From: support Date: Wed, 18 May 2022 09:54:59 +0000 (+0000) Subject: Built motion from commit 538092ac.|2.6.10 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=69e298f4b4377233837118e5e5da70d3cc4a8b21;p=motion2.git Built motion from commit 538092ac.|2.6.10 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e75763e..1468f82 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-05-18T09:03:59.794Z", + "time": "2022-05-18T09:47:45.353Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 07ae97b..ad2c0e8 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-05-18T09:03:59.794Z", + "time": "2022-05-18T09:47:45.353Z", "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 f7eef83..c0931aa 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 _0x442b=['getDataValue','action','STRING','contactManager','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','VIRTUAL'];(function(_0x43bba8,_0x2dbfda){var _0x21178c=function(_0x49ab2e){while(--_0x49ab2e){_0x43bba8['push'](_0x43bba8['shift']());}};_0x21178c(++_0x2dbfda);}(_0x442b,0x15e));var _0xb442=function(_0x8bc9ec,_0x37d942){_0x8bc9ec=_0x8bc9ec-0x0;var _0x1c9c15=_0x442b[_0x8bc9ec];return _0x1c9c15;};'use strict';var Sequelize=require(_0xb442('0x0'));module['exports']={'name':{'type':Sequelize[_0xb442('0x1')],'get':function(_0x3f826c){return this[_0xb442('0x2')](_0xb442('0x3'));}},'action':{'type':Sequelize[_0xb442('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb442('0x5'),'integration','motionbar',_0xb442('0x6'),_0xb442('0x7'),_0xb442('0x8'),_0xb442('0x9'),_0xb442('0xa')]],'msg':_0xb442('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xb442('0x4')](0x1000),'comment':_0xb442('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xb442('0x4')](0x1000),'comment':_0xb442('0xd')},'data4':{'type':Sequelize[_0xb442('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xb442('0xe')},'data6':{'type':Sequelize[_0xb442('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xb442('0xf')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xde11=['STRING','motionbar','jscripty','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xde11,0x73));var _0x1de1=function(_0x17198d,_0xbe353b){_0x17198d=_0x17198d-0x0;var _0x1db057=_0xde11[_0x17198d];return _0x1db057;};'use strict';var Sequelize=require('sequelize');module[_0x1de1('0x0')]={'name':{'type':Sequelize[_0x1de1('0x1')],'get':function(_0x13ff36){return this[_0x1de1('0x2')](_0x1de1('0x3'));}},'action':{'type':Sequelize[_0x1de1('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x1de1('0x5'),_0x1de1('0x6'),'urlForward',_0x1de1('0x7'),_0x1de1('0x8'),'script']],'msg':_0x1de1('0x9')}},'comment':_0x1de1('0x9')},'data1':{'type':Sequelize[_0x1de1('0x4')](0x1000),'comment':_0x1de1('0xa')},'data2':{'type':Sequelize[_0x1de1('0x4')](0x1000),'comment':_0x1de1('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x1de1('0xc')},'data4':{'type':Sequelize[_0x1de1('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x1de1('0xd')},'data6':{'type':Sequelize[_0x1de1('0x4')],'comments':_0x1de1('0xe')},'data7':{'type':Sequelize[_0x1de1('0xf')],'comments':_0x1de1('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1e2cda8..7608d3d 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 _0xb215=['undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','body','Action','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4321a4,_0x431dfe){var _0x4ad705=function(_0x23914b){while(--_0x23914b){_0x4321a4['push'](_0x4321a4['shift']());}};_0x4ad705(++_0x431dfe);}(_0xb215,0x124));var _0x5b21=function(_0x1adbcb,_0x26704d){_0x1adbcb=_0x1adbcb-0x0;var _0x51e89f=_0xb215[_0x1adbcb];return _0x51e89f;};'use strict';var emlformat=require(_0x5b21('0x0'));var rimraf=require(_0x5b21('0x1'));var zipdir=require(_0x5b21('0x2'));var jsonpatch=require(_0x5b21('0x3'));var rp=require('request-promise');var moment=require(_0x5b21('0x4'));var BPromise=require(_0x5b21('0x5'));var Mustache=require(_0x5b21('0x6'));var util=require(_0x5b21('0x7'));var path=require(_0x5b21('0x8'));var sox=require(_0x5b21('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b21('0xa'));var squel=require('squel');var crypto=require(_0x5b21('0xb'));var jsforce=require(_0x5b21('0xc'));var deskjs=require(_0x5b21('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5b21('0xe'));var Papa=require(_0x5b21('0xf'));var Redis=require(_0x5b21('0x10'));var authService=require(_0x5b21('0x11'));var qs=require(_0x5b21('0x12'));var as=require(_0x5b21('0x13'));var hardwareService=require(_0x5b21('0x14'));var logger=require('../../config/logger')(_0x5b21('0x15'));var utils=require(_0x5b21('0x16'));var config=require(_0x5b21('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b21('0x18'))['db'];function respondWithStatusCode(_0x32ca6b,_0xeab554){_0xeab554=_0xeab554||0xcc;return function(_0x5d5c0e){if(_0x5d5c0e){return _0x32ca6b[_0x5b21('0x19')](_0xeab554);}return _0x32ca6b[_0x5b21('0x1a')](_0xeab554)[_0x5b21('0x1b')]();};}function respondWithResult(_0x5d8e50,_0x2e6d4e){_0x2e6d4e=_0x2e6d4e||0xc8;return function(_0x3c9414){if(_0x3c9414){return _0x5d8e50[_0x5b21('0x1a')](_0x2e6d4e)[_0x5b21('0x1c')](_0x3c9414);}};}function respondWithFilteredResult(_0x3b151f,_0x2eb4bf){return function(_0x3dbc2a){if(_0x3dbc2a){var _0x3ab8c9=typeof _0x2eb4bf[_0x5b21('0x1d')]===_0x5b21('0x1e')&&typeof _0x2eb4bf['limit']===_0x5b21('0x1e');var _0x4827ee=_0x3dbc2a['count'];var _0x3484f3=_0x3ab8c9?0x0:_0x2eb4bf[_0x5b21('0x1d')];var _0x344e7e=_0x3ab8c9?_0x3dbc2a[_0x5b21('0x1f')]:_0x2eb4bf[_0x5b21('0x1d')]+_0x2eb4bf[_0x5b21('0x20')];var _0x325b4f;if(_0x344e7e>=_0x4827ee){_0x344e7e=_0x4827ee;_0x325b4f=0xc8;}else{_0x325b4f=0xce;}_0x3b151f['status'](_0x325b4f);return _0x3b151f['set'](_0x5b21('0x21'),_0x3484f3+'-'+_0x344e7e+'/'+_0x4827ee)[_0x5b21('0x1c')](_0x3dbc2a);}return null;};}function patchUpdates(_0x184b8d){return function(_0x22935f){try{jsonpatch[_0x5b21('0x22')](_0x22935f,_0x184b8d,!![]);}catch(_0x3ff578){return BPromise[_0x5b21('0x23')](_0x3ff578);}return _0x22935f['save']();};}function saveUpdates(_0x41da46,_0x35f0ab){return function(_0x2f0da6){if(_0x2f0da6){return _0x2f0da6[_0x5b21('0x24')](_0x41da46)[_0x5b21('0x25')](function(_0x5395c6){return _0x5395c6;});}return null;};}function removeEntity(_0x422908,_0x41f9d1){return function(_0x48dbe3){if(_0x48dbe3){return _0x48dbe3['destroy']()[_0x5b21('0x25')](function(){_0x422908['status'](0xcc)[_0x5b21('0x1b')]();});}};}function handleEntityNotFound(_0xe29a59,_0x4c8f2b){return function(_0x5e809b){if(!_0x5e809b){_0xe29a59[_0x5b21('0x19')](0x194);}return _0x5e809b;};}function handleError(_0x19d897,_0x35a547){_0x35a547=_0x35a547||0x1f4;return function(_0x50f673){logger['error'](_0x50f673[_0x5b21('0x26')]);if(_0x50f673[_0x5b21('0x27')]){delete _0x50f673['name'];}_0x19d897[_0x5b21('0x1a')](_0x35a547)[_0x5b21('0x28')](_0x50f673);};}exports['update']=function(_0x4d9e04,_0x61794e){if(_0x4d9e04['body']['id']){delete _0x4d9e04[_0x5b21('0x29')]['id'];}return db[_0x5b21('0x2a')]['find']({'where':{'id':_0x4d9e04[_0x5b21('0x2b')]['id']}})[_0x5b21('0x25')](handleEntityNotFound(_0x61794e,null))[_0x5b21('0x25')](saveUpdates(_0x4d9e04['body'],null))[_0x5b21('0x25')](respondWithResult(_0x61794e,null))[_0x5b21('0x2c')](handleError(_0x61794e,null));};exports[_0x5b21('0x2d')]=function(_0x414383,_0x15b402){return db[_0x5b21('0x2a')]['find']({'where':{'id':_0x414383['params']['id']}})[_0x5b21('0x25')](handleEntityNotFound(_0x15b402,null))[_0x5b21('0x25')](removeEntity(_0x15b402,null))[_0x5b21('0x2c')](handleError(_0x15b402,null));}; \ No newline at end of file +var _0xc281=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','body','Action','find','then','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x4a8c24,_0x55e301){var _0x505ea8=function(_0x31a565){while(--_0x31a565){_0x4a8c24['push'](_0x4a8c24['shift']());}};_0x505ea8(++_0x55e301);}(_0xc281,0x146));var _0x1c28=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0xc281[_0x5cc61d];return _0x2e25d0;};'use strict';var emlformat=require(_0x1c28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c28('0x1'));var rp=require(_0x1c28('0x2'));var moment=require(_0x1c28('0x3'));var BPromise=require(_0x1c28('0x4'));var Mustache=require(_0x1c28('0x5'));var util=require(_0x1c28('0x6'));var path=require(_0x1c28('0x7'));var sox=require(_0x1c28('0x8'));var csv=require('to-csv');var ejs=require(_0x1c28('0x9'));var fs=require('fs');var fs_extra=require(_0x1c28('0xa'));var _=require(_0x1c28('0xb'));var squel=require(_0x1c28('0xc'));var crypto=require(_0x1c28('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1c28('0xe'));var toCsv=require(_0x1c28('0xf'));var querystring=require(_0x1c28('0x10'));var Papa=require(_0x1c28('0x11'));var Redis=require(_0x1c28('0x12'));var authService=require(_0x1c28('0x13'));var qs=require(_0x1c28('0x14'));var as=require(_0x1c28('0x15'));var hardwareService=require(_0x1c28('0x16'));var logger=require('../../config/logger')(_0x1c28('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1c28('0x18'));var db=require(_0x1c28('0x19'))['db'];function respondWithStatusCode(_0x48ca2f,_0x772ee9){_0x772ee9=_0x772ee9||0xcc;return function(_0x282b8c){if(_0x282b8c){return _0x48ca2f[_0x1c28('0x1a')](_0x772ee9);}return _0x48ca2f[_0x1c28('0x1b')](_0x772ee9)['end']();};}function respondWithResult(_0x32878c,_0x14e2c4){_0x14e2c4=_0x14e2c4||0xc8;return function(_0x2e02e2){if(_0x2e02e2){return _0x32878c['status'](_0x14e2c4)[_0x1c28('0x1c')](_0x2e02e2);}};}function respondWithFilteredResult(_0x25d1a8,_0x5973f7){return function(_0xbc811b){if(_0xbc811b){var _0x3b638f=typeof _0x5973f7[_0x1c28('0x1d')]===_0x1c28('0x1e')&&typeof _0x5973f7['limit']==='undefined';var _0x169b67=_0xbc811b[_0x1c28('0x1f')];var _0x1bba44=_0x3b638f?0x0:_0x5973f7[_0x1c28('0x1d')];var _0x3552c6=_0x3b638f?_0xbc811b['count']:_0x5973f7[_0x1c28('0x1d')]+_0x5973f7[_0x1c28('0x20')];var _0x23c9bb;if(_0x3552c6>=_0x169b67){_0x3552c6=_0x169b67;_0x23c9bb=0xc8;}else{_0x23c9bb=0xce;}_0x25d1a8[_0x1c28('0x1b')](_0x23c9bb);return _0x25d1a8[_0x1c28('0x21')](_0x1c28('0x22'),_0x1bba44+'-'+_0x3552c6+'/'+_0x169b67)[_0x1c28('0x1c')](_0xbc811b);}return null;};}function patchUpdates(_0x1da3b3){return function(_0x58d6a9){try{jsonpatch[_0x1c28('0x23')](_0x58d6a9,_0x1da3b3,!![]);}catch(_0x4aa7d0){return BPromise[_0x1c28('0x24')](_0x4aa7d0);}return _0x58d6a9[_0x1c28('0x25')]();};}function saveUpdates(_0x7dba52,_0x4ba613){return function(_0x2956e6){if(_0x2956e6){return _0x2956e6[_0x1c28('0x26')](_0x7dba52)['then'](function(_0x3db8d4){return _0x3db8d4;});}return null;};}function removeEntity(_0x31c7fa,_0x135b0e){return function(_0xbbe5d8){if(_0xbbe5d8){return _0xbbe5d8[_0x1c28('0x27')]()['then'](function(){_0x31c7fa[_0x1c28('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x214fbc,_0x35b222){return function(_0x1e0404){if(!_0x1e0404){_0x214fbc[_0x1c28('0x1a')](0x194);}return _0x1e0404;};}function handleError(_0x56b821,_0x123950){_0x123950=_0x123950||0x1f4;return function(_0x37022c){logger[_0x1c28('0x28')](_0x37022c[_0x1c28('0x29')]);if(_0x37022c[_0x1c28('0x2a')]){delete _0x37022c[_0x1c28('0x2a')];}_0x56b821[_0x1c28('0x1b')](_0x123950)[_0x1c28('0x2b')](_0x37022c);};}exports['update']=function(_0x16fd5b,_0x30096d){if(_0x16fd5b[_0x1c28('0x2c')]['id']){delete _0x16fd5b[_0x1c28('0x2c')]['id'];}return db[_0x1c28('0x2d')][_0x1c28('0x2e')]({'where':{'id':_0x16fd5b['params']['id']}})[_0x1c28('0x2f')](handleEntityNotFound(_0x30096d,null))['then'](saveUpdates(_0x16fd5b[_0x1c28('0x2c')],null))[_0x1c28('0x2f')](respondWithResult(_0x30096d,null))['catch'](handleError(_0x30096d,null));};exports[_0x1c28('0x27')]=function(_0x2d93a9,_0x376e29){return db['Action'][_0x1c28('0x2e')]({'where':{'id':_0x2d93a9[_0x1c28('0x30')]['id']}})[_0x1c28('0x2f')](handleEntityNotFound(_0x376e29,null))[_0x1c28('0x2f')](removeEntity(_0x376e29,null))['catch'](handleError(_0x376e29,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 52dd9b0..c8ff270 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 _0x330c=['./action.attributes','exports','define','Action','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e20fb,_0x5b5c93){var _0x5e445a=function(_0x425bb3){while(--_0x425bb3){_0x2e20fb['push'](_0x2e20fb['shift']());}};_0x5e445a(++_0x5b5c93);}(_0x330c,0x14e));var _0xc330=function(_0x5b8d58,_0x1f18e7){_0x5b8d58=_0x5b8d58-0x0;var _0x34e8ed=_0x330c[_0x5b8d58];return _0x34e8ed;};'use strict';var _=require('lodash');var util=require(_0xc330('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc330('0x1'));var BPromise=require(_0xc330('0x2'));var rp=require(_0xc330('0x3'));var fs=require('fs');var path=require(_0xc330('0x4'));var rimraf=require(_0xc330('0x5'));var config=require('../../config/environment');var attributes=require(_0xc330('0x6'));module[_0xc330('0x7')]=function(_0x2faeec,_0x329d61){return _0x2faeec[_0xc330('0x8')](_0xc330('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaee=['rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x20a9ad,_0x274978){var _0x419337=function(_0x567614){while(--_0x567614){_0x20a9ad['push'](_0x20a9ad['shift']());}};_0x419337(++_0x274978);}(_0xcaee,0x13e));var _0xecae=function(_0x41b8b4,_0x2b8e54){_0x41b8b4=_0x41b8b4-0x0;var _0x186585=_0xcaee[_0x41b8b4];return _0x186585;};'use strict';var _=require(_0xecae('0x0'));var util=require(_0xecae('0x1'));var logger=require(_0xecae('0x2'))(_0xecae('0x3'));var moment=require('moment');var BPromise=require(_0xecae('0x4'));var rp=require(_0xecae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xecae('0x6'));var config=require(_0xecae('0x7'));var attributes=require(_0xecae('0x8'));module[_0xecae('0x9')]=function(_0x11fc01,_0x3243da){return _0x11fc01[_0xecae('0xa')]('Action',attributes,{'tableName':_0xecae('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 41f9754..5094553 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5712a9,_0xadd114){var _0x5afdb1=function(_0x3229e5){while(--_0x3229e5){_0x5712a9['push'](_0x5712a9['shift']());}};_0x5afdb1(++_0xadd114);}(_0x1261,0x144));var _0x1126=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x1261[_0x28f32c];return _0x355402;};'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')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2e69d99..b6e6cb4 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 _0xd791=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout'];(function(_0x114273,_0x55c289){var _0x40d19c=function(_0x2bca54){while(--_0x2bca54){_0x114273['push'](_0x114273['shift']());}};_0x40d19c(++_0x55c289);}(_0xd791,0x137));var _0x1d79=function(_0x482d06,_0x1c7c4a){_0x482d06=_0x482d06-0x0;var _0x3bdd88=_0xd791[_0x482d06];return _0x3bdd88;};'use strict';var multer=require(_0x1d79('0x0'));var util=require(_0x1d79('0x1'));var path=require(_0x1d79('0x2'));var timeout=require(_0x1d79('0x3'));var express=require(_0x1d79('0x4'));var router=express[_0x1d79('0x5')]();var fs_extra=require(_0x1d79('0x6'));var auth=require(_0x1d79('0x7'));var interaction=require(_0x1d79('0x8'));var config=require(_0x1d79('0x9'));var controller=require(_0x1d79('0xa'));router['put'](_0x1d79('0xb'),auth[_0x1d79('0xc')](),controller[_0x1d79('0xd')]);router['delete'](_0x1d79('0xb'),auth[_0x1d79('0xc')](),controller['destroy']);module[_0x1d79('0xe')]=router; \ No newline at end of file +var _0xf687=['../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','exports','multer','util','path','express','../../components/auth/service'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xf687,0x140));var _0x7f68=function(_0x306ee6,_0x16febb){_0x306ee6=_0x306ee6-0x0;var _0x47ab12=_0xf687[_0x306ee6];return _0x47ab12;};'use strict';var multer=require(_0x7f68('0x0'));var util=require(_0x7f68('0x1'));var path=require(_0x7f68('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f68('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7f68('0x4'));var interaction=require(_0x7f68('0x5'));var config=require(_0x7f68('0x6'));var controller=require(_0x7f68('0x7'));router[_0x7f68('0x8')](_0x7f68('0x9'),auth[_0x7f68('0xa')](),controller[_0x7f68('0xb')]);router['delete']('/:id',auth[_0x7f68('0xa')](),controller['destroy']);module[_0x7f68('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 81770ad..c836c77 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 _0x5d58=['TEXT','STRING'];(function(_0x42fdd2,_0x36dd0b){var _0x2a32ab=function(_0x10424d){while(--_0x10424d){_0x42fdd2['push'](_0x42fdd2['shift']());}};_0x2a32ab(++_0x36dd0b);}(_0x5d58,0x187));var _0x85d5=function(_0x57e644,_0x532fd5){_0x57e644=_0x57e644-0x0;var _0x44ac94=_0x5d58[_0x57e644];return _0x44ac94;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x4499e0,_0x1a3b48){var _0x548bd9=function(_0x473f4a){while(--_0x473f4a){_0x4499e0['push'](_0x4499e0['shift']());}};_0x548bd9(++_0x1a3b48);}(_0xe14b,0x93));var _0xbe14=function(_0x102233,_0x532545){_0x102233=_0x102233-0x0;var _0x36465c=_0xe14b[_0x102233];return _0x36465c;};'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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b240e43..ddca78c 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 _0xbf3c=['undefined','limit','count','status','set','Content-Range','reject','save','then','get','CustomReports','UserProfileResource','destroy','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','table','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','IS\x20NULL','value','getFields','alias','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','right_join','COUNT(%s)','AnalyticMetric','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset'];(function(_0x5c74b4,_0x2b75ae){var _0x259f96=function(_0x5e2997){while(--_0x5e2997){_0x5c74b4['push'](_0x5c74b4['shift']());}};_0x259f96(++_0x2b75ae);}(_0xbf3c,0x1ce));var _0xcbf3=function(_0x49653d,_0x46c789){_0x49653d=_0x49653d-0x0;var _0x51a7e7=_0xbf3c[_0x49653d];return _0x51a7e7;};'use strict';var emlformat=require(_0xcbf3('0x0'));var rimraf=require(_0xcbf3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcbf3('0x2'));var rp=require('request-promise');var moment=require(_0xcbf3('0x3'));var BPromise=require(_0xcbf3('0x4'));var Mustache=require(_0xcbf3('0x5'));var util=require(_0xcbf3('0x6'));var path=require(_0xcbf3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcbf3('0x8'));var _=require(_0xcbf3('0x9'));var squel=require(_0xcbf3('0xa'));var crypto=require(_0xcbf3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcbf3('0xc'));var toCsv=require(_0xcbf3('0xd'));var querystring=require(_0xcbf3('0xe'));var Papa=require('papaparse');var Redis=require(_0xcbf3('0xf'));var authService=require(_0xcbf3('0x10'));var qs=require(_0xcbf3('0x11'));var as=require(_0xcbf3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbf3('0x13'))('api');var utils=require(_0xcbf3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcbf3('0x15'));var db=require(_0xcbf3('0x16'))['db'];var dbH=require(_0xcbf3('0x16'))['dbH'];function respondWithStatusCode(_0x365273,_0x38ba52){_0x38ba52=_0x38ba52||0xcc;return function(_0x446a24){if(_0x446a24){return _0x365273[_0xcbf3('0x17')](_0x38ba52);}return _0x365273['status'](_0x38ba52)[_0xcbf3('0x18')]();};}function respondWithResult(_0x2d7f54,_0x37a385){_0x37a385=_0x37a385||0xc8;return function(_0x20283d){if(_0x20283d){return _0x2d7f54['status'](_0x37a385)[_0xcbf3('0x19')](_0x20283d);}};}function respondWithFilteredResult(_0x13c768,_0x4b1368){return function(_0x11075f){if(_0x11075f){var _0x18ea57=typeof _0x4b1368[_0xcbf3('0x1a')]===_0xcbf3('0x1b')&&typeof _0x4b1368[_0xcbf3('0x1c')]===_0xcbf3('0x1b');var _0x3a29ac=_0x11075f[_0xcbf3('0x1d')];var _0x334290=_0x18ea57?0x0:_0x4b1368[_0xcbf3('0x1a')];var _0x2537ef=_0x18ea57?_0x11075f[_0xcbf3('0x1d')]:_0x4b1368[_0xcbf3('0x1a')]+_0x4b1368['limit'];var _0x32fa16;if(_0x2537ef>=_0x3a29ac){_0x2537ef=_0x3a29ac;_0x32fa16=0xc8;}else{_0x32fa16=0xce;}_0x13c768[_0xcbf3('0x1e')](_0x32fa16);return _0x13c768[_0xcbf3('0x1f')](_0xcbf3('0x20'),_0x334290+'-'+_0x2537ef+'/'+_0x3a29ac)[_0xcbf3('0x19')](_0x11075f);}return null;};}function patchUpdates(_0x56bc55){return function(_0x1dfb8f){try{jsonpatch['apply'](_0x1dfb8f,_0x56bc55,!![]);}catch(_0x725603){return BPromise[_0xcbf3('0x21')](_0x725603);}return _0x1dfb8f[_0xcbf3('0x22')]();};}function saveUpdates(_0x2f4ae1,_0x273a0a){return function(_0x58a754){if(_0x58a754){return _0x58a754['update'](_0x2f4ae1)[_0xcbf3('0x23')](function(_0x25d45e){return _0x25d45e;});}return null;};}function removeEntity(_0x4d8c3b,_0x5c43db){return function(_0x18b054){if(_0x18b054){return _0x18b054['destroy']()[_0xcbf3('0x23')](function(){var _0x1feeb3=_0x18b054[_0xcbf3('0x24')]({'plain':!![]});var _0x21663a=_0xcbf3('0x25');return db[_0xcbf3('0x26')][_0xcbf3('0x27')]({'where':{'type':_0x21663a,'resourceId':_0x1feeb3['id']}})['then'](function(){return _0x18b054;});})[_0xcbf3('0x23')](function(){_0x4d8c3b[_0xcbf3('0x1e')](0xcc)[_0xcbf3('0x18')]();});}};}function handleEntityNotFound(_0x318b39,_0xe9fcbe){return function(_0x4a69d3){if(!_0x4a69d3){_0x318b39[_0xcbf3('0x17')](0x194);}return _0x4a69d3;};}function handleError(_0x2be897,_0x41eb0b){_0x41eb0b=_0x41eb0b||0x1f4;return function(_0x41900f){logger['error'](_0x41900f['stack']);if(_0x41900f[_0xcbf3('0x28')]){delete _0x41900f['name'];}_0x2be897['status'](_0x41eb0b)[_0xcbf3('0x29')](_0x41900f);};}exports[_0xcbf3('0x2a')]=function(_0x31979c,_0x496ba8){var _0x25e9dc={},_0x14434b={},_0x57ea19={'count':0x0,'rows':[]};var _0x13a8ab=_['map'](db[_0xcbf3('0x2b')][_0xcbf3('0x2c')],function(_0x30b482){return{'name':_0x30b482[_0xcbf3('0x2d')],'type':_0x30b482[_0xcbf3('0x2e')][_0xcbf3('0x2f')]};});_0x14434b[_0xcbf3('0x30')]=_[_0xcbf3('0x31')](_0x13a8ab,_0xcbf3('0x28'));_0x14434b[_0xcbf3('0x32')]=_[_0xcbf3('0x33')](_0x31979c[_0xcbf3('0x32')]);_0x14434b[_0xcbf3('0x34')]=_[_0xcbf3('0x35')](_0x14434b['model'],_0x14434b['query']);_0x25e9dc[_0xcbf3('0x36')]=_[_0xcbf3('0x35')](_0x14434b[_0xcbf3('0x30')],qs[_0xcbf3('0x37')](_0x31979c['query'][_0xcbf3('0x37')]));_0x25e9dc['attributes']=_0x25e9dc[_0xcbf3('0x36')][_0xcbf3('0x38')]?_0x25e9dc['attributes']:_0x14434b['model'];if(!_0x31979c['query'][_0xcbf3('0x39')](_0xcbf3('0x3a'))){_0x25e9dc['limit']=qs[_0xcbf3('0x1c')](_0x31979c['query'][_0xcbf3('0x1c')]);_0x25e9dc[_0xcbf3('0x1a')]=qs[_0xcbf3('0x1a')](_0x31979c[_0xcbf3('0x32')]['offset']);}_0x25e9dc[_0xcbf3('0x3b')]=qs['sort'](_0x31979c[_0xcbf3('0x32')][_0xcbf3('0x3c')]);_0x25e9dc[_0xcbf3('0x3d')]=qs[_0xcbf3('0x34')](_['pick'](_0x31979c[_0xcbf3('0x32')],_0x14434b[_0xcbf3('0x34')]),_0x13a8ab);if(_0x31979c[_0xcbf3('0x32')][_0xcbf3('0x3e')]){_0x25e9dc[_0xcbf3('0x3d')]=_[_0xcbf3('0x3f')](_0x25e9dc['where'],{'$or':_[_0xcbf3('0x31')](_0x13a8ab,function(_0x286828){if(_0x286828[_0xcbf3('0x2e')]!==_0xcbf3('0x40')){var _0x39b92f={};_0x39b92f[_0x286828[_0xcbf3('0x28')]]={'$like':'%'+_0x31979c['query'][_0xcbf3('0x3e')]+'%'};return _0x39b92f;}})});}_0x25e9dc=_['merge']({},_0x25e9dc,_0x31979c[_0xcbf3('0x41')]);var _0x58110f={'where':_0x25e9dc['where']};return db[_0xcbf3('0x2b')][_0xcbf3('0x1d')](_0x58110f)[_0xcbf3('0x23')](function(_0x27d2e7){_0x57ea19['count']=_0x27d2e7;if(_0x31979c[_0xcbf3('0x32')]['includeAll']){_0x25e9dc[_0xcbf3('0x42')]=[{'all':!![]}];}return db[_0xcbf3('0x2b')][_0xcbf3('0x43')](_0x25e9dc);})[_0xcbf3('0x23')](function(_0x1083ee){_0x57ea19[_0xcbf3('0x44')]=_0x1083ee;return _0x57ea19;})['then'](respondWithFilteredResult(_0x496ba8,_0x25e9dc))[_0xcbf3('0x45')](handleError(_0x496ba8,null));};exports['show']=function(_0x5ee7bd,_0x4b053e){var _0x7f0e3c={'raw':![],'where':{'id':_0x5ee7bd[_0xcbf3('0x46')]['id']}},_0x2ca0de={};_0x2ca0de[_0xcbf3('0x30')]=_[_0xcbf3('0x33')](db[_0xcbf3('0x2b')]['rawAttributes']);_0x2ca0de[_0xcbf3('0x32')]=_['keys'](_0x5ee7bd['query']);_0x2ca0de[_0xcbf3('0x34')]=_['intersection'](_0x2ca0de['model'],_0x2ca0de[_0xcbf3('0x32')]);_0x7f0e3c[_0xcbf3('0x36')]=_[_0xcbf3('0x35')](_0x2ca0de[_0xcbf3('0x30')],qs['fields'](_0x5ee7bd['query'][_0xcbf3('0x37')]));_0x7f0e3c['attributes']=_0x7f0e3c[_0xcbf3('0x36')][_0xcbf3('0x38')]?_0x7f0e3c[_0xcbf3('0x36')]:_0x2ca0de['model'];if(_0x5ee7bd[_0xcbf3('0x32')][_0xcbf3('0x47')]){_0x7f0e3c[_0xcbf3('0x42')]=[{'all':!![]}];}_0x7f0e3c=_[_0xcbf3('0x3f')]({},_0x7f0e3c,_0x5ee7bd[_0xcbf3('0x41')]);return db[_0xcbf3('0x2b')]['find'](_0x7f0e3c)[_0xcbf3('0x23')](handleEntityNotFound(_0x4b053e,null))['then'](respondWithResult(_0x4b053e,null))[_0xcbf3('0x45')](handleError(_0x4b053e,null));};exports['create']=function(_0x171c24,_0x2b72ec){return db[_0xcbf3('0x2b')][_0xcbf3('0x48')](_0x171c24['body'],{})[_0xcbf3('0x23')](function(_0x450e1f){var _0x26b74a=_0x171c24[_0xcbf3('0x49')][_0xcbf3('0x24')]({'plain':!![]});if(!_0x26b74a)throw new Error(_0xcbf3('0x4a'));if(_0x26b74a['role']===_0xcbf3('0x49')){var _0x147f17=_0x450e1f[_0xcbf3('0x24')]({'plain':!![]});var _0x257d21='Reports';return db[_0xcbf3('0x4b')][_0xcbf3('0x4c')]({'where':{'name':_0x257d21,'userProfileId':_0x26b74a[_0xcbf3('0x4d')]},'raw':!![]})[_0xcbf3('0x23')](function(_0x2f0f3e){if(_0x2f0f3e&&_0x2f0f3e['autoAssociation']===0x0){return db[_0xcbf3('0x26')][_0xcbf3('0x48')]({'name':_0x147f17[_0xcbf3('0x28')],'resourceId':_0x147f17['id'],'type':_0xcbf3('0x25'),'sectionId':_0x2f0f3e['id']},{})[_0xcbf3('0x23')](function(){return _0x450e1f;});}else{return _0x450e1f;}})[_0xcbf3('0x45')](function(_0x325df8){logger[_0xcbf3('0x4e')](_0xcbf3('0x4f'),_0x325df8);throw _0x325df8;});}return _0x450e1f;})[_0xcbf3('0x23')](respondWithResult(_0x2b72ec,0xc9))[_0xcbf3('0x45')](handleError(_0x2b72ec,null));};exports[_0xcbf3('0x50')]=function(_0x1f1aee,_0x5d867c){if(_0x1f1aee[_0xcbf3('0x51')]['id']){delete _0x1f1aee[_0xcbf3('0x51')]['id'];}return db['AnalyticCustomReport'][_0xcbf3('0x4c')]({'where':{'id':_0x1f1aee['params']['id']}})[_0xcbf3('0x23')](handleEntityNotFound(_0x5d867c,null))[_0xcbf3('0x23')](saveUpdates(_0x1f1aee[_0xcbf3('0x51')],null))[_0xcbf3('0x23')](respondWithResult(_0x5d867c,null))[_0xcbf3('0x45')](handleError(_0x5d867c,null));};exports[_0xcbf3('0x27')]=function(_0x1afd84,_0x30bd9d){return db[_0xcbf3('0x2b')][_0xcbf3('0x4c')]({'where':{'id':_0x1afd84['params']['id']}})[_0xcbf3('0x23')](handleEntityNotFound(_0x30bd9d,null))[_0xcbf3('0x23')](removeEntity(_0x30bd9d,null))[_0xcbf3('0x45')](handleError(_0x30bd9d,null));};exports[_0xcbf3('0x52')]=function(_0x4c4547,_0x40fe2b){var _0x49a39c=0xa;var _0x16fe38=['join',_0xcbf3('0x53'),'right_join',_0xcbf3('0x54')];var _0x28eb18={'SUM':_0xcbf3('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcbf3('0x56'),'MAX':_0xcbf3('0x57'),'MIN':_0xcbf3('0x58'),'AVG':_0xcbf3('0x59'),'GROUP_CONCAT':_0xcbf3('0x5a'),'GROUP_CONCAT ASC':_0xcbf3('0x5b'),'GROUP_CONCAT DESC':_0xcbf3('0x5c')};var _0x1fea1c={'SEC_TO_TIME':_0xcbf3('0x5d'),'DATE':_0xcbf3('0x5e'),'HOUR':_0xcbf3('0x5f'),'ROUND':_0xcbf3('0x60'),'UNIX_TIMESTAMP':_0xcbf3('0x61')};var _0x21557f=function(_0x5eef92){return!_[_0xcbf3('0x62')](['IS\x20NULL',_0xcbf3('0x63'),_0xcbf3('0x64'),_0xcbf3('0x65')],_0x5eef92);};var _0x477c13=function(_0x3a6725){if(!_0x3a6725||!_0x3a6725['rules'][_0xcbf3('0x38')]){return'';}for(var _0x476c46='(',_0xc8e0bd=0x0;_0xc8e0bd<_0x3a6725[_0xcbf3('0x66')][_0xcbf3('0x38')];_0xc8e0bd+=0x1){_0xc8e0bd>0x0&&(_0x476c46+='\x20'+_0x3a6725[_0xcbf3('0x67')]+'\x20');_0x476c46+=_0x3a6725[_0xcbf3('0x66')][_0xc8e0bd][_0xcbf3('0x68')]?_0x477c13(_0x3a6725[_0xcbf3('0x66')][_0xc8e0bd][_0xcbf3('0x68')]):_0x3a6725[_0xcbf3('0x66')][_0xc8e0bd]['field']+'\x20'+_0x3a6725[_0xcbf3('0x66')][_0xc8e0bd]['condition']+(_0x21557f(_0x3a6725[_0xcbf3('0x66')][_0xc8e0bd][_0xcbf3('0x69')])?'\x20'+_0x3a6725[_0xcbf3('0x66')][_0xc8e0bd]['value']:'');}return _0x476c46+')';};var _0x163df2={'where':{'id':_0x4c4547['params']['id']}},_0x1f07f7,_0x1ff8df,_0x3b9b2a,_0xb731c2,_0x4eba5c;_0x163df2=_[_0xcbf3('0x3f')]({},_0x163df2,_0x4c4547[_0xcbf3('0x41')]);return db[_0xcbf3('0x2b')][_0xcbf3('0x4c')](_0x163df2)[_0xcbf3('0x23')](function(_0x3f5801){if(_0x3f5801){_0x1f07f7=_0x3f5801;return _0x3f5801['getFields']();}return null;})[_0xcbf3('0x23')](function(_0x22d3ab){if(_0x22d3ab){if(!_0x22d3ab[_0xcbf3('0x38')]){throw new db[(_0xcbf3('0x6a'))][(_0xcbf3('0x6b'))](_0xcbf3('0x6c'),0x193);}_0x1ff8df=_0x22d3ab;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x11090c){if(_0x11090c){_0x3b9b2a=_[_0xcbf3('0x6d')](_0x11090c,'id');var _0x40de84;var _0x1cd82e=squel[_0xcbf3('0x6e')]();_0x1cd82e[_0xcbf3('0x6f')](_0x1f07f7['table']);for(var _0x2aed26=0x0;_0x2aed26<_0x1ff8df['length'];_0x2aed26+=0x1){_0x40de84=_0x1ff8df[_0x2aed26][_0xcbf3('0x70')]?_0x3b9b2a[_0x1ff8df[_0x2aed26]['MetricId']][_0xcbf3('0x71')]:_0x1ff8df[_0x2aed26][_0xcbf3('0x72')];_0x40de84=_0x1ff8df[_0x2aed26][_0xcbf3('0x73')]?_[_0xcbf3('0x74')](_0x28eb18[_0x1ff8df[_0x2aed26]['function']],'%s',_0x40de84):_0x40de84;_0x40de84=_0x1ff8df[_0x2aed26][_0xcbf3('0x75')]?_[_0xcbf3('0x74')](_0x1fea1c[_0x1ff8df[_0x2aed26][_0xcbf3('0x75')]],'%s',_0x40de84):_0x40de84;if(_0x1ff8df[_0x2aed26][_0xcbf3('0x76')]){_0x1cd82e[_0xcbf3('0x68')](_0x40de84);}_0x1ff8df[_0x2aed26][_0xcbf3('0x77')]&&_0x1cd82e[_0xcbf3('0x3b')](_0x40de84,_0x1ff8df[_0x2aed26]['orderBy']===_0xcbf3('0x78')?![]:!![]);_0x1cd82e['field'](_0x40de84,_0x1ff8df[_0x2aed26]['alias']||_0x40de84);}if(_0x1f07f7[_0xcbf3('0x79')]){_0x1f07f7[_0xcbf3('0x79')]=JSON[_0xcbf3('0x7a')](_0x1f07f7['joins']);for(var _0x1dbf53=0x0;_0x1dbf53<_0x1f07f7[_0xcbf3('0x79')][_0xcbf3('0x38')];_0x1dbf53+=0x1){if(_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53][_0xcbf3('0x2e')]&&_[_0xcbf3('0x62')](_0x16fe38,_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53][_0xcbf3('0x2e')])&&_0x1f07f7['joins'][_0x1dbf53][_0xcbf3('0x7b')]&&_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53][_0xcbf3('0x7c')]&&_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53]['foreignKey']){_0x1cd82e[_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53][_0xcbf3('0x2e')]](_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53][_0xcbf3('0x7c')],null,util[_0xcbf3('0x75')]('%s.%s\x20=\x20%s.%s',_0x1f07f7[_0xcbf3('0x7d')],_0x1f07f7['joins'][_0x1dbf53][_0xcbf3('0x7b')],_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53][_0xcbf3('0x7c')],_0x1f07f7[_0xcbf3('0x79')][_0x1dbf53][_0xcbf3('0x7e')]));}}}if(_0x1f07f7[_0xcbf3('0x7f')]){_0x1f07f7[_0xcbf3('0x7f')]=JSON[_0xcbf3('0x7a')](_0x1f07f7[_0xcbf3('0x7f')]);_0x1cd82e[_0xcbf3('0x3d')](_0x477c13(_0x1f07f7[_0xcbf3('0x7f')]['group']));}_0x4eba5c=_0x1cd82e[_0xcbf3('0x80')]();_0x1cd82e[_0xcbf3('0x1c')](_0x49a39c);_0x1cd82e[_0xcbf3('0x1a')](0x0);logger[_0xcbf3('0x81')](_0xcbf3('0x82'),_0x1cd82e[_0xcbf3('0x83')]());return dbH[_0xcbf3('0x84')][_0xcbf3('0x32')](_0x1cd82e['toString'](),{'type':dbH[_0xcbf3('0x84')][_0xcbf3('0x85')][_0xcbf3('0x86')]});}})[_0xcbf3('0x23')](respondWithResult(_0x40fe2b,null))[_0xcbf3('0x45')](handleError(_0x40fe2b,null));};function runReport(_0x41c75f,_0x2f1481,_0x418934){var _0x3a091f=_0x2f1481['name'];var _0x392501=0xa;var _0x4017f6=[_0xcbf3('0x87'),_0xcbf3('0x53'),'right_join',_0xcbf3('0x54')];var _0xeda467={'SUM':_0xcbf3('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcbf3('0x56'),'MAX':'MAX(%s)','MIN':_0xcbf3('0x58'),'AVG':_0xcbf3('0x59'),'GROUP_CONCAT':_0xcbf3('0x5a'),'GROUP_CONCAT ASC':_0xcbf3('0x5b'),'GROUP_CONCAT DESC':_0xcbf3('0x5c')};var _0x1cbb3c={'SEC_TO_TIME':_0xcbf3('0x5d'),'DATE':'DATE(%s)','HOUR':_0xcbf3('0x5f'),'ROUND':_0xcbf3('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x465b6b=function(_0x41fd96){return!_[_0xcbf3('0x62')]([_0xcbf3('0x88'),_0xcbf3('0x63'),_0xcbf3('0x64'),_0xcbf3('0x65')],_0x41fd96);};var _0x961325=function(_0x2f91c3){if(!_0x2f91c3||!_0x2f91c3['rules']['length']){return'';}for(var _0x28a928='(',_0x50428d=0x0;_0x50428d<_0x2f91c3['rules'][_0xcbf3('0x38')];_0x50428d+=0x1){_0x50428d>0x0&&(_0x28a928+='\x20'+_0x2f91c3[_0xcbf3('0x67')]+'\x20');_0x28a928+=_0x2f91c3[_0xcbf3('0x66')][_0x50428d][_0xcbf3('0x68')]?_0x961325(_0x2f91c3[_0xcbf3('0x66')][_0x50428d][_0xcbf3('0x68')]):_0x2f91c3[_0xcbf3('0x66')][_0x50428d][_0xcbf3('0x72')]+'\x20'+_0x2f91c3[_0xcbf3('0x66')][_0x50428d][_0xcbf3('0x69')]+(_0x465b6b(_0x2f91c3[_0xcbf3('0x66')][_0x50428d]['condition'])?'\x20'+_0x2f91c3[_0xcbf3('0x66')][_0x50428d][_0xcbf3('0x89')]:'');}return _0x28a928+')';};var _0x4d9b97={'where':{'id':_0x41c75f['id']}},_0x39a599,_0x42c087,_0x429788,_0x1cfd0e,_0x4a5665;_0x4d9b97=_['merge']({},_0x4d9b97,_0x418934);return db[_0xcbf3('0x2b')][_0xcbf3('0x4c')](_0x4d9b97)[_0xcbf3('0x23')](function(_0x72d5c0){if(_0x72d5c0){_0x39a599=_0x72d5c0;return _0x72d5c0[_0xcbf3('0x8a')]();}return null;})['then'](function(_0x54e084){if(_0x54e084){if(!_0x54e084[_0xcbf3('0x38')]){throw new db['Sequelize'][(_0xcbf3('0x6b'))](_0xcbf3('0x6c'),0x193);}_0x42c087=_0x54e084;return db['AnalyticMetric'][_0xcbf3('0x43')]({'raw':!![]});}return null;})[_0xcbf3('0x23')](function(_0x244daf){if(_0x244daf){_0x429788=_[_0xcbf3('0x6d')](_0x244daf,'id');var _0xf498b;var _0x3d9d16=squel[_0xcbf3('0x6e')]();_0x3d9d16[_0xcbf3('0x6f')](_0x39a599[_0xcbf3('0x7d')]);for(var _0x4aafa6=0x0;_0x4aafa6<_0x42c087[_0xcbf3('0x38')];_0x4aafa6+=0x1){_0xf498b=_0x42c087[_0x4aafa6][_0xcbf3('0x70')]?_0x429788[_0x42c087[_0x4aafa6]['MetricId']][_0xcbf3('0x71')]:_0x42c087[_0x4aafa6][_0xcbf3('0x72')];_0xf498b=_0x42c087[_0x4aafa6]['function']?_['replace'](_0xeda467[_0x42c087[_0x4aafa6][_0xcbf3('0x73')]],'%s',_0xf498b):_0xf498b;_0xf498b=_0x42c087[_0x4aafa6][_0xcbf3('0x75')]?_[_0xcbf3('0x74')](_0x1cbb3c[_0x42c087[_0x4aafa6][_0xcbf3('0x75')]],'%s',_0xf498b):_0xf498b;if(_0x42c087[_0x4aafa6][_0xcbf3('0x76')]){_0x3d9d16['group'](_0xf498b);}_0x42c087[_0x4aafa6][_0xcbf3('0x77')]&&_0x3d9d16[_0xcbf3('0x3b')](_0xf498b,_0x42c087[_0x4aafa6][_0xcbf3('0x77')]===_0xcbf3('0x78')?![]:!![]);_0x3d9d16[_0xcbf3('0x72')](_0xf498b,_0x42c087[_0x4aafa6][_0xcbf3('0x8b')]||_0xf498b);}if(_0x39a599[_0xcbf3('0x79')]){_0x39a599[_0xcbf3('0x79')]=JSON[_0xcbf3('0x7a')](_0x39a599[_0xcbf3('0x79')]);for(var _0x206ee0=0x0;_0x206ee0<_0x39a599[_0xcbf3('0x79')][_0xcbf3('0x38')];_0x206ee0+=0x1){if(_0x39a599[_0xcbf3('0x79')][_0x206ee0][_0xcbf3('0x2e')]&&_[_0xcbf3('0x62')](_0x4017f6,_0x39a599['joins'][_0x206ee0]['type'])&&_0x39a599[_0xcbf3('0x79')][_0x206ee0][_0xcbf3('0x7b')]&&_0x39a599[_0xcbf3('0x79')][_0x206ee0]['foreignTable']&&_0x39a599[_0xcbf3('0x79')][_0x206ee0][_0xcbf3('0x7e')]){_0x3d9d16[_0x39a599[_0xcbf3('0x79')][_0x206ee0][_0xcbf3('0x2e')]](_0x39a599[_0xcbf3('0x79')][_0x206ee0][_0xcbf3('0x7c')],null,util[_0xcbf3('0x75')](_0xcbf3('0x8c'),_0x39a599[_0xcbf3('0x7d')],_0x39a599[_0xcbf3('0x79')][_0x206ee0][_0xcbf3('0x7b')],_0x39a599['joins'][_0x206ee0][_0xcbf3('0x7c')],_0x39a599[_0xcbf3('0x79')][_0x206ee0][_0xcbf3('0x7e')]));}}}if(_0x39a599['conditions']){_0x39a599['conditions']=JSON[_0xcbf3('0x7a')](_0x39a599[_0xcbf3('0x7f')]);_0x3d9d16[_0xcbf3('0x3d')](_0x961325(_0x39a599[_0xcbf3('0x7f')]['group']));}_0x4a5665=_0x3d9d16['clone']();_0x3d9d16[_0xcbf3('0x1c')](_0x392501);_0x3d9d16[_0xcbf3('0x1a')](0x0);return;}})[_0xcbf3('0x23')](function(){if(_0x2f1481[_0xcbf3('0x8d')]==='web'){return null;}var _0x3cc938=_['merge'](_0x2f1481,{'name':_0x2f1481[_0xcbf3('0x8e')]||_0x2f1481[_0xcbf3('0x28')]||_0x39a599['name'],'basename':_0x3a091f,'savename':util[_0xcbf3('0x75')](_0xcbf3('0x8f'),_0x2f1481[_0xcbf3('0x28')]||_0x39a599[_0xcbf3('0x28')],require(_0xcbf3('0x90'))['generate'](0x4),_0x2f1481['output']||_0xcbf3('0x91')),'reportId':_0x39a599['id'],'reportType':_0xcbf3('0x92')});return db['AnalyticExtractedReport']['create'](_0x3cc938,{'raw':!![]});})[_0xcbf3('0x23')](function(_0x5ea569){if(_0x39a599[_0xcbf3('0x7d')]===_0xcbf3('0x93')){_0x4a5665[_0xcbf3('0x3d')](_0x39a599[_0xcbf3('0x7d')]+_0xcbf3('0x94'),_0x2f1481[_0xcbf3('0x95')],_0x2f1481['endDate']);}else{_0x4a5665[_0xcbf3('0x3d')](_0x39a599[_0xcbf3('0x7d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f1481[_0xcbf3('0x95')],_0x2f1481[_0xcbf3('0x96')]);}if(_0x5ea569){logger[_0xcbf3('0x97')](_0xcbf3('0x98'),_0x4a5665['toString']());require(_0xcbf3('0x99'))[_0xcbf3('0x9a')](path[_0xcbf3('0x87')](__dirname,_0xcbf3('0x9b'),_0x5ea569['output']),[_0x5ea569['id'],_0x4a5665[_0xcbf3('0x83')](),path['join'](__dirname,_0xcbf3('0x9c'),_0x5ea569[_0xcbf3('0x9d')]),_0x3a091f]);return _0x5ea569;}else{var _0x365a9d=squel[_0xcbf3('0x6e')]();_0x365a9d[_0xcbf3('0x6f')]('('+_0x4a5665['toString']()+')',_0xcbf3('0x9e'));_0x365a9d['field']('COUNT(*)',_0xcbf3('0x1d'));_0x4a5665[_0xcbf3('0x1c')](_0x2f1481[_0xcbf3('0x1c')]||_0x392501);_0x4a5665[_0xcbf3('0x1a')](_0x2f1481['offset']||0x0);return dbH[_0xcbf3('0x84')]['query'](_0x365a9d[_0xcbf3('0x83')](),{'type':dbH[_0xcbf3('0x84')][_0xcbf3('0x85')]['SELECT']})[_0xcbf3('0x23')](function(_0x20d979){if(!_0x20d979[_0xcbf3('0x38')]){_0x1cfd0e=0x0;}else{_0x1cfd0e=_0x20d979[0x0][_0xcbf3('0x1d')]||0x0;}return dbH['sequelize'][_0xcbf3('0x32')](_0x4a5665[_0xcbf3('0x83')](),{'type':dbH[_0xcbf3('0x84')]['QueryTypes']['SELECT']});})[_0xcbf3('0x23')](function(_0x17ffb2){return{'rows':_0x17ffb2||[],'count':_0x1cfd0e};});}});}exports[_0xcbf3('0x9f')]=function(_0x549f8b,_0x4a3104){return runReport(_0x549f8b[_0xcbf3('0x46')],_0x549f8b['query'],_0x549f8b[_0xcbf3('0x41')])[_0xcbf3('0x23')](respondWithResult(_0x4a3104,null))[_0xcbf3('0x45')](handleError(_0x4a3104,null));};exports['runReport']=runReport;exports[_0xcbf3('0x32')]=function(_0x1f32a3,_0x164c47){var _0x2750=0xa;var _0x56bf1c=[_0xcbf3('0x87'),_0xcbf3('0x53'),_0xcbf3('0xa0'),'cross_join'];var _0x365ecc={'SUM':'SUM(%s)','COUNT':_0xcbf3('0xa1'),'COUNT DISTINCT':_0xcbf3('0x56'),'MAX':'MAX(%s)','MIN':_0xcbf3('0x58'),'AVG':_0xcbf3('0x59'),'GROUP_CONCAT':_0xcbf3('0x5a'),'GROUP_CONCAT ASC':_0xcbf3('0x5b'),'GROUP_CONCAT DESC':_0xcbf3('0x5c')};var _0x19e35a={'SEC_TO_TIME':_0xcbf3('0x5d'),'DATE':_0xcbf3('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xcbf3('0x60'),'UNIX_TIMESTAMP':_0xcbf3('0x61')};var _0x312d74=function(_0x5a2f6a){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xcbf3('0x64'),_0xcbf3('0x65')],_0x5a2f6a);};var _0xb2d848=function(_0xed3f23){if(!_0xed3f23||!_0xed3f23[_0xcbf3('0x66')][_0xcbf3('0x38')]){return'';}for(var _0x5ef618='(',_0x44402c=0x0;_0x44402c<_0xed3f23[_0xcbf3('0x66')][_0xcbf3('0x38')];_0x44402c+=0x1){_0x44402c>0x0&&(_0x5ef618+='\x20'+_0xed3f23[_0xcbf3('0x67')]+'\x20');_0x5ef618+=_0xed3f23[_0xcbf3('0x66')][_0x44402c][_0xcbf3('0x68')]?_0xb2d848(_0xed3f23[_0xcbf3('0x66')][_0x44402c]['group']):_0xed3f23[_0xcbf3('0x66')][_0x44402c][_0xcbf3('0x72')]+'\x20'+_0xed3f23[_0xcbf3('0x66')][_0x44402c][_0xcbf3('0x69')]+(_0x312d74(_0xed3f23['rules'][_0x44402c]['condition'])?'\x20'+_0xed3f23['rules'][_0x44402c][_0xcbf3('0x89')]:'');}return _0x5ef618+')';};var _0x5ad507={'where':{'id':_0x1f32a3[_0xcbf3('0x46')]['id']}},_0x2a5b00,_0x88ab62,_0x32ae57,_0x59e022,_0x597aeb;_0x5ad507=_[_0xcbf3('0x3f')]({},_0x5ad507,_0x1f32a3[_0xcbf3('0x41')]);return db[_0xcbf3('0x2b')][_0xcbf3('0x4c')](_0x5ad507)[_0xcbf3('0x23')](function(_0x2508d6){if(_0x2508d6){_0x2a5b00=_0x2508d6;return _0x2508d6[_0xcbf3('0x8a')]();}return null;})[_0xcbf3('0x23')](function(_0x47e556){if(_0x47e556){if(!_0x47e556['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xcbf3('0x6c'),0x193);}_0x88ab62=_0x47e556;return db[_0xcbf3('0xa2')][_0xcbf3('0x43')]({'raw':!![]});}return null;})[_0xcbf3('0x23')](function(_0x1228e8){if(_0x1228e8){_0x32ae57=_[_0xcbf3('0x6d')](_0x1228e8,'id');var _0x1b1d0f;var _0xa247b=squel[_0xcbf3('0x6e')]();_0xa247b[_0xcbf3('0x6f')](_0x2a5b00[_0xcbf3('0x7d')]);for(var _0x4dfedb=0x0;_0x4dfedb<_0x88ab62[_0xcbf3('0x38')];_0x4dfedb+=0x1){_0x1b1d0f=_0x88ab62[_0x4dfedb][_0xcbf3('0x70')]?_0x32ae57[_0x88ab62[_0x4dfedb][_0xcbf3('0x70')]][_0xcbf3('0x71')]:_0x88ab62[_0x4dfedb][_0xcbf3('0x72')];_0x1b1d0f=_0x88ab62[_0x4dfedb][_0xcbf3('0x73')]?_[_0xcbf3('0x74')](_0x365ecc[_0x88ab62[_0x4dfedb][_0xcbf3('0x73')]],'%s',_0x1b1d0f):_0x1b1d0f;_0x1b1d0f=_0x88ab62[_0x4dfedb][_0xcbf3('0x75')]?_[_0xcbf3('0x74')](_0x19e35a[_0x88ab62[_0x4dfedb][_0xcbf3('0x75')]],'%s',_0x1b1d0f):_0x1b1d0f;if(_0x88ab62[_0x4dfedb][_0xcbf3('0x76')]){_0xa247b[_0xcbf3('0x68')](_0x1b1d0f);}_0x88ab62[_0x4dfedb][_0xcbf3('0x77')]&&_0xa247b[_0xcbf3('0x3b')](_0x1b1d0f,_0x88ab62[_0x4dfedb][_0xcbf3('0x77')]===_0xcbf3('0x78')?![]:!![]);_0xa247b[_0xcbf3('0x72')](_0x1b1d0f,_0x88ab62[_0x4dfedb][_0xcbf3('0x8b')]||_0x1b1d0f);}if(_0x2a5b00['joins']){_0x2a5b00[_0xcbf3('0x79')]=JSON['parse'](_0x2a5b00[_0xcbf3('0x79')]);for(var _0x3e2daa=0x0;_0x3e2daa<_0x2a5b00[_0xcbf3('0x79')]['length'];_0x3e2daa+=0x1){if(_0x2a5b00['joins'][_0x3e2daa][_0xcbf3('0x2e')]&&_[_0xcbf3('0x62')](_0x56bf1c,_0x2a5b00[_0xcbf3('0x79')][_0x3e2daa][_0xcbf3('0x2e')])&&_0x2a5b00[_0xcbf3('0x79')][_0x3e2daa][_0xcbf3('0x7b')]&&_0x2a5b00[_0xcbf3('0x79')][_0x3e2daa][_0xcbf3('0x7c')]&&_0x2a5b00[_0xcbf3('0x79')][_0x3e2daa][_0xcbf3('0x7e')]){_0xa247b[_0x2a5b00[_0xcbf3('0x79')][_0x3e2daa][_0xcbf3('0x2e')]](_0x2a5b00[_0xcbf3('0x79')][_0x3e2daa][_0xcbf3('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2a5b00['table'],_0x2a5b00['joins'][_0x3e2daa]['parentKey'],_0x2a5b00[_0xcbf3('0x79')][_0x3e2daa]['foreignTable'],_0x2a5b00['joins'][_0x3e2daa][_0xcbf3('0x7e')]));}}}if(_0x2a5b00['conditions']){_0x2a5b00[_0xcbf3('0x7f')]=JSON['parse'](_0x2a5b00[_0xcbf3('0x7f')]);_0xa247b['where'](_0xb2d848(_0x2a5b00[_0xcbf3('0x7f')]['group']));}_0x597aeb=_0xa247b[_0xcbf3('0x80')]();_0xa247b[_0xcbf3('0x1c')](_0x2750);_0xa247b[_0xcbf3('0x1a')](0x0);logger['debug'](_0xcbf3('0x82'),_0xa247b[_0xcbf3('0x83')]());return dbH[_0xcbf3('0x84')][_0xcbf3('0x32')](_0xa247b[_0xcbf3('0x83')](),{'type':dbH['sequelize'][_0xcbf3('0x85')]['SELECT']});}})['then'](function(){return{'sql':_0x597aeb[_0xcbf3('0x83')]()};})[_0xcbf3('0x23')](respondWithResult(_0x164c47,null))['catch'](handleError(_0x164c47,null));}; \ No newline at end of file +var _0xb0fb=['joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','join','COUNT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20NOT\x20EMPTY','value','keyBy','metric','output','web','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','SELECT','runReport','DATE(%s)','Please\x20insert\x20at\x20least\x20one\x20field','debug','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','create','body','user','role','userProfileId','autoAssociation','CustomReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','order','DESC','alias'];(function(_0x3118e1,_0x394663){var _0x41312d=function(_0x48dd52){while(--_0x48dd52){_0x3118e1['push'](_0x3118e1['shift']());}};_0x41312d(++_0x394663);}(_0xb0fb,0xcb));var _0xbb0f=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xb0fb[_0x31ced5];return _0x10d9e5;};'use strict';var emlformat=require(_0xbb0f('0x0'));var rimraf=require(_0xbb0f('0x1'));var zipdir=require(_0xbb0f('0x2'));var jsonpatch=require(_0xbb0f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbb0f('0x4'));var Mustache=require(_0xbb0f('0x5'));var util=require(_0xbb0f('0x6'));var path=require('path');var sox=require(_0xbb0f('0x7'));var csv=require(_0xbb0f('0x8'));var ejs=require(_0xbb0f('0x9'));var fs=require('fs');var fs_extra=require(_0xbb0f('0xa'));var _=require(_0xbb0f('0xb'));var squel=require(_0xbb0f('0xc'));var crypto=require(_0xbb0f('0xd'));var jsforce=require(_0xbb0f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbb0f('0x8'));var querystring=require(_0xbb0f('0xf'));var Papa=require(_0xbb0f('0x10'));var Redis=require(_0xbb0f('0x11'));var authService=require(_0xbb0f('0x12'));var qs=require(_0xbb0f('0x13'));var as=require(_0xbb0f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb0f('0x15'))(_0xbb0f('0x16'));var utils=require('../../config/utils');var config=require(_0xbb0f('0x17'));var licenseUtil=require(_0xbb0f('0x18'));var db=require(_0xbb0f('0x19'))['db'];var dbH=require('../../mysqldb')[_0xbb0f('0x1a')];function respondWithStatusCode(_0x4095c4,_0xf39ba9){_0xf39ba9=_0xf39ba9||0xcc;return function(_0x1e5ff9){if(_0x1e5ff9){return _0x4095c4[_0xbb0f('0x1b')](_0xf39ba9);}return _0x4095c4[_0xbb0f('0x1c')](_0xf39ba9)[_0xbb0f('0x1d')]();};}function respondWithResult(_0x28728e,_0x2dfb5e){_0x2dfb5e=_0x2dfb5e||0xc8;return function(_0x483705){if(_0x483705){return _0x28728e[_0xbb0f('0x1c')](_0x2dfb5e)['json'](_0x483705);}};}function respondWithFilteredResult(_0x7eb056,_0x2baddf){return function(_0x3261fe){if(_0x3261fe){var _0x33f059=typeof _0x2baddf[_0xbb0f('0x1e')]===_0xbb0f('0x1f')&&typeof _0x2baddf['limit']===_0xbb0f('0x1f');var _0x18d91f=_0x3261fe[_0xbb0f('0x20')];var _0x30b1ba=_0x33f059?0x0:_0x2baddf[_0xbb0f('0x1e')];var _0x58c805=_0x33f059?_0x3261fe[_0xbb0f('0x20')]:_0x2baddf['offset']+_0x2baddf[_0xbb0f('0x21')];var _0x302145;if(_0x58c805>=_0x18d91f){_0x58c805=_0x18d91f;_0x302145=0xc8;}else{_0x302145=0xce;}_0x7eb056['status'](_0x302145);return _0x7eb056[_0xbb0f('0x22')]('Content-Range',_0x30b1ba+'-'+_0x58c805+'/'+_0x18d91f)[_0xbb0f('0x23')](_0x3261fe);}return null;};}function patchUpdates(_0x504275){return function(_0xca77fe){try{jsonpatch['apply'](_0xca77fe,_0x504275,!![]);}catch(_0x1612ee){return BPromise[_0xbb0f('0x24')](_0x1612ee);}return _0xca77fe['save']();};}function saveUpdates(_0x3fe26d,_0x5a3040){return function(_0x3e264d){if(_0x3e264d){return _0x3e264d[_0xbb0f('0x25')](_0x3fe26d)[_0xbb0f('0x26')](function(_0x3ca307){return _0x3ca307;});}return null;};}function removeEntity(_0x495f00,_0x4c14f9){return function(_0x2a6c3d){if(_0x2a6c3d){return _0x2a6c3d[_0xbb0f('0x27')]()[_0xbb0f('0x26')](function(){var _0x4560c1=_0x2a6c3d[_0xbb0f('0x28')]({'plain':!![]});var _0x26cd31='CustomReports';return db[_0xbb0f('0x29')][_0xbb0f('0x27')]({'where':{'type':_0x26cd31,'resourceId':_0x4560c1['id']}})[_0xbb0f('0x26')](function(){return _0x2a6c3d;});})[_0xbb0f('0x26')](function(){_0x495f00[_0xbb0f('0x1c')](0xcc)[_0xbb0f('0x1d')]();});}};}function handleEntityNotFound(_0x5a9472,_0x2ba211){return function(_0x232217){if(!_0x232217){_0x5a9472[_0xbb0f('0x1b')](0x194);}return _0x232217;};}function handleError(_0x5edae7,_0x30fd06){_0x30fd06=_0x30fd06||0x1f4;return function(_0x5d11ec){logger[_0xbb0f('0x2a')](_0x5d11ec[_0xbb0f('0x2b')]);if(_0x5d11ec[_0xbb0f('0x2c')]){delete _0x5d11ec['name'];}_0x5edae7['status'](_0x30fd06)['send'](_0x5d11ec);};}exports[_0xbb0f('0x2d')]=function(_0xad2e35,_0x41d3f7){var _0x2dfc28={},_0x3451b8={},_0xdf4023={'count':0x0,'rows':[]};var _0x113161=_[_0xbb0f('0x2e')](db[_0xbb0f('0x2f')]['rawAttributes'],function(_0x5a0db0){return{'name':_0x5a0db0['fieldName'],'type':_0x5a0db0[_0xbb0f('0x30')][_0xbb0f('0x31')]};});_0x3451b8[_0xbb0f('0x32')]=_['map'](_0x113161,_0xbb0f('0x2c'));_0x3451b8[_0xbb0f('0x33')]=_[_0xbb0f('0x34')](_0xad2e35[_0xbb0f('0x33')]);_0x3451b8[_0xbb0f('0x35')]=_[_0xbb0f('0x36')](_0x3451b8[_0xbb0f('0x32')],_0x3451b8[_0xbb0f('0x33')]);_0x2dfc28[_0xbb0f('0x37')]=_['intersection'](_0x3451b8[_0xbb0f('0x32')],qs['fields'](_0xad2e35['query']['fields']));_0x2dfc28[_0xbb0f('0x37')]=_0x2dfc28[_0xbb0f('0x37')][_0xbb0f('0x38')]?_0x2dfc28['attributes']:_0x3451b8[_0xbb0f('0x32')];if(!_0xad2e35[_0xbb0f('0x33')][_0xbb0f('0x39')](_0xbb0f('0x3a'))){_0x2dfc28[_0xbb0f('0x21')]=qs[_0xbb0f('0x21')](_0xad2e35['query'][_0xbb0f('0x21')]);_0x2dfc28[_0xbb0f('0x1e')]=qs[_0xbb0f('0x1e')](_0xad2e35[_0xbb0f('0x33')]['offset']);}_0x2dfc28['order']=qs[_0xbb0f('0x3b')](_0xad2e35['query'][_0xbb0f('0x3b')]);_0x2dfc28[_0xbb0f('0x3c')]=qs[_0xbb0f('0x35')](_[_0xbb0f('0x3d')](_0xad2e35[_0xbb0f('0x33')],_0x3451b8['filters']),_0x113161);if(_0xad2e35[_0xbb0f('0x33')][_0xbb0f('0x3e')]){_0x2dfc28[_0xbb0f('0x3c')]=_[_0xbb0f('0x3f')](_0x2dfc28['where'],{'$or':_['map'](_0x113161,function(_0x26733c){if(_0x26733c['type']!==_0xbb0f('0x40')){var _0x215760={};_0x215760[_0x26733c[_0xbb0f('0x2c')]]={'$like':'%'+_0xad2e35[_0xbb0f('0x33')][_0xbb0f('0x3e')]+'%'};return _0x215760;}})});}_0x2dfc28=_[_0xbb0f('0x3f')]({},_0x2dfc28,_0xad2e35[_0xbb0f('0x41')]);var _0x47d0c4={'where':_0x2dfc28[_0xbb0f('0x3c')]};return db['AnalyticCustomReport'][_0xbb0f('0x20')](_0x47d0c4)[_0xbb0f('0x26')](function(_0x125a8b){_0xdf4023[_0xbb0f('0x20')]=_0x125a8b;if(_0xad2e35[_0xbb0f('0x33')][_0xbb0f('0x42')]){_0x2dfc28[_0xbb0f('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xbb0f('0x44')](_0x2dfc28);})[_0xbb0f('0x26')](function(_0x144390){_0xdf4023[_0xbb0f('0x45')]=_0x144390;return _0xdf4023;})[_0xbb0f('0x26')](respondWithFilteredResult(_0x41d3f7,_0x2dfc28))['catch'](handleError(_0x41d3f7,null));};exports[_0xbb0f('0x46')]=function(_0xb157db,_0x1475d8){var _0x478268={'raw':![],'where':{'id':_0xb157db[_0xbb0f('0x47')]['id']}},_0x4e237a={};_0x4e237a[_0xbb0f('0x32')]=_['keys'](db[_0xbb0f('0x2f')][_0xbb0f('0x48')]);_0x4e237a[_0xbb0f('0x33')]=_[_0xbb0f('0x34')](_0xb157db['query']);_0x4e237a[_0xbb0f('0x35')]=_[_0xbb0f('0x36')](_0x4e237a[_0xbb0f('0x32')],_0x4e237a[_0xbb0f('0x33')]);_0x478268[_0xbb0f('0x37')]=_['intersection'](_0x4e237a[_0xbb0f('0x32')],qs[_0xbb0f('0x49')](_0xb157db[_0xbb0f('0x33')][_0xbb0f('0x49')]));_0x478268[_0xbb0f('0x37')]=_0x478268[_0xbb0f('0x37')][_0xbb0f('0x38')]?_0x478268[_0xbb0f('0x37')]:_0x4e237a[_0xbb0f('0x32')];if(_0xb157db['query'][_0xbb0f('0x42')]){_0x478268[_0xbb0f('0x43')]=[{'all':!![]}];}_0x478268=_[_0xbb0f('0x3f')]({},_0x478268,_0xb157db['options']);return db[_0xbb0f('0x2f')][_0xbb0f('0x4a')](_0x478268)[_0xbb0f('0x26')](handleEntityNotFound(_0x1475d8,null))['then'](respondWithResult(_0x1475d8,null))['catch'](handleError(_0x1475d8,null));};exports[_0xbb0f('0x4b')]=function(_0x29e8ca,_0x2bb2b5){return db[_0xbb0f('0x2f')][_0xbb0f('0x4b')](_0x29e8ca[_0xbb0f('0x4c')],{})[_0xbb0f('0x26')](function(_0x2decbb){var _0x1f4fea=_0x29e8ca[_0xbb0f('0x4d')][_0xbb0f('0x28')]({'plain':!![]});if(!_0x1f4fea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f4fea[_0xbb0f('0x4e')]===_0xbb0f('0x4d')){var _0x5785ec=_0x2decbb['get']({'plain':!![]});var _0x2fa57f='Reports';return db['UserProfileSection'][_0xbb0f('0x4a')]({'where':{'name':_0x2fa57f,'userProfileId':_0x1f4fea[_0xbb0f('0x4f')]},'raw':!![]})['then'](function(_0x45fdb2){if(_0x45fdb2&&_0x45fdb2[_0xbb0f('0x50')]===0x0){return db[_0xbb0f('0x29')][_0xbb0f('0x4b')]({'name':_0x5785ec[_0xbb0f('0x2c')],'resourceId':_0x5785ec['id'],'type':_0xbb0f('0x51'),'sectionId':_0x45fdb2['id']},{})[_0xbb0f('0x26')](function(){return _0x2decbb;});}else{return _0x2decbb;}})[_0xbb0f('0x52')](function(_0x1d0b4f){logger[_0xbb0f('0x2a')](_0xbb0f('0x53'),_0x1d0b4f);throw _0x1d0b4f;});}return _0x2decbb;})[_0xbb0f('0x26')](respondWithResult(_0x2bb2b5,0xc9))[_0xbb0f('0x52')](handleError(_0x2bb2b5,null));};exports['update']=function(_0x177fe6,_0x5186a1){if(_0x177fe6[_0xbb0f('0x4c')]['id']){delete _0x177fe6['body']['id'];}return db[_0xbb0f('0x2f')]['find']({'where':{'id':_0x177fe6[_0xbb0f('0x47')]['id']}})[_0xbb0f('0x26')](handleEntityNotFound(_0x5186a1,null))[_0xbb0f('0x26')](saveUpdates(_0x177fe6[_0xbb0f('0x4c')],null))[_0xbb0f('0x26')](respondWithResult(_0x5186a1,null))[_0xbb0f('0x52')](handleError(_0x5186a1,null));};exports[_0xbb0f('0x27')]=function(_0xaff63d,_0x4ddff0){return db[_0xbb0f('0x2f')]['find']({'where':{'id':_0xaff63d[_0xbb0f('0x47')]['id']}})[_0xbb0f('0x26')](handleEntityNotFound(_0x4ddff0,null))['then'](removeEntity(_0x4ddff0,null))[_0xbb0f('0x52')](handleError(_0x4ddff0,null));};exports[_0xbb0f('0x54')]=function(_0x1b495b,_0x17c156){var _0x72a820=0xa;var _0x385505=['join',_0xbb0f('0x55'),_0xbb0f('0x56'),_0xbb0f('0x57')];var _0x13f0ab={'SUM':_0xbb0f('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbb0f('0x59'),'MAX':_0xbb0f('0x5a'),'MIN':_0xbb0f('0x5b'),'AVG':_0xbb0f('0x5c'),'GROUP_CONCAT':_0xbb0f('0x5d'),'GROUP_CONCAT ASC':_0xbb0f('0x5e'),'GROUP_CONCAT DESC':_0xbb0f('0x5f')};var _0x1d12b9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xbb0f('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbb0f('0x61')};var _0x430ec2=function(_0x394845){return!_[_0xbb0f('0x62')]([_0xbb0f('0x63'),_0xbb0f('0x64'),_0xbb0f('0x65'),'IS\x20NOT\x20EMPTY'],_0x394845);};var _0x300b1e=function(_0x58449a){if(!_0x58449a||!_0x58449a['rules']['length']){return'';}for(var _0x3cb741='(',_0x579562=0x0;_0x579562<_0x58449a[_0xbb0f('0x66')][_0xbb0f('0x38')];_0x579562+=0x1){_0x579562>0x0&&(_0x3cb741+='\x20'+_0x58449a[_0xbb0f('0x67')]+'\x20');_0x3cb741+=_0x58449a['rules'][_0x579562][_0xbb0f('0x68')]?_0x300b1e(_0x58449a[_0xbb0f('0x66')][_0x579562][_0xbb0f('0x68')]):_0x58449a[_0xbb0f('0x66')][_0x579562]['field']+'\x20'+_0x58449a[_0xbb0f('0x66')][_0x579562][_0xbb0f('0x69')]+(_0x430ec2(_0x58449a['rules'][_0x579562][_0xbb0f('0x69')])?'\x20'+_0x58449a[_0xbb0f('0x66')][_0x579562]['value']:'');}return _0x3cb741+')';};var _0x5e8a00={'where':{'id':_0x1b495b[_0xbb0f('0x47')]['id']}},_0x475603,_0x46518d,_0x5b94eb,_0x14a7eb,_0x2190f8;_0x5e8a00=_['merge']({},_0x5e8a00,_0x1b495b[_0xbb0f('0x41')]);return db[_0xbb0f('0x2f')][_0xbb0f('0x4a')](_0x5e8a00)['then'](function(_0x453f33){if(_0x453f33){_0x475603=_0x453f33;return _0x453f33[_0xbb0f('0x6a')]();}return null;})['then'](function(_0xc9b7fd){if(_0xc9b7fd){if(!_0xc9b7fd[_0xbb0f('0x38')]){throw new db[(_0xbb0f('0x6b'))][(_0xbb0f('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x46518d=_0xc9b7fd;return db[_0xbb0f('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xbb0f('0x26')](function(_0x1291d8){if(_0x1291d8){_0x5b94eb=_['keyBy'](_0x1291d8,'id');var _0x5de3ac;var _0x5dfbc8=squel[_0xbb0f('0x6e')]();_0x5dfbc8[_0xbb0f('0x6f')](_0x475603[_0xbb0f('0x70')]);for(var _0x1a4dbf=0x0;_0x1a4dbf<_0x46518d['length'];_0x1a4dbf+=0x1){_0x5de3ac=_0x46518d[_0x1a4dbf][_0xbb0f('0x71')]?_0x5b94eb[_0x46518d[_0x1a4dbf]['MetricId']]['metric']:_0x46518d[_0x1a4dbf][_0xbb0f('0x72')];_0x5de3ac=_0x46518d[_0x1a4dbf][_0xbb0f('0x73')]?_[_0xbb0f('0x74')](_0x13f0ab[_0x46518d[_0x1a4dbf][_0xbb0f('0x73')]],'%s',_0x5de3ac):_0x5de3ac;_0x5de3ac=_0x46518d[_0x1a4dbf]['format']?_[_0xbb0f('0x74')](_0x1d12b9[_0x46518d[_0x1a4dbf][_0xbb0f('0x75')]],'%s',_0x5de3ac):_0x5de3ac;if(_0x46518d[_0x1a4dbf][_0xbb0f('0x76')]){_0x5dfbc8['group'](_0x5de3ac);}_0x46518d[_0x1a4dbf][_0xbb0f('0x77')]&&_0x5dfbc8[_0xbb0f('0x78')](_0x5de3ac,_0x46518d[_0x1a4dbf][_0xbb0f('0x77')]===_0xbb0f('0x79')?![]:!![]);_0x5dfbc8[_0xbb0f('0x72')](_0x5de3ac,_0x46518d[_0x1a4dbf][_0xbb0f('0x7a')]||_0x5de3ac);}if(_0x475603[_0xbb0f('0x7b')]){_0x475603[_0xbb0f('0x7b')]=JSON[_0xbb0f('0x7c')](_0x475603[_0xbb0f('0x7b')]);for(var _0x314a9c=0x0;_0x314a9c<_0x475603[_0xbb0f('0x7b')][_0xbb0f('0x38')];_0x314a9c+=0x1){if(_0x475603[_0xbb0f('0x7b')][_0x314a9c]['type']&&_['includes'](_0x385505,_0x475603['joins'][_0x314a9c][_0xbb0f('0x30')])&&_0x475603[_0xbb0f('0x7b')][_0x314a9c][_0xbb0f('0x7d')]&&_0x475603[_0xbb0f('0x7b')][_0x314a9c][_0xbb0f('0x7e')]&&_0x475603[_0xbb0f('0x7b')][_0x314a9c][_0xbb0f('0x7f')]){_0x5dfbc8[_0x475603['joins'][_0x314a9c][_0xbb0f('0x30')]](_0x475603['joins'][_0x314a9c][_0xbb0f('0x7e')],null,util['format'](_0xbb0f('0x80'),_0x475603['table'],_0x475603[_0xbb0f('0x7b')][_0x314a9c]['parentKey'],_0x475603[_0xbb0f('0x7b')][_0x314a9c][_0xbb0f('0x7e')],_0x475603[_0xbb0f('0x7b')][_0x314a9c][_0xbb0f('0x7f')]));}}}if(_0x475603[_0xbb0f('0x81')]){_0x475603[_0xbb0f('0x81')]=JSON[_0xbb0f('0x7c')](_0x475603[_0xbb0f('0x81')]);_0x5dfbc8['where'](_0x300b1e(_0x475603[_0xbb0f('0x81')]['group']));}_0x2190f8=_0x5dfbc8[_0xbb0f('0x82')]();_0x5dfbc8['limit'](_0x72a820);_0x5dfbc8[_0xbb0f('0x1e')](0x0);logger['debug'](_0xbb0f('0x83'),_0x5dfbc8[_0xbb0f('0x84')]());return dbH[_0xbb0f('0x85')][_0xbb0f('0x33')](_0x5dfbc8[_0xbb0f('0x84')](),{'type':dbH[_0xbb0f('0x85')][_0xbb0f('0x86')]['SELECT']});}})[_0xbb0f('0x26')](respondWithResult(_0x17c156,null))['catch'](handleError(_0x17c156,null));};function runReport(_0x150a28,_0x26a089,_0x18e12f){var _0x11758a=_0x26a089[_0xbb0f('0x2c')];var _0x1a01e9=0xa;var _0x1f8913=[_0xbb0f('0x87'),_0xbb0f('0x55'),_0xbb0f('0x56'),'cross_join'];var _0x4357a1={'SUM':_0xbb0f('0x58'),'COUNT':_0xbb0f('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xbb0f('0x5b'),'AVG':_0xbb0f('0x5c'),'GROUP_CONCAT':_0xbb0f('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3153bb={'SEC_TO_TIME':_0xbb0f('0x89'),'DATE':'DATE(%s)','HOUR':_0xbb0f('0x60'),'ROUND':_0xbb0f('0x8a'),'UNIX_TIMESTAMP':_0xbb0f('0x61')};var _0x4ba530=function(_0x402289){return!_['includes'](['IS\x20NULL',_0xbb0f('0x64'),_0xbb0f('0x65'),_0xbb0f('0x8b')],_0x402289);};var _0xdd46=function(_0x30594f){if(!_0x30594f||!_0x30594f[_0xbb0f('0x66')][_0xbb0f('0x38')]){return'';}for(var _0x53014e='(',_0x501030=0x0;_0x501030<_0x30594f[_0xbb0f('0x66')][_0xbb0f('0x38')];_0x501030+=0x1){_0x501030>0x0&&(_0x53014e+='\x20'+_0x30594f[_0xbb0f('0x67')]+'\x20');_0x53014e+=_0x30594f[_0xbb0f('0x66')][_0x501030][_0xbb0f('0x68')]?_0xdd46(_0x30594f['rules'][_0x501030][_0xbb0f('0x68')]):_0x30594f[_0xbb0f('0x66')][_0x501030][_0xbb0f('0x72')]+'\x20'+_0x30594f[_0xbb0f('0x66')][_0x501030]['condition']+(_0x4ba530(_0x30594f['rules'][_0x501030]['condition'])?'\x20'+_0x30594f['rules'][_0x501030][_0xbb0f('0x8c')]:'');}return _0x53014e+')';};var _0x525e45={'where':{'id':_0x150a28['id']}},_0xdfef96,_0x18ceb7,_0xd6d99d,_0x59e136,_0x1e9185;_0x525e45=_[_0xbb0f('0x3f')]({},_0x525e45,_0x18e12f);return db[_0xbb0f('0x2f')]['find'](_0x525e45)[_0xbb0f('0x26')](function(_0x3cc3e2){if(_0x3cc3e2){_0xdfef96=_0x3cc3e2;return _0x3cc3e2[_0xbb0f('0x6a')]();}return null;})['then'](function(_0x3fbdb9){if(_0x3fbdb9){if(!_0x3fbdb9[_0xbb0f('0x38')]){throw new db['Sequelize'][(_0xbb0f('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x18ceb7=_0x3fbdb9;return db[_0xbb0f('0x6d')][_0xbb0f('0x44')]({'raw':!![]});}return null;})['then'](function(_0x33b7ba){if(_0x33b7ba){_0xd6d99d=_[_0xbb0f('0x8d')](_0x33b7ba,'id');var _0x3ea8e2;var _0x23c7bf=squel[_0xbb0f('0x6e')]();_0x23c7bf[_0xbb0f('0x6f')](_0xdfef96[_0xbb0f('0x70')]);for(var _0x15d981=0x0;_0x15d981<_0x18ceb7[_0xbb0f('0x38')];_0x15d981+=0x1){_0x3ea8e2=_0x18ceb7[_0x15d981][_0xbb0f('0x71')]?_0xd6d99d[_0x18ceb7[_0x15d981][_0xbb0f('0x71')]][_0xbb0f('0x8e')]:_0x18ceb7[_0x15d981][_0xbb0f('0x72')];_0x3ea8e2=_0x18ceb7[_0x15d981]['function']?_[_0xbb0f('0x74')](_0x4357a1[_0x18ceb7[_0x15d981][_0xbb0f('0x73')]],'%s',_0x3ea8e2):_0x3ea8e2;_0x3ea8e2=_0x18ceb7[_0x15d981][_0xbb0f('0x75')]?_['replace'](_0x3153bb[_0x18ceb7[_0x15d981]['format']],'%s',_0x3ea8e2):_0x3ea8e2;if(_0x18ceb7[_0x15d981][_0xbb0f('0x76')]){_0x23c7bf[_0xbb0f('0x68')](_0x3ea8e2);}_0x18ceb7[_0x15d981][_0xbb0f('0x77')]&&_0x23c7bf[_0xbb0f('0x78')](_0x3ea8e2,_0x18ceb7[_0x15d981][_0xbb0f('0x77')]===_0xbb0f('0x79')?![]:!![]);_0x23c7bf['field'](_0x3ea8e2,_0x18ceb7[_0x15d981][_0xbb0f('0x7a')]||_0x3ea8e2);}if(_0xdfef96['joins']){_0xdfef96['joins']=JSON[_0xbb0f('0x7c')](_0xdfef96[_0xbb0f('0x7b')]);for(var _0x48ef15=0x0;_0x48ef15<_0xdfef96[_0xbb0f('0x7b')]['length'];_0x48ef15+=0x1){if(_0xdfef96[_0xbb0f('0x7b')][_0x48ef15]['type']&&_[_0xbb0f('0x62')](_0x1f8913,_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x30')])&&_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x7d')]&&_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x7e')]&&_0xdfef96[_0xbb0f('0x7b')][_0x48ef15]['foreignKey']){_0x23c7bf[_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x30')]](_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x7e')],null,util[_0xbb0f('0x75')](_0xbb0f('0x80'),_0xdfef96['table'],_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x7d')],_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x7e')],_0xdfef96[_0xbb0f('0x7b')][_0x48ef15][_0xbb0f('0x7f')]));}}}if(_0xdfef96['conditions']){_0xdfef96[_0xbb0f('0x81')]=JSON[_0xbb0f('0x7c')](_0xdfef96[_0xbb0f('0x81')]);_0x23c7bf[_0xbb0f('0x3c')](_0xdd46(_0xdfef96['conditions'][_0xbb0f('0x68')]));}_0x1e9185=_0x23c7bf[_0xbb0f('0x82')]();_0x23c7bf['limit'](_0x1a01e9);_0x23c7bf[_0xbb0f('0x1e')](0x0);return;}})['then'](function(){if(_0x26a089[_0xbb0f('0x8f')]===_0xbb0f('0x90')){return null;}var _0x2ae495=_['merge'](_0x26a089,{'name':_0x26a089['fullPath']||_0x26a089[_0xbb0f('0x2c')]||_0xdfef96[_0xbb0f('0x2c')],'basename':_0x11758a,'savename':util['format']('%s-%s.%s',_0x26a089[_0xbb0f('0x2c')]||_0xdfef96['name'],require(_0xbb0f('0x91'))[_0xbb0f('0x92')](0x4),_0x26a089['output']||_0xbb0f('0x93')),'reportId':_0xdfef96['id'],'reportType':_0xbb0f('0x94')});return db['AnalyticExtractedReport']['create'](_0x2ae495,{'raw':!![]});})[_0xbb0f('0x26')](function(_0x2d74e6){if(_0xdfef96[_0xbb0f('0x70')]===_0xbb0f('0x95')){_0x1e9185[_0xbb0f('0x3c')](_0xdfef96[_0xbb0f('0x70')]+_0xbb0f('0x96'),_0x26a089['startDate'],_0x26a089[_0xbb0f('0x97')]);}else{_0x1e9185[_0xbb0f('0x3c')](_0xdfef96[_0xbb0f('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x26a089[_0xbb0f('0x98')],_0x26a089[_0xbb0f('0x97')]);}if(_0x2d74e6){logger[_0xbb0f('0x99')](_0xbb0f('0x9a'),_0x1e9185[_0xbb0f('0x84')]());require('child_process')['fork'](path[_0xbb0f('0x87')](__dirname,_0xbb0f('0x9b'),_0x2d74e6[_0xbb0f('0x8f')]),[_0x2d74e6['id'],_0x1e9185[_0xbb0f('0x84')](),path['join'](__dirname,_0xbb0f('0x9c'),_0x2d74e6[_0xbb0f('0x9d')]),_0x11758a]);return _0x2d74e6;}else{var _0x11325e=squel[_0xbb0f('0x6e')]();_0x11325e[_0xbb0f('0x6f')]('('+_0x1e9185[_0xbb0f('0x84')]()+')','countTable');_0x11325e[_0xbb0f('0x72')]('COUNT(*)',_0xbb0f('0x20'));_0x1e9185['limit'](_0x26a089[_0xbb0f('0x21')]||_0x1a01e9);_0x1e9185[_0xbb0f('0x1e')](_0x26a089['offset']||0x0);return dbH[_0xbb0f('0x85')][_0xbb0f('0x33')](_0x11325e['toString'](),{'type':dbH[_0xbb0f('0x85')][_0xbb0f('0x86')][_0xbb0f('0x9e')]})[_0xbb0f('0x26')](function(_0x19a8cf){if(!_0x19a8cf['length']){_0x59e136=0x0;}else{_0x59e136=_0x19a8cf[0x0][_0xbb0f('0x20')]||0x0;}return dbH[_0xbb0f('0x85')][_0xbb0f('0x33')](_0x1e9185['toString'](),{'type':dbH[_0xbb0f('0x85')]['QueryTypes'][_0xbb0f('0x9e')]});})[_0xbb0f('0x26')](function(_0x218f5d){return{'rows':_0x218f5d||[],'count':_0x59e136};});}});}exports['run']=function(_0x329587,_0x1cdf85){return runReport(_0x329587[_0xbb0f('0x47')],_0x329587['query'],_0x329587[_0xbb0f('0x41')])[_0xbb0f('0x26')](respondWithResult(_0x1cdf85,null))['catch'](handleError(_0x1cdf85,null));};exports[_0xbb0f('0x9f')]=runReport;exports[_0xbb0f('0x33')]=function(_0x2168fa,_0x5453a7){var _0x24c513=0xa;var _0x422ee8=[_0xbb0f('0x87'),_0xbb0f('0x55'),_0xbb0f('0x56'),_0xbb0f('0x57')];var _0x2fd152={'SUM':_0xbb0f('0x58'),'COUNT':_0xbb0f('0x88'),'COUNT DISTINCT':_0xbb0f('0x59'),'MAX':_0xbb0f('0x5a'),'MIN':_0xbb0f('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb0f('0x5e'),'GROUP_CONCAT DESC':_0xbb0f('0x5f')};var _0xefbd71={'SEC_TO_TIME':_0xbb0f('0x89'),'DATE':_0xbb0f('0xa0'),'HOUR':_0xbb0f('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbb0f('0x61')};var _0x430bcc=function(_0x4123c2){return!_[_0xbb0f('0x62')]([_0xbb0f('0x63'),_0xbb0f('0x64'),'IS\x20EMPTY',_0xbb0f('0x8b')],_0x4123c2);};var _0x186886=function(_0x48ca10){if(!_0x48ca10||!_0x48ca10[_0xbb0f('0x66')][_0xbb0f('0x38')]){return'';}for(var _0x1442d5='(',_0x438222=0x0;_0x438222<_0x48ca10['rules'][_0xbb0f('0x38')];_0x438222+=0x1){_0x438222>0x0&&(_0x1442d5+='\x20'+_0x48ca10[_0xbb0f('0x67')]+'\x20');_0x1442d5+=_0x48ca10[_0xbb0f('0x66')][_0x438222][_0xbb0f('0x68')]?_0x186886(_0x48ca10['rules'][_0x438222]['group']):_0x48ca10[_0xbb0f('0x66')][_0x438222][_0xbb0f('0x72')]+'\x20'+_0x48ca10[_0xbb0f('0x66')][_0x438222][_0xbb0f('0x69')]+(_0x430bcc(_0x48ca10[_0xbb0f('0x66')][_0x438222][_0xbb0f('0x69')])?'\x20'+_0x48ca10['rules'][_0x438222][_0xbb0f('0x8c')]:'');}return _0x1442d5+')';};var _0x350785={'where':{'id':_0x2168fa['params']['id']}},_0x34a1a5,_0x68c5b5,_0x466a19,_0x306794,_0x2718cf;_0x350785=_['merge']({},_0x350785,_0x2168fa[_0xbb0f('0x41')]);return db['AnalyticCustomReport'][_0xbb0f('0x4a')](_0x350785)[_0xbb0f('0x26')](function(_0x3cd7e9){if(_0x3cd7e9){_0x34a1a5=_0x3cd7e9;return _0x3cd7e9[_0xbb0f('0x6a')]();}return null;})[_0xbb0f('0x26')](function(_0x5184c2){if(_0x5184c2){if(!_0x5184c2[_0xbb0f('0x38')]){throw new db[(_0xbb0f('0x6b'))][(_0xbb0f('0x6c'))](_0xbb0f('0xa1'),0x193);}_0x68c5b5=_0x5184c2;return db[_0xbb0f('0x6d')][_0xbb0f('0x44')]({'raw':!![]});}return null;})[_0xbb0f('0x26')](function(_0x22d37b){if(_0x22d37b){_0x466a19=_[_0xbb0f('0x8d')](_0x22d37b,'id');var _0x4cf060;var _0x5ca758=squel['select']();_0x5ca758[_0xbb0f('0x6f')](_0x34a1a5[_0xbb0f('0x70')]);for(var _0x57da04=0x0;_0x57da04<_0x68c5b5[_0xbb0f('0x38')];_0x57da04+=0x1){_0x4cf060=_0x68c5b5[_0x57da04][_0xbb0f('0x71')]?_0x466a19[_0x68c5b5[_0x57da04][_0xbb0f('0x71')]][_0xbb0f('0x8e')]:_0x68c5b5[_0x57da04][_0xbb0f('0x72')];_0x4cf060=_0x68c5b5[_0x57da04][_0xbb0f('0x73')]?_[_0xbb0f('0x74')](_0x2fd152[_0x68c5b5[_0x57da04]['function']],'%s',_0x4cf060):_0x4cf060;_0x4cf060=_0x68c5b5[_0x57da04][_0xbb0f('0x75')]?_[_0xbb0f('0x74')](_0xefbd71[_0x68c5b5[_0x57da04]['format']],'%s',_0x4cf060):_0x4cf060;if(_0x68c5b5[_0x57da04][_0xbb0f('0x76')]){_0x5ca758[_0xbb0f('0x68')](_0x4cf060);}_0x68c5b5[_0x57da04][_0xbb0f('0x77')]&&_0x5ca758['order'](_0x4cf060,_0x68c5b5[_0x57da04]['orderBy']===_0xbb0f('0x79')?![]:!![]);_0x5ca758[_0xbb0f('0x72')](_0x4cf060,_0x68c5b5[_0x57da04]['alias']||_0x4cf060);}if(_0x34a1a5[_0xbb0f('0x7b')]){_0x34a1a5[_0xbb0f('0x7b')]=JSON['parse'](_0x34a1a5['joins']);for(var _0x4acaa0=0x0;_0x4acaa0<_0x34a1a5['joins']['length'];_0x4acaa0+=0x1){if(_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0]['type']&&_[_0xbb0f('0x62')](_0x422ee8,_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0][_0xbb0f('0x30')])&&_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0][_0xbb0f('0x7d')]&&_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0][_0xbb0f('0x7e')]&&_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0][_0xbb0f('0x7f')]){_0x5ca758[_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0][_0xbb0f('0x30')]](_0x34a1a5['joins'][_0x4acaa0]['foreignTable'],null,util[_0xbb0f('0x75')](_0xbb0f('0x80'),_0x34a1a5[_0xbb0f('0x70')],_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0][_0xbb0f('0x7d')],_0x34a1a5[_0xbb0f('0x7b')][_0x4acaa0][_0xbb0f('0x7e')],_0x34a1a5['joins'][_0x4acaa0][_0xbb0f('0x7f')]));}}}if(_0x34a1a5['conditions']){_0x34a1a5[_0xbb0f('0x81')]=JSON[_0xbb0f('0x7c')](_0x34a1a5[_0xbb0f('0x81')]);_0x5ca758['where'](_0x186886(_0x34a1a5[_0xbb0f('0x81')][_0xbb0f('0x68')]));}_0x2718cf=_0x5ca758[_0xbb0f('0x82')]();_0x5ca758[_0xbb0f('0x21')](_0x24c513);_0x5ca758[_0xbb0f('0x1e')](0x0);logger[_0xbb0f('0xa2')](_0xbb0f('0x83'),_0x5ca758[_0xbb0f('0x84')]());return dbH[_0xbb0f('0x85')][_0xbb0f('0x33')](_0x5ca758[_0xbb0f('0x84')](),{'type':dbH[_0xbb0f('0x85')][_0xbb0f('0x86')]['SELECT']});}})[_0xbb0f('0x26')](function(){return{'sql':_0x2718cf[_0xbb0f('0x84')]()};})[_0xbb0f('0x26')](respondWithResult(_0x5453a7,null))[_0xbb0f('0x52')](handleError(_0x5453a7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 0c64a64..5bdd19e 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 _0xf9d7=['AnalyticCustomReport','analytics_custom_reports','../../config/logger','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x272fc3,_0x2f11e3){var _0x1cc3b1=function(_0x9fb23e){while(--_0x9fb23e){_0x272fc3['push'](_0x272fc3['shift']());}};_0x1cc3b1(++_0x2f11e3);}(_0xf9d7,0xd2));var _0x7f9d=function(_0x3ad2e5,_0x94d414){_0x3ad2e5=_0x3ad2e5-0x0;var _0xc4e565=_0xf9d7[_0x3ad2e5];return _0xc4e565;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f9d('0x0'))('api');var moment=require(_0x7f9d('0x1'));var BPromise=require('bluebird');var rp=require(_0x7f9d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f9d('0x3'));var config=require(_0x7f9d('0x4'));var attributes=require(_0x7f9d('0x5'));module['exports']=function(_0x1b4b33,_0x4fbc66){return _0x1b4b33['define'](_0x7f9d('0x6'),attributes,{'tableName':_0x7f9d('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fea=['bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','lodash','util','../../config/logger','api'];(function(_0x20b36e,_0x1e02c8){var _0x4fc42e=function(_0x59634c){while(--_0x59634c){_0x20b36e['push'](_0x20b36e['shift']());}};_0x4fc42e(++_0x1e02c8);}(_0x6fea,0xf4));var _0xa6fe=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x6fea[_0x5ca644];return _0x5c87a2;};'use strict';var _=require(_0xa6fe('0x0'));var util=require(_0xa6fe('0x1'));var logger=require(_0xa6fe('0x2'))(_0xa6fe('0x3'));var moment=require('moment');var BPromise=require(_0xa6fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6fe('0x5'));var config=require(_0xa6fe('0x6'));var attributes=require(_0xa6fe('0x7'));module['exports']=function(_0x1a8503,_0x570069){return _0x1a8503['define']('AnalyticCustomReport',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 8742333..62816e0 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 _0xd72d=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd72d,0x77));var _0xdd72=function(_0x1e5b3c,_0x3b9329){_0x1e5b3c=_0x1e5b3c-0x0;var _0x552a98=_0xd72d[_0x1e5b3c];return _0x552a98;};'use strict';var _=require(_0xdd72('0x0'));var util=require(_0xdd72('0x1'));var moment=require('moment');var BPromise=require(_0xdd72('0x2'));var rs=require(_0xdd72('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd72('0x4'));var logger=require(_0xdd72('0x5'))(_0xdd72('0x6'));var config=require(_0xdd72('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdd72('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8f4824,_0x34baea,_0x1a881d){return new BPromise(function(_0x1ed663,_0x3450df){return client['request'](_0x8f4824,_0x1a881d)['then'](function(_0x83f2ca){logger[_0xdd72('0x9')]('AnalyticCustomReport,\x20%s,\x20%s',_0x34baea,'request\x20sent');logger[_0xdd72('0xa')](_0xdd72('0xb'),_0x34baea,_0xdd72('0xc'),JSON[_0xdd72('0xd')](_0x83f2ca));if(_0x83f2ca['error']){if(_0x83f2ca[_0xdd72('0xe')][_0xdd72('0xf')]===0x1f4){logger[_0xdd72('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x34baea,_0x83f2ca[_0xdd72('0xe')][_0xdd72('0x10')]);return _0x3450df(_0x83f2ca['error'][_0xdd72('0x10')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x34baea,_0x83f2ca[_0xdd72('0xe')][_0xdd72('0x10')]);return _0x1ed663(_0x83f2ca['error'][_0xdd72('0x10')]);}else{logger[_0xdd72('0x9')](_0xdd72('0x11'),_0x34baea,'request\x20sent');_0x1ed663(_0x83f2ca[_0xdd72('0x12')][_0xdd72('0x10')]);}})[_0xdd72('0x13')](function(_0x620a3f){logger[_0xdd72('0xe')](_0xdd72('0x11'),_0x34baea,_0x620a3f);_0x3450df(_0x620a3f);});});} \ No newline at end of file +var _0x4378=['debug','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0x4378,0x10a));var _0x8437=function(_0x5aff1f,_0x138c46){_0x5aff1f=_0x5aff1f-0x0;var _0x385adc=_0x4378[_0x5aff1f];return _0x385adc;};'use strict';var _=require('lodash');var util=require(_0x8437('0x0'));var moment=require(_0x8437('0x1'));var BPromise=require(_0x8437('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8437('0x3'));var db=require(_0x8437('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8437('0x5'))('rpc');var config=require(_0x8437('0x6'));var jayson=require(_0x8437('0x7'));var client=jayson[_0x8437('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x447143,_0x4aef13,_0x3db3ac){return new BPromise(function(_0x1729bb,_0x5aebbc){return client[_0x8437('0x9')](_0x447143,_0x3db3ac)[_0x8437('0xa')](function(_0x4c04b4){logger[_0x8437('0xb')](_0x8437('0xc'),_0x4aef13,_0x8437('0xd'));logger[_0x8437('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4aef13,'request\x20sent',JSON[_0x8437('0xf')](_0x4c04b4));if(_0x4c04b4['error']){if(_0x4c04b4[_0x8437('0x10')][_0x8437('0x11')]===0x1f4){logger[_0x8437('0x10')](_0x8437('0xc'),_0x4aef13,_0x4c04b4[_0x8437('0x10')][_0x8437('0x12')]);return _0x5aebbc(_0x4c04b4[_0x8437('0x10')][_0x8437('0x12')]);}logger['error'](_0x8437('0xc'),_0x4aef13,_0x4c04b4[_0x8437('0x10')][_0x8437('0x12')]);return _0x1729bb(_0x4c04b4[_0x8437('0x10')][_0x8437('0x12')]);}else{logger[_0x8437('0xb')](_0x8437('0xc'),_0x4aef13,'request\x20sent');_0x1729bb(_0x4c04b4[_0x8437('0x13')]['message']);}})['catch'](function(_0x32cf75){logger[_0x8437('0x10')](_0x8437('0xc'),_0x4aef13,_0x32cf75);_0x5aebbc(_0x32cf75);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 390b850..7df076d 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 _0xd7eb=['preview','/:id/run','/:id/query','query','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','/:id','/:id/preview'];(function(_0x48ad90,_0x2114ef){var _0x30e5c1=function(_0x41af68){while(--_0x41af68){_0x48ad90['push'](_0x48ad90['shift']());}};_0x30e5c1(++_0x2114ef);}(_0xd7eb,0x77));var _0xbd7e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xd7eb[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require(_0xbd7e('0x0'));var util=require(_0xbd7e('0x1'));var path=require(_0xbd7e('0x2'));var timeout=require(_0xbd7e('0x3'));var express=require(_0xbd7e('0x4'));var router=express['Router']();var fs_extra=require(_0xbd7e('0x5'));var auth=require(_0xbd7e('0x6'));var interaction=require(_0xbd7e('0x7'));var config=require('../../config/environment');var controller=require(_0xbd7e('0x8'));router[_0xbd7e('0x9')]('/',auth[_0xbd7e('0xa')](),controller['index']);router['get'](_0xbd7e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbd7e('0x9')](_0xbd7e('0xc'),auth['isAuthenticated'](),controller[_0xbd7e('0xd')]);router['get'](_0xbd7e('0xe'),auth['isAuthenticated'](),controller['run']);router['get'](_0xbd7e('0xf'),auth['isAuthenticated'](),controller[_0xbd7e('0x10')]);router[_0xbd7e('0x11')]('/',auth[_0xbd7e('0xa')](),controller[_0xbd7e('0x12')]);router[_0xbd7e('0x13')]('/:id',auth[_0xbd7e('0xa')](),controller['update']);router['delete'](_0xbd7e('0xb'),auth['isAuthenticated'](),controller[_0xbd7e('0x14')]);module[_0xbd7e('0x15')]=router; \ No newline at end of file +var _0x3822=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','run','/:id/query','query','create','put','update','delete','destroy','exports'];(function(_0x3767fb,_0x3b917c){var _0x9bd1b9=function(_0x37d2ba){while(--_0x37d2ba){_0x3767fb['push'](_0x3767fb['shift']());}};_0x9bd1b9(++_0x3b917c);}(_0x3822,0x1b8));var _0x2382=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x3822[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require(_0x2382('0x0'));var util=require(_0x2382('0x1'));var path=require(_0x2382('0x2'));var timeout=require(_0x2382('0x3'));var express=require(_0x2382('0x4'));var router=express[_0x2382('0x5')]();var fs_extra=require(_0x2382('0x6'));var auth=require(_0x2382('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x2382('0x8')](),controller[_0x2382('0x9')]);router[_0x2382('0xa')](_0x2382('0xb'),auth[_0x2382('0x8')](),controller[_0x2382('0xc')]);router[_0x2382('0xa')]('/:id/preview',auth[_0x2382('0x8')](),controller['preview']);router[_0x2382('0xa')]('/:id/run',auth[_0x2382('0x8')](),controller[_0x2382('0xd')]);router[_0x2382('0xa')](_0x2382('0xe'),auth[_0x2382('0x8')](),controller[_0x2382('0xf')]);router['post']('/',auth[_0x2382('0x8')](),controller[_0x2382('0x10')]);router[_0x2382('0x11')](_0x2382('0xb'),auth[_0x2382('0x8')](),controller[_0x2382('0x12')]);router[_0x2382('0x13')]('/:id',auth[_0x2382('0x8')](),controller[_0x2382('0x14')]);module[_0x2382('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 25cec10..591f8cf 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 _0xae24=['sequelize','STRING'];(function(_0x4a80a6,_0x52b720){var _0x14c900=function(_0x4d89f2){while(--_0x4d89f2){_0x4a80a6['push'](_0x4a80a6['shift']());}};_0x14c900(++_0x52b720);}(_0xae24,0x182));var _0x4ae2=function(_0x449a5a,_0x2f107f){_0x449a5a=_0x449a5a-0x0;var _0x4ef42a=_0xae24[_0x449a5a];return _0x4ef42a;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x1aadc5,_0x5eebc0){var _0xe8aff1=function(_0x55bc82){while(--_0x55bc82){_0x1aadc5['push'](_0x1aadc5['shift']());}};_0xe8aff1(++_0x5eebc0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0e1f8fa..dad07c2 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 _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0xaa9ade,_0x338eb5){var _0x31b0f3=function(_0x27b774){while(--_0x27b774){_0xaa9ade['push'](_0xaa9ade['shift']());}};_0x31b0f3(++_0x338eb5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x5fc3[_0x2d61b2];return _0x12df89;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file +var _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xc356b2,_0x37d108){_0xc356b2=_0xc356b2-0x0;var _0x34952a=_0xdbf5[_0xc356b2];return _0x34952a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 348b033..92b91f4 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 _0xabb0=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x43c7ca,_0x3f1b44){var _0x22215a=function(_0x17fd89){while(--_0x17fd89){_0x43c7ca['push'](_0x43c7ca['shift']());}};_0x22215a(++_0x3f1b44);}(_0xabb0,0xf2));var _0x0abb=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xabb0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0abb('0x0'));var util=require(_0x0abb('0x1'));var logger=require(_0x0abb('0x2'))(_0x0abb('0x3'));var moment=require(_0x0abb('0x4'));var BPromise=require('bluebird');var rp=require(_0x0abb('0x5'));var fs=require('fs');var path=require(_0x0abb('0x6'));var rimraf=require(_0x0abb('0x7'));var config=require(_0x0abb('0x8'));var attributes=require(_0x0abb('0x9'));module['exports']=function(_0x3ad551,_0x637dd2){return _0x3ad551[_0x0abb('0xa')](_0x0abb('0xb'),attributes,{'tableName':_0x0abb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x834d=['api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','util','../../config/logger'];(function(_0x2a600b,_0x26ce40){var _0x5ac763=function(_0x78e74a){while(--_0x78e74a){_0x2a600b['push'](_0x2a600b['shift']());}};_0x5ac763(++_0x26ce40);}(_0x834d,0x1ab));var _0xd834=function(_0x7e3dfe,_0xdc3db){_0x7e3dfe=_0x7e3dfe-0x0;var _0x38c148=_0x834d[_0x7e3dfe];return _0x38c148;};'use strict';var _=require('lodash');var util=require(_0xd834('0x0'));var logger=require(_0xd834('0x1'))(_0xd834('0x2'));var moment=require(_0xd834('0x3'));var BPromise=require(_0xd834('0x4'));var rp=require(_0xd834('0x5'));var fs=require('fs');var path=require(_0xd834('0x6'));var rimraf=require('rimraf');var config=require(_0xd834('0x7'));var attributes=require(_0xd834('0x8'));module['exports']=function(_0x3bf349,_0x103522){return _0x3bf349[_0xd834('0x9')](_0xd834('0xa'),attributes,{'tableName':'analytics_default_reports','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 341e386..7b3b3f1 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 _0x9455=['stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2dd796,_0x10611b){var _0xa15f3c=function(_0x430615){while(--_0x430615){_0x2dd796['push'](_0x2dd796['shift']());}};_0xa15f3c(++_0x10611b);}(_0x9455,0x85));var _0x5945=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9455[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x5945('0x0'));var util=require(_0x5945('0x1'));var moment=require('moment');var BPromise=require(_0x5945('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5945('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5945('0x4'));var config=require('../../config/environment');var jayson=require(_0x5945('0x5'));var client=jayson[_0x5945('0x6')][_0x5945('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e49b4,_0x126db,_0x259889){return new BPromise(function(_0x345a6f,_0x5455d3){return client[_0x5945('0x8')](_0x4e49b4,_0x259889)[_0x5945('0x9')](function(_0x5cd47c){logger[_0x5945('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x126db,'request\x20sent');logger[_0x5945('0xb')](_0x5945('0xc'),_0x126db,_0x5945('0xd'),JSON[_0x5945('0xe')](_0x5cd47c));if(_0x5cd47c[_0x5945('0xf')]){if(_0x5cd47c[_0x5945('0xf')][_0x5945('0x10')]===0x1f4){logger[_0x5945('0xf')](_0x5945('0x11'),_0x126db,_0x5cd47c['error'][_0x5945('0x12')]);return _0x5455d3(_0x5cd47c['error'][_0x5945('0x12')]);}logger['error'](_0x5945('0x11'),_0x126db,_0x5cd47c['error']['message']);return _0x345a6f(_0x5cd47c[_0x5945('0xf')][_0x5945('0x12')]);}else{logger[_0x5945('0xa')](_0x5945('0x11'),_0x126db,_0x5945('0xd'));_0x345a6f(_0x5cd47c[_0x5945('0x13')]['message']);}})[_0x5945('0x14')](function(_0x26ceb1){logger[_0x5945('0xf')](_0x5945('0x11'),_0x126db,_0x26ceb1);_0x5455d3(_0x26ceb1);});});} \ No newline at end of file +var _0x689b=['rpc','../../config/environment','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x689b,0x19e));var _0xb689=function(_0x9c50fe,_0xb11566){_0x9c50fe=_0x9c50fe-0x0;var _0x26116b=_0x689b[_0x9c50fe];return _0x26116b;};'use strict';var _=require(_0xb689('0x0'));var util=require('util');var moment=require(_0xb689('0x1'));var BPromise=require(_0xb689('0x2'));var rs=require(_0xb689('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb689('0x4'));var logger=require(_0xb689('0x5'))(_0xb689('0x6'));var config=require(_0xb689('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28bc45,_0x1d71f8,_0x5dc92f){return new BPromise(function(_0x678662,_0x51f804){return client[_0xb689('0x8')](_0x28bc45,_0x5dc92f)[_0xb689('0x9')](function(_0x41258c){logger['info'](_0xb689('0xa'),_0x1d71f8,_0xb689('0xb'));logger[_0xb689('0xc')](_0xb689('0xd'),_0x1d71f8,_0xb689('0xb'),JSON[_0xb689('0xe')](_0x41258c));if(_0x41258c[_0xb689('0xf')]){if(_0x41258c[_0xb689('0xf')][_0xb689('0x10')]===0x1f4){logger[_0xb689('0xf')](_0xb689('0xa'),_0x1d71f8,_0x41258c['error'][_0xb689('0x11')]);return _0x51f804(_0x41258c['error'][_0xb689('0x11')]);}logger[_0xb689('0xf')](_0xb689('0xa'),_0x1d71f8,_0x41258c[_0xb689('0xf')][_0xb689('0x11')]);return _0x678662(_0x41258c[_0xb689('0xf')][_0xb689('0x11')]);}else{logger[_0xb689('0x12')](_0xb689('0xa'),_0x1d71f8,_0xb689('0xb'));_0x678662(_0x41258c[_0xb689('0x13')][_0xb689('0x11')]);}})[_0xb689('0x14')](function(_0x2fec51){logger[_0xb689('0xf')](_0xb689('0xa'),_0x1d71f8,_0x2fec51);_0x51f804(_0x2fec51);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e172223..ce7a3bd 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 _0xe4a0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/preview','run','/:id/query','query','create','delete','/:id','destroy','exports','multer','util','path'];(function(_0xf16a02,_0x511866){var _0x444d4f=function(_0x25548f){while(--_0x25548f){_0xf16a02['push'](_0xf16a02['shift']());}};_0x444d4f(++_0x511866);}(_0xe4a0,0xcf));var _0x0e4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe4a0[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x0e4a('0x0'));var util=require(_0x0e4a('0x1'));var path=require(_0x0e4a('0x2'));var timeout=require(_0x0e4a('0x3'));var express=require('express');var router=express[_0x0e4a('0x4')]();var fs_extra=require(_0x0e4a('0x5'));var auth=require(_0x0e4a('0x6'));var interaction=require(_0x0e4a('0x7'));var config=require(_0x0e4a('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x0e4a('0x9')]('/',auth[_0x0e4a('0xa')](),controller['index']);router[_0x0e4a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0e4a('0xb')]);router['get'](_0x0e4a('0xc'),auth[_0x0e4a('0xa')](),controller['preview']);router['get']('/:id/run',auth[_0x0e4a('0xa')](),controller[_0x0e4a('0xd')]);router[_0x0e4a('0x9')](_0x0e4a('0xe'),auth[_0x0e4a('0xa')](),controller[_0x0e4a('0xf')]);router['post']('/',auth[_0x0e4a('0xa')](),controller[_0x0e4a('0x10')]);router['put']('/:id',auth[_0x0e4a('0xa')](),controller['update']);router[_0x0e4a('0x11')](_0x0e4a('0x12'),auth[_0x0e4a('0xa')](),controller[_0x0e4a('0x13')]);module[_0x0e4a('0x14')]=router; \ No newline at end of file +var _0xd892=['update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd892,0x1c9));var _0x2d89=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xd892[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x2d89('0x0'));var util=require(_0x2d89('0x1'));var path=require(_0x2d89('0x2'));var timeout=require(_0x2d89('0x3'));var express=require(_0x2d89('0x4'));var router=express['Router']();var fs_extra=require(_0x2d89('0x5'));var auth=require(_0x2d89('0x6'));var interaction=require(_0x2d89('0x7'));var config=require(_0x2d89('0x8'));var controller=require(_0x2d89('0x9'));router[_0x2d89('0xa')]('/',auth[_0x2d89('0xb')](),controller[_0x2d89('0xc')]);router['get'](_0x2d89('0xd'),auth['isAuthenticated'](),controller[_0x2d89('0xe')]);router['get'](_0x2d89('0xf'),auth[_0x2d89('0xb')](),controller['preview']);router[_0x2d89('0xa')](_0x2d89('0x10'),auth[_0x2d89('0xb')](),controller[_0x2d89('0x11')]);router[_0x2d89('0xa')](_0x2d89('0x12'),auth[_0x2d89('0xb')](),controller[_0x2d89('0x13')]);router[_0x2d89('0x14')]('/',auth[_0x2d89('0xb')](),controller[_0x2d89('0x15')]);router[_0x2d89('0x16')](_0x2d89('0xd'),auth['isAuthenticated'](),controller[_0x2d89('0x17')]);router['delete'](_0x2d89('0xd'),auth[_0x2d89('0xb')](),controller['destroy']);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 c0a75ed..00b44a2 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 _0x0e37=['ENUM','manual','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','DATE','Loading'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x0e37,0x7c));var _0x70e3=function(_0x5185cc,_0x39614a){_0x5185cc=_0x5185cc-0x0;var _0x1ac2a0=_0x0e37[_0x5185cc];return _0x1ac2a0;};'use strict';var Sequelize=require(_0x70e3('0x0'));var moment=require(_0x70e3('0x1'));module[_0x70e3('0x2')]={'name':{'type':Sequelize[_0x70e3('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x70e3('0x4'),_0x70e3('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x70e3('0x4')},'savename':{'type':Sequelize[_0x70e3('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x70e3('0x6')]},'status':{'type':Sequelize[_0x70e3('0x3')],'defaultValue':_0x70e3('0x7')},'type':{'type':Sequelize[_0x70e3('0x8')](_0x70e3('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x70e3('0xa')]},'reportType':{'type':Sequelize[_0x70e3('0x3')]}}; \ No newline at end of file +var _0x4dbe=['csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM'];(function(_0x24b483,_0x45e6b7){var _0x3aca08=function(_0x19f5a0){while(--_0x19f5a0){_0x24b483['push'](_0x24b483['shift']());}};_0x3aca08(++_0x45e6b7);}(_0x4dbe,0x10d));var _0xe4db=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4dbe[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xe4db('0x0'));var moment=require(_0xe4db('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xe4db('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xe4db('0x3')](_0xe4db('0x4'),_0xe4db('0x5'),_0xe4db('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xe4db('0x7')]},'endDate':{'type':Sequelize[_0xe4db('0x7')]},'status':{'type':Sequelize[_0xe4db('0x2')],'defaultValue':_0xe4db('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0xe4db('0x9')),'allowNull':![],'defaultValue':_0xe4db('0xa')},'reportId':{'type':Sequelize[_0xe4db('0xb')](0xb)[_0xe4db('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8baf308..4e86841 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 _0x5b49=['send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','AnalyticExtractedReport','includeAll','include','findAll','catch','show','params','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','join','server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','api','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','json','save','update','then','ExtractedReports','UserProfileResource','destroy','end','error','stack','name'];(function(_0x5019aa,_0x35edb9){var _0x55cf92=function(_0x31c3a8){while(--_0x31c3a8){_0x5019aa['push'](_0x5019aa['shift']());}};_0x55cf92(++_0x35edb9);}(_0x5b49,0x95));var _0x95b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5b49[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x95b4('0x0'));var rimraf=require(_0x95b4('0x1'));var zipdir=require(_0x95b4('0x2'));var jsonpatch=require(_0x95b4('0x3'));var rp=require(_0x95b4('0x4'));var moment=require(_0x95b4('0x5'));var BPromise=require(_0x95b4('0x6'));var Mustache=require(_0x95b4('0x7'));var util=require(_0x95b4('0x8'));var path=require(_0x95b4('0x9'));var sox=require(_0x95b4('0xa'));var csv=require(_0x95b4('0xb'));var ejs=require(_0x95b4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95b4('0xd'));var squel=require(_0x95b4('0xe'));var crypto=require(_0x95b4('0xf'));var jsforce=require(_0x95b4('0x10'));var deskjs=require(_0x95b4('0x11'));var toCsv=require(_0x95b4('0xb'));var querystring=require('querystring');var Papa=require(_0x95b4('0x12'));var Redis=require(_0x95b4('0x13'));var authService=require(_0x95b4('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x95b4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x95b4('0x16'));var db=require(_0x95b4('0x17'))['db'];function respondWithStatusCode(_0x2428ca,_0x53f1de){_0x53f1de=_0x53f1de||0xcc;return function(_0x45120e){if(_0x45120e){return _0x2428ca['sendStatus'](_0x53f1de);}return _0x2428ca['status'](_0x53f1de)['end']();};}function respondWithResult(_0x248973,_0x6e0652){_0x6e0652=_0x6e0652||0xc8;return function(_0x1bb5ed){if(_0x1bb5ed){return _0x248973[_0x95b4('0x18')](_0x6e0652)['json'](_0x1bb5ed);}};}function respondWithFilteredResult(_0x11a931,_0xda4190){return function(_0x253a8c){if(_0x253a8c){var _0x30b536=typeof _0xda4190[_0x95b4('0x19')]===_0x95b4('0x1a')&&typeof _0xda4190['limit']===_0x95b4('0x1a');var _0x460b12=_0x253a8c[_0x95b4('0x1b')];var _0x5838d1=_0x30b536?0x0:_0xda4190[_0x95b4('0x19')];var _0x138208=_0x30b536?_0x253a8c['count']:_0xda4190[_0x95b4('0x19')]+_0xda4190[_0x95b4('0x1c')];var _0xe58517;if(_0x138208>=_0x460b12){_0x138208=_0x460b12;_0xe58517=0xc8;}else{_0xe58517=0xce;}_0x11a931[_0x95b4('0x18')](_0xe58517);return _0x11a931[_0x95b4('0x1d')]('Content-Range',_0x5838d1+'-'+_0x138208+'/'+_0x460b12)[_0x95b4('0x1e')](_0x253a8c);}return null;};}function patchUpdates(_0x2c1a7d){return function(_0x2e5f5f){try{jsonpatch['apply'](_0x2e5f5f,_0x2c1a7d,!![]);}catch(_0x465d4c){return BPromise['reject'](_0x465d4c);}return _0x2e5f5f[_0x95b4('0x1f')]();};}function saveUpdates(_0x9ffcc,_0x34e178){return function(_0x322017){if(_0x322017){return _0x322017[_0x95b4('0x20')](_0x9ffcc)[_0x95b4('0x21')](function(_0x3b8e59){return _0x3b8e59;});}return null;};}function removeEntity(_0x152030,_0x180b0e){return function(_0x2657bd){if(_0x2657bd){return _0x2657bd['destroy']()[_0x95b4('0x21')](function(){var _0x37b1bf=_0x2657bd['get']({'plain':!![]});var _0x40daae=_0x95b4('0x22');return db[_0x95b4('0x23')][_0x95b4('0x24')]({'where':{'type':_0x40daae,'resourceId':_0x37b1bf['id']}})[_0x95b4('0x21')](function(){return _0x2657bd;});})[_0x95b4('0x21')](function(){_0x152030[_0x95b4('0x18')](0xcc)[_0x95b4('0x25')]();});}};}function handleEntityNotFound(_0x2c6898,_0x2aef91){return function(_0x114de1){if(!_0x114de1){_0x2c6898['sendStatus'](0x194);}return _0x114de1;};}function handleError(_0x2e0b33,_0x49f9bd){_0x49f9bd=_0x49f9bd||0x1f4;return function(_0xeb1ed1){logger[_0x95b4('0x26')](_0xeb1ed1[_0x95b4('0x27')]);if(_0xeb1ed1[_0x95b4('0x28')]){delete _0xeb1ed1[_0x95b4('0x28')];}_0x2e0b33[_0x95b4('0x18')](_0x49f9bd)[_0x95b4('0x29')](_0xeb1ed1);};}exports['index']=function(_0x54a94a,_0x59710a){var _0x5175ea={},_0x9dbb8b={},_0x1cfdb5={'count':0x0,'rows':[]};var _0x49326c=_['map'](db['AnalyticExtractedReport'][_0x95b4('0x2a')],function(_0x300e36){return{'name':_0x300e36[_0x95b4('0x2b')],'type':_0x300e36[_0x95b4('0x2c')]['key']};});_0x9dbb8b[_0x95b4('0x2d')]=_[_0x95b4('0x2e')](_0x49326c,'name');_0x9dbb8b[_0x95b4('0x2f')]=_[_0x95b4('0x30')](_0x54a94a[_0x95b4('0x2f')]);_0x9dbb8b[_0x95b4('0x31')]=_[_0x95b4('0x32')](_0x9dbb8b[_0x95b4('0x2d')],_0x9dbb8b[_0x95b4('0x2f')]);_0x5175ea[_0x95b4('0x33')]=_[_0x95b4('0x32')](_0x9dbb8b[_0x95b4('0x2d')],qs[_0x95b4('0x34')](_0x54a94a['query'][_0x95b4('0x34')]));_0x5175ea[_0x95b4('0x33')]=_0x5175ea[_0x95b4('0x33')][_0x95b4('0x35')]?_0x5175ea[_0x95b4('0x33')]:_0x9dbb8b[_0x95b4('0x2d')];if(!_0x54a94a[_0x95b4('0x2f')][_0x95b4('0x36')](_0x95b4('0x37'))){_0x5175ea['limit']=qs[_0x95b4('0x1c')](_0x54a94a['query']['limit']);_0x5175ea['offset']=qs[_0x95b4('0x19')](_0x54a94a['query'][_0x95b4('0x19')]);}_0x5175ea[_0x95b4('0x38')]=qs[_0x95b4('0x39')](_0x54a94a[_0x95b4('0x2f')][_0x95b4('0x39')]);_0x5175ea['where']=qs['filters'](_[_0x95b4('0x3a')](_0x54a94a[_0x95b4('0x2f')],_0x9dbb8b['filters']),_0x49326c);if(_0x54a94a[_0x95b4('0x2f')][_0x95b4('0x3b')]){_0x5175ea['where']=_[_0x95b4('0x3c')](_0x5175ea[_0x95b4('0x3d')],{'$or':_[_0x95b4('0x2e')](_0x49326c,function(_0x5528c5){if(_0x5528c5['type']!==_0x95b4('0x3e')){var _0x3dd99f={};_0x3dd99f[_0x5528c5[_0x95b4('0x28')]]={'$like':'%'+_0x54a94a[_0x95b4('0x2f')][_0x95b4('0x3b')]+'%'};return _0x3dd99f;}})});}_0x5175ea=_[_0x95b4('0x3c')]({},_0x5175ea,_0x54a94a['options']);var _0x391610={'where':_0x5175ea[_0x95b4('0x3d')]};return db[_0x95b4('0x3f')][_0x95b4('0x1b')](_0x391610)[_0x95b4('0x21')](function(_0xba85ba){_0x1cfdb5[_0x95b4('0x1b')]=_0xba85ba;if(_0x54a94a['query'][_0x95b4('0x40')]){_0x5175ea[_0x95b4('0x41')]=[{'all':!![]}];}return db[_0x95b4('0x3f')][_0x95b4('0x42')](_0x5175ea);})['then'](function(_0x545905){_0x1cfdb5['rows']=_0x545905;return _0x1cfdb5;})[_0x95b4('0x21')](respondWithFilteredResult(_0x59710a,_0x5175ea))[_0x95b4('0x43')](handleError(_0x59710a,null));};exports[_0x95b4('0x44')]=function(_0xcd52ae,_0x3d8d7f){var _0x70ffc7={'raw':!![],'where':{'id':_0xcd52ae[_0x95b4('0x45')]['id']}},_0x51cb7a={};_0x51cb7a[_0x95b4('0x2d')]=_[_0x95b4('0x30')](db[_0x95b4('0x3f')][_0x95b4('0x2a')]);_0x51cb7a['query']=_[_0x95b4('0x30')](_0xcd52ae['query']);_0x51cb7a[_0x95b4('0x31')]=_['intersection'](_0x51cb7a['model'],_0x51cb7a['query']);_0x70ffc7[_0x95b4('0x33')]=_[_0x95b4('0x32')](_0x51cb7a[_0x95b4('0x2d')],qs['fields'](_0xcd52ae[_0x95b4('0x2f')][_0x95b4('0x34')]));_0x70ffc7[_0x95b4('0x33')]=_0x70ffc7[_0x95b4('0x33')]['length']?_0x70ffc7[_0x95b4('0x33')]:_0x51cb7a['model'];if(_0xcd52ae[_0x95b4('0x2f')][_0x95b4('0x40')]){_0x70ffc7[_0x95b4('0x41')]=[{'all':!![]}];}_0x70ffc7=_[_0x95b4('0x3c')]({},_0x70ffc7,_0xcd52ae[_0x95b4('0x46')]);return db[_0x95b4('0x3f')]['find'](_0x70ffc7)[_0x95b4('0x21')](handleEntityNotFound(_0x3d8d7f,null))[_0x95b4('0x21')](respondWithResult(_0x3d8d7f,null))[_0x95b4('0x43')](handleError(_0x3d8d7f,null));};exports[_0x95b4('0x47')]=function(_0x44b480,_0x4dd157){return db[_0x95b4('0x3f')][_0x95b4('0x47')](_0x44b480[_0x95b4('0x48')],{})[_0x95b4('0x21')](function(_0xfdff9f){var _0x416050=_0x44b480['user'][_0x95b4('0x49')]({'plain':!![]});if(!_0x416050)throw new Error(_0x95b4('0x4a'));if(_0x416050[_0x95b4('0x4b')]===_0x95b4('0x4c')){var _0x419372=_0xfdff9f[_0x95b4('0x49')]({'plain':!![]});var _0x4c4d95='ExtractedReports';return db[_0x95b4('0x4d')][_0x95b4('0x4e')]({'where':{'name':_0x4c4d95,'userProfileId':_0x416050['userProfileId']},'raw':!![]})[_0x95b4('0x21')](function(_0xe6b9d){if(_0xe6b9d&&_0xe6b9d[_0x95b4('0x4f')]===0x0){return db[_0x95b4('0x23')][_0x95b4('0x47')]({'name':_0x419372[_0x95b4('0x28')],'resourceId':_0x419372['id'],'type':_0xe6b9d[_0x95b4('0x28')],'sectionId':_0xe6b9d['id']},{})['then'](function(){return _0xfdff9f;});}else{return _0xfdff9f;}})[_0x95b4('0x43')](function(_0x1a298b){logger[_0x95b4('0x26')](_0x95b4('0x50'),_0x1a298b);throw _0x1a298b;});}return _0xfdff9f;})['then'](respondWithResult(_0x4dd157,0xc9))[_0x95b4('0x43')](handleError(_0x4dd157,null));};exports[_0x95b4('0x20')]=function(_0x30e321,_0xa84a0b){if(_0x30e321[_0x95b4('0x48')]['id']){delete _0x30e321['body']['id'];}return db[_0x95b4('0x3f')][_0x95b4('0x4e')]({'where':{'id':_0x30e321[_0x95b4('0x45')]['id']}})[_0x95b4('0x21')](handleEntityNotFound(_0xa84a0b,null))[_0x95b4('0x21')](saveUpdates(_0x30e321['body'],null))[_0x95b4('0x21')](respondWithResult(_0xa84a0b,null))[_0x95b4('0x43')](handleError(_0xa84a0b,null));};exports[_0x95b4('0x24')]=function(_0x596aff,_0x3e565c){return db['AnalyticExtractedReport'][_0x95b4('0x4e')]({'where':{'id':_0x596aff[_0x95b4('0x45')]['id']}})[_0x95b4('0x21')](handleEntityNotFound(_0x3e565c,null))['then'](removeEntity(_0x3e565c,null))[_0x95b4('0x43')](handleError(_0x3e565c,null));};exports[_0x95b4('0x51')]=function(_0x37e31d,_0x21fa6f,_0x3179e6){return db[_0x95b4('0x3f')]['find']({'where':{'id':_0x37e31d[_0x95b4('0x45')]['id']},'attributes':[_0x95b4('0x28'),_0x95b4('0x52'),_0x95b4('0x53'),_0x95b4('0x54')],'raw':!![]})[_0x95b4('0x21')](handleEntityNotFound(_0x21fa6f,null))['then'](function(_0x389c06){if(_0x389c06){if(!fs['existsSync'](path['join'](config[_0x95b4('0x55')],'server/files/reports',_0x389c06[_0x95b4('0x53')]))){throw new db[(_0x95b4('0x56'))][(_0x95b4('0x57'))](_0x95b4('0x58'));}if(_0x37e31d[_0x95b4('0x2f')][_0x95b4('0x59')]){return _0x21fa6f[_0x95b4('0x5a')](0xc8);}return _0x21fa6f['download'](path[_0x95b4('0x5b')](config[_0x95b4('0x55')],_0x95b4('0x5c'),_0x389c06[_0x95b4('0x53')]),util[_0x95b4('0x5d')](_0x95b4('0x5e'),_0x389c06['basename']||_0x389c06[_0x95b4('0x28')],_0x389c06[_0x95b4('0x54')]['toLowerCase']()));}})[_0x95b4('0x43')](handleError(_0x21fa6f,null));}; \ No newline at end of file +var _0x7384=['crypto','desk.js','to-csv','querystring','ioredis','../../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','set','Content-Range','apply','save','update','destroy','ExtractedReports','UserProfileResource','then','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','AnalyticExtractedReport','findAll','show','params','keys','includeAll','include','catch','create','body','user','get','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','find','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0x7384,0x170));var _0x4738=function(_0x45dee4,_0x574be2){_0x45dee4=_0x45dee4-0x0;var _0x1d98e9=_0x7384[_0x45dee4];return _0x1d98e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4738('0x0'));var zipdir=require(_0x4738('0x1'));var jsonpatch=require(_0x4738('0x2'));var rp=require(_0x4738('0x3'));var moment=require('moment');var BPromise=require(_0x4738('0x4'));var Mustache=require(_0x4738('0x5'));var util=require(_0x4738('0x6'));var path=require(_0x4738('0x7'));var sox=require(_0x4738('0x8'));var csv=require('to-csv');var ejs=require(_0x4738('0x9'));var fs=require('fs');var fs_extra=require(_0x4738('0xa'));var _=require('lodash');var squel=require(_0x4738('0xb'));var crypto=require(_0x4738('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4738('0xd'));var toCsv=require(_0x4738('0xe'));var querystring=require(_0x4738('0xf'));var Papa=require('papaparse');var Redis=require(_0x4738('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4738('0x11'));var as=require(_0x4738('0x12'));var hardwareService=require(_0x4738('0x13'));var logger=require(_0x4738('0x14'))('api');var utils=require(_0x4738('0x15'));var config=require(_0x4738('0x16'));var licenseUtil=require(_0x4738('0x17'));var db=require(_0x4738('0x18'))['db'];function respondWithStatusCode(_0x451d9e,_0x40c9a2){_0x40c9a2=_0x40c9a2||0xcc;return function(_0xaa9858){if(_0xaa9858){return _0x451d9e[_0x4738('0x19')](_0x40c9a2);}return _0x451d9e['status'](_0x40c9a2)[_0x4738('0x1a')]();};}function respondWithResult(_0x1691ff,_0x4ae7cc){_0x4ae7cc=_0x4ae7cc||0xc8;return function(_0x3dada4){if(_0x3dada4){return _0x1691ff[_0x4738('0x1b')](_0x4ae7cc)[_0x4738('0x1c')](_0x3dada4);}};}function respondWithFilteredResult(_0x5ea850,_0x21f197){return function(_0x46fab9){if(_0x46fab9){var _0xe3dc0=typeof _0x21f197[_0x4738('0x1d')]===_0x4738('0x1e')&&typeof _0x21f197[_0x4738('0x1f')]==='undefined';var _0x2d5180=_0x46fab9[_0x4738('0x20')];var _0x6ac0ba=_0xe3dc0?0x0:_0x21f197['offset'];var _0x1fe15f=_0xe3dc0?_0x46fab9[_0x4738('0x20')]:_0x21f197[_0x4738('0x1d')]+_0x21f197['limit'];var _0x151878;if(_0x1fe15f>=_0x2d5180){_0x1fe15f=_0x2d5180;_0x151878=0xc8;}else{_0x151878=0xce;}_0x5ea850['status'](_0x151878);return _0x5ea850[_0x4738('0x21')](_0x4738('0x22'),_0x6ac0ba+'-'+_0x1fe15f+'/'+_0x2d5180)[_0x4738('0x1c')](_0x46fab9);}return null;};}function patchUpdates(_0x31a818){return function(_0x1f0633){try{jsonpatch[_0x4738('0x23')](_0x1f0633,_0x31a818,!![]);}catch(_0x55dd0e){return BPromise['reject'](_0x55dd0e);}return _0x1f0633[_0x4738('0x24')]();};}function saveUpdates(_0x4400c5,_0x49ed5b){return function(_0x799dd1){if(_0x799dd1){return _0x799dd1[_0x4738('0x25')](_0x4400c5)['then'](function(_0x4fd90d){return _0x4fd90d;});}return null;};}function removeEntity(_0x1e4180,_0x56840a){return function(_0x21874b){if(_0x21874b){return _0x21874b[_0x4738('0x26')]()['then'](function(){var _0x3d713c=_0x21874b['get']({'plain':!![]});var _0x514079=_0x4738('0x27');return db[_0x4738('0x28')][_0x4738('0x26')]({'where':{'type':_0x514079,'resourceId':_0x3d713c['id']}})[_0x4738('0x29')](function(){return _0x21874b;});})[_0x4738('0x29')](function(){_0x1e4180[_0x4738('0x1b')](0xcc)[_0x4738('0x1a')]();});}};}function handleEntityNotFound(_0x26b713,_0x25fb94){return function(_0x432f98){if(!_0x432f98){_0x26b713[_0x4738('0x19')](0x194);}return _0x432f98;};}function handleError(_0x25a82d,_0xfc2206){_0xfc2206=_0xfc2206||0x1f4;return function(_0x1d1243){logger['error'](_0x1d1243[_0x4738('0x2a')]);if(_0x1d1243['name']){delete _0x1d1243['name'];}_0x25a82d[_0x4738('0x1b')](_0xfc2206)[_0x4738('0x2b')](_0x1d1243);};}exports[_0x4738('0x2c')]=function(_0x5e4fb8,_0x19ff9a){var _0x1f3a7f={},_0x361ff6={},_0x2ce1a3={'count':0x0,'rows':[]};var _0x48ab14=_[_0x4738('0x2d')](db['AnalyticExtractedReport'][_0x4738('0x2e')],function(_0x4570ee){return{'name':_0x4570ee[_0x4738('0x2f')],'type':_0x4570ee[_0x4738('0x30')][_0x4738('0x31')]};});_0x361ff6[_0x4738('0x32')]=_[_0x4738('0x2d')](_0x48ab14,_0x4738('0x33'));_0x361ff6[_0x4738('0x34')]=_['keys'](_0x5e4fb8[_0x4738('0x34')]);_0x361ff6[_0x4738('0x35')]=_[_0x4738('0x36')](_0x361ff6['model'],_0x361ff6[_0x4738('0x34')]);_0x1f3a7f[_0x4738('0x37')]=_[_0x4738('0x36')](_0x361ff6['model'],qs[_0x4738('0x38')](_0x5e4fb8['query'][_0x4738('0x38')]));_0x1f3a7f['attributes']=_0x1f3a7f['attributes'][_0x4738('0x39')]?_0x1f3a7f[_0x4738('0x37')]:_0x361ff6[_0x4738('0x32')];if(!_0x5e4fb8[_0x4738('0x34')][_0x4738('0x3a')]('nolimit')){_0x1f3a7f[_0x4738('0x1f')]=qs[_0x4738('0x1f')](_0x5e4fb8[_0x4738('0x34')]['limit']);_0x1f3a7f[_0x4738('0x1d')]=qs[_0x4738('0x1d')](_0x5e4fb8[_0x4738('0x34')][_0x4738('0x1d')]);}_0x1f3a7f[_0x4738('0x3b')]=qs[_0x4738('0x3c')](_0x5e4fb8['query']['sort']);_0x1f3a7f['where']=qs[_0x4738('0x35')](_[_0x4738('0x3d')](_0x5e4fb8[_0x4738('0x34')],_0x361ff6[_0x4738('0x35')]),_0x48ab14);if(_0x5e4fb8[_0x4738('0x34')][_0x4738('0x3e')]){_0x1f3a7f['where']=_[_0x4738('0x3f')](_0x1f3a7f[_0x4738('0x40')],{'$or':_[_0x4738('0x2d')](_0x48ab14,function(_0x1e3fd4){if(_0x1e3fd4[_0x4738('0x30')]!==_0x4738('0x41')){var _0x151448={};_0x151448[_0x1e3fd4[_0x4738('0x33')]]={'$like':'%'+_0x5e4fb8[_0x4738('0x34')]['filter']+'%'};return _0x151448;}})});}_0x1f3a7f=_[_0x4738('0x3f')]({},_0x1f3a7f,_0x5e4fb8[_0x4738('0x42')]);var _0x4dcd5f={'where':_0x1f3a7f[_0x4738('0x40')]};return db[_0x4738('0x43')][_0x4738('0x20')](_0x4dcd5f)[_0x4738('0x29')](function(_0x3a65ee){_0x2ce1a3[_0x4738('0x20')]=_0x3a65ee;if(_0x5e4fb8[_0x4738('0x34')]['includeAll']){_0x1f3a7f['include']=[{'all':!![]}];}return db[_0x4738('0x43')][_0x4738('0x44')](_0x1f3a7f);})[_0x4738('0x29')](function(_0x52a767){_0x2ce1a3['rows']=_0x52a767;return _0x2ce1a3;})[_0x4738('0x29')](respondWithFilteredResult(_0x19ff9a,_0x1f3a7f))['catch'](handleError(_0x19ff9a,null));};exports[_0x4738('0x45')]=function(_0x36d270,_0xccde75){var _0x31616f={'raw':!![],'where':{'id':_0x36d270[_0x4738('0x46')]['id']}},_0xc6d1af={};_0xc6d1af['model']=_[_0x4738('0x47')](db[_0x4738('0x43')][_0x4738('0x2e')]);_0xc6d1af['query']=_[_0x4738('0x47')](_0x36d270[_0x4738('0x34')]);_0xc6d1af[_0x4738('0x35')]=_[_0x4738('0x36')](_0xc6d1af[_0x4738('0x32')],_0xc6d1af['query']);_0x31616f[_0x4738('0x37')]=_[_0x4738('0x36')](_0xc6d1af[_0x4738('0x32')],qs['fields'](_0x36d270[_0x4738('0x34')][_0x4738('0x38')]));_0x31616f[_0x4738('0x37')]=_0x31616f['attributes'][_0x4738('0x39')]?_0x31616f[_0x4738('0x37')]:_0xc6d1af[_0x4738('0x32')];if(_0x36d270['query'][_0x4738('0x48')]){_0x31616f[_0x4738('0x49')]=[{'all':!![]}];}_0x31616f=_[_0x4738('0x3f')]({},_0x31616f,_0x36d270['options']);return db[_0x4738('0x43')]['find'](_0x31616f)[_0x4738('0x29')](handleEntityNotFound(_0xccde75,null))[_0x4738('0x29')](respondWithResult(_0xccde75,null))[_0x4738('0x4a')](handleError(_0xccde75,null));};exports[_0x4738('0x4b')]=function(_0x234ca5,_0x3eee46){return db[_0x4738('0x43')][_0x4738('0x4b')](_0x234ca5[_0x4738('0x4c')],{})['then'](function(_0x55c0e2){var _0x355111=_0x234ca5[_0x4738('0x4d')][_0x4738('0x4e')]({'plain':!![]});if(!_0x355111)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x355111['role']===_0x4738('0x4d')){var _0x374805=_0x55c0e2[_0x4738('0x4e')]({'plain':!![]});var _0x3c8ba6='ExtractedReports';return db['UserProfileSection']['find']({'where':{'name':_0x3c8ba6,'userProfileId':_0x355111[_0x4738('0x4f')]},'raw':!![]})[_0x4738('0x29')](function(_0xf81ce4){if(_0xf81ce4&&_0xf81ce4['autoAssociation']===0x0){return db[_0x4738('0x28')][_0x4738('0x4b')]({'name':_0x374805[_0x4738('0x33')],'resourceId':_0x374805['id'],'type':_0xf81ce4[_0x4738('0x33')],'sectionId':_0xf81ce4['id']},{})[_0x4738('0x29')](function(){return _0x55c0e2;});}else{return _0x55c0e2;}})[_0x4738('0x4a')](function(_0x36dbc1){logger[_0x4738('0x50')](_0x4738('0x51'),_0x36dbc1);throw _0x36dbc1;});}return _0x55c0e2;})[_0x4738('0x29')](respondWithResult(_0x3eee46,0xc9))[_0x4738('0x4a')](handleError(_0x3eee46,null));};exports[_0x4738('0x25')]=function(_0x2995c0,_0x3f60c1){if(_0x2995c0[_0x4738('0x4c')]['id']){delete _0x2995c0[_0x4738('0x4c')]['id'];}return db[_0x4738('0x43')]['find']({'where':{'id':_0x2995c0[_0x4738('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f60c1,null))[_0x4738('0x29')](saveUpdates(_0x2995c0[_0x4738('0x4c')],null))['then'](respondWithResult(_0x3f60c1,null))[_0x4738('0x4a')](handleError(_0x3f60c1,null));};exports[_0x4738('0x26')]=function(_0x25ce3a,_0xed8237){return db[_0x4738('0x43')]['find']({'where':{'id':_0x25ce3a[_0x4738('0x46')]['id']}})['then'](handleEntityNotFound(_0xed8237,null))[_0x4738('0x29')](removeEntity(_0xed8237,null))[_0x4738('0x4a')](handleError(_0xed8237,null));};exports[_0x4738('0x52')]=function(_0x2f26bc,_0x1a1e76,_0xc6dd61){return db[_0x4738('0x43')][_0x4738('0x53')]({'where':{'id':_0x2f26bc['params']['id']},'attributes':[_0x4738('0x33'),_0x4738('0x54'),_0x4738('0x55'),_0x4738('0x56')],'raw':!![]})[_0x4738('0x29')](handleEntityNotFound(_0x1a1e76,null))[_0x4738('0x29')](function(_0x1c73c3){if(_0x1c73c3){if(!fs['existsSync'](path[_0x4738('0x57')](config[_0x4738('0x58')],_0x4738('0x59'),_0x1c73c3[_0x4738('0x55')]))){throw new db[(_0x4738('0x5a'))][(_0x4738('0x5b'))](_0x4738('0x5c'));}if(_0x2f26bc[_0x4738('0x34')]['exists']){return _0x1a1e76[_0x4738('0x19')](0xc8);}return _0x1a1e76[_0x4738('0x52')](path[_0x4738('0x57')](config[_0x4738('0x58')],_0x4738('0x59'),_0x1c73c3[_0x4738('0x55')]),util[_0x4738('0x5d')](_0x4738('0x5e'),_0x1c73c3[_0x4738('0x54')]||_0x1c73c3[_0x4738('0x33')],_0x1c73c3[_0x4738('0x56')]['toLowerCase']()));}})[_0x4738('0x4a')](handleError(_0x1a1e76,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b52c839..ccc641f 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 _0xa24b=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util'];(function(_0x2b4e35,_0x4611cd){var _0x5a3345=function(_0x1d90d0){while(--_0x1d90d0){_0x2b4e35['push'](_0x2b4e35['shift']());}};_0x5a3345(++_0x4611cd);}(_0xa24b,0x1d5));var _0xba24=function(_0x4b01ce,_0x2f2e1b){_0x4b01ce=_0x4b01ce-0x0;var _0x54bfa9=_0xa24b[_0x4b01ce];return _0x54bfa9;};'use strict';var _=require('lodash');var util=require(_0xba24('0x0'));var logger=require(_0xba24('0x1'))('api');var moment=require(_0xba24('0x2'));var BPromise=require(_0xba24('0x3'));var rp=require(_0xba24('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba24('0x5'));var attributes=require(_0xba24('0x6'));module['exports']=function(_0x35a7b6,_0x59d007){return _0x35a7b6[_0xba24('0x7')](_0xba24('0x8'),attributes,{'tableName':_0xba24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa600=['util','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa600,0x1ac));var _0x0a60=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0xa600[_0x366e99];return _0x180bbe;};'use strict';var _=require(_0x0a60('0x0'));var util=require(_0x0a60('0x1'));var logger=require('../../config/logger')(_0x0a60('0x2'));var moment=require(_0x0a60('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a60('0x4'));var fs=require('fs');var path=require(_0x0a60('0x5'));var rimraf=require(_0x0a60('0x6'));var config=require(_0x0a60('0x7'));var attributes=require(_0x0a60('0x8'));module[_0x0a60('0x9')]=function(_0x2250a7,_0xc57d65){return _0x2250a7[_0x0a60('0xa')](_0x0a60('0xb'),attributes,{'tableName':_0x0a60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 149faef..8470b25 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 _0x2b50=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2c4c5b,_0x3c3e7f){var _0x1e0084=function(_0x24a0bd){while(--_0x24a0bd){_0x2c4c5b['push'](_0x2c4c5b['shift']());}};_0x1e0084(++_0x3c3e7f);}(_0x2b50,0x68));var _0x02b5=function(_0x3e671a,_0x2d88cd){_0x3e671a=_0x3e671a-0x0;var _0x335b56=_0x2b50[_0x3e671a];return _0x335b56;};'use strict';var _=require(_0x02b5('0x0'));var util=require('util');var moment=require(_0x02b5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02b5('0x2'))['db'];var utils=require(_0x02b5('0x3'));var logger=require(_0x02b5('0x4'))(_0x02b5('0x5'));var config=require('../../config/environment');var jayson=require(_0x02b5('0x6'));var client=jayson[_0x02b5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ba96b,_0x55c24d,_0x2353f8){return new BPromise(function(_0x3be9df,_0xbac4a9){return client[_0x02b5('0x8')](_0x5ba96b,_0x2353f8)[_0x02b5('0x9')](function(_0x44b9b9){logger[_0x02b5('0xa')](_0x02b5('0xb'),_0x55c24d,_0x02b5('0xc'));logger[_0x02b5('0xd')](_0x02b5('0xe'),_0x55c24d,_0x02b5('0xc'),JSON[_0x02b5('0xf')](_0x44b9b9));if(_0x44b9b9[_0x02b5('0x10')]){if(_0x44b9b9[_0x02b5('0x10')][_0x02b5('0x11')]===0x1f4){logger[_0x02b5('0x10')](_0x02b5('0xb'),_0x55c24d,_0x44b9b9[_0x02b5('0x10')][_0x02b5('0x12')]);return _0xbac4a9(_0x44b9b9[_0x02b5('0x10')][_0x02b5('0x12')]);}logger[_0x02b5('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x55c24d,_0x44b9b9['error'][_0x02b5('0x12')]);return _0x3be9df(_0x44b9b9[_0x02b5('0x10')]['message']);}else{logger[_0x02b5('0xa')](_0x02b5('0xb'),_0x55c24d,_0x02b5('0xc'));_0x3be9df(_0x44b9b9[_0x02b5('0x13')][_0x02b5('0x12')]);}})[_0x02b5('0x14')](function(_0x39dfee){logger[_0x02b5('0x10')](_0x02b5('0xb'),_0x55c24d,_0x39dfee);_0xbac4a9(_0x39dfee);});});} \ No newline at end of file +var _0x6bc9=['AnalyticExtractedReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0x6bc9,0x180));var _0x96bc=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x6bc9[_0x378891];return _0xfbfda2;};'use strict';var _=require('lodash');var util=require(_0x96bc('0x0'));var moment=require(_0x96bc('0x1'));var BPromise=require(_0x96bc('0x2'));var rs=require(_0x96bc('0x3'));var fs=require('fs');var Redis=require(_0x96bc('0x4'));var db=require(_0x96bc('0x5'))['db'];var utils=require(_0x96bc('0x6'));var logger=require('../../config/logger')(_0x96bc('0x7'));var config=require(_0x96bc('0x8'));var jayson=require(_0x96bc('0x9'));var client=jayson[_0x96bc('0xa')][_0x96bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2efb96,_0x356268,_0x4a886c){return new BPromise(function(_0x577d16,_0x3556bc){return client[_0x96bc('0xc')](_0x2efb96,_0x4a886c)[_0x96bc('0xd')](function(_0x540158){logger[_0x96bc('0xe')](_0x96bc('0xf'),_0x356268,'request\x20sent');logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x356268,'request\x20sent',JSON[_0x96bc('0x10')](_0x540158));if(_0x540158[_0x96bc('0x11')]){if(_0x540158[_0x96bc('0x11')]['code']===0x1f4){logger[_0x96bc('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x356268,_0x540158[_0x96bc('0x11')][_0x96bc('0x12')]);return _0x3556bc(_0x540158['error'][_0x96bc('0x12')]);}logger[_0x96bc('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x356268,_0x540158[_0x96bc('0x11')][_0x96bc('0x12')]);return _0x577d16(_0x540158['error'][_0x96bc('0x12')]);}else{logger[_0x96bc('0xe')](_0x96bc('0xf'),_0x356268,_0x96bc('0x13'));_0x577d16(_0x540158['result']['message']);}})[_0x96bc('0x14')](function(_0x1df439){logger[_0x96bc('0x11')](_0x96bc('0xf'),_0x356268,_0x1df439);_0x3556bc(_0x1df439);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 47035f8..54c99ec 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 _0xdb53=['/:id','/:id/download','download','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x241519,_0x1003a9){var _0xe506b1=function(_0x47d7e6){while(--_0x47d7e6){_0x241519['push'](_0x241519['shift']());}};_0xe506b1(++_0x1003a9);}(_0xdb53,0x1d7));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3db5('0x0'));var util=require(_0x3db5('0x1'));var path=require(_0x3db5('0x2'));var timeout=require('connect-timeout');var express=require(_0x3db5('0x3'));var router=express[_0x3db5('0x4')]();var fs_extra=require(_0x3db5('0x5'));var auth=require(_0x3db5('0x6'));var interaction=require(_0x3db5('0x7'));var config=require(_0x3db5('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x3db5('0x9')]('/',auth[_0x3db5('0xa')](),controller[_0x3db5('0xb')]);router[_0x3db5('0x9')](_0x3db5('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3db5('0xd'),auth[_0x3db5('0xa')](),controller[_0x3db5('0xe')]);router[_0x3db5('0xf')]('/',auth['isAuthenticated'](),controller[_0x3db5('0x10')]);router[_0x3db5('0x11')](_0x3db5('0xc'),auth[_0x3db5('0xa')](),controller[_0x3db5('0x12')]);router[_0x3db5('0x13')](_0x3db5('0xc'),auth[_0x3db5('0xa')](),controller['destroy']);module[_0x3db5('0x14')]=router; \ No newline at end of file +var _0xce3b=['get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xce3b,0x121));var _0xbce3=function(_0x1be216,_0x3c5113){_0x1be216=_0x1be216-0x0;var _0x2e3a1c=_0xce3b[_0x1be216];return _0x2e3a1c;};'use strict';var multer=require(_0xbce3('0x0'));var util=require('util');var path=require(_0xbce3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbce3('0x2')]();var fs_extra=require(_0xbce3('0x3'));var auth=require(_0xbce3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xbce3('0x5')]('/',auth[_0xbce3('0x6')](),controller[_0xbce3('0x7')]);router['get'](_0xbce3('0x8'),auth[_0xbce3('0x6')](),controller[_0xbce3('0x9')]);router['get']('/:id/download',auth[_0xbce3('0x6')](),controller['download']);router[_0xbce3('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbce3('0x8'),auth[_0xbce3('0x6')](),controller['update']);router[_0xbce3('0xb')](_0xbce3('0x8'),auth[_0xbce3('0x6')](),controller[_0xbce3('0xc')]);module[_0xbce3('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index f3931ef..1c1b322 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 _0x93c3=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x125041,_0x38a56f){var _0x32b412=function(_0xefcfa7){while(--_0xefcfa7){_0x125041['push'](_0x125041['shift']());}};_0x32b412(++_0x38a56f);}(_0x93c3,0x17d));var _0x393c=function(_0x50a68a,_0x40ac6f){_0x50a68a=_0x50a68a-0x0;var _0x848f0b=_0x93c3[_0x50a68a];return _0x848f0b;};'use strict';var Sequelize=require(_0x393c('0x0'));module[_0x393c('0x1')]={'field':{'type':Sequelize[_0x393c('0x2')]},'alias':{'type':Sequelize[_0x393c('0x3')]},'function':{'type':Sequelize[_0x393c('0x3')]},'format':{'type':Sequelize[_0x393c('0x3')]},'groupBy':{'type':Sequelize[_0x393c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x393c('0x3')]},'custom':{'type':Sequelize[_0x393c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa5c8=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xa5c8,0x152));var _0x8a5c=function(_0x48d316,_0x6de374){_0x48d316=_0x48d316-0x0;var _0x17b56d=_0xa5c8[_0x48d316];return _0x17b56d;};'use strict';var Sequelize=require(_0x8a5c('0x0'));module[_0x8a5c('0x1')]={'field':{'type':Sequelize[_0x8a5c('0x2')]},'alias':{'type':Sequelize[_0x8a5c('0x3')]},'function':{'type':Sequelize[_0x8a5c('0x3')]},'format':{'type':Sequelize[_0x8a5c('0x3')]},'groupBy':{'type':Sequelize[_0x8a5c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x8a5c('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 693c65c..b1b0424 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 _0x9268=['bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','bulkCreate','body','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9268,0xab));var _0x8926=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x9268[_0x2077c2];return _0x312f9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8926('0x0'));var zipdir=require(_0x8926('0x1'));var jsonpatch=require(_0x8926('0x2'));var rp=require(_0x8926('0x3'));var moment=require('moment');var BPromise=require(_0x8926('0x4'));var Mustache=require(_0x8926('0x5'));var util=require(_0x8926('0x6'));var path=require('path');var sox=require(_0x8926('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8926('0x8'));var _=require(_0x8926('0x9'));var squel=require('squel');var crypto=require(_0x8926('0xa'));var jsforce=require(_0x8926('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8926('0xc'));var querystring=require(_0x8926('0xd'));var Papa=require(_0x8926('0xe'));var Redis=require(_0x8926('0xf'));var authService=require(_0x8926('0x10'));var qs=require(_0x8926('0x11'));var as=require(_0x8926('0x12'));var hardwareService=require(_0x8926('0x13'));var logger=require(_0x8926('0x14'))(_0x8926('0x15'));var utils=require(_0x8926('0x16'));var config=require(_0x8926('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8926('0x18'))['db'];function respondWithStatusCode(_0x976f26,_0x5255e3){_0x5255e3=_0x5255e3||0xcc;return function(_0x482206){if(_0x482206){return _0x976f26[_0x8926('0x19')](_0x5255e3);}return _0x976f26[_0x8926('0x1a')](_0x5255e3)[_0x8926('0x1b')]();};}function respondWithResult(_0x17afb9,_0x4cdd16){_0x4cdd16=_0x4cdd16||0xc8;return function(_0x4fb19a){if(_0x4fb19a){return _0x17afb9[_0x8926('0x1a')](_0x4cdd16)[_0x8926('0x1c')](_0x4fb19a);}};}function respondWithFilteredResult(_0x177757,_0x2fc1bd){return function(_0x31a1d6){if(_0x31a1d6){var _0x9fda04=typeof _0x2fc1bd[_0x8926('0x1d')]===_0x8926('0x1e')&&typeof _0x2fc1bd['limit']==='undefined';var _0x379550=_0x31a1d6[_0x8926('0x1f')];var _0x6b5f2f=_0x9fda04?0x0:_0x2fc1bd[_0x8926('0x1d')];var _0x5d3ef2=_0x9fda04?_0x31a1d6['count']:_0x2fc1bd[_0x8926('0x1d')]+_0x2fc1bd[_0x8926('0x20')];var _0x5562ac;if(_0x5d3ef2>=_0x379550){_0x5d3ef2=_0x379550;_0x5562ac=0xc8;}else{_0x5562ac=0xce;}_0x177757[_0x8926('0x1a')](_0x5562ac);return _0x177757[_0x8926('0x21')](_0x8926('0x22'),_0x6b5f2f+'-'+_0x5d3ef2+'/'+_0x379550)[_0x8926('0x1c')](_0x31a1d6);}return null;};}function patchUpdates(_0x4ad211){return function(_0x3595f6){try{jsonpatch[_0x8926('0x23')](_0x3595f6,_0x4ad211,!![]);}catch(_0x34f5cb){return BPromise[_0x8926('0x24')](_0x34f5cb);}return _0x3595f6['save']();};}function saveUpdates(_0x15658e,_0xf6d596){return function(_0x1e05d3){if(_0x1e05d3){return _0x1e05d3['update'](_0x15658e)[_0x8926('0x25')](function(_0x4425db){return _0x4425db;});}return null;};}function removeEntity(_0x19ade1,_0x3c7cbb){return function(_0x227c77){if(_0x227c77){return _0x227c77[_0x8926('0x26')]()[_0x8926('0x25')](function(){_0x19ade1[_0x8926('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e433,_0x45b9ce){return function(_0xc38ff4){if(!_0xc38ff4){_0x59e433[_0x8926('0x19')](0x194);}return _0xc38ff4;};}function handleError(_0x39f33f,_0x142e0d){_0x142e0d=_0x142e0d||0x1f4;return function(_0x4e8e0a){logger[_0x8926('0x27')](_0x4e8e0a['stack']);if(_0x4e8e0a['name']){delete _0x4e8e0a[_0x8926('0x28')];}_0x39f33f['status'](_0x142e0d)[_0x8926('0x29')](_0x4e8e0a);};}exports['index']=function(_0x3d370c,_0x42b482){var _0x1ca9bf={},_0x314f2c={},_0x253cdc={'count':0x0,'rows':[]};var _0x5ae3e1=_[_0x8926('0x2a')](db['AnalyticFieldReport']['rawAttributes'],function(_0x51a30e){return{'name':_0x51a30e[_0x8926('0x2b')],'type':_0x51a30e[_0x8926('0x2c')]['key']};});_0x314f2c[_0x8926('0x2d')]=_[_0x8926('0x2a')](_0x5ae3e1,'name');_0x314f2c[_0x8926('0x2e')]=_[_0x8926('0x2f')](_0x3d370c['query']);_0x314f2c[_0x8926('0x30')]=_[_0x8926('0x31')](_0x314f2c[_0x8926('0x2d')],_0x314f2c['query']);_0x1ca9bf[_0x8926('0x32')]=_[_0x8926('0x31')](_0x314f2c[_0x8926('0x2d')],qs[_0x8926('0x33')](_0x3d370c['query'][_0x8926('0x33')]));_0x1ca9bf['attributes']=_0x1ca9bf[_0x8926('0x32')][_0x8926('0x34')]?_0x1ca9bf['attributes']:_0x314f2c[_0x8926('0x2d')];if(!_0x3d370c[_0x8926('0x2e')][_0x8926('0x35')](_0x8926('0x36'))){_0x1ca9bf[_0x8926('0x20')]=qs[_0x8926('0x20')](_0x3d370c[_0x8926('0x2e')][_0x8926('0x20')]);_0x1ca9bf[_0x8926('0x1d')]=qs[_0x8926('0x1d')](_0x3d370c[_0x8926('0x2e')][_0x8926('0x1d')]);}_0x1ca9bf['order']=qs['sort'](_0x3d370c[_0x8926('0x2e')][_0x8926('0x37')]);_0x1ca9bf[_0x8926('0x38')]=qs[_0x8926('0x30')](_[_0x8926('0x39')](_0x3d370c['query'],_0x314f2c['filters']),_0x5ae3e1);if(_0x3d370c[_0x8926('0x2e')][_0x8926('0x3a')]){_0x1ca9bf[_0x8926('0x38')]=_[_0x8926('0x3b')](_0x1ca9bf[_0x8926('0x38')],{'$or':_[_0x8926('0x2a')](_0x5ae3e1,function(_0x35cd75){if(_0x35cd75[_0x8926('0x2c')]!=='VIRTUAL'){var _0x11c77f={};_0x11c77f[_0x35cd75[_0x8926('0x28')]]={'$like':'%'+_0x3d370c[_0x8926('0x2e')][_0x8926('0x3a')]+'%'};return _0x11c77f;}})});}_0x1ca9bf=_[_0x8926('0x3b')]({},_0x1ca9bf,_0x3d370c['options']);var _0x4e5955={'where':_0x1ca9bf[_0x8926('0x38')]};return db[_0x8926('0x3c')][_0x8926('0x1f')](_0x4e5955)[_0x8926('0x25')](function(_0x559a75){_0x253cdc[_0x8926('0x1f')]=_0x559a75;if(_0x3d370c[_0x8926('0x2e')][_0x8926('0x3d')]){_0x1ca9bf[_0x8926('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8926('0x3f')](_0x1ca9bf);})[_0x8926('0x25')](function(_0x10f55c){_0x253cdc[_0x8926('0x40')]=_0x10f55c;return _0x253cdc;})[_0x8926('0x25')](respondWithFilteredResult(_0x42b482,_0x1ca9bf))[_0x8926('0x41')](handleError(_0x42b482,null));};exports[_0x8926('0x42')]=function(_0xb6750e,_0x56bf6f){var _0x2bfcb8={'raw':![],'where':{'id':_0xb6750e[_0x8926('0x43')]['id']}},_0x4b1fca={};_0x4b1fca[_0x8926('0x2d')]=_[_0x8926('0x2f')](db[_0x8926('0x3c')][_0x8926('0x44')]);_0x4b1fca['query']=_[_0x8926('0x2f')](_0xb6750e['query']);_0x4b1fca[_0x8926('0x30')]=_[_0x8926('0x31')](_0x4b1fca[_0x8926('0x2d')],_0x4b1fca[_0x8926('0x2e')]);_0x2bfcb8[_0x8926('0x32')]=_[_0x8926('0x31')](_0x4b1fca[_0x8926('0x2d')],qs['fields'](_0xb6750e['query'][_0x8926('0x33')]));_0x2bfcb8[_0x8926('0x32')]=_0x2bfcb8[_0x8926('0x32')][_0x8926('0x34')]?_0x2bfcb8[_0x8926('0x32')]:_0x4b1fca[_0x8926('0x2d')];if(_0xb6750e[_0x8926('0x2e')][_0x8926('0x3d')]){_0x2bfcb8[_0x8926('0x3e')]=[{'all':!![]}];}_0x2bfcb8=_[_0x8926('0x3b')]({},_0x2bfcb8,_0xb6750e[_0x8926('0x45')]);return db[_0x8926('0x3c')][_0x8926('0x46')](_0x2bfcb8)[_0x8926('0x25')](handleEntityNotFound(_0x56bf6f,null))[_0x8926('0x25')](respondWithResult(_0x56bf6f,null))[_0x8926('0x41')](handleError(_0x56bf6f,null));};exports[_0x8926('0x47')]=function(_0x3ad417,_0x4a6f1f){return db['AnalyticFieldReport']['create'](_0x3ad417['body'],{})[_0x8926('0x25')](respondWithResult(_0x4a6f1f,0xc9))[_0x8926('0x41')](handleError(_0x4a6f1f,null));};exports[_0x8926('0x48')]=function(_0xfcd43f,_0x12c48b){return db[_0x8926('0x3c')][_0x8926('0x48')](_0xfcd43f[_0x8926('0x49')],{'raw':![],'individualHooks':!![]})[_0x8926('0x25')](respondWithResult(_0x12c48b,0xc9))[_0x8926('0x41')](handleError(_0x12c48b,null));};exports[_0x8926('0x4a')]=function(_0x229b4a,_0x4873d6){if(_0x229b4a[_0x8926('0x49')]['id']){delete _0x229b4a[_0x8926('0x49')]['id'];}return db[_0x8926('0x3c')][_0x8926('0x46')]({'where':{'id':_0x229b4a['params']['id']}})[_0x8926('0x25')](handleEntityNotFound(_0x4873d6,null))[_0x8926('0x25')](saveUpdates(_0x229b4a[_0x8926('0x49')],null))[_0x8926('0x25')](respondWithResult(_0x4873d6,null))[_0x8926('0x41')](handleError(_0x4873d6,null));};exports[_0x8926('0x26')]=function(_0xa5bdbb,_0x5f2ee6){return db[_0x8926('0x3c')][_0x8926('0x46')]({'where':{'id':_0xa5bdbb[_0x8926('0x43')]['id']}})[_0x8926('0x25')](handleEntityNotFound(_0x5f2ee6,null))[_0x8926('0x25')](removeEntity(_0x5f2ee6,null))[_0x8926('0x41')](handleError(_0x5f2ee6,null));};exports[_0x8926('0x4b')]=function(_0x1c56f5,_0x4cc4c4){return db[_0x8926('0x3c')][_0x8926('0x26')]({'where':{'id':_0x1c56f5['query'][_0x8926('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x8926('0x25')](respondWithResult(_0x4cc4c4,0xcc))[_0x8926('0x41')](handleError(_0x4cc4c4,null));};exports[_0x8926('0x4d')]=function(_0x40d8c7,_0x31ee36,_0x231fd0){return db[_0x8926('0x4e')]['findOne']({'where':{'id':_0x40d8c7[_0x8926('0x43')]['id']}})[_0x8926('0x25')](handleEntityNotFound(_0x31ee36,null))[_0x8926('0x25')](function(_0x275ac9){if(_0x275ac9){return db[_0x8926('0x4f')][_0x8926('0x50')](function(_0x2c1d04){return db[_0x8926('0x3c')][_0x8926('0x26')]({'where':{'CustomReportId':_0x40d8c7[_0x8926('0x43')]['id']},'transaction':_0x2c1d04})[_0x8926('0x25')](function(_0x412173){var _0x5021df=_['map'](_0x40d8c7[_0x8926('0x49')],function(_0x295713){delete _0x295713['id'];_0x295713[_0x8926('0x51')]=_0x40d8c7[_0x8926('0x43')]['id'];return _0x295713;});return db[_0x8926('0x3c')]['bulkCreate'](_0x5021df,{'transaction':_0x2c1d04});});})[_0x8926('0x25')](function(){return db[_0x8926('0x3c')][_0x8926('0x3f')]({'where':{'CustomReportId':_0x40d8c7[_0x8926('0x43')]['id']}});});}})[_0x8926('0x25')](respondWithResult(_0x31ee36,null))[_0x8926('0x41')](handleError(_0x31ee36,null));}; \ No newline at end of file +var _0x4757=['mustache','util','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','request-promise','bluebird'];(function(_0x411770,_0x5da88f){var _0x10d5d6=function(_0x20aa60){while(--_0x20aa60){_0x411770['push'](_0x411770['shift']());}};_0x10d5d6(++_0x5da88f);}(_0x4757,0x140));var _0x7475=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x4757[_0x4cf0b7];return _0x545f10;};'use strict';var emlformat=require(_0x7475('0x0'));var rimraf=require(_0x7475('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7475('0x2'));var moment=require('moment');var BPromise=require(_0x7475('0x3'));var Mustache=require(_0x7475('0x4'));var util=require(_0x7475('0x5'));var path=require(_0x7475('0x6'));var sox=require(_0x7475('0x7'));var csv=require('to-csv');var ejs=require(_0x7475('0x8'));var fs=require('fs');var fs_extra=require(_0x7475('0x9'));var _=require(_0x7475('0xa'));var squel=require(_0x7475('0xb'));var crypto=require(_0x7475('0xc'));var jsforce=require(_0x7475('0xd'));var deskjs=require(_0x7475('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7475('0xf'));var Papa=require('papaparse');var Redis=require(_0x7475('0x10'));var authService=require(_0x7475('0x11'));var qs=require(_0x7475('0x12'));var as=require(_0x7475('0x13'));var hardwareService=require(_0x7475('0x14'));var logger=require(_0x7475('0x15'))(_0x7475('0x16'));var utils=require('../../config/utils');var config=require(_0x7475('0x17'));var licenseUtil=require(_0x7475('0x18'));var db=require(_0x7475('0x19'))['db'];function respondWithStatusCode(_0x2ffce8,_0x46cdd7){_0x46cdd7=_0x46cdd7||0xcc;return function(_0x347729){if(_0x347729){return _0x2ffce8[_0x7475('0x1a')](_0x46cdd7);}return _0x2ffce8[_0x7475('0x1b')](_0x46cdd7)[_0x7475('0x1c')]();};}function respondWithResult(_0x5d7468,_0x685511){_0x685511=_0x685511||0xc8;return function(_0x95ca07){if(_0x95ca07){return _0x5d7468[_0x7475('0x1b')](_0x685511)[_0x7475('0x1d')](_0x95ca07);}};}function respondWithFilteredResult(_0x1d1cd9,_0x50627e){return function(_0x523058){if(_0x523058){var _0xda220b=typeof _0x50627e['offset']===_0x7475('0x1e')&&typeof _0x50627e[_0x7475('0x1f')]===_0x7475('0x1e');var _0x1dec68=_0x523058[_0x7475('0x20')];var _0x38882a=_0xda220b?0x0:_0x50627e[_0x7475('0x21')];var _0x19cdb2=_0xda220b?_0x523058[_0x7475('0x20')]:_0x50627e['offset']+_0x50627e[_0x7475('0x1f')];var _0x3ac0f5;if(_0x19cdb2>=_0x1dec68){_0x19cdb2=_0x1dec68;_0x3ac0f5=0xc8;}else{_0x3ac0f5=0xce;}_0x1d1cd9[_0x7475('0x1b')](_0x3ac0f5);return _0x1d1cd9[_0x7475('0x22')]('Content-Range',_0x38882a+'-'+_0x19cdb2+'/'+_0x1dec68)['json'](_0x523058);}return null;};}function patchUpdates(_0x45cff4){return function(_0x52c9cd){try{jsonpatch[_0x7475('0x23')](_0x52c9cd,_0x45cff4,!![]);}catch(_0xdf8428){return BPromise['reject'](_0xdf8428);}return _0x52c9cd['save']();};}function saveUpdates(_0x35a4a9,_0x49ff71){return function(_0x2a0e1f){if(_0x2a0e1f){return _0x2a0e1f[_0x7475('0x24')](_0x35a4a9)[_0x7475('0x25')](function(_0x123117){return _0x123117;});}return null;};}function removeEntity(_0x15e8a8,_0xcc8d7b){return function(_0x5cddfd){if(_0x5cddfd){return _0x5cddfd[_0x7475('0x26')]()[_0x7475('0x25')](function(){_0x15e8a8[_0x7475('0x1b')](0xcc)[_0x7475('0x1c')]();});}};}function handleEntityNotFound(_0x3f5250,_0x5b7cd9){return function(_0x3f7f76){if(!_0x3f7f76){_0x3f5250['sendStatus'](0x194);}return _0x3f7f76;};}function handleError(_0x2e75e7,_0x3bbb20){_0x3bbb20=_0x3bbb20||0x1f4;return function(_0x591d95){logger['error'](_0x591d95[_0x7475('0x27')]);if(_0x591d95[_0x7475('0x28')]){delete _0x591d95[_0x7475('0x28')];}_0x2e75e7[_0x7475('0x1b')](_0x3bbb20)['send'](_0x591d95);};}exports['index']=function(_0x4a683b,_0x2f9e9f){var _0x3d8509={},_0x4f6540={},_0x452205={'count':0x0,'rows':[]};var _0x3c656f=_[_0x7475('0x29')](db[_0x7475('0x2a')][_0x7475('0x2b')],function(_0x2921c6){return{'name':_0x2921c6[_0x7475('0x2c')],'type':_0x2921c6[_0x7475('0x2d')]['key']};});_0x4f6540[_0x7475('0x2e')]=_[_0x7475('0x29')](_0x3c656f,'name');_0x4f6540[_0x7475('0x2f')]=_[_0x7475('0x30')](_0x4a683b[_0x7475('0x2f')]);_0x4f6540[_0x7475('0x31')]=_['intersection'](_0x4f6540[_0x7475('0x2e')],_0x4f6540['query']);_0x3d8509[_0x7475('0x32')]=_[_0x7475('0x33')](_0x4f6540[_0x7475('0x2e')],qs[_0x7475('0x34')](_0x4a683b[_0x7475('0x2f')][_0x7475('0x34')]));_0x3d8509[_0x7475('0x32')]=_0x3d8509['attributes']['length']?_0x3d8509['attributes']:_0x4f6540['model'];if(!_0x4a683b['query'][_0x7475('0x35')](_0x7475('0x36'))){_0x3d8509['limit']=qs['limit'](_0x4a683b[_0x7475('0x2f')]['limit']);_0x3d8509[_0x7475('0x21')]=qs[_0x7475('0x21')](_0x4a683b['query']['offset']);}_0x3d8509[_0x7475('0x37')]=qs[_0x7475('0x38')](_0x4a683b[_0x7475('0x2f')][_0x7475('0x38')]);_0x3d8509[_0x7475('0x39')]=qs[_0x7475('0x31')](_[_0x7475('0x3a')](_0x4a683b[_0x7475('0x2f')],_0x4f6540[_0x7475('0x31')]),_0x3c656f);if(_0x4a683b[_0x7475('0x2f')][_0x7475('0x3b')]){_0x3d8509[_0x7475('0x39')]=_[_0x7475('0x3c')](_0x3d8509['where'],{'$or':_[_0x7475('0x29')](_0x3c656f,function(_0x262fbf){if(_0x262fbf['type']!==_0x7475('0x3d')){var _0x28a216={};_0x28a216[_0x262fbf[_0x7475('0x28')]]={'$like':'%'+_0x4a683b[_0x7475('0x2f')][_0x7475('0x3b')]+'%'};return _0x28a216;}})});}_0x3d8509=_['merge']({},_0x3d8509,_0x4a683b[_0x7475('0x3e')]);var _0x14fc63={'where':_0x3d8509['where']};return db['AnalyticFieldReport'][_0x7475('0x20')](_0x14fc63)[_0x7475('0x25')](function(_0x284d78){_0x452205[_0x7475('0x20')]=_0x284d78;if(_0x4a683b[_0x7475('0x2f')][_0x7475('0x3f')]){_0x3d8509[_0x7475('0x40')]=[{'all':!![]}];}return db[_0x7475('0x2a')][_0x7475('0x41')](_0x3d8509);})[_0x7475('0x25')](function(_0x2f4409){_0x452205[_0x7475('0x42')]=_0x2f4409;return _0x452205;})[_0x7475('0x25')](respondWithFilteredResult(_0x2f9e9f,_0x3d8509))['catch'](handleError(_0x2f9e9f,null));};exports['show']=function(_0x5b19b3,_0x40a3b5){var _0x1da4c5={'raw':![],'where':{'id':_0x5b19b3[_0x7475('0x43')]['id']}},_0x5e1d9c={};_0x5e1d9c['model']=_[_0x7475('0x30')](db['AnalyticFieldReport'][_0x7475('0x2b')]);_0x5e1d9c['query']=_[_0x7475('0x30')](_0x5b19b3['query']);_0x5e1d9c[_0x7475('0x31')]=_[_0x7475('0x33')](_0x5e1d9c[_0x7475('0x2e')],_0x5e1d9c['query']);_0x1da4c5['attributes']=_[_0x7475('0x33')](_0x5e1d9c[_0x7475('0x2e')],qs[_0x7475('0x34')](_0x5b19b3[_0x7475('0x2f')][_0x7475('0x34')]));_0x1da4c5['attributes']=_0x1da4c5[_0x7475('0x32')][_0x7475('0x44')]?_0x1da4c5[_0x7475('0x32')]:_0x5e1d9c[_0x7475('0x2e')];if(_0x5b19b3[_0x7475('0x2f')][_0x7475('0x3f')]){_0x1da4c5[_0x7475('0x40')]=[{'all':!![]}];}_0x1da4c5=_[_0x7475('0x3c')]({},_0x1da4c5,_0x5b19b3[_0x7475('0x3e')]);return db[_0x7475('0x2a')][_0x7475('0x45')](_0x1da4c5)[_0x7475('0x25')](handleEntityNotFound(_0x40a3b5,null))[_0x7475('0x25')](respondWithResult(_0x40a3b5,null))[_0x7475('0x46')](handleError(_0x40a3b5,null));};exports[_0x7475('0x47')]=function(_0x4f2231,_0x12d521){return db[_0x7475('0x2a')][_0x7475('0x47')](_0x4f2231[_0x7475('0x48')],{})[_0x7475('0x25')](respondWithResult(_0x12d521,0xc9))[_0x7475('0x46')](handleError(_0x12d521,null));};exports[_0x7475('0x49')]=function(_0xaaeaa9,_0x50774c){return db[_0x7475('0x2a')][_0x7475('0x49')](_0xaaeaa9[_0x7475('0x48')],{'raw':![],'individualHooks':!![]})[_0x7475('0x25')](respondWithResult(_0x50774c,0xc9))['catch'](handleError(_0x50774c,null));};exports[_0x7475('0x24')]=function(_0x12d0e8,_0x576b28){if(_0x12d0e8[_0x7475('0x48')]['id']){delete _0x12d0e8['body']['id'];}return db[_0x7475('0x2a')][_0x7475('0x45')]({'where':{'id':_0x12d0e8[_0x7475('0x43')]['id']}})[_0x7475('0x25')](handleEntityNotFound(_0x576b28,null))[_0x7475('0x25')](saveUpdates(_0x12d0e8[_0x7475('0x48')],null))[_0x7475('0x25')](respondWithResult(_0x576b28,null))[_0x7475('0x46')](handleError(_0x576b28,null));};exports[_0x7475('0x26')]=function(_0x5d48df,_0x59fde0){return db[_0x7475('0x2a')][_0x7475('0x45')]({'where':{'id':_0x5d48df[_0x7475('0x43')]['id']}})[_0x7475('0x25')](handleEntityNotFound(_0x59fde0,null))['then'](removeEntity(_0x59fde0,null))[_0x7475('0x46')](handleError(_0x59fde0,null));};exports[_0x7475('0x4a')]=function(_0x3023c7,_0x3d291c){return db[_0x7475('0x2a')][_0x7475('0x26')]({'where':{'id':_0x3023c7[_0x7475('0x2f')][_0x7475('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x7475('0x25')](respondWithResult(_0x3d291c,0xcc))['catch'](handleError(_0x3d291c,null));};exports['addFields']=function(_0x436eb8,_0x5c45c6,_0x5d2fa5){return db[_0x7475('0x4c')][_0x7475('0x4d')]({'where':{'id':_0x436eb8[_0x7475('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c45c6,null))[_0x7475('0x25')](function(_0x403651){if(_0x403651){return db[_0x7475('0x4e')][_0x7475('0x4f')](function(_0x4ee8c8){return db[_0x7475('0x2a')]['destroy']({'where':{'CustomReportId':_0x436eb8['params']['id']},'transaction':_0x4ee8c8})['then'](function(_0x30beb4){var _0x3fc7e4=_[_0x7475('0x29')](_0x436eb8[_0x7475('0x48')],function(_0x2b48fd){delete _0x2b48fd['id'];_0x2b48fd[_0x7475('0x50')]=_0x436eb8['params']['id'];return _0x2b48fd;});return db[_0x7475('0x2a')][_0x7475('0x49')](_0x3fc7e4,{'transaction':_0x4ee8c8});});})['then'](function(){return db['AnalyticFieldReport'][_0x7475('0x41')]({'where':{'CustomReportId':_0x436eb8['params']['id']}});});}})[_0x7475('0x25')](respondWithResult(_0x5c45c6,null))[_0x7475('0x46')](handleError(_0x5c45c6,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6cfdfdb..3c4494a 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 _0xdd36=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x4dad78,_0x410018){var _0x2418de=function(_0xde23a3){while(--_0xde23a3){_0x4dad78['push'](_0x4dad78['shift']());}};_0x2418de(++_0x410018);}(_0xdd36,0x1a4));var _0x6dd3=function(_0x31f7ca,_0x6f7fd0){_0x31f7ca=_0x31f7ca-0x0;var _0x2f9f64=_0xdd36[_0x31f7ca];return _0x2f9f64;};'use strict';var _=require(_0x6dd3('0x0'));var util=require(_0x6dd3('0x1'));var logger=require(_0x6dd3('0x2'))(_0x6dd3('0x3'));var moment=require('moment');var BPromise=require(_0x6dd3('0x4'));var rp=require(_0x6dd3('0x5'));var fs=require('fs');var path=require(_0x6dd3('0x6'));var rimraf=require('rimraf');var config=require(_0x6dd3('0x7'));var attributes=require(_0x6dd3('0x8'));module['exports']=function(_0x2305b2,_0x3f98db){return _0x2305b2[_0x6dd3('0x9')](_0x6dd3('0xa'),attributes,{'tableName':_0x6dd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7f4=['moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','util','../../config/logger'];(function(_0xd49abd,_0x2ace0b){var _0x58769d=function(_0x1015ac){while(--_0x1015ac){_0xd49abd['push'](_0xd49abd['shift']());}};_0x58769d(++_0x2ace0b);}(_0xf7f4,0x1e1));var _0x4f7f=function(_0x58ff2d,_0x60115c){_0x58ff2d=_0x58ff2d-0x0;var _0x419f38=_0xf7f4[_0x58ff2d];return _0x419f38;};'use strict';var _=require(_0x4f7f('0x0'));var util=require(_0x4f7f('0x1'));var logger=require(_0x4f7f('0x2'))('api');var moment=require(_0x4f7f('0x3'));var BPromise=require(_0x4f7f('0x4'));var rp=require(_0x4f7f('0x5'));var fs=require('fs');var path=require(_0x4f7f('0x6'));var rimraf=require(_0x4f7f('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f7f('0x8'));module['exports']=function(_0x1688e4,_0x5e72ca){return _0x1688e4[_0x4f7f('0x9')](_0x4f7f('0xa'),attributes,{'tableName':'analytics_report_fields','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 da582c7..c8c79e8 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 _0x6591=['result','catch','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x355558,_0x5d26cd){var _0x1f4581=function(_0x3eaf56){while(--_0x3eaf56){_0x355558['push'](_0x355558['shift']());}};_0x1f4581(++_0x5d26cd);}(_0x6591,0x66));var _0x1659=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x6591[_0x37e845];return _0x59e55b;};'use strict';var _=require('lodash');var util=require(_0x1659('0x0'));var moment=require(_0x1659('0x1'));var BPromise=require('bluebird');var rs=require(_0x1659('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1659('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1659('0x4'));var config=require(_0x1659('0x5'));var jayson=require(_0x1659('0x6'));var client=jayson[_0x1659('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca39d,_0x94e3c6,_0x477410){return new BPromise(function(_0x276887,_0x32430c){return client[_0x1659('0x8')](_0x1ca39d,_0x477410)[_0x1659('0x9')](function(_0x16dbfe){logger[_0x1659('0xa')](_0x1659('0xb'),_0x94e3c6,_0x1659('0xc'));logger[_0x1659('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x94e3c6,_0x1659('0xc'),JSON[_0x1659('0xe')](_0x16dbfe));if(_0x16dbfe['error']){if(_0x16dbfe[_0x1659('0xf')][_0x1659('0x10')]===0x1f4){logger[_0x1659('0xf')](_0x1659('0xb'),_0x94e3c6,_0x16dbfe['error'][_0x1659('0x11')]);return _0x32430c(_0x16dbfe[_0x1659('0xf')][_0x1659('0x11')]);}logger['error'](_0x1659('0xb'),_0x94e3c6,_0x16dbfe['error'][_0x1659('0x11')]);return _0x276887(_0x16dbfe[_0x1659('0xf')][_0x1659('0x11')]);}else{logger[_0x1659('0xa')](_0x1659('0xb'),_0x94e3c6,_0x1659('0xc'));_0x276887(_0x16dbfe[_0x1659('0x12')]['message']);}})[_0x1659('0x13')](function(_0xc65574){logger[_0x1659('0xf')](_0x1659('0xb'),_0x94e3c6,_0xc65574);_0x32430c(_0xc65574);});});} \ No newline at end of file +var _0xd9ec=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','code','error','message','result','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x130c9d,_0x4662a8){var _0x46e7cf=function(_0x2edee8){while(--_0x2edee8){_0x130c9d['push'](_0x130c9d['shift']());}};_0x46e7cf(++_0x4662a8);}(_0xd9ec,0xc3));var _0xcd9e=function(_0x52a97d,_0x407df6){_0x52a97d=_0x52a97d-0x0;var _0x55ac90=_0xd9ec[_0x52a97d];return _0x55ac90;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcd9e('0x0'));var BPromise=require(_0xcd9e('0x1'));var rs=require(_0xcd9e('0x2'));var fs=require('fs');var Redis=require(_0xcd9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd9e('0x4'));var logger=require(_0xcd9e('0x5'))('rpc');var config=require(_0xcd9e('0x6'));var jayson=require(_0xcd9e('0x7'));var client=jayson['client'][_0xcd9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41ac79,_0xdd9a17,_0x5d55ff){return new BPromise(function(_0x280b15,_0x3474f0){return client[_0xcd9e('0x9')](_0x41ac79,_0x5d55ff)[_0xcd9e('0xa')](function(_0x2ac0b6){logger[_0xcd9e('0xb')](_0xcd9e('0xc'),_0xdd9a17,_0xcd9e('0xd'));logger[_0xcd9e('0xe')](_0xcd9e('0xf'),_0xdd9a17,_0xcd9e('0xd'),JSON['stringify'](_0x2ac0b6));if(_0x2ac0b6['error']){if(_0x2ac0b6['error'][_0xcd9e('0x10')]===0x1f4){logger[_0xcd9e('0x11')](_0xcd9e('0xc'),_0xdd9a17,_0x2ac0b6[_0xcd9e('0x11')][_0xcd9e('0x12')]);return _0x3474f0(_0x2ac0b6[_0xcd9e('0x11')][_0xcd9e('0x12')]);}logger[_0xcd9e('0x11')](_0xcd9e('0xc'),_0xdd9a17,_0x2ac0b6[_0xcd9e('0x11')][_0xcd9e('0x12')]);return _0x280b15(_0x2ac0b6['error'][_0xcd9e('0x12')]);}else{logger[_0xcd9e('0xb')](_0xcd9e('0xc'),_0xdd9a17,'request\x20sent');_0x280b15(_0x2ac0b6[_0xcd9e('0x13')][_0xcd9e('0x12')]);}})['catch'](function(_0x288803){logger[_0xcd9e('0x11')](_0xcd9e('0xc'),_0xdd9a17,_0x288803);_0x3474f0(_0x288803);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a935bbe..db7c58a 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(_0x105a6b,_0x7fd8d7){var _0x4e50da=function(_0x51763e){while(--_0x51763e){_0x105a6b['push'](_0x105a6b['shift']());}};_0x4e50da(++_0x7fd8d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x4fa0eb,_0x5666c7){var _0x53c675=function(_0x4fba0c){while(--_0x4fba0c){_0x4fa0eb['push'](_0x4fa0eb['shift']());}};_0x53c675(++_0x5666c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 186af76..073d78e 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 _0x3451=['sequelize','exports','name','STRING','TEXT'];(function(_0x630685,_0x2229a8){var _0x60b3e1=function(_0x2a8456){while(--_0x2a8456){_0x630685['push'](_0x630685['shift']());}};_0x60b3e1(++_0x2229a8);}(_0x3451,0x19a));var _0x1345=function(_0x3d5808,_0x56bd0d){_0x3d5808=_0x3d5808-0x0;var _0xafe969=_0x3451[_0x3d5808];return _0xafe969;};'use strict';var Sequelize=require(_0x1345('0x0'));module[_0x1345('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1345('0x2')},'table':{'type':Sequelize[_0x1345('0x3')]},'metric':{'type':Sequelize[_0x1345('0x4')]},'description':{'type':Sequelize[_0x1345('0x3')]}}; \ No newline at end of file +var _0xa45b=['STRING','exports'];(function(_0x58ee13,_0x52e418){var _0x4d2d36=function(_0x4c6673){while(--_0x4c6673){_0x58ee13['push'](_0x58ee13['shift']());}};_0x4d2d36(++_0x52e418);}(_0xa45b,0x199));var _0xba45=function(_0x5aea3c,_0x31c4a8){_0x5aea3c=_0x5aea3c-0x0;var _0x4ab239=_0xa45b[_0x5aea3c];return _0x4ab239;};'use strict';var Sequelize=require('sequelize');module[_0xba45('0x0')]={'name':{'type':Sequelize[_0xba45('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xba45('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 240452b..12d1967 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 _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x253cf5,_0x1f3766){var _0x416e4f=function(_0xbef073){while(--_0xbef073){_0x253cf5['push'](_0x253cf5['shift']());}};_0x416e4f(++_0x1f3766);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x2e19ac,_0x5ee48a){var _0x29d578=function(_0x436f90){while(--_0x436f90){_0x2e19ac['push'](_0x2e19ac['shift']());}};_0x29d578(++_0x5ee48a);}(_0x008c,0x188));var _0xc008=function(_0x4f90af,_0x14b70c){_0x4f90af=_0x4f90af-0x0;var _0x5e62c0=_0x008c[_0x4f90af];return _0x5e62c0;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d78d628..768ca46 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 _0x66c7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x57bf13,_0x183263){var _0x34727e=function(_0x300aef){while(--_0x300aef){_0x57bf13['push'](_0x57bf13['shift']());}};_0x34727e(++_0x183263);}(_0x66c7,0x15c));var _0x766c=function(_0x3c994d,_0x1d0ff0){_0x3c994d=_0x3c994d-0x0;var _0x1bb8c7=_0x66c7[_0x3c994d];return _0x1bb8c7;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var logger=require(_0x766c('0x2'))('api');var moment=require(_0x766c('0x3'));var BPromise=require(_0x766c('0x4'));var rp=require(_0x766c('0x5'));var fs=require('fs');var path=require(_0x766c('0x6'));var rimraf=require(_0x766c('0x7'));var config=require(_0x766c('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x766c('0x9')]=function(_0x80d91d,_0x6f94c3){return _0x80d91d[_0x766c('0xa')](_0x766c('0xb'),attributes,{'tableName':_0x766c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ec6=['define','analytics_metrics','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x26e50c,_0x1d6a64){var _0x476d4a=function(_0x2ea722){while(--_0x2ea722){_0x26e50c['push'](_0x26e50c['shift']());}};_0x476d4a(++_0x1d6a64);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x2e9df4,_0x90bed7){_0x2e9df4=_0x2e9df4-0x0;var _0x3d9711=_0x0ec6[_0x2e9df4];return _0x3d9711;};'use strict';var _=require(_0x60ec('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60ec('0x1'));var moment=require(_0x60ec('0x2'));var BPromise=require(_0x60ec('0x3'));var rp=require(_0x60ec('0x4'));var fs=require('fs');var path=require(_0x60ec('0x5'));var rimraf=require(_0x60ec('0x6'));var config=require(_0x60ec('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x60ec('0x8')]=function(_0xb4a258,_0x1d8fb5){return _0xb4a258[_0x60ec('0x9')]('AnalyticMetric',attributes,{'tableName':_0x60ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 1160a8a..522f6cf 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 _0x3a79=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0xe669d5,_0x407b4f){var _0x7a4819=function(_0xa88900){while(--_0xa88900){_0xe669d5['push'](_0xe669d5['shift']());}};_0x7a4819(++_0x407b4f);}(_0x3a79,0x118));var _0x93a7=function(_0x3ed123,_0x798b98){_0x3ed123=_0x3ed123-0x0;var _0x551c1a=_0x3a79[_0x3ed123];return _0x551c1a;};'use strict';var _=require(_0x93a7('0x0'));var util=require(_0x93a7('0x1'));var moment=require(_0x93a7('0x2'));var BPromise=require(_0x93a7('0x3'));var rs=require(_0x93a7('0x4'));var fs=require('fs');var Redis=require(_0x93a7('0x5'));var db=require(_0x93a7('0x6'))['db'];var utils=require(_0x93a7('0x7'));var logger=require(_0x93a7('0x8'))(_0x93a7('0x9'));var config=require(_0x93a7('0xa'));var jayson=require(_0x93a7('0xb'));var client=jayson[_0x93a7('0xc')][_0x93a7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x10e0aa,_0x3b30da,_0x5ea26a){return new BPromise(function(_0x5bfffe,_0x5179b9){return client[_0x93a7('0xe')](_0x10e0aa,_0x5ea26a)[_0x93a7('0xf')](function(_0x3ef976){logger[_0x93a7('0x10')](_0x93a7('0x11'),_0x3b30da,_0x93a7('0x12'));logger['debug'](_0x93a7('0x13'),_0x3b30da,_0x93a7('0x12'),JSON['stringify'](_0x3ef976));if(_0x3ef976[_0x93a7('0x14')]){if(_0x3ef976[_0x93a7('0x14')][_0x93a7('0x15')]===0x1f4){logger[_0x93a7('0x14')](_0x93a7('0x11'),_0x3b30da,_0x3ef976['error'][_0x93a7('0x16')]);return _0x5179b9(_0x3ef976[_0x93a7('0x14')][_0x93a7('0x16')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3b30da,_0x3ef976[_0x93a7('0x14')]['message']);return _0x5bfffe(_0x3ef976[_0x93a7('0x14')][_0x93a7('0x16')]);}else{logger['info'](_0x93a7('0x11'),_0x3b30da,_0x93a7('0x12'));_0x5bfffe(_0x3ef976[_0x93a7('0x17')]['message']);}})[_0x93a7('0x18')](function(_0x5818c8){logger[_0x93a7('0x14')](_0x93a7('0x11'),_0x3b30da,_0x5818c8);_0x5179b9(_0x5818c8);});});} \ No newline at end of file +var _0x7a43=['../../config/environment','jayson/promise','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4db359,_0x3793c0){var _0x598361=function(_0x570470){while(--_0x570470){_0x4db359['push'](_0x4db359['shift']());}};_0x598361(++_0x3793c0);}(_0x7a43,0x18a));var _0x37a4=function(_0x33cdfb,_0x355bce){_0x33cdfb=_0x33cdfb-0x0;var _0x4289bc=_0x7a43[_0x33cdfb];return _0x4289bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37a4('0x0'));var BPromise=require(_0x37a4('0x1'));var rs=require(_0x37a4('0x2'));var fs=require('fs');var Redis=require(_0x37a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37a4('0x4'))(_0x37a4('0x5'));var config=require(_0x37a4('0x6'));var jayson=require(_0x37a4('0x7'));var client=jayson['client'][_0x37a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45b055,_0x4481b4,_0xc1e2ee){return new BPromise(function(_0x56aeb5,_0x389b73){return client['request'](_0x45b055,_0xc1e2ee)[_0x37a4('0x9')](function(_0xb36395){logger[_0x37a4('0xa')](_0x37a4('0xb'),_0x4481b4,_0x37a4('0xc'));logger[_0x37a4('0xd')](_0x37a4('0xe'),_0x4481b4,_0x37a4('0xc'),JSON['stringify'](_0xb36395));if(_0xb36395[_0x37a4('0xf')]){if(_0xb36395[_0x37a4('0xf')][_0x37a4('0x10')]===0x1f4){logger['error'](_0x37a4('0xb'),_0x4481b4,_0xb36395[_0x37a4('0xf')][_0x37a4('0x11')]);return _0x389b73(_0xb36395['error'][_0x37a4('0x11')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x4481b4,_0xb36395[_0x37a4('0xf')][_0x37a4('0x11')]);return _0x56aeb5(_0xb36395[_0x37a4('0xf')]['message']);}else{logger[_0x37a4('0xa')](_0x37a4('0xb'),_0x4481b4,'request\x20sent');_0x56aeb5(_0xb36395[_0x37a4('0x12')][_0x37a4('0x11')]);}})[_0x37a4('0x13')](function(_0x24fa87){logger[_0x37a4('0xf')](_0x37a4('0xb'),_0x4481b4,_0x24fa87);_0x389b73(_0x24fa87);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 167c6be..93ae634 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 _0xc1fc=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','update'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc1fc,0x93));var _0xcc1f=function(_0x136ec5,_0x1bfd4c){_0x136ec5=_0x136ec5-0x0;var _0x14afac=_0xc1fc[_0x136ec5];return _0x14afac;};'use strict';var multer=require('multer');var util=require(_0xcc1f('0x0'));var path=require(_0xcc1f('0x1'));var timeout=require('connect-timeout');var express=require(_0xcc1f('0x2'));var router=express[_0xcc1f('0x3')]();var fs_extra=require(_0xcc1f('0x4'));var auth=require(_0xcc1f('0x5'));var interaction=require(_0xcc1f('0x6'));var config=require(_0xcc1f('0x7'));var controller=require(_0xcc1f('0x8'));router[_0xcc1f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcc1f('0x9')](_0xcc1f('0xa'),auth[_0xcc1f('0xb')](),controller[_0xcc1f('0xc')]);router[_0xcc1f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcc1f('0xa'),auth[_0xcc1f('0xb')](),controller[_0xcc1f('0xe')]);router[_0xcc1f('0xf')](_0xcc1f('0xa'),auth[_0xcc1f('0xb')](),controller[_0xcc1f('0x10')]);module[_0xcc1f('0x11')]=router; \ No newline at end of file +var _0x102b=['index','get','/:id','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated'];(function(_0x2ca4a5,_0x5a6569){var _0x3d131c=function(_0x42dcb8){while(--_0x42dcb8){_0x2ca4a5['push'](_0x2ca4a5['shift']());}};_0x3d131c(++_0x5a6569);}(_0x102b,0x1be));var _0xb102=function(_0x15c1d4,_0x203053){_0x15c1d4=_0x15c1d4-0x0;var _0x10f3d2=_0x102b[_0x15c1d4];return _0x10f3d2;};'use strict';var multer=require('multer');var util=require(_0xb102('0x0'));var path=require('path');var timeout=require(_0xb102('0x1'));var express=require(_0xb102('0x2'));var router=express[_0xb102('0x3')]();var fs_extra=require(_0xb102('0x4'));var auth=require(_0xb102('0x5'));var interaction=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var controller=require(_0xb102('0x8'));router['get']('/',auth[_0xb102('0x9')](),controller[_0xb102('0xa')]);router[_0xb102('0xb')](_0xb102('0xc'),auth[_0xb102('0x9')](),controller['show']);router[_0xb102('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb102('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb102('0xf')]);router[_0xb102('0x10')]('/:id',auth[_0xb102('0x9')](),controller[_0xb102('0x11')]);module[_0xb102('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cfa273a..2b54479 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 _0xb0bf=['TEXT','sequelize'];(function(_0x49a6fb,_0x15ef6c){var _0x42c4f2=function(_0x38c4c3){while(--_0x38c4c3){_0x49a6fb['push'](_0x49a6fb['shift']());}};_0x42c4f2(++_0x15ef6c);}(_0xb0bf,0x69));var _0xfb0b=function(_0x7fe90f,_0x2565d6){_0x7fe90f=_0x7fe90f-0x0;var _0x3831dc=_0xb0bf[_0x7fe90f];return _0x3831dc;};'use strict';var Sequelize=require(_0xfb0b('0x0'));module['exports']={'tree':{'type':Sequelize[_0xfb0b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbe44=['exports'];(function(_0x474264,_0xe1d48d){var _0x5b3ebb=function(_0xf91746){while(--_0xf91746){_0x474264['push'](_0x474264['shift']());}};_0x5b3ebb(++_0xe1d48d);}(_0xbe44,0xc5));var _0x4be4=function(_0x4b15a4,_0x4241fe){_0x4b15a4=_0x4b15a4-0x0;var _0x40a783=_0xbe44[_0x4b15a4];return _0x40a783;};'use strict';var Sequelize=require('sequelize');module[_0x4be4('0x0')]={'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 a9035da..7636c1c 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 _0xd722=['count','set','json','apply','save','then','destroy','end','sendStatus','stack','name','index','map','AnalyticTreeReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','length','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit'];(function(_0xe94161,_0x469feb){var _0x2d2b62=function(_0x3c1089){while(--_0x3c1089){_0xe94161['push'](_0xe94161['shift']());}};_0x2d2b62(++_0x469feb);}(_0xd722,0x18f));var _0x2d72=function(_0x4816d3,_0x2314a1){_0x4816d3=_0x4816d3-0x0;var _0x38138c=_0xd722[_0x4816d3];return _0x38138c;};'use strict';var emlformat=require(_0x2d72('0x0'));var rimraf=require(_0x2d72('0x1'));var zipdir=require(_0x2d72('0x2'));var jsonpatch=require(_0x2d72('0x3'));var rp=require(_0x2d72('0x4'));var moment=require(_0x2d72('0x5'));var BPromise=require(_0x2d72('0x6'));var Mustache=require(_0x2d72('0x7'));var util=require('util');var path=require(_0x2d72('0x8'));var sox=require(_0x2d72('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d72('0xa'));var _=require(_0x2d72('0xb'));var squel=require(_0x2d72('0xc'));var crypto=require('crypto');var jsforce=require(_0x2d72('0xd'));var deskjs=require(_0x2d72('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2d72('0xf'));var Papa=require(_0x2d72('0x10'));var Redis=require('ioredis');var authService=require(_0x2d72('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2d72('0x12'));var hardwareService=require(_0x2d72('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d72('0x14'));var config=require(_0x2d72('0x15'));var licenseUtil=require(_0x2d72('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e4fd4,_0x1e6aec){_0x1e6aec=_0x1e6aec||0xcc;return function(_0x13fdc8){if(_0x13fdc8){return _0x5e4fd4['sendStatus'](_0x1e6aec);}return _0x5e4fd4[_0x2d72('0x17')](_0x1e6aec)['end']();};}function respondWithResult(_0x5007e4,_0x28afbb){_0x28afbb=_0x28afbb||0xc8;return function(_0x370b1c){if(_0x370b1c){return _0x5007e4[_0x2d72('0x17')](_0x28afbb)['json'](_0x370b1c);}};}function respondWithFilteredResult(_0x18fae2,_0x2bacb0){return function(_0x59be40){if(_0x59be40){var _0x487686=typeof _0x2bacb0[_0x2d72('0x18')]===_0x2d72('0x19')&&typeof _0x2bacb0[_0x2d72('0x1a')]==='undefined';var _0x48d35a=_0x59be40[_0x2d72('0x1b')];var _0x582470=_0x487686?0x0:_0x2bacb0[_0x2d72('0x18')];var _0x3b4ffe=_0x487686?_0x59be40[_0x2d72('0x1b')]:_0x2bacb0[_0x2d72('0x18')]+_0x2bacb0[_0x2d72('0x1a')];var _0x548ad4;if(_0x3b4ffe>=_0x48d35a){_0x3b4ffe=_0x48d35a;_0x548ad4=0xc8;}else{_0x548ad4=0xce;}_0x18fae2[_0x2d72('0x17')](_0x548ad4);return _0x18fae2[_0x2d72('0x1c')]('Content-Range',_0x582470+'-'+_0x3b4ffe+'/'+_0x48d35a)[_0x2d72('0x1d')](_0x59be40);}return null;};}function patchUpdates(_0x5f74bd){return function(_0x2e446c){try{jsonpatch[_0x2d72('0x1e')](_0x2e446c,_0x5f74bd,!![]);}catch(_0x17214f){return BPromise['reject'](_0x17214f);}return _0x2e446c[_0x2d72('0x1f')]();};}function saveUpdates(_0xb38179,_0x5c8f64){return function(_0xb9ce5c){if(_0xb9ce5c){return _0xb9ce5c['update'](_0xb38179)[_0x2d72('0x20')](function(_0x236818){return _0x236818;});}return null;};}function removeEntity(_0x51dd13,_0x1be9ad){return function(_0xbcd61f){if(_0xbcd61f){return _0xbcd61f[_0x2d72('0x21')]()[_0x2d72('0x20')](function(){_0x51dd13[_0x2d72('0x17')](0xcc)[_0x2d72('0x22')]();});}};}function handleEntityNotFound(_0x529adb,_0x44660e){return function(_0x59d4b5){if(!_0x59d4b5){_0x529adb[_0x2d72('0x23')](0x194);}return _0x59d4b5;};}function handleError(_0x100218,_0x552b48){_0x552b48=_0x552b48||0x1f4;return function(_0x2b3a54){logger['error'](_0x2b3a54[_0x2d72('0x24')]);if(_0x2b3a54[_0x2d72('0x25')]){delete _0x2b3a54[_0x2d72('0x25')];}_0x100218['status'](_0x552b48)['send'](_0x2b3a54);};}exports[_0x2d72('0x26')]=function(_0x18415a,_0x200722){var _0x88fa8e={},_0x33c055={},_0x54c83b={'count':0x0,'rows':[]};var _0x322605=_[_0x2d72('0x27')](db[_0x2d72('0x28')][_0x2d72('0x29')],function(_0x82b4eb){return{'name':_0x82b4eb['fieldName'],'type':_0x82b4eb[_0x2d72('0x2a')][_0x2d72('0x2b')]};});_0x33c055['model']=_[_0x2d72('0x27')](_0x322605,_0x2d72('0x25'));_0x33c055[_0x2d72('0x2c')]=_[_0x2d72('0x2d')](_0x18415a['query']);_0x33c055[_0x2d72('0x2e')]=_[_0x2d72('0x2f')](_0x33c055['model'],_0x33c055[_0x2d72('0x2c')]);_0x88fa8e['attributes']=_[_0x2d72('0x2f')](_0x33c055['model'],qs['fields'](_0x18415a['query']['fields']));_0x88fa8e[_0x2d72('0x30')]=_0x88fa8e['attributes'][_0x2d72('0x31')]?_0x88fa8e[_0x2d72('0x30')]:_0x33c055[_0x2d72('0x32')];if(!_0x18415a['query']['hasOwnProperty'](_0x2d72('0x33'))){_0x88fa8e[_0x2d72('0x1a')]=qs[_0x2d72('0x1a')](_0x18415a[_0x2d72('0x2c')][_0x2d72('0x1a')]);_0x88fa8e[_0x2d72('0x18')]=qs[_0x2d72('0x18')](_0x18415a['query'][_0x2d72('0x18')]);}_0x88fa8e[_0x2d72('0x34')]=qs[_0x2d72('0x35')](_0x18415a[_0x2d72('0x2c')][_0x2d72('0x35')]);_0x88fa8e[_0x2d72('0x36')]=qs[_0x2d72('0x2e')](_[_0x2d72('0x37')](_0x18415a[_0x2d72('0x2c')],_0x33c055['filters']),_0x322605);if(_0x18415a[_0x2d72('0x2c')][_0x2d72('0x38')]){_0x88fa8e[_0x2d72('0x36')]=_[_0x2d72('0x39')](_0x88fa8e[_0x2d72('0x36')],{'$or':_[_0x2d72('0x27')](_0x322605,function(_0x39995a){if(_0x39995a[_0x2d72('0x2a')]!==_0x2d72('0x3a')){var _0x269bf6={};_0x269bf6[_0x39995a[_0x2d72('0x25')]]={'$like':'%'+_0x18415a[_0x2d72('0x2c')][_0x2d72('0x38')]+'%'};return _0x269bf6;}})});}_0x88fa8e=_[_0x2d72('0x39')]({},_0x88fa8e,_0x18415a[_0x2d72('0x3b')]);var _0x2ef4a3={'where':_0x88fa8e['where']};return db[_0x2d72('0x28')][_0x2d72('0x1b')](_0x2ef4a3)[_0x2d72('0x20')](function(_0x3c60e0){_0x54c83b[_0x2d72('0x1b')]=_0x3c60e0;if(_0x18415a['query'][_0x2d72('0x3c')]){_0x88fa8e[_0x2d72('0x3d')]=[{'all':!![]}];}return db[_0x2d72('0x28')]['findAll'](_0x88fa8e);})[_0x2d72('0x20')](function(_0x2fb573){_0x54c83b[_0x2d72('0x3e')]=_0x2fb573;return _0x54c83b;})['then'](respondWithFilteredResult(_0x200722,_0x88fa8e))[_0x2d72('0x3f')](handleError(_0x200722,null));};exports[_0x2d72('0x40')]=function(_0x4be651,_0x474466){var _0x58d729={'raw':!![],'where':{'id':_0x4be651[_0x2d72('0x41')]['id']}},_0x2d9958={};_0x2d9958['model']=_[_0x2d72('0x2d')](db[_0x2d72('0x28')][_0x2d72('0x29')]);_0x2d9958[_0x2d72('0x2c')]=_['keys'](_0x4be651[_0x2d72('0x2c')]);_0x2d9958[_0x2d72('0x2e')]=_[_0x2d72('0x2f')](_0x2d9958[_0x2d72('0x32')],_0x2d9958[_0x2d72('0x2c')]);_0x58d729[_0x2d72('0x30')]=_[_0x2d72('0x2f')](_0x2d9958['model'],qs[_0x2d72('0x42')](_0x4be651[_0x2d72('0x2c')]['fields']));_0x58d729[_0x2d72('0x30')]=_0x58d729[_0x2d72('0x30')][_0x2d72('0x31')]?_0x58d729[_0x2d72('0x30')]:_0x2d9958[_0x2d72('0x32')];if(_0x4be651[_0x2d72('0x2c')]['includeAll']){_0x58d729[_0x2d72('0x3d')]=[{'all':!![]}];}_0x58d729=_[_0x2d72('0x39')]({},_0x58d729,_0x4be651[_0x2d72('0x3b')]);return db[_0x2d72('0x28')]['find'](_0x58d729)[_0x2d72('0x20')](handleEntityNotFound(_0x474466,null))[_0x2d72('0x20')](respondWithResult(_0x474466,null))[_0x2d72('0x3f')](handleError(_0x474466,null));};exports[_0x2d72('0x43')]=function(_0x46920b,_0x3308c9){return db[_0x2d72('0x28')][_0x2d72('0x43')](_0x46920b[_0x2d72('0x44')],{})['then'](respondWithResult(_0x3308c9,0xc9))[_0x2d72('0x3f')](handleError(_0x3308c9,null));};exports[_0x2d72('0x45')]=function(_0x3766f3,_0x4cac89){if(_0x3766f3[_0x2d72('0x44')]['id']){delete _0x3766f3[_0x2d72('0x44')]['id'];}return db['AnalyticTreeReport'][_0x2d72('0x46')]({'where':{'id':_0x3766f3['params']['id']}})[_0x2d72('0x20')](handleEntityNotFound(_0x4cac89,null))[_0x2d72('0x20')](saveUpdates(_0x3766f3[_0x2d72('0x44')],null))[_0x2d72('0x20')](respondWithResult(_0x4cac89,null))[_0x2d72('0x3f')](handleError(_0x4cac89,null));};exports[_0x2d72('0x21')]=function(_0x221b86,_0x411a19){return db[_0x2d72('0x28')][_0x2d72('0x46')]({'where':{'id':_0x221b86[_0x2d72('0x41')]['id']}})[_0x2d72('0x20')](handleEntityNotFound(_0x411a19,null))['then'](removeEntity(_0x411a19,null))[_0x2d72('0x3f')](handleError(_0x411a19,null));}; \ No newline at end of file +var _0x30da=['where','merge','VIRTUAL','options','include','AnalyticTreeReport','findAll','rows','catch','show','includeAll','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','map','rawAttributes','type','key','model','name','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','pick','filter'];(function(_0x472f9b,_0x39baa8){var _0x1aa89f=function(_0x1e82e2){while(--_0x1e82e2){_0x472f9b['push'](_0x472f9b['shift']());}};_0x1aa89f(++_0x39baa8);}(_0x30da,0x18c));var _0xa30d=function(_0x1ec3fd,_0x2c34dc){_0x1ec3fd=_0x1ec3fd-0x0;var _0x3aa37f=_0x30da[_0x1ec3fd];return _0x3aa37f;};'use strict';var emlformat=require(_0xa30d('0x0'));var rimraf=require(_0xa30d('0x1'));var zipdir=require(_0xa30d('0x2'));var jsonpatch=require(_0xa30d('0x3'));var rp=require(_0xa30d('0x4'));var moment=require(_0xa30d('0x5'));var BPromise=require(_0xa30d('0x6'));var Mustache=require(_0xa30d('0x7'));var util=require(_0xa30d('0x8'));var path=require(_0xa30d('0x9'));var sox=require('sox');var csv=require(_0xa30d('0xa'));var ejs=require(_0xa30d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa30d('0xc'));var squel=require(_0xa30d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa30d('0xe'));var toCsv=require(_0xa30d('0xa'));var querystring=require(_0xa30d('0xf'));var Papa=require('papaparse');var Redis=require(_0xa30d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa30d('0x11'));var as=require(_0xa30d('0x12'));var hardwareService=require(_0xa30d('0x13'));var logger=require(_0xa30d('0x14'))(_0xa30d('0x15'));var utils=require(_0xa30d('0x16'));var config=require(_0xa30d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa30d('0x18'))['db'];function respondWithStatusCode(_0x5216ce,_0x5b0c6e){_0x5b0c6e=_0x5b0c6e||0xcc;return function(_0x591f8d){if(_0x591f8d){return _0x5216ce[_0xa30d('0x19')](_0x5b0c6e);}return _0x5216ce[_0xa30d('0x1a')](_0x5b0c6e)[_0xa30d('0x1b')]();};}function respondWithResult(_0x5999d0,_0x105544){_0x105544=_0x105544||0xc8;return function(_0x293aed){if(_0x293aed){return _0x5999d0[_0xa30d('0x1a')](_0x105544)['json'](_0x293aed);}};}function respondWithFilteredResult(_0xf2234a,_0x5ae1dd){return function(_0x764659){if(_0x764659){var _0x33532e=typeof _0x5ae1dd[_0xa30d('0x1c')]===_0xa30d('0x1d')&&typeof _0x5ae1dd['limit']===_0xa30d('0x1d');var _0xd83d80=_0x764659[_0xa30d('0x1e')];var _0x120e19=_0x33532e?0x0:_0x5ae1dd['offset'];var _0x232407=_0x33532e?_0x764659[_0xa30d('0x1e')]:_0x5ae1dd[_0xa30d('0x1c')]+_0x5ae1dd['limit'];var _0x539e7f;if(_0x232407>=_0xd83d80){_0x232407=_0xd83d80;_0x539e7f=0xc8;}else{_0x539e7f=0xce;}_0xf2234a[_0xa30d('0x1a')](_0x539e7f);return _0xf2234a[_0xa30d('0x1f')](_0xa30d('0x20'),_0x120e19+'-'+_0x232407+'/'+_0xd83d80)[_0xa30d('0x21')](_0x764659);}return null;};}function patchUpdates(_0x3d2a28){return function(_0x1b7461){try{jsonpatch[_0xa30d('0x22')](_0x1b7461,_0x3d2a28,!![]);}catch(_0x1a2fe2){return BPromise[_0xa30d('0x23')](_0x1a2fe2);}return _0x1b7461[_0xa30d('0x24')]();};}function saveUpdates(_0x2b4b22,_0x5f46b1){return function(_0x2f5a46){if(_0x2f5a46){return _0x2f5a46['update'](_0x2b4b22)[_0xa30d('0x25')](function(_0x5bd84a){return _0x5bd84a;});}return null;};}function removeEntity(_0x597952,_0x35b492){return function(_0x396b8f){if(_0x396b8f){return _0x396b8f[_0xa30d('0x26')]()[_0xa30d('0x25')](function(){_0x597952[_0xa30d('0x1a')](0xcc)[_0xa30d('0x1b')]();});}};}function handleEntityNotFound(_0x2ab4f0,_0x56b4c1){return function(_0x3c9169){if(!_0x3c9169){_0x2ab4f0[_0xa30d('0x19')](0x194);}return _0x3c9169;};}function handleError(_0x33b2b4,_0x13b32d){_0x13b32d=_0x13b32d||0x1f4;return function(_0xaaad32){logger[_0xa30d('0x27')](_0xaaad32[_0xa30d('0x28')]);if(_0xaaad32['name']){delete _0xaaad32['name'];}_0x33b2b4[_0xa30d('0x1a')](_0x13b32d)['send'](_0xaaad32);};}exports['index']=function(_0x532a4a,_0x24b9e8){var _0x258606={},_0x26f2d2={},_0x1aa7e4={'count':0x0,'rows':[]};var _0x7f1ef8=_[_0xa30d('0x29')](db['AnalyticTreeReport'][_0xa30d('0x2a')],function(_0x5460a4){return{'name':_0x5460a4['fieldName'],'type':_0x5460a4[_0xa30d('0x2b')][_0xa30d('0x2c')]};});_0x26f2d2[_0xa30d('0x2d')]=_['map'](_0x7f1ef8,_0xa30d('0x2e'));_0x26f2d2['query']=_[_0xa30d('0x2f')](_0x532a4a[_0xa30d('0x30')]);_0x26f2d2['filters']=_[_0xa30d('0x31')](_0x26f2d2['model'],_0x26f2d2[_0xa30d('0x30')]);_0x258606[_0xa30d('0x32')]=_[_0xa30d('0x31')](_0x26f2d2[_0xa30d('0x2d')],qs[_0xa30d('0x33')](_0x532a4a[_0xa30d('0x30')][_0xa30d('0x33')]));_0x258606[_0xa30d('0x32')]=_0x258606[_0xa30d('0x32')][_0xa30d('0x34')]?_0x258606[_0xa30d('0x32')]:_0x26f2d2[_0xa30d('0x2d')];if(!_0x532a4a[_0xa30d('0x30')]['hasOwnProperty'](_0xa30d('0x35'))){_0x258606[_0xa30d('0x36')]=qs[_0xa30d('0x36')](_0x532a4a[_0xa30d('0x30')][_0xa30d('0x36')]);_0x258606[_0xa30d('0x1c')]=qs['offset'](_0x532a4a[_0xa30d('0x30')]['offset']);}_0x258606[_0xa30d('0x37')]=qs[_0xa30d('0x38')](_0x532a4a[_0xa30d('0x30')]['sort']);_0x258606['where']=qs[_0xa30d('0x39')](_[_0xa30d('0x3a')](_0x532a4a[_0xa30d('0x30')],_0x26f2d2[_0xa30d('0x39')]),_0x7f1ef8);if(_0x532a4a[_0xa30d('0x30')][_0xa30d('0x3b')]){_0x258606[_0xa30d('0x3c')]=_[_0xa30d('0x3d')](_0x258606[_0xa30d('0x3c')],{'$or':_[_0xa30d('0x29')](_0x7f1ef8,function(_0x357c47){if(_0x357c47[_0xa30d('0x2b')]!==_0xa30d('0x3e')){var _0x99cd79={};_0x99cd79[_0x357c47[_0xa30d('0x2e')]]={'$like':'%'+_0x532a4a[_0xa30d('0x30')]['filter']+'%'};return _0x99cd79;}})});}_0x258606=_[_0xa30d('0x3d')]({},_0x258606,_0x532a4a[_0xa30d('0x3f')]);var _0x5d988c={'where':_0x258606[_0xa30d('0x3c')]};return db['AnalyticTreeReport'][_0xa30d('0x1e')](_0x5d988c)['then'](function(_0x4d5cdb){_0x1aa7e4['count']=_0x4d5cdb;if(_0x532a4a['query']['includeAll']){_0x258606[_0xa30d('0x40')]=[{'all':!![]}];}return db[_0xa30d('0x41')][_0xa30d('0x42')](_0x258606);})[_0xa30d('0x25')](function(_0x5a7f90){_0x1aa7e4[_0xa30d('0x43')]=_0x5a7f90;return _0x1aa7e4;})[_0xa30d('0x25')](respondWithFilteredResult(_0x24b9e8,_0x258606))[_0xa30d('0x44')](handleError(_0x24b9e8,null));};exports[_0xa30d('0x45')]=function(_0x2f0d93,_0x4faa6c){var _0x213c9d={'raw':!![],'where':{'id':_0x2f0d93['params']['id']}},_0x45a4aa={};_0x45a4aa[_0xa30d('0x2d')]=_[_0xa30d('0x2f')](db[_0xa30d('0x41')][_0xa30d('0x2a')]);_0x45a4aa[_0xa30d('0x30')]=_[_0xa30d('0x2f')](_0x2f0d93[_0xa30d('0x30')]);_0x45a4aa['filters']=_[_0xa30d('0x31')](_0x45a4aa[_0xa30d('0x2d')],_0x45a4aa['query']);_0x213c9d['attributes']=_['intersection'](_0x45a4aa[_0xa30d('0x2d')],qs[_0xa30d('0x33')](_0x2f0d93['query'][_0xa30d('0x33')]));_0x213c9d[_0xa30d('0x32')]=_0x213c9d[_0xa30d('0x32')][_0xa30d('0x34')]?_0x213c9d[_0xa30d('0x32')]:_0x45a4aa[_0xa30d('0x2d')];if(_0x2f0d93[_0xa30d('0x30')][_0xa30d('0x46')]){_0x213c9d[_0xa30d('0x40')]=[{'all':!![]}];}_0x213c9d=_['merge']({},_0x213c9d,_0x2f0d93[_0xa30d('0x3f')]);return db[_0xa30d('0x41')][_0xa30d('0x47')](_0x213c9d)['then'](handleEntityNotFound(_0x4faa6c,null))['then'](respondWithResult(_0x4faa6c,null))[_0xa30d('0x44')](handleError(_0x4faa6c,null));};exports[_0xa30d('0x48')]=function(_0x1121e4,_0x19afb8){return db['AnalyticTreeReport'][_0xa30d('0x48')](_0x1121e4[_0xa30d('0x49')],{})['then'](respondWithResult(_0x19afb8,0xc9))[_0xa30d('0x44')](handleError(_0x19afb8,null));};exports[_0xa30d('0x4a')]=function(_0x481938,_0x143e02){if(_0x481938[_0xa30d('0x49')]['id']){delete _0x481938[_0xa30d('0x49')]['id'];}return db['AnalyticTreeReport'][_0xa30d('0x47')]({'where':{'id':_0x481938[_0xa30d('0x4b')]['id']}})[_0xa30d('0x25')](handleEntityNotFound(_0x143e02,null))[_0xa30d('0x25')](saveUpdates(_0x481938[_0xa30d('0x49')],null))[_0xa30d('0x25')](respondWithResult(_0x143e02,null))['catch'](handleError(_0x143e02,null));};exports['destroy']=function(_0x2635ec,_0x155e71){return db[_0xa30d('0x41')][_0xa30d('0x47')]({'where':{'id':_0x2635ec['params']['id']}})[_0xa30d('0x25')](handleEntityNotFound(_0x155e71,null))[_0xa30d('0x25')](removeEntity(_0x155e71,null))[_0xa30d('0x44')](handleError(_0x155e71,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1ebfcc2..01f2511 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 _0xcbee=['define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x1fbb4f,_0x65d310){var _0xc226b5=function(_0x455a13){while(--_0x455a13){_0x1fbb4f['push'](_0x1fbb4f['shift']());}};_0xc226b5(++_0x65d310);}(_0xcbee,0x107));var _0xecbe=function(_0x2eeb90,_0x398ad2){_0x2eeb90=_0x2eeb90-0x0;var _0xd40a87=_0xcbee[_0x2eeb90];return _0xd40a87;};'use strict';var _=require(_0xecbe('0x0'));var util=require('util');var logger=require(_0xecbe('0x1'))(_0xecbe('0x2'));var moment=require(_0xecbe('0x3'));var BPromise=require(_0xecbe('0x4'));var rp=require(_0xecbe('0x5'));var fs=require('fs');var path=require(_0xecbe('0x6'));var rimraf=require(_0xecbe('0x7'));var config=require(_0xecbe('0x8'));var attributes=require(_0xecbe('0x9'));module['exports']=function(_0x135c3d,_0x455f5c){return _0x135c3d[_0xecbe('0xa')](_0xecbe('0xb'),attributes,{'tableName':_0xecbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07a6=['request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4bbc65,_0x5737e9){var _0x288343=function(_0x1e2c4a){while(--_0x1e2c4a){_0x4bbc65['push'](_0x4bbc65['shift']());}};_0x288343(++_0x5737e9);}(_0x07a6,0x10c));var _0x607a=function(_0x20f870,_0xce7343){_0x20f870=_0x20f870-0x0;var _0xc2c7ff=_0x07a6[_0x20f870];return _0xc2c7ff;};'use strict';var _=require(_0x607a('0x0'));var util=require('util');var logger=require(_0x607a('0x1'))(_0x607a('0x2'));var moment=require(_0x607a('0x3'));var BPromise=require(_0x607a('0x4'));var rp=require(_0x607a('0x5'));var fs=require('fs');var path=require(_0x607a('0x6'));var rimraf=require(_0x607a('0x7'));var config=require('../../config/environment');var attributes=require(_0x607a('0x8'));module[_0x607a('0x9')]=function(_0x21b724,_0x5ce0cf){return _0x21b724[_0x607a('0xa')](_0x607a('0xb'),attributes,{'tableName':_0x607a('0xc'),'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 27c6d9b..705b401 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2aa47b,_0x2d19f0){var _0x4b05d5=function(_0xe6e71){while(--_0xe6e71){_0x2aa47b['push'](_0x2aa47b['shift']());}};_0x4b05d5(++_0x2d19f0);}(_0xadb5,0xad));var _0x5adb=function(_0x4bd1a2,_0x1c64c7){_0x4bd1a2=_0x4bd1a2-0x0;var _0xb06134=_0xadb5[_0x4bd1a2];return _0xb06134;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5c0d94,_0x19e4b7){_0x5c0d94=_0x5c0d94-0x0;var _0x5b8482=_0x7a54[_0x5c0d94];return _0x5b8482;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6864589..e5d5de2 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 _0x2393=['show','post','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id'];(function(_0x48cde9,_0x22e722){var _0x105c92=function(_0x36b603){while(--_0x36b603){_0x48cde9['push'](_0x48cde9['shift']());}};_0x105c92(++_0x22e722);}(_0x2393,0x122));var _0x3239=function(_0x15ff74,_0x4cc6a9){_0x15ff74=_0x15ff74-0x0;var _0x437331=_0x2393[_0x15ff74];return _0x437331;};'use strict';var multer=require('multer');var util=require(_0x3239('0x0'));var path=require(_0x3239('0x1'));var timeout=require(_0x3239('0x2'));var express=require(_0x3239('0x3'));var router=express[_0x3239('0x4')]();var fs_extra=require(_0x3239('0x5'));var auth=require(_0x3239('0x6'));var interaction=require(_0x3239('0x7'));var config=require(_0x3239('0x8'));var controller=require(_0x3239('0x9'));router[_0x3239('0xa')]('/',auth[_0x3239('0xb')](),controller[_0x3239('0xc')]);router[_0x3239('0xa')](_0x3239('0xd'),auth[_0x3239('0xb')](),controller[_0x3239('0xe')]);router[_0x3239('0xf')]('/',auth[_0x3239('0xb')](),controller['create']);router['put'](_0x3239('0xd'),auth[_0x3239('0xb')](),controller[_0x3239('0x10')]);router[_0x3239('0x11')](_0x3239('0xd'),auth['isAuthenticated'](),controller[_0x3239('0x12')]);module['exports']=router; \ No newline at end of file +var _0x076b=['get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','express','../../components/interaction/service'];(function(_0x57e26c,_0x3d97ba){var _0x299bfa=function(_0x794eb2){while(--_0x794eb2){_0x57e26c['push'](_0x57e26c['shift']());}};_0x299bfa(++_0x3d97ba);}(_0x076b,0x14c));var _0xb076=function(_0x1c31d0,_0x24ca51){_0x1c31d0=_0x1c31d0-0x0;var _0x301fde=_0x076b[_0x1c31d0];return _0x301fde;};'use strict';var multer=require(_0xb076('0x0'));var util=require('util');var path=require(_0xb076('0x1'));var timeout=require('connect-timeout');var express=require(_0xb076('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb076('0x3'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xb076('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb076('0x5'),auth['isAuthenticated'](),controller[_0xb076('0x6')]);router['post']('/',auth[_0xb076('0x7')](),controller[_0xb076('0x8')]);router[_0xb076('0x9')](_0xb076('0x5'),auth[_0xb076('0x7')](),controller[_0xb076('0xa')]);router[_0xb076('0xb')](_0xb076('0x5'),auth['isAuthenticated'](),controller[_0xb076('0xc')]);module[_0xb076('0xd')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a48e7fe..9974280 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 _0x19ea=['sequelize','STRING'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x19ea,0xfe));var _0xa19e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x19ea[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0xa19e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa19e('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','sequelize'];(function(_0xa52b0b,_0xc98fef){var _0x5c6fcb=function(_0x838cab){while(--_0x838cab){_0xa52b0b['push'](_0xa52b0b['shift']());}};_0x5c6fcb(++_0xc98fef);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x45806b,_0x53eeae){_0x45806b=_0x45806b-0x0;var _0x3e228e=_0xf3cd[_0x45806b];return _0x3e228e;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'basename':{'type':Sequelize[_0xdf3c('0x2')]},'type':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8af24c6..2eac70d 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 _0xab04=['get','createdAt','updatedAt','body','omit','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','clone','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xab04,0xd2));var _0x4ab0=function(_0x586642,_0x3b2e5d){_0x586642=_0x586642-0x0;var _0xef997a=_0xab04[_0x586642];return _0xef997a;};'use strict';var emlformat=require(_0x4ab0('0x0'));var rimraf=require(_0x4ab0('0x1'));var zipdir=require(_0x4ab0('0x2'));var jsonpatch=require(_0x4ab0('0x3'));var rp=require(_0x4ab0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ab0('0x5'));var util=require(_0x4ab0('0x6'));var path=require(_0x4ab0('0x7'));var sox=require(_0x4ab0('0x8'));var csv=require(_0x4ab0('0x9'));var ejs=require(_0x4ab0('0xa'));var fs=require('fs');var fs_extra=require(_0x4ab0('0xb'));var _=require(_0x4ab0('0xc'));var squel=require(_0x4ab0('0xd'));var crypto=require(_0x4ab0('0xe'));var jsforce=require(_0x4ab0('0xf'));var deskjs=require(_0x4ab0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4ab0('0x11'));var Papa=require(_0x4ab0('0x12'));var Redis=require(_0x4ab0('0x13'));var authService=require(_0x4ab0('0x14'));var qs=require(_0x4ab0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ab0('0x16'));var logger=require(_0x4ab0('0x17'))(_0x4ab0('0x18'));var utils=require('../../config/utils');var config=require(_0x4ab0('0x19'));var licenseUtil=require(_0x4ab0('0x1a'));var db=require(_0x4ab0('0x1b'))['db'];function respondWithStatusCode(_0x4b79a0,_0x12c724){_0x12c724=_0x12c724||0xcc;return function(_0x1b2d91){if(_0x1b2d91){return _0x4b79a0[_0x4ab0('0x1c')](_0x12c724);}return _0x4b79a0[_0x4ab0('0x1d')](_0x12c724)[_0x4ab0('0x1e')]();};}function respondWithResult(_0x3eec1d,_0x438a0a){_0x438a0a=_0x438a0a||0xc8;return function(_0x55a2aa){if(_0x55a2aa){return _0x3eec1d[_0x4ab0('0x1d')](_0x438a0a)['json'](_0x55a2aa);}};}function respondWithFilteredResult(_0x4d0a95,_0x92929c){return function(_0x1058a2){if(_0x1058a2){var _0x16a676=typeof _0x92929c['offset']===_0x4ab0('0x1f')&&typeof _0x92929c[_0x4ab0('0x20')]==='undefined';var _0x401938=_0x1058a2[_0x4ab0('0x21')];var _0x45b5be=_0x16a676?0x0:_0x92929c[_0x4ab0('0x22')];var _0x549183=_0x16a676?_0x1058a2[_0x4ab0('0x21')]:_0x92929c['offset']+_0x92929c['limit'];var _0x28b6c0;if(_0x549183>=_0x401938){_0x549183=_0x401938;_0x28b6c0=0xc8;}else{_0x28b6c0=0xce;}_0x4d0a95[_0x4ab0('0x1d')](_0x28b6c0);return _0x4d0a95[_0x4ab0('0x23')]('Content-Range',_0x45b5be+'-'+_0x549183+'/'+_0x401938)[_0x4ab0('0x24')](_0x1058a2);}return null;};}function patchUpdates(_0x3f6e8a){return function(_0x3ac563){try{jsonpatch[_0x4ab0('0x25')](_0x3ac563,_0x3f6e8a,!![]);}catch(_0x2fa077){return BPromise[_0x4ab0('0x26')](_0x2fa077);}return _0x3ac563[_0x4ab0('0x27')]();};}function saveUpdates(_0x5ab98c,_0x5abf3c){return function(_0x1d92ab){if(_0x1d92ab){return _0x1d92ab['update'](_0x5ab98c)[_0x4ab0('0x28')](function(_0x41e06b){return _0x41e06b;});}return null;};}function removeEntity(_0x20e13f,_0x4e643e){return function(_0x165a44){if(_0x165a44){return _0x165a44['destroy']()[_0x4ab0('0x28')](function(){_0x20e13f[_0x4ab0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74b6ce,_0xd2c50d){return function(_0x20d3e4){if(!_0x20d3e4){_0x74b6ce['sendStatus'](0x194);}return _0x20d3e4;};}function handleError(_0x2b5e73,_0x297f99){_0x297f99=_0x297f99||0x1f4;return function(_0x481798){logger[_0x4ab0('0x29')](_0x481798[_0x4ab0('0x2a')]);if(_0x481798[_0x4ab0('0x2b')]){delete _0x481798[_0x4ab0('0x2b')];}_0x2b5e73[_0x4ab0('0x1d')](_0x297f99)[_0x4ab0('0x2c')](_0x481798);};}exports[_0x4ab0('0x2d')]=function(_0x4e8a3d,_0x1f9afb){var _0x57cedf={},_0x1ecd42={},_0x109ddc={'count':0x0,'rows':[]};var _0x3fbf42=_[_0x4ab0('0x2e')](db[_0x4ab0('0x2f')][_0x4ab0('0x30')],function(_0x4347d0){return{'name':_0x4347d0[_0x4ab0('0x31')],'type':_0x4347d0['type'][_0x4ab0('0x32')]};});_0x1ecd42[_0x4ab0('0x33')]=_[_0x4ab0('0x2e')](_0x3fbf42,'name');_0x1ecd42[_0x4ab0('0x34')]=_[_0x4ab0('0x35')](_0x4e8a3d['query']);_0x1ecd42[_0x4ab0('0x36')]=_['intersection'](_0x1ecd42[_0x4ab0('0x33')],_0x1ecd42[_0x4ab0('0x34')]);_0x57cedf[_0x4ab0('0x37')]=_[_0x4ab0('0x38')](_0x1ecd42[_0x4ab0('0x33')],qs[_0x4ab0('0x39')](_0x4e8a3d[_0x4ab0('0x34')][_0x4ab0('0x39')]));_0x57cedf[_0x4ab0('0x37')]=_0x57cedf['attributes'][_0x4ab0('0x3a')]?_0x57cedf['attributes']:_0x1ecd42[_0x4ab0('0x33')];if(!_0x4e8a3d[_0x4ab0('0x34')][_0x4ab0('0x3b')]('nolimit')){_0x57cedf['limit']=qs[_0x4ab0('0x20')](_0x4e8a3d[_0x4ab0('0x34')]['limit']);_0x57cedf[_0x4ab0('0x22')]=qs[_0x4ab0('0x22')](_0x4e8a3d[_0x4ab0('0x34')]['offset']);}_0x57cedf[_0x4ab0('0x3c')]=qs['sort'](_0x4e8a3d[_0x4ab0('0x34')][_0x4ab0('0x3d')]);_0x57cedf[_0x4ab0('0x3e')]=qs[_0x4ab0('0x36')](_[_0x4ab0('0x3f')](_0x4e8a3d[_0x4ab0('0x34')],_0x1ecd42[_0x4ab0('0x36')]),_0x3fbf42);if(_0x4e8a3d[_0x4ab0('0x34')][_0x4ab0('0x40')]){_0x57cedf[_0x4ab0('0x3e')]=_[_0x4ab0('0x41')](_0x57cedf[_0x4ab0('0x3e')],{'$or':_['map'](_0x3fbf42,function(_0xf16104){if(_0xf16104[_0x4ab0('0x42')]!==_0x4ab0('0x43')){var _0x46f808={};_0x46f808[_0xf16104[_0x4ab0('0x2b')]]={'$like':'%'+_0x4e8a3d[_0x4ab0('0x34')][_0x4ab0('0x40')]+'%'};return _0x46f808;}})});}_0x57cedf=_[_0x4ab0('0x41')]({},_0x57cedf,_0x4e8a3d[_0x4ab0('0x44')]);var _0x7c507a={'where':_0x57cedf['where']};return db[_0x4ab0('0x2f')][_0x4ab0('0x21')](_0x7c507a)[_0x4ab0('0x28')](function(_0x5090e0){_0x109ddc[_0x4ab0('0x21')]=_0x5090e0;if(_0x4e8a3d[_0x4ab0('0x34')][_0x4ab0('0x45')]){_0x57cedf[_0x4ab0('0x46')]=[{'all':!![]}];}return db[_0x4ab0('0x2f')][_0x4ab0('0x47')](_0x57cedf);})[_0x4ab0('0x28')](function(_0x2fc180){_0x109ddc[_0x4ab0('0x48')]=_0x2fc180;return _0x109ddc;})[_0x4ab0('0x28')](respondWithFilteredResult(_0x1f9afb,_0x57cedf))[_0x4ab0('0x49')](handleError(_0x1f9afb,null));};exports[_0x4ab0('0x4a')]=function(_0x3665bd,_0xde7ce6){var _0x5c67b8={'raw':!![],'where':{'id':_0x3665bd['params']['id']}},_0x3f47bd={};_0x3f47bd['model']=_[_0x4ab0('0x35')](db[_0x4ab0('0x2f')][_0x4ab0('0x30')]);_0x3f47bd['query']=_[_0x4ab0('0x35')](_0x3665bd[_0x4ab0('0x34')]);_0x3f47bd['filters']=_[_0x4ab0('0x38')](_0x3f47bd[_0x4ab0('0x33')],_0x3f47bd['query']);_0x5c67b8['attributes']=_[_0x4ab0('0x38')](_0x3f47bd[_0x4ab0('0x33')],qs[_0x4ab0('0x39')](_0x3665bd[_0x4ab0('0x34')][_0x4ab0('0x39')]));_0x5c67b8[_0x4ab0('0x37')]=_0x5c67b8[_0x4ab0('0x37')]['length']?_0x5c67b8[_0x4ab0('0x37')]:_0x3f47bd[_0x4ab0('0x33')];if(_0x3665bd[_0x4ab0('0x34')][_0x4ab0('0x45')]){_0x5c67b8[_0x4ab0('0x46')]=[{'all':!![]}];}_0x5c67b8=_[_0x4ab0('0x41')]({},_0x5c67b8,_0x3665bd[_0x4ab0('0x44')]);return db[_0x4ab0('0x2f')][_0x4ab0('0x4b')](_0x5c67b8)['then'](handleEntityNotFound(_0xde7ce6,null))['then'](respondWithResult(_0xde7ce6,null))[_0x4ab0('0x49')](handleError(_0xde7ce6,null));};exports[_0x4ab0('0x4c')]=function(_0x5a5ee5,_0x4f9362){var _0x30ec47={'where':{'id':_0x5a5ee5[_0x4ab0('0x4d')]['id']}},_0x171429={};_0x171429[_0x4ab0('0x33')]=_[_0x4ab0('0x35')](db['Attachment'][_0x4ab0('0x30')]);_0x30ec47[_0x4ab0('0x37')]=_['intersection'](_0x171429['model'],qs[_0x4ab0('0x39')](_0x5a5ee5[_0x4ab0('0x34')]['fields']));_0x30ec47['attributes']=_0x30ec47[_0x4ab0('0x37')][_0x4ab0('0x3a')]?_0x30ec47[_0x4ab0('0x37')]:_0x171429['model'];if(_0x5a5ee5[_0x4ab0('0x34')][_0x4ab0('0x45')]){_0x30ec47['include']=[{'all':!![]}];}_0x30ec47=_['merge']({},_0x30ec47,_0x5a5ee5['options']);return db[_0x4ab0('0x2f')][_0x4ab0('0x4b')](_0x30ec47)['then'](handleEntityNotFound(_0x4f9362,null))['then'](function(_0x108bcf){if(_0x108bcf){var _0x51cf38=_0x108bcf[_0x4ab0('0x4e')]({'plain':!![]});_0x51cf38=qs['omit'](_0x51cf38,['id',_0x4ab0('0x4f'),_0x4ab0('0x50')]);_0x5a5ee5[_0x4ab0('0x51')]=_[_0x4ab0('0x52')](_0x5a5ee5[_0x4ab0('0x51')],['id',_0x4ab0('0x4f'),'updatedAt']);return db['Attachment'][_0x4ab0('0x53')](_[_0x4ab0('0x41')](_0x51cf38,_0x5a5ee5[_0x4ab0('0x51')]),{'include':_0x5a5ee5[_0x4ab0('0x34')][_0x4ab0('0x45')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4f9362,0xc9))[_0x4ab0('0x49')](handleError(_0x4f9362,null));};exports['update']=function(_0x14dfd4,_0x72cfc4){if(_0x14dfd4[_0x4ab0('0x51')]['id']){delete _0x14dfd4[_0x4ab0('0x51')]['id'];}return db[_0x4ab0('0x2f')][_0x4ab0('0x4b')]({'where':{'id':_0x14dfd4[_0x4ab0('0x4d')]['id']}})[_0x4ab0('0x28')](handleEntityNotFound(_0x72cfc4,null))['then'](saveUpdates(_0x14dfd4[_0x4ab0('0x51')],null))['then'](respondWithResult(_0x72cfc4,null))[_0x4ab0('0x49')](handleError(_0x72cfc4,null));};exports[_0x4ab0('0x54')]=function(_0x3cf174,_0x534b59){return db[_0x4ab0('0x2f')]['find']({'where':{'id':_0x3cf174['params']['id']}})[_0x4ab0('0x28')](handleEntityNotFound(_0x534b59,null))[_0x4ab0('0x28')](removeEntity(_0x534b59,null))['catch'](handleError(_0x534b59,null));};exports[_0x4ab0('0x53')]=function(_0x4aeed4,_0x3098ca,_0x4de930){_0x4aeed4[_0x4ab0('0x51')][_0x4ab0('0x2b')]=_0x4aeed4[_0x4ab0('0x55')][_0x4ab0('0x56')];_0x4aeed4[_0x4ab0('0x51')][_0x4ab0('0x57')]=_0x4aeed4[_0x4ab0('0x55')][_0x4ab0('0x58')];_0x4aeed4[_0x4ab0('0x51')][_0x4ab0('0x42')]=_0x4aeed4[_0x4ab0('0x55')][_0x4ab0('0x59')];return db[_0x4ab0('0x2f')]['create'](_0x4aeed4[_0x4ab0('0x51')])[_0x4ab0('0x28')](respondWithResult(_0x3098ca,0xc9))['catch'](handleError(_0x3098ca,null));};exports[_0x4ab0('0x5a')]=function(_0x21ac1f,_0x5b9663,_0x412f79){return db[_0x4ab0('0x2f')][_0x4ab0('0x5b')]({'where':{'id':_0x21ac1f['params']['id']},'raw':!![]})[_0x4ab0('0x28')](handleEntityNotFound(_0x5b9663,null))[_0x4ab0('0x28')](function(_0x3f1a68){if(_0x3f1a68){var _0x573897=_0x3f1a68[_0x4ab0('0x5c')]!==null;var _0x3b64cd=path[_0x4ab0('0x5d')](config['root'],_0x4ab0('0x5e'));if(_0x573897){_0x3b64cd=path[_0x4ab0('0x5d')](_0x3b64cd,_0x4ab0('0x5f'));}var _0x398cf6=path['join'](_0x3b64cd,_0x3f1a68[_0x4ab0('0x57')]);return _0x5b9663[_0x4ab0('0x5a')](_0x398cf6);}})[_0x4ab0('0x49')](handleError(_0x5b9663,null));}; \ No newline at end of file +var _0x07e7=['save','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','options','clone','find','createdAt','updatedAt','body','omit','create','update','originalname','file','filename','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x358971,_0x130ce0){var _0x425a95=function(_0x5eca7f){while(--_0x5eca7f){_0x358971['push'](_0x358971['shift']());}};_0x425a95(++_0x130ce0);}(_0x07e7,0xe3));var _0x707e=function(_0x15fe26,_0x5012b1){_0x15fe26=_0x15fe26-0x0;var _0xaae7f2=_0x07e7[_0x15fe26];return _0xaae7f2;};'use strict';var emlformat=require(_0x707e('0x0'));var rimraf=require(_0x707e('0x1'));var zipdir=require(_0x707e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x707e('0x3'));var moment=require(_0x707e('0x4'));var BPromise=require(_0x707e('0x5'));var Mustache=require('mustache');var util=require(_0x707e('0x6'));var path=require(_0x707e('0x7'));var sox=require(_0x707e('0x8'));var csv=require('to-csv');var ejs=require(_0x707e('0x9'));var fs=require('fs');var fs_extra=require(_0x707e('0xa'));var _=require(_0x707e('0xb'));var squel=require(_0x707e('0xc'));var crypto=require(_0x707e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x707e('0xe'));var toCsv=require(_0x707e('0xf'));var querystring=require(_0x707e('0x10'));var Papa=require(_0x707e('0x11'));var Redis=require(_0x707e('0x12'));var authService=require(_0x707e('0x13'));var qs=require(_0x707e('0x14'));var as=require(_0x707e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x707e('0x16'));var utils=require(_0x707e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x707e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d9a78,_0x22d56e){_0x22d56e=_0x22d56e||0xcc;return function(_0x290e33){if(_0x290e33){return _0x4d9a78['sendStatus'](_0x22d56e);}return _0x4d9a78[_0x707e('0x19')](_0x22d56e)['end']();};}function respondWithResult(_0x5c2226,_0x430a57){_0x430a57=_0x430a57||0xc8;return function(_0x139e4f){if(_0x139e4f){return _0x5c2226[_0x707e('0x19')](_0x430a57)[_0x707e('0x1a')](_0x139e4f);}};}function respondWithFilteredResult(_0x336a00,_0x52b826){return function(_0x498f7d){if(_0x498f7d){var _0xa6ae6f=typeof _0x52b826[_0x707e('0x1b')]===_0x707e('0x1c')&&typeof _0x52b826[_0x707e('0x1d')]==='undefined';var _0x2adec8=_0x498f7d[_0x707e('0x1e')];var _0x4936a5=_0xa6ae6f?0x0:_0x52b826[_0x707e('0x1b')];var _0x3e9055=_0xa6ae6f?_0x498f7d[_0x707e('0x1e')]:_0x52b826[_0x707e('0x1b')]+_0x52b826[_0x707e('0x1d')];var _0x338af0;if(_0x3e9055>=_0x2adec8){_0x3e9055=_0x2adec8;_0x338af0=0xc8;}else{_0x338af0=0xce;}_0x336a00[_0x707e('0x19')](_0x338af0);return _0x336a00[_0x707e('0x1f')](_0x707e('0x20'),_0x4936a5+'-'+_0x3e9055+'/'+_0x2adec8)[_0x707e('0x1a')](_0x498f7d);}return null;};}function patchUpdates(_0x50c96c){return function(_0x447af2){try{jsonpatch[_0x707e('0x21')](_0x447af2,_0x50c96c,!![]);}catch(_0xf945f5){return BPromise['reject'](_0xf945f5);}return _0x447af2[_0x707e('0x22')]();};}function saveUpdates(_0x55c39a,_0xfd1ddc){return function(_0x9e0e8d){if(_0x9e0e8d){return _0x9e0e8d['update'](_0x55c39a)[_0x707e('0x23')](function(_0x334d12){return _0x334d12;});}return null;};}function removeEntity(_0x1bf7a6,_0x473fa6){return function(_0x38e71b){if(_0x38e71b){return _0x38e71b[_0x707e('0x24')]()[_0x707e('0x23')](function(){_0x1bf7a6[_0x707e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ba20,_0x25b1a1){return function(_0x24c453){if(!_0x24c453){_0x43ba20[_0x707e('0x25')](0x194);}return _0x24c453;};}function handleError(_0x402032,_0x1fd3c6){_0x1fd3c6=_0x1fd3c6||0x1f4;return function(_0x11d021){logger[_0x707e('0x26')](_0x11d021[_0x707e('0x27')]);if(_0x11d021[_0x707e('0x28')]){delete _0x11d021[_0x707e('0x28')];}_0x402032[_0x707e('0x19')](_0x1fd3c6)[_0x707e('0x29')](_0x11d021);};}exports[_0x707e('0x2a')]=function(_0x4bdcb1,_0xf3480c){var _0x55dbfa={},_0x4875cf={},_0x14e916={'count':0x0,'rows':[]};var _0x36fbe3=_[_0x707e('0x2b')](db[_0x707e('0x2c')]['rawAttributes'],function(_0x264f75){return{'name':_0x264f75[_0x707e('0x2d')],'type':_0x264f75[_0x707e('0x2e')]['key']};});_0x4875cf[_0x707e('0x2f')]=_[_0x707e('0x2b')](_0x36fbe3,_0x707e('0x28'));_0x4875cf[_0x707e('0x30')]=_[_0x707e('0x31')](_0x4bdcb1[_0x707e('0x30')]);_0x4875cf['filters']=_[_0x707e('0x32')](_0x4875cf[_0x707e('0x2f')],_0x4875cf[_0x707e('0x30')]);_0x55dbfa[_0x707e('0x33')]=_[_0x707e('0x32')](_0x4875cf[_0x707e('0x2f')],qs[_0x707e('0x34')](_0x4bdcb1['query']['fields']));_0x55dbfa[_0x707e('0x33')]=_0x55dbfa[_0x707e('0x33')][_0x707e('0x35')]?_0x55dbfa[_0x707e('0x33')]:_0x4875cf['model'];if(!_0x4bdcb1['query'][_0x707e('0x36')](_0x707e('0x37'))){_0x55dbfa[_0x707e('0x1d')]=qs[_0x707e('0x1d')](_0x4bdcb1[_0x707e('0x30')][_0x707e('0x1d')]);_0x55dbfa[_0x707e('0x1b')]=qs['offset'](_0x4bdcb1[_0x707e('0x30')][_0x707e('0x1b')]);}_0x55dbfa[_0x707e('0x38')]=qs[_0x707e('0x39')](_0x4bdcb1['query']['sort']);_0x55dbfa[_0x707e('0x3a')]=qs['filters'](_[_0x707e('0x3b')](_0x4bdcb1[_0x707e('0x30')],_0x4875cf[_0x707e('0x3c')]),_0x36fbe3);if(_0x4bdcb1['query'][_0x707e('0x3d')]){_0x55dbfa[_0x707e('0x3a')]=_[_0x707e('0x3e')](_0x55dbfa[_0x707e('0x3a')],{'$or':_[_0x707e('0x2b')](_0x36fbe3,function(_0x3b54f6){if(_0x3b54f6[_0x707e('0x2e')]!==_0x707e('0x3f')){var _0x172c45={};_0x172c45[_0x3b54f6['name']]={'$like':'%'+_0x4bdcb1[_0x707e('0x30')][_0x707e('0x3d')]+'%'};return _0x172c45;}})});}_0x55dbfa=_[_0x707e('0x3e')]({},_0x55dbfa,_0x4bdcb1['options']);var _0x42efb4={'where':_0x55dbfa[_0x707e('0x3a')]};return db[_0x707e('0x2c')]['count'](_0x42efb4)[_0x707e('0x23')](function(_0x3ced63){_0x14e916['count']=_0x3ced63;if(_0x4bdcb1['query'][_0x707e('0x40')]){_0x55dbfa['include']=[{'all':!![]}];}return db['Attachment'][_0x707e('0x41')](_0x55dbfa);})[_0x707e('0x23')](function(_0x57e4b4){_0x14e916['rows']=_0x57e4b4;return _0x14e916;})[_0x707e('0x23')](respondWithFilteredResult(_0xf3480c,_0x55dbfa))[_0x707e('0x42')](handleError(_0xf3480c,null));};exports[_0x707e('0x43')]=function(_0x21da8d,_0x4ec30a){var _0x158be4={'raw':!![],'where':{'id':_0x21da8d[_0x707e('0x44')]['id']}},_0x16635a={};_0x16635a[_0x707e('0x2f')]=_['keys'](db['Attachment'][_0x707e('0x45')]);_0x16635a['query']=_[_0x707e('0x31')](_0x21da8d[_0x707e('0x30')]);_0x16635a['filters']=_['intersection'](_0x16635a['model'],_0x16635a[_0x707e('0x30')]);_0x158be4['attributes']=_[_0x707e('0x32')](_0x16635a[_0x707e('0x2f')],qs[_0x707e('0x34')](_0x21da8d['query'][_0x707e('0x34')]));_0x158be4[_0x707e('0x33')]=_0x158be4[_0x707e('0x33')][_0x707e('0x35')]?_0x158be4[_0x707e('0x33')]:_0x16635a[_0x707e('0x2f')];if(_0x21da8d[_0x707e('0x30')][_0x707e('0x40')]){_0x158be4['include']=[{'all':!![]}];}_0x158be4=_[_0x707e('0x3e')]({},_0x158be4,_0x21da8d[_0x707e('0x46')]);return db[_0x707e('0x2c')]['find'](_0x158be4)['then'](handleEntityNotFound(_0x4ec30a,null))[_0x707e('0x23')](respondWithResult(_0x4ec30a,null))[_0x707e('0x42')](handleError(_0x4ec30a,null));};exports[_0x707e('0x47')]=function(_0x26fef7,_0xf037d2){var _0x21701d={'where':{'id':_0x26fef7[_0x707e('0x44')]['id']}},_0x4d2db0={};_0x4d2db0[_0x707e('0x2f')]=_['keys'](db[_0x707e('0x2c')][_0x707e('0x45')]);_0x21701d[_0x707e('0x33')]=_[_0x707e('0x32')](_0x4d2db0['model'],qs[_0x707e('0x34')](_0x26fef7[_0x707e('0x30')][_0x707e('0x34')]));_0x21701d['attributes']=_0x21701d[_0x707e('0x33')][_0x707e('0x35')]?_0x21701d['attributes']:_0x4d2db0[_0x707e('0x2f')];if(_0x26fef7[_0x707e('0x30')][_0x707e('0x40')]){_0x21701d['include']=[{'all':!![]}];}_0x21701d=_['merge']({},_0x21701d,_0x26fef7[_0x707e('0x46')]);return db[_0x707e('0x2c')][_0x707e('0x48')](_0x21701d)[_0x707e('0x23')](handleEntityNotFound(_0xf037d2,null))[_0x707e('0x23')](function(_0xdee484){if(_0xdee484){var _0x40286f=_0xdee484['get']({'plain':!![]});_0x40286f=qs['omit'](_0x40286f,['id',_0x707e('0x49'),_0x707e('0x4a')]);_0x26fef7[_0x707e('0x4b')]=_[_0x707e('0x4c')](_0x26fef7['body'],['id',_0x707e('0x49'),_0x707e('0x4a')]);return db[_0x707e('0x2c')][_0x707e('0x4d')](_['merge'](_0x40286f,_0x26fef7['body']),{'include':_0x26fef7[_0x707e('0x30')][_0x707e('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xf037d2,0xc9))[_0x707e('0x42')](handleError(_0xf037d2,null));};exports[_0x707e('0x4e')]=function(_0x9d194c,_0x43eb71){if(_0x9d194c[_0x707e('0x4b')]['id']){delete _0x9d194c[_0x707e('0x4b')]['id'];}return db[_0x707e('0x2c')][_0x707e('0x48')]({'where':{'id':_0x9d194c[_0x707e('0x44')]['id']}})[_0x707e('0x23')](handleEntityNotFound(_0x43eb71,null))['then'](saveUpdates(_0x9d194c[_0x707e('0x4b')],null))[_0x707e('0x23')](respondWithResult(_0x43eb71,null))['catch'](handleError(_0x43eb71,null));};exports[_0x707e('0x24')]=function(_0x1ae4db,_0x2005ba){return db[_0x707e('0x2c')][_0x707e('0x48')]({'where':{'id':_0x1ae4db[_0x707e('0x44')]['id']}})[_0x707e('0x23')](handleEntityNotFound(_0x2005ba,null))[_0x707e('0x23')](removeEntity(_0x2005ba,null))[_0x707e('0x42')](handleError(_0x2005ba,null));};exports[_0x707e('0x4d')]=function(_0x1d165b,_0x42c115,_0x1a925f){_0x1d165b[_0x707e('0x4b')]['name']=_0x1d165b['file'][_0x707e('0x4f')];_0x1d165b[_0x707e('0x4b')]['basename']=_0x1d165b[_0x707e('0x50')][_0x707e('0x51')];_0x1d165b[_0x707e('0x4b')][_0x707e('0x2e')]=_0x1d165b[_0x707e('0x50')]['mimetype'];return db[_0x707e('0x2c')][_0x707e('0x4d')](_0x1d165b['body'])['then'](respondWithResult(_0x42c115,0xc9))[_0x707e('0x42')](handleError(_0x42c115,null));};exports['download']=function(_0x423b04,_0x3fca86,_0x2d8979){return db[_0x707e('0x2c')]['findOne']({'where':{'id':_0x423b04[_0x707e('0x44')]['id']},'raw':!![]})[_0x707e('0x23')](handleEntityNotFound(_0x3fca86,null))[_0x707e('0x23')](function(_0x30006b){if(_0x30006b){var _0x491d37=_0x30006b[_0x707e('0x52')]!==null;var _0x3deb10=path[_0x707e('0x53')](config['root'],_0x707e('0x54'));if(_0x491d37){_0x3deb10=path['join'](_0x3deb10,_0x707e('0x55'));}var _0x1a53dc=path[_0x707e('0x53')](_0x3deb10,_0x30006b[_0x707e('0x56')]);return _0x3fca86['download'](_0x1a53dc);}})['catch'](handleError(_0x3fca86,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index bfe3998..1883df5 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 _0xce1f=['Attachment','attachments','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x181c12,_0x42241d){var _0x219ffd=function(_0x2808aa){while(--_0x2808aa){_0x181c12['push'](_0x181c12['shift']());}};_0x219ffd(++_0x42241d);}(_0xce1f,0x1ba));var _0xfce1=function(_0x4e06ad,_0x1d806b){_0x4e06ad=_0x4e06ad-0x0;var _0x1d715e=_0xce1f[_0x4e06ad];return _0x1d715e;};'use strict';var _=require('lodash');var util=require(_0xfce1('0x0'));var logger=require(_0xfce1('0x1'))('api');var moment=require(_0xfce1('0x2'));var BPromise=require('bluebird');var rp=require(_0xfce1('0x3'));var fs=require('fs');var path=require(_0xfce1('0x4'));var rimraf=require(_0xfce1('0x5'));var config=require(_0xfce1('0x6'));var attributes=require('./attachment.attributes');module[_0xfce1('0x7')]=function(_0x1925b3,_0x532e95){return _0x1925b3[_0xfce1('0x8')](_0xfce1('0x9'),attributes,{'tableName':_0xfce1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe937=['api','moment','bluebird','path','rimraf','exports','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x29f8da,_0x1fb3dd){var _0x169291=function(_0x1efe29){while(--_0x1efe29){_0x29f8da['push'](_0x29f8da['shift']());}};_0x169291(++_0x1fb3dd);}(_0xe937,0x189));var _0x7e93=function(_0x252c07,_0x51b001){_0x252c07=_0x252c07-0x0;var _0xabf32e=_0xe937[_0x252c07];return _0xabf32e;};'use strict';var _=require(_0x7e93('0x0'));var util=require(_0x7e93('0x1'));var logger=require(_0x7e93('0x2'))(_0x7e93('0x3'));var moment=require(_0x7e93('0x4'));var BPromise=require(_0x7e93('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e93('0x6'));var rimraf=require(_0x7e93('0x7'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x7e93('0x8')]=function(_0x5016ea,_0xe7f62e){return _0x5016ea['define'](_0x7e93('0x9'),attributes,{'tableName':_0x7e93('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 3037e0e..0c44a19 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 _0xa0bc=['options','raw','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','create','body'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var moment=require(_0xca0b('0x1'));var BPromise=require('bluebird');var rs=require(_0xca0b('0x2'));var fs=require('fs');var Redis=require(_0xca0b('0x3'));var db=require(_0xca0b('0x4'))['db'];var utils=require(_0xca0b('0x5'));var logger=require(_0xca0b('0x6'))(_0xca0b('0x7'));var config=require(_0xca0b('0x8'));var jayson=require(_0xca0b('0x9'));var client=jayson[_0xca0b('0xa')][_0xca0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbe64c7,_0x30202d,_0xa506a4){return new BPromise(function(_0x19acc2,_0x55a1de){return client[_0xca0b('0xc')](_0xbe64c7,_0xa506a4)[_0xca0b('0xd')](function(_0x3e3909){logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));logger['debug'](_0xca0b('0x11'),_0x30202d,_0xca0b('0x10'),JSON[_0xca0b('0x12')](_0x3e3909));if(_0x3e3909[_0xca0b('0x13')]){if(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x14')]===0x1f4){logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);return _0x55a1de(_0x3e3909['error'][_0xca0b('0x15')]);}logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909['error'][_0xca0b('0x15')]);return _0x19acc2(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);}else{logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));_0x19acc2(_0x3e3909['result'][_0xca0b('0x15')]);}})[_0xca0b('0x16')](function(_0x4d9b16){logger[_0xca0b('0x13')]('Attachment,\x20%s,\x20%s',_0x30202d,_0x4d9b16);_0x55a1de(_0x4d9b16);});});}exports[_0xca0b('0x17')]=function(_0x5050b7){var _0x236503=this;return new Promise(function(_0x32eff7,_0x97be82){return db['Attachment'][_0xca0b('0x18')](_0x5050b7[_0xca0b('0x19')],{'raw':_0x5050b7['options']?_0x5050b7[_0xca0b('0x1a')][_0xca0b('0x1b')]===undefined?!![]:![]:!![]})[_0xca0b('0xd')](function(_0x59bda9){logger[_0xca0b('0xe')](_0xca0b('0x17'),_0x5050b7);logger[_0xca0b('0x1c')](_0xca0b('0x17'),_0x5050b7,JSON[_0xca0b('0x12')](_0x59bda9));_0x32eff7(_0x59bda9);})[_0xca0b('0x16')](function(_0x49e695){logger[_0xca0b('0x13')](_0xca0b('0x17'),_0x49e695[_0xca0b('0x15')],_0x5050b7);_0x97be82(_0x236503['error'](0x1f4,_0x49e695['message']));});});}; \ No newline at end of file +var _0xe600=['code','message','catch','Attachment','create','options','raw','CreateAttachment','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40ffab,_0xcd1df7){var _0x20ed59=function(_0x4c3e73){while(--_0x4c3e73){_0x40ffab['push'](_0x40ffab['shift']());}};_0x20ed59(++_0xcd1df7);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var moment=require('moment');var BPromise=require(_0x0e60('0x1'));var rs=require(_0x0e60('0x2'));var fs=require('fs');var Redis=require(_0x0e60('0x3'));var db=require(_0x0e60('0x4'))['db'];var utils=require(_0x0e60('0x5'));var logger=require(_0x0e60('0x6'))(_0x0e60('0x7'));var config=require(_0x0e60('0x8'));var jayson=require(_0x0e60('0x9'));var client=jayson[_0x0e60('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7563,_0x497a61,_0x6727dd){return new BPromise(function(_0x30eaed,_0x5ba123){return client[_0x0e60('0xb')](_0x1d7563,_0x6727dd)[_0x0e60('0xc')](function(_0x238537){logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));logger['debug'](_0x0e60('0x10'),_0x497a61,_0x0e60('0xf'),JSON[_0x0e60('0x11')](_0x238537));if(_0x238537[_0x0e60('0x12')]){if(_0x238537[_0x0e60('0x12')][_0x0e60('0x13')]===0x1f4){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537['error'][_0x0e60('0x14')]);return _0x5ba123(_0x238537[_0x0e60('0x12')][_0x0e60('0x14')]);}logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537[_0x0e60('0x12')]['message']);return _0x30eaed(_0x238537[_0x0e60('0x12')]['message']);}else{logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));_0x30eaed(_0x238537['result'][_0x0e60('0x14')]);}})[_0x0e60('0x15')](function(_0xdb7760){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0xdb7760);_0x5ba123(_0xdb7760);});});}exports['CreateAttachment']=function(_0x992490){var _0x43a103=this;return new Promise(function(_0x599c1d,_0x17ab47){return db[_0x0e60('0x16')][_0x0e60('0x17')](_0x992490['body'],{'raw':_0x992490[_0x0e60('0x18')]?_0x992490['options'][_0x0e60('0x19')]===undefined?!![]:![]:!![]})[_0x0e60('0xc')](function(_0xb9f037){logger[_0x0e60('0xd')](_0x0e60('0x1a'),_0x992490);logger[_0x0e60('0x1b')](_0x0e60('0x1a'),_0x992490,JSON[_0x0e60('0x11')](_0xb9f037));_0x599c1d(_0xb9f037);})[_0x0e60('0x15')](function(_0x10f875){logger[_0x0e60('0x12')](_0x0e60('0x1a'),_0x10f875[_0x0e60('0x14')],_0x992490);_0x17ab47(_0x43a103[_0x0e60('0x12')](0x1f4,_0x10f875[_0x0e60('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d4d14de..ef51f2d 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 _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(_0x21c449,_0x4ad50d){var _0x5f1dd2=function(_0x29728c){while(--_0x29728c){_0x21c449['push'](_0x21c449['shift']());}};_0x5f1dd2(++_0x4ad50d);}(_0xb10b,0x12a));var _0xbb10=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0xb10b[_0x39bc06];return _0x131143;};'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 +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x26307d,_0x579442){var _0x30f745=function(_0x13c0c3){while(--_0x13c0c3){_0x26307d['push'](_0x26307d['shift']());}};_0x30f745(++_0x579442);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c23ac,_0x2d2c46){_0x1c23ac=_0x1c23ac-0x0;var _0x3f5cc5=_0x5f2f[_0x1c23ac];return _0x3f5cc5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('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 08a25d3..e9cef51 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 _0xe151=['blockedAt','online','admin','user','agent','name','disabled','blocked','add','minutes','getLicense','catch','status','login','ad-login','signToken','json','use','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe151,0x1b9));var _0x1e15=function(_0x57532c,_0x2c75cf){_0x57532c=_0x57532c-0x0;var _0x5cb9a6=_0xe151[_0x57532c];return _0x5cb9a6;};'use strict';var passport=require(_0x1e15('0x0'));var LocalStrategy=require(_0x1e15('0x1'))[_0x1e15('0x2')];var moment=require(_0x1e15('0x3'));var ActiveDirectory=require(_0x1e15('0x4'));var BPromise=require(_0x1e15('0x5'));var util=require(_0x1e15('0x6'));var db=require(_0x1e15('0x7'))['db'];var authService=require(_0x1e15('0x8'));var utils=require(_0x1e15('0x9'));var config=require('../../config/environment');var logger=require(_0x1e15('0xa'))(_0x1e15('0xb'));function isActiveDirectoryConfigured(_0x159474){var _0x3ea0ea=![];if(typeof _0x159474[_0x1e15('0xc')]!==_0x1e15('0xd')){_0x3ea0ea=_0x159474[_0x1e15('0xc')]['baseDN']&&_0x159474[_0x1e15('0xc')]['url']&&_0x159474[_0x1e15('0xc')][_0x1e15('0xe')];}return _0x3ea0ea;}function adAuthenticate(_0x1a7c76,_0x49ed09,_0x4b896b){return new BPromise(function(_0x41cf9b,_0x58539e){try{var _0x3d46d6=new ActiveDirectory(_0x1a7c76);_0x3d46d6[_0x1e15('0xf')](_0x49ed09,_0x4b896b,function(_0x2f92de,_0x530fd3){if(_0x2f92de){logger[_0x1e15('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x49ed09,util[_0x1e15('0x11')](_0x2f92de,{'showHidden':![],'depth':null}));_0x58539e(_0x1e15('0x12'));}else if(!_0x530fd3){logger[_0x1e15('0x10')](_0x1e15('0x13'),_0x49ed09);_0x58539e(_0x1e15('0x12'));}else{_0x41cf9b(_0x530fd3);}});}catch(_0x5ef792){_0x58539e(_0x5ef792);}});}function ActiveDirectoryAuthenticate(_0x45aeef,_0x4ed00f,_0x4c9927,_0x1c8524){var _0x10650c,_0x57961e;if(!isActiveDirectoryConfigured(config)){logger[_0x1e15('0x10')](_0x1e15('0x14'),_0x4ed00f);return _0x1c8524(null,![],{'message':_0x1e15('0x12')});}return db['Setting'][_0x1e15('0x15')]({'where':{'id':0x1},'attributes':[_0x1e15('0x16'),_0x1e15('0x17')],'raw':!![]})[_0x1e15('0x18')](function(_0xf1747d){_0x10650c=_0xf1747d;if(!_0x10650c[_0x1e15('0x16')]){logger[_0x1e15('0x10')](_0x1e15('0x19'),_0x4ed00f);throw new Error(_0x1e15('0x12'));}return _0x45aeef[_0x1e15('0x15')]({'attributes':['id','name',_0x1e15('0x1a'),_0x1e15('0x1b'),_0x1e15('0x1c'),'disabled','blocked',_0x1e15('0x1d'),_0x1e15('0x1e')],'where':{'name':_0x4ed00f,'role':{'$or':[_0x1e15('0x1f'),_0x1e15('0x20'),_0x1e15('0x21')]},'adSsoEnabled':!![]}});})[_0x1e15('0x18')](function(_0xdbc587){if(!_0xdbc587||_0xdbc587&&_0xdbc587[_0x1e15('0x22')]!==_0x4ed00f){throw new Error(_0x1e15('0x12'));}_0x57961e=_0xdbc587;var _0x49395e=_0x57961e[_0x1e15('0x22')]+'@'+config[_0x1e15('0xc')][_0x1e15('0xe')];return adAuthenticate(config[_0x1e15('0xc')],_0x49395e,_0x4c9927);})[_0x1e15('0x18')](function(_0x293562){if(_0x57961e[_0x1e15('0x23')]){throw new Error(_0x1e15('0x12'));}if(_0x10650c[_0x1e15('0x17')]>0x0){if(_0x57961e[_0x1e15('0x24')]){if(moment(_0x57961e['blockedAt'])[_0x1e15('0x25')](_0x10650c[_0x1e15('0x17')],_0x1e15('0x26'))>moment()){throw new Error(_0x1e15('0x12'));}return utils['clearBlockUser'](_0x57961e,0x0,![],null)[_0x1e15('0x18')](function(){return utils[_0x1e15('0x27')](_0x57961e);})[_0x1e15('0x18')](function(){return _0x1c8524(null,_0x57961e);});}else{return utils[_0x1e15('0x27')](_0x57961e)[_0x1e15('0x18')](function(){return _0x1c8524(null,_0x57961e);});}}else{return utils[_0x1e15('0x27')](_0x57961e)[_0x1e15('0x18')](function(){return _0x1c8524(null,_0x57961e);});}})[_0x1e15('0x28')](function(_0x2baf52){return _0x1c8524(null,![],_0x2baf52);});}function handleError(_0x200953,_0x38fd29,_0x4ba690){return _0x200953[_0x1e15('0x29')](_0x38fd29||0x1f4)['send']({'message':_0x4ba690?_0x4ba690['message']||_0x4ba690:''});}exports[_0x1e15('0x2a')]=function(_0x512917,_0xdf895e,_0x5c4336){passport[_0x1e15('0xf')](_0x1e15('0x2b'),function(_0x36519b,_0x480d54,_0x10afb8){var _0x42fb09=_0x36519b||_0x10afb8;if(_0x42fb09){return handleError(_0xdf895e,0x191,_0x42fb09);}if(!_0x480d54){return handleError(_0xdf895e,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3cd54e={'payload':{'id':_0x480d54['id'],'role':_0x480d54[_0x1e15('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x1e15('0x2c')](_0x3cd54e)[_0x1e15('0x18')](function(_0x2d8cac){_0xdf895e[_0x1e15('0x2d')]({'id':_0x480d54['id'],'token':_0x2d8cac,'statusCall':'','isAlreadyLogged':_0x480d54['online']});});}})(_0x512917,_0xdf895e,_0x5c4336);};passport[_0x1e15('0x2e')](_0x1e15('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':_0x1e15('0x1a')},function(_0x51dc28,_0xc4a5f0,_0x4ec454){return ActiveDirectoryAuthenticate(db['User'],_0x51dc28,_0xc4a5f0,_0x4ec454);})); \ No newline at end of file +var _0xabae=['moment','activedirectory2','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','disabled','blocked','blockedAt','admin','user','then','blockDuration','minutes','clearBlockUser','getLicense','catch','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','ad-login','User','passport-local','Strategy'];(function(_0xe06071,_0x4eeaa1){var _0x8ad8be=function(_0xb48521){while(--_0xb48521){_0xe06071['push'](_0xe06071['shift']());}};_0x8ad8be(++_0x4eeaa1);}(_0xabae,0x139));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xeaba('0x0'))[_0xeaba('0x1')];var moment=require(_0xeaba('0x2'));var ActiveDirectory=require(_0xeaba('0x3'));var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xeaba('0x4'));var utils=require(_0xeaba('0x5'));var config=require(_0xeaba('0x6'));var logger=require(_0xeaba('0x7'))(_0xeaba('0x8'));function isActiveDirectoryConfigured(_0x3eccbf){var _0x133c3a=![];if(typeof _0x3eccbf[_0xeaba('0x9')]!==_0xeaba('0xa')){_0x133c3a=_0x3eccbf[_0xeaba('0x9')][_0xeaba('0xb')]&&_0x3eccbf['activedirectory'][_0xeaba('0xc')]&&_0x3eccbf['activedirectory'][_0xeaba('0xd')];}return _0x133c3a;}function adAuthenticate(_0x1983c5,_0x3b985f,_0x133653){return new BPromise(function(_0x2c98e6,_0x39db45){try{var _0x5dc32f=new ActiveDirectory(_0x1983c5);_0x5dc32f[_0xeaba('0xe')](_0x3b985f,_0x133653,function(_0x272c56,_0x40762f){if(_0x272c56){logger[_0xeaba('0xf')](_0xeaba('0x10'),_0x3b985f,util['inspect'](_0x272c56,{'showHidden':![],'depth':null}));_0x39db45(_0xeaba('0x11'));}else if(!_0x40762f){logger[_0xeaba('0xf')](_0xeaba('0x12'),_0x3b985f);_0x39db45('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2c98e6(_0x40762f);}});}catch(_0x24dbb4){_0x39db45(_0x24dbb4);}});}function ActiveDirectoryAuthenticate(_0x3f4a0b,_0x263f7d,_0x311d2e,_0x9f4aa8){var _0x2cecd3,_0x2a4d0c;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xeaba('0x13'),_0x263f7d);return _0x9f4aa8(null,![],{'message':_0xeaba('0x11')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})['then'](function(_0x37560a){_0x2cecd3=_0x37560a;if(!_0x2cecd3['adSsoEnabled']){logger['error'](_0xeaba('0x14'),_0x263f7d);throw new Error(_0xeaba('0x11'));}return _0x3f4a0b[_0xeaba('0x15')]({'attributes':['id',_0xeaba('0x16'),_0xeaba('0x17'),_0xeaba('0x18'),'role',_0xeaba('0x19'),_0xeaba('0x1a'),_0xeaba('0x1b'),'online'],'where':{'name':_0x263f7d,'role':{'$or':[_0xeaba('0x1c'),_0xeaba('0x1d'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x2a9de1){if(!_0x2a9de1||_0x2a9de1&&_0x2a9de1[_0xeaba('0x16')]!==_0x263f7d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2a4d0c=_0x2a9de1;var _0x47d39e=_0x2a4d0c[_0xeaba('0x16')]+'@'+config['activedirectory'][_0xeaba('0xd')];return adAuthenticate(config['activedirectory'],_0x47d39e,_0x311d2e);})[_0xeaba('0x1e')](function(_0x12c06a){if(_0x2a4d0c[_0xeaba('0x19')]){throw new Error(_0xeaba('0x11'));}if(_0x2cecd3['blockDuration']>0x0){if(_0x2a4d0c[_0xeaba('0x1a')]){if(moment(_0x2a4d0c[_0xeaba('0x1b')])['add'](_0x2cecd3[_0xeaba('0x1f')],_0xeaba('0x20'))>moment()){throw new Error(_0xeaba('0x11'));}return utils[_0xeaba('0x21')](_0x2a4d0c,0x0,![],null)[_0xeaba('0x1e')](function(){return utils['getLicense'](_0x2a4d0c);})[_0xeaba('0x1e')](function(){return _0x9f4aa8(null,_0x2a4d0c);});}else{return utils['getLicense'](_0x2a4d0c)[_0xeaba('0x1e')](function(){return _0x9f4aa8(null,_0x2a4d0c);});}}else{return utils[_0xeaba('0x22')](_0x2a4d0c)['then'](function(){return _0x9f4aa8(null,_0x2a4d0c);});}})[_0xeaba('0x23')](function(_0x159e97){return _0x9f4aa8(null,![],_0x159e97);});}function handleError(_0x380cf4,_0x45e085,_0x2f8aa3){return _0x380cf4['status'](_0x45e085||0x1f4)[_0xeaba('0x24')]({'message':_0x2f8aa3?_0x2f8aa3[_0xeaba('0x25')]||_0x2f8aa3:''});}exports['login']=function(_0x11de1c,_0x210f5b,_0x2e6e3d){passport[_0xeaba('0xe')]('ad-login',function(_0x470895,_0x3f59df,_0x4e052f){var _0x1521c9=_0x470895||_0x4e052f;if(_0x1521c9){return handleError(_0x210f5b,0x191,_0x1521c9);}if(!_0x3f59df){return handleError(_0x210f5b,0x194,{'message':_0xeaba('0x26')});}else{var _0x6fc480={'payload':{'id':_0x3f59df['id'],'role':_0x3f59df[_0xeaba('0x27')]},'options':{'expiresIn':0x15180}};return authService[_0xeaba('0x28')](_0x6fc480)[_0xeaba('0x1e')](function(_0x55d17f){_0x210f5b[_0xeaba('0x29')]({'id':_0x3f59df['id'],'token':_0x55d17f,'statusCall':'','isAlreadyLogged':_0x3f59df['online']});});}})(_0x11de1c,_0x210f5b,_0x2e6e3d);};passport[_0xeaba('0x2a')](_0xeaba('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':_0xeaba('0x17')},function(_0x8cb231,_0x3d1c92,_0x11f698){return ActiveDirectoryAuthenticate(db[_0xeaba('0x2c')],_0x8cb231,_0x3d1c92,_0x11f698);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a6460f5..1340dcc 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 _0x0958=['login','exports','express','./authActiveDirectory.controller','post'];(function(_0x29f56b,_0x100c68){var _0x40bb89=function(_0x65fe58){while(--_0x65fe58){_0x29f56b['push'](_0x29f56b['shift']());}};_0x40bb89(++_0x100c68);}(_0x0958,0x138));var _0x8095=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0958[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0x8095('0x0'));var router=express['Router']();var controller=require(_0x8095('0x1'));router[_0x8095('0x2')]('/',controller[_0x8095('0x3')]);module[_0x8095('0x4')]=router; \ No newline at end of file +var _0x4c12=['./authActiveDirectory.controller','post','exports','Router'];(function(_0x1c6089,_0x3816e2){var _0x4d97c1=function(_0x3e631b){while(--_0x3e631b){_0x1c6089['push'](_0x1c6089['shift']());}};_0x4d97c1(++_0x3816e2);}(_0x4c12,0xfb));var _0x24c1=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x4c12[_0x38b2d9];return _0x23a3e1;};'use strict';var express=require('express');var router=express[_0x24c1('0x0')]();var controller=require(_0x24c1('0x1'));router[_0x24c1('0x2')]('/',controller['login']);module[_0x24c1('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9aaf16d..aa60aef 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(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x7a54,0x106));var _0x47a5=function(_0x149463,_0x5eb5f8){_0x149463=_0x149463-0x0;var _0x3e3e60=_0x7a54[_0x149463];return _0x3e3e60;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x7a54,0x106));var _0x47a5=function(_0x294269,_0x507410){_0x294269=_0x294269-0x0;var _0xdad125=_0x7a54[_0x294269];return _0xdad125;};'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 82928ec..85e4789 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 _0x0b1a=['login','/callback','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x23d274,_0x7e1ebe){var _0x2b0f72=function(_0x464e30){while(--_0x464e30){_0x23d274['push'](_0x23d274['shift']());}};_0x2b0f72(++_0x7e1ebe);}(_0x0b1a,0x10c));var _0xa0b1=function(_0x1a71bb,_0x287b6e){_0x1a71bb=_0x1a71bb-0x0;var _0x447572=_0x0b1a[_0x1a71bb];return _0x447572;};'use strict';var express=require(_0xa0b1('0x0'));var passport=require(_0xa0b1('0x1'));var router=express[_0xa0b1('0x2')]();var controller=require(_0xa0b1('0x3'));var userController=require(_0xa0b1('0x4'));var authService=require(_0xa0b1('0x5'));router[_0xa0b1('0x6')]('/',controller[_0xa0b1('0x7')]);router[_0xa0b1('0x6')](_0xa0b1('0x8'),controller['callback'],authService['isMiddleware'],userController[_0xa0b1('0x7')],authService[_0xa0b1('0x9')]);module[_0xa0b1('0xa')]=router; \ No newline at end of file +var _0x20a5=['express','passport','./authGoogle.controller','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports'];(function(_0x41a66e,_0x4b34b8){var _0x2c2f21=function(_0x2a5812){while(--_0x2a5812){_0x41a66e['push'](_0x41a66e['shift']());}};_0x2c2f21(++_0x4b34b8);}(_0x20a5,0x122));var _0x520a=function(_0x440713,_0x258c5c){_0x440713=_0x440713-0x0;var _0x5c8efe=_0x20a5[_0x440713];return _0x5c8efe;};'use strict';var express=require(_0x520a('0x0'));var passport=require(_0x520a('0x1'));var router=express['Router']();var controller=require(_0x520a('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x520a('0x3'));router[_0x520a('0x4')]('/',controller[_0x520a('0x5')]);router[_0x520a('0x4')]('/callback',controller[_0x520a('0x6')],authService[_0x520a('0x7')],userController[_0x520a('0x5')],authService[_0x520a('0x8')]);module[_0x520a('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 9f2020e..a032324 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 _0xddcf=['https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','local-login','util','passport','Strategy','jayson/promise','lodash','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','salt','disabled','blocked','blockedAt','loginAttempts','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','allowedLoginAttempts','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','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'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0xddcf,0x1ab));var _0xfddc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xddcf[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xfddc('0x0'));var passport=require(_0xfddc('0x1'));var LocalStrategy=require('passport-local')[_0xfddc('0x2')];var jayson=require(_0xfddc('0x3'));var _=require(_0xfddc('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0xfddc('0x5'))['db'];var authService=require(_0xfddc('0x6'));var utils=require(_0xfddc('0x7'));var client=jayson[_0xfddc('0x8')][_0xfddc('0x9')]({'port':0x232b});function localAuthenticate(_0x1dac42,_0x569a6e,_0x54f02b,_0x59b2a8){var _0x34c3f9,_0x30b5c4;return db[_0xfddc('0xa')][_0xfddc('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xfddc('0xc')],'raw':!![]})[_0xfddc('0xd')](function(_0xfb52f){_0x34c3f9=_0xfb52f;return _0x1dac42['findOne']({'attributes':['id','name','password',_0xfddc('0xe'),'role',_0xfddc('0xf'),_0xfddc('0x10'),_0xfddc('0x11'),_0xfddc('0x12')],'where':{'name':_0x569a6e,'role':{'$or':['admin',_0xfddc('0x13'),_0xfddc('0x14')]}}});})[_0xfddc('0xd')](function(_0x14f920){if(!_0x14f920||_0x14f920&&_0x14f920[_0xfddc('0x15')]!==_0x569a6e){throw new Error(_0xfddc('0x16'));}else{_0x30b5c4=_0x14f920;return _0x30b5c4;}})[_0xfddc('0xd')](function(){_0x30b5c4[_0xfddc('0x17')](_0x54f02b,function(_0x90f8d2,_0x516971){var _0x5a0da8=_0x30b5c4['loginAttempts']+0x1;if(_0x90f8d2){return _0x59b2a8(_0x90f8d2);}else if(!_0x516971){if(_0x30b5c4[_0xfddc('0xf')]){return _0x59b2a8(null,![],{'message':_0xfddc('0x16')});}else if(_0x34c3f9['allowedLoginAttempts']>0x0){if(_0x30b5c4[_0xfddc('0x10')]){if(_0x34c3f9[_0xfddc('0xc')]>0x0){if(moment(_0x30b5c4[_0xfddc('0x11')])[_0xfddc('0x18')](_0x34c3f9['blockDuration'],'minutes')>moment()){return _0x59b2a8(null,![],{'message':_0xfddc('0x16')});}else{return utils[_0xfddc('0x19')](_0x30b5c4,_0x5a0da8,![],null)[_0xfddc('0xd')](function(){return _0x59b2a8(null,![],{'message':_0xfddc('0x16')});});}}else{return _0x59b2a8(null,![],{'message':_0xfddc('0x16')});}}else{if(_0x5a0da8>=_0x34c3f9[_0xfddc('0x1a')]){return utils[_0xfddc('0x19')](_0x30b5c4,0x0,!![],moment())[_0xfddc('0xd')](function(){return _0x59b2a8(null,![],{'message':_0xfddc('0x16')});});}else{return utils[_0xfddc('0x19')](_0x30b5c4,_0x5a0da8,![],null)[_0xfddc('0xd')](function(){return _0x59b2a8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x59b2a8(null,![],{'message':_0xfddc('0x16')});}}else{if(_0x30b5c4[_0xfddc('0xf')]){return _0x59b2a8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x34c3f9[_0xfddc('0x1a')]>0x0){if(_0x30b5c4[_0xfddc('0x10')]){if(_0x34c3f9[_0xfddc('0xc')]>0x0){if(moment(_0x30b5c4[_0xfddc('0x11')])[_0xfddc('0x18')](_0x34c3f9['blockDuration'],'minutes')>moment()){return _0x59b2a8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfddc('0x19')](_0x30b5c4,0x0,![],null)['then'](function(){return utils[_0xfddc('0x1b')](_0x30b5c4);})[_0xfddc('0xd')](function(){return _0x59b2a8(null,_0x30b5c4);});}}else{return _0x59b2a8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xfddc('0x19')](_0x30b5c4,0x0,![],null)['then'](function(){return utils[_0xfddc('0x1b')](_0x30b5c4);})['then'](function(){return _0x59b2a8(null,_0x30b5c4);})[_0xfddc('0x1c')](function(_0x120ea4){return _0x59b2a8(null,![],_0x120ea4);});}}else{if(_0x30b5c4[_0xfddc('0x10')]){return _0x59b2a8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfddc('0x1b')](_0x30b5c4)[_0xfddc('0xd')](function(){return _0x59b2a8(null,_0x30b5c4);});}}}});})[_0xfddc('0x1c')](function(_0x53c52d){return _0x59b2a8(null,![],_0x53c52d);});}function sendServiceMail(_0xc0315b){return db['MailAccount'][_0xfddc('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0xfddc('0x1e')],'include':[{'model':db[_0xfddc('0x1f')],'as':'Smtp','include':[{'model':db[_0xfddc('0x20')],'as':'CloudProvider'}]}]})['then'](function(_0x29bc0c){if(!_0x29bc0c){throw new Error(_0xfddc('0x21'));}var _0xd3949d=_0x29bc0c[_0xfddc('0x22')]();var _0x5de20c={'account':_0xd3949d,'message':_[_0xfddc('0x23')]({'from':util[_0xfddc('0x24')](_0xfddc('0x25'),_0x29bc0c['name'],_0x29bc0c[_0xfddc('0x1e')]||_0x29bc0c[_0xfddc('0x26')][_0xfddc('0x13')])},_0xc0315b)};return client[_0xfddc('0x27')](_0xfddc('0x28'),_0x5de20c);})[_0xfddc('0xd')](function(_0x36e511){if(_0x36e511[_0xfddc('0x29')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x36e511['error']['message']||JSON['stringify'](_0x36e511[_0xfddc('0x29')])));}return!![];});}function handleError(_0x291ed2,_0x385846,_0x137fc5){return _0x291ed2[_0xfddc('0x2a')](_0x385846||0x1f4)[_0xfddc('0x2b')]({'message':_0x137fc5?_0x137fc5[_0xfddc('0x2c')]||_0x137fc5:''});}exports[_0xfddc('0x2d')]=function(_0x16ec9,_0x26052b,_0x1094c3){passport[_0xfddc('0x17')]('local-login',function(_0x5b916a,_0x2be6ad,_0x2c283b){var _0x318633=_0x5b916a||_0x2c283b;if(_0x318633){return handleError(_0x26052b,0x191,_0x318633);}if(!_0x2be6ad){return handleError(_0x26052b,0x194,{'message':_0xfddc('0x2e')});}else{var _0x67035d={'payload':{'id':_0x2be6ad['id'],'role':_0x2be6ad[_0xfddc('0x2f')]},'options':{'expiresIn':0x15180}};return authService[_0xfddc('0x30')](_0x67035d)[_0xfddc('0xd')](function(_0x3e0220){_0x26052b[_0xfddc('0x31')]({'id':_0x2be6ad['id'],'token':_0x3e0220,'statusCall':'','isAlreadyLogged':_0x2be6ad[_0xfddc('0x32')]});});}})(_0x16ec9,_0x26052b,_0x1094c3);};exports[_0xfddc('0x33')]=function(_0x43f753,_0x23cb76){if(!_0x43f753[_0xfddc('0x34')]['email']){return handleError(_0x23cb76,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x2162f1=rs[_0xfddc('0x35')]();_0x43f753['body'][_0xfddc('0x1e')]=_0x43f753[_0xfddc('0x34')][_0xfddc('0x1e')]['trim']()[_0xfddc('0x36')]();var _0x6c7b1e;return db[_0xfddc('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xfddc('0x1a'),_0xfddc('0xc')],'raw':!![]})['then'](function(_0x20f3c5){_0x6c7b1e=_0x20f3c5;return db[_0xfddc('0x37')]['find']({'where':{'email':_0x43f753[_0xfddc('0x34')][_0xfddc('0x1e')]}});})[_0xfddc('0xd')](function(_0x57455b){if(!_0x57455b){throw new Error(_0xfddc('0x38'));}if(_0x57455b[_0xfddc('0xf')]){throw new Error(_0xfddc('0x39'));}if(_0x57455b[_0xfddc('0x10')]){if(moment(_0x57455b[_0xfddc('0x11')])[_0xfddc('0x18')](_0x6c7b1e['blockDuration'],'minutes')>moment()){throw new Error(_0xfddc('0x3a'));}else{_0x57455b['blocked']=![];_0x57455b[_0xfddc('0x11')]=null;}}_0x57455b[_0xfddc('0x3b')]=_0x2162f1;_0x57455b[_0xfddc('0x3c')]=Date[_0xfddc('0x3d')]()+0x36ee80;return _0x57455b[_0xfddc('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0x43f753[_0xfddc('0x34')][_0xfddc('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xfddc('0x3f')+_0xfddc('0x40')+_0xfddc('0x41')+_0x43f753[_0xfddc('0x42')][_0xfddc('0x43')]+_0xfddc('0x44')+_0x2162f1+'\x0a\x0a'+_0xfddc('0x45')});})['then'](function(){_0x23cb76['status'](0xc8)[_0xfddc('0x2b')]({'message':_0xfddc('0x46')});})['catch'](function(_0x392de6){return handleError(_0x23cb76,0x1f4,_0x392de6);});};exports[_0xfddc('0x47')]=function(_0x54ddd3,_0x15d083){return db[_0xfddc('0x37')][_0xfddc('0x1d')]({'where':{'resetPasswordToken':_0x54ddd3['params'][_0xfddc('0x48')],'resetPasswordExpires':{'$gt':Date[_0xfddc('0x3d')]()}}})['then'](function(_0x4c717d){if(!_0x4c717d){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xfddc('0xb')]({'attributes':['id',_0xfddc('0x49'),_0xfddc('0x4a'),_0xfddc('0x4b')]})['then'](function(_0x51e42e){if(_0x51e42e['securePassword'])authService['validatePasswordPattern'](_0x54ddd3[_0xfddc('0x34')][_0xfddc('0x4c')]);if(!_0x51e42e['enforcePasswordHistory']||!_0x4c717d[_0xfddc('0x4d')])return _0x4c717d;authService[_0xfddc('0x4e')](_0x54ddd3[_0xfddc('0x34')][_0xfddc('0x4c')],_0x4c717d[_0xfddc('0x4d')],_0x51e42e['passwordHistoryLimit']);return _0x4c717d;})[_0xfddc('0xd')](function(){_0x4c717d[_0xfddc('0x4c')]=_0x54ddd3['body']['password'];_0x4c717d[_0xfddc('0x3b')]=null;_0x4c717d['resetPasswordExpires']=null;return _0x4c717d[_0xfddc('0x3e')]();});})['then'](function(){_0x15d083[_0xfddc('0x2a')](0xc8)[_0xfddc('0x2b')]({'message':_0xfddc('0x4f')});})[_0xfddc('0x1c')](function(_0x4f356a){return handleError(_0x15d083,0x1f4,_0x4f356a);});};passport[_0xfddc('0x50')](_0xfddc('0x51'),new LocalStrategy({'usernameField':'name','passwordField':_0xfddc('0x4c')},function(_0x1d07eb,_0x2317cc,_0x5e798a){return localAuthenticate(db[_0xfddc('0x37')],_0x1d07eb,_0x2317cc,_0x5e798a);})); \ No newline at end of file +var _0xcacf=['find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\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','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','local-login','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','Setting','findOne','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','Smtp','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','Email\x20parameter\x20is\x20missing','body'];(function(_0x30e68c,_0x2d3c60){var _0x20b206=function(_0x7fce37){while(--_0x7fce37){_0x30e68c['push'](_0x30e68c['shift']());}};_0x20b206(++_0x2d3c60);}(_0xcacf,0x192));var _0xfcac=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xcacf[_0x47b58b];return _0x46bebe;};'use strict';var util=require(_0xfcac('0x0'));var passport=require('passport');var LocalStrategy=require(_0xfcac('0x1'))['Strategy'];var jayson=require(_0xfcac('0x2'));var _=require(_0xfcac('0x3'));var rs=require(_0xfcac('0x4'));var moment=require(_0xfcac('0x5'));var db=require(_0xfcac('0x6'))['db'];var authService=require(_0xfcac('0x7'));var utils=require('../../config/utils');var client=jayson[_0xfcac('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x5b1407,_0x215267,_0x5719eb,_0x2dc0dc){var _0xe9c73b,_0x1b258d;return db[_0xfcac('0x9')][_0xfcac('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xfcac('0xb')],'raw':!![]})['then'](function(_0x1b61bb){_0xe9c73b=_0x1b61bb;return _0x5b1407[_0xfcac('0xa')]({'attributes':['id',_0xfcac('0xc'),_0xfcac('0xd'),_0xfcac('0xe'),_0xfcac('0xf'),_0xfcac('0x10'),_0xfcac('0x11'),_0xfcac('0x12'),_0xfcac('0x13')],'where':{'name':_0x215267,'role':{'$or':[_0xfcac('0x14'),_0xfcac('0x15'),_0xfcac('0x16')]}}});})['then'](function(_0x2a246a){if(!_0x2a246a||_0x2a246a&&_0x2a246a[_0xfcac('0xc')]!==_0x215267){throw new Error(_0xfcac('0x17'));}else{_0x1b258d=_0x2a246a;return _0x1b258d;}})[_0xfcac('0x18')](function(){_0x1b258d['authenticate'](_0x5719eb,function(_0x59b0b5,_0x1d44d4){var _0x41bea1=_0x1b258d[_0xfcac('0x13')]+0x1;if(_0x59b0b5){return _0x2dc0dc(_0x59b0b5);}else if(!_0x1d44d4){if(_0x1b258d[_0xfcac('0x10')]){return _0x2dc0dc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xe9c73b[_0xfcac('0x19')]>0x0){if(_0x1b258d['blocked']){if(_0xe9c73b[_0xfcac('0xb')]>0x0){if(moment(_0x1b258d[_0xfcac('0x12')])['add'](_0xe9c73b[_0xfcac('0xb')],_0xfcac('0x1a'))>moment()){return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});}else{return utils['clearBlockUser'](_0x1b258d,_0x41bea1,![],null)[_0xfcac('0x18')](function(){return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});});}}else{return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});}}else{if(_0x41bea1>=_0xe9c73b[_0xfcac('0x19')]){return utils[_0xfcac('0x1b')](_0x1b258d,0x0,!![],moment())[_0xfcac('0x18')](function(){return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});});}else{return utils[_0xfcac('0x1b')](_0x1b258d,_0x41bea1,![],null)[_0xfcac('0x18')](function(){return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});});}}}else{return _0x2dc0dc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1b258d[_0xfcac('0x10')]){return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});}else if(_0xe9c73b[_0xfcac('0x19')]>0x0){if(_0x1b258d[_0xfcac('0x11')]){if(_0xe9c73b[_0xfcac('0xb')]>0x0){if(moment(_0x1b258d[_0xfcac('0x12')])[_0xfcac('0x1c')](_0xe9c73b[_0xfcac('0xb')],_0xfcac('0x1a'))>moment()){return _0x2dc0dc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfcac('0x1b')](_0x1b258d,0x0,![],null)[_0xfcac('0x18')](function(){return utils[_0xfcac('0x1d')](_0x1b258d);})[_0xfcac('0x18')](function(){return _0x2dc0dc(null,_0x1b258d);});}}else{return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});}}else{return utils['clearBlockUser'](_0x1b258d,0x0,![],null)[_0xfcac('0x18')](function(){return utils[_0xfcac('0x1d')](_0x1b258d);})[_0xfcac('0x18')](function(){return _0x2dc0dc(null,_0x1b258d);})['catch'](function(_0xcd94d){return _0x2dc0dc(null,![],_0xcd94d);});}}else{if(_0x1b258d[_0xfcac('0x11')]){return _0x2dc0dc(null,![],{'message':_0xfcac('0x17')});}else{return utils[_0xfcac('0x1d')](_0x1b258d)['then'](function(){return _0x2dc0dc(null,_0x1b258d);});}}}});})[_0xfcac('0x1e')](function(_0x21682e){return _0x2dc0dc(null,![],_0x21682e);});}function sendServiceMail(_0x16d3e3){return db[_0xfcac('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0xfcac('0xc'),_0xfcac('0x20')],'include':[{'model':db[_0xfcac('0x21')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xfcac('0x22')}]}]})[_0xfcac('0x18')](function(_0x2cca51){if(!_0x2cca51){throw new Error(_0xfcac('0x23'));}var _0x487a26=_0x2cca51['getSmtpOptions']();var _0x52fc7a={'account':_0x487a26,'message':_[_0xfcac('0x24')]({'from':util[_0xfcac('0x25')](_0xfcac('0x26'),_0x2cca51[_0xfcac('0xc')],_0x2cca51['email']||_0x2cca51[_0xfcac('0x27')][_0xfcac('0x15')])},_0x16d3e3)};return client['request'](_0xfcac('0x28'),_0x52fc7a);})[_0xfcac('0x18')](function(_0x30d7ca){if(_0x30d7ca[_0xfcac('0x29')]){throw new Error(util[_0xfcac('0x25')](_0xfcac('0x2a'),_0x30d7ca['error'][_0xfcac('0x2b')]||JSON['stringify'](_0x30d7ca[_0xfcac('0x29')])));}return!![];});}function handleError(_0x2a8d54,_0x18b06c,_0x23a2c9){return _0x2a8d54[_0xfcac('0x2c')](_0x18b06c||0x1f4)[_0xfcac('0x2d')]({'message':_0x23a2c9?_0x23a2c9['message']||_0x23a2c9:''});}exports[_0xfcac('0x2e')]=function(_0x144aaa,_0x57742b,_0x27efd2){passport[_0xfcac('0x2f')]('local-login',function(_0x24490f,_0x4827fc,_0x424c8b){var _0x3ccdb8=_0x24490f||_0x424c8b;if(_0x3ccdb8){return handleError(_0x57742b,0x191,_0x3ccdb8);}if(!_0x4827fc){return handleError(_0x57742b,0x194,{'message':_0xfcac('0x30')});}else{var _0x2f0cd1={'payload':{'id':_0x4827fc['id'],'role':_0x4827fc[_0xfcac('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xfcac('0x31')](_0x2f0cd1)['then'](function(_0xe42be9){_0x57742b['json']({'id':_0x4827fc['id'],'token':_0xe42be9,'statusCall':'','isAlreadyLogged':_0x4827fc[_0xfcac('0x32')]});});}})(_0x144aaa,_0x57742b,_0x27efd2);};exports[_0xfcac('0x33')]=function(_0x4e5d2a,_0x227b64){if(!_0x4e5d2a['body'][_0xfcac('0x20')]){return handleError(_0x227b64,0x1f4,{'message':_0xfcac('0x34')});}var _0xc20157=rs['generate']();_0x4e5d2a[_0xfcac('0x35')][_0xfcac('0x20')]=_0x4e5d2a['body'][_0xfcac('0x20')]['trim']()['toLowerCase']();var _0x6eef7b;return db[_0xfcac('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xfcac('0xb')],'raw':!![]})['then'](function(_0x404b85){_0x6eef7b=_0x404b85;return db['User'][_0xfcac('0x36')]({'where':{'email':_0x4e5d2a['body'][_0xfcac('0x20')]}});})[_0xfcac('0x18')](function(_0x334e0f){if(!_0x334e0f){throw new Error(_0xfcac('0x37'));}if(_0x334e0f[_0xfcac('0x10')]){throw new Error(_0xfcac('0x38'));}if(_0x334e0f[_0xfcac('0x11')]){if(moment(_0x334e0f[_0xfcac('0x12')])[_0xfcac('0x1c')](_0x6eef7b[_0xfcac('0xb')],_0xfcac('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x334e0f[_0xfcac('0x11')]=![];_0x334e0f[_0xfcac('0x12')]=null;}}_0x334e0f[_0xfcac('0x39')]=_0xc20157;_0x334e0f[_0xfcac('0x3a')]=Date[_0xfcac('0x3b')]()+0x36ee80;return _0x334e0f[_0xfcac('0x3c')]();})[_0xfcac('0x18')](function(){return sendServiceMail({'to':_0x4e5d2a['body'][_0xfcac('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xfcac('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x4e5d2a['headers']['host']+'/reset/'+_0xc20157+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xfcac('0x18')](function(){_0x227b64['status'](0xc8)['send']({'message':_0xfcac('0x3e')});})[_0xfcac('0x1e')](function(_0x3d738e){return handleError(_0x227b64,0x1f4,_0x3d738e);});};exports[_0xfcac('0x3f')]=function(_0x2a5ca4,_0x3343e2){return db[_0xfcac('0x40')][_0xfcac('0x36')]({'where':{'resetPasswordToken':_0x2a5ca4[_0xfcac('0x41')][_0xfcac('0x42')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xfcac('0x18')](function(_0x559b71){if(!_0x559b71){throw new Error(_0xfcac('0x43'));}return db[_0xfcac('0x9')][_0xfcac('0xa')]({'attributes':['id',_0xfcac('0x44'),_0xfcac('0x45'),_0xfcac('0x46')]})[_0xfcac('0x18')](function(_0x1867e6){if(_0x1867e6['securePassword'])authService[_0xfcac('0x47')](_0x2a5ca4[_0xfcac('0x35')]['password']);if(!_0x1867e6[_0xfcac('0x45')]||!_0x559b71[_0xfcac('0x48')])return _0x559b71;authService['validatePasswordHistory'](_0x2a5ca4['body']['password'],_0x559b71[_0xfcac('0x48')],_0x1867e6[_0xfcac('0x46')]);return _0x559b71;})[_0xfcac('0x18')](function(){_0x559b71[_0xfcac('0xd')]=_0x2a5ca4[_0xfcac('0x35')][_0xfcac('0xd')];_0x559b71[_0xfcac('0x39')]=null;_0x559b71[_0xfcac('0x3a')]=null;return _0x559b71[_0xfcac('0x3c')]();});})[_0xfcac('0x18')](function(){_0x3343e2[_0xfcac('0x2c')](0xc8)[_0xfcac('0x2d')]({'message':_0xfcac('0x49')});})[_0xfcac('0x1e')](function(_0x2aee57){return handleError(_0x3343e2,0x1f4,_0x2aee57);});};passport[_0xfcac('0x4a')](_0xfcac('0x4b'),new LocalStrategy({'usernameField':_0xfcac('0xc'),'passwordField':'password'},function(_0x31c5c7,_0x599621,_0x4e7615){return localAuthenticate(db[_0xfcac('0x40')],_0x31c5c7,_0x599621,_0x4e7615);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9ad8caa..4402599 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 _0xa91c=['/reset/:token','reset','exports','./authLocal.controller','post','login','forgot'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xa91c,0x65));var _0xca91=function(_0x2b5947,_0x41cf17){_0x2b5947=_0x2b5947-0x0;var _0x39510c=_0xa91c[_0x2b5947];return _0x39510c;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xca91('0x0'));router[_0xca91('0x1')]('/',controller[_0xca91('0x2')]);router[_0xca91('0x1')]('/forgot',controller[_0xca91('0x3')]);router[_0xca91('0x1')](_0xca91('0x4'),controller[_0xca91('0x5')]);module[_0xca91('0x6')]=router; \ No newline at end of file +var _0x8a6a=['login','post','/forgot','forgot','/reset/:token','reset','exports','Router','./authLocal.controller'];(function(_0x19aaa9,_0x9d0bb6){var _0x465463=function(_0x3a96db){while(--_0x3a96db){_0x19aaa9['push'](_0x19aaa9['shift']());}};_0x465463(++_0x9d0bb6);}(_0x8a6a,0xfa));var _0xa8a6=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8a6a[_0x543084];return _0x306a57;};'use strict';var express=require('express');var router=express[_0xa8a6('0x0')]();var controller=require(_0xa8a6('0x1'));router['post']('/',controller[_0xa8a6('0x2')]);router[_0xa8a6('0x3')](_0xa8a6('0x4'),controller[_0xa8a6('0x5')]);router[_0xa8a6('0x3')](_0xa8a6('0x6'),controller[_0xa8a6('0x7')]);module[_0xa8a6('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 2d5e2b1..121c9d2 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 _0xc447=['BOOLEAN','sequelize','STRING'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0xc447,0xfd));var _0x7c44=function(_0x543a37,_0x2691ea){_0x543a37=_0x543a37-0x0;var _0x17f5bb=_0xc447[_0x543a37];return _0x17f5bb;};'use strict';var Sequelize=require(_0x7c44('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c44('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x7c44('0x1')]},'description':{'type':Sequelize[_0x7c44('0x1')]},'status':{'type':Sequelize[_0x7c44('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x3f8f=['BOOLEAN','INTEGER','STRING'];(function(_0x31cc6e,_0x4da430){var _0x39a234=function(_0x3fe7cd){while(--_0x3fe7cd){_0x31cc6e['push'](_0x31cc6e['shift']());}};_0x39a234(++_0x4da430);}(_0x3f8f,0x1a0));var _0xf3f8=function(_0x5faae8,_0x1523d5){_0x5faae8=_0x5faae8-0x0;var _0x542615=_0x3f8f[_0x5faae8];return _0x542615;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xf3f8('0x0')]},'description':{'type':Sequelize[_0xf3f8('0x0')]},'status':{'type':Sequelize[_0xf3f8('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf3f8('0x2')],'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 5c76796..6cd9fb9 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 _0x8b00=['Content-Range','save','destroy','then','name','send','index','map','Automation','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','show','params','rawAttributes','include','find','create','body','catch','update','addConditions','Condition','ids','getConditions','addActions','Action','omit','getActions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set'];(function(_0x3f4e0e,_0x4577a7){var _0x2d7fb1=function(_0x4c5afc){while(--_0x4c5afc){_0x3f4e0e['push'](_0x3f4e0e['shift']());}};_0x2d7fb1(++_0x4577a7);}(_0x8b00,0xcd));var _0x08b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b00[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x08b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08b0('0x1'));var jsonpatch=require(_0x08b0('0x2'));var rp=require(_0x08b0('0x3'));var moment=require(_0x08b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x08b0('0x5'));var util=require(_0x08b0('0x6'));var path=require(_0x08b0('0x7'));var sox=require(_0x08b0('0x8'));var csv=require('to-csv');var ejs=require(_0x08b0('0x9'));var fs=require('fs');var fs_extra=require(_0x08b0('0xa'));var _=require(_0x08b0('0xb'));var squel=require('squel');var crypto=require(_0x08b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x08b0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x08b0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x08b0('0xf'));var hardwareService=require(_0x08b0('0x10'));var logger=require(_0x08b0('0x11'))(_0x08b0('0x12'));var utils=require('../../config/utils');var config=require(_0x08b0('0x13'));var licenseUtil=require(_0x08b0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5955b1,_0x10b41e){_0x10b41e=_0x10b41e||0xcc;return function(_0x2078b2){if(_0x2078b2){return _0x5955b1[_0x08b0('0x15')](_0x10b41e);}return _0x5955b1[_0x08b0('0x16')](_0x10b41e)[_0x08b0('0x17')]();};}function respondWithResult(_0x168fdc,_0x26f19a){_0x26f19a=_0x26f19a||0xc8;return function(_0x18e4a9){if(_0x18e4a9){return _0x168fdc[_0x08b0('0x16')](_0x26f19a)[_0x08b0('0x18')](_0x18e4a9);}};}function respondWithFilteredResult(_0x118935,_0x2d48d9){return function(_0x47f8fe){if(_0x47f8fe){var _0x714ec0=typeof _0x2d48d9[_0x08b0('0x19')]===_0x08b0('0x1a')&&typeof _0x2d48d9[_0x08b0('0x1b')]==='undefined';var _0x576d13=_0x47f8fe['count'];var _0x88c045=_0x714ec0?0x0:_0x2d48d9[_0x08b0('0x19')];var _0x43a8d7=_0x714ec0?_0x47f8fe['count']:_0x2d48d9[_0x08b0('0x19')]+_0x2d48d9[_0x08b0('0x1b')];var _0x34b535;if(_0x43a8d7>=_0x576d13){_0x43a8d7=_0x576d13;_0x34b535=0xc8;}else{_0x34b535=0xce;}_0x118935[_0x08b0('0x16')](_0x34b535);return _0x118935[_0x08b0('0x1c')](_0x08b0('0x1d'),_0x88c045+'-'+_0x43a8d7+'/'+_0x576d13)[_0x08b0('0x18')](_0x47f8fe);}return null;};}function patchUpdates(_0x39d7f5){return function(_0x36eba7){try{jsonpatch['apply'](_0x36eba7,_0x39d7f5,!![]);}catch(_0x30fc7d){return BPromise['reject'](_0x30fc7d);}return _0x36eba7[_0x08b0('0x1e')]();};}function saveUpdates(_0x5c356e,_0x5b81ed){return function(_0x514e6e){if(_0x514e6e){return _0x514e6e['update'](_0x5c356e)['then'](function(_0x55c508){return _0x55c508;});}return null;};}function removeEntity(_0x344b27,_0x244156){return function(_0x4fe1fa){if(_0x4fe1fa){return _0x4fe1fa[_0x08b0('0x1f')]()[_0x08b0('0x20')](function(){_0x344b27[_0x08b0('0x16')](0xcc)[_0x08b0('0x17')]();});}};}function handleEntityNotFound(_0x7f7961,_0x2f4361){return function(_0x500ba5){if(!_0x500ba5){_0x7f7961['sendStatus'](0x194);}return _0x500ba5;};}function handleError(_0x394f44,_0x419aa6){_0x419aa6=_0x419aa6||0x1f4;return function(_0x2364fc){logger['error'](_0x2364fc['stack']);if(_0x2364fc[_0x08b0('0x21')]){delete _0x2364fc[_0x08b0('0x21')];}_0x394f44[_0x08b0('0x16')](_0x419aa6)[_0x08b0('0x22')](_0x2364fc);};}exports[_0x08b0('0x23')]=function(_0x101d7a,_0xe080fe){var _0x58db77={},_0xc9ab76={},_0x130ab6={'count':0x0,'rows':[]};var _0x538103=_[_0x08b0('0x24')](db[_0x08b0('0x25')]['rawAttributes'],function(_0xa56dee){return{'name':_0xa56dee['fieldName'],'type':_0xa56dee['type']['key']};});_0xc9ab76[_0x08b0('0x26')]=_['map'](_0x538103,_0x08b0('0x21'));_0xc9ab76[_0x08b0('0x27')]=_[_0x08b0('0x28')](_0x101d7a['query']);_0xc9ab76[_0x08b0('0x29')]=_[_0x08b0('0x2a')](_0xc9ab76[_0x08b0('0x26')],_0xc9ab76['query']);_0x58db77['attributes']=_[_0x08b0('0x2a')](_0xc9ab76[_0x08b0('0x26')],qs[_0x08b0('0x2b')](_0x101d7a[_0x08b0('0x27')]['fields']));_0x58db77['attributes']=_0x58db77[_0x08b0('0x2c')][_0x08b0('0x2d')]?_0x58db77[_0x08b0('0x2c')]:_0xc9ab76[_0x08b0('0x26')];if(!_0x101d7a['query'][_0x08b0('0x2e')](_0x08b0('0x2f'))){_0x58db77[_0x08b0('0x1b')]=qs['limit'](_0x101d7a[_0x08b0('0x27')][_0x08b0('0x1b')]);_0x58db77['offset']=qs[_0x08b0('0x19')](_0x101d7a[_0x08b0('0x27')][_0x08b0('0x19')]);}_0x58db77[_0x08b0('0x30')]=qs[_0x08b0('0x31')](_0x101d7a[_0x08b0('0x27')][_0x08b0('0x31')]);_0x58db77[_0x08b0('0x32')]=qs[_0x08b0('0x29')](_[_0x08b0('0x33')](_0x101d7a['query'],_0xc9ab76['filters']),_0x538103);if(_0x101d7a[_0x08b0('0x27')][_0x08b0('0x34')]){_0x58db77[_0x08b0('0x32')]=_[_0x08b0('0x35')](_0x58db77[_0x08b0('0x32')],{'$or':_[_0x08b0('0x24')](_0x538103,function(_0x49e62b){if(_0x49e62b[_0x08b0('0x36')]!==_0x08b0('0x37')){var _0x2889be={};_0x2889be[_0x49e62b[_0x08b0('0x21')]]={'$like':'%'+_0x101d7a[_0x08b0('0x27')][_0x08b0('0x34')]+'%'};return _0x2889be;}})});}_0x58db77=_[_0x08b0('0x35')]({},_0x58db77,_0x101d7a[_0x08b0('0x38')]);var _0x5ebbeb={'where':_0x58db77['where']};return db['Automation'][_0x08b0('0x39')](_0x5ebbeb)['then'](function(_0x2883e1){_0x130ab6[_0x08b0('0x39')]=_0x2883e1;if(_0x101d7a[_0x08b0('0x27')][_0x08b0('0x3a')]){_0x58db77['include']=[{'all':!![]}];}return db[_0x08b0('0x25')][_0x08b0('0x3b')](_0x58db77);})[_0x08b0('0x20')](function(_0x63bca3){_0x130ab6['rows']=_0x63bca3;return _0x130ab6;})[_0x08b0('0x20')](respondWithFilteredResult(_0xe080fe,_0x58db77))['catch'](handleError(_0xe080fe,null));};exports[_0x08b0('0x3c')]=function(_0x564d3c,_0x2a7d14){var _0x517f16={'raw':![],'where':{'id':_0x564d3c[_0x08b0('0x3d')]['id']}},_0x24dfba={};_0x24dfba[_0x08b0('0x26')]=_[_0x08b0('0x28')](db[_0x08b0('0x25')][_0x08b0('0x3e')]);_0x24dfba[_0x08b0('0x27')]=_['keys'](_0x564d3c[_0x08b0('0x27')]);_0x24dfba[_0x08b0('0x29')]=_['intersection'](_0x24dfba['model'],_0x24dfba[_0x08b0('0x27')]);_0x517f16[_0x08b0('0x2c')]=_[_0x08b0('0x2a')](_0x24dfba[_0x08b0('0x26')],qs[_0x08b0('0x2b')](_0x564d3c[_0x08b0('0x27')][_0x08b0('0x2b')]));_0x517f16[_0x08b0('0x2c')]=_0x517f16[_0x08b0('0x2c')]['length']?_0x517f16[_0x08b0('0x2c')]:_0x24dfba['model'];if(_0x564d3c['query'][_0x08b0('0x3a')]){_0x517f16[_0x08b0('0x3f')]=[{'all':!![]}];}_0x517f16=_[_0x08b0('0x35')]({},_0x517f16,_0x564d3c[_0x08b0('0x38')]);return db['Automation'][_0x08b0('0x40')](_0x517f16)['then'](handleEntityNotFound(_0x2a7d14,null))['then'](respondWithResult(_0x2a7d14,null))['catch'](handleError(_0x2a7d14,null));};exports['create']=function(_0x36fe41,_0xe954a1){return db[_0x08b0('0x25')][_0x08b0('0x41')](_0x36fe41[_0x08b0('0x42')],{})['then'](respondWithResult(_0xe954a1,0xc9))[_0x08b0('0x43')](handleError(_0xe954a1,null));};exports[_0x08b0('0x44')]=function(_0x397611,_0x5f5805){if(_0x397611[_0x08b0('0x42')]['id']){delete _0x397611[_0x08b0('0x42')]['id'];}return db['Automation'][_0x08b0('0x40')]({'where':{'id':_0x397611[_0x08b0('0x3d')]['id']}})[_0x08b0('0x20')](handleEntityNotFound(_0x5f5805,null))[_0x08b0('0x20')](saveUpdates(_0x397611['body'],null))[_0x08b0('0x20')](respondWithResult(_0x5f5805,null))[_0x08b0('0x43')](handleError(_0x5f5805,null));};exports['destroy']=function(_0x1a8fe8,_0x208cb0){return db[_0x08b0('0x25')][_0x08b0('0x40')]({'where':{'id':_0x1a8fe8[_0x08b0('0x3d')]['id']}})[_0x08b0('0x20')](handleEntityNotFound(_0x208cb0,null))[_0x08b0('0x20')](removeEntity(_0x208cb0,null))[_0x08b0('0x43')](handleError(_0x208cb0,null));};exports[_0x08b0('0x45')]=function(_0x31789f,_0x488210,_0xb9ee7c){return db[_0x08b0('0x46')][_0x08b0('0x40')]({'where':{'id':_0x31789f[_0x08b0('0x3d')]['id']}})[_0x08b0('0x20')](handleEntityNotFound(_0x488210,null))['then'](function(_0x4cc55a){if(_0x4cc55a){return _0x4cc55a[_0x08b0('0x45')](_0x31789f[_0x08b0('0x42')]['ids'],_['omit'](_0x31789f[_0x08b0('0x42')],[_0x08b0('0x47'),'id'])||{});}})[_0x08b0('0x20')](respondWithResult(_0x488210,null))[_0x08b0('0x43')](handleError(_0x488210,null));};exports['getConditions']=function(_0x16a1db,_0x11228b,_0x5e6f57){var _0x446a46={};var _0x3d6eb2={};var _0x40f810;var _0x576722;return db[_0x08b0('0x25')]['findOne']({'where':{'id':_0x16a1db[_0x08b0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x11228b,null))['then'](function(_0x2d684c){if(_0x2d684c){_0x40f810=_0x2d684c;_0x3d6eb2['model']=_['keys'](db[_0x08b0('0x46')][_0x08b0('0x3e')]);_0x3d6eb2[_0x08b0('0x27')]=_[_0x08b0('0x28')](_0x16a1db['query']);_0x3d6eb2[_0x08b0('0x29')]=_['intersection'](_0x3d6eb2[_0x08b0('0x26')],_0x3d6eb2[_0x08b0('0x27')]);_0x446a46[_0x08b0('0x2c')]=_[_0x08b0('0x2a')](_0x3d6eb2[_0x08b0('0x26')],qs[_0x08b0('0x2b')](_0x16a1db[_0x08b0('0x27')][_0x08b0('0x2b')]));_0x446a46[_0x08b0('0x2c')]=_0x446a46['attributes'][_0x08b0('0x2d')]?_0x446a46[_0x08b0('0x2c')]:_0x3d6eb2[_0x08b0('0x26')];_0x446a46[_0x08b0('0x30')]=qs[_0x08b0('0x31')](_0x16a1db[_0x08b0('0x27')][_0x08b0('0x31')]);_0x446a46['where']=qs[_0x08b0('0x29')](_[_0x08b0('0x33')](_0x16a1db[_0x08b0('0x27')],_0x3d6eb2['filters']));if(_0x16a1db[_0x08b0('0x27')][_0x08b0('0x34')]){_0x446a46['where']=_[_0x08b0('0x35')](_0x446a46[_0x08b0('0x32')],{'$or':_[_0x08b0('0x24')](_0x446a46[_0x08b0('0x2c')],function(_0x454cd7){var _0x37b8c3={};_0x37b8c3[_0x454cd7]={'$like':'%'+_0x16a1db[_0x08b0('0x27')][_0x08b0('0x34')]+'%'};return _0x37b8c3;})});}_0x446a46=_[_0x08b0('0x35')]({},_0x446a46,_0x16a1db[_0x08b0('0x38')]);return _0x40f810[_0x08b0('0x48')](_0x446a46);}})['then'](function(_0x511164){if(_0x511164){_0x576722=_0x511164['length'];if(!_0x16a1db[_0x08b0('0x27')][_0x08b0('0x2e')](_0x08b0('0x2f'))){_0x446a46[_0x08b0('0x1b')]=qs[_0x08b0('0x1b')](_0x16a1db['query'][_0x08b0('0x1b')]);_0x446a46[_0x08b0('0x19')]=qs[_0x08b0('0x19')](_0x16a1db[_0x08b0('0x27')][_0x08b0('0x19')]);}return _0x40f810[_0x08b0('0x48')](_0x446a46);}})[_0x08b0('0x20')](function(_0x2fb036){if(_0x2fb036){return _0x2fb036?{'count':_0x576722,'rows':_0x2fb036}:null;}})[_0x08b0('0x20')](respondWithResult(_0x11228b,null))[_0x08b0('0x43')](handleError(_0x11228b,null));};exports[_0x08b0('0x49')]=function(_0x1c9e63,_0x32555e,_0x137abb){return db[_0x08b0('0x4a')][_0x08b0('0x40')]({'where':{'id':_0x1c9e63[_0x08b0('0x3d')]['id']}})[_0x08b0('0x20')](handleEntityNotFound(_0x32555e,null))[_0x08b0('0x20')](function(_0x54e5ed){if(_0x54e5ed){return _0x54e5ed[_0x08b0('0x49')](_0x1c9e63[_0x08b0('0x42')][_0x08b0('0x47')],_[_0x08b0('0x4b')](_0x1c9e63[_0x08b0('0x42')],['ids','id'])||{});}})[_0x08b0('0x20')](respondWithResult(_0x32555e,null))['catch'](handleError(_0x32555e,null));};exports[_0x08b0('0x4c')]=function(_0x58eef6,_0x1bd15b,_0x56078d){var _0x1f674a={};var _0x264faf={};var _0x2b38e7;var _0x15e8ba;return db[_0x08b0('0x25')][_0x08b0('0x4d')]({'where':{'id':_0x58eef6[_0x08b0('0x3d')]['id']}})[_0x08b0('0x20')](handleEntityNotFound(_0x1bd15b,null))['then'](function(_0x273106){if(_0x273106){_0x2b38e7=_0x273106;_0x264faf[_0x08b0('0x26')]=_['keys'](db[_0x08b0('0x4a')][_0x08b0('0x3e')]);_0x264faf['query']=_[_0x08b0('0x28')](_0x58eef6[_0x08b0('0x27')]);_0x264faf[_0x08b0('0x29')]=_[_0x08b0('0x2a')](_0x264faf[_0x08b0('0x26')],_0x264faf[_0x08b0('0x27')]);_0x1f674a['attributes']=_[_0x08b0('0x2a')](_0x264faf['model'],qs['fields'](_0x58eef6['query']['fields']));_0x1f674a[_0x08b0('0x2c')]=_0x1f674a[_0x08b0('0x2c')][_0x08b0('0x2d')]?_0x1f674a[_0x08b0('0x2c')]:_0x264faf[_0x08b0('0x26')];_0x1f674a[_0x08b0('0x30')]=qs[_0x08b0('0x31')](_0x58eef6[_0x08b0('0x27')][_0x08b0('0x31')]);_0x1f674a[_0x08b0('0x32')]=qs[_0x08b0('0x29')](_[_0x08b0('0x33')](_0x58eef6[_0x08b0('0x27')],_0x264faf[_0x08b0('0x29')]));if(_0x58eef6[_0x08b0('0x27')][_0x08b0('0x34')]){_0x1f674a['where']=_['merge'](_0x1f674a[_0x08b0('0x32')],{'$or':_[_0x08b0('0x24')](_0x1f674a[_0x08b0('0x2c')],function(_0x43a2d7){var _0x2ba5fe={};_0x2ba5fe[_0x43a2d7]={'$like':'%'+_0x58eef6[_0x08b0('0x27')]['filter']+'%'};return _0x2ba5fe;})});}_0x1f674a=_[_0x08b0('0x35')]({},_0x1f674a,_0x58eef6[_0x08b0('0x38')]);return _0x2b38e7[_0x08b0('0x4c')](_0x1f674a);}})[_0x08b0('0x20')](function(_0xf1584d){if(_0xf1584d){_0x15e8ba=_0xf1584d[_0x08b0('0x2d')];if(!_0x58eef6[_0x08b0('0x27')][_0x08b0('0x2e')](_0x08b0('0x2f'))){_0x1f674a[_0x08b0('0x1b')]=qs[_0x08b0('0x1b')](_0x58eef6[_0x08b0('0x27')][_0x08b0('0x1b')]);_0x1f674a[_0x08b0('0x19')]=qs[_0x08b0('0x19')](_0x58eef6[_0x08b0('0x27')][_0x08b0('0x19')]);}return _0x2b38e7[_0x08b0('0x4c')](_0x1f674a);}})[_0x08b0('0x20')](function(_0x4eceaf){if(_0x4eceaf){return _0x4eceaf?{'count':_0x15e8ba,'rows':_0x4eceaf}:null;}})['then'](respondWithResult(_0x1bd15b,null))[_0x08b0('0x43')](handleError(_0x1bd15b,null));}; \ No newline at end of file +var _0xad39=['bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Automation','includeAll','include','findAll','rows','catch','show','find','create','body','params','addConditions','ids','omit','getConditions','findOne','Condition','pick','addActions','Action','getActions','eml-format','fast-json-patch','request-promise','moment'];(function(_0x4287bd,_0x28e174){var _0x5b9d29=function(_0x536995){while(--_0x536995){_0x4287bd['push'](_0x4287bd['shift']());}};_0x5b9d29(++_0x28e174);}(_0xad39,0xa2));var _0x9ad3=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xad39[_0x16aaef];return _0x1c82ef;};'use strict';var emlformat=require(_0x9ad3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ad3('0x1'));var rp=require(_0x9ad3('0x2'));var moment=require(_0x9ad3('0x3'));var BPromise=require(_0x9ad3('0x4'));var Mustache=require('mustache');var util=require(_0x9ad3('0x5'));var path=require(_0x9ad3('0x6'));var sox=require('sox');var csv=require(_0x9ad3('0x7'));var ejs=require(_0x9ad3('0x8'));var fs=require('fs');var fs_extra=require(_0x9ad3('0x9'));var _=require('lodash');var squel=require(_0x9ad3('0xa'));var crypto=require(_0x9ad3('0xb'));var jsforce=require(_0x9ad3('0xc'));var deskjs=require(_0x9ad3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9ad3('0xe'));var Papa=require(_0x9ad3('0xf'));var Redis=require(_0x9ad3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9ad3('0x11'));var hardwareService=require(_0x9ad3('0x12'));var logger=require('../../config/logger')(_0x9ad3('0x13'));var utils=require(_0x9ad3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9ad3('0x15'));var db=require(_0x9ad3('0x16'))['db'];function respondWithStatusCode(_0x2f98e7,_0x23ed9d){_0x23ed9d=_0x23ed9d||0xcc;return function(_0x2fe085){if(_0x2fe085){return _0x2f98e7[_0x9ad3('0x17')](_0x23ed9d);}return _0x2f98e7['status'](_0x23ed9d)[_0x9ad3('0x18')]();};}function respondWithResult(_0x189b48,_0x213ab6){_0x213ab6=_0x213ab6||0xc8;return function(_0x400ad0){if(_0x400ad0){return _0x189b48[_0x9ad3('0x19')](_0x213ab6)[_0x9ad3('0x1a')](_0x400ad0);}};}function respondWithFilteredResult(_0x3a7d10,_0x2263b5){return function(_0x34b6d1){if(_0x34b6d1){var _0x2961fa=typeof _0x2263b5[_0x9ad3('0x1b')]===_0x9ad3('0x1c')&&typeof _0x2263b5[_0x9ad3('0x1d')]===_0x9ad3('0x1c');var _0x51a74e=_0x34b6d1[_0x9ad3('0x1e')];var _0x5b2909=_0x2961fa?0x0:_0x2263b5['offset'];var _0x388f2e=_0x2961fa?_0x34b6d1[_0x9ad3('0x1e')]:_0x2263b5[_0x9ad3('0x1b')]+_0x2263b5['limit'];var _0x3e2f80;if(_0x388f2e>=_0x51a74e){_0x388f2e=_0x51a74e;_0x3e2f80=0xc8;}else{_0x3e2f80=0xce;}_0x3a7d10[_0x9ad3('0x19')](_0x3e2f80);return _0x3a7d10[_0x9ad3('0x1f')]('Content-Range',_0x5b2909+'-'+_0x388f2e+'/'+_0x51a74e)['json'](_0x34b6d1);}return null;};}function patchUpdates(_0x83aa7e){return function(_0x278e3a){try{jsonpatch[_0x9ad3('0x20')](_0x278e3a,_0x83aa7e,!![]);}catch(_0x43995f){return BPromise[_0x9ad3('0x21')](_0x43995f);}return _0x278e3a[_0x9ad3('0x22')]();};}function saveUpdates(_0x433c22,_0x98038b){return function(_0x666cf2){if(_0x666cf2){return _0x666cf2[_0x9ad3('0x23')](_0x433c22)[_0x9ad3('0x24')](function(_0x189a1a){return _0x189a1a;});}return null;};}function removeEntity(_0x28216f,_0x21c465){return function(_0x1dca4b){if(_0x1dca4b){return _0x1dca4b[_0x9ad3('0x25')]()['then'](function(){_0x28216f[_0x9ad3('0x19')](0xcc)[_0x9ad3('0x18')]();});}};}function handleEntityNotFound(_0x1655a7,_0x5a8189){return function(_0x480948){if(!_0x480948){_0x1655a7[_0x9ad3('0x17')](0x194);}return _0x480948;};}function handleError(_0x4bff56,_0x35af21){_0x35af21=_0x35af21||0x1f4;return function(_0x2907ee){logger[_0x9ad3('0x26')](_0x2907ee[_0x9ad3('0x27')]);if(_0x2907ee[_0x9ad3('0x28')]){delete _0x2907ee[_0x9ad3('0x28')];}_0x4bff56[_0x9ad3('0x19')](_0x35af21)[_0x9ad3('0x29')](_0x2907ee);};}exports['index']=function(_0x324957,_0x52073c){var _0x49f5f2={},_0x44c85f={},_0xc5c49e={'count':0x0,'rows':[]};var _0x35f3d2=_['map'](db['Automation'][_0x9ad3('0x2a')],function(_0xa84349){return{'name':_0xa84349[_0x9ad3('0x2b')],'type':_0xa84349[_0x9ad3('0x2c')]['key']};});_0x44c85f[_0x9ad3('0x2d')]=_[_0x9ad3('0x2e')](_0x35f3d2,_0x9ad3('0x28'));_0x44c85f[_0x9ad3('0x2f')]=_[_0x9ad3('0x30')](_0x324957[_0x9ad3('0x2f')]);_0x44c85f[_0x9ad3('0x31')]=_['intersection'](_0x44c85f[_0x9ad3('0x2d')],_0x44c85f[_0x9ad3('0x2f')]);_0x49f5f2[_0x9ad3('0x32')]=_[_0x9ad3('0x33')](_0x44c85f[_0x9ad3('0x2d')],qs[_0x9ad3('0x34')](_0x324957[_0x9ad3('0x2f')][_0x9ad3('0x34')]));_0x49f5f2[_0x9ad3('0x32')]=_0x49f5f2[_0x9ad3('0x32')][_0x9ad3('0x35')]?_0x49f5f2[_0x9ad3('0x32')]:_0x44c85f['model'];if(!_0x324957[_0x9ad3('0x2f')][_0x9ad3('0x36')](_0x9ad3('0x37'))){_0x49f5f2['limit']=qs[_0x9ad3('0x1d')](_0x324957['query']['limit']);_0x49f5f2[_0x9ad3('0x1b')]=qs['offset'](_0x324957[_0x9ad3('0x2f')][_0x9ad3('0x1b')]);}_0x49f5f2[_0x9ad3('0x38')]=qs['sort'](_0x324957[_0x9ad3('0x2f')][_0x9ad3('0x39')]);_0x49f5f2[_0x9ad3('0x3a')]=qs[_0x9ad3('0x31')](_['pick'](_0x324957[_0x9ad3('0x2f')],_0x44c85f[_0x9ad3('0x31')]),_0x35f3d2);if(_0x324957[_0x9ad3('0x2f')][_0x9ad3('0x3b')]){_0x49f5f2[_0x9ad3('0x3a')]=_['merge'](_0x49f5f2['where'],{'$or':_[_0x9ad3('0x2e')](_0x35f3d2,function(_0x40941c){if(_0x40941c[_0x9ad3('0x2c')]!=='VIRTUAL'){var _0x387642={};_0x387642[_0x40941c[_0x9ad3('0x28')]]={'$like':'%'+_0x324957[_0x9ad3('0x2f')]['filter']+'%'};return _0x387642;}})});}_0x49f5f2=_[_0x9ad3('0x3c')]({},_0x49f5f2,_0x324957[_0x9ad3('0x3d')]);var _0x7149e9={'where':_0x49f5f2[_0x9ad3('0x3a')]};return db[_0x9ad3('0x3e')][_0x9ad3('0x1e')](_0x7149e9)[_0x9ad3('0x24')](function(_0x2690c8){_0xc5c49e[_0x9ad3('0x1e')]=_0x2690c8;if(_0x324957[_0x9ad3('0x2f')][_0x9ad3('0x3f')]){_0x49f5f2[_0x9ad3('0x40')]=[{'all':!![]}];}return db[_0x9ad3('0x3e')][_0x9ad3('0x41')](_0x49f5f2);})[_0x9ad3('0x24')](function(_0x30e91e){_0xc5c49e[_0x9ad3('0x42')]=_0x30e91e;return _0xc5c49e;})[_0x9ad3('0x24')](respondWithFilteredResult(_0x52073c,_0x49f5f2))[_0x9ad3('0x43')](handleError(_0x52073c,null));};exports[_0x9ad3('0x44')]=function(_0x564250,_0x30159d){var _0x44dd76={'raw':![],'where':{'id':_0x564250['params']['id']}},_0x45d040={};_0x45d040[_0x9ad3('0x2d')]=_[_0x9ad3('0x30')](db['Automation'][_0x9ad3('0x2a')]);_0x45d040[_0x9ad3('0x2f')]=_[_0x9ad3('0x30')](_0x564250[_0x9ad3('0x2f')]);_0x45d040['filters']=_[_0x9ad3('0x33')](_0x45d040['model'],_0x45d040[_0x9ad3('0x2f')]);_0x44dd76[_0x9ad3('0x32')]=_[_0x9ad3('0x33')](_0x45d040[_0x9ad3('0x2d')],qs[_0x9ad3('0x34')](_0x564250['query']['fields']));_0x44dd76[_0x9ad3('0x32')]=_0x44dd76['attributes'][_0x9ad3('0x35')]?_0x44dd76['attributes']:_0x45d040[_0x9ad3('0x2d')];if(_0x564250['query']['includeAll']){_0x44dd76[_0x9ad3('0x40')]=[{'all':!![]}];}_0x44dd76=_['merge']({},_0x44dd76,_0x564250[_0x9ad3('0x3d')]);return db[_0x9ad3('0x3e')][_0x9ad3('0x45')](_0x44dd76)[_0x9ad3('0x24')](handleEntityNotFound(_0x30159d,null))['then'](respondWithResult(_0x30159d,null))[_0x9ad3('0x43')](handleError(_0x30159d,null));};exports[_0x9ad3('0x46')]=function(_0x8211a6,_0x2b0ea9){return db['Automation'][_0x9ad3('0x46')](_0x8211a6[_0x9ad3('0x47')],{})['then'](respondWithResult(_0x2b0ea9,0xc9))[_0x9ad3('0x43')](handleError(_0x2b0ea9,null));};exports['update']=function(_0x4a6650,_0x284819){if(_0x4a6650['body']['id']){delete _0x4a6650[_0x9ad3('0x47')]['id'];}return db[_0x9ad3('0x3e')][_0x9ad3('0x45')]({'where':{'id':_0x4a6650['params']['id']}})[_0x9ad3('0x24')](handleEntityNotFound(_0x284819,null))[_0x9ad3('0x24')](saveUpdates(_0x4a6650[_0x9ad3('0x47')],null))[_0x9ad3('0x24')](respondWithResult(_0x284819,null))[_0x9ad3('0x43')](handleError(_0x284819,null));};exports[_0x9ad3('0x25')]=function(_0x78b861,_0x23b672){return db['Automation']['find']({'where':{'id':_0x78b861['params']['id']}})[_0x9ad3('0x24')](handleEntityNotFound(_0x23b672,null))[_0x9ad3('0x24')](removeEntity(_0x23b672,null))['catch'](handleError(_0x23b672,null));};exports['addConditions']=function(_0x12159b,_0x3636fa,_0x1a5a5e){return db['Condition'][_0x9ad3('0x45')]({'where':{'id':_0x12159b[_0x9ad3('0x48')]['id']}})['then'](handleEntityNotFound(_0x3636fa,null))[_0x9ad3('0x24')](function(_0x418279){if(_0x418279){return _0x418279[_0x9ad3('0x49')](_0x12159b[_0x9ad3('0x47')][_0x9ad3('0x4a')],_[_0x9ad3('0x4b')](_0x12159b[_0x9ad3('0x47')],['ids','id'])||{});}})[_0x9ad3('0x24')](respondWithResult(_0x3636fa,null))[_0x9ad3('0x43')](handleError(_0x3636fa,null));};exports[_0x9ad3('0x4c')]=function(_0x36b963,_0x4a45a8,_0x454e2b){var _0x2354a7={};var _0x5bc7b1={};var _0x99e564;var _0x41f079;return db[_0x9ad3('0x3e')][_0x9ad3('0x4d')]({'where':{'id':_0x36b963[_0x9ad3('0x48')]['id']}})[_0x9ad3('0x24')](handleEntityNotFound(_0x4a45a8,null))[_0x9ad3('0x24')](function(_0x1afa1c){if(_0x1afa1c){_0x99e564=_0x1afa1c;_0x5bc7b1[_0x9ad3('0x2d')]=_[_0x9ad3('0x30')](db[_0x9ad3('0x4e')][_0x9ad3('0x2a')]);_0x5bc7b1[_0x9ad3('0x2f')]=_['keys'](_0x36b963['query']);_0x5bc7b1[_0x9ad3('0x31')]=_[_0x9ad3('0x33')](_0x5bc7b1[_0x9ad3('0x2d')],_0x5bc7b1[_0x9ad3('0x2f')]);_0x2354a7[_0x9ad3('0x32')]=_['intersection'](_0x5bc7b1[_0x9ad3('0x2d')],qs[_0x9ad3('0x34')](_0x36b963[_0x9ad3('0x2f')]['fields']));_0x2354a7['attributes']=_0x2354a7[_0x9ad3('0x32')]['length']?_0x2354a7[_0x9ad3('0x32')]:_0x5bc7b1[_0x9ad3('0x2d')];_0x2354a7[_0x9ad3('0x38')]=qs[_0x9ad3('0x39')](_0x36b963[_0x9ad3('0x2f')][_0x9ad3('0x39')]);_0x2354a7['where']=qs['filters'](_[_0x9ad3('0x4f')](_0x36b963[_0x9ad3('0x2f')],_0x5bc7b1[_0x9ad3('0x31')]));if(_0x36b963[_0x9ad3('0x2f')][_0x9ad3('0x3b')]){_0x2354a7['where']=_[_0x9ad3('0x3c')](_0x2354a7['where'],{'$or':_[_0x9ad3('0x2e')](_0x2354a7[_0x9ad3('0x32')],function(_0x199064){var _0x4bb102={};_0x4bb102[_0x199064]={'$like':'%'+_0x36b963[_0x9ad3('0x2f')][_0x9ad3('0x3b')]+'%'};return _0x4bb102;})});}_0x2354a7=_[_0x9ad3('0x3c')]({},_0x2354a7,_0x36b963[_0x9ad3('0x3d')]);return _0x99e564[_0x9ad3('0x4c')](_0x2354a7);}})[_0x9ad3('0x24')](function(_0x1ec0b4){if(_0x1ec0b4){_0x41f079=_0x1ec0b4['length'];if(!_0x36b963[_0x9ad3('0x2f')][_0x9ad3('0x36')]('nolimit')){_0x2354a7['limit']=qs[_0x9ad3('0x1d')](_0x36b963[_0x9ad3('0x2f')][_0x9ad3('0x1d')]);_0x2354a7[_0x9ad3('0x1b')]=qs[_0x9ad3('0x1b')](_0x36b963['query'][_0x9ad3('0x1b')]);}return _0x99e564[_0x9ad3('0x4c')](_0x2354a7);}})[_0x9ad3('0x24')](function(_0x445c8c){if(_0x445c8c){return _0x445c8c?{'count':_0x41f079,'rows':_0x445c8c}:null;}})[_0x9ad3('0x24')](respondWithResult(_0x4a45a8,null))[_0x9ad3('0x43')](handleError(_0x4a45a8,null));};exports[_0x9ad3('0x50')]=function(_0x3afe73,_0x59d851,_0x2823f9){return db[_0x9ad3('0x51')]['find']({'where':{'id':_0x3afe73[_0x9ad3('0x48')]['id']}})[_0x9ad3('0x24')](handleEntityNotFound(_0x59d851,null))[_0x9ad3('0x24')](function(_0x118872){if(_0x118872){return _0x118872[_0x9ad3('0x50')](_0x3afe73[_0x9ad3('0x47')][_0x9ad3('0x4a')],_[_0x9ad3('0x4b')](_0x3afe73['body'],['ids','id'])||{});}})[_0x9ad3('0x24')](respondWithResult(_0x59d851,null))[_0x9ad3('0x43')](handleError(_0x59d851,null));};exports['getActions']=function(_0xde190b,_0x49e428,_0x1a76b1){var _0x395524={};var _0x5c5291={};var _0x250f79;var _0x148a21;return db[_0x9ad3('0x3e')][_0x9ad3('0x4d')]({'where':{'id':_0xde190b[_0x9ad3('0x48')]['id']}})[_0x9ad3('0x24')](handleEntityNotFound(_0x49e428,null))['then'](function(_0x500a21){if(_0x500a21){_0x250f79=_0x500a21;_0x5c5291[_0x9ad3('0x2d')]=_['keys'](db[_0x9ad3('0x51')]['rawAttributes']);_0x5c5291['query']=_[_0x9ad3('0x30')](_0xde190b[_0x9ad3('0x2f')]);_0x5c5291[_0x9ad3('0x31')]=_['intersection'](_0x5c5291[_0x9ad3('0x2d')],_0x5c5291[_0x9ad3('0x2f')]);_0x395524[_0x9ad3('0x32')]=_[_0x9ad3('0x33')](_0x5c5291[_0x9ad3('0x2d')],qs[_0x9ad3('0x34')](_0xde190b[_0x9ad3('0x2f')]['fields']));_0x395524[_0x9ad3('0x32')]=_0x395524[_0x9ad3('0x32')]['length']?_0x395524[_0x9ad3('0x32')]:_0x5c5291[_0x9ad3('0x2d')];_0x395524[_0x9ad3('0x38')]=qs['sort'](_0xde190b[_0x9ad3('0x2f')][_0x9ad3('0x39')]);_0x395524[_0x9ad3('0x3a')]=qs[_0x9ad3('0x31')](_[_0x9ad3('0x4f')](_0xde190b[_0x9ad3('0x2f')],_0x5c5291[_0x9ad3('0x31')]));if(_0xde190b[_0x9ad3('0x2f')][_0x9ad3('0x3b')]){_0x395524[_0x9ad3('0x3a')]=_[_0x9ad3('0x3c')](_0x395524[_0x9ad3('0x3a')],{'$or':_[_0x9ad3('0x2e')](_0x395524[_0x9ad3('0x32')],function(_0x582a41){var _0x289087={};_0x289087[_0x582a41]={'$like':'%'+_0xde190b[_0x9ad3('0x2f')][_0x9ad3('0x3b')]+'%'};return _0x289087;})});}_0x395524=_[_0x9ad3('0x3c')]({},_0x395524,_0xde190b[_0x9ad3('0x3d')]);return _0x250f79[_0x9ad3('0x52')](_0x395524);}})[_0x9ad3('0x24')](function(_0x3be346){if(_0x3be346){_0x148a21=_0x3be346['length'];if(!_0xde190b[_0x9ad3('0x2f')][_0x9ad3('0x36')](_0x9ad3('0x37'))){_0x395524[_0x9ad3('0x1d')]=qs[_0x9ad3('0x1d')](_0xde190b['query'][_0x9ad3('0x1d')]);_0x395524[_0x9ad3('0x1b')]=qs['offset'](_0xde190b[_0x9ad3('0x2f')]['offset']);}return _0x250f79['getActions'](_0x395524);}})['then'](function(_0x2b0bcc){if(_0x2b0bcc){return _0x2b0bcc?{'count':_0x148a21,'rows':_0x2b0bcc}:null;}})[_0x9ad3('0x24')](respondWithResult(_0x49e428,null))[_0x9ad3('0x43')](handleError(_0x49e428,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f1acfb6..5dfeedb 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 _0xb621=['request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x162a4e,_0x2997cd){var _0x1ff480=function(_0x4ad45a){while(--_0x4ad45a){_0x162a4e['push'](_0x162a4e['shift']());}};_0x1ff480(++_0x2997cd);}(_0xb621,0x193));var _0x1b62=function(_0x19fcd3,_0x39417b){_0x19fcd3=_0x19fcd3-0x0;var _0xef71f6=_0xb621[_0x19fcd3];return _0xef71f6;};'use strict';var _=require(_0x1b62('0x0'));var util=require('util');var logger=require(_0x1b62('0x1'))(_0x1b62('0x2'));var moment=require(_0x1b62('0x3'));var BPromise=require(_0x1b62('0x4'));var rp=require(_0x1b62('0x5'));var fs=require('fs');var path=require(_0x1b62('0x6'));var rimraf=require(_0x1b62('0x7'));var config=require(_0x1b62('0x8'));var attributes=require(_0x1b62('0x9'));module[_0x1b62('0xa')]=function(_0x45eca4,_0x452b98){return _0x45eca4[_0x1b62('0xb')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf91d=['define','Automation','tools_automations','lodash','../../config/logger','api','path','../../config/environment','exports'];(function(_0x220273,_0x43c85a){var _0x3575bf=function(_0x3c9b94){while(--_0x3c9b94){_0x220273['push'](_0x220273['shift']());}};_0x3575bf(++_0x43c85a);}(_0xf91d,0xd2));var _0xdf91=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf91d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xdf91('0x0'));var util=require('util');var logger=require(_0xdf91('0x1'))(_0xdf91('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf91('0x3'));var rimraf=require('rimraf');var config=require(_0xdf91('0x4'));var attributes=require('./automation.attributes');module[_0xdf91('0x5')]=function(_0x5d4bc0,_0x4d6693){return _0x5d4bc0[_0xdf91('0x6')](_0xdf91('0x7'),attributes,{'tableName':_0xdf91('0x8'),'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 a533fab..8aabedf 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 _0x82d8=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/environment'];(function(_0x5e0bbe,_0x21e501){var _0x8f8324=function(_0x4f5e5c){while(--_0x4f5e5c){_0x5e0bbe['push'](_0x5e0bbe['shift']());}};_0x8f8324(++_0x21e501);}(_0x82d8,0xff));var _0x882d=function(_0x11035b,_0x221017){_0x11035b=_0x11035b-0x0;var _0x447ce6=_0x82d8[_0x11035b];return _0x447ce6;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var moment=require(_0x882d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x882d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x882d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x882d('0x4'));var jayson=require(_0x882d('0x5'));var client=jayson[_0x882d('0x6')][_0x882d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb7539b,_0x3c8b67,_0x4067a9){return new BPromise(function(_0x4ea710,_0x4035ba){return client[_0x882d('0x8')](_0xb7539b,_0x4067a9)[_0x882d('0x9')](function(_0x4da4aa){logger[_0x882d('0xa')](_0x882d('0xb'),_0x3c8b67,'request\x20sent');logger[_0x882d('0xc')](_0x882d('0xd'),_0x3c8b67,_0x882d('0xe'),JSON['stringify'](_0x4da4aa));if(_0x4da4aa[_0x882d('0xf')]){if(_0x4da4aa[_0x882d('0xf')][_0x882d('0x10')]===0x1f4){logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x4da4aa[_0x882d('0xf')][_0x882d('0x11')]);return _0x4035ba(_0x4da4aa['error']['message']);}logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x4da4aa[_0x882d('0xf')][_0x882d('0x11')]);return _0x4ea710(_0x4da4aa[_0x882d('0xf')]['message']);}else{logger[_0x882d('0xa')](_0x882d('0xb'),_0x3c8b67,_0x882d('0xe'));_0x4ea710(_0x4da4aa[_0x882d('0x12')][_0x882d('0x11')]);}})[_0x882d('0x13')](function(_0x46cfcc){logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x46cfcc);_0x4035ba(_0x46cfcc);});});} \ No newline at end of file +var _0xc6a2=['info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x550a61,_0x1c5d8c){var _0x248bfc=function(_0x38d79e){while(--_0x38d79e){_0x550a61['push'](_0x550a61['shift']());}};_0x248bfc(++_0x1c5d8c);}(_0xc6a2,0x69));var _0x2c6a=function(_0x5e5f22,_0x24f7f1){_0x5e5f22=_0x5e5f22-0x0;var _0x343c09=_0xc6a2[_0x5e5f22];return _0x343c09;};'use strict';var _=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var moment=require('moment');var BPromise=require(_0x2c6a('0x2'));var rs=require(_0x2c6a('0x3'));var fs=require('fs');var Redis=require(_0x2c6a('0x4'));var db=require(_0x2c6a('0x5'))['db'];var utils=require(_0x2c6a('0x6'));var logger=require(_0x2c6a('0x7'))(_0x2c6a('0x8'));var config=require(_0x2c6a('0x9'));var jayson=require(_0x2c6a('0xa'));var client=jayson[_0x2c6a('0xb')][_0x2c6a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33cdf9,_0x9c5133,_0x2b006a){return new BPromise(function(_0x4e45fa,_0x36f800){return client[_0x2c6a('0xd')](_0x33cdf9,_0x2b006a)[_0x2c6a('0xe')](function(_0x2290ed){logger[_0x2c6a('0xf')](_0x2c6a('0x10'),_0x9c5133,_0x2c6a('0x11'));logger[_0x2c6a('0x12')]('Automation,\x20%s,\x20%s,\x20%s',_0x9c5133,'request\x20sent',JSON[_0x2c6a('0x13')](_0x2290ed));if(_0x2290ed[_0x2c6a('0x14')]){if(_0x2290ed[_0x2c6a('0x14')][_0x2c6a('0x15')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x9c5133,_0x2290ed[_0x2c6a('0x14')][_0x2c6a('0x16')]);return _0x36f800(_0x2290ed[_0x2c6a('0x14')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x9c5133,_0x2290ed[_0x2c6a('0x14')][_0x2c6a('0x16')]);return _0x4e45fa(_0x2290ed[_0x2c6a('0x14')][_0x2c6a('0x16')]);}else{logger[_0x2c6a('0xf')](_0x2c6a('0x10'),_0x9c5133,_0x2c6a('0x11'));_0x4e45fa(_0x2290ed[_0x2c6a('0x17')][_0x2c6a('0x16')]);}})['catch'](function(_0x41f830){logger[_0x2c6a('0x14')]('Automation,\x20%s,\x20%s',_0x9c5133,_0x41f830);_0x36f800(_0x41f830);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f9ecc47..b4cb0e1 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 _0x374f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1d570a,_0xdabdba){var _0x3a0b6f=function(_0x95137c){while(--_0x95137c){_0x1d570a['push'](_0x1d570a['shift']());}};_0x3a0b6f(++_0xdabdba);}(_0x374f,0x13f));var _0xf374=function(_0x10fb42,_0x509f02){_0x10fb42=_0x10fb42-0x0;var _0xf07b84=_0x374f[_0x10fb42];return _0xf07b84;};'use strict';var multer=require(_0xf374('0x0'));var util=require(_0xf374('0x1'));var path=require('path');var timeout=require(_0xf374('0x2'));var express=require(_0xf374('0x3'));var router=express[_0xf374('0x4')]();var fs_extra=require(_0xf374('0x5'));var auth=require(_0xf374('0x6'));var interaction=require(_0xf374('0x7'));var config=require(_0xf374('0x8'));var controller=require(_0xf374('0x9'));router[_0xf374('0xa')]('/',auth[_0xf374('0xb')](),controller[_0xf374('0xc')]);router[_0xf374('0xa')](_0xf374('0xd'),auth[_0xf374('0xb')](),controller[_0xf374('0xe')]);router[_0xf374('0xa')]('/:id/conditions',auth[_0xf374('0xb')](),controller[_0xf374('0xf')]);router[_0xf374('0xa')](_0xf374('0x10'),auth['isAuthenticated'](),controller[_0xf374('0x11')]);router[_0xf374('0x12')]('/',auth[_0xf374('0xb')](),controller[_0xf374('0x13')]);router[_0xf374('0x12')](_0xf374('0x14'),auth[_0xf374('0xb')](),controller[_0xf374('0x15')]);router[_0xf374('0x12')](_0xf374('0x10'),auth[_0xf374('0xb')](),controller[_0xf374('0x16')]);router['put'](_0xf374('0xd'),auth[_0xf374('0xb')](),controller[_0xf374('0x17')]);router[_0xf374('0x18')](_0xf374('0xd'),auth['isAuthenticated'](),controller[_0xf374('0x19')]);module[_0xf374('0x1a')]=router; \ No newline at end of file +var _0x20ad=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete'];(function(_0x39ee87,_0x3c1d80){var _0x16bf6c=function(_0x1e0697){while(--_0x1e0697){_0x39ee87['push'](_0x39ee87['shift']());}};_0x16bf6c(++_0x3c1d80);}(_0x20ad,0x13a));var _0xd20a=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x20ad[_0x28d18d];return _0x470640;};'use strict';var multer=require(_0xd20a('0x0'));var util=require(_0xd20a('0x1'));var path=require(_0xd20a('0x2'));var timeout=require(_0xd20a('0x3'));var express=require('express');var router=express[_0xd20a('0x4')]();var fs_extra=require(_0xd20a('0x5'));var auth=require(_0xd20a('0x6'));var interaction=require(_0xd20a('0x7'));var config=require(_0xd20a('0x8'));var controller=require(_0xd20a('0x9'));router[_0xd20a('0xa')]('/',auth[_0xd20a('0xb')](),controller[_0xd20a('0xc')]);router['get'](_0xd20a('0xd'),auth[_0xd20a('0xb')](),controller['show']);router[_0xd20a('0xa')](_0xd20a('0xe'),auth[_0xd20a('0xb')](),controller[_0xd20a('0xf')]);router[_0xd20a('0xa')](_0xd20a('0x10'),auth[_0xd20a('0xb')](),controller[_0xd20a('0x11')]);router['post']('/',auth[_0xd20a('0xb')](),controller['create']);router[_0xd20a('0x12')]('/:id/conditions',auth[_0xd20a('0xb')](),controller[_0xd20a('0x13')]);router[_0xd20a('0x12')](_0xd20a('0x10'),auth[_0xd20a('0xb')](),controller[_0xd20a('0x14')]);router[_0xd20a('0x15')](_0xd20a('0xd'),auth['isAuthenticated'](),controller[_0xd20a('0x16')]);router[_0xd20a('0x17')](_0xd20a('0xd'),auth['isAuthenticated'](),controller[_0xd20a('0x18')]);module[_0xd20a('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 04dbf71..2ff47f0 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 _0x4219=['INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4219,0xdc));var _0x9421=function(_0x5ba7d3,_0x27f561){_0x5ba7d3=_0x5ba7d3-0x0;var _0x32285a=_0x4219[_0x5ba7d3];return _0x32285a;};'use strict';var Sequelize=require(_0x9421('0x0'));module[_0x9421('0x1')]={'name':{'type':Sequelize[_0x9421('0x2')],'unique':_0x9421('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9421('0x4')](_0x9421('0x5')),'allowNull':![],'defaultValue':_0x9421('0x5')},'description':{'type':Sequelize[_0x9421('0x2')]},'active':{'type':Sequelize[_0x9421('0x6')],'defaultValue':0x0,'comment':_0x9421('0x7')},'limitCalls':{'type':Sequelize[_0x9421('0x8')](0x4)[_0x9421('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9421('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9421('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9421('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9421('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9421('0x8')](0x5)[_0x9421('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9421('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9421('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9421('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9421('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'comment':_0x9421('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9421('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9421('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9421('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9421('0x11')},'dialTimezone':{'type':Sequelize[_0x9421('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9421('0x2')],'defaultValue':_0x9421('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x9421('0x4')](_0x9421('0x13'),_0x9421('0x14'),_0x9421('0x15')),'defaultValue':_0x9421('0x13')},'dialAMDActive':{'type':Sequelize[_0x9421('0x6')],'defaultValue':0x0,'comment':_0x9421('0x16')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9421('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9421('0x17')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9421('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9421('0x8')](0x9)[_0x9421('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9421('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9421('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9421('0x8')](0x9)[_0x9421('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9421('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9421('0x8')](0x9)[_0x9421('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9421('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9421('0x8')](0x9)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9421('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9421('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9421('0x8')](0x9)[_0x9421('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x9421('0x4')](_0x9421('0x1c'),_0x9421('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x9421('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9421('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9421('0x1e')},'dialCutDigit':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9421('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9421('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9421('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9421('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x9421('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9421('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9421('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9421('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9421('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9421('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9421('0x8')](0x3)[_0x9421('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9421('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9421('0x8')](0x5)[_0x9421('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xd08d=['#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,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','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)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xd08d,0x81));var _0xdd08=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xd08d[_0x557fd2];return _0x1b54a2;};'use strict';var Sequelize=require('sequelize');module[_0xdd08('0x0')]={'name':{'type':Sequelize[_0xdd08('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xdd08('0x2')](_0xdd08('0x3')),'allowNull':![],'defaultValue':_0xdd08('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xdd08('0x4')],'defaultValue':0x0,'comment':_0xdd08('0x5')},'limitCalls':{'type':Sequelize[_0xdd08('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdd08('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdd08('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdd08('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd08('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdd08('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd08('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd08('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdd08('0x6')](0x5)[_0xdd08('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd08('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'comment':_0xdd08('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdd08('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd08('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdd08('0xf')},'dialTimezone':{'type':Sequelize[_0xdd08('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdd08('0x1')],'defaultValue':_0xdd08('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xdd08('0x2')](_0xdd08('0x11'),_0xdd08('0x12'),_0xdd08('0x13')),'defaultValue':_0xdd08('0x11')},'dialAMDActive':{'type':Sequelize[_0xdd08('0x4')],'defaultValue':0x0,'comment':_0xdd08('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xdd08('0x6')](0x9)[_0xdd08('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdd08('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xdd08('0x6')](0x9)[_0xdd08('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdd08('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdd08('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdd08('0x6')](0x9)[_0xdd08('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd08('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdd08('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdd08('0x6')](0x9)[_0xdd08('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdd08('0x6')](0x9)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdd08('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdd08('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdd08('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd08('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdd08('0x2')]('DESC','ASC'),'defaultValue':_0xdd08('0x1b')},'dialPrefix':{'type':Sequelize[_0xdd08('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdd08('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd08('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd08('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd08('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xdd08('0x6')](0x5)[_0xdd08('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd08('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdd08('0x6')](0x5)[_0xdd08('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd08('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdd08('0x6')](0x5)[_0xdd08('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd08('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdd08('0x6')](0x3)[_0xdd08('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd08('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdd08('0x6')](0x5)[_0xdd08('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9722101..e562e6e 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 _0x462e=['CampaignId\x20=\x20?','into','fromQuery','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','json','apply','reject','then','destroy','get','IvrCampaigns','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','map','VIRTUAL','options','Campaign','includeAll','include','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','autoAssociation','update','CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','findOne','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','cm_hopper','scheduledAt','ContactId','ListId','select','phone','NOW()','field','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)'];(function(_0x11e2b0,_0x386c82){var _0x1b9672=function(_0x51096d){while(--_0x51096d){_0x11e2b0['push'](_0x11e2b0['shift']());}};_0x1b9672(++_0x386c82);}(_0x462e,0x13c));var _0xe462=function(_0x109383,_0x25a0a0){_0x109383=_0x109383-0x0;var _0x5ac0f6=_0x462e[_0x109383];return _0x5ac0f6;};'use strict';var emlformat=require(_0xe462('0x0'));var rimraf=require(_0xe462('0x1'));var zipdir=require(_0xe462('0x2'));var jsonpatch=require(_0xe462('0x3'));var rp=require(_0xe462('0x4'));var moment=require('moment');var BPromise=require(_0xe462('0x5'));var Mustache=require(_0xe462('0x6'));var util=require(_0xe462('0x7'));var path=require(_0xe462('0x8'));var sox=require('sox');var csv=require(_0xe462('0x9'));var ejs=require(_0xe462('0xa'));var fs=require('fs');var fs_extra=require(_0xe462('0xb'));var _=require(_0xe462('0xc'));var squel=require(_0xe462('0xd'));var crypto=require('crypto');var jsforce=require(_0xe462('0xe'));var deskjs=require(_0xe462('0xf'));var toCsv=require(_0xe462('0x9'));var querystring=require(_0xe462('0x10'));var Papa=require('papaparse');var Redis=require(_0xe462('0x11'));var authService=require(_0xe462('0x12'));var qs=require(_0xe462('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe462('0x14'));var logger=require(_0xe462('0x15'))(_0xe462('0x16'));var utils=require('../../config/utils');var config=require(_0xe462('0x17'));var licenseUtil=require(_0xe462('0x18'));var db=require(_0xe462('0x19'))['db'];function respondWithStatusCode(_0x4f42c0,_0x1aa938){_0x1aa938=_0x1aa938||0xcc;return function(_0x5925ef){if(_0x5925ef){return _0x4f42c0[_0xe462('0x1a')](_0x1aa938);}return _0x4f42c0['status'](_0x1aa938)[_0xe462('0x1b')]();};}function respondWithResult(_0xe793eb,_0x11af0d){_0x11af0d=_0x11af0d||0xc8;return function(_0x50b70b){if(_0x50b70b){return _0xe793eb[_0xe462('0x1c')](_0x11af0d)['json'](_0x50b70b);}};}function respondWithFilteredResult(_0x305610,_0x528969){return function(_0x20ee82){if(_0x20ee82){var _0x48eefb=typeof _0x528969['offset']===_0xe462('0x1d')&&typeof _0x528969['limit']===_0xe462('0x1d');var _0x532f25=_0x20ee82[_0xe462('0x1e')];var _0x114dbc=_0x48eefb?0x0:_0x528969[_0xe462('0x1f')];var _0x1283f0=_0x48eefb?_0x20ee82[_0xe462('0x1e')]:_0x528969['offset']+_0x528969['limit'];var _0x22aab9;if(_0x1283f0>=_0x532f25){_0x1283f0=_0x532f25;_0x22aab9=0xc8;}else{_0x22aab9=0xce;}_0x305610[_0xe462('0x1c')](_0x22aab9);return _0x305610['set']('Content-Range',_0x114dbc+'-'+_0x1283f0+'/'+_0x532f25)[_0xe462('0x20')](_0x20ee82);}return null;};}function patchUpdates(_0x5eb4e7){return function(_0x37c5b9){try{jsonpatch[_0xe462('0x21')](_0x37c5b9,_0x5eb4e7,!![]);}catch(_0x5b1166){return BPromise[_0xe462('0x22')](_0x5b1166);}return _0x37c5b9['save']();};}function saveUpdates(_0x3983cc,_0x4a8ec4){return function(_0x43bf72){if(_0x43bf72){return _0x43bf72['update'](_0x3983cc)[_0xe462('0x23')](function(_0x1d015f){return _0x1d015f;});}return null;};}function removeEntity(_0x2f0142,_0x4a16e6){return function(_0x5c605b){if(_0x5c605b){return _0x5c605b[_0xe462('0x24')]()['then'](function(){var _0x51a128=_0x5c605b[_0xe462('0x25')]({'plain':!![]});var _0x464d71=_0xe462('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x464d71,'resourceId':_0x51a128['id']}})['then'](function(){return _0x5c605b;});})[_0xe462('0x23')](function(){_0x2f0142['status'](0xcc)[_0xe462('0x1b')]();});}};}function handleEntityNotFound(_0x381153,_0x5a2808){return function(_0x186b6a){if(!_0x186b6a){_0x381153[_0xe462('0x1a')](0x194);}return _0x186b6a;};}function handleError(_0x35cb55,_0x14e2c7){_0x14e2c7=_0x14e2c7||0x1f4;return function(_0x1e4207){logger['error'](_0x1e4207[_0xe462('0x27')]);if(_0x1e4207['name']){delete _0x1e4207[_0xe462('0x28')];}_0x35cb55[_0xe462('0x1c')](_0x14e2c7)[_0xe462('0x29')](_0x1e4207);};}exports['index']=function(_0x2cf110,_0x2d9285){var _0x548120={},_0x412eb3={},_0x437c29={'count':0x0,'rows':[]};var _0x5110af=_['map'](db['Campaign'][_0xe462('0x2a')],function(_0x152603){return{'name':_0x152603[_0xe462('0x2b')],'type':_0x152603[_0xe462('0x2c')][_0xe462('0x2d')]};});_0x412eb3[_0xe462('0x2e')]=_['map'](_0x5110af,_0xe462('0x28'));_0x412eb3[_0xe462('0x2f')]=_['keys'](_0x2cf110[_0xe462('0x2f')]);_0x412eb3[_0xe462('0x30')]=_[_0xe462('0x31')](_0x412eb3[_0xe462('0x2e')],_0x412eb3['query']);_0x548120[_0xe462('0x32')]=_[_0xe462('0x31')](_0x412eb3['model'],qs[_0xe462('0x33')](_0x2cf110[_0xe462('0x2f')][_0xe462('0x33')]));_0x548120['attributes']=_0x548120[_0xe462('0x32')][_0xe462('0x34')]?_0x548120[_0xe462('0x32')]:_0x412eb3['model'];if(!_0x2cf110[_0xe462('0x2f')]['hasOwnProperty'](_0xe462('0x35'))){_0x548120['limit']=qs['limit'](_0x2cf110[_0xe462('0x2f')][_0xe462('0x36')]);_0x548120[_0xe462('0x1f')]=qs[_0xe462('0x1f')](_0x2cf110[_0xe462('0x2f')][_0xe462('0x1f')]);}_0x548120[_0xe462('0x37')]=qs['sort'](_0x2cf110[_0xe462('0x2f')][_0xe462('0x38')]);_0x548120[_0xe462('0x39')]=qs[_0xe462('0x30')](_['pick'](_0x2cf110[_0xe462('0x2f')],_0x412eb3[_0xe462('0x30')]),_0x5110af);if(_0x2cf110[_0xe462('0x2f')][_0xe462('0x3a')]){_0x548120[_0xe462('0x39')]=_[_0xe462('0x3b')](_0x548120[_0xe462('0x39')],{'$or':_[_0xe462('0x3c')](_0x5110af,function(_0x548972){if(_0x548972[_0xe462('0x2c')]!==_0xe462('0x3d')){var _0x410800={};_0x410800[_0x548972['name']]={'$like':'%'+_0x2cf110[_0xe462('0x2f')][_0xe462('0x3a')]+'%'};return _0x410800;}})});}_0x548120=_[_0xe462('0x3b')]({},_0x548120,_0x2cf110[_0xe462('0x3e')]);var _0x4aaaf8={'where':_0x548120[_0xe462('0x39')]};return db[_0xe462('0x3f')][_0xe462('0x1e')](_0x4aaaf8)[_0xe462('0x23')](function(_0xe517eb){_0x437c29[_0xe462('0x1e')]=_0xe517eb;if(_0x2cf110[_0xe462('0x2f')][_0xe462('0x40')]){_0x548120[_0xe462('0x41')]=[{'all':!![]}];}return db[_0xe462('0x3f')]['findAll'](_0x548120);})[_0xe462('0x23')](function(_0x375a91){_0x437c29[_0xe462('0x42')]=_0x375a91;return _0x437c29;})['then'](respondWithFilteredResult(_0x2d9285,_0x548120))[_0xe462('0x43')](handleError(_0x2d9285,null));};exports[_0xe462('0x44')]=function(_0x4b077f,_0x1d1829){var _0x5ec81b={'raw':![],'where':{'id':_0x4b077f['params']['id']}},_0x32267c={};_0x32267c[_0xe462('0x2e')]=_['keys'](db['Campaign'][_0xe462('0x2a')]);_0x32267c[_0xe462('0x2f')]=_[_0xe462('0x45')](_0x4b077f[_0xe462('0x2f')]);_0x32267c['filters']=_['intersection'](_0x32267c[_0xe462('0x2e')],_0x32267c[_0xe462('0x2f')]);_0x5ec81b['attributes']=_['intersection'](_0x32267c[_0xe462('0x2e')],qs['fields'](_0x4b077f[_0xe462('0x2f')][_0xe462('0x33')]));_0x5ec81b[_0xe462('0x32')]=_0x5ec81b[_0xe462('0x32')]['length']?_0x5ec81b['attributes']:_0x32267c['model'];if(_0x4b077f['query'][_0xe462('0x40')]){_0x5ec81b[_0xe462('0x41')]=[{'all':!![]}];}_0x5ec81b=_[_0xe462('0x3b')]({},_0x5ec81b,_0x4b077f['options']);return db['Campaign']['find'](_0x5ec81b)[_0xe462('0x23')](handleEntityNotFound(_0x1d1829,null))[_0xe462('0x23')](respondWithResult(_0x1d1829,null))[_0xe462('0x43')](handleError(_0x1d1829,null));};exports[_0xe462('0x46')]=function(_0x5c767d,_0x1dac7f){return db['Campaign'][_0xe462('0x46')](_0x5c767d[_0xe462('0x47')],{})[_0xe462('0x23')](function(_0x528b6a){var _0x5cb384=_0x5c767d[_0xe462('0x48')][_0xe462('0x25')]({'plain':!![]});if(!_0x5cb384)throw new Error(_0xe462('0x49'));if(_0x5cb384[_0xe462('0x4a')]===_0xe462('0x48')){var _0x95b08f=_0x528b6a[_0xe462('0x25')]({'plain':!![]});var _0x51d323=_0xe462('0x26');return db[_0xe462('0x4b')][_0xe462('0x4c')]({'where':{'name':_0x51d323,'userProfileId':_0x5cb384[_0xe462('0x4d')]},'raw':!![]})['then'](function(_0x4bb9f9){if(_0x4bb9f9&&_0x4bb9f9['autoAssociation']===0x0){return db[_0xe462('0x4e')][_0xe462('0x46')]({'name':_0x95b08f[_0xe462('0x28')],'resourceId':_0x95b08f['id'],'type':_0x4bb9f9['name'],'sectionId':_0x4bb9f9['id']},{})[_0xe462('0x23')](function(){return _0x528b6a;});}else{return _0x528b6a;}})[_0xe462('0x43')](function(_0x33b5da){logger[_0xe462('0x4f')](_0xe462('0x50'),_0x33b5da);throw _0x33b5da;});}return _0x528b6a;})[_0xe462('0x23')](respondWithResult(_0x1dac7f,0xc9))['catch'](handleError(_0x1dac7f,null));};exports[_0xe462('0x51')]=function(_0x51d7c6,_0x4c4f16){var _0x68278a={'where':{'id':_0x51d7c6[_0xe462('0x52')]['id']}},_0x4a0bc9={};_0x4a0bc9['model']=_[_0xe462('0x45')](db[_0xe462('0x3f')][_0xe462('0x2a')]);_0x68278a[_0xe462('0x32')]=_[_0xe462('0x31')](_0x4a0bc9['model'],qs[_0xe462('0x33')](_0x51d7c6[_0xe462('0x2f')]['fields']));_0x68278a[_0xe462('0x32')]=_0x68278a[_0xe462('0x32')][_0xe462('0x34')]?_0x68278a['attributes']:_0x4a0bc9[_0xe462('0x2e')];if(_0x51d7c6['query'][_0xe462('0x40')]){_0x68278a[_0xe462('0x41')]=[{'all':!![]}];}_0x68278a=_[_0xe462('0x3b')]({},_0x68278a,_0x51d7c6[_0xe462('0x3e')]);return db[_0xe462('0x3f')][_0xe462('0x4c')](_0x68278a)[_0xe462('0x23')](handleEntityNotFound(_0x4c4f16,null))[_0xe462('0x23')](function(_0x2093d5){if(_0x2093d5){var _0x20a3d8=_0x2093d5['get']({'plain':!![]});_0x20a3d8=qs['omit'](_0x20a3d8,['id',_0xe462('0x53'),_0xe462('0x54')]);_0x51d7c6['body']=_[_0xe462('0x55')](_0x51d7c6[_0xe462('0x47')],['id','createdAt',_0xe462('0x54')]);return db[_0xe462('0x3f')]['create'](_[_0xe462('0x3b')](_0x20a3d8,_0x51d7c6[_0xe462('0x47')]),{'include':_0x51d7c6[_0xe462('0x2f')][_0xe462('0x40')]?[{'all':!![]}]:undefined})[_0xe462('0x23')](function(_0x33e8f1){var _0x532091=_0x51d7c6['user']['get']({'plain':!![]});if(!_0x532091)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x532091[_0xe462('0x4a')]===_0xe462('0x48')){var _0x2bec46=_0x33e8f1[_0xe462('0x25')]({'plain':!![]});var _0x186b22=_0xe462('0x26');return db[_0xe462('0x4b')]['find']({'where':{'name':_0x186b22,'userProfileId':_0x532091[_0xe462('0x4d')]},'raw':!![]})['then'](function(_0x50c80c){if(_0x50c80c&&_0x50c80c[_0xe462('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x2bec46[_0xe462('0x28')],'resourceId':_0x2bec46['id'],'type':_0x50c80c['name'],'sectionId':_0x50c80c['id']},{})[_0xe462('0x23')](function(){return _0x33e8f1;});}else{return _0x33e8f1;}})[_0xe462('0x43')](function(_0x4fe258){logger[_0xe462('0x4f')](_0xe462('0x50'),_0x4fe258);throw _0x4fe258;});}return _0x33e8f1;});}})[_0xe462('0x23')](respondWithResult(_0x4c4f16,0xc9))['catch'](handleError(_0x4c4f16,null));};exports[_0xe462('0x57')]=function(_0xb70a2c,_0x2b6cb3){if(_0xb70a2c[_0xe462('0x47')]['id']){delete _0xb70a2c[_0xe462('0x47')]['id'];}return db['Campaign']['find']({'where':{'id':_0xb70a2c[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x2b6cb3,null))[_0xe462('0x23')](saveUpdates(_0xb70a2c['body'],null))[_0xe462('0x23')](respondWithResult(_0x2b6cb3,null))[_0xe462('0x43')](handleError(_0x2b6cb3,null));};exports[_0xe462('0x24')]=function(_0x4d9126,_0xd5ab6f){return db[_0xe462('0x3f')][_0xe462('0x4c')]({'where':{'id':_0x4d9126['params']['id']}})[_0xe462('0x23')](handleEntityNotFound(_0xd5ab6f,null))[_0xe462('0x23')](removeEntity(_0xd5ab6f,null))[_0xe462('0x43')](handleError(_0xd5ab6f,null));};exports['getHoppers']=function(_0x1806e7,_0x31109a,_0x17dedf){var _0xd09306={'raw':!![],'where':{}};var _0x5f4c1d={};var _0x2a48d0={'count':0x0,'rows':[]};return db[_0xe462('0x3f')]['findOne']({'where':{'id':_0x1806e7[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x31109a,null))[_0xe462('0x23')](function(_0x14c59e){if(_0x14c59e){_0x5f4c1d[_0xe462('0x2e')]=_[_0xe462('0x45')](db[_0xe462('0x58')][_0xe462('0x2a')]);_0x5f4c1d['query']=_[_0xe462('0x45')](_0x1806e7[_0xe462('0x2f')]);_0x5f4c1d[_0xe462('0x30')]=_['intersection'](_0x5f4c1d[_0xe462('0x2e')],_0x5f4c1d[_0xe462('0x2f')]);_0xd09306['attributes']=_[_0xe462('0x31')](_0x5f4c1d[_0xe462('0x2e')],qs[_0xe462('0x33')](_0x1806e7[_0xe462('0x2f')][_0xe462('0x33')]));_0xd09306['attributes']=_0xd09306[_0xe462('0x32')]['length']?_0xd09306['attributes']:_0x5f4c1d['model'];if(!_0x1806e7[_0xe462('0x2f')][_0xe462('0x59')](_0xe462('0x35'))){_0xd09306[_0xe462('0x36')]=qs[_0xe462('0x36')](_0x1806e7['query'][_0xe462('0x36')]);_0xd09306[_0xe462('0x1f')]=qs['offset'](_0x1806e7['query']['offset']);}_0xd09306[_0xe462('0x37')]=qs[_0xe462('0x38')](_0x1806e7[_0xe462('0x2f')][_0xe462('0x38')]);_0xd09306[_0xe462('0x39')]=qs[_0xe462('0x30')](_['pick'](_0x1806e7[_0xe462('0x2f')],_0x5f4c1d[_0xe462('0x30')]));_0xd09306[_0xe462('0x39')][_0xe462('0x5a')]=_0x14c59e['id'];if(_0x1806e7[_0xe462('0x2f')][_0xe462('0x3a')]){_0xd09306[_0xe462('0x39')]=_['merge'](_0xd09306[_0xe462('0x39')],{'$or':_[_0xe462('0x3c')](_0xd09306[_0xe462('0x32')],function(_0x3d2be8){var _0x2976a7={};_0x2976a7[_0x3d2be8]={'$like':'%'+_0x1806e7[_0xe462('0x2f')][_0xe462('0x3a')]+'%'};return _0x2976a7;})});}_0xd09306=_['merge']({},_0xd09306,_0x1806e7[_0xe462('0x3e')]);return db[_0xe462('0x58')][_0xe462('0x1e')]({'where':_0xd09306[_0xe462('0x39')]})[_0xe462('0x23')](function(_0x1a412a){_0x2a48d0['count']=_0x1a412a;if(_0x1806e7['query']['includeAll']){_0xd09306['include']=[{'all':!![]}];}return db[_0xe462('0x58')][_0xe462('0x5b')](_0xd09306);})[_0xe462('0x23')](function(_0x4e98af){_0x2a48d0[_0xe462('0x42')]=_0x4e98af;return _0x2a48d0;});}})['then'](respondWithFilteredResult(_0x31109a,_0xd09306))[_0xe462('0x43')](handleError(_0x31109a,null));};exports[_0xe462('0x5c')]=function(_0xcc7e25,_0x2d0965,_0x5a1198){var _0x49f92e={'raw':!![],'where':{}};var _0x3fd1d0={};var _0x3c6de2={'count':0x0,'rows':[]};return db['Campaign'][_0xe462('0x5d')]({'where':{'id':_0xcc7e25['params']['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x2d0965,null))[_0xe462('0x23')](function(_0x3d941d){if(_0x3d941d){_0x3fd1d0[_0xe462('0x2e')]=_['keys'](db[_0xe462('0x5e')][_0xe462('0x2a')]);_0x3fd1d0[_0xe462('0x2f')]=_['keys'](_0xcc7e25[_0xe462('0x2f')]);_0x3fd1d0[_0xe462('0x30')]=_['intersection'](_0x3fd1d0[_0xe462('0x2e')],_0x3fd1d0[_0xe462('0x2f')]);_0x49f92e['attributes']=_[_0xe462('0x31')](_0x3fd1d0['model'],qs[_0xe462('0x33')](_0xcc7e25[_0xe462('0x2f')][_0xe462('0x33')]));_0x49f92e[_0xe462('0x32')]=_0x49f92e[_0xe462('0x32')]['length']?_0x49f92e[_0xe462('0x32')]:_0x3fd1d0['model'];if(!_0xcc7e25[_0xe462('0x2f')]['hasOwnProperty']('nolimit')){_0x49f92e['limit']=qs[_0xe462('0x36')](_0xcc7e25[_0xe462('0x2f')][_0xe462('0x36')]);_0x49f92e[_0xe462('0x1f')]=qs[_0xe462('0x1f')](_0xcc7e25['query'][_0xe462('0x1f')]);}_0x49f92e[_0xe462('0x37')]=qs[_0xe462('0x38')](_0xcc7e25[_0xe462('0x2f')][_0xe462('0x38')]);_0x49f92e[_0xe462('0x39')]=qs[_0xe462('0x30')](_[_0xe462('0x5f')](_0xcc7e25[_0xe462('0x2f')],_0x3fd1d0[_0xe462('0x30')]));_0x49f92e['where'][_0xe462('0x5a')]=_0x3d941d['id'];if(_0xcc7e25[_0xe462('0x2f')][_0xe462('0x3a')]){_0x49f92e[_0xe462('0x39')]=_[_0xe462('0x3b')](_0x49f92e[_0xe462('0x39')],{'$or':_[_0xe462('0x3c')](_0x49f92e[_0xe462('0x32')],function(_0x627e1c){var _0xf8f944={};_0xf8f944[_0x627e1c]={'$like':'%'+_0xcc7e25[_0xe462('0x2f')][_0xe462('0x3a')]+'%'};return _0xf8f944;})});}_0x49f92e=_[_0xe462('0x3b')]({},_0x49f92e,_0xcc7e25['options']);return db[_0xe462('0x5e')]['count']({'where':_0x49f92e['where']})[_0xe462('0x23')](function(_0x4c926c){_0x3c6de2[_0xe462('0x1e')]=_0x4c926c;if(_0xcc7e25['query'][_0xe462('0x40')]){_0x49f92e[_0xe462('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe462('0x5b')](_0x49f92e);})[_0xe462('0x23')](function(_0x169797){_0x3c6de2[_0xe462('0x42')]=_0x169797;return _0x3c6de2;});}})[_0xe462('0x23')](respondWithFilteredResult(_0x2d0965,_0x49f92e))['catch'](handleError(_0x2d0965,null));};exports[_0xe462('0x60')]=function(_0x2f6ce6,_0x49c5a3,_0x48d53c){var _0x3d1fb2={'raw':!![],'where':{}};var _0x56bcc6={};var _0x419843={'count':0x0,'rows':[]};return db[_0xe462('0x3f')]['findOne']({'where':{'id':_0x2f6ce6[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x49c5a3,null))[_0xe462('0x23')](function(_0x1bbe4d){if(_0x1bbe4d){_0x56bcc6[_0xe462('0x2e')]=_[_0xe462('0x45')](db[_0xe462('0x61')][_0xe462('0x2a')]);_0x56bcc6['query']=_[_0xe462('0x45')](_0x2f6ce6[_0xe462('0x2f')]);_0x56bcc6[_0xe462('0x30')]=_[_0xe462('0x31')](_0x56bcc6[_0xe462('0x2e')],_0x56bcc6[_0xe462('0x2f')]);_0x3d1fb2[_0xe462('0x32')]=_['intersection'](_0x56bcc6[_0xe462('0x2e')],qs[_0xe462('0x33')](_0x2f6ce6[_0xe462('0x2f')][_0xe462('0x33')]));_0x3d1fb2[_0xe462('0x32')]=_0x3d1fb2[_0xe462('0x32')]['length']?_0x3d1fb2[_0xe462('0x32')]:_0x56bcc6[_0xe462('0x2e')];if(!_0x2f6ce6[_0xe462('0x2f')][_0xe462('0x59')](_0xe462('0x35'))){_0x3d1fb2[_0xe462('0x36')]=qs['limit'](_0x2f6ce6[_0xe462('0x2f')][_0xe462('0x36')]);_0x3d1fb2[_0xe462('0x1f')]=qs[_0xe462('0x1f')](_0x2f6ce6['query']['offset']);}_0x3d1fb2[_0xe462('0x37')]=qs[_0xe462('0x38')](_0x2f6ce6[_0xe462('0x2f')][_0xe462('0x38')]);_0x3d1fb2[_0xe462('0x39')]=qs[_0xe462('0x30')](_[_0xe462('0x5f')](_0x2f6ce6[_0xe462('0x2f')],_0x56bcc6[_0xe462('0x30')]));_0x3d1fb2[_0xe462('0x39')][_0xe462('0x5a')]=_0x1bbe4d['id'];if(_0x2f6ce6[_0xe462('0x2f')][_0xe462('0x3a')]){_0x3d1fb2[_0xe462('0x39')]=_[_0xe462('0x3b')](_0x3d1fb2['where'],{'$or':_[_0xe462('0x3c')](_0x3d1fb2['attributes'],function(_0x2e90a4){var _0x2a4370={};_0x2a4370[_0x2e90a4]={'$like':'%'+_0x2f6ce6[_0xe462('0x2f')]['filter']+'%'};return _0x2a4370;})});}_0x3d1fb2=_[_0xe462('0x3b')]({},_0x3d1fb2,_0x2f6ce6['options']);return db['CmHopperFinal']['count']({'where':_0x3d1fb2[_0xe462('0x39')]})['then'](function(_0x1bcd02){_0x419843[_0xe462('0x1e')]=_0x1bcd02;if(_0x2f6ce6[_0xe462('0x2f')][_0xe462('0x40')]){_0x3d1fb2['include']=[{'all':!![]}];}return db[_0xe462('0x61')]['findAll'](_0x3d1fb2);})[_0xe462('0x23')](function(_0x45b7b2){_0x419843[_0xe462('0x42')]=_0x45b7b2;return _0x419843;});}})[_0xe462('0x23')](respondWithFilteredResult(_0x49c5a3,_0x3d1fb2))[_0xe462('0x43')](handleError(_0x49c5a3,null));};exports['getHopperBlacks']=function(_0x2caf50,_0x555879,_0x3682e6){var _0x5a0835={'raw':!![],'where':{}};var _0x2b41de={};var _0x568243={'count':0x0,'rows':[]};return db['Campaign'][_0xe462('0x5d')]({'where':{'id':_0x2caf50[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x555879,null))[_0xe462('0x23')](function(_0x570aa3){if(_0x570aa3){_0x2b41de[_0xe462('0x2e')]=_['keys'](db[_0xe462('0x62')][_0xe462('0x2a')]);_0x2b41de[_0xe462('0x2f')]=_[_0xe462('0x45')](_0x2caf50[_0xe462('0x2f')]);_0x2b41de['filters']=_[_0xe462('0x31')](_0x2b41de[_0xe462('0x2e')],_0x2b41de[_0xe462('0x2f')]);_0x5a0835[_0xe462('0x32')]=_[_0xe462('0x31')](_0x2b41de[_0xe462('0x2e')],qs['fields'](_0x2caf50['query']['fields']));_0x5a0835[_0xe462('0x32')]=_0x5a0835[_0xe462('0x32')][_0xe462('0x34')]?_0x5a0835[_0xe462('0x32')]:_0x2b41de['model'];if(!_0x2caf50['query']['hasOwnProperty'](_0xe462('0x35'))){_0x5a0835['limit']=qs[_0xe462('0x36')](_0x2caf50['query'][_0xe462('0x36')]);_0x5a0835[_0xe462('0x1f')]=qs[_0xe462('0x1f')](_0x2caf50[_0xe462('0x2f')][_0xe462('0x1f')]);}_0x5a0835[_0xe462('0x37')]=qs[_0xe462('0x38')](_0x2caf50[_0xe462('0x2f')][_0xe462('0x38')]);_0x5a0835[_0xe462('0x39')]=qs['filters'](_[_0xe462('0x5f')](_0x2caf50[_0xe462('0x2f')],_0x2b41de[_0xe462('0x30')]));_0x5a0835[_0xe462('0x39')]['CampaignId']=_0x570aa3['id'];if(_0x2caf50[_0xe462('0x2f')]['filter']){_0x5a0835['where']=_[_0xe462('0x3b')](_0x5a0835[_0xe462('0x39')],{'$or':_[_0xe462('0x3c')](_0x5a0835[_0xe462('0x32')],function(_0x7085d0){var _0x38a05b={};_0x38a05b[_0x7085d0]={'$like':'%'+_0x2caf50[_0xe462('0x2f')][_0xe462('0x3a')]+'%'};return _0x38a05b;})});}_0x5a0835=_['merge']({},_0x5a0835,_0x2caf50['options']);return db[_0xe462('0x62')]['count']({'where':_0x5a0835[_0xe462('0x39')]})[_0xe462('0x23')](function(_0x107859){_0x568243[_0xe462('0x1e')]=_0x107859;if(_0x2caf50['query'][_0xe462('0x40')]){_0x5a0835[_0xe462('0x41')]=[{'all':!![]}];}return db[_0xe462('0x62')]['findAll'](_0x5a0835);})[_0xe462('0x23')](function(_0x4f0d97){_0x568243[_0xe462('0x42')]=_0x4f0d97;return _0x568243;});}})['then'](respondWithFilteredResult(_0x555879,_0x5a0835))[_0xe462('0x43')](handleError(_0x555879,null));};exports[_0xe462('0x63')]=function(_0x54e7dd,_0x1b2eac,_0x26be9c){var _0x2c66bc={};var _0x3772a8={};var _0x4bf94b;var _0x316ed4;return db[_0xe462('0x3f')][_0xe462('0x5d')]({'where':{'id':_0x54e7dd['params']['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x1b2eac,null))[_0xe462('0x23')](function(_0x2d763f){if(_0x2d763f){_0x4bf94b=_0x2d763f;_0x3772a8[_0xe462('0x2e')]=_[_0xe462('0x45')](db['CmList'][_0xe462('0x2a')]);_0x3772a8[_0xe462('0x2f')]=_[_0xe462('0x45')](_0x54e7dd[_0xe462('0x2f')]);_0x3772a8[_0xe462('0x30')]=_[_0xe462('0x31')](_0x3772a8['model'],_0x3772a8[_0xe462('0x2f')]);_0x2c66bc[_0xe462('0x32')]=_['intersection'](_0x3772a8[_0xe462('0x2e')],qs[_0xe462('0x33')](_0x54e7dd[_0xe462('0x2f')]['fields']));_0x2c66bc['attributes']=_0x2c66bc[_0xe462('0x32')][_0xe462('0x34')]?_0x2c66bc[_0xe462('0x32')]:_0x3772a8[_0xe462('0x2e')];_0x2c66bc[_0xe462('0x37')]=qs['sort'](_0x54e7dd[_0xe462('0x2f')][_0xe462('0x38')]);_0x2c66bc[_0xe462('0x39')]=qs[_0xe462('0x30')](_[_0xe462('0x5f')](_0x54e7dd[_0xe462('0x2f')],_0x3772a8[_0xe462('0x30')]));if(_0x54e7dd[_0xe462('0x2f')][_0xe462('0x3a')]){_0x2c66bc[_0xe462('0x39')]=_[_0xe462('0x3b')](_0x2c66bc[_0xe462('0x39')],{'$or':_[_0xe462('0x3c')](_0x2c66bc[_0xe462('0x32')],function(_0x4887b6){var _0x319d97={};_0x319d97[_0x4887b6]={'$like':'%'+_0x54e7dd[_0xe462('0x2f')][_0xe462('0x3a')]+'%'};return _0x319d97;})});}_0x2c66bc=_[_0xe462('0x3b')]({},_0x2c66bc,_0x54e7dd[_0xe462('0x3e')]);return _0x4bf94b['getLists'](_0x2c66bc);}})[_0xe462('0x23')](function(_0x1ad09f){if(_0x1ad09f){_0x316ed4=_0x1ad09f[_0xe462('0x34')];if(!_0x54e7dd[_0xe462('0x2f')][_0xe462('0x59')](_0xe462('0x35'))){_0x2c66bc['limit']=qs[_0xe462('0x36')](_0x54e7dd['query'][_0xe462('0x36')]);_0x2c66bc[_0xe462('0x1f')]=qs['offset'](_0x54e7dd[_0xe462('0x2f')][_0xe462('0x1f')]);}return _0x4bf94b[_0xe462('0x63')](_0x2c66bc);}})[_0xe462('0x23')](function(_0xa568f7){if(_0xa568f7){return _0xa568f7?{'count':_0x316ed4,'rows':_0xa568f7}:null;}})[_0xe462('0x23')](respondWithResult(_0x1b2eac,null))[_0xe462('0x43')](handleError(_0x1b2eac,null));};exports[_0xe462('0x64')]=function(_0x250f1b,_0x49464e,_0x31dc71){var _0xc4362c,_0x4772c6;var _0x505505=[];var _0x71ec15=moment()[_0xe462('0x65')](_0xe462('0x66'));return db[_0xe462('0x3f')][_0xe462('0x4c')]({'where':{'id':_0x250f1b[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x49464e,null))['then'](function(_0xa55f32){if(_0xa55f32){_0x4772c6=_0xa55f32;return _0xa55f32[_0xe462('0x64')](_0x250f1b['body']['ids'],_[_0xe462('0x55')](_0x250f1b['body'],['ids','id'])||{});}return null;})[_0xe462('0x67')](function(_0x4f6d3d){var _0x14d9f9;var _0x231391;_0xc4362c=_0x4f6d3d||[];var _0x50ae3b=[];if(_0x4f6d3d){for(var _0xebc9b8=0x0;_0xebc9b8<_0x4f6d3d[_0xe462('0x34')];_0xebc9b8+=0x1){var _0x40e891=_0x4f6d3d[_0xebc9b8]['get']({'plain':!![]});_0x4772c6[_0xe462('0x68')]=_0x250f1b[_0xe462('0x47')][_0xe462('0x68')]?_0x250f1b['body'][_0xe462('0x68')]:_0x4772c6[_0xe462('0x68')];switch(_0x4772c6[_0xe462('0x68')]){case _0xe462('0x69'):_0x14d9f9=squel[_0xe462('0x6a')]()['into'](_0xe462('0x6b'))['fromQuery'](['phone',_0xe462('0x6c'),_0xe462('0x6d'),_0xe462('0x6e'),'CampaignId',_0xe462('0x53'),_0xe462('0x54')],squel[_0xe462('0x6f')]()['field'](_0xe462('0x70'),_0xe462('0x70'))['field'](_0xe462('0x71'),_0xe462('0x6c'))[_0xe462('0x72')]('id','ContactId')[_0xe462('0x72')](_0x40e891['CmListId'][_0xe462('0x73')](),_0xe462('0x6e'))['field'](_0x250f1b[_0xe462('0x52')]['id'][_0xe462('0x73')](),_0xe462('0x5a'))[_0xe462('0x72')]('\x27'+_0x71ec15+'\x27',_0xe462('0x53'))['field']('\x27'+_0x71ec15+'\x27','updatedAt')[_0xe462('0x74')](_0xe462('0x75'))[_0xe462('0x39')](_0xe462('0x76'))['where'](_0xe462('0x77'),_0x40e891[_0xe462('0x78')][_0xe462('0x73')]())[_0xe462('0x39')](_0xe462('0x79'))[_0xe462('0x39')](_0xe462('0x7a'),squel[_0xe462('0x6f')]()[_0xe462('0x72')](_0xe462('0x7b'))[_0xe462('0x74')]('cm_hopper_final')[_0xe462('0x39')]('CampaignId\x20=\x20?',_0x250f1b[_0xe462('0x52')]['id'][_0xe462('0x73')]()))['where'](_0xe462('0x7a'),squel[_0xe462('0x6f')]()[_0xe462('0x72')](_0xe462('0x7c'))['from'](_0xe462('0x6b'))[_0xe462('0x39')](_0xe462('0x7d'),_0x250f1b['params']['id'][_0xe462('0x73')]())))['toString']();break;case'onlyIfOpen':_0x14d9f9=squel['insert']()[_0xe462('0x7e')](_0xe462('0x6b'))[_0xe462('0x7f')]([_0xe462('0x70'),_0xe462('0x6c'),_0xe462('0x6d'),_0xe462('0x6e'),_0xe462('0x5a'),_0xe462('0x53'),_0xe462('0x54')],squel['select']()[_0xe462('0x72')](_0xe462('0x70'),'phone')[_0xe462('0x72')](_0xe462('0x71'),_0xe462('0x6c'))['field']('id',_0xe462('0x6d'))[_0xe462('0x72')](_0x40e891[_0xe462('0x78')][_0xe462('0x73')](),'ListId')[_0xe462('0x72')](_0x250f1b[_0xe462('0x52')]['id']['toString'](),_0xe462('0x5a'))['field']('\x27'+_0x71ec15+'\x27',_0xe462('0x53'))['field']('\x27'+_0x71ec15+'\x27',_0xe462('0x54'))['from'](_0xe462('0x75'))['where'](_0xe462('0x76'))[_0xe462('0x39')](_0xe462('0x77'),_0x40e891[_0xe462('0x78')][_0xe462('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe462('0x39')](_0xe462('0x7a'),squel[_0xe462('0x6f')]()[_0xe462('0x72')](_0xe462('0x7c'))[_0xe462('0x74')](_0xe462('0x6b'))['where'](_0xe462('0x7d'),_0x250f1b[_0xe462('0x52')]['id'][_0xe462('0x73')]())))['toString']();break;default:_0x14d9f9=squel['insert']()[_0xe462('0x7e')]('cm_hopper')[_0xe462('0x7f')]([_0xe462('0x70'),_0xe462('0x6c'),_0xe462('0x6d'),_0xe462('0x6e'),_0xe462('0x5a'),_0xe462('0x53'),_0xe462('0x54')],squel[_0xe462('0x6f')]()[_0xe462('0x72')](_0xe462('0x70'),'phone')[_0xe462('0x72')](_0xe462('0x71'),_0xe462('0x6c'))[_0xe462('0x72')]('id','ContactId')['field'](_0x40e891['CmListId'][_0xe462('0x73')](),'ListId')[_0xe462('0x72')](_0x250f1b[_0xe462('0x52')]['id'][_0xe462('0x73')](),_0xe462('0x5a'))[_0xe462('0x72')]('\x27'+_0x71ec15+'\x27',_0xe462('0x53'))['field']('\x27'+_0x71ec15+'\x27',_0xe462('0x54'))[_0xe462('0x74')](_0xe462('0x75'))[_0xe462('0x39')](_0xe462('0x76'))['where'](_0xe462('0x77'),_0x40e891[_0xe462('0x78')][_0xe462('0x73')]())[_0xe462('0x39')](_0xe462('0x79')))[_0xe462('0x73')]();}_0x231391=squel[_0xe462('0x6a')]()['into'](_0xe462('0x80'))[_0xe462('0x7f')]([_0xe462('0x81'),'scheduledAt',_0xe462('0x70'),'OrderBy',_0xe462('0x53'),_0xe462('0x54')],squel[_0xe462('0x6f')]()['field'](_0xe462('0x82'),'id')[_0xe462('0x72')](_0xe462('0x71'),_0xe462('0x6c'))['field'](_0xe462('0x83'),_0xe462('0x70'))[_0xe462('0x72')](_0xe462('0x84'),_0xe462('0x85'))['field']('\x27'+_0x71ec15+'\x27',_0xe462('0x53'))[_0xe462('0x72')]('\x27'+_0x71ec15+'\x27',_0xe462('0x54'))[_0xe462('0x74')](_0xe462('0x86'),'ci')[_0xe462('0x87')](_0xe462('0x6b'),'h',_0xe462('0x88'))[_0xe462('0x39')](_0xe462('0x89'),_0x40e891[_0xe462('0x78')]['toString']())['where'](_0xe462('0x8a'),_0x250f1b['params']['id'][_0xe462('0x73')]())[_0xe462('0x39')]('h.createdAt\x20=\x20?',_0x71ec15))[_0xe462('0x73')]();_0x50ae3b[_0xe462('0x8b')](db[_0xe462('0x8c')][_0xe462('0x2f')](_0x14d9f9));_0x505505[_0xe462('0x8b')](db[_0xe462('0x8c')][_0xe462('0x2f')](_0x231391));}return BPromise[_0xe462('0x8d')](_0x50ae3b);}})['then'](function(){return BPromise[_0xe462('0x8d')](_0x505505);})[_0xe462('0x23')](function(){return _0xc4362c;})[_0xe462('0x23')](respondWithResult(_0x49464e,null))[_0xe462('0x43')](handleError(_0x49464e,null));};exports[_0xe462('0x8e')]=function(_0x44bfac,_0xb86eb5,_0x2daf53){return db[_0xe462('0x3f')][_0xe462('0x4c')]({'where':{'id':_0x44bfac[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0xb86eb5,null))['then'](function(_0x54dcb4){if(_0x54dcb4){return _0x54dcb4[_0xe462('0x8e')](_0x44bfac[_0xe462('0x2f')][_0xe462('0x8f')]);}})['then'](function(_0xbf410c){if(_0xbf410c){return db[_0xe462('0x58')][_0xe462('0x24')]({'where':{'ListId':_0x44bfac['query'][_0xe462('0x8f')],'CampaignId':_0x44bfac[_0xe462('0x52')]['id']}})[_0xe462('0x23')](function(){return _0xbf410c;});}})[_0xe462('0x23')](respondWithStatusCode(_0xb86eb5,null))[_0xe462('0x43')](handleError(_0xb86eb5,null));};exports[_0xe462('0x90')]=function(_0x5346dc,_0x1579da,_0x21ab08){var _0x42919d={};var _0x3abb3b={};var _0x32f089;var _0x334300;return db[_0xe462('0x3f')][_0xe462('0x5d')]({'where':{'id':_0x5346dc[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x1579da,null))['then'](function(_0x53a041){if(_0x53a041){_0x32f089=_0x53a041;_0x3abb3b[_0xe462('0x2e')]=_[_0xe462('0x45')](db['CmList'][_0xe462('0x2a')]);_0x3abb3b[_0xe462('0x2f')]=_[_0xe462('0x45')](_0x5346dc[_0xe462('0x2f')]);_0x3abb3b[_0xe462('0x30')]=_[_0xe462('0x31')](_0x3abb3b[_0xe462('0x2e')],_0x3abb3b[_0xe462('0x2f')]);_0x42919d[_0xe462('0x32')]=_[_0xe462('0x31')](_0x3abb3b[_0xe462('0x2e')],qs[_0xe462('0x33')](_0x5346dc[_0xe462('0x2f')]['fields']));_0x42919d[_0xe462('0x32')]=_0x42919d[_0xe462('0x32')][_0xe462('0x34')]?_0x42919d[_0xe462('0x32')]:_0x3abb3b[_0xe462('0x2e')];_0x42919d[_0xe462('0x37')]=qs[_0xe462('0x38')](_0x5346dc[_0xe462('0x2f')]['sort']);_0x42919d['where']=qs[_0xe462('0x30')](_[_0xe462('0x5f')](_0x5346dc[_0xe462('0x2f')],_0x3abb3b[_0xe462('0x30')]));if(_0x5346dc[_0xe462('0x2f')][_0xe462('0x3a')]){_0x42919d[_0xe462('0x39')]=_[_0xe462('0x3b')](_0x42919d['where'],{'$or':_[_0xe462('0x3c')](_0x42919d['attributes'],function(_0x2f1c20){var _0x289bb6={};_0x289bb6[_0x2f1c20]={'$like':'%'+_0x5346dc['query'][_0xe462('0x3a')]+'%'};return _0x289bb6;})});}_0x42919d=_[_0xe462('0x3b')]({},_0x42919d,_0x5346dc[_0xe462('0x3e')]);return _0x32f089['getBlackLists'](_0x42919d);}})[_0xe462('0x23')](function(_0x324313){if(_0x324313){_0x334300=_0x324313[_0xe462('0x34')];if(!_0x5346dc[_0xe462('0x2f')][_0xe462('0x59')]('nolimit')){_0x42919d[_0xe462('0x36')]=qs[_0xe462('0x36')](_0x5346dc['query'][_0xe462('0x36')]);_0x42919d[_0xe462('0x1f')]=qs[_0xe462('0x1f')](_0x5346dc[_0xe462('0x2f')][_0xe462('0x1f')]);}return _0x32f089[_0xe462('0x90')](_0x42919d);}})[_0xe462('0x23')](function(_0x4b426d){if(_0x4b426d){return _0x4b426d?{'count':_0x334300,'rows':_0x4b426d}:null;}})[_0xe462('0x23')](respondWithResult(_0x1579da,null))[_0xe462('0x43')](handleError(_0x1579da,null));};exports[_0xe462('0x91')]=function(_0x50408c,_0x177dcf,_0x283bfe){var _0x2e3285,_0x242cf0;var _0xd6cbd6=[];var _0x1ef45d=moment()[_0xe462('0x65')](_0xe462('0x66'));return db[_0xe462('0x3f')][_0xe462('0x4c')]({'where':{'id':_0x50408c[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x177dcf,null))['then'](function(_0x594ec0){if(_0x594ec0){_0x242cf0=_0x594ec0;return _0x594ec0[_0xe462('0x91')](_0x50408c[_0xe462('0x47')][_0xe462('0x8f')],_[_0xe462('0x55')](_0x50408c['body'],[_0xe462('0x8f'),'id'])||{});}return null;})['spread'](function(_0x59e70c){var _0x5af716;var _0x38b860;_0x2e3285=_0x59e70c||[];var _0x4b5691=[];if(_0x59e70c){for(var _0x30f66f=0x0;_0x30f66f<_0x59e70c[_0xe462('0x34')];_0x30f66f+=0x1){var _0x5c6b97=_0x59e70c[_0x30f66f][_0xe462('0x25')]({'plain':!![]});_0x5af716=squel[_0xe462('0x6a')]()[_0xe462('0x7e')](_0xe462('0x92'))[_0xe462('0x7f')]([_0xe462('0x70'),_0xe462('0x6d'),'ListId',_0xe462('0x5a'),'createdAt',_0xe462('0x54')],squel['select']()['field']('phone',_0xe462('0x70'))['field']('id',_0xe462('0x6d'))[_0xe462('0x72')](_0x5c6b97[_0xe462('0x78')][_0xe462('0x73')](),_0xe462('0x6e'))['field'](_0x50408c['params']['id'][_0xe462('0x73')](),'CampaignId')[_0xe462('0x72')](_0xe462('0x71'),_0xe462('0x53'))[_0xe462('0x72')](_0xe462('0x71'),'updatedAt')[_0xe462('0x74')](_0xe462('0x75'))[_0xe462('0x39')](_0xe462('0x76'))[_0xe462('0x39')]('ListId\x20=\x20?',_0x5c6b97['CmListId'][_0xe462('0x73')]())['where'](_0xe462('0x79')))[_0xe462('0x73')]();_0x4b5691[_0xe462('0x8b')](db[_0xe462('0x8c')][_0xe462('0x2f')](_0x5af716));}return BPromise[_0xe462('0x8d')](_0x4b5691);}})[_0xe462('0x23')](function(){return _0x2e3285;})[_0xe462('0x23')](respondWithResult(_0x177dcf,null))[_0xe462('0x43')](handleError(_0x177dcf,null));};exports['removeBlackLists']=function(_0x39eac2,_0x1f10fe,_0x198913){return db['Campaign'][_0xe462('0x4c')]({'where':{'id':_0x39eac2[_0xe462('0x52')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x1f10fe,null))[_0xe462('0x23')](function(_0x4200b3){if(_0x4200b3){return _0x4200b3['removeBlackLists'](_0x39eac2['query']['ids']);}})[_0xe462('0x23')](function(_0x3386ef){if(_0x3386ef){return db[_0xe462('0x62')][_0xe462('0x24')]({'where':{'ListId':_0x39eac2[_0xe462('0x2f')][_0xe462('0x8f')],'CampaignId':_0x39eac2[_0xe462('0x52')]['id']}})[_0xe462('0x23')](function(){return _0x3386ef;});}})[_0xe462('0x23')](respondWithStatusCode(_0x1f10fe,null))[_0xe462('0x43')](handleError(_0x1f10fe,null));}; \ No newline at end of file +var _0xae88=['COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','cm_hopper_additional_phones','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_contacts','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','then','IvrCampaigns','UserProfileResource','end','error','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','include','omit','updatedAt','createdAt','update','destroy','getHoppers','findOne','nolimit','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xae88,0xa1));var _0x8ae8=function(_0x132b14,_0x56323c){_0x132b14=_0x132b14-0x0;var _0x2a9c2b=_0xae88[_0x132b14];return _0x2a9c2b;};'use strict';var emlformat=require(_0x8ae8('0x0'));var rimraf=require(_0x8ae8('0x1'));var zipdir=require(_0x8ae8('0x2'));var jsonpatch=require(_0x8ae8('0x3'));var rp=require(_0x8ae8('0x4'));var moment=require('moment');var BPromise=require(_0x8ae8('0x5'));var Mustache=require('mustache');var util=require(_0x8ae8('0x6'));var path=require('path');var sox=require(_0x8ae8('0x7'));var csv=require('to-csv');var ejs=require(_0x8ae8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ae8('0x9'));var squel=require(_0x8ae8('0xa'));var crypto=require('crypto');var jsforce=require(_0x8ae8('0xb'));var deskjs=require(_0x8ae8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8ae8('0xd'));var Papa=require(_0x8ae8('0xe'));var Redis=require(_0x8ae8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8ae8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ae8('0x11'))(_0x8ae8('0x12'));var utils=require(_0x8ae8('0x13'));var config=require(_0x8ae8('0x14'));var licenseUtil=require(_0x8ae8('0x15'));var db=require(_0x8ae8('0x16'))['db'];function respondWithStatusCode(_0x56ca5d,_0x1e0ca9){_0x1e0ca9=_0x1e0ca9||0xcc;return function(_0xca6f82){if(_0xca6f82){return _0x56ca5d[_0x8ae8('0x17')](_0x1e0ca9);}return _0x56ca5d[_0x8ae8('0x18')](_0x1e0ca9)['end']();};}function respondWithResult(_0x2f47ca,_0x13b09a){_0x13b09a=_0x13b09a||0xc8;return function(_0x30b12c){if(_0x30b12c){return _0x2f47ca[_0x8ae8('0x18')](_0x13b09a)[_0x8ae8('0x19')](_0x30b12c);}};}function respondWithFilteredResult(_0x19a1d9,_0x2df77c){return function(_0x1eb2a9){if(_0x1eb2a9){var _0x3c674f=typeof _0x2df77c['offset']==='undefined'&&typeof _0x2df77c[_0x8ae8('0x1a')]===_0x8ae8('0x1b');var _0x3bc66c=_0x1eb2a9['count'];var _0x2620de=_0x3c674f?0x0:_0x2df77c[_0x8ae8('0x1c')];var _0x3909c7=_0x3c674f?_0x1eb2a9[_0x8ae8('0x1d')]:_0x2df77c['offset']+_0x2df77c['limit'];var _0x3c276c;if(_0x3909c7>=_0x3bc66c){_0x3909c7=_0x3bc66c;_0x3c276c=0xc8;}else{_0x3c276c=0xce;}_0x19a1d9['status'](_0x3c276c);return _0x19a1d9[_0x8ae8('0x1e')](_0x8ae8('0x1f'),_0x2620de+'-'+_0x3909c7+'/'+_0x3bc66c)[_0x8ae8('0x19')](_0x1eb2a9);}return null;};}function patchUpdates(_0x76554d){return function(_0x472718){try{jsonpatch['apply'](_0x472718,_0x76554d,!![]);}catch(_0x9ec156){return BPromise['reject'](_0x9ec156);}return _0x472718['save']();};}function saveUpdates(_0x1ee2a8,_0x20756c){return function(_0xd8b0f6){if(_0xd8b0f6){return _0xd8b0f6['update'](_0x1ee2a8)[_0x8ae8('0x20')](function(_0x5a3df6){return _0x5a3df6;});}return null;};}function removeEntity(_0x2136e0,_0x2e46af){return function(_0x205214){if(_0x205214){return _0x205214['destroy']()[_0x8ae8('0x20')](function(){var _0x25ce3a=_0x205214['get']({'plain':!![]});var _0x2c8ce3=_0x8ae8('0x21');return db[_0x8ae8('0x22')]['destroy']({'where':{'type':_0x2c8ce3,'resourceId':_0x25ce3a['id']}})['then'](function(){return _0x205214;});})[_0x8ae8('0x20')](function(){_0x2136e0[_0x8ae8('0x18')](0xcc)[_0x8ae8('0x23')]();});}};}function handleEntityNotFound(_0xbc7b86,_0x465254){return function(_0x1872d5){if(!_0x1872d5){_0xbc7b86[_0x8ae8('0x17')](0x194);}return _0x1872d5;};}function handleError(_0x5567e4,_0x2b014d){_0x2b014d=_0x2b014d||0x1f4;return function(_0x209bbd){logger[_0x8ae8('0x24')](_0x209bbd['stack']);if(_0x209bbd[_0x8ae8('0x25')]){delete _0x209bbd[_0x8ae8('0x25')];}_0x5567e4[_0x8ae8('0x18')](_0x2b014d)['send'](_0x209bbd);};}exports[_0x8ae8('0x26')]=function(_0x578e8c,_0xfb5c29){var _0x47cbfa={},_0x201bef={},_0x349eae={'count':0x0,'rows':[]};var _0x4e99b2=_[_0x8ae8('0x27')](db[_0x8ae8('0x28')][_0x8ae8('0x29')],function(_0x49d1e5){return{'name':_0x49d1e5[_0x8ae8('0x2a')],'type':_0x49d1e5[_0x8ae8('0x2b')][_0x8ae8('0x2c')]};});_0x201bef[_0x8ae8('0x2d')]=_[_0x8ae8('0x27')](_0x4e99b2,_0x8ae8('0x25'));_0x201bef[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x578e8c[_0x8ae8('0x2e')]);_0x201bef[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x201bef[_0x8ae8('0x2d')],_0x201bef[_0x8ae8('0x2e')]);_0x47cbfa[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x201bef['model'],qs['fields'](_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0x47cbfa['attributes']=_0x47cbfa[_0x8ae8('0x32')]['length']?_0x47cbfa[_0x8ae8('0x32')]:_0x201bef[_0x8ae8('0x2d')];if(!_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x34')]('nolimit')){_0x47cbfa['limit']=qs[_0x8ae8('0x1a')](_0x578e8c[_0x8ae8('0x2e')]['limit']);_0x47cbfa[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}_0x47cbfa[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0x47cbfa[_0x8ae8('0x37')]=qs[_0x8ae8('0x30')](_[_0x8ae8('0x38')](_0x578e8c[_0x8ae8('0x2e')],_0x201bef['filters']),_0x4e99b2);if(_0x578e8c['query'][_0x8ae8('0x39')]){_0x47cbfa['where']=_[_0x8ae8('0x3a')](_0x47cbfa[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0x4e99b2,function(_0x12af7c){if(_0x12af7c[_0x8ae8('0x2b')]!=='VIRTUAL'){var _0x9692e4={};_0x9692e4[_0x12af7c[_0x8ae8('0x25')]]={'$like':'%'+_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x9692e4;}})});}_0x47cbfa=_[_0x8ae8('0x3a')]({},_0x47cbfa,_0x578e8c[_0x8ae8('0x3b')]);var _0x46b57e={'where':_0x47cbfa['where']};return db['Campaign'][_0x8ae8('0x1d')](_0x46b57e)[_0x8ae8('0x20')](function(_0x9eef24){_0x349eae[_0x8ae8('0x1d')]=_0x9eef24;if(_0x578e8c[_0x8ae8('0x2e')]['includeAll']){_0x47cbfa['include']=[{'all':!![]}];}return db[_0x8ae8('0x28')][_0x8ae8('0x3c')](_0x47cbfa);})[_0x8ae8('0x20')](function(_0x4646e2){_0x349eae[_0x8ae8('0x3d')]=_0x4646e2;return _0x349eae;})[_0x8ae8('0x20')](respondWithFilteredResult(_0xfb5c29,_0x47cbfa))[_0x8ae8('0x3e')](handleError(_0xfb5c29,null));};exports[_0x8ae8('0x3f')]=function(_0x4e6c94,_0x264d86){var _0x424dd8={'raw':![],'where':{'id':_0x4e6c94[_0x8ae8('0x40')]['id']}},_0x3a6c6e={};_0x3a6c6e[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db['Campaign'][_0x8ae8('0x29')]);_0x3a6c6e[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x4e6c94['query']);_0x3a6c6e[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x3a6c6e[_0x8ae8('0x2d')],_0x3a6c6e[_0x8ae8('0x2e')]);_0x424dd8[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x3a6c6e[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x4e6c94[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0x424dd8[_0x8ae8('0x32')]=_0x424dd8[_0x8ae8('0x32')]['length']?_0x424dd8[_0x8ae8('0x32')]:_0x3a6c6e['model'];if(_0x4e6c94['query'][_0x8ae8('0x41')]){_0x424dd8['include']=[{'all':!![]}];}_0x424dd8=_[_0x8ae8('0x3a')]({},_0x424dd8,_0x4e6c94[_0x8ae8('0x3b')]);return db['Campaign']['find'](_0x424dd8)[_0x8ae8('0x20')](handleEntityNotFound(_0x264d86,null))[_0x8ae8('0x20')](respondWithResult(_0x264d86,null))[_0x8ae8('0x3e')](handleError(_0x264d86,null));};exports[_0x8ae8('0x42')]=function(_0x2de81d,_0x12c4bb){return db[_0x8ae8('0x28')]['create'](_0x2de81d[_0x8ae8('0x43')],{})[_0x8ae8('0x20')](function(_0xbea562){var _0xc7ed31=_0x2de81d[_0x8ae8('0x44')][_0x8ae8('0x45')]({'plain':!![]});if(!_0xc7ed31)throw new Error(_0x8ae8('0x46'));if(_0xc7ed31[_0x8ae8('0x47')]===_0x8ae8('0x44')){var _0x32f674=_0xbea562[_0x8ae8('0x45')]({'plain':!![]});var _0x1e3bd3=_0x8ae8('0x21');return db[_0x8ae8('0x48')][_0x8ae8('0x49')]({'where':{'name':_0x1e3bd3,'userProfileId':_0xc7ed31[_0x8ae8('0x4a')]},'raw':!![]})['then'](function(_0x116090){if(_0x116090&&_0x116090[_0x8ae8('0x4b')]===0x0){return db[_0x8ae8('0x22')]['create']({'name':_0x32f674[_0x8ae8('0x25')],'resourceId':_0x32f674['id'],'type':_0x116090[_0x8ae8('0x25')],'sectionId':_0x116090['id']},{})['then'](function(){return _0xbea562;});}else{return _0xbea562;}})[_0x8ae8('0x3e')](function(_0x52de05){logger[_0x8ae8('0x24')](_0x8ae8('0x4c'),_0x52de05);throw _0x52de05;});}return _0xbea562;})[_0x8ae8('0x20')](respondWithResult(_0x12c4bb,0xc9))[_0x8ae8('0x3e')](handleError(_0x12c4bb,null));};exports[_0x8ae8('0x4d')]=function(_0x1d057b,_0x52e8f4){var _0x12d376={'where':{'id':_0x1d057b['params']['id']}},_0x27cb15={};_0x27cb15[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db[_0x8ae8('0x28')][_0x8ae8('0x29')]);_0x12d376['attributes']=_[_0x8ae8('0x31')](_0x27cb15['model'],qs[_0x8ae8('0x33')](_0x1d057b[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0x12d376[_0x8ae8('0x32')]=_0x12d376[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x12d376[_0x8ae8('0x32')]:_0x27cb15[_0x8ae8('0x2d')];if(_0x1d057b[_0x8ae8('0x2e')][_0x8ae8('0x41')]){_0x12d376[_0x8ae8('0x4f')]=[{'all':!![]}];}_0x12d376=_['merge']({},_0x12d376,_0x1d057b[_0x8ae8('0x3b')]);return db['Campaign'][_0x8ae8('0x49')](_0x12d376)[_0x8ae8('0x20')](handleEntityNotFound(_0x52e8f4,null))[_0x8ae8('0x20')](function(_0x3d4987){if(_0x3d4987){var _0x4a2207=_0x3d4987['get']({'plain':!![]});_0x4a2207=qs[_0x8ae8('0x50')](_0x4a2207,['id','createdAt',_0x8ae8('0x51')]);_0x1d057b['body']=_[_0x8ae8('0x50')](_0x1d057b['body'],['id',_0x8ae8('0x52'),_0x8ae8('0x51')]);return db[_0x8ae8('0x28')][_0x8ae8('0x42')](_[_0x8ae8('0x3a')](_0x4a2207,_0x1d057b[_0x8ae8('0x43')]),{'include':_0x1d057b['query'][_0x8ae8('0x41')]?[{'all':!![]}]:undefined})[_0x8ae8('0x20')](function(_0x1fc36a){var _0x3f7593=_0x1d057b['user'][_0x8ae8('0x45')]({'plain':!![]});if(!_0x3f7593)throw new Error(_0x8ae8('0x46'));if(_0x3f7593[_0x8ae8('0x47')]==='user'){var _0x3cff74=_0x1fc36a[_0x8ae8('0x45')]({'plain':!![]});var _0x471b1e=_0x8ae8('0x21');return db['UserProfileSection'][_0x8ae8('0x49')]({'where':{'name':_0x471b1e,'userProfileId':_0x3f7593[_0x8ae8('0x4a')]},'raw':!![]})[_0x8ae8('0x20')](function(_0x1f7b8f){if(_0x1f7b8f&&_0x1f7b8f['autoAssociation']===0x0){return db[_0x8ae8('0x22')]['create']({'name':_0x3cff74[_0x8ae8('0x25')],'resourceId':_0x3cff74['id'],'type':_0x1f7b8f[_0x8ae8('0x25')],'sectionId':_0x1f7b8f['id']},{})[_0x8ae8('0x20')](function(){return _0x1fc36a;});}else{return _0x1fc36a;}})['catch'](function(_0x2ad525){logger[_0x8ae8('0x24')](_0x8ae8('0x4c'),_0x2ad525);throw _0x2ad525;});}return _0x1fc36a;});}})[_0x8ae8('0x20')](respondWithResult(_0x52e8f4,0xc9))[_0x8ae8('0x3e')](handleError(_0x52e8f4,null));};exports[_0x8ae8('0x53')]=function(_0xe32f4e,_0x53c5fd){if(_0xe32f4e[_0x8ae8('0x43')]['id']){delete _0xe32f4e['body']['id'];}return db[_0x8ae8('0x28')]['find']({'where':{'id':_0xe32f4e[_0x8ae8('0x40')]['id']}})['then'](handleEntityNotFound(_0x53c5fd,null))[_0x8ae8('0x20')](saveUpdates(_0xe32f4e[_0x8ae8('0x43')],null))[_0x8ae8('0x20')](respondWithResult(_0x53c5fd,null))['catch'](handleError(_0x53c5fd,null));};exports[_0x8ae8('0x54')]=function(_0xd4a348,_0x131ec9){return db['Campaign'][_0x8ae8('0x49')]({'where':{'id':_0xd4a348['params']['id']}})['then'](handleEntityNotFound(_0x131ec9,null))[_0x8ae8('0x20')](removeEntity(_0x131ec9,null))['catch'](handleError(_0x131ec9,null));};exports[_0x8ae8('0x55')]=function(_0x233fd1,_0x218e9d,_0x3ae3ee){var _0x520915={'raw':!![],'where':{}};var _0x2b9ae8={};var _0x58def5={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x233fd1[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x218e9d,null))[_0x8ae8('0x20')](function(_0x21293c){if(_0x21293c){_0x2b9ae8[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db['CmHopper'][_0x8ae8('0x29')]);_0x2b9ae8[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x233fd1['query']);_0x2b9ae8['filters']=_[_0x8ae8('0x31')](_0x2b9ae8[_0x8ae8('0x2d')],_0x2b9ae8[_0x8ae8('0x2e')]);_0x520915[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x2b9ae8[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x233fd1[_0x8ae8('0x2e')]['fields']));_0x520915['attributes']=_0x520915[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x520915[_0x8ae8('0x32')]:_0x2b9ae8[_0x8ae8('0x2d')];if(!_0x233fd1['query'][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x520915[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x233fd1[_0x8ae8('0x2e')]['limit']);_0x520915[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}_0x520915['order']=qs[_0x8ae8('0x36')](_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0x520915['where']=qs[_0x8ae8('0x30')](_['pick'](_0x233fd1[_0x8ae8('0x2e')],_0x2b9ae8['filters']));_0x520915['where']['CampaignId']=_0x21293c['id'];if(_0x233fd1['query'][_0x8ae8('0x39')]){_0x520915[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0x520915[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0x520915[_0x8ae8('0x32')],function(_0x249885){var _0x29a34b={};_0x29a34b[_0x249885]={'$like':'%'+_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x29a34b;})});}_0x520915=_[_0x8ae8('0x3a')]({},_0x520915,_0x233fd1[_0x8ae8('0x3b')]);return db[_0x8ae8('0x58')]['count']({'where':_0x520915[_0x8ae8('0x37')]})[_0x8ae8('0x20')](function(_0x16a65e){_0x58def5['count']=_0x16a65e;if(_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x41')]){_0x520915[_0x8ae8('0x4f')]=[{'all':!![]}];}return db[_0x8ae8('0x58')][_0x8ae8('0x3c')](_0x520915);})[_0x8ae8('0x20')](function(_0x49441b){_0x58def5[_0x8ae8('0x3d')]=_0x49441b;return _0x58def5;});}})[_0x8ae8('0x20')](respondWithFilteredResult(_0x218e9d,_0x520915))[_0x8ae8('0x3e')](handleError(_0x218e9d,null));};exports[_0x8ae8('0x59')]=function(_0x39398c,_0x5e8f60,_0x530bc0){var _0x4684b5={'raw':!![],'where':{}};var _0x17c6af={};var _0x51c184={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x39398c[_0x8ae8('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e8f60,null))[_0x8ae8('0x20')](function(_0x1f9256){if(_0x1f9256){_0x17c6af[_0x8ae8('0x2d')]=_['keys'](db[_0x8ae8('0x5a')]['rawAttributes']);_0x17c6af[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x39398c[_0x8ae8('0x2e')]);_0x17c6af['filters']=_['intersection'](_0x17c6af[_0x8ae8('0x2d')],_0x17c6af[_0x8ae8('0x2e')]);_0x4684b5[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x17c6af[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x39398c['query']['fields']));_0x4684b5[_0x8ae8('0x32')]=_0x4684b5[_0x8ae8('0x32')]['length']?_0x4684b5['attributes']:_0x17c6af['model'];if(!_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x34')]('nolimit')){_0x4684b5[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x39398c['query'][_0x8ae8('0x1a')]);_0x4684b5[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}_0x4684b5[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x39398c[_0x8ae8('0x2e')]['sort']);_0x4684b5[_0x8ae8('0x37')]=qs['filters'](_[_0x8ae8('0x38')](_0x39398c[_0x8ae8('0x2e')],_0x17c6af[_0x8ae8('0x30')]));_0x4684b5[_0x8ae8('0x37')][_0x8ae8('0x5b')]=_0x1f9256['id'];if(_0x39398c[_0x8ae8('0x2e')]['filter']){_0x4684b5[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0x4684b5['where'],{'$or':_[_0x8ae8('0x27')](_0x4684b5[_0x8ae8('0x32')],function(_0xa6b101){var _0x5810d1={};_0x5810d1[_0xa6b101]={'$like':'%'+_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x5810d1;})});}_0x4684b5=_['merge']({},_0x4684b5,_0x39398c[_0x8ae8('0x3b')]);return db[_0x8ae8('0x5a')][_0x8ae8('0x1d')]({'where':_0x4684b5[_0x8ae8('0x37')]})[_0x8ae8('0x20')](function(_0x5c60fd){_0x51c184[_0x8ae8('0x1d')]=_0x5c60fd;if(_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x41')]){_0x4684b5[_0x8ae8('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x8ae8('0x3c')](_0x4684b5);})[_0x8ae8('0x20')](function(_0x167652){_0x51c184[_0x8ae8('0x3d')]=_0x167652;return _0x51c184;});}})['then'](respondWithFilteredResult(_0x5e8f60,_0x4684b5))[_0x8ae8('0x3e')](handleError(_0x5e8f60,null));};exports[_0x8ae8('0x5c')]=function(_0x421c51,_0x269c53,_0x2230d9){var _0x5483b1={'raw':!![],'where':{}};var _0x4fddc6={};var _0x42f7b9={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x421c51[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x269c53,null))['then'](function(_0x237a86){if(_0x237a86){_0x4fddc6[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db['CmHopperFinal'][_0x8ae8('0x29')]);_0x4fddc6[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x421c51[_0x8ae8('0x2e')]);_0x4fddc6['filters']=_['intersection'](_0x4fddc6['model'],_0x4fddc6['query']);_0x5483b1['attributes']=_['intersection'](_0x4fddc6[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x421c51[_0x8ae8('0x2e')]['fields']));_0x5483b1[_0x8ae8('0x32')]=_0x5483b1[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x5483b1[_0x8ae8('0x32')]:_0x4fddc6[_0x8ae8('0x2d')];if(!_0x421c51[_0x8ae8('0x2e')][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x5483b1['limit']=qs[_0x8ae8('0x1a')](_0x421c51[_0x8ae8('0x2e')][_0x8ae8('0x1a')]);_0x5483b1['offset']=qs[_0x8ae8('0x1c')](_0x421c51['query'][_0x8ae8('0x1c')]);}_0x5483b1[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x421c51['query'][_0x8ae8('0x36')]);_0x5483b1['where']=qs[_0x8ae8('0x30')](_['pick'](_0x421c51[_0x8ae8('0x2e')],_0x4fddc6[_0x8ae8('0x30')]));_0x5483b1[_0x8ae8('0x37')][_0x8ae8('0x5b')]=_0x237a86['id'];if(_0x421c51[_0x8ae8('0x2e')][_0x8ae8('0x39')]){_0x5483b1[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0x5483b1[_0x8ae8('0x37')],{'$or':_['map'](_0x5483b1['attributes'],function(_0x58baa3){var _0x58aecc={};_0x58aecc[_0x58baa3]={'$like':'%'+_0x421c51['query'][_0x8ae8('0x39')]+'%'};return _0x58aecc;})});}_0x5483b1=_[_0x8ae8('0x3a')]({},_0x5483b1,_0x421c51[_0x8ae8('0x3b')]);return db['CmHopperFinal'][_0x8ae8('0x1d')]({'where':_0x5483b1['where']})[_0x8ae8('0x20')](function(_0x373572){_0x42f7b9[_0x8ae8('0x1d')]=_0x373572;if(_0x421c51[_0x8ae8('0x2e')]['includeAll']){_0x5483b1[_0x8ae8('0x4f')]=[{'all':!![]}];}return db[_0x8ae8('0x5d')]['findAll'](_0x5483b1);})[_0x8ae8('0x20')](function(_0x473850){_0x42f7b9[_0x8ae8('0x3d')]=_0x473850;return _0x42f7b9;});}})[_0x8ae8('0x20')](respondWithFilteredResult(_0x269c53,_0x5483b1))[_0x8ae8('0x3e')](handleError(_0x269c53,null));};exports['getHopperBlacks']=function(_0x5311ac,_0x22e322,_0x119296){var _0xce2d44={'raw':!![],'where':{}};var _0x18f9f3={};var _0x2af79b={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x5311ac[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x22e322,null))[_0x8ae8('0x20')](function(_0x3cbe55){if(_0x3cbe55){_0x18f9f3[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db[_0x8ae8('0x5e')][_0x8ae8('0x29')]);_0x18f9f3[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x5311ac[_0x8ae8('0x2e')]);_0x18f9f3[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x18f9f3[_0x8ae8('0x2d')],_0x18f9f3[_0x8ae8('0x2e')]);_0xce2d44['attributes']=_['intersection'](_0x18f9f3[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0xce2d44['attributes']=_0xce2d44['attributes'][_0x8ae8('0x4e')]?_0xce2d44[_0x8ae8('0x32')]:_0x18f9f3['model'];if(!_0x5311ac[_0x8ae8('0x2e')]['hasOwnProperty'](_0x8ae8('0x57'))){_0xce2d44[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x5311ac[_0x8ae8('0x2e')]['limit']);_0xce2d44[_0x8ae8('0x1c')]=qs['offset'](_0x5311ac['query']['offset']);}_0xce2d44[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0xce2d44[_0x8ae8('0x37')]=qs[_0x8ae8('0x30')](_['pick'](_0x5311ac[_0x8ae8('0x2e')],_0x18f9f3[_0x8ae8('0x30')]));_0xce2d44[_0x8ae8('0x37')]['CampaignId']=_0x3cbe55['id'];if(_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x39')]){_0xce2d44[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0xce2d44[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0xce2d44[_0x8ae8('0x32')],function(_0x7cfc10){var _0x2fc658={};_0x2fc658[_0x7cfc10]={'$like':'%'+_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x2fc658;})});}_0xce2d44=_['merge']({},_0xce2d44,_0x5311ac[_0x8ae8('0x3b')]);return db[_0x8ae8('0x5e')]['count']({'where':_0xce2d44['where']})[_0x8ae8('0x20')](function(_0x220907){_0x2af79b[_0x8ae8('0x1d')]=_0x220907;if(_0x5311ac['query'][_0x8ae8('0x41')]){_0xce2d44[_0x8ae8('0x4f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8ae8('0x3c')](_0xce2d44);})[_0x8ae8('0x20')](function(_0x127186){_0x2af79b['rows']=_0x127186;return _0x2af79b;});}})['then'](respondWithFilteredResult(_0x22e322,_0xce2d44))[_0x8ae8('0x3e')](handleError(_0x22e322,null));};exports[_0x8ae8('0x5f')]=function(_0x5b8fa1,_0xa9f8a6,_0x5a6471){var _0x1123b2={};var _0x22ed19={};var _0x154096;var _0x166c41;return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x5b8fa1['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0xa9f8a6,null))['then'](function(_0x279abc){if(_0x279abc){_0x154096=_0x279abc;_0x22ed19[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db[_0x8ae8('0x60')][_0x8ae8('0x29')]);_0x22ed19[_0x8ae8('0x2e')]=_['keys'](_0x5b8fa1[_0x8ae8('0x2e')]);_0x22ed19[_0x8ae8('0x30')]=_['intersection'](_0x22ed19[_0x8ae8('0x2d')],_0x22ed19[_0x8ae8('0x2e')]);_0x1123b2[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x22ed19[_0x8ae8('0x2d')],qs['fields'](_0x5b8fa1['query'][_0x8ae8('0x33')]));_0x1123b2[_0x8ae8('0x32')]=_0x1123b2[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x1123b2['attributes']:_0x22ed19[_0x8ae8('0x2d')];_0x1123b2[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x5b8fa1[_0x8ae8('0x2e')]['sort']);_0x1123b2[_0x8ae8('0x37')]=qs[_0x8ae8('0x30')](_[_0x8ae8('0x38')](_0x5b8fa1[_0x8ae8('0x2e')],_0x22ed19[_0x8ae8('0x30')]));if(_0x5b8fa1['query'][_0x8ae8('0x39')]){_0x1123b2[_0x8ae8('0x37')]=_['merge'](_0x1123b2[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0x1123b2[_0x8ae8('0x32')],function(_0x93518b){var _0x5908a7={};_0x5908a7[_0x93518b]={'$like':'%'+_0x5b8fa1[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x5908a7;})});}_0x1123b2=_[_0x8ae8('0x3a')]({},_0x1123b2,_0x5b8fa1['options']);return _0x154096[_0x8ae8('0x5f')](_0x1123b2);}})[_0x8ae8('0x20')](function(_0xe9379c){if(_0xe9379c){_0x166c41=_0xe9379c[_0x8ae8('0x4e')];if(!_0x5b8fa1[_0x8ae8('0x2e')][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x1123b2[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x5b8fa1['query']['limit']);_0x1123b2[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x5b8fa1[_0x8ae8('0x2e')]['offset']);}return _0x154096['getLists'](_0x1123b2);}})[_0x8ae8('0x20')](function(_0x278600){if(_0x278600){return _0x278600?{'count':_0x166c41,'rows':_0x278600}:null;}})[_0x8ae8('0x20')](respondWithResult(_0xa9f8a6,null))[_0x8ae8('0x3e')](handleError(_0xa9f8a6,null));};exports[_0x8ae8('0x61')]=function(_0x3f7be6,_0x51e7e3,_0x463e18){var _0xc51a79,_0x3cd185;var _0x2280a2=[];var _0x1e4934=moment()[_0x8ae8('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x8ae8('0x28')][_0x8ae8('0x49')]({'where':{'id':_0x3f7be6[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x51e7e3,null))[_0x8ae8('0x20')](function(_0x1a2340){if(_0x1a2340){_0x3cd185=_0x1a2340;return _0x1a2340[_0x8ae8('0x61')](_0x3f7be6[_0x8ae8('0x43')][_0x8ae8('0x63')],_[_0x8ae8('0x50')](_0x3f7be6[_0x8ae8('0x43')],['ids','id'])||{});}return null;})[_0x8ae8('0x64')](function(_0x305418){var _0x18870e;var _0x35a0c3;_0xc51a79=_0x305418||[];var _0x51fcac=[];if(_0x305418){for(var _0x364ea7=0x0;_0x364ea7<_0x305418[_0x8ae8('0x4e')];_0x364ea7+=0x1){var _0x4ab562=_0x305418[_0x364ea7]['get']({'plain':!![]});_0x3cd185[_0x8ae8('0x65')]=_0x3f7be6[_0x8ae8('0x43')][_0x8ae8('0x65')]?_0x3f7be6[_0x8ae8('0x43')]['dialCheckDuplicateType']:_0x3cd185[_0x8ae8('0x65')];switch(_0x3cd185[_0x8ae8('0x65')]){case'always':_0x18870e=squel['insert']()[_0x8ae8('0x66')](_0x8ae8('0x67'))[_0x8ae8('0x68')](['phone',_0x8ae8('0x69'),_0x8ae8('0x6a'),_0x8ae8('0x6b'),_0x8ae8('0x5b'),'createdAt',_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()['field']('phone',_0x8ae8('0x6d'))[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x69'))['field']('id','ContactId')[_0x8ae8('0x6e')](_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')](),_0x8ae8('0x6b'))[_0x8ae8('0x6e')](_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))['field']('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))['field']('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))[_0x8ae8('0x72')]('cm_contacts')[_0x8ae8('0x37')](_0x8ae8('0x73'))[_0x8ae8('0x37')](_0x8ae8('0x74'),_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x75'))[_0x8ae8('0x37')](_0x8ae8('0x76'),squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')](_0x8ae8('0x77'))[_0x8ae8('0x72')](_0x8ae8('0x78'))[_0x8ae8('0x37')](_0x8ae8('0x79'),_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')]()))[_0x8ae8('0x37')](_0x8ae8('0x76'),squel[_0x8ae8('0x6c')]()['field'](_0x8ae8('0x7a'))[_0x8ae8('0x72')](_0x8ae8('0x67'))[_0x8ae8('0x37')](_0x8ae8('0x79'),_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')]())))[_0x8ae8('0x71')]();break;case'onlyIfOpen':_0x18870e=squel['insert']()['into'](_0x8ae8('0x67'))[_0x8ae8('0x68')]([_0x8ae8('0x6d'),_0x8ae8('0x69'),_0x8ae8('0x6a'),_0x8ae8('0x6b'),_0x8ae8('0x5b'),'createdAt',_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()['field']('phone','phone')[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x69'))[_0x8ae8('0x6e')]('id',_0x8ae8('0x6a'))['field'](_0x4ab562[_0x8ae8('0x70')]['toString'](),_0x8ae8('0x6b'))[_0x8ae8('0x6e')](_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))[_0x8ae8('0x72')]('cm_contacts')[_0x8ae8('0x37')](_0x8ae8('0x73'))['where'](_0x8ae8('0x74'),_0x4ab562['CmListId'][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x75'))[_0x8ae8('0x37')](_0x8ae8('0x76'),squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')](_0x8ae8('0x7a'))[_0x8ae8('0x72')]('cm_hopper')['where'](_0x8ae8('0x79'),_0x3f7be6[_0x8ae8('0x40')]['id']['toString']())))[_0x8ae8('0x71')]();break;default:_0x18870e=squel['insert']()[_0x8ae8('0x66')](_0x8ae8('0x67'))['fromQuery']([_0x8ae8('0x6d'),'scheduledAt','ContactId',_0x8ae8('0x6b'),_0x8ae8('0x5b'),'createdAt',_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')](_0x8ae8('0x6d'),_0x8ae8('0x6d'))['field'](_0x8ae8('0x6f'),_0x8ae8('0x69'))[_0x8ae8('0x6e')]('id','ContactId')[_0x8ae8('0x6e')](_0x4ab562['CmListId']['toString'](),_0x8ae8('0x6b'))['field'](_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))['from']('cm_contacts')[_0x8ae8('0x37')](_0x8ae8('0x73'))[_0x8ae8('0x37')](_0x8ae8('0x74'),_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x75')))[_0x8ae8('0x71')]();}_0x35a0c3=squel[_0x8ae8('0x7b')]()[_0x8ae8('0x66')](_0x8ae8('0x7c'))[_0x8ae8('0x68')](['cmHopperId','scheduledAt','phone',_0x8ae8('0x7d'),_0x8ae8('0x52'),_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')]('h.id','id')['field'](_0x8ae8('0x6f'),'scheduledAt')['field']('ci.item',_0x8ae8('0x6d'))['field'](_0x8ae8('0x7e'),_0x8ae8('0x7d'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))[_0x8ae8('0x72')](_0x8ae8('0x7f'),'ci')[_0x8ae8('0x80')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x8ae8('0x37')](_0x8ae8('0x81'),_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x82'),_0x3f7be6[_0x8ae8('0x40')]['id']['toString']())[_0x8ae8('0x37')]('h.createdAt\x20=\x20?',_0x1e4934))[_0x8ae8('0x71')]();_0x51fcac[_0x8ae8('0x83')](db[_0x8ae8('0x84')][_0x8ae8('0x2e')](_0x18870e));_0x2280a2[_0x8ae8('0x83')](db[_0x8ae8('0x84')][_0x8ae8('0x2e')](_0x35a0c3));}return BPromise['all'](_0x51fcac);}})[_0x8ae8('0x20')](function(){return BPromise[_0x8ae8('0x85')](_0x2280a2);})[_0x8ae8('0x20')](function(){return _0xc51a79;})[_0x8ae8('0x20')](respondWithResult(_0x51e7e3,null))[_0x8ae8('0x3e')](handleError(_0x51e7e3,null));};exports[_0x8ae8('0x86')]=function(_0x4f4c52,_0x3f54a0,_0x2a51b8){return db[_0x8ae8('0x28')]['find']({'where':{'id':_0x4f4c52['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x3f54a0,null))[_0x8ae8('0x20')](function(_0x2acdbc){if(_0x2acdbc){return _0x2acdbc[_0x8ae8('0x86')](_0x4f4c52[_0x8ae8('0x2e')][_0x8ae8('0x63')]);}})[_0x8ae8('0x20')](function(_0xcfeb08){if(_0xcfeb08){return db[_0x8ae8('0x58')][_0x8ae8('0x54')]({'where':{'ListId':_0x4f4c52[_0x8ae8('0x2e')][_0x8ae8('0x63')],'CampaignId':_0x4f4c52['params']['id']}})[_0x8ae8('0x20')](function(){return _0xcfeb08;});}})[_0x8ae8('0x20')](respondWithStatusCode(_0x3f54a0,null))[_0x8ae8('0x3e')](handleError(_0x3f54a0,null));};exports[_0x8ae8('0x87')]=function(_0x52e487,_0x657eda,_0x26aeca){var _0x41ea3e={};var _0x11b0a8={};var _0x33f65c;var _0x304707;return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x52e487['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x657eda,null))[_0x8ae8('0x20')](function(_0xd3aae6){if(_0xd3aae6){_0x33f65c=_0xd3aae6;_0x11b0a8[_0x8ae8('0x2d')]=_['keys'](db[_0x8ae8('0x60')][_0x8ae8('0x29')]);_0x11b0a8[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x52e487[_0x8ae8('0x2e')]);_0x11b0a8[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x11b0a8[_0x8ae8('0x2d')],_0x11b0a8[_0x8ae8('0x2e')]);_0x41ea3e[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x11b0a8[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x52e487[_0x8ae8('0x2e')]['fields']));_0x41ea3e[_0x8ae8('0x32')]=_0x41ea3e[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x41ea3e[_0x8ae8('0x32')]:_0x11b0a8[_0x8ae8('0x2d')];_0x41ea3e[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0x41ea3e['where']=qs['filters'](_[_0x8ae8('0x38')](_0x52e487[_0x8ae8('0x2e')],_0x11b0a8[_0x8ae8('0x30')]));if(_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x39')]){_0x41ea3e['where']=_['merge'](_0x41ea3e['where'],{'$or':_[_0x8ae8('0x27')](_0x41ea3e[_0x8ae8('0x32')],function(_0xbf361b){var _0x476af1={};_0x476af1[_0xbf361b]={'$like':'%'+_0x52e487[_0x8ae8('0x2e')]['filter']+'%'};return _0x476af1;})});}_0x41ea3e=_[_0x8ae8('0x3a')]({},_0x41ea3e,_0x52e487[_0x8ae8('0x3b')]);return _0x33f65c[_0x8ae8('0x87')](_0x41ea3e);}})[_0x8ae8('0x20')](function(_0x4fdcd5){if(_0x4fdcd5){_0x304707=_0x4fdcd5[_0x8ae8('0x4e')];if(!_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x41ea3e[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x52e487['query'][_0x8ae8('0x1a')]);_0x41ea3e[_0x8ae8('0x1c')]=qs['offset'](_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}return _0x33f65c[_0x8ae8('0x87')](_0x41ea3e);}})[_0x8ae8('0x20')](function(_0x5a5245){if(_0x5a5245){return _0x5a5245?{'count':_0x304707,'rows':_0x5a5245}:null;}})[_0x8ae8('0x20')](respondWithResult(_0x657eda,null))[_0x8ae8('0x3e')](handleError(_0x657eda,null));};exports[_0x8ae8('0x88')]=function(_0xc52744,_0x4bae66,_0x2bf8e8){var _0x208d4f,_0x4937be;var _0x420074=[];var _0x5eed8c=moment()[_0x8ae8('0x62')](_0x8ae8('0x89'));return db[_0x8ae8('0x28')][_0x8ae8('0x49')]({'where':{'id':_0xc52744[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x4bae66,null))[_0x8ae8('0x20')](function(_0x421fe1){if(_0x421fe1){_0x4937be=_0x421fe1;return _0x421fe1[_0x8ae8('0x88')](_0xc52744['body'][_0x8ae8('0x63')],_['omit'](_0xc52744[_0x8ae8('0x43')],[_0x8ae8('0x63'),'id'])||{});}return null;})[_0x8ae8('0x64')](function(_0x2bf902){var _0x2c6ba3;var _0x2dda05;_0x208d4f=_0x2bf902||[];var _0x332acf=[];if(_0x2bf902){for(var _0x487e7a=0x0;_0x487e7a<_0x2bf902['length'];_0x487e7a+=0x1){var _0x26cfab=_0x2bf902[_0x487e7a][_0x8ae8('0x45')]({'plain':!![]});_0x2c6ba3=squel[_0x8ae8('0x7b')]()[_0x8ae8('0x66')]('cm_hopper_black')[_0x8ae8('0x68')]([_0x8ae8('0x6d'),_0x8ae8('0x6a'),_0x8ae8('0x6b'),'CampaignId',_0x8ae8('0x52'),_0x8ae8('0x51')],squel['select']()[_0x8ae8('0x6e')]('phone',_0x8ae8('0x6d'))[_0x8ae8('0x6e')]('id','ContactId')['field'](_0x26cfab['CmListId']['toString'](),_0x8ae8('0x6b'))['field'](_0xc52744[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x52'))[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x51'))['from'](_0x8ae8('0x8a'))['where'](_0x8ae8('0x73'))[_0x8ae8('0x37')](_0x8ae8('0x74'),_0x26cfab['CmListId'][_0x8ae8('0x71')]())['where'](_0x8ae8('0x75')))['toString']();_0x332acf['push'](db[_0x8ae8('0x84')]['query'](_0x2c6ba3));}return BPromise['all'](_0x332acf);}})['then'](function(){return _0x208d4f;})[_0x8ae8('0x20')](respondWithResult(_0x4bae66,null))[_0x8ae8('0x3e')](handleError(_0x4bae66,null));};exports['removeBlackLists']=function(_0x85110,_0x44e366,_0x4edc32){return db[_0x8ae8('0x28')]['find']({'where':{'id':_0x85110['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x44e366,null))[_0x8ae8('0x20')](function(_0x317d36){if(_0x317d36){return _0x317d36[_0x8ae8('0x8b')](_0x85110[_0x8ae8('0x2e')]['ids']);}})['then'](function(_0xc8d209){if(_0xc8d209){return db[_0x8ae8('0x5e')][_0x8ae8('0x54')]({'where':{'ListId':_0x85110['query'][_0x8ae8('0x63')],'CampaignId':_0x85110[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](function(){return _0xc8d209;});}})['then'](respondWithStatusCode(_0x44e366,null))['catch'](handleError(_0x44e366,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f04a187..b3aa8c4 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8bafbc1..41e7b80 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 _0x0fc8=['stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','include','map','model','debug','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x14a4d0,_0x4c7068){var _0x18c8ab=function(_0x10bd3b){while(--_0x10bd3b){_0x14a4d0['push'](_0x14a4d0['shift']());}};_0x18c8ab(++_0x4c7068);}(_0x0fc8,0x145));var _0x80fc=function(_0x91b641,_0x4b48a6){_0x91b641=_0x91b641-0x0;var _0x5340df=_0x0fc8[_0x91b641];return _0x5340df;};'use strict';var _=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80fc('0x2'));var db=require(_0x80fc('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x80fc('0x4'));var config=require('../../config/environment');var jayson=require(_0x80fc('0x5'));var client=jayson[_0x80fc('0x6')][_0x80fc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x116a2e,_0x1f64ab,_0x5cb645){return new BPromise(function(_0x14a3c4,_0x36e45f){return client['request'](_0x116a2e,_0x5cb645)[_0x80fc('0x8')](function(_0x43eb28){logger[_0x80fc('0x9')]('Campaign,\x20%s,\x20%s',_0x1f64ab,_0x80fc('0xa'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x1f64ab,_0x80fc('0xa'),JSON[_0x80fc('0xb')](_0x43eb28));if(_0x43eb28[_0x80fc('0xc')]){if(_0x43eb28[_0x80fc('0xc')][_0x80fc('0xd')]===0x1f4){logger[_0x80fc('0xc')](_0x80fc('0xe'),_0x1f64ab,_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);return _0x36e45f(_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);}logger[_0x80fc('0xc')](_0x80fc('0xe'),_0x1f64ab,_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);return _0x14a3c4(_0x43eb28[_0x80fc('0xc')][_0x80fc('0xf')]);}else{logger['info'](_0x80fc('0xe'),_0x1f64ab,'request\x20sent');_0x14a3c4(_0x43eb28[_0x80fc('0x10')][_0x80fc('0xf')]);}})[_0x80fc('0x11')](function(_0x5d105c){logger[_0x80fc('0xc')]('Campaign,\x20%s,\x20%s',_0x1f64ab,_0x5d105c);_0x36e45f(_0x5d105c);});});}exports[_0x80fc('0x12')]=function(_0x38f340){var _0x358007=this;return new Promise(function(_0x5205d5,_0x1b4a98){return db['Campaign'][_0x80fc('0x13')]({'raw':_0x38f340[_0x80fc('0x14')]?_0x38f340[_0x80fc('0x14')][_0x80fc('0x15')]===undefined?!![]:![]:!![],'where':_0x38f340[_0x80fc('0x14')]?_0x38f340[_0x80fc('0x14')][_0x80fc('0x16')]||null:null,'attributes':_0x38f340['options']?_0x38f340[_0x80fc('0x14')][_0x80fc('0x17')]||null:null,'limit':_0x38f340[_0x80fc('0x14')]?_0x38f340[_0x80fc('0x14')]['limit']||null:null,'include':_0x38f340[_0x80fc('0x14')]?_0x38f340[_0x80fc('0x14')][_0x80fc('0x18')]?_[_0x80fc('0x19')](_0x38f340['options'][_0x80fc('0x18')],function(_0xee9f08){return{'model':db[_0xee9f08[_0x80fc('0x1a')]],'as':_0xee9f08['as'],'attributes':_0xee9f08[_0x80fc('0x17')],'include':_0xee9f08[_0x80fc('0x18')]?_[_0x80fc('0x19')](_0xee9f08['include'],function(_0x5d2719){return{'model':db[_0x5d2719[_0x80fc('0x1a')]],'as':_0x5d2719['as'],'attributes':_0x5d2719[_0x80fc('0x17')],'include':_0x5d2719[_0x80fc('0x18')]?_[_0x80fc('0x19')](_0x5d2719[_0x80fc('0x18')],function(_0x32d839){return{'model':db[_0x32d839['model']],'as':_0x32d839['as'],'attributes':_0x32d839[_0x80fc('0x17')]};}):[]};}):[]};}):[]:[]})[_0x80fc('0x8')](function(_0x4888ce){logger[_0x80fc('0x9')]('GetCampaign',_0x38f340);logger[_0x80fc('0x1b')]('GetCampaign',_0x38f340,JSON[_0x80fc('0xb')](_0x4888ce));_0x5205d5(_0x4888ce);})[_0x80fc('0x11')](function(_0x1f32c9){logger[_0x80fc('0xc')](_0x80fc('0x12'),_0x1f32c9[_0x80fc('0xf')],_0x38f340);_0x1b4a98(_0x358007[_0x80fc('0xc')](0x1f4,_0x1f32c9[_0x80fc('0xf')]));});});}; \ No newline at end of file +var _0x8482=['Campaign,\x20%s,\x20%s','message','info','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53881d,_0x5b3c64){var _0x277c2c=function(_0x7f8f3){while(--_0x7f8f3){_0x53881d['push'](_0x53881d['shift']());}};_0x277c2c(++_0x5b3c64);}(_0x8482,0x14e));var _0x2848=function(_0xc33b75,_0x4c2b64){_0xc33b75=_0xc33b75-0x0;var _0x4470e7=_0x8482[_0xc33b75];return _0x4470e7;};'use strict';var _=require('lodash');var util=require(_0x2848('0x0'));var moment=require(_0x2848('0x1'));var BPromise=require(_0x2848('0x2'));var rs=require(_0x2848('0x3'));var fs=require('fs');var Redis=require(_0x2848('0x4'));var db=require(_0x2848('0x5'))['db'];var utils=require(_0x2848('0x6'));var logger=require(_0x2848('0x7'))(_0x2848('0x8'));var config=require(_0x2848('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2848('0xa')][_0x2848('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x503238,_0xeca507,_0x48c0f3){return new BPromise(function(_0x53c865,_0xff7900){return client['request'](_0x503238,_0x48c0f3)[_0x2848('0xc')](function(_0x4a117b){logger['info']('Campaign,\x20%s,\x20%s',_0xeca507,_0x2848('0xd'));logger[_0x2848('0xe')](_0x2848('0xf'),_0xeca507,_0x2848('0xd'),JSON[_0x2848('0x10')](_0x4a117b));if(_0x4a117b[_0x2848('0x11')]){if(_0x4a117b['error']['code']===0x1f4){logger[_0x2848('0x11')](_0x2848('0x12'),_0xeca507,_0x4a117b[_0x2848('0x11')]['message']);return _0xff7900(_0x4a117b[_0x2848('0x11')][_0x2848('0x13')]);}logger[_0x2848('0x11')]('Campaign,\x20%s,\x20%s',_0xeca507,_0x4a117b[_0x2848('0x11')]['message']);return _0x53c865(_0x4a117b[_0x2848('0x11')]['message']);}else{logger[_0x2848('0x14')](_0x2848('0x12'),_0xeca507,_0x2848('0xd'));_0x53c865(_0x4a117b['result']['message']);}})['catch'](function(_0x5f5616){logger[_0x2848('0x11')](_0x2848('0x12'),_0xeca507,_0x5f5616);_0xff7900(_0x5f5616);});});}exports[_0x2848('0x15')]=function(_0x46755c){var _0x3f9472=this;return new Promise(function(_0x3b4eeb,_0x34de28){return db[_0x2848('0x16')][_0x2848('0x17')]({'raw':_0x46755c[_0x2848('0x18')]?_0x46755c[_0x2848('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x46755c[_0x2848('0x18')]?_0x46755c[_0x2848('0x18')][_0x2848('0x19')]||null:null,'attributes':_0x46755c['options']?_0x46755c[_0x2848('0x18')][_0x2848('0x1a')]||null:null,'limit':_0x46755c[_0x2848('0x18')]?_0x46755c[_0x2848('0x18')][_0x2848('0x1b')]||null:null,'include':_0x46755c['options']?_0x46755c[_0x2848('0x18')][_0x2848('0x1c')]?_[_0x2848('0x1d')](_0x46755c[_0x2848('0x18')][_0x2848('0x1c')],function(_0x40f510){return{'model':db[_0x40f510['model']],'as':_0x40f510['as'],'attributes':_0x40f510[_0x2848('0x1a')],'include':_0x40f510['include']?_[_0x2848('0x1d')](_0x40f510[_0x2848('0x1c')],function(_0x2d936a){return{'model':db[_0x2d936a[_0x2848('0x1e')]],'as':_0x2d936a['as'],'attributes':_0x2d936a['attributes'],'include':_0x2d936a[_0x2848('0x1c')]?_[_0x2848('0x1d')](_0x2d936a[_0x2848('0x1c')],function(_0x2dc32e){return{'model':db[_0x2dc32e[_0x2848('0x1e')]],'as':_0x2dc32e['as'],'attributes':_0x2dc32e[_0x2848('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2848('0xc')](function(_0x4ec4b5){logger['info']('GetCampaign',_0x46755c);logger[_0x2848('0xe')](_0x2848('0x15'),_0x46755c,JSON[_0x2848('0x10')](_0x4ec4b5));_0x3b4eeb(_0x4ec4b5);})[_0x2848('0x1f')](function(_0x189701){logger[_0x2848('0x11')]('GetCampaign',_0x189701['message'],_0x46755c);_0x34de28(_0x3f9472[_0x2848('0x11')](0x1f4,_0x189701[_0x2848('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 486d97f..3cd96a3 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 _0xc964=['removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy'];(function(_0xc77c92,_0x8a9f1){var _0x51319b=function(_0x45b041){while(--_0x45b041){_0xc77c92['push'](_0xc77c92['shift']());}};_0x51319b(++_0x8a9f1);}(_0xc964,0x7e));var _0x4c96=function(_0x7724f8,_0x189ad5){_0x7724f8=_0x7724f8-0x0;var _0x399356=_0xc964[_0x7724f8];return _0x399356;};'use strict';var multer=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var timeout=require(_0x4c96('0x2'));var express=require(_0x4c96('0x3'));var router=express[_0x4c96('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c96('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c96('0x6'));var controller=require(_0x4c96('0x7'));router[_0x4c96('0x8')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0xa')]);router[_0x4c96('0x8')](_0x4c96('0xb'),auth['isAuthenticated'](),controller[_0x4c96('0xc')]);router[_0x4c96('0x8')](_0x4c96('0xd'),auth['isAuthenticated'](),controller[_0x4c96('0xe')]);router[_0x4c96('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x4c96('0x8')](_0x4c96('0xf'),auth[_0x4c96('0x9')](),controller['getHopperFinals']);router[_0x4c96('0x8')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x4c96('0x10')]);router[_0x4c96('0x8')](_0x4c96('0x11'),auth['isAuthenticated'](),controller['getLists']);router[_0x4c96('0x8')](_0x4c96('0x12'),auth[_0x4c96('0x9')](),controller['getBlackLists']);router[_0x4c96('0x13')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0x14')]);router[_0x4c96('0x13')](_0x4c96('0x15'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x16')]);router['post'](_0x4c96('0x11'),auth['isAuthenticated'](),controller[_0x4c96('0x17')]);router['post'](_0x4c96('0x12'),auth['isAuthenticated'](),controller[_0x4c96('0x18')]);router[_0x4c96('0x19')](_0x4c96('0xb'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x1a')]);router[_0x4c96('0x1b')](_0x4c96('0xb'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x1c')]);router[_0x4c96('0x1b')](_0x4c96('0x11'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x4c96('0x12'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x1d')]);module[_0x4c96('0x1e')]=router; \ No newline at end of file +var _0xb2ef=['get','index','show','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','clone','/:id/lists','addLists','addBlackLists','put','/:id','update','delete','destroy','removeLists','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller'];(function(_0x2ec0bc,_0x306615){var _0x349950=function(_0x11f613){while(--_0x11f613){_0x2ec0bc['push'](_0x2ec0bc['shift']());}};_0x349950(++_0x306615);}(_0xb2ef,0x7f));var _0xfb2e=function(_0x2d9c24,_0x562520){_0x2d9c24=_0x2d9c24-0x0;var _0x5a9d8f=_0xb2ef[_0x2d9c24];return _0x5a9d8f;};'use strict';var multer=require(_0xfb2e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfb2e('0x1'));var express=require(_0xfb2e('0x2'));var router=express[_0xfb2e('0x3')]();var fs_extra=require(_0xfb2e('0x4'));var auth=require(_0xfb2e('0x5'));var interaction=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var controller=require(_0xfb2e('0x8'));router[_0xfb2e('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb2e('0xa')]);router[_0xfb2e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xfb2e('0xb')]);router[_0xfb2e('0x9')]('/:id/hoppers',auth[_0xfb2e('0xc')](),controller['getHoppers']);router[_0xfb2e('0x9')](_0xfb2e('0xd'),auth['isAuthenticated'](),controller[_0xfb2e('0xe')]);router[_0xfb2e('0x9')](_0xfb2e('0xf'),auth[_0xfb2e('0xc')](),controller[_0xfb2e('0x10')]);router[_0xfb2e('0x9')](_0xfb2e('0x11'),auth[_0xfb2e('0xc')](),controller[_0xfb2e('0x12')]);router[_0xfb2e('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0xfb2e('0x13')]);router['get'](_0xfb2e('0x14'),auth['isAuthenticated'](),controller[_0xfb2e('0x15')]);router[_0xfb2e('0x16')]('/',auth[_0xfb2e('0xc')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xfb2e('0x17')]);router[_0xfb2e('0x16')](_0xfb2e('0x18'),auth[_0xfb2e('0xc')](),controller[_0xfb2e('0x19')]);router['post'](_0xfb2e('0x14'),auth['isAuthenticated'](),controller[_0xfb2e('0x1a')]);router[_0xfb2e('0x1b')](_0xfb2e('0x1c'),auth[_0xfb2e('0xc')](),controller[_0xfb2e('0x1d')]);router[_0xfb2e('0x1e')](_0xfb2e('0x1c'),auth['isAuthenticated'](),controller[_0xfb2e('0x1f')]);router[_0xfb2e('0x1e')]('/:id/lists',auth[_0xfb2e('0xc')](),controller[_0xfb2e('0x20')]);router['delete'](_0xfb2e('0x14'),auth[_0xfb2e('0xc')](),controller['removeBlackLists']);module[_0xfb2e('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index cc55a8b..56f478b 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 _0x88f6=['exports','STRING','TEXT','key'];(function(_0x1bc706,_0x45b1c4){var _0x38bc66=function(_0x305728){while(--_0x305728){_0x1bc706['push'](_0x1bc706['shift']());}};_0x38bc66(++_0x45b1c4);}(_0x88f6,0xfc));var _0x688f=function(_0x6d0248,_0x49838c){_0x6d0248=_0x6d0248-0x0;var _0x2004d7=_0x88f6[_0x6d0248];return _0x2004d7;};'use strict';var Sequelize=require('sequelize');module[_0x688f('0x0')]={'key':{'type':Sequelize[_0x688f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x688f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x688f('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x688f('0x3'));}}}; \ No newline at end of file +var _0x5de9=['STRING','VIRTUAL','getDataValue','sequelize','exports'];(function(_0x3e9be2,_0x256e3b){var _0x363017=function(_0x368dee){while(--_0x368dee){_0x3e9be2['push'](_0x3e9be2['shift']());}};_0x363017(++_0x256e3b);}(_0x5de9,0xda));var _0x95de=function(_0x39cc8f,_0xb60cd8){_0x39cc8f=_0x39cc8f-0x0;var _0x15e616=_0x5de9[_0x39cc8f];return _0x15e616;};'use strict';var Sequelize=require(_0x95de('0x0'));module[_0x95de('0x1')]={'key':{'type':Sequelize[_0x95de('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x95de('0x2')]},'name':{'type':Sequelize[_0x95de('0x3')],'get':function(){return this[_0x95de('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 74c76ad..86e92dc 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 _0x41f2=['MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','error','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x41f2,0x11f));var _0x241f=function(_0x549372,_0x294338){_0x549372=_0x549372-0x0;var _0x14c9f4=_0x41f2[_0x549372];return _0x14c9f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x241f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x241f('0x1'));var rp=require(_0x241f('0x2'));var moment=require(_0x241f('0x3'));var BPromise=require(_0x241f('0x4'));var Mustache=require(_0x241f('0x5'));var util=require('util');var path=require(_0x241f('0x6'));var sox=require(_0x241f('0x7'));var csv=require(_0x241f('0x8'));var ejs=require(_0x241f('0x9'));var fs=require('fs');var fs_extra=require(_0x241f('0xa'));var _=require(_0x241f('0xb'));var squel=require(_0x241f('0xc'));var crypto=require(_0x241f('0xd'));var jsforce=require(_0x241f('0xe'));var deskjs=require(_0x241f('0xf'));var toCsv=require(_0x241f('0x8'));var querystring=require(_0x241f('0x10'));var Papa=require(_0x241f('0x11'));var Redis=require('ioredis');var authService=require(_0x241f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x241f('0x13'));var hardwareService=require(_0x241f('0x14'));var logger=require(_0x241f('0x15'))('api');var utils=require(_0x241f('0x16'));var config=require(_0x241f('0x17'));var licenseUtil=require(_0x241f('0x18'));var db=require(_0x241f('0x19'))['db'];function respondWithStatusCode(_0x57b8b0,_0x41a58e){_0x41a58e=_0x41a58e||0xcc;return function(_0x2b8134){if(_0x2b8134){return _0x57b8b0[_0x241f('0x1a')](_0x41a58e);}return _0x57b8b0[_0x241f('0x1b')](_0x41a58e)[_0x241f('0x1c')]();};}function respondWithResult(_0x5bc955,_0x39b40b){_0x39b40b=_0x39b40b||0xc8;return function(_0x7f3033){if(_0x7f3033){return _0x5bc955['status'](_0x39b40b)[_0x241f('0x1d')](_0x7f3033);}};}function respondWithFilteredResult(_0x13da4d,_0x4d4f18){return function(_0x306f7c){if(_0x306f7c){var _0x314db1=typeof _0x4d4f18[_0x241f('0x1e')]==='undefined'&&typeof _0x4d4f18[_0x241f('0x1f')]===_0x241f('0x20');var _0x31d965=_0x306f7c[_0x241f('0x21')];var _0x482dc5=_0x314db1?0x0:_0x4d4f18[_0x241f('0x1e')];var _0x20c684=_0x314db1?_0x306f7c[_0x241f('0x21')]:_0x4d4f18[_0x241f('0x1e')]+_0x4d4f18[_0x241f('0x1f')];var _0x57e637;if(_0x20c684>=_0x31d965){_0x20c684=_0x31d965;_0x57e637=0xc8;}else{_0x57e637=0xce;}_0x13da4d[_0x241f('0x1b')](_0x57e637);return _0x13da4d[_0x241f('0x22')]('Content-Range',_0x482dc5+'-'+_0x20c684+'/'+_0x31d965)[_0x241f('0x1d')](_0x306f7c);}return null;};}function patchUpdates(_0x48e1fc){return function(_0x305244){try{jsonpatch[_0x241f('0x23')](_0x305244,_0x48e1fc,!![]);}catch(_0x29014d){return BPromise[_0x241f('0x24')](_0x29014d);}return _0x305244[_0x241f('0x25')]();};}function saveUpdates(_0x39d100,_0x4c12f4){return function(_0x10ac89){if(_0x10ac89){return _0x10ac89[_0x241f('0x26')](_0x39d100)[_0x241f('0x27')](function(_0xc9e092){return _0xc9e092;});}return null;};}function removeEntity(_0x44d908,_0x4e8c77){return function(_0x397c6d){if(_0x397c6d){return _0x397c6d[_0x241f('0x28')]()[_0x241f('0x27')](function(){var _0x516114=_0x397c6d[_0x241f('0x29')]({'plain':!![]});var _0x182d64='CannedAnswers';return db['UserProfileResource'][_0x241f('0x28')]({'where':{'type':_0x182d64,'resourceId':_0x516114['id']}})['then'](function(){return _0x397c6d;});})[_0x241f('0x27')](function(){_0x44d908['status'](0xcc)[_0x241f('0x1c')]();});}};}function handleEntityNotFound(_0xf10c23,_0x341772){return function(_0x461bba){if(!_0x461bba){_0xf10c23['sendStatus'](0x194);}return _0x461bba;};}function handleError(_0x881cdf,_0x2cfb5a){_0x2cfb5a=_0x2cfb5a||0x1f4;return function(_0x4c752a){logger['error'](_0x4c752a['stack']);if(_0x4c752a[_0x241f('0x2a')]){delete _0x4c752a[_0x241f('0x2a')];}_0x881cdf['status'](_0x2cfb5a)[_0x241f('0x2b')](_0x4c752a);};}exports[_0x241f('0x2c')]=function(_0xf77f93,_0x5cfe27){var _0x3e92af={},_0x8d1a9f={},_0x4c39fe={'count':0x0,'rows':[]};var _0x3b8232=_[_0x241f('0x2d')](db[_0x241f('0x2e')][_0x241f('0x2f')],function(_0x56788f){return{'name':_0x56788f[_0x241f('0x30')],'type':_0x56788f[_0x241f('0x31')][_0x241f('0x32')]};});_0x8d1a9f[_0x241f('0x33')]=_['map'](_0x3b8232,_0x241f('0x2a'));_0x8d1a9f[_0x241f('0x34')]=_[_0x241f('0x35')](_0xf77f93[_0x241f('0x34')]);_0x8d1a9f[_0x241f('0x36')]=_[_0x241f('0x37')](_0x8d1a9f['model'],_0x8d1a9f[_0x241f('0x34')]);_0x3e92af[_0x241f('0x38')]=_['intersection'](_0x8d1a9f[_0x241f('0x33')],qs['fields'](_0xf77f93[_0x241f('0x34')][_0x241f('0x39')]));_0x3e92af[_0x241f('0x38')]=_0x3e92af['attributes'][_0x241f('0x3a')]?_0x3e92af[_0x241f('0x38')]:_0x8d1a9f[_0x241f('0x33')];if(!_0xf77f93[_0x241f('0x34')][_0x241f('0x3b')](_0x241f('0x3c'))){_0x3e92af[_0x241f('0x1f')]=qs[_0x241f('0x1f')](_0xf77f93['query'][_0x241f('0x1f')]);_0x3e92af['offset']=qs[_0x241f('0x1e')](_0xf77f93[_0x241f('0x34')][_0x241f('0x1e')]);}_0x3e92af[_0x241f('0x3d')]=qs['sort'](_0xf77f93[_0x241f('0x34')]['sort']);_0x3e92af[_0x241f('0x3e')]=qs['filters'](_[_0x241f('0x3f')](_0xf77f93[_0x241f('0x34')],_0x8d1a9f[_0x241f('0x36')]),_0x3b8232);if(_0xf77f93[_0x241f('0x34')]['filter']){_0x3e92af[_0x241f('0x3e')]=_[_0x241f('0x40')](_0x3e92af['where'],{'$or':[{'key':{'$like':'%'+_0xf77f93[_0x241f('0x34')][_0x241f('0x41')]+'%'}},{'value':{'$like':'%'+_0xf77f93[_0x241f('0x34')]['filter']+'%'}}]});}_0x3e92af=_[_0x241f('0x40')]({},_0x3e92af,_0xf77f93[_0x241f('0x42')]);var _0x2912e9={'where':_0x3e92af[_0x241f('0x3e')]};return db[_0x241f('0x2e')][_0x241f('0x21')](_0x2912e9)[_0x241f('0x27')](function(_0xef5bff){_0x4c39fe['count']=_0xef5bff;if(_0xf77f93[_0x241f('0x34')][_0x241f('0x43')]){_0x3e92af[_0x241f('0x44')]=[{'all':!![]}];}return db[_0x241f('0x2e')][_0x241f('0x45')](_0x3e92af);})[_0x241f('0x27')](function(_0x68aab9){_0x4c39fe[_0x241f('0x46')]=_0x68aab9;return _0x4c39fe;})['then'](respondWithFilteredResult(_0x5cfe27,_0x3e92af))[_0x241f('0x47')](handleError(_0x5cfe27,null));};exports[_0x241f('0x48')]=function(_0x257231,_0x33f047){var _0x430a33={'raw':!![],'where':{'id':_0x257231[_0x241f('0x49')]['id']}},_0x1bfdd6={};_0x1bfdd6[_0x241f('0x33')]=_[_0x241f('0x35')](db[_0x241f('0x2e')][_0x241f('0x2f')]);_0x1bfdd6[_0x241f('0x34')]=_[_0x241f('0x35')](_0x257231[_0x241f('0x34')]);_0x1bfdd6[_0x241f('0x36')]=_[_0x241f('0x37')](_0x1bfdd6['model'],_0x1bfdd6[_0x241f('0x34')]);_0x430a33[_0x241f('0x38')]=_[_0x241f('0x37')](_0x1bfdd6[_0x241f('0x33')],qs[_0x241f('0x39')](_0x257231['query'][_0x241f('0x39')]));_0x430a33['attributes']=_0x430a33[_0x241f('0x38')][_0x241f('0x3a')]?_0x430a33['attributes']:_0x1bfdd6['model'];if(_0x257231[_0x241f('0x34')][_0x241f('0x43')]){_0x430a33[_0x241f('0x44')]=[{'all':!![]}];}_0x430a33=_['merge']({},_0x430a33,_0x257231[_0x241f('0x42')]);return db[_0x241f('0x2e')][_0x241f('0x4a')](_0x430a33)[_0x241f('0x27')](handleEntityNotFound(_0x33f047,null))[_0x241f('0x27')](respondWithResult(_0x33f047,null))[_0x241f('0x47')](handleError(_0x33f047,null));};exports[_0x241f('0x26')]=function(_0x4b8833,_0x5ee204){if(_0x4b8833['body']['id']){delete _0x4b8833[_0x241f('0x4b')]['id'];}return db[_0x241f('0x2e')][_0x241f('0x4a')]({'where':{'id':_0x4b8833[_0x241f('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ee204,null))[_0x241f('0x27')](saveUpdates(_0x4b8833['body'],null))[_0x241f('0x27')](respondWithResult(_0x5ee204,null))['catch'](handleError(_0x5ee204,null));};exports[_0x241f('0x28')]=function(_0xac1272,_0x43c6cd){return db['CannedAnswer'][_0x241f('0x4a')]({'where':{'id':_0xac1272[_0x241f('0x49')]['id']}})[_0x241f('0x27')](handleEntityNotFound(_0x43c6cd,null))[_0x241f('0x27')](removeEntity(_0x43c6cd,null))['catch'](handleError(_0x43c6cd,null));};exports[_0x241f('0x4c')]=function(_0x504675,_0x498946){var _0x4c4a04={'key':_0x504675[_0x241f('0x4b')][_0x241f('0x32')]};if(_0x504675[_0x241f('0x4b')]['MailAccountId']){_0x4c4a04[_0x241f('0x4d')]=_0x504675['body'][_0x241f('0x4d')];}else if(_0x504675['body'][_0x241f('0x4e')]){_0x4c4a04['SmsAccountId']=_0x504675['body'][_0x241f('0x4e')];}else if(_0x504675[_0x241f('0x4b')][_0x241f('0x4f')]){_0x4c4a04['OpenchannelAccountId']=_0x504675[_0x241f('0x4b')]['OpenchannelAccountId'];}else if(_0x504675[_0x241f('0x4b')][_0x241f('0x50')]){_0x4c4a04[_0x241f('0x50')]=_0x504675[_0x241f('0x4b')][_0x241f('0x50')];}return db[_0x241f('0x2e')]['find']({'where':_0x4c4a04})[_0x241f('0x27')](function(_0x359186){if(_0x359186){throw new db[(_0x241f('0x51'))][(_0x241f('0x52'))](_0x241f('0x53'));}return db[_0x241f('0x2e')][_0x241f('0x4c')](_0x504675['body']);})[_0x241f('0x27')](function(_0x1016fd){var _0x3db97d=_0x504675['user']['get']({'plain':!![]});if(!_0x3db97d)throw new Error(_0x241f('0x54'));if(_0x3db97d[_0x241f('0x55')]===_0x241f('0x56')){var _0x1e45d1=_0x1016fd[_0x241f('0x29')]({'plain':!![]});return db[_0x241f('0x57')][_0x241f('0x4a')]({'where':{'name':'CannedAnswers','userProfileId':_0x3db97d[_0x241f('0x58')]},'raw':!![]})[_0x241f('0x27')](function(_0x353f09){if(_0x353f09&&_0x353f09['autoAssociation']===0x0){return db[_0x241f('0x59')]['create']({'name':_0x1e45d1[_0x241f('0x2a')],'resourceId':_0x1e45d1['id'],'type':_0x353f09[_0x241f('0x2a')],'sectionId':_0x353f09['id']},{})['then'](function(){return _0x1016fd;});}else{return _0x1016fd;}})[_0x241f('0x47')](function(_0xe5a5f4){logger[_0x241f('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe5a5f4);throw _0xe5a5f4;});}return _0x1016fd;})['then'](respondWithResult(_0x498946,0xc9))['catch'](handleError(_0x498946,null));}; \ No newline at end of file +var _0x5eb4=['include','options','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','CannedAnswer','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eb4,0x1dd));var _0x45eb=function(_0x5f0cdd,_0x34916e){_0x5f0cdd=_0x5f0cdd-0x0;var _0x5f0d29=_0x5eb4[_0x5f0cdd];return _0x5f0d29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45eb('0x0'));var zipdir=require(_0x45eb('0x1'));var jsonpatch=require(_0x45eb('0x2'));var rp=require(_0x45eb('0x3'));var moment=require(_0x45eb('0x4'));var BPromise=require(_0x45eb('0x5'));var Mustache=require(_0x45eb('0x6'));var util=require('util');var path=require(_0x45eb('0x7'));var sox=require(_0x45eb('0x8'));var csv=require('to-csv');var ejs=require(_0x45eb('0x9'));var fs=require('fs');var fs_extra=require(_0x45eb('0xa'));var _=require(_0x45eb('0xb'));var squel=require(_0x45eb('0xc'));var crypto=require(_0x45eb('0xd'));var jsforce=require(_0x45eb('0xe'));var deskjs=require(_0x45eb('0xf'));var toCsv=require(_0x45eb('0x10'));var querystring=require('querystring');var Papa=require(_0x45eb('0x11'));var Redis=require(_0x45eb('0x12'));var authService=require(_0x45eb('0x13'));var qs=require(_0x45eb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45eb('0x15'));var logger=require('../../config/logger')(_0x45eb('0x16'));var utils=require('../../config/utils');var config=require(_0x45eb('0x17'));var licenseUtil=require(_0x45eb('0x18'));var db=require(_0x45eb('0x19'))['db'];function respondWithStatusCode(_0x39cfea,_0x47fdb4){_0x47fdb4=_0x47fdb4||0xcc;return function(_0x453007){if(_0x453007){return _0x39cfea[_0x45eb('0x1a')](_0x47fdb4);}return _0x39cfea[_0x45eb('0x1b')](_0x47fdb4)[_0x45eb('0x1c')]();};}function respondWithResult(_0x1e99ae,_0x2f4e34){_0x2f4e34=_0x2f4e34||0xc8;return function(_0x30575b){if(_0x30575b){return _0x1e99ae['status'](_0x2f4e34)[_0x45eb('0x1d')](_0x30575b);}};}function respondWithFilteredResult(_0x22ccee,_0x1e4df3){return function(_0x3143db){if(_0x3143db){var _0x1c50b7=typeof _0x1e4df3['offset']==='undefined'&&typeof _0x1e4df3[_0x45eb('0x1e')]===_0x45eb('0x1f');var _0x1110ee=_0x3143db[_0x45eb('0x20')];var _0x22319c=_0x1c50b7?0x0:_0x1e4df3['offset'];var _0x36be98=_0x1c50b7?_0x3143db[_0x45eb('0x20')]:_0x1e4df3[_0x45eb('0x21')]+_0x1e4df3[_0x45eb('0x1e')];var _0x1c2573;if(_0x36be98>=_0x1110ee){_0x36be98=_0x1110ee;_0x1c2573=0xc8;}else{_0x1c2573=0xce;}_0x22ccee[_0x45eb('0x1b')](_0x1c2573);return _0x22ccee[_0x45eb('0x22')](_0x45eb('0x23'),_0x22319c+'-'+_0x36be98+'/'+_0x1110ee)['json'](_0x3143db);}return null;};}function patchUpdates(_0x1d6f21){return function(_0x3f945b){try{jsonpatch[_0x45eb('0x24')](_0x3f945b,_0x1d6f21,!![]);}catch(_0x5735c2){return BPromise[_0x45eb('0x25')](_0x5735c2);}return _0x3f945b['save']();};}function saveUpdates(_0x2df586,_0x203a43){return function(_0x441a43){if(_0x441a43){return _0x441a43[_0x45eb('0x26')](_0x2df586)[_0x45eb('0x27')](function(_0x1624b0){return _0x1624b0;});}return null;};}function removeEntity(_0x944245,_0x84104c){return function(_0x4099ca){if(_0x4099ca){return _0x4099ca[_0x45eb('0x28')]()[_0x45eb('0x27')](function(){var _0x3ed20a=_0x4099ca[_0x45eb('0x29')]({'plain':!![]});var _0x13ef6f=_0x45eb('0x2a');return db[_0x45eb('0x2b')]['destroy']({'where':{'type':_0x13ef6f,'resourceId':_0x3ed20a['id']}})[_0x45eb('0x27')](function(){return _0x4099ca;});})[_0x45eb('0x27')](function(){_0x944245['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7234,_0x303352){return function(_0x49d666){if(!_0x49d666){_0x2b7234[_0x45eb('0x1a')](0x194);}return _0x49d666;};}function handleError(_0x55a75c,_0x4efb0d){_0x4efb0d=_0x4efb0d||0x1f4;return function(_0x23de60){logger[_0x45eb('0x2c')](_0x23de60[_0x45eb('0x2d')]);if(_0x23de60['name']){delete _0x23de60[_0x45eb('0x2e')];}_0x55a75c[_0x45eb('0x1b')](_0x4efb0d)[_0x45eb('0x2f')](_0x23de60);};}exports[_0x45eb('0x30')]=function(_0x2dc9d1,_0x84d22e){var _0x156531={},_0x16bbc1={},_0x53aea5={'count':0x0,'rows':[]};var _0x16cfd1=_['map'](db[_0x45eb('0x31')]['rawAttributes'],function(_0x552895){return{'name':_0x552895[_0x45eb('0x32')],'type':_0x552895['type'][_0x45eb('0x33')]};});_0x16bbc1['model']=_[_0x45eb('0x34')](_0x16cfd1,_0x45eb('0x2e'));_0x16bbc1[_0x45eb('0x35')]=_[_0x45eb('0x36')](_0x2dc9d1[_0x45eb('0x35')]);_0x16bbc1[_0x45eb('0x37')]=_[_0x45eb('0x38')](_0x16bbc1[_0x45eb('0x39')],_0x16bbc1[_0x45eb('0x35')]);_0x156531[_0x45eb('0x3a')]=_[_0x45eb('0x38')](_0x16bbc1[_0x45eb('0x39')],qs[_0x45eb('0x3b')](_0x2dc9d1[_0x45eb('0x35')][_0x45eb('0x3b')]));_0x156531[_0x45eb('0x3a')]=_0x156531[_0x45eb('0x3a')][_0x45eb('0x3c')]?_0x156531[_0x45eb('0x3a')]:_0x16bbc1[_0x45eb('0x39')];if(!_0x2dc9d1[_0x45eb('0x35')][_0x45eb('0x3d')](_0x45eb('0x3e'))){_0x156531[_0x45eb('0x1e')]=qs['limit'](_0x2dc9d1[_0x45eb('0x35')][_0x45eb('0x1e')]);_0x156531['offset']=qs[_0x45eb('0x21')](_0x2dc9d1['query'][_0x45eb('0x21')]);}_0x156531[_0x45eb('0x3f')]=qs[_0x45eb('0x40')](_0x2dc9d1[_0x45eb('0x35')][_0x45eb('0x40')]);_0x156531[_0x45eb('0x41')]=qs[_0x45eb('0x37')](_[_0x45eb('0x42')](_0x2dc9d1[_0x45eb('0x35')],_0x16bbc1[_0x45eb('0x37')]),_0x16cfd1);if(_0x2dc9d1[_0x45eb('0x35')]['filter']){_0x156531['where']=_[_0x45eb('0x43')](_0x156531['where'],{'$or':[{'key':{'$like':'%'+_0x2dc9d1[_0x45eb('0x35')]['filter']+'%'}},{'value':{'$like':'%'+_0x2dc9d1['query'][_0x45eb('0x44')]+'%'}}]});}_0x156531=_[_0x45eb('0x43')]({},_0x156531,_0x2dc9d1['options']);var _0x455d0d={'where':_0x156531[_0x45eb('0x41')]};return db['CannedAnswer'][_0x45eb('0x20')](_0x455d0d)[_0x45eb('0x27')](function(_0x178f5d){_0x53aea5['count']=_0x178f5d;if(_0x2dc9d1[_0x45eb('0x35')][_0x45eb('0x45')]){_0x156531['include']=[{'all':!![]}];}return db[_0x45eb('0x31')][_0x45eb('0x46')](_0x156531);})[_0x45eb('0x27')](function(_0x39365e){_0x53aea5[_0x45eb('0x47')]=_0x39365e;return _0x53aea5;})['then'](respondWithFilteredResult(_0x84d22e,_0x156531))[_0x45eb('0x48')](handleError(_0x84d22e,null));};exports[_0x45eb('0x49')]=function(_0x45295e,_0x14b374){var _0x1d477c={'raw':!![],'where':{'id':_0x45295e[_0x45eb('0x4a')]['id']}},_0xdc3f3b={};_0xdc3f3b[_0x45eb('0x39')]=_[_0x45eb('0x36')](db['CannedAnswer']['rawAttributes']);_0xdc3f3b[_0x45eb('0x35')]=_[_0x45eb('0x36')](_0x45295e[_0x45eb('0x35')]);_0xdc3f3b[_0x45eb('0x37')]=_[_0x45eb('0x38')](_0xdc3f3b[_0x45eb('0x39')],_0xdc3f3b[_0x45eb('0x35')]);_0x1d477c[_0x45eb('0x3a')]=_[_0x45eb('0x38')](_0xdc3f3b[_0x45eb('0x39')],qs['fields'](_0x45295e['query']['fields']));_0x1d477c['attributes']=_0x1d477c[_0x45eb('0x3a')][_0x45eb('0x3c')]?_0x1d477c[_0x45eb('0x3a')]:_0xdc3f3b[_0x45eb('0x39')];if(_0x45295e[_0x45eb('0x35')]['includeAll']){_0x1d477c[_0x45eb('0x4b')]=[{'all':!![]}];}_0x1d477c=_[_0x45eb('0x43')]({},_0x1d477c,_0x45295e[_0x45eb('0x4c')]);return db[_0x45eb('0x31')]['find'](_0x1d477c)[_0x45eb('0x27')](handleEntityNotFound(_0x14b374,null))[_0x45eb('0x27')](respondWithResult(_0x14b374,null))[_0x45eb('0x48')](handleError(_0x14b374,null));};exports[_0x45eb('0x26')]=function(_0x159cc5,_0x19548f){if(_0x159cc5[_0x45eb('0x4d')]['id']){delete _0x159cc5[_0x45eb('0x4d')]['id'];}return db[_0x45eb('0x31')][_0x45eb('0x4e')]({'where':{'id':_0x159cc5[_0x45eb('0x4a')]['id']}})[_0x45eb('0x27')](handleEntityNotFound(_0x19548f,null))['then'](saveUpdates(_0x159cc5['body'],null))['then'](respondWithResult(_0x19548f,null))[_0x45eb('0x48')](handleError(_0x19548f,null));};exports[_0x45eb('0x28')]=function(_0x2a012a,_0x24259a){return db['CannedAnswer'][_0x45eb('0x4e')]({'where':{'id':_0x2a012a['params']['id']}})[_0x45eb('0x27')](handleEntityNotFound(_0x24259a,null))[_0x45eb('0x27')](removeEntity(_0x24259a,null))['catch'](handleError(_0x24259a,null));};exports['create']=function(_0x37d8a3,_0x596c4f){var _0x2499bf={'key':_0x37d8a3[_0x45eb('0x4d')][_0x45eb('0x33')]};if(_0x37d8a3['body'][_0x45eb('0x4f')]){_0x2499bf[_0x45eb('0x4f')]=_0x37d8a3[_0x45eb('0x4d')]['MailAccountId'];}else if(_0x37d8a3['body'][_0x45eb('0x50')]){_0x2499bf[_0x45eb('0x50')]=_0x37d8a3[_0x45eb('0x4d')][_0x45eb('0x50')];}else if(_0x37d8a3[_0x45eb('0x4d')]['OpenchannelAccountId']){_0x2499bf['OpenchannelAccountId']=_0x37d8a3['body'][_0x45eb('0x51')];}else if(_0x37d8a3[_0x45eb('0x4d')]['ChatWebsiteId']){_0x2499bf[_0x45eb('0x52')]=_0x37d8a3['body'][_0x45eb('0x52')];}return db[_0x45eb('0x31')][_0x45eb('0x4e')]({'where':_0x2499bf})['then'](function(_0x18f5da){if(_0x18f5da){throw new db[(_0x45eb('0x53'))][(_0x45eb('0x54'))](_0x45eb('0x55'));}return db[_0x45eb('0x31')]['create'](_0x37d8a3[_0x45eb('0x4d')]);})[_0x45eb('0x27')](function(_0x38043c){var _0x4dc0d1=_0x37d8a3[_0x45eb('0x56')][_0x45eb('0x29')]({'plain':!![]});if(!_0x4dc0d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dc0d1[_0x45eb('0x57')]===_0x45eb('0x56')){var _0x5799e1=_0x38043c['get']({'plain':!![]});return db[_0x45eb('0x58')][_0x45eb('0x4e')]({'where':{'name':_0x45eb('0x2a'),'userProfileId':_0x4dc0d1[_0x45eb('0x59')]},'raw':!![]})[_0x45eb('0x27')](function(_0x2689d3){if(_0x2689d3&&_0x2689d3['autoAssociation']===0x0){return db['UserProfileResource'][_0x45eb('0x5a')]({'name':_0x5799e1['name'],'resourceId':_0x5799e1['id'],'type':_0x2689d3[_0x45eb('0x2e')],'sectionId':_0x2689d3['id']},{})[_0x45eb('0x27')](function(){return _0x38043c;});}else{return _0x38043c;}})[_0x45eb('0x48')](function(_0x2a306e){logger[_0x45eb('0x2c')](_0x45eb('0x5b'),_0x2a306e);throw _0x2a306e;});}return _0x38043c;})[_0x45eb('0x27')](respondWithResult(_0x596c4f,0xc9))[_0x45eb('0x48')](handleError(_0x596c4f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2cd2487..767a247 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 _0x49c9=['bluebird','rimraf','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4','lodash','util','api','moment'];(function(_0x11d258,_0x13b4ab){var _0x566b6b=function(_0xd34df0){while(--_0xd34df0){_0x11d258['push'](_0x11d258['shift']());}};_0x566b6b(++_0x13b4ab);}(_0x49c9,0x164));var _0x949c=function(_0x52a379,_0x2d6ae1){_0x52a379=_0x52a379-0x0;var _0x504030=_0x49c9[_0x52a379];return _0x504030;};'use strict';var _=require(_0x949c('0x0'));var util=require(_0x949c('0x1'));var logger=require('../../config/logger')(_0x949c('0x2'));var moment=require(_0x949c('0x3'));var BPromise=require(_0x949c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x949c('0x5'));var config=require('../../config/environment');var attributes=require(_0x949c('0x6'));module['exports']=function(_0x477a38,_0x4a5e52){return _0x477a38[_0x949c('0x7')]('CannedAnswer',attributes,{'tableName':_0x949c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x949c('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0093=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x135d48,_0xf216e7){var _0xd7a790=function(_0x55c6ba){while(--_0x55c6ba){_0x135d48['push'](_0x135d48['shift']());}};_0xd7a790(++_0xf216e7);}(_0x0093,0x168));var _0x3009=function(_0x3812d8,_0x16c100){_0x3812d8=_0x3812d8-0x0;var _0x57bef3=_0x0093[_0x3812d8];return _0x57bef3;};'use strict';var _=require(_0x3009('0x0'));var util=require('util');var logger=require(_0x3009('0x1'))(_0x3009('0x2'));var moment=require(_0x3009('0x3'));var BPromise=require('bluebird');var rp=require(_0x3009('0x4'));var fs=require('fs');var path=require(_0x3009('0x5'));var rimraf=require('rimraf');var config=require(_0x3009('0x6'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x47464b,_0x2e6790){return _0x47464b[_0x3009('0x7')](_0x3009('0x8'),attributes,{'tableName':_0x3009('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3009('0xa'),'collate':_0x3009('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 003f851..c0481bc 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(_0xb60e46,_0x7575b){var _0x2841de=function(_0x2ce70b){while(--_0x2ce70b){_0xb60e46['push'](_0xb60e46['shift']());}};_0x2841de(++_0x7575b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x48ee6d,_0x57e4f9){var _0x1f5a71=function(_0x2ef857){while(--_0x2ef857){_0x48ee6d['push'](_0x48ee6d['shift']());}};_0x1f5a71(++_0x57e4f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 b9388f5..9d67a62 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 _0x12bb=['create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','show'];(function(_0x6dd03e,_0x62f1e4){var _0x21f06e=function(_0x11f30e){while(--_0x11f30e){_0x6dd03e['push'](_0x6dd03e['shift']());}};_0x21f06e(++_0x62f1e4);}(_0x12bb,0x8c));var _0xb12b=function(_0x4f606e,_0x112826){_0x4f606e=_0x4f606e-0x0;var _0x3b84df=_0x12bb[_0x4f606e];return _0x3b84df;};'use strict';var multer=require(_0xb12b('0x0'));var util=require('util');var path=require(_0xb12b('0x1'));var timeout=require(_0xb12b('0x2'));var express=require(_0xb12b('0x3'));var router=express[_0xb12b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb12b('0x5'));var config=require(_0xb12b('0x6'));var controller=require(_0xb12b('0x7'));router['get']('/',auth[_0xb12b('0x8')](),controller[_0xb12b('0x9')]);router[_0xb12b('0xa')](_0xb12b('0xb'),auth[_0xb12b('0x8')](),controller[_0xb12b('0xc')]);router['post']('/',auth[_0xb12b('0x8')](),controller[_0xb12b('0xd')]);router[_0xb12b('0xe')](_0xb12b('0xb'),auth[_0xb12b('0x8')](),controller[_0xb12b('0xf')]);router[_0xb12b('0x10')](_0xb12b('0xb'),auth[_0xb12b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x24e4=['update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','get','/:id','show','put'];(function(_0x405387,_0x2a657b){var _0x2930bc=function(_0x3b6d16){while(--_0x3b6d16){_0x405387['push'](_0x405387['shift']());}};_0x2930bc(++_0x2a657b);}(_0x24e4,0x168));var _0x424e=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x24e4[_0x2bc3f4];return _0x14ac53;};'use strict';var multer=require(_0x424e('0x0'));var util=require('util');var path=require(_0x424e('0x1'));var timeout=require(_0x424e('0x2'));var express=require(_0x424e('0x3'));var router=express[_0x424e('0x4')]();var fs_extra=require(_0x424e('0x5'));var auth=require(_0x424e('0x6'));var interaction=require(_0x424e('0x7'));var config=require('../../config/environment');var controller=require(_0x424e('0x8'));router['get']('/',auth[_0x424e('0x9')](),controller['index']);router[_0x424e('0xa')](_0x424e('0xb'),auth[_0x424e('0x9')](),controller[_0x424e('0xc')]);router['post']('/',auth[_0x424e('0x9')](),controller['create']);router[_0x424e('0xd')](_0x424e('0xb'),auth['isAuthenticated'](),controller[_0x424e('0xe')]);router['delete'](_0x424e('0xb'),auth[_0x424e('0x9')](),controller[_0x424e('0xf')]);module[_0x424e('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 42b49a8..0712187 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 _0x38a5=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38a5,0x69));var _0x538a=function(_0x5ad7e4,_0x234ef8){_0x5ad7e4=_0x5ad7e4-0x0;var _0x258fc2=_0x38a5[_0x5ad7e4];return _0x258fc2;};'use strict';var Sequelize=require(_0x538a('0x0'));module[_0x538a('0x1')]={'calldate':{'type':Sequelize[_0x538a('0x2')],'allowNull':![],'defaultValue':_0x538a('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x538a('0x4')]},'dst':{'type':Sequelize[_0x538a('0x4')]},'dcontext':{'type':Sequelize[_0x538a('0x4')]},'channel':{'type':Sequelize[_0x538a('0x4')]},'dstchannel':{'type':Sequelize[_0x538a('0x4')]},'lastapp':{'type':Sequelize[_0x538a('0x4')]},'lastdata':{'type':Sequelize[_0x538a('0x4')]},'duration':{'type':Sequelize[_0x538a('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x538a('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x538a('0x4')]},'amaflags':{'type':Sequelize[_0x538a('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x538a('0x4')]},'userfield':{'type':Sequelize[_0x538a('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x538a('0x4')]},'peeraccount':{'type':Sequelize[_0x538a('0x4')]},'type':{'type':Sequelize[_0x538a('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5620=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5620,0xbf));var _0x0562=function(_0x26f866,_0x1900bc){_0x26f866=_0x26f866-0x0;var _0x1abef3=_0x5620[_0x26f866];return _0x1abef3;};'use strict';var Sequelize=require(_0x0562('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x0562('0x1')],'allowNull':![],'defaultValue':_0x0562('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x0562('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x0562('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0562('0x3')]},'duration':{'type':Sequelize[_0x0562('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0562('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0562('0x3')]},'amaflags':{'type':Sequelize[_0x0562('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0562('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0562('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x0562('0x3')]},'type':{'type':Sequelize[_0x0562('0x3')]},'tag':{'type':Sequelize[_0x0562('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 8212994..c6e24b0 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 _0xbfe8=['mustache','util','sox','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','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','reject','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','Cdr','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x427494,_0x1095f7){_0x427494=_0x427494-0x0;var _0x22802a=_0xbfe8[_0x427494];return _0x22802a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bfe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bfe('0x1'));var rp=require(_0x8bfe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8bfe('0x3'));var util=require(_0x8bfe('0x4'));var path=require('path');var sox=require(_0x8bfe('0x5'));var csv=require(_0x8bfe('0x6'));var ejs=require(_0x8bfe('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bfe('0x8'));var squel=require(_0x8bfe('0x9'));var crypto=require(_0x8bfe('0xa'));var jsforce=require(_0x8bfe('0xb'));var deskjs=require(_0x8bfe('0xc'));var toCsv=require(_0x8bfe('0x6'));var querystring=require(_0x8bfe('0xd'));var Papa=require(_0x8bfe('0xe'));var Redis=require(_0x8bfe('0xf'));var authService=require(_0x8bfe('0x10'));var qs=require(_0x8bfe('0x11'));var as=require(_0x8bfe('0x12'));var hardwareService=require(_0x8bfe('0x13'));var logger=require(_0x8bfe('0x14'))(_0x8bfe('0x15'));var utils=require('../../config/utils');var config=require(_0x8bfe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bfe('0x17'))['db'];function respondWithStatusCode(_0x2f479d,_0x22a131){_0x22a131=_0x22a131||0xcc;return function(_0x5ba48c){if(_0x5ba48c){return _0x2f479d['sendStatus'](_0x22a131);}return _0x2f479d[_0x8bfe('0x18')](_0x22a131)[_0x8bfe('0x19')]();};}function respondWithResult(_0x22737f,_0x36fd25){_0x36fd25=_0x36fd25||0xc8;return function(_0x46c8e3){if(_0x46c8e3){return _0x22737f['status'](_0x36fd25)[_0x8bfe('0x1a')](_0x46c8e3);}};}function respondWithFilteredResult(_0x5520d7,_0x55914b){return function(_0x778f01){if(_0x778f01){var _0xe57cb1=typeof _0x55914b[_0x8bfe('0x1b')]==='undefined'&&typeof _0x55914b['limit']===_0x8bfe('0x1c');var _0x5019ba=_0x778f01['count'];var _0x2e7c29=_0xe57cb1?0x0:_0x55914b[_0x8bfe('0x1b')];var _0x5d8bf1=_0xe57cb1?_0x778f01[_0x8bfe('0x1d')]:_0x55914b[_0x8bfe('0x1b')]+_0x55914b[_0x8bfe('0x1e')];var _0x3b0837;if(_0x5d8bf1>=_0x5019ba){_0x5d8bf1=_0x5019ba;_0x3b0837=0xc8;}else{_0x3b0837=0xce;}_0x5520d7['status'](_0x3b0837);return _0x5520d7[_0x8bfe('0x1f')]('Content-Range',_0x2e7c29+'-'+_0x5d8bf1+'/'+_0x5019ba)[_0x8bfe('0x1a')](_0x778f01);}return null;};}function patchUpdates(_0x3f8050){return function(_0x3c6e7b){try{jsonpatch['apply'](_0x3c6e7b,_0x3f8050,!![]);}catch(_0x55af8c){return BPromise[_0x8bfe('0x20')](_0x55af8c);}return _0x3c6e7b['save']();};}function saveUpdates(_0x55f5bc,_0xef5e81){return function(_0x5397fb){if(_0x5397fb){return _0x5397fb[_0x8bfe('0x21')](_0x55f5bc)['then'](function(_0x34043a){return _0x34043a;});}return null;};}function removeEntity(_0x19058e,_0x42a93f){return function(_0x260dd9){if(_0x260dd9){return _0x260dd9['destroy']()[_0x8bfe('0x22')](function(){_0x19058e[_0x8bfe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f73d0,_0x1789f7){return function(_0x46526f){if(!_0x46526f){_0x2f73d0[_0x8bfe('0x23')](0x194);}return _0x46526f;};}function handleError(_0x2dc8d5,_0x91271f){_0x91271f=_0x91271f||0x1f4;return function(_0x4fcb3a){logger[_0x8bfe('0x24')](_0x4fcb3a[_0x8bfe('0x25')]);if(_0x4fcb3a[_0x8bfe('0x26')]){delete _0x4fcb3a[_0x8bfe('0x26')];}_0x2dc8d5[_0x8bfe('0x18')](_0x91271f)[_0x8bfe('0x27')](_0x4fcb3a);};}exports[_0x8bfe('0x28')]=function(_0x2cbfb3,_0x15fccc){var _0x2b47c6={},_0x3c6a3c={},_0x597651={'count':0x0,'rows':[]};var _0xdf4c3f=_[_0x8bfe('0x29')](db['Cdr'][_0x8bfe('0x2a')],function(_0x2e86ee){return{'name':_0x2e86ee[_0x8bfe('0x2b')],'type':_0x2e86ee['type'][_0x8bfe('0x2c')]};});_0x3c6a3c[_0x8bfe('0x2d')]=_['map'](_0xdf4c3f,'name');_0x3c6a3c[_0x8bfe('0x2e')]=_[_0x8bfe('0x2f')](_0x2cbfb3[_0x8bfe('0x2e')]);_0x3c6a3c[_0x8bfe('0x30')]=_[_0x8bfe('0x31')](_0x3c6a3c[_0x8bfe('0x2d')],_0x3c6a3c[_0x8bfe('0x2e')]);_0x2b47c6[_0x8bfe('0x32')]=_[_0x8bfe('0x31')](_0x3c6a3c[_0x8bfe('0x2d')],qs['fields'](_0x2cbfb3['query'][_0x8bfe('0x33')]));_0x2b47c6[_0x8bfe('0x32')]=_0x2b47c6[_0x8bfe('0x32')][_0x8bfe('0x34')]?_0x2b47c6[_0x8bfe('0x32')]:_0x3c6a3c[_0x8bfe('0x2d')];if(!_0x2cbfb3[_0x8bfe('0x2e')]['hasOwnProperty'](_0x8bfe('0x35'))){_0x2b47c6[_0x8bfe('0x1e')]=qs['limit'](_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x1e')]);_0x2b47c6[_0x8bfe('0x1b')]=qs[_0x8bfe('0x1b')](_0x2cbfb3[_0x8bfe('0x2e')]['offset']);}_0x2b47c6[_0x8bfe('0x36')]=qs['sort'](_0x2cbfb3['query']['sort']);_0x2b47c6['where']=qs[_0x8bfe('0x30')](_[_0x8bfe('0x37')](_0x2cbfb3[_0x8bfe('0x2e')],_0x3c6a3c[_0x8bfe('0x30')]),_0xdf4c3f);if(_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x38')]){_0x2b47c6[_0x8bfe('0x39')]=_['merge'](_0x2b47c6[_0x8bfe('0x39')],{'$or':_['map'](_0xdf4c3f,function(_0x5c5801){if(_0x5c5801['type']!==_0x8bfe('0x3a')){var _0x65a1a3={};_0x65a1a3[_0x5c5801[_0x8bfe('0x26')]]={'$like':'%'+_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x38')]+'%'};return _0x65a1a3;}})});}_0x2b47c6=_[_0x8bfe('0x3b')]({},_0x2b47c6,_0x2cbfb3[_0x8bfe('0x3c')]);var _0x20b085={'where':_0x2b47c6['where']};return db['Cdr'][_0x8bfe('0x1d')](_0x20b085)[_0x8bfe('0x22')](function(_0x36d23c){_0x597651[_0x8bfe('0x1d')]=_0x36d23c;if(_0x2cbfb3[_0x8bfe('0x2e')][_0x8bfe('0x3d')]){_0x2b47c6[_0x8bfe('0x3e')]=[{'all':!![]}];}return db[_0x8bfe('0x3f')][_0x8bfe('0x40')](_0x2b47c6);})['then'](function(_0x62a6e2){_0x597651[_0x8bfe('0x41')]=_0x62a6e2;return _0x597651;})[_0x8bfe('0x22')](respondWithFilteredResult(_0x15fccc,_0x2b47c6))[_0x8bfe('0x42')](handleError(_0x15fccc,null));};exports[_0x8bfe('0x43')]=function(_0x234edc,_0x403456){var _0x55814c={'raw':!![],'where':{'id':_0x234edc[_0x8bfe('0x44')]['id']}},_0x25d26f={};_0x25d26f['model']=_[_0x8bfe('0x2f')](db['Cdr']['rawAttributes']);_0x25d26f[_0x8bfe('0x2e')]=_[_0x8bfe('0x2f')](_0x234edc[_0x8bfe('0x2e')]);_0x25d26f['filters']=_[_0x8bfe('0x31')](_0x25d26f['model'],_0x25d26f[_0x8bfe('0x2e')]);_0x55814c[_0x8bfe('0x32')]=_['intersection'](_0x25d26f[_0x8bfe('0x2d')],qs[_0x8bfe('0x33')](_0x234edc[_0x8bfe('0x2e')][_0x8bfe('0x33')]));_0x55814c['attributes']=_0x55814c[_0x8bfe('0x32')][_0x8bfe('0x34')]?_0x55814c[_0x8bfe('0x32')]:_0x25d26f['model'];if(_0x234edc['query'][_0x8bfe('0x3d')]){_0x55814c[_0x8bfe('0x3e')]=[{'all':!![]}];}_0x55814c=_[_0x8bfe('0x3b')]({},_0x55814c,_0x234edc[_0x8bfe('0x3c')]);return db[_0x8bfe('0x3f')][_0x8bfe('0x45')](_0x55814c)[_0x8bfe('0x22')](handleEntityNotFound(_0x403456,null))[_0x8bfe('0x22')](respondWithResult(_0x403456,null))['catch'](handleError(_0x403456,null));};exports[_0x8bfe('0x46')]=function(_0x2af8fa,_0x4e6949){return db['Cdr'][_0x8bfe('0x46')](_0x2af8fa[_0x8bfe('0x47')],{})[_0x8bfe('0x22')](respondWithResult(_0x4e6949,0xc9))['catch'](handleError(_0x4e6949,null));};exports[_0x8bfe('0x21')]=function(_0x3c4086,_0x55ad6e){if(_0x3c4086[_0x8bfe('0x47')]['id']){delete _0x3c4086[_0x8bfe('0x47')]['id'];}return db[_0x8bfe('0x3f')][_0x8bfe('0x45')]({'where':{'id':_0x3c4086[_0x8bfe('0x44')]['id']}})[_0x8bfe('0x22')](handleEntityNotFound(_0x55ad6e,null))['then'](saveUpdates(_0x3c4086['body'],null))['then'](respondWithResult(_0x55ad6e,null))['catch'](handleError(_0x55ad6e,null));};exports[_0x8bfe('0x48')]=function(_0x2b84a3,_0x36e938){return db[_0x8bfe('0x3f')][_0x8bfe('0x45')]({'where':{'id':_0x2b84a3['params']['id']}})[_0x8bfe('0x22')](handleEntityNotFound(_0x36e938,null))[_0x8bfe('0x22')](removeEntity(_0x36e938,null))[_0x8bfe('0x42')](handleError(_0x36e938,null));};exports[_0x8bfe('0x49')]=function(_0x3c6cbc,_0x43a0c5){return db['Cdr'][_0x8bfe('0x49')]()[_0x8bfe('0x22')](respondWithResult(_0x43a0c5,null))['catch'](handleError(_0x43a0c5,null));}; \ No newline at end of file +var _0xfc17=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','Cdr','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x557d4e,_0x37a3f4){var _0x171de9=function(_0xfcb133){while(--_0xfcb133){_0x557d4e['push'](_0x557d4e['shift']());}};_0x171de9(++_0x37a3f4);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x14d48b,_0x75de1f){_0x14d48b=_0x14d48b-0x0;var _0x314c41=_0xfc17[_0x14d48b];return _0x314c41;};'use strict';var emlformat=require(_0x7fc1('0x0'));var rimraf=require(_0x7fc1('0x1'));var zipdir=require(_0x7fc1('0x2'));var jsonpatch=require(_0x7fc1('0x3'));var rp=require('request-promise');var moment=require(_0x7fc1('0x4'));var BPromise=require(_0x7fc1('0x5'));var Mustache=require(_0x7fc1('0x6'));var util=require(_0x7fc1('0x7'));var path=require(_0x7fc1('0x8'));var sox=require(_0x7fc1('0x9'));var csv=require('to-csv');var ejs=require(_0x7fc1('0xa'));var fs=require('fs');var fs_extra=require(_0x7fc1('0xb'));var _=require(_0x7fc1('0xc'));var squel=require(_0x7fc1('0xd'));var crypto=require(_0x7fc1('0xe'));var jsforce=require(_0x7fc1('0xf'));var deskjs=require(_0x7fc1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fc1('0x11'));var Papa=require(_0x7fc1('0x12'));var Redis=require(_0x7fc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fc1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc1('0x15'))(_0x7fc1('0x16'));var utils=require(_0x7fc1('0x17'));var config=require(_0x7fc1('0x18'));var licenseUtil=require(_0x7fc1('0x19'));var db=require(_0x7fc1('0x1a'))['db'];function respondWithStatusCode(_0x53277f,_0x3a7c8e){_0x3a7c8e=_0x3a7c8e||0xcc;return function(_0x902325){if(_0x902325){return _0x53277f[_0x7fc1('0x1b')](_0x3a7c8e);}return _0x53277f[_0x7fc1('0x1c')](_0x3a7c8e)[_0x7fc1('0x1d')]();};}function respondWithResult(_0x5651f2,_0x54a204){_0x54a204=_0x54a204||0xc8;return function(_0x881462){if(_0x881462){return _0x5651f2[_0x7fc1('0x1c')](_0x54a204)[_0x7fc1('0x1e')](_0x881462);}};}function respondWithFilteredResult(_0x391de7,_0x432825){return function(_0x3c4671){if(_0x3c4671){var _0x3d8e82=typeof _0x432825[_0x7fc1('0x1f')]===_0x7fc1('0x20')&&typeof _0x432825[_0x7fc1('0x21')]==='undefined';var _0x419170=_0x3c4671['count'];var _0x30fc04=_0x3d8e82?0x0:_0x432825[_0x7fc1('0x1f')];var _0x535ae1=_0x3d8e82?_0x3c4671[_0x7fc1('0x22')]:_0x432825[_0x7fc1('0x1f')]+_0x432825['limit'];var _0x25d384;if(_0x535ae1>=_0x419170){_0x535ae1=_0x419170;_0x25d384=0xc8;}else{_0x25d384=0xce;}_0x391de7[_0x7fc1('0x1c')](_0x25d384);return _0x391de7[_0x7fc1('0x23')](_0x7fc1('0x24'),_0x30fc04+'-'+_0x535ae1+'/'+_0x419170)[_0x7fc1('0x1e')](_0x3c4671);}return null;};}function patchUpdates(_0x1c249d){return function(_0x3e7c92){try{jsonpatch[_0x7fc1('0x25')](_0x3e7c92,_0x1c249d,!![]);}catch(_0x327569){return BPromise[_0x7fc1('0x26')](_0x327569);}return _0x3e7c92['save']();};}function saveUpdates(_0x49a44f,_0x2390b8){return function(_0x5e10cd){if(_0x5e10cd){return _0x5e10cd[_0x7fc1('0x27')](_0x49a44f)[_0x7fc1('0x28')](function(_0x253ae9){return _0x253ae9;});}return null;};}function removeEntity(_0x3683f4,_0x56c5d6){return function(_0x38b5b5){if(_0x38b5b5){return _0x38b5b5[_0x7fc1('0x29')]()[_0x7fc1('0x28')](function(){_0x3683f4['status'](0xcc)[_0x7fc1('0x1d')]();});}};}function handleEntityNotFound(_0x252b18,_0x5ddc11){return function(_0x4b24d6){if(!_0x4b24d6){_0x252b18[_0x7fc1('0x1b')](0x194);}return _0x4b24d6;};}function handleError(_0x293a2a,_0x1f58ca){_0x1f58ca=_0x1f58ca||0x1f4;return function(_0x2ae7db){logger['error'](_0x2ae7db[_0x7fc1('0x2a')]);if(_0x2ae7db[_0x7fc1('0x2b')]){delete _0x2ae7db[_0x7fc1('0x2b')];}_0x293a2a[_0x7fc1('0x1c')](_0x1f58ca)['send'](_0x2ae7db);};}exports[_0x7fc1('0x2c')]=function(_0x583e60,_0x1f7fce){var _0x22a3c1={},_0x34ec70={},_0x231913={'count':0x0,'rows':[]};var _0x2317f5=_['map'](db[_0x7fc1('0x2d')]['rawAttributes'],function(_0x55b4f1){return{'name':_0x55b4f1[_0x7fc1('0x2e')],'type':_0x55b4f1[_0x7fc1('0x2f')][_0x7fc1('0x30')]};});_0x34ec70[_0x7fc1('0x31')]=_[_0x7fc1('0x32')](_0x2317f5,_0x7fc1('0x2b'));_0x34ec70[_0x7fc1('0x33')]=_[_0x7fc1('0x34')](_0x583e60[_0x7fc1('0x33')]);_0x34ec70[_0x7fc1('0x35')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],_0x34ec70[_0x7fc1('0x33')]);_0x22a3c1[_0x7fc1('0x37')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],qs['fields'](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x22a3c1[_0x7fc1('0x37')]=_0x22a3c1[_0x7fc1('0x37')][_0x7fc1('0x39')]?_0x22a3c1[_0x7fc1('0x37')]:_0x34ec70['model'];if(!_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3a')]('nolimit')){_0x22a3c1[_0x7fc1('0x21')]=qs[_0x7fc1('0x21')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x21')]);_0x22a3c1[_0x7fc1('0x1f')]=qs['offset'](_0x583e60['query'][_0x7fc1('0x1f')]);}_0x22a3c1[_0x7fc1('0x3b')]=qs[_0x7fc1('0x3c')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3c')]);_0x22a3c1[_0x7fc1('0x3d')]=qs[_0x7fc1('0x35')](_[_0x7fc1('0x3e')](_0x583e60['query'],_0x34ec70[_0x7fc1('0x35')]),_0x2317f5);if(_0x583e60[_0x7fc1('0x33')]['filter']){_0x22a3c1[_0x7fc1('0x3d')]=_[_0x7fc1('0x3f')](_0x22a3c1[_0x7fc1('0x3d')],{'$or':_['map'](_0x2317f5,function(_0x57ef4c){if(_0x57ef4c[_0x7fc1('0x2f')]!==_0x7fc1('0x40')){var _0xafc8b0={};_0xafc8b0[_0x57ef4c['name']]={'$like':'%'+_0x583e60['query']['filter']+'%'};return _0xafc8b0;}})});}_0x22a3c1=_[_0x7fc1('0x3f')]({},_0x22a3c1,_0x583e60[_0x7fc1('0x41')]);var _0x32607c={'where':_0x22a3c1[_0x7fc1('0x3d')]};return db['Cdr']['count'](_0x32607c)[_0x7fc1('0x28')](function(_0xf26d98){_0x231913[_0x7fc1('0x22')]=_0xf26d98;if(_0x583e60['query']['includeAll']){_0x22a3c1['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x22a3c1);})[_0x7fc1('0x28')](function(_0x54749f){_0x231913[_0x7fc1('0x42')]=_0x54749f;return _0x231913;})[_0x7fc1('0x28')](respondWithFilteredResult(_0x1f7fce,_0x22a3c1))['catch'](handleError(_0x1f7fce,null));};exports[_0x7fc1('0x43')]=function(_0x16ad03,_0x111d51){var _0x3282dd={'raw':!![],'where':{'id':_0x16ad03[_0x7fc1('0x44')]['id']}},_0x56b853={};_0x56b853['model']=_[_0x7fc1('0x34')](db[_0x7fc1('0x2d')][_0x7fc1('0x45')]);_0x56b853[_0x7fc1('0x33')]=_['keys'](_0x16ad03[_0x7fc1('0x33')]);_0x56b853[_0x7fc1('0x35')]=_['intersection'](_0x56b853[_0x7fc1('0x31')],_0x56b853[_0x7fc1('0x33')]);_0x3282dd['attributes']=_[_0x7fc1('0x36')](_0x56b853[_0x7fc1('0x31')],qs['fields'](_0x16ad03[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x3282dd[_0x7fc1('0x37')]=_0x3282dd['attributes'][_0x7fc1('0x39')]?_0x3282dd[_0x7fc1('0x37')]:_0x56b853[_0x7fc1('0x31')];if(_0x16ad03[_0x7fc1('0x33')]['includeAll']){_0x3282dd['include']=[{'all':!![]}];}_0x3282dd=_[_0x7fc1('0x3f')]({},_0x3282dd,_0x16ad03[_0x7fc1('0x41')]);return db[_0x7fc1('0x2d')][_0x7fc1('0x46')](_0x3282dd)[_0x7fc1('0x28')](handleEntityNotFound(_0x111d51,null))[_0x7fc1('0x28')](respondWithResult(_0x111d51,null))[_0x7fc1('0x47')](handleError(_0x111d51,null));};exports[_0x7fc1('0x48')]=function(_0x419ea1,_0x4c4606){return db['Cdr']['create'](_0x419ea1[_0x7fc1('0x49')],{})[_0x7fc1('0x28')](respondWithResult(_0x4c4606,0xc9))[_0x7fc1('0x47')](handleError(_0x4c4606,null));};exports[_0x7fc1('0x27')]=function(_0x4bcd63,_0xafd821){if(_0x4bcd63[_0x7fc1('0x49')]['id']){delete _0x4bcd63[_0x7fc1('0x49')]['id'];}return db[_0x7fc1('0x2d')]['find']({'where':{'id':_0x4bcd63[_0x7fc1('0x44')]['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0xafd821,null))[_0x7fc1('0x28')](saveUpdates(_0x4bcd63[_0x7fc1('0x49')],null))[_0x7fc1('0x28')](respondWithResult(_0xafd821,null))[_0x7fc1('0x47')](handleError(_0xafd821,null));};exports[_0x7fc1('0x29')]=function(_0x4d27db,_0x3d5f40){return db['Cdr'][_0x7fc1('0x46')]({'where':{'id':_0x4d27db['params']['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0x3d5f40,null))[_0x7fc1('0x28')](removeEntity(_0x3d5f40,null))['catch'](handleError(_0x3d5f40,null));};exports[_0x7fc1('0x4a')]=function(_0x3b492a,_0x509959){return db[_0x7fc1('0x2d')][_0x7fc1('0x4a')]()[_0x7fc1('0x28')](respondWithResult(_0x509959,null))[_0x7fc1('0x47')](handleError(_0x509959,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7b3b455..21a0352 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(_0x1b1457,_0x4b754){var _0x4858ca=function(_0x37cabe){while(--_0x37cabe){_0x1b1457['push'](_0x1b1457['shift']());}};_0x4858ca(++_0x4b754);}(_0x7a54,0x106));var _0x47a5=function(_0x51f87d,_0x39e939){_0x51f87d=_0x51f87d-0x0;var _0x22b2b4=_0x7a54[_0x51f87d];return _0x22b2b4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5562d4,_0x1d89f1){var _0x54593c=function(_0x18f65e){while(--_0x18f65e){_0x5562d4['push'](_0x5562d4['shift']());}};_0x54593c(++_0x1d89f1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0773c92..452484b 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 _0xbc33=['code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Cdr,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x3ac53e,_0x4834ca){var _0x274cea=function(_0x3187f7){while(--_0x3187f7){_0x3ac53e['push'](_0x3ac53e['shift']());}};_0x274cea(++_0x4834ca);}(_0xbc33,0x12f));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3bc3('0x0'));var util=require(_0x3bc3('0x1'));var moment=require(_0x3bc3('0x2'));var BPromise=require(_0x3bc3('0x3'));var rs=require(_0x3bc3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3bc3('0x5'));var logger=require(_0x3bc3('0x6'))(_0x3bc3('0x7'));var config=require('../../config/environment');var jayson=require(_0x3bc3('0x8'));var client=jayson[_0x3bc3('0x9')][_0x3bc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46c839,_0x180c1c,_0x4f1113){return new BPromise(function(_0x2b9f9b,_0x2b750e){return client['request'](_0x46c839,_0x4f1113)['then'](function(_0x3bd159){logger[_0x3bc3('0xb')](_0x3bc3('0xc'),_0x180c1c,'request\x20sent');logger[_0x3bc3('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x180c1c,_0x3bc3('0xe'),JSON[_0x3bc3('0xf')](_0x3bd159));if(_0x3bd159[_0x3bc3('0x10')]){if(_0x3bd159[_0x3bc3('0x10')][_0x3bc3('0x11')]===0x1f4){logger['error'](_0x3bc3('0xc'),_0x180c1c,_0x3bd159['error'][_0x3bc3('0x12')]);return _0x2b750e(_0x3bd159[_0x3bc3('0x10')][_0x3bc3('0x12')]);}logger['error'](_0x3bc3('0xc'),_0x180c1c,_0x3bd159[_0x3bc3('0x10')][_0x3bc3('0x12')]);return _0x2b9f9b(_0x3bd159[_0x3bc3('0x10')][_0x3bc3('0x12')]);}else{logger[_0x3bc3('0xb')](_0x3bc3('0xc'),_0x180c1c,_0x3bc3('0xe'));_0x2b9f9b(_0x3bd159[_0x3bc3('0x13')][_0x3bc3('0x12')]);}})['catch'](function(_0x38517f){logger['error'](_0x3bc3('0xc'),_0x180c1c,_0x38517f);_0x2b750e(_0x38517f);});});} \ No newline at end of file +var _0x0b0d=['then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x0b0d,0x7e));var _0xd0b0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0b0d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xd0b0('0x0'));var util=require(_0xd0b0('0x1'));var moment=require(_0xd0b0('0x2'));var BPromise=require(_0xd0b0('0x3'));var rs=require(_0xd0b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0b0('0x5'))['db'];var utils=require(_0xd0b0('0x6'));var logger=require('../../config/logger')(_0xd0b0('0x7'));var config=require(_0xd0b0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd0b0('0x9')][_0xd0b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21edf0,_0xf0be61,_0x1716b4){return new BPromise(function(_0x2a3d16,_0x3abdc8){return client[_0xd0b0('0xb')](_0x21edf0,_0x1716b4)[_0xd0b0('0xc')](function(_0x3e08c7){logger[_0xd0b0('0xd')]('Cdr,\x20%s,\x20%s',_0xf0be61,'request\x20sent');logger[_0xd0b0('0xe')](_0xd0b0('0xf'),_0xf0be61,'request\x20sent',JSON[_0xd0b0('0x10')](_0x3e08c7));if(_0x3e08c7[_0xd0b0('0x11')]){if(_0x3e08c7[_0xd0b0('0x11')]['code']===0x1f4){logger[_0xd0b0('0x11')](_0xd0b0('0x12'),_0xf0be61,_0x3e08c7['error']['message']);return _0x3abdc8(_0x3e08c7[_0xd0b0('0x11')][_0xd0b0('0x13')]);}logger[_0xd0b0('0x11')]('Cdr,\x20%s,\x20%s',_0xf0be61,_0x3e08c7[_0xd0b0('0x11')][_0xd0b0('0x13')]);return _0x2a3d16(_0x3e08c7[_0xd0b0('0x11')][_0xd0b0('0x13')]);}else{logger[_0xd0b0('0xd')]('Cdr,\x20%s,\x20%s',_0xf0be61,_0xd0b0('0x14'));_0x2a3d16(_0x3e08c7[_0xd0b0('0x15')]['message']);}})[_0xd0b0('0x16')](function(_0x1d1ddf){logger[_0xd0b0('0x11')](_0xd0b0('0x12'),_0xf0be61,_0x1d1ddf);_0x3abdc8(_0x1d1ddf);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5828773..d022cde 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x20ba6d,_0x256177){var _0x338188=function(_0x568977){while(--_0x568977){_0x20ba6d['push'](_0x20ba6d['shift']());}};_0x338188(++_0x256177);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f8c5f7e..5696b90 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 _0x3add=['STRING','noop','TEXT','*,*,*,*'];(function(_0x54e7d5,_0x5dd1c1){var _0xea9fa4=function(_0x1ba3d5){while(--_0x1ba3d5){_0x54e7d5['push'](_0x54e7d5['shift']());}};_0xea9fa4(++_0x5dd1c1);}(_0x3add,0xf8));var _0xd3ad=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x3add[_0x4d35f3];return _0x382fea;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd3ad('0x0')],'allowNull':![],'defaultValue':_0xd3ad('0x1')},'appdata':{'type':Sequelize[_0xd3ad('0x2')]()},'description':{'type':Sequelize[_0xd3ad('0x0')]},'interval':{'type':Sequelize[_0xd3ad('0x0')],'defaultValue':_0xd3ad('0x3')}}; \ No newline at end of file +var _0x1a60=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x27757e,_0x525247){var _0x43d7eb=function(_0x30239c){while(--_0x30239c){_0x27757e['push'](_0x27757e['shift']());}};_0x43d7eb(++_0x525247);}(_0x1a60,0x11c));var _0x01a6=function(_0x7600b4,_0x249467){_0x7600b4=_0x7600b4-0x0;var _0x3bca17=_0x1a60[_0x7600b4];return _0x3bca17;};'use strict';var Sequelize=require('sequelize');module[_0x01a6('0x0')]={'priority':{'type':Sequelize[_0x01a6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x01a6('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x01a6('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x01a6('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3a71a4f..f2a1592 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 _0x37e9=['model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','params'];(function(_0x2f1e15,_0x1be139){var _0x3fdb2d=function(_0xaf29f1){while(--_0xaf29f1){_0x2f1e15['push'](_0x2f1e15['shift']());}};_0x3fdb2d(++_0x1be139);}(_0x37e9,0x1e7));var _0x937e=function(_0x157505,_0x230e2a){_0x157505=_0x157505-0x0;var _0x271cbf=_0x37e9[_0x157505];return _0x271cbf;};'use strict';var emlformat=require(_0x937e('0x0'));var rimraf=require(_0x937e('0x1'));var zipdir=require(_0x937e('0x2'));var jsonpatch=require(_0x937e('0x3'));var rp=require(_0x937e('0x4'));var moment=require(_0x937e('0x5'));var BPromise=require(_0x937e('0x6'));var Mustache=require('mustache');var util=require(_0x937e('0x7'));var path=require(_0x937e('0x8'));var sox=require(_0x937e('0x9'));var csv=require(_0x937e('0xa'));var ejs=require(_0x937e('0xb'));var fs=require('fs');var fs_extra=require(_0x937e('0xc'));var _=require('lodash');var squel=require(_0x937e('0xd'));var crypto=require(_0x937e('0xe'));var jsforce=require(_0x937e('0xf'));var deskjs=require(_0x937e('0x10'));var toCsv=require(_0x937e('0xa'));var querystring=require(_0x937e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x937e('0x12'));var qs=require(_0x937e('0x13'));var as=require(_0x937e('0x14'));var hardwareService=require(_0x937e('0x15'));var logger=require(_0x937e('0x16'))(_0x937e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x937e('0x18'))['db'];function respondWithStatusCode(_0x284f27,_0x49a1b6){_0x49a1b6=_0x49a1b6||0xcc;return function(_0x216c24){if(_0x216c24){return _0x284f27[_0x937e('0x19')](_0x49a1b6);}return _0x284f27[_0x937e('0x1a')](_0x49a1b6)[_0x937e('0x1b')]();};}function respondWithResult(_0x4f4f21,_0x369119){_0x369119=_0x369119||0xc8;return function(_0x1ea9e2){if(_0x1ea9e2){return _0x4f4f21[_0x937e('0x1a')](_0x369119)[_0x937e('0x1c')](_0x1ea9e2);}};}function respondWithFilteredResult(_0x5ab042,_0x2ebfdd){return function(_0x3b09ff){if(_0x3b09ff){var _0x4499a2=typeof _0x2ebfdd[_0x937e('0x1d')]===_0x937e('0x1e')&&typeof _0x2ebfdd[_0x937e('0x1f')]===_0x937e('0x1e');var _0x16682c=_0x3b09ff['count'];var _0x5a1542=_0x4499a2?0x0:_0x2ebfdd[_0x937e('0x1d')];var _0x13683f=_0x4499a2?_0x3b09ff[_0x937e('0x20')]:_0x2ebfdd[_0x937e('0x1d')]+_0x2ebfdd[_0x937e('0x1f')];var _0x1d740e;if(_0x13683f>=_0x16682c){_0x13683f=_0x16682c;_0x1d740e=0xc8;}else{_0x1d740e=0xce;}_0x5ab042[_0x937e('0x1a')](_0x1d740e);return _0x5ab042[_0x937e('0x21')](_0x937e('0x22'),_0x5a1542+'-'+_0x13683f+'/'+_0x16682c)['json'](_0x3b09ff);}return null;};}function patchUpdates(_0x25c1e3){return function(_0x155f36){try{jsonpatch['apply'](_0x155f36,_0x25c1e3,!![]);}catch(_0x58e262){return BPromise[_0x937e('0x23')](_0x58e262);}return _0x155f36[_0x937e('0x24')]();};}function saveUpdates(_0x5706b1,_0x3de0f2){return function(_0x5ae493){if(_0x5ae493){return _0x5ae493[_0x937e('0x25')](_0x5706b1)[_0x937e('0x26')](function(_0x218ddc){return _0x218ddc;});}return null;};}function removeEntity(_0xdf7ea8,_0x132ece){return function(_0x58d3dc){if(_0x58d3dc){return _0x58d3dc[_0x937e('0x27')]()[_0x937e('0x26')](function(){_0xdf7ea8[_0x937e('0x1a')](0xcc)[_0x937e('0x1b')]();});}};}function handleEntityNotFound(_0x41ab49,_0x42d4da){return function(_0x486eaa){if(!_0x486eaa){_0x41ab49[_0x937e('0x19')](0x194);}return _0x486eaa;};}function handleError(_0xcfeba2,_0x2ee185){_0x2ee185=_0x2ee185||0x1f4;return function(_0x41ea93){logger['error'](_0x41ea93[_0x937e('0x28')]);if(_0x41ea93[_0x937e('0x29')]){delete _0x41ea93[_0x937e('0x29')];}_0xcfeba2[_0x937e('0x1a')](_0x2ee185)[_0x937e('0x2a')](_0x41ea93);};}exports['show']=function(_0x222078,_0x380999){var _0x518ebd={'raw':!![],'where':{'id':_0x222078[_0x937e('0x2b')]['id']}},_0x8ec885={};_0x8ec885[_0x937e('0x2c')]=_['keys'](db[_0x937e('0x2d')][_0x937e('0x2e')]);_0x8ec885[_0x937e('0x2f')]=_[_0x937e('0x30')](_0x222078[_0x937e('0x2f')]);_0x8ec885[_0x937e('0x31')]=_[_0x937e('0x32')](_0x8ec885[_0x937e('0x2c')],_0x8ec885[_0x937e('0x2f')]);_0x518ebd[_0x937e('0x33')]=_[_0x937e('0x32')](_0x8ec885[_0x937e('0x2c')],qs[_0x937e('0x34')](_0x222078[_0x937e('0x2f')][_0x937e('0x34')]));_0x518ebd[_0x937e('0x33')]=_0x518ebd[_0x937e('0x33')][_0x937e('0x35')]?_0x518ebd[_0x937e('0x33')]:_0x8ec885['model'];if(_0x222078['query'][_0x937e('0x36')]){_0x518ebd[_0x937e('0x37')]=[{'all':!![]}];}_0x518ebd=_['merge']({},_0x518ebd,_0x222078['options']);return db[_0x937e('0x2d')][_0x937e('0x38')](_0x518ebd)[_0x937e('0x26')](handleEntityNotFound(_0x380999,null))[_0x937e('0x26')](respondWithResult(_0x380999,null))[_0x937e('0x39')](handleError(_0x380999,null));};exports[_0x937e('0x25')]=function(_0x5712f0,_0x3056f7){if(_0x5712f0[_0x937e('0x3a')]['id']){delete _0x5712f0['body']['id'];}return db[_0x937e('0x2d')][_0x937e('0x38')]({'where':{'id':_0x5712f0[_0x937e('0x2b')]['id']}})[_0x937e('0x26')](handleEntityNotFound(_0x3056f7,null))[_0x937e('0x26')](saveUpdates(_0x5712f0[_0x937e('0x3a')],null))['then'](respondWithResult(_0x3056f7,null))[_0x937e('0x39')](handleError(_0x3056f7,null));};exports[_0x937e('0x27')]=function(_0x4fc5ee,_0x42a560){return db[_0x937e('0x2d')][_0x937e('0x38')]({'where':{'id':_0x4fc5ee[_0x937e('0x2b')]['id']}})[_0x937e('0x26')](handleEntityNotFound(_0x42a560,null))[_0x937e('0x26')](removeEntity(_0x42a560,null))[_0x937e('0x39')](handleError(_0x42a560,null));}; \ No newline at end of file +var _0x1094=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','sendStatus','error','name','send','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','merge','find','catch','body','ChatApplication','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x268862,_0x3020eb){var _0x4e6d5f=function(_0x5c1ea1){while(--_0x5c1ea1){_0x268862['push'](_0x268862['shift']());}};_0x4e6d5f(++_0x3020eb);}(_0x1094,0x143));var _0x4109=function(_0xc93556,_0x840f41){_0xc93556=_0xc93556-0x0;var _0x4453a1=_0x1094[_0xc93556];return _0x4453a1;};'use strict';var emlformat=require(_0x4109('0x0'));var rimraf=require(_0x4109('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4109('0x2'));var rp=require('request-promise');var moment=require(_0x4109('0x3'));var BPromise=require(_0x4109('0x4'));var Mustache=require(_0x4109('0x5'));var util=require(_0x4109('0x6'));var path=require(_0x4109('0x7'));var sox=require('sox');var csv=require(_0x4109('0x8'));var ejs=require(_0x4109('0x9'));var fs=require('fs');var fs_extra=require(_0x4109('0xa'));var _=require(_0x4109('0xb'));var squel=require(_0x4109('0xc'));var crypto=require(_0x4109('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4109('0xe'));var toCsv=require(_0x4109('0x8'));var querystring=require(_0x4109('0xf'));var Papa=require(_0x4109('0x10'));var Redis=require(_0x4109('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4109('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4109('0x13'))(_0x4109('0x14'));var utils=require(_0x4109('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4109('0x16'));var db=require(_0x4109('0x17'))['db'];function respondWithStatusCode(_0xfa09ea,_0x41e682){_0x41e682=_0x41e682||0xcc;return function(_0x2c2c9d){if(_0x2c2c9d){return _0xfa09ea['sendStatus'](_0x41e682);}return _0xfa09ea[_0x4109('0x18')](_0x41e682)[_0x4109('0x19')]();};}function respondWithResult(_0x3c8a84,_0x3c893a){_0x3c893a=_0x3c893a||0xc8;return function(_0x4a13fc){if(_0x4a13fc){return _0x3c8a84['status'](_0x3c893a)[_0x4109('0x1a')](_0x4a13fc);}};}function respondWithFilteredResult(_0x397937,_0x2e8e63){return function(_0x37b444){if(_0x37b444){var _0x1d81d8=typeof _0x2e8e63[_0x4109('0x1b')]===_0x4109('0x1c')&&typeof _0x2e8e63[_0x4109('0x1d')]==='undefined';var _0x4c4cf3=_0x37b444[_0x4109('0x1e')];var _0x328f1c=_0x1d81d8?0x0:_0x2e8e63[_0x4109('0x1b')];var _0x2e3fd6=_0x1d81d8?_0x37b444[_0x4109('0x1e')]:_0x2e8e63[_0x4109('0x1b')]+_0x2e8e63[_0x4109('0x1d')];var _0x6e8d56;if(_0x2e3fd6>=_0x4c4cf3){_0x2e3fd6=_0x4c4cf3;_0x6e8d56=0xc8;}else{_0x6e8d56=0xce;}_0x397937[_0x4109('0x18')](_0x6e8d56);return _0x397937['set'](_0x4109('0x1f'),_0x328f1c+'-'+_0x2e3fd6+'/'+_0x4c4cf3)[_0x4109('0x1a')](_0x37b444);}return null;};}function patchUpdates(_0x5cde5d){return function(_0x295f97){try{jsonpatch[_0x4109('0x20')](_0x295f97,_0x5cde5d,!![]);}catch(_0x4ba222){return BPromise['reject'](_0x4ba222);}return _0x295f97[_0x4109('0x21')]();};}function saveUpdates(_0x4e8723,_0x369de0){return function(_0x45d848){if(_0x45d848){return _0x45d848[_0x4109('0x22')](_0x4e8723)[_0x4109('0x23')](function(_0x5ddef4){return _0x5ddef4;});}return null;};}function removeEntity(_0x406d35,_0x438f4f){return function(_0x339cec){if(_0x339cec){return _0x339cec['destroy']()[_0x4109('0x23')](function(){_0x406d35[_0x4109('0x18')](0xcc)[_0x4109('0x19')]();});}};}function handleEntityNotFound(_0x57768e,_0x5e397f){return function(_0x54d82d){if(!_0x54d82d){_0x57768e[_0x4109('0x24')](0x194);}return _0x54d82d;};}function handleError(_0x40c36f,_0x103beb){_0x103beb=_0x103beb||0x1f4;return function(_0x1ef8fb){logger[_0x4109('0x25')](_0x1ef8fb['stack']);if(_0x1ef8fb[_0x4109('0x26')]){delete _0x1ef8fb[_0x4109('0x26')];}_0x40c36f['status'](_0x103beb)[_0x4109('0x27')](_0x1ef8fb);};}exports['show']=function(_0x1d3eaa,_0x2bbd38){var _0xc1e757={'raw':!![],'where':{'id':_0x1d3eaa[_0x4109('0x28')]['id']}},_0x3165c5={};_0x3165c5['model']=_[_0x4109('0x29')](db['ChatApplication'][_0x4109('0x2a')]);_0x3165c5[_0x4109('0x2b')]=_[_0x4109('0x29')](_0x1d3eaa[_0x4109('0x2b')]);_0x3165c5[_0x4109('0x2c')]=_[_0x4109('0x2d')](_0x3165c5[_0x4109('0x2e')],_0x3165c5[_0x4109('0x2b')]);_0xc1e757[_0x4109('0x2f')]=_[_0x4109('0x2d')](_0x3165c5[_0x4109('0x2e')],qs[_0x4109('0x30')](_0x1d3eaa[_0x4109('0x2b')][_0x4109('0x30')]));_0xc1e757[_0x4109('0x2f')]=_0xc1e757[_0x4109('0x2f')]['length']?_0xc1e757[_0x4109('0x2f')]:_0x3165c5[_0x4109('0x2e')];if(_0x1d3eaa[_0x4109('0x2b')][_0x4109('0x31')]){_0xc1e757[_0x4109('0x32')]=[{'all':!![]}];}_0xc1e757=_[_0x4109('0x33')]({},_0xc1e757,_0x1d3eaa['options']);return db['ChatApplication'][_0x4109('0x34')](_0xc1e757)[_0x4109('0x23')](handleEntityNotFound(_0x2bbd38,null))[_0x4109('0x23')](respondWithResult(_0x2bbd38,null))[_0x4109('0x35')](handleError(_0x2bbd38,null));};exports['update']=function(_0x3092b2,_0x269edf){if(_0x3092b2[_0x4109('0x36')]['id']){delete _0x3092b2[_0x4109('0x36')]['id'];}return db[_0x4109('0x37')][_0x4109('0x34')]({'where':{'id':_0x3092b2['params']['id']}})[_0x4109('0x23')](handleEntityNotFound(_0x269edf,null))['then'](saveUpdates(_0x3092b2[_0x4109('0x36')],null))[_0x4109('0x23')](respondWithResult(_0x269edf,null))['catch'](handleError(_0x269edf,null));};exports[_0x4109('0x38')]=function(_0x3c7580,_0x5dddb5){return db['ChatApplication'][_0x4109('0x34')]({'where':{'id':_0x3c7580['params']['id']}})[_0x4109('0x23')](handleEntityNotFound(_0x5dddb5,null))['then'](removeEntity(_0x5dddb5,null))[_0x4109('0x35')](handleError(_0x5dddb5,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2deb9f4..e062732 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 _0x833b=['exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x984097,_0x18e5bf){var _0x557b33=function(_0x3e74e8){while(--_0x3e74e8){_0x984097['push'](_0x984097['shift']());}};_0x557b33(++_0x18e5bf);}(_0x833b,0x131));var _0xb833=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x833b[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0xb833('0x0'));var logger=require('../../config/logger')(_0xb833('0x1'));var moment=require('moment');var BPromise=require(_0xb833('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb833('0x3'));var rimraf=require(_0xb833('0x4'));var config=require(_0xb833('0x5'));var attributes=require(_0xb833('0x6'));module[_0xb833('0x7')]=function(_0x35b3f0,_0x4422a2){return _0x35b3f0['define'](_0xb833('0x8'),attributes,{'tableName':_0xb833('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb833('0xa'),'collate':_0xb833('0xb')});}; \ No newline at end of file +var _0x5109=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x1d7377,_0x25a864){var _0x2d4c15=function(_0xa62ea){while(--_0xa62ea){_0x1d7377['push'](_0x1d7377['shift']());}};_0x2d4c15(++_0x25a864);}(_0x5109,0xb8));var _0x9510=function(_0x23d1ec,_0x295825){_0x23d1ec=_0x23d1ec-0x0;var _0x5b172c=_0x5109[_0x23d1ec];return _0x5b172c;};'use strict';var _=require(_0x9510('0x0'));var util=require(_0x9510('0x1'));var logger=require(_0x9510('0x2'))(_0x9510('0x3'));var moment=require(_0x9510('0x4'));var BPromise=require('bluebird');var rp=require(_0x9510('0x5'));var fs=require('fs');var path=require(_0x9510('0x6'));var rimraf=require(_0x9510('0x7'));var config=require(_0x9510('0x8'));var attributes=require(_0x9510('0x9'));module[_0x9510('0xa')]=function(_0x240d1a,_0x156535){return _0x240d1a['define'](_0x9510('0xb'),attributes,{'tableName':_0x9510('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9510('0xd'),'collate':_0x9510('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0021b48..b06d7d5 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 _0xe1a4=['then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xc611ee,_0x134971){var _0x4a951c=function(_0x1e1f44){while(--_0x1e1f44){_0xc611ee['push'](_0xc611ee['shift']());}};_0x4a951c(++_0x134971);}(_0xe1a4,0x16a));var _0x4e1a=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xe1a4[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x4e1a('0x0'));var util=require(_0x4e1a('0x1'));var moment=require(_0x4e1a('0x2'));var BPromise=require(_0x4e1a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e1a('0x4'));var logger=require(_0x4e1a('0x5'))(_0x4e1a('0x6'));var config=require(_0x4e1a('0x7'));var jayson=require(_0x4e1a('0x8'));var client=jayson[_0x4e1a('0x9')][_0x4e1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f4f64,_0x1275ca,_0x2ae14d){return new BPromise(function(_0x430233,_0x27dd03){return client[_0x4e1a('0xb')](_0x4f4f64,_0x2ae14d)[_0x4e1a('0xc')](function(_0x4d9b38){logger['info'](_0x4e1a('0xd'),_0x1275ca,'request\x20sent');logger[_0x4e1a('0xe')](_0x4e1a('0xf'),_0x1275ca,'request\x20sent',JSON['stringify'](_0x4d9b38));if(_0x4d9b38['error']){if(_0x4d9b38[_0x4e1a('0x10')][_0x4e1a('0x11')]===0x1f4){logger[_0x4e1a('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1275ca,_0x4d9b38[_0x4e1a('0x10')][_0x4e1a('0x12')]);return _0x27dd03(_0x4d9b38[_0x4e1a('0x10')][_0x4e1a('0x12')]);}logger[_0x4e1a('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1275ca,_0x4d9b38[_0x4e1a('0x10')][_0x4e1a('0x12')]);return _0x430233(_0x4d9b38['error']['message']);}else{logger[_0x4e1a('0x13')](_0x4e1a('0xd'),_0x1275ca,_0x4e1a('0x14'));_0x430233(_0x4d9b38['result']['message']);}})[_0x4e1a('0x15')](function(_0x17d6e3){logger[_0x4e1a('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1275ca,_0x17d6e3);_0x27dd03(_0x17d6e3);});});} \ No newline at end of file +var _0x1212=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x16acda,_0x820f22){var _0x548f51=function(_0x396dd8){while(--_0x396dd8){_0x16acda['push'](_0x16acda['shift']());}};_0x548f51(++_0x820f22);}(_0x1212,0x1e0));var _0x2121=function(_0x143e47,_0x1b61c8){_0x143e47=_0x143e47-0x0;var _0x51366f=_0x1212[_0x143e47];return _0x51366f;};'use strict';var _=require('lodash');var util=require(_0x2121('0x0'));var moment=require(_0x2121('0x1'));var BPromise=require(_0x2121('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2121('0x3'));var db=require(_0x2121('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2121('0x5'))('rpc');var config=require(_0x2121('0x6'));var jayson=require(_0x2121('0x7'));var client=jayson[_0x2121('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57f45c,_0x47c63e,_0x39f88d){return new BPromise(function(_0x567c47,_0xeab4b1){return client['request'](_0x57f45c,_0x39f88d)[_0x2121('0x9')](function(_0x475a15){logger[_0x2121('0xa')](_0x2121('0xb'),_0x47c63e,_0x2121('0xc'));logger[_0x2121('0xd')](_0x2121('0xe'),_0x47c63e,'request\x20sent',JSON[_0x2121('0xf')](_0x475a15));if(_0x475a15[_0x2121('0x10')]){if(_0x475a15[_0x2121('0x10')][_0x2121('0x11')]===0x1f4){logger[_0x2121('0x10')](_0x2121('0xb'),_0x47c63e,_0x475a15[_0x2121('0x10')]['message']);return _0xeab4b1(_0x475a15[_0x2121('0x10')][_0x2121('0x12')]);}logger[_0x2121('0x10')]('ChatApplication,\x20%s,\x20%s',_0x47c63e,_0x475a15[_0x2121('0x10')][_0x2121('0x12')]);return _0x567c47(_0x475a15[_0x2121('0x10')][_0x2121('0x12')]);}else{logger[_0x2121('0xa')](_0x2121('0xb'),_0x47c63e,_0x2121('0xc'));_0x567c47(_0x475a15[_0x2121('0x13')]['message']);}})[_0x2121('0x14')](function(_0x583a2a){logger[_0x2121('0x10')](_0x2121('0xb'),_0x47c63e,_0x583a2a);_0xeab4b1(_0x583a2a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 36058a0..36c1b7a 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 _0x2503=['show','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x22237e,_0x2c42dd){var _0x2dc2c5=function(_0x26f59d){while(--_0x26f59d){_0x22237e['push'](_0x22237e['shift']());}};_0x2dc2c5(++_0x2c42dd);}(_0x2503,0xcb));var _0x3250=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2503[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3250('0x0'));var util=require('util');var path=require(_0x3250('0x1'));var timeout=require(_0x3250('0x2'));var express=require(_0x3250('0x3'));var router=express[_0x3250('0x4')]();var fs_extra=require(_0x3250('0x5'));var auth=require(_0x3250('0x6'));var interaction=require(_0x3250('0x7'));var config=require(_0x3250('0x8'));var controller=require(_0x3250('0x9'));router[_0x3250('0xa')](_0x3250('0xb'),auth[_0x3250('0xc')](),controller[_0x3250('0xd')]);router['put'](_0x3250('0xb'),auth['isAuthenticated'](),controller[_0x3250('0xe')]);router[_0x3250('0xf')]('/:id',auth[_0x3250('0xc')](),controller[_0x3250('0x10')]);module[_0x3250('0x11')]=router; \ No newline at end of file +var _0x9c1d=['fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','delete','destroy','multer','util','connect-timeout'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x9c1d,0x81));var _0xd9c1=function(_0x4e4993,_0x19c4de){_0x4e4993=_0x4e4993-0x0;var _0x3460a9=_0x9c1d[_0x4e4993];return _0x3460a9;};'use strict';var multer=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var path=require('path');var timeout=require(_0xd9c1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd9c1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd9c1('0x4'));var config=require(_0xd9c1('0x5'));var controller=require(_0xd9c1('0x6'));router[_0xd9c1('0x7')](_0xd9c1('0x8'),auth[_0xd9c1('0x9')](),controller['show']);router['put']('/:id',auth[_0xd9c1('0x9')](),controller['update']);router[_0xd9c1('0xa')](_0xd9c1('0x8'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 40c5f05..981ffe5 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 _0x3d4b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0x3d4b[_0x3c4016];return _0x3cebbd;};'use strict';var Sequelize=require(_0xb3d4('0x0'));module[_0xb3d4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb3d4('0x2')]},'write':{'type':Sequelize[_0xb3d4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe08b=['sequelize','STRING'];(function(_0x51d433,_0x228d5e){var _0x403b5e=function(_0x39bd15){while(--_0x39bd15){_0x51d433['push'](_0x51d433['shift']());}};_0x403b5e(++_0x228d5e);}(_0xe08b,0x10e));var _0xbe08=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xe08b[_0x158f01];return _0x5ef74e;};'use strict';var Sequelize=require(_0xbe08('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe08('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbe08('0x1')]},'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 063e36d..a435444 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 _0x5d0a=['status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','findAll','rows','catch','keys','include','merge','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','User','removeMembers','addMessage','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus'];(function(_0x5045a8,_0x5d27b9){var _0x3945cf=function(_0x2c5c18){while(--_0x2c5c18){_0x5045a8['push'](_0x5045a8['shift']());}};_0x3945cf(++_0x5d27b9);}(_0x5d0a,0x155));var _0xa5d0=function(_0x53b666,_0x423476){_0x53b666=_0x53b666-0x0;var _0x2f201a=_0x5d0a[_0x53b666];return _0x2f201a;};'use strict';var emlformat=require(_0xa5d0('0x0'));var rimraf=require(_0xa5d0('0x1'));var zipdir=require(_0xa5d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5d0('0x3'));var moment=require('moment');var BPromise=require(_0xa5d0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa5d0('0x5'));var csv=require('to-csv');var ejs=require(_0xa5d0('0x6'));var fs=require('fs');var fs_extra=require(_0xa5d0('0x7'));var _=require(_0xa5d0('0x8'));var squel=require(_0xa5d0('0x9'));var crypto=require('crypto');var jsforce=require(_0xa5d0('0xa'));var deskjs=require(_0xa5d0('0xb'));var toCsv=require(_0xa5d0('0xc'));var querystring=require(_0xa5d0('0xd'));var Papa=require(_0xa5d0('0xe'));var Redis=require(_0xa5d0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa5d0('0x10'));var as=require(_0xa5d0('0x11'));var hardwareService=require(_0xa5d0('0x12'));var logger=require(_0xa5d0('0x13'))(_0xa5d0('0x14'));var utils=require('../../config/utils');var config=require(_0xa5d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa5d0('0x16')]=_['defaults'](config['redis'],{'host':_0xa5d0('0x17'),'port':0x18eb});var socket=require(_0xa5d0('0x18'))(new Redis(config[_0xa5d0('0x16')]));require(_0xa5d0('0x19'))['register'](socket);function respondWithStatusCode(_0x1eb79b,_0x1fa279){_0x1fa279=_0x1fa279||0xcc;return function(_0x42096b){if(_0x42096b){return _0x1eb79b[_0xa5d0('0x1a')](_0x1fa279);}return _0x1eb79b[_0xa5d0('0x1b')](_0x1fa279)[_0xa5d0('0x1c')]();};}function respondWithResult(_0x23e5c8,_0x329a8d){_0x329a8d=_0x329a8d||0xc8;return function(_0x1286a9){if(_0x1286a9){return _0x23e5c8[_0xa5d0('0x1b')](_0x329a8d)[_0xa5d0('0x1d')](_0x1286a9);}};}function respondWithFilteredResult(_0x4a0c2d,_0x36fdee){return function(_0x27e47d){if(_0x27e47d){var _0x1e91a1=typeof _0x36fdee[_0xa5d0('0x1e')]===_0xa5d0('0x1f')&&typeof _0x36fdee['limit']===_0xa5d0('0x1f');var _0x365206=_0x27e47d[_0xa5d0('0x20')];var _0x16625f=_0x1e91a1?0x0:_0x36fdee[_0xa5d0('0x1e')];var _0x1a7ae3=_0x1e91a1?_0x27e47d[_0xa5d0('0x20')]:_0x36fdee['offset']+_0x36fdee['limit'];var _0x65999c;if(_0x1a7ae3>=_0x365206){_0x1a7ae3=_0x365206;_0x65999c=0xc8;}else{_0x65999c=0xce;}_0x4a0c2d[_0xa5d0('0x1b')](_0x65999c);return _0x4a0c2d[_0xa5d0('0x21')](_0xa5d0('0x22'),_0x16625f+'-'+_0x1a7ae3+'/'+_0x365206)[_0xa5d0('0x1d')](_0x27e47d);}return null;};}function patchUpdates(_0xaeec71){return function(_0x583df2){try{jsonpatch[_0xa5d0('0x23')](_0x583df2,_0xaeec71,!![]);}catch(_0x562fab){return BPromise['reject'](_0x562fab);}return _0x583df2[_0xa5d0('0x24')]();};}function saveUpdates(_0x26b407,_0x369de5){return function(_0x22e36c){if(_0x22e36c){return _0x22e36c[_0xa5d0('0x25')](_0x26b407)[_0xa5d0('0x26')](function(_0x39faa2){return _0x39faa2;});}return null;};}function removeEntity(_0x5f3f61,_0x5707db){return function(_0x103099){if(_0x103099){return _0x103099[_0xa5d0('0x27')]()[_0xa5d0('0x26')](function(){_0x5f3f61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a4bc7,_0x5e6055){return function(_0x15ef03){if(!_0x15ef03){_0x3a4bc7[_0xa5d0('0x1a')](0x194);}return _0x15ef03;};}function handleError(_0x5cdfc3,_0x51aea3){_0x51aea3=_0x51aea3||0x1f4;return function(_0x459d7c){logger[_0xa5d0('0x28')](_0x459d7c[_0xa5d0('0x29')]);if(_0x459d7c[_0xa5d0('0x2a')]){delete _0x459d7c['name'];}_0x5cdfc3[_0xa5d0('0x1b')](_0x51aea3)[_0xa5d0('0x2b')](_0x459d7c);};}exports['index']=function(_0xa6aed8,_0x54c16a){var _0x32ca32={},_0x5828e3={},_0x3e49a1={'count':0x0,'rows':[]};var _0x407f1f=_[_0xa5d0('0x2c')](db[_0xa5d0('0x2d')][_0xa5d0('0x2e')],function(_0x4767f6){return{'name':_0x4767f6[_0xa5d0('0x2f')],'type':_0x4767f6[_0xa5d0('0x30')]['key']};});_0x5828e3[_0xa5d0('0x31')]=_[_0xa5d0('0x2c')](_0x407f1f,'name');_0x5828e3[_0xa5d0('0x32')]=_['keys'](_0xa6aed8['query']);_0x5828e3[_0xa5d0('0x33')]=_[_0xa5d0('0x34')](_0x5828e3[_0xa5d0('0x31')],_0x5828e3[_0xa5d0('0x32')]);_0x32ca32[_0xa5d0('0x35')]=_['intersection'](_0x5828e3[_0xa5d0('0x31')],qs[_0xa5d0('0x36')](_0xa6aed8[_0xa5d0('0x32')][_0xa5d0('0x36')]));_0x32ca32[_0xa5d0('0x35')]=_0x32ca32[_0xa5d0('0x35')][_0xa5d0('0x37')]?_0x32ca32[_0xa5d0('0x35')]:_0x5828e3['model'];if(!_0xa6aed8[_0xa5d0('0x32')]['hasOwnProperty'](_0xa5d0('0x38'))){_0x32ca32[_0xa5d0('0x39')]=qs[_0xa5d0('0x39')](_0xa6aed8[_0xa5d0('0x32')]['limit']);_0x32ca32[_0xa5d0('0x1e')]=qs['offset'](_0xa6aed8[_0xa5d0('0x32')][_0xa5d0('0x1e')]);}_0x32ca32[_0xa5d0('0x3a')]=qs[_0xa5d0('0x3b')](_0xa6aed8[_0xa5d0('0x32')][_0xa5d0('0x3b')]);_0x32ca32['where']=qs[_0xa5d0('0x33')](_[_0xa5d0('0x3c')](_0xa6aed8['query'],_0x5828e3[_0xa5d0('0x33')]),_0x407f1f);if(_0xa6aed8[_0xa5d0('0x32')][_0xa5d0('0x3d')]){_0x32ca32['where']=_['merge'](_0x32ca32['where'],{'$or':_['map'](_0x407f1f,function(_0xd5e4a){if(_0xd5e4a['type']!==_0xa5d0('0x3e')){var _0x11a960={};_0x11a960[_0xd5e4a['name']]={'$like':'%'+_0xa6aed8[_0xa5d0('0x32')]['filter']+'%'};return _0x11a960;}})});}_0x32ca32=_['merge']({},_0x32ca32,_0xa6aed8[_0xa5d0('0x3f')]);var _0x528c3e={'where':_0x32ca32[_0xa5d0('0x40')]};return db[_0xa5d0('0x2d')][_0xa5d0('0x20')](_0x528c3e)['then'](function(_0x550489){_0x3e49a1[_0xa5d0('0x20')]=_0x550489;if(_0xa6aed8[_0xa5d0('0x32')][_0xa5d0('0x41')]){_0x32ca32['include']=[{'all':!![]}];}return db['ChatGroup'][_0xa5d0('0x42')](_0x32ca32);})[_0xa5d0('0x26')](function(_0x4d149f){_0x3e49a1[_0xa5d0('0x43')]=_0x4d149f;return _0x3e49a1;})['then'](respondWithFilteredResult(_0x54c16a,_0x32ca32))[_0xa5d0('0x44')](handleError(_0x54c16a,null));};exports['show']=function(_0x41ead0,_0x2d0d29){var _0x556ea9={'raw':!![],'where':{'id':_0x41ead0['params']['id']}},_0x48ada6={};_0x48ada6[_0xa5d0('0x31')]=_[_0xa5d0('0x45')](db[_0xa5d0('0x2d')][_0xa5d0('0x2e')]);_0x48ada6['query']=_[_0xa5d0('0x45')](_0x41ead0[_0xa5d0('0x32')]);_0x48ada6[_0xa5d0('0x33')]=_[_0xa5d0('0x34')](_0x48ada6[_0xa5d0('0x31')],_0x48ada6[_0xa5d0('0x32')]);_0x556ea9[_0xa5d0('0x35')]=_[_0xa5d0('0x34')](_0x48ada6[_0xa5d0('0x31')],qs[_0xa5d0('0x36')](_0x41ead0[_0xa5d0('0x32')]['fields']));_0x556ea9[_0xa5d0('0x35')]=_0x556ea9[_0xa5d0('0x35')][_0xa5d0('0x37')]?_0x556ea9[_0xa5d0('0x35')]:_0x48ada6[_0xa5d0('0x31')];if(_0x41ead0[_0xa5d0('0x32')][_0xa5d0('0x41')]){_0x556ea9[_0xa5d0('0x46')]=[{'all':!![]}];}_0x556ea9=_[_0xa5d0('0x47')]({},_0x556ea9,_0x41ead0['options']);return db[_0xa5d0('0x2d')][_0xa5d0('0x48')](_0x556ea9)[_0xa5d0('0x26')](handleEntityNotFound(_0x2d0d29,null))[_0xa5d0('0x26')](respondWithResult(_0x2d0d29,null))[_0xa5d0('0x44')](handleError(_0x2d0d29,null));};exports[_0xa5d0('0x49')]=function(_0x2692e5,_0x564012){return db[_0xa5d0('0x2d')][_0xa5d0('0x49')](_0x2692e5[_0xa5d0('0x4a')],{})[_0xa5d0('0x26')](respondWithResult(_0x564012,0xc9))[_0xa5d0('0x44')](handleError(_0x564012,null));};exports[_0xa5d0('0x25')]=function(_0x1f2a74,_0x4cf172){if(_0x1f2a74['body']['id']){delete _0x1f2a74[_0xa5d0('0x4a')]['id'];}return db['ChatGroup'][_0xa5d0('0x48')]({'where':{'id':_0x1f2a74[_0xa5d0('0x4b')]['id']}})[_0xa5d0('0x26')](handleEntityNotFound(_0x4cf172,null))[_0xa5d0('0x26')](saveUpdates(_0x1f2a74[_0xa5d0('0x4a')],null))[_0xa5d0('0x26')](respondWithResult(_0x4cf172,null))[_0xa5d0('0x44')](handleError(_0x4cf172,null));};exports[_0xa5d0('0x27')]=function(_0x218725,_0x4801a2){return db['ChatGroup'][_0xa5d0('0x48')]({'where':{'id':_0x218725['params']['id']}})[_0xa5d0('0x26')](handleEntityNotFound(_0x4801a2,null))[_0xa5d0('0x26')](removeEntity(_0x4801a2,null))[_0xa5d0('0x44')](handleError(_0x4801a2,null));};exports[_0xa5d0('0x4c')]=function(_0x46e53d,_0x199897){return db[_0xa5d0('0x2d')][_0xa5d0('0x4c')]()[_0xa5d0('0x26')](respondWithResult(_0x199897,null))[_0xa5d0('0x44')](handleError(_0x199897,null));};exports[_0xa5d0('0x4d')]=function(_0xd81879,_0xf223ed,_0x3ed770){return db[_0xa5d0('0x4e')][_0xa5d0('0x20')]({'where':{'ChatGroupId':_0xd81879[_0xa5d0('0x4b')]['id'],'ToId':_0xd81879['user']['id'],'read':![]}})[_0xa5d0('0x26')](function(_0x149db4){return{'id':_[_0xa5d0('0x4f')](_0xd81879['params']['id']),'count':_0x149db4};})['then'](respondWithResult(_0xf223ed,null))['catch'](handleError(_0xf223ed,null));};exports[_0xa5d0('0x50')]=function(_0x462208,_0x2c61d5,_0x87e282){return db[_0xa5d0('0x2d')]['find']({'where':{'id':_0x462208[_0xa5d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c61d5,null))['then'](function(_0x15dfe9){if(_0x15dfe9){return _0x15dfe9['addMembers'](_0x462208['body'][_0xa5d0('0x51')],_['omit'](_0x462208['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2c61d5,null))['catch'](handleError(_0x2c61d5,null));};exports[_0xa5d0('0x52')]=function(_0x40189e,_0x1118b2,_0x475ddd){var _0x54dd29={};var _0x1041cf={};var _0x268cde;var _0x192bcb;return db[_0xa5d0('0x2d')]['findOne']({'where':{'id':_0x40189e['params']['id']}})[_0xa5d0('0x26')](handleEntityNotFound(_0x1118b2,null))[_0xa5d0('0x26')](function(_0x2bc982){if(_0x2bc982){_0x268cde=_0x2bc982;_0x1041cf['model']=_[_0xa5d0('0x45')](db[_0xa5d0('0x53')][_0xa5d0('0x2e')]);_0x1041cf['query']=_[_0xa5d0('0x45')](_0x40189e['query']);_0x1041cf[_0xa5d0('0x33')]=_[_0xa5d0('0x34')](_0x1041cf[_0xa5d0('0x31')],_0x1041cf[_0xa5d0('0x32')]);_0x54dd29['attributes']=_[_0xa5d0('0x34')](_0x1041cf[_0xa5d0('0x31')],qs[_0xa5d0('0x36')](_0x40189e[_0xa5d0('0x32')][_0xa5d0('0x36')]));_0x54dd29['attributes']=_0x54dd29['attributes'][_0xa5d0('0x37')]?_0x54dd29[_0xa5d0('0x35')]:_0x1041cf['model'];_0x54dd29['order']=qs[_0xa5d0('0x3b')](_0x40189e['query'][_0xa5d0('0x3b')]);_0x54dd29['where']=qs[_0xa5d0('0x33')](_['pick'](_0x40189e[_0xa5d0('0x32')],_0x1041cf[_0xa5d0('0x33')]));if(_0x40189e[_0xa5d0('0x32')][_0xa5d0('0x3d')]){_0x54dd29[_0xa5d0('0x40')]=_[_0xa5d0('0x47')](_0x54dd29['where'],{'$or':_[_0xa5d0('0x2c')](_0x54dd29[_0xa5d0('0x35')],function(_0x13a091){var _0x4968ec={};_0x4968ec[_0x13a091]={'$like':'%'+_0x40189e[_0xa5d0('0x32')]['filter']+'%'};return _0x4968ec;})});}_0x54dd29=_[_0xa5d0('0x47')]({},_0x54dd29,_0x40189e[_0xa5d0('0x3f')]);return _0x268cde[_0xa5d0('0x52')](_0x54dd29);}})['then'](function(_0x50a74a){if(_0x50a74a){_0x192bcb=_0x50a74a[_0xa5d0('0x37')];if(!_0x40189e[_0xa5d0('0x32')]['hasOwnProperty'](_0xa5d0('0x38'))){_0x54dd29[_0xa5d0('0x39')]=qs[_0xa5d0('0x39')](_0x40189e[_0xa5d0('0x32')]['limit']);_0x54dd29['offset']=qs[_0xa5d0('0x1e')](_0x40189e[_0xa5d0('0x32')][_0xa5d0('0x1e')]);}return _0x268cde[_0xa5d0('0x52')](_0x54dd29);}})['then'](function(_0x264d0a){if(_0x264d0a){return _0x264d0a?{'count':_0x192bcb,'rows':_0x264d0a}:null;}})[_0xa5d0('0x26')](respondWithResult(_0x1118b2,null))[_0xa5d0('0x44')](handleError(_0x1118b2,null));};exports[_0xa5d0('0x54')]=function(_0x2ff9e0,_0x2f4f69,_0x271456){return db[_0xa5d0('0x2d')][_0xa5d0('0x48')]({'where':{'id':_0x2ff9e0[_0xa5d0('0x4b')]['id']}})[_0xa5d0('0x26')](handleEntityNotFound(_0x2f4f69,null))[_0xa5d0('0x26')](function(_0x57a1bf){if(_0x57a1bf){return _0x57a1bf[_0xa5d0('0x54')](_0x2ff9e0[_0xa5d0('0x32')][_0xa5d0('0x51')]);}})[_0xa5d0('0x26')](respondWithStatusCode(_0x2f4f69,null))['catch'](handleError(_0x2f4f69,null));};exports[_0xa5d0('0x55')]=function(_0x4b964b,_0x3b402b,_0x31ff11){if(_0x4b964b[_0xa5d0('0x4a')]['id']){delete _0x4b964b[_0xa5d0('0x4a')]['id'];}return db[_0xa5d0('0x2d')][_0xa5d0('0x48')]({'where':{'id':_0x4b964b[_0xa5d0('0x4b')]['id']}})[_0xa5d0('0x26')](handleEntityNotFound(_0x3b402b,null))[_0xa5d0('0x26')](function(_0x283302){if(_0x283302){_0x4b964b['body']['ChatGroupId']=_0x283302['id'];return db[_0xa5d0('0x4e')][_0xa5d0('0x49')](_0x4b964b[_0xa5d0('0x4a')]);}})[_0xa5d0('0x26')](respondWithResult(_0x3b402b,null))[_0xa5d0('0x44')](handleError(_0x3b402b,null));};exports[_0xa5d0('0x56')]=function(_0x52e4bc,_0x104327,_0x57d87e){var _0xc261d9={};var _0x1e4696={};var _0x1dad3b;var _0x399632;return db[_0xa5d0('0x2d')][_0xa5d0('0x57')]({'where':{'id':_0x52e4bc['params']['id']}})['then'](handleEntityNotFound(_0x104327,null))['then'](function(_0x46391c){if(_0x46391c){_0x1dad3b=_0x46391c;_0x1e4696['model']=_[_0xa5d0('0x45')](db[_0xa5d0('0x4e')][_0xa5d0('0x2e')]);_0x1e4696[_0xa5d0('0x32')]=_[_0xa5d0('0x45')](_0x52e4bc[_0xa5d0('0x32')]);_0x1e4696[_0xa5d0('0x33')]=_[_0xa5d0('0x34')](_0x1e4696[_0xa5d0('0x31')],_0x1e4696[_0xa5d0('0x32')]);_0xc261d9['attributes']=_[_0xa5d0('0x34')](_0x1e4696['model'],qs[_0xa5d0('0x36')](_0x52e4bc[_0xa5d0('0x32')][_0xa5d0('0x36')]));_0xc261d9[_0xa5d0('0x35')]=_0xc261d9[_0xa5d0('0x35')][_0xa5d0('0x37')]?_0xc261d9['attributes']:_0x1e4696['model'];_0xc261d9[_0xa5d0('0x3a')]=qs[_0xa5d0('0x3b')](_0x52e4bc[_0xa5d0('0x32')][_0xa5d0('0x3b')]);_0xc261d9[_0xa5d0('0x40')]=qs[_0xa5d0('0x33')](_['pick'](_0x52e4bc[_0xa5d0('0x32')],_0x1e4696[_0xa5d0('0x33')]));if(_0x52e4bc[_0xa5d0('0x32')][_0xa5d0('0x3d')]){_0xc261d9['where']=_['merge'](_0xc261d9['where'],{'$or':_['map'](_0xc261d9['attributes'],function(_0x2f158b){var _0x252605={};_0x252605[_0x2f158b]={'$like':'%'+_0x52e4bc[_0xa5d0('0x32')]['filter']+'%'};return _0x252605;})});}if(_0x52e4bc[_0xa5d0('0x32')][_0xa5d0('0x58')]){var _0x44a5e5=_0x52e4bc[_0xa5d0('0x32')]['$gte']['split'](',');var _0x20d99a={};_0x20d99a[_0x44a5e5[0x0]]={'$gte':moment(_0x44a5e5[0x1])[_0xa5d0('0x59')](_0xa5d0('0x5a'))};_0xc261d9[_0xa5d0('0x40')]=_['merge'](_0xc261d9['where'],_0x20d99a);}_0xc261d9=_['merge']({},_0xc261d9,_0x52e4bc[_0xa5d0('0x3f')]);return _0x1dad3b[_0xa5d0('0x56')](_0xc261d9);}})['then'](function(_0xb4a12a){if(_0xb4a12a){_0x399632=_0xb4a12a[_0xa5d0('0x37')];if(!_0x52e4bc[_0xa5d0('0x32')][_0xa5d0('0x5b')](_0xa5d0('0x38'))){_0xc261d9[_0xa5d0('0x39')]=qs[_0xa5d0('0x39')](_0x52e4bc[_0xa5d0('0x32')]['limit']);_0xc261d9[_0xa5d0('0x1e')]=qs[_0xa5d0('0x1e')](_0x52e4bc['query']['offset']);}return _0x1dad3b[_0xa5d0('0x56')](_0xc261d9);}})['then'](function(_0x3a5bdd){if(_0x3a5bdd){return _0x3a5bdd?{'count':_0x399632,'rows':_0x3a5bdd}:null;}})[_0xa5d0('0x26')](respondWithResult(_0x104327,null))[_0xa5d0('0x44')](handleError(_0x104327,null));}; \ No newline at end of file +var _0x72e9=['intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','include','options','find','create','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','nolimit','removeMembers','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','ChatGroup','rawAttributes','type','key','model','map','query','keys','filters'];(function(_0x35dfe6,_0x4244fa){var _0x59651c=function(_0x3ff137){while(--_0x3ff137){_0x35dfe6['push'](_0x35dfe6['shift']());}};_0x59651c(++_0x4244fa);}(_0x72e9,0x137));var _0x972e=function(_0x629c23,_0x209620){_0x629c23=_0x629c23-0x0;var _0xdfbd80=_0x72e9[_0x629c23];return _0xdfbd80;};'use strict';var emlformat=require(_0x972e('0x0'));var rimraf=require(_0x972e('0x1'));var zipdir=require(_0x972e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x972e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x972e('0x4'));var path=require(_0x972e('0x5'));var sox=require(_0x972e('0x6'));var csv=require('to-csv');var ejs=require(_0x972e('0x7'));var fs=require('fs');var fs_extra=require(_0x972e('0x8'));var _=require('lodash');var squel=require(_0x972e('0x9'));var crypto=require(_0x972e('0xa'));var jsforce=require(_0x972e('0xb'));var deskjs=require(_0x972e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x972e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x972e('0xe'));var qs=require(_0x972e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x972e('0x10'));var utils=require('../../config/utils');var config=require(_0x972e('0x11'));var licenseUtil=require(_0x972e('0x12'));var db=require(_0x972e('0x13'))['db'];config[_0x972e('0x14')]=_[_0x972e('0x15')](config[_0x972e('0x14')],{'host':_0x972e('0x16'),'port':0x18eb});var socket=require(_0x972e('0x17'))(new Redis(config['redis']));require(_0x972e('0x18'))[_0x972e('0x19')](socket);function respondWithStatusCode(_0x511a8e,_0x11e781){_0x11e781=_0x11e781||0xcc;return function(_0x28ab9a){if(_0x28ab9a){return _0x511a8e['sendStatus'](_0x11e781);}return _0x511a8e[_0x972e('0x1a')](_0x11e781)['end']();};}function respondWithResult(_0x30197e,_0x4ed867){_0x4ed867=_0x4ed867||0xc8;return function(_0x47e671){if(_0x47e671){return _0x30197e[_0x972e('0x1a')](_0x4ed867)[_0x972e('0x1b')](_0x47e671);}};}function respondWithFilteredResult(_0xac9023,_0x1a19db){return function(_0xcc4f28){if(_0xcc4f28){var _0x5c411b=typeof _0x1a19db[_0x972e('0x1c')]===_0x972e('0x1d')&&typeof _0x1a19db['limit']===_0x972e('0x1d');var _0x1b5529=_0xcc4f28[_0x972e('0x1e')];var _0x51eddf=_0x5c411b?0x0:_0x1a19db[_0x972e('0x1c')];var _0x7fe919=_0x5c411b?_0xcc4f28[_0x972e('0x1e')]:_0x1a19db['offset']+_0x1a19db['limit'];var _0x2bf58e;if(_0x7fe919>=_0x1b5529){_0x7fe919=_0x1b5529;_0x2bf58e=0xc8;}else{_0x2bf58e=0xce;}_0xac9023[_0x972e('0x1a')](_0x2bf58e);return _0xac9023[_0x972e('0x1f')]('Content-Range',_0x51eddf+'-'+_0x7fe919+'/'+_0x1b5529)[_0x972e('0x1b')](_0xcc4f28);}return null;};}function patchUpdates(_0x1b6ef9){return function(_0x271fd4){try{jsonpatch[_0x972e('0x20')](_0x271fd4,_0x1b6ef9,!![]);}catch(_0x8dcbb4){return BPromise[_0x972e('0x21')](_0x8dcbb4);}return _0x271fd4[_0x972e('0x22')]();};}function saveUpdates(_0x217d7e,_0x48946b){return function(_0x2845de){if(_0x2845de){return _0x2845de[_0x972e('0x23')](_0x217d7e)[_0x972e('0x24')](function(_0x511da4){return _0x511da4;});}return null;};}function removeEntity(_0x3c333f,_0x507209){return function(_0x537955){if(_0x537955){return _0x537955[_0x972e('0x25')]()[_0x972e('0x24')](function(){_0x3c333f[_0x972e('0x1a')](0xcc)[_0x972e('0x26')]();});}};}function handleEntityNotFound(_0x2804c6,_0x283928){return function(_0x2fba73){if(!_0x2fba73){_0x2804c6[_0x972e('0x27')](0x194);}return _0x2fba73;};}function handleError(_0x2f6f1a,_0x1411ab){_0x1411ab=_0x1411ab||0x1f4;return function(_0x26e2c7){logger['error'](_0x26e2c7[_0x972e('0x28')]);if(_0x26e2c7[_0x972e('0x29')]){delete _0x26e2c7[_0x972e('0x29')];}_0x2f6f1a[_0x972e('0x1a')](_0x1411ab)[_0x972e('0x2a')](_0x26e2c7);};}exports[_0x972e('0x2b')]=function(_0x47544b,_0x189022){var _0x5dbc24={},_0x21842a={},_0x3803c1={'count':0x0,'rows':[]};var _0x9b9bbd=_['map'](db[_0x972e('0x2c')][_0x972e('0x2d')],function(_0xbdcc70){return{'name':_0xbdcc70['fieldName'],'type':_0xbdcc70[_0x972e('0x2e')][_0x972e('0x2f')]};});_0x21842a[_0x972e('0x30')]=_[_0x972e('0x31')](_0x9b9bbd,_0x972e('0x29'));_0x21842a[_0x972e('0x32')]=_[_0x972e('0x33')](_0x47544b[_0x972e('0x32')]);_0x21842a[_0x972e('0x34')]=_[_0x972e('0x35')](_0x21842a[_0x972e('0x30')],_0x21842a[_0x972e('0x32')]);_0x5dbc24[_0x972e('0x36')]=_[_0x972e('0x35')](_0x21842a['model'],qs[_0x972e('0x37')](_0x47544b['query'][_0x972e('0x37')]));_0x5dbc24[_0x972e('0x36')]=_0x5dbc24['attributes'][_0x972e('0x38')]?_0x5dbc24['attributes']:_0x21842a[_0x972e('0x30')];if(!_0x47544b[_0x972e('0x32')][_0x972e('0x39')]('nolimit')){_0x5dbc24[_0x972e('0x3a')]=qs[_0x972e('0x3a')](_0x47544b[_0x972e('0x32')][_0x972e('0x3a')]);_0x5dbc24[_0x972e('0x1c')]=qs[_0x972e('0x1c')](_0x47544b['query'][_0x972e('0x1c')]);}_0x5dbc24[_0x972e('0x3b')]=qs[_0x972e('0x3c')](_0x47544b[_0x972e('0x32')]['sort']);_0x5dbc24[_0x972e('0x3d')]=qs['filters'](_['pick'](_0x47544b[_0x972e('0x32')],_0x21842a[_0x972e('0x34')]),_0x9b9bbd);if(_0x47544b[_0x972e('0x32')][_0x972e('0x3e')]){_0x5dbc24['where']=_[_0x972e('0x3f')](_0x5dbc24[_0x972e('0x3d')],{'$or':_[_0x972e('0x31')](_0x9b9bbd,function(_0x8b9f2a){if(_0x8b9f2a[_0x972e('0x2e')]!=='VIRTUAL'){var _0x2b3092={};_0x2b3092[_0x8b9f2a['name']]={'$like':'%'+_0x47544b[_0x972e('0x32')]['filter']+'%'};return _0x2b3092;}})});}_0x5dbc24=_[_0x972e('0x3f')]({},_0x5dbc24,_0x47544b['options']);var _0x3b2e91={'where':_0x5dbc24[_0x972e('0x3d')]};return db[_0x972e('0x2c')]['count'](_0x3b2e91)[_0x972e('0x24')](function(_0x426691){_0x3803c1[_0x972e('0x1e')]=_0x426691;if(_0x47544b[_0x972e('0x32')][_0x972e('0x40')]){_0x5dbc24['include']=[{'all':!![]}];}return db[_0x972e('0x2c')][_0x972e('0x41')](_0x5dbc24);})[_0x972e('0x24')](function(_0x45f5a2){_0x3803c1[_0x972e('0x42')]=_0x45f5a2;return _0x3803c1;})[_0x972e('0x24')](respondWithFilteredResult(_0x189022,_0x5dbc24))[_0x972e('0x43')](handleError(_0x189022,null));};exports['show']=function(_0x5c78e1,_0x54aea5){var _0x112218={'raw':!![],'where':{'id':_0x5c78e1['params']['id']}},_0x259a6a={};_0x259a6a[_0x972e('0x30')]=_[_0x972e('0x33')](db['ChatGroup'][_0x972e('0x2d')]);_0x259a6a[_0x972e('0x32')]=_['keys'](_0x5c78e1[_0x972e('0x32')]);_0x259a6a[_0x972e('0x34')]=_[_0x972e('0x35')](_0x259a6a['model'],_0x259a6a['query']);_0x112218[_0x972e('0x36')]=_[_0x972e('0x35')](_0x259a6a['model'],qs[_0x972e('0x37')](_0x5c78e1[_0x972e('0x32')][_0x972e('0x37')]));_0x112218[_0x972e('0x36')]=_0x112218['attributes'][_0x972e('0x38')]?_0x112218['attributes']:_0x259a6a['model'];if(_0x5c78e1[_0x972e('0x32')]['includeAll']){_0x112218[_0x972e('0x44')]=[{'all':!![]}];}_0x112218=_['merge']({},_0x112218,_0x5c78e1[_0x972e('0x45')]);return db[_0x972e('0x2c')][_0x972e('0x46')](_0x112218)[_0x972e('0x24')](handleEntityNotFound(_0x54aea5,null))[_0x972e('0x24')](respondWithResult(_0x54aea5,null))['catch'](handleError(_0x54aea5,null));};exports[_0x972e('0x47')]=function(_0x348f46,_0x4cec29){return db[_0x972e('0x2c')][_0x972e('0x47')](_0x348f46[_0x972e('0x48')],{})[_0x972e('0x24')](respondWithResult(_0x4cec29,0xc9))[_0x972e('0x43')](handleError(_0x4cec29,null));};exports[_0x972e('0x23')]=function(_0x29b4c3,_0x14070e){if(_0x29b4c3[_0x972e('0x48')]['id']){delete _0x29b4c3[_0x972e('0x48')]['id'];}return db[_0x972e('0x2c')]['find']({'where':{'id':_0x29b4c3[_0x972e('0x49')]['id']}})[_0x972e('0x24')](handleEntityNotFound(_0x14070e,null))[_0x972e('0x24')](saveUpdates(_0x29b4c3[_0x972e('0x48')],null))['then'](respondWithResult(_0x14070e,null))['catch'](handleError(_0x14070e,null));};exports[_0x972e('0x25')]=function(_0x17117a,_0x134d7f){return db[_0x972e('0x2c')][_0x972e('0x46')]({'where':{'id':_0x17117a[_0x972e('0x49')]['id']}})[_0x972e('0x24')](handleEntityNotFound(_0x134d7f,null))['then'](removeEntity(_0x134d7f,null))['catch'](handleError(_0x134d7f,null));};exports[_0x972e('0x4a')]=function(_0x541487,_0x439fe4){return db['ChatGroup'][_0x972e('0x4a')]()[_0x972e('0x24')](respondWithResult(_0x439fe4,null))[_0x972e('0x43')](handleError(_0x439fe4,null));};exports['getUnread']=function(_0x2d6abc,_0x16882a,_0x5acb0e){return db[_0x972e('0x4b')][_0x972e('0x1e')]({'where':{'ChatGroupId':_0x2d6abc[_0x972e('0x49')]['id'],'ToId':_0x2d6abc[_0x972e('0x4c')]['id'],'read':![]}})[_0x972e('0x24')](function(_0x3bcbe9){return{'id':_[_0x972e('0x4d')](_0x2d6abc[_0x972e('0x49')]['id']),'count':_0x3bcbe9};})[_0x972e('0x24')](respondWithResult(_0x16882a,null))[_0x972e('0x43')](handleError(_0x16882a,null));};exports[_0x972e('0x4e')]=function(_0x121fc2,_0x5ede2b,_0x927808){return db[_0x972e('0x2c')][_0x972e('0x46')]({'where':{'id':_0x121fc2[_0x972e('0x49')]['id']}})[_0x972e('0x24')](handleEntityNotFound(_0x5ede2b,null))[_0x972e('0x24')](function(_0x34b652){if(_0x34b652){return _0x34b652['addMembers'](_0x121fc2[_0x972e('0x48')][_0x972e('0x4f')],_[_0x972e('0x50')](_0x121fc2['body'],['ids','id'])||{});}})[_0x972e('0x24')](respondWithResult(_0x5ede2b,null))[_0x972e('0x43')](handleError(_0x5ede2b,null));};exports[_0x972e('0x51')]=function(_0x51d1a9,_0x5abd78,_0x561d60){var _0x188150={};var _0x1a1459={};var _0x13db34;var _0x31e194;return db[_0x972e('0x2c')][_0x972e('0x52')]({'where':{'id':_0x51d1a9['params']['id']}})[_0x972e('0x24')](handleEntityNotFound(_0x5abd78,null))[_0x972e('0x24')](function(_0x2e3df8){if(_0x2e3df8){_0x13db34=_0x2e3df8;_0x1a1459['model']=_[_0x972e('0x33')](db[_0x972e('0x53')][_0x972e('0x2d')]);_0x1a1459['query']=_[_0x972e('0x33')](_0x51d1a9[_0x972e('0x32')]);_0x1a1459['filters']=_[_0x972e('0x35')](_0x1a1459[_0x972e('0x30')],_0x1a1459[_0x972e('0x32')]);_0x188150['attributes']=_[_0x972e('0x35')](_0x1a1459[_0x972e('0x30')],qs['fields'](_0x51d1a9[_0x972e('0x32')][_0x972e('0x37')]));_0x188150[_0x972e('0x36')]=_0x188150[_0x972e('0x36')][_0x972e('0x38')]?_0x188150[_0x972e('0x36')]:_0x1a1459[_0x972e('0x30')];_0x188150['order']=qs[_0x972e('0x3c')](_0x51d1a9[_0x972e('0x32')]['sort']);_0x188150[_0x972e('0x3d')]=qs[_0x972e('0x34')](_[_0x972e('0x54')](_0x51d1a9[_0x972e('0x32')],_0x1a1459[_0x972e('0x34')]));if(_0x51d1a9[_0x972e('0x32')][_0x972e('0x3e')]){_0x188150[_0x972e('0x3d')]=_[_0x972e('0x3f')](_0x188150[_0x972e('0x3d')],{'$or':_['map'](_0x188150[_0x972e('0x36')],function(_0x1d239a){var _0x22c7d4={};_0x22c7d4[_0x1d239a]={'$like':'%'+_0x51d1a9[_0x972e('0x32')][_0x972e('0x3e')]+'%'};return _0x22c7d4;})});}_0x188150=_['merge']({},_0x188150,_0x51d1a9[_0x972e('0x45')]);return _0x13db34[_0x972e('0x51')](_0x188150);}})[_0x972e('0x24')](function(_0x1e1b33){if(_0x1e1b33){_0x31e194=_0x1e1b33[_0x972e('0x38')];if(!_0x51d1a9[_0x972e('0x32')]['hasOwnProperty'](_0x972e('0x55'))){_0x188150[_0x972e('0x3a')]=qs[_0x972e('0x3a')](_0x51d1a9['query'][_0x972e('0x3a')]);_0x188150['offset']=qs[_0x972e('0x1c')](_0x51d1a9['query'][_0x972e('0x1c')]);}return _0x13db34[_0x972e('0x51')](_0x188150);}})[_0x972e('0x24')](function(_0x493a60){if(_0x493a60){return _0x493a60?{'count':_0x31e194,'rows':_0x493a60}:null;}})[_0x972e('0x24')](respondWithResult(_0x5abd78,null))[_0x972e('0x43')](handleError(_0x5abd78,null));};exports[_0x972e('0x56')]=function(_0x45c9d9,_0x3f1464,_0x2bb998){return db[_0x972e('0x2c')][_0x972e('0x46')]({'where':{'id':_0x45c9d9[_0x972e('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f1464,null))[_0x972e('0x24')](function(_0x310e7e){if(_0x310e7e){return _0x310e7e[_0x972e('0x56')](_0x45c9d9[_0x972e('0x32')][_0x972e('0x4f')]);}})[_0x972e('0x24')](respondWithStatusCode(_0x3f1464,null))[_0x972e('0x43')](handleError(_0x3f1464,null));};exports['addMessage']=function(_0x5478fa,_0x15c709,_0x3d52c0){if(_0x5478fa[_0x972e('0x48')]['id']){delete _0x5478fa[_0x972e('0x48')]['id'];}return db[_0x972e('0x2c')]['find']({'where':{'id':_0x5478fa[_0x972e('0x49')]['id']}})[_0x972e('0x24')](handleEntityNotFound(_0x15c709,null))[_0x972e('0x24')](function(_0xe0e41e){if(_0xe0e41e){_0x5478fa[_0x972e('0x48')]['ChatGroupId']=_0xe0e41e['id'];return db['ChatInternalMessage'][_0x972e('0x47')](_0x5478fa[_0x972e('0x48')]);}})[_0x972e('0x24')](respondWithResult(_0x15c709,null))[_0x972e('0x43')](handleError(_0x15c709,null));};exports[_0x972e('0x57')]=function(_0x5405d1,_0x4015f6,_0x560f02){var _0x407e92={};var _0x507fd2={};var _0x43d0cd;var _0x42a840;return db[_0x972e('0x2c')][_0x972e('0x52')]({'where':{'id':_0x5405d1['params']['id']}})[_0x972e('0x24')](handleEntityNotFound(_0x4015f6,null))[_0x972e('0x24')](function(_0x10bd62){if(_0x10bd62){_0x43d0cd=_0x10bd62;_0x507fd2[_0x972e('0x30')]=_[_0x972e('0x33')](db[_0x972e('0x4b')]['rawAttributes']);_0x507fd2[_0x972e('0x32')]=_[_0x972e('0x33')](_0x5405d1[_0x972e('0x32')]);_0x507fd2[_0x972e('0x34')]=_['intersection'](_0x507fd2[_0x972e('0x30')],_0x507fd2['query']);_0x407e92[_0x972e('0x36')]=_['intersection'](_0x507fd2[_0x972e('0x30')],qs['fields'](_0x5405d1['query'][_0x972e('0x37')]));_0x407e92[_0x972e('0x36')]=_0x407e92['attributes'][_0x972e('0x38')]?_0x407e92['attributes']:_0x507fd2[_0x972e('0x30')];_0x407e92['order']=qs[_0x972e('0x3c')](_0x5405d1[_0x972e('0x32')][_0x972e('0x3c')]);_0x407e92[_0x972e('0x3d')]=qs['filters'](_[_0x972e('0x54')](_0x5405d1['query'],_0x507fd2[_0x972e('0x34')]));if(_0x5405d1[_0x972e('0x32')][_0x972e('0x3e')]){_0x407e92['where']=_[_0x972e('0x3f')](_0x407e92[_0x972e('0x3d')],{'$or':_[_0x972e('0x31')](_0x407e92[_0x972e('0x36')],function(_0x430243){var _0x2eb30f={};_0x2eb30f[_0x430243]={'$like':'%'+_0x5405d1['query'][_0x972e('0x3e')]+'%'};return _0x2eb30f;})});}if(_0x5405d1['query'][_0x972e('0x58')]){var _0xd70e2f=_0x5405d1[_0x972e('0x32')][_0x972e('0x58')][_0x972e('0x59')](',');var _0x4f3167={};_0x4f3167[_0xd70e2f[0x0]]={'$gte':moment(_0xd70e2f[0x1])[_0x972e('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x407e92[_0x972e('0x3d')]=_[_0x972e('0x3f')](_0x407e92['where'],_0x4f3167);}_0x407e92=_['merge']({},_0x407e92,_0x5405d1[_0x972e('0x45')]);return _0x43d0cd[_0x972e('0x57')](_0x407e92);}})[_0x972e('0x24')](function(_0x277590){if(_0x277590){_0x42a840=_0x277590[_0x972e('0x38')];if(!_0x5405d1[_0x972e('0x32')][_0x972e('0x39')](_0x972e('0x55'))){_0x407e92[_0x972e('0x3a')]=qs[_0x972e('0x3a')](_0x5405d1['query'][_0x972e('0x3a')]);_0x407e92[_0x972e('0x1c')]=qs['offset'](_0x5405d1['query']['offset']);}return _0x43d0cd[_0x972e('0x57')](_0x407e92);}})['then'](function(_0x19c1d3){if(_0x19c1d3){return _0x19c1d3?{'count':_0x42a840,'rows':_0x19c1d3}:null;}})[_0x972e('0x24')](respondWithResult(_0x4015f6,null))[_0x972e('0x43')](handleError(_0x4015f6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 7cd2cf3..cb4552c 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 _0xef0a=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3ab14c,_0x4093a1){var _0x423753=function(_0x278031){while(--_0x278031){_0x3ab14c['push'](_0x3ab14c['shift']());}};_0x423753(++_0x4093a1);}(_0xef0a,0xdd));var _0xaef0=function(_0xf04053,_0x126472){_0xf04053=_0xf04053-0x0;var _0x4c12e4=_0xef0a[_0xf04053];return _0x4c12e4;};'use strict';var EventEmitter=require(_0xaef0('0x0'));var ChatGroup=require(_0xaef0('0x1'))['db'][_0xaef0('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xaef0('0x3')](0x0);var events={'afterCreate':_0xaef0('0x4'),'afterUpdate':_0xaef0('0x5'),'afterDestroy':_0xaef0('0x6')};function emitEvent(_0x8cbf2a){return function(_0x3d0bfe,_0x2798e6,_0x9c7ece){ChatGroupEvents['emit'](_0x8cbf2a+':'+_0x3d0bfe['id'],_0x3d0bfe);ChatGroupEvents[_0xaef0('0x7')](_0x8cbf2a,_0x3d0bfe);_0x9c7ece(null);};}for(var e in events){if(events[_0xaef0('0x8')](e)){var event=events[e];ChatGroup[_0xaef0('0x9')](e,emitEvent(event));}}module[_0xaef0('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x8838=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook'];(function(_0x269e5a,_0x1cbe9f){var _0x32ed5a=function(_0x54eb97){while(--_0x54eb97){_0x269e5a['push'](_0x269e5a['shift']());}};_0x32ed5a(++_0x1cbe9f);}(_0x8838,0x90));var _0x8883=function(_0x384867,_0x494cf1){_0x384867=_0x384867-0x0;var _0x4d66a9=_0x8838[_0x384867];return _0x4d66a9;};'use strict';var EventEmitter=require(_0x8883('0x0'));var ChatGroup=require(_0x8883('0x1'))['db'][_0x8883('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8883('0x3')](0x0);var events={'afterCreate':_0x8883('0x4'),'afterUpdate':_0x8883('0x5'),'afterDestroy':_0x8883('0x6')};function emitEvent(_0x87a65f){return function(_0x3df479,_0x2d7568,_0x4c489){ChatGroupEvents[_0x8883('0x7')](_0x87a65f+':'+_0x3df479['id'],_0x3df479);ChatGroupEvents['emit'](_0x87a65f,_0x3df479);_0x4c489(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x8883('0x8')](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 d957523..a729cec 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 _0x4a6c=['path','rimraf','../../config/environment','exports','define','chat_groups','lodash','util','api','moment','bluebird'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x4a6c,0x150));var _0xc4a6=function(_0xd89e41,_0x516cac){_0xd89e41=_0xd89e41-0x0;var _0x5651cf=_0x4a6c[_0xd89e41];return _0x5651cf;};'use strict';var _=require(_0xc4a6('0x0'));var util=require(_0xc4a6('0x1'));var logger=require('../../config/logger')(_0xc4a6('0x2'));var moment=require(_0xc4a6('0x3'));var BPromise=require(_0xc4a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4a6('0x5'));var rimraf=require(_0xc4a6('0x6'));var config=require(_0xc4a6('0x7'));var attributes=require('./chatGroup.attributes');module[_0xc4a6('0x8')]=function(_0x217a72,_0x1a93b1){return _0x217a72[_0xc4a6('0x9')]('ChatGroup',attributes,{'tableName':_0xc4a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f3=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29defd,_0x2f511e){var _0x23a3d7=function(_0x5307fc){while(--_0x5307fc){_0x29defd['push'](_0x29defd['shift']());}};_0x23a3d7(++_0x2f511e);}(_0x42f3,0xad));var _0x342f=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x42f3[_0x545a3a];return _0x5a5493;};'use strict';var _=require('lodash');var util=require(_0x342f('0x0'));var logger=require(_0x342f('0x1'))(_0x342f('0x2'));var moment=require(_0x342f('0x3'));var BPromise=require(_0x342f('0x4'));var rp=require(_0x342f('0x5'));var fs=require('fs');var path=require(_0x342f('0x6'));var rimraf=require(_0x342f('0x7'));var config=require(_0x342f('0x8'));var attributes=require(_0x342f('0x9'));module[_0x342f('0xa')]=function(_0x49968f,_0x559c86){return _0x49968f[_0x342f('0xb')](_0x342f('0xc'),attributes,{'tableName':_0x342f('0xd'),'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 3c54195..0bc0af4 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 _0x7f90=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x5b33ad,_0x2a7d55){var _0x16ec00=function(_0x1caf48){while(--_0x1caf48){_0x5b33ad['push'](_0x5b33ad['shift']());}};_0x16ec00(++_0x2a7d55);}(_0x7f90,0xf4));var _0x07f9=function(_0x5ddd8d,_0x495d09){_0x5ddd8d=_0x5ddd8d-0x0;var _0x453514=_0x7f90[_0x5ddd8d];return _0x453514;};'use strict';var _=require(_0x07f9('0x0'));var util=require(_0x07f9('0x1'));var moment=require(_0x07f9('0x2'));var BPromise=require(_0x07f9('0x3'));var rs=require(_0x07f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x07f9('0x5'));var logger=require(_0x07f9('0x6'))('rpc');var config=require(_0x07f9('0x7'));var jayson=require(_0x07f9('0x8'));var client=jayson[_0x07f9('0x9')][_0x07f9('0xa')]({'port':0x232a});config[_0x07f9('0xb')]=_['defaults'](config['redis'],{'host':_0x07f9('0xc'),'port':0x18eb});var socket=require(_0x07f9('0xd'))(new Redis(config['redis']));require(_0x07f9('0xe'))['register'](socket);function respondWithRpcPromise(_0x11ba3d,_0x36f0d4,_0x242d48){return new BPromise(function(_0x13dcc1,_0x4d34b3){return client[_0x07f9('0xf')](_0x11ba3d,_0x242d48)[_0x07f9('0x10')](function(_0x3f2251){logger[_0x07f9('0x11')]('ChatGroup,\x20%s,\x20%s',_0x36f0d4,_0x07f9('0x12'));logger['debug'](_0x07f9('0x13'),_0x36f0d4,_0x07f9('0x12'),JSON[_0x07f9('0x14')](_0x3f2251));if(_0x3f2251[_0x07f9('0x15')]){if(_0x3f2251[_0x07f9('0x15')]['code']===0x1f4){logger[_0x07f9('0x15')](_0x07f9('0x16'),_0x36f0d4,_0x3f2251['error'][_0x07f9('0x17')]);return _0x4d34b3(_0x3f2251['error'][_0x07f9('0x17')]);}logger[_0x07f9('0x15')]('ChatGroup,\x20%s,\x20%s',_0x36f0d4,_0x3f2251[_0x07f9('0x15')][_0x07f9('0x17')]);return _0x13dcc1(_0x3f2251[_0x07f9('0x15')][_0x07f9('0x17')]);}else{logger['info'](_0x07f9('0x16'),_0x36f0d4,_0x07f9('0x12'));_0x13dcc1(_0x3f2251[_0x07f9('0x18')][_0x07f9('0x17')]);}})['catch'](function(_0x3ab6cc){logger[_0x07f9('0x15')](_0x07f9('0x16'),_0x36f0d4,_0x3ab6cc);_0x4d34b3(_0x3ab6cc);});});} \ No newline at end of file +var _0xf1e1=['stringify','error','code','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x3bb706,_0x5baae3){var _0x18f011=function(_0x2e6fa0){while(--_0x2e6fa0){_0x3bb706['push'](_0x3bb706['shift']());}};_0x18f011(++_0x5baae3);}(_0xf1e1,0x102));var _0x1f1e=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0xf1e1[_0x2a4095];return _0x52eeab;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var moment=require(_0x1f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f1e('0x3'))['db'];var utils=require(_0x1f1e('0x4'));var logger=require(_0x1f1e('0x5'))(_0x1f1e('0x6'));var config=require(_0x1f1e('0x7'));var jayson=require(_0x1f1e('0x8'));var client=jayson[_0x1f1e('0x9')][_0x1f1e('0xa')]({'port':0x232a});config[_0x1f1e('0xb')]=_[_0x1f1e('0xc')](config[_0x1f1e('0xb')],{'host':_0x1f1e('0xd'),'port':0x18eb});var socket=require(_0x1f1e('0xe'))(new Redis(config[_0x1f1e('0xb')]));require('./chatGroup.socket')[_0x1f1e('0xf')](socket);function respondWithRpcPromise(_0x20bd13,_0x12c2ca,_0x128e9f){return new BPromise(function(_0x37989d,_0x32f1ff){return client[_0x1f1e('0x10')](_0x20bd13,_0x128e9f)[_0x1f1e('0x11')](function(_0x824601){logger['info'](_0x1f1e('0x12'),_0x12c2ca,_0x1f1e('0x13'));logger[_0x1f1e('0x14')](_0x1f1e('0x15'),_0x12c2ca,_0x1f1e('0x13'),JSON[_0x1f1e('0x16')](_0x824601));if(_0x824601[_0x1f1e('0x17')]){if(_0x824601['error'][_0x1f1e('0x18')]===0x1f4){logger[_0x1f1e('0x17')]('ChatGroup,\x20%s,\x20%s',_0x12c2ca,_0x824601[_0x1f1e('0x17')][_0x1f1e('0x19')]);return _0x32f1ff(_0x824601['error'][_0x1f1e('0x19')]);}logger[_0x1f1e('0x17')](_0x1f1e('0x12'),_0x12c2ca,_0x824601[_0x1f1e('0x17')][_0x1f1e('0x19')]);return _0x37989d(_0x824601[_0x1f1e('0x17')][_0x1f1e('0x19')]);}else{logger[_0x1f1e('0x1a')](_0x1f1e('0x12'),_0x12c2ca,'request\x20sent');_0x37989d(_0x824601[_0x1f1e('0x1b')][_0x1f1e('0x19')]);}})['catch'](function(_0x19c8c6){logger[_0x1f1e('0x17')](_0x1f1e('0x12'),_0x12c2ca,_0x19c8c6);_0x32f1ff(_0x19c8c6);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8c6e263..5cbe128 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 _0x6b19=['remove','update','emit','register','length','./chatGroup.events','save'];(function(_0xaff186,_0x311478){var _0x38a41e=function(_0x5af105){while(--_0x5af105){_0xaff186['push'](_0xaff186['shift']());}};_0x38a41e(++_0x311478);}(_0x6b19,0xd0));var _0x96b1=function(_0x1bcc35,_0x1253be){_0x1bcc35=_0x1bcc35-0x0;var _0x471657=_0x6b19[_0x1bcc35];return _0x471657;};'use strict';var ChatGroupEvents=require(_0x96b1('0x0'));var events=[_0x96b1('0x1'),_0x96b1('0x2'),_0x96b1('0x3')];function createListener(_0x402f32,_0x1da27e){return function(_0x25fe39){_0x1da27e[_0x96b1('0x4')](_0x402f32,_0x25fe39);};}function removeListener(_0x35612d,_0x44edeb){return function(){ChatGroupEvents['removeListener'](_0x35612d,_0x44edeb);};}exports[_0x96b1('0x5')]=function(_0x17e296){for(var _0x18bb5f=0x0,_0x464217=events[_0x96b1('0x6')];_0x18bb5f<_0x464217;_0x18bb5f++){var _0x1ad864=events[_0x18bb5f];var _0x78c48c=createListener('chatGroup:'+_0x1ad864,_0x17e296);ChatGroupEvents['on'](_0x1ad864,_0x78c48c);}}; \ No newline at end of file +var _0x3bff=['remove','update','length','chatGroup:'];(function(_0x45cb25,_0x51c508){var _0x692d04=function(_0x2dd624){while(--_0x2dd624){_0x45cb25['push'](_0x45cb25['shift']());}};_0x692d04(++_0x51c508);}(_0x3bff,0x124));var _0xf3bf=function(_0x1b2c60,_0x53b096){_0x1b2c60=_0x1b2c60-0x0;var _0x1b6b7e=_0x3bff[_0x1b2c60];return _0x1b6b7e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0xf3bf('0x0'),_0xf3bf('0x1')];function createListener(_0x1eabc9,_0x2aa77b){return function(_0x13c5fb){_0x2aa77b['emit'](_0x1eabc9,_0x13c5fb);};}function removeListener(_0x4b471f,_0x4841b2){return function(){ChatGroupEvents['removeListener'](_0x4b471f,_0x4841b2);};}exports['register']=function(_0x5b0461){for(var _0x2b47d9=0x0,_0x4c7095=events[_0xf3bf('0x2')];_0x2b47d9<_0x4c7095;_0x2b47d9++){var _0x392b9f=events[_0x2b47d9];var _0x53b589=createListener(_0xf3bf('0x3')+_0x392b9f,_0x5b0461);ChatGroupEvents['on'](_0x392b9f,_0x53b589);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 93d940b..03bbc61 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 _0x3f3d=['addMembers','/:id/messages','addMessage','put','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','index','get','/describe','/:id','isAuthenticated','show','/:id/unread','getUnread','/:id/members','getMessages','post'];(function(_0x4dd851,_0x467113){var _0xc69fb1=function(_0x557503){while(--_0x557503){_0x4dd851['push'](_0x4dd851['shift']());}};_0xc69fb1(++_0x467113);}(_0x3f3d,0x13f));var _0xd3f3=function(_0x7aef09,_0x192202){_0x7aef09=_0x7aef09-0x0;var _0x224203=_0x3f3d[_0x7aef09];return _0x224203;};'use strict';var multer=require(_0xd3f3('0x0'));var util=require(_0xd3f3('0x1'));var path=require(_0xd3f3('0x2'));var timeout=require(_0xd3f3('0x3'));var express=require(_0xd3f3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd3f3('0x5'));var interaction=require(_0xd3f3('0x6'));var config=require('../../config/environment');var controller=require(_0xd3f3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd3f3('0x8')]);router[_0xd3f3('0x9')](_0xd3f3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd3f3('0x9')](_0xd3f3('0xb'),auth[_0xd3f3('0xc')](),controller[_0xd3f3('0xd')]);router[_0xd3f3('0x9')](_0xd3f3('0xe'),auth[_0xd3f3('0xc')](),controller[_0xd3f3('0xf')]);router[_0xd3f3('0x9')](_0xd3f3('0x10'),auth[_0xd3f3('0xc')](),controller['getMembers']);router[_0xd3f3('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd3f3('0x11')]);router[_0xd3f3('0x12')]('/',auth[_0xd3f3('0xc')](),controller['create']);router[_0xd3f3('0x12')]('/:id/members',auth[_0xd3f3('0xc')](),controller[_0xd3f3('0x13')]);router['post'](_0xd3f3('0x14'),auth[_0xd3f3('0xc')](),controller[_0xd3f3('0x15')]);router[_0xd3f3('0x16')](_0xd3f3('0xb'),auth[_0xd3f3('0xc')](),controller['update']);router['delete']('/:id',auth[_0xd3f3('0xc')](),controller[_0xd3f3('0x17')]);router['delete']('/:id/members',auth[_0xd3f3('0xc')](),controller[_0xd3f3('0x18')]);module[_0xd3f3('0x19')]=router; \ No newline at end of file +var _0x3613=['getMembers','/:id/messages','getMessages','create','addMembers','post','addMessage','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','/:id/members'];(function(_0x41428b,_0xe6dbc7){var _0x3d32df=function(_0x2cd3c9){while(--_0x2cd3c9){_0x41428b['push'](_0x41428b['shift']());}};_0x3d32df(++_0xe6dbc7);}(_0x3613,0x181));var _0x3361=function(_0x566aaf,_0x38b9cd){_0x566aaf=_0x566aaf-0x0;var _0x1b2fa8=_0x3613[_0x566aaf];return _0x1b2fa8;};'use strict';var multer=require('multer');var util=require(_0x3361('0x0'));var path=require(_0x3361('0x1'));var timeout=require(_0x3361('0x2'));var express=require(_0x3361('0x3'));var router=express[_0x3361('0x4')]();var fs_extra=require(_0x3361('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3361('0x6'));var config=require('../../config/environment');var controller=require(_0x3361('0x7'));router[_0x3361('0x8')]('/',auth[_0x3361('0x9')](),controller[_0x3361('0xa')]);router[_0x3361('0x8')]('/describe',auth[_0x3361('0x9')](),controller[_0x3361('0xb')]);router[_0x3361('0x8')](_0x3361('0xc'),auth[_0x3361('0x9')](),controller['show']);router['get'](_0x3361('0xd'),auth['isAuthenticated'](),controller['getUnread']);router[_0x3361('0x8')](_0x3361('0xe'),auth[_0x3361('0x9')](),controller[_0x3361('0xf')]);router[_0x3361('0x8')](_0x3361('0x10'),auth[_0x3361('0x9')](),controller[_0x3361('0x11')]);router['post']('/',auth[_0x3361('0x9')](),controller[_0x3361('0x12')]);router['post'](_0x3361('0xe'),auth[_0x3361('0x9')](),controller[_0x3361('0x13')]);router[_0x3361('0x14')](_0x3361('0x10'),auth[_0x3361('0x9')](),controller[_0x3361('0x15')]);router['put']('/:id',auth[_0x3361('0x9')](),controller[_0x3361('0x16')]);router[_0x3361('0x17')](_0x3361('0xc'),auth['isAuthenticated'](),controller[_0x3361('0x18')]);router[_0x3361('0x17')](_0x3361('0xe'),auth[_0x3361('0x9')](),controller['removeMembers']);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 c4db98b..2ed8195 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 _0x6b20=['DATE','long','ENUM','out','BOOLEAN','sequelize','exports','INTEGER','star','thumb','TEXT','STRING'];(function(_0x5bfbf4,_0x165ba5){var _0x2bc520=function(_0x15d92b){while(--_0x15d92b){_0x5bfbf4['push'](_0x5bfbf4['shift']());}};_0x2bc520(++_0x165ba5);}(_0x6b20,0xd1));var _0x06b2=function(_0x7d6bf2,_0x405a26){_0x7d6bf2=_0x7d6bf2-0x0;var _0x4a8998=_0x6b20[_0x7d6bf2];return _0x4a8998;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x06b2('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x06b2('0x3'),_0x06b2('0x4')),'defaultValue':_0x06b2('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x06b2('0x5')]},'mailTranscript':{'type':Sequelize[_0x06b2('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x06b2('0x7')]},'disposition':{'type':Sequelize[_0x06b2('0x6')]},'secondDisposition':{'type':Sequelize[_0x06b2('0x6')]},'thirdDisposition':{'type':Sequelize[_0x06b2('0x6')]},'note':{'type':Sequelize[_0x06b2('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x06b2('0x6')]},'osName':{'type':Sequelize[_0x06b2('0x6')]},'osVersion':{'type':Sequelize[_0x06b2('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x06b2('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x06b2('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x06b2('0x8'))},'read1stAt':{'type':Sequelize[_0x06b2('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x06b2('0x9')]('in',_0x06b2('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x06b2('0x6')]},'customerPort':{'type':Sequelize[_0x06b2('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x06b2('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x06b2('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x915a=['ENUM','thumb','TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0xcc59f3,_0x16e91e){var _0x4bc13e=function(_0x245586){while(--_0x245586){_0xcc59f3['push'](_0xcc59f3['shift']());}};_0x4bc13e(++_0x16e91e);}(_0x915a,0x1d2));var _0xa915=function(_0x126193,_0x47bf8c){_0x126193=_0x126193-0x0;var _0x19bf08=_0x915a[_0x126193];return _0x19bf08;};'use strict';var Sequelize=require(_0xa915('0x0'));module[_0xa915('0x1')]={'closed':{'type':Sequelize[_0xa915('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa915('0x3')]},'ratingType':{'type':Sequelize[_0xa915('0x4')]('star',_0xa915('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa915('0x6')]},'mailTranscript':{'type':Sequelize[_0xa915('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa915('0x8')]},'disposition':{'type':Sequelize[_0xa915('0x7')]},'secondDisposition':{'type':Sequelize[_0xa915('0x7')]},'thirdDisposition':{'type':Sequelize[_0xa915('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xa915('0x7')]},'osName':{'type':Sequelize[_0xa915('0x7')]},'osVersion':{'type':Sequelize[_0xa915('0x7')]},'deviceModel':{'type':Sequelize[_0xa915('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xa915('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa915('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xa915('0x8')]},'lastMsgAt':{'type':Sequelize[_0xa915('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xa915('0x4')]('in',_0xa915('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xa915('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7964366..f8e8117 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 _0x2c52=['vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','basename','filename','mimetype','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','ChatMessage','User','Messages','agentAlias','System','%s%d','Visitor','ContactId','agentIdentifier','website_alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','getMessages','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','getMyMessages','order','push','alias','rows','addTags','omit','spread','color','emit','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','read','Owner','get','mkdirSync','Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','referer','customerIp','customerPort','createReadStream','createWriteStream','lastName','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','http','client','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','stack','name','send','render','merge','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','type','key','getOptions','findAll','chat','user','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','update','describe','findOne','ChatWebsite','ChatWebsiteId'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x2c52,0x150));var _0x22c5=function(_0x5eb5fa,_0x5ed05e){_0x5eb5fa=_0x5eb5fa-0x0;var _0x199396=_0x2c52[_0x5eb5fa];return _0x199396;};'use strict';var rimraf=require(_0x22c5('0x0'));var zipdir=require(_0x22c5('0x1'));var rp=require(_0x22c5('0x2'));var moment=require(_0x22c5('0x3'));var BPromise=require(_0x22c5('0x4'));var Mustache=require(_0x22c5('0x5'));var util=require(_0x22c5('0x6'));var path=require(_0x22c5('0x7'));var ejs=require(_0x22c5('0x8'));var fs=require('fs');var _=require(_0x22c5('0x9'));var Redis=require(_0x22c5('0xa'));var interaction=require(_0x22c5('0xb'));var qs=require(_0x22c5('0xc'));var pdf=require(_0x22c5('0xd'));var logger=require(_0x22c5('0xe'))(_0x22c5('0xf'));var config=require('../../config/environment');var db=require(_0x22c5('0x10'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x22c5('0x11'),'port':0x18eb});var socket=require(_0x22c5('0x12'))(new Redis(config[_0x22c5('0x13')]));require(_0x22c5('0x14'))[_0x22c5('0x15')](socket);var jayson=require(_0x22c5('0x16'));var client=jayson['client'][_0x22c5('0x17')]({'port':0x232b});var client9004=jayson[_0x22c5('0x18')][_0x22c5('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x31b583,_0x3cc0e2,_0x3ecbf1,_0x49dd81){return new BPromise(function(_0x512571,_0x3fb9df){var _0x3e0ed6=_0x49dd81||client;return _0x3e0ed6[_0x22c5('0x19')](_0x31b583,_0x3ecbf1)['then'](function(_0x2b19fb){logger['info'](_0x22c5('0x1a'),_0x3cc0e2,_0x22c5('0x1b'));logger[_0x22c5('0x1c')](_0x22c5('0x1d'),_0x3cc0e2,'request\x20sent',JSON[_0x22c5('0x1e')](_0x2b19fb));if(_0x2b19fb[_0x22c5('0x1f')]){if(_0x2b19fb[_0x22c5('0x1f')]['code']===0x1f4){logger[_0x22c5('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x3cc0e2,_0x2b19fb['error'][_0x22c5('0x20')]);return _0x3fb9df(_0x2b19fb[_0x22c5('0x1f')][_0x22c5('0x20')]);}logger[_0x22c5('0x1f')](_0x22c5('0x1a'),_0x3cc0e2,_0x2b19fb[_0x22c5('0x1f')][_0x22c5('0x20')]);return _0x512571(_0x2b19fb[_0x22c5('0x1f')][_0x22c5('0x20')]);}else{logger[_0x22c5('0x21')](_0x22c5('0x1a'),_0x3cc0e2,'request\x20sent');_0x512571(_0x2b19fb['result'][_0x22c5('0x20')]);}})[_0x22c5('0x22')](function(_0x506d30){logger[_0x22c5('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x3cc0e2,_0x506d30);_0x3fb9df(_0x506d30);});});}function respondWithStatusCode(_0x188402,_0x5e1fec){_0x5e1fec=_0x5e1fec||0xcc;return function(_0x43d9d3){if(_0x43d9d3){return _0x188402[_0x22c5('0x23')](_0x5e1fec);}return _0x188402[_0x22c5('0x24')](_0x5e1fec)['end']();};}function respondWithResult(_0x29675e,_0x1bd3f5){_0x1bd3f5=_0x1bd3f5||0xc8;return function(_0x1744ac){if(_0x1744ac){return _0x29675e[_0x22c5('0x24')](_0x1bd3f5)[_0x22c5('0x25')](_0x1744ac);}};}function respondWithFilteredResult(_0x4d15d7,_0x3acf27){return function(_0x241fab){if(_0x241fab){var _0x360fa7=typeof _0x3acf27[_0x22c5('0x26')]==='undefined'&&typeof _0x3acf27[_0x22c5('0x27')]===_0x22c5('0x28');var _0x465ff=_0x241fab['count'];var _0x2f6400=_0x360fa7?0x0:_0x3acf27[_0x22c5('0x26')];var _0x51826d=_0x360fa7?_0x241fab[_0x22c5('0x29')]:_0x3acf27[_0x22c5('0x26')]+_0x3acf27[_0x22c5('0x27')];var _0x44ebe3;if(_0x51826d>=_0x465ff){_0x51826d=_0x465ff;_0x44ebe3=0xc8;}else{_0x44ebe3=0xce;}_0x4d15d7[_0x22c5('0x24')](_0x44ebe3);return _0x4d15d7[_0x22c5('0x2a')](_0x22c5('0x2b'),_0x2f6400+'-'+_0x51826d+'/'+_0x465ff)[_0x22c5('0x25')](_0x241fab);}return null;};}function saveUpdates(_0x3fa20f){return function(_0x30f00a){if(_0x30f00a){return _0x30f00a['update'](_0x3fa20f)[_0x22c5('0x2c')](function(_0x166340){return _0x166340;});}return null;};}function removeEntity(_0x51f2d6){return function(_0x11853b){if(_0x11853b){return _0x11853b[_0x22c5('0x2d')]()[_0x22c5('0x2c')](function(){_0x51f2d6[_0x22c5('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e07f){return function(_0x4a1030){if(!_0x4a1030){_0x5e07f[_0x22c5('0x23')](0x194);}return _0x4a1030;};}function handleError(_0x4369c9,_0x43c9aa){_0x43c9aa=_0x43c9aa||0x1f4;return function(_0x3210da){logger[_0x22c5('0x1f')](_0x3210da[_0x22c5('0x2e')]);if(_0x3210da[_0x22c5('0x2f')]){delete _0x3210da[_0x22c5('0x2f')];}_0x4369c9[_0x22c5('0x24')](_0x43c9aa)[_0x22c5('0x30')](_0x3210da);};}function getMustacheRender(_0x1357d8,_0x6b273d){return Mustache[_0x22c5('0x31')](_0x1357d8,_[_0x22c5('0x32')](_0x6b273d[_0x22c5('0x33')],{'contact':_0x6b273d['contact'],'message':_0x6b273d[_0x22c5('0x20')],'agent':_0x6b273d[_0x22c5('0x34')],'interaction':_0x6b273d[_0x22c5('0x35')],'account':_0x6b273d[_0x22c5('0x36')]}))||'';}exports[_0x22c5('0x37')]=function(_0x35f9c6,_0x56036a){var _0x4b6be6={};var _0x1e965b=_[_0x22c5('0x38')](db[_0x22c5('0x39')][_0x22c5('0x3a')],function(_0x1ff0d9){return{'name':_0x1ff0d9['fieldName'],'type':_0x1ff0d9[_0x22c5('0x3b')][_0x22c5('0x3c')]};});_0x4b6be6=qs[_0x22c5('0x3d')](_0x1e965b,_0x35f9c6);return interaction[_0x22c5('0x3e')](_0x22c5('0x3f'),_0x35f9c6['query'],_0x35f9c6[_0x22c5('0x40')],_0x4b6be6,_0x1e965b)['then'](respondWithFilteredResult(_0x56036a,_0x4b6be6))[_0x22c5('0x22')](handleError(_0x56036a,null));};exports[_0x22c5('0x41')]=function(_0x4409eb,_0x490429){var _0x2e7a52={'raw':![],'where':{'id':_0x4409eb[_0x22c5('0x42')]['id']}},_0x54017e={};_0x54017e[_0x22c5('0x43')]=_[_0x22c5('0x44')](db['ChatInteraction'][_0x22c5('0x3a')]);_0x54017e[_0x22c5('0x45')]=_[_0x22c5('0x44')](_0x4409eb[_0x22c5('0x45')]);_0x54017e[_0x22c5('0x46')]=_[_0x22c5('0x47')](_0x54017e[_0x22c5('0x43')],_0x54017e[_0x22c5('0x45')]);_0x2e7a52['attributes']=_[_0x22c5('0x47')](_0x54017e['model'],qs[_0x22c5('0x48')](_0x4409eb[_0x22c5('0x45')][_0x22c5('0x48')]));_0x2e7a52[_0x22c5('0x49')]=_0x2e7a52[_0x22c5('0x49')][_0x22c5('0x4a')]?_0x2e7a52['attributes']:_0x54017e[_0x22c5('0x43')];if(_0x4409eb[_0x22c5('0x45')][_0x22c5('0x4b')]){_0x2e7a52[_0x22c5('0x4c')]=[{'all':!![]}];}_0x2e7a52=_[_0x22c5('0x32')]({},_0x2e7a52,_0x4409eb[_0x22c5('0x4d')]);return db[_0x22c5('0x39')][_0x22c5('0x4e')](_0x2e7a52)[_0x22c5('0x2c')](handleEntityNotFound(_0x490429,null))[_0x22c5('0x2c')](respondWithResult(_0x490429,null))[_0x22c5('0x22')](handleError(_0x490429,null));};exports['create']=function(_0x2e8189,_0x5dd9c2){return db[_0x22c5('0x39')]['create'](_0x2e8189['body'],{})[_0x22c5('0x2c')](respondWithResult(_0x5dd9c2,0xc9))[_0x22c5('0x22')](handleError(_0x5dd9c2,null));};exports[_0x22c5('0x4f')]=function(_0x5d2004,_0x90477b){if(_0x5d2004[_0x22c5('0x33')]['id']){delete _0x5d2004[_0x22c5('0x33')]['id'];}return db[_0x22c5('0x39')][_0x22c5('0x4e')]({'where':{'id':_0x5d2004['params']['id']}})[_0x22c5('0x2c')](handleEntityNotFound(_0x90477b,null))[_0x22c5('0x2c')](saveUpdates(_0x5d2004[_0x22c5('0x33')],null))[_0x22c5('0x2c')](respondWithResult(_0x90477b,null))[_0x22c5('0x22')](handleError(_0x90477b,null));};exports['destroy']=function(_0x425599,_0x298e15){return db[_0x22c5('0x39')]['find']({'where':{'id':_0x425599[_0x22c5('0x42')]['id']}})[_0x22c5('0x2c')](handleEntityNotFound(_0x298e15,null))['then'](removeEntity(_0x298e15,null))[_0x22c5('0x22')](handleError(_0x298e15,null));};exports[_0x22c5('0x50')]=function(_0x165882,_0xbcf5fb){return db['ChatInteraction'][_0x22c5('0x50')]()[_0x22c5('0x2c')](respondWithResult(_0xbcf5fb,null))[_0x22c5('0x22')](handleError(_0xbcf5fb,null));};exports['createVidaooSession']=function(_0x1c75b8,_0x5c9261){var _0x244ee7=_0x1c75b8[_0x22c5('0x42')]['id'];var _0xb9617e;var _0x58972b;var _0x1b7a42;return db['ChatInteraction'][_0x22c5('0x51')]({'where':{'id':_0x244ee7}})[_0x22c5('0x2c')](function(_0x475249){_0xb9617e=_0x475249;return db[_0x22c5('0x52')]['findOne']({'where':{'id':_0x475249[_0x22c5('0x53')]},'attributes':['id',_0x22c5('0x54'),_0x22c5('0x55'),_0x22c5('0x56'),_0x22c5('0x57'),_0x22c5('0x58')],'raw':!![]});})['then'](function(_0x341802){if(_0x341802&&_0x341802[_0x22c5('0x54')]&&_0x341802['vidaooEscalation']){_0x58972b=_0x341802;var _0x3aadeb={'interaction':{'id':_0x244ee7},'agent':{'id':_0x1c75b8[_0x22c5('0x40')]['id'],'name':_0x1c75b8[_0x22c5('0x40')][_0x22c5('0x2f')],'fullname':_0x1c75b8[_0x22c5('0x40')]['fullname'],'email':_0x1c75b8[_0x22c5('0x40')][_0x22c5('0x59')]},'contact':_0x1c75b8[_0x22c5('0x33')][_0x22c5('0x5a')],'account':_0x1c75b8[_0x22c5('0x33')][_0x22c5('0x36')]};var _0x1aac6e={'rejectUnauthorized':![],'method':'POST','url':_0x22c5('0x5b'),'headers':{'X-APIKEY':_0x341802[_0x22c5('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1c75b8[_0x22c5('0x40')][_0x22c5('0x59')]],'buttons':null,'topic':_0x58972b[_0x22c5('0x56')],'note':_[_0x22c5('0x5c')](_0x58972b['vidaooNote'])?null:getMustacheRender(_0x58972b[_0x22c5('0x57')],_0x3aadeb),'metadata':null},'redirect':_0x22c5('0x5d'),'json':!![]};try{if(!_['isNull'](_0x58972b[_0x22c5('0x58')])){var _0x4ceb08=getMustacheRender(_0x58972b[_0x22c5('0x58')],_0x3aadeb);var _0x22e646=JSON[_0x22c5('0x5e')](_0x4ceb08);_0x1aac6e['body'][_0x22c5('0x5f')]=_0x22e646;}}catch(_0x1e4cae){throw new db['Sequelize']['ValidationError'](_0x22c5('0x60'));}return rp(_0x1aac6e);}else{throw new db[(_0x22c5('0x61'))][(_0x22c5('0x62'))](_0x22c5('0x63'));}})[_0x22c5('0x2c')](function(_0x265d36){_0x1b7a42=_0x265d36;if(_0x1b7a42['id']){var _0x457967={'body':_0x1b7a42[_0x22c5('0x64')],'ChatWebsiteId':_0x58972b['id'],'ChatInteractionId':_0xb9617e['id'],'direction':_0x22c5('0x65'),'UserId':_0x1c75b8['user']['id']};return db['ChatMessage'][_0x22c5('0x66')](_0x457967,{});}else{throw new db['Sequelize'][(_0x22c5('0x62'))](_0x22c5('0x67'));}})[_0x22c5('0x2c')](function(){return _0xb9617e[_0x22c5('0x68')]({'vidaooSessionId':_0x1b7a42['id']});})[_0x22c5('0x2c')](respondWithResult(_0x5c9261,null))[_0x22c5('0x22')](handleError(_0x5c9261,null));};exports[_0x22c5('0x69')]=function(_0x4dfe3d,_0x4a05b8){if(_0x4dfe3d['body']['id']){delete _0x4dfe3d[_0x22c5('0x33')]['id'];}return db['ChatInteraction'][_0x22c5('0x4e')]({'where':{'id':_0x4dfe3d[_0x22c5('0x42')]['id']},'include':[{'model':db[_0x22c5('0x6a')],'as':_0x22c5('0x6b')}]})[_0x22c5('0x2c')](handleEntityNotFound(_0x4a05b8,null))[_0x22c5('0x2c')](saveUpdates(_0x4dfe3d[_0x22c5('0x33')],null))['then'](respondWithResult(_0x4a05b8,null))['catch'](handleError(_0x4a05b8,null));};exports['abandon']=function(_0x12db25,_0x41d67b){if(_0x12db25['body']['id']){delete _0x12db25[_0x22c5('0x33')]['id'];}return db[_0x22c5('0x39')]['find']({'where':{'id':_0x12db25[_0x22c5('0x42')]['id']}})[_0x22c5('0x2c')](function(_0x230cef){if(!_0x230cef){logger[_0x22c5('0x1f')](_0x22c5('0x6c'),_0x22c5('0x6d'),0x194,_0x22c5('0x6e'));_0x41d67b[_0x22c5('0x23')](0x194);}else{if(_0x230cef[_0x22c5('0x6f')]){throw new db[(_0x22c5('0x61'))]['ValidationError'](_0x22c5('0x70'));}}return _0x230cef;})['then'](function(_0x10a2b1){if(_0x10a2b1){return _0x10a2b1[_0x22c5('0x4f')]({'closed':_0x12db25[_0x22c5('0x33')][_0x22c5('0x71')],'disposition':_0x12db25[_0x22c5('0x33')]['disposition']})[_0x22c5('0x2c')](function(_0xdfa74d){return _0xdfa74d;});}})[_0x22c5('0x2c')](function(){return respondWithRpcPromise(_0x22c5('0x72'),'abandon',_0x12db25['body'],client9004);})[_0x22c5('0x2c')](respondWithResult(_0x41d67b,null))[_0x22c5('0x22')](handleError(_0x41d67b,null));};exports[_0x22c5('0x73')]=function(_0x5ccaff,_0x2e2fc5){_0x5ccaff[_0x22c5('0x33')][_0x22c5('0x2f')]=_0x5ccaff[_0x22c5('0x74')]['originalname'];_0x5ccaff[_0x22c5('0x33')][_0x22c5('0x75')]=_0x5ccaff[_0x22c5('0x74')][_0x22c5('0x76')];_0x5ccaff['body'][_0x22c5('0x3b')]=_0x5ccaff[_0x22c5('0x74')][_0x22c5('0x77')];return db[_0x22c5('0x78')][_0x22c5('0x66')](_0x5ccaff[_0x22c5('0x33')])[_0x22c5('0x2c')](respondWithResult(_0x2e2fc5,0xc9))[_0x22c5('0x22')](handleError(_0x2e2fc5,null));};exports['attachmentDownload']=function(_0x113d98,_0xdc925){return db['ChatInteraction'][_0x22c5('0x51')]({'where':{'id':_0x113d98[_0x22c5('0x42')]['id']},'raw':!![]})[_0x22c5('0x2c')](handleEntityNotFound(_0xdc925,null))[_0x22c5('0x2c')](function(_0x7a671c){if(_0x7a671c){if(_0x7a671c[_0x22c5('0x71')]){return _0xdc925[_0x22c5('0x24')](0x193)[_0x22c5('0x25')]({'status':0x193,'message':'Unauthorized'});}return db[_0x22c5('0x78')][_0x22c5('0x51')]({'where':{'id':_0x113d98[_0x22c5('0x45')][_0x22c5('0x79')]},'raw':!![]})[_0x22c5('0x2c')](handleEntityNotFound(_0xdc925,null));}})[_0x22c5('0x2c')](function(_0x34b5ec){if(_0x34b5ec){var _0x401d23=_0x34b5ec[_0x22c5('0x7a')]!==null;var _0x114784=path[_0x22c5('0x7b')](config[_0x22c5('0x7c')],_0x22c5('0x7d'));if(_0x401d23){_0x114784=path[_0x22c5('0x7b')](_0x114784,'offline-chat/');}var _0xd21a2a=path['join'](_0x114784,_0x34b5ec[_0x22c5('0x75')]);return _0xdc925[_0x22c5('0x7e')](_0xd21a2a);}})['catch'](handleError(_0xdc925,null));};exports['close']=function(_0x834a43,_0xa278fa){var _0x25ea25=null;var _0xaf14ee=null;var _0x553cab=null;if(_0x834a43[_0x22c5('0x33')]['id']){delete _0x834a43[_0x22c5('0x33')]['id'];}if(_0x834a43[_0x22c5('0x33')][_0x22c5('0x7f')]){_0x553cab=path[_0x22c5('0x7b')](config['root'],_0x22c5('0x80'),util[_0x22c5('0x81')](_0x22c5('0x82'),Date['now']()));_0x834a43['body'][_0x22c5('0x83')]=_0x553cab;}return db[_0x22c5('0x39')][_0x22c5('0x4e')]({'where':{'id':_0x834a43['params']['id']},'include':[{'model':db[_0x22c5('0x84')],'as':'Messages','include':[{'model':db[_0x22c5('0x85')],'as':_0x22c5('0x85')}]}]})[_0x22c5('0x2c')](handleEntityNotFound(_0xa278fa,null))[_0x22c5('0x2c')](saveUpdates(_0x834a43[_0x22c5('0x33')],null))['then'](function(_0x1484a3){if(_0x1484a3){_0x25ea25=_0x1484a3;return db['ChatWebsite'][_0x22c5('0x4e')]({'where':{'id':_0x25ea25['ChatWebsiteId']}});}})['then'](function(_0x2c5c94){if(_0x2c5c94){_0xaf14ee=_0x2c5c94;return db[_0x22c5('0x6a')]['find']({'where':{'id':_0x25ea25['ContactId']}});}})[_0x22c5('0x2c')](function(_0x195bb1){if(_0x195bb1){if(_0x553cab){var _0x407388=null;for(var _0x260185=0x1;_0x260185<_0x25ea25[_0x22c5('0x86')][_0x22c5('0x4a')];++_0x260185){_0x407388=_0x25ea25[_0x22c5('0x86')][_0x260185];var _0x2dbd25=_0x407388[_0x22c5('0x6f')]?util[_0x22c5('0x81')]('%s%d',_0xaf14ee[_0x22c5('0x87')],_0x407388[_0x22c5('0x6f')]):_0x22c5('0x88');var _0x4141db=_0x834a43[_0x22c5('0x33')]['customer']||util[_0x22c5('0x81')](_0x22c5('0x89'),_0x22c5('0x8a'),_0x407388[_0x22c5('0x8b')]);switch(_0xaf14ee[_0x22c5('0x8c')]){case _0x22c5('0x8d'):_0x2dbd25=_0x407388[_0x22c5('0x6f')]?util[_0x22c5('0x81')](_0x22c5('0x89'),_0xaf14ee['agentAlias'],_0x407388[_0x22c5('0x6f')]):'System';break;case'agent_alias':_0x2dbd25=_0x407388[_0x22c5('0x6f')]?_0x407388[_0x22c5('0x85')]['alias']||_0x407388['User']['fullname']:_0x22c5('0x88');break;case _0x22c5('0x8e'):_0x2dbd25=_0x407388[_0x22c5('0x6f')]?_0x407388[_0x22c5('0x85')][_0x22c5('0x8f')]:_0x22c5('0x88');break;default:_0x2dbd25=_0x407388[_0x22c5('0x6f')]?util[_0x22c5('0x81')](_0x22c5('0x89'),_0xaf14ee[_0x22c5('0x87')],_0x407388[_0x22c5('0x6f')]):'System';}var _0x289e5f=util[_0x22c5('0x81')](_0x22c5('0x90'),moment(_0x407388[_0x22c5('0x91')])[_0x22c5('0x81')](_0x22c5('0x92')),_0x407388[_0x22c5('0x93')]==='in'?_0x4141db:_0x2dbd25,_0x407388[_0x22c5('0x33')]);if(!_0x407388[_0x22c5('0x94')]){fs[_0x22c5('0x95')](_0x553cab,_0x289e5f);}}return db[_0x22c5('0x96')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x22c5('0x97'),'raw':!![],'include':[{'model':db[_0x22c5('0x98')],'as':_0x22c5('0x98'),'raw':!![]}]}]});}}})[_0x22c5('0x2c')](function(_0x5c2712){if(!_0x5c2712||!_0x5c2712[_0x22c5('0x97')]||!_0x834a43[_0x22c5('0x33')])return _0x25ea25;var _0x2bddd8=_0x5c2712['getSmtpOptions']();return respondWithRpcPromise(_0x22c5('0x99'),_0x22c5('0x9a'),{'account':_0x2bddd8,'message':{'from':util[_0x22c5('0x81')]('\x22%s\x22\x20<%s>',_0x5c2712[_0x22c5('0x2f')],_0x5c2712[_0x22c5('0x59')]||_0x5c2712[_0x22c5('0x97')][_0x22c5('0x40')]),'to':_0x834a43[_0x22c5('0x33')][_0x22c5('0x7f')],'subject':_0x22c5('0x9b'),'text':util[_0x22c5('0x81')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x834a43[_0x22c5('0x33')][_0x22c5('0x7f')]),'attachments':[{'path':_0x553cab}]}})[_0x22c5('0x2c')](function(){return _0x25ea25;})[_0x22c5('0x22')](function(_0x5e1106){logger[_0x22c5('0x1f')](_0x5e1106);});})[_0x22c5('0x2c')](respondWithStatusCode(_0xa278fa,0xc8))[_0x22c5('0x22')](handleError(_0xa278fa,null));};exports[_0x22c5('0x9c')]=function(_0x127b81,_0x25f545){return db[_0x22c5('0x84')]['find']({'where':{'id':_0x127b81[_0x22c5('0x42')]['id']}})['then'](handleEntityNotFound(_0x25f545,null))[_0x22c5('0x2c')](function(_0x11f918){if(_0x11f918){return _0x11f918[_0x22c5('0x9c')](_0x127b81[_0x22c5('0x33')][_0x22c5('0x9d')],_['omit'](_0x127b81[_0x22c5('0x33')],[_0x22c5('0x9d'),'id'])||{});}})[_0x22c5('0x2c')](respondWithResult(_0x25f545,null))[_0x22c5('0x22')](handleError(_0x25f545,null));};exports[_0x22c5('0x9e')]=function(_0x3384e1,_0x58d80f){var _0x4e01d0={'raw':![],'where':{}};var _0x255569={};var _0x5deb18={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x3384e1[_0x22c5('0x42')]['id']}})[_0x22c5('0x2c')](handleEntityNotFound(_0x58d80f,null))[_0x22c5('0x2c')](function(_0x4a8e6d){if(_0x4a8e6d){_0x255569[_0x22c5('0x43')]=_[_0x22c5('0x44')](db[_0x22c5('0x84')]['rawAttributes']);_0x255569[_0x22c5('0x45')]=_['keys'](_0x3384e1[_0x22c5('0x45')]);_0x255569['filters']=_[_0x22c5('0x47')](_0x255569['model'],_0x255569['query']);_0x4e01d0[_0x22c5('0x49')]=_[_0x22c5('0x47')](_0x255569['model'],qs['fields'](_0x3384e1[_0x22c5('0x45')][_0x22c5('0x48')]));_0x4e01d0['attributes']=_0x4e01d0[_0x22c5('0x49')][_0x22c5('0x4a')]?_0x4e01d0[_0x22c5('0x49')]:_0x255569[_0x22c5('0x43')];if(!_0x3384e1[_0x22c5('0x45')]['hasOwnProperty'](_0x22c5('0x9f'))){_0x4e01d0[_0x22c5('0x27')]=qs['limit'](_0x3384e1[_0x22c5('0x45')]['limit']);_0x4e01d0[_0x22c5('0x26')]=qs['offset'](_0x3384e1[_0x22c5('0x45')][_0x22c5('0x26')]);}_0x4e01d0['order']=qs[_0x22c5('0xa0')](_0x3384e1[_0x22c5('0x45')][_0x22c5('0xa0')]);_0x4e01d0[_0x22c5('0xa1')]=qs[_0x22c5('0x46')](_[_0x22c5('0xa2')](_0x3384e1[_0x22c5('0x45')],_0x255569[_0x22c5('0x46')]));_0x4e01d0[_0x22c5('0xa1')][_0x22c5('0xa3')]=_0x4a8e6d['id'];if(_0x3384e1[_0x22c5('0x45')]['filter']){_0x4e01d0[_0x22c5('0xa1')]=_['merge'](_0x4e01d0[_0x22c5('0xa1')],{'$or':_[_0x22c5('0x38')](_0x4e01d0[_0x22c5('0x49')],function(_0x2a7133){var _0x3dd324={};_0x3dd324[_0x2a7133]={'$like':'%'+_0x3384e1['query'][_0x22c5('0xa4')]+'%'};return _0x3dd324;})});}if(_0x3384e1[_0x22c5('0x45')][_0x22c5('0xa5')]){var _0x3a2d77=_0x3384e1[_0x22c5('0x45')][_0x22c5('0xa5')][_0x22c5('0xa6')](',');var _0x3af5bb={};_0x3af5bb[_0x3a2d77[0x0]]={'$gte':moment(_0x3a2d77[0x1])[_0x22c5('0x81')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4e01d0[_0x22c5('0xa1')]=_[_0x22c5('0x32')](_0x4e01d0[_0x22c5('0xa1')],_0x3af5bb);}_0x4e01d0=_[_0x22c5('0x32')]({},_0x4e01d0,_0x3384e1[_0x22c5('0x4d')]);return db['ChatMessage'][_0x22c5('0x29')]({'where':_0x4e01d0[_0x22c5('0xa1')]})[_0x22c5('0x2c')](function(_0x57281c){_0x5deb18['count']=_0x57281c;if(_0x3384e1[_0x22c5('0x45')][_0x22c5('0x4b')]){_0x4e01d0[_0x22c5('0x4c')]=[{'all':!![]}];}return db[_0x22c5('0x84')][_0x22c5('0x3e')](_0x4e01d0);})[_0x22c5('0x2c')](function(_0x3663fd){_0x5deb18['rows']=_0x3663fd;return _0x5deb18;});}})[_0x22c5('0x2c')](respondWithFilteredResult(_0x58d80f,_0x4e01d0))[_0x22c5('0x22')](handleError(_0x58d80f,null));};exports[_0x22c5('0xa7')]=function(_0x533083,_0xcbfda6){var _0x5387ee={'where':{}},_0x3456d1={},_0x293cb0={'count':0x0,'rows':[]};return db[_0x22c5('0x39')][_0x22c5('0x51')]({'where':{'id':_0x533083['params']['id']}})['then'](handleEntityNotFound(_0xcbfda6,null))[_0x22c5('0x2c')](function(_0x5a1a6d){if(_0x5a1a6d){_0x3456d1[_0x22c5('0x43')]=_['keys'](db[_0x22c5('0x84')]['rawAttributes']);_0x3456d1[_0x22c5('0x45')]=_[_0x22c5('0x44')](_0x533083[_0x22c5('0x45')]);_0x3456d1[_0x22c5('0x46')]=_[_0x22c5('0x47')](_0x3456d1[_0x22c5('0x43')],_0x3456d1[_0x22c5('0x45')]);_0x5387ee[_0x22c5('0x49')]=_['intersection'](_0x3456d1['model'],qs[_0x22c5('0x48')](_0x533083['query'][_0x22c5('0x48')]));_0x5387ee[_0x22c5('0x49')]=_0x5387ee[_0x22c5('0x49')][_0x22c5('0x4a')]?_0x5387ee[_0x22c5('0x49')]:_0x3456d1[_0x22c5('0x43')];if(!_0x533083['query']['hasOwnProperty'](_0x22c5('0x9f'))){_0x5387ee[_0x22c5('0x27')]=qs[_0x22c5('0x27')](_0x533083[_0x22c5('0x45')][_0x22c5('0x27')]);_0x5387ee[_0x22c5('0x26')]=qs[_0x22c5('0x26')](_0x533083[_0x22c5('0x45')][_0x22c5('0x26')]);}_0x5387ee[_0x22c5('0xa8')]=qs[_0x22c5('0xa0')](_0x533083[_0x22c5('0x45')][_0x22c5('0xa0')]);_0x5387ee[_0x22c5('0xa1')]=qs['filters'](_[_0x22c5('0xa2')](_0x533083[_0x22c5('0x45')],_0x3456d1[_0x22c5('0x46')]));_0x5387ee[_0x22c5('0xa1')][_0x22c5('0xa3')]=_0x5a1a6d['id'];if(_0x533083[_0x22c5('0x45')][_0x22c5('0xa4')]){_0x5387ee[_0x22c5('0xa1')]=_['merge'](_0x5387ee[_0x22c5('0xa1')],{'$or':_[_0x22c5('0x38')](_0x5387ee[_0x22c5('0x49')],function(_0x5e00b8){var _0x33474e={};_0x33474e[_0x5e00b8]={'$like':'%'+_0x533083[_0x22c5('0x45')][_0x22c5('0xa4')]+'%'};return _0x33474e;})});}_0x5387ee[_0x22c5('0xa1')][_0x22c5('0x94')]=![];if(_0x533083[_0x22c5('0x45')]['id']){_0x5387ee['where']['id']={'$gt':_0x533083[_0x22c5('0x45')]['id']};}_0x5387ee=_['merge']({},_0x5387ee,_0x533083[_0x22c5('0x4d')]);return db[_0x22c5('0x84')]['count']({'where':_0x5387ee['where']})[_0x22c5('0x2c')](function(_0x167b41){_0x293cb0[_0x22c5('0x29')]=_0x167b41;_0x5387ee[_0x22c5('0x4c')]=[];if(_0x533083[_0x22c5('0x45')]['includeAgent']){_0x5387ee['include'][_0x22c5('0xa9')]({'model':db['User'],'as':'User','attributes':['id','fullname',_0x22c5('0xaa')]});}if(_0x533083[_0x22c5('0x45')]['includeAll']){_0x5387ee[_0x22c5('0x4c')]=[{'all':!![]}];}return db['ChatMessage'][_0x22c5('0x3e')](_0x5387ee);})[_0x22c5('0x2c')](function(_0x503979){_0x293cb0[_0x22c5('0xab')]=_0x503979;return _0x293cb0;});}})[_0x22c5('0x2c')](respondWithFilteredResult(_0xcbfda6,_0x5387ee))['catch'](handleError(_0xcbfda6,null));};exports[_0x22c5('0xac')]=function(_0x2883f7,_0x1b327d){return db['ChatInteraction'][_0x22c5('0x4e')]({'where':{'id':_0x2883f7[_0x22c5('0x42')]['id']}})[_0x22c5('0x2c')](handleEntityNotFound(_0x1b327d,null))[_0x22c5('0x2c')](function(_0x409a26){if(_0x409a26){return _0x409a26['setTags'](_0x2883f7[_0x22c5('0x33')][_0x22c5('0x9d')],_[_0x22c5('0xad')](_0x2883f7[_0x22c5('0x33')],[_0x22c5('0x9d'),'id'])||{})[_0x22c5('0xae')](function(){return db['Tag'][_0x22c5('0x3e')]({'attributes':['id',_0x22c5('0x2f'),_0x22c5('0xaf')],'where':{'id':_0x2883f7['body']['ids']}});})[_0x22c5('0x2c')](function(_0x58561b){socket[_0x22c5('0xb0')]('chatInteractionTags:save',{'id':Number(_0x2883f7[_0x22c5('0x42')]['id']),'tags':_0x58561b||[]});return{'id':Number(_0x2883f7['params']['id']),'tags':_0x58561b||[]};});}})[_0x22c5('0x2c')](respondWithResult(_0x1b327d,null))[_0x22c5('0x22')](handleError(_0x1b327d,null));};exports[_0x22c5('0xb1')]=function(_0x3470c0,_0x3d1d03){return db[_0x22c5('0x39')]['find']({'where':{'id':_0x3470c0[_0x22c5('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d1d03,null))[_0x22c5('0x2c')](function(_0x202820){if(_0x202820){return _0x202820['removeTags'](_0x3470c0[_0x22c5('0x45')][_0x22c5('0x9d')]);}})[_0x22c5('0x2c')](respondWithStatusCode(_0x3d1d03,null))[_0x22c5('0x22')](handleError(_0x3d1d03,null));};exports[_0x22c5('0x7e')]=function(_0x1be9cb,_0x4e4e5d){var _0x3d9431=moment()[_0x22c5('0xb2')]()[_0x22c5('0xb3')]();var _0x5d9b93=path[_0x22c5('0x7b')](config['root'],_0x22c5('0xb4'),_0x22c5('0xb5'),_0x22c5('0xb6'));var _0x266ec5=path[_0x22c5('0x7b')](config['root'],'server',_0x22c5('0xb5'),_0x22c5('0xb7'));var _0x4b66fb=path[_0x22c5('0x7b')](_0x5d9b93,_0x3d9431);var _0x40a0e8=util['format'](_0x22c5('0xb8'),_0x1be9cb['params']['id'],_0x3d9431);var _0x270097=path[_0x22c5('0x7b')](_0x5d9b93,_0x40a0e8);var _0x261231=[];_0x261231[_0x22c5('0xa9')]({'model':db[_0x22c5('0x85')],'as':_0x22c5('0x85'),'attributes':['id',_0x22c5('0x8f')],'raw':!![]});_0x261231[_0x22c5('0xa9')]({'model':db[_0x22c5('0x6a')],'as':_0x22c5('0x6b'),'attributes':['id',_0x22c5('0xb9'),'lastName'],'raw':!![]});if(_0x1be9cb['query'][_0x22c5('0xb7')]){_0x261231[_0x22c5('0xa9')]({'model':db[_0x22c5('0x78')],'as':_0x22c5('0x78'),'raw':!![]});}var _0x52bf24=[{'model':db[_0x22c5('0x84')],'as':_0x22c5('0x86'),'attributes':['id','body',_0x22c5('0x91'),'direction',_0x22c5('0x94'),_0x22c5('0xba')],'include':_0x261231}];_0x52bf24[_0x22c5('0xa9')]({'model':db[_0x22c5('0x52')],'as':'Account','attributes':['id',_0x22c5('0x2f')]});_0x52bf24[_0x22c5('0xa9')]({'model':db[_0x22c5('0x85')],'as':_0x22c5('0xbb'),'attributes':['id',_0x22c5('0x8f')]});return db['ChatInteraction'][_0x22c5('0x4e')]({'where':{'id':_0x1be9cb['params']['id']},'include':_0x52bf24})[_0x22c5('0x2c')](handleEntityNotFound(_0x4e4e5d,null))[_0x22c5('0x2c')](function(_0x595c1b){if(_0x595c1b){var _0x390923=_0x595c1b[_0x22c5('0xbc')]({'plain':!![]});fs[_0x22c5('0xbd')](_0x4b66fb);var _0x1e8525={'channel':_0x22c5('0xbe'),'account':_0x390923[_0x22c5('0xbf')][_0x22c5('0x2f')],'agent':_0x390923[_0x22c5('0xbb')]?_0x390923[_0x22c5('0xbb')][_0x22c5('0x8f')]:_0x22c5('0xc0'),'createdAt':moment(_0x390923[_0x22c5('0x91')])['format'](_0x22c5('0xc1'))[_0x22c5('0xb3')](),'closedAt':_0x390923[_0x22c5('0x71')]?moment(_0x390923[_0x22c5('0xc2')])['format'](_0x22c5('0xc1'))[_0x22c5('0xb3')]():'','disposition':_0x390923[_0x22c5('0xc3')],'chatInfo':{'browser':_0x390923[_0x22c5('0xc4')],'os':_0x390923['osName'],'referer':_0x390923[_0x22c5('0xc5')],'customerIp':_0x390923[_0x22c5('0xc6')],'customerPort':_0x390923['customerPort']?_0x390923[_0x22c5('0xc7')]:'N.A.'},'messages':_(_0x390923[_0x22c5('0x86')])['tail']()[_0x22c5('0xa4')]({'secret':![]})[_0x22c5('0x38')](function(_0x5d40b3){if(_0x5d40b3[_0x22c5('0x78')]){var _0x146169=path[_0x22c5('0x7b')](_0x266ec5,_0x5d40b3['Attachment'][_0x22c5('0x75')]);if(fs['existsSync'](_0x146169)){fs[_0x22c5('0xc8')](_0x146169)['pipe'](fs[_0x22c5('0xc9')](path['join'](_0x4b66fb,_0x5d40b3[_0x22c5('0x78')][_0x22c5('0x75')])));}}return{'date':moment(_0x5d40b3[_0x22c5('0x91')])[_0x22c5('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x22c5('0xb3')](),'sender':_0x5d40b3[_0x22c5('0x93')]===_0x22c5('0x65')?_0x5d40b3[_0x22c5('0x85')]?_0x5d40b3[_0x22c5('0x85')]['fullname']:_0x22c5('0x88'):_0x5d40b3[_0x22c5('0x6b')][_0x22c5('0xb9')]+(_0x5d40b3[_0x22c5('0x6b')][_0x22c5('0xca')]?'\x20'+_0x5d40b3[_0x22c5('0x6b')]['lastName']:''),'body':_0x5d40b3[_0x22c5('0x78')]?_0x5d40b3[_0x22c5('0x78')]['basename']:_0x5d40b3[_0x22c5('0x33')],'direction':_0x5d40b3[_0x22c5('0x93')]==='out'?'A':'C','secret':_0x5d40b3[_0x22c5('0x94')],'read':_0x5d40b3['read'],'attachment':_0x5d40b3[_0x22c5('0x78')]};})[_0x22c5('0xcb')]()};return ejs[_0x22c5('0xcc')](path['join'](config[_0x22c5('0x7c')],_0x22c5('0xb4'),'views',_0x22c5('0xcd')),{'interaction':_0x1e8525})['then'](function(_0x34303f){var _0x3f681f=path[_0x22c5('0x7b')](_0x4b66fb,_0x22c5('0xce')+_0x390923['id']+'-'+_0x3d9431+'.pdf');var _0x412869={'path':_0x3f681f,'channel':_0x22c5('0xbe'),'interactionId':_0x390923['id']};return pdf[_0x22c5('0xcf')](_0x34303f,_0x412869);})[_0x22c5('0x2c')](function(){return new Promise(function(_0x334f13,_0x4445d0){zipdir(_0x4b66fb,{'saveTo':_0x270097},function(_0x5a27d9,_0x3cea79){if(_0x5a27d9)return _0x4445d0(_0x5a27d9);return _0x334f13(_0x3cea79);});})[_0x22c5('0x2c')](function(){return new BPromise(function(_0x12adeb,_0x3bab89){rimraf(_0x4b66fb,function(_0x2609f7){if(_0x2609f7)_0x3bab89(_0x2609f7);return _0x12adeb();});});})[_0x22c5('0x2c')](function(){return _0x4e4e5d[_0x22c5('0x7e')](_0x270097,_0x40a0e8,function(_0xdeea27){if(_0xdeea27){logger[_0x22c5('0x1f')](_0x22c5('0xd0'),_0xdeea27);}else{fs[_0x22c5('0xd1')](_0x270097);}});});});}else{return _0x4e4e5d[_0x22c5('0x23')](0xc8);}})[_0x22c5('0x22')](handleError(_0x4e4e5d,null));}; \ No newline at end of file +var _0x84dc=['rows','pick','filter','secret','include','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','stack','name','render','merge','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','body','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','ContactId','Messages','agentAlias','customer','%s%d','Visitor','agentIdentifier','System','User','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e04f5,_0xf0a7a5){var _0x1b18ae=function(_0x38b91d){while(--_0x38b91d){_0x3e04f5['push'](_0x3e04f5['shift']());}};_0x1b18ae(++_0xf0a7a5);}(_0x84dc,0x1df));var _0xc84d=function(_0xd95112,_0x587075){_0xd95112=_0xd95112-0x0;var _0x17ac7c=_0x84dc[_0xd95112];return _0x17ac7c;};'use strict';var rimraf=require(_0xc84d('0x0'));var zipdir=require(_0xc84d('0x1'));var rp=require(_0xc84d('0x2'));var moment=require(_0xc84d('0x3'));var BPromise=require(_0xc84d('0x4'));var Mustache=require(_0xc84d('0x5'));var util=require(_0xc84d('0x6'));var path=require('path');var ejs=require(_0xc84d('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xc84d('0x8'));var qs=require(_0xc84d('0x9'));var pdf=require(_0xc84d('0xa'));var logger=require(_0xc84d('0xb'))(_0xc84d('0xc'));var config=require(_0xc84d('0xd'));var db=require(_0xc84d('0xe'))['db'];config[_0xc84d('0xf')]=_[_0xc84d('0x10')](config[_0xc84d('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xc84d('0x11'))(new Redis(config['redis']));require(_0xc84d('0x12'))[_0xc84d('0x13')](socket);var jayson=require(_0xc84d('0x14'));var client=jayson['client'][_0xc84d('0x15')]({'port':0x232b});var client9004=jayson[_0xc84d('0x16')][_0xc84d('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x486625,_0x163625,_0x1939bd,_0x49e1cd){return new BPromise(function(_0x453af0,_0x483fe8){var _0x537d13=_0x49e1cd||client;return _0x537d13['request'](_0x486625,_0x1939bd)[_0xc84d('0x17')](function(_0x11d1e0){logger[_0xc84d('0x18')](_0xc84d('0x19'),_0x163625,_0xc84d('0x1a'));logger['debug'](_0xc84d('0x1b'),_0x163625,_0xc84d('0x1a'),JSON[_0xc84d('0x1c')](_0x11d1e0));if(_0x11d1e0['error']){if(_0x11d1e0[_0xc84d('0x1d')][_0xc84d('0x1e')]===0x1f4){logger[_0xc84d('0x1d')](_0xc84d('0x19'),_0x163625,_0x11d1e0[_0xc84d('0x1d')][_0xc84d('0x1f')]);return _0x483fe8(_0x11d1e0[_0xc84d('0x1d')][_0xc84d('0x1f')]);}logger[_0xc84d('0x1d')](_0xc84d('0x19'),_0x163625,_0x11d1e0[_0xc84d('0x1d')][_0xc84d('0x1f')]);return _0x453af0(_0x11d1e0['error'][_0xc84d('0x1f')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x163625,'request\x20sent');_0x453af0(_0x11d1e0['result'][_0xc84d('0x1f')]);}})[_0xc84d('0x20')](function(_0x8904a2){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x163625,_0x8904a2);_0x483fe8(_0x8904a2);});});}function respondWithStatusCode(_0x4a0636,_0x1858e1){_0x1858e1=_0x1858e1||0xcc;return function(_0x579576){if(_0x579576){return _0x4a0636[_0xc84d('0x21')](_0x1858e1);}return _0x4a0636[_0xc84d('0x22')](_0x1858e1)[_0xc84d('0x23')]();};}function respondWithResult(_0x1c59d7,_0x1e9e56){_0x1e9e56=_0x1e9e56||0xc8;return function(_0x525e71){if(_0x525e71){return _0x1c59d7[_0xc84d('0x22')](_0x1e9e56)[_0xc84d('0x24')](_0x525e71);}};}function respondWithFilteredResult(_0x5936cf,_0x3b3f09){return function(_0x3c862f){if(_0x3c862f){var _0x52e530=typeof _0x3b3f09[_0xc84d('0x25')]===_0xc84d('0x26')&&typeof _0x3b3f09[_0xc84d('0x27')]===_0xc84d('0x26');var _0x4a5fbd=_0x3c862f[_0xc84d('0x28')];var _0x2521e6=_0x52e530?0x0:_0x3b3f09[_0xc84d('0x25')];var _0x291027=_0x52e530?_0x3c862f['count']:_0x3b3f09[_0xc84d('0x25')]+_0x3b3f09['limit'];var _0x46f4b4;if(_0x291027>=_0x4a5fbd){_0x291027=_0x4a5fbd;_0x46f4b4=0xc8;}else{_0x46f4b4=0xce;}_0x5936cf[_0xc84d('0x22')](_0x46f4b4);return _0x5936cf['set'](_0xc84d('0x29'),_0x2521e6+'-'+_0x291027+'/'+_0x4a5fbd)[_0xc84d('0x24')](_0x3c862f);}return null;};}function saveUpdates(_0x50b329){return function(_0x44bf27){if(_0x44bf27){return _0x44bf27[_0xc84d('0x2a')](_0x50b329)['then'](function(_0x2ee1c2){return _0x2ee1c2;});}return null;};}function removeEntity(_0x56579b){return function(_0x16534c){if(_0x16534c){return _0x16534c[_0xc84d('0x2b')]()[_0xc84d('0x17')](function(){_0x56579b[_0xc84d('0x22')](0xcc)[_0xc84d('0x23')]();});}};}function handleEntityNotFound(_0x58d797){return function(_0x50fb78){if(!_0x50fb78){_0x58d797[_0xc84d('0x21')](0x194);}return _0x50fb78;};}function handleError(_0x163f53,_0x208ca3){_0x208ca3=_0x208ca3||0x1f4;return function(_0x209c3a){logger[_0xc84d('0x1d')](_0x209c3a[_0xc84d('0x2c')]);if(_0x209c3a[_0xc84d('0x2d')]){delete _0x209c3a[_0xc84d('0x2d')];}_0x163f53[_0xc84d('0x22')](_0x208ca3)['send'](_0x209c3a);};}function getMustacheRender(_0xb13002,_0x59df4a){return Mustache[_0xc84d('0x2e')](_0xb13002,_[_0xc84d('0x2f')](_0x59df4a['body'],{'contact':_0x59df4a[_0xc84d('0x30')],'message':_0x59df4a[_0xc84d('0x1f')],'agent':_0x59df4a['agent'],'interaction':_0x59df4a[_0xc84d('0x31')],'account':_0x59df4a[_0xc84d('0x32')]}))||'';}exports[_0xc84d('0x33')]=function(_0x479859,_0x1bb691){var _0x4ce05e={};var _0x29acc8=_[_0xc84d('0x34')](db[_0xc84d('0x35')][_0xc84d('0x36')],function(_0x6dc6f){return{'name':_0x6dc6f[_0xc84d('0x37')],'type':_0x6dc6f[_0xc84d('0x38')][_0xc84d('0x39')]};});_0x4ce05e=qs[_0xc84d('0x3a')](_0x29acc8,_0x479859);return interaction[_0xc84d('0x3b')]('chat',_0x479859[_0xc84d('0x3c')],_0x479859[_0xc84d('0x3d')],_0x4ce05e,_0x29acc8)['then'](respondWithFilteredResult(_0x1bb691,_0x4ce05e))[_0xc84d('0x20')](handleError(_0x1bb691,null));};exports[_0xc84d('0x3e')]=function(_0x24a5c8,_0x28086f){var _0x2c3667={'raw':![],'where':{'id':_0x24a5c8[_0xc84d('0x3f')]['id']}},_0x13cc0a={};_0x13cc0a['model']=_[_0xc84d('0x40')](db[_0xc84d('0x35')][_0xc84d('0x36')]);_0x13cc0a[_0xc84d('0x3c')]=_['keys'](_0x24a5c8[_0xc84d('0x3c')]);_0x13cc0a[_0xc84d('0x41')]=_[_0xc84d('0x42')](_0x13cc0a[_0xc84d('0x43')],_0x13cc0a[_0xc84d('0x3c')]);_0x2c3667[_0xc84d('0x44')]=_['intersection'](_0x13cc0a[_0xc84d('0x43')],qs[_0xc84d('0x45')](_0x24a5c8[_0xc84d('0x3c')][_0xc84d('0x45')]));_0x2c3667[_0xc84d('0x44')]=_0x2c3667['attributes'][_0xc84d('0x46')]?_0x2c3667[_0xc84d('0x44')]:_0x13cc0a['model'];if(_0x24a5c8['query'][_0xc84d('0x47')]){_0x2c3667['include']=[{'all':!![]}];}_0x2c3667=_['merge']({},_0x2c3667,_0x24a5c8[_0xc84d('0x48')]);return db[_0xc84d('0x35')][_0xc84d('0x49')](_0x2c3667)[_0xc84d('0x17')](handleEntityNotFound(_0x28086f,null))[_0xc84d('0x17')](respondWithResult(_0x28086f,null))[_0xc84d('0x20')](handleError(_0x28086f,null));};exports[_0xc84d('0x4a')]=function(_0xef5f79,_0x364ec0){return db[_0xc84d('0x35')][_0xc84d('0x4a')](_0xef5f79[_0xc84d('0x4b')],{})[_0xc84d('0x17')](respondWithResult(_0x364ec0,0xc9))[_0xc84d('0x20')](handleError(_0x364ec0,null));};exports[_0xc84d('0x2a')]=function(_0x4a0fc6,_0x3f1a13){if(_0x4a0fc6[_0xc84d('0x4b')]['id']){delete _0x4a0fc6[_0xc84d('0x4b')]['id'];}return db[_0xc84d('0x35')][_0xc84d('0x49')]({'where':{'id':_0x4a0fc6['params']['id']}})[_0xc84d('0x17')](handleEntityNotFound(_0x3f1a13,null))['then'](saveUpdates(_0x4a0fc6[_0xc84d('0x4b')],null))[_0xc84d('0x17')](respondWithResult(_0x3f1a13,null))['catch'](handleError(_0x3f1a13,null));};exports['destroy']=function(_0x5d54dc,_0x30c0eb){return db['ChatInteraction']['find']({'where':{'id':_0x5d54dc[_0xc84d('0x3f')]['id']}})[_0xc84d('0x17')](handleEntityNotFound(_0x30c0eb,null))[_0xc84d('0x17')](removeEntity(_0x30c0eb,null))[_0xc84d('0x20')](handleError(_0x30c0eb,null));};exports['describe']=function(_0x33242c,_0x2c991e){return db[_0xc84d('0x35')][_0xc84d('0x4c')]()['then'](respondWithResult(_0x2c991e,null))['catch'](handleError(_0x2c991e,null));};exports[_0xc84d('0x4d')]=function(_0x10bbcf,_0x441bd8){var _0x44efc4=_0x10bbcf[_0xc84d('0x3f')]['id'];var _0x95dc0b;var _0x57c05f;var _0x5c599d;return db[_0xc84d('0x35')]['findOne']({'where':{'id':_0x44efc4}})['then'](function(_0x323c81){_0x95dc0b=_0x323c81;return db[_0xc84d('0x4e')][_0xc84d('0x4f')]({'where':{'id':_0x323c81[_0xc84d('0x50')]},'attributes':['id',_0xc84d('0x51'),_0xc84d('0x52'),_0xc84d('0x53'),_0xc84d('0x54'),_0xc84d('0x55')],'raw':!![]});})[_0xc84d('0x17')](function(_0x3194eb){if(_0x3194eb&&_0x3194eb[_0xc84d('0x51')]&&_0x3194eb[_0xc84d('0x52')]){_0x57c05f=_0x3194eb;var _0x3840a6={'interaction':{'id':_0x44efc4},'agent':{'id':_0x10bbcf[_0xc84d('0x3d')]['id'],'name':_0x10bbcf[_0xc84d('0x3d')][_0xc84d('0x2d')],'fullname':_0x10bbcf[_0xc84d('0x3d')]['fullname'],'email':_0x10bbcf[_0xc84d('0x3d')][_0xc84d('0x56')]},'contact':_0x10bbcf[_0xc84d('0x4b')][_0xc84d('0x30')],'account':_0x10bbcf[_0xc84d('0x4b')][_0xc84d('0x32')]};var _0x1cbb77={'rejectUnauthorized':![],'method':_0xc84d('0x57'),'url':_0xc84d('0x58'),'headers':{'X-APIKEY':_0x3194eb[_0xc84d('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x10bbcf[_0xc84d('0x3d')][_0xc84d('0x56')]],'buttons':null,'topic':_0x57c05f[_0xc84d('0x53')],'note':_[_0xc84d('0x59')](_0x57c05f['vidaooNote'])?null:getMustacheRender(_0x57c05f[_0xc84d('0x54')],_0x3840a6),'metadata':null},'redirect':_0xc84d('0x5a'),'json':!![]};try{if(!_['isNull'](_0x57c05f[_0xc84d('0x55')])){var _0x40f6b1=getMustacheRender(_0x57c05f[_0xc84d('0x55')],_0x3840a6);var _0x4171ef=JSON['parse'](_0x40f6b1);_0x1cbb77['body'][_0xc84d('0x5b')]=_0x4171ef;}}catch(_0x384af4){throw new db[(_0xc84d('0x5c'))][(_0xc84d('0x5d'))](_0xc84d('0x5e'));}return rp(_0x1cbb77);}else{throw new db['Sequelize'][(_0xc84d('0x5d'))](_0xc84d('0x5f'));}})['then'](function(_0x47f36d){_0x5c599d=_0x47f36d;if(_0x5c599d['id']){var _0x4021d3={'body':_0x5c599d[_0xc84d('0x60')],'ChatWebsiteId':_0x57c05f['id'],'ChatInteractionId':_0x95dc0b['id'],'direction':_0xc84d('0x61'),'UserId':_0x10bbcf[_0xc84d('0x3d')]['id']};return db[_0xc84d('0x62')][_0xc84d('0x4a')](_0x4021d3,{});}else{throw new db[(_0xc84d('0x5c'))][(_0xc84d('0x5d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x95dc0b['updateAttributes']({'vidaooSessionId':_0x5c599d['id']});})[_0xc84d('0x17')](respondWithResult(_0x441bd8,null))[_0xc84d('0x20')](handleError(_0x441bd8,null));};exports[_0xc84d('0x63')]=function(_0x4f64e3,_0x2cfd48){if(_0x4f64e3[_0xc84d('0x4b')]['id']){delete _0x4f64e3[_0xc84d('0x4b')]['id'];}return db[_0xc84d('0x35')][_0xc84d('0x49')]({'where':{'id':_0x4f64e3[_0xc84d('0x3f')]['id']},'include':[{'model':db[_0xc84d('0x64')],'as':_0xc84d('0x65')}]})[_0xc84d('0x17')](handleEntityNotFound(_0x2cfd48,null))[_0xc84d('0x17')](saveUpdates(_0x4f64e3[_0xc84d('0x4b')],null))['then'](respondWithResult(_0x2cfd48,null))[_0xc84d('0x20')](handleError(_0x2cfd48,null));};exports[_0xc84d('0x66')]=function(_0x38b31d,_0x3d8138){if(_0x38b31d['body']['id']){delete _0x38b31d[_0xc84d('0x4b')]['id'];}return db[_0xc84d('0x35')][_0xc84d('0x49')]({'where':{'id':_0x38b31d['params']['id']}})['then'](function(_0x49f6c3){if(!_0x49f6c3){logger[_0xc84d('0x1d')](_0xc84d('0x67'),'abandon',0x194,_0xc84d('0x68'));_0x3d8138[_0xc84d('0x21')](0x194);}else{if(_0x49f6c3[_0xc84d('0x69')]){throw new db['Sequelize'][(_0xc84d('0x5d'))](_0xc84d('0x6a'));}}return _0x49f6c3;})[_0xc84d('0x17')](function(_0x2c15c5){if(_0x2c15c5){return _0x2c15c5['update']({'closed':_0x38b31d[_0xc84d('0x4b')][_0xc84d('0x6b')],'disposition':_0x38b31d[_0xc84d('0x4b')][_0xc84d('0x6c')]})[_0xc84d('0x17')](function(_0x158922){return _0x158922;});}})[_0xc84d('0x17')](function(){return respondWithRpcPromise(_0xc84d('0x6d'),_0xc84d('0x66'),_0x38b31d[_0xc84d('0x4b')],client9004);})['then'](respondWithResult(_0x3d8138,null))['catch'](handleError(_0x3d8138,null));};exports[_0xc84d('0x6e')]=function(_0xe8b8fd,_0x87d245){_0xe8b8fd[_0xc84d('0x4b')][_0xc84d('0x2d')]=_0xe8b8fd[_0xc84d('0x6f')][_0xc84d('0x70')];_0xe8b8fd[_0xc84d('0x4b')][_0xc84d('0x71')]=_0xe8b8fd['file'][_0xc84d('0x72')];_0xe8b8fd[_0xc84d('0x4b')][_0xc84d('0x38')]=_0xe8b8fd['file'][_0xc84d('0x73')];return db[_0xc84d('0x74')][_0xc84d('0x4a')](_0xe8b8fd[_0xc84d('0x4b')])['then'](respondWithResult(_0x87d245,0xc9))['catch'](handleError(_0x87d245,null));};exports[_0xc84d('0x75')]=function(_0x4bd4e4,_0x5b31c3){return db['ChatInteraction']['findOne']({'where':{'id':_0x4bd4e4[_0xc84d('0x3f')]['id']},'raw':!![]})[_0xc84d('0x17')](handleEntityNotFound(_0x5b31c3,null))[_0xc84d('0x17')](function(_0x4ff4ad){if(_0x4ff4ad){if(_0x4ff4ad[_0xc84d('0x6b')]){return _0x5b31c3[_0xc84d('0x22')](0x193)[_0xc84d('0x24')]({'status':0x193,'message':_0xc84d('0x76')});}return db[_0xc84d('0x74')][_0xc84d('0x4f')]({'where':{'id':_0x4bd4e4[_0xc84d('0x3c')][_0xc84d('0x77')]},'raw':!![]})[_0xc84d('0x17')](handleEntityNotFound(_0x5b31c3,null));}})[_0xc84d('0x17')](function(_0x146fc7){if(_0x146fc7){var _0x50dc74=_0x146fc7[_0xc84d('0x78')]!==null;var _0x1f511b=path[_0xc84d('0x79')](config[_0xc84d('0x7a')],_0xc84d('0x7b'));if(_0x50dc74){_0x1f511b=path['join'](_0x1f511b,_0xc84d('0x7c'));}var _0x231e81=path['join'](_0x1f511b,_0x146fc7[_0xc84d('0x71')]);return _0x5b31c3[_0xc84d('0x7d')](_0x231e81);}})[_0xc84d('0x20')](handleError(_0x5b31c3,null));};exports[_0xc84d('0x7e')]=function(_0x40d891,_0x5cf448){var _0x429883=null;var _0x196d1e=null;var _0x323f46=null;if(_0x40d891[_0xc84d('0x4b')]['id']){delete _0x40d891[_0xc84d('0x4b')]['id'];}if(_0x40d891[_0xc84d('0x4b')][_0xc84d('0x7f')]){_0x323f46=path['join'](config[_0xc84d('0x7a')],_0xc84d('0x80'),util[_0xc84d('0x81')]('transcript-%s.txt',Date[_0xc84d('0x82')]()));_0x40d891[_0xc84d('0x4b')]['pathTranscript']=_0x323f46;}return db['ChatInteraction'][_0xc84d('0x49')]({'where':{'id':_0x40d891[_0xc84d('0x3f')]['id']},'include':[{'model':db[_0xc84d('0x62')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x5cf448,null))[_0xc84d('0x17')](saveUpdates(_0x40d891[_0xc84d('0x4b')],null))[_0xc84d('0x17')](function(_0x182cd2){if(_0x182cd2){_0x429883=_0x182cd2;return db[_0xc84d('0x4e')][_0xc84d('0x49')]({'where':{'id':_0x429883[_0xc84d('0x50')]}});}})['then'](function(_0x264756){if(_0x264756){_0x196d1e=_0x264756;return db[_0xc84d('0x64')][_0xc84d('0x49')]({'where':{'id':_0x429883[_0xc84d('0x83')]}});}})['then'](function(_0x1f2203){if(_0x1f2203){if(_0x323f46){var _0x307ad3=null;for(var _0x4ce7be=0x1;_0x4ce7be<_0x429883[_0xc84d('0x84')]['length'];++_0x4ce7be){_0x307ad3=_0x429883[_0xc84d('0x84')][_0x4ce7be];var _0x25eec0=_0x307ad3['UserId']?util['format']('%s%d',_0x196d1e[_0xc84d('0x85')],_0x307ad3[_0xc84d('0x69')]):'System';var _0x1abe8f=_0x40d891[_0xc84d('0x4b')][_0xc84d('0x86')]||util['format'](_0xc84d('0x87'),_0xc84d('0x88'),_0x307ad3[_0xc84d('0x83')]);switch(_0x196d1e[_0xc84d('0x89')]){case'website_alias':_0x25eec0=_0x307ad3[_0xc84d('0x69')]?util[_0xc84d('0x81')](_0xc84d('0x87'),_0x196d1e[_0xc84d('0x85')],_0x307ad3[_0xc84d('0x69')]):_0xc84d('0x8a');break;case'agent_alias':_0x25eec0=_0x307ad3[_0xc84d('0x69')]?_0x307ad3[_0xc84d('0x8b')][_0xc84d('0x8c')]||_0x307ad3[_0xc84d('0x8b')][_0xc84d('0x8d')]:_0xc84d('0x8a');break;case _0xc84d('0x8e'):_0x25eec0=_0x307ad3[_0xc84d('0x69')]?_0x307ad3[_0xc84d('0x8b')]['fullname']:'System';break;default:_0x25eec0=_0x307ad3[_0xc84d('0x69')]?util[_0xc84d('0x81')](_0xc84d('0x87'),_0x196d1e['agentAlias'],_0x307ad3[_0xc84d('0x69')]):_0xc84d('0x8a');}var _0x5dbc4e=util[_0xc84d('0x81')](_0xc84d('0x8f'),moment(_0x307ad3[_0xc84d('0x90')])[_0xc84d('0x81')](_0xc84d('0x91')),_0x307ad3[_0xc84d('0x92')]==='in'?_0x1abe8f:_0x25eec0,_0x307ad3[_0xc84d('0x4b')]);if(!_0x307ad3['secret']){fs[_0xc84d('0x93')](_0x323f46,_0x5dbc4e);}}return db[_0xc84d('0x94')][_0xc84d('0x4f')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc84d('0x95'),'raw':!![],'include':[{'model':db[_0xc84d('0x96')],'as':_0xc84d('0x96'),'raw':!![]}]}]});}}})[_0xc84d('0x17')](function(_0x1754f7){if(!_0x1754f7||!_0x1754f7[_0xc84d('0x95')]||!_0x40d891[_0xc84d('0x4b')])return _0x429883;var _0x558a39=_0x1754f7[_0xc84d('0x97')]();return respondWithRpcPromise(_0xc84d('0x98'),'sendMail',{'account':_0x558a39,'message':{'from':util[_0xc84d('0x81')](_0xc84d('0x99'),_0x1754f7[_0xc84d('0x2d')],_0x1754f7[_0xc84d('0x56')]||_0x1754f7[_0xc84d('0x95')][_0xc84d('0x3d')]),'to':_0x40d891[_0xc84d('0x4b')][_0xc84d('0x7f')],'subject':_0xc84d('0x9a'),'text':util['format'](_0xc84d('0x9b'),_0x40d891['body']['mailTranscript']),'attachments':[{'path':_0x323f46}]}})[_0xc84d('0x17')](function(){return _0x429883;})[_0xc84d('0x20')](function(_0x5845a6){logger[_0xc84d('0x1d')](_0x5845a6);});})[_0xc84d('0x17')](respondWithStatusCode(_0x5cf448,0xc8))[_0xc84d('0x20')](handleError(_0x5cf448,null));};exports[_0xc84d('0x9c')]=function(_0x4c153c,_0x24d409){return db[_0xc84d('0x62')][_0xc84d('0x49')]({'where':{'id':_0x4c153c[_0xc84d('0x3f')]['id']}})[_0xc84d('0x17')](handleEntityNotFound(_0x24d409,null))['then'](function(_0x4409fd){if(_0x4409fd){return _0x4409fd[_0xc84d('0x9c')](_0x4c153c['body']['ids'],_[_0xc84d('0x9d')](_0x4c153c[_0xc84d('0x4b')],[_0xc84d('0x9e'),'id'])||{});}})['then'](respondWithResult(_0x24d409,null))['catch'](handleError(_0x24d409,null));};exports[_0xc84d('0x9f')]=function(_0x256eee,_0x556ce4){var _0x43e5b6={'raw':![],'where':{}};var _0x3a5819={};var _0xe8febd={'count':0x0,'rows':[]};return db[_0xc84d('0x35')][_0xc84d('0x4f')]({'where':{'id':_0x256eee[_0xc84d('0x3f')]['id']}})[_0xc84d('0x17')](handleEntityNotFound(_0x556ce4,null))[_0xc84d('0x17')](function(_0xf04bb9){if(_0xf04bb9){_0x3a5819['model']=_[_0xc84d('0x40')](db['ChatMessage'][_0xc84d('0x36')]);_0x3a5819[_0xc84d('0x3c')]=_['keys'](_0x256eee[_0xc84d('0x3c')]);_0x3a5819[_0xc84d('0x41')]=_[_0xc84d('0x42')](_0x3a5819[_0xc84d('0x43')],_0x3a5819[_0xc84d('0x3c')]);_0x43e5b6[_0xc84d('0x44')]=_[_0xc84d('0x42')](_0x3a5819['model'],qs[_0xc84d('0x45')](_0x256eee[_0xc84d('0x3c')][_0xc84d('0x45')]));_0x43e5b6['attributes']=_0x43e5b6[_0xc84d('0x44')][_0xc84d('0x46')]?_0x43e5b6[_0xc84d('0x44')]:_0x3a5819[_0xc84d('0x43')];if(!_0x256eee[_0xc84d('0x3c')][_0xc84d('0xa0')](_0xc84d('0xa1'))){_0x43e5b6['limit']=qs['limit'](_0x256eee['query'][_0xc84d('0x27')]);_0x43e5b6[_0xc84d('0x25')]=qs[_0xc84d('0x25')](_0x256eee[_0xc84d('0x3c')][_0xc84d('0x25')]);}_0x43e5b6[_0xc84d('0xa2')]=qs[_0xc84d('0xa3')](_0x256eee[_0xc84d('0x3c')]['sort']);_0x43e5b6[_0xc84d('0xa4')]=qs[_0xc84d('0x41')](_['pick'](_0x256eee[_0xc84d('0x3c')],_0x3a5819[_0xc84d('0x41')]));_0x43e5b6['where'][_0xc84d('0xa5')]=_0xf04bb9['id'];if(_0x256eee[_0xc84d('0x3c')]['filter']){_0x43e5b6[_0xc84d('0xa4')]=_[_0xc84d('0x2f')](_0x43e5b6[_0xc84d('0xa4')],{'$or':_[_0xc84d('0x34')](_0x43e5b6['attributes'],function(_0x2cde63){var _0x29f3e5={};_0x29f3e5[_0x2cde63]={'$like':'%'+_0x256eee[_0xc84d('0x3c')]['filter']+'%'};return _0x29f3e5;})});}if(_0x256eee[_0xc84d('0x3c')][_0xc84d('0xa6')]){var _0x1d69e3=_0x256eee[_0xc84d('0x3c')]['$gte'][_0xc84d('0xa7')](',');var _0x355156={};_0x355156[_0x1d69e3[0x0]]={'$gte':moment(_0x1d69e3[0x1])[_0xc84d('0x81')](_0xc84d('0xa8'))};_0x43e5b6[_0xc84d('0xa4')]=_[_0xc84d('0x2f')](_0x43e5b6['where'],_0x355156);}_0x43e5b6=_[_0xc84d('0x2f')]({},_0x43e5b6,_0x256eee[_0xc84d('0x48')]);return db['ChatMessage'][_0xc84d('0x28')]({'where':_0x43e5b6[_0xc84d('0xa4')]})[_0xc84d('0x17')](function(_0x15bb26){_0xe8febd[_0xc84d('0x28')]=_0x15bb26;if(_0x256eee[_0xc84d('0x3c')][_0xc84d('0x47')]){_0x43e5b6['include']=[{'all':!![]}];}return db[_0xc84d('0x62')][_0xc84d('0x3b')](_0x43e5b6);})[_0xc84d('0x17')](function(_0xa5fc66){_0xe8febd[_0xc84d('0xa9')]=_0xa5fc66;return _0xe8febd;});}})['then'](respondWithFilteredResult(_0x556ce4,_0x43e5b6))[_0xc84d('0x20')](handleError(_0x556ce4,null));};exports['getMyMessages']=function(_0x2f6729,_0x184ced){var _0x3134c3={'where':{}},_0x347cb3={},_0x47f227={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc84d('0x4f')]({'where':{'id':_0x2f6729[_0xc84d('0x3f')]['id']}})[_0xc84d('0x17')](handleEntityNotFound(_0x184ced,null))['then'](function(_0x3a0376){if(_0x3a0376){_0x347cb3[_0xc84d('0x43')]=_[_0xc84d('0x40')](db[_0xc84d('0x62')][_0xc84d('0x36')]);_0x347cb3[_0xc84d('0x3c')]=_['keys'](_0x2f6729['query']);_0x347cb3['filters']=_['intersection'](_0x347cb3[_0xc84d('0x43')],_0x347cb3[_0xc84d('0x3c')]);_0x3134c3['attributes']=_[_0xc84d('0x42')](_0x347cb3[_0xc84d('0x43')],qs[_0xc84d('0x45')](_0x2f6729['query'][_0xc84d('0x45')]));_0x3134c3[_0xc84d('0x44')]=_0x3134c3['attributes']['length']?_0x3134c3[_0xc84d('0x44')]:_0x347cb3[_0xc84d('0x43')];if(!_0x2f6729[_0xc84d('0x3c')]['hasOwnProperty']('nolimit')){_0x3134c3[_0xc84d('0x27')]=qs['limit'](_0x2f6729[_0xc84d('0x3c')][_0xc84d('0x27')]);_0x3134c3['offset']=qs[_0xc84d('0x25')](_0x2f6729[_0xc84d('0x3c')]['offset']);}_0x3134c3[_0xc84d('0xa2')]=qs[_0xc84d('0xa3')](_0x2f6729[_0xc84d('0x3c')][_0xc84d('0xa3')]);_0x3134c3[_0xc84d('0xa4')]=qs['filters'](_[_0xc84d('0xaa')](_0x2f6729[_0xc84d('0x3c')],_0x347cb3[_0xc84d('0x41')]));_0x3134c3[_0xc84d('0xa4')][_0xc84d('0xa5')]=_0x3a0376['id'];if(_0x2f6729['query'][_0xc84d('0xab')]){_0x3134c3[_0xc84d('0xa4')]=_['merge'](_0x3134c3[_0xc84d('0xa4')],{'$or':_['map'](_0x3134c3[_0xc84d('0x44')],function(_0x3899a5){var _0x35e0d4={};_0x35e0d4[_0x3899a5]={'$like':'%'+_0x2f6729[_0xc84d('0x3c')][_0xc84d('0xab')]+'%'};return _0x35e0d4;})});}_0x3134c3['where'][_0xc84d('0xac')]=![];if(_0x2f6729[_0xc84d('0x3c')]['id']){_0x3134c3['where']['id']={'$gt':_0x2f6729['query']['id']};}_0x3134c3=_[_0xc84d('0x2f')]({},_0x3134c3,_0x2f6729[_0xc84d('0x48')]);return db['ChatMessage'][_0xc84d('0x28')]({'where':_0x3134c3[_0xc84d('0xa4')]})[_0xc84d('0x17')](function(_0x3e7a22){_0x47f227[_0xc84d('0x28')]=_0x3e7a22;_0x3134c3['include']=[];if(_0x2f6729['query']['includeAgent']){_0x3134c3[_0xc84d('0xad')]['push']({'model':db['User'],'as':_0xc84d('0x8b'),'attributes':['id',_0xc84d('0x8d'),_0xc84d('0x8c')]});}if(_0x2f6729['query']['includeAll']){_0x3134c3[_0xc84d('0xad')]=[{'all':!![]}];}return db[_0xc84d('0x62')][_0xc84d('0x3b')](_0x3134c3);})['then'](function(_0x260b85){_0x47f227[_0xc84d('0xa9')]=_0x260b85;return _0x47f227;});}})['then'](respondWithFilteredResult(_0x184ced,_0x3134c3))[_0xc84d('0x20')](handleError(_0x184ced,null));};exports[_0xc84d('0xae')]=function(_0x38c279,_0x1b6e25){return db[_0xc84d('0x35')][_0xc84d('0x49')]({'where':{'id':_0x38c279[_0xc84d('0x3f')]['id']}})[_0xc84d('0x17')](handleEntityNotFound(_0x1b6e25,null))[_0xc84d('0x17')](function(_0x350807){if(_0x350807){return _0x350807[_0xc84d('0xaf')](_0x38c279[_0xc84d('0x4b')][_0xc84d('0x9e')],_[_0xc84d('0x9d')](_0x38c279[_0xc84d('0x4b')],[_0xc84d('0x9e'),'id'])||{})[_0xc84d('0xb0')](function(){return db[_0xc84d('0xb1')][_0xc84d('0x3b')]({'attributes':['id',_0xc84d('0x2d'),_0xc84d('0xb2')],'where':{'id':_0x38c279[_0xc84d('0x4b')][_0xc84d('0x9e')]}});})[_0xc84d('0x17')](function(_0x40d4d4){socket[_0xc84d('0xb3')](_0xc84d('0xb4'),{'id':Number(_0x38c279[_0xc84d('0x3f')]['id']),'tags':_0x40d4d4||[]});return{'id':Number(_0x38c279[_0xc84d('0x3f')]['id']),'tags':_0x40d4d4||[]};});}})['then'](respondWithResult(_0x1b6e25,null))[_0xc84d('0x20')](handleError(_0x1b6e25,null));};exports['removeTags']=function(_0x2c3f87,_0x6a7066){return db[_0xc84d('0x35')][_0xc84d('0x49')]({'where':{'id':_0x2c3f87[_0xc84d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6a7066,null))[_0xc84d('0x17')](function(_0x1eb0a1){if(_0x1eb0a1){return _0x1eb0a1['removeTags'](_0x2c3f87[_0xc84d('0x3c')][_0xc84d('0x9e')]);}})[_0xc84d('0x17')](respondWithStatusCode(_0x6a7066,null))[_0xc84d('0x20')](handleError(_0x6a7066,null));};exports[_0xc84d('0x7d')]=function(_0x1929f5,_0x5233dd){var _0x5d1028=moment()[_0xc84d('0xb5')]()[_0xc84d('0xb6')]();var _0x43dfd6=path[_0xc84d('0x79')](config['root'],_0xc84d('0xb7'),_0xc84d('0xb8'),_0xc84d('0xb9'));var _0x3eb070=path[_0xc84d('0x79')](config[_0xc84d('0x7a')],_0xc84d('0xb7'),_0xc84d('0xb8'),_0xc84d('0xba'));var _0x219ebc=path[_0xc84d('0x79')](_0x43dfd6,_0x5d1028);var _0x18f272=util[_0xc84d('0x81')](_0xc84d('0xbb'),_0x1929f5[_0xc84d('0x3f')]['id'],_0x5d1028);var _0x4260d1=path[_0xc84d('0x79')](_0x43dfd6,_0x18f272);var _0x1336bd=[];_0x1336bd['push']({'model':db['User'],'as':_0xc84d('0x8b'),'attributes':['id',_0xc84d('0x8d')],'raw':!![]});_0x1336bd[_0xc84d('0xbc')]({'model':db['CmContact'],'as':_0xc84d('0x65'),'attributes':['id',_0xc84d('0xbd'),_0xc84d('0xbe')],'raw':!![]});if(_0x1929f5[_0xc84d('0x3c')][_0xc84d('0xba')]){_0x1336bd[_0xc84d('0xbc')]({'model':db[_0xc84d('0x74')],'as':_0xc84d('0x74'),'raw':!![]});}var _0x54343e=[{'model':db['ChatMessage'],'as':_0xc84d('0x84'),'attributes':['id',_0xc84d('0x4b'),_0xc84d('0x90'),'direction','secret',_0xc84d('0xbf')],'include':_0x1336bd}];_0x54343e[_0xc84d('0xbc')]({'model':db[_0xc84d('0x4e')],'as':_0xc84d('0xc0'),'attributes':['id',_0xc84d('0x2d')]});_0x54343e[_0xc84d('0xbc')]({'model':db[_0xc84d('0x8b')],'as':_0xc84d('0xc1'),'attributes':['id',_0xc84d('0x8d')]});return db['ChatInteraction'][_0xc84d('0x49')]({'where':{'id':_0x1929f5[_0xc84d('0x3f')]['id']},'include':_0x54343e})['then'](handleEntityNotFound(_0x5233dd,null))[_0xc84d('0x17')](function(_0x198c6e){if(_0x198c6e){var _0x30aead=_0x198c6e[_0xc84d('0xc2')]({'plain':!![]});fs[_0xc84d('0xc3')](_0x219ebc);var _0x10ed46={'channel':_0xc84d('0xc4'),'account':_0x30aead['Account'][_0xc84d('0x2d')],'agent':_0x30aead['Owner']?_0x30aead['Owner']['fullname']:_0xc84d('0xc5'),'createdAt':moment(_0x30aead[_0xc84d('0x90')])[_0xc84d('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc84d('0xb6')](),'closedAt':_0x30aead[_0xc84d('0x6b')]?moment(_0x30aead[_0xc84d('0xc6')])[_0xc84d('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc84d('0xb6')]():'','disposition':_0x30aead[_0xc84d('0x6c')],'chatInfo':{'browser':_0x30aead[_0xc84d('0xc7')],'os':_0x30aead['osName'],'referer':_0x30aead[_0xc84d('0xc8')],'customerIp':_0x30aead[_0xc84d('0xc9')],'customerPort':_0x30aead['customerPort']?_0x30aead[_0xc84d('0xca')]:_0xc84d('0xc5')},'messages':_(_0x30aead[_0xc84d('0x84')])[_0xc84d('0xcb')]()[_0xc84d('0xab')]({'secret':![]})[_0xc84d('0x34')](function(_0x4e8723){if(_0x4e8723[_0xc84d('0x74')]){var _0x1e12a5=path[_0xc84d('0x79')](_0x3eb070,_0x4e8723[_0xc84d('0x74')][_0xc84d('0x71')]);if(fs[_0xc84d('0xcc')](_0x1e12a5)){fs['createReadStream'](_0x1e12a5)[_0xc84d('0xcd')](fs[_0xc84d('0xce')](path['join'](_0x219ebc,_0x4e8723[_0xc84d('0x74')]['basename'])));}}return{'date':moment(_0x4e8723[_0xc84d('0x90')])[_0xc84d('0x81')](_0xc84d('0xa8'))[_0xc84d('0xb6')](),'sender':_0x4e8723[_0xc84d('0x92')]==='out'?_0x4e8723[_0xc84d('0x8b')]?_0x4e8723[_0xc84d('0x8b')][_0xc84d('0x8d')]:_0xc84d('0x8a'):_0x4e8723[_0xc84d('0x65')][_0xc84d('0xbd')]+(_0x4e8723['Contact'][_0xc84d('0xbe')]?'\x20'+_0x4e8723[_0xc84d('0x65')][_0xc84d('0xbe')]:''),'body':_0x4e8723[_0xc84d('0x74')]?_0x4e8723[_0xc84d('0x74')]['basename']:_0x4e8723[_0xc84d('0x4b')],'direction':_0x4e8723[_0xc84d('0x92')]===_0xc84d('0x61')?'A':'C','secret':_0x4e8723[_0xc84d('0xac')],'read':_0x4e8723[_0xc84d('0xbf')],'attachment':_0x4e8723[_0xc84d('0x74')]};})[_0xc84d('0xcf')]()};return ejs[_0xc84d('0xd0')](path[_0xc84d('0x79')](config[_0xc84d('0x7a')],_0xc84d('0xb7'),_0xc84d('0xd1'),_0xc84d('0xd2')),{'interaction':_0x10ed46})[_0xc84d('0x17')](function(_0x3e9a7f){var _0x32161d=path[_0xc84d('0x79')](_0x219ebc,_0xc84d('0xd3')+_0x30aead['id']+'-'+_0x5d1028+_0xc84d('0xd4'));var _0x2527be={'path':_0x32161d,'channel':'Chat','interactionId':_0x30aead['id']};return pdf[_0xc84d('0xd5')](_0x3e9a7f,_0x2527be);})[_0xc84d('0x17')](function(){return new Promise(function(_0x28580f,_0x56e800){zipdir(_0x219ebc,{'saveTo':_0x4260d1},function(_0x3f034b,_0x920128){if(_0x3f034b)return _0x56e800(_0x3f034b);return _0x28580f(_0x920128);});})[_0xc84d('0x17')](function(){return new BPromise(function(_0xb9556c,_0x2a4aa7){rimraf(_0x219ebc,function(_0x3059ab){if(_0x3059ab)_0x2a4aa7(_0x3059ab);return _0xb9556c();});});})[_0xc84d('0x17')](function(){return _0x5233dd['download'](_0x4260d1,_0x18f272,function(_0x57ac48){if(_0x57ac48){logger['error'](_0xc84d('0xd6'),_0x57ac48);}else{fs[_0xc84d('0xd7')](_0x4260d1);}});});});}else{return _0x5233dd[_0xc84d('0x21')](0xc8);}})[_0xc84d('0x20')](handleError(_0x5233dd,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3df7136..a7b541c 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 _0x9a66=['exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','findAll','setDataValue','length','catch','hook'];(function(_0x487281,_0x39d5d2){var _0x258005=function(_0x4b15ce){while(--_0x4b15ce){_0x487281['push'](_0x487281['shift']());}};_0x258005(++_0x39d5d2);}(_0x9a66,0x181));var _0x69a6=function(_0x161f75,_0x1e4b5a){_0x161f75=_0x161f75-0x0;var _0x1fcee6=_0x9a66[_0x161f75];return _0x1fcee6;};'use strict';var EventEmitter=require(_0x69a6('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x69a6('0x1')];var ChatMessage=require(_0x69a6('0x2'))['db'][_0x69a6('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x69a6('0x4')](0x0);var events={'afterCreate':_0x69a6('0x5'),'afterUpdate':_0x69a6('0x6'),'afterDestroy':_0x69a6('0x7')};function emitEvent(_0x5c8ef9){return function(_0x436626,_0x3d8dbc,_0x5d4924){_0x436626[_0x69a6('0x8')]({'attributes':['id'],'raw':!![]})[_0x69a6('0x9')](function(_0x2d6593){_0x436626['setDataValue']('Users',_0x2d6593['map'](function(_0x455bc9){return{'id':_0x455bc9['id']};}));return ChatMessage[_0x69a6('0xa')]({'where':{'ChatInteractionId':_0x436626['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x199d25){_0x436626[_0x69a6('0xb')]('unreadMessages',_0x199d25[_0x69a6('0xc')]);ChatInteractionEvents['emit'](_0x5c8ef9+':'+_0x436626['id'],_0x436626);ChatInteractionEvents['emit'](_0x5c8ef9,_0x436626);_0x5d4924(null);})[_0x69a6('0xd')](_0x5d4924(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x69a6('0xe')](e,emitEvent(event));}}module[_0x69a6('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xdce9=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','Users','map','then','unreadMessages','length','emit'];(function(_0x1bbb18,_0x39c469){var _0x2eba98=function(_0x4a5132){while(--_0x4a5132){_0x1bbb18['push'](_0x1bbb18['shift']());}};_0x2eba98(++_0x39c469);}(_0xdce9,0x190));var _0x9dce=function(_0x33ecee,_0x42f257){_0x33ecee=_0x33ecee-0x0;var _0x3c209b=_0xdce9[_0x33ecee];return _0x3c209b;};'use strict';var EventEmitter=require(_0x9dce('0x0'));var ChatInteraction=require(_0x9dce('0x1'))['db'][_0x9dce('0x2')];var ChatMessage=require(_0x9dce('0x1'))['db'][_0x9dce('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9dce('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9dce('0x5'),'afterDestroy':_0x9dce('0x6')};function emitEvent(_0x11f810){return function(_0x27eb24,_0x3d6d66,_0x55396a){_0x27eb24[_0x9dce('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3c5357){_0x27eb24['setDataValue'](_0x9dce('0x8'),_0x3c5357[_0x9dce('0x9')](function(_0x2aecb7){return{'id':_0x2aecb7['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x27eb24['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9dce('0xa')](function(_0x5b9b10){_0x27eb24['setDataValue'](_0x9dce('0xb'),_0x5b9b10[_0x9dce('0xc')]);ChatInteractionEvents[_0x9dce('0xd')](_0x11f810+':'+_0x27eb24['id'],_0x27eb24);ChatInteractionEvents['emit'](_0x11f810,_0x27eb24);_0x55396a(null);})[_0x9dce('0xe')](_0x55396a(null));};}for(var e in events){if(events[_0x9dce('0xf')](e)){var event=events[e];ChatInteraction[_0x9dce('0x10')](e,emitEvent(event));}}module[_0x9dce('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 f32b967..d677e38 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 _0xf743=['./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5ea253,_0x287212){var _0x549ff8=function(_0x54c6ca){while(--_0x54c6ca){_0x5ea253['push'](_0x5ea253['shift']());}};_0x549ff8(++_0x287212);}(_0xf743,0x81));var _0x3f74=function(_0x10a5e4,_0x51aaea){_0x10a5e4=_0x10a5e4-0x0;var _0x4aa0a3=_0xf743[_0x10a5e4];return _0x4aa0a3;};'use strict';var _=require(_0x3f74('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3f74('0x1'));var BPromise=require('bluebird');var rp=require(_0x3f74('0x2'));var fs=require('fs');var path=require(_0x3f74('0x3'));var rimraf=require(_0x3f74('0x4'));var config=require(_0x3f74('0x5'));var attributes=require(_0x3f74('0x6'));module['exports']=function(_0x13696e,_0x2eaf36){return _0x13696e[_0x3f74('0x7')](_0x3f74('0x8'),attributes,{'tableName':_0x3f74('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b4e69,_0xe103de,_0x25d84c){if(_0x5b4e69['changed'](_0x3f74('0xa'))){_0x5b4e69[_0x3f74('0xb')]=moment()[_0x3f74('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x25d84c(null,_0x5b4e69);}},'charset':_0x3f74('0xd'),'collate':_0x3f74('0xe')});}; \ No newline at end of file +var _0x6883=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash'];(function(_0x192add,_0x4490e4){var _0x1b9d9d=function(_0x55084d){while(--_0x55084d){_0x192add['push'](_0x192add['shift']());}};_0x1b9d9d(++_0x4490e4);}(_0x6883,0x6b));var _0x3688=function(_0x5ed63d,_0x4b7ea1){_0x5ed63d=_0x5ed63d-0x0;var _0x43192a=_0x6883[_0x5ed63d];return _0x43192a;};'use strict';var _=require(_0x3688('0x0'));var util=require(_0x3688('0x1'));var logger=require(_0x3688('0x2'))(_0x3688('0x3'));var moment=require(_0x3688('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3688('0x5'));var rimraf=require(_0x3688('0x6'));var config=require(_0x3688('0x7'));var attributes=require(_0x3688('0x8'));module[_0x3688('0x9')]=function(_0x5b7867,_0x4175c9){return _0x5b7867[_0x3688('0xa')]('ChatInteraction',attributes,{'tableName':_0x3688('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c02b0,_0x38738c,_0x4ecd05){if(_0x5c02b0[_0x3688('0xc')](_0x3688('0xd'))){_0x5c02b0[_0x3688('0xe')]=moment()[_0x3688('0xf')](_0x3688('0x10'));}_0x4ecd05(null,_0x5c02b0);}},'charset':_0x3688('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 09aff85..14a3ac8 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 _0xfe22=['debug','stringify','error','code','message','info','result','UpdateChatInteraction','ChatInteraction','update','options','raw','attributes','limit','then','catch','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','ChatInteraction,\x20%s,\x20%s'];(function(_0x3c0727,_0x1dc37c){var _0x2cc877=function(_0x1794c3){while(--_0x1794c3){_0x3c0727['push'](_0x3c0727['shift']());}};_0x2cc877(++_0x1dc37c);}(_0xfe22,0xb7));var _0x2fe2=function(_0xbd16e2,_0x55944){_0xbd16e2=_0xbd16e2-0x0;var _0x2c4e30=_0xfe22[_0xbd16e2];return _0x2c4e30;};'use strict';var _=require(_0x2fe2('0x0'));var util=require(_0x2fe2('0x1'));var moment=require(_0x2fe2('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fe2('0x3'));var fs=require('fs');var Redis=require(_0x2fe2('0x4'));var db=require(_0x2fe2('0x5'))['db'];var utils=require(_0x2fe2('0x6'));var logger=require('../../config/logger')(_0x2fe2('0x7'));var config=require(_0x2fe2('0x8'));var jayson=require(_0x2fe2('0x9'));var client=jayson[_0x2fe2('0xa')][_0x2fe2('0xb')]({'port':0x232a});config[_0x2fe2('0xc')]=_[_0x2fe2('0xd')](config['redis'],{'host':_0x2fe2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2fe2('0xc')]));require(_0x2fe2('0xf'))['register'](socket);function respondWithRpcPromise(_0x49d44e,_0x35a564,_0x1d91b0){return new BPromise(function(_0x707dd6,_0x161a17){return client['request'](_0x49d44e,_0x1d91b0)['then'](function(_0x190f15){logger['info'](_0x2fe2('0x10'),_0x35a564,'request\x20sent');logger[_0x2fe2('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x35a564,'request\x20sent',JSON[_0x2fe2('0x12')](_0x190f15));if(_0x190f15[_0x2fe2('0x13')]){if(_0x190f15['error'][_0x2fe2('0x14')]===0x1f4){logger[_0x2fe2('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x35a564,_0x190f15[_0x2fe2('0x13')]['message']);return _0x161a17(_0x190f15['error'][_0x2fe2('0x15')]);}logger[_0x2fe2('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x35a564,_0x190f15['error']['message']);return _0x707dd6(_0x190f15[_0x2fe2('0x13')][_0x2fe2('0x15')]);}else{logger[_0x2fe2('0x16')](_0x2fe2('0x10'),_0x35a564,'request\x20sent');_0x707dd6(_0x190f15[_0x2fe2('0x17')][_0x2fe2('0x15')]);}})['catch'](function(_0x5f0451){logger[_0x2fe2('0x13')](_0x2fe2('0x10'),_0x35a564,_0x5f0451);_0x161a17(_0x5f0451);});});}exports[_0x2fe2('0x18')]=function(_0x145492){var _0x2d7d4a=this;return new Promise(function(_0x3a2140,_0x26d29d){return db[_0x2fe2('0x19')][_0x2fe2('0x1a')](_0x145492['body'],{'raw':_0x145492[_0x2fe2('0x1b')]?_0x145492[_0x2fe2('0x1b')][_0x2fe2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145492['options']?_0x145492['options']['where']||null:null,'attributes':_0x145492[_0x2fe2('0x1b')]?_0x145492[_0x2fe2('0x1b')][_0x2fe2('0x1d')]||null:null,'limit':_0x145492[_0x2fe2('0x1b')]?_0x145492['options'][_0x2fe2('0x1e')]||null:null})[_0x2fe2('0x1f')](function(_0x2bdeab){logger['info'](_0x2fe2('0x18'),_0x145492);logger[_0x2fe2('0x11')](_0x2fe2('0x18'),_0x145492,JSON[_0x2fe2('0x12')](_0x2bdeab));_0x3a2140(_0x2bdeab);})[_0x2fe2('0x20')](function(_0x132838){logger[_0x2fe2('0x13')](_0x2fe2('0x18'),_0x132838[_0x2fe2('0x15')],_0x145492);_0x26d29d(_0x2d7d4a[_0x2fe2('0x13')](0x1f4,_0x132838[_0x2fe2('0x15')]));});});};exports[_0x2fe2('0x21')]=function(_0x237e7b){return new Promise(function(_0x261813,_0x27b195){return db[_0x2fe2('0x19')][_0x2fe2('0x22')]({'where':_0x237e7b['options']?_0x237e7b[_0x2fe2('0x1b')]['where']||null:null})['then'](function(_0x513961){if(_0x513961){return _0x513961['addTags'](_0x237e7b[_0x2fe2('0x23')][_0x2fe2('0x24')],_[_0x2fe2('0x25')](_0x237e7b[_0x2fe2('0x23')],['ids','id'])||{});}})[_0x2fe2('0x26')](function(_0x57eef0){logger[_0x2fe2('0x16')]('AddTags',_0x237e7b);logger[_0x2fe2('0x11')](_0x2fe2('0x27'),_0x237e7b,JSON[_0x2fe2('0x12')](_0x57eef0));_0x261813(_0x57eef0);})[_0x2fe2('0x20')](function(_0x502b45){logger['error']('AddTags',_0x502b45[_0x2fe2('0x15')],_0x237e7b);_0x27b195(_this[_0x2fe2('0x13')](0x1f4,_0x502b45[_0x2fe2('0x15')]));});});}; \ No newline at end of file +var _0x56d9=['socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','AddTagsToChatInteraction','find','omit','ids','spread','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x38a72d,_0x32d8dc){var _0x3d08d3=function(_0x4ff44b){while(--_0x4ff44b){_0x38a72d['push'](_0x38a72d['shift']());}};_0x3d08d3(++_0x32d8dc);}(_0x56d9,0x119));var _0x956d=function(_0x1acc03,_0x1794d6){_0x1acc03=_0x1acc03-0x0;var _0x51bc63=_0x56d9[_0x1acc03];return _0x51bc63;};'use strict';var _=require(_0x956d('0x0'));var util=require('util');var moment=require(_0x956d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x956d('0x2'));var db=require(_0x956d('0x3'))['db'];var utils=require(_0x956d('0x4'));var logger=require(_0x956d('0x5'))(_0x956d('0x6'));var config=require(_0x956d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x956d('0x8')][_0x956d('0x9')]({'port':0x232a});config[_0x956d('0xa')]=_[_0x956d('0xb')](config[_0x956d('0xa')],{'host':_0x956d('0xc'),'port':0x18eb});var socket=require(_0x956d('0xd'))(new Redis(config[_0x956d('0xa')]));require(_0x956d('0xe'))[_0x956d('0xf')](socket);function respondWithRpcPromise(_0x31e989,_0x3070ab,_0x55cb0d){return new BPromise(function(_0xa3daef,_0x1db6ad){return client[_0x956d('0x10')](_0x31e989,_0x55cb0d)[_0x956d('0x11')](function(_0x282e15){logger[_0x956d('0x12')](_0x956d('0x13'),_0x3070ab,_0x956d('0x14'));logger[_0x956d('0x15')](_0x956d('0x16'),_0x3070ab,_0x956d('0x14'),JSON[_0x956d('0x17')](_0x282e15));if(_0x282e15[_0x956d('0x18')]){if(_0x282e15[_0x956d('0x18')][_0x956d('0x19')]===0x1f4){logger[_0x956d('0x18')](_0x956d('0x13'),_0x3070ab,_0x282e15[_0x956d('0x18')][_0x956d('0x1a')]);return _0x1db6ad(_0x282e15[_0x956d('0x18')][_0x956d('0x1a')]);}logger[_0x956d('0x18')](_0x956d('0x13'),_0x3070ab,_0x282e15[_0x956d('0x18')][_0x956d('0x1a')]);return _0xa3daef(_0x282e15[_0x956d('0x18')][_0x956d('0x1a')]);}else{logger[_0x956d('0x12')](_0x956d('0x13'),_0x3070ab,_0x956d('0x14'));_0xa3daef(_0x282e15[_0x956d('0x1b')][_0x956d('0x1a')]);}})[_0x956d('0x1c')](function(_0x2d0261){logger[_0x956d('0x18')](_0x956d('0x13'),_0x3070ab,_0x2d0261);_0x1db6ad(_0x2d0261);});});}exports[_0x956d('0x1d')]=function(_0x142de2){var _0x3c2ac8=this;return new Promise(function(_0x22ecde,_0x52990a){return db[_0x956d('0x1e')][_0x956d('0x1f')](_0x142de2[_0x956d('0x20')],{'raw':_0x142de2[_0x956d('0x21')]?_0x142de2[_0x956d('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142de2[_0x956d('0x21')]?_0x142de2[_0x956d('0x21')][_0x956d('0x22')]||null:null,'attributes':_0x142de2[_0x956d('0x21')]?_0x142de2[_0x956d('0x21')][_0x956d('0x23')]||null:null,'limit':_0x142de2[_0x956d('0x21')]?_0x142de2[_0x956d('0x21')]['limit']||null:null})[_0x956d('0x11')](function(_0x41c117){logger['info'](_0x956d('0x1d'),_0x142de2);logger[_0x956d('0x15')]('UpdateChatInteraction',_0x142de2,JSON[_0x956d('0x17')](_0x41c117));_0x22ecde(_0x41c117);})[_0x956d('0x1c')](function(_0x4996e4){logger[_0x956d('0x18')](_0x956d('0x1d'),_0x4996e4[_0x956d('0x1a')],_0x142de2);_0x52990a(_0x3c2ac8[_0x956d('0x18')](0x1f4,_0x4996e4['message']));});});};exports[_0x956d('0x24')]=function(_0x255e26){return new Promise(function(_0x58427f,_0x28cf2e){return db['ChatInteraction'][_0x956d('0x25')]({'where':_0x255e26[_0x956d('0x21')]?_0x255e26[_0x956d('0x21')][_0x956d('0x22')]||null:null})[_0x956d('0x11')](function(_0x24c55a){if(_0x24c55a){return _0x24c55a['addTags'](_0x255e26[_0x956d('0x20')]['ids'],_[_0x956d('0x26')](_0x255e26[_0x956d('0x20')],[_0x956d('0x27'),'id'])||{});}})[_0x956d('0x28')](function(_0x52bdb9){logger[_0x956d('0x12')](_0x956d('0x29'),_0x255e26);logger[_0x956d('0x15')](_0x956d('0x29'),_0x255e26,JSON[_0x956d('0x17')](_0x52bdb9));_0x58427f(_0x52bdb9);})[_0x956d('0x1c')](function(_0x2c6a80){logger['error'](_0x956d('0x29'),_0x2c6a80[_0x956d('0x1a')],_0x255e26);_0x28cf2e(_this['error'](0x1f4,_0x2c6a80['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d7b973e..717afaf 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 _0x5750=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','removeListener'];(function(_0x5e568c,_0x4e46bc){var _0x495441=function(_0x450d44){while(--_0x450d44){_0x5e568c['push'](_0x5e568c['shift']());}};_0x495441(++_0x4e46bc);}(_0x5750,0x1bb));var _0x0575=function(_0x18d8e9,_0x2d9568){_0x18d8e9=_0x18d8e9-0x0;var _0x1b9102=_0x5750[_0x18d8e9];return _0x1b9102;};'use strict';var ChatInteractionEvents=require(_0x0575('0x0'));var events=[_0x0575('0x1'),_0x0575('0x2'),_0x0575('0x3')];function createListener(_0x3d806a,_0x3d9487){return function(_0x13b988){_0x3d9487['emit'](_0x3d806a,_0x13b988);};}function removeListener(_0x3f4ad5,_0x310cfe){return function(){ChatInteractionEvents[_0x0575('0x4')](_0x3f4ad5,_0x310cfe);};}exports[_0x0575('0x5')]=function(_0x4fe813){for(var _0x42409f=0x0,_0x2b507f=events[_0x0575('0x6')];_0x42409f<_0x2b507f;_0x42409f++){var _0x4d0b03=events[_0x42409f];var _0x4176b8=createListener(_0x0575('0x7')+_0x4d0b03,_0x4fe813);ChatInteractionEvents['on'](_0x4d0b03,_0x4176b8);}}; \ No newline at end of file +var _0xa87e=['emit','removeListener','register','./chatInteraction.events','remove','update'];(function(_0xf8a2c4,_0x522b87){var _0x298fb8=function(_0x1739be){while(--_0x1739be){_0xf8a2c4['push'](_0xf8a2c4['shift']());}};_0x298fb8(++_0x522b87);}(_0xa87e,0x1bf));var _0xea87=function(_0x14c0bb,_0x5b60a7){_0x14c0bb=_0x14c0bb-0x0;var _0xf46edd=_0xa87e[_0x14c0bb];return _0xf46edd;};'use strict';var ChatInteractionEvents=require(_0xea87('0x0'));var events=['save',_0xea87('0x1'),_0xea87('0x2')];function createListener(_0x36796d,_0xf56f92){return function(_0x13dd9f){_0xf56f92[_0xea87('0x3')](_0x36796d,_0x13dd9f);};}function removeListener(_0x19bb95,_0x5484c6){return function(){ChatInteractionEvents[_0xea87('0x4')](_0x19bb95,_0x5484c6);};}exports[_0xea87('0x5')]=function(_0x2a8f8f){for(var _0x264a3d=0x0,_0x246150=events['length'];_0x264a3d<_0x246150;_0x264a3d++){var _0x2b2452=events[_0x264a3d];var _0x5cc5fe=createListener('chatInteraction:'+_0x2b2452,_0x2a8f8f);ChatInteractionEvents['on'](_0x2b2452,_0x5cc5fe);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d4c1e61..5fee591 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 _0x0e48=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInteraction.controller','get','index','/describe','isAuthenticated','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','put','delete','chatinteraction:destroy','destroy','removeTags','multer','util','path'];(function(_0x594880,_0x17df86){var _0x31bab3=function(_0x517224){while(--_0x517224){_0x594880['push'](_0x594880['shift']());}};_0x31bab3(++_0x17df86);}(_0x0e48,0x93));var _0x80e4=function(_0x1f8e4c,_0x5aef1a){_0x1f8e4c=_0x1f8e4c-0x0;var _0x5d2be1=_0x0e48[_0x1f8e4c];return _0x5d2be1;};'use strict';var multer=require(_0x80e4('0x0'));var util=require(_0x80e4('0x1'));var path=require(_0x80e4('0x2'));var timeout=require(_0x80e4('0x3'));var express=require(_0x80e4('0x4'));var router=express[_0x80e4('0x5')]();var fs_extra=require(_0x80e4('0x6'));var auth=require(_0x80e4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x80e4('0x8'));router[_0x80e4('0x9')]('/',auth['isAuthenticated'](),controller[_0x80e4('0xa')]);router['get'](_0x80e4('0xb'),auth[_0x80e4('0xc')](),controller['describe']);router[_0x80e4('0x9')](_0x80e4('0xd'),auth[_0x80e4('0xe')](),controller[_0x80e4('0xf')]);router[_0x80e4('0x9')](_0x80e4('0x10'),auth[_0x80e4('0xe')](),controller['attachmentDownload']);router[_0x80e4('0x9')](_0x80e4('0x11'),auth['isAuthenticated'](),controller[_0x80e4('0x12')]);router[_0x80e4('0x9')](_0x80e4('0x13'),auth[_0x80e4('0xe')](),controller[_0x80e4('0x14')]);router[_0x80e4('0x9')](_0x80e4('0x15'),auth[_0x80e4('0xc')](),controller['download']);router[_0x80e4('0x16')]('/',auth[_0x80e4('0xc')](),controller[_0x80e4('0x17')]);router['post'](_0x80e4('0x18'),auth[_0x80e4('0xc')](),controller[_0x80e4('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x123208,_0x2aa1ea,_0x1deb49){_0x1deb49(null,path['join'](config['root'],_0x80e4('0x1a')));},'filename':function(_0x4efa89,_0x6fd2d,_0x309eca){_0x309eca(null,util[_0x80e4('0x1b')](_0x80e4('0x1c'),Date[_0x80e4('0x1d')](),_0x6fd2d[_0x80e4('0x1e')][_0x80e4('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x80e4('0x16')](_0x80e4('0x20'),upload['single'](_0x80e4('0x21')),controller['attachmentUpload']);router[_0x80e4('0x16')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x80e4('0x16')](_0x80e4('0x22'),auth[_0x80e4('0xc')](),interaction[_0x80e4('0x23')](_0x80e4('0x24'),_0x80e4('0x25')),controller[_0x80e4('0x26')]);router['put'](_0x80e4('0xd'),auth[_0x80e4('0xc')](),interaction['tracked']('chat',_0x80e4('0x27')),controller[_0x80e4('0x28')]);router['put'](_0x80e4('0x29'),controller[_0x80e4('0x2a')]);router['put'](_0x80e4('0x2b'),auth[_0x80e4('0xe')](),controller[_0x80e4('0x2c')]);router[_0x80e4('0x2d')]('/:id/close',controller['close']);router[_0x80e4('0x2e')](_0x80e4('0xd'),auth[_0x80e4('0xc')](),interaction[_0x80e4('0x23')](_0x80e4('0x24'),_0x80e4('0x2f')),controller[_0x80e4('0x30')]);router[_0x80e4('0x2e')]('/:id/tags',auth[_0x80e4('0xc')](),controller[_0x80e4('0x31')]);module['exports']=router; \ No newline at end of file +var _0xab77=['addTags','put','/:id','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags'];(function(_0x5a2de6,_0x160e3c){var _0x95affb=function(_0x5e33fa){while(--_0x5e33fa){_0x5a2de6['push'](_0x5a2de6['shift']());}};_0x95affb(++_0x160e3c);}(_0xab77,0x18f));var _0x7ab7=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0xab77[_0x115621];return _0x5ef5ce;};'use strict';var multer=require(_0x7ab7('0x0'));var util=require(_0x7ab7('0x1'));var path=require('path');var timeout=require(_0x7ab7('0x2'));var express=require(_0x7ab7('0x3'));var router=express[_0x7ab7('0x4')]();var fs_extra=require(_0x7ab7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7ab7('0x6'));var config=require(_0x7ab7('0x7'));var controller=require(_0x7ab7('0x8'));router[_0x7ab7('0x9')]('/',auth[_0x7ab7('0xa')](),controller['index']);router[_0x7ab7('0x9')](_0x7ab7('0xb'),auth['isAuthenticated'](),controller[_0x7ab7('0xc')]);router['get']('/:id',auth[_0x7ab7('0xd')](),controller[_0x7ab7('0xe')]);router[_0x7ab7('0x9')](_0x7ab7('0xf'),auth[_0x7ab7('0xd')](),controller['attachmentDownload']);router[_0x7ab7('0x9')](_0x7ab7('0x10'),auth[_0x7ab7('0xa')](),controller[_0x7ab7('0x11')]);router[_0x7ab7('0x9')](_0x7ab7('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x7ab7('0x13')]);router[_0x7ab7('0x9')](_0x7ab7('0x14'),auth[_0x7ab7('0xa')](),controller[_0x7ab7('0x15')]);router[_0x7ab7('0x16')]('/',auth[_0x7ab7('0xa')](),controller[_0x7ab7('0x17')]);router[_0x7ab7('0x16')](_0x7ab7('0x18'),auth['isAuthenticated'](),controller[_0x7ab7('0x19')]);var upload=multer({'storage':multer[_0x7ab7('0x1a')]({'destination':function(_0x2180ec,_0x54964c,_0x4e27d7){_0x4e27d7(null,path[_0x7ab7('0x1b')](config[_0x7ab7('0x1c')],_0x7ab7('0x1d')));},'filename':function(_0x4f7cae,_0x32bf60,_0x337d30){_0x337d30(null,util['format'](_0x7ab7('0x1e'),Date['now'](),_0x32bf60['originalname'][_0x7ab7('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7ab7('0x16')](_0x7ab7('0x20'),upload[_0x7ab7('0x21')](_0x7ab7('0x22')),controller[_0x7ab7('0x23')]);router[_0x7ab7('0x16')]('/:id/messages',auth[_0x7ab7('0xd')](),controller[_0x7ab7('0x24')]);router['post'](_0x7ab7('0x25'),auth[_0x7ab7('0xa')](),interaction[_0x7ab7('0x26')](_0x7ab7('0x27'),_0x7ab7('0x28')),controller[_0x7ab7('0x29')]);router[_0x7ab7('0x2a')](_0x7ab7('0x2b'),auth[_0x7ab7('0xa')](),interaction[_0x7ab7('0x26')]('chat',_0x7ab7('0x2c')),controller[_0x7ab7('0x2d')]);router['put']('/:id/custom_update',controller[_0x7ab7('0x2e')]);router[_0x7ab7('0x2a')](_0x7ab7('0x2f'),auth['isChatInteractionAuthorized'](),controller[_0x7ab7('0x30')]);router[_0x7ab7('0x2a')](_0x7ab7('0x31'),controller['close']);router[_0x7ab7('0x32')](_0x7ab7('0x2b'),auth['isAuthenticated'](),interaction[_0x7ab7('0x26')]('chat',_0x7ab7('0x33')),controller[_0x7ab7('0x34')]);router['delete']('/:id/tags',auth[_0x7ab7('0xa')](),controller[_0x7ab7('0x35')]);module[_0x7ab7('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 307718f..0385430 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 _0xc4a9=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0xcd25a9,_0x1dddd2){var _0x5d0986=function(_0x294041){while(--_0x294041){_0xcd25a9['push'](_0xcd25a9['shift']());}};_0x5d0986(++_0x1dddd2);}(_0xc4a9,0xd5));var _0x9c4a=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xc4a9[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require('sequelize');module[_0x9c4a('0x0')]={'body':{'type':Sequelize[_0x9c4a('0x1')](_0x9c4a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9c4a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9c4a('0x4')]}}; \ No newline at end of file +var _0x71ef=['BOOLEAN','sequelize','exports','medium'];(function(_0x83534e,_0x4f25ee){var _0x3dcfaa=function(_0x34ed6a){while(--_0x34ed6a){_0x83534e['push'](_0x83534e['shift']());}};_0x3dcfaa(++_0x4f25ee);}(_0x71ef,0x9d));var _0xf71e=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x71ef[_0x21bfab];return _0x4db318;};'use strict';var Sequelize=require(_0xf71e('0x0'));module[_0xf71e('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf71e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf71e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 908d000..cd27bac 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 _0xe224=['offset','count','set','json','apply','reject','save','then','destroy','error','stack','name','send','ChatInternalMessage','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','admin','user','fullname','role','userpic','internal','online','showWebBar','sort','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','undefined','limit'];(function(_0x3aa719,_0x54f744){var _0x484aec=function(_0x71bcf7){while(--_0x71bcf7){_0x3aa719['push'](_0x3aa719['shift']());}};_0x484aec(++_0x54f744);}(_0xe224,0x1ab));var _0x4e22=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe224[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4e22('0x0'));var rimraf=require(_0x4e22('0x1'));var zipdir=require(_0x4e22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e22('0x3'));var moment=require(_0x4e22('0x4'));var BPromise=require(_0x4e22('0x5'));var Mustache=require(_0x4e22('0x6'));var util=require(_0x4e22('0x7'));var path=require('path');var sox=require(_0x4e22('0x8'));var csv=require('to-csv');var ejs=require(_0x4e22('0x9'));var fs=require('fs');var fs_extra=require(_0x4e22('0xa'));var _=require(_0x4e22('0xb'));var squel=require('squel');var crypto=require(_0x4e22('0xc'));var jsforce=require(_0x4e22('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4e22('0xe'));var querystring=require('querystring');var Papa=require(_0x4e22('0xf'));var Redis=require(_0x4e22('0x10'));var authService=require(_0x4e22('0x11'));var qs=require(_0x4e22('0x12'));var as=require(_0x4e22('0x13'));var hardwareService=require(_0x4e22('0x14'));var logger=require(_0x4e22('0x15'))(_0x4e22('0x16'));var utils=require(_0x4e22('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4e22('0x18'));var db=require(_0x4e22('0x19'))['db'];config[_0x4e22('0x1a')]=_[_0x4e22('0x1b')](config[_0x4e22('0x1a')],{'host':_0x4e22('0x1c'),'port':0x18eb});var socket=require(_0x4e22('0x1d'))(new Redis(config['redis']));require(_0x4e22('0x1e'))[_0x4e22('0x1f')](socket);function respondWithStatusCode(_0x32de4b,_0x3fef5d){_0x3fef5d=_0x3fef5d||0xcc;return function(_0x44b886){if(_0x44b886){return _0x32de4b[_0x4e22('0x20')](_0x3fef5d);}return _0x32de4b[_0x4e22('0x21')](_0x3fef5d)[_0x4e22('0x22')]();};}function respondWithResult(_0x4929b7,_0x2cc35b){_0x2cc35b=_0x2cc35b||0xc8;return function(_0x250e6b){if(_0x250e6b){return _0x4929b7[_0x4e22('0x21')](_0x2cc35b)['json'](_0x250e6b);}};}function respondWithFilteredResult(_0x51118a,_0x1dd161){return function(_0x522678){if(_0x522678){var _0x49c278=typeof _0x1dd161['offset']===_0x4e22('0x23')&&typeof _0x1dd161[_0x4e22('0x24')]===_0x4e22('0x23');var _0x171326=_0x522678['count'];var _0x48f31d=_0x49c278?0x0:_0x1dd161[_0x4e22('0x25')];var _0x2645ce=_0x49c278?_0x522678[_0x4e22('0x26')]:_0x1dd161[_0x4e22('0x25')]+_0x1dd161[_0x4e22('0x24')];var _0x1113ff;if(_0x2645ce>=_0x171326){_0x2645ce=_0x171326;_0x1113ff=0xc8;}else{_0x1113ff=0xce;}_0x51118a[_0x4e22('0x21')](_0x1113ff);return _0x51118a[_0x4e22('0x27')]('Content-Range',_0x48f31d+'-'+_0x2645ce+'/'+_0x171326)[_0x4e22('0x28')](_0x522678);}return null;};}function patchUpdates(_0x313109){return function(_0x467adc){try{jsonpatch[_0x4e22('0x29')](_0x467adc,_0x313109,!![]);}catch(_0x92a11e){return BPromise[_0x4e22('0x2a')](_0x92a11e);}return _0x467adc[_0x4e22('0x2b')]();};}function saveUpdates(_0xdbb362,_0x5618db){return function(_0x5b95cb){if(_0x5b95cb){return _0x5b95cb['update'](_0xdbb362)[_0x4e22('0x2c')](function(_0x47df00){return _0x47df00;});}return null;};}function removeEntity(_0x196a0b,_0xf05154){return function(_0x108863){if(_0x108863){return _0x108863[_0x4e22('0x2d')]()[_0x4e22('0x2c')](function(){_0x196a0b[_0x4e22('0x21')](0xcc)[_0x4e22('0x22')]();});}};}function handleEntityNotFound(_0x326514,_0x50733f){return function(_0xdcd6da){if(!_0xdcd6da){_0x326514[_0x4e22('0x20')](0x194);}return _0xdcd6da;};}function handleError(_0x36d436,_0x4ed22c){_0x4ed22c=_0x4ed22c||0x1f4;return function(_0x2a37b5){logger[_0x4e22('0x2e')](_0x2a37b5[_0x4e22('0x2f')]);if(_0x2a37b5[_0x4e22('0x30')]){delete _0x2a37b5[_0x4e22('0x30')];}_0x36d436[_0x4e22('0x21')](_0x4ed22c)[_0x4e22('0x31')](_0x2a37b5);};}exports['index']=function(_0x2d70d8,_0x586fa6){var _0x3bb506={},_0x4d264f={},_0xfedf4={'count':0x0,'rows':[]};var _0x3ca371=_['map'](db[_0x4e22('0x32')][_0x4e22('0x33')],function(_0x2469bf){return{'name':_0x2469bf['fieldName'],'type':_0x2469bf['type'][_0x4e22('0x34')]};});_0x4d264f[_0x4e22('0x35')]=_[_0x4e22('0x36')](_0x3ca371,'name');_0x4d264f[_0x4e22('0x37')]=_['keys'](_0x2d70d8[_0x4e22('0x37')]);_0x4d264f[_0x4e22('0x38')]=_[_0x4e22('0x39')](_0x4d264f[_0x4e22('0x35')],_0x4d264f[_0x4e22('0x37')]);_0x3bb506[_0x4e22('0x3a')]=_[_0x4e22('0x39')](_0x4d264f['model'],qs['fields'](_0x2d70d8['query'][_0x4e22('0x3b')]));_0x3bb506[_0x4e22('0x3a')]=_0x3bb506[_0x4e22('0x3a')][_0x4e22('0x3c')]?_0x3bb506['attributes']:_0x4d264f[_0x4e22('0x35')];if(!_0x2d70d8['query'][_0x4e22('0x3d')](_0x4e22('0x3e'))){_0x3bb506[_0x4e22('0x24')]=qs[_0x4e22('0x24')](_0x2d70d8[_0x4e22('0x37')][_0x4e22('0x24')]);_0x3bb506['offset']=qs['offset'](_0x2d70d8[_0x4e22('0x37')][_0x4e22('0x25')]);}_0x3bb506[_0x4e22('0x3f')]=qs['sort'](_0x2d70d8[_0x4e22('0x37')]['sort']);_0x3bb506[_0x4e22('0x40')]=qs[_0x4e22('0x38')](_[_0x4e22('0x41')](_0x2d70d8['query'],_0x4d264f[_0x4e22('0x38')]),_0x3ca371);if(_0x2d70d8[_0x4e22('0x37')][_0x4e22('0x42')]){_0x3bb506[_0x4e22('0x40')]=_[_0x4e22('0x43')](_0x3bb506['where'],{'$or':_[_0x4e22('0x36')](_0x3ca371,function(_0xeedd37){if(_0xeedd37[_0x4e22('0x44')]!==_0x4e22('0x45')){var _0x1c812f={};_0x1c812f[_0xeedd37[_0x4e22('0x30')]]={'$like':'%'+_0x2d70d8[_0x4e22('0x37')][_0x4e22('0x42')]+'%'};return _0x1c812f;}})});}_0x3bb506=_[_0x4e22('0x43')]({},_0x3bb506,_0x2d70d8[_0x4e22('0x46')]);var _0x4c1222={'where':_0x3bb506[_0x4e22('0x40')]};return db[_0x4e22('0x32')]['count'](_0x4c1222)[_0x4e22('0x2c')](function(_0x10ebb4){_0xfedf4[_0x4e22('0x26')]=_0x10ebb4;if(_0x2d70d8[_0x4e22('0x37')][_0x4e22('0x47')]){_0x3bb506[_0x4e22('0x48')]=[{'all':!![]}];}return db[_0x4e22('0x32')]['findAll'](_0x3bb506);})['then'](function(_0x49f431){_0xfedf4[_0x4e22('0x49')]=_0x49f431;return _0xfedf4;})['then'](respondWithFilteredResult(_0x586fa6,_0x3bb506))[_0x4e22('0x4a')](handleError(_0x586fa6,null));};exports[_0x4e22('0x4b')]=function(_0x1fc51e,_0x455578){var _0x5abde0={'raw':!![],'where':{'id':_0x1fc51e[_0x4e22('0x4c')]['id']}},_0x5e7165={};_0x5e7165[_0x4e22('0x35')]=_['keys'](db['ChatInternalMessage'][_0x4e22('0x33')]);_0x5e7165[_0x4e22('0x37')]=_['keys'](_0x1fc51e['query']);_0x5e7165[_0x4e22('0x38')]=_[_0x4e22('0x39')](_0x5e7165[_0x4e22('0x35')],_0x5e7165[_0x4e22('0x37')]);_0x5abde0['attributes']=_[_0x4e22('0x39')](_0x5e7165[_0x4e22('0x35')],qs[_0x4e22('0x3b')](_0x1fc51e[_0x4e22('0x37')]['fields']));_0x5abde0[_0x4e22('0x3a')]=_0x5abde0['attributes']['length']?_0x5abde0['attributes']:_0x5e7165[_0x4e22('0x35')];if(_0x1fc51e[_0x4e22('0x37')]['includeAll']){_0x5abde0[_0x4e22('0x48')]=[{'all':!![]}];}_0x5abde0=_[_0x4e22('0x43')]({},_0x5abde0,_0x1fc51e['options']);return db[_0x4e22('0x32')][_0x4e22('0x4d')](_0x5abde0)[_0x4e22('0x2c')](handleEntityNotFound(_0x455578,null))[_0x4e22('0x2c')](respondWithResult(_0x455578,null))[_0x4e22('0x4a')](handleError(_0x455578,null));};exports[_0x4e22('0x4e')]=function(_0x4d6633,_0x468c21){return db[_0x4e22('0x32')][_0x4e22('0x4e')](_0x4d6633[_0x4e22('0x4f')],{})[_0x4e22('0x2c')](respondWithResult(_0x468c21,0xc9))['catch'](handleError(_0x468c21,null));};exports[_0x4e22('0x50')]=function(_0x2c0ddb,_0x2c3614){if(_0x2c0ddb[_0x4e22('0x4f')]['id']){delete _0x2c0ddb[_0x4e22('0x4f')]['id'];}return db[_0x4e22('0x32')][_0x4e22('0x4d')]({'where':{'id':_0x2c0ddb[_0x4e22('0x4c')]['id']}})[_0x4e22('0x2c')](handleEntityNotFound(_0x2c3614,null))[_0x4e22('0x2c')](saveUpdates(_0x2c0ddb['body'],null))[_0x4e22('0x2c')](respondWithResult(_0x2c3614,null))[_0x4e22('0x4a')](handleError(_0x2c3614,null));};exports['destroy']=function(_0x2b2ad2,_0x5bbfee){return db[_0x4e22('0x32')][_0x4e22('0x4d')]({'where':{'id':_0x2b2ad2[_0x4e22('0x4c')]['id']}})[_0x4e22('0x2c')](handleEntityNotFound(_0x5bbfee,null))[_0x4e22('0x2c')](removeEntity(_0x5bbfee,null))[_0x4e22('0x4a')](handleError(_0x5bbfee,null));};exports['describe']=function(_0xa4d6b5,_0x3af6f1){return db[_0x4e22('0x32')][_0x4e22('0x51')]()['then'](respondWithResult(_0x3af6f1,null))['catch'](handleError(_0x3af6f1,null));};function wrapUser(_0x8c8975){return function(_0x14a81b){var _0x577662=_0x8c8975[_0x4e22('0x52')]({'plain':!![]});_0x577662[_0x4e22('0x53')]=[];if(_0x14a81b){_0x577662[_0x4e22('0x54')]=_0x14a81b[_0x4e22('0x55')];_0x577662[_0x4e22('0x56')]=_0x14a81b;}else{_0x577662['lastMessageAt']=moment(0x0)[_0x4e22('0x57')](_0x4e22('0x58'));_0x577662['lastMessage']={};}return _0x577662;};}exports[_0x4e22('0x59')]=function(_0x532012,_0x59840e,_0x4e15c){var _0x477969=[];return db['User'][_0x4e22('0x5a')]({'where':{'role':[_0x4e22('0x5b'),_0x4e22('0x5c'),_0x4e22('0x5d')]},'attributes':['id',_0x4e22('0x5e'),_0x4e22('0x30'),_0x4e22('0x5f'),_0x4e22('0x60'),_0x4e22('0x61'),_0x4e22('0x62'),'lastLoginAt','allowmessenger',_0x4e22('0x63')],'order':qs[_0x4e22('0x64')](_0x4e22('0x65')),'include':[{'model':db[_0x4e22('0x66')],'as':_0x4e22('0x67'),'attributes':['id',_0x4e22('0x30'),_0x4e22('0x44')],'through':{'attributes':[]}}]})['then'](function(_0x73adc0){if(_0x73adc0){var _0xb6c421=_0x532012['user'][_0x4e22('0x52')]({'plain':!![]});if(!_0xb6c421)throw new Error(_0x4e22('0x68'));if(_0xb6c421[_0x4e22('0x5f')]===_0x4e22('0x5d')){return db[_0x4e22('0x69')]['find']({'where':{'name':_0x4e22('0x6a'),'userProfileId':_0xb6c421[_0x4e22('0x6b')]},'raw':!![]})[_0x4e22('0x2c')](function(_0x1bcdab){if(_0x1bcdab){if(_0x1bcdab[_0x4e22('0x6c')]===0x0){return db['UserProfileResource'][_0x4e22('0x5a')]({'where':{'sectionId':_0x1bcdab['id']},'raw':!![]})[_0x4e22('0x2c')](function(_0x248eee){var _0x4e6147=[];if(_[_0x4e22('0x6d')](_0x248eee)){_0x4e6147=_[_0x4e22('0x42')](_0x73adc0,function(_0x56f79e){if(_0x56f79e[_0x4e22('0x5f')]!==_0x4e22('0x5b')){return _0x56f79e;}});return _0x4e6147;}else{for(var _0x2ca0ad=0x0;_0x2ca0ad<_0x73adc0[_0x4e22('0x3c')];_0x2ca0ad++){var _0x417ee6=_0x73adc0[_0x2ca0ad];if(_0x417ee6['role']===_0x4e22('0x5b')){var _0x3aef5e=_['find'](_0x248eee,function(_0x3f4408){return _0x3f4408['resourceId']===_0x417ee6['id'];});if(_0x3aef5e)_0x4e6147['push'](_0x417ee6);}else{_0x4e6147[_0x4e22('0x6e')](_0x417ee6);}}return _0x4e6147;}});}else{return _0x73adc0;}}else{var _0x4d70aa=_[_0x4e22('0x42')](_0x73adc0,function(_0x5bd9e9){if(_0x5bd9e9['role']!==_0x4e22('0x5b')){return _0x5bd9e9;}});return _0x4d70aa;}});}else{return _0x73adc0;}}})['then'](function(_0x3d0815){var _0x35cc9f=[];if(_0x3d0815){_0x477969=_0x3d0815;for(var _0x4a4893=0x0;_0x4a4893<_0x3d0815[_0x4e22('0x3c')];_0x4a4893+=0x1){_0x477969[_0x4a4893][_0x4e22('0x53')]=[];_0x35cc9f[_0x4e22('0x6e')](db[_0x4e22('0x32')][_0x4e22('0x4d')]({'where':{'FromId':[_0x532012[_0x4e22('0x5d')]['id'],_0x3d0815[_0x4a4893]['id']],'ToId':[_0x532012[_0x4e22('0x5d')]['id'],_0x3d0815[_0x4a4893]['id']],'ChatGroupId':null},'attributes':['id',_0x4e22('0x55'),_0x4e22('0x6f'),_0x4e22('0x70'),_0x4e22('0x71'),_0x4e22('0x4f')],'order':qs[_0x4e22('0x64')](_0x4e22('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4e22('0x2c')](wrapUser(_0x3d0815[_0x4a4893])));}return BPromise[_0x4e22('0x73')](_0x35cc9f);}return[];})[_0x4e22('0x2c')](function(_0x101c0c){return{'rows':_0x101c0c,'count':_0x101c0c[_0x4e22('0x3c')]};})[_0x4e22('0x2c')](respondWithResult(_0x59840e,null))[_0x4e22('0x4a')](handleError(_0x59840e,null));}; \ No newline at end of file +var _0x883a=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','ChatInternalMessage','findAll','rows','catch','show','find','create','body','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','role','userpic','online','lastLoginAt','-online','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x598cd7,_0x163f5e){var _0x2619d1=function(_0x24d85a){while(--_0x24d85a){_0x598cd7['push'](_0x598cd7['shift']());}};_0x2619d1(++_0x163f5e);}(_0x883a,0x1ea));var _0xa883=function(_0xa12b3f,_0x4abcfd){_0xa12b3f=_0xa12b3f-0x0;var _0x22de8b=_0x883a[_0xa12b3f];return _0x22de8b;};'use strict';var emlformat=require(_0xa883('0x0'));var rimraf=require(_0xa883('0x1'));var zipdir=require(_0xa883('0x2'));var jsonpatch=require(_0xa883('0x3'));var rp=require(_0xa883('0x4'));var moment=require('moment');var BPromise=require(_0xa883('0x5'));var Mustache=require(_0xa883('0x6'));var util=require(_0xa883('0x7'));var path=require(_0xa883('0x8'));var sox=require('sox');var csv=require(_0xa883('0x9'));var ejs=require(_0xa883('0xa'));var fs=require('fs');var fs_extra=require(_0xa883('0xb'));var _=require('lodash');var squel=require(_0xa883('0xc'));var crypto=require(_0xa883('0xd'));var jsforce=require(_0xa883('0xe'));var deskjs=require(_0xa883('0xf'));var toCsv=require(_0xa883('0x9'));var querystring=require(_0xa883('0x10'));var Papa=require('papaparse');var Redis=require(_0xa883('0x11'));var authService=require(_0xa883('0x12'));var qs=require(_0xa883('0x13'));var as=require(_0xa883('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa883('0x15'));var utils=require(_0xa883('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa883('0x17'));var db=require(_0xa883('0x18'))['db'];config[_0xa883('0x19')]=_[_0xa883('0x1a')](config[_0xa883('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa883('0x1b'))(new Redis(config[_0xa883('0x19')]));require(_0xa883('0x1c'))[_0xa883('0x1d')](socket);function respondWithStatusCode(_0x4176b9,_0x4030bc){_0x4030bc=_0x4030bc||0xcc;return function(_0x90d01b){if(_0x90d01b){return _0x4176b9[_0xa883('0x1e')](_0x4030bc);}return _0x4176b9[_0xa883('0x1f')](_0x4030bc)[_0xa883('0x20')]();};}function respondWithResult(_0x55f6e1,_0xb571de){_0xb571de=_0xb571de||0xc8;return function(_0x455a58){if(_0x455a58){return _0x55f6e1['status'](_0xb571de)[_0xa883('0x21')](_0x455a58);}};}function respondWithFilteredResult(_0x432589,_0x3de28a){return function(_0x5501c8){if(_0x5501c8){var _0x1f36ca=typeof _0x3de28a[_0xa883('0x22')]===_0xa883('0x23')&&typeof _0x3de28a[_0xa883('0x24')]===_0xa883('0x23');var _0x9d45d5=_0x5501c8[_0xa883('0x25')];var _0xe4db56=_0x1f36ca?0x0:_0x3de28a[_0xa883('0x22')];var _0x23dbae=_0x1f36ca?_0x5501c8[_0xa883('0x25')]:_0x3de28a['offset']+_0x3de28a[_0xa883('0x24')];var _0x3b8960;if(_0x23dbae>=_0x9d45d5){_0x23dbae=_0x9d45d5;_0x3b8960=0xc8;}else{_0x3b8960=0xce;}_0x432589[_0xa883('0x1f')](_0x3b8960);return _0x432589[_0xa883('0x26')]('Content-Range',_0xe4db56+'-'+_0x23dbae+'/'+_0x9d45d5)[_0xa883('0x21')](_0x5501c8);}return null;};}function patchUpdates(_0x21da8c){return function(_0x3a9185){try{jsonpatch[_0xa883('0x27')](_0x3a9185,_0x21da8c,!![]);}catch(_0x47233b){return BPromise[_0xa883('0x28')](_0x47233b);}return _0x3a9185['save']();};}function saveUpdates(_0x1786d4,_0x219736){return function(_0x628b41){if(_0x628b41){return _0x628b41[_0xa883('0x29')](_0x1786d4)['then'](function(_0x53fcbf){return _0x53fcbf;});}return null;};}function removeEntity(_0x55c48f,_0x4743f1){return function(_0x48c465){if(_0x48c465){return _0x48c465[_0xa883('0x2a')]()[_0xa883('0x2b')](function(){_0x55c48f[_0xa883('0x1f')](0xcc)[_0xa883('0x20')]();});}};}function handleEntityNotFound(_0x1981da,_0x4d385d){return function(_0x5b787e){if(!_0x5b787e){_0x1981da[_0xa883('0x1e')](0x194);}return _0x5b787e;};}function handleError(_0x375b51,_0x1b108f){_0x1b108f=_0x1b108f||0x1f4;return function(_0x324eca){logger[_0xa883('0x2c')](_0x324eca[_0xa883('0x2d')]);if(_0x324eca['name']){delete _0x324eca[_0xa883('0x2e')];}_0x375b51[_0xa883('0x1f')](_0x1b108f)[_0xa883('0x2f')](_0x324eca);};}exports[_0xa883('0x30')]=function(_0x3489f5,_0xa13ae5){var _0x4c9d38={},_0x1a0ddd={},_0xcfe104={'count':0x0,'rows':[]};var _0x377744=_[_0xa883('0x31')](db['ChatInternalMessage'][_0xa883('0x32')],function(_0x450279){return{'name':_0x450279['fieldName'],'type':_0x450279[_0xa883('0x33')]['key']};});_0x1a0ddd[_0xa883('0x34')]=_[_0xa883('0x31')](_0x377744,_0xa883('0x2e'));_0x1a0ddd['query']=_[_0xa883('0x35')](_0x3489f5[_0xa883('0x36')]);_0x1a0ddd[_0xa883('0x37')]=_[_0xa883('0x38')](_0x1a0ddd[_0xa883('0x34')],_0x1a0ddd[_0xa883('0x36')]);_0x4c9d38[_0xa883('0x39')]=_[_0xa883('0x38')](_0x1a0ddd[_0xa883('0x34')],qs['fields'](_0x3489f5[_0xa883('0x36')][_0xa883('0x3a')]));_0x4c9d38['attributes']=_0x4c9d38[_0xa883('0x39')][_0xa883('0x3b')]?_0x4c9d38[_0xa883('0x39')]:_0x1a0ddd['model'];if(!_0x3489f5[_0xa883('0x36')]['hasOwnProperty'](_0xa883('0x3c'))){_0x4c9d38[_0xa883('0x24')]=qs[_0xa883('0x24')](_0x3489f5[_0xa883('0x36')]['limit']);_0x4c9d38[_0xa883('0x22')]=qs['offset'](_0x3489f5[_0xa883('0x36')][_0xa883('0x22')]);}_0x4c9d38[_0xa883('0x3d')]=qs[_0xa883('0x3e')](_0x3489f5[_0xa883('0x36')][_0xa883('0x3e')]);_0x4c9d38[_0xa883('0x3f')]=qs[_0xa883('0x37')](_[_0xa883('0x40')](_0x3489f5[_0xa883('0x36')],_0x1a0ddd[_0xa883('0x37')]),_0x377744);if(_0x3489f5[_0xa883('0x36')][_0xa883('0x41')]){_0x4c9d38[_0xa883('0x3f')]=_[_0xa883('0x42')](_0x4c9d38['where'],{'$or':_[_0xa883('0x31')](_0x377744,function(_0x1d588f){if(_0x1d588f[_0xa883('0x33')]!=='VIRTUAL'){var _0x1fe8ae={};_0x1fe8ae[_0x1d588f[_0xa883('0x2e')]]={'$like':'%'+_0x3489f5['query']['filter']+'%'};return _0x1fe8ae;}})});}_0x4c9d38=_[_0xa883('0x42')]({},_0x4c9d38,_0x3489f5[_0xa883('0x43')]);var _0xa28c78={'where':_0x4c9d38['where']};return db[_0xa883('0x44')]['count'](_0xa28c78)['then'](function(_0x22cc42){_0xcfe104['count']=_0x22cc42;if(_0x3489f5[_0xa883('0x36')]['includeAll']){_0x4c9d38['include']=[{'all':!![]}];}return db[_0xa883('0x44')][_0xa883('0x45')](_0x4c9d38);})['then'](function(_0x20ce80){_0xcfe104[_0xa883('0x46')]=_0x20ce80;return _0xcfe104;})['then'](respondWithFilteredResult(_0xa13ae5,_0x4c9d38))[_0xa883('0x47')](handleError(_0xa13ae5,null));};exports[_0xa883('0x48')]=function(_0x5860c6,_0x510659){var _0x4c631c={'raw':!![],'where':{'id':_0x5860c6['params']['id']}},_0x23afb9={};_0x23afb9['model']=_[_0xa883('0x35')](db[_0xa883('0x44')][_0xa883('0x32')]);_0x23afb9[_0xa883('0x36')]=_['keys'](_0x5860c6[_0xa883('0x36')]);_0x23afb9[_0xa883('0x37')]=_['intersection'](_0x23afb9[_0xa883('0x34')],_0x23afb9[_0xa883('0x36')]);_0x4c631c[_0xa883('0x39')]=_[_0xa883('0x38')](_0x23afb9[_0xa883('0x34')],qs[_0xa883('0x3a')](_0x5860c6[_0xa883('0x36')][_0xa883('0x3a')]));_0x4c631c[_0xa883('0x39')]=_0x4c631c['attributes']['length']?_0x4c631c[_0xa883('0x39')]:_0x23afb9[_0xa883('0x34')];if(_0x5860c6[_0xa883('0x36')]['includeAll']){_0x4c631c['include']=[{'all':!![]}];}_0x4c631c=_['merge']({},_0x4c631c,_0x5860c6[_0xa883('0x43')]);return db[_0xa883('0x44')][_0xa883('0x49')](_0x4c631c)['then'](handleEntityNotFound(_0x510659,null))[_0xa883('0x2b')](respondWithResult(_0x510659,null))[_0xa883('0x47')](handleError(_0x510659,null));};exports[_0xa883('0x4a')]=function(_0x4f1482,_0x34c8b6){return db[_0xa883('0x44')][_0xa883('0x4a')](_0x4f1482[_0xa883('0x4b')],{})[_0xa883('0x2b')](respondWithResult(_0x34c8b6,0xc9))[_0xa883('0x47')](handleError(_0x34c8b6,null));};exports[_0xa883('0x29')]=function(_0x2719c7,_0x1d03e0){if(_0x2719c7['body']['id']){delete _0x2719c7[_0xa883('0x4b')]['id'];}return db[_0xa883('0x44')][_0xa883('0x49')]({'where':{'id':_0x2719c7['params']['id']}})['then'](handleEntityNotFound(_0x1d03e0,null))['then'](saveUpdates(_0x2719c7[_0xa883('0x4b')],null))['then'](respondWithResult(_0x1d03e0,null))[_0xa883('0x47')](handleError(_0x1d03e0,null));};exports[_0xa883('0x2a')]=function(_0x390b9c,_0x272707){return db[_0xa883('0x44')][_0xa883('0x49')]({'where':{'id':_0x390b9c['params']['id']}})[_0xa883('0x2b')](handleEntityNotFound(_0x272707,null))['then'](removeEntity(_0x272707,null))[_0xa883('0x47')](handleError(_0x272707,null));};exports[_0xa883('0x4c')]=function(_0x4d5904,_0x2d7d15){return db[_0xa883('0x44')][_0xa883('0x4c')]()['then'](respondWithResult(_0x2d7d15,null))[_0xa883('0x47')](handleError(_0x2d7d15,null));};function wrapUser(_0x237dc9){return function(_0x5e79e6){var _0x5bb5b0=_0x237dc9[_0xa883('0x4d')]({'plain':!![]});_0x5bb5b0[_0xa883('0x4e')]=[];if(_0x5e79e6){_0x5bb5b0[_0xa883('0x4f')]=_0x5e79e6[_0xa883('0x50')];_0x5bb5b0['lastMessage']=_0x5e79e6;}else{_0x5bb5b0['lastMessageAt']=moment(0x0)['format'](_0xa883('0x51'));_0x5bb5b0[_0xa883('0x52')]={};}return _0x5bb5b0;};}exports['getUsers']=function(_0x2aa318,_0x282cd1,_0x11d9cd){var _0x3439bb=[];return db[_0xa883('0x53')]['findAll']({'where':{'role':[_0xa883('0x54'),_0xa883('0x55'),_0xa883('0x56')]},'attributes':['id','fullname',_0xa883('0x2e'),_0xa883('0x57'),_0xa883('0x58'),'internal',_0xa883('0x59'),_0xa883('0x5a'),'allowmessenger','showWebBar'],'order':qs['sort'](_0xa883('0x5b')),'include':[{'model':db[_0xa883('0x5c')],'as':'VoiceQueues','attributes':['id',_0xa883('0x2e'),_0xa883('0x33')],'through':{'attributes':[]}}]})['then'](function(_0x21fc7d){if(_0x21fc7d){var _0x3a5066=_0x2aa318[_0xa883('0x56')][_0xa883('0x4d')]({'plain':!![]});if(!_0x3a5066)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a5066['role']===_0xa883('0x56')){return db[_0xa883('0x5d')][_0xa883('0x49')]({'where':{'name':_0xa883('0x5e'),'userProfileId':_0x3a5066[_0xa883('0x5f')]},'raw':!![]})[_0xa883('0x2b')](function(_0x15dc8e){if(_0x15dc8e){if(_0x15dc8e[_0xa883('0x60')]===0x0){return db['UserProfileResource'][_0xa883('0x45')]({'where':{'sectionId':_0x15dc8e['id']},'raw':!![]})['then'](function(_0xc9c182){var _0x3a8ada=[];if(_[_0xa883('0x61')](_0xc9c182)){_0x3a8ada=_[_0xa883('0x41')](_0x21fc7d,function(_0x11aec5){if(_0x11aec5[_0xa883('0x57')]!==_0xa883('0x54')){return _0x11aec5;}});return _0x3a8ada;}else{for(var _0x4b9c1d=0x0;_0x4b9c1d<_0x21fc7d['length'];_0x4b9c1d++){var _0x2749d7=_0x21fc7d[_0x4b9c1d];if(_0x2749d7[_0xa883('0x57')]===_0xa883('0x54')){var _0x6dd4e3=_[_0xa883('0x49')](_0xc9c182,function(_0x21c7dc){return _0x21c7dc[_0xa883('0x62')]===_0x2749d7['id'];});if(_0x6dd4e3)_0x3a8ada[_0xa883('0x63')](_0x2749d7);}else{_0x3a8ada[_0xa883('0x63')](_0x2749d7);}}return _0x3a8ada;}});}else{return _0x21fc7d;}}else{var _0x30492e=_[_0xa883('0x41')](_0x21fc7d,function(_0x7dff17){if(_0x7dff17[_0xa883('0x57')]!==_0xa883('0x54')){return _0x7dff17;}});return _0x30492e;}});}else{return _0x21fc7d;}}})[_0xa883('0x2b')](function(_0x1992ac){var _0x24e5d8=[];if(_0x1992ac){_0x3439bb=_0x1992ac;for(var _0x53208b=0x0;_0x53208b<_0x1992ac[_0xa883('0x3b')];_0x53208b+=0x1){_0x3439bb[_0x53208b][_0xa883('0x4e')]=[];_0x24e5d8['push'](db['ChatInternalMessage'][_0xa883('0x49')]({'where':{'FromId':[_0x2aa318['user']['id'],_0x1992ac[_0x53208b]['id']],'ToId':[_0x2aa318[_0xa883('0x56')]['id'],_0x1992ac[_0x53208b]['id']],'ChatGroupId':null},'attributes':['id',_0xa883('0x50'),_0xa883('0x64'),_0xa883('0x65'),_0xa883('0x66'),_0xa883('0x4b')],'order':qs['sort'](_0xa883('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa883('0x2b')](wrapUser(_0x1992ac[_0x53208b])));}return BPromise['all'](_0x24e5d8);}return[];})[_0xa883('0x2b')](function(_0xc64eb0){return{'rows':_0xc64eb0,'count':_0xc64eb0[_0xa883('0x3b')]};})[_0xa883('0x2b')](respondWithResult(_0x282cd1,null))[_0xa883('0x47')](handleError(_0x282cd1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 84ac1ea..0f56ed3 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 _0x05d8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save','remove'];(function(_0x5ae4b5,_0x11834b){var _0x35b85e=function(_0x58b7b3){while(--_0x58b7b3){_0x5ae4b5['push'](_0x5ae4b5['shift']());}};_0x35b85e(++_0x11834b);}(_0x05d8,0xe5));var _0x805d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x05d8[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x805d('0x0'));var ChatInternalMessage=require(_0x805d('0x1'))['db'][_0x805d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x805d('0x3'),'afterUpdate':'update','afterDestroy':_0x805d('0x4')};function emitEvent(_0x2158b9){return function(_0x3341f8,_0x1468f8,_0x3e87d6){ChatInternalMessageEvents['emit'](_0x2158b9+':'+_0x3341f8['id'],_0x3341f8);ChatInternalMessageEvents[_0x805d('0x5')](_0x2158b9,_0x3341f8);_0x3e87d6(null);};}for(var e in events){if(events[_0x805d('0x6')](e)){var event=events[e];ChatInternalMessage[_0x805d('0x7')](e,emitEvent(event));}}module[_0x805d('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x2768=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1da430,_0x13e5e7){var _0x5d7bc6=function(_0x45bd65){while(--_0x45bd65){_0x1da430['push'](_0x1da430['shift']());}};_0x5d7bc6(++_0x13e5e7);}(_0x2768,0x6c));var _0x8276=function(_0x12d87d,_0x29c8d8){_0x12d87d=_0x12d87d-0x0;var _0x53b77d=_0x2768[_0x12d87d];return _0x53b77d;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x8276('0x0'))['db'][_0x8276('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8276('0x2')](0x0);var events={'afterCreate':_0x8276('0x3'),'afterUpdate':_0x8276('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15557f){return function(_0x178fde,_0x512040,_0x3b1d2c){ChatInternalMessageEvents[_0x8276('0x5')](_0x15557f+':'+_0x178fde['id'],_0x178fde);ChatInternalMessageEvents[_0x8276('0x5')](_0x15557f,_0x178fde);_0x3b1d2c(null);};}for(var e in events){if(events[_0x8276('0x6')](e)){var event=events[e];ChatInternalMessage[_0x8276('0x7')](e,emitEvent(event));}}module[_0x8276('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 7dffe12..73e9ec4 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 _0xb2f1=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0xb2f1,0xc7));var _0x1b2f=function(_0x490cdd,_0x3bfce4){_0x490cdd=_0x490cdd-0x0;var _0x21b3c8=_0xb2f1[_0x490cdd];return _0x21b3c8;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require(_0x1b2f('0x2'))(_0x1b2f('0x3'));var moment=require(_0x1b2f('0x4'));var BPromise=require(_0x1b2f('0x5'));var rp=require(_0x1b2f('0x6'));var fs=require('fs');var path=require(_0x1b2f('0x7'));var rimraf=require(_0x1b2f('0x8'));var config=require(_0x1b2f('0x9'));var attributes=require('./chatInternalMessage.attributes');module[_0x1b2f('0xa')]=function(_0x32667a,_0x26d0a8){return _0x32667a[_0x1b2f('0xb')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x907e=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','utf8mb4'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x907e,0x8c));var _0xe907=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x907e[_0x5dc03e];return _0x466a07;};'use strict';var _=require(_0xe907('0x0'));var util=require(_0xe907('0x1'));var logger=require(_0xe907('0x2'))(_0xe907('0x3'));var moment=require('moment');var BPromise=require(_0xe907('0x4'));var rp=require(_0xe907('0x5'));var fs=require('fs');var path=require(_0xe907('0x6'));var rimraf=require('rimraf');var config=require(_0xe907('0x7'));var attributes=require(_0xe907('0x8'));module['exports']=function(_0x54db83,_0x568e9f){return _0x54db83['define']('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe907('0x9'),'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 42b4ef8..657ee77 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 _0xe6c1=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults'];(function(_0x789da4,_0x4928df){var _0x49982a=function(_0x4d336f){while(--_0x4d336f){_0x789da4['push'](_0x789da4['shift']());}};_0x49982a(++_0x4928df);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x1e6c('0x0'));var moment=require(_0x1e6c('0x1'));var BPromise=require(_0x1e6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e6c('0x3'))['db'];var utils=require(_0x1e6c('0x4'));var logger=require(_0x1e6c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1e6c('0x6')]({'port':0x232a});config[_0x1e6c('0x7')]=_[_0x1e6c('0x8')](config[_0x1e6c('0x7')],{'host':_0x1e6c('0x9'),'port':0x18eb});var socket=require(_0x1e6c('0xa'))(new Redis(config[_0x1e6c('0x7')]));require(_0x1e6c('0xb'))[_0x1e6c('0xc')](socket);function respondWithRpcPromise(_0x1632a9,_0x350260,_0x2f8980){return new BPromise(function(_0x33d351,_0x1c8c86){return client[_0x1e6c('0xd')](_0x1632a9,_0x2f8980)[_0x1e6c('0xe')](function(_0x16a013){logger[_0x1e6c('0xf')](_0x1e6c('0x10'),_0x350260,_0x1e6c('0x11'));logger[_0x1e6c('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x350260,_0x1e6c('0x11'),JSON[_0x1e6c('0x13')](_0x16a013));if(_0x16a013['error']){if(_0x16a013[_0x1e6c('0x14')][_0x1e6c('0x15')]===0x1f4){logger[_0x1e6c('0x14')](_0x1e6c('0x10'),_0x350260,_0x16a013[_0x1e6c('0x14')][_0x1e6c('0x16')]);return _0x1c8c86(_0x16a013[_0x1e6c('0x14')]['message']);}logger[_0x1e6c('0x14')](_0x1e6c('0x10'),_0x350260,_0x16a013[_0x1e6c('0x14')][_0x1e6c('0x16')]);return _0x33d351(_0x16a013[_0x1e6c('0x14')]['message']);}else{logger[_0x1e6c('0xf')](_0x1e6c('0x10'),_0x350260,_0x1e6c('0x11'));_0x33d351(_0x16a013[_0x1e6c('0x17')]['message']);}})[_0x1e6c('0x18')](function(_0x24271b){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x350260,_0x24271b);_0x1c8c86(_0x24271b);});});} \ No newline at end of file +var _0x6732=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x550370,_0x303d8d){var _0x340b52=function(_0x288ff2){while(--_0x288ff2){_0x550370['push'](_0x550370['shift']());}};_0x340b52(++_0x303d8d);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2673('0x0'));var util=require(_0x2673('0x1'));var moment=require(_0x2673('0x2'));var BPromise=require(_0x2673('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2673('0x4'));var db=require(_0x2673('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2673('0x6'))(_0x2673('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2673('0x8')][_0x2673('0x9')]({'port':0x232a});config[_0x2673('0xa')]=_[_0x2673('0xb')](config[_0x2673('0xa')],{'host':_0x2673('0xc'),'port':0x18eb});var socket=require(_0x2673('0xd'))(new Redis(config[_0x2673('0xa')]));require(_0x2673('0xe'))[_0x2673('0xf')](socket);function respondWithRpcPromise(_0x1cde0f,_0x3176be,_0xd9759d){return new BPromise(function(_0x29daef,_0x35b72e){return client[_0x2673('0x10')](_0x1cde0f,_0xd9759d)[_0x2673('0x11')](function(_0xacd8f7){logger[_0x2673('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3176be,_0x2673('0x13'));logger['debug'](_0x2673('0x14'),_0x3176be,_0x2673('0x13'),JSON[_0x2673('0x15')](_0xacd8f7));if(_0xacd8f7[_0x2673('0x16')]){if(_0xacd8f7[_0x2673('0x16')]['code']===0x1f4){logger['error'](_0x2673('0x17'),_0x3176be,_0xacd8f7[_0x2673('0x16')][_0x2673('0x18')]);return _0x35b72e(_0xacd8f7[_0x2673('0x16')][_0x2673('0x18')]);}logger['error'](_0x2673('0x17'),_0x3176be,_0xacd8f7[_0x2673('0x16')][_0x2673('0x18')]);return _0x29daef(_0xacd8f7[_0x2673('0x16')]['message']);}else{logger[_0x2673('0x12')](_0x2673('0x17'),_0x3176be,_0x2673('0x13'));_0x29daef(_0xacd8f7[_0x2673('0x19')][_0x2673('0x18')]);}})['catch'](function(_0x585be4){logger[_0x2673('0x16')](_0x2673('0x17'),_0x3176be,_0x585be4);_0x35b72e(_0x585be4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 69ae23d..07bafe3 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 _0xf1d3=['./chatInternalMessage.events','save','update','emit','register','chatInternalMessage:'];(function(_0x22152c,_0x1d9db9){var _0x5d57ef=function(_0x4d4720){while(--_0x4d4720){_0x22152c['push'](_0x22152c['shift']());}};_0x5d57ef(++_0x1d9db9);}(_0xf1d3,0x14a));var _0x3f1d=function(_0x2e76af,_0x2283d9){_0x2e76af=_0x2e76af-0x0;var _0xcd80c4=_0xf1d3[_0x2e76af];return _0xcd80c4;};'use strict';var ChatInternalMessageEvents=require(_0x3f1d('0x0'));var events=[_0x3f1d('0x1'),'remove',_0x3f1d('0x2')];function createListener(_0x23e117,_0x3e4359){return function(_0x4f6c36){_0x3e4359[_0x3f1d('0x3')](_0x23e117,_0x4f6c36);};}function removeListener(_0x54e69c,_0x24e89c){return function(){ChatInternalMessageEvents['removeListener'](_0x54e69c,_0x24e89c);};}exports[_0x3f1d('0x4')]=function(_0x4f4c53){for(var _0x30b8e9=0x0,_0x2c75ab=events['length'];_0x30b8e9<_0x2c75ab;_0x30b8e9++){var _0x32fd73=events[_0x30b8e9];var _0x493cea=createListener(_0x3f1d('0x5')+_0x32fd73,_0x4f4c53);ChatInternalMessageEvents['on'](_0x32fd73,_0x493cea);}}; \ No newline at end of file +var _0xe097=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x274584,_0x501942){var _0x3a068=function(_0x292e30){while(--_0x292e30){_0x274584['push'](_0x274584['shift']());}};_0x3a068(++_0x501942);}(_0xe097,0x1ad));var _0x7e09=function(_0x243207,_0x24786b){_0x243207=_0x243207-0x0;var _0x17ba1c=_0xe097[_0x243207];return _0x17ba1c;};'use strict';var ChatInternalMessageEvents=require(_0x7e09('0x0'));var events=[_0x7e09('0x1'),_0x7e09('0x2'),_0x7e09('0x3')];function createListener(_0x5e2452,_0x4ffc93){return function(_0x2ada49){_0x4ffc93[_0x7e09('0x4')](_0x5e2452,_0x2ada49);};}function removeListener(_0x44a66f,_0x25b5f8){return function(){ChatInternalMessageEvents[_0x7e09('0x5')](_0x44a66f,_0x25b5f8);};}exports[_0x7e09('0x6')]=function(_0x4388c7){for(var _0x1e11cb=0x0,_0x59a963=events[_0x7e09('0x7')];_0x1e11cb<_0x59a963;_0x1e11cb++){var _0x27f881=events[_0x1e11cb];var _0x4963a2=createListener(_0x7e09('0x8')+_0x27f881,_0x4388c7);ChatInternalMessageEvents['on'](_0x27f881,_0x4963a2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 38c1c59..f636f1f 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 _0x341a=['destroy','exports','multer','util','connect-timeout','express','fs-extra','./chatInternalMessage.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','delete'];(function(_0x17b97c,_0x2c9547){var _0xa40336=function(_0x3215a7){while(--_0x3215a7){_0x17b97c['push'](_0x17b97c['shift']());}};_0xa40336(++_0x2c9547);}(_0x341a,0x6e));var _0xa341=function(_0x35488b,_0x1ee7ac){_0x35488b=_0x35488b-0x0;var _0x48e6d5=_0x341a[_0x35488b];return _0x48e6d5;};'use strict';var multer=require(_0xa341('0x0'));var util=require(_0xa341('0x1'));var path=require('path');var timeout=require(_0xa341('0x2'));var express=require(_0xa341('0x3'));var router=express['Router']();var fs_extra=require(_0xa341('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa341('0x5'));router[_0xa341('0x6')]('/',auth[_0xa341('0x7')](),controller[_0xa341('0x8')]);router[_0xa341('0x6')]('/describe',auth[_0xa341('0x7')](),controller[_0xa341('0x9')]);router[_0xa341('0x6')]('/users',auth[_0xa341('0x7')](),controller['getUsers']);router['get']('/:id',auth[_0xa341('0x7')](),controller[_0xa341('0xa')]);router[_0xa341('0xb')]('/',auth[_0xa341('0x7')](),controller[_0xa341('0xc')]);router[_0xa341('0xd')](_0xa341('0xe'),controller['update']);router[_0xa341('0xf')](_0xa341('0xe'),auth[_0xa341('0x7')](),controller[_0xa341('0x10')]);module[_0xa341('0x11')]=router; \ No newline at end of file +var _0x7846=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','create','put'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x7846,0xf4));var _0x6784=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x7846[_0x267c52];return _0x46c47b;};'use strict';var multer=require('multer');var util=require(_0x6784('0x0'));var path=require(_0x6784('0x1'));var timeout=require(_0x6784('0x2'));var express=require(_0x6784('0x3'));var router=express[_0x6784('0x4')]();var fs_extra=require(_0x6784('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6784('0x6'));var config=require(_0x6784('0x7'));var controller=require(_0x6784('0x8'));router[_0x6784('0x9')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0xb')]);router[_0x6784('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6784('0xc')]);router[_0x6784('0x9')](_0x6784('0xd'),auth[_0x6784('0xa')](),controller[_0x6784('0xe')]);router[_0x6784('0x9')](_0x6784('0xf'),auth[_0x6784('0xa')](),controller[_0x6784('0x10')]);router[_0x6784('0x11')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0x12')]);router[_0x6784('0x13')](_0x6784('0xf'),controller[_0x6784('0x14')]);router[_0x6784('0x15')]('/:id',auth[_0x6784('0xa')](),controller[_0x6784('0x16')]);module[_0x6784('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index af19468..f4eba47 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 _0x0fd9=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x2a5d22,_0x5cfd8e){var _0x1ab928=function(_0x177f60){while(--_0x177f60){_0x2a5d22['push'](_0x2a5d22['shift']());}};_0x1ab928(++_0x5cfd8e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x0fd9[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'body':{'type':Sequelize[_0x90fd('0x1')](_0x90fd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x90fd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x90fd('0x4')),'defaultValue':_0x90fd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x90fd('0x5')]},'providerName':{'type':Sequelize[_0x90fd('0x6')]},'providerResponse':{'type':Sequelize[_0x90fd('0x1')]}}; \ No newline at end of file +var _0x6b20=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x4c0baa,_0x2e110f){var _0x4bf459=function(_0x401aa3){while(--_0x401aa3){_0x4c0baa['push'](_0x4c0baa['shift']());}};_0x4bf459(++_0x2e110f);}(_0x6b20,0xd1));var _0x06b2=function(_0x3daf86,_0x3b3a78){_0x3daf86=_0x3daf86-0x0;var _0x3e9647=_0x6b20[_0x3daf86];return _0x3e9647;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x06b2('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x06b2('0x4')]('in',_0x06b2('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x06b2('0x6')]},'providerName':{'type':Sequelize[_0x06b2('0x7')]},'providerResponse':{'type':Sequelize[_0x06b2('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5ee4ad3..0ba66f5 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 _0xd445=['body','describe','../../config/logger','chat-interactions','accept','readAt','format','UserId','user','agent','get','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','reject','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd445,0x1cb));var _0x5d44=function(_0x40008b,_0x10bb16){_0x40008b=_0x40008b-0x0;var _0x351514=_0xd445[_0x40008b];return _0x351514;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d44('0x0'));var zipdir=require(_0x5d44('0x1'));var jsonpatch=require(_0x5d44('0x2'));var rp=require(_0x5d44('0x3'));var moment=require(_0x5d44('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5d44('0x5'));var util=require(_0x5d44('0x6'));var path=require(_0x5d44('0x7'));var sox=require(_0x5d44('0x8'));var csv=require(_0x5d44('0x9'));var ejs=require(_0x5d44('0xa'));var fs=require('fs');var fs_extra=require(_0x5d44('0xb'));var _=require(_0x5d44('0xc'));var squel=require(_0x5d44('0xd'));var crypto=require(_0x5d44('0xe'));var jsforce=require(_0x5d44('0xf'));var deskjs=require(_0x5d44('0x10'));var toCsv=require(_0x5d44('0x9'));var querystring=require(_0x5d44('0x11'));var Papa=require('papaparse');var Redis=require(_0x5d44('0x12'));var authService=require(_0x5d44('0x13'));var qs=require(_0x5d44('0x14'));var as=require(_0x5d44('0x15'));var hardwareService=require(_0x5d44('0x16'));var logger=require('../../config/logger')(_0x5d44('0x17'));var utils=require(_0x5d44('0x18'));var config=require(_0x5d44('0x19'));var licenseUtil=require(_0x5d44('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5d44('0x1b')](config[_0x5d44('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x5d44('0x1d'))(new Redis(config[_0x5d44('0x1c')]));require(_0x5d44('0x1e'))[_0x5d44('0x1f')](socket);var jayson=require(_0x5d44('0x20'));var client=jayson[_0x5d44('0x21')][_0x5d44('0x22')]({'port':0x232c});var client9002=jayson[_0x5d44('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5762e2,_0x32970b,_0x16d194,_0x1ab30f){return new BPromise(function(_0x17eb7c,_0x950ad){var _0x14a882=_0x1ab30f||client;return _0x14a882['request'](_0x5762e2,_0x16d194)[_0x5d44('0x23')](function(_0x3006d1){logger['info'](_0x5d44('0x24'),_0x32970b,_0x5d44('0x25'));logger[_0x5d44('0x26')](_0x5d44('0x27'),_0x32970b,_0x5d44('0x25'),JSON['stringify'](_0x3006d1));if(_0x3006d1[_0x5d44('0x28')]){if(_0x3006d1[_0x5d44('0x28')][_0x5d44('0x29')]===0x1f4){logger[_0x5d44('0x28')]('ChatMessage,\x20%s,\x20%s',_0x32970b,_0x3006d1['error'][_0x5d44('0x2a')]);return _0x950ad(_0x3006d1[_0x5d44('0x28')][_0x5d44('0x2a')]);}logger[_0x5d44('0x28')](_0x5d44('0x24'),_0x32970b,_0x3006d1[_0x5d44('0x28')][_0x5d44('0x2a')]);return _0x17eb7c(_0x3006d1['error'][_0x5d44('0x2a')]);}else{logger['info'](_0x5d44('0x24'),_0x32970b,_0x5d44('0x25'));_0x17eb7c(_0x3006d1[_0x5d44('0x2b')][_0x5d44('0x2a')]);}})[_0x5d44('0x2c')](function(_0x179350){logger[_0x5d44('0x28')](_0x5d44('0x24'),_0x32970b,_0x179350);_0x950ad(_0x179350);});});}function respondWithStatusCode(_0x299986,_0x2ec3df){_0x2ec3df=_0x2ec3df||0xcc;return function(_0xd9700c){if(_0xd9700c){return _0x299986[_0x5d44('0x2d')](_0x2ec3df);}return _0x299986[_0x5d44('0x2e')](_0x2ec3df)['end']();};}function respondWithResult(_0x339867,_0x4f26ed){_0x4f26ed=_0x4f26ed||0xc8;return function(_0x2bb344){if(_0x2bb344){return _0x339867[_0x5d44('0x2e')](_0x4f26ed)['json'](_0x2bb344);}};}function respondWithFilteredResult(_0x3465a6,_0x52a548){return function(_0x52635c){if(_0x52635c){var _0x3984f0=typeof _0x52a548[_0x5d44('0x2f')]===_0x5d44('0x30')&&typeof _0x52a548['limit']===_0x5d44('0x30');var _0x5ec559=_0x52635c[_0x5d44('0x31')];var _0x5e2797=_0x3984f0?0x0:_0x52a548[_0x5d44('0x2f')];var _0x271136=_0x3984f0?_0x52635c[_0x5d44('0x31')]:_0x52a548[_0x5d44('0x2f')]+_0x52a548[_0x5d44('0x32')];var _0x5e5112;if(_0x271136>=_0x5ec559){_0x271136=_0x5ec559;_0x5e5112=0xc8;}else{_0x5e5112=0xce;}_0x3465a6[_0x5d44('0x2e')](_0x5e5112);return _0x3465a6['set'](_0x5d44('0x33'),_0x5e2797+'-'+_0x271136+'/'+_0x5ec559)[_0x5d44('0x34')](_0x52635c);}return null;};}function patchUpdates(_0x5872fe){return function(_0x14c0a8){try{jsonpatch[_0x5d44('0x35')](_0x14c0a8,_0x5872fe,!![]);}catch(_0x2bd0d){return BPromise['reject'](_0x2bd0d);}return _0x14c0a8[_0x5d44('0x36')]();};}function saveUpdates(_0x3a2a30,_0x477ddc){return function(_0xbf935c){if(_0xbf935c){return _0xbf935c[_0x5d44('0x37')](_0x3a2a30)[_0x5d44('0x23')](function(_0x3ed8dc){return _0x3ed8dc;});}return null;};}function removeEntity(_0x9ea9b9,_0x36bf93){return function(_0x6fa78e){if(_0x6fa78e){return _0x6fa78e[_0x5d44('0x38')]()[_0x5d44('0x23')](function(){_0x9ea9b9[_0x5d44('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x152474,_0x2b4c74){return function(_0x1c6cfd){if(!_0x1c6cfd){_0x152474[_0x5d44('0x2d')](0x194);}return _0x1c6cfd;};}function handleError(_0x43b5b5,_0x545f82){_0x545f82=_0x545f82||0x1f4;return function(_0x1a0423){logger[_0x5d44('0x28')](_0x1a0423[_0x5d44('0x39')]);if(_0x1a0423[_0x5d44('0x3a')]){delete _0x1a0423['name'];}_0x43b5b5[_0x5d44('0x2e')](_0x545f82)[_0x5d44('0x3b')](_0x1a0423);};}exports[_0x5d44('0x3c')]=function(_0x1fe90b,_0x8681db){var _0x464a8a={},_0xc362d2={},_0x4be3a1={'count':0x0,'rows':[]};var _0x2d6332=_[_0x5d44('0x3d')](db[_0x5d44('0x3e')][_0x5d44('0x3f')],function(_0xbc271c){return{'name':_0xbc271c['fieldName'],'type':_0xbc271c['type']['key']};});_0xc362d2[_0x5d44('0x40')]=_[_0x5d44('0x3d')](_0x2d6332,_0x5d44('0x3a'));_0xc362d2[_0x5d44('0x41')]=_[_0x5d44('0x42')](_0x1fe90b[_0x5d44('0x41')]);_0xc362d2[_0x5d44('0x43')]=_[_0x5d44('0x44')](_0xc362d2[_0x5d44('0x40')],_0xc362d2[_0x5d44('0x41')]);_0x464a8a['attributes']=_[_0x5d44('0x44')](_0xc362d2[_0x5d44('0x40')],qs[_0x5d44('0x45')](_0x1fe90b[_0x5d44('0x41')]['fields']));_0x464a8a[_0x5d44('0x46')]=_0x464a8a[_0x5d44('0x46')][_0x5d44('0x47')]?_0x464a8a['attributes']:_0xc362d2[_0x5d44('0x40')];if(!_0x1fe90b['query'][_0x5d44('0x48')](_0x5d44('0x49'))){_0x464a8a[_0x5d44('0x32')]=qs[_0x5d44('0x32')](_0x1fe90b[_0x5d44('0x41')][_0x5d44('0x32')]);_0x464a8a[_0x5d44('0x2f')]=qs[_0x5d44('0x2f')](_0x1fe90b['query'][_0x5d44('0x2f')]);}_0x464a8a[_0x5d44('0x4a')]=qs[_0x5d44('0x4b')](_0x1fe90b[_0x5d44('0x41')][_0x5d44('0x4b')]);_0x464a8a[_0x5d44('0x4c')]=qs[_0x5d44('0x43')](_[_0x5d44('0x4d')](_0x1fe90b[_0x5d44('0x41')],_0xc362d2[_0x5d44('0x43')]),_0x2d6332);if(_0x1fe90b['query'][_0x5d44('0x4e')]){_0x464a8a['where']=_[_0x5d44('0x4f')](_0x464a8a[_0x5d44('0x4c')],{'$or':_['map'](_0x2d6332,function(_0x3f60e2){if(_0x3f60e2['type']!==_0x5d44('0x50')){var _0x2d6672={};_0x2d6672[_0x3f60e2[_0x5d44('0x3a')]]={'$like':'%'+_0x1fe90b[_0x5d44('0x41')][_0x5d44('0x4e')]+'%'};return _0x2d6672;}})});}_0x464a8a=_[_0x5d44('0x4f')]({},_0x464a8a,_0x1fe90b[_0x5d44('0x51')]);var _0x34be6d={'where':_0x464a8a[_0x5d44('0x4c')]};return db[_0x5d44('0x3e')][_0x5d44('0x31')](_0x34be6d)[_0x5d44('0x23')](function(_0x43537a){_0x4be3a1['count']=_0x43537a;if(_0x1fe90b[_0x5d44('0x41')][_0x5d44('0x52')]){_0x464a8a[_0x5d44('0x53')]=[{'all':!![]}];}return db[_0x5d44('0x3e')][_0x5d44('0x54')](_0x464a8a);})[_0x5d44('0x23')](function(_0x6c2928){_0x4be3a1[_0x5d44('0x55')]=_0x6c2928;return _0x4be3a1;})[_0x5d44('0x23')](respondWithFilteredResult(_0x8681db,_0x464a8a))[_0x5d44('0x2c')](handleError(_0x8681db,null));};exports['show']=function(_0x3d9f80,_0x22a0b6){var _0x307cd7={'raw':!![],'where':{'id':_0x3d9f80[_0x5d44('0x56')]['id']}},_0x528325={};_0x528325[_0x5d44('0x40')]=_['keys'](db[_0x5d44('0x3e')]['rawAttributes']);_0x528325[_0x5d44('0x41')]=_[_0x5d44('0x42')](_0x3d9f80[_0x5d44('0x41')]);_0x528325[_0x5d44('0x43')]=_[_0x5d44('0x44')](_0x528325[_0x5d44('0x40')],_0x528325['query']);_0x307cd7[_0x5d44('0x46')]=_[_0x5d44('0x44')](_0x528325[_0x5d44('0x40')],qs[_0x5d44('0x45')](_0x3d9f80['query'][_0x5d44('0x45')]));_0x307cd7[_0x5d44('0x46')]=_0x307cd7[_0x5d44('0x46')]['length']?_0x307cd7['attributes']:_0x528325['model'];if(_0x3d9f80[_0x5d44('0x41')][_0x5d44('0x52')]){_0x307cd7[_0x5d44('0x53')]=[{'all':!![]}];}_0x307cd7=_[_0x5d44('0x4f')]({},_0x307cd7,_0x3d9f80['options']);return db[_0x5d44('0x3e')][_0x5d44('0x57')](_0x307cd7)['then'](handleEntityNotFound(_0x22a0b6,null))[_0x5d44('0x23')](respondWithResult(_0x22a0b6,null))[_0x5d44('0x2c')](handleError(_0x22a0b6,null));};exports[_0x5d44('0x58')]=function(_0x31521f,_0x2d8db6){return db[_0x5d44('0x3e')][_0x5d44('0x58')](_0x31521f['body'],{})['then'](respondWithResult(_0x2d8db6,0xc9))[_0x5d44('0x2c')](handleError(_0x2d8db6,null));};exports[_0x5d44('0x37')]=function(_0x1f1c04,_0x47b558){if(_0x1f1c04[_0x5d44('0x59')]['id']){delete _0x1f1c04[_0x5d44('0x59')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x1f1c04[_0x5d44('0x56')]['id']}})[_0x5d44('0x23')](handleEntityNotFound(_0x47b558,null))[_0x5d44('0x23')](saveUpdates(_0x1f1c04[_0x5d44('0x59')],null))[_0x5d44('0x23')](respondWithResult(_0x47b558,null))[_0x5d44('0x2c')](handleError(_0x47b558,null));};exports[_0x5d44('0x38')]=function(_0x7a8853,_0x3cc20c){return db[_0x5d44('0x3e')][_0x5d44('0x57')]({'where':{'id':_0x7a8853[_0x5d44('0x56')]['id']}})[_0x5d44('0x23')](handleEntityNotFound(_0x3cc20c,null))[_0x5d44('0x23')](removeEntity(_0x3cc20c,null))['catch'](handleError(_0x3cc20c,null));};exports['describe']=function(_0x14342d,_0x38f62e){return db[_0x5d44('0x3e')][_0x5d44('0x5a')]()[_0x5d44('0x23')](respondWithResult(_0x38f62e,null))[_0x5d44('0x2c')](handleError(_0x38f62e,null));};var interaction_log=require(_0x5d44('0x5b'))(_0x5d44('0x5c'));exports[_0x5d44('0x5d')]=function(_0x2118c9,_0x2eada5,_0x2a45c2){var _0x368f6e={'agent':{},'channel':'chat'};if(_0x2118c9[_0x5d44('0x59')]['id']){delete _0x2118c9[_0x5d44('0x59')]['id'];}_0x2118c9['body']['read']=!![];_0x2118c9['body'][_0x5d44('0x5e')]=moment()[_0x5d44('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2118c9[_0x5d44('0x59')][_0x5d44('0x60')]=_0x2118c9[_0x5d44('0x59')][_0x5d44('0x60')]||_0x2118c9[_0x5d44('0x61')]['id'];_0x368f6e[_0x5d44('0x62')]['id']=_0x2118c9['body'][_0x5d44('0x60')];return db[_0x5d44('0x3e')][_0x5d44('0x57')]({'where':{'id':_0x2118c9[_0x5d44('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2eada5,null))[_0x5d44('0x23')](saveUpdates(_0x2118c9[_0x5d44('0x59')],null))['then'](function(_0x330707){if(_0x330707){_0x368f6e[_0x5d44('0x2a')]=_0x330707[_0x5d44('0x63')]({'plain':!![]});return db['ChatInteraction'][_0x5d44('0x57')]({'where':{'id':_0x330707['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2eada5,null))['then'](function(_0xf0ff92){if(_0xf0ff92){return _0xf0ff92[_0x5d44('0x37')]({'UserId':_0x2118c9[_0x5d44('0x59')][_0x5d44('0x60')],'read1stAt':_[_0x5d44('0x64')](_0xf0ff92[_0x5d44('0x65')])?moment()[_0x5d44('0x5f')](_0x5d44('0x66')):undefined});}return null;})[_0x5d44('0x23')](function(_0x182b86){if(_0x182b86){_0x368f6e[_0x5d44('0x67')]=_0x182b86['get']({'plain':!![]});interaction_log[_0x5d44('0x68')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2118c9['user']['id'],_0x2118c9['user'][_0x5d44('0x3a')],_0x2118c9['user'][_0x5d44('0x69')],_0x368f6e[_0x5d44('0x67')]['id'],_0x2118c9['body']?JSON[_0x5d44('0x6a')](_0x2118c9[_0x5d44('0x59')]):_0x5d44('0x6b'));return respondWithRpcPromise(_0x5d44('0x6c'),'acceptMessage',_0x368f6e);}return null;})[_0x5d44('0x23')](function(_0x4b330c){var _0x577354=_0x5d44('0x6d')+_0x4b330c[_0x5d44('0x2a')][_0x5d44('0x6e')];return db[_0x5d44('0x6f')][_0x5d44('0x41')](_0x577354,{'type':db[_0x5d44('0x70')][_0x5d44('0x71')][_0x5d44('0x72')],'raw':!![]})[_0x5d44('0x23')](function(_0x33bc92){return _0x33bc92;});})[_0x5d44('0x23')](function(_0x3e8702){if(_0x3e8702){_0x368f6e[_0x5d44('0x2a')][_0x5d44('0x73')]=_0x3e8702[0x0];if(!_0x2118c9['body'][_0x5d44('0x60')])return;return db[_0x5d44('0x74')]['find']({'where':{'id':_0x2118c9[_0x5d44('0x59')][_0x5d44('0x60')],'role':_0x5d44('0x62')},'attributes':['id',_0x5d44('0x3a'),'fullname',_0x5d44('0x75'),_0x5d44('0x76')],'raw':!![]});}return null;})['then'](function(_0x49d197){if(!_0x49d197)return null;_0x368f6e[_0x5d44('0x2a')][_0x5d44('0x62')]=_0x49d197;return _0x368f6e;})[_0x5d44('0x23')](function(_0x22e59b){if(_0x22e59b){if(_0x2118c9[_0x5d44('0x59')][_0x5d44('0x77')]){_0x368f6e[_0x5d44('0x2a')][_0x5d44('0x78')]=util[_0x5d44('0x5f')](_0x5d44('0x79'),_0x2118c9['user'][_0x5d44('0x3a')]);_0x368f6e[_0x5d44('0x2a')][_0x5d44('0x7a')]=_0x368f6e['channel'];_0x368f6e['message'][_0x5d44('0x7b')]=_0x368f6e[_0x5d44('0x7a')];_0x368f6e[_0x5d44('0x2a')][_0x5d44('0x7c')]=_0x5d44('0x5d');return respondWithRpcPromise(_0x5d44('0x7d'),'EventManager',{'event':_0x5d44('0x7e'),'message':_['merge'](_0x368f6e[_0x5d44('0x2a')],JSON[_0x5d44('0x7f')](_0x368f6e['interaction'][_0x5d44('0x80')]))},client9002)[_0x5d44('0x23')](function(){return _0x368f6e;});}return _0x368f6e;}return null;})[_0x5d44('0x23')](respondWithResult(_0x2eada5,null))[_0x5d44('0x2c')](handleError(_0x2eada5,null));};var interaction_log=require(_0x5d44('0x5b'))(_0x5d44('0x5c'));exports[_0x5d44('0x81')]=function(_0x5ae83d,_0x2e480f,_0xbb77da){var _0x41f348={'agent':{},'channel':'chat'};if(_0x5ae83d[_0x5d44('0x59')]['id']){delete _0x5ae83d[_0x5d44('0x59')]['id'];}_0x5ae83d[_0x5d44('0x59')][_0x5d44('0x60')]=_0x5ae83d['body'][_0x5d44('0x60')]||_0x5ae83d[_0x5d44('0x61')]['id'];_0x41f348[_0x5d44('0x62')]['id']=_0x5ae83d['body'][_0x5d44('0x60')];return db[_0x5d44('0x3e')][_0x5d44('0x57')]({'where':{'id':_0x5ae83d['params']['id'],'UserId':null}})[_0x5d44('0x23')](handleEntityNotFound(_0x2e480f,null))[_0x5d44('0x23')](function(_0x31effd){if(_0x31effd){_0x41f348[_0x5d44('0x2a')]=_0x31effd[_0x5d44('0x63')]({'plain':!![]});return db[_0x5d44('0x82')][_0x5d44('0x57')]({'where':{'id':_0x31effd[_0x5d44('0x83')]}});}return null;})[_0x5d44('0x23')](handleEntityNotFound(_0x2e480f,null))[_0x5d44('0x23')](function(_0x1a2ff1){if(_0x1a2ff1){_0x41f348[_0x5d44('0x67')]=_0x1a2ff1[_0x5d44('0x63')]({'plain':!![]});interaction_log['info'](_0x5d44('0x84'),_0x5ae83d['user']['id'],_0x5ae83d[_0x5d44('0x61')][_0x5d44('0x3a')],_0x5ae83d[_0x5d44('0x61')][_0x5d44('0x69')],_0x41f348[_0x5d44('0x67')]['id'],_0x5ae83d[_0x5d44('0x59')]?JSON[_0x5d44('0x6a')](_0x5ae83d['body']):_0x5d44('0x6b'));return respondWithRpcPromise(_0x5d44('0x85'),_0x5d44('0x86'),_0x41f348);}return null;})[_0x5d44('0x23')](function(_0x2980ef){var _0xa26308=_0x5d44('0x6d')+_0x2980ef[_0x5d44('0x2a')][_0x5d44('0x6e')];return db[_0x5d44('0x6f')][_0x5d44('0x41')](_0xa26308,{'type':db['Sequelize'][_0x5d44('0x71')][_0x5d44('0x72')],'raw':!![]})[_0x5d44('0x23')](function(_0x243174){return _0x243174;});})[_0x5d44('0x23')](function(_0x410883){if(_0x410883){_0x41f348[_0x5d44('0x2a')][_0x5d44('0x73')]=_0x410883[0x0];if(!_0x5ae83d[_0x5d44('0x59')][_0x5d44('0x60')])return;return db[_0x5d44('0x74')][_0x5d44('0x57')]({'where':{'id':_0x5ae83d['body'][_0x5d44('0x60')],'role':_0x5d44('0x62')},'attributes':['id',_0x5d44('0x3a'),_0x5d44('0x87'),_0x5d44('0x75'),_0x5d44('0x76')],'raw':!![]});}return null;})[_0x5d44('0x23')](function(_0x328310){if(!_0x328310)return null;_0x41f348[_0x5d44('0x2a')][_0x5d44('0x62')]=_0x328310;return _0x41f348;})['then'](function(_0x469207){if(_0x469207){_0x469207['message'][_0x5d44('0x78')]=util[_0x5d44('0x5f')](_0x5d44('0x79'),_0x5ae83d['user']['name']);_0x469207[_0x5d44('0x2a')][_0x5d44('0x7a')]=_0x41f348['channel'];_0x469207[_0x5d44('0x2a')]['motionChannel']=_0x41f348[_0x5d44('0x7a')];_0x469207['message'][_0x5d44('0x7c')]=_0x5d44('0x81');respondWithRpcPromise(_0x5d44('0x7d'),_0x5d44('0x7d'),{'event':_0x5d44('0x88'),'message':_[_0x5d44('0x4f')](_0x41f348[_0x5d44('0x2a')],JSON[_0x5d44('0x7f')](_0x41f348[_0x5d44('0x67')][_0x5d44('0x80')]))},client9002);return _0x41f348;}return null;})['then'](respondWithResult(_0x2e480f,null))[_0x5d44('0x2c')](handleError(_0x2e480f,null));}; \ No newline at end of file +var _0x00bf=['parse','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','http','client','then','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','options','include','ChatMessage','rows','params','length','includeAll','merge','find','create','body','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','interaction','get','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','channel','event','EventManager','formData','reject','RejectMessage','rejectMessage','interface','motionChannel','rejectmessage'];(function(_0x24dbd6,_0x554a8b){var _0x339c88=function(_0x49ef4c){while(--_0x49ef4c){_0x24dbd6['push'](_0x24dbd6['shift']());}};_0x339c88(++_0x554a8b);}(_0x00bf,0x7f));var _0xf00b=function(_0x33ae31,_0x25b4ac){_0x33ae31=_0x33ae31-0x0;var _0x43e626=_0x00bf[_0x33ae31];return _0x43e626;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf00b('0x0'));var zipdir=require(_0xf00b('0x1'));var jsonpatch=require(_0xf00b('0x2'));var rp=require(_0xf00b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf00b('0x4'));var util=require(_0xf00b('0x5'));var path=require(_0xf00b('0x6'));var sox=require(_0xf00b('0x7'));var csv=require(_0xf00b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf00b('0x9'));var _=require('lodash');var squel=require(_0xf00b('0xa'));var crypto=require('crypto');var jsforce=require(_0xf00b('0xb'));var deskjs=require(_0xf00b('0xc'));var toCsv=require(_0xf00b('0x8'));var querystring=require(_0xf00b('0xd'));var Papa=require(_0xf00b('0xe'));var Redis=require(_0xf00b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf00b('0x10'));var as=require(_0xf00b('0x11'));var hardwareService=require(_0xf00b('0x12'));var logger=require(_0xf00b('0x13'))(_0xf00b('0x14'));var utils=require('../../config/utils');var config=require(_0xf00b('0x15'));var licenseUtil=require(_0xf00b('0x16'));var db=require('../../mysqldb')['db'];config[_0xf00b('0x17')]=_[_0xf00b('0x18')](config[_0xf00b('0x17')],{'host':_0xf00b('0x19'),'port':0x18eb});var socket=require(_0xf00b('0x1a'))(new Redis(config[_0xf00b('0x17')]));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf00b('0x1b')]({'port':0x232c});var client9002=jayson[_0xf00b('0x1c')][_0xf00b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x342b29,_0x20967e,_0x54eb30,_0x4aa702){return new BPromise(function(_0x199a3c,_0xcb8943){var _0x3d9318=_0x4aa702||client;return _0x3d9318['request'](_0x342b29,_0x54eb30)[_0xf00b('0x1d')](function(_0x51b531){logger['info']('ChatMessage,\x20%s,\x20%s',_0x20967e,'request\x20sent');logger[_0xf00b('0x1e')](_0xf00b('0x1f'),_0x20967e,'request\x20sent',JSON[_0xf00b('0x20')](_0x51b531));if(_0x51b531[_0xf00b('0x21')]){if(_0x51b531['error'][_0xf00b('0x22')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x20967e,_0x51b531[_0xf00b('0x21')][_0xf00b('0x23')]);return _0xcb8943(_0x51b531[_0xf00b('0x21')][_0xf00b('0x23')]);}logger[_0xf00b('0x21')](_0xf00b('0x24'),_0x20967e,_0x51b531[_0xf00b('0x21')][_0xf00b('0x23')]);return _0x199a3c(_0x51b531[_0xf00b('0x21')][_0xf00b('0x23')]);}else{logger['info'](_0xf00b('0x24'),_0x20967e,_0xf00b('0x25'));_0x199a3c(_0x51b531[_0xf00b('0x26')][_0xf00b('0x23')]);}})[_0xf00b('0x27')](function(_0x5a628c){logger[_0xf00b('0x21')](_0xf00b('0x24'),_0x20967e,_0x5a628c);_0xcb8943(_0x5a628c);});});}function respondWithStatusCode(_0x15f195,_0x369e15){_0x369e15=_0x369e15||0xcc;return function(_0x40c7d6){if(_0x40c7d6){return _0x15f195[_0xf00b('0x28')](_0x369e15);}return _0x15f195['status'](_0x369e15)[_0xf00b('0x29')]();};}function respondWithResult(_0x2ae9e9,_0x37f0c8){_0x37f0c8=_0x37f0c8||0xc8;return function(_0x269cd2){if(_0x269cd2){return _0x2ae9e9[_0xf00b('0x2a')](_0x37f0c8)[_0xf00b('0x2b')](_0x269cd2);}};}function respondWithFilteredResult(_0x14a3a1,_0x563177){return function(_0x29566a){if(_0x29566a){var _0x3397e3=typeof _0x563177['offset']==='undefined'&&typeof _0x563177['limit']===_0xf00b('0x2c');var _0x2aa84e=_0x29566a[_0xf00b('0x2d')];var _0x2448cd=_0x3397e3?0x0:_0x563177['offset'];var _0x4cdc2e=_0x3397e3?_0x29566a[_0xf00b('0x2d')]:_0x563177[_0xf00b('0x2e')]+_0x563177[_0xf00b('0x2f')];var _0x4ebc0c;if(_0x4cdc2e>=_0x2aa84e){_0x4cdc2e=_0x2aa84e;_0x4ebc0c=0xc8;}else{_0x4ebc0c=0xce;}_0x14a3a1[_0xf00b('0x2a')](_0x4ebc0c);return _0x14a3a1['set'](_0xf00b('0x30'),_0x2448cd+'-'+_0x4cdc2e+'/'+_0x2aa84e)[_0xf00b('0x2b')](_0x29566a);}return null;};}function patchUpdates(_0x1bf479){return function(_0x2f485e){try{jsonpatch[_0xf00b('0x31')](_0x2f485e,_0x1bf479,!![]);}catch(_0x1987e7){return BPromise['reject'](_0x1987e7);}return _0x2f485e['save']();};}function saveUpdates(_0x50eed9,_0x3c0f6e){return function(_0x5462cd){if(_0x5462cd){return _0x5462cd[_0xf00b('0x32')](_0x50eed9)[_0xf00b('0x1d')](function(_0x52e86c){return _0x52e86c;});}return null;};}function removeEntity(_0x4115ce,_0x30425d){return function(_0x1ee0e3){if(_0x1ee0e3){return _0x1ee0e3[_0xf00b('0x33')]()[_0xf00b('0x1d')](function(){_0x4115ce['status'](0xcc)[_0xf00b('0x29')]();});}};}function handleEntityNotFound(_0x12dd2d,_0x1e5a42){return function(_0x1c6dff){if(!_0x1c6dff){_0x12dd2d[_0xf00b('0x28')](0x194);}return _0x1c6dff;};}function handleError(_0x23a142,_0x4e4545){_0x4e4545=_0x4e4545||0x1f4;return function(_0xd7a60e){logger['error'](_0xd7a60e[_0xf00b('0x34')]);if(_0xd7a60e[_0xf00b('0x35')]){delete _0xd7a60e[_0xf00b('0x35')];}_0x23a142[_0xf00b('0x2a')](_0x4e4545)['send'](_0xd7a60e);};}exports[_0xf00b('0x36')]=function(_0x2d7a95,_0x247dc0){var _0x91fb8e={},_0x414cec={},_0x233989={'count':0x0,'rows':[]};var _0x491348=_[_0xf00b('0x37')](db['ChatMessage'][_0xf00b('0x38')],function(_0x4df337){return{'name':_0x4df337[_0xf00b('0x39')],'type':_0x4df337[_0xf00b('0x3a')][_0xf00b('0x3b')]};});_0x414cec[_0xf00b('0x3c')]=_[_0xf00b('0x37')](_0x491348,_0xf00b('0x35'));_0x414cec[_0xf00b('0x3d')]=_[_0xf00b('0x3e')](_0x2d7a95['query']);_0x414cec['filters']=_[_0xf00b('0x3f')](_0x414cec['model'],_0x414cec[_0xf00b('0x3d')]);_0x91fb8e['attributes']=_[_0xf00b('0x3f')](_0x414cec[_0xf00b('0x3c')],qs[_0xf00b('0x40')](_0x2d7a95[_0xf00b('0x3d')][_0xf00b('0x40')]));_0x91fb8e[_0xf00b('0x41')]=_0x91fb8e['attributes']['length']?_0x91fb8e[_0xf00b('0x41')]:_0x414cec['model'];if(!_0x2d7a95['query'][_0xf00b('0x42')](_0xf00b('0x43'))){_0x91fb8e[_0xf00b('0x2f')]=qs[_0xf00b('0x2f')](_0x2d7a95[_0xf00b('0x3d')]['limit']);_0x91fb8e[_0xf00b('0x2e')]=qs[_0xf00b('0x2e')](_0x2d7a95[_0xf00b('0x3d')]['offset']);}_0x91fb8e[_0xf00b('0x44')]=qs[_0xf00b('0x45')](_0x2d7a95[_0xf00b('0x3d')][_0xf00b('0x45')]);_0x91fb8e[_0xf00b('0x46')]=qs[_0xf00b('0x47')](_['pick'](_0x2d7a95[_0xf00b('0x3d')],_0x414cec[_0xf00b('0x47')]),_0x491348);if(_0x2d7a95[_0xf00b('0x3d')]['filter']){_0x91fb8e[_0xf00b('0x46')]=_['merge'](_0x91fb8e[_0xf00b('0x46')],{'$or':_[_0xf00b('0x37')](_0x491348,function(_0x215f62){if(_0x215f62['type']!==_0xf00b('0x48')){var _0x15ab85={};_0x15ab85[_0x215f62[_0xf00b('0x35')]]={'$like':'%'+_0x2d7a95[_0xf00b('0x3d')]['filter']+'%'};return _0x15ab85;}})});}_0x91fb8e=_['merge']({},_0x91fb8e,_0x2d7a95[_0xf00b('0x49')]);var _0x361dfe={'where':_0x91fb8e[_0xf00b('0x46')]};return db['ChatMessage'][_0xf00b('0x2d')](_0x361dfe)[_0xf00b('0x1d')](function(_0x84a05e){_0x233989['count']=_0x84a05e;if(_0x2d7a95['query']['includeAll']){_0x91fb8e[_0xf00b('0x4a')]=[{'all':!![]}];}return db[_0xf00b('0x4b')]['findAll'](_0x91fb8e);})[_0xf00b('0x1d')](function(_0x5493c6){_0x233989[_0xf00b('0x4c')]=_0x5493c6;return _0x233989;})[_0xf00b('0x1d')](respondWithFilteredResult(_0x247dc0,_0x91fb8e))[_0xf00b('0x27')](handleError(_0x247dc0,null));};exports['show']=function(_0x1a3e05,_0x49d210){var _0x356eb7={'raw':!![],'where':{'id':_0x1a3e05[_0xf00b('0x4d')]['id']}},_0x1edae4={};_0x1edae4[_0xf00b('0x3c')]=_[_0xf00b('0x3e')](db[_0xf00b('0x4b')][_0xf00b('0x38')]);_0x1edae4[_0xf00b('0x3d')]=_['keys'](_0x1a3e05['query']);_0x1edae4['filters']=_[_0xf00b('0x3f')](_0x1edae4[_0xf00b('0x3c')],_0x1edae4['query']);_0x356eb7[_0xf00b('0x41')]=_[_0xf00b('0x3f')](_0x1edae4[_0xf00b('0x3c')],qs[_0xf00b('0x40')](_0x1a3e05[_0xf00b('0x3d')][_0xf00b('0x40')]));_0x356eb7[_0xf00b('0x41')]=_0x356eb7['attributes'][_0xf00b('0x4e')]?_0x356eb7[_0xf00b('0x41')]:_0x1edae4['model'];if(_0x1a3e05[_0xf00b('0x3d')][_0xf00b('0x4f')]){_0x356eb7['include']=[{'all':!![]}];}_0x356eb7=_[_0xf00b('0x50')]({},_0x356eb7,_0x1a3e05[_0xf00b('0x49')]);return db[_0xf00b('0x4b')][_0xf00b('0x51')](_0x356eb7)[_0xf00b('0x1d')](handleEntityNotFound(_0x49d210,null))[_0xf00b('0x1d')](respondWithResult(_0x49d210,null))['catch'](handleError(_0x49d210,null));};exports[_0xf00b('0x52')]=function(_0x4a4995,_0x434ccd){return db[_0xf00b('0x4b')]['create'](_0x4a4995[_0xf00b('0x53')],{})[_0xf00b('0x1d')](respondWithResult(_0x434ccd,0xc9))[_0xf00b('0x27')](handleError(_0x434ccd,null));};exports[_0xf00b('0x32')]=function(_0x575249,_0x2469cc){if(_0x575249[_0xf00b('0x53')]['id']){delete _0x575249[_0xf00b('0x53')]['id'];}return db['ChatMessage'][_0xf00b('0x51')]({'where':{'id':_0x575249[_0xf00b('0x4d')]['id']}})[_0xf00b('0x1d')](handleEntityNotFound(_0x2469cc,null))[_0xf00b('0x1d')](saveUpdates(_0x575249[_0xf00b('0x53')],null))[_0xf00b('0x1d')](respondWithResult(_0x2469cc,null))[_0xf00b('0x27')](handleError(_0x2469cc,null));};exports[_0xf00b('0x33')]=function(_0x31962b,_0x22f1f6){return db[_0xf00b('0x4b')][_0xf00b('0x51')]({'where':{'id':_0x31962b['params']['id']}})['then'](handleEntityNotFound(_0x22f1f6,null))[_0xf00b('0x1d')](removeEntity(_0x22f1f6,null))['catch'](handleError(_0x22f1f6,null));};exports[_0xf00b('0x54')]=function(_0x203b2a,_0x2e1cd2){return db['ChatMessage'][_0xf00b('0x54')]()[_0xf00b('0x1d')](respondWithResult(_0x2e1cd2,null))['catch'](handleError(_0x2e1cd2,null));};var interaction_log=require(_0xf00b('0x13'))('chat-interactions');exports[_0xf00b('0x55')]=function(_0x3c113e,_0x4cfff8,_0x51f4c6){var _0x10b215={'agent':{},'channel':_0xf00b('0x56')};if(_0x3c113e[_0xf00b('0x53')]['id']){delete _0x3c113e[_0xf00b('0x53')]['id'];}_0x3c113e['body'][_0xf00b('0x57')]=!![];_0x3c113e[_0xf00b('0x53')][_0xf00b('0x58')]=moment()[_0xf00b('0x59')](_0xf00b('0x5a'));_0x3c113e['body'][_0xf00b('0x5b')]=_0x3c113e[_0xf00b('0x53')]['UserId']||_0x3c113e[_0xf00b('0x5c')]['id'];_0x10b215[_0xf00b('0x5d')]['id']=_0x3c113e[_0xf00b('0x53')]['UserId'];return db['ChatMessage'][_0xf00b('0x51')]({'where':{'id':_0x3c113e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4cfff8,null))['then'](saveUpdates(_0x3c113e['body'],null))[_0xf00b('0x1d')](function(_0x3e5188){if(_0x3e5188){_0x10b215[_0xf00b('0x23')]=_0x3e5188['get']({'plain':!![]});return db[_0xf00b('0x5e')]['find']({'where':{'id':_0x3e5188[_0xf00b('0x5f')]}});}return null;})[_0xf00b('0x1d')](handleEntityNotFound(_0x4cfff8,null))[_0xf00b('0x1d')](function(_0x53d60c){if(_0x53d60c){return _0x53d60c[_0xf00b('0x32')]({'UserId':_0x3c113e[_0xf00b('0x53')][_0xf00b('0x5b')],'read1stAt':_[_0xf00b('0x60')](_0x53d60c['read1stAt'])?moment()[_0xf00b('0x59')](_0xf00b('0x5a')):undefined});}return null;})[_0xf00b('0x1d')](function(_0x3d89bc){if(_0x3d89bc){_0x10b215[_0xf00b('0x61')]=_0x3d89bc[_0xf00b('0x62')]({'plain':!![]});interaction_log[_0xf00b('0x63')](_0xf00b('0x64'),_0x3c113e[_0xf00b('0x5c')]['id'],_0x3c113e[_0xf00b('0x5c')]['name'],_0x3c113e[_0xf00b('0x5c')][_0xf00b('0x65')],_0x10b215[_0xf00b('0x61')]['id'],_0x3c113e[_0xf00b('0x53')]?JSON['stringify'](_0x3c113e[_0xf00b('0x53')]):_0xf00b('0x66'));return respondWithRpcPromise(_0xf00b('0x67'),'acceptMessage',_0x10b215);}return null;})[_0xf00b('0x1d')](function(_0x447093){var _0xd21ce5=_0xf00b('0x68')+_0x447093[_0xf00b('0x23')][_0xf00b('0x69')];return db[_0xf00b('0x6a')][_0xf00b('0x3d')](_0xd21ce5,{'type':db[_0xf00b('0x6b')][_0xf00b('0x6c')][_0xf00b('0x6d')],'raw':!![]})[_0xf00b('0x1d')](function(_0x3d013d){return _0x3d013d;});})[_0xf00b('0x1d')](function(_0x2930ec){if(_0x2930ec){_0x10b215[_0xf00b('0x23')][_0xf00b('0x6e')]=_0x2930ec[0x0];if(!_0x3c113e['body'][_0xf00b('0x5b')])return;return db[_0xf00b('0x6f')]['find']({'where':{'id':_0x3c113e[_0xf00b('0x53')][_0xf00b('0x5b')],'role':_0xf00b('0x5d')},'attributes':['id',_0xf00b('0x35'),_0xf00b('0x70'),'email',_0xf00b('0x71')],'raw':!![]});}return null;})[_0xf00b('0x1d')](function(_0x4fd74d){if(!_0x4fd74d)return null;_0x10b215[_0xf00b('0x23')][_0xf00b('0x5d')]=_0x4fd74d;return _0x10b215;})[_0xf00b('0x1d')](function(_0x7ee2a5){if(_0x7ee2a5){if(_0x3c113e[_0xf00b('0x53')][_0xf00b('0x72')]){_0x10b215[_0xf00b('0x23')]['interface']=util[_0xf00b('0x59')]('SIP/%s',_0x3c113e[_0xf00b('0x5c')]['name']);_0x10b215['message'][_0xf00b('0x73')]=_0x10b215[_0xf00b('0x73')];_0x10b215[_0xf00b('0x23')]['motionChannel']=_0x10b215[_0xf00b('0x73')];_0x10b215[_0xf00b('0x23')][_0xf00b('0x74')]=_0xf00b('0x55');return respondWithRpcPromise(_0xf00b('0x75'),'EventManager',{'event':'acceptmessage','message':_['merge'](_0x10b215[_0xf00b('0x23')],JSON['parse'](_0x10b215[_0xf00b('0x61')][_0xf00b('0x76')]))},client9002)[_0xf00b('0x1d')](function(){return _0x10b215;});}return _0x10b215;}return null;})[_0xf00b('0x1d')](respondWithResult(_0x4cfff8,null))[_0xf00b('0x27')](handleError(_0x4cfff8,null));};var interaction_log=require(_0xf00b('0x13'))('chat-interactions');exports[_0xf00b('0x77')]=function(_0x4ba846,_0xe6285a,_0x2ffc20){var _0x4a789f={'agent':{},'channel':_0xf00b('0x56')};if(_0x4ba846[_0xf00b('0x53')]['id']){delete _0x4ba846[_0xf00b('0x53')]['id'];}_0x4ba846['body'][_0xf00b('0x5b')]=_0x4ba846[_0xf00b('0x53')]['UserId']||_0x4ba846[_0xf00b('0x5c')]['id'];_0x4a789f[_0xf00b('0x5d')]['id']=_0x4ba846[_0xf00b('0x53')]['UserId'];return db['ChatMessage'][_0xf00b('0x51')]({'where':{'id':_0x4ba846['params']['id'],'UserId':null}})[_0xf00b('0x1d')](handleEntityNotFound(_0xe6285a,null))[_0xf00b('0x1d')](function(_0x4f519c){if(_0x4f519c){_0x4a789f['message']=_0x4f519c['get']({'plain':!![]});return db[_0xf00b('0x5e')][_0xf00b('0x51')]({'where':{'id':_0x4f519c[_0xf00b('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0xe6285a,null))['then'](function(_0x2d2724){if(_0x2d2724){_0x4a789f[_0xf00b('0x61')]=_0x2d2724[_0xf00b('0x62')]({'plain':!![]});interaction_log[_0xf00b('0x63')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ba846[_0xf00b('0x5c')]['id'],_0x4ba846['user'][_0xf00b('0x35')],_0x4ba846['user'][_0xf00b('0x65')],_0x4a789f[_0xf00b('0x61')]['id'],_0x4ba846[_0xf00b('0x53')]?JSON[_0xf00b('0x20')](_0x4ba846['body']):'null');return respondWithRpcPromise(_0xf00b('0x78'),_0xf00b('0x79'),_0x4a789f);}return null;})[_0xf00b('0x1d')](function(_0x2b4deb){var _0x17201b=_0xf00b('0x68')+_0x2b4deb[_0xf00b('0x23')][_0xf00b('0x69')];return db[_0xf00b('0x6a')]['query'](_0x17201b,{'type':db[_0xf00b('0x6b')][_0xf00b('0x6c')][_0xf00b('0x6d')],'raw':!![]})[_0xf00b('0x1d')](function(_0x294f46){return _0x294f46;});})[_0xf00b('0x1d')](function(_0x283f7b){if(_0x283f7b){_0x4a789f[_0xf00b('0x23')]['contact']=_0x283f7b[0x0];if(!_0x4ba846[_0xf00b('0x53')]['UserId'])return;return db[_0xf00b('0x6f')][_0xf00b('0x51')]({'where':{'id':_0x4ba846[_0xf00b('0x53')][_0xf00b('0x5b')],'role':_0xf00b('0x5d')},'attributes':['id',_0xf00b('0x35'),_0xf00b('0x70'),'email',_0xf00b('0x71')],'raw':!![]});}return null;})[_0xf00b('0x1d')](function(_0xc98d69){if(!_0xc98d69)return null;_0x4a789f[_0xf00b('0x23')][_0xf00b('0x5d')]=_0xc98d69;return _0x4a789f;})[_0xf00b('0x1d')](function(_0x35d514){if(_0x35d514){_0x35d514['message'][_0xf00b('0x7a')]=util[_0xf00b('0x59')]('SIP/%s',_0x4ba846[_0xf00b('0x5c')][_0xf00b('0x35')]);_0x35d514[_0xf00b('0x23')][_0xf00b('0x73')]=_0x4a789f[_0xf00b('0x73')];_0x35d514[_0xf00b('0x23')][_0xf00b('0x7b')]=_0x4a789f['channel'];_0x35d514['message'][_0xf00b('0x74')]=_0xf00b('0x77');respondWithRpcPromise(_0xf00b('0x75'),'EventManager',{'event':_0xf00b('0x7c'),'message':_[_0xf00b('0x50')](_0x4a789f['message'],JSON[_0xf00b('0x7d')](_0x4a789f[_0xf00b('0x61')]['formData']))},client9002);return _0x4a789f;}return null;})['then'](respondWithResult(_0xe6285a,null))['catch'](handleError(_0xe6285a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5aa34cd..19c0a8e 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 _0xee9f=['remove','emit','hasOwnProperty','hook','ChatMessage','setMaxListeners','save'];(function(_0x3480ae,_0x516561){var _0x48aece=function(_0x3301e3){while(--_0x3301e3){_0x3480ae['push'](_0x3480ae['shift']());}};_0x48aece(++_0x516561);}(_0xee9f,0x89));var _0xfee9=function(_0xb21215,_0x522a21){_0xb21215=_0xb21215-0x0;var _0x4a3975=_0xee9f[_0xb21215];return _0x4a3975;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xfee9('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfee9('0x1')](0x0);var events={'afterCreate':_0xfee9('0x2'),'afterUpdate':'update','afterDestroy':_0xfee9('0x3')};function emitEvent(_0x5d9c4c){return function(_0x228435,_0x3efb6b,_0x36dcf9){ChatMessageEvents[_0xfee9('0x4')](_0x5d9c4c+':'+_0x228435['id'],_0x228435);ChatMessageEvents[_0xfee9('0x4')](_0x5d9c4c,_0x228435);_0x36dcf9(null);};}for(var e in events){if(events[_0xfee9('0x5')](e)){var event=events[e];ChatMessage[_0xfee9('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x84bc=['emit','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update'];(function(_0x3c5c8d,_0x4bad74){var _0x4cafe6=function(_0x1a98bb){while(--_0x1a98bb){_0x3c5c8d['push'](_0x3c5c8d['shift']());}};_0x4cafe6(++_0x4bad74);}(_0x84bc,0x1e3));var _0xc84b=function(_0x4564b1,_0x17a1dc){_0x4564b1=_0x4564b1-0x0;var _0x1aecfe=_0x84bc[_0x4564b1];return _0x1aecfe;};'use strict';var EventEmitter=require(_0xc84b('0x0'));var ChatMessage=require(_0xc84b('0x1'))['db'][_0xc84b('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc84b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc84b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4f8c95){return function(_0xd7888f,_0x2c48ad,_0x1f7e2f){ChatMessageEvents[_0xc84b('0x5')](_0x4f8c95+':'+_0xd7888f['id'],_0xd7888f);ChatMessageEvents[_0xc84b('0x5')](_0x4f8c95,_0xd7888f);_0x1f7e2f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xc84b('0x6')](e,emitEvent(event));}}module[_0xc84b('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 4eb0431..de01bff 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 _0x5733=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','findOne','then','createdAt','catch','error'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5733,0x1b2));var _0x3573=function(_0x381e0d,_0x637f4d){_0x381e0d=_0x381e0d-0x0;var _0x3d9243=_0x5733[_0x381e0d];return _0x3d9243;};'use strict';var _=require(_0x3573('0x0'));var util=require(_0x3573('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3573('0x2'));var BPromise=require(_0x3573('0x3'));var rp=require(_0x3573('0x4'));var fs=require('fs');var path=require(_0x3573('0x5'));var rimraf=require('rimraf');var config=require(_0x3573('0x6'));var attributes=require(_0x3573('0x7'));module[_0x3573('0x8')]=function(_0x13d81b,_0x1795f8){return _0x13d81b['define'](_0x3573('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x3573('0xa'),'fields':[_0x3573('0xb')],'type':_0x3573('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a0d31,_0x36394f,_0x8fd048){var _0x5d31f5=_0x13d81b[_0x3573('0xd')];var _0x523b2f=_0x1a0d31[_0x3573('0xe')]({'plain':!![]});if(_0x523b2f[_0x3573('0xf')][_0x3573('0x10')]()==='in'||_0x523b2f['direction'][_0x3573('0x10')]()===_0x3573('0x11')&&!_0x523b2f['secret']&&!_[_0x3573('0x12')](_0x523b2f[_0x3573('0x13')])){_0x5d31f5['ChatInteraction'][_0x3573('0x14')]({'where':{'id':_0x523b2f['ChatInteractionId']}})[_0x3573('0x15')](function(_0x1950cd){if(_0x1950cd){_0x1950cd['update']({'lastMsgAt':_0x523b2f[_0x3573('0x16')],'lastMsgDirection':_0x523b2f[_0x3573('0xf')][_0x3573('0x10')]()});}})[_0x3573('0x17')](function(_0x53b75b){console[_0x3573('0x18')](_0x53b75b);});}_0x8fd048();}},'charset':_0x3573('0x19'),'collate':_0x3573('0x1a')});}; \ No newline at end of file +var _0x4b84=['lodash','util','moment','path','rimraf','../../config/environment','ChatMessage','fti_chat_messages','models','get','direction','toLowerCase','secret','isNil','ChatInteraction','ChatInteractionId','then','update','catch','error'];(function(_0x56062e,_0x171446){var _0x34c9a6=function(_0x5c94f1){while(--_0x5c94f1){_0x56062e['push'](_0x56062e['shift']());}};_0x34c9a6(++_0x171446);}(_0x4b84,0x1cc));var _0x44b8=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x4b84[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x44b8('0x7'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41d515,_0x42319d,_0x30ebc3){var _0x48a371=_0x55f25d[_0x44b8('0x8')];var _0x2cc74b=_0x41d515[_0x44b8('0x9')]({'plain':!![]});if(_0x2cc74b[_0x44b8('0xa')][_0x44b8('0xb')]()==='in'||_0x2cc74b[_0x44b8('0xa')][_0x44b8('0xb')]()==='out'&&!_0x2cc74b[_0x44b8('0xc')]&&!_[_0x44b8('0xd')](_0x2cc74b['UserId'])){_0x48a371[_0x44b8('0xe')]['findOne']({'where':{'id':_0x2cc74b[_0x44b8('0xf')]}})[_0x44b8('0x10')](function(_0x4df670){if(_0x4df670){_0x4df670[_0x44b8('0x11')]({'lastMsgAt':_0x2cc74b['createdAt'],'lastMsgDirection':_0x2cc74b['direction'][_0x44b8('0xb')]()});}})[_0x44b8('0x12')](function(_0x1722da){console[_0x44b8('0x13')](_0x1722da);});}_0x30ebc3();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 847e3d9..a03aae7 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 _0xa739=['ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatMessage,\x20%s,\x20%s','result','catch','create','body','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','debug'];(function(_0x465aea,_0x2b1836){var _0x46150b=function(_0x1804a4){while(--_0x1804a4){_0x465aea['push'](_0x465aea['shift']());}};_0x46150b(++_0x2b1836);}(_0xa739,0x72));var _0x9a73=function(_0x5dbe5e,_0x1cedac){_0x5dbe5e=_0x5dbe5e-0x0;var _0x59e45f=_0xa739[_0x5dbe5e];return _0x59e45f;};'use strict';var _=require(_0x9a73('0x0'));var util=require(_0x9a73('0x1'));var moment=require(_0x9a73('0x2'));var BPromise=require(_0x9a73('0x3'));var rs=require(_0x9a73('0x4'));var fs=require('fs');var Redis=require(_0x9a73('0x5'));var db=require(_0x9a73('0x6'))['db'];var utils=require(_0x9a73('0x7'));var logger=require('../../config/logger')(_0x9a73('0x8'));var config=require(_0x9a73('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9a73('0xa')][_0x9a73('0xb')]({'port':0x232a});config[_0x9a73('0xc')]=_[_0x9a73('0xd')](config[_0x9a73('0xc')],{'host':_0x9a73('0xe'),'port':0x18eb});var socket=require(_0x9a73('0xf'))(new Redis(config['redis']));require(_0x9a73('0x10'))[_0x9a73('0x11')](socket);function respondWithRpcPromise(_0xe2e966,_0x3bf5d3,_0x41bab4){return new BPromise(function(_0x296510,_0x5e7de2){return client[_0x9a73('0x12')](_0xe2e966,_0x41bab4)[_0x9a73('0x13')](function(_0x1bb09e){logger[_0x9a73('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3bf5d3,'request\x20sent');logger[_0x9a73('0x15')](_0x9a73('0x16'),_0x3bf5d3,_0x9a73('0x17'),JSON[_0x9a73('0x18')](_0x1bb09e));if(_0x1bb09e['error']){if(_0x1bb09e[_0x9a73('0x19')]['code']===0x1f4){logger[_0x9a73('0x19')]('ChatMessage,\x20%s,\x20%s',_0x3bf5d3,_0x1bb09e['error'][_0x9a73('0x1a')]);return _0x5e7de2(_0x1bb09e[_0x9a73('0x19')][_0x9a73('0x1a')]);}logger[_0x9a73('0x19')](_0x9a73('0x1b'),_0x3bf5d3,_0x1bb09e['error']['message']);return _0x296510(_0x1bb09e[_0x9a73('0x19')][_0x9a73('0x1a')]);}else{logger[_0x9a73('0x14')](_0x9a73('0x1b'),_0x3bf5d3,_0x9a73('0x17'));_0x296510(_0x1bb09e[_0x9a73('0x1c')][_0x9a73('0x1a')]);}})[_0x9a73('0x1d')](function(_0x868b27){logger['error'](_0x9a73('0x1b'),_0x3bf5d3,_0x868b27);_0x5e7de2(_0x868b27);});});}exports['CreateChatMessage']=function(_0x1f1fb7){var _0x1c352e=this;return new Promise(function(_0x5e9a91,_0x40905e){return db['ChatMessage'][_0x9a73('0x1e')](_0x1f1fb7[_0x9a73('0x1f')],{'raw':_0x1f1fb7['options']?_0x1f1fb7['options'][_0x9a73('0x20')]===undefined?!![]:![]:!![]})[_0x9a73('0x13')](function(_0x276d35){logger[_0x9a73('0x14')](_0x9a73('0x21'),_0x1f1fb7);logger['debug'](_0x9a73('0x21'),_0x1f1fb7,JSON[_0x9a73('0x18')](_0x276d35));_0x5e9a91(_0x276d35);})['catch'](function(_0x45ae8d){logger[_0x9a73('0x19')]('CreateChatMessage',_0x45ae8d['message'],_0x1f1fb7);_0x40905e(_0x1c352e[_0x9a73('0x19')](0x1f4,_0x45ae8d[_0x9a73('0x1a')]));});});}; \ No newline at end of file +var _0x4e50=['defaults','socket.io-emitter','./chatMessage.socket','register','request','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','catch','ChatMessage','create','body','options','raw','then','CreateChatMessage','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x2ffb90,_0x167dba){var _0x4f17a0=function(_0x1a9504){while(--_0x1a9504){_0x2ffb90['push'](_0x2ffb90['shift']());}};_0x4f17a0(++_0x167dba);}(_0x4e50,0xdc));var _0x04e5=function(_0x413066,_0x437e37){_0x413066=_0x413066-0x0;var _0x22796c=_0x4e50[_0x413066];return _0x22796c;};'use strict';var _=require(_0x04e5('0x0'));var util=require(_0x04e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x04e5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04e5('0x3'))['db'];var utils=require(_0x04e5('0x4'));var logger=require(_0x04e5('0x5'))(_0x04e5('0x6'));var config=require(_0x04e5('0x7'));var jayson=require(_0x04e5('0x8'));var client=jayson['client'][_0x04e5('0x9')]({'port':0x232a});config[_0x04e5('0xa')]=_[_0x04e5('0xb')](config[_0x04e5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x04e5('0xc'))(new Redis(config[_0x04e5('0xa')]));require(_0x04e5('0xd'))[_0x04e5('0xe')](socket);function respondWithRpcPromise(_0x5a0008,_0x2b83b0,_0x58a02){return new BPromise(function(_0x224e8c,_0x5d1c07){return client[_0x04e5('0xf')](_0x5a0008,_0x58a02)['then'](function(_0x1c13ed){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2b83b0,_0x04e5('0x10'));logger[_0x04e5('0x11')](_0x04e5('0x12'),_0x2b83b0,'request\x20sent',JSON[_0x04e5('0x13')](_0x1c13ed));if(_0x1c13ed['error']){if(_0x1c13ed[_0x04e5('0x14')][_0x04e5('0x15')]===0x1f4){logger[_0x04e5('0x14')](_0x04e5('0x16'),_0x2b83b0,_0x1c13ed['error'][_0x04e5('0x17')]);return _0x5d1c07(_0x1c13ed['error'][_0x04e5('0x17')]);}logger['error'](_0x04e5('0x16'),_0x2b83b0,_0x1c13ed[_0x04e5('0x14')][_0x04e5('0x17')]);return _0x224e8c(_0x1c13ed['error'][_0x04e5('0x17')]);}else{logger[_0x04e5('0x18')]('ChatMessage,\x20%s,\x20%s',_0x2b83b0,'request\x20sent');_0x224e8c(_0x1c13ed['result'][_0x04e5('0x17')]);}})[_0x04e5('0x19')](function(_0x56e206){logger[_0x04e5('0x14')](_0x04e5('0x16'),_0x2b83b0,_0x56e206);_0x5d1c07(_0x56e206);});});}exports['CreateChatMessage']=function(_0x12ee0e){var _0x363056=this;return new Promise(function(_0x561530,_0x2e3a63){return db[_0x04e5('0x1a')][_0x04e5('0x1b')](_0x12ee0e[_0x04e5('0x1c')],{'raw':_0x12ee0e[_0x04e5('0x1d')]?_0x12ee0e[_0x04e5('0x1d')][_0x04e5('0x1e')]===undefined?!![]:![]:!![]})[_0x04e5('0x1f')](function(_0xd8630c){logger[_0x04e5('0x18')](_0x04e5('0x20'),_0x12ee0e);logger[_0x04e5('0x11')](_0x04e5('0x20'),_0x12ee0e,JSON[_0x04e5('0x13')](_0xd8630c));_0x561530(_0xd8630c);})[_0x04e5('0x19')](function(_0x1a04a2){logger['error'](_0x04e5('0x20'),_0x1a04a2[_0x04e5('0x17')],_0x12ee0e);_0x2e3a63(_0x363056['error'](0x1f4,_0x1a04a2[_0x04e5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8c3422c..7d55931 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 _0x9c5a=['chatMessage:','./chatMessage.events','save','update','register'];(function(_0x23e8d6,_0x535283){var _0x55f929=function(_0x4370c7){while(--_0x4370c7){_0x23e8d6['push'](_0x23e8d6['shift']());}};_0x55f929(++_0x535283);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x29bcb1,_0x456569){_0x29bcb1=_0x29bcb1-0x0;var _0x3b6f35=_0x9c5a[_0x29bcb1];return _0x3b6f35;};'use strict';var ChatMessageEvents=require(_0xa9c5('0x0'));var events=[_0xa9c5('0x1'),'remove',_0xa9c5('0x2')];function createListener(_0x1cd14d,_0x1d0ee9){return function(_0x32e75a){_0x1d0ee9['emit'](_0x1cd14d,_0x32e75a);};}function removeListener(_0x2acfaf,_0x3051b1){return function(){ChatMessageEvents['removeListener'](_0x2acfaf,_0x3051b1);};}exports[_0xa9c5('0x3')]=function(_0x4d9c7a){for(var _0x394d84=0x0,_0x3df556=events['length'];_0x394d84<_0x3df556;_0x394d84++){var _0x4b6db6=events[_0x394d84];var _0x3d6b50=createListener(_0xa9c5('0x4')+_0x4b6db6,_0x4d9c7a);ChatMessageEvents['on'](_0x4b6db6,_0x3d6b50);}}; \ No newline at end of file +var _0x19da=['update','register','length','save'];(function(_0xace8d3,_0x22feae){var _0x40fbce=function(_0x3a2507){while(--_0x3a2507){_0xace8d3['push'](_0xace8d3['shift']());}};_0x40fbce(++_0x22feae);}(_0x19da,0x9f));var _0xa19d=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x19da[_0x1d87fc];return _0x492b56;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa19d('0x0'),'remove',_0xa19d('0x1')];function createListener(_0x5ba569,_0x3a48f4){return function(_0x17f1c6){_0x3a48f4['emit'](_0x5ba569,_0x17f1c6);};}function removeListener(_0x179db7,_0x28ec9a){return function(){ChatMessageEvents['removeListener'](_0x179db7,_0x28ec9a);};}exports[_0xa19d('0x2')]=function(_0x330adb){for(var _0x1f6e10=0x0,_0x14dc68=events[_0xa19d('0x3')];_0x1f6e10<_0x14dc68;_0x1f6e10++){var _0x4b4627=events[_0x1f6e10];var _0x197c4e=createListener('chatMessage:'+_0x4b4627,_0x330adb);ChatMessageEvents['on'](_0x4b4627,_0x197c4e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ef52f21..438fa90 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 _0x55b9=['/:id','show','post','tracked','create','put','update','/:id/accept','reject','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x55b9,0x1ee));var _0x955b=function(_0x2724c2,_0x138a77){_0x2724c2=_0x2724c2-0x0;var _0x5d1698=_0x55b9[_0x2724c2];return _0x5d1698;};'use strict';var multer=require(_0x955b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x955b('0x1'));var express=require(_0x955b('0x2'));var router=express[_0x955b('0x3')]();var fs_extra=require(_0x955b('0x4'));var auth=require(_0x955b('0x5'));var interaction=require(_0x955b('0x6'));var config=require('../../config/environment');var controller=require(_0x955b('0x7'));router['get']('/',auth[_0x955b('0x8')](),controller[_0x955b('0x9')]);router[_0x955b('0xa')](_0x955b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x955b('0xa')](_0x955b('0xc'),auth[_0x955b('0x8')](),controller[_0x955b('0xd')]);router[_0x955b('0xe')]('/',auth['isAuthenticated'](),interaction[_0x955b('0xf')]('chat','chatmessage:create'),controller[_0x955b('0x10')]);router[_0x955b('0x11')](_0x955b('0xc'),controller[_0x955b('0x12')]);router[_0x955b('0x11')](_0x955b('0x13'),auth[_0x955b('0x8')](),controller['accept']);router[_0x955b('0x11')]('/:id/reject',auth[_0x955b('0x8')](),controller[_0x955b('0x14')]);router[_0x955b('0x15')]('/:id',auth[_0x955b('0x8')](),controller[_0x955b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6128=['show','post','tracked','chat','put','update','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x333ce0,_0x573ff3){var _0x24f885=function(_0x5af352){while(--_0x5af352){_0x333ce0['push'](_0x333ce0['shift']());}};_0x24f885(++_0x573ff3);}(_0x6128,0x136));var _0x8612=function(_0x2cfbdd,_0xa84a2a){_0x2cfbdd=_0x2cfbdd-0x0;var _0x218576=_0x6128[_0x2cfbdd];return _0x218576;};'use strict';var multer=require(_0x8612('0x0'));var util=require('util');var path=require(_0x8612('0x1'));var timeout=require(_0x8612('0x2'));var express=require(_0x8612('0x3'));var router=express[_0x8612('0x4')]();var fs_extra=require(_0x8612('0x5'));var auth=require(_0x8612('0x6'));var interaction=require(_0x8612('0x7'));var config=require(_0x8612('0x8'));var controller=require(_0x8612('0x9'));router[_0x8612('0xa')]('/',auth[_0x8612('0xb')](),controller[_0x8612('0xc')]);router[_0x8612('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x8612('0xd')]);router[_0x8612('0xa')](_0x8612('0xe'),auth['isAuthenticated'](),controller[_0x8612('0xf')]);router[_0x8612('0x10')]('/',auth[_0x8612('0xb')](),interaction[_0x8612('0x11')](_0x8612('0x12'),'chatmessage:create'),controller['create']);router[_0x8612('0x13')](_0x8612('0xe'),controller[_0x8612('0x14')]);router[_0x8612('0x13')]('/:id/accept',auth[_0x8612('0xb')](),controller['accept']);router[_0x8612('0x13')](_0x8612('0x15'),auth[_0x8612('0xb')](),controller[_0x8612('0x16')]);router['delete'](_0x8612('0xe'),auth['isAuthenticated'](),controller[_0x8612('0x17')]);module[_0x8612('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 912c5f1..da4a610 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0xd6981d,_0x55b963){var _0x5744bb=function(_0x5ab9b9){while(--_0x5ab9b9){_0xd6981d['push'](_0xd6981d['shift']());}};_0x5744bb(++_0x55b963);}(_0xb10b,0x12a));var _0xbb10=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0xb10b[_0x383dbb];return _0x6e8bde;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x0b0e[_0x5951e8];return _0x20a1f5;};'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 462c9cd..7ff8dac 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x7a54,0x106));var _0x47a5=function(_0x2e701d,_0x589117){_0x2e701d=_0x2e701d-0x0;var _0x342acd=_0x7a54[_0x2e701d];return _0x342acd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3d5d6a,_0x2a69b7){var _0x2a4d89=function(_0x45acc5){while(--_0x45acc5){_0x3d5d6a['push'](_0x3d5d6a['shift']());}};_0x2a4d89(++_0x2a69b7);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 41caa1f..ecc01ce 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 _0x7b58=['../../mysqldb','remove','emit','hook','exports','events'];(function(_0x253c93,_0x399f9e){var _0x4891b6=function(_0xe14a42){while(--_0xe14a42){_0x253c93['push'](_0x253c93['shift']());}};_0x4891b6(++_0x399f9e);}(_0x7b58,0xe9));var _0x87b5=function(_0xf022be,_0x14e78e){_0xf022be=_0xf022be-0x0;var _0x18d7d5=_0x7b58[_0xf022be];return _0x18d7d5;};'use strict';var EventEmitter=require(_0x87b5('0x0'));var ChatOfflineMessage=require(_0x87b5('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x87b5('0x2')};function emitEvent(_0x46d127){return function(_0x21a606,_0xacb38c,_0x24dd90){ChatOfflineMessageEvents['emit'](_0x46d127+':'+_0x21a606['id'],_0x21a606);ChatOfflineMessageEvents[_0x87b5('0x3')](_0x46d127,_0x21a606);_0x24dd90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x87b5('0x4')](e,emitEvent(event));}}module[_0x87b5('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4279=['update','remove','emit','hook','exports','../../mysqldb','ChatOfflineMessage','save'];(function(_0x34a14d,_0xc49d24){var _0x2015f2=function(_0x2a0b48){while(--_0x2a0b48){_0x34a14d['push'](_0x34a14d['shift']());}};_0x2015f2(++_0xc49d24);}(_0x4279,0x8d));var _0x9427=function(_0xe27481,_0x222de3){_0xe27481=_0xe27481-0x0;var _0x315cf5=_0x4279[_0xe27481];return _0x315cf5;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x9427('0x0'))['db'][_0x9427('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9427('0x2'),'afterUpdate':_0x9427('0x3'),'afterDestroy':_0x9427('0x4')};function emitEvent(_0x32d94e){return function(_0x54cdfb,_0x426911,_0x57f12b){ChatOfflineMessageEvents[_0x9427('0x5')](_0x32d94e+':'+_0x54cdfb['id'],_0x54cdfb);ChatOfflineMessageEvents[_0x9427('0x5')](_0x32d94e,_0x54cdfb);_0x57f12b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x9427('0x6')](e,emitEvent(event));}}module[_0x9427('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 59ddeb7..a8fd8f4 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 _0x84b1=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x84b1,0xd6));var _0x184b=function(_0x5a6837,_0x5c3e19){_0x5a6837=_0x5a6837-0x0;var _0x37330e=_0x84b1[_0x5a6837];return _0x37330e;};'use strict';var attributes=require(_0x184b('0x0'));module[_0x184b('0x1')]=function(_0x93899e){return _0x93899e['define'](_0x184b('0x2'),attributes,{'tableName':_0x184b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x184b('0x4'),'collate':_0x184b('0x5')});}; \ No newline at end of file +var _0xf782=['utf8mb4_unicode_ci','exports','chat_offline_messages','utf8mb4'];(function(_0x20dd9b,_0x3c0fb8){var _0x2de3b0=function(_0x5673d2){while(--_0x5673d2){_0x20dd9b['push'](_0x20dd9b['shift']());}};_0x2de3b0(++_0x3c0fb8);}(_0xf782,0xc9));var _0x2f78=function(_0x4239bd,_0x1f310b){_0x4239bd=_0x4239bd-0x0;var _0x21f061=_0xf782[_0x4239bd];return _0x21f061;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x2f78('0x0')]=function(_0x51409b){return _0x51409b['define']('ChatOfflineMessage',attributes,{'tableName':_0x2f78('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f78('0x2'),'collate':_0x2f78('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 43c2731..826f7bb 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 _0x2f14=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f14,0x1b4));var _0x42f1=function(_0x19b2f5,_0x48d1fa){_0x19b2f5=_0x19b2f5-0x0;var _0x28d53c=_0x2f14[_0x19b2f5];return _0x28d53c;};'use strict';var _=require(_0x42f1('0x0'));var util=require(_0x42f1('0x1'));var moment=require('moment');var BPromise=require(_0x42f1('0x2'));var rs=require(_0x42f1('0x3'));var fs=require('fs');var Redis=require(_0x42f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42f1('0x5'));var logger=require(_0x42f1('0x6'))(_0x42f1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x42f1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50e09f,_0x5f58db,_0x281909){return new BPromise(function(_0x1a093c,_0x48f9fe){return client[_0x42f1('0x9')](_0x50e09f,_0x281909)[_0x42f1('0xa')](function(_0x2d8aa9){logger[_0x42f1('0xb')](_0x42f1('0xc'),_0x5f58db,_0x42f1('0xd'));logger['debug'](_0x42f1('0xe'),_0x5f58db,_0x42f1('0xd'),JSON[_0x42f1('0xf')](_0x2d8aa9));if(_0x2d8aa9[_0x42f1('0x10')]){if(_0x2d8aa9[_0x42f1('0x10')][_0x42f1('0x11')]===0x1f4){logger[_0x42f1('0x10')](_0x42f1('0xc'),_0x5f58db,_0x2d8aa9['error'][_0x42f1('0x12')]);return _0x48f9fe(_0x2d8aa9['error'][_0x42f1('0x12')]);}logger[_0x42f1('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5f58db,_0x2d8aa9[_0x42f1('0x10')][_0x42f1('0x12')]);return _0x1a093c(_0x2d8aa9[_0x42f1('0x10')]['message']);}else{logger[_0x42f1('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5f58db,_0x42f1('0xd'));_0x1a093c(_0x2d8aa9['result']['message']);}})['catch'](function(_0x5e2f8e){logger[_0x42f1('0x10')](_0x42f1('0xc'),_0x5f58db,_0x5e2f8e);_0x48f9fe(_0x5e2f8e);});});} \ No newline at end of file +var _0x481e=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0xbb4e02,_0x1cac95){var _0x50ac16=function(_0xa64de2){while(--_0xa64de2){_0xbb4e02['push'](_0xbb4e02['shift']());}};_0x50ac16(++_0x1cac95);}(_0x481e,0x12f));var _0xe481=function(_0x53fabb,_0x2e23b0){_0x53fabb=_0x53fabb-0x0;var _0x188f5f=_0x481e[_0x53fabb];return _0x188f5f;};'use strict';var _=require('lodash');var util=require(_0xe481('0x0'));var moment=require(_0xe481('0x1'));var BPromise=require('bluebird');var rs=require(_0xe481('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe481('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe481('0x4'))(_0xe481('0x5'));var config=require(_0xe481('0x6'));var jayson=require(_0xe481('0x7'));var client=jayson[_0xe481('0x8')][_0xe481('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20f68b,_0xfc7c09,_0x201b9b){return new BPromise(function(_0x1b9c8b,_0x4cb26d){return client[_0xe481('0xa')](_0x20f68b,_0x201b9b)['then'](function(_0x564c9a){logger[_0xe481('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0xfc7c09,_0xe481('0xc'));logger[_0xe481('0xd')](_0xe481('0xe'),_0xfc7c09,_0xe481('0xc'),JSON[_0xe481('0xf')](_0x564c9a));if(_0x564c9a['error']){if(_0x564c9a[_0xe481('0x10')][_0xe481('0x11')]===0x1f4){logger[_0xe481('0x10')](_0xe481('0x12'),_0xfc7c09,_0x564c9a[_0xe481('0x10')][_0xe481('0x13')]);return _0x4cb26d(_0x564c9a['error']['message']);}logger[_0xe481('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0xfc7c09,_0x564c9a[_0xe481('0x10')][_0xe481('0x13')]);return _0x1b9c8b(_0x564c9a[_0xe481('0x10')][_0xe481('0x13')]);}else{logger[_0xe481('0xb')](_0xe481('0x12'),_0xfc7c09,_0xe481('0xc'));_0x1b9c8b(_0x564c9a['result'][_0xe481('0x13')]);}})[_0xe481('0x14')](function(_0x44ee63){logger[_0xe481('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0xfc7c09,_0x44ee63);_0x4cb26d(_0x44ee63);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5d93ba0..26b23ed 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 _0x9d38=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9d38,0x1e9));var _0x89d3=function(_0x3da9ab,_0x354090){_0x3da9ab=_0x3da9ab-0x0;var _0x5575e3=_0x9d38[_0x3da9ab];return _0x5575e3;};'use strict';var multer=require(_0x89d3('0x0'));var util=require(_0x89d3('0x1'));var path=require(_0x89d3('0x2'));var timeout=require(_0x89d3('0x3'));var express=require(_0x89d3('0x4'));var router=express['Router']();var fs_extra=require(_0x89d3('0x5'));var auth=require(_0x89d3('0x6'));var interaction=require(_0x89d3('0x7'));var config=require(_0x89d3('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0x89d3('0x9')]('/',auth[_0x89d3('0xa')](),controller[_0x89d3('0xb')]);router[_0x89d3('0x9')](_0x89d3('0xc'),auth['isAuthenticated'](),controller[_0x89d3('0xd')]);router['get'](_0x89d3('0xe'),auth[_0x89d3('0xa')](),controller[_0x89d3('0xf')]);router[_0x89d3('0x10')]('/',auth['isAuthenticated'](),controller[_0x89d3('0x11')]);router[_0x89d3('0x12')](_0x89d3('0xe'),auth['isAuthenticated'](),controller[_0x89d3('0x13')]);router[_0x89d3('0x14')](_0x89d3('0xe'),auth[_0x89d3('0xa')](),controller[_0x89d3('0x15')]);module[_0x89d3('0x16')]=router; \ No newline at end of file +var _0x5d9b=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xa5ef85,_0x13d5cb){var _0x247d4b=function(_0x185c65){while(--_0x185c65){_0xa5ef85['push'](_0xa5ef85['shift']());}};_0x247d4b(++_0x13d5cb);}(_0x5d9b,0xca));var _0xb5d9=function(_0x185c8a,_0x725f45){_0x185c8a=_0x185c8a-0x0;var _0x15d394=_0x5d9b[_0x185c8a];return _0x15d394;};'use strict';var multer=require(_0xb5d9('0x0'));var util=require(_0xb5d9('0x1'));var path=require(_0xb5d9('0x2'));var timeout=require(_0xb5d9('0x3'));var express=require(_0xb5d9('0x4'));var router=express[_0xb5d9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb5d9('0x6'));var interaction=require(_0xb5d9('0x7'));var config=require(_0xb5d9('0x8'));var controller=require(_0xb5d9('0x9'));router[_0xb5d9('0xa')]('/',auth[_0xb5d9('0xb')](),controller[_0xb5d9('0xc')]);router[_0xb5d9('0xa')](_0xb5d9('0xd'),auth[_0xb5d9('0xb')](),controller[_0xb5d9('0xe')]);router[_0xb5d9('0xa')](_0xb5d9('0xf'),auth[_0xb5d9('0xb')](),controller[_0xb5d9('0x10')]);router['post']('/',auth[_0xb5d9('0xb')](),controller[_0xb5d9('0x11')]);router[_0xb5d9('0x12')](_0xb5d9('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb5d9('0xf'),auth['isAuthenticated'](),controller[_0xb5d9('0x13')]);module[_0xb5d9('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 949a09a..679f82c 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 _0x7642=['sequelize','exports','ENUM','mouseOver','STRING','INTEGER'];(function(_0x572b58,_0x5c8fa0){var _0x34ae79=function(_0x3f5f10){while(--_0x3f5f10){_0x572b58['push'](_0x572b58['shift']());}};_0x34ae79(++_0x5c8fa0);}(_0x7642,0xde));var _0x2764=function(_0x2bb6b7,_0x59ccb8){_0x2bb6b7=_0x2bb6b7-0x0;var _0x2d31df=_0x7642[_0x2bb6b7];return _0x2d31df;};'use strict';var Sequelize=require(_0x2764('0x0'));module[_0x2764('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2764('0x2')](_0x2764('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x2764('0x4')]},'timeout':{'type':Sequelize[_0x2764('0x5')]}}; \ No newline at end of file +var _0x64c4=['sequelize','exports','mouseOver','timeout','INTEGER'];(function(_0x1055ef,_0x493539){var _0x8b1e01=function(_0x42e222){while(--_0x42e222){_0x1055ef['push'](_0x1055ef['shift']());}};_0x8b1e01(++_0x493539);}(_0x64c4,0x1a9));var _0x464c=function(_0x1e5b72,_0x2ebeb2){_0x1e5b72=_0x1e5b72-0x0;var _0x38fdb8=_0x64c4[_0x1e5b72];return _0x38fdb8;};'use strict';var Sequelize=require(_0x464c('0x0'));module[_0x464c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x464c('0x2'),_0x464c('0x3')),'defaultValue':_0x464c('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x464c('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index abae052..7399cf7 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 _0xa44a=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','catch','create','ChatProactiveAction','body','destroy','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto'];(function(_0x2d08d2,_0x22d0c1){var _0x5b91e9=function(_0x4c93b2){while(--_0x4c93b2){_0x2d08d2['push'](_0x2d08d2['shift']());}};_0x5b91e9(++_0x22d0c1);}(_0xa44a,0x9a));var _0xaa44=function(_0x26042f,_0x4cf1f1){_0x26042f=_0x26042f-0x0;var _0x10a8bf=_0xa44a[_0x26042f];return _0x10a8bf;};'use strict';var emlformat=require(_0xaa44('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa44('0x1'));var rp=require(_0xaa44('0x2'));var moment=require(_0xaa44('0x3'));var BPromise=require(_0xaa44('0x4'));var Mustache=require(_0xaa44('0x5'));var util=require(_0xaa44('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xaa44('0x7'));var ejs=require(_0xaa44('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa44('0x9'));var squel=require('squel');var crypto=require(_0xaa44('0xa'));var jsforce=require(_0xaa44('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa44('0x7'));var querystring=require(_0xaa44('0xc'));var Papa=require('papaparse');var Redis=require(_0xaa44('0xd'));var authService=require(_0xaa44('0xe'));var qs=require(_0xaa44('0xf'));var as=require(_0xaa44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa44('0x11'))('api');var utils=require(_0xaa44('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7e76,_0x14241a){_0x14241a=_0x14241a||0xcc;return function(_0x4041d0){if(_0x4041d0){return _0x1b7e76['sendStatus'](_0x14241a);}return _0x1b7e76[_0xaa44('0x13')](_0x14241a)[_0xaa44('0x14')]();};}function respondWithResult(_0x4d1827,_0x57e11d){_0x57e11d=_0x57e11d||0xc8;return function(_0x2cbd1c){if(_0x2cbd1c){return _0x4d1827[_0xaa44('0x13')](_0x57e11d)['json'](_0x2cbd1c);}};}function respondWithFilteredResult(_0x5ab5be,_0xc6673b){return function(_0x5ebdb3){if(_0x5ebdb3){var _0x2d7eea=typeof _0xc6673b['offset']===_0xaa44('0x15')&&typeof _0xc6673b[_0xaa44('0x16')]===_0xaa44('0x15');var _0x23cbc7=_0x5ebdb3[_0xaa44('0x17')];var _0x4b54cf=_0x2d7eea?0x0:_0xc6673b[_0xaa44('0x18')];var _0x16fa2c=_0x2d7eea?_0x5ebdb3[_0xaa44('0x17')]:_0xc6673b[_0xaa44('0x18')]+_0xc6673b[_0xaa44('0x16')];var _0xd7f602;if(_0x16fa2c>=_0x23cbc7){_0x16fa2c=_0x23cbc7;_0xd7f602=0xc8;}else{_0xd7f602=0xce;}_0x5ab5be[_0xaa44('0x13')](_0xd7f602);return _0x5ab5be[_0xaa44('0x19')](_0xaa44('0x1a'),_0x4b54cf+'-'+_0x16fa2c+'/'+_0x23cbc7)['json'](_0x5ebdb3);}return null;};}function patchUpdates(_0x27c156){return function(_0x4f4922){try{jsonpatch[_0xaa44('0x1b')](_0x4f4922,_0x27c156,!![]);}catch(_0x16fc0f){return BPromise['reject'](_0x16fc0f);}return _0x4f4922[_0xaa44('0x1c')]();};}function saveUpdates(_0x3d1fc1,_0x39ad8f){return function(_0x1c4de8){if(_0x1c4de8){return _0x1c4de8[_0xaa44('0x1d')](_0x3d1fc1)[_0xaa44('0x1e')](function(_0x9043d7){return _0x9043d7;});}return null;};}function removeEntity(_0xf9d46e,_0x17afa1){return function(_0x16d244){if(_0x16d244){return _0x16d244['destroy']()[_0xaa44('0x1e')](function(){_0xf9d46e[_0xaa44('0x13')](0xcc)[_0xaa44('0x14')]();});}};}function handleEntityNotFound(_0x39830b,_0xbbed2c){return function(_0x24ccaa){if(!_0x24ccaa){_0x39830b[_0xaa44('0x1f')](0x194);}return _0x24ccaa;};}function handleError(_0x566a41,_0x13f2a2){_0x13f2a2=_0x13f2a2||0x1f4;return function(_0x2b1941){logger[_0xaa44('0x20')](_0x2b1941[_0xaa44('0x21')]);if(_0x2b1941['name']){delete _0x2b1941[_0xaa44('0x22')];}_0x566a41[_0xaa44('0x13')](_0x13f2a2)[_0xaa44('0x23')](_0x2b1941);};}exports[_0xaa44('0x24')]=function(_0x34b2eb,_0x12c2bd){var _0x38c9bd={'raw':!![],'where':{'id':_0x34b2eb[_0xaa44('0x25')]['id']}},_0x2b4e06={};_0x2b4e06[_0xaa44('0x26')]=_[_0xaa44('0x27')](db['ChatProactiveAction'][_0xaa44('0x28')]);_0x2b4e06[_0xaa44('0x29')]=_[_0xaa44('0x27')](_0x34b2eb[_0xaa44('0x29')]);_0x2b4e06[_0xaa44('0x2a')]=_[_0xaa44('0x2b')](_0x2b4e06['model'],_0x2b4e06[_0xaa44('0x29')]);_0x38c9bd[_0xaa44('0x2c')]=_[_0xaa44('0x2b')](_0x2b4e06['model'],qs[_0xaa44('0x2d')](_0x34b2eb['query'][_0xaa44('0x2d')]));_0x38c9bd[_0xaa44('0x2c')]=_0x38c9bd['attributes'][_0xaa44('0x2e')]?_0x38c9bd[_0xaa44('0x2c')]:_0x2b4e06[_0xaa44('0x26')];if(_0x34b2eb[_0xaa44('0x29')]['includeAll']){_0x38c9bd[_0xaa44('0x2f')]=[{'all':!![]}];}_0x38c9bd=_[_0xaa44('0x30')]({},_0x38c9bd,_0x34b2eb['options']);return db['ChatProactiveAction']['find'](_0x38c9bd)[_0xaa44('0x1e')](handleEntityNotFound(_0x12c2bd,null))[_0xaa44('0x1e')](respondWithResult(_0x12c2bd,null))[_0xaa44('0x31')](handleError(_0x12c2bd,null));};exports[_0xaa44('0x32')]=function(_0x7f1e90,_0x20701d){return db[_0xaa44('0x33')][_0xaa44('0x32')](_0x7f1e90[_0xaa44('0x34')],{})[_0xaa44('0x1e')](respondWithResult(_0x20701d,0xc9))[_0xaa44('0x31')](handleError(_0x20701d,null));};exports[_0xaa44('0x1d')]=function(_0x17ff37,_0x3603c6){if(_0x17ff37[_0xaa44('0x34')]['id']){delete _0x17ff37[_0xaa44('0x34')]['id'];}return db[_0xaa44('0x33')]['find']({'where':{'id':_0x17ff37['params']['id']}})[_0xaa44('0x1e')](handleEntityNotFound(_0x3603c6,null))[_0xaa44('0x1e')](saveUpdates(_0x17ff37[_0xaa44('0x34')],null))['then'](respondWithResult(_0x3603c6,null))['catch'](handleError(_0x3603c6,null));};exports[_0xaa44('0x35')]=function(_0x5b9966,_0x3af75a){return db[_0xaa44('0x33')][_0xaa44('0x36')]({'where':{'id':_0x5b9966['params']['id']}})[_0xaa44('0x1e')](handleEntityNotFound(_0x3af75a,null))[_0xaa44('0x1e')](removeEntity(_0x3af75a,null))['catch'](handleError(_0x3af75a,null));}; \ No newline at end of file +var _0x1d7e=['catch','create','body','update','params','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','options','find'];(function(_0x2d3c46,_0xd7e192){var _0x36bea2=function(_0x222231){while(--_0x222231){_0x2d3c46['push'](_0x2d3c46['shift']());}};_0x36bea2(++_0xd7e192);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1d7e[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];function respondWithStatusCode(_0x207502,_0x455a7a){_0x455a7a=_0x455a7a||0xcc;return function(_0x445994){if(_0x445994){return _0x207502[_0xe1d7('0x17')](_0x455a7a);}return _0x207502['status'](_0x455a7a)[_0xe1d7('0x18')]();};}function respondWithResult(_0x247286,_0x156a3f){_0x156a3f=_0x156a3f||0xc8;return function(_0x3d3d8d){if(_0x3d3d8d){return _0x247286[_0xe1d7('0x19')](_0x156a3f)[_0xe1d7('0x1a')](_0x3d3d8d);}};}function respondWithFilteredResult(_0x3c1923,_0x565278){return function(_0x391f55){if(_0x391f55){var _0x328898=typeof _0x565278[_0xe1d7('0x1b')]==='undefined'&&typeof _0x565278[_0xe1d7('0x1c')]===_0xe1d7('0x1d');var _0x800c15=_0x391f55[_0xe1d7('0x1e')];var _0x1dc61f=_0x328898?0x0:_0x565278[_0xe1d7('0x1b')];var _0xdad949=_0x328898?_0x391f55[_0xe1d7('0x1e')]:_0x565278[_0xe1d7('0x1b')]+_0x565278[_0xe1d7('0x1c')];var _0x2035e7;if(_0xdad949>=_0x800c15){_0xdad949=_0x800c15;_0x2035e7=0xc8;}else{_0x2035e7=0xce;}_0x3c1923[_0xe1d7('0x19')](_0x2035e7);return _0x3c1923['set'](_0xe1d7('0x1f'),_0x1dc61f+'-'+_0xdad949+'/'+_0x800c15)[_0xe1d7('0x1a')](_0x391f55);}return null;};}function patchUpdates(_0x1e9a1e){return function(_0x3e25e8){try{jsonpatch[_0xe1d7('0x20')](_0x3e25e8,_0x1e9a1e,!![]);}catch(_0x5f2053){return BPromise[_0xe1d7('0x21')](_0x5f2053);}return _0x3e25e8[_0xe1d7('0x22')]();};}function saveUpdates(_0x111e52,_0x13867a){return function(_0x33ac20){if(_0x33ac20){return _0x33ac20['update'](_0x111e52)[_0xe1d7('0x23')](function(_0x370c92){return _0x370c92;});}return null;};}function removeEntity(_0x2572ec,_0x3bc5c1){return function(_0x25e3c9){if(_0x25e3c9){return _0x25e3c9[_0xe1d7('0x24')]()[_0xe1d7('0x23')](function(){_0x2572ec[_0xe1d7('0x19')](0xcc)[_0xe1d7('0x18')]();});}};}function handleEntityNotFound(_0x2e47f7,_0x55446d){return function(_0x672bed){if(!_0x672bed){_0x2e47f7[_0xe1d7('0x17')](0x194);}return _0x672bed;};}function handleError(_0x3abcb3,_0x4fea12){_0x4fea12=_0x4fea12||0x1f4;return function(_0x11dde2){logger[_0xe1d7('0x25')](_0x11dde2[_0xe1d7('0x26')]);if(_0x11dde2[_0xe1d7('0x27')]){delete _0x11dde2[_0xe1d7('0x27')];}_0x3abcb3[_0xe1d7('0x19')](_0x4fea12)[_0xe1d7('0x28')](_0x11dde2);};}exports['show']=function(_0x3e8ca3,_0x4a3344){var _0xbc38f3={'raw':!![],'where':{'id':_0x3e8ca3['params']['id']}},_0x264481={};_0x264481['model']=_[_0xe1d7('0x29')](db[_0xe1d7('0x2a')][_0xe1d7('0x2b')]);_0x264481[_0xe1d7('0x2c')]=_[_0xe1d7('0x29')](_0x3e8ca3['query']);_0x264481[_0xe1d7('0x2d')]=_[_0xe1d7('0x2e')](_0x264481[_0xe1d7('0x2f')],_0x264481[_0xe1d7('0x2c')]);_0xbc38f3[_0xe1d7('0x30')]=_['intersection'](_0x264481[_0xe1d7('0x2f')],qs[_0xe1d7('0x31')](_0x3e8ca3[_0xe1d7('0x2c')][_0xe1d7('0x31')]));_0xbc38f3[_0xe1d7('0x30')]=_0xbc38f3[_0xe1d7('0x30')][_0xe1d7('0x32')]?_0xbc38f3[_0xe1d7('0x30')]:_0x264481['model'];if(_0x3e8ca3[_0xe1d7('0x2c')][_0xe1d7('0x33')]){_0xbc38f3[_0xe1d7('0x34')]=[{'all':!![]}];}_0xbc38f3=_['merge']({},_0xbc38f3,_0x3e8ca3[_0xe1d7('0x35')]);return db[_0xe1d7('0x2a')][_0xe1d7('0x36')](_0xbc38f3)[_0xe1d7('0x23')](handleEntityNotFound(_0x4a3344,null))[_0xe1d7('0x23')](respondWithResult(_0x4a3344,null))[_0xe1d7('0x37')](handleError(_0x4a3344,null));};exports['create']=function(_0x1882bb,_0x33a0d2){return db[_0xe1d7('0x2a')][_0xe1d7('0x38')](_0x1882bb[_0xe1d7('0x39')],{})[_0xe1d7('0x23')](respondWithResult(_0x33a0d2,0xc9))['catch'](handleError(_0x33a0d2,null));};exports[_0xe1d7('0x3a')]=function(_0x228f2c,_0x36f1d6){if(_0x228f2c['body']['id']){delete _0x228f2c[_0xe1d7('0x39')]['id'];}return db[_0xe1d7('0x2a')][_0xe1d7('0x36')]({'where':{'id':_0x228f2c['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x36f1d6,null))['then'](saveUpdates(_0x228f2c[_0xe1d7('0x39')],null))[_0xe1d7('0x23')](respondWithResult(_0x36f1d6,null))['catch'](handleError(_0x36f1d6,null));};exports[_0xe1d7('0x24')]=function(_0x371c2e,_0x412688){return db['ChatProactiveAction'][_0xe1d7('0x36')]({'where':{'id':_0x371c2e[_0xe1d7('0x3b')]['id']}})['then'](handleEntityNotFound(_0x412688,null))[_0xe1d7('0x23')](removeEntity(_0x412688,null))['catch'](handleError(_0x412688,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2db16d6..ffbe257 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 _0x0d01=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x150c5e,_0x3ffce4){var _0x7d4b1=function(_0x57c905){while(--_0x57c905){_0x150c5e['push'](_0x150c5e['shift']());}};_0x7d4b1(++_0x3ffce4);}(_0x0d01,0xee));var _0x10d0=function(_0x1cf2d6,_0x4780c0){_0x1cf2d6=_0x1cf2d6-0x0;var _0x26d987=_0x0d01[_0x1cf2d6];return _0x26d987;};'use strict';var _=require(_0x10d0('0x0'));var util=require(_0x10d0('0x1'));var logger=require(_0x10d0('0x2'))(_0x10d0('0x3'));var moment=require('moment');var BPromise=require(_0x10d0('0x4'));var rp=require(_0x10d0('0x5'));var fs=require('fs');var path=require(_0x10d0('0x6'));var rimraf=require(_0x10d0('0x7'));var config=require(_0x10d0('0x8'));var attributes=require(_0x10d0('0x9'));module[_0x10d0('0xa')]=function(_0x5ccc8a,_0x4de9b8){return _0x5ccc8a[_0x10d0('0xb')](_0x10d0('0xc'),attributes,{'tableName':_0x10d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cc0=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','../../config/logger','moment','request-promise','path'];(function(_0x4dbf11,_0x36a91f){var _0x571bf9=function(_0x3edd71){while(--_0x3edd71){_0x4dbf11['push'](_0x4dbf11['shift']());}};_0x571bf9(++_0x36a91f);}(_0x8cc0,0x187));var _0x08cc=function(_0x1c905a,_0x1b54ec){_0x1c905a=_0x1c905a-0x0;var _0x231324=_0x8cc0[_0x1c905a];return _0x231324;};'use strict';var _=require(_0x08cc('0x0'));var util=require('util');var logger=require(_0x08cc('0x1'))('api');var moment=require(_0x08cc('0x2'));var BPromise=require('bluebird');var rp=require(_0x08cc('0x3'));var fs=require('fs');var path=require(_0x08cc('0x4'));var rimraf=require(_0x08cc('0x5'));var config=require(_0x08cc('0x6'));var attributes=require(_0x08cc('0x7'));module[_0x08cc('0x8')]=function(_0x5d87f7,_0x10ea6c){return _0x5d87f7[_0x08cc('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x08cc('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 1a78ddd..fdd30c5 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 _0x2e19=['../../config/utils','rpc','../../config/environment','client','http','request','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0xaeb658,_0x47f58e){var _0xea3a30=function(_0x42ab41){while(--_0x42ab41){_0xaeb658['push'](_0xaeb658['shift']());}};_0xea3a30(++_0x47f58e);}(_0x2e19,0x79));var _0x92e1=function(_0x57d078,_0x41b5b4){_0x57d078=_0x57d078-0x0;var _0x5ef64d=_0x2e19[_0x57d078];return _0x5ef64d;};'use strict';var _=require(_0x92e1('0x0'));var util=require('util');var moment=require(_0x92e1('0x1'));var BPromise=require('bluebird');var rs=require(_0x92e1('0x2'));var fs=require('fs');var Redis=require(_0x92e1('0x3'));var db=require(_0x92e1('0x4'))['db'];var utils=require(_0x92e1('0x5'));var logger=require('../../config/logger')(_0x92e1('0x6'));var config=require(_0x92e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x92e1('0x8')][_0x92e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c7c49,_0xbe38f6,_0x34dbe1){return new BPromise(function(_0x60a8e4,_0x133113){return client[_0x92e1('0xa')](_0x3c7c49,_0x34dbe1)['then'](function(_0x117bcd){logger['info'](_0x92e1('0xb'),_0xbe38f6,'request\x20sent');logger['debug'](_0x92e1('0xc'),_0xbe38f6,_0x92e1('0xd'),JSON[_0x92e1('0xe')](_0x117bcd));if(_0x117bcd[_0x92e1('0xf')]){if(_0x117bcd[_0x92e1('0xf')][_0x92e1('0x10')]===0x1f4){logger[_0x92e1('0xf')](_0x92e1('0xb'),_0xbe38f6,_0x117bcd[_0x92e1('0xf')][_0x92e1('0x11')]);return _0x133113(_0x117bcd['error'][_0x92e1('0x11')]);}logger['error'](_0x92e1('0xb'),_0xbe38f6,_0x117bcd[_0x92e1('0xf')][_0x92e1('0x11')]);return _0x60a8e4(_0x117bcd[_0x92e1('0xf')][_0x92e1('0x11')]);}else{logger[_0x92e1('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0xbe38f6,_0x92e1('0xd'));_0x60a8e4(_0x117bcd[_0x92e1('0x13')][_0x92e1('0x11')]);}})[_0x92e1('0x14')](function(_0x37613c){logger[_0x92e1('0xf')](_0x92e1('0xb'),_0xbe38f6,_0x37613c);_0x133113(_0x37613c);});});} \ No newline at end of file +var _0x8729=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x8729,0x181));var _0x9872=function(_0x215401,_0x2ffb16){_0x215401=_0x215401-0x0;var _0x5adadd=_0x8729[_0x215401];return _0x5adadd;};'use strict';var _=require(_0x9872('0x0'));var util=require(_0x9872('0x1'));var moment=require('moment');var BPromise=require(_0x9872('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9872('0x3'));var db=require(_0x9872('0x4'))['db'];var utils=require(_0x9872('0x5'));var logger=require(_0x9872('0x6'))(_0x9872('0x7'));var config=require(_0x9872('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9872('0x9')][_0x9872('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x233ee1,_0x2a8e7a,_0x14890f){return new BPromise(function(_0xb78d8d,_0x54a76d){return client['request'](_0x233ee1,_0x14890f)['then'](function(_0x1de9dc){logger['info'](_0x9872('0xb'),_0x2a8e7a,_0x9872('0xc'));logger[_0x9872('0xd')](_0x9872('0xe'),_0x2a8e7a,_0x9872('0xc'),JSON[_0x9872('0xf')](_0x1de9dc));if(_0x1de9dc[_0x9872('0x10')]){if(_0x1de9dc[_0x9872('0x10')][_0x9872('0x11')]===0x1f4){logger['error'](_0x9872('0xb'),_0x2a8e7a,_0x1de9dc['error']['message']);return _0x54a76d(_0x1de9dc['error']['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2a8e7a,_0x1de9dc[_0x9872('0x10')][_0x9872('0x12')]);return _0xb78d8d(_0x1de9dc[_0x9872('0x10')][_0x9872('0x12')]);}else{logger['info'](_0x9872('0xb'),_0x2a8e7a,'request\x20sent');_0xb78d8d(_0x1de9dc[_0x9872('0x13')]['message']);}})[_0x9872('0x14')](function(_0x8eed2f){logger['error'](_0x9872('0xb'),_0x2a8e7a,_0x8eed2f);_0x54a76d(_0x8eed2f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 633ed02..b06d33e 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x7da7,0x10d));var _0x77da=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x7da7[_0x10e983];return _0x324138;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file +var _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x174b62,_0x316871){var _0x358adf=function(_0x1a3adf){while(--_0x1a3adf){_0x174b62['push'](_0x174b62['shift']());}};_0x358adf(++_0x316871);}(_0x4819,0xcd));var _0x9481=function(_0x57fd0d,_0x2630ea){_0x57fd0d=_0x57fd0d-0x0;var _0x4b57f6=_0x4819[_0x57fd0d];return _0x4b57f6;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 1bd902c..4155c7d 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 _0x04ef=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x43762c,_0x48ff0f){var _0x4a85e0=function(_0x452e89){while(--_0x452e89){_0x43762c['push'](_0x43762c['shift']());}};_0x4a85e0(++_0x48ff0f);}(_0x04ef,0x17e));var _0xf04e=function(_0x420e3b,_0x1a3528){_0x420e3b=_0x420e3b-0x0;var _0x2d61ad=_0x04ef[_0x420e3b];return _0x2d61ad;};'use strict';var Sequelize=require('sequelize');module[_0xf04e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf04e('0x1')]},'timeout':{'type':Sequelize[_0xf04e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf04e('0x3')](_0xf04e('0x4'),_0xf04e('0x5'),_0xf04e('0x6'))}}; \ No newline at end of file +var _0x6f2b=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0x6f2b,0x176));var _0xb6f2=function(_0x526af5,_0x4ddc92){_0x526af5=_0x526af5-0x0;var _0x2595f8=_0x6f2b[_0x526af5];return _0x2595f8;};'use strict';var Sequelize=require(_0xb6f2('0x0'));module[_0xb6f2('0x1')]={'name':{'type':Sequelize[_0xb6f2('0x2')],'unique':_0xb6f2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb6f2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6f2('0x5')](_0xb6f2('0x6'),'beepall',_0xb6f2('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f256c1f..b526b46 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 _0x422e=['stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','include','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','findAll','User','findAndCountAll','UserId','createdAt','rows','format','%s/%s','SIP','chatPause','updatedAt','getTeams','Team','pick','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x422e,0x75));var _0xe422=function(_0x30cca3,_0x2af3fb){_0x30cca3=_0x30cca3-0x0;var _0x247229=_0x422e[_0x30cca3];return _0x247229;};'use strict';var emlformat=require(_0xe422('0x0'));var rimraf=require(_0xe422('0x1'));var zipdir=require(_0xe422('0x2'));var jsonpatch=require(_0xe422('0x3'));var rp=require(_0xe422('0x4'));var moment=require(_0xe422('0x5'));var BPromise=require(_0xe422('0x6'));var Mustache=require(_0xe422('0x7'));var util=require(_0xe422('0x8'));var path=require(_0xe422('0x9'));var sox=require(_0xe422('0xa'));var csv=require(_0xe422('0xb'));var ejs=require(_0xe422('0xc'));var fs=require('fs');var fs_extra=require(_0xe422('0xd'));var _=require(_0xe422('0xe'));var squel=require('squel');var crypto=require(_0xe422('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe422('0x10'));var toCsv=require(_0xe422('0xb'));var querystring=require(_0xe422('0x11'));var Papa=require(_0xe422('0x12'));var Redis=require(_0xe422('0x13'));var authService=require(_0xe422('0x14'));var qs=require(_0xe422('0x15'));var as=require(_0xe422('0x16'));var hardwareService=require(_0xe422('0x17'));var logger=require('../../config/logger')(_0xe422('0x18'));var utils=require(_0xe422('0x19'));var config=require(_0xe422('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe422('0x1b'))['db'];config[_0xe422('0x1c')]=_[_0xe422('0x1d')](config[_0xe422('0x1c')],{'host':_0xe422('0x1e'),'port':0x18eb});var socket=require(_0xe422('0x1f'))(new Redis(config[_0xe422('0x1c')]));require(_0xe422('0x20'))[_0xe422('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x431a52,_0x2ae517,_0x26078b,_0x1aaf3b){return new BPromise(function(_0x2814fc,_0x50026a){var _0x4f1590=_0x1aaf3b||client;return _0x4f1590['request'](_0x431a52,_0x26078b)['then'](function(_0x42c0ba){logger[_0xe422('0x22')](_0xe422('0x23'),_0x2ae517,_0xe422('0x24'));logger[_0xe422('0x25')](_0xe422('0x26'),_0x2ae517,'request\x20sent',JSON[_0xe422('0x27')](_0x42c0ba));if(_0x42c0ba['error']){if(_0x42c0ba[_0xe422('0x28')]['code']===0x1f4){logger['error'](_0xe422('0x23'),_0x2ae517,_0x42c0ba[_0xe422('0x28')]['message']);return _0x50026a(_0x42c0ba[_0xe422('0x28')]['message']);}logger[_0xe422('0x28')](_0xe422('0x23'),_0x2ae517,_0x42c0ba['error'][_0xe422('0x29')]);return _0x2814fc(_0x42c0ba['error'][_0xe422('0x29')]);}else{logger[_0xe422('0x22')](_0xe422('0x23'),_0x2ae517,_0xe422('0x24'));_0x2814fc(_0x42c0ba[_0xe422('0x2a')][_0xe422('0x29')]);}})[_0xe422('0x2b')](function(_0x31f0bd){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2ae517,_0x31f0bd);_0x50026a(_0x31f0bd);});});}function respondWithStatusCode(_0x35621b,_0x21b702){_0x21b702=_0x21b702||0xcc;return function(_0x91aaa2){if(_0x91aaa2){return _0x35621b['sendStatus'](_0x21b702);}return _0x35621b[_0xe422('0x2c')](_0x21b702)[_0xe422('0x2d')]();};}function respondWithResult(_0x351a88,_0x24f85f){_0x24f85f=_0x24f85f||0xc8;return function(_0x532fe2){if(_0x532fe2){return _0x351a88[_0xe422('0x2c')](_0x24f85f)[_0xe422('0x2e')](_0x532fe2);}};}function respondWithFilteredResult(_0x522c59,_0x1be978){return function(_0x2a465e){if(_0x2a465e){var _0x170aa6=typeof _0x1be978[_0xe422('0x2f')]===_0xe422('0x30')&&typeof _0x1be978[_0xe422('0x31')]===_0xe422('0x30');var _0x3ad976=_0x2a465e[_0xe422('0x32')];var _0x204998=_0x170aa6?0x0:_0x1be978[_0xe422('0x2f')];var _0x26a2f5=_0x170aa6?_0x2a465e[_0xe422('0x32')]:_0x1be978[_0xe422('0x2f')]+_0x1be978['limit'];var _0x2602fe;if(_0x26a2f5>=_0x3ad976){_0x26a2f5=_0x3ad976;_0x2602fe=0xc8;}else{_0x2602fe=0xce;}_0x522c59[_0xe422('0x2c')](_0x2602fe);return _0x522c59[_0xe422('0x33')](_0xe422('0x34'),_0x204998+'-'+_0x26a2f5+'/'+_0x3ad976)[_0xe422('0x2e')](_0x2a465e);}return null;};}function patchUpdates(_0x50cc47){return function(_0x5989dd){try{jsonpatch[_0xe422('0x35')](_0x5989dd,_0x50cc47,!![]);}catch(_0x1ef1a6){return BPromise[_0xe422('0x36')](_0x1ef1a6);}return _0x5989dd['save']();};}function saveUpdates(_0x393830,_0x3462df){return function(_0x2ce5f8){if(_0x2ce5f8){return _0x2ce5f8[_0xe422('0x37')](_0x393830)[_0xe422('0x38')](function(_0x53844c){return _0x53844c;});}return null;};}function removeEntity(_0x10f89b,_0x276038){return function(_0x590c66){if(_0x590c66){return _0x590c66[_0xe422('0x39')]()['then'](function(){var _0x4bcd59=_0x590c66[_0xe422('0x3a')]({'plain':!![]});var _0x52549f='ChatQueues';return db[_0xe422('0x3b')][_0xe422('0x39')]({'where':{'type':_0x52549f,'resourceId':_0x4bcd59['id']}})[_0xe422('0x38')](function(){return _0x590c66;});})[_0xe422('0x38')](function(){_0x10f89b[_0xe422('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1807ae,_0x452840){return function(_0x1b6546){if(!_0x1b6546){_0x1807ae[_0xe422('0x3c')](0x194);}return _0x1b6546;};}function handleError(_0x12ff9d,_0x40a833){_0x40a833=_0x40a833||0x1f4;return function(_0x3702d6){logger['error'](_0x3702d6['stack']);if(_0x3702d6[_0xe422('0x3d')]){delete _0x3702d6[_0xe422('0x3d')];}_0x12ff9d[_0xe422('0x2c')](_0x40a833)[_0xe422('0x3e')](_0x3702d6);};}exports['index']=function(_0x3d5c5e,_0x2e586f){var _0x26d169={},_0x1e5e7b={},_0xe17204={'count':0x0,'rows':[]};var _0x23c4f8=_[_0xe422('0x3f')](db[_0xe422('0x40')][_0xe422('0x41')],function(_0x4d45e5){return{'name':_0x4d45e5[_0xe422('0x42')],'type':_0x4d45e5[_0xe422('0x43')][_0xe422('0x44')]};});_0x1e5e7b[_0xe422('0x45')]=_[_0xe422('0x3f')](_0x23c4f8,_0xe422('0x3d'));_0x1e5e7b[_0xe422('0x46')]=_[_0xe422('0x47')](_0x3d5c5e[_0xe422('0x46')]);_0x1e5e7b[_0xe422('0x48')]=_[_0xe422('0x49')](_0x1e5e7b[_0xe422('0x45')],_0x1e5e7b[_0xe422('0x46')]);_0x26d169[_0xe422('0x4a')]=_[_0xe422('0x49')](_0x1e5e7b['model'],qs['fields'](_0x3d5c5e[_0xe422('0x46')][_0xe422('0x4b')]));_0x26d169['attributes']=_0x26d169[_0xe422('0x4a')]['length']?_0x26d169[_0xe422('0x4a')]:_0x1e5e7b[_0xe422('0x45')];if(!_0x3d5c5e[_0xe422('0x46')][_0xe422('0x4c')](_0xe422('0x4d'))){_0x26d169['limit']=qs[_0xe422('0x31')](_0x3d5c5e[_0xe422('0x46')][_0xe422('0x31')]);_0x26d169[_0xe422('0x2f')]=qs['offset'](_0x3d5c5e[_0xe422('0x46')][_0xe422('0x2f')]);}_0x26d169['order']=qs[_0xe422('0x4e')](_0x3d5c5e[_0xe422('0x46')][_0xe422('0x4e')]);_0x26d169[_0xe422('0x4f')]=qs[_0xe422('0x48')](_['pick'](_0x3d5c5e[_0xe422('0x46')],_0x1e5e7b[_0xe422('0x48')]),_0x23c4f8);if(_0x3d5c5e[_0xe422('0x46')]['filter']){_0x26d169[_0xe422('0x4f')]=_['merge'](_0x26d169['where'],{'$or':_[_0xe422('0x3f')](_0x23c4f8,function(_0x26ccdf){if(_0x26ccdf[_0xe422('0x43')]!==_0xe422('0x50')){var _0x3c2cf1={};_0x3c2cf1[_0x26ccdf['name']]={'$like':'%'+_0x3d5c5e[_0xe422('0x46')][_0xe422('0x51')]+'%'};return _0x3c2cf1;}})});}_0x26d169=_[_0xe422('0x52')]({},_0x26d169,_0x3d5c5e[_0xe422('0x53')]);var _0x5f1480={'where':_0x26d169[_0xe422('0x4f')]};return db[_0xe422('0x40')][_0xe422('0x32')](_0x5f1480)[_0xe422('0x38')](function(_0x3133ba){_0xe17204[_0xe422('0x32')]=_0x3133ba;if(_0x3d5c5e[_0xe422('0x46')]['includeAll']){_0x26d169[_0xe422('0x54')]=[{'all':!![]}];}return db[_0xe422('0x40')]['findAll'](_0x26d169);})[_0xe422('0x38')](function(_0x2875ff){_0xe17204['rows']=_0x2875ff;return _0xe17204;})[_0xe422('0x38')](respondWithFilteredResult(_0x2e586f,_0x26d169))['catch'](handleError(_0x2e586f,null));};exports[_0xe422('0x55')]=function(_0x3f3462,_0x3c9717){var _0x14fe39={'raw':!![],'where':{'id':_0x3f3462[_0xe422('0x56')]['id']}},_0x5b080e={};_0x5b080e[_0xe422('0x45')]=_['keys'](db[_0xe422('0x40')][_0xe422('0x41')]);_0x5b080e[_0xe422('0x46')]=_[_0xe422('0x47')](_0x3f3462[_0xe422('0x46')]);_0x5b080e[_0xe422('0x48')]=_[_0xe422('0x49')](_0x5b080e[_0xe422('0x45')],_0x5b080e[_0xe422('0x46')]);_0x14fe39[_0xe422('0x4a')]=_[_0xe422('0x49')](_0x5b080e[_0xe422('0x45')],qs[_0xe422('0x4b')](_0x3f3462[_0xe422('0x46')]['fields']));_0x14fe39[_0xe422('0x4a')]=_0x14fe39[_0xe422('0x4a')][_0xe422('0x57')]?_0x14fe39[_0xe422('0x4a')]:_0x5b080e[_0xe422('0x45')];if(_0x3f3462[_0xe422('0x46')][_0xe422('0x58')]){_0x14fe39[_0xe422('0x54')]=[{'all':!![]}];}_0x14fe39=_[_0xe422('0x52')]({},_0x14fe39,_0x3f3462[_0xe422('0x53')]);return db[_0xe422('0x40')][_0xe422('0x59')](_0x14fe39)['then'](handleEntityNotFound(_0x3c9717,null))[_0xe422('0x38')](respondWithResult(_0x3c9717,null))[_0xe422('0x2b')](handleError(_0x3c9717,null));};exports['create']=function(_0x18fe50,_0x3e1767){return db[_0xe422('0x40')][_0xe422('0x5a')](_0x18fe50['body'],{})['then'](function(_0xe11298){var _0x469fe3=_0x18fe50[_0xe422('0x5b')][_0xe422('0x3a')]({'plain':!![]});if(!_0x469fe3)throw new Error(_0xe422('0x5c'));if(_0x469fe3[_0xe422('0x5d')]==='user'){var _0x3c44e2=_0xe11298[_0xe422('0x3a')]({'plain':!![]});var _0x196c8c='ChatQueues';return db['UserProfileSection'][_0xe422('0x59')]({'where':{'name':_0x196c8c,'userProfileId':_0x469fe3[_0xe422('0x5e')]},'raw':!![]})[_0xe422('0x38')](function(_0x4b9bfc){if(_0x4b9bfc&&_0x4b9bfc[_0xe422('0x5f')]===0x0){return db[_0xe422('0x3b')][_0xe422('0x5a')]({'name':_0x3c44e2[_0xe422('0x3d')],'resourceId':_0x3c44e2['id'],'type':_0x4b9bfc[_0xe422('0x3d')],'sectionId':_0x4b9bfc['id']},{})[_0xe422('0x38')](function(){return _0xe11298;});}else{return _0xe11298;}})[_0xe422('0x2b')](function(_0x37f29d){logger[_0xe422('0x28')](_0xe422('0x60'),_0x37f29d);throw _0x37f29d;});}return _0xe11298;})[_0xe422('0x38')](respondWithResult(_0x3e1767,0xc9))['catch'](handleError(_0x3e1767,null));};exports[_0xe422('0x37')]=function(_0x2741fa,_0x503ed0){if(_0x2741fa[_0xe422('0x61')]['id']){delete _0x2741fa[_0xe422('0x61')]['id'];}return db[_0xe422('0x40')][_0xe422('0x59')]({'where':{'id':_0x2741fa[_0xe422('0x56')]['id']}})[_0xe422('0x38')](handleEntityNotFound(_0x503ed0,null))[_0xe422('0x38')](saveUpdates(_0x2741fa['body'],null))['then'](respondWithResult(_0x503ed0,null))[_0xe422('0x2b')](handleError(_0x503ed0,null));};exports[_0xe422('0x39')]=function(_0x2bd06b,_0x360ee0){return db['ChatQueue'][_0xe422('0x59')]({'where':{'id':_0x2bd06b['params']['id']}})['then'](handleEntityNotFound(_0x360ee0,null))['then'](removeEntity(_0x360ee0,null))['catch'](handleError(_0x360ee0,null));};exports[_0xe422('0x62')]=function(_0xfe521e,_0x37e1c3){return db[_0xe422('0x40')][_0xe422('0x62')]()[_0xe422('0x38')](respondWithResult(_0x37e1c3,null))['catch'](handleError(_0x37e1c3,null));};exports[_0xe422('0x63')]=function(_0x583444,_0x539c32,_0x2f11d1){var _0x52160d={'raw':!![],'where':{}},_0xe4c0e9={},_0x28d3f5;return db[_0xe422('0x40')][_0xe422('0x64')]({'where':{'id':_0x583444['params']['id']}})[_0xe422('0x38')](handleEntityNotFound(_0x539c32,null))['then'](function(_0x58bbb1){if(_0x58bbb1){_0x28d3f5=_0x58bbb1[_0xe422('0x3a')]({'plain':!![]});_0xe4c0e9[_0xe422('0x45')]=_[_0xe422('0x47')](db[_0xe422('0x65')]['rawAttributes']);_0xe4c0e9[_0xe422('0x46')]=_['keys'](_0x583444['query']);_0xe4c0e9[_0xe422('0x48')]=_[_0xe422('0x49')](_0xe4c0e9[_0xe422('0x45')],_0xe4c0e9[_0xe422('0x46')]);_0x52160d[_0xe422('0x4a')]=_['intersection'](_0xe4c0e9[_0xe422('0x45')],qs['fields'](_0x583444[_0xe422('0x46')]['fields']));_0x52160d['attributes']=_0x52160d[_0xe422('0x4a')][_0xe422('0x57')]?_0x52160d[_0xe422('0x4a')]:_0xe4c0e9['model'];if(!_0x583444[_0xe422('0x46')][_0xe422('0x4c')](_0xe422('0x4d'))){_0x52160d[_0xe422('0x31')]=qs[_0xe422('0x31')](_0x583444[_0xe422('0x46')][_0xe422('0x31')]);_0x52160d[_0xe422('0x2f')]=qs[_0xe422('0x2f')](_0x583444[_0xe422('0x46')][_0xe422('0x2f')]);}_0x52160d[_0xe422('0x66')]=qs[_0xe422('0x4e')](_0x583444[_0xe422('0x46')]['sort']);_0x52160d[_0xe422('0x4f')]=qs['filters'](_['pick'](_0x583444[_0xe422('0x46')],_0xe4c0e9['filters']));_0x52160d[_0xe422('0x4f')][_0xe422('0x67')]=_0x58bbb1['id'];if(_0x583444[_0xe422('0x46')]['filter']){_0x52160d['where']=_[_0xe422('0x52')](_0x52160d['where'],{'$or':_[_0xe422('0x3f')](_0x52160d[_0xe422('0x4a')],function(_0x1df9df){var _0x366630={};_0x366630[_0x1df9df]={'$like':'%'+_0x583444[_0xe422('0x46')][_0xe422('0x51')]+'%'};return _0x366630;})});}_0x52160d=_[_0xe422('0x52')]({},_0x52160d,_0x583444[_0xe422('0x53')]);return db[_0xe422('0x65')][_0xe422('0x68')](_0x52160d);}})[_0xe422('0x38')](function(_0x4b57c6){if(_0x4b57c6){return db[_0xe422('0x69')][_0xe422('0x6a')]({'where':{'id':_[_0xe422('0x3f')](_0x4b57c6,_0xe422('0x6b')),'role':'agent'},'attributes':['id',_0xe422('0x3d'),'chatPause','updatedAt',_0xe422('0x6c')]});}})[_0xe422('0x38')](function(_0x215684){if(_0x215684){return{'count':_0x215684[_0xe422('0x32')],'rows':_[_0xe422('0x3f')](_0x215684[_0xe422('0x6d')],function(_0x4bab34){return{'membername':_0x4bab34['name'],'UserId':_0x4bab34['id'],'queue_name':_0x28d3f5[_0xe422('0x3d')],'ChatQueueId':_0x28d3f5['id'],'interface':util[_0xe422('0x6e')](_0xe422('0x6f'),_0xe422('0x70'),_0x4bab34[_0xe422('0x3d')]),'penalty':0x0,'paused':_0x4bab34[_0xe422('0x71')],'createdAt':_0x4bab34[_0xe422('0x6c')],'updatedAt':_0x4bab34[_0xe422('0x72')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe422('0x38')](respondWithFilteredResult(_0x539c32,_0x52160d))[_0xe422('0x2b')](handleError(_0x539c32,null));};exports[_0xe422('0x73')]=function(_0x436127,_0x390037,_0x5f178d){var _0x3675bc={};var _0x4614d8={};var _0x4cca3c;var _0x51427d;return db[_0xe422('0x40')][_0xe422('0x64')]({'where':{'id':_0x436127[_0xe422('0x56')]['id']}})['then'](handleEntityNotFound(_0x390037,null))[_0xe422('0x38')](function(_0x5f134f){if(_0x5f134f){_0x4cca3c=_0x5f134f;_0x4614d8[_0xe422('0x45')]=_[_0xe422('0x47')](db[_0xe422('0x74')][_0xe422('0x41')]);_0x4614d8[_0xe422('0x46')]=_['keys'](_0x436127[_0xe422('0x46')]);_0x4614d8[_0xe422('0x48')]=_[_0xe422('0x49')](_0x4614d8[_0xe422('0x45')],_0x4614d8['query']);_0x3675bc[_0xe422('0x4a')]=_[_0xe422('0x49')](_0x4614d8['model'],qs['fields'](_0x436127[_0xe422('0x46')][_0xe422('0x4b')]));_0x3675bc[_0xe422('0x4a')]=_0x3675bc[_0xe422('0x4a')][_0xe422('0x57')]?_0x3675bc[_0xe422('0x4a')]:_0x4614d8[_0xe422('0x45')];_0x3675bc[_0xe422('0x66')]=qs['sort'](_0x436127[_0xe422('0x46')][_0xe422('0x4e')]);_0x3675bc['where']=qs[_0xe422('0x48')](_[_0xe422('0x75')](_0x436127[_0xe422('0x46')],_0x4614d8[_0xe422('0x48')]));if(_0x436127[_0xe422('0x46')][_0xe422('0x51')]){_0x3675bc[_0xe422('0x4f')]=_[_0xe422('0x52')](_0x3675bc['where'],{'$or':_[_0xe422('0x3f')](_0x3675bc['attributes'],function(_0x152edf){var _0x2cb7b8={};_0x2cb7b8[_0x152edf]={'$like':'%'+_0x436127[_0xe422('0x46')][_0xe422('0x51')]+'%'};return _0x2cb7b8;})});}_0x3675bc=_[_0xe422('0x52')]({},_0x3675bc,_0x436127[_0xe422('0x53')]);return _0x4cca3c[_0xe422('0x73')](_0x3675bc);}})[_0xe422('0x38')](function(_0x3d3ab4){if(_0x3d3ab4){_0x51427d=_0x3d3ab4[_0xe422('0x57')];if(!_0x436127['query'][_0xe422('0x4c')]('nolimit')){_0x3675bc['limit']=qs[_0xe422('0x31')](_0x436127[_0xe422('0x46')][_0xe422('0x31')]);_0x3675bc[_0xe422('0x2f')]=qs[_0xe422('0x2f')](_0x436127[_0xe422('0x46')][_0xe422('0x2f')]);}return _0x4cca3c[_0xe422('0x73')](_0x3675bc);}})[_0xe422('0x38')](function(_0x7e5bb8){if(_0x7e5bb8){return _0x7e5bb8?{'count':_0x51427d,'rows':_0x7e5bb8}:null;}})['then'](respondWithResult(_0x390037,null))[_0xe422('0x2b')](handleError(_0x390037,null));};exports['addTeams']=function(_0x2b3558,_0x26d669,_0x1522bd){var _0x2366be=_0x2b3558[_0xe422('0x61')][_0xe422('0x76')];return db[_0xe422('0x74')][_0xe422('0x68')]({'where':{'id':_0x2366be},'attributes':['id'],'include':[{'model':db[_0xe422('0x69')],'as':_0xe422('0x77'),'attributes':['id','name',_0xe422('0x78'),_0xe422('0x79'),_0xe422('0x7a')],'raw':!![]}]})[_0xe422('0x38')](function(_0x15bb4a){if(_0x15bb4a){var _0x39fbce=_[_0xe422('0x7b')](_0x15bb4a,function(_0x4e777b){var _0x79db9a=_0x4e777b[_0xe422('0x3a')]({'plain':!![]});return _0x79db9a[_0xe422('0x77')];});return db['ChatQueue']['find']({'where':{'id':_0x2b3558[_0xe422('0x56')]['id']}})[_0xe422('0x38')](function(_0x2191ed){return db[_0xe422('0x7c')][_0xe422('0x7d')](function(_0x175e70){return _0x2191ed[_0xe422('0x7e')](_0x2366be,{'transaction':_0x175e70})[_0xe422('0x38')](function(){return BPromise[_0xe422('0x7f')](_0x39fbce,function(_0x3f814a){return db[_0xe422('0x65')][_0xe422('0x80')]({'where':{'UserId':_0x3f814a['id'],'ChatQueueId':_0x2b3558['params']['id']},'transaction':_0x175e70});});})['then'](function(){_0x39fbce[_0xe422('0x81')](function(_0x41faec){socket['emit'](_0xe422('0x82'),{'UserId':_0x41faec['id'],'ChatQueueId':_0x2191ed['id']});});});});});}})[_0xe422('0x38')](respondWithStatusCode(_0x26d669,null))[_0xe422('0x2b')](handleError(_0x26d669,null));};exports[_0xe422('0x83')]=function(_0x3f3651,_0xd4acf9,_0x2dadc7){return db['Team']['findAll']({'where':{'id':_0x3f3651['query'][_0xe422('0x76')]},'attributes':['id'],'include':[{'model':db[_0xe422('0x69')],'as':_0xe422('0x77'),'attributes':['id'],'raw':!![]}]})[_0xe422('0x38')](handleEntityNotFound(_0xd4acf9,null))[_0xe422('0x38')](function(_0x52733d){var _0x5b3a5c=_[_0xe422('0x3f')](_0x52733d,'id');var _0x58e9a1=[];var _0x54b1de=[];var _0x5ae7ce=squel[_0xe422('0x84')]();_0x5ae7ce[_0xe422('0x85')](_0xe422('0x86'))['from'](_0xe422('0x87'),'tq')[_0xe422('0x88')]('user_has_teams','ut',_0xe422('0x89'))[_0xe422('0x4f')](_0xe422('0x8a'),_0x3f3651['params']['id']);for(var _0x72554d=0x0;_0x72554d<_0x52733d[_0xe422('0x57')];_0x72554d+=0x1){let _0x12698d=_0x52733d[_0x72554d];for(var _0x4a1839=0x0;_0x4a1839<_0x12698d[_0xe422('0x77')]['length'];_0x4a1839+=0x1){let _0x3b80a6=_0x12698d[_0xe422('0x77')][_0x4a1839];var _0x36abd4=_0x5ae7ce['clone']();_0x36abd4['where'](_0xe422('0x8b'),_0x3b80a6['id']);_0x54b1de[_0xe422('0x8c')](db[_0xe422('0x7c')][_0xe422('0x46')](_0x36abd4[_0xe422('0x8d')](),{'type':db[_0xe422('0x7c')][_0xe422('0x8e')][_0xe422('0x8f')]})[_0xe422('0x38')](function(_0x2c6533){if(_0x2c6533['length']===0x1){return _0x3b80a6['id'];}else{var _0xec08bd=_['every'](_[_0xe422('0x3f')](_0x2c6533,_0xe422('0x90')),function(_0x53c084){return _['includes'](_0x5b3a5c,_0x53c084);});if(_0xec08bd){return _0x3b80a6['id'];}}}));}}return BPromise[_0xe422('0x91')](_0x54b1de)[_0xe422('0x38')](function(_0x10b499){_0x58e9a1=_(_0x58e9a1)['union'](_0x10b499)['compact']()[_0xe422('0x92')]();return db[_0xe422('0x40')]['find']({'where':{'id':_0x3f3651[_0xe422('0x56')]['id']}})['then'](function(_0x18684b){return db['sequelize'][_0xe422('0x7d')](function(_0x195051){return _0x18684b['removeTeams'](_0x3f3651['query'][_0xe422('0x76')],{'transaction':_0x195051})[_0xe422('0x38')](function(){if(!_[_0xe422('0x93')](_0x58e9a1)){return _0x18684b[_0xe422('0x94')](_0x58e9a1,{'transaction':_0x195051});}})[_0xe422('0x38')](function(){_0x58e9a1[_0xe422('0x81')](function(_0x5d7956){socket['emit'](_0xe422('0x95'),{'UserId':_0x5d7956,'ChatQueueId':_0x18684b['id']});});});});});});})[_0xe422('0x38')](respondWithStatusCode(_0xd4acf9,null))['catch'](handleError(_0xd4acf9,null));};exports[_0xe422('0x96')]=function(_0x2777fc,_0x543504,_0x15607a){return db[_0xe422('0x40')][_0xe422('0x59')]({'where':{'id':_0x2777fc[_0xe422('0x56')]['id']}})[_0xe422('0x38')](handleEntityNotFound(_0x543504,null))[_0xe422('0x38')](function(_0x46c622){if(_0x46c622){return _0x46c622[_0xe422('0x96')](_0x2777fc[_0xe422('0x61')][_0xe422('0x76')],_[_0xe422('0x97')](_0x2777fc[_0xe422('0x61')],[_0xe422('0x76'),'id'])||{})[_0xe422('0x98')](function(_0x415b45){for(var _0x91c8e6=0x0;_0x91c8e6<_0x2777fc[_0xe422('0x61')][_0xe422('0x76')][_0xe422('0x57')];_0x91c8e6+=0x1){socket[_0xe422('0x99')](_0xe422('0x82'),{'UserId':Number(_0x2777fc[_0xe422('0x61')][_0xe422('0x76')][_0x91c8e6]),'ChatQueueId':Number(_0x2777fc['params']['id'])});}return _0x415b45;});}})[_0xe422('0x38')](respondWithResult(_0x543504,null))[_0xe422('0x2b')](handleError(_0x543504,null));};exports['removeAgents']=function(_0x100f0c,_0x33e489,_0x3a609e){return db[_0xe422('0x40')][_0xe422('0x59')]({'where':{'id':_0x100f0c['params']['id']}})['then'](handleEntityNotFound(_0x33e489,null))[_0xe422('0x38')](function(_0x339ed){if(_0x339ed){return _0x339ed['removeAgents'](_0x100f0c['query']['ids'])['then'](function(){if(_[_0xe422('0x9a')](_0x100f0c[_0xe422('0x46')]['ids'])){for(var _0x6095c=0x0;_0x6095c<_0x100f0c[_0xe422('0x46')][_0xe422('0x76')][_0xe422('0x57')];_0x6095c+=0x1){socket[_0xe422('0x99')](_0xe422('0x95'),{'UserId':Number(_0x100f0c['query']['ids'][_0x6095c]),'ChatQueueId':Number(_0x100f0c[_0xe422('0x56')]['id'])});}}else{socket['emit'](_0xe422('0x95'),{'UserId':Number(_0x100f0c[_0xe422('0x46')][_0xe422('0x76')]),'ChatQueueId':Number(_0x100f0c[_0xe422('0x56')]['id'])});}});}})[_0xe422('0x38')](respondWithStatusCode(_0x33e489,null))[_0xe422('0x2b')](handleError(_0x33e489,null));};exports[_0xe422('0x9b')]=function(_0x1825d1,_0x4ac702,_0x5466fb){var _0x33eca3={};var _0x6b5a73={};var _0x249484;var _0xe8c9eb;return db[_0xe422('0x40')][_0xe422('0x64')]({'where':{'id':_0x1825d1[_0xe422('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ac702,null))['then'](function(_0x3a30f4){if(_0x3a30f4){_0x249484=_0x3a30f4;_0x6b5a73[_0xe422('0x45')]=_['keys'](db['User'][_0xe422('0x41')]);_0x6b5a73[_0xe422('0x46')]=_['keys'](_0x1825d1['query']);_0x6b5a73[_0xe422('0x48')]=_[_0xe422('0x49')](_0x6b5a73[_0xe422('0x45')],_0x6b5a73[_0xe422('0x46')]);_0x33eca3['attributes']=_['intersection'](_0x6b5a73['model'],qs[_0xe422('0x4b')](_0x1825d1[_0xe422('0x46')]['fields']));_0x33eca3[_0xe422('0x4a')]=_0x33eca3[_0xe422('0x4a')]['length']?_0x33eca3[_0xe422('0x4a')]:_0x6b5a73[_0xe422('0x45')];_0x33eca3[_0xe422('0x66')]=qs[_0xe422('0x4e')](_0x1825d1[_0xe422('0x46')][_0xe422('0x4e')]);_0x33eca3[_0xe422('0x4f')]=qs[_0xe422('0x48')](_['pick'](_0x1825d1['query'],_0x6b5a73[_0xe422('0x48')]));if(_0x1825d1[_0xe422('0x46')][_0xe422('0x51')]){_0x33eca3['where']=_[_0xe422('0x52')](_0x33eca3[_0xe422('0x4f')],{'$or':_[_0xe422('0x3f')](_0x33eca3[_0xe422('0x4a')],function(_0xc97114){var _0x26b321={};_0x26b321[_0xc97114]={'$like':'%'+_0x1825d1['query'][_0xe422('0x51')]+'%'};return _0x26b321;})});}_0x33eca3=_[_0xe422('0x52')]({},_0x33eca3,_0x1825d1[_0xe422('0x53')]);return _0x249484[_0xe422('0x9b')](_0x33eca3);}})[_0xe422('0x38')](function(_0x835323){if(_0x835323){_0xe8c9eb=_0x835323[_0xe422('0x57')];if(!_0x1825d1['query'][_0xe422('0x4c')](_0xe422('0x4d'))){_0x33eca3[_0xe422('0x31')]=qs[_0xe422('0x31')](_0x1825d1[_0xe422('0x46')][_0xe422('0x31')]);_0x33eca3[_0xe422('0x2f')]=qs[_0xe422('0x2f')](_0x1825d1[_0xe422('0x46')][_0xe422('0x2f')]);}return _0x249484[_0xe422('0x9b')](_0x33eca3);}})[_0xe422('0x38')](function(_0x1ac226){if(_0x1ac226){return _0x1ac226?{'count':_0xe8c9eb,'rows':_0x1ac226}:null;}})[_0xe422('0x38')](respondWithResult(_0x4ac702,null))[_0xe422('0x2b')](handleError(_0x4ac702,null));}; \ No newline at end of file +var _0x227d=['userChatQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','set','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','end','stack','name','index','ChatQueue','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','rows','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getMembers','findOne','UserChatQueue','ChatQueueId','findAll','findAndCountAll','agent','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','findOrCreate','emit','removeTeams','User','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','length','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','transaction','isEmpty','forEach','userChatQueue:remove','addAgents','omit','spread'];(function(_0x3d9f11,_0x4811d7){var _0x2a735c=function(_0x447556){while(--_0x447556){_0x3d9f11['push'](_0x3d9f11['shift']());}};_0x2a735c(++_0x4811d7);}(_0x227d,0x1ce));var _0xd227=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x227d[_0x11a220];return _0x20d8fe;};'use strict';var emlformat=require(_0xd227('0x0'));var rimraf=require(_0xd227('0x1'));var zipdir=require(_0xd227('0x2'));var jsonpatch=require(_0xd227('0x3'));var rp=require('request-promise');var moment=require(_0xd227('0x4'));var BPromise=require(_0xd227('0x5'));var Mustache=require(_0xd227('0x6'));var util=require(_0xd227('0x7'));var path=require(_0xd227('0x8'));var sox=require('sox');var csv=require(_0xd227('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd227('0xa'));var _=require(_0xd227('0xb'));var squel=require(_0xd227('0xc'));var crypto=require(_0xd227('0xd'));var jsforce=require(_0xd227('0xe'));var deskjs=require(_0xd227('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd227('0x10'));var Redis=require(_0xd227('0x11'));var authService=require(_0xd227('0x12'));var qs=require(_0xd227('0x13'));var as=require(_0xd227('0x14'));var hardwareService=require(_0xd227('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd227('0x16'));var config=require(_0xd227('0x17'));var licenseUtil=require(_0xd227('0x18'));var db=require(_0xd227('0x19'))['db'];config[_0xd227('0x1a')]=_[_0xd227('0x1b')](config[_0xd227('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd227('0x1a')]));require('./chatQueue.socket')[_0xd227('0x1c')](socket);var jayson=require(_0xd227('0x1d'));var client=jayson[_0xd227('0x1e')][_0xd227('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2d978d,_0x3ef154,_0xab9518,_0x42a84b){return new BPromise(function(_0x26486c,_0x5e3c7a){var _0x1d07fe=_0x42a84b||client;return _0x1d07fe[_0xd227('0x20')](_0x2d978d,_0xab9518)[_0xd227('0x21')](function(_0x568868){logger[_0xd227('0x22')](_0xd227('0x23'),_0x3ef154,_0xd227('0x24'));logger[_0xd227('0x25')](_0xd227('0x26'),_0x3ef154,'request\x20sent',JSON[_0xd227('0x27')](_0x568868));if(_0x568868[_0xd227('0x28')]){if(_0x568868['error']['code']===0x1f4){logger[_0xd227('0x28')](_0xd227('0x23'),_0x3ef154,_0x568868[_0xd227('0x28')]['message']);return _0x5e3c7a(_0x568868[_0xd227('0x28')]['message']);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x3ef154,_0x568868[_0xd227('0x28')]['message']);return _0x26486c(_0x568868['error'][_0xd227('0x29')]);}else{logger['info'](_0xd227('0x23'),_0x3ef154,_0xd227('0x24'));_0x26486c(_0x568868[_0xd227('0x2a')][_0xd227('0x29')]);}})[_0xd227('0x2b')](function(_0x5b9a23){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3ef154,_0x5b9a23);_0x5e3c7a(_0x5b9a23);});});}function respondWithStatusCode(_0x27ea51,_0x4b3367){_0x4b3367=_0x4b3367||0xcc;return function(_0x4c4fd8){if(_0x4c4fd8){return _0x27ea51[_0xd227('0x2c')](_0x4b3367);}return _0x27ea51[_0xd227('0x2d')](_0x4b3367)['end']();};}function respondWithResult(_0x4172f4,_0x5ea7b6){_0x5ea7b6=_0x5ea7b6||0xc8;return function(_0x37ac42){if(_0x37ac42){return _0x4172f4[_0xd227('0x2d')](_0x5ea7b6)[_0xd227('0x2e')](_0x37ac42);}};}function respondWithFilteredResult(_0x2dde66,_0x24237c){return function(_0x19e5d6){if(_0x19e5d6){var _0x31c73f=typeof _0x24237c[_0xd227('0x2f')]==='undefined'&&typeof _0x24237c[_0xd227('0x30')]===_0xd227('0x31');var _0x42427f=_0x19e5d6['count'];var _0x4ff99c=_0x31c73f?0x0:_0x24237c[_0xd227('0x2f')];var _0x4bf6c2=_0x31c73f?_0x19e5d6['count']:_0x24237c[_0xd227('0x2f')]+_0x24237c[_0xd227('0x30')];var _0x240e5b;if(_0x4bf6c2>=_0x42427f){_0x4bf6c2=_0x42427f;_0x240e5b=0xc8;}else{_0x240e5b=0xce;}_0x2dde66[_0xd227('0x2d')](_0x240e5b);return _0x2dde66[_0xd227('0x32')]('Content-Range',_0x4ff99c+'-'+_0x4bf6c2+'/'+_0x42427f)['json'](_0x19e5d6);}return null;};}function patchUpdates(_0x2a8b60){return function(_0x331328){try{jsonpatch[_0xd227('0x33')](_0x331328,_0x2a8b60,!![]);}catch(_0x1d72e8){return BPromise[_0xd227('0x34')](_0x1d72e8);}return _0x331328[_0xd227('0x35')]();};}function saveUpdates(_0x4fd0d3,_0x290c29){return function(_0x452403){if(_0x452403){return _0x452403['update'](_0x4fd0d3)[_0xd227('0x21')](function(_0x3ba254){return _0x3ba254;});}return null;};}function removeEntity(_0x2ee3ae,_0x9079be){return function(_0x166162){if(_0x166162){return _0x166162[_0xd227('0x36')]()['then'](function(){var _0x1ad147=_0x166162[_0xd227('0x37')]({'plain':!![]});var _0x19f69b=_0xd227('0x38');return db[_0xd227('0x39')][_0xd227('0x36')]({'where':{'type':_0x19f69b,'resourceId':_0x1ad147['id']}})['then'](function(){return _0x166162;});})['then'](function(){_0x2ee3ae[_0xd227('0x2d')](0xcc)[_0xd227('0x3a')]();});}};}function handleEntityNotFound(_0x220e08,_0x41cb24){return function(_0x51c6df){if(!_0x51c6df){_0x220e08[_0xd227('0x2c')](0x194);}return _0x51c6df;};}function handleError(_0xd0ece9,_0x5fedc8){_0x5fedc8=_0x5fedc8||0x1f4;return function(_0x57e3ce){logger[_0xd227('0x28')](_0x57e3ce[_0xd227('0x3b')]);if(_0x57e3ce[_0xd227('0x3c')]){delete _0x57e3ce['name'];}_0xd0ece9[_0xd227('0x2d')](_0x5fedc8)['send'](_0x57e3ce);};}exports[_0xd227('0x3d')]=function(_0x556035,_0xc4b2dc){var _0x53acad={},_0x3ec7c2={},_0xfbfc65={'count':0x0,'rows':[]};var _0x12260a=_['map'](db[_0xd227('0x3e')]['rawAttributes'],function(_0x2496b0){return{'name':_0x2496b0[_0xd227('0x3f')],'type':_0x2496b0[_0xd227('0x40')]['key']};});_0x3ec7c2[_0xd227('0x41')]=_[_0xd227('0x42')](_0x12260a,'name');_0x3ec7c2[_0xd227('0x43')]=_[_0xd227('0x44')](_0x556035['query']);_0x3ec7c2[_0xd227('0x45')]=_[_0xd227('0x46')](_0x3ec7c2[_0xd227('0x41')],_0x3ec7c2[_0xd227('0x43')]);_0x53acad['attributes']=_['intersection'](_0x3ec7c2[_0xd227('0x41')],qs[_0xd227('0x47')](_0x556035[_0xd227('0x43')][_0xd227('0x47')]));_0x53acad['attributes']=_0x53acad['attributes']['length']?_0x53acad[_0xd227('0x48')]:_0x3ec7c2[_0xd227('0x41')];if(!_0x556035['query'][_0xd227('0x49')](_0xd227('0x4a'))){_0x53acad[_0xd227('0x30')]=qs['limit'](_0x556035[_0xd227('0x43')][_0xd227('0x30')]);_0x53acad['offset']=qs['offset'](_0x556035[_0xd227('0x43')][_0xd227('0x2f')]);}_0x53acad[_0xd227('0x4b')]=qs[_0xd227('0x4c')](_0x556035[_0xd227('0x43')][_0xd227('0x4c')]);_0x53acad[_0xd227('0x4d')]=qs['filters'](_[_0xd227('0x4e')](_0x556035['query'],_0x3ec7c2[_0xd227('0x45')]),_0x12260a);if(_0x556035[_0xd227('0x43')]['filter']){_0x53acad[_0xd227('0x4d')]=_[_0xd227('0x4f')](_0x53acad[_0xd227('0x4d')],{'$or':_[_0xd227('0x42')](_0x12260a,function(_0x2860de){if(_0x2860de[_0xd227('0x40')]!==_0xd227('0x50')){var _0x569bb3={};_0x569bb3[_0x2860de[_0xd227('0x3c')]]={'$like':'%'+_0x556035[_0xd227('0x43')][_0xd227('0x51')]+'%'};return _0x569bb3;}})});}_0x53acad=_['merge']({},_0x53acad,_0x556035[_0xd227('0x52')]);var _0xea2a86={'where':_0x53acad[_0xd227('0x4d')]};return db[_0xd227('0x3e')][_0xd227('0x53')](_0xea2a86)['then'](function(_0x541f47){_0xfbfc65[_0xd227('0x53')]=_0x541f47;if(_0x556035[_0xd227('0x43')][_0xd227('0x54')]){_0x53acad['include']=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x53acad);})[_0xd227('0x21')](function(_0x3452fb){_0xfbfc65[_0xd227('0x55')]=_0x3452fb;return _0xfbfc65;})[_0xd227('0x21')](respondWithFilteredResult(_0xc4b2dc,_0x53acad))[_0xd227('0x2b')](handleError(_0xc4b2dc,null));};exports[_0xd227('0x56')]=function(_0x1fe29d,_0x3bff9c){var _0x155f2d={'raw':!![],'where':{'id':_0x1fe29d[_0xd227('0x57')]['id']}},_0x17062f={};_0x17062f[_0xd227('0x41')]=_[_0xd227('0x44')](db[_0xd227('0x3e')][_0xd227('0x58')]);_0x17062f[_0xd227('0x43')]=_[_0xd227('0x44')](_0x1fe29d[_0xd227('0x43')]);_0x17062f['filters']=_['intersection'](_0x17062f[_0xd227('0x41')],_0x17062f[_0xd227('0x43')]);_0x155f2d[_0xd227('0x48')]=_[_0xd227('0x46')](_0x17062f['model'],qs['fields'](_0x1fe29d[_0xd227('0x43')][_0xd227('0x47')]));_0x155f2d[_0xd227('0x48')]=_0x155f2d[_0xd227('0x48')]['length']?_0x155f2d[_0xd227('0x48')]:_0x17062f['model'];if(_0x1fe29d[_0xd227('0x43')][_0xd227('0x54')]){_0x155f2d[_0xd227('0x59')]=[{'all':!![]}];}_0x155f2d=_['merge']({},_0x155f2d,_0x1fe29d['options']);return db[_0xd227('0x3e')][_0xd227('0x5a')](_0x155f2d)[_0xd227('0x21')](handleEntityNotFound(_0x3bff9c,null))[_0xd227('0x21')](respondWithResult(_0x3bff9c,null))['catch'](handleError(_0x3bff9c,null));};exports[_0xd227('0x5b')]=function(_0x34d866,_0x228ace){return db[_0xd227('0x3e')][_0xd227('0x5b')](_0x34d866['body'],{})['then'](function(_0x464aac){var _0x2b9878=_0x34d866[_0xd227('0x5c')][_0xd227('0x37')]({'plain':!![]});if(!_0x2b9878)throw new Error(_0xd227('0x5d'));if(_0x2b9878['role']===_0xd227('0x5c')){var _0x56b872=_0x464aac[_0xd227('0x37')]({'plain':!![]});var _0x40b1ef=_0xd227('0x38');return db[_0xd227('0x5e')][_0xd227('0x5a')]({'where':{'name':_0x40b1ef,'userProfileId':_0x2b9878[_0xd227('0x5f')]},'raw':!![]})[_0xd227('0x21')](function(_0x4581db){if(_0x4581db&&_0x4581db[_0xd227('0x60')]===0x0){return db[_0xd227('0x39')][_0xd227('0x5b')]({'name':_0x56b872[_0xd227('0x3c')],'resourceId':_0x56b872['id'],'type':_0x4581db[_0xd227('0x3c')],'sectionId':_0x4581db['id']},{})[_0xd227('0x21')](function(){return _0x464aac;});}else{return _0x464aac;}})[_0xd227('0x2b')](function(_0x516d34){logger['error'](_0xd227('0x61'),_0x516d34);throw _0x516d34;});}return _0x464aac;})[_0xd227('0x21')](respondWithResult(_0x228ace,0xc9))[_0xd227('0x2b')](handleError(_0x228ace,null));};exports[_0xd227('0x62')]=function(_0x456b27,_0x5011aa){if(_0x456b27['body']['id']){delete _0x456b27[_0xd227('0x63')]['id'];}return db['ChatQueue'][_0xd227('0x5a')]({'where':{'id':_0x456b27['params']['id']}})['then'](handleEntityNotFound(_0x5011aa,null))[_0xd227('0x21')](saveUpdates(_0x456b27['body'],null))[_0xd227('0x21')](respondWithResult(_0x5011aa,null))['catch'](handleError(_0x5011aa,null));};exports[_0xd227('0x36')]=function(_0x30704d,_0x43a54d){return db[_0xd227('0x3e')][_0xd227('0x5a')]({'where':{'id':_0x30704d[_0xd227('0x57')]['id']}})['then'](handleEntityNotFound(_0x43a54d,null))['then'](removeEntity(_0x43a54d,null))[_0xd227('0x2b')](handleError(_0x43a54d,null));};exports['describe']=function(_0x31cc16,_0x12db17){return db['ChatQueue']['describe']()[_0xd227('0x21')](respondWithResult(_0x12db17,null))['catch'](handleError(_0x12db17,null));};exports[_0xd227('0x64')]=function(_0x2df8bc,_0xfc9a85,_0x428608){var _0x25a94b={'raw':!![],'where':{}},_0x2d32fe={},_0x4c4c95;return db[_0xd227('0x3e')][_0xd227('0x65')]({'where':{'id':_0x2df8bc[_0xd227('0x57')]['id']}})[_0xd227('0x21')](handleEntityNotFound(_0xfc9a85,null))['then'](function(_0x3b02da){if(_0x3b02da){_0x4c4c95=_0x3b02da[_0xd227('0x37')]({'plain':!![]});_0x2d32fe[_0xd227('0x41')]=_[_0xd227('0x44')](db[_0xd227('0x66')][_0xd227('0x58')]);_0x2d32fe[_0xd227('0x43')]=_[_0xd227('0x44')](_0x2df8bc[_0xd227('0x43')]);_0x2d32fe[_0xd227('0x45')]=_[_0xd227('0x46')](_0x2d32fe[_0xd227('0x41')],_0x2d32fe['query']);_0x25a94b[_0xd227('0x48')]=_[_0xd227('0x46')](_0x2d32fe[_0xd227('0x41')],qs[_0xd227('0x47')](_0x2df8bc[_0xd227('0x43')][_0xd227('0x47')]));_0x25a94b[_0xd227('0x48')]=_0x25a94b[_0xd227('0x48')]['length']?_0x25a94b[_0xd227('0x48')]:_0x2d32fe['model'];if(!_0x2df8bc[_0xd227('0x43')][_0xd227('0x49')]('nolimit')){_0x25a94b['limit']=qs[_0xd227('0x30')](_0x2df8bc['query'][_0xd227('0x30')]);_0x25a94b[_0xd227('0x2f')]=qs[_0xd227('0x2f')](_0x2df8bc['query'][_0xd227('0x2f')]);}_0x25a94b['order']=qs[_0xd227('0x4c')](_0x2df8bc[_0xd227('0x43')][_0xd227('0x4c')]);_0x25a94b[_0xd227('0x4d')]=qs[_0xd227('0x45')](_['pick'](_0x2df8bc[_0xd227('0x43')],_0x2d32fe[_0xd227('0x45')]));_0x25a94b[_0xd227('0x4d')][_0xd227('0x67')]=_0x3b02da['id'];if(_0x2df8bc[_0xd227('0x43')]['filter']){_0x25a94b['where']=_[_0xd227('0x4f')](_0x25a94b[_0xd227('0x4d')],{'$or':_[_0xd227('0x42')](_0x25a94b[_0xd227('0x48')],function(_0x2b6706){var _0x409f31={};_0x409f31[_0x2b6706]={'$like':'%'+_0x2df8bc[_0xd227('0x43')]['filter']+'%'};return _0x409f31;})});}_0x25a94b=_[_0xd227('0x4f')]({},_0x25a94b,_0x2df8bc[_0xd227('0x52')]);return db[_0xd227('0x66')][_0xd227('0x68')](_0x25a94b);}})['then'](function(_0x2c0c65){if(_0x2c0c65){return db['User'][_0xd227('0x69')]({'where':{'id':_[_0xd227('0x42')](_0x2c0c65,'UserId'),'role':_0xd227('0x6a')},'attributes':['id','name','chatPause',_0xd227('0x6b'),_0xd227('0x6c')]});}})[_0xd227('0x21')](function(_0x11ff3b){if(_0x11ff3b){return{'count':_0x11ff3b[_0xd227('0x53')],'rows':_['map'](_0x11ff3b['rows'],function(_0x59ce30){return{'membername':_0x59ce30['name'],'UserId':_0x59ce30['id'],'queue_name':_0x4c4c95[_0xd227('0x3c')],'ChatQueueId':_0x4c4c95['id'],'interface':util['format'](_0xd227('0x6d'),_0xd227('0x6e'),_0x59ce30['name']),'penalty':0x0,'paused':_0x59ce30['chatPause'],'createdAt':_0x59ce30[_0xd227('0x6c')],'updatedAt':_0x59ce30[_0xd227('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xfc9a85,_0x25a94b))[_0xd227('0x2b')](handleError(_0xfc9a85,null));};exports[_0xd227('0x6f')]=function(_0x2e6ae7,_0x5279c3,_0x5e25d8){var _0x4cc305={};var _0x1f9226={};var _0x5c86fe;var _0x1b8f3e;return db[_0xd227('0x3e')][_0xd227('0x65')]({'where':{'id':_0x2e6ae7[_0xd227('0x57')]['id']}})[_0xd227('0x21')](handleEntityNotFound(_0x5279c3,null))[_0xd227('0x21')](function(_0xe17b5b){if(_0xe17b5b){_0x5c86fe=_0xe17b5b;_0x1f9226[_0xd227('0x41')]=_['keys'](db[_0xd227('0x70')][_0xd227('0x58')]);_0x1f9226[_0xd227('0x43')]=_[_0xd227('0x44')](_0x2e6ae7[_0xd227('0x43')]);_0x1f9226[_0xd227('0x45')]=_[_0xd227('0x46')](_0x1f9226['model'],_0x1f9226[_0xd227('0x43')]);_0x4cc305[_0xd227('0x48')]=_[_0xd227('0x46')](_0x1f9226['model'],qs[_0xd227('0x47')](_0x2e6ae7[_0xd227('0x43')][_0xd227('0x47')]));_0x4cc305['attributes']=_0x4cc305[_0xd227('0x48')]['length']?_0x4cc305[_0xd227('0x48')]:_0x1f9226[_0xd227('0x41')];_0x4cc305[_0xd227('0x4b')]=qs[_0xd227('0x4c')](_0x2e6ae7[_0xd227('0x43')][_0xd227('0x4c')]);_0x4cc305[_0xd227('0x4d')]=qs['filters'](_[_0xd227('0x4e')](_0x2e6ae7[_0xd227('0x43')],_0x1f9226[_0xd227('0x45')]));if(_0x2e6ae7['query'][_0xd227('0x51')]){_0x4cc305['where']=_[_0xd227('0x4f')](_0x4cc305[_0xd227('0x4d')],{'$or':_['map'](_0x4cc305[_0xd227('0x48')],function(_0x3b4450){var _0x189d58={};_0x189d58[_0x3b4450]={'$like':'%'+_0x2e6ae7[_0xd227('0x43')]['filter']+'%'};return _0x189d58;})});}_0x4cc305=_[_0xd227('0x4f')]({},_0x4cc305,_0x2e6ae7[_0xd227('0x52')]);return _0x5c86fe[_0xd227('0x6f')](_0x4cc305);}})[_0xd227('0x21')](function(_0x176e2a){if(_0x176e2a){_0x1b8f3e=_0x176e2a['length'];if(!_0x2e6ae7[_0xd227('0x43')][_0xd227('0x49')](_0xd227('0x4a'))){_0x4cc305[_0xd227('0x30')]=qs[_0xd227('0x30')](_0x2e6ae7[_0xd227('0x43')]['limit']);_0x4cc305['offset']=qs['offset'](_0x2e6ae7['query']['offset']);}return _0x5c86fe[_0xd227('0x6f')](_0x4cc305);}})[_0xd227('0x21')](function(_0x123430){if(_0x123430){return _0x123430?{'count':_0x1b8f3e,'rows':_0x123430}:null;}})[_0xd227('0x21')](respondWithResult(_0x5279c3,null))['catch'](handleError(_0x5279c3,null));};exports[_0xd227('0x71')]=function(_0x28208c,_0x292b67,_0x3cb753){var _0x1d3d1d=_0x28208c[_0xd227('0x63')][_0xd227('0x72')];return db[_0xd227('0x70')][_0xd227('0x68')]({'where':{'id':_0x1d3d1d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd227('0x3c'),_0xd227('0x73'),_0xd227('0x74'),'interface'],'raw':!![]}]})[_0xd227('0x21')](function(_0x62da7e){if(_0x62da7e){var _0x5c55fd=_[_0xd227('0x75')](_0x62da7e,function(_0x717a89){var _0x4cf908=_0x717a89[_0xd227('0x37')]({'plain':!![]});return _0x4cf908[_0xd227('0x76')];});return db['ChatQueue'][_0xd227('0x5a')]({'where':{'id':_0x28208c[_0xd227('0x57')]['id']}})[_0xd227('0x21')](function(_0x1af129){return db['sequelize']['transaction'](function(_0x7af114){return _0x1af129[_0xd227('0x71')](_0x1d3d1d,{'transaction':_0x7af114})[_0xd227('0x21')](function(){return BPromise['each'](_0x5c55fd,function(_0x4d9eea){return db[_0xd227('0x66')][_0xd227('0x77')]({'where':{'UserId':_0x4d9eea['id'],'ChatQueueId':_0x28208c[_0xd227('0x57')]['id']},'transaction':_0x7af114});});})[_0xd227('0x21')](function(){_0x5c55fd['forEach'](function(_0x298817){socket[_0xd227('0x78')]('userChatQueue:save',{'UserId':_0x298817['id'],'ChatQueueId':_0x1af129['id']});});});});});}})[_0xd227('0x21')](respondWithStatusCode(_0x292b67,null))['catch'](handleError(_0x292b67,null));};exports[_0xd227('0x79')]=function(_0x268946,_0x364a62,_0x21d6b2){return db[_0xd227('0x70')][_0xd227('0x68')]({'where':{'id':_0x268946[_0xd227('0x43')][_0xd227('0x72')]},'attributes':['id'],'include':[{'model':db[_0xd227('0x7a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd227('0x21')](handleEntityNotFound(_0x364a62,null))[_0xd227('0x21')](function(_0x5a9df0){var _0x9a6ca=_[_0xd227('0x42')](_0x5a9df0,'id');var _0x5bb99b=[];var _0x18b737=[];var _0xd72382=squel[_0xd227('0x7b')]();_0xd72382[_0xd227('0x7c')](_0xd227('0x7d'))['from'](_0xd227('0x7e'),'tq')[_0xd227('0x7f')](_0xd227('0x80'),'ut',_0xd227('0x81'))[_0xd227('0x4d')](_0xd227('0x82'),_0x268946['params']['id']);for(var _0x55df95=0x0;_0x55df95<_0x5a9df0[_0xd227('0x83')];_0x55df95+=0x1){let _0x47af97=_0x5a9df0[_0x55df95];for(var _0x4ac5f2=0x0;_0x4ac5f2<_0x47af97[_0xd227('0x76')][_0xd227('0x83')];_0x4ac5f2+=0x1){let _0x42aa9c=_0x47af97['Agents'][_0x4ac5f2];var _0x25005f=_0xd72382['clone']();_0x25005f[_0xd227('0x4d')](_0xd227('0x84'),_0x42aa9c['id']);_0x18b737[_0xd227('0x85')](db[_0xd227('0x86')]['query'](_0x25005f[_0xd227('0x87')](),{'type':db[_0xd227('0x86')][_0xd227('0x88')][_0xd227('0x89')]})[_0xd227('0x21')](function(_0x16eb7a){if(_0x16eb7a['length']===0x1){return _0x42aa9c['id'];}else{var _0x42e734=_['every'](_[_0xd227('0x42')](_0x16eb7a,_0xd227('0x8a')),function(_0x2983d7){return _[_0xd227('0x8b')](_0x9a6ca,_0x2983d7);});if(_0x42e734){return _0x42aa9c['id'];}}}));}}return BPromise['all'](_0x18b737)[_0xd227('0x21')](function(_0x4635d0){_0x5bb99b=_(_0x5bb99b)[_0xd227('0x8c')](_0x4635d0)[_0xd227('0x8d')]()[_0xd227('0x8e')]();return db[_0xd227('0x3e')][_0xd227('0x5a')]({'where':{'id':_0x268946[_0xd227('0x57')]['id']}})[_0xd227('0x21')](function(_0x4f24dc){return db['sequelize'][_0xd227('0x8f')](function(_0x3f4e24){return _0x4f24dc[_0xd227('0x79')](_0x268946[_0xd227('0x43')][_0xd227('0x72')],{'transaction':_0x3f4e24})['then'](function(){if(!_[_0xd227('0x90')](_0x5bb99b)){return _0x4f24dc['removeAgents'](_0x5bb99b,{'transaction':_0x3f4e24});}})['then'](function(){_0x5bb99b[_0xd227('0x91')](function(_0x1238ed){socket[_0xd227('0x78')](_0xd227('0x92'),{'UserId':_0x1238ed,'ChatQueueId':_0x4f24dc['id']});});});});});});})[_0xd227('0x21')](respondWithStatusCode(_0x364a62,null))[_0xd227('0x2b')](handleError(_0x364a62,null));};exports[_0xd227('0x93')]=function(_0x4435d4,_0x1174af,_0x471876){return db[_0xd227('0x3e')][_0xd227('0x5a')]({'where':{'id':_0x4435d4[_0xd227('0x57')]['id']}})[_0xd227('0x21')](handleEntityNotFound(_0x1174af,null))['then'](function(_0x5d774b){if(_0x5d774b){return _0x5d774b['addAgents'](_0x4435d4[_0xd227('0x63')]['ids'],_[_0xd227('0x94')](_0x4435d4[_0xd227('0x63')],['ids','id'])||{})[_0xd227('0x95')](function(_0x1cb3e7){for(var _0x1103ab=0x0;_0x1103ab<_0x4435d4['body'][_0xd227('0x72')][_0xd227('0x83')];_0x1103ab+=0x1){socket[_0xd227('0x78')](_0xd227('0x96'),{'UserId':Number(_0x4435d4[_0xd227('0x63')][_0xd227('0x72')][_0x1103ab]),'ChatQueueId':Number(_0x4435d4[_0xd227('0x57')]['id'])});}return _0x1cb3e7;});}})[_0xd227('0x21')](respondWithResult(_0x1174af,null))[_0xd227('0x2b')](handleError(_0x1174af,null));};exports[_0xd227('0x97')]=function(_0x104cbf,_0x1c816d,_0x2dfea0){return db[_0xd227('0x3e')][_0xd227('0x5a')]({'where':{'id':_0x104cbf['params']['id']}})[_0xd227('0x21')](handleEntityNotFound(_0x1c816d,null))['then'](function(_0x27df6a){if(_0x27df6a){return _0x27df6a[_0xd227('0x97')](_0x104cbf['query'][_0xd227('0x72')])[_0xd227('0x21')](function(){if(_['isArray'](_0x104cbf[_0xd227('0x43')][_0xd227('0x72')])){for(var _0x244b0b=0x0;_0x244b0b<_0x104cbf['query'][_0xd227('0x72')]['length'];_0x244b0b+=0x1){socket[_0xd227('0x78')](_0xd227('0x92'),{'UserId':Number(_0x104cbf[_0xd227('0x43')]['ids'][_0x244b0b]),'ChatQueueId':Number(_0x104cbf[_0xd227('0x57')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x104cbf[_0xd227('0x43')]['ids']),'ChatQueueId':Number(_0x104cbf[_0xd227('0x57')]['id'])});}});}})[_0xd227('0x21')](respondWithStatusCode(_0x1c816d,null))['catch'](handleError(_0x1c816d,null));};exports['getAgents']=function(_0x56a5b0,_0x368006,_0x2a5f6e){var _0x482385={};var _0x2d9c9f={};var _0x4a7fa9;var _0x20025d;return db[_0xd227('0x3e')][_0xd227('0x65')]({'where':{'id':_0x56a5b0[_0xd227('0x57')]['id']}})['then'](handleEntityNotFound(_0x368006,null))[_0xd227('0x21')](function(_0x47fe35){if(_0x47fe35){_0x4a7fa9=_0x47fe35;_0x2d9c9f['model']=_[_0xd227('0x44')](db['User'][_0xd227('0x58')]);_0x2d9c9f['query']=_[_0xd227('0x44')](_0x56a5b0[_0xd227('0x43')]);_0x2d9c9f['filters']=_['intersection'](_0x2d9c9f[_0xd227('0x41')],_0x2d9c9f['query']);_0x482385['attributes']=_[_0xd227('0x46')](_0x2d9c9f[_0xd227('0x41')],qs[_0xd227('0x47')](_0x56a5b0['query'][_0xd227('0x47')]));_0x482385[_0xd227('0x48')]=_0x482385['attributes'][_0xd227('0x83')]?_0x482385[_0xd227('0x48')]:_0x2d9c9f['model'];_0x482385[_0xd227('0x4b')]=qs[_0xd227('0x4c')](_0x56a5b0['query'][_0xd227('0x4c')]);_0x482385[_0xd227('0x4d')]=qs['filters'](_['pick'](_0x56a5b0['query'],_0x2d9c9f[_0xd227('0x45')]));if(_0x56a5b0[_0xd227('0x43')]['filter']){_0x482385[_0xd227('0x4d')]=_[_0xd227('0x4f')](_0x482385[_0xd227('0x4d')],{'$or':_['map'](_0x482385[_0xd227('0x48')],function(_0x259f06){var _0xdaa292={};_0xdaa292[_0x259f06]={'$like':'%'+_0x56a5b0[_0xd227('0x43')][_0xd227('0x51')]+'%'};return _0xdaa292;})});}_0x482385=_[_0xd227('0x4f')]({},_0x482385,_0x56a5b0[_0xd227('0x52')]);return _0x4a7fa9['getAgents'](_0x482385);}})[_0xd227('0x21')](function(_0x551ee6){if(_0x551ee6){_0x20025d=_0x551ee6[_0xd227('0x83')];if(!_0x56a5b0[_0xd227('0x43')][_0xd227('0x49')](_0xd227('0x4a'))){_0x482385['limit']=qs[_0xd227('0x30')](_0x56a5b0[_0xd227('0x43')][_0xd227('0x30')]);_0x482385[_0xd227('0x2f')]=qs['offset'](_0x56a5b0[_0xd227('0x43')][_0xd227('0x2f')]);}return _0x4a7fa9[_0xd227('0x98')](_0x482385);}})[_0xd227('0x21')](function(_0x354616){if(_0x354616){return _0x354616?{'count':_0x20025d,'rows':_0x354616}:null;}})[_0xd227('0x21')](respondWithResult(_0x368006,null))['catch'](handleError(_0x368006,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 52c4456..580e9d1 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 _0x7bae=['hook','exports','../../mysqldb','ChatQueue','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x7bae,0xaa));var _0xe7ba=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7bae[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xe7ba('0x0'))['db'][_0xe7ba('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe7ba('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe7ba('0x3')};function emitEvent(_0x2b7658){return function(_0x4c130b,_0x45bd66,_0x1d7476){ChatQueueEvents[_0xe7ba('0x4')](_0x2b7658+':'+_0x4c130b['id'],_0x4c130b);ChatQueueEvents[_0xe7ba('0x4')](_0x2b7658,_0x4c130b);_0x1d7476(null);};}for(var e in events){if(events[_0xe7ba('0x5')](e)){var event=events[e];ChatQueue[_0xe7ba('0x6')](e,emitEvent(event));}}module[_0xe7ba('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xc33a=['emit','hook','exports','../../mysqldb','ChatQueue','save','update','remove'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0xc33a,0xcb));var _0xac33=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0xc33a[_0x2a2166];return _0x3bcf50;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xac33('0x0'))['db'][_0xac33('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac33('0x2'),'afterUpdate':_0xac33('0x3'),'afterDestroy':_0xac33('0x4')};function emitEvent(_0x128c5f){return function(_0x4ae730,_0x4b5dd0,_0x445ec2){ChatQueueEvents['emit'](_0x128c5f+':'+_0x4ae730['id'],_0x4ae730);ChatQueueEvents[_0xac33('0x5')](_0x128c5f,_0x4ae730);_0x445ec2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xac33('0x6')](e,emitEvent(event));}}module[_0xac33('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 c38ffea..e889b8e 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 _0xe813=['rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','util','../../config/logger','bluebird','request-promise','path'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0xe813,0x150));var _0x3e81=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xe813[_0x5eef05];return _0x56d4b8;};'use strict';var _=require('lodash');var util=require(_0x3e81('0x0'));var logger=require(_0x3e81('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e81('0x2'));var rp=require(_0x3e81('0x3'));var fs=require('fs');var path=require(_0x3e81('0x4'));var rimraf=require(_0x3e81('0x5'));var config=require(_0x3e81('0x6'));var attributes=require(_0x3e81('0x7'));module[_0x3e81('0x8')]=function(_0x32db75,_0x45dcb8){return _0x32db75['define'](_0x3e81('0x9'),attributes,{'tableName':_0x3e81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ab1=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x34537a,_0x4984ac){var _0x2ac5f8=function(_0x2a12de){while(--_0x2a12de){_0x34537a['push'](_0x34537a['shift']());}};_0x2ac5f8(++_0x4984ac);}(_0x8ab1,0x111));var _0x18ab=function(_0x3d6b5b,_0x163153){_0x3d6b5b=_0x3d6b5b-0x0;var _0x3f8935=_0x8ab1[_0x3d6b5b];return _0x3f8935;};'use strict';var _=require(_0x18ab('0x0'));var util=require(_0x18ab('0x1'));var logger=require(_0x18ab('0x2'))(_0x18ab('0x3'));var moment=require(_0x18ab('0x4'));var BPromise=require(_0x18ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18ab('0x6'));var rimraf=require(_0x18ab('0x7'));var config=require(_0x18ab('0x8'));var attributes=require('./chatQueue.attributes');module[_0x18ab('0x9')]=function(_0x1d6960,_0x163a1a){return _0x1d6960[_0x18ab('0xa')]('ChatQueue',attributes,{'tableName':'chat_queues','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 4133792..a08c03e 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 _0xbcae=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetChatQueue','find','ShowChatQueue','lodash','util','moment'];(function(_0x1eb045,_0x5bbfc2){var _0x1ded38=function(_0x29c578){while(--_0x29c578){_0x1eb045['push'](_0x1eb045['shift']());}};_0x1ded38(++_0x5bbfc2);}(_0xbcae,0xa9));var _0xebca=function(_0x172db3,_0x2f2e82){_0x172db3=_0x172db3-0x0;var _0x39b245=_0xbcae[_0x172db3];return _0x39b245;};'use strict';var _=require(_0xebca('0x0'));var util=require(_0xebca('0x1'));var moment=require(_0xebca('0x2'));var BPromise=require(_0xebca('0x3'));var rs=require(_0xebca('0x4'));var fs=require('fs');var Redis=require(_0xebca('0x5'));var db=require(_0xebca('0x6'))['db'];var utils=require(_0xebca('0x7'));var logger=require(_0xebca('0x8'))(_0xebca('0x9'));var config=require('../../config/environment');var jayson=require(_0xebca('0xa'));var client=jayson[_0xebca('0xb')]['http']({'port':0x232a});config[_0xebca('0xc')]=_[_0xebca('0xd')](config[_0xebca('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xebca('0xe'))(new Redis(config[_0xebca('0xc')]));require(_0xebca('0xf'))[_0xebca('0x10')](socket);function respondWithRpcPromise(_0x198c66,_0x3c0b2a,_0x4e63b0){return new BPromise(function(_0x525679,_0x5d8909){return client[_0xebca('0x11')](_0x198c66,_0x4e63b0)[_0xebca('0x12')](function(_0x31c3a1){logger[_0xebca('0x13')](_0xebca('0x14'),_0x3c0b2a,'request\x20sent');logger[_0xebca('0x15')](_0xebca('0x16'),_0x3c0b2a,_0xebca('0x17'),JSON[_0xebca('0x18')](_0x31c3a1));if(_0x31c3a1[_0xebca('0x19')]){if(_0x31c3a1[_0xebca('0x19')][_0xebca('0x1a')]===0x1f4){logger[_0xebca('0x19')]('ChatQueue,\x20%s,\x20%s',_0x3c0b2a,_0x31c3a1['error'][_0xebca('0x1b')]);return _0x5d8909(_0x31c3a1['error'][_0xebca('0x1b')]);}logger[_0xebca('0x19')](_0xebca('0x14'),_0x3c0b2a,_0x31c3a1[_0xebca('0x19')]['message']);return _0x525679(_0x31c3a1[_0xebca('0x19')][_0xebca('0x1b')]);}else{logger[_0xebca('0x13')](_0xebca('0x14'),_0x3c0b2a,'request\x20sent');_0x525679(_0x31c3a1[_0xebca('0x1c')][_0xebca('0x1b')]);}})[_0xebca('0x1d')](function(_0x4b1b1e){logger[_0xebca('0x19')](_0xebca('0x14'),_0x3c0b2a,_0x4b1b1e);_0x5d8909(_0x4b1b1e);});});}exports['GetChatQueue']=function(_0x2c0546){var _0x1a7cc0=this;return new Promise(function(_0x37b271,_0x337ebb){return db[_0xebca('0x1e')][_0xebca('0x1f')]({'raw':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x21')]===undefined?!![]:![]:!![],'where':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x22')]||null:null,'attributes':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')]['attributes']||null:null,'limit':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x23')]||null:null,'include':_0x2c0546['options']?_0x2c0546['options'][_0xebca('0x24')]?_[_0xebca('0x25')](_0x2c0546['options'][_0xebca('0x24')],function(_0x163478){return{'model':db[_0x163478[_0xebca('0x26')]],'as':_0x163478['as'],'attributes':_0x163478['attributes'],'include':_0x163478[_0xebca('0x24')]?_[_0xebca('0x25')](_0x163478[_0xebca('0x24')],function(_0x2234af){return{'model':db[_0x2234af[_0xebca('0x26')]],'as':_0x2234af['as'],'attributes':_0x2234af[_0xebca('0x27')],'include':_0x2234af[_0xebca('0x24')]?_[_0xebca('0x25')](_0x2234af[_0xebca('0x24')],function(_0x98b94a){return{'model':db[_0x98b94a[_0xebca('0x26')]],'as':_0x98b94a['as'],'attributes':_0x98b94a[_0xebca('0x27')]};}):[]};}):[]};}):[]:[]})[_0xebca('0x12')](function(_0x3a49ba){logger[_0xebca('0x13')](_0xebca('0x28'),_0x2c0546);logger[_0xebca('0x15')](_0xebca('0x28'),_0x2c0546,JSON[_0xebca('0x18')](_0x3a49ba));_0x37b271(_0x3a49ba);})[_0xebca('0x1d')](function(_0x217398){logger[_0xebca('0x19')](_0xebca('0x28'),_0x217398[_0xebca('0x1b')],_0x2c0546);_0x337ebb(_0x1a7cc0[_0xebca('0x19')](0x1f4,_0x217398[_0xebca('0x1b')]));});});};exports['ShowChatQueue']=function(_0x1bdbbe){var _0xece17d=this;return new Promise(function(_0x4da32b,_0x594fbe){return db['ChatQueue'][_0xebca('0x29')]({'raw':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x21')]===undefined?!![]:![]:!![],'where':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x22')]||null:null,'attributes':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x27')]||null:null,'include':_0x1bdbbe['options']?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x24')]?_[_0xebca('0x25')](_0x1bdbbe[_0xebca('0x20')]['include'],function(_0x3c8eb3){return{'model':db[_0x3c8eb3[_0xebca('0x26')]],'as':_0x3c8eb3['as'],'attributes':_0x3c8eb3[_0xebca('0x27')],'include':_0x3c8eb3[_0xebca('0x24')]?_[_0xebca('0x25')](_0x3c8eb3[_0xebca('0x24')],function(_0x26c28f){return{'model':db[_0x26c28f[_0xebca('0x26')]],'as':_0x26c28f['as'],'attributes':_0x26c28f[_0xebca('0x27')],'include':_0x26c28f[_0xebca('0x24')]?_[_0xebca('0x25')](_0x26c28f[_0xebca('0x24')],function(_0x1c4a68){return{'model':db[_0x1c4a68[_0xebca('0x26')]],'as':_0x1c4a68['as'],'attributes':_0x1c4a68[_0xebca('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x176782){logger['info'](_0xebca('0x2a'),_0x1bdbbe);logger[_0xebca('0x15')]('ShowChatQueue',_0x1bdbbe,JSON[_0xebca('0x18')](_0x176782));_0x4da32b(_0x176782);})[_0xebca('0x1d')](function(_0x552fa1){logger[_0xebca('0x19')](_0xebca('0x2a'),_0x552fa1[_0xebca('0x1b')],_0x1bdbbe);_0x594fbe(_0xece17d['error'](0x1f4,_0x552fa1[_0xebca('0x1b')]));});});}; \ No newline at end of file +var _0xb1ef=['client','defaults','redis','localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','map','include','model','ShowChatQueue','find','raw','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfb1e('0x0'));var util=require('util');var moment=require(_0xfb1e('0x1'));var BPromise=require(_0xfb1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb1e('0x4'));var logger=require(_0xfb1e('0x5'))('rpc');var config=require(_0xfb1e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfb1e('0x7')]['http']({'port':0x232a});config['redis']=_[_0xfb1e('0x8')](config[_0xfb1e('0x9')],{'host':_0xfb1e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb1e('0x9')]));require(_0xfb1e('0xb'))[_0xfb1e('0xc')](socket);function respondWithRpcPromise(_0x512860,_0x3e648b,_0x5e4bfa){return new BPromise(function(_0x301566,_0x228c95){return client['request'](_0x512860,_0x5e4bfa)[_0xfb1e('0xd')](function(_0x273e58){logger[_0xfb1e('0xe')](_0xfb1e('0xf'),_0x3e648b,_0xfb1e('0x10'));logger[_0xfb1e('0x11')](_0xfb1e('0x12'),_0x3e648b,'request\x20sent',JSON[_0xfb1e('0x13')](_0x273e58));if(_0x273e58[_0xfb1e('0x14')]){if(_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x15')]===0x1f4){logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x273e58['error'][_0xfb1e('0x16')]);return _0x228c95(_0x273e58[_0xfb1e('0x14')]['message']);}logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x16')]);return _0x301566(_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x16')]);}else{logger[_0xfb1e('0xe')]('ChatQueue,\x20%s,\x20%s',_0x3e648b,_0xfb1e('0x10'));_0x301566(_0x273e58[_0xfb1e('0x17')][_0xfb1e('0x16')]);}})[_0xfb1e('0x18')](function(_0x25f742){logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x25f742);_0x228c95(_0x25f742);});});}exports[_0xfb1e('0x19')]=function(_0x517ddd){var _0x41c882=this;return new Promise(function(_0x1594de,_0x2b8c7b){return db[_0xfb1e('0x1a')]['findAll']({'raw':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1c')]||null:null,'attributes':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1d')]||null:null,'limit':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1e')]||null:null,'include':_0x517ddd['options']?_0x517ddd['options']['include']?_[_0xfb1e('0x1f')](_0x517ddd['options'][_0xfb1e('0x20')],function(_0x16c328){return{'model':db[_0x16c328[_0xfb1e('0x21')]],'as':_0x16c328['as'],'attributes':_0x16c328[_0xfb1e('0x1d')],'include':_0x16c328[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x16c328[_0xfb1e('0x20')],function(_0x2f6c0f){return{'model':db[_0x2f6c0f['model']],'as':_0x2f6c0f['as'],'attributes':_0x2f6c0f[_0xfb1e('0x1d')],'include':_0x2f6c0f[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x2f6c0f[_0xfb1e('0x20')],function(_0x3b891c){return{'model':db[_0x3b891c['model']],'as':_0x3b891c['as'],'attributes':_0x3b891c[_0xfb1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb1e('0xd')](function(_0x1266f6){logger[_0xfb1e('0xe')](_0xfb1e('0x19'),_0x517ddd);logger[_0xfb1e('0x11')](_0xfb1e('0x19'),_0x517ddd,JSON['stringify'](_0x1266f6));_0x1594de(_0x1266f6);})[_0xfb1e('0x18')](function(_0x399de0){logger[_0xfb1e('0x14')](_0xfb1e('0x19'),_0x399de0[_0xfb1e('0x16')],_0x517ddd);_0x2b8c7b(_0x41c882['error'](0x1f4,_0x399de0[_0xfb1e('0x16')]));});});};exports[_0xfb1e('0x22')]=function(_0xd8abfd){var _0x47d5c4=this;return new Promise(function(_0x4aecca,_0x204ad3){return db[_0xfb1e('0x1a')][_0xfb1e('0x23')]({'raw':_0xd8abfd[_0xfb1e('0x1b')]?_0xd8abfd[_0xfb1e('0x1b')][_0xfb1e('0x24')]===undefined?!![]:![]:!![],'where':_0xd8abfd['options']?_0xd8abfd['options'][_0xfb1e('0x1c')]||null:null,'attributes':_0xd8abfd[_0xfb1e('0x1b')]?_0xd8abfd[_0xfb1e('0x1b')]['attributes']||null:null,'include':_0xd8abfd['options']?_0xd8abfd['options'][_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0xd8abfd[_0xfb1e('0x1b')][_0xfb1e('0x20')],function(_0x40024b){return{'model':db[_0x40024b[_0xfb1e('0x21')]],'as':_0x40024b['as'],'attributes':_0x40024b[_0xfb1e('0x1d')],'include':_0x40024b[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x40024b[_0xfb1e('0x20')],function(_0x438ba0){return{'model':db[_0x438ba0[_0xfb1e('0x21')]],'as':_0x438ba0['as'],'attributes':_0x438ba0['attributes'],'include':_0x438ba0[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x438ba0[_0xfb1e('0x20')],function(_0x154b9f){return{'model':db[_0x154b9f[_0xfb1e('0x21')]],'as':_0x154b9f['as'],'attributes':_0x154b9f[_0xfb1e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34dde7){logger[_0xfb1e('0xe')]('ShowChatQueue',_0xd8abfd);logger[_0xfb1e('0x11')](_0xfb1e('0x22'),_0xd8abfd,JSON[_0xfb1e('0x13')](_0x34dde7));_0x4aecca(_0x34dde7);})[_0xfb1e('0x18')](function(_0x586e81){logger['error'](_0xfb1e('0x22'),_0x586e81['message'],_0xd8abfd);_0x204ad3(_0x47d5c4[_0xfb1e('0x14')](0x1f4,_0x586e81['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9c4c8ae..ac2b727 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 _0x70e0=['chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x4a32c8,_0x502532){var _0x22131c=function(_0x257d97){while(--_0x257d97){_0x4a32c8['push'](_0x4a32c8['shift']());}};_0x22131c(++_0x502532);}(_0x70e0,0x17b));var _0x070e=function(_0x1fb47d,_0x56ff96){_0x1fb47d=_0x1fb47d-0x0;var _0x37a0c6=_0x70e0[_0x1fb47d];return _0x37a0c6;};'use strict';var ChatQueueEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){ChatQueueEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);ChatQueueEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 236ecc8..a0cd68f 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x25a1f0,_0x1acb8d){_0x25a1f0=_0x25a1f0-0x0;var _0x1ef5ae=_0x3e74[_0x25a1f0];return _0x1ef5ae;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e74,0x175));var _0x43e7=function(_0x1c98ee,_0x14e39d){_0x1c98ee=_0x1c98ee-0x0;var _0x1b1ac5=_0x3e74[_0x1c98ee];return _0x1b1ac5;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ac74f67..307e8a7 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 _0xcb5c=['STRING','DATE','moment','exports'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xcb5c,0x96));var _0xccb5=function(_0x582cfb,_0x17e595){_0x582cfb=_0x582cfb-0x0;var _0x14f2d2=_0xcb5c[_0x582cfb];return _0x14f2d2;};'use strict';var moment=require(_0xccb5('0x0'));var Sequelize=require('sequelize');module[_0xccb5('0x1')]={'uniqueid':{'type':Sequelize[_0xccb5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xccb5('0x2')]},'joinAt':{'type':Sequelize[_0xccb5('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xccb5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xccb5('0x2')]}}; \ No newline at end of file +var _0xb416=['sequelize','STRING','DATE','moment'];(function(_0x4c8f01,_0x170514){var _0x30c1f7=function(_0x2aae01){while(--_0x2aae01){_0x4c8f01['push'](_0x4c8f01['shift']());}};_0x30c1f7(++_0x170514);}(_0xb416,0x173));var _0x6b41=function(_0x521f38,_0x30443d){_0x521f38=_0x521f38-0x0;var _0x2ddc87=_0xb416[_0x521f38];return _0x2ddc87;};'use strict';var moment=require(_0x6b41('0x0'));var Sequelize=require(_0x6b41('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6b41('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6b41('0x2')]},'joinAt':{'type':Sequelize[_0x6b41('0x3')]},'leaveAt':{'type':Sequelize[_0x6b41('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6b41('0x3')]},'reason':{'type':Sequelize[_0x6b41('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8379eec..14d5e6f 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 _0xd9a8=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x520d35,_0x5df6e5){var _0x59c2cc=function(_0xc71ebe){while(--_0xc71ebe){_0x520d35['push'](_0x520d35['shift']());}};_0x59c2cc(++_0x5df6e5);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x2b51a9,_0x5b9092){_0x2b51a9=_0x2b51a9-0x0;var _0x2de139=_0xd9a8[_0x2b51a9];return _0x2de139;};'use strict';var emlformat=require(_0x8d9a('0x0'));var rimraf=require(_0x8d9a('0x1'));var zipdir=require(_0x8d9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d9a('0x3'));var moment=require(_0x8d9a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8d9a('0x5'));var path=require(_0x8d9a('0x6'));var sox=require(_0x8d9a('0x7'));var csv=require(_0x8d9a('0x8'));var ejs=require(_0x8d9a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d9a('0xa'));var squel=require(_0x8d9a('0xb'));var crypto=require(_0x8d9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8d9a('0xd'));var toCsv=require(_0x8d9a('0x8'));var querystring=require(_0x8d9a('0xe'));var Papa=require('papaparse');var Redis=require(_0x8d9a('0xf'));var authService=require(_0x8d9a('0x10'));var qs=require(_0x8d9a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d9a('0x12'));var logger=require('../../config/logger')(_0x8d9a('0x13'));var utils=require(_0x8d9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8d9a('0x15'));var db=require(_0x8d9a('0x16'))['db'];function respondWithStatusCode(_0x4b200f,_0x63c291){_0x63c291=_0x63c291||0xcc;return function(_0x297911){if(_0x297911){return _0x4b200f[_0x8d9a('0x17')](_0x63c291);}return _0x4b200f[_0x8d9a('0x18')](_0x63c291)[_0x8d9a('0x19')]();};}function respondWithResult(_0x44443f,_0x3a18b8){_0x3a18b8=_0x3a18b8||0xc8;return function(_0x29ceeb){if(_0x29ceeb){return _0x44443f['status'](_0x3a18b8)[_0x8d9a('0x1a')](_0x29ceeb);}};}function respondWithFilteredResult(_0x36fd8c,_0x44f260){return function(_0x2bbee0){if(_0x2bbee0){var _0x2439db=typeof _0x44f260[_0x8d9a('0x1b')]==='undefined'&&typeof _0x44f260['limit']===_0x8d9a('0x1c');var _0x49202a=_0x2bbee0[_0x8d9a('0x1d')];var _0x374714=_0x2439db?0x0:_0x44f260['offset'];var _0x1cd883=_0x2439db?_0x2bbee0[_0x8d9a('0x1d')]:_0x44f260[_0x8d9a('0x1b')]+_0x44f260[_0x8d9a('0x1e')];var _0x56a730;if(_0x1cd883>=_0x49202a){_0x1cd883=_0x49202a;_0x56a730=0xc8;}else{_0x56a730=0xce;}_0x36fd8c[_0x8d9a('0x18')](_0x56a730);return _0x36fd8c[_0x8d9a('0x1f')](_0x8d9a('0x20'),_0x374714+'-'+_0x1cd883+'/'+_0x49202a)[_0x8d9a('0x1a')](_0x2bbee0);}return null;};}function patchUpdates(_0x4de98e){return function(_0x30c0f7){try{jsonpatch[_0x8d9a('0x21')](_0x30c0f7,_0x4de98e,!![]);}catch(_0x2fac0c){return BPromise['reject'](_0x2fac0c);}return _0x30c0f7[_0x8d9a('0x22')]();};}function saveUpdates(_0x4593be,_0xc6e7a){return function(_0xd36efd){if(_0xd36efd){return _0xd36efd[_0x8d9a('0x23')](_0x4593be)[_0x8d9a('0x24')](function(_0x401be0){return _0x401be0;});}return null;};}function removeEntity(_0x36185d,_0x80ea5a){return function(_0x33344b){if(_0x33344b){return _0x33344b[_0x8d9a('0x25')]()[_0x8d9a('0x24')](function(){_0x36185d[_0x8d9a('0x18')](0xcc)[_0x8d9a('0x19')]();});}};}function handleEntityNotFound(_0x522ace,_0x5e181e){return function(_0x3140f1){if(!_0x3140f1){_0x522ace[_0x8d9a('0x17')](0x194);}return _0x3140f1;};}function handleError(_0x574de9,_0x26c6f4){_0x26c6f4=_0x26c6f4||0x1f4;return function(_0x2b1752){logger[_0x8d9a('0x26')](_0x2b1752[_0x8d9a('0x27')]);if(_0x2b1752['name']){delete _0x2b1752[_0x8d9a('0x28')];}_0x574de9[_0x8d9a('0x18')](_0x26c6f4)[_0x8d9a('0x29')](_0x2b1752);};}exports[_0x8d9a('0x2a')]=function(_0x3fdd5e,_0xcc127c){var _0x4fcb3a={},_0x4f0471={},_0x86b1ef={'count':0x0,'rows':[]};var _0x24a7b7=_[_0x8d9a('0x2b')](db[_0x8d9a('0x2c')][_0x8d9a('0x2d')],function(_0x5e18df){return{'name':_0x5e18df[_0x8d9a('0x2e')],'type':_0x5e18df[_0x8d9a('0x2f')][_0x8d9a('0x30')]};});_0x4f0471[_0x8d9a('0x31')]=_['map'](_0x24a7b7,_0x8d9a('0x28'));_0x4f0471['query']=_[_0x8d9a('0x32')](_0x3fdd5e['query']);_0x4f0471[_0x8d9a('0x33')]=_[_0x8d9a('0x34')](_0x4f0471['model'],_0x4f0471[_0x8d9a('0x35')]);_0x4fcb3a[_0x8d9a('0x36')]=_[_0x8d9a('0x34')](_0x4f0471[_0x8d9a('0x31')],qs[_0x8d9a('0x37')](_0x3fdd5e[_0x8d9a('0x35')][_0x8d9a('0x37')]));_0x4fcb3a[_0x8d9a('0x36')]=_0x4fcb3a[_0x8d9a('0x36')][_0x8d9a('0x38')]?_0x4fcb3a[_0x8d9a('0x36')]:_0x4f0471[_0x8d9a('0x31')];if(!_0x3fdd5e[_0x8d9a('0x35')][_0x8d9a('0x39')](_0x8d9a('0x3a'))){_0x4fcb3a['limit']=qs[_0x8d9a('0x1e')](_0x3fdd5e[_0x8d9a('0x35')]['limit']);_0x4fcb3a[_0x8d9a('0x1b')]=qs[_0x8d9a('0x1b')](_0x3fdd5e[_0x8d9a('0x35')][_0x8d9a('0x1b')]);}_0x4fcb3a['order']=qs['sort'](_0x3fdd5e['query'][_0x8d9a('0x3b')]);_0x4fcb3a[_0x8d9a('0x3c')]=qs[_0x8d9a('0x33')](_[_0x8d9a('0x3d')](_0x3fdd5e[_0x8d9a('0x35')],_0x4f0471['filters']),_0x24a7b7);if(_0x3fdd5e['query'][_0x8d9a('0x3e')]){_0x4fcb3a['where']=_[_0x8d9a('0x3f')](_0x4fcb3a[_0x8d9a('0x3c')],{'$or':_['map'](_0x24a7b7,function(_0x488ced){if(_0x488ced[_0x8d9a('0x2f')]!==_0x8d9a('0x40')){var _0x4fb5e9={};_0x4fb5e9[_0x488ced[_0x8d9a('0x28')]]={'$like':'%'+_0x3fdd5e[_0x8d9a('0x35')][_0x8d9a('0x3e')]+'%'};return _0x4fb5e9;}})});}_0x4fcb3a=_[_0x8d9a('0x3f')]({},_0x4fcb3a,_0x3fdd5e['options']);var _0x10d3c2={'where':_0x4fcb3a['where']};return db[_0x8d9a('0x2c')][_0x8d9a('0x1d')](_0x10d3c2)[_0x8d9a('0x24')](function(_0x42e6ce){_0x86b1ef[_0x8d9a('0x1d')]=_0x42e6ce;if(_0x3fdd5e['query'][_0x8d9a('0x41')]){_0x4fcb3a['include']=[{'all':!![]}];}return db[_0x8d9a('0x2c')][_0x8d9a('0x42')](_0x4fcb3a);})[_0x8d9a('0x24')](function(_0x59c145){_0x86b1ef['rows']=_0x59c145;return _0x86b1ef;})['then'](respondWithFilteredResult(_0xcc127c,_0x4fcb3a))['catch'](handleError(_0xcc127c,null));};exports['show']=function(_0x239d3d,_0x3774d6){var _0x14320e={'raw':!![],'where':{'id':_0x239d3d[_0x8d9a('0x43')]['id']}},_0x2f6514={};_0x2f6514[_0x8d9a('0x31')]=_['keys'](db[_0x8d9a('0x2c')][_0x8d9a('0x2d')]);_0x2f6514[_0x8d9a('0x35')]=_[_0x8d9a('0x32')](_0x239d3d[_0x8d9a('0x35')]);_0x2f6514['filters']=_[_0x8d9a('0x34')](_0x2f6514[_0x8d9a('0x31')],_0x2f6514[_0x8d9a('0x35')]);_0x14320e[_0x8d9a('0x36')]=_[_0x8d9a('0x34')](_0x2f6514[_0x8d9a('0x31')],qs[_0x8d9a('0x37')](_0x239d3d[_0x8d9a('0x35')][_0x8d9a('0x37')]));_0x14320e['attributes']=_0x14320e[_0x8d9a('0x36')][_0x8d9a('0x38')]?_0x14320e[_0x8d9a('0x36')]:_0x2f6514['model'];if(_0x239d3d[_0x8d9a('0x35')]['includeAll']){_0x14320e['include']=[{'all':!![]}];}_0x14320e=_[_0x8d9a('0x3f')]({},_0x14320e,_0x239d3d['options']);return db[_0x8d9a('0x2c')][_0x8d9a('0x44')](_0x14320e)['then'](handleEntityNotFound(_0x3774d6,null))[_0x8d9a('0x24')](respondWithResult(_0x3774d6,null))[_0x8d9a('0x45')](handleError(_0x3774d6,null));};exports[_0x8d9a('0x46')]=function(_0xb416a5,_0x574506){return db[_0x8d9a('0x2c')][_0x8d9a('0x46')](_0xb416a5['body'],{})['then'](respondWithResult(_0x574506,0xc9))[_0x8d9a('0x45')](handleError(_0x574506,null));};exports[_0x8d9a('0x23')]=function(_0x47ed1f,_0x4b728d){if(_0x47ed1f[_0x8d9a('0x47')]['id']){delete _0x47ed1f[_0x8d9a('0x47')]['id'];}return db[_0x8d9a('0x2c')]['find']({'where':{'id':_0x47ed1f[_0x8d9a('0x43')]['id']}})[_0x8d9a('0x24')](handleEntityNotFound(_0x4b728d,null))[_0x8d9a('0x24')](saveUpdates(_0x47ed1f[_0x8d9a('0x47')],null))[_0x8d9a('0x24')](respondWithResult(_0x4b728d,null))[_0x8d9a('0x45')](handleError(_0x4b728d,null));};exports[_0x8d9a('0x25')]=function(_0x40aa95,_0x5f0115){return db[_0x8d9a('0x2c')][_0x8d9a('0x44')]({'where':{'id':_0x40aa95[_0x8d9a('0x43')]['id']}})[_0x8d9a('0x24')](handleEntityNotFound(_0x5f0115,null))[_0x8d9a('0x24')](removeEntity(_0x5f0115,null))[_0x8d9a('0x45')](handleError(_0x5f0115,null));};exports[_0x8d9a('0x48')]=function(_0x38719a,_0x30e04c){return db[_0x8d9a('0x2c')]['describe']()[_0x8d9a('0x24')](respondWithResult(_0x30e04c,null))['catch'](handleError(_0x30e04c,null));}; \ No newline at end of file +var _0x806d=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../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','apply','save','update','destroy','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes'];(function(_0x50494a,_0x481eae){var _0x2d23ec=function(_0x27a059){while(--_0x27a059){_0x50494a['push'](_0x50494a['shift']());}};_0x2d23ec(++_0x481eae);}(_0x806d,0x131));var _0xd806=function(_0xd4840b,_0x10d2de){_0xd4840b=_0xd4840b-0x0;var _0x521dd8=_0x806d[_0xd4840b];return _0x521dd8;};'use strict';var emlformat=require(_0xd806('0x0'));var rimraf=require(_0xd806('0x1'));var zipdir=require(_0xd806('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd806('0x3'));var Mustache=require(_0xd806('0x4'));var util=require('util');var path=require(_0xd806('0x5'));var sox=require('sox');var csv=require(_0xd806('0x6'));var ejs=require(_0xd806('0x7'));var fs=require('fs');var fs_extra=require(_0xd806('0x8'));var _=require(_0xd806('0x9'));var squel=require(_0xd806('0xa'));var crypto=require(_0xd806('0xb'));var jsforce=require(_0xd806('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd806('0x6'));var querystring=require(_0xd806('0xd'));var Papa=require(_0xd806('0xe'));var Redis=require(_0xd806('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd806('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd806('0x11'));var logger=require(_0xd806('0x12'))('api');var utils=require(_0xd806('0x13'));var config=require(_0xd806('0x14'));var licenseUtil=require(_0xd806('0x15'));var db=require(_0xd806('0x16'))['db'];function respondWithStatusCode(_0x451cba,_0x394569){_0x394569=_0x394569||0xcc;return function(_0x1c751c){if(_0x1c751c){return _0x451cba[_0xd806('0x17')](_0x394569);}return _0x451cba[_0xd806('0x18')](_0x394569)[_0xd806('0x19')]();};}function respondWithResult(_0x32f405,_0x47ef3b){_0x47ef3b=_0x47ef3b||0xc8;return function(_0x17d8bc){if(_0x17d8bc){return _0x32f405[_0xd806('0x18')](_0x47ef3b)[_0xd806('0x1a')](_0x17d8bc);}};}function respondWithFilteredResult(_0x4a2139,_0x7a8ed1){return function(_0x5a4ae4){if(_0x5a4ae4){var _0x33127f=typeof _0x7a8ed1[_0xd806('0x1b')]===_0xd806('0x1c')&&typeof _0x7a8ed1[_0xd806('0x1d')]===_0xd806('0x1c');var _0x1e7f7f=_0x5a4ae4[_0xd806('0x1e')];var _0x332eec=_0x33127f?0x0:_0x7a8ed1[_0xd806('0x1b')];var _0x5bd7a1=_0x33127f?_0x5a4ae4[_0xd806('0x1e')]:_0x7a8ed1[_0xd806('0x1b')]+_0x7a8ed1[_0xd806('0x1d')];var _0x5a3781;if(_0x5bd7a1>=_0x1e7f7f){_0x5bd7a1=_0x1e7f7f;_0x5a3781=0xc8;}else{_0x5a3781=0xce;}_0x4a2139[_0xd806('0x18')](_0x5a3781);return _0x4a2139['set'](_0xd806('0x1f'),_0x332eec+'-'+_0x5bd7a1+'/'+_0x1e7f7f)[_0xd806('0x1a')](_0x5a4ae4);}return null;};}function patchUpdates(_0x222a12){return function(_0x469f01){try{jsonpatch[_0xd806('0x20')](_0x469f01,_0x222a12,!![]);}catch(_0x58c632){return BPromise['reject'](_0x58c632);}return _0x469f01[_0xd806('0x21')]();};}function saveUpdates(_0x3680c1,_0x76392f){return function(_0x95450b){if(_0x95450b){return _0x95450b[_0xd806('0x22')](_0x3680c1)['then'](function(_0x500f9d){return _0x500f9d;});}return null;};}function removeEntity(_0x2a173b,_0x1335c9){return function(_0x17aa45){if(_0x17aa45){return _0x17aa45[_0xd806('0x23')]()[_0xd806('0x24')](function(){_0x2a173b['status'](0xcc)[_0xd806('0x19')]();});}};}function handleEntityNotFound(_0xf8df1e,_0x53782d){return function(_0x479744){if(!_0x479744){_0xf8df1e[_0xd806('0x17')](0x194);}return _0x479744;};}function handleError(_0x5acda8,_0x26bf96){_0x26bf96=_0x26bf96||0x1f4;return function(_0xe9664e){logger[_0xd806('0x25')](_0xe9664e[_0xd806('0x26')]);if(_0xe9664e[_0xd806('0x27')]){delete _0xe9664e['name'];}_0x5acda8['status'](_0x26bf96)[_0xd806('0x28')](_0xe9664e);};}exports[_0xd806('0x29')]=function(_0x10db6c,_0x4a7c5f){var _0x2b6b4d={},_0x25a2f0={},_0x358ae2={'count':0x0,'rows':[]};var _0x524893=_[_0xd806('0x2a')](db[_0xd806('0x2b')][_0xd806('0x2c')],function(_0x441e1d){return{'name':_0x441e1d[_0xd806('0x2d')],'type':_0x441e1d[_0xd806('0x2e')]['key']};});_0x25a2f0['model']=_['map'](_0x524893,'name');_0x25a2f0[_0xd806('0x2f')]=_[_0xd806('0x30')](_0x10db6c[_0xd806('0x2f')]);_0x25a2f0[_0xd806('0x31')]=_[_0xd806('0x32')](_0x25a2f0[_0xd806('0x33')],_0x25a2f0[_0xd806('0x2f')]);_0x2b6b4d[_0xd806('0x34')]=_[_0xd806('0x32')](_0x25a2f0['model'],qs[_0xd806('0x35')](_0x10db6c[_0xd806('0x2f')][_0xd806('0x35')]));_0x2b6b4d[_0xd806('0x34')]=_0x2b6b4d['attributes'][_0xd806('0x36')]?_0x2b6b4d['attributes']:_0x25a2f0[_0xd806('0x33')];if(!_0x10db6c['query']['hasOwnProperty'](_0xd806('0x37'))){_0x2b6b4d[_0xd806('0x1d')]=qs['limit'](_0x10db6c[_0xd806('0x2f')][_0xd806('0x1d')]);_0x2b6b4d['offset']=qs[_0xd806('0x1b')](_0x10db6c[_0xd806('0x2f')]['offset']);}_0x2b6b4d[_0xd806('0x38')]=qs[_0xd806('0x39')](_0x10db6c['query']['sort']);_0x2b6b4d[_0xd806('0x3a')]=qs[_0xd806('0x31')](_['pick'](_0x10db6c[_0xd806('0x2f')],_0x25a2f0[_0xd806('0x31')]),_0x524893);if(_0x10db6c['query']['filter']){_0x2b6b4d['where']=_[_0xd806('0x3b')](_0x2b6b4d[_0xd806('0x3a')],{'$or':_[_0xd806('0x2a')](_0x524893,function(_0x3e69f6){if(_0x3e69f6[_0xd806('0x2e')]!==_0xd806('0x3c')){var _0x370644={};_0x370644[_0x3e69f6[_0xd806('0x27')]]={'$like':'%'+_0x10db6c[_0xd806('0x2f')][_0xd806('0x3d')]+'%'};return _0x370644;}})});}_0x2b6b4d=_['merge']({},_0x2b6b4d,_0x10db6c[_0xd806('0x3e')]);var _0x5c1cbf={'where':_0x2b6b4d[_0xd806('0x3a')]};return db[_0xd806('0x2b')]['count'](_0x5c1cbf)[_0xd806('0x24')](function(_0x54ab4a){_0x358ae2[_0xd806('0x1e')]=_0x54ab4a;if(_0x10db6c['query']['includeAll']){_0x2b6b4d['include']=[{'all':!![]}];}return db[_0xd806('0x2b')]['findAll'](_0x2b6b4d);})[_0xd806('0x24')](function(_0x11a915){_0x358ae2[_0xd806('0x3f')]=_0x11a915;return _0x358ae2;})[_0xd806('0x24')](respondWithFilteredResult(_0x4a7c5f,_0x2b6b4d))[_0xd806('0x40')](handleError(_0x4a7c5f,null));};exports['show']=function(_0x4e7904,_0x3f8ab5){var _0x5a97ae={'raw':!![],'where':{'id':_0x4e7904[_0xd806('0x41')]['id']}},_0x1c4191={};_0x1c4191[_0xd806('0x33')]=_['keys'](db[_0xd806('0x2b')]['rawAttributes']);_0x1c4191[_0xd806('0x2f')]=_[_0xd806('0x30')](_0x4e7904[_0xd806('0x2f')]);_0x1c4191[_0xd806('0x31')]=_['intersection'](_0x1c4191[_0xd806('0x33')],_0x1c4191[_0xd806('0x2f')]);_0x5a97ae[_0xd806('0x34')]=_['intersection'](_0x1c4191[_0xd806('0x33')],qs['fields'](_0x4e7904[_0xd806('0x2f')][_0xd806('0x35')]));_0x5a97ae[_0xd806('0x34')]=_0x5a97ae[_0xd806('0x34')]['length']?_0x5a97ae['attributes']:_0x1c4191[_0xd806('0x33')];if(_0x4e7904[_0xd806('0x2f')]['includeAll']){_0x5a97ae['include']=[{'all':!![]}];}_0x5a97ae=_[_0xd806('0x3b')]({},_0x5a97ae,_0x4e7904[_0xd806('0x3e')]);return db[_0xd806('0x2b')][_0xd806('0x42')](_0x5a97ae)[_0xd806('0x24')](handleEntityNotFound(_0x3f8ab5,null))['then'](respondWithResult(_0x3f8ab5,null))['catch'](handleError(_0x3f8ab5,null));};exports[_0xd806('0x43')]=function(_0x5058ba,_0x5555da){return db[_0xd806('0x2b')][_0xd806('0x43')](_0x5058ba[_0xd806('0x44')],{})['then'](respondWithResult(_0x5555da,0xc9))[_0xd806('0x40')](handleError(_0x5555da,null));};exports['update']=function(_0x45a75c,_0x1e5da1){if(_0x45a75c[_0xd806('0x44')]['id']){delete _0x45a75c[_0xd806('0x44')]['id'];}return db[_0xd806('0x2b')]['find']({'where':{'id':_0x45a75c['params']['id']}})['then'](handleEntityNotFound(_0x1e5da1,null))[_0xd806('0x24')](saveUpdates(_0x45a75c[_0xd806('0x44')],null))['then'](respondWithResult(_0x1e5da1,null))['catch'](handleError(_0x1e5da1,null));};exports[_0xd806('0x23')]=function(_0x34166a,_0x527dcb){return db[_0xd806('0x2b')]['find']({'where':{'id':_0x34166a[_0xd806('0x41')]['id']}})[_0xd806('0x24')](handleEntityNotFound(_0x527dcb,null))['then'](removeEntity(_0x527dcb,null))[_0xd806('0x40')](handleError(_0x527dcb,null));};exports['describe']=function(_0x453f41,_0x48201f){return db[_0xd806('0x2b')][_0xd806('0x45')]()['then'](respondWithResult(_0x48201f,null))['catch'](handleError(_0x48201f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3545ba4..384fdf8 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1e2bd6,_0xff3d2){var _0x5eea45=function(_0xa5ac7d){while(--_0xa5ac7d){_0x1e2bd6['push'](_0x1e2bd6['shift']());}};_0x5eea45(++_0xff3d2);}(_0x757a,0xde));var _0xa757=function(_0x137638,_0x4e100b){_0x137638=_0x137638-0x0;var _0x4ad56a=_0x757a[_0x137638];return _0x4ad56a;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x2158e1,_0x124e99){var _0x1d205a=function(_0x11ebf7){while(--_0x11ebf7){_0x2158e1['push'](_0x2158e1['shift']());}};_0x1d205a(++_0x124e99);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 adb063e..34f45b0 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 _0x1cf3=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','options','raw','debug','UpdateChatQueueReport','update','body','where','attributes','lodash','util'];(function(_0x18ce16,_0x5ae41b){var _0x5e7a5b=function(_0x4e6539){while(--_0x4e6539){_0x18ce16['push'](_0x18ce16['shift']());}};_0x5e7a5b(++_0x5ae41b);}(_0x1cf3,0x1be));var _0x31cf=function(_0x3b4e3b,_0x398859){_0x3b4e3b=_0x3b4e3b-0x0;var _0x4de49a=_0x1cf3[_0x3b4e3b];return _0x4de49a;};'use strict';var _=require(_0x31cf('0x0'));var util=require(_0x31cf('0x1'));var moment=require(_0x31cf('0x2'));var BPromise=require(_0x31cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x31cf('0x5'));var logger=require(_0x31cf('0x6'))(_0x31cf('0x7'));var config=require(_0x31cf('0x8'));var jayson=require(_0x31cf('0x9'));var client=jayson[_0x31cf('0xa')][_0x31cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830b4,_0x2581c4,_0x6be80){return new BPromise(function(_0x3f7b2e,_0x3fa83e){return client[_0x31cf('0xc')](_0x1830b4,_0x6be80)[_0x31cf('0xd')](function(_0x56e8f6){logger[_0x31cf('0xe')](_0x31cf('0xf'),_0x2581c4,_0x31cf('0x10'));logger['debug'](_0x31cf('0x11'),_0x2581c4,_0x31cf('0x10'),JSON[_0x31cf('0x12')](_0x56e8f6));if(_0x56e8f6[_0x31cf('0x13')]){if(_0x56e8f6[_0x31cf('0x13')]['code']===0x1f4){logger['error'](_0x31cf('0xf'),_0x2581c4,_0x56e8f6[_0x31cf('0x13')][_0x31cf('0x14')]);return _0x3fa83e(_0x56e8f6[_0x31cf('0x13')]['message']);}logger[_0x31cf('0x13')](_0x31cf('0xf'),_0x2581c4,_0x56e8f6[_0x31cf('0x13')]['message']);return _0x3f7b2e(_0x56e8f6[_0x31cf('0x13')][_0x31cf('0x14')]);}else{logger[_0x31cf('0xe')](_0x31cf('0xf'),_0x2581c4,'request\x20sent');_0x3f7b2e(_0x56e8f6['result'][_0x31cf('0x14')]);}})[_0x31cf('0x15')](function(_0x2d5532){logger['error'](_0x31cf('0xf'),_0x2581c4,_0x2d5532);_0x3fa83e(_0x2d5532);});});}exports[_0x31cf('0x16')]=function(_0x54b753){var _0x560d11=this;return new Promise(function(_0x3c1bca,_0x521be0){return db[_0x31cf('0x17')]['create'](_0x54b753['body'],{'raw':_0x54b753[_0x31cf('0x18')]?_0x54b753[_0x31cf('0x18')][_0x31cf('0x19')]===undefined?!![]:![]:!![]})[_0x31cf('0xd')](function(_0x337447){logger[_0x31cf('0xe')](_0x31cf('0x16'),_0x54b753);logger[_0x31cf('0x1a')]('CreateChatQueueReport',_0x54b753,JSON[_0x31cf('0x12')](_0x337447));_0x3c1bca(_0x337447);})[_0x31cf('0x15')](function(_0x247a48){logger[_0x31cf('0x13')](_0x31cf('0x16'),_0x247a48[_0x31cf('0x14')],_0x54b753);_0x521be0(_0x560d11[_0x31cf('0x13')](0x1f4,_0x247a48['message']));});});};exports[_0x31cf('0x1b')]=function(_0x3f09d3){var _0x348b46=this;return new Promise(function(_0x816fbb,_0x29779f){return db[_0x31cf('0x17')][_0x31cf('0x1c')](_0x3f09d3[_0x31cf('0x1d')],{'raw':_0x3f09d3['options']?_0x3f09d3[_0x31cf('0x18')][_0x31cf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f09d3[_0x31cf('0x18')]?_0x3f09d3[_0x31cf('0x18')][_0x31cf('0x1e')]||null:null,'attributes':_0x3f09d3[_0x31cf('0x18')]?_0x3f09d3[_0x31cf('0x18')][_0x31cf('0x1f')]||null:null,'limit':_0x3f09d3[_0x31cf('0x18')]?_0x3f09d3[_0x31cf('0x18')]['limit']||null:null})[_0x31cf('0xd')](function(_0x148e36){logger['info'](_0x31cf('0x1b'),_0x3f09d3);logger['debug'](_0x31cf('0x1b'),_0x3f09d3,JSON[_0x31cf('0x12')](_0x148e36));_0x816fbb(_0x148e36);})[_0x31cf('0x15')](function(_0x31585a){logger[_0x31cf('0x13')](_0x31cf('0x1b'),_0x31585a[_0x31cf('0x14')],_0x3f09d3);_0x29779f(_0x348b46[_0x31cf('0x13')](0x1f4,_0x31585a[_0x31cf('0x14')]));});});}; \ No newline at end of file +var _0x2793=['options','raw','debug','UpdateChatQueueReport','update','body','attributes','limit','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2793,0x147));var _0x3279=function(_0x3d4407,_0x2735be){_0x3d4407=_0x3d4407-0x0;var _0x5ea719=_0x2793[_0x3d4407];return _0x5ea719;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3279('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3279('0x1'))['db'];var utils=require(_0x3279('0x2'));var logger=require(_0x3279('0x3'))(_0x3279('0x4'));var config=require('../../config/environment');var jayson=require(_0x3279('0x5'));var client=jayson[_0x3279('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x506fd7,_0x4e5169,_0xa9bb81){return new BPromise(function(_0x2fa6b4,_0x5e731e){return client[_0x3279('0x7')](_0x506fd7,_0xa9bb81)[_0x3279('0x8')](function(_0x2e327a){logger['info'](_0x3279('0x9'),_0x4e5169,_0x3279('0xa'));logger['debug'](_0x3279('0xb'),_0x4e5169,_0x3279('0xa'),JSON[_0x3279('0xc')](_0x2e327a));if(_0x2e327a[_0x3279('0xd')]){if(_0x2e327a['error'][_0x3279('0xe')]===0x1f4){logger['error'](_0x3279('0x9'),_0x4e5169,_0x2e327a[_0x3279('0xd')][_0x3279('0xf')]);return _0x5e731e(_0x2e327a[_0x3279('0xd')][_0x3279('0xf')]);}logger[_0x3279('0xd')](_0x3279('0x9'),_0x4e5169,_0x2e327a[_0x3279('0xd')]['message']);return _0x2fa6b4(_0x2e327a[_0x3279('0xd')][_0x3279('0xf')]);}else{logger[_0x3279('0x10')](_0x3279('0x9'),_0x4e5169,_0x3279('0xa'));_0x2fa6b4(_0x2e327a['result'][_0x3279('0xf')]);}})[_0x3279('0x11')](function(_0x53c81a){logger['error'](_0x3279('0x9'),_0x4e5169,_0x53c81a);_0x5e731e(_0x53c81a);});});}exports[_0x3279('0x12')]=function(_0x178db0){var _0x56017e=this;return new Promise(function(_0x58dba2,_0x5d7c9e){return db[_0x3279('0x13')][_0x3279('0x14')](_0x178db0['body'],{'raw':_0x178db0['options']?_0x178db0[_0x3279('0x15')][_0x3279('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x593911){logger[_0x3279('0x10')](_0x3279('0x12'),_0x178db0);logger[_0x3279('0x17')](_0x3279('0x12'),_0x178db0,JSON[_0x3279('0xc')](_0x593911));_0x58dba2(_0x593911);})['catch'](function(_0x19b45b){logger['error'](_0x3279('0x12'),_0x19b45b[_0x3279('0xf')],_0x178db0);_0x5d7c9e(_0x56017e[_0x3279('0xd')](0x1f4,_0x19b45b[_0x3279('0xf')]));});});};exports[_0x3279('0x18')]=function(_0x4e5cbe){var _0x7580c=this;return new Promise(function(_0x928109,_0x327b34){return db['ChatQueueReport'][_0x3279('0x19')](_0x4e5cbe[_0x3279('0x1a')],{'raw':_0x4e5cbe[_0x3279('0x15')]?_0x4e5cbe[_0x3279('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5cbe[_0x3279('0x15')]?_0x4e5cbe[_0x3279('0x15')]['where']||null:null,'attributes':_0x4e5cbe[_0x3279('0x15')]?_0x4e5cbe['options'][_0x3279('0x1b')]||null:null,'limit':_0x4e5cbe[_0x3279('0x15')]?_0x4e5cbe[_0x3279('0x15')][_0x3279('0x1c')]||null:null})[_0x3279('0x8')](function(_0x479735){logger[_0x3279('0x10')]('UpdateChatQueueReport',_0x4e5cbe);logger['debug']('UpdateChatQueueReport',_0x4e5cbe,JSON[_0x3279('0xc')](_0x479735));_0x928109(_0x479735);})[_0x3279('0x11')](function(_0x28a982){logger[_0x3279('0xd')]('UpdateChatQueueReport',_0x28a982[_0x3279('0xf')],_0x4e5cbe);_0x327b34(_0x7580c[_0x3279('0xd')](0x1f4,_0x28a982[_0x3279('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3a78528..bb071c3 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 _0x80af=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x391be0,_0x15d68f){var _0x5ee324=function(_0x282341){while(--_0x282341){_0x391be0['push'](_0x391be0['shift']());}};_0x5ee324(++_0x15d68f);}(_0x80af,0x1d7));var _0xf80a=function(_0x4c5fe6,_0x4af7aa){_0x4c5fe6=_0x4c5fe6-0x0;var _0x5cfd2f=_0x80af[_0x4c5fe6];return _0x5cfd2f;};'use strict';var multer=require(_0xf80a('0x0'));var util=require('util');var path=require(_0xf80a('0x1'));var timeout=require(_0xf80a('0x2'));var express=require(_0xf80a('0x3'));var router=express[_0xf80a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf80a('0x5'));var interaction=require(_0xf80a('0x6'));var config=require(_0xf80a('0x7'));var controller=require('./chatQueueReport.controller');router[_0xf80a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf80a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xf80a('0x8')](_0xf80a('0xa'),auth[_0xf80a('0xb')](),controller['show']);router[_0xf80a('0xc')]('/',auth[_0xf80a('0xb')](),controller[_0xf80a('0xd')]);router[_0xf80a('0xe')](_0xf80a('0xa'),auth[_0xf80a('0xb')](),controller[_0xf80a('0xf')]);router[_0xf80a('0x10')]('/:id',auth[_0xf80a('0xb')](),controller[_0xf80a('0x11')]);module[_0xf80a('0x12')]=router; \ No newline at end of file +var _0xb3d7=['./chatQueueReport.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x561aa2,_0x1d99c1){var _0x54df3c=function(_0x26a93b){while(--_0x26a93b){_0x561aa2['push'](_0x561aa2['shift']());}};_0x54df3c(++_0x1d99c1);}(_0xb3d7,0x1d3));var _0x7b3d=function(_0x5f24f9,_0x2681b1){_0x5f24f9=_0x5f24f9-0x0;var _0x35cbd6=_0xb3d7[_0x5f24f9];return _0x35cbd6;};'use strict';var multer=require(_0x7b3d('0x0'));var util=require(_0x7b3d('0x1'));var path=require('path');var timeout=require(_0x7b3d('0x2'));var express=require(_0x7b3d('0x3'));var router=express['Router']();var fs_extra=require(_0x7b3d('0x4'));var auth=require(_0x7b3d('0x5'));var interaction=require(_0x7b3d('0x6'));var config=require(_0x7b3d('0x7'));var controller=require(_0x7b3d('0x8'));router[_0x7b3d('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b3d('0xa')]);router['get'](_0x7b3d('0xb'),auth[_0x7b3d('0xc')](),controller['describe']);router[_0x7b3d('0x9')](_0x7b3d('0xd'),auth[_0x7b3d('0xc')](),controller['show']);router[_0x7b3d('0xe')]('/',auth[_0x7b3d('0xc')](),controller[_0x7b3d('0xf')]);router[_0x7b3d('0x10')](_0x7b3d('0xd'),auth[_0x7b3d('0xc')](),controller['update']);router[_0x7b3d('0x11')](_0x7b3d('0xd'),auth[_0x7b3d('0xc')](),controller[_0x7b3d('0x12')]);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 8f0ec44..f9852d3 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x315360,_0xbb70f8){var _0x3c468e=function(_0x28a9cf){while(--_0x28a9cf){_0x315360['push'](_0x315360['shift']());}};_0x3c468e(++_0xbb70f8);}(_0x70e0,0x17b));var _0x070e=function(_0x805712,_0x26fa38){_0x805712=_0x805712-0x0;var _0x4596eb=_0x70e0[_0x805712];return _0x4596eb;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0xb43b,0x1b2));var _0xbb43=function(_0x15f72b,_0x5083da){_0x15f72b=_0x15f72b-0x0;var _0x36f4fa=_0xb43b[_0x15f72b];return _0x36f4fa;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b698f81..1b9a44b 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 _0x36c9=['destroy','then','error','name','index','map','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','ChatTransferReport','includeAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x481a26,_0x13d43e){var _0x4653c7=function(_0x1fb5ae){while(--_0x1fb5ae){_0x481a26['push'](_0x481a26['shift']());}};_0x4653c7(++_0x13d43e);}(_0x36c9,0x193));var _0x936c=function(_0x10702d,_0x329cf3){_0x10702d=_0x10702d-0x0;var _0x3587d7=_0x36c9[_0x10702d];return _0x3587d7;};'use strict';var emlformat=require(_0x936c('0x0'));var rimraf=require(_0x936c('0x1'));var zipdir=require(_0x936c('0x2'));var jsonpatch=require(_0x936c('0x3'));var rp=require(_0x936c('0x4'));var moment=require('moment');var BPromise=require(_0x936c('0x5'));var Mustache=require(_0x936c('0x6'));var util=require(_0x936c('0x7'));var path=require(_0x936c('0x8'));var sox=require(_0x936c('0x9'));var csv=require(_0x936c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x936c('0xb'));var squel=require(_0x936c('0xc'));var crypto=require(_0x936c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x936c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x936c('0xf'));var Papa=require(_0x936c('0x10'));var Redis=require(_0x936c('0x11'));var authService=require(_0x936c('0x12'));var qs=require(_0x936c('0x13'));var as=require(_0x936c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x936c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x936c('0x16'));var db=require(_0x936c('0x17'))['db'];function respondWithStatusCode(_0xae675c,_0x13f428){_0x13f428=_0x13f428||0xcc;return function(_0x4eebd4){if(_0x4eebd4){return _0xae675c[_0x936c('0x18')](_0x13f428);}return _0xae675c['status'](_0x13f428)[_0x936c('0x19')]();};}function respondWithResult(_0x38088d,_0x266f36){_0x266f36=_0x266f36||0xc8;return function(_0xfed3db){if(_0xfed3db){return _0x38088d[_0x936c('0x1a')](_0x266f36)[_0x936c('0x1b')](_0xfed3db);}};}function respondWithFilteredResult(_0x385e8e,_0x164ef9){return function(_0x4d9cbf){if(_0x4d9cbf){var _0xb16489=typeof _0x164ef9[_0x936c('0x1c')]===_0x936c('0x1d')&&typeof _0x164ef9[_0x936c('0x1e')]===_0x936c('0x1d');var _0x16524d=_0x4d9cbf[_0x936c('0x1f')];var _0x359e51=_0xb16489?0x0:_0x164ef9[_0x936c('0x1c')];var _0x410499=_0xb16489?_0x4d9cbf['count']:_0x164ef9[_0x936c('0x1c')]+_0x164ef9[_0x936c('0x1e')];var _0x265040;if(_0x410499>=_0x16524d){_0x410499=_0x16524d;_0x265040=0xc8;}else{_0x265040=0xce;}_0x385e8e[_0x936c('0x1a')](_0x265040);return _0x385e8e[_0x936c('0x20')](_0x936c('0x21'),_0x359e51+'-'+_0x410499+'/'+_0x16524d)[_0x936c('0x1b')](_0x4d9cbf);}return null;};}function patchUpdates(_0x144fb0){return function(_0x8f21d0){try{jsonpatch['apply'](_0x8f21d0,_0x144fb0,!![]);}catch(_0x513b1a){return BPromise[_0x936c('0x22')](_0x513b1a);}return _0x8f21d0['save']();};}function saveUpdates(_0x5079d1,_0x4ddf52){return function(_0x241961){if(_0x241961){return _0x241961['update'](_0x5079d1)['then'](function(_0x246722){return _0x246722;});}return null;};}function removeEntity(_0x3e05f4,_0x4f4085){return function(_0x579fa3){if(_0x579fa3){return _0x579fa3[_0x936c('0x23')]()[_0x936c('0x24')](function(){_0x3e05f4[_0x936c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59979d,_0x182c52){return function(_0x3ac9a2){if(!_0x3ac9a2){_0x59979d[_0x936c('0x18')](0x194);}return _0x3ac9a2;};}function handleError(_0x142175,_0x3700e7){_0x3700e7=_0x3700e7||0x1f4;return function(_0x1a2f25){logger[_0x936c('0x25')](_0x1a2f25['stack']);if(_0x1a2f25[_0x936c('0x26')]){delete _0x1a2f25[_0x936c('0x26')];}_0x142175[_0x936c('0x1a')](_0x3700e7)['send'](_0x1a2f25);};}exports[_0x936c('0x27')]=function(_0x592657,_0x4f7943){var _0x12b215={},_0x3aa6ad={},_0x1f5696={'count':0x0,'rows':[]};var _0x51a3eb=_[_0x936c('0x28')](db['ChatTransferReport']['rawAttributes'],function(_0x560dda){return{'name':_0x560dda[_0x936c('0x29')],'type':_0x560dda[_0x936c('0x2a')][_0x936c('0x2b')]};});_0x3aa6ad[_0x936c('0x2c')]=_[_0x936c('0x28')](_0x51a3eb,_0x936c('0x26'));_0x3aa6ad[_0x936c('0x2d')]=_['keys'](_0x592657['query']);_0x3aa6ad['filters']=_[_0x936c('0x2e')](_0x3aa6ad['model'],_0x3aa6ad[_0x936c('0x2d')]);_0x12b215[_0x936c('0x2f')]=_[_0x936c('0x2e')](_0x3aa6ad['model'],qs[_0x936c('0x30')](_0x592657['query'][_0x936c('0x30')]));_0x12b215[_0x936c('0x2f')]=_0x12b215[_0x936c('0x2f')]['length']?_0x12b215[_0x936c('0x2f')]:_0x3aa6ad[_0x936c('0x2c')];if(!_0x592657['query'][_0x936c('0x31')](_0x936c('0x32'))){_0x12b215[_0x936c('0x1e')]=qs[_0x936c('0x1e')](_0x592657['query']['limit']);_0x12b215[_0x936c('0x1c')]=qs[_0x936c('0x1c')](_0x592657['query'][_0x936c('0x1c')]);}_0x12b215[_0x936c('0x33')]=qs[_0x936c('0x34')](_0x592657[_0x936c('0x2d')][_0x936c('0x34')]);_0x12b215['where']=qs[_0x936c('0x35')](_[_0x936c('0x36')](_0x592657['query'],_0x3aa6ad['filters']),_0x51a3eb);if(_0x592657['query'][_0x936c('0x37')]){_0x12b215[_0x936c('0x38')]=_[_0x936c('0x39')](_0x12b215[_0x936c('0x38')],{'$or':_['map'](_0x51a3eb,function(_0x147362){if(_0x147362['type']!=='VIRTUAL'){var _0x3889ed={};_0x3889ed[_0x147362[_0x936c('0x26')]]={'$like':'%'+_0x592657[_0x936c('0x2d')]['filter']+'%'};return _0x3889ed;}})});}_0x12b215=_[_0x936c('0x39')]({},_0x12b215,_0x592657[_0x936c('0x3a')]);var _0x166178={'where':_0x12b215[_0x936c('0x38')]};return db[_0x936c('0x3b')][_0x936c('0x1f')](_0x166178)[_0x936c('0x24')](function(_0xf49e18){_0x1f5696[_0x936c('0x1f')]=_0xf49e18;if(_0x592657[_0x936c('0x2d')][_0x936c('0x3c')]){_0x12b215['include']=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x12b215);})[_0x936c('0x24')](function(_0x351b6c){_0x1f5696[_0x936c('0x3d')]=_0x351b6c;return _0x1f5696;})[_0x936c('0x24')](respondWithFilteredResult(_0x4f7943,_0x12b215))[_0x936c('0x3e')](handleError(_0x4f7943,null));};exports[_0x936c('0x3f')]=function(_0x505dd2,_0x4cecad){var _0x1b3c39={'raw':!![],'where':{'id':_0x505dd2[_0x936c('0x40')]['id']}},_0x8530eb={};_0x8530eb[_0x936c('0x2c')]=_[_0x936c('0x41')](db[_0x936c('0x3b')][_0x936c('0x42')]);_0x8530eb[_0x936c('0x2d')]=_[_0x936c('0x41')](_0x505dd2[_0x936c('0x2d')]);_0x8530eb[_0x936c('0x35')]=_[_0x936c('0x2e')](_0x8530eb[_0x936c('0x2c')],_0x8530eb[_0x936c('0x2d')]);_0x1b3c39['attributes']=_[_0x936c('0x2e')](_0x8530eb[_0x936c('0x2c')],qs[_0x936c('0x30')](_0x505dd2['query'][_0x936c('0x30')]));_0x1b3c39['attributes']=_0x1b3c39[_0x936c('0x2f')]['length']?_0x1b3c39[_0x936c('0x2f')]:_0x8530eb[_0x936c('0x2c')];if(_0x505dd2[_0x936c('0x2d')][_0x936c('0x3c')]){_0x1b3c39[_0x936c('0x43')]=[{'all':!![]}];}_0x1b3c39=_['merge']({},_0x1b3c39,_0x505dd2[_0x936c('0x3a')]);return db[_0x936c('0x3b')][_0x936c('0x44')](_0x1b3c39)[_0x936c('0x24')](handleEntityNotFound(_0x4cecad,null))['then'](respondWithResult(_0x4cecad,null))[_0x936c('0x3e')](handleError(_0x4cecad,null));};exports[_0x936c('0x45')]=function(_0x5eda8d,_0x43db02){return db['ChatTransferReport'][_0x936c('0x45')](_0x5eda8d[_0x936c('0x46')],{})[_0x936c('0x24')](respondWithResult(_0x43db02,0xc9))[_0x936c('0x3e')](handleError(_0x43db02,null));};exports[_0x936c('0x47')]=function(_0x196117,_0x4eaf83){if(_0x196117[_0x936c('0x46')]['id']){delete _0x196117[_0x936c('0x46')]['id'];}return db[_0x936c('0x3b')][_0x936c('0x44')]({'where':{'id':_0x196117['params']['id']}})['then'](handleEntityNotFound(_0x4eaf83,null))['then'](saveUpdates(_0x196117['body'],null))[_0x936c('0x24')](respondWithResult(_0x4eaf83,null))[_0x936c('0x3e')](handleError(_0x4eaf83,null));};exports[_0x936c('0x23')]=function(_0x4dc68b,_0x34ef39){return db[_0x936c('0x3b')][_0x936c('0x44')]({'where':{'id':_0x4dc68b[_0x936c('0x40')]['id']}})[_0x936c('0x24')](handleEntityNotFound(_0x34ef39,null))[_0x936c('0x24')](removeEntity(_0x34ef39,null))[_0x936c('0x3e')](handleError(_0x34ef39,null));};exports[_0x936c('0x48')]=function(_0x56b3a3,_0x1e8fcf){return db[_0x936c('0x3b')][_0x936c('0x48')]()[_0x936c('0x24')](respondWithResult(_0x1e8fcf,null))[_0x936c('0x3e')](handleError(_0x1e8fcf,null));}; \ No newline at end of file +var _0x9587=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x9587,0x1c3));var _0x7958=function(_0x267a92,_0x144bb1){_0x267a92=_0x267a92-0x0;var _0x41c589=_0x9587[_0x267a92];return _0x41c589;};'use strict';var emlformat=require(_0x7958('0x0'));var rimraf=require(_0x7958('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7958('0x2'));var rp=require(_0x7958('0x3'));var moment=require(_0x7958('0x4'));var BPromise=require(_0x7958('0x5'));var Mustache=require(_0x7958('0x6'));var util=require(_0x7958('0x7'));var path=require(_0x7958('0x8'));var sox=require(_0x7958('0x9'));var csv=require(_0x7958('0xa'));var ejs=require(_0x7958('0xb'));var fs=require('fs');var fs_extra=require(_0x7958('0xc'));var _=require(_0x7958('0xd'));var squel=require(_0x7958('0xe'));var crypto=require(_0x7958('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7958('0x10'));var toCsv=require(_0x7958('0xa'));var querystring=require(_0x7958('0x11'));var Papa=require(_0x7958('0x12'));var Redis=require(_0x7958('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7958('0x14'));var as=require(_0x7958('0x15'));var hardwareService=require(_0x7958('0x16'));var logger=require(_0x7958('0x17'))('api');var utils=require(_0x7958('0x18'));var config=require(_0x7958('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7958('0x1a'))['db'];function respondWithStatusCode(_0x342b05,_0x43109f){_0x43109f=_0x43109f||0xcc;return function(_0xa088a9){if(_0xa088a9){return _0x342b05[_0x7958('0x1b')](_0x43109f);}return _0x342b05[_0x7958('0x1c')](_0x43109f)[_0x7958('0x1d')]();};}function respondWithResult(_0xdfabcb,_0x4e5d06){_0x4e5d06=_0x4e5d06||0xc8;return function(_0xadef1b){if(_0xadef1b){return _0xdfabcb[_0x7958('0x1c')](_0x4e5d06)[_0x7958('0x1e')](_0xadef1b);}};}function respondWithFilteredResult(_0x39c3b3,_0x33c64e){return function(_0x1a578f){if(_0x1a578f){var _0x4bc29b=typeof _0x33c64e['offset']===_0x7958('0x1f')&&typeof _0x33c64e[_0x7958('0x20')]===_0x7958('0x1f');var _0x47875e=_0x1a578f[_0x7958('0x21')];var _0x34482c=_0x4bc29b?0x0:_0x33c64e[_0x7958('0x22')];var _0x566da3=_0x4bc29b?_0x1a578f[_0x7958('0x21')]:_0x33c64e[_0x7958('0x22')]+_0x33c64e[_0x7958('0x20')];var _0x31b0c3;if(_0x566da3>=_0x47875e){_0x566da3=_0x47875e;_0x31b0c3=0xc8;}else{_0x31b0c3=0xce;}_0x39c3b3['status'](_0x31b0c3);return _0x39c3b3['set'](_0x7958('0x23'),_0x34482c+'-'+_0x566da3+'/'+_0x47875e)[_0x7958('0x1e')](_0x1a578f);}return null;};}function patchUpdates(_0x492af2){return function(_0x260d29){try{jsonpatch[_0x7958('0x24')](_0x260d29,_0x492af2,!![]);}catch(_0x106b8c){return BPromise[_0x7958('0x25')](_0x106b8c);}return _0x260d29[_0x7958('0x26')]();};}function saveUpdates(_0x24bae1,_0x577c53){return function(_0x1e897d){if(_0x1e897d){return _0x1e897d['update'](_0x24bae1)[_0x7958('0x27')](function(_0x592633){return _0x592633;});}return null;};}function removeEntity(_0x478d3a,_0x587eb7){return function(_0x5b0b8a){if(_0x5b0b8a){return _0x5b0b8a[_0x7958('0x28')]()[_0x7958('0x27')](function(){_0x478d3a[_0x7958('0x1c')](0xcc)[_0x7958('0x1d')]();});}};}function handleEntityNotFound(_0x5ae920,_0x5f4548){return function(_0x15bbff){if(!_0x15bbff){_0x5ae920[_0x7958('0x1b')](0x194);}return _0x15bbff;};}function handleError(_0x1c7cde,_0x228422){_0x228422=_0x228422||0x1f4;return function(_0xe9c6f3){logger['error'](_0xe9c6f3[_0x7958('0x29')]);if(_0xe9c6f3[_0x7958('0x2a')]){delete _0xe9c6f3[_0x7958('0x2a')];}_0x1c7cde['status'](_0x228422)[_0x7958('0x2b')](_0xe9c6f3);};}exports[_0x7958('0x2c')]=function(_0x17e823,_0x2de1e5){var _0x27cf4f={},_0x33a92e={},_0x54b902={'count':0x0,'rows':[]};var _0x3bdb2a=_[_0x7958('0x2d')](db[_0x7958('0x2e')][_0x7958('0x2f')],function(_0x31217e){return{'name':_0x31217e[_0x7958('0x30')],'type':_0x31217e['type'][_0x7958('0x31')]};});_0x33a92e['model']=_[_0x7958('0x2d')](_0x3bdb2a,_0x7958('0x2a'));_0x33a92e[_0x7958('0x32')]=_[_0x7958('0x33')](_0x17e823['query']);_0x33a92e[_0x7958('0x34')]=_[_0x7958('0x35')](_0x33a92e[_0x7958('0x36')],_0x33a92e[_0x7958('0x32')]);_0x27cf4f['attributes']=_[_0x7958('0x35')](_0x33a92e['model'],qs[_0x7958('0x37')](_0x17e823[_0x7958('0x32')]['fields']));_0x27cf4f[_0x7958('0x38')]=_0x27cf4f['attributes'][_0x7958('0x39')]?_0x27cf4f[_0x7958('0x38')]:_0x33a92e[_0x7958('0x36')];if(!_0x17e823[_0x7958('0x32')]['hasOwnProperty']('nolimit')){_0x27cf4f['limit']=qs[_0x7958('0x20')](_0x17e823[_0x7958('0x32')]['limit']);_0x27cf4f[_0x7958('0x22')]=qs[_0x7958('0x22')](_0x17e823['query'][_0x7958('0x22')]);}_0x27cf4f[_0x7958('0x3a')]=qs['sort'](_0x17e823[_0x7958('0x32')][_0x7958('0x3b')]);_0x27cf4f[_0x7958('0x3c')]=qs[_0x7958('0x34')](_[_0x7958('0x3d')](_0x17e823['query'],_0x33a92e[_0x7958('0x34')]),_0x3bdb2a);if(_0x17e823[_0x7958('0x32')][_0x7958('0x3e')]){_0x27cf4f[_0x7958('0x3c')]=_[_0x7958('0x3f')](_0x27cf4f[_0x7958('0x3c')],{'$or':_[_0x7958('0x2d')](_0x3bdb2a,function(_0x1b2e9a){if(_0x1b2e9a[_0x7958('0x40')]!==_0x7958('0x41')){var _0x3014dc={};_0x3014dc[_0x1b2e9a['name']]={'$like':'%'+_0x17e823[_0x7958('0x32')][_0x7958('0x3e')]+'%'};return _0x3014dc;}})});}_0x27cf4f=_[_0x7958('0x3f')]({},_0x27cf4f,_0x17e823[_0x7958('0x42')]);var _0x2c6920={'where':_0x27cf4f[_0x7958('0x3c')]};return db[_0x7958('0x2e')][_0x7958('0x21')](_0x2c6920)[_0x7958('0x27')](function(_0x458730){_0x54b902[_0x7958('0x21')]=_0x458730;if(_0x17e823['query'][_0x7958('0x43')]){_0x27cf4f[_0x7958('0x44')]=[{'all':!![]}];}return db[_0x7958('0x2e')]['findAll'](_0x27cf4f);})[_0x7958('0x27')](function(_0xf0229){_0x54b902[_0x7958('0x45')]=_0xf0229;return _0x54b902;})[_0x7958('0x27')](respondWithFilteredResult(_0x2de1e5,_0x27cf4f))['catch'](handleError(_0x2de1e5,null));};exports[_0x7958('0x46')]=function(_0x5e2220,_0x4046d8){var _0x1f8b65={'raw':!![],'where':{'id':_0x5e2220[_0x7958('0x47')]['id']}},_0x2526f6={};_0x2526f6[_0x7958('0x36')]=_['keys'](db[_0x7958('0x2e')][_0x7958('0x2f')]);_0x2526f6[_0x7958('0x32')]=_[_0x7958('0x33')](_0x5e2220['query']);_0x2526f6[_0x7958('0x34')]=_[_0x7958('0x35')](_0x2526f6[_0x7958('0x36')],_0x2526f6[_0x7958('0x32')]);_0x1f8b65['attributes']=_['intersection'](_0x2526f6[_0x7958('0x36')],qs[_0x7958('0x37')](_0x5e2220[_0x7958('0x32')][_0x7958('0x37')]));_0x1f8b65[_0x7958('0x38')]=_0x1f8b65['attributes'][_0x7958('0x39')]?_0x1f8b65[_0x7958('0x38')]:_0x2526f6[_0x7958('0x36')];if(_0x5e2220[_0x7958('0x32')][_0x7958('0x43')]){_0x1f8b65[_0x7958('0x44')]=[{'all':!![]}];}_0x1f8b65=_[_0x7958('0x3f')]({},_0x1f8b65,_0x5e2220[_0x7958('0x42')]);return db['ChatTransferReport'][_0x7958('0x48')](_0x1f8b65)[_0x7958('0x27')](handleEntityNotFound(_0x4046d8,null))['then'](respondWithResult(_0x4046d8,null))[_0x7958('0x49')](handleError(_0x4046d8,null));};exports[_0x7958('0x4a')]=function(_0x133fbb,_0x4af0bb){return db[_0x7958('0x2e')][_0x7958('0x4a')](_0x133fbb[_0x7958('0x4b')],{})[_0x7958('0x27')](respondWithResult(_0x4af0bb,0xc9))[_0x7958('0x49')](handleError(_0x4af0bb,null));};exports[_0x7958('0x4c')]=function(_0x3ae696,_0x57f456){if(_0x3ae696['body']['id']){delete _0x3ae696[_0x7958('0x4b')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x3ae696[_0x7958('0x47')]['id']}})[_0x7958('0x27')](handleEntityNotFound(_0x57f456,null))[_0x7958('0x27')](saveUpdates(_0x3ae696[_0x7958('0x4b')],null))[_0x7958('0x27')](respondWithResult(_0x57f456,null))[_0x7958('0x49')](handleError(_0x57f456,null));};exports['destroy']=function(_0x25ca12,_0x37ce5d){return db[_0x7958('0x2e')][_0x7958('0x48')]({'where':{'id':_0x25ca12[_0x7958('0x47')]['id']}})[_0x7958('0x27')](handleEntityNotFound(_0x37ce5d,null))['then'](removeEntity(_0x37ce5d,null))[_0x7958('0x49')](handleError(_0x37ce5d,null));};exports['describe']=function(_0x40c52d,_0x3c7363){return db['ChatTransferReport']['describe']()[_0x7958('0x27')](respondWithResult(_0x3c7363,null))[_0x7958('0x49')](handleError(_0x3c7363,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3b3169e..085dee3 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 _0xfb88=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','ChatTransferReport','uniqueid'];(function(_0x1028b0,_0x4c2027){var _0x59ea55=function(_0x2dc029){while(--_0x2dc029){_0x1028b0['push'](_0x1028b0['shift']());}};_0x59ea55(++_0x4c2027);}(_0xfb88,0x168));var _0x8fb8=function(_0x65f1b5,_0x50c1eb){_0x65f1b5=_0x65f1b5-0x0;var _0xd2fbda=_0xfb88[_0x65f1b5];return _0xd2fbda;};'use strict';var _=require(_0x8fb8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8fb8('0x1'));var moment=require('moment');var BPromise=require(_0x8fb8('0x2'));var rp=require(_0x8fb8('0x3'));var fs=require('fs');var path=require(_0x8fb8('0x4'));var rimraf=require(_0x8fb8('0x5'));var config=require(_0x8fb8('0x6'));var attributes=require(_0x8fb8('0x7'));module['exports']=function(_0x47c762,_0x4989d0){return _0x47c762['define'](_0x8fb8('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x8fb8('0x9'),'fields':[_0x8fb8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23c2=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','lodash'];(function(_0x2dea58,_0x59d6f0){var _0x2b23c2=function(_0x3e5c44){while(--_0x3e5c44){_0x2dea58['push'](_0x2dea58['shift']());}};_0x2b23c2(++_0x59d6f0);}(_0x23c2,0x137));var _0x223c=function(_0x3e9942,_0x12e0e6){_0x3e9942=_0x3e9942-0x0;var _0x2f7e3f=_0x23c2[_0x3e9942];return _0x2f7e3f;};'use strict';var _=require(_0x223c('0x0'));var util=require(_0x223c('0x1'));var logger=require(_0x223c('0x2'))(_0x223c('0x3'));var moment=require(_0x223c('0x4'));var BPromise=require(_0x223c('0x5'));var rp=require(_0x223c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x223c('0x7'));var config=require(_0x223c('0x8'));var attributes=require(_0x223c('0x9'));module['exports']=function(_0x29fcfc,_0x2b393b){return _0x29fcfc[_0x223c('0xa')](_0x223c('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x223c('0xc'),'fields':[_0x223c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 95cf067..9656a1f 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 _0xc3c9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x53bed2,_0x118207){var _0x446814=function(_0x9b7fa5){while(--_0x9b7fa5){_0x53bed2['push'](_0x53bed2['shift']());}};_0x446814(++_0x118207);}(_0xc3c9,0xb5));var _0x9c3c=function(_0x2882ef,_0x1c8891){_0x2882ef=_0x2882ef-0x0;var _0x48e899=_0xc3c9[_0x2882ef];return _0x48e899;};'use strict';var _=require(_0x9c3c('0x0'));var util=require(_0x9c3c('0x1'));var moment=require(_0x9c3c('0x2'));var BPromise=require(_0x9c3c('0x3'));var rs=require(_0x9c3c('0x4'));var fs=require('fs');var Redis=require(_0x9c3c('0x5'));var db=require(_0x9c3c('0x6'))['db'];var utils=require(_0x9c3c('0x7'));var logger=require(_0x9c3c('0x8'))(_0x9c3c('0x9'));var config=require(_0x9c3c('0xa'));var jayson=require(_0x9c3c('0xb'));var client=jayson[_0x9c3c('0xc')][_0x9c3c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24862a,_0x2f7ea7,_0x7f910c){return new BPromise(function(_0x302c75,_0x334fc9){return client[_0x9c3c('0xe')](_0x24862a,_0x7f910c)[_0x9c3c('0xf')](function(_0x59ae27){logger[_0x9c3c('0x10')](_0x9c3c('0x11'),_0x2f7ea7,'request\x20sent');logger['debug'](_0x9c3c('0x12'),_0x2f7ea7,_0x9c3c('0x13'),JSON[_0x9c3c('0x14')](_0x59ae27));if(_0x59ae27[_0x9c3c('0x15')]){if(_0x59ae27[_0x9c3c('0x15')][_0x9c3c('0x16')]===0x1f4){logger['error'](_0x9c3c('0x11'),_0x2f7ea7,_0x59ae27[_0x9c3c('0x15')][_0x9c3c('0x17')]);return _0x334fc9(_0x59ae27['error'][_0x9c3c('0x17')]);}logger[_0x9c3c('0x15')]('ChatTransferReport,\x20%s,\x20%s',_0x2f7ea7,_0x59ae27[_0x9c3c('0x15')]['message']);return _0x302c75(_0x59ae27[_0x9c3c('0x15')][_0x9c3c('0x17')]);}else{logger[_0x9c3c('0x10')](_0x9c3c('0x11'),_0x2f7ea7,'request\x20sent');_0x302c75(_0x59ae27[_0x9c3c('0x18')][_0x9c3c('0x17')]);}})[_0x9c3c('0x19')](function(_0x27a3e6){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2f7ea7,_0x27a3e6);_0x334fc9(_0x27a3e6);});});} \ No newline at end of file +var _0xfa8e=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x7f06e4,_0x202d5b){var _0x4dcf20=function(_0x4995aa){while(--_0x4995aa){_0x7f06e4['push'](_0x7f06e4['shift']());}};_0x4dcf20(++_0x202d5b);}(_0xfa8e,0x65));var _0xefa8=function(_0x16a3ce,_0x228263){_0x16a3ce=_0x16a3ce-0x0;var _0x42c198=_0xfa8e[_0x16a3ce];return _0x42c198;};'use strict';var _=require(_0xefa8('0x0'));var util=require(_0xefa8('0x1'));var moment=require(_0xefa8('0x2'));var BPromise=require(_0xefa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefa8('0x4'));var db=require(_0xefa8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xefa8('0x6'));var config=require('../../config/environment');var jayson=require(_0xefa8('0x7'));var client=jayson[_0xefa8('0x8')][_0xefa8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c7e5c,_0x2b9492,_0x46b332){return new BPromise(function(_0x32cac5,_0x11d063){return client[_0xefa8('0xa')](_0x5c7e5c,_0x46b332)[_0xefa8('0xb')](function(_0x46f140){logger[_0xefa8('0xc')](_0xefa8('0xd'),_0x2b9492,_0xefa8('0xe'));logger['debug'](_0xefa8('0xf'),_0x2b9492,'request\x20sent',JSON[_0xefa8('0x10')](_0x46f140));if(_0x46f140['error']){if(_0x46f140[_0xefa8('0x11')][_0xefa8('0x12')]===0x1f4){logger[_0xefa8('0x11')](_0xefa8('0xd'),_0x2b9492,_0x46f140[_0xefa8('0x11')]['message']);return _0x11d063(_0x46f140[_0xefa8('0x11')][_0xefa8('0x13')]);}logger[_0xefa8('0x11')](_0xefa8('0xd'),_0x2b9492,_0x46f140['error'][_0xefa8('0x13')]);return _0x32cac5(_0x46f140[_0xefa8('0x11')][_0xefa8('0x13')]);}else{logger[_0xefa8('0xc')](_0xefa8('0xd'),_0x2b9492,_0xefa8('0xe'));_0x32cac5(_0x46f140['result']['message']);}})[_0xefa8('0x14')](function(_0x127ddf){logger[_0xefa8('0x11')](_0xefa8('0xd'),_0x2b9492,_0x127ddf);_0x11d063(_0x127ddf);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 15baaec..3ce3979 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 _0xc8f1=['../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4426df,_0x16ca67){var _0x35f87e=function(_0x5ae461){while(--_0x5ae461){_0x4426df['push'](_0x4426df['shift']());}};_0x35f87e(++_0x16ca67);}(_0xc8f1,0x86));var _0x1c8f=function(_0xac1f40,_0x4b760a){_0xac1f40=_0xac1f40-0x0;var _0x28d7d6=_0xc8f1[_0xac1f40];return _0x28d7d6;};'use strict';var multer=require('multer');var util=require(_0x1c8f('0x0'));var path=require(_0x1c8f('0x1'));var timeout=require(_0x1c8f('0x2'));var express=require(_0x1c8f('0x3'));var router=express[_0x1c8f('0x4')]();var fs_extra=require(_0x1c8f('0x5'));var auth=require(_0x1c8f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c8f('0x7'));var controller=require('./chatTransferReport.controller');router[_0x1c8f('0x8')]('/',auth['isAuthenticated'](),controller[_0x1c8f('0x9')]);router[_0x1c8f('0x8')](_0x1c8f('0xa'),auth[_0x1c8f('0xb')](),controller['describe']);router[_0x1c8f('0x8')](_0x1c8f('0xc'),auth['isAuthenticated'](),controller[_0x1c8f('0xd')]);router[_0x1c8f('0xe')]('/',auth[_0x1c8f('0xb')](),controller['create']);router[_0x1c8f('0xf')](_0x1c8f('0xc'),auth[_0x1c8f('0xb')](),controller[_0x1c8f('0x10')]);router[_0x1c8f('0x11')](_0x1c8f('0xc'),auth['isAuthenticated'](),controller[_0x1c8f('0x12')]);module[_0x1c8f('0x13')]=router; \ No newline at end of file +var _0xe5d2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x11cb9d,_0x42e499){var _0x49a9e6=function(_0x458be0){while(--_0x458be0){_0x11cb9d['push'](_0x11cb9d['shift']());}};_0x49a9e6(++_0x42e499);}(_0xe5d2,0x18a));var _0x2e5d=function(_0x4fa2da,_0x8ab535){_0x4fa2da=_0x4fa2da-0x0;var _0xd6958a=_0xe5d2[_0x4fa2da];return _0xd6958a;};'use strict';var multer=require(_0x2e5d('0x0'));var util=require(_0x2e5d('0x1'));var path=require(_0x2e5d('0x2'));var timeout=require(_0x2e5d('0x3'));var express=require(_0x2e5d('0x4'));var router=express[_0x2e5d('0x5')]();var fs_extra=require(_0x2e5d('0x6'));var auth=require(_0x2e5d('0x7'));var interaction=require(_0x2e5d('0x8'));var config=require(_0x2e5d('0x9'));var controller=require('./chatTransferReport.controller');router[_0x2e5d('0xa')]('/',auth[_0x2e5d('0xb')](),controller[_0x2e5d('0xc')]);router[_0x2e5d('0xa')]('/describe',auth[_0x2e5d('0xb')](),controller['describe']);router[_0x2e5d('0xa')](_0x2e5d('0xd'),auth[_0x2e5d('0xb')](),controller[_0x2e5d('0xe')]);router[_0x2e5d('0xf')]('/',auth[_0x2e5d('0xb')](),controller['create']);router[_0x2e5d('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2e5d('0x11')](_0x2e5d('0xd'),auth[_0x2e5d('0xb')](),controller[_0x2e5d('0x12')]);module[_0x2e5d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 51f0a4b..cb4f16e 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 _0x750a=['System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','ENUM','thumb','TEXT','input','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa'];(function(_0x47bca8,_0x3fc0e5){var _0x419be9=function(_0x19a944){while(--_0x19a944){_0x47bca8['push'](_0x47bca8['shift']());}};_0x419be9(++_0x3fc0e5);}(_0x750a,0x140));var _0xa750=function(_0xbda2fa,_0x544664){_0xbda2fa=_0xbda2fa-0x0;var _0x3b62b7=_0x750a[_0xbda2fa];return _0x3b62b7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa750('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'unique':_0xa750('0x2')},'description':{'type':Sequelize[_0xa750('0x1')]},'mapKey':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x3')},'mapKeyOffline':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x3')},'key':{'type':Sequelize[_0xa750('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x4')},'customerAlias':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':_0xa750('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':_0xa750('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa750('0x1')]},'animation':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xa750('0x8')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x9')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0xa')},'offline_chat_button':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0xc')},'download_transcript':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa750('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xa750('0x12')]('star',_0xa750('0x13')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa750('0x14')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa750('0x15'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xa750('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xa750('0x3'),'type':_0xa750('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa750('0x16')](_0xa750('0x17'))?JSON[_0xa750('0x18')](this[_0xa750('0x16')](_0xa750('0x17'))):{};},'set':function(_0x3d52b3){return this[_0xa750('0x19')](_0xa750('0x17'),JSON[_0xa750('0x1a')](_0x3d52b3));}},'offlineForm':{'type':Sequelize[_0xa750('0x14')],'defaultValue':function(){return JSON[_0xa750('0x1a')]({'items':[{'type':_0xa750('0x15'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa750('0x3'),'type':_0xa750('0x3')},'variable':null},{'type':_0xa750('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0xa750('0x1c'),'helpText':_0xa750('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0xa750('0x16')](_0xa750('0x1e'))?JSON['parse'](this[_0xa750('0x16')](_0xa750('0x1e'))):{};},'set':function(_0x449bb7){return this[_0xa750('0x19')](_0xa750('0x1e'),JSON['stringify'](_0x449bb7));}},'token':{'type':Sequelize[_0xa750('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa750('0x1')]},'forwardOffline':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa750('0x1')]},'waitingTitle':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x1f')},'waitingMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x21')},'skipUnmanaged':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa750('0x14')]},'showAgentAvatar':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa750('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa750('0x22');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x23')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x24')},'verticalAlignment':{'type':Sequelize[_0xa750('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0x25')},'messagesAlignment':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x26')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xa750('0x14')]},'showCustomerAvatar':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa750('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa750('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa750('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0x28')},'systemAvatar':{'type':Sequelize[_0xa750('0x14')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa750('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![],'comment':_0xa750('0x2a'),'set':function(_0x1166ff){if(!_0x1166ff)this[_0xa750('0x19')]('mandatoryDispositionPauseId',null);this[_0xa750('0x19')](_0xa750('0x2b'),_0x1166ff);}},'vidaooEscalation':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa750('0x1')]},'vidaooTopic':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':_0xa750('0x2c')},'vidaooNote':{'type':Sequelize[_0xa750('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xa750('0x14')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa750('0x14')]}}; \ No newline at end of file +var _0xdace=['Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Skip','Feedback','ENUM','star','thumb','input','name','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0xdace,0xc5));var _0xedac=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xdace[_0x37b7b6];return _0x10c4c3;};'use strict';var Sequelize=require(_0xedac('0x0'));var rs=require('randomstring');module[_0xedac('0x1')]={'name':{'type':Sequelize[_0xedac('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xedac('0x2')]},'mapKey':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x3')},'mapKeyOffline':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xedac('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':_0xedac('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':_0xedac('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xedac('0x2')]},'animation':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xedac('0x8')),'defaultValue':_0xedac('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xedac('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xedac('0xb')},'offline_chat_button':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xc')},'header_offline':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xd')},'download_transcript':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xedac('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xedac('0xf')]},'closingQuestion':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x11')},'placeholderMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xc')},'skipMessageButton':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x14')},'ratingType':{'type':Sequelize[_0xedac('0x15')](_0xedac('0x16'),_0xedac('0x17')),'defaultValue':_0xedac('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xedac('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xedac('0x18'),'variable':null,'config':{'placeholder':_0xedac('0x19'),'type':'text','required':!![]},'props':{'title':_0xedac('0x19'),'helpText':''}},{'type':_0xedac('0x18'),'props':{'title':_0xedac('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xedac('0x3'),'type':_0xedac('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xedac('0x1a')]('onlineForm')?JSON[_0xedac('0x1b')](this[_0xedac('0x1a')](_0xedac('0x1c'))):{};},'set':function(_0x41ad8d){return this[_0xedac('0x1d')](_0xedac('0x1c'),JSON[_0xedac('0x1e')](_0x41ad8d));}},'offlineForm':{'type':Sequelize[_0xedac('0xf')],'defaultValue':function(){return JSON[_0xedac('0x1e')]({'items':[{'type':_0xedac('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xedac('0x3'),'type':_0xedac('0x3')},'variable':null},{'type':_0xedac('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xedac('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xedac('0x21'))?JSON[_0xedac('0x1b')](this[_0xedac('0x1a')](_0xedac('0x21'))):{};},'set':function(_0x555f1f){return this['setDataValue'](_0xedac('0x21'),JSON[_0xedac('0x1e')](_0x555f1f));}},'token':{'type':Sequelize[_0xedac('0x2')],'defaultValue':function(){return rs[_0xedac('0x22')]();}},'autoclose':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xedac('0x2')]},'waitingTitle':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xedac('0x24')},'offlineMessageBody':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x25')},'skipUnmanaged':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x13')},'sendUnmanaged':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xedac('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xedac('0x2')]},'notificationTemplate':{'type':Sequelize[_0xedac('0xf')],'defaultValue':function(){return _0xedac('0x26');}},'notificationSound':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xedac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x28')},'verticalAlignment':{'type':Sequelize[_0xedac('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x29')},'messagesAlignment':{'type':Sequelize[_0xedac('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xedac('0x2')]},'customerAvatar':{'type':Sequelize[_0xedac('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xedac('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xedac('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xedac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xedac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xedac('0x2')],'defaultValue':_0xedac('0x2b')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xedac('0xe')],'comment':_0xedac('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xedac('0x2d'),'set':function(_0x2fa832){if(!_0x2fa832)this['setDataValue'](_0xedac('0x2e'),null);this['setDataValue'](_0xedac('0x2f'),_0x2fa832);}},'vidaooEscalation':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xedac('0x2')]},'vidaooTopic':{'type':Sequelize[_0xedac('0x2')],'allowNull':![],'defaultValue':_0xedac('0x30')},'vidaooNote':{'type':Sequelize[_0xedac('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xedac('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xedac('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xedac('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 08dae84..87f4932 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 _0xa7c8=['stringify','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','close','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','notify','files','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','openNewInteraction','subjectOffline','mapValues','email','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','Interval','Intervals','virtual','custom','increment','all','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','Transaction','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','false','items','fromKey','Attachments','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','querystring','ioredis','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','html-to-text','jayson/promise','client','http','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','role','ChatWebsites','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','server/files/images/logos/','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','download','server/files/images/avatars/system_avatar.png','user-agent-parser','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Applications','List','account','list','applications','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','format'];(function(_0xceed74,_0x3f51e0){var _0x12de79=function(_0xe8a630){while(--_0xe8a630){_0xceed74['push'](_0xceed74['shift']());}};_0x12de79(++_0x3f51e0);}(_0xa7c8,0x76));var _0x8a7c=function(_0x24f44b,_0x1a0aa9){_0x24f44b=_0x24f44b-0x0;var _0x3acb63=_0xa7c8[_0x24f44b];return _0x3acb63;};'use strict';var BPromise=require(_0x8a7c('0x0'));var Mustache=require(_0x8a7c('0x1'));var util=require(_0x8a7c('0x2'));var path=require(_0x8a7c('0x3'));var ejs=require(_0x8a7c('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0x8a7c('0x5'));var Redis=require(_0x8a7c('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8a7c('0x7'));var config=require(_0x8a7c('0x8'));var db=require('../../mysqldb')['db'];config[_0x8a7c('0x9')]=_[_0x8a7c('0xa')](config[_0x8a7c('0x9')],{'host':_0x8a7c('0xb'),'port':0x18eb});var socket=require(_0x8a7c('0xc'))(new Redis(config[_0x8a7c('0x9')]));require('./chatWebsite.socket')[_0x8a7c('0xd')](socket);var htmlToText=require(_0x8a7c('0xe'));var jayson=require(_0x8a7c('0xf'));var client=jayson[_0x8a7c('0x10')][_0x8a7c('0x11')]({'port':0x232c});var client9002=jayson['client'][_0x8a7c('0x11')]({'port':0x232a});var client9003=jayson[_0x8a7c('0x10')][_0x8a7c('0x11')]({'port':0x232b});var client9001=jayson[_0x8a7c('0x10')][_0x8a7c('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x1c4bf1,_0x128f61,_0x278e1c,_0x2b75d7){return new BPromise(function(_0x5116c7,_0x329c1b){var _0x163345=_0x2b75d7||client;return _0x163345[_0x8a7c('0x12')](_0x1c4bf1,_0x278e1c)['then'](function(_0xd52026){logger['info'](_0x8a7c('0x13'),_0x128f61,_0x8a7c('0x14'));logger[_0x8a7c('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x128f61,_0x8a7c('0x14'),JSON['stringify'](_0xd52026));if(_0xd52026[_0x8a7c('0x16')]){if(_0xd52026[_0x8a7c('0x16')]['code']===0x1f4){logger[_0x8a7c('0x16')](_0x8a7c('0x13'),_0x128f61,_0xd52026['error']['message']);return _0x329c1b(_0xd52026['error'][_0x8a7c('0x17')]);}logger[_0x8a7c('0x16')](_0x8a7c('0x13'),_0x128f61,_0xd52026[_0x8a7c('0x16')][_0x8a7c('0x17')]);return _0x5116c7(_0xd52026[_0x8a7c('0x16')][_0x8a7c('0x17')]);}else{logger[_0x8a7c('0x18')](_0x8a7c('0x13'),_0x128f61,_0x8a7c('0x14'));_0x5116c7(_0xd52026[_0x8a7c('0x19')]['message']);}})[_0x8a7c('0x1a')](function(_0x2458fe){logger[_0x8a7c('0x16')](_0x8a7c('0x13'),_0x128f61,_0x2458fe);_0x329c1b(_0x2458fe);});});}function respondWithStatusCode(_0x53945a,_0x3e5b6d){_0x3e5b6d=_0x3e5b6d||0xcc;return function(_0x491628){if(_0x491628){return _0x53945a[_0x8a7c('0x1b')](_0x3e5b6d);}return _0x53945a[_0x8a7c('0x1c')](_0x3e5b6d)[_0x8a7c('0x1d')]();};}function respondWithResult(_0x2192b6,_0x46c35b){_0x46c35b=_0x46c35b||0xc8;return function(_0x50fb2f){if(_0x50fb2f){return _0x2192b6['status'](_0x46c35b)[_0x8a7c('0x1e')](_0x50fb2f);}};}function respondWithFilteredResult(_0x10a3b8,_0x231038){return function(_0xb8d993){if(_0xb8d993){var _0xe6465a=typeof _0x231038['offset']===_0x8a7c('0x1f')&&typeof _0x231038['limit']===_0x8a7c('0x1f');var _0x3a2d6f=_0xb8d993[_0x8a7c('0x20')];var _0xa52ff2=_0xe6465a?0x0:_0x231038['offset'];var _0x211189=_0xe6465a?_0xb8d993[_0x8a7c('0x20')]:_0x231038[_0x8a7c('0x21')]+_0x231038[_0x8a7c('0x22')];var _0x13fb65;if(_0x211189>=_0x3a2d6f){_0x211189=_0x3a2d6f;_0x13fb65=0xc8;}else{_0x13fb65=0xce;}_0x10a3b8[_0x8a7c('0x1c')](_0x13fb65);return _0x10a3b8[_0x8a7c('0x23')](_0x8a7c('0x24'),_0xa52ff2+'-'+_0x211189+'/'+_0x3a2d6f)[_0x8a7c('0x1e')](_0xb8d993);}return null;};}function saveUpdates(_0x1b6884){return function(_0x319aff){if(_0x319aff){return _0x319aff[_0x8a7c('0x25')](_0x1b6884)[_0x8a7c('0x26')](function(_0x4fcf64){return _0x4fcf64;});}return null;};}function removeEntity(_0x1e4629){return function(_0x37aee4){if(_0x37aee4){return _0x37aee4[_0x8a7c('0x27')]()[_0x8a7c('0x26')](function(){var _0x3d24f4=_0x37aee4[_0x8a7c('0x28')]({'plain':!![]});var _0x24534f='ChatWebsites';return db[_0x8a7c('0x29')][_0x8a7c('0x27')]({'where':{'type':_0x24534f,'resourceId':_0x3d24f4['id']}})['then'](function(){return _0x37aee4;});})[_0x8a7c('0x26')](function(){_0x1e4629[_0x8a7c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x77f9e7){return function(_0x4268c2){if(!_0x4268c2){_0x77f9e7[_0x8a7c('0x1b')](0x194);}return _0x4268c2;};}function handleError(_0x2c740e,_0x176be1){_0x176be1=_0x176be1||0x1f4;return function(_0x566f37){logger[_0x8a7c('0x16')](_0x566f37[_0x8a7c('0x2a')]);if(_0x566f37[_0x8a7c('0x2b')]){delete _0x566f37[_0x8a7c('0x2b')];}_0x2c740e[_0x8a7c('0x1c')](_0x176be1)[_0x8a7c('0x2c')](_0x566f37);};}exports['index']=function(_0xf5205,_0x5b1ba9){var _0x2ca0af={'include':[{'model':db['Pause'],'as':_0x8a7c('0x2d')}]},_0x43aa43={},_0x5675cb={'count':0x0,'rows':[]};var _0xf7f12a=_[_0x8a7c('0x2e')](db['ChatWebsite'][_0x8a7c('0x2f')],function(_0x1856e1){return{'name':_0x1856e1['fieldName'],'type':_0x1856e1[_0x8a7c('0x30')][_0x8a7c('0x31')]};});_0x43aa43[_0x8a7c('0x32')]=_[_0x8a7c('0x2e')](_0xf7f12a,_0x8a7c('0x2b'));_0x43aa43['query']=_[_0x8a7c('0x33')](_0xf5205[_0x8a7c('0x34')]);_0x43aa43[_0x8a7c('0x35')]=_[_0x8a7c('0x36')](_0x43aa43[_0x8a7c('0x32')],_0x43aa43['query']);_0x2ca0af[_0x8a7c('0x37')]=_[_0x8a7c('0x36')](_0x43aa43[_0x8a7c('0x32')],qs[_0x8a7c('0x38')](_0xf5205[_0x8a7c('0x34')][_0x8a7c('0x38')]));_0x2ca0af['attributes']=_0x2ca0af[_0x8a7c('0x37')][_0x8a7c('0x39')]?_0x2ca0af[_0x8a7c('0x37')]:_0x43aa43[_0x8a7c('0x32')];if(!_0xf5205[_0x8a7c('0x34')][_0x8a7c('0x3a')](_0x8a7c('0x3b'))){_0x2ca0af[_0x8a7c('0x22')]=qs[_0x8a7c('0x22')](_0xf5205['query'][_0x8a7c('0x22')]);_0x2ca0af[_0x8a7c('0x21')]=qs['offset'](_0xf5205[_0x8a7c('0x34')][_0x8a7c('0x21')]);}_0x2ca0af[_0x8a7c('0x3c')]=qs[_0x8a7c('0x3d')](_0xf5205['query'][_0x8a7c('0x3d')]);_0x2ca0af[_0x8a7c('0x3e')]=qs[_0x8a7c('0x35')](_[_0x8a7c('0x3f')](_0xf5205[_0x8a7c('0x34')],_0x43aa43['filters']),_0xf7f12a);if(_0xf5205['query'][_0x8a7c('0x40')]){_0x2ca0af[_0x8a7c('0x3e')]=_[_0x8a7c('0x41')](_0x2ca0af['where'],{'$or':_[_0x8a7c('0x2e')](_0xf7f12a,function(_0x21444a){if(_0x21444a[_0x8a7c('0x30')]!==_0x8a7c('0x42')){var _0x308976={};_0x308976[_0x21444a[_0x8a7c('0x2b')]]={'$like':'%'+_0xf5205[_0x8a7c('0x34')][_0x8a7c('0x40')]+'%'};return _0x308976;}})});}_0x2ca0af=_[_0x8a7c('0x41')]({},_0x2ca0af,_0xf5205[_0x8a7c('0x43')]);var _0x73093a={'where':_0x2ca0af['where']};return db[_0x8a7c('0x44')][_0x8a7c('0x20')](_0x73093a)[_0x8a7c('0x26')](function(_0x5bffde){_0x5675cb[_0x8a7c('0x20')]=_0x5bffde;if(_0xf5205[_0x8a7c('0x34')][_0x8a7c('0x45')]){_0x2ca0af[_0x8a7c('0x46')]=[{'all':!![]}];}return db['ChatWebsite'][_0x8a7c('0x47')](_0x2ca0af);})[_0x8a7c('0x26')](function(_0x354803){_0x5675cb[_0x8a7c('0x48')]=_0x354803;return _0x5675cb;})[_0x8a7c('0x26')](respondWithFilteredResult(_0x5b1ba9,_0x2ca0af))[_0x8a7c('0x1a')](handleError(_0x5b1ba9,null));};exports[_0x8a7c('0x49')]=function(_0x190d95,_0x3ba869){var _0x30de89={'raw':![],'where':{'id':_0x190d95[_0x8a7c('0x4a')]['id']},'include':[{'model':db[_0x8a7c('0x4b')],'as':_0x8a7c('0x2d')}]},_0x24099f={};_0x24099f['model']=_['keys'](db[_0x8a7c('0x44')][_0x8a7c('0x2f')]);_0x24099f[_0x8a7c('0x34')]=_[_0x8a7c('0x33')](_0x190d95[_0x8a7c('0x34')]);_0x24099f['filters']=_['intersection'](_0x24099f[_0x8a7c('0x32')],_0x24099f[_0x8a7c('0x34')]);_0x30de89['attributes']=_[_0x8a7c('0x36')](_0x24099f[_0x8a7c('0x32')],qs[_0x8a7c('0x38')](_0x190d95['query'][_0x8a7c('0x38')]));_0x30de89[_0x8a7c('0x37')]=_0x30de89[_0x8a7c('0x37')]['length']?_0x30de89['attributes']:_0x24099f[_0x8a7c('0x32')];if(_0x190d95[_0x8a7c('0x34')]['includeAll']){_0x30de89[_0x8a7c('0x46')]=[{'all':!![]}];}_0x30de89=_[_0x8a7c('0x41')]({},_0x30de89,_0x190d95[_0x8a7c('0x43')]);return db[_0x8a7c('0x44')][_0x8a7c('0x4c')](_0x30de89)[_0x8a7c('0x26')](handleEntityNotFound(_0x3ba869,null))[_0x8a7c('0x26')](respondWithResult(_0x3ba869,null))['catch'](handleError(_0x3ba869,null));};exports[_0x8a7c('0x4d')]=function(_0x32c552,_0x1dba0e){return db[_0x8a7c('0x44')]['create'](_0x32c552[_0x8a7c('0x4e')],{})['then'](function(_0x1cb4a0){var _0x2e6f6e=_0x32c552[_0x8a7c('0x4f')][_0x8a7c('0x28')]({'plain':!![]});if(!_0x2e6f6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e6f6e[_0x8a7c('0x50')]===_0x8a7c('0x4f')){var _0xb6cf5d=_0x1cb4a0['get']({'plain':!![]});var _0x5132c4=_0x8a7c('0x51');return db['UserProfileSection'][_0x8a7c('0x4c')]({'where':{'name':_0x5132c4,'userProfileId':_0x2e6f6e[_0x8a7c('0x52')]},'raw':!![]})['then'](function(_0x3e4d6b){if(_0x3e4d6b&&_0x3e4d6b[_0x8a7c('0x53')]===0x0){return db[_0x8a7c('0x29')][_0x8a7c('0x4d')]({'name':_0xb6cf5d[_0x8a7c('0x2b')],'resourceId':_0xb6cf5d['id'],'type':_0x3e4d6b[_0x8a7c('0x2b')],'sectionId':_0x3e4d6b['id']},{})[_0x8a7c('0x26')](function(){return _0x1cb4a0;});}else{return _0x1cb4a0;}})[_0x8a7c('0x1a')](function(_0x203149){logger['error'](_0x8a7c('0x54'),_0x203149);throw _0x203149;});}return _0x1cb4a0;})[_0x8a7c('0x26')](respondWithResult(_0x1dba0e,0xc9))[_0x8a7c('0x1a')](handleError(_0x1dba0e,null));};exports[_0x8a7c('0x25')]=function(_0x2000ac,_0x4105ac){if(_0x2000ac[_0x8a7c('0x4e')]['id']){delete _0x2000ac['body']['id'];}return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x2000ac['params']['id']},'include':[{'model':db[_0x8a7c('0x4b')],'as':_0x8a7c('0x2d')}]})[_0x8a7c('0x26')](handleEntityNotFound(_0x4105ac,null))[_0x8a7c('0x26')](saveUpdates(_0x2000ac['body'],null))[_0x8a7c('0x26')](respondWithResult(_0x4105ac,null))['catch'](handleError(_0x4105ac,null));};exports['destroy']=function(_0x188542,_0x3b72c9){return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x188542[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x3b72c9,null))[_0x8a7c('0x26')](removeEntity(_0x3b72c9,null))[_0x8a7c('0x1a')](handleError(_0x3b72c9,null));};exports[_0x8a7c('0x55')]=function(_0x338ea6,_0x144937){return db[_0x8a7c('0x44')][_0x8a7c('0x55')]()[_0x8a7c('0x26')](respondWithResult(_0x144937,null))['catch'](handleError(_0x144937,null));};exports[_0x8a7c('0x56')]=function(_0x4b0cfe,_0x59e342){if(_0x4b0cfe[_0x8a7c('0x4e')]['id']){delete _0x4b0cfe[_0x8a7c('0x4e')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x4b0cfe[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x59e342,null))[_0x8a7c('0x26')](function(_0x446f25){if(_0x446f25){_0x4b0cfe[_0x8a7c('0x4e')][_0x8a7c('0x57')]=_0x446f25['id'];return db[_0x8a7c('0x58')][_0x8a7c('0x4d')](_0x4b0cfe[_0x8a7c('0x4e')]);}})[_0x8a7c('0x26')](respondWithResult(_0x59e342,null))[_0x8a7c('0x1a')](handleError(_0x59e342,null));};exports['getDispositions']=function(_0x15ee5d,_0x1d4048){var _0x23fc03={'raw':![],'where':{}};var _0x35c525={};var _0xfaa04={'count':0x0,'rows':[]};return db[_0x8a7c('0x44')]['findOne']({'where':{'id':_0x15ee5d[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x1d4048,null))[_0x8a7c('0x26')](function(_0x288594){if(_0x288594){_0x35c525[_0x8a7c('0x32')]=_[_0x8a7c('0x33')](db[_0x8a7c('0x58')]['rawAttributes']);_0x35c525[_0x8a7c('0x34')]=_['keys'](_0x15ee5d[_0x8a7c('0x34')]);_0x35c525[_0x8a7c('0x35')]=_[_0x8a7c('0x36')](_0x35c525[_0x8a7c('0x32')],_0x35c525[_0x8a7c('0x34')]);_0x23fc03['attributes']=_[_0x8a7c('0x36')](_0x35c525[_0x8a7c('0x32')],qs[_0x8a7c('0x38')](_0x15ee5d[_0x8a7c('0x34')][_0x8a7c('0x38')]));_0x23fc03[_0x8a7c('0x37')]=_0x23fc03[_0x8a7c('0x37')][_0x8a7c('0x39')]?_0x23fc03[_0x8a7c('0x37')]:_0x35c525['model'];if(!_0x15ee5d[_0x8a7c('0x34')]['hasOwnProperty'](_0x8a7c('0x3b'))){_0x23fc03[_0x8a7c('0x22')]=qs[_0x8a7c('0x22')](_0x15ee5d[_0x8a7c('0x34')]['limit']);_0x23fc03[_0x8a7c('0x21')]=qs[_0x8a7c('0x21')](_0x15ee5d[_0x8a7c('0x34')]['offset']);}_0x23fc03['order']=qs[_0x8a7c('0x3d')](_0x15ee5d[_0x8a7c('0x34')][_0x8a7c('0x3d')]);_0x23fc03[_0x8a7c('0x3e')]=qs[_0x8a7c('0x35')](_[_0x8a7c('0x3f')](_0x15ee5d['query'],_0x35c525[_0x8a7c('0x35')]));_0x23fc03[_0x8a7c('0x3e')][_0x8a7c('0x57')]=_0x288594['id'];if(_0x15ee5d[_0x8a7c('0x34')]['filter']){_0x23fc03[_0x8a7c('0x3e')]=_[_0x8a7c('0x41')](_0x23fc03['where'],{'$or':_['map'](_0x23fc03[_0x8a7c('0x37')],function(_0x59d8b1){var _0xf1f9a0={};_0xf1f9a0[_0x59d8b1]={'$like':'%'+_0x15ee5d[_0x8a7c('0x34')]['filter']+'%'};return _0xf1f9a0;})});}_0x23fc03=_['merge']({},_0x23fc03,_0x15ee5d['options']);return db['Disposition'][_0x8a7c('0x20')]({'where':_0x23fc03[_0x8a7c('0x3e')]})[_0x8a7c('0x26')](function(_0x40b620){_0xfaa04['count']=_0x40b620;if(_0x15ee5d[_0x8a7c('0x34')]['includeAll']){_0x23fc03[_0x8a7c('0x46')]=[{'all':!![]}];}return db[_0x8a7c('0x58')][_0x8a7c('0x47')](_0x23fc03);})[_0x8a7c('0x26')](function(_0x19067b){_0xfaa04[_0x8a7c('0x48')]=_0x19067b;return _0xfaa04;});}})[_0x8a7c('0x26')](respondWithFilteredResult(_0x1d4048,_0x23fc03))[_0x8a7c('0x1a')](handleError(_0x1d4048,null));};exports['removeDispositions']=function(_0x178e73,_0xa8a299){return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x178e73['params']['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0xa8a299,null))[_0x8a7c('0x26')](function(_0x45fad8){if(_0x45fad8){return _0x45fad8[_0x8a7c('0x59')](_0x178e73[_0x8a7c('0x34')][_0x8a7c('0x5a')]);}})[_0x8a7c('0x26')](respondWithStatusCode(_0xa8a299,null))['catch'](handleError(_0xa8a299,null));};exports[_0x8a7c('0x5b')]=function(_0x3e8c57,_0x4f3445){if(_0x3e8c57['body']['id']){delete _0x3e8c57[_0x8a7c('0x4e')]['id'];}return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x3e8c57['params']['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x4f3445,null))[_0x8a7c('0x26')](function(_0x20308a){if(_0x20308a){_0x3e8c57[_0x8a7c('0x4e')]['ChatWebsiteId']=_0x20308a['id'];return db['CannedAnswer']['create'](_0x3e8c57['body']);}})[_0x8a7c('0x26')](respondWithResult(_0x4f3445,null))[_0x8a7c('0x1a')](handleError(_0x4f3445,null));};exports[_0x8a7c('0x5c')]=function(_0x449890,_0x4fde26){var _0x4d440c={'raw':![],'where':{}};var _0x28159a={};var _0x9f4d15={'count':0x0,'rows':[]};return db[_0x8a7c('0x44')][_0x8a7c('0x5d')]({'where':{'id':_0x449890[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x4fde26,null))['then'](function(_0x4ee783){if(_0x4ee783){_0x28159a[_0x8a7c('0x32')]=_[_0x8a7c('0x33')](db[_0x8a7c('0x5e')][_0x8a7c('0x2f')]);_0x28159a['query']=_[_0x8a7c('0x33')](_0x449890[_0x8a7c('0x34')]);_0x28159a['filters']=_[_0x8a7c('0x36')](_0x28159a[_0x8a7c('0x32')],_0x28159a[_0x8a7c('0x34')]);_0x4d440c[_0x8a7c('0x37')]=_[_0x8a7c('0x36')](_0x28159a[_0x8a7c('0x32')],qs['fields'](_0x449890[_0x8a7c('0x34')][_0x8a7c('0x38')]));_0x4d440c[_0x8a7c('0x37')]=_0x4d440c[_0x8a7c('0x37')]['length']?_0x4d440c[_0x8a7c('0x37')]:_0x28159a[_0x8a7c('0x32')];if(!_0x449890[_0x8a7c('0x34')][_0x8a7c('0x3a')](_0x8a7c('0x3b'))){_0x4d440c[_0x8a7c('0x22')]=qs['limit'](_0x449890['query']['limit']);_0x4d440c[_0x8a7c('0x21')]=qs[_0x8a7c('0x21')](_0x449890[_0x8a7c('0x34')]['offset']);}_0x4d440c[_0x8a7c('0x3c')]=qs[_0x8a7c('0x3d')](_0x449890[_0x8a7c('0x34')][_0x8a7c('0x3d')]);_0x4d440c[_0x8a7c('0x3e')]=qs['filters'](_[_0x8a7c('0x3f')](_0x449890[_0x8a7c('0x34')],_0x28159a[_0x8a7c('0x35')]));_0x4d440c[_0x8a7c('0x3e')][_0x8a7c('0x57')]=_0x4ee783['id'];if(_0x449890[_0x8a7c('0x34')][_0x8a7c('0x40')]){_0x4d440c['where']=_[_0x8a7c('0x41')](_0x4d440c[_0x8a7c('0x3e')],{'$or':_['map'](_0x4d440c['attributes'],function(_0x5b4967){var _0xe383f2={};_0xe383f2[_0x5b4967]={'$like':'%'+_0x449890[_0x8a7c('0x34')]['filter']+'%'};return _0xe383f2;})});}_0x4d440c=_['merge']({},_0x4d440c,_0x449890[_0x8a7c('0x43')]);return db[_0x8a7c('0x5e')][_0x8a7c('0x20')]({'where':_0x4d440c['where']})[_0x8a7c('0x26')](function(_0x14dd3f){_0x9f4d15[_0x8a7c('0x20')]=_0x14dd3f;if(_0x449890[_0x8a7c('0x34')]['includeAll']){_0x4d440c[_0x8a7c('0x46')]=[{'all':!![]}];}return db[_0x8a7c('0x5e')]['findAll'](_0x4d440c);})['then'](function(_0x2cc3ae){_0x9f4d15[_0x8a7c('0x48')]=_0x2cc3ae;return _0x9f4d15;});}})['then'](respondWithFilteredResult(_0x4fde26,_0x4d440c))[_0x8a7c('0x1a')](handleError(_0x4fde26,null));};exports[_0x8a7c('0x5f')]=function(_0x4bdc2a,_0xa7bbf6){return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x4bdc2a[_0x8a7c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa7bbf6,null))['then'](function(_0x1b3ccd){if(_0x1b3ccd){return _0x1b3ccd['removeAnswers'](_0x4bdc2a[_0x8a7c('0x34')][_0x8a7c('0x5a')]);}})[_0x8a7c('0x26')](respondWithStatusCode(_0xa7bbf6,null))[_0x8a7c('0x1a')](handleError(_0xa7bbf6,null));};exports['addLogo']=function(_0x14aa19,_0x1c47e7){_0x14aa19[_0x8a7c('0x4e')][_0x8a7c('0x60')]=_0x14aa19[_0x8a7c('0x61')][_0x8a7c('0x62')];return db['ChatWebsite'][_0x8a7c('0x4c')]({'where':{'id':_0x14aa19['params']['id']}})['then'](handleEntityNotFound(_0x1c47e7,null))[_0x8a7c('0x26')](saveUpdates(_0x14aa19[_0x8a7c('0x4e')],null))[_0x8a7c('0x26')](respondWithResult(_0x1c47e7,null))[_0x8a7c('0x1a')](handleError(_0x1c47e7,null));};exports[_0x8a7c('0x63')]=function(_0x24e7a0,_0x5749fa){_0x24e7a0[_0x8a7c('0x4e')][_0x8a7c('0x64')]=_0x24e7a0['file']['filename'];return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x24e7a0['params']['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x5749fa,null))[_0x8a7c('0x26')](saveUpdates(_0x24e7a0['body'],null))[_0x8a7c('0x26')](respondWithResult(_0x5749fa,null))[_0x8a7c('0x1a')](handleError(_0x5749fa,null));};exports[_0x8a7c('0x65')]=function(_0x50579c,_0x13f175){_0x50579c['body'][_0x8a7c('0x66')]=_0x50579c[_0x8a7c('0x61')][_0x8a7c('0x62')];return db['ChatWebsite'][_0x8a7c('0x4c')]({'where':{'id':_0x50579c['params']['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x13f175,null))[_0x8a7c('0x26')](saveUpdates(_0x50579c[_0x8a7c('0x4e')],null))['then'](respondWithResult(_0x13f175,null))[_0x8a7c('0x1a')](handleError(_0x13f175,null));};exports[_0x8a7c('0x67')]=function(_0x5a7941,_0x2bc1d6){_0x5a7941[_0x8a7c('0x4e')][_0x8a7c('0x68')]=_0x5a7941[_0x8a7c('0x61')][_0x8a7c('0x62')];return db['ChatWebsite']['find']({'where':{'id':_0x5a7941['params']['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x2bc1d6,null))[_0x8a7c('0x26')](saveUpdates(_0x5a7941[_0x8a7c('0x4e')],null))[_0x8a7c('0x26')](respondWithResult(_0x2bc1d6,null))[_0x8a7c('0x1a')](handleError(_0x2bc1d6,null));};exports[_0x8a7c('0x69')]=function(_0x351a62,_0x33b6c4){var _0x1fcf89=path[_0x8a7c('0x6a')](config[_0x8a7c('0x6b')],_0x8a7c('0x6c'));var _0x4e436a={'where':{'id':_0x351a62[_0x8a7c('0x4a')]['id']},'attributes':['id',_0x8a7c('0x60')],'raw':!![]};var _0x2caf15=![];return require(_0x8a7c('0x6d'))[_0x8a7c('0x6e')]()[_0x8a7c('0x26')](function(_0x3ddc27){if(_0x3ddc27){_0x2caf15=_0x3ddc27['custom'];}})[_0x8a7c('0x26')](function(){return db[_0x8a7c('0x44')][_0x8a7c('0x4c')](_0x4e436a);})[_0x8a7c('0x26')](handleEntityNotFound(_0x33b6c4,null))[_0x8a7c('0x26')](function(_0x1bb532){if(_0x1bb532){if(!_['isNil'](_0x1bb532['sitepic'])){if(fs['existsSync'](path[_0x8a7c('0x6a')](config['root'],_0x8a7c('0x6f'),_0x1bb532[_0x8a7c('0x60')]))&&_0x2caf15){_0x1fcf89=path['join'](config['root'],'server/files/images/logos/',_0x1bb532['sitepic']);}}return _0x33b6c4['download'](_0x1fcf89);}})[_0x8a7c('0x1a')](handleError(_0x33b6c4,null));};exports['getAvatar']=function(_0x16d1fa,_0x4545f1){var _0x34f904=path[_0x8a7c('0x6a')](config['root'],_0x8a7c('0x70'));var _0x2a9ba9={'where':{'id':_0x16d1fa[_0x8a7c('0x4a')]['id']},'attributes':['id',_0x8a7c('0x64')],'raw':!![]};return db[_0x8a7c('0x44')][_0x8a7c('0x4c')](_0x2a9ba9)[_0x8a7c('0x26')](handleEntityNotFound(_0x4545f1,null))['then'](function(_0x407fd5){if(_0x407fd5){if(!_[_0x8a7c('0x71')](_0x407fd5[_0x8a7c('0x64')])){if(fs['existsSync'](path['join'](config[_0x8a7c('0x6b')],'server/files/images/avatars/',_0x407fd5[_0x8a7c('0x64')]))){_0x34f904=path[_0x8a7c('0x6a')](config['root'],_0x8a7c('0x72'),_0x407fd5[_0x8a7c('0x64')]);}}return _0x4545f1['download'](_0x34f904);}})[_0x8a7c('0x1a')](handleError(_0x4545f1,null));};exports[_0x8a7c('0x73')]=function(_0x1a8e23,_0x2fcf27){var _0x472ef3=path['join'](config[_0x8a7c('0x6b')],_0x8a7c('0x74'));var _0x442680={'where':{'id':_0x1a8e23['params']['id']},'attributes':['id',_0x8a7c('0x66'),_0x8a7c('0x75')],'raw':!![]};return db[_0x8a7c('0x44')][_0x8a7c('0x4c')](_0x442680)[_0x8a7c('0x26')](handleEntityNotFound(_0x2fcf27,null))[_0x8a7c('0x26')](function(_0x14b783){if(_0x14b783){if(!_[_0x8a7c('0x71')](_0x14b783['customerAvatar'])){if(fs[_0x8a7c('0x76')](path[_0x8a7c('0x6a')](config[_0x8a7c('0x6b')],_0x8a7c('0x72'),_0x14b783['customerAvatar']))&&_0x14b783[_0x8a7c('0x75')]){_0x472ef3=path[_0x8a7c('0x6a')](config[_0x8a7c('0x6b')],_0x8a7c('0x72'),_0x14b783[_0x8a7c('0x66')]);}}return _0x2fcf27[_0x8a7c('0x77')](_0x472ef3);}})[_0x8a7c('0x1a')](handleError(_0x2fcf27,null));};exports['getSystemAvatar']=function(_0x283c6f,_0x5dd8d3){var _0x374c11=path['join'](config[_0x8a7c('0x6b')],_0x8a7c('0x78'));var _0x29f078={'where':{'id':_0x283c6f[_0x8a7c('0x4a')]['id']},'attributes':['id',_0x8a7c('0x68')],'raw':!![]};return db[_0x8a7c('0x44')][_0x8a7c('0x4c')](_0x29f078)[_0x8a7c('0x26')](handleEntityNotFound(_0x5dd8d3,null))[_0x8a7c('0x26')](function(_0x1e3f88){if(_0x1e3f88){if(!_[_0x8a7c('0x71')](_0x1e3f88[_0x8a7c('0x68')])){if(fs[_0x8a7c('0x76')](path[_0x8a7c('0x6a')](config['root'],_0x8a7c('0x72'),_0x1e3f88[_0x8a7c('0x68')]))){_0x374c11=path['join'](config[_0x8a7c('0x6b')],_0x8a7c('0x72'),_0x1e3f88[_0x8a7c('0x68')]);}}return _0x5dd8d3[_0x8a7c('0x77')](_0x374c11);}})[_0x8a7c('0x1a')](handleError(_0x5dd8d3,null));};exports['notify']=function(_0x1d7f7b,_0x22cb15){var _0x177dae=require(_0x8a7c('0x79'));var _0x195766=new _0x177dae();var _0x4c8a9f=_0x195766['setUA'](_0x1d7f7b[_0x8a7c('0x7a')][_0x8a7c('0x7b')])[_0x8a7c('0x7c')]();var _0x2a4cce={'body':_0x1d7f7b[_0x8a7c('0x4e')],'channel':'chat'};var _0x13c16b=[];var _0x4710f7=[];var _0x46180f={};var _0x20043e=![];return db[_0x8a7c('0x7d')][_0x8a7c('0x55')]()[_0x8a7c('0x26')](function(_0xf4b9ff){if(!_0xf4b9ff){throw new db[(_0x8a7c('0x7e'))][(_0x8a7c('0x7f'))](_0x8a7c('0x80'));}_0x13c16b=_['difference'](_[_0x8a7c('0x33')](_0xf4b9ff),[_0x8a7c('0x81'),_0x8a7c('0x82')]);_0x4710f7=_[_0x8a7c('0x83')](_['keys'](_0xf4b9ff),[_0x8a7c('0x81'),_0x8a7c('0x82'),'CompanyId',_0x8a7c('0x84')]);if(_0x1d7f7b['body']['id']){delete _0x1d7f7b[_0x8a7c('0x4e')]['id'];}if(_[_0x8a7c('0x71')](_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0x85')])){throw new db['Sequelize'][(_0x8a7c('0x7f'))](_0x8a7c('0x86'));}if(_['isNil'](_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0x4e')])||_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0x4e')]===''){throw new db[(_0x8a7c('0x7e'))][(_0x8a7c('0x7f'))](_0x8a7c('0x87'));}if(_[_0x8a7c('0x71')](_0x1d7f7b['body'][_0x8a7c('0x88')])){throw new db[(_0x8a7c('0x7e'))][(_0x8a7c('0x7f'))](_0x8a7c('0x89')+_0x4710f7);}if(!_['includes'](_0x4710f7,_0x1d7f7b[_0x8a7c('0x4e')]['mapKey'])){throw new db[(_0x8a7c('0x7e'))][(_0x8a7c('0x7f'))](_0x8a7c('0x8a')+_0x4710f7);}_0x46180f[_0x1d7f7b[_0x8a7c('0x4e')]['mapKey']]=_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0x85')];})[_0x8a7c('0x26')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1d7f7b[_0x8a7c('0x4a')]['id']},'include':[{'model':db[_0x8a7c('0x8b')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8a7c('0x8c'),'where':_0x46180f,'limit':0x1,'order':[[_0x8a7c('0x82'),_0x8a7c('0x8d')]]}]},{'model':db[_0x8a7c('0x8e')],'as':_0x8a7c('0x8f')}]});})['then'](handleEntityNotFound(_0x22cb15,null))[_0x8a7c('0x26')](function(_0x48bd65){if(_0x48bd65&&_0x48bd65[_0x8a7c('0x90')]){_0x2a4cce[_0x8a7c('0x91')]=_0x48bd65;_0x2a4cce['applications']=_0x48bd65[_0x8a7c('0x8f')];_0x2a4cce[_0x8a7c('0x92')]=_0x48bd65[_0x8a7c('0x90')];_0x2a4cce[_0x8a7c('0x93')]=_['orderBy'](_0x2a4cce[_0x8a7c('0x93')],[_0x8a7c('0x94')],[_0x8a7c('0x95')]);if(_0x2a4cce[_0x8a7c('0x91')][_0x8a7c('0x8f')]){delete _0x2a4cce[_0x8a7c('0x91')][_0x8a7c('0x8f')];}if(_0x2a4cce[_0x8a7c('0x91')][_0x8a7c('0x90')]&&_0x2a4cce[_0x8a7c('0x91')][_0x8a7c('0x90')][_0x8a7c('0x8c')][_0x8a7c('0x39')]){return _0x2a4cce[_0x8a7c('0x91')]['List']['Contacts'][0x0];}var _0x27fdfc=_[_0x8a7c('0xa')](_0x1d7f7b[_0x8a7c('0x4e')],{'firstName':_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0x85')],'ListId':_0x48bd65[_0x8a7c('0x84')]});_0x27fdfc[_0x1d7f7b['body'][_0x8a7c('0x88')]]=_0x1d7f7b['body'][_0x8a7c('0x85')];return db[_0x8a7c('0x7d')][_0x8a7c('0x4d')](_0x27fdfc,{'fields':_0x13c16b,'raw':!![]});}})[_0x8a7c('0x26')](handleEntityNotFound(_0x22cb15,null))[_0x8a7c('0x26')](function(_0x2b700c){_0x2a4cce[_0x8a7c('0x96')]=_0x2b700c;var _0x1f4733=_0x1d7f7b['body'][_0x8a7c('0x97')];if(_0x1d7f7b[_0x8a7c('0x7a')]['cf-connecting-ip']){_0x1f4733=_0x1d7f7b[_0x8a7c('0x7a')][_0x8a7c('0x98')];}else if(_0x1d7f7b['headers'][_0x8a7c('0x99')]){_0x1f4733=_[_0x8a7c('0x9a')](_0x1d7f7b['headers'][_0x8a7c('0x99')][_0x8a7c('0x9b')](','));}if(_0x2b700c){var _0x3ee8d4={'ContactId':_0x2b700c['id'],'ChatWebsiteId':_0x1d7f7b['params']['id'],'from':(_0x2b700c[_0x8a7c('0x9c')]||'')+'\x20'+(_0x2b700c[_0x8a7c('0x9d')]||''),'customerIp':_0x1f4733,'customerPort':_0x1d7f7b[_0x8a7c('0x7a')][_0x8a7c('0x9e')]?_0x1d7f7b[_0x8a7c('0x7a')][_0x8a7c('0x9e')]:null,'referer':_0x1d7f7b['body'][_0x8a7c('0x9f')],'browserName':_0x4c8a9f['browser'][_0x8a7c('0x2b')]&&_0x4c8a9f[_0x8a7c('0xa0')][_0x8a7c('0xa1')]?util['format'](_0x8a7c('0xa2'),_0x4c8a9f[_0x8a7c('0xa0')][_0x8a7c('0x2b')],_0x4c8a9f[_0x8a7c('0xa0')][_0x8a7c('0xa1')]):_0x8a7c('0xa3'),'browserVersion':_0x4c8a9f[_0x8a7c('0xa0')][_0x8a7c('0xa1')]||_0x8a7c('0xa3'),'osName':util['format'](_0x8a7c('0xa2'),_0x4c8a9f['os'][_0x8a7c('0x2b')],_0x4c8a9f['os'][_0x8a7c('0xa1')]),'osVersion':_0x4c8a9f['os'][_0x8a7c('0xa1')],'deviceModel':_0x4c8a9f[_0x8a7c('0xa4')][_0x8a7c('0x32')]&&_0x4c8a9f[_0x8a7c('0xa4')][_0x8a7c('0xa5')]?util[_0x8a7c('0xa6')]('%s\x20%s\x20%s',_0x4c8a9f['device'][_0x8a7c('0x32')],_0x4c8a9f[_0x8a7c('0xa4')][_0x8a7c('0xa5')],_0x4c8a9f['device']['type']):null,'deviceVendor':_0x4c8a9f[_0x8a7c('0xa4')][_0x8a7c('0xa5')],'deviceType':_0x4c8a9f[_0x8a7c('0xa4')][_0x8a7c('0x30')],'formData':JSON[_0x8a7c('0xa7')](_0x1d7f7b[_0x8a7c('0x4e')])};var _0x4cf95f={'ChatWebsiteId':_0x1d7f7b['params']['id'],'closed':![]};if(_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0xa8')]){_0x4cf95f[_0x8a7c('0xa8')]=_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0xa8')];return db[_0x8a7c('0xa9')]['find']({'where':_0x4cf95f})[_0x8a7c('0x26')](function(_0xad18e6){if(_0xad18e6){return[_0xad18e6,![]];}_0x3ee8d4[_0x8a7c('0xa8')]=_0x1d7f7b['body']['threadId'];_0x3ee8d4[_0x8a7c('0xaa')]=_0x1d7f7b[_0x8a7c('0x4e')]['externalUrl'];return db[_0x8a7c('0xa9')]['create'](_0x3ee8d4)[_0x8a7c('0x26')](function(_0x27545a){return[_0x27545a,!![]];});});}_0x4cf95f['ContactId']=_0x2b700c['id'];if(_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0xab')]&&_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0xab')]['id']){_0x4cf95f['id']=_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0xab')]['id'];return db[_0x8a7c('0xa9')]['find']({'where':_0x4cf95f})[_0x8a7c('0x26')](function(_0x387749){if(_0x387749){return[_0x387749,![]];}return db[_0x8a7c('0xa9')][_0x8a7c('0x4d')](_0x3ee8d4)['then'](function(_0x220f86){return[_0x220f86,!![]];});});}return db[_0x8a7c('0xa9')][_0x8a7c('0x4d')](_0x3ee8d4)[_0x8a7c('0x26')](function(_0x26d58c){return[_0x26d58c,!![]];});}})['spread'](function(_0x1e9f50,_0x2d0bbb){if(_0x1e9f50){_0x20043e=_0x2d0bbb;if(!_0x2d0bbb){var _0x5db811={'from':(_0x2a4cce[_0x8a7c('0x96')][_0x8a7c('0x9c')]||'')+'\x20'+(_0x2a4cce[_0x8a7c('0x96')][_0x8a7c('0x9d')]||'')};if(_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0xa8')]&&_0x1d7f7b[_0x8a7c('0x4e')]['messageId']&&_0x1d7f7b[_0x8a7c('0x4e')]['threadId']!=_0x1d7f7b['body'][_0x8a7c('0xac')]){_0x5db811[_0x8a7c('0xa8')]=_0x1d7f7b['body'][_0x8a7c('0xac')];}return _0x1e9f50[_0x8a7c('0x25')](_0x5db811);}else{return _0x1e9f50;}}})[_0x8a7c('0x26')](function(_0x5031a3){_0x2a4cce[_0x8a7c('0xab')]=_0x5031a3['get']({'plain':!![]});_0x2a4cce[_0x8a7c('0xab')][_0x8a7c('0xad')]=_0x20043e;if(_0x2a4cce[_0x8a7c('0xab')][_0x8a7c('0xad')]){if(_0x2a4cce[_0x8a7c('0x91')][_0x8a7c('0xae')]){_0x2a4cce[_0x8a7c('0x93')][_0x8a7c('0xaf')]({'id':0x0,'priority':_0x2a4cce[_0x8a7c('0x93')]['length']+0x1,'app':_0x8a7c('0xb0'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x8a7c('0xb1')][_0x8a7c('0x4d')]({'body':_0x1d7f7b[_0x8a7c('0x4e')][_0x8a7c('0x4e')],'ChatWebsiteId':_0x1d7f7b[_0x8a7c('0x4a')]['id'],'ChatInteractionId':_0x5031a3['id'],'direction':'in','ContactId':_0x2a4cce['contact']['id'],'AttachmentId':_0x1d7f7b[_0x8a7c('0x4e')]['AttachmentId']});})[_0x8a7c('0x26')](function(_0x41e85e){_0x2a4cce[_0x8a7c('0x17')]=_0x41e85e;if(_0x2a4cce[_0x8a7c('0xab')][_0x8a7c('0xb2')]){return db[_0x8a7c('0xb3')][_0x8a7c('0x4c')]({'attributes':['id',_0x8a7c('0x2b')],'where':{'id':_0x2a4cce['interaction'][_0x8a7c('0xb2')]}})[_0x8a7c('0x26')](function(_0x3ab5cb){if(_0x3ab5cb){_0x2a4cce[_0x8a7c('0x93')][_0x8a7c('0xb4')]({'id':0x0,'priority':0x0,'app':_0x8a7c('0xb5'),'appdata':_0x3ab5cb[_0x8a7c('0x2b')]+','+(_0x2a4cce[_0x8a7c('0x91')][_0x8a7c('0xb6')]||0xa),'interval':_0x8a7c('0xb7')});_0x2a4cce['forcedOwnership']=!![];}return respondWithRpcPromise(_0x8a7c('0xb8'),_0x8a7c('0xb9'),_0x2a4cce);});}return respondWithRpcPromise(_0x8a7c('0xb8'),'startRouting',_0x2a4cce);})[_0x8a7c('0x26')](function(_0x2d9c4f){respondWithRpcPromise(_0x8a7c('0xba'),_0x8a7c('0xba'),{'event':_0x8a7c('0xbb'),'message':_0x2d9c4f},client9002);return _0x2d9c4f;})[_0x8a7c('0x26')](respondWithResult(_0x22cb15,null))[_0x8a7c('0x1a')](handleError(_0x22cb15,null));};exports['offline']=function(_0x4422d9,_0xd78a84){var _0x5e02fd,_0xefcceb,_0x59e744;var _0x4bd6b8=[];var _0x52da7b={};var _0x2ad5cf=_0x4422d9[_0x8a7c('0xbc')]||[];var _0x438658=[];var _0x928fe2;return db['CmContact'][_0x8a7c('0x55')]()[_0x8a7c('0x26')](function(_0x367654){if(!_0x367654){throw new db[(_0x8a7c('0x7e'))]['ValidationError']('no\x20available\x20attributes');}_0x4bd6b8=_[_0x8a7c('0x83')](_[_0x8a7c('0x33')](_0x367654),['createdAt',_0x8a7c('0x82'),_0x8a7c('0xbd'),'ListId']);if(_0x4422d9[_0x8a7c('0x4e')]['id']){delete _0x4422d9[_0x8a7c('0x4e')]['id'];}if(_[_0x8a7c('0x71')](_0x4422d9[_0x8a7c('0x4e')]['from'])){throw _0xd78a84[_0x8a7c('0x1c')](0x1f4)[_0x8a7c('0x2c')](new db['Sequelize']['ValidationError'](_0x8a7c('0x86')));}if(_[_0x8a7c('0x71')](_0x4422d9[_0x8a7c('0x4e')][_0x8a7c('0x4e')])||_0x4422d9['body']['body']===''){throw _0xd78a84[_0x8a7c('0x1c')](0x1f4)[_0x8a7c('0x2c')](new db['Sequelize']['ValidationError'](_0x8a7c('0x87')));}if(_['isNil'](_0x4422d9[_0x8a7c('0x4e')][_0x8a7c('0xbe')])){throw _0xd78a84[_0x8a7c('0x1c')](0x1f4)[_0x8a7c('0x2c')](new db[(_0x8a7c('0x7e'))][(_0x8a7c('0x7f'))](_0x8a7c('0xbf')+_0x4bd6b8));}if(!_[_0x8a7c('0xc0')](_0x4bd6b8,_0x4422d9[_0x8a7c('0x4e')]['mapKeyOffline'])){throw _0xd78a84['status'](0x1f4)[_0x8a7c('0x2c')](new db['Sequelize'][(_0x8a7c('0x7f'))](_0x8a7c('0xc1')+_0x4bd6b8));}_0x52da7b[_0x4422d9[_0x8a7c('0x4e')][_0x8a7c('0xbe')]]=_0x4422d9[_0x8a7c('0x4e')][_0x8a7c('0x85')];})[_0x8a7c('0x26')](function(){return db['ChatWebsite'][_0x8a7c('0x4c')]({'where':{'id':_0x4422d9['params']['id']},'include':[{'model':db['CmList'],'as':_0x8a7c('0x90')},{'model':db[_0x8a7c('0xc2')],'as':_0x8a7c('0xc2')}]});})['then'](handleEntityNotFound(_0xd78a84,null))[_0x8a7c('0x26')](function(_0x598dea){if(_0x598dea&&_0x598dea[_0x8a7c('0x90')]){_0xefcceb=_0x598dea;var _0x27b25d=_['defaults'](_0x4422d9[_0x8a7c('0x4e')],{'firstName':_0x4422d9[_0x8a7c('0x4e')][_0x8a7c('0x85')],'phone':_0x4422d9[_0x8a7c('0x4e')]['from'],'ListId':_0x598dea['ListId']});_0x27b25d[_0x4422d9[_0x8a7c('0x4e')]['mapKeyOffline']]=_0x4422d9[_0x8a7c('0x4e')][_0x8a7c('0x85')];return db[_0x8a7c('0x7d')]['findOrCreate']({'where':_0x52da7b,'defaults':_0x27b25d});}})[_0x8a7c('0xc3')](function(_0x19f733){if(_0x19f733){_0x59e744=_0x19f733;var _0x4ab839=fs['readFileSync'](path[_0x8a7c('0x6a')](config[_0x8a7c('0x6b')],_0x8a7c('0xc4')),_0x8a7c('0xc5'));var _0x4ebe88=ejs[_0x8a7c('0xc6')](_0x4ab839,{'body':_['toPairs'](_0x4422d9[_0x8a7c('0x4e')][_0x8a7c('0x4e')]),'bodyTitle':_0xefcceb[_0x8a7c('0xc7')]});return db[_0x8a7c('0xc8')][_0x8a7c('0x4d')]({'body':_0x4ebe88,'plainBody':htmlToText[_0x8a7c('0xc9')](_0x4ebe88),'ContactId':_0x19f733['id'],'ChatWebsiteId':_0xefcceb['id']});}})['then'](function(_0x563fac){_0x928fe2=_0x563fac;if(_0x2ad5cf[_0x8a7c('0x39')]){var _0x1aa872=_0x2ad5cf['map'](function(_0x44aa19){return{'name':_0x44aa19[_0x8a7c('0xca')],'basename':_0x44aa19[_0x8a7c('0x62')],'type':_0x44aa19[_0x8a7c('0xcb')],'ChatOfflineMessageId':_0x563fac['id']};});_0x438658=_0x1aa872['map'](_0x18f65d=>{var _0x555e61={'filename':_0x18f65d[_0x8a7c('0x2b')],'path':path[_0x8a7c('0x6a')](config[_0x8a7c('0x6b')],_0x8a7c('0xcc'),_0x8a7c('0xbc'),_0x8a7c('0xcd'),_0x8a7c('0xce'),_0x18f65d['basename'])};return _0x555e61;});if(!_0xefcceb['openNewInteraction']){return db[_0x8a7c('0xcf')][_0x8a7c('0xd0')](function(_0x41d19b){return db[_0x8a7c('0xd1')][_0x8a7c('0xd2')](_0x1aa872,{'transaction':_0x41d19b});});}}})[_0x8a7c('0x26')](function(){if(_0x928fe2){_0x5e02fd=_0x928fe2;return db[_0x8a7c('0xc2')][_0x8a7c('0x5d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x8a7c('0xd3'),'raw':!![],'include':[{'model':db[_0x8a7c('0xd4')],'as':_0x8a7c('0xd4'),'raw':!![]}]}]});}})[_0x8a7c('0x26')](function(_0x48c998){if(_0x48c998&&_0x48c998[_0x8a7c('0xd3')]&&_0xefcceb[_0x8a7c('0xd5')]&&_0xefcceb[_0x8a7c('0xd6')]){var _0x2f9095=_0x48c998[_0x8a7c('0xd7')]();return respondWithRpcPromise(_0x8a7c('0xd8'),_0x8a7c('0xd9'),{'account':_0x2f9095,'message':{'from':util['format'](_0x8a7c('0xda'),_0x48c998[_0x8a7c('0x2b')],_0x48c998['email']||_0x48c998[_0x8a7c('0xd3')][_0x8a7c('0x4f')]),'to':_0xefcceb[_0x8a7c('0xd6')],'subject':_0xefcceb[_0x8a7c('0xdb')],'html':_0x5e02fd[_0x8a7c('0x4e')],'attachments':_0x438658}},client9003)[_0x8a7c('0x26')](function(){return _0x5e02fd;})[_0x8a7c('0x1a')](function(_0x33085f){logger['error'](_0x33085f);});}})[_0x8a7c('0x26')](function(){if(_0xefcceb&&_0xefcceb[_0x8a7c('0xdc')]&&_0xefcceb['MailAccountId']){var _0x15c5df=[];if(_0x2ad5cf['length']){_0x15c5df=_0x2ad5cf['map'](function(_0x4b2dfa){return{'name':_0x4b2dfa[_0x8a7c('0xca')],'basename':_0x4b2dfa['filename'],'type':_0x4b2dfa[_0x8a7c('0xcb')],'ChatOfflineMessageId':_0x928fe2['id']};});}var _0xfdb734;if(!_[_0x8a7c('0x71')](_0xefcceb[_0x8a7c('0xdd')])){var _0x3ff81b=_[_0x8a7c('0x2e')](_0x4422d9[_0x8a7c('0x4e')],function(_0x24542){return _0x24542;});var _0x4e4ba1=_['toPairsIn'](_0x3ff81b)[0x0];var _0x20b000=_[_0x8a7c('0xde')](_0x4e4ba1,function(_0x5dfa15){return _0x5dfa15;});_0xfdb734=_0x20b000[0x1][_0xefcceb[_0x8a7c('0xdd')]];}var _0x2911fc={'from':_0x59e744['email'],'firstName':_0x59e744[_0x8a7c('0x9c')],'lastName':_0x59e744[_0x8a7c('0x9d')],'mapKey':_0x8a7c('0xdf'),'message':{'from':_0x59e744[_0x8a7c('0xdf')],'to':_0xefcceb[_0x8a7c('0xc2')]['email'],'cc':'','subject':_[_0x8a7c('0x71')](_0xfdb734)?_0xefcceb[_0x8a7c('0xdb')]:_0xfdb734,'messageId':'','sentAt':new Date(),'attach':_0x15c5df[_0x8a7c('0x39')],'attachments':_0x15c5df,'originChannel':_0x8a7c('0xe0'),'ChatWebsiteId':_0xefcceb['id'],'ChatOfflineMessageId':_0x5e02fd['id'],'originTo':_0xefcceb[_0x8a7c('0xc2')][_0x8a7c('0xdf')]},'body':_0x5e02fd['body']};var _0x50fe75={'account':{'id':_0xefcceb[_0x8a7c('0xe1')]},'body':_0x2911fc,'log':_0x8a7c('0xe2')};return respondWithRpcPromise(_0x8a7c('0xe2'),_0x8a7c('0xe3'),_0x50fe75,client9001)[_0x8a7c('0x26')](function(){return _0x5e02fd;})['catch'](function(_0x325abe){logger[_0x8a7c('0x16')](_0x325abe);});}return;})[_0x8a7c('0x26')](function(){if(_0x5e02fd){return _0x5e02fd;}})[_0x8a7c('0x26')](respondWithResult(_0xd78a84,null))['catch'](function(_0x56bda2){logger[_0x8a7c('0x16')]('catch',_0x56bda2);for(var _0x225b86 of _0x2ad5cf){var _0x534b90=path[_0x8a7c('0x6a')](config[_0x8a7c('0x6b')],_0x8a7c('0xcc'),_0x8a7c('0xbc'),_0x8a7c('0xcd'),_0x8a7c('0xce'),_0x225b86[_0x8a7c('0x62')]);fs_extra['remove'](_0x534b90)[_0x8a7c('0x1a')](function(_0x14a5c4){logger[_0x8a7c('0x16')](_0x8a7c('0xe4'),_0x534b90,_0x14a5c4);});}});};exports[_0x8a7c('0xe5')]=function(_0x3969ec,_0x1573ff){return db['ChatInteraction'][_0x8a7c('0x4c')]({'where':{'id':_0x3969ec[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x1573ff,null))['then'](function(_0x4ea802){if(_0x4ea802){return _0x4ea802[_0x8a7c('0xe5')](_0x3969ec['body'][_0x8a7c('0x5a')],_[_0x8a7c('0xe6')](_0x3969ec['body'],[_0x8a7c('0x5a'),'id'])||{});}})[_0x8a7c('0x26')](respondWithResult(_0x1573ff,null))['catch'](handleError(_0x1573ff,null));};exports[_0x8a7c('0xe7')]=function(_0x5c7b6d,_0x554948){var _0x435776={'raw':![],'where':{}};var _0x261d5e={};var _0x4af8e1={'count':0x0,'rows':[]};return db[_0x8a7c('0x44')][_0x8a7c('0x5d')]({'where':{'id':_0x5c7b6d['params']['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x554948,null))[_0x8a7c('0x26')](function(_0x434eb1){if(_0x434eb1){_0x261d5e['model']=_[_0x8a7c('0x33')](db[_0x8a7c('0xa9')]['rawAttributes']);_0x261d5e[_0x8a7c('0x34')]=_[_0x8a7c('0x33')](_0x5c7b6d[_0x8a7c('0x34')]);_0x261d5e[_0x8a7c('0x35')]=_[_0x8a7c('0x36')](_0x261d5e[_0x8a7c('0x32')],_0x261d5e[_0x8a7c('0x34')]);_0x435776['attributes']=_['intersection'](_0x261d5e[_0x8a7c('0x32')],qs[_0x8a7c('0x38')](_0x5c7b6d[_0x8a7c('0x34')]['fields']));_0x435776['attributes']=_0x435776[_0x8a7c('0x37')][_0x8a7c('0x39')]?_0x435776['attributes']:_0x261d5e[_0x8a7c('0x32')];if(!_0x5c7b6d[_0x8a7c('0x34')][_0x8a7c('0x3a')]('nolimit')){_0x435776[_0x8a7c('0x22')]=qs[_0x8a7c('0x22')](_0x5c7b6d['query'][_0x8a7c('0x22')]);_0x435776['offset']=qs['offset'](_0x5c7b6d['query'][_0x8a7c('0x21')]);}_0x435776[_0x8a7c('0x3c')]=qs[_0x8a7c('0x3d')](_0x5c7b6d[_0x8a7c('0x34')][_0x8a7c('0x3d')]);_0x435776['where']=qs[_0x8a7c('0x35')](_[_0x8a7c('0x3f')](_0x5c7b6d[_0x8a7c('0x34')],_0x261d5e[_0x8a7c('0x35')]));_0x435776['where'][_0x8a7c('0x57')]=_0x434eb1['id'];if(_0x5c7b6d[_0x8a7c('0x34')][_0x8a7c('0x40')]){_0x435776[_0x8a7c('0x3e')]=_['merge'](_0x435776[_0x8a7c('0x3e')],{'$or':_[_0x8a7c('0x2e')](_0x435776[_0x8a7c('0x37')],function(_0x78db8d){var _0x1da626={};_0x1da626[_0x78db8d]={'$like':'%'+_0x5c7b6d[_0x8a7c('0x34')][_0x8a7c('0x40')]+'%'};return _0x1da626;})});}_0x435776=_[_0x8a7c('0x41')]({},_0x435776,_0x5c7b6d[_0x8a7c('0x43')]);return db[_0x8a7c('0xa9')][_0x8a7c('0x20')]({'where':_0x435776['where']})[_0x8a7c('0x26')](function(_0x24c3c2){_0x4af8e1[_0x8a7c('0x20')]=_0x24c3c2;if(_0x5c7b6d['query'][_0x8a7c('0x45')]){_0x435776[_0x8a7c('0x46')]=[{'model':db[_0x8a7c('0x7d')],'as':_0x8a7c('0xe8'),'required':![]},{'model':db[_0x8a7c('0xb3')],'as':_0x8a7c('0xe9'),'attributes':[_0x8a7c('0x2b'),_0x8a7c('0xea'),'internal'],'required':![]},{'model':db[_0x8a7c('0xeb')],'as':_0x8a7c('0xec'),'attributes':['id',_0x8a7c('0x2b'),_0x8a7c('0xed')],'where':_0x5c7b6d['query'][_0x8a7c('0xee')]?{'id':_0x5c7b6d[_0x8a7c('0x34')][_0x8a7c('0xee')]}:undefined,'required':_0x5c7b6d[_0x8a7c('0x34')][_0x8a7c('0xee')]?!![]:![]}];}return db[_0x8a7c('0xa9')][_0x8a7c('0x47')](_0x435776);})[_0x8a7c('0x26')](function(_0x5b2adf){_0x4af8e1['rows']=_0x5b2adf;return _0x4af8e1;});}})[_0x8a7c('0x26')](respondWithFilteredResult(_0x554948,_0x435776))[_0x8a7c('0x1a')](handleError(_0x554948,null));};function iftimePromise(_0x536045,_0x931e7f){return respondWithRpcPromise(_0x8a7c('0xef'),_0x8a7c('0xf0'),{'command':_0x931e7f[_0x8a7c('0xf1')]?util[_0x8a7c('0xa6')]('iftime\x20%s,%s',_0x536045[_0x8a7c('0xf2')],_0x931e7f[_0x8a7c('0xf1')]):util[_0x8a7c('0xa6')](_0x8a7c('0xf3'),_0x536045[_0x8a7c('0xf2')])},client9002)['then'](function(_0x4e4f62){var _0x88fa94=_0x4e4f62&&_0x4e4f62[_0x8a7c('0xf4')](_0x8a7c('0xf5'))>=0x0?!![]:![];logger[_0x8a7c('0x18')](_0x8a7c('0xf6'),_0x931e7f['id'],_0x536045['id'],_0x536045[_0x8a7c('0xf2')],_0x88fa94?_0x8a7c('0xf7'):_0x8a7c('0xf8'),_0x931e7f[_0x8a7c('0xf1')]?_0x931e7f[_0x8a7c('0xf1')]:'No\x20timezone');return _0x88fa94;})[_0x8a7c('0x1a')](function(_0xd486f0){logger[_0x8a7c('0x16')](_0x8a7c('0xf6'),_0x931e7f['id'],_0x536045['id'],_0x536045[_0x8a7c('0xf2')],util['inspect'](_0xd486f0,{'showHidden':![],'depth':null}),_0x931e7f[_0x8a7c('0xf1')]?_0x931e7f['timezone']:'No\x20timezone');return![];});}exports[_0x8a7c('0xf0')]=function(_0x1ce7de,_0x4be536){var _0x191a51=0x0;var _0x185161=0x0;var _0x22afdf=![];var _0x249f4f;var _0x1b0ed9;return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x1ce7de[_0x8a7c('0x4a')]['id']},'include':[{'model':db[_0x8a7c('0xf9')],'as':_0x8a7c('0xf9'),'include':[{'model':db[_0x8a7c('0xf9')],'as':_0x8a7c('0xfa'),'attributes':['id',_0x8a7c('0xf2')],'raw':!![]}]}]})[_0x8a7c('0x26')](handleEntityNotFound(_0x4be536,null))[_0x8a7c('0x26')](function(_0x5b2dd4){if(_0x5b2dd4){_0x249f4f=_0x5b2dd4;return _0x5b2dd4['getProactiveActions']({'raw':!![]});}})['then'](function(_0x167ec8){if(_0x249f4f){if(_0x167ec8){_0x1b0ed9=_0x167ec8;}}return require(_0x8a7c('0x6d'))[_0x8a7c('0x6e')]();})['then'](function(_0x54f4bb){if(_0x54f4bb){_0x185161=_0x54f4bb[_0x8a7c('0xfb')];_0x22afdf=_0x54f4bb[_0x8a7c('0xfc')];}})[_0x8a7c('0x26')](function(){return db[_0x8a7c('0xa9')][_0x8a7c('0x20')]({'where':{'closed':![]}});})[_0x8a7c('0x26')](function(_0x139316){_0x191a51=_0x139316;if(_0x185161&&_0x139316>_0x185161){return db['License'][_0x8a7c('0x5d')]({'where':{'id':0x1}})['then'](function(_0x197404){if(_0x197404){_0x197404[_0x8a7c('0xfd')]('chatLicenseExceeded');}});}})[_0x8a7c('0x26')](function(){if(_0x249f4f[_0x8a7c('0xf9')]&&_0x249f4f['Interval'][_0x8a7c('0xfa')]){var _0x4611b9=[];for(var _0x1730a8=0x0;_0x1730a8<_0x249f4f['Interval']['Intervals'][_0x8a7c('0x39')];_0x1730a8++){var _0x2d4a7b=_0x249f4f[_0x8a7c('0xf9')][_0x8a7c('0xfa')][_0x1730a8][_0x8a7c('0x28')]({'plain':!![]});_0x4611b9['push'](iftimePromise(_0x2d4a7b,_0x249f4f));}return BPromise[_0x8a7c('0xfe')](_0x4611b9)[_0x8a7c('0x26')](function(_0x552aef){return _['some'](_0x552aef);});}else{return!![];}})['then'](function(_0x6dc5e1){var _0x115672=fs[_0x8a7c('0xff')](path[_0x8a7c('0x6a')](config['root'],_0x8a7c('0x100')),_0x8a7c('0xc5'));var _0x2d874b={'remote':_0x249f4f[_0x8a7c('0x101')],'query':querystring[_0x8a7c('0xa7')](_[_0x8a7c('0x41')](_0x249f4f[_0x8a7c('0x28')]({'plain':!![]}),{'customerIp':_0x1ce7de[_0x8a7c('0x7a')][_0x8a7c('0x99')]||_0x1ce7de['headers'][_0x8a7c('0x102')]||_0x1ce7de['connection']['remoteAddress']||_0x1ce7de['ip'],'referer':_0x1ce7de[_0x8a7c('0x7a')][_0x8a7c('0x9f')],'openedInteractions':_0x191a51,'maxInteractions':_0x185161,'virtual':_0x22afdf['virtual'],'online':_0x6dc5e1,'custom':_0x22afdf}))['replace'](/'/g,'\x5c\x27')};_0x4be536['send'](ejs[_0x8a7c('0xc6')](Mustache['render'](_0x115672,_0x2d874b),{'proactiveActions':_0x1b0ed9,'alignment':_0x249f4f[_0x8a7c('0x103')],'verticalAlignment':_0x249f4f[_0x8a7c('0x104')],'div_color':_0x249f4f[_0x8a7c('0xed')],'labelText':_0x249f4f[_0x8a7c('0x105')],'text_color':_0x249f4f[_0x8a7c('0x106')],'text_button_color':_0x249f4f['textButtonColor'],'button_color':_0x249f4f[_0x8a7c('0x107')],'background_color':_0x249f4f[_0x8a7c('0x108')],'hideWhenOffline':_0x249f4f[_0x8a7c('0x109')],'interval':_0x249f4f['IntervalId']}));})[_0x8a7c('0x1a')](handleError(_0x4be536,null));};exports['addApplications']=function(_0x2da57d,_0x3151b0){var _0x399e16=_0x2da57d[_0x8a7c('0x4a')]['id'];var _0x2b243a=_0x2da57d[_0x8a7c('0x4e')];var _0x43ef0d=0xc8;var _0x1d6ac5=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x8a7c('0xcf')][_0x8a7c('0x10a')]['ISOLATION_LEVELS'][_0x8a7c('0x10b')]},function(_0x152e9d){return db['ChatWebsite'][_0x8a7c('0x5d')]({'where':{'id':_0x399e16},'transaction':_0x152e9d})[_0x8a7c('0x26')](function(_0x2e0d1f){if(_0x2e0d1f){return db[_0x8a7c('0x8e')][_0x8a7c('0x27')]({'where':{'ChatWebsiteId':_0x399e16},'transaction':_0x152e9d})['then'](function(){var _0x3b7b94=_[_0x8a7c('0x2e')](_0x2b243a,function(_0x4783b5){_0x4783b5['ChatWebsiteId']=_0x399e16;return _0x4783b5;});return db[_0x8a7c('0x8e')][_0x8a7c('0xd2')](_0x3b7b94,{'transaction':_0x152e9d});});}else{_0x43ef0d=0x194;_0x1d6ac5=[];}});})[_0x8a7c('0x26')](function(){if(_0x43ef0d!==0x194){return db[_0x8a7c('0x8e')][_0x8a7c('0x10c')]({'where':{'ChatWebsiteId':_0x399e16},'order':'priority'})[_0x8a7c('0x26')](function(_0xb79c82){_0x1d6ac5=_0xb79c82;});}})['catch'](function(_0x27b6d2){_0x43ef0d=0x1f4;logger[_0x8a7c('0x16')](_0x27b6d2['stack']);if(_0x27b6d2[_0x8a7c('0x2b')]){delete _0x27b6d2[_0x8a7c('0x2b')];}_0x1d6ac5=_0x27b6d2;})['finally'](function(){if(_0x1d6ac5===null){_0x3151b0['sendStatus'](_0x43ef0d);}else{if(_0x43ef0d===0x1f4){_0x3151b0['status'](_0x43ef0d)[_0x8a7c('0x2c')](_0x1d6ac5);}else{_0x3151b0[_0x8a7c('0x1c')](_0x43ef0d)[_0x8a7c('0x1e')](_0x1d6ac5);}}});};exports[_0x8a7c('0x10d')]=function(_0x52eee9,_0x8a5ecf){var _0x251941={};var _0x14a32f={};var _0x21de73;var _0x5c339f;return db[_0x8a7c('0x44')]['findOne']({'where':{'id':_0x52eee9[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x8a5ecf,null))[_0x8a7c('0x26')](function(_0x1f1ab8){if(_0x1f1ab8){_0x21de73=_0x1f1ab8;_0x14a32f[_0x8a7c('0x32')]=_[_0x8a7c('0x33')](db[_0x8a7c('0x8e')][_0x8a7c('0x2f')]);_0x14a32f[_0x8a7c('0x34')]=_[_0x8a7c('0x33')](_0x52eee9[_0x8a7c('0x34')]);_0x14a32f[_0x8a7c('0x35')]=_[_0x8a7c('0x36')](_0x14a32f['model'],_0x14a32f['query']);_0x251941[_0x8a7c('0x37')]=_[_0x8a7c('0x36')](_0x14a32f[_0x8a7c('0x32')],qs['fields'](_0x52eee9[_0x8a7c('0x34')][_0x8a7c('0x38')]));_0x251941[_0x8a7c('0x37')]=_0x251941[_0x8a7c('0x37')][_0x8a7c('0x39')]?_0x251941[_0x8a7c('0x37')]:_0x14a32f['model'];_0x251941[_0x8a7c('0x3c')]=qs[_0x8a7c('0x3d')](_0x52eee9[_0x8a7c('0x34')][_0x8a7c('0x3d')]);_0x251941[_0x8a7c('0x3e')]=qs[_0x8a7c('0x35')](_[_0x8a7c('0x3f')](_0x52eee9[_0x8a7c('0x34')],_0x14a32f[_0x8a7c('0x35')]));if(_0x52eee9[_0x8a7c('0x34')][_0x8a7c('0x40')]){_0x251941[_0x8a7c('0x3e')]=_[_0x8a7c('0x41')](_0x251941[_0x8a7c('0x3e')],{'$or':_[_0x8a7c('0x2e')](_0x251941[_0x8a7c('0x37')],function(_0x3b86d3){var _0x109dbc={};_0x109dbc[_0x3b86d3]={'$like':'%'+_0x52eee9['query'][_0x8a7c('0x40')]+'%'};return _0x109dbc;})});}_0x251941=_[_0x8a7c('0x41')]({},_0x251941,_0x52eee9[_0x8a7c('0x43')]);return _0x21de73[_0x8a7c('0x10d')](_0x251941);}})[_0x8a7c('0x26')](function(_0x594333){if(_0x594333){_0x5c339f=_0x594333[_0x8a7c('0x39')];if(!_0x52eee9['query'][_0x8a7c('0x3a')](_0x8a7c('0x3b'))){_0x251941['limit']=qs[_0x8a7c('0x22')](_0x52eee9['query'][_0x8a7c('0x22')]);_0x251941[_0x8a7c('0x21')]=qs[_0x8a7c('0x21')](_0x52eee9['query']['offset']);}return _0x21de73['getApplications'](_0x251941);}})['then'](function(_0x528dd6){if(_0x528dd6){return _0x528dd6?{'count':_0x5c339f,'rows':_0x528dd6}:null;}})[_0x8a7c('0x26')](respondWithResult(_0x8a5ecf,null))[_0x8a7c('0x1a')](handleError(_0x8a5ecf,null));};exports[_0x8a7c('0x10e')]=function(_0x2a863d,_0x2963db){return db[_0x8a7c('0x10f')][_0x8a7c('0x4c')]({'where':{'id':_0x2a863d[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x2963db,null))[_0x8a7c('0x26')](function(_0x28fef1){if(_0x28fef1){return _0x28fef1[_0x8a7c('0x10e')](_0x2a863d[_0x8a7c('0x4e')]['ids'],_[_0x8a7c('0xe6')](_0x2a863d[_0x8a7c('0x4e')],[_0x8a7c('0x5a'),'id'])||{});}})[_0x8a7c('0x26')](respondWithResult(_0x2963db,null))['catch'](handleError(_0x2963db,null));};exports[_0x8a7c('0x110')]=function(_0x3e4af5,_0x52e640){var _0x1c9eaa={};var _0xaa276f={};var _0x69f08d;var _0x4f06ab;return db[_0x8a7c('0x44')][_0x8a7c('0x5d')]({'where':{'id':_0x3e4af5[_0x8a7c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52e640,null))['then'](function(_0x52e9c5){if(_0x52e9c5){_0x69f08d=_0x52e9c5;_0xaa276f[_0x8a7c('0x32')]=_[_0x8a7c('0x33')](db[_0x8a7c('0x111')][_0x8a7c('0x2f')]);_0xaa276f[_0x8a7c('0x34')]=_[_0x8a7c('0x33')](_0x3e4af5[_0x8a7c('0x34')]);_0xaa276f[_0x8a7c('0x35')]=_['intersection'](_0xaa276f['model'],_0xaa276f[_0x8a7c('0x34')]);_0x1c9eaa[_0x8a7c('0x37')]=_[_0x8a7c('0x36')](_0xaa276f[_0x8a7c('0x32')],qs[_0x8a7c('0x38')](_0x3e4af5[_0x8a7c('0x34')][_0x8a7c('0x38')]));_0x1c9eaa[_0x8a7c('0x37')]=_0x1c9eaa['attributes'][_0x8a7c('0x39')]?_0x1c9eaa[_0x8a7c('0x37')]:_0xaa276f['model'];_0x1c9eaa['order']=qs['sort'](_0x3e4af5[_0x8a7c('0x34')][_0x8a7c('0x3d')]);_0x1c9eaa[_0x8a7c('0x3e')]=qs[_0x8a7c('0x35')](_[_0x8a7c('0x3f')](_0x3e4af5[_0x8a7c('0x34')],_0xaa276f[_0x8a7c('0x35')]));if(_0x3e4af5['query']['filter']){_0x1c9eaa[_0x8a7c('0x3e')]=_[_0x8a7c('0x41')](_0x1c9eaa[_0x8a7c('0x3e')],{'$or':_[_0x8a7c('0x2e')](_0x1c9eaa[_0x8a7c('0x37')],function(_0xf55b53){var _0x4461a9={};_0x4461a9[_0xf55b53]={'$like':'%'+_0x3e4af5[_0x8a7c('0x34')][_0x8a7c('0x40')]+'%'};return _0x4461a9;})});}_0x1c9eaa=_['merge']({},_0x1c9eaa,_0x3e4af5[_0x8a7c('0x43')]);return _0x69f08d['getProactiveActions'](_0x1c9eaa);}})[_0x8a7c('0x26')](function(_0x45c3a6){if(_0x45c3a6){_0x4f06ab=_0x45c3a6['length'];if(!_0x3e4af5[_0x8a7c('0x34')][_0x8a7c('0x3a')](_0x8a7c('0x3b'))){_0x1c9eaa['limit']=qs[_0x8a7c('0x22')](_0x3e4af5[_0x8a7c('0x34')][_0x8a7c('0x22')]);_0x1c9eaa[_0x8a7c('0x21')]=qs['offset'](_0x3e4af5[_0x8a7c('0x34')]['offset']);}return _0x69f08d[_0x8a7c('0x110')](_0x1c9eaa);}})[_0x8a7c('0x26')](function(_0x49ebf4){if(_0x49ebf4){return _0x49ebf4?{'count':_0x4f06ab,'rows':_0x49ebf4}:null;}})[_0x8a7c('0x26')](respondWithResult(_0x52e640,null))['catch'](handleError(_0x52e640,null));};exports[_0x8a7c('0x112')]=function(_0x7939f7,_0x853e9e){var _0x4ffb51=_0x7939f7['query']['online']===_0x8a7c('0x113')?'offlineForm':'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x4ffb51],'where':{'id':_0x7939f7[_0x8a7c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x853e9e,null))[_0x8a7c('0x26')](function(_0xfb54f7){if(_0xfb54f7){var _0x560c12=_0xfb54f7[_0x4ffb51];var _0x351850=_0x560c12&&_0x560c12[_0x8a7c('0x114')]?_0x560c12[_0x8a7c('0x114')]:[];_0x853e9e['send']({'fromKey':_[_0x8a7c('0x71')](_0x560c12[_0x8a7c('0x115')])?undefined:_0x560c12[_0x8a7c('0x115')],'count':_0x351850['length'],'rows':_0x351850});}})[_0x8a7c('0x1a')](handleError(_0x853e9e,null));};exports['getOfflineMessages']=function(_0x5f046c,_0x4ae3da){var _0xeeeb0c={'raw':![],'where':{}};var _0x14a7e8={};var _0x32bfca={'count':0x0,'rows':[]};return db[_0x8a7c('0x44')][_0x8a7c('0x5d')]({'where':{'id':_0x5f046c[_0x8a7c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ae3da,null))[_0x8a7c('0x26')](function(_0xbc8303){if(_0xbc8303){_0x14a7e8[_0x8a7c('0x32')]=_[_0x8a7c('0x33')](db[_0x8a7c('0xc8')][_0x8a7c('0x2f')]);_0x14a7e8[_0x8a7c('0x34')]=_['keys'](_0x5f046c['query']);_0x14a7e8[_0x8a7c('0x35')]=_[_0x8a7c('0x36')](_0x14a7e8[_0x8a7c('0x32')],_0x14a7e8['query']);_0xeeeb0c['attributes']=_[_0x8a7c('0x36')](_0x14a7e8[_0x8a7c('0x32')],qs[_0x8a7c('0x38')](_0x5f046c[_0x8a7c('0x34')][_0x8a7c('0x38')]));_0xeeeb0c[_0x8a7c('0x37')]=_0xeeeb0c['attributes'][_0x8a7c('0x39')]?_0xeeeb0c[_0x8a7c('0x37')]:_0x14a7e8[_0x8a7c('0x32')];if(!_0x5f046c[_0x8a7c('0x34')][_0x8a7c('0x3a')](_0x8a7c('0x3b'))){_0xeeeb0c[_0x8a7c('0x22')]=qs['limit'](_0x5f046c['query']['limit']);_0xeeeb0c[_0x8a7c('0x21')]=qs[_0x8a7c('0x21')](_0x5f046c[_0x8a7c('0x34')]['offset']);}_0xeeeb0c[_0x8a7c('0x3c')]=qs[_0x8a7c('0x3d')](_0x5f046c['query'][_0x8a7c('0x3d')]);_0xeeeb0c[_0x8a7c('0x3e')]=qs[_0x8a7c('0x35')](_['pick'](_0x5f046c[_0x8a7c('0x34')],_0x14a7e8['filters']));_0xeeeb0c[_0x8a7c('0x3e')]['ChatWebsiteId']=_0xbc8303['id'];if(_0x5f046c[_0x8a7c('0x34')][_0x8a7c('0x40')]){_0xeeeb0c[_0x8a7c('0x3e')]=_['merge'](_0xeeeb0c[_0x8a7c('0x3e')],{'$or':_[_0x8a7c('0x2e')](_0xeeeb0c[_0x8a7c('0x37')],function(_0x133c90){var _0x46033a={};_0x46033a[_0x133c90]={'$like':'%'+_0x5f046c[_0x8a7c('0x34')]['filter']+'%'};return _0x46033a;})});}_0xeeeb0c=_[_0x8a7c('0x41')]({},_0xeeeb0c,_0x5f046c[_0x8a7c('0x43')]);return db[_0x8a7c('0xc8')][_0x8a7c('0x20')]({'where':_0xeeeb0c[_0x8a7c('0x3e')]})[_0x8a7c('0x26')](function(_0x34138f){_0x32bfca[_0x8a7c('0x20')]=_0x34138f;if(_0x5f046c[_0x8a7c('0x34')]['includeAll']){_0xeeeb0c[_0x8a7c('0x46')]=[{'all':!![]}];}else{_0xeeeb0c[_0x8a7c('0x46')]=[{'model':db[_0x8a7c('0x7d')],'as':_0x8a7c('0xe8'),'required':![]},{'model':db[_0x8a7c('0xd1')],'as':_0x8a7c('0x116'),'required':![]}];}return db[_0x8a7c('0xc8')][_0x8a7c('0x47')](_0xeeeb0c);})[_0x8a7c('0x26')](function(_0x19288c){_0x32bfca[_0x8a7c('0x48')]=_0x19288c;return _0x32bfca;});}})[_0x8a7c('0x26')](respondWithFilteredResult(_0x4ae3da,_0xeeeb0c))[_0x8a7c('0x1a')](handleError(_0x4ae3da,null));};exports[_0x8a7c('0x117')]=function(_0x3d2fb0,_0x1c80bc){return db['ChatWebsite'][_0x8a7c('0x4c')]({'where':{'id':_0x3d2fb0[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x1c80bc,null))[_0x8a7c('0x26')](function(_0x100754){if(_0x100754){return _0x100754[_0x8a7c('0x117')](_0x3d2fb0[_0x8a7c('0x4e')]['ids'],_[_0x8a7c('0xe6')](_0x3d2fb0[_0x8a7c('0x4e')],[_0x8a7c('0x5a'),'id'])||{})[_0x8a7c('0xc3')](function(_0xd6fb9){for(var _0x2c917c=0x0;_0x2c917c<_0x3d2fb0[_0x8a7c('0x4e')][_0x8a7c('0x5a')][_0x8a7c('0x39')];_0x2c917c+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x3d2fb0[_0x8a7c('0x4e')][_0x8a7c('0x5a')][_0x2c917c]),'ChatWebsiteId':Number(_0x3d2fb0[_0x8a7c('0x4a')]['id'])});}return _0xd6fb9;});}})[_0x8a7c('0x26')](respondWithResult(_0x1c80bc,null))[_0x8a7c('0x1a')](handleError(_0x1c80bc,null));};exports[_0x8a7c('0x118')]=function(_0x31f4ed,_0x10fcda){return db[_0x8a7c('0x44')][_0x8a7c('0x4c')]({'where':{'id':_0x31f4ed[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x10fcda,null))[_0x8a7c('0x26')](function(_0x279d6c){if(_0x279d6c){return _0x279d6c[_0x8a7c('0x118')](_0x31f4ed[_0x8a7c('0x34')]['ids'])[_0x8a7c('0x26')](function(){if(_[_0x8a7c('0x119')](_0x31f4ed[_0x8a7c('0x34')]['ids'])){for(var _0x4dcade=0x0;_0x4dcade<_0x31f4ed[_0x8a7c('0x34')]['ids'][_0x8a7c('0x39')];_0x4dcade+=0x1){socket[_0x8a7c('0x11a')](_0x8a7c('0x11b'),{'UserId':Number(_0x31f4ed['query'][_0x8a7c('0x5a')][_0x4dcade]),'ChatWebsiteId':Number(_0x31f4ed[_0x8a7c('0x4a')]['id'])});}}else{socket[_0x8a7c('0x11a')](_0x8a7c('0x11b'),{'UserId':Number(_0x31f4ed[_0x8a7c('0x34')][_0x8a7c('0x5a')]),'ChatWebsiteId':Number(_0x31f4ed['params']['id'])});}});}})['then'](respondWithStatusCode(_0x10fcda,null))[_0x8a7c('0x1a')](handleError(_0x10fcda,null));};exports['getAgents']=function(_0x40fea8,_0x2e06ef){var _0x29e942={};var _0x239685={};var _0x2b2630;var _0x8bbec8;return db[_0x8a7c('0x44')][_0x8a7c('0x5d')]({'where':{'id':_0x40fea8[_0x8a7c('0x4a')]['id']}})[_0x8a7c('0x26')](handleEntityNotFound(_0x2e06ef,null))[_0x8a7c('0x26')](function(_0x39bf08){if(_0x39bf08){_0x2b2630=_0x39bf08;_0x239685[_0x8a7c('0x32')]=_[_0x8a7c('0x33')](db['User'][_0x8a7c('0x2f')]);_0x239685[_0x8a7c('0x34')]=_[_0x8a7c('0x33')](_0x40fea8['query']);_0x239685[_0x8a7c('0x35')]=_['intersection'](_0x239685[_0x8a7c('0x32')],_0x239685['query']);_0x29e942[_0x8a7c('0x37')]=_[_0x8a7c('0x36')](_0x239685[_0x8a7c('0x32')],qs[_0x8a7c('0x38')](_0x40fea8[_0x8a7c('0x34')]['fields']));_0x29e942[_0x8a7c('0x37')]=_0x29e942[_0x8a7c('0x37')][_0x8a7c('0x39')]?_0x29e942[_0x8a7c('0x37')]:_0x239685[_0x8a7c('0x32')];_0x29e942['order']=qs['sort'](_0x40fea8['query'][_0x8a7c('0x3d')]);_0x29e942['where']=qs[_0x8a7c('0x35')](_[_0x8a7c('0x3f')](_0x40fea8['query'],_0x239685[_0x8a7c('0x35')]));if(_0x40fea8['query'][_0x8a7c('0x40')]){_0x29e942[_0x8a7c('0x3e')]=_[_0x8a7c('0x41')](_0x29e942[_0x8a7c('0x3e')],{'$or':_[_0x8a7c('0x2e')](_0x29e942[_0x8a7c('0x37')],function(_0x870bab){var _0x4fa105={};_0x4fa105[_0x870bab]={'$like':'%'+_0x40fea8[_0x8a7c('0x34')][_0x8a7c('0x40')]+'%'};return _0x4fa105;})});}_0x29e942=_['merge']({},_0x29e942,_0x40fea8['options']);return _0x2b2630[_0x8a7c('0x11c')](_0x29e942);}})[_0x8a7c('0x26')](function(_0x4262f1){if(_0x4262f1){_0x8bbec8=_0x4262f1['length'];if(!_0x40fea8[_0x8a7c('0x34')]['hasOwnProperty'](_0x8a7c('0x3b'))){_0x29e942['limit']=qs[_0x8a7c('0x22')](_0x40fea8['query'][_0x8a7c('0x22')]);_0x29e942['offset']=qs[_0x8a7c('0x21')](_0x40fea8[_0x8a7c('0x34')][_0x8a7c('0x21')]);}return _0x2b2630[_0x8a7c('0x11c')](_0x29e942);}})['then'](function(_0x29da7e){if(_0x29da7e){return _0x29da7e?{'count':_0x8bbec8,'rows':_0x29da7e}:null;}})[_0x8a7c('0x26')](respondWithResult(_0x2e06ef,null))['catch'](handleError(_0x2e06ef,null));}; \ No newline at end of file +var _0x9318=['includes','from','CmList','List','Applications','account','applications','list','orderBy','priority','asc','Contacts','ListId','contact','customerIp','first','firstName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','ChatInteraction','interaction','spread','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','difference','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','render','fromString','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','CloudProvider','Smtp','SendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','originalname','subjectOffline','toPairsIn','mapValues','MailAccount','offlineMessageSubject','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','timezone','No\x20timezone','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textButtonColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','false','offlineForm','onlineForm','items','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','destroy','ChatWebsites','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','findOne','order','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','agentAvatar','addCustomerAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x11bcbd,_0x4d39b3){var _0x58aa24=function(_0x7b15f3){while(--_0x7b15f3){_0x11bcbd['push'](_0x11bcbd['shift']());}};_0x58aa24(++_0x4d39b3);}(_0x9318,0x95));var _0x8931=function(_0x5aba56,_0x17f8bb){_0x5aba56=_0x5aba56-0x0;var _0x273611=_0x9318[_0x5aba56];return _0x273611;};'use strict';var BPromise=require(_0x8931('0x0'));var Mustache=require(_0x8931('0x1'));var util=require(_0x8931('0x2'));var path=require('path');var ejs=require(_0x8931('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8931('0x4'));var querystring=require(_0x8931('0x5'));var Redis=require(_0x8931('0x6'));var qs=require(_0x8931('0x7'));var logger=require(_0x8931('0x8'))('api');var config=require('../../config/environment');var db=require(_0x8931('0x9'))['db'];config[_0x8931('0xa')]=_[_0x8931('0xb')](config[_0x8931('0xa')],{'host':_0x8931('0xc'),'port':0x18eb});var socket=require(_0x8931('0xd'))(new Redis(config[_0x8931('0xa')]));require(_0x8931('0xe'))[_0x8931('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x8931('0x10'));var client=jayson[_0x8931('0x11')][_0x8931('0x12')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x8931('0x11')][_0x8931('0x12')]({'port':0x232b});var client9001=jayson[_0x8931('0x11')][_0x8931('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x2d9a4e,_0x191e1f,_0x2d1a21,_0x291d30){return new BPromise(function(_0x3f89b0,_0x1500bd){var _0x17a53b=_0x291d30||client;return _0x17a53b[_0x8931('0x13')](_0x2d9a4e,_0x2d1a21)[_0x8931('0x14')](function(_0xaa749b){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x191e1f,_0x8931('0x15'));logger['debug'](_0x8931('0x16'),_0x191e1f,_0x8931('0x15'),JSON[_0x8931('0x17')](_0xaa749b));if(_0xaa749b[_0x8931('0x18')]){if(_0xaa749b[_0x8931('0x18')][_0x8931('0x19')]===0x1f4){logger['error'](_0x8931('0x1a'),_0x191e1f,_0xaa749b['error']['message']);return _0x1500bd(_0xaa749b[_0x8931('0x18')][_0x8931('0x1b')]);}logger['error'](_0x8931('0x1a'),_0x191e1f,_0xaa749b[_0x8931('0x18')][_0x8931('0x1b')]);return _0x3f89b0(_0xaa749b[_0x8931('0x18')][_0x8931('0x1b')]);}else{logger[_0x8931('0x1c')](_0x8931('0x1a'),_0x191e1f,_0x8931('0x15'));_0x3f89b0(_0xaa749b['result']['message']);}})[_0x8931('0x1d')](function(_0x4dbee7){logger[_0x8931('0x18')](_0x8931('0x1a'),_0x191e1f,_0x4dbee7);_0x1500bd(_0x4dbee7);});});}function respondWithStatusCode(_0x30079e,_0x116511){_0x116511=_0x116511||0xcc;return function(_0x4de59b){if(_0x4de59b){return _0x30079e[_0x8931('0x1e')](_0x116511);}return _0x30079e[_0x8931('0x1f')](_0x116511)[_0x8931('0x20')]();};}function respondWithResult(_0x3e5001,_0x232145){_0x232145=_0x232145||0xc8;return function(_0xaa086b){if(_0xaa086b){return _0x3e5001[_0x8931('0x1f')](_0x232145)[_0x8931('0x21')](_0xaa086b);}};}function respondWithFilteredResult(_0x581c94,_0x564d4a){return function(_0x244bc5){if(_0x244bc5){var _0x2bf1dc=typeof _0x564d4a['offset']===_0x8931('0x22')&&typeof _0x564d4a[_0x8931('0x23')]==='undefined';var _0xa9fe8f=_0x244bc5[_0x8931('0x24')];var _0x3ea571=_0x2bf1dc?0x0:_0x564d4a[_0x8931('0x25')];var _0x2b9f89=_0x2bf1dc?_0x244bc5[_0x8931('0x24')]:_0x564d4a[_0x8931('0x25')]+_0x564d4a[_0x8931('0x23')];var _0x8a7c7f;if(_0x2b9f89>=_0xa9fe8f){_0x2b9f89=_0xa9fe8f;_0x8a7c7f=0xc8;}else{_0x8a7c7f=0xce;}_0x581c94['status'](_0x8a7c7f);return _0x581c94['set'](_0x8931('0x26'),_0x3ea571+'-'+_0x2b9f89+'/'+_0xa9fe8f)[_0x8931('0x21')](_0x244bc5);}return null;};}function saveUpdates(_0x133d32){return function(_0x5ee08d){if(_0x5ee08d){return _0x5ee08d['update'](_0x133d32)[_0x8931('0x14')](function(_0x3054ec){return _0x3054ec;});}return null;};}function removeEntity(_0x2990f8){return function(_0x3315b0){if(_0x3315b0){return _0x3315b0[_0x8931('0x27')]()[_0x8931('0x14')](function(){var _0x52d69d=_0x3315b0['get']({'plain':!![]});var _0x5b7d4f=_0x8931('0x28');return db[_0x8931('0x29')][_0x8931('0x27')]({'where':{'type':_0x5b7d4f,'resourceId':_0x52d69d['id']}})['then'](function(){return _0x3315b0;});})[_0x8931('0x14')](function(){_0x2990f8['status'](0xcc)[_0x8931('0x20')]();});}};}function handleEntityNotFound(_0x55757e){return function(_0x412950){if(!_0x412950){_0x55757e['sendStatus'](0x194);}return _0x412950;};}function handleError(_0x1873de,_0x29f7c0){_0x29f7c0=_0x29f7c0||0x1f4;return function(_0x1ccdef){logger[_0x8931('0x18')](_0x1ccdef[_0x8931('0x2a')]);if(_0x1ccdef['name']){delete _0x1ccdef[_0x8931('0x2b')];}_0x1873de[_0x8931('0x1f')](_0x29f7c0)[_0x8931('0x2c')](_0x1ccdef);};}exports['index']=function(_0x41d5f9,_0xbbc741){var _0x57c256={'include':[{'model':db[_0x8931('0x2d')],'as':_0x8931('0x2e')}]},_0x3c0b9b={},_0x123290={'count':0x0,'rows':[]};var _0x3179af=_[_0x8931('0x2f')](db[_0x8931('0x30')][_0x8931('0x31')],function(_0xc52bff){return{'name':_0xc52bff[_0x8931('0x32')],'type':_0xc52bff['type']['key']};});_0x3c0b9b[_0x8931('0x33')]=_[_0x8931('0x2f')](_0x3179af,_0x8931('0x2b'));_0x3c0b9b[_0x8931('0x34')]=_[_0x8931('0x35')](_0x41d5f9['query']);_0x3c0b9b[_0x8931('0x36')]=_[_0x8931('0x37')](_0x3c0b9b[_0x8931('0x33')],_0x3c0b9b['query']);_0x57c256['attributes']=_[_0x8931('0x37')](_0x3c0b9b['model'],qs[_0x8931('0x38')](_0x41d5f9[_0x8931('0x34')]['fields']));_0x57c256[_0x8931('0x39')]=_0x57c256[_0x8931('0x39')][_0x8931('0x3a')]?_0x57c256['attributes']:_0x3c0b9b[_0x8931('0x33')];if(!_0x41d5f9[_0x8931('0x34')][_0x8931('0x3b')](_0x8931('0x3c'))){_0x57c256[_0x8931('0x23')]=qs[_0x8931('0x23')](_0x41d5f9[_0x8931('0x34')][_0x8931('0x23')]);_0x57c256[_0x8931('0x25')]=qs[_0x8931('0x25')](_0x41d5f9[_0x8931('0x34')][_0x8931('0x25')]);}_0x57c256['order']=qs[_0x8931('0x3d')](_0x41d5f9[_0x8931('0x34')][_0x8931('0x3d')]);_0x57c256[_0x8931('0x3e')]=qs[_0x8931('0x36')](_[_0x8931('0x3f')](_0x41d5f9[_0x8931('0x34')],_0x3c0b9b[_0x8931('0x36')]),_0x3179af);if(_0x41d5f9['query']['filter']){_0x57c256['where']=_['merge'](_0x57c256[_0x8931('0x3e')],{'$or':_[_0x8931('0x2f')](_0x3179af,function(_0xd68181){if(_0xd68181['type']!=='VIRTUAL'){var _0x1be7dd={};_0x1be7dd[_0xd68181[_0x8931('0x2b')]]={'$like':'%'+_0x41d5f9['query'][_0x8931('0x40')]+'%'};return _0x1be7dd;}})});}_0x57c256=_[_0x8931('0x41')]({},_0x57c256,_0x41d5f9[_0x8931('0x42')]);var _0xc3a20e={'where':_0x57c256[_0x8931('0x3e')]};return db['ChatWebsite'][_0x8931('0x24')](_0xc3a20e)[_0x8931('0x14')](function(_0x55018f){_0x123290['count']=_0x55018f;if(_0x41d5f9[_0x8931('0x34')][_0x8931('0x43')]){_0x57c256[_0x8931('0x44')]=[{'all':!![]}];}return db[_0x8931('0x30')][_0x8931('0x45')](_0x57c256);})[_0x8931('0x14')](function(_0x58d5c3){_0x123290[_0x8931('0x46')]=_0x58d5c3;return _0x123290;})[_0x8931('0x14')](respondWithFilteredResult(_0xbbc741,_0x57c256))['catch'](handleError(_0xbbc741,null));};exports[_0x8931('0x47')]=function(_0x508b10,_0x1eaaca){var _0x293818={'raw':![],'where':{'id':_0x508b10[_0x8931('0x48')]['id']},'include':[{'model':db[_0x8931('0x2d')],'as':_0x8931('0x2e')}]},_0x37fcb8={};_0x37fcb8[_0x8931('0x33')]=_['keys'](db[_0x8931('0x30')]['rawAttributes']);_0x37fcb8[_0x8931('0x34')]=_['keys'](_0x508b10['query']);_0x37fcb8['filters']=_[_0x8931('0x37')](_0x37fcb8[_0x8931('0x33')],_0x37fcb8['query']);_0x293818[_0x8931('0x39')]=_['intersection'](_0x37fcb8[_0x8931('0x33')],qs[_0x8931('0x38')](_0x508b10['query'][_0x8931('0x38')]));_0x293818[_0x8931('0x39')]=_0x293818[_0x8931('0x39')]['length']?_0x293818[_0x8931('0x39')]:_0x37fcb8[_0x8931('0x33')];if(_0x508b10[_0x8931('0x34')][_0x8931('0x43')]){_0x293818[_0x8931('0x44')]=[{'all':!![]}];}_0x293818=_['merge']({},_0x293818,_0x508b10[_0x8931('0x42')]);return db[_0x8931('0x30')][_0x8931('0x49')](_0x293818)['then'](handleEntityNotFound(_0x1eaaca,null))[_0x8931('0x14')](respondWithResult(_0x1eaaca,null))[_0x8931('0x1d')](handleError(_0x1eaaca,null));};exports[_0x8931('0x4a')]=function(_0x3a9528,_0x3fa856){return db[_0x8931('0x30')][_0x8931('0x4a')](_0x3a9528[_0x8931('0x4b')],{})[_0x8931('0x14')](function(_0x54bbe7){var _0x169f93=_0x3a9528['user'][_0x8931('0x4c')]({'plain':!![]});if(!_0x169f93)throw new Error(_0x8931('0x4d'));if(_0x169f93[_0x8931('0x4e')]===_0x8931('0x4f')){var _0x159061=_0x54bbe7['get']({'plain':!![]});var _0x5423b3='ChatWebsites';return db[_0x8931('0x50')][_0x8931('0x49')]({'where':{'name':_0x5423b3,'userProfileId':_0x169f93['userProfileId']},'raw':!![]})[_0x8931('0x14')](function(_0x78e31){if(_0x78e31&&_0x78e31[_0x8931('0x51')]===0x0){return db[_0x8931('0x29')][_0x8931('0x4a')]({'name':_0x159061[_0x8931('0x2b')],'resourceId':_0x159061['id'],'type':_0x78e31[_0x8931('0x2b')],'sectionId':_0x78e31['id']},{})[_0x8931('0x14')](function(){return _0x54bbe7;});}else{return _0x54bbe7;}})['catch'](function(_0x2e2ae5){logger[_0x8931('0x18')](_0x8931('0x52'),_0x2e2ae5);throw _0x2e2ae5;});}return _0x54bbe7;})[_0x8931('0x14')](respondWithResult(_0x3fa856,0xc9))[_0x8931('0x1d')](handleError(_0x3fa856,null));};exports[_0x8931('0x53')]=function(_0x3ea9a0,_0x32ec4d){if(_0x3ea9a0[_0x8931('0x4b')]['id']){delete _0x3ea9a0[_0x8931('0x4b')]['id'];}return db['ChatWebsite'][_0x8931('0x49')]({'where':{'id':_0x3ea9a0[_0x8931('0x48')]['id']},'include':[{'model':db[_0x8931('0x2d')],'as':_0x8931('0x2e')}]})[_0x8931('0x14')](handleEntityNotFound(_0x32ec4d,null))[_0x8931('0x14')](saveUpdates(_0x3ea9a0[_0x8931('0x4b')],null))['then'](respondWithResult(_0x32ec4d,null))['catch'](handleError(_0x32ec4d,null));};exports['destroy']=function(_0xa9ccfe,_0x4ae71d){return db[_0x8931('0x30')][_0x8931('0x49')]({'where':{'id':_0xa9ccfe[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x4ae71d,null))[_0x8931('0x14')](removeEntity(_0x4ae71d,null))[_0x8931('0x1d')](handleError(_0x4ae71d,null));};exports[_0x8931('0x54')]=function(_0x4053dd,_0x33e504){return db[_0x8931('0x30')]['describe']()[_0x8931('0x14')](respondWithResult(_0x33e504,null))[_0x8931('0x1d')](handleError(_0x33e504,null));};exports[_0x8931('0x55')]=function(_0x2c50d9,_0x3b5d0e){if(_0x2c50d9['body']['id']){delete _0x2c50d9['body']['id'];}return db[_0x8931('0x30')][_0x8931('0x49')]({'where':{'id':_0x2c50d9['params']['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x3b5d0e,null))['then'](function(_0x3eb248){if(_0x3eb248){_0x2c50d9[_0x8931('0x4b')]['ChatWebsiteId']=_0x3eb248['id'];return db[_0x8931('0x56')][_0x8931('0x4a')](_0x2c50d9[_0x8931('0x4b')]);}})[_0x8931('0x14')](respondWithResult(_0x3b5d0e,null))['catch'](handleError(_0x3b5d0e,null));};exports['getDispositions']=function(_0x1dfda3,_0x5e38b0){var _0x30d2da={'raw':![],'where':{}};var _0xc8f9fc={};var _0x323e60={'count':0x0,'rows':[]};return db[_0x8931('0x30')][_0x8931('0x57')]({'where':{'id':_0x1dfda3[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x5e38b0,null))['then'](function(_0x3fa70d){if(_0x3fa70d){_0xc8f9fc[_0x8931('0x33')]=_[_0x8931('0x35')](db[_0x8931('0x56')][_0x8931('0x31')]);_0xc8f9fc[_0x8931('0x34')]=_[_0x8931('0x35')](_0x1dfda3[_0x8931('0x34')]);_0xc8f9fc[_0x8931('0x36')]=_[_0x8931('0x37')](_0xc8f9fc[_0x8931('0x33')],_0xc8f9fc[_0x8931('0x34')]);_0x30d2da[_0x8931('0x39')]=_[_0x8931('0x37')](_0xc8f9fc[_0x8931('0x33')],qs[_0x8931('0x38')](_0x1dfda3['query']['fields']));_0x30d2da['attributes']=_0x30d2da[_0x8931('0x39')][_0x8931('0x3a')]?_0x30d2da[_0x8931('0x39')]:_0xc8f9fc['model'];if(!_0x1dfda3[_0x8931('0x34')][_0x8931('0x3b')](_0x8931('0x3c'))){_0x30d2da['limit']=qs[_0x8931('0x23')](_0x1dfda3[_0x8931('0x34')][_0x8931('0x23')]);_0x30d2da[_0x8931('0x25')]=qs['offset'](_0x1dfda3[_0x8931('0x34')]['offset']);}_0x30d2da[_0x8931('0x58')]=qs[_0x8931('0x3d')](_0x1dfda3[_0x8931('0x34')][_0x8931('0x3d')]);_0x30d2da[_0x8931('0x3e')]=qs[_0x8931('0x36')](_[_0x8931('0x3f')](_0x1dfda3[_0x8931('0x34')],_0xc8f9fc[_0x8931('0x36')]));_0x30d2da[_0x8931('0x3e')][_0x8931('0x59')]=_0x3fa70d['id'];if(_0x1dfda3[_0x8931('0x34')][_0x8931('0x40')]){_0x30d2da[_0x8931('0x3e')]=_[_0x8931('0x41')](_0x30d2da[_0x8931('0x3e')],{'$or':_['map'](_0x30d2da[_0x8931('0x39')],function(_0x1a6dec){var _0x45c975={};_0x45c975[_0x1a6dec]={'$like':'%'+_0x1dfda3['query'][_0x8931('0x40')]+'%'};return _0x45c975;})});}_0x30d2da=_['merge']({},_0x30d2da,_0x1dfda3['options']);return db[_0x8931('0x56')][_0x8931('0x24')]({'where':_0x30d2da[_0x8931('0x3e')]})['then'](function(_0x2e68db){_0x323e60[_0x8931('0x24')]=_0x2e68db;if(_0x1dfda3['query'][_0x8931('0x43')]){_0x30d2da[_0x8931('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x30d2da);})[_0x8931('0x14')](function(_0x34673a){_0x323e60['rows']=_0x34673a;return _0x323e60;});}})[_0x8931('0x14')](respondWithFilteredResult(_0x5e38b0,_0x30d2da))[_0x8931('0x1d')](handleError(_0x5e38b0,null));};exports[_0x8931('0x5a')]=function(_0x1f4c97,_0x724744){return db['ChatWebsite'][_0x8931('0x49')]({'where':{'id':_0x1f4c97['params']['id']}})['then'](handleEntityNotFound(_0x724744,null))[_0x8931('0x14')](function(_0x4e4107){if(_0x4e4107){return _0x4e4107[_0x8931('0x5a')](_0x1f4c97[_0x8931('0x34')][_0x8931('0x5b')]);}})[_0x8931('0x14')](respondWithStatusCode(_0x724744,null))[_0x8931('0x1d')](handleError(_0x724744,null));};exports[_0x8931('0x5c')]=function(_0xb8dd9f,_0x1abd88){if(_0xb8dd9f['body']['id']){delete _0xb8dd9f[_0x8931('0x4b')]['id'];}return db[_0x8931('0x30')][_0x8931('0x49')]({'where':{'id':_0xb8dd9f[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x1abd88,null))[_0x8931('0x14')](function(_0x4c1da9){if(_0x4c1da9){_0xb8dd9f[_0x8931('0x4b')][_0x8931('0x59')]=_0x4c1da9['id'];return db[_0x8931('0x5d')][_0x8931('0x4a')](_0xb8dd9f[_0x8931('0x4b')]);}})['then'](respondWithResult(_0x1abd88,null))[_0x8931('0x1d')](handleError(_0x1abd88,null));};exports[_0x8931('0x5e')]=function(_0x157691,_0x4fcfae){var _0x333865={'raw':![],'where':{}};var _0x80a19a={};var _0x491d52={'count':0x0,'rows':[]};return db[_0x8931('0x30')]['findOne']({'where':{'id':_0x157691[_0x8931('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fcfae,null))['then'](function(_0x20e7b9){if(_0x20e7b9){_0x80a19a[_0x8931('0x33')]=_[_0x8931('0x35')](db['CannedAnswer'][_0x8931('0x31')]);_0x80a19a[_0x8931('0x34')]=_[_0x8931('0x35')](_0x157691['query']);_0x80a19a[_0x8931('0x36')]=_['intersection'](_0x80a19a[_0x8931('0x33')],_0x80a19a[_0x8931('0x34')]);_0x333865['attributes']=_[_0x8931('0x37')](_0x80a19a[_0x8931('0x33')],qs[_0x8931('0x38')](_0x157691[_0x8931('0x34')]['fields']));_0x333865[_0x8931('0x39')]=_0x333865[_0x8931('0x39')]['length']?_0x333865['attributes']:_0x80a19a[_0x8931('0x33')];if(!_0x157691[_0x8931('0x34')]['hasOwnProperty']('nolimit')){_0x333865[_0x8931('0x23')]=qs['limit'](_0x157691[_0x8931('0x34')][_0x8931('0x23')]);_0x333865[_0x8931('0x25')]=qs[_0x8931('0x25')](_0x157691[_0x8931('0x34')][_0x8931('0x25')]);}_0x333865[_0x8931('0x58')]=qs[_0x8931('0x3d')](_0x157691[_0x8931('0x34')]['sort']);_0x333865['where']=qs[_0x8931('0x36')](_[_0x8931('0x3f')](_0x157691[_0x8931('0x34')],_0x80a19a[_0x8931('0x36')]));_0x333865[_0x8931('0x3e')]['ChatWebsiteId']=_0x20e7b9['id'];if(_0x157691[_0x8931('0x34')][_0x8931('0x40')]){_0x333865[_0x8931('0x3e')]=_[_0x8931('0x41')](_0x333865[_0x8931('0x3e')],{'$or':_['map'](_0x333865['attributes'],function(_0x177a72){var _0x58df0d={};_0x58df0d[_0x177a72]={'$like':'%'+_0x157691[_0x8931('0x34')][_0x8931('0x40')]+'%'};return _0x58df0d;})});}_0x333865=_[_0x8931('0x41')]({},_0x333865,_0x157691[_0x8931('0x42')]);return db[_0x8931('0x5d')][_0x8931('0x24')]({'where':_0x333865[_0x8931('0x3e')]})[_0x8931('0x14')](function(_0x570792){_0x491d52['count']=_0x570792;if(_0x157691[_0x8931('0x34')][_0x8931('0x43')]){_0x333865[_0x8931('0x44')]=[{'all':!![]}];}return db[_0x8931('0x5d')][_0x8931('0x45')](_0x333865);})[_0x8931('0x14')](function(_0x384ec7){_0x491d52['rows']=_0x384ec7;return _0x491d52;});}})['then'](respondWithFilteredResult(_0x4fcfae,_0x333865))[_0x8931('0x1d')](handleError(_0x4fcfae,null));};exports[_0x8931('0x5f')]=function(_0x4e8b26,_0x418a8b){return db['ChatWebsite'][_0x8931('0x49')]({'where':{'id':_0x4e8b26[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x418a8b,null))[_0x8931('0x14')](function(_0x408653){if(_0x408653){return _0x408653[_0x8931('0x5f')](_0x4e8b26['query'][_0x8931('0x5b')]);}})['then'](respondWithStatusCode(_0x418a8b,null))[_0x8931('0x1d')](handleError(_0x418a8b,null));};exports[_0x8931('0x60')]=function(_0x38d57b,_0x4523ef){_0x38d57b[_0x8931('0x4b')][_0x8931('0x61')]=_0x38d57b[_0x8931('0x62')]['filename'];return db[_0x8931('0x30')]['find']({'where':{'id':_0x38d57b['params']['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x4523ef,null))[_0x8931('0x14')](saveUpdates(_0x38d57b[_0x8931('0x4b')],null))[_0x8931('0x14')](respondWithResult(_0x4523ef,null))[_0x8931('0x1d')](handleError(_0x4523ef,null));};exports['addAvatar']=function(_0x102bd0,_0x13f227){_0x102bd0[_0x8931('0x4b')][_0x8931('0x63')]=_0x102bd0['file']['filename'];return db['ChatWebsite'][_0x8931('0x49')]({'where':{'id':_0x102bd0[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x13f227,null))[_0x8931('0x14')](saveUpdates(_0x102bd0[_0x8931('0x4b')],null))['then'](respondWithResult(_0x13f227,null))[_0x8931('0x1d')](handleError(_0x13f227,null));};exports[_0x8931('0x64')]=function(_0x58fca2,_0x3c576f){_0x58fca2[_0x8931('0x4b')][_0x8931('0x65')]=_0x58fca2[_0x8931('0x62')][_0x8931('0x66')];return db[_0x8931('0x30')][_0x8931('0x49')]({'where':{'id':_0x58fca2[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x3c576f,null))['then'](saveUpdates(_0x58fca2['body'],null))[_0x8931('0x14')](respondWithResult(_0x3c576f,null))['catch'](handleError(_0x3c576f,null));};exports[_0x8931('0x67')]=function(_0x235946,_0x4a6116){_0x235946[_0x8931('0x4b')][_0x8931('0x68')]=_0x235946[_0x8931('0x62')]['filename'];return db[_0x8931('0x30')]['find']({'where':{'id':_0x235946[_0x8931('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a6116,null))[_0x8931('0x14')](saveUpdates(_0x235946[_0x8931('0x4b')],null))['then'](respondWithResult(_0x4a6116,null))['catch'](handleError(_0x4a6116,null));};exports[_0x8931('0x69')]=function(_0x237587,_0x1e4819){var _0x96cd07=path[_0x8931('0x6a')](config[_0x8931('0x6b')],_0x8931('0x6c'));var _0x5b2322={'where':{'id':_0x237587['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x28f06a=![];return require(_0x8931('0x6d'))[_0x8931('0x6e')]()[_0x8931('0x14')](function(_0x111801){if(_0x111801){_0x28f06a=_0x111801[_0x8931('0x6f')];}})[_0x8931('0x14')](function(){return db[_0x8931('0x30')][_0x8931('0x49')](_0x5b2322);})[_0x8931('0x14')](handleEntityNotFound(_0x1e4819,null))[_0x8931('0x14')](function(_0x35f03f){if(_0x35f03f){if(!_[_0x8931('0x70')](_0x35f03f[_0x8931('0x61')])){if(fs[_0x8931('0x71')](path[_0x8931('0x6a')](config['root'],_0x8931('0x72'),_0x35f03f[_0x8931('0x61')]))&&_0x28f06a){_0x96cd07=path['join'](config[_0x8931('0x6b')],'server/files/images/logos/',_0x35f03f[_0x8931('0x61')]);}}return _0x1e4819[_0x8931('0x73')](_0x96cd07);}})[_0x8931('0x1d')](handleError(_0x1e4819,null));};exports[_0x8931('0x74')]=function(_0x50fe4f,_0x3d8699){var _0x44858c=path['join'](config[_0x8931('0x6b')],'server/files/images/avatars/default_avatar.png');var _0x24334b={'where':{'id':_0x50fe4f[_0x8931('0x48')]['id']},'attributes':['id',_0x8931('0x63')],'raw':!![]};return db[_0x8931('0x30')][_0x8931('0x49')](_0x24334b)[_0x8931('0x14')](handleEntityNotFound(_0x3d8699,null))[_0x8931('0x14')](function(_0x3ac242){if(_0x3ac242){if(!_['isNil'](_0x3ac242['agentAvatar'])){if(fs[_0x8931('0x71')](path[_0x8931('0x6a')](config[_0x8931('0x6b')],'server/files/images/avatars/',_0x3ac242[_0x8931('0x63')]))){_0x44858c=path[_0x8931('0x6a')](config[_0x8931('0x6b')],'server/files/images/avatars/',_0x3ac242[_0x8931('0x63')]);}}return _0x3d8699['download'](_0x44858c);}})[_0x8931('0x1d')](handleError(_0x3d8699,null));};exports[_0x8931('0x75')]=function(_0x4902dc,_0x599e5e){var _0x157a4e=path[_0x8931('0x6a')](config[_0x8931('0x6b')],_0x8931('0x76'));var _0x31c18a={'where':{'id':_0x4902dc['params']['id']},'attributes':['id','customerAvatar',_0x8931('0x77')],'raw':!![]};return db['ChatWebsite'][_0x8931('0x49')](_0x31c18a)['then'](handleEntityNotFound(_0x599e5e,null))[_0x8931('0x14')](function(_0x370b17){if(_0x370b17){if(!_[_0x8931('0x70')](_0x370b17[_0x8931('0x65')])){if(fs[_0x8931('0x71')](path[_0x8931('0x6a')](config['root'],_0x8931('0x78'),_0x370b17[_0x8931('0x65')]))&&_0x370b17['showCustomerAvatar']){_0x157a4e=path['join'](config[_0x8931('0x6b')],_0x8931('0x78'),_0x370b17[_0x8931('0x65')]);}}return _0x599e5e[_0x8931('0x73')](_0x157a4e);}})['catch'](handleError(_0x599e5e,null));};exports['getSystemAvatar']=function(_0x27e41b,_0x4e103d){var _0x1749b7=path[_0x8931('0x6a')](config['root'],_0x8931('0x79'));var _0x367ea0={'where':{'id':_0x27e41b['params']['id']},'attributes':['id',_0x8931('0x68')],'raw':!![]};return db[_0x8931('0x30')][_0x8931('0x49')](_0x367ea0)['then'](handleEntityNotFound(_0x4e103d,null))['then'](function(_0x3e349b){if(_0x3e349b){if(!_['isNil'](_0x3e349b[_0x8931('0x68')])){if(fs[_0x8931('0x71')](path[_0x8931('0x6a')](config[_0x8931('0x6b')],_0x8931('0x78'),_0x3e349b[_0x8931('0x68')]))){_0x1749b7=path[_0x8931('0x6a')](config['root'],_0x8931('0x78'),_0x3e349b[_0x8931('0x68')]);}}return _0x4e103d[_0x8931('0x73')](_0x1749b7);}})['catch'](handleError(_0x4e103d,null));};exports[_0x8931('0x7a')]=function(_0x20508e,_0x33da46){var _0x5a58de=require(_0x8931('0x7b'));var _0x27fbc4=new _0x5a58de();var _0x25a9ad=_0x27fbc4[_0x8931('0x7c')](_0x20508e[_0x8931('0x7d')][_0x8931('0x7e')])[_0x8931('0x7f')]();var _0x43f778={'body':_0x20508e['body'],'channel':_0x8931('0x80')};var _0x44d40b=[];var _0x507053=[];var _0x13b619={};var _0x33ead9=![];return db[_0x8931('0x81')][_0x8931('0x54')]()['then'](function(_0x449535){if(!_0x449535){throw new db['Sequelize'][(_0x8931('0x82'))](_0x8931('0x83'));}_0x44d40b=_['difference'](_[_0x8931('0x35')](_0x449535),[_0x8931('0x84'),_0x8931('0x85')]);_0x507053=_['difference'](_[_0x8931('0x35')](_0x449535),[_0x8931('0x84'),_0x8931('0x85'),_0x8931('0x86'),'ListId']);if(_0x20508e[_0x8931('0x4b')]['id']){delete _0x20508e[_0x8931('0x4b')]['id'];}if(_[_0x8931('0x70')](_0x20508e[_0x8931('0x4b')]['from'])){throw new db[(_0x8931('0x87'))][(_0x8931('0x82'))]('from\x20is\x20mandatory');}if(_[_0x8931('0x70')](_0x20508e[_0x8931('0x4b')][_0x8931('0x4b')])||_0x20508e['body'][_0x8931('0x4b')]===''){throw new db[(_0x8931('0x87'))]['ValidationError'](_0x8931('0x88'));}if(_[_0x8931('0x70')](_0x20508e[_0x8931('0x4b')][_0x8931('0x89')])){throw new db[(_0x8931('0x87'))][(_0x8931('0x82'))](_0x8931('0x8a')+_0x507053);}if(!_[_0x8931('0x8b')](_0x507053,_0x20508e[_0x8931('0x4b')]['mapKey'])){throw new db[(_0x8931('0x87'))][(_0x8931('0x82'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x507053);}_0x13b619[_0x20508e[_0x8931('0x4b')][_0x8931('0x89')]]=_0x20508e[_0x8931('0x4b')][_0x8931('0x8c')];})[_0x8931('0x14')](function(){return db[_0x8931('0x30')][_0x8931('0x49')]({'where':{'id':_0x20508e[_0x8931('0x48')]['id']},'include':[{'model':db[_0x8931('0x8d')],'as':_0x8931('0x8e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x13b619,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':_0x8931('0x8f')}]});})[_0x8931('0x14')](handleEntityNotFound(_0x33da46,null))[_0x8931('0x14')](function(_0x40e28a){if(_0x40e28a&&_0x40e28a[_0x8931('0x8e')]){_0x43f778[_0x8931('0x90')]=_0x40e28a;_0x43f778[_0x8931('0x91')]=_0x40e28a[_0x8931('0x8f')];_0x43f778[_0x8931('0x92')]=_0x40e28a[_0x8931('0x8e')];_0x43f778[_0x8931('0x91')]=_[_0x8931('0x93')](_0x43f778[_0x8931('0x91')],[_0x8931('0x94')],[_0x8931('0x95')]);if(_0x43f778[_0x8931('0x90')]['Applications']){delete _0x43f778[_0x8931('0x90')]['Applications'];}if(_0x43f778[_0x8931('0x90')][_0x8931('0x8e')]&&_0x43f778[_0x8931('0x90')]['List']['Contacts'][_0x8931('0x3a')]){return _0x43f778[_0x8931('0x90')]['List'][_0x8931('0x96')][0x0];}var _0xa99593=_[_0x8931('0xb')](_0x20508e[_0x8931('0x4b')],{'firstName':_0x20508e[_0x8931('0x4b')][_0x8931('0x8c')],'ListId':_0x40e28a[_0x8931('0x97')]});_0xa99593[_0x20508e[_0x8931('0x4b')][_0x8931('0x89')]]=_0x20508e['body']['from'];return db[_0x8931('0x81')]['create'](_0xa99593,{'fields':_0x44d40b,'raw':!![]});}})['then'](handleEntityNotFound(_0x33da46,null))[_0x8931('0x14')](function(_0x16e57c){_0x43f778[_0x8931('0x98')]=_0x16e57c;var _0x36a49c=_0x20508e[_0x8931('0x4b')][_0x8931('0x99')];if(_0x20508e[_0x8931('0x7d')]['cf-connecting-ip']){_0x36a49c=_0x20508e['headers']['cf-connecting-ip'];}else if(_0x20508e['headers']['x-forwarded-for']){_0x36a49c=_[_0x8931('0x9a')](_0x20508e[_0x8931('0x7d')]['x-forwarded-for']['split'](','));}if(_0x16e57c){var _0x766e93={'ContactId':_0x16e57c['id'],'ChatWebsiteId':_0x20508e[_0x8931('0x48')]['id'],'from':(_0x16e57c[_0x8931('0x9b')]||'')+'\x20'+(_0x16e57c['lastName']||''),'customerIp':_0x36a49c,'customerPort':_0x20508e[_0x8931('0x7d')]['x-real-port']?_0x20508e[_0x8931('0x7d')][_0x8931('0x9c')]:null,'referer':_0x20508e[_0x8931('0x4b')][_0x8931('0x9d')],'browserName':_0x25a9ad[_0x8931('0x9e')][_0x8931('0x2b')]&&_0x25a9ad[_0x8931('0x9e')]['version']?util['format'](_0x8931('0x9f'),_0x25a9ad[_0x8931('0x9e')][_0x8931('0x2b')],_0x25a9ad[_0x8931('0x9e')]['version']):'unknown','browserVersion':_0x25a9ad[_0x8931('0x9e')][_0x8931('0xa0')]||_0x8931('0xa1'),'osName':util[_0x8931('0xa2')](_0x8931('0x9f'),_0x25a9ad['os'][_0x8931('0x2b')],_0x25a9ad['os'][_0x8931('0xa0')]),'osVersion':_0x25a9ad['os'][_0x8931('0xa0')],'deviceModel':_0x25a9ad[_0x8931('0xa3')][_0x8931('0x33')]&&_0x25a9ad[_0x8931('0xa3')][_0x8931('0xa4')]?util[_0x8931('0xa2')](_0x8931('0xa5'),_0x25a9ad[_0x8931('0xa3')][_0x8931('0x33')],_0x25a9ad[_0x8931('0xa3')][_0x8931('0xa4')],_0x25a9ad[_0x8931('0xa3')][_0x8931('0xa6')]):null,'deviceVendor':_0x25a9ad['device']['vendor'],'deviceType':_0x25a9ad[_0x8931('0xa3')]['type'],'formData':JSON['stringify'](_0x20508e[_0x8931('0x4b')])};var _0x26943d={'ChatWebsiteId':_0x20508e[_0x8931('0x48')]['id'],'closed':![]};if(_0x20508e['body'][_0x8931('0xa7')]){_0x26943d[_0x8931('0xa7')]=_0x20508e['body'][_0x8931('0xa7')];return db['ChatInteraction'][_0x8931('0x49')]({'where':_0x26943d})[_0x8931('0x14')](function(_0x5bbd2e){if(_0x5bbd2e){return[_0x5bbd2e,![]];}_0x766e93[_0x8931('0xa7')]=_0x20508e[_0x8931('0x4b')][_0x8931('0xa7')];_0x766e93['externalUrl']=_0x20508e[_0x8931('0x4b')][_0x8931('0xa8')];return db[_0x8931('0xa9')][_0x8931('0x4a')](_0x766e93)[_0x8931('0x14')](function(_0x5e4267){return[_0x5e4267,!![]];});});}_0x26943d['ContactId']=_0x16e57c['id'];if(_0x20508e[_0x8931('0x4b')][_0x8931('0xaa')]&&_0x20508e[_0x8931('0x4b')][_0x8931('0xaa')]['id']){_0x26943d['id']=_0x20508e[_0x8931('0x4b')][_0x8931('0xaa')]['id'];return db['ChatInteraction']['find']({'where':_0x26943d})['then'](function(_0x52680a){if(_0x52680a){return[_0x52680a,![]];}return db['ChatInteraction']['create'](_0x766e93)[_0x8931('0x14')](function(_0x545204){return[_0x545204,!![]];});});}return db[_0x8931('0xa9')]['create'](_0x766e93)['then'](function(_0x53f8e4){return[_0x53f8e4,!![]];});}})[_0x8931('0xab')](function(_0x4ec364,_0x1d7504){if(_0x4ec364){_0x33ead9=_0x1d7504;if(!_0x1d7504){var _0x1abc77={'from':(_0x43f778[_0x8931('0x98')][_0x8931('0x9b')]||'')+'\x20'+(_0x43f778[_0x8931('0x98')][_0x8931('0xac')]||'')};if(_0x20508e['body'][_0x8931('0xa7')]&&_0x20508e[_0x8931('0x4b')]['messageId']&&_0x20508e[_0x8931('0x4b')][_0x8931('0xa7')]!=_0x20508e[_0x8931('0x4b')]['messageId']){_0x1abc77[_0x8931('0xa7')]=_0x20508e['body'][_0x8931('0xad')];}return _0x4ec364[_0x8931('0x53')](_0x1abc77);}else{return _0x4ec364;}}})[_0x8931('0x14')](function(_0x2c6a8c){_0x43f778[_0x8931('0xaa')]=_0x2c6a8c[_0x8931('0x4c')]({'plain':!![]});_0x43f778[_0x8931('0xaa')][_0x8931('0xae')]=_0x33ead9;if(_0x43f778[_0x8931('0xaa')][_0x8931('0xae')]){if(_0x43f778[_0x8931('0x90')][_0x8931('0xaf')]){_0x43f778[_0x8931('0x91')][_0x8931('0xb0')]({'id':0x0,'priority':_0x43f778[_0x8931('0x91')][_0x8931('0x3a')]+0x1,'app':_0x8931('0xb1'),'appdata':_0x8931('0xb2'),'interval':_0x8931('0xb3')});}}return db[_0x8931('0xb4')][_0x8931('0x4a')]({'body':_0x20508e[_0x8931('0x4b')][_0x8931('0x4b')],'ChatWebsiteId':_0x20508e[_0x8931('0x48')]['id'],'ChatInteractionId':_0x2c6a8c['id'],'direction':'in','ContactId':_0x43f778['contact']['id'],'AttachmentId':_0x20508e[_0x8931('0x4b')][_0x8931('0xb5')]});})[_0x8931('0x14')](function(_0xaa908e){_0x43f778[_0x8931('0x1b')]=_0xaa908e;if(_0x43f778[_0x8931('0xaa')][_0x8931('0xb6')]){return db[_0x8931('0xb7')][_0x8931('0x49')]({'attributes':['id',_0x8931('0x2b')],'where':{'id':_0x43f778[_0x8931('0xaa')][_0x8931('0xb6')]}})[_0x8931('0x14')](function(_0x21469e){if(_0x21469e){_0x43f778[_0x8931('0x91')][_0x8931('0xb8')]({'id':0x0,'priority':0x0,'app':_0x8931('0xb9'),'appdata':_0x21469e[_0x8931('0x2b')]+','+(_0x43f778[_0x8931('0x90')][_0x8931('0xba')]||0xa),'interval':_0x8931('0xb3')});_0x43f778['forcedOwnership']=!![];}return respondWithRpcPromise(_0x8931('0xbb'),_0x8931('0xbc'),_0x43f778);});}return respondWithRpcPromise(_0x8931('0xbb'),_0x8931('0xbc'),_0x43f778);})['then'](function(_0x2d71e8){respondWithRpcPromise(_0x8931('0xbd'),_0x8931('0xbd'),{'event':'notify','message':_0x2d71e8},client9002);return _0x2d71e8;})[_0x8931('0x14')](respondWithResult(_0x33da46,null))[_0x8931('0x1d')](handleError(_0x33da46,null));};exports[_0x8931('0xbe')]=function(_0x1154fb,_0x48e708){var _0xa6db30,_0x363b3d,_0x1fe75c;var _0x4261b1=[];var _0x425dce={};var _0x1f8359=_0x1154fb[_0x8931('0xbf')]||[];var _0x247205=[];var _0x55cd6a;return db[_0x8931('0x81')]['describe']()[_0x8931('0x14')](function(_0x466821){if(!_0x466821){throw new db[(_0x8931('0x87'))][(_0x8931('0x82'))]('no\x20available\x20attributes');}_0x4261b1=_[_0x8931('0xc0')](_[_0x8931('0x35')](_0x466821),['createdAt','updatedAt',_0x8931('0x86'),_0x8931('0x97')]);if(_0x1154fb[_0x8931('0x4b')]['id']){delete _0x1154fb[_0x8931('0x4b')]['id'];}if(_[_0x8931('0x70')](_0x1154fb['body'][_0x8931('0x8c')])){throw _0x48e708[_0x8931('0x1f')](0x1f4)[_0x8931('0x2c')](new db[(_0x8931('0x87'))][(_0x8931('0x82'))](_0x8931('0xc1')));}if(_[_0x8931('0x70')](_0x1154fb['body'][_0x8931('0x4b')])||_0x1154fb['body'][_0x8931('0x4b')]===''){throw _0x48e708[_0x8931('0x1f')](0x1f4)[_0x8931('0x2c')](new db['Sequelize']['ValidationError'](_0x8931('0x88')));}if(_[_0x8931('0x70')](_0x1154fb[_0x8931('0x4b')][_0x8931('0xc2')])){throw _0x48e708[_0x8931('0x1f')](0x1f4)[_0x8931('0x2c')](new db[(_0x8931('0x87'))]['ValidationError'](_0x8931('0xc3')+_0x4261b1));}if(!_[_0x8931('0x8b')](_0x4261b1,_0x1154fb[_0x8931('0x4b')][_0x8931('0xc2')])){throw _0x48e708[_0x8931('0x1f')](0x1f4)[_0x8931('0x2c')](new db[(_0x8931('0x87'))][(_0x8931('0x82'))](_0x8931('0xc4')+_0x4261b1));}_0x425dce[_0x1154fb[_0x8931('0x4b')][_0x8931('0xc2')]]=_0x1154fb[_0x8931('0x4b')][_0x8931('0x8c')];})[_0x8931('0x14')](function(){return db[_0x8931('0x30')]['find']({'where':{'id':_0x1154fb[_0x8931('0x48')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x8931('0x14')](handleEntityNotFound(_0x48e708,null))['then'](function(_0x50bbb3){if(_0x50bbb3&&_0x50bbb3[_0x8931('0x8e')]){_0x363b3d=_0x50bbb3;var _0x10972a=_[_0x8931('0xb')](_0x1154fb[_0x8931('0x4b')],{'firstName':_0x1154fb['body']['from'],'phone':_0x1154fb['body'][_0x8931('0x8c')],'ListId':_0x50bbb3['ListId']});_0x10972a[_0x1154fb['body'][_0x8931('0xc2')]]=_0x1154fb['body'][_0x8931('0x8c')];return db[_0x8931('0x81')][_0x8931('0xc5')]({'where':_0x425dce,'defaults':_0x10972a});}})[_0x8931('0xab')](function(_0x4aa7fd){if(_0x4aa7fd){_0x1fe75c=_0x4aa7fd;var _0x7a84c3=fs[_0x8931('0xc6')](path[_0x8931('0x6a')](config[_0x8931('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),_0x8931('0xc7'));var _0x12dfa5=ejs[_0x8931('0xc8')](_0x7a84c3,{'body':_['toPairs'](_0x1154fb[_0x8931('0x4b')][_0x8931('0x4b')]),'bodyTitle':_0x363b3d['offlineMessageBody']});return db['ChatOfflineMessage'][_0x8931('0x4a')]({'body':_0x12dfa5,'plainBody':htmlToText[_0x8931('0xc9')](_0x12dfa5),'ContactId':_0x4aa7fd['id'],'ChatWebsiteId':_0x363b3d['id']});}})['then'](function(_0x32b800){_0x55cd6a=_0x32b800;if(_0x1f8359[_0x8931('0x3a')]){var _0x1fd27e=_0x1f8359[_0x8931('0x2f')](function(_0x3dd196){return{'name':_0x3dd196['originalname'],'basename':_0x3dd196[_0x8931('0x66')],'type':_0x3dd196[_0x8931('0xca')],'ChatOfflineMessageId':_0x32b800['id']};});_0x247205=_0x1fd27e['map'](_0x4a2815=>{var _0x1bdf23={'filename':_0x4a2815[_0x8931('0x2b')],'path':path[_0x8931('0x6a')](config['root'],_0x8931('0xcb'),_0x8931('0xbf'),_0x8931('0xcc'),_0x8931('0xcd'),_0x4a2815['basename'])};return _0x1bdf23;});if(!_0x363b3d[_0x8931('0xce')]){return db[_0x8931('0xcf')][_0x8931('0xd0')](function(_0x92742a){return db[_0x8931('0xd1')]['bulkCreate'](_0x1fd27e,{'transaction':_0x92742a});});}}})['then'](function(){if(_0x55cd6a){_0xa6db30=_0x55cd6a;return db['MailAccount'][_0x8931('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0x8931('0xd2')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8931('0xd3')],'as':_0x8931('0xd3'),'raw':!![]}]}]});}})[_0x8931('0x14')](function(_0x4fc418){if(_0x4fc418&&_0x4fc418[_0x8931('0xd4')]&&_0x363b3d['forwardOffline']&&_0x363b3d['forwardOfflineAddress']){var _0x4c3a8b=_0x4fc418['getSmtpOptions']();return respondWithRpcPromise(_0x8931('0xd5'),'sendMail',{'account':_0x4c3a8b,'message':{'from':util[_0x8931('0xa2')](_0x8931('0xd6'),_0x4fc418[_0x8931('0x2b')],_0x4fc418[_0x8931('0xd7')]||_0x4fc418[_0x8931('0xd4')]['user']),'to':_0x363b3d[_0x8931('0xd8')],'subject':_0x363b3d['offlineMessageSubject'],'html':_0xa6db30[_0x8931('0x4b')],'attachments':_0x247205}},client9003)[_0x8931('0x14')](function(){return _0xa6db30;})[_0x8931('0x1d')](function(_0x32c0f3){logger[_0x8931('0x18')](_0x32c0f3);});}})['then'](function(){if(_0x363b3d&&_0x363b3d['openNewInteraction']&&_0x363b3d['MailAccountId']){var _0x567112=[];if(_0x1f8359[_0x8931('0x3a')]){_0x567112=_0x1f8359[_0x8931('0x2f')](function(_0x9b3cb5){return{'name':_0x9b3cb5[_0x8931('0xd9')],'basename':_0x9b3cb5['filename'],'type':_0x9b3cb5[_0x8931('0xca')],'ChatOfflineMessageId':_0x55cd6a['id']};});}var _0x9e907d;if(!_[_0x8931('0x70')](_0x363b3d[_0x8931('0xda')])){var _0x193a1b=_[_0x8931('0x2f')](_0x1154fb[_0x8931('0x4b')],function(_0x68cd21){return _0x68cd21;});var _0x4cd9a0=_[_0x8931('0xdb')](_0x193a1b)[0x0];var _0x33dae8=_[_0x8931('0xdc')](_0x4cd9a0,function(_0x49a842){return _0x49a842;});_0x9e907d=_0x33dae8[0x1][_0x363b3d['subjectOffline']];}var _0x25e65b={'from':_0x1fe75c[_0x8931('0xd7')],'firstName':_0x1fe75c[_0x8931('0x9b')],'lastName':_0x1fe75c[_0x8931('0xac')],'mapKey':'email','message':{'from':_0x1fe75c['email'],'to':_0x363b3d[_0x8931('0xdd')][_0x8931('0xd7')],'cc':'','subject':_[_0x8931('0x70')](_0x9e907d)?_0x363b3d[_0x8931('0xde')]:_0x9e907d,'messageId':'','sentAt':new Date(),'attach':_0x567112[_0x8931('0x3a')],'attachments':_0x567112,'originChannel':'Chat','ChatWebsiteId':_0x363b3d['id'],'ChatOfflineMessageId':_0xa6db30['id'],'originTo':_0x363b3d[_0x8931('0xdd')][_0x8931('0xd7')]},'body':_0xa6db30['body']};var _0x1569b3={'account':{'id':_0x363b3d['MailAccountId']},'body':_0x25e65b,'log':_0x8931('0xdf')};return respondWithRpcPromise(_0x8931('0xdf'),_0x8931('0xe0'),_0x1569b3,client9001)[_0x8931('0x14')](function(){return _0xa6db30;})['catch'](function(_0x46c01f){logger[_0x8931('0x18')](_0x46c01f);});}return;})[_0x8931('0x14')](function(){if(_0xa6db30){return _0xa6db30;}})[_0x8931('0x14')](respondWithResult(_0x48e708,null))[_0x8931('0x1d')](function(_0x14a253){logger[_0x8931('0x18')]('catch',_0x14a253);for(var _0x17c9ae of _0x1f8359){var _0x44b8f5=path[_0x8931('0x6a')](config[_0x8931('0x6b')],_0x8931('0xcb'),'files','attachments',_0x8931('0xcd'),_0x17c9ae[_0x8931('0x66')]);fs_extra['remove'](_0x44b8f5)[_0x8931('0x1d')](function(_0x989a8){logger[_0x8931('0x18')](_0x8931('0xe1'),_0x44b8f5,_0x989a8);});}});};exports[_0x8931('0xe2')]=function(_0x2b56ea,_0x16cd0f){return db['ChatInteraction'][_0x8931('0x49')]({'where':{'id':_0x2b56ea['params']['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x16cd0f,null))[_0x8931('0x14')](function(_0x3d3b4d){if(_0x3d3b4d){return _0x3d3b4d['addInteraction'](_0x2b56ea['body'][_0x8931('0x5b')],_[_0x8931('0xe3')](_0x2b56ea[_0x8931('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x16cd0f,null))['catch'](handleError(_0x16cd0f,null));};exports[_0x8931('0xe4')]=function(_0x5a9031,_0x4a3299){var _0x5e3b0c={'raw':![],'where':{}};var _0x364568={};var _0x16118b={'count':0x0,'rows':[]};return db[_0x8931('0x30')][_0x8931('0x57')]({'where':{'id':_0x5a9031[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x4a3299,null))[_0x8931('0x14')](function(_0x42fe8d){if(_0x42fe8d){_0x364568[_0x8931('0x33')]=_['keys'](db[_0x8931('0xa9')][_0x8931('0x31')]);_0x364568[_0x8931('0x34')]=_[_0x8931('0x35')](_0x5a9031[_0x8931('0x34')]);_0x364568[_0x8931('0x36')]=_[_0x8931('0x37')](_0x364568[_0x8931('0x33')],_0x364568[_0x8931('0x34')]);_0x5e3b0c[_0x8931('0x39')]=_[_0x8931('0x37')](_0x364568[_0x8931('0x33')],qs['fields'](_0x5a9031['query']['fields']));_0x5e3b0c[_0x8931('0x39')]=_0x5e3b0c[_0x8931('0x39')][_0x8931('0x3a')]?_0x5e3b0c[_0x8931('0x39')]:_0x364568[_0x8931('0x33')];if(!_0x5a9031[_0x8931('0x34')][_0x8931('0x3b')](_0x8931('0x3c'))){_0x5e3b0c[_0x8931('0x23')]=qs[_0x8931('0x23')](_0x5a9031[_0x8931('0x34')]['limit']);_0x5e3b0c[_0x8931('0x25')]=qs[_0x8931('0x25')](_0x5a9031[_0x8931('0x34')][_0x8931('0x25')]);}_0x5e3b0c[_0x8931('0x58')]=qs['sort'](_0x5a9031[_0x8931('0x34')]['sort']);_0x5e3b0c['where']=qs['filters'](_[_0x8931('0x3f')](_0x5a9031[_0x8931('0x34')],_0x364568[_0x8931('0x36')]));_0x5e3b0c['where']['ChatWebsiteId']=_0x42fe8d['id'];if(_0x5a9031[_0x8931('0x34')][_0x8931('0x40')]){_0x5e3b0c[_0x8931('0x3e')]=_[_0x8931('0x41')](_0x5e3b0c[_0x8931('0x3e')],{'$or':_[_0x8931('0x2f')](_0x5e3b0c[_0x8931('0x39')],function(_0x23aae0){var _0x232b6c={};_0x232b6c[_0x23aae0]={'$like':'%'+_0x5a9031['query']['filter']+'%'};return _0x232b6c;})});}_0x5e3b0c=_[_0x8931('0x41')]({},_0x5e3b0c,_0x5a9031[_0x8931('0x42')]);return db['ChatInteraction']['count']({'where':_0x5e3b0c[_0x8931('0x3e')]})['then'](function(_0x6cb7ec){_0x16118b['count']=_0x6cb7ec;if(_0x5a9031[_0x8931('0x34')][_0x8931('0x43')]){_0x5e3b0c[_0x8931('0x44')]=[{'model':db[_0x8931('0x81')],'as':_0x8931('0xe5'),'required':![]},{'model':db[_0x8931('0xb7')],'as':'Owner','attributes':[_0x8931('0x2b'),_0x8931('0xe6'),'internal'],'required':![]},{'model':db[_0x8931('0xe7')],'as':_0x8931('0xe8'),'attributes':['id',_0x8931('0x2b'),_0x8931('0xe9')],'where':_0x5a9031[_0x8931('0x34')]['tag']?{'id':_0x5a9031[_0x8931('0x34')]['tag']}:undefined,'required':_0x5a9031[_0x8931('0x34')][_0x8931('0xea')]?!![]:![]}];}return db[_0x8931('0xa9')]['findAll'](_0x5e3b0c);})[_0x8931('0x14')](function(_0x39fdf9){_0x16118b['rows']=_0x39fdf9;return _0x16118b;});}})[_0x8931('0x14')](respondWithFilteredResult(_0x4a3299,_0x5e3b0c))[_0x8931('0x1d')](handleError(_0x4a3299,null));};function iftimePromise(_0x2731ce,_0x97063){return respondWithRpcPromise(_0x8931('0xeb'),_0x8931('0xec'),{'command':_0x97063['timezone']?util['format'](_0x8931('0xed'),_0x2731ce[_0x8931('0xee')],_0x97063['timezone']):util[_0x8931('0xa2')](_0x8931('0xef'),_0x2731ce[_0x8931('0xee')])},client9002)['then'](function(_0x1a3b99){var _0x55f4f2=_0x1a3b99&&_0x1a3b99[_0x8931('0xf0')]('true')>=0x0?!![]:![];logger[_0x8931('0x1c')](_0x8931('0xf1'),_0x97063['id'],_0x2731ce['id'],_0x2731ce[_0x8931('0xee')],_0x55f4f2?_0x8931('0xf2'):'OFFLINE',_0x97063['timezone']?_0x97063[_0x8931('0xf3')]:'No\x20timezone');return _0x55f4f2;})[_0x8931('0x1d')](function(_0x3bb730){logger[_0x8931('0x18')](_0x8931('0xf1'),_0x97063['id'],_0x2731ce['id'],_0x2731ce['interval'],util['inspect'](_0x3bb730,{'showHidden':![],'depth':null}),_0x97063[_0x8931('0xf3')]?_0x97063[_0x8931('0xf3')]:_0x8931('0xf4'));return![];});}exports[_0x8931('0xec')]=function(_0x496e70,_0x180057){var _0x81b34e=0x0;var _0x4bb38e=0x0;var _0x3ff78c=![];var _0x93e452;var _0x1498b1;return db[_0x8931('0x30')][_0x8931('0x49')]({'where':{'id':_0x496e70[_0x8931('0x48')]['id']},'include':[{'model':db[_0x8931('0xf5')],'as':_0x8931('0xf5'),'include':[{'model':db['Interval'],'as':_0x8931('0xf6'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x8931('0x14')](handleEntityNotFound(_0x180057,null))[_0x8931('0x14')](function(_0x448520){if(_0x448520){_0x93e452=_0x448520;return _0x448520[_0x8931('0xf7')]({'raw':!![]});}})[_0x8931('0x14')](function(_0x3fc014){if(_0x93e452){if(_0x3fc014){_0x1498b1=_0x3fc014;}}return require('../../config/license/util')[_0x8931('0x6e')]();})[_0x8931('0x14')](function(_0x2c3520){if(_0x2c3520){_0x4bb38e=_0x2c3520['virtual'];_0x3ff78c=_0x2c3520['custom'];}})['then'](function(){return db[_0x8931('0xa9')][_0x8931('0x24')]({'where':{'closed':![]}});})['then'](function(_0x4e79cd){_0x81b34e=_0x4e79cd;if(_0x4bb38e&&_0x4e79cd>_0x4bb38e){return db[_0x8931('0xf8')][_0x8931('0x57')]({'where':{'id':0x1}})['then'](function(_0x35acc0){if(_0x35acc0){_0x35acc0[_0x8931('0xf9')](_0x8931('0xfa'));}});}})['then'](function(){if(_0x93e452[_0x8931('0xf5')]&&_0x93e452[_0x8931('0xf5')]['Intervals']){var _0x4234e2=[];for(var _0x14def9=0x0;_0x14def9<_0x93e452['Interval'][_0x8931('0xf6')][_0x8931('0x3a')];_0x14def9++){var _0x5a7710=_0x93e452[_0x8931('0xf5')]['Intervals'][_0x14def9][_0x8931('0x4c')]({'plain':!![]});_0x4234e2['push'](iftimePromise(_0x5a7710,_0x93e452));}return BPromise['all'](_0x4234e2)[_0x8931('0x14')](function(_0x17c75d){return _['some'](_0x17c75d);});}else{return!![];}})[_0x8931('0x14')](function(_0x538e56){var _0x5bef09=fs[_0x8931('0xc6')](path[_0x8931('0x6a')](config[_0x8931('0x6b')],_0x8931('0xfb')),_0x8931('0xc7'));var _0x44a618={'remote':_0x93e452[_0x8931('0xfc')],'query':querystring[_0x8931('0x17')](_[_0x8931('0x41')](_0x93e452[_0x8931('0x4c')]({'plain':!![]}),{'customerIp':_0x496e70[_0x8931('0x7d')][_0x8931('0xfd')]||_0x496e70[_0x8931('0x7d')][_0x8931('0xfe')]||_0x496e70[_0x8931('0xff')][_0x8931('0x100')]||_0x496e70['ip'],'referer':_0x496e70[_0x8931('0x7d')][_0x8931('0x9d')],'openedInteractions':_0x81b34e,'maxInteractions':_0x4bb38e,'virtual':_0x3ff78c['virtual'],'online':_0x538e56,'custom':_0x3ff78c}))[_0x8931('0x101')](/'/g,'\x5c\x27')};_0x180057[_0x8931('0x2c')](ejs[_0x8931('0xc8')](Mustache[_0x8931('0xc8')](_0x5bef09,_0x44a618),{'proactiveActions':_0x1498b1,'alignment':_0x93e452[_0x8931('0x102')],'verticalAlignment':_0x93e452[_0x8931('0x103')],'div_color':_0x93e452[_0x8931('0xe9')],'labelText':_0x93e452[_0x8931('0x104')],'text_color':_0x93e452['textColor'],'text_button_color':_0x93e452[_0x8931('0x105')],'button_color':_0x93e452['color_button'],'background_color':_0x93e452['backgroundColor'],'hideWhenOffline':_0x93e452['hideWhenOffline'],'interval':_0x93e452[_0x8931('0x106')]}));})[_0x8931('0x1d')](handleError(_0x180057,null));};exports[_0x8931('0x107')]=function(_0xa4a1e,_0x5a9cae){var _0x2723ca=_0xa4a1e[_0x8931('0x48')]['id'];var _0x3e1310=_0xa4a1e[_0x8931('0x4b')];var _0x50df13=0xc8;var _0x1ecda6=null;return db['sequelize'][_0x8931('0xd0')]({'isolationLevel':db[_0x8931('0xcf')][_0x8931('0x108')][_0x8931('0x109')][_0x8931('0x10a')]},function(_0x1a92ac){return db['ChatWebsite']['findOne']({'where':{'id':_0x2723ca},'transaction':_0x1a92ac})[_0x8931('0x14')](function(_0x5b8c0b){if(_0x5b8c0b){return db[_0x8931('0x10b')][_0x8931('0x27')]({'where':{'ChatWebsiteId':_0x2723ca},'transaction':_0x1a92ac})[_0x8931('0x14')](function(){var _0x46429c=_[_0x8931('0x2f')](_0x3e1310,function(_0x1b225a){_0x1b225a[_0x8931('0x59')]=_0x2723ca;return _0x1b225a;});return db[_0x8931('0x10b')][_0x8931('0x10c')](_0x46429c,{'transaction':_0x1a92ac});});}else{_0x50df13=0x194;_0x1ecda6=[];}});})['then'](function(){if(_0x50df13!==0x194){return db[_0x8931('0x10b')][_0x8931('0x10d')]({'where':{'ChatWebsiteId':_0x2723ca},'order':'priority'})[_0x8931('0x14')](function(_0x435ce9){_0x1ecda6=_0x435ce9;});}})[_0x8931('0x1d')](function(_0x21ebb3){_0x50df13=0x1f4;logger[_0x8931('0x18')](_0x21ebb3[_0x8931('0x2a')]);if(_0x21ebb3[_0x8931('0x2b')]){delete _0x21ebb3[_0x8931('0x2b')];}_0x1ecda6=_0x21ebb3;})[_0x8931('0x10e')](function(){if(_0x1ecda6===null){_0x5a9cae['sendStatus'](_0x50df13);}else{if(_0x50df13===0x1f4){_0x5a9cae[_0x8931('0x1f')](_0x50df13)[_0x8931('0x2c')](_0x1ecda6);}else{_0x5a9cae['status'](_0x50df13)[_0x8931('0x21')](_0x1ecda6);}}});};exports['getApplications']=function(_0xbbfc83,_0x1c1671){var _0x2d27cf={};var _0x3ed8b5={};var _0x1a048e;var _0x2aac87;return db[_0x8931('0x30')][_0x8931('0x57')]({'where':{'id':_0xbbfc83['params']['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x1c1671,null))[_0x8931('0x14')](function(_0x3b8528){if(_0x3b8528){_0x1a048e=_0x3b8528;_0x3ed8b5[_0x8931('0x33')]=_[_0x8931('0x35')](db[_0x8931('0x10b')][_0x8931('0x31')]);_0x3ed8b5[_0x8931('0x34')]=_[_0x8931('0x35')](_0xbbfc83[_0x8931('0x34')]);_0x3ed8b5[_0x8931('0x36')]=_[_0x8931('0x37')](_0x3ed8b5['model'],_0x3ed8b5[_0x8931('0x34')]);_0x2d27cf[_0x8931('0x39')]=_[_0x8931('0x37')](_0x3ed8b5['model'],qs[_0x8931('0x38')](_0xbbfc83[_0x8931('0x34')][_0x8931('0x38')]));_0x2d27cf['attributes']=_0x2d27cf['attributes'][_0x8931('0x3a')]?_0x2d27cf[_0x8931('0x39')]:_0x3ed8b5['model'];_0x2d27cf[_0x8931('0x58')]=qs[_0x8931('0x3d')](_0xbbfc83[_0x8931('0x34')]['sort']);_0x2d27cf['where']=qs[_0x8931('0x36')](_[_0x8931('0x3f')](_0xbbfc83[_0x8931('0x34')],_0x3ed8b5[_0x8931('0x36')]));if(_0xbbfc83[_0x8931('0x34')]['filter']){_0x2d27cf[_0x8931('0x3e')]=_['merge'](_0x2d27cf[_0x8931('0x3e')],{'$or':_[_0x8931('0x2f')](_0x2d27cf[_0x8931('0x39')],function(_0x369fc3){var _0x5aa4ce={};_0x5aa4ce[_0x369fc3]={'$like':'%'+_0xbbfc83[_0x8931('0x34')]['filter']+'%'};return _0x5aa4ce;})});}_0x2d27cf=_['merge']({},_0x2d27cf,_0xbbfc83[_0x8931('0x42')]);return _0x1a048e['getApplications'](_0x2d27cf);}})[_0x8931('0x14')](function(_0x54407d){if(_0x54407d){_0x2aac87=_0x54407d[_0x8931('0x3a')];if(!_0xbbfc83[_0x8931('0x34')][_0x8931('0x3b')]('nolimit')){_0x2d27cf[_0x8931('0x23')]=qs[_0x8931('0x23')](_0xbbfc83[_0x8931('0x34')][_0x8931('0x23')]);_0x2d27cf[_0x8931('0x25')]=qs[_0x8931('0x25')](_0xbbfc83['query'][_0x8931('0x25')]);}return _0x1a048e[_0x8931('0x10f')](_0x2d27cf);}})[_0x8931('0x14')](function(_0x45bbc2){if(_0x45bbc2){return _0x45bbc2?{'count':_0x2aac87,'rows':_0x45bbc2}:null;}})['then'](respondWithResult(_0x1c1671,null))[_0x8931('0x1d')](handleError(_0x1c1671,null));};exports[_0x8931('0x110')]=function(_0x5bcd10,_0x51e739){return db[_0x8931('0x111')][_0x8931('0x49')]({'where':{'id':_0x5bcd10[_0x8931('0x48')]['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x51e739,null))[_0x8931('0x14')](function(_0x39e384){if(_0x39e384){return _0x39e384[_0x8931('0x110')](_0x5bcd10[_0x8931('0x4b')][_0x8931('0x5b')],_[_0x8931('0xe3')](_0x5bcd10[_0x8931('0x4b')],[_0x8931('0x5b'),'id'])||{});}})[_0x8931('0x14')](respondWithResult(_0x51e739,null))['catch'](handleError(_0x51e739,null));};exports['getProactiveActions']=function(_0x2f5d26,_0x12fbeb){var _0x1bca43={};var _0x22b640={};var _0x13d0ab;var _0x1d0a89;return db['ChatWebsite'][_0x8931('0x57')]({'where':{'id':_0x2f5d26[_0x8931('0x48')]['id']}})['then'](handleEntityNotFound(_0x12fbeb,null))[_0x8931('0x14')](function(_0x6f6dde){if(_0x6f6dde){_0x13d0ab=_0x6f6dde;_0x22b640[_0x8931('0x33')]=_[_0x8931('0x35')](db[_0x8931('0x112')][_0x8931('0x31')]);_0x22b640['query']=_['keys'](_0x2f5d26['query']);_0x22b640[_0x8931('0x36')]=_['intersection'](_0x22b640[_0x8931('0x33')],_0x22b640[_0x8931('0x34')]);_0x1bca43[_0x8931('0x39')]=_[_0x8931('0x37')](_0x22b640['model'],qs[_0x8931('0x38')](_0x2f5d26[_0x8931('0x34')][_0x8931('0x38')]));_0x1bca43['attributes']=_0x1bca43[_0x8931('0x39')][_0x8931('0x3a')]?_0x1bca43[_0x8931('0x39')]:_0x22b640[_0x8931('0x33')];_0x1bca43[_0x8931('0x58')]=qs[_0x8931('0x3d')](_0x2f5d26[_0x8931('0x34')][_0x8931('0x3d')]);_0x1bca43[_0x8931('0x3e')]=qs[_0x8931('0x36')](_['pick'](_0x2f5d26[_0x8931('0x34')],_0x22b640[_0x8931('0x36')]));if(_0x2f5d26[_0x8931('0x34')][_0x8931('0x40')]){_0x1bca43[_0x8931('0x3e')]=_[_0x8931('0x41')](_0x1bca43['where'],{'$or':_[_0x8931('0x2f')](_0x1bca43[_0x8931('0x39')],function(_0x831137){var _0x307e7d={};_0x307e7d[_0x831137]={'$like':'%'+_0x2f5d26['query'][_0x8931('0x40')]+'%'};return _0x307e7d;})});}_0x1bca43=_['merge']({},_0x1bca43,_0x2f5d26[_0x8931('0x42')]);return _0x13d0ab[_0x8931('0xf7')](_0x1bca43);}})[_0x8931('0x14')](function(_0x4e11ce){if(_0x4e11ce){_0x1d0a89=_0x4e11ce[_0x8931('0x3a')];if(!_0x2f5d26[_0x8931('0x34')][_0x8931('0x3b')](_0x8931('0x3c'))){_0x1bca43[_0x8931('0x23')]=qs[_0x8931('0x23')](_0x2f5d26[_0x8931('0x34')]['limit']);_0x1bca43['offset']=qs[_0x8931('0x25')](_0x2f5d26['query'][_0x8931('0x25')]);}return _0x13d0ab[_0x8931('0xf7')](_0x1bca43);}})['then'](function(_0x35875b){if(_0x35875b){return _0x35875b?{'count':_0x1d0a89,'rows':_0x35875b}:null;}})[_0x8931('0x14')](respondWithResult(_0x12fbeb,null))[_0x8931('0x1d')](handleError(_0x12fbeb,null));};exports['getFields']=function(_0x5346,_0x2b226a){var _0x26c408=_0x5346['query']['online']===_0x8931('0x113')?_0x8931('0x114'):_0x8931('0x115');return db[_0x8931('0x30')]['find']({'attributes':['id',_0x26c408],'where':{'id':_0x5346[_0x8931('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b226a,null))[_0x8931('0x14')](function(_0x4fa921){if(_0x4fa921){var _0x33140a=_0x4fa921[_0x26c408];var _0xff6db1=_0x33140a&&_0x33140a[_0x8931('0x116')]?_0x33140a[_0x8931('0x116')]:[];_0x2b226a[_0x8931('0x2c')]({'fromKey':_[_0x8931('0x70')](_0x33140a['fromKey'])?undefined:_0x33140a['fromKey'],'count':_0xff6db1[_0x8931('0x3a')],'rows':_0xff6db1});}})[_0x8931('0x1d')](handleError(_0x2b226a,null));};exports[_0x8931('0x117')]=function(_0xb8fe6e,_0x47b4dc){var _0x38bd59={'raw':![],'where':{}};var _0x2f113e={};var _0x229c50={'count':0x0,'rows':[]};return db[_0x8931('0x30')][_0x8931('0x57')]({'where':{'id':_0xb8fe6e[_0x8931('0x48')]['id']}})['then'](handleEntityNotFound(_0x47b4dc,null))[_0x8931('0x14')](function(_0x3d789f){if(_0x3d789f){_0x2f113e[_0x8931('0x33')]=_[_0x8931('0x35')](db['ChatOfflineMessage'][_0x8931('0x31')]);_0x2f113e[_0x8931('0x34')]=_['keys'](_0xb8fe6e['query']);_0x2f113e[_0x8931('0x36')]=_[_0x8931('0x37')](_0x2f113e[_0x8931('0x33')],_0x2f113e[_0x8931('0x34')]);_0x38bd59[_0x8931('0x39')]=_[_0x8931('0x37')](_0x2f113e['model'],qs['fields'](_0xb8fe6e[_0x8931('0x34')]['fields']));_0x38bd59['attributes']=_0x38bd59[_0x8931('0x39')][_0x8931('0x3a')]?_0x38bd59[_0x8931('0x39')]:_0x2f113e['model'];if(!_0xb8fe6e[_0x8931('0x34')][_0x8931('0x3b')]('nolimit')){_0x38bd59['limit']=qs['limit'](_0xb8fe6e[_0x8931('0x34')][_0x8931('0x23')]);_0x38bd59[_0x8931('0x25')]=qs[_0x8931('0x25')](_0xb8fe6e[_0x8931('0x34')][_0x8931('0x25')]);}_0x38bd59[_0x8931('0x58')]=qs['sort'](_0xb8fe6e[_0x8931('0x34')]['sort']);_0x38bd59[_0x8931('0x3e')]=qs[_0x8931('0x36')](_[_0x8931('0x3f')](_0xb8fe6e[_0x8931('0x34')],_0x2f113e['filters']));_0x38bd59[_0x8931('0x3e')]['ChatWebsiteId']=_0x3d789f['id'];if(_0xb8fe6e[_0x8931('0x34')][_0x8931('0x40')]){_0x38bd59[_0x8931('0x3e')]=_[_0x8931('0x41')](_0x38bd59[_0x8931('0x3e')],{'$or':_['map'](_0x38bd59[_0x8931('0x39')],function(_0x412607){var _0x4c7e58={};_0x4c7e58[_0x412607]={'$like':'%'+_0xb8fe6e['query'][_0x8931('0x40')]+'%'};return _0x4c7e58;})});}_0x38bd59=_[_0x8931('0x41')]({},_0x38bd59,_0xb8fe6e[_0x8931('0x42')]);return db[_0x8931('0x118')][_0x8931('0x24')]({'where':_0x38bd59['where']})['then'](function(_0x1a1956){_0x229c50[_0x8931('0x24')]=_0x1a1956;if(_0xb8fe6e[_0x8931('0x34')][_0x8931('0x43')]){_0x38bd59[_0x8931('0x44')]=[{'all':!![]}];}else{_0x38bd59[_0x8931('0x44')]=[{'model':db['CmContact'],'as':_0x8931('0xe5'),'required':![]},{'model':db[_0x8931('0xd1')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x8931('0x45')](_0x38bd59);})[_0x8931('0x14')](function(_0x246954){_0x229c50[_0x8931('0x46')]=_0x246954;return _0x229c50;});}})['then'](respondWithFilteredResult(_0x47b4dc,_0x38bd59))[_0x8931('0x1d')](handleError(_0x47b4dc,null));};exports[_0x8931('0x119')]=function(_0x4b1491,_0x2e3695){return db[_0x8931('0x30')][_0x8931('0x49')]({'where':{'id':_0x4b1491['params']['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x2e3695,null))[_0x8931('0x14')](function(_0x25adc5){if(_0x25adc5){return _0x25adc5['addAgents'](_0x4b1491[_0x8931('0x4b')]['ids'],_[_0x8931('0xe3')](_0x4b1491['body'],[_0x8931('0x5b'),'id'])||{})[_0x8931('0xab')](function(_0x222d5a){for(var _0x2fa0df=0x0;_0x2fa0df<_0x4b1491[_0x8931('0x4b')]['ids']['length'];_0x2fa0df+=0x1){socket['emit'](_0x8931('0x11a'),{'UserId':Number(_0x4b1491[_0x8931('0x4b')][_0x8931('0x5b')][_0x2fa0df]),'ChatWebsiteId':Number(_0x4b1491['params']['id'])});}return _0x222d5a;});}})['then'](respondWithResult(_0x2e3695,null))['catch'](handleError(_0x2e3695,null));};exports[_0x8931('0x11b')]=function(_0x4a85e5,_0x5e8ee9){return db['ChatWebsite']['find']({'where':{'id':_0x4a85e5['params']['id']}})[_0x8931('0x14')](handleEntityNotFound(_0x5e8ee9,null))[_0x8931('0x14')](function(_0x1b0e2e){if(_0x1b0e2e){return _0x1b0e2e[_0x8931('0x11b')](_0x4a85e5[_0x8931('0x34')][_0x8931('0x5b')])['then'](function(){if(_[_0x8931('0x11c')](_0x4a85e5[_0x8931('0x34')][_0x8931('0x5b')])){for(var _0x431b2a=0x0;_0x431b2a<_0x4a85e5[_0x8931('0x34')][_0x8931('0x5b')][_0x8931('0x3a')];_0x431b2a+=0x1){socket[_0x8931('0x11d')]('userChatWebsite:remove',{'UserId':Number(_0x4a85e5[_0x8931('0x34')][_0x8931('0x5b')][_0x431b2a]),'ChatWebsiteId':Number(_0x4a85e5[_0x8931('0x48')]['id'])});}}else{socket['emit'](_0x8931('0x11e'),{'UserId':Number(_0x4a85e5['query']['ids']),'ChatWebsiteId':Number(_0x4a85e5[_0x8931('0x48')]['id'])});}});}})[_0x8931('0x14')](respondWithStatusCode(_0x5e8ee9,null))[_0x8931('0x1d')](handleError(_0x5e8ee9,null));};exports[_0x8931('0x11f')]=function(_0x57f702,_0x3673de){var _0x45c635={};var _0x4d44f8={};var _0x192c76;var _0x20c860;return db[_0x8931('0x30')][_0x8931('0x57')]({'where':{'id':_0x57f702['params']['id']}})['then'](handleEntityNotFound(_0x3673de,null))[_0x8931('0x14')](function(_0x1039aa){if(_0x1039aa){_0x192c76=_0x1039aa;_0x4d44f8['model']=_['keys'](db[_0x8931('0xb7')][_0x8931('0x31')]);_0x4d44f8['query']=_['keys'](_0x57f702[_0x8931('0x34')]);_0x4d44f8[_0x8931('0x36')]=_[_0x8931('0x37')](_0x4d44f8[_0x8931('0x33')],_0x4d44f8[_0x8931('0x34')]);_0x45c635[_0x8931('0x39')]=_[_0x8931('0x37')](_0x4d44f8[_0x8931('0x33')],qs[_0x8931('0x38')](_0x57f702[_0x8931('0x34')][_0x8931('0x38')]));_0x45c635[_0x8931('0x39')]=_0x45c635[_0x8931('0x39')]['length']?_0x45c635['attributes']:_0x4d44f8[_0x8931('0x33')];_0x45c635[_0x8931('0x58')]=qs[_0x8931('0x3d')](_0x57f702[_0x8931('0x34')][_0x8931('0x3d')]);_0x45c635[_0x8931('0x3e')]=qs['filters'](_[_0x8931('0x3f')](_0x57f702[_0x8931('0x34')],_0x4d44f8[_0x8931('0x36')]));if(_0x57f702['query'][_0x8931('0x40')]){_0x45c635[_0x8931('0x3e')]=_['merge'](_0x45c635[_0x8931('0x3e')],{'$or':_[_0x8931('0x2f')](_0x45c635[_0x8931('0x39')],function(_0xb6b9f3){var _0x1442f4={};_0x1442f4[_0xb6b9f3]={'$like':'%'+_0x57f702[_0x8931('0x34')][_0x8931('0x40')]+'%'};return _0x1442f4;})});}_0x45c635=_[_0x8931('0x41')]({},_0x45c635,_0x57f702['options']);return _0x192c76[_0x8931('0x11f')](_0x45c635);}})[_0x8931('0x14')](function(_0x38fe36){if(_0x38fe36){_0x20c860=_0x38fe36[_0x8931('0x3a')];if(!_0x57f702['query'][_0x8931('0x3b')](_0x8931('0x3c'))){_0x45c635[_0x8931('0x23')]=qs['limit'](_0x57f702[_0x8931('0x34')]['limit']);_0x45c635[_0x8931('0x25')]=qs[_0x8931('0x25')](_0x57f702['query'][_0x8931('0x25')]);}return _0x192c76[_0x8931('0x11f')](_0x45c635);}})[_0x8931('0x14')](function(_0x2d7a08){if(_0x2d7a08){return _0x2d7a08?{'count':_0x20c860,'rows':_0x2d7a08}:null;}})[_0x8931('0x14')](respondWithResult(_0x3673de,null))[_0x8931('0x1d')](handleError(_0x3673de,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 209fbae..6613c6f 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 _0x6dd1=['events','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x381ded,_0x452105){var _0x54ea45=function(_0x363bcb){while(--_0x363bcb){_0x381ded['push'](_0x381ded['shift']());}};_0x54ea45(++_0x452105);}(_0x6dd1,0x111));var _0x16dd=function(_0x58585c,_0x511973){_0x58585c=_0x58585c-0x0;var _0xfa4d17=_0x6dd1[_0x58585c];return _0xfa4d17;};'use strict';var EventEmitter=require(_0x16dd('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x16dd('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x16dd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x16dd('0x3'),'afterDestroy':_0x16dd('0x4')};function emitEvent(_0x160837){return function(_0x3b2fd2,_0x369ea0,_0x327ead){ChatWebsiteEvents[_0x16dd('0x5')](_0x160837+':'+_0x3b2fd2['id'],_0x3b2fd2);ChatWebsiteEvents[_0x16dd('0x5')](_0x160837,_0x3b2fd2);_0x327ead(null);};}for(var e in events){if(events[_0x16dd('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x885a=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x30173c,_0x599eb2){var _0x210c49=function(_0x3f0159){while(--_0x3f0159){_0x30173c['push'](_0x30173c['shift']());}};_0x210c49(++_0x599eb2);}(_0x885a,0x180));var _0xa885=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x885a[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xa885('0x0'))['db'][_0xa885('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa885('0x2')](0x0);var events={'afterCreate':_0xa885('0x3'),'afterUpdate':'update','afterDestroy':_0xa885('0x4')};function emitEvent(_0x1c41b5){return function(_0x2386ec,_0x106e16,_0x108285){ChatWebsiteEvents[_0xa885('0x5')](_0x1c41b5+':'+_0x2386ec['id'],_0x2386ec);ChatWebsiteEvents['emit'](_0x1c41b5,_0x2386ec);_0x108285(null);};}for(var e in events){if(events[_0xa885('0x6')](e)){var event=events[e];ChatWebsite[_0xa885('0x7')](e,emitEvent(event));}}module[_0xa885('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index c848d5f..83bcf99 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 _0x78d0=['../../config/environment','exports','ChatWebsite','chat_websites','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3db0d4,_0x2eea2c){var _0x1dce96=function(_0x40163d){while(--_0x40163d){_0x3db0d4['push'](_0x3db0d4['shift']());}};_0x1dce96(++_0x2eea2c);}(_0x78d0,0x190));var _0x078d=function(_0x36836c,_0x5e8982){_0x36836c=_0x36836c-0x0;var _0x46d489=_0x78d0[_0x36836c];return _0x46d489;};'use strict';var _=require(_0x078d('0x0'));var util=require('util');var logger=require(_0x078d('0x1'))('api');var moment=require(_0x078d('0x2'));var BPromise=require(_0x078d('0x3'));var rp=require(_0x078d('0x4'));var fs=require('fs');var path=require(_0x078d('0x5'));var rimraf=require(_0x078d('0x6'));var config=require(_0x078d('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x078d('0x8')]=function(_0x111f1a,_0x653f79){return _0x111f1a['define'](_0x078d('0x9'),attributes,{'tableName':_0x078d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4563=['ChatWebsite','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x117e2d,_0x5a10b3){var _0x3d66e7=function(_0x340cdf){while(--_0x340cdf){_0x117e2d['push'](_0x117e2d['shift']());}};_0x3d66e7(++_0x5a10b3);}(_0x4563,0xe8));var _0x3456=function(_0x44e3bc,_0x5142ce){_0x44e3bc=_0x44e3bc-0x0;var _0x2edfbd=_0x4563[_0x44e3bc];return _0x2edfbd;};'use strict';var _=require(_0x3456('0x0'));var util=require(_0x3456('0x1'));var logger=require(_0x3456('0x2'))(_0x3456('0x3'));var moment=require(_0x3456('0x4'));var BPromise=require(_0x3456('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3456('0x6'));var config=require(_0x3456('0x7'));var attributes=require(_0x3456('0x8'));module[_0x3456('0x9')]=function(_0x3139ce,_0x592a21){return _0x3139ce['define'](_0x3456('0xa'),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 1d58e37..4ac3dd8 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 _0x3110=['request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x124c82,_0x652108){var _0x5b7fd0=function(_0x3d386a){while(--_0x3d386a){_0x124c82['push'](_0x124c82['shift']());}};_0x5b7fd0(++_0x652108);}(_0x3110,0x89));var _0x0311=function(_0x45a523,_0x321504){_0x45a523=_0x45a523-0x0;var _0xc22778=_0x3110[_0x45a523];return _0xc22778;};'use strict';var _=require('lodash');var util=require(_0x0311('0x0'));var moment=require(_0x0311('0x1'));var BPromise=require(_0x0311('0x2'));var rs=require(_0x0311('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0311('0x4'));var logger=require(_0x0311('0x5'))('rpc');var config=require(_0x0311('0x6'));var jayson=require(_0x0311('0x7'));var client=jayson[_0x0311('0x8')][_0x0311('0x9')]({'port':0x232a});config[_0x0311('0xa')]=_[_0x0311('0xb')](config['redis'],{'host':_0x0311('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0311('0xa')]));require(_0x0311('0xd'))[_0x0311('0xe')](socket);function respondWithRpcPromise(_0x46ab50,_0x183c74,_0x50f201){return new BPromise(function(_0x3510d7,_0xe1dc5d){return client[_0x0311('0xf')](_0x46ab50,_0x50f201)[_0x0311('0x10')](function(_0x44f536){logger[_0x0311('0x11')](_0x0311('0x12'),_0x183c74,_0x0311('0x13'));logger['debug'](_0x0311('0x14'),_0x183c74,_0x0311('0x13'),JSON[_0x0311('0x15')](_0x44f536));if(_0x44f536[_0x0311('0x16')]){if(_0x44f536['error'][_0x0311('0x17')]===0x1f4){logger['error'](_0x0311('0x12'),_0x183c74,_0x44f536['error'][_0x0311('0x18')]);return _0xe1dc5d(_0x44f536[_0x0311('0x16')][_0x0311('0x18')]);}logger[_0x0311('0x16')](_0x0311('0x12'),_0x183c74,_0x44f536[_0x0311('0x16')][_0x0311('0x18')]);return _0x3510d7(_0x44f536[_0x0311('0x16')]['message']);}else{logger[_0x0311('0x11')](_0x0311('0x12'),_0x183c74,'request\x20sent');_0x3510d7(_0x44f536['result']['message']);}})[_0x0311('0x19')](function(_0x265ffd){logger[_0x0311('0x16')](_0x0311('0x12'),_0x183c74,_0x265ffd);_0xe1dc5d(_0x265ffd);});});} \ No newline at end of file +var _0xa139=['localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3ef368,_0x12b871){var _0x204a3b=function(_0x4ce471){while(--_0x4ce471){_0x3ef368['push'](_0x3ef368['shift']());}};_0x204a3b(++_0x12b871);}(_0xa139,0x82));var _0x9a13=function(_0x2d8d42,_0x31218f){_0x2d8d42=_0x2d8d42-0x0;var _0x1daba9=_0xa139[_0x2d8d42];return _0x1daba9;};'use strict';var _=require(_0x9a13('0x0'));var util=require(_0x9a13('0x1'));var moment=require(_0x9a13('0x2'));var BPromise=require(_0x9a13('0x3'));var rs=require(_0x9a13('0x4'));var fs=require('fs');var Redis=require(_0x9a13('0x5'));var db=require(_0x9a13('0x6'))['db'];var utils=require(_0x9a13('0x7'));var logger=require(_0x9a13('0x8'))(_0x9a13('0x9'));var config=require(_0x9a13('0xa'));var jayson=require(_0x9a13('0xb'));var client=jayson[_0x9a13('0xc')][_0x9a13('0xd')]({'port':0x232a});config[_0x9a13('0xe')]=_['defaults'](config['redis'],{'host':_0x9a13('0xf'),'port':0x18eb});var socket=require(_0x9a13('0x10'))(new Redis(config[_0x9a13('0xe')]));require(_0x9a13('0x11'))['register'](socket);function respondWithRpcPromise(_0x2943b5,_0x50459f,_0x53feeb){return new BPromise(function(_0x5a7896,_0x209cd9){return client[_0x9a13('0x12')](_0x2943b5,_0x53feeb)[_0x9a13('0x13')](function(_0x568a53){logger[_0x9a13('0x14')](_0x9a13('0x15'),_0x50459f,_0x9a13('0x16'));logger[_0x9a13('0x17')](_0x9a13('0x18'),_0x50459f,_0x9a13('0x16'),JSON['stringify'](_0x568a53));if(_0x568a53['error']){if(_0x568a53[_0x9a13('0x19')][_0x9a13('0x1a')]===0x1f4){logger['error'](_0x9a13('0x15'),_0x50459f,_0x568a53[_0x9a13('0x19')][_0x9a13('0x1b')]);return _0x209cd9(_0x568a53[_0x9a13('0x19')][_0x9a13('0x1b')]);}logger[_0x9a13('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x50459f,_0x568a53[_0x9a13('0x19')][_0x9a13('0x1b')]);return _0x5a7896(_0x568a53[_0x9a13('0x19')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x50459f,_0x9a13('0x16'));_0x5a7896(_0x568a53[_0x9a13('0x1c')][_0x9a13('0x1b')]);}})['catch'](function(_0x4485f5){logger[_0x9a13('0x19')](_0x9a13('0x15'),_0x50459f,_0x4485f5);_0x209cd9(_0x4485f5);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d1559a1..3285141 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 _0x587a=['remove','update','emit','removeListener','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x334b17,_0x1547af){var _0x4fa37e=function(_0x2ad3a4){while(--_0x2ad3a4){_0x334b17['push'](_0x334b17['shift']());}};_0x4fa37e(++_0x1547af);}(_0x587a,0x1a6));var _0xa587=function(_0xf60fe1,_0x11d045){_0xf60fe1=_0xf60fe1-0x0;var _0x257ec4=_0x587a[_0xf60fe1];return _0x257ec4;};'use strict';var ChatWebsiteEvents=require(_0xa587('0x0'));var events=[_0xa587('0x1'),_0xa587('0x2'),_0xa587('0x3')];function createListener(_0x1c4966,_0x253321){return function(_0x502594){_0x253321[_0xa587('0x4')](_0x1c4966,_0x502594);};}function removeListener(_0x3cd285,_0x4e7fef){return function(){ChatWebsiteEvents[_0xa587('0x5')](_0x3cd285,_0x4e7fef);};}exports['register']=function(_0x57547c){for(var _0x23e2ac=0x0,_0x144620=events[_0xa587('0x6')];_0x23e2ac<_0x144620;_0x23e2ac++){var _0x91d263=events[_0x23e2ac];var _0x446129=createListener(_0xa587('0x7')+_0x91d263,_0x57547c);ChatWebsiteEvents['on'](_0x91d263,_0x446129);}}; \ No newline at end of file +var _0x5320=['./chatWebsite.events','save','remove','update','emit','length','chatWebsite:'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5320,0x16c));var _0x0532=function(_0x2868ed,_0x2e5ceb){_0x2868ed=_0x2868ed-0x0;var _0x53d526=_0x5320[_0x2868ed];return _0x53d526;};'use strict';var ChatWebsiteEvents=require(_0x0532('0x0'));var events=[_0x0532('0x1'),_0x0532('0x2'),_0x0532('0x3')];function createListener(_0x2abb88,_0x59c59c){return function(_0x28587f){_0x59c59c[_0x0532('0x4')](_0x2abb88,_0x28587f);};}function removeListener(_0x3d317a,_0xd20fc3){return function(){ChatWebsiteEvents['removeListener'](_0x3d317a,_0xd20fc3);};}exports['register']=function(_0x307866){for(var _0x49cdd4=0x0,_0x1ef4fd=events[_0x0532('0x5')];_0x49cdd4<_0x1ef4fd;_0x49cdd4++){var _0x6bd686=events[_0x49cdd4];var _0x59d6e7=createListener(_0x0532('0x6')+_0x6bd686,_0x307866);ChatWebsiteEvents['on'](_0x6bd686,_0x59d6e7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d1ff936..7b1ce51 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 _0x3c10=['attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','create','post','addAnswer','join','root','format','%s-%s','now','addLogo','diskStorage','server/files/images/avatars/','originalname','file','addAvatar','single','addCustomerAvatar','/:id/notify','notify','server/files'];(function(_0x1713e0,_0x3258d8){var _0x2f63d7=function(_0x29f857){while(--_0x29f857){_0x1713e0['push'](_0x1713e0['shift']());}};_0x2f63d7(++_0x3258d8);}(_0x3c10,0x1ee));var _0x03c1=function(_0x2c56de,_0x35063a){_0x2c56de=_0x2c56de-0x0;var _0x30748b=_0x3c10[_0x2c56de];return _0x30748b;};'use strict';var multer=require('multer');var util=require(_0x03c1('0x0'));var path=require(_0x03c1('0x1'));var timeout=require(_0x03c1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x03c1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x03c1('0x4'));var config=require(_0x03c1('0x5'));var controller=require('./chatWebsite.controller');router[_0x03c1('0x6')]('/',auth[_0x03c1('0x7')](),controller['index']);router['get'](_0x03c1('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x03c1('0x6')](_0x03c1('0x9'),auth['isAuthenticated'](),controller[_0x03c1('0xa')]);router[_0x03c1('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x03c1('0xb')]);router[_0x03c1('0x6')](_0x03c1('0xc'),auth[_0x03c1('0x7')](),controller[_0x03c1('0xd')]);router[_0x03c1('0x6')](_0x03c1('0xe'),controller[_0x03c1('0xf')]);router[_0x03c1('0x6')](_0x03c1('0x10'),controller[_0x03c1('0x11')]);router[_0x03c1('0x6')](_0x03c1('0x12'),controller[_0x03c1('0x13')]);router[_0x03c1('0x6')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x03c1('0x6')](_0x03c1('0x14'),auth[_0x03c1('0x7')](),controller[_0x03c1('0x15')]);router['get'](_0x03c1('0x16'),controller['getSnippet']);router[_0x03c1('0x6')](_0x03c1('0x17'),auth['isAuthenticated'](),controller[_0x03c1('0x18')]);router[_0x03c1('0x6')](_0x03c1('0x19'),auth[_0x03c1('0x7')](),controller['getProactiveActions']);router[_0x03c1('0x6')](_0x03c1('0x1a'),controller[_0x03c1('0x1b')]);router['get'](_0x03c1('0x1c'),auth[_0x03c1('0x7')](),controller['getOfflineMessages']);router[_0x03c1('0x6')](_0x03c1('0x1d'),auth[_0x03c1('0x7')](),controller[_0x03c1('0x1e')]);router['post']('/',auth[_0x03c1('0x7')](),controller[_0x03c1('0x1f')]);router[_0x03c1('0x20')]('/:id/dispositions',auth[_0x03c1('0x7')](),controller['addDisposition']);router[_0x03c1('0x20')](_0x03c1('0xc'),auth['isAuthenticated'](),controller[_0x03c1('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5f49a5,_0x4f8d5c,_0x448a28){_0x448a28(null,path[_0x03c1('0x22')](config[_0x03c1('0x23')],'server/files/images/logos/'));},'filename':function(_0x114655,_0xd1d225,_0x1468b3){_0x1468b3(null,util[_0x03c1('0x24')](_0x03c1('0x25'),Date[_0x03c1('0x26')](),_0xd1d225['originalname']));}})});router[_0x03c1('0x20')](_0x03c1('0xe'),upload['single']('file'),controller[_0x03c1('0x27')]);var upload=multer({'storage':multer[_0x03c1('0x28')]({'destination':function(_0xba1908,_0x32b552,_0x1b0ce5){_0x1b0ce5(null,path[_0x03c1('0x22')](config[_0x03c1('0x23')],_0x03c1('0x29')));},'filename':function(_0x266087,_0x4769b7,_0x5e6f43){_0x5e6f43(null,util[_0x03c1('0x24')]('%s-%s',Date['now'](),_0x4769b7[_0x03c1('0x2a')]));}})});router[_0x03c1('0x20')](_0x03c1('0x10'),upload['single'](_0x03c1('0x2b')),controller[_0x03c1('0x2c')]);var upload=multer({'storage':multer[_0x03c1('0x28')]({'destination':function(_0x1af6f2,_0x5cf165,_0xc5f259){_0xc5f259(null,path[_0x03c1('0x22')](config[_0x03c1('0x23')],_0x03c1('0x29')));},'filename':function(_0x8600e7,_0x108fb9,_0x40ba90){_0x40ba90(null,util[_0x03c1('0x24')](_0x03c1('0x25'),Date[_0x03c1('0x26')](),_0x108fb9[_0x03c1('0x2a')]));}})});router[_0x03c1('0x20')]('/:id/customer_avatar',upload[_0x03c1('0x2d')]('file'),controller[_0x03c1('0x2e')]);var upload=multer({'storage':multer[_0x03c1('0x28')]({'destination':function(_0x3a15bf,_0x3059aa,_0x599362){_0x599362(null,path['join'](config[_0x03c1('0x23')],_0x03c1('0x29')));},'filename':function(_0x3c3376,_0x4ea376,_0x31b78d){_0x31b78d(null,util[_0x03c1('0x24')](_0x03c1('0x25'),Date['now'](),_0x4ea376[_0x03c1('0x2a')]));}})});router[_0x03c1('0x20')]('/:id/system_avatar',upload[_0x03c1('0x2d')](_0x03c1('0x2b')),controller['addSystemAvatar']);router[_0x03c1('0x20')](_0x03c1('0x2f'),controller[_0x03c1('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x03c1('0x28')]({'destination':function(_0x20206a,_0x42702e,_0x5483e3){const _0x2f9a34=path[_0x03c1('0x22')](config[_0x03c1('0x23')],_0x03c1('0x31'),_0x03c1('0x32'),_0x03c1('0x33'));fs_extra[_0x03c1('0x34')](_0x2f9a34,function(){_0x5483e3(null,_0x2f9a34);});},'filename':function(_0x208697,_0x1cb8c0,_0x310c9f){const _0x2f26cd=_0x1cb8c0[_0x03c1('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1a2fd5=path[_0x03c1('0x35')](_0x2f26cd);const _0x2117e0=Date['now']()+'-'+_0x2f26cd[_0x03c1('0x36')](_0x1a2fd5,'')+_0x1a2fd5;_0x310c9f(null,_0x2117e0);}})});router[_0x03c1('0x20')](_0x03c1('0x37'),offlineUploadMulter[_0x03c1('0x38')](),controller[_0x03c1('0x39')]);router[_0x03c1('0x20')](_0x03c1('0x14'),auth[_0x03c1('0x7')](),controller['addInteraction']);router[_0x03c1('0x20')](_0x03c1('0x17'),auth['isAuthenticated'](),controller[_0x03c1('0x3a')]);router[_0x03c1('0x20')](_0x03c1('0x19'),auth[_0x03c1('0x7')](),controller[_0x03c1('0x3b')]);router[_0x03c1('0x20')]('/:id/users',auth[_0x03c1('0x7')](),controller[_0x03c1('0x3c')]);router[_0x03c1('0x3d')](_0x03c1('0x9'),auth[_0x03c1('0x7')](),controller[_0x03c1('0x3e')]);router[_0x03c1('0x3f')](_0x03c1('0x9'),auth[_0x03c1('0x7')](),controller[_0x03c1('0x40')]);router[_0x03c1('0x3f')]('/:id/dispositions',auth[_0x03c1('0x7')](),controller[_0x03c1('0x41')]);router[_0x03c1('0x3f')](_0x03c1('0xc'),auth[_0x03c1('0x7')](),controller['removeAnswers']);router[_0x03c1('0x3f')](_0x03c1('0x1d'),auth[_0x03c1('0x7')](),controller[_0x03c1('0x42')]);module[_0x03c1('0x43')]=router; \ No newline at end of file +var _0xb6c4=['offline-chat','replace','extname','/:id/offline','any','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','update','/:id','destroy','/:id/dispositions','removeAnswers','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','show','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments'];(function(_0x5c4bb6,_0xefcfb0){var _0x35cf78=function(_0x9ae03a){while(--_0x9ae03a){_0x5c4bb6['push'](_0x5c4bb6['shift']());}};_0x35cf78(++_0xefcfb0);}(_0xb6c4,0xea));var _0x4b6c=function(_0x2a6439,_0x37f530){_0x2a6439=_0x2a6439-0x0;var _0x5879c2=_0xb6c4[_0x2a6439];return _0x5879c2;};'use strict';var multer=require(_0x4b6c('0x0'));var util=require(_0x4b6c('0x1'));var path=require('path');var timeout=require(_0x4b6c('0x2'));var express=require(_0x4b6c('0x3'));var router=express[_0x4b6c('0x4')]();var fs_extra=require(_0x4b6c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b6c('0x6'));var controller=require(_0x4b6c('0x7'));router[_0x4b6c('0x8')]('/',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0xa')]);router[_0x4b6c('0x8')]('/describe',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0xb')]);router[_0x4b6c('0x8')]('/:id',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0xc')]);router[_0x4b6c('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4b6c('0xd')]);router[_0x4b6c('0x8')]('/:id/canned_answers',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0xe')]);router[_0x4b6c('0x8')](_0x4b6c('0xf'),controller[_0x4b6c('0x10')]);router['get'](_0x4b6c('0x11'),controller[_0x4b6c('0x12')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router['get'](_0x4b6c('0x13'),controller[_0x4b6c('0x14')]);router[_0x4b6c('0x8')](_0x4b6c('0x15'),auth['isAuthenticated'](),controller[_0x4b6c('0x16')]);router[_0x4b6c('0x8')]('/:id/snippet',controller[_0x4b6c('0x17')]);router['get'](_0x4b6c('0x18'),auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x19')]);router[_0x4b6c('0x8')](_0x4b6c('0x1a'),auth[_0x4b6c('0x9')](),controller['getProactiveActions']);router[_0x4b6c('0x8')](_0x4b6c('0x1b'),controller['getFields']);router[_0x4b6c('0x8')](_0x4b6c('0x1c'),auth['isAuthenticated'](),controller[_0x4b6c('0x1d')]);router[_0x4b6c('0x8')]('/:id/users',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x1e')]);router['post']('/',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x1f')]);router[_0x4b6c('0x20')]('/:id/dispositions',auth[_0x4b6c('0x9')](),controller['addDisposition']);router[_0x4b6c('0x20')](_0x4b6c('0x21'),auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x22')]);var upload=multer({'storage':multer[_0x4b6c('0x23')]({'destination':function(_0x2411d9,_0x28ae86,_0x2bd286){_0x2bd286(null,path[_0x4b6c('0x24')](config[_0x4b6c('0x25')],_0x4b6c('0x26')));},'filename':function(_0x1e1c86,_0xe17621,_0x48587){_0x48587(null,util[_0x4b6c('0x27')](_0x4b6c('0x28'),Date[_0x4b6c('0x29')](),_0xe17621[_0x4b6c('0x2a')]));}})});router[_0x4b6c('0x20')](_0x4b6c('0xf'),upload[_0x4b6c('0x2b')](_0x4b6c('0x2c')),controller[_0x4b6c('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12b65b,_0x42ac9c,_0x348e7b){_0x348e7b(null,path['join'](config[_0x4b6c('0x25')],_0x4b6c('0x2e')));},'filename':function(_0xb3b8d,_0x1a6164,_0x47ec40){_0x47ec40(null,util[_0x4b6c('0x27')](_0x4b6c('0x28'),Date['now'](),_0x1a6164[_0x4b6c('0x2a')]));}})});router['post'](_0x4b6c('0x11'),upload['single'](_0x4b6c('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x4b6c('0x23')]({'destination':function(_0xba6d75,_0x3dc975,_0xa6425e){_0xa6425e(null,path[_0x4b6c('0x24')](config[_0x4b6c('0x25')],_0x4b6c('0x2e')));},'filename':function(_0x65d9f8,_0x472e68,_0x25eee1){_0x25eee1(null,util[_0x4b6c('0x27')](_0x4b6c('0x28'),Date[_0x4b6c('0x29')](),_0x472e68['originalname']));}})});router[_0x4b6c('0x20')](_0x4b6c('0x2f'),upload[_0x4b6c('0x2b')](_0x4b6c('0x2c')),controller[_0x4b6c('0x30')]);var upload=multer({'storage':multer[_0x4b6c('0x23')]({'destination':function(_0x54e533,_0x490cb7,_0xc2204e){_0xc2204e(null,path[_0x4b6c('0x24')](config[_0x4b6c('0x25')],'server/files/images/avatars/'));},'filename':function(_0x4074a8,_0x41b41c,_0x59f4cf){_0x59f4cf(null,util[_0x4b6c('0x27')](_0x4b6c('0x28'),Date[_0x4b6c('0x29')](),_0x41b41c[_0x4b6c('0x2a')]));}})});router['post'](_0x4b6c('0x13'),upload[_0x4b6c('0x2b')]('file'),controller[_0x4b6c('0x31')]);router['post'](_0x4b6c('0x32'),controller[_0x4b6c('0x33')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x416a77,_0x138997,_0x2406d8){const _0x48ef5b=path[_0x4b6c('0x24')](config['root'],_0x4b6c('0x34'),_0x4b6c('0x35'),_0x4b6c('0x36'));fs_extra['ensureDir'](_0x48ef5b,function(){_0x2406d8(null,_0x48ef5b);});},'filename':function(_0x4e9a38,_0x18c28f,_0x1c218b){const _0x15f545=_0x18c28f[_0x4b6c('0x2a')][_0x4b6c('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x30b9c7=path[_0x4b6c('0x38')](_0x15f545);const _0x527da0=Date[_0x4b6c('0x29')]()+'-'+_0x15f545[_0x4b6c('0x37')](_0x30b9c7,'')+_0x30b9c7;_0x1c218b(null,_0x527da0);}})});router[_0x4b6c('0x20')](_0x4b6c('0x39'),offlineUploadMulter[_0x4b6c('0x3a')](),controller['offline']);router[_0x4b6c('0x20')](_0x4b6c('0x15'),auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x3b')]);router[_0x4b6c('0x20')]('/:id/applications',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x3c')]);router[_0x4b6c('0x20')](_0x4b6c('0x1a'),auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x3d')]);router[_0x4b6c('0x20')](_0x4b6c('0x3e'),auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x3f')]);router['put']('/:id',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x40')]);router['delete'](_0x4b6c('0x41'),auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x42')]);router['delete'](_0x4b6c('0x43'),auth[_0x4b6c('0x9')](),controller['removeDispositions']);router['delete'](_0x4b6c('0x21'),auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x44')]);router[_0x4b6c('0x45')]('/:id/users',auth[_0x4b6c('0x9')](),controller[_0x4b6c('0x46')]);module[_0x4b6c('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4f876cf..4ac7295 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 _0x472a=['../components/auth/service','../config/environment','Router','env','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports'];(function(_0x349545,_0x3df7bc){var _0x56a8a5=function(_0x9d334c){while(--_0x9d334c){_0x349545['push'](_0x349545['shift']());}};_0x56a8a5(++_0x3df7bc);}(_0x472a,0x197));var _0xa472=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x472a[_0x2dea24];return _0x309d58;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xa472('0x0'));var config=require(_0xa472('0x1'));var router=express[_0xa472('0x2')]();var isProduction=config[_0xa472('0x3')]==='production'||![];function clientSideLogs(_0x25f9ad,_0x1504f3,_0x206f2d){var _0x1207d5=_0x25f9ad['app'][_0xa472('0x4')](_0xa472('0x5'));if(!_0x1207d5){throw new Error(_0xa472('0x6'));}return beaverLogger[_0xa472('0x7')]({'uri':'/client-logs','logger':_0x1207d5,'enableCors':!isProduction})(_0x25f9ad,_0x1504f3,_0x206f2d);}router[_0xa472('0x8')](auth[_0xa472('0x9')](),clientSideLogs);module[_0xa472('0xa')]=router; \ No newline at end of file +var _0xdf65=['/client-logs','use','beaver-logger/server','../config/environment','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x264e83,_0x398fd4){var _0x538952=function(_0x2ce4ad){while(--_0x2ce4ad){_0x264e83['push'](_0x264e83['shift']());}};_0x538952(++_0x398fd4);}(_0xdf65,0xbd));var _0x5df6=function(_0x3ac9d5,_0x3929dd){_0x3ac9d5=_0x3ac9d5-0x0;var _0x2622c6=_0xdf65[_0x3ac9d5];return _0x2622c6;};var beaverLogger=require(_0x5df6('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x5df6('0x1'));var router=express[_0x5df6('0x2')]();var isProduction=config[_0x5df6('0x3')]===_0x5df6('0x4')||![];function clientSideLogs(_0x4d3d5a,_0x35e6fd,_0x20598d){var _0x325629=_0x4d3d5a['app'][_0x5df6('0x5')](_0x5df6('0x6'));if(!_0x325629){throw new Error(_0x5df6('0x7'));}return beaverLogger[_0x5df6('0x8')]({'uri':_0x5df6('0x9'),'logger':_0x325629,'enableCors':!isProduction})(_0x4d3d5a,_0x35e6fd,_0x20598d);}router[_0x5df6('0xa')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index a9a660c..d041a74 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 _0xfc81=['Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xfc81,0x19a));var _0x1fc8=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0xfc81[_0xe2c95e];return _0x42ce6f;};'use strict';var Sequelize=require(_0x1fc8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1fc8('0x1')](_0x1fc8('0x2'),_0x1fc8('0x3'),_0x1fc8('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1fc8('0x5'),_0x1fc8('0x6'))},'data1':{'type':Sequelize[_0x1fc8('0x7')],'comment':_0x1fc8('0x8')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x1fc8('0x7')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x1fc8('0x9')},'data5':{'type':Sequelize[_0x1fc8('0xa')],'comment':_0x1fc8('0xb')},'data6':{'type':Sequelize[_0x1fc8('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x1fc8('0xa')],'comment':_0x1fc8('0xc')}}; \ No newline at end of file +var _0x91b1=['AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM'];(function(_0x3f8a9a,_0x5f3046){var _0xcaad7b=function(_0x5ec46e){while(--_0x5ec46e){_0x3f8a9a['push'](_0x3f8a9a['shift']());}};_0xcaad7b(++_0x5f3046);}(_0x91b1,0xfa));var _0x191b=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x91b1[_0x22dac7];return _0x3e6cfa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x191b('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x191b('0x1')](_0x191b('0x2'),_0x191b('0x3'),_0x191b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x191b('0x1')]('Outlook365',_0x191b('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x191b('0x6')},'data2':{'type':Sequelize[_0x191b('0x0')],'comment':_0x191b('0x7')},'data3':{'type':Sequelize['STRING'],'comment':_0x191b('0x8')},'data4':{'type':Sequelize[_0x191b('0x0')],'comment':_0x191b('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0x191b('0xa')},'data6':{'type':Sequelize[_0x191b('0xb')],'comment':_0x191b('0xc')},'data7':{'type':Sequelize[_0x191b('0xb')],'comment':_0x191b('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2cf9a07..31f278f 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 _0x9e54=['options','service','data3','show','params','length','includeAll','include','merge','find','MicrosoftAzure','decryptString','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','from','ascii','parse','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','data5','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','error','stack','name','send','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL'];(function(_0x35ed3a,_0x28dce8){var _0x26fd47=function(_0x38ea54){while(--_0x38ea54){_0x35ed3a['push'](_0x35ed3a['shift']());}};_0x26fd47(++_0x28dce8);}(_0x9e54,0xe2));var _0x49e5=function(_0x254461,_0x45615a){_0x254461=_0x254461-0x0;var _0x28ee0e=_0x9e54[_0x254461];return _0x28ee0e;};'use strict';var _=require('lodash');var Redis=require(_0x49e5('0x0'));var qs=require(_0x49e5('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x49e5('0x2'))(_0x49e5('0x3'));var db=require(_0x49e5('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x49e5('0x5')]=_['defaults'](config[_0x49e5('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x49e5('0x6'))(new Redis(config[_0x49e5('0x5')]));var redis=new Redis(config[_0x49e5('0x5')]);function respondWithStatusCode(_0x16dd74,_0x3578a8){_0x3578a8=_0x3578a8||0xcc;return function(_0x31ded8){if(_0x31ded8){return _0x16dd74[_0x49e5('0x7')](_0x3578a8);}return _0x16dd74['status'](_0x3578a8)[_0x49e5('0x8')]();};}function respondWithResult(_0x5ce23f,_0x5ad456){_0x5ad456=_0x5ad456||0xc8;return function(_0x6628ce){if(_0x6628ce){return _0x5ce23f[_0x49e5('0x9')](_0x5ad456)[_0x49e5('0xa')](_0x6628ce);}};}function respondWithFilteredResult(_0x3e33d6,_0x5f0407){return function(_0x4da66e){if(_0x4da66e){var _0x25608d=typeof _0x5f0407[_0x49e5('0xb')]==='undefined'&&typeof _0x5f0407['limit']===_0x49e5('0xc');var _0x2335e3=_0x4da66e['count'];var _0x4a3264=_0x25608d?0x0:_0x5f0407[_0x49e5('0xb')];var _0x3a9b0c=_0x25608d?_0x4da66e[_0x49e5('0xd')]:_0x5f0407[_0x49e5('0xb')]+_0x5f0407[_0x49e5('0xe')];var _0x4d193c;if(_0x3a9b0c>=_0x2335e3){_0x3a9b0c=_0x2335e3;_0x4d193c=0xc8;}else{_0x4d193c=0xce;}_0x3e33d6[_0x49e5('0x9')](_0x4d193c);return _0x3e33d6[_0x49e5('0xf')](_0x49e5('0x10'),_0x4a3264+'-'+_0x3a9b0c+'/'+_0x2335e3)[_0x49e5('0xa')](_0x4da66e);}return null;};}function saveUpdates(_0x3d6842){return function(_0x2e4fc0){if(_0x2e4fc0){return _0x2e4fc0[_0x49e5('0x11')](_0x3d6842)[_0x49e5('0x12')](function(_0x17e88c){return _0x17e88c;});}return null;};}function removeEntity(_0x567780){return function(_0x29aee5){if(_0x29aee5){return _0x29aee5['destroy']()['then'](function(){_0x567780[_0x49e5('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x68615f){return function(_0x384e57){if(!_0x384e57){_0x68615f[_0x49e5('0x7')](0x194);}return _0x384e57;};}function handleError(_0x4e7b30,_0xff8b21){_0xff8b21=_0xff8b21||0x1f4;return function(_0x46d965){logger[_0x49e5('0x13')](_0x46d965[_0x49e5('0x14')]);if(_0x46d965[_0x49e5('0x15')]){delete _0x46d965['name'];}_0x4e7b30[_0x49e5('0x9')](_0xff8b21)[_0x49e5('0x16')](_0x46d965);};}function maskClientSecret(_0x2c563e){return _[_0x49e5('0x17')](_0x2c563e[_0x49e5('0x18')](0x0,0x3),0x14,'*');}exports[_0x49e5('0x19')]=function(_0xb40ebe,_0x3344cd){var _0x549e5={},_0x57cd14={},_0x1b9c8b={'count':0x0,'rows':[]};var _0x420452=_['map'](db[_0x49e5('0x1a')][_0x49e5('0x1b')],function(_0x5432c7){return{'name':_0x5432c7[_0x49e5('0x1c')],'type':_0x5432c7[_0x49e5('0x1d')][_0x49e5('0x1e')]};});_0x57cd14[_0x49e5('0x1f')]=_[_0x49e5('0x20')](_0x420452,'name');_0x57cd14['query']=_[_0x49e5('0x21')](_0xb40ebe[_0x49e5('0x22')]);_0x57cd14[_0x49e5('0x23')]=_[_0x49e5('0x24')](_0x57cd14[_0x49e5('0x1f')],_0x57cd14[_0x49e5('0x22')]);_0x549e5[_0x49e5('0x25')]=_[_0x49e5('0x24')](_0x57cd14[_0x49e5('0x1f')],qs[_0x49e5('0x26')](_0xb40ebe[_0x49e5('0x22')][_0x49e5('0x26')]));_0x549e5[_0x49e5('0x25')]=_0x549e5[_0x49e5('0x25')]['length']?_0x549e5['attributes']:_0x57cd14[_0x49e5('0x1f')];if(!_0xb40ebe[_0x49e5('0x22')]['hasOwnProperty']('nolimit')){_0x549e5[_0x49e5('0xe')]=qs[_0x49e5('0xe')](_0xb40ebe[_0x49e5('0x22')][_0x49e5('0xe')]);_0x549e5['offset']=qs[_0x49e5('0xb')](_0xb40ebe[_0x49e5('0x22')][_0x49e5('0xb')]);}_0x549e5[_0x49e5('0x27')]=qs[_0x49e5('0x28')](_0xb40ebe[_0x49e5('0x22')][_0x49e5('0x28')]);_0x549e5[_0x49e5('0x29')]=qs[_0x49e5('0x23')](_['pick'](_0xb40ebe['query'],_0x57cd14[_0x49e5('0x23')]),_0x420452);if(_0xb40ebe[_0x49e5('0x22')][_0x49e5('0x2a')]){_0x549e5[_0x49e5('0x29')]=_['merge'](_0x549e5[_0x49e5('0x29')],{'$or':_['map'](_0x420452,function(_0x4cc145){if(_0x4cc145[_0x49e5('0x1d')]!==_0x49e5('0x2b')){var _0x5d4599={};_0x5d4599[_0x4cc145[_0x49e5('0x15')]]={'$like':'%'+_0xb40ebe[_0x49e5('0x22')][_0x49e5('0x2a')]+'%'};return _0x5d4599;}})});}_0x549e5=_['merge']({},_0x549e5,_0xb40ebe[_0x49e5('0x2c')]);var _0x12dea2={'where':_0x549e5[_0x49e5('0x29')]};return db[_0x49e5('0x1a')][_0x49e5('0xd')](_0x12dea2)[_0x49e5('0x12')](function(_0x42ae15){_0x1b9c8b[_0x49e5('0xd')]=_0x42ae15;if(_0xb40ebe['query']['includeAll']){_0x549e5['include']=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x549e5);})['then'](function(_0x4cf656){_0x1b9c8b['rows']=_['map'](_0x4cf656,function(_0x381976){if(_0x381976[_0x49e5('0x2d')]==='MicrosoftAzure'){var _0x49a118=encryptor['decryptString'](_0x381976[_0x49e5('0x2e')]);_0x381976['data3']=maskClientSecret(_0x49a118);}return _0x381976;});return _0x1b9c8b;})[_0x49e5('0x12')](respondWithFilteredResult(_0x3344cd,_0x549e5))['catch'](handleError(_0x3344cd,null));};exports[_0x49e5('0x2f')]=function(_0x5491d2,_0x1b9ca8){var _0x1268eb={'raw':!![],'where':{'id':_0x5491d2[_0x49e5('0x30')]['id']}},_0x10846a={};_0x10846a[_0x49e5('0x1f')]=_['keys'](db[_0x49e5('0x1a')]['rawAttributes']);_0x10846a[_0x49e5('0x22')]=_[_0x49e5('0x21')](_0x5491d2[_0x49e5('0x22')]);_0x10846a['filters']=_[_0x49e5('0x24')](_0x10846a['model'],_0x10846a[_0x49e5('0x22')]);_0x1268eb['attributes']=_['intersection'](_0x10846a[_0x49e5('0x1f')],qs[_0x49e5('0x26')](_0x5491d2[_0x49e5('0x22')][_0x49e5('0x26')]));_0x1268eb[_0x49e5('0x25')]=_0x1268eb[_0x49e5('0x25')][_0x49e5('0x31')]?_0x1268eb[_0x49e5('0x25')]:_0x10846a[_0x49e5('0x1f')];if(_0x5491d2[_0x49e5('0x22')][_0x49e5('0x32')]){_0x1268eb[_0x49e5('0x33')]=[{'all':!![]}];}_0x1268eb=_[_0x49e5('0x34')]({},_0x1268eb,_0x5491d2[_0x49e5('0x2c')]);return db['CloudProvider'][_0x49e5('0x35')](_0x1268eb)[_0x49e5('0x12')](handleEntityNotFound(_0x1b9ca8,null))[_0x49e5('0x12')](function(_0x42776e){if(_0x42776e['service']===_0x49e5('0x36')){var _0x43f2d3=encryptor[_0x49e5('0x37')](_0x42776e[_0x49e5('0x2e')]);_0x42776e[_0x49e5('0x2e')]=maskClientSecret(_0x43f2d3);}return _0x42776e;})[_0x49e5('0x12')](respondWithResult(_0x1b9ca8,null))[_0x49e5('0x38')](handleError(_0x1b9ca8,null));};exports[_0x49e5('0x39')]=function(_0x4fd280,_0x2a5e3a){if(!_0x4fd280[_0x49e5('0x3a')][_0x49e5('0x15')])throw new Error(_0x49e5('0x3b'));if(!_0x4fd280[_0x49e5('0x3a')]['service'])throw new Error(_0x49e5('0x3c'));var _0x43e738=db[_0x49e5('0x1a')][_0x49e5('0x1b')][_0x49e5('0x2d')][_0x49e5('0x3d')];if(!_0x43e738['includes'](_0x4fd280[_0x49e5('0x3a')][_0x49e5('0x2d')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x43e738[_0x49e5('0x3e')](',\x20'));if(_0x4fd280['body'][_0x49e5('0x2d')]===_0x49e5('0x36')&&_0x4fd280[_0x49e5('0x3a')][_0x49e5('0x2e')]){_0x4fd280[_0x49e5('0x3a')][_0x49e5('0x2e')]=encryptor[_0x49e5('0x3f')](_0x4fd280['body'][_0x49e5('0x2e')]);}return db[_0x49e5('0x1a')]['create'](_0x4fd280['body'],{})[_0x49e5('0x12')](respondWithResult(_0x2a5e3a,0xc9))['catch'](handleError(_0x2a5e3a,null));};exports['update']=function(_0x3c6d75,_0xe14abe){if(_0x3c6d75[_0x49e5('0x3a')]['id']){delete _0x3c6d75[_0x49e5('0x3a')]['id'];}return db[_0x49e5('0x1a')][_0x49e5('0x35')]({'where':{'id':_0x3c6d75[_0x49e5('0x30')]['id']}})[_0x49e5('0x12')](handleEntityNotFound(_0xe14abe,null))[_0x49e5('0x12')](function(_0x2ed410){if(_0x2ed410[_0x49e5('0x2d')]===_0x49e5('0x36')&&_0x3c6d75[_0x49e5('0x3a')][_0x49e5('0x2e')]){_0x3c6d75[_0x49e5('0x3a')]['data3']=encryptor['encryptString'](_0x3c6d75[_0x49e5('0x3a')][_0x49e5('0x2e')]);}return _0x2ed410;})[_0x49e5('0x12')](saveUpdates(_0x3c6d75[_0x49e5('0x3a')],null))['then'](respondWithResult(_0xe14abe,null))['catch'](handleError(_0xe14abe,null));};exports[_0x49e5('0x40')]=function(_0x55b8d,_0x15dc5b){return db[_0x49e5('0x1a')]['find']({'where':{'id':_0x55b8d[_0x49e5('0x30')]['id']}})[_0x49e5('0x12')](handleEntityNotFound(_0x15dc5b,null))[_0x49e5('0x12')](removeEntity(_0x15dc5b,null))[_0x49e5('0x38')](handleError(_0x15dc5b,null));};exports[_0x49e5('0x41')]=function(_0x412460,_0x1e841e){return db[_0x49e5('0x1a')][_0x49e5('0x42')]({'where':{'id':_0x412460[_0x49e5('0x30')]['id']},'raw':!![]})[_0x49e5('0x12')](function(_0x5df45e){if(!_0x5df45e)return _0x1e841e[_0x49e5('0x7')](0x194);return{'url':oauth[_0x49e5('0x43')](_0x5df45e,_0x412460[_0x49e5('0x44')]['id'])};})[_0x49e5('0x12')](respondWithResult(_0x1e841e,null))[_0x49e5('0x38')](handleError(_0x1e841e,null));};exports[_0x49e5('0x45')]=function(_0x385ceb,_0x41006d){var _0x16768a=_0x385ceb[_0x49e5('0x3a')];var _0x4424f0;var _0x19b36c;if(_0x16768a[_0x49e5('0x13')])throw _0x16768a;redis[_0x49e5('0x46')](_0x16768a[_0x49e5('0x47')])['then'](function(_0x80b5de){if(!_0x80b5de)throw new Error('Invalid\x20state\x20parameter');_0x4424f0=JSON['parse'](_0x80b5de);var _0x43cbbc=Buffer[_0x49e5('0x48')](_0x16768a[_0x49e5('0x47')],'base64')['toString'](_0x49e5('0x49'));_0x19b36c=JSON[_0x49e5('0x4a')](_0x43cbbc);if(!oauth[_0x49e5('0x4b')](_0x16768a['id_token'],_0x4424f0['oauth2Claims']))throw new Error(_0x49e5('0x4c'));redis[_0x49e5('0x4d')](_0x16768a['state']);return oauth[_0x49e5('0x4e')](_0x16768a[_0x49e5('0x4f')],_0x4424f0);})[_0x49e5('0x12')](function(_0x156c02){_0x4424f0['data5']=_0x156c02[_0x49e5('0x50')];_0x4424f0[_0x49e5('0x51')]=_0x156c02['refresh_token'];return db[_0x49e5('0x1a')][_0x49e5('0x11')]({'data5':_0x4424f0[_0x49e5('0x52')],'data6':_0x4424f0[_0x49e5('0x51')]},{'where':{'id':_0x4424f0['id']}});})[_0x49e5('0x12')](function(){oauth[_0x49e5('0x53')](_0x4424f0);socket['emit'](_0x49e5('0x54'),{'id':_0x19b36c['id']});return;})[_0x49e5('0x12')](respondWithStatusCode(_0x41006d,null))[_0x49e5('0x38')](function(_0x52a61e){if(_0x19b36c){socket[_0x49e5('0x55')](_0x49e5('0x56'),{'id':_0x19b36c['id']});}if(!_0x4424f0){logger[_0x49e5('0x13')]('Invalid\x20authentication\x20state\x20parameter',_0x52a61e);return _0x41006d[_0x49e5('0x9')](0x1f4)[_0x49e5('0x16')](_0x52a61e[_0x49e5('0x57')]);}logger['error'](_0x49e5('0x58'),_0x4424f0['id'],JSON[_0x49e5('0x59')](_0x52a61e));});}; \ No newline at end of file +var _0x9628=['message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/parsers/qs','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','status','end','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','params','destroy','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:error'];(function(_0x12229b,_0x311a05){var _0x27af9c=function(_0x472b5d){while(--_0x472b5d){_0x12229b['push'](_0x12229b['shift']());}};_0x27af9c(++_0x311a05);}(_0x9628,0x166));var _0x8962=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x9628[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var Redis=require(_0x8962('0x0'));var qs=require(_0x8962('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x8962('0x2'));var logger=require('../../config/logger')(_0x8962('0x3'));var db=require(_0x8962('0x4'))['db'];var oauth=require(_0x8962('0x5'));config[_0x8962('0x6')]=_[_0x8962('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8962('0x6')]));var redis=new Redis(config[_0x8962('0x6')]);function respondWithStatusCode(_0x313878,_0xca630c){_0xca630c=_0xca630c||0xcc;return function(_0x1ec3bf){if(_0x1ec3bf){return _0x313878['sendStatus'](_0xca630c);}return _0x313878[_0x8962('0x8')](_0xca630c)[_0x8962('0x9')]();};}function respondWithResult(_0x5172a3,_0x16a02f){_0x16a02f=_0x16a02f||0xc8;return function(_0x235f98){if(_0x235f98){return _0x5172a3[_0x8962('0x8')](_0x16a02f)[_0x8962('0xa')](_0x235f98);}};}function respondWithFilteredResult(_0x343414,_0xb3b437){return function(_0x5a298d){if(_0x5a298d){var _0x2cd908=typeof _0xb3b437[_0x8962('0xb')]===_0x8962('0xc')&&typeof _0xb3b437[_0x8962('0xd')]===_0x8962('0xc');var _0x1dfa14=_0x5a298d[_0x8962('0xe')];var _0x399a04=_0x2cd908?0x0:_0xb3b437['offset'];var _0x2a734d=_0x2cd908?_0x5a298d[_0x8962('0xe')]:_0xb3b437['offset']+_0xb3b437['limit'];var _0x379df2;if(_0x2a734d>=_0x1dfa14){_0x2a734d=_0x1dfa14;_0x379df2=0xc8;}else{_0x379df2=0xce;}_0x343414[_0x8962('0x8')](_0x379df2);return _0x343414[_0x8962('0xf')]('Content-Range',_0x399a04+'-'+_0x2a734d+'/'+_0x1dfa14)[_0x8962('0xa')](_0x5a298d);}return null;};}function saveUpdates(_0x2570ef){return function(_0x79282c){if(_0x79282c){return _0x79282c[_0x8962('0x10')](_0x2570ef)[_0x8962('0x11')](function(_0x302668){return _0x302668;});}return null;};}function removeEntity(_0x5a190b){return function(_0x2320f8){if(_0x2320f8){return _0x2320f8['destroy']()[_0x8962('0x11')](function(){_0x5a190b['status'](0xcc)[_0x8962('0x9')]();});}};}function handleEntityNotFound(_0x508512){return function(_0x4b5ca2){if(!_0x4b5ca2){_0x508512[_0x8962('0x12')](0x194);}return _0x4b5ca2;};}function handleError(_0x245d41,_0x4b83a6){_0x4b83a6=_0x4b83a6||0x1f4;return function(_0x11e9ca){logger[_0x8962('0x13')](_0x11e9ca['stack']);if(_0x11e9ca[_0x8962('0x14')]){delete _0x11e9ca[_0x8962('0x14')];}_0x245d41[_0x8962('0x8')](_0x4b83a6)[_0x8962('0x15')](_0x11e9ca);};}function maskClientSecret(_0x50a01d){return _[_0x8962('0x16')](_0x50a01d['slice'](0x0,0x3),0x14,'*');}exports[_0x8962('0x17')]=function(_0x4cda3c,_0x19bcd7){var _0xe247c0={},_0x24e976={},_0x249baf={'count':0x0,'rows':[]};var _0x22b3ea=_[_0x8962('0x18')](db[_0x8962('0x19')][_0x8962('0x1a')],function(_0x57de17){return{'name':_0x57de17[_0x8962('0x1b')],'type':_0x57de17[_0x8962('0x1c')]['key']};});_0x24e976[_0x8962('0x1d')]=_[_0x8962('0x18')](_0x22b3ea,_0x8962('0x14'));_0x24e976['query']=_[_0x8962('0x1e')](_0x4cda3c[_0x8962('0x1f')]);_0x24e976[_0x8962('0x20')]=_[_0x8962('0x21')](_0x24e976[_0x8962('0x1d')],_0x24e976[_0x8962('0x1f')]);_0xe247c0[_0x8962('0x22')]=_['intersection'](_0x24e976[_0x8962('0x1d')],qs[_0x8962('0x23')](_0x4cda3c[_0x8962('0x1f')][_0x8962('0x23')]));_0xe247c0['attributes']=_0xe247c0[_0x8962('0x22')][_0x8962('0x24')]?_0xe247c0[_0x8962('0x22')]:_0x24e976[_0x8962('0x1d')];if(!_0x4cda3c['query']['hasOwnProperty']('nolimit')){_0xe247c0[_0x8962('0xd')]=qs[_0x8962('0xd')](_0x4cda3c['query'][_0x8962('0xd')]);_0xe247c0[_0x8962('0xb')]=qs[_0x8962('0xb')](_0x4cda3c[_0x8962('0x1f')]['offset']);}_0xe247c0[_0x8962('0x25')]=qs[_0x8962('0x26')](_0x4cda3c[_0x8962('0x1f')][_0x8962('0x26')]);_0xe247c0[_0x8962('0x27')]=qs[_0x8962('0x20')](_[_0x8962('0x28')](_0x4cda3c[_0x8962('0x1f')],_0x24e976[_0x8962('0x20')]),_0x22b3ea);if(_0x4cda3c[_0x8962('0x1f')][_0x8962('0x29')]){_0xe247c0[_0x8962('0x27')]=_[_0x8962('0x2a')](_0xe247c0[_0x8962('0x27')],{'$or':_['map'](_0x22b3ea,function(_0x2eb461){if(_0x2eb461[_0x8962('0x1c')]!==_0x8962('0x2b')){var _0x55ea9d={};_0x55ea9d[_0x2eb461[_0x8962('0x14')]]={'$like':'%'+_0x4cda3c[_0x8962('0x1f')][_0x8962('0x29')]+'%'};return _0x55ea9d;}})});}_0xe247c0=_['merge']({},_0xe247c0,_0x4cda3c[_0x8962('0x2c')]);var _0x508c72={'where':_0xe247c0['where']};return db[_0x8962('0x19')][_0x8962('0xe')](_0x508c72)[_0x8962('0x11')](function(_0x4e52cc){_0x249baf[_0x8962('0xe')]=_0x4e52cc;if(_0x4cda3c[_0x8962('0x1f')][_0x8962('0x2d')]){_0xe247c0[_0x8962('0x2e')]=[{'all':!![]}];}return db['CloudProvider'][_0x8962('0x2f')](_0xe247c0);})[_0x8962('0x11')](function(_0x33fbb1){_0x249baf[_0x8962('0x30')]=_[_0x8962('0x18')](_0x33fbb1,function(_0x102d93){if(_0x102d93[_0x8962('0x31')]===_0x8962('0x32')){var _0x562617=encryptor['decryptString'](_0x102d93[_0x8962('0x33')]);_0x102d93[_0x8962('0x33')]=maskClientSecret(_0x562617);}return _0x102d93;});return _0x249baf;})['then'](respondWithFilteredResult(_0x19bcd7,_0xe247c0))[_0x8962('0x34')](handleError(_0x19bcd7,null));};exports[_0x8962('0x35')]=function(_0x2d8801,_0x1c845e){var _0x2e0ddc={'raw':!![],'where':{'id':_0x2d8801['params']['id']}},_0xc2113c={};_0xc2113c[_0x8962('0x1d')]=_['keys'](db[_0x8962('0x19')]['rawAttributes']);_0xc2113c[_0x8962('0x1f')]=_[_0x8962('0x1e')](_0x2d8801['query']);_0xc2113c[_0x8962('0x20')]=_[_0x8962('0x21')](_0xc2113c['model'],_0xc2113c[_0x8962('0x1f')]);_0x2e0ddc[_0x8962('0x22')]=_[_0x8962('0x21')](_0xc2113c[_0x8962('0x1d')],qs[_0x8962('0x23')](_0x2d8801[_0x8962('0x1f')][_0x8962('0x23')]));_0x2e0ddc[_0x8962('0x22')]=_0x2e0ddc['attributes'][_0x8962('0x24')]?_0x2e0ddc[_0x8962('0x22')]:_0xc2113c[_0x8962('0x1d')];if(_0x2d8801[_0x8962('0x1f')][_0x8962('0x2d')]){_0x2e0ddc[_0x8962('0x2e')]=[{'all':!![]}];}_0x2e0ddc=_[_0x8962('0x2a')]({},_0x2e0ddc,_0x2d8801['options']);return db[_0x8962('0x19')]['find'](_0x2e0ddc)[_0x8962('0x11')](handleEntityNotFound(_0x1c845e,null))[_0x8962('0x11')](function(_0x3cfb53){if(_0x3cfb53[_0x8962('0x31')]===_0x8962('0x32')){var _0x1f3868=encryptor['decryptString'](_0x3cfb53['data3']);_0x3cfb53[_0x8962('0x33')]=maskClientSecret(_0x1f3868);}return _0x3cfb53;})['then'](respondWithResult(_0x1c845e,null))[_0x8962('0x34')](handleError(_0x1c845e,null));};exports['create']=function(_0x1ee08b,_0xb3be6c){if(!_0x1ee08b[_0x8962('0x36')][_0x8962('0x14')])throw new Error(_0x8962('0x37'));if(!_0x1ee08b[_0x8962('0x36')][_0x8962('0x31')])throw new Error(_0x8962('0x38'));var _0x535771=db[_0x8962('0x19')][_0x8962('0x1a')][_0x8962('0x31')][_0x8962('0x39')];if(!_0x535771[_0x8962('0x3a')](_0x1ee08b[_0x8962('0x36')][_0x8962('0x31')]))throw new Error(_0x8962('0x3b')+_0x535771[_0x8962('0x3c')](',\x20'));if(_0x1ee08b['body'][_0x8962('0x31')]===_0x8962('0x32')&&_0x1ee08b[_0x8962('0x36')]['data3']){_0x1ee08b[_0x8962('0x36')][_0x8962('0x33')]=encryptor[_0x8962('0x3d')](_0x1ee08b[_0x8962('0x36')]['data3']);}return db[_0x8962('0x19')]['create'](_0x1ee08b['body'],{})[_0x8962('0x11')](respondWithResult(_0xb3be6c,0xc9))[_0x8962('0x34')](handleError(_0xb3be6c,null));};exports['update']=function(_0xfa2a01,_0x5e72c2){if(_0xfa2a01[_0x8962('0x36')]['id']){delete _0xfa2a01[_0x8962('0x36')]['id'];}return db['CloudProvider'][_0x8962('0x3e')]({'where':{'id':_0xfa2a01[_0x8962('0x3f')]['id']}})[_0x8962('0x11')](handleEntityNotFound(_0x5e72c2,null))[_0x8962('0x11')](function(_0x1b6c99){if(_0x1b6c99['service']===_0x8962('0x32')&&_0xfa2a01[_0x8962('0x36')][_0x8962('0x33')]){_0xfa2a01['body'][_0x8962('0x33')]=encryptor[_0x8962('0x3d')](_0xfa2a01['body'][_0x8962('0x33')]);}return _0x1b6c99;})[_0x8962('0x11')](saveUpdates(_0xfa2a01[_0x8962('0x36')],null))['then'](respondWithResult(_0x5e72c2,null))[_0x8962('0x34')](handleError(_0x5e72c2,null));};exports[_0x8962('0x40')]=function(_0x1e69b0,_0xeb6c8b){return db['CloudProvider'][_0x8962('0x3e')]({'where':{'id':_0x1e69b0[_0x8962('0x3f')]['id']}})['then'](handleEntityNotFound(_0xeb6c8b,null))[_0x8962('0x11')](removeEntity(_0xeb6c8b,null))[_0x8962('0x34')](handleError(_0xeb6c8b,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5be6c7,_0x6cd22f){return db['CloudProvider'][_0x8962('0x41')]({'where':{'id':_0x5be6c7[_0x8962('0x3f')]['id']},'raw':!![]})[_0x8962('0x11')](function(_0x2fa4ac){if(!_0x2fa4ac)return _0x6cd22f[_0x8962('0x12')](0x194);return{'url':oauth[_0x8962('0x42')](_0x2fa4ac,_0x5be6c7[_0x8962('0x43')]['id'])};})[_0x8962('0x11')](respondWithResult(_0x6cd22f,null))['catch'](handleError(_0x6cd22f,null));};exports[_0x8962('0x44')]=function(_0x3f8a1e,_0x2c4d10){var _0x4e28dc=_0x3f8a1e[_0x8962('0x36')];var _0x45b3d6;var _0x56b8a0;if(_0x4e28dc[_0x8962('0x13')])throw _0x4e28dc;redis[_0x8962('0x45')](_0x4e28dc[_0x8962('0x46')])[_0x8962('0x11')](function(_0x25f278){if(!_0x25f278)throw new Error(_0x8962('0x47'));_0x45b3d6=JSON[_0x8962('0x48')](_0x25f278);var _0x20d4ef=Buffer[_0x8962('0x49')](_0x4e28dc['state'],_0x8962('0x4a'))[_0x8962('0x4b')](_0x8962('0x4c'));_0x56b8a0=JSON[_0x8962('0x48')](_0x20d4ef);if(!oauth[_0x8962('0x4d')](_0x4e28dc[_0x8962('0x4e')],_0x45b3d6['oauth2Claims']))throw new Error(_0x8962('0x4f'));redis[_0x8962('0x50')](_0x4e28dc['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x4e28dc['code'],_0x45b3d6);})[_0x8962('0x11')](function(_0x10a93f){_0x45b3d6[_0x8962('0x51')]=_0x10a93f[_0x8962('0x52')];_0x45b3d6[_0x8962('0x53')]=_0x10a93f[_0x8962('0x54')];return db[_0x8962('0x19')][_0x8962('0x10')]({'data5':_0x45b3d6['data5'],'data6':_0x45b3d6[_0x8962('0x53')]},{'where':{'id':_0x45b3d6['id']}});})[_0x8962('0x11')](function(){oauth['startRefreshInterval'](_0x45b3d6);socket[_0x8962('0x55')]('microsoftAuthorization:success',{'id':_0x56b8a0['id']});return;})[_0x8962('0x11')](respondWithStatusCode(_0x2c4d10,null))['catch'](function(_0x41ed4c){if(_0x56b8a0){socket['emit'](_0x8962('0x56'),{'id':_0x56b8a0['id']});}if(!_0x45b3d6){logger[_0x8962('0x13')]('Invalid\x20authentication\x20state\x20parameter',_0x41ed4c);return _0x2c4d10[_0x8962('0x8')](0x1f4)[_0x8962('0x15')](_0x41ed4c[_0x8962('0x57')]);}logger[_0x8962('0x13')](_0x8962('0x58'),_0x45b3d6['id'],JSON['stringify'](_0x41ed4c));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e3fb442..bd8b068 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 _0x36e1=['path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x36e1,0x1ce));var _0x136e=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x36e1[_0x3299d1];return _0x44356e;};'use strict';var _=require('lodash');var util=require(_0x136e('0x0'));var logger=require(_0x136e('0x1'))(_0x136e('0x2'));var moment=require(_0x136e('0x3'));var BPromise=require(_0x136e('0x4'));var rp=require(_0x136e('0x5'));var fs=require('fs');var path=require(_0x136e('0x6'));var rimraf=require('rimraf');var config=require(_0x136e('0x7'));var attributes=require(_0x136e('0x8'));module[_0x136e('0x9')]=function(_0x537df9,_0x27c64a){return _0x537df9[_0x136e('0xa')](_0x136e('0xb'),attributes,{'tableName':_0x136e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36c0=['../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x8db64b,_0x40740b){var _0x2f3294=function(_0x4fd9ff){while(--_0x4fd9ff){_0x8db64b['push'](_0x8db64b['shift']());}};_0x2f3294(++_0x40740b);}(_0x36c0,0x1f1));var _0x036c=function(_0x52b671,_0x196334){_0x52b671=_0x52b671-0x0;var _0xd11aaa=_0x36c0[_0x52b671];return _0xd11aaa;};'use strict';var _=require(_0x036c('0x0'));var util=require('util');var logger=require(_0x036c('0x1'))(_0x036c('0x2'));var moment=require(_0x036c('0x3'));var BPromise=require(_0x036c('0x4'));var rp=require(_0x036c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x036c('0x6'));var config=require(_0x036c('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x036c('0x8')]=function(_0x4b628f,_0x52b6b6){return _0x4b628f[_0x036c('0x9')](_0x036c('0xa'),attributes,{'tableName':_0x036c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 2656d7e..5e5165a 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 _0xe103=['inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','redis','defaults','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push','data7','/.default','Outlook365','replace','data2','code','id_token','from','stringify','toString','base64','client_id','data1','join','response_mode','form_post','scope','nonce','login','value','oauth2Claims','oauth2/','set','payload','iss','issuer','aud','audience','unix','exp','resolve','findOne','then','data6','data4','decryptString','data3','{TENANT_ID}','data5','refresh_token','CloudProvider','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','POST','intervals','bind','findAll'];(function(_0x49b296,_0x3aa044){var _0x165565=function(_0x27cb18){while(--_0x27cb18){_0x49b296['push'](_0x49b296['shift']());}};_0x165565(++_0x3aa044);}(_0xe103,0x1bf));var _0x3e10=function(_0x4097e0,_0x4adf57){_0x4097e0=_0x4097e0-0x0;var _0x173af2=_0xe103[_0x4097e0];return _0x173af2;};'use strict';var _=require(_0x3e10('0x0'));var crypto=require(_0x3e10('0x1'));var jwt=require(_0x3e10('0x2'));var moment=require('moment');var Redis=require(_0x3e10('0x3'));var rp=require(_0x3e10('0x4'));var util=require(_0x3e10('0x5'));var encryptor=require(_0x3e10('0x6'));var config=require(_0x3e10('0x7'));var logger=require('../../config/logger')(_0x3e10('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x3e10('0x9')]=_[_0x3e10('0xa')](config[_0x3e10('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x3e10('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x3e10('0xb'),_0x3e10('0xc'),_0x3e10('0xd'),_0x3e10('0xe'),_0x3e10('0xf'),_0x3e10('0x10'),_0x3e10('0x11')],'Dynamics365':[_0x3e10('0xb'),_0x3e10('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0x3e10('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x50baf2){var _0x15a536=_[_0x3e10('0x13')](AZURE_AUTH_SCOPES[_0x50baf2[_0x3e10('0x14')]]);if(_0x50baf2[_0x3e10('0x14')]===_0x3e10('0x15'))_0x15a536[_0x3e10('0x16')](_0x50baf2[_0x3e10('0x17')]+_0x3e10('0x18'));return _0x15a536['join']('\x20');}function getAccessTokenScope(_0xaaf839){if(_0xaaf839['type']===_0x3e10('0x19'))return _0x3e10('0xf');if(_0xaaf839[_0x3e10('0x14')]===_0x3e10('0x15'))return _0xaaf839[_0x3e10('0x17')]+_0x3e10('0x18');}function generateMicrosoftAuthorizationUrl(_0x7e42ae,_0x127392){var _0x2360cd=MICROSOFT_AUTH_URL[_0x3e10('0x1a')]('{TENANT_ID}',_0x7e42ae[_0x3e10('0x1b')]);var _0x14841d=[_0x3e10('0x1c'),_0x3e10('0x1d')];var _0x1a5814=Buffer[_0x3e10('0x1e')](JSON[_0x3e10('0x1f')]({'id':_0x127392}))[_0x3e10('0x20')](_0x3e10('0x21'));var _0x1c1ad5=crypto['randomBytes'](0x10)[_0x3e10('0x20')]('hex');var _0x490d81=getAuthorizationScopes(_0x7e42ae);var _0x319e1b=[{'key':_0x3e10('0x22'),'value':_0x7e42ae[_0x3e10('0x23')]},{'key':'response_type','value':encodeURIComponent(_0x14841d[_0x3e10('0x24')]('\x20'))},{'key':'redirect_uri','value':_0x7e42ae['data4']},{'key':_0x3e10('0x25'),'value':_0x3e10('0x26')},{'key':_0x3e10('0x27'),'value':encodeURIComponent(_0x490d81)},{'key':'state','value':_0x1a5814},{'key':_0x3e10('0x28'),'value':_0x1c1ad5},{'key':'prompt','value':_0x3e10('0x29')}];var _0x1c89f9=_0x2360cd+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x319e1b,function(_0x30d321){return _0x30d321['key']+'='+_0x30d321[_0x3e10('0x2a')];})[_0x3e10('0x24')]('&');_0x7e42ae[_0x3e10('0x2b')]={'issuer':_0x2360cd[_0x3e10('0x1a')](_0x3e10('0x2c'),''),'audience':_0x7e42ae[_0x3e10('0x23')],'state':_0x1a5814,'nonce':_0x1c1ad5};redis[_0x3e10('0x2d')](_0x1a5814,JSON[_0x3e10('0x1f')](_0x7e42ae));return _0x1c89f9;}function isValidIdToken(_0x39d06b,_0x13fdb8){try{var _0x2fa650=jwt['decode'](_0x39d06b,{'complete':!![]});var _0x3e367a=_0x2fa650[_0x3e10('0x2e')];if(_0x3e367a[_0x3e10('0x2f')]!==_0x13fdb8[_0x3e10('0x30')])return![];if(_0x3e367a[_0x3e10('0x31')]!==_0x13fdb8[_0x3e10('0x32')])return![];if(_0x3e367a[_0x3e10('0x28')]!==_0x13fdb8[_0x3e10('0x28')])return![];if(moment()['isAfter'](moment[_0x3e10('0x33')](_0x3e367a[_0x3e10('0x34')])))return![];return!![];}catch(_0x47af04){throw _0x47af04;}}function refreshOauth2MicrosoftAccessToken(_0x3edf84){return Promise[_0x3e10('0x35')]()['then'](function(){if(_0x3edf84['data3'])return _0x3edf84;return db['CloudProvider'][_0x3e10('0x36')]({'where':{'id':_0x3edf84['id']},'raw':!![]});})[_0x3e10('0x37')](function(_0x294218){var _0x30438e={'grant_type':'refresh_token','refresh_token':_0x294218[_0x3e10('0x38')],'scope':getAccessTokenScope(_0x294218),'redirect_uri':_0x294218[_0x3e10('0x39')],'client_id':_0x294218[_0x3e10('0x23')],'client_secret':encryptor[_0x3e10('0x3a')](_0x294218[_0x3e10('0x3b')])};var _0x384830={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x3e10('0x1a')](_0x3e10('0x3c'),_0x294218[_0x3e10('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x30438e,'json':!![]};return rp(_0x384830);})[_0x3e10('0x37')](function(_0x3ea887){_0x3edf84[_0x3e10('0x3d')]=_0x3ea887['access_token'];_0x3edf84[_0x3e10('0x38')]=_0x3ea887[_0x3e10('0x3e')];return db[_0x3e10('0x3f')]['update']({'data5':_0x3edf84[_0x3e10('0x3d')],'data6':_0x3edf84[_0x3e10('0x38')]},{'where':{'id':_0x3edf84['id']}});})[_0x3e10('0x37')](function(){return _0x3edf84;})[_0x3e10('0x40')](function(_0x51dd95){logger[_0x3e10('0x41')](_0x3e10('0x42'),_0x3edf84['id'],_0x51dd95);});}function getOauth2MicrosoftAccessToken(_0x6642e,_0x2069dc){var _0x39aef7={'grant_type':'authorization_code','code':_0x6642e,'scope':getAccessTokenScope(_0x2069dc),'redirect_uri':_0x2069dc['data4'],'client_id':_0x2069dc[_0x3e10('0x23')],'client_secret':encryptor['decryptString'](_0x2069dc[_0x3e10('0x3b')])};var _0x59e584={'method':_0x3e10('0x43'),'uri':MICROSOFT_AUTH_URL[_0x3e10('0x1a')](_0x3e10('0x3c'),_0x2069dc['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x39aef7,'json':!![]};return rp(_0x59e584);}function startRefreshInterval(_0x221748){var _0x4afe82=schedule[_0x3e10('0x44')];if(_0x4afe82[_0x221748['id']])clearInterval(_0x4afe82[_0x221748['id']]);_0x4afe82[_0x221748['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3e10('0x45')](this,{'id':_0x221748['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4afe82;}function startAllRefreshIntervals(){return db[_0x3e10('0x3f')][_0x3e10('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x3e10('0x37')](function(_0x467001){var _0x56c65b=_0x467001[_0x3e10('0x13')](function(_0x3b76c8){return refreshOauth2MicrosoftAccessToken(_0x3b76c8)[_0x3e10('0x37')](function(_0x51fa6f){startRefreshInterval(_0x51fa6f);});});return Promise['all'](_0x56c65b);})[_0x3e10('0x40')](function(_0x5b3573){var _0x52ae4d=_0x5b3573?util[_0x3e10('0x47')](_0x5b3573,{'showHidden':![],'depth':null}):'';logger[_0x3e10('0x41')](_0x3e10('0x48'),_0x52ae4d);});}module[_0x3e10('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x9eb4=['stringify','base64','randomBytes','client_id','data1','response_type','redirect_uri','data4','form_post','state','nonce','prompt','login','key','value','oauth2/','set','payload','iss','issuer','aud','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','data3','POST','data5','access_token','update','catch','error','decryptString','bind','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','request-promise','util','../../components/encryptor','../../config/logger','api','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','join','/.default','replace','{TENANT_ID}','data2','code','id_token','from'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0x9eb4,0x10c));var _0x49eb=function(_0x5d71fb,_0x5b3f42){_0x5d71fb=_0x5d71fb-0x0;var _0x19bac8=_0x9eb4[_0x5d71fb];return _0x19bac8;};'use strict';var _=require(_0x49eb('0x0'));var crypto=require(_0x49eb('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x49eb('0x2'));var Redis=require('ioredis');var rp=require(_0x49eb('0x3'));var util=require(_0x49eb('0x4'));var encryptor=require(_0x49eb('0x5'));var config=require('../../config/environment');var logger=require(_0x49eb('0x6'))(_0x49eb('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x49eb('0x8'),'port':0x18eb});var redis=new Redis(config[_0x49eb('0x9')]);var MICROSOFT_AUTH_URL=_0x49eb('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x49eb('0xb'),_0x49eb('0xc'),_0x49eb('0xd'),'offline_access',_0x49eb('0xe'),_0x49eb('0xf'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x49eb('0xb'),_0x49eb('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x49eb('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x49eb('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5ad7cf){var _0x41c37f=_[_0x49eb('0x13')](AZURE_AUTH_SCOPES[_0x5ad7cf[_0x49eb('0x14')]]);if(_0x5ad7cf[_0x49eb('0x14')]===_0x49eb('0x15'))_0x41c37f[_0x49eb('0x16')](_0x5ad7cf[_0x49eb('0x17')]+'/.default');return _0x41c37f[_0x49eb('0x18')]('\x20');}function getAccessTokenScope(_0x106bcb){if(_0x106bcb[_0x49eb('0x14')]==='Outlook365')return _0x49eb('0xe');if(_0x106bcb['type']===_0x49eb('0x15'))return _0x106bcb[_0x49eb('0x17')]+_0x49eb('0x19');}function generateMicrosoftAuthorizationUrl(_0x5547e6,_0x4ba216){var _0x5c69c6=MICROSOFT_AUTH_URL[_0x49eb('0x1a')](_0x49eb('0x1b'),_0x5547e6[_0x49eb('0x1c')]);var _0x54f975=[_0x49eb('0x1d'),_0x49eb('0x1e')];var _0x283b47=Buffer[_0x49eb('0x1f')](JSON[_0x49eb('0x20')]({'id':_0x4ba216}))['toString'](_0x49eb('0x21'));var _0x4c5855=crypto[_0x49eb('0x22')](0x10)['toString']('hex');var _0x2306b1=getAuthorizationScopes(_0x5547e6);var _0x4cc225=[{'key':_0x49eb('0x23'),'value':_0x5547e6[_0x49eb('0x24')]},{'key':_0x49eb('0x25'),'value':encodeURIComponent(_0x54f975[_0x49eb('0x18')]('\x20'))},{'key':_0x49eb('0x26'),'value':_0x5547e6[_0x49eb('0x27')]},{'key':'response_mode','value':_0x49eb('0x28')},{'key':'scope','value':encodeURIComponent(_0x2306b1)},{'key':_0x49eb('0x29'),'value':_0x283b47},{'key':_0x49eb('0x2a'),'value':_0x4c5855},{'key':_0x49eb('0x2b'),'value':_0x49eb('0x2c')}];var _0x2ce352=_0x5c69c6+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x49eb('0x13')](_0x4cc225,function(_0x5ece1){return _0x5ece1[_0x49eb('0x2d')]+'='+_0x5ece1[_0x49eb('0x2e')];})[_0x49eb('0x18')]('&');_0x5547e6['oauth2Claims']={'issuer':_0x5c69c6['replace'](_0x49eb('0x2f'),''),'audience':_0x5547e6[_0x49eb('0x24')],'state':_0x283b47,'nonce':_0x4c5855};redis[_0x49eb('0x30')](_0x283b47,JSON[_0x49eb('0x20')](_0x5547e6));return _0x2ce352;}function isValidIdToken(_0x4618ce,_0x33041a){try{var _0x3d63eb=jwt['decode'](_0x4618ce,{'complete':!![]});var _0x2ae220=_0x3d63eb[_0x49eb('0x31')];if(_0x2ae220[_0x49eb('0x32')]!==_0x33041a[_0x49eb('0x33')])return![];if(_0x2ae220[_0x49eb('0x34')]!==_0x33041a['audience'])return![];if(_0x2ae220['nonce']!==_0x33041a[_0x49eb('0x2a')])return![];if(moment()[_0x49eb('0x35')](moment[_0x49eb('0x36')](_0x2ae220[_0x49eb('0x37')])))return![];return!![];}catch(_0x14481b){throw _0x14481b;}}function refreshOauth2MicrosoftAccessToken(_0x2d6980){return Promise[_0x49eb('0x38')]()[_0x49eb('0x39')](function(){if(_0x2d6980['data3'])return _0x2d6980;return db[_0x49eb('0x3a')][_0x49eb('0x3b')]({'where':{'id':_0x2d6980['id']},'raw':!![]});})[_0x49eb('0x39')](function(_0x3ffadc){var _0x527749={'grant_type':_0x49eb('0x3c'),'refresh_token':_0x3ffadc[_0x49eb('0x3d')],'scope':getAccessTokenScope(_0x3ffadc),'redirect_uri':_0x3ffadc['data4'],'client_id':_0x3ffadc['data1'],'client_secret':encryptor['decryptString'](_0x3ffadc[_0x49eb('0x3e')])};var _0x45f2a9={'method':_0x49eb('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0x49eb('0x1b'),_0x3ffadc[_0x49eb('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x527749,'json':!![]};return rp(_0x45f2a9);})[_0x49eb('0x39')](function(_0x2d3fbe){_0x2d6980[_0x49eb('0x40')]=_0x2d3fbe[_0x49eb('0x41')];_0x2d6980[_0x49eb('0x3d')]=_0x2d3fbe[_0x49eb('0x3c')];return db[_0x49eb('0x3a')][_0x49eb('0x42')]({'data5':_0x2d6980['data5'],'data6':_0x2d6980['data6']},{'where':{'id':_0x2d6980['id']}});})[_0x49eb('0x39')](function(){return _0x2d6980;})[_0x49eb('0x43')](function(_0x18586b){logger[_0x49eb('0x44')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x2d6980['id'],_0x18586b);});}function getOauth2MicrosoftAccessToken(_0x477e82,_0x2ab021){var _0x48db97={'grant_type':'authorization_code','code':_0x477e82,'scope':getAccessTokenScope(_0x2ab021),'redirect_uri':_0x2ab021['data4'],'client_id':_0x2ab021[_0x49eb('0x24')],'client_secret':encryptor[_0x49eb('0x45')](_0x2ab021['data3'])};var _0x37e7da={'method':_0x49eb('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x49eb('0x1a')](_0x49eb('0x1b'),_0x2ab021[_0x49eb('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x48db97,'json':!![]};return rp(_0x37e7da);}function startRefreshInterval(_0x4b5397){var _0x282cd2=schedule['intervals'];if(_0x282cd2[_0x4b5397['id']])clearInterval(_0x282cd2[_0x4b5397['id']]);_0x282cd2[_0x4b5397['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x49eb('0x46')](this,{'id':_0x4b5397['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x282cd2;}function startAllRefreshIntervals(){return db[_0x49eb('0x3a')][_0x49eb('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x45a34f){var _0x392b4c=_0x45a34f[_0x49eb('0x13')](function(_0x4ad412){return refreshOauth2MicrosoftAccessToken(_0x4ad412)['then'](function(_0x55b45f){startRefreshInterval(_0x55b45f);});});return Promise['all'](_0x392b4c);})[_0x49eb('0x43')](function(_0x52879d){var _0x3c1e10=_0x52879d?util[_0x49eb('0x48')](_0x52879d,{'showHidden':![],'depth':null}):'';logger[_0x49eb('0x44')](_0x49eb('0x49'),_0x3c1e10);});}module[_0x49eb('0x4a')]={'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 d029ca6..b718d40 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 _0x8969=['message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','stringify','error'];(function(_0x56aac6,_0x5bd6f0){var _0x448cb3=function(_0x5e6435){while(--_0x5e6435){_0x56aac6['push'](_0x56aac6['shift']());}};_0x448cb3(++_0x5bd6f0);}(_0x8969,0x130));var _0x9896=function(_0x77be8d,_0x179ae8){_0x77be8d=_0x77be8d-0x0;var _0xd7a234=_0x8969[_0x77be8d];return _0xd7a234;};'use strict';var _=require(_0x9896('0x0'));var util=require('util');var moment=require(_0x9896('0x1'));var BPromise=require(_0x9896('0x2'));var rs=require(_0x9896('0x3'));var fs=require('fs');var Redis=require(_0x9896('0x4'));var db=require(_0x9896('0x5'))['db'];var utils=require(_0x9896('0x6'));var logger=require(_0x9896('0x7'))('rpc');var config=require(_0x9896('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9896('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25ea98,_0x260577,_0x4c9c5c){return new BPromise(function(_0x1aa0d1,_0x281745){return client[_0x9896('0xa')](_0x25ea98,_0x4c9c5c)['then'](function(_0xbf6b82){logger[_0x9896('0xb')]('CloudProvider,\x20%s,\x20%s',_0x260577,_0x9896('0xc'));logger[_0x9896('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x260577,_0x9896('0xc'),JSON[_0x9896('0xe')](_0xbf6b82));if(_0xbf6b82[_0x9896('0xf')]){if(_0xbf6b82[_0x9896('0xf')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x260577,_0xbf6b82[_0x9896('0xf')][_0x9896('0x10')]);return _0x281745(_0xbf6b82[_0x9896('0xf')][_0x9896('0x10')]);}logger[_0x9896('0xf')](_0x9896('0x11'),_0x260577,_0xbf6b82[_0x9896('0xf')][_0x9896('0x10')]);return _0x1aa0d1(_0xbf6b82[_0x9896('0xf')][_0x9896('0x10')]);}else{logger['info'](_0x9896('0x11'),_0x260577,'request\x20sent');_0x1aa0d1(_0xbf6b82[_0x9896('0x12')][_0x9896('0x10')]);}})[_0x9896('0x13')](function(_0x42ccee){logger['error'](_0x9896('0x11'),_0x260577,_0x42ccee);_0x281745(_0x42ccee);});});} \ No newline at end of file +var _0x9f37=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1df3b9,_0x48cb63){var _0x3658d2=function(_0x139a05){while(--_0x139a05){_0x1df3b9['push'](_0x1df3b9['shift']());}};_0x3658d2(++_0x48cb63);}(_0x9f37,0xd1));var _0x79f3=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9f37[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require('moment');var BPromise=require(_0x79f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79f3('0x3'))['db'];var utils=require(_0x79f3('0x4'));var logger=require(_0x79f3('0x5'))('rpc');var config=require(_0x79f3('0x6'));var jayson=require(_0x79f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x171940,_0x42b440,_0x2ad818){return new BPromise(function(_0xe4ed49,_0x59efc6){return client[_0x79f3('0x8')](_0x171940,_0x2ad818)[_0x79f3('0x9')](function(_0x4b4562){logger[_0x79f3('0xa')](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));logger[_0x79f3('0xd')](_0x79f3('0xe'),_0x42b440,'request\x20sent',JSON[_0x79f3('0xf')](_0x4b4562));if(_0x4b4562[_0x79f3('0x10')]){if(_0x4b4562['error']['code']===0x1f4){logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0x59efc6(_0x4b4562['error'][_0x79f3('0x11')]);}logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0xe4ed49(_0x4b4562[_0x79f3('0x10')]['message']);}else{logger['info'](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));_0xe4ed49(_0x4b4562['result'][_0x79f3('0x11')]);}})[_0x79f3('0x12')](function(_0x23874b){logger[_0x79f3('0x10')]('CloudProvider,\x20%s,\x20%s',_0x42b440,_0x23874b);_0x59efc6(_0x23874b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d0ae793..8e05948 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44b0c0,_0x1e8a30){_0x44b0c0=_0x44b0c0-0x0;var _0x5b23dc=_0x5f2f[_0x44b0c0];return _0x5b23dc;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=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(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x1261,0x144));var _0x1126=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0x1261[_0x2bc8e0];return _0xca8f97;};'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 51ebff6..06519bd 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 _0x6117=['sequelize','name','STRING'];(function(_0x4798de,_0x12f3fd){var _0x332509=function(_0x4334db){while(--_0x4334db){_0x4798de['push'](_0x4798de['shift']());}};_0x332509(++_0x12f3fd);}(_0x6117,0x198));var _0x7611=function(_0x188494,_0x206afc){_0x188494=_0x188494-0x0;var _0x263e9e=_0x6117[_0x188494];return _0x263e9e;};'use strict';var Sequelize=require(_0x7611('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7611('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7611('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x7611('0x2')]},'phone':{'type':Sequelize[_0x7611('0x2')]},'fax':{'type':Sequelize[_0x7611('0x2')]},'type':{'type':Sequelize[_0x7611('0x2')]},'street':{'type':Sequelize[_0x7611('0x2')]},'postalCode':{'type':Sequelize[_0x7611('0x2')]},'city':{'type':Sequelize[_0x7611('0x2')]},'country':{'type':Sequelize[_0x7611('0x2')]},'email':{'type':Sequelize[_0x7611('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x7611('0x2')]},'sPostalCode':{'type':Sequelize[_0x7611('0x2')]},'sCity':{'type':Sequelize[_0x7611('0x2')]},'sCountry':{'type':Sequelize[_0x7611('0x2')]},'description':{'type':Sequelize[_0x7611('0x2')]}}; \ No newline at end of file +var _0x6325=['STRING','sequelize','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6325,0xe8));var _0x5632=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6325[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5632('0x0'));module[_0x5632('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5632('0x2')]},'companyId':{'type':Sequelize[_0x5632('0x2')]},'website':{'type':Sequelize[_0x5632('0x2')]},'phone':{'type':Sequelize[_0x5632('0x2')]},'fax':{'type':Sequelize[_0x5632('0x2')]},'type':{'type':Sequelize[_0x5632('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5632('0x2')]},'city':{'type':Sequelize[_0x5632('0x2')]},'country':{'type':Sequelize[_0x5632('0x2')]},'email':{'type':Sequelize[_0x5632('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x5632('0x2')]},'sPostalCode':{'type':Sequelize[_0x5632('0x2')]},'sCity':{'type':Sequelize[_0x5632('0x2')]},'sCountry':{'type':Sequelize[_0x5632('0x2')]},'description':{'type':Sequelize[_0x5632('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1306834..8906817 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 _0x817c=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','reject','save','update','then','get','Companies','destroy','error','stack','name','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','map','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','findOne','length','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x418589,_0x2e0dec){var _0x4ceb01=function(_0x90b963){while(--_0x90b963){_0x418589['push'](_0x418589['shift']());}};_0x4ceb01(++_0x2e0dec);}(_0x817c,0x14b));var _0xc817=function(_0xbf5bc8,_0x2192f4){_0xbf5bc8=_0xbf5bc8-0x0;var _0x5a43dd=_0x817c[_0xbf5bc8];return _0x5a43dd;};'use strict';var emlformat=require(_0xc817('0x0'));var rimraf=require(_0xc817('0x1'));var zipdir=require(_0xc817('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc817('0x3'));var moment=require(_0xc817('0x4'));var BPromise=require(_0xc817('0x5'));var Mustache=require(_0xc817('0x6'));var util=require(_0xc817('0x7'));var path=require(_0xc817('0x8'));var sox=require(_0xc817('0x9'));var csv=require(_0xc817('0xa'));var ejs=require(_0xc817('0xb'));var fs=require('fs');var fs_extra=require(_0xc817('0xc'));var _=require(_0xc817('0xd'));var squel=require('squel');var crypto=require(_0xc817('0xe'));var jsforce=require(_0xc817('0xf'));var deskjs=require(_0xc817('0x10'));var toCsv=require(_0xc817('0xa'));var querystring=require(_0xc817('0x11'));var Papa=require(_0xc817('0x12'));var Redis=require(_0xc817('0x13'));var authService=require(_0xc817('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc817('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc817('0x16'))(_0xc817('0x17'));var utils=require(_0xc817('0x18'));var config=require(_0xc817('0x19'));var licenseUtil=require(_0xc817('0x1a'));var db=require(_0xc817('0x1b'))['db'];function respondWithStatusCode(_0x403125,_0xab55a3){_0xab55a3=_0xab55a3||0xcc;return function(_0x348446){if(_0x348446){return _0x403125[_0xc817('0x1c')](_0xab55a3);}return _0x403125[_0xc817('0x1d')](_0xab55a3)[_0xc817('0x1e')]();};}function respondWithResult(_0x5daae6,_0xdee82e){_0xdee82e=_0xdee82e||0xc8;return function(_0x11f368){if(_0x11f368){return _0x5daae6[_0xc817('0x1d')](_0xdee82e)[_0xc817('0x1f')](_0x11f368);}};}function respondWithFilteredResult(_0xed2a6,_0x313cfb){return function(_0xaa1f75){if(_0xaa1f75){var _0xbcf47f=typeof _0x313cfb['offset']==='undefined'&&typeof _0x313cfb['limit']===_0xc817('0x20');var _0x5437bf=_0xaa1f75[_0xc817('0x21')];var _0xc8de94=_0xbcf47f?0x0:_0x313cfb[_0xc817('0x22')];var _0x5e6fcb=_0xbcf47f?_0xaa1f75[_0xc817('0x21')]:_0x313cfb[_0xc817('0x22')]+_0x313cfb[_0xc817('0x23')];var _0x46f0a7;if(_0x5e6fcb>=_0x5437bf){_0x5e6fcb=_0x5437bf;_0x46f0a7=0xc8;}else{_0x46f0a7=0xce;}_0xed2a6[_0xc817('0x1d')](_0x46f0a7);return _0xed2a6['set']('Content-Range',_0xc8de94+'-'+_0x5e6fcb+'/'+_0x5437bf)[_0xc817('0x1f')](_0xaa1f75);}return null;};}function patchUpdates(_0x1887b3){return function(_0x5f2586){try{jsonpatch['apply'](_0x5f2586,_0x1887b3,!![]);}catch(_0x5b86c7){return BPromise[_0xc817('0x24')](_0x5b86c7);}return _0x5f2586[_0xc817('0x25')]();};}function saveUpdates(_0xa1dbea,_0x47af6d){return function(_0xb113ca){if(_0xb113ca){return _0xb113ca[_0xc817('0x26')](_0xa1dbea)[_0xc817('0x27')](function(_0x2263ff){return _0x2263ff;});}return null;};}function removeEntity(_0x1ebc1d,_0x29fae7){return function(_0x8cea51){if(_0x8cea51){return _0x8cea51['destroy']()[_0xc817('0x27')](function(){var _0xc3ef7a=_0x8cea51[_0xc817('0x28')]({'plain':!![]});var _0x1ad80c=_0xc817('0x29');return db['UserProfileResource'][_0xc817('0x2a')]({'where':{'type':_0x1ad80c,'resourceId':_0xc3ef7a['id']}})[_0xc817('0x27')](function(){return _0x8cea51;});})[_0xc817('0x27')](function(){_0x1ebc1d[_0xc817('0x1d')](0xcc)[_0xc817('0x1e')]();});}};}function handleEntityNotFound(_0x5e0f3c,_0xc6a80e){return function(_0x35bbbf){if(!_0x35bbbf){_0x5e0f3c[_0xc817('0x1c')](0x194);}return _0x35bbbf;};}function handleError(_0x31c5b1,_0x586e48){_0x586e48=_0x586e48||0x1f4;return function(_0x3f6c63){logger[_0xc817('0x2b')](_0x3f6c63[_0xc817('0x2c')]);if(_0x3f6c63[_0xc817('0x2d')]){delete _0x3f6c63[_0xc817('0x2d')];}_0x31c5b1['status'](_0x586e48)['send'](_0x3f6c63);};}exports['index']=function(_0x3c24d4,_0x5ab636){var _0x1f1a48={},_0x2a466c={},_0x48ee8b={'count':0x0,'rows':[]};return db[_0xc817('0x2e')][_0xc817('0x2f')]()['then'](function(_0x559ee0){_0x2a466c[_0xc817('0x30')]=_[_0xc817('0x31')](_0x559ee0);_0x2a466c[_0xc817('0x32')]=_['keys'](_0x3c24d4['query']);_0x2a466c[_0xc817('0x33')]=_[_0xc817('0x34')](_0x2a466c[_0xc817('0x30')],_0x2a466c[_0xc817('0x32')]);_0x1f1a48['attributes']=_['intersection'](_0x2a466c[_0xc817('0x30')],qs[_0xc817('0x35')](_0x3c24d4['query'][_0xc817('0x35')]));_0x1f1a48[_0xc817('0x36')]=_0x1f1a48[_0xc817('0x36')]['length']?_0x1f1a48[_0xc817('0x36')]:_0x2a466c[_0xc817('0x30')];if(!_0x3c24d4[_0xc817('0x32')][_0xc817('0x37')](_0xc817('0x38'))){_0x1f1a48[_0xc817('0x23')]=qs[_0xc817('0x23')](_0x3c24d4[_0xc817('0x32')]['limit']);_0x1f1a48[_0xc817('0x22')]=qs[_0xc817('0x22')](_0x3c24d4[_0xc817('0x32')][_0xc817('0x22')]);}_0x1f1a48['order']=qs[_0xc817('0x39')](_0x3c24d4[_0xc817('0x32')]['sort']);_0x1f1a48[_0xc817('0x3a')]=qs[_0xc817('0x33')](_['pick'](_0x3c24d4['query'],_0x2a466c[_0xc817('0x33')]),_0x559ee0);if(_0x3c24d4[_0xc817('0x32')]['filter']){_0x1f1a48['where']=_[_0xc817('0x3b')](_0x1f1a48[_0xc817('0x3a')],{'$or':_[_0xc817('0x3c')](_0x1f1a48['attributes'],function(_0x2707de){var _0x3c4a55={};_0x3c4a55[_0x2707de]={'$like':'%'+_0x3c24d4[_0xc817('0x32')]['filter']+'%'};return _0x3c4a55;})});}_0x1f1a48=_[_0xc817('0x3b')]({},_0x1f1a48,_0x3c24d4['options']);var _0x58f01c={'where':_0x1f1a48[_0xc817('0x3a')]};return db[_0xc817('0x2e')][_0xc817('0x21')](_0x58f01c)[_0xc817('0x27')](function(_0x5a39ed){_0x48ee8b[_0xc817('0x21')]=_0x5a39ed;if(_0x3c24d4[_0xc817('0x32')][_0xc817('0x3d')]){_0x1f1a48[_0xc817('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0xc817('0x3f')](_0x1f1a48);})[_0xc817('0x27')](function(_0x2feed7){_0x48ee8b['rows']=_0x2feed7;return _0x48ee8b;})[_0xc817('0x27')](respondWithFilteredResult(_0x5ab636,_0x1f1a48))[_0xc817('0x40')](handleError(_0x5ab636,null));})[_0xc817('0x40')](handleError(_0x5ab636,null));};exports[_0xc817('0x41')]=function(_0x5b7d60,_0x5b648d){var _0x4b390b={'raw':![],'where':{'id':_0x5b7d60[_0xc817('0x42')]['id']}},_0xc2544c={};_0xc2544c['model']=_[_0xc817('0x31')](db[_0xc817('0x2e')][_0xc817('0x43')]);_0xc2544c[_0xc817('0x32')]=_[_0xc817('0x31')](_0x5b7d60[_0xc817('0x32')]);_0xc2544c[_0xc817('0x33')]=_[_0xc817('0x34')](_0xc2544c[_0xc817('0x30')],_0xc2544c['query']);_0x4b390b[_0xc817('0x36')]=_[_0xc817('0x34')](_0xc2544c[_0xc817('0x30')],qs[_0xc817('0x35')](_0x5b7d60[_0xc817('0x32')][_0xc817('0x35')]));_0x4b390b[_0xc817('0x36')]=_0x4b390b['attributes']['length']?_0x4b390b[_0xc817('0x36')]:_0xc2544c[_0xc817('0x30')];if(_0x5b7d60['query']['includeAll']){_0x4b390b['include']=[{'all':!![]}];}_0x4b390b=_[_0xc817('0x3b')]({},_0x4b390b,_0x5b7d60[_0xc817('0x44')]);return db[_0xc817('0x2e')][_0xc817('0x45')](_0x4b390b)['then'](handleEntityNotFound(_0x5b648d,null))[_0xc817('0x27')](respondWithResult(_0x5b648d,null))[_0xc817('0x40')](handleError(_0x5b648d,null));};exports['create']=function(_0x2fa994,_0xe9bcff){return db[_0xc817('0x2e')][_0xc817('0x46')](_0x2fa994[_0xc817('0x47')],{})[_0xc817('0x27')](function(_0x4f3766){var _0xb60c16=_0x2fa994[_0xc817('0x48')][_0xc817('0x28')]({'plain':!![]});if(!_0xb60c16)throw new Error(_0xc817('0x49'));if(_0xb60c16[_0xc817('0x4a')]===_0xc817('0x48')){var _0x589005=_0x4f3766['get']({'plain':!![]});var _0x2cb288='Companies';return db[_0xc817('0x4b')]['find']({'where':{'name':_0x2cb288,'userProfileId':_0xb60c16['userProfileId']},'raw':!![]})[_0xc817('0x27')](function(_0x5f3ca7){if(_0x5f3ca7&&_0x5f3ca7['autoAssociation']===0x0){return db[_0xc817('0x4c')]['create']({'name':_0x589005[_0xc817('0x2d')],'resourceId':_0x589005['id'],'type':_0x5f3ca7[_0xc817('0x2d')],'sectionId':_0x5f3ca7['id']},{})[_0xc817('0x27')](function(){return _0x4f3766;});}else{return _0x4f3766;}})[_0xc817('0x40')](function(_0x30565c){logger[_0xc817('0x2b')](_0xc817('0x4d'),_0x30565c);throw _0x30565c;});}return _0x4f3766;})[_0xc817('0x27')](respondWithResult(_0xe9bcff,0xc9))[_0xc817('0x40')](handleError(_0xe9bcff,null));};exports[_0xc817('0x26')]=function(_0x706bb5,_0x51cff2){if(_0x706bb5['body']['id']){delete _0x706bb5['body']['id'];}return db[_0xc817('0x2e')][_0xc817('0x45')]({'where':{'id':_0x706bb5[_0xc817('0x42')]['id']}})[_0xc817('0x27')](handleEntityNotFound(_0x51cff2,null))[_0xc817('0x27')](saveUpdates(_0x706bb5[_0xc817('0x47')],null))[_0xc817('0x27')](respondWithResult(_0x51cff2,null))[_0xc817('0x40')](handleError(_0x51cff2,null));};exports[_0xc817('0x2a')]=function(_0x40452f,_0x2152f8){return db[_0xc817('0x2e')][_0xc817('0x45')]({'where':{'id':_0x40452f[_0xc817('0x42')]['id']}})['then'](handleEntityNotFound(_0x2152f8,null))[_0xc817('0x27')](removeEntity(_0x2152f8,null))[_0xc817('0x40')](handleError(_0x2152f8,null));};exports[_0xc817('0x2f')]=function(_0x23b4ab,_0x2fa189){return db['CmCompany'][_0xc817('0x2f')]()['then'](respondWithResult(_0x2fa189,null))[_0xc817('0x40')](handleError(_0x2fa189,null));};exports[_0xc817('0x4e')]=function(_0x1724c2,_0x3e7f7f,_0x55346a){return db[_0xc817('0x4f')][_0xc817('0x45')]({'where':{'id':_0x1724c2[_0xc817('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e7f7f,null))[_0xc817('0x27')](function(_0x169ea7){if(_0x169ea7){return _0x169ea7[_0xc817('0x4e')](_0x1724c2[_0xc817('0x47')]['ids'],_[_0xc817('0x50')](_0x1724c2[_0xc817('0x47')],[_0xc817('0x51'),'id'])||{});}})[_0xc817('0x27')](respondWithResult(_0x3e7f7f,null))['catch'](handleError(_0x3e7f7f,null));};exports[_0xc817('0x52')]=function(_0x1bebf3,_0x521ec4,_0xf42658){var _0x4bac43={};var _0x4b7c1d={};var _0x964310;var _0x1fc7f7;return db[_0xc817('0x2e')][_0xc817('0x53')]({'where':{'id':_0x1bebf3[_0xc817('0x42')]['id']}})[_0xc817('0x27')](handleEntityNotFound(_0x521ec4,null))['then'](function(_0x1d9285){if(_0x1d9285){_0x964310=_0x1d9285;_0x4b7c1d['model']=_[_0xc817('0x31')](db[_0xc817('0x4f')][_0xc817('0x43')]);_0x4b7c1d[_0xc817('0x32')]=_['keys'](_0x1bebf3[_0xc817('0x32')]);_0x4b7c1d['filters']=_[_0xc817('0x34')](_0x4b7c1d[_0xc817('0x30')],_0x4b7c1d[_0xc817('0x32')]);_0x4bac43['attributes']=_[_0xc817('0x34')](_0x4b7c1d[_0xc817('0x30')],qs[_0xc817('0x35')](_0x1bebf3[_0xc817('0x32')][_0xc817('0x35')]));_0x4bac43[_0xc817('0x36')]=_0x4bac43[_0xc817('0x36')][_0xc817('0x54')]?_0x4bac43['attributes']:_0x4b7c1d[_0xc817('0x30')];_0x4bac43['order']=qs[_0xc817('0x39')](_0x1bebf3[_0xc817('0x32')][_0xc817('0x39')]);_0x4bac43['where']=qs['filters'](_['pick'](_0x1bebf3['query'],_0x4b7c1d['filters']));if(_0x1bebf3[_0xc817('0x32')][_0xc817('0x55')]){_0x4bac43['where']=_[_0xc817('0x3b')](_0x4bac43[_0xc817('0x3a')],{'$or':_[_0xc817('0x3c')](_0x4bac43[_0xc817('0x36')],function(_0x30d7b6){var _0xa75043={};_0xa75043[_0x30d7b6]={'$like':'%'+_0x1bebf3[_0xc817('0x32')][_0xc817('0x55')]+'%'};return _0xa75043;})});}_0x4bac43=_[_0xc817('0x3b')]({},_0x4bac43,_0x1bebf3[_0xc817('0x44')]);return _0x964310[_0xc817('0x52')](_0x4bac43);}})['then'](function(_0x4f95b2){if(_0x4f95b2){_0x1fc7f7=_0x4f95b2['length'];if(!_0x1bebf3[_0xc817('0x32')][_0xc817('0x37')]('nolimit')){_0x4bac43[_0xc817('0x23')]=qs[_0xc817('0x23')](_0x1bebf3[_0xc817('0x32')][_0xc817('0x23')]);_0x4bac43[_0xc817('0x22')]=qs['offset'](_0x1bebf3[_0xc817('0x32')][_0xc817('0x22')]);}return _0x964310['getContacts'](_0x4bac43);}})['then'](function(_0x2e8e59){if(_0x2e8e59){return _0x2e8e59?{'count':_0x1fc7f7,'rows':_0x2e8e59}:null;}})[_0xc817('0x27')](respondWithResult(_0x521ec4,null))[_0xc817('0x40')](handleError(_0x521ec4,null));}; \ No newline at end of file +var _0x2b51=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','error','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes'];(function(_0x5a1c5f,_0x1a6956){var _0x3eb42d=function(_0x9f708e){while(--_0x9f708e){_0x5a1c5f['push'](_0x5a1c5f['shift']());}};_0x3eb42d(++_0x1a6956);}(_0x2b51,0x77));var _0x12b5=function(_0x13588c,_0x289580){_0x13588c=_0x13588c-0x0;var _0x53a0d0=_0x2b51[_0x13588c];return _0x53a0d0;};'use strict';var emlformat=require(_0x12b5('0x0'));var rimraf=require(_0x12b5('0x1'));var zipdir=require(_0x12b5('0x2'));var jsonpatch=require(_0x12b5('0x3'));var rp=require(_0x12b5('0x4'));var moment=require(_0x12b5('0x5'));var BPromise=require(_0x12b5('0x6'));var Mustache=require(_0x12b5('0x7'));var util=require(_0x12b5('0x8'));var path=require(_0x12b5('0x9'));var sox=require(_0x12b5('0xa'));var csv=require('to-csv');var ejs=require(_0x12b5('0xb'));var fs=require('fs');var fs_extra=require(_0x12b5('0xc'));var _=require(_0x12b5('0xd'));var squel=require(_0x12b5('0xe'));var crypto=require(_0x12b5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x12b5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x12b5('0x11'));var Redis=require(_0x12b5('0x12'));var authService=require(_0x12b5('0x13'));var qs=require(_0x12b5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12b5('0x15'));var logger=require('../../config/logger')(_0x12b5('0x16'));var utils=require('../../config/utils');var config=require(_0x12b5('0x17'));var licenseUtil=require(_0x12b5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f23dc,_0x222f38){_0x222f38=_0x222f38||0xcc;return function(_0x5bf8dd){if(_0x5bf8dd){return _0x4f23dc['sendStatus'](_0x222f38);}return _0x4f23dc[_0x12b5('0x19')](_0x222f38)[_0x12b5('0x1a')]();};}function respondWithResult(_0x1fc2f9,_0x2e46e5){_0x2e46e5=_0x2e46e5||0xc8;return function(_0x392129){if(_0x392129){return _0x1fc2f9[_0x12b5('0x19')](_0x2e46e5)['json'](_0x392129);}};}function respondWithFilteredResult(_0x5652f9,_0x184117){return function(_0x1a5aa9){if(_0x1a5aa9){var _0x25fed1=typeof _0x184117[_0x12b5('0x1b')]===_0x12b5('0x1c')&&typeof _0x184117[_0x12b5('0x1d')]==='undefined';var _0x48a7dd=_0x1a5aa9['count'];var _0x7a8f71=_0x25fed1?0x0:_0x184117[_0x12b5('0x1b')];var _0x52e2b2=_0x25fed1?_0x1a5aa9[_0x12b5('0x1e')]:_0x184117[_0x12b5('0x1b')]+_0x184117['limit'];var _0x1cf4d0;if(_0x52e2b2>=_0x48a7dd){_0x52e2b2=_0x48a7dd;_0x1cf4d0=0xc8;}else{_0x1cf4d0=0xce;}_0x5652f9[_0x12b5('0x19')](_0x1cf4d0);return _0x5652f9['set'](_0x12b5('0x1f'),_0x7a8f71+'-'+_0x52e2b2+'/'+_0x48a7dd)[_0x12b5('0x20')](_0x1a5aa9);}return null;};}function patchUpdates(_0x3f520c){return function(_0x295fcf){try{jsonpatch[_0x12b5('0x21')](_0x295fcf,_0x3f520c,!![]);}catch(_0x1465f8){return BPromise['reject'](_0x1465f8);}return _0x295fcf[_0x12b5('0x22')]();};}function saveUpdates(_0x3f2065,_0x595ecf){return function(_0x239190){if(_0x239190){return _0x239190[_0x12b5('0x23')](_0x3f2065)[_0x12b5('0x24')](function(_0x2fdc35){return _0x2fdc35;});}return null;};}function removeEntity(_0x2600e8,_0x49d39e){return function(_0x1a8acc){if(_0x1a8acc){return _0x1a8acc[_0x12b5('0x25')]()[_0x12b5('0x24')](function(){var _0x516009=_0x1a8acc[_0x12b5('0x26')]({'plain':!![]});var _0x2582cb=_0x12b5('0x27');return db[_0x12b5('0x28')][_0x12b5('0x25')]({'where':{'type':_0x2582cb,'resourceId':_0x516009['id']}})['then'](function(){return _0x1a8acc;});})[_0x12b5('0x24')](function(){_0x2600e8[_0x12b5('0x19')](0xcc)[_0x12b5('0x1a')]();});}};}function handleEntityNotFound(_0x2a75ac,_0x2ebd48){return function(_0x3b3882){if(!_0x3b3882){_0x2a75ac[_0x12b5('0x29')](0x194);}return _0x3b3882;};}function handleError(_0x4cb6ed,_0x2d3d42){_0x2d3d42=_0x2d3d42||0x1f4;return function(_0x265c85){logger[_0x12b5('0x2a')](_0x265c85['stack']);if(_0x265c85[_0x12b5('0x2b')]){delete _0x265c85[_0x12b5('0x2b')];}_0x4cb6ed[_0x12b5('0x19')](_0x2d3d42)[_0x12b5('0x2c')](_0x265c85);};}exports['index']=function(_0x4d490e,_0x920a7a){var _0x2d4509={},_0x6349c={},_0x2d309e={'count':0x0,'rows':[]};return db[_0x12b5('0x2d')][_0x12b5('0x2e')]()[_0x12b5('0x24')](function(_0xa4b7f8){_0x6349c[_0x12b5('0x2f')]=_[_0x12b5('0x30')](_0xa4b7f8);_0x6349c[_0x12b5('0x31')]=_[_0x12b5('0x30')](_0x4d490e[_0x12b5('0x31')]);_0x6349c[_0x12b5('0x32')]=_[_0x12b5('0x33')](_0x6349c['model'],_0x6349c[_0x12b5('0x31')]);_0x2d4509[_0x12b5('0x34')]=_['intersection'](_0x6349c[_0x12b5('0x2f')],qs['fields'](_0x4d490e['query'][_0x12b5('0x35')]));_0x2d4509['attributes']=_0x2d4509[_0x12b5('0x34')][_0x12b5('0x36')]?_0x2d4509[_0x12b5('0x34')]:_0x6349c[_0x12b5('0x2f')];if(!_0x4d490e['query'][_0x12b5('0x37')](_0x12b5('0x38'))){_0x2d4509[_0x12b5('0x1d')]=qs[_0x12b5('0x1d')](_0x4d490e[_0x12b5('0x31')][_0x12b5('0x1d')]);_0x2d4509[_0x12b5('0x1b')]=qs[_0x12b5('0x1b')](_0x4d490e[_0x12b5('0x31')]['offset']);}_0x2d4509[_0x12b5('0x39')]=qs[_0x12b5('0x3a')](_0x4d490e[_0x12b5('0x31')][_0x12b5('0x3a')]);_0x2d4509[_0x12b5('0x3b')]=qs['filters'](_[_0x12b5('0x3c')](_0x4d490e[_0x12b5('0x31')],_0x6349c[_0x12b5('0x32')]),_0xa4b7f8);if(_0x4d490e[_0x12b5('0x31')]['filter']){_0x2d4509[_0x12b5('0x3b')]=_[_0x12b5('0x3d')](_0x2d4509[_0x12b5('0x3b')],{'$or':_[_0x12b5('0x3e')](_0x2d4509[_0x12b5('0x34')],function(_0x411183){var _0x3c768d={};_0x3c768d[_0x411183]={'$like':'%'+_0x4d490e[_0x12b5('0x31')][_0x12b5('0x3f')]+'%'};return _0x3c768d;})});}_0x2d4509=_[_0x12b5('0x3d')]({},_0x2d4509,_0x4d490e['options']);var _0x1ff4ed={'where':_0x2d4509[_0x12b5('0x3b')]};return db['CmCompany'][_0x12b5('0x1e')](_0x1ff4ed)['then'](function(_0x2393da){_0x2d309e[_0x12b5('0x1e')]=_0x2393da;if(_0x4d490e[_0x12b5('0x31')][_0x12b5('0x40')]){_0x2d4509[_0x12b5('0x41')]=[{'all':!![]}];}return db[_0x12b5('0x2d')][_0x12b5('0x42')](_0x2d4509);})[_0x12b5('0x24')](function(_0x2c20c2){_0x2d309e[_0x12b5('0x43')]=_0x2c20c2;return _0x2d309e;})[_0x12b5('0x24')](respondWithFilteredResult(_0x920a7a,_0x2d4509))[_0x12b5('0x44')](handleError(_0x920a7a,null));})[_0x12b5('0x44')](handleError(_0x920a7a,null));};exports[_0x12b5('0x45')]=function(_0x570ab5,_0x2e0226){var _0xf507ff={'raw':![],'where':{'id':_0x570ab5[_0x12b5('0x46')]['id']}},_0x4cd890={};_0x4cd890['model']=_[_0x12b5('0x30')](db['CmCompany'][_0x12b5('0x47')]);_0x4cd890[_0x12b5('0x31')]=_[_0x12b5('0x30')](_0x570ab5[_0x12b5('0x31')]);_0x4cd890[_0x12b5('0x32')]=_[_0x12b5('0x33')](_0x4cd890[_0x12b5('0x2f')],_0x4cd890['query']);_0xf507ff[_0x12b5('0x34')]=_['intersection'](_0x4cd890[_0x12b5('0x2f')],qs[_0x12b5('0x35')](_0x570ab5[_0x12b5('0x31')][_0x12b5('0x35')]));_0xf507ff['attributes']=_0xf507ff[_0x12b5('0x34')][_0x12b5('0x36')]?_0xf507ff['attributes']:_0x4cd890['model'];if(_0x570ab5[_0x12b5('0x31')][_0x12b5('0x40')]){_0xf507ff[_0x12b5('0x41')]=[{'all':!![]}];}_0xf507ff=_[_0x12b5('0x3d')]({},_0xf507ff,_0x570ab5[_0x12b5('0x48')]);return db[_0x12b5('0x2d')][_0x12b5('0x49')](_0xf507ff)[_0x12b5('0x24')](handleEntityNotFound(_0x2e0226,null))[_0x12b5('0x24')](respondWithResult(_0x2e0226,null))[_0x12b5('0x44')](handleError(_0x2e0226,null));};exports[_0x12b5('0x4a')]=function(_0x5696f7,_0xb288b4){return db[_0x12b5('0x2d')][_0x12b5('0x4a')](_0x5696f7[_0x12b5('0x4b')],{})['then'](function(_0xe5ad36){var _0x2b6ad1=_0x5696f7['user']['get']({'plain':!![]});if(!_0x2b6ad1)throw new Error(_0x12b5('0x4c'));if(_0x2b6ad1[_0x12b5('0x4d')]===_0x12b5('0x4e')){var _0x565c47=_0xe5ad36['get']({'plain':!![]});var _0x4f150a=_0x12b5('0x27');return db[_0x12b5('0x4f')][_0x12b5('0x49')]({'where':{'name':_0x4f150a,'userProfileId':_0x2b6ad1['userProfileId']},'raw':!![]})[_0x12b5('0x24')](function(_0x205d87){if(_0x205d87&&_0x205d87['autoAssociation']===0x0){return db[_0x12b5('0x28')][_0x12b5('0x4a')]({'name':_0x565c47['name'],'resourceId':_0x565c47['id'],'type':_0x205d87[_0x12b5('0x2b')],'sectionId':_0x205d87['id']},{})[_0x12b5('0x24')](function(){return _0xe5ad36;});}else{return _0xe5ad36;}})[_0x12b5('0x44')](function(_0x5ea551){logger[_0x12b5('0x2a')](_0x12b5('0x50'),_0x5ea551);throw _0x5ea551;});}return _0xe5ad36;})[_0x12b5('0x24')](respondWithResult(_0xb288b4,0xc9))[_0x12b5('0x44')](handleError(_0xb288b4,null));};exports[_0x12b5('0x23')]=function(_0x4d092b,_0x581da4){if(_0x4d092b['body']['id']){delete _0x4d092b['body']['id'];}return db[_0x12b5('0x2d')][_0x12b5('0x49')]({'where':{'id':_0x4d092b[_0x12b5('0x46')]['id']}})['then'](handleEntityNotFound(_0x581da4,null))[_0x12b5('0x24')](saveUpdates(_0x4d092b[_0x12b5('0x4b')],null))[_0x12b5('0x24')](respondWithResult(_0x581da4,null))[_0x12b5('0x44')](handleError(_0x581da4,null));};exports[_0x12b5('0x25')]=function(_0x20e3db,_0x4629a3){return db['CmCompany'][_0x12b5('0x49')]({'where':{'id':_0x20e3db[_0x12b5('0x46')]['id']}})[_0x12b5('0x24')](handleEntityNotFound(_0x4629a3,null))[_0x12b5('0x24')](removeEntity(_0x4629a3,null))[_0x12b5('0x44')](handleError(_0x4629a3,null));};exports[_0x12b5('0x2e')]=function(_0x22ab87,_0x315920){return db[_0x12b5('0x2d')][_0x12b5('0x2e')]()[_0x12b5('0x24')](respondWithResult(_0x315920,null))[_0x12b5('0x44')](handleError(_0x315920,null));};exports[_0x12b5('0x51')]=function(_0x575015,_0x103510,_0x4aa60e){return db[_0x12b5('0x52')][_0x12b5('0x49')]({'where':{'id':_0x575015[_0x12b5('0x46')]['id']}})[_0x12b5('0x24')](handleEntityNotFound(_0x103510,null))[_0x12b5('0x24')](function(_0x3b8e29){if(_0x3b8e29){return _0x3b8e29[_0x12b5('0x51')](_0x575015[_0x12b5('0x4b')][_0x12b5('0x53')],_[_0x12b5('0x54')](_0x575015[_0x12b5('0x4b')],[_0x12b5('0x53'),'id'])||{});}})[_0x12b5('0x24')](respondWithResult(_0x103510,null))[_0x12b5('0x44')](handleError(_0x103510,null));};exports['getContacts']=function(_0x5ed1ed,_0x154462,_0x1a9c6b){var _0x341ece={};var _0x5723d1={};var _0x33cbc8;var _0x450d19;return db['CmCompany']['findOne']({'where':{'id':_0x5ed1ed[_0x12b5('0x46')]['id']}})[_0x12b5('0x24')](handleEntityNotFound(_0x154462,null))[_0x12b5('0x24')](function(_0x160e33){if(_0x160e33){_0x33cbc8=_0x160e33;_0x5723d1['model']=_[_0x12b5('0x30')](db['CmContact'][_0x12b5('0x47')]);_0x5723d1[_0x12b5('0x31')]=_[_0x12b5('0x30')](_0x5ed1ed[_0x12b5('0x31')]);_0x5723d1[_0x12b5('0x32')]=_['intersection'](_0x5723d1['model'],_0x5723d1[_0x12b5('0x31')]);_0x341ece['attributes']=_[_0x12b5('0x33')](_0x5723d1[_0x12b5('0x2f')],qs['fields'](_0x5ed1ed[_0x12b5('0x31')][_0x12b5('0x35')]));_0x341ece[_0x12b5('0x34')]=_0x341ece[_0x12b5('0x34')][_0x12b5('0x36')]?_0x341ece[_0x12b5('0x34')]:_0x5723d1[_0x12b5('0x2f')];_0x341ece['order']=qs[_0x12b5('0x3a')](_0x5ed1ed['query'][_0x12b5('0x3a')]);_0x341ece[_0x12b5('0x3b')]=qs[_0x12b5('0x32')](_[_0x12b5('0x3c')](_0x5ed1ed[_0x12b5('0x31')],_0x5723d1[_0x12b5('0x32')]));if(_0x5ed1ed[_0x12b5('0x31')][_0x12b5('0x3f')]){_0x341ece[_0x12b5('0x3b')]=_['merge'](_0x341ece[_0x12b5('0x3b')],{'$or':_['map'](_0x341ece[_0x12b5('0x34')],function(_0x3572d4){var _0x358e79={};_0x358e79[_0x3572d4]={'$like':'%'+_0x5ed1ed[_0x12b5('0x31')][_0x12b5('0x3f')]+'%'};return _0x358e79;})});}_0x341ece=_[_0x12b5('0x3d')]({},_0x341ece,_0x5ed1ed[_0x12b5('0x48')]);return _0x33cbc8[_0x12b5('0x55')](_0x341ece);}})[_0x12b5('0x24')](function(_0x12ac83){if(_0x12ac83){_0x450d19=_0x12ac83[_0x12b5('0x36')];if(!_0x5ed1ed[_0x12b5('0x31')][_0x12b5('0x37')](_0x12b5('0x38'))){_0x341ece[_0x12b5('0x1d')]=qs['limit'](_0x5ed1ed[_0x12b5('0x31')][_0x12b5('0x1d')]);_0x341ece[_0x12b5('0x1b')]=qs[_0x12b5('0x1b')](_0x5ed1ed[_0x12b5('0x31')][_0x12b5('0x1b')]);}return _0x33cbc8[_0x12b5('0x55')](_0x341ece);}})['then'](function(_0xad0b92){if(_0xad0b92){return _0xad0b92?{'count':_0x450d19,'rows':_0xad0b92}:null;}})[_0x12b5('0x24')](respondWithResult(_0x154462,null))[_0x12b5('0x44')](handleError(_0x154462,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 1a0f96e..8ab1770 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 _0xe47d=['define','CmCompany','cm_companies','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe47d,0x1ef));var _0xde47=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xe47d[_0x441563];return _0x2369ec;};'use strict';var _=require(_0xde47('0x0'));var util=require(_0xde47('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde47('0x2'));var BPromise=require(_0xde47('0x3'));var rp=require(_0xde47('0x4'));var fs=require('fs');var path=require(_0xde47('0x5'));var rimraf=require(_0xde47('0x6'));var config=require(_0xde47('0x7'));var attributes=require(_0xde47('0x8'));module['exports']=function(_0x77b9d4,_0x3f303f){return _0x77b9d4[_0xde47('0x9')](_0xde47('0xa'),attributes,{'tableName':_0xde47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5145=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x5145,0xa6));var _0x5514=function(_0x631ef9,_0x331e41){_0x631ef9=_0x631ef9-0x0;var _0x2f94ee=_0x5145[_0x631ef9];return _0x2f94ee;};'use strict';var _=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var logger=require(_0x5514('0x2'))(_0x5514('0x3'));var moment=require(_0x5514('0x4'));var BPromise=require(_0x5514('0x5'));var rp=require(_0x5514('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5514('0x7'));var config=require(_0x5514('0x8'));var attributes=require('./cmCompany.attributes');module[_0x5514('0x9')]=function(_0x128dbf,_0x5e8c20){return _0x128dbf[_0x5514('0xa')](_0x5514('0xb'),attributes,{'tableName':_0x5514('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 2bac59e..e7fb890 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 _0x0b17=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','info'];(function(_0x2ada99,_0x4ea2aa){var _0x5447e5=function(_0x1d25eb){while(--_0x1d25eb){_0x2ada99['push'](_0x2ada99['shift']());}};_0x5447e5(++_0x4ea2aa);}(_0x0b17,0x1d7));var _0x70b1=function(_0xddce13,_0x2957df){_0xddce13=_0xddce13-0x0;var _0x3c1580=_0x0b17[_0xddce13];return _0x3c1580;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x70b1('0x0'));var BPromise=require(_0x70b1('0x1'));var rs=require(_0x70b1('0x2'));var fs=require('fs');var Redis=require(_0x70b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x70b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x70b1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x70b1('0x6')][_0x70b1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x81253,_0xab81dc,_0x46095d){return new BPromise(function(_0x21bba1,_0x457bea){return client['request'](_0x81253,_0x46095d)['then'](function(_0x1ee7ef){logger[_0x70b1('0x8')](_0x70b1('0x9'),_0xab81dc,_0x70b1('0xa'));logger[_0x70b1('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xab81dc,'request\x20sent',JSON[_0x70b1('0xc')](_0x1ee7ef));if(_0x1ee7ef[_0x70b1('0xd')]){if(_0x1ee7ef[_0x70b1('0xd')][_0x70b1('0xe')]===0x1f4){logger[_0x70b1('0xd')](_0x70b1('0x9'),_0xab81dc,_0x1ee7ef['error'][_0x70b1('0xf')]);return _0x457bea(_0x1ee7ef[_0x70b1('0xd')][_0x70b1('0xf')]);}logger[_0x70b1('0xd')](_0x70b1('0x9'),_0xab81dc,_0x1ee7ef[_0x70b1('0xd')][_0x70b1('0xf')]);return _0x21bba1(_0x1ee7ef[_0x70b1('0xd')]['message']);}else{logger[_0x70b1('0x8')](_0x70b1('0x9'),_0xab81dc,_0x70b1('0xa'));_0x21bba1(_0x1ee7ef['result']['message']);}})['catch'](function(_0x2e200d){logger[_0x70b1('0xd')](_0x70b1('0x9'),_0xab81dc,_0x2e200d);_0x457bea(_0x2e200d);});});} \ No newline at end of file +var _0x7acf=['request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x112ab2,_0x235720){var _0x50eee9=function(_0xe09408){while(--_0xe09408){_0x112ab2['push'](_0x112ab2['shift']());}};_0x50eee9(++_0x235720);}(_0x7acf,0xad));var _0xf7ac=function(_0x2a11e9,_0x42b447){_0x2a11e9=_0x2a11e9-0x0;var _0x3b340b=_0x7acf[_0x2a11e9];return _0x3b340b;};'use strict';var _=require(_0xf7ac('0x0'));var util=require('util');var moment=require(_0xf7ac('0x1'));var BPromise=require(_0xf7ac('0x2'));var rs=require(_0xf7ac('0x3'));var fs=require('fs');var Redis=require(_0xf7ac('0x4'));var db=require(_0xf7ac('0x5'))['db'];var utils=require(_0xf7ac('0x6'));var logger=require(_0xf7ac('0x7'))(_0xf7ac('0x8'));var config=require(_0xf7ac('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd81622,_0x589b8a,_0x195998){return new BPromise(function(_0x57a751,_0x4d21a6){return client[_0xf7ac('0xb')](_0xd81622,_0x195998)[_0xf7ac('0xc')](function(_0x643b8){logger[_0xf7ac('0xd')]('CmCompany,\x20%s,\x20%s',_0x589b8a,_0xf7ac('0xe'));logger[_0xf7ac('0xf')](_0xf7ac('0x10'),_0x589b8a,_0xf7ac('0xe'),JSON[_0xf7ac('0x11')](_0x643b8));if(_0x643b8[_0xf7ac('0x12')]){if(_0x643b8[_0xf7ac('0x12')][_0xf7ac('0x13')]===0x1f4){logger[_0xf7ac('0x12')](_0xf7ac('0x14'),_0x589b8a,_0x643b8[_0xf7ac('0x12')][_0xf7ac('0x15')]);return _0x4d21a6(_0x643b8[_0xf7ac('0x12')][_0xf7ac('0x15')]);}logger[_0xf7ac('0x12')]('CmCompany,\x20%s,\x20%s',_0x589b8a,_0x643b8['error'][_0xf7ac('0x15')]);return _0x57a751(_0x643b8[_0xf7ac('0x12')][_0xf7ac('0x15')]);}else{logger['info'](_0xf7ac('0x14'),_0x589b8a,'request\x20sent');_0x57a751(_0x643b8[_0xf7ac('0x16')][_0xf7ac('0x15')]);}})['catch'](function(_0x396cac){logger['error'](_0xf7ac('0x14'),_0x589b8a,_0x396cac);_0x4d21a6(_0x396cac);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 134e186..9b05a74 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 _0xeff8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','post','addContacts','/:id','update','delete','exports','multer','util','connect-timeout'];(function(_0xd955e9,_0x5054b5){var _0x2d852b=function(_0x1fa61f){while(--_0x1fa61f){_0xd955e9['push'](_0xd955e9['shift']());}};_0x2d852b(++_0x5054b5);}(_0xeff8,0x195));var _0x8eff=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xeff8[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require(_0x8eff('0x5'));var auth=require(_0x8eff('0x6'));var interaction=require(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var controller=require(_0x8eff('0x9'));router[_0x8eff('0xa')]('/',auth[_0x8eff('0xb')](),controller[_0x8eff('0xc')]);router[_0x8eff('0xa')](_0x8eff('0xd'),auth[_0x8eff('0xb')](),controller[_0x8eff('0xe')]);router[_0x8eff('0xa')]('/:id',auth[_0x8eff('0xb')](),controller[_0x8eff('0xf')]);router['get'](_0x8eff('0x10'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x11')]);router[_0x8eff('0x12')]('/',auth[_0x8eff('0xb')](),controller['create']);router['post']('/:id/contacts',auth[_0x8eff('0xb')](),controller[_0x8eff('0x13')]);router['put'](_0x8eff('0x14'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x15')]);router[_0x8eff('0x16')](_0x8eff('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x8eff('0x17')]=router; \ No newline at end of file +var _0x292c=['exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/contacts','getContacts','create','post','addContacts','put','delete','destroy'];(function(_0x5811c5,_0x3e5521){var _0x223fa7=function(_0x5d89c5){while(--_0x5d89c5){_0x5811c5['push'](_0x5811c5['shift']());}};_0x223fa7(++_0x3e5521);}(_0x292c,0x17d));var _0xc292=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x292c[_0x2053ea];return _0x2232c4;};'use strict';var multer=require('multer');var util=require(_0xc292('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc292('0x1'));var router=express['Router']();var fs_extra=require(_0xc292('0x2'));var auth=require(_0xc292('0x3'));var interaction=require(_0xc292('0x4'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xc292('0x5')]('/',auth[_0xc292('0x6')](),controller[_0xc292('0x7')]);router[_0xc292('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xc292('0x8')]);router['get'](_0xc292('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xc292('0xa'),auth['isAuthenticated'](),controller[_0xc292('0xb')]);router['post']('/',auth[_0xc292('0x6')](),controller[_0xc292('0xc')]);router[_0xc292('0xd')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xc292('0xe')]);router[_0xc292('0xf')](_0xc292('0x9'),auth[_0xc292('0x6')](),controller['update']);router[_0xc292('0x10')](_0xc292('0x9'),auth[_0xc292('0x6')](),controller[_0xc292('0x11')]);module[_0xc292('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 50b49ba..7834543 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 _0x3b38=['UNSIGNED','NOW','exports','STRING','TEXT','INTEGER'];(function(_0x2698c5,_0x4877fe){var _0x2182aa=function(_0x4d715d){while(--_0x4d715d){_0x2698c5['push'](_0x2698c5['shift']());}};_0x2182aa(++_0x4877fe);}(_0x3b38,0x1b2));var _0x83b3=function(_0x3082f8,_0x4ace4c){_0x3082f8=_0x3082f8-0x0;var _0x2d9587=_0x3b38[_0x3082f8];return _0x2d9587;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x83b3('0x0')]={'firstName':{'type':Sequelize[_0x83b3('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x83b3('0x1')]},'postalCode':{'type':Sequelize[_0x83b3('0x1')]},'city':{'type':Sequelize[_0x83b3('0x1')]},'country':{'type':Sequelize[_0x83b3('0x1')]},'dateOfBirth':{'type':Sequelize[_0x83b3('0x1')]},'description':{'type':Sequelize[_0x83b3('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x83b3('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x83b3('0x1')]},'url':{'type':Sequelize[_0x83b3('0x1')]},'facebook':{'type':Sequelize[_0x83b3('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x83b3('0x1')]},'skype':{'type':Sequelize[_0x83b3('0x1')]},'teams':{'type':Sequelize[_0x83b3('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x83b3('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x83b3('0x3')](0x2)[_0x83b3('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x83b3('0x5')]},'dialTimezone':{'type':Sequelize[_0x83b3('0x1')]},'utcOffset':{'type':Sequelize[_0x83b3('0x3')]}}; \ No newline at end of file +var _0xbaff=['lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0xbaff,0xd0));var _0xfbaf=function(_0x2f3688,_0x222e83){_0x2f3688=_0x2f3688-0x0;var _0x57a3d9=_0xbaff[_0x2f3688];return _0x57a3d9;};'use strict';var _=require(_0xfbaf('0x0'));var Sequelize=require(_0xfbaf('0x1'));module[_0xfbaf('0x2')]={'firstName':{'type':Sequelize[_0xfbaf('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xfbaf('0x3')]},'city':{'type':Sequelize[_0xfbaf('0x3')]},'country':{'type':Sequelize[_0xfbaf('0x3')]},'dateOfBirth':{'type':Sequelize[_0xfbaf('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xfbaf('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfbaf('0x3')]},'email':{'type':Sequelize[_0xfbaf('0x3')]},'url':{'type':Sequelize[_0xfbaf('0x3')]},'facebook':{'type':Sequelize[_0xfbaf('0x3')]},'fb_data':{'type':Sequelize[_0xfbaf('0x3')]},'twitter':{'type':Sequelize[_0xfbaf('0x3')]},'skype':{'type':Sequelize[_0xfbaf('0x3')]},'teams':{'type':Sequelize[_0xfbaf('0x3')]},'viber':{'type':Sequelize[_0xfbaf('0x3')]},'line':{'type':Sequelize[_0xfbaf('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xfbaf('0x3')]},'UserId':{'type':Sequelize[_0xfbaf('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xfbaf('0x3')]},'priority':{'type':Sequelize[_0xfbaf('0x4')](0x2)[_0xfbaf('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':Sequelize[_0xfbaf('0x7')]},'dialTimezone':{'type':Sequelize[_0xfbaf('0x3')]},'utcOffset':{'type':Sequelize[_0xfbaf('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 822ddc9..81c7a00 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(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_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 145fd22..8937857 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 _0xeb9b=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact'];(function(_0x46811f,_0xd5c65d){var _0x79ead4=function(_0x2decd6){while(--_0x2decd6){_0x46811f['push'](_0x46811f['shift']());}};_0x79ead4(++_0xd5c65d);}(_0xeb9b,0x15d));var _0xbeb9=function(_0x5710db,_0x410db1){_0x5710db=_0x5710db-0x0;var _0xee92e=_0xeb9b[_0x5710db];return _0xee92e;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xbeb9('0x0'))['db'][_0xbeb9('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbeb9('0x2'),'afterUpdate':_0xbeb9('0x3'),'afterDestroy':_0xbeb9('0x4')};function emitEvent(_0x708f0c){return function(_0x56ac13,_0x54b30e,_0x50c72e){CmContactEvents[_0xbeb9('0x5')](_0x708f0c+':'+_0x56ac13['id'],_0x56ac13);CmContactEvents[_0xbeb9('0x5')](_0x708f0c,_0x56ac13);_0x50c72e(null);};}for(var e in events){if(events[_0xbeb9('0x6')](e)){var event=events[e];CmContact[_0xbeb9('0x7')](e,emitEvent(event));}}module[_0xbeb9('0x8')]=CmContactEvents; \ No newline at end of file +var _0x881e=['exports','events','../../mysqldb','CmContact','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4a3559,_0x42c32e){var _0xd8982e=function(_0x324cc2){while(--_0x324cc2){_0x4a3559['push'](_0x4a3559['shift']());}};_0xd8982e(++_0x42c32e);}(_0x881e,0x145));var _0xe881=function(_0x457d00,_0x445222){_0x457d00=_0x457d00-0x0;var _0x16b0b5=_0x881e[_0x457d00];return _0x16b0b5;};'use strict';var EventEmitter=require(_0xe881('0x0'));var CmContact=require(_0xe881('0x1'))['db'][_0xe881('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xe881('0x3')](0x0);var events={'afterCreate':_0xe881('0x4'),'afterUpdate':'update','afterDestroy':_0xe881('0x5')};function emitEvent(_0xba5a8b){return function(_0x28ec86,_0x163575,_0x32421c){CmContactEvents[_0xe881('0x6')](_0xba5a8b+':'+_0x28ec86['id'],_0x28ec86);CmContactEvents[_0xe881('0x6')](_0xba5a8b,_0x28ec86);_0x32421c(null);};}for(var e in events){if(events[_0xe881('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xe881('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index f8b2f70..d94e7e8 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 _0x91a2=['dialTimezone','timezones','scheduledat','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','Campaign','utcOffset','\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','VoiceQueue','findAll','outbound','Lists','length','get','dialCheckDuplicateType','onlyIfOpen','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','cmContact','afterCreate','inspect','format','YYYY-MM-DD\x20HH:mm:ss','isNil','findOne','then'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x91a2,0x18b));var _0x291a=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x91a2[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0x291a('0x0'));var util=require(_0x291a('0x1'));var logger=require('../../config/logger')(_0x291a('0x2'));var moment=require(_0x291a('0x3'));var BPromise=require(_0x291a('0x4'));var rp=require(_0x291a('0x5'));var fs=require('fs');var path=require(_0x291a('0x6'));var rimraf=require(_0x291a('0x7'));var config=require('../../config/environment');var shared=require(_0x291a('0x8'));var attributes=require(_0x291a('0x9'));module[_0x291a('0xa')]=function(_0x25168d,_0x158360){return _0x25168d[_0x291a('0xb')](_0x291a('0xc'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x291a('0xd'),'fields':[_0x291a('0xd')]},{'name':_0x291a('0xe'),'fields':[_0x291a('0xf'),_0x291a('0x10'),_0x291a('0xd'),_0x291a('0x11'),'fax','email'],'type':_0x291a('0x12')}],'timestamps':!![],'charset':_0x291a('0x13'),'collate':_0x291a('0x14'),'hooks':{'afterCreate':function(_0x25973a,_0x671ebe,_0x5476c7){var _0x4daf95=_0x25168d[_0x291a('0x15')];var _0xaac31d=_0x25973a['get']({'plain':!![]});function _0x52b251(){return function(_0x36d020){logger[_0x291a('0x16')](_0x291a('0x17'),_0x291a('0x18'),util[_0x291a('0x19')](_0x36d020,{'showHidden':![],'depth':null}));};}function _0x8e5754(_0x2431e5,_0x497931){var _0x19c53d=_0x497931['scheduledat']?_0x497931['scheduledat']:moment()[_0x291a('0x1a')](_0x291a('0x1b'));return new BPromise(function(_0xabf17e,_0x4965b0){if(_[_0x291a('0x1c')](_0x497931['dialTimezone'])){_0xabf17e({'ret':_0x19c53d});}else{_0x4daf95['VoiceQueue'][_0x291a('0x1d')]({'where':{'id':_0x2431e5['id']}})[_0x291a('0x1e')](function(_0x116b3b){if(!_[_0x291a('0x1c')](_0x116b3b)){var _0x355906=_0x116b3b[_0x291a('0x1f')];if(!_[_0x291a('0x1c')](_0x355906)){var _0xe1dd1b=shared[_0x291a('0x20')];var _0x5d08ab=_0xe1dd1b[_0x355906];var _0x457f5c=_0xe1dd1b[_0x497931[_0x291a('0x1f')]];if(!_['isNil'](_0x5d08ab)&&!_[_0x291a('0x1c')](_0x457f5c)){var _0x5ce770=_0x5d08ab['utcOffset']-_0x457f5c['utcOffset'];_0x19c53d=_0x497931['scheduledat']?_0x497931[_0x291a('0x21')]:moment();var _0x2c6b94=moment(_0x19c53d)[_0x291a('0x22')](_0x5ce770,_0x291a('0x23'));_0xabf17e({'ret':_0x2c6b94[_0x291a('0x1a')](_0x291a('0x1b'))});}else _0xabf17e({'ret':_0x19c53d});}else _0xabf17e({'ret':_0x19c53d});}else{_0xabf17e({'ret':_0x19c53d});}});}});return 0xa;}var _0x5ca4fd=function(_0x232adc){return new BPromise(function(_0x29516a,_0x662752){_0x8e5754(_0x232adc,_0xaac31d)[_0x291a('0x1e')](function(_0x1c2e3f){_0xaac31d[_0x291a('0x21')]=_0x1c2e3f['ret'];_0x4daf95[_0x291a('0x24')][_0x291a('0x1d')]({'where':{'phone':_0xaac31d['phone'],'VoiceQueueId':_0x232adc['id']}})['then'](function(_0x116f72){if(!_[_0x291a('0x1c')](_0x116f72)){throw new Error(_0x291a('0x25')+_0xaac31d['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x232adc['id']);}return _0x4daf95['CmHopper']['create']({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d[_0x291a('0x26')],'priority':_0xaac31d[_0x291a('0x27')]?_0xaac31d[_0x291a('0x27')]:0x2,'scheduledat':_0xaac31d[_0x291a('0x21')]?_0xaac31d[_0x291a('0x21')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xaac31d[_0x291a('0x28')]?!![]:![],'callbackuniqueid':_0xaac31d[_0x291a('0x28')]?_0xaac31d[_0x291a('0x28')]:undefined,'callbackat':_0xaac31d[_0x291a('0x28')]?moment()[_0x291a('0x1a')](_0x291a('0x1b')):undefined,'VoiceQueueId':_0x232adc['id']});})[_0x291a('0x29')](function(_0x5d5b45){_0x662752(_0x5d5b45);});});});};var _0x44d341=function(_0x551aeb){return new BPromise(function(_0x1cf293,_0x10ee9a){_0x8e5754(_0x551aeb,_0xaac31d)['then'](function(_0x2ac35f){_0xaac31d[_0x291a('0x21')]=_0x2ac35f[_0x291a('0x2a')];_0x4daf95[_0x291a('0x24')]['findOne']({'where':{'phone':_0xaac31d['phone'],'VoiceQueueId':_0x551aeb['id']}})[_0x291a('0x1e')](function(_0xe45d0b){if(!_[_0x291a('0x1c')](_0xe45d0b)){throw new Error(_0x291a('0x25')+_0xaac31d['phone']+_0x291a('0x2b')+_0x551aeb['id']);}return _0x4daf95['CmHopperFinal'][_0x291a('0x1d')]({'where':{'calleridnum':_0xaac31d[_0x291a('0xd')],'VoiceQueueId':_0x551aeb['id']}});})[_0x291a('0x1e')](function(_0x48789f){if(!_[_0x291a('0x1c')](_0x48789f)){throw new Error(_0x291a('0x2c')+_0xaac31d[_0x291a('0xd')]+_0x291a('0x2d')+_0x551aeb['id']);}return _0x4daf95[_0x291a('0x24')][_0x291a('0x2e')]({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d[_0x291a('0x26')],'priority':_0xaac31d[_0x291a('0x27')]?_0xaac31d[_0x291a('0x27')]:0x2,'scheduledat':_0xaac31d[_0x291a('0x21')]?_0xaac31d[_0x291a('0x21')]:moment()['format'](_0x291a('0x1b')),'callback':_0xaac31d[_0x291a('0x28')]?!![]:![],'callbackuniqueid':_0xaac31d[_0x291a('0x28')]?_0xaac31d[_0x291a('0x28')]:undefined,'callbackat':_0xaac31d['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x551aeb['id']});})[_0x291a('0x29')](function(_0x17ed21){_0x10ee9a(_0x17ed21);});});});};function _0xa94410(){return function(_0x5bb441){logger[_0x291a('0x16')]('cmContact',_0x291a('0x18'),util[_0x291a('0x19')](_0x5bb441,{'showHidden':![],'depth':null}));};}function _0x5cb773(_0x2291ea,_0x24e133){var _0x5cb019=_0x24e133[_0x291a('0x21')]?_0x24e133[_0x291a('0x21')]:moment()[_0x291a('0x1a')](_0x291a('0x1b'));return new BPromise(function(_0x44e2bd,_0x32dec6){if(_[_0x291a('0x1c')](_0x24e133[_0x291a('0x1f')])){_0x44e2bd({'ret':_0x5cb019});}else{_0x4daf95[_0x291a('0x2f')]['findOne']({'where':{'id':_0x2291ea['id']}})[_0x291a('0x1e')](function(_0x5870b3){if(!_[_0x291a('0x1c')](_0x5870b3)){var _0x4a98ed=_0x5870b3[_0x291a('0x1f')];if(!_['isNil'](_0x4a98ed)){var _0x4924ca=shared['timezones'];var _0x5e9011=_0x4924ca[_0x4a98ed];var _0x5b917b=_0x4924ca[_0x24e133['dialTimezone']];if(!_[_0x291a('0x1c')](_0x5e9011)&&!_[_0x291a('0x1c')](_0x5b917b)){var _0x51922c=_0x5e9011['utcOffset']-_0x5b917b[_0x291a('0x30')];_0x5cb019=_0x24e133[_0x291a('0x21')]?_0x24e133[_0x291a('0x21')]:moment();var _0x2bf9bf=moment(_0x5cb019)[_0x291a('0x22')](_0x51922c,_0x291a('0x23'));_0x44e2bd({'ret':_0x2bf9bf[_0x291a('0x1a')](_0x291a('0x1b'))});}else _0x44e2bd({'ret':_0x5cb019});}else _0x44e2bd({'ret':_0x5cb019});}else{_0x44e2bd({'ret':_0x5cb019});}});}});return 0xa;}var _0x180974=function(_0xcdaed0){return new BPromise(function(_0x56170d,_0x19795c){_0x5cb773(_0xcdaed0,_0xaac31d)[_0x291a('0x1e')](function(_0x5512fa){_0xaac31d[_0x291a('0x21')]=_0x5512fa['ret'];_0x4daf95[_0x291a('0x24')][_0x291a('0x1d')]({'where':{'phone':_0xaac31d[_0x291a('0xd')],'CampaignId':_0xcdaed0['id']}})[_0x291a('0x1e')](function(_0x5b6bb3){if(!_['isNil'](_0x5b6bb3)){throw new Error(_0x291a('0x25')+_0xaac31d[_0x291a('0xd')]+_0x291a('0x31')+_0xcdaed0['id']);}return _0x4daf95['CmHopper'][_0x291a('0x2e')]({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d[_0x291a('0x26')],'priority':_0xaac31d[_0x291a('0x27')]?_0xaac31d[_0x291a('0x27')]:0x2,'scheduledat':_0xaac31d[_0x291a('0x21')]?_0xaac31d[_0x291a('0x21')]:moment()[_0x291a('0x1a')](_0x291a('0x1b')),'callback':_0xaac31d[_0x291a('0x28')]?!![]:![],'callbackuniqueid':_0xaac31d[_0x291a('0x28')]?_0xaac31d['callbackUniqueid']:undefined,'callbackat':_0xaac31d[_0x291a('0x28')]?moment()[_0x291a('0x1a')](_0x291a('0x1b')):undefined,'CampaignId':_0xcdaed0['id']});})[_0x291a('0x29')](function(_0x3a96c4){_0x19795c(_0x3a96c4);});});});};var _0x304fc0=function(_0xa5326e){return new BPromise(function(_0x1f6831,_0x4b20c){_0x5cb773(_0xa5326e,_0xaac31d)[_0x291a('0x1e')](function(_0x4df161){_0xaac31d[_0x291a('0x21')]=_0x4df161[_0x291a('0x2a')];_0x4daf95[_0x291a('0x24')][_0x291a('0x1d')]({'where':{'phone':_0xaac31d[_0x291a('0xd')],'CampaignId':_0xa5326e['id']}})[_0x291a('0x1e')](function(_0x4658be){if(!_[_0x291a('0x1c')](_0x4658be)){throw new Error(_0x291a('0x25')+_0xaac31d[_0x291a('0xd')]+_0x291a('0x32')+_0xa5326e['id']);}return _0x4daf95['CmHopperFinal']['findOne']({'where':{'calleridnum':_0xaac31d[_0x291a('0xd')],'CampaignId':_0xa5326e['id']}});})[_0x291a('0x1e')](function(_0x820aea){if(!_[_0x291a('0x1c')](_0x820aea)){throw new Error(_0x291a('0x2c')+_0xaac31d[_0x291a('0xd')]+_0x291a('0x33')+_0xa5326e['id']);}return _0x4daf95[_0x291a('0x24')][_0x291a('0x2e')]({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d['ListId'],'priority':_0xaac31d[_0x291a('0x27')]?_0xaac31d[_0x291a('0x27')]:0x2,'scheduledat':_0xaac31d[_0x291a('0x21')]?_0xaac31d[_0x291a('0x21')]:moment()[_0x291a('0x1a')](_0x291a('0x1b')),'callback':_0xaac31d[_0x291a('0x28')]?!![]:![],'callbackuniqueid':_0xaac31d[_0x291a('0x28')]?_0xaac31d[_0x291a('0x28')]:undefined,'callbackat':_0xaac31d[_0x291a('0x28')]?moment()[_0x291a('0x1a')](_0x291a('0x1b')):undefined,'CampaignId':_0xa5326e['id']});})['catch'](function(_0x5a5ef1){_0x4b20c(_0x5a5ef1);});});});};if(_0xaac31d[_0x291a('0x26')]){_0x4daf95[_0x291a('0x34')][_0x291a('0x35')]({'where':{'type':_0x291a('0x36')},'attributes':['id','dialCheckDuplicateType',_0x291a('0x1f')],'include':[{'model':_0x4daf95['CmList'],'as':_0x291a('0x37'),'where':{'id':_0xaac31d['ListId']}}]})[_0x291a('0x1e')](function(_0x3cc762){if(_0x3cc762){var _0x3c596e=[];for(var _0x5c34ba=0x0,_0x5b7de3;_0x5c34ba<_0x3cc762[_0x291a('0x38')];_0x5c34ba+=0x1){_0x5b7de3=_0x3cc762[_0x5c34ba][_0x291a('0x39')]({'plain':!![]});switch(_0x5b7de3[_0x291a('0x3a')]){case'always':_0x44d341(_0x5b7de3)[_0x291a('0x29')](_0x52b251());break;case _0x291a('0x3b'):_0x5ca4fd(_0x5b7de3)['catch'](_0x52b251());break;default:_0x5cb773(_0x5b7de3,_0xaac31d)[_0x291a('0x1e')](function(_0x44a2c3){_0xaac31d[_0x291a('0x21')]=_0x44a2c3['ret'];_0x4daf95['CmHopper'][_0x291a('0x2e')]({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d[_0x291a('0x26')],'scheduledat':_0xaac31d['scheduledat']?_0xaac31d[_0x291a('0x21')]:moment()['format'](_0x291a('0x1b')),'priority':_0xaac31d[_0x291a('0x27')]?_0xaac31d[_0x291a('0x27')]:0x2,'callback':_0xaac31d[_0x291a('0x28')]?!![]:![],'callbackuniqueid':_0xaac31d[_0x291a('0x28')]?_0xaac31d[_0x291a('0x28')]:undefined,'callbackat':_0xaac31d[_0x291a('0x28')]?moment()[_0x291a('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5b7de3['id']})[_0x291a('0x29')](_0x52b251());});}}}})[_0x291a('0x1e')](function(){return _0x4daf95[_0x291a('0x34')][_0x291a('0x35')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x4daf95[_0x291a('0x3c')],'as':_0x291a('0x3d'),'where':{'id':_0xaac31d[_0x291a('0x26')]}}]})['then'](function(_0x44fedd){if(_0x44fedd){var _0x320df2=[];for(var _0x4295fe=0x0,_0xe91566;_0x4295fe<_0x44fedd['length'];_0x4295fe+=0x1){_0xe91566=_0x44fedd[_0x4295fe][_0x291a('0x39')]({'plain':!![]});_0x4daf95[_0x291a('0x3e')][_0x291a('0x2e')]({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d['ListId'],'VoiceQueueId':_0xe91566['id']})[_0x291a('0x29')](function(_0x1ed429){logger[_0x291a('0x16')](_0x291a('0x3f'),_0x291a('0x18'),_0x1ed429[_0x291a('0x40')]);});}}});})[_0x291a('0x1e')](function(){return _0x4daf95[_0x291a('0x2f')][_0x291a('0x35')]({'attributes':['id',_0x291a('0x3a'),'dialTimezone'],'include':[{'model':_0x4daf95[_0x291a('0x3c')],'as':_0x291a('0x37'),'where':{'id':_0xaac31d['ListId']}}]})[_0x291a('0x1e')](function(_0x48a377){if(_0x48a377){var _0x2a2cca=[];for(var _0x569e65=0x0,_0x5a8763;_0x569e65<_0x48a377[_0x291a('0x38')];_0x569e65+=0x1){_0x5a8763=_0x48a377[_0x569e65][_0x291a('0x39')]({'plain':!![]});switch(_0x5a8763['dialCheckDuplicateType']){case'always':_0x304fc0(_0x5a8763)[_0x291a('0x29')](_0xa94410());break;case'onlyIfOpen':_0x180974(_0x5a8763)[_0x291a('0x29')](_0xa94410());break;default:_0x4daf95[_0x291a('0x24')][_0x291a('0x2e')]({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d['ListId'],'scheduledat':_0xaac31d[_0x291a('0x21')]?_0xaac31d[_0x291a('0x21')]:moment()[_0x291a('0x1a')](_0x291a('0x1b')),'priority':_0xaac31d['priority']?_0xaac31d[_0x291a('0x27')]:0x2,'callback':_0xaac31d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xaac31d[_0x291a('0x28')]?_0xaac31d[_0x291a('0x28')]:undefined,'callbackat':_0xaac31d[_0x291a('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5a8763['id']})['catch'](_0xa94410());}}}});})[_0x291a('0x1e')](function(){return _0x4daf95[_0x291a('0x2f')][_0x291a('0x35')]({'attributes':['id'],'include':[{'model':_0x4daf95[_0x291a('0x3c')],'as':_0x291a('0x3d'),'where':{'id':_0xaac31d['ListId']}}]})[_0x291a('0x1e')](function(_0x205812){if(_0x205812){var _0x464288=[];for(var _0x5a2eb9=0x0,_0x12f794;_0x5a2eb9<_0x205812[_0x291a('0x38')];_0x5a2eb9+=0x1){_0x12f794=_0x205812[_0x5a2eb9]['get']({'plain':!![]});_0x4daf95[_0x291a('0x3e')]['create']({'phone':_0xaac31d[_0x291a('0xd')],'ContactId':_0xaac31d['id'],'ListId':_0xaac31d[_0x291a('0x26')],'CampaignId':_0x12f794['id']})[_0x291a('0x29')](function(_0x57664f){logger['error'](_0x291a('0x3f'),_0x291a('0x18'),_0x57664f[_0x291a('0x40')]);});}}});})[_0x291a('0x1e')](function(){_0x5476c7();})[_0x291a('0x29')](function(_0x23c1fd){logger['error'](_0x291a('0x3f'),_0x291a('0x18'),_0x23c1fd[_0x291a('0x40')]);_0x5476c7(_0x23c1fd);});}else{_0x5476c7(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x3be686,_0x51e85c,_0x53afdf){var _0x2a400e=_0x25168d[_0x291a('0x15')];var _0x3f5721=_0x3be686[_0x291a('0x39')]({'plain':!![]});return _0x2a400e[_0x291a('0x24')][_0x291a('0x35')]({'raw':!![],'where':{'ListId':_0x3f5721[_0x291a('0x26')],'ContactId':_0x3f5721['id']}})[_0x291a('0x1e')](function(_0x23b964){if(!_['isEmpty'](_0x23b964)){var _0x26af9c=[];for(var _0x3ca8a3=0x0;_0x3ca8a3<_0x23b964[_0x291a('0x38')];_0x3ca8a3+=0x1){var _0x2c4495=_0x2a400e[_0x291a('0x24')]['destroy']({'where':{'ListId':_0x23b964[_0x3ca8a3][_0x291a('0x26')],'ContactId':_0x23b964[_0x3ca8a3][_0x291a('0x41')],'VoiceQueueId':_0x23b964[_0x3ca8a3]['VoiceQueueId'],'CampaignId':_0x23b964[_0x3ca8a3][_0x291a('0x42')]}});_0x26af9c[_0x291a('0x43')](_0x2c4495);}return BPromise['all'](_0x26af9c);}})[_0x291a('0x1e')](function(_0x177f18){logger[_0x291a('0x44')](_0x291a('0x45'),util[_0x291a('0x19')](_0x177f18,{'showHidden':![],'depth':null}));_0x53afdf();})[_0x291a('0x29')](function(_0x13615b){logger[_0x291a('0x16')](_0x291a('0x46'),util[_0x291a('0x19')](_0x13615b,{'showHidden':![],'depth':null}));_0x53afdf(_0x13615b);});}}});}; \ No newline at end of file +var _0x6100=['minutes','YYYY-MM-DD\x20HH:mm:ss','then','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','format','catch','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ret','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Campaign','dialCheckDuplicateType','always','message','List\x20not\x20found','models','isEmpty','destroy','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','path','rimraf','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','isNil','VoiceQueue','findOne','dialTimezone','timezones','utcOffset'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x6100,0x1cc));var _0x0610=function(_0x7de119,_0x411a89){_0x7de119=_0x7de119-0x0;var _0x1be026=_0x6100[_0x7de119];return _0x1be026;};'use strict';var _=require(_0x0610('0x0'));var util=require(_0x0610('0x1'));var logger=require(_0x0610('0x2'))(_0x0610('0x3'));var moment=require('moment');var BPromise=require(_0x0610('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0610('0x5'));var rimraf=require(_0x0610('0x6'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module['exports']=function(_0x5a7d83,_0xcb0edb){return _0x5a7d83[_0x0610('0x7')](_0x0610('0x8'),attributes,{'tableName':_0x0610('0x9'),'paranoid':!![],'indexes':[{'name':_0x0610('0xa'),'fields':[_0x0610('0xa')]},{'name':_0x0610('0xb'),'fields':[_0x0610('0xc'),_0x0610('0xd'),_0x0610('0xa'),'mobile','fax',_0x0610('0xe')],'type':_0x0610('0xf')}],'timestamps':!![],'charset':_0x0610('0x10'),'collate':_0x0610('0x11'),'hooks':{'afterCreate':function(_0x3c2a32,_0x13d423,_0x3c3648){var _0x3459f1=_0x5a7d83['models'];var _0x4ccb03=_0x3c2a32[_0x0610('0x12')]({'plain':!![]});function _0x305d6f(){return function(_0x9771e7){logger[_0x0610('0x13')](_0x0610('0x14'),_0x0610('0x15'),util[_0x0610('0x16')](_0x9771e7,{'showHidden':![],'depth':null}));};}function _0x423e7a(_0x5785b8,_0x391e70){var _0x4b7111=_0x391e70[_0x0610('0x17')]?_0x391e70[_0x0610('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x367060,_0x14515f){if(_[_0x0610('0x18')](_0x391e70['dialTimezone'])){_0x367060({'ret':_0x4b7111});}else{_0x3459f1[_0x0610('0x19')][_0x0610('0x1a')]({'where':{'id':_0x5785b8['id']}})['then'](function(_0x5e3cbe){if(!_[_0x0610('0x18')](_0x5e3cbe)){var _0x4bf843=_0x5e3cbe[_0x0610('0x1b')];if(!_[_0x0610('0x18')](_0x4bf843)){var _0x19aa7d=shared[_0x0610('0x1c')];var _0x547382=_0x19aa7d[_0x4bf843];var _0x454bcb=_0x19aa7d[_0x391e70['dialTimezone']];if(!_[_0x0610('0x18')](_0x547382)&&!_[_0x0610('0x18')](_0x454bcb)){var _0x40ecd9=_0x547382[_0x0610('0x1d')]-_0x454bcb[_0x0610('0x1d')];_0x4b7111=_0x391e70[_0x0610('0x17')]?_0x391e70[_0x0610('0x17')]:moment();var _0xb09ee8=moment(_0x4b7111)['add'](_0x40ecd9,_0x0610('0x1e'));_0x367060({'ret':_0xb09ee8['format'](_0x0610('0x1f'))});}else _0x367060({'ret':_0x4b7111});}else _0x367060({'ret':_0x4b7111});}else{_0x367060({'ret':_0x4b7111});}});}});return 0xa;}var _0x41dbbd=function(_0x166fc8){return new BPromise(function(_0xde670,_0x2fc5cd){_0x423e7a(_0x166fc8,_0x4ccb03)[_0x0610('0x20')](function(_0x80531e){_0x4ccb03[_0x0610('0x17')]=_0x80531e['ret'];_0x3459f1[_0x0610('0x21')][_0x0610('0x1a')]({'where':{'phone':_0x4ccb03['phone'],'VoiceQueueId':_0x166fc8['id']}})[_0x0610('0x20')](function(_0x4ffff4){if(!_[_0x0610('0x18')](_0x4ffff4)){throw new Error(_0x0610('0x22')+_0x4ccb03[_0x0610('0xa')]+_0x0610('0x23')+_0x166fc8['id']);}return _0x3459f1[_0x0610('0x21')][_0x0610('0x24')]({'phone':_0x4ccb03[_0x0610('0xa')],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03[_0x0610('0x25')],'priority':_0x4ccb03[_0x0610('0x26')]?_0x4ccb03[_0x0610('0x26')]:0x2,'scheduledat':_0x4ccb03[_0x0610('0x17')]?_0x4ccb03[_0x0610('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4ccb03['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ccb03[_0x0610('0x27')]?_0x4ccb03['callbackUniqueid']:undefined,'callbackat':_0x4ccb03[_0x0610('0x27')]?moment()[_0x0610('0x28')](_0x0610('0x1f')):undefined,'VoiceQueueId':_0x166fc8['id']});})[_0x0610('0x29')](function(_0x359f10){_0x2fc5cd(_0x359f10);});});});};var _0xaac3a0=function(_0x5bc5de){return new BPromise(function(_0x212367,_0x317d4d){_0x423e7a(_0x5bc5de,_0x4ccb03)['then'](function(_0x5109af){_0x4ccb03[_0x0610('0x17')]=_0x5109af['ret'];_0x3459f1[_0x0610('0x21')]['findOne']({'where':{'phone':_0x4ccb03[_0x0610('0xa')],'VoiceQueueId':_0x5bc5de['id']}})['then'](function(_0x283cf8){if(!_[_0x0610('0x18')](_0x283cf8)){throw new Error(_0x0610('0x22')+_0x4ccb03[_0x0610('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5bc5de['id']);}return _0x3459f1[_0x0610('0x2a')]['findOne']({'where':{'calleridnum':_0x4ccb03[_0x0610('0xa')],'VoiceQueueId':_0x5bc5de['id']}});})[_0x0610('0x20')](function(_0x4f9d07){if(!_[_0x0610('0x18')](_0x4f9d07)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4ccb03[_0x0610('0xa')]+_0x0610('0x2b')+_0x5bc5de['id']);}return _0x3459f1[_0x0610('0x21')][_0x0610('0x24')]({'phone':_0x4ccb03[_0x0610('0xa')],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03[_0x0610('0x25')],'priority':_0x4ccb03['priority']?_0x4ccb03[_0x0610('0x26')]:0x2,'scheduledat':_0x4ccb03[_0x0610('0x17')]?_0x4ccb03[_0x0610('0x17')]:moment()[_0x0610('0x28')](_0x0610('0x1f')),'callback':_0x4ccb03[_0x0610('0x27')]?!![]:![],'callbackuniqueid':_0x4ccb03[_0x0610('0x27')]?_0x4ccb03[_0x0610('0x27')]:undefined,'callbackat':_0x4ccb03[_0x0610('0x27')]?moment()[_0x0610('0x28')](_0x0610('0x1f')):undefined,'VoiceQueueId':_0x5bc5de['id']});})[_0x0610('0x29')](function(_0x4f1665){_0x317d4d(_0x4f1665);});});});};function _0xa3b770(){return function(_0x2448db){logger[_0x0610('0x13')](_0x0610('0x14'),'afterCreate',util[_0x0610('0x16')](_0x2448db,{'showHidden':![],'depth':null}));};}function _0x5a5737(_0x5531ef,_0x15870){var _0x1b558b=_0x15870['scheduledat']?_0x15870[_0x0610('0x17')]:moment()[_0x0610('0x28')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x394565,_0x589394){if(_['isNil'](_0x15870['dialTimezone'])){_0x394565({'ret':_0x1b558b});}else{_0x3459f1['Campaign'][_0x0610('0x1a')]({'where':{'id':_0x5531ef['id']}})[_0x0610('0x20')](function(_0x517dc1){if(!_[_0x0610('0x18')](_0x517dc1)){var _0x510f23=_0x517dc1[_0x0610('0x1b')];if(!_[_0x0610('0x18')](_0x510f23)){var _0x574ddf=shared['timezones'];var _0xcdaa1b=_0x574ddf[_0x510f23];var _0x553106=_0x574ddf[_0x15870[_0x0610('0x1b')]];if(!_[_0x0610('0x18')](_0xcdaa1b)&&!_[_0x0610('0x18')](_0x553106)){var _0x37858e=_0xcdaa1b[_0x0610('0x1d')]-_0x553106['utcOffset'];_0x1b558b=_0x15870['scheduledat']?_0x15870[_0x0610('0x17')]:moment();var _0x2507ee=moment(_0x1b558b)['add'](_0x37858e,_0x0610('0x1e'));_0x394565({'ret':_0x2507ee[_0x0610('0x28')](_0x0610('0x1f'))});}else _0x394565({'ret':_0x1b558b});}else _0x394565({'ret':_0x1b558b});}else{_0x394565({'ret':_0x1b558b});}});}});return 0xa;}var _0x93adaa=function(_0x389499){return new BPromise(function(_0x3d2987,_0x3a01db){_0x5a5737(_0x389499,_0x4ccb03)['then'](function(_0x311a4f){_0x4ccb03[_0x0610('0x17')]=_0x311a4f[_0x0610('0x2c')];_0x3459f1[_0x0610('0x21')][_0x0610('0x1a')]({'where':{'phone':_0x4ccb03[_0x0610('0xa')],'CampaignId':_0x389499['id']}})['then'](function(_0x313685){if(!_[_0x0610('0x18')](_0x313685)){throw new Error(_0x0610('0x22')+_0x4ccb03[_0x0610('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x389499['id']);}return _0x3459f1[_0x0610('0x21')][_0x0610('0x24')]({'phone':_0x4ccb03[_0x0610('0xa')],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03[_0x0610('0x25')],'priority':_0x4ccb03['priority']?_0x4ccb03['priority']:0x2,'scheduledat':_0x4ccb03[_0x0610('0x17')]?_0x4ccb03[_0x0610('0x17')]:moment()[_0x0610('0x28')](_0x0610('0x1f')),'callback':_0x4ccb03[_0x0610('0x27')]?!![]:![],'callbackuniqueid':_0x4ccb03[_0x0610('0x27')]?_0x4ccb03[_0x0610('0x27')]:undefined,'callbackat':_0x4ccb03[_0x0610('0x27')]?moment()[_0x0610('0x28')](_0x0610('0x1f')):undefined,'CampaignId':_0x389499['id']});})[_0x0610('0x29')](function(_0x21d635){_0x3a01db(_0x21d635);});});});};var _0x424418=function(_0x34217d){return new BPromise(function(_0x393ef8,_0x3b3406){_0x5a5737(_0x34217d,_0x4ccb03)[_0x0610('0x20')](function(_0x4b902c){_0x4ccb03['scheduledat']=_0x4b902c[_0x0610('0x2c')];_0x3459f1['CmHopper']['findOne']({'where':{'phone':_0x4ccb03[_0x0610('0xa')],'CampaignId':_0x34217d['id']}})[_0x0610('0x20')](function(_0xdd7a2){if(!_[_0x0610('0x18')](_0xdd7a2)){throw new Error(_0x0610('0x22')+_0x4ccb03['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x34217d['id']);}return _0x3459f1[_0x0610('0x2a')][_0x0610('0x1a')]({'where':{'calleridnum':_0x4ccb03['phone'],'CampaignId':_0x34217d['id']}});})[_0x0610('0x20')](function(_0x1882d8){if(!_[_0x0610('0x18')](_0x1882d8)){throw new Error(_0x0610('0x2d')+_0x4ccb03[_0x0610('0xa')]+_0x0610('0x2e')+_0x34217d['id']);}return _0x3459f1[_0x0610('0x21')][_0x0610('0x24')]({'phone':_0x4ccb03[_0x0610('0xa')],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03['ListId'],'priority':_0x4ccb03['priority']?_0x4ccb03['priority']:0x2,'scheduledat':_0x4ccb03[_0x0610('0x17')]?_0x4ccb03[_0x0610('0x17')]:moment()[_0x0610('0x28')](_0x0610('0x1f')),'callback':_0x4ccb03[_0x0610('0x27')]?!![]:![],'callbackuniqueid':_0x4ccb03['callbackUniqueid']?_0x4ccb03['callbackUniqueid']:undefined,'callbackat':_0x4ccb03[_0x0610('0x27')]?moment()[_0x0610('0x28')](_0x0610('0x1f')):undefined,'CampaignId':_0x34217d['id']});})[_0x0610('0x29')](function(_0x2c63d9){_0x3b3406(_0x2c63d9);});});});};if(_0x4ccb03[_0x0610('0x25')]){_0x3459f1[_0x0610('0x19')][_0x0610('0x2f')]({'where':{'type':_0x0610('0x30')},'attributes':['id','dialCheckDuplicateType',_0x0610('0x1b')],'include':[{'model':_0x3459f1[_0x0610('0x31')],'as':_0x0610('0x32'),'where':{'id':_0x4ccb03[_0x0610('0x25')]}}]})[_0x0610('0x20')](function(_0x2b7b14){if(_0x2b7b14){var _0x58055f=[];for(var _0x402562=0x0,_0x529ce9;_0x402562<_0x2b7b14[_0x0610('0x33')];_0x402562+=0x1){_0x529ce9=_0x2b7b14[_0x402562][_0x0610('0x12')]({'plain':!![]});switch(_0x529ce9['dialCheckDuplicateType']){case'always':_0xaac3a0(_0x529ce9)['catch'](_0x305d6f());break;case _0x0610('0x34'):_0x41dbbd(_0x529ce9)[_0x0610('0x29')](_0x305d6f());break;default:_0x5a5737(_0x529ce9,_0x4ccb03)[_0x0610('0x20')](function(_0x2d35a6){_0x4ccb03['scheduledat']=_0x2d35a6['ret'];_0x3459f1['CmHopper'][_0x0610('0x24')]({'phone':_0x4ccb03[_0x0610('0xa')],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03[_0x0610('0x25')],'scheduledat':_0x4ccb03[_0x0610('0x17')]?_0x4ccb03['scheduledat']:moment()[_0x0610('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4ccb03['priority']?_0x4ccb03[_0x0610('0x26')]:0x2,'callback':_0x4ccb03['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ccb03['callbackUniqueid']?_0x4ccb03[_0x0610('0x27')]:undefined,'callbackat':_0x4ccb03[_0x0610('0x27')]?moment()[_0x0610('0x28')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x529ce9['id']})['catch'](_0x305d6f());});}}}})['then'](function(){return _0x3459f1[_0x0610('0x19')][_0x0610('0x2f')]({'where':{'type':_0x0610('0x30')},'attributes':['id'],'include':[{'model':_0x3459f1[_0x0610('0x31')],'as':_0x0610('0x35'),'where':{'id':_0x4ccb03[_0x0610('0x25')]}}]})[_0x0610('0x20')](function(_0x5627b3){if(_0x5627b3){var _0x4d6f3d=[];for(var _0x305a6e=0x0,_0x15f77d;_0x305a6e<_0x5627b3[_0x0610('0x33')];_0x305a6e+=0x1){_0x15f77d=_0x5627b3[_0x305a6e]['get']({'plain':!![]});_0x3459f1[_0x0610('0x36')][_0x0610('0x24')]({'phone':_0x4ccb03[_0x0610('0xa')],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03[_0x0610('0x25')],'VoiceQueueId':_0x15f77d['id']})['catch'](function(_0x2eb802){logger[_0x0610('0x13')](_0x0610('0x37'),_0x0610('0x15'),_0x2eb802['message']);});}}});})[_0x0610('0x20')](function(){return _0x3459f1[_0x0610('0x38')][_0x0610('0x2f')]({'attributes':['id',_0x0610('0x39'),_0x0610('0x1b')],'include':[{'model':_0x3459f1['CmList'],'as':'Lists','where':{'id':_0x4ccb03[_0x0610('0x25')]}}]})['then'](function(_0x48ac6d){if(_0x48ac6d){var _0x20e291=[];for(var _0x5e2b6d=0x0,_0x2d1d75;_0x5e2b6d<_0x48ac6d['length'];_0x5e2b6d+=0x1){_0x2d1d75=_0x48ac6d[_0x5e2b6d]['get']({'plain':!![]});switch(_0x2d1d75[_0x0610('0x39')]){case _0x0610('0x3a'):_0x424418(_0x2d1d75)['catch'](_0xa3b770());break;case'onlyIfOpen':_0x93adaa(_0x2d1d75)[_0x0610('0x29')](_0xa3b770());break;default:_0x3459f1[_0x0610('0x21')]['create']({'phone':_0x4ccb03[_0x0610('0xa')],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03[_0x0610('0x25')],'scheduledat':_0x4ccb03[_0x0610('0x17')]?_0x4ccb03[_0x0610('0x17')]:moment()[_0x0610('0x28')](_0x0610('0x1f')),'priority':_0x4ccb03[_0x0610('0x26')]?_0x4ccb03[_0x0610('0x26')]:0x2,'callback':_0x4ccb03['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ccb03[_0x0610('0x27')]?_0x4ccb03[_0x0610('0x27')]:undefined,'callbackat':_0x4ccb03[_0x0610('0x27')]?moment()[_0x0610('0x28')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2d1d75['id']})[_0x0610('0x29')](_0xa3b770());}}}});})[_0x0610('0x20')](function(){return _0x3459f1[_0x0610('0x38')][_0x0610('0x2f')]({'attributes':['id'],'include':[{'model':_0x3459f1['CmList'],'as':_0x0610('0x35'),'where':{'id':_0x4ccb03['ListId']}}]})['then'](function(_0x512ea4){if(_0x512ea4){var _0x49a877=[];for(var _0x564cf7=0x0,_0x4d1472;_0x564cf7<_0x512ea4['length'];_0x564cf7+=0x1){_0x4d1472=_0x512ea4[_0x564cf7][_0x0610('0x12')]({'plain':!![]});_0x3459f1[_0x0610('0x36')]['create']({'phone':_0x4ccb03['phone'],'ContactId':_0x4ccb03['id'],'ListId':_0x4ccb03['ListId'],'CampaignId':_0x4d1472['id']})[_0x0610('0x29')](function(_0x3c7eee){logger['error'](_0x0610('0x37'),_0x0610('0x15'),_0x3c7eee[_0x0610('0x3b')]);});}}});})[_0x0610('0x20')](function(){_0x3c3648();})[_0x0610('0x29')](function(_0x504959){logger[_0x0610('0x13')](_0x0610('0x37'),_0x0610('0x15'),_0x504959['message']);_0x3c3648(_0x504959);});}else{_0x3c3648(new Error(_0x0610('0x3c')));}},'afterDestroy':function(_0x1c26d6,_0x164b9c,_0x3e379c){var _0x22ef50=_0x5a7d83[_0x0610('0x3d')];var _0x206b2e=_0x1c26d6[_0x0610('0x12')]({'plain':!![]});return _0x22ef50[_0x0610('0x21')][_0x0610('0x2f')]({'raw':!![],'where':{'ListId':_0x206b2e['ListId'],'ContactId':_0x206b2e['id']}})[_0x0610('0x20')](function(_0x5ec47f){if(!_[_0x0610('0x3e')](_0x5ec47f)){var _0xbe2fea=[];for(var _0x27ebb4=0x0;_0x27ebb4<_0x5ec47f[_0x0610('0x33')];_0x27ebb4+=0x1){var _0xa14002=_0x22ef50[_0x0610('0x21')][_0x0610('0x3f')]({'where':{'ListId':_0x5ec47f[_0x27ebb4]['ListId'],'ContactId':_0x5ec47f[_0x27ebb4]['ContactId'],'VoiceQueueId':_0x5ec47f[_0x27ebb4][_0x0610('0x40')],'CampaignId':_0x5ec47f[_0x27ebb4][_0x0610('0x41')]}});_0xbe2fea[_0x0610('0x42')](_0xa14002);}return BPromise['all'](_0xbe2fea);}})[_0x0610('0x20')](function(_0x49bb58){logger[_0x0610('0x43')](_0x0610('0x44'),util['inspect'](_0x49bb58,{'showHidden':![],'depth':null}));_0x3e379c();})[_0x0610('0x29')](function(_0x9f8c6b){logger[_0x0610('0x13')](_0x0610('0x45'),util[_0x0610('0x16')](_0x9f8c6b,{'showHidden':![],'depth':null}));_0x3e379c(_0x9f8c6b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index d8a0a27..138ecc4 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x23cd7b,_0x10d241){var _0x2512ee=function(_0x2c3a1a){while(--_0x2c3a1a){_0x23cd7b['push'](_0x23cd7b['shift']());}};_0x2512ee(++_0x10d241);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 9b8b27e..2f6486c 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 _0x4f29=['PHONE','exports','INTEGER','STRING'];(function(_0x3dddb5,_0x551c53){var _0x22b8fc=function(_0x5550b6){while(--_0x5550b6){_0x3dddb5['push'](_0x3dddb5['shift']());}};_0x22b8fc(++_0x551c53);}(_0x4f29,0xfd));var _0x94f2=function(_0x44e341,_0x324dee){_0x44e341=_0x44e341-0x0;var _0x3142ec=_0x4f29[_0x44e341];return _0x3142ec;};'use strict';var Sequelize=require('sequelize');module[_0x94f2('0x0')]={'CmContactId':{'type':Sequelize[_0x94f2('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x94f2('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x94f2('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x94f2('0x2')],'defaultValue':_0x94f2('0x3')},'OrderBy':{'type':Sequelize[_0x94f2('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x94f2('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xf822=['STRING','PHONE','sequelize','INTEGER'];(function(_0x56ca61,_0x187321){var _0x1e7bee=function(_0x1d6eb4){while(--_0x1d6eb4){_0x56ca61['push'](_0x56ca61['shift']());}};_0x1e7bee(++_0x187321);}(_0xf822,0x19e));var _0x2f82=function(_0x151a67,_0x522ab4){_0x151a67=_0x151a67-0x0;var _0xaf97c0=_0xf822[_0x151a67];return _0xaf97c0;};'use strict';var Sequelize=require(_0x2f82('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x2f82('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2f82('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2f82('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2f82('0x2')],'defaultValue':_0x2f82('0x3')},'OrderBy':{'type':Sequelize[_0x2f82('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'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 e88dde3..f8a9910 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 _0xdb57=['reject','update','destroy','then','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range'];(function(_0x399552,_0x431748){var _0x549079=function(_0x2829ed){while(--_0x2829ed){_0x399552['push'](_0x399552['shift']());}};_0x549079(++_0x431748);}(_0xdb57,0x12c));var _0x7db5=function(_0x12d6a8,_0x5027ca){_0x12d6a8=_0x12d6a8-0x0;var _0x1ed4eb=_0xdb57[_0x12d6a8];return _0x1ed4eb;};'use strict';var emlformat=require(_0x7db5('0x0'));var rimraf=require(_0x7db5('0x1'));var zipdir=require(_0x7db5('0x2'));var jsonpatch=require(_0x7db5('0x3'));var rp=require(_0x7db5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7db5('0x5'));var util=require(_0x7db5('0x6'));var path=require(_0x7db5('0x7'));var sox=require('sox');var csv=require(_0x7db5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7db5('0x9'));var _=require(_0x7db5('0xa'));var squel=require(_0x7db5('0xb'));var crypto=require(_0x7db5('0xc'));var jsforce=require(_0x7db5('0xd'));var deskjs=require(_0x7db5('0xe'));var toCsv=require(_0x7db5('0x8'));var querystring=require(_0x7db5('0xf'));var Papa=require(_0x7db5('0x10'));var Redis=require(_0x7db5('0x11'));var authService=require(_0x7db5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7db5('0x13'));var hardwareService=require(_0x7db5('0x14'));var logger=require(_0x7db5('0x15'))('api');var utils=require(_0x7db5('0x16'));var config=require(_0x7db5('0x17'));var licenseUtil=require(_0x7db5('0x18'));var db=require(_0x7db5('0x19'))['db'];function respondWithStatusCode(_0x21627f,_0x1452b7){_0x1452b7=_0x1452b7||0xcc;return function(_0x53785f){if(_0x53785f){return _0x21627f[_0x7db5('0x1a')](_0x1452b7);}return _0x21627f[_0x7db5('0x1b')](_0x1452b7)[_0x7db5('0x1c')]();};}function respondWithResult(_0x202d90,_0x5abb8d){_0x5abb8d=_0x5abb8d||0xc8;return function(_0xe2f841){if(_0xe2f841){return _0x202d90['status'](_0x5abb8d)[_0x7db5('0x1d')](_0xe2f841);}};}function respondWithFilteredResult(_0x84d00b,_0x48f946){return function(_0x56e442){if(_0x56e442){var _0x169b2b=typeof _0x48f946['offset']==='undefined'&&typeof _0x48f946[_0x7db5('0x1e')]===_0x7db5('0x1f');var _0x47b5b1=_0x56e442[_0x7db5('0x20')];var _0x27a2b8=_0x169b2b?0x0:_0x48f946[_0x7db5('0x21')];var _0x2472de=_0x169b2b?_0x56e442[_0x7db5('0x20')]:_0x48f946['offset']+_0x48f946['limit'];var _0x52d3f0;if(_0x2472de>=_0x47b5b1){_0x2472de=_0x47b5b1;_0x52d3f0=0xc8;}else{_0x52d3f0=0xce;}_0x84d00b[_0x7db5('0x1b')](_0x52d3f0);return _0x84d00b[_0x7db5('0x22')](_0x7db5('0x23'),_0x27a2b8+'-'+_0x2472de+'/'+_0x47b5b1)[_0x7db5('0x1d')](_0x56e442);}return null;};}function patchUpdates(_0x3d1436){return function(_0x2f678b){try{jsonpatch['apply'](_0x2f678b,_0x3d1436,!![]);}catch(_0x4bcde4){return BPromise[_0x7db5('0x24')](_0x4bcde4);}return _0x2f678b['save']();};}function saveUpdates(_0x28e0c1,_0x3229a8){return function(_0x162847){if(_0x162847){return _0x162847[_0x7db5('0x25')](_0x28e0c1)['then'](function(_0x4a122f){return _0x4a122f;});}return null;};}function removeEntity(_0x49b554,_0x674e3c){return function(_0x1171ae){if(_0x1171ae){return _0x1171ae[_0x7db5('0x26')]()[_0x7db5('0x27')](function(){var _0x20bd86=_0x1171ae['get']({'plain':!![]});var _0x134c80=_0x7db5('0x28');return db[_0x7db5('0x29')]['destroy']({'where':{'type':_0x134c80,'resourceId':_0x20bd86['id']}})[_0x7db5('0x27')](function(){return _0x1171ae;});})[_0x7db5('0x27')](function(){_0x49b554[_0x7db5('0x1b')](0xcc)[_0x7db5('0x1c')]();});}};}function handleEntityNotFound(_0x1e1ada,_0x2ecbe9){return function(_0x7b9416){if(!_0x7b9416){_0x1e1ada[_0x7db5('0x1a')](0x194);}return _0x7b9416;};}function handleError(_0x21bc84,_0x32699e){_0x32699e=_0x32699e||0x1f4;return function(_0x32d625){logger[_0x7db5('0x2a')](_0x32d625[_0x7db5('0x2b')]);if(_0x32d625[_0x7db5('0x2c')]){delete _0x32d625[_0x7db5('0x2c')];}_0x21bc84['status'](_0x32699e)['send'](_0x32d625);};}exports[_0x7db5('0x2d')]=function(_0x5c04ad,_0x327124){var _0x40697d={},_0x5089bd={},_0x5e6154={'count':0x0,'rows':[]};var _0x2769d1=_[_0x7db5('0x2e')](db[_0x7db5('0x2f')]['rawAttributes'],function(_0x393151){return{'name':_0x393151[_0x7db5('0x30')],'type':_0x393151[_0x7db5('0x31')][_0x7db5('0x32')]};});_0x5089bd[_0x7db5('0x33')]=_[_0x7db5('0x2e')](_0x2769d1,'name');_0x5089bd[_0x7db5('0x34')]=_[_0x7db5('0x35')](_0x5c04ad['query']);_0x5089bd[_0x7db5('0x36')]=_[_0x7db5('0x37')](_0x5089bd[_0x7db5('0x33')],_0x5089bd[_0x7db5('0x34')]);_0x40697d['attributes']=_['intersection'](_0x5089bd[_0x7db5('0x33')],qs[_0x7db5('0x38')](_0x5c04ad[_0x7db5('0x34')][_0x7db5('0x38')]));_0x40697d[_0x7db5('0x39')]=_0x40697d[_0x7db5('0x39')][_0x7db5('0x3a')]?_0x40697d[_0x7db5('0x39')]:_0x5089bd['model'];if(!_0x5c04ad[_0x7db5('0x34')]['hasOwnProperty']('nolimit')){_0x40697d[_0x7db5('0x1e')]=qs[_0x7db5('0x1e')](_0x5c04ad['query'][_0x7db5('0x1e')]);_0x40697d[_0x7db5('0x21')]=qs['offset'](_0x5c04ad[_0x7db5('0x34')][_0x7db5('0x21')]);}_0x40697d[_0x7db5('0x3b')]=qs[_0x7db5('0x3c')](_0x5c04ad['query'][_0x7db5('0x3c')]);_0x40697d[_0x7db5('0x3d')]=qs[_0x7db5('0x36')](_[_0x7db5('0x3e')](_0x5c04ad[_0x7db5('0x34')],_0x5089bd[_0x7db5('0x36')]),_0x2769d1);if(_0x5c04ad[_0x7db5('0x34')][_0x7db5('0x3f')]){_0x40697d['where']=_[_0x7db5('0x40')](_0x40697d[_0x7db5('0x3d')],{'$or':_[_0x7db5('0x2e')](_0x2769d1,function(_0x30cbf6){if(_0x30cbf6['type']!==_0x7db5('0x41')){var _0x1e89b2={};_0x1e89b2[_0x30cbf6[_0x7db5('0x2c')]]={'$like':'%'+_0x5c04ad[_0x7db5('0x34')][_0x7db5('0x3f')]+'%'};return _0x1e89b2;}})});}_0x40697d=_['merge']({},_0x40697d,_0x5c04ad[_0x7db5('0x42')]);var _0x1d7a3c={'where':_0x40697d[_0x7db5('0x3d')]};return db['CmContactHasItem'][_0x7db5('0x20')](_0x1d7a3c)['then'](function(_0x3ec19c){_0x5e6154['count']=_0x3ec19c;if(_0x5c04ad[_0x7db5('0x34')][_0x7db5('0x43')]){_0x40697d[_0x7db5('0x44')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x7db5('0x45')](_0x40697d);})[_0x7db5('0x27')](function(_0x328f94){_0x5e6154[_0x7db5('0x46')]=_0x328f94;return _0x5e6154;})[_0x7db5('0x27')](respondWithFilteredResult(_0x327124,_0x40697d))[_0x7db5('0x47')](handleError(_0x327124,null));};exports[_0x7db5('0x48')]=function(_0x588aef,_0x1dab7d){var _0x21ac6a={'raw':!![],'where':{'id':_0x588aef[_0x7db5('0x49')]['id']}},_0x8ae5b3={};_0x8ae5b3['model']=_[_0x7db5('0x35')](db['CmContactHasItem'][_0x7db5('0x4a')]);_0x8ae5b3['query']=_[_0x7db5('0x35')](_0x588aef[_0x7db5('0x34')]);_0x8ae5b3[_0x7db5('0x36')]=_['intersection'](_0x8ae5b3[_0x7db5('0x33')],_0x8ae5b3[_0x7db5('0x34')]);_0x21ac6a[_0x7db5('0x39')]=_['intersection'](_0x8ae5b3[_0x7db5('0x33')],qs[_0x7db5('0x38')](_0x588aef[_0x7db5('0x34')][_0x7db5('0x38')]));_0x21ac6a['attributes']=_0x21ac6a[_0x7db5('0x39')][_0x7db5('0x3a')]?_0x21ac6a['attributes']:_0x8ae5b3[_0x7db5('0x33')];if(_0x588aef[_0x7db5('0x34')]['includeAll']){_0x21ac6a[_0x7db5('0x44')]=[{'all':!![]}];}_0x21ac6a=_['merge']({},_0x21ac6a,_0x588aef[_0x7db5('0x42')]);return db[_0x7db5('0x2f')][_0x7db5('0x4b')](_0x21ac6a)[_0x7db5('0x27')](handleEntityNotFound(_0x1dab7d,null))[_0x7db5('0x27')](respondWithResult(_0x1dab7d,null))[_0x7db5('0x47')](handleError(_0x1dab7d,null));};exports[_0x7db5('0x4c')]=function(_0x2cdd81,_0x597782){return db['CmContactHasItem'][_0x7db5('0x4c')](_0x2cdd81[_0x7db5('0x4d')],{})['then'](function(_0x5ae4c5){var _0x578f5f=_0x2cdd81[_0x7db5('0x4e')][_0x7db5('0x4f')]({'plain':!![]});if(!_0x578f5f)throw new Error(_0x7db5('0x50'));if(_0x578f5f['role']===_0x7db5('0x4e')){var _0x39d32f=_0x5ae4c5[_0x7db5('0x4f')]({'plain':!![]});var _0x1046bc='CmContactHasItems';return db[_0x7db5('0x51')][_0x7db5('0x4b')]({'where':{'name':_0x1046bc,'userProfileId':_0x578f5f[_0x7db5('0x52')]},'raw':!![]})[_0x7db5('0x27')](function(_0x1fad6b){if(_0x1fad6b&&_0x1fad6b[_0x7db5('0x53')]===0x0){return db['UserProfileResource'][_0x7db5('0x4c')]({'name':_0x39d32f[_0x7db5('0x2c')],'resourceId':_0x39d32f['id'],'type':_0x1fad6b['name'],'sectionId':_0x1fad6b['id']},{})[_0x7db5('0x27')](function(){return _0x5ae4c5;});}else{return _0x5ae4c5;}})[_0x7db5('0x47')](function(_0x5c9e9e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c9e9e);throw _0x5c9e9e;});}return _0x5ae4c5;})['then'](respondWithResult(_0x597782,0xc9))[_0x7db5('0x47')](handleError(_0x597782,null));};exports[_0x7db5('0x25')]=function(_0x3959fd,_0x5a6f2b){if(_0x3959fd['body']['id']){delete _0x3959fd[_0x7db5('0x4d')]['id'];}return db[_0x7db5('0x2f')][_0x7db5('0x4b')]({'where':{'id':_0x3959fd['params']['id']}})['then'](handleEntityNotFound(_0x5a6f2b,null))[_0x7db5('0x27')](saveUpdates(_0x3959fd['body'],null))[_0x7db5('0x27')](respondWithResult(_0x5a6f2b,null))['catch'](handleError(_0x5a6f2b,null));};exports[_0x7db5('0x26')]=function(_0x5387b1,_0x2108e4){return db['CmContactHasItem']['find']({'where':{'id':_0x5387b1['params']['id']}})[_0x7db5('0x27')](handleEntityNotFound(_0x2108e4,null))[_0x7db5('0x27')](removeEntity(_0x2108e4,null))[_0x7db5('0x47')](handleError(_0x2108e4,null));}; \ No newline at end of file +var _0xd840=['role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','rawAttributes','model','query','intersection','fields','attributes','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','CmContactHasItem','findAll','rows','catch','show','params','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5aa126,_0x3980f6){var _0x2b953e=function(_0x414f99){while(--_0x414f99){_0x5aa126['push'](_0x5aa126['shift']());}};_0x2b953e(++_0x3980f6);}(_0xd840,0x185));var _0x0d84=function(_0x19abf4,_0x5461f6){_0x19abf4=_0x19abf4-0x0;var _0x2b8540=_0xd840[_0x19abf4];return _0x2b8540;};'use strict';var emlformat=require(_0x0d84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d84('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d84('0x2'));var moment=require('moment');var BPromise=require(_0x0d84('0x3'));var Mustache=require('mustache');var util=require(_0x0d84('0x4'));var path=require(_0x0d84('0x5'));var sox=require(_0x0d84('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d84('0x7'));var _=require(_0x0d84('0x8'));var squel=require(_0x0d84('0x9'));var crypto=require(_0x0d84('0xa'));var jsforce=require(_0x0d84('0xb'));var deskjs=require(_0x0d84('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0d84('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d84('0xe'));var as=require(_0x0d84('0xf'));var hardwareService=require(_0x0d84('0x10'));var logger=require('../../config/logger')(_0x0d84('0x11'));var utils=require(_0x0d84('0x12'));var config=require(_0x0d84('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d84('0x14'))['db'];function respondWithStatusCode(_0x1256f1,_0x14c095){_0x14c095=_0x14c095||0xcc;return function(_0x4a65dd){if(_0x4a65dd){return _0x1256f1['sendStatus'](_0x14c095);}return _0x1256f1[_0x0d84('0x15')](_0x14c095)[_0x0d84('0x16')]();};}function respondWithResult(_0x156ede,_0xba0e9d){_0xba0e9d=_0xba0e9d||0xc8;return function(_0x13f5ba){if(_0x13f5ba){return _0x156ede[_0x0d84('0x15')](_0xba0e9d)[_0x0d84('0x17')](_0x13f5ba);}};}function respondWithFilteredResult(_0x1c405b,_0x45ade4){return function(_0x50928f){if(_0x50928f){var _0x5aead1=typeof _0x45ade4[_0x0d84('0x18')]===_0x0d84('0x19')&&typeof _0x45ade4[_0x0d84('0x1a')]===_0x0d84('0x19');var _0x5c9e53=_0x50928f[_0x0d84('0x1b')];var _0x1fd1dd=_0x5aead1?0x0:_0x45ade4['offset'];var _0x2b9b06=_0x5aead1?_0x50928f[_0x0d84('0x1b')]:_0x45ade4[_0x0d84('0x18')]+_0x45ade4[_0x0d84('0x1a')];var _0x50ff06;if(_0x2b9b06>=_0x5c9e53){_0x2b9b06=_0x5c9e53;_0x50ff06=0xc8;}else{_0x50ff06=0xce;}_0x1c405b[_0x0d84('0x15')](_0x50ff06);return _0x1c405b[_0x0d84('0x1c')](_0x0d84('0x1d'),_0x1fd1dd+'-'+_0x2b9b06+'/'+_0x5c9e53)[_0x0d84('0x17')](_0x50928f);}return null;};}function patchUpdates(_0xb45eaf){return function(_0x50682b){try{jsonpatch[_0x0d84('0x1e')](_0x50682b,_0xb45eaf,!![]);}catch(_0x17f371){return BPromise[_0x0d84('0x1f')](_0x17f371);}return _0x50682b[_0x0d84('0x20')]();};}function saveUpdates(_0x2cdd9b,_0x3a17d3){return function(_0x279e18){if(_0x279e18){return _0x279e18[_0x0d84('0x21')](_0x2cdd9b)[_0x0d84('0x22')](function(_0x10cdb8){return _0x10cdb8;});}return null;};}function removeEntity(_0x380bc9,_0x352b56){return function(_0x1ec606){if(_0x1ec606){return _0x1ec606[_0x0d84('0x23')]()[_0x0d84('0x22')](function(){var _0x10abc2=_0x1ec606['get']({'plain':!![]});var _0x8cf45='CmContactHasItems';return db[_0x0d84('0x24')]['destroy']({'where':{'type':_0x8cf45,'resourceId':_0x10abc2['id']}})['then'](function(){return _0x1ec606;});})[_0x0d84('0x22')](function(){_0x380bc9[_0x0d84('0x15')](0xcc)[_0x0d84('0x16')]();});}};}function handleEntityNotFound(_0x3454c4,_0x4cdbee){return function(_0x229d08){if(!_0x229d08){_0x3454c4['sendStatus'](0x194);}return _0x229d08;};}function handleError(_0x478f68,_0x3801e0){_0x3801e0=_0x3801e0||0x1f4;return function(_0x1b1b99){logger[_0x0d84('0x25')](_0x1b1b99[_0x0d84('0x26')]);if(_0x1b1b99[_0x0d84('0x27')]){delete _0x1b1b99[_0x0d84('0x27')];}_0x478f68['status'](_0x3801e0)['send'](_0x1b1b99);};}exports[_0x0d84('0x28')]=function(_0x496142,_0x113679){var _0x415f53={},_0x32075e={},_0x283bf1={'count':0x0,'rows':[]};var _0x410c2e=_[_0x0d84('0x29')](db['CmContactHasItem'][_0x0d84('0x2a')],function(_0x4c29b){return{'name':_0x4c29b['fieldName'],'type':_0x4c29b['type']['key']};});_0x32075e[_0x0d84('0x2b')]=_[_0x0d84('0x29')](_0x410c2e,_0x0d84('0x27'));_0x32075e[_0x0d84('0x2c')]=_['keys'](_0x496142[_0x0d84('0x2c')]);_0x32075e['filters']=_[_0x0d84('0x2d')](_0x32075e[_0x0d84('0x2b')],_0x32075e[_0x0d84('0x2c')]);_0x415f53['attributes']=_[_0x0d84('0x2d')](_0x32075e[_0x0d84('0x2b')],qs[_0x0d84('0x2e')](_0x496142['query'][_0x0d84('0x2e')]));_0x415f53[_0x0d84('0x2f')]=_0x415f53[_0x0d84('0x2f')]['length']?_0x415f53['attributes']:_0x32075e[_0x0d84('0x2b')];if(!_0x496142[_0x0d84('0x2c')]['hasOwnProperty'](_0x0d84('0x30'))){_0x415f53[_0x0d84('0x1a')]=qs[_0x0d84('0x1a')](_0x496142[_0x0d84('0x2c')][_0x0d84('0x1a')]);_0x415f53[_0x0d84('0x18')]=qs[_0x0d84('0x18')](_0x496142[_0x0d84('0x2c')][_0x0d84('0x18')]);}_0x415f53[_0x0d84('0x31')]=qs[_0x0d84('0x32')](_0x496142[_0x0d84('0x2c')]['sort']);_0x415f53['where']=qs[_0x0d84('0x33')](_[_0x0d84('0x34')](_0x496142[_0x0d84('0x2c')],_0x32075e[_0x0d84('0x33')]),_0x410c2e);if(_0x496142[_0x0d84('0x2c')][_0x0d84('0x35')]){_0x415f53[_0x0d84('0x36')]=_['merge'](_0x415f53[_0x0d84('0x36')],{'$or':_[_0x0d84('0x29')](_0x410c2e,function(_0x2588a5){if(_0x2588a5['type']!==_0x0d84('0x37')){var _0x399ee0={};_0x399ee0[_0x2588a5[_0x0d84('0x27')]]={'$like':'%'+_0x496142[_0x0d84('0x2c')][_0x0d84('0x35')]+'%'};return _0x399ee0;}})});}_0x415f53=_[_0x0d84('0x38')]({},_0x415f53,_0x496142[_0x0d84('0x39')]);var _0x1fba87={'where':_0x415f53[_0x0d84('0x36')]};return db['CmContactHasItem'][_0x0d84('0x1b')](_0x1fba87)[_0x0d84('0x22')](function(_0x365fc1){_0x283bf1['count']=_0x365fc1;if(_0x496142[_0x0d84('0x2c')][_0x0d84('0x3a')]){_0x415f53['include']=[{'all':!![]}];}return db[_0x0d84('0x3b')][_0x0d84('0x3c')](_0x415f53);})[_0x0d84('0x22')](function(_0x17d8a8){_0x283bf1[_0x0d84('0x3d')]=_0x17d8a8;return _0x283bf1;})[_0x0d84('0x22')](respondWithFilteredResult(_0x113679,_0x415f53))[_0x0d84('0x3e')](handleError(_0x113679,null));};exports[_0x0d84('0x3f')]=function(_0x9fc460,_0x4f82c9){var _0x56912f={'raw':!![],'where':{'id':_0x9fc460[_0x0d84('0x40')]['id']}},_0x197d70={};_0x197d70[_0x0d84('0x2b')]=_['keys'](db['CmContactHasItem'][_0x0d84('0x2a')]);_0x197d70[_0x0d84('0x2c')]=_['keys'](_0x9fc460[_0x0d84('0x2c')]);_0x197d70[_0x0d84('0x33')]=_['intersection'](_0x197d70[_0x0d84('0x2b')],_0x197d70[_0x0d84('0x2c')]);_0x56912f[_0x0d84('0x2f')]=_[_0x0d84('0x2d')](_0x197d70[_0x0d84('0x2b')],qs['fields'](_0x9fc460[_0x0d84('0x2c')][_0x0d84('0x2e')]));_0x56912f['attributes']=_0x56912f[_0x0d84('0x2f')][_0x0d84('0x41')]?_0x56912f[_0x0d84('0x2f')]:_0x197d70['model'];if(_0x9fc460[_0x0d84('0x2c')][_0x0d84('0x3a')]){_0x56912f[_0x0d84('0x42')]=[{'all':!![]}];}_0x56912f=_[_0x0d84('0x38')]({},_0x56912f,_0x9fc460['options']);return db[_0x0d84('0x3b')][_0x0d84('0x43')](_0x56912f)[_0x0d84('0x22')](handleEntityNotFound(_0x4f82c9,null))['then'](respondWithResult(_0x4f82c9,null))[_0x0d84('0x3e')](handleError(_0x4f82c9,null));};exports['create']=function(_0x24ad7f,_0x5d7865){return db['CmContactHasItem'][_0x0d84('0x44')](_0x24ad7f[_0x0d84('0x45')],{})[_0x0d84('0x22')](function(_0x53f06a){var _0x456b07=_0x24ad7f[_0x0d84('0x46')][_0x0d84('0x47')]({'plain':!![]});if(!_0x456b07)throw new Error(_0x0d84('0x48'));if(_0x456b07[_0x0d84('0x49')]===_0x0d84('0x46')){var _0x3a6039=_0x53f06a['get']({'plain':!![]});var _0x57957='CmContactHasItems';return db[_0x0d84('0x4a')][_0x0d84('0x43')]({'where':{'name':_0x57957,'userProfileId':_0x456b07['userProfileId']},'raw':!![]})[_0x0d84('0x22')](function(_0x546e95){if(_0x546e95&&_0x546e95[_0x0d84('0x4b')]===0x0){return db[_0x0d84('0x24')][_0x0d84('0x44')]({'name':_0x3a6039['name'],'resourceId':_0x3a6039['id'],'type':_0x546e95[_0x0d84('0x27')],'sectionId':_0x546e95['id']},{})['then'](function(){return _0x53f06a;});}else{return _0x53f06a;}})[_0x0d84('0x3e')](function(_0x1345e1){logger['error'](_0x0d84('0x4c'),_0x1345e1);throw _0x1345e1;});}return _0x53f06a;})['then'](respondWithResult(_0x5d7865,0xc9))[_0x0d84('0x3e')](handleError(_0x5d7865,null));};exports[_0x0d84('0x21')]=function(_0x4dda13,_0x32be40){if(_0x4dda13[_0x0d84('0x45')]['id']){delete _0x4dda13[_0x0d84('0x45')]['id'];}return db[_0x0d84('0x3b')]['find']({'where':{'id':_0x4dda13[_0x0d84('0x40')]['id']}})['then'](handleEntityNotFound(_0x32be40,null))[_0x0d84('0x22')](saveUpdates(_0x4dda13[_0x0d84('0x45')],null))[_0x0d84('0x22')](respondWithResult(_0x32be40,null))[_0x0d84('0x3e')](handleError(_0x32be40,null));};exports[_0x0d84('0x23')]=function(_0x3cec89,_0xc57461){return db[_0x0d84('0x3b')][_0x0d84('0x43')]({'where':{'id':_0x3cec89[_0x0d84('0x40')]['id']}})['then'](handleEntityNotFound(_0xc57461,null))['then'](removeEntity(_0xc57461,null))['catch'](handleError(_0xc57461,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index da3e2cd..3d7ba93 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 _0xb094=['CmContactHasItem','lodash','util','../../config/logger','api','moment','path','../../config/environment','./cmContactHasItem.attributes','define'];(function(_0xde965e,_0x4efc7a){var _0x2cd7c1=function(_0x56a25d){while(--_0x56a25d){_0xde965e['push'](_0xde965e['shift']());}};_0x2cd7c1(++_0x4efc7a);}(_0xb094,0x155));var _0x4b09=function(_0x2d3318,_0x29e816){_0x2d3318=_0x2d3318-0x0;var _0x117280=_0xb094[_0x2d3318];return _0x117280;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var logger=require(_0x4b09('0x2'))(_0x4b09('0x3'));var moment=require(_0x4b09('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b09('0x5'));var rimraf=require('rimraf');var config=require(_0x4b09('0x6'));var attributes=require(_0x4b09('0x7'));module['exports']=function(_0x563161,_0x43e2d5){return _0x563161[_0x4b09('0x8')](_0x4b09('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf41e=['util','../../config/logger','api','moment','bluebird','request-promise','path','./cmContactHasItem.attributes','exports','lodash'];(function(_0x34fb34,_0x455d52){var _0x4fd927=function(_0x6586ff){while(--_0x6586ff){_0x34fb34['push'](_0x34fb34['shift']());}};_0x4fd927(++_0x455d52);}(_0xf41e,0x167));var _0xef41=function(_0x242508,_0x8e42ec){_0x242508=_0x242508-0x0;var _0x11f237=_0xf41e[_0x242508];return _0x11f237;};'use strict';var _=require(_0xef41('0x0'));var util=require(_0xef41('0x1'));var logger=require(_0xef41('0x2'))(_0xef41('0x3'));var moment=require(_0xef41('0x4'));var BPromise=require(_0xef41('0x5'));var rp=require(_0xef41('0x6'));var fs=require('fs');var path=require(_0xef41('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef41('0x8'));module[_0xef41('0x9')]=function(_0x385172,_0x57325f){return _0x385172['define']('CmContactHasItem',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 17af8e7..2fccbe9 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 _0x5b36=['jayson/promise','client','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5b36,0xe9));var _0x65b3=function(_0x436766,_0x4485da){_0x436766=_0x436766-0x0;var _0x5e79a0=_0x5b36[_0x436766];return _0x5e79a0;};'use strict';var _=require(_0x65b3('0x0'));var util=require(_0x65b3('0x1'));var moment=require('moment');var BPromise=require(_0x65b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x65b3('0x4'))(_0x65b3('0x5'));var config=require(_0x65b3('0x6'));var jayson=require(_0x65b3('0x7'));var client=jayson[_0x65b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1830d1,_0x37a05a,_0x7339a3){return new BPromise(function(_0x4ee9f3,_0x411060){return client[_0x65b3('0x9')](_0x1830d1,_0x7339a3)[_0x65b3('0xa')](function(_0x22b305){logger['info'](_0x65b3('0xb'),_0x37a05a,_0x65b3('0xc'));logger['debug'](_0x65b3('0xd'),_0x37a05a,_0x65b3('0xc'),JSON[_0x65b3('0xe')](_0x22b305));if(_0x22b305['error']){if(_0x22b305['error'][_0x65b3('0xf')]===0x1f4){logger['error'](_0x65b3('0xb'),_0x37a05a,_0x22b305[_0x65b3('0x10')]['message']);return _0x411060(_0x22b305['error'][_0x65b3('0x11')]);}logger[_0x65b3('0x10')](_0x65b3('0xb'),_0x37a05a,_0x22b305[_0x65b3('0x10')][_0x65b3('0x11')]);return _0x4ee9f3(_0x22b305[_0x65b3('0x10')][_0x65b3('0x11')]);}else{logger[_0x65b3('0x12')](_0x65b3('0xb'),_0x37a05a,_0x65b3('0xc'));_0x4ee9f3(_0x22b305['result']['message']);}})[_0x65b3('0x13')](function(_0x3b5d39){logger['error'](_0x65b3('0xb'),_0x37a05a,_0x3b5d39);_0x411060(_0x3b5d39);});});} \ No newline at end of file +var _0x1008=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4e1d62,_0x8e6ce6){var _0x2b17d2=function(_0x128c59){while(--_0x128c59){_0x4e1d62['push'](_0x4e1d62['shift']());}};_0x2b17d2(++_0x8e6ce6);}(_0x1008,0x1e8));var _0x8100=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x1008[_0x36d703];return _0x12c909;};'use strict';var _=require(_0x8100('0x0'));var util=require(_0x8100('0x1'));var moment=require(_0x8100('0x2'));var BPromise=require(_0x8100('0x3'));var rs=require(_0x8100('0x4'));var fs=require('fs');var Redis=require(_0x8100('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8100('0x6'));var logger=require(_0x8100('0x7'))(_0x8100('0x8'));var config=require('../../config/environment');var jayson=require(_0x8100('0x9'));var client=jayson['client'][_0x8100('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2517c3,_0x4ce344,_0x3d3199){return new BPromise(function(_0x9a1166,_0x5e454e){return client[_0x8100('0xb')](_0x2517c3,_0x3d3199)[_0x8100('0xc')](function(_0x82f96a){logger['info'](_0x8100('0xd'),_0x4ce344,_0x8100('0xe'));logger[_0x8100('0xf')](_0x8100('0x10'),_0x4ce344,_0x8100('0xe'),JSON[_0x8100('0x11')](_0x82f96a));if(_0x82f96a['error']){if(_0x82f96a[_0x8100('0x12')][_0x8100('0x13')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4ce344,_0x82f96a[_0x8100('0x12')]['message']);return _0x5e454e(_0x82f96a[_0x8100('0x12')][_0x8100('0x14')]);}logger[_0x8100('0x12')](_0x8100('0xd'),_0x4ce344,_0x82f96a[_0x8100('0x12')]['message']);return _0x9a1166(_0x82f96a[_0x8100('0x12')]['message']);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4ce344,_0x8100('0xe'));_0x9a1166(_0x82f96a[_0x8100('0x15')]['message']);}})[_0x8100('0x16')](function(_0x14aa88){logger[_0x8100('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x4ce344,_0x14aa88);_0x5e454e(_0x14aa88);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4d9284e..cc51c0e 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 _0x90db=['connect-timeout','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','util','path'];(function(_0x54c3c1,_0x42a27a){var _0x24428d=function(_0x5b1a22){while(--_0x5b1a22){_0x54c3c1['push'](_0x54c3c1['shift']());}};_0x24428d(++_0x42a27a);}(_0x90db,0x1c0));var _0xb90d=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x90db[_0x9aada2];return _0x196dff;};'use strict';var multer=require('multer');var util=require(_0xb90d('0x0'));var path=require(_0xb90d('0x1'));var timeout=require(_0xb90d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb90d('0x3'));var controller=require(_0xb90d('0x4'));router[_0xb90d('0x5')]('/',auth[_0xb90d('0x6')](),controller[_0xb90d('0x7')]);router[_0xb90d('0x5')](_0xb90d('0x8'),auth[_0xb90d('0x6')](),controller[_0xb90d('0x9')]);router[_0xb90d('0xa')]('/',auth[_0xb90d('0x6')](),controller[_0xb90d('0xb')]);router['put'](_0xb90d('0x8'),auth[_0xb90d('0x6')](),controller[_0xb90d('0xc')]);router['delete'](_0xb90d('0x8'),auth[_0xb90d('0x6')](),controller[_0xb90d('0xd')]);module[_0xb90d('0xe')]=router; \ No newline at end of file +var _0x874c=['post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../config/environment','./cmContactHasItem.controller','get','/:id','isAuthenticated','show'];(function(_0x3a723e,_0x59d99a){var _0x3e9c03=function(_0x4a6947){while(--_0x4a6947){_0x3a723e['push'](_0x3a723e['shift']());}};_0x3e9c03(++_0x59d99a);}(_0x874c,0x15a));var _0xc874=function(_0x1717cb,_0x301a62){_0x1717cb=_0x1717cb-0x0;var _0x4f7cd5=_0x874c[_0x1717cb];return _0x4f7cd5;};'use strict';var multer=require(_0xc874('0x0'));var util=require('util');var path=require(_0xc874('0x1'));var timeout=require('connect-timeout');var express=require(_0xc874('0x2'));var router=express[_0xc874('0x3')]();var fs_extra=require(_0xc874('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc874('0x5'));var controller=require(_0xc874('0x6'));router[_0xc874('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc874('0x8'),auth[_0xc874('0x9')](),controller[_0xc874('0xa')]);router[_0xc874('0xb')]('/',auth[_0xc874('0x9')](),controller[_0xc874('0xc')]);router[_0xc874('0xd')](_0xc874('0x8'),auth[_0xc874('0x9')](),controller[_0xc874('0xe')]);router[_0xc874('0xf')](_0xc874('0x8'),auth[_0xc874('0x9')](),controller['destroy']);module[_0xc874('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 c53e690..38f7a69 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 _0x740d=['BOOLEAN','ENUM','sequelize','lodash','getDataValue','alias','TEXT','type','select','values','setDataValue','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x740d,0x116));var _0xd740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd740('0x0'));var _=require(_0xd740('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2469f1){return this[_0xd740('0x2')](_0xd740('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x32014e){this['setDataValue'](_0xd740('0x3'),_0x32014e?_0x32014e:this[_0xd740('0x2')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xd740('0x4')]('long'),'get':function(){if(this[_0xd740('0x2')](_0xd740('0x5'))===_0xd740('0x6')){return JSON['parse'](this[_0xd740('0x2')](_0xd740('0x7')));}else{return this[_0xd740('0x2')](_0xd740('0x7'));}},'set':function(_0x4b7b52){if(Array['isArray'](_0x4b7b52)){this[_0xd740('0x8')](_0xd740('0x7'),JSON[_0xd740('0x9')](_0x4b7b52));}else{this[_0xd740('0x8')](_0xd740('0x7'),_0x4b7b52);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd740('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd740('0xb')]('voice')}}; \ No newline at end of file +var _0x98a4=['ENUM','voice','sequelize','getDataValue','alias','STRING','setDataValue','long','parse','values','isArray','stringify','BOOLEAN'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x98a4,0x106));var _0x498a=function(_0x4aa156,_0xb9dd89){_0x4aa156=_0x4aa156-0x0;var _0x3da040=_0x98a4[_0x4aa156];return _0x3da040;};'use strict';var Sequelize=require(_0x498a('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x30081d){return this[_0x498a('0x1')](_0x498a('0x2'));}},'alias':{'type':Sequelize[_0x498a('0x3')],'allowNull':![],'set':function(_0x38ad57){this[_0x498a('0x4')](_0x498a('0x2'),_0x38ad57?_0x38ad57:this[_0x498a('0x1')]('name'));}},'type':{'type':Sequelize[_0x498a('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x498a('0x5')),'get':function(){if(this[_0x498a('0x1')]('type')==='select'){return JSON[_0x498a('0x6')](this[_0x498a('0x1')](_0x498a('0x7')));}else{return this[_0x498a('0x1')](_0x498a('0x7'));}},'set':function(_0xffce6e){if(Array[_0x498a('0x8')](_0xffce6e)){this[_0x498a('0x4')](_0x498a('0x7'),JSON[_0x498a('0x9')](_0xffce6e));}else{this['setDataValue']('values',_0xffce6e);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x498a('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x498a('0xb')](_0x498a('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5a2b664..3bde01c 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 _0xd9ee=['lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','sendStatus','stack','index','map','CmCustomField','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','options','body','find','create','transaction','TEXT','Sequelize','INTEGER','switch','BOOLEAN','sequelize','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra'];(function(_0x4ad16f,_0x32ee30){var _0x37350d=function(_0x560a23){while(--_0x560a23){_0x4ad16f['push'](_0x4ad16f['shift']());}};_0x37350d(++_0x32ee30);}(_0xd9ee,0x9f));var _0xed9e=function(_0x265db6,_0xbef4d4){_0x265db6=_0x265db6-0x0;var _0xbfaf95=_0xd9ee[_0x265db6];return _0xbfaf95;};'use strict';var emlformat=require(_0xed9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed9e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed9e('0x2'));var moment=require(_0xed9e('0x3'));var BPromise=require(_0xed9e('0x4'));var Mustache=require(_0xed9e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xed9e('0x6'));var ejs=require(_0xed9e('0x7'));var fs=require('fs');var fs_extra=require(_0xed9e('0x8'));var _=require(_0xed9e('0x9'));var squel=require(_0xed9e('0xa'));var crypto=require(_0xed9e('0xb'));var jsforce=require(_0xed9e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xed9e('0x6'));var querystring=require(_0xed9e('0xd'));var Papa=require(_0xed9e('0xe'));var Redis=require('ioredis');var authService=require(_0xed9e('0xf'));var qs=require(_0xed9e('0x10'));var as=require(_0xed9e('0x11'));var hardwareService=require(_0xed9e('0x12'));var logger=require(_0xed9e('0x13'))(_0xed9e('0x14'));var utils=require(_0xed9e('0x15'));var config=require(_0xed9e('0x16'));var licenseUtil=require(_0xed9e('0x17'));var db=require(_0xed9e('0x18'))['db'];function respondWithStatusCode(_0x414702,_0x1bb2a6){_0x1bb2a6=_0x1bb2a6||0xcc;return function(_0x321623){if(_0x321623){return _0x414702['sendStatus'](_0x1bb2a6);}return _0x414702[_0xed9e('0x19')](_0x1bb2a6)[_0xed9e('0x1a')]();};}function respondWithResult(_0x41d4eb,_0x1661b0){_0x1661b0=_0x1661b0||0xc8;return function(_0x40eda7){if(_0x40eda7){return _0x41d4eb['status'](_0x1661b0)[_0xed9e('0x1b')](_0x40eda7);}};}function respondWithFilteredResult(_0x15544e,_0x3cdbeb){return function(_0x5cf8fa){if(_0x5cf8fa){var _0x2c67bf=typeof _0x3cdbeb[_0xed9e('0x1c')]===_0xed9e('0x1d')&&typeof _0x3cdbeb['limit']==='undefined';var _0x348db8=_0x5cf8fa[_0xed9e('0x1e')];var _0x31a86f=_0x2c67bf?0x0:_0x3cdbeb[_0xed9e('0x1c')];var _0x3d5adf=_0x2c67bf?_0x5cf8fa[_0xed9e('0x1e')]:_0x3cdbeb[_0xed9e('0x1c')]+_0x3cdbeb[_0xed9e('0x1f')];var _0x253360;if(_0x3d5adf>=_0x348db8){_0x3d5adf=_0x348db8;_0x253360=0xc8;}else{_0x253360=0xce;}_0x15544e['status'](_0x253360);return _0x15544e['set']('Content-Range',_0x31a86f+'-'+_0x3d5adf+'/'+_0x348db8)['json'](_0x5cf8fa);}return null;};}function patchUpdates(_0x1f8c56){return function(_0x27d66d){try{jsonpatch[_0xed9e('0x20')](_0x27d66d,_0x1f8c56,!![]);}catch(_0x30239e){return BPromise[_0xed9e('0x21')](_0x30239e);}return _0x27d66d[_0xed9e('0x22')]();};}function saveUpdates(_0x55af3c,_0x4f36ee){return function(_0x1a755a){if(_0x1a755a){return _0x1a755a[_0xed9e('0x23')](_0x55af3c)[_0xed9e('0x24')](function(_0x3a0120){return _0x3a0120;});}return null;};}function removeEntity(_0x2763be,_0xf9dbb0){return function(_0x485b2c){if(_0x485b2c){return _0x485b2c[_0xed9e('0x25')]()['then'](function(){_0x2763be[_0xed9e('0x19')](0xcc)[_0xed9e('0x1a')]();});}};}function handleEntityNotFound(_0xf9433b,_0x2214f0){return function(_0x31b10b){if(!_0x31b10b){_0xf9433b[_0xed9e('0x26')](0x194);}return _0x31b10b;};}function handleError(_0x2e5f89,_0x541ec2){_0x541ec2=_0x541ec2||0x1f4;return function(_0x645de9){logger['error'](_0x645de9[_0xed9e('0x27')]);if(_0x645de9['name']){delete _0x645de9['name'];}_0x2e5f89[_0xed9e('0x19')](_0x541ec2)['send'](_0x645de9);};}exports[_0xed9e('0x28')]=function(_0x254c59,_0x25ce46){var _0x13a194={},_0x465d00={},_0x525844={'count':0x0,'rows':[]};var _0x366b77=_[_0xed9e('0x29')](db[_0xed9e('0x2a')]['rawAttributes'],function(_0x2d71ee){return{'name':_0x2d71ee[_0xed9e('0x2b')],'type':_0x2d71ee[_0xed9e('0x2c')][_0xed9e('0x2d')]};});_0x465d00[_0xed9e('0x2e')]=_['differenceBy'](_[_0xed9e('0x29')](_0x366b77,'name'),[_0xed9e('0x2f')]);_0x465d00[_0xed9e('0x30')]=_[_0xed9e('0x31')](_0x254c59[_0xed9e('0x30')]);_0x465d00[_0xed9e('0x32')]=_[_0xed9e('0x33')](_0x465d00[_0xed9e('0x2e')],_0x465d00['query']);_0x13a194[_0xed9e('0x34')]=_[_0xed9e('0x33')](_0x465d00[_0xed9e('0x2e')],qs[_0xed9e('0x35')](_0x254c59[_0xed9e('0x30')][_0xed9e('0x35')]));_0x13a194[_0xed9e('0x34')]=_0x13a194[_0xed9e('0x34')][_0xed9e('0x36')]?_0x13a194[_0xed9e('0x34')]:_0x465d00[_0xed9e('0x2e')];if(!_0x254c59[_0xed9e('0x30')][_0xed9e('0x37')](_0xed9e('0x38'))){_0x13a194[_0xed9e('0x1f')]=qs['limit'](_0x254c59[_0xed9e('0x30')][_0xed9e('0x1f')]);_0x13a194[_0xed9e('0x1c')]=qs[_0xed9e('0x1c')](_0x254c59[_0xed9e('0x30')]['offset']);}_0x13a194[_0xed9e('0x39')]=qs['sort'](_0x254c59[_0xed9e('0x30')][_0xed9e('0x3a')]);_0x13a194[_0xed9e('0x3b')]=qs[_0xed9e('0x32')](_[_0xed9e('0x3c')](_0x254c59[_0xed9e('0x30')],_0x465d00['filters']),_0x366b77);if(_0x254c59['query'][_0xed9e('0x3d')]){_0x13a194[_0xed9e('0x3b')]=_[_0xed9e('0x3e')](_0x13a194[_0xed9e('0x3b')],{'$or':_['map'](_0x366b77,function(_0x17372a){if(_0x17372a[_0xed9e('0x2c')]!==_0xed9e('0x3f')){var _0x5216e9={};_0x5216e9[_0x17372a['name']]={'$like':'%'+_0x254c59['query']['filter']+'%'};return _0x5216e9;}})});}_0x13a194=_[_0xed9e('0x3e')]({},_0x13a194,_0x254c59['options']);var _0x57b4bc={'where':_0x13a194[_0xed9e('0x3b')]};return db[_0xed9e('0x2a')]['count'](_0x57b4bc)['then'](function(_0x31e53a){_0x525844[_0xed9e('0x1e')]=_0x31e53a;if(_0x254c59['query']['includeAll']){_0x13a194[_0xed9e('0x40')]=[{'all':!![]}];}return db[_0xed9e('0x2a')][_0xed9e('0x41')](_0x13a194);})[_0xed9e('0x24')](function(_0x1dc3e0){_0x525844['rows']=_0x1dc3e0;return _0x525844;})[_0xed9e('0x24')](respondWithFilteredResult(_0x25ce46,_0x13a194))[_0xed9e('0x42')](handleError(_0x25ce46,null));};exports[_0xed9e('0x43')]=function(_0x5343d0,_0x2d5d22){var _0xdf698={'raw':!![],'where':{'id':_0x5343d0[_0xed9e('0x44')]['id']}},_0xeaeeca={};_0xeaeeca[_0xed9e('0x2e')]=_[_0xed9e('0x31')](db[_0xed9e('0x2a')][_0xed9e('0x45')]);_0xeaeeca[_0xed9e('0x30')]=_[_0xed9e('0x31')](_0x5343d0[_0xed9e('0x30')]);_0xeaeeca['filters']=_[_0xed9e('0x33')](_0xeaeeca[_0xed9e('0x2e')],_0xeaeeca[_0xed9e('0x30')]);_0xdf698[_0xed9e('0x34')]=_[_0xed9e('0x33')](_0xeaeeca[_0xed9e('0x2e')],qs['fields'](_0x5343d0[_0xed9e('0x30')][_0xed9e('0x35')]));_0xdf698[_0xed9e('0x34')]=_0xdf698[_0xed9e('0x34')]['length']?_0xdf698[_0xed9e('0x34')]:_0xeaeeca[_0xed9e('0x2e')];if(_0x5343d0['query']['includeAll']){_0xdf698['include']=[{'all':!![]}];}_0xdf698=_[_0xed9e('0x3e')]({},_0xdf698,_0x5343d0[_0xed9e('0x46')]);return db[_0xed9e('0x2a')]['find'](_0xdf698)['then'](handleEntityNotFound(_0x2d5d22,null))[_0xed9e('0x24')](respondWithResult(_0x2d5d22,null))[_0xed9e('0x42')](handleError(_0x2d5d22,null));};exports[_0xed9e('0x23')]=function(_0x4cb934,_0x19c5e2){if(_0x4cb934['body']['id']){delete _0x4cb934[_0xed9e('0x47')]['id'];}return db[_0xed9e('0x2a')][_0xed9e('0x48')]({'where':{'id':_0x4cb934['params']['id']}})['then'](handleEntityNotFound(_0x19c5e2,null))[_0xed9e('0x24')](saveUpdates(_0x4cb934[_0xed9e('0x47')],null))[_0xed9e('0x24')](respondWithResult(_0x19c5e2,null))[_0xed9e('0x42')](handleError(_0x19c5e2,null));};exports[_0xed9e('0x25')]=function(_0x1af4d5,_0x2ad5e9){return db[_0xed9e('0x2a')][_0xed9e('0x48')]({'where':{'id':_0x1af4d5[_0xed9e('0x44')]['id']}})[_0xed9e('0x24')](handleEntityNotFound(_0x2ad5e9,null))[_0xed9e('0x24')](removeEntity(_0x2ad5e9,null))['catch'](handleError(_0x2ad5e9,null));};exports[_0xed9e('0x49')]=function(_0x3c0e37,_0xd8595e){var _0x4a7c19;return db['sequelize'][_0xed9e('0x4a')](function(_0x5854f8){return db[_0xed9e('0x2a')]['create'](_0x3c0e37[_0xed9e('0x47')],{'transaction':_0x5854f8})['then'](function(_0x35bec2){_0x4a7c19=_0x35bec2;var _0x1274d0={'type':db['Sequelize'][_0xed9e('0x4b')],'transaction':_0x5854f8};switch(_0x3c0e37[_0xed9e('0x47')][_0xed9e('0x2c')]){case'text':_0x1274d0[_0xed9e('0x2c')]=db[_0xed9e('0x4c')][_0xed9e('0x4b')];break;case'number':_0x1274d0[_0xed9e('0x2c')]=db[_0xed9e('0x4c')][_0xed9e('0x4d')];break;case _0xed9e('0x4e'):_0x1274d0[_0xed9e('0x2c')]=db['Sequelize'][_0xed9e('0x4f')];_0x1274d0['defaultValue']=![];break;default:}return db[_0xed9e('0x50')]['queryInterface'][_0xed9e('0x51')](_0xed9e('0x52'),util['format'](_0xed9e('0x53'),_0x4a7c19['id']),_0x1274d0);})[_0xed9e('0x24')](function(){return _0x4a7c19;});})[_0xed9e('0x24')](respondWithResult(_0xd8595e,0xc9))[_0xed9e('0x42')](handleError(_0xd8595e,null));}; \ No newline at end of file +var _0x6670=['defaultValue','queryInterface','addColumn','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','catch','sequelize','transaction','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x6670,0xb2));var _0x0667=function(_0x35ac90,_0x5bae99){_0x35ac90=_0x35ac90-0x0;var _0x38ece2=_0x6670[_0x35ac90];return _0x38ece2;};'use strict';var emlformat=require(_0x0667('0x0'));var rimraf=require(_0x0667('0x1'));var zipdir=require(_0x0667('0x2'));var jsonpatch=require(_0x0667('0x3'));var rp=require('request-promise');var moment=require(_0x0667('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0667('0x5'));var util=require(_0x0667('0x6'));var path=require(_0x0667('0x7'));var sox=require('sox');var csv=require(_0x0667('0x8'));var ejs=require(_0x0667('0x9'));var fs=require('fs');var fs_extra=require(_0x0667('0xa'));var _=require(_0x0667('0xb'));var squel=require(_0x0667('0xc'));var crypto=require(_0x0667('0xd'));var jsforce=require(_0x0667('0xe'));var deskjs=require(_0x0667('0xf'));var toCsv=require(_0x0667('0x8'));var querystring=require(_0x0667('0x10'));var Papa=require(_0x0667('0x11'));var Redis=require(_0x0667('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0667('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0667('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0667('0x15'));var config=require(_0x0667('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x434cff,_0x1cddfb){_0x1cddfb=_0x1cddfb||0xcc;return function(_0x28822b){if(_0x28822b){return _0x434cff[_0x0667('0x17')](_0x1cddfb);}return _0x434cff[_0x0667('0x18')](_0x1cddfb)['end']();};}function respondWithResult(_0x399f99,_0x84664){_0x84664=_0x84664||0xc8;return function(_0x397a93){if(_0x397a93){return _0x399f99[_0x0667('0x18')](_0x84664)['json'](_0x397a93);}};}function respondWithFilteredResult(_0x30435c,_0xfc752e){return function(_0x381e82){if(_0x381e82){var _0xefdf0e=typeof _0xfc752e[_0x0667('0x19')]===_0x0667('0x1a')&&typeof _0xfc752e[_0x0667('0x1b')]==='undefined';var _0x222a4a=_0x381e82[_0x0667('0x1c')];var _0x1dfb8e=_0xefdf0e?0x0:_0xfc752e[_0x0667('0x19')];var _0x413f6c=_0xefdf0e?_0x381e82[_0x0667('0x1c')]:_0xfc752e[_0x0667('0x19')]+_0xfc752e[_0x0667('0x1b')];var _0x7cc524;if(_0x413f6c>=_0x222a4a){_0x413f6c=_0x222a4a;_0x7cc524=0xc8;}else{_0x7cc524=0xce;}_0x30435c['status'](_0x7cc524);return _0x30435c['set'](_0x0667('0x1d'),_0x1dfb8e+'-'+_0x413f6c+'/'+_0x222a4a)[_0x0667('0x1e')](_0x381e82);}return null;};}function patchUpdates(_0x88f348){return function(_0x4ea160){try{jsonpatch[_0x0667('0x1f')](_0x4ea160,_0x88f348,!![]);}catch(_0x204eb1){return BPromise[_0x0667('0x20')](_0x204eb1);}return _0x4ea160[_0x0667('0x21')]();};}function saveUpdates(_0x2b3a49,_0x22a445){return function(_0x25da66){if(_0x25da66){return _0x25da66[_0x0667('0x22')](_0x2b3a49)[_0x0667('0x23')](function(_0x49dfff){return _0x49dfff;});}return null;};}function removeEntity(_0x20fe20,_0x5e3316){return function(_0x3fec36){if(_0x3fec36){return _0x3fec36[_0x0667('0x24')]()['then'](function(){_0x20fe20[_0x0667('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23819f,_0x1da809){return function(_0x2b6bae){if(!_0x2b6bae){_0x23819f['sendStatus'](0x194);}return _0x2b6bae;};}function handleError(_0x304184,_0x1ab89d){_0x1ab89d=_0x1ab89d||0x1f4;return function(_0x557603){logger[_0x0667('0x25')](_0x557603[_0x0667('0x26')]);if(_0x557603[_0x0667('0x27')]){delete _0x557603[_0x0667('0x27')];}_0x304184[_0x0667('0x18')](_0x1ab89d)[_0x0667('0x28')](_0x557603);};}exports[_0x0667('0x29')]=function(_0x18bb7e,_0x226468){var _0x4babf3={},_0x3fab4c={},_0x32d3f2={'count':0x0,'rows':[]};var _0x192d8=_[_0x0667('0x2a')](db[_0x0667('0x2b')]['rawAttributes'],function(_0x567c8d){return{'name':_0x567c8d['fieldName'],'type':_0x567c8d[_0x0667('0x2c')][_0x0667('0x2d')]};});_0x3fab4c[_0x0667('0x2e')]=_[_0x0667('0x2f')](_[_0x0667('0x2a')](_0x192d8,_0x0667('0x27')),[_0x0667('0x27')]);_0x3fab4c[_0x0667('0x30')]=_[_0x0667('0x31')](_0x18bb7e[_0x0667('0x30')]);_0x3fab4c[_0x0667('0x32')]=_['intersection'](_0x3fab4c[_0x0667('0x2e')],_0x3fab4c[_0x0667('0x30')]);_0x4babf3[_0x0667('0x33')]=_[_0x0667('0x34')](_0x3fab4c[_0x0667('0x2e')],qs['fields'](_0x18bb7e[_0x0667('0x30')][_0x0667('0x35')]));_0x4babf3[_0x0667('0x33')]=_0x4babf3[_0x0667('0x33')][_0x0667('0x36')]?_0x4babf3[_0x0667('0x33')]:_0x3fab4c[_0x0667('0x2e')];if(!_0x18bb7e['query'][_0x0667('0x37')](_0x0667('0x38'))){_0x4babf3[_0x0667('0x1b')]=qs[_0x0667('0x1b')](_0x18bb7e[_0x0667('0x30')][_0x0667('0x1b')]);_0x4babf3[_0x0667('0x19')]=qs['offset'](_0x18bb7e[_0x0667('0x30')][_0x0667('0x19')]);}_0x4babf3[_0x0667('0x39')]=qs['sort'](_0x18bb7e[_0x0667('0x30')]['sort']);_0x4babf3[_0x0667('0x3a')]=qs['filters'](_[_0x0667('0x3b')](_0x18bb7e[_0x0667('0x30')],_0x3fab4c[_0x0667('0x32')]),_0x192d8);if(_0x18bb7e[_0x0667('0x30')][_0x0667('0x3c')]){_0x4babf3[_0x0667('0x3a')]=_[_0x0667('0x3d')](_0x4babf3[_0x0667('0x3a')],{'$or':_[_0x0667('0x2a')](_0x192d8,function(_0x375edc){if(_0x375edc['type']!==_0x0667('0x3e')){var _0x4529fe={};_0x4529fe[_0x375edc[_0x0667('0x27')]]={'$like':'%'+_0x18bb7e['query'][_0x0667('0x3c')]+'%'};return _0x4529fe;}})});}_0x4babf3=_[_0x0667('0x3d')]({},_0x4babf3,_0x18bb7e[_0x0667('0x3f')]);var _0x57f327={'where':_0x4babf3[_0x0667('0x3a')]};return db[_0x0667('0x2b')]['count'](_0x57f327)[_0x0667('0x23')](function(_0x168104){_0x32d3f2[_0x0667('0x1c')]=_0x168104;if(_0x18bb7e[_0x0667('0x30')][_0x0667('0x40')]){_0x4babf3[_0x0667('0x41')]=[{'all':!![]}];}return db[_0x0667('0x2b')][_0x0667('0x42')](_0x4babf3);})[_0x0667('0x23')](function(_0xccb7c0){_0x32d3f2[_0x0667('0x43')]=_0xccb7c0;return _0x32d3f2;})[_0x0667('0x23')](respondWithFilteredResult(_0x226468,_0x4babf3))['catch'](handleError(_0x226468,null));};exports[_0x0667('0x44')]=function(_0x4c13cc,_0x2bfa25){var _0x408eeb={'raw':!![],'where':{'id':_0x4c13cc[_0x0667('0x45')]['id']}},_0x4e96de={};_0x4e96de[_0x0667('0x2e')]=_[_0x0667('0x31')](db[_0x0667('0x2b')][_0x0667('0x46')]);_0x4e96de['query']=_['keys'](_0x4c13cc['query']);_0x4e96de[_0x0667('0x32')]=_[_0x0667('0x34')](_0x4e96de[_0x0667('0x2e')],_0x4e96de[_0x0667('0x30')]);_0x408eeb[_0x0667('0x33')]=_[_0x0667('0x34')](_0x4e96de[_0x0667('0x2e')],qs[_0x0667('0x35')](_0x4c13cc[_0x0667('0x30')]['fields']));_0x408eeb[_0x0667('0x33')]=_0x408eeb[_0x0667('0x33')][_0x0667('0x36')]?_0x408eeb[_0x0667('0x33')]:_0x4e96de[_0x0667('0x2e')];if(_0x4c13cc[_0x0667('0x30')][_0x0667('0x40')]){_0x408eeb[_0x0667('0x41')]=[{'all':!![]}];}_0x408eeb=_[_0x0667('0x3d')]({},_0x408eeb,_0x4c13cc[_0x0667('0x3f')]);return db[_0x0667('0x2b')][_0x0667('0x47')](_0x408eeb)[_0x0667('0x23')](handleEntityNotFound(_0x2bfa25,null))['then'](respondWithResult(_0x2bfa25,null))['catch'](handleError(_0x2bfa25,null));};exports[_0x0667('0x22')]=function(_0x53b831,_0x10ae64){if(_0x53b831[_0x0667('0x48')]['id']){delete _0x53b831['body']['id'];}return db['CmCustomField'][_0x0667('0x47')]({'where':{'id':_0x53b831[_0x0667('0x45')]['id']}})[_0x0667('0x23')](handleEntityNotFound(_0x10ae64,null))['then'](saveUpdates(_0x53b831['body'],null))[_0x0667('0x23')](respondWithResult(_0x10ae64,null))[_0x0667('0x49')](handleError(_0x10ae64,null));};exports['destroy']=function(_0x17f47f,_0x4370be){return db[_0x0667('0x2b')][_0x0667('0x47')]({'where':{'id':_0x17f47f[_0x0667('0x45')]['id']}})[_0x0667('0x23')](handleEntityNotFound(_0x4370be,null))[_0x0667('0x23')](removeEntity(_0x4370be,null))[_0x0667('0x49')](handleError(_0x4370be,null));};exports['create']=function(_0x53d467,_0x3a05e7){var _0x42c216;return db[_0x0667('0x4a')][_0x0667('0x4b')](function(_0x576a7a){return db[_0x0667('0x2b')][_0x0667('0x4c')](_0x53d467[_0x0667('0x48')],{'transaction':_0x576a7a})[_0x0667('0x23')](function(_0x3287ab){_0x42c216=_0x3287ab;var _0x1e1210={'type':db[_0x0667('0x4d')][_0x0667('0x4e')],'transaction':_0x576a7a};switch(_0x53d467[_0x0667('0x48')][_0x0667('0x2c')]){case _0x0667('0x4f'):_0x1e1210[_0x0667('0x2c')]=db[_0x0667('0x4d')][_0x0667('0x4e')];break;case'number':_0x1e1210[_0x0667('0x2c')]=db['Sequelize'][_0x0667('0x50')];break;case _0x0667('0x51'):_0x1e1210[_0x0667('0x2c')]=db['Sequelize'][_0x0667('0x52')];_0x1e1210[_0x0667('0x53')]=![];break;default:}return db[_0x0667('0x4a')][_0x0667('0x54')][_0x0667('0x55')]('cm_contacts',util['format'](_0x0667('0x56'),_0x42c216['id']),_0x1e1210);})[_0x0667('0x23')](function(){return _0x42c216;});})[_0x0667('0x23')](respondWithResult(_0x3a05e7,0xc9))['catch'](handleError(_0x3a05e7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e69f93f..5cdf517 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 _0x9801=['api','moment','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0x463080,_0x1c3024){var _0x466b20=function(_0xe4356d){while(--_0xe4356d){_0x463080['push'](_0x463080['shift']());}};_0x466b20(++_0x1c3024);}(_0x9801,0x1ab));var _0x1980=function(_0x4e5868,_0x5c77a6){_0x4e5868=_0x4e5868-0x0;var _0x5d7bcb=_0x9801[_0x4e5868];return _0x5d7bcb;};'use strict';var _=require(_0x1980('0x0'));var util=require(_0x1980('0x1'));var logger=require(_0x1980('0x2'))(_0x1980('0x3'));var moment=require(_0x1980('0x4'));var BPromise=require('bluebird');var rp=require(_0x1980('0x5'));var fs=require('fs');var path=require(_0x1980('0x6'));var rimraf=require(_0x1980('0x7'));var config=require(_0x1980('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x1980('0x9')]=function(_0x42802c,_0x4f8a3e){return _0x42802c['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed76=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','util','../../config/logger','moment','path','rimraf'];(function(_0x7c118d,_0x1aff2b){var _0x4b4a1f=function(_0x40084f){while(--_0x40084f){_0x7c118d['push'](_0x7c118d['shift']());}};_0x4b4a1f(++_0x1aff2b);}(_0xed76,0x1c7));var _0x6ed7=function(_0x4cf645,_0x5a84cc){_0x4cf645=_0x4cf645-0x0;var _0x5e095b=_0xed76[_0x4cf645];return _0x5e095b;};'use strict';var _=require('lodash');var util=require(_0x6ed7('0x0'));var logger=require(_0x6ed7('0x1'))('api');var moment=require(_0x6ed7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ed7('0x3'));var rimraf=require(_0x6ed7('0x4'));var config=require(_0x6ed7('0x5'));var attributes=require(_0x6ed7('0x6'));module[_0x6ed7('0x7')]=function(_0x452aa2,_0x5e3f66){return _0x452aa2[_0x6ed7('0x8')](_0x6ed7('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0fa515e..6a6ac6d 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 _0x5423=['code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x18313b,_0x5c914f){var _0x2ba97d=function(_0x41143d){while(--_0x41143d){_0x18313b['push'](_0x18313b['shift']());}};_0x2ba97d(++_0x5c914f);}(_0x5423,0xae));var _0x3542=function(_0x5418fb,_0x1c6dd1){_0x5418fb=_0x5418fb-0x0;var _0x1ac581=_0x5423[_0x5418fb];return _0x1ac581;};'use strict';var _=require('lodash');var util=require(_0x3542('0x0'));var moment=require(_0x3542('0x1'));var BPromise=require('bluebird');var rs=require(_0x3542('0x2'));var fs=require('fs');var Redis=require(_0x3542('0x3'));var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3542('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3542('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a3a23,_0x2bf218,_0x8b1cf1){return new BPromise(function(_0x2b1990,_0x4ec65b){return client[_0x3542('0x8')](_0x1a3a23,_0x8b1cf1)[_0x3542('0x9')](function(_0x5d1ab5){logger[_0x3542('0xa')](_0x3542('0xb'),_0x2bf218,'request\x20sent');logger['debug'](_0x3542('0xc'),_0x2bf218,_0x3542('0xd'),JSON[_0x3542('0xe')](_0x5d1ab5));if(_0x5d1ab5[_0x3542('0xf')]){if(_0x5d1ab5[_0x3542('0xf')][_0x3542('0x10')]===0x1f4){logger[_0x3542('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2bf218,_0x5d1ab5[_0x3542('0xf')]['message']);return _0x4ec65b(_0x5d1ab5[_0x3542('0xf')]['message']);}logger[_0x3542('0xf')](_0x3542('0xb'),_0x2bf218,_0x5d1ab5[_0x3542('0xf')][_0x3542('0x11')]);return _0x2b1990(_0x5d1ab5[_0x3542('0xf')][_0x3542('0x11')]);}else{logger[_0x3542('0xa')](_0x3542('0xb'),_0x2bf218,_0x3542('0xd'));_0x2b1990(_0x5d1ab5[_0x3542('0x12')][_0x3542('0x11')]);}})['catch'](function(_0x544b8f){logger['error'](_0x3542('0xb'),_0x2bf218,_0x544b8f);_0x4ec65b(_0x544b8f);});});} \ No newline at end of file +var _0xbbb8=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x1ff85b,_0x4c8180){var _0x1abf01=function(_0x3286d4){while(--_0x3286d4){_0x1ff85b['push'](_0x1ff85b['shift']());}};_0x1abf01(++_0x4c8180);}(_0xbbb8,0x151));var _0x8bbb=function(_0x19f3a2,_0x4b1026){_0x19f3a2=_0x19f3a2-0x0;var _0x232dfa=_0xbbb8[_0x19f3a2];return _0x232dfa;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var moment=require('moment');var BPromise=require(_0x8bbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bbb('0x3'));var db=require(_0x8bbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bbb('0x5'))('rpc');var config=require(_0x8bbb('0x6'));var jayson=require(_0x8bbb('0x7'));var client=jayson[_0x8bbb('0x8')][_0x8bbb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16155a,_0x53e252,_0x46b2ff){return new BPromise(function(_0x30b4e0,_0x4bdd1e){return client['request'](_0x16155a,_0x46b2ff)['then'](function(_0x5cebf9){logger[_0x8bbb('0xa')]('CmCustomField,\x20%s,\x20%s',_0x53e252,_0x8bbb('0xb'));logger['debug'](_0x8bbb('0xc'),_0x53e252,_0x8bbb('0xb'),JSON[_0x8bbb('0xd')](_0x5cebf9));if(_0x5cebf9[_0x8bbb('0xe')]){if(_0x5cebf9[_0x8bbb('0xe')][_0x8bbb('0xf')]===0x1f4){logger[_0x8bbb('0xe')](_0x8bbb('0x10'),_0x53e252,_0x5cebf9[_0x8bbb('0xe')]['message']);return _0x4bdd1e(_0x5cebf9['error'][_0x8bbb('0x11')]);}logger[_0x8bbb('0xe')]('CmCustomField,\x20%s,\x20%s',_0x53e252,_0x5cebf9[_0x8bbb('0xe')][_0x8bbb('0x11')]);return _0x30b4e0(_0x5cebf9[_0x8bbb('0xe')][_0x8bbb('0x11')]);}else{logger['info'](_0x8bbb('0x10'),_0x53e252,_0x8bbb('0xb'));_0x30b4e0(_0x5cebf9[_0x8bbb('0x12')][_0x8bbb('0x11')]);}})[_0x8bbb('0x13')](function(_0x1cbedf){logger[_0x8bbb('0xe')]('CmCustomField,\x20%s,\x20%s',_0x53e252,_0x1cbedf);_0x4bdd1e(_0x1cbedf);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4aad6af..b22cc6e 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 _0x3b61=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0x3b61,0x67));var _0x13b6=function(_0xe2c7d7,_0x5ef289){_0xe2c7d7=_0xe2c7d7-0x0;var _0x1d37ad=_0x3b61[_0xe2c7d7];return _0x1d37ad;};'use strict';var multer=require(_0x13b6('0x0'));var util=require(_0x13b6('0x1'));var path=require(_0x13b6('0x2'));var timeout=require(_0x13b6('0x3'));var express=require(_0x13b6('0x4'));var router=express[_0x13b6('0x5')]();var fs_extra=require(_0x13b6('0x6'));var auth=require(_0x13b6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x13b6('0x8'));var controller=require(_0x13b6('0x9'));router[_0x13b6('0xa')]('/',auth['isAuthenticated'](),controller[_0x13b6('0xb')]);router[_0x13b6('0xa')](_0x13b6('0xc'),auth[_0x13b6('0xd')](),controller[_0x13b6('0xe')]);router['post']('/',auth[_0x13b6('0xd')](),controller[_0x13b6('0xf')]);router[_0x13b6('0x10')](_0x13b6('0xc'),auth[_0x13b6('0xd')](),controller[_0x13b6('0x11')]);router[_0x13b6('0x12')](_0x13b6('0xc'),auth[_0x13b6('0xd')](),controller[_0x13b6('0x13')]);module[_0x13b6('0x14')]=router; \ No newline at end of file +var _0xcddb=['post','put','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','get','/:id','show'];(function(_0xffa958,_0x3e59de){var _0x3f07bd=function(_0x4559f9){while(--_0x4559f9){_0xffa958['push'](_0xffa958['shift']());}};_0x3f07bd(++_0x3e59de);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x31fc93,_0x436b6f){_0x31fc93=_0x31fc93-0x0;var _0x40b6f2=_0xcddb[_0x31fc93];return _0x40b6f2;};'use strict';var multer=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var path=require(_0xbcdd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbcdd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbcdd('0x4'));var interaction=require(_0xbcdd('0x5'));var config=require(_0xbcdd('0x6'));var controller=require(_0xbcdd('0x7'));router['get']('/',auth[_0xbcdd('0x8')](),controller['index']);router[_0xbcdd('0x9')](_0xbcdd('0xa'),auth['isAuthenticated'](),controller[_0xbcdd('0xb')]);router[_0xbcdd('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbcdd('0xd')](_0xbcdd('0xa'),auth[_0xbcdd('0x8')](),controller['update']);router[_0xbcdd('0xe')](_0xbcdd('0xa'),auth[_0xbcdd('0x8')](),controller[_0xbcdd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 9a3deda..67efca1 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 _0x2217=['exports','STRING','BOOLEAN','format','INTEGER','DATE','UNSIGNED','contactListQueue','moment'];(function(_0x5d857c,_0x291d00){var _0x6c9d27=function(_0x310e28){while(--_0x310e28){_0x5d857c['push'](_0x5d857c['shift']());}};_0x6c9d27(++_0x291d00);}(_0x2217,0x104));var _0x7221=function(_0x1d216f,_0x318d2d){_0x1d216f=_0x1d216f-0x0;var _0x34cc7e=_0x2217[_0x1d216f];return _0x34cc7e;};'use strict';var moment=require(_0x7221('0x0'));var Sequelize=require('sequelize');module[_0x7221('0x1')]={'phone':{'type':Sequelize[_0x7221('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x7221('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7221('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x7221('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7221('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7221('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7221('0x6')]},'priority':{'type':Sequelize[_0x7221('0x5')](0x2)[_0x7221('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7221('0x5')],'unique':_0x7221('0x8')},'UserId':{'type':Sequelize[_0x7221('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x7221('0x5')],'unique':_0x7221('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x7221('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7221('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7221('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7221('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7221('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7221('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7221('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8769=['contactListQueue','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED'];(function(_0x3cf2f5,_0x59ad0f){var _0x999ad=function(_0x3908d4){while(--_0x3908d4){_0x3cf2f5['push'](_0x3cf2f5['shift']());}};_0x999ad(++_0x59ad0f);}(_0x8769,0xb5));var _0x9876=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x8769[_0x88cd7b];return _0x56fcc8;};'use strict';var moment=require(_0x9876('0x0'));var Sequelize=require('sequelize');module[_0x9876('0x1')]={'phone':{'type':Sequelize[_0x9876('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9876('0x3')],'defaultValue':moment()[_0x9876('0x4')](_0x9876('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9876('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9876('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9876('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9876('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9876('0x3')]},'priority':{'type':Sequelize[_0x9876('0x6')](0x2)[_0x9876('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9876('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9876('0x6')],'unique':_0x9876('0x9')},'ListId':{'type':Sequelize[_0x9876('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x9876('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x9876('0x6')],'unique':_0x9876('0x9')},'CampaignId':{'type':Sequelize[_0x9876('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9876('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9876('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9876('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9876('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9876('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9876('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 18bbcfe..9079649 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 _0x0d4d=['firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','getPreviewRecall','LOCK','dialActive','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','offset','limit','count','Content-Range','json','update','error','stack','send','index','rawAttributes','fieldName','type','key','map','keys','query','model','filters','concat','$and','$gt','$lt','$lte','$ne','$between','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','nolimit','sort','filter','where','name','merge','options','includeAll','include','CmHopper','findAll','then','catch','find','create','body','describe','params','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','state','statedesc','deleted','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId'];(function(_0x36b8b4,_0x2c2fc8){var _0x16dda2=function(_0x326542){while(--_0x326542){_0x36b8b4['push'](_0x36b8b4['shift']());}};_0x16dda2(++_0x2c2fc8);}(_0x0d4d,0x132));var _0xd0d4=function(_0x1414ee,_0x59ae0a){_0x1414ee=_0x1414ee-0x0;var _0x49677c=_0x0d4d[_0x1414ee];return _0x49677c;};'use strict';var moment=require(_0xd0d4('0x0'));var _=require(_0xd0d4('0x1'));var qs=require(_0xd0d4('0x2'));var logger=require(_0xd0d4('0x3'))(_0xd0d4('0x4'));var shared=require(_0xd0d4('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x984664,_0x58909f){_0x58909f=_0x58909f||0xc8;return function(_0x2e99ee){if(_0x2e99ee){return _0x984664[_0xd0d4('0x6')](_0x58909f)['json'](_0x2e99ee);}};}function respondWithFilteredResult(_0x34d93b,_0x3db5ab){return function(_0x1c5d01){if(_0x1c5d01){var _0x5c8c7b=typeof _0x3db5ab[_0xd0d4('0x7')]==='undefined'&&typeof _0x3db5ab[_0xd0d4('0x8')]==='undefined';var _0xdf6916=_0x1c5d01[_0xd0d4('0x9')];var _0xdfcbed=_0x5c8c7b?0x0:_0x3db5ab['offset'];var _0x1ed4da=_0x5c8c7b?_0x1c5d01[_0xd0d4('0x9')]:_0x3db5ab[_0xd0d4('0x7')]+_0x3db5ab[_0xd0d4('0x8')];var _0x1be3fd;if(_0x1ed4da>=_0xdf6916){_0x1ed4da=_0xdf6916;_0x1be3fd=0xc8;}else{_0x1be3fd=0xce;}_0x34d93b[_0xd0d4('0x6')](_0x1be3fd);return _0x34d93b['set'](_0xd0d4('0xa'),_0xdfcbed+'-'+_0x1ed4da+'/'+_0xdf6916)[_0xd0d4('0xb')](_0x1c5d01);}return null;};}function saveUpdates(_0x29ee49,_0x2ddeca){return function(_0x38ca06){if(_0x38ca06){return _0x38ca06[_0xd0d4('0xc')](_0x29ee49)['then'](function(_0x3dc332){return _0x3dc332;});}return null;};}function handleEntityNotFound(_0x2131c8,_0x10a175){return function(_0x5d6dd7){if(!_0x5d6dd7){_0x2131c8['sendStatus'](0x194);}return _0x5d6dd7;};}function handleError(_0x13424f,_0x186405){_0x186405=_0x186405||0x1f4;return function(_0x553b47){logger[_0xd0d4('0xd')](_0x553b47[_0xd0d4('0xe')]);if(_0x553b47['name']){delete _0x553b47['name'];}_0x13424f[_0xd0d4('0x6')](_0x186405)[_0xd0d4('0xf')](_0x553b47);};}exports[_0xd0d4('0x10')]=function(_0x5079d5,_0x5cf4c6){var _0x5eb5e4={},_0x407cda={},_0x1e46db={'count':0x0,'rows':[]};var _0x1e8409=_['map'](db['CmHopper'][_0xd0d4('0x11')],function(_0x4b3b77){return{'name':_0x4b3b77[_0xd0d4('0x12')],'type':_0x4b3b77[_0xd0d4('0x13')][_0xd0d4('0x14')]};});_0x407cda['model']=_[_0xd0d4('0x15')](_0x1e8409,'name');_0x407cda['query']=_[_0xd0d4('0x16')](_0x5079d5[_0xd0d4('0x17')]);_0x407cda['filters']=_['intersection'](_0x407cda[_0xd0d4('0x18')],_0x407cda[_0xd0d4('0x17')]);_0x407cda[_0xd0d4('0x19')]=_[_0xd0d4('0x1a')](_0x407cda[_0xd0d4('0x19')],[_0xd0d4('0x1b'),'$or',_0xd0d4('0x1c'),'$gte',_0xd0d4('0x1d'),_0xd0d4('0x1e'),_0xd0d4('0x1f'),'$eq','$not',_0xd0d4('0x20'),'$notBetween','$in',_0xd0d4('0x21'),_0xd0d4('0x22'),_0xd0d4('0x23'),_0xd0d4('0x24'),'$notILike',_0xd0d4('0x22'),_0xd0d4('0x25'),_0xd0d4('0x26'),_0xd0d4('0x27'),_0xd0d4('0x28')]);_0x5eb5e4[_0xd0d4('0x29')]=_[_0xd0d4('0x2a')](_0x407cda[_0xd0d4('0x18')],qs[_0xd0d4('0x2b')](_0x5079d5['query'][_0xd0d4('0x2b')]));_0x5eb5e4[_0xd0d4('0x29')]=_0x5eb5e4[_0xd0d4('0x29')][_0xd0d4('0x2c')]?_0x5eb5e4[_0xd0d4('0x29')]:_0x407cda[_0xd0d4('0x18')];if(!_0x5079d5['query']['hasOwnProperty'](_0xd0d4('0x2d'))){_0x5eb5e4['limit']=qs[_0xd0d4('0x8')](_0x5079d5[_0xd0d4('0x17')][_0xd0d4('0x8')]);_0x5eb5e4[_0xd0d4('0x7')]=qs[_0xd0d4('0x7')](_0x5079d5[_0xd0d4('0x17')][_0xd0d4('0x7')]);}_0x5eb5e4['order']=qs['sort'](_0x5079d5[_0xd0d4('0x17')][_0xd0d4('0x2e')]);_0x5eb5e4['where']=qs[_0xd0d4('0x19')](_['pick'](_0x5079d5['query'],_0x407cda[_0xd0d4('0x19')]),_0x1e8409);if(_0x5079d5[_0xd0d4('0x17')][_0xd0d4('0x2f')]){_0x5eb5e4[_0xd0d4('0x30')]=_['merge'](_0x5eb5e4['where'],{'$or':_[_0xd0d4('0x15')](_0x1e8409,function(_0xc405d7){if(_0xc405d7[_0xd0d4('0x13')]!=='VIRTUAL'){var _0x180e1f={};_0x180e1f[_0xc405d7[_0xd0d4('0x31')]]={'$like':'%'+_0x5079d5[_0xd0d4('0x17')][_0xd0d4('0x2f')]+'%'};return _0x180e1f;}})});}_0x5eb5e4=_[_0xd0d4('0x32')]({},_0x5eb5e4,_0x5079d5[_0xd0d4('0x33')]);var _0x33479c={'where':_0x5eb5e4[_0xd0d4('0x30')]};return db['CmHopper'][_0xd0d4('0x9')](_0x33479c)['then'](function(_0x4eab36){_0x1e46db[_0xd0d4('0x9')]=_0x4eab36;if(_0x5079d5['query'][_0xd0d4('0x34')]){_0x5eb5e4[_0xd0d4('0x35')]=[{'all':!![]}];}return db[_0xd0d4('0x36')][_0xd0d4('0x37')](_0x5eb5e4);})[_0xd0d4('0x38')](function(_0x3b24c8){_0x1e46db['rows']=_0x3b24c8;return _0x1e46db;})[_0xd0d4('0x38')](respondWithFilteredResult(_0x5cf4c6,_0x5eb5e4))[_0xd0d4('0x39')](handleError(_0x5cf4c6,null));};exports['show']=function(_0x554885,_0x19c4cf){var _0x3e6527={'raw':!![],'where':{'id':_0x554885['params']['id']}},_0x31d268={};_0x31d268[_0xd0d4('0x18')]=_[_0xd0d4('0x16')](db[_0xd0d4('0x36')][_0xd0d4('0x11')]);_0x31d268[_0xd0d4('0x17')]=_[_0xd0d4('0x16')](_0x554885[_0xd0d4('0x17')]);_0x31d268[_0xd0d4('0x19')]=_['intersection'](_0x31d268[_0xd0d4('0x18')],_0x31d268[_0xd0d4('0x17')]);_0x3e6527[_0xd0d4('0x29')]=_['intersection'](_0x31d268[_0xd0d4('0x18')],qs[_0xd0d4('0x2b')](_0x554885['query'][_0xd0d4('0x2b')]));_0x3e6527[_0xd0d4('0x29')]=_0x3e6527[_0xd0d4('0x29')][_0xd0d4('0x2c')]?_0x3e6527[_0xd0d4('0x29')]:_0x31d268[_0xd0d4('0x18')];if(_0x554885['query'][_0xd0d4('0x34')]){_0x3e6527[_0xd0d4('0x35')]=[{'all':!![]}];}_0x3e6527=_[_0xd0d4('0x32')]({},_0x3e6527,_0x554885[_0xd0d4('0x33')]);return db['CmHopper'][_0xd0d4('0x3a')](_0x3e6527)[_0xd0d4('0x38')](handleEntityNotFound(_0x19c4cf,null))[_0xd0d4('0x38')](respondWithResult(_0x19c4cf,null))[_0xd0d4('0x39')](handleError(_0x19c4cf,null));};exports[_0xd0d4('0x3b')]=function(_0x4379e6,_0x1f8678){return db['CmHopper'][_0xd0d4('0x3b')](_0x4379e6[_0xd0d4('0x3c')],{})['then'](respondWithResult(_0x1f8678,0xc9))[_0xd0d4('0x39')](handleError(_0x1f8678,null));};exports[_0xd0d4('0xc')]=function(_0x10c391,_0x1709a3){if(_0x10c391[_0xd0d4('0x3c')]['id']){delete _0x10c391[_0xd0d4('0x3c')]['id'];}return db['CmHopper'][_0xd0d4('0x3a')]({'where':{'id':_0x10c391['params']['id']}})[_0xd0d4('0x38')](handleEntityNotFound(_0x1709a3,null))[_0xd0d4('0x38')](saveUpdates(_0x10c391['body'],null))[_0xd0d4('0x38')](respondWithResult(_0x1709a3,null))['catch'](handleError(_0x1709a3,null));};exports['describe']=function(_0x1dad8b,_0x52ff40){return db[_0xd0d4('0x36')][_0xd0d4('0x3d')]()['then'](respondWithResult(_0x52ff40,null))[_0xd0d4('0x39')](handleError(_0x52ff40,null));};exports['destroy']=function(_0xdf2562,_0x258cd1){var _0x171f9f;var _0x200739=_0xdf2562[_0xd0d4('0x3e')]['id'];return db[_0xd0d4('0x36')][_0xd0d4('0x3a')]({'where':{'id':_0xdf2562[_0xd0d4('0x3e')]['id']}})[_0xd0d4('0x38')](handleEntityNotFound(_0x258cd1,null))['then'](function(_0x5470f2){if(_0x5470f2){return _0x5470f2[_0xd0d4('0x3f')]()[_0xd0d4('0x38')](function(_0x333a5b){return _0x333a5b;});}})[_0xd0d4('0x38')](function(_0x1dd17c){_0x171f9f=_0x1dd17c;if(_0x1dd17c){if(_0x1dd17c[_0xd0d4('0x40')]||_0x1dd17c[_0xd0d4('0x41')]){return db[_0x1dd17c[_0xd0d4('0x40')]?_0xd0d4('0x42'):'Campaign'][_0xd0d4('0x3a')]({'where':{'id':_0x1dd17c['VoiceQueueId']?_0x1dd17c['VoiceQueueId']:_0x1dd17c[_0xd0d4('0x41')]},'attributes':['id','name'],'raw':!![]});}}})[_0xd0d4('0x38')](function(_0x3c8dec){var _0x135cec={};if(_0x3c8dec){_[_0xd0d4('0x32')](_0x135cec,_['omit'](_0x171f9f[_0xd0d4('0x43')],[_0xd0d4('0x44'),'updatedAt','id']));_0x135cec[_0xd0d4('0x45')]=0x15;_0x135cec[_0xd0d4('0x46')]=_0xd0d4('0x47');_0x135cec['campaign']=_0x3c8dec[_0xd0d4('0x31')];_0x135cec['membername']=_0xdf2562[_0xd0d4('0x48')][_0xd0d4('0x31')];_0x135cec[_0xd0d4('0x49')]=_0xdf2562['user']['id'];_0x135cec[_0xd0d4('0x47')]=!![];_0x135cec[_0xd0d4('0x4a')]=moment()[_0xd0d4('0x4b')](_0xd0d4('0x4c'));_0x135cec[_0xd0d4('0x4d')]=_0x171f9f[_0xd0d4('0x4e')];_0x135cec[_0xd0d4('0x4f')]=_0x171f9f[_0xd0d4('0x40')]?_0xd0d4('0x50'):_0xd0d4('0x51');return db[_0xd0d4('0x52')]['find']({'where':{'id':_0x135cec[_0xd0d4('0x53')]},'attributes':[_0xd0d4('0x54'),_0xd0d4('0x55')]})['then'](function(_0x2b8b09){if(!_[_0xd0d4('0x56')](_0x258cd1)&&!_['isNil'](_0x2b8b09[_0xd0d4('0x54')])){_0x135cec[_0xd0d4('0x57')]=_0x2b8b09[_0xd0d4('0x54')];if(!_[_0xd0d4('0x56')](_0x2b8b09[_0xd0d4('0x55')])){_0x135cec['calleridname']+='\x20'+_0x2b8b09[_0xd0d4('0x55')];}}})[_0xd0d4('0x58')](function(){return db[_0xd0d4('0x59')]['create'](_0x135cec);});}})[_0xd0d4('0x38')](function(_0x474102){return db[_0xd0d4('0x5a')][_0xd0d4('0x3f')]({'where':{'CmHopperId':_0x200739}});})[_0xd0d4('0x38')](function(){return _0x258cd1[_0xd0d4('0x6')](0xcc)[_0xd0d4('0x5b')]();})[_0xd0d4('0x39')](handleError(_0x258cd1,null));};exports[_0xd0d4('0x5c')]=function(_0x406bb0,_0x428591){var _0x504728=[];return db[_0xd0d4('0x52')]['describe']()['then'](function(_0x465531){_0x504728=_[_0xd0d4('0x16')](_0x465531);return _0x406bb0[_0xd0d4('0x48')][_0xd0d4('0x5d')]({'where':{'type':_0xd0d4('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xd0d4('0x5f'),_0xd0d4('0x60')],'raw':!![]});})[_0xd0d4('0x38')](function(_0x230164){if(_0x230164&&_0x230164[_0xd0d4('0x2c')]){return db[_0xd0d4('0x61')][_0xd0d4('0x62')](function(_0x6203f5){var _0x3eef0b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xd0d4('0x4c'))},'VoiceQueueId':{'$in':_[_0xd0d4('0x15')](_0x230164,'id')},'$or':[{'UserId':null},{'UserId':_0x406bb0[_0xd0d4('0x48')]['id']}]};var _0x5b7b58={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x230164)[_0xd0d4('0x2f')]([_0xd0d4('0x60'),0x0])['map']('id')[_0xd0d4('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x406bb0['user']['id']}]};var _0x4899e7={'$or':[_0x3eef0b,_0x5b7b58]};var _0x1dfe1f=[];if(_0x406bb0[_0xd0d4('0x3c')][_0xd0d4('0x64')]&&_0x406bb0[_0xd0d4('0x3c')][_0xd0d4('0x64')]===_0xd0d4('0x65')){if(!_['isEmpty'](_0x406bb0[_0xd0d4('0x3c')][_0xd0d4('0x66')])){_0x4899e7['id']={'$in':_0x406bb0[_0xd0d4('0x3c')][_0xd0d4('0x66')]};}_0x1dfe1f=[[_0xd0d4('0x67'),_0xd0d4('0x68')],[_0xd0d4('0x69'),_0x230164[0x0][_0xd0d4('0x5f')]===_0xd0d4('0x68')?_0xd0d4('0x6a'):_0xd0d4('0x68')],db[_0xd0d4('0x61')][_0xd0d4('0x6b')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xd0d4('0x6a')]];}else{if(!_['isEmpty'](_0x406bb0[_0xd0d4('0x3c')][_0xd0d4('0x66')])){_0x4899e7['id']={'$notIn':_0x406bb0[_0xd0d4('0x3c')][_0xd0d4('0x66')]};}_0x1dfe1f=[[_0xd0d4('0x67'),_0xd0d4('0x6a')],[_0xd0d4('0x69'),_0x230164[0x0]['dialOrderByScheduledAt']],db[_0xd0d4('0x61')][_0xd0d4('0x6b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xd0d4('0x68')]];}return db[_0xd0d4('0x36')][_0xd0d4('0x6c')]({'attributes':['id',_0xd0d4('0x6d'),_0xd0d4('0x4e'),_0xd0d4('0x6e')],'where':_0x4899e7,'order':_0x1dfe1f,'transaction':_0x6203f5,'lock':_0x6203f5['LOCK'][_0xd0d4('0x6f')],'include':[{'model':db[_0xd0d4('0x52')],'as':_0xd0d4('0x70'),'attributes':_0x504728,'include':[{'model':db[_0xd0d4('0x71')],'as':_0xd0d4('0x72'),'attributes':['id',_0xd0d4('0x31')]}]},{'model':db[_0xd0d4('0x73')],'as':_0xd0d4('0x74'),'attributes':['id',_0xd0d4('0x31')]},{'model':db[_0xd0d4('0x42')],'as':_0xd0d4('0x75'),'attributes':['id',_0xd0d4('0x31'),'dialActive']}]})[_0xd0d4('0x38')](function(_0x1ded9e){if(_0x1ded9e){return _0x1ded9e[_0xd0d4('0xc')]({'UserId':_0x406bb0[_0xd0d4('0x48')]['id']},{'transaction':_0x6203f5});}});});}})[_0xd0d4('0x38')](handleEntityNotFound(_0x428591,null))[_0xd0d4('0x38')](respondWithResult(_0x428591,null))[_0xd0d4('0x39')](handleError(_0x428591,null));};exports[_0xd0d4('0x76')]=function(_0x2ddc47,_0x14f53c,_0x323cdb){var _0x407b93=[];var _0xce4a32=_0x2ddc47[_0xd0d4('0x3e')]['id'];var _0x1d6dda=_0x2ddc47[_0xd0d4('0x48')]['id'];return db[_0xd0d4('0x52')][_0xd0d4('0x3d')]()[_0xd0d4('0x38')](function(_0x1537b7){_0x407b93=_[_0xd0d4('0x16')](_0x1537b7);return db[_0xd0d4('0x61')][_0xd0d4('0x62')](function(_0x243300){const _0x43f6db={'id':_0xce4a32};return db[_0xd0d4('0x36')][_0xd0d4('0x6c')]({'attributes':['id',_0xd0d4('0x6d'),_0xd0d4('0x6e')],'where':_0x43f6db,'transaction':_0x243300,'lock':_0x243300[_0xd0d4('0x77')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xd0d4('0x70'),'attributes':_0x407b93,'include':[{'model':db[_0xd0d4('0x71')],'as':'Company','attributes':['id',_0xd0d4('0x31')]}]},{'model':db[_0xd0d4('0x73')],'as':_0xd0d4('0x74'),'attributes':['id',_0xd0d4('0x31')]},{'model':db['VoiceQueue'],'as':_0xd0d4('0x75'),'attributes':['id','name',_0xd0d4('0x78')]}]})[_0xd0d4('0x38')](function(_0x4f52d0){if(_0x4f52d0){return _0x4f52d0[_0xd0d4('0xc')]({'UserId':_0x1d6dda},{'transaction':_0x243300});}});});})[_0xd0d4('0x38')](handleEntityNotFound(_0x14f53c,null))[_0xd0d4('0x38')](respondWithResult(_0x14f53c,null))[_0xd0d4('0x39')](handleError(_0x14f53c,null));};exports['getOpenContacts']=function(_0x5bba7a,_0x20a203){return _0x5bba7a['user'][_0xd0d4('0x5d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xd0d4('0x79')},'attributes':['id'],'raw':!![]})[_0xd0d4('0x38')](function(_0x21f021){if(_0x21f021&&_0x21f021['length']){return db[_0xd0d4('0x36')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd0d4('0x4b')](_0xd0d4('0x4c'))},'VoiceQueueId':{'$in':_[_0xd0d4('0x15')](_0x21f021,'id')},'$or':[{'UserId':null},{'UserId':_0x5bba7a[_0xd0d4('0x48')]['id']}]}});}return 0x0;})[_0xd0d4('0x38')](function(_0x320733){if(!_[_0xd0d4('0x56')](_0x320733)&&_[_0xd0d4('0x7a')](_0x320733)){return _0x20a203[_0xd0d4('0x6')](0xc8)[_0xd0d4('0xb')]({'contacts':_0x320733});}else{logger[_0xd0d4('0xd')](_0xd0d4('0x7b'),_0xd0d4('0x7c'),0x194,_0xd0d4('0x7d'));_0x20a203['sendStatus'](0x194);}})[_0xd0d4('0x39')](handleError(_0x20a203,null));};exports['getTimezones']=function(_0xf0b9fb,_0x507ffd){var _0x17a983=shared[_0xd0d4('0x7e')];var _0x5c0612=[];_[_0xd0d4('0x15')](_0x17a983,function(_0x34f9d3){_0x5c0612[_0xd0d4('0x7f')]({'id':_0x34f9d3[_0xd0d4('0x31')],'name':_0x34f9d3[_0xd0d4('0x31')],'utcOffset':_0x34f9d3[_0xd0d4('0x80')]});});return _0x507ffd[_0xd0d4('0x6')](0xc8)[_0xd0d4('0xb')]({'tz':_0x5c0612});};exports[_0xd0d4('0x81')]=function(_0x49d569,_0x508b56){var _0x391bf7=shared['timezones'];var _0x503b71={};if(!_['isNil'](_0x391bf7[_0x49d569[_0xd0d4('0x3c')]['id']]))_0x503b71=_0x391bf7[_0x49d569[_0xd0d4('0x3c')]['id']];return _0x508b56['status'](0xc8)[_0xd0d4('0xb')](_0x503b71);}; \ No newline at end of file +var _0xc492=['$iLike','$overlap','$contained','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmHopper','count','include','show','find','body','params','catch','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','CmContact','firstName','isNil','lastName','finally','create','CmHopperAdditionalPhone','end','getPreview','describe','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','transaction','CmCompany','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/environment','json','offset','undefined','limit','status','set','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','concat','$and','$or','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$notIn','$like'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xc492,0xd7));var _0x2c49=function(_0x31ade1,_0x474d9d){_0x31ade1=_0x31ade1-0x0;var _0x5a5919=_0xc492[_0x31ade1];return _0x5a5919;};'use strict';var moment=require(_0x2c49('0x0'));var _=require(_0x2c49('0x1'));var qs=require(_0x2c49('0x2'));var logger=require('../../config/logger')('api');var shared=require(_0x2c49('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x4c9b2d,_0x555cba){_0x555cba=_0x555cba||0xc8;return function(_0x1de940){if(_0x1de940){return _0x4c9b2d['status'](_0x555cba)[_0x2c49('0x4')](_0x1de940);}};}function respondWithFilteredResult(_0x499c4e,_0x3ad911){return function(_0x9c10f7){if(_0x9c10f7){var _0x4c76dd=typeof _0x3ad911[_0x2c49('0x5')]===_0x2c49('0x6')&&typeof _0x3ad911[_0x2c49('0x7')]===_0x2c49('0x6');var _0x326287=_0x9c10f7['count'];var _0x3d3e2a=_0x4c76dd?0x0:_0x3ad911['offset'];var _0x493cd2=_0x4c76dd?_0x9c10f7['count']:_0x3ad911['offset']+_0x3ad911[_0x2c49('0x7')];var _0x4d07b6;if(_0x493cd2>=_0x326287){_0x493cd2=_0x326287;_0x4d07b6=0xc8;}else{_0x4d07b6=0xce;}_0x499c4e[_0x2c49('0x8')](_0x4d07b6);return _0x499c4e[_0x2c49('0x9')]('Content-Range',_0x3d3e2a+'-'+_0x493cd2+'/'+_0x326287)[_0x2c49('0x4')](_0x9c10f7);}return null;};}function saveUpdates(_0x1cc78b,_0x19f7d9){return function(_0x1e2210){if(_0x1e2210){return _0x1e2210[_0x2c49('0xa')](_0x1cc78b)[_0x2c49('0xb')](function(_0x560c76){return _0x560c76;});}return null;};}function handleEntityNotFound(_0x2006cf,_0x5af5e7){return function(_0x2eeb10){if(!_0x2eeb10){_0x2006cf[_0x2c49('0xc')](0x194);}return _0x2eeb10;};}function handleError(_0x14f529,_0x561d83){_0x561d83=_0x561d83||0x1f4;return function(_0x19f59b){logger[_0x2c49('0xd')](_0x19f59b[_0x2c49('0xe')]);if(_0x19f59b[_0x2c49('0xf')]){delete _0x19f59b[_0x2c49('0xf')];}_0x14f529[_0x2c49('0x8')](_0x561d83)[_0x2c49('0x10')](_0x19f59b);};}exports[_0x2c49('0x11')]=function(_0x1fe9f8,_0x89bcb){var _0x4f6063={},_0x3001af={},_0x3fe920={'count':0x0,'rows':[]};var _0x3dfb36=_[_0x2c49('0x12')](db['CmHopper'][_0x2c49('0x13')],function(_0x578c07){return{'name':_0x578c07[_0x2c49('0x14')],'type':_0x578c07[_0x2c49('0x15')]['key']};});_0x3001af['model']=_[_0x2c49('0x12')](_0x3dfb36,_0x2c49('0xf'));_0x3001af[_0x2c49('0x16')]=_[_0x2c49('0x17')](_0x1fe9f8[_0x2c49('0x16')]);_0x3001af[_0x2c49('0x18')]=_[_0x2c49('0x19')](_0x3001af[_0x2c49('0x1a')],_0x3001af[_0x2c49('0x16')]);_0x3001af['filters']=_[_0x2c49('0x1b')](_0x3001af[_0x2c49('0x18')],[_0x2c49('0x1c'),_0x2c49('0x1d'),'$gt',_0x2c49('0x1e'),_0x2c49('0x1f'),_0x2c49('0x20'),_0x2c49('0x21'),'$eq',_0x2c49('0x22'),_0x2c49('0x23'),_0x2c49('0x24'),'$in',_0x2c49('0x25'),_0x2c49('0x26'),'$notLike',_0x2c49('0x27'),'$notILike','$like',_0x2c49('0x28'),'$contains',_0x2c49('0x29'),'$any']);_0x4f6063[_0x2c49('0x2a')]=_[_0x2c49('0x19')](_0x3001af[_0x2c49('0x1a')],qs[_0x2c49('0x2b')](_0x1fe9f8[_0x2c49('0x16')][_0x2c49('0x2b')]));_0x4f6063[_0x2c49('0x2a')]=_0x4f6063[_0x2c49('0x2a')][_0x2c49('0x2c')]?_0x4f6063[_0x2c49('0x2a')]:_0x3001af['model'];if(!_0x1fe9f8[_0x2c49('0x16')]['hasOwnProperty'](_0x2c49('0x2d'))){_0x4f6063[_0x2c49('0x7')]=qs[_0x2c49('0x7')](_0x1fe9f8[_0x2c49('0x16')][_0x2c49('0x7')]);_0x4f6063[_0x2c49('0x5')]=qs[_0x2c49('0x5')](_0x1fe9f8[_0x2c49('0x16')][_0x2c49('0x5')]);}_0x4f6063[_0x2c49('0x2e')]=qs[_0x2c49('0x2f')](_0x1fe9f8[_0x2c49('0x16')][_0x2c49('0x2f')]);_0x4f6063[_0x2c49('0x30')]=qs['filters'](_['pick'](_0x1fe9f8[_0x2c49('0x16')],_0x3001af[_0x2c49('0x18')]),_0x3dfb36);if(_0x1fe9f8['query'][_0x2c49('0x31')]){_0x4f6063[_0x2c49('0x30')]=_[_0x2c49('0x32')](_0x4f6063[_0x2c49('0x30')],{'$or':_[_0x2c49('0x12')](_0x3dfb36,function(_0x1df5de){if(_0x1df5de[_0x2c49('0x15')]!==_0x2c49('0x33')){var _0x4ed053={};_0x4ed053[_0x1df5de[_0x2c49('0xf')]]={'$like':'%'+_0x1fe9f8[_0x2c49('0x16')]['filter']+'%'};return _0x4ed053;}})});}_0x4f6063=_[_0x2c49('0x32')]({},_0x4f6063,_0x1fe9f8[_0x2c49('0x34')]);var _0xddfe1a={'where':_0x4f6063['where']};return db[_0x2c49('0x35')][_0x2c49('0x36')](_0xddfe1a)[_0x2c49('0xb')](function(_0x321fa3){_0x3fe920[_0x2c49('0x36')]=_0x321fa3;if(_0x1fe9f8[_0x2c49('0x16')]['includeAll']){_0x4f6063[_0x2c49('0x37')]=[{'all':!![]}];}return db[_0x2c49('0x35')]['findAll'](_0x4f6063);})[_0x2c49('0xb')](function(_0x438486){_0x3fe920['rows']=_0x438486;return _0x3fe920;})[_0x2c49('0xb')](respondWithFilteredResult(_0x89bcb,_0x4f6063))['catch'](handleError(_0x89bcb,null));};exports[_0x2c49('0x38')]=function(_0x47773e,_0x477efc){var _0x5a6822={'raw':!![],'where':{'id':_0x47773e['params']['id']}},_0x472d84={};_0x472d84[_0x2c49('0x1a')]=_[_0x2c49('0x17')](db[_0x2c49('0x35')][_0x2c49('0x13')]);_0x472d84[_0x2c49('0x16')]=_['keys'](_0x47773e[_0x2c49('0x16')]);_0x472d84[_0x2c49('0x18')]=_[_0x2c49('0x19')](_0x472d84[_0x2c49('0x1a')],_0x472d84[_0x2c49('0x16')]);_0x5a6822[_0x2c49('0x2a')]=_[_0x2c49('0x19')](_0x472d84[_0x2c49('0x1a')],qs['fields'](_0x47773e[_0x2c49('0x16')][_0x2c49('0x2b')]));_0x5a6822['attributes']=_0x5a6822[_0x2c49('0x2a')][_0x2c49('0x2c')]?_0x5a6822['attributes']:_0x472d84[_0x2c49('0x1a')];if(_0x47773e['query']['includeAll']){_0x5a6822['include']=[{'all':!![]}];}_0x5a6822=_['merge']({},_0x5a6822,_0x47773e[_0x2c49('0x34')]);return db[_0x2c49('0x35')][_0x2c49('0x39')](_0x5a6822)[_0x2c49('0xb')](handleEntityNotFound(_0x477efc,null))[_0x2c49('0xb')](respondWithResult(_0x477efc,null))['catch'](handleError(_0x477efc,null));};exports['create']=function(_0x5757e5,_0x5ee329){return db[_0x2c49('0x35')]['create'](_0x5757e5[_0x2c49('0x3a')],{})['then'](respondWithResult(_0x5ee329,0xc9))['catch'](handleError(_0x5ee329,null));};exports['update']=function(_0x1d4d7b,_0x51e7e5){if(_0x1d4d7b[_0x2c49('0x3a')]['id']){delete _0x1d4d7b[_0x2c49('0x3a')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x1d4d7b[_0x2c49('0x3b')]['id']}})[_0x2c49('0xb')](handleEntityNotFound(_0x51e7e5,null))[_0x2c49('0xb')](saveUpdates(_0x1d4d7b[_0x2c49('0x3a')],null))[_0x2c49('0xb')](respondWithResult(_0x51e7e5,null))['catch'](handleError(_0x51e7e5,null));};exports['describe']=function(_0x426c8a,_0x2587c6){return db['CmHopper']['describe']()['then'](respondWithResult(_0x2587c6,null))[_0x2c49('0x3c')](handleError(_0x2587c6,null));};exports[_0x2c49('0x3d')]=function(_0x98fc90,_0x55e4cd){var _0xf4c2c2;var _0xea11c4=_0x98fc90[_0x2c49('0x3b')]['id'];return db[_0x2c49('0x35')][_0x2c49('0x39')]({'where':{'id':_0x98fc90[_0x2c49('0x3b')]['id']}})[_0x2c49('0xb')](handleEntityNotFound(_0x55e4cd,null))['then'](function(_0x5f2267){if(_0x5f2267){return _0x5f2267['destroy']()[_0x2c49('0xb')](function(_0x1aa034){return _0x1aa034;});}})['then'](function(_0x1ea344){_0xf4c2c2=_0x1ea344;if(_0x1ea344){if(_0x1ea344[_0x2c49('0x3e')]||_0x1ea344[_0x2c49('0x3f')]){return db[_0x1ea344[_0x2c49('0x3e')]?_0x2c49('0x40'):_0x2c49('0x41')][_0x2c49('0x39')]({'where':{'id':_0x1ea344[_0x2c49('0x3e')]?_0x1ea344[_0x2c49('0x3e')]:_0x1ea344[_0x2c49('0x3f')]},'attributes':['id','name'],'raw':!![]});}}})[_0x2c49('0xb')](function(_0xe026bf){var _0xfcdbaf={};if(_0xe026bf){_['merge'](_0xfcdbaf,_[_0x2c49('0x42')](_0xf4c2c2[_0x2c49('0x43')],['createdAt',_0x2c49('0x44'),'id']));_0xfcdbaf[_0x2c49('0x45')]=0x15;_0xfcdbaf[_0x2c49('0x46')]=_0x2c49('0x47');_0xfcdbaf['campaign']=_0xe026bf[_0x2c49('0xf')];_0xfcdbaf[_0x2c49('0x48')]=_0x98fc90[_0x2c49('0x49')][_0x2c49('0xf')];_0xfcdbaf['UserId']=_0x98fc90[_0x2c49('0x49')]['id'];_0xfcdbaf[_0x2c49('0x47')]=!![];_0xfcdbaf[_0x2c49('0x4a')]=moment()[_0x2c49('0x4b')](_0x2c49('0x4c'));_0xfcdbaf[_0x2c49('0x4d')]=_0xf4c2c2[_0x2c49('0x4e')];_0xfcdbaf[_0x2c49('0x4f')]=_0xf4c2c2[_0x2c49('0x3e')]?'queue':'ivr';return db[_0x2c49('0x50')][_0x2c49('0x39')]({'where':{'id':_0xfcdbaf['ContactId']},'attributes':[_0x2c49('0x51'),'lastName']})[_0x2c49('0xb')](function(_0x32b4fd){if(!_[_0x2c49('0x52')](_0x55e4cd)&&!_[_0x2c49('0x52')](_0x32b4fd[_0x2c49('0x51')])){_0xfcdbaf['calleridname']=_0x32b4fd[_0x2c49('0x51')];if(!_[_0x2c49('0x52')](_0x32b4fd[_0x2c49('0x53')])){_0xfcdbaf['calleridname']+='\x20'+_0x32b4fd[_0x2c49('0x53')];}}})[_0x2c49('0x54')](function(){return db['CmHopperFinal'][_0x2c49('0x55')](_0xfcdbaf);});}})[_0x2c49('0xb')](function(_0x547311){return db[_0x2c49('0x56')]['destroy']({'where':{'CmHopperId':_0xea11c4}});})[_0x2c49('0xb')](function(){return _0x55e4cd[_0x2c49('0x8')](0xcc)[_0x2c49('0x57')]();})[_0x2c49('0x3c')](handleError(_0x55e4cd,null));};exports[_0x2c49('0x58')]=function(_0x144658,_0x4a4a2f){var _0xbc3817=[];return db[_0x2c49('0x50')][_0x2c49('0x59')]()['then'](function(_0x1a71da){_0xbc3817=_['keys'](_0x1a71da);return _0x144658['user']['getVoiceQueues']({'where':{'type':_0x2c49('0x5a'),'dialActive':!![],'dialMethod':_0x2c49('0x5b')},'attributes':['id',_0x2c49('0x5c'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x2c49('0xb')](function(_0x57237c){if(_0x57237c&&_0x57237c['length']){return db['sequelize']['transaction'](function(_0x5ae15e){var _0x127dea={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2c49('0x12')](_0x57237c,'id')},'$or':[{'UserId':null},{'UserId':_0x144658['user']['id']}]};var _0x5f28b7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x57237c)['filter']([_0x2c49('0x5d'),0x0])[_0x2c49('0x12')]('id')[_0x2c49('0x5e')]()},'$or':[{'UserId':null},{'UserId':_0x144658[_0x2c49('0x49')]['id']}]};var _0x3fd55e={'$or':[_0x127dea,_0x5f28b7]};var _0x4fef4f=[];if(_0x144658[_0x2c49('0x3a')][_0x2c49('0x5f')]&&_0x144658[_0x2c49('0x3a')][_0x2c49('0x5f')]===_0x2c49('0x60')){if(!_[_0x2c49('0x61')](_0x144658[_0x2c49('0x3a')][_0x2c49('0x62')])){_0x3fd55e['id']={'$in':_0x144658[_0x2c49('0x3a')]['hopperIds']};}_0x4fef4f=[[_0x2c49('0x63'),_0x2c49('0x64')],['scheduledAt',_0x57237c[0x0][_0x2c49('0x5c')]===_0x2c49('0x64')?_0x2c49('0x65'):_0x2c49('0x64')],db[_0x2c49('0x66')][_0x2c49('0x67')](_0x2c49('0x68')),['id',_0x2c49('0x65')]];}else{if(!_[_0x2c49('0x61')](_0x144658[_0x2c49('0x3a')][_0x2c49('0x62')])){_0x3fd55e['id']={'$notIn':_0x144658[_0x2c49('0x3a')]['hopperIds']};}_0x4fef4f=[[_0x2c49('0x63'),_0x2c49('0x65')],[_0x2c49('0x69'),_0x57237c[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x2c49('0x35')][_0x2c49('0x6a')]({'attributes':['id',_0x2c49('0x6b'),_0x2c49('0x4e'),'recallme'],'where':_0x3fd55e,'order':_0x4fef4f,'transaction':_0x5ae15e,'lock':_0x5ae15e[_0x2c49('0x6c')][_0x2c49('0x6d')],'include':[{'model':db[_0x2c49('0x50')],'as':_0x2c49('0x6e'),'attributes':_0xbc3817,'include':[{'model':db['CmCompany'],'as':_0x2c49('0x6f'),'attributes':['id',_0x2c49('0xf')]}]},{'model':db[_0x2c49('0x70')],'as':_0x2c49('0x71'),'attributes':['id','name']},{'model':db[_0x2c49('0x40')],'as':_0x2c49('0x72'),'attributes':['id',_0x2c49('0xf'),_0x2c49('0x73')]}]})['then'](function(_0x7fd1b){if(_0x7fd1b){return _0x7fd1b[_0x2c49('0xa')]({'UserId':_0x144658[_0x2c49('0x49')]['id']},{'transaction':_0x5ae15e});}});});}})[_0x2c49('0xb')](handleEntityNotFound(_0x4a4a2f,null))['then'](respondWithResult(_0x4a4a2f,null))[_0x2c49('0x3c')](handleError(_0x4a4a2f,null));};exports[_0x2c49('0x74')]=function(_0x2df60c,_0x5da8d5,_0x3e7410){var _0x2f0818=[];var _0x2d658c=_0x2df60c[_0x2c49('0x3b')]['id'];var _0x39ce2d=_0x2df60c[_0x2c49('0x49')]['id'];return db[_0x2c49('0x50')][_0x2c49('0x59')]()[_0x2c49('0xb')](function(_0x53b169){_0x2f0818=_[_0x2c49('0x17')](_0x53b169);return db[_0x2c49('0x66')][_0x2c49('0x75')](function(_0x16fd93){const _0xe1417f={'id':_0x2d658c};return db[_0x2c49('0x35')][_0x2c49('0x6a')]({'attributes':['id',_0x2c49('0x6b'),'recallme'],'where':_0xe1417f,'transaction':_0x16fd93,'lock':_0x16fd93[_0x2c49('0x6c')][_0x2c49('0x6d')],'include':[{'model':db[_0x2c49('0x50')],'as':'Contact','attributes':_0x2f0818,'include':[{'model':db[_0x2c49('0x76')],'as':'Company','attributes':['id',_0x2c49('0xf')]}]},{'model':db['CmList'],'as':_0x2c49('0x71'),'attributes':['id',_0x2c49('0xf')]},{'model':db[_0x2c49('0x40')],'as':_0x2c49('0x72'),'attributes':['id',_0x2c49('0xf'),_0x2c49('0x73')]}]})[_0x2c49('0xb')](function(_0x56e8be){if(_0x56e8be){return _0x56e8be[_0x2c49('0xa')]({'UserId':_0x39ce2d},{'transaction':_0x16fd93});}});});})[_0x2c49('0xb')](handleEntityNotFound(_0x5da8d5,null))[_0x2c49('0xb')](respondWithResult(_0x5da8d5,null))[_0x2c49('0x3c')](handleError(_0x5da8d5,null));};exports[_0x2c49('0x77')]=function(_0x19a496,_0x2c5efa){return _0x19a496[_0x2c49('0x49')][_0x2c49('0x78')]({'where':{'type':_0x2c49('0x5a'),'dialActive':!![],'dialMethod':_0x2c49('0x5b')},'attributes':['id'],'raw':!![]})['then'](function(_0x577edb){if(_0x577edb&&_0x577edb[_0x2c49('0x2c')]){return db[_0x2c49('0x35')][_0x2c49('0x36')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2c49('0x4b')](_0x2c49('0x4c'))},'VoiceQueueId':{'$in':_[_0x2c49('0x12')](_0x577edb,'id')},'$or':[{'UserId':null},{'UserId':_0x19a496[_0x2c49('0x49')]['id']}]}});}return 0x0;})['then'](function(_0x1ff359){if(!_[_0x2c49('0x52')](_0x1ff359)&&_['isNumber'](_0x1ff359)){return _0x2c5efa[_0x2c49('0x8')](0xc8)[_0x2c49('0x4')]({'contacts':_0x1ff359});}else{logger[_0x2c49('0xd')](_0x2c49('0x79'),_0x2c49('0x77'),0x194,_0x2c49('0x7a'));_0x2c5efa['sendStatus'](0x194);}})['catch'](handleError(_0x2c5efa,null));};exports[_0x2c49('0x7b')]=function(_0x37ccd9,_0x2b30aa){var _0x4cb76b=shared[_0x2c49('0x7c')];var _0x37d09c=[];_[_0x2c49('0x12')](_0x4cb76b,function(_0x2d9a45){_0x37d09c['push']({'id':_0x2d9a45[_0x2c49('0xf')],'name':_0x2d9a45[_0x2c49('0xf')],'utcOffset':_0x2d9a45[_0x2c49('0x7d')]});});return _0x2b30aa[_0x2c49('0x8')](0xc8)[_0x2c49('0x4')]({'tz':_0x37d09c});};exports[_0x2c49('0x7e')]=function(_0x4fcd43,_0x48e935){var _0x1a477f=shared[_0x2c49('0x7c')];var _0x11a53b={};if(!_[_0x2c49('0x52')](_0x1a477f[_0x4fcd43[_0x2c49('0x3a')]['id']]))_0x11a53b=_0x1a477f[_0x4fcd43['body']['id']];return _0x48e935[_0x2c49('0x8')](0xc8)['json'](_0x11a53b);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 3943004..052f6c0 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 _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x3eb03d,_0x5efbe6){var _0xc11fe2=function(_0x1f14e4){while(--_0x1f14e4){_0x3eb03d['push'](_0x3eb03d['shift']());}};_0xc11fe2(++_0x5efbe6);}(_0x2bd8,0x130));var _0x82bd=function(_0x4e52f4,_0x5dea17){_0x4e52f4=_0x4e52f4-0x0;var _0x560221=_0x2bd8[_0x4e52f4];return _0x560221;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x4b193f,_0x1f0f1d){var _0x2859a3=function(_0x2eaa19){while(--_0x2eaa19){_0x4b193f['push'](_0x4b193f['shift']());}};_0x2859a3(++_0x1f0f1d);}(_0x5496,0x175));var _0x6549=function(_0x252c68,_0x3f278a){_0x252c68=_0x252c68-0x0;var _0x463c41=_0x5496[_0x252c68];return _0x463c41;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 05d7a58..66b7399 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 _0x45de=['attributes','include','map','model','then','stringify','message','error','ShowCmHopper','catch','CreateCmHopper','create','body','info','debug','update','limit','UpdateCmHopper','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','keys','User','name','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','UPDATE','all','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','\x20MINUTE','Agent','voicePause','CmList','List','NOW()','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','raw','where'];(function(_0x1429dd,_0x2046d5){var _0x27e1d7=function(_0x36a051){while(--_0x36a051){_0x1429dd['push'](_0x1429dd['shift']());}};_0x27e1d7(++_0x2046d5);}(_0x45de,0xe4));var _0xe45d=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x45de[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe45d('0x0'));var db=require(_0xe45d('0x1'))['db'];var logger=require(_0xe45d('0x2'))(_0xe45d('0x3'));exports[_0xe45d('0x4')]=function(_0x302528){var _0x2e03db=this;return new Promise(function(_0x3ab02f,_0x2c088b){return db[_0xe45d('0x5')]['findAll']({'raw':_0x302528[_0xe45d('0x6')]?_0x302528[_0xe45d('0x6')][_0xe45d('0x7')]===undefined?!![]:![]:!![],'where':_0x302528[_0xe45d('0x6')]?_0x302528[_0xe45d('0x6')][_0xe45d('0x8')]||null:null,'attributes':_0x302528[_0xe45d('0x6')]?_0x302528[_0xe45d('0x6')][_0xe45d('0x9')]||null:null,'limit':_0x302528[_0xe45d('0x6')]?_0x302528[_0xe45d('0x6')]['limit']||null:null,'include':_0x302528[_0xe45d('0x6')]?_0x302528[_0xe45d('0x6')][_0xe45d('0xa')]?_[_0xe45d('0xb')](_0x302528[_0xe45d('0x6')][_0xe45d('0xa')],function(_0x5ee3a4){return{'model':db[_0x5ee3a4[_0xe45d('0xc')]],'as':_0x5ee3a4['as'],'attributes':_0x5ee3a4['attributes'],'include':_0x5ee3a4[_0xe45d('0xa')]?_['map'](_0x5ee3a4[_0xe45d('0xa')],function(_0x5469ac){return{'model':db[_0x5469ac[_0xe45d('0xc')]],'as':_0x5469ac['as'],'attributes':_0x5469ac['attributes'],'include':_0x5469ac[_0xe45d('0xa')]?_[_0xe45d('0xb')](_0x5469ac['include'],function(_0x2c8ead){return{'model':db[_0x2c8ead[_0xe45d('0xc')]],'as':_0x2c8ead['as'],'attributes':_0x2c8ead['attributes']};}):[]};}):[]};}):[]:[]})[_0xe45d('0xd')](function(_0x151ffc){logger['info'](_0xe45d('0x4'),_0x302528);logger['debug'](_0xe45d('0x4'),_0x302528,JSON[_0xe45d('0xe')](_0x151ffc));_0x3ab02f(_0x151ffc);})['catch'](function(_0x43682e){logger['error']('GetCmHopper',_0x43682e[_0xe45d('0xf')],_0x302528);_0x2c088b(_0x2e03db[_0xe45d('0x10')](0x1f4,_0x43682e[_0xe45d('0xf')]));});});};exports[_0xe45d('0x11')]=function(_0x5780cf){var _0x5d38c6=this;return new Promise(function(_0x2f5aa8,_0x5cfa6b){return db[_0xe45d('0x5')]['find']({'raw':_0x5780cf[_0xe45d('0x6')]?_0x5780cf['options'][_0xe45d('0x7')]===undefined?!![]:![]:!![],'where':_0x5780cf[_0xe45d('0x6')]?_0x5780cf['options'][_0xe45d('0x8')]||null:null,'attributes':_0x5780cf['options']?_0x5780cf[_0xe45d('0x6')]['attributes']||null:null,'include':_0x5780cf[_0xe45d('0x6')]?_0x5780cf[_0xe45d('0x6')][_0xe45d('0xa')]?_[_0xe45d('0xb')](_0x5780cf[_0xe45d('0x6')][_0xe45d('0xa')],function(_0x3a56f1){return{'model':db[_0x3a56f1[_0xe45d('0xc')]],'as':_0x3a56f1['as'],'attributes':_0x3a56f1[_0xe45d('0x9')],'include':_0x3a56f1[_0xe45d('0xa')]?_['map'](_0x3a56f1['include'],function(_0xcd7098){return{'model':db[_0xcd7098[_0xe45d('0xc')]],'as':_0xcd7098['as'],'attributes':_0xcd7098['attributes'],'include':_0xcd7098[_0xe45d('0xa')]?_['map'](_0xcd7098[_0xe45d('0xa')],function(_0x355a71){return{'model':db[_0x355a71['model']],'as':_0x355a71['as'],'attributes':_0x355a71[_0xe45d('0x9')]};}):[]};}):[]};}):[]:[]})[_0xe45d('0xd')](function(_0x3daed9){logger['info'](_0xe45d('0x11'),_0x5780cf);logger['debug'](_0xe45d('0x11'),_0x5780cf,JSON[_0xe45d('0xe')](_0x3daed9));_0x2f5aa8(_0x3daed9);})[_0xe45d('0x12')](function(_0x25d572){logger[_0xe45d('0x10')]('ShowCmHopper',_0x25d572['message'],_0x5780cf);_0x5cfa6b(_0x5d38c6[_0xe45d('0x10')](0x1f4,_0x25d572[_0xe45d('0xf')]));});});};exports[_0xe45d('0x13')]=function(_0x5cc6b2){var _0x532d7c=this;return new Promise(function(_0x4477e4,_0x530eb5){return db['CmHopper'][_0xe45d('0x14')](_0x5cc6b2[_0xe45d('0x15')],{'raw':_0x5cc6b2[_0xe45d('0x6')]?_0x5cc6b2[_0xe45d('0x6')]['raw']===undefined?!![]:![]:!![]})[_0xe45d('0xd')](function(_0x56419e){logger[_0xe45d('0x16')](_0xe45d('0x13'),_0x5cc6b2);logger[_0xe45d('0x17')](_0xe45d('0x13'),_0x5cc6b2,JSON[_0xe45d('0xe')](_0x56419e));_0x4477e4(_0x56419e);})[_0xe45d('0x12')](function(_0x3445d2){logger[_0xe45d('0x10')](_0xe45d('0x13'),_0x3445d2['message'],_0x5cc6b2);_0x530eb5(_0x532d7c[_0xe45d('0x10')](0x1f4,_0x3445d2['message']));});});};exports['UpdateCmHopper']=function(_0x14ad9e){var _0x3bd7eb=this;return new Promise(function(_0x568fa6,_0x386653){return db[_0xe45d('0x5')][_0xe45d('0x18')](_0x14ad9e[_0xe45d('0x15')],{'raw':_0x14ad9e[_0xe45d('0x6')]?_0x14ad9e[_0xe45d('0x6')][_0xe45d('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14ad9e[_0xe45d('0x6')]?_0x14ad9e[_0xe45d('0x6')][_0xe45d('0x8')]||null:null,'attributes':_0x14ad9e[_0xe45d('0x6')]?_0x14ad9e[_0xe45d('0x6')]['attributes']||null:null,'limit':_0x14ad9e[_0xe45d('0x6')]?_0x14ad9e['options'][_0xe45d('0x19')]||null:null})[_0xe45d('0xd')](function(_0x23b2cc){logger[_0xe45d('0x16')](_0xe45d('0x1a'),_0x14ad9e);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xe45d('0xe')](_0x14ad9e[_0xe45d('0x6')][_0xe45d('0x8')]),_0x14ad9e[_0xe45d('0x15')][_0xe45d('0x1b')]);logger[_0xe45d('0x17')]('UpdateCmHopper',_0x14ad9e,JSON[_0xe45d('0xe')](_0x23b2cc));_0x568fa6(_0x23b2cc);})[_0xe45d('0x12')](function(_0x3aef20){logger[_0xe45d('0x10')](_0xe45d('0x1a'),_0x3aef20['message'],_0x14ad9e);_0x386653(_0x3bd7eb[_0xe45d('0x10')](0x1f4,_0x3aef20[_0xe45d('0xf')]));});});};exports[_0xe45d('0x1c')]=function(_0xe7e526){var _0x56ebe1=this;return new Promise(function(_0xee7c5b,_0x5d1b29){return db[_0xe45d('0x5')][_0xe45d('0x1d')]({'where':_0xe7e526[_0xe45d('0x6')]?_0xe7e526['options']['where']||null:null})[_0xe45d('0xd')](function(_0x30b76a){logger['info'](_0xe45d('0x1c'),_0xe7e526);logger[_0xe45d('0x17')](_0xe45d('0x1c'),_0xe7e526,JSON['stringify'](_0x30b76a));_0xee7c5b(_0x30b76a);})[_0xe45d('0x12')](function(_0x598e5d){logger[_0xe45d('0x10')](_0xe45d('0x1c'),_0x598e5d[_0xe45d('0xf')],_0xe7e526);_0x5d1b29(_0x56ebe1[_0xe45d('0x10')](0x1f4,_0x598e5d[_0xe45d('0xf')]));});});};exports['GetContactDialer']=function(_0x5079eb){var _0xfb920=this;return new Promise(function(_0x4aaf34,_0x461d74){return db[_0xe45d('0x1e')][_0xe45d('0x1f')]()[_0xe45d('0xd')](function(_0x4712e6){return db[_0xe45d('0x20')][_0xe45d('0x21')](function(_0xdc8bb5){return db[_0xe45d('0x5')][_0xe45d('0x22')]({'where':_0x5079eb[_0xe45d('0x6')]?_0x5079eb['options'][_0xe45d('0x8')]||null:null,'attributes':_0x5079eb[_0xe45d('0x6')]?_0x5079eb[_0xe45d('0x6')][_0xe45d('0x9')]||null:null,'limit':_0x5079eb['options']?_0x5079eb[_0xe45d('0x6')][_0xe45d('0x19')]||null:null,'order':_0x5079eb[_0xe45d('0x6')]?_0x5079eb[_0xe45d('0x6')][_0xe45d('0x23')]||null:null,'transaction':_0xdc8bb5,'lock':_0xdc8bb5[_0xe45d('0x24')]['UPDATE'],'include':[{'model':db[_0xe45d('0x1e')],'as':'Contact','attributes':_[_0xe45d('0x25')](_0x4712e6)},{'model':db[_0xe45d('0x26')],'as':'Agent','attributes':['id',_0xe45d('0x27'),'voicePause']}]})[_0xe45d('0xd')](function(_0x2f1c9e){var _0x5d78e6=[];var _0xc4b912=[];for(var _0x1e105b=0x0;_0x1e105b<_0x2f1c9e[_0xe45d('0x28')];_0x1e105b+=0x1){var _0x3a1b10=_0x2f1c9e[_0x1e105b][_0xe45d('0x29')];if(_0x3a1b10===null){_0x5d78e6[_0xe45d('0x2a')](_0x2f1c9e[_0x1e105b][_0xe45d('0x18')](_0x5079eb[_0xe45d('0x15')],{'transaction':_0xdc8bb5}));}else if(!_0xc4b912[_0xe45d('0x2b')](_0x3a1b10)){_0xc4b912['push'](_0x3a1b10);_0x5d78e6[_0xe45d('0x2a')](_0x2f1c9e[_0x1e105b][_0xe45d('0x18')](_0x5079eb[_0xe45d('0x15')],{'transaction':_0xdc8bb5}));}}return BPromise['all'](_0x5d78e6);});})['then'](function(_0xd6bc41){logger[_0xe45d('0x16')]('GetContactDialer',_0x5079eb);if(_0xd6bc41['length']>0x0){logger[_0xe45d('0x16')](_0xe45d('0x2c'),_0xd6bc41[0x0][_0xe45d('0x2d')]['id'],_0xd6bc41[0x0][_0xe45d('0x2d')]['ContactId'],_0xd6bc41[0x0][_0xe45d('0x2d')]['active']);}logger[_0xe45d('0x17')](_0xe45d('0x2e'),_0x5079eb,JSON[_0xe45d('0xe')](_0xd6bc41));_0x4aaf34(_0xd6bc41);})[_0xe45d('0x12')](function(_0x24f029){logger[_0xe45d('0x10')](_0xe45d('0x2e'),_0x24f029[_0xe45d('0xf')],_0x5079eb);_0x461d74(_0xfb920[_0xe45d('0x10')](0x1f4,_0x24f029[_0xe45d('0xf')]));});});});};exports[_0xe45d('0x2f')]=function(_0x44d17e){var _0x3d5109=this;return new Promise(function(_0x1f7cc8,_0x65c149){return db[_0xe45d('0x20')]['transaction'](function(_0x3f4240){return db[_0xe45d('0x30')][_0xe45d('0x14')](_0x44d17e['body'],{'raw':_0x44d17e[_0xe45d('0x6')]?_0x44d17e[_0xe45d('0x6')][_0xe45d('0x7')]===undefined?!![]:![]:!![],'transaction':_0x3f4240})[_0xe45d('0xd')](function(){logger[_0xe45d('0x16')](_0xe45d('0x31'),JSON[_0xe45d('0xe')](_0x44d17e[_0xe45d('0x6')][_0xe45d('0x8')]),_0x44d17e[_0xe45d('0x6')][_0xe45d('0x8')]['active']);return db['CmHopper'][_0xe45d('0x1d')]({'where':_0x44d17e[_0xe45d('0x6')]?_0x44d17e[_0xe45d('0x6')][_0xe45d('0x8')]||null:null,'transaction':_0x3f4240});});})[_0xe45d('0xd')](function(_0x366d78){logger[_0xe45d('0x16')]('MoveContactManagedDialer',_0x44d17e);logger[_0xe45d('0x17')](_0xe45d('0x2f'),_0x44d17e,JSON[_0xe45d('0xe')](_0x366d78));_0x1f7cc8(_0x366d78);})[_0xe45d('0x12')](function(_0x3b7657){logger[_0xe45d('0x10')](_0xe45d('0x2f'),_0x3b7657[_0xe45d('0xf')],_0x44d17e);_0x65c149(_0x3d5109['error'](0x1f4,_0x3b7657[_0xe45d('0xf')]));});});};exports[_0xe45d('0x32')]=function(_0x253c45){var _0x34018c=this;return new Promise(function(_0x5f38bd,_0x36c78b){return db['CmHopper'][_0xe45d('0x22')]({'raw':_0x253c45[_0xe45d('0x6')]?_0x253c45[_0xe45d('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x253c45[_0xe45d('0x6')]?_0x253c45[_0xe45d('0x6')][_0xe45d('0x8')]||null:null,'attributes':[[db[_0xe45d('0x20')]['fn'](_0xe45d('0x33'),db[_0xe45d('0x20')]['fn']('IF',db[_0xe45d('0x20')]['literal'](_0xe45d('0x34')+util[_0xe45d('0x35')](_0xe45d('0x36'),moment()['format'](_0xe45d('0x37')))+'\x20,\x201,\x20null'))),_0xe45d('0x38')]]})[_0xe45d('0xd')](function(_0x2688da){logger[_0xe45d('0x16')](_0xe45d('0x32'),_0x253c45);logger['debug'](_0xe45d('0x32'),_0x253c45,JSON['stringify'](_0x2688da));_0x5f38bd(_0x2688da);})[_0xe45d('0x12')](function(_0x59826c){logger[_0xe45d('0x10')](_0xe45d('0x32'),_0x59826c[_0xe45d('0xf')],_0x253c45);_0x36c78b(_0x34018c['error'](0x1f4,_0x59826c['message']));});});};exports['GetContactRecallMe']=function(_0x3a1230){var _0xe23f97=this;return new Promise(function(_0x526814,_0x560904){return db[_0xe45d('0x1e')][_0xe45d('0x1f')]()[_0xe45d('0xd')](function(){return db[_0xe45d('0x20')]['transaction'](function(_0x4cbf9e){return db[_0xe45d('0x5')][_0xe45d('0x22')]({'where':_0x3a1230[_0xe45d('0x6')]?_0x3a1230[_0xe45d('0x6')][_0xe45d('0x8')]||null:null,'attributes':_0x3a1230[_0xe45d('0x6')]?_0x3a1230[_0xe45d('0x6')][_0xe45d('0x9')]||null:null,'limit':0x1,'order':_0x3a1230[_0xe45d('0x6')]?_0x3a1230[_0xe45d('0x6')]['order']||null:null,'group':db[_0xe45d('0x5')][_0xe45d('0x29')],'transaction':_0x4cbf9e,'lock':_0x4cbf9e[_0xe45d('0x24')][_0xe45d('0x39')],'include':_0x3a1230[_0xe45d('0x6')]?_0x3a1230[_0xe45d('0x6')][_0xe45d('0xa')]?_[_0xe45d('0xb')](_0x3a1230['options'][_0xe45d('0xa')],function(_0x5c606c){return{'model':db[_0x5c606c[_0xe45d('0xc')]],'as':_0x5c606c['as'],'attributes':_0x5c606c[_0xe45d('0x9')],'include':_0x5c606c[_0xe45d('0xa')]?_[_0xe45d('0xb')](_0x5c606c[_0xe45d('0xa')],function(_0x3d23ac){return{'model':db[_0x3d23ac[_0xe45d('0xc')]],'as':_0x3d23ac['as'],'attributes':_0x3d23ac[_0xe45d('0x9')],'include':_0x3d23ac['include']?_[_0xe45d('0xb')](_0x3d23ac[_0xe45d('0xa')],function(_0x481e0f){return{'model':db[_0x481e0f[_0xe45d('0xc')]],'as':_0x481e0f['as'],'attributes':_0x481e0f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe45d('0xd')](function(_0x5f3a33){var _0x324161=[];for(var _0x505e31=0x0;_0x505e31<_0x5f3a33['length'];_0x505e31+=0x1){_0x324161[_0xe45d('0x2a')](_0x5f3a33[_0x505e31][_0xe45d('0x18')](_0x3a1230[_0xe45d('0x15')],{'transaction':_0x4cbf9e}));}return BPromise[_0xe45d('0x3a')](_0x324161);});})['then'](function(_0x5c8c27){logger[_0xe45d('0x16')](_0xe45d('0x3b'),_0x3a1230);logger[_0xe45d('0x17')]('GetContactRecallMe',_0x3a1230,JSON['stringify'](_0x5c8c27));_0x526814(_0x5c8c27);})['catch'](function(_0x117b65){logger[_0xe45d('0x10')](_0xe45d('0x3b'),_0x117b65[_0xe45d('0xf')],_0x3a1230);_0x560904(_0xe23f97[_0xe45d('0x10')](0x1f4,_0x117b65[_0xe45d('0xf')]));});});});};exports[_0xe45d('0x3c')]=function(_0x2b471c){var _0x1c80ec=this;return new Promise(function(_0x48961d,_0x2b0662){db['CmContact'][_0xe45d('0x1f')]()[_0xe45d('0xd')](function(_0x12759d){return db[_0xe45d('0x5')][_0xe45d('0x22')]({'raw':_0x2b471c[_0xe45d('0x6')]?_0x2b471c[_0xe45d('0x6')][_0xe45d('0x7')]===undefined?!![]:![]:!![],'where':_0x2b471c[_0xe45d('0x6')]?_0x2b471c[_0xe45d('0x6')][_0xe45d('0x8')]||null:null,'attributes':_0x2b471c[_0xe45d('0x6')]?_0x2b471c[_0xe45d('0x6')][_0xe45d('0x9')]||null:null,'limit':_0x2b471c[_0xe45d('0x6')]?_0x2b471c['options'][_0xe45d('0x19')]||null:null,'include':_0x2b471c[_0xe45d('0x6')]?_0x2b471c[_0xe45d('0x6')]['include']?_[_0xe45d('0xb')](_0x2b471c[_0xe45d('0x6')][_0xe45d('0xa')],function(_0x54ee74){return{'model':db[_0x54ee74[_0xe45d('0xc')]],'as':_0x54ee74['as'],'attributes':_0x54ee74['as']===_0xe45d('0x3d')?_[_0xe45d('0x25')](_0x12759d):_0x54ee74['attributes'],'include':_0x54ee74[_0xe45d('0xa')]?_[_0xe45d('0xb')](_0x54ee74[_0xe45d('0xa')],function(_0x9034d4){return{'model':db[_0x9034d4[_0xe45d('0xc')]],'as':_0x9034d4['as'],'attributes':_0x9034d4[_0xe45d('0x9')],'include':_0x9034d4[_0xe45d('0xa')]?_[_0xe45d('0xb')](_0x9034d4['include'],function(_0x3177aa){return{'model':db[_0x3177aa[_0xe45d('0xc')]],'as':_0x3177aa['as'],'attributes':_0x3177aa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x315c6a){logger['info'](_0xe45d('0x4'),_0x2b471c);logger[_0xe45d('0x17')]('GetCmHopper',_0x2b471c,JSON[_0xe45d('0xe')](_0x315c6a));_0x48961d(_0x315c6a);})[_0xe45d('0x12')](function(_0x7bc9d3){logger['error']('GetCmHopper',_0x7bc9d3[_0xe45d('0xf')],_0x2b471c);_0x2b0662(_0x1c80ec[_0xe45d('0x10')](0x1f4,_0x7bc9d3['message']));});});});};exports[_0xe45d('0x3e')]=function(_0xf1f020){var _0x21c139=this;return new Promise(function(_0x3e06bc,_0x32e833){return db[_0xe45d('0x1e')]['findOne']({'raw':!![],'where':{'phone':_0xf1f020[_0xe45d('0x6')][_0xe45d('0x8')][_0xe45d('0x3f')]},'attributes':['id',_0xe45d('0x40')],'order':[['id',_0xe45d('0x41')]]})[_0xe45d('0xd')](function(_0x442fce){logger[_0xe45d('0x16')](_0xe45d('0x42'),_0xf1f020);logger[_0xe45d('0x17')](_0xe45d('0x42'),_0xf1f020,JSON[_0xe45d('0xe')](_0x442fce));_0x3e06bc(_0x442fce);})['catch'](function(_0x372502){logger[_0xe45d('0x10')](_0xe45d('0x42'),_0x372502[_0xe45d('0xf')],_0xf1f020);_0x32e833(_0x21c139[_0xe45d('0x10')](0x1f4,_0x372502[_0xe45d('0xf')]));});});};exports[_0xe45d('0x43')]=function(_0x5afd84){var _0x55482b=this;return new Promise(function(_0x27ff36,_0x59185f){return db[_0xe45d('0x20')][_0xe45d('0x21')](function(_0x375bc1){var _0x259c24=_0x5afd84[_0xe45d('0x6')]&&_0x5afd84[_0xe45d('0x6')][_0xe45d('0x8')]?_0x5afd84[_0xe45d('0x6')][_0xe45d('0x8')]:{};return db[_0xe45d('0x5')][_0xe45d('0x18')](_0x5afd84[_0xe45d('0x15')],{'where':_0x259c24,'transaction':_0x375bc1})[_0xe45d('0xd')](function(_0x15eb19){logger[_0xe45d('0x16')](_0xe45d('0x43'),_0x5afd84);logger[_0xe45d('0x17')](_0xe45d('0x43'),_0x5afd84,JSON[_0xe45d('0xe')](_0x15eb19));_0x27ff36(_0x15eb19);})[_0xe45d('0x12')](function(_0x4c661a){logger['error'](_0xe45d('0x43'),_0x4c661a['message'],_0x5afd84);_0x59185f(_0x55482b['error'](0x1f4,_0x4c661a[_0xe45d('0xf')]));});});});};exports[_0xe45d('0x44')]=function(_0x3f4546){var _0x3e77cf=this;var _0x4d5790=_0x3f4546[_0xe45d('0x15')][_0xe45d('0x8')][_0xe45d('0x45')];var _0x2a7132=_0x3f4546[_0xe45d('0x15')][_0xe45d('0x8')][_0xe45d('0x46')];var _0x23ea56=_0x3f4546['body']['where'][_0xe45d('0x47')];return new Promise(function(_0x135b5e,_0x1b2aa0){return db[_0xe45d('0x5')][_0xe45d('0x22')]({'where':{'voiceQueueId':{'$in':_0x4d5790},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xe45d('0x48')]('NOW()\x20+\x20INTERVAL\x20'+_0x2a7132+_0xe45d('0x49')),'$gt':db[_0xe45d('0x20')]['literal']('NOW()')}},'UserId':{'$in':_0x23ea56}},'include':[{'model':db[_0xe45d('0x1e')],'as':_0xe45d('0x3d')},{'model':db[_0xe45d('0x26')],'as':_0xe45d('0x4a'),'attributes':['id','name',_0xe45d('0x4b')]},{'model':db[_0xe45d('0x4c')],'as':_0xe45d('0x4d')}]})[_0xe45d('0xd')](function(_0x4b3480){if(_0x4b3480[_0xe45d('0x28')]>0x0){return db['sequelize'][_0xe45d('0x21')](function(_0x26304a){return db[_0xe45d('0x5')][_0xe45d('0x18')]({'recallmeNotifiedDate':db[_0xe45d('0x20')][_0xe45d('0x48')](_0xe45d('0x4e'))},{'where':{'id':{'$in':_[_0xe45d('0xb')](_0x4b3480,'id')}},'transaction':_0x26304a})['then'](function(){_0x135b5e(_0x4b3480);})[_0xe45d('0x12')](function(_0x25ab82){logger['error'](_0xe45d('0x44'),_0x25ab82[_0xe45d('0xf')],_0x3f4546);_0x1b2aa0(_0x3e77cf['error'](0x1f4,_0x25ab82['message']));});})['catch'](function(_0x2c5735){logger[_0xe45d('0x10')](_0xe45d('0x44'),_0x2c5735[_0xe45d('0xf')],_0x3f4546);_0x1b2aa0(_0x3e77cf[_0xe45d('0x10')](0x1f4,_0x2c5735[_0xe45d('0xf')]));});}else{_0x135b5e(_0x4b3480);}});});}; \ No newline at end of file +var _0x600a=['dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','User','name','List','lodash','util','moment','../../mysqldb','findAll','raw','options','where','attributes','include','map','model','then','info','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','CreateCmHopper','body','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','transaction','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','length','UserId','push','update'];(function(_0x47ab21,_0x3907b6){var _0x1104e3=function(_0x49bfda){while(--_0x49bfda){_0x47ab21['push'](_0x47ab21['shift']());}};_0x1104e3(++_0x3907b6);}(_0x600a,0x19c));var _0xa600=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0x600a[_0x582d0b];return _0x2e93e1;};'use strict';var _=require(_0xa600('0x0'));var util=require(_0xa600('0x1'));var moment=require(_0xa600('0x2'));var BPromise=require('bluebird');var db=require(_0xa600('0x3'))['db'];var logger=require('../../config/logger')('rpc');exports['GetCmHopper']=function(_0x4927aa){var _0x5a7cd0=this;return new Promise(function(_0x26635d,_0x4ef674){return db['CmHopper'][_0xa600('0x4')]({'raw':_0x4927aa['options']?_0x4927aa['options'][_0xa600('0x5')]===undefined?!![]:![]:!![],'where':_0x4927aa[_0xa600('0x6')]?_0x4927aa[_0xa600('0x6')][_0xa600('0x7')]||null:null,'attributes':_0x4927aa[_0xa600('0x6')]?_0x4927aa['options'][_0xa600('0x8')]||null:null,'limit':_0x4927aa[_0xa600('0x6')]?_0x4927aa[_0xa600('0x6')]['limit']||null:null,'include':_0x4927aa[_0xa600('0x6')]?_0x4927aa['options'][_0xa600('0x9')]?_[_0xa600('0xa')](_0x4927aa[_0xa600('0x6')]['include'],function(_0x5ed023){return{'model':db[_0x5ed023[_0xa600('0xb')]],'as':_0x5ed023['as'],'attributes':_0x5ed023[_0xa600('0x8')],'include':_0x5ed023[_0xa600('0x9')]?_['map'](_0x5ed023[_0xa600('0x9')],function(_0x441954){return{'model':db[_0x441954[_0xa600('0xb')]],'as':_0x441954['as'],'attributes':_0x441954['attributes'],'include':_0x441954[_0xa600('0x9')]?_['map'](_0x441954[_0xa600('0x9')],function(_0xf861ef){return{'model':db[_0xf861ef['model']],'as':_0xf861ef['as'],'attributes':_0xf861ef[_0xa600('0x8')]};}):[]};}):[]};}):[]:[]})[_0xa600('0xc')](function(_0x482ed1){logger[_0xa600('0xd')](_0xa600('0xe'),_0x4927aa);logger[_0xa600('0xf')](_0xa600('0xe'),_0x4927aa,JSON[_0xa600('0x10')](_0x482ed1));_0x26635d(_0x482ed1);})[_0xa600('0x11')](function(_0x232bd3){logger[_0xa600('0x12')]('GetCmHopper',_0x232bd3[_0xa600('0x13')],_0x4927aa);_0x4ef674(_0x5a7cd0[_0xa600('0x12')](0x1f4,_0x232bd3['message']));});});};exports[_0xa600('0x14')]=function(_0x4325c1){var _0x1fd903=this;return new Promise(function(_0x15a257,_0x5439af){return db[_0xa600('0x15')][_0xa600('0x16')]({'raw':_0x4325c1[_0xa600('0x6')]?_0x4325c1[_0xa600('0x6')][_0xa600('0x5')]===undefined?!![]:![]:!![],'where':_0x4325c1[_0xa600('0x6')]?_0x4325c1[_0xa600('0x6')][_0xa600('0x7')]||null:null,'attributes':_0x4325c1[_0xa600('0x6')]?_0x4325c1['options'][_0xa600('0x8')]||null:null,'include':_0x4325c1[_0xa600('0x6')]?_0x4325c1['options'][_0xa600('0x9')]?_[_0xa600('0xa')](_0x4325c1[_0xa600('0x6')][_0xa600('0x9')],function(_0x42bd74){return{'model':db[_0x42bd74[_0xa600('0xb')]],'as':_0x42bd74['as'],'attributes':_0x42bd74[_0xa600('0x8')],'include':_0x42bd74[_0xa600('0x9')]?_[_0xa600('0xa')](_0x42bd74[_0xa600('0x9')],function(_0x47e6cc){return{'model':db[_0x47e6cc[_0xa600('0xb')]],'as':_0x47e6cc['as'],'attributes':_0x47e6cc[_0xa600('0x8')],'include':_0x47e6cc[_0xa600('0x9')]?_[_0xa600('0xa')](_0x47e6cc[_0xa600('0x9')],function(_0x5a1daa){return{'model':db[_0x5a1daa[_0xa600('0xb')]],'as':_0x5a1daa['as'],'attributes':_0x5a1daa[_0xa600('0x8')]};}):[]};}):[]};}):[]:[]})[_0xa600('0xc')](function(_0x18d634){logger[_0xa600('0xd')]('ShowCmHopper',_0x4325c1);logger['debug'](_0xa600('0x14'),_0x4325c1,JSON[_0xa600('0x10')](_0x18d634));_0x15a257(_0x18d634);})[_0xa600('0x11')](function(_0x4ddf7c){logger['error']('ShowCmHopper',_0x4ddf7c[_0xa600('0x13')],_0x4325c1);_0x5439af(_0x1fd903[_0xa600('0x12')](0x1f4,_0x4ddf7c[_0xa600('0x13')]));});});};exports[_0xa600('0x17')]=function(_0x537232){var _0x5ea9ba=this;return new Promise(function(_0x4ee93f,_0xefc8db){return db[_0xa600('0x15')]['create'](_0x537232[_0xa600('0x18')],{'raw':_0x537232[_0xa600('0x6')]?_0x537232['options'][_0xa600('0x5')]===undefined?!![]:![]:!![]})['then'](function(_0x3f7804){logger[_0xa600('0xd')](_0xa600('0x17'),_0x537232);logger[_0xa600('0xf')]('CreateCmHopper',_0x537232,JSON[_0xa600('0x10')](_0x3f7804));_0x4ee93f(_0x3f7804);})[_0xa600('0x11')](function(_0x2dee3b){logger['error'](_0xa600('0x17'),_0x2dee3b[_0xa600('0x13')],_0x537232);_0xefc8db(_0x5ea9ba['error'](0x1f4,_0x2dee3b['message']));});});};exports['UpdateCmHopper']=function(_0x5c118f){var _0x3c57fb=this;return new Promise(function(_0x37ee2a,_0x64de56){return db['CmHopper']['update'](_0x5c118f[_0xa600('0x18')],{'raw':_0x5c118f[_0xa600('0x6')]?_0x5c118f['options'][_0xa600('0x5')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c118f[_0xa600('0x6')]?_0x5c118f[_0xa600('0x6')]['where']||null:null,'attributes':_0x5c118f[_0xa600('0x6')]?_0x5c118f['options'][_0xa600('0x8')]||null:null,'limit':_0x5c118f[_0xa600('0x6')]?_0x5c118f[_0xa600('0x6')][_0xa600('0x19')]||null:null})[_0xa600('0xc')](function(_0x90892f){logger[_0xa600('0xd')](_0xa600('0x1a'),_0x5c118f);logger['info'](_0xa600('0x1b'),JSON[_0xa600('0x10')](_0x5c118f['options']['where']),_0x5c118f[_0xa600('0x18')]['active']);logger[_0xa600('0xf')](_0xa600('0x1a'),_0x5c118f,JSON[_0xa600('0x10')](_0x90892f));_0x37ee2a(_0x90892f);})[_0xa600('0x11')](function(_0xc677c5){logger[_0xa600('0x12')](_0xa600('0x1a'),_0xc677c5[_0xa600('0x13')],_0x5c118f);_0x64de56(_0x3c57fb[_0xa600('0x12')](0x1f4,_0xc677c5[_0xa600('0x13')]));});});};exports[_0xa600('0x1c')]=function(_0x4c4208){var _0x4e150b=this;return new Promise(function(_0x36b71a,_0x3cc06b){return db[_0xa600('0x15')][_0xa600('0x1d')]({'where':_0x4c4208[_0xa600('0x6')]?_0x4c4208[_0xa600('0x6')]['where']||null:null})['then'](function(_0x382d6c){logger['info'](_0xa600('0x1c'),_0x4c4208);logger[_0xa600('0xf')](_0xa600('0x1c'),_0x4c4208,JSON['stringify'](_0x382d6c));_0x36b71a(_0x382d6c);})[_0xa600('0x11')](function(_0x3b039b){logger['error'](_0xa600('0x1c'),_0x3b039b[_0xa600('0x13')],_0x4c4208);_0x3cc06b(_0x4e150b[_0xa600('0x12')](0x1f4,_0x3b039b[_0xa600('0x13')]));});});};exports[_0xa600('0x1e')]=function(_0x109e82){var _0x47132a=this;return new Promise(function(_0x5c3d8c,_0xe0a6c7){return db[_0xa600('0x1f')]['describe']()['then'](function(_0x4c22f9){return db['sequelize'][_0xa600('0x20')](function(_0x48e899){return db[_0xa600('0x15')][_0xa600('0x4')]({'where':_0x109e82[_0xa600('0x6')]?_0x109e82[_0xa600('0x6')][_0xa600('0x7')]||null:null,'attributes':_0x109e82['options']?_0x109e82['options'][_0xa600('0x8')]||null:null,'limit':_0x109e82[_0xa600('0x6')]?_0x109e82['options'][_0xa600('0x19')]||null:null,'order':_0x109e82[_0xa600('0x6')]?_0x109e82[_0xa600('0x6')][_0xa600('0x21')]||null:null,'transaction':_0x48e899,'lock':_0x48e899[_0xa600('0x22')][_0xa600('0x23')],'include':[{'model':db['CmContact'],'as':_0xa600('0x24'),'attributes':_[_0xa600('0x25')](_0x4c22f9)},{'model':db['User'],'as':_0xa600('0x26'),'attributes':['id','name',_0xa600('0x27')]}]})[_0xa600('0xc')](function(_0x289982){var _0x8eeae5=[];var _0x45dc68=[];for(var _0x5b756f=0x0;_0x5b756f<_0x289982[_0xa600('0x28')];_0x5b756f+=0x1){var _0x2b14d2=_0x289982[_0x5b756f][_0xa600('0x29')];if(_0x2b14d2===null){_0x8eeae5[_0xa600('0x2a')](_0x289982[_0x5b756f][_0xa600('0x2b')](_0x109e82['body'],{'transaction':_0x48e899}));}else if(!_0x45dc68['includes'](_0x2b14d2)){_0x45dc68[_0xa600('0x2a')](_0x2b14d2);_0x8eeae5[_0xa600('0x2a')](_0x289982[_0x5b756f][_0xa600('0x2b')](_0x109e82['body'],{'transaction':_0x48e899}));}}return BPromise['all'](_0x8eeae5);});})[_0xa600('0xc')](function(_0x56c743){logger[_0xa600('0xd')](_0xa600('0x1e'),_0x109e82);if(_0x56c743['length']>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x56c743[0x0][_0xa600('0x2c')]['id'],_0x56c743[0x0][_0xa600('0x2c')][_0xa600('0x2d')],_0x56c743[0x0][_0xa600('0x2c')]['active']);}logger[_0xa600('0xf')](_0xa600('0x1e'),_0x109e82,JSON[_0xa600('0x10')](_0x56c743));_0x5c3d8c(_0x56c743);})['catch'](function(_0x363b8a){logger[_0xa600('0x12')](_0xa600('0x1e'),_0x363b8a['message'],_0x109e82);_0xe0a6c7(_0x47132a[_0xa600('0x12')](0x1f4,_0x363b8a[_0xa600('0x13')]));});});});};exports[_0xa600('0x2e')]=function(_0xcb1256){var _0x4f7d4a=this;return new Promise(function(_0x39595e,_0x42f3cc){return db['sequelize']['transaction'](function(_0x1ebe9a){return db[_0xa600('0x2f')]['create'](_0xcb1256['body'],{'raw':_0xcb1256[_0xa600('0x6')]?_0xcb1256['options'][_0xa600('0x5')]===undefined?!![]:![]:!![],'transaction':_0x1ebe9a})[_0xa600('0xc')](function(){logger[_0xa600('0xd')](_0xa600('0x30'),JSON[_0xa600('0x10')](_0xcb1256['options'][_0xa600('0x7')]),_0xcb1256[_0xa600('0x6')]['where'][_0xa600('0x31')]);return db['CmHopper']['destroy']({'where':_0xcb1256[_0xa600('0x6')]?_0xcb1256[_0xa600('0x6')][_0xa600('0x7')]||null:null,'transaction':_0x1ebe9a});});})[_0xa600('0xc')](function(_0x11b299){logger[_0xa600('0xd')](_0xa600('0x2e'),_0xcb1256);logger['debug'](_0xa600('0x2e'),_0xcb1256,JSON[_0xa600('0x10')](_0x11b299));_0x39595e(_0x11b299);})['catch'](function(_0x3c2a15){logger[_0xa600('0x12')](_0xa600('0x2e'),_0x3c2a15['message'],_0xcb1256);_0x42f3cc(_0x4f7d4a['error'](0x1f4,_0x3c2a15[_0xa600('0x13')]));});});};exports[_0xa600('0x32')]=function(_0x31eff5){var _0x4dceb5=this;return new Promise(function(_0x5bb950,_0x15ce94){return db[_0xa600('0x15')][_0xa600('0x4')]({'raw':_0x31eff5[_0xa600('0x6')]?_0x31eff5['options'][_0xa600('0x5')]===undefined?!![]:![]:!![],'where':_0x31eff5[_0xa600('0x6')]?_0x31eff5[_0xa600('0x6')][_0xa600('0x7')]||null:null,'attributes':[[db[_0xa600('0x33')]['fn'](_0xa600('0x34'),db['sequelize']['fn']('IF',db[_0xa600('0x33')][_0xa600('0x35')](_0xa600('0x36')+util['format']('\x22%s\x22',moment()['format'](_0xa600('0x37')))+'\x20,\x201,\x20null'))),_0xa600('0x38')]]})[_0xa600('0xc')](function(_0x29e9b3){logger[_0xa600('0xd')](_0xa600('0x32'),_0x31eff5);logger[_0xa600('0xf')](_0xa600('0x32'),_0x31eff5,JSON[_0xa600('0x10')](_0x29e9b3));_0x5bb950(_0x29e9b3);})['catch'](function(_0x58b0de){logger[_0xa600('0x12')](_0xa600('0x32'),_0x58b0de[_0xa600('0x13')],_0x31eff5);_0x15ce94(_0x4dceb5[_0xa600('0x12')](0x1f4,_0x58b0de[_0xa600('0x13')]));});});};exports[_0xa600('0x39')]=function(_0x41d742){var _0x5e5da8=this;return new Promise(function(_0x3cdb4f,_0x5d71dd){return db[_0xa600('0x1f')][_0xa600('0x3a')]()[_0xa600('0xc')](function(){return db['sequelize'][_0xa600('0x20')](function(_0x31c005){return db[_0xa600('0x15')][_0xa600('0x4')]({'where':_0x41d742['options']?_0x41d742[_0xa600('0x6')][_0xa600('0x7')]||null:null,'attributes':_0x41d742[_0xa600('0x6')]?_0x41d742['options'][_0xa600('0x8')]||null:null,'limit':0x1,'order':_0x41d742['options']?_0x41d742[_0xa600('0x6')]['order']||null:null,'group':db[_0xa600('0x15')][_0xa600('0x29')],'transaction':_0x31c005,'lock':_0x31c005[_0xa600('0x22')][_0xa600('0x23')],'include':_0x41d742[_0xa600('0x6')]?_0x41d742[_0xa600('0x6')][_0xa600('0x9')]?_[_0xa600('0xa')](_0x41d742[_0xa600('0x6')][_0xa600('0x9')],function(_0x4b9e44){return{'model':db[_0x4b9e44[_0xa600('0xb')]],'as':_0x4b9e44['as'],'attributes':_0x4b9e44[_0xa600('0x8')],'include':_0x4b9e44['include']?_[_0xa600('0xa')](_0x4b9e44['include'],function(_0x512e46){return{'model':db[_0x512e46[_0xa600('0xb')]],'as':_0x512e46['as'],'attributes':_0x512e46[_0xa600('0x8')],'include':_0x512e46[_0xa600('0x9')]?_[_0xa600('0xa')](_0x512e46[_0xa600('0x9')],function(_0x1f6447){return{'model':db[_0x1f6447[_0xa600('0xb')]],'as':_0x1f6447['as'],'attributes':_0x1f6447['attributes']};}):[]};}):[]};}):[]:[]})[_0xa600('0xc')](function(_0x53d79b){var _0x2150e6=[];for(var _0x404ad6=0x0;_0x404ad6<_0x53d79b[_0xa600('0x28')];_0x404ad6+=0x1){_0x2150e6[_0xa600('0x2a')](_0x53d79b[_0x404ad6][_0xa600('0x2b')](_0x41d742['body'],{'transaction':_0x31c005}));}return BPromise['all'](_0x2150e6);});})[_0xa600('0xc')](function(_0x16072d){logger[_0xa600('0xd')](_0xa600('0x39'),_0x41d742);logger['debug'](_0xa600('0x39'),_0x41d742,JSON['stringify'](_0x16072d));_0x3cdb4f(_0x16072d);})[_0xa600('0x11')](function(_0x3f6821){logger[_0xa600('0x12')](_0xa600('0x39'),_0x3f6821[_0xa600('0x13')],_0x41d742);_0x5d71dd(_0x5e5da8[_0xa600('0x12')](0x1f4,_0x3f6821[_0xa600('0x13')]));});});});};exports[_0xa600('0x3b')]=function(_0x52a9e4){var _0x1292de=this;return new Promise(function(_0xf9f49a,_0xfde1e0){db[_0xa600('0x1f')][_0xa600('0x3a')]()[_0xa600('0xc')](function(_0x3a936d){return db[_0xa600('0x15')][_0xa600('0x4')]({'raw':_0x52a9e4['options']?_0x52a9e4['options'][_0xa600('0x5')]===undefined?!![]:![]:!![],'where':_0x52a9e4['options']?_0x52a9e4['options'][_0xa600('0x7')]||null:null,'attributes':_0x52a9e4[_0xa600('0x6')]?_0x52a9e4[_0xa600('0x6')][_0xa600('0x8')]||null:null,'limit':_0x52a9e4['options']?_0x52a9e4['options']['limit']||null:null,'include':_0x52a9e4[_0xa600('0x6')]?_0x52a9e4['options']['include']?_[_0xa600('0xa')](_0x52a9e4['options']['include'],function(_0x1bcbfe){return{'model':db[_0x1bcbfe['model']],'as':_0x1bcbfe['as'],'attributes':_0x1bcbfe['as']===_0xa600('0x24')?_[_0xa600('0x25')](_0x3a936d):_0x1bcbfe[_0xa600('0x8')],'include':_0x1bcbfe[_0xa600('0x9')]?_[_0xa600('0xa')](_0x1bcbfe[_0xa600('0x9')],function(_0x4395ee){return{'model':db[_0x4395ee[_0xa600('0xb')]],'as':_0x4395ee['as'],'attributes':_0x4395ee[_0xa600('0x8')],'include':_0x4395ee[_0xa600('0x9')]?_[_0xa600('0xa')](_0x4395ee['include'],function(_0x4d63fa){return{'model':db[_0x4d63fa[_0xa600('0xb')]],'as':_0x4d63fa['as'],'attributes':_0x4d63fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e3aec){logger[_0xa600('0xd')](_0xa600('0xe'),_0x52a9e4);logger[_0xa600('0xf')]('GetCmHopper',_0x52a9e4,JSON[_0xa600('0x10')](_0x2e3aec));_0xf9f49a(_0x2e3aec);})[_0xa600('0x11')](function(_0x1ca72a){logger[_0xa600('0x12')](_0xa600('0xe'),_0x1ca72a[_0xa600('0x13')],_0x52a9e4);_0xfde1e0(_0x1292de[_0xa600('0x12')](0x1f4,_0x1ca72a[_0xa600('0x13')]));});});});};exports[_0xa600('0x3c')]=function(_0x17a384){var _0x2edd4d=this;return new Promise(function(_0x25e145,_0x41eb69){return db['CmContact'][_0xa600('0x3d')]({'raw':!![],'where':{'phone':_0x17a384[_0xa600('0x6')]['where'][_0xa600('0x3e')]},'attributes':['id',_0xa600('0x3f')],'order':[['id',_0xa600('0x40')]]})[_0xa600('0xc')](function(_0x12009b){logger[_0xa600('0xd')]('getContactByPhone',_0x17a384);logger[_0xa600('0xf')](_0xa600('0x41'),_0x17a384,JSON[_0xa600('0x10')](_0x12009b));_0x25e145(_0x12009b);})[_0xa600('0x11')](function(_0x15ba7b){logger[_0xa600('0x12')](_0xa600('0x41'),_0x15ba7b[_0xa600('0x13')],_0x17a384);_0x41eb69(_0x2edd4d['error'](0x1f4,_0x15ba7b[_0xa600('0x13')]));});});};exports['ResetActiveCalls']=function(_0x2de360){var _0x2425a1=this;return new Promise(function(_0x34a531,_0x25beef){return db[_0xa600('0x33')][_0xa600('0x20')](function(_0x3ecb66){var _0x68c286=_0x2de360[_0xa600('0x6')]&&_0x2de360[_0xa600('0x6')]['where']?_0x2de360[_0xa600('0x6')]['where']:{};return db[_0xa600('0x15')][_0xa600('0x2b')](_0x2de360[_0xa600('0x18')],{'where':_0x68c286,'transaction':_0x3ecb66})[_0xa600('0xc')](function(_0x19f95d){logger[_0xa600('0xd')](_0xa600('0x42'),_0x2de360);logger['debug'](_0xa600('0x42'),_0x2de360,JSON[_0xa600('0x10')](_0x19f95d));_0x34a531(_0x19f95d);})[_0xa600('0x11')](function(_0x4100ec){logger[_0xa600('0x12')]('ResetActiveCalls',_0x4100ec[_0xa600('0x13')],_0x2de360);_0x25beef(_0x2425a1['error'](0x1f4,_0x4100ec['message']));});});});};exports[_0xa600('0x43')]=function(_0x25daba){var _0x3ad946=this;var _0x36b0b4=_0x25daba[_0xa600('0x18')][_0xa600('0x7')][_0xa600('0x44')];var _0x132f93=_0x25daba[_0xa600('0x18')][_0xa600('0x7')][_0xa600('0x45')];var _0xf47d34=_0x25daba[_0xa600('0x18')]['where'][_0xa600('0x46')];return new Promise(function(_0x1dd64b,_0x2ce50a){return db[_0xa600('0x15')][_0xa600('0x4')]({'where':{'voiceQueueId':{'$in':_0x36b0b4},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xa600('0x33')][_0xa600('0x35')](_0xa600('0x47')+_0x132f93+'\x20MINUTE'),'$gt':db[_0xa600('0x33')][_0xa600('0x35')](_0xa600('0x48'))}},'UserId':{'$in':_0xf47d34}},'include':[{'model':db[_0xa600('0x1f')],'as':'Contact'},{'model':db[_0xa600('0x49')],'as':_0xa600('0x26'),'attributes':['id',_0xa600('0x4a'),'voicePause']},{'model':db['CmList'],'as':_0xa600('0x4b')}]})[_0xa600('0xc')](function(_0x36f85b){if(_0x36f85b[_0xa600('0x28')]>0x0){return db[_0xa600('0x33')][_0xa600('0x20')](function(_0x59ca38){return db['CmHopper'][_0xa600('0x2b')]({'recallmeNotifiedDate':db[_0xa600('0x33')][_0xa600('0x35')](_0xa600('0x48'))},{'where':{'id':{'$in':_[_0xa600('0xa')](_0x36f85b,'id')}},'transaction':_0x59ca38})[_0xa600('0xc')](function(){_0x1dd64b(_0x36f85b);})[_0xa600('0x11')](function(_0x9c4494){logger[_0xa600('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x9c4494['message'],_0x25daba);_0x2ce50a(_0x3ad946[_0xa600('0x12')](0x1f4,_0x9c4494[_0xa600('0x13')]));});})[_0xa600('0x11')](function(_0x56b075){logger[_0xa600('0x12')](_0xa600('0x43'),_0x56b075[_0xa600('0x13')],_0x25daba);_0x2ce50a(_0x3ad946['error'](0x1f4,_0x56b075[_0xa600('0x13')]));});}else{_0x1dd64b(_0x36f85b);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 66a9995..cd0b154 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 _0x604f=['getPreview','/timezone','update','delete','exports','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create'];(function(_0x443a64,_0x451fa3){var _0x188286=function(_0x573065){while(--_0x573065){_0x443a64['push'](_0x443a64['shift']());}};_0x188286(++_0x451fa3);}(_0x604f,0x140));var _0xf604=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x604f[_0x474bc0];return _0x4b24cf;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf604('0x0'));var controller=require(_0xf604('0x1'));router[_0xf604('0x2')]('/',auth['isAuthenticated'](),controller[_0xf604('0x3')]);router['get']('/describe',auth[_0xf604('0x4')](),controller[_0xf604('0x5')]);router[_0xf604('0x2')](_0xf604('0x6'),auth['isAuthenticated'](),controller[_0xf604('0x7')]);router[_0xf604('0x2')](_0xf604('0x8'),auth[_0xf604('0x4')](),controller[_0xf604('0x9')]);router['get'](_0xf604('0xa'),auth[_0xf604('0x4')](),controller[_0xf604('0xb')]);router['get'](_0xf604('0xc'),auth[_0xf604('0x4')](),controller[_0xf604('0xd')]);router[_0xf604('0xe')]('/',auth[_0xf604('0x4')](),controller[_0xf604('0xf')]);router[_0xf604('0xe')]('/preview',auth[_0xf604('0x4')](),controller[_0xf604('0x10')]);router['post'](_0xf604('0x11'),auth[_0xf604('0x4')](),controller['getTimezone']);router['put'](_0xf604('0xa'),auth[_0xf604('0x4')](),controller[_0xf604('0x12')]);router[_0xf604('0x13')]('/:id',auth[_0xf604('0x4')](),controller['destroy']);module[_0xf604('0x14')]=router; \ No newline at end of file +var _0x73e3=['/timezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','/timezone','put','update','delete','destroy','exports','express','../../components/auth/service','get','isAuthenticated','/describe','getOpenContacts'];(function(_0x5ab2d7,_0x4626c9){var _0x47636f=function(_0x261239){while(--_0x261239){_0x5ab2d7['push'](_0x5ab2d7['shift']());}};_0x47636f(++_0x4626c9);}(_0x73e3,0x176));var _0x373e=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x73e3[_0x33bc64];return _0x3fdd34;};'use strict';var express=require(_0x373e('0x0'));var router=express['Router']();var auth=require(_0x373e('0x1'));var controller=require('./cmHopper.controller');router[_0x373e('0x2')]('/',auth[_0x373e('0x3')](),controller['index']);router[_0x373e('0x2')](_0x373e('0x4'),auth[_0x373e('0x3')](),controller['describe']);router[_0x373e('0x2')]('/opencontacts',auth[_0x373e('0x3')](),controller[_0x373e('0x5')]);router['get'](_0x373e('0x6'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x373e('0x2')](_0x373e('0x7'),auth['isAuthenticated'](),controller[_0x373e('0x8')]);router[_0x373e('0x2')](_0x373e('0x9'),auth[_0x373e('0x3')](),controller[_0x373e('0xa')]);router[_0x373e('0xb')]('/',auth[_0x373e('0x3')](),controller[_0x373e('0xc')]);router['post'](_0x373e('0xd'),auth[_0x373e('0x3')](),controller['getPreview']);router['post'](_0x373e('0xe'),auth[_0x373e('0x3')](),controller['getTimezone']);router[_0x373e('0xf')](_0x373e('0x7'),auth[_0x373e('0x3')](),controller[_0x373e('0x10')]);router[_0x373e('0x11')](_0x373e('0x7'),auth[_0x373e('0x3')](),controller[_0x373e('0x12')]);module[_0x373e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index bcc455b..d80e08a 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 _0x9c70=['STRING','format','moment','INTEGER'];(function(_0x3415ad,_0x2160d2){var _0x58ca81=function(_0x5eecd9){while(--_0x5eecd9){_0x3415ad['push'](_0x3415ad['shift']());}};_0x58ca81(++_0x2160d2);}(_0x9c70,0x12a));var _0x09c7=function(_0x5bd7d0,_0x535f62){_0x5bd7d0=_0x5bd7d0-0x0;var _0x4dfccb=_0x9c70[_0x5bd7d0];return _0x4dfccb;};'use strict';var moment=require(_0x09c7('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x09c7('0x1')]},'phone':{'type':Sequelize[_0x09c7('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x09c7('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x09c7('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x09c7('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x09c7('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x09c7('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x09c7('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x09c7('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x09c7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1677=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','DATE'];(function(_0x1c55e9,_0x287797){var _0x255651=function(_0x528bde){while(--_0x528bde){_0x1c55e9['push'](_0x1c55e9['shift']());}};_0x255651(++_0x287797);}(_0x1677,0xaa));var _0x7167=function(_0x2dc1a0,_0x29cf94){_0x2dc1a0=_0x2dc1a0-0x0;var _0x3d7e3d=_0x1677[_0x2dc1a0];return _0x3d7e3d;};'use strict';var moment=require(_0x7167('0x0'));var Sequelize=require(_0x7167('0x1'));module[_0x7167('0x2')]={'CmHopperId':{'type':Sequelize[_0x7167('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7167('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7167('0x4')],'defaultValue':moment()[_0x7167('0x5')](_0x7167('0x6'))},'countbusyretry':{'type':Sequelize[_0x7167('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7167('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7167('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7167('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7167('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d6c8b7a..9ccdd02 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 _0xf69d=['query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','rawAttributes','includeAll','include','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../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','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','error','name','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','keys','filters','intersection'];(function(_0x9ba57c,_0x5ecc0d){var _0x627a6e=function(_0x3c702d){while(--_0x3c702d){_0x9ba57c['push'](_0x9ba57c['shift']());}};_0x627a6e(++_0x5ecc0d);}(_0xf69d,0x1b1));var _0xdf69=function(_0x2d50f7,_0x2b4ff3){_0x2d50f7=_0x2d50f7-0x0;var _0x2064d4=_0xf69d[_0x2d50f7];return _0x2064d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf69('0x0'));var zipdir=require(_0xdf69('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf69('0x2'));var moment=require(_0xdf69('0x3'));var BPromise=require(_0xdf69('0x4'));var Mustache=require(_0xdf69('0x5'));var util=require(_0xdf69('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdf69('0x7'));var fs=require('fs');var fs_extra=require(_0xdf69('0x8'));var _=require('lodash');var squel=require(_0xdf69('0x9'));var crypto=require(_0xdf69('0xa'));var jsforce=require(_0xdf69('0xb'));var deskjs=require(_0xdf69('0xc'));var toCsv=require(_0xdf69('0xd'));var querystring=require(_0xdf69('0xe'));var Papa=require(_0xdf69('0xf'));var Redis=require(_0xdf69('0x10'));var authService=require(_0xdf69('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdf69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf69('0x13'))(_0xdf69('0x14'));var utils=require(_0xdf69('0x15'));var config=require(_0xdf69('0x16'));var licenseUtil=require(_0xdf69('0x17'));var db=require(_0xdf69('0x18'))['db'];function respondWithStatusCode(_0x2d3c27,_0x22bbe5){_0x22bbe5=_0x22bbe5||0xcc;return function(_0x56d1f8){if(_0x56d1f8){return _0x2d3c27[_0xdf69('0x19')](_0x22bbe5);}return _0x2d3c27[_0xdf69('0x1a')](_0x22bbe5)[_0xdf69('0x1b')]();};}function respondWithResult(_0x541623,_0x59ac66){_0x59ac66=_0x59ac66||0xc8;return function(_0x22bbbe){if(_0x22bbbe){return _0x541623[_0xdf69('0x1a')](_0x59ac66)[_0xdf69('0x1c')](_0x22bbbe);}};}function respondWithFilteredResult(_0x255ef4,_0x4d3af6){return function(_0x571409){if(_0x571409){var _0x431f57=typeof _0x4d3af6[_0xdf69('0x1d')]===_0xdf69('0x1e')&&typeof _0x4d3af6[_0xdf69('0x1f')]===_0xdf69('0x1e');var _0x2f8a9b=_0x571409['count'];var _0x116302=_0x431f57?0x0:_0x4d3af6[_0xdf69('0x1d')];var _0x3f2b52=_0x431f57?_0x571409[_0xdf69('0x20')]:_0x4d3af6[_0xdf69('0x1d')]+_0x4d3af6[_0xdf69('0x1f')];var _0xcece79;if(_0x3f2b52>=_0x2f8a9b){_0x3f2b52=_0x2f8a9b;_0xcece79=0xc8;}else{_0xcece79=0xce;}_0x255ef4['status'](_0xcece79);return _0x255ef4[_0xdf69('0x21')]('Content-Range',_0x116302+'-'+_0x3f2b52+'/'+_0x2f8a9b)[_0xdf69('0x1c')](_0x571409);}return null;};}function patchUpdates(_0x177929){return function(_0x1e4330){try{jsonpatch[_0xdf69('0x22')](_0x1e4330,_0x177929,!![]);}catch(_0x585200){return BPromise[_0xdf69('0x23')](_0x585200);}return _0x1e4330['save']();};}function saveUpdates(_0x1c22cc,_0x55798e){return function(_0x28b441){if(_0x28b441){return _0x28b441[_0xdf69('0x24')](_0x1c22cc)[_0xdf69('0x25')](function(_0x597b62){return _0x597b62;});}return null;};}function removeEntity(_0x25c334,_0x1ab266){return function(_0x414db8){if(_0x414db8){return _0x414db8[_0xdf69('0x26')]()['then'](function(){var _0x4b86c0=_0x414db8[_0xdf69('0x27')]({'plain':!![]});var _0x4b5d69=_0xdf69('0x28');return db['UserProfileResource'][_0xdf69('0x26')]({'where':{'type':_0x4b5d69,'resourceId':_0x4b86c0['id']}})[_0xdf69('0x25')](function(){return _0x414db8;});})[_0xdf69('0x25')](function(){_0x25c334[_0xdf69('0x1a')](0xcc)[_0xdf69('0x1b')]();});}};}function handleEntityNotFound(_0x4cf464,_0x509174){return function(_0x515afb){if(!_0x515afb){_0x4cf464[_0xdf69('0x19')](0x194);}return _0x515afb;};}function handleError(_0x454f2a,_0x34449b){_0x34449b=_0x34449b||0x1f4;return function(_0x44a438){logger[_0xdf69('0x29')](_0x44a438['stack']);if(_0x44a438[_0xdf69('0x2a')]){delete _0x44a438[_0xdf69('0x2a')];}_0x454f2a[_0xdf69('0x1a')](_0x34449b)['send'](_0x44a438);};}exports[_0xdf69('0x2b')]=function(_0xfe7de,_0x1fc106){var _0xc40bfe={},_0x271bcd={},_0x37395d={'count':0x0,'rows':[]};var _0x2e8e65=_[_0xdf69('0x2c')](db[_0xdf69('0x2d')]['rawAttributes'],function(_0x105485){return{'name':_0x105485[_0xdf69('0x2e')],'type':_0x105485[_0xdf69('0x2f')][_0xdf69('0x30')]};});_0x271bcd[_0xdf69('0x31')]=_[_0xdf69('0x2c')](_0x2e8e65,_0xdf69('0x2a'));_0x271bcd['query']=_[_0xdf69('0x32')](_0xfe7de['query']);_0x271bcd[_0xdf69('0x33')]=_[_0xdf69('0x34')](_0x271bcd[_0xdf69('0x31')],_0x271bcd[_0xdf69('0x35')]);_0xc40bfe[_0xdf69('0x36')]=_[_0xdf69('0x34')](_0x271bcd[_0xdf69('0x31')],qs[_0xdf69('0x37')](_0xfe7de[_0xdf69('0x35')][_0xdf69('0x37')]));_0xc40bfe[_0xdf69('0x36')]=_0xc40bfe[_0xdf69('0x36')][_0xdf69('0x38')]?_0xc40bfe[_0xdf69('0x36')]:_0x271bcd[_0xdf69('0x31')];if(!_0xfe7de['query'][_0xdf69('0x39')](_0xdf69('0x3a'))){_0xc40bfe[_0xdf69('0x1f')]=qs['limit'](_0xfe7de[_0xdf69('0x35')][_0xdf69('0x1f')]);_0xc40bfe[_0xdf69('0x1d')]=qs['offset'](_0xfe7de[_0xdf69('0x35')][_0xdf69('0x1d')]);}_0xc40bfe[_0xdf69('0x3b')]=qs[_0xdf69('0x3c')](_0xfe7de[_0xdf69('0x35')][_0xdf69('0x3c')]);_0xc40bfe[_0xdf69('0x3d')]=qs['filters'](_['pick'](_0xfe7de[_0xdf69('0x35')],_0x271bcd[_0xdf69('0x33')]),_0x2e8e65);if(_0xfe7de['query'][_0xdf69('0x3e')]){_0xc40bfe[_0xdf69('0x3d')]=_[_0xdf69('0x3f')](_0xc40bfe[_0xdf69('0x3d')],{'$or':_[_0xdf69('0x2c')](_0x2e8e65,function(_0x51d086){if(_0x51d086[_0xdf69('0x2f')]!==_0xdf69('0x40')){var _0x6ca966={};_0x6ca966[_0x51d086[_0xdf69('0x2a')]]={'$like':'%'+_0xfe7de[_0xdf69('0x35')][_0xdf69('0x3e')]+'%'};return _0x6ca966;}})});}_0xc40bfe=_[_0xdf69('0x3f')]({},_0xc40bfe,_0xfe7de[_0xdf69('0x41')]);var _0x2d70a2={'where':_0xc40bfe[_0xdf69('0x3d')]};return db[_0xdf69('0x2d')][_0xdf69('0x20')](_0x2d70a2)[_0xdf69('0x25')](function(_0x3c9f77){_0x37395d[_0xdf69('0x20')]=_0x3c9f77;if(_0xfe7de[_0xdf69('0x35')]['includeAll']){_0xc40bfe['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0xc40bfe);})[_0xdf69('0x25')](function(_0x1a17fe){_0x37395d[_0xdf69('0x42')]=_0x1a17fe;return _0x37395d;})['then'](respondWithFilteredResult(_0x1fc106,_0xc40bfe))[_0xdf69('0x43')](handleError(_0x1fc106,null));};exports[_0xdf69('0x44')]=function(_0x45dbab,_0x2a046c){var _0x3770d8={'raw':!![],'where':{'id':_0x45dbab['params']['id']}},_0xa41ef1={};_0xa41ef1[_0xdf69('0x31')]=_[_0xdf69('0x32')](db[_0xdf69('0x2d')][_0xdf69('0x45')]);_0xa41ef1['query']=_[_0xdf69('0x32')](_0x45dbab['query']);_0xa41ef1[_0xdf69('0x33')]=_['intersection'](_0xa41ef1['model'],_0xa41ef1[_0xdf69('0x35')]);_0x3770d8[_0xdf69('0x36')]=_[_0xdf69('0x34')](_0xa41ef1[_0xdf69('0x31')],qs[_0xdf69('0x37')](_0x45dbab['query'][_0xdf69('0x37')]));_0x3770d8['attributes']=_0x3770d8[_0xdf69('0x36')]['length']?_0x3770d8[_0xdf69('0x36')]:_0xa41ef1['model'];if(_0x45dbab[_0xdf69('0x35')][_0xdf69('0x46')]){_0x3770d8[_0xdf69('0x47')]=[{'all':!![]}];}_0x3770d8=_[_0xdf69('0x3f')]({},_0x3770d8,_0x45dbab[_0xdf69('0x41')]);return db[_0xdf69('0x2d')][_0xdf69('0x48')](_0x3770d8)[_0xdf69('0x25')](handleEntityNotFound(_0x2a046c,null))[_0xdf69('0x25')](respondWithResult(_0x2a046c,null))[_0xdf69('0x43')](handleError(_0x2a046c,null));};exports[_0xdf69('0x49')]=function(_0x299697,_0x383cbc){return db[_0xdf69('0x2d')]['create'](_0x299697[_0xdf69('0x4a')],{})[_0xdf69('0x25')](function(_0x444d0c){var _0x141204=_0x299697[_0xdf69('0x4b')][_0xdf69('0x27')]({'plain':!![]});if(!_0x141204)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x141204[_0xdf69('0x4c')]==='user'){var _0xb44edf=_0x444d0c[_0xdf69('0x27')]({'plain':!![]});var _0x8236b9=_0xdf69('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x8236b9,'userProfileId':_0x141204[_0xdf69('0x4d')]},'raw':!![]})[_0xdf69('0x25')](function(_0x2e7d4a){if(_0x2e7d4a&&_0x2e7d4a[_0xdf69('0x4e')]===0x0){return db['UserProfileResource'][_0xdf69('0x49')]({'name':_0xb44edf[_0xdf69('0x2a')],'resourceId':_0xb44edf['id'],'type':_0x2e7d4a[_0xdf69('0x2a')],'sectionId':_0x2e7d4a['id']},{})[_0xdf69('0x25')](function(){return _0x444d0c;});}else{return _0x444d0c;}})['catch'](function(_0x191276){logger['error'](_0xdf69('0x4f'),_0x191276);throw _0x191276;});}return _0x444d0c;})[_0xdf69('0x25')](respondWithResult(_0x383cbc,0xc9))[_0xdf69('0x43')](handleError(_0x383cbc,null));};exports[_0xdf69('0x24')]=function(_0x2f8d4c,_0x2df92d){if(_0x2f8d4c['body']['id']){delete _0x2f8d4c['body']['id'];}return db[_0xdf69('0x2d')][_0xdf69('0x48')]({'where':{'id':_0x2f8d4c[_0xdf69('0x50')]['id']}})[_0xdf69('0x25')](handleEntityNotFound(_0x2df92d,null))[_0xdf69('0x25')](saveUpdates(_0x2f8d4c[_0xdf69('0x4a')],null))[_0xdf69('0x25')](respondWithResult(_0x2df92d,null))[_0xdf69('0x43')](handleError(_0x2df92d,null));};exports[_0xdf69('0x26')]=function(_0x31b673,_0x426ec2){return db['CmHopperAdditionalPhone'][_0xdf69('0x48')]({'where':{'id':_0x31b673['params']['id']}})[_0xdf69('0x25')](handleEntityNotFound(_0x426ec2,null))[_0xdf69('0x25')](removeEntity(_0x426ec2,null))['catch'](handleError(_0x426ec2,null));}; \ No newline at end of file +var _0x70c0=['to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','type','findAll','show','params','keys','includeAll','include','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x447e11,_0x2e5435){var _0x26fd55=function(_0x146229){while(--_0x146229){_0x447e11['push'](_0x447e11['shift']());}};_0x26fd55(++_0x2e5435);}(_0x70c0,0x195));var _0x070c=function(_0x5c2987,_0x1fb400){_0x5c2987=_0x5c2987-0x0;var _0x3fcfc2=_0x70c0[_0x5c2987];return _0x3fcfc2;};'use strict';var emlformat=require(_0x070c('0x0'));var rimraf=require(_0x070c('0x1'));var zipdir=require(_0x070c('0x2'));var jsonpatch=require(_0x070c('0x3'));var rp=require(_0x070c('0x4'));var moment=require(_0x070c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x070c('0x6'));var util=require(_0x070c('0x7'));var path=require(_0x070c('0x8'));var sox=require(_0x070c('0x9'));var csv=require(_0x070c('0xa'));var ejs=require(_0x070c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x070c('0xc'));var deskjs=require(_0x070c('0xd'));var toCsv=require(_0x070c('0xa'));var querystring=require(_0x070c('0xe'));var Papa=require(_0x070c('0xf'));var Redis=require(_0x070c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x070c('0x11'));var as=require(_0x070c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x070c('0x13'))(_0x070c('0x14'));var utils=require(_0x070c('0x15'));var config=require(_0x070c('0x16'));var licenseUtil=require(_0x070c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521bd7,_0x4aac6f){_0x4aac6f=_0x4aac6f||0xcc;return function(_0x4af1f5){if(_0x4af1f5){return _0x521bd7[_0x070c('0x18')](_0x4aac6f);}return _0x521bd7[_0x070c('0x19')](_0x4aac6f)[_0x070c('0x1a')]();};}function respondWithResult(_0x205844,_0x2044e3){_0x2044e3=_0x2044e3||0xc8;return function(_0x15a180){if(_0x15a180){return _0x205844['status'](_0x2044e3)[_0x070c('0x1b')](_0x15a180);}};}function respondWithFilteredResult(_0xad606f,_0x58abaa){return function(_0x1a09d2){if(_0x1a09d2){var _0x89876b=typeof _0x58abaa[_0x070c('0x1c')]==='undefined'&&typeof _0x58abaa[_0x070c('0x1d')]===_0x070c('0x1e');var _0x13c5e1=_0x1a09d2[_0x070c('0x1f')];var _0x739f0d=_0x89876b?0x0:_0x58abaa['offset'];var _0x55a697=_0x89876b?_0x1a09d2[_0x070c('0x1f')]:_0x58abaa[_0x070c('0x1c')]+_0x58abaa[_0x070c('0x1d')];var _0x5d3bfa;if(_0x55a697>=_0x13c5e1){_0x55a697=_0x13c5e1;_0x5d3bfa=0xc8;}else{_0x5d3bfa=0xce;}_0xad606f['status'](_0x5d3bfa);return _0xad606f[_0x070c('0x20')](_0x070c('0x21'),_0x739f0d+'-'+_0x55a697+'/'+_0x13c5e1)[_0x070c('0x1b')](_0x1a09d2);}return null;};}function patchUpdates(_0x1c5fd9){return function(_0x72929f){try{jsonpatch[_0x070c('0x22')](_0x72929f,_0x1c5fd9,!![]);}catch(_0x566f68){return BPromise[_0x070c('0x23')](_0x566f68);}return _0x72929f[_0x070c('0x24')]();};}function saveUpdates(_0x353b0b,_0x319558){return function(_0xff35ee){if(_0xff35ee){return _0xff35ee['update'](_0x353b0b)[_0x070c('0x25')](function(_0x172d15){return _0x172d15;});}return null;};}function removeEntity(_0x5bd2c4,_0x127441){return function(_0x51a384){if(_0x51a384){return _0x51a384[_0x070c('0x26')]()[_0x070c('0x25')](function(){var _0x54543f=_0x51a384[_0x070c('0x27')]({'plain':!![]});var _0x3d1b67=_0x070c('0x28');return db[_0x070c('0x29')]['destroy']({'where':{'type':_0x3d1b67,'resourceId':_0x54543f['id']}})[_0x070c('0x25')](function(){return _0x51a384;});})[_0x070c('0x25')](function(){_0x5bd2c4[_0x070c('0x19')](0xcc)[_0x070c('0x1a')]();});}};}function handleEntityNotFound(_0x81e200,_0x5a642f){return function(_0xf5453a){if(!_0xf5453a){_0x81e200['sendStatus'](0x194);}return _0xf5453a;};}function handleError(_0x2a7616,_0x5f09ee){_0x5f09ee=_0x5f09ee||0x1f4;return function(_0x1fa7fe){logger['error'](_0x1fa7fe[_0x070c('0x2a')]);if(_0x1fa7fe[_0x070c('0x2b')]){delete _0x1fa7fe[_0x070c('0x2b')];}_0x2a7616['status'](_0x5f09ee)[_0x070c('0x2c')](_0x1fa7fe);};}exports[_0x070c('0x2d')]=function(_0x172d78,_0x47a46f){var _0xda4cd6={},_0x4f50c7={},_0x4912ec={'count':0x0,'rows':[]};var _0x281708=_[_0x070c('0x2e')](db[_0x070c('0x2f')][_0x070c('0x30')],function(_0xd2ff5){return{'name':_0xd2ff5['fieldName'],'type':_0xd2ff5['type'][_0x070c('0x31')]};});_0x4f50c7[_0x070c('0x32')]=_[_0x070c('0x2e')](_0x281708,_0x070c('0x2b'));_0x4f50c7[_0x070c('0x33')]=_['keys'](_0x172d78[_0x070c('0x33')]);_0x4f50c7[_0x070c('0x34')]=_[_0x070c('0x35')](_0x4f50c7[_0x070c('0x32')],_0x4f50c7[_0x070c('0x33')]);_0xda4cd6[_0x070c('0x36')]=_[_0x070c('0x35')](_0x4f50c7[_0x070c('0x32')],qs[_0x070c('0x37')](_0x172d78['query']['fields']));_0xda4cd6['attributes']=_0xda4cd6[_0x070c('0x36')][_0x070c('0x38')]?_0xda4cd6['attributes']:_0x4f50c7[_0x070c('0x32')];if(!_0x172d78[_0x070c('0x33')][_0x070c('0x39')](_0x070c('0x3a'))){_0xda4cd6['limit']=qs[_0x070c('0x1d')](_0x172d78[_0x070c('0x33')]['limit']);_0xda4cd6[_0x070c('0x1c')]=qs[_0x070c('0x1c')](_0x172d78['query'][_0x070c('0x1c')]);}_0xda4cd6['order']=qs['sort'](_0x172d78[_0x070c('0x33')][_0x070c('0x3b')]);_0xda4cd6['where']=qs[_0x070c('0x34')](_['pick'](_0x172d78[_0x070c('0x33')],_0x4f50c7[_0x070c('0x34')]),_0x281708);if(_0x172d78[_0x070c('0x33')][_0x070c('0x3c')]){_0xda4cd6['where']=_[_0x070c('0x3d')](_0xda4cd6[_0x070c('0x3e')],{'$or':_['map'](_0x281708,function(_0x4d5c94){if(_0x4d5c94[_0x070c('0x3f')]!=='VIRTUAL'){var _0x2cb967={};_0x2cb967[_0x4d5c94['name']]={'$like':'%'+_0x172d78[_0x070c('0x33')][_0x070c('0x3c')]+'%'};return _0x2cb967;}})});}_0xda4cd6=_[_0x070c('0x3d')]({},_0xda4cd6,_0x172d78['options']);var _0x190a2c={'where':_0xda4cd6[_0x070c('0x3e')]};return db[_0x070c('0x2f')][_0x070c('0x1f')](_0x190a2c)[_0x070c('0x25')](function(_0x296d96){_0x4912ec[_0x070c('0x1f')]=_0x296d96;if(_0x172d78[_0x070c('0x33')]['includeAll']){_0xda4cd6['include']=[{'all':!![]}];}return db[_0x070c('0x2f')][_0x070c('0x40')](_0xda4cd6);})[_0x070c('0x25')](function(_0x415f70){_0x4912ec['rows']=_0x415f70;return _0x4912ec;})[_0x070c('0x25')](respondWithFilteredResult(_0x47a46f,_0xda4cd6))['catch'](handleError(_0x47a46f,null));};exports[_0x070c('0x41')]=function(_0x6879f1,_0xd6e10e){var _0x447730={'raw':!![],'where':{'id':_0x6879f1[_0x070c('0x42')]['id']}},_0x5245d3={};_0x5245d3[_0x070c('0x32')]=_['keys'](db[_0x070c('0x2f')][_0x070c('0x30')]);_0x5245d3[_0x070c('0x33')]=_[_0x070c('0x43')](_0x6879f1[_0x070c('0x33')]);_0x5245d3['filters']=_[_0x070c('0x35')](_0x5245d3[_0x070c('0x32')],_0x5245d3[_0x070c('0x33')]);_0x447730[_0x070c('0x36')]=_[_0x070c('0x35')](_0x5245d3[_0x070c('0x32')],qs[_0x070c('0x37')](_0x6879f1[_0x070c('0x33')][_0x070c('0x37')]));_0x447730[_0x070c('0x36')]=_0x447730['attributes'][_0x070c('0x38')]?_0x447730[_0x070c('0x36')]:_0x5245d3[_0x070c('0x32')];if(_0x6879f1[_0x070c('0x33')][_0x070c('0x44')]){_0x447730[_0x070c('0x45')]=[{'all':!![]}];}_0x447730=_[_0x070c('0x3d')]({},_0x447730,_0x6879f1[_0x070c('0x46')]);return db[_0x070c('0x2f')][_0x070c('0x47')](_0x447730)[_0x070c('0x25')](handleEntityNotFound(_0xd6e10e,null))[_0x070c('0x25')](respondWithResult(_0xd6e10e,null))[_0x070c('0x48')](handleError(_0xd6e10e,null));};exports[_0x070c('0x49')]=function(_0x1b68f4,_0x317377){return db[_0x070c('0x2f')][_0x070c('0x49')](_0x1b68f4['body'],{})[_0x070c('0x25')](function(_0x1ff4af){var _0x489503=_0x1b68f4[_0x070c('0x4a')]['get']({'plain':!![]});if(!_0x489503)throw new Error(_0x070c('0x4b'));if(_0x489503[_0x070c('0x4c')]===_0x070c('0x4a')){var _0x258747=_0x1ff4af[_0x070c('0x27')]({'plain':!![]});var _0x5c7b81=_0x070c('0x28');return db[_0x070c('0x4d')][_0x070c('0x47')]({'where':{'name':_0x5c7b81,'userProfileId':_0x489503[_0x070c('0x4e')]},'raw':!![]})[_0x070c('0x25')](function(_0x18df97){if(_0x18df97&&_0x18df97[_0x070c('0x4f')]===0x0){return db[_0x070c('0x29')][_0x070c('0x49')]({'name':_0x258747[_0x070c('0x2b')],'resourceId':_0x258747['id'],'type':_0x18df97[_0x070c('0x2b')],'sectionId':_0x18df97['id']},{})[_0x070c('0x25')](function(){return _0x1ff4af;});}else{return _0x1ff4af;}})[_0x070c('0x48')](function(_0x48647d){logger['error'](_0x070c('0x50'),_0x48647d);throw _0x48647d;});}return _0x1ff4af;})[_0x070c('0x25')](respondWithResult(_0x317377,0xc9))[_0x070c('0x48')](handleError(_0x317377,null));};exports[_0x070c('0x51')]=function(_0x13b60f,_0x5bee4b){if(_0x13b60f['body']['id']){delete _0x13b60f['body']['id'];}return db[_0x070c('0x2f')][_0x070c('0x47')]({'where':{'id':_0x13b60f[_0x070c('0x42')]['id']}})[_0x070c('0x25')](handleEntityNotFound(_0x5bee4b,null))[_0x070c('0x25')](saveUpdates(_0x13b60f[_0x070c('0x52')],null))['then'](respondWithResult(_0x5bee4b,null))[_0x070c('0x48')](handleError(_0x5bee4b,null));};exports[_0x070c('0x26')]=function(_0x37dbe8,_0x25ef61){return db['CmHopperAdditionalPhone'][_0x070c('0x47')]({'where':{'id':_0x37dbe8[_0x070c('0x42')]['id']}})[_0x070c('0x25')](handleEntityNotFound(_0x25ef61,null))[_0x070c('0x25')](removeEntity(_0x25ef61,null))[_0x070c('0x48')](handleError(_0x25ef61,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index c108eaf..6c140dd 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 _0x9e29=['api','moment','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x289f00,_0x33fb48){var _0x2a459b=function(_0x4b0f29){while(--_0x4b0f29){_0x289f00['push'](_0x289f00['shift']());}};_0x2a459b(++_0x33fb48);}(_0x9e29,0xf4));var _0x99e2=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x9e29[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0x99e2('0x0'));var util=require(_0x99e2('0x1'));var logger=require(_0x99e2('0x2'))(_0x99e2('0x3'));var moment=require(_0x99e2('0x4'));var BPromise=require(_0x99e2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x99e2('0x6'));var config=require(_0x99e2('0x7'));var attributes=require(_0x99e2('0x8'));module[_0x99e2('0x9')]=function(_0x1c5d41,_0x42edac){return _0x1c5d41[_0x99e2('0xa')](_0x99e2('0xb'),attributes,{'tableName':_0x99e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf643=['rimraf','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','api','bluebird','path'];(function(_0x18e9e7,_0x3b0c98){var _0xe3ada4=function(_0x5f4cf7){while(--_0x5f4cf7){_0x18e9e7['push'](_0x18e9e7['shift']());}};_0xe3ada4(++_0x3b0c98);}(_0xf643,0xa7));var _0x3f64=function(_0x52491c,_0x41d2e6){_0x52491c=_0x52491c-0x0;var _0x157cea=_0xf643[_0x52491c];return _0x157cea;};'use strict';var _=require(_0x3f64('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3f64('0x1'));var moment=require('moment');var BPromise=require(_0x3f64('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f64('0x3'));var rimraf=require(_0x3f64('0x4'));var config=require('../../config/environment');var attributes=require(_0x3f64('0x5'));module[_0x3f64('0x6')]=function(_0x17c208,_0x3ea35c){return _0x17c208['define'](_0x3f64('0x7'),attributes,{'tableName':_0x3f64('0x8'),'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 45d1e12..3ee70e0 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 _0x0e5b=['code','message','catch','findOne','body','ContactId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','entity','dialGlobalMaxRetry','ASC','countmachineretry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','ListId','waitTime','duration','isNil','scheduledat','minutes','phone','add','countagentrejectretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0e5b,0x9d));var _0xb0e5=function(_0x5a8b60,_0x2aa9bf){_0x5a8b60=_0x5a8b60-0x0;var _0x4fdbb2=_0x0e5b[_0x5a8b60];return _0x4fdbb2;};'use strict';var _=require('lodash');var util=require(_0xb0e5('0x0'));var moment=require(_0xb0e5('0x1'));var BPromise=require(_0xb0e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0e5('0x3'));var db=require(_0xb0e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0e5('0x5'))(_0xb0e5('0x6'));var config=require(_0xb0e5('0x7'));var jayson=require(_0xb0e5('0x8'));var client=jayson['client'][_0xb0e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc81aec,_0x52b427,_0x2109a7){return new BPromise(function(_0x86616d,_0x559a09){return client['request'](_0xc81aec,_0x2109a7)['then'](function(_0x4f037b){logger[_0xb0e5('0xa')](_0xb0e5('0xb'),_0x52b427,_0xb0e5('0xc'));logger[_0xb0e5('0xd')](_0xb0e5('0xe'),_0x52b427,_0xb0e5('0xc'),JSON[_0xb0e5('0xf')](_0x4f037b));if(_0x4f037b[_0xb0e5('0x10')]){if(_0x4f037b['error'][_0xb0e5('0x11')]===0x1f4){logger[_0xb0e5('0x10')](_0xb0e5('0xb'),_0x52b427,_0x4f037b['error'][_0xb0e5('0x12')]);return _0x559a09(_0x4f037b[_0xb0e5('0x10')][_0xb0e5('0x12')]);}logger[_0xb0e5('0x10')](_0xb0e5('0xb'),_0x52b427,_0x4f037b['error']['message']);return _0x86616d(_0x4f037b['error'][_0xb0e5('0x12')]);}else{logger['info'](_0xb0e5('0xb'),_0x52b427,'request\x20sent');_0x86616d(_0x4f037b['result'][_0xb0e5('0x12')]);}})[_0xb0e5('0x13')](function(_0x1a0cc5){logger[_0xb0e5('0x10')](_0xb0e5('0xb'),_0x52b427,_0x1a0cc5);_0x559a09(_0x1a0cc5);});});}exports['VerifyAdditionalPhones']=function(_0x4dafbf){var _0x5a706c=this;return new Promise(function(_0x1e1211,_0x4b2b06){return db['CmHopper'][_0xb0e5('0x14')]({'raw':!![],'where':{'ContactId':_0x4dafbf[_0xb0e5('0x15')][_0xb0e5('0x16')],'ListId':_0x4dafbf[_0xb0e5('0x15')]['ListId'],'VoiceQueueId':_0x4dafbf[_0xb0e5('0x15')][_0xb0e5('0x17')]===undefined?null:_0x4dafbf['body'][_0xb0e5('0x17')],'CampaignId':_0x4dafbf[_0xb0e5('0x15')][_0xb0e5('0x18')]===undefined?null:_0x4dafbf[_0xb0e5('0x15')]['CampaignId']}})[_0xb0e5('0x19')](function(_0x27400b){if(_0x27400b!=null){return db[_0xb0e5('0x1a')][_0xb0e5('0x14')]({'raw':!![],'where':{'CmHopperId':_0x27400b['id'],'OrderBy':{'$gt':_0x27400b[_0xb0e5('0x1b')]}},'order':[['OrderBy','ASC']]})[_0xb0e5('0x19')](function(_0x4a9bf8){var _0x5e9f2c=0x0;if(_0x4a9bf8){if(_0x4a9bf8[_0xb0e5('0x1c')]+_0x4a9bf8[_0xb0e5('0x1d')]+_0x4a9bf8[_0xb0e5('0x1e')]+_0x4a9bf8[_0xb0e5('0x1f')]+_0x4a9bf8[_0xb0e5('0x20')]+_0x4a9bf8[_0xb0e5('0x21')]+_0x4a9bf8['countmachineretry']+_0x4a9bf8['countagentrejectretry']<_0x4dafbf[_0xb0e5('0x22')][_0xb0e5('0x23')])_0x5e9f2c=0x1;_0x1e1211({'additional':_0x5e9f2c});}else{return db[_0xb0e5('0x1a')][_0xb0e5('0x14')]({'raw':!![],'where':{'CmHopperId':_0x27400b['id']},'order':[[_0xb0e5('0x1b'),_0xb0e5('0x24')]]})['then'](function(_0x353306){var _0x2404da=0x0;if(_0x353306){if(_0x353306[_0xb0e5('0x1c')]+_0x353306[_0xb0e5('0x1d')]+_0x353306[_0xb0e5('0x1e')]+_0x353306[_0xb0e5('0x1f')]+_0x353306[_0xb0e5('0x20')]+_0x353306[_0xb0e5('0x21')]+_0x353306[_0xb0e5('0x25')]+_0x353306['countagentrejectretry']<_0x4dafbf[_0xb0e5('0x22')][_0xb0e5('0x23')])_0x2404da=0x1;_0x1e1211({'additional':_0x2404da});}else{_0x1e1211({'additional':0x0});}})['catch'](function(_0x322a5b){logger[_0xb0e5('0x10')](_0xb0e5('0x26'),_0x322a5b[_0xb0e5('0x12')]);_0x4b2b06(_0x5a706c[_0xb0e5('0x10')](0x1f4,_0x322a5b[_0xb0e5('0x12')]));});}})[_0xb0e5('0x13')](function(_0xb8200d){logger['error'](_0xb0e5('0x26'),_0xb8200d[_0xb0e5('0x12')]);_0x4b2b06(_0x5a706c['error'](0x1f4,_0xb8200d[_0xb0e5('0x12')]));});}else _0x1e1211({'additional':0x0});});});};exports[_0xb0e5('0x27')]=function(_0x46fc11){var _0x2a7e04=this;return new Promise(function(_0x555aac,_0x148eae){return db[_0xb0e5('0x28')][_0xb0e5('0x14')]({'raw':!![],'where':{'ContactId':_0x46fc11['body'][_0xb0e5('0x16')],'ListId':_0x46fc11['body'][_0xb0e5('0x29')],'VoiceQueueId':_0x46fc11['body']['VoiceQueueId']===undefined?null:_0x46fc11[_0xb0e5('0x15')][_0xb0e5('0x17')],'CampaignId':_0x46fc11['body'][_0xb0e5('0x18')]===undefined?null:_0x46fc11['body'][_0xb0e5('0x18')]}})[_0xb0e5('0x19')](function(_0x17ed8c){if(_0x17ed8c!=null){return db[_0xb0e5('0x1a')][_0xb0e5('0x14')]({'raw':!![],'where':{'CmHopperId':_0x17ed8c['id'],'OrderBy':{'$gte':_0x17ed8c[_0xb0e5('0x1b')]}},'order':[[_0xb0e5('0x1b'),_0xb0e5('0x24')]]})['then'](function(_0x46d61e){if(_0x46d61e)return activateAdditionalPhone(_0x17ed8c,_0x46fc11['body'],_0x46d61e,_0x46fc11['duration'],_0x46fc11[_0xb0e5('0x2a')])['then'](function(_0x1ed2b1){_0x555aac(_0x1ed2b1);});else{return db[_0xb0e5('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x17ed8c['id']},'order':[[_0xb0e5('0x1b'),_0xb0e5('0x24')]]})[_0xb0e5('0x19')](function(_0x52aa12){if(_0x52aa12)return activateAdditionalPhone(_0x17ed8c,_0x46fc11[_0xb0e5('0x15')],_0x52aa12,_0x46fc11[_0xb0e5('0x2b')],_0x46fc11[_0xb0e5('0x2a')])['then'](function(_0x4defab){_0x555aac(_0x4defab);});else{_0x555aac({'id':_0x17ed8c['id'],'phone':''});}})[_0xb0e5('0x13')](function(_0x1d8bb2){logger['error'](_0xb0e5('0x26'),_0x1d8bb2[_0xb0e5('0x12')]);_0x148eae(_0x2a7e04[_0xb0e5('0x10')](0x1f4,_0x1d8bb2[_0xb0e5('0x12')]));});}})[_0xb0e5('0x13')](function(_0x55d8af){logger[_0xb0e5('0x10')](_0xb0e5('0x26'),_0x55d8af['message']);_0x148eae(_0x2a7e04[_0xb0e5('0x10')](0x1f4,_0x55d8af[_0xb0e5('0x12')]));});}else _0x555aac(0x1);});});};function activateAdditionalPhone(_0x1d30c3,_0x38170e,_0x48b8e3,_0x9404a,_0x1ac6cd){return new Promise(function(_0x3d8fce,_0x7dd140){var _0x3dd68e;if(_[_0xb0e5('0x2c')](_0x48b8e3[_0xb0e5('0x2d')])){_0x48b8e3[_0xb0e5('0x2d')]=moment();}if(moment()>moment(_0x48b8e3[_0xb0e5('0x2d')])){_0x3dd68e=moment()['add'](_0x1ac6cd||0x3,'minutes');}else{if(_0x48b8e3[_0xb0e5('0x1b')]==0x0){_0x3dd68e=moment(_0x48b8e3[_0xb0e5('0x2d')]);}else{_0x3dd68e=moment()['add'](_0x1ac6cd||0x3,'minutes');}}if(_[_0xb0e5('0x2c')](_0x3dd68e)){_0x3dd68e=moment()['add'](_0x1ac6cd||0x3,_0xb0e5('0x2e'));}var _0x268742={'phone':_0x1d30c3[_0xb0e5('0x2f')],'active':0x0,'OrderBy':_[_0xb0e5('0x2c')](_0x1d30c3[_0xb0e5('0x1b')])?0x0:_0x1d30c3[_0xb0e5('0x1b')],'scheduledat':moment()[_0xb0e5('0x30')](_0x9404a||0x1,_0xb0e5('0x2e')),'countbusyretry':_0x38170e[_0xb0e5('0x1c')],'countcongestionretry':_0x38170e[_0xb0e5('0x1d')],'countnoanswerretry':_0x38170e['countnoanswerretry'],'countnosuchnumberretry':_0x38170e['countnosuchnumberretry'],'countdropretry':_0x38170e[_0xb0e5('0x20')],'countabandonedretry':_0x38170e[_0xb0e5('0x21')],'countmachineretry':_0x38170e[_0xb0e5('0x25')],'countagentrejectretry':_0x38170e[_0xb0e5('0x31')],'createdAt':_0x38170e[_0xb0e5('0x32')],'updatedAt':_0x38170e['updatedAt']};var _0x2cfdca={'CmHopperId':_0x1d30c3['id'],'phone':_0x48b8e3[_0xb0e5('0x2f')],'active':0x0,'OrderBy':_[_0xb0e5('0x2c')](_0x48b8e3['OrderBy'])?0x0:_0x48b8e3[_0xb0e5('0x1b')],'scheduledat':_0x3dd68e,'countbusyretry':_0x48b8e3[_0xb0e5('0x1c')],'countcongestionretry':_0x48b8e3[_0xb0e5('0x1d')],'countnoanswerretry':_0x48b8e3[_0xb0e5('0x1e')],'countnosuchnumberretry':_0x48b8e3[_0xb0e5('0x1f')],'countdropretry':_0x48b8e3[_0xb0e5('0x20')],'countabandonedretry':_0x48b8e3['countabandonedretry'],'countmachineretry':_0x48b8e3['countmachineretry'],'countagentrejectretry':_0x48b8e3[_0xb0e5('0x31')],'createdAt':_0x48b8e3[_0xb0e5('0x32')],'updatedAt':_0x48b8e3[_0xb0e5('0x33')]};return db[_0xb0e5('0x34')][_0xb0e5('0x35')](function(_0x43ef74){return db[_0xb0e5('0x1a')]['update'](_0x268742,{'where':{'id':_0x48b8e3['id']}},{'transaction':_0x43ef74})['then'](function(){return db[_0xb0e5('0x28')][_0xb0e5('0x36')](_0x2cfdca,{'where':{'id':_0x1d30c3['id']}},{'transaction':_0x43ef74});});})[_0xb0e5('0x19')](function(_0x4760b9){_0x3d8fce({'id':_0x1d30c3['id'],'phone':_0x48b8e3[_0xb0e5('0x2f')]});})[_0xb0e5('0x13')](function(_0x5da8bf){logger['error'](_0xb0e5('0x37'),_0x5da8bf['message']);_0x7dd140({'error':_0x5da8bf[_0xb0e5('0x12')]});});});}exports[_0xb0e5('0x38')]=function(_0x35634e){var _0x56714a=this;return new Promise(function(_0x51a8fc,_0x187f33){return db[_0xb0e5('0x28')][_0xb0e5('0x36')](_0x35634e[_0xb0e5('0x15')][_0xb0e5('0x39')],{'where':{'id':_0x35634e[_0xb0e5('0x15')]['id']}})[_0xb0e5('0x19')](function(_0x44a738){_0x51a8fc(_0x44a738);})[_0xb0e5('0x13')](function(_0x16be4d){logger[_0xb0e5('0x10')](_0xb0e5('0x38'),_0x16be4d[_0xb0e5('0x12')]);_0x187f33(_0x56714a['error'](0x1f4,_0x16be4d['message']));});});}; \ No newline at end of file +var _0xb7aa=['http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','catch','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','sequelize','transaction','update','phone','IncrementPreviewCounters','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x57a205,_0x288fee){var _0x149a79=function(_0xb4b7bb){while(--_0xb4b7bb){_0x57a205['push'](_0x57a205['shift']());}};_0x149a79(++_0x288fee);}(_0xb7aa,0x13b));var _0xab7a=function(_0x581fac,_0x165cbc){_0x581fac=_0x581fac-0x0;var _0x207776=_0xb7aa[_0x581fac];return _0x207776;};'use strict';var _=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var moment=require(_0xab7a('0x2'));var BPromise=require(_0xab7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab7a('0x4'));var db=require(_0xab7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab7a('0x6'));var config=require(_0xab7a('0x7'));var jayson=require(_0xab7a('0x8'));var client=jayson['client'][_0xab7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c4dd4,_0xa63800,_0x1fdfb1){return new BPromise(function(_0x74568a,_0x39d86d){return client['request'](_0x2c4dd4,_0x1fdfb1)[_0xab7a('0xa')](function(_0x18b260){logger[_0xab7a('0xb')](_0xab7a('0xc'),_0xa63800,_0xab7a('0xd'));logger[_0xab7a('0xe')](_0xab7a('0xf'),_0xa63800,'request\x20sent',JSON['stringify'](_0x18b260));if(_0x18b260[_0xab7a('0x10')]){if(_0x18b260[_0xab7a('0x10')]['code']===0x1f4){logger[_0xab7a('0x10')](_0xab7a('0xc'),_0xa63800,_0x18b260[_0xab7a('0x10')][_0xab7a('0x11')]);return _0x39d86d(_0x18b260['error'][_0xab7a('0x11')]);}logger[_0xab7a('0x10')](_0xab7a('0xc'),_0xa63800,_0x18b260[_0xab7a('0x10')][_0xab7a('0x11')]);return _0x74568a(_0x18b260['error']['message']);}else{logger[_0xab7a('0xb')](_0xab7a('0xc'),_0xa63800,_0xab7a('0xd'));_0x74568a(_0x18b260[_0xab7a('0x12')][_0xab7a('0x11')]);}})['catch'](function(_0x10e39c){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xa63800,_0x10e39c);_0x39d86d(_0x10e39c);});});}exports[_0xab7a('0x13')]=function(_0x4d9f3d){var _0x541870=this;return new Promise(function(_0x37beb8,_0x1dbf17){return db[_0xab7a('0x14')][_0xab7a('0x15')]({'raw':!![],'where':{'ContactId':_0x4d9f3d[_0xab7a('0x16')]['ContactId'],'ListId':_0x4d9f3d[_0xab7a('0x16')]['ListId'],'VoiceQueueId':_0x4d9f3d['body']['VoiceQueueId']===undefined?null:_0x4d9f3d['body'][_0xab7a('0x17')],'CampaignId':_0x4d9f3d['body']['CampaignId']===undefined?null:_0x4d9f3d[_0xab7a('0x16')][_0xab7a('0x18')]}})[_0xab7a('0xa')](function(_0xb46f1a){if(_0xb46f1a!=null){return db[_0xab7a('0x19')][_0xab7a('0x15')]({'raw':!![],'where':{'CmHopperId':_0xb46f1a['id'],'OrderBy':{'$gt':_0xb46f1a[_0xab7a('0x1a')]}},'order':[[_0xab7a('0x1a'),_0xab7a('0x1b')]]})[_0xab7a('0xa')](function(_0x464004){var _0x37d36a=0x0;if(_0x464004){if(_0x464004['countbusyretry']+_0x464004[_0xab7a('0x1c')]+_0x464004[_0xab7a('0x1d')]+_0x464004[_0xab7a('0x1e')]+_0x464004[_0xab7a('0x1f')]+_0x464004[_0xab7a('0x20')]+_0x464004[_0xab7a('0x21')]+_0x464004[_0xab7a('0x22')]<_0x4d9f3d[_0xab7a('0x23')][_0xab7a('0x24')])_0x37d36a=0x1;_0x37beb8({'additional':_0x37d36a});}else{return db[_0xab7a('0x19')][_0xab7a('0x15')]({'raw':!![],'where':{'CmHopperId':_0xb46f1a['id']},'order':[[_0xab7a('0x1a'),_0xab7a('0x1b')]]})[_0xab7a('0xa')](function(_0x1a06a5){var _0x58698c=0x0;if(_0x1a06a5){if(_0x1a06a5[_0xab7a('0x25')]+_0x1a06a5[_0xab7a('0x1c')]+_0x1a06a5[_0xab7a('0x1d')]+_0x1a06a5[_0xab7a('0x1e')]+_0x1a06a5[_0xab7a('0x1f')]+_0x1a06a5[_0xab7a('0x20')]+_0x1a06a5[_0xab7a('0x21')]+_0x1a06a5[_0xab7a('0x22')]<_0x4d9f3d['entity'][_0xab7a('0x24')])_0x58698c=0x1;_0x37beb8({'additional':_0x58698c});}else{_0x37beb8({'additional':0x0});}})[_0xab7a('0x26')](function(_0x7e17a8){logger['error'](_0xab7a('0x13'),_0x7e17a8[_0xab7a('0x11')]);_0x1dbf17(_0x541870['error'](0x1f4,_0x7e17a8[_0xab7a('0x11')]));});}})['catch'](function(_0x3cad47){logger[_0xab7a('0x10')](_0xab7a('0x13'),_0x3cad47['message']);_0x1dbf17(_0x541870[_0xab7a('0x10')](0x1f4,_0x3cad47[_0xab7a('0x11')]));});}else _0x37beb8({'additional':0x0});});});};exports[_0xab7a('0x27')]=function(_0x5c93ef){var _0x4c424a=this;return new Promise(function(_0x1b627c,_0x70a4b5){return db[_0xab7a('0x14')][_0xab7a('0x15')]({'raw':!![],'where':{'ContactId':_0x5c93ef[_0xab7a('0x16')][_0xab7a('0x28')],'ListId':_0x5c93ef[_0xab7a('0x16')]['ListId'],'VoiceQueueId':_0x5c93ef[_0xab7a('0x16')][_0xab7a('0x17')]===undefined?null:_0x5c93ef[_0xab7a('0x16')][_0xab7a('0x17')],'CampaignId':_0x5c93ef['body'][_0xab7a('0x18')]===undefined?null:_0x5c93ef[_0xab7a('0x16')]['CampaignId']}})['then'](function(_0x47d54f){if(_0x47d54f!=null){return db['CmHopperAdditionalPhone'][_0xab7a('0x15')]({'raw':!![],'where':{'CmHopperId':_0x47d54f['id'],'OrderBy':{'$gte':_0x47d54f[_0xab7a('0x1a')]}},'order':[[_0xab7a('0x1a'),_0xab7a('0x1b')]]})[_0xab7a('0xa')](function(_0x31ad97){if(_0x31ad97)return activateAdditionalPhone(_0x47d54f,_0x5c93ef[_0xab7a('0x16')],_0x31ad97,_0x5c93ef[_0xab7a('0x29')],_0x5c93ef[_0xab7a('0x2a')])['then'](function(_0x342b7a){_0x1b627c(_0x342b7a);});else{return db[_0xab7a('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x47d54f['id']},'order':[[_0xab7a('0x1a'),'ASC']]})[_0xab7a('0xa')](function(_0x402fa5){if(_0x402fa5)return activateAdditionalPhone(_0x47d54f,_0x5c93ef[_0xab7a('0x16')],_0x402fa5,_0x5c93ef[_0xab7a('0x29')],_0x5c93ef[_0xab7a('0x2a')])[_0xab7a('0xa')](function(_0x52754f){_0x1b627c(_0x52754f);});else{_0x1b627c({'id':_0x47d54f['id'],'phone':''});}})[_0xab7a('0x26')](function(_0x573d1a){logger[_0xab7a('0x10')](_0xab7a('0x13'),_0x573d1a['message']);_0x70a4b5(_0x4c424a['error'](0x1f4,_0x573d1a[_0xab7a('0x11')]));});}})[_0xab7a('0x26')](function(_0x45893a){logger[_0xab7a('0x10')]('VerifyAdditionalPhones',_0x45893a[_0xab7a('0x11')]);_0x70a4b5(_0x4c424a['error'](0x1f4,_0x45893a[_0xab7a('0x11')]));});}else _0x1b627c(0x1);});});};function activateAdditionalPhone(_0x16eda6,_0x40279f,_0x5cbed6,_0x5d19d3,_0x2e2973){return new Promise(function(_0x3b438e,_0x24776b){var _0x3a3af5;if(_[_0xab7a('0x2b')](_0x5cbed6[_0xab7a('0x2c')])){_0x5cbed6[_0xab7a('0x2c')]=moment();}if(moment()>moment(_0x5cbed6['scheduledat'])){_0x3a3af5=moment()[_0xab7a('0x2d')](_0x2e2973||0x3,_0xab7a('0x2e'));}else{if(_0x5cbed6['OrderBy']==0x0){_0x3a3af5=moment(_0x5cbed6[_0xab7a('0x2c')]);}else{_0x3a3af5=moment()[_0xab7a('0x2d')](_0x2e2973||0x3,_0xab7a('0x2e'));}}if(_[_0xab7a('0x2b')](_0x3a3af5)){_0x3a3af5=moment()[_0xab7a('0x2d')](_0x2e2973||0x3,_0xab7a('0x2e'));}var _0x45136e={'phone':_0x16eda6['phone'],'active':0x0,'OrderBy':_['isNil'](_0x16eda6['OrderBy'])?0x0:_0x16eda6[_0xab7a('0x1a')],'scheduledat':moment()[_0xab7a('0x2d')](_0x5d19d3||0x1,'minutes'),'countbusyretry':_0x40279f[_0xab7a('0x25')],'countcongestionretry':_0x40279f[_0xab7a('0x1c')],'countnoanswerretry':_0x40279f[_0xab7a('0x1d')],'countnosuchnumberretry':_0x40279f[_0xab7a('0x1e')],'countdropretry':_0x40279f['countdropretry'],'countabandonedretry':_0x40279f['countabandonedretry'],'countmachineretry':_0x40279f['countmachineretry'],'countagentrejectretry':_0x40279f[_0xab7a('0x22')],'createdAt':_0x40279f[_0xab7a('0x2f')],'updatedAt':_0x40279f['updatedAt']};var _0x3a9d9c={'CmHopperId':_0x16eda6['id'],'phone':_0x5cbed6['phone'],'active':0x0,'OrderBy':_[_0xab7a('0x2b')](_0x5cbed6[_0xab7a('0x1a')])?0x0:_0x5cbed6[_0xab7a('0x1a')],'scheduledat':_0x3a3af5,'countbusyretry':_0x5cbed6['countbusyretry'],'countcongestionretry':_0x5cbed6[_0xab7a('0x1c')],'countnoanswerretry':_0x5cbed6[_0xab7a('0x1d')],'countnosuchnumberretry':_0x5cbed6[_0xab7a('0x1e')],'countdropretry':_0x5cbed6[_0xab7a('0x1f')],'countabandonedretry':_0x5cbed6[_0xab7a('0x20')],'countmachineretry':_0x5cbed6[_0xab7a('0x21')],'countagentrejectretry':_0x5cbed6['countagentrejectretry'],'createdAt':_0x5cbed6[_0xab7a('0x2f')],'updatedAt':_0x5cbed6[_0xab7a('0x30')]};return db[_0xab7a('0x31')][_0xab7a('0x32')](function(_0x332e78){return db[_0xab7a('0x19')]['update'](_0x45136e,{'where':{'id':_0x5cbed6['id']}},{'transaction':_0x332e78})['then'](function(){return db['CmHopper'][_0xab7a('0x33')](_0x3a9d9c,{'where':{'id':_0x16eda6['id']}},{'transaction':_0x332e78});});})['then'](function(_0x6fe6a0){_0x3b438e({'id':_0x16eda6['id'],'phone':_0x5cbed6[_0xab7a('0x34')]});})[_0xab7a('0x26')](function(_0x2ffe84){logger[_0xab7a('0x10')]('activateAdditionalPhone',_0x2ffe84[_0xab7a('0x11')]);_0x24776b({'error':_0x2ffe84[_0xab7a('0x11')]});});});}exports[_0xab7a('0x35')]=function(_0x45af2d){var _0xedd8a3=this;return new Promise(function(_0x21b00a,_0xdb6f17){return db[_0xab7a('0x14')][_0xab7a('0x33')](_0x45af2d[_0xab7a('0x16')]['field'],{'where':{'id':_0x45af2d[_0xab7a('0x16')]['id']}})[_0xab7a('0xa')](function(_0x1d4061){_0x21b00a(_0x1d4061);})['catch'](function(_0x26e32a){logger[_0xab7a('0x10')]('IncrementPreviewCounters',_0x26e32a[_0xab7a('0x11')]);_0xdb6f17(_0xedd8a3['error'](0x1f4,_0x26e32a[_0xab7a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index cc16831..57fda32 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 _0xd5c6=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x2f98c2,_0x54ec47){var _0x1ede3c=function(_0x1081fd){while(--_0x1081fd){_0x2f98c2['push'](_0x2f98c2['shift']());}};_0x1ede3c(++_0x54ec47);}(_0xd5c6,0x76));var _0x6d5c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd5c6[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x6d5c('0x0'));var util=require(_0x6d5c('0x1'));var path=require(_0x6d5c('0x2'));var timeout=require(_0x6d5c('0x3'));var express=require(_0x6d5c('0x4'));var router=express['Router']();var fs_extra=require(_0x6d5c('0x5'));var auth=require(_0x6d5c('0x6'));var interaction=require(_0x6d5c('0x7'));var config=require(_0x6d5c('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x6d5c('0x9')]('/',auth[_0x6d5c('0xa')](),controller[_0x6d5c('0xb')]);router[_0x6d5c('0x9')](_0x6d5c('0xc'),auth[_0x6d5c('0xa')](),controller[_0x6d5c('0xd')]);router[_0x6d5c('0xe')]('/',auth[_0x6d5c('0xa')](),controller[_0x6d5c('0xf')]);router[_0x6d5c('0x10')](_0x6d5c('0xc'),auth[_0x6d5c('0xa')](),controller['update']);router[_0x6d5c('0x11')](_0x6d5c('0xc'),auth[_0x6d5c('0xa')](),controller[_0x6d5c('0x12')]);module[_0x6d5c('0x13')]=router; \ No newline at end of file +var _0x9d53=['destroy','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0x9d53,0xf1));var _0x39d5=function(_0x159f74,_0x36d2a8){_0x159f74=_0x159f74-0x0;var _0x114853=_0x9d53[_0x159f74];return _0x114853;};'use strict';var multer=require(_0x39d5('0x0'));var util=require('util');var path=require(_0x39d5('0x1'));var timeout=require('connect-timeout');var express=require(_0x39d5('0x2'));var router=express['Router']();var fs_extra=require(_0x39d5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x39d5('0x4'));var config=require(_0x39d5('0x5'));var controller=require(_0x39d5('0x6'));router[_0x39d5('0x7')]('/',auth[_0x39d5('0x8')](),controller[_0x39d5('0x9')]);router[_0x39d5('0x7')](_0x39d5('0xa'),auth[_0x39d5('0x8')](),controller['show']);router[_0x39d5('0xb')]('/',auth[_0x39d5('0x8')](),controller[_0x39d5('0xc')]);router[_0x39d5('0xd')](_0x39d5('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x39d5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c31e4da..e502c40 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 _0xd943=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x3b3013,_0x2260c8){var _0x14c9cc=function(_0x4cf559){while(--_0x4cf559){_0x3b3013['push'](_0x3b3013['shift']());}};_0x14c9cc(++_0x2260c8);}(_0xd943,0x14a));var _0x3d94=function(_0x4cf3c5,_0x150517){_0x4cf3c5=_0x4cf3c5-0x0;var _0xce1d62=_0xd943[_0x4cf3c5];return _0xce1d62;};'use strict';var moment=require(_0x3d94('0x0'));var Sequelize=require(_0x3d94('0x1'));module[_0x3d94('0x2')]={'phone':{'type':Sequelize[_0x3d94('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3d94('0x4')],'unique':_0x3d94('0x5')},'ListId':{'type':Sequelize[_0x3d94('0x4')],'unique':_0x3d94('0x5')},'VoiceQueueId':{'type':Sequelize[_0x3d94('0x4')],'unique':_0x3d94('0x5')}}; \ No newline at end of file +var _0xcbd3=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x45ec8a,_0x3bd588){_0x45ec8a=_0x45ec8a-0x0;var _0x1f05f4=_0xcbd3[_0x45ec8a];return _0x1f05f4;};'use strict';var moment=require(_0x3cbd('0x0'));var Sequelize=require(_0x3cbd('0x1'));module[_0x3cbd('0x2')]={'phone':{'type':Sequelize[_0x3cbd('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3cbd('0x4')],'unique':_0x3cbd('0x5')},'ListId':{'type':Sequelize[_0x3cbd('0x4')],'unique':_0x3cbd('0x5')},'VoiceQueueId':{'type':Sequelize[_0x3cbd('0x4')],'unique':_0x3cbd('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 44a9260..3d356c0 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 _0x18dc=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','CmHopperBlack','include','findAll','catch','show','keys','includeAll','find','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path'];(function(_0x32b8f0,_0x3d1222){var _0x4f3a2e=function(_0x51c177){while(--_0x51c177){_0x32b8f0['push'](_0x32b8f0['shift']());}};_0x4f3a2e(++_0x3d1222);}(_0x18dc,0x11d));var _0xc18d=function(_0x26f68f,_0x125079){_0x26f68f=_0x26f68f-0x0;var _0x3047dd=_0x18dc[_0x26f68f];return _0x3047dd;};'use strict';var emlformat=require(_0xc18d('0x0'));var rimraf=require(_0xc18d('0x1'));var zipdir=require(_0xc18d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc18d('0x3'));var BPromise=require(_0xc18d('0x4'));var Mustache=require('mustache');var util=require(_0xc18d('0x5'));var path=require(_0xc18d('0x6'));var sox=require(_0xc18d('0x7'));var csv=require(_0xc18d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc18d('0x9'));var _=require(_0xc18d('0xa'));var squel=require(_0xc18d('0xb'));var crypto=require(_0xc18d('0xc'));var jsforce=require(_0xc18d('0xd'));var deskjs=require(_0xc18d('0xe'));var toCsv=require(_0xc18d('0x8'));var querystring=require(_0xc18d('0xf'));var Papa=require(_0xc18d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc18d('0x11'));var as=require(_0xc18d('0x12'));var hardwareService=require(_0xc18d('0x13'));var logger=require(_0xc18d('0x14'))(_0xc18d('0x15'));var utils=require(_0xc18d('0x16'));var config=require(_0xc18d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc18d('0x18'))['db'];function respondWithStatusCode(_0x291567,_0x385e21){_0x385e21=_0x385e21||0xcc;return function(_0x38f782){if(_0x38f782){return _0x291567[_0xc18d('0x19')](_0x385e21);}return _0x291567[_0xc18d('0x1a')](_0x385e21)[_0xc18d('0x1b')]();};}function respondWithResult(_0x5a70ed,_0x28e3ce){_0x28e3ce=_0x28e3ce||0xc8;return function(_0x1a21df){if(_0x1a21df){return _0x5a70ed[_0xc18d('0x1a')](_0x28e3ce)['json'](_0x1a21df);}};}function respondWithFilteredResult(_0xc77fd6,_0x441a43){return function(_0x358eee){if(_0x358eee){var _0x462ca3=typeof _0x441a43[_0xc18d('0x1c')]===_0xc18d('0x1d')&&typeof _0x441a43[_0xc18d('0x1e')]==='undefined';var _0x569634=_0x358eee[_0xc18d('0x1f')];var _0x4b11fc=_0x462ca3?0x0:_0x441a43[_0xc18d('0x1c')];var _0x4246ca=_0x462ca3?_0x358eee[_0xc18d('0x1f')]:_0x441a43[_0xc18d('0x1c')]+_0x441a43['limit'];var _0x19b22c;if(_0x4246ca>=_0x569634){_0x4246ca=_0x569634;_0x19b22c=0xc8;}else{_0x19b22c=0xce;}_0xc77fd6['status'](_0x19b22c);return _0xc77fd6['set'](_0xc18d('0x20'),_0x4b11fc+'-'+_0x4246ca+'/'+_0x569634)['json'](_0x358eee);}return null;};}function patchUpdates(_0xf37536){return function(_0x5cf1f){try{jsonpatch[_0xc18d('0x21')](_0x5cf1f,_0xf37536,!![]);}catch(_0x5f3e75){return BPromise[_0xc18d('0x22')](_0x5f3e75);}return _0x5cf1f['save']();};}function saveUpdates(_0x39c058,_0x3c32bd){return function(_0x314192){if(_0x314192){return _0x314192[_0xc18d('0x23')](_0x39c058)[_0xc18d('0x24')](function(_0x34497d){return _0x34497d;});}return null;};}function removeEntity(_0x4c5557,_0x44c2d3){return function(_0x3ec8c1){if(_0x3ec8c1){return _0x3ec8c1[_0xc18d('0x25')]()[_0xc18d('0x24')](function(){_0x4c5557[_0xc18d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x78ee9d,_0x3b2033){return function(_0x5940a6){if(!_0x5940a6){_0x78ee9d[_0xc18d('0x19')](0x194);}return _0x5940a6;};}function handleError(_0x5f0586,_0x19b228){_0x19b228=_0x19b228||0x1f4;return function(_0x3a3a21){logger[_0xc18d('0x26')](_0x3a3a21[_0xc18d('0x27')]);if(_0x3a3a21[_0xc18d('0x28')]){delete _0x3a3a21[_0xc18d('0x28')];}_0x5f0586[_0xc18d('0x1a')](_0x19b228)[_0xc18d('0x29')](_0x3a3a21);};}exports[_0xc18d('0x2a')]=function(_0x4f2ece,_0x2517f6){var _0x26762c={},_0x454bf0={},_0x5693e2={'count':0x0,'rows':[]};var _0x53a630=_[_0xc18d('0x2b')](db['CmHopperBlack'][_0xc18d('0x2c')],function(_0x402aae){return{'name':_0x402aae['fieldName'],'type':_0x402aae[_0xc18d('0x2d')][_0xc18d('0x2e')]};});_0x454bf0[_0xc18d('0x2f')]=_['map'](_0x53a630,_0xc18d('0x28'));_0x454bf0[_0xc18d('0x30')]=_['keys'](_0x4f2ece['query']);_0x454bf0[_0xc18d('0x31')]=_[_0xc18d('0x32')](_0x454bf0[_0xc18d('0x2f')],_0x454bf0['query']);_0x26762c[_0xc18d('0x33')]=_[_0xc18d('0x32')](_0x454bf0[_0xc18d('0x2f')],qs[_0xc18d('0x34')](_0x4f2ece[_0xc18d('0x30')][_0xc18d('0x34')]));_0x26762c[_0xc18d('0x33')]=_0x26762c[_0xc18d('0x33')][_0xc18d('0x35')]?_0x26762c[_0xc18d('0x33')]:_0x454bf0[_0xc18d('0x2f')];if(!_0x4f2ece[_0xc18d('0x30')][_0xc18d('0x36')](_0xc18d('0x37'))){_0x26762c[_0xc18d('0x1e')]=qs[_0xc18d('0x1e')](_0x4f2ece[_0xc18d('0x30')][_0xc18d('0x1e')]);_0x26762c[_0xc18d('0x1c')]=qs[_0xc18d('0x1c')](_0x4f2ece[_0xc18d('0x30')][_0xc18d('0x1c')]);}_0x26762c['order']=qs[_0xc18d('0x38')](_0x4f2ece[_0xc18d('0x30')][_0xc18d('0x38')]);_0x26762c[_0xc18d('0x39')]=qs['filters'](_['pick'](_0x4f2ece[_0xc18d('0x30')],_0x454bf0['filters']),_0x53a630);if(_0x4f2ece[_0xc18d('0x30')][_0xc18d('0x3a')]){_0x26762c[_0xc18d('0x39')]=_[_0xc18d('0x3b')](_0x26762c[_0xc18d('0x39')],{'$or':_['map'](_0x53a630,function(_0x38d726){if(_0x38d726['type']!==_0xc18d('0x3c')){var _0x13f719={};_0x13f719[_0x38d726['name']]={'$like':'%'+_0x4f2ece[_0xc18d('0x30')][_0xc18d('0x3a')]+'%'};return _0x13f719;}})});}_0x26762c=_[_0xc18d('0x3b')]({},_0x26762c,_0x4f2ece[_0xc18d('0x3d')]);var _0x4d99d9={'where':_0x26762c['where']};return db[_0xc18d('0x3e')][_0xc18d('0x1f')](_0x4d99d9)[_0xc18d('0x24')](function(_0x5861a6){_0x5693e2[_0xc18d('0x1f')]=_0x5861a6;if(_0x4f2ece[_0xc18d('0x30')]['includeAll']){_0x26762c[_0xc18d('0x3f')]=[{'all':!![]}];}return db[_0xc18d('0x3e')][_0xc18d('0x40')](_0x26762c);})[_0xc18d('0x24')](function(_0x54df1b){_0x5693e2['rows']=_0x54df1b;return _0x5693e2;})[_0xc18d('0x24')](respondWithFilteredResult(_0x2517f6,_0x26762c))[_0xc18d('0x41')](handleError(_0x2517f6,null));};exports[_0xc18d('0x42')]=function(_0x2db11b,_0x3c146d){var _0x4ae2f4={'raw':!![],'where':{'id':_0x2db11b['params']['id']}},_0x574042={};_0x574042['model']=_[_0xc18d('0x43')](db[_0xc18d('0x3e')][_0xc18d('0x2c')]);_0x574042[_0xc18d('0x30')]=_[_0xc18d('0x43')](_0x2db11b[_0xc18d('0x30')]);_0x574042[_0xc18d('0x31')]=_['intersection'](_0x574042[_0xc18d('0x2f')],_0x574042['query']);_0x4ae2f4[_0xc18d('0x33')]=_[_0xc18d('0x32')](_0x574042[_0xc18d('0x2f')],qs[_0xc18d('0x34')](_0x2db11b['query'][_0xc18d('0x34')]));_0x4ae2f4[_0xc18d('0x33')]=_0x4ae2f4[_0xc18d('0x33')][_0xc18d('0x35')]?_0x4ae2f4[_0xc18d('0x33')]:_0x574042[_0xc18d('0x2f')];if(_0x2db11b[_0xc18d('0x30')][_0xc18d('0x44')]){_0x4ae2f4['include']=[{'all':!![]}];}_0x4ae2f4=_['merge']({},_0x4ae2f4,_0x2db11b[_0xc18d('0x3d')]);return db['CmHopperBlack'][_0xc18d('0x45')](_0x4ae2f4)['then'](handleEntityNotFound(_0x3c146d,null))[_0xc18d('0x24')](respondWithResult(_0x3c146d,null))[_0xc18d('0x41')](handleError(_0x3c146d,null));};exports[_0xc18d('0x23')]=function(_0x5b61e1,_0x33c1d5){if(_0x5b61e1[_0xc18d('0x46')]['id']){delete _0x5b61e1[_0xc18d('0x46')]['id'];}return db[_0xc18d('0x3e')][_0xc18d('0x45')]({'where':{'id':_0x5b61e1[_0xc18d('0x47')]['id']}})[_0xc18d('0x24')](handleEntityNotFound(_0x33c1d5,null))[_0xc18d('0x24')](saveUpdates(_0x5b61e1[_0xc18d('0x46')],null))['then'](respondWithResult(_0x33c1d5,null))[_0xc18d('0x41')](handleError(_0x33c1d5,null));};exports[_0xc18d('0x25')]=function(_0x227771,_0x5a5690){return db[_0xc18d('0x3e')][_0xc18d('0x45')]({'where':{'id':_0x227771[_0xc18d('0x47')]['id']}})[_0xc18d('0x24')](handleEntityNotFound(_0x5a5690,null))[_0xc18d('0x24')](removeEntity(_0x5a5690,null))[_0xc18d('0x41')](handleError(_0x5a5690,null));};exports[_0xc18d('0x48')]=function(_0x4cb73d,_0x400c41){return db['CmHopperBlack']['describe']()[_0xc18d('0x24')](respondWithResult(_0x400c41,null))[_0xc18d('0x41')](handleError(_0x400c41,null));}; \ No newline at end of file +var _0x8970=['send','index','map','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','CmHopperBlack','includeAll','include','findAll','rows','catch','params','options','find','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','then','error','stack','name'];(function(_0x58f57f,_0x23028c){var _0x318b7f=function(_0x1f239b){while(--_0x1f239b){_0x58f57f['push'](_0x58f57f['shift']());}};_0x318b7f(++_0x23028c);}(_0x8970,0xb3));var _0x0897=function(_0x362471,_0x39a9cf){_0x362471=_0x362471-0x0;var _0x51d9db=_0x8970[_0x362471];return _0x51d9db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0897('0x0'));var zipdir=require(_0x0897('0x1'));var jsonpatch=require(_0x0897('0x2'));var rp=require(_0x0897('0x3'));var moment=require(_0x0897('0x4'));var BPromise=require(_0x0897('0x5'));var Mustache=require(_0x0897('0x6'));var util=require('util');var path=require(_0x0897('0x7'));var sox=require(_0x0897('0x8'));var csv=require('to-csv');var ejs=require(_0x0897('0x9'));var fs=require('fs');var fs_extra=require(_0x0897('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0897('0xb'));var deskjs=require(_0x0897('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0897('0xd'));var Redis=require(_0x0897('0xe'));var authService=require(_0x0897('0xf'));var qs=require(_0x0897('0x10'));var as=require(_0x0897('0x11'));var hardwareService=require(_0x0897('0x12'));var logger=require(_0x0897('0x13'))(_0x0897('0x14'));var utils=require(_0x0897('0x15'));var config=require(_0x0897('0x16'));var licenseUtil=require(_0x0897('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bb0c2,_0x36ba4e){_0x36ba4e=_0x36ba4e||0xcc;return function(_0x82d29a){if(_0x82d29a){return _0x5bb0c2[_0x0897('0x18')](_0x36ba4e);}return _0x5bb0c2['status'](_0x36ba4e)[_0x0897('0x19')]();};}function respondWithResult(_0x4c7246,_0x26c45c){_0x26c45c=_0x26c45c||0xc8;return function(_0x5b2f9c){if(_0x5b2f9c){return _0x4c7246[_0x0897('0x1a')](_0x26c45c)[_0x0897('0x1b')](_0x5b2f9c);}};}function respondWithFilteredResult(_0x592899,_0x24b360){return function(_0x4889ad){if(_0x4889ad){var _0x2200a4=typeof _0x24b360[_0x0897('0x1c')]===_0x0897('0x1d')&&typeof _0x24b360[_0x0897('0x1e')]===_0x0897('0x1d');var _0x412c1b=_0x4889ad['count'];var _0x247c1d=_0x2200a4?0x0:_0x24b360[_0x0897('0x1c')];var _0xadceae=_0x2200a4?_0x4889ad[_0x0897('0x1f')]:_0x24b360['offset']+_0x24b360[_0x0897('0x1e')];var _0xd45251;if(_0xadceae>=_0x412c1b){_0xadceae=_0x412c1b;_0xd45251=0xc8;}else{_0xd45251=0xce;}_0x592899['status'](_0xd45251);return _0x592899[_0x0897('0x20')](_0x0897('0x21'),_0x247c1d+'-'+_0xadceae+'/'+_0x412c1b)['json'](_0x4889ad);}return null;};}function patchUpdates(_0x206f3a){return function(_0x437b33){try{jsonpatch[_0x0897('0x22')](_0x437b33,_0x206f3a,!![]);}catch(_0x439e04){return BPromise['reject'](_0x439e04);}return _0x437b33['save']();};}function saveUpdates(_0x2ebd1e,_0x3855a5){return function(_0x5583b9){if(_0x5583b9){return _0x5583b9['update'](_0x2ebd1e)['then'](function(_0x5d3f7a){return _0x5d3f7a;});}return null;};}function removeEntity(_0x1eedaa,_0x340d58){return function(_0x2424f9){if(_0x2424f9){return _0x2424f9[_0x0897('0x23')]()[_0x0897('0x24')](function(){_0x1eedaa[_0x0897('0x1a')](0xcc)[_0x0897('0x19')]();});}};}function handleEntityNotFound(_0x133f11,_0x3ec210){return function(_0x39363d){if(!_0x39363d){_0x133f11[_0x0897('0x18')](0x194);}return _0x39363d;};}function handleError(_0x360e15,_0x2e8c1d){_0x2e8c1d=_0x2e8c1d||0x1f4;return function(_0xf4ecad){logger[_0x0897('0x25')](_0xf4ecad[_0x0897('0x26')]);if(_0xf4ecad[_0x0897('0x27')]){delete _0xf4ecad[_0x0897('0x27')];}_0x360e15[_0x0897('0x1a')](_0x2e8c1d)[_0x0897('0x28')](_0xf4ecad);};}exports[_0x0897('0x29')]=function(_0x374ce6,_0x25500a){var _0x269576={},_0x149d28={},_0x4c7677={'count':0x0,'rows':[]};var _0x71ff7b=_[_0x0897('0x2a')](db['CmHopperBlack']['rawAttributes'],function(_0x8f20b4){return{'name':_0x8f20b4[_0x0897('0x2b')],'type':_0x8f20b4[_0x0897('0x2c')][_0x0897('0x2d')]};});_0x149d28['model']=_[_0x0897('0x2a')](_0x71ff7b,_0x0897('0x27'));_0x149d28[_0x0897('0x2e')]=_[_0x0897('0x2f')](_0x374ce6[_0x0897('0x2e')]);_0x149d28[_0x0897('0x30')]=_['intersection'](_0x149d28[_0x0897('0x31')],_0x149d28[_0x0897('0x2e')]);_0x269576['attributes']=_[_0x0897('0x32')](_0x149d28[_0x0897('0x31')],qs[_0x0897('0x33')](_0x374ce6[_0x0897('0x2e')][_0x0897('0x33')]));_0x269576[_0x0897('0x34')]=_0x269576[_0x0897('0x34')][_0x0897('0x35')]?_0x269576[_0x0897('0x34')]:_0x149d28[_0x0897('0x31')];if(!_0x374ce6[_0x0897('0x2e')][_0x0897('0x36')]('nolimit')){_0x269576[_0x0897('0x1e')]=qs[_0x0897('0x1e')](_0x374ce6[_0x0897('0x2e')][_0x0897('0x1e')]);_0x269576[_0x0897('0x1c')]=qs['offset'](_0x374ce6[_0x0897('0x2e')]['offset']);}_0x269576[_0x0897('0x37')]=qs['sort'](_0x374ce6[_0x0897('0x2e')][_0x0897('0x38')]);_0x269576[_0x0897('0x39')]=qs[_0x0897('0x30')](_['pick'](_0x374ce6[_0x0897('0x2e')],_0x149d28['filters']),_0x71ff7b);if(_0x374ce6[_0x0897('0x2e')]['filter']){_0x269576[_0x0897('0x39')]=_[_0x0897('0x3a')](_0x269576[_0x0897('0x39')],{'$or':_[_0x0897('0x2a')](_0x71ff7b,function(_0x26498b){if(_0x26498b[_0x0897('0x2c')]!==_0x0897('0x3b')){var _0x179a3e={};_0x179a3e[_0x26498b[_0x0897('0x27')]]={'$like':'%'+_0x374ce6[_0x0897('0x2e')][_0x0897('0x3c')]+'%'};return _0x179a3e;}})});}_0x269576=_[_0x0897('0x3a')]({},_0x269576,_0x374ce6['options']);var _0x5bcb0b={'where':_0x269576[_0x0897('0x39')]};return db[_0x0897('0x3d')]['count'](_0x5bcb0b)[_0x0897('0x24')](function(_0x3b6b00){_0x4c7677[_0x0897('0x1f')]=_0x3b6b00;if(_0x374ce6[_0x0897('0x2e')][_0x0897('0x3e')]){_0x269576[_0x0897('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0897('0x40')](_0x269576);})[_0x0897('0x24')](function(_0x26e9a1){_0x4c7677[_0x0897('0x41')]=_0x26e9a1;return _0x4c7677;})[_0x0897('0x24')](respondWithFilteredResult(_0x25500a,_0x269576))[_0x0897('0x42')](handleError(_0x25500a,null));};exports['show']=function(_0x40eed7,_0x4508ae){var _0x453f51={'raw':!![],'where':{'id':_0x40eed7[_0x0897('0x43')]['id']}},_0x51b232={};_0x51b232['model']=_[_0x0897('0x2f')](db['CmHopperBlack']['rawAttributes']);_0x51b232[_0x0897('0x2e')]=_[_0x0897('0x2f')](_0x40eed7['query']);_0x51b232[_0x0897('0x30')]=_[_0x0897('0x32')](_0x51b232[_0x0897('0x31')],_0x51b232[_0x0897('0x2e')]);_0x453f51[_0x0897('0x34')]=_['intersection'](_0x51b232[_0x0897('0x31')],qs['fields'](_0x40eed7['query'][_0x0897('0x33')]));_0x453f51[_0x0897('0x34')]=_0x453f51[_0x0897('0x34')]['length']?_0x453f51[_0x0897('0x34')]:_0x51b232[_0x0897('0x31')];if(_0x40eed7[_0x0897('0x2e')]['includeAll']){_0x453f51[_0x0897('0x3f')]=[{'all':!![]}];}_0x453f51=_[_0x0897('0x3a')]({},_0x453f51,_0x40eed7[_0x0897('0x44')]);return db['CmHopperBlack'][_0x0897('0x45')](_0x453f51)[_0x0897('0x24')](handleEntityNotFound(_0x4508ae,null))['then'](respondWithResult(_0x4508ae,null))['catch'](handleError(_0x4508ae,null));};exports[_0x0897('0x46')]=function(_0x4de0a3,_0x3df8f7){if(_0x4de0a3[_0x0897('0x47')]['id']){delete _0x4de0a3[_0x0897('0x47')]['id'];}return db[_0x0897('0x3d')][_0x0897('0x45')]({'where':{'id':_0x4de0a3[_0x0897('0x43')]['id']}})[_0x0897('0x24')](handleEntityNotFound(_0x3df8f7,null))[_0x0897('0x24')](saveUpdates(_0x4de0a3[_0x0897('0x47')],null))[_0x0897('0x24')](respondWithResult(_0x3df8f7,null))[_0x0897('0x42')](handleError(_0x3df8f7,null));};exports[_0x0897('0x23')]=function(_0x18469,_0x42a234){return db[_0x0897('0x3d')]['find']({'where':{'id':_0x18469['params']['id']}})[_0x0897('0x24')](handleEntityNotFound(_0x42a234,null))[_0x0897('0x24')](removeEntity(_0x42a234,null))['catch'](handleError(_0x42a234,null));};exports['describe']=function(_0x26f268,_0x303d13){return db['CmHopperBlack'][_0x0897('0x48')]()[_0x0897('0x24')](respondWithResult(_0x303d13,null))[_0x0897('0x42')](handleError(_0x303d13,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2fc23e4..f81a79f 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 _0xaf92=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x4b7c85,_0x479378){var _0x209bec=function(_0x4d2e89){while(--_0x4d2e89){_0x4b7c85['push'](_0x4b7c85['shift']());}};_0x209bec(++_0x479378);}(_0xaf92,0x81));var _0x2af9=function(_0x52c32f,_0x5d5431){_0x52c32f=_0x52c32f-0x0;var _0x6504cb=_0xaf92[_0x52c32f];return _0x6504cb;};'use strict';var _=require(_0x2af9('0x0'));var util=require(_0x2af9('0x1'));var logger=require(_0x2af9('0x2'))(_0x2af9('0x3'));var moment=require('moment');var BPromise=require(_0x2af9('0x4'));var rp=require(_0x2af9('0x5'));var fs=require('fs');var path=require(_0x2af9('0x6'));var rimraf=require(_0x2af9('0x7'));var config=require(_0x2af9('0x8'));var attributes=require(_0x2af9('0x9'));module['exports']=function(_0x98b47d,_0x5d7d1e){return _0x98b47d['define']('CmHopperBlack',attributes,{'tableName':_0x2af9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa904=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','api','moment','request-promise','path'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xa904,0xc6));var _0x4a90=function(_0xe69bf1,_0x487cbc){_0xe69bf1=_0xe69bf1-0x0;var _0x1259d1=_0xa904[_0xe69bf1];return _0x1259d1;};'use strict';var _=require(_0x4a90('0x0'));var util=require(_0x4a90('0x1'));var logger=require('../../config/logger')(_0x4a90('0x2'));var moment=require(_0x4a90('0x3'));var BPromise=require('bluebird');var rp=require(_0x4a90('0x4'));var fs=require('fs');var path=require(_0x4a90('0x5'));var rimraf=require(_0x4a90('0x6'));var config=require(_0x4a90('0x7'));var attributes=require(_0x4a90('0x8'));module[_0x4a90('0x9')]=function(_0x4610db,_0x1b15fd){return _0x4610db[_0x4a90('0xa')]('CmHopperBlack',attributes,{'tableName':_0x4a90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index fb45f7a..20da098 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 _0x17d6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','raw','options','attributes','limit','include','map','model','then','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x17d6,0x1de));var _0x617d=function(_0xc93e0d,_0x3e4859){_0xc93e0d=_0xc93e0d-0x0;var _0x48c470=_0x17d6[_0xc93e0d];return _0x48c470;};'use strict';var _=require(_0x617d('0x0'));var util=require(_0x617d('0x1'));var moment=require(_0x617d('0x2'));var BPromise=require(_0x617d('0x3'));var rs=require(_0x617d('0x4'));var fs=require('fs');var Redis=require(_0x617d('0x5'));var db=require(_0x617d('0x6'))['db'];var utils=require(_0x617d('0x7'));var logger=require('../../config/logger')(_0x617d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x617d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5fa,_0x1b599e,_0x209f59){return new BPromise(function(_0x2e5617,_0x203503){return client['request'](_0x4f5fa,_0x209f59)['then'](function(_0x5d3d3b){logger[_0x617d('0xa')](_0x617d('0xb'),_0x1b599e,_0x617d('0xc'));logger[_0x617d('0xd')](_0x617d('0xe'),_0x1b599e,_0x617d('0xc'),JSON[_0x617d('0xf')](_0x5d3d3b));if(_0x5d3d3b['error']){if(_0x5d3d3b[_0x617d('0x10')][_0x617d('0x11')]===0x1f4){logger[_0x617d('0x10')](_0x617d('0xb'),_0x1b599e,_0x5d3d3b[_0x617d('0x10')][_0x617d('0x12')]);return _0x203503(_0x5d3d3b[_0x617d('0x10')][_0x617d('0x12')]);}logger[_0x617d('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x1b599e,_0x5d3d3b[_0x617d('0x10')]['message']);return _0x2e5617(_0x5d3d3b['error'][_0x617d('0x12')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x1b599e,'request\x20sent');_0x2e5617(_0x5d3d3b['result']['message']);}})[_0x617d('0x13')](function(_0x33e6d9){logger[_0x617d('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x1b599e,_0x33e6d9);_0x203503(_0x33e6d9);});});}exports['GetCmHopperBlack']=function(_0x147cb9){var _0x1aef91=this;return new Promise(function(_0xf84114,_0x49f43b){return db['CmHopperBlack'][_0x617d('0x14')]({'raw':_0x147cb9['options']?_0x147cb9['options'][_0x617d('0x15')]===undefined?!![]:![]:!![],'where':_0x147cb9[_0x617d('0x16')]?_0x147cb9[_0x617d('0x16')]['where']||null:null,'attributes':_0x147cb9[_0x617d('0x16')]?_0x147cb9[_0x617d('0x16')][_0x617d('0x17')]||null:null,'limit':_0x147cb9[_0x617d('0x16')]?_0x147cb9['options'][_0x617d('0x18')]||null:null,'include':_0x147cb9['options']?_0x147cb9[_0x617d('0x16')][_0x617d('0x19')]?_[_0x617d('0x1a')](_0x147cb9[_0x617d('0x16')]['include'],function(_0x36b744){return{'model':db[_0x36b744[_0x617d('0x1b')]],'as':_0x36b744['as'],'attributes':_0x36b744[_0x617d('0x17')],'include':_0x36b744[_0x617d('0x19')]?_['map'](_0x36b744['include'],function(_0x4d4a8a){return{'model':db[_0x4d4a8a[_0x617d('0x1b')]],'as':_0x4d4a8a['as'],'attributes':_0x4d4a8a['attributes'],'include':_0x4d4a8a[_0x617d('0x19')]?_[_0x617d('0x1a')](_0x4d4a8a[_0x617d('0x19')],function(_0x3644e9){return{'model':db[_0x3644e9[_0x617d('0x1b')]],'as':_0x3644e9['as'],'attributes':_0x3644e9[_0x617d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x617d('0x1c')](function(_0x32dad2){logger['info']('GetCmHopperBlack',_0x147cb9);logger[_0x617d('0xd')](_0x617d('0x1d'),_0x147cb9,JSON['stringify'](_0x32dad2));_0xf84114(_0x32dad2);})[_0x617d('0x13')](function(_0xd80b6e){logger[_0x617d('0x10')](_0x617d('0x1d'),_0xd80b6e[_0x617d('0x12')],_0x147cb9);_0x49f43b(_0x1aef91[_0x617d('0x10')](0x1f4,_0xd80b6e[_0x617d('0x12')]));});});};exports[_0x617d('0x1e')]=function(_0x23ba82){var _0x16e9f1=this;return new Promise(function(_0x287379,_0x58cd2e){return db[_0x617d('0x1f')][_0x617d('0x20')](_0x23ba82[_0x617d('0x21')],{'raw':_0x23ba82[_0x617d('0x16')]?_0x23ba82['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23ba82[_0x617d('0x16')]?_0x23ba82[_0x617d('0x16')][_0x617d('0x22')]||null:null,'attributes':_0x23ba82[_0x617d('0x16')]?_0x23ba82[_0x617d('0x16')][_0x617d('0x17')]||null:null,'limit':_0x23ba82[_0x617d('0x16')]?_0x23ba82[_0x617d('0x16')][_0x617d('0x18')]||null:null})[_0x617d('0x1c')](function(_0x5f58ff){logger[_0x617d('0xa')](_0x617d('0x1e'),_0x23ba82);logger[_0x617d('0xd')](_0x617d('0x1e'),_0x23ba82,JSON['stringify'](_0x5f58ff));_0x287379(_0x5f58ff);})[_0x617d('0x13')](function(_0x4b48b0){logger['error'](_0x617d('0x1e'),_0x4b48b0[_0x617d('0x12')],_0x23ba82);_0x58cd2e(_0x16e9f1[_0x617d('0x10')](0x1f4,_0x4b48b0[_0x617d('0x12')]));});});};exports[_0x617d('0x23')]=function(_0x59d199){var _0x1fd715=this;return new Promise(function(_0x53af2d,_0x24a81c){return db[_0x617d('0x1f')][_0x617d('0x24')]({'where':_0x59d199[_0x617d('0x16')]?_0x59d199[_0x617d('0x16')][_0x617d('0x22')]||null:null})[_0x617d('0x1c')](function(_0x329fc6){logger[_0x617d('0xa')](_0x617d('0x23'),_0x59d199);logger[_0x617d('0xd')](_0x617d('0x23'),_0x59d199,JSON[_0x617d('0xf')](_0x329fc6));_0x53af2d(_0x329fc6);})['catch'](function(_0x5ec016){logger[_0x617d('0x10')](_0x617d('0x23'),_0x5ec016[_0x617d('0x12')],_0x59d199);_0x24a81c(_0x1fd715[_0x617d('0x10')](0x1f4,_0x5ec016[_0x617d('0x12')]));});});}; \ No newline at end of file +var _0xa357=['debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','include','map','model','UpdateCmHopperBlack','update','body','raw','where','limit','stringify','destroy','DestroyCmHopperBlack','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0x3705b6,_0x50d8d9){var _0x5cf2f7=function(_0x33e227){while(--_0x33e227){_0x3705b6['push'](_0x3705b6['shift']());}};_0x5cf2f7(++_0x50d8d9);}(_0xa357,0x65));var _0x7a35=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xa357[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0x7a35('0x0'));var util=require(_0x7a35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a35('0x2'));var db=require(_0x7a35('0x3'))['db'];var utils=require(_0x7a35('0x4'));var logger=require(_0x7a35('0x5'))(_0x7a35('0x6'));var config=require(_0x7a35('0x7'));var jayson=require(_0x7a35('0x8'));var client=jayson[_0x7a35('0x9')][_0x7a35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39a5ef,_0x5dfec7,_0x225e45){return new BPromise(function(_0x1d66ad,_0x4aacda){return client[_0x7a35('0xb')](_0x39a5ef,_0x225e45)[_0x7a35('0xc')](function(_0xbafb19){logger[_0x7a35('0xd')](_0x7a35('0xe'),_0x5dfec7,_0x7a35('0xf'));logger[_0x7a35('0x10')](_0x7a35('0x11'),_0x5dfec7,_0x7a35('0xf'),JSON['stringify'](_0xbafb19));if(_0xbafb19[_0x7a35('0x12')]){if(_0xbafb19[_0x7a35('0x12')][_0x7a35('0x13')]===0x1f4){logger[_0x7a35('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x5dfec7,_0xbafb19[_0x7a35('0x12')]['message']);return _0x4aacda(_0xbafb19['error'][_0x7a35('0x14')]);}logger[_0x7a35('0x12')](_0x7a35('0xe'),_0x5dfec7,_0xbafb19[_0x7a35('0x12')][_0x7a35('0x14')]);return _0x1d66ad(_0xbafb19[_0x7a35('0x12')][_0x7a35('0x14')]);}else{logger[_0x7a35('0xd')](_0x7a35('0xe'),_0x5dfec7,_0x7a35('0xf'));_0x1d66ad(_0xbafb19['result'][_0x7a35('0x14')]);}})[_0x7a35('0x15')](function(_0x2a47a4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5dfec7,_0x2a47a4);_0x4aacda(_0x2a47a4);});});}exports[_0x7a35('0x16')]=function(_0x2f54a8){var _0x22db75=this;return new Promise(function(_0x34007a,_0x3a5b50){return db[_0x7a35('0x17')][_0x7a35('0x18')]({'raw':_0x2f54a8['options']?_0x2f54a8[_0x7a35('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2f54a8[_0x7a35('0x19')]?_0x2f54a8[_0x7a35('0x19')]['where']||null:null,'attributes':_0x2f54a8['options']?_0x2f54a8[_0x7a35('0x19')][_0x7a35('0x1a')]||null:null,'limit':_0x2f54a8[_0x7a35('0x19')]?_0x2f54a8[_0x7a35('0x19')]['limit']||null:null,'include':_0x2f54a8[_0x7a35('0x19')]?_0x2f54a8[_0x7a35('0x19')][_0x7a35('0x1b')]?_[_0x7a35('0x1c')](_0x2f54a8['options'][_0x7a35('0x1b')],function(_0x11085c){return{'model':db[_0x11085c[_0x7a35('0x1d')]],'as':_0x11085c['as'],'attributes':_0x11085c[_0x7a35('0x1a')],'include':_0x11085c['include']?_[_0x7a35('0x1c')](_0x11085c['include'],function(_0x2a0081){return{'model':db[_0x2a0081[_0x7a35('0x1d')]],'as':_0x2a0081['as'],'attributes':_0x2a0081[_0x7a35('0x1a')],'include':_0x2a0081[_0x7a35('0x1b')]?_[_0x7a35('0x1c')](_0x2a0081[_0x7a35('0x1b')],function(_0x5e7752){return{'model':db[_0x5e7752[_0x7a35('0x1d')]],'as':_0x5e7752['as'],'attributes':_0x5e7752[_0x7a35('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d1c95){logger['info'](_0x7a35('0x16'),_0x2f54a8);logger['debug'](_0x7a35('0x16'),_0x2f54a8,JSON['stringify'](_0x1d1c95));_0x34007a(_0x1d1c95);})['catch'](function(_0x43b575){logger['error'](_0x7a35('0x16'),_0x43b575['message'],_0x2f54a8);_0x3a5b50(_0x22db75['error'](0x1f4,_0x43b575[_0x7a35('0x14')]));});});};exports[_0x7a35('0x1e')]=function(_0x316077){var _0x2c09d8=this;return new Promise(function(_0x3370b9,_0x4d91da){return db['CmHopperBlack'][_0x7a35('0x1f')](_0x316077[_0x7a35('0x20')],{'raw':_0x316077[_0x7a35('0x19')]?_0x316077[_0x7a35('0x19')][_0x7a35('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316077[_0x7a35('0x19')]?_0x316077['options'][_0x7a35('0x22')]||null:null,'attributes':_0x316077[_0x7a35('0x19')]?_0x316077[_0x7a35('0x19')][_0x7a35('0x1a')]||null:null,'limit':_0x316077[_0x7a35('0x19')]?_0x316077[_0x7a35('0x19')][_0x7a35('0x23')]||null:null})[_0x7a35('0xc')](function(_0x194b3e){logger[_0x7a35('0xd')]('UpdateCmHopperBlack',_0x316077);logger['debug'](_0x7a35('0x1e'),_0x316077,JSON[_0x7a35('0x24')](_0x194b3e));_0x3370b9(_0x194b3e);})['catch'](function(_0x5c0c5b){logger[_0x7a35('0x12')](_0x7a35('0x1e'),_0x5c0c5b[_0x7a35('0x14')],_0x316077);_0x4d91da(_0x2c09d8['error'](0x1f4,_0x5c0c5b[_0x7a35('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x3a96df){var _0x2dec2a=this;return new Promise(function(_0x5a6e2c,_0xe0f990){return db[_0x7a35('0x17')][_0x7a35('0x25')]({'where':_0x3a96df[_0x7a35('0x19')]?_0x3a96df[_0x7a35('0x19')]['where']||null:null})[_0x7a35('0xc')](function(_0x569368){logger['info'](_0x7a35('0x26'),_0x3a96df);logger[_0x7a35('0x10')]('DestroyCmHopperBlack',_0x3a96df,JSON[_0x7a35('0x24')](_0x569368));_0x5a6e2c(_0x569368);})[_0x7a35('0x15')](function(_0x517163){logger['error'](_0x7a35('0x26'),_0x517163['message'],_0x3a96df);_0xe0f990(_0x2dec2a[_0x7a35('0x12')](0x1f4,_0x517163[_0x7a35('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 3289f13..b50349c 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd101,0xc1));var _0x1d10=function(_0x5567bc,_0x1d0c9a){_0x5567bc=_0x5567bc-0x0;var _0x2710b7=_0xd101[_0x5567bc];return _0x2710b7;};'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 _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a94d24e..84ea971 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 _0xc1c5=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x50f702,_0x46815d){var _0xd4981d=function(_0x58114d){while(--_0x58114d){_0x50f702['push'](_0x50f702['shift']());}};_0xd4981d(++_0x46815d);}(_0xc1c5,0xbc));var _0x5c1c=function(_0x44215e,_0xf68538){_0x44215e=_0x44215e-0x0;var _0x229326=_0xc1c5[_0x44215e];return _0x229326;};'use strict';var Sequelize=require(_0x5c1c('0x0'));var moment=require(_0x5c1c('0x1'));module['exports']={'state':{'type':Sequelize[_0x5c1c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5c1c('0x3')]},'scheduledat':{'type':Sequelize[_0x5c1c('0x4')]},'countbusyretry':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5c1c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5c1c('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5c1c('0x3')]},'calleridname':{'type':Sequelize[_0x5c1c('0x3')]},'starttime':{'type':Sequelize[_0x5c1c('0x4')]},'responsetime':{'type':Sequelize[_0x5c1c('0x4')]},'answertime':{'type':Sequelize[_0x5c1c('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5c1c('0x3')]},'membername':{'type':Sequelize[_0x5c1c('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5c1c('0x3')]},'secondDisposition':{'type':Sequelize[_0x5c1c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5c1c('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x378d0a){var _0x3e3ca7=this[_0x5c1c('0x5')](_0x5c1c('0x6'));if(_0x3e3ca7&&_0x378d0a){this[_0x5c1c('0x7')](_0x5c1c('0x8'),moment(_0x378d0a)[_0x5c1c('0x9')](moment(_0x3e3ca7),'seconds'));}}},'amd':{'type':Sequelize[_0x5c1c('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5c1c('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5c1c('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5c1c('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5c1c('0x4')]},'callback':{'type':Sequelize[_0x5c1c('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5c1c('0x4')]},'deleted':{'type':Sequelize[_0x5c1c('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5c1c('0x4')]},'recallme':{'type':Sequelize[_0x5c1c('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5c1c('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5c1c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ede=['DATE','INTEGER','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports','STRING'];(function(_0x3aa78e,_0x43d0f1){var _0x61caf7=function(_0x5fbdb9){while(--_0x5fbdb9){_0x3aa78e['push'](_0x3aa78e['shift']());}};_0x61caf7(++_0x43d0f1);}(_0x3ede,0x146));var _0xe3ed=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x3ede[_0x26a4ea];return _0x1b669e;};'use strict';var Sequelize=require(_0xe3ed('0x0'));var moment=require(_0xe3ed('0x1'));module[_0xe3ed('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe3ed('0x3')]},'scheduledat':{'type':Sequelize[_0xe3ed('0x4')]},'countbusyretry':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe3ed('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xe3ed('0x3')]},'calleridnum':{'type':Sequelize[_0xe3ed('0x3')]},'calleridname':{'type':Sequelize[_0xe3ed('0x3')]},'starttime':{'type':Sequelize[_0xe3ed('0x4')]},'responsetime':{'type':Sequelize[_0xe3ed('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe3ed('0x4')]},'endtime':{'type':Sequelize[_0xe3ed('0x4')]},'ringtime':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe3ed('0x3')]},'campaign':{'type':Sequelize[_0xe3ed('0x3')]},'campaigntype':{'type':Sequelize[_0xe3ed('0x3')]},'membername':{'type':Sequelize[_0xe3ed('0x3')]},'reason':{'type':Sequelize[_0xe3ed('0x3')]},'disposition':{'type':Sequelize[_0xe3ed('0x3')]},'secondDisposition':{'type':Sequelize[_0xe3ed('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe3ed('0x3')]},'dispositionat':{'type':Sequelize[_0xe3ed('0x4')],'set':function(_0x3849e6){var _0x1e0fb3=this['getDataValue'](_0xe3ed('0x6'));if(_0x1e0fb3&&_0x3849e6){this[_0xe3ed('0x7')](_0xe3ed('0x8'),moment(_0x3849e6)['diff'](moment(_0x1e0fb3),_0xe3ed('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe3ed('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe3ed('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe3ed('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe3ed('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe3ed('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe3ed('0x4')]},'recallme':{'type':Sequelize[_0xe3ed('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe3ed('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe3ed('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe3ed('0x5')],'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 04e6415..ca07e55 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 _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x814b,0x1a2));var _0xb814=function(_0x554047,_0x46ec41){_0x554047=_0x554047-0x0;var _0x5d11e4=_0x814b[_0x554047];return _0x5d11e4;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file +var _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','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','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x28557b,_0x479a06){var _0x5a695d=function(_0x46cc0d){while(--_0x46cc0d){_0x28557b['push'](_0x28557b['shift']());}};_0x5a695d(++_0x479a06);}(_0x4819,0xcd));var _0x9481=function(_0x3f9602,_0x132175){_0x3f9602=_0x3f9602-0x0;var _0x5133ea=_0x4819[_0x3f9602];return _0x5133ea;};'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'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['CmHopperFinal']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index cbacf38..1242db4 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 _0x430d=['path','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api','moment','request-promise'];(function(_0x42eab0,_0x2442e0){var _0x4c3f19=function(_0x11f5cc){while(--_0x11f5cc){_0x42eab0['push'](_0x42eab0['shift']());}};_0x4c3f19(++_0x2442e0);}(_0x430d,0x188));var _0xd430=function(_0x58cda9,_0x89446e){_0x58cda9=_0x58cda9-0x0;var _0x12a811=_0x430d[_0x58cda9];return _0x12a811;};'use strict';var _=require('lodash');var util=require(_0xd430('0x0'));var logger=require('../../config/logger')(_0xd430('0x1'));var moment=require(_0xd430('0x2'));var BPromise=require('bluebird');var rp=require(_0xd430('0x3'));var fs=require('fs');var path=require(_0xd430('0x4'));var rimraf=require('rimraf');var config=require(_0xd430('0x5'));var attributes=require('./cmHopperFinal.attributes');module[_0xd430('0x6')]=function(_0x57f7d3,_0x45f1e2){return _0x57f7d3[_0xd430('0x7')](_0xd430('0x8'),attributes,{'tableName':_0xd430('0x9'),'paranoid':![],'indexes':[{'name':_0xd430('0xa'),'fields':[_0xd430('0xa')]},{'name':'uniqueid','fields':[_0xd430('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2787=['path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x39d825,_0x291cd8){var _0x168917=function(_0x330a69){while(--_0x330a69){_0x39d825['push'](_0x39d825['shift']());}};_0x168917(++_0x291cd8);}(_0x2787,0x70));var _0x7278=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2787[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7278('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7278('0x1'));var moment=require(_0x7278('0x2'));var BPromise=require(_0x7278('0x3'));var rp=require(_0x7278('0x4'));var fs=require('fs');var path=require(_0x7278('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7278('0x6'));module[_0x7278('0x7')]=function(_0x50c857,_0x16a6ed){return _0x50c857[_0x7278('0x8')](_0x7278('0x9'),attributes,{'tableName':_0x7278('0xa'),'paranoid':![],'indexes':[{'name':_0x7278('0xb'),'fields':[_0x7278('0xb')]},{'name':_0x7278('0xc'),'fields':[_0x7278('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 12a0d61..085cdbd 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(_0x1aef23,_0x17ea5e){var _0x5f2bea=function(_0x448b95){while(--_0x448b95){_0x1aef23['push'](_0x1aef23['shift']());}};_0x5f2bea(++_0x17ea5e);}(_0x7a54,0x106));var _0x47a5=function(_0x1fa605,_0x43c2bb){_0x1fa605=_0x1fa605-0x0;var _0x3ced0f=_0x7a54[_0x1fa605];return _0x3ced0f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x291ffa,_0x566a20){var _0x291b31=function(_0x95f065){while(--_0x95f065){_0x291ffa['push'](_0x291ffa['shift']());}};_0x291b31(++_0x566a20);}(_0x7a54,0x106));var _0x47a5=function(_0x30c0fc,_0x127a32){_0x30c0fc=_0x30c0fc-0x0;var _0x117836=_0x7a54[_0x30c0fc];return _0x117836;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 4a1bd71..c69a18f 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 _0x5e60=['update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5e60,0x179));var _0x05e6=function(_0x2981d1,_0x4cd4b9){_0x2981d1=_0x2981d1-0x0;var _0x5791e7=_0x5e60[_0x2981d1];return _0x5791e7;};'use strict';var multer=require('multer');var util=require(_0x05e6('0x0'));var path=require(_0x05e6('0x1'));var timeout=require(_0x05e6('0x2'));var express=require('express');var router=express[_0x05e6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x05e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x05e6('0x5'));var controller=require('./cmHopperFinal.controller');router[_0x05e6('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x05e6('0x7'),auth[_0x05e6('0x8')](),controller[_0x05e6('0x9')]);router[_0x05e6('0x6')]('/:id',auth[_0x05e6('0x8')](),controller[_0x05e6('0xa')]);router[_0x05e6('0x6')](_0x05e6('0xb'),auth[_0x05e6('0x8')](),controller[_0x05e6('0xc')]);router[_0x05e6('0x6')](_0x05e6('0xd'),auth[_0x05e6('0x8')](),controller[_0x05e6('0xe')]);router[_0x05e6('0xf')](_0x05e6('0x10'),auth[_0x05e6('0x8')](),controller[_0x05e6('0x11')]);router[_0x05e6('0xf')](_0x05e6('0x12'),auth[_0x05e6('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x05e6('0x13'),auth[_0x05e6('0x8')](),controller[_0x05e6('0x14')]);router[_0x05e6('0x15')](_0x05e6('0x16'),auth[_0x05e6('0x8')](),controller[_0x05e6('0x17')]);module[_0x05e6('0x18')]=router; \ No newline at end of file +var _0x1b62=['isAuthenticated','countContactsQueueCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','fs-extra','../../components/interaction/service','get','index','describe','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x1b62,0x199));var _0x21b6=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x1b62[_0x197185];return _0x2c8af1;};'use strict';var multer=require(_0x21b6('0x0'));var util=require(_0x21b6('0x1'));var path=require(_0x21b6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x21b6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x21b6('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x21b6('0x5')]('/',auth['isAuthenticated'](),controller[_0x21b6('0x6')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x21b6('0x7')]);router['get'](_0x21b6('0x8'),auth['isAuthenticated'](),controller[_0x21b6('0x9')]);router[_0x21b6('0x5')](_0x21b6('0xa'),auth[_0x21b6('0xb')](),controller[_0x21b6('0xc')]);router[_0x21b6('0x5')]('/campaign/countAttributes/:id',auth[_0x21b6('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x21b6('0xd')]('/voice/queue/moveContacts/:id',auth[_0x21b6('0xb')](),controller[_0x21b6('0xe')]);router[_0x21b6('0xd')](_0x21b6('0xf'),auth['isAuthenticated'](),controller[_0x21b6('0x10')]);router[_0x21b6('0xd')](_0x21b6('0x11'),auth['isAuthenticated'](),controller[_0x21b6('0x12')]);router[_0x21b6('0x13')](_0x21b6('0x8'),auth[_0x21b6('0xb')](),controller['update']);module[_0x21b6('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 588af46..bd1c2bb 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 _0x9bc8=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9bc8,0xa6));var _0x89bc=function(_0x3338e4,_0x1b8448){_0x3338e4=_0x3338e4-0x0;var _0x16afa8=_0x9bc8[_0x3338e4];return _0x16afa8;};'use strict';var Sequelize=require(_0x89bc('0x0'));module[_0x89bc('0x1')]={'state':{'type':Sequelize[_0x89bc('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x89bc('0x3')]},'scheduledat':{'type':Sequelize[_0x89bc('0x4')]},'countbusyretry':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x89bc('0x3')]},'calleridnum':{'type':Sequelize[_0x89bc('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x89bc('0x4')]},'responsetime':{'type':Sequelize[_0x89bc('0x4')]},'answertime':{'type':Sequelize[_0x89bc('0x4')]},'droptime':{'type':Sequelize[_0x89bc('0x4')]},'endtime':{'type':Sequelize[_0x89bc('0x4')]},'ringtime':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x89bc('0x3')]},'campaign':{'type':Sequelize[_0x89bc('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x89bc('0x3')]},'reason':{'type':Sequelize[_0x89bc('0x3')]},'amd':{'type':Sequelize[_0x89bc('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x89bc('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x89bc('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x89bc('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x89bc('0x4')]},'edited':{'type':Sequelize[_0x89bc('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x89bc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x89bc('0x3')]}}; \ No newline at end of file +var _0x3102=['STRING','DATE','BOOLEAN','INTEGER'];(function(_0x11f314,_0xd1c18f){var _0x350978=function(_0x1375fd){while(--_0x1375fd){_0x11f314['push'](_0x11f314['shift']());}};_0x350978(++_0xd1c18f);}(_0x3102,0x83));var _0x2310=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x3102[_0x3c22e0];return _0x215811;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x2310('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x2310('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2310('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x2310('0x1')]},'originatecalleridname':{'type':Sequelize[_0x2310('0x1')]},'calleridnum':{'type':Sequelize[_0x2310('0x1')]},'calleridname':{'type':Sequelize[_0x2310('0x1')]},'starttime':{'type':Sequelize[_0x2310('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x2310('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2310('0x1')]},'campaigntype':{'type':Sequelize[_0x2310('0x1')]},'membername':{'type':Sequelize[_0x2310('0x1')]},'reason':{'type':Sequelize[_0x2310('0x1')]},'amd':{'type':Sequelize[_0x2310('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2310('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2310('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2310('0x2')]},'recallme':{'type':Sequelize[_0x2310('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x2310('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2310('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2310('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a28fb5e..a9a2a8e 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 _0x516e=['includeAll','include','catch','show','params','find','create','describe','body','uniqueid','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x516e,0x9a));var _0xe516=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x516e[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xe516('0x0'));var rimraf=require(_0xe516('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe516('0x2'));var moment=require('moment');var BPromise=require(_0xe516('0x3'));var Mustache=require(_0xe516('0x4'));var util=require(_0xe516('0x5'));var path=require(_0xe516('0x6'));var sox=require(_0xe516('0x7'));var csv=require(_0xe516('0x8'));var ejs=require(_0xe516('0x9'));var fs=require('fs');var fs_extra=require(_0xe516('0xa'));var _=require(_0xe516('0xb'));var squel=require('squel');var crypto=require(_0xe516('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe516('0xd'));var toCsv=require(_0xe516('0x8'));var querystring=require(_0xe516('0xe'));var Papa=require('papaparse');var Redis=require(_0xe516('0xf'));var authService=require(_0xe516('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe516('0x11'))(_0xe516('0x12'));var utils=require('../../config/utils');var config=require(_0xe516('0x13'));var licenseUtil=require(_0xe516('0x14'));var db=require(_0xe516('0x15'))['db'];function respondWithStatusCode(_0x2b8f9d,_0x34c390){_0x34c390=_0x34c390||0xcc;return function(_0x192dc0){if(_0x192dc0){return _0x2b8f9d[_0xe516('0x16')](_0x34c390);}return _0x2b8f9d['status'](_0x34c390)['end']();};}function respondWithResult(_0x30170a,_0xe2a0d1){_0xe2a0d1=_0xe2a0d1||0xc8;return function(_0x44264d){if(_0x44264d){return _0x30170a[_0xe516('0x17')](_0xe2a0d1)['json'](_0x44264d);}};}function respondWithFilteredResult(_0x519c1c,_0x1f302a){return function(_0x268543){if(_0x268543){var _0x2a9437=typeof _0x1f302a['offset']===_0xe516('0x18')&&typeof _0x1f302a['limit']===_0xe516('0x18');var _0x42fa33=_0x268543['count'];var _0x53ee34=_0x2a9437?0x0:_0x1f302a['offset'];var _0x547337=_0x2a9437?_0x268543[_0xe516('0x19')]:_0x1f302a['offset']+_0x1f302a[_0xe516('0x1a')];var _0x59e2db;if(_0x547337>=_0x42fa33){_0x547337=_0x42fa33;_0x59e2db=0xc8;}else{_0x59e2db=0xce;}_0x519c1c[_0xe516('0x17')](_0x59e2db);return _0x519c1c[_0xe516('0x1b')](_0xe516('0x1c'),_0x53ee34+'-'+_0x547337+'/'+_0x42fa33)[_0xe516('0x1d')](_0x268543);}return null;};}function patchUpdates(_0x47f5ba){return function(_0x17f03c){try{jsonpatch[_0xe516('0x1e')](_0x17f03c,_0x47f5ba,!![]);}catch(_0x10c458){return BPromise['reject'](_0x10c458);}return _0x17f03c[_0xe516('0x1f')]();};}function saveUpdates(_0x5c20a6,_0x5212bd){return function(_0x22114f){if(_0x22114f){return _0x22114f[_0xe516('0x20')](_0x5c20a6)[_0xe516('0x21')](function(_0x46d570){return _0x46d570;});}return null;};}function removeEntity(_0x2c69f2,_0x53ce36){return function(_0x48fa5d){if(_0x48fa5d){return _0x48fa5d[_0xe516('0x22')]()[_0xe516('0x21')](function(){_0x2c69f2[_0xe516('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430c78,_0x15ae7c){return function(_0x36f4a3){if(!_0x36f4a3){_0x430c78[_0xe516('0x16')](0x194);}return _0x36f4a3;};}function handleError(_0x5d9003,_0xc36ce9){_0xc36ce9=_0xc36ce9||0x1f4;return function(_0x4de2f6){logger[_0xe516('0x23')](_0x4de2f6[_0xe516('0x24')]);if(_0x4de2f6[_0xe516('0x25')]){delete _0x4de2f6[_0xe516('0x25')];}_0x5d9003[_0xe516('0x17')](_0xc36ce9)[_0xe516('0x26')](_0x4de2f6);};}exports['index']=function(_0x460dcc,_0xec27){var _0x247e92={},_0x1af67d={},_0x5b8968={'count':0x0,'rows':[]};var _0x49bbd0=_[_0xe516('0x27')](db[_0xe516('0x28')][_0xe516('0x29')],function(_0x24cbaa){return{'name':_0x24cbaa['fieldName'],'type':_0x24cbaa[_0xe516('0x2a')]['key']};});_0x1af67d[_0xe516('0x2b')]=_[_0xe516('0x27')](_0x49bbd0,_0xe516('0x25'));_0x1af67d[_0xe516('0x2c')]=_[_0xe516('0x2d')](_0x460dcc[_0xe516('0x2c')]);_0x1af67d[_0xe516('0x2e')]=_['intersection'](_0x1af67d[_0xe516('0x2b')],_0x1af67d['query']);_0x247e92['attributes']=_[_0xe516('0x2f')](_0x1af67d[_0xe516('0x2b')],qs['fields'](_0x460dcc[_0xe516('0x2c')][_0xe516('0x30')]));_0x247e92[_0xe516('0x31')]=_0x247e92[_0xe516('0x31')][_0xe516('0x32')]?_0x247e92[_0xe516('0x31')]:_0x1af67d[_0xe516('0x2b')];if(!_0x460dcc[_0xe516('0x2c')][_0xe516('0x33')](_0xe516('0x34'))){_0x247e92[_0xe516('0x1a')]=qs['limit'](_0x460dcc[_0xe516('0x2c')][_0xe516('0x1a')]);_0x247e92[_0xe516('0x35')]=qs[_0xe516('0x35')](_0x460dcc['query'][_0xe516('0x35')]);}_0x247e92[_0xe516('0x36')]=qs[_0xe516('0x37')](_0x460dcc['query'][_0xe516('0x37')]);_0x247e92[_0xe516('0x38')]=qs[_0xe516('0x2e')](_[_0xe516('0x39')](_0x460dcc[_0xe516('0x2c')],_0x1af67d['filters']),_0x49bbd0);if(_0x460dcc[_0xe516('0x2c')][_0xe516('0x3a')]){_0x247e92['where']=_[_0xe516('0x3b')](_0x247e92[_0xe516('0x38')],{'$or':_['map'](_0x49bbd0,function(_0x29a726){if(_0x29a726[_0xe516('0x2a')]!==_0xe516('0x3c')){var _0x4fabf8={};_0x4fabf8[_0x29a726['name']]={'$like':'%'+_0x460dcc['query']['filter']+'%'};return _0x4fabf8;}})});}_0x247e92=_[_0xe516('0x3b')]({},_0x247e92,_0x460dcc[_0xe516('0x3d')]);var _0x27c76f={'where':_0x247e92[_0xe516('0x38')]};return db[_0xe516('0x28')][_0xe516('0x19')](_0x27c76f)[_0xe516('0x21')](function(_0x246184){_0x5b8968[_0xe516('0x19')]=_0x246184;if(_0x460dcc[_0xe516('0x2c')][_0xe516('0x3e')]){_0x247e92[_0xe516('0x3f')]=[{'all':!![]}];}return db[_0xe516('0x28')]['findAll'](_0x247e92);})['then'](function(_0x1e5e8a){_0x5b8968['rows']=_0x1e5e8a;return _0x5b8968;})['then'](respondWithFilteredResult(_0xec27,_0x247e92))[_0xe516('0x40')](handleError(_0xec27,null));};exports[_0xe516('0x41')]=function(_0x8d4c33,_0x30f733){var _0x5da351={'raw':!![],'where':{'id':_0x8d4c33[_0xe516('0x42')]['id']}},_0x13598d={};_0x13598d['model']=_[_0xe516('0x2d')](db[_0xe516('0x28')][_0xe516('0x29')]);_0x13598d[_0xe516('0x2c')]=_[_0xe516('0x2d')](_0x8d4c33[_0xe516('0x2c')]);_0x13598d[_0xe516('0x2e')]=_[_0xe516('0x2f')](_0x13598d[_0xe516('0x2b')],_0x13598d[_0xe516('0x2c')]);_0x5da351['attributes']=_[_0xe516('0x2f')](_0x13598d[_0xe516('0x2b')],qs['fields'](_0x8d4c33[_0xe516('0x2c')][_0xe516('0x30')]));_0x5da351['attributes']=_0x5da351[_0xe516('0x31')]['length']?_0x5da351[_0xe516('0x31')]:_0x13598d['model'];if(_0x8d4c33[_0xe516('0x2c')]['includeAll']){_0x5da351[_0xe516('0x3f')]=[{'all':!![]}];}_0x5da351=_[_0xe516('0x3b')]({},_0x5da351,_0x8d4c33[_0xe516('0x3d')]);return db[_0xe516('0x28')][_0xe516('0x43')](_0x5da351)[_0xe516('0x21')](handleEntityNotFound(_0x30f733,null))[_0xe516('0x21')](respondWithResult(_0x30f733,null))[_0xe516('0x40')](handleError(_0x30f733,null));};exports[_0xe516('0x44')]=function(_0x342068,_0x8cc131){return db['CmHopperHistory'][_0xe516('0x44')](_0x342068['body'],{})[_0xe516('0x21')](respondWithResult(_0x8cc131,0xc9))[_0xe516('0x40')](handleError(_0x8cc131,null));};exports[_0xe516('0x45')]=function(_0x56294b,_0xa19370){return db[_0xe516('0x28')][_0xe516('0x45')]()['then'](respondWithResult(_0xa19370,null))['catch'](handleError(_0xa19370,null));};exports[_0xe516('0x20')]=function(_0x5d34f0,_0x5ebb14){if(_0x5d34f0[_0xe516('0x46')][_0xe516('0x47')]){delete _0x5d34f0[_0xe516('0x46')][_0xe516('0x47')];}return db[_0xe516('0x28')][_0xe516('0x43')]({'where':{'uniqueid':_0x5d34f0[_0xe516('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ebb14,null))[_0xe516('0x21')](saveUpdates(_0x5d34f0[_0xe516('0x46')],null))[_0xe516('0x21')](respondWithResult(_0x5ebb14,null))['catch'](handleError(_0x5ebb14,null));}; \ No newline at end of file +var _0x72dc=['merge','options','include','CmHopperHistory','rows','catch','show','params','keys','length','includeAll','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter'];(function(_0x478aac,_0x415843){var _0x29148e=function(_0x268a59){while(--_0x268a59){_0x478aac['push'](_0x478aac['shift']());}};_0x29148e(++_0x415843);}(_0x72dc,0x138));var _0xc72d=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x72dc[_0x1e6db3];return _0x1de886;};'use strict';var emlformat=require(_0xc72d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc72d('0x1'));var jsonpatch=require(_0xc72d('0x2'));var rp=require(_0xc72d('0x3'));var moment=require(_0xc72d('0x4'));var BPromise=require(_0xc72d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc72d('0x6'));var sox=require(_0xc72d('0x7'));var csv=require(_0xc72d('0x8'));var ejs=require(_0xc72d('0x9'));var fs=require('fs');var fs_extra=require(_0xc72d('0xa'));var _=require(_0xc72d('0xb'));var squel=require('squel');var crypto=require(_0xc72d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc72d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc72d('0xe'));var Papa=require(_0xc72d('0xf'));var Redis=require(_0xc72d('0x10'));var authService=require(_0xc72d('0x11'));var qs=require(_0xc72d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc72d('0x13'));var logger=require(_0xc72d('0x14'))(_0xc72d('0x15'));var utils=require(_0xc72d('0x16'));var config=require(_0xc72d('0x17'));var licenseUtil=require(_0xc72d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18f40c,_0x1b8771){_0x1b8771=_0x1b8771||0xcc;return function(_0x3200c7){if(_0x3200c7){return _0x18f40c['sendStatus'](_0x1b8771);}return _0x18f40c[_0xc72d('0x19')](_0x1b8771)['end']();};}function respondWithResult(_0x17ec6c,_0x36bec8){_0x36bec8=_0x36bec8||0xc8;return function(_0xa858fa){if(_0xa858fa){return _0x17ec6c[_0xc72d('0x19')](_0x36bec8)[_0xc72d('0x1a')](_0xa858fa);}};}function respondWithFilteredResult(_0x31e6dc,_0x14edb5){return function(_0x321fa2){if(_0x321fa2){var _0x41b1ff=typeof _0x14edb5[_0xc72d('0x1b')]===_0xc72d('0x1c')&&typeof _0x14edb5[_0xc72d('0x1d')]==='undefined';var _0x2a1f1b=_0x321fa2[_0xc72d('0x1e')];var _0x38e39d=_0x41b1ff?0x0:_0x14edb5[_0xc72d('0x1b')];var _0x595c6a=_0x41b1ff?_0x321fa2[_0xc72d('0x1e')]:_0x14edb5[_0xc72d('0x1b')]+_0x14edb5['limit'];var _0x1abfb2;if(_0x595c6a>=_0x2a1f1b){_0x595c6a=_0x2a1f1b;_0x1abfb2=0xc8;}else{_0x1abfb2=0xce;}_0x31e6dc[_0xc72d('0x19')](_0x1abfb2);return _0x31e6dc[_0xc72d('0x1f')]('Content-Range',_0x38e39d+'-'+_0x595c6a+'/'+_0x2a1f1b)[_0xc72d('0x1a')](_0x321fa2);}return null;};}function patchUpdates(_0x306bae){return function(_0x56c143){try{jsonpatch[_0xc72d('0x20')](_0x56c143,_0x306bae,!![]);}catch(_0x8fad){return BPromise[_0xc72d('0x21')](_0x8fad);}return _0x56c143[_0xc72d('0x22')]();};}function saveUpdates(_0x54265b,_0x4d5727){return function(_0x9f38f1){if(_0x9f38f1){return _0x9f38f1[_0xc72d('0x23')](_0x54265b)['then'](function(_0xbfe5ea){return _0xbfe5ea;});}return null;};}function removeEntity(_0x2497eb,_0x22cc13){return function(_0x4f7116){if(_0x4f7116){return _0x4f7116[_0xc72d('0x24')]()[_0xc72d('0x25')](function(){_0x2497eb[_0xc72d('0x19')](0xcc)[_0xc72d('0x26')]();});}};}function handleEntityNotFound(_0x5c0e88,_0x3659b5){return function(_0x5e2faa){if(!_0x5e2faa){_0x5c0e88[_0xc72d('0x27')](0x194);}return _0x5e2faa;};}function handleError(_0x188257,_0x38bf18){_0x38bf18=_0x38bf18||0x1f4;return function(_0x599037){logger[_0xc72d('0x28')](_0x599037['stack']);if(_0x599037[_0xc72d('0x29')]){delete _0x599037[_0xc72d('0x29')];}_0x188257[_0xc72d('0x19')](_0x38bf18)['send'](_0x599037);};}exports[_0xc72d('0x2a')]=function(_0x595e84,_0x43ea89){var _0x172835={},_0x53b932={},_0x36d654={'count':0x0,'rows':[]};var _0x9261b8=_[_0xc72d('0x2b')](db['CmHopperHistory'][_0xc72d('0x2c')],function(_0x20b9d5){return{'name':_0x20b9d5[_0xc72d('0x2d')],'type':_0x20b9d5['type'][_0xc72d('0x2e')]};});_0x53b932[_0xc72d('0x2f')]=_[_0xc72d('0x2b')](_0x9261b8,'name');_0x53b932['query']=_['keys'](_0x595e84[_0xc72d('0x30')]);_0x53b932[_0xc72d('0x31')]=_[_0xc72d('0x32')](_0x53b932[_0xc72d('0x2f')],_0x53b932[_0xc72d('0x30')]);_0x172835[_0xc72d('0x33')]=_[_0xc72d('0x32')](_0x53b932['model'],qs[_0xc72d('0x34')](_0x595e84[_0xc72d('0x30')][_0xc72d('0x34')]));_0x172835[_0xc72d('0x33')]=_0x172835['attributes']['length']?_0x172835[_0xc72d('0x33')]:_0x53b932[_0xc72d('0x2f')];if(!_0x595e84[_0xc72d('0x30')]['hasOwnProperty']('nolimit')){_0x172835['limit']=qs[_0xc72d('0x1d')](_0x595e84[_0xc72d('0x30')][_0xc72d('0x1d')]);_0x172835[_0xc72d('0x1b')]=qs['offset'](_0x595e84[_0xc72d('0x30')][_0xc72d('0x1b')]);}_0x172835[_0xc72d('0x35')]=qs[_0xc72d('0x36')](_0x595e84[_0xc72d('0x30')][_0xc72d('0x36')]);_0x172835[_0xc72d('0x37')]=qs[_0xc72d('0x31')](_[_0xc72d('0x38')](_0x595e84[_0xc72d('0x30')],_0x53b932[_0xc72d('0x31')]),_0x9261b8);if(_0x595e84[_0xc72d('0x30')][_0xc72d('0x39')]){_0x172835[_0xc72d('0x37')]=_['merge'](_0x172835[_0xc72d('0x37')],{'$or':_[_0xc72d('0x2b')](_0x9261b8,function(_0x12cac4){if(_0x12cac4['type']!=='VIRTUAL'){var _0x16476e={};_0x16476e[_0x12cac4[_0xc72d('0x29')]]={'$like':'%'+_0x595e84[_0xc72d('0x30')][_0xc72d('0x39')]+'%'};return _0x16476e;}})});}_0x172835=_[_0xc72d('0x3a')]({},_0x172835,_0x595e84[_0xc72d('0x3b')]);var _0x371e07={'where':_0x172835['where']};return db['CmHopperHistory'][_0xc72d('0x1e')](_0x371e07)['then'](function(_0x455479){_0x36d654[_0xc72d('0x1e')]=_0x455479;if(_0x595e84[_0xc72d('0x30')]['includeAll']){_0x172835[_0xc72d('0x3c')]=[{'all':!![]}];}return db[_0xc72d('0x3d')]['findAll'](_0x172835);})[_0xc72d('0x25')](function(_0x148f3b){_0x36d654[_0xc72d('0x3e')]=_0x148f3b;return _0x36d654;})['then'](respondWithFilteredResult(_0x43ea89,_0x172835))[_0xc72d('0x3f')](handleError(_0x43ea89,null));};exports[_0xc72d('0x40')]=function(_0x5cac64,_0x4e0cc6){var _0x11d613={'raw':!![],'where':{'id':_0x5cac64[_0xc72d('0x41')]['id']}},_0x4d8d35={};_0x4d8d35[_0xc72d('0x2f')]=_[_0xc72d('0x42')](db[_0xc72d('0x3d')]['rawAttributes']);_0x4d8d35[_0xc72d('0x30')]=_[_0xc72d('0x42')](_0x5cac64[_0xc72d('0x30')]);_0x4d8d35[_0xc72d('0x31')]=_[_0xc72d('0x32')](_0x4d8d35['model'],_0x4d8d35['query']);_0x11d613[_0xc72d('0x33')]=_[_0xc72d('0x32')](_0x4d8d35[_0xc72d('0x2f')],qs['fields'](_0x5cac64['query'][_0xc72d('0x34')]));_0x11d613[_0xc72d('0x33')]=_0x11d613[_0xc72d('0x33')][_0xc72d('0x43')]?_0x11d613[_0xc72d('0x33')]:_0x4d8d35['model'];if(_0x5cac64[_0xc72d('0x30')][_0xc72d('0x44')]){_0x11d613[_0xc72d('0x3c')]=[{'all':!![]}];}_0x11d613=_[_0xc72d('0x3a')]({},_0x11d613,_0x5cac64[_0xc72d('0x3b')]);return db[_0xc72d('0x3d')][_0xc72d('0x45')](_0x11d613)[_0xc72d('0x25')](handleEntityNotFound(_0x4e0cc6,null))[_0xc72d('0x25')](respondWithResult(_0x4e0cc6,null))[_0xc72d('0x3f')](handleError(_0x4e0cc6,null));};exports[_0xc72d('0x46')]=function(_0x546272,_0x5a6e27){return db[_0xc72d('0x3d')]['create'](_0x546272[_0xc72d('0x47')],{})[_0xc72d('0x25')](respondWithResult(_0x5a6e27,0xc9))['catch'](handleError(_0x5a6e27,null));};exports[_0xc72d('0x48')]=function(_0x22954b,_0x28f7f6){return db[_0xc72d('0x3d')][_0xc72d('0x48')]()[_0xc72d('0x25')](respondWithResult(_0x28f7f6,null))['catch'](handleError(_0x28f7f6,null));};exports[_0xc72d('0x23')]=function(_0x2a1e0c,_0x329b54){if(_0x2a1e0c[_0xc72d('0x47')][_0xc72d('0x49')]){delete _0x2a1e0c[_0xc72d('0x47')][_0xc72d('0x49')];}return db[_0xc72d('0x3d')][_0xc72d('0x45')]({'where':{'uniqueid':_0x2a1e0c[_0xc72d('0x41')]['id']}})[_0xc72d('0x25')](handleEntityNotFound(_0x329b54,null))['then'](saveUpdates(_0x2a1e0c[_0xc72d('0x47')],null))[_0xc72d('0x25')](respondWithResult(_0x329b54,null))[_0xc72d('0x3f')](handleError(_0x329b54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 85d7e4f..5a874bb 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 _0x5c3c=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5258f2,_0x50ae30){var _0x2a82f0=function(_0x2ffd0f){while(--_0x2ffd0f){_0x5258f2['push'](_0x5258f2['shift']());}};_0x2a82f0(++_0x50ae30);}(_0x5c3c,0x132));var _0xc5c3=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x5c3c[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var logger=require(_0xc5c3('0x2'))(_0xc5c3('0x3'));var moment=require('moment');var BPromise=require(_0xc5c3('0x4'));var rp=require(_0xc5c3('0x5'));var fs=require('fs');var path=require(_0xc5c3('0x6'));var rimraf=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var attributes=require(_0xc5c3('0x9'));module[_0xc5c3('0xa')]=function(_0x23a6b5,_0x28bdd9){return _0x23a6b5['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xc5c3('0xb'),'fields':[_0xc5c3('0xb')]},{'name':'uniqueid','fields':[_0xc5c3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x002d=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2cc21c,_0x4ceefa){var _0x59e4ea=function(_0x4e86d6){while(--_0x4e86d6){_0x2cc21c['push'](_0x2cc21c['shift']());}};_0x59e4ea(++_0x4ceefa);}(_0x002d,0xca));var _0xd002=function(_0x198e2b,_0x418a9d){_0x198e2b=_0x198e2b-0x0;var _0x57e783=_0x002d[_0x198e2b];return _0x57e783;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var logger=require(_0xd002('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd002('0x3'));var rp=require(_0xd002('0x4'));var fs=require('fs');var path=require(_0xd002('0x5'));var rimraf=require(_0xd002('0x6'));var config=require(_0xd002('0x7'));var attributes=require(_0xd002('0x8'));module[_0xd002('0x9')]=function(_0x38ec77,_0x3ec3d7){return _0x38ec77[_0xd002('0xa')](_0xd002('0xb'),attributes,{'tableName':_0xd002('0xc'),'paranoid':![],'indexes':[{'name':_0xd002('0xd'),'fields':[_0xd002('0xd')]},{'name':_0xd002('0xe'),'fields':[_0xd002('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8afcac2..0716de3 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 _0x3189=['`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','then','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','findAll','where','sequelize','col','COUNT','literal'];(function(_0x5bc02c,_0x3640aa){var _0x241ff0=function(_0x3cd5df){while(--_0x3cd5df){_0x5bc02c['push'](_0x5bc02c['shift']());}};_0x241ff0(++_0x3640aa);}(_0x3189,0xae));var _0x9318=function(_0x3d6699,_0x398369){_0x3d6699=_0x3d6699-0x0;var _0x3ea73f=_0x3189[_0x3d6699];return _0x3ea73f;};'use strict';var _=require(_0x9318('0x0'));var util=require(_0x9318('0x1'));var moment=require('moment');var BPromise=require(_0x9318('0x2'));var rs=require(_0x9318('0x3'));var fs=require('fs');var Redis=require(_0x9318('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9318('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9318('0x6'));var jayson=require(_0x9318('0x7'));var client=jayson['client'][_0x9318('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bb3c3,_0x4dbe95,_0x2f6831){return new BPromise(function(_0x324307,_0x1bfed6){return client['request'](_0x4bb3c3,_0x2f6831)[_0x9318('0x9')](function(_0x2e8d1c){logger[_0x9318('0xa')](_0x9318('0xb'),_0x4dbe95,'request\x20sent');logger['debug'](_0x9318('0xc'),_0x4dbe95,'request\x20sent',JSON[_0x9318('0xd')](_0x2e8d1c));if(_0x2e8d1c[_0x9318('0xe')]){if(_0x2e8d1c[_0x9318('0xe')]['code']===0x1f4){logger[_0x9318('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x4dbe95,_0x2e8d1c['error'][_0x9318('0xf')]);return _0x1bfed6(_0x2e8d1c['error'][_0x9318('0xf')]);}logger[_0x9318('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x4dbe95,_0x2e8d1c[_0x9318('0xe')][_0x9318('0xf')]);return _0x324307(_0x2e8d1c[_0x9318('0xe')]['message']);}else{logger['info'](_0x9318('0xb'),_0x4dbe95,_0x9318('0x10'));_0x324307(_0x2e8d1c['result'][_0x9318('0xf')]);}})[_0x9318('0x11')](function(_0x5e1238){logger[_0x9318('0xe')](_0x9318('0xb'),_0x4dbe95,_0x5e1238);_0x1bfed6(_0x5e1238);});});}exports[_0x9318('0x12')]=function(_0xda93f2){var _0xd1fd86=this;return new Promise(function(_0x19c253,_0xf657f7){return db[_0x9318('0x13')]['create'](_0xda93f2[_0x9318('0x14')],{'raw':_0xda93f2[_0x9318('0x15')]?_0xda93f2[_0x9318('0x15')][_0x9318('0x16')]===undefined?!![]:![]:!![]})[_0x9318('0x9')](function(_0xc122e9){logger['info'](_0x9318('0x12'),_0xda93f2);logger['debug']('CreateCmHopperHistory',_0xda93f2,JSON[_0x9318('0xd')](_0xc122e9));_0x19c253(_0xc122e9);})[_0x9318('0x11')](function(_0xa45304){logger[_0x9318('0xe')](_0x9318('0x12'),_0xa45304['message'],_0xda93f2);_0xf657f7(_0xd1fd86[_0x9318('0xe')](0x1f4,_0xa45304[_0x9318('0xf')]));});});};exports[_0x9318('0x17')]=function(_0x33502a){var _0x4316f8=this;return new Promise(function(_0x2f364e,_0x2686e8){return db[_0x9318('0x13')][_0x9318('0x18')]({'raw':_0x33502a[_0x9318('0x15')]?_0x33502a[_0x9318('0x15')][_0x9318('0x16')]===undefined?!![]:![]:!![],'where':_0x33502a[_0x9318('0x15')]?_0x33502a[_0x9318('0x15')][_0x9318('0x19')]||null:null,'attributes':[[db[_0x9318('0x1a')]['fn']('COUNT',db[_0x9318('0x1a')][_0x9318('0x1b')]('id')),'predictiveIntervalTotalCalls'],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x1e')))),_0x9318('0x1f')],[db['sequelize']['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db['sequelize'][_0x9318('0x1d')]('`state`\x20=\x2010,\x201,\x20null'))),_0x9318('0x20')],[db[_0x9318('0x1a')]['fn']('COUNT',db[_0x9318('0x1a')]['fn']('IF',db['sequelize'][_0x9318('0x1d')](_0x9318('0x21')))),_0x9318('0x22')],[db['sequelize']['fn'](_0x9318('0x23'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x9318('0x1a')]['fn']('AVG',db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')]['literal'](_0x9318('0x24')))),_0x9318('0x25')]]})['then'](function(_0x443011){logger[_0x9318('0xa')]('AvgHandleTime',_0x33502a);logger[_0x9318('0x26')](_0x9318('0x17'),_0x33502a,JSON[_0x9318('0xd')](_0x443011));_0x2f364e(_0x443011);})[_0x9318('0x11')](function(_0x503126){logger[_0x9318('0xe')](_0x9318('0x17'),_0x503126[_0x9318('0xf')],_0x33502a);_0x2686e8(_0x4316f8[_0x9318('0xe')](0x1f4,_0x503126['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2caab5){var _0x8bf2ee=this;return new Promise(function(_0x147def,_0x38bf17){return db[_0x9318('0x13')][_0x9318('0x18')]({'raw':_0x2caab5[_0x9318('0x15')]?_0x2caab5[_0x9318('0x15')][_0x9318('0x16')]===undefined?!![]:![]:!![],'where':_0x2caab5[_0x9318('0x15')]?_0x2caab5['options']['where']||null:null,'attributes':[[_0x9318('0x27'),'name'],[db['sequelize']['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x28')))),_0x9318('0x29')],[db['sequelize']['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')]('`state`\x20=\x203,\x201,\x20null'))),_0x9318('0x2a')],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x9318('0x1e')))),_0x9318('0x2b')],[db['sequelize']['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')]['literal'](_0x9318('0x2c')))),_0x9318('0x2d')],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db['sequelize']['fn']('IF',db[_0x9318('0x1a')]['literal'](_0x9318('0x2e')))),_0x9318('0x2f')],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')]['literal'](_0x9318('0x30')))),'outboundDropCallsDayTimeout'],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9318('0x31')))),_0x9318('0x32')],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x33')))),_0x9318('0x34')],[db[_0x9318('0x1a')]['fn']('COUNT',db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x35')))),_0x9318('0x36')],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db['sequelize'][_0x9318('0x1d')](_0x9318('0x37')))),_0x9318('0x38')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x39')))),_0x9318('0x3a')],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db['sequelize'][_0x9318('0x1d')](_0x9318('0x3b')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x3c')))),_0x9318('0x3a')],[db[_0x9318('0x1a')]['fn'](_0x9318('0x1c'),db['sequelize']['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x3d')))),_0x9318('0x3e')]],'group':[_0x9318('0x27')]})[_0x9318('0x9')](function(_0x2c41a0){logger[_0x9318('0xa')](_0x9318('0x3f'),_0x2caab5);logger[_0x9318('0x26')](_0x9318('0x3f'),_0x2caab5,JSON[_0x9318('0xd')](_0x2c41a0));_0x147def(_0x2c41a0);})[_0x9318('0x11')](function(_0x260c87){logger[_0x9318('0xe')]('GetVoiceQueueHopperHistory',_0x260c87['message'],_0x2caab5);_0x38bf17(_0x8bf2ee[_0x9318('0xe')](0x1f4,_0x260c87[_0x9318('0xf')]));});});};exports['GetCampaignHopperHistory']=function(_0x105040){var _0x3fac23=this;return new Promise(function(_0x240518,_0x161de7){return db[_0x9318('0x13')][_0x9318('0x18')]({'raw':_0x105040['options']?_0x105040['options'][_0x9318('0x16')]===undefined?!![]:![]:!![],'where':_0x105040[_0x9318('0x15')]?_0x105040[_0x9318('0x15')]['where']||null:null,'attributes':[['campaign',_0x9318('0x40')],[db['sequelize']['fn'](_0x9318('0x1c'),db[_0x9318('0x1a')]['col']('id')),_0x9318('0x41')],[db['sequelize']['fn'](_0x9318('0x1c'),db['sequelize']['fn']('IF',db[_0x9318('0x1a')][_0x9318('0x1d')](_0x9318('0x1e')))),_0x9318('0x42')]],'group':[_0x9318('0x27')]})[_0x9318('0x9')](function(_0x16f93e){logger[_0x9318('0xa')](_0x9318('0x43'),_0x105040);logger[_0x9318('0x26')](_0x9318('0x43'),_0x105040,JSON[_0x9318('0xd')](_0x16f93e));_0x240518(_0x16f93e);})[_0x9318('0x11')](function(_0x4a8590){logger[_0x9318('0xe')](_0x9318('0x43'),_0x4a8590[_0x9318('0xf')],_0x105040);_0x161de7(_0x3fac23[_0x9318('0xe')](0x1f4,_0x4a8590['message']));});});}; \ No newline at end of file +var _0x9063=['CmHopperHistory','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','campaign','col','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory'];(function(_0x371ec9,_0x2d758e){var _0x4fcf27=function(_0x42457e){while(--_0x42457e){_0x371ec9['push'](_0x371ec9['shift']());}};_0x4fcf27(++_0x2d758e);}(_0x9063,0x1a2));var _0x3906=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x9063[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var moment=require(_0x3906('0x2'));var BPromise=require(_0x3906('0x3'));var rs=require(_0x3906('0x4'));var fs=require('fs');var Redis=require(_0x3906('0x5'));var db=require(_0x3906('0x6'))['db'];var utils=require(_0x3906('0x7'));var logger=require('../../config/logger')(_0x3906('0x8'));var config=require(_0x3906('0x9'));var jayson=require(_0x3906('0xa'));var client=jayson[_0x3906('0xb')][_0x3906('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x522b71,_0x54637d,_0x4a8864){return new BPromise(function(_0x331b42,_0x14f37c){return client[_0x3906('0xd')](_0x522b71,_0x4a8864)['then'](function(_0x45f3bf){logger[_0x3906('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x54637d,_0x3906('0xf'));logger[_0x3906('0x10')](_0x3906('0x11'),_0x54637d,'request\x20sent',JSON[_0x3906('0x12')](_0x45f3bf));if(_0x45f3bf[_0x3906('0x13')]){if(_0x45f3bf['error'][_0x3906('0x14')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x54637d,_0x45f3bf[_0x3906('0x13')][_0x3906('0x15')]);return _0x14f37c(_0x45f3bf['error']['message']);}logger[_0x3906('0x13')](_0x3906('0x16'),_0x54637d,_0x45f3bf['error']['message']);return _0x331b42(_0x45f3bf[_0x3906('0x13')][_0x3906('0x15')]);}else{logger[_0x3906('0xe')](_0x3906('0x16'),_0x54637d,_0x3906('0xf'));_0x331b42(_0x45f3bf[_0x3906('0x17')][_0x3906('0x15')]);}})[_0x3906('0x18')](function(_0x3f8515){logger[_0x3906('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x54637d,_0x3f8515);_0x14f37c(_0x3f8515);});});}exports[_0x3906('0x19')]=function(_0x56b52a){var _0xf0bf50=this;return new Promise(function(_0x3c6900,_0x4b4221){return db[_0x3906('0x1a')]['create'](_0x56b52a[_0x3906('0x1b')],{'raw':_0x56b52a[_0x3906('0x1c')]?_0x56b52a[_0x3906('0x1c')][_0x3906('0x1d')]===undefined?!![]:![]:!![]})[_0x3906('0x1e')](function(_0x553333){logger[_0x3906('0xe')](_0x3906('0x19'),_0x56b52a);logger[_0x3906('0x10')](_0x3906('0x19'),_0x56b52a,JSON['stringify'](_0x553333));_0x3c6900(_0x553333);})[_0x3906('0x18')](function(_0x472411){logger[_0x3906('0x13')](_0x3906('0x19'),_0x472411['message'],_0x56b52a);_0x4b4221(_0xf0bf50['error'](0x1f4,_0x472411[_0x3906('0x15')]));});});};exports[_0x3906('0x1f')]=function(_0x343821){var _0xe5a4c8=this;return new Promise(function(_0x513124,_0x723ca){return db[_0x3906('0x1a')]['findAll']({'raw':_0x343821['options']?_0x343821[_0x3906('0x1c')][_0x3906('0x1d')]===undefined?!![]:![]:!![],'where':_0x343821[_0x3906('0x1c')]?_0x343821['options'][_0x3906('0x20')]||null:null,'attributes':[[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['col']('id')),_0x3906('0x23')],[db['sequelize']['fn'](_0x3906('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x3906('0x24')](_0x3906('0x25')))),_0x3906('0x26')],[db['sequelize']['fn']('COUNT',db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x27')))),_0x3906('0x28')],[db[_0x3906('0x21')]['fn']('COUNT',db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x3906('0x29')],[db['sequelize']['fn'](_0x3906('0x2a'),db[_0x3906('0x21')]['fn']('IF',db['sequelize'][_0x3906('0x24')](_0x3906('0x2b')))),_0x3906('0x2c')],[db[_0x3906('0x21')]['fn'](_0x3906('0x2a'),db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x2d')))),_0x3906('0x2e')]]})['then'](function(_0x43f2c0){logger[_0x3906('0xe')](_0x3906('0x1f'),_0x343821);logger[_0x3906('0x10')]('AvgHandleTime',_0x343821,JSON[_0x3906('0x12')](_0x43f2c0));_0x513124(_0x43f2c0);})[_0x3906('0x18')](function(_0x16c7ab){logger[_0x3906('0x13')](_0x3906('0x1f'),_0x16c7ab[_0x3906('0x15')],_0x343821);_0x723ca(_0xe5a4c8[_0x3906('0x13')](0x1f4,_0x16c7ab[_0x3906('0x15')]));});});};exports[_0x3906('0x2f')]=function(_0x3ba3a3){var _0x273199=this;return new Promise(function(_0x3610f1,_0x2889e0){return db[_0x3906('0x1a')]['findAll']({'raw':_0x3ba3a3['options']?_0x3ba3a3[_0x3906('0x1c')][_0x3906('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ba3a3['options']?_0x3ba3a3[_0x3906('0x1c')][_0x3906('0x20')]||null:null,'attributes':[['campaign',_0x3906('0x30')],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db['sequelize']['fn']('IF',db[_0x3906('0x21')]['literal'](_0x3906('0x31')))),'outboundNoSuchCallsDay'],[db[_0x3906('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x32')))),_0x3906('0x33')],[db['sequelize']['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x25')))),'outboundAnswerCallsDay'],[db[_0x3906('0x21')]['fn']('COUNT',db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x3906('0x34')],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x35')))),_0x3906('0x36')],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x37')))),_0x3906('0x38')],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db['sequelize'][_0x3906('0x24')](_0x3906('0x39')))),_0x3906('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x3b')))),_0x3906('0x3c')],[db['sequelize']['fn'](_0x3906('0x22'),db['sequelize']['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x3d')))),_0x3906('0x3e')],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db['sequelize'][_0x3906('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3906('0x3f')],[db['sequelize']['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0x3906('0x40')],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')]['literal'](_0x3906('0x41')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x3906('0x22'),db['sequelize']['fn']('IF',db[_0x3906('0x21')][_0x3906('0x24')](_0x3906('0x42')))),_0x3906('0x40')],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db['sequelize'][_0x3906('0x24')](_0x3906('0x43')))),_0x3906('0x44')]],'group':['campaign']})[_0x3906('0x1e')](function(_0x1a385c){logger[_0x3906('0xe')](_0x3906('0x2f'),_0x3ba3a3);logger['debug'](_0x3906('0x2f'),_0x3ba3a3,JSON[_0x3906('0x12')](_0x1a385c));_0x3610f1(_0x1a385c);})[_0x3906('0x18')](function(_0x323ffb){logger[_0x3906('0x13')](_0x3906('0x2f'),_0x323ffb[_0x3906('0x15')],_0x3ba3a3);_0x2889e0(_0x273199[_0x3906('0x13')](0x1f4,_0x323ffb[_0x3906('0x15')]));});});};exports[_0x3906('0x45')]=function(_0x620c5d){var _0x161296=this;return new Promise(function(_0x46b4f9,_0xf5b653){return db[_0x3906('0x1a')][_0x3906('0x46')]({'raw':_0x620c5d[_0x3906('0x1c')]?_0x620c5d[_0x3906('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x620c5d['options']?_0x620c5d[_0x3906('0x1c')]['where']||null:null,'attributes':[[_0x3906('0x47'),_0x3906('0x30')],[db[_0x3906('0x21')]['fn']('COUNT',db[_0x3906('0x21')][_0x3906('0x48')]('id')),'ivrTotalCallsDays'],[db[_0x3906('0x21')]['fn'](_0x3906('0x22'),db[_0x3906('0x21')]['fn']('IF',db[_0x3906('0x21')]['literal'](_0x3906('0x25')))),_0x3906('0x49')]],'group':[_0x3906('0x47')]})[_0x3906('0x1e')](function(_0x54dde4){logger[_0x3906('0xe')](_0x3906('0x45'),_0x620c5d);logger['debug'](_0x3906('0x45'),_0x620c5d,JSON[_0x3906('0x12')](_0x54dde4));_0x46b4f9(_0x54dde4);})['catch'](function(_0x5939bd){logger['error'](_0x3906('0x45'),_0x5939bd['message'],_0x620c5d);_0xf5b653(_0x161296[_0x3906('0x13')](0x1f4,_0x5939bd[_0x3906('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b87e5b9..431cb3a 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 _0xa043=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','/:id','post','update','exports','multer','util','path','connect-timeout','express'];(function(_0x4a4653,_0x3cb41c){var _0xe01658=function(_0x3149ac){while(--_0x3149ac){_0x4a4653['push'](_0x4a4653['shift']());}};_0xe01658(++_0x3cb41c);}(_0xa043,0x109));var _0x3a04=function(_0x3654c1,_0x45e17c){_0x3654c1=_0x3654c1-0x0;var _0x54d34e=_0xa043[_0x3654c1];return _0x54d34e;};'use strict';var multer=require(_0x3a04('0x0'));var util=require(_0x3a04('0x1'));var path=require(_0x3a04('0x2'));var timeout=require(_0x3a04('0x3'));var express=require(_0x3a04('0x4'));var router=express[_0x3a04('0x5')]();var fs_extra=require(_0x3a04('0x6'));var auth=require(_0x3a04('0x7'));var interaction=require(_0x3a04('0x8'));var config=require(_0x3a04('0x9'));var controller=require(_0x3a04('0xa'));router[_0x3a04('0xb')]('/',auth[_0x3a04('0xc')](),controller['index']);router[_0x3a04('0xb')](_0x3a04('0xd'),auth[_0x3a04('0xc')](),controller['describe']);router[_0x3a04('0xb')](_0x3a04('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3a04('0xf')]('/',auth[_0x3a04('0xc')](),controller['create']);router['put'](_0x3a04('0xe'),auth[_0x3a04('0xc')](),controller[_0x3a04('0x10')]);module[_0x3a04('0x11')]=router; \ No newline at end of file +var _0x8a0e=['post','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x363653,_0x436598){var _0x46d271=function(_0x190858){while(--_0x190858){_0x363653['push'](_0x363653['shift']());}};_0x46d271(++_0x436598);}(_0x8a0e,0xb7));var _0xe8a0=function(_0x5719ad,_0x47441a){_0x5719ad=_0x5719ad-0x0;var _0x37daa5=_0x8a0e[_0x5719ad];return _0x37daa5;};'use strict';var multer=require(_0xe8a0('0x0'));var util=require(_0xe8a0('0x1'));var path=require(_0xe8a0('0x2'));var timeout=require(_0xe8a0('0x3'));var express=require(_0xe8a0('0x4'));var router=express[_0xe8a0('0x5')]();var fs_extra=require(_0xe8a0('0x6'));var auth=require(_0xe8a0('0x7'));var interaction=require(_0xe8a0('0x8'));var config=require(_0xe8a0('0x9'));var controller=require(_0xe8a0('0xa'));router[_0xe8a0('0xb')]('/',auth[_0xe8a0('0xc')](),controller[_0xe8a0('0xd')]);router[_0xe8a0('0xb')](_0xe8a0('0xe'),auth[_0xe8a0('0xc')](),controller[_0xe8a0('0xf')]);router[_0xe8a0('0xb')]('/:id',auth[_0xe8a0('0xc')](),controller[_0xe8a0('0x10')]);router[_0xe8a0('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xe8a0('0xc')](),controller[_0xe8a0('0x12')]);module[_0xe8a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c1d854a..bc6abf9 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 _0x0851=['STRING','name','sequelize','exports'];(function(_0x5ec39a,_0x32e0b8){var _0x38cac6=function(_0x2033a5){while(--_0x2033a5){_0x5ec39a['push'](_0x5ec39a['shift']());}};_0x38cac6(++_0x32e0b8);}(_0x0851,0x8a));var _0x1085=function(_0x287c21,_0x1b7be5){_0x287c21=_0x287c21-0x0;var _0x145e31=_0x0851[_0x287c21];return _0x145e31;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'name':{'type':Sequelize[_0x1085('0x2')],'unique':_0x1085('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x1085('0x2')]}}; \ No newline at end of file +var _0x3645=['name','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3645,0x154));var _0x5364=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x3645[_0xee3051];return _0x139e81;};'use strict';var Sequelize=require('sequelize');module[_0x5364('0x0')]={'name':{'type':Sequelize[_0x5364('0x1')],'unique':_0x5364('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5364('0x1')]},'dialPrefix':{'type':Sequelize[_0x5364('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fa3800a..bf5c53e 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 _0x0040=['ListId','Disposition','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','setHeader','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','addColumn','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','getAgents','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmList','include','findAll','rows','catch','show','includeAll','find','create','user','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','params'];(function(_0xc2e544,_0x334b38){var _0x24d8bf=function(_0x58408d){while(--_0x58408d){_0xc2e544['push'](_0xc2e544['shift']());}};_0x24d8bf(++_0x334b38);}(_0x0040,0xdd));var _0x0004=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x0040[_0x3aaf0a];return _0x33e6bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0004('0x0'));var zipdir=require(_0x0004('0x1'));var jsonpatch=require(_0x0004('0x2'));var rp=require(_0x0004('0x3'));var moment=require(_0x0004('0x4'));var BPromise=require(_0x0004('0x5'));var Mustache=require(_0x0004('0x6'));var util=require('util');var path=require(_0x0004('0x7'));var sox=require('sox');var csv=require(_0x0004('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0004('0x9'));var _=require(_0x0004('0xa'));var squel=require(_0x0004('0xb'));var crypto=require('crypto');var jsforce=require(_0x0004('0xc'));var deskjs=require(_0x0004('0xd'));var toCsv=require(_0x0004('0x8'));var querystring=require(_0x0004('0xe'));var Papa=require(_0x0004('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0004('0x10'));var hardwareService=require(_0x0004('0x11'));var logger=require('../../config/logger')(_0x0004('0x12'));var utils=require(_0x0004('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0004('0x14'));var db=require(_0x0004('0x15'))['db'];var csv_results;config[_0x0004('0x16')]=_[_0x0004('0x17')](config[_0x0004('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0004('0x18'))(new Redis(config['redis']));require('./cmList.socket')[_0x0004('0x19')](socket);function respondWithStatusCode(_0x310eea,_0x2af847){_0x2af847=_0x2af847||0xcc;return function(_0x27fe2c){if(_0x27fe2c){return _0x310eea[_0x0004('0x1a')](_0x2af847);}return _0x310eea['status'](_0x2af847)['end']();};}function respondWithResult(_0x57bed8,_0x385af0){_0x385af0=_0x385af0||0xc8;return function(_0x4154b9){if(_0x4154b9){return _0x57bed8['status'](_0x385af0)['json'](_0x4154b9);}};}function respondWithFilteredResult(_0x447585,_0x39d069){return function(_0x45392d){if(_0x45392d){var _0x1343a3=typeof _0x39d069[_0x0004('0x1b')]===_0x0004('0x1c')&&typeof _0x39d069[_0x0004('0x1d')]===_0x0004('0x1c');var _0x481120=_0x45392d[_0x0004('0x1e')];var _0x1fbddc=_0x1343a3?0x0:_0x39d069['offset'];var _0x4d71b6=_0x1343a3?_0x45392d['count']:_0x39d069[_0x0004('0x1b')]+_0x39d069[_0x0004('0x1d')];var _0x418659;if(_0x4d71b6>=_0x481120){_0x4d71b6=_0x481120;_0x418659=0xc8;}else{_0x418659=0xce;}_0x447585[_0x0004('0x1f')](_0x418659);return _0x447585['set'](_0x0004('0x20'),_0x1fbddc+'-'+_0x4d71b6+'/'+_0x481120)[_0x0004('0x21')](_0x45392d);}return null;};}function patchUpdates(_0x2ff77f){return function(_0x19afc2){try{jsonpatch[_0x0004('0x22')](_0x19afc2,_0x2ff77f,!![]);}catch(_0x578588){return BPromise[_0x0004('0x23')](_0x578588);}return _0x19afc2[_0x0004('0x24')]();};}function saveUpdates(_0x2e236d,_0xb60ee){return function(_0x15f2cd){if(_0x15f2cd){return _0x15f2cd[_0x0004('0x25')](_0x2e236d)[_0x0004('0x26')](function(_0xe9ae87){return _0xe9ae87;});}return null;};}function removeEntity(_0x1eef0b,_0xf1810e){return function(_0x5a0092){if(_0x5a0092){return _0x5a0092[_0x0004('0x27')]()['then'](function(){var _0x58a120=_0x5a0092[_0x0004('0x28')]({'plain':!![]});var _0x780cd8='Lists';return db[_0x0004('0x29')][_0x0004('0x27')]({'where':{'type':_0x780cd8,'resourceId':_0x58a120['id']}})[_0x0004('0x26')](function(){return _0x5a0092;});})[_0x0004('0x26')](function(){_0x1eef0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2ad7,_0x1ceeb0){return function(_0x39e442){if(!_0x39e442){_0x5f2ad7['sendStatus'](0x194);}return _0x39e442;};}function handleError(_0xd02eb9,_0x63ff9c){_0x63ff9c=_0x63ff9c||0x1f4;return function(_0x42e9b8){logger[_0x0004('0x2a')](_0x42e9b8['stack']);if(_0x42e9b8[_0x0004('0x2b')]){delete _0x42e9b8['name'];}_0xd02eb9[_0x0004('0x1f')](_0x63ff9c)['send'](_0x42e9b8);};}exports[_0x0004('0x2c')]=function(_0x29c7a6,_0x357d38){var _0x2b0a2f={},_0x3e133d={},_0x23c79a={'count':0x0,'rows':[]};var _0x1413f9=_['map'](db['CmList'][_0x0004('0x2d')],function(_0x481817){return{'name':_0x481817['fieldName'],'type':_0x481817[_0x0004('0x2e')][_0x0004('0x2f')]};});_0x3e133d['model']=_[_0x0004('0x30')](_0x1413f9,_0x0004('0x2b'));_0x3e133d[_0x0004('0x31')]=_[_0x0004('0x32')](_0x29c7a6[_0x0004('0x31')]);_0x3e133d[_0x0004('0x33')]=_[_0x0004('0x34')](_0x3e133d['model'],_0x3e133d['query']);_0x2b0a2f[_0x0004('0x35')]=_[_0x0004('0x34')](_0x3e133d[_0x0004('0x36')],qs[_0x0004('0x37')](_0x29c7a6[_0x0004('0x31')]['fields']));_0x2b0a2f[_0x0004('0x35')]=_0x2b0a2f[_0x0004('0x35')][_0x0004('0x38')]?_0x2b0a2f[_0x0004('0x35')]:_0x3e133d[_0x0004('0x36')];if(!_0x29c7a6['query'][_0x0004('0x39')](_0x0004('0x3a'))){_0x2b0a2f[_0x0004('0x1d')]=qs[_0x0004('0x1d')](_0x29c7a6[_0x0004('0x31')]['limit']);_0x2b0a2f['offset']=qs[_0x0004('0x1b')](_0x29c7a6[_0x0004('0x31')][_0x0004('0x1b')]);}_0x2b0a2f[_0x0004('0x3b')]=qs[_0x0004('0x3c')](_0x29c7a6[_0x0004('0x31')][_0x0004('0x3c')]);_0x2b0a2f[_0x0004('0x3d')]=qs[_0x0004('0x33')](_[_0x0004('0x3e')](_0x29c7a6[_0x0004('0x31')],_0x3e133d[_0x0004('0x33')]),_0x1413f9);if(_0x29c7a6[_0x0004('0x31')][_0x0004('0x3f')]){_0x2b0a2f['where']=_['merge'](_0x2b0a2f[_0x0004('0x3d')],{'$or':_['map'](_0x1413f9,function(_0x1c78fa){if(_0x1c78fa[_0x0004('0x2e')]!=='VIRTUAL'){var _0x22bcbb={};_0x22bcbb[_0x1c78fa['name']]={'$like':'%'+_0x29c7a6['query']['filter']+'%'};return _0x22bcbb;}})});}_0x2b0a2f=_[_0x0004('0x40')]({},_0x2b0a2f,_0x29c7a6[_0x0004('0x41')]);var _0x3be1a4={'where':_0x2b0a2f['where']};return db[_0x0004('0x42')][_0x0004('0x1e')](_0x3be1a4)[_0x0004('0x26')](function(_0x3beaa0){_0x23c79a[_0x0004('0x1e')]=_0x3beaa0;if(_0x29c7a6[_0x0004('0x31')]['includeAll']){_0x2b0a2f[_0x0004('0x43')]=[{'all':!![]}];}return db[_0x0004('0x42')][_0x0004('0x44')](_0x2b0a2f);})[_0x0004('0x26')](function(_0x6afc91){_0x23c79a[_0x0004('0x45')]=_0x6afc91;return _0x23c79a;})[_0x0004('0x26')](respondWithFilteredResult(_0x357d38,_0x2b0a2f))[_0x0004('0x46')](handleError(_0x357d38,null));};exports[_0x0004('0x47')]=function(_0x5f3882,_0x2ebc4d){var _0x138e0b={'raw':![],'where':{'id':_0x5f3882['params']['id']}},_0x36da11={};_0x36da11[_0x0004('0x36')]=_['keys'](db[_0x0004('0x42')]['rawAttributes']);_0x36da11['query']=_[_0x0004('0x32')](_0x5f3882[_0x0004('0x31')]);_0x36da11[_0x0004('0x33')]=_[_0x0004('0x34')](_0x36da11[_0x0004('0x36')],_0x36da11['query']);_0x138e0b[_0x0004('0x35')]=_[_0x0004('0x34')](_0x36da11[_0x0004('0x36')],qs[_0x0004('0x37')](_0x5f3882['query'][_0x0004('0x37')]));_0x138e0b['attributes']=_0x138e0b[_0x0004('0x35')][_0x0004('0x38')]?_0x138e0b['attributes']:_0x36da11['model'];if(_0x5f3882[_0x0004('0x31')][_0x0004('0x48')]){_0x138e0b['include']=[{'all':!![]}];}_0x138e0b=_[_0x0004('0x40')]({},_0x138e0b,_0x5f3882[_0x0004('0x41')]);return db[_0x0004('0x42')][_0x0004('0x49')](_0x138e0b)[_0x0004('0x26')](handleEntityNotFound(_0x2ebc4d,null))[_0x0004('0x26')](respondWithResult(_0x2ebc4d,null))[_0x0004('0x46')](handleError(_0x2ebc4d,null));};exports[_0x0004('0x4a')]=function(_0x323918,_0x3b4305){return db[_0x0004('0x42')][_0x0004('0x4a')](_0x323918['body'],{})['then'](function(_0x1f84eb){var _0x260ea2=_0x323918['user'][_0x0004('0x28')]({'plain':!![]});if(!_0x260ea2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x260ea2['role']===_0x0004('0x4b')){var _0x2d88f7=_0x1f84eb['get']({'plain':!![]});var _0x48a0c5=_0x0004('0x4c');return db[_0x0004('0x4d')][_0x0004('0x49')]({'where':{'name':_0x48a0c5,'userProfileId':_0x260ea2[_0x0004('0x4e')]},'raw':!![]})[_0x0004('0x26')](function(_0x1df851){if(_0x1df851&&_0x1df851[_0x0004('0x4f')]===0x0){return db[_0x0004('0x29')]['create']({'name':_0x2d88f7[_0x0004('0x2b')],'resourceId':_0x2d88f7['id'],'type':_0x1df851['name'],'sectionId':_0x1df851['id']},{})['then'](function(){return _0x1f84eb;});}else{return _0x1f84eb;}})['catch'](function(_0x279598){logger[_0x0004('0x2a')](_0x0004('0x50'),_0x279598);throw _0x279598;});}return _0x1f84eb;})[_0x0004('0x26')](respondWithResult(_0x3b4305,0xc9))[_0x0004('0x46')](handleError(_0x3b4305,null));};exports[_0x0004('0x25')]=function(_0x20e2ed,_0x30b076){if(_0x20e2ed[_0x0004('0x51')]['id']){delete _0x20e2ed['body']['id'];}return db[_0x0004('0x42')][_0x0004('0x49')]({'where':{'id':_0x20e2ed['params']['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x30b076,null))[_0x0004('0x26')](saveUpdates(_0x20e2ed[_0x0004('0x51')],null))[_0x0004('0x26')](respondWithResult(_0x30b076,null))[_0x0004('0x46')](handleError(_0x30b076,null));};exports[_0x0004('0x27')]=function(_0x1d29da,_0x4698c9){return db['CmList'][_0x0004('0x49')]({'where':{'id':_0x1d29da['params']['id']}})['then'](handleEntityNotFound(_0x4698c9,null))['then'](removeEntity(_0x4698c9,null))['catch'](handleError(_0x4698c9,null));};exports[_0x0004('0x52')]=function(_0x4845be,_0x4a7fbb){return db[_0x0004('0x42')][_0x0004('0x52')]()[_0x0004('0x26')](respondWithResult(_0x4a7fbb,null))[_0x0004('0x46')](handleError(_0x4a7fbb,null));};exports[_0x0004('0x53')]=function(_0x5b1415,_0x3fce21,_0x244e66){if(_0x5b1415[_0x0004('0x51')]['id']){delete _0x5b1415['body']['id'];}return db[_0x0004('0x42')][_0x0004('0x49')]({'where':{'id':_0x5b1415[_0x0004('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fce21,null))['then'](function(_0x15d008){if(_0x15d008){_0x5b1415[_0x0004('0x51')][_0x0004('0x55')]=_0x15d008['id'];return db[_0x0004('0x56')][_0x0004('0x4a')](_0x5b1415[_0x0004('0x51')]);}})[_0x0004('0x26')](respondWithResult(_0x3fce21,null))[_0x0004('0x46')](handleError(_0x3fce21,null));};exports['getDispositions']=function(_0x5064c1,_0x36bffa,_0x41c5d5){var _0x28e290={'raw':![],'where':{}};var _0x561d6f={};var _0x5470f2={'count':0x0,'rows':[]};return db[_0x0004('0x42')][_0x0004('0x57')]({'where':{'id':_0x5064c1['params']['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x36bffa,null))[_0x0004('0x26')](function(_0x1a994a){if(_0x1a994a){_0x561d6f['model']=_[_0x0004('0x32')](db[_0x0004('0x56')]['rawAttributes']);_0x561d6f[_0x0004('0x31')]=_[_0x0004('0x32')](_0x5064c1[_0x0004('0x31')]);_0x561d6f[_0x0004('0x33')]=_[_0x0004('0x34')](_0x561d6f[_0x0004('0x36')],_0x561d6f['query']);_0x28e290['attributes']=_[_0x0004('0x34')](_0x561d6f[_0x0004('0x36')],qs[_0x0004('0x37')](_0x5064c1[_0x0004('0x31')][_0x0004('0x37')]));_0x28e290[_0x0004('0x35')]=_0x28e290[_0x0004('0x35')]['length']?_0x28e290[_0x0004('0x35')]:_0x561d6f[_0x0004('0x36')];if(!_0x5064c1[_0x0004('0x31')][_0x0004('0x39')](_0x0004('0x3a'))){_0x28e290[_0x0004('0x1d')]=qs[_0x0004('0x1d')](_0x5064c1[_0x0004('0x31')]['limit']);_0x28e290['offset']=qs[_0x0004('0x1b')](_0x5064c1[_0x0004('0x31')][_0x0004('0x1b')]);}_0x28e290['order']=qs[_0x0004('0x3c')](_0x5064c1[_0x0004('0x31')][_0x0004('0x3c')]);_0x28e290[_0x0004('0x3d')]=qs[_0x0004('0x33')](_[_0x0004('0x3e')](_0x5064c1[_0x0004('0x31')],_0x561d6f[_0x0004('0x33')]));_0x28e290[_0x0004('0x3d')][_0x0004('0x55')]=_0x1a994a['id'];if(_0x5064c1[_0x0004('0x31')][_0x0004('0x3f')]){_0x28e290[_0x0004('0x3d')]=_[_0x0004('0x40')](_0x28e290[_0x0004('0x3d')],{'$or':_['map'](_0x28e290['attributes'],function(_0x28080b){var _0x1cc471={};_0x1cc471[_0x28080b]={'$like':'%'+_0x5064c1[_0x0004('0x31')][_0x0004('0x3f')]+'%'};return _0x1cc471;})});}_0x28e290=_['merge']({},_0x28e290,_0x5064c1['options']);return db[_0x0004('0x56')][_0x0004('0x1e')]({'where':_0x28e290[_0x0004('0x3d')]})['then'](function(_0x2a1819){_0x5470f2[_0x0004('0x1e')]=_0x2a1819;if(_0x5064c1[_0x0004('0x31')][_0x0004('0x48')]){_0x28e290[_0x0004('0x43')]=[{'all':!![]}];}return db[_0x0004('0x56')][_0x0004('0x44')](_0x28e290);})[_0x0004('0x26')](function(_0x587e25){_0x5470f2[_0x0004('0x45')]=_0x587e25;return _0x5470f2;});}})[_0x0004('0x26')](respondWithFilteredResult(_0x36bffa,_0x28e290))['catch'](handleError(_0x36bffa,null));};exports[_0x0004('0x58')]=function(_0x4d8032,_0x1b60da,_0x455873){return db[_0x0004('0x42')][_0x0004('0x49')]({'where':{'id':_0x4d8032[_0x0004('0x54')]['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x1b60da,null))['then'](function(_0x5c37f9){if(_0x5c37f9){return _0x5c37f9[_0x0004('0x58')](_0x4d8032[_0x0004('0x31')][_0x0004('0x59')]);}})[_0x0004('0x26')](respondWithStatusCode(_0x1b60da,null))[_0x0004('0x46')](handleError(_0x1b60da,null));};exports[_0x0004('0x5a')]=function(_0x3a8932,_0x5d8834,_0x2afc5e){return db[_0x0004('0x42')][_0x0004('0x49')]({'where':{'id':_0x3a8932[_0x0004('0x54')]['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x5d8834,null))['then'](function(_0x465997){if(_0x465997){var _0x215b16=[];var _0x2b072f={'success':[],'errors':[]};return db[_0x0004('0x5b')][_0x0004('0x52')]()[_0x0004('0x26')](function(_0x3e2c59){if(_0x3a8932[_0x0004('0x51')][_0x0004('0x5c')]&&_[_0x0004('0x5d')](_0x3a8932[_0x0004('0x51')]['tags'])){if(_0x3a8932[_0x0004('0x51')]['tags'][_0x0004('0x38')]){_0x3a8932[_0x0004('0x51')][_0x0004('0x5c')]=_0x3a8932[_0x0004('0x51')][_0x0004('0x5c')][_0x0004('0x5e')](';')+';';}else{_0x3a8932['body']['tags']=null;}}else{_0x3a8932[_0x0004('0x51')][_0x0004('0x5c')]=null;}if(_0x3a8932['body']&&_[_0x0004('0x5d')](_0x3a8932[_0x0004('0x51')])){for(var _0x2d9310=0x0;_0x2d9310<_0x3a8932[_0x0004('0x51')][_0x0004('0x38')];_0x2d9310+=0x1){_0x3a8932[_0x0004('0x51')][_0x2d9310]['ListId']=_0x3a8932[_0x0004('0x54')]['id'];_0x215b16[_0x0004('0x5f')](_0x3a8932[_0x0004('0x51')][_0x2d9310]);}return BPromise[_0x0004('0x60')](_0x215b16,function(_0x2ff958){return db[_0x0004('0x5b')][_0x0004('0x4a')](_['omit'](_0x2ff958,[_0x0004('0x59'),'id'])||{},{'fields':_[_0x0004('0x32')](_0x3e2c59),'raw':!![]})[_0x0004('0x26')](function(_0x503f64){_0x2b072f[_0x0004('0x61')]['push'](_0x503f64[_0x0004('0x62')]);})[_0x0004('0x46')](function(_0x128718){_0x2b072f[_0x0004('0x63')][_0x0004('0x5f')]({'data':_0x2ff958,'error':_0x128718[_0x0004('0x64')]});});})[_0x0004('0x26')](function(_0x1b6ea8){return _0x2b072f;})[_0x0004('0x46')](function(_0x30f490){return _0x30f490;});}else{_0x5d8834[_0x0004('0x1f')](0x190)['json']({'message':_0x0004('0x65')});}});}})[_0x0004('0x26')](respondWithResult(_0x5d8834,null))[_0x0004('0x46')](handleError(_0x5d8834,null));};exports[_0x0004('0x66')]=function(_0x200090,_0x3c8162,_0x2393cc){var _0x56bf58;return db[_0x0004('0x42')][_0x0004('0x49')]({'where':{'id':_0x200090['params']['id']},'include':[{'model':db[_0x0004('0x67')],'as':_0x0004('0x68')}]})[_0x0004('0x26')](handleEntityNotFound(_0x3c8162,null))['then'](function(_0x3ad4a0){if(_0x3ad4a0){_0x56bf58=_0x3ad4a0;return db[_0x0004('0x5b')][_0x0004('0x2d')];}})['then'](function(_0x1976a1){if(_0x1976a1){var _0xc237ba={};var _0x525fe1={};_0x525fe1[_0x0004('0x36')]=_[_0x0004('0x69')](_['keys'](_0x1976a1),_[_0x0004('0x30')](_0x56bf58['CustomFields'],function(_0x1444d3){return util[_0x0004('0x6a')](_0x0004('0x6b'),_0x1444d3['id']);}));_0x525fe1['query']=_[_0x0004('0x32')](_0x200090['query']);_0x525fe1[_0x0004('0x33')]=_[_0x0004('0x34')](_0x525fe1['model'],_0x525fe1[_0x0004('0x31')]);_0xc237ba[_0x0004('0x35')]=_[_0x0004('0x34')](_0x525fe1[_0x0004('0x36')],qs[_0x0004('0x37')](_0x200090['query'][_0x0004('0x37')]));_0xc237ba[_0x0004('0x35')]=_0xc237ba[_0x0004('0x35')][_0x0004('0x38')]?_0xc237ba['attributes']:_0x525fe1[_0x0004('0x36')];if(!_0x200090[_0x0004('0x31')]['hasOwnProperty'](_0x0004('0x3a'))){_0xc237ba['limit']=qs[_0x0004('0x1d')](_0x200090[_0x0004('0x31')][_0x0004('0x1d')]);_0xc237ba[_0x0004('0x1b')]=qs[_0x0004('0x1b')](_0x200090['query'][_0x0004('0x1b')]);}_0xc237ba[_0x0004('0x3b')]=qs[_0x0004('0x3c')](_0x200090[_0x0004('0x31')][_0x0004('0x3c')]);_0xc237ba[_0x0004('0x3d')]=qs['filters'](_[_0x0004('0x3e')](_0x200090['query'],_0x525fe1[_0x0004('0x33')]));_0xc237ba[_0x0004('0x6c')]=!![];if(_0x200090[_0x0004('0x31')][_0x0004('0x3f')]){_0xc237ba['where']=_[_0x0004('0x40')](_0xc237ba[_0x0004('0x3d')],{'$or':_['map'](_0xc237ba['attributes'],function(_0x615990){var _0x42da76={};_0x42da76[_0x615990]={'$like':'%'+_0x200090[_0x0004('0x31')][_0x0004('0x3f')]+'%'};return _0x42da76;})});}_0xc237ba=_[_0x0004('0x40')]({},_0xc237ba,_0x200090[_0x0004('0x41')]);return _0x56bf58['getContacts'](_0xc237ba);}})[_0x0004('0x26')](respondWithResult(_0x3c8162,null))[_0x0004('0x46')](handleError(_0x3c8162,null));};exports[_0x0004('0x6d')]=function(_0x32f86f,_0x5d2e72,_0x524cd8){var _0x432977;var _0x21e7cb;var _0x3a7115;var _0x9f97f6=_0x32f86f[_0x0004('0x54')]['id'];csv_results=[];return db['ContactItemType'][_0x0004('0x44')]({'attributes':['id',_0x0004('0x2b')],'raw':!![],'order':[_0x0004('0x6e')]})[_0x0004('0x26')](function(_0x5a3c87){_0x432977=_0x5a3c87;var _0x56ebd9=_[_0x0004('0x32')](db['CmContact'][_0x0004('0x2d')]);return db['CmCustomField'][_0x0004('0x44')]({'raw':!![],'attributes':['id',_0x0004('0x6f')]})[_0x0004('0x26')](function(_0x278091){_0x21e7cb=_0x278091;var _0x3ae24a=squel[_0x0004('0x70')]()[_0x0004('0x37')](_0x56ebd9)[_0x0004('0x71')](_0x0004('0x72'),'c')[_0x0004('0x3d')](_0x0004('0x73'),_0x9f97f6)[_0x0004('0x3d')](_0x0004('0x74'))[_0x0004('0x75')]();for(var _0x537eef=0x0;_0x537eef<_0x21e7cb[_0x0004('0x38')];_0x537eef++){_0x3ae24a[_0x0004('0x76')](_0x0004('0x77')+_0x21e7cb[_0x537eef]['id'],_0x0004('0x78')+_0x21e7cb[_0x537eef]['alias']);}for(var _0x537eef=0x0;_0x537eef<_0x432977['length'];_0x537eef++){_0x3ae24a['field'](squel[_0x0004('0x70')]()[_0x0004('0x76')](_0x0004('0x79'))['from'](_0x0004('0x7a'))[_0x0004('0x3d')](_0x0004('0x7b'),_0x432977[_0x537eef]['id'])['where'](_0x0004('0x7c')),_0x0004('0x7d')+_0x432977[_0x537eef][_0x0004('0x2b')]);_0x3ae24a['field'](squel[_0x0004('0x70')]()[_0x0004('0x76')](_0x0004('0x7e'))[_0x0004('0x71')](_0x0004('0x7a'))[_0x0004('0x3d')](_0x0004('0x7b'),_0x432977[_0x537eef]['id'])[_0x0004('0x3d')](_0x0004('0x7c')),'description_additionalPhone_'+_0x432977[_0x537eef][_0x0004('0x2b')]);}var _0x3c09d7=[];_0x3c09d7[_0x0004('0x5f')](_0x3ae24a[_0x0004('0x7f')]());BPromise['each'](_0x3c09d7,handleQuery)['then'](function(_0x37828c){handleQuery(_0x3ae24a[_0x0004('0x7f')]());var _0xa9e026=csv_results[0x0];if(!_['isEmpty'](_0xa9e026)){var _0x343cef=toCsv(_0xa9e026);var _0x4fa28b=Date[_0x0004('0x80')]();fs[_0x0004('0x81')](util[_0x0004('0x6a')](_0x0004('0x82'),_0x9f97f6,_0x4fa28b),_0x343cef);_0x5d2e72['setHeader']('Content-disposition',_0x0004('0x83')+util[_0x0004('0x6a')]('list_%d_%s.csv',_0x9f97f6,_0x4fa28b));_0x5d2e72[_0x0004('0x84')]('Content-type',_0x0004('0x85'));return _0x5d2e72[_0x0004('0x86')](util[_0x0004('0x6a')]('/tmp/list_%d_%s.csv',_0x9f97f6,_0x4fa28b));}else{return _0x5d2e72[_0x0004('0x1a')](0xcc);}});});});};exports[_0x0004('0x87')]=function(_0x51c9a2,_0x49f68c,_0x505550){var _0x2a5213;delete _0x51c9a2['body']['id'];return db[_0x0004('0x42')][_0x0004('0x57')]({'where':{'id':_0x51c9a2['params']['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x49f68c,null))['then'](function(_0x2f25c5){if(_0x2f25c5){return db[_0x0004('0x88')][_0x0004('0x89')](function(_0xef12ae){return db['CmCustomField']['create'](_0x51c9a2[_0x0004('0x51')],{'transaction':_0xef12ae})['then'](function(_0x428a3e){_0x2a5213=_0x428a3e;return _0x2f25c5[_0x0004('0x8a')](_0x428a3e,{'transaction':_0xef12ae});})[_0x0004('0x26')](function(){var _0x4426f1={'type':db[_0x0004('0x8b')]['TEXT'],'transaction':_0xef12ae};switch(_0x51c9a2[_0x0004('0x51')]['type']){case'text':_0x4426f1[_0x0004('0x2e')]=db[_0x0004('0x8b')][_0x0004('0x8c')];break;case'number':_0x4426f1[_0x0004('0x2e')]=db[_0x0004('0x8b')][_0x0004('0x8d')];break;case _0x0004('0x8e'):_0x4426f1[_0x0004('0x2e')]=db[_0x0004('0x8b')]['BOOLEAN'];_0x4426f1['defaultValue']=![];break;default:}return db[_0x0004('0x88')]['queryInterface'][_0x0004('0x8f')](_0x0004('0x72'),util[_0x0004('0x6a')]('cf_%s',_0x2a5213['id']),_0x4426f1);})['then'](function(){return _0x2a5213;});});}})[_0x0004('0x26')](respondWithResult(_0x49f68c,null))[_0x0004('0x46')](handleError(_0x49f68c,null));};exports['getCustomFields']=function(_0x26d99a,_0x29c435,_0x493cdd){var _0x20bbde={};var _0x195168={};var _0x5e09dc;var _0x12f7e7;return db[_0x0004('0x42')][_0x0004('0x57')]({'where':{'id':_0x26d99a[_0x0004('0x54')]['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x29c435,null))['then'](function(_0x540014){if(_0x540014){_0x5e09dc=_0x540014;_0x195168[_0x0004('0x36')]=_[_0x0004('0x32')](db[_0x0004('0x67')][_0x0004('0x2d')]);_0x195168[_0x0004('0x31')]=_[_0x0004('0x32')](_0x26d99a[_0x0004('0x31')]);_0x195168[_0x0004('0x33')]=_[_0x0004('0x34')](_0x195168[_0x0004('0x36')],_0x195168[_0x0004('0x31')]);_0x20bbde[_0x0004('0x35')]=_['intersection'](_0x195168[_0x0004('0x36')],qs[_0x0004('0x37')](_0x26d99a[_0x0004('0x31')][_0x0004('0x37')]));_0x20bbde[_0x0004('0x35')]=_0x20bbde[_0x0004('0x35')][_0x0004('0x38')]?_0x20bbde[_0x0004('0x35')]:_0x195168['model'];_0x20bbde['order']=qs[_0x0004('0x3c')](_0x26d99a[_0x0004('0x31')][_0x0004('0x3c')]);_0x20bbde['where']=qs[_0x0004('0x33')](_[_0x0004('0x3e')](_0x26d99a[_0x0004('0x31')],_0x195168[_0x0004('0x33')]));_0x20bbde[_0x0004('0x3d')]=_[_0x0004('0x40')](_0x20bbde[_0x0004('0x3d')],{'$or':[{'ListId':_0x540014['id']},{'ListId':null}]});if(_0x26d99a[_0x0004('0x31')][_0x0004('0x3f')]){_0x20bbde['where']=_['merge'](_0x20bbde[_0x0004('0x3d')],{'$or':_[_0x0004('0x30')](_0x20bbde[_0x0004('0x35')],function(_0x3ab259){var _0xac37fa={};_0xac37fa[_0x3ab259]={'$like':'%'+_0x26d99a['query'][_0x0004('0x3f')]+'%'};return _0xac37fa;})});}_0x20bbde=_[_0x0004('0x40')]({},_0x20bbde,_0x26d99a[_0x0004('0x41')]);return db[_0x0004('0x67')][_0x0004('0x90')](_0x20bbde);}})[_0x0004('0x26')](respondWithResult(_0x29c435,null))[_0x0004('0x46')](handleError(_0x29c435,null));};exports[_0x0004('0x91')]=function(_0x39c738,_0x518c58){return db[_0x0004('0x67')][_0x0004('0x90')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x518c58,null))[_0x0004('0x26')](function(_0x3e0e01){return _0x3e0e01;})[_0x0004('0x26')](respondWithResult(_0x518c58,null))[_0x0004('0x46')](handleError(_0x518c58,null));};exports[_0x0004('0x92')]=function(_0x3245ef,_0x3025f7,_0x15cd6f){return db[_0x0004('0x42')]['find']({'where':{'id':_0x3245ef[_0x0004('0x54')]['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x3025f7,null))['then'](function(_0x1a87ae){if(_0x1a87ae){return _0x1a87ae[_0x0004('0x92')](_0x3245ef['body'][_0x0004('0x59')],_[_0x0004('0x93')](_0x3245ef[_0x0004('0x51')],[_0x0004('0x59'),'id'])||{})[_0x0004('0x94')](function(_0x118351){for(var _0x2af9e7=0x0;_0x2af9e7<_0x3245ef[_0x0004('0x51')][_0x0004('0x59')][_0x0004('0x38')];_0x2af9e7+=0x1){socket[_0x0004('0x95')](_0x0004('0x96'),{'UserId':Number(_0x3245ef[_0x0004('0x51')][_0x0004('0x59')][_0x2af9e7]),'CmListId':Number(_0x3245ef[_0x0004('0x54')]['id'])});}return _0x118351;});}})[_0x0004('0x26')](respondWithResult(_0x3025f7,null))[_0x0004('0x46')](handleError(_0x3025f7,null));};exports['removeAgents']=function(_0x5b4ef4,_0x11fa7f,_0x332363){return db[_0x0004('0x42')][_0x0004('0x49')]({'where':{'id':_0x5b4ef4[_0x0004('0x54')]['id']}})['then'](handleEntityNotFound(_0x11fa7f,null))[_0x0004('0x26')](function(_0x170331){if(_0x170331){return _0x170331['removeAgents'](_0x5b4ef4[_0x0004('0x31')][_0x0004('0x59')])[_0x0004('0x26')](function(){if(_[_0x0004('0x5d')](_0x5b4ef4[_0x0004('0x31')][_0x0004('0x59')])){for(var _0x1cc5f3=0x0;_0x1cc5f3<_0x5b4ef4['query'][_0x0004('0x59')]['length'];_0x1cc5f3+=0x1){socket[_0x0004('0x95')]('userCmList:remove',{'UserId':Number(_0x5b4ef4[_0x0004('0x31')][_0x0004('0x59')][_0x1cc5f3]),'CmListId':Number(_0x5b4ef4[_0x0004('0x54')]['id'])});}}else{socket[_0x0004('0x95')]('userCmList:remove',{'UserId':Number(_0x5b4ef4[_0x0004('0x31')][_0x0004('0x59')]),'CmListId':Number(_0x5b4ef4[_0x0004('0x54')]['id'])});}});}})[_0x0004('0x26')](respondWithStatusCode(_0x11fa7f,null))[_0x0004('0x46')](handleError(_0x11fa7f,null));};exports['getAgents']=function(_0x3350bc,_0x5de4f3,_0x198164){var _0x500d00={};var _0x19a654={};var _0x3a321a;var _0x460524;return db['CmList']['findOne']({'where':{'id':_0x3350bc[_0x0004('0x54')]['id']}})[_0x0004('0x26')](handleEntityNotFound(_0x5de4f3,null))['then'](function(_0x18f31c){if(_0x18f31c){_0x3a321a=_0x18f31c;_0x19a654[_0x0004('0x36')]=_[_0x0004('0x32')](db['User'][_0x0004('0x2d')]);_0x19a654[_0x0004('0x31')]=_['keys'](_0x3350bc[_0x0004('0x31')]);_0x19a654['filters']=_[_0x0004('0x34')](_0x19a654['model'],_0x19a654[_0x0004('0x31')]);_0x500d00['attributes']=_[_0x0004('0x34')](_0x19a654[_0x0004('0x36')],qs[_0x0004('0x37')](_0x3350bc['query'][_0x0004('0x37')]));_0x500d00['attributes']=_0x500d00[_0x0004('0x35')][_0x0004('0x38')]?_0x500d00[_0x0004('0x35')]:_0x19a654['model'];_0x500d00[_0x0004('0x3b')]=qs[_0x0004('0x3c')](_0x3350bc[_0x0004('0x31')][_0x0004('0x3c')]);_0x500d00[_0x0004('0x3d')]=qs[_0x0004('0x33')](_['pick'](_0x3350bc[_0x0004('0x31')],_0x19a654[_0x0004('0x33')]));if(_0x3350bc[_0x0004('0x31')][_0x0004('0x3f')]){_0x500d00[_0x0004('0x3d')]=_['merge'](_0x500d00[_0x0004('0x3d')],{'$or':_['map'](_0x500d00['attributes'],function(_0x5d3079){var _0x3a1684={};_0x3a1684[_0x5d3079]={'$like':'%'+_0x3350bc[_0x0004('0x31')][_0x0004('0x3f')]+'%'};return _0x3a1684;})});}_0x500d00=_[_0x0004('0x40')]({},_0x500d00,_0x3350bc['options']);return _0x3a321a[_0x0004('0x97')](_0x500d00);}})[_0x0004('0x26')](function(_0x45957a){if(_0x45957a){_0x460524=_0x45957a[_0x0004('0x38')];if(!_0x3350bc[_0x0004('0x31')][_0x0004('0x39')](_0x0004('0x3a'))){_0x500d00[_0x0004('0x1d')]=qs[_0x0004('0x1d')](_0x3350bc[_0x0004('0x31')][_0x0004('0x1d')]);_0x500d00[_0x0004('0x1b')]=qs[_0x0004('0x1b')](_0x3350bc[_0x0004('0x31')][_0x0004('0x1b')]);}return _0x3a321a[_0x0004('0x97')](_0x500d00);}})[_0x0004('0x26')](function(_0x45129c){if(_0x45129c){return _0x45129c?{'count':_0x460524,'rows':_0x45129c}:null;}})[_0x0004('0x26')](respondWithResult(_0x5de4f3,null))[_0x0004('0x46')](handleError(_0x5de4f3,null));};function handleQuery(_0x44e72b){logger[_0x0004('0x98')](_0x44e72b);return db['sequelize']['query'](_0x44e72b)[_0x0004('0x94')](function(_0x3f54a9){csv_results[_0x0004('0x5f')](_0x3f54a9);})[_0x0004('0x46')](function(_0x5ce5b3){logger['error'](_0x5ce5b3[_0x0004('0x64')]);});} \ No newline at end of file +var _0xd5bd=['findAll','rows','catch','show','params','rawAttributes','intersection','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','raw','getContacts','ContactItemType','OrderBy','alias','select','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','item','from','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmList','includeAll'];(function(_0x4a0448,_0x5d1048){var _0x5cd670=function(_0x126148){while(--_0x126148){_0x4a0448['push'](_0x4a0448['shift']());}};_0x5cd670(++_0x5d1048);}(_0xd5bd,0xfe));var _0xdd5b=function(_0x14a69f,_0x159b4e){_0x14a69f=_0x14a69f-0x0;var _0x4d542c=_0xd5bd[_0x14a69f];return _0x4d542c;};'use strict';var emlformat=require(_0xdd5b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd5b('0x1'));var BPromise=require(_0xdd5b('0x2'));var Mustache=require(_0xdd5b('0x3'));var util=require('util');var path=require('path');var sox=require(_0xdd5b('0x4'));var csv=require('to-csv');var ejs=require(_0xdd5b('0x5'));var fs=require('fs');var fs_extra=require(_0xdd5b('0x6'));var _=require(_0xdd5b('0x7'));var squel=require(_0xdd5b('0x8'));var crypto=require(_0xdd5b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xdd5b('0xa'));var toCsv=require('to-csv');var querystring=require(_0xdd5b('0xb'));var Papa=require(_0xdd5b('0xc'));var Redis=require('ioredis');var authService=require(_0xdd5b('0xd'));var qs=require(_0xdd5b('0xe'));var as=require(_0xdd5b('0xf'));var hardwareService=require(_0xdd5b('0x10'));var logger=require(_0xdd5b('0x11'))(_0xdd5b('0x12'));var utils=require(_0xdd5b('0x13'));var config=require(_0xdd5b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd5b('0x15'))['db'];var csv_results;config[_0xdd5b('0x16')]=_['defaults'](config['redis'],{'host':_0xdd5b('0x17'),'port':0x18eb});var socket=require(_0xdd5b('0x18'))(new Redis(config['redis']));require(_0xdd5b('0x19'))[_0xdd5b('0x1a')](socket);function respondWithStatusCode(_0x17779e,_0x19d319){_0x19d319=_0x19d319||0xcc;return function(_0x126875){if(_0x126875){return _0x17779e[_0xdd5b('0x1b')](_0x19d319);}return _0x17779e[_0xdd5b('0x1c')](_0x19d319)[_0xdd5b('0x1d')]();};}function respondWithResult(_0x47d55b,_0x24f5f6){_0x24f5f6=_0x24f5f6||0xc8;return function(_0x2b3ebd){if(_0x2b3ebd){return _0x47d55b[_0xdd5b('0x1c')](_0x24f5f6)['json'](_0x2b3ebd);}};}function respondWithFilteredResult(_0x15e810,_0x39e42d){return function(_0x19a57f){if(_0x19a57f){var _0x5ce5f6=typeof _0x39e42d[_0xdd5b('0x1e')]===_0xdd5b('0x1f')&&typeof _0x39e42d[_0xdd5b('0x20')]===_0xdd5b('0x1f');var _0x702465=_0x19a57f[_0xdd5b('0x21')];var _0x1ba925=_0x5ce5f6?0x0:_0x39e42d['offset'];var _0x1f7733=_0x5ce5f6?_0x19a57f[_0xdd5b('0x21')]:_0x39e42d[_0xdd5b('0x1e')]+_0x39e42d[_0xdd5b('0x20')];var _0x5b4810;if(_0x1f7733>=_0x702465){_0x1f7733=_0x702465;_0x5b4810=0xc8;}else{_0x5b4810=0xce;}_0x15e810[_0xdd5b('0x1c')](_0x5b4810);return _0x15e810[_0xdd5b('0x22')]('Content-Range',_0x1ba925+'-'+_0x1f7733+'/'+_0x702465)[_0xdd5b('0x23')](_0x19a57f);}return null;};}function patchUpdates(_0x4fd3c5){return function(_0x5012bf){try{jsonpatch[_0xdd5b('0x24')](_0x5012bf,_0x4fd3c5,!![]);}catch(_0x35fc27){return BPromise['reject'](_0x35fc27);}return _0x5012bf[_0xdd5b('0x25')]();};}function saveUpdates(_0x3b6061,_0x4b578b){return function(_0x42dd57){if(_0x42dd57){return _0x42dd57[_0xdd5b('0x26')](_0x3b6061)[_0xdd5b('0x27')](function(_0x9229a4){return _0x9229a4;});}return null;};}function removeEntity(_0x36ac49,_0x33084b){return function(_0x4a9df3){if(_0x4a9df3){return _0x4a9df3[_0xdd5b('0x28')]()[_0xdd5b('0x27')](function(){var _0x4af799=_0x4a9df3[_0xdd5b('0x29')]({'plain':!![]});var _0x5f2224=_0xdd5b('0x2a');return db[_0xdd5b('0x2b')]['destroy']({'where':{'type':_0x5f2224,'resourceId':_0x4af799['id']}})[_0xdd5b('0x27')](function(){return _0x4a9df3;});})[_0xdd5b('0x27')](function(){_0x36ac49['status'](0xcc)[_0xdd5b('0x1d')]();});}};}function handleEntityNotFound(_0x3302d,_0x548cc4){return function(_0x2be8f2){if(!_0x2be8f2){_0x3302d[_0xdd5b('0x1b')](0x194);}return _0x2be8f2;};}function handleError(_0x1f7c95,_0x5eaaa0){_0x5eaaa0=_0x5eaaa0||0x1f4;return function(_0x5d477d){logger[_0xdd5b('0x2c')](_0x5d477d[_0xdd5b('0x2d')]);if(_0x5d477d[_0xdd5b('0x2e')]){delete _0x5d477d[_0xdd5b('0x2e')];}_0x1f7c95[_0xdd5b('0x1c')](_0x5eaaa0)[_0xdd5b('0x2f')](_0x5d477d);};}exports[_0xdd5b('0x30')]=function(_0x5f45ea,_0x53f269){var _0x14b7e2={},_0x5c961f={},_0x4203a3={'count':0x0,'rows':[]};var _0x186e09=_['map'](db['CmList']['rawAttributes'],function(_0x4a17d5){return{'name':_0x4a17d5[_0xdd5b('0x31')],'type':_0x4a17d5[_0xdd5b('0x32')][_0xdd5b('0x33')]};});_0x5c961f[_0xdd5b('0x34')]=_[_0xdd5b('0x35')](_0x186e09,_0xdd5b('0x2e'));_0x5c961f[_0xdd5b('0x36')]=_[_0xdd5b('0x37')](_0x5f45ea[_0xdd5b('0x36')]);_0x5c961f[_0xdd5b('0x38')]=_['intersection'](_0x5c961f[_0xdd5b('0x34')],_0x5c961f[_0xdd5b('0x36')]);_0x14b7e2[_0xdd5b('0x39')]=_['intersection'](_0x5c961f['model'],qs[_0xdd5b('0x3a')](_0x5f45ea[_0xdd5b('0x36')][_0xdd5b('0x3a')]));_0x14b7e2[_0xdd5b('0x39')]=_0x14b7e2[_0xdd5b('0x39')][_0xdd5b('0x3b')]?_0x14b7e2['attributes']:_0x5c961f['model'];if(!_0x5f45ea['query'][_0xdd5b('0x3c')](_0xdd5b('0x3d'))){_0x14b7e2[_0xdd5b('0x20')]=qs[_0xdd5b('0x20')](_0x5f45ea[_0xdd5b('0x36')][_0xdd5b('0x20')]);_0x14b7e2[_0xdd5b('0x1e')]=qs[_0xdd5b('0x1e')](_0x5f45ea[_0xdd5b('0x36')][_0xdd5b('0x1e')]);}_0x14b7e2[_0xdd5b('0x3e')]=qs[_0xdd5b('0x3f')](_0x5f45ea[_0xdd5b('0x36')]['sort']);_0x14b7e2[_0xdd5b('0x40')]=qs[_0xdd5b('0x38')](_[_0xdd5b('0x41')](_0x5f45ea['query'],_0x5c961f[_0xdd5b('0x38')]),_0x186e09);if(_0x5f45ea['query'][_0xdd5b('0x42')]){_0x14b7e2[_0xdd5b('0x40')]=_['merge'](_0x14b7e2[_0xdd5b('0x40')],{'$or':_['map'](_0x186e09,function(_0x12244d){if(_0x12244d[_0xdd5b('0x32')]!==_0xdd5b('0x43')){var _0x58af00={};_0x58af00[_0x12244d[_0xdd5b('0x2e')]]={'$like':'%'+_0x5f45ea[_0xdd5b('0x36')]['filter']+'%'};return _0x58af00;}})});}_0x14b7e2=_[_0xdd5b('0x44')]({},_0x14b7e2,_0x5f45ea[_0xdd5b('0x45')]);var _0x45ad11={'where':_0x14b7e2[_0xdd5b('0x40')]};return db[_0xdd5b('0x46')][_0xdd5b('0x21')](_0x45ad11)[_0xdd5b('0x27')](function(_0x13145e){_0x4203a3[_0xdd5b('0x21')]=_0x13145e;if(_0x5f45ea[_0xdd5b('0x36')][_0xdd5b('0x47')]){_0x14b7e2['include']=[{'all':!![]}];}return db[_0xdd5b('0x46')][_0xdd5b('0x48')](_0x14b7e2);})[_0xdd5b('0x27')](function(_0xa031f1){_0x4203a3[_0xdd5b('0x49')]=_0xa031f1;return _0x4203a3;})['then'](respondWithFilteredResult(_0x53f269,_0x14b7e2))[_0xdd5b('0x4a')](handleError(_0x53f269,null));};exports[_0xdd5b('0x4b')]=function(_0x26e41a,_0x3fbac1){var _0x22b9d2={'raw':![],'where':{'id':_0x26e41a[_0xdd5b('0x4c')]['id']}},_0x18a6e4={};_0x18a6e4[_0xdd5b('0x34')]=_['keys'](db[_0xdd5b('0x46')][_0xdd5b('0x4d')]);_0x18a6e4[_0xdd5b('0x36')]=_[_0xdd5b('0x37')](_0x26e41a['query']);_0x18a6e4[_0xdd5b('0x38')]=_[_0xdd5b('0x4e')](_0x18a6e4[_0xdd5b('0x34')],_0x18a6e4[_0xdd5b('0x36')]);_0x22b9d2[_0xdd5b('0x39')]=_[_0xdd5b('0x4e')](_0x18a6e4[_0xdd5b('0x34')],qs[_0xdd5b('0x3a')](_0x26e41a['query'][_0xdd5b('0x3a')]));_0x22b9d2['attributes']=_0x22b9d2[_0xdd5b('0x39')][_0xdd5b('0x3b')]?_0x22b9d2['attributes']:_0x18a6e4[_0xdd5b('0x34')];if(_0x26e41a[_0xdd5b('0x36')][_0xdd5b('0x47')]){_0x22b9d2[_0xdd5b('0x4f')]=[{'all':!![]}];}_0x22b9d2=_[_0xdd5b('0x44')]({},_0x22b9d2,_0x26e41a[_0xdd5b('0x45')]);return db[_0xdd5b('0x46')]['find'](_0x22b9d2)['then'](handleEntityNotFound(_0x3fbac1,null))[_0xdd5b('0x27')](respondWithResult(_0x3fbac1,null))[_0xdd5b('0x4a')](handleError(_0x3fbac1,null));};exports[_0xdd5b('0x50')]=function(_0x25c1be,_0x271627){return db['CmList']['create'](_0x25c1be[_0xdd5b('0x51')],{})['then'](function(_0x1f7195){var _0x522eb6=_0x25c1be[_0xdd5b('0x52')][_0xdd5b('0x29')]({'plain':!![]});if(!_0x522eb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x522eb6[_0xdd5b('0x53')]===_0xdd5b('0x52')){var _0x4fa511=_0x1f7195[_0xdd5b('0x29')]({'plain':!![]});var _0x1dd3d8=_0xdd5b('0x2a');return db[_0xdd5b('0x54')][_0xdd5b('0x55')]({'where':{'name':_0x1dd3d8,'userProfileId':_0x522eb6[_0xdd5b('0x56')]},'raw':!![]})[_0xdd5b('0x27')](function(_0xc547f2){if(_0xc547f2&&_0xc547f2[_0xdd5b('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fa511[_0xdd5b('0x2e')],'resourceId':_0x4fa511['id'],'type':_0xc547f2[_0xdd5b('0x2e')],'sectionId':_0xc547f2['id']},{})[_0xdd5b('0x27')](function(){return _0x1f7195;});}else{return _0x1f7195;}})[_0xdd5b('0x4a')](function(_0x5da8f1){logger[_0xdd5b('0x2c')](_0xdd5b('0x58'),_0x5da8f1);throw _0x5da8f1;});}return _0x1f7195;})[_0xdd5b('0x27')](respondWithResult(_0x271627,0xc9))[_0xdd5b('0x4a')](handleError(_0x271627,null));};exports[_0xdd5b('0x26')]=function(_0x2e81d2,_0x3946bc){if(_0x2e81d2['body']['id']){delete _0x2e81d2[_0xdd5b('0x51')]['id'];}return db[_0xdd5b('0x46')][_0xdd5b('0x55')]({'where':{'id':_0x2e81d2[_0xdd5b('0x4c')]['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x3946bc,null))[_0xdd5b('0x27')](saveUpdates(_0x2e81d2['body'],null))[_0xdd5b('0x27')](respondWithResult(_0x3946bc,null))['catch'](handleError(_0x3946bc,null));};exports[_0xdd5b('0x28')]=function(_0x482b99,_0x230d90){return db[_0xdd5b('0x46')][_0xdd5b('0x55')]({'where':{'id':_0x482b99[_0xdd5b('0x4c')]['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x230d90,null))[_0xdd5b('0x27')](removeEntity(_0x230d90,null))['catch'](handleError(_0x230d90,null));};exports[_0xdd5b('0x59')]=function(_0x2bf195,_0x4b7a96){return db[_0xdd5b('0x46')]['describe']()[_0xdd5b('0x27')](respondWithResult(_0x4b7a96,null))['catch'](handleError(_0x4b7a96,null));};exports['addDisposition']=function(_0x7c3f49,_0x2a7c77,_0x2807b3){if(_0x7c3f49[_0xdd5b('0x51')]['id']){delete _0x7c3f49['body']['id'];}return db[_0xdd5b('0x46')]['find']({'where':{'id':_0x7c3f49[_0xdd5b('0x4c')]['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x2a7c77,null))[_0xdd5b('0x27')](function(_0x26f86e){if(_0x26f86e){_0x7c3f49[_0xdd5b('0x51')][_0xdd5b('0x5a')]=_0x26f86e['id'];return db['Disposition'][_0xdd5b('0x50')](_0x7c3f49[_0xdd5b('0x51')]);}})[_0xdd5b('0x27')](respondWithResult(_0x2a7c77,null))[_0xdd5b('0x4a')](handleError(_0x2a7c77,null));};exports[_0xdd5b('0x5b')]=function(_0x157903,_0x786ea7,_0x5f34fd){var _0x564f30={'raw':![],'where':{}};var _0x4d9e5f={};var _0x3f9cad={'count':0x0,'rows':[]};return db[_0xdd5b('0x46')][_0xdd5b('0x5c')]({'where':{'id':_0x157903[_0xdd5b('0x4c')]['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x786ea7,null))[_0xdd5b('0x27')](function(_0x33f367){if(_0x33f367){_0x4d9e5f[_0xdd5b('0x34')]=_['keys'](db['Disposition']['rawAttributes']);_0x4d9e5f['query']=_[_0xdd5b('0x37')](_0x157903[_0xdd5b('0x36')]);_0x4d9e5f['filters']=_[_0xdd5b('0x4e')](_0x4d9e5f[_0xdd5b('0x34')],_0x4d9e5f[_0xdd5b('0x36')]);_0x564f30[_0xdd5b('0x39')]=_[_0xdd5b('0x4e')](_0x4d9e5f[_0xdd5b('0x34')],qs[_0xdd5b('0x3a')](_0x157903[_0xdd5b('0x36')][_0xdd5b('0x3a')]));_0x564f30['attributes']=_0x564f30[_0xdd5b('0x39')]['length']?_0x564f30[_0xdd5b('0x39')]:_0x4d9e5f[_0xdd5b('0x34')];if(!_0x157903[_0xdd5b('0x36')][_0xdd5b('0x3c')](_0xdd5b('0x3d'))){_0x564f30['limit']=qs[_0xdd5b('0x20')](_0x157903[_0xdd5b('0x36')][_0xdd5b('0x20')]);_0x564f30['offset']=qs['offset'](_0x157903[_0xdd5b('0x36')][_0xdd5b('0x1e')]);}_0x564f30[_0xdd5b('0x3e')]=qs[_0xdd5b('0x3f')](_0x157903[_0xdd5b('0x36')]['sort']);_0x564f30[_0xdd5b('0x40')]=qs[_0xdd5b('0x38')](_[_0xdd5b('0x41')](_0x157903['query'],_0x4d9e5f['filters']));_0x564f30['where']['ListId']=_0x33f367['id'];if(_0x157903[_0xdd5b('0x36')][_0xdd5b('0x42')]){_0x564f30[_0xdd5b('0x40')]=_[_0xdd5b('0x44')](_0x564f30[_0xdd5b('0x40')],{'$or':_['map'](_0x564f30[_0xdd5b('0x39')],function(_0x402e61){var _0x4f51fa={};_0x4f51fa[_0x402e61]={'$like':'%'+_0x157903[_0xdd5b('0x36')][_0xdd5b('0x42')]+'%'};return _0x4f51fa;})});}_0x564f30=_[_0xdd5b('0x44')]({},_0x564f30,_0x157903[_0xdd5b('0x45')]);return db['Disposition']['count']({'where':_0x564f30[_0xdd5b('0x40')]})['then'](function(_0x2aaef3){_0x3f9cad[_0xdd5b('0x21')]=_0x2aaef3;if(_0x157903[_0xdd5b('0x36')][_0xdd5b('0x47')]){_0x564f30[_0xdd5b('0x4f')]=[{'all':!![]}];}return db[_0xdd5b('0x5d')][_0xdd5b('0x48')](_0x564f30);})['then'](function(_0x8e75f8){_0x3f9cad['rows']=_0x8e75f8;return _0x3f9cad;});}})[_0xdd5b('0x27')](respondWithFilteredResult(_0x786ea7,_0x564f30))[_0xdd5b('0x4a')](handleError(_0x786ea7,null));};exports['removeDispositions']=function(_0x25571e,_0x557fd0,_0x339f78){return db['CmList'][_0xdd5b('0x55')]({'where':{'id':_0x25571e['params']['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x557fd0,null))[_0xdd5b('0x27')](function(_0xd8ebab){if(_0xd8ebab){return _0xd8ebab[_0xdd5b('0x5e')](_0x25571e[_0xdd5b('0x36')][_0xdd5b('0x5f')]);}})[_0xdd5b('0x27')](respondWithStatusCode(_0x557fd0,null))['catch'](handleError(_0x557fd0,null));};exports[_0xdd5b('0x60')]=function(_0x36a51b,_0x1a795e,_0xcdf5f6){return db['CmList']['find']({'where':{'id':_0x36a51b[_0xdd5b('0x4c')]['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x1a795e,null))[_0xdd5b('0x27')](function(_0x220537){if(_0x220537){var _0x73cd28=[];var _0x5ebc76={'success':[],'errors':[]};return db[_0xdd5b('0x61')]['describe']()[_0xdd5b('0x27')](function(_0x520eae){if(_0x36a51b['body'][_0xdd5b('0x62')]&&_[_0xdd5b('0x63')](_0x36a51b[_0xdd5b('0x51')][_0xdd5b('0x62')])){if(_0x36a51b[_0xdd5b('0x51')]['tags'][_0xdd5b('0x3b')]){_0x36a51b[_0xdd5b('0x51')]['tags']=_0x36a51b['body'][_0xdd5b('0x62')][_0xdd5b('0x64')](';')+';';}else{_0x36a51b[_0xdd5b('0x51')][_0xdd5b('0x62')]=null;}}else{_0x36a51b['body']['tags']=null;}if(_0x36a51b['body']&&_['isArray'](_0x36a51b['body'])){for(var _0x1f4533=0x0;_0x1f4533<_0x36a51b[_0xdd5b('0x51')]['length'];_0x1f4533+=0x1){_0x36a51b['body'][_0x1f4533]['ListId']=_0x36a51b['params']['id'];_0x73cd28[_0xdd5b('0x65')](_0x36a51b[_0xdd5b('0x51')][_0x1f4533]);}return BPromise['each'](_0x73cd28,function(_0x32c973){return db[_0xdd5b('0x61')][_0xdd5b('0x50')](_[_0xdd5b('0x66')](_0x32c973,[_0xdd5b('0x5f'),'id'])||{},{'fields':_['keys'](_0x520eae),'raw':!![]})[_0xdd5b('0x27')](function(_0x32ebbf){_0x5ebc76['success']['push'](_0x32ebbf[_0xdd5b('0x67')]);})[_0xdd5b('0x4a')](function(_0x5f2d02){_0x5ebc76[_0xdd5b('0x68')][_0xdd5b('0x65')]({'data':_0x32c973,'error':_0x5f2d02['message']});});})[_0xdd5b('0x27')](function(_0x5ccbbb){return _0x5ebc76;})['catch'](function(_0xd2a8bb){return _0xd2a8bb;});}else{_0x1a795e[_0xdd5b('0x1c')](0x190)['json']({'message':_0xdd5b('0x69')});}});}})['then'](respondWithResult(_0x1a795e,null))[_0xdd5b('0x4a')](handleError(_0x1a795e,null));};exports['getContacts']=function(_0x4ec55f,_0x4f1400,_0xfc2dfa){var _0x276c23;return db['CmList'][_0xdd5b('0x55')]({'where':{'id':_0x4ec55f['params']['id']},'include':[{'model':db[_0xdd5b('0x6a')],'as':'CustomFields'}]})[_0xdd5b('0x27')](handleEntityNotFound(_0x4f1400,null))[_0xdd5b('0x27')](function(_0x35e685){if(_0x35e685){_0x276c23=_0x35e685;return db[_0xdd5b('0x61')]['rawAttributes'];}})[_0xdd5b('0x27')](function(_0x107533){if(_0x107533){var _0x58b03b={};var _0x45623b={};_0x45623b[_0xdd5b('0x34')]=_['concat'](_[_0xdd5b('0x37')](_0x107533),_[_0xdd5b('0x35')](_0x276c23[_0xdd5b('0x6b')],function(_0x4b2326){return util[_0xdd5b('0x6c')]('cf_%d',_0x4b2326['id']);}));_0x45623b[_0xdd5b('0x36')]=_['keys'](_0x4ec55f[_0xdd5b('0x36')]);_0x45623b['filters']=_[_0xdd5b('0x4e')](_0x45623b[_0xdd5b('0x34')],_0x45623b[_0xdd5b('0x36')]);_0x58b03b[_0xdd5b('0x39')]=_['intersection'](_0x45623b[_0xdd5b('0x34')],qs[_0xdd5b('0x3a')](_0x4ec55f[_0xdd5b('0x36')]['fields']));_0x58b03b[_0xdd5b('0x39')]=_0x58b03b[_0xdd5b('0x39')][_0xdd5b('0x3b')]?_0x58b03b[_0xdd5b('0x39')]:_0x45623b['model'];if(!_0x4ec55f[_0xdd5b('0x36')][_0xdd5b('0x3c')](_0xdd5b('0x3d'))){_0x58b03b[_0xdd5b('0x20')]=qs[_0xdd5b('0x20')](_0x4ec55f[_0xdd5b('0x36')]['limit']);_0x58b03b[_0xdd5b('0x1e')]=qs[_0xdd5b('0x1e')](_0x4ec55f[_0xdd5b('0x36')][_0xdd5b('0x1e')]);}_0x58b03b['order']=qs['sort'](_0x4ec55f[_0xdd5b('0x36')][_0xdd5b('0x3f')]);_0x58b03b['where']=qs[_0xdd5b('0x38')](_[_0xdd5b('0x41')](_0x4ec55f[_0xdd5b('0x36')],_0x45623b[_0xdd5b('0x38')]));_0x58b03b[_0xdd5b('0x6d')]=!![];if(_0x4ec55f[_0xdd5b('0x36')][_0xdd5b('0x42')]){_0x58b03b['where']=_[_0xdd5b('0x44')](_0x58b03b['where'],{'$or':_['map'](_0x58b03b['attributes'],function(_0x1ed849){var _0x4ddb82={};_0x4ddb82[_0x1ed849]={'$like':'%'+_0x4ec55f[_0xdd5b('0x36')][_0xdd5b('0x42')]+'%'};return _0x4ddb82;})});}_0x58b03b=_[_0xdd5b('0x44')]({},_0x58b03b,_0x4ec55f[_0xdd5b('0x45')]);return _0x276c23[_0xdd5b('0x6e')](_0x58b03b);}})['then'](respondWithResult(_0x4f1400,null))['catch'](handleError(_0x4f1400,null));};exports['getContactsCsv']=function(_0xcb6718,_0x2d9733,_0x39e913){var _0x1cb146;var _0x508d45;var _0x116cd2;var _0x3f2d32=_0xcb6718[_0xdd5b('0x4c')]['id'];csv_results=[];return db[_0xdd5b('0x6f')][_0xdd5b('0x48')]({'attributes':['id','name'],'raw':!![],'order':[_0xdd5b('0x70')]})[_0xdd5b('0x27')](function(_0x3d6b15){_0x1cb146=_0x3d6b15;var _0xa54d97=_[_0xdd5b('0x37')](db[_0xdd5b('0x61')][_0xdd5b('0x4d')]);return db[_0xdd5b('0x6a')][_0xdd5b('0x48')]({'raw':!![],'attributes':['id',_0xdd5b('0x71')]})[_0xdd5b('0x27')](function(_0x1d9366){_0x508d45=_0x1d9366;var _0x156c2d=squel[_0xdd5b('0x72')]()[_0xdd5b('0x3a')](_0xa54d97)['from']('cm_contacts','c')['where'](_0xdd5b('0x73'),_0x3f2d32)['where'](_0xdd5b('0x74'))['distinct']();for(var _0x4c4684=0x0;_0x4c4684<_0x508d45[_0xdd5b('0x3b')];_0x4c4684++){_0x156c2d[_0xdd5b('0x75')](_0xdd5b('0x76')+_0x508d45[_0x4c4684]['id'],'customField_'+_0x508d45[_0x4c4684][_0xdd5b('0x71')]);}for(var _0x4c4684=0x0;_0x4c4684<_0x1cb146[_0xdd5b('0x3b')];_0x4c4684++){_0x156c2d[_0xdd5b('0x75')](squel[_0xdd5b('0x72')]()[_0xdd5b('0x75')](_0xdd5b('0x77'))[_0xdd5b('0x78')](_0xdd5b('0x79'))['where']('ItemTypeId\x20=\x20?',_0x1cb146[_0x4c4684]['id'])[_0xdd5b('0x40')](_0xdd5b('0x7a')),_0xdd5b('0x7b')+_0x1cb146[_0x4c4684][_0xdd5b('0x2e')]);_0x156c2d[_0xdd5b('0x75')](squel[_0xdd5b('0x72')]()[_0xdd5b('0x75')](_0xdd5b('0x7c'))[_0xdd5b('0x78')]('cm_contact_has_items')[_0xdd5b('0x40')]('ItemTypeId\x20=\x20?',_0x1cb146[_0x4c4684]['id'])['where'](_0xdd5b('0x7a')),_0xdd5b('0x7d')+_0x1cb146[_0x4c4684]['name']);}var _0x59d761=[];_0x59d761['push'](_0x156c2d[_0xdd5b('0x7e')]());BPromise[_0xdd5b('0x7f')](_0x59d761,handleQuery)[_0xdd5b('0x27')](function(_0xbe4543){handleQuery(_0x156c2d['toString']());var _0x237b6d=csv_results[0x0];if(!_[_0xdd5b('0x80')](_0x237b6d)){var _0x5b7c6d=toCsv(_0x237b6d);var _0x23739a=Date[_0xdd5b('0x81')]();fs[_0xdd5b('0x82')](util['format']('/tmp/list_%d_%s.csv',_0x3f2d32,_0x23739a),_0x5b7c6d);_0x2d9733[_0xdd5b('0x83')](_0xdd5b('0x84'),_0xdd5b('0x85')+util['format'](_0xdd5b('0x86'),_0x3f2d32,_0x23739a));_0x2d9733['setHeader'](_0xdd5b('0x87'),_0xdd5b('0x88'));return _0x2d9733[_0xdd5b('0x89')](util[_0xdd5b('0x6c')](_0xdd5b('0x8a'),_0x3f2d32,_0x23739a));}else{return _0x2d9733[_0xdd5b('0x1b')](0xcc);}});});});};exports[_0xdd5b('0x8b')]=function(_0xaea343,_0x2e189a,_0x5d1ca3){var _0x3f0350;delete _0xaea343[_0xdd5b('0x51')]['id'];return db[_0xdd5b('0x46')][_0xdd5b('0x5c')]({'where':{'id':_0xaea343['params']['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x2e189a,null))[_0xdd5b('0x27')](function(_0x116dff){if(_0x116dff){return db[_0xdd5b('0x8c')][_0xdd5b('0x8d')](function(_0x2a6cd2){return db[_0xdd5b('0x6a')]['create'](_0xaea343[_0xdd5b('0x51')],{'transaction':_0x2a6cd2})[_0xdd5b('0x27')](function(_0x3afb5e){_0x3f0350=_0x3afb5e;return _0x116dff[_0xdd5b('0x8e')](_0x3afb5e,{'transaction':_0x2a6cd2});})[_0xdd5b('0x27')](function(){var _0x30c689={'type':db[_0xdd5b('0x8f')][_0xdd5b('0x90')],'transaction':_0x2a6cd2};switch(_0xaea343[_0xdd5b('0x51')]['type']){case _0xdd5b('0x91'):_0x30c689[_0xdd5b('0x32')]=db[_0xdd5b('0x8f')][_0xdd5b('0x90')];break;case _0xdd5b('0x92'):_0x30c689['type']=db[_0xdd5b('0x8f')]['INTEGER'];break;case'switch':_0x30c689[_0xdd5b('0x32')]=db[_0xdd5b('0x8f')][_0xdd5b('0x93')];_0x30c689[_0xdd5b('0x94')]=![];break;default:}return db[_0xdd5b('0x8c')][_0xdd5b('0x95')][_0xdd5b('0x96')](_0xdd5b('0x97'),util[_0xdd5b('0x6c')](_0xdd5b('0x98'),_0x3f0350['id']),_0x30c689);})[_0xdd5b('0x27')](function(){return _0x3f0350;});});}})[_0xdd5b('0x27')](respondWithResult(_0x2e189a,null))['catch'](handleError(_0x2e189a,null));};exports['getCustomFields']=function(_0x986687,_0x28957e,_0x3ddd38){var _0x4323da={};var _0x52123a={};var _0x2e5a60;var _0x51b032;return db['CmList']['findOne']({'where':{'id':_0x986687[_0xdd5b('0x4c')]['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x28957e,null))['then'](function(_0x2359ea){if(_0x2359ea){_0x2e5a60=_0x2359ea;_0x52123a[_0xdd5b('0x34')]=_[_0xdd5b('0x37')](db['CmCustomField'][_0xdd5b('0x4d')]);_0x52123a[_0xdd5b('0x36')]=_[_0xdd5b('0x37')](_0x986687[_0xdd5b('0x36')]);_0x52123a[_0xdd5b('0x38')]=_[_0xdd5b('0x4e')](_0x52123a[_0xdd5b('0x34')],_0x52123a[_0xdd5b('0x36')]);_0x4323da[_0xdd5b('0x39')]=_[_0xdd5b('0x4e')](_0x52123a[_0xdd5b('0x34')],qs['fields'](_0x986687[_0xdd5b('0x36')][_0xdd5b('0x3a')]));_0x4323da[_0xdd5b('0x39')]=_0x4323da['attributes']['length']?_0x4323da['attributes']:_0x52123a[_0xdd5b('0x34')];_0x4323da[_0xdd5b('0x3e')]=qs[_0xdd5b('0x3f')](_0x986687[_0xdd5b('0x36')][_0xdd5b('0x3f')]);_0x4323da['where']=qs[_0xdd5b('0x38')](_[_0xdd5b('0x41')](_0x986687[_0xdd5b('0x36')],_0x52123a[_0xdd5b('0x38')]));_0x4323da[_0xdd5b('0x40')]=_[_0xdd5b('0x44')](_0x4323da[_0xdd5b('0x40')],{'$or':[{'ListId':_0x2359ea['id']},{'ListId':null}]});if(_0x986687[_0xdd5b('0x36')][_0xdd5b('0x42')]){_0x4323da[_0xdd5b('0x40')]=_[_0xdd5b('0x44')](_0x4323da[_0xdd5b('0x40')],{'$or':_['map'](_0x4323da[_0xdd5b('0x39')],function(_0x5ea14a){var _0x907269={};_0x907269[_0x5ea14a]={'$like':'%'+_0x986687[_0xdd5b('0x36')][_0xdd5b('0x42')]+'%'};return _0x907269;})});}_0x4323da=_['merge']({},_0x4323da,_0x986687[_0xdd5b('0x45')]);return db[_0xdd5b('0x6a')][_0xdd5b('0x99')](_0x4323da);}})[_0xdd5b('0x27')](respondWithResult(_0x28957e,null))[_0xdd5b('0x4a')](handleError(_0x28957e,null));};exports[_0xdd5b('0x9a')]=function(_0x3e7598,_0x3abf93){return db[_0xdd5b('0x6a')][_0xdd5b('0x99')]({'where':{'ListId':null}})[_0xdd5b('0x27')](handleEntityNotFound(_0x3abf93,null))['then'](function(_0x1dc674){return _0x1dc674;})[_0xdd5b('0x27')](respondWithResult(_0x3abf93,null))[_0xdd5b('0x4a')](handleError(_0x3abf93,null));};exports['addAgents']=function(_0x272614,_0x31c1af,_0x592c08){return db[_0xdd5b('0x46')][_0xdd5b('0x55')]({'where':{'id':_0x272614[_0xdd5b('0x4c')]['id']}})[_0xdd5b('0x27')](handleEntityNotFound(_0x31c1af,null))[_0xdd5b('0x27')](function(_0x276776){if(_0x276776){return _0x276776[_0xdd5b('0x9b')](_0x272614[_0xdd5b('0x51')][_0xdd5b('0x5f')],_[_0xdd5b('0x66')](_0x272614['body'],[_0xdd5b('0x5f'),'id'])||{})['spread'](function(_0x4df4d9){for(var _0x14496a=0x0;_0x14496a<_0x272614[_0xdd5b('0x51')]['ids']['length'];_0x14496a+=0x1){socket[_0xdd5b('0x9c')](_0xdd5b('0x9d'),{'UserId':Number(_0x272614[_0xdd5b('0x51')][_0xdd5b('0x5f')][_0x14496a]),'CmListId':Number(_0x272614[_0xdd5b('0x4c')]['id'])});}return _0x4df4d9;});}})[_0xdd5b('0x27')](respondWithResult(_0x31c1af,null))[_0xdd5b('0x4a')](handleError(_0x31c1af,null));};exports[_0xdd5b('0x9e')]=function(_0x422233,_0x36d463,_0x1c46b0){return db[_0xdd5b('0x46')][_0xdd5b('0x55')]({'where':{'id':_0x422233['params']['id']}})['then'](handleEntityNotFound(_0x36d463,null))[_0xdd5b('0x27')](function(_0x124162){if(_0x124162){return _0x124162[_0xdd5b('0x9e')](_0x422233['query'][_0xdd5b('0x5f')])[_0xdd5b('0x27')](function(){if(_[_0xdd5b('0x63')](_0x422233[_0xdd5b('0x36')][_0xdd5b('0x5f')])){for(var _0x2a548d=0x0;_0x2a548d<_0x422233[_0xdd5b('0x36')][_0xdd5b('0x5f')][_0xdd5b('0x3b')];_0x2a548d+=0x1){socket[_0xdd5b('0x9c')](_0xdd5b('0x9f'),{'UserId':Number(_0x422233[_0xdd5b('0x36')]['ids'][_0x2a548d]),'CmListId':Number(_0x422233[_0xdd5b('0x4c')]['id'])});}}else{socket['emit'](_0xdd5b('0x9f'),{'UserId':Number(_0x422233[_0xdd5b('0x36')]['ids']),'CmListId':Number(_0x422233[_0xdd5b('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x36d463,null))['catch'](handleError(_0x36d463,null));};exports[_0xdd5b('0xa0')]=function(_0x3d7ff6,_0x317294,_0x718c5){var _0x5f3166={};var _0x34b479={};var _0x1c3524;var _0x33ff95;return db[_0xdd5b('0x46')][_0xdd5b('0x5c')]({'where':{'id':_0x3d7ff6[_0xdd5b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x317294,null))[_0xdd5b('0x27')](function(_0x3f010b){if(_0x3f010b){_0x1c3524=_0x3f010b;_0x34b479[_0xdd5b('0x34')]=_[_0xdd5b('0x37')](db[_0xdd5b('0xa1')][_0xdd5b('0x4d')]);_0x34b479[_0xdd5b('0x36')]=_[_0xdd5b('0x37')](_0x3d7ff6[_0xdd5b('0x36')]);_0x34b479[_0xdd5b('0x38')]=_[_0xdd5b('0x4e')](_0x34b479['model'],_0x34b479[_0xdd5b('0x36')]);_0x5f3166[_0xdd5b('0x39')]=_['intersection'](_0x34b479[_0xdd5b('0x34')],qs['fields'](_0x3d7ff6[_0xdd5b('0x36')][_0xdd5b('0x3a')]));_0x5f3166[_0xdd5b('0x39')]=_0x5f3166[_0xdd5b('0x39')][_0xdd5b('0x3b')]?_0x5f3166['attributes']:_0x34b479[_0xdd5b('0x34')];_0x5f3166[_0xdd5b('0x3e')]=qs[_0xdd5b('0x3f')](_0x3d7ff6[_0xdd5b('0x36')][_0xdd5b('0x3f')]);_0x5f3166[_0xdd5b('0x40')]=qs['filters'](_[_0xdd5b('0x41')](_0x3d7ff6['query'],_0x34b479['filters']));if(_0x3d7ff6[_0xdd5b('0x36')][_0xdd5b('0x42')]){_0x5f3166[_0xdd5b('0x40')]=_[_0xdd5b('0x44')](_0x5f3166['where'],{'$or':_[_0xdd5b('0x35')](_0x5f3166['attributes'],function(_0x1cc1e7){var _0x243750={};_0x243750[_0x1cc1e7]={'$like':'%'+_0x3d7ff6['query']['filter']+'%'};return _0x243750;})});}_0x5f3166=_['merge']({},_0x5f3166,_0x3d7ff6[_0xdd5b('0x45')]);return _0x1c3524[_0xdd5b('0xa0')](_0x5f3166);}})[_0xdd5b('0x27')](function(_0x48a856){if(_0x48a856){_0x33ff95=_0x48a856[_0xdd5b('0x3b')];if(!_0x3d7ff6['query'][_0xdd5b('0x3c')](_0xdd5b('0x3d'))){_0x5f3166[_0xdd5b('0x20')]=qs['limit'](_0x3d7ff6['query']['limit']);_0x5f3166[_0xdd5b('0x1e')]=qs[_0xdd5b('0x1e')](_0x3d7ff6[_0xdd5b('0x36')][_0xdd5b('0x1e')]);}return _0x1c3524['getAgents'](_0x5f3166);}})[_0xdd5b('0x27')](function(_0x3afdec){if(_0x3afdec){return _0x3afdec?{'count':_0x33ff95,'rows':_0x3afdec}:null;}})[_0xdd5b('0x27')](respondWithResult(_0x317294,null))[_0xdd5b('0x4a')](handleError(_0x317294,null));};function handleQuery(_0x35b5a5){logger['info'](_0x35b5a5);return db['sequelize']['query'](_0x35b5a5)[_0xdd5b('0xa2')](function(_0x2c28d6){csv_results['push'](_0x2c28d6);})[_0xdd5b('0x4a')](function(_0x31028f){logger[_0xdd5b('0x2c')](_0x31028f['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9c70dd5..9801466 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x12669f,_0x7c3655){_0x12669f=_0x12669f-0x0;var _0x557333=_0x3e74[_0x12669f];return _0x557333;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x7248cb,_0x2ddd25){var _0x5a6f98=function(_0x1cd082){while(--_0x1cd082){_0x7248cb['push'](_0x7248cb['shift']());}};_0x5a6f98(++_0x2ddd25);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index afaacd1..73721f2 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0x502af7,_0x5d7021){var _0x15d611=function(_0x1bbbe3){while(--_0x1bbbe3){_0x502af7['push'](_0x502af7['shift']());}};_0x15d611(++_0x5d7021);}(_0xaa88,0x137));var _0x8aa8=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xaa88[_0xf51c06];return _0x1d5420;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x4117fe,_0x4b8b91){var _0x1194e0=function(_0x24ba5f){while(--_0x24ba5f){_0x4117fe['push'](_0x4117fe['shift']());}};_0x1194e0(++_0x4b8b91);}(_0x99e9,0xb4));var _0x999e=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x99e9[_0x1e172a];return _0x96338b;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index b2d5dce..78a085e 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 _0xed2f=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0xed2f,0x94));var _0xfed2=function(_0x1057e3,_0x4d6170){_0x1057e3=_0x1057e3-0x0;var _0x229c0e=_0xed2f[_0x1057e3];return _0x229c0e;};'use strict';var _=require(_0xfed2('0x0'));var util=require('util');var moment=require(_0xfed2('0x1'));var BPromise=require(_0xfed2('0x2'));var rs=require(_0xfed2('0x3'));var fs=require('fs');var Redis=require(_0xfed2('0x4'));var db=require(_0xfed2('0x5'))['db'];var utils=require(_0xfed2('0x6'));var logger=require('../../config/logger')(_0xfed2('0x7'));var config=require(_0xfed2('0x8'));var jayson=require(_0xfed2('0x9'));var client=jayson[_0xfed2('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xfed2('0xb')],{'host':_0xfed2('0xc'),'port':0x18eb});var socket=require(_0xfed2('0xd'))(new Redis(config[_0xfed2('0xb')]));require('./cmList.socket')[_0xfed2('0xe')](socket);function respondWithRpcPromise(_0x3f51b7,_0x2b33c9,_0x4b034e){return new BPromise(function(_0x3107e0,_0x1b5228){return client['request'](_0x3f51b7,_0x4b034e)[_0xfed2('0xf')](function(_0x4409c5){logger[_0xfed2('0x10')](_0xfed2('0x11'),_0x2b33c9,_0xfed2('0x12'));logger[_0xfed2('0x13')](_0xfed2('0x14'),_0x2b33c9,_0xfed2('0x12'),JSON['stringify'](_0x4409c5));if(_0x4409c5[_0xfed2('0x15')]){if(_0x4409c5[_0xfed2('0x15')][_0xfed2('0x16')]===0x1f4){logger[_0xfed2('0x15')](_0xfed2('0x11'),_0x2b33c9,_0x4409c5[_0xfed2('0x15')][_0xfed2('0x17')]);return _0x1b5228(_0x4409c5[_0xfed2('0x15')]['message']);}logger[_0xfed2('0x15')](_0xfed2('0x11'),_0x2b33c9,_0x4409c5[_0xfed2('0x15')]['message']);return _0x3107e0(_0x4409c5[_0xfed2('0x15')][_0xfed2('0x17')]);}else{logger[_0xfed2('0x10')](_0xfed2('0x11'),_0x2b33c9,_0xfed2('0x12'));_0x3107e0(_0x4409c5[_0xfed2('0x18')][_0xfed2('0x17')]);}})[_0xfed2('0x19')](function(_0xfff310){logger['error'](_0xfed2('0x11'),_0x2b33c9,_0xfff310);_0x1b5228(_0xfff310);});});} \ No newline at end of file +var _0xa85e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2cbde2,_0x94a41b){var _0x59b340=function(_0x4a7ec5){while(--_0x4a7ec5){_0x2cbde2['push'](_0x2cbde2['shift']());}};_0x59b340(++_0x94a41b);}(_0xa85e,0x154));var _0xea85=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xa85e[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0xea85('0x0'));var util=require(_0xea85('0x1'));var moment=require(_0xea85('0x2'));var BPromise=require(_0xea85('0x3'));var rs=require(_0xea85('0x4'));var fs=require('fs');var Redis=require(_0xea85('0x5'));var db=require(_0xea85('0x6'))['db'];var utils=require(_0xea85('0x7'));var logger=require(_0xea85('0x8'))(_0xea85('0x9'));var config=require(_0xea85('0xa'));var jayson=require(_0xea85('0xb'));var client=jayson[_0xea85('0xc')][_0xea85('0xd')]({'port':0x232a});config['redis']=_[_0xea85('0xe')](config[_0xea85('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xea85('0x10'))(new Redis(config[_0xea85('0xf')]));require(_0xea85('0x11'))[_0xea85('0x12')](socket);function respondWithRpcPromise(_0x4f320e,_0xca68b1,_0x2060e9){return new BPromise(function(_0x15a059,_0x4fa78d){return client[_0xea85('0x13')](_0x4f320e,_0x2060e9)['then'](function(_0x23b8fe){logger[_0xea85('0x14')](_0xea85('0x15'),_0xca68b1,_0xea85('0x16'));logger[_0xea85('0x17')](_0xea85('0x18'),_0xca68b1,_0xea85('0x16'),JSON[_0xea85('0x19')](_0x23b8fe));if(_0x23b8fe[_0xea85('0x1a')]){if(_0x23b8fe[_0xea85('0x1a')][_0xea85('0x1b')]===0x1f4){logger[_0xea85('0x1a')](_0xea85('0x15'),_0xca68b1,_0x23b8fe['error'][_0xea85('0x1c')]);return _0x4fa78d(_0x23b8fe['error'][_0xea85('0x1c')]);}logger[_0xea85('0x1a')](_0xea85('0x15'),_0xca68b1,_0x23b8fe[_0xea85('0x1a')]['message']);return _0x15a059(_0x23b8fe[_0xea85('0x1a')][_0xea85('0x1c')]);}else{logger[_0xea85('0x14')](_0xea85('0x15'),_0xca68b1,'request\x20sent');_0x15a059(_0x23b8fe[_0xea85('0x1d')][_0xea85('0x1c')]);}})[_0xea85('0x1e')](function(_0x4baf53){logger[_0xea85('0x1a')](_0xea85('0x15'),_0xca68b1,_0x4baf53);_0x4fa78d(_0x4baf53);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 9a6e384..745a28d 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 _0xe3fd=['emit','removeListener','register','length','cmList:','./cmList.events','remove'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xe3fd,0x155));var _0xde3f=function(_0x12b334,_0xaa7509){_0x12b334=_0x12b334-0x0;var _0x1c6f03=_0xe3fd[_0x12b334];return _0x1c6f03;};'use strict';var CmListEvents=require(_0xde3f('0x0'));var events=['save',_0xde3f('0x1'),'update'];function createListener(_0x3e9122,_0x55eee1){return function(_0x3df2b3){_0x55eee1[_0xde3f('0x2')](_0x3e9122,_0x3df2b3);};}function removeListener(_0xd2fdff,_0x541041){return function(){CmListEvents[_0xde3f('0x3')](_0xd2fdff,_0x541041);};}exports[_0xde3f('0x4')]=function(_0x275800){for(var _0x652265=0x0,_0x122bca=events[_0xde3f('0x5')];_0x652265<_0x122bca;_0x652265++){var _0x29de0c=events[_0x652265];var _0x36e08c=createListener(_0xde3f('0x6')+_0x29de0c,_0x275800);CmListEvents['on'](_0x29de0c,_0x36e08c);}}; \ No newline at end of file +var _0xd98a=['save','remove','update','removeListener','register','length'];(function(_0x2d725f,_0x1af9d6){var _0x405482=function(_0x245ba6){while(--_0x245ba6){_0x2d725f['push'](_0x2d725f['shift']());}};_0x405482(++_0x1af9d6);}(_0xd98a,0xf6));var _0xad98=function(_0x4539b6,_0x1643c9){_0x4539b6=_0x4539b6-0x0;var _0x5bb0c4=_0xd98a[_0x4539b6];return _0x5bb0c4;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xad98('0x0'),_0xad98('0x1'),_0xad98('0x2')];function createListener(_0x2d3582,_0x493539){return function(_0x12ac30){_0x493539['emit'](_0x2d3582,_0x12ac30);};}function removeListener(_0x1339e1,_0x4f8ed5){return function(){CmListEvents[_0xad98('0x3')](_0x1339e1,_0x4f8ed5);};}exports[_0xad98('0x4')]=function(_0x5de12c){for(var _0x518e62=0x0,_0x47d062=events[_0xad98('0x5')];_0x518e62<_0x47d062;_0x518e62++){var _0xe95134=events[_0x518e62];var _0x3d60d7=createListener('cmList:'+_0xe95134,_0x5de12c);CmListEvents['on'](_0xe95134,_0x3d60d7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d01e959..e5e53e8 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 _0x6731=['getContacts','/:id/contacts/csv','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','getDispositions','/:id/contacts'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x6731,0x80));var _0x1673=function(_0x171520,_0x1cee8c){_0x171520=_0x171520-0x0;var _0x3cc729=_0x6731[_0x171520];return _0x3cc729;};'use strict';var multer=require(_0x1673('0x0'));var util=require(_0x1673('0x1'));var path=require(_0x1673('0x2'));var timeout=require(_0x1673('0x3'));var express=require(_0x1673('0x4'));var router=express['Router']();var fs_extra=require(_0x1673('0x5'));var auth=require(_0x1673('0x6'));var interaction=require(_0x1673('0x7'));var config=require(_0x1673('0x8'));var controller=require(_0x1673('0x9'));router[_0x1673('0xa')]('/',auth[_0x1673('0xb')](),controller[_0x1673('0xc')]);router[_0x1673('0xa')](_0x1673('0xd'),auth['isAuthenticated'](),controller[_0x1673('0xe')]);router[_0x1673('0xa')](_0x1673('0xf'),auth['isAuthenticated'](),controller[_0x1673('0x10')]);router['get'](_0x1673('0x11'),auth[_0x1673('0xb')](),controller['show']);router[_0x1673('0xa')]('/:id/dispositions',auth[_0x1673('0xb')](),controller[_0x1673('0x12')]);router[_0x1673('0xa')](_0x1673('0x13'),auth['isAuthenticated'](),controller[_0x1673('0x14')]);router[_0x1673('0xa')](_0x1673('0x15'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x1673('0xa')]('/:id/fields',auth[_0x1673('0xb')](),controller['getCustomFields']);router['get'](_0x1673('0x16'),auth[_0x1673('0xb')](),controller[_0x1673('0x17')]);router[_0x1673('0x18')]('/',auth[_0x1673('0xb')](),controller['create']);router[_0x1673('0x18')](_0x1673('0x19'),auth[_0x1673('0xb')](),controller[_0x1673('0x1a')]);router[_0x1673('0x18')](_0x1673('0x13'),auth[_0x1673('0xb')](),controller[_0x1673('0x1b')]);router[_0x1673('0x18')](_0x1673('0x1c'),auth[_0x1673('0xb')](),controller[_0x1673('0x1d')]);router['post'](_0x1673('0x16'),auth['isAuthenticated'](),controller[_0x1673('0x1e')]);router[_0x1673('0x1f')](_0x1673('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1673('0x20')](_0x1673('0x11'),auth['isAuthenticated'](),controller[_0x1673('0x21')]);router[_0x1673('0x20')](_0x1673('0x19'),auth[_0x1673('0xb')](),controller[_0x1673('0x22')]);router[_0x1673('0x20')](_0x1673('0x16'),auth[_0x1673('0xb')](),controller[_0x1673('0x23')]);module[_0x1673('0x24')]=router; \ No newline at end of file +var _0x2a31=['isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get'];(function(_0x599c68,_0x30d4c3){var _0x2166a6=function(_0x4eb5f3){while(--_0x4eb5f3){_0x599c68['push'](_0x599c68['shift']());}};_0x2166a6(++_0x30d4c3);}(_0x2a31,0xe4));var _0x12a3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2a31[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x12a3('0x0'));var util=require(_0x12a3('0x1'));var path=require(_0x12a3('0x2'));var timeout=require(_0x12a3('0x3'));var express=require(_0x12a3('0x4'));var router=express[_0x12a3('0x5')]();var fs_extra=require(_0x12a3('0x6'));var auth=require(_0x12a3('0x7'));var interaction=require(_0x12a3('0x8'));var config=require(_0x12a3('0x9'));var controller=require(_0x12a3('0xa'));router[_0x12a3('0xb')]('/',auth[_0x12a3('0xc')](),controller[_0x12a3('0xd')]);router['get'](_0x12a3('0xe'),auth['isAuthenticated'](),controller[_0x12a3('0xf')]);router['get'](_0x12a3('0x10'),auth['isAuthenticated'](),controller[_0x12a3('0x11')]);router['get'](_0x12a3('0x12'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x13')]);router['get']('/:id/dispositions',auth[_0x12a3('0xc')](),controller[_0x12a3('0x14')]);router[_0x12a3('0xb')](_0x12a3('0x15'),auth['isAuthenticated'](),controller['getContacts']);router[_0x12a3('0xb')]('/:id/contacts/csv',auth[_0x12a3('0xc')](),controller[_0x12a3('0x16')]);router['get'](_0x12a3('0x17'),auth[_0x12a3('0xc')](),controller['getCustomFields']);router['get'](_0x12a3('0x18'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x19')]);router[_0x12a3('0x1a')]('/',auth[_0x12a3('0xc')](),controller[_0x12a3('0x1b')]);router[_0x12a3('0x1a')](_0x12a3('0x1c'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x1d')]);router[_0x12a3('0x1a')](_0x12a3('0x15'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x1e')]);router[_0x12a3('0x1a')](_0x12a3('0x17'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x1f')]);router[_0x12a3('0x1a')](_0x12a3('0x18'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x20')]);router[_0x12a3('0x21')]('/:id',auth[_0x12a3('0xc')](),controller[_0x12a3('0x22')]);router[_0x12a3('0x23')](_0x12a3('0x12'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x24')]);router['delete']('/:id/dispositions',auth[_0x12a3('0xc')](),controller[_0x12a3('0x25')]);router[_0x12a3('0x23')](_0x12a3('0x18'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x26')]);module[_0x12a3('0x27')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 13377f7..74f6237 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 _0x2498=['field','STRING','exports','getDataValue'];(function(_0xbf757d,_0x4791e4){var _0x139f7f=function(_0x4e2a55){while(--_0x4e2a55){_0xbf757d['push'](_0xbf757d['shift']());}};_0x139f7f(++_0x4791e4);}(_0x2498,0x1ea));var _0x8249=function(_0x31e339,_0x234324){_0x31e339=_0x31e339-0x0;var _0x326da1=_0x2498[_0x31e339];return _0x326da1;};'use strict';var Sequelize=require('sequelize');module[_0x8249('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xfb7f6a){return this[_0x8249('0x1')](_0x8249('0x2'));}},'field':{'type':Sequelize[_0x8249('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x8249('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x8249('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xfdf1=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x41f2f5,_0x14f33c){var _0x3d49f1=function(_0x300207){while(--_0x300207){_0x41f2f5['push'](_0x41f2f5['shift']());}};_0x3d49f1(++_0x14f33c);}(_0xfdf1,0x1e3));var _0x1fdf=function(_0x2aa983,_0x5363e8){_0x2aa983=_0x2aa983-0x0;var _0xdc4cdc=_0xfdf1[_0x2aa983];return _0xdc4cdc;};'use strict';var Sequelize=require(_0x1fdf('0x0'));module[_0x1fdf('0x1')]={'name':{'type':Sequelize[_0x1fdf('0x2')],'get':function(_0x51330b){return this[_0x1fdf('0x3')]('field');}},'field':{'type':Sequelize[_0x1fdf('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b490df4..fc01fe0 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x262564,_0x52901a){var _0x400b01=function(_0x18a208){while(--_0x18a208){_0x262564['push'](_0x262564['shift']());}};_0x400b01(++_0x52901a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4d80e0,_0x39ee8c){var _0xcd86e1=function(_0x595f30){while(--_0x595f30){_0x4d80e0['push'](_0x4d80e0['shift']());}};_0xcd86e1(++_0x39ee8c);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 17dcaec..0391581 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 _0x846b=['path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x846b,0x133));var _0xb846=function(_0x3e9ada,_0x4d74f7){_0x3e9ada=_0x3e9ada-0x0;var _0x2f9657=_0x846b[_0x3e9ada];return _0x2f9657;};'use strict';var _=require(_0xb846('0x0'));var util=require(_0xb846('0x1'));var logger=require(_0xb846('0x2'))(_0xb846('0x3'));var moment=require('moment');var BPromise=require(_0xb846('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb846('0x5'));var rimraf=require(_0xb846('0x6'));var config=require(_0xb846('0x7'));var attributes=require(_0xb846('0x8'));module[_0xb846('0x9')]=function(_0x17d725,_0x46e969){return _0x17d725[_0xb846('0xa')](_0xb846('0xb'),attributes,{'tableName':_0xb846('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x531c=['util','../../config/logger','api','moment','bluebird','rimraf','./condition.attributes','exports','define','tools_conditions','lodash'];(function(_0x1f7996,_0x299a14){var _0x584609=function(_0x14c34a){while(--_0x14c34a){_0x1f7996['push'](_0x1f7996['shift']());}};_0x584609(++_0x299a14);}(_0x531c,0xa4));var _0xc531=function(_0x24161e,_0x5e3d59){_0x24161e=_0x24161e-0x0;var _0x49fb89=_0x531c[_0x24161e];return _0x49fb89;};'use strict';var _=require(_0xc531('0x0'));var util=require(_0xc531('0x1'));var logger=require(_0xc531('0x2'))(_0xc531('0x3'));var moment=require(_0xc531('0x4'));var BPromise=require(_0xc531('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc531('0x6'));var config=require('../../config/environment');var attributes=require(_0xc531('0x7'));module[_0xc531('0x8')]=function(_0x4800c7,_0xf803c1){return _0x4800c7[_0xc531('0x9')]('Condition',attributes,{'tableName':_0xc531('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 942c7df..13b737c 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 _0x351a=['rpc','../../config/environment','client','request','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x15c8f4,_0x2e30ac){var _0x55de76=function(_0xde92a0){while(--_0xde92a0){_0x15c8f4['push'](_0x15c8f4['shift']());}};_0x55de76(++_0x2e30ac);}(_0x351a,0x11b));var _0xa351=function(_0x5f23f2,_0x476d21){_0x5f23f2=_0x5f23f2-0x0;var _0x4332d3=_0x351a[_0x5f23f2];return _0x4332d3;};'use strict';var _=require(_0xa351('0x0'));var util=require('util');var moment=require(_0xa351('0x1'));var BPromise=require(_0xa351('0x2'));var rs=require(_0xa351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa351('0x5'))(_0xa351('0x6'));var config=require(_0xa351('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa351('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x127f51,_0xb8a0ef,_0x43dcd4){return new BPromise(function(_0x21ed16,_0x1bbc59){return client[_0xa351('0x9')](_0x127f51,_0x43dcd4)['then'](function(_0x3c6d75){logger['info'](_0xa351('0xa'),_0xb8a0ef,_0xa351('0xb'));logger[_0xa351('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0xb8a0ef,_0xa351('0xb'),JSON[_0xa351('0xd')](_0x3c6d75));if(_0x3c6d75['error']){if(_0x3c6d75['error'][_0xa351('0xe')]===0x1f4){logger[_0xa351('0xf')](_0xa351('0xa'),_0xb8a0ef,_0x3c6d75[_0xa351('0xf')]['message']);return _0x1bbc59(_0x3c6d75[_0xa351('0xf')][_0xa351('0x10')]);}logger['error'](_0xa351('0xa'),_0xb8a0ef,_0x3c6d75[_0xa351('0xf')][_0xa351('0x10')]);return _0x21ed16(_0x3c6d75['error'][_0xa351('0x10')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xb8a0ef,_0xa351('0xb'));_0x21ed16(_0x3c6d75['result']['message']);}})['catch'](function(_0x7c8a72){logger[_0xa351('0xf')]('Condition,\x20%s,\x20%s',_0xb8a0ef,_0x7c8a72);_0x1bbc59(_0x7c8a72);});});} \ No newline at end of file +var _0x976b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','stringify','error','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32753a,_0x313eff){var _0x5cc638=function(_0x87e14c){while(--_0x87e14c){_0x32753a['push'](_0x32753a['shift']());}};_0x5cc638(++_0x313eff);}(_0x976b,0xec));var _0xb976=function(_0x36163d,_0x243b96){_0x36163d=_0x36163d-0x0;var _0x17189f=_0x976b[_0x36163d];return _0x17189f;};'use strict';var _=require(_0xb976('0x0'));var util=require(_0xb976('0x1'));var moment=require('moment');var BPromise=require(_0xb976('0x2'));var rs=require(_0xb976('0x3'));var fs=require('fs');var Redis=require(_0xb976('0x4'));var db=require(_0xb976('0x5'))['db'];var utils=require(_0xb976('0x6'));var logger=require(_0xb976('0x7'))(_0xb976('0x8'));var config=require(_0xb976('0x9'));var jayson=require(_0xb976('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x404480,_0x9a53c4,_0x525f4a){return new BPromise(function(_0x4eb440,_0x12b40d){return client[_0xb976('0xb')](_0x404480,_0x525f4a)[_0xb976('0xc')](function(_0x28ac18){logger['info']('Condition,\x20%s,\x20%s',_0x9a53c4,_0xb976('0xd'));logger[_0xb976('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x9a53c4,_0xb976('0xd'),JSON[_0xb976('0xf')](_0x28ac18));if(_0x28ac18[_0xb976('0x10')]){if(_0x28ac18['error']['code']===0x1f4){logger[_0xb976('0x10')](_0xb976('0x11'),_0x9a53c4,_0x28ac18[_0xb976('0x10')]['message']);return _0x12b40d(_0x28ac18[_0xb976('0x10')][_0xb976('0x12')]);}logger[_0xb976('0x10')](_0xb976('0x11'),_0x9a53c4,_0x28ac18[_0xb976('0x10')][_0xb976('0x12')]);return _0x4eb440(_0x28ac18['error'][_0xb976('0x12')]);}else{logger[_0xb976('0x13')](_0xb976('0x11'),_0x9a53c4,_0xb976('0xd'));_0x4eb440(_0x28ac18[_0xb976('0x14')][_0xb976('0x12')]);}})[_0xb976('0x15')](function(_0x186bd5){logger[_0xb976('0x10')](_0xb976('0x11'),_0x9a53c4,_0x186bd5);_0x12b40d(_0x186bd5);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c75d7e0..13bdceb 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 _0x2e6b=['./condition.controller','put','isAuthenticated','update','delete','/:id','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1365de,_0x25ae33){var _0x5d8d82=function(_0x285c6e){while(--_0x285c6e){_0x1365de['push'](_0x1365de['shift']());}};_0x5d8d82(++_0x25ae33);}(_0x2e6b,0xf0));var _0xb2e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2e6b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb2e6('0x0'));var util=require('util');var path=require(_0xb2e6('0x1'));var timeout=require(_0xb2e6('0x2'));var express=require(_0xb2e6('0x3'));var router=express['Router']();var fs_extra=require(_0xb2e6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2e6('0x5'));var config=require(_0xb2e6('0x6'));var controller=require(_0xb2e6('0x7'));router[_0xb2e6('0x8')]('/:id',auth[_0xb2e6('0x9')](),controller[_0xb2e6('0xa')]);router[_0xb2e6('0xb')](_0xb2e6('0xc'),auth[_0xb2e6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd5d4=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','put','isAuthenticated','delete','/:id','destroy','exports'];(function(_0x4a0dd9,_0x1176a8){var _0x50d5db=function(_0x2bff4c){while(--_0x2bff4c){_0x4a0dd9['push'](_0x4a0dd9['shift']());}};_0x50d5db(++_0x1176a8);}(_0xd5d4,0xfc));var _0x4d5d=function(_0xf32c6d,_0x372704){_0xf32c6d=_0xf32c6d-0x0;var _0x156c11=_0xd5d4[_0xf32c6d];return _0x156c11;};'use strict';var multer=require(_0x4d5d('0x0'));var util=require(_0x4d5d('0x1'));var path=require(_0x4d5d('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d5d('0x3'));var router=express[_0x4d5d('0x4')]();var fs_extra=require(_0x4d5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4d5d('0x6'));var config=require(_0x4d5d('0x7'));var controller=require('./condition.controller');router[_0x4d5d('0x8')]('/:id',auth[_0x4d5d('0x9')](),controller['update']);router[_0x4d5d('0xa')](_0x4d5d('0xb'),auth['isAuthenticated'](),controller[_0x4d5d('0xc')]);module[_0x4d5d('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 10ffeef..ecb822e 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 _0x5492=['STRING','name'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x5492,0xf8));var _0x2549=function(_0x58fda5,_0x37289a){_0x58fda5=_0x58fda5-0x0;var _0x360f53=_0x5492[_0x58fda5];return _0x360f53;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2549('0x0')],'allowNull':![],'unique':_0x2549('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x2549('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xa250=['STRING','INTEGER','exports'];(function(_0x444473,_0x4b290b){var _0x6ddea9=function(_0x47e226){while(--_0x47e226){_0x444473['push'](_0x444473['shift']());}};_0x6ddea9(++_0x4b290b);}(_0xa250,0xb0));var _0x0a25=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0xa250[_0x54b062];return _0x255e41;};'use strict';var Sequelize=require('sequelize');module[_0x0a25('0x0')]={'name':{'type':Sequelize[_0x0a25('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x0a25('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0a25('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 caa3db8..a3f5da0 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 _0xd7d1=['autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x1034d1,_0x1d7763){var _0x1ee718=function(_0x3d5fc5){while(--_0x3d5fc5){_0x1034d1['push'](_0x1034d1['shift']());}};_0x1ee718(++_0x1d7763);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x59f8eb,_0x28ecd5){_0x59f8eb=_0x59f8eb-0x0;var _0x27abfa=_0xd7d1[_0x59f8eb];return _0x27abfa;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file +var _0x5b12=['request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','get','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','map','query','keys','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','intersection','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x1ffcfd,_0x45c002){var _0x70f802=function(_0x396752){while(--_0x396752){_0x1ffcfd['push'](_0x1ffcfd['shift']());}};_0x70f802(++_0x45c002);}(_0x5b12,0xa3));var _0x25b1=function(_0x384428,_0x485561){_0x384428=_0x384428-0x0;var _0x19ef5e=_0x5b12[_0x384428];return _0x19ef5e;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){var _0x3fa043=_0x246acd[_0x25b1('0x24')]({'plain':!![]});var _0xd22469=_0x25b1('0x25');return db[_0x25b1('0x26')][_0x25b1('0x23')]({'where':{'type':_0xd22469,'resourceId':_0x3fa043['id']}})['then'](function(){return _0x246acd;});})[_0x25b1('0x27')](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0x5bc8fc,_0x20a218){return function(_0x9e175f){if(!_0x9e175f){_0x5bc8fc[_0x25b1('0x19')](0x194);}return _0x9e175f;};}function handleError(_0x584357,_0x33baed){_0x33baed=_0x33baed||0x1f4;return function(_0x54ce2d){logger[_0x25b1('0x28')](_0x54ce2d[_0x25b1('0x29')]);if(_0x54ce2d[_0x25b1('0x2a')]){delete _0x54ce2d[_0x25b1('0x2a')];}_0x584357[_0x25b1('0x1a')](_0x33baed)[_0x25b1('0x2b')](_0x54ce2d);};}exports[_0x25b1('0x2c')]=function(_0x4cd825,_0x30d455){var _0xca56f0={},_0x925e99={},_0x26f323={'count':0x0,'rows':[]};var _0x274205=_['map'](db[_0x25b1('0x2d')][_0x25b1('0x2e')],function(_0x42441d){return{'name':_0x42441d[_0x25b1('0x2f')],'type':_0x42441d[_0x25b1('0x30')]['key']};});_0x925e99['model']=_[_0x25b1('0x31')](_0x274205,'name');_0x925e99[_0x25b1('0x32')]=_[_0x25b1('0x33')](_0x4cd825[_0x25b1('0x32')]);_0x925e99['filters']=_['intersection'](_0x925e99[_0x25b1('0x34')],_0x925e99[_0x25b1('0x32')]);_0xca56f0[_0x25b1('0x35')]=_['intersection'](_0x925e99[_0x25b1('0x34')],qs[_0x25b1('0x36')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x36')]));_0xca56f0['attributes']=_0xca56f0[_0x25b1('0x35')][_0x25b1('0x37')]?_0xca56f0[_0x25b1('0x35')]:_0x925e99['model'];if(!_0x4cd825['query'][_0x25b1('0x38')]('nolimit')){_0xca56f0[_0x25b1('0x39')]=qs[_0x25b1('0x39')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x39')]);_0xca56f0[_0x25b1('0x1e')]=qs[_0x25b1('0x1e')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x1e')]);}_0xca56f0[_0x25b1('0x3a')]=qs[_0x25b1('0x3b')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x3b')]);_0xca56f0[_0x25b1('0x3c')]=qs[_0x25b1('0x3d')](_[_0x25b1('0x3e')](_0x4cd825['query'],_0x925e99[_0x25b1('0x3d')]),_0x274205);if(_0x4cd825[_0x25b1('0x32')]['filter']){_0xca56f0[_0x25b1('0x3c')]=_[_0x25b1('0x3f')](_0xca56f0[_0x25b1('0x3c')],{'$or':_[_0x25b1('0x31')](_0x274205,function(_0xb82930){if(_0xb82930['type']!==_0x25b1('0x40')){var _0x5c729d={};_0x5c729d[_0xb82930[_0x25b1('0x2a')]]={'$like':'%'+_0x4cd825['query'][_0x25b1('0x41')]+'%'};return _0x5c729d;}})});}_0xca56f0=_[_0x25b1('0x3f')]({},_0xca56f0,_0x4cd825[_0x25b1('0x42')]);var _0x454eac={'where':_0xca56f0[_0x25b1('0x3c')]};return db[_0x25b1('0x2d')][_0x25b1('0x1d')](_0x454eac)[_0x25b1('0x27')](function(_0x3f9754){_0x26f323['count']=_0x3f9754;if(_0x4cd825[_0x25b1('0x32')]['includeAll']){_0xca56f0[_0x25b1('0x43')]=[{'all':!![]}];}return db[_0x25b1('0x2d')]['findAll'](_0xca56f0);})[_0x25b1('0x27')](function(_0x39b4c7){_0x26f323[_0x25b1('0x44')]=_0x39b4c7;return _0x26f323;})[_0x25b1('0x27')](respondWithFilteredResult(_0x30d455,_0xca56f0))[_0x25b1('0x45')](handleError(_0x30d455,null));};exports[_0x25b1('0x46')]=function(_0x122ce4,_0x30ee65){var _0x33e39c={'raw':!![],'where':{'id':_0x122ce4[_0x25b1('0x47')]['id']}},_0x453352={};_0x453352[_0x25b1('0x34')]=_[_0x25b1('0x33')](db[_0x25b1('0x2d')][_0x25b1('0x2e')]);_0x453352[_0x25b1('0x32')]=_[_0x25b1('0x33')](_0x122ce4[_0x25b1('0x32')]);_0x453352['filters']=_['intersection'](_0x453352['model'],_0x453352[_0x25b1('0x32')]);_0x33e39c['attributes']=_[_0x25b1('0x48')](_0x453352['model'],qs[_0x25b1('0x36')](_0x122ce4[_0x25b1('0x32')][_0x25b1('0x36')]));_0x33e39c[_0x25b1('0x35')]=_0x33e39c[_0x25b1('0x35')][_0x25b1('0x37')]?_0x33e39c['attributes']:_0x453352[_0x25b1('0x34')];if(_0x122ce4[_0x25b1('0x32')][_0x25b1('0x49')]){_0x33e39c[_0x25b1('0x43')]=[{'all':!![]}];}_0x33e39c=_['merge']({},_0x33e39c,_0x122ce4[_0x25b1('0x42')]);return db[_0x25b1('0x2d')][_0x25b1('0x4a')](_0x33e39c)['then'](handleEntityNotFound(_0x30ee65,null))[_0x25b1('0x27')](respondWithResult(_0x30ee65,null))['catch'](handleError(_0x30ee65,null));};exports[_0x25b1('0x4b')]=function(_0x4b6181,_0x543f9b){return db[_0x25b1('0x2d')][_0x25b1('0x4b')](_0x4b6181[_0x25b1('0x4c')],{})[_0x25b1('0x27')](function(_0x5de62e){var _0x2b38ca=_0x4b6181['user'][_0x25b1('0x24')]({'plain':!![]});if(!_0x2b38ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b38ca[_0x25b1('0x4d')]===_0x25b1('0x4e')){var _0x1fcc79=_0x5de62e['get']({'plain':!![]});var _0x1f3b01=_0x25b1('0x25');return db[_0x25b1('0x4f')][_0x25b1('0x4a')]({'where':{'name':_0x1f3b01,'userProfileId':_0x2b38ca[_0x25b1('0x50')]},'raw':!![]})[_0x25b1('0x27')](function(_0x59859e){if(_0x59859e&&_0x59859e[_0x25b1('0x51')]===0x0){return db[_0x25b1('0x26')][_0x25b1('0x4b')]({'name':_0x1fcc79[_0x25b1('0x2a')],'resourceId':_0x1fcc79['id'],'type':_0x59859e[_0x25b1('0x2a')],'sectionId':_0x59859e['id']},{})[_0x25b1('0x27')](function(){return _0x5de62e;});}else{return _0x5de62e;}})[_0x25b1('0x45')](function(_0x40d574){logger[_0x25b1('0x28')](_0x25b1('0x52'),_0x40d574);throw _0x40d574;});}return _0x5de62e;})[_0x25b1('0x27')](respondWithResult(_0x543f9b,0xc9))[_0x25b1('0x45')](handleError(_0x543f9b,null));};exports[_0x25b1('0x22')]=function(_0x2f17b2,_0x3191d7){if(_0x2f17b2[_0x25b1('0x4c')]['id']){delete _0x2f17b2[_0x25b1('0x4c')]['id'];}return db[_0x25b1('0x2d')]['find']({'where':{'id':_0x2f17b2[_0x25b1('0x47')]['id']}})[_0x25b1('0x27')](handleEntityNotFound(_0x3191d7,null))[_0x25b1('0x27')](saveUpdates(_0x2f17b2[_0x25b1('0x4c')],null))[_0x25b1('0x27')](respondWithResult(_0x3191d7,null))[_0x25b1('0x45')](handleError(_0x3191d7,null));};exports['destroy']=function(_0x105587,_0x3af93d){return db[_0x25b1('0x2d')]['find']({'where':{'id':_0x105587[_0x25b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x3af93d,null))['then'](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x105587[_0x25b1('0x47')]['id']}}))['then'](removeEntity(_0x3af93d,null))[_0x25b1('0x45')](handleError(_0x3af93d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index bb77ccc..bfe0606 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 _0xfad0=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4bbca5,_0x4c6b2a){var _0x6ee1b1=function(_0x1cd607){while(--_0x1cd607){_0x4bbca5['push'](_0x4bbca5['shift']());}};_0x6ee1b1(++_0x4c6b2a);}(_0xfad0,0x166));var _0x0fad=function(_0x21a6f7,_0x1547d9){_0x21a6f7=_0x21a6f7-0x0;var _0x5d5042=_0xfad0[_0x21a6f7];return _0x5d5042;};'use strict';var _=require(_0x0fad('0x0'));var util=require(_0x0fad('0x1'));var logger=require(_0x0fad('0x2'))(_0x0fad('0x3'));var moment=require(_0x0fad('0x4'));var BPromise=require('bluebird');var rp=require(_0x0fad('0x5'));var fs=require('fs');var path=require(_0x0fad('0x6'));var rimraf=require(_0x0fad('0x7'));var config=require(_0x0fad('0x8'));var attributes=require(_0x0fad('0x9'));module[_0x0fad('0xa')]=function(_0xa6d728,_0x2b6a95){return _0xa6d728['define'](_0x0fad('0xb'),attributes,{'tableName':_0x0fad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x957a=['moment','bluebird','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','api'];(function(_0x524af1,_0xac1579){var _0x5529b1=function(_0xde1094){while(--_0xde1094){_0x524af1['push'](_0x524af1['shift']());}};_0x5529b1(++_0xac1579);}(_0x957a,0x193));var _0xa957=function(_0x372989,_0x548b63){_0x372989=_0x372989-0x0;var _0x522e38=_0x957a[_0x372989];return _0x522e38;};'use strict';var _=require(_0xa957('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa957('0x1'));var moment=require(_0xa957('0x2'));var BPromise=require(_0xa957('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa957('0x4'));var attributes=require(_0xa957('0x5'));module[_0xa957('0x6')]=function(_0x3bff6f,_0x5d60cd){return _0x3bff6f['define'](_0xa957('0x7'),attributes,{'tableName':_0xa957('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 3cb3070..8dd3ac6 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 _0x8307=['error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','info','request\x20sent','stringify'];(function(_0xb45845,_0x56978b){var _0x2313e4=function(_0x5ca262){while(--_0x5ca262){_0xb45845['push'](_0xb45845['shift']());}};_0x2313e4(++_0x56978b);}(_0x8307,0xc4));var _0x7830=function(_0x1a8207,_0x576621){_0x1a8207=_0x1a8207-0x0;var _0x4bc774=_0x8307[_0x1a8207];return _0x4bc774;};'use strict';var _=require(_0x7830('0x0'));var util=require(_0x7830('0x1'));var moment=require('moment');var BPromise=require(_0x7830('0x2'));var rs=require(_0x7830('0x3'));var fs=require('fs');var Redis=require(_0x7830('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7830('0x5'));var logger=require(_0x7830('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7830('0x7'));var client=jayson['client'][_0x7830('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ab50a,_0x55e969,_0x20ed52){return new BPromise(function(_0x595074,_0x19c4b1){return client[_0x7830('0x9')](_0x5ab50a,_0x20ed52)['then'](function(_0x44992c){logger[_0x7830('0xa')]('ContactItemType,\x20%s,\x20%s',_0x55e969,_0x7830('0xb'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x55e969,_0x7830('0xb'),JSON[_0x7830('0xc')](_0x44992c));if(_0x44992c[_0x7830('0xd')]){if(_0x44992c[_0x7830('0xd')][_0x7830('0xe')]===0x1f4){logger[_0x7830('0xd')](_0x7830('0xf'),_0x55e969,_0x44992c[_0x7830('0xd')]['message']);return _0x19c4b1(_0x44992c[_0x7830('0xd')][_0x7830('0x10')]);}logger[_0x7830('0xd')]('ContactItemType,\x20%s,\x20%s',_0x55e969,_0x44992c['error']['message']);return _0x595074(_0x44992c[_0x7830('0xd')]['message']);}else{logger[_0x7830('0xa')](_0x7830('0xf'),_0x55e969,_0x7830('0xb'));_0x595074(_0x44992c[_0x7830('0x11')][_0x7830('0x10')]);}})[_0x7830('0x12')](function(_0x36f583){logger[_0x7830('0xd')](_0x7830('0xf'),_0x55e969,_0x36f583);_0x19c4b1(_0x36f583);});});} \ No newline at end of file +var _0x9464=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3bd241,_0x5e4d32){var _0x225cb8=function(_0x589e1b){while(--_0x589e1b){_0x3bd241['push'](_0x3bd241['shift']());}};_0x225cb8(++_0x5e4d32);}(_0x9464,0xd7));var _0x4946=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0x9464[_0x50f112];return _0x4ecf28;};'use strict';var _=require('lodash');var util=require(_0x4946('0x0'));var moment=require('moment');var BPromise=require(_0x4946('0x1'));var rs=require(_0x4946('0x2'));var fs=require('fs');var Redis=require(_0x4946('0x3'));var db=require(_0x4946('0x4'))['db'];var utils=require(_0x4946('0x5'));var logger=require(_0x4946('0x6'))(_0x4946('0x7'));var config=require(_0x4946('0x8'));var jayson=require(_0x4946('0x9'));var client=jayson[_0x4946('0xa')][_0x4946('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34015d,_0x3087ce,_0x55e3bd){return new BPromise(function(_0x45f06b,_0x483407){return client[_0x4946('0xc')](_0x34015d,_0x55e3bd)[_0x4946('0xd')](function(_0x17cc6a){logger[_0x4946('0xe')](_0x4946('0xf'),_0x3087ce,_0x4946('0x10'));logger[_0x4946('0x11')](_0x4946('0x12'),_0x3087ce,'request\x20sent',JSON[_0x4946('0x13')](_0x17cc6a));if(_0x17cc6a['error']){if(_0x17cc6a[_0x4946('0x14')][_0x4946('0x15')]===0x1f4){logger[_0x4946('0x14')](_0x4946('0xf'),_0x3087ce,_0x17cc6a[_0x4946('0x14')][_0x4946('0x16')]);return _0x483407(_0x17cc6a['error'][_0x4946('0x16')]);}logger[_0x4946('0x14')](_0x4946('0xf'),_0x3087ce,_0x17cc6a[_0x4946('0x14')][_0x4946('0x16')]);return _0x45f06b(_0x17cc6a[_0x4946('0x14')][_0x4946('0x16')]);}else{logger[_0x4946('0xe')](_0x4946('0xf'),_0x3087ce,_0x4946('0x10'));_0x45f06b(_0x17cc6a[_0x4946('0x17')][_0x4946('0x16')]);}})[_0x4946('0x18')](function(_0x30f443){logger['error'](_0x4946('0xf'),_0x3087ce,_0x30f443);_0x483407(_0x30f443);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 9b25d6b..651a63b 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 _0xcc2b=['put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','post','create'];(function(_0x4e4515,_0x3944ac){var _0x294b51=function(_0xf39d19){while(--_0xf39d19){_0x4e4515['push'](_0x4e4515['shift']());}};_0x294b51(++_0x3944ac);}(_0xcc2b,0x16d));var _0xbcc2=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xcc2b[_0x288f5e];return _0x476cc9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbcc2('0x0'));var timeout=require('connect-timeout');var express=require(_0xbcc2('0x1'));var router=express[_0xbcc2('0x2')]();var fs_extra=require(_0xbcc2('0x3'));var auth=require(_0xbcc2('0x4'));var interaction=require(_0xbcc2('0x5'));var config=require(_0xbcc2('0x6'));var controller=require(_0xbcc2('0x7'));router[_0xbcc2('0x8')]('/',auth[_0xbcc2('0x9')](),controller['index']);router['get'](_0xbcc2('0xa'),auth[_0xbcc2('0x9')](),controller['show']);router[_0xbcc2('0xb')]('/',auth[_0xbcc2('0x9')](),controller[_0xbcc2('0xc')]);router[_0xbcc2('0xd')]('/:id',auth[_0xbcc2('0x9')](),controller[_0xbcc2('0xe')]);router[_0xbcc2('0xf')](_0xbcc2('0xa'),auth[_0xbcc2('0x9')](),controller[_0xbcc2('0x10')]);module[_0xbcc2('0x11')]=router; \ No newline at end of file +var _0xbfbf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','util','path','connect-timeout','express','Router'];(function(_0x46b0f9,_0x361b39){var _0x1aff1d=function(_0x1450ac){while(--_0x1450ac){_0x46b0f9['push'](_0x46b0f9['shift']());}};_0x1aff1d(++_0x361b39);}(_0xbfbf,0x13f));var _0xfbfb=function(_0x1536d8,_0x578791){_0x1536d8=_0x1536d8-0x0;var _0x475951=_0xbfbf[_0x1536d8];return _0x475951;};'use strict';var multer=require('multer');var util=require(_0xfbfb('0x0'));var path=require(_0xfbfb('0x1'));var timeout=require(_0xfbfb('0x2'));var express=require(_0xfbfb('0x3'));var router=express[_0xfbfb('0x4')]();var fs_extra=require(_0xfbfb('0x5'));var auth=require(_0xfbfb('0x6'));var interaction=require(_0xfbfb('0x7'));var config=require(_0xfbfb('0x8'));var controller=require(_0xfbfb('0x9'));router[_0xfbfb('0xa')]('/',auth[_0xfbfb('0xb')](),controller[_0xfbfb('0xc')]);router[_0xfbfb('0xa')](_0xfbfb('0xd'),auth[_0xfbfb('0xb')](),controller[_0xfbfb('0xe')]);router[_0xfbfb('0xf')]('/',auth['isAuthenticated'](),controller[_0xfbfb('0x10')]);router[_0xfbfb('0x11')](_0xfbfb('0xd'),auth[_0xfbfb('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f3ff6e7..e0a9971 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xb7e7[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x4d40c2,_0x2368ea){var _0x20baa3=function(_0x54a069){while(--_0x54a069){_0x4d40c2['push'](_0x4d40c2['shift']());}};_0x20baa3(++_0x2368ea);}(_0x757a,0xde));var _0xa757=function(_0x4d571b,_0x36fc5a){_0x4d571b=_0x4d571b-0x0;var _0x3c63ad=_0x757a[_0x4d571b];return _0x3c63ad;};'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 46cea78..ab88c65 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 _0x1478=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','options','omit','createdAt','body','updatedAt','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','findOne','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','find'];(function(_0x244f75,_0x162f22){var _0x31764b=function(_0x2bd1cc){while(--_0x2bd1cc){_0x244f75['push'](_0x244f75['shift']());}};_0x31764b(++_0x162f22);}(_0x1478,0xb3));var _0x8147=function(_0x57c4ec,_0xfb1ad0){_0x57c4ec=_0x57c4ec-0x0;var _0x157f3c=_0x1478[_0x57c4ec];return _0x157f3c;};'use strict';var emlformat=require(_0x8147('0x0'));var rimraf=require(_0x8147('0x1'));var zipdir=require(_0x8147('0x2'));var jsonpatch=require(_0x8147('0x3'));var rp=require(_0x8147('0x4'));var moment=require(_0x8147('0x5'));var BPromise=require(_0x8147('0x6'));var Mustache=require(_0x8147('0x7'));var util=require(_0x8147('0x8'));var path=require('path');var sox=require(_0x8147('0x9'));var csv=require('to-csv');var ejs=require(_0x8147('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8147('0xb'));var squel=require('squel');var crypto=require(_0x8147('0xc'));var jsforce=require(_0x8147('0xd'));var deskjs=require(_0x8147('0xe'));var toCsv=require(_0x8147('0xf'));var querystring=require('querystring');var Papa=require(_0x8147('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8147('0x11'));var as=require(_0x8147('0x12'));var hardwareService=require(_0x8147('0x13'));var logger=require(_0x8147('0x14'))(_0x8147('0x15'));var utils=require('../../config/utils');var config=require(_0x8147('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8147('0x17')]=_[_0x8147('0x18')](config[_0x8147('0x17')],{'host':_0x8147('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8147('0x17')]));require(_0x8147('0x1a'))[_0x8147('0x1b')](socket);function respondWithStatusCode(_0x3fad0e,_0xffef0d){_0xffef0d=_0xffef0d||0xcc;return function(_0x5924a9){if(_0x5924a9){return _0x3fad0e[_0x8147('0x1c')](_0xffef0d);}return _0x3fad0e[_0x8147('0x1d')](_0xffef0d)[_0x8147('0x1e')]();};}function respondWithResult(_0x16b183,_0x89722c){_0x89722c=_0x89722c||0xc8;return function(_0x1901b3){if(_0x1901b3){return _0x16b183[_0x8147('0x1d')](_0x89722c)[_0x8147('0x1f')](_0x1901b3);}};}function respondWithFilteredResult(_0x5eadfc,_0x1fa9fe){return function(_0x1bda2f){if(_0x1bda2f){var _0x4c3d62=typeof _0x1fa9fe[_0x8147('0x20')]===_0x8147('0x21')&&typeof _0x1fa9fe[_0x8147('0x22')]===_0x8147('0x21');var _0x3e3988=_0x1bda2f['count'];var _0x2c8464=_0x4c3d62?0x0:_0x1fa9fe[_0x8147('0x20')];var _0x27b9c8=_0x4c3d62?_0x1bda2f[_0x8147('0x23')]:_0x1fa9fe[_0x8147('0x20')]+_0x1fa9fe[_0x8147('0x22')];var _0x477d15;if(_0x27b9c8>=_0x3e3988){_0x27b9c8=_0x3e3988;_0x477d15=0xc8;}else{_0x477d15=0xce;}_0x5eadfc[_0x8147('0x1d')](_0x477d15);return _0x5eadfc['set'](_0x8147('0x24'),_0x2c8464+'-'+_0x27b9c8+'/'+_0x3e3988)['json'](_0x1bda2f);}return null;};}function patchUpdates(_0x29840d){return function(_0x49a53f){try{jsonpatch['apply'](_0x49a53f,_0x29840d,!![]);}catch(_0x2b62c0){return BPromise[_0x8147('0x25')](_0x2b62c0);}return _0x49a53f[_0x8147('0x26')]();};}function saveUpdates(_0x35b8ca,_0x2506b){return function(_0x73907e){if(_0x73907e){return _0x73907e[_0x8147('0x27')](_0x35b8ca)[_0x8147('0x28')](function(_0xe3ba7d){return _0xe3ba7d;});}return null;};}function removeEntity(_0x466778,_0x3a45c8){return function(_0x2103ea){if(_0x2103ea){return _0x2103ea[_0x8147('0x29')]()[_0x8147('0x28')](function(){var _0x351ed9=_0x2103ea[_0x8147('0x2a')]({'plain':!![]});var _0x360eef=_0x8147('0x2b');return db[_0x8147('0x2c')][_0x8147('0x29')]({'where':{'type':_0x360eef,'resourceId':_0x351ed9['id']}})[_0x8147('0x28')](function(){return _0x2103ea;});})[_0x8147('0x28')](function(){_0x466778['status'](0xcc)[_0x8147('0x1e')]();});}};}function handleEntityNotFound(_0x5d87f7,_0x487019){return function(_0x1581be){if(!_0x1581be){_0x5d87f7[_0x8147('0x1c')](0x194);}return _0x1581be;};}function handleError(_0x2a9fdb,_0x531f99){_0x531f99=_0x531f99||0x1f4;return function(_0x29da8c){logger[_0x8147('0x2d')](_0x29da8c['stack']);if(_0x29da8c[_0x8147('0x2e')]){delete _0x29da8c['name'];}_0x2a9fdb[_0x8147('0x1d')](_0x531f99)['send'](_0x29da8c);};}exports['index']=function(_0x5de713,_0x34ddc7){var _0x2765b5={},_0x54dfa1={},_0x202f87={'count':0x0,'rows':[]};var _0x306ade=_[_0x8147('0x2f')](db[_0x8147('0x30')][_0x8147('0x31')],function(_0x193e5a){return{'name':_0x193e5a[_0x8147('0x32')],'type':_0x193e5a[_0x8147('0x33')][_0x8147('0x34')]};});_0x54dfa1[_0x8147('0x35')]=_['map'](_0x306ade,_0x8147('0x2e'));_0x54dfa1[_0x8147('0x36')]=_['keys'](_0x5de713['query']);_0x54dfa1[_0x8147('0x37')]=_[_0x8147('0x38')](_0x54dfa1[_0x8147('0x35')],_0x54dfa1['query']);_0x2765b5[_0x8147('0x39')]=_[_0x8147('0x38')](_0x54dfa1['model'],qs[_0x8147('0x3a')](_0x5de713['query']['fields']));_0x2765b5[_0x8147('0x39')]=_0x2765b5[_0x8147('0x39')][_0x8147('0x3b')]?_0x2765b5['attributes']:_0x54dfa1['model'];if(!_0x5de713[_0x8147('0x36')][_0x8147('0x3c')](_0x8147('0x3d'))){_0x2765b5[_0x8147('0x22')]=qs[_0x8147('0x22')](_0x5de713[_0x8147('0x36')]['limit']);_0x2765b5[_0x8147('0x20')]=qs[_0x8147('0x20')](_0x5de713[_0x8147('0x36')]['offset']);}_0x2765b5[_0x8147('0x3e')]=qs[_0x8147('0x3f')](_0x5de713[_0x8147('0x36')][_0x8147('0x3f')]);_0x2765b5['where']=qs['filters'](_[_0x8147('0x40')](_0x5de713['query'],_0x54dfa1[_0x8147('0x37')]),_0x306ade);if(_0x5de713['query'][_0x8147('0x41')]){_0x2765b5['where']=_[_0x8147('0x42')](_0x2765b5[_0x8147('0x43')],{'$or':_[_0x8147('0x2f')](_0x306ade,function(_0x2ffc6b){if(_0x2ffc6b[_0x8147('0x33')]!==_0x8147('0x44')){var _0x231234={};_0x231234[_0x2ffc6b['name']]={'$like':'%'+_0x5de713[_0x8147('0x36')][_0x8147('0x41')]+'%'};return _0x231234;}})});}_0x2765b5=_[_0x8147('0x42')]({},_0x2765b5,_0x5de713['options']);var _0x518cbb={'where':_0x2765b5[_0x8147('0x43')]};return db['Dashboard'][_0x8147('0x23')](_0x518cbb)[_0x8147('0x28')](function(_0x166830){_0x202f87[_0x8147('0x23')]=_0x166830;if(_0x5de713[_0x8147('0x36')][_0x8147('0x45')]){_0x2765b5[_0x8147('0x46')]=[{'all':!![]}];}return db[_0x8147('0x30')][_0x8147('0x47')](_0x2765b5);})[_0x8147('0x28')](function(_0x49c910){_0x202f87[_0x8147('0x48')]=_0x49c910;return _0x202f87;})['then'](respondWithFilteredResult(_0x34ddc7,_0x2765b5))[_0x8147('0x49')](handleError(_0x34ddc7,null));};exports[_0x8147('0x4a')]=function(_0x958083,_0x1d7858){var _0xc9b10d={'raw':![],'where':{'id':_0x958083['params']['id']}},_0x14751b={};_0x14751b['model']=_[_0x8147('0x4b')](db[_0x8147('0x30')]['rawAttributes']);_0x14751b['query']=_['keys'](_0x958083[_0x8147('0x36')]);_0x14751b['filters']=_[_0x8147('0x38')](_0x14751b[_0x8147('0x35')],_0x14751b[_0x8147('0x36')]);_0xc9b10d[_0x8147('0x39')]=_[_0x8147('0x38')](_0x14751b[_0x8147('0x35')],qs['fields'](_0x958083[_0x8147('0x36')]['fields']));_0xc9b10d['attributes']=_0xc9b10d[_0x8147('0x39')][_0x8147('0x3b')]?_0xc9b10d[_0x8147('0x39')]:_0x14751b[_0x8147('0x35')];if(_0x958083[_0x8147('0x36')]['includeAll']){_0xc9b10d[_0x8147('0x46')]=[{'all':!![]}];}_0xc9b10d=_[_0x8147('0x42')]({},_0xc9b10d,_0x958083['options']);return db[_0x8147('0x30')][_0x8147('0x4c')](_0xc9b10d)[_0x8147('0x28')](handleEntityNotFound(_0x1d7858,null))[_0x8147('0x28')](respondWithResult(_0x1d7858,null))['catch'](handleError(_0x1d7858,null));};exports['create']=function(_0x18cd83,_0xb20fb7){return db[_0x8147('0x30')]['create'](_0x18cd83['body'],{})[_0x8147('0x28')](function(_0x4ec741){var _0xce2712=_0x18cd83[_0x8147('0x4d')]['get']({'plain':!![]});if(!_0xce2712)throw new Error(_0x8147('0x4e'));if(_0xce2712[_0x8147('0x4f')]===_0x8147('0x4d')){var _0x37ccea=_0x4ec741[_0x8147('0x2a')]({'plain':!![]});var _0xf5612b=_0x8147('0x2b');return db[_0x8147('0x50')][_0x8147('0x4c')]({'where':{'name':_0xf5612b,'userProfileId':_0xce2712[_0x8147('0x51')]},'raw':!![]})[_0x8147('0x28')](function(_0x576168){if(_0x576168&&_0x576168[_0x8147('0x52')]===0x0){return db['UserProfileResource'][_0x8147('0x53')]({'name':_0x37ccea[_0x8147('0x2e')],'resourceId':_0x37ccea['id'],'type':_0x576168[_0x8147('0x2e')],'sectionId':_0x576168['id']},{})[_0x8147('0x28')](function(){return _0x4ec741;});}else{return _0x4ec741;}})[_0x8147('0x49')](function(_0x504555){logger[_0x8147('0x2d')](_0x8147('0x54'),_0x504555);throw _0x504555;});}return _0x4ec741;})[_0x8147('0x28')](respondWithResult(_0xb20fb7,0xc9))['catch'](handleError(_0xb20fb7,null));};exports[_0x8147('0x55')]=function(_0x40b6d5,_0x2da9c8){var _0x127e27={'where':{'id':_0x40b6d5[_0x8147('0x56')]['id']}},_0x3aee33={};_0x3aee33[_0x8147('0x35')]=_[_0x8147('0x4b')](db[_0x8147('0x30')][_0x8147('0x31')]);_0x127e27[_0x8147('0x39')]=_[_0x8147('0x38')](_0x3aee33[_0x8147('0x35')],qs[_0x8147('0x3a')](_0x40b6d5[_0x8147('0x36')][_0x8147('0x3a')]));_0x127e27[_0x8147('0x39')]=_0x127e27['attributes'][_0x8147('0x3b')]?_0x127e27[_0x8147('0x39')]:_0x3aee33[_0x8147('0x35')];if(_0x40b6d5['query']['includeAll']){_0x127e27[_0x8147('0x46')]=[{'all':!![]}];}_0x127e27=_['merge']({},_0x127e27,_0x40b6d5[_0x8147('0x57')]);return db[_0x8147('0x30')]['find'](_0x127e27)[_0x8147('0x28')](handleEntityNotFound(_0x2da9c8,null))['then'](function(_0x444991){if(_0x444991){var _0x566113=_0x444991['get']({'plain':!![]});_0x566113=qs[_0x8147('0x58')](_0x566113,['id',_0x8147('0x59'),'updatedAt']);_0x40b6d5['body']=_[_0x8147('0x58')](_0x40b6d5[_0x8147('0x5a')],['id',_0x8147('0x59'),_0x8147('0x5b')]);return db[_0x8147('0x30')]['create'](_[_0x8147('0x42')](_0x566113,_0x40b6d5[_0x8147('0x5a')]),{'include':_0x40b6d5['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2f7c29){var _0x485fde=_0x40b6d5[_0x8147('0x4d')]['get']({'plain':!![]});if(!_0x485fde)throw new Error(_0x8147('0x4e'));if(_0x485fde[_0x8147('0x4f')]==='user'){var _0x158004=_0x2f7c29['get']({'plain':!![]});var _0x2c89f8=_0x8147('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2c89f8,'userProfileId':_0x485fde[_0x8147('0x51')]},'raw':!![]})['then'](function(_0x36a1b7){if(_0x36a1b7&&_0x36a1b7[_0x8147('0x52')]===0x0){return db[_0x8147('0x2c')]['create']({'name':_0x158004[_0x8147('0x2e')],'resourceId':_0x158004['id'],'type':_0x36a1b7['name'],'sectionId':_0x36a1b7['id']},{})['then'](function(){return _0x2f7c29;});}else{return _0x2f7c29;}})[_0x8147('0x49')](function(_0x4d8cfd){logger[_0x8147('0x2d')](_0x8147('0x54'),_0x4d8cfd);throw _0x4d8cfd;});}return _0x2f7c29;});}})[_0x8147('0x28')](respondWithResult(_0x2da9c8,0xc9))[_0x8147('0x49')](handleError(_0x2da9c8,null));};exports[_0x8147('0x27')]=function(_0x41f13a,_0x57cb45){if(_0x41f13a[_0x8147('0x5a')]['id']){delete _0x41f13a[_0x8147('0x5a')]['id'];}return db[_0x8147('0x30')][_0x8147('0x4c')]({'where':{'id':_0x41f13a[_0x8147('0x56')]['id']}})['then'](handleEntityNotFound(_0x57cb45,null))['then'](saveUpdates(_0x41f13a[_0x8147('0x5a')],null))['then'](respondWithResult(_0x57cb45,null))['catch'](handleError(_0x57cb45,null));};exports[_0x8147('0x29')]=function(_0x4891d2,_0x3e2cd6){return db[_0x8147('0x30')][_0x8147('0x4c')]({'where':{'id':_0x4891d2[_0x8147('0x56')]['id']}})[_0x8147('0x28')](handleEntityNotFound(_0x3e2cd6,null))[_0x8147('0x28')](removeEntity(_0x3e2cd6,null))[_0x8147('0x49')](handleError(_0x3e2cd6,null));};function widgetAttributes(_0x540811){try{switch(_0x540811[_0x8147('0x33')]){case'iframe':return[{'name':_0x8147('0x5c'),'value':_0x540811[_0x8147('0x5c')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x0]?_0x540811[_0x8147('0x5d')][0x0][_0x8147('0x5e')]:undefined)||_0x8147('0x5f')}];case _0x8147('0x60'):return[{'name':_0x8147('0x61'),'value':_0x540811[_0x8147('0x61')]||(_0x540811[_0x8147('0x5d')]&&_0x540811['attrs'][0x0]?_0x540811[_0x8147('0x5d')][0x0][_0x8147('0x5e')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x540811[_0x8147('0x62')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x0]?_0x540811[_0x8147('0x5d')][0x0]['value']:undefined)||_0x8147('0x63')},{'name':_0x8147('0x64'),'value':_0x540811[_0x8147('0x64')]||(_0x540811['attrs']&&_0x540811['attrs'][0x1]?_0x540811[_0x8147('0x5d')][0x1][_0x8147('0x5e')]:undefined)||_0x8147('0x65')},{'name':_0x8147('0x66'),'value':_0x540811['attrFontSize']||(_0x540811[_0x8147('0x5d')]&&_0x540811['attrs'][0x2]?_0x540811['attrs'][0x2][_0x8147('0x5e')]:undefined)||0xc}];case _0x8147('0x67'):return[{'name':'attrMetric','value':_0x540811[_0x8147('0x68')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x0]?_0x540811[_0x8147('0x5d')][0x0][_0x8147('0x5e')]:undefined)||_0x8147('0x69')},{'name':_0x8147('0x6a'),'value':_0x540811[_0x8147('0x6a')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x1]?_0x540811['attrs'][0x1][_0x8147('0x5e')]:undefined)||[]},{'name':'attrFontSize','value':_0x540811[_0x8147('0x66')]||(_0x540811['attrs']&&_0x540811['attrs'][0x2]?_0x540811[_0x8147('0x5d')][0x2][_0x8147('0x5e')]:undefined)||0x14},{'name':_0x8147('0x6b'),'value':_0x540811[_0x8147('0x6b')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x3]?_0x540811[_0x8147('0x5d')][0x3][_0x8147('0x5e')]:undefined)||_0x8147('0x6c')},{'name':_0x8147('0x6d'),'value':_0x540811[_0x8147('0x6d')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x4]?_0x540811[_0x8147('0x5d')][0x4][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x6e'),'value':_0x540811['attrFaxAccounts']||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x5]?_0x540811[_0x8147('0x5d')][0x5][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x6f'),'value':_0x540811[_0x8147('0x6f')]||(_0x540811['attrs']&&_0x540811['attrs'][0x6]?_0x540811['attrs'][0x6][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x70'),'value':_0x540811['attrOpenchannelAccounts']||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x7]?_0x540811[_0x8147('0x5d')][0x7][_0x8147('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x540811[_0x8147('0x71')]||(_0x540811['attrs']&&_0x540811[_0x8147('0x5d')][0x8]?_0x540811['attrs'][0x8][_0x8147('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x540811[_0x8147('0x72')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x9]?_0x540811['attrs'][0x9]['value']:undefined)||''}];case _0x8147('0x73'):case _0x8147('0x74'):return[{'name':'attrSerie1','value':_0x540811['attrSerie1']||(_0x540811[_0x8147('0x5d')]&&_0x540811['attrs'][0x0]?_0x540811['attrs'][0x0][_0x8147('0x5e')]:undefined)||'total'},{'name':_0x8147('0x75'),'value':_0x540811[_0x8147('0x75')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x1]?_0x540811[_0x8147('0x5d')][0x1][_0x8147('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x540811[_0x8147('0x76')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x2]?_0x540811[_0x8147('0x5d')][0x2][_0x8147('0x5e')]:undefined)||null},{'name':_0x8147('0x6a'),'value':_0x540811[_0x8147('0x6a')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x3]?_0x540811[_0x8147('0x5d')][0x3][_0x8147('0x5e')]:undefined)||[]},{'name':_0x8147('0x6b'),'value':_0x540811[_0x8147('0x6b')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x4]?_0x540811[_0x8147('0x5d')][0x4][_0x8147('0x5e')]:undefined)||_0x8147('0x6c')},{'name':'attrEmailAccounts','value':_0x540811['attrEmailAccounts']||(_0x540811['attrs']&&_0x540811[_0x8147('0x5d')][0x5]?_0x540811[_0x8147('0x5d')][0x5][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x6e'),'value':_0x540811[_0x8147('0x6e')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x6]?_0x540811[_0x8147('0x5d')][0x6][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x6f'),'value':_0x540811['attrSmsAccounts']||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x7]?_0x540811[_0x8147('0x5d')][0x7][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x70'),'value':_0x540811[_0x8147('0x70')]||(_0x540811['attrs']&&_0x540811[_0x8147('0x5d')][0x8]?_0x540811[_0x8147('0x5d')][0x8][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x71'),'value':_0x540811['attrWhatsappAccounts']||(_0x540811['attrs']&&_0x540811[_0x8147('0x5d')][0x9]?_0x540811[_0x8147('0x5d')][0x9][_0x8147('0x5e')]:undefined)||''},{'name':_0x8147('0x72'),'value':_0x540811[_0x8147('0x72')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0xa]?_0x540811['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x8147('0x77'),'type':_0x540811[_0x8147('0x78')]||(_0x540811[_0x8147('0x5d')]&&_0x540811['attrs'][0x0]?_0x540811[_0x8147('0x5d')][0x0][_0x8147('0x33')]:undefined)||null,'value':_0x540811[_0x8147('0x77')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x0]?_0x540811[_0x8147('0x5d')][0x0][_0x8147('0x5e')]:undefined)||null},{'name':_0x8147('0x79'),'value':_0x540811[_0x8147('0x79')]||(_0x540811[_0x8147('0x5d')]&&_0x540811[_0x8147('0x5d')][0x1]?_0x540811[_0x8147('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x34267f){logger['error'](_0x8147('0x7a'),JSON[_0x8147('0x7b')](_0x34267f));return[];}}exports[_0x8147('0x7c')]=function(_0x254dc4,_0x50ea78,_0x177d4f){if(_0x254dc4[_0x8147('0x5a')]['id']){delete _0x254dc4['body']['id'];}return db[_0x8147('0x30')]['find']({'where':{'id':_0x254dc4[_0x8147('0x56')]['id']}})[_0x8147('0x28')](handleEntityNotFound(_0x50ea78,null))[_0x8147('0x28')](function(_0x2a6efd){if(_0x2a6efd){_0x254dc4['body']['DashboardId']=_0x2a6efd['id'];_0x254dc4[_0x8147('0x5a')]['attrs']=widgetAttributes(_0x254dc4[_0x8147('0x5a')]);return db['DashboardItem'][_0x8147('0x53')](_0x254dc4[_0x8147('0x5a')]);}})[_0x8147('0x28')](respondWithResult(_0x50ea78,null))[_0x8147('0x49')](handleError(_0x50ea78,null));};exports['getItems']=function(_0x52a040,_0x4b4d14,_0x4e0ecc){var _0x4993a8={};var _0x35a596={};var _0x556216;var _0x5cf383;return db[_0x8147('0x30')][_0x8147('0x7d')]({'where':{'id':_0x52a040[_0x8147('0x56')]['id']}})[_0x8147('0x28')](handleEntityNotFound(_0x4b4d14,null))[_0x8147('0x28')](function(_0x1fd410){if(_0x1fd410){_0x556216=_0x1fd410;_0x35a596[_0x8147('0x35')]=_['keys'](db[_0x8147('0x7e')][_0x8147('0x31')]);_0x35a596[_0x8147('0x36')]=_['keys'](_0x52a040[_0x8147('0x36')]);_0x35a596[_0x8147('0x37')]=_['intersection'](_0x35a596[_0x8147('0x35')],_0x35a596['query']);_0x4993a8[_0x8147('0x39')]=_[_0x8147('0x38')](_0x35a596[_0x8147('0x35')],qs[_0x8147('0x3a')](_0x52a040[_0x8147('0x36')][_0x8147('0x3a')]));_0x4993a8[_0x8147('0x39')]=_0x4993a8[_0x8147('0x39')][_0x8147('0x3b')]?_0x4993a8[_0x8147('0x39')]:_0x35a596[_0x8147('0x35')];_0x4993a8[_0x8147('0x3e')]=qs['sort'](_0x52a040[_0x8147('0x36')][_0x8147('0x3f')]);_0x4993a8[_0x8147('0x43')]=qs[_0x8147('0x37')](_[_0x8147('0x40')](_0x52a040[_0x8147('0x36')],_0x35a596[_0x8147('0x37')]));if(_0x52a040[_0x8147('0x36')][_0x8147('0x41')]){_0x4993a8[_0x8147('0x43')]=_[_0x8147('0x42')](_0x4993a8[_0x8147('0x43')],{'$or':_[_0x8147('0x2f')](_0x4993a8['attributes'],function(_0x281c9a){var _0x32fb2d={};_0x32fb2d[_0x281c9a]={'$like':'%'+_0x52a040[_0x8147('0x36')][_0x8147('0x41')]+'%'};return _0x32fb2d;})});}_0x4993a8=_[_0x8147('0x42')]({},_0x4993a8,_0x52a040[_0x8147('0x57')]);return _0x556216[_0x8147('0x7f')](_0x4993a8);}})[_0x8147('0x28')](function(_0x52dc3d){if(_0x52dc3d){_0x5cf383=_0x52dc3d['length'];if(!_0x52a040[_0x8147('0x36')][_0x8147('0x3c')]('nolimit')){_0x4993a8[_0x8147('0x22')]=qs[_0x8147('0x22')](_0x52a040[_0x8147('0x36')][_0x8147('0x22')]);_0x4993a8['offset']=qs[_0x8147('0x20')](_0x52a040[_0x8147('0x36')]['offset']);}return _0x556216[_0x8147('0x7f')](_0x4993a8);}})[_0x8147('0x28')](function(_0x56959d){if(_0x56959d){return _0x56959d?{'count':_0x5cf383,'rows':_0x56959d}:null;}})[_0x8147('0x28')](respondWithResult(_0x4b4d14,null))[_0x8147('0x49')](handleError(_0x4b4d14,null));}; \ No newline at end of file +var _0xa4b2=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','createdAt','updatedAt','omit','UserProfileResource','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Dashboard','includeAll','include','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3d1b03,_0x5d881a){var _0x2e41e0=function(_0x17aaf6){while(--_0x17aaf6){_0x3d1b03['push'](_0x3d1b03['shift']());}};_0x2e41e0(++_0x5d881a);}(_0xa4b2,0x1b5));var _0x2a4b=function(_0x402896,_0x4b8c99){_0x402896=_0x402896-0x0;var _0x354fc7=_0xa4b2[_0x402896];return _0x354fc7;};'use strict';var emlformat=require(_0x2a4b('0x0'));var rimraf=require(_0x2a4b('0x1'));var zipdir=require(_0x2a4b('0x2'));var jsonpatch=require(_0x2a4b('0x3'));var rp=require('request-promise');var moment=require(_0x2a4b('0x4'));var BPromise=require(_0x2a4b('0x5'));var Mustache=require('mustache');var util=require(_0x2a4b('0x6'));var path=require(_0x2a4b('0x7'));var sox=require(_0x2a4b('0x8'));var csv=require(_0x2a4b('0x9'));var ejs=require(_0x2a4b('0xa'));var fs=require('fs');var fs_extra=require(_0x2a4b('0xb'));var _=require(_0x2a4b('0xc'));var squel=require(_0x2a4b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2a4b('0xe'));var toCsv=require(_0x2a4b('0x9'));var querystring=require(_0x2a4b('0xf'));var Papa=require(_0x2a4b('0x10'));var Redis=require(_0x2a4b('0x11'));var authService=require(_0x2a4b('0x12'));var qs=require(_0x2a4b('0x13'));var as=require(_0x2a4b('0x14'));var hardwareService=require(_0x2a4b('0x15'));var logger=require(_0x2a4b('0x16'))(_0x2a4b('0x17'));var utils=require(_0x2a4b('0x18'));var config=require(_0x2a4b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2a4b('0x1a')](config[_0x2a4b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a4b('0x1c'))(new Redis(config['redis']));require(_0x2a4b('0x1d'))[_0x2a4b('0x1e')](socket);function respondWithStatusCode(_0x35505b,_0x5b0643){_0x5b0643=_0x5b0643||0xcc;return function(_0xc60679){if(_0xc60679){return _0x35505b[_0x2a4b('0x1f')](_0x5b0643);}return _0x35505b[_0x2a4b('0x20')](_0x5b0643)[_0x2a4b('0x21')]();};}function respondWithResult(_0x36dc32,_0x5e45cd){_0x5e45cd=_0x5e45cd||0xc8;return function(_0x535b09){if(_0x535b09){return _0x36dc32['status'](_0x5e45cd)[_0x2a4b('0x22')](_0x535b09);}};}function respondWithFilteredResult(_0x331b86,_0x14b2d3){return function(_0x88e29){if(_0x88e29){var _0x2af2db=typeof _0x14b2d3[_0x2a4b('0x23')]===_0x2a4b('0x24')&&typeof _0x14b2d3[_0x2a4b('0x25')]===_0x2a4b('0x24');var _0x387eab=_0x88e29['count'];var _0x4282eb=_0x2af2db?0x0:_0x14b2d3[_0x2a4b('0x23')];var _0x32d4ec=_0x2af2db?_0x88e29[_0x2a4b('0x26')]:_0x14b2d3[_0x2a4b('0x23')]+_0x14b2d3[_0x2a4b('0x25')];var _0x2c69ed;if(_0x32d4ec>=_0x387eab){_0x32d4ec=_0x387eab;_0x2c69ed=0xc8;}else{_0x2c69ed=0xce;}_0x331b86[_0x2a4b('0x20')](_0x2c69ed);return _0x331b86[_0x2a4b('0x27')](_0x2a4b('0x28'),_0x4282eb+'-'+_0x32d4ec+'/'+_0x387eab)['json'](_0x88e29);}return null;};}function patchUpdates(_0x106b24){return function(_0xbe952a){try{jsonpatch[_0x2a4b('0x29')](_0xbe952a,_0x106b24,!![]);}catch(_0x5cb3fe){return BPromise['reject'](_0x5cb3fe);}return _0xbe952a[_0x2a4b('0x2a')]();};}function saveUpdates(_0x2e2fb7,_0x3eccf1){return function(_0x3095e7){if(_0x3095e7){return _0x3095e7['update'](_0x2e2fb7)[_0x2a4b('0x2b')](function(_0x26c0f4){return _0x26c0f4;});}return null;};}function removeEntity(_0x377d6a,_0x590047){return function(_0xed4307){if(_0xed4307){return _0xed4307[_0x2a4b('0x2c')]()[_0x2a4b('0x2b')](function(){var _0x105fae=_0xed4307[_0x2a4b('0x2d')]({'plain':!![]});var _0x157274='CustomDashboards';return db['UserProfileResource'][_0x2a4b('0x2c')]({'where':{'type':_0x157274,'resourceId':_0x105fae['id']}})['then'](function(){return _0xed4307;});})['then'](function(){_0x377d6a[_0x2a4b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22bd98,_0x7e7b6d){return function(_0x220bd0){if(!_0x220bd0){_0x22bd98[_0x2a4b('0x1f')](0x194);}return _0x220bd0;};}function handleError(_0x44b3f9,_0x393583){_0x393583=_0x393583||0x1f4;return function(_0x5d6ccd){logger[_0x2a4b('0x2e')](_0x5d6ccd[_0x2a4b('0x2f')]);if(_0x5d6ccd[_0x2a4b('0x30')]){delete _0x5d6ccd[_0x2a4b('0x30')];}_0x44b3f9[_0x2a4b('0x20')](_0x393583)[_0x2a4b('0x31')](_0x5d6ccd);};}exports[_0x2a4b('0x32')]=function(_0x187c2f,_0x345ea7){var _0x5d3022={},_0x663fe8={},_0x380989={'count':0x0,'rows':[]};var _0x164625=_[_0x2a4b('0x33')](db['Dashboard'][_0x2a4b('0x34')],function(_0xa6e0e9){return{'name':_0xa6e0e9['fieldName'],'type':_0xa6e0e9[_0x2a4b('0x35')][_0x2a4b('0x36')]};});_0x663fe8[_0x2a4b('0x37')]=_[_0x2a4b('0x33')](_0x164625,'name');_0x663fe8['query']=_[_0x2a4b('0x38')](_0x187c2f[_0x2a4b('0x39')]);_0x663fe8[_0x2a4b('0x3a')]=_[_0x2a4b('0x3b')](_0x663fe8[_0x2a4b('0x37')],_0x663fe8[_0x2a4b('0x39')]);_0x5d3022[_0x2a4b('0x3c')]=_[_0x2a4b('0x3b')](_0x663fe8[_0x2a4b('0x37')],qs['fields'](_0x187c2f[_0x2a4b('0x39')]['fields']));_0x5d3022[_0x2a4b('0x3c')]=_0x5d3022[_0x2a4b('0x3c')][_0x2a4b('0x3d')]?_0x5d3022[_0x2a4b('0x3c')]:_0x663fe8[_0x2a4b('0x37')];if(!_0x187c2f[_0x2a4b('0x39')]['hasOwnProperty'](_0x2a4b('0x3e'))){_0x5d3022[_0x2a4b('0x25')]=qs[_0x2a4b('0x25')](_0x187c2f[_0x2a4b('0x39')][_0x2a4b('0x25')]);_0x5d3022[_0x2a4b('0x23')]=qs['offset'](_0x187c2f['query'][_0x2a4b('0x23')]);}_0x5d3022[_0x2a4b('0x3f')]=qs[_0x2a4b('0x40')](_0x187c2f[_0x2a4b('0x39')]['sort']);_0x5d3022[_0x2a4b('0x41')]=qs['filters'](_[_0x2a4b('0x42')](_0x187c2f[_0x2a4b('0x39')],_0x663fe8[_0x2a4b('0x3a')]),_0x164625);if(_0x187c2f[_0x2a4b('0x39')][_0x2a4b('0x43')]){_0x5d3022[_0x2a4b('0x41')]=_['merge'](_0x5d3022['where'],{'$or':_[_0x2a4b('0x33')](_0x164625,function(_0x209735){if(_0x209735[_0x2a4b('0x35')]!==_0x2a4b('0x44')){var _0x109355={};_0x109355[_0x209735[_0x2a4b('0x30')]]={'$like':'%'+_0x187c2f[_0x2a4b('0x39')][_0x2a4b('0x43')]+'%'};return _0x109355;}})});}_0x5d3022=_['merge']({},_0x5d3022,_0x187c2f[_0x2a4b('0x45')]);var _0xd4a98d={'where':_0x5d3022[_0x2a4b('0x41')]};return db[_0x2a4b('0x46')]['count'](_0xd4a98d)['then'](function(_0x332f2b){_0x380989[_0x2a4b('0x26')]=_0x332f2b;if(_0x187c2f['query'][_0x2a4b('0x47')]){_0x5d3022[_0x2a4b('0x48')]=[{'all':!![]}];}return db[_0x2a4b('0x46')]['findAll'](_0x5d3022);})[_0x2a4b('0x2b')](function(_0x523ed3){_0x380989['rows']=_0x523ed3;return _0x380989;})['then'](respondWithFilteredResult(_0x345ea7,_0x5d3022))[_0x2a4b('0x49')](handleError(_0x345ea7,null));};exports[_0x2a4b('0x4a')]=function(_0x2b9188,_0x445a72){var _0x532919={'raw':![],'where':{'id':_0x2b9188[_0x2a4b('0x4b')]['id']}},_0x587c94={};_0x587c94['model']=_['keys'](db[_0x2a4b('0x46')]['rawAttributes']);_0x587c94['query']=_[_0x2a4b('0x38')](_0x2b9188[_0x2a4b('0x39')]);_0x587c94['filters']=_['intersection'](_0x587c94[_0x2a4b('0x37')],_0x587c94[_0x2a4b('0x39')]);_0x532919[_0x2a4b('0x3c')]=_[_0x2a4b('0x3b')](_0x587c94[_0x2a4b('0x37')],qs[_0x2a4b('0x4c')](_0x2b9188[_0x2a4b('0x39')][_0x2a4b('0x4c')]));_0x532919[_0x2a4b('0x3c')]=_0x532919[_0x2a4b('0x3c')][_0x2a4b('0x3d')]?_0x532919['attributes']:_0x587c94['model'];if(_0x2b9188['query'][_0x2a4b('0x47')]){_0x532919[_0x2a4b('0x48')]=[{'all':!![]}];}_0x532919=_['merge']({},_0x532919,_0x2b9188['options']);return db[_0x2a4b('0x46')][_0x2a4b('0x4d')](_0x532919)['then'](handleEntityNotFound(_0x445a72,null))['then'](respondWithResult(_0x445a72,null))[_0x2a4b('0x49')](handleError(_0x445a72,null));};exports[_0x2a4b('0x4e')]=function(_0x2b76ba,_0x46c374){return db['Dashboard'][_0x2a4b('0x4e')](_0x2b76ba[_0x2a4b('0x4f')],{})[_0x2a4b('0x2b')](function(_0x2d6832){var _0x261cb7=_0x2b76ba[_0x2a4b('0x50')][_0x2a4b('0x2d')]({'plain':!![]});if(!_0x261cb7)throw new Error(_0x2a4b('0x51'));if(_0x261cb7[_0x2a4b('0x52')]===_0x2a4b('0x50')){var _0x3e394a=_0x2d6832['get']({'plain':!![]});var _0x3c795a=_0x2a4b('0x53');return db[_0x2a4b('0x54')][_0x2a4b('0x4d')]({'where':{'name':_0x3c795a,'userProfileId':_0x261cb7[_0x2a4b('0x55')]},'raw':!![]})['then'](function(_0x568952){if(_0x568952&&_0x568952[_0x2a4b('0x56')]===0x0){return db['UserProfileResource'][_0x2a4b('0x4e')]({'name':_0x3e394a[_0x2a4b('0x30')],'resourceId':_0x3e394a['id'],'type':_0x568952[_0x2a4b('0x30')],'sectionId':_0x568952['id']},{})['then'](function(){return _0x2d6832;});}else{return _0x2d6832;}})[_0x2a4b('0x49')](function(_0x987248){logger[_0x2a4b('0x2e')](_0x2a4b('0x57'),_0x987248);throw _0x987248;});}return _0x2d6832;})['then'](respondWithResult(_0x46c374,0xc9))[_0x2a4b('0x49')](handleError(_0x46c374,null));};exports[_0x2a4b('0x58')]=function(_0x479bb8,_0x41214b){var _0x17e5ba={'where':{'id':_0x479bb8[_0x2a4b('0x4b')]['id']}},_0x5b0608={};_0x5b0608[_0x2a4b('0x37')]=_[_0x2a4b('0x38')](db[_0x2a4b('0x46')][_0x2a4b('0x34')]);_0x17e5ba[_0x2a4b('0x3c')]=_[_0x2a4b('0x3b')](_0x5b0608[_0x2a4b('0x37')],qs[_0x2a4b('0x4c')](_0x479bb8[_0x2a4b('0x39')][_0x2a4b('0x4c')]));_0x17e5ba['attributes']=_0x17e5ba[_0x2a4b('0x3c')]['length']?_0x17e5ba[_0x2a4b('0x3c')]:_0x5b0608['model'];if(_0x479bb8[_0x2a4b('0x39')][_0x2a4b('0x47')]){_0x17e5ba[_0x2a4b('0x48')]=[{'all':!![]}];}_0x17e5ba=_[_0x2a4b('0x59')]({},_0x17e5ba,_0x479bb8[_0x2a4b('0x45')]);return db['Dashboard'][_0x2a4b('0x4d')](_0x17e5ba)[_0x2a4b('0x2b')](handleEntityNotFound(_0x41214b,null))[_0x2a4b('0x2b')](function(_0x83cfd7){if(_0x83cfd7){var _0x485d68=_0x83cfd7['get']({'plain':!![]});_0x485d68=qs['omit'](_0x485d68,['id',_0x2a4b('0x5a'),_0x2a4b('0x5b')]);_0x479bb8[_0x2a4b('0x4f')]=_[_0x2a4b('0x5c')](_0x479bb8['body'],['id',_0x2a4b('0x5a'),_0x2a4b('0x5b')]);return db[_0x2a4b('0x46')][_0x2a4b('0x4e')](_['merge'](_0x485d68,_0x479bb8[_0x2a4b('0x4f')]),{'include':_0x479bb8[_0x2a4b('0x39')]['includeAll']?[{'all':!![]}]:undefined})[_0x2a4b('0x2b')](function(_0x98b467){var _0x10a51b=_0x479bb8['user']['get']({'plain':!![]});if(!_0x10a51b)throw new Error(_0x2a4b('0x51'));if(_0x10a51b['role']===_0x2a4b('0x50')){var _0x23e5fc=_0x98b467['get']({'plain':!![]});var _0x3b6e21=_0x2a4b('0x53');return db[_0x2a4b('0x54')][_0x2a4b('0x4d')]({'where':{'name':_0x3b6e21,'userProfileId':_0x10a51b[_0x2a4b('0x55')]},'raw':!![]})['then'](function(_0x441e70){if(_0x441e70&&_0x441e70[_0x2a4b('0x56')]===0x0){return db[_0x2a4b('0x5d')][_0x2a4b('0x4e')]({'name':_0x23e5fc[_0x2a4b('0x30')],'resourceId':_0x23e5fc['id'],'type':_0x441e70[_0x2a4b('0x30')],'sectionId':_0x441e70['id']},{})[_0x2a4b('0x2b')](function(){return _0x98b467;});}else{return _0x98b467;}})[_0x2a4b('0x49')](function(_0x288e6b){logger[_0x2a4b('0x2e')](_0x2a4b('0x57'),_0x288e6b);throw _0x288e6b;});}return _0x98b467;});}})['then'](respondWithResult(_0x41214b,0xc9))[_0x2a4b('0x49')](handleError(_0x41214b,null));};exports['update']=function(_0x2065d5,_0x4917b3){if(_0x2065d5[_0x2a4b('0x4f')]['id']){delete _0x2065d5[_0x2a4b('0x4f')]['id'];}return db[_0x2a4b('0x46')][_0x2a4b('0x4d')]({'where':{'id':_0x2065d5[_0x2a4b('0x4b')]['id']}})[_0x2a4b('0x2b')](handleEntityNotFound(_0x4917b3,null))[_0x2a4b('0x2b')](saveUpdates(_0x2065d5[_0x2a4b('0x4f')],null))[_0x2a4b('0x2b')](respondWithResult(_0x4917b3,null))[_0x2a4b('0x49')](handleError(_0x4917b3,null));};exports['destroy']=function(_0x346adb,_0xa774ab){return db[_0x2a4b('0x46')]['find']({'where':{'id':_0x346adb['params']['id']}})['then'](handleEntityNotFound(_0xa774ab,null))[_0x2a4b('0x2b')](removeEntity(_0xa774ab,null))[_0x2a4b('0x49')](handleError(_0xa774ab,null));};function widgetAttributes(_0x43a800){try{switch(_0x43a800[_0x2a4b('0x35')]){case _0x2a4b('0x5e'):return[{'name':_0x2a4b('0x5f'),'value':_0x43a800[_0x2a4b('0x5f')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x0]?_0x43a800[_0x2a4b('0x60')][0x0][_0x2a4b('0x61')]:undefined)||_0x2a4b('0x62')}];case _0x2a4b('0x63'):return[{'name':_0x2a4b('0x64'),'value':_0x43a800[_0x2a4b('0x64')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x0]?_0x43a800[_0x2a4b('0x60')][0x0]['value']:undefined)||''}];case _0x2a4b('0x65'):return[{'name':'attrHourFormat','value':_0x43a800['attrHourFormat']||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800['attrs'][0x0]?_0x43a800[_0x2a4b('0x60')][0x0][_0x2a4b('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x2a4b('0x66'),'value':_0x43a800[_0x2a4b('0x66')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x1]?_0x43a800[_0x2a4b('0x60')][0x1]['value']:undefined)||'0.00'},{'name':_0x2a4b('0x67'),'value':_0x43a800[_0x2a4b('0x67')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x2]?_0x43a800[_0x2a4b('0x60')][0x2][_0x2a4b('0x61')]:undefined)||0xc}];case _0x2a4b('0x68'):return[{'name':_0x2a4b('0x69'),'value':_0x43a800['attrMetric']||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800['attrs'][0x0]?_0x43a800[_0x2a4b('0x60')][0x0][_0x2a4b('0x61')]:undefined)||_0x2a4b('0x6a')},{'name':_0x2a4b('0x6b'),'value':_0x43a800['attrVoiceQueues']||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x1]?_0x43a800[_0x2a4b('0x60')][0x1][_0x2a4b('0x61')]:undefined)||[]},{'name':_0x2a4b('0x67'),'value':_0x43a800[_0x2a4b('0x67')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x2]?_0x43a800[_0x2a4b('0x60')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x43a800[_0x2a4b('0x6c')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800['attrs'][0x3]?_0x43a800[_0x2a4b('0x60')][0x3][_0x2a4b('0x61')]:undefined)||_0x2a4b('0x6d')},{'name':_0x2a4b('0x6e'),'value':_0x43a800[_0x2a4b('0x6e')]||(_0x43a800['attrs']&&_0x43a800[_0x2a4b('0x60')][0x4]?_0x43a800['attrs'][0x4]['value']:undefined)||''},{'name':_0x2a4b('0x6f'),'value':_0x43a800[_0x2a4b('0x6f')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800['attrs'][0x5]?_0x43a800[_0x2a4b('0x60')][0x5][_0x2a4b('0x61')]:undefined)||''},{'name':_0x2a4b('0x70'),'value':_0x43a800[_0x2a4b('0x70')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x6]?_0x43a800['attrs'][0x6]['value']:undefined)||''},{'name':_0x2a4b('0x71'),'value':_0x43a800[_0x2a4b('0x71')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x7]?_0x43a800[_0x2a4b('0x60')][0x7][_0x2a4b('0x61')]:undefined)||''},{'name':_0x2a4b('0x72'),'value':_0x43a800[_0x2a4b('0x72')]||(_0x43a800['attrs']&&_0x43a800[_0x2a4b('0x60')][0x8]?_0x43a800['attrs'][0x8][_0x2a4b('0x61')]:undefined)||''},{'name':_0x2a4b('0x73'),'value':_0x43a800[_0x2a4b('0x73')]||(_0x43a800['attrs']&&_0x43a800[_0x2a4b('0x60')][0x9]?_0x43a800[_0x2a4b('0x60')][0x9][_0x2a4b('0x61')]:undefined)||''}];case _0x2a4b('0x74'):case'pie-chart':return[{'name':_0x2a4b('0x75'),'value':_0x43a800[_0x2a4b('0x75')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x0]?_0x43a800['attrs'][0x0][_0x2a4b('0x61')]:undefined)||'total'},{'name':_0x2a4b('0x76'),'value':_0x43a800[_0x2a4b('0x76')]||(_0x43a800['attrs']&&_0x43a800[_0x2a4b('0x60')][0x1]?_0x43a800['attrs'][0x1][_0x2a4b('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x43a800[_0x2a4b('0x77')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x2]?_0x43a800[_0x2a4b('0x60')][0x2][_0x2a4b('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x43a800[_0x2a4b('0x6b')]||(_0x43a800['attrs']&&_0x43a800[_0x2a4b('0x60')][0x3]?_0x43a800['attrs'][0x3][_0x2a4b('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0x43a800[_0x2a4b('0x6c')]||(_0x43a800['attrs']&&_0x43a800[_0x2a4b('0x60')][0x4]?_0x43a800[_0x2a4b('0x60')][0x4][_0x2a4b('0x61')]:undefined)||'voice'},{'name':_0x2a4b('0x6e'),'value':_0x43a800[_0x2a4b('0x6e')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x5]?_0x43a800['attrs'][0x5][_0x2a4b('0x61')]:undefined)||''},{'name':_0x2a4b('0x6f'),'value':_0x43a800[_0x2a4b('0x6f')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800['attrs'][0x6]?_0x43a800[_0x2a4b('0x60')][0x6][_0x2a4b('0x61')]:undefined)||''},{'name':_0x2a4b('0x70'),'value':_0x43a800[_0x2a4b('0x70')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x7]?_0x43a800[_0x2a4b('0x60')][0x7]['value']:undefined)||''},{'name':_0x2a4b('0x71'),'value':_0x43a800['attrOpenchannelAccounts']||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x8]?_0x43a800[_0x2a4b('0x60')][0x8][_0x2a4b('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x43a800['attrWhatsappAccounts']||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800['attrs'][0x9]?_0x43a800[_0x2a4b('0x60')][0x9][_0x2a4b('0x61')]:undefined)||''},{'name':_0x2a4b('0x73'),'value':_0x43a800[_0x2a4b('0x73')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0xa]?_0x43a800[_0x2a4b('0x60')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x2a4b('0x78'),'type':_0x43a800[_0x2a4b('0x79')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x0]?_0x43a800[_0x2a4b('0x60')][0x0][_0x2a4b('0x35')]:undefined)||null,'value':_0x43a800[_0x2a4b('0x78')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x0]?_0x43a800['attrs'][0x0][_0x2a4b('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x43a800[_0x2a4b('0x7a')]||(_0x43a800[_0x2a4b('0x60')]&&_0x43a800[_0x2a4b('0x60')][0x1]?_0x43a800[_0x2a4b('0x60')][0x1][_0x2a4b('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x1475e4){logger[_0x2a4b('0x2e')](_0x2a4b('0x7b'),JSON[_0x2a4b('0x7c')](_0x1475e4));return[];}}exports[_0x2a4b('0x7d')]=function(_0x2ba9c4,_0x130255,_0x265718){if(_0x2ba9c4[_0x2a4b('0x4f')]['id']){delete _0x2ba9c4[_0x2a4b('0x4f')]['id'];}return db['Dashboard'][_0x2a4b('0x4d')]({'where':{'id':_0x2ba9c4[_0x2a4b('0x4b')]['id']}})[_0x2a4b('0x2b')](handleEntityNotFound(_0x130255,null))[_0x2a4b('0x2b')](function(_0x2748c9){if(_0x2748c9){_0x2ba9c4[_0x2a4b('0x4f')][_0x2a4b('0x7e')]=_0x2748c9['id'];_0x2ba9c4[_0x2a4b('0x4f')][_0x2a4b('0x60')]=widgetAttributes(_0x2ba9c4[_0x2a4b('0x4f')]);return db[_0x2a4b('0x7f')]['create'](_0x2ba9c4[_0x2a4b('0x4f')]);}})[_0x2a4b('0x2b')](respondWithResult(_0x130255,null))[_0x2a4b('0x49')](handleError(_0x130255,null));};exports['getItems']=function(_0x572e81,_0x4607a6,_0x119279){var _0x2fb06a={};var _0x1fa7cf={};var _0x1b39a8;var _0x1d4a93;return db[_0x2a4b('0x46')][_0x2a4b('0x80')]({'where':{'id':_0x572e81[_0x2a4b('0x4b')]['id']}})[_0x2a4b('0x2b')](handleEntityNotFound(_0x4607a6,null))[_0x2a4b('0x2b')](function(_0x453e5e){if(_0x453e5e){_0x1b39a8=_0x453e5e;_0x1fa7cf[_0x2a4b('0x37')]=_['keys'](db[_0x2a4b('0x7f')][_0x2a4b('0x34')]);_0x1fa7cf[_0x2a4b('0x39')]=_[_0x2a4b('0x38')](_0x572e81[_0x2a4b('0x39')]);_0x1fa7cf[_0x2a4b('0x3a')]=_[_0x2a4b('0x3b')](_0x1fa7cf[_0x2a4b('0x37')],_0x1fa7cf[_0x2a4b('0x39')]);_0x2fb06a['attributes']=_['intersection'](_0x1fa7cf[_0x2a4b('0x37')],qs[_0x2a4b('0x4c')](_0x572e81[_0x2a4b('0x39')][_0x2a4b('0x4c')]));_0x2fb06a[_0x2a4b('0x3c')]=_0x2fb06a[_0x2a4b('0x3c')][_0x2a4b('0x3d')]?_0x2fb06a[_0x2a4b('0x3c')]:_0x1fa7cf[_0x2a4b('0x37')];_0x2fb06a[_0x2a4b('0x3f')]=qs[_0x2a4b('0x40')](_0x572e81[_0x2a4b('0x39')][_0x2a4b('0x40')]);_0x2fb06a[_0x2a4b('0x41')]=qs['filters'](_[_0x2a4b('0x42')](_0x572e81[_0x2a4b('0x39')],_0x1fa7cf[_0x2a4b('0x3a')]));if(_0x572e81['query']['filter']){_0x2fb06a[_0x2a4b('0x41')]=_[_0x2a4b('0x59')](_0x2fb06a[_0x2a4b('0x41')],{'$or':_[_0x2a4b('0x33')](_0x2fb06a['attributes'],function(_0x3f8965){var _0x53856a={};_0x53856a[_0x3f8965]={'$like':'%'+_0x572e81['query'][_0x2a4b('0x43')]+'%'};return _0x53856a;})});}_0x2fb06a=_['merge']({},_0x2fb06a,_0x572e81[_0x2a4b('0x45')]);return _0x1b39a8[_0x2a4b('0x81')](_0x2fb06a);}})['then'](function(_0x5a984b){if(_0x5a984b){_0x1d4a93=_0x5a984b[_0x2a4b('0x3d')];if(!_0x572e81[_0x2a4b('0x39')][_0x2a4b('0x82')](_0x2a4b('0x3e'))){_0x2fb06a[_0x2a4b('0x25')]=qs[_0x2a4b('0x25')](_0x572e81[_0x2a4b('0x39')]['limit']);_0x2fb06a[_0x2a4b('0x23')]=qs[_0x2a4b('0x23')](_0x572e81[_0x2a4b('0x39')]['offset']);}return _0x1b39a8[_0x2a4b('0x81')](_0x2fb06a);}})['then'](function(_0xc2a0e3){if(_0xc2a0e3){return _0xc2a0e3?{'count':_0x1d4a93,'rows':_0xc2a0e3}:null;}})[_0x2a4b('0x2b')](respondWithResult(_0x4607a6,null))[_0x2a4b('0x49')](handleError(_0x4607a6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 3d9d47f..e1767ec 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 _0x241f=['exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3b1574,_0x4079cb){var _0x43ecd4=function(_0x302ac0){while(--_0x302ac0){_0x3b1574['push'](_0x3b1574['shift']());}};_0x43ecd4(++_0x4079cb);}(_0x241f,0x169));var _0xf241=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0x241f[_0x481df5];return _0x32726e;};'use strict';var EventEmitter=require(_0xf241('0x0'));var Dashboard=require(_0xf241('0x1'))['db'][_0xf241('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf241('0x3')](0x0);var events={'afterCreate':_0xf241('0x4'),'afterUpdate':'update','afterDestroy':_0xf241('0x5')};function emitEvent(_0x4a803e){return function(_0x164cab,_0x433f61,_0x570d5e){DashboardEvents[_0xf241('0x6')](_0x4a803e+':'+_0x164cab['id'],_0x164cab);DashboardEvents[_0xf241('0x6')](_0x4a803e,_0x164cab);_0x570d5e(null);};}for(var e in events){if(events[_0xf241('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xf241('0x8')]=DashboardEvents; \ No newline at end of file +var _0x09d5=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x09d5,0x192));var _0x509d=function(_0x439f4e,_0x3ecd69){_0x439f4e=_0x439f4e-0x0;var _0x33aec4=_0x09d5[_0x439f4e];return _0x33aec4;};'use strict';var EventEmitter=require(_0x509d('0x0'));var Dashboard=require(_0x509d('0x1'))['db'][_0x509d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x509d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x509d('0x4'),'afterDestroy':_0x509d('0x5')};function emitEvent(_0x3faff8){return function(_0x7ffd12,_0x73acee,_0x55d0cf){DashboardEvents['emit'](_0x3faff8+':'+_0x7ffd12['id'],_0x7ffd12);DashboardEvents[_0x509d('0x6')](_0x3faff8,_0x7ffd12);_0x55d0cf(null);};}for(var e in events){if(events[_0x509d('0x7')](e)){var event=events[e];Dashboard[_0x509d('0x8')](e,emitEvent(event));}}module[_0x509d('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2f57288..f536705 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 _0xb347=['dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define'];(function(_0x556b28,_0x46061b){var _0x23bfc1=function(_0x27bf7d){while(--_0x27bf7d){_0x556b28['push'](_0x556b28['shift']());}};_0x23bfc1(++_0x46061b);}(_0xb347,0x199));var _0x7b34=function(_0x3864e4,_0x21ada0){_0x3864e4=_0x3864e4-0x0;var _0xb8f719=_0xb347[_0x3864e4];return _0xb8f719;};'use strict';var _=require(_0x7b34('0x0'));var util=require(_0x7b34('0x1'));var logger=require(_0x7b34('0x2'))(_0x7b34('0x3'));var moment=require('moment');var BPromise=require(_0x7b34('0x4'));var rp=require(_0x7b34('0x5'));var fs=require('fs');var path=require(_0x7b34('0x6'));var rimraf=require(_0x7b34('0x7'));var config=require(_0x7b34('0x8'));var attributes=require(_0x7b34('0x9'));module['exports']=function(_0x308128,_0xa8ece0){return _0x308128[_0x7b34('0xa')]('Dashboard',attributes,{'tableName':_0x7b34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34d9=['request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','util','api','moment'];(function(_0x2138ca,_0x180aac){var _0x2650de=function(_0x2446ba){while(--_0x2446ba){_0x2138ca['push'](_0x2138ca['shift']());}};_0x2650de(++_0x180aac);}(_0x34d9,0x104));var _0x934d=function(_0x568908,_0x13e599){_0x568908=_0x568908-0x0;var _0x459d3b=_0x34d9[_0x568908];return _0x459d3b;};'use strict';var _=require(_0x934d('0x0'));var util=require(_0x934d('0x1'));var logger=require('../../config/logger')(_0x934d('0x2'));var moment=require(_0x934d('0x3'));var BPromise=require('bluebird');var rp=require(_0x934d('0x4'));var fs=require('fs');var path=require(_0x934d('0x5'));var rimraf=require(_0x934d('0x6'));var config=require(_0x934d('0x7'));var attributes=require(_0x934d('0x8'));module[_0x934d('0x9')]=function(_0x11b073,_0x416b98){return _0x11b073['define'](_0x934d('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index acd9423..5fc6402 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 _0x6a3b=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6a3b,0x134));var _0xb6a3=function(_0x254390,_0x3ca0e1){_0x254390=_0x254390-0x0;var _0x6ed875=_0x6a3b[_0x254390];return _0x6ed875;};'use strict';var _=require('lodash');var util=require(_0xb6a3('0x0'));var moment=require(_0xb6a3('0x1'));var BPromise=require(_0xb6a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6a3('0x4'));var logger=require(_0xb6a3('0x5'))(_0xb6a3('0x6'));var config=require(_0xb6a3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb6a3('0x8')][_0xb6a3('0x9')]({'port':0x232a});config[_0xb6a3('0xa')]=_[_0xb6a3('0xb')](config[_0xb6a3('0xa')],{'host':_0xb6a3('0xc'),'port':0x18eb});var socket=require(_0xb6a3('0xd'))(new Redis(config['redis']));require('./dashboard.socket')[_0xb6a3('0xe')](socket);function respondWithRpcPromise(_0x12376b,_0x41f50e,_0x168350){return new BPromise(function(_0x40ada8,_0x4d4478){return client[_0xb6a3('0xf')](_0x12376b,_0x168350)[_0xb6a3('0x10')](function(_0x807edb){logger[_0xb6a3('0x11')](_0xb6a3('0x12'),_0x41f50e,'request\x20sent');logger[_0xb6a3('0x13')](_0xb6a3('0x14'),_0x41f50e,'request\x20sent',JSON[_0xb6a3('0x15')](_0x807edb));if(_0x807edb[_0xb6a3('0x16')]){if(_0x807edb['error'][_0xb6a3('0x17')]===0x1f4){logger[_0xb6a3('0x16')](_0xb6a3('0x12'),_0x41f50e,_0x807edb[_0xb6a3('0x16')]['message']);return _0x4d4478(_0x807edb[_0xb6a3('0x16')][_0xb6a3('0x18')]);}logger[_0xb6a3('0x16')](_0xb6a3('0x12'),_0x41f50e,_0x807edb[_0xb6a3('0x16')][_0xb6a3('0x18')]);return _0x40ada8(_0x807edb['error'][_0xb6a3('0x18')]);}else{logger[_0xb6a3('0x11')](_0xb6a3('0x12'),_0x41f50e,_0xb6a3('0x19'));_0x40ada8(_0x807edb[_0xb6a3('0x1a')][_0xb6a3('0x18')]);}})[_0xb6a3('0x1b')](function(_0x333a7d){logger[_0xb6a3('0x16')]('Dashboard,\x20%s,\x20%s',_0x41f50e,_0x333a7d);_0x4d4478(_0x333a7d);});});} \ No newline at end of file +var _0x239a=['register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x239a,0x1be));var _0xa239=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x239a[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xa239('0x0'));var moment=require('moment');var BPromise=require(_0xa239('0x1'));var rs=require(_0xa239('0x2'));var fs=require('fs');var Redis=require(_0xa239('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa239('0x4'));var logger=require('../../config/logger')(_0xa239('0x5'));var config=require(_0xa239('0x6'));var jayson=require(_0xa239('0x7'));var client=jayson[_0xa239('0x8')][_0xa239('0x9')]({'port':0x232a});config[_0xa239('0xa')]=_['defaults'](config['redis'],{'host':_0xa239('0xb'),'port':0x18eb});var socket=require(_0xa239('0xc'))(new Redis(config[_0xa239('0xa')]));require(_0xa239('0xd'))[_0xa239('0xe')](socket);function respondWithRpcPromise(_0x504ff8,_0x33298d,_0x4f1332){return new BPromise(function(_0x28cc2f,_0x28ea5c){return client['request'](_0x504ff8,_0x4f1332)[_0xa239('0xf')](function(_0x384dc4){logger[_0xa239('0x10')](_0xa239('0x11'),_0x33298d,_0xa239('0x12'));logger[_0xa239('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x33298d,_0xa239('0x12'),JSON['stringify'](_0x384dc4));if(_0x384dc4[_0xa239('0x14')]){if(_0x384dc4[_0xa239('0x14')][_0xa239('0x15')]===0x1f4){logger['error'](_0xa239('0x11'),_0x33298d,_0x384dc4[_0xa239('0x14')][_0xa239('0x16')]);return _0x28ea5c(_0x384dc4[_0xa239('0x14')][_0xa239('0x16')]);}logger['error'](_0xa239('0x11'),_0x33298d,_0x384dc4[_0xa239('0x14')]['message']);return _0x28cc2f(_0x384dc4[_0xa239('0x14')][_0xa239('0x16')]);}else{logger[_0xa239('0x10')]('Dashboard,\x20%s,\x20%s',_0x33298d,_0xa239('0x12'));_0x28cc2f(_0x384dc4['result']['message']);}})['catch'](function(_0x4f580b){logger[_0xa239('0x14')](_0xa239('0x11'),_0x33298d,_0x4f580b);_0x28ea5c(_0x4f580b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 154977d..b8ac0bd 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 _0xe602=['save','update','emit','removeListener','register','dashboard:','./dashboard.events'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0xe602,0x1f0));var _0x2e60=function(_0x4c8e70,_0x59bf61){_0x4c8e70=_0x4c8e70-0x0;var _0x4e5d38=_0xe602[_0x4c8e70];return _0x4e5d38;};'use strict';var DashboardEvents=require(_0x2e60('0x0'));var events=[_0x2e60('0x1'),'remove',_0x2e60('0x2')];function createListener(_0x5478c8,_0xf704fc){return function(_0x3d7132){_0xf704fc[_0x2e60('0x3')](_0x5478c8,_0x3d7132);};}function removeListener(_0x5bdeba,_0x15a0d9){return function(){DashboardEvents[_0x2e60('0x4')](_0x5bdeba,_0x15a0d9);};}exports[_0x2e60('0x5')]=function(_0x2fda2c){for(var _0xc0b563=0x0,_0x218678=events['length'];_0xc0b563<_0x218678;_0xc0b563++){var _0x1c1716=events[_0xc0b563];var _0x1f448f=createListener(_0x2e60('0x6')+_0x1c1716,_0x2fda2c);DashboardEvents['on'](_0x1c1716,_0x1f448f);}}; \ No newline at end of file +var _0xaaa2=['removeListener','./dashboard.events','save','remove','update','emit'];(function(_0xe26a92,_0x598725){var _0x4c8d65=function(_0x30be03){while(--_0x30be03){_0xe26a92['push'](_0xe26a92['shift']());}};_0x4c8d65(++_0x598725);}(_0xaaa2,0x1ab));var _0x2aaa=function(_0x15299c,_0x4d0921){_0x15299c=_0x15299c-0x0;var _0x66213f=_0xaaa2[_0x15299c];return _0x66213f;};'use strict';var DashboardEvents=require(_0x2aaa('0x0'));var events=[_0x2aaa('0x1'),_0x2aaa('0x2'),_0x2aaa('0x3')];function createListener(_0x1b178c,_0x27166a){return function(_0x3b46c1){_0x27166a[_0x2aaa('0x4')](_0x1b178c,_0x3b46c1);};}function removeListener(_0x287659,_0x5c4113){return function(){DashboardEvents[_0x2aaa('0x5')](_0x287659,_0x5c4113);};}exports['register']=function(_0x1f5c5b){for(var _0x3b353c=0x0,_0x1a0aa7=events['length'];_0x3b353c<_0x1a0aa7;_0x3b353c++){var _0x1f3203=events[_0x3b353c];var _0x24aa1a=createListener('dashboard:'+_0x1f3203,_0x1f5c5b);DashboardEvents['on'](_0x1f3203,_0x24aa1a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 656f68a..8eef1d9 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 _0xa181=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','/:id/clone','clone','/:id/items','addItem','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5652c1,_0x31d683){var _0x37a92e=function(_0x18f6bb){while(--_0x18f6bb){_0x5652c1['push'](_0x5652c1['shift']());}};_0x37a92e(++_0x31d683);}(_0xa181,0x149));var _0x1a18=function(_0x2201fc,_0x121138){_0x2201fc=_0x2201fc-0x0;var _0x21fcee=_0xa181[_0x2201fc];return _0x21fcee;};'use strict';var multer=require(_0x1a18('0x0'));var util=require(_0x1a18('0x1'));var path=require(_0x1a18('0x2'));var timeout=require(_0x1a18('0x3'));var express=require(_0x1a18('0x4'));var router=express[_0x1a18('0x5')]();var fs_extra=require(_0x1a18('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1a18('0x7'));var config=require(_0x1a18('0x8'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x1a18('0x9')](),controller[_0x1a18('0xa')]);router[_0x1a18('0xb')](_0x1a18('0xc'),auth[_0x1a18('0x9')](),controller[_0x1a18('0xd')]);router['get']('/:id/items',auth[_0x1a18('0x9')](),controller['getItems']);router[_0x1a18('0xe')]('/',auth[_0x1a18('0x9')](),controller[_0x1a18('0xf')]);router[_0x1a18('0xe')](_0x1a18('0x10'),auth[_0x1a18('0x9')](),controller[_0x1a18('0x11')]);router[_0x1a18('0xe')](_0x1a18('0x12'),auth['isAuthenticated'](),controller[_0x1a18('0x13')]);router[_0x1a18('0x14')](_0x1a18('0xc'),auth[_0x1a18('0x9')](),controller[_0x1a18('0x15')]);router[_0x1a18('0x16')](_0x1a18('0xc'),auth[_0x1a18('0x9')](),controller['destroy']);module[_0x1a18('0x17')]=router; \ No newline at end of file +var _0xb358=['path','express','Router','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util'];(function(_0x2512fd,_0x45ded2){var _0x22b790=function(_0x21a9a7){while(--_0x21a9a7){_0x2512fd['push'](_0x2512fd['shift']());}};_0x22b790(++_0x45ded2);}(_0xb358,0x1e1));var _0x8b35=function(_0x323b6c,_0x263e71){_0x323b6c=_0x323b6c-0x0;var _0x124c3e=_0xb358[_0x323b6c];return _0x124c3e;};'use strict';var multer=require(_0x8b35('0x0'));var util=require(_0x8b35('0x1'));var path=require(_0x8b35('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b35('0x3'));var router=express[_0x8b35('0x4')]();var fs_extra=require(_0x8b35('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b35('0x6'));var controller=require(_0x8b35('0x7'));router[_0x8b35('0x8')]('/',auth[_0x8b35('0x9')](),controller['index']);router[_0x8b35('0x8')](_0x8b35('0xa'),auth['isAuthenticated'](),controller[_0x8b35('0xb')]);router[_0x8b35('0x8')](_0x8b35('0xc'),auth[_0x8b35('0x9')](),controller['getItems']);router[_0x8b35('0xd')]('/',auth[_0x8b35('0x9')](),controller[_0x8b35('0xe')]);router[_0x8b35('0xd')](_0x8b35('0xf'),auth[_0x8b35('0x9')](),controller[_0x8b35('0x10')]);router['post'](_0x8b35('0xc'),auth[_0x8b35('0x9')](),controller[_0x8b35('0x11')]);router[_0x8b35('0x12')](_0x8b35('0xa'),auth[_0x8b35('0x9')](),controller[_0x8b35('0x13')]);router[_0x8b35('0x14')](_0x8b35('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b653166..7f0d7c5 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 _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x526f1a,_0x5249db){var _0x3158e5=function(_0x2c7613){while(--_0x2c7613){_0x526f1a['push'](_0x526f1a['shift']());}};_0x3158e5(++_0x5249db);}(_0x5fab,0x177));var _0xb5fa=function(_0x27c69b,_0x4cbe55){_0x27c69b=_0x27c69b-0x0;var _0x198ac4=_0x5fab[_0x27c69b];return _0x198ac4;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1623=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','exports','STRING','TEXT','long'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x1623,0xab));var _0x3162=function(_0x32c188,_0x276eac){_0x32c188=_0x32c188-0x0;var _0x491d63=_0x1623[_0x32c188];return _0x491d63;};'use strict';var Sequelize=require(_0x3162('0x0'));var squel=require('squel');var _=require('lodash');module[_0x3162('0x1')]={'title':{'type':Sequelize[_0x3162('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x3162('0x5')));}catch(_0x4b77c4){return[];}},'set':function(_0x1b55f2){try{this[_0x3162('0x6')]('attrs',JSON[_0x3162('0x7')](_0x1b55f2));}catch(_0x2dc07e){this[_0x3162('0x6')](_0x3162('0x5'),JSON[_0x3162('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3162('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3162('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3162('0x2')],'allowNull':![],'defaultValue':_0x3162('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3162('0x2')]},'titleFontSize':{'type':Sequelize[_0x3162('0x8')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8ca09e5..2cfb432 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 _0x482d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','send','show','params','keys','DashboardItem','rawAttributes','filters','intersection','model','query','attributes','includeAll','include','merge','options','catch','find','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','stringify','body','create','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','desk.js'];(function(_0x57524e,_0x236f11){var _0x4a0867=function(_0x472b27){while(--_0x472b27){_0x57524e['push'](_0x57524e['shift']());}};_0x4a0867(++_0x236f11);}(_0x482d,0x16c));var _0xd482=function(_0x36fc53,_0x4f2426){_0x36fc53=_0x36fc53-0x0;var _0x157821=_0x482d[_0x36fc53];return _0x157821;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd482('0x0'));var jsonpatch=require(_0xd482('0x1'));var rp=require(_0xd482('0x2'));var moment=require(_0xd482('0x3'));var BPromise=require(_0xd482('0x4'));var Mustache=require(_0xd482('0x5'));var util=require('util');var path=require(_0xd482('0x6'));var sox=require(_0xd482('0x7'));var csv=require(_0xd482('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd482('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd482('0xa'));var deskjs=require(_0xd482('0xb'));var toCsv=require(_0xd482('0x8'));var querystring=require('querystring');var Papa=require(_0xd482('0xc'));var Redis=require(_0xd482('0xd'));var authService=require(_0xd482('0xe'));var qs=require(_0xd482('0xf'));var as=require(_0xd482('0x10'));var hardwareService=require(_0xd482('0x11'));var logger=require(_0xd482('0x12'))(_0xd482('0x13'));var utils=require('../../config/utils');var config=require(_0xd482('0x14'));var licenseUtil=require(_0xd482('0x15'));var db=require(_0xd482('0x16'))['db'];config[_0xd482('0x17')]=_['defaults'](config[_0xd482('0x17')],{'host':_0xd482('0x18'),'port':0x18eb});var socket=require(_0xd482('0x19'))(new Redis(config['redis']));require(_0xd482('0x1a'))['register'](socket);function respondWithStatusCode(_0x5c5eaa,_0x2aa7f4){_0x2aa7f4=_0x2aa7f4||0xcc;return function(_0x5420dc){if(_0x5420dc){return _0x5c5eaa[_0xd482('0x1b')](_0x2aa7f4);}return _0x5c5eaa[_0xd482('0x1c')](_0x2aa7f4)['end']();};}function respondWithResult(_0x3f4c2f,_0x138422){_0x138422=_0x138422||0xc8;return function(_0x319c97){if(_0x319c97){return _0x3f4c2f[_0xd482('0x1c')](_0x138422)[_0xd482('0x1d')](_0x319c97);}};}function respondWithFilteredResult(_0x499dbc,_0x3d48c3){return function(_0x1816b7){if(_0x1816b7){var _0x3914b8=typeof _0x3d48c3['offset']===_0xd482('0x1e')&&typeof _0x3d48c3[_0xd482('0x1f')]===_0xd482('0x1e');var _0x155c35=_0x1816b7[_0xd482('0x20')];var _0x545b11=_0x3914b8?0x0:_0x3d48c3['offset'];var _0x4e3abc=_0x3914b8?_0x1816b7[_0xd482('0x20')]:_0x3d48c3[_0xd482('0x21')]+_0x3d48c3[_0xd482('0x1f')];var _0x5510cd;if(_0x4e3abc>=_0x155c35){_0x4e3abc=_0x155c35;_0x5510cd=0xc8;}else{_0x5510cd=0xce;}_0x499dbc[_0xd482('0x1c')](_0x5510cd);return _0x499dbc[_0xd482('0x22')](_0xd482('0x23'),_0x545b11+'-'+_0x4e3abc+'/'+_0x155c35)[_0xd482('0x1d')](_0x1816b7);}return null;};}function patchUpdates(_0x76b6ea){return function(_0x441525){try{jsonpatch[_0xd482('0x24')](_0x441525,_0x76b6ea,!![]);}catch(_0x305251){return BPromise['reject'](_0x305251);}return _0x441525[_0xd482('0x25')]();};}function saveUpdates(_0x34c646,_0x3adcb5){return function(_0xc3fb6e){if(_0xc3fb6e){return _0xc3fb6e[_0xd482('0x26')](_0x34c646)[_0xd482('0x27')](function(_0x1e68c2){return _0x1e68c2;});}return null;};}function removeEntity(_0x1545d8,_0x5075b7){return function(_0x4d9351){if(_0x4d9351){return _0x4d9351[_0xd482('0x28')]()['then'](function(){_0x1545d8[_0xd482('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ce2d,_0x5e4bed){return function(_0x11ca6d){if(!_0x11ca6d){_0x47ce2d[_0xd482('0x1b')](0x194);}return _0x11ca6d;};}function handleError(_0x400cbc,_0x120906){_0x120906=_0x120906||0x1f4;return function(_0x3654fa){logger[_0xd482('0x29')](_0x3654fa[_0xd482('0x2a')]);if(_0x3654fa['name']){delete _0x3654fa['name'];}_0x400cbc[_0xd482('0x1c')](_0x120906)[_0xd482('0x2b')](_0x3654fa);};}exports[_0xd482('0x2c')]=function(_0x51d858,_0x5905c8){var _0x43f952={'raw':![],'where':{'id':_0x51d858[_0xd482('0x2d')]['id']}},_0x39f753={};_0x39f753['model']=_[_0xd482('0x2e')](db[_0xd482('0x2f')][_0xd482('0x30')]);_0x39f753['query']=_[_0xd482('0x2e')](_0x51d858['query']);_0x39f753[_0xd482('0x31')]=_[_0xd482('0x32')](_0x39f753[_0xd482('0x33')],_0x39f753[_0xd482('0x34')]);_0x43f952['attributes']=_[_0xd482('0x32')](_0x39f753[_0xd482('0x33')],qs['fields'](_0x51d858[_0xd482('0x34')]['fields']));_0x43f952[_0xd482('0x35')]=_0x43f952['attributes']['length']?_0x43f952['attributes']:_0x39f753[_0xd482('0x33')];if(_0x51d858['query'][_0xd482('0x36')]){_0x43f952[_0xd482('0x37')]=[{'all':!![]}];}_0x43f952=_[_0xd482('0x38')]({},_0x43f952,_0x51d858[_0xd482('0x39')]);return db[_0xd482('0x2f')]['find'](_0x43f952)[_0xd482('0x27')](handleEntityNotFound(_0x5905c8,null))[_0xd482('0x27')](respondWithResult(_0x5905c8,null))[_0xd482('0x3a')](handleError(_0x5905c8,null));};exports[_0xd482('0x28')]=function(_0x1ce476,_0x2566a9){return db[_0xd482('0x2f')][_0xd482('0x3b')]({'where':{'id':_0x1ce476['params']['id']}})['then'](handleEntityNotFound(_0x2566a9,null))[_0xd482('0x27')](removeEntity(_0x2566a9,null))[_0xd482('0x3a')](handleError(_0x2566a9,null));};function widgetAttributes(_0x3d4440){try{switch(_0x3d4440['type']){case'iframe':return[{'name':_0xd482('0x3c'),'value':_0x3d4440[_0xd482('0x3c')]||(_0x3d4440['attrs']&&_0x3d4440['attrs'][0x0]?_0x3d4440[_0xd482('0x3d')][0x0][_0xd482('0x3e')]:undefined)||_0xd482('0x3f')}];case _0xd482('0x40'):return[{'name':_0xd482('0x41'),'value':_0x3d4440[_0xd482('0x41')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440['attrs'][0x0]?_0x3d4440[_0xd482('0x3d')][0x0][_0xd482('0x3e')]:undefined)||''}];case _0xd482('0x42'):return[{'name':_0xd482('0x43'),'value':_0x3d4440['attrHourFormat']||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x0]?_0x3d4440[_0xd482('0x3d')][0x0][_0xd482('0x3e')]:undefined)||_0xd482('0x44')},{'name':_0xd482('0x45'),'value':_0x3d4440['attrTimezone']||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440['attrs'][0x1]?_0x3d4440['attrs'][0x1][_0xd482('0x3e')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3d4440[_0xd482('0x46')]||(_0x3d4440['attrs']&&_0x3d4440[_0xd482('0x3d')][0x2]?_0x3d4440[_0xd482('0x3d')][0x2][_0xd482('0x3e')]:undefined)||0xc}];case _0xd482('0x47'):return[{'name':'attrMetric','value':_0x3d4440[_0xd482('0x48')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x0]?_0x3d4440[_0xd482('0x3d')][0x0]['value']:undefined)||_0xd482('0x49')},{'name':_0xd482('0x4a'),'value':_0x3d4440['attrVoiceQueues']||(_0x3d4440['attrs']&&_0x3d4440[_0xd482('0x3d')][0x1]?_0x3d4440[_0xd482('0x3d')][0x1][_0xd482('0x3e')]:undefined)||[]},{'name':_0xd482('0x46'),'value':_0x3d4440['attrFontSize']||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x2]?_0x3d4440['attrs'][0x2][_0xd482('0x3e')]:undefined)||0x14},{'name':_0xd482('0x4b'),'value':_0x3d4440[_0xd482('0x4b')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x3]?_0x3d4440[_0xd482('0x3d')][0x3][_0xd482('0x3e')]:undefined)||_0xd482('0x4c')},{'name':_0xd482('0x4d'),'value':_0x3d4440[_0xd482('0x4d')]||(_0x3d4440['attrs']&&_0x3d4440[_0xd482('0x3d')][0x4]?_0x3d4440[_0xd482('0x3d')][0x4][_0xd482('0x3e')]:undefined)||''},{'name':_0xd482('0x4e'),'value':_0x3d4440[_0xd482('0x4e')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x5]?_0x3d4440[_0xd482('0x3d')][0x5][_0xd482('0x3e')]:undefined)||''},{'name':_0xd482('0x4f'),'value':_0x3d4440['attrSmsAccounts']||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x6]?_0x3d4440['attrs'][0x6][_0xd482('0x3e')]:undefined)||''},{'name':_0xd482('0x50'),'value':_0x3d4440['attrOpenchannelAccounts']||(_0x3d4440['attrs']&&_0x3d4440['attrs'][0x7]?_0x3d4440[_0xd482('0x3d')][0x7]['value']:undefined)||''},{'name':_0xd482('0x51'),'value':_0x3d4440[_0xd482('0x51')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x8]?_0x3d4440['attrs'][0x8][_0xd482('0x3e')]:undefined)||''},{'name':_0xd482('0x52'),'value':_0x3d4440[_0xd482('0x52')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x9]?_0x3d4440['attrs'][0x9][_0xd482('0x3e')]:undefined)||''}];case _0xd482('0x53'):case _0xd482('0x54'):return[{'name':_0xd482('0x55'),'value':_0x3d4440[_0xd482('0x55')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440['attrs'][0x0]?_0x3d4440[_0xd482('0x3d')][0x0][_0xd482('0x3e')]:undefined)||'total'},{'name':_0xd482('0x56'),'value':_0x3d4440['attrSerie2']||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x1]?_0x3d4440[_0xd482('0x3d')][0x1]['value']:undefined)||null},{'name':_0xd482('0x57'),'value':_0x3d4440[_0xd482('0x57')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x2]?_0x3d4440['attrs'][0x2][_0xd482('0x3e')]:undefined)||null},{'name':_0xd482('0x4a'),'value':_0x3d4440[_0xd482('0x4a')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x3]?_0x3d4440[_0xd482('0x3d')][0x3][_0xd482('0x3e')]:undefined)||[]},{'name':_0xd482('0x4b'),'value':_0x3d4440['attrChannel']||(_0x3d4440['attrs']&&_0x3d4440[_0xd482('0x3d')][0x4]?_0x3d4440['attrs'][0x4][_0xd482('0x3e')]:undefined)||_0xd482('0x4c')},{'name':_0xd482('0x4d'),'value':_0x3d4440[_0xd482('0x4d')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x5]?_0x3d4440[_0xd482('0x3d')][0x5][_0xd482('0x3e')]:undefined)||''},{'name':_0xd482('0x4e'),'value':_0x3d4440[_0xd482('0x4e')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x6]?_0x3d4440[_0xd482('0x3d')][0x6]['value']:undefined)||''},{'name':_0xd482('0x4f'),'value':_0x3d4440[_0xd482('0x4f')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440['attrs'][0x7]?_0x3d4440[_0xd482('0x3d')][0x7]['value']:undefined)||''},{'name':_0xd482('0x50'),'value':_0x3d4440[_0xd482('0x50')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x8]?_0x3d4440[_0xd482('0x3d')][0x8][_0xd482('0x3e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3d4440[_0xd482('0x51')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440['attrs'][0x9]?_0x3d4440[_0xd482('0x3d')][0x9]['value']:undefined)||''},{'name':_0xd482('0x52'),'value':_0x3d4440[_0xd482('0x52')]||(_0x3d4440['attrs']&&_0x3d4440[_0xd482('0x3d')][0xa]?_0x3d4440[_0xd482('0x3d')][0xa][_0xd482('0x3e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3d4440[_0xd482('0x58')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440[_0xd482('0x3d')][0x0]?_0x3d4440[_0xd482('0x3d')][0x0]['type']:undefined)||null,'value':_0x3d4440[_0xd482('0x59')]||(_0x3d4440[_0xd482('0x3d')]&&_0x3d4440['attrs'][0x0]?_0x3d4440[_0xd482('0x3d')][0x0][_0xd482('0x3e')]:undefined)||null},{'name':_0xd482('0x5a'),'value':_0x3d4440[_0xd482('0x5a')]||(_0x3d4440['attrs']&&_0x3d4440[_0xd482('0x3d')][0x1]?_0x3d4440['attrs'][0x1][_0xd482('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x923da0){logger[_0xd482('0x29')]('widgetAttributes:\x20%s',JSON[_0xd482('0x5b')](_0x923da0));return[];}}exports['create']=function(_0x22947c,_0xc7e326){if(_0x22947c[_0xd482('0x5c')]){_0x22947c[_0xd482('0x5c')]['attrs']=widgetAttributes(_0x22947c[_0xd482('0x5c')]);}return db[_0xd482('0x2f')][_0xd482('0x5d')](_0x22947c[_0xd482('0x5c')],{})[_0xd482('0x27')](respondWithResult(_0xc7e326,0xc9))[_0xd482('0x3a')](handleError(_0xc7e326,null));};exports[_0xd482('0x26')]=function(_0x41653e,_0x9d08ed){if(_0x41653e[_0xd482('0x5c')]['id']){delete _0x41653e[_0xd482('0x5c')]['id'];}_0x41653e[_0xd482('0x5c')]['attrs']=widgetAttributes(_0x41653e[_0xd482('0x5c')]);return db[_0xd482('0x2f')]['find']({'where':{'id':_0x41653e[_0xd482('0x2d')]['id']}})[_0xd482('0x27')](handleEntityNotFound(_0x9d08ed,null))[_0xd482('0x27')](saveUpdates(_0x41653e[_0xd482('0x5c')],null))[_0xd482('0x27')](respondWithResult(_0x9d08ed,null))[_0xd482('0x3a')](handleError(_0x9d08ed,null));}; \ No newline at end of file +var _0xe978=['attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','include','merge','options','find','catch','params','type','iframe','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts'];(function(_0x4b45cd,_0x59d91e){var _0x397775=function(_0x9d169b){while(--_0x9d169b){_0x4b45cd['push'](_0x4b45cd['shift']());}};_0x397775(++_0x59d91e);}(_0xe978,0x70));var _0x8e97=function(_0x315938,_0x76aca7){_0x315938=_0x315938-0x0;var _0x4430b3=_0xe978[_0x315938];return _0x4430b3;};'use strict';var emlformat=require(_0x8e97('0x0'));var rimraf=require(_0x8e97('0x1'));var zipdir=require(_0x8e97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e97('0x3'));var BPromise=require(_0x8e97('0x4'));var Mustache=require(_0x8e97('0x5'));var util=require(_0x8e97('0x6'));var path=require(_0x8e97('0x7'));var sox=require('sox');var csv=require(_0x8e97('0x8'));var ejs=require(_0x8e97('0x9'));var fs=require('fs');var fs_extra=require(_0x8e97('0xa'));var _=require(_0x8e97('0xb'));var squel=require(_0x8e97('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e97('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e97('0x8'));var querystring=require(_0x8e97('0xe'));var Papa=require(_0x8e97('0xf'));var Redis=require('ioredis');var authService=require(_0x8e97('0x10'));var qs=require(_0x8e97('0x11'));var as=require(_0x8e97('0x12'));var hardwareService=require(_0x8e97('0x13'));var logger=require(_0x8e97('0x14'))(_0x8e97('0x15'));var utils=require(_0x8e97('0x16'));var config=require(_0x8e97('0x17'));var licenseUtil=require(_0x8e97('0x18'));var db=require(_0x8e97('0x19'))['db'];config[_0x8e97('0x1a')]=_['defaults'](config[_0x8e97('0x1a')],{'host':_0x8e97('0x1b'),'port':0x18eb});var socket=require(_0x8e97('0x1c'))(new Redis(config[_0x8e97('0x1a')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x583c0a,_0x516c91){_0x516c91=_0x516c91||0xcc;return function(_0x5d78c5){if(_0x5d78c5){return _0x583c0a['sendStatus'](_0x516c91);}return _0x583c0a[_0x8e97('0x1d')](_0x516c91)['end']();};}function respondWithResult(_0x33b6b3,_0x3bb176){_0x3bb176=_0x3bb176||0xc8;return function(_0x4943c1){if(_0x4943c1){return _0x33b6b3['status'](_0x3bb176)[_0x8e97('0x1e')](_0x4943c1);}};}function respondWithFilteredResult(_0x3f3738,_0xb779ed){return function(_0x2f475c){if(_0x2f475c){var _0x2155ab=typeof _0xb779ed[_0x8e97('0x1f')]===_0x8e97('0x20')&&typeof _0xb779ed[_0x8e97('0x21')]===_0x8e97('0x20');var _0x596d71=_0x2f475c[_0x8e97('0x22')];var _0x442f99=_0x2155ab?0x0:_0xb779ed[_0x8e97('0x1f')];var _0x19f487=_0x2155ab?_0x2f475c[_0x8e97('0x22')]:_0xb779ed[_0x8e97('0x1f')]+_0xb779ed[_0x8e97('0x21')];var _0x5a5c99;if(_0x19f487>=_0x596d71){_0x19f487=_0x596d71;_0x5a5c99=0xc8;}else{_0x5a5c99=0xce;}_0x3f3738[_0x8e97('0x1d')](_0x5a5c99);return _0x3f3738[_0x8e97('0x23')](_0x8e97('0x24'),_0x442f99+'-'+_0x19f487+'/'+_0x596d71)[_0x8e97('0x1e')](_0x2f475c);}return null;};}function patchUpdates(_0x387748){return function(_0x1763e7){try{jsonpatch[_0x8e97('0x25')](_0x1763e7,_0x387748,!![]);}catch(_0x18fcdb){return BPromise[_0x8e97('0x26')](_0x18fcdb);}return _0x1763e7[_0x8e97('0x27')]();};}function saveUpdates(_0x517c1e,_0x5d5a94){return function(_0x4b08ed){if(_0x4b08ed){return _0x4b08ed[_0x8e97('0x28')](_0x517c1e)[_0x8e97('0x29')](function(_0x2be986){return _0x2be986;});}return null;};}function removeEntity(_0xcee009,_0x1bae19){return function(_0x10f327){if(_0x10f327){return _0x10f327[_0x8e97('0x2a')]()[_0x8e97('0x29')](function(){_0xcee009['status'](0xcc)[_0x8e97('0x2b')]();});}};}function handleEntityNotFound(_0x2a5f18,_0x33e801){return function(_0x5bb338){if(!_0x5bb338){_0x2a5f18[_0x8e97('0x2c')](0x194);}return _0x5bb338;};}function handleError(_0x4ef232,_0x7f0baf){_0x7f0baf=_0x7f0baf||0x1f4;return function(_0x7f3ea1){logger[_0x8e97('0x2d')](_0x7f3ea1[_0x8e97('0x2e')]);if(_0x7f3ea1[_0x8e97('0x2f')]){delete _0x7f3ea1[_0x8e97('0x2f')];}_0x4ef232[_0x8e97('0x1d')](_0x7f0baf)['send'](_0x7f3ea1);};}exports['show']=function(_0x1271c1,_0x364296){var _0x19d800={'raw':![],'where':{'id':_0x1271c1['params']['id']}},_0x3f24d0={};_0x3f24d0[_0x8e97('0x30')]=_[_0x8e97('0x31')](db[_0x8e97('0x32')][_0x8e97('0x33')]);_0x3f24d0[_0x8e97('0x34')]=_['keys'](_0x1271c1[_0x8e97('0x34')]);_0x3f24d0[_0x8e97('0x35')]=_[_0x8e97('0x36')](_0x3f24d0[_0x8e97('0x30')],_0x3f24d0[_0x8e97('0x34')]);_0x19d800['attributes']=_[_0x8e97('0x36')](_0x3f24d0['model'],qs[_0x8e97('0x37')](_0x1271c1[_0x8e97('0x34')][_0x8e97('0x37')]));_0x19d800[_0x8e97('0x38')]=_0x19d800[_0x8e97('0x38')]['length']?_0x19d800[_0x8e97('0x38')]:_0x3f24d0[_0x8e97('0x30')];if(_0x1271c1['query']['includeAll']){_0x19d800[_0x8e97('0x39')]=[{'all':!![]}];}_0x19d800=_[_0x8e97('0x3a')]({},_0x19d800,_0x1271c1[_0x8e97('0x3b')]);return db['DashboardItem'][_0x8e97('0x3c')](_0x19d800)[_0x8e97('0x29')](handleEntityNotFound(_0x364296,null))[_0x8e97('0x29')](respondWithResult(_0x364296,null))[_0x8e97('0x3d')](handleError(_0x364296,null));};exports[_0x8e97('0x2a')]=function(_0x535fde,_0x197b29){return db['DashboardItem'][_0x8e97('0x3c')]({'where':{'id':_0x535fde[_0x8e97('0x3e')]['id']}})[_0x8e97('0x29')](handleEntityNotFound(_0x197b29,null))['then'](removeEntity(_0x197b29,null))['catch'](handleError(_0x197b29,null));};function widgetAttributes(_0x3b8fae){try{switch(_0x3b8fae[_0x8e97('0x3f')]){case _0x8e97('0x40'):return[{'name':'attrUrl','value':_0x3b8fae['attrUrl']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0]['value']:undefined)||'https://'}];case _0x8e97('0x42'):return[{'name':'attrPath','value':_0x3b8fae[_0x8e97('0x43')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||''}];case _0x8e97('0x45'):return[{'name':_0x8e97('0x46'),'value':_0x3b8fae['attrHourFormat']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||_0x8e97('0x47')},{'name':_0x8e97('0x48'),'value':_0x3b8fae[_0x8e97('0x48')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x1]?_0x3b8fae[_0x8e97('0x41')][0x1][_0x8e97('0x44')]:undefined)||_0x8e97('0x49')},{'name':'attrFontSize','value':_0x3b8fae[_0x8e97('0x4a')]||(_0x3b8fae['attrs']&&_0x3b8fae[_0x8e97('0x41')][0x2]?_0x3b8fae[_0x8e97('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x8e97('0x4b'),'value':_0x3b8fae[_0x8e97('0x4b')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||_0x8e97('0x4c')},{'name':'attrVoiceQueues','value':_0x3b8fae[_0x8e97('0x4d')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x1]?_0x3b8fae[_0x8e97('0x41')][0x1][_0x8e97('0x44')]:undefined)||[]},{'name':_0x8e97('0x4a'),'value':_0x3b8fae['attrFontSize']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x2]?_0x3b8fae[_0x8e97('0x41')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x3b8fae[_0x8e97('0x4e')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x3]?_0x3b8fae[_0x8e97('0x41')][0x3][_0x8e97('0x44')]:undefined)||_0x8e97('0x4f')},{'name':'attrEmailAccounts','value':_0x3b8fae[_0x8e97('0x50')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x4]?_0x3b8fae[_0x8e97('0x41')][0x4]['value']:undefined)||''},{'name':_0x8e97('0x51'),'value':_0x3b8fae['attrFaxAccounts']||(_0x3b8fae['attrs']&&_0x3b8fae[_0x8e97('0x41')][0x5]?_0x3b8fae[_0x8e97('0x41')][0x5][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x52'),'value':_0x3b8fae[_0x8e97('0x52')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x6]?_0x3b8fae[_0x8e97('0x41')][0x6][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x53'),'value':_0x3b8fae[_0x8e97('0x53')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x7]?_0x3b8fae['attrs'][0x7][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x54'),'value':_0x3b8fae['attrWhatsappAccounts']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x8]?_0x3b8fae[_0x8e97('0x41')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3b8fae[_0x8e97('0x55')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x9]?_0x3b8fae[_0x8e97('0x41')][0x9][_0x8e97('0x44')]:undefined)||''}];case _0x8e97('0x56'):case _0x8e97('0x57'):return[{'name':_0x8e97('0x58'),'value':_0x3b8fae[_0x8e97('0x58')]||(_0x3b8fae['attrs']&&_0x3b8fae['attrs'][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||_0x8e97('0x4c')},{'name':_0x8e97('0x59'),'value':_0x3b8fae['attrSerie2']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x1]?_0x3b8fae['attrs'][0x1][_0x8e97('0x44')]:undefined)||null},{'name':_0x8e97('0x5a'),'value':_0x3b8fae[_0x8e97('0x5a')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x2]?_0x3b8fae[_0x8e97('0x41')][0x2]['value']:undefined)||null},{'name':_0x8e97('0x4d'),'value':_0x3b8fae[_0x8e97('0x4d')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x3]?_0x3b8fae[_0x8e97('0x41')][0x3]['value']:undefined)||[]},{'name':_0x8e97('0x4e'),'value':_0x3b8fae['attrChannel']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x4]?_0x3b8fae['attrs'][0x4][_0x8e97('0x44')]:undefined)||_0x8e97('0x4f')},{'name':_0x8e97('0x50'),'value':_0x3b8fae[_0x8e97('0x50')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x5]?_0x3b8fae[_0x8e97('0x41')][0x5][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x51'),'value':_0x3b8fae['attrFaxAccounts']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x6]?_0x3b8fae[_0x8e97('0x41')][0x6][_0x8e97('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3b8fae[_0x8e97('0x52')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x7]?_0x3b8fae[_0x8e97('0x41')][0x7][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x53'),'value':_0x3b8fae[_0x8e97('0x53')]||(_0x3b8fae['attrs']&&_0x3b8fae['attrs'][0x8]?_0x3b8fae['attrs'][0x8][_0x8e97('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3b8fae['attrWhatsappAccounts']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x9]?_0x3b8fae[_0x8e97('0x41')][0x9][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x55'),'value':_0x3b8fae['attrChatWebsites']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0xa]?_0x3b8fae[_0x8e97('0x41')][0xa][_0x8e97('0x44')]:undefined)||''}];case _0x8e97('0x5b'):return[{'name':_0x8e97('0x5c'),'type':_0x3b8fae['reportType']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x3f')]:undefined)||null,'value':_0x3b8fae[_0x8e97('0x5c')]||(_0x3b8fae['attrs']&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0]['value']:undefined)||null},{'name':_0x8e97('0x5d'),'value':_0x3b8fae[_0x8e97('0x5d')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x1]?_0x3b8fae['attrs'][0x1][_0x8e97('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x5ec6d5){logger[_0x8e97('0x2d')](_0x8e97('0x5e'),JSON['stringify'](_0x5ec6d5));return[];}}exports[_0x8e97('0x5f')]=function(_0x36eaa6,_0x32a851){if(_0x36eaa6[_0x8e97('0x60')]){_0x36eaa6[_0x8e97('0x60')][_0x8e97('0x41')]=widgetAttributes(_0x36eaa6[_0x8e97('0x60')]);}return db[_0x8e97('0x32')][_0x8e97('0x5f')](_0x36eaa6[_0x8e97('0x60')],{})[_0x8e97('0x29')](respondWithResult(_0x32a851,0xc9))[_0x8e97('0x3d')](handleError(_0x32a851,null));};exports[_0x8e97('0x28')]=function(_0x181e0f,_0x4f5dce){if(_0x181e0f[_0x8e97('0x60')]['id']){delete _0x181e0f[_0x8e97('0x60')]['id'];}_0x181e0f['body'][_0x8e97('0x41')]=widgetAttributes(_0x181e0f['body']);return db[_0x8e97('0x32')]['find']({'where':{'id':_0x181e0f[_0x8e97('0x3e')]['id']}})[_0x8e97('0x29')](handleEntityNotFound(_0x4f5dce,null))['then'](saveUpdates(_0x181e0f[_0x8e97('0x60')],null))['then'](respondWithResult(_0x4f5dce,null))[_0x8e97('0x3d')](handleError(_0x4f5dce,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 92b88f7..cd5024c 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 _0xc139=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2fda28,_0x2db933){var _0x5f1ae5=function(_0x312af1){while(--_0x312af1){_0x2fda28['push'](_0x2fda28['shift']());}};_0x5f1ae5(++_0x2db933);}(_0xc139,0x1b9));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9c13('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9c13('0x1')](0x0);var events={'afterCreate':_0x9c13('0x2'),'afterUpdate':_0x9c13('0x3'),'afterDestroy':_0x9c13('0x4')};function emitEvent(_0x93296f){return function(_0x3fe4be,_0x17b1a3,_0xe57a55){DashboardItemEvents[_0x9c13('0x5')](_0x93296f+':'+_0x3fe4be['id'],_0x3fe4be);DashboardItemEvents[_0x9c13('0x5')](_0x93296f,_0x3fe4be);_0xe57a55(null);};}for(var e in events){if(events[_0x9c13('0x6')](e)){var event=events[e];DashboardItem[_0x9c13('0x7')](e,emitEvent(event));}}module[_0x9c13('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x0a97=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x0a97,0x1a7));var _0x70a9=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x0a97[_0x2dd390];return _0x3afe47;};'use strict';var EventEmitter=require(_0x70a9('0x0'));var DashboardItem=require(_0x70a9('0x1'))['db'][_0x70a9('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x70a9('0x3')](0x0);var events={'afterCreate':_0x70a9('0x4'),'afterUpdate':_0x70a9('0x5'),'afterDestroy':_0x70a9('0x6')};function emitEvent(_0x264540){return function(_0x5bfdce,_0x2d9215,_0x52478c){DashboardItemEvents['emit'](_0x264540+':'+_0x5bfdce['id'],_0x5bfdce);DashboardItemEvents['emit'](_0x264540,_0x5bfdce);_0x52478c(null);};}for(var e in events){if(events[_0x70a9('0x7')](e)){var event=events[e];DashboardItem[_0x70a9('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 294ef02..9a3f734 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 _0x54f3=['api','moment','bluebird','rimraf','../../config/environment','./dashboardItem.attributes','DashboardItem','dashboard_items','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54f3,0x120));var _0x354f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x54f3[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var logger=require(_0x354f('0x1'))(_0x354f('0x2'));var moment=require(_0x354f('0x3'));var BPromise=require(_0x354f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var attributes=require(_0x354f('0x7'));module['exports']=function(_0x5618ac,_0x234ac6){return _0x5618ac['define'](_0x354f('0x8'),attributes,{'tableName':_0x354f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafe6=['path','rimraf','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1ac4d0,_0x3fba53){var _0x4d455b=function(_0x2579eb){while(--_0x2579eb){_0x1ac4d0['push'](_0x1ac4d0['shift']());}};_0x4d455b(++_0x3fba53);}(_0xafe6,0x66));var _0x6afe=function(_0x512b71,_0x2ed87a){_0x512b71=_0x512b71-0x0;var _0x1b60a5=_0xafe6[_0x512b71];return _0x1b60a5;};'use strict';var _=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var logger=require(_0x6afe('0x2'))(_0x6afe('0x3'));var moment=require(_0x6afe('0x4'));var BPromise=require('bluebird');var rp=require(_0x6afe('0x5'));var fs=require('fs');var path=require(_0x6afe('0x6'));var rimraf=require(_0x6afe('0x7'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x6afe('0x8')]=function(_0x4e0780,_0x29cda2){return _0x4e0780[_0x6afe('0x9')](_0x6afe('0xa'),attributes,{'tableName':_0x6afe('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 c303721..280e880 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 _0xc330=['code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30ba6b,_0x5322b8){var _0x4c0762=function(_0x38404b){while(--_0x38404b){_0x30ba6b['push'](_0x30ba6b['shift']());}};_0x4c0762(++_0x5322b8);}(_0xc330,0x131));var _0x0c33=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc330[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x0c33('0x0'));var util=require(_0x0c33('0x1'));var moment=require(_0x0c33('0x2'));var BPromise=require(_0x0c33('0x3'));var rs=require(_0x0c33('0x4'));var fs=require('fs');var Redis=require(_0x0c33('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c33('0x6'));var logger=require(_0x0c33('0x7'))(_0x0c33('0x8'));var config=require('../../config/environment');var jayson=require(_0x0c33('0x9'));var client=jayson[_0x0c33('0xa')][_0x0c33('0xb')]({'port':0x232a});config[_0x0c33('0xc')]=_[_0x0c33('0xd')](config[_0x0c33('0xc')],{'host':_0x0c33('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c33('0xc')]));require(_0x0c33('0xf'))[_0x0c33('0x10')](socket);function respondWithRpcPromise(_0x1f4f86,_0x1fff30,_0x427485){return new BPromise(function(_0x252264,_0x3a4909){return client[_0x0c33('0x11')](_0x1f4f86,_0x427485)[_0x0c33('0x12')](function(_0x44a830){logger[_0x0c33('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1fff30,_0x0c33('0x14'));logger[_0x0c33('0x15')](_0x0c33('0x16'),_0x1fff30,_0x0c33('0x14'),JSON[_0x0c33('0x17')](_0x44a830));if(_0x44a830[_0x0c33('0x18')]){if(_0x44a830[_0x0c33('0x18')][_0x0c33('0x19')]===0x1f4){logger[_0x0c33('0x18')](_0x0c33('0x1a'),_0x1fff30,_0x44a830[_0x0c33('0x18')][_0x0c33('0x1b')]);return _0x3a4909(_0x44a830[_0x0c33('0x18')][_0x0c33('0x1b')]);}logger[_0x0c33('0x18')](_0x0c33('0x1a'),_0x1fff30,_0x44a830[_0x0c33('0x18')][_0x0c33('0x1b')]);return _0x252264(_0x44a830[_0x0c33('0x18')]['message']);}else{logger[_0x0c33('0x13')](_0x0c33('0x1a'),_0x1fff30,'request\x20sent');_0x252264(_0x44a830[_0x0c33('0x1c')][_0x0c33('0x1b')]);}})[_0x0c33('0x1d')](function(_0x382c3a){logger[_0x0c33('0x18')](_0x0c33('0x1a'),_0x1fff30,_0x382c3a);_0x3a4909(_0x382c3a);});});} \ No newline at end of file +var _0xc14b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch'];(function(_0x52984e,_0x45bb25){var _0xcb76d=function(_0x212bf2){while(--_0x212bf2){_0x52984e['push'](_0x52984e['shift']());}};_0xcb76d(++_0x45bb25);}(_0xc14b,0x1ed));var _0xbc14=function(_0x269c23,_0x289264){_0x269c23=_0x269c23-0x0;var _0x184ecd=_0xc14b[_0x269c23];return _0x184ecd;};'use strict';var _=require(_0xbc14('0x0'));var util=require(_0xbc14('0x1'));var moment=require('moment');var BPromise=require(_0xbc14('0x2'));var rs=require(_0xbc14('0x3'));var fs=require('fs');var Redis=require(_0xbc14('0x4'));var db=require(_0xbc14('0x5'))['db'];var utils=require(_0xbc14('0x6'));var logger=require(_0xbc14('0x7'))(_0xbc14('0x8'));var config=require(_0xbc14('0x9'));var jayson=require(_0xbc14('0xa'));var client=jayson[_0xbc14('0xb')][_0xbc14('0xc')]({'port':0x232a});config[_0xbc14('0xd')]=_[_0xbc14('0xe')](config['redis'],{'host':_0xbc14('0xf'),'port':0x18eb});var socket=require(_0xbc14('0x10'))(new Redis(config[_0xbc14('0xd')]));require('./dashboardItem.socket')[_0xbc14('0x11')](socket);function respondWithRpcPromise(_0x453eed,_0x208f5c,_0x31a39c){return new BPromise(function(_0x5e3ff8,_0x4fa57a){return client[_0xbc14('0x12')](_0x453eed,_0x31a39c)[_0xbc14('0x13')](function(_0x2dac1f){logger['info'](_0xbc14('0x14'),_0x208f5c,_0xbc14('0x15'));logger[_0xbc14('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x208f5c,'request\x20sent',JSON['stringify'](_0x2dac1f));if(_0x2dac1f[_0xbc14('0x17')]){if(_0x2dac1f['error'][_0xbc14('0x18')]===0x1f4){logger[_0xbc14('0x17')](_0xbc14('0x14'),_0x208f5c,_0x2dac1f[_0xbc14('0x17')][_0xbc14('0x19')]);return _0x4fa57a(_0x2dac1f[_0xbc14('0x17')][_0xbc14('0x19')]);}logger[_0xbc14('0x17')](_0xbc14('0x14'),_0x208f5c,_0x2dac1f[_0xbc14('0x17')][_0xbc14('0x19')]);return _0x5e3ff8(_0x2dac1f[_0xbc14('0x17')][_0xbc14('0x19')]);}else{logger[_0xbc14('0x1a')](_0xbc14('0x14'),_0x208f5c,_0xbc14('0x15'));_0x5e3ff8(_0x2dac1f[_0xbc14('0x1b')][_0xbc14('0x19')]);}})[_0xbc14('0x1c')](function(_0x1e17f3){logger[_0xbc14('0x17')]('DashboardItem,\x20%s,\x20%s',_0x208f5c,_0x1e17f3);_0x4fa57a(_0x1e17f3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4e3d1c6..70203f0 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 _0x0853=['./dashboardItem.events','save','update','emit','removeListener','length','dashboardItem:'];(function(_0x101f17,_0x4aaa20){var _0x2a1339=function(_0x53af59){while(--_0x53af59){_0x101f17['push'](_0x101f17['shift']());}};_0x2a1339(++_0x4aaa20);}(_0x0853,0xd2));var _0x3085=function(_0x5d438a,_0x4d4018){_0x5d438a=_0x5d438a-0x0;var _0x50b130=_0x0853[_0x5d438a];return _0x50b130;};'use strict';var DashboardItemEvents=require(_0x3085('0x0'));var events=[_0x3085('0x1'),'remove',_0x3085('0x2')];function createListener(_0x1e2adc,_0x4673ec){return function(_0x34b4e7){_0x4673ec[_0x3085('0x3')](_0x1e2adc,_0x34b4e7);};}function removeListener(_0x1a7fa6,_0x3e1968){return function(){DashboardItemEvents[_0x3085('0x4')](_0x1a7fa6,_0x3e1968);};}exports['register']=function(_0x209602){for(var _0x2ba250=0x0,_0x40022e=events[_0x3085('0x5')];_0x2ba250<_0x40022e;_0x2ba250++){var _0x4fd924=events[_0x2ba250];var _0x592f91=createListener(_0x3085('0x6')+_0x4fd924,_0x209602);DashboardItemEvents['on'](_0x4fd924,_0x592f91);}}; \ No newline at end of file +var _0x986e=['save','remove','update','emit','removeListener','register','dashboardItem:'];(function(_0x405d43,_0x5c92f5){var _0x45004b=function(_0x4b74c7){while(--_0x4b74c7){_0x405d43['push'](_0x405d43['shift']());}};_0x45004b(++_0x5c92f5);}(_0x986e,0xee));var _0xe986=function(_0x57e51,_0x27de3a){_0x57e51=_0x57e51-0x0;var _0x17c798=_0x986e[_0x57e51];return _0x17c798;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xe986('0x0'),_0xe986('0x1'),_0xe986('0x2')];function createListener(_0x4afb53,_0x2d100f){return function(_0x660e57){_0x2d100f[_0xe986('0x3')](_0x4afb53,_0x660e57);};}function removeListener(_0x313fcb,_0x34e84f){return function(){DashboardItemEvents[_0xe986('0x4')](_0x313fcb,_0x34e84f);};}exports[_0xe986('0x5')]=function(_0x32cec4){for(var _0x283a27=0x0,_0x4230ee=events['length'];_0x283a27<_0x4230ee;_0x283a27++){var _0x32b17a=events[_0x283a27];var _0xc129b3=createListener(_0xe986('0x6')+_0x32b17a,_0x32cec4);DashboardItemEvents['on'](_0x32b17a,_0xc129b3);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0f365ef..6b72b84 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 _0xd2b3=['post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd2b3,0x110));var _0x3d2b=function(_0x18a47f,_0x46c322){_0x18a47f=_0x18a47f-0x0;var _0x321c5c=_0xd2b3[_0x18a47f];return _0x321c5c;};'use strict';var multer=require(_0x3d2b('0x0'));var util=require('util');var path=require(_0x3d2b('0x1'));var timeout=require(_0x3d2b('0x2'));var express=require(_0x3d2b('0x3'));var router=express[_0x3d2b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d2b('0x5'));var interaction=require(_0x3d2b('0x6'));var config=require(_0x3d2b('0x7'));var controller=require(_0x3d2b('0x8'));router[_0x3d2b('0x9')](_0x3d2b('0xa'),auth[_0x3d2b('0xb')](),controller[_0x3d2b('0xc')]);router[_0x3d2b('0xd')]('/',auth[_0x3d2b('0xb')](),controller[_0x3d2b('0xe')]);router[_0x3d2b('0xf')](_0x3d2b('0xa'),auth[_0x3d2b('0xb')](),controller[_0x3d2b('0x10')]);router['delete'](_0x3d2b('0xa'),auth[_0x3d2b('0xb')](),controller[_0x3d2b('0x11')]);module[_0x3d2b('0x12')]=router; \ No newline at end of file +var _0x403e=['show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','/:id','isAuthenticated'];(function(_0x55d693,_0x1a5f6b){var _0x5bd7c3=function(_0x15f672){while(--_0x15f672){_0x55d693['push'](_0x55d693['shift']());}};_0x5bd7c3(++_0x1a5f6b);}(_0x403e,0x1f1));var _0xe403=function(_0xb14eea,_0x5227cd){_0xb14eea=_0xb14eea-0x0;var _0x1dc52e=_0x403e[_0xb14eea];return _0x1dc52e;};'use strict';var multer=require('multer');var util=require(_0xe403('0x0'));var path=require(_0xe403('0x1'));var timeout=require(_0xe403('0x2'));var express=require(_0xe403('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe403('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router['get'](_0xe403('0x5'),auth[_0xe403('0x6')](),controller[_0xe403('0x7')]);router[_0xe403('0x8')]('/',auth[_0xe403('0x6')](),controller[_0xe403('0x9')]);router[_0xe403('0xa')](_0xe403('0x5'),auth[_0xe403('0x6')](),controller[_0xe403('0xb')]);router[_0xe403('0xc')](_0xe403('0x5'),auth[_0xe403('0x6')](),controller[_0xe403('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 48d47e3..77543dd 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 _0xd910=['exports','ENUM','first','STRING'];(function(_0x31d921,_0x1f2414){var _0x304e88=function(_0x3d1e63){while(--_0x3d1e63){_0x31d921['push'](_0x31d921['shift']());}};_0x304e88(++_0x1f2414);}(_0xd910,0x1b0));var _0x0d91=function(_0x4f9ae9,_0x258be2){_0x4f9ae9=_0x4f9ae9-0x0;var _0xaf9c93=_0xd910[_0x4f9ae9];return _0xaf9c93;};'use strict';var Sequelize=require('sequelize');module[_0x0d91('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x0d91('0x1')]('first','second','third'),'allowNull':![],'defaultValue':_0x0d91('0x2')},'description':{'type':Sequelize[_0x0d91('0x3')]}}; \ No newline at end of file +var _0x6f38=['exports','ENUM','first','third','STRING','sequelize'];(function(_0x552204,_0x222864){var _0x24988d=function(_0x5d893b){while(--_0x5d893b){_0x552204['push'](_0x552204['shift']());}};_0x24988d(++_0x222864);}(_0x6f38,0x167));var _0x86f3=function(_0x2dc46e,_0x22c800){_0x2dc46e=_0x2dc46e-0x0;var _0x4eb52c=_0x6f38[_0x2dc46e];return _0x4eb52c;};'use strict';var Sequelize=require(_0x86f3('0x0'));module[_0x86f3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x86f3('0x2')](_0x86f3('0x3'),'second',_0x86f3('0x4')),'allowNull':![],'defaultValue':_0x86f3('0x3')},'description':{'type':Sequelize[_0x86f3('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c3aa7ab..7102a7f 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 _0x46fa=['Dispositions','sendStatus','error','index','map','Disposition','type','name','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x46fa,0x76));var _0xa46f=function(_0x52ba7c,_0x2d8300){_0x52ba7c=_0x52ba7c-0x0;var _0x5bf302=_0x46fa[_0x52ba7c];return _0x5bf302;};'use strict';var emlformat=require(_0xa46f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa46f('0x1'));var jsonpatch=require(_0xa46f('0x2'));var rp=require(_0xa46f('0x3'));var moment=require('moment');var BPromise=require(_0xa46f('0x4'));var Mustache=require(_0xa46f('0x5'));var util=require(_0xa46f('0x6'));var path=require(_0xa46f('0x7'));var sox=require('sox');var csv=require(_0xa46f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa46f('0x9'));var squel=require(_0xa46f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa46f('0xb'));var toCsv=require(_0xa46f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa46f('0xc'));var authService=require(_0xa46f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa46f('0xe'));var hardwareService=require(_0xa46f('0xf'));var logger=require('../../config/logger')(_0xa46f('0x10'));var utils=require(_0xa46f('0x11'));var config=require(_0xa46f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa46f('0x13'))['db'];function respondWithStatusCode(_0x2b5b8b,_0x1dbae2){_0x1dbae2=_0x1dbae2||0xcc;return function(_0x12bc20){if(_0x12bc20){return _0x2b5b8b['sendStatus'](_0x1dbae2);}return _0x2b5b8b[_0xa46f('0x14')](_0x1dbae2)[_0xa46f('0x15')]();};}function respondWithResult(_0x4d5aa7,_0x317a1b){_0x317a1b=_0x317a1b||0xc8;return function(_0x55b50b){if(_0x55b50b){return _0x4d5aa7['status'](_0x317a1b)['json'](_0x55b50b);}};}function respondWithFilteredResult(_0x3342ca,_0x259afb){return function(_0x4e2137){if(_0x4e2137){var _0x19c519=typeof _0x259afb['offset']===_0xa46f('0x16')&&typeof _0x259afb[_0xa46f('0x17')]===_0xa46f('0x16');var _0x705722=_0x4e2137[_0xa46f('0x18')];var _0x23342e=_0x19c519?0x0:_0x259afb['offset'];var _0x5e4556=_0x19c519?_0x4e2137[_0xa46f('0x18')]:_0x259afb[_0xa46f('0x19')]+_0x259afb[_0xa46f('0x17')];var _0x204d69;if(_0x5e4556>=_0x705722){_0x5e4556=_0x705722;_0x204d69=0xc8;}else{_0x204d69=0xce;}_0x3342ca[_0xa46f('0x14')](_0x204d69);return _0x3342ca[_0xa46f('0x1a')](_0xa46f('0x1b'),_0x23342e+'-'+_0x5e4556+'/'+_0x705722)['json'](_0x4e2137);}return null;};}function patchUpdates(_0x30281e){return function(_0x530dfe){try{jsonpatch[_0xa46f('0x1c')](_0x530dfe,_0x30281e,!![]);}catch(_0x24ecf5){return BPromise[_0xa46f('0x1d')](_0x24ecf5);}return _0x530dfe[_0xa46f('0x1e')]();};}function saveUpdates(_0x563006,_0xfc141c){return function(_0x51c061){if(_0x51c061){return _0x51c061[_0xa46f('0x1f')](_0x563006)['then'](function(_0xc4ce89){return _0xc4ce89;});}return null;};}function removeEntity(_0x405ddd,_0x491e6c){return function(_0x3cbfba){if(_0x3cbfba){return _0x3cbfba['destroy']()[_0xa46f('0x20')](function(){var _0x31d6c8=_0x3cbfba[_0xa46f('0x21')]({'plain':!![]});var _0xb00f7=_0xa46f('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0xb00f7,'resourceId':_0x31d6c8['id']}})[_0xa46f('0x20')](function(){return _0x3cbfba;});})['then'](function(){_0x405ddd[_0xa46f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e6b0,_0x3dcedc){return function(_0x4dd21a){if(!_0x4dd21a){_0x39e6b0[_0xa46f('0x23')](0x194);}return _0x4dd21a;};}function handleError(_0x3031be,_0x4037fd){_0x4037fd=_0x4037fd||0x1f4;return function(_0x244a09){logger[_0xa46f('0x24')](_0x244a09['stack']);if(_0x244a09['name']){delete _0x244a09['name'];}_0x3031be[_0xa46f('0x14')](_0x4037fd)['send'](_0x244a09);};}exports[_0xa46f('0x25')]=function(_0xd6befc,_0x27135e){var _0x5e856f={},_0x1a8c6c={},_0x42578e={'count':0x0,'rows':[]};var _0x592833=_[_0xa46f('0x26')](db[_0xa46f('0x27')]['rawAttributes'],function(_0x266755){return{'name':_0x266755['fieldName'],'type':_0x266755[_0xa46f('0x28')]['key']};});_0x1a8c6c['model']=_[_0xa46f('0x26')](_0x592833,_0xa46f('0x29'));_0x1a8c6c[_0xa46f('0x2a')]=_[_0xa46f('0x2b')](_0xd6befc[_0xa46f('0x2a')]);_0x1a8c6c[_0xa46f('0x2c')]=_['intersection'](_0x1a8c6c[_0xa46f('0x2d')],_0x1a8c6c[_0xa46f('0x2a')]);_0x5e856f[_0xa46f('0x2e')]=_[_0xa46f('0x2f')](_0x1a8c6c[_0xa46f('0x2d')],qs[_0xa46f('0x30')](_0xd6befc[_0xa46f('0x2a')][_0xa46f('0x30')]));_0x5e856f[_0xa46f('0x2e')]=_0x5e856f[_0xa46f('0x2e')][_0xa46f('0x31')]?_0x5e856f[_0xa46f('0x2e')]:_0x1a8c6c['model'];if(!_0xd6befc[_0xa46f('0x2a')]['hasOwnProperty'](_0xa46f('0x32'))){_0x5e856f[_0xa46f('0x17')]=qs[_0xa46f('0x17')](_0xd6befc[_0xa46f('0x2a')][_0xa46f('0x17')]);_0x5e856f[_0xa46f('0x19')]=qs['offset'](_0xd6befc[_0xa46f('0x2a')]['offset']);}_0x5e856f[_0xa46f('0x33')]=qs[_0xa46f('0x34')](_0xd6befc['query'][_0xa46f('0x34')]);_0x5e856f['where']=qs[_0xa46f('0x2c')](_[_0xa46f('0x35')](_0xd6befc[_0xa46f('0x2a')],_0x1a8c6c[_0xa46f('0x2c')]),_0x592833);if(_0xd6befc[_0xa46f('0x2a')]['filter']){_0x5e856f[_0xa46f('0x36')]=_[_0xa46f('0x37')](_0x5e856f[_0xa46f('0x36')],{'$or':_[_0xa46f('0x26')](_0x592833,function(_0x422b6c){if(_0x422b6c['type']!==_0xa46f('0x38')){var _0x472635={};_0x472635[_0x422b6c[_0xa46f('0x29')]]={'$like':'%'+_0xd6befc[_0xa46f('0x2a')][_0xa46f('0x39')]+'%'};return _0x472635;}})});}_0x5e856f=_[_0xa46f('0x37')]({},_0x5e856f,_0xd6befc['options']);var _0xd291a5={'where':_0x5e856f['where']};return db['Disposition'][_0xa46f('0x18')](_0xd291a5)[_0xa46f('0x20')](function(_0x3859be){_0x42578e[_0xa46f('0x18')]=_0x3859be;if(_0xd6befc[_0xa46f('0x2a')]['includeAll']){_0x5e856f[_0xa46f('0x3a')]=[{'all':!![]}];}return db[_0xa46f('0x27')][_0xa46f('0x3b')](_0x5e856f);})[_0xa46f('0x20')](function(_0x4a03b9){_0x42578e[_0xa46f('0x3c')]=_0x4a03b9;return _0x42578e;})[_0xa46f('0x20')](respondWithFilteredResult(_0x27135e,_0x5e856f))[_0xa46f('0x3d')](handleError(_0x27135e,null));};exports[_0xa46f('0x3e')]=function(_0x2d979e,_0x1048be){var _0x503bf6={'raw':!![],'where':{'id':_0x2d979e[_0xa46f('0x3f')]['id']}},_0x2010de={};_0x2010de[_0xa46f('0x2d')]=_['keys'](db[_0xa46f('0x27')][_0xa46f('0x40')]);_0x2010de[_0xa46f('0x2a')]=_[_0xa46f('0x2b')](_0x2d979e[_0xa46f('0x2a')]);_0x2010de['filters']=_[_0xa46f('0x2f')](_0x2010de[_0xa46f('0x2d')],_0x2010de[_0xa46f('0x2a')]);_0x503bf6['attributes']=_['intersection'](_0x2010de[_0xa46f('0x2d')],qs[_0xa46f('0x30')](_0x2d979e['query'][_0xa46f('0x30')]));_0x503bf6['attributes']=_0x503bf6[_0xa46f('0x2e')]['length']?_0x503bf6[_0xa46f('0x2e')]:_0x2010de[_0xa46f('0x2d')];if(_0x2d979e[_0xa46f('0x2a')]['includeAll']){_0x503bf6[_0xa46f('0x3a')]=[{'all':!![]}];}_0x503bf6=_[_0xa46f('0x37')]({},_0x503bf6,_0x2d979e[_0xa46f('0x41')]);return db[_0xa46f('0x27')][_0xa46f('0x42')](_0x503bf6)[_0xa46f('0x20')](handleEntityNotFound(_0x1048be,null))[_0xa46f('0x20')](respondWithResult(_0x1048be,null))[_0xa46f('0x3d')](handleError(_0x1048be,null));};exports['create']=function(_0x3c6717,_0x15f2f7){return db[_0xa46f('0x27')][_0xa46f('0x43')](_0x3c6717[_0xa46f('0x44')],{})['then'](function(_0x46797a){var _0x42b0c7=_0x3c6717[_0xa46f('0x45')][_0xa46f('0x21')]({'plain':!![]});if(!_0x42b0c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42b0c7[_0xa46f('0x46')]==='user'){var _0x15b98a=_0x46797a[_0xa46f('0x21')]({'plain':!![]});var _0x19a37c=_0xa46f('0x22');return db[_0xa46f('0x47')]['find']({'where':{'name':_0x19a37c,'userProfileId':_0x42b0c7['userProfileId']},'raw':!![]})[_0xa46f('0x20')](function(_0x33ad7a){if(_0x33ad7a&&_0x33ad7a[_0xa46f('0x48')]===0x0){return db[_0xa46f('0x49')][_0xa46f('0x43')]({'name':_0x15b98a['name'],'resourceId':_0x15b98a['id'],'type':_0x33ad7a[_0xa46f('0x29')],'sectionId':_0x33ad7a['id']},{})[_0xa46f('0x20')](function(){return _0x46797a;});}else{return _0x46797a;}})[_0xa46f('0x3d')](function(_0x595bd5){logger[_0xa46f('0x24')](_0xa46f('0x4a'),_0x595bd5);throw _0x595bd5;});}return _0x46797a;})[_0xa46f('0x20')](respondWithResult(_0x15f2f7,0xc9))[_0xa46f('0x3d')](handleError(_0x15f2f7,null));};exports['update']=function(_0x565e33,_0x231cb1){if(_0x565e33['body']['id']){delete _0x565e33[_0xa46f('0x44')]['id'];}return db['Disposition'][_0xa46f('0x42')]({'where':{'id':_0x565e33['params']['id']}})[_0xa46f('0x20')](handleEntityNotFound(_0x231cb1,null))[_0xa46f('0x20')](saveUpdates(_0x565e33[_0xa46f('0x44')],null))['then'](respondWithResult(_0x231cb1,null))[_0xa46f('0x3d')](handleError(_0x231cb1,null));};exports[_0xa46f('0x4b')]=function(_0xd6be21,_0x37714a){return db[_0xa46f('0x27')][_0xa46f('0x42')]({'where':{'id':_0xd6be21['params']['id']}})[_0xa46f('0x20')](handleEntityNotFound(_0x37714a,null))[_0xa46f('0x20')](removeEntity(_0x37714a,null))[_0xa46f('0x3d')](handleError(_0x37714a,null));}; \ No newline at end of file +var _0x44ff=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x44ff,0x1c3));var _0xf44f=function(_0x88e3bf,_0x4d8151){_0x88e3bf=_0x88e3bf-0x0;var _0x1d2416=_0x44ff[_0x88e3bf];return _0x1d2416;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf44f('0x0'));var zipdir=require(_0xf44f('0x1'));var jsonpatch=require(_0xf44f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf44f('0x3'));var path=require(_0xf44f('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf44f('0x5'));var fs=require('fs');var fs_extra=require(_0xf44f('0x6'));var _=require(_0xf44f('0x7'));var squel=require('squel');var crypto=require(_0xf44f('0x8'));var jsforce=require(_0xf44f('0x9'));var deskjs=require(_0xf44f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf44f('0xb'));var Papa=require(_0xf44f('0xc'));var Redis=require(_0xf44f('0xd'));var authService=require(_0xf44f('0xe'));var qs=require(_0xf44f('0xf'));var as=require(_0xf44f('0x10'));var hardwareService=require(_0xf44f('0x11'));var logger=require(_0xf44f('0x12'))(_0xf44f('0x13'));var utils=require(_0xf44f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf44f('0x15'));var db=require(_0xf44f('0x16'))['db'];function respondWithStatusCode(_0x23b73a,_0x34d3da){_0x34d3da=_0x34d3da||0xcc;return function(_0x10176f){if(_0x10176f){return _0x23b73a[_0xf44f('0x17')](_0x34d3da);}return _0x23b73a[_0xf44f('0x18')](_0x34d3da)['end']();};}function respondWithResult(_0x5d2b86,_0x17e828){_0x17e828=_0x17e828||0xc8;return function(_0x5f20aa){if(_0x5f20aa){return _0x5d2b86['status'](_0x17e828)['json'](_0x5f20aa);}};}function respondWithFilteredResult(_0x3aa2b8,_0x1d2d77){return function(_0x409907){if(_0x409907){var _0x1a5ce4=typeof _0x1d2d77['offset']===_0xf44f('0x19')&&typeof _0x1d2d77['limit']===_0xf44f('0x19');var _0x40e414=_0x409907[_0xf44f('0x1a')];var _0x15e5b6=_0x1a5ce4?0x0:_0x1d2d77['offset'];var _0x4f0338=_0x1a5ce4?_0x409907['count']:_0x1d2d77['offset']+_0x1d2d77[_0xf44f('0x1b')];var _0x4f0292;if(_0x4f0338>=_0x40e414){_0x4f0338=_0x40e414;_0x4f0292=0xc8;}else{_0x4f0292=0xce;}_0x3aa2b8['status'](_0x4f0292);return _0x3aa2b8[_0xf44f('0x1c')](_0xf44f('0x1d'),_0x15e5b6+'-'+_0x4f0338+'/'+_0x40e414)[_0xf44f('0x1e')](_0x409907);}return null;};}function patchUpdates(_0x515ea6){return function(_0x1c317e){try{jsonpatch[_0xf44f('0x1f')](_0x1c317e,_0x515ea6,!![]);}catch(_0x5eb768){return BPromise[_0xf44f('0x20')](_0x5eb768);}return _0x1c317e['save']();};}function saveUpdates(_0x1cc24e,_0x166acd){return function(_0x3e0b9c){if(_0x3e0b9c){return _0x3e0b9c['update'](_0x1cc24e)[_0xf44f('0x21')](function(_0x1b9dc9){return _0x1b9dc9;});}return null;};}function removeEntity(_0x329ed3,_0x58d4af){return function(_0x1ba9c0){if(_0x1ba9c0){return _0x1ba9c0[_0xf44f('0x22')]()[_0xf44f('0x21')](function(){var _0x2c660f=_0x1ba9c0[_0xf44f('0x23')]({'plain':!![]});var _0x5313f5=_0xf44f('0x24');return db[_0xf44f('0x25')][_0xf44f('0x22')]({'where':{'type':_0x5313f5,'resourceId':_0x2c660f['id']}})[_0xf44f('0x21')](function(){return _0x1ba9c0;});})['then'](function(){_0x329ed3[_0xf44f('0x18')](0xcc)[_0xf44f('0x26')]();});}};}function handleEntityNotFound(_0x36e7a9,_0x3ea717){return function(_0xc6ed8a){if(!_0xc6ed8a){_0x36e7a9[_0xf44f('0x17')](0x194);}return _0xc6ed8a;};}function handleError(_0x4cf521,_0x202f7c){_0x202f7c=_0x202f7c||0x1f4;return function(_0x5255eb){logger[_0xf44f('0x27')](_0x5255eb[_0xf44f('0x28')]);if(_0x5255eb['name']){delete _0x5255eb['name'];}_0x4cf521[_0xf44f('0x18')](_0x202f7c)[_0xf44f('0x29')](_0x5255eb);};}exports[_0xf44f('0x2a')]=function(_0xcd3334,_0x549fdd){var _0x1ee969={},_0x37a208={},_0x5d3ac2={'count':0x0,'rows':[]};var _0x3ec317=_[_0xf44f('0x2b')](db[_0xf44f('0x2c')][_0xf44f('0x2d')],function(_0x441249){return{'name':_0x441249[_0xf44f('0x2e')],'type':_0x441249[_0xf44f('0x2f')][_0xf44f('0x30')]};});_0x37a208[_0xf44f('0x31')]=_[_0xf44f('0x2b')](_0x3ec317,'name');_0x37a208[_0xf44f('0x32')]=_[_0xf44f('0x33')](_0xcd3334['query']);_0x37a208[_0xf44f('0x34')]=_[_0xf44f('0x35')](_0x37a208[_0xf44f('0x31')],_0x37a208[_0xf44f('0x32')]);_0x1ee969[_0xf44f('0x36')]=_['intersection'](_0x37a208[_0xf44f('0x31')],qs[_0xf44f('0x37')](_0xcd3334[_0xf44f('0x32')][_0xf44f('0x37')]));_0x1ee969[_0xf44f('0x36')]=_0x1ee969[_0xf44f('0x36')][_0xf44f('0x38')]?_0x1ee969[_0xf44f('0x36')]:_0x37a208[_0xf44f('0x31')];if(!_0xcd3334['query'][_0xf44f('0x39')](_0xf44f('0x3a'))){_0x1ee969[_0xf44f('0x1b')]=qs[_0xf44f('0x1b')](_0xcd3334[_0xf44f('0x32')][_0xf44f('0x1b')]);_0x1ee969[_0xf44f('0x3b')]=qs[_0xf44f('0x3b')](_0xcd3334[_0xf44f('0x32')][_0xf44f('0x3b')]);}_0x1ee969[_0xf44f('0x3c')]=qs[_0xf44f('0x3d')](_0xcd3334[_0xf44f('0x32')][_0xf44f('0x3d')]);_0x1ee969[_0xf44f('0x3e')]=qs[_0xf44f('0x34')](_[_0xf44f('0x3f')](_0xcd3334[_0xf44f('0x32')],_0x37a208[_0xf44f('0x34')]),_0x3ec317);if(_0xcd3334[_0xf44f('0x32')][_0xf44f('0x40')]){_0x1ee969[_0xf44f('0x3e')]=_[_0xf44f('0x41')](_0x1ee969['where'],{'$or':_[_0xf44f('0x2b')](_0x3ec317,function(_0x2b2233){if(_0x2b2233[_0xf44f('0x2f')]!==_0xf44f('0x42')){var _0x4da6b7={};_0x4da6b7[_0x2b2233[_0xf44f('0x43')]]={'$like':'%'+_0xcd3334['query']['filter']+'%'};return _0x4da6b7;}})});}_0x1ee969=_[_0xf44f('0x41')]({},_0x1ee969,_0xcd3334[_0xf44f('0x44')]);var _0x3b376f={'where':_0x1ee969[_0xf44f('0x3e')]};return db[_0xf44f('0x2c')]['count'](_0x3b376f)[_0xf44f('0x21')](function(_0x32e8e0){_0x5d3ac2['count']=_0x32e8e0;if(_0xcd3334[_0xf44f('0x32')][_0xf44f('0x45')]){_0x1ee969[_0xf44f('0x46')]=[{'all':!![]}];}return db['Disposition'][_0xf44f('0x47')](_0x1ee969);})['then'](function(_0x28717a){_0x5d3ac2[_0xf44f('0x48')]=_0x28717a;return _0x5d3ac2;})['then'](respondWithFilteredResult(_0x549fdd,_0x1ee969))[_0xf44f('0x49')](handleError(_0x549fdd,null));};exports[_0xf44f('0x4a')]=function(_0x39b23d,_0x9f0204){var _0x37330c={'raw':!![],'where':{'id':_0x39b23d[_0xf44f('0x4b')]['id']}},_0x367708={};_0x367708[_0xf44f('0x31')]=_['keys'](db[_0xf44f('0x2c')][_0xf44f('0x2d')]);_0x367708[_0xf44f('0x32')]=_[_0xf44f('0x33')](_0x39b23d[_0xf44f('0x32')]);_0x367708[_0xf44f('0x34')]=_['intersection'](_0x367708[_0xf44f('0x31')],_0x367708[_0xf44f('0x32')]);_0x37330c[_0xf44f('0x36')]=_['intersection'](_0x367708[_0xf44f('0x31')],qs['fields'](_0x39b23d[_0xf44f('0x32')][_0xf44f('0x37')]));_0x37330c[_0xf44f('0x36')]=_0x37330c['attributes'][_0xf44f('0x38')]?_0x37330c[_0xf44f('0x36')]:_0x367708[_0xf44f('0x31')];if(_0x39b23d['query']['includeAll']){_0x37330c[_0xf44f('0x46')]=[{'all':!![]}];}_0x37330c=_[_0xf44f('0x41')]({},_0x37330c,_0x39b23d[_0xf44f('0x44')]);return db[_0xf44f('0x2c')][_0xf44f('0x4c')](_0x37330c)[_0xf44f('0x21')](handleEntityNotFound(_0x9f0204,null))[_0xf44f('0x21')](respondWithResult(_0x9f0204,null))['catch'](handleError(_0x9f0204,null));};exports[_0xf44f('0x4d')]=function(_0x30e382,_0x5a80fc){return db['Disposition']['create'](_0x30e382[_0xf44f('0x4e')],{})[_0xf44f('0x21')](function(_0x11dcad){var _0x58db4c=_0x30e382['user'][_0xf44f('0x23')]({'plain':!![]});if(!_0x58db4c)throw new Error(_0xf44f('0x4f'));if(_0x58db4c[_0xf44f('0x50')]===_0xf44f('0x51')){var _0x1ecff0=_0x11dcad['get']({'plain':!![]});var _0x3c2c35=_0xf44f('0x24');return db['UserProfileSection'][_0xf44f('0x4c')]({'where':{'name':_0x3c2c35,'userProfileId':_0x58db4c['userProfileId']},'raw':!![]})[_0xf44f('0x21')](function(_0x14fb53){if(_0x14fb53&&_0x14fb53[_0xf44f('0x52')]===0x0){return db[_0xf44f('0x25')][_0xf44f('0x4d')]({'name':_0x1ecff0[_0xf44f('0x43')],'resourceId':_0x1ecff0['id'],'type':_0x14fb53[_0xf44f('0x43')],'sectionId':_0x14fb53['id']},{})['then'](function(){return _0x11dcad;});}else{return _0x11dcad;}})[_0xf44f('0x49')](function(_0x3ce51d){logger[_0xf44f('0x27')](_0xf44f('0x53'),_0x3ce51d);throw _0x3ce51d;});}return _0x11dcad;})['then'](respondWithResult(_0x5a80fc,0xc9))['catch'](handleError(_0x5a80fc,null));};exports['update']=function(_0x554f21,_0x1604ac){if(_0x554f21[_0xf44f('0x4e')]['id']){delete _0x554f21[_0xf44f('0x4e')]['id'];}return db['Disposition'][_0xf44f('0x4c')]({'where':{'id':_0x554f21[_0xf44f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1604ac,null))[_0xf44f('0x21')](saveUpdates(_0x554f21['body'],null))[_0xf44f('0x21')](respondWithResult(_0x1604ac,null))[_0xf44f('0x49')](handleError(_0x1604ac,null));};exports[_0xf44f('0x22')]=function(_0x432fdc,_0x177098){return db[_0xf44f('0x2c')][_0xf44f('0x4c')]({'where':{'id':_0x432fdc[_0xf44f('0x4b')]['id']}})[_0xf44f('0x21')](handleEntityNotFound(_0x177098,null))[_0xf44f('0x21')](removeEntity(_0x177098,null))[_0xf44f('0x49')](handleError(_0x177098,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c2ad392..f229050 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 _0x3959=['rimraf','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3959,0x19b));var _0x9395=function(_0x2d8468,_0x309ffc){_0x2d8468=_0x2d8468-0x0;var _0x21b630=_0x3959[_0x2d8468];return _0x21b630;};'use strict';var _=require(_0x9395('0x0'));var util=require(_0x9395('0x1'));var logger=require(_0x9395('0x2'))(_0x9395('0x3'));var moment=require('moment');var BPromise=require(_0x9395('0x4'));var rp=require(_0x9395('0x5'));var fs=require('fs');var path=require(_0x9395('0x6'));var rimraf=require(_0x9395('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x9395('0x8')]=function(_0x21c1c8,_0x58db2c){return _0x21c1c8['define'](_0x9395('0x9'),attributes,{'tableName':_0x9395('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9395('0xb'),'fields':[_0x9395('0xc'),_0x9395('0xd')]},{'unique':!![],'name':_0x9395('0xe'),'fields':[_0x9395('0xc'),_0x9395('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0x9395('0xc'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x9395('0xc'),_0x9395('0x10')]},{'unique':!![],'name':_0x9395('0x11'),'fields':[_0x9395('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x9395('0x12'),'fields':[_0x9395('0xc'),_0x9395('0x13')]},{'unique':!![],'name':_0x9395('0x14'),'fields':[_0x9395('0xc'),_0x9395('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2db2=['OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ChatWebsiteId','MailAccountId','name_sms','FaxAccountId','name_openchannel'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0x2db2,0xf5));var _0x22db=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x2db2[_0x2f6233];return _0x1c9c36;};'use strict';var _=require(_0x22db('0x0'));var util=require(_0x22db('0x1'));var logger=require(_0x22db('0x2'))(_0x22db('0x3'));var moment=require(_0x22db('0x4'));var BPromise=require(_0x22db('0x5'));var rp=require(_0x22db('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x22db('0x7'));var attributes=require(_0x22db('0x8'));module[_0x22db('0x9')]=function(_0x1da142,_0x257f5b){return _0x1da142[_0x22db('0xa')](_0x22db('0xb'),attributes,{'tableName':_0x22db('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x22db('0xd'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x22db('0xd'),_0x22db('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x22db('0xd'),_0x22db('0xf')]},{'unique':!![],'name':_0x22db('0x10'),'fields':[_0x22db('0xd'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x22db('0xd'),_0x22db('0x11')]},{'unique':!![],'name':_0x22db('0x12'),'fields':[_0x22db('0xd'),_0x22db('0x13')]},{'unique':!![],'name':_0x22db('0x14'),'fields':['name',_0x22db('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 86b199d..064e937 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(_0x40d9ee,_0x5a37e1){var _0x1a5efe=function(_0x299148){while(--_0x299148){_0x40d9ee['push'](_0x40d9ee['shift']());}};_0x1a5efe(++_0x5a37e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x1f1f88,_0x2c1625){var _0x5599e7=function(_0x5d5cdc){while(--_0x5d5cdc){_0x1f1f88['push'](_0x1f1f88['shift']());}};_0x5599e7(++_0x2c1625);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5d15b2e..9111ae5 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 _0xce79=['/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','show','post','isAuthenticated','create','put'];(function(_0x199483,_0x2c73e5){var _0x134222=function(_0x3e8308){while(--_0x3e8308){_0x199483['push'](_0x199483['shift']());}};_0x134222(++_0x2c73e5);}(_0xce79,0xff));var _0x9ce7=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xce79[_0x5b740b];return _0x6f8f4e;};'use strict';var multer=require(_0x9ce7('0x0'));var util=require(_0x9ce7('0x1'));var path=require(_0x9ce7('0x2'));var timeout=require(_0x9ce7('0x3'));var express=require(_0x9ce7('0x4'));var router=express[_0x9ce7('0x5')]();var fs_extra=require(_0x9ce7('0x6'));var auth=require(_0x9ce7('0x7'));var interaction=require(_0x9ce7('0x8'));var config=require(_0x9ce7('0x9'));var controller=require(_0x9ce7('0xa'));router[_0x9ce7('0xb')]('/',auth['isAuthenticated'](),controller[_0x9ce7('0xc')]);router[_0x9ce7('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9ce7('0xd')]);router[_0x9ce7('0xe')]('/',auth[_0x9ce7('0xf')](),controller[_0x9ce7('0x10')]);router[_0x9ce7('0x11')](_0x9ce7('0x12'),auth[_0x9ce7('0xf')](),controller[_0x9ce7('0x13')]);router[_0x9ce7('0x14')]('/:id',auth[_0x9ce7('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfa35=['get','index','/:id','isAuthenticated','show','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa35,0x1a6));var _0x5fa3=function(_0x3f9631,_0x51ffcb){_0x3f9631=_0x3f9631-0x0;var _0x242d84=_0xfa35[_0x3f9631];return _0x242d84;};'use strict';var multer=require(_0x5fa3('0x0'));var util=require(_0x5fa3('0x1'));var path=require(_0x5fa3('0x2'));var timeout=require(_0x5fa3('0x3'));var express=require('express');var router=express[_0x5fa3('0x4')]();var fs_extra=require(_0x5fa3('0x5'));var auth=require(_0x5fa3('0x6'));var interaction=require(_0x5fa3('0x7'));var config=require(_0x5fa3('0x8'));var controller=require(_0x5fa3('0x9'));router[_0x5fa3('0xa')]('/',auth['isAuthenticated'](),controller[_0x5fa3('0xb')]);router[_0x5fa3('0xa')](_0x5fa3('0xc'),auth[_0x5fa3('0xd')](),controller[_0x5fa3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5fa3('0xc'),auth['isAuthenticated'](),controller[_0x5fa3('0xf')]);router['delete'](_0x5fa3('0xc'),auth['isAuthenticated'](),controller[_0x5fa3('0x10')]);module[_0x5fa3('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7c659a3..695fb23 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 _0xc33e=['12000','14400','ENUM','INTEGER','IAX','DADHI','KHOMP','TEXT','BOOLEAN','setDataValue','mandatoryDisposition','sequelize','STRING','yes','localstationid','2400','4800','9600'];(function(_0x733760,_0x99c1cb){var _0x441db1=function(_0x33e15f){while(--_0x33e15f){_0x733760['push'](_0x733760['shift']());}};_0x441db1(++_0x99c1cb);}(_0xc33e,0x1df));var _0xec33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc33e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xec33('0x0'));module['exports']={'name':{'type':Sequelize[_0xec33('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xec33('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xec33('0x2'),'no'),'defaultValue':_0xec33('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xec33('0x1')],'unique':_0xec33('0x3')},'minrate':{'type':Sequelize['ENUM'](_0xec33('0x4'),_0xec33('0x5'),'7200',_0xec33('0x6'),_0xec33('0x7'),_0xec33('0x8')),'defaultValue':_0xec33('0x5')},'maxrate':{'type':Sequelize[_0xec33('0x9')](_0xec33('0x4'),_0xec33('0x5'),'7200',_0xec33('0x6'),_0xec33('0x7'),_0xec33('0x8')),'defaultValue':_0xec33('0x8')},'modem':{'type':Sequelize[_0xec33('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xec33('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xec33('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xec33('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xec33('0x9')]('SIP',_0xec33('0xb'),_0xec33('0xc'),_0xec33('0xd')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xec33('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xec33('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xec33('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xec33('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xec33('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xec33('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xec33('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xec33('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xec33('0xa')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xec33('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e08af){if(!_0x1e08af)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xec33('0x10')](_0xec33('0x11'),_0x1e08af);}}}; \ No newline at end of file +var _0x7af3=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','14400','2400','7200','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1e0499,_0x2222ed){var _0x527766=function(_0xac41b8){while(--_0xac41b8){_0x1e0499['push'](_0x1e0499['shift']());}};_0x527766(++_0x2222ed);}(_0x7af3,0xa5));var _0x37af=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x7af3[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require('sequelize');module[_0x37af('0x0')]={'name':{'type':Sequelize[_0x37af('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x37af('0x2')](_0x37af('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x37af('0x1')],'defaultValue':_0x37af('0x4')},'localstationid':{'type':Sequelize[_0x37af('0x1')],'unique':_0x37af('0x5')},'minrate':{'type':Sequelize[_0x37af('0x2')]('2400',_0x37af('0x6'),'7200',_0x37af('0x7'),'12000',_0x37af('0x8')),'defaultValue':_0x37af('0x6')},'maxrate':{'type':Sequelize[_0x37af('0x2')](_0x37af('0x9'),'4800',_0x37af('0xa'),_0x37af('0x7'),'12000',_0x37af('0x8')),'defaultValue':_0x37af('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x37af('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x37af('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x37af('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x37af('0xc'),_0x37af('0xd'),_0x37af('0xe'),_0x37af('0xf')),'defaultValue':_0x37af('0xc')},'key':{'type':Sequelize[_0x37af('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x37af('0x10')],'defaultValue':function(){return _0x37af('0x11');}},'notificationSound':{'type':Sequelize[_0x37af('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x37af('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x37af('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x37af('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x37af('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x37af('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x37af('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x37af('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x37af('0x12')],'defaultValue':![],'comment':_0x37af('0x14'),'set':function(_0x19bb0a){if(!_0x19bb0a)this[_0x37af('0x15')]('mandatoryDispositionPauseId',null);this[_0x37af('0x15')](_0x37af('0x16'),_0x19bb0a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 66b363a..4162f55 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 _0xe41c=['TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','FaxAccounts','destroy','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','rows','show','params','mandatoryDispositionPause','length','options','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt'];(function(_0x3f9dab,_0x487458){var _0x32a68b=function(_0x535ec6){while(--_0x535ec6){_0x3f9dab['push'](_0x3f9dab['shift']());}};_0x32a68b(++_0x487458);}(_0xe41c,0xe6));var _0xce41=function(_0x22cd98,_0x5b01ea){_0x22cd98=_0x22cd98-0x0;var _0x570b1c=_0xe41c[_0x22cd98];return _0x570b1c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xce41('0x0'));var jsonpatch=require(_0xce41('0x1'));var rp=require('request-promise');var moment=require(_0xce41('0x2'));var BPromise=require(_0xce41('0x3'));var Mustache=require('mustache');var util=require(_0xce41('0x4'));var path=require(_0xce41('0x5'));var sox=require(_0xce41('0x6'));var csv=require(_0xce41('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce41('0x8'));var _=require('lodash');var squel=require(_0xce41('0x9'));var crypto=require(_0xce41('0xa'));var jsforce=require(_0xce41('0xb'));var deskjs=require(_0xce41('0xc'));var toCsv=require('to-csv');var querystring=require(_0xce41('0xd'));var Papa=require('papaparse');var Redis=require(_0xce41('0xe'));var authService=require(_0xce41('0xf'));var qs=require(_0xce41('0x10'));var as=require(_0xce41('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce41('0x12'))(_0xce41('0x13'));var utils=require('../../config/utils');var config=require(_0xce41('0x14'));var licenseUtil=require(_0xce41('0x15'));var db=require(_0xce41('0x16'))['db'];config[_0xce41('0x17')]=_[_0xce41('0x18')](config[_0xce41('0x17')],{'host':_0xce41('0x19'),'port':0x18eb});var socket=require(_0xce41('0x1a'))(new Redis(config[_0xce41('0x17')]));require(_0xce41('0x1b'))['register'](socket);var jayson=require(_0xce41('0x1c'));var client=jayson[_0xce41('0x1d')][_0xce41('0x1e')]({'port':0x232c});var client9002=jayson[_0xce41('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2faadd,_0x3c75e3,_0x1156b1,_0x23ca12){return new BPromise(function(_0x2a831d,_0x38901c){var _0x58dbbe=_0x23ca12||client;return _0x58dbbe[_0xce41('0x1f')](_0x2faadd,_0x1156b1)[_0xce41('0x20')](function(_0x1ff3fa){logger[_0xce41('0x21')]('FaxAccount,\x20%s,\x20%s',_0x3c75e3,'request\x20sent');logger[_0xce41('0x22')](_0xce41('0x23'),_0x3c75e3,_0xce41('0x24'),JSON[_0xce41('0x25')](_0x1ff3fa));if(_0x1ff3fa[_0xce41('0x26')]){if(_0x1ff3fa[_0xce41('0x26')][_0xce41('0x27')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3c75e3,_0x1ff3fa[_0xce41('0x26')][_0xce41('0x28')]);return _0x38901c(_0x1ff3fa['error']['message']);}logger[_0xce41('0x26')](_0xce41('0x29'),_0x3c75e3,_0x1ff3fa[_0xce41('0x26')]['message']);return _0x2a831d(_0x1ff3fa['error'][_0xce41('0x28')]);}else{logger[_0xce41('0x21')](_0xce41('0x29'),_0x3c75e3,'request\x20sent');_0x2a831d(_0x1ff3fa[_0xce41('0x2a')][_0xce41('0x28')]);}})[_0xce41('0x2b')](function(_0x551d59){logger[_0xce41('0x26')](_0xce41('0x29'),_0x3c75e3,_0x551d59);_0x38901c(_0x551d59);});});}function respondWithStatusCode(_0x684bf6,_0x16b6be){_0x16b6be=_0x16b6be||0xcc;return function(_0x3a70a9){if(_0x3a70a9){return _0x684bf6[_0xce41('0x2c')](_0x16b6be);}return _0x684bf6[_0xce41('0x2d')](_0x16b6be)[_0xce41('0x2e')]();};}function respondWithResult(_0x5c6ad9,_0x26ad5e){_0x26ad5e=_0x26ad5e||0xc8;return function(_0x3bcc68){if(_0x3bcc68){return _0x5c6ad9[_0xce41('0x2d')](_0x26ad5e)['json'](_0x3bcc68);}};}function respondWithFilteredResult(_0xde12cf,_0x530cb6){return function(_0x10ca5a){if(_0x10ca5a){var _0x45d3d8=typeof _0x530cb6[_0xce41('0x2f')]===_0xce41('0x30')&&typeof _0x530cb6[_0xce41('0x31')]===_0xce41('0x30');var _0x321bce=_0x10ca5a[_0xce41('0x32')];var _0x4abff8=_0x45d3d8?0x0:_0x530cb6['offset'];var _0x7e33dc=_0x45d3d8?_0x10ca5a['count']:_0x530cb6['offset']+_0x530cb6[_0xce41('0x31')];var _0x11fa2e;if(_0x7e33dc>=_0x321bce){_0x7e33dc=_0x321bce;_0x11fa2e=0xc8;}else{_0x11fa2e=0xce;}_0xde12cf[_0xce41('0x2d')](_0x11fa2e);return _0xde12cf[_0xce41('0x33')](_0xce41('0x34'),_0x4abff8+'-'+_0x7e33dc+'/'+_0x321bce)[_0xce41('0x35')](_0x10ca5a);}return null;};}function patchUpdates(_0x3337f0){return function(_0x413592){try{jsonpatch[_0xce41('0x36')](_0x413592,_0x3337f0,!![]);}catch(_0x35a4da){return BPromise[_0xce41('0x37')](_0x35a4da);}return _0x413592[_0xce41('0x38')]();};}function saveUpdates(_0x33615d,_0x43fd24){return function(_0xf53e6d){if(_0xf53e6d){return _0xf53e6d[_0xce41('0x39')](_0x33615d)[_0xce41('0x20')](function(_0x2a647c){return _0x2a647c;});}return null;};}function removeEntity(_0x1ea1d8,_0x2238ff){return function(_0x5a4d7d){if(_0x5a4d7d){return _0x5a4d7d['destroy']()[_0xce41('0x20')](function(){var _0x2342ea=_0x5a4d7d['get']({'plain':!![]});var _0x140e8c=_0xce41('0x3a');return db['UserProfileResource'][_0xce41('0x3b')]({'where':{'type':_0x140e8c,'resourceId':_0x2342ea['id']}})['then'](function(){return _0x5a4d7d;});})['then'](function(){_0x1ea1d8[_0xce41('0x2d')](0xcc)[_0xce41('0x2e')]();});}};}function handleEntityNotFound(_0x152012,_0x3b0514){return function(_0x372bc1){if(!_0x372bc1){_0x152012[_0xce41('0x2c')](0x194);}return _0x372bc1;};}function handleError(_0x451d74,_0x10ff4e){_0x10ff4e=_0x10ff4e||0x1f4;return function(_0x5f4466){logger['error'](_0x5f4466[_0xce41('0x3c')]);if(_0x5f4466[_0xce41('0x3d')]){delete _0x5f4466[_0xce41('0x3d')];}_0x451d74['status'](_0x10ff4e)[_0xce41('0x3e')](_0x5f4466);};}exports[_0xce41('0x3f')]=function(_0x3b04da,_0x31d1dc){var _0x2bb5c6={'include':[{'model':db[_0xce41('0x40')],'as':'mandatoryDispositionPause'}]},_0x5691aa={},_0x4ccbca={'count':0x0,'rows':[]};var _0x2c35e2=_[_0xce41('0x41')](db[_0xce41('0x42')][_0xce41('0x43')],function(_0x189aa9){return{'name':_0x189aa9[_0xce41('0x44')],'type':_0x189aa9[_0xce41('0x45')][_0xce41('0x46')]};});_0x5691aa[_0xce41('0x47')]=_[_0xce41('0x41')](_0x2c35e2,_0xce41('0x3d'));_0x5691aa['query']=_[_0xce41('0x48')](_0x3b04da['query']);_0x5691aa[_0xce41('0x49')]=_[_0xce41('0x4a')](_0x5691aa[_0xce41('0x47')],_0x5691aa[_0xce41('0x4b')]);_0x2bb5c6['attributes']=_[_0xce41('0x4a')](_0x5691aa['model'],qs['fields'](_0x3b04da[_0xce41('0x4b')][_0xce41('0x4c')]));_0x2bb5c6[_0xce41('0x4d')]=_0x2bb5c6[_0xce41('0x4d')]['length']?_0x2bb5c6[_0xce41('0x4d')]:_0x5691aa[_0xce41('0x47')];if(!_0x3b04da[_0xce41('0x4b')][_0xce41('0x4e')](_0xce41('0x4f'))){_0x2bb5c6[_0xce41('0x31')]=qs[_0xce41('0x31')](_0x3b04da[_0xce41('0x4b')][_0xce41('0x31')]);_0x2bb5c6[_0xce41('0x2f')]=qs[_0xce41('0x2f')](_0x3b04da['query']['offset']);}_0x2bb5c6[_0xce41('0x50')]=qs[_0xce41('0x51')](_0x3b04da['query']['sort']);_0x2bb5c6[_0xce41('0x52')]=qs[_0xce41('0x49')](_['pick'](_0x3b04da['query'],_0x5691aa[_0xce41('0x49')]),_0x2c35e2);if(_0x3b04da['query']['filter']){_0x2bb5c6[_0xce41('0x52')]=_[_0xce41('0x53')](_0x2bb5c6[_0xce41('0x52')],{'$or':_['map'](_0x2c35e2,function(_0x59d881){if(_0x59d881[_0xce41('0x45')]!=='VIRTUAL'){var _0x341b81={};_0x341b81[_0x59d881[_0xce41('0x3d')]]={'$like':'%'+_0x3b04da[_0xce41('0x4b')][_0xce41('0x54')]+'%'};return _0x341b81;}})});}_0x2bb5c6=_['merge']({},_0x2bb5c6,_0x3b04da['options']);var _0x4e30f4={'where':_0x2bb5c6[_0xce41('0x52')]};return db[_0xce41('0x42')][_0xce41('0x32')](_0x4e30f4)[_0xce41('0x20')](function(_0x3f405b){_0x4ccbca[_0xce41('0x32')]=_0x3f405b;if(_0x3b04da[_0xce41('0x4b')][_0xce41('0x55')]){_0x2bb5c6[_0xce41('0x56')]=[{'all':!![]}];}return db[_0xce41('0x42')]['findAll'](_0x2bb5c6);})[_0xce41('0x20')](function(_0x404fd9){_0x4ccbca[_0xce41('0x57')]=_0x404fd9;return _0x4ccbca;})[_0xce41('0x20')](respondWithFilteredResult(_0x31d1dc,_0x2bb5c6))[_0xce41('0x2b')](handleError(_0x31d1dc,null));};exports[_0xce41('0x58')]=function(_0x1110a3,_0x17016a){var _0x314b01={'raw':![],'where':{'id':_0x1110a3[_0xce41('0x59')]['id']},'include':[{'model':db[_0xce41('0x40')],'as':_0xce41('0x5a')}]},_0x55d302={};_0x55d302[_0xce41('0x47')]=_[_0xce41('0x48')](db[_0xce41('0x42')][_0xce41('0x43')]);_0x55d302[_0xce41('0x4b')]=_['keys'](_0x1110a3[_0xce41('0x4b')]);_0x55d302['filters']=_[_0xce41('0x4a')](_0x55d302[_0xce41('0x47')],_0x55d302[_0xce41('0x4b')]);_0x314b01[_0xce41('0x4d')]=_[_0xce41('0x4a')](_0x55d302['model'],qs[_0xce41('0x4c')](_0x1110a3[_0xce41('0x4b')][_0xce41('0x4c')]));_0x314b01[_0xce41('0x4d')]=_0x314b01[_0xce41('0x4d')][_0xce41('0x5b')]?_0x314b01[_0xce41('0x4d')]:_0x55d302['model'];if(_0x1110a3['query'][_0xce41('0x55')]){_0x314b01['include']=[{'all':!![]}];}_0x314b01=_[_0xce41('0x53')]({},_0x314b01,_0x1110a3[_0xce41('0x5c')]);return db[_0xce41('0x42')][_0xce41('0x5d')](_0x314b01)[_0xce41('0x20')](handleEntityNotFound(_0x17016a,null))[_0xce41('0x20')](respondWithResult(_0x17016a,null))['catch'](handleError(_0x17016a,null));};exports[_0xce41('0x5e')]=function(_0x41abbd,_0x2c49d2){return db['FaxAccount'][_0xce41('0x5e')](_0x41abbd[_0xce41('0x5f')],{})['then'](function(_0x31135b){var _0x240e74=_0x41abbd[_0xce41('0x60')][_0xce41('0x61')]({'plain':!![]});if(!_0x240e74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x240e74[_0xce41('0x62')]===_0xce41('0x60')){var _0x142aa6=_0x31135b[_0xce41('0x61')]({'plain':!![]});var _0x229b1e='FaxAccounts';return db[_0xce41('0x63')][_0xce41('0x5d')]({'where':{'name':_0x229b1e,'userProfileId':_0x240e74['userProfileId']},'raw':!![]})['then'](function(_0x30061a){if(_0x30061a&&_0x30061a[_0xce41('0x64')]===0x0){return db[_0xce41('0x65')]['create']({'name':_0x142aa6['name'],'resourceId':_0x142aa6['id'],'type':_0x30061a[_0xce41('0x3d')],'sectionId':_0x30061a['id']},{})[_0xce41('0x20')](function(){return _0x31135b;});}else{return _0x31135b;}})['catch'](function(_0x23054d){logger[_0xce41('0x26')](_0xce41('0x66'),_0x23054d);throw _0x23054d;});}return _0x31135b;})[_0xce41('0x20')](respondWithResult(_0x2c49d2,0xc9))['catch'](handleError(_0x2c49d2,null));};exports['update']=function(_0x4dfe45,_0x171202){if(_0x4dfe45[_0xce41('0x5f')]['id']){delete _0x4dfe45['body']['id'];}return db[_0xce41('0x42')][_0xce41('0x5d')]({'where':{'id':_0x4dfe45[_0xce41('0x59')]['id']},'include':[{'model':db[_0xce41('0x40')],'as':'mandatoryDispositionPause'}]})[_0xce41('0x20')](handleEntityNotFound(_0x171202,null))[_0xce41('0x20')](saveUpdates(_0x4dfe45[_0xce41('0x5f')],null))[_0xce41('0x20')](respondWithResult(_0x171202,null))[_0xce41('0x2b')](handleError(_0x171202,null));};exports[_0xce41('0x3b')]=function(_0x2b1574,_0x7e12a5){return db[_0xce41('0x42')][_0xce41('0x5d')]({'where':{'id':_0x2b1574[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x7e12a5,null))[_0xce41('0x20')](removeEntity(_0x7e12a5,null))[_0xce41('0x2b')](handleError(_0x7e12a5,null));};exports['describe']=function(_0x2bd955,_0x334f65){return db[_0xce41('0x42')][_0xce41('0x67')]()[_0xce41('0x20')](respondWithResult(_0x334f65,null))[_0xce41('0x2b')](handleError(_0x334f65,null));};exports[_0xce41('0x68')]=function(_0x403cc3,_0x339905,_0x28c289){if(_0x403cc3[_0xce41('0x5f')]['id']){delete _0x403cc3[_0xce41('0x5f')]['id'];}return db[_0xce41('0x42')][_0xce41('0x5d')]({'where':{'id':_0x403cc3[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x339905,null))[_0xce41('0x20')](function(_0x7176d){if(_0x7176d){_0x403cc3[_0xce41('0x5f')][_0xce41('0x69')]=_0x7176d['id'];return db[_0xce41('0x6a')][_0xce41('0x5e')](_0x403cc3[_0xce41('0x5f')]);}})[_0xce41('0x20')](respondWithResult(_0x339905,null))[_0xce41('0x2b')](handleError(_0x339905,null));};exports[_0xce41('0x6b')]=function(_0x5a2b6b,_0x3f5c9d,_0x54327e){var _0x417d7e={'raw':![],'where':{}};var _0x54718f={};var _0x6bd73c={'count':0x0,'rows':[]};return db[_0xce41('0x42')][_0xce41('0x6c')]({'where':{'id':_0x5a2b6b[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x3f5c9d,null))['then'](function(_0x4e7868){if(_0x4e7868){_0x54718f[_0xce41('0x47')]=_[_0xce41('0x48')](db[_0xce41('0x6a')][_0xce41('0x43')]);_0x54718f[_0xce41('0x4b')]=_[_0xce41('0x48')](_0x5a2b6b[_0xce41('0x4b')]);_0x54718f[_0xce41('0x49')]=_[_0xce41('0x4a')](_0x54718f[_0xce41('0x47')],_0x54718f['query']);_0x417d7e[_0xce41('0x4d')]=_[_0xce41('0x4a')](_0x54718f['model'],qs[_0xce41('0x4c')](_0x5a2b6b[_0xce41('0x4b')][_0xce41('0x4c')]));_0x417d7e['attributes']=_0x417d7e[_0xce41('0x4d')][_0xce41('0x5b')]?_0x417d7e[_0xce41('0x4d')]:_0x54718f[_0xce41('0x47')];if(!_0x5a2b6b[_0xce41('0x4b')][_0xce41('0x4e')](_0xce41('0x4f'))){_0x417d7e[_0xce41('0x31')]=qs[_0xce41('0x31')](_0x5a2b6b[_0xce41('0x4b')]['limit']);_0x417d7e[_0xce41('0x2f')]=qs[_0xce41('0x2f')](_0x5a2b6b['query'][_0xce41('0x2f')]);}_0x417d7e[_0xce41('0x50')]=qs[_0xce41('0x51')](_0x5a2b6b[_0xce41('0x4b')][_0xce41('0x51')]);_0x417d7e['where']=qs[_0xce41('0x49')](_[_0xce41('0x6d')](_0x5a2b6b[_0xce41('0x4b')],_0x54718f['filters']));_0x417d7e[_0xce41('0x52')]['FaxAccountId']=_0x4e7868['id'];if(_0x5a2b6b[_0xce41('0x4b')][_0xce41('0x54')]){_0x417d7e[_0xce41('0x52')]=_[_0xce41('0x53')](_0x417d7e['where'],{'$or':_[_0xce41('0x41')](_0x417d7e[_0xce41('0x4d')],function(_0x210d8a){var _0x5455e9={};_0x5455e9[_0x210d8a]={'$like':'%'+_0x5a2b6b[_0xce41('0x4b')]['filter']+'%'};return _0x5455e9;})});}_0x417d7e=_[_0xce41('0x53')]({},_0x417d7e,_0x5a2b6b[_0xce41('0x5c')]);return db[_0xce41('0x6a')][_0xce41('0x32')]({'where':_0x417d7e['where']})['then'](function(_0x2ad1d9){_0x6bd73c[_0xce41('0x32')]=_0x2ad1d9;if(_0x5a2b6b[_0xce41('0x4b')][_0xce41('0x55')]){_0x417d7e[_0xce41('0x56')]=[{'all':!![]}];}return db[_0xce41('0x6a')][_0xce41('0x6e')](_0x417d7e);})[_0xce41('0x20')](function(_0x41abec){_0x6bd73c[_0xce41('0x57')]=_0x41abec;return _0x6bd73c;});}})[_0xce41('0x20')](respondWithFilteredResult(_0x3f5c9d,_0x417d7e))['catch'](handleError(_0x3f5c9d,null));};exports[_0xce41('0x6f')]=function(_0xd0b5fd,_0x4d5839,_0x21c16a){return db[_0xce41('0x42')][_0xce41('0x5d')]({'where':{'id':_0xd0b5fd['params']['id']}})['then'](handleEntityNotFound(_0x4d5839,null))[_0xce41('0x20')](function(_0x4dedf9){if(_0x4dedf9){return _0x4dedf9[_0xce41('0x6f')](_0xd0b5fd['query'][_0xce41('0x70')]);}})['then'](respondWithStatusCode(_0x4d5839,null))[_0xce41('0x2b')](handleError(_0x4d5839,null));};exports[_0xce41('0x71')]=function(_0x23a4e8,_0x4f47d1,_0x34e91e){if(_0x23a4e8[_0xce41('0x5f')]['id']){delete _0x23a4e8[_0xce41('0x5f')]['id'];}return db['FaxAccount'][_0xce41('0x5d')]({'where':{'id':_0x23a4e8[_0xce41('0x59')]['id']}})['then'](handleEntityNotFound(_0x4f47d1,null))[_0xce41('0x20')](function(_0x37486e){if(_0x37486e){_0x23a4e8['body'][_0xce41('0x69')]=_0x37486e['id'];return db[_0xce41('0x72')][_0xce41('0x5e')](_0x23a4e8[_0xce41('0x5f')]);}})[_0xce41('0x20')](respondWithResult(_0x4f47d1,null))[_0xce41('0x2b')](handleError(_0x4f47d1,null));};exports[_0xce41('0x73')]=function(_0x5b650d,_0x447b02,_0x30052e){var _0xf8a055={'raw':![],'where':{}};var _0x1e3a1d={};var _0x568830={'count':0x0,'rows':[]};return db[_0xce41('0x42')][_0xce41('0x6c')]({'where':{'id':_0x5b650d[_0xce41('0x59')]['id']}})['then'](handleEntityNotFound(_0x447b02,null))[_0xce41('0x20')](function(_0x361871){if(_0x361871){_0x1e3a1d['model']=_['keys'](db[_0xce41('0x72')][_0xce41('0x43')]);_0x1e3a1d[_0xce41('0x4b')]=_[_0xce41('0x48')](_0x5b650d[_0xce41('0x4b')]);_0x1e3a1d[_0xce41('0x49')]=_[_0xce41('0x4a')](_0x1e3a1d[_0xce41('0x47')],_0x1e3a1d['query']);_0xf8a055['attributes']=_[_0xce41('0x4a')](_0x1e3a1d[_0xce41('0x47')],qs[_0xce41('0x4c')](_0x5b650d[_0xce41('0x4b')][_0xce41('0x4c')]));_0xf8a055[_0xce41('0x4d')]=_0xf8a055['attributes']['length']?_0xf8a055['attributes']:_0x1e3a1d[_0xce41('0x47')];if(!_0x5b650d[_0xce41('0x4b')][_0xce41('0x4e')](_0xce41('0x4f'))){_0xf8a055[_0xce41('0x31')]=qs[_0xce41('0x31')](_0x5b650d[_0xce41('0x4b')]['limit']);_0xf8a055[_0xce41('0x2f')]=qs[_0xce41('0x2f')](_0x5b650d[_0xce41('0x4b')][_0xce41('0x2f')]);}_0xf8a055[_0xce41('0x50')]=qs[_0xce41('0x51')](_0x5b650d[_0xce41('0x4b')][_0xce41('0x51')]);_0xf8a055['where']=qs['filters'](_['pick'](_0x5b650d[_0xce41('0x4b')],_0x1e3a1d[_0xce41('0x49')]));_0xf8a055['where'][_0xce41('0x69')]=_0x361871['id'];if(_0x5b650d['query'][_0xce41('0x54')]){_0xf8a055[_0xce41('0x52')]=_[_0xce41('0x53')](_0xf8a055[_0xce41('0x52')],{'$or':_[_0xce41('0x41')](_0xf8a055['attributes'],function(_0xdcb61d){var _0x5b2ed7={};_0x5b2ed7[_0xdcb61d]={'$like':'%'+_0x5b650d[_0xce41('0x4b')][_0xce41('0x54')]+'%'};return _0x5b2ed7;})});}_0xf8a055=_[_0xce41('0x53')]({},_0xf8a055,_0x5b650d[_0xce41('0x5c')]);return db[_0xce41('0x72')][_0xce41('0x32')]({'where':_0xf8a055['where']})[_0xce41('0x20')](function(_0x3b0018){_0x568830[_0xce41('0x32')]=_0x3b0018;if(_0x5b650d['query'][_0xce41('0x55')]){_0xf8a055[_0xce41('0x56')]=[{'all':!![]}];}return db[_0xce41('0x72')][_0xce41('0x6e')](_0xf8a055);})[_0xce41('0x20')](function(_0x1ed269){_0x568830[_0xce41('0x57')]=_0x1ed269;return _0x568830;});}})[_0xce41('0x20')](respondWithFilteredResult(_0x447b02,_0xf8a055))[_0xce41('0x2b')](handleError(_0x447b02,null));};exports['removeAnswers']=function(_0x10316a,_0x151ac8,_0x3c0d7c){return db[_0xce41('0x42')][_0xce41('0x5d')]({'where':{'id':_0x10316a[_0xce41('0x59')]['id']}})['then'](handleEntityNotFound(_0x151ac8,null))[_0xce41('0x20')](function(_0x4077fb){if(_0x4077fb){return _0x4077fb[_0xce41('0x74')](_0x10316a[_0xce41('0x4b')][_0xce41('0x70')]);}})[_0xce41('0x20')](respondWithStatusCode(_0x151ac8,null))[_0xce41('0x2b')](handleError(_0x151ac8,null));};exports['addInteraction']=function(_0x2810ff,_0xa6ec73,_0x5b65ac){return db[_0xce41('0x75')]['find']({'where':{'id':_0x2810ff[_0xce41('0x59')]['id']}})['then'](handleEntityNotFound(_0xa6ec73,null))[_0xce41('0x20')](function(_0x3fe73e){if(_0x3fe73e){return _0x3fe73e[_0xce41('0x76')](_0x2810ff['body']['ids'],_[_0xce41('0x77')](_0x2810ff[_0xce41('0x5f')],[_0xce41('0x70'),'id'])||{});}})[_0xce41('0x20')](respondWithResult(_0xa6ec73,null))[_0xce41('0x2b')](handleError(_0xa6ec73,null));};exports[_0xce41('0x78')]=function(_0x4c13fd,_0x5c73f5,_0x183a17){var _0x3386a4={'raw':![],'where':{}};var _0x7a6955={};var _0x318d6b={'count':0x0,'rows':[]};return db[_0xce41('0x42')][_0xce41('0x6c')]({'where':{'id':_0x4c13fd[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x5c73f5,null))[_0xce41('0x20')](function(_0x2d43a6){if(_0x2d43a6){_0x7a6955[_0xce41('0x47')]=_['keys'](db[_0xce41('0x75')][_0xce41('0x43')]);_0x7a6955[_0xce41('0x4b')]=_[_0xce41('0x48')](_0x4c13fd[_0xce41('0x4b')]);_0x7a6955[_0xce41('0x49')]=_[_0xce41('0x4a')](_0x7a6955[_0xce41('0x47')],_0x7a6955[_0xce41('0x4b')]);_0x3386a4[_0xce41('0x4d')]=_['intersection'](_0x7a6955[_0xce41('0x47')],qs[_0xce41('0x4c')](_0x4c13fd[_0xce41('0x4b')][_0xce41('0x4c')]));_0x3386a4['attributes']=_0x3386a4[_0xce41('0x4d')][_0xce41('0x5b')]?_0x3386a4[_0xce41('0x4d')]:_0x7a6955['model'];if(!_0x4c13fd[_0xce41('0x4b')][_0xce41('0x4e')](_0xce41('0x4f'))){_0x3386a4[_0xce41('0x31')]=qs[_0xce41('0x31')](_0x4c13fd['query'][_0xce41('0x31')]);_0x3386a4['offset']=qs[_0xce41('0x2f')](_0x4c13fd[_0xce41('0x4b')][_0xce41('0x2f')]);}_0x3386a4['order']=qs[_0xce41('0x51')](_0x4c13fd[_0xce41('0x4b')][_0xce41('0x51')]);_0x3386a4[_0xce41('0x52')]=qs[_0xce41('0x49')](_[_0xce41('0x6d')](_0x4c13fd['query'],_0x7a6955[_0xce41('0x49')]));_0x3386a4[_0xce41('0x52')][_0xce41('0x69')]=_0x2d43a6['id'];if(_0x4c13fd[_0xce41('0x4b')]['filter']){_0x3386a4[_0xce41('0x52')]=_['merge'](_0x3386a4[_0xce41('0x52')],{'$or':_[_0xce41('0x41')](_0x3386a4[_0xce41('0x4d')],function(_0x563a89){var _0x499b99={};_0x499b99[_0x563a89]={'$like':'%'+_0x4c13fd['query'][_0xce41('0x54')]+'%'};return _0x499b99;})});}_0x3386a4=_[_0xce41('0x53')]({},_0x3386a4,_0x4c13fd[_0xce41('0x5c')]);return db[_0xce41('0x75')][_0xce41('0x32')]({'where':_0x3386a4[_0xce41('0x52')]})['then'](function(_0x49be45){_0x318d6b[_0xce41('0x32')]=_0x49be45;if(_0x4c13fd[_0xce41('0x4b')][_0xce41('0x55')]){_0x3386a4[_0xce41('0x56')]=[{'model':db[_0xce41('0x79')],'as':'Contact','required':![]},{'model':db[_0xce41('0x7a')],'as':_0xce41('0x7b'),'attributes':['name',_0xce41('0x7c'),_0xce41('0x7d')],'required':![]},{'model':db[_0xce41('0x7e')],'as':_0xce41('0x7f'),'attributes':['id',_0xce41('0x3d'),_0xce41('0x80')],'where':_0x4c13fd[_0xce41('0x4b')][_0xce41('0x81')]?{'id':_0x4c13fd[_0xce41('0x4b')][_0xce41('0x81')]}:undefined,'required':_0x4c13fd[_0xce41('0x4b')][_0xce41('0x81')]?!![]:![]}];}return db[_0xce41('0x75')][_0xce41('0x6e')](_0x3386a4);})[_0xce41('0x20')](function(_0x59abff){_0x318d6b[_0xce41('0x57')]=_0x59abff;return _0x318d6b;});}})['then'](respondWithFilteredResult(_0x5c73f5,_0x3386a4))[_0xce41('0x2b')](handleError(_0x5c73f5,null));};exports[_0xce41('0x82')]=function(_0xc77d65,_0x4ae5a9){var _0x51c721=_0xc77d65['params']['id'];var _0x51c83a=_0xc77d65[_0xce41('0x5f')];var _0xab802a=0xc8;var _0x2139d7=null;return db[_0xce41('0x83')][_0xce41('0x84')]({'isolationLevel':db[_0xce41('0x83')][_0xce41('0x85')][_0xce41('0x86')][_0xce41('0x87')]},function(_0xd6ce34){return db[_0xce41('0x42')][_0xce41('0x6c')]({'where':{'id':_0x51c721},'transaction':_0xd6ce34})['then'](function(_0x377a0e){if(_0x377a0e){return db[_0xce41('0x88')][_0xce41('0x3b')]({'where':{'FaxAccountId':_0x51c721},'transaction':_0xd6ce34})[_0xce41('0x20')](function(){var _0x52bdfd=_['map'](_0x51c83a,function(_0x333611){_0x333611[_0xce41('0x69')]=_0x51c721;return _0x333611;});return db[_0xce41('0x88')]['bulkCreate'](_0x52bdfd,{'transaction':_0xd6ce34});});}else{_0xab802a=0x194;_0x2139d7=[];}});})[_0xce41('0x20')](function(){if(_0xab802a!==0x194){return db['FaxApplication'][_0xce41('0x89')]({'where':{'FaxAccountId':_0x51c721},'order':'priority'})['then'](function(_0x3ea4a7){_0x2139d7=_0x3ea4a7;});}})[_0xce41('0x2b')](function(_0x1d8b51){_0xab802a=0x1f4;logger[_0xce41('0x26')](_0x1d8b51[_0xce41('0x3c')]);if(_0x1d8b51['name']){delete _0x1d8b51[_0xce41('0x3d')];}_0x2139d7=_0x1d8b51;})[_0xce41('0x8a')](function(){if(_0x2139d7===null){_0x4ae5a9['sendStatus'](_0xab802a);}else{if(_0xab802a===0x1f4){_0x4ae5a9[_0xce41('0x2d')](_0xab802a)[_0xce41('0x3e')](_0x2139d7);}else{_0x4ae5a9[_0xce41('0x2d')](_0xab802a)[_0xce41('0x35')](_0x2139d7);}}});};exports['getApplications']=function(_0x67a0d6,_0x5b7cd6,_0x4ad68b){var _0x30df4c={};var _0x4ee829={};var _0x1b2f7e;var _0x136254;return db[_0xce41('0x42')][_0xce41('0x6c')]({'where':{'id':_0x67a0d6[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x5b7cd6,null))[_0xce41('0x20')](function(_0x266e0c){if(_0x266e0c){_0x1b2f7e=_0x266e0c;_0x4ee829['model']=_[_0xce41('0x48')](db[_0xce41('0x88')]['rawAttributes']);_0x4ee829[_0xce41('0x4b')]=_[_0xce41('0x48')](_0x67a0d6['query']);_0x4ee829[_0xce41('0x49')]=_[_0xce41('0x4a')](_0x4ee829[_0xce41('0x47')],_0x4ee829[_0xce41('0x4b')]);_0x30df4c[_0xce41('0x4d')]=_['intersection'](_0x4ee829['model'],qs['fields'](_0x67a0d6[_0xce41('0x4b')][_0xce41('0x4c')]));_0x30df4c[_0xce41('0x4d')]=_0x30df4c['attributes'][_0xce41('0x5b')]?_0x30df4c[_0xce41('0x4d')]:_0x4ee829[_0xce41('0x47')];_0x30df4c[_0xce41('0x50')]=qs[_0xce41('0x51')](_0x67a0d6[_0xce41('0x4b')][_0xce41('0x51')]);_0x30df4c['where']=qs[_0xce41('0x49')](_[_0xce41('0x6d')](_0x67a0d6['query'],_0x4ee829[_0xce41('0x49')]));if(_0x67a0d6[_0xce41('0x4b')][_0xce41('0x54')]){_0x30df4c[_0xce41('0x52')]=_['merge'](_0x30df4c[_0xce41('0x52')],{'$or':_[_0xce41('0x41')](_0x30df4c['attributes'],function(_0x21cfc3){var _0x1c8159={};_0x1c8159[_0x21cfc3]={'$like':'%'+_0x67a0d6[_0xce41('0x4b')][_0xce41('0x54')]+'%'};return _0x1c8159;})});}_0x30df4c=_['merge']({},_0x30df4c,_0x67a0d6[_0xce41('0x5c')]);return _0x1b2f7e['getApplications'](_0x30df4c);}})[_0xce41('0x20')](function(_0x25d938){if(_0x25d938){_0x136254=_0x25d938[_0xce41('0x5b')];if(!_0x67a0d6[_0xce41('0x4b')][_0xce41('0x4e')](_0xce41('0x4f'))){_0x30df4c['limit']=qs[_0xce41('0x31')](_0x67a0d6[_0xce41('0x4b')][_0xce41('0x31')]);_0x30df4c[_0xce41('0x2f')]=qs[_0xce41('0x2f')](_0x67a0d6[_0xce41('0x4b')][_0xce41('0x2f')]);}return _0x1b2f7e[_0xce41('0x8b')](_0x30df4c);}})['then'](function(_0x16bbe3){if(_0x16bbe3){return _0x16bbe3?{'count':_0x136254,'rows':_0x16bbe3}:null;}})[_0xce41('0x20')](respondWithResult(_0x5b7cd6,null))['catch'](handleError(_0x5b7cd6,null));};function Extension(_0x122144,_0x1728c4,_0x47777c,_0x4786f9){this['context']='from-voip-provider';this['exten']=_0x122144[_0xce41('0x8c')];this[_0xce41('0x8d')]=_0x4786f9;this[_0xce41('0x45')]=_0xce41('0x8e');this[_0xce41('0x8f')]=_0xce41('0x90');this[_0xce41('0x69')]=_0x122144['id'];this[_0xce41('0x91')]=_0x1728c4;this[_0xce41('0x92')]=_0x47777c;}function createExtensionsReciveFax(_0x3af7e6){var _0x21c5e1=0x1;var _0x5f1168=[];_0x5f1168[_0xce41('0x93')](new Extension(_0x3af7e6,_0x21c5e1,'',_0xce41('0x94')));_0x21c5e1+=0x1;_0x5f1168[_0xce41('0x93')](new Extension(_0x3af7e6,_0x21c5e1,_0xce41('0x95'),_0xce41('0x96')));_0x21c5e1+=0x1;for(var _0x47d2ea in _0x3af7e6){if(_0x3af7e6[_0xce41('0x4e')](_0x47d2ea)&&(_0x47d2ea===_0xce41('0x97')||_0x47d2ea===_0xce41('0x8c')||_0x47d2ea===_0xce41('0x98')||_0x47d2ea===_0xce41('0x99')||_0x47d2ea===_0xce41('0x9a')||_0x47d2ea===_0xce41('0x9b')||_0x47d2ea===_0xce41('0x9c')||_0x47d2ea===_0xce41('0x9d')||_0x47d2ea==='t38timeout')){_0x5f1168[_0xce41('0x93')](new Extension(_0x3af7e6,_0x21c5e1,_0xce41('0x9e')+_0x47d2ea+')='+_0x3af7e6[_0x47d2ea],_0xce41('0x96')));_0x21c5e1+=0x1;}}_0x5f1168[_0xce41('0x93')](new Extension(_0x3af7e6,_0x21c5e1,'6','Wait'));_0x21c5e1+=0x1;_0x5f1168[_0xce41('0x93')](new Extension(_0x3af7e6,_0x21c5e1,_0xce41('0x9f'),'ReceiveFax'));_0x21c5e1=0x0;return _0x5f1168;}exports['addAccountApplications']=function(_0x2a3860,_0xd982b,_0x4206fe){var _0x5ab102;return db[_0xce41('0x83')][_0xce41('0x84')](function(_0x24c146){return db[_0xce41('0x42')][_0xce41('0x5e')](_0x2a3860[_0xce41('0x5f')],{'transaction':_0x24c146})[_0xce41('0x20')](function(_0x33d6ce){_0x5ab102=_0x33d6ce['get']({'plain':!![]});return db[_0xce41('0xa0')][_0xce41('0xa1')](createExtensionsReciveFax(_0x5ab102),{'transaction':_0x24c146});});})[_0xce41('0x20')](function(){return _0x5ab102;})[_0xce41('0x20')](respondWithResult(_0xd982b,null))[_0xce41('0x2b')](handleError(_0xd982b,null));};exports[_0xce41('0xa2')]=function(_0x27e836,_0x57258d,_0x55b527){var _0x301bfb;return db[_0xce41('0x83')][_0xce41('0x84')](function(_0x58e783){return db[_0xce41('0x42')][_0xce41('0x39')](_0x27e836[_0xce41('0x5f')],{'where':{'id':_0x27e836['body']['id']},'transaction':_0x58e783})['then'](function(_0x5d96d0){return db['VoiceExtension'][_0xce41('0x3b')]({'where':{'FaxAccountId':_0x27e836[_0xce41('0x5f')]['id']},'transaction':_0x58e783})[_0xce41('0x20')](function(_0x22fa11){return db[_0xce41('0xa0')][_0xce41('0xa1')](createExtensionsReciveFax(_['omit'](_0x27e836[_0xce41('0x5f')],[_0xce41('0xa3'),_0xce41('0x46'),_0xce41('0xa4'),_0xce41('0xa5'),_0xce41('0xa6'),_0xce41('0xa7')])),{'transaction':_0x58e783});});});})[_0xce41('0x20')](function(){return db[_0xce41('0x42')]['findById'](_0x27e836[_0xce41('0x5f')]['id']);})[_0xce41('0x20')](respondWithResult(_0x57258d,null))[_0xce41('0x2b')](handleError(_0x57258d,null));};exports[_0xce41('0xa8')]=function(_0x3a8234,_0x332b0d,_0x4e8d7b){var _0x1f337a={'raw':!![],'where':{}};var _0x3ad0cf={};var _0x4cfdcd={'count':0x0,'rows':[]};return db[_0xce41('0x42')][_0xce41('0x6c')]({'where':{'id':_0x3a8234[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x332b0d,null))['then'](function(_0x53e212){if(_0x53e212){_0x3ad0cf[_0xce41('0x47')]=_[_0xce41('0x48')](db[_0xce41('0xa9')][_0xce41('0x43')]);_0x3ad0cf[_0xce41('0x4b')]=_[_0xce41('0x48')](_0x3a8234[_0xce41('0x4b')]);_0x3ad0cf[_0xce41('0x49')]=_[_0xce41('0x4a')](_0x3ad0cf[_0xce41('0x47')],_0x3ad0cf[_0xce41('0x4b')]);_0x1f337a[_0xce41('0x4d')]=_[_0xce41('0x4a')](_0x3ad0cf['model'],qs[_0xce41('0x4c')](_0x3a8234[_0xce41('0x4b')][_0xce41('0x4c')]));_0x1f337a[_0xce41('0x4d')]=_0x1f337a['attributes']['length']?_0x1f337a[_0xce41('0x4d')]:_0x3ad0cf[_0xce41('0x47')];if(!_0x3a8234[_0xce41('0x4b')][_0xce41('0x4e')](_0xce41('0x4f'))){_0x1f337a[_0xce41('0x31')]=qs['limit'](_0x3a8234[_0xce41('0x4b')][_0xce41('0x31')]);_0x1f337a[_0xce41('0x2f')]=qs['offset'](_0x3a8234[_0xce41('0x4b')][_0xce41('0x2f')]);}_0x1f337a[_0xce41('0x50')]=qs[_0xce41('0x51')](_0x3a8234['query'][_0xce41('0x51')]);_0x1f337a[_0xce41('0x52')]=qs[_0xce41('0x49')](_[_0xce41('0x6d')](_0x3a8234[_0xce41('0x4b')],_0x3ad0cf[_0xce41('0x49')]));_0x1f337a[_0xce41('0x52')][_0xce41('0x69')]=_0x53e212['id'];if(_0x3a8234[_0xce41('0x4b')][_0xce41('0x54')]){_0x1f337a[_0xce41('0x52')]=_[_0xce41('0x53')](_0x1f337a[_0xce41('0x52')],{'$or':_[_0xce41('0x41')](_0x1f337a[_0xce41('0x4d')],function(_0x5714c7){var _0x5d4610={};_0x5d4610[_0x5714c7]={'$like':'%'+_0x3a8234[_0xce41('0x4b')][_0xce41('0x54')]+'%'};return _0x5d4610;})});}if(_0x3a8234[_0xce41('0x4b')][_0xce41('0xaa')]){var _0x4906b8=_0x3a8234['query'][_0xce41('0xaa')][_0xce41('0xab')](',');var _0x500306={};_0x500306[_0x4906b8[0x0]]={'$gte':moment(_0x4906b8[0x1])[_0xce41('0xac')](_0xce41('0xad'))};_0x1f337a['where']=_[_0xce41('0x53')](_0x1f337a[_0xce41('0x52')],_0x500306);}_0x1f337a=_[_0xce41('0x53')]({},_0x1f337a,_0x3a8234[_0xce41('0x5c')]);return db['FaxMessage'][_0xce41('0x32')]({'where':_0x1f337a[_0xce41('0x52')]})[_0xce41('0x20')](function(_0x3a81d3){_0x4cfdcd[_0xce41('0x32')]=_0x3a81d3;if(_0x3a8234['query'][_0xce41('0x55')]){_0x1f337a[_0xce41('0x56')]=[{'all':!![]}];}return db[_0xce41('0xa9')][_0xce41('0x6e')](_0x1f337a);})['then'](function(_0x33369e){_0x4cfdcd[_0xce41('0x57')]=_0x33369e;return _0x4cfdcd;});}})[_0xce41('0x20')](respondWithFilteredResult(_0x332b0d,_0x1f337a))[_0xce41('0x2b')](handleError(_0x332b0d,null));};exports['send']=function(_0x3e8177,_0x5d3dfc,_0x7bebc4){var _0x3535f2,_0x1af797={},_0x4eb2d8;if(_0x3e8177[_0xce41('0x5f')]['to']){_0x4eb2d8=_0x3e8177['body']['to'][0x0];}return db[_0xce41('0x42')][_0xce41('0x5d')]({'where':{'id':_0x3e8177[_0xce41('0x59')]['id']},'include':[{'model':db[_0xce41('0xae')],'as':_0xce41('0xaf'),'include':[{'model':db[_0xce41('0x79')],'as':_0xce41('0xb0'),'where':{'fax':_0x4eb2d8},'limit':0x1,'order':[[_0xce41('0xa5'),'DESC']]}]}]})[_0xce41('0x20')](handleEntityNotFound(_0x5d3dfc,null))['then'](function(_0x42992a){_0x3535f2=_0x42992a;if(_0x3e8177[_0xce41('0x5f')][_0xce41('0xb1')]&&_0x3e8177['body'][_0xce41('0xb1')]['length']){for(var _0x41275d=0x0;_0x41275d<_0x3e8177[_0xce41('0x5f')][_0xce41('0xb1')]['length'];_0x41275d+=0x1){_0x3e8177[_0xce41('0x5f')][_0xce41('0xb1')][_0x41275d]={'filename':_0x3e8177[_0xce41('0x5f')][_0xce41('0xb1')][_0x41275d]['name'],'id':_0x3e8177['body'][_0xce41('0xb1')][_0x41275d]['id'],'path':path['join'](config['root'],_0xce41('0xb2'),_0x3e8177[_0xce41('0x5f')]['attachments'][_0x41275d][_0xce41('0xb3')])};}}return respondWithRpcPromise(_0xce41('0xb4'),_0xce41('0xb4'),{'FaxAccountId':_[_0xce41('0xb5')](_0x3e8177[_0xce41('0x59')]['id'])?undefined:_0x3e8177[_0xce41('0x59')]['id'],'path':_[_0xce41('0xb5')](_0x3e8177[_0xce41('0x5f')][_0xce41('0xb1')][0x0]['path'])?undefined:_0x3e8177[_0xce41('0x5f')][_0xce41('0xb1')][0x0][_0xce41('0x5')],'fax':_['isNil'](_0x3e8177[_0xce41('0x5f')]['to'][0x0])?undefined:_0x3e8177['body']['to'][0x0]},client9002);})[_0xce41('0x20')](function(){if(_0x3535f2){if(_[_0xce41('0xb5')](_0x3e8177[_0xce41('0x5f')][_0xce41('0xb6')])){_0x3e8177[_0xce41('0x5f')][_0xce41('0xb6')]=util[_0xce41('0xac')](_0xce41('0xb7'),_0x3535f2[_0xce41('0x3d')],_0x3535f2['fax']);}if(_0x3535f2[_0xce41('0xaf')]){if(_0x3535f2['List'][_0xce41('0xb0')][_0xce41('0x5b')]){return _0x3535f2[_0xce41('0xaf')][_0xce41('0xb0')][0x0];}else{return db['CmContact'][_0xce41('0x5e')](_[_0xce41('0x18')](_0x3e8177['body'],{'firstName':_0x3e8177['body']['to'][0x0],'phone':_0x3e8177[_0xce41('0x5f')]['to'][0x0],'fax':_0x3e8177['body']['to'][0x0],'ListId':_0x3535f2['ListId']}));}}else{throw new Error(_0xce41('0xb8'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xce41('0x20')](function(_0x5d3ae2){if(_0x5d3ae2){return db[_0xce41('0x75')][_0xce41('0x5d')]({'where':{'ContactId':_0x5d3ae2['id'],'closed':![],'FaxAccountId':_0x3535f2['id']}})[_0xce41('0x20')](function(_0x31469e){if(_0x31469e){return[_0x31469e,![]];}return db[_0xce41('0x75')][_0xce41('0x5e')]({'UserId':_0x3e8177[_0xce41('0x60')]['id'],'ContactId':_0x5d3ae2['id'],'FaxAccountId':_0x3535f2['id'],'fax':_0x3e8177[_0xce41('0x5f')]['to'][0x0],'firstMsgDirection':_0xce41('0xb9'),'Messages':[_['merge'](_0x3e8177[_0xce41('0x5f')],{'read':![],'body':_0x3e8177[_0xce41('0x5f')]['attachments'][0x0][_0xce41('0xba')],'FaxAccountId':_0x3535f2['id'],'UserId':_0x3e8177[_0xce41('0x60')]['id'],'ContactId':_0x5d3ae2['id'],'AttachmentId':_0x3e8177['body'][_0xce41('0xb1')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xce41('0xbb')}]})[_0xce41('0x20')](function(_0x4042b3){return[_0x4042b3,!![]];});});}else{throw new Error(_0xce41('0xbc'));}})[_0xce41('0xbd')](function(_0x276c07,_0x2c2792){if(_0x2c2792){return _0x276c07;}return db['FaxMessage'][_0xce41('0x5e')]({'direction':'out','read':![],'body':_0x3e8177['body'][_0xce41('0xb1')][0x0][_0xce41('0xba')],'FaxAccountId':_0x3535f2['id'],'FaxInteractionId':_0x276c07['id'],'UserId':_0x3e8177[_0xce41('0x60')]['id'],'ContactId':_0x276c07[_0xce41('0xbe')],'AttachmentId':_0x3e8177['body'][_0xce41('0xb1')][0x0]['id']})[_0xce41('0x20')](function(_0x13a2fc){_0x276c07[_0xce41('0xbf')]['Messages']=[];_0x276c07[_0xce41('0xbf')][_0xce41('0xbb')][_0xce41('0x93')](_0x13a2fc[_0xce41('0xbf')]);return _0x276c07;});})[_0xce41('0x20')](function(_0x5632ca){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xce41('0xb5')](_0x3e8177[_0xce41('0x59')]['id'])?undefined:_0x3e8177[_0xce41('0x59')]['id'],'path':_[_0xce41('0xb5')](_0x3e8177[_0xce41('0x5f')][_0xce41('0xb1')][0x0][_0xce41('0x5')])?undefined:_0x3e8177['body'][_0xce41('0xb1')][0x0][_0xce41('0x5')],'fax':_[_0xce41('0xb5')](_0x3e8177[_0xce41('0x5f')]['to'][0x0])?undefined:_0x3e8177[_0xce41('0x5f')]['to'][0x0],'AttachmentId':_0x3e8177['body']['attachments'][0x0]['id']},client9002)[_0xce41('0x20')](function(_0x573439){logger['info']('SendFaxRpc,\x20%s',_0x573439);})[_0xce41('0x2b')](function(_0x53190e){logger[_0xce41('0x21')]('SendFaxRpc,\x20%s',_0x53190e);});return _0x5632ca;})['then'](respondWithResult(_0x5d3dfc,null))[_0xce41('0x2b')](handleError(_0x5d3dfc,null));};exports['addAgents']=function(_0x508103,_0x8e27bc,_0x3c0db3){return db['FaxAccount'][_0xce41('0x5d')]({'where':{'id':_0x508103[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x8e27bc,null))[_0xce41('0x20')](function(_0x19fa70){if(_0x19fa70){return _0x19fa70[_0xce41('0xc0')](_0x508103[_0xce41('0x5f')][_0xce41('0x70')],_[_0xce41('0x77')](_0x508103[_0xce41('0x5f')],['ids','id'])||{})['spread'](function(_0x833c3f){for(var _0x3322c4=0x0;_0x3322c4<_0x508103[_0xce41('0x5f')][_0xce41('0x70')][_0xce41('0x5b')];_0x3322c4+=0x1){socket[_0xce41('0xc1')](_0xce41('0xc2'),{'UserId':Number(_0x508103[_0xce41('0x5f')][_0xce41('0x70')][_0x3322c4]),'FaxAccountId':Number(_0x508103['params']['id'])});}return _0x833c3f;});}})[_0xce41('0x20')](respondWithResult(_0x8e27bc,null))[_0xce41('0x2b')](handleError(_0x8e27bc,null));};exports[_0xce41('0xc3')]=function(_0x4bb8ac,_0x336398,_0x28e627){return db[_0xce41('0x42')]['find']({'where':{'id':_0x4bb8ac['params']['id']}})['then'](handleEntityNotFound(_0x336398,null))['then'](function(_0x42851){if(_0x42851){return _0x42851[_0xce41('0xc3')](_0x4bb8ac[_0xce41('0x4b')][_0xce41('0x70')])['then'](function(){if(_['isArray'](_0x4bb8ac[_0xce41('0x4b')][_0xce41('0x70')])){for(var _0x1e5f30=0x0;_0x1e5f30<_0x4bb8ac[_0xce41('0x4b')][_0xce41('0x70')]['length'];_0x1e5f30+=0x1){socket[_0xce41('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x4bb8ac[_0xce41('0x4b')]['ids'][_0x1e5f30]),'FaxAccountId':Number(_0x4bb8ac[_0xce41('0x59')]['id'])});}}else{socket[_0xce41('0xc1')](_0xce41('0xc4'),{'UserId':Number(_0x4bb8ac['query'][_0xce41('0x70')]),'FaxAccountId':Number(_0x4bb8ac['params']['id'])});}});}})['then'](respondWithStatusCode(_0x336398,null))[_0xce41('0x2b')](handleError(_0x336398,null));};exports[_0xce41('0xc5')]=function(_0x27ea25,_0x4cdddc,_0x17dc5d){var _0x2ce245={};var _0x12c961={};var _0x12cafe;var _0x5d0dde;return db[_0xce41('0x42')][_0xce41('0x6c')]({'where':{'id':_0x27ea25[_0xce41('0x59')]['id']}})[_0xce41('0x20')](handleEntityNotFound(_0x4cdddc,null))[_0xce41('0x20')](function(_0x156131){if(_0x156131){_0x12cafe=_0x156131;_0x12c961[_0xce41('0x47')]=_[_0xce41('0x48')](db[_0xce41('0x7a')][_0xce41('0x43')]);_0x12c961[_0xce41('0x4b')]=_['keys'](_0x27ea25[_0xce41('0x4b')]);_0x12c961['filters']=_[_0xce41('0x4a')](_0x12c961['model'],_0x12c961[_0xce41('0x4b')]);_0x2ce245[_0xce41('0x4d')]=_[_0xce41('0x4a')](_0x12c961[_0xce41('0x47')],qs[_0xce41('0x4c')](_0x27ea25['query']['fields']));_0x2ce245['attributes']=_0x2ce245[_0xce41('0x4d')][_0xce41('0x5b')]?_0x2ce245[_0xce41('0x4d')]:_0x12c961[_0xce41('0x47')];_0x2ce245[_0xce41('0x50')]=qs[_0xce41('0x51')](_0x27ea25[_0xce41('0x4b')]['sort']);_0x2ce245['where']=qs[_0xce41('0x49')](_['pick'](_0x27ea25['query'],_0x12c961[_0xce41('0x49')]));if(_0x27ea25[_0xce41('0x4b')][_0xce41('0x54')]){_0x2ce245[_0xce41('0x52')]=_['merge'](_0x2ce245[_0xce41('0x52')],{'$or':_[_0xce41('0x41')](_0x2ce245['attributes'],function(_0x240520){var _0x87c1a3={};_0x87c1a3[_0x240520]={'$like':'%'+_0x27ea25[_0xce41('0x4b')]['filter']+'%'};return _0x87c1a3;})});}_0x2ce245=_[_0xce41('0x53')]({},_0x2ce245,_0x27ea25[_0xce41('0x5c')]);return _0x12cafe[_0xce41('0xc5')](_0x2ce245);}})[_0xce41('0x20')](function(_0x3d185e){if(_0x3d185e){_0x5d0dde=_0x3d185e[_0xce41('0x5b')];if(!_0x27ea25['query']['hasOwnProperty'](_0xce41('0x4f'))){_0x2ce245['limit']=qs[_0xce41('0x31')](_0x27ea25[_0xce41('0x4b')][_0xce41('0x31')]);_0x2ce245['offset']=qs[_0xce41('0x2f')](_0x27ea25[_0xce41('0x4b')][_0xce41('0x2f')]);}return _0x12cafe['getAgents'](_0x2ce245);}})['then'](function(_0x4b766d){if(_0x4b766d){return _0x4b766d?{'count':_0x5d0dde,'rows':_0x4b766d}:null;}})[_0xce41('0x20')](respondWithResult(_0x4cdddc,null))['catch'](handleError(_0x4cdddc,null));}; \ No newline at end of file +var _0xefc7=['count','set','Content-Range','reject','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','merge','where','VIRTUAL','options','FaxAccount','includeAll','include','rows','show','Pause','mandatoryDispositionPause','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','filter','findAll','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tags','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','send','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','Set','gateway','faxdetect','headerinfo','maxrate','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','Contact\x20not\x20found','spread','out','filename','dataValues','Messages','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','isArray','emit','userFaxAccount:remove','User','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0xefc7,0x15b));var _0x7efc=function(_0x25d6fa,_0x142ed8){_0x25d6fa=_0x25d6fa-0x0;var _0x5d1c92=_0xefc7[_0x25d6fa];return _0x5d1c92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7efc('0x0'));var zipdir=require(_0x7efc('0x1'));var jsonpatch=require(_0x7efc('0x2'));var rp=require(_0x7efc('0x3'));var moment=require(_0x7efc('0x4'));var BPromise=require(_0x7efc('0x5'));var Mustache=require('mustache');var util=require(_0x7efc('0x6'));var path=require(_0x7efc('0x7'));var sox=require(_0x7efc('0x8'));var csv=require(_0x7efc('0x9'));var ejs=require(_0x7efc('0xa'));var fs=require('fs');var fs_extra=require(_0x7efc('0xb'));var _=require(_0x7efc('0xc'));var squel=require('squel');var crypto=require(_0x7efc('0xd'));var jsforce=require(_0x7efc('0xe'));var deskjs=require(_0x7efc('0xf'));var toCsv=require(_0x7efc('0x9'));var querystring=require(_0x7efc('0x10'));var Papa=require('papaparse');var Redis=require(_0x7efc('0x11'));var authService=require(_0x7efc('0x12'));var qs=require(_0x7efc('0x13'));var as=require(_0x7efc('0x14'));var hardwareService=require(_0x7efc('0x15'));var logger=require(_0x7efc('0x16'))(_0x7efc('0x17'));var utils=require(_0x7efc('0x18'));var config=require(_0x7efc('0x19'));var licenseUtil=require(_0x7efc('0x1a'));var db=require(_0x7efc('0x1b'))['db'];config[_0x7efc('0x1c')]=_[_0x7efc('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7efc('0x1e'))(new Redis(config[_0x7efc('0x1c')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x7efc('0x1f'));var client=jayson[_0x7efc('0x20')][_0x7efc('0x21')]({'port':0x232c});var client9002=jayson[_0x7efc('0x20')][_0x7efc('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x103411,_0x48839f,_0x5a15bc,_0x4457df){return new BPromise(function(_0x5c1a28,_0x3c494c){var _0x50e347=_0x4457df||client;return _0x50e347['request'](_0x103411,_0x5a15bc)[_0x7efc('0x22')](function(_0x2ca121){logger[_0x7efc('0x23')]('FaxAccount,\x20%s,\x20%s',_0x48839f,_0x7efc('0x24'));logger['debug'](_0x7efc('0x25'),_0x48839f,'request\x20sent',JSON[_0x7efc('0x26')](_0x2ca121));if(_0x2ca121[_0x7efc('0x27')]){if(_0x2ca121['error'][_0x7efc('0x28')]===0x1f4){logger[_0x7efc('0x27')](_0x7efc('0x29'),_0x48839f,_0x2ca121['error'][_0x7efc('0x2a')]);return _0x3c494c(_0x2ca121[_0x7efc('0x27')][_0x7efc('0x2a')]);}logger[_0x7efc('0x27')](_0x7efc('0x29'),_0x48839f,_0x2ca121[_0x7efc('0x27')][_0x7efc('0x2a')]);return _0x5c1a28(_0x2ca121[_0x7efc('0x27')][_0x7efc('0x2a')]);}else{logger[_0x7efc('0x23')](_0x7efc('0x29'),_0x48839f,'request\x20sent');_0x5c1a28(_0x2ca121[_0x7efc('0x2b')]['message']);}})['catch'](function(_0x124c67){logger[_0x7efc('0x27')](_0x7efc('0x29'),_0x48839f,_0x124c67);_0x3c494c(_0x124c67);});});}function respondWithStatusCode(_0xe1c7cd,_0x33256c){_0x33256c=_0x33256c||0xcc;return function(_0x3cd928){if(_0x3cd928){return _0xe1c7cd[_0x7efc('0x2c')](_0x33256c);}return _0xe1c7cd[_0x7efc('0x2d')](_0x33256c)[_0x7efc('0x2e')]();};}function respondWithResult(_0x5b6b9e,_0x1d4690){_0x1d4690=_0x1d4690||0xc8;return function(_0x5a286f){if(_0x5a286f){return _0x5b6b9e[_0x7efc('0x2d')](_0x1d4690)[_0x7efc('0x2f')](_0x5a286f);}};}function respondWithFilteredResult(_0xabe1d8,_0x4803da){return function(_0x5daf1c){if(_0x5daf1c){var _0x1d93b5=typeof _0x4803da[_0x7efc('0x30')]===_0x7efc('0x31')&&typeof _0x4803da[_0x7efc('0x32')]===_0x7efc('0x31');var _0x2d31bf=_0x5daf1c[_0x7efc('0x33')];var _0x10df1e=_0x1d93b5?0x0:_0x4803da['offset'];var _0x30065e=_0x1d93b5?_0x5daf1c[_0x7efc('0x33')]:_0x4803da[_0x7efc('0x30')]+_0x4803da[_0x7efc('0x32')];var _0x45139b;if(_0x30065e>=_0x2d31bf){_0x30065e=_0x2d31bf;_0x45139b=0xc8;}else{_0x45139b=0xce;}_0xabe1d8[_0x7efc('0x2d')](_0x45139b);return _0xabe1d8[_0x7efc('0x34')](_0x7efc('0x35'),_0x10df1e+'-'+_0x30065e+'/'+_0x2d31bf)['json'](_0x5daf1c);}return null;};}function patchUpdates(_0x1ee9fe){return function(_0x5540a7){try{jsonpatch['apply'](_0x5540a7,_0x1ee9fe,!![]);}catch(_0x4b95e6){return BPromise[_0x7efc('0x36')](_0x4b95e6);}return _0x5540a7['save']();};}function saveUpdates(_0x3862aa,_0x36f910){return function(_0x278fca){if(_0x278fca){return _0x278fca['update'](_0x3862aa)[_0x7efc('0x22')](function(_0x555dd8){return _0x555dd8;});}return null;};}function removeEntity(_0xdfede6,_0x50283d){return function(_0x4fec94){if(_0x4fec94){return _0x4fec94[_0x7efc('0x37')]()[_0x7efc('0x22')](function(){var _0x48819c=_0x4fec94[_0x7efc('0x38')]({'plain':!![]});var _0x3a26ff=_0x7efc('0x39');return db[_0x7efc('0x3a')][_0x7efc('0x37')]({'where':{'type':_0x3a26ff,'resourceId':_0x48819c['id']}})[_0x7efc('0x22')](function(){return _0x4fec94;});})[_0x7efc('0x22')](function(){_0xdfede6[_0x7efc('0x2d')](0xcc)[_0x7efc('0x2e')]();});}};}function handleEntityNotFound(_0x524183,_0x2f4331){return function(_0x396812){if(!_0x396812){_0x524183['sendStatus'](0x194);}return _0x396812;};}function handleError(_0x3d1647,_0x17c7f8){_0x17c7f8=_0x17c7f8||0x1f4;return function(_0x2fc061){logger['error'](_0x2fc061[_0x7efc('0x3b')]);if(_0x2fc061[_0x7efc('0x3c')]){delete _0x2fc061[_0x7efc('0x3c')];}_0x3d1647[_0x7efc('0x2d')](_0x17c7f8)['send'](_0x2fc061);};}exports[_0x7efc('0x3d')]=function(_0xec9ef,_0x4bd7f7){var _0x4cf8bf={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xc08d44={},_0x43cdd6={'count':0x0,'rows':[]};var _0x214545=_[_0x7efc('0x3e')](db['FaxAccount'][_0x7efc('0x3f')],function(_0x129058){return{'name':_0x129058[_0x7efc('0x40')],'type':_0x129058[_0x7efc('0x41')]['key']};});_0xc08d44[_0x7efc('0x42')]=_[_0x7efc('0x3e')](_0x214545,_0x7efc('0x3c'));_0xc08d44[_0x7efc('0x43')]=_[_0x7efc('0x44')](_0xec9ef[_0x7efc('0x43')]);_0xc08d44[_0x7efc('0x45')]=_['intersection'](_0xc08d44[_0x7efc('0x42')],_0xc08d44[_0x7efc('0x43')]);_0x4cf8bf[_0x7efc('0x46')]=_[_0x7efc('0x47')](_0xc08d44[_0x7efc('0x42')],qs[_0x7efc('0x48')](_0xec9ef[_0x7efc('0x43')]['fields']));_0x4cf8bf[_0x7efc('0x46')]=_0x4cf8bf[_0x7efc('0x46')]['length']?_0x4cf8bf['attributes']:_0xc08d44[_0x7efc('0x42')];if(!_0xec9ef[_0x7efc('0x43')]['hasOwnProperty'](_0x7efc('0x49'))){_0x4cf8bf[_0x7efc('0x32')]=qs[_0x7efc('0x32')](_0xec9ef['query'][_0x7efc('0x32')]);_0x4cf8bf[_0x7efc('0x30')]=qs[_0x7efc('0x30')](_0xec9ef['query'][_0x7efc('0x30')]);}_0x4cf8bf['order']=qs[_0x7efc('0x4a')](_0xec9ef['query'][_0x7efc('0x4a')]);_0x4cf8bf['where']=qs['filters'](_[_0x7efc('0x4b')](_0xec9ef[_0x7efc('0x43')],_0xc08d44[_0x7efc('0x45')]),_0x214545);if(_0xec9ef[_0x7efc('0x43')]['filter']){_0x4cf8bf['where']=_[_0x7efc('0x4c')](_0x4cf8bf[_0x7efc('0x4d')],{'$or':_[_0x7efc('0x3e')](_0x214545,function(_0x1b51d8){if(_0x1b51d8[_0x7efc('0x41')]!==_0x7efc('0x4e')){var _0x3ff806={};_0x3ff806[_0x1b51d8[_0x7efc('0x3c')]]={'$like':'%'+_0xec9ef['query']['filter']+'%'};return _0x3ff806;}})});}_0x4cf8bf=_[_0x7efc('0x4c')]({},_0x4cf8bf,_0xec9ef[_0x7efc('0x4f')]);var _0x1a8f74={'where':_0x4cf8bf['where']};return db[_0x7efc('0x50')]['count'](_0x1a8f74)[_0x7efc('0x22')](function(_0x26bae4){_0x43cdd6[_0x7efc('0x33')]=_0x26bae4;if(_0xec9ef['query'][_0x7efc('0x51')]){_0x4cf8bf[_0x7efc('0x52')]=[{'all':!![]}];}return db[_0x7efc('0x50')]['findAll'](_0x4cf8bf);})[_0x7efc('0x22')](function(_0x427205){_0x43cdd6[_0x7efc('0x53')]=_0x427205;return _0x43cdd6;})[_0x7efc('0x22')](respondWithFilteredResult(_0x4bd7f7,_0x4cf8bf))['catch'](handleError(_0x4bd7f7,null));};exports[_0x7efc('0x54')]=function(_0x930c8c,_0xb4de3c){var _0x4c111f={'raw':![],'where':{'id':_0x930c8c['params']['id']},'include':[{'model':db[_0x7efc('0x55')],'as':_0x7efc('0x56')}]},_0x2433cb={};_0x2433cb[_0x7efc('0x42')]=_[_0x7efc('0x44')](db[_0x7efc('0x50')][_0x7efc('0x3f')]);_0x2433cb[_0x7efc('0x43')]=_[_0x7efc('0x44')](_0x930c8c[_0x7efc('0x43')]);_0x2433cb[_0x7efc('0x45')]=_[_0x7efc('0x47')](_0x2433cb['model'],_0x2433cb['query']);_0x4c111f[_0x7efc('0x46')]=_['intersection'](_0x2433cb['model'],qs[_0x7efc('0x48')](_0x930c8c[_0x7efc('0x43')][_0x7efc('0x48')]));_0x4c111f[_0x7efc('0x46')]=_0x4c111f['attributes']['length']?_0x4c111f['attributes']:_0x2433cb['model'];if(_0x930c8c[_0x7efc('0x43')][_0x7efc('0x51')]){_0x4c111f['include']=[{'all':!![]}];}_0x4c111f=_[_0x7efc('0x4c')]({},_0x4c111f,_0x930c8c[_0x7efc('0x4f')]);return db[_0x7efc('0x50')]['find'](_0x4c111f)[_0x7efc('0x22')](handleEntityNotFound(_0xb4de3c,null))[_0x7efc('0x22')](respondWithResult(_0xb4de3c,null))[_0x7efc('0x57')](handleError(_0xb4de3c,null));};exports[_0x7efc('0x58')]=function(_0x50282c,_0x217866){return db[_0x7efc('0x50')][_0x7efc('0x58')](_0x50282c['body'],{})['then'](function(_0x5336f2){var _0x334b6b=_0x50282c['user'][_0x7efc('0x38')]({'plain':!![]});if(!_0x334b6b)throw new Error(_0x7efc('0x59'));if(_0x334b6b[_0x7efc('0x5a')]===_0x7efc('0x5b')){var _0x1e36c5=_0x5336f2[_0x7efc('0x38')]({'plain':!![]});var _0x5af2e6=_0x7efc('0x39');return db[_0x7efc('0x5c')][_0x7efc('0x5d')]({'where':{'name':_0x5af2e6,'userProfileId':_0x334b6b[_0x7efc('0x5e')]},'raw':!![]})[_0x7efc('0x22')](function(_0x57a596){if(_0x57a596&&_0x57a596['autoAssociation']===0x0){return db[_0x7efc('0x3a')][_0x7efc('0x58')]({'name':_0x1e36c5[_0x7efc('0x3c')],'resourceId':_0x1e36c5['id'],'type':_0x57a596[_0x7efc('0x3c')],'sectionId':_0x57a596['id']},{})['then'](function(){return _0x5336f2;});}else{return _0x5336f2;}})['catch'](function(_0x388fd2){logger[_0x7efc('0x27')](_0x7efc('0x5f'),_0x388fd2);throw _0x388fd2;});}return _0x5336f2;})[_0x7efc('0x22')](respondWithResult(_0x217866,0xc9))['catch'](handleError(_0x217866,null));};exports[_0x7efc('0x60')]=function(_0x4c3a44,_0x18f1b9){if(_0x4c3a44['body']['id']){delete _0x4c3a44[_0x7efc('0x61')]['id'];}return db['FaxAccount'][_0x7efc('0x5d')]({'where':{'id':_0x4c3a44[_0x7efc('0x62')]['id']},'include':[{'model':db[_0x7efc('0x55')],'as':_0x7efc('0x56')}]})['then'](handleEntityNotFound(_0x18f1b9,null))['then'](saveUpdates(_0x4c3a44[_0x7efc('0x61')],null))[_0x7efc('0x22')](respondWithResult(_0x18f1b9,null))['catch'](handleError(_0x18f1b9,null));};exports['destroy']=function(_0x3c823c,_0x59c7e8){return db[_0x7efc('0x50')]['find']({'where':{'id':_0x3c823c[_0x7efc('0x62')]['id']}})['then'](handleEntityNotFound(_0x59c7e8,null))[_0x7efc('0x22')](removeEntity(_0x59c7e8,null))[_0x7efc('0x57')](handleError(_0x59c7e8,null));};exports[_0x7efc('0x63')]=function(_0x344dba,_0x52e467){return db[_0x7efc('0x50')][_0x7efc('0x63')]()['then'](respondWithResult(_0x52e467,null))[_0x7efc('0x57')](handleError(_0x52e467,null));};exports[_0x7efc('0x64')]=function(_0x55206c,_0x4dfd15,_0x2c3869){if(_0x55206c[_0x7efc('0x61')]['id']){delete _0x55206c[_0x7efc('0x61')]['id'];}return db[_0x7efc('0x50')][_0x7efc('0x5d')]({'where':{'id':_0x55206c['params']['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x4dfd15,null))[_0x7efc('0x22')](function(_0x31df9c){if(_0x31df9c){_0x55206c[_0x7efc('0x61')][_0x7efc('0x65')]=_0x31df9c['id'];return db[_0x7efc('0x66')][_0x7efc('0x58')](_0x55206c[_0x7efc('0x61')]);}})['then'](respondWithResult(_0x4dfd15,null))[_0x7efc('0x57')](handleError(_0x4dfd15,null));};exports[_0x7efc('0x67')]=function(_0x2af97a,_0x23b81c,_0x481ea2){var _0x43e857={'raw':![],'where':{}};var _0x46c62b={};var _0x2faf64={'count':0x0,'rows':[]};return db[_0x7efc('0x50')][_0x7efc('0x68')]({'where':{'id':_0x2af97a[_0x7efc('0x62')]['id']}})['then'](handleEntityNotFound(_0x23b81c,null))[_0x7efc('0x22')](function(_0xa6f5b4){if(_0xa6f5b4){_0x46c62b[_0x7efc('0x42')]=_[_0x7efc('0x44')](db[_0x7efc('0x66')][_0x7efc('0x3f')]);_0x46c62b[_0x7efc('0x43')]=_[_0x7efc('0x44')](_0x2af97a['query']);_0x46c62b[_0x7efc('0x45')]=_['intersection'](_0x46c62b['model'],_0x46c62b['query']);_0x43e857['attributes']=_[_0x7efc('0x47')](_0x46c62b[_0x7efc('0x42')],qs['fields'](_0x2af97a[_0x7efc('0x43')][_0x7efc('0x48')]));_0x43e857['attributes']=_0x43e857[_0x7efc('0x46')]['length']?_0x43e857[_0x7efc('0x46')]:_0x46c62b[_0x7efc('0x42')];if(!_0x2af97a[_0x7efc('0x43')][_0x7efc('0x69')](_0x7efc('0x49'))){_0x43e857[_0x7efc('0x32')]=qs[_0x7efc('0x32')](_0x2af97a[_0x7efc('0x43')][_0x7efc('0x32')]);_0x43e857[_0x7efc('0x30')]=qs[_0x7efc('0x30')](_0x2af97a['query'][_0x7efc('0x30')]);}_0x43e857[_0x7efc('0x6a')]=qs[_0x7efc('0x4a')](_0x2af97a[_0x7efc('0x43')]['sort']);_0x43e857['where']=qs['filters'](_[_0x7efc('0x4b')](_0x2af97a[_0x7efc('0x43')],_0x46c62b[_0x7efc('0x45')]));_0x43e857[_0x7efc('0x4d')][_0x7efc('0x65')]=_0xa6f5b4['id'];if(_0x2af97a[_0x7efc('0x43')][_0x7efc('0x6b')]){_0x43e857['where']=_[_0x7efc('0x4c')](_0x43e857[_0x7efc('0x4d')],{'$or':_[_0x7efc('0x3e')](_0x43e857[_0x7efc('0x46')],function(_0x14f46b){var _0x19e52b={};_0x19e52b[_0x14f46b]={'$like':'%'+_0x2af97a[_0x7efc('0x43')]['filter']+'%'};return _0x19e52b;})});}_0x43e857=_['merge']({},_0x43e857,_0x2af97a['options']);return db[_0x7efc('0x66')][_0x7efc('0x33')]({'where':_0x43e857[_0x7efc('0x4d')]})[_0x7efc('0x22')](function(_0x2b9684){_0x2faf64['count']=_0x2b9684;if(_0x2af97a['query'][_0x7efc('0x51')]){_0x43e857[_0x7efc('0x52')]=[{'all':!![]}];}return db[_0x7efc('0x66')][_0x7efc('0x6c')](_0x43e857);})[_0x7efc('0x22')](function(_0x36b465){_0x2faf64[_0x7efc('0x53')]=_0x36b465;return _0x2faf64;});}})[_0x7efc('0x22')](respondWithFilteredResult(_0x23b81c,_0x43e857))['catch'](handleError(_0x23b81c,null));};exports['removeDispositions']=function(_0x2a8a09,_0x94db67,_0x2a67c4){return db[_0x7efc('0x50')][_0x7efc('0x5d')]({'where':{'id':_0x2a8a09[_0x7efc('0x62')]['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x94db67,null))['then'](function(_0x2ebc68){if(_0x2ebc68){return _0x2ebc68['removeDispositions'](_0x2a8a09['query'][_0x7efc('0x6d')]);}})[_0x7efc('0x22')](respondWithStatusCode(_0x94db67,null))[_0x7efc('0x57')](handleError(_0x94db67,null));};exports[_0x7efc('0x6e')]=function(_0x365a13,_0x58e8c5,_0x4f0025){if(_0x365a13[_0x7efc('0x61')]['id']){delete _0x365a13[_0x7efc('0x61')]['id'];}return db[_0x7efc('0x50')][_0x7efc('0x5d')]({'where':{'id':_0x365a13[_0x7efc('0x62')]['id']}})['then'](handleEntityNotFound(_0x58e8c5,null))[_0x7efc('0x22')](function(_0x1086d6){if(_0x1086d6){_0x365a13[_0x7efc('0x61')][_0x7efc('0x65')]=_0x1086d6['id'];return db[_0x7efc('0x6f')][_0x7efc('0x58')](_0x365a13[_0x7efc('0x61')]);}})[_0x7efc('0x22')](respondWithResult(_0x58e8c5,null))[_0x7efc('0x57')](handleError(_0x58e8c5,null));};exports[_0x7efc('0x70')]=function(_0xd54ade,_0x2a1129,_0x244184){var _0x28421a={'raw':![],'where':{}};var _0x18267b={};var _0x2c6f58={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7efc('0x68')]({'where':{'id':_0xd54ade['params']['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x2a1129,null))[_0x7efc('0x22')](function(_0x1cb9fe){if(_0x1cb9fe){_0x18267b['model']=_[_0x7efc('0x44')](db[_0x7efc('0x6f')][_0x7efc('0x3f')]);_0x18267b[_0x7efc('0x43')]=_[_0x7efc('0x44')](_0xd54ade[_0x7efc('0x43')]);_0x18267b[_0x7efc('0x45')]=_[_0x7efc('0x47')](_0x18267b[_0x7efc('0x42')],_0x18267b[_0x7efc('0x43')]);_0x28421a['attributes']=_[_0x7efc('0x47')](_0x18267b[_0x7efc('0x42')],qs['fields'](_0xd54ade[_0x7efc('0x43')][_0x7efc('0x48')]));_0x28421a[_0x7efc('0x46')]=_0x28421a[_0x7efc('0x46')][_0x7efc('0x71')]?_0x28421a['attributes']:_0x18267b[_0x7efc('0x42')];if(!_0xd54ade[_0x7efc('0x43')][_0x7efc('0x69')](_0x7efc('0x49'))){_0x28421a['limit']=qs[_0x7efc('0x32')](_0xd54ade[_0x7efc('0x43')]['limit']);_0x28421a[_0x7efc('0x30')]=qs['offset'](_0xd54ade[_0x7efc('0x43')][_0x7efc('0x30')]);}_0x28421a[_0x7efc('0x6a')]=qs[_0x7efc('0x4a')](_0xd54ade[_0x7efc('0x43')]['sort']);_0x28421a['where']=qs['filters'](_[_0x7efc('0x4b')](_0xd54ade[_0x7efc('0x43')],_0x18267b[_0x7efc('0x45')]));_0x28421a[_0x7efc('0x4d')][_0x7efc('0x65')]=_0x1cb9fe['id'];if(_0xd54ade[_0x7efc('0x43')][_0x7efc('0x6b')]){_0x28421a[_0x7efc('0x4d')]=_[_0x7efc('0x4c')](_0x28421a[_0x7efc('0x4d')],{'$or':_[_0x7efc('0x3e')](_0x28421a[_0x7efc('0x46')],function(_0xf7c5a4){var _0x338c96={};_0x338c96[_0xf7c5a4]={'$like':'%'+_0xd54ade[_0x7efc('0x43')][_0x7efc('0x6b')]+'%'};return _0x338c96;})});}_0x28421a=_[_0x7efc('0x4c')]({},_0x28421a,_0xd54ade[_0x7efc('0x4f')]);return db['CannedAnswer'][_0x7efc('0x33')]({'where':_0x28421a['where']})[_0x7efc('0x22')](function(_0x5e965d){_0x2c6f58['count']=_0x5e965d;if(_0xd54ade[_0x7efc('0x43')][_0x7efc('0x51')]){_0x28421a[_0x7efc('0x52')]=[{'all':!![]}];}return db[_0x7efc('0x6f')]['findAll'](_0x28421a);})[_0x7efc('0x22')](function(_0x129482){_0x2c6f58[_0x7efc('0x53')]=_0x129482;return _0x2c6f58;});}})[_0x7efc('0x22')](respondWithFilteredResult(_0x2a1129,_0x28421a))[_0x7efc('0x57')](handleError(_0x2a1129,null));};exports[_0x7efc('0x72')]=function(_0x2fe449,_0x5dfea9,_0xa93f2a){return db[_0x7efc('0x50')]['find']({'where':{'id':_0x2fe449['params']['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x5dfea9,null))[_0x7efc('0x22')](function(_0x1f320e){if(_0x1f320e){return _0x1f320e[_0x7efc('0x72')](_0x2fe449[_0x7efc('0x43')][_0x7efc('0x6d')]);}})[_0x7efc('0x22')](respondWithStatusCode(_0x5dfea9,null))['catch'](handleError(_0x5dfea9,null));};exports[_0x7efc('0x73')]=function(_0x192117,_0x138b47,_0x437cb2){return db['FaxInteraction']['find']({'where':{'id':_0x192117[_0x7efc('0x62')]['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x138b47,null))['then'](function(_0x864366){if(_0x864366){return _0x864366[_0x7efc('0x73')](_0x192117[_0x7efc('0x61')][_0x7efc('0x6d')],_[_0x7efc('0x74')](_0x192117['body'],['ids','id'])||{});}})[_0x7efc('0x22')](respondWithResult(_0x138b47,null))[_0x7efc('0x57')](handleError(_0x138b47,null));};exports[_0x7efc('0x75')]=function(_0x56cf2c,_0x709a63,_0x137eef){var _0x2808a0={'raw':![],'where':{}};var _0x678b50={};var _0x47f0ff={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7efc('0x68')]({'where':{'id':_0x56cf2c[_0x7efc('0x62')]['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x709a63,null))[_0x7efc('0x22')](function(_0x29f7dc){if(_0x29f7dc){_0x678b50[_0x7efc('0x42')]=_[_0x7efc('0x44')](db[_0x7efc('0x76')][_0x7efc('0x3f')]);_0x678b50[_0x7efc('0x43')]=_[_0x7efc('0x44')](_0x56cf2c[_0x7efc('0x43')]);_0x678b50['filters']=_['intersection'](_0x678b50[_0x7efc('0x42')],_0x678b50[_0x7efc('0x43')]);_0x2808a0[_0x7efc('0x46')]=_[_0x7efc('0x47')](_0x678b50['model'],qs[_0x7efc('0x48')](_0x56cf2c[_0x7efc('0x43')][_0x7efc('0x48')]));_0x2808a0['attributes']=_0x2808a0[_0x7efc('0x46')][_0x7efc('0x71')]?_0x2808a0[_0x7efc('0x46')]:_0x678b50[_0x7efc('0x42')];if(!_0x56cf2c[_0x7efc('0x43')][_0x7efc('0x69')]('nolimit')){_0x2808a0[_0x7efc('0x32')]=qs['limit'](_0x56cf2c[_0x7efc('0x43')][_0x7efc('0x32')]);_0x2808a0['offset']=qs['offset'](_0x56cf2c[_0x7efc('0x43')]['offset']);}_0x2808a0[_0x7efc('0x6a')]=qs['sort'](_0x56cf2c['query'][_0x7efc('0x4a')]);_0x2808a0[_0x7efc('0x4d')]=qs[_0x7efc('0x45')](_['pick'](_0x56cf2c[_0x7efc('0x43')],_0x678b50['filters']));_0x2808a0['where'][_0x7efc('0x65')]=_0x29f7dc['id'];if(_0x56cf2c['query'][_0x7efc('0x6b')]){_0x2808a0[_0x7efc('0x4d')]=_[_0x7efc('0x4c')](_0x2808a0[_0x7efc('0x4d')],{'$or':_[_0x7efc('0x3e')](_0x2808a0[_0x7efc('0x46')],function(_0x3f3d49){var _0x2cb172={};_0x2cb172[_0x3f3d49]={'$like':'%'+_0x56cf2c[_0x7efc('0x43')][_0x7efc('0x6b')]+'%'};return _0x2cb172;})});}_0x2808a0=_['merge']({},_0x2808a0,_0x56cf2c['options']);return db[_0x7efc('0x76')][_0x7efc('0x33')]({'where':_0x2808a0['where']})['then'](function(_0x410af4){_0x47f0ff[_0x7efc('0x33')]=_0x410af4;if(_0x56cf2c[_0x7efc('0x43')][_0x7efc('0x51')]){_0x2808a0[_0x7efc('0x52')]=[{'model':db[_0x7efc('0x77')],'as':_0x7efc('0x78'),'required':![]},{'model':db['User'],'as':_0x7efc('0x79'),'attributes':[_0x7efc('0x3c'),_0x7efc('0x7a'),_0x7efc('0x7b')],'required':![]},{'model':db['Tag'],'as':_0x7efc('0x7c'),'attributes':['id','name',_0x7efc('0x7d')],'where':_0x56cf2c[_0x7efc('0x43')][_0x7efc('0x7e')]?{'id':_0x56cf2c[_0x7efc('0x43')]['tag']}:undefined,'required':_0x56cf2c['query'][_0x7efc('0x7e')]?!![]:![]}];}return db[_0x7efc('0x76')][_0x7efc('0x6c')](_0x2808a0);})[_0x7efc('0x22')](function(_0x53f96c){_0x47f0ff[_0x7efc('0x53')]=_0x53f96c;return _0x47f0ff;});}})[_0x7efc('0x22')](respondWithFilteredResult(_0x709a63,_0x2808a0))[_0x7efc('0x57')](handleError(_0x709a63,null));};exports['addApplications']=function(_0x294a79,_0xa81ea3){var _0x4a99c0=_0x294a79[_0x7efc('0x62')]['id'];var _0x22a115=_0x294a79[_0x7efc('0x61')];var _0x4f3706=0xc8;var _0x114e50=null;return db['sequelize'][_0x7efc('0x7f')]({'isolationLevel':db[_0x7efc('0x80')][_0x7efc('0x81')][_0x7efc('0x82')][_0x7efc('0x83')]},function(_0x507df0){return db[_0x7efc('0x50')][_0x7efc('0x68')]({'where':{'id':_0x4a99c0},'transaction':_0x507df0})[_0x7efc('0x22')](function(_0x540b15){if(_0x540b15){return db[_0x7efc('0x84')][_0x7efc('0x37')]({'where':{'FaxAccountId':_0x4a99c0},'transaction':_0x507df0})[_0x7efc('0x22')](function(){var _0x24a36b=_[_0x7efc('0x3e')](_0x22a115,function(_0xeb4ca5){_0xeb4ca5[_0x7efc('0x65')]=_0x4a99c0;return _0xeb4ca5;});return db[_0x7efc('0x84')][_0x7efc('0x85')](_0x24a36b,{'transaction':_0x507df0});});}else{_0x4f3706=0x194;_0x114e50=[];}});})[_0x7efc('0x22')](function(){if(_0x4f3706!==0x194){return db[_0x7efc('0x84')]['findAndCountAll']({'where':{'FaxAccountId':_0x4a99c0},'order':_0x7efc('0x86')})['then'](function(_0x2372e3){_0x114e50=_0x2372e3;});}})[_0x7efc('0x57')](function(_0x272797){_0x4f3706=0x1f4;logger[_0x7efc('0x27')](_0x272797[_0x7efc('0x3b')]);if(_0x272797[_0x7efc('0x3c')]){delete _0x272797['name'];}_0x114e50=_0x272797;})['finally'](function(){if(_0x114e50===null){_0xa81ea3[_0x7efc('0x2c')](_0x4f3706);}else{if(_0x4f3706===0x1f4){_0xa81ea3['status'](_0x4f3706)[_0x7efc('0x87')](_0x114e50);}else{_0xa81ea3['status'](_0x4f3706)[_0x7efc('0x2f')](_0x114e50);}}});};exports['getApplications']=function(_0x1340d7,_0x1fd45e,_0x4d70ef){var _0x156db3={};var _0x2c88bb={};var _0x2d7d9d;var _0x3252f5;return db['FaxAccount']['findOne']({'where':{'id':_0x1340d7[_0x7efc('0x62')]['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x1fd45e,null))['then'](function(_0x62a9d6){if(_0x62a9d6){_0x2d7d9d=_0x62a9d6;_0x2c88bb[_0x7efc('0x42')]=_['keys'](db[_0x7efc('0x84')][_0x7efc('0x3f')]);_0x2c88bb[_0x7efc('0x43')]=_[_0x7efc('0x44')](_0x1340d7[_0x7efc('0x43')]);_0x2c88bb[_0x7efc('0x45')]=_[_0x7efc('0x47')](_0x2c88bb[_0x7efc('0x42')],_0x2c88bb['query']);_0x156db3[_0x7efc('0x46')]=_[_0x7efc('0x47')](_0x2c88bb[_0x7efc('0x42')],qs[_0x7efc('0x48')](_0x1340d7['query']['fields']));_0x156db3[_0x7efc('0x46')]=_0x156db3[_0x7efc('0x46')][_0x7efc('0x71')]?_0x156db3[_0x7efc('0x46')]:_0x2c88bb['model'];_0x156db3[_0x7efc('0x6a')]=qs[_0x7efc('0x4a')](_0x1340d7[_0x7efc('0x43')][_0x7efc('0x4a')]);_0x156db3[_0x7efc('0x4d')]=qs[_0x7efc('0x45')](_[_0x7efc('0x4b')](_0x1340d7[_0x7efc('0x43')],_0x2c88bb[_0x7efc('0x45')]));if(_0x1340d7[_0x7efc('0x43')][_0x7efc('0x6b')]){_0x156db3[_0x7efc('0x4d')]=_[_0x7efc('0x4c')](_0x156db3['where'],{'$or':_[_0x7efc('0x3e')](_0x156db3[_0x7efc('0x46')],function(_0x205ed9){var _0x29da19={};_0x29da19[_0x205ed9]={'$like':'%'+_0x1340d7[_0x7efc('0x43')][_0x7efc('0x6b')]+'%'};return _0x29da19;})});}_0x156db3=_['merge']({},_0x156db3,_0x1340d7[_0x7efc('0x4f')]);return _0x2d7d9d[_0x7efc('0x88')](_0x156db3);}})[_0x7efc('0x22')](function(_0x196590){if(_0x196590){_0x3252f5=_0x196590[_0x7efc('0x71')];if(!_0x1340d7[_0x7efc('0x43')][_0x7efc('0x69')](_0x7efc('0x49'))){_0x156db3['limit']=qs[_0x7efc('0x32')](_0x1340d7[_0x7efc('0x43')][_0x7efc('0x32')]);_0x156db3[_0x7efc('0x30')]=qs[_0x7efc('0x30')](_0x1340d7[_0x7efc('0x43')][_0x7efc('0x30')]);}return _0x2d7d9d[_0x7efc('0x88')](_0x156db3);}})['then'](function(_0x131016){if(_0x131016){return _0x131016?{'count':_0x3252f5,'rows':_0x131016}:null;}})[_0x7efc('0x22')](respondWithResult(_0x1fd45e,null))[_0x7efc('0x57')](handleError(_0x1fd45e,null));};function Extension(_0x2c8442,_0x30f2f3,_0x2677db,_0xa535e9){this[_0x7efc('0x89')]=_0x7efc('0x8a');this[_0x7efc('0x8b')]=_0x2c8442[_0x7efc('0x8c')];this['app']=_0xa535e9;this[_0x7efc('0x41')]=_0x7efc('0x8d');this[_0x7efc('0x8e')]=_0x7efc('0x8f');this[_0x7efc('0x65')]=_0x2c8442['id'];this[_0x7efc('0x86')]=_0x30f2f3;this[_0x7efc('0x90')]=_0x2677db;}function createExtensionsReciveFax(_0x497240){var _0x5d6dda=0x1;var _0x250c70=[];_0x250c70[_0x7efc('0x91')](new Extension(_0x497240,_0x5d6dda,'',_0x7efc('0x92')));_0x5d6dda+=0x1;_0x250c70['push'](new Extension(_0x497240,_0x5d6dda,'CDR(type)=inbound-fax',_0x7efc('0x93')));_0x5d6dda+=0x1;for(var _0x551b5c in _0x497240){if(_0x497240[_0x7efc('0x69')](_0x551b5c)&&(_0x551b5c==='ecm'||_0x551b5c===_0x7efc('0x8c')||_0x551b5c===_0x7efc('0x94')||_0x551b5c===_0x7efc('0x95')||_0x551b5c===_0x7efc('0x96')||_0x551b5c===_0x7efc('0x97')||_0x551b5c==='minrate'||_0x551b5c==='modem'||_0x551b5c===_0x7efc('0x98'))){_0x250c70['push'](new Extension(_0x497240,_0x5d6dda,'FAXOPT('+_0x551b5c+')='+_0x497240[_0x551b5c],_0x7efc('0x93')));_0x5d6dda+=0x1;}}_0x250c70[_0x7efc('0x91')](new Extension(_0x497240,_0x5d6dda,'6',_0x7efc('0x99')));_0x5d6dda+=0x1;_0x250c70[_0x7efc('0x91')](new Extension(_0x497240,_0x5d6dda,_0x7efc('0x9a'),_0x7efc('0x9b')));_0x5d6dda=0x0;return _0x250c70;}exports[_0x7efc('0x9c')]=function(_0xbbceda,_0x3dfd46,_0x6e8db8){var _0x238f09;return db[_0x7efc('0x80')]['transaction'](function(_0x2482b4){return db[_0x7efc('0x50')][_0x7efc('0x58')](_0xbbceda['body'],{'transaction':_0x2482b4})[_0x7efc('0x22')](function(_0x210926){_0x238f09=_0x210926[_0x7efc('0x38')]({'plain':!![]});return db[_0x7efc('0x9d')][_0x7efc('0x85')](createExtensionsReciveFax(_0x238f09),{'transaction':_0x2482b4});});})[_0x7efc('0x22')](function(){return _0x238f09;})[_0x7efc('0x22')](respondWithResult(_0x3dfd46,null))['catch'](handleError(_0x3dfd46,null));};exports[_0x7efc('0x9e')]=function(_0xc91534,_0x3d0588,_0x8816c2){var _0x24de99;return db['sequelize'][_0x7efc('0x7f')](function(_0x5e88ee){return db['FaxAccount']['update'](_0xc91534['body'],{'where':{'id':_0xc91534[_0x7efc('0x61')]['id']},'transaction':_0x5e88ee})[_0x7efc('0x22')](function(_0x485152){return db[_0x7efc('0x9d')][_0x7efc('0x37')]({'where':{'FaxAccountId':_0xc91534[_0x7efc('0x61')]['id']},'transaction':_0x5e88ee})['then'](function(_0x25b2dd){return db[_0x7efc('0x9d')][_0x7efc('0x85')](createExtensionsReciveFax(_[_0x7efc('0x74')](_0xc91534[_0x7efc('0x61')],[_0x7efc('0x9f'),_0x7efc('0xa0'),_0x7efc('0xa1'),_0x7efc('0xa2'),_0x7efc('0xa3'),_0x7efc('0xa4')])),{'transaction':_0x5e88ee});});});})[_0x7efc('0x22')](function(){return db[_0x7efc('0x50')][_0x7efc('0xa5')](_0xc91534['body']['id']);})['then'](respondWithResult(_0x3d0588,null))[_0x7efc('0x57')](handleError(_0x3d0588,null));};exports[_0x7efc('0xa6')]=function(_0x2a8290,_0x3a83a1,_0x52903b){var _0x13f53f={'raw':!![],'where':{}};var _0x5d2a65={};var _0x52bda0={'count':0x0,'rows':[]};return db[_0x7efc('0x50')][_0x7efc('0x68')]({'where':{'id':_0x2a8290[_0x7efc('0x62')]['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x3a83a1,null))[_0x7efc('0x22')](function(_0x15af28){if(_0x15af28){_0x5d2a65[_0x7efc('0x42')]=_['keys'](db[_0x7efc('0xa7')]['rawAttributes']);_0x5d2a65['query']=_[_0x7efc('0x44')](_0x2a8290[_0x7efc('0x43')]);_0x5d2a65[_0x7efc('0x45')]=_[_0x7efc('0x47')](_0x5d2a65[_0x7efc('0x42')],_0x5d2a65[_0x7efc('0x43')]);_0x13f53f[_0x7efc('0x46')]=_[_0x7efc('0x47')](_0x5d2a65[_0x7efc('0x42')],qs[_0x7efc('0x48')](_0x2a8290[_0x7efc('0x43')][_0x7efc('0x48')]));_0x13f53f[_0x7efc('0x46')]=_0x13f53f[_0x7efc('0x46')][_0x7efc('0x71')]?_0x13f53f['attributes']:_0x5d2a65[_0x7efc('0x42')];if(!_0x2a8290['query']['hasOwnProperty']('nolimit')){_0x13f53f[_0x7efc('0x32')]=qs[_0x7efc('0x32')](_0x2a8290[_0x7efc('0x43')][_0x7efc('0x32')]);_0x13f53f[_0x7efc('0x30')]=qs[_0x7efc('0x30')](_0x2a8290[_0x7efc('0x43')][_0x7efc('0x30')]);}_0x13f53f[_0x7efc('0x6a')]=qs['sort'](_0x2a8290[_0x7efc('0x43')][_0x7efc('0x4a')]);_0x13f53f[_0x7efc('0x4d')]=qs[_0x7efc('0x45')](_[_0x7efc('0x4b')](_0x2a8290[_0x7efc('0x43')],_0x5d2a65[_0x7efc('0x45')]));_0x13f53f[_0x7efc('0x4d')][_0x7efc('0x65')]=_0x15af28['id'];if(_0x2a8290[_0x7efc('0x43')][_0x7efc('0x6b')]){_0x13f53f[_0x7efc('0x4d')]=_[_0x7efc('0x4c')](_0x13f53f['where'],{'$or':_[_0x7efc('0x3e')](_0x13f53f[_0x7efc('0x46')],function(_0x33f990){var _0x220747={};_0x220747[_0x33f990]={'$like':'%'+_0x2a8290['query'][_0x7efc('0x6b')]+'%'};return _0x220747;})});}if(_0x2a8290[_0x7efc('0x43')][_0x7efc('0xa8')]){var _0x32f8a2=_0x2a8290[_0x7efc('0x43')]['$gte']['split'](',');var _0x591736={};_0x591736[_0x32f8a2[0x0]]={'$gte':moment(_0x32f8a2[0x1])['format'](_0x7efc('0xa9'))};_0x13f53f[_0x7efc('0x4d')]=_[_0x7efc('0x4c')](_0x13f53f[_0x7efc('0x4d')],_0x591736);}_0x13f53f=_[_0x7efc('0x4c')]({},_0x13f53f,_0x2a8290['options']);return db[_0x7efc('0xa7')]['count']({'where':_0x13f53f[_0x7efc('0x4d')]})[_0x7efc('0x22')](function(_0x3a8f59){_0x52bda0[_0x7efc('0x33')]=_0x3a8f59;if(_0x2a8290[_0x7efc('0x43')]['includeAll']){_0x13f53f[_0x7efc('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x13f53f);})['then'](function(_0x278ccb){_0x52bda0['rows']=_0x278ccb;return _0x52bda0;});}})[_0x7efc('0x22')](respondWithFilteredResult(_0x3a83a1,_0x13f53f))[_0x7efc('0x57')](handleError(_0x3a83a1,null));};exports['send']=function(_0x5bd2d8,_0x2875df,_0x4a7bb8){var _0x3a1498,_0x4db0d8={},_0xb73e3b;if(_0x5bd2d8[_0x7efc('0x61')]['to']){_0xb73e3b=_0x5bd2d8[_0x7efc('0x61')]['to'][0x0];}return db[_0x7efc('0x50')][_0x7efc('0x5d')]({'where':{'id':_0x5bd2d8[_0x7efc('0x62')]['id']},'include':[{'model':db[_0x7efc('0xaa')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0xb73e3b},'limit':0x1,'order':[[_0x7efc('0xa2'),_0x7efc('0xab')]]}]}]})[_0x7efc('0x22')](handleEntityNotFound(_0x2875df,null))[_0x7efc('0x22')](function(_0x1b60d2){_0x3a1498=_0x1b60d2;if(_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')]&&_0x5bd2d8['body']['attachments'][_0x7efc('0x71')]){for(var _0x2b0479=0x0;_0x2b0479<_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][_0x7efc('0x71')];_0x2b0479+=0x1){_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][_0x2b0479]={'filename':_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][_0x2b0479][_0x7efc('0x3c')],'id':_0x5bd2d8[_0x7efc('0x61')]['attachments'][_0x2b0479]['id'],'path':path['join'](config[_0x7efc('0xad')],_0x7efc('0xae'),_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][_0x2b0479][_0x7efc('0xaf')])};}}return respondWithRpcPromise(_0x7efc('0xb0'),_0x7efc('0xb0'),{'FaxAccountId':_[_0x7efc('0xb1')](_0x5bd2d8['params']['id'])?undefined:_0x5bd2d8['params']['id'],'path':_[_0x7efc('0xb1')](_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][0x0][_0x7efc('0x7')])?undefined:_0x5bd2d8[_0x7efc('0x61')]['attachments'][0x0][_0x7efc('0x7')],'fax':_[_0x7efc('0xb1')](_0x5bd2d8[_0x7efc('0x61')]['to'][0x0])?undefined:_0x5bd2d8[_0x7efc('0x61')]['to'][0x0]},client9002);})[_0x7efc('0x22')](function(){if(_0x3a1498){if(_['isNil'](_0x5bd2d8[_0x7efc('0x61')]['from'])){_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xb2')]=util[_0x7efc('0xb3')](_0x7efc('0xb4'),_0x3a1498[_0x7efc('0x3c')],_0x3a1498[_0x7efc('0xb5')]);}if(_0x3a1498['List']){if(_0x3a1498['List'][_0x7efc('0xb6')][_0x7efc('0x71')]){return _0x3a1498['List']['Contacts'][0x0];}else{return db['CmContact'][_0x7efc('0x58')](_[_0x7efc('0x1d')](_0x5bd2d8[_0x7efc('0x61')],{'firstName':_0x5bd2d8['body']['to'][0x0],'phone':_0x5bd2d8[_0x7efc('0x61')]['to'][0x0],'fax':_0x5bd2d8['body']['to'][0x0],'ListId':_0x3a1498[_0x7efc('0xa4')]}));}}else{throw new Error(_0x7efc('0xb7'));}}else{throw new Error(_0x7efc('0xb8'));}})['then'](function(_0x71f849){if(_0x71f849){return db[_0x7efc('0x76')][_0x7efc('0x5d')]({'where':{'ContactId':_0x71f849['id'],'closed':![],'FaxAccountId':_0x3a1498['id']}})[_0x7efc('0x22')](function(_0x33b46e){if(_0x33b46e){return[_0x33b46e,![]];}return db[_0x7efc('0x76')][_0x7efc('0x58')]({'UserId':_0x5bd2d8[_0x7efc('0x5b')]['id'],'ContactId':_0x71f849['id'],'FaxAccountId':_0x3a1498['id'],'fax':_0x5bd2d8[_0x7efc('0x61')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x7efc('0x4c')](_0x5bd2d8['body'],{'read':![],'body':_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][0x0]['filename'],'FaxAccountId':_0x3a1498['id'],'UserId':_0x5bd2d8[_0x7efc('0x5b')]['id'],'ContactId':_0x71f849['id'],'AttachmentId':_0x5bd2d8[_0x7efc('0x61')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x7efc('0x22')](function(_0x14b229){return[_0x14b229,!![]];});});}else{throw new Error(_0x7efc('0xb9'));}})[_0x7efc('0xba')](function(_0x2fc20a,_0x119747){if(_0x119747){return _0x2fc20a;}return db[_0x7efc('0xa7')][_0x7efc('0x58')]({'direction':_0x7efc('0xbb'),'read':![],'body':_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][0x0][_0x7efc('0xbc')],'FaxAccountId':_0x3a1498['id'],'FaxInteractionId':_0x2fc20a['id'],'UserId':_0x5bd2d8[_0x7efc('0x5b')]['id'],'ContactId':_0x2fc20a['ContactId'],'AttachmentId':_0x5bd2d8[_0x7efc('0x61')]['attachments'][0x0]['id']})[_0x7efc('0x22')](function(_0x29edae){_0x2fc20a[_0x7efc('0xbd')]['Messages']=[];_0x2fc20a[_0x7efc('0xbd')][_0x7efc('0xbe')][_0x7efc('0x91')](_0x29edae[_0x7efc('0xbd')]);return _0x2fc20a;});})[_0x7efc('0x22')](function(_0x1e5646){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x7efc('0xb1')](_0x5bd2d8['params']['id'])?undefined:_0x5bd2d8[_0x7efc('0x62')]['id'],'path':_[_0x7efc('0xb1')](_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][0x0][_0x7efc('0x7')])?undefined:_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][0x0]['path'],'fax':_[_0x7efc('0xb1')](_0x5bd2d8[_0x7efc('0x61')]['to'][0x0])?undefined:_0x5bd2d8[_0x7efc('0x61')]['to'][0x0],'AttachmentId':_0x5bd2d8[_0x7efc('0x61')][_0x7efc('0xac')][0x0]['id']},client9002)[_0x7efc('0x22')](function(_0x115cec){logger['info'](_0x7efc('0xbf'),_0x115cec);})[_0x7efc('0x57')](function(_0x12dd83){logger[_0x7efc('0x23')](_0x7efc('0xbf'),_0x12dd83);});return _0x1e5646;})[_0x7efc('0x22')](respondWithResult(_0x2875df,null))['catch'](handleError(_0x2875df,null));};exports[_0x7efc('0xc0')]=function(_0xe0a546,_0x3ff1e1,_0x53b2f1){return db[_0x7efc('0x50')][_0x7efc('0x5d')]({'where':{'id':_0xe0a546[_0x7efc('0x62')]['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x3ff1e1,null))[_0x7efc('0x22')](function(_0x85a83){if(_0x85a83){return _0x85a83['addAgents'](_0xe0a546[_0x7efc('0x61')]['ids'],_[_0x7efc('0x74')](_0xe0a546[_0x7efc('0x61')],['ids','id'])||{})[_0x7efc('0xba')](function(_0x41007f){for(var _0x57e11e=0x0;_0x57e11e<_0xe0a546['body'][_0x7efc('0x6d')][_0x7efc('0x71')];_0x57e11e+=0x1){socket['emit'](_0x7efc('0xc1'),{'UserId':Number(_0xe0a546[_0x7efc('0x61')][_0x7efc('0x6d')][_0x57e11e]),'FaxAccountId':Number(_0xe0a546[_0x7efc('0x62')]['id'])});}return _0x41007f;});}})[_0x7efc('0x22')](respondWithResult(_0x3ff1e1,null))['catch'](handleError(_0x3ff1e1,null));};exports['removeAgents']=function(_0x471104,_0x1cf9e8,_0x31e958){return db[_0x7efc('0x50')][_0x7efc('0x5d')]({'where':{'id':_0x471104[_0x7efc('0x62')]['id']}})[_0x7efc('0x22')](handleEntityNotFound(_0x1cf9e8,null))[_0x7efc('0x22')](function(_0x2745a9){if(_0x2745a9){return _0x2745a9['removeAgents'](_0x471104[_0x7efc('0x43')][_0x7efc('0x6d')])['then'](function(){if(_[_0x7efc('0xc2')](_0x471104[_0x7efc('0x43')][_0x7efc('0x6d')])){for(var _0x3b91fc=0x0;_0x3b91fc<_0x471104['query'][_0x7efc('0x6d')]['length'];_0x3b91fc+=0x1){socket[_0x7efc('0xc3')](_0x7efc('0xc4'),{'UserId':Number(_0x471104[_0x7efc('0x43')]['ids'][_0x3b91fc]),'FaxAccountId':Number(_0x471104['params']['id'])});}}else{socket[_0x7efc('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x471104[_0x7efc('0x43')][_0x7efc('0x6d')]),'FaxAccountId':Number(_0x471104[_0x7efc('0x62')]['id'])});}});}})[_0x7efc('0x22')](respondWithStatusCode(_0x1cf9e8,null))[_0x7efc('0x57')](handleError(_0x1cf9e8,null));};exports['getAgents']=function(_0x30b59c,_0x14c7d4,_0x12b400){var _0x206e37={};var _0x114982={};var _0x31c099;var _0x57aafc;return db[_0x7efc('0x50')][_0x7efc('0x68')]({'where':{'id':_0x30b59c[_0x7efc('0x62')]['id']}})['then'](handleEntityNotFound(_0x14c7d4,null))['then'](function(_0x380161){if(_0x380161){_0x31c099=_0x380161;_0x114982[_0x7efc('0x42')]=_['keys'](db[_0x7efc('0xc5')][_0x7efc('0x3f')]);_0x114982['query']=_[_0x7efc('0x44')](_0x30b59c['query']);_0x114982[_0x7efc('0x45')]=_[_0x7efc('0x47')](_0x114982[_0x7efc('0x42')],_0x114982[_0x7efc('0x43')]);_0x206e37[_0x7efc('0x46')]=_[_0x7efc('0x47')](_0x114982[_0x7efc('0x42')],qs[_0x7efc('0x48')](_0x30b59c[_0x7efc('0x43')][_0x7efc('0x48')]));_0x206e37[_0x7efc('0x46')]=_0x206e37[_0x7efc('0x46')][_0x7efc('0x71')]?_0x206e37['attributes']:_0x114982[_0x7efc('0x42')];_0x206e37['order']=qs[_0x7efc('0x4a')](_0x30b59c[_0x7efc('0x43')][_0x7efc('0x4a')]);_0x206e37[_0x7efc('0x4d')]=qs[_0x7efc('0x45')](_[_0x7efc('0x4b')](_0x30b59c[_0x7efc('0x43')],_0x114982['filters']));if(_0x30b59c[_0x7efc('0x43')][_0x7efc('0x6b')]){_0x206e37[_0x7efc('0x4d')]=_['merge'](_0x206e37[_0x7efc('0x4d')],{'$or':_[_0x7efc('0x3e')](_0x206e37[_0x7efc('0x46')],function(_0x19ed71){var _0x2e6eb8={};_0x2e6eb8[_0x19ed71]={'$like':'%'+_0x30b59c['query'][_0x7efc('0x6b')]+'%'};return _0x2e6eb8;})});}_0x206e37=_[_0x7efc('0x4c')]({},_0x206e37,_0x30b59c[_0x7efc('0x4f')]);return _0x31c099['getAgents'](_0x206e37);}})['then'](function(_0x297c35){if(_0x297c35){_0x57aafc=_0x297c35[_0x7efc('0x71')];if(!_0x30b59c[_0x7efc('0x43')][_0x7efc('0x69')](_0x7efc('0x49'))){_0x206e37[_0x7efc('0x32')]=qs['limit'](_0x30b59c[_0x7efc('0x43')][_0x7efc('0x32')]);_0x206e37[_0x7efc('0x30')]=qs[_0x7efc('0x30')](_0x30b59c['query'][_0x7efc('0x30')]);}return _0x31c099[_0x7efc('0xc6')](_0x206e37);}})['then'](function(_0x158e10){if(_0x158e10){return _0x158e10?{'count':_0x57aafc,'rows':_0x158e10}:null;}})[_0x7efc('0x22')](respondWithResult(_0x14c7d4,null))[_0x7efc('0x57')](handleError(_0x14c7d4,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 33a4aa9..f31149f 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 _0x1c29=['save','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5116f5,_0x5b95d2){var _0x36da70=function(_0x1b6df8){while(--_0x1b6df8){_0x5116f5['push'](_0x5116f5['shift']());}};_0x36da70(++_0x5b95d2);}(_0x1c29,0xed));var _0x91c2=function(_0x4a880a,_0xf1af2f){_0x4a880a=_0x4a880a-0x0;var _0x335197=_0x1c29[_0x4a880a];return _0x335197;};'use strict';var EventEmitter=require(_0x91c2('0x0'));var FaxAccount=require(_0x91c2('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x91c2('0x2')](0x0);var events={'afterCreate':_0x91c2('0x3'),'afterUpdate':'update','afterDestroy':_0x91c2('0x4')};function emitEvent(_0x40b9ef){return function(_0x15e649,_0xf1d6a8,_0x4e0e53){FaxAccountEvents[_0x91c2('0x5')](_0x40b9ef+':'+_0x15e649['id'],_0x15e649);FaxAccountEvents[_0x91c2('0x5')](_0x40b9ef,_0x15e649);_0x4e0e53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x91c2('0x6')](e,emitEvent(event));}}module[_0x91c2('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xf110=['events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1d6c09,_0x2e7771){var _0x3f49a7=function(_0x4e6634){while(--_0x4e6634){_0x1d6c09['push'](_0x1d6c09['shift']());}};_0x3f49a7(++_0x2e7771);}(_0xf110,0x134));var _0x0f11=function(_0x218681,_0x16971b){_0x218681=_0x218681-0x0;var _0x56c5de=_0xf110[_0x218681];return _0x56c5de;};'use strict';var EventEmitter=require(_0x0f11('0x0'));var FaxAccount=require(_0x0f11('0x1'))['db'][_0x0f11('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0f11('0x3')](0x0);var events={'afterCreate':_0x0f11('0x4'),'afterUpdate':_0x0f11('0x5'),'afterDestroy':_0x0f11('0x6')};function emitEvent(_0x1b1698){return function(_0x17090c,_0x2d99fc,_0x737dca){FaxAccountEvents[_0x0f11('0x7')](_0x1b1698+':'+_0x17090c['id'],_0x17090c);FaxAccountEvents[_0x0f11('0x7')](_0x1b1698,_0x17090c);_0x737dca(null);};}for(var e in events){if(events[_0x0f11('0x8')](e)){var event=events[e];FaxAccount[_0x0f11('0x9')](e,emitEvent(event));}}module[_0x0f11('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 88f2d51..d1d0741 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 _0xb30f=['exports','define','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1faf84,_0x27fe90){var _0x1cd0ba=function(_0x2d09ca){while(--_0x2d09ca){_0x1faf84['push'](_0x1faf84['shift']());}};_0x1cd0ba(++_0x27fe90);}(_0xb30f,0xdb));var _0xfb30=function(_0x24fd5a,_0x34f72e){_0x24fd5a=_0x24fd5a-0x0;var _0x56c099=_0xb30f[_0x24fd5a];return _0x56c099;};'use strict';var _=require(_0xfb30('0x0'));var util=require(_0xfb30('0x1'));var logger=require(_0xfb30('0x2'))('api');var moment=require(_0xfb30('0x3'));var BPromise=require(_0xfb30('0x4'));var rp=require(_0xfb30('0x5'));var fs=require('fs');var path=require(_0xfb30('0x6'));var rimraf=require(_0xfb30('0x7'));var config=require(_0xfb30('0x8'));var attributes=require('./faxAccount.attributes');module[_0xfb30('0x9')]=function(_0x491d3d,_0x3c415a){return _0x491d3d[_0xfb30('0xa')]('FaxAccount',attributes,{'tableName':_0xfb30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc110=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','FaxAccount','fax_accounts','util','../../config/logger'];(function(_0xae307e,_0x191360){var _0x5971f5=function(_0x4eaaf7){while(--_0x4eaaf7){_0xae307e['push'](_0xae307e['shift']());}};_0x5971f5(++_0x191360);}(_0xc110,0x1e2));var _0x0c11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc110[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0c11('0x0'));var logger=require(_0x0c11('0x1'))(_0x0c11('0x2'));var moment=require(_0x0c11('0x3'));var BPromise=require(_0x0c11('0x4'));var rp=require(_0x0c11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c11('0x6'));var config=require(_0x0c11('0x7'));var attributes=require(_0x0c11('0x8'));module['exports']=function(_0x5428ed,_0x4f45a5){return _0x5428ed['define'](_0x0c11('0x9'),attributes,{'tableName':_0x0c11('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 55f0941..c7b0f6e 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 _0x4cce=['isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','create','find','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','then','debug','catch','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','body'];(function(_0x44a612,_0x37c2ec){var _0xbda14e=function(_0x221966){while(--_0x221966){_0x44a612['push'](_0x44a612['shift']());}};_0xbda14e(++_0x37c2ec);}(_0x4cce,0x7f));var _0xe4cc=function(_0x50e025,_0x52a390){_0x50e025=_0x50e025-0x0;var _0x4a0e50=_0x4cce[_0x50e025];return _0x4a0e50;};'use strict';var _=require(_0xe4cc('0x0'));var util=require(_0xe4cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4cc('0x2'));var db=require(_0xe4cc('0x3'))['db'];var utils=require(_0xe4cc('0x4'));var logger=require(_0xe4cc('0x5'))(_0xe4cc('0x6'));var config=require(_0xe4cc('0x7'));var jayson=require(_0xe4cc('0x8'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0xe4cc('0x9')](config[_0xe4cc('0xa')],{'host':_0xe4cc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4cc('0xa')]));require(_0xe4cc('0xc'))[_0xe4cc('0xd')](socket);function respondWithRpcPromise(_0x1ab16b,_0x5f3b73,_0x54c0da){return new BPromise(function(_0x4282fa,_0x190ceb){return client[_0xe4cc('0xe')](_0x1ab16b,_0x54c0da)['then'](function(_0x175bd1){logger[_0xe4cc('0xf')](_0xe4cc('0x10'),_0x5f3b73,_0xe4cc('0x11'));logger['debug'](_0xe4cc('0x12'),_0x5f3b73,'request\x20sent',JSON[_0xe4cc('0x13')](_0x175bd1));if(_0x175bd1[_0xe4cc('0x14')]){if(_0x175bd1[_0xe4cc('0x14')][_0xe4cc('0x15')]===0x1f4){logger[_0xe4cc('0x14')](_0xe4cc('0x10'),_0x5f3b73,_0x175bd1[_0xe4cc('0x14')]['message']);return _0x190ceb(_0x175bd1[_0xe4cc('0x14')][_0xe4cc('0x16')]);}logger[_0xe4cc('0x14')](_0xe4cc('0x10'),_0x5f3b73,_0x175bd1[_0xe4cc('0x14')]['message']);return _0x4282fa(_0x175bd1[_0xe4cc('0x14')][_0xe4cc('0x16')]);}else{logger[_0xe4cc('0xf')](_0xe4cc('0x10'),_0x5f3b73,_0xe4cc('0x11'));_0x4282fa(_0x175bd1[_0xe4cc('0x17')][_0xe4cc('0x16')]);}})['catch'](function(_0x1022a0){logger['error'](_0xe4cc('0x10'),_0x5f3b73,_0x1022a0);_0x190ceb(_0x1022a0);});});}exports[_0xe4cc('0x18')]=function(_0x1975fd){var _0x23fe9d=this;return new Promise(function(_0x4e0b78,_0x43439e){return db[_0xe4cc('0x19')][_0xe4cc('0x1a')]({'raw':_0x1975fd[_0xe4cc('0x1b')]?_0x1975fd[_0xe4cc('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1975fd['options']?_0x1975fd[_0xe4cc('0x1b')][_0xe4cc('0x1c')]||null:null,'attributes':_0x1975fd['options']?_0x1975fd['options'][_0xe4cc('0x1d')]||null:null,'limit':_0x1975fd[_0xe4cc('0x1b')]?_0x1975fd['options'][_0xe4cc('0x1e')]||null:null,'include':_0x1975fd['options']?_0x1975fd[_0xe4cc('0x1b')][_0xe4cc('0x1f')]?_[_0xe4cc('0x20')](_0x1975fd[_0xe4cc('0x1b')][_0xe4cc('0x1f')],function(_0x5e40a9){return{'model':db[_0x5e40a9[_0xe4cc('0x21')]],'as':_0x5e40a9['as'],'attributes':_0x5e40a9[_0xe4cc('0x1d')],'include':_0x5e40a9[_0xe4cc('0x1f')]?_['map'](_0x5e40a9[_0xe4cc('0x1f')],function(_0x5c853c){return{'model':db[_0x5c853c[_0xe4cc('0x21')]],'as':_0x5c853c['as'],'attributes':_0x5c853c[_0xe4cc('0x1d')],'include':_0x5c853c[_0xe4cc('0x1f')]?_[_0xe4cc('0x20')](_0x5c853c['include'],function(_0xb194f){return{'model':db[_0xb194f[_0xe4cc('0x21')]],'as':_0xb194f['as'],'attributes':_0xb194f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4cc('0x22')](function(_0x44c4fa){logger[_0xe4cc('0xf')](_0xe4cc('0x18'),_0x1975fd);logger[_0xe4cc('0x23')](_0xe4cc('0x18'),_0x1975fd,JSON['stringify'](_0x44c4fa));_0x4e0b78(_0x44c4fa);})[_0xe4cc('0x24')](function(_0x45cb91){logger[_0xe4cc('0x14')]('GetFaxAccount',_0x45cb91['message'],_0x1975fd);_0x43439e(_0x23fe9d[_0xe4cc('0x14')](0x1f4,_0x45cb91[_0xe4cc('0x16')]));});});};exports[_0xe4cc('0x25')]=function(_0x5569c3,_0x16fc09,_0x27ceb3){var _0x2f7190=this;return new Promise(function(_0x355361,_0x20fefd){var _0x20f19d={'body':_0x5569c3['body'],'channel':_0xe4cc('0x26')};var _0x55b336=[];var _0x182c02=[];var _0xe0faa={};return db[_0xe4cc('0x27')][_0xe4cc('0x28')]()[_0xe4cc('0x22')](function(_0x4782ed){if(!_0x4782ed){throw new db[(_0xe4cc('0x29'))][(_0xe4cc('0x2a'))]('no\x20available\x20attributes');}_0x55b336=_[_0xe4cc('0x2b')](_[_0xe4cc('0x2c')](_0x4782ed),[_0xe4cc('0x2d'),'updatedAt']);_0x182c02=_[_0xe4cc('0x2b')](_[_0xe4cc('0x2c')](_0x4782ed),['createdAt',_0xe4cc('0x2e'),'CompanyId',_0xe4cc('0x2f')]);if(_0x5569c3[_0xe4cc('0x30')]['id']){delete _0x5569c3['body']['id'];}if(_[_0xe4cc('0x31')](_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x32')])){throw new db[(_0xe4cc('0x29'))][(_0xe4cc('0x2a'))](_0xe4cc('0x33'));}if(_['isNil'](_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x30')])||_0x5569c3['body']['body']===''){throw new db[(_0xe4cc('0x29'))][(_0xe4cc('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe4cc('0x31')](_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x34')])){throw new db[(_0xe4cc('0x29'))][(_0xe4cc('0x2a'))](_0xe4cc('0x35')+_0x182c02);}if(!_[_0xe4cc('0x36')](_0x182c02,_0x5569c3[_0xe4cc('0x30')]['mapKey'])){throw new db[(_0xe4cc('0x29'))][(_0xe4cc('0x2a'))](_0xe4cc('0x37')+_0x182c02);}_0xe0faa[_0x5569c3['body'][_0xe4cc('0x34')]]=_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x32')];})[_0xe4cc('0x22')](function(){return db['FaxAccount']['find']({'where':{'id':_0x5569c3[_0xe4cc('0x38')]['id']},'include':[{'model':db[_0xe4cc('0x39')],'as':_0xe4cc('0x3a'),'include':[{'model':db['CmContact'],'as':_0xe4cc('0x3b'),'where':_0xe0faa,'limit':0x1,'order':[[_0xe4cc('0x2e'),_0xe4cc('0x3c')]]}]},{'model':db[_0xe4cc('0x3d')],'as':_0xe4cc('0x3e')}]});})[_0xe4cc('0x22')](function(_0x3a66d6){if(_0x3a66d6&&_0x3a66d6[_0xe4cc('0x3a')]){var _0x77680e=_0x3a66d6[_0xe4cc('0x3f')]({'plain':!![]});_0x20f19d[_0xe4cc('0x38')]=_0x77680e;_0x20f19d[_0xe4cc('0x40')]=_0x77680e['Applications'];_0x20f19d[_0xe4cc('0x41')]=_0x77680e[_0xe4cc('0x3a')];_0x20f19d['applications']=_[_0xe4cc('0x42')](_0x20f19d[_0xe4cc('0x40')],[_0xe4cc('0x43')],['asc']);if(_0x20f19d[_0xe4cc('0x38')]['Applications']){delete _0x20f19d[_0xe4cc('0x38')][_0xe4cc('0x3e')];}if(_0x20f19d['account']['List']&&_0x20f19d['account'][_0xe4cc('0x3a')][_0xe4cc('0x3b')][_0xe4cc('0x44')]){return _0x20f19d[_0xe4cc('0x38')][_0xe4cc('0x3a')][_0xe4cc('0x3b')][0x0];}var _0x553737=_['defaults'](_0x5569c3[_0xe4cc('0x30')],{'firstName':_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x32')],'ListId':_0x77680e['ListId']});_0x553737[_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x34')]]=_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x32')];return db[_0xe4cc('0x27')][_0xe4cc('0x45')](_0x553737,{'fields':_0x55b336,'raw':!![]});}})[_0xe4cc('0x22')](function(_0x3d2e45){_0x20f19d['contact']=_0x3d2e45;if(_0x3d2e45){var _0x353eba={'ContactId':_0x3d2e45['id'],'FaxAccountId':_0x5569c3['account']['id'],'fax':_0x3d2e45['fax']};return db['FaxInteraction'][_0xe4cc('0x46')]({'where':{'ContactId':_0x3d2e45['id'],'closed':![],'FaxAccountId':_0x5569c3['account']['id']}})['then'](function(_0x3aa724){if(_0x3aa724){return[_0x3aa724,![]];}return db['FaxInteraction'][_0xe4cc('0x45')](_0x353eba)[_0xe4cc('0x22')](function(_0x29dd96){return[_0x29dd96,!![]];});});}else{throw new Error(_0xe4cc('0x47'));}})[_0xe4cc('0x48')](function(_0x15f2e7,_0x57898f){var _0x56d0f4=_0x15f2e7[_0xe4cc('0x3f')]({'plain':!![]});if(_0x57898f){if(_0x20f19d[_0xe4cc('0x38')][_0xe4cc('0x49')]){_0x20f19d[_0xe4cc('0x40')][_0xe4cc('0x4a')]({'id':0x0,'priority':_0x20f19d[_0xe4cc('0x40')][_0xe4cc('0x44')]+0x1,'app':'close','appdata':_0xe4cc('0x4b'),'interval':_0xe4cc('0x4c')});}_0x56d0f4[_0xe4cc('0x4d')]=!![];}else{_0x56d0f4[_0xe4cc('0x4d')]=![];}_0x20f19d[_0xe4cc('0x4e')]=_0x56d0f4;return db[_0xe4cc('0x4f')]['create']({'body':_0x5569c3[_0xe4cc('0x30')][_0xe4cc('0x30')],'FaxAccountId':_0x5569c3[_0xe4cc('0x38')]['id'],'FaxInteractionId':_0x15f2e7['id'],'direction':'in','ContactId':_0x15f2e7[_0xe4cc('0x50')],'AttachmentId':_0x5569c3[_0xe4cc('0x30')]['AttachmentId']});})[_0xe4cc('0x22')](function(_0x371e97){_0x20f19d[_0xe4cc('0x16')]=_0x371e97;if(_0x20f19d[_0xe4cc('0x4e')][_0xe4cc('0x51')]){return db[_0xe4cc('0x52')][_0xe4cc('0x46')]({'attributes':['id','name'],'where':{'id':_0x20f19d[_0xe4cc('0x4e')][_0xe4cc('0x51')]}})['then'](function(_0x28f8f9){if(_0x28f8f9){_0x20f19d[_0xe4cc('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe4cc('0x53'),'appdata':_0x28f8f9[_0xe4cc('0x54')]+','+(_0x20f19d[_0xe4cc('0x38')][_0xe4cc('0x55')]||0xa),'interval':_0xe4cc('0x4c')});}return respondWithRpcPromise(_0xe4cc('0x56'),_0xe4cc('0x57'),_0x20f19d);});}return respondWithRpcPromise(_0xe4cc('0x56'),'startRouting',_0x20f19d);})['then'](function(_0x1c8200){_0x355361(_0x1c8200);})[_0xe4cc('0x24')](function(_0x340c08){_0x20fefd(_0x2f7190[_0xe4cc('0x14')](0x1f4,_0x340c08['message']));});});}; \ No newline at end of file +var _0xbeb2=['./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','model','map','then','info','debug','NotifyFaxAccount','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','body','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','CmContact','updatedAt','DESC','FaxApplication','Applications','get','applications','list','List','priority','asc','Contacts','length','create','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','Start','startRouting','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis'];(function(_0x4f6f12,_0x2832dc){var _0x685309=function(_0x48c6de){while(--_0x48c6de){_0x4f6f12['push'](_0x4f6f12['shift']());}};_0x685309(++_0x2832dc);}(_0xbeb2,0x1f2));var _0x2beb=function(_0x1f3f55,_0x57a149){_0x1f3f55=_0x1f3f55-0x0;var _0x26be6e=_0xbeb2[_0x1f3f55];return _0x26be6e;};'use strict';var _=require('lodash');var util=require(_0x2beb('0x0'));var moment=require('moment');var BPromise=require(_0x2beb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2beb('0x2'));var db=require(_0x2beb('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2beb('0x4'));var jayson=require(_0x2beb('0x5'));var client=jayson[_0x2beb('0x6')][_0x2beb('0x7')]({'port':0x232c});config['redis']=_[_0x2beb('0x8')](config['redis'],{'host':_0x2beb('0x9'),'port':0x18eb});var socket=require(_0x2beb('0xa'))(new Redis(config[_0x2beb('0xb')]));require(_0x2beb('0xc'))[_0x2beb('0xd')](socket);function respondWithRpcPromise(_0xbadd3d,_0x555f6b,_0x528487){return new BPromise(function(_0x3bd318,_0x402b87){return client[_0x2beb('0xe')](_0xbadd3d,_0x528487)['then'](function(_0x2ee6c4){logger['info'](_0x2beb('0xf'),_0x555f6b,_0x2beb('0x10'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x555f6b,_0x2beb('0x10'),JSON[_0x2beb('0x11')](_0x2ee6c4));if(_0x2ee6c4[_0x2beb('0x12')]){if(_0x2ee6c4[_0x2beb('0x12')][_0x2beb('0x13')]===0x1f4){logger['error'](_0x2beb('0xf'),_0x555f6b,_0x2ee6c4[_0x2beb('0x12')][_0x2beb('0x14')]);return _0x402b87(_0x2ee6c4[_0x2beb('0x12')][_0x2beb('0x14')]);}logger[_0x2beb('0x12')](_0x2beb('0xf'),_0x555f6b,_0x2ee6c4[_0x2beb('0x12')][_0x2beb('0x14')]);return _0x3bd318(_0x2ee6c4[_0x2beb('0x12')]['message']);}else{logger['info'](_0x2beb('0xf'),_0x555f6b,_0x2beb('0x10'));_0x3bd318(_0x2ee6c4['result']['message']);}})[_0x2beb('0x15')](function(_0xb523c2){logger[_0x2beb('0x12')]('FaxAccount,\x20%s,\x20%s',_0x555f6b,_0xb523c2);_0x402b87(_0xb523c2);});});}exports[_0x2beb('0x16')]=function(_0x257fef){var _0x543b8b=this;return new Promise(function(_0x1c7138,_0x9da734){return db[_0x2beb('0x17')]['findAll']({'raw':_0x257fef[_0x2beb('0x18')]?_0x257fef[_0x2beb('0x18')][_0x2beb('0x19')]===undefined?!![]:![]:!![],'where':_0x257fef[_0x2beb('0x18')]?_0x257fef['options'][_0x2beb('0x1a')]||null:null,'attributes':_0x257fef[_0x2beb('0x18')]?_0x257fef[_0x2beb('0x18')][_0x2beb('0x1b')]||null:null,'limit':_0x257fef[_0x2beb('0x18')]?_0x257fef['options'][_0x2beb('0x1c')]||null:null,'include':_0x257fef[_0x2beb('0x18')]?_0x257fef['options'][_0x2beb('0x1d')]?_['map'](_0x257fef[_0x2beb('0x18')][_0x2beb('0x1d')],function(_0x2efa80){return{'model':db[_0x2efa80[_0x2beb('0x1e')]],'as':_0x2efa80['as'],'attributes':_0x2efa80[_0x2beb('0x1b')],'include':_0x2efa80[_0x2beb('0x1d')]?_['map'](_0x2efa80['include'],function(_0x57a9b8){return{'model':db[_0x57a9b8[_0x2beb('0x1e')]],'as':_0x57a9b8['as'],'attributes':_0x57a9b8[_0x2beb('0x1b')],'include':_0x57a9b8['include']?_[_0x2beb('0x1f')](_0x57a9b8[_0x2beb('0x1d')],function(_0x1eccc9){return{'model':db[_0x1eccc9[_0x2beb('0x1e')]],'as':_0x1eccc9['as'],'attributes':_0x1eccc9[_0x2beb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2beb('0x20')](function(_0x263298){logger[_0x2beb('0x21')]('GetFaxAccount',_0x257fef);logger[_0x2beb('0x22')](_0x2beb('0x16'),_0x257fef,JSON[_0x2beb('0x11')](_0x263298));_0x1c7138(_0x263298);})[_0x2beb('0x15')](function(_0x1226ba){logger[_0x2beb('0x12')](_0x2beb('0x16'),_0x1226ba[_0x2beb('0x14')],_0x257fef);_0x9da734(_0x543b8b['error'](0x1f4,_0x1226ba[_0x2beb('0x14')]));});});};exports[_0x2beb('0x23')]=function(_0x4727f6,_0x4157aa,_0x32ce48){var _0x49147e=this;return new Promise(function(_0x606581,_0x2f82ce){var _0x4135cf={'body':_0x4727f6['body'],'channel':_0x2beb('0x24')};var _0x829f38=[];var _0x35acf3=[];var _0xf6cb90={};return db['CmContact']['describe']()[_0x2beb('0x20')](function(_0x519eb8){if(!_0x519eb8){throw new db[(_0x2beb('0x25'))][(_0x2beb('0x26'))](_0x2beb('0x27'));}_0x829f38=_[_0x2beb('0x28')](_['keys'](_0x519eb8),['createdAt','updatedAt']);_0x35acf3=_['difference'](_['keys'](_0x519eb8),[_0x2beb('0x29'),'updatedAt',_0x2beb('0x2a'),_0x2beb('0x2b')]);if(_0x4727f6[_0x2beb('0x2c')]['id']){delete _0x4727f6[_0x2beb('0x2c')]['id'];}if(_[_0x2beb('0x2d')](_0x4727f6[_0x2beb('0x2c')]['from'])){throw new db[(_0x2beb('0x25'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x2beb('0x2d')](_0x4727f6['body']['body'])||_0x4727f6['body'][_0x2beb('0x2c')]===''){throw new db[(_0x2beb('0x25'))][(_0x2beb('0x26'))](_0x2beb('0x2e'));}if(_[_0x2beb('0x2d')](_0x4727f6[_0x2beb('0x2c')][_0x2beb('0x2f')])){throw new db[(_0x2beb('0x25'))][(_0x2beb('0x26'))](_0x2beb('0x30')+_0x35acf3);}if(!_[_0x2beb('0x31')](_0x35acf3,_0x4727f6[_0x2beb('0x2c')][_0x2beb('0x2f')])){throw new db[(_0x2beb('0x25'))][(_0x2beb('0x26'))](_0x2beb('0x32')+_0x35acf3);}_0xf6cb90[_0x4727f6['body'][_0x2beb('0x2f')]]=_0x4727f6[_0x2beb('0x2c')][_0x2beb('0x33')];})[_0x2beb('0x20')](function(){return db[_0x2beb('0x17')]['find']({'where':{'id':_0x4727f6[_0x2beb('0x34')]['id']},'include':[{'model':db[_0x2beb('0x35')],'as':'List','include':[{'model':db[_0x2beb('0x36')],'as':'Contacts','where':_0xf6cb90,'limit':0x1,'order':[[_0x2beb('0x37'),_0x2beb('0x38')]]}]},{'model':db[_0x2beb('0x39')],'as':_0x2beb('0x3a')}]});})['then'](function(_0x1f8609){if(_0x1f8609&&_0x1f8609['List']){var _0x2e59cd=_0x1f8609[_0x2beb('0x3b')]({'plain':!![]});_0x4135cf[_0x2beb('0x34')]=_0x2e59cd;_0x4135cf[_0x2beb('0x3c')]=_0x2e59cd[_0x2beb('0x3a')];_0x4135cf[_0x2beb('0x3d')]=_0x2e59cd[_0x2beb('0x3e')];_0x4135cf['applications']=_['orderBy'](_0x4135cf['applications'],[_0x2beb('0x3f')],[_0x2beb('0x40')]);if(_0x4135cf['account'][_0x2beb('0x3a')]){delete _0x4135cf[_0x2beb('0x34')][_0x2beb('0x3a')];}if(_0x4135cf[_0x2beb('0x34')][_0x2beb('0x3e')]&&_0x4135cf[_0x2beb('0x34')][_0x2beb('0x3e')][_0x2beb('0x41')][_0x2beb('0x42')]){return _0x4135cf[_0x2beb('0x34')][_0x2beb('0x3e')]['Contacts'][0x0];}var _0x34bf71=_[_0x2beb('0x8')](_0x4727f6[_0x2beb('0x2c')],{'firstName':_0x4727f6['body']['from'],'ListId':_0x2e59cd[_0x2beb('0x2b')]});_0x34bf71[_0x4727f6[_0x2beb('0x2c')][_0x2beb('0x2f')]]=_0x4727f6[_0x2beb('0x2c')][_0x2beb('0x33')];return db[_0x2beb('0x36')][_0x2beb('0x43')](_0x34bf71,{'fields':_0x829f38,'raw':!![]});}})[_0x2beb('0x20')](function(_0xcb7c6f){_0x4135cf['contact']=_0xcb7c6f;if(_0xcb7c6f){var _0xb3785f={'ContactId':_0xcb7c6f['id'],'FaxAccountId':_0x4727f6[_0x2beb('0x34')]['id'],'fax':_0xcb7c6f[_0x2beb('0x24')]};return db[_0x2beb('0x44')][_0x2beb('0x45')]({'where':{'ContactId':_0xcb7c6f['id'],'closed':![],'FaxAccountId':_0x4727f6['account']['id']}})[_0x2beb('0x20')](function(_0x49aed0){if(_0x49aed0){return[_0x49aed0,![]];}return db[_0x2beb('0x44')][_0x2beb('0x43')](_0xb3785f)[_0x2beb('0x20')](function(_0x2f5664){return[_0x2f5664,!![]];});});}else{throw new Error(_0x2beb('0x46'));}})[_0x2beb('0x47')](function(_0xca09e,_0x352ec1){var _0x3cafa0=_0xca09e[_0x2beb('0x3b')]({'plain':!![]});if(_0x352ec1){if(_0x4135cf[_0x2beb('0x34')][_0x2beb('0x48')]){_0x4135cf[_0x2beb('0x3c')][_0x2beb('0x49')]({'id':0x0,'priority':_0x4135cf[_0x2beb('0x3c')][_0x2beb('0x42')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x2beb('0x4a')});}_0x3cafa0[_0x2beb('0x4b')]=!![];}else{_0x3cafa0[_0x2beb('0x4b')]=![];}_0x4135cf[_0x2beb('0x4c')]=_0x3cafa0;return db[_0x2beb('0x4d')][_0x2beb('0x43')]({'body':_0x4727f6[_0x2beb('0x2c')][_0x2beb('0x2c')],'FaxAccountId':_0x4727f6[_0x2beb('0x34')]['id'],'FaxInteractionId':_0xca09e['id'],'direction':'in','ContactId':_0xca09e['ContactId'],'AttachmentId':_0x4727f6[_0x2beb('0x2c')][_0x2beb('0x4e')]});})[_0x2beb('0x20')](function(_0x399a50){_0x4135cf[_0x2beb('0x14')]=_0x399a50;if(_0x4135cf[_0x2beb('0x4c')][_0x2beb('0x4f')]){return db[_0x2beb('0x50')]['find']({'attributes':['id',_0x2beb('0x51')],'where':{'id':_0x4135cf[_0x2beb('0x4c')][_0x2beb('0x4f')]}})['then'](function(_0xdaa9f5){if(_0xdaa9f5){_0x4135cf['applications'][_0x2beb('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xdaa9f5[_0x2beb('0x51')]+','+(_0x4135cf['account']['waitForTheAssignedAgent']||0xa),'interval':_0x2beb('0x4a')});}return respondWithRpcPromise(_0x2beb('0x53'),'startRouting',_0x4135cf);});}return respondWithRpcPromise(_0x2beb('0x53'),_0x2beb('0x54'),_0x4135cf);})[_0x2beb('0x20')](function(_0x8333ef){_0x606581(_0x8333ef);})['catch'](function(_0x5c627a){_0x2f82ce(_0x49147e['error'](0x1f4,_0x5c627a[_0x2beb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d6efcdd..6f127c7 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 _0xce3d=['emit','removeListener','register','length','./faxAccount.events','save','remove','update'];(function(_0x3b0bc9,_0x2a15f1){var _0xaf2a6f=function(_0x4a1865){while(--_0x4a1865){_0x3b0bc9['push'](_0x3b0bc9['shift']());}};_0xaf2a6f(++_0x2a15f1);}(_0xce3d,0x144));var _0xdce3=function(_0x5713f2,_0x40ef5f){_0x5713f2=_0x5713f2-0x0;var _0x52232b=_0xce3d[_0x5713f2];return _0x52232b;};'use strict';var FaxAccountEvents=require(_0xdce3('0x0'));var events=[_0xdce3('0x1'),_0xdce3('0x2'),_0xdce3('0x3')];function createListener(_0x1fe7c9,_0x417889){return function(_0x2ddbf2){_0x417889[_0xdce3('0x4')](_0x1fe7c9,_0x2ddbf2);};}function removeListener(_0x35b4e7,_0x44f260){return function(){FaxAccountEvents[_0xdce3('0x5')](_0x35b4e7,_0x44f260);};}exports[_0xdce3('0x6')]=function(_0xd83ce1){for(var _0x42a405=0x0,_0x4c5784=events[_0xdce3('0x7')];_0x42a405<_0x4c5784;_0x42a405++){var _0x300d83=events[_0x42a405];var _0x4ead53=createListener('faxAccount:'+_0x300d83,_0xd83ce1);FaxAccountEvents['on'](_0x300d83,_0x4ead53);}}; \ No newline at end of file +var _0xa357=['emit','removeListener','register','length','faxAccount:','save','remove','update'];(function(_0x2979a2,_0x407892){var _0x141289=function(_0x369ed2){while(--_0x369ed2){_0x2979a2['push'](_0x2979a2['shift']());}};_0x141289(++_0x407892);}(_0xa357,0x135));var _0x7a35=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xa357[_0x4f5108];return _0x2d56ca;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7a35('0x0'),_0x7a35('0x1'),_0x7a35('0x2')];function createListener(_0x4f530d,_0x1c8e71){return function(_0x1b4545){_0x1c8e71[_0x7a35('0x3')](_0x4f530d,_0x1b4545);};}function removeListener(_0x15065d,_0x150aa0){return function(){FaxAccountEvents[_0x7a35('0x4')](_0x15065d,_0x150aa0);};}exports[_0x7a35('0x5')]=function(_0x20febf){for(var _0x4516c8=0x0,_0x204775=events[_0x7a35('0x6')];_0x4516c8<_0x204775;_0x4516c8++){var _0x152021=events[_0x4516c8];var _0x5901bf=createListener(_0x7a35('0x7')+_0x152021,_0x20febf);FaxAccountEvents['on'](_0x152021,_0x5901bf);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index a5232c4..bd26ab9 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(_0x3ba282,_0x1dde3d){var _0x374bfd=function(_0x536bbc){while(--_0x536bbc){_0x3ba282['push'](_0x3ba282['shift']());}};_0x374bfd(++_0x1dde3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x4fbe83,_0x12fb70){var _0x378eaa=function(_0x2c16e1){while(--_0x2c16e1){_0x4fbe83['push'](_0x4fbe83['shift']());}};_0x378eaa(++_0x12fb70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5f48db4..5498fc6 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 _0x68fb=['noop','TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x2c2526,_0x2c1188){var _0x45439d=function(_0x4b8898){while(--_0x4b8898){_0x2c2526['push'](_0x2c2526['shift']());}};_0x45439d(++_0x2c1188);}(_0x68fb,0xf3));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb68f('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb68f('0x1')],'allowNull':![],'defaultValue':_0xb68f('0x2')},'appdata':{'type':Sequelize[_0xb68f('0x3')]()},'description':{'type':Sequelize[_0xb68f('0x1')]},'interval':{'type':Sequelize[_0xb68f('0x1')],'defaultValue':_0xb68f('0x4')}}; \ No newline at end of file +var _0x8177=['STRING','sequelize','exports','noop'];(function(_0x5832c4,_0x2136be){var _0x22656d=function(_0x11aa66){while(--_0x11aa66){_0x5832c4['push'](_0x5832c4['shift']());}};_0x22656d(++_0x2136be);}(_0x8177,0x85));var _0x7817=function(_0x53ef8d,_0x4f87af){_0x53ef8d=_0x53ef8d-0x0;var _0x1b9308=_0x8177[_0x53ef8d];return _0x1b9308;};'use strict';var Sequelize=require(_0x7817('0x0'));module[_0x7817('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7817('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7817('0x3')]},'interval':{'type':Sequelize[_0x7817('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 10edb87..1a82aca 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 _0xd41a=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','FaxApplication','includeAll','include','rows','catch','params','keys','fields','find','create','update','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0xd41a,0x11a));var _0xad41=function(_0x7c645f,_0x4177ab){_0x7c645f=_0x7c645f-0x0;var _0x1ae9c0=_0xd41a[_0x7c645f];return _0x1ae9c0;};'use strict';var emlformat=require(_0xad41('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xad41('0x1'));var rp=require(_0xad41('0x2'));var moment=require('moment');var BPromise=require(_0xad41('0x3'));var Mustache=require(_0xad41('0x4'));var util=require('util');var path=require(_0xad41('0x5'));var sox=require(_0xad41('0x6'));var csv=require(_0xad41('0x7'));var ejs=require(_0xad41('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad41('0x9'));var squel=require(_0xad41('0xa'));var crypto=require(_0xad41('0xb'));var jsforce=require(_0xad41('0xc'));var deskjs=require(_0xad41('0xd'));var toCsv=require(_0xad41('0x7'));var querystring=require('querystring');var Papa=require(_0xad41('0xe'));var Redis=require(_0xad41('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xad41('0x10'));var as=require(_0xad41('0x11'));var hardwareService=require(_0xad41('0x12'));var logger=require(_0xad41('0x13'))(_0xad41('0x14'));var utils=require(_0xad41('0x15'));var config=require(_0xad41('0x16'));var licenseUtil=require(_0xad41('0x17'));var db=require(_0xad41('0x18'))['db'];function respondWithStatusCode(_0x492ca4,_0xab3dac){_0xab3dac=_0xab3dac||0xcc;return function(_0x3b1d44){if(_0x3b1d44){return _0x492ca4[_0xad41('0x19')](_0xab3dac);}return _0x492ca4['status'](_0xab3dac)[_0xad41('0x1a')]();};}function respondWithResult(_0x3778f3,_0x219eae){_0x219eae=_0x219eae||0xc8;return function(_0x3a73a8){if(_0x3a73a8){return _0x3778f3[_0xad41('0x1b')](_0x219eae)[_0xad41('0x1c')](_0x3a73a8);}};}function respondWithFilteredResult(_0x368e23,_0x19c2b9){return function(_0xea94e0){if(_0xea94e0){var _0x39b420=typeof _0x19c2b9['offset']==='undefined'&&typeof _0x19c2b9[_0xad41('0x1d')]===_0xad41('0x1e');var _0x410c8f=_0xea94e0[_0xad41('0x1f')];var _0x7c8903=_0x39b420?0x0:_0x19c2b9[_0xad41('0x20')];var _0x20b5a6=_0x39b420?_0xea94e0[_0xad41('0x1f')]:_0x19c2b9[_0xad41('0x20')]+_0x19c2b9[_0xad41('0x1d')];var _0x36e3b1;if(_0x20b5a6>=_0x410c8f){_0x20b5a6=_0x410c8f;_0x36e3b1=0xc8;}else{_0x36e3b1=0xce;}_0x368e23[_0xad41('0x1b')](_0x36e3b1);return _0x368e23[_0xad41('0x21')](_0xad41('0x22'),_0x7c8903+'-'+_0x20b5a6+'/'+_0x410c8f)[_0xad41('0x1c')](_0xea94e0);}return null;};}function patchUpdates(_0xb6d5d8){return function(_0x1db451){try{jsonpatch[_0xad41('0x23')](_0x1db451,_0xb6d5d8,!![]);}catch(_0x5adc87){return BPromise[_0xad41('0x24')](_0x5adc87);}return _0x1db451[_0xad41('0x25')]();};}function saveUpdates(_0x1333e9,_0x1449ae){return function(_0x5c3fad){if(_0x5c3fad){return _0x5c3fad['update'](_0x1333e9)[_0xad41('0x26')](function(_0x253c61){return _0x253c61;});}return null;};}function removeEntity(_0x1fe1a3,_0x2bd5d1){return function(_0x463c92){if(_0x463c92){return _0x463c92[_0xad41('0x27')]()[_0xad41('0x26')](function(){_0x1fe1a3[_0xad41('0x1b')](0xcc)[_0xad41('0x1a')]();});}};}function handleEntityNotFound(_0x3c510a,_0x324165){return function(_0x2e1bdc){if(!_0x2e1bdc){_0x3c510a['sendStatus'](0x194);}return _0x2e1bdc;};}function handleError(_0x1ec0af,_0x2c4637){_0x2c4637=_0x2c4637||0x1f4;return function(_0x3827fb){logger['error'](_0x3827fb[_0xad41('0x28')]);if(_0x3827fb[_0xad41('0x29')]){delete _0x3827fb['name'];}_0x1ec0af[_0xad41('0x1b')](_0x2c4637)[_0xad41('0x2a')](_0x3827fb);};}exports[_0xad41('0x2b')]=function(_0x45dc77,_0x156454){var _0x41cf01={},_0x26ff07={},_0x2a0867={'count':0x0,'rows':[]};var _0xa150ee=_[_0xad41('0x2c')](db['FaxApplication'][_0xad41('0x2d')],function(_0x526f86){return{'name':_0x526f86[_0xad41('0x2e')],'type':_0x526f86[_0xad41('0x2f')][_0xad41('0x30')]};});_0x26ff07[_0xad41('0x31')]=_['map'](_0xa150ee,_0xad41('0x29'));_0x26ff07[_0xad41('0x32')]=_['keys'](_0x45dc77[_0xad41('0x32')]);_0x26ff07['filters']=_[_0xad41('0x33')](_0x26ff07[_0xad41('0x31')],_0x26ff07[_0xad41('0x32')]);_0x41cf01[_0xad41('0x34')]=_[_0xad41('0x33')](_0x26ff07[_0xad41('0x31')],qs['fields'](_0x45dc77[_0xad41('0x32')]['fields']));_0x41cf01[_0xad41('0x34')]=_0x41cf01[_0xad41('0x34')][_0xad41('0x35')]?_0x41cf01[_0xad41('0x34')]:_0x26ff07[_0xad41('0x31')];if(!_0x45dc77[_0xad41('0x32')][_0xad41('0x36')]('nolimit')){_0x41cf01['limit']=qs[_0xad41('0x1d')](_0x45dc77[_0xad41('0x32')][_0xad41('0x1d')]);_0x41cf01['offset']=qs[_0xad41('0x20')](_0x45dc77[_0xad41('0x32')][_0xad41('0x20')]);}_0x41cf01[_0xad41('0x37')]=qs['sort'](_0x45dc77[_0xad41('0x32')][_0xad41('0x38')]);_0x41cf01[_0xad41('0x39')]=qs['filters'](_['pick'](_0x45dc77[_0xad41('0x32')],_0x26ff07[_0xad41('0x3a')]),_0xa150ee);if(_0x45dc77[_0xad41('0x32')][_0xad41('0x3b')]){_0x41cf01[_0xad41('0x39')]=_['merge'](_0x41cf01['where'],{'$or':_[_0xad41('0x2c')](_0xa150ee,function(_0x3aee6e){if(_0x3aee6e[_0xad41('0x2f')]!=='VIRTUAL'){var _0x2874c9={};_0x2874c9[_0x3aee6e[_0xad41('0x29')]]={'$like':'%'+_0x45dc77['query'][_0xad41('0x3b')]+'%'};return _0x2874c9;}})});}_0x41cf01=_[_0xad41('0x3c')]({},_0x41cf01,_0x45dc77[_0xad41('0x3d')]);var _0x96a7d={'where':_0x41cf01['where']};return db[_0xad41('0x3e')][_0xad41('0x1f')](_0x96a7d)['then'](function(_0x4ab9a5){_0x2a0867[_0xad41('0x1f')]=_0x4ab9a5;if(_0x45dc77[_0xad41('0x32')][_0xad41('0x3f')]){_0x41cf01[_0xad41('0x40')]=[{'all':!![]}];}return db[_0xad41('0x3e')]['findAll'](_0x41cf01);})[_0xad41('0x26')](function(_0x4e8c71){_0x2a0867[_0xad41('0x41')]=_0x4e8c71;return _0x2a0867;})[_0xad41('0x26')](respondWithFilteredResult(_0x156454,_0x41cf01))[_0xad41('0x42')](handleError(_0x156454,null));};exports['show']=function(_0x424eb6,_0x54ec6b){var _0x4b8db4={'raw':!![],'where':{'id':_0x424eb6[_0xad41('0x43')]['id']}},_0xfcaef0={};_0xfcaef0['model']=_[_0xad41('0x44')](db[_0xad41('0x3e')][_0xad41('0x2d')]);_0xfcaef0[_0xad41('0x32')]=_[_0xad41('0x44')](_0x424eb6[_0xad41('0x32')]);_0xfcaef0['filters']=_[_0xad41('0x33')](_0xfcaef0[_0xad41('0x31')],_0xfcaef0[_0xad41('0x32')]);_0x4b8db4[_0xad41('0x34')]=_['intersection'](_0xfcaef0['model'],qs['fields'](_0x424eb6[_0xad41('0x32')][_0xad41('0x45')]));_0x4b8db4['attributes']=_0x4b8db4['attributes'][_0xad41('0x35')]?_0x4b8db4[_0xad41('0x34')]:_0xfcaef0['model'];if(_0x424eb6[_0xad41('0x32')][_0xad41('0x3f')]){_0x4b8db4[_0xad41('0x40')]=[{'all':!![]}];}_0x4b8db4=_[_0xad41('0x3c')]({},_0x4b8db4,_0x424eb6[_0xad41('0x3d')]);return db[_0xad41('0x3e')][_0xad41('0x46')](_0x4b8db4)[_0xad41('0x26')](handleEntityNotFound(_0x54ec6b,null))[_0xad41('0x26')](respondWithResult(_0x54ec6b,null))[_0xad41('0x42')](handleError(_0x54ec6b,null));};exports[_0xad41('0x47')]=function(_0x3f81b2,_0x39d0f9){return db[_0xad41('0x3e')][_0xad41('0x47')](_0x3f81b2['body'],{})[_0xad41('0x26')](respondWithResult(_0x39d0f9,0xc9))[_0xad41('0x42')](handleError(_0x39d0f9,null));};exports[_0xad41('0x48')]=function(_0x214670,_0x30e6ef){if(_0x214670['body']['id']){delete _0x214670[_0xad41('0x49')]['id'];}return db[_0xad41('0x3e')][_0xad41('0x46')]({'where':{'id':_0x214670[_0xad41('0x43')]['id']}})[_0xad41('0x26')](handleEntityNotFound(_0x30e6ef,null))['then'](saveUpdates(_0x214670[_0xad41('0x49')],null))[_0xad41('0x26')](respondWithResult(_0x30e6ef,null))['catch'](handleError(_0x30e6ef,null));};exports[_0xad41('0x27')]=function(_0x250879,_0x1dcb5c){return db[_0xad41('0x3e')][_0xad41('0x46')]({'where':{'id':_0x250879[_0xad41('0x43')]['id']}})[_0xad41('0x26')](handleEntityNotFound(_0x1dcb5c,null))[_0xad41('0x26')](removeEntity(_0x1dcb5c,null))[_0xad41('0x42')](handleError(_0x1dcb5c,null));}; \ No newline at end of file +var _0x9a09=['includeAll','include','findAll','catch','keys','find','create','body','update','params','rimraf','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x684eb3,_0x353527){var _0x3d3517=function(_0x3ef16b){while(--_0x3ef16b){_0x684eb3['push'](_0x684eb3['shift']());}};_0x3d3517(++_0x353527);}(_0x9a09,0x163));var _0x99a0=function(_0x58fd22,_0x5b1bb6){_0x58fd22=_0x58fd22-0x0;var _0x2948f1=_0x9a09[_0x58fd22];return _0x2948f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99a0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99a0('0x1'));var rp=require(_0x99a0('0x2'));var moment=require(_0x99a0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99a0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x99a0('0x5'));var csv=require('to-csv');var ejs=require(_0x99a0('0x6'));var fs=require('fs');var fs_extra=require(_0x99a0('0x7'));var _=require(_0x99a0('0x8'));var squel=require(_0x99a0('0x9'));var crypto=require('crypto');var jsforce=require(_0x99a0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x99a0('0xb'));var querystring=require(_0x99a0('0xc'));var Papa=require('papaparse');var Redis=require(_0x99a0('0xd'));var authService=require(_0x99a0('0xe'));var qs=require(_0x99a0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x99a0('0x10'))(_0x99a0('0x11'));var utils=require(_0x99a0('0x12'));var config=require(_0x99a0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x99a0('0x14'))['db'];function respondWithStatusCode(_0x20776a,_0xf266bd){_0xf266bd=_0xf266bd||0xcc;return function(_0x567b16){if(_0x567b16){return _0x20776a[_0x99a0('0x15')](_0xf266bd);}return _0x20776a['status'](_0xf266bd)['end']();};}function respondWithResult(_0x121227,_0xe7875d){_0xe7875d=_0xe7875d||0xc8;return function(_0x154221){if(_0x154221){return _0x121227[_0x99a0('0x16')](_0xe7875d)[_0x99a0('0x17')](_0x154221);}};}function respondWithFilteredResult(_0x11295a,_0x3a9032){return function(_0x3f936a){if(_0x3f936a){var _0x10727a=typeof _0x3a9032[_0x99a0('0x18')]===_0x99a0('0x19')&&typeof _0x3a9032[_0x99a0('0x1a')]==='undefined';var _0x2f7d11=_0x3f936a[_0x99a0('0x1b')];var _0x348c49=_0x10727a?0x0:_0x3a9032[_0x99a0('0x18')];var _0x4871eb=_0x10727a?_0x3f936a['count']:_0x3a9032['offset']+_0x3a9032[_0x99a0('0x1a')];var _0x503f2d;if(_0x4871eb>=_0x2f7d11){_0x4871eb=_0x2f7d11;_0x503f2d=0xc8;}else{_0x503f2d=0xce;}_0x11295a['status'](_0x503f2d);return _0x11295a[_0x99a0('0x1c')](_0x99a0('0x1d'),_0x348c49+'-'+_0x4871eb+'/'+_0x2f7d11)[_0x99a0('0x17')](_0x3f936a);}return null;};}function patchUpdates(_0x2a6aeb){return function(_0x12ce9b){try{jsonpatch[_0x99a0('0x1e')](_0x12ce9b,_0x2a6aeb,!![]);}catch(_0x1d21fc){return BPromise[_0x99a0('0x1f')](_0x1d21fc);}return _0x12ce9b['save']();};}function saveUpdates(_0x4242b4,_0x1fabb0){return function(_0x2f455c){if(_0x2f455c){return _0x2f455c['update'](_0x4242b4)[_0x99a0('0x20')](function(_0x10eefa){return _0x10eefa;});}return null;};}function removeEntity(_0x191b70,_0x45b355){return function(_0x691905){if(_0x691905){return _0x691905[_0x99a0('0x21')]()[_0x99a0('0x20')](function(){_0x191b70[_0x99a0('0x16')](0xcc)[_0x99a0('0x22')]();});}};}function handleEntityNotFound(_0x5ad940,_0x4c296a){return function(_0x427459){if(!_0x427459){_0x5ad940[_0x99a0('0x15')](0x194);}return _0x427459;};}function handleError(_0x45df37,_0x426411){_0x426411=_0x426411||0x1f4;return function(_0x173e46){logger[_0x99a0('0x23')](_0x173e46[_0x99a0('0x24')]);if(_0x173e46[_0x99a0('0x25')]){delete _0x173e46[_0x99a0('0x25')];}_0x45df37[_0x99a0('0x16')](_0x426411)[_0x99a0('0x26')](_0x173e46);};}exports['index']=function(_0x39de6c,_0x38b053){var _0x3c6bc3={},_0x1ad69f={},_0x18c3aa={'count':0x0,'rows':[]};var _0x21733a=_[_0x99a0('0x27')](db[_0x99a0('0x28')][_0x99a0('0x29')],function(_0x4cf693){return{'name':_0x4cf693[_0x99a0('0x2a')],'type':_0x4cf693[_0x99a0('0x2b')][_0x99a0('0x2c')]};});_0x1ad69f['model']=_[_0x99a0('0x27')](_0x21733a,_0x99a0('0x25'));_0x1ad69f[_0x99a0('0x2d')]=_['keys'](_0x39de6c[_0x99a0('0x2d')]);_0x1ad69f[_0x99a0('0x2e')]=_[_0x99a0('0x2f')](_0x1ad69f[_0x99a0('0x30')],_0x1ad69f[_0x99a0('0x2d')]);_0x3c6bc3['attributes']=_['intersection'](_0x1ad69f[_0x99a0('0x30')],qs[_0x99a0('0x31')](_0x39de6c['query'][_0x99a0('0x31')]));_0x3c6bc3['attributes']=_0x3c6bc3[_0x99a0('0x32')][_0x99a0('0x33')]?_0x3c6bc3[_0x99a0('0x32')]:_0x1ad69f['model'];if(!_0x39de6c[_0x99a0('0x2d')][_0x99a0('0x34')](_0x99a0('0x35'))){_0x3c6bc3['limit']=qs[_0x99a0('0x1a')](_0x39de6c[_0x99a0('0x2d')]['limit']);_0x3c6bc3[_0x99a0('0x18')]=qs[_0x99a0('0x18')](_0x39de6c[_0x99a0('0x2d')]['offset']);}_0x3c6bc3['order']=qs[_0x99a0('0x36')](_0x39de6c[_0x99a0('0x2d')]['sort']);_0x3c6bc3[_0x99a0('0x37')]=qs['filters'](_[_0x99a0('0x38')](_0x39de6c['query'],_0x1ad69f[_0x99a0('0x2e')]),_0x21733a);if(_0x39de6c[_0x99a0('0x2d')][_0x99a0('0x39')]){_0x3c6bc3[_0x99a0('0x37')]=_['merge'](_0x3c6bc3[_0x99a0('0x37')],{'$or':_[_0x99a0('0x27')](_0x21733a,function(_0x226f7c){if(_0x226f7c[_0x99a0('0x2b')]!=='VIRTUAL'){var _0x1b0507={};_0x1b0507[_0x226f7c[_0x99a0('0x25')]]={'$like':'%'+_0x39de6c['query'][_0x99a0('0x39')]+'%'};return _0x1b0507;}})});}_0x3c6bc3=_[_0x99a0('0x3a')]({},_0x3c6bc3,_0x39de6c['options']);var _0x2eea8f={'where':_0x3c6bc3[_0x99a0('0x37')]};return db['FaxApplication']['count'](_0x2eea8f)[_0x99a0('0x20')](function(_0x560060){_0x18c3aa[_0x99a0('0x1b')]=_0x560060;if(_0x39de6c[_0x99a0('0x2d')][_0x99a0('0x3b')]){_0x3c6bc3[_0x99a0('0x3c')]=[{'all':!![]}];}return db[_0x99a0('0x28')][_0x99a0('0x3d')](_0x3c6bc3);})[_0x99a0('0x20')](function(_0x4b7f0a){_0x18c3aa['rows']=_0x4b7f0a;return _0x18c3aa;})[_0x99a0('0x20')](respondWithFilteredResult(_0x38b053,_0x3c6bc3))[_0x99a0('0x3e')](handleError(_0x38b053,null));};exports['show']=function(_0x5ab75d,_0x15e29f){var _0x372e52={'raw':!![],'where':{'id':_0x5ab75d['params']['id']}},_0x4a42b0={};_0x4a42b0[_0x99a0('0x30')]=_['keys'](db[_0x99a0('0x28')][_0x99a0('0x29')]);_0x4a42b0[_0x99a0('0x2d')]=_[_0x99a0('0x3f')](_0x5ab75d[_0x99a0('0x2d')]);_0x4a42b0[_0x99a0('0x2e')]=_[_0x99a0('0x2f')](_0x4a42b0[_0x99a0('0x30')],_0x4a42b0['query']);_0x372e52[_0x99a0('0x32')]=_[_0x99a0('0x2f')](_0x4a42b0['model'],qs['fields'](_0x5ab75d[_0x99a0('0x2d')][_0x99a0('0x31')]));_0x372e52[_0x99a0('0x32')]=_0x372e52[_0x99a0('0x32')][_0x99a0('0x33')]?_0x372e52[_0x99a0('0x32')]:_0x4a42b0[_0x99a0('0x30')];if(_0x5ab75d[_0x99a0('0x2d')][_0x99a0('0x3b')]){_0x372e52[_0x99a0('0x3c')]=[{'all':!![]}];}_0x372e52=_['merge']({},_0x372e52,_0x5ab75d['options']);return db[_0x99a0('0x28')][_0x99a0('0x40')](_0x372e52)[_0x99a0('0x20')](handleEntityNotFound(_0x15e29f,null))['then'](respondWithResult(_0x15e29f,null))[_0x99a0('0x3e')](handleError(_0x15e29f,null));};exports['create']=function(_0x3214f4,_0x1a1b23){return db[_0x99a0('0x28')][_0x99a0('0x41')](_0x3214f4[_0x99a0('0x42')],{})[_0x99a0('0x20')](respondWithResult(_0x1a1b23,0xc9))[_0x99a0('0x3e')](handleError(_0x1a1b23,null));};exports[_0x99a0('0x43')]=function(_0x5006c3,_0x348634){if(_0x5006c3['body']['id']){delete _0x5006c3[_0x99a0('0x42')]['id'];}return db[_0x99a0('0x28')]['find']({'where':{'id':_0x5006c3[_0x99a0('0x44')]['id']}})['then'](handleEntityNotFound(_0x348634,null))[_0x99a0('0x20')](saveUpdates(_0x5006c3[_0x99a0('0x42')],null))['then'](respondWithResult(_0x348634,null))[_0x99a0('0x3e')](handleError(_0x348634,null));};exports[_0x99a0('0x21')]=function(_0x4d022f,_0x6264a2){return db['FaxApplication'][_0x99a0('0x40')]({'where':{'id':_0x4d022f[_0x99a0('0x44')]['id']}})[_0x99a0('0x20')](handleEntityNotFound(_0x6264a2,null))['then'](removeEntity(_0x6264a2,null))[_0x99a0('0x3e')](handleError(_0x6264a2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4cba499..2d42b2e 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 _0xadc6=['rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3e85fb,_0x224e41){var _0x265535=function(_0x218ad0){while(--_0x218ad0){_0x3e85fb['push'](_0x3e85fb['shift']());}};_0x265535(++_0x224e41);}(_0xadc6,0x159));var _0x6adc=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xadc6[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x6adc('0x0'));var logger=require(_0x6adc('0x1'))('api');var moment=require(_0x6adc('0x2'));var BPromise=require(_0x6adc('0x3'));var rp=require(_0x6adc('0x4'));var fs=require('fs');var path=require(_0x6adc('0x5'));var rimraf=require(_0x6adc('0x6'));var config=require(_0x6adc('0x7'));var attributes=require(_0x6adc('0x8'));module[_0x6adc('0x9')]=function(_0x5c2c6e,_0x1ba32){return _0x5c2c6e['define'](_0x6adc('0xa'),attributes,{'tableName':_0x6adc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6adc('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5cda=['path','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise'];(function(_0x394658,_0x3737de){var _0x4f027e=function(_0x1670b3){while(--_0x1670b3){_0x394658['push'](_0x394658['shift']());}};_0x4f027e(++_0x3737de);}(_0x5cda,0x1b4));var _0xa5cd=function(_0x3c2e50,_0x516129){_0x3c2e50=_0x3c2e50-0x0;var _0x57a4ea=_0x5cda[_0x3c2e50];return _0x57a4ea;};'use strict';var _=require(_0xa5cd('0x0'));var util=require(_0xa5cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa5cd('0x2'));var BPromise=require('bluebird');var rp=require(_0xa5cd('0x3'));var fs=require('fs');var path=require(_0xa5cd('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5cd('0x5'));module[_0xa5cd('0x6')]=function(_0x6b0a4c,_0x460d86){return _0x6b0a4c['define'](_0xa5cd('0x7'),attributes,{'tableName':_0xa5cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa5cd('0x9'),'collate':_0xa5cd('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 99a30de..2164be9 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 _0xcc15=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','options','raw','where','attributes','UpdateFaxApplication','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b7a25,_0x132af7){var _0x2d6b3b=function(_0x370fd9){while(--_0x370fd9){_0x4b7a25['push'](_0x4b7a25['shift']());}};_0x2d6b3b(++_0x132af7);}(_0xcc15,0x15e));var _0x5cc1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcc15[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x5cc1('0x0'));var moment=require(_0x5cc1('0x1'));var BPromise=require(_0x5cc1('0x2'));var rs=require(_0x5cc1('0x3'));var fs=require('fs');var Redis=require(_0x5cc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5cc1('0x5'))(_0x5cc1('0x6'));var config=require(_0x5cc1('0x7'));var jayson=require(_0x5cc1('0x8'));var client=jayson['client'][_0x5cc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x234bf5,_0x3d2d3d,_0x532ca5){return new BPromise(function(_0x1921e7,_0x219039){return client['request'](_0x234bf5,_0x532ca5)[_0x5cc1('0xa')](function(_0x3a0108){logger[_0x5cc1('0xb')](_0x5cc1('0xc'),_0x3d2d3d,_0x5cc1('0xd'));logger[_0x5cc1('0xe')](_0x5cc1('0xf'),_0x3d2d3d,_0x5cc1('0xd'),JSON[_0x5cc1('0x10')](_0x3a0108));if(_0x3a0108[_0x5cc1('0x11')]){if(_0x3a0108[_0x5cc1('0x11')][_0x5cc1('0x12')]===0x1f4){logger[_0x5cc1('0x11')]('FaxApplication,\x20%s,\x20%s',_0x3d2d3d,_0x3a0108[_0x5cc1('0x11')][_0x5cc1('0x13')]);return _0x219039(_0x3a0108['error'][_0x5cc1('0x13')]);}logger[_0x5cc1('0x11')](_0x5cc1('0xc'),_0x3d2d3d,_0x3a0108[_0x5cc1('0x11')][_0x5cc1('0x13')]);return _0x1921e7(_0x3a0108[_0x5cc1('0x11')][_0x5cc1('0x13')]);}else{logger[_0x5cc1('0xb')](_0x5cc1('0xc'),_0x3d2d3d,_0x5cc1('0xd'));_0x1921e7(_0x3a0108[_0x5cc1('0x14')][_0x5cc1('0x13')]);}})[_0x5cc1('0x15')](function(_0x8b3454){logger[_0x5cc1('0x11')]('FaxApplication,\x20%s,\x20%s',_0x3d2d3d,_0x8b3454);_0x219039(_0x8b3454);});});}exports['UpdateFaxApplication']=function(_0x3a5dae){var _0x3de805=this;return new Promise(function(_0x3aad15,_0x17c860){return db[_0x5cc1('0x16')][_0x5cc1('0x17')](_0x3a5dae[_0x5cc1('0x18')],{'raw':_0x3a5dae[_0x5cc1('0x19')]?_0x3a5dae['options'][_0x5cc1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5dae[_0x5cc1('0x19')]?_0x3a5dae[_0x5cc1('0x19')][_0x5cc1('0x1b')]||null:null,'attributes':_0x3a5dae[_0x5cc1('0x19')]?_0x3a5dae['options'][_0x5cc1('0x1c')]||null:null,'limit':_0x3a5dae['options']?_0x3a5dae['options']['limit']||null:null})[_0x5cc1('0xa')](function(_0x4ea0e5){logger[_0x5cc1('0xb')](_0x5cc1('0x1d'),_0x3a5dae);logger[_0x5cc1('0xe')](_0x5cc1('0x1d'),_0x3a5dae,JSON[_0x5cc1('0x10')](_0x4ea0e5));_0x3aad15(_0x4ea0e5);})[_0x5cc1('0x15')](function(_0x59c8fc){logger[_0x5cc1('0x11')](_0x5cc1('0x1d'),_0x59c8fc[_0x5cc1('0x13')],_0x3a5dae);_0x17c860(_0x3de805[_0x5cc1('0x11')](0x1f4,_0x59c8fc[_0x5cc1('0x13')]));});});}; \ No newline at end of file +var _0x5dd7=['FaxApplication','update','body','options','where','attributes','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateFaxApplication'];(function(_0x38c5c6,_0x459b80){var _0x2e56d2=function(_0x2dde05){while(--_0x2dde05){_0x38c5c6['push'](_0x38c5c6['shift']());}};_0x2e56d2(++_0x459b80);}(_0x5dd7,0xae));var _0x75dd=function(_0x4497cd,_0x4a2208){_0x4497cd=_0x4497cd-0x0;var _0x3c6c43=_0x5dd7[_0x4497cd];return _0x3c6c43;};'use strict';var _=require(_0x75dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75dd('0x1'));var fs=require('fs');var Redis=require(_0x75dd('0x2'));var db=require(_0x75dd('0x3'))['db'];var utils=require(_0x75dd('0x4'));var logger=require(_0x75dd('0x5'))(_0x75dd('0x6'));var config=require(_0x75dd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x75dd('0x8')][_0x75dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c8b4e,_0x50d483,_0x7a75e){return new BPromise(function(_0x41f6b2,_0xb9d1b){return client[_0x75dd('0xa')](_0x4c8b4e,_0x7a75e)[_0x75dd('0xb')](function(_0x472945){logger[_0x75dd('0xc')](_0x75dd('0xd'),_0x50d483,_0x75dd('0xe'));logger[_0x75dd('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x50d483,_0x75dd('0xe'),JSON[_0x75dd('0x10')](_0x472945));if(_0x472945[_0x75dd('0x11')]){if(_0x472945[_0x75dd('0x11')]['code']===0x1f4){logger[_0x75dd('0x11')]('FaxApplication,\x20%s,\x20%s',_0x50d483,_0x472945[_0x75dd('0x11')][_0x75dd('0x12')]);return _0xb9d1b(_0x472945[_0x75dd('0x11')][_0x75dd('0x12')]);}logger['error'](_0x75dd('0xd'),_0x50d483,_0x472945['error']['message']);return _0x41f6b2(_0x472945[_0x75dd('0x11')]['message']);}else{logger['info'](_0x75dd('0xd'),_0x50d483,_0x75dd('0xe'));_0x41f6b2(_0x472945[_0x75dd('0x13')][_0x75dd('0x12')]);}})[_0x75dd('0x14')](function(_0x2799be){logger[_0x75dd('0x11')]('FaxApplication,\x20%s,\x20%s',_0x50d483,_0x2799be);_0xb9d1b(_0x2799be);});});}exports[_0x75dd('0x15')]=function(_0x547c22){var _0x4dd9f9=this;return new Promise(function(_0x39b74c,_0x33d8ba){return db[_0x75dd('0x16')][_0x75dd('0x17')](_0x547c22[_0x75dd('0x18')],{'raw':_0x547c22[_0x75dd('0x19')]?_0x547c22['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547c22[_0x75dd('0x19')]?_0x547c22[_0x75dd('0x19')][_0x75dd('0x1a')]||null:null,'attributes':_0x547c22[_0x75dd('0x19')]?_0x547c22[_0x75dd('0x19')][_0x75dd('0x1b')]||null:null,'limit':_0x547c22[_0x75dd('0x19')]?_0x547c22[_0x75dd('0x19')]['limit']||null:null})[_0x75dd('0xb')](function(_0x45463e){logger['info'](_0x75dd('0x15'),_0x547c22);logger[_0x75dd('0xf')](_0x75dd('0x15'),_0x547c22,JSON[_0x75dd('0x10')](_0x45463e));_0x39b74c(_0x45463e);})[_0x75dd('0x14')](function(_0x4dbc18){logger[_0x75dd('0x11')]('UpdateFaxApplication',_0x4dbc18[_0x75dd('0x12')],_0x547c22);_0x33d8ba(_0x4dd9f9[_0x75dd('0x11')](0x1f4,_0x4dbc18['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index fac1ecc..bdc67a3 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x4bb0f7,_0xb630dc){var _0x2b4fac=function(_0x55ecae){while(--_0x55ecae){_0x4bb0f7['push'](_0x4bb0f7['shift']());}};_0x2b4fac(++_0xb630dc);}(_0x34b7,0x196));var _0x734b=function(_0xa270f3,_0x293fd){_0xa270f3=_0xa270f3-0x0;var _0x48767f=_0x34b7[_0xa270f3];return _0x48767f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x36b0ce,_0x2cc08d){var _0x46f985=function(_0x5641ed){while(--_0x5641ed){_0x36b0ce['push'](_0x36b0ce['shift']());}};_0x46f985(++_0x2cc08d);}(_0xa571,0x107));var _0x1a57=function(_0x44cd21,_0x27dc22){_0x44cd21=_0x44cd21-0x0;var _0x34e6b9=_0xa571[_0x44cd21];return _0x34e6b9;};'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('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 69318b5..6461ab4 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 _0x2d58=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3ef631,_0x530cce){var _0xf23932=function(_0xb93526){while(--_0xb93526){_0x3ef631['push'](_0x3ef631['shift']());}};_0xf23932(++_0x530cce);}(_0x2d58,0x144));var _0x82d5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2d58[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x82d5('0x0')]={'closed':{'type':Sequelize[_0x82d5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x82d5('0x2')]},'disposition':{'type':Sequelize[_0x82d5('0x3')]},'secondDisposition':{'type':Sequelize[_0x82d5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x82d5('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x82d5('0x2')]},'fax':{'type':Sequelize[_0x82d5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x82d5('0x4')]('in',_0x82d5('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x82d5('0x4')]('in',_0x82d5('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xfaaf=['out','sequelize','DATE','STRING','ENUM'];(function(_0x2cf52a,_0x263f89){var _0x5eaf30=function(_0x54a4f6){while(--_0x54a4f6){_0x2cf52a['push'](_0x2cf52a['shift']());}};_0x5eaf30(++_0x263f89);}(_0xfaaf,0x9c));var _0xffaa=function(_0x1d0035,_0x45354b){_0x1d0035=_0x1d0035-0x0;var _0x310e3a=_0xfaaf[_0x1d0035];return _0x310e3a;};'use strict';var Sequelize=require(_0xffaa('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xffaa('0x1')]},'disposition':{'type':Sequelize[_0xffaa('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xffaa('0x2')]},'note':{'type':Sequelize[_0xffaa('0x2')]},'read1stAt':{'type':Sequelize[_0xffaa('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xffaa('0x3')]('in',_0xffaa('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xffaa('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xffaa('0x3')]('in',_0xffaa('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 43e0c1a..0d98693 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 _0xb751=['lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./faxInteraction.socket','json','undefined','limit','offset','count','set','Content-Range','update','then','end','sendStatus','stack','name','status','send','index','map','FaxInteraction','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','rawAttributes','keys','model','attributes','intersection','fields','includeAll','include','merge','options','find','create','body','destroy','addMessage','FaxMessage','omit','getMessages','findOne','filters','length','hasOwnProperty','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','ids','emit','faxInteractionTags:save','removeTags','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','unlinkSync','rimraf','moment','bluebird','util','path'];(function(_0x3e8ed1,_0x488fa3){var _0x52c466=function(_0x4ab73a){while(--_0x4ab73a){_0x3e8ed1['push'](_0x3e8ed1['shift']());}};_0x52c466(++_0x488fa3);}(_0xb751,0x64));var _0x1b75=function(_0x572f0f,_0x5dc63e){_0x572f0f=_0x572f0f-0x0;var _0x4cb922=_0xb751[_0x572f0f];return _0x4cb922;};'use strict';var rimraf=require(_0x1b75('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1b75('0x1'));var BPromise=require(_0x1b75('0x2'));var util=require(_0x1b75('0x3'));var path=require(_0x1b75('0x4'));var fs=require('fs');var _=require(_0x1b75('0x5'));var Redis=require(_0x1b75('0x6'));var interaction=require(_0x1b75('0x7'));var qs=require(_0x1b75('0x8'));var logger=require(_0x1b75('0x9'))('api');var config=require(_0x1b75('0xa'));var db=require(_0x1b75('0xb'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1b75('0xc'))(new Redis(config[_0x1b75('0xd')]));require(_0x1b75('0xe'))['register'](socket);function respondWithStatusCode(_0x56319f,_0x32ce73){_0x32ce73=_0x32ce73||0xcc;return function(_0x4e58e4){if(_0x4e58e4){return _0x56319f['sendStatus'](_0x32ce73);}return _0x56319f['status'](_0x32ce73)['end']();};}function respondWithResult(_0x142c90,_0x3c9fe8){_0x3c9fe8=_0x3c9fe8||0xc8;return function(_0x5e3258){if(_0x5e3258){return _0x142c90['status'](_0x3c9fe8)[_0x1b75('0xf')](_0x5e3258);}};}function respondWithFilteredResult(_0x139902,_0x2c2b83){return function(_0x8acba3){if(_0x8acba3){var _0x1c05be=typeof _0x2c2b83['offset']===_0x1b75('0x10')&&typeof _0x2c2b83[_0x1b75('0x11')]===_0x1b75('0x10');var _0x4169b0=_0x8acba3['count'];var _0x2a7023=_0x1c05be?0x0:_0x2c2b83[_0x1b75('0x12')];var _0x588bbe=_0x1c05be?_0x8acba3[_0x1b75('0x13')]:_0x2c2b83['offset']+_0x2c2b83[_0x1b75('0x11')];var _0xec8982;if(_0x588bbe>=_0x4169b0){_0x588bbe=_0x4169b0;_0xec8982=0xc8;}else{_0xec8982=0xce;}_0x139902['status'](_0xec8982);return _0x139902[_0x1b75('0x14')](_0x1b75('0x15'),_0x2a7023+'-'+_0x588bbe+'/'+_0x4169b0)[_0x1b75('0xf')](_0x8acba3);}return null;};}function saveUpdates(_0x5771c7){return function(_0x53d1cb){if(_0x53d1cb){return _0x53d1cb[_0x1b75('0x16')](_0x5771c7)[_0x1b75('0x17')](function(_0x1e879b){return _0x1e879b;});}return null;};}function removeEntity(_0x6e5956){return function(_0x335878){if(_0x335878){return _0x335878['destroy']()['then'](function(){_0x6e5956['status'](0xcc)[_0x1b75('0x18')]();});}};}function handleEntityNotFound(_0x2b344f){return function(_0x49037c){if(!_0x49037c){_0x2b344f[_0x1b75('0x19')](0x194);}return _0x49037c;};}function handleError(_0xc0c52b,_0x4a1380){_0x4a1380=_0x4a1380||0x1f4;return function(_0x230171){logger['error'](_0x230171[_0x1b75('0x1a')]);if(_0x230171['name']){delete _0x230171[_0x1b75('0x1b')];}_0xc0c52b[_0x1b75('0x1c')](_0x4a1380)[_0x1b75('0x1d')](_0x230171);};}exports[_0x1b75('0x1e')]=function(_0xe351e9,_0x1c9f57){var _0x3739f9={};var _0x260044=_[_0x1b75('0x1f')](db[_0x1b75('0x20')]['rawAttributes'],function(_0x480383){return{'name':_0x480383[_0x1b75('0x21')],'type':_0x480383[_0x1b75('0x22')][_0x1b75('0x23')]};});_0x3739f9=qs[_0x1b75('0x24')](_0x260044,_0xe351e9);return interaction[_0x1b75('0x25')](_0x1b75('0x26'),_0xe351e9[_0x1b75('0x27')],_0xe351e9[_0x1b75('0x28')],_0x3739f9,_0x260044)['then'](respondWithFilteredResult(_0x1c9f57,_0x3739f9))[_0x1b75('0x29')](handleError(_0x1c9f57,null));};exports[_0x1b75('0x2a')]=function(_0x2907c7,_0x43a31a){var _0x47f31e={'raw':![],'where':{'id':_0x2907c7[_0x1b75('0x2b')]['id']}},_0x49f2de={};_0x49f2de['model']=_['keys'](db[_0x1b75('0x20')][_0x1b75('0x2c')]);_0x49f2de['query']=_[_0x1b75('0x2d')](_0x2907c7['query']);_0x49f2de['filters']=_['intersection'](_0x49f2de[_0x1b75('0x2e')],_0x49f2de[_0x1b75('0x27')]);_0x47f31e[_0x1b75('0x2f')]=_[_0x1b75('0x30')](_0x49f2de[_0x1b75('0x2e')],qs[_0x1b75('0x31')](_0x2907c7[_0x1b75('0x27')][_0x1b75('0x31')]));_0x47f31e['attributes']=_0x47f31e[_0x1b75('0x2f')]['length']?_0x47f31e[_0x1b75('0x2f')]:_0x49f2de['model'];if(_0x2907c7[_0x1b75('0x27')][_0x1b75('0x32')]){_0x47f31e[_0x1b75('0x33')]=[{'all':!![]}];}_0x47f31e=_[_0x1b75('0x34')]({},_0x47f31e,_0x2907c7[_0x1b75('0x35')]);return db[_0x1b75('0x20')][_0x1b75('0x36')](_0x47f31e)[_0x1b75('0x17')](handleEntityNotFound(_0x43a31a,null))[_0x1b75('0x17')](respondWithResult(_0x43a31a,null))[_0x1b75('0x29')](handleError(_0x43a31a,null));};exports[_0x1b75('0x37')]=function(_0x5543e1,_0x1b57c3){return db['FaxInteraction'][_0x1b75('0x37')](_0x5543e1['body'],{})['then'](respondWithResult(_0x1b57c3,0xc9))[_0x1b75('0x29')](handleError(_0x1b57c3,null));};exports[_0x1b75('0x16')]=function(_0x5e20f7,_0x4895b7){if(_0x5e20f7[_0x1b75('0x38')]['id']){delete _0x5e20f7[_0x1b75('0x38')]['id'];}return db[_0x1b75('0x20')][_0x1b75('0x36')]({'where':{'id':_0x5e20f7[_0x1b75('0x2b')]['id']}})[_0x1b75('0x17')](handleEntityNotFound(_0x4895b7,null))['then'](saveUpdates(_0x5e20f7[_0x1b75('0x38')],null))[_0x1b75('0x17')](respondWithResult(_0x4895b7,null))[_0x1b75('0x29')](handleError(_0x4895b7,null));};exports[_0x1b75('0x39')]=function(_0x22c7cf,_0x2f902d){return db['FaxInteraction']['find']({'where':{'id':_0x22c7cf['params']['id']}})[_0x1b75('0x17')](handleEntityNotFound(_0x2f902d,null))['then'](removeEntity(_0x2f902d,null))[_0x1b75('0x29')](handleError(_0x2f902d,null));};exports['describe']=function(_0x4af9ac,_0x546e7e){return db[_0x1b75('0x20')]['describe']()['then'](respondWithResult(_0x546e7e,null))[_0x1b75('0x29')](handleError(_0x546e7e,null));};exports[_0x1b75('0x3a')]=function(_0x22af6e,_0x46dfef){return db[_0x1b75('0x3b')][_0x1b75('0x36')]({'where':{'id':_0x22af6e['params']['id']}})[_0x1b75('0x17')](handleEntityNotFound(_0x46dfef,null))[_0x1b75('0x17')](function(_0x28f4ed){if(_0x28f4ed){return _0x28f4ed[_0x1b75('0x3a')](_0x22af6e[_0x1b75('0x38')]['ids'],_[_0x1b75('0x3c')](_0x22af6e[_0x1b75('0x38')],['ids','id'])||{});}})[_0x1b75('0x17')](respondWithResult(_0x46dfef,null))['catch'](handleError(_0x46dfef,null));};exports[_0x1b75('0x3d')]=function(_0x361c34,_0x184cc5){var _0x186e75={'raw':![],'where':{}};var _0x2bed02={};var _0x5035ed={'count':0x0,'rows':[]};return db[_0x1b75('0x20')][_0x1b75('0x3e')]({'where':{'id':_0x361c34[_0x1b75('0x2b')]['id']}})[_0x1b75('0x17')](handleEntityNotFound(_0x184cc5,null))[_0x1b75('0x17')](function(_0x26638f){if(_0x26638f){_0x2bed02[_0x1b75('0x2e')]=_[_0x1b75('0x2d')](db[_0x1b75('0x3b')]['rawAttributes']);_0x2bed02[_0x1b75('0x27')]=_[_0x1b75('0x2d')](_0x361c34[_0x1b75('0x27')]);_0x2bed02[_0x1b75('0x3f')]=_[_0x1b75('0x30')](_0x2bed02['model'],_0x2bed02['query']);_0x186e75[_0x1b75('0x2f')]=_[_0x1b75('0x30')](_0x2bed02[_0x1b75('0x2e')],qs[_0x1b75('0x31')](_0x361c34[_0x1b75('0x27')][_0x1b75('0x31')]));_0x186e75[_0x1b75('0x2f')]=_0x186e75['attributes'][_0x1b75('0x40')]?_0x186e75[_0x1b75('0x2f')]:_0x2bed02['model'];if(!_0x361c34[_0x1b75('0x27')][_0x1b75('0x41')]('nolimit')){_0x186e75[_0x1b75('0x11')]=qs[_0x1b75('0x11')](_0x361c34['query']['limit']);_0x186e75[_0x1b75('0x12')]=qs[_0x1b75('0x12')](_0x361c34[_0x1b75('0x27')]['offset']);}_0x186e75[_0x1b75('0x42')]=qs['sort'](_0x361c34['query'][_0x1b75('0x43')]);_0x186e75[_0x1b75('0x44')]=qs['filters'](_[_0x1b75('0x45')](_0x361c34['query'],_0x2bed02[_0x1b75('0x3f')]));_0x186e75[_0x1b75('0x44')][_0x1b75('0x46')]=_0x26638f['id'];if(_0x361c34[_0x1b75('0x27')][_0x1b75('0x47')]){_0x186e75['where']=_[_0x1b75('0x34')](_0x186e75['where'],{'$or':_[_0x1b75('0x1f')](_0x186e75[_0x1b75('0x2f')],function(_0x38d418){var _0x520c20={};_0x520c20[_0x38d418]={'$like':'%'+_0x361c34['query'][_0x1b75('0x47')]+'%'};return _0x520c20;})});}if(_0x361c34['query'][_0x1b75('0x48')]){var _0x1bc59b=_0x361c34[_0x1b75('0x27')]['$gte'][_0x1b75('0x49')](',');var _0x454010={};_0x454010[_0x1bc59b[0x0]]={'$gte':moment(_0x1bc59b[0x1])[_0x1b75('0x4a')](_0x1b75('0x4b'))};_0x186e75[_0x1b75('0x44')]=_[_0x1b75('0x34')](_0x186e75[_0x1b75('0x44')],_0x454010);}_0x186e75=_[_0x1b75('0x34')]({},_0x186e75,_0x361c34['options']);return db['FaxMessage']['count']({'where':_0x186e75['where']})['then'](function(_0xe26461){_0x5035ed[_0x1b75('0x13')]=_0xe26461;if(_0x361c34[_0x1b75('0x27')][_0x1b75('0x32')]){_0x186e75[_0x1b75('0x33')]=[{'all':!![]}];}return db[_0x1b75('0x3b')][_0x1b75('0x25')](_0x186e75);})[_0x1b75('0x17')](function(_0x3195da){_0x5035ed[_0x1b75('0x4c')]=_0x3195da;return _0x5035ed;});}})['then'](respondWithFilteredResult(_0x184cc5,_0x186e75))[_0x1b75('0x29')](handleError(_0x184cc5,null));};exports[_0x1b75('0x4d')]=function(_0x1b5296,_0x3a88cb){return db[_0x1b75('0x20')][_0x1b75('0x36')]({'where':{'id':_0x1b5296['params']['id']}})[_0x1b75('0x17')](handleEntityNotFound(_0x3a88cb,null))['then'](function(_0x6d2c5e){if(_0x6d2c5e){return _0x6d2c5e[_0x1b75('0x4e')](_0x1b5296[_0x1b75('0x38')]['ids'],_[_0x1b75('0x3c')](_0x1b5296[_0x1b75('0x38')],['ids','id'])||{})['spread'](function(){return db[_0x1b75('0x4f')][_0x1b75('0x25')]({'attributes':['id','name','color'],'where':{'id':_0x1b5296[_0x1b75('0x38')][_0x1b75('0x50')]}});})[_0x1b75('0x17')](function(_0x18485a){socket[_0x1b75('0x51')](_0x1b75('0x52'),{'id':Number(_0x1b5296[_0x1b75('0x2b')]['id']),'tags':_0x18485a||[]});return{'id':Number(_0x1b5296[_0x1b75('0x2b')]['id']),'tags':_0x18485a||[]};});}})[_0x1b75('0x17')](respondWithResult(_0x3a88cb,null))[_0x1b75('0x29')](handleError(_0x3a88cb,null));};exports[_0x1b75('0x53')]=function(_0x12add2,_0x4db878){return db[_0x1b75('0x20')][_0x1b75('0x36')]({'where':{'id':_0x12add2['params']['id']}})['then'](handleEntityNotFound(_0x4db878,null))[_0x1b75('0x17')](function(_0x365b26){if(_0x365b26){return _0x365b26[_0x1b75('0x53')](_0x12add2[_0x1b75('0x27')][_0x1b75('0x50')]);}})['then'](respondWithStatusCode(_0x4db878,null))[_0x1b75('0x29')](handleError(_0x4db878,null));};exports['download']=function(_0x1c2b41,_0xafea1){var _0x513c45=moment()['unix']()[_0x1b75('0x54')]();var _0x33b147=path['join'](config[_0x1b75('0x55')],_0x1b75('0x56'),_0x1b75('0x57'),_0x1b75('0x58'));var _0x256828=path[_0x1b75('0x59')](config['root'],'server',_0x1b75('0x57'),_0x1b75('0x5a'));var _0x5df9d7=path['join'](_0x33b147,_0x513c45);var _0x4876a6=util[_0x1b75('0x4a')](_0x1b75('0x5b'),_0x1c2b41['params']['id'],_0x513c45);var _0x90b8c4=path[_0x1b75('0x59')](_0x33b147,_0x4876a6);var _0x3b9d7d=[];_0x3b9d7d[_0x1b75('0x5c')]({'model':db['Attachment'],'as':_0x1b75('0x5d'),'raw':!![]});var _0x1015a1=[{'model':db[_0x1b75('0x3b')],'as':_0x1b75('0x5e'),'attributes':['id',_0x1b75('0x38'),_0x1b75('0x5f')],'include':_0x3b9d7d}];return db[_0x1b75('0x20')]['find']({'where':{'id':_0x1c2b41[_0x1b75('0x2b')]['id']},'include':_0x1015a1})[_0x1b75('0x17')](handleEntityNotFound(_0xafea1,null))['then'](function(_0x149426){if(_0x149426&&_0x149426[_0x1b75('0x5e')]){var _0x21ddaf=_0x149426['get']({'plain':!![]});fs[_0x1b75('0x60')](_0x5df9d7);for(var _0x16b363=0x0;_0x16b363<_0x21ddaf[_0x1b75('0x5e')]['length'];_0x16b363++){var _0x39c57c=_0x21ddaf[_0x1b75('0x5e')][_0x16b363][_0x1b75('0x5d')];if(_0x39c57c){var _0x253537=path[_0x1b75('0x59')](_0x256828,_0x39c57c[_0x1b75('0x61')]);if(fs[_0x1b75('0x62')](_0x253537)){fs[_0x1b75('0x63')](_0x253537)[_0x1b75('0x64')](fs[_0x1b75('0x65')](path['join'](_0x5df9d7,_0x39c57c['basename'])));}}}return BPromise[_0x1b75('0x66')]()[_0x1b75('0x17')](function(){return new BPromise(function(_0x2b7745,_0x1d2eb7){zipdir(_0x5df9d7,{'saveTo':_0x90b8c4},function(_0x1d158d,_0x4bb320){if(_0x1d158d)return _0x1d2eb7(_0x1d158d);return _0x2b7745(_0x4bb320);});})[_0x1b75('0x17')](function(){return new BPromise(function(_0x26a28f,_0x2f8cb8){rimraf(_0x5df9d7,function(_0x462b4f){if(_0x462b4f)_0x2f8cb8(_0x462b4f);return _0x26a28f();});});})[_0x1b75('0x17')](function(){return _0xafea1[_0x1b75('0x67')](_0x90b8c4,_0x4876a6,function(_0x16763a){if(_0x16763a){console['log']('err',_0x16763a);}else{fs[_0x1b75('0x68')](_0x90b8c4);}});});});}else{return _0xafea1[_0x1b75('0x19')](0xc8);}})[_0x1b75('0x29')](handleError(_0xafea1,null));}; \ No newline at end of file +var _0xd901=['push','Attachment','Messages','mkdirSync','basename','existsSync','pipe','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','undefined','count','offset','update','then','end','sendStatus','error','stack','name','send','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','params','model','filters','attributes','intersection','fields','length','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','limit','order','sort','where','FaxInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','format'];(function(_0xc2e419,_0x1ee82c){var _0x5dcc2d=function(_0x2ec00c){while(--_0x2ec00c){_0xc2e419['push'](_0xc2e419['shift']());}};_0x5dcc2d(++_0x1ee82c);}(_0xd901,0x192));var _0x1d90=function(_0x77f5a5,_0x5f1839){_0x77f5a5=_0x77f5a5-0x0;var _0x487072=_0xd901[_0x77f5a5];return _0x487072;};'use strict';var rimraf=require(_0x1d90('0x0'));var zipdir=require(_0x1d90('0x1'));var moment=require(_0x1d90('0x2'));var BPromise=require(_0x1d90('0x3'));var util=require('util');var path=require(_0x1d90('0x4'));var fs=require('fs');var _=require(_0x1d90('0x5'));var Redis=require(_0x1d90('0x6'));var interaction=require(_0x1d90('0x7'));var qs=require(_0x1d90('0x8'));var logger=require(_0x1d90('0x9'))('api');var config=require(_0x1d90('0xa'));var db=require(_0x1d90('0xb'))['db'];config[_0x1d90('0xc')]=_['defaults'](config[_0x1d90('0xc')],{'host':_0x1d90('0xd'),'port':0x18eb});var socket=require(_0x1d90('0xe'))(new Redis(config[_0x1d90('0xc')]));require(_0x1d90('0xf'))[_0x1d90('0x10')](socket);function respondWithStatusCode(_0x4ce328,_0xd5aab2){_0xd5aab2=_0xd5aab2||0xcc;return function(_0x4d8631){if(_0x4d8631){return _0x4ce328['sendStatus'](_0xd5aab2);}return _0x4ce328[_0x1d90('0x11')](_0xd5aab2)['end']();};}function respondWithResult(_0x53920d,_0x18074b){_0x18074b=_0x18074b||0xc8;return function(_0x17a79e){if(_0x17a79e){return _0x53920d[_0x1d90('0x11')](_0x18074b)[_0x1d90('0x12')](_0x17a79e);}};}function respondWithFilteredResult(_0x8cf9f4,_0x4edd88){return function(_0x2e1be5){if(_0x2e1be5){var _0x20126a=typeof _0x4edd88['offset']===_0x1d90('0x13')&&typeof _0x4edd88['limit']===_0x1d90('0x13');var _0x1b53f5=_0x2e1be5[_0x1d90('0x14')];var _0x37dd08=_0x20126a?0x0:_0x4edd88[_0x1d90('0x15')];var _0x186395=_0x20126a?_0x2e1be5['count']:_0x4edd88['offset']+_0x4edd88['limit'];var _0x5150e3;if(_0x186395>=_0x1b53f5){_0x186395=_0x1b53f5;_0x5150e3=0xc8;}else{_0x5150e3=0xce;}_0x8cf9f4[_0x1d90('0x11')](_0x5150e3);return _0x8cf9f4['set']('Content-Range',_0x37dd08+'-'+_0x186395+'/'+_0x1b53f5)['json'](_0x2e1be5);}return null;};}function saveUpdates(_0x44b496){return function(_0x59625a){if(_0x59625a){return _0x59625a[_0x1d90('0x16')](_0x44b496)[_0x1d90('0x17')](function(_0xcf9788){return _0xcf9788;});}return null;};}function removeEntity(_0x56e133){return function(_0x1f40e4){if(_0x1f40e4){return _0x1f40e4['destroy']()['then'](function(){_0x56e133[_0x1d90('0x11')](0xcc)[_0x1d90('0x18')]();});}};}function handleEntityNotFound(_0x4fae5d){return function(_0x3e20fb){if(!_0x3e20fb){_0x4fae5d[_0x1d90('0x19')](0x194);}return _0x3e20fb;};}function handleError(_0x42b6ca,_0x3c8e7d){_0x3c8e7d=_0x3c8e7d||0x1f4;return function(_0x3a5c0c){logger[_0x1d90('0x1a')](_0x3a5c0c[_0x1d90('0x1b')]);if(_0x3a5c0c[_0x1d90('0x1c')]){delete _0x3a5c0c[_0x1d90('0x1c')];}_0x42b6ca[_0x1d90('0x11')](_0x3c8e7d)[_0x1d90('0x1d')](_0x3a5c0c);};}exports['index']=function(_0x53c73a,_0x15dc6c){var _0x329457={};var _0x107e02=_['map'](db[_0x1d90('0x1e')][_0x1d90('0x1f')],function(_0x324d76){return{'name':_0x324d76[_0x1d90('0x20')],'type':_0x324d76[_0x1d90('0x21')][_0x1d90('0x22')]};});_0x329457=qs[_0x1d90('0x23')](_0x107e02,_0x53c73a);return interaction[_0x1d90('0x24')]('fax',_0x53c73a[_0x1d90('0x25')],_0x53c73a[_0x1d90('0x26')],_0x329457,_0x107e02)[_0x1d90('0x17')](respondWithFilteredResult(_0x15dc6c,_0x329457))[_0x1d90('0x27')](handleError(_0x15dc6c,null));};exports['show']=function(_0x3b4637,_0x3d329b){var _0x40a26e={'raw':![],'where':{'id':_0x3b4637[_0x1d90('0x28')]['id']}},_0x456c4c={};_0x456c4c[_0x1d90('0x29')]=_['keys'](db[_0x1d90('0x1e')]['rawAttributes']);_0x456c4c['query']=_['keys'](_0x3b4637[_0x1d90('0x25')]);_0x456c4c[_0x1d90('0x2a')]=_['intersection'](_0x456c4c[_0x1d90('0x29')],_0x456c4c[_0x1d90('0x25')]);_0x40a26e[_0x1d90('0x2b')]=_[_0x1d90('0x2c')](_0x456c4c[_0x1d90('0x29')],qs[_0x1d90('0x2d')](_0x3b4637[_0x1d90('0x25')]['fields']));_0x40a26e[_0x1d90('0x2b')]=_0x40a26e[_0x1d90('0x2b')][_0x1d90('0x2e')]?_0x40a26e[_0x1d90('0x2b')]:_0x456c4c[_0x1d90('0x29')];if(_0x3b4637[_0x1d90('0x25')][_0x1d90('0x2f')]){_0x40a26e[_0x1d90('0x30')]=[{'all':!![]}];}_0x40a26e=_[_0x1d90('0x31')]({},_0x40a26e,_0x3b4637[_0x1d90('0x32')]);return db[_0x1d90('0x1e')]['find'](_0x40a26e)[_0x1d90('0x17')](handleEntityNotFound(_0x3d329b,null))[_0x1d90('0x17')](respondWithResult(_0x3d329b,null))[_0x1d90('0x27')](handleError(_0x3d329b,null));};exports[_0x1d90('0x33')]=function(_0x4ee3f7,_0x52e1b4){return db[_0x1d90('0x1e')][_0x1d90('0x33')](_0x4ee3f7['body'],{})[_0x1d90('0x17')](respondWithResult(_0x52e1b4,0xc9))[_0x1d90('0x27')](handleError(_0x52e1b4,null));};exports[_0x1d90('0x16')]=function(_0x3d9473,_0x41ec49){if(_0x3d9473[_0x1d90('0x34')]['id']){delete _0x3d9473[_0x1d90('0x34')]['id'];}return db[_0x1d90('0x1e')][_0x1d90('0x35')]({'where':{'id':_0x3d9473[_0x1d90('0x28')]['id']}})[_0x1d90('0x17')](handleEntityNotFound(_0x41ec49,null))['then'](saveUpdates(_0x3d9473[_0x1d90('0x34')],null))[_0x1d90('0x17')](respondWithResult(_0x41ec49,null))[_0x1d90('0x27')](handleError(_0x41ec49,null));};exports[_0x1d90('0x36')]=function(_0x58aed4,_0x596680){return db[_0x1d90('0x1e')]['find']({'where':{'id':_0x58aed4[_0x1d90('0x28')]['id']}})[_0x1d90('0x17')](handleEntityNotFound(_0x596680,null))[_0x1d90('0x17')](removeEntity(_0x596680,null))['catch'](handleError(_0x596680,null));};exports[_0x1d90('0x37')]=function(_0x3875a9,_0x22815f){return db[_0x1d90('0x1e')][_0x1d90('0x37')]()[_0x1d90('0x17')](respondWithResult(_0x22815f,null))[_0x1d90('0x27')](handleError(_0x22815f,null));};exports[_0x1d90('0x38')]=function(_0x48e8e5,_0x364b10){return db[_0x1d90('0x39')][_0x1d90('0x35')]({'where':{'id':_0x48e8e5[_0x1d90('0x28')]['id']}})[_0x1d90('0x17')](handleEntityNotFound(_0x364b10,null))[_0x1d90('0x17')](function(_0x19369f){if(_0x19369f){return _0x19369f[_0x1d90('0x38')](_0x48e8e5[_0x1d90('0x34')][_0x1d90('0x3a')],_[_0x1d90('0x3b')](_0x48e8e5[_0x1d90('0x34')],[_0x1d90('0x3a'),'id'])||{});}})[_0x1d90('0x17')](respondWithResult(_0x364b10,null))[_0x1d90('0x27')](handleError(_0x364b10,null));};exports[_0x1d90('0x3c')]=function(_0x2b0d77,_0x3e40b1){var _0x3b3ded={'raw':![],'where':{}};var _0x5a1f1a={};var _0x3807b3={'count':0x0,'rows':[]};return db[_0x1d90('0x1e')][_0x1d90('0x3d')]({'where':{'id':_0x2b0d77[_0x1d90('0x28')]['id']}})[_0x1d90('0x17')](handleEntityNotFound(_0x3e40b1,null))[_0x1d90('0x17')](function(_0x14f7c2){if(_0x14f7c2){_0x5a1f1a['model']=_[_0x1d90('0x3e')](db[_0x1d90('0x39')][_0x1d90('0x1f')]);_0x5a1f1a[_0x1d90('0x25')]=_[_0x1d90('0x3e')](_0x2b0d77['query']);_0x5a1f1a[_0x1d90('0x2a')]=_[_0x1d90('0x2c')](_0x5a1f1a[_0x1d90('0x29')],_0x5a1f1a[_0x1d90('0x25')]);_0x3b3ded[_0x1d90('0x2b')]=_[_0x1d90('0x2c')](_0x5a1f1a[_0x1d90('0x29')],qs['fields'](_0x2b0d77[_0x1d90('0x25')]['fields']));_0x3b3ded[_0x1d90('0x2b')]=_0x3b3ded[_0x1d90('0x2b')][_0x1d90('0x2e')]?_0x3b3ded[_0x1d90('0x2b')]:_0x5a1f1a[_0x1d90('0x29')];if(!_0x2b0d77[_0x1d90('0x25')][_0x1d90('0x3f')]('nolimit')){_0x3b3ded[_0x1d90('0x40')]=qs['limit'](_0x2b0d77['query'][_0x1d90('0x40')]);_0x3b3ded[_0x1d90('0x15')]=qs[_0x1d90('0x15')](_0x2b0d77[_0x1d90('0x25')]['offset']);}_0x3b3ded[_0x1d90('0x41')]=qs[_0x1d90('0x42')](_0x2b0d77[_0x1d90('0x25')][_0x1d90('0x42')]);_0x3b3ded[_0x1d90('0x43')]=qs['filters'](_['pick'](_0x2b0d77[_0x1d90('0x25')],_0x5a1f1a[_0x1d90('0x2a')]));_0x3b3ded[_0x1d90('0x43')][_0x1d90('0x44')]=_0x14f7c2['id'];if(_0x2b0d77[_0x1d90('0x25')]['filter']){_0x3b3ded[_0x1d90('0x43')]=_[_0x1d90('0x31')](_0x3b3ded[_0x1d90('0x43')],{'$or':_['map'](_0x3b3ded[_0x1d90('0x2b')],function(_0x3004dd){var _0x197eb0={};_0x197eb0[_0x3004dd]={'$like':'%'+_0x2b0d77[_0x1d90('0x25')]['filter']+'%'};return _0x197eb0;})});}if(_0x2b0d77[_0x1d90('0x25')][_0x1d90('0x45')]){var _0x2a1cea=_0x2b0d77[_0x1d90('0x25')][_0x1d90('0x45')][_0x1d90('0x46')](',');var _0x2fc5f9={};_0x2fc5f9[_0x2a1cea[0x0]]={'$gte':moment(_0x2a1cea[0x1])['format'](_0x1d90('0x47'))};_0x3b3ded[_0x1d90('0x43')]=_[_0x1d90('0x31')](_0x3b3ded[_0x1d90('0x43')],_0x2fc5f9);}_0x3b3ded=_[_0x1d90('0x31')]({},_0x3b3ded,_0x2b0d77[_0x1d90('0x32')]);return db[_0x1d90('0x39')][_0x1d90('0x14')]({'where':_0x3b3ded['where']})[_0x1d90('0x17')](function(_0x3bdae2){_0x3807b3[_0x1d90('0x14')]=_0x3bdae2;if(_0x2b0d77['query'][_0x1d90('0x2f')]){_0x3b3ded['include']=[{'all':!![]}];}return db[_0x1d90('0x39')][_0x1d90('0x24')](_0x3b3ded);})['then'](function(_0x1e8b33){_0x3807b3['rows']=_0x1e8b33;return _0x3807b3;});}})[_0x1d90('0x17')](respondWithFilteredResult(_0x3e40b1,_0x3b3ded))[_0x1d90('0x27')](handleError(_0x3e40b1,null));};exports['addTags']=function(_0xf49994,_0xf3bdb4){return db[_0x1d90('0x1e')]['find']({'where':{'id':_0xf49994['params']['id']}})[_0x1d90('0x17')](handleEntityNotFound(_0xf3bdb4,null))['then'](function(_0x304c53){if(_0x304c53){return _0x304c53[_0x1d90('0x48')](_0xf49994[_0x1d90('0x34')][_0x1d90('0x3a')],_[_0x1d90('0x3b')](_0xf49994[_0x1d90('0x34')],[_0x1d90('0x3a'),'id'])||{})[_0x1d90('0x49')](function(){return db[_0x1d90('0x4a')][_0x1d90('0x24')]({'attributes':['id',_0x1d90('0x1c'),_0x1d90('0x4b')],'where':{'id':_0xf49994[_0x1d90('0x34')]['ids']}});})[_0x1d90('0x17')](function(_0x1780eb){socket[_0x1d90('0x4c')](_0x1d90('0x4d'),{'id':Number(_0xf49994[_0x1d90('0x28')]['id']),'tags':_0x1780eb||[]});return{'id':Number(_0xf49994[_0x1d90('0x28')]['id']),'tags':_0x1780eb||[]};});}})[_0x1d90('0x17')](respondWithResult(_0xf3bdb4,null))[_0x1d90('0x27')](handleError(_0xf3bdb4,null));};exports[_0x1d90('0x4e')]=function(_0x5ba307,_0x56f6b0){return db[_0x1d90('0x1e')][_0x1d90('0x35')]({'where':{'id':_0x5ba307[_0x1d90('0x28')]['id']}})['then'](handleEntityNotFound(_0x56f6b0,null))['then'](function(_0x512523){if(_0x512523){return _0x512523[_0x1d90('0x4e')](_0x5ba307[_0x1d90('0x25')]['ids']);}})['then'](respondWithStatusCode(_0x56f6b0,null))[_0x1d90('0x27')](handleError(_0x56f6b0,null));};exports[_0x1d90('0x4f')]=function(_0x58fc69,_0x34dd83){var _0x1079e3=moment()[_0x1d90('0x50')]()[_0x1d90('0x51')]();var _0xbaed6c=path[_0x1d90('0x52')](config[_0x1d90('0x53')],_0x1d90('0x54'),'files',_0x1d90('0x55'));var _0x65580d=path['join'](config[_0x1d90('0x53')],_0x1d90('0x54'),_0x1d90('0x56'),'attachments');var _0x45818c=path[_0x1d90('0x52')](_0xbaed6c,_0x1079e3);var _0x4d200f=util[_0x1d90('0x57')]('transcript-%d-%s.zip',_0x58fc69['params']['id'],_0x1079e3);var _0x4f899e=path[_0x1d90('0x52')](_0xbaed6c,_0x4d200f);var _0x205410=[];_0x205410[_0x1d90('0x58')]({'model':db[_0x1d90('0x59')],'as':_0x1d90('0x59'),'raw':!![]});var _0x554c99=[{'model':db[_0x1d90('0x39')],'as':_0x1d90('0x5a'),'attributes':['id',_0x1d90('0x34'),'createdAt'],'include':_0x205410}];return db[_0x1d90('0x1e')][_0x1d90('0x35')]({'where':{'id':_0x58fc69['params']['id']},'include':_0x554c99})['then'](handleEntityNotFound(_0x34dd83,null))[_0x1d90('0x17')](function(_0x5505f8){if(_0x5505f8&&_0x5505f8['Messages']){var _0x206cec=_0x5505f8['get']({'plain':!![]});fs[_0x1d90('0x5b')](_0x45818c);for(var _0x1dd042=0x0;_0x1dd042<_0x206cec[_0x1d90('0x5a')]['length'];_0x1dd042++){var _0x3daf17=_0x206cec[_0x1d90('0x5a')][_0x1dd042][_0x1d90('0x59')];if(_0x3daf17){var _0x4ba36c=path[_0x1d90('0x52')](_0x65580d,_0x3daf17[_0x1d90('0x5c')]);if(fs[_0x1d90('0x5d')](_0x4ba36c)){fs['createReadStream'](_0x4ba36c)[_0x1d90('0x5e')](fs['createWriteStream'](path[_0x1d90('0x52')](_0x45818c,_0x3daf17[_0x1d90('0x5c')])));}}}return BPromise['resolve']()[_0x1d90('0x17')](function(){return new BPromise(function(_0x2ad1a0,_0x4100d4){zipdir(_0x45818c,{'saveTo':_0x4f899e},function(_0x79114b,_0x43f8a3){if(_0x79114b)return _0x4100d4(_0x79114b);return _0x2ad1a0(_0x43f8a3);});})[_0x1d90('0x17')](function(){return new BPromise(function(_0x559339,_0x420cc7){rimraf(_0x45818c,function(_0xe343f8){if(_0xe343f8)_0x420cc7(_0xe343f8);return _0x559339();});});})[_0x1d90('0x17')](function(){return _0x34dd83[_0x1d90('0x4f')](_0x4f899e,_0x4d200f,function(_0x1cce55){if(_0x1cce55){console[_0x1d90('0x5f')](_0x1d90('0x60'),_0x1cce55);}else{fs[_0x1d90('0x61')](_0x4f899e);}});});});}else{return _0x34dd83['sendStatus'](0xc8);}})[_0x1d90('0x27')](handleError(_0x34dd83,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 272821a..763b9a5 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 _0xabac=['then','Users','map','unreadMessages','length','emit','catch','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x397b18,_0xafff91){var _0x519a6f=function(_0xc61a73){while(--_0xc61a73){_0x397b18['push'](_0x397b18['shift']());}};_0x519a6f(++_0xafff91);}(_0xabac,0x158));var _0xcaba=function(_0x5c6361,_0x55c253){_0x5c6361=_0x5c6361-0x0;var _0x40729f=_0xabac[_0x5c6361];return _0x40729f;};'use strict';var EventEmitter=require(_0xcaba('0x0'));var FaxInteraction=require(_0xcaba('0x1'))['db'][_0xcaba('0x2')];var FaxMessage=require(_0xcaba('0x1'))['db'][_0xcaba('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xcaba('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcaba('0x5'),'afterDestroy':_0xcaba('0x6')};function emitEvent(_0x367715){return function(_0x495d18,_0x3e18e0,_0x120b8f){_0x495d18[_0xcaba('0x7')]({'attributes':['id'],'raw':!![]})[_0xcaba('0x8')](function(_0x9fa50b){_0x495d18['setDataValue'](_0xcaba('0x9'),_0x9fa50b[_0xcaba('0xa')](function(_0x1fd0ef){return{'id':_0x1fd0ef['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x495d18['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd03c0e){_0x495d18['setDataValue'](_0xcaba('0xb'),_0xd03c0e[_0xcaba('0xc')]);FaxInteractionEvents[_0xcaba('0xd')](_0x367715+':'+_0x495d18['id'],_0x495d18);FaxInteractionEvents[_0xcaba('0xd')](_0x367715,_0x495d18);_0x120b8f(null);})[_0xcaba('0xe')](_0x120b8f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xcaba('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x4e8b=['emit','catch','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','length'];(function(_0x3cfbc4,_0x592078){var _0x5a8f5e=function(_0x3b0f8c){while(--_0x3b0f8c){_0x3cfbc4['push'](_0x3cfbc4['shift']());}};_0x5a8f5e(++_0x592078);}(_0x4e8b,0x1b4));var _0xb4e8=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x4e8b[_0x34325b];return _0x3da348;};'use strict';var EventEmitter=require(_0xb4e8('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xb4e8('0x1')];var FaxMessage=require(_0xb4e8('0x2'))['db'][_0xb4e8('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb4e8('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb4e8('0x5')};function emitEvent(_0x5723f6){return function(_0x513660,_0x12401f,_0x67f881){_0x513660[_0xb4e8('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1171c3){_0x513660['setDataValue'](_0xb4e8('0x7'),_0x1171c3[_0xb4e8('0x8')](function(_0x423dc7){return{'id':_0x423dc7['id']};}));return FaxMessage[_0xb4e8('0x9')]({'where':{'FaxInteractionId':_0x513660['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4e8('0xa')](function(_0x57617e){_0x513660[_0xb4e8('0xb')](_0xb4e8('0xc'),_0x57617e[_0xb4e8('0xd')]);FaxInteractionEvents[_0xb4e8('0xe')](_0x5723f6+':'+_0x513660['id'],_0x513660);FaxInteractionEvents[_0xb4e8('0xe')](_0x5723f6,_0x513660);_0x67f881(null);})[_0xb4e8('0xf')](_0x67f881(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xb4e8('0x10')](e,emitEvent(event));}}module[_0xb4e8('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 089f66e..ccbd53f 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 _0x0fdc=['path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird'];(function(_0x295a63,_0x2f3216){var _0x2495d4=function(_0xf4645f){while(--_0xf4645f){_0x295a63['push'](_0x295a63['shift']());}};_0x2495d4(++_0x2f3216);}(_0x0fdc,0xeb));var _0xc0fd=function(_0x118355,_0x201311){_0x118355=_0x118355-0x0;var _0x32f7ea=_0x0fdc[_0x118355];return _0x32f7ea;};'use strict';var _=require('lodash');var util=require(_0xc0fd('0x0'));var logger=require('../../config/logger')(_0xc0fd('0x1'));var moment=require('moment');var BPromise=require(_0xc0fd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0fd('0x3'));var rimraf=require(_0xc0fd('0x4'));var config=require('../../config/environment');var attributes=require(_0xc0fd('0x5'));module[_0xc0fd('0x6')]=function(_0x397674,_0x2d013e){return _0x397674[_0xc0fd('0x7')](_0xc0fd('0x8'),attributes,{'tableName':_0xc0fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55aee0,_0x395296,_0x2ccec2){if(_0x55aee0[_0xc0fd('0xa')](_0xc0fd('0xb'))){_0x55aee0[_0xc0fd('0xc')]=moment()['format'](_0xc0fd('0xd'));}_0x2ccec2(null,_0x55aee0);}}});}; \ No newline at end of file +var _0xed83=['format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','FaxInteraction','fax_interactions','closed'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0xed83,0x160));var _0x3ed8=function(_0x579fda,_0x35afa7){_0x579fda=_0x579fda-0x0;var _0x40054f=_0xed83[_0x579fda];return _0x40054f;};'use strict';var _=require('lodash');var util=require(_0x3ed8('0x0'));var logger=require(_0x3ed8('0x1'))(_0x3ed8('0x2'));var moment=require(_0x3ed8('0x3'));var BPromise=require(_0x3ed8('0x4'));var rp=require(_0x3ed8('0x5'));var fs=require('fs');var path=require(_0x3ed8('0x6'));var rimraf=require(_0x3ed8('0x7'));var config=require(_0x3ed8('0x8'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x38eed7,_0x3e9436){return _0x38eed7['define'](_0x3ed8('0x9'),attributes,{'tableName':_0x3ed8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40f21c,_0x3b87d9,_0x4a7f85){if(_0x40f21c['changed'](_0x3ed8('0xb'))){_0x40f21c['closedAt']=moment()[_0x3ed8('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4a7f85(null,_0x40f21c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index bf665bd..f35eb4a 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 _0x6a38=['localhost','./faxInteraction.socket','register','request','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','find','addTags','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x6a38,0x164));var _0x86a3=function(_0x12a66f,_0x3ca46d){_0x12a66f=_0x12a66f-0x0;var _0x38004d=_0x6a38[_0x12a66f];return _0x38004d;};'use strict';var _=require(_0x86a3('0x0'));var util=require(_0x86a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x86a3('0x2'));var fs=require('fs');var Redis=require(_0x86a3('0x3'));var db=require(_0x86a3('0x4'))['db'];var utils=require(_0x86a3('0x5'));var logger=require('../../config/logger')(_0x86a3('0x6'));var config=require(_0x86a3('0x7'));var jayson=require(_0x86a3('0x8'));var client=jayson[_0x86a3('0x9')][_0x86a3('0xa')]({'port':0x232a});config['redis']=_[_0x86a3('0xb')](config[_0x86a3('0xc')],{'host':_0x86a3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x86a3('0xe'))[_0x86a3('0xf')](socket);function respondWithRpcPromise(_0x5a2661,_0x52b3ec,_0x3857a8){return new BPromise(function(_0x405d97,_0xaa1213){return client[_0x86a3('0x10')](_0x5a2661,_0x3857a8)['then'](function(_0x6f829f){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x52b3ec,_0x86a3('0x11'));logger[_0x86a3('0x12')](_0x86a3('0x13'),_0x52b3ec,_0x86a3('0x11'),JSON[_0x86a3('0x14')](_0x6f829f));if(_0x6f829f[_0x86a3('0x15')]){if(_0x6f829f[_0x86a3('0x15')][_0x86a3('0x16')]===0x1f4){logger[_0x86a3('0x15')](_0x86a3('0x17'),_0x52b3ec,_0x6f829f[_0x86a3('0x15')]['message']);return _0xaa1213(_0x6f829f[_0x86a3('0x15')][_0x86a3('0x18')]);}logger[_0x86a3('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x52b3ec,_0x6f829f[_0x86a3('0x15')][_0x86a3('0x18')]);return _0x405d97(_0x6f829f['error'][_0x86a3('0x18')]);}else{logger[_0x86a3('0x19')](_0x86a3('0x17'),_0x52b3ec,_0x86a3('0x11'));_0x405d97(_0x6f829f[_0x86a3('0x1a')]['message']);}})[_0x86a3('0x1b')](function(_0x41401e){logger[_0x86a3('0x15')](_0x86a3('0x17'),_0x52b3ec,_0x41401e);_0xaa1213(_0x41401e);});});}exports[_0x86a3('0x1c')]=function(_0x281888){var _0x1d9b89=this;return new Promise(function(_0x3eb2f3,_0x17d399){return db[_0x86a3('0x1d')][_0x86a3('0x1e')](_0x281888[_0x86a3('0x1f')],{'raw':_0x281888['options']?_0x281888[_0x86a3('0x20')][_0x86a3('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x281888[_0x86a3('0x20')]?_0x281888[_0x86a3('0x20')][_0x86a3('0x22')]||null:null,'attributes':_0x281888[_0x86a3('0x20')]?_0x281888['options'][_0x86a3('0x23')]||null:null,'limit':_0x281888[_0x86a3('0x20')]?_0x281888[_0x86a3('0x20')]['limit']||null:null})['then'](function(_0x250ed8){logger[_0x86a3('0x19')](_0x86a3('0x1c'),_0x281888);logger[_0x86a3('0x12')]('UpdateFaxInteraction',_0x281888,JSON['stringify'](_0x250ed8));_0x3eb2f3(_0x250ed8);})['catch'](function(_0x51cf0e){logger['error'](_0x86a3('0x1c'),_0x51cf0e[_0x86a3('0x18')],_0x281888);_0x17d399(_0x1d9b89['error'](0x1f4,_0x51cf0e[_0x86a3('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5ad938){return new Promise(function(_0xbfdc99,_0x2aa66a){return db[_0x86a3('0x1d')][_0x86a3('0x24')]({'where':_0x5ad938[_0x86a3('0x20')]?_0x5ad938['options']['where']||null:null})['then'](function(_0x500c13){if(_0x500c13){return _0x500c13[_0x86a3('0x25')](_0x5ad938['body'][_0x86a3('0x26')],_['omit'](_0x5ad938[_0x86a3('0x1f')],['ids','id'])||{});}})[_0x86a3('0x27')](function(_0x519e5d){logger[_0x86a3('0x19')]('AddTags',_0x5ad938);logger[_0x86a3('0x12')](_0x86a3('0x28'),_0x5ad938,JSON[_0x86a3('0x14')](_0x519e5d));_0xbfdc99(_0x519e5d);})[_0x86a3('0x1b')](function(_0x2e5d57){logger[_0x86a3('0x15')](_0x86a3('0x28'),_0x2e5d57[_0x86a3('0x18')],_0x5ad938);_0x2aa66a(_this[_0x86a3('0x15')](0x1f4,_0x2e5d57[_0x86a3('0x18')]));});});}; \ No newline at end of file +var _0x2686=['options','where','attributes','limit','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','debug','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body'];(function(_0x4470c0,_0x5b9cd1){var _0x2c079a=function(_0x1a91c5){while(--_0x1a91c5){_0x4470c0['push'](_0x4470c0['shift']());}};_0x2c079a(++_0x5b9cd1);}(_0x2686,0x76));var _0x6268=function(_0x22706b,_0x226d14){_0x22706b=_0x22706b-0x0;var _0x1fa04a=_0x2686[_0x22706b];return _0x1fa04a;};'use strict';var _=require('lodash');var util=require(_0x6268('0x0'));var moment=require('moment');var BPromise=require(_0x6268('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6268('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6268('0x3'));var logger=require(_0x6268('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6268('0x5'));var client=jayson[_0x6268('0x6')][_0x6268('0x7')]({'port':0x232a});config[_0x6268('0x8')]=_[_0x6268('0x9')](config[_0x6268('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6268('0x8')]));require(_0x6268('0xa'))[_0x6268('0xb')](socket);function respondWithRpcPromise(_0x25c45d,_0x23cd30,_0x532826){return new BPromise(function(_0x200f1b,_0x421ab9){return client['request'](_0x25c45d,_0x532826)[_0x6268('0xc')](function(_0x4bfe1b){logger[_0x6268('0xd')](_0x6268('0xe'),_0x23cd30,_0x6268('0xf'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x23cd30,_0x6268('0xf'),JSON[_0x6268('0x10')](_0x4bfe1b));if(_0x4bfe1b['error']){if(_0x4bfe1b['error'][_0x6268('0x11')]===0x1f4){logger[_0x6268('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x23cd30,_0x4bfe1b[_0x6268('0x12')][_0x6268('0x13')]);return _0x421ab9(_0x4bfe1b['error'][_0x6268('0x13')]);}logger[_0x6268('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x23cd30,_0x4bfe1b[_0x6268('0x12')][_0x6268('0x13')]);return _0x200f1b(_0x4bfe1b[_0x6268('0x12')][_0x6268('0x13')]);}else{logger[_0x6268('0xd')]('FaxInteraction,\x20%s,\x20%s',_0x23cd30,'request\x20sent');_0x200f1b(_0x4bfe1b[_0x6268('0x14')][_0x6268('0x13')]);}})[_0x6268('0x15')](function(_0x577b0c){logger['error'](_0x6268('0xe'),_0x23cd30,_0x577b0c);_0x421ab9(_0x577b0c);});});}exports[_0x6268('0x16')]=function(_0x424a80){var _0x1bb674=this;return new Promise(function(_0x58ff3b,_0x305b88){return db[_0x6268('0x17')][_0x6268('0x18')](_0x424a80[_0x6268('0x19')],{'raw':_0x424a80[_0x6268('0x1a')]?_0x424a80[_0x6268('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x424a80[_0x6268('0x1a')]?_0x424a80[_0x6268('0x1a')][_0x6268('0x1b')]||null:null,'attributes':_0x424a80['options']?_0x424a80[_0x6268('0x1a')][_0x6268('0x1c')]||null:null,'limit':_0x424a80[_0x6268('0x1a')]?_0x424a80[_0x6268('0x1a')][_0x6268('0x1d')]||null:null})[_0x6268('0xc')](function(_0x1abe44){logger['info']('UpdateFaxInteraction',_0x424a80);logger['debug']('UpdateFaxInteraction',_0x424a80,JSON['stringify'](_0x1abe44));_0x58ff3b(_0x1abe44);})[_0x6268('0x15')](function(_0x2dc7ca){logger[_0x6268('0x12')](_0x6268('0x16'),_0x2dc7ca[_0x6268('0x13')],_0x424a80);_0x305b88(_0x1bb674[_0x6268('0x12')](0x1f4,_0x2dc7ca[_0x6268('0x13')]));});});};exports[_0x6268('0x1e')]=function(_0x47a7eb){return new Promise(function(_0x2ac497,_0x40e006){return db[_0x6268('0x17')]['find']({'where':_0x47a7eb[_0x6268('0x1a')]?_0x47a7eb['options'][_0x6268('0x1b')]||null:null})[_0x6268('0xc')](function(_0x4f0ba2){if(_0x4f0ba2){return _0x4f0ba2[_0x6268('0x1f')](_0x47a7eb[_0x6268('0x19')][_0x6268('0x20')],_[_0x6268('0x21')](_0x47a7eb['body'],[_0x6268('0x20'),'id'])||{});}})['spread'](function(_0x49fa7b){logger[_0x6268('0xd')](_0x6268('0x22'),_0x47a7eb);logger[_0x6268('0x23')]('AddTags',_0x47a7eb,JSON[_0x6268('0x10')](_0x49fa7b));_0x2ac497(_0x49fa7b);})[_0x6268('0x15')](function(_0x408466){logger[_0x6268('0x12')]('AddTags',_0x408466[_0x6268('0x13')],_0x47a7eb);_0x40e006(_this[_0x6268('0x12')](0x1f4,_0x408466[_0x6268('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 026995a..c8b21d7 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 _0x8c92=['./faxInteraction.events','save','update','removeListener','register','length','faxInteraction:'];(function(_0x5b174b,_0x404869){var _0x47ee37=function(_0x467947){while(--_0x467947){_0x5b174b['push'](_0x5b174b['shift']());}};_0x47ee37(++_0x404869);}(_0x8c92,0xbd));var _0x28c9=function(_0x218188,_0x579fe4){_0x218188=_0x218188-0x0;var _0x99e9fb=_0x8c92[_0x218188];return _0x99e9fb;};'use strict';var FaxInteractionEvents=require(_0x28c9('0x0'));var events=[_0x28c9('0x1'),'remove',_0x28c9('0x2')];function createListener(_0x2194cc,_0x15f1b9){return function(_0x1b596c){_0x15f1b9['emit'](_0x2194cc,_0x1b596c);};}function removeListener(_0x5535af,_0x2a35fc){return function(){FaxInteractionEvents[_0x28c9('0x3')](_0x5535af,_0x2a35fc);};}exports[_0x28c9('0x4')]=function(_0x5d1812){for(var _0x4e61c1=0x0,_0xd0b0db=events[_0x28c9('0x5')];_0x4e61c1<_0xd0b0db;_0x4e61c1++){var _0x527d5c=events[_0x4e61c1];var _0x5179c1=createListener(_0x28c9('0x6')+_0x527d5c,_0x5d1812);FaxInteractionEvents['on'](_0x527d5c,_0x5179c1);}}; \ No newline at end of file +var _0xa5aa=['update','emit','removeListener','length','faxInteraction:','save','remove'];(function(_0x4c88f2,_0x1a907a){var _0x21998c=function(_0x5b91d8){while(--_0x5b91d8){_0x4c88f2['push'](_0x4c88f2['shift']());}};_0x21998c(++_0x1a907a);}(_0xa5aa,0x1e1));var _0xaa5a=function(_0x1b1846,_0x30b595){_0x1b1846=_0x1b1846-0x0;var _0xf566cf=_0xa5aa[_0x1b1846];return _0xf566cf;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xaa5a('0x0'),_0xaa5a('0x1'),_0xaa5a('0x2')];function createListener(_0x4c586a,_0x5cc6a5){return function(_0x256073){_0x5cc6a5[_0xaa5a('0x3')](_0x4c586a,_0x256073);};}function removeListener(_0x39f922,_0x138022){return function(){FaxInteractionEvents[_0xaa5a('0x4')](_0x39f922,_0x138022);};}exports['register']=function(_0x1482ef){for(var _0x374fe0=0x0,_0x398f30=events[_0xaa5a('0x5')];_0x374fe0<_0x398f30;_0x374fe0++){var _0x4ca6c7=events[_0x374fe0];var _0x300b2d=createListener(_0xaa5a('0x6')+_0x4ca6c7,_0x1482ef);FaxInteractionEvents['on'](_0x4ca6c7,_0x300b2d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 83ef6ea..984efd6 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 _0xbc6c=['download','post','create','addMessage','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x13a9a7,_0x233f9c){var _0x20fd81=function(_0x27dff8){while(--_0x27dff8){_0x13a9a7['push'](_0x13a9a7['shift']());}};_0x20fd81(++_0x233f9c);}(_0xbc6c,0x1b1));var _0xcbc6=function(_0x5641b3,_0x1ad344){_0x5641b3=_0x5641b3-0x0;var _0x190cbf=_0xbc6c[_0x5641b3];return _0x190cbf;};'use strict';var multer=require('multer');var util=require(_0xcbc6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbc6('0x1'));var router=express[_0xcbc6('0x2')]();var fs_extra=require(_0xcbc6('0x3'));var auth=require(_0xcbc6('0x4'));var interaction=require(_0xcbc6('0x5'));var config=require(_0xcbc6('0x6'));var controller=require('./faxInteraction.controller');router[_0xcbc6('0x7')]('/',auth['isAuthenticated'](),controller[_0xcbc6('0x8')]);router[_0xcbc6('0x7')](_0xcbc6('0x9'),auth[_0xcbc6('0xa')](),controller[_0xcbc6('0xb')]);router[_0xcbc6('0x7')](_0xcbc6('0xc'),auth[_0xcbc6('0xa')](),controller[_0xcbc6('0xd')]);router[_0xcbc6('0x7')](_0xcbc6('0xe'),auth[_0xcbc6('0xa')](),controller[_0xcbc6('0xf')]);router[_0xcbc6('0x7')](_0xcbc6('0x10'),auth[_0xcbc6('0xa')](),controller[_0xcbc6('0x11')]);router[_0xcbc6('0x12')]('/',auth[_0xcbc6('0xa')](),controller[_0xcbc6('0x13')]);router[_0xcbc6('0x12')](_0xcbc6('0xe'),auth['isAuthenticated'](),controller[_0xcbc6('0x14')]);router[_0xcbc6('0x12')](_0xcbc6('0x15'),auth[_0xcbc6('0xa')](),interaction[_0xcbc6('0x16')](_0xcbc6('0x17'),'faxinteraction:addtags'),controller[_0xcbc6('0x18')]);router[_0xcbc6('0x19')]('/:id',auth[_0xcbc6('0xa')](),interaction[_0xcbc6('0x16')](_0xcbc6('0x17'),_0xcbc6('0x1a')),controller[_0xcbc6('0x1b')]);router['delete'](_0xcbc6('0xc'),auth['isAuthenticated'](),interaction[_0xcbc6('0x16')](_0xcbc6('0x17'),'faxinteraction:destroy'),controller['destroy']);router[_0xcbc6('0x1c')](_0xcbc6('0x15'),auth['isAuthenticated'](),controller['removeTags']);module[_0xcbc6('0x1d')]=router; \ No newline at end of file +var _0xb18e=['isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','removeTags','exports','path','express','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xb18e,0x181));var _0xeb18=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0xb18e[_0x1fcf1b];return _0x5d2952;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb18('0x0'));var timeout=require('connect-timeout');var express=require(_0xeb18('0x1'));var router=express['Router']();var fs_extra=require(_0xeb18('0x2'));var auth=require(_0xeb18('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeb18('0x4'));var controller=require(_0xeb18('0x5'));router[_0xeb18('0x6')]('/',auth[_0xeb18('0x7')](),controller[_0xeb18('0x8')]);router[_0xeb18('0x6')]('/describe',auth[_0xeb18('0x7')](),controller[_0xeb18('0x9')]);router['get'](_0xeb18('0xa'),auth[_0xeb18('0x7')](),controller[_0xeb18('0xb')]);router[_0xeb18('0x6')](_0xeb18('0xc'),auth[_0xeb18('0x7')](),controller[_0xeb18('0xd')]);router[_0xeb18('0x6')](_0xeb18('0xe'),auth[_0xeb18('0x7')](),controller['download']);router[_0xeb18('0xf')]('/',auth[_0xeb18('0x7')](),controller['create']);router[_0xeb18('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0xeb18('0x10')]);router[_0xeb18('0xf')](_0xeb18('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0xeb18('0x12'),_0xeb18('0x13')),controller['addTags']);router[_0xeb18('0x14')](_0xeb18('0xa'),auth[_0xeb18('0x7')](),interaction['tracked'](_0xeb18('0x12'),_0xeb18('0x15')),controller[_0xeb18('0x16')]);router[_0xeb18('0x17')](_0xeb18('0xa'),auth[_0xeb18('0x7')](),interaction[_0xeb18('0x18')]('fax',_0xeb18('0x19')),controller['destroy']);router[_0xeb18('0x17')](_0xeb18('0x11'),auth[_0xeb18('0x7')](),controller[_0xeb18('0x1a')]);module[_0xeb18('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7d16ca7..27b1af9 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 _0x56e6=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x460e1d,_0x5f4f26){var _0x38f39e=function(_0x3f808e){while(--_0x3f808e){_0x460e1d['push'](_0x460e1d['shift']());}};_0x38f39e(++_0x5f4f26);}(_0x56e6,0x6b));var _0x656e=function(_0x3688ac,_0x20c67a){_0x3688ac=_0x3688ac-0x0;var _0x376fb0=_0x56e6[_0x3688ac];return _0x376fb0;};'use strict';var Sequelize=require(_0x656e('0x0'));module[_0x656e('0x1')]={'body':{'type':Sequelize[_0x656e('0x2')](_0x656e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x656e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x656e('0x5')]('in','out'),'defaultValue':_0x656e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x656e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x656e('0x7')]}}; \ No newline at end of file +var _0x31c2=['TEXT','DATE','sequelize','medium','BOOLEAN','out'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x31c2,0x98));var _0x231c=function(_0x8b8a7e,_0x2a1852){_0x8b8a7e=_0x8b8a7e-0x0;var _0x49e8c7=_0x31c2[_0x8b8a7e];return _0x49e8c7;};'use strict';var Sequelize=require(_0x231c('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x231c('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x231c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x231c('0x3')),'defaultValue':_0x231c('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x231c('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x231c('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8447ea5..9fc9bed 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 _0x8868=['readAt','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','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','SELECT','contact','fullname','email','manual','channel','motionChannel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','QueryTypes','internal','interface','SIP/%s','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','keys','includeAll','include','find','body','params','describe','fax-interactions','accept','fax','read'];(function(_0x5cbfed,_0x2b8ba5){var _0x462d98=function(_0xf4bce9){while(--_0xf4bce9){_0x5cbfed['push'](_0x5cbfed['shift']());}};_0x462d98(++_0x2b8ba5);}(_0x8868,0x16d));var _0x8886=function(_0x48e827,_0x5c5a2c){_0x48e827=_0x48e827-0x0;var _0x1803a3=_0x8868[_0x48e827];return _0x1803a3;};'use strict';var emlformat=require(_0x8886('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8886('0x1'));var jsonpatch=require(_0x8886('0x2'));var rp=require(_0x8886('0x3'));var moment=require('moment');var BPromise=require(_0x8886('0x4'));var Mustache=require(_0x8886('0x5'));var util=require(_0x8886('0x6'));var path=require(_0x8886('0x7'));var sox=require(_0x8886('0x8'));var csv=require(_0x8886('0x9'));var ejs=require(_0x8886('0xa'));var fs=require('fs');var fs_extra=require(_0x8886('0xb'));var _=require(_0x8886('0xc'));var squel=require(_0x8886('0xd'));var crypto=require(_0x8886('0xe'));var jsforce=require(_0x8886('0xf'));var deskjs=require(_0x8886('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8886('0x11'));var Redis=require(_0x8886('0x12'));var authService=require(_0x8886('0x13'));var qs=require(_0x8886('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8886('0x15'));var logger=require(_0x8886('0x16'))(_0x8886('0x17'));var utils=require(_0x8886('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8886('0x19'));var db=require(_0x8886('0x1a'))['db'];config[_0x8886('0x1b')]=_[_0x8886('0x1c')](config[_0x8886('0x1b')],{'host':_0x8886('0x1d'),'port':0x18eb});var socket=require(_0x8886('0x1e'))(new Redis(config['redis']));require(_0x8886('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8886('0x20')][_0x8886('0x21')]({'port':0x232c});var client9002=jayson[_0x8886('0x20')][_0x8886('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1800e6,_0x3c4db9,_0x2a89a0,_0x1b19f6){return new BPromise(function(_0x158b04,_0x118137){var _0x34c9c1=_0x1b19f6||client;return _0x34c9c1['request'](_0x1800e6,_0x2a89a0)[_0x8886('0x22')](function(_0x4cf916){logger['info'](_0x8886('0x23'),_0x3c4db9,_0x8886('0x24'));logger[_0x8886('0x25')](_0x8886('0x26'),_0x3c4db9,_0x8886('0x24'),JSON[_0x8886('0x27')](_0x4cf916));if(_0x4cf916[_0x8886('0x28')]){if(_0x4cf916[_0x8886('0x28')][_0x8886('0x29')]===0x1f4){logger[_0x8886('0x28')]('FaxMessage,\x20%s,\x20%s',_0x3c4db9,_0x4cf916['error'][_0x8886('0x2a')]);return _0x118137(_0x4cf916[_0x8886('0x28')][_0x8886('0x2a')]);}logger[_0x8886('0x28')](_0x8886('0x23'),_0x3c4db9,_0x4cf916['error'][_0x8886('0x2a')]);return _0x158b04(_0x4cf916[_0x8886('0x28')][_0x8886('0x2a')]);}else{logger[_0x8886('0x2b')](_0x8886('0x23'),_0x3c4db9,_0x8886('0x24'));_0x158b04(_0x4cf916[_0x8886('0x2c')][_0x8886('0x2a')]);}})['catch'](function(_0x16adb1){logger['error'](_0x8886('0x23'),_0x3c4db9,_0x16adb1);_0x118137(_0x16adb1);});});}function respondWithStatusCode(_0x5a825d,_0x24b9e5){_0x24b9e5=_0x24b9e5||0xcc;return function(_0x3c8162){if(_0x3c8162){return _0x5a825d[_0x8886('0x2d')](_0x24b9e5);}return _0x5a825d[_0x8886('0x2e')](_0x24b9e5)[_0x8886('0x2f')]();};}function respondWithResult(_0x4f211b,_0x24f13a){_0x24f13a=_0x24f13a||0xc8;return function(_0x33e98f){if(_0x33e98f){return _0x4f211b[_0x8886('0x2e')](_0x24f13a)['json'](_0x33e98f);}};}function respondWithFilteredResult(_0x3152ec,_0x2fac34){return function(_0x10777c){if(_0x10777c){var _0x4d4609=typeof _0x2fac34[_0x8886('0x30')]==='undefined'&&typeof _0x2fac34[_0x8886('0x31')]===_0x8886('0x32');var _0x53e6e5=_0x10777c[_0x8886('0x33')];var _0x1f2bfa=_0x4d4609?0x0:_0x2fac34[_0x8886('0x30')];var _0x28aca4=_0x4d4609?_0x10777c[_0x8886('0x33')]:_0x2fac34[_0x8886('0x30')]+_0x2fac34['limit'];var _0x17b28d;if(_0x28aca4>=_0x53e6e5){_0x28aca4=_0x53e6e5;_0x17b28d=0xc8;}else{_0x17b28d=0xce;}_0x3152ec[_0x8886('0x2e')](_0x17b28d);return _0x3152ec[_0x8886('0x34')](_0x8886('0x35'),_0x1f2bfa+'-'+_0x28aca4+'/'+_0x53e6e5)[_0x8886('0x36')](_0x10777c);}return null;};}function patchUpdates(_0x73d8d7){return function(_0x46ffcb){try{jsonpatch[_0x8886('0x37')](_0x46ffcb,_0x73d8d7,!![]);}catch(_0x40b28d){return BPromise['reject'](_0x40b28d);}return _0x46ffcb[_0x8886('0x38')]();};}function saveUpdates(_0x4639ac,_0x3d715c){return function(_0x53304d){if(_0x53304d){return _0x53304d[_0x8886('0x39')](_0x4639ac)['then'](function(_0x29df78){return _0x29df78;});}return null;};}function removeEntity(_0x13fa81,_0x594e18){return function(_0x1409a8){if(_0x1409a8){return _0x1409a8[_0x8886('0x3a')]()[_0x8886('0x22')](function(){_0x13fa81[_0x8886('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf9d8e1,_0x5e241b){return function(_0xdd2a90){if(!_0xdd2a90){_0xf9d8e1[_0x8886('0x2d')](0x194);}return _0xdd2a90;};}function handleError(_0x3a310c,_0x2117fd){_0x2117fd=_0x2117fd||0x1f4;return function(_0x2f8b51){logger[_0x8886('0x28')](_0x2f8b51[_0x8886('0x3b')]);if(_0x2f8b51[_0x8886('0x3c')]){delete _0x2f8b51[_0x8886('0x3c')];}_0x3a310c[_0x8886('0x2e')](_0x2117fd)[_0x8886('0x3d')](_0x2f8b51);};}exports[_0x8886('0x3e')]=function(_0xa56f32,_0x2f2a63){var _0x1075fd={},_0x1423a2={},_0x11a6a7={'count':0x0,'rows':[]};var _0x2a1b69=_['map'](db[_0x8886('0x3f')][_0x8886('0x40')],function(_0x33a48e){return{'name':_0x33a48e[_0x8886('0x41')],'type':_0x33a48e[_0x8886('0x42')][_0x8886('0x43')]};});_0x1423a2[_0x8886('0x44')]=_[_0x8886('0x45')](_0x2a1b69,_0x8886('0x3c'));_0x1423a2[_0x8886('0x46')]=_['keys'](_0xa56f32[_0x8886('0x46')]);_0x1423a2[_0x8886('0x47')]=_[_0x8886('0x48')](_0x1423a2[_0x8886('0x44')],_0x1423a2['query']);_0x1075fd['attributes']=_['intersection'](_0x1423a2[_0x8886('0x44')],qs[_0x8886('0x49')](_0xa56f32[_0x8886('0x46')]['fields']));_0x1075fd[_0x8886('0x4a')]=_0x1075fd[_0x8886('0x4a')][_0x8886('0x4b')]?_0x1075fd[_0x8886('0x4a')]:_0x1423a2[_0x8886('0x44')];if(!_0xa56f32[_0x8886('0x46')][_0x8886('0x4c')](_0x8886('0x4d'))){_0x1075fd[_0x8886('0x31')]=qs[_0x8886('0x31')](_0xa56f32['query'][_0x8886('0x31')]);_0x1075fd[_0x8886('0x30')]=qs[_0x8886('0x30')](_0xa56f32[_0x8886('0x46')][_0x8886('0x30')]);}_0x1075fd[_0x8886('0x4e')]=qs['sort'](_0xa56f32[_0x8886('0x46')][_0x8886('0x4f')]);_0x1075fd[_0x8886('0x50')]=qs[_0x8886('0x47')](_['pick'](_0xa56f32[_0x8886('0x46')],_0x1423a2['filters']),_0x2a1b69);if(_0xa56f32[_0x8886('0x46')][_0x8886('0x51')]){_0x1075fd['where']=_[_0x8886('0x52')](_0x1075fd[_0x8886('0x50')],{'$or':_['map'](_0x2a1b69,function(_0x1e5acc){if(_0x1e5acc[_0x8886('0x42')]!==_0x8886('0x53')){var _0x3a017f={};_0x3a017f[_0x1e5acc[_0x8886('0x3c')]]={'$like':'%'+_0xa56f32[_0x8886('0x46')][_0x8886('0x51')]+'%'};return _0x3a017f;}})});}_0x1075fd=_[_0x8886('0x52')]({},_0x1075fd,_0xa56f32[_0x8886('0x54')]);var _0xe9273c={'where':_0x1075fd[_0x8886('0x50')]};return db[_0x8886('0x3f')][_0x8886('0x33')](_0xe9273c)[_0x8886('0x22')](function(_0x1728c2){_0x11a6a7[_0x8886('0x33')]=_0x1728c2;if(_0xa56f32[_0x8886('0x46')]['includeAll']){_0x1075fd['include']=[{'all':!![]}];}return db['FaxMessage'][_0x8886('0x55')](_0x1075fd);})[_0x8886('0x22')](function(_0x2f303c){_0x11a6a7[_0x8886('0x56')]=_0x2f303c;return _0x11a6a7;})['then'](respondWithFilteredResult(_0x2f2a63,_0x1075fd))[_0x8886('0x57')](handleError(_0x2f2a63,null));};exports[_0x8886('0x58')]=function(_0x4bf8ef,_0x3f1efb){var _0x1ddc89={'raw':!![],'where':{'id':_0x4bf8ef['params']['id']}},_0x3dfc3c={};_0x3dfc3c[_0x8886('0x44')]=_[_0x8886('0x59')](db[_0x8886('0x3f')]['rawAttributes']);_0x3dfc3c[_0x8886('0x46')]=_[_0x8886('0x59')](_0x4bf8ef[_0x8886('0x46')]);_0x3dfc3c[_0x8886('0x47')]=_[_0x8886('0x48')](_0x3dfc3c[_0x8886('0x44')],_0x3dfc3c['query']);_0x1ddc89[_0x8886('0x4a')]=_[_0x8886('0x48')](_0x3dfc3c['model'],qs[_0x8886('0x49')](_0x4bf8ef[_0x8886('0x46')][_0x8886('0x49')]));_0x1ddc89[_0x8886('0x4a')]=_0x1ddc89[_0x8886('0x4a')][_0x8886('0x4b')]?_0x1ddc89[_0x8886('0x4a')]:_0x3dfc3c[_0x8886('0x44')];if(_0x4bf8ef[_0x8886('0x46')][_0x8886('0x5a')]){_0x1ddc89[_0x8886('0x5b')]=[{'all':!![]}];}_0x1ddc89=_[_0x8886('0x52')]({},_0x1ddc89,_0x4bf8ef[_0x8886('0x54')]);return db[_0x8886('0x3f')][_0x8886('0x5c')](_0x1ddc89)['then'](handleEntityNotFound(_0x3f1efb,null))[_0x8886('0x22')](respondWithResult(_0x3f1efb,null))['catch'](handleError(_0x3f1efb,null));};exports[_0x8886('0x39')]=function(_0xd5e51d,_0x24ce5b){if(_0xd5e51d[_0x8886('0x5d')]['id']){delete _0xd5e51d[_0x8886('0x5d')]['id'];}return db[_0x8886('0x3f')][_0x8886('0x5c')]({'where':{'id':_0xd5e51d[_0x8886('0x5e')]['id']}})[_0x8886('0x22')](handleEntityNotFound(_0x24ce5b,null))[_0x8886('0x22')](saveUpdates(_0xd5e51d['body'],null))['then'](respondWithResult(_0x24ce5b,null))[_0x8886('0x57')](handleError(_0x24ce5b,null));};exports['destroy']=function(_0x39c7fc,_0x53b0b3){return db['FaxMessage'][_0x8886('0x5c')]({'where':{'id':_0x39c7fc[_0x8886('0x5e')]['id']}})['then'](handleEntityNotFound(_0x53b0b3,null))['then'](removeEntity(_0x53b0b3,null))['catch'](handleError(_0x53b0b3,null));};exports[_0x8886('0x5f')]=function(_0x18ab93,_0x314cd4){return db[_0x8886('0x3f')][_0x8886('0x5f')]()[_0x8886('0x22')](respondWithResult(_0x314cd4,null))[_0x8886('0x57')](handleError(_0x314cd4,null));};var interaction_log=require(_0x8886('0x16'))(_0x8886('0x60'));exports[_0x8886('0x61')]=function(_0x32e699,_0x40bfcd,_0x125d5e){var _0x4f7b57={'agent':{},'channel':_0x8886('0x62')};if(_0x32e699[_0x8886('0x5d')]['id']){delete _0x32e699[_0x8886('0x5d')]['id'];}_0x32e699[_0x8886('0x5d')][_0x8886('0x63')]=!![];_0x32e699[_0x8886('0x5d')][_0x8886('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32e699[_0x8886('0x5d')]['UserId']=_0x32e699['body'][_0x8886('0x65')]||_0x32e699[_0x8886('0x66')]['id'];_0x4f7b57[_0x8886('0x67')]['id']=_0x32e699[_0x8886('0x5d')]['UserId'];return db[_0x8886('0x3f')][_0x8886('0x5c')]({'where':{'id':_0x32e699['params']['id'],'UserId':null}})[_0x8886('0x22')](handleEntityNotFound(_0x40bfcd,null))[_0x8886('0x22')](saveUpdates(_0x32e699['body'],null))['then'](function(_0x9e2001){if(_0x9e2001){_0x4f7b57[_0x8886('0x2a')]=_0x9e2001[_0x8886('0x68')]({'plain':!![]});return db[_0x8886('0x69')][_0x8886('0x5c')]({'where':{'id':_0x9e2001[_0x8886('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x40bfcd,null))[_0x8886('0x22')](function(_0x585c5f){if(_0x585c5f){return _0x585c5f['update']({'UserId':_0x32e699[_0x8886('0x5d')][_0x8886('0x65')],'read1stAt':_['isNil'](_0x585c5f[_0x8886('0x6b')])?moment()[_0x8886('0x6c')](_0x8886('0x6d')):undefined});}return null;})[_0x8886('0x22')](function(_0x512a0e){if(_0x512a0e){_0x4f7b57[_0x8886('0x6e')]=_0x512a0e[_0x8886('0x68')]({'plain':!![]});interaction_log[_0x8886('0x2b')](_0x8886('0x6f'),_0x32e699[_0x8886('0x66')]['id'],_0x32e699[_0x8886('0x66')][_0x8886('0x3c')],_0x32e699[_0x8886('0x66')][_0x8886('0x70')],_0x4f7b57[_0x8886('0x6e')]['id'],_0x32e699[_0x8886('0x5d')]?JSON['stringify'](_0x32e699['body']):_0x8886('0x71'));return respondWithRpcPromise(_0x8886('0x72'),_0x8886('0x73'),_0x4f7b57);}return null;})[_0x8886('0x22')](function(_0x462faa){var _0x52cff6=_0x8886('0x74')+_0x462faa['message'][_0x8886('0x75')];return db[_0x8886('0x76')][_0x8886('0x46')](_0x52cff6,{'type':db['Sequelize']['QueryTypes'][_0x8886('0x77')],'raw':!![]})['then'](function(_0x547021){return _0x547021;});})[_0x8886('0x22')](function(_0x240b9b){if(_0x240b9b){_0x4f7b57[_0x8886('0x2a')][_0x8886('0x78')]=_0x240b9b[0x0];if(!_0x32e699['body'][_0x8886('0x65')])return;return db['User'][_0x8886('0x5c')]({'where':{'id':_0x32e699[_0x8886('0x5d')]['UserId'],'role':_0x8886('0x67')},'attributes':['id',_0x8886('0x3c'),_0x8886('0x79'),_0x8886('0x7a'),'internal'],'raw':!![]});}return null;})[_0x8886('0x22')](function(_0x39f1db){if(!_0x39f1db)return null;_0x4f7b57[_0x8886('0x2a')][_0x8886('0x67')]=_0x39f1db;return _0x4f7b57;})[_0x8886('0x22')](function(_0x4ea056){if(_0x4ea056){if(_0x32e699[_0x8886('0x5d')][_0x8886('0x7b')]){_0x4f7b57[_0x8886('0x2a')]['interface']=util[_0x8886('0x6c')]('SIP/%s',_0x32e699[_0x8886('0x66')][_0x8886('0x3c')]);_0x4f7b57['message'][_0x8886('0x7c')]=_0x4f7b57[_0x8886('0x7c')];_0x4f7b57[_0x8886('0x2a')][_0x8886('0x7d')]=_0x4f7b57[_0x8886('0x7c')];_0x4f7b57[_0x8886('0x2a')][_0x8886('0x7e')]=_0x8886('0x61');return respondWithRpcPromise(_0x8886('0x7f'),'EventManager',{'event':_0x8886('0x80'),'message':_0x4f7b57[_0x8886('0x2a')]},client9002)['then'](function(){return _0x4f7b57;});}return _0x4f7b57;}return null;})['then'](respondWithResult(_0x40bfcd,null))[_0x8886('0x57')](handleError(_0x40bfcd,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x8886('0x81')]=function(_0x1c7087,_0x571146,_0x3fb850){var _0x4abe56={'agent':{},'channel':_0x8886('0x62')};if(_0x1c7087['body']['id']){delete _0x1c7087[_0x8886('0x5d')]['id'];}_0x1c7087[_0x8886('0x5d')][_0x8886('0x65')]=_0x1c7087[_0x8886('0x5d')][_0x8886('0x65')]||_0x1c7087['user']['id'];_0x4abe56[_0x8886('0x67')]['id']=_0x1c7087[_0x8886('0x5d')][_0x8886('0x65')];return db[_0x8886('0x3f')][_0x8886('0x5c')]({'where':{'id':_0x1c7087[_0x8886('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x571146,null))['then'](function(_0x5f3f4d){if(_0x5f3f4d){_0x4abe56[_0x8886('0x2a')]=_0x5f3f4d['get']({'plain':!![]});return db[_0x8886('0x69')][_0x8886('0x5c')]({'where':{'id':_0x5f3f4d[_0x8886('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x571146,null))['then'](function(_0x38f9f4){if(_0x38f9f4){_0x4abe56[_0x8886('0x6e')]=_0x38f9f4[_0x8886('0x68')]({'plain':!![]});interaction_log['info'](_0x8886('0x82'),_0x1c7087['user']['id'],_0x1c7087[_0x8886('0x66')][_0x8886('0x3c')],_0x1c7087['user'][_0x8886('0x70')],_0x4abe56[_0x8886('0x6e')]['id'],_0x1c7087[_0x8886('0x5d')]?JSON[_0x8886('0x27')](_0x1c7087[_0x8886('0x5d')]):_0x8886('0x71'));return respondWithRpcPromise(_0x8886('0x83'),_0x8886('0x84'),_0x4abe56);}return null;})['then'](function(_0x30dfb2){var _0xd740f9=_0x8886('0x74')+_0x30dfb2[_0x8886('0x2a')][_0x8886('0x75')];return db[_0x8886('0x76')]['query'](_0xd740f9,{'type':db[_0x8886('0x85')][_0x8886('0x86')][_0x8886('0x77')],'raw':!![]})['then'](function(_0x563d2f){return _0x563d2f;});})['then'](function(_0x3e2736){if(_0x3e2736){_0x4abe56[_0x8886('0x2a')][_0x8886('0x78')]=_0x3e2736[0x0];if(!_0x1c7087[_0x8886('0x5d')][_0x8886('0x65')])return;return db['User'][_0x8886('0x5c')]({'where':{'id':_0x1c7087[_0x8886('0x5d')]['UserId'],'role':_0x8886('0x67')},'attributes':['id',_0x8886('0x3c'),_0x8886('0x79'),_0x8886('0x7a'),_0x8886('0x87')],'raw':!![]});}return null;})[_0x8886('0x22')](function(_0x3fc071){if(!_0x3fc071)return null;_0x4abe56[_0x8886('0x2a')][_0x8886('0x67')]=_0x3fc071;return _0x4abe56;})[_0x8886('0x22')](function(_0x44bcab){if(_0x44bcab){_0x44bcab[_0x8886('0x2a')][_0x8886('0x88')]=util['format'](_0x8886('0x89'),_0x1c7087[_0x8886('0x66')][_0x8886('0x3c')]);_0x44bcab['message'][_0x8886('0x7c')]=_0x4abe56[_0x8886('0x7c')];_0x44bcab[_0x8886('0x2a')][_0x8886('0x7d')]=_0x4abe56[_0x8886('0x7c')];_0x44bcab[_0x8886('0x2a')][_0x8886('0x7e')]=_0x8886('0x81');respondWithRpcPromise(_0x8886('0x7f'),_0x8886('0x7f'),{'event':_0x8886('0x8a'),'message':_0x44bcab[_0x8886('0x2a')]},client9002);return _0x4abe56;}return null;})[_0x8886('0x22')](respondWithResult(_0x571146,null))['catch'](handleError(_0x571146,null));};exports['create']=function(_0x3bbc48,_0xf03d4c){var _0x3b350d;return db['FaxMessage'][_0x8886('0x8b')](_0x3bbc48['body'],{})['then'](function(_0x1a1f42){_0x3b350d=_0x1a1f42;return db[_0x8886('0x8c')][_0x8886('0x8d')]({'where':{'id':_0x3b350d[_0x8886('0x75')]}});})['then'](function(_0xab7ba6){if(_['isNil'](_0xab7ba6)){return;}else{_0x3b350d['fax']=_0xab7ba6['fax'];return db[_0x8886('0x8e')]['findOne']({'where':{'id':_0x3b350d[_0x8886('0x8f')]}});}})[_0x8886('0x22')](function(_0x591063){return respondWithRpcPromise(_0x8886('0x90'),_0x8886('0x90'),{'FaxAccountId':_[_0x8886('0x91')](_0x3bbc48[_0x8886('0x5d')])?undefined:_0x3bbc48[_0x8886('0x5d')][_0x8886('0x92')],'path':_[_0x8886('0x91')](_0x591063)?undefined:util[_0x8886('0x6c')](_0x8886('0x93'),_0x591063[_0x8886('0x94')]),'fax':_[_0x8886('0x91')](_0x3b350d[_0x8886('0x62')])?undefined:_0x3b350d[_0x8886('0x62')],'AttachmentId':_0x3b350d[_0x8886('0x8f')]},client9002);})[_0x8886('0x22')](respondWithResult(_0xf03d4c,0xc9))[_0x8886('0x57')](handleError(_0xf03d4c,null));};exports[_0x8886('0x95')]=function(_0xf0e926,_0x149f12){var _0x48cd7f=path[_0x8886('0x96')](config[_0x8886('0x97')],_0x8886('0x98'),_0x8886('0x99'),_0x8886('0x9a'));return db['FaxMessage']['find']({'where':{'id':_0xf0e926[_0x8886('0x5e')]['id']},'include':[{'model':db['Attachment'],'as':_0x8886('0x8e')}]})[_0x8886('0x22')](handleEntityNotFound(_0x149f12,null))['then'](function(_0x229d9d){if(_0x229d9d){return _0x149f12[_0x8886('0x95')](path[_0x8886('0x96')](_0x48cd7f,_0x229d9d['Attachment'][_0x8886('0x94')]));}})['catch'](handleError(_0x149f12,null));}; \ No newline at end of file +var _0x032d=['join','root','server','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','show','find','body','destroy','params','describe','read','readAt','format','UserId','user','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','agent','interface','SIP/%s','motionChannel','channel','event','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','email','EventManager','rejectmessage','create','CmContact','findOne','fax','Attachment','AttachmentId','/var/opt/motion2/server/files/attachments/%s','basename'];(function(_0x12762a,_0x39176d){var _0xef013b=function(_0x45585a){while(--_0x45585a){_0x12762a['push'](_0x12762a['shift']());}};_0xef013b(++_0x39176d);}(_0x032d,0x1af));var _0xd032=function(_0x3e31fc,_0x1cb9e0){_0x3e31fc=_0x3e31fc-0x0;var _0x4e5bcd=_0x032d[_0x3e31fc];return _0x4e5bcd;};'use strict';var emlformat=require(_0xd032('0x0'));var rimraf=require(_0xd032('0x1'));var zipdir=require(_0xd032('0x2'));var jsonpatch=require(_0xd032('0x3'));var rp=require(_0xd032('0x4'));var moment=require(_0xd032('0x5'));var BPromise=require(_0xd032('0x6'));var Mustache=require('mustache');var util=require(_0xd032('0x7'));var path=require(_0xd032('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd032('0x9'));var fs=require('fs');var fs_extra=require(_0xd032('0xa'));var _=require(_0xd032('0xb'));var squel=require('squel');var crypto=require(_0xd032('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd032('0xd'));var toCsv=require(_0xd032('0xe'));var querystring=require(_0xd032('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd032('0x10'));var qs=require(_0xd032('0x11'));var as=require(_0xd032('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd032('0x13'))(_0xd032('0x14'));var utils=require(_0xd032('0x15'));var config=require(_0xd032('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd032('0x17'))['db'];config[_0xd032('0x18')]=_['defaults'](config[_0xd032('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd032('0x19'))(new Redis(config[_0xd032('0x18')]));require('./faxMessage.socket')[_0xd032('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd032('0x1b')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x209091,_0x107d4c,_0x2215e0,_0x447791){return new BPromise(function(_0x10b6fb,_0x1a7b8e){var _0x15a30d=_0x447791||client;return _0x15a30d[_0xd032('0x1c')](_0x209091,_0x2215e0)[_0xd032('0x1d')](function(_0xff76f4){logger['info'](_0xd032('0x1e'),_0x107d4c,_0xd032('0x1f'));logger[_0xd032('0x20')](_0xd032('0x21'),_0x107d4c,_0xd032('0x1f'),JSON[_0xd032('0x22')](_0xff76f4));if(_0xff76f4[_0xd032('0x23')]){if(_0xff76f4[_0xd032('0x23')][_0xd032('0x24')]===0x1f4){logger[_0xd032('0x23')](_0xd032('0x1e'),_0x107d4c,_0xff76f4[_0xd032('0x23')]['message']);return _0x1a7b8e(_0xff76f4['error'][_0xd032('0x25')]);}logger[_0xd032('0x23')](_0xd032('0x1e'),_0x107d4c,_0xff76f4[_0xd032('0x23')][_0xd032('0x25')]);return _0x10b6fb(_0xff76f4[_0xd032('0x23')][_0xd032('0x25')]);}else{logger[_0xd032('0x26')]('FaxMessage,\x20%s,\x20%s',_0x107d4c,_0xd032('0x1f'));_0x10b6fb(_0xff76f4[_0xd032('0x27')][_0xd032('0x25')]);}})[_0xd032('0x28')](function(_0x1e5b21){logger['error'](_0xd032('0x1e'),_0x107d4c,_0x1e5b21);_0x1a7b8e(_0x1e5b21);});});}function respondWithStatusCode(_0x57b4fc,_0x4f5921){_0x4f5921=_0x4f5921||0xcc;return function(_0x316864){if(_0x316864){return _0x57b4fc[_0xd032('0x29')](_0x4f5921);}return _0x57b4fc[_0xd032('0x2a')](_0x4f5921)[_0xd032('0x2b')]();};}function respondWithResult(_0x1d213b,_0x17842a){_0x17842a=_0x17842a||0xc8;return function(_0x92e975){if(_0x92e975){return _0x1d213b[_0xd032('0x2a')](_0x17842a)['json'](_0x92e975);}};}function respondWithFilteredResult(_0x636815,_0x324a9a){return function(_0x4f8ce3){if(_0x4f8ce3){var _0x3968b6=typeof _0x324a9a[_0xd032('0x2c')]===_0xd032('0x2d')&&typeof _0x324a9a[_0xd032('0x2e')]===_0xd032('0x2d');var _0x35c30d=_0x4f8ce3[_0xd032('0x2f')];var _0xb99807=_0x3968b6?0x0:_0x324a9a[_0xd032('0x2c')];var _0x432763=_0x3968b6?_0x4f8ce3[_0xd032('0x2f')]:_0x324a9a['offset']+_0x324a9a['limit'];var _0xddbbe3;if(_0x432763>=_0x35c30d){_0x432763=_0x35c30d;_0xddbbe3=0xc8;}else{_0xddbbe3=0xce;}_0x636815['status'](_0xddbbe3);return _0x636815[_0xd032('0x30')](_0xd032('0x31'),_0xb99807+'-'+_0x432763+'/'+_0x35c30d)['json'](_0x4f8ce3);}return null;};}function patchUpdates(_0x74331){return function(_0x539e72){try{jsonpatch[_0xd032('0x32')](_0x539e72,_0x74331,!![]);}catch(_0x232d21){return BPromise[_0xd032('0x33')](_0x232d21);}return _0x539e72[_0xd032('0x34')]();};}function saveUpdates(_0x2678c4,_0x263cff){return function(_0x1db001){if(_0x1db001){return _0x1db001[_0xd032('0x35')](_0x2678c4)['then'](function(_0x5dfecf){return _0x5dfecf;});}return null;};}function removeEntity(_0x5985ce,_0x3e0125){return function(_0x27cbc9){if(_0x27cbc9){return _0x27cbc9['destroy']()[_0xd032('0x1d')](function(){_0x5985ce[_0xd032('0x2a')](0xcc)[_0xd032('0x2b')]();});}};}function handleEntityNotFound(_0x2d433d,_0x22f956){return function(_0x5cb1f4){if(!_0x5cb1f4){_0x2d433d[_0xd032('0x29')](0x194);}return _0x5cb1f4;};}function handleError(_0x3079ca,_0x1e83cb){_0x1e83cb=_0x1e83cb||0x1f4;return function(_0x28416d){logger[_0xd032('0x23')](_0x28416d[_0xd032('0x36')]);if(_0x28416d[_0xd032('0x37')]){delete _0x28416d['name'];}_0x3079ca[_0xd032('0x2a')](_0x1e83cb)[_0xd032('0x38')](_0x28416d);};}exports['index']=function(_0x58372d,_0xf80c20){var _0x903afd={},_0x158211={},_0x495f0c={'count':0x0,'rows':[]};var _0x40dcfb=_[_0xd032('0x39')](db['FaxMessage'][_0xd032('0x3a')],function(_0x3858f3){return{'name':_0x3858f3[_0xd032('0x3b')],'type':_0x3858f3[_0xd032('0x3c')][_0xd032('0x3d')]};});_0x158211[_0xd032('0x3e')]=_[_0xd032('0x39')](_0x40dcfb,'name');_0x158211[_0xd032('0x3f')]=_[_0xd032('0x40')](_0x58372d[_0xd032('0x3f')]);_0x158211[_0xd032('0x41')]=_[_0xd032('0x42')](_0x158211[_0xd032('0x3e')],_0x158211[_0xd032('0x3f')]);_0x903afd[_0xd032('0x43')]=_[_0xd032('0x42')](_0x158211['model'],qs[_0xd032('0x44')](_0x58372d[_0xd032('0x3f')][_0xd032('0x44')]));_0x903afd['attributes']=_0x903afd[_0xd032('0x43')][_0xd032('0x45')]?_0x903afd[_0xd032('0x43')]:_0x158211[_0xd032('0x3e')];if(!_0x58372d['query'][_0xd032('0x46')](_0xd032('0x47'))){_0x903afd[_0xd032('0x2e')]=qs['limit'](_0x58372d['query'][_0xd032('0x2e')]);_0x903afd[_0xd032('0x2c')]=qs[_0xd032('0x2c')](_0x58372d[_0xd032('0x3f')]['offset']);}_0x903afd[_0xd032('0x48')]=qs[_0xd032('0x49')](_0x58372d[_0xd032('0x3f')][_0xd032('0x49')]);_0x903afd[_0xd032('0x4a')]=qs[_0xd032('0x41')](_['pick'](_0x58372d['query'],_0x158211[_0xd032('0x41')]),_0x40dcfb);if(_0x58372d[_0xd032('0x3f')][_0xd032('0x4b')]){_0x903afd[_0xd032('0x4a')]=_[_0xd032('0x4c')](_0x903afd[_0xd032('0x4a')],{'$or':_['map'](_0x40dcfb,function(_0x318319){if(_0x318319[_0xd032('0x3c')]!==_0xd032('0x4d')){var _0x139848={};_0x139848[_0x318319[_0xd032('0x37')]]={'$like':'%'+_0x58372d['query'][_0xd032('0x4b')]+'%'};return _0x139848;}})});}_0x903afd=_['merge']({},_0x903afd,_0x58372d[_0xd032('0x4e')]);var _0x180575={'where':_0x903afd[_0xd032('0x4a')]};return db[_0xd032('0x4f')]['count'](_0x180575)[_0xd032('0x1d')](function(_0x22ca6f){_0x495f0c[_0xd032('0x2f')]=_0x22ca6f;if(_0x58372d[_0xd032('0x3f')][_0xd032('0x50')]){_0x903afd[_0xd032('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0xd032('0x52')](_0x903afd);})[_0xd032('0x1d')](function(_0x5a993d){_0x495f0c['rows']=_0x5a993d;return _0x495f0c;})[_0xd032('0x1d')](respondWithFilteredResult(_0xf80c20,_0x903afd))['catch'](handleError(_0xf80c20,null));};exports[_0xd032('0x53')]=function(_0x555e89,_0x44f3f7){var _0x5f5914={'raw':!![],'where':{'id':_0x555e89['params']['id']}},_0x5d0333={};_0x5d0333['model']=_['keys'](db['FaxMessage'][_0xd032('0x3a')]);_0x5d0333[_0xd032('0x3f')]=_[_0xd032('0x40')](_0x555e89['query']);_0x5d0333[_0xd032('0x41')]=_['intersection'](_0x5d0333['model'],_0x5d0333[_0xd032('0x3f')]);_0x5f5914['attributes']=_[_0xd032('0x42')](_0x5d0333[_0xd032('0x3e')],qs[_0xd032('0x44')](_0x555e89[_0xd032('0x3f')][_0xd032('0x44')]));_0x5f5914[_0xd032('0x43')]=_0x5f5914[_0xd032('0x43')]['length']?_0x5f5914['attributes']:_0x5d0333['model'];if(_0x555e89[_0xd032('0x3f')][_0xd032('0x50')]){_0x5f5914[_0xd032('0x51')]=[{'all':!![]}];}_0x5f5914=_[_0xd032('0x4c')]({},_0x5f5914,_0x555e89[_0xd032('0x4e')]);return db[_0xd032('0x4f')][_0xd032('0x54')](_0x5f5914)['then'](handleEntityNotFound(_0x44f3f7,null))['then'](respondWithResult(_0x44f3f7,null))['catch'](handleError(_0x44f3f7,null));};exports[_0xd032('0x35')]=function(_0x449e98,_0x5d416c){if(_0x449e98[_0xd032('0x55')]['id']){delete _0x449e98[_0xd032('0x55')]['id'];}return db[_0xd032('0x4f')]['find']({'where':{'id':_0x449e98['params']['id']}})['then'](handleEntityNotFound(_0x5d416c,null))[_0xd032('0x1d')](saveUpdates(_0x449e98[_0xd032('0x55')],null))[_0xd032('0x1d')](respondWithResult(_0x5d416c,null))['catch'](handleError(_0x5d416c,null));};exports[_0xd032('0x56')]=function(_0x3b355b,_0x2d4fec){return db[_0xd032('0x4f')][_0xd032('0x54')]({'where':{'id':_0x3b355b[_0xd032('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d4fec,null))[_0xd032('0x1d')](removeEntity(_0x2d4fec,null))[_0xd032('0x28')](handleError(_0x2d4fec,null));};exports[_0xd032('0x58')]=function(_0x366fb9,_0x4814cc){return db[_0xd032('0x4f')][_0xd032('0x58')]()[_0xd032('0x1d')](respondWithResult(_0x4814cc,null))['catch'](handleError(_0x4814cc,null));};var interaction_log=require(_0xd032('0x13'))('fax-interactions');exports['accept']=function(_0x4f3322,_0x1b0c43,_0x437dc9){var _0x28b05e={'agent':{},'channel':'fax'};if(_0x4f3322[_0xd032('0x55')]['id']){delete _0x4f3322[_0xd032('0x55')]['id'];}_0x4f3322[_0xd032('0x55')][_0xd032('0x59')]=!![];_0x4f3322[_0xd032('0x55')][_0xd032('0x5a')]=moment()[_0xd032('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f3322[_0xd032('0x55')][_0xd032('0x5c')]=_0x4f3322[_0xd032('0x55')][_0xd032('0x5c')]||_0x4f3322[_0xd032('0x5d')]['id'];_0x28b05e['agent']['id']=_0x4f3322['body'][_0xd032('0x5c')];return db[_0xd032('0x4f')][_0xd032('0x54')]({'where':{'id':_0x4f3322[_0xd032('0x57')]['id'],'UserId':null}})[_0xd032('0x1d')](handleEntityNotFound(_0x1b0c43,null))[_0xd032('0x1d')](saveUpdates(_0x4f3322[_0xd032('0x55')],null))[_0xd032('0x1d')](function(_0x489fd7){if(_0x489fd7){_0x28b05e[_0xd032('0x25')]=_0x489fd7['get']({'plain':!![]});return db[_0xd032('0x5e')][_0xd032('0x54')]({'where':{'id':_0x489fd7[_0xd032('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x1b0c43,null))[_0xd032('0x1d')](function(_0x26bc27){if(_0x26bc27){return _0x26bc27[_0xd032('0x35')]({'UserId':_0x4f3322[_0xd032('0x55')][_0xd032('0x5c')],'read1stAt':_[_0xd032('0x60')](_0x26bc27[_0xd032('0x61')])?moment()[_0xd032('0x5b')](_0xd032('0x62')):undefined});}return null;})['then'](function(_0x4a2aa7){if(_0x4a2aa7){_0x28b05e[_0xd032('0x63')]=_0x4a2aa7[_0xd032('0x64')]({'plain':!![]});interaction_log['info'](_0xd032('0x65'),_0x4f3322[_0xd032('0x5d')]['id'],_0x4f3322[_0xd032('0x5d')][_0xd032('0x37')],_0x4f3322['user']['role'],_0x28b05e['interaction']['id'],_0x4f3322[_0xd032('0x55')]?JSON['stringify'](_0x4f3322[_0xd032('0x55')]):_0xd032('0x66'));return respondWithRpcPromise('AcceptMessage',_0xd032('0x67'),_0x28b05e);}return null;})['then'](function(_0x43269f){var _0x305c29=_0xd032('0x68')+_0x43269f['message'][_0xd032('0x69')];return db[_0xd032('0x6a')][_0xd032('0x3f')](_0x305c29,{'type':db[_0xd032('0x6b')][_0xd032('0x6c')][_0xd032('0x6d')],'raw':!![]})[_0xd032('0x1d')](function(_0x4c20d1){return _0x4c20d1;});})[_0xd032('0x1d')](function(_0x29b5cc){if(_0x29b5cc){_0x28b05e[_0xd032('0x25')][_0xd032('0x6e')]=_0x29b5cc[0x0];if(!_0x4f3322[_0xd032('0x55')][_0xd032('0x5c')])return;return db['User'][_0xd032('0x54')]({'where':{'id':_0x4f3322[_0xd032('0x55')][_0xd032('0x5c')],'role':'agent'},'attributes':['id',_0xd032('0x37'),_0xd032('0x6f'),'email',_0xd032('0x70')],'raw':!![]});}return null;})['then'](function(_0x340ece){if(!_0x340ece)return null;_0x28b05e[_0xd032('0x25')][_0xd032('0x71')]=_0x340ece;return _0x28b05e;})[_0xd032('0x1d')](function(_0x132beb){if(_0x132beb){if(_0x4f3322[_0xd032('0x55')]['manual']){_0x28b05e[_0xd032('0x25')][_0xd032('0x72')]=util[_0xd032('0x5b')](_0xd032('0x73'),_0x4f3322[_0xd032('0x5d')][_0xd032('0x37')]);_0x28b05e[_0xd032('0x25')]['channel']=_0x28b05e['channel'];_0x28b05e[_0xd032('0x25')][_0xd032('0x74')]=_0x28b05e[_0xd032('0x75')];_0x28b05e[_0xd032('0x25')][_0xd032('0x76')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd032('0x77'),'message':_0x28b05e[_0xd032('0x25')]},client9002)['then'](function(){return _0x28b05e;});}return _0x28b05e;}return null;})[_0xd032('0x1d')](respondWithResult(_0x1b0c43,null))[_0xd032('0x28')](handleError(_0x1b0c43,null));};var interaction_log=require(_0xd032('0x13'))(_0xd032('0x78'));exports[_0xd032('0x33')]=function(_0x3d3123,_0x510d94,_0x18a8d7){var _0x5c60c5={'agent':{},'channel':'fax'};if(_0x3d3123[_0xd032('0x55')]['id']){delete _0x3d3123[_0xd032('0x55')]['id'];}_0x3d3123['body'][_0xd032('0x5c')]=_0x3d3123[_0xd032('0x55')][_0xd032('0x5c')]||_0x3d3123[_0xd032('0x5d')]['id'];_0x5c60c5[_0xd032('0x71')]['id']=_0x3d3123['body'][_0xd032('0x5c')];return db[_0xd032('0x4f')][_0xd032('0x54')]({'where':{'id':_0x3d3123[_0xd032('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x510d94,null))['then'](function(_0xb8fa86){if(_0xb8fa86){_0x5c60c5[_0xd032('0x25')]=_0xb8fa86[_0xd032('0x64')]({'plain':!![]});return db[_0xd032('0x5e')]['find']({'where':{'id':_0xb8fa86[_0xd032('0x5f')]}});}return null;})[_0xd032('0x1d')](handleEntityNotFound(_0x510d94,null))[_0xd032('0x1d')](function(_0x4e0c74){if(_0x4e0c74){_0x5c60c5[_0xd032('0x63')]=_0x4e0c74[_0xd032('0x64')]({'plain':!![]});interaction_log['info'](_0xd032('0x79'),_0x3d3123[_0xd032('0x5d')]['id'],_0x3d3123[_0xd032('0x5d')][_0xd032('0x37')],_0x3d3123[_0xd032('0x5d')][_0xd032('0x7a')],_0x5c60c5[_0xd032('0x63')]['id'],_0x3d3123[_0xd032('0x55')]?JSON[_0xd032('0x22')](_0x3d3123[_0xd032('0x55')]):_0xd032('0x66'));return respondWithRpcPromise(_0xd032('0x7b'),_0xd032('0x7c'),_0x5c60c5);}return null;})[_0xd032('0x1d')](function(_0x3f1be9){var _0x849901=_0xd032('0x68')+_0x3f1be9[_0xd032('0x25')][_0xd032('0x69')];return db[_0xd032('0x6a')][_0xd032('0x3f')](_0x849901,{'type':db[_0xd032('0x6b')][_0xd032('0x6c')][_0xd032('0x6d')],'raw':!![]})['then'](function(_0x27153c){return _0x27153c;});})[_0xd032('0x1d')](function(_0x1fdcca){if(_0x1fdcca){_0x5c60c5[_0xd032('0x25')]['contact']=_0x1fdcca[0x0];if(!_0x3d3123[_0xd032('0x55')][_0xd032('0x5c')])return;return db[_0xd032('0x7d')][_0xd032('0x54')]({'where':{'id':_0x3d3123[_0xd032('0x55')][_0xd032('0x5c')],'role':_0xd032('0x71')},'attributes':['id',_0xd032('0x37'),'fullname',_0xd032('0x7e'),'internal'],'raw':!![]});}return null;})[_0xd032('0x1d')](function(_0x106379){if(!_0x106379)return null;_0x5c60c5[_0xd032('0x25')][_0xd032('0x71')]=_0x106379;return _0x5c60c5;})[_0xd032('0x1d')](function(_0x37e0fb){if(_0x37e0fb){_0x37e0fb[_0xd032('0x25')][_0xd032('0x72')]=util[_0xd032('0x5b')]('SIP/%s',_0x3d3123[_0xd032('0x5d')][_0xd032('0x37')]);_0x37e0fb[_0xd032('0x25')][_0xd032('0x75')]=_0x5c60c5['channel'];_0x37e0fb['message']['motionChannel']=_0x5c60c5[_0xd032('0x75')];_0x37e0fb[_0xd032('0x25')][_0xd032('0x76')]='reject';respondWithRpcPromise(_0xd032('0x7f'),_0xd032('0x7f'),{'event':_0xd032('0x80'),'message':_0x37e0fb['message']},client9002);return _0x5c60c5;}return null;})['then'](respondWithResult(_0x510d94,null))[_0xd032('0x28')](handleError(_0x510d94,null));};exports[_0xd032('0x81')]=function(_0x5d88f0,_0x968fe){var _0x1f0545;return db[_0xd032('0x4f')][_0xd032('0x81')](_0x5d88f0[_0xd032('0x55')],{})[_0xd032('0x1d')](function(_0x51ec18){_0x1f0545=_0x51ec18;return db[_0xd032('0x82')][_0xd032('0x83')]({'where':{'id':_0x1f0545[_0xd032('0x69')]}});})['then'](function(_0x2a562d){if(_[_0xd032('0x60')](_0x2a562d)){return;}else{_0x1f0545[_0xd032('0x84')]=_0x2a562d[_0xd032('0x84')];return db[_0xd032('0x85')][_0xd032('0x83')]({'where':{'id':_0x1f0545[_0xd032('0x86')]}});}})[_0xd032('0x1d')](function(_0x467157){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xd032('0x60')](_0x5d88f0[_0xd032('0x55')])?undefined:_0x5d88f0[_0xd032('0x55')]['FaxAccountId'],'path':_['isNil'](_0x467157)?undefined:util[_0xd032('0x5b')](_0xd032('0x87'),_0x467157[_0xd032('0x88')]),'fax':_[_0xd032('0x60')](_0x1f0545['fax'])?undefined:_0x1f0545['fax'],'AttachmentId':_0x1f0545[_0xd032('0x86')]},client9002);})[_0xd032('0x1d')](respondWithResult(_0x968fe,0xc9))[_0xd032('0x28')](handleError(_0x968fe,null));};exports['download']=function(_0x2c949f,_0x2e0742){var _0x338424=path[_0xd032('0x89')](config[_0xd032('0x8a')],_0xd032('0x8b'),'files',_0xd032('0x8c'));return db[_0xd032('0x4f')][_0xd032('0x54')]({'where':{'id':_0x2c949f[_0xd032('0x57')]['id']},'include':[{'model':db[_0xd032('0x85')],'as':'Attachment'}]})[_0xd032('0x1d')](handleEntityNotFound(_0x2e0742,null))[_0xd032('0x1d')](function(_0x3e5884){if(_0x3e5884){return _0x2e0742[_0xd032('0x8d')](path[_0xd032('0x89')](_0x338424,_0x3e5884[_0xd032('0x85')][_0xd032('0x88')]));}})[_0xd032('0x28')](handleError(_0x2e0742,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c639d73..6998767 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 _0x9fe7=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x9fe7,0x1df));var _0x79fe=function(_0x59a2f8,_0x5e52f6){_0x59a2f8=_0x59a2f8-0x0;var _0x549d4d=_0x9fe7[_0x59a2f8];return _0x549d4d;};'use strict';var EventEmitter=require(_0x79fe('0x0'));var FaxMessage=require(_0x79fe('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x79fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x79fe('0x3'),'afterDestroy':_0x79fe('0x4')};function emitEvent(_0x277bb5){return function(_0x50423a,_0x44c145,_0x627ec4){FaxMessageEvents[_0x79fe('0x5')](_0x277bb5+':'+_0x50423a['id'],_0x50423a);FaxMessageEvents['emit'](_0x277bb5,_0x50423a);_0x627ec4(null);};}for(var e in events){if(events[_0x79fe('0x6')](e)){var event=events[e];FaxMessage[_0x79fe('0x7')](e,emitEvent(event));}}module[_0x79fe('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x63f2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x114303,_0x53a230){var _0x1cd1e1=function(_0x5cf3e0){while(--_0x5cf3e0){_0x114303['push'](_0x114303['shift']());}};_0x1cd1e1(++_0x53a230);}(_0x63f2,0x19b));var _0x263f=function(_0x9e6ad9,_0x254084){_0x9e6ad9=_0x9e6ad9-0x0;var _0x234ff2=_0x63f2[_0x9e6ad9];return _0x234ff2;};'use strict';var EventEmitter=require(_0x263f('0x0'));var FaxMessage=require(_0x263f('0x1'))['db'][_0x263f('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x263f('0x3')](0x0);var events={'afterCreate':_0x263f('0x4'),'afterUpdate':_0x263f('0x5'),'afterDestroy':_0x263f('0x6')};function emitEvent(_0x4cd09c){return function(_0x3e39a0,_0x5926d1,_0x1a4ead){FaxMessageEvents[_0x263f('0x7')](_0x4cd09c+':'+_0x3e39a0['id'],_0x3e39a0);FaxMessageEvents['emit'](_0x4cd09c,_0x3e39a0);_0x1a4ead(null);};}for(var e in events){if(events[_0x263f('0x8')](e)){var event=events[e];FaxMessage[_0x263f('0x9')](e,emitEvent(event));}}module[_0x263f('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e0b84f1..cdf3338 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 _0xc1e1=['../../config/environment','./faxMessage.attributes','FaxMessage','fti_fax_messages','body','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc1e1,0xea));var _0x1c1e=function(_0x610571,_0x5b56fd){_0x610571=_0x610571-0x0;var _0x2ebdae=_0xc1e1[_0x610571];return _0x2ebdae;};'use strict';var _=require(_0x1c1e('0x0'));var util=require(_0x1c1e('0x1'));var logger=require('../../config/logger')(_0x1c1e('0x2'));var moment=require('moment');var BPromise=require(_0x1c1e('0x3'));var rp=require(_0x1c1e('0x4'));var fs=require('fs');var path=require(_0x1c1e('0x5'));var rimraf=require('rimraf');var config=require(_0x1c1e('0x6'));var attributes=require(_0x1c1e('0x7'));module['exports']=function(_0x1394e6,_0xfcfa1c){return _0x1394e6['define'](_0x1c1e('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x1c1e('0x9'),'fields':[_0x1c1e('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cbfc3,_0x662af0,_0x4ae3ae){var _0x32fca9=_0x1394e6['models'];var _0x337ad8=_0x5cbfc3[_0x1c1e('0xb')]({'plain':!![]});if(_0x337ad8[_0x1c1e('0xc')]['toLowerCase']()==='in'||_0x337ad8[_0x1c1e('0xc')][_0x1c1e('0xd')]()===_0x1c1e('0xe')&&!_0x337ad8['secret']&&!_[_0x1c1e('0xf')](_0x337ad8[_0x1c1e('0x10')])){_0x32fca9[_0x1c1e('0x11')][_0x1c1e('0x12')]({'where':{'id':_0x337ad8[_0x1c1e('0x13')]}})[_0x1c1e('0x14')](function(_0x43cf0c){if(_0x43cf0c){_0x43cf0c[_0x1c1e('0x15')]({'lastMsgAt':_0x337ad8['createdAt'],'lastMsgDirection':_0x337ad8['direction'][_0x1c1e('0xd')]()});}})['catch'](function(_0x64653){console['error'](_0x64653);});}_0x4ae3ae();}},'charset':_0x1c1e('0x16'),'collate':_0x1c1e('0x17')});}; \ No newline at end of file +var _0x5429=['exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes'];(function(_0x3d86f5,_0x257914){var _0x2d6881=function(_0x2d912e){while(--_0x2d912e){_0x3d86f5['push'](_0x3d86f5['shift']());}};_0x2d6881(++_0x257914);}(_0x5429,0x183));var _0x9542=function(_0x3e2810,_0x104d34){_0x3e2810=_0x3e2810-0x0;var _0x577d18=_0x5429[_0x3e2810];return _0x577d18;};'use strict';var _=require(_0x9542('0x0'));var util=require(_0x9542('0x1'));var logger=require(_0x9542('0x2'))(_0x9542('0x3'));var moment=require('moment');var BPromise=require(_0x9542('0x4'));var rp=require(_0x9542('0x5'));var fs=require('fs');var path=require(_0x9542('0x6'));var rimraf=require('rimraf');var config=require(_0x9542('0x7'));var attributes=require(_0x9542('0x8'));module[_0x9542('0x9')]=function(_0x4c91be,_0x27d3ff){return _0x4c91be[_0x9542('0xa')](_0x9542('0xb'),attributes,{'tableName':_0x9542('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9542('0xd')],'type':_0x9542('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f1baf,_0x4a903d,_0x52604a){var _0x5f107d=_0x4c91be[_0x9542('0xf')];var _0x1007c7=_0x3f1baf[_0x9542('0x10')]({'plain':!![]});if(_0x1007c7['direction'][_0x9542('0x11')]()==='in'||_0x1007c7[_0x9542('0x12')][_0x9542('0x11')]()===_0x9542('0x13')&&!_0x1007c7[_0x9542('0x14')]&&!_[_0x9542('0x15')](_0x1007c7[_0x9542('0x16')])){_0x5f107d[_0x9542('0x17')][_0x9542('0x18')]({'where':{'id':_0x1007c7[_0x9542('0x19')]}})[_0x9542('0x1a')](function(_0x4d8c01){if(_0x4d8c01){_0x4d8c01[_0x9542('0x1b')]({'lastMsgAt':_0x1007c7[_0x9542('0x1c')],'lastMsgDirection':_0x1007c7[_0x9542('0x12')][_0x9542('0x11')]()});}})[_0x9542('0x1d')](function(_0x242227){console[_0x9542('0x1e')](_0x242227);});}_0x52604a();}},'charset':_0x9542('0x1f'),'collate':_0x9542('0x20')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f7bd3d6..02d7da9 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 _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x3999be,_0x361cab){var _0x4f4033=function(_0x178c82){while(--_0x178c82){_0x3999be['push'](_0x3999be['shift']());}};_0x4f4033(++_0x361cab);}(_0xbec5,0xe5));var _0x5bec=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0xbec5[_0x14d896];return _0x28679a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file +var _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xed1f,0x6a));var _0xfed1=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xed1f[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7a528af..651f8f5 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 _0xf968=['faxMessage:','save','emit','register','length'];(function(_0x1b7c05,_0x3a8552){var _0x404f1f=function(_0x203511){while(--_0x203511){_0x1b7c05['push'](_0x1b7c05['shift']());}};_0x404f1f(++_0x3a8552);}(_0xf968,0x182));var _0x8f96=function(_0x2a24e9,_0x71f68b){_0x2a24e9=_0x2a24e9-0x0;var _0x55b5fa=_0xf968[_0x2a24e9];return _0x55b5fa;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x8f96('0x0'),'remove','update'];function createListener(_0x349e8b,_0x2b6c82){return function(_0x4f84a5){_0x2b6c82[_0x8f96('0x1')](_0x349e8b,_0x4f84a5);};}function removeListener(_0x59e457,_0x26dc47){return function(){FaxMessageEvents['removeListener'](_0x59e457,_0x26dc47);};}exports[_0x8f96('0x2')]=function(_0x396987){for(var _0x32660b=0x0,_0x5b69c2=events[_0x8f96('0x3')];_0x32660b<_0x5b69c2;_0x32660b++){var _0x3e96b8=events[_0x32660b];var _0x45ba6a=createListener(_0x8f96('0x4')+_0x3e96b8,_0x396987);FaxMessageEvents['on'](_0x3e96b8,_0x45ba6a);}}; \ No newline at end of file +var _0x7fcb=['update','emit','removeListener','faxMessage:','./faxMessage.events','save','remove'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x7fcb,0x185));var _0xb7fc=function(_0x202a76,_0x52775d){_0x202a76=_0x202a76-0x0;var _0xa6433b=_0x7fcb[_0x202a76];return _0xa6433b;};'use strict';var FaxMessageEvents=require(_0xb7fc('0x0'));var events=[_0xb7fc('0x1'),_0xb7fc('0x2'),_0xb7fc('0x3')];function createListener(_0x3c7511,_0x2712f9){return function(_0x15a664){_0x2712f9[_0xb7fc('0x4')](_0x3c7511,_0x15a664);};}function removeListener(_0x1b8112,_0x1d9e07){return function(){FaxMessageEvents[_0xb7fc('0x5')](_0x1b8112,_0x1d9e07);};}exports['register']=function(_0x23926b){for(var _0x2b1d37=0x0,_0x2357f3=events['length'];_0x2b1d37<_0x2357f3;_0x2b1d37++){var _0x34c552=events[_0x2b1d37];var _0x292eac=createListener(_0xb7fc('0x6')+_0x34c552,_0x23926b);FaxMessageEvents['on'](_0x34c552,_0x292eac);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 27a3528..2c76e29 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 _0x2f68=['/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept'];(function(_0x210b8c,_0xd76f59){var _0xf39efa=function(_0x594179){while(--_0x594179){_0x210b8c['push'](_0x210b8c['shift']());}};_0xf39efa(++_0xd76f59);}(_0x2f68,0x9a));var _0x82f6=function(_0x13440c,_0x4b8acb){_0x13440c=_0x13440c-0x0;var _0x245faa=_0x2f68[_0x13440c];return _0x245faa;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var fs_extra=require(_0x82f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var controller=require('./faxMessage.controller');router[_0x82f6('0x7')]('/',auth[_0x82f6('0x8')](),controller['index']);router['get'](_0x82f6('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x82f6('0x7')](_0x82f6('0xa'),auth[_0x82f6('0x8')](),controller['show']);router[_0x82f6('0x7')](_0x82f6('0xb'),auth['isAuthenticated'](),controller[_0x82f6('0xc')]);router[_0x82f6('0xd')]('/',auth[_0x82f6('0x8')](),interaction[_0x82f6('0xe')](_0x82f6('0xf'),_0x82f6('0x10')),controller['create']);router[_0x82f6('0x11')](_0x82f6('0xa'),auth['isAuthenticated'](),controller[_0x82f6('0x12')]);router[_0x82f6('0x11')](_0x82f6('0x13'),auth[_0x82f6('0x8')](),controller[_0x82f6('0x14')]);router[_0x82f6('0x11')](_0x82f6('0x15'),auth[_0x82f6('0x8')](),controller[_0x82f6('0x16')]);router['delete'](_0x82f6('0xa'),auth['isAuthenticated'](),controller[_0x82f6('0x17')]);module[_0x82f6('0x18')]=router; \ No newline at end of file +var _0x3140=['download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x38f60c,_0x47f7d4){var _0x2c87b0=function(_0x4d730f){while(--_0x4d730f){_0x38f60c['push'](_0x38f60c['shift']());}};_0x2c87b0(++_0x47f7d4);}(_0x3140,0xaf));var _0x0314=function(_0x1f55f9,_0xf5c554){_0x1f55f9=_0x1f55f9-0x0;var _0x885614=_0x3140[_0x1f55f9];return _0x885614;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['describe']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0314('0x9')]('/:id/download',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),interaction[_0x0314('0x10')](_0x0314('0x11'),'faxmessage:create'),controller[_0x0314('0x12')]);router[_0x0314('0x13')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller[_0x0314('0x14')]);router[_0x0314('0x13')](_0x0314('0x15'),auth['isAuthenticated'](),controller[_0x0314('0x16')]);router[_0x0314('0x13')](_0x0314('0x17'),auth[_0x0314('0xa')](),controller[_0x0314('0x18')]);router[_0x0314('0x19')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller['destroy']);module[_0x0314('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index ede33b1..1b5caa7 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 _0x3746=['roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0x3746,0xa9));var _0x6374=function(_0x3af0a6,_0x2e87ee){_0x3af0a6=_0x3af0a6-0x0;var _0x218d58=_0x3746[_0x3af0a6];return _0x218d58;};'use strict';var Sequelize=require(_0x6374('0x0'));module[_0x6374('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6374('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6374('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6374('0x4')]('rrmemory','beepall',_0x6374('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6374('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x23c7=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x4f73c9,_0x482cd2){var _0x2dc738=function(_0xf62915){while(--_0xf62915){_0x4f73c9['push'](_0x4f73c9['shift']());}};_0x2dc738(++_0x482cd2);}(_0x23c7,0x86));var _0x723c=function(_0x454599,_0x6018be){_0x454599=_0x454599-0x0;var _0xc33aee=_0x23c7[_0x454599];return _0xc33aee;};'use strict';var Sequelize=require(_0x723c('0x0'));module[_0x723c('0x1')]={'name':{'type':Sequelize[_0x723c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x723c('0x2')]},'timeout':{'type':Sequelize[_0x723c('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x723c('0x4'),_0x723c('0x5'),_0x723c('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index cd78124..38a3382 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 _0x143f=['where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','params','describe','findOne','UserFaxQueue','nolimit','pick','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','rows','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','removeAgents','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','end','error','stack','name','send','map','FaxQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x4855e4,_0x480cd1){var _0x1ce1ca=function(_0x47f44f){while(--_0x47f44f){_0x4855e4['push'](_0x4855e4['shift']());}};_0x1ce1ca(++_0x480cd1);}(_0x143f,0x1ec));var _0xf143=function(_0x10f338,_0x5f2210){_0x10f338=_0x10f338-0x0;var _0x51729b=_0x143f[_0x10f338];return _0x51729b;};'use strict';var emlformat=require(_0xf143('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf143('0x1'));var jsonpatch=require(_0xf143('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf143('0x3'));var Mustache=require(_0xf143('0x4'));var util=require(_0xf143('0x5'));var path=require(_0xf143('0x6'));var sox=require(_0xf143('0x7'));var csv=require(_0xf143('0x8'));var ejs=require(_0xf143('0x9'));var fs=require('fs');var fs_extra=require(_0xf143('0xa'));var _=require(_0xf143('0xb'));var squel=require(_0xf143('0xc'));var crypto=require(_0xf143('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf143('0x8'));var querystring=require(_0xf143('0xe'));var Papa=require(_0xf143('0xf'));var Redis=require(_0xf143('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf143('0x11'));var hardwareService=require(_0xf143('0x12'));var logger=require(_0xf143('0x13'))('api');var utils=require(_0xf143('0x14'));var config=require(_0xf143('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf143('0x16')]=_[_0xf143('0x17')](config[_0xf143('0x16')],{'host':_0xf143('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf143('0x16')]));require(_0xf143('0x19'))['register'](socket);function respondWithStatusCode(_0x11a945,_0x513d31){_0x513d31=_0x513d31||0xcc;return function(_0x41bd49){if(_0x41bd49){return _0x11a945[_0xf143('0x1a')](_0x513d31);}return _0x11a945[_0xf143('0x1b')](_0x513d31)['end']();};}function respondWithResult(_0x331e1c,_0x5508cd){_0x5508cd=_0x5508cd||0xc8;return function(_0x572c9a){if(_0x572c9a){return _0x331e1c['status'](_0x5508cd)[_0xf143('0x1c')](_0x572c9a);}};}function respondWithFilteredResult(_0x497a56,_0x34625b){return function(_0x1f0efe){if(_0x1f0efe){var _0x4a2449=typeof _0x34625b[_0xf143('0x1d')]===_0xf143('0x1e')&&typeof _0x34625b[_0xf143('0x1f')]===_0xf143('0x1e');var _0x537965=_0x1f0efe['count'];var _0x3445ae=_0x4a2449?0x0:_0x34625b[_0xf143('0x1d')];var _0x334072=_0x4a2449?_0x1f0efe['count']:_0x34625b['offset']+_0x34625b[_0xf143('0x1f')];var _0x2bf844;if(_0x334072>=_0x537965){_0x334072=_0x537965;_0x2bf844=0xc8;}else{_0x2bf844=0xce;}_0x497a56[_0xf143('0x1b')](_0x2bf844);return _0x497a56['set']('Content-Range',_0x3445ae+'-'+_0x334072+'/'+_0x537965)['json'](_0x1f0efe);}return null;};}function patchUpdates(_0x3d7914){return function(_0xf37e13){try{jsonpatch[_0xf143('0x20')](_0xf37e13,_0x3d7914,!![]);}catch(_0x171f59){return BPromise[_0xf143('0x21')](_0x171f59);}return _0xf37e13[_0xf143('0x22')]();};}function saveUpdates(_0x44642e,_0x16e4c1){return function(_0x3a55c2){if(_0x3a55c2){return _0x3a55c2[_0xf143('0x23')](_0x44642e)[_0xf143('0x24')](function(_0x59f872){return _0x59f872;});}return null;};}function removeEntity(_0x1d7f00,_0x411dd2){return function(_0x1f6b9b){if(_0x1f6b9b){return _0x1f6b9b[_0xf143('0x25')]()['then'](function(){var _0xcb1b79=_0x1f6b9b['get']({'plain':!![]});var _0x4c0220=_0xf143('0x26');return db[_0xf143('0x27')][_0xf143('0x25')]({'where':{'type':_0x4c0220,'resourceId':_0xcb1b79['id']}})[_0xf143('0x24')](function(){return _0x1f6b9b;});})[_0xf143('0x24')](function(){_0x1d7f00[_0xf143('0x1b')](0xcc)[_0xf143('0x28')]();});}};}function handleEntityNotFound(_0x5905cb,_0x5f0c38){return function(_0x8cf5e6){if(!_0x8cf5e6){_0x5905cb[_0xf143('0x1a')](0x194);}return _0x8cf5e6;};}function handleError(_0x1826e7,_0x1b68bd){_0x1b68bd=_0x1b68bd||0x1f4;return function(_0x4209b1){logger[_0xf143('0x29')](_0x4209b1[_0xf143('0x2a')]);if(_0x4209b1[_0xf143('0x2b')]){delete _0x4209b1['name'];}_0x1826e7[_0xf143('0x1b')](_0x1b68bd)[_0xf143('0x2c')](_0x4209b1);};}exports['index']=function(_0xfdaedc,_0x4aca0b){var _0x1617d4={},_0x259285={},_0x18ae56={'count':0x0,'rows':[]};var _0x4cfeaf=_[_0xf143('0x2d')](db[_0xf143('0x2e')][_0xf143('0x2f')],function(_0x19befd){return{'name':_0x19befd['fieldName'],'type':_0x19befd[_0xf143('0x30')][_0xf143('0x31')]};});_0x259285[_0xf143('0x32')]=_[_0xf143('0x2d')](_0x4cfeaf,'name');_0x259285[_0xf143('0x33')]=_[_0xf143('0x34')](_0xfdaedc['query']);_0x259285['filters']=_[_0xf143('0x35')](_0x259285[_0xf143('0x32')],_0x259285[_0xf143('0x33')]);_0x1617d4[_0xf143('0x36')]=_[_0xf143('0x35')](_0x259285['model'],qs[_0xf143('0x37')](_0xfdaedc[_0xf143('0x33')][_0xf143('0x37')]));_0x1617d4['attributes']=_0x1617d4[_0xf143('0x36')][_0xf143('0x38')]?_0x1617d4[_0xf143('0x36')]:_0x259285[_0xf143('0x32')];if(!_0xfdaedc['query'][_0xf143('0x39')]('nolimit')){_0x1617d4[_0xf143('0x1f')]=qs['limit'](_0xfdaedc[_0xf143('0x33')][_0xf143('0x1f')]);_0x1617d4['offset']=qs[_0xf143('0x1d')](_0xfdaedc['query'][_0xf143('0x1d')]);}_0x1617d4[_0xf143('0x3a')]=qs['sort'](_0xfdaedc[_0xf143('0x33')][_0xf143('0x3b')]);_0x1617d4[_0xf143('0x3c')]=qs[_0xf143('0x3d')](_['pick'](_0xfdaedc[_0xf143('0x33')],_0x259285[_0xf143('0x3d')]),_0x4cfeaf);if(_0xfdaedc[_0xf143('0x33')][_0xf143('0x3e')]){_0x1617d4['where']=_[_0xf143('0x3f')](_0x1617d4[_0xf143('0x3c')],{'$or':_['map'](_0x4cfeaf,function(_0x160e80){if(_0x160e80['type']!==_0xf143('0x40')){var _0x31737a={};_0x31737a[_0x160e80['name']]={'$like':'%'+_0xfdaedc[_0xf143('0x33')][_0xf143('0x3e')]+'%'};return _0x31737a;}})});}_0x1617d4=_['merge']({},_0x1617d4,_0xfdaedc[_0xf143('0x41')]);var _0x2533fb={'where':_0x1617d4[_0xf143('0x3c')]};return db[_0xf143('0x2e')][_0xf143('0x42')](_0x2533fb)['then'](function(_0x69d80e){_0x18ae56[_0xf143('0x42')]=_0x69d80e;if(_0xfdaedc[_0xf143('0x33')][_0xf143('0x43')]){_0x1617d4[_0xf143('0x44')]=[{'all':!![]}];}return db[_0xf143('0x2e')][_0xf143('0x45')](_0x1617d4);})[_0xf143('0x24')](function(_0x5d8a6e){_0x18ae56['rows']=_0x5d8a6e;return _0x18ae56;})[_0xf143('0x24')](respondWithFilteredResult(_0x4aca0b,_0x1617d4))[_0xf143('0x46')](handleError(_0x4aca0b,null));};exports[_0xf143('0x47')]=function(_0x1d37e3,_0x504198){var _0xaebb8a={'raw':!![],'where':{'id':_0x1d37e3['params']['id']}},_0x266692={};_0x266692[_0xf143('0x32')]=_[_0xf143('0x34')](db[_0xf143('0x2e')][_0xf143('0x2f')]);_0x266692['query']=_[_0xf143('0x34')](_0x1d37e3[_0xf143('0x33')]);_0x266692[_0xf143('0x3d')]=_[_0xf143('0x35')](_0x266692['model'],_0x266692['query']);_0xaebb8a['attributes']=_[_0xf143('0x35')](_0x266692[_0xf143('0x32')],qs['fields'](_0x1d37e3[_0xf143('0x33')][_0xf143('0x37')]));_0xaebb8a[_0xf143('0x36')]=_0xaebb8a[_0xf143('0x36')][_0xf143('0x38')]?_0xaebb8a['attributes']:_0x266692['model'];if(_0x1d37e3[_0xf143('0x33')][_0xf143('0x43')]){_0xaebb8a[_0xf143('0x44')]=[{'all':!![]}];}_0xaebb8a=_[_0xf143('0x3f')]({},_0xaebb8a,_0x1d37e3[_0xf143('0x41')]);return db[_0xf143('0x2e')][_0xf143('0x48')](_0xaebb8a)[_0xf143('0x24')](handleEntityNotFound(_0x504198,null))['then'](respondWithResult(_0x504198,null))['catch'](handleError(_0x504198,null));};exports[_0xf143('0x49')]=function(_0x450a4c,_0x4a436d){return db[_0xf143('0x2e')][_0xf143('0x49')](_0x450a4c[_0xf143('0x4a')],{})[_0xf143('0x24')](function(_0x2b6066){var _0x412e09=_0x450a4c[_0xf143('0x4b')][_0xf143('0x4c')]({'plain':!![]});if(!_0x412e09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x412e09[_0xf143('0x4d')]==='user'){var _0x3c9290=_0x2b6066[_0xf143('0x4c')]({'plain':!![]});var _0x450ded='FaxQueues';return db[_0xf143('0x4e')][_0xf143('0x48')]({'where':{'name':_0x450ded,'userProfileId':_0x412e09[_0xf143('0x4f')]},'raw':!![]})[_0xf143('0x24')](function(_0x3cc310){if(_0x3cc310&&_0x3cc310[_0xf143('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c9290[_0xf143('0x2b')],'resourceId':_0x3c9290['id'],'type':_0x3cc310['name'],'sectionId':_0x3cc310['id']},{})[_0xf143('0x24')](function(){return _0x2b6066;});}else{return _0x2b6066;}})['catch'](function(_0x505a2d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x505a2d);throw _0x505a2d;});}return _0x2b6066;})[_0xf143('0x24')](respondWithResult(_0x4a436d,0xc9))[_0xf143('0x46')](handleError(_0x4a436d,null));};exports[_0xf143('0x23')]=function(_0x3d1a27,_0x3e5de2){if(_0x3d1a27[_0xf143('0x4a')]['id']){delete _0x3d1a27['body']['id'];}return db[_0xf143('0x2e')][_0xf143('0x48')]({'where':{'id':_0x3d1a27[_0xf143('0x51')]['id']}})[_0xf143('0x24')](handleEntityNotFound(_0x3e5de2,null))['then'](saveUpdates(_0x3d1a27['body'],null))[_0xf143('0x24')](respondWithResult(_0x3e5de2,null))[_0xf143('0x46')](handleError(_0x3e5de2,null));};exports['destroy']=function(_0x47a0db,_0x2979b5){return db[_0xf143('0x2e')]['find']({'where':{'id':_0x47a0db[_0xf143('0x51')]['id']}})[_0xf143('0x24')](handleEntityNotFound(_0x2979b5,null))['then'](removeEntity(_0x2979b5,null))[_0xf143('0x46')](handleError(_0x2979b5,null));};exports[_0xf143('0x52')]=function(_0x5ba35e,_0x194254){return db[_0xf143('0x2e')][_0xf143('0x52')]()['then'](respondWithResult(_0x194254,null))[_0xf143('0x46')](handleError(_0x194254,null));};exports['getMembers']=function(_0x36b05a,_0x3f7c35,_0x2a0a6d){var _0x34aa9a={'raw':!![],'where':{}},_0x182592={},_0x2d9d94;return db[_0xf143('0x2e')][_0xf143('0x53')]({'where':{'id':_0x36b05a[_0xf143('0x51')]['id']}})[_0xf143('0x24')](handleEntityNotFound(_0x3f7c35,null))[_0xf143('0x24')](function(_0x1201e4){if(_0x1201e4){_0x2d9d94=_0x1201e4[_0xf143('0x4c')]({'plain':!![]});_0x182592['model']=_[_0xf143('0x34')](db[_0xf143('0x54')][_0xf143('0x2f')]);_0x182592[_0xf143('0x33')]=_[_0xf143('0x34')](_0x36b05a['query']);_0x182592[_0xf143('0x3d')]=_[_0xf143('0x35')](_0x182592['model'],_0x182592[_0xf143('0x33')]);_0x34aa9a[_0xf143('0x36')]=_['intersection'](_0x182592['model'],qs['fields'](_0x36b05a[_0xf143('0x33')]['fields']));_0x34aa9a[_0xf143('0x36')]=_0x34aa9a[_0xf143('0x36')][_0xf143('0x38')]?_0x34aa9a[_0xf143('0x36')]:_0x182592[_0xf143('0x32')];if(!_0x36b05a['query'][_0xf143('0x39')](_0xf143('0x55'))){_0x34aa9a['limit']=qs[_0xf143('0x1f')](_0x36b05a[_0xf143('0x33')]['limit']);_0x34aa9a[_0xf143('0x1d')]=qs['offset'](_0x36b05a[_0xf143('0x33')][_0xf143('0x1d')]);}_0x34aa9a[_0xf143('0x3a')]=qs['sort'](_0x36b05a[_0xf143('0x33')][_0xf143('0x3b')]);_0x34aa9a[_0xf143('0x3c')]=qs[_0xf143('0x3d')](_[_0xf143('0x56')](_0x36b05a[_0xf143('0x33')],_0x182592[_0xf143('0x3d')]));_0x34aa9a[_0xf143('0x3c')][_0xf143('0x57')]=_0x1201e4['id'];if(_0x36b05a['query'][_0xf143('0x3e')]){_0x34aa9a['where']=_[_0xf143('0x3f')](_0x34aa9a[_0xf143('0x3c')],{'$or':_['map'](_0x34aa9a[_0xf143('0x36')],function(_0x14722d){var _0x1e110e={};_0x1e110e[_0x14722d]={'$like':'%'+_0x36b05a['query'][_0xf143('0x3e')]+'%'};return _0x1e110e;})});}_0x34aa9a=_['merge']({},_0x34aa9a,_0x36b05a[_0xf143('0x41')]);return db[_0xf143('0x54')][_0xf143('0x45')](_0x34aa9a);}})[_0xf143('0x24')](function(_0x2da845){if(_0x2da845){return db[_0xf143('0x58')][_0xf143('0x59')]({'where':{'id':_[_0xf143('0x2d')](_0x2da845,'UserId'),'role':_0xf143('0x5a')},'attributes':['id',_0xf143('0x2b'),_0xf143('0x5b'),_0xf143('0x5c'),'createdAt']});}})[_0xf143('0x24')](function(_0x5e740c){if(_0x5e740c){return{'count':_0x5e740c[_0xf143('0x42')],'rows':_[_0xf143('0x2d')](_0x5e740c[_0xf143('0x5d')],function(_0x4c0754){return{'membername':_0x4c0754[_0xf143('0x2b')],'UserId':_0x4c0754['id'],'queue_name':_0x2d9d94[_0xf143('0x2b')],'FaxQueueId':_0x2d9d94['id'],'interface':util[_0xf143('0x5e')](_0xf143('0x5f'),_0xf143('0x60'),_0x4c0754['name']),'penalty':0x0,'paused':_0x4c0754[_0xf143('0x5b')],'createdAt':_0x4c0754[_0xf143('0x61')],'updatedAt':_0x4c0754[_0xf143('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf143('0x24')](respondWithFilteredResult(_0x3f7c35,_0x34aa9a))['catch'](handleError(_0x3f7c35,null));};exports['getTeams']=function(_0x9aa842,_0x1694a1,_0x76a264){var _0x148e2d={};var _0x247a2b={};var _0x26d995;var _0x157e15;return db['FaxQueue']['findOne']({'where':{'id':_0x9aa842[_0xf143('0x51')]['id']}})[_0xf143('0x24')](handleEntityNotFound(_0x1694a1,null))[_0xf143('0x24')](function(_0x242e6a){if(_0x242e6a){_0x26d995=_0x242e6a;_0x247a2b[_0xf143('0x32')]=_[_0xf143('0x34')](db[_0xf143('0x62')][_0xf143('0x2f')]);_0x247a2b[_0xf143('0x33')]=_[_0xf143('0x34')](_0x9aa842[_0xf143('0x33')]);_0x247a2b[_0xf143('0x3d')]=_[_0xf143('0x35')](_0x247a2b[_0xf143('0x32')],_0x247a2b[_0xf143('0x33')]);_0x148e2d[_0xf143('0x36')]=_['intersection'](_0x247a2b[_0xf143('0x32')],qs['fields'](_0x9aa842['query'][_0xf143('0x37')]));_0x148e2d[_0xf143('0x36')]=_0x148e2d['attributes'][_0xf143('0x38')]?_0x148e2d[_0xf143('0x36')]:_0x247a2b[_0xf143('0x32')];_0x148e2d[_0xf143('0x3a')]=qs['sort'](_0x9aa842['query'][_0xf143('0x3b')]);_0x148e2d[_0xf143('0x3c')]=qs[_0xf143('0x3d')](_[_0xf143('0x56')](_0x9aa842['query'],_0x247a2b[_0xf143('0x3d')]));if(_0x9aa842[_0xf143('0x33')][_0xf143('0x3e')]){_0x148e2d['where']=_['merge'](_0x148e2d[_0xf143('0x3c')],{'$or':_[_0xf143('0x2d')](_0x148e2d[_0xf143('0x36')],function(_0x521f60){var _0x49a732={};_0x49a732[_0x521f60]={'$like':'%'+_0x9aa842[_0xf143('0x33')][_0xf143('0x3e')]+'%'};return _0x49a732;})});}_0x148e2d=_[_0xf143('0x3f')]({},_0x148e2d,_0x9aa842['options']);return _0x26d995[_0xf143('0x63')](_0x148e2d);}})[_0xf143('0x24')](function(_0x11f6c8){if(_0x11f6c8){_0x157e15=_0x11f6c8[_0xf143('0x38')];if(!_0x9aa842[_0xf143('0x33')][_0xf143('0x39')](_0xf143('0x55'))){_0x148e2d[_0xf143('0x1f')]=qs['limit'](_0x9aa842['query'][_0xf143('0x1f')]);_0x148e2d['offset']=qs['offset'](_0x9aa842[_0xf143('0x33')][_0xf143('0x1d')]);}return _0x26d995[_0xf143('0x63')](_0x148e2d);}})['then'](function(_0x1064ca){if(_0x1064ca){return _0x1064ca?{'count':_0x157e15,'rows':_0x1064ca}:null;}})[_0xf143('0x24')](respondWithResult(_0x1694a1,null))[_0xf143('0x46')](handleError(_0x1694a1,null));};exports[_0xf143('0x64')]=function(_0x505161,_0xc81d6d,_0x423881){var _0x37b179=_0x505161[_0xf143('0x4a')][_0xf143('0x65')];return db[_0xf143('0x62')]['findAll']({'where':{'id':_0x37b179},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf143('0x66'),'attributes':['id','name',_0xf143('0x67'),_0xf143('0x68'),_0xf143('0x69')],'raw':!![]}]})[_0xf143('0x24')](function(_0x34c047){if(_0x34c047){var _0x3c09e3=_[_0xf143('0x6a')](_0x34c047,function(_0x3088d4){var _0x5a95c2=_0x3088d4[_0xf143('0x4c')]({'plain':!![]});return _0x5a95c2['Agents'];});return db[_0xf143('0x2e')][_0xf143('0x48')]({'where':{'id':_0x505161['params']['id']}})[_0xf143('0x24')](function(_0x6b2a0d){return db[_0xf143('0x6b')]['transaction'](function(_0x14e8a1){return _0x6b2a0d['addTeams'](_0x37b179,{'transaction':_0x14e8a1})[_0xf143('0x24')](function(){return BPromise[_0xf143('0x6c')](_0x3c09e3,function(_0x4f2c75){return db['UserFaxQueue'][_0xf143('0x6d')]({'where':{'UserId':_0x4f2c75['id'],'FaxQueueId':_0x505161[_0xf143('0x51')]['id']},'transaction':_0x14e8a1});});})[_0xf143('0x24')](function(){_0x3c09e3[_0xf143('0x6e')](function(_0x568c2b){socket[_0xf143('0x6f')]('userFaxQueue:save',{'UserId':_0x568c2b['id'],'FaxQueueId':_0x6b2a0d['id']});});});});});}})['then'](respondWithStatusCode(_0xc81d6d,null))[_0xf143('0x46')](handleError(_0xc81d6d,null));};exports[_0xf143('0x70')]=function(_0x2c4656,_0x26315d,_0x339163){return db[_0xf143('0x62')]['findAll']({'where':{'id':_0x2c4656[_0xf143('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf143('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x26315d,null))[_0xf143('0x24')](function(_0x152e68){var _0x204f4d=_['map'](_0x152e68,'id');var _0x2805cd=[];var _0x167fc3=[];var _0x157711=squel[_0xf143('0x71')]();_0x157711[_0xf143('0x72')]('tq.TeamId')[_0xf143('0x73')](_0xf143('0x74'),'tq')[_0xf143('0x75')](_0xf143('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf143('0x3c')]('FaxQueueId\x20=\x20?',_0x2c4656['params']['id']);for(var _0x550136=0x0;_0x550136<_0x152e68[_0xf143('0x38')];_0x550136+=0x1){let _0x2139b1=_0x152e68[_0x550136];for(var _0xb75fa3=0x0;_0xb75fa3<_0x2139b1['Agents'][_0xf143('0x38')];_0xb75fa3+=0x1){let _0x4e8194=_0x2139b1['Agents'][_0xb75fa3];var _0x10cf53=_0x157711['clone']();_0x10cf53[_0xf143('0x3c')](_0xf143('0x77'),_0x4e8194['id']);_0x167fc3[_0xf143('0x78')](db[_0xf143('0x6b')][_0xf143('0x33')](_0x10cf53[_0xf143('0x79')](),{'type':db[_0xf143('0x6b')][_0xf143('0x7a')][_0xf143('0x7b')]})[_0xf143('0x24')](function(_0x4b4815){if(_0x4b4815[_0xf143('0x38')]===0x1){return _0x4e8194['id'];}else{var _0x3f5b8b=_[_0xf143('0x7c')](_[_0xf143('0x2d')](_0x4b4815,'TeamId'),function(_0x3a4a03){return _[_0xf143('0x7d')](_0x204f4d,_0x3a4a03);});if(_0x3f5b8b){return _0x4e8194['id'];}}}));}}return BPromise[_0xf143('0x7e')](_0x167fc3)[_0xf143('0x24')](function(_0x2652dc){_0x2805cd=_(_0x2805cd)[_0xf143('0x7f')](_0x2652dc)[_0xf143('0x80')]()[_0xf143('0x81')]();return db['FaxQueue'][_0xf143('0x48')]({'where':{'id':_0x2c4656[_0xf143('0x51')]['id']}})['then'](function(_0x51c00e){return db['sequelize'][_0xf143('0x82')](function(_0x145069){return _0x51c00e[_0xf143('0x70')](_0x2c4656[_0xf143('0x33')]['ids'],{'transaction':_0x145069})['then'](function(){if(!_['isEmpty'](_0x2805cd)){return _0x51c00e[_0xf143('0x83')](_0x2805cd,{'transaction':_0x145069});}})[_0xf143('0x24')](function(){_0x2805cd[_0xf143('0x6e')](function(_0x4f8af7){socket[_0xf143('0x6f')](_0xf143('0x84'),{'UserId':_0x4f8af7,'FaxQueueId':_0x51c00e['id']});});});});});});})['then'](respondWithStatusCode(_0x26315d,null))[_0xf143('0x46')](handleError(_0x26315d,null));};exports['addAgents']=function(_0x4985ec,_0x2bfd44,_0x24c884){return db[_0xf143('0x2e')][_0xf143('0x48')]({'where':{'id':_0x4985ec[_0xf143('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bfd44,null))[_0xf143('0x24')](function(_0x32f7e2){if(_0x32f7e2){return _0x32f7e2[_0xf143('0x85')](_0x4985ec[_0xf143('0x4a')][_0xf143('0x65')],_['omit'](_0x4985ec['body'],[_0xf143('0x65'),'id'])||{})[_0xf143('0x86')](function(_0xbccc9f){for(var _0x1757ac=0x0;_0x1757ac<_0x4985ec[_0xf143('0x4a')]['ids']['length'];_0x1757ac+=0x1){socket[_0xf143('0x6f')](_0xf143('0x87'),{'UserId':Number(_0x4985ec[_0xf143('0x4a')][_0xf143('0x65')][_0x1757ac]),'FaxQueueId':Number(_0x4985ec['params']['id'])});}return _0xbccc9f;});}})[_0xf143('0x24')](respondWithResult(_0x2bfd44,null))[_0xf143('0x46')](handleError(_0x2bfd44,null));};exports[_0xf143('0x83')]=function(_0x34efd6,_0x4e4d24,_0x105e87){return db['FaxQueue']['find']({'where':{'id':_0x34efd6['params']['id']}})[_0xf143('0x24')](handleEntityNotFound(_0x4e4d24,null))[_0xf143('0x24')](function(_0x1eb12b){if(_0x1eb12b){return _0x1eb12b[_0xf143('0x83')](_0x34efd6[_0xf143('0x33')][_0xf143('0x65')])[_0xf143('0x24')](function(){if(_[_0xf143('0x88')](_0x34efd6[_0xf143('0x33')][_0xf143('0x65')])){for(var _0x5728cf=0x0;_0x5728cf<_0x34efd6[_0xf143('0x33')][_0xf143('0x65')][_0xf143('0x38')];_0x5728cf+=0x1){socket[_0xf143('0x6f')](_0xf143('0x84'),{'UserId':Number(_0x34efd6[_0xf143('0x33')]['ids'][_0x5728cf]),'FaxQueueId':Number(_0x34efd6[_0xf143('0x51')]['id'])});}}else{socket[_0xf143('0x6f')](_0xf143('0x84'),{'UserId':Number(_0x34efd6[_0xf143('0x33')][_0xf143('0x65')]),'FaxQueueId':Number(_0x34efd6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4e4d24,null))['catch'](handleError(_0x4e4d24,null));};exports[_0xf143('0x89')]=function(_0x4158db,_0x584e27,_0x3103c8){var _0x44ae62={};var _0x143a24={};var _0x7395ef;var _0x7c355a;return db[_0xf143('0x2e')][_0xf143('0x53')]({'where':{'id':_0x4158db['params']['id']}})[_0xf143('0x24')](handleEntityNotFound(_0x584e27,null))[_0xf143('0x24')](function(_0x3b736a){if(_0x3b736a){_0x7395ef=_0x3b736a;_0x143a24[_0xf143('0x32')]=_[_0xf143('0x34')](db[_0xf143('0x58')][_0xf143('0x2f')]);_0x143a24[_0xf143('0x33')]=_['keys'](_0x4158db[_0xf143('0x33')]);_0x143a24[_0xf143('0x3d')]=_[_0xf143('0x35')](_0x143a24['model'],_0x143a24['query']);_0x44ae62[_0xf143('0x36')]=_[_0xf143('0x35')](_0x143a24[_0xf143('0x32')],qs[_0xf143('0x37')](_0x4158db[_0xf143('0x33')][_0xf143('0x37')]));_0x44ae62['attributes']=_0x44ae62[_0xf143('0x36')][_0xf143('0x38')]?_0x44ae62[_0xf143('0x36')]:_0x143a24['model'];_0x44ae62[_0xf143('0x3a')]=qs[_0xf143('0x3b')](_0x4158db[_0xf143('0x33')][_0xf143('0x3b')]);_0x44ae62[_0xf143('0x3c')]=qs['filters'](_[_0xf143('0x56')](_0x4158db[_0xf143('0x33')],_0x143a24[_0xf143('0x3d')]));if(_0x4158db[_0xf143('0x33')][_0xf143('0x3e')]){_0x44ae62['where']=_['merge'](_0x44ae62[_0xf143('0x3c')],{'$or':_[_0xf143('0x2d')](_0x44ae62['attributes'],function(_0x3f5d3f){var _0x4157ce={};_0x4157ce[_0x3f5d3f]={'$like':'%'+_0x4158db['query'][_0xf143('0x3e')]+'%'};return _0x4157ce;})});}_0x44ae62=_['merge']({},_0x44ae62,_0x4158db[_0xf143('0x41')]);return _0x7395ef[_0xf143('0x89')](_0x44ae62);}})['then'](function(_0x13e7ee){if(_0x13e7ee){_0x7c355a=_0x13e7ee['length'];if(!_0x4158db[_0xf143('0x33')][_0xf143('0x39')](_0xf143('0x55'))){_0x44ae62[_0xf143('0x1f')]=qs[_0xf143('0x1f')](_0x4158db[_0xf143('0x33')][_0xf143('0x1f')]);_0x44ae62[_0xf143('0x1d')]=qs['offset'](_0x4158db[_0xf143('0x33')]['offset']);}return _0x7395ef[_0xf143('0x89')](_0x44ae62);}})['then'](function(_0x3b560f){if(_0x3b560f){return _0x3b560f?{'count':_0x7c355a,'rows':_0x3b560f}:null;}})['then'](respondWithResult(_0x584e27,null))[_0xf143('0x46')](handleError(_0x584e27,null));}; \ No newline at end of file +var _0xad52=['transaction','each','findOrCreate','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','FaxQueues','UserProfileResource','then','sendStatus','error','stack','name','send','map','FaxQueue','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','format','getTeams','Team','nolimit','addTeams','ids','online','voicePause','interface','flatMap','Agents'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xad52,0x139));var _0x2ad5=function(_0x5d73ce,_0x241c4f){_0x5d73ce=_0x5d73ce-0x0;var _0x2f3425=_0xad52[_0x5d73ce];return _0x2f3425;};'use strict';var emlformat=require(_0x2ad5('0x0'));var rimraf=require(_0x2ad5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ad5('0x2'));var rp=require(_0x2ad5('0x3'));var moment=require(_0x2ad5('0x4'));var BPromise=require(_0x2ad5('0x5'));var Mustache=require(_0x2ad5('0x6'));var util=require(_0x2ad5('0x7'));var path=require(_0x2ad5('0x8'));var sox=require(_0x2ad5('0x9'));var csv=require(_0x2ad5('0xa'));var ejs=require(_0x2ad5('0xb'));var fs=require('fs');var fs_extra=require(_0x2ad5('0xc'));var _=require(_0x2ad5('0xd'));var squel=require(_0x2ad5('0xe'));var crypto=require(_0x2ad5('0xf'));var jsforce=require(_0x2ad5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2ad5('0xa'));var querystring=require(_0x2ad5('0x11'));var Papa=require(_0x2ad5('0x12'));var Redis=require('ioredis');var authService=require(_0x2ad5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2ad5('0x14'));var hardwareService=require(_0x2ad5('0x15'));var logger=require(_0x2ad5('0x16'))('api');var utils=require(_0x2ad5('0x17'));var config=require(_0x2ad5('0x18'));var licenseUtil=require(_0x2ad5('0x19'));var db=require(_0x2ad5('0x1a'))['db'];config[_0x2ad5('0x1b')]=_[_0x2ad5('0x1c')](config[_0x2ad5('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ad5('0x1d'))(new Redis(config[_0x2ad5('0x1b')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x2e6051,_0x2878b2){_0x2878b2=_0x2878b2||0xcc;return function(_0x561575){if(_0x561575){return _0x2e6051['sendStatus'](_0x2878b2);}return _0x2e6051[_0x2ad5('0x1e')](_0x2878b2)[_0x2ad5('0x1f')]();};}function respondWithResult(_0x1dd330,_0x214fb2){_0x214fb2=_0x214fb2||0xc8;return function(_0x1570a5){if(_0x1570a5){return _0x1dd330[_0x2ad5('0x1e')](_0x214fb2)[_0x2ad5('0x20')](_0x1570a5);}};}function respondWithFilteredResult(_0x776d,_0x2bb9f1){return function(_0x1c52c1){if(_0x1c52c1){var _0x5124bb=typeof _0x2bb9f1[_0x2ad5('0x21')]===_0x2ad5('0x22')&&typeof _0x2bb9f1[_0x2ad5('0x23')]===_0x2ad5('0x22');var _0x273d2e=_0x1c52c1[_0x2ad5('0x24')];var _0x3cca37=_0x5124bb?0x0:_0x2bb9f1[_0x2ad5('0x21')];var _0x489be1=_0x5124bb?_0x1c52c1['count']:_0x2bb9f1[_0x2ad5('0x21')]+_0x2bb9f1[_0x2ad5('0x23')];var _0x597353;if(_0x489be1>=_0x273d2e){_0x489be1=_0x273d2e;_0x597353=0xc8;}else{_0x597353=0xce;}_0x776d[_0x2ad5('0x1e')](_0x597353);return _0x776d[_0x2ad5('0x25')]('Content-Range',_0x3cca37+'-'+_0x489be1+'/'+_0x273d2e)['json'](_0x1c52c1);}return null;};}function patchUpdates(_0x56de4c){return function(_0x29ffb4){try{jsonpatch[_0x2ad5('0x26')](_0x29ffb4,_0x56de4c,!![]);}catch(_0x2215dd){return BPromise[_0x2ad5('0x27')](_0x2215dd);}return _0x29ffb4[_0x2ad5('0x28')]();};}function saveUpdates(_0x4b441b,_0x32715a){return function(_0x156336){if(_0x156336){return _0x156336['update'](_0x4b441b)['then'](function(_0x35db51){return _0x35db51;});}return null;};}function removeEntity(_0x5a21fc,_0x5281af){return function(_0x4369f2){if(_0x4369f2){return _0x4369f2[_0x2ad5('0x29')]()['then'](function(){var _0x5b018c=_0x4369f2['get']({'plain':!![]});var _0x375920=_0x2ad5('0x2a');return db[_0x2ad5('0x2b')][_0x2ad5('0x29')]({'where':{'type':_0x375920,'resourceId':_0x5b018c['id']}})[_0x2ad5('0x2c')](function(){return _0x4369f2;});})[_0x2ad5('0x2c')](function(){_0x5a21fc['status'](0xcc)[_0x2ad5('0x1f')]();});}};}function handleEntityNotFound(_0x3d37e3,_0x433330){return function(_0x2ab4e4){if(!_0x2ab4e4){_0x3d37e3[_0x2ad5('0x2d')](0x194);}return _0x2ab4e4;};}function handleError(_0x42b55b,_0x43c9cb){_0x43c9cb=_0x43c9cb||0x1f4;return function(_0x57ae4a){logger[_0x2ad5('0x2e')](_0x57ae4a[_0x2ad5('0x2f')]);if(_0x57ae4a[_0x2ad5('0x30')]){delete _0x57ae4a[_0x2ad5('0x30')];}_0x42b55b[_0x2ad5('0x1e')](_0x43c9cb)[_0x2ad5('0x31')](_0x57ae4a);};}exports['index']=function(_0xbf7adc,_0x2c48a5){var _0x5d806c={},_0x110298={},_0x18f7f1={'count':0x0,'rows':[]};var _0x2b142a=_[_0x2ad5('0x32')](db[_0x2ad5('0x33')]['rawAttributes'],function(_0x510704){return{'name':_0x510704[_0x2ad5('0x34')],'type':_0x510704[_0x2ad5('0x35')][_0x2ad5('0x36')]};});_0x110298['model']=_['map'](_0x2b142a,_0x2ad5('0x30'));_0x110298['query']=_[_0x2ad5('0x37')](_0xbf7adc['query']);_0x110298[_0x2ad5('0x38')]=_[_0x2ad5('0x39')](_0x110298[_0x2ad5('0x3a')],_0x110298[_0x2ad5('0x3b')]);_0x5d806c[_0x2ad5('0x3c')]=_['intersection'](_0x110298[_0x2ad5('0x3a')],qs[_0x2ad5('0x3d')](_0xbf7adc[_0x2ad5('0x3b')]['fields']));_0x5d806c[_0x2ad5('0x3c')]=_0x5d806c[_0x2ad5('0x3c')][_0x2ad5('0x3e')]?_0x5d806c[_0x2ad5('0x3c')]:_0x110298[_0x2ad5('0x3a')];if(!_0xbf7adc[_0x2ad5('0x3b')][_0x2ad5('0x3f')]('nolimit')){_0x5d806c[_0x2ad5('0x23')]=qs[_0x2ad5('0x23')](_0xbf7adc[_0x2ad5('0x3b')][_0x2ad5('0x23')]);_0x5d806c[_0x2ad5('0x21')]=qs[_0x2ad5('0x21')](_0xbf7adc['query'][_0x2ad5('0x21')]);}_0x5d806c[_0x2ad5('0x40')]=qs[_0x2ad5('0x41')](_0xbf7adc[_0x2ad5('0x3b')][_0x2ad5('0x41')]);_0x5d806c[_0x2ad5('0x42')]=qs[_0x2ad5('0x38')](_[_0x2ad5('0x43')](_0xbf7adc[_0x2ad5('0x3b')],_0x110298['filters']),_0x2b142a);if(_0xbf7adc[_0x2ad5('0x3b')][_0x2ad5('0x44')]){_0x5d806c[_0x2ad5('0x42')]=_[_0x2ad5('0x45')](_0x5d806c['where'],{'$or':_[_0x2ad5('0x32')](_0x2b142a,function(_0x21fb3c){if(_0x21fb3c['type']!=='VIRTUAL'){var _0x446ece={};_0x446ece[_0x21fb3c[_0x2ad5('0x30')]]={'$like':'%'+_0xbf7adc['query'][_0x2ad5('0x44')]+'%'};return _0x446ece;}})});}_0x5d806c=_[_0x2ad5('0x45')]({},_0x5d806c,_0xbf7adc[_0x2ad5('0x46')]);var _0x5df2b8={'where':_0x5d806c[_0x2ad5('0x42')]};return db[_0x2ad5('0x33')][_0x2ad5('0x24')](_0x5df2b8)[_0x2ad5('0x2c')](function(_0x5e1eb5){_0x18f7f1['count']=_0x5e1eb5;if(_0xbf7adc[_0x2ad5('0x3b')][_0x2ad5('0x47')]){_0x5d806c['include']=[{'all':!![]}];}return db['FaxQueue'][_0x2ad5('0x48')](_0x5d806c);})[_0x2ad5('0x2c')](function(_0x384b87){_0x18f7f1[_0x2ad5('0x49')]=_0x384b87;return _0x18f7f1;})[_0x2ad5('0x2c')](respondWithFilteredResult(_0x2c48a5,_0x5d806c))[_0x2ad5('0x4a')](handleError(_0x2c48a5,null));};exports['show']=function(_0x4c243b,_0x4ed457){var _0x319826={'raw':!![],'where':{'id':_0x4c243b[_0x2ad5('0x4b')]['id']}},_0x1130cb={};_0x1130cb[_0x2ad5('0x3a')]=_['keys'](db[_0x2ad5('0x33')][_0x2ad5('0x4c')]);_0x1130cb[_0x2ad5('0x3b')]=_[_0x2ad5('0x37')](_0x4c243b[_0x2ad5('0x3b')]);_0x1130cb[_0x2ad5('0x38')]=_[_0x2ad5('0x39')](_0x1130cb[_0x2ad5('0x3a')],_0x1130cb[_0x2ad5('0x3b')]);_0x319826['attributes']=_[_0x2ad5('0x39')](_0x1130cb[_0x2ad5('0x3a')],qs[_0x2ad5('0x3d')](_0x4c243b[_0x2ad5('0x3b')][_0x2ad5('0x3d')]));_0x319826[_0x2ad5('0x3c')]=_0x319826[_0x2ad5('0x3c')]['length']?_0x319826['attributes']:_0x1130cb[_0x2ad5('0x3a')];if(_0x4c243b[_0x2ad5('0x3b')]['includeAll']){_0x319826[_0x2ad5('0x4d')]=[{'all':!![]}];}_0x319826=_['merge']({},_0x319826,_0x4c243b[_0x2ad5('0x46')]);return db[_0x2ad5('0x33')][_0x2ad5('0x4e')](_0x319826)[_0x2ad5('0x2c')](handleEntityNotFound(_0x4ed457,null))['then'](respondWithResult(_0x4ed457,null))[_0x2ad5('0x4a')](handleError(_0x4ed457,null));};exports[_0x2ad5('0x4f')]=function(_0x3f33d1,_0xeca8e0){return db[_0x2ad5('0x33')]['create'](_0x3f33d1['body'],{})[_0x2ad5('0x2c')](function(_0x596f02){var _0x10a300=_0x3f33d1[_0x2ad5('0x50')][_0x2ad5('0x51')]({'plain':!![]});if(!_0x10a300)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10a300[_0x2ad5('0x52')]===_0x2ad5('0x50')){var _0x3dcadc=_0x596f02[_0x2ad5('0x51')]({'plain':!![]});var _0xc47457='FaxQueues';return db[_0x2ad5('0x53')][_0x2ad5('0x4e')]({'where':{'name':_0xc47457,'userProfileId':_0x10a300[_0x2ad5('0x54')]},'raw':!![]})['then'](function(_0x2343bb){if(_0x2343bb&&_0x2343bb[_0x2ad5('0x55')]===0x0){return db[_0x2ad5('0x2b')][_0x2ad5('0x4f')]({'name':_0x3dcadc['name'],'resourceId':_0x3dcadc['id'],'type':_0x2343bb[_0x2ad5('0x30')],'sectionId':_0x2343bb['id']},{})[_0x2ad5('0x2c')](function(){return _0x596f02;});}else{return _0x596f02;}})[_0x2ad5('0x4a')](function(_0x178e82){logger[_0x2ad5('0x2e')](_0x2ad5('0x56'),_0x178e82);throw _0x178e82;});}return _0x596f02;})['then'](respondWithResult(_0xeca8e0,0xc9))[_0x2ad5('0x4a')](handleError(_0xeca8e0,null));};exports['update']=function(_0x4ff8d7,_0xc53c2b){if(_0x4ff8d7[_0x2ad5('0x57')]['id']){delete _0x4ff8d7[_0x2ad5('0x57')]['id'];}return db[_0x2ad5('0x33')]['find']({'where':{'id':_0x4ff8d7[_0x2ad5('0x4b')]['id']}})[_0x2ad5('0x2c')](handleEntityNotFound(_0xc53c2b,null))[_0x2ad5('0x2c')](saveUpdates(_0x4ff8d7['body'],null))[_0x2ad5('0x2c')](respondWithResult(_0xc53c2b,null))[_0x2ad5('0x4a')](handleError(_0xc53c2b,null));};exports[_0x2ad5('0x29')]=function(_0x2f731f,_0x5cd410){return db[_0x2ad5('0x33')]['find']({'where':{'id':_0x2f731f['params']['id']}})[_0x2ad5('0x2c')](handleEntityNotFound(_0x5cd410,null))[_0x2ad5('0x2c')](removeEntity(_0x5cd410,null))['catch'](handleError(_0x5cd410,null));};exports['describe']=function(_0x1b65c6,_0x51346b){return db['FaxQueue'][_0x2ad5('0x58')]()[_0x2ad5('0x2c')](respondWithResult(_0x51346b,null))[_0x2ad5('0x4a')](handleError(_0x51346b,null));};exports[_0x2ad5('0x59')]=function(_0x333a41,_0x2e4171,_0x131f33){var _0x342478={'raw':!![],'where':{}},_0x274608={},_0x22beb9;return db[_0x2ad5('0x33')][_0x2ad5('0x5a')]({'where':{'id':_0x333a41[_0x2ad5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e4171,null))[_0x2ad5('0x2c')](function(_0x283c31){if(_0x283c31){_0x22beb9=_0x283c31[_0x2ad5('0x51')]({'plain':!![]});_0x274608[_0x2ad5('0x3a')]=_[_0x2ad5('0x37')](db[_0x2ad5('0x5b')]['rawAttributes']);_0x274608['query']=_[_0x2ad5('0x37')](_0x333a41['query']);_0x274608[_0x2ad5('0x38')]=_[_0x2ad5('0x39')](_0x274608['model'],_0x274608[_0x2ad5('0x3b')]);_0x342478['attributes']=_[_0x2ad5('0x39')](_0x274608[_0x2ad5('0x3a')],qs['fields'](_0x333a41[_0x2ad5('0x3b')][_0x2ad5('0x3d')]));_0x342478[_0x2ad5('0x3c')]=_0x342478[_0x2ad5('0x3c')][_0x2ad5('0x3e')]?_0x342478[_0x2ad5('0x3c')]:_0x274608['model'];if(!_0x333a41['query'][_0x2ad5('0x3f')]('nolimit')){_0x342478[_0x2ad5('0x23')]=qs[_0x2ad5('0x23')](_0x333a41[_0x2ad5('0x3b')]['limit']);_0x342478[_0x2ad5('0x21')]=qs[_0x2ad5('0x21')](_0x333a41[_0x2ad5('0x3b')]['offset']);}_0x342478[_0x2ad5('0x40')]=qs['sort'](_0x333a41[_0x2ad5('0x3b')][_0x2ad5('0x41')]);_0x342478[_0x2ad5('0x42')]=qs['filters'](_[_0x2ad5('0x43')](_0x333a41[_0x2ad5('0x3b')],_0x274608[_0x2ad5('0x38')]));_0x342478[_0x2ad5('0x42')][_0x2ad5('0x5c')]=_0x283c31['id'];if(_0x333a41[_0x2ad5('0x3b')][_0x2ad5('0x44')]){_0x342478[_0x2ad5('0x42')]=_[_0x2ad5('0x45')](_0x342478['where'],{'$or':_[_0x2ad5('0x32')](_0x342478[_0x2ad5('0x3c')],function(_0x47dc94){var _0x3e9446={};_0x3e9446[_0x47dc94]={'$like':'%'+_0x333a41[_0x2ad5('0x3b')][_0x2ad5('0x44')]+'%'};return _0x3e9446;})});}_0x342478=_['merge']({},_0x342478,_0x333a41[_0x2ad5('0x46')]);return db[_0x2ad5('0x5b')][_0x2ad5('0x48')](_0x342478);}})['then'](function(_0x1badaa){if(_0x1badaa){return db[_0x2ad5('0x5d')]['findAndCountAll']({'where':{'id':_[_0x2ad5('0x32')](_0x1badaa,_0x2ad5('0x5e')),'role':_0x2ad5('0x5f')},'attributes':['id',_0x2ad5('0x30'),_0x2ad5('0x60'),_0x2ad5('0x61'),_0x2ad5('0x62')]});}})[_0x2ad5('0x2c')](function(_0x34ae1d){if(_0x34ae1d){return{'count':_0x34ae1d[_0x2ad5('0x24')],'rows':_['map'](_0x34ae1d[_0x2ad5('0x49')],function(_0x513d2e){return{'membername':_0x513d2e[_0x2ad5('0x30')],'UserId':_0x513d2e['id'],'queue_name':_0x22beb9[_0x2ad5('0x30')],'FaxQueueId':_0x22beb9['id'],'interface':util[_0x2ad5('0x63')]('%s/%s','SIP',_0x513d2e[_0x2ad5('0x30')]),'penalty':0x0,'paused':_0x513d2e['faxPause'],'createdAt':_0x513d2e[_0x2ad5('0x62')],'updatedAt':_0x513d2e[_0x2ad5('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2e4171,_0x342478))[_0x2ad5('0x4a')](handleError(_0x2e4171,null));};exports[_0x2ad5('0x64')]=function(_0x4de6f5,_0x528bac,_0x562dec){var _0x2ef5d2={};var _0x250abc={};var _0x321b0f;var _0x187257;return db[_0x2ad5('0x33')][_0x2ad5('0x5a')]({'where':{'id':_0x4de6f5[_0x2ad5('0x4b')]['id']}})[_0x2ad5('0x2c')](handleEntityNotFound(_0x528bac,null))[_0x2ad5('0x2c')](function(_0xbdb70b){if(_0xbdb70b){_0x321b0f=_0xbdb70b;_0x250abc['model']=_[_0x2ad5('0x37')](db[_0x2ad5('0x65')][_0x2ad5('0x4c')]);_0x250abc[_0x2ad5('0x3b')]=_[_0x2ad5('0x37')](_0x4de6f5[_0x2ad5('0x3b')]);_0x250abc['filters']=_[_0x2ad5('0x39')](_0x250abc[_0x2ad5('0x3a')],_0x250abc[_0x2ad5('0x3b')]);_0x2ef5d2[_0x2ad5('0x3c')]=_[_0x2ad5('0x39')](_0x250abc[_0x2ad5('0x3a')],qs[_0x2ad5('0x3d')](_0x4de6f5[_0x2ad5('0x3b')][_0x2ad5('0x3d')]));_0x2ef5d2[_0x2ad5('0x3c')]=_0x2ef5d2[_0x2ad5('0x3c')][_0x2ad5('0x3e')]?_0x2ef5d2[_0x2ad5('0x3c')]:_0x250abc[_0x2ad5('0x3a')];_0x2ef5d2[_0x2ad5('0x40')]=qs[_0x2ad5('0x41')](_0x4de6f5['query'][_0x2ad5('0x41')]);_0x2ef5d2[_0x2ad5('0x42')]=qs[_0x2ad5('0x38')](_[_0x2ad5('0x43')](_0x4de6f5[_0x2ad5('0x3b')],_0x250abc['filters']));if(_0x4de6f5[_0x2ad5('0x3b')][_0x2ad5('0x44')]){_0x2ef5d2[_0x2ad5('0x42')]=_[_0x2ad5('0x45')](_0x2ef5d2[_0x2ad5('0x42')],{'$or':_['map'](_0x2ef5d2[_0x2ad5('0x3c')],function(_0xee1644){var _0x36fa2d={};_0x36fa2d[_0xee1644]={'$like':'%'+_0x4de6f5[_0x2ad5('0x3b')]['filter']+'%'};return _0x36fa2d;})});}_0x2ef5d2=_[_0x2ad5('0x45')]({},_0x2ef5d2,_0x4de6f5[_0x2ad5('0x46')]);return _0x321b0f[_0x2ad5('0x64')](_0x2ef5d2);}})['then'](function(_0x25fea7){if(_0x25fea7){_0x187257=_0x25fea7[_0x2ad5('0x3e')];if(!_0x4de6f5[_0x2ad5('0x3b')][_0x2ad5('0x3f')](_0x2ad5('0x66'))){_0x2ef5d2[_0x2ad5('0x23')]=qs[_0x2ad5('0x23')](_0x4de6f5[_0x2ad5('0x3b')][_0x2ad5('0x23')]);_0x2ef5d2['offset']=qs[_0x2ad5('0x21')](_0x4de6f5[_0x2ad5('0x3b')]['offset']);}return _0x321b0f[_0x2ad5('0x64')](_0x2ef5d2);}})['then'](function(_0x49a6f7){if(_0x49a6f7){return _0x49a6f7?{'count':_0x187257,'rows':_0x49a6f7}:null;}})[_0x2ad5('0x2c')](respondWithResult(_0x528bac,null))[_0x2ad5('0x4a')](handleError(_0x528bac,null));};exports[_0x2ad5('0x67')]=function(_0x1e8145,_0xb9c837,_0x148fe1){var _0x22aec4=_0x1e8145[_0x2ad5('0x57')][_0x2ad5('0x68')];return db[_0x2ad5('0x65')][_0x2ad5('0x48')]({'where':{'id':_0x22aec4},'attributes':['id'],'include':[{'model':db[_0x2ad5('0x5d')],'as':'Agents','attributes':['id','name',_0x2ad5('0x69'),_0x2ad5('0x6a'),_0x2ad5('0x6b')],'raw':!![]}]})[_0x2ad5('0x2c')](function(_0x2661ee){if(_0x2661ee){var _0x5136f1=_[_0x2ad5('0x6c')](_0x2661ee,function(_0x2cf6e4){var _0x394207=_0x2cf6e4[_0x2ad5('0x51')]({'plain':!![]});return _0x394207[_0x2ad5('0x6d')];});return db[_0x2ad5('0x33')][_0x2ad5('0x4e')]({'where':{'id':_0x1e8145[_0x2ad5('0x4b')]['id']}})[_0x2ad5('0x2c')](function(_0x27c7c7){return db['sequelize'][_0x2ad5('0x6e')](function(_0x3b87c1){return _0x27c7c7['addTeams'](_0x22aec4,{'transaction':_0x3b87c1})[_0x2ad5('0x2c')](function(){return BPromise[_0x2ad5('0x6f')](_0x5136f1,function(_0x5540f4){return db[_0x2ad5('0x5b')][_0x2ad5('0x70')]({'where':{'UserId':_0x5540f4['id'],'FaxQueueId':_0x1e8145[_0x2ad5('0x4b')]['id']},'transaction':_0x3b87c1});});})['then'](function(){_0x5136f1['forEach'](function(_0x402fe6){socket[_0x2ad5('0x71')](_0x2ad5('0x72'),{'UserId':_0x402fe6['id'],'FaxQueueId':_0x27c7c7['id']});});});});});}})['then'](respondWithStatusCode(_0xb9c837,null))[_0x2ad5('0x4a')](handleError(_0xb9c837,null));};exports['removeTeams']=function(_0x8b768b,_0x22229f,_0x5ae369){return db[_0x2ad5('0x65')][_0x2ad5('0x48')]({'where':{'id':_0x8b768b[_0x2ad5('0x3b')][_0x2ad5('0x68')]},'attributes':['id'],'include':[{'model':db[_0x2ad5('0x5d')],'as':_0x2ad5('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x2ad5('0x2c')](handleEntityNotFound(_0x22229f,null))['then'](function(_0x36a44e){var _0x17b1d1=_[_0x2ad5('0x32')](_0x36a44e,'id');var _0x109a32=[];var _0x2653f8=[];var _0x433f58=squel['select']();_0x433f58[_0x2ad5('0x73')](_0x2ad5('0x74'))[_0x2ad5('0x75')](_0x2ad5('0x76'),'tq')[_0x2ad5('0x77')]('user_has_teams','ut',_0x2ad5('0x78'))['where']('FaxQueueId\x20=\x20?',_0x8b768b['params']['id']);for(var _0x14a880=0x0;_0x14a880<_0x36a44e[_0x2ad5('0x3e')];_0x14a880+=0x1){let _0x1937af=_0x36a44e[_0x14a880];for(var _0x2f2b76=0x0;_0x2f2b76<_0x1937af[_0x2ad5('0x6d')]['length'];_0x2f2b76+=0x1){let _0x1cd98e=_0x1937af['Agents'][_0x2f2b76];var _0x395aec=_0x433f58['clone']();_0x395aec[_0x2ad5('0x42')]('ut.UserId\x20=\x20?',_0x1cd98e['id']);_0x2653f8[_0x2ad5('0x79')](db[_0x2ad5('0x7a')][_0x2ad5('0x3b')](_0x395aec[_0x2ad5('0x7b')](),{'type':db[_0x2ad5('0x7a')][_0x2ad5('0x7c')][_0x2ad5('0x7d')]})[_0x2ad5('0x2c')](function(_0x1b7b25){if(_0x1b7b25[_0x2ad5('0x3e')]===0x1){return _0x1cd98e['id'];}else{var _0x1991a0=_[_0x2ad5('0x7e')](_[_0x2ad5('0x32')](_0x1b7b25,'TeamId'),function(_0x2ccc76){return _[_0x2ad5('0x7f')](_0x17b1d1,_0x2ccc76);});if(_0x1991a0){return _0x1cd98e['id'];}}}));}}return BPromise[_0x2ad5('0x80')](_0x2653f8)[_0x2ad5('0x2c')](function(_0x140460){_0x109a32=_(_0x109a32)[_0x2ad5('0x81')](_0x140460)[_0x2ad5('0x82')]()[_0x2ad5('0x83')]();return db['FaxQueue'][_0x2ad5('0x4e')]({'where':{'id':_0x8b768b[_0x2ad5('0x4b')]['id']}})['then'](function(_0x5a69b1){return db['sequelize'][_0x2ad5('0x6e')](function(_0x45f428){return _0x5a69b1[_0x2ad5('0x84')](_0x8b768b[_0x2ad5('0x3b')][_0x2ad5('0x68')],{'transaction':_0x45f428})[_0x2ad5('0x2c')](function(){if(!_[_0x2ad5('0x85')](_0x109a32)){return _0x5a69b1[_0x2ad5('0x86')](_0x109a32,{'transaction':_0x45f428});}})[_0x2ad5('0x2c')](function(){_0x109a32[_0x2ad5('0x87')](function(_0x37835c){socket[_0x2ad5('0x71')](_0x2ad5('0x88'),{'UserId':_0x37835c,'FaxQueueId':_0x5a69b1['id']});});});});});});})[_0x2ad5('0x2c')](respondWithStatusCode(_0x22229f,null))['catch'](handleError(_0x22229f,null));};exports[_0x2ad5('0x89')]=function(_0x3a09fe,_0xd02597,_0x1b691d){return db[_0x2ad5('0x33')]['find']({'where':{'id':_0x3a09fe['params']['id']}})[_0x2ad5('0x2c')](handleEntityNotFound(_0xd02597,null))['then'](function(_0x4e0506){if(_0x4e0506){return _0x4e0506['addAgents'](_0x3a09fe[_0x2ad5('0x57')]['ids'],_['omit'](_0x3a09fe[_0x2ad5('0x57')],['ids','id'])||{})[_0x2ad5('0x8a')](function(_0x1bd44b){for(var _0x59f6c3=0x0;_0x59f6c3<_0x3a09fe['body'][_0x2ad5('0x68')]['length'];_0x59f6c3+=0x1){socket[_0x2ad5('0x71')](_0x2ad5('0x72'),{'UserId':Number(_0x3a09fe['body']['ids'][_0x59f6c3]),'FaxQueueId':Number(_0x3a09fe[_0x2ad5('0x4b')]['id'])});}return _0x1bd44b;});}})[_0x2ad5('0x2c')](respondWithResult(_0xd02597,null))[_0x2ad5('0x4a')](handleError(_0xd02597,null));};exports[_0x2ad5('0x86')]=function(_0xc93f9c,_0x330188,_0x3c4ba4){return db['FaxQueue'][_0x2ad5('0x4e')]({'where':{'id':_0xc93f9c[_0x2ad5('0x4b')]['id']}})[_0x2ad5('0x2c')](handleEntityNotFound(_0x330188,null))[_0x2ad5('0x2c')](function(_0x3b2f30){if(_0x3b2f30){return _0x3b2f30['removeAgents'](_0xc93f9c[_0x2ad5('0x3b')][_0x2ad5('0x68')])['then'](function(){if(_[_0x2ad5('0x8b')](_0xc93f9c[_0x2ad5('0x3b')]['ids'])){for(var _0x5cb08e=0x0;_0x5cb08e<_0xc93f9c[_0x2ad5('0x3b')][_0x2ad5('0x68')][_0x2ad5('0x3e')];_0x5cb08e+=0x1){socket[_0x2ad5('0x71')](_0x2ad5('0x88'),{'UserId':Number(_0xc93f9c[_0x2ad5('0x3b')][_0x2ad5('0x68')][_0x5cb08e]),'FaxQueueId':Number(_0xc93f9c[_0x2ad5('0x4b')]['id'])});}}else{socket[_0x2ad5('0x71')](_0x2ad5('0x88'),{'UserId':Number(_0xc93f9c['query'][_0x2ad5('0x68')]),'FaxQueueId':Number(_0xc93f9c[_0x2ad5('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x330188,null))[_0x2ad5('0x4a')](handleError(_0x330188,null));};exports[_0x2ad5('0x8c')]=function(_0x3d454d,_0x17a58f,_0x59a831){var _0x55ad1c={};var _0x3e6845={};var _0x92fae7;var _0x79a70b;return db[_0x2ad5('0x33')][_0x2ad5('0x5a')]({'where':{'id':_0x3d454d[_0x2ad5('0x4b')]['id']}})[_0x2ad5('0x2c')](handleEntityNotFound(_0x17a58f,null))[_0x2ad5('0x2c')](function(_0x934449){if(_0x934449){_0x92fae7=_0x934449;_0x3e6845[_0x2ad5('0x3a')]=_[_0x2ad5('0x37')](db[_0x2ad5('0x5d')]['rawAttributes']);_0x3e6845['query']=_[_0x2ad5('0x37')](_0x3d454d[_0x2ad5('0x3b')]);_0x3e6845[_0x2ad5('0x38')]=_[_0x2ad5('0x39')](_0x3e6845[_0x2ad5('0x3a')],_0x3e6845['query']);_0x55ad1c[_0x2ad5('0x3c')]=_['intersection'](_0x3e6845['model'],qs[_0x2ad5('0x3d')](_0x3d454d[_0x2ad5('0x3b')]['fields']));_0x55ad1c[_0x2ad5('0x3c')]=_0x55ad1c[_0x2ad5('0x3c')][_0x2ad5('0x3e')]?_0x55ad1c[_0x2ad5('0x3c')]:_0x3e6845['model'];_0x55ad1c['order']=qs[_0x2ad5('0x41')](_0x3d454d[_0x2ad5('0x3b')][_0x2ad5('0x41')]);_0x55ad1c[_0x2ad5('0x42')]=qs[_0x2ad5('0x38')](_[_0x2ad5('0x43')](_0x3d454d[_0x2ad5('0x3b')],_0x3e6845[_0x2ad5('0x38')]));if(_0x3d454d['query']['filter']){_0x55ad1c[_0x2ad5('0x42')]=_['merge'](_0x55ad1c[_0x2ad5('0x42')],{'$or':_[_0x2ad5('0x32')](_0x55ad1c[_0x2ad5('0x3c')],function(_0x465a8f){var _0x4fcd01={};_0x4fcd01[_0x465a8f]={'$like':'%'+_0x3d454d[_0x2ad5('0x3b')][_0x2ad5('0x44')]+'%'};return _0x4fcd01;})});}_0x55ad1c=_['merge']({},_0x55ad1c,_0x3d454d[_0x2ad5('0x46')]);return _0x92fae7[_0x2ad5('0x8c')](_0x55ad1c);}})['then'](function(_0x2d29d1){if(_0x2d29d1){_0x79a70b=_0x2d29d1[_0x2ad5('0x3e')];if(!_0x3d454d[_0x2ad5('0x3b')][_0x2ad5('0x3f')]('nolimit')){_0x55ad1c[_0x2ad5('0x23')]=qs[_0x2ad5('0x23')](_0x3d454d[_0x2ad5('0x3b')][_0x2ad5('0x23')]);_0x55ad1c['offset']=qs[_0x2ad5('0x21')](_0x3d454d['query'][_0x2ad5('0x21')]);}return _0x92fae7[_0x2ad5('0x8c')](_0x55ad1c);}})['then'](function(_0x399600){if(_0x399600){return _0x399600?{'count':_0x79a70b,'rows':_0x399600}:null;}})[_0x2ad5('0x2c')](respondWithResult(_0x17a58f,null))[_0x2ad5('0x4a')](handleError(_0x17a58f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7c4ed4b..df0d7ff 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 _0xf077=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x228db3,_0xadb0b4){var _0x5c2b6f=function(_0x325968){while(--_0x325968){_0x228db3['push'](_0x228db3['shift']());}};_0x5c2b6f(++_0xadb0b4);}(_0xf077,0x133));var _0x7f07=function(_0x313796,_0x1cea29){_0x313796=_0x313796-0x0;var _0x19fe92=_0xf077[_0x313796];return _0x19fe92;};'use strict';var EventEmitter=require(_0x7f07('0x0'));var FaxQueue=require(_0x7f07('0x1'))['db'][_0x7f07('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7f07('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f07('0x4'),'afterDestroy':_0x7f07('0x5')};function emitEvent(_0x1f25ab){return function(_0x47fe82,_0x35608f,_0x53cea6){FaxQueueEvents[_0x7f07('0x6')](_0x1f25ab+':'+_0x47fe82['id'],_0x47fe82);FaxQueueEvents[_0x7f07('0x6')](_0x1f25ab,_0x47fe82);_0x53cea6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x7f07('0x7')](e,emitEvent(event));}}module[_0x7f07('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x7f55=['FaxQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3ec5ec,_0x176dd0){var _0x39e1da=function(_0x4a3618){while(--_0x4a3618){_0x3ec5ec['push'](_0x3ec5ec['shift']());}};_0x39e1da(++_0x176dd0);}(_0x7f55,0xb2));var _0x57f5=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x7f55[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0x57f5('0x0'));var FaxQueue=require(_0x57f5('0x1'))['db'][_0x57f5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x57f5('0x3'),'afterUpdate':_0x57f5('0x4'),'afterDestroy':_0x57f5('0x5')};function emitEvent(_0x486cc5){return function(_0x2cf7dc,_0x420c44,_0xd37775){FaxQueueEvents[_0x57f5('0x6')](_0x486cc5+':'+_0x2cf7dc['id'],_0x2cf7dc);FaxQueueEvents[_0x57f5('0x6')](_0x486cc5,_0x2cf7dc);_0xd37775(null);};}for(var e in events){if(events[_0x57f5('0x7')](e)){var event=events[e];FaxQueue[_0x57f5('0x8')](e,emitEvent(event));}}module[_0x57f5('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0ce71c4..7d8f616 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 _0x2d75=['fax_queues','lodash','util','api','moment','bluebird','path','rimraf','./faxQueue.attributes','exports','define'];(function(_0x2aa91e,_0x380411){var _0x1c8143=function(_0x2df28c){while(--_0x2df28c){_0x2aa91e['push'](_0x2aa91e['shift']());}};_0x1c8143(++_0x380411);}(_0x2d75,0x14b));var _0x52d7=function(_0x213969,_0x303344){_0x213969=_0x213969-0x0;var _0x5f4fca=_0x2d75[_0x213969];return _0x5f4fca;};'use strict';var _=require(_0x52d7('0x0'));var util=require(_0x52d7('0x1'));var logger=require('../../config/logger')(_0x52d7('0x2'));var moment=require(_0x52d7('0x3'));var BPromise=require(_0x52d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52d7('0x5'));var rimraf=require(_0x52d7('0x6'));var config=require('../../config/environment');var attributes=require(_0x52d7('0x7'));module[_0x52d7('0x8')]=function(_0x59b11f,_0x2436ae){return _0x59b11f[_0x52d7('0x9')]('FaxQueue',attributes,{'tableName':_0x52d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf6c=['../../config/environment','exports','fax_queues','util','api','moment','request-promise','path'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xcf6c,0x133));var _0xccf6=function(_0x11cb1d,_0x4782da){_0x11cb1d=_0x11cb1d-0x0;var _0x353d97=_0xcf6c[_0x11cb1d];return _0x353d97;};'use strict';var _=require('lodash');var util=require(_0xccf6('0x0'));var logger=require('../../config/logger')(_0xccf6('0x1'));var moment=require(_0xccf6('0x2'));var BPromise=require('bluebird');var rp=require(_0xccf6('0x3'));var fs=require('fs');var path=require(_0xccf6('0x4'));var rimraf=require('rimraf');var config=require(_0xccf6('0x5'));var attributes=require('./faxQueue.attributes');module[_0xccf6('0x6')]=function(_0x906486,_0x40aecf){return _0x906486['define']('FaxQueue',attributes,{'tableName':_0xccf6('0x7'),'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 4965d6d..d7cee1b 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 _0x78f9=['options','where','attributes','limit','include','map','model','debug','stringify','ShowFaxQueue','FaxQueue','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxQueue','raw'];(function(_0x21d61b,_0x3435d2){var _0x3fb8a2=function(_0x125746){while(--_0x125746){_0x21d61b['push'](_0x21d61b['shift']());}};_0x3fb8a2(++_0x3435d2);}(_0x78f9,0xa8));var _0x978f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x78f9[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x978f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x978f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x978f('0x2'))['db'];var utils=require(_0x978f('0x3'));var logger=require(_0x978f('0x4'))(_0x978f('0x5'));var config=require(_0x978f('0x6'));var jayson=require(_0x978f('0x7'));var client=jayson[_0x978f('0x8')][_0x978f('0x9')]({'port':0x232a});config[_0x978f('0xa')]=_[_0x978f('0xb')](config['redis'],{'host':_0x978f('0xc'),'port':0x18eb});var socket=require(_0x978f('0xd'))(new Redis(config[_0x978f('0xa')]));require(_0x978f('0xe'))[_0x978f('0xf')](socket);function respondWithRpcPromise(_0x443738,_0x17be8c,_0x47adb0){return new BPromise(function(_0x4e8be3,_0x2b5ba3){return client['request'](_0x443738,_0x47adb0)[_0x978f('0x10')](function(_0x1ba036){logger[_0x978f('0x11')](_0x978f('0x12'),_0x17be8c,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x17be8c,_0x978f('0x13'),JSON['stringify'](_0x1ba036));if(_0x1ba036[_0x978f('0x14')]){if(_0x1ba036[_0x978f('0x14')][_0x978f('0x15')]===0x1f4){logger[_0x978f('0x14')](_0x978f('0x12'),_0x17be8c,_0x1ba036['error'][_0x978f('0x16')]);return _0x2b5ba3(_0x1ba036[_0x978f('0x14')][_0x978f('0x16')]);}logger['error'](_0x978f('0x12'),_0x17be8c,_0x1ba036[_0x978f('0x14')][_0x978f('0x16')]);return _0x4e8be3(_0x1ba036[_0x978f('0x14')][_0x978f('0x16')]);}else{logger[_0x978f('0x11')](_0x978f('0x12'),_0x17be8c,_0x978f('0x13'));_0x4e8be3(_0x1ba036[_0x978f('0x17')][_0x978f('0x16')]);}})[_0x978f('0x18')](function(_0x236730){logger[_0x978f('0x14')](_0x978f('0x12'),_0x17be8c,_0x236730);_0x2b5ba3(_0x236730);});});}exports[_0x978f('0x19')]=function(_0x3b165f){var _0xf19254=this;return new Promise(function(_0x2c3e57,_0x528469){return db['FaxQueue']['findAll']({'raw':_0x3b165f['options']?_0x3b165f['options'][_0x978f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b165f[_0x978f('0x1b')]?_0x3b165f[_0x978f('0x1b')][_0x978f('0x1c')]||null:null,'attributes':_0x3b165f[_0x978f('0x1b')]?_0x3b165f[_0x978f('0x1b')][_0x978f('0x1d')]||null:null,'limit':_0x3b165f[_0x978f('0x1b')]?_0x3b165f[_0x978f('0x1b')][_0x978f('0x1e')]||null:null,'include':_0x3b165f[_0x978f('0x1b')]?_0x3b165f[_0x978f('0x1b')][_0x978f('0x1f')]?_[_0x978f('0x20')](_0x3b165f[_0x978f('0x1b')][_0x978f('0x1f')],function(_0x314af2){return{'model':db[_0x314af2['model']],'as':_0x314af2['as'],'attributes':_0x314af2['attributes'],'include':_0x314af2[_0x978f('0x1f')]?_['map'](_0x314af2[_0x978f('0x1f')],function(_0x3ddc7b){return{'model':db[_0x3ddc7b[_0x978f('0x21')]],'as':_0x3ddc7b['as'],'attributes':_0x3ddc7b[_0x978f('0x1d')],'include':_0x3ddc7b[_0x978f('0x1f')]?_['map'](_0x3ddc7b[_0x978f('0x1f')],function(_0x2bf7a6){return{'model':db[_0x2bf7a6[_0x978f('0x21')]],'as':_0x2bf7a6['as'],'attributes':_0x2bf7a6[_0x978f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x978f('0x10')](function(_0x82d046){logger[_0x978f('0x11')]('GetFaxQueue',_0x3b165f);logger[_0x978f('0x22')](_0x978f('0x19'),_0x3b165f,JSON[_0x978f('0x23')](_0x82d046));_0x2c3e57(_0x82d046);})[_0x978f('0x18')](function(_0x4f477f){logger[_0x978f('0x14')](_0x978f('0x19'),_0x4f477f[_0x978f('0x16')],_0x3b165f);_0x528469(_0xf19254['error'](0x1f4,_0x4f477f['message']));});});};exports[_0x978f('0x24')]=function(_0x50c989){var _0x45a310=this;return new Promise(function(_0x59e9cc,_0x144fc0){return db[_0x978f('0x25')][_0x978f('0x26')]({'raw':_0x50c989[_0x978f('0x1b')]?_0x50c989['options']['raw']===undefined?!![]:![]:!![],'where':_0x50c989[_0x978f('0x1b')]?_0x50c989['options'][_0x978f('0x1c')]||null:null,'attributes':_0x50c989[_0x978f('0x1b')]?_0x50c989[_0x978f('0x1b')]['attributes']||null:null,'include':_0x50c989[_0x978f('0x1b')]?_0x50c989[_0x978f('0x1b')][_0x978f('0x1f')]?_[_0x978f('0x20')](_0x50c989[_0x978f('0x1b')]['include'],function(_0x4c4954){return{'model':db[_0x4c4954[_0x978f('0x21')]],'as':_0x4c4954['as'],'attributes':_0x4c4954[_0x978f('0x1d')],'include':_0x4c4954[_0x978f('0x1f')]?_[_0x978f('0x20')](_0x4c4954[_0x978f('0x1f')],function(_0x24706a){return{'model':db[_0x24706a[_0x978f('0x21')]],'as':_0x24706a['as'],'attributes':_0x24706a[_0x978f('0x1d')],'include':_0x24706a[_0x978f('0x1f')]?_[_0x978f('0x20')](_0x24706a[_0x978f('0x1f')],function(_0x2a7ef5){return{'model':db[_0x2a7ef5[_0x978f('0x21')]],'as':_0x2a7ef5['as'],'attributes':_0x2a7ef5[_0x978f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x978f('0x10')](function(_0xd701ba){logger[_0x978f('0x11')](_0x978f('0x24'),_0x50c989);logger[_0x978f('0x22')](_0x978f('0x24'),_0x50c989,JSON[_0x978f('0x23')](_0xd701ba));_0x59e9cc(_0xd701ba);})[_0x978f('0x18')](function(_0x13f0a){logger[_0x978f('0x14')](_0x978f('0x24'),_0x13f0a['message'],_0x50c989);_0x144fc0(_0x45a310[_0x978f('0x14')](0x1f4,_0x13f0a[_0x978f('0x16')]));});});}; \ No newline at end of file +var _0x35fd=['FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowFaxQueue','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','localhost','redis','register','request','then','info'];(function(_0x4e4ee0,_0x66ce4f){var _0x2a413d=function(_0x713bbc){while(--_0x713bbc){_0x4e4ee0['push'](_0x4e4ee0['shift']());}};_0x2a413d(++_0x66ce4f);}(_0x35fd,0xa5));var _0xd35f=function(_0x17fa6c,_0x4eb7df){_0x17fa6c=_0x17fa6c-0x0;var _0x22ab8b=_0x35fd[_0x17fa6c];return _0x22ab8b;};'use strict';var _=require('lodash');var util=require(_0xd35f('0x0'));var moment=require(_0xd35f('0x1'));var BPromise=require(_0xd35f('0x2'));var rs=require(_0xd35f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd35f('0x4'))['db'];var utils=require(_0xd35f('0x5'));var logger=require('../../config/logger')(_0xd35f('0x6'));var config=require(_0xd35f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd35f('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd35f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd35f('0xa')]));require('./faxQueue.socket')[_0xd35f('0xb')](socket);function respondWithRpcPromise(_0x4c8b6a,_0x2496c9,_0x4b8f83){return new BPromise(function(_0x29171b,_0x3f471d){return client[_0xd35f('0xc')](_0x4c8b6a,_0x4b8f83)[_0xd35f('0xd')](function(_0x2087ca){logger[_0xd35f('0xe')](_0xd35f('0xf'),_0x2496c9,_0xd35f('0x10'));logger['debug'](_0xd35f('0x11'),_0x2496c9,_0xd35f('0x10'),JSON[_0xd35f('0x12')](_0x2087ca));if(_0x2087ca[_0xd35f('0x13')]){if(_0x2087ca['error']['code']===0x1f4){logger['error'](_0xd35f('0xf'),_0x2496c9,_0x2087ca[_0xd35f('0x13')][_0xd35f('0x14')]);return _0x3f471d(_0x2087ca['error'][_0xd35f('0x14')]);}logger[_0xd35f('0x13')](_0xd35f('0xf'),_0x2496c9,_0x2087ca[_0xd35f('0x13')]['message']);return _0x29171b(_0x2087ca[_0xd35f('0x13')][_0xd35f('0x14')]);}else{logger[_0xd35f('0xe')](_0xd35f('0xf'),_0x2496c9,_0xd35f('0x10'));_0x29171b(_0x2087ca[_0xd35f('0x15')]['message']);}})[_0xd35f('0x16')](function(_0x4c3968){logger[_0xd35f('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2496c9,_0x4c3968);_0x3f471d(_0x4c3968);});});}exports[_0xd35f('0x17')]=function(_0x2c6107){var _0x46cdb4=this;return new Promise(function(_0x479476,_0x1935ef){return db[_0xd35f('0x18')][_0xd35f('0x19')]({'raw':_0x2c6107[_0xd35f('0x1a')]?_0x2c6107['options'][_0xd35f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c6107[_0xd35f('0x1a')]?_0x2c6107[_0xd35f('0x1a')]['where']||null:null,'attributes':_0x2c6107[_0xd35f('0x1a')]?_0x2c6107[_0xd35f('0x1a')][_0xd35f('0x1c')]||null:null,'limit':_0x2c6107[_0xd35f('0x1a')]?_0x2c6107[_0xd35f('0x1a')][_0xd35f('0x1d')]||null:null,'include':_0x2c6107[_0xd35f('0x1a')]?_0x2c6107['options'][_0xd35f('0x1e')]?_[_0xd35f('0x1f')](_0x2c6107[_0xd35f('0x1a')][_0xd35f('0x1e')],function(_0x273ebe){return{'model':db[_0x273ebe[_0xd35f('0x20')]],'as':_0x273ebe['as'],'attributes':_0x273ebe[_0xd35f('0x1c')],'include':_0x273ebe['include']?_[_0xd35f('0x1f')](_0x273ebe[_0xd35f('0x1e')],function(_0x12e6cd){return{'model':db[_0x12e6cd['model']],'as':_0x12e6cd['as'],'attributes':_0x12e6cd[_0xd35f('0x1c')],'include':_0x12e6cd[_0xd35f('0x1e')]?_[_0xd35f('0x1f')](_0x12e6cd['include'],function(_0x583caf){return{'model':db[_0x583caf[_0xd35f('0x20')]],'as':_0x583caf['as'],'attributes':_0x583caf[_0xd35f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b6d8f){logger[_0xd35f('0xe')]('GetFaxQueue',_0x2c6107);logger[_0xd35f('0x21')](_0xd35f('0x17'),_0x2c6107,JSON[_0xd35f('0x12')](_0x3b6d8f));_0x479476(_0x3b6d8f);})[_0xd35f('0x16')](function(_0x52b67f){logger['error']('GetFaxQueue',_0x52b67f[_0xd35f('0x14')],_0x2c6107);_0x1935ef(_0x46cdb4[_0xd35f('0x13')](0x1f4,_0x52b67f[_0xd35f('0x14')]));});});};exports[_0xd35f('0x22')]=function(_0x37950b){var _0x113342=this;return new Promise(function(_0x45cdd1,_0x506cb4){return db[_0xd35f('0x18')]['find']({'raw':_0x37950b[_0xd35f('0x1a')]?_0x37950b[_0xd35f('0x1a')][_0xd35f('0x1b')]===undefined?!![]:![]:!![],'where':_0x37950b[_0xd35f('0x1a')]?_0x37950b[_0xd35f('0x1a')][_0xd35f('0x23')]||null:null,'attributes':_0x37950b[_0xd35f('0x1a')]?_0x37950b[_0xd35f('0x1a')]['attributes']||null:null,'include':_0x37950b[_0xd35f('0x1a')]?_0x37950b[_0xd35f('0x1a')][_0xd35f('0x1e')]?_[_0xd35f('0x1f')](_0x37950b[_0xd35f('0x1a')]['include'],function(_0x2c2650){return{'model':db[_0x2c2650[_0xd35f('0x20')]],'as':_0x2c2650['as'],'attributes':_0x2c2650[_0xd35f('0x1c')],'include':_0x2c2650[_0xd35f('0x1e')]?_['map'](_0x2c2650[_0xd35f('0x1e')],function(_0x14f13b){return{'model':db[_0x14f13b[_0xd35f('0x20')]],'as':_0x14f13b['as'],'attributes':_0x14f13b[_0xd35f('0x1c')],'include':_0x14f13b[_0xd35f('0x1e')]?_[_0xd35f('0x1f')](_0x14f13b[_0xd35f('0x1e')],function(_0xba52a){return{'model':db[_0xba52a[_0xd35f('0x20')]],'as':_0xba52a['as'],'attributes':_0xba52a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe1836c){logger[_0xd35f('0xe')](_0xd35f('0x22'),_0x37950b);logger[_0xd35f('0x21')](_0xd35f('0x22'),_0x37950b,JSON['stringify'](_0xe1836c));_0x45cdd1(_0xe1836c);})[_0xd35f('0x16')](function(_0x193ff5){logger[_0xd35f('0x13')]('ShowFaxQueue',_0x193ff5[_0xd35f('0x14')],_0x37950b);_0x506cb4(_0x113342[_0xd35f('0x13')](0x1f4,_0x193ff5[_0xd35f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index dfbff40..70f74ab 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 _0xab9b=['emit','removeListener','register','length','./faxQueue.events','save','remove','update'];(function(_0x7ec042,_0x8cc3ec){var _0x2d2427=function(_0x1b61f6){while(--_0x1b61f6){_0x7ec042['push'](_0x7ec042['shift']());}};_0x2d2427(++_0x8cc3ec);}(_0xab9b,0x12c));var _0xbab9=function(_0x3b0b34,_0xe6a14f){_0x3b0b34=_0x3b0b34-0x0;var _0x5f5496=_0xab9b[_0x3b0b34];return _0x5f5496;};'use strict';var FaxQueueEvents=require(_0xbab9('0x0'));var events=[_0xbab9('0x1'),_0xbab9('0x2'),_0xbab9('0x3')];function createListener(_0x36f79a,_0xc80847){return function(_0x5338e1){_0xc80847[_0xbab9('0x4')](_0x36f79a,_0x5338e1);};}function removeListener(_0x516347,_0x1cffd5){return function(){FaxQueueEvents[_0xbab9('0x5')](_0x516347,_0x1cffd5);};}exports[_0xbab9('0x6')]=function(_0x212bdb){for(var _0x114960=0x0,_0x26cde0=events[_0xbab9('0x7')];_0x114960<_0x26cde0;_0x114960++){var _0x22cdf4=events[_0x114960];var _0x428a30=createListener('faxQueue:'+_0x22cdf4,_0x212bdb);FaxQueueEvents['on'](_0x22cdf4,_0x428a30);}}; \ No newline at end of file +var _0xc747=['update','register','faxQueue:','save','remove'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xc747,0x16b));var _0x7c74=function(_0x452bed,_0x128e55){_0x452bed=_0x452bed-0x0;var _0x4bb2cf=_0xc747[_0x452bed];return _0x4bb2cf;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x7c74('0x0'),_0x7c74('0x1'),_0x7c74('0x2')];function createListener(_0x126230,_0x475b5c){return function(_0x42e873){_0x475b5c['emit'](_0x126230,_0x42e873);};}function removeListener(_0x3ac5b6,_0x3617ee){return function(){FaxQueueEvents['removeListener'](_0x3ac5b6,_0x3617ee);};}exports[_0x7c74('0x3')]=function(_0x28c2b2){for(var _0x2f1c8a=0x0,_0x3a1f55=events['length'];_0x2f1c8a<_0x3a1f55;_0x2f1c8a++){var _0x2e560b=events[_0x2f1c8a];var _0x4fbae2=createListener(_0x7c74('0x4')+_0x2e560b,_0x28c2b2);FaxQueueEvents['on'](_0x2e560b,_0x4fbae2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c064bae..ddbd6d6 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 _0x68b3=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x68b3,0x1d8));var _0x368b=function(_0x135259,_0x37861c){_0x135259=_0x135259-0x0;var _0x389c7b=_0x68b3[_0x135259];return _0x389c7b;};'use strict';var multer=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var path=require(_0x368b('0x2'));var timeout=require(_0x368b('0x3'));var express=require(_0x368b('0x4'));var router=express['Router']();var fs_extra=require(_0x368b('0x5'));var auth=require(_0x368b('0x6'));var interaction=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var controller=require('./faxQueue.controller');router[_0x368b('0x9')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0xb')]);router[_0x368b('0x9')](_0x368b('0xc'),auth[_0x368b('0xa')](),controller[_0x368b('0xd')]);router[_0x368b('0x9')](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0xf')]);router['get'](_0x368b('0x10'),auth[_0x368b('0xa')](),controller[_0x368b('0x11')]);router['get'](_0x368b('0x12'),auth[_0x368b('0xa')](),controller[_0x368b('0x13')]);router['get'](_0x368b('0x14'),auth[_0x368b('0xa')](),controller['getAgents']);router[_0x368b('0x15')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0x16')]);router[_0x368b('0x15')](_0x368b('0x12'),auth['isAuthenticated'](),controller[_0x368b('0x17')]);router[_0x368b('0x15')]('/:id/users',auth[_0x368b('0xa')](),controller[_0x368b('0x18')]);router[_0x368b('0x19')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x1a')]);router[_0x368b('0x1b')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x1c')]);router[_0x368b('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x368b('0x1d')]);router[_0x368b('0x1b')](_0x368b('0x14'),auth[_0x368b('0xa')](),controller[_0x368b('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x6f44=['/:id/users','getAgents','post','create','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','isAuthenticated','getTeams'];(function(_0x4b1ce7,_0x6b0788){var _0xf45575=function(_0x596d1f){while(--_0x596d1f){_0x4b1ce7['push'](_0x4b1ce7['shift']());}};_0xf45575(++_0x6b0788);}(_0x6f44,0x1ea));var _0x46f4=function(_0x22456b,_0x4af853){_0x22456b=_0x22456b-0x0;var _0x5de8ff=_0x6f44[_0x22456b];return _0x5de8ff;};'use strict';var multer=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var path=require('path');var timeout=require(_0x46f4('0x2'));var express=require(_0x46f4('0x3'));var router=express[_0x46f4('0x4')]();var fs_extra=require(_0x46f4('0x5'));var auth=require(_0x46f4('0x6'));var interaction=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var controller=require(_0x46f4('0x9'));router[_0x46f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x46f4('0xb')]);router[_0x46f4('0xa')](_0x46f4('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x46f4('0xa')](_0x46f4('0xd'),auth['isAuthenticated'](),controller[_0x46f4('0xe')]);router['get'](_0x46f4('0xf'),auth['isAuthenticated'](),controller[_0x46f4('0x10')]);router[_0x46f4('0xa')](_0x46f4('0x11'),auth[_0x46f4('0x12')](),controller[_0x46f4('0x13')]);router[_0x46f4('0xa')](_0x46f4('0x14'),auth[_0x46f4('0x12')](),controller[_0x46f4('0x15')]);router[_0x46f4('0x16')]('/',auth[_0x46f4('0x12')](),controller[_0x46f4('0x17')]);router['post'](_0x46f4('0x11'),auth[_0x46f4('0x12')](),controller['addTeams']);router[_0x46f4('0x16')](_0x46f4('0x14'),auth[_0x46f4('0x12')](),controller['addAgents']);router[_0x46f4('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x46f4('0x19')]);router[_0x46f4('0x1a')](_0x46f4('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/teams',auth[_0x46f4('0x12')](),controller[_0x46f4('0x1b')]);router['delete'](_0x46f4('0x14'),auth[_0x46f4('0x12')](),controller[_0x46f4('0x1c')]);module[_0x46f4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0986d15..decf4f1 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 _0xd59d=['DATE','moment','exports','STRING'];(function(_0x4f645b,_0x20ea7a){var _0x111375=function(_0x360aae){while(--_0x360aae){_0x4f645b['push'](_0x4f645b['shift']());}};_0x111375(++_0x20ea7a);}(_0xd59d,0x81));var _0xdd59=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd59d[_0x4243a3];return _0x1b2a33;};'use strict';var moment=require(_0xdd59('0x0'));var Sequelize=require('sequelize');module[_0xdd59('0x1')]={'uniqueid':{'type':Sequelize[_0xdd59('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdd59('0x2')]},'joinAt':{'type':Sequelize[_0xdd59('0x3')]},'leaveAt':{'type':Sequelize[_0xdd59('0x3')]},'acceptAt':{'type':Sequelize[_0xdd59('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdd59('0x2')]}}; \ No newline at end of file +var _0xf3c9=['DATE','sequelize','exports','STRING'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0xf3c9,0xa1));var _0x9f3c=function(_0x34570e,_0x3d50aa){_0x34570e=_0x34570e-0x0;var _0x55465f=_0xf3c9[_0x34570e];return _0x55465f;};'use strict';var moment=require('moment');var Sequelize=require(_0x9f3c('0x0'));module[_0x9f3c('0x1')]={'uniqueid':{'type':Sequelize[_0x9f3c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9f3c('0x3')]},'leaveAt':{'type':Sequelize[_0x9f3c('0x3')]},'acceptAt':{'type':Sequelize[_0x9f3c('0x3')]},'exitAt':{'type':Sequelize[_0x9f3c('0x3')]},'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 0503671..a989798 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 _0xc9b7=['end','offset','count','limit','Content-Range','json','reject','save','update','then','destroy','stack','index','map','FaxQueueReport','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','keys','rawAttributes','include','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x1b6c50,_0x16e581){var _0x13019a=function(_0x2d4e02){while(--_0x2d4e02){_0x1b6c50['push'](_0x1b6c50['shift']());}};_0x13019a(++_0x16e581);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0xc9b7[_0x109371];return _0x4fd858;};'use strict';var emlformat=require(_0x7c9b('0x0'));var rimraf=require(_0x7c9b('0x1'));var zipdir=require(_0x7c9b('0x2'));var jsonpatch=require(_0x7c9b('0x3'));var rp=require('request-promise');var moment=require(_0x7c9b('0x4'));var BPromise=require(_0x7c9b('0x5'));var Mustache=require('mustache');var util=require(_0x7c9b('0x6'));var path=require(_0x7c9b('0x7'));var sox=require(_0x7c9b('0x8'));var csv=require(_0x7c9b('0x9'));var ejs=require(_0x7c9b('0xa'));var fs=require('fs');var fs_extra=require(_0x7c9b('0xb'));var _=require(_0x7c9b('0xc'));var squel=require(_0x7c9b('0xd'));var crypto=require(_0x7c9b('0xe'));var jsforce=require(_0x7c9b('0xf'));var deskjs=require(_0x7c9b('0x10'));var toCsv=require(_0x7c9b('0x9'));var querystring=require(_0x7c9b('0x11'));var Papa=require(_0x7c9b('0x12'));var Redis=require(_0x7c9b('0x13'));var authService=require(_0x7c9b('0x14'));var qs=require(_0x7c9b('0x15'));var as=require(_0x7c9b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c9b('0x17'))(_0x7c9b('0x18'));var utils=require(_0x7c9b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7c9b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e6b13,_0x42362a){_0x42362a=_0x42362a||0xcc;return function(_0x4cdc09){if(_0x4cdc09){return _0x1e6b13[_0x7c9b('0x1b')](_0x42362a);}return _0x1e6b13[_0x7c9b('0x1c')](_0x42362a)[_0x7c9b('0x1d')]();};}function respondWithResult(_0x2e8001,_0x56f49d){_0x56f49d=_0x56f49d||0xc8;return function(_0x1ec7dd){if(_0x1ec7dd){return _0x2e8001[_0x7c9b('0x1c')](_0x56f49d)['json'](_0x1ec7dd);}};}function respondWithFilteredResult(_0x2f1ecb,_0x482e81){return function(_0x86a9ca){if(_0x86a9ca){var _0x2f1967=typeof _0x482e81[_0x7c9b('0x1e')]==='undefined'&&typeof _0x482e81['limit']==='undefined';var _0x3206b7=_0x86a9ca[_0x7c9b('0x1f')];var _0x2bb448=_0x2f1967?0x0:_0x482e81[_0x7c9b('0x1e')];var _0x18d6d5=_0x2f1967?_0x86a9ca[_0x7c9b('0x1f')]:_0x482e81['offset']+_0x482e81[_0x7c9b('0x20')];var _0x132dbe;if(_0x18d6d5>=_0x3206b7){_0x18d6d5=_0x3206b7;_0x132dbe=0xc8;}else{_0x132dbe=0xce;}_0x2f1ecb[_0x7c9b('0x1c')](_0x132dbe);return _0x2f1ecb['set'](_0x7c9b('0x21'),_0x2bb448+'-'+_0x18d6d5+'/'+_0x3206b7)[_0x7c9b('0x22')](_0x86a9ca);}return null;};}function patchUpdates(_0xb7c53e){return function(_0x456f81){try{jsonpatch['apply'](_0x456f81,_0xb7c53e,!![]);}catch(_0x4321c3){return BPromise[_0x7c9b('0x23')](_0x4321c3);}return _0x456f81[_0x7c9b('0x24')]();};}function saveUpdates(_0x4ca682,_0x1583ab){return function(_0x4d68be){if(_0x4d68be){return _0x4d68be[_0x7c9b('0x25')](_0x4ca682)[_0x7c9b('0x26')](function(_0x1f8b22){return _0x1f8b22;});}return null;};}function removeEntity(_0x3e4282,_0x1be41b){return function(_0x4c080c){if(_0x4c080c){return _0x4c080c[_0x7c9b('0x27')]()[_0x7c9b('0x26')](function(){_0x3e4282[_0x7c9b('0x1c')](0xcc)[_0x7c9b('0x1d')]();});}};}function handleEntityNotFound(_0x23be90,_0x17b63c){return function(_0x816979){if(!_0x816979){_0x23be90[_0x7c9b('0x1b')](0x194);}return _0x816979;};}function handleError(_0x269b60,_0x3750ce){_0x3750ce=_0x3750ce||0x1f4;return function(_0x47d843){logger['error'](_0x47d843[_0x7c9b('0x28')]);if(_0x47d843['name']){delete _0x47d843['name'];}_0x269b60[_0x7c9b('0x1c')](_0x3750ce)['send'](_0x47d843);};}exports[_0x7c9b('0x29')]=function(_0x17b477,_0x722b0d){var _0x17cf3c={},_0x2a7afe={},_0x2cbe6f={'count':0x0,'rows':[]};var _0x1bd094=_[_0x7c9b('0x2a')](db[_0x7c9b('0x2b')]['rawAttributes'],function(_0x405709){return{'name':_0x405709[_0x7c9b('0x2c')],'type':_0x405709[_0x7c9b('0x2d')][_0x7c9b('0x2e')]};});_0x2a7afe[_0x7c9b('0x2f')]=_[_0x7c9b('0x2a')](_0x1bd094,_0x7c9b('0x30'));_0x2a7afe[_0x7c9b('0x31')]=_['keys'](_0x17b477['query']);_0x2a7afe[_0x7c9b('0x32')]=_[_0x7c9b('0x33')](_0x2a7afe[_0x7c9b('0x2f')],_0x2a7afe[_0x7c9b('0x31')]);_0x17cf3c[_0x7c9b('0x34')]=_[_0x7c9b('0x33')](_0x2a7afe[_0x7c9b('0x2f')],qs[_0x7c9b('0x35')](_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x35')]));_0x17cf3c[_0x7c9b('0x34')]=_0x17cf3c[_0x7c9b('0x34')]['length']?_0x17cf3c[_0x7c9b('0x34')]:_0x2a7afe[_0x7c9b('0x2f')];if(!_0x17b477['query'][_0x7c9b('0x36')](_0x7c9b('0x37'))){_0x17cf3c[_0x7c9b('0x20')]=qs[_0x7c9b('0x20')](_0x17b477['query'][_0x7c9b('0x20')]);_0x17cf3c[_0x7c9b('0x1e')]=qs[_0x7c9b('0x1e')](_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x1e')]);}_0x17cf3c[_0x7c9b('0x38')]=qs[_0x7c9b('0x39')](_0x17b477['query'][_0x7c9b('0x39')]);_0x17cf3c['where']=qs['filters'](_[_0x7c9b('0x3a')](_0x17b477[_0x7c9b('0x31')],_0x2a7afe[_0x7c9b('0x32')]),_0x1bd094);if(_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x3b')]){_0x17cf3c[_0x7c9b('0x3c')]=_[_0x7c9b('0x3d')](_0x17cf3c[_0x7c9b('0x3c')],{'$or':_['map'](_0x1bd094,function(_0x559d99){if(_0x559d99[_0x7c9b('0x2d')]!==_0x7c9b('0x3e')){var _0x2a5fc4={};_0x2a5fc4[_0x559d99[_0x7c9b('0x30')]]={'$like':'%'+_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x3b')]+'%'};return _0x2a5fc4;}})});}_0x17cf3c=_[_0x7c9b('0x3d')]({},_0x17cf3c,_0x17b477[_0x7c9b('0x3f')]);var _0x1a21e2={'where':_0x17cf3c[_0x7c9b('0x3c')]};return db[_0x7c9b('0x2b')][_0x7c9b('0x1f')](_0x1a21e2)['then'](function(_0x21c04c){_0x2cbe6f[_0x7c9b('0x1f')]=_0x21c04c;if(_0x17b477[_0x7c9b('0x31')]['includeAll']){_0x17cf3c['include']=[{'all':!![]}];}return db[_0x7c9b('0x2b')][_0x7c9b('0x40')](_0x17cf3c);})[_0x7c9b('0x26')](function(_0x560bc3){_0x2cbe6f[_0x7c9b('0x41')]=_0x560bc3;return _0x2cbe6f;})['then'](respondWithFilteredResult(_0x722b0d,_0x17cf3c))['catch'](handleError(_0x722b0d,null));};exports[_0x7c9b('0x42')]=function(_0x4d070e,_0x36a4c8){var _0x1a4817={'raw':!![],'where':{'id':_0x4d070e['params']['id']}},_0xc2cae5={};_0xc2cae5[_0x7c9b('0x2f')]=_[_0x7c9b('0x43')](db[_0x7c9b('0x2b')][_0x7c9b('0x44')]);_0xc2cae5['query']=_[_0x7c9b('0x43')](_0x4d070e[_0x7c9b('0x31')]);_0xc2cae5[_0x7c9b('0x32')]=_[_0x7c9b('0x33')](_0xc2cae5[_0x7c9b('0x2f')],_0xc2cae5[_0x7c9b('0x31')]);_0x1a4817[_0x7c9b('0x34')]=_[_0x7c9b('0x33')](_0xc2cae5[_0x7c9b('0x2f')],qs[_0x7c9b('0x35')](_0x4d070e['query'][_0x7c9b('0x35')]));_0x1a4817['attributes']=_0x1a4817[_0x7c9b('0x34')]['length']?_0x1a4817[_0x7c9b('0x34')]:_0xc2cae5[_0x7c9b('0x2f')];if(_0x4d070e[_0x7c9b('0x31')]['includeAll']){_0x1a4817[_0x7c9b('0x45')]=[{'all':!![]}];}_0x1a4817=_['merge']({},_0x1a4817,_0x4d070e[_0x7c9b('0x3f')]);return db[_0x7c9b('0x2b')][_0x7c9b('0x46')](_0x1a4817)[_0x7c9b('0x26')](handleEntityNotFound(_0x36a4c8,null))[_0x7c9b('0x26')](respondWithResult(_0x36a4c8,null))['catch'](handleError(_0x36a4c8,null));};exports[_0x7c9b('0x47')]=function(_0x162537,_0x2ce1ce){return db[_0x7c9b('0x2b')][_0x7c9b('0x47')](_0x162537[_0x7c9b('0x48')],{})[_0x7c9b('0x26')](respondWithResult(_0x2ce1ce,0xc9))[_0x7c9b('0x49')](handleError(_0x2ce1ce,null));};exports['update']=function(_0x37428b,_0x4ab845){if(_0x37428b[_0x7c9b('0x48')]['id']){delete _0x37428b[_0x7c9b('0x48')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x37428b[_0x7c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ab845,null))['then'](saveUpdates(_0x37428b[_0x7c9b('0x48')],null))[_0x7c9b('0x26')](respondWithResult(_0x4ab845,null))[_0x7c9b('0x49')](handleError(_0x4ab845,null));};exports[_0x7c9b('0x27')]=function(_0x36131c,_0x2bfca0){return db[_0x7c9b('0x2b')]['find']({'where':{'id':_0x36131c[_0x7c9b('0x4a')]['id']}})[_0x7c9b('0x26')](handleEntityNotFound(_0x2bfca0,null))[_0x7c9b('0x26')](removeEntity(_0x2bfca0,null))[_0x7c9b('0x49')](handleError(_0x2bfca0,null));};exports[_0x7c9b('0x4b')]=function(_0x5c70b0,_0x359a6b){return db['FaxQueueReport'][_0x7c9b('0x4b')]()[_0x7c9b('0x26')](respondWithResult(_0x359a6b,null))[_0x7c9b('0x49')](handleError(_0x359a6b,null));}; \ No newline at end of file +var _0x7119=['fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','FaxQueueReport','rows','catch','show','params','keys','include','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0x3919ac,_0x41581c){var _0x507a38=function(_0x4a0c30){while(--_0x4a0c30){_0x3919ac['push'](_0x3919ac['shift']());}};_0x507a38(++_0x41581c);}(_0x7119,0x1c7));var _0x9711=function(_0x230639,_0x20f428){_0x230639=_0x230639-0x0;var _0x5248d7=_0x7119[_0x230639];return _0x5248d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9711('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9711('0x1'));var rp=require('request-promise');var moment=require(_0x9711('0x2'));var BPromise=require(_0x9711('0x3'));var Mustache=require(_0x9711('0x4'));var util=require(_0x9711('0x5'));var path=require('path');var sox=require(_0x9711('0x6'));var csv=require(_0x9711('0x7'));var ejs=require(_0x9711('0x8'));var fs=require('fs');var fs_extra=require(_0x9711('0x9'));var _=require(_0x9711('0xa'));var squel=require('squel');var crypto=require(_0x9711('0xb'));var jsforce=require(_0x9711('0xc'));var deskjs=require(_0x9711('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9711('0xe'));var Papa=require('papaparse');var Redis=require(_0x9711('0xf'));var authService=require(_0x9711('0x10'));var qs=require(_0x9711('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9711('0x12'));var logger=require(_0x9711('0x13'))(_0x9711('0x14'));var utils=require(_0x9711('0x15'));var config=require(_0x9711('0x16'));var licenseUtil=require(_0x9711('0x17'));var db=require(_0x9711('0x18'))['db'];function respondWithStatusCode(_0x13525d,_0xdcc5ec){_0xdcc5ec=_0xdcc5ec||0xcc;return function(_0x33249b){if(_0x33249b){return _0x13525d[_0x9711('0x19')](_0xdcc5ec);}return _0x13525d['status'](_0xdcc5ec)['end']();};}function respondWithResult(_0x2c4fc0,_0x38d721){_0x38d721=_0x38d721||0xc8;return function(_0x449c99){if(_0x449c99){return _0x2c4fc0[_0x9711('0x1a')](_0x38d721)[_0x9711('0x1b')](_0x449c99);}};}function respondWithFilteredResult(_0x592a2e,_0x3f8a3d){return function(_0x5324ce){if(_0x5324ce){var _0x376f3c=typeof _0x3f8a3d[_0x9711('0x1c')]===_0x9711('0x1d')&&typeof _0x3f8a3d[_0x9711('0x1e')]===_0x9711('0x1d');var _0x5e5816=_0x5324ce['count'];var _0x2ef16c=_0x376f3c?0x0:_0x3f8a3d[_0x9711('0x1c')];var _0x210f8b=_0x376f3c?_0x5324ce[_0x9711('0x1f')]:_0x3f8a3d[_0x9711('0x1c')]+_0x3f8a3d['limit'];var _0x3690e7;if(_0x210f8b>=_0x5e5816){_0x210f8b=_0x5e5816;_0x3690e7=0xc8;}else{_0x3690e7=0xce;}_0x592a2e[_0x9711('0x1a')](_0x3690e7);return _0x592a2e[_0x9711('0x20')](_0x9711('0x21'),_0x2ef16c+'-'+_0x210f8b+'/'+_0x5e5816)['json'](_0x5324ce);}return null;};}function patchUpdates(_0x5589b5){return function(_0x55b6d7){try{jsonpatch[_0x9711('0x22')](_0x55b6d7,_0x5589b5,!![]);}catch(_0x283703){return BPromise[_0x9711('0x23')](_0x283703);}return _0x55b6d7['save']();};}function saveUpdates(_0x3f3aa2,_0x3f3859){return function(_0x4ac003){if(_0x4ac003){return _0x4ac003[_0x9711('0x24')](_0x3f3aa2)['then'](function(_0x2dbb58){return _0x2dbb58;});}return null;};}function removeEntity(_0x4f363a,_0x3023cf){return function(_0x124eb7){if(_0x124eb7){return _0x124eb7['destroy']()[_0x9711('0x25')](function(){_0x4f363a[_0x9711('0x1a')](0xcc)[_0x9711('0x26')]();});}};}function handleEntityNotFound(_0x2db327,_0x4d2438){return function(_0x50726b){if(!_0x50726b){_0x2db327[_0x9711('0x19')](0x194);}return _0x50726b;};}function handleError(_0x1be579,_0x5e3eda){_0x5e3eda=_0x5e3eda||0x1f4;return function(_0x4d16e5){logger['error'](_0x4d16e5['stack']);if(_0x4d16e5[_0x9711('0x27')]){delete _0x4d16e5[_0x9711('0x27')];}_0x1be579['status'](_0x5e3eda)[_0x9711('0x28')](_0x4d16e5);};}exports['index']=function(_0x3ab10d,_0x38e357){var _0x5eff02={},_0x3fc5bb={},_0x1db611={'count':0x0,'rows':[]};var _0x3c6da4=_[_0x9711('0x29')](db['FaxQueueReport'][_0x9711('0x2a')],function(_0x346b70){return{'name':_0x346b70[_0x9711('0x2b')],'type':_0x346b70['type'][_0x9711('0x2c')]};});_0x3fc5bb[_0x9711('0x2d')]=_[_0x9711('0x29')](_0x3c6da4,_0x9711('0x27'));_0x3fc5bb['query']=_['keys'](_0x3ab10d[_0x9711('0x2e')]);_0x3fc5bb[_0x9711('0x2f')]=_[_0x9711('0x30')](_0x3fc5bb[_0x9711('0x2d')],_0x3fc5bb['query']);_0x5eff02['attributes']=_['intersection'](_0x3fc5bb['model'],qs['fields'](_0x3ab10d[_0x9711('0x2e')][_0x9711('0x31')]));_0x5eff02[_0x9711('0x32')]=_0x5eff02[_0x9711('0x32')][_0x9711('0x33')]?_0x5eff02[_0x9711('0x32')]:_0x3fc5bb[_0x9711('0x2d')];if(!_0x3ab10d[_0x9711('0x2e')][_0x9711('0x34')](_0x9711('0x35'))){_0x5eff02['limit']=qs[_0x9711('0x1e')](_0x3ab10d[_0x9711('0x2e')][_0x9711('0x1e')]);_0x5eff02[_0x9711('0x1c')]=qs[_0x9711('0x1c')](_0x3ab10d[_0x9711('0x2e')][_0x9711('0x1c')]);}_0x5eff02['order']=qs[_0x9711('0x36')](_0x3ab10d[_0x9711('0x2e')][_0x9711('0x36')]);_0x5eff02[_0x9711('0x37')]=qs[_0x9711('0x2f')](_[_0x9711('0x38')](_0x3ab10d[_0x9711('0x2e')],_0x3fc5bb[_0x9711('0x2f')]),_0x3c6da4);if(_0x3ab10d[_0x9711('0x2e')][_0x9711('0x39')]){_0x5eff02[_0x9711('0x37')]=_['merge'](_0x5eff02[_0x9711('0x37')],{'$or':_[_0x9711('0x29')](_0x3c6da4,function(_0x252d73){if(_0x252d73['type']!==_0x9711('0x3a')){var _0x5541d7={};_0x5541d7[_0x252d73[_0x9711('0x27')]]={'$like':'%'+_0x3ab10d[_0x9711('0x2e')]['filter']+'%'};return _0x5541d7;}})});}_0x5eff02=_[_0x9711('0x3b')]({},_0x5eff02,_0x3ab10d[_0x9711('0x3c')]);var _0x208d36={'where':_0x5eff02[_0x9711('0x37')]};return db['FaxQueueReport'][_0x9711('0x1f')](_0x208d36)[_0x9711('0x25')](function(_0xa0e9e4){_0x1db611[_0x9711('0x1f')]=_0xa0e9e4;if(_0x3ab10d['query']['includeAll']){_0x5eff02['include']=[{'all':!![]}];}return db[_0x9711('0x3d')]['findAll'](_0x5eff02);})[_0x9711('0x25')](function(_0x1bb299){_0x1db611[_0x9711('0x3e')]=_0x1bb299;return _0x1db611;})[_0x9711('0x25')](respondWithFilteredResult(_0x38e357,_0x5eff02))[_0x9711('0x3f')](handleError(_0x38e357,null));};exports[_0x9711('0x40')]=function(_0x4a0e2b,_0x242477){var _0x483cb7={'raw':!![],'where':{'id':_0x4a0e2b[_0x9711('0x41')]['id']}},_0x1b93f2={};_0x1b93f2[_0x9711('0x2d')]=_[_0x9711('0x42')](db[_0x9711('0x3d')][_0x9711('0x2a')]);_0x1b93f2['query']=_[_0x9711('0x42')](_0x4a0e2b[_0x9711('0x2e')]);_0x1b93f2['filters']=_['intersection'](_0x1b93f2[_0x9711('0x2d')],_0x1b93f2[_0x9711('0x2e')]);_0x483cb7[_0x9711('0x32')]=_[_0x9711('0x30')](_0x1b93f2[_0x9711('0x2d')],qs[_0x9711('0x31')](_0x4a0e2b[_0x9711('0x2e')][_0x9711('0x31')]));_0x483cb7[_0x9711('0x32')]=_0x483cb7[_0x9711('0x32')][_0x9711('0x33')]?_0x483cb7[_0x9711('0x32')]:_0x1b93f2[_0x9711('0x2d')];if(_0x4a0e2b['query']['includeAll']){_0x483cb7[_0x9711('0x43')]=[{'all':!![]}];}_0x483cb7=_[_0x9711('0x3b')]({},_0x483cb7,_0x4a0e2b[_0x9711('0x3c')]);return db['FaxQueueReport'][_0x9711('0x44')](_0x483cb7)[_0x9711('0x25')](handleEntityNotFound(_0x242477,null))[_0x9711('0x25')](respondWithResult(_0x242477,null))[_0x9711('0x3f')](handleError(_0x242477,null));};exports[_0x9711('0x45')]=function(_0x1cc16e,_0x4c6362){return db[_0x9711('0x3d')]['create'](_0x1cc16e[_0x9711('0x46')],{})[_0x9711('0x25')](respondWithResult(_0x4c6362,0xc9))[_0x9711('0x3f')](handleError(_0x4c6362,null));};exports[_0x9711('0x24')]=function(_0x3c0a49,_0xbd198a){if(_0x3c0a49[_0x9711('0x46')]['id']){delete _0x3c0a49[_0x9711('0x46')]['id'];}return db['FaxQueueReport'][_0x9711('0x44')]({'where':{'id':_0x3c0a49[_0x9711('0x41')]['id']}})[_0x9711('0x25')](handleEntityNotFound(_0xbd198a,null))[_0x9711('0x25')](saveUpdates(_0x3c0a49[_0x9711('0x46')],null))[_0x9711('0x25')](respondWithResult(_0xbd198a,null))[_0x9711('0x3f')](handleError(_0xbd198a,null));};exports['destroy']=function(_0x13c539,_0x3ed8a0){return db[_0x9711('0x3d')][_0x9711('0x44')]({'where':{'id':_0x13c539[_0x9711('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ed8a0,null))[_0x9711('0x25')](removeEntity(_0x3ed8a0,null))[_0x9711('0x3f')](handleError(_0x3ed8a0,null));};exports['describe']=function(_0x327b49,_0x5d0d74){return db[_0x9711('0x3d')][_0x9711('0x47')]()['then'](respondWithResult(_0x5d0d74,null))[_0x9711('0x3f')](handleError(_0x5d0d74,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5d0cefa..2024f6f 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x476590,_0x3fb542){var _0x18258c=function(_0x448adc){while(--_0x448adc){_0x476590['push'](_0x476590['shift']());}};_0x18258c(++_0x3fb542);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x65a23b,_0x4265d9){var _0x1ce42c=function(_0x27b5d1){while(--_0x27b5d1){_0x65a23b['push'](_0x65a23b['shift']());}};_0x1ce42c(++_0x4265d9);}(_0x326f,0xd1));var _0xf326=function(_0x3b5216,_0x19ef10){_0x3b5216=_0x3b5216-0x0;var _0x30ca0d=_0x326f[_0x3b5216];return _0x30ca0d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1705302..b2378f1 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 _0xcd39=['message','catch','create','body','raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','update','options','where','limit','stringify','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s'];(function(_0x5aafbd,_0x1bd92c){var _0x43c986=function(_0x5b1b67){while(--_0x5b1b67){_0x5aafbd['push'](_0x5aafbd['shift']());}};_0x43c986(++_0x1bd92c);}(_0xcd39,0x12f));var _0x9cd3=function(_0x564615,_0x51000c){_0x564615=_0x564615-0x0;var _0x3e5c3c=_0xcd39[_0x564615];return _0x3e5c3c;};'use strict';var _=require(_0x9cd3('0x0'));var util=require(_0x9cd3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cd3('0x2'));var db=require(_0x9cd3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cd3('0x4'))('rpc');var config=require(_0x9cd3('0x5'));var jayson=require(_0x9cd3('0x6'));var client=jayson[_0x9cd3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x445b8b,_0x5210da,_0x3af1a8){return new BPromise(function(_0x14d0fa,_0x17ef2c){return client[_0x9cd3('0x8')](_0x445b8b,_0x3af1a8)[_0x9cd3('0x9')](function(_0x4e6de2){logger[_0x9cd3('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x5210da,_0x9cd3('0xb'));logger[_0x9cd3('0xc')](_0x9cd3('0xd'),_0x5210da,_0x9cd3('0xb'),JSON['stringify'](_0x4e6de2));if(_0x4e6de2[_0x9cd3('0xe')]){if(_0x4e6de2[_0x9cd3('0xe')]['code']===0x1f4){logger[_0x9cd3('0xe')](_0x9cd3('0xf'),_0x5210da,_0x4e6de2[_0x9cd3('0xe')]['message']);return _0x17ef2c(_0x4e6de2['error'][_0x9cd3('0x10')]);}logger['error'](_0x9cd3('0xf'),_0x5210da,_0x4e6de2[_0x9cd3('0xe')][_0x9cd3('0x10')]);return _0x14d0fa(_0x4e6de2[_0x9cd3('0xe')][_0x9cd3('0x10')]);}else{logger[_0x9cd3('0xa')](_0x9cd3('0xf'),_0x5210da,'request\x20sent');_0x14d0fa(_0x4e6de2['result'][_0x9cd3('0x10')]);}})[_0x9cd3('0x11')](function(_0x5e09c3){logger['error'](_0x9cd3('0xf'),_0x5210da,_0x5e09c3);_0x17ef2c(_0x5e09c3);});});}exports['CreateFaxQueueReport']=function(_0x4c2319){var _0x1d4384=this;return new Promise(function(_0x34d6c2,_0x3a9c32){return db['FaxQueueReport'][_0x9cd3('0x12')](_0x4c2319[_0x9cd3('0x13')],{'raw':_0x4c2319['options']?_0x4c2319['options'][_0x9cd3('0x14')]===undefined?!![]:![]:!![]})[_0x9cd3('0x9')](function(_0x13d7ea){logger['info']('CreateFaxQueueReport',_0x4c2319);logger[_0x9cd3('0xc')](_0x9cd3('0x15'),_0x4c2319,JSON['stringify'](_0x13d7ea));_0x34d6c2(_0x13d7ea);})[_0x9cd3('0x11')](function(_0x1dca1e){logger[_0x9cd3('0xe')](_0x9cd3('0x15'),_0x1dca1e[_0x9cd3('0x10')],_0x4c2319);_0x3a9c32(_0x1d4384['error'](0x1f4,_0x1dca1e[_0x9cd3('0x10')]));});});};exports[_0x9cd3('0x16')]=function(_0xd3cc74){var _0x371e1a=this;return new Promise(function(_0x170847,_0xf3c4c){return db[_0x9cd3('0x17')][_0x9cd3('0x18')](_0xd3cc74[_0x9cd3('0x13')],{'raw':_0xd3cc74[_0x9cd3('0x19')]?_0xd3cc74[_0x9cd3('0x19')][_0x9cd3('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd3cc74[_0x9cd3('0x19')]?_0xd3cc74['options'][_0x9cd3('0x1a')]||null:null,'attributes':_0xd3cc74[_0x9cd3('0x19')]?_0xd3cc74[_0x9cd3('0x19')]['attributes']||null:null,'limit':_0xd3cc74[_0x9cd3('0x19')]?_0xd3cc74[_0x9cd3('0x19')][_0x9cd3('0x1b')]||null:null})['then'](function(_0x173bae){logger[_0x9cd3('0xa')](_0x9cd3('0x16'),_0xd3cc74);logger['debug'](_0x9cd3('0x16'),_0xd3cc74,JSON[_0x9cd3('0x1c')](_0x173bae));_0x170847(_0x173bae);})['catch'](function(_0x1bd5f0){logger[_0x9cd3('0xe')]('UpdateFaxQueueReport',_0x1bd5f0[_0x9cd3('0x10')],_0xd3cc74);_0xf3c4c(_0x371e1a[_0x9cd3('0xe')](0x1f4,_0x1bd5f0[_0x9cd3('0x10')]));});});}; \ No newline at end of file +var _0x011b=['info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x44636d,_0x327230){var _0x112eeb=function(_0x3b9b8e){while(--_0x3b9b8e){_0x44636d['push'](_0x44636d['shift']());}};_0x112eeb(++_0x327230);}(_0x011b,0x74));var _0xb011=function(_0x398941,_0x421254){_0x398941=_0x398941-0x0;var _0x2d2273=_0x011b[_0x398941];return _0x2d2273;};'use strict';var _=require(_0xb011('0x0'));var util=require(_0xb011('0x1'));var moment=require(_0xb011('0x2'));var BPromise=require('bluebird');var rs=require(_0xb011('0x3'));var fs=require('fs');var Redis=require(_0xb011('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb011('0x5'));var logger=require('../../config/logger')(_0xb011('0x6'));var config=require(_0xb011('0x7'));var jayson=require(_0xb011('0x8'));var client=jayson[_0xb011('0x9')][_0xb011('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xded262,_0x1d958d,_0x4c2537){return new BPromise(function(_0x5ba8b3,_0x361ef8){return client['request'](_0xded262,_0x4c2537)[_0xb011('0xb')](function(_0x738cb1){logger[_0xb011('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1d958d,'request\x20sent');logger['debug'](_0xb011('0xd'),_0x1d958d,_0xb011('0xe'),JSON[_0xb011('0xf')](_0x738cb1));if(_0x738cb1[_0xb011('0x10')]){if(_0x738cb1['error']['code']===0x1f4){logger['error'](_0xb011('0x11'),_0x1d958d,_0x738cb1['error'][_0xb011('0x12')]);return _0x361ef8(_0x738cb1['error'][_0xb011('0x12')]);}logger[_0xb011('0x10')](_0xb011('0x11'),_0x1d958d,_0x738cb1[_0xb011('0x10')][_0xb011('0x12')]);return _0x5ba8b3(_0x738cb1[_0xb011('0x10')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1d958d,_0xb011('0xe'));_0x5ba8b3(_0x738cb1[_0xb011('0x13')][_0xb011('0x12')]);}})['catch'](function(_0x5899aa){logger[_0xb011('0x10')](_0xb011('0x11'),_0x1d958d,_0x5899aa);_0x361ef8(_0x5899aa);});});}exports[_0xb011('0x14')]=function(_0x3bc617){var _0x66b9c5=this;return new Promise(function(_0x4ce051,_0x45c741){return db['FaxQueueReport'][_0xb011('0x15')](_0x3bc617[_0xb011('0x16')],{'raw':_0x3bc617['options']?_0x3bc617[_0xb011('0x17')][_0xb011('0x18')]===undefined?!![]:![]:!![]})[_0xb011('0xb')](function(_0x437e65){logger[_0xb011('0xc')](_0xb011('0x14'),_0x3bc617);logger['debug'](_0xb011('0x14'),_0x3bc617,JSON[_0xb011('0xf')](_0x437e65));_0x4ce051(_0x437e65);})[_0xb011('0x19')](function(_0x197e96){logger[_0xb011('0x10')]('CreateFaxQueueReport',_0x197e96[_0xb011('0x12')],_0x3bc617);_0x45c741(_0x66b9c5[_0xb011('0x10')](0x1f4,_0x197e96[_0xb011('0x12')]));});});};exports[_0xb011('0x1a')]=function(_0x4778c6){var _0x40d104=this;return new Promise(function(_0xbe9d7f,_0x277964){return db[_0xb011('0x1b')][_0xb011('0x1c')](_0x4778c6[_0xb011('0x16')],{'raw':_0x4778c6['options']?_0x4778c6['options'][_0xb011('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4778c6['options']?_0x4778c6[_0xb011('0x17')][_0xb011('0x1d')]||null:null,'attributes':_0x4778c6[_0xb011('0x17')]?_0x4778c6['options'][_0xb011('0x1e')]||null:null,'limit':_0x4778c6[_0xb011('0x17')]?_0x4778c6['options'][_0xb011('0x1f')]||null:null})['then'](function(_0x5794da){logger['info'](_0xb011('0x1a'),_0x4778c6);logger['debug']('UpdateFaxQueueReport',_0x4778c6,JSON[_0xb011('0xf')](_0x5794da));_0xbe9d7f(_0x5794da);})[_0xb011('0x19')](function(_0x5b9244){logger[_0xb011('0x10')]('UpdateFaxQueueReport',_0x5b9244[_0xb011('0x12')],_0x4778c6);_0x277964(_0x40d104['error'](0x1f4,_0x5b9244[_0xb011('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2a6c049..dd989d2 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 _0xea61=['describe','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./faxQueueReport.controller','index','get'];(function(_0x31e965,_0xbd1e54){var _0x120351=function(_0x45229d){while(--_0x45229d){_0x31e965['push'](_0x31e965['shift']());}};_0x120351(++_0xbd1e54);}(_0xea61,0xbe));var _0x1ea6=function(_0x540a29,_0x4f9ab1){_0x540a29=_0x540a29-0x0;var _0xea85fd=_0xea61[_0x540a29];return _0xea85fd;};'use strict';var multer=require(_0x1ea6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1ea6('0x1'));var express=require(_0x1ea6('0x2'));var router=express['Router']();var fs_extra=require(_0x1ea6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ea6('0x4'));var controller=require(_0x1ea6('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ea6('0x6')]);router[_0x1ea6('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1ea6('0x8')]);router[_0x1ea6('0x7')](_0x1ea6('0x9'),auth[_0x1ea6('0xa')](),controller[_0x1ea6('0xb')]);router[_0x1ea6('0xc')]('/',auth[_0x1ea6('0xa')](),controller[_0x1ea6('0xd')]);router[_0x1ea6('0xe')](_0x1ea6('0x9'),auth[_0x1ea6('0xa')](),controller[_0x1ea6('0xf')]);router[_0x1ea6('0x10')](_0x1ea6('0x9'),auth[_0x1ea6('0xa')](),controller['destroy']);module[_0x1ea6('0x11')]=router; \ No newline at end of file +var _0x640a=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2b6f6a,_0x36ce0c){var _0x105b28=function(_0x13334a){while(--_0x13334a){_0x2b6f6a['push'](_0x2b6f6a['shift']());}};_0x105b28(++_0x36ce0c);}(_0x640a,0x189));var _0xa640=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x640a[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xa640('0x0'));var util=require('util');var path=require(_0xa640('0x1'));var timeout=require(_0xa640('0x2'));var express=require(_0xa640('0x3'));var router=express['Router']();var fs_extra=require(_0xa640('0x4'));var auth=require(_0xa640('0x5'));var interaction=require(_0xa640('0x6'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xa640('0x7')]('/',auth[_0xa640('0x8')](),controller[_0xa640('0x9')]);router[_0xa640('0x7')](_0xa640('0xa'),auth[_0xa640('0x8')](),controller[_0xa640('0xb')]);router[_0xa640('0x7')](_0xa640('0xc'),auth['isAuthenticated'](),controller[_0xa640('0xd')]);router[_0xa640('0xe')]('/',auth[_0xa640('0x8')](),controller['create']);router['put'](_0xa640('0xc'),auth[_0xa640('0x8')](),controller[_0xa640('0xf')]);router[_0xa640('0x10')](_0xa640('0xc'),auth[_0xa640('0x8')](),controller[_0xa640('0x11')]);module[_0xa640('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3a8b0fb..421a0b9 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x544c03,_0x558fe4){var _0x5e86ad=function(_0x3b2aaf){while(--_0x3b2aaf){_0x544c03['push'](_0x544c03['shift']());}};_0x5e86ad(++_0x558fe4);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x9c3c94,_0x296e5a){var _0x598937=function(_0x2e3c3b){while(--_0x2e3c3b){_0x9c3c94['push'](_0x9c3c94['shift']());}};_0x598937(++_0x296e5a);}(_0x008c,0x188));var _0xc008=function(_0x2494f5,_0x1f1d3c){_0x2494f5=_0x2494f5-0x0;var _0x5c60a4=_0x008c[_0x2494f5];return _0x5c60a4;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b638aab..95d70b4 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 _0x4dd2=['../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x4dd2,0xca));var _0x24dd=function(_0x500812,_0x296a3c){_0x500812=_0x500812-0x0;var _0x4add02=_0x4dd2[_0x500812];return _0x4add02;};'use strict';var emlformat=require(_0x24dd('0x0'));var rimraf=require(_0x24dd('0x1'));var zipdir=require(_0x24dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x24dd('0x3'));var BPromise=require(_0x24dd('0x4'));var Mustache=require('mustache');var util=require(_0x24dd('0x5'));var path=require(_0x24dd('0x6'));var sox=require(_0x24dd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24dd('0x8'));var squel=require('squel');var crypto=require(_0x24dd('0x9'));var jsforce=require(_0x24dd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x24dd('0xb'));var querystring=require(_0x24dd('0xc'));var Papa=require(_0x24dd('0xd'));var Redis=require(_0x24dd('0xe'));var authService=require(_0x24dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x24dd('0x10'));var hardwareService=require(_0x24dd('0x11'));var logger=require(_0x24dd('0x12'))(_0x24dd('0x13'));var utils=require('../../config/utils');var config=require(_0x24dd('0x14'));var licenseUtil=require(_0x24dd('0x15'));var db=require(_0x24dd('0x16'))['db'];function respondWithStatusCode(_0x2768cd,_0x4de8eb){_0x4de8eb=_0x4de8eb||0xcc;return function(_0x13bc5f){if(_0x13bc5f){return _0x2768cd['sendStatus'](_0x4de8eb);}return _0x2768cd['status'](_0x4de8eb)[_0x24dd('0x17')]();};}function respondWithResult(_0x1d7705,_0x4610da){_0x4610da=_0x4610da||0xc8;return function(_0x3524b9){if(_0x3524b9){return _0x1d7705[_0x24dd('0x18')](_0x4610da)[_0x24dd('0x19')](_0x3524b9);}};}function respondWithFilteredResult(_0x39ea52,_0x4281e5){return function(_0x16a3e2){if(_0x16a3e2){var _0x2a3a28=typeof _0x4281e5[_0x24dd('0x1a')]===_0x24dd('0x1b')&&typeof _0x4281e5[_0x24dd('0x1c')]===_0x24dd('0x1b');var _0x55b58d=_0x16a3e2['count'];var _0x384703=_0x2a3a28?0x0:_0x4281e5['offset'];var _0x4a7c89=_0x2a3a28?_0x16a3e2['count']:_0x4281e5[_0x24dd('0x1a')]+_0x4281e5[_0x24dd('0x1c')];var _0x18feb9;if(_0x4a7c89>=_0x55b58d){_0x4a7c89=_0x55b58d;_0x18feb9=0xc8;}else{_0x18feb9=0xce;}_0x39ea52[_0x24dd('0x18')](_0x18feb9);return _0x39ea52['set'](_0x24dd('0x1d'),_0x384703+'-'+_0x4a7c89+'/'+_0x55b58d)[_0x24dd('0x19')](_0x16a3e2);}return null;};}function patchUpdates(_0x2e5164){return function(_0x25be8a){try{jsonpatch[_0x24dd('0x1e')](_0x25be8a,_0x2e5164,!![]);}catch(_0x532518){return BPromise[_0x24dd('0x1f')](_0x532518);}return _0x25be8a[_0x24dd('0x20')]();};}function saveUpdates(_0x36042e,_0x26d827){return function(_0x58d8fd){if(_0x58d8fd){return _0x58d8fd[_0x24dd('0x21')](_0x36042e)[_0x24dd('0x22')](function(_0x46a26e){return _0x46a26e;});}return null;};}function removeEntity(_0x221fdf,_0x261863){return function(_0x160475){if(_0x160475){return _0x160475[_0x24dd('0x23')]()[_0x24dd('0x22')](function(){_0x221fdf[_0x24dd('0x18')](0xcc)[_0x24dd('0x17')]();});}};}function handleEntityNotFound(_0x5e901a,_0x31221b){return function(_0x14b9e3){if(!_0x14b9e3){_0x5e901a[_0x24dd('0x24')](0x194);}return _0x14b9e3;};}function handleError(_0x144ee6,_0x2eb7be){_0x2eb7be=_0x2eb7be||0x1f4;return function(_0x529fb2){logger[_0x24dd('0x25')](_0x529fb2[_0x24dd('0x26')]);if(_0x529fb2[_0x24dd('0x27')]){delete _0x529fb2[_0x24dd('0x27')];}_0x144ee6[_0x24dd('0x18')](_0x2eb7be)[_0x24dd('0x28')](_0x529fb2);};}exports[_0x24dd('0x29')]=function(_0x3b2f7c,_0x1aca7f){var _0x2f16d8={},_0x4f1cb9={},_0x556b8c={'count':0x0,'rows':[]};var _0x25811a=_[_0x24dd('0x2a')](db[_0x24dd('0x2b')][_0x24dd('0x2c')],function(_0x4363b1){return{'name':_0x4363b1['fieldName'],'type':_0x4363b1[_0x24dd('0x2d')][_0x24dd('0x2e')]};});_0x4f1cb9['model']=_['map'](_0x25811a,_0x24dd('0x27'));_0x4f1cb9['query']=_['keys'](_0x3b2f7c[_0x24dd('0x2f')]);_0x4f1cb9[_0x24dd('0x30')]=_['intersection'](_0x4f1cb9[_0x24dd('0x31')],_0x4f1cb9[_0x24dd('0x2f')]);_0x2f16d8['attributes']=_[_0x24dd('0x32')](_0x4f1cb9['model'],qs[_0x24dd('0x33')](_0x3b2f7c[_0x24dd('0x2f')][_0x24dd('0x33')]));_0x2f16d8[_0x24dd('0x34')]=_0x2f16d8['attributes'][_0x24dd('0x35')]?_0x2f16d8[_0x24dd('0x34')]:_0x4f1cb9[_0x24dd('0x31')];if(!_0x3b2f7c[_0x24dd('0x2f')][_0x24dd('0x36')]('nolimit')){_0x2f16d8[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0x3b2f7c[_0x24dd('0x2f')][_0x24dd('0x1c')]);_0x2f16d8[_0x24dd('0x1a')]=qs[_0x24dd('0x1a')](_0x3b2f7c[_0x24dd('0x2f')]['offset']);}_0x2f16d8[_0x24dd('0x37')]=qs['sort'](_0x3b2f7c[_0x24dd('0x2f')][_0x24dd('0x38')]);_0x2f16d8['where']=qs[_0x24dd('0x30')](_['pick'](_0x3b2f7c[_0x24dd('0x2f')],_0x4f1cb9[_0x24dd('0x30')]),_0x25811a);if(_0x3b2f7c[_0x24dd('0x2f')]['filter']){_0x2f16d8['where']=_[_0x24dd('0x39')](_0x2f16d8[_0x24dd('0x3a')],{'$or':_[_0x24dd('0x2a')](_0x25811a,function(_0x557435){if(_0x557435[_0x24dd('0x2d')]!==_0x24dd('0x3b')){var _0xdd0f84={};_0xdd0f84[_0x557435[_0x24dd('0x27')]]={'$like':'%'+_0x3b2f7c[_0x24dd('0x2f')][_0x24dd('0x3c')]+'%'};return _0xdd0f84;}})});}_0x2f16d8=_[_0x24dd('0x39')]({},_0x2f16d8,_0x3b2f7c[_0x24dd('0x3d')]);var _0x1a1b19={'where':_0x2f16d8[_0x24dd('0x3a')]};return db[_0x24dd('0x2b')][_0x24dd('0x3e')](_0x1a1b19)[_0x24dd('0x22')](function(_0x4d5dc5){_0x556b8c['count']=_0x4d5dc5;if(_0x3b2f7c[_0x24dd('0x2f')][_0x24dd('0x3f')]){_0x2f16d8[_0x24dd('0x40')]=[{'all':!![]}];}return db[_0x24dd('0x2b')]['findAll'](_0x2f16d8);})['then'](function(_0x3c7a19){_0x556b8c[_0x24dd('0x41')]=_0x3c7a19;return _0x556b8c;})[_0x24dd('0x22')](respondWithFilteredResult(_0x1aca7f,_0x2f16d8))[_0x24dd('0x42')](handleError(_0x1aca7f,null));};exports[_0x24dd('0x43')]=function(_0x582479,_0x12ff5c){var _0x4f40fc={'raw':!![],'where':{'id':_0x582479[_0x24dd('0x44')]['id']}},_0x2f7348={};_0x2f7348['model']=_[_0x24dd('0x45')](db['FaxTransferReport'][_0x24dd('0x2c')]);_0x2f7348['query']=_[_0x24dd('0x45')](_0x582479['query']);_0x2f7348[_0x24dd('0x30')]=_[_0x24dd('0x32')](_0x2f7348[_0x24dd('0x31')],_0x2f7348[_0x24dd('0x2f')]);_0x4f40fc[_0x24dd('0x34')]=_['intersection'](_0x2f7348[_0x24dd('0x31')],qs[_0x24dd('0x33')](_0x582479[_0x24dd('0x2f')][_0x24dd('0x33')]));_0x4f40fc['attributes']=_0x4f40fc[_0x24dd('0x34')][_0x24dd('0x35')]?_0x4f40fc['attributes']:_0x2f7348['model'];if(_0x582479['query'][_0x24dd('0x3f')]){_0x4f40fc['include']=[{'all':!![]}];}_0x4f40fc=_[_0x24dd('0x39')]({},_0x4f40fc,_0x582479[_0x24dd('0x3d')]);return db[_0x24dd('0x2b')][_0x24dd('0x46')](_0x4f40fc)[_0x24dd('0x22')](handleEntityNotFound(_0x12ff5c,null))[_0x24dd('0x22')](respondWithResult(_0x12ff5c,null))[_0x24dd('0x42')](handleError(_0x12ff5c,null));};exports[_0x24dd('0x47')]=function(_0x18338e,_0x2578dd){return db[_0x24dd('0x2b')][_0x24dd('0x47')](_0x18338e[_0x24dd('0x48')],{})['then'](respondWithResult(_0x2578dd,0xc9))[_0x24dd('0x42')](handleError(_0x2578dd,null));};exports[_0x24dd('0x21')]=function(_0x1564d3,_0x5fc043){if(_0x1564d3[_0x24dd('0x48')]['id']){delete _0x1564d3[_0x24dd('0x48')]['id'];}return db[_0x24dd('0x2b')][_0x24dd('0x46')]({'where':{'id':_0x1564d3[_0x24dd('0x44')]['id']}})[_0x24dd('0x22')](handleEntityNotFound(_0x5fc043,null))[_0x24dd('0x22')](saveUpdates(_0x1564d3[_0x24dd('0x48')],null))[_0x24dd('0x22')](respondWithResult(_0x5fc043,null))['catch'](handleError(_0x5fc043,null));};exports[_0x24dd('0x23')]=function(_0x1d0ba8,_0x4b6505){return db[_0x24dd('0x2b')][_0x24dd('0x46')]({'where':{'id':_0x1d0ba8[_0x24dd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b6505,null))[_0x24dd('0x22')](removeEntity(_0x4b6505,null))['catch'](handleError(_0x4b6505,null));};exports[_0x24dd('0x49')]=function(_0x5b9fe4,_0x2f0adb){return db[_0x24dd('0x2b')][_0x24dd('0x49')]()[_0x24dd('0x22')](respondWithResult(_0x2f0adb,null))[_0x24dd('0x42')](handleError(_0x2f0adb,null));}; \ No newline at end of file +var _0xceba=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','update','then','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick'];(function(_0x233d84,_0x3f63c9){var _0x33f28f=function(_0x27646b){while(--_0x27646b){_0x233d84['push'](_0x233d84['shift']());}};_0x33f28f(++_0x3f63c9);}(_0xceba,0xb4));var _0xaceb=function(_0x3f97c6,_0x3844dc){_0x3f97c6=_0x3f97c6-0x0;var _0x25fe28=_0xceba[_0x3f97c6];return _0x25fe28;};'use strict';var emlformat=require(_0xaceb('0x0'));var rimraf=require(_0xaceb('0x1'));var zipdir=require(_0xaceb('0x2'));var jsonpatch=require(_0xaceb('0x3'));var rp=require('request-promise');var moment=require(_0xaceb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaceb('0x5'));var util=require(_0xaceb('0x6'));var path=require(_0xaceb('0x7'));var sox=require(_0xaceb('0x8'));var csv=require(_0xaceb('0x9'));var ejs=require(_0xaceb('0xa'));var fs=require('fs');var fs_extra=require(_0xaceb('0xb'));var _=require(_0xaceb('0xc'));var squel=require(_0xaceb('0xd'));var crypto=require(_0xaceb('0xe'));var jsforce=require(_0xaceb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaceb('0x10'));var Papa=require(_0xaceb('0x11'));var Redis=require(_0xaceb('0x12'));var authService=require(_0xaceb('0x13'));var qs=require(_0xaceb('0x14'));var as=require(_0xaceb('0x15'));var hardwareService=require(_0xaceb('0x16'));var logger=require(_0xaceb('0x17'))(_0xaceb('0x18'));var utils=require(_0xaceb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xaceb('0x1a'));var db=require(_0xaceb('0x1b'))['db'];function respondWithStatusCode(_0x16fcba,_0x4a5734){_0x4a5734=_0x4a5734||0xcc;return function(_0x461276){if(_0x461276){return _0x16fcba[_0xaceb('0x1c')](_0x4a5734);}return _0x16fcba[_0xaceb('0x1d')](_0x4a5734)[_0xaceb('0x1e')]();};}function respondWithResult(_0x55cc49,_0x2060ad){_0x2060ad=_0x2060ad||0xc8;return function(_0xe35566){if(_0xe35566){return _0x55cc49[_0xaceb('0x1d')](_0x2060ad)[_0xaceb('0x1f')](_0xe35566);}};}function respondWithFilteredResult(_0x2b839e,_0x40960e){return function(_0x5a6617){if(_0x5a6617){var _0x397be8=typeof _0x40960e['offset']==='undefined'&&typeof _0x40960e[_0xaceb('0x20')]===_0xaceb('0x21');var _0x282930=_0x5a6617[_0xaceb('0x22')];var _0x5137e2=_0x397be8?0x0:_0x40960e[_0xaceb('0x23')];var _0x25d2b4=_0x397be8?_0x5a6617[_0xaceb('0x22')]:_0x40960e[_0xaceb('0x23')]+_0x40960e[_0xaceb('0x20')];var _0x568491;if(_0x25d2b4>=_0x282930){_0x25d2b4=_0x282930;_0x568491=0xc8;}else{_0x568491=0xce;}_0x2b839e['status'](_0x568491);return _0x2b839e[_0xaceb('0x24')](_0xaceb('0x25'),_0x5137e2+'-'+_0x25d2b4+'/'+_0x282930)['json'](_0x5a6617);}return null;};}function patchUpdates(_0x10459f){return function(_0x3acd5e){try{jsonpatch['apply'](_0x3acd5e,_0x10459f,!![]);}catch(_0x27d841){return BPromise['reject'](_0x27d841);}return _0x3acd5e[_0xaceb('0x26')]();};}function saveUpdates(_0x505e8c,_0x395896){return function(_0x4cf0cd){if(_0x4cf0cd){return _0x4cf0cd[_0xaceb('0x27')](_0x505e8c)[_0xaceb('0x28')](function(_0x59822f){return _0x59822f;});}return null;};}function removeEntity(_0xd3c809,_0x56738a){return function(_0x70e577){if(_0x70e577){return _0x70e577['destroy']()[_0xaceb('0x28')](function(){_0xd3c809[_0xaceb('0x1d')](0xcc)[_0xaceb('0x1e')]();});}};}function handleEntityNotFound(_0x56d271,_0x56510e){return function(_0x5a7b7a){if(!_0x5a7b7a){_0x56d271['sendStatus'](0x194);}return _0x5a7b7a;};}function handleError(_0xcc91d1,_0x492aab){_0x492aab=_0x492aab||0x1f4;return function(_0x2ff3d2){logger[_0xaceb('0x29')](_0x2ff3d2[_0xaceb('0x2a')]);if(_0x2ff3d2[_0xaceb('0x2b')]){delete _0x2ff3d2[_0xaceb('0x2b')];}_0xcc91d1[_0xaceb('0x1d')](_0x492aab)[_0xaceb('0x2c')](_0x2ff3d2);};}exports[_0xaceb('0x2d')]=function(_0x5775df,_0x5ee0b9){var _0x4d0bca={},_0x120132={},_0x5734d4={'count':0x0,'rows':[]};var _0x5f3bea=_[_0xaceb('0x2e')](db[_0xaceb('0x2f')]['rawAttributes'],function(_0x7ea198){return{'name':_0x7ea198[_0xaceb('0x30')],'type':_0x7ea198[_0xaceb('0x31')][_0xaceb('0x32')]};});_0x120132['model']=_[_0xaceb('0x2e')](_0x5f3bea,'name');_0x120132['query']=_['keys'](_0x5775df[_0xaceb('0x33')]);_0x120132[_0xaceb('0x34')]=_['intersection'](_0x120132[_0xaceb('0x35')],_0x120132[_0xaceb('0x33')]);_0x4d0bca[_0xaceb('0x36')]=_[_0xaceb('0x37')](_0x120132['model'],qs[_0xaceb('0x38')](_0x5775df[_0xaceb('0x33')][_0xaceb('0x38')]));_0x4d0bca[_0xaceb('0x36')]=_0x4d0bca[_0xaceb('0x36')][_0xaceb('0x39')]?_0x4d0bca[_0xaceb('0x36')]:_0x120132[_0xaceb('0x35')];if(!_0x5775df[_0xaceb('0x33')]['hasOwnProperty'](_0xaceb('0x3a'))){_0x4d0bca[_0xaceb('0x20')]=qs[_0xaceb('0x20')](_0x5775df[_0xaceb('0x33')][_0xaceb('0x20')]);_0x4d0bca[_0xaceb('0x23')]=qs[_0xaceb('0x23')](_0x5775df['query'][_0xaceb('0x23')]);}_0x4d0bca[_0xaceb('0x3b')]=qs[_0xaceb('0x3c')](_0x5775df[_0xaceb('0x33')][_0xaceb('0x3c')]);_0x4d0bca[_0xaceb('0x3d')]=qs['filters'](_[_0xaceb('0x3e')](_0x5775df[_0xaceb('0x33')],_0x120132[_0xaceb('0x34')]),_0x5f3bea);if(_0x5775df['query'][_0xaceb('0x3f')]){_0x4d0bca[_0xaceb('0x3d')]=_[_0xaceb('0x40')](_0x4d0bca[_0xaceb('0x3d')],{'$or':_['map'](_0x5f3bea,function(_0x23e44f){if(_0x23e44f[_0xaceb('0x31')]!==_0xaceb('0x41')){var _0x48c03b={};_0x48c03b[_0x23e44f['name']]={'$like':'%'+_0x5775df[_0xaceb('0x33')][_0xaceb('0x3f')]+'%'};return _0x48c03b;}})});}_0x4d0bca=_[_0xaceb('0x40')]({},_0x4d0bca,_0x5775df[_0xaceb('0x42')]);var _0x1ae497={'where':_0x4d0bca[_0xaceb('0x3d')]};return db[_0xaceb('0x2f')]['count'](_0x1ae497)['then'](function(_0x106c33){_0x5734d4['count']=_0x106c33;if(_0x5775df[_0xaceb('0x33')][_0xaceb('0x43')]){_0x4d0bca[_0xaceb('0x44')]=[{'all':!![]}];}return db[_0xaceb('0x2f')][_0xaceb('0x45')](_0x4d0bca);})[_0xaceb('0x28')](function(_0x5cdee2){_0x5734d4[_0xaceb('0x46')]=_0x5cdee2;return _0x5734d4;})[_0xaceb('0x28')](respondWithFilteredResult(_0x5ee0b9,_0x4d0bca))[_0xaceb('0x47')](handleError(_0x5ee0b9,null));};exports[_0xaceb('0x48')]=function(_0x930562,_0x49edb1){var _0x35c0fe={'raw':!![],'where':{'id':_0x930562[_0xaceb('0x49')]['id']}},_0x53c1b4={};_0x53c1b4['model']=_[_0xaceb('0x4a')](db[_0xaceb('0x2f')][_0xaceb('0x4b')]);_0x53c1b4[_0xaceb('0x33')]=_['keys'](_0x930562[_0xaceb('0x33')]);_0x53c1b4[_0xaceb('0x34')]=_[_0xaceb('0x37')](_0x53c1b4[_0xaceb('0x35')],_0x53c1b4[_0xaceb('0x33')]);_0x35c0fe[_0xaceb('0x36')]=_[_0xaceb('0x37')](_0x53c1b4[_0xaceb('0x35')],qs[_0xaceb('0x38')](_0x930562[_0xaceb('0x33')][_0xaceb('0x38')]));_0x35c0fe[_0xaceb('0x36')]=_0x35c0fe['attributes'][_0xaceb('0x39')]?_0x35c0fe[_0xaceb('0x36')]:_0x53c1b4[_0xaceb('0x35')];if(_0x930562['query'][_0xaceb('0x43')]){_0x35c0fe[_0xaceb('0x44')]=[{'all':!![]}];}_0x35c0fe=_[_0xaceb('0x40')]({},_0x35c0fe,_0x930562['options']);return db[_0xaceb('0x2f')][_0xaceb('0x4c')](_0x35c0fe)[_0xaceb('0x28')](handleEntityNotFound(_0x49edb1,null))[_0xaceb('0x28')](respondWithResult(_0x49edb1,null))['catch'](handleError(_0x49edb1,null));};exports[_0xaceb('0x4d')]=function(_0x412e59,_0x551a6d){return db[_0xaceb('0x2f')][_0xaceb('0x4d')](_0x412e59[_0xaceb('0x4e')],{})[_0xaceb('0x28')](respondWithResult(_0x551a6d,0xc9))['catch'](handleError(_0x551a6d,null));};exports['update']=function(_0x368cd8,_0x540348){if(_0x368cd8[_0xaceb('0x4e')]['id']){delete _0x368cd8[_0xaceb('0x4e')]['id'];}return db['FaxTransferReport'][_0xaceb('0x4c')]({'where':{'id':_0x368cd8[_0xaceb('0x49')]['id']}})['then'](handleEntityNotFound(_0x540348,null))[_0xaceb('0x28')](saveUpdates(_0x368cd8[_0xaceb('0x4e')],null))[_0xaceb('0x28')](respondWithResult(_0x540348,null))[_0xaceb('0x47')](handleError(_0x540348,null));};exports[_0xaceb('0x4f')]=function(_0x5c4aa6,_0x436a08){return db['FaxTransferReport'][_0xaceb('0x4c')]({'where':{'id':_0x5c4aa6[_0xaceb('0x49')]['id']}})[_0xaceb('0x28')](handleEntityNotFound(_0x436a08,null))[_0xaceb('0x28')](removeEntity(_0x436a08,null))[_0xaceb('0x47')](handleError(_0x436a08,null));};exports['describe']=function(_0x32511a,_0x365663){return db[_0xaceb('0x2f')][_0xaceb('0x50')]()[_0xaceb('0x28')](respondWithResult(_0x365663,null))['catch'](handleError(_0x365663,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index bc09d99..e9503ac 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 _0xa227=['api','moment','bluebird','./faxTransferReport.attributes','exports','define','uniqueid','util','../../config/logger'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0xa227,0x16f));var _0x7a22=function(_0x2ad447,_0x2860a9){_0x2ad447=_0x2ad447-0x0;var _0x5e34df=_0xa227[_0x2ad447];return _0x5e34df;};'use strict';var _=require('lodash');var util=require(_0x7a22('0x0'));var logger=require(_0x7a22('0x1'))(_0x7a22('0x2'));var moment=require(_0x7a22('0x3'));var BPromise=require(_0x7a22('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(_0x7a22('0x5'));module[_0x7a22('0x6')]=function(_0x13f20c,_0x14a526){return _0x13f20c[_0x7a22('0x7')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x7a22('0x8'),'fields':[_0x7a22('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1de7=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x211e34,_0x482f6b){var _0x1bf25b=function(_0x4f817f){while(--_0x4f817f){_0x211e34['push'](_0x211e34['shift']());}};_0x1bf25b(++_0x482f6b);}(_0x1de7,0x1de));var _0x71de=function(_0x4daf02,_0x58e1bb){_0x4daf02=_0x4daf02-0x0;var _0xdc6982=_0x1de7[_0x4daf02];return _0xdc6982;};'use strict';var _=require(_0x71de('0x0'));var util=require(_0x71de('0x1'));var logger=require(_0x71de('0x2'))('api');var moment=require(_0x71de('0x3'));var BPromise=require(_0x71de('0x4'));var rp=require(_0x71de('0x5'));var fs=require('fs');var path=require(_0x71de('0x6'));var rimraf=require(_0x71de('0x7'));var config=require(_0x71de('0x8'));var attributes=require(_0x71de('0x9'));module[_0x71de('0xa')]=function(_0x4a0047,_0x48624a){return _0x4a0047['define'](_0x71de('0xb'),attributes,{'tableName':_0x71de('0xc'),'paranoid':![],'indexes':[{'name':_0x71de('0xd'),'fields':[_0x71de('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 14dd0e3..ef9a886 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 _0xf052=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf052,0x1c6));var _0x2f05=function(_0x5111a9,_0x353fa5){_0x5111a9=_0x5111a9-0x0;var _0x59a15a=_0xf052[_0x5111a9];return _0x59a15a;};'use strict';var _=require(_0x2f05('0x0'));var util=require('util');var moment=require(_0x2f05('0x1'));var BPromise=require(_0x2f05('0x2'));var rs=require(_0x2f05('0x3'));var fs=require('fs');var Redis=require(_0x2f05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f05('0x5'));var logger=require(_0x2f05('0x6'))(_0x2f05('0x7'));var config=require('../../config/environment');var jayson=require(_0x2f05('0x8'));var client=jayson[_0x2f05('0x9')][_0x2f05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x461166,_0x4c67d1,_0x37d370){return new BPromise(function(_0x220808,_0x192a04){return client[_0x2f05('0xb')](_0x461166,_0x37d370)[_0x2f05('0xc')](function(_0x203d9d){logger[_0x2f05('0xd')](_0x2f05('0xe'),_0x4c67d1,'request\x20sent');logger['debug'](_0x2f05('0xf'),_0x4c67d1,_0x2f05('0x10'),JSON[_0x2f05('0x11')](_0x203d9d));if(_0x203d9d['error']){if(_0x203d9d[_0x2f05('0x12')][_0x2f05('0x13')]===0x1f4){logger[_0x2f05('0x12')](_0x2f05('0xe'),_0x4c67d1,_0x203d9d[_0x2f05('0x12')][_0x2f05('0x14')]);return _0x192a04(_0x203d9d['error'][_0x2f05('0x14')]);}logger['error'](_0x2f05('0xe'),_0x4c67d1,_0x203d9d['error'][_0x2f05('0x14')]);return _0x220808(_0x203d9d[_0x2f05('0x12')][_0x2f05('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x4c67d1,_0x2f05('0x10'));_0x220808(_0x203d9d[_0x2f05('0x15')]['message']);}})[_0x2f05('0x16')](function(_0x40be69){logger[_0x2f05('0x12')](_0x2f05('0xe'),_0x4c67d1,_0x40be69);_0x192a04(_0x40be69);});});} \ No newline at end of file +var _0xbe4d=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x139841,_0x59e4d5){var _0x1a018f=function(_0x52cdcf){while(--_0x52cdcf){_0x139841['push'](_0x139841['shift']());}};_0x1a018f(++_0x59e4d5);}(_0xbe4d,0x170));var _0xdbe4=function(_0x367753,_0x37b526){_0x367753=_0x367753-0x0;var _0x52cb58=_0xbe4d[_0x367753];return _0x52cb58;};'use strict';var _=require(_0xdbe4('0x0'));var util=require(_0xdbe4('0x1'));var moment=require(_0xdbe4('0x2'));var BPromise=require(_0xdbe4('0x3'));var rs=require(_0xdbe4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbe4('0x5'));var logger=require('../../config/logger')(_0xdbe4('0x6'));var config=require(_0xdbe4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdbe4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36178a,_0x33f0ca,_0x2f6d03){return new BPromise(function(_0x1f2a65,_0x59ba22){return client['request'](_0x36178a,_0x2f6d03)['then'](function(_0xcdb1fd){logger[_0xdbe4('0x9')](_0xdbe4('0xa'),_0x33f0ca,_0xdbe4('0xb'));logger[_0xdbe4('0xc')](_0xdbe4('0xd'),_0x33f0ca,'request\x20sent',JSON[_0xdbe4('0xe')](_0xcdb1fd));if(_0xcdb1fd[_0xdbe4('0xf')]){if(_0xcdb1fd[_0xdbe4('0xf')]['code']===0x1f4){logger['error'](_0xdbe4('0xa'),_0x33f0ca,_0xcdb1fd[_0xdbe4('0xf')][_0xdbe4('0x10')]);return _0x59ba22(_0xcdb1fd[_0xdbe4('0xf')][_0xdbe4('0x10')]);}logger[_0xdbe4('0xf')](_0xdbe4('0xa'),_0x33f0ca,_0xcdb1fd['error'][_0xdbe4('0x10')]);return _0x1f2a65(_0xcdb1fd[_0xdbe4('0xf')][_0xdbe4('0x10')]);}else{logger['info'](_0xdbe4('0xa'),_0x33f0ca,_0xdbe4('0xb'));_0x1f2a65(_0xcdb1fd[_0xdbe4('0x11')][_0xdbe4('0x10')]);}})[_0xdbe4('0x12')](function(_0x1986b4){logger[_0xdbe4('0xf')](_0xdbe4('0xa'),_0x33f0ca,_0x1986b4);_0x59ba22(_0x1986b4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ccc06e6..100d368 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 _0xafb4=['/describe','describe','post','create','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0xafb4,0xff));var _0x4afb=function(_0x457eb5,_0x4d523e){_0x457eb5=_0x457eb5-0x0;var _0x12e9f9=_0xafb4[_0x457eb5];return _0x12e9f9;};'use strict';var multer=require(_0x4afb('0x0'));var util=require('util');var path=require(_0x4afb('0x1'));var timeout=require(_0x4afb('0x2'));var express=require(_0x4afb('0x3'));var router=express[_0x4afb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4afb('0x5'));var interaction=require(_0x4afb('0x6'));var config=require(_0x4afb('0x7'));var controller=require(_0x4afb('0x8'));router[_0x4afb('0x9')]('/',auth[_0x4afb('0xa')](),controller['index']);router[_0x4afb('0x9')](_0x4afb('0xb'),auth[_0x4afb('0xa')](),controller[_0x4afb('0xc')]);router[_0x4afb('0x9')]('/:id',auth[_0x4afb('0xa')](),controller['show']);router[_0x4afb('0xd')]('/',auth[_0x4afb('0xa')](),controller[_0x4afb('0xe')]);router['put'](_0x4afb('0xf'),auth[_0x4afb('0xa')](),controller[_0x4afb('0x10')]);router[_0x4afb('0x11')]('/:id',auth[_0x4afb('0xa')](),controller['destroy']);module[_0x4afb('0x12')]=router; \ No newline at end of file +var _0xfbbd=['update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0xd93482,_0xa1a4a6){var _0x3499d1=function(_0x5e400a){while(--_0x5e400a){_0xd93482['push'](_0xd93482['shift']());}};_0x3499d1(++_0xa1a4a6);}(_0xfbbd,0x191));var _0xdfbb=function(_0x6fed9d,_0xbaa71d){_0x6fed9d=_0x6fed9d-0x0;var _0x417dfb=_0xfbbd[_0x6fed9d];return _0x417dfb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdfbb('0x0'));var timeout=require(_0xdfbb('0x1'));var express=require(_0xdfbb('0x2'));var router=express[_0xdfbb('0x3')]();var fs_extra=require(_0xdfbb('0x4'));var auth=require(_0xdfbb('0x5'));var interaction=require(_0xdfbb('0x6'));var config=require(_0xdfbb('0x7'));var controller=require('./faxTransferReport.controller');router[_0xdfbb('0x8')]('/',auth['isAuthenticated'](),controller[_0xdfbb('0x9')]);router[_0xdfbb('0x8')]('/describe',auth[_0xdfbb('0xa')](),controller[_0xdfbb('0xb')]);router[_0xdfbb('0x8')](_0xdfbb('0xc'),auth[_0xdfbb('0xa')](),controller[_0xdfbb('0xd')]);router[_0xdfbb('0xe')]('/',auth[_0xdfbb('0xa')](),controller[_0xdfbb('0xf')]);router[_0xdfbb('0x10')](_0xdfbb('0xc'),auth[_0xdfbb('0xa')](),controller[_0xdfbb('0x11')]);router['delete'](_0xdfbb('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xdfbb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f49f08c..e3c44b3 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 _0x29b2=['/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x29b2,0xae));var _0x229b=function(_0x1e219d,_0x35cc5a){_0x1e219d=_0x1e219d-0x0;var _0x4d4a9a=_0x29b2[_0x1e219d];return _0x4d4a9a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x229b('0x0'));var timeout=require(_0x229b('0x1'));var express=require(_0x229b('0x2'));var router=express['Router']();var fs_extra=require(_0x229b('0x3'));var auth=require(_0x229b('0x4'));var interaction=require(_0x229b('0x5'));var config=require('../../config/environment');var controller=require(_0x229b('0x6'));router[_0x229b('0x7')]('/',auth[_0x229b('0x8')](),controller[_0x229b('0x9')]);router['get'](_0x229b('0xa'),auth[_0x229b('0x8')](),controller[_0x229b('0xb')]);router[_0x229b('0x7')]('/:id/configurations',auth[_0x229b('0x8')](),controller[_0x229b('0xc')]);router[_0x229b('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x229b('0xd')]);router[_0x229b('0xe')]('/',auth['isAuthenticated'](),controller[_0x229b('0xf')]);router[_0x229b('0xe')](_0x229b('0x10'),auth[_0x229b('0x8')](),controller[_0x229b('0x11')]);router[_0x229b('0x12')](_0x229b('0xa'),auth[_0x229b('0x8')](),controller[_0x229b('0x13')]);router[_0x229b('0x14')](_0x229b('0xa'),auth[_0x229b('0x8')](),controller[_0x229b('0x15')]);module[_0x229b('0x16')]=router; \ No newline at end of file +var _0xef47=['create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xef47,0x11b));var _0x7ef4=function(_0x3a3946,_0x328610){_0x3a3946=_0x3a3946-0x0;var _0x55c835=_0xef47[_0x3a3946];return _0x55c835;};'use strict';var multer=require(_0x7ef4('0x0'));var util=require(_0x7ef4('0x1'));var path=require(_0x7ef4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ef4('0x3')]();var fs_extra=require(_0x7ef4('0x4'));var auth=require(_0x7ef4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7ef4('0x6'));var controller=require(_0x7ef4('0x7'));router['get']('/',auth[_0x7ef4('0x8')](),controller[_0x7ef4('0x9')]);router[_0x7ef4('0xa')](_0x7ef4('0xb'),auth[_0x7ef4('0x8')](),controller[_0x7ef4('0xc')]);router['get']('/:id/configurations',auth[_0x7ef4('0x8')](),controller[_0x7ef4('0xd')]);router['get'](_0x7ef4('0xe'),auth[_0x7ef4('0x8')](),controller['getFields']);router[_0x7ef4('0xf')]('/',auth[_0x7ef4('0x8')](),controller[_0x7ef4('0x10')]);router[_0x7ef4('0xf')](_0x7ef4('0x11'),auth[_0x7ef4('0x8')](),controller[_0x7ef4('0x12')]);router[_0x7ef4('0x13')]('/:id',auth[_0x7ef4('0x8')](),controller['update']);router[_0x7ef4('0x14')](_0x7ef4('0xb'),auth[_0x7ef4('0x8')](),controller[_0x7ef4('0x15')]);module[_0x7ef4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5d4c107..d02e0cd 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 _0xa95d=['exports','STRING','ENUM','newTab','integrationTab','sequelize'];(function(_0x234380,_0x3341d0){var _0x53e796=function(_0x43a6fb){while(--_0x43a6fb){_0x234380['push'](_0x234380['shift']());}};_0x53e796(++_0x3341d0);}(_0xa95d,0x155));var _0xda95=function(_0x7a242a,_0x423353){_0x7a242a=_0x7a242a-0x0;var _0x3b20c3=_0xa95d[_0x7a242a];return _0x3b20c3;};'use strict';var Sequelize=require(_0xda95('0x0'));module[_0xda95('0x1')]={'name':{'type':Sequelize[_0xda95('0x2')]},'description':{'type':Sequelize[_0xda95('0x2')]},'username':{'type':Sequelize[_0xda95('0x2')]},'remoteUri':{'type':Sequelize[_0xda95('0x2')]},'authType':{'type':Sequelize[_0xda95('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0xda95('0x2')]},'consumerKey':{'type':Sequelize[_0xda95('0x2')]},'consumerSecret':{'type':Sequelize[_0xda95('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xda95('0x2')]},'serverUrl':{'type':Sequelize[_0xda95('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xda95('0x3')]('integrationTab',_0xda95('0x4')),'defaultValue':_0xda95('0x5')}}; \ No newline at end of file +var _0x2f5e=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x104b11,_0x5d87ab){var _0x29d105=function(_0x2a23f7){while(--_0x2a23f7){_0x104b11['push'](_0x104b11['shift']());}};_0x29d105(++_0x5d87ab);}(_0x2f5e,0x125));var _0xe2f5=function(_0x230df3,_0x2a972e){_0x230df3=_0x230df3-0x0;var _0x14c031=_0x2f5e[_0x230df3];return _0x14c031;};'use strict';var Sequelize=require(_0xe2f5('0x0'));module[_0xe2f5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe2f5('0x2')]},'username':{'type':Sequelize[_0xe2f5('0x2')]},'remoteUri':{'type':Sequelize[_0xe2f5('0x2')]},'authType':{'type':Sequelize[_0xe2f5('0x3')](_0xe2f5('0x4')),'defaultValue':_0xe2f5('0x4')},'password':{'type':Sequelize[_0xe2f5('0x2')]},'consumerKey':{'type':Sequelize[_0xe2f5('0x2')]},'consumerSecret':{'type':Sequelize[_0xe2f5('0x2')]},'token':{'type':Sequelize[_0xe2f5('0x2')]},'tokenSecret':{'type':Sequelize[_0xe2f5('0x2')]},'serverUrl':{'type':Sequelize[_0xe2f5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe2f5('0x3')](_0xe2f5('0x5'),_0xe2f5('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7e6f4a0..7f18519 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 _0x1bbe=['consumerKey','consumerSecret','slice','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','send','index','map','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','DeskAccount','include','rows','show','params','rawAttributes','includeAll','catch','create','body','find','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','username','password'];(function(_0x39deb9,_0x43a678){var _0x1c2af=function(_0x195702){while(--_0x195702){_0x39deb9['push'](_0x39deb9['shift']());}};_0x1c2af(++_0x43a678);}(_0x1bbe,0x1d5));var _0xe1bb=function(_0x23dcae,_0x5ac4e2){_0x23dcae=_0x23dcae-0x0;var _0x570ecc=_0x1bbe[_0x23dcae];return _0x570ecc;};'use strict';var emlformat=require(_0xe1bb('0x0'));var rimraf=require(_0xe1bb('0x1'));var zipdir=require(_0xe1bb('0x2'));var jsonpatch=require(_0xe1bb('0x3'));var rp=require('request-promise');var moment=require(_0xe1bb('0x4'));var BPromise=require(_0xe1bb('0x5'));var Mustache=require(_0xe1bb('0x6'));var util=require(_0xe1bb('0x7'));var path=require(_0xe1bb('0x8'));var sox=require(_0xe1bb('0x9'));var csv=require(_0xe1bb('0xa'));var ejs=require(_0xe1bb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe1bb('0xc'));var squel=require(_0xe1bb('0xd'));var crypto=require(_0xe1bb('0xe'));var jsforce=require(_0xe1bb('0xf'));var deskjs=require(_0xe1bb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe1bb('0x11'));var Papa=require(_0xe1bb('0x12'));var Redis=require(_0xe1bb('0x13'));var authService=require(_0xe1bb('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1bb('0x15'));var logger=require(_0xe1bb('0x16'))('api');var utils=require(_0xe1bb('0x17'));var config=require(_0xe1bb('0x18'));var licenseUtil=require(_0xe1bb('0x19'));var db=require(_0xe1bb('0x1a'))['db'];var integrations=require(_0xe1bb('0x1b'));function respondWithStatusCode(_0x33b894,_0x8e2e96){_0x8e2e96=_0x8e2e96||0xcc;return function(_0x1183d2){if(_0x1183d2){return _0x33b894[_0xe1bb('0x1c')](_0x8e2e96);}return _0x33b894[_0xe1bb('0x1d')](_0x8e2e96)[_0xe1bb('0x1e')]();};}function respondWithResult(_0x3826d9,_0x280889){_0x280889=_0x280889||0xc8;return function(_0x4bf075){if(_0x4bf075){return _0x3826d9[_0xe1bb('0x1d')](_0x280889)[_0xe1bb('0x1f')](_0x4bf075);}};}function respondWithFilteredResult(_0x25c9f7,_0x4ece9a){return function(_0x5eb496){if(_0x5eb496){var _0xa95b2f=typeof _0x4ece9a[_0xe1bb('0x20')]===_0xe1bb('0x21')&&typeof _0x4ece9a[_0xe1bb('0x22')]==='undefined';var _0x31eb50=_0x5eb496['count'];var _0x5bcdab=_0xa95b2f?0x0:_0x4ece9a[_0xe1bb('0x20')];var _0x3ff603=_0xa95b2f?_0x5eb496[_0xe1bb('0x23')]:_0x4ece9a[_0xe1bb('0x20')]+_0x4ece9a['limit'];var _0x426a44;if(_0x3ff603>=_0x31eb50){_0x3ff603=_0x31eb50;_0x426a44=0xc8;}else{_0x426a44=0xce;}_0x25c9f7[_0xe1bb('0x1d')](_0x426a44);return _0x25c9f7[_0xe1bb('0x24')](_0xe1bb('0x25'),_0x5bcdab+'-'+_0x3ff603+'/'+_0x31eb50)['json'](_0x5eb496);}return null;};}function patchUpdates(_0x4adb99){return function(_0x565fa3){try{jsonpatch['apply'](_0x565fa3,_0x4adb99,!![]);}catch(_0x206e00){return BPromise[_0xe1bb('0x26')](_0x206e00);}return _0x565fa3[_0xe1bb('0x27')]();};}function saveUpdates(_0x358ae3,_0x30b16d){return function(_0x669c7f){if(_0x669c7f){return _0x669c7f[_0xe1bb('0x28')](_0x358ae3)[_0xe1bb('0x29')](function(_0x3d1c2c){return _0x3d1c2c;});}return null;};}function removeEntity(_0x4b1cae,_0x43dcc0){return function(_0x449283){if(_0x449283){return _0x449283[_0xe1bb('0x2a')]()[_0xe1bb('0x29')](function(){_0x4b1cae[_0xe1bb('0x1d')](0xcc)[_0xe1bb('0x1e')]();});}};}function handleEntityNotFound(_0x1566d3,_0x5c4c8d){return function(_0x31b3cd){if(!_0x31b3cd){_0x1566d3['sendStatus'](0x194);}return _0x31b3cd;};}function handleError(_0x49c974,_0x2affdf){_0x2affdf=_0x2affdf||0x1f4;return function(_0x5932d8){logger['error'](_0x5932d8[_0xe1bb('0x2b')]);if(_0x5932d8['name']){delete _0x5932d8['name'];}_0x49c974['status'](_0x2affdf)[_0xe1bb('0x2c')](_0x5932d8);};}exports[_0xe1bb('0x2d')]=function(_0x39a143,_0x56b2fc){var _0xe7d06f={},_0x1ab420={},_0x3ed01f={'count':0x0,'rows':[]};var _0x3835c9=_[_0xe1bb('0x2e')](db['DeskAccount']['rawAttributes'],function(_0xd8e56){return{'name':_0xd8e56['fieldName'],'type':_0xd8e56[_0xe1bb('0x2f')][_0xe1bb('0x30')]};});_0x1ab420[_0xe1bb('0x31')]=_['map'](_0x3835c9,'name');_0x1ab420['query']=_[_0xe1bb('0x32')](_0x39a143['query']);_0x1ab420[_0xe1bb('0x33')]=_['intersection'](_0x1ab420[_0xe1bb('0x31')],_0x1ab420[_0xe1bb('0x34')]);_0xe7d06f[_0xe1bb('0x35')]=_[_0xe1bb('0x36')](_0x1ab420[_0xe1bb('0x31')],qs[_0xe1bb('0x37')](_0x39a143['query'][_0xe1bb('0x37')]));_0xe7d06f[_0xe1bb('0x35')]=_0xe7d06f[_0xe1bb('0x35')][_0xe1bb('0x38')]?_0xe7d06f['attributes']:_0x1ab420[_0xe1bb('0x31')];if(!_0x39a143[_0xe1bb('0x34')][_0xe1bb('0x39')](_0xe1bb('0x3a'))){_0xe7d06f[_0xe1bb('0x22')]=qs[_0xe1bb('0x22')](_0x39a143['query']['limit']);_0xe7d06f[_0xe1bb('0x20')]=qs[_0xe1bb('0x20')](_0x39a143[_0xe1bb('0x34')][_0xe1bb('0x20')]);}_0xe7d06f[_0xe1bb('0x3b')]=qs[_0xe1bb('0x3c')](_0x39a143[_0xe1bb('0x34')][_0xe1bb('0x3c')]);_0xe7d06f[_0xe1bb('0x3d')]=qs[_0xe1bb('0x33')](_['pick'](_0x39a143['query'],_0x1ab420[_0xe1bb('0x33')]),_0x3835c9);if(_0x39a143[_0xe1bb('0x34')][_0xe1bb('0x3e')]){_0xe7d06f[_0xe1bb('0x3d')]=_[_0xe1bb('0x3f')](_0xe7d06f['where'],{'$or':_[_0xe1bb('0x2e')](_0x3835c9,function(_0x1d403b){if(_0x1d403b[_0xe1bb('0x2f')]!==_0xe1bb('0x40')){var _0xa96bed={};_0xa96bed[_0x1d403b[_0xe1bb('0x41')]]={'$like':'%'+_0x39a143[_0xe1bb('0x34')][_0xe1bb('0x3e')]+'%'};return _0xa96bed;}})});}_0xe7d06f=_[_0xe1bb('0x3f')]({},_0xe7d06f,_0x39a143[_0xe1bb('0x42')]);var _0x12042f={'where':_0xe7d06f[_0xe1bb('0x3d')]};return db[_0xe1bb('0x43')][_0xe1bb('0x23')](_0x12042f)[_0xe1bb('0x29')](function(_0x4eb167){_0x3ed01f[_0xe1bb('0x23')]=_0x4eb167;if(_0x39a143['query']['includeAll']){_0xe7d06f[_0xe1bb('0x44')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0xe7d06f);})[_0xe1bb('0x29')](function(_0x1522d2){_0x3ed01f[_0xe1bb('0x45')]=_0x1522d2;return _0x3ed01f;})['then'](respondWithFilteredResult(_0x56b2fc,_0xe7d06f))['catch'](handleError(_0x56b2fc,null));};exports[_0xe1bb('0x46')]=function(_0x4c7a0f,_0x2366f4){var _0x19a588={'raw':![],'where':{'id':_0x4c7a0f[_0xe1bb('0x47')]['id']}},_0x4e9ba6={};_0x4e9ba6[_0xe1bb('0x31')]=_[_0xe1bb('0x32')](db['DeskAccount'][_0xe1bb('0x48')]);_0x4e9ba6[_0xe1bb('0x34')]=_[_0xe1bb('0x32')](_0x4c7a0f[_0xe1bb('0x34')]);_0x4e9ba6[_0xe1bb('0x33')]=_['intersection'](_0x4e9ba6[_0xe1bb('0x31')],_0x4e9ba6[_0xe1bb('0x34')]);_0x19a588[_0xe1bb('0x35')]=_[_0xe1bb('0x36')](_0x4e9ba6[_0xe1bb('0x31')],qs['fields'](_0x4c7a0f[_0xe1bb('0x34')][_0xe1bb('0x37')]));_0x19a588[_0xe1bb('0x35')]=_0x19a588[_0xe1bb('0x35')][_0xe1bb('0x38')]?_0x19a588['attributes']:_0x4e9ba6['model'];if(_0x4c7a0f['query'][_0xe1bb('0x49')]){_0x19a588[_0xe1bb('0x44')]=[{'all':!![]}];}_0x19a588=_[_0xe1bb('0x3f')]({},_0x19a588,_0x4c7a0f[_0xe1bb('0x42')]);return db[_0xe1bb('0x43')]['find'](_0x19a588)['then'](handleEntityNotFound(_0x2366f4,null))[_0xe1bb('0x29')](respondWithResult(_0x2366f4,null))[_0xe1bb('0x4a')](handleError(_0x2366f4,null));};exports[_0xe1bb('0x4b')]=function(_0x344093,_0x1d310a){return db[_0xe1bb('0x43')][_0xe1bb('0x4b')](_0x344093['body'],{})['then'](respondWithResult(_0x1d310a,0xc9))['catch'](handleError(_0x1d310a,null));};exports[_0xe1bb('0x28')]=function(_0x2a998c,_0x1a228d){if(_0x2a998c[_0xe1bb('0x4c')]['id']){delete _0x2a998c[_0xe1bb('0x4c')]['id'];}return db[_0xe1bb('0x43')]['find']({'where':{'id':_0x2a998c[_0xe1bb('0x47')]['id']}})[_0xe1bb('0x29')](handleEntityNotFound(_0x1a228d,null))[_0xe1bb('0x29')](saveUpdates(_0x2a998c[_0xe1bb('0x4c')],null))[_0xe1bb('0x29')](respondWithResult(_0x1a228d,null))[_0xe1bb('0x4a')](handleError(_0x1a228d,null));};exports['destroy']=function(_0x201849,_0x5aee14){return db[_0xe1bb('0x43')][_0xe1bb('0x4d')]({'where':{'id':_0x201849[_0xe1bb('0x47')]['id']}})[_0xe1bb('0x29')](handleEntityNotFound(_0x5aee14,null))[_0xe1bb('0x29')](removeEntity(_0x5aee14,null))['catch'](handleError(_0x5aee14,null));};exports[_0xe1bb('0x4e')]=function(_0x4fc433,_0x1d7570,_0x3d359a){var _0x38ee17={};var _0x49dcdc={};var _0x377efb;var _0x3ef3fc;return db[_0xe1bb('0x43')][_0xe1bb('0x4f')]({'where':{'id':_0x4fc433[_0xe1bb('0x47')]['id']}})[_0xe1bb('0x29')](handleEntityNotFound(_0x1d7570,null))['then'](function(_0x37c39c){if(_0x37c39c){_0x377efb=_0x37c39c;_0x49dcdc['model']=_[_0xe1bb('0x32')](db[_0xe1bb('0x50')]['rawAttributes']);_0x49dcdc['query']=_[_0xe1bb('0x32')](_0x4fc433['query']);_0x49dcdc[_0xe1bb('0x33')]=_[_0xe1bb('0x36')](_0x49dcdc[_0xe1bb('0x31')],_0x49dcdc[_0xe1bb('0x34')]);_0x38ee17['attributes']=_['intersection'](_0x49dcdc[_0xe1bb('0x31')],qs[_0xe1bb('0x37')](_0x4fc433[_0xe1bb('0x34')][_0xe1bb('0x37')]));_0x38ee17['attributes']=_0x38ee17[_0xe1bb('0x35')]['length']?_0x38ee17[_0xe1bb('0x35')]:_0x49dcdc['model'];_0x38ee17['order']=qs[_0xe1bb('0x3c')](_0x4fc433['query'][_0xe1bb('0x3c')]);_0x38ee17[_0xe1bb('0x3d')]=qs[_0xe1bb('0x33')](_['pick'](_0x4fc433['query'],_0x49dcdc[_0xe1bb('0x33')]));if(_0x4fc433['query'][_0xe1bb('0x3e')]){_0x38ee17[_0xe1bb('0x3d')]=_[_0xe1bb('0x3f')](_0x38ee17[_0xe1bb('0x3d')],{'$or':_['map'](_0x38ee17['attributes'],function(_0x1e5667){var _0xa32659={};_0xa32659[_0x1e5667]={'$like':'%'+_0x4fc433[_0xe1bb('0x34')][_0xe1bb('0x3e')]+'%'};return _0xa32659;})});}_0x38ee17=_[_0xe1bb('0x3f')]({},_0x38ee17,_0x4fc433['options']);return _0x377efb[_0xe1bb('0x4e')](_0x38ee17);}})[_0xe1bb('0x29')](function(_0x5a3334){if(_0x5a3334){_0x3ef3fc=_0x5a3334[_0xe1bb('0x38')];if(!_0x4fc433[_0xe1bb('0x34')][_0xe1bb('0x39')](_0xe1bb('0x3a'))){_0x38ee17['limit']=qs[_0xe1bb('0x22')](_0x4fc433['query'][_0xe1bb('0x22')]);_0x38ee17['offset']=qs[_0xe1bb('0x20')](_0x4fc433[_0xe1bb('0x34')][_0xe1bb('0x20')]);}return _0x377efb[_0xe1bb('0x4e')](_0x38ee17);}})[_0xe1bb('0x29')](function(_0x39edde){if(_0x39edde){return _0x39edde?{'count':_0x3ef3fc,'rows':_0x39edde}:null;}})['then'](respondWithResult(_0x1d7570,null))['catch'](handleError(_0x1d7570,null));};exports['addConfiguration']=function(_0x130ac9,_0x4e53c3,_0x3722b0){if(_0x130ac9[_0xe1bb('0x4c')]['id']){delete _0x130ac9[_0xe1bb('0x4c')]['id'];}return db['DeskAccount'][_0xe1bb('0x4f')]({'where':{'id':_0x130ac9['params']['id']}})[_0xe1bb('0x29')](handleEntityNotFound(_0x4e53c3,null))['then'](function(_0x12d19b){if(_0x12d19b){_0x130ac9['body'][_0xe1bb('0x51')]=_0x12d19b['id'];_0x130ac9[_0xe1bb('0x4c')][_0xe1bb('0x52')]=integrations['getSubjects'](_0x130ac9[_0xe1bb('0x4c')][_0xe1bb('0x53')],_0x130ac9[_0xe1bb('0x4c')][_0xe1bb('0x2f')]);_0x130ac9[_0xe1bb('0x4c')][_0xe1bb('0x54')]=integrations['getDescriptions'](_0x130ac9['body'][_0xe1bb('0x53')],_0x130ac9[_0xe1bb('0x4c')]['type']);return db[_0xe1bb('0x50')]['create'](_0x130ac9[_0xe1bb('0x4c')],{'include':[{'model':db[_0xe1bb('0x55')],'as':_0xe1bb('0x52')},{'model':db[_0xe1bb('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4e53c3,null))[_0xe1bb('0x4a')](handleError(_0x4e53c3,null));};exports[_0xe1bb('0x56')]=function(_0x32832b,_0x4e4f06,_0x588937){var _0x2ba309=[{'name':'priority','label':_0xe1bb('0x57'),'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 _0x272aa2='';return db[_0xe1bb('0x43')]['findOne']({'where':{'id':_0x32832b[_0xe1bb('0x47')]['id']},'attributes':['id',_0xe1bb('0x58'),'authType',_0xe1bb('0x59'),_0xe1bb('0x5a'),_0xe1bb('0x5b'),_0xe1bb('0x5c'),'token','tokenSecret']})[_0xe1bb('0x29')](handleEntityNotFound(_0x4e4f06,null))[_0xe1bb('0x29')](function(_0xf7ebc8){if(_0xf7ebc8){_0x272aa2=_0xf7ebc8[_0xe1bb('0x58')];var _0x1d72ac=_0x272aa2[_0xe1bb('0x5d')](-0x1);if(_0x1d72ac==='/'){_0x272aa2=_0x272aa2['substring'](0x0,_0x272aa2[_0xe1bb('0x5e')](_0x1d72ac));}var _0x4fbad0={'method':_0xe1bb('0x5f'),'uri':util['format'](_0xe1bb('0x60'),_0x272aa2),'headers':{'Content-Type':'application/json','Accept':_0xe1bb('0x61')},'json':!![]};if(_0xf7ebc8['authType']===_0xe1bb('0x62')){_0x4fbad0['headers'][_0xe1bb('0x63')]=util[_0xe1bb('0x64')](_0xe1bb('0x65'),new Buffer(util[_0xe1bb('0x64')](_0xe1bb('0x66'),_0xf7ebc8[_0xe1bb('0x59')],_0xf7ebc8[_0xe1bb('0x5a')]))[_0xe1bb('0x67')](_0xe1bb('0x68')));}return rp(_0x4fbad0)[_0xe1bb('0x29')](function(_0xba508d){return _0x2ba309[_0xe1bb('0x69')](_[_0xe1bb('0x2e')](_0xba508d[_0xe1bb('0x6a')][_0xe1bb('0x6b')],function(_0x3f9233){return{'id':_0x3f9233[_0xe1bb('0x41')],'name':_0x3f9233[_0xe1bb('0x41')],'type':_0x3f9233[_0xe1bb('0x2f')],'active':_0x3f9233[_0xe1bb('0x6c')],'label':_0x3f9233['label'],'custom':!![]};}));});}})[_0xe1bb('0x29')](function(_0x12c868){return{'count':_0x12c868[_0xe1bb('0x38')],'rows':_0x12c868};})[_0xe1bb('0x29')](respondWithResult(_0x4e4f06,null))['catch'](function(_0xa94283){var _0x391d95=_0x32832b[_0xe1bb('0x34')][_0xe1bb('0x6d')]?0x1f4:_0xa94283[_0xe1bb('0x6e')]||0x1f4;logger['error'](_0xe1bb('0x6f'),_0xe1bb('0x56'),_0x391d95,JSON['stringify'](_0xa94283));delete _0xa94283['name'];if(_0x391d95===0x191){_0x391d95=0x190;}_0x4e4f06[_0xe1bb('0x1d')](_0x391d95)['send'](_0x32832b[_0xe1bb('0x34')][_0xe1bb('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0xa94283[_0xe1bb('0x6e')]}:_0xa94283);});}; \ No newline at end of file +var _0x5979=['set','Content-Range','apply','reject','save','then','destroy','error','stack','index','DeskAccount','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','length','find','create','body','update','params','getConfigurations','DeskConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','priority','remoteUri','authType','username','password','consumerSecret','token','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','%s:%s','toString','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit'];(function(_0x13c9cb,_0xb6aa4){var _0x38db76=function(_0x427954){while(--_0x427954){_0x13c9cb['push'](_0x13c9cb['shift']());}};_0x38db76(++_0xb6aa4);}(_0x5979,0x1ac));var _0x9597=function(_0x3cc00c,_0x52cf5a){_0x3cc00c=_0x3cc00c-0x0;var _0x1163e6=_0x5979[_0x3cc00c];return _0x1163e6;};'use strict';var emlformat=require(_0x9597('0x0'));var rimraf=require(_0x9597('0x1'));var zipdir=require(_0x9597('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9597('0x3'));var moment=require('moment');var BPromise=require(_0x9597('0x4'));var Mustache=require(_0x9597('0x5'));var util=require('util');var path=require(_0x9597('0x6'));var sox=require(_0x9597('0x7'));var csv=require(_0x9597('0x8'));var ejs=require(_0x9597('0x9'));var fs=require('fs');var fs_extra=require(_0x9597('0xa'));var _=require(_0x9597('0xb'));var squel=require(_0x9597('0xc'));var crypto=require(_0x9597('0xd'));var jsforce=require(_0x9597('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9597('0x8'));var querystring=require(_0x9597('0xf'));var Papa=require('papaparse');var Redis=require(_0x9597('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9597('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9597('0x12'));var logger=require(_0x9597('0x13'))(_0x9597('0x14'));var utils=require(_0x9597('0x15'));var config=require(_0x9597('0x16'));var licenseUtil=require(_0x9597('0x17'));var db=require(_0x9597('0x18'))['db'];var integrations=require(_0x9597('0x19'));function respondWithStatusCode(_0xa16f29,_0x1d7a18){_0x1d7a18=_0x1d7a18||0xcc;return function(_0x1dcb9c){if(_0x1dcb9c){return _0xa16f29[_0x9597('0x1a')](_0x1d7a18);}return _0xa16f29[_0x9597('0x1b')](_0x1d7a18)[_0x9597('0x1c')]();};}function respondWithResult(_0x9e80bf,_0x1f858a){_0x1f858a=_0x1f858a||0xc8;return function(_0x2c914b){if(_0x2c914b){return _0x9e80bf['status'](_0x1f858a)[_0x9597('0x1d')](_0x2c914b);}};}function respondWithFilteredResult(_0x2bcc62,_0x5ba947){return function(_0x3963fe){if(_0x3963fe){var _0x2c842f=typeof _0x5ba947['offset']==='undefined'&&typeof _0x5ba947['limit']==='undefined';var _0x46aa3a=_0x3963fe['count'];var _0x1d34ad=_0x2c842f?0x0:_0x5ba947[_0x9597('0x1e')];var _0x119efe=_0x2c842f?_0x3963fe['count']:_0x5ba947[_0x9597('0x1e')]+_0x5ba947[_0x9597('0x1f')];var _0x231bc8;if(_0x119efe>=_0x46aa3a){_0x119efe=_0x46aa3a;_0x231bc8=0xc8;}else{_0x231bc8=0xce;}_0x2bcc62[_0x9597('0x1b')](_0x231bc8);return _0x2bcc62[_0x9597('0x20')](_0x9597('0x21'),_0x1d34ad+'-'+_0x119efe+'/'+_0x46aa3a)[_0x9597('0x1d')](_0x3963fe);}return null;};}function patchUpdates(_0x502517){return function(_0x27581b){try{jsonpatch[_0x9597('0x22')](_0x27581b,_0x502517,!![]);}catch(_0x46cfa1){return BPromise[_0x9597('0x23')](_0x46cfa1);}return _0x27581b[_0x9597('0x24')]();};}function saveUpdates(_0x2934c5,_0x4a0320){return function(_0x1a3224){if(_0x1a3224){return _0x1a3224['update'](_0x2934c5)[_0x9597('0x25')](function(_0x5efbdc){return _0x5efbdc;});}return null;};}function removeEntity(_0x3c68db,_0x4fbbcb){return function(_0x11e871){if(_0x11e871){return _0x11e871[_0x9597('0x26')]()['then'](function(){_0x3c68db[_0x9597('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2a82,_0x2b4e93){return function(_0x341939){if(!_0x341939){_0x2a2a82[_0x9597('0x1a')](0x194);}return _0x341939;};}function handleError(_0x24cd61,_0x1defe7){_0x1defe7=_0x1defe7||0x1f4;return function(_0x4ead15){logger[_0x9597('0x27')](_0x4ead15[_0x9597('0x28')]);if(_0x4ead15['name']){delete _0x4ead15['name'];}_0x24cd61['status'](_0x1defe7)['send'](_0x4ead15);};}exports[_0x9597('0x29')]=function(_0x370561,_0x1beb65){var _0x3a4368={},_0x211561={},_0x58c6ea={'count':0x0,'rows':[]};var _0x15aa80=_['map'](db[_0x9597('0x2a')][_0x9597('0x2b')],function(_0x2d7ffe){return{'name':_0x2d7ffe[_0x9597('0x2c')],'type':_0x2d7ffe[_0x9597('0x2d')]['key']};});_0x211561[_0x9597('0x2e')]=_[_0x9597('0x2f')](_0x15aa80,_0x9597('0x30'));_0x211561[_0x9597('0x31')]=_[_0x9597('0x32')](_0x370561['query']);_0x211561[_0x9597('0x33')]=_[_0x9597('0x34')](_0x211561[_0x9597('0x2e')],_0x211561[_0x9597('0x31')]);_0x3a4368[_0x9597('0x35')]=_['intersection'](_0x211561[_0x9597('0x2e')],qs[_0x9597('0x36')](_0x370561[_0x9597('0x31')][_0x9597('0x36')]));_0x3a4368['attributes']=_0x3a4368[_0x9597('0x35')]['length']?_0x3a4368['attributes']:_0x211561[_0x9597('0x2e')];if(!_0x370561[_0x9597('0x31')][_0x9597('0x37')](_0x9597('0x38'))){_0x3a4368[_0x9597('0x1f')]=qs['limit'](_0x370561[_0x9597('0x31')][_0x9597('0x1f')]);_0x3a4368['offset']=qs[_0x9597('0x1e')](_0x370561['query'][_0x9597('0x1e')]);}_0x3a4368[_0x9597('0x39')]=qs['sort'](_0x370561['query'][_0x9597('0x3a')]);_0x3a4368['where']=qs[_0x9597('0x33')](_[_0x9597('0x3b')](_0x370561['query'],_0x211561[_0x9597('0x33')]),_0x15aa80);if(_0x370561[_0x9597('0x31')][_0x9597('0x3c')]){_0x3a4368[_0x9597('0x3d')]=_[_0x9597('0x3e')](_0x3a4368[_0x9597('0x3d')],{'$or':_[_0x9597('0x2f')](_0x15aa80,function(_0x11de04){if(_0x11de04[_0x9597('0x2d')]!==_0x9597('0x3f')){var _0xed813c={};_0xed813c[_0x11de04[_0x9597('0x30')]]={'$like':'%'+_0x370561[_0x9597('0x31')]['filter']+'%'};return _0xed813c;}})});}_0x3a4368=_[_0x9597('0x3e')]({},_0x3a4368,_0x370561[_0x9597('0x40')]);var _0x2e41b9={'where':_0x3a4368[_0x9597('0x3d')]};return db['DeskAccount'][_0x9597('0x41')](_0x2e41b9)[_0x9597('0x25')](function(_0xfd7dfd){_0x58c6ea['count']=_0xfd7dfd;if(_0x370561[_0x9597('0x31')][_0x9597('0x42')]){_0x3a4368[_0x9597('0x43')]=[{'all':!![]}];}return db[_0x9597('0x2a')]['findAll'](_0x3a4368);})[_0x9597('0x25')](function(_0x5013a7){_0x58c6ea[_0x9597('0x44')]=_0x5013a7;return _0x58c6ea;})[_0x9597('0x25')](respondWithFilteredResult(_0x1beb65,_0x3a4368))[_0x9597('0x45')](handleError(_0x1beb65,null));};exports[_0x9597('0x46')]=function(_0x4dd6f1,_0x5af0b3){var _0x591d5b={'raw':![],'where':{'id':_0x4dd6f1['params']['id']}},_0xd6e0f6={};_0xd6e0f6['model']=_[_0x9597('0x32')](db[_0x9597('0x2a')][_0x9597('0x2b')]);_0xd6e0f6[_0x9597('0x31')]=_['keys'](_0x4dd6f1['query']);_0xd6e0f6[_0x9597('0x33')]=_['intersection'](_0xd6e0f6['model'],_0xd6e0f6['query']);_0x591d5b['attributes']=_['intersection'](_0xd6e0f6[_0x9597('0x2e')],qs['fields'](_0x4dd6f1['query'][_0x9597('0x36')]));_0x591d5b[_0x9597('0x35')]=_0x591d5b[_0x9597('0x35')][_0x9597('0x47')]?_0x591d5b[_0x9597('0x35')]:_0xd6e0f6['model'];if(_0x4dd6f1[_0x9597('0x31')]['includeAll']){_0x591d5b[_0x9597('0x43')]=[{'all':!![]}];}_0x591d5b=_[_0x9597('0x3e')]({},_0x591d5b,_0x4dd6f1[_0x9597('0x40')]);return db[_0x9597('0x2a')][_0x9597('0x48')](_0x591d5b)[_0x9597('0x25')](handleEntityNotFound(_0x5af0b3,null))[_0x9597('0x25')](respondWithResult(_0x5af0b3,null))[_0x9597('0x45')](handleError(_0x5af0b3,null));};exports[_0x9597('0x49')]=function(_0x28f633,_0x3e4abc){return db[_0x9597('0x2a')]['create'](_0x28f633[_0x9597('0x4a')],{})[_0x9597('0x25')](respondWithResult(_0x3e4abc,0xc9))['catch'](handleError(_0x3e4abc,null));};exports[_0x9597('0x4b')]=function(_0x24707c,_0x4af4e8){if(_0x24707c[_0x9597('0x4a')]['id']){delete _0x24707c[_0x9597('0x4a')]['id'];}return db[_0x9597('0x2a')]['find']({'where':{'id':_0x24707c[_0x9597('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4af4e8,null))['then'](saveUpdates(_0x24707c[_0x9597('0x4a')],null))[_0x9597('0x25')](respondWithResult(_0x4af4e8,null))[_0x9597('0x45')](handleError(_0x4af4e8,null));};exports[_0x9597('0x26')]=function(_0x23e869,_0x3d6341){return db[_0x9597('0x2a')]['find']({'where':{'id':_0x23e869['params']['id']}})[_0x9597('0x25')](handleEntityNotFound(_0x3d6341,null))['then'](removeEntity(_0x3d6341,null))[_0x9597('0x45')](handleError(_0x3d6341,null));};exports[_0x9597('0x4d')]=function(_0x61733e,_0x42f3aa,_0x30396f){var _0x570fa9={};var _0x30abff={};var _0x180717;var _0x1d15e3;return db[_0x9597('0x2a')]['findOne']({'where':{'id':_0x61733e[_0x9597('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42f3aa,null))[_0x9597('0x25')](function(_0x2fd248){if(_0x2fd248){_0x180717=_0x2fd248;_0x30abff[_0x9597('0x2e')]=_[_0x9597('0x32')](db[_0x9597('0x4e')][_0x9597('0x2b')]);_0x30abff['query']=_[_0x9597('0x32')](_0x61733e[_0x9597('0x31')]);_0x30abff[_0x9597('0x33')]=_[_0x9597('0x34')](_0x30abff[_0x9597('0x2e')],_0x30abff[_0x9597('0x31')]);_0x570fa9[_0x9597('0x35')]=_[_0x9597('0x34')](_0x30abff[_0x9597('0x2e')],qs[_0x9597('0x36')](_0x61733e[_0x9597('0x31')][_0x9597('0x36')]));_0x570fa9[_0x9597('0x35')]=_0x570fa9[_0x9597('0x35')][_0x9597('0x47')]?_0x570fa9['attributes']:_0x30abff[_0x9597('0x2e')];_0x570fa9[_0x9597('0x39')]=qs[_0x9597('0x3a')](_0x61733e[_0x9597('0x31')]['sort']);_0x570fa9['where']=qs[_0x9597('0x33')](_[_0x9597('0x3b')](_0x61733e[_0x9597('0x31')],_0x30abff[_0x9597('0x33')]));if(_0x61733e[_0x9597('0x31')]['filter']){_0x570fa9['where']=_['merge'](_0x570fa9[_0x9597('0x3d')],{'$or':_[_0x9597('0x2f')](_0x570fa9[_0x9597('0x35')],function(_0x590eae){var _0x4805b8={};_0x4805b8[_0x590eae]={'$like':'%'+_0x61733e['query'][_0x9597('0x3c')]+'%'};return _0x4805b8;})});}_0x570fa9=_[_0x9597('0x3e')]({},_0x570fa9,_0x61733e['options']);return _0x180717[_0x9597('0x4d')](_0x570fa9);}})[_0x9597('0x25')](function(_0x38cc0e){if(_0x38cc0e){_0x1d15e3=_0x38cc0e['length'];if(!_0x61733e[_0x9597('0x31')]['hasOwnProperty']('nolimit')){_0x570fa9[_0x9597('0x1f')]=qs['limit'](_0x61733e['query'][_0x9597('0x1f')]);_0x570fa9[_0x9597('0x1e')]=qs['offset'](_0x61733e['query'][_0x9597('0x1e')]);}return _0x180717[_0x9597('0x4d')](_0x570fa9);}})[_0x9597('0x25')](function(_0x551ed3){if(_0x551ed3){return _0x551ed3?{'count':_0x1d15e3,'rows':_0x551ed3}:null;}})[_0x9597('0x25')](respondWithResult(_0x42f3aa,null))[_0x9597('0x45')](handleError(_0x42f3aa,null));};exports['addConfiguration']=function(_0x493504,_0x2b92a0,_0x139a03){if(_0x493504['body']['id']){delete _0x493504[_0x9597('0x4a')]['id'];}return db['DeskAccount'][_0x9597('0x4f')]({'where':{'id':_0x493504[_0x9597('0x4c')]['id']}})[_0x9597('0x25')](handleEntityNotFound(_0x2b92a0,null))['then'](function(_0x5b221d){if(_0x5b221d){_0x493504[_0x9597('0x4a')][_0x9597('0x50')]=_0x5b221d['id'];_0x493504['body'][_0x9597('0x51')]=integrations[_0x9597('0x52')](_0x493504['body']['channel'],_0x493504[_0x9597('0x4a')][_0x9597('0x2d')]);_0x493504[_0x9597('0x4a')][_0x9597('0x53')]=integrations[_0x9597('0x54')](_0x493504[_0x9597('0x4a')][_0x9597('0x55')],_0x493504['body'][_0x9597('0x2d')]);return db['DeskConfiguration'][_0x9597('0x49')](_0x493504[_0x9597('0x4a')],{'include':[{'model':db[_0x9597('0x56')],'as':_0x9597('0x51')},{'model':db[_0x9597('0x56')],'as':_0x9597('0x53')}]});}return null;})[_0x9597('0x25')](respondWithResult(_0x2b92a0,null))[_0x9597('0x45')](handleError(_0x2b92a0,null));};exports['getFields']=function(_0x3ecb91,_0x4e9a39,_0x45027f){var _0x2a8971=[{'name':_0x9597('0x57'),'label':_0x9597('0x57'),'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 _0xa3f150='';return db[_0x9597('0x2a')]['findOne']({'where':{'id':_0x3ecb91[_0x9597('0x4c')]['id']},'attributes':['id',_0x9597('0x58'),_0x9597('0x59'),_0x9597('0x5a'),_0x9597('0x5b'),'consumerKey',_0x9597('0x5c'),_0x9597('0x5d'),'tokenSecret']})[_0x9597('0x25')](handleEntityNotFound(_0x4e9a39,null))[_0x9597('0x25')](function(_0x119259){if(_0x119259){_0xa3f150=_0x119259['remoteUri'];var _0x4cf57e=_0xa3f150[_0x9597('0x5e')](-0x1);if(_0x4cf57e==='/'){_0xa3f150=_0xa3f150[_0x9597('0x5f')](0x0,_0xa3f150[_0x9597('0x60')](_0x4cf57e));}var _0x393fd1={'method':_0x9597('0x61'),'uri':util['format'](_0x9597('0x62'),_0xa3f150),'headers':{'Content-Type':_0x9597('0x63'),'Accept':_0x9597('0x63')},'json':!![]};if(_0x119259[_0x9597('0x59')]===_0x9597('0x64')){_0x393fd1['headers'][_0x9597('0x65')]=util[_0x9597('0x66')]('Basic\x20%s',new Buffer(util[_0x9597('0x66')](_0x9597('0x67'),_0x119259[_0x9597('0x5a')],_0x119259[_0x9597('0x5b')]))[_0x9597('0x68')]('base64'));}return rp(_0x393fd1)[_0x9597('0x25')](function(_0x5460f8){return _0x2a8971['concat'](_[_0x9597('0x2f')](_0x5460f8[_0x9597('0x69')][_0x9597('0x6a')],function(_0x4a03d9){return{'id':_0x4a03d9[_0x9597('0x30')],'name':_0x4a03d9[_0x9597('0x30')],'type':_0x4a03d9[_0x9597('0x2d')],'active':_0x4a03d9[_0x9597('0x6b')],'label':_0x4a03d9[_0x9597('0x6c')],'custom':!![]};}));});}})[_0x9597('0x25')](function(_0x155902){return{'count':_0x155902[_0x9597('0x47')],'rows':_0x155902};})[_0x9597('0x25')](respondWithResult(_0x4e9a39,null))[_0x9597('0x45')](function(_0x249ca0){var _0x54be13=_0x3ecb91[_0x9597('0x31')]['test']?0x1f4:_0x249ca0[_0x9597('0x6d')]||0x1f4;logger['error'](_0x9597('0x6e'),_0x9597('0x6f'),_0x54be13,JSON['stringify'](_0x249ca0));delete _0x249ca0[_0x9597('0x30')];if(_0x54be13===0x191){_0x54be13=0x190;}_0x4e9a39[_0x9597('0x1b')](_0x54be13)[_0x9597('0x70')](_0x3ecb91[_0x9597('0x31')][_0x9597('0x71')]?{'message':_0x9597('0x72'),'statusCode':_0x249ca0[_0x9597('0x6d')]}:_0x249ca0);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d5ad7a8..85fed8d 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 _0x302b=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_desk_accounts'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x302b,0xcc));var _0xb302=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0x302b[_0x4bcf38];return _0x4a89be;};'use strict';var _=require(_0xb302('0x0'));var util=require(_0xb302('0x1'));var logger=require(_0xb302('0x2'))('api');var moment=require(_0xb302('0x3'));var BPromise=require(_0xb302('0x4'));var rp=require(_0xb302('0x5'));var fs=require('fs');var path=require(_0xb302('0x6'));var rimraf=require(_0xb302('0x7'));var config=require(_0xb302('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xb302('0x9'));module[_0xb302('0xa')]=function(_0x4ea538,_0x335274){return _0x4ea538['define']('DeskAccount',attributes,{'tableName':_0xb302('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa004=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa004,0x9a));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a00('0x0'));var util=require(_0x4a00('0x1'));var logger=require(_0x4a00('0x2'))(_0x4a00('0x3'));var moment=require(_0x4a00('0x4'));var BPromise=require(_0x4a00('0x5'));var rp=require(_0x4a00('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a00('0x7'));var attributes=require(_0x4a00('0x8'));var integrations=require(_0x4a00('0x9'));module[_0x4a00('0xa')]=function(_0x592b19,_0x1a0ca9){return _0x592b19[_0x4a00('0xb')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b9b8148..0c52014 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 _0x06eb=['stringify','catch','ShowDeskAccount','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x505869,_0x9a28a7){var _0x5c27a7=function(_0xc3a6c7){while(--_0xc3a6c7){_0x505869['push'](_0x505869['shift']());}};_0x5c27a7(++_0x9a28a7);}(_0x06eb,0xae));var _0xb06e=function(_0xd83abc,_0x571415){_0xd83abc=_0xd83abc-0x0;var _0x1a0235=_0x06eb[_0xd83abc];return _0x1a0235;};'use strict';var _=require(_0xb06e('0x0'));var util=require(_0xb06e('0x1'));var moment=require(_0xb06e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb06e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb06e('0x4'))['db'];var utils=require(_0xb06e('0x5'));var logger=require(_0xb06e('0x6'))('rpc');var config=require(_0xb06e('0x7'));var jayson=require(_0xb06e('0x8'));var client=jayson['client'][_0xb06e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a24b0,_0x340890,_0x5f2867){return new BPromise(function(_0x56ebdb,_0x363123){return client['request'](_0x5a24b0,_0x5f2867)[_0xb06e('0xa')](function(_0x3e283c){logger['info'](_0xb06e('0xb'),_0x340890,'request\x20sent');logger[_0xb06e('0xc')](_0xb06e('0xd'),_0x340890,'request\x20sent',JSON['stringify'](_0x3e283c));if(_0x3e283c['error']){if(_0x3e283c[_0xb06e('0xe')][_0xb06e('0xf')]===0x1f4){logger[_0xb06e('0xe')]('DeskAccount,\x20%s,\x20%s',_0x340890,_0x3e283c[_0xb06e('0xe')][_0xb06e('0x10')]);return _0x363123(_0x3e283c[_0xb06e('0xe')][_0xb06e('0x10')]);}logger[_0xb06e('0xe')](_0xb06e('0xb'),_0x340890,_0x3e283c[_0xb06e('0xe')][_0xb06e('0x10')]);return _0x56ebdb(_0x3e283c['error'][_0xb06e('0x10')]);}else{logger[_0xb06e('0x11')]('DeskAccount,\x20%s,\x20%s',_0x340890,_0xb06e('0x12'));_0x56ebdb(_0x3e283c[_0xb06e('0x13')][_0xb06e('0x10')]);}})['catch'](function(_0x4527a5){logger['error'](_0xb06e('0xb'),_0x340890,_0x4527a5);_0x363123(_0x4527a5);});});}exports[_0xb06e('0x14')]=function(_0x441dc0){var _0x3d0d58=this;return new Promise(function(_0x2d7cd3,_0x50f916){return db[_0xb06e('0x15')][_0xb06e('0x16')]({'raw':_0x441dc0[_0xb06e('0x17')]?_0x441dc0[_0xb06e('0x17')][_0xb06e('0x18')]===undefined?!![]:![]:!![],'where':_0x441dc0[_0xb06e('0x17')]?_0x441dc0['options']['where']||null:null,'attributes':_0x441dc0[_0xb06e('0x17')]?_0x441dc0['options'][_0xb06e('0x19')]||null:null,'limit':_0x441dc0['options']?_0x441dc0[_0xb06e('0x17')][_0xb06e('0x1a')]||null:null,'include':_0x441dc0['options']?_0x441dc0['options'][_0xb06e('0x1b')]?_[_0xb06e('0x1c')](_0x441dc0[_0xb06e('0x17')][_0xb06e('0x1b')],function(_0x51a1ae){return{'model':db[_0x51a1ae['model']],'as':_0x51a1ae['as'],'attributes':_0x51a1ae['attributes'],'include':_0x51a1ae[_0xb06e('0x1b')]?_['map'](_0x51a1ae[_0xb06e('0x1b')],function(_0x23e1bb){return{'model':db[_0x23e1bb[_0xb06e('0x1d')]],'as':_0x23e1bb['as'],'attributes':_0x23e1bb[_0xb06e('0x19')],'include':_0x23e1bb['include']?_['map'](_0x23e1bb[_0xb06e('0x1b')],function(_0x7f3f33){return{'model':db[_0x7f3f33['model']],'as':_0x7f3f33['as'],'attributes':_0x7f3f33[_0xb06e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x526d9a){logger['info'](_0xb06e('0x14'),_0x441dc0);logger[_0xb06e('0xc')](_0xb06e('0x14'),_0x441dc0,JSON[_0xb06e('0x1e')](_0x526d9a));_0x2d7cd3(_0x526d9a);})[_0xb06e('0x1f')](function(_0x585acd){logger[_0xb06e('0xe')]('GetDeskAccount',_0x585acd[_0xb06e('0x10')],_0x441dc0);_0x50f916(_0x3d0d58[_0xb06e('0xe')](0x1f4,_0x585acd['message']));});});};exports[_0xb06e('0x20')]=function(_0x5dc844){var _0x150f86=this;return new Promise(function(_0x536da1,_0x459a04){return db[_0xb06e('0x15')]['find']({'raw':_0x5dc844['options']?_0x5dc844['options']['raw']===undefined?!![]:![]:!![],'where':_0x5dc844[_0xb06e('0x17')]?_0x5dc844[_0xb06e('0x17')][_0xb06e('0x21')]||null:null,'attributes':_0x5dc844[_0xb06e('0x17')]?_0x5dc844[_0xb06e('0x17')][_0xb06e('0x19')]||null:null,'include':_0x5dc844[_0xb06e('0x17')]?_0x5dc844['options'][_0xb06e('0x1b')]?_[_0xb06e('0x1c')](_0x5dc844['options'][_0xb06e('0x1b')],function(_0x1a3f15){return{'model':db[_0x1a3f15[_0xb06e('0x1d')]],'as':_0x1a3f15['as'],'attributes':_0x1a3f15[_0xb06e('0x19')],'include':_0x1a3f15[_0xb06e('0x1b')]?_[_0xb06e('0x1c')](_0x1a3f15[_0xb06e('0x1b')],function(_0x2dc518){return{'model':db[_0x2dc518['model']],'as':_0x2dc518['as'],'attributes':_0x2dc518[_0xb06e('0x19')],'include':_0x2dc518[_0xb06e('0x1b')]?_[_0xb06e('0x1c')](_0x2dc518[_0xb06e('0x1b')],function(_0x44715c){return{'model':db[_0x44715c[_0xb06e('0x1d')]],'as':_0x44715c['as'],'attributes':_0x44715c[_0xb06e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb06e('0xa')](function(_0x4d7174){logger[_0xb06e('0x11')](_0xb06e('0x20'),_0x5dc844);logger[_0xb06e('0xc')](_0xb06e('0x20'),_0x5dc844,JSON[_0xb06e('0x1e')](_0x4d7174));_0x536da1(_0x4d7174);})['catch'](function(_0x55f631){logger[_0xb06e('0xe')]('ShowDeskAccount',_0x55f631['message'],_0x5dc844);_0x459a04(_0x150f86['error'](0x1f4,_0x55f631['message']));});});}; \ No newline at end of file +var _0x88c1=['debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','DeskAccount','options','raw','where','include','map','attributes','model','then','GetDeskAccount','catch','ShowDeskAccount','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x38b2f1,_0x12a0df){var _0x12b4ce=function(_0x253e64){while(--_0x253e64){_0x38b2f1['push'](_0x38b2f1['shift']());}};_0x12b4ce(++_0x12a0df);}(_0x88c1,0x1e2));var _0x188c=function(_0x105f1,_0x1cc3d5){_0x105f1=_0x105f1-0x0;var _0x165e05=_0x88c1[_0x105f1];return _0x165e05;};'use strict';var _=require(_0x188c('0x0'));var util=require('util');var moment=require(_0x188c('0x1'));var BPromise=require('bluebird');var rs=require(_0x188c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x188c('0x3'))['db'];var utils=require(_0x188c('0x4'));var logger=require(_0x188c('0x5'))(_0x188c('0x6'));var config=require(_0x188c('0x7'));var jayson=require(_0x188c('0x8'));var client=jayson['client'][_0x188c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x217dd6,_0x40ecdb,_0x21f225){return new BPromise(function(_0x5e3e84,_0x12dfb6){return client[_0x188c('0xa')](_0x217dd6,_0x21f225)['then'](function(_0x578c1a){logger['info'](_0x188c('0xb'),_0x40ecdb,_0x188c('0xc'));logger[_0x188c('0xd')](_0x188c('0xe'),_0x40ecdb,_0x188c('0xc'),JSON[_0x188c('0xf')](_0x578c1a));if(_0x578c1a[_0x188c('0x10')]){if(_0x578c1a[_0x188c('0x10')][_0x188c('0x11')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x40ecdb,_0x578c1a[_0x188c('0x10')]['message']);return _0x12dfb6(_0x578c1a[_0x188c('0x10')]['message']);}logger[_0x188c('0x10')]('DeskAccount,\x20%s,\x20%s',_0x40ecdb,_0x578c1a[_0x188c('0x10')]['message']);return _0x5e3e84(_0x578c1a[_0x188c('0x10')][_0x188c('0x12')]);}else{logger[_0x188c('0x13')](_0x188c('0xb'),_0x40ecdb,_0x188c('0xc'));_0x5e3e84(_0x578c1a['result'][_0x188c('0x12')]);}})['catch'](function(_0x460a5d){logger[_0x188c('0x10')](_0x188c('0xb'),_0x40ecdb,_0x460a5d);_0x12dfb6(_0x460a5d);});});}exports['GetDeskAccount']=function(_0x2d9184){var _0x336847=this;return new Promise(function(_0x34a71d,_0x317d65){return db[_0x188c('0x14')]['findAll']({'raw':_0x2d9184['options']?_0x2d9184[_0x188c('0x15')][_0x188c('0x16')]===undefined?!![]:![]:!![],'where':_0x2d9184['options']?_0x2d9184['options'][_0x188c('0x17')]||null:null,'attributes':_0x2d9184['options']?_0x2d9184[_0x188c('0x15')]['attributes']||null:null,'limit':_0x2d9184[_0x188c('0x15')]?_0x2d9184[_0x188c('0x15')]['limit']||null:null,'include':_0x2d9184['options']?_0x2d9184[_0x188c('0x15')][_0x188c('0x18')]?_[_0x188c('0x19')](_0x2d9184[_0x188c('0x15')][_0x188c('0x18')],function(_0x19b2ad){return{'model':db[_0x19b2ad['model']],'as':_0x19b2ad['as'],'attributes':_0x19b2ad[_0x188c('0x1a')],'include':_0x19b2ad[_0x188c('0x18')]?_[_0x188c('0x19')](_0x19b2ad[_0x188c('0x18')],function(_0x34d98a){return{'model':db[_0x34d98a[_0x188c('0x1b')]],'as':_0x34d98a['as'],'attributes':_0x34d98a[_0x188c('0x1a')],'include':_0x34d98a[_0x188c('0x18')]?_[_0x188c('0x19')](_0x34d98a['include'],function(_0x572446){return{'model':db[_0x572446['model']],'as':_0x572446['as'],'attributes':_0x572446['attributes']};}):[]};}):[]};}):[]:[]})[_0x188c('0x1c')](function(_0x29aa16){logger['info'](_0x188c('0x1d'),_0x2d9184);logger[_0x188c('0xd')](_0x188c('0x1d'),_0x2d9184,JSON[_0x188c('0xf')](_0x29aa16));_0x34a71d(_0x29aa16);})[_0x188c('0x1e')](function(_0x395091){logger['error'](_0x188c('0x1d'),_0x395091['message'],_0x2d9184);_0x317d65(_0x336847[_0x188c('0x10')](0x1f4,_0x395091[_0x188c('0x12')]));});});};exports[_0x188c('0x1f')]=function(_0x5eb6e3){var _0x38ad29=this;return new Promise(function(_0x4d1ee6,_0x214003){return db['DeskAccount'][_0x188c('0x20')]({'raw':_0x5eb6e3[_0x188c('0x15')]?_0x5eb6e3[_0x188c('0x15')][_0x188c('0x16')]===undefined?!![]:![]:!![],'where':_0x5eb6e3[_0x188c('0x15')]?_0x5eb6e3[_0x188c('0x15')][_0x188c('0x17')]||null:null,'attributes':_0x5eb6e3[_0x188c('0x15')]?_0x5eb6e3['options']['attributes']||null:null,'include':_0x5eb6e3[_0x188c('0x15')]?_0x5eb6e3[_0x188c('0x15')][_0x188c('0x18')]?_[_0x188c('0x19')](_0x5eb6e3['options'][_0x188c('0x18')],function(_0x2fef6f){return{'model':db[_0x2fef6f['model']],'as':_0x2fef6f['as'],'attributes':_0x2fef6f[_0x188c('0x1a')],'include':_0x2fef6f['include']?_[_0x188c('0x19')](_0x2fef6f[_0x188c('0x18')],function(_0x224c43){return{'model':db[_0x224c43['model']],'as':_0x224c43['as'],'attributes':_0x224c43['attributes'],'include':_0x224c43[_0x188c('0x18')]?_[_0x188c('0x19')](_0x224c43[_0x188c('0x18')],function(_0x28eca7){return{'model':db[_0x28eca7['model']],'as':_0x28eca7['as'],'attributes':_0x28eca7['attributes']};}):[]};}):[]};}):[]:[]})[_0x188c('0x1c')](function(_0x2b31cb){logger[_0x188c('0x13')](_0x188c('0x1f'),_0x5eb6e3);logger[_0x188c('0xd')](_0x188c('0x1f'),_0x5eb6e3,JSON[_0x188c('0xf')](_0x2b31cb));_0x4d1ee6(_0x2b31cb);})[_0x188c('0x1e')](function(_0x49f5d5){logger[_0x188c('0x10')](_0x188c('0x1f'),_0x49f5d5['message'],_0x5eb6e3);_0x214003(_0x38ad29[_0x188c('0x10')](0x1f4,_0x49f5d5[_0x188c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 1c07845..8bbde2a 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a6736,_0x47a486){var _0x3693fb=function(_0xc916c3){while(--_0xc916c3){_0x3a6736['push'](_0x3a6736['shift']());}};_0x3693fb(++_0x47a486);}(_0x008c,0x188));var _0xc008=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x008c[_0x55c485];return _0x6bb521;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _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(_0xb1a7e8,_0x1092c6){var _0x4db26b=function(_0x2a0a05){while(--_0x2a0a05){_0xb1a7e8['push'](_0xb1a7e8['shift']());}};_0x4db26b(++_0x1092c6);}(_0xedd9,0xfc));var _0x9edd=function(_0x11e08a,_0x4e068a){_0x11e08a=_0x11e08a-0x0;var _0x143ddb=_0xedd9[_0x11e08a];return _0x143ddb;};'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 0478fa7..e271299 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 _0xcaf2=['STRING'];(function(_0x14b637,_0x598130){var _0x3fa824=function(_0x2f6a2b){while(--_0x2f6a2b){_0x14b637['push'](_0x14b637['shift']());}};_0x3fa824(++_0x598130);}(_0xcaf2,0xcb));var _0x2caf=function(_0xbb1add,_0x489d26){_0xbb1add=_0xbb1add-0x0;var _0x1620b1=_0xcaf2[_0xbb1add];return _0x1620b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2caf('0x0')]}}; \ No newline at end of file +var _0x2441=['STRING','sequelize'];(function(_0x240c38,_0x59d016){var _0x82d886=function(_0x3100d9){while(--_0x3100d9){_0x240c38['push'](_0x240c38['shift']());}};_0x82d886(++_0x59d016);}(_0x2441,0x195));var _0x1244=function(_0x11fdcf,_0x32382b){_0x11fdcf=_0x11fdcf-0x0;var _0x704545=_0x2441[_0x11fdcf];return _0x704545;};'use strict';var Sequelize=require(_0x1244('0x0'));module['exports']={'name':{'type':Sequelize[_0x1244('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f34e4c7..c154987 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 _0xce85=['count','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','getSubjects','DeskField','nolimit','getDescriptions','getTags','findOne','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xce85,0x13b));var _0x5ce8=function(_0x2fc0f2,_0x1fa2f6){_0x2fc0f2=_0x2fc0f2-0x0;var _0xd42d53=_0xce85[_0x2fc0f2];return _0xd42d53;};'use strict';var emlformat=require(_0x5ce8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5ce8('0x1'));var rp=require(_0x5ce8('0x2'));var moment=require(_0x5ce8('0x3'));var BPromise=require(_0x5ce8('0x4'));var Mustache=require(_0x5ce8('0x5'));var util=require(_0x5ce8('0x6'));var path=require(_0x5ce8('0x7'));var sox=require(_0x5ce8('0x8'));var csv=require('to-csv');var ejs=require(_0x5ce8('0x9'));var fs=require('fs');var fs_extra=require(_0x5ce8('0xa'));var _=require(_0x5ce8('0xb'));var squel=require(_0x5ce8('0xc'));var crypto=require(_0x5ce8('0xd'));var jsforce=require(_0x5ce8('0xe'));var deskjs=require(_0x5ce8('0xf'));var toCsv=require(_0x5ce8('0x10'));var querystring=require(_0x5ce8('0x11'));var Papa=require(_0x5ce8('0x12'));var Redis=require(_0x5ce8('0x13'));var authService=require(_0x5ce8('0x14'));var qs=require(_0x5ce8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ce8('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x5ce8('0x17'));var config=require(_0x5ce8('0x18'));var licenseUtil=require(_0x5ce8('0x19'));var db=require(_0x5ce8('0x1a'))['db'];function respondWithStatusCode(_0x40e340,_0x9f21b4){_0x9f21b4=_0x9f21b4||0xcc;return function(_0x3c7820){if(_0x3c7820){return _0x40e340['sendStatus'](_0x9f21b4);}return _0x40e340['status'](_0x9f21b4)[_0x5ce8('0x1b')]();};}function respondWithResult(_0x58df6c,_0x3826cd){_0x3826cd=_0x3826cd||0xc8;return function(_0x43b975){if(_0x43b975){return _0x58df6c[_0x5ce8('0x1c')](_0x3826cd)[_0x5ce8('0x1d')](_0x43b975);}};}function respondWithFilteredResult(_0x4f4b79,_0x44dc5e){return function(_0x1bede1){if(_0x1bede1){var _0x4db460=typeof _0x44dc5e[_0x5ce8('0x1e')]===_0x5ce8('0x1f')&&typeof _0x44dc5e[_0x5ce8('0x20')]===_0x5ce8('0x1f');var _0x45269d=_0x1bede1[_0x5ce8('0x21')];var _0x3d6f43=_0x4db460?0x0:_0x44dc5e[_0x5ce8('0x1e')];var _0xebbc13=_0x4db460?_0x1bede1[_0x5ce8('0x21')]:_0x44dc5e['offset']+_0x44dc5e[_0x5ce8('0x20')];var _0xb29b70;if(_0xebbc13>=_0x45269d){_0xebbc13=_0x45269d;_0xb29b70=0xc8;}else{_0xb29b70=0xce;}_0x4f4b79[_0x5ce8('0x1c')](_0xb29b70);return _0x4f4b79[_0x5ce8('0x22')]('Content-Range',_0x3d6f43+'-'+_0xebbc13+'/'+_0x45269d)[_0x5ce8('0x1d')](_0x1bede1);}return null;};}function patchUpdates(_0x21452f){return function(_0x320574){try{jsonpatch[_0x5ce8('0x23')](_0x320574,_0x21452f,!![]);}catch(_0x7df879){return BPromise[_0x5ce8('0x24')](_0x7df879);}return _0x320574['save']();};}function saveUpdates(_0x9016e2,_0x15aa7b){return function(_0x401ce2){if(_0x401ce2){return _0x401ce2[_0x5ce8('0x25')](_0x9016e2)['then'](function(_0x589ad4){return _0x589ad4;});}return null;};}function removeEntity(_0x1008aa,_0x493423){return function(_0x330678){if(_0x330678){return _0x330678[_0x5ce8('0x26')]()[_0x5ce8('0x27')](function(){_0x1008aa[_0x5ce8('0x1c')](0xcc)[_0x5ce8('0x1b')]();});}};}function handleEntityNotFound(_0x1a1eaf,_0x5e11c6){return function(_0x2b8dc5){if(!_0x2b8dc5){_0x1a1eaf[_0x5ce8('0x28')](0x194);}return _0x2b8dc5;};}function handleError(_0x4b9ee2,_0x1bb30b){_0x1bb30b=_0x1bb30b||0x1f4;return function(_0x42dde5){logger[_0x5ce8('0x29')](_0x42dde5[_0x5ce8('0x2a')]);if(_0x42dde5[_0x5ce8('0x2b')]){delete _0x42dde5['name'];}_0x4b9ee2[_0x5ce8('0x1c')](_0x1bb30b)[_0x5ce8('0x2c')](_0x42dde5);};}exports[_0x5ce8('0x2d')]=function(_0x4b916e,_0xd5bee){var _0x2cfe37={},_0x2a3512={},_0x278760={'count':0x0,'rows':[]};var _0xbafd94=_[_0x5ce8('0x2e')](db[_0x5ce8('0x2f')][_0x5ce8('0x30')],function(_0xbf209c){return{'name':_0xbf209c['fieldName'],'type':_0xbf209c[_0x5ce8('0x31')][_0x5ce8('0x32')]};});_0x2a3512[_0x5ce8('0x33')]=_[_0x5ce8('0x2e')](_0xbafd94,_0x5ce8('0x2b'));_0x2a3512[_0x5ce8('0x34')]=_[_0x5ce8('0x35')](_0x4b916e['query']);_0x2a3512[_0x5ce8('0x36')]=_[_0x5ce8('0x37')](_0x2a3512[_0x5ce8('0x33')],_0x2a3512[_0x5ce8('0x34')]);_0x2cfe37[_0x5ce8('0x38')]=_[_0x5ce8('0x37')](_0x2a3512[_0x5ce8('0x33')],qs['fields'](_0x4b916e[_0x5ce8('0x34')][_0x5ce8('0x39')]));_0x2cfe37[_0x5ce8('0x38')]=_0x2cfe37[_0x5ce8('0x38')][_0x5ce8('0x3a')]?_0x2cfe37[_0x5ce8('0x38')]:_0x2a3512[_0x5ce8('0x33')];if(!_0x4b916e[_0x5ce8('0x34')][_0x5ce8('0x3b')]('nolimit')){_0x2cfe37[_0x5ce8('0x20')]=qs[_0x5ce8('0x20')](_0x4b916e[_0x5ce8('0x34')]['limit']);_0x2cfe37['offset']=qs[_0x5ce8('0x1e')](_0x4b916e[_0x5ce8('0x34')][_0x5ce8('0x1e')]);}_0x2cfe37[_0x5ce8('0x3c')]=qs[_0x5ce8('0x3d')](_0x4b916e[_0x5ce8('0x34')]['sort']);_0x2cfe37['where']=qs['filters'](_[_0x5ce8('0x3e')](_0x4b916e[_0x5ce8('0x34')],_0x2a3512['filters']),_0xbafd94);if(_0x4b916e[_0x5ce8('0x34')][_0x5ce8('0x3f')]){_0x2cfe37[_0x5ce8('0x40')]=_[_0x5ce8('0x41')](_0x2cfe37[_0x5ce8('0x40')],{'$or':_[_0x5ce8('0x2e')](_0xbafd94,function(_0x5b6ba8){if(_0x5b6ba8[_0x5ce8('0x31')]!==_0x5ce8('0x42')){var _0x5a6039={};_0x5a6039[_0x5b6ba8[_0x5ce8('0x2b')]]={'$like':'%'+_0x4b916e[_0x5ce8('0x34')]['filter']+'%'};return _0x5a6039;}})});}_0x2cfe37=_['merge']({},_0x2cfe37,_0x4b916e[_0x5ce8('0x43')]);var _0x323dee={'where':_0x2cfe37['where']};return db[_0x5ce8('0x2f')][_0x5ce8('0x21')](_0x323dee)['then'](function(_0x35a1bd){_0x278760[_0x5ce8('0x21')]=_0x35a1bd;if(_0x4b916e[_0x5ce8('0x34')][_0x5ce8('0x44')]){_0x2cfe37[_0x5ce8('0x45')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x5ce8('0x46')](_0x2cfe37);})[_0x5ce8('0x27')](function(_0x21c913){_0x278760[_0x5ce8('0x47')]=_0x21c913;return _0x278760;})['then'](respondWithFilteredResult(_0xd5bee,_0x2cfe37))[_0x5ce8('0x48')](handleError(_0xd5bee,null));};exports[_0x5ce8('0x49')]=function(_0x47068c,_0x2dc255){var _0x29aca6={'raw':![],'where':{'id':_0x47068c[_0x5ce8('0x4a')]['id']}},_0xbc95d2={};_0xbc95d2[_0x5ce8('0x33')]=_[_0x5ce8('0x35')](db['DeskConfiguration'][_0x5ce8('0x30')]);_0xbc95d2[_0x5ce8('0x34')]=_['keys'](_0x47068c['query']);_0xbc95d2['filters']=_[_0x5ce8('0x37')](_0xbc95d2[_0x5ce8('0x33')],_0xbc95d2[_0x5ce8('0x34')]);_0x29aca6[_0x5ce8('0x38')]=_['intersection'](_0xbc95d2['model'],qs[_0x5ce8('0x39')](_0x47068c['query'][_0x5ce8('0x39')]));_0x29aca6[_0x5ce8('0x38')]=_0x29aca6[_0x5ce8('0x38')][_0x5ce8('0x3a')]?_0x29aca6[_0x5ce8('0x38')]:_0xbc95d2[_0x5ce8('0x33')];if(_0x47068c['query']['includeAll']){_0x29aca6[_0x5ce8('0x45')]=[{'all':!![]}];}_0x29aca6=_[_0x5ce8('0x41')]({},_0x29aca6,_0x47068c[_0x5ce8('0x43')]);return db[_0x5ce8('0x2f')][_0x5ce8('0x4b')](_0x29aca6)[_0x5ce8('0x27')](handleEntityNotFound(_0x2dc255,null))[_0x5ce8('0x27')](respondWithResult(_0x2dc255,null))[_0x5ce8('0x48')](handleError(_0x2dc255,null));};exports[_0x5ce8('0x4c')]=function(_0x2d03fa,_0x1eaebf){return db[_0x5ce8('0x2f')]['create'](_0x2d03fa[_0x5ce8('0x4d')],{})[_0x5ce8('0x27')](respondWithResult(_0x1eaebf,0xc9))[_0x5ce8('0x48')](handleError(_0x1eaebf,null));};exports[_0x5ce8('0x25')]=function(_0x597793,_0x594383){if(_0x597793[_0x5ce8('0x4d')]['id']){delete _0x597793['body']['id'];}return db[_0x5ce8('0x2f')][_0x5ce8('0x4b')]({'where':{'id':_0x597793[_0x5ce8('0x4a')]['id']}})[_0x5ce8('0x27')](handleEntityNotFound(_0x594383,null))[_0x5ce8('0x27')](saveUpdates(_0x597793['body'],null))[_0x5ce8('0x27')](respondWithResult(_0x594383,null))[_0x5ce8('0x48')](handleError(_0x594383,null));};exports[_0x5ce8('0x26')]=function(_0x39562e,_0x5de275){return db[_0x5ce8('0x2f')][_0x5ce8('0x4b')]({'where':{'id':_0x39562e['params']['id']}})['then'](handleEntityNotFound(_0x5de275,null))['then'](removeEntity(_0x5de275,null))['catch'](handleError(_0x5de275,null));};exports[_0x5ce8('0x4e')]=function(_0x18ce77,_0x31705e,_0x157734){var _0x4ae70b={};var _0x466f46={};var _0x358e7b;var _0x130457;return db['DeskConfiguration']['findOne']({'where':{'id':_0x18ce77[_0x5ce8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31705e,null))[_0x5ce8('0x27')](function(_0x51b966){if(_0x51b966){_0x358e7b=_0x51b966;_0x466f46[_0x5ce8('0x33')]=_[_0x5ce8('0x35')](db['DeskField'][_0x5ce8('0x30')]);_0x466f46['query']=_[_0x5ce8('0x35')](_0x18ce77[_0x5ce8('0x34')]);_0x466f46[_0x5ce8('0x36')]=_[_0x5ce8('0x37')](_0x466f46[_0x5ce8('0x33')],_0x466f46['query']);_0x4ae70b[_0x5ce8('0x38')]=_[_0x5ce8('0x37')](_0x466f46[_0x5ce8('0x33')],qs[_0x5ce8('0x39')](_0x18ce77['query'][_0x5ce8('0x39')]));_0x4ae70b[_0x5ce8('0x38')]=_0x4ae70b['attributes'][_0x5ce8('0x3a')]?_0x4ae70b[_0x5ce8('0x38')]:_0x466f46[_0x5ce8('0x33')];_0x4ae70b[_0x5ce8('0x3c')]=qs[_0x5ce8('0x3d')](_0x18ce77[_0x5ce8('0x34')][_0x5ce8('0x3d')]);_0x4ae70b[_0x5ce8('0x40')]=qs[_0x5ce8('0x36')](_[_0x5ce8('0x3e')](_0x18ce77[_0x5ce8('0x34')],_0x466f46['filters']));if(_0x18ce77[_0x5ce8('0x34')]['filter']){_0x4ae70b[_0x5ce8('0x40')]=_[_0x5ce8('0x41')](_0x4ae70b[_0x5ce8('0x40')],{'$or':_['map'](_0x4ae70b[_0x5ce8('0x38')],function(_0x43448d){var _0x196d6d={};_0x196d6d[_0x43448d]={'$like':'%'+_0x18ce77[_0x5ce8('0x34')][_0x5ce8('0x3f')]+'%'};return _0x196d6d;})});}_0x4ae70b=_['merge']({},_0x4ae70b,_0x18ce77[_0x5ce8('0x43')]);return _0x358e7b[_0x5ce8('0x4e')](_0x4ae70b);}})[_0x5ce8('0x27')](function(_0x540b54){if(_0x540b54){_0x130457=_0x540b54[_0x5ce8('0x3a')];if(!_0x18ce77[_0x5ce8('0x34')][_0x5ce8('0x3b')]('nolimit')){_0x4ae70b[_0x5ce8('0x20')]=qs[_0x5ce8('0x20')](_0x18ce77[_0x5ce8('0x34')][_0x5ce8('0x20')]);_0x4ae70b[_0x5ce8('0x1e')]=qs[_0x5ce8('0x1e')](_0x18ce77[_0x5ce8('0x34')][_0x5ce8('0x1e')]);}return _0x358e7b[_0x5ce8('0x4e')](_0x4ae70b);}})[_0x5ce8('0x27')](function(_0x1d324b){if(_0x1d324b){return _0x1d324b?{'count':_0x130457,'rows':_0x1d324b}:null;}})[_0x5ce8('0x27')](respondWithResult(_0x31705e,null))['catch'](handleError(_0x31705e,null));};exports[_0x5ce8('0x4f')]=function(_0x2cf1a5,_0x3c2fa2,_0x46ec9a){var _0x4f80cc={};var _0x2b2137={};var _0x555568;var _0x260966;return db[_0x5ce8('0x2f')]['findOne']({'where':{'id':_0x2cf1a5[_0x5ce8('0x4a')]['id']}})[_0x5ce8('0x27')](handleEntityNotFound(_0x3c2fa2,null))['then'](function(_0x53252c){if(_0x53252c){_0x555568=_0x53252c;_0x2b2137[_0x5ce8('0x33')]=_[_0x5ce8('0x35')](db[_0x5ce8('0x50')][_0x5ce8('0x30')]);_0x2b2137[_0x5ce8('0x34')]=_[_0x5ce8('0x35')](_0x2cf1a5['query']);_0x2b2137[_0x5ce8('0x36')]=_[_0x5ce8('0x37')](_0x2b2137['model'],_0x2b2137[_0x5ce8('0x34')]);_0x4f80cc[_0x5ce8('0x38')]=_[_0x5ce8('0x37')](_0x2b2137[_0x5ce8('0x33')],qs[_0x5ce8('0x39')](_0x2cf1a5[_0x5ce8('0x34')][_0x5ce8('0x39')]));_0x4f80cc[_0x5ce8('0x38')]=_0x4f80cc['attributes'][_0x5ce8('0x3a')]?_0x4f80cc[_0x5ce8('0x38')]:_0x2b2137[_0x5ce8('0x33')];_0x4f80cc[_0x5ce8('0x3c')]=qs[_0x5ce8('0x3d')](_0x2cf1a5[_0x5ce8('0x34')][_0x5ce8('0x3d')]);_0x4f80cc['where']=qs[_0x5ce8('0x36')](_[_0x5ce8('0x3e')](_0x2cf1a5[_0x5ce8('0x34')],_0x2b2137[_0x5ce8('0x36')]));if(_0x2cf1a5['query'][_0x5ce8('0x3f')]){_0x4f80cc[_0x5ce8('0x40')]=_[_0x5ce8('0x41')](_0x4f80cc[_0x5ce8('0x40')],{'$or':_['map'](_0x4f80cc[_0x5ce8('0x38')],function(_0x37bb23){var _0xd3bb12={};_0xd3bb12[_0x37bb23]={'$like':'%'+_0x2cf1a5[_0x5ce8('0x34')][_0x5ce8('0x3f')]+'%'};return _0xd3bb12;})});}_0x4f80cc=_[_0x5ce8('0x41')]({},_0x4f80cc,_0x2cf1a5[_0x5ce8('0x43')]);return _0x555568[_0x5ce8('0x4f')](_0x4f80cc);}})[_0x5ce8('0x27')](function(_0x3da5a0){if(_0x3da5a0){_0x260966=_0x3da5a0[_0x5ce8('0x3a')];if(!_0x2cf1a5[_0x5ce8('0x34')][_0x5ce8('0x3b')](_0x5ce8('0x51'))){_0x4f80cc[_0x5ce8('0x20')]=qs[_0x5ce8('0x20')](_0x2cf1a5[_0x5ce8('0x34')][_0x5ce8('0x20')]);_0x4f80cc['offset']=qs[_0x5ce8('0x1e')](_0x2cf1a5[_0x5ce8('0x34')]['offset']);}return _0x555568[_0x5ce8('0x4f')](_0x4f80cc);}})['then'](function(_0x304034){if(_0x304034){return _0x304034?{'count':_0x260966,'rows':_0x304034}:null;}})[_0x5ce8('0x27')](respondWithResult(_0x3c2fa2,null))['catch'](handleError(_0x3c2fa2,null));};exports[_0x5ce8('0x52')]=function(_0x3778b0,_0x116d6e,_0x5351c3){var _0xb459f={};var _0x4e4a53={};var _0xa2e41d;var _0x333d51;return db[_0x5ce8('0x2f')]['findOne']({'where':{'id':_0x3778b0[_0x5ce8('0x4a')]['id']}})[_0x5ce8('0x27')](handleEntityNotFound(_0x116d6e,null))['then'](function(_0x1a0609){if(_0x1a0609){_0xa2e41d=_0x1a0609;_0x4e4a53['model']=_[_0x5ce8('0x35')](db[_0x5ce8('0x50')][_0x5ce8('0x30')]);_0x4e4a53[_0x5ce8('0x34')]=_[_0x5ce8('0x35')](_0x3778b0[_0x5ce8('0x34')]);_0x4e4a53[_0x5ce8('0x36')]=_[_0x5ce8('0x37')](_0x4e4a53[_0x5ce8('0x33')],_0x4e4a53[_0x5ce8('0x34')]);_0xb459f[_0x5ce8('0x38')]=_[_0x5ce8('0x37')](_0x4e4a53[_0x5ce8('0x33')],qs[_0x5ce8('0x39')](_0x3778b0[_0x5ce8('0x34')][_0x5ce8('0x39')]));_0xb459f[_0x5ce8('0x38')]=_0xb459f[_0x5ce8('0x38')][_0x5ce8('0x3a')]?_0xb459f[_0x5ce8('0x38')]:_0x4e4a53[_0x5ce8('0x33')];_0xb459f[_0x5ce8('0x3c')]=qs['sort'](_0x3778b0[_0x5ce8('0x34')]['sort']);_0xb459f[_0x5ce8('0x40')]=qs[_0x5ce8('0x36')](_[_0x5ce8('0x3e')](_0x3778b0[_0x5ce8('0x34')],_0x4e4a53[_0x5ce8('0x36')]));if(_0x3778b0[_0x5ce8('0x34')][_0x5ce8('0x3f')]){_0xb459f[_0x5ce8('0x40')]=_[_0x5ce8('0x41')](_0xb459f['where'],{'$or':_[_0x5ce8('0x2e')](_0xb459f['attributes'],function(_0x2bcffc){var _0x21783e={};_0x21783e[_0x2bcffc]={'$like':'%'+_0x3778b0[_0x5ce8('0x34')]['filter']+'%'};return _0x21783e;})});}_0xb459f=_[_0x5ce8('0x41')]({},_0xb459f,_0x3778b0[_0x5ce8('0x43')]);return _0xa2e41d[_0x5ce8('0x52')](_0xb459f);}})['then'](function(_0x11a14f){if(_0x11a14f){_0x333d51=_0x11a14f[_0x5ce8('0x3a')];if(!_0x3778b0[_0x5ce8('0x34')][_0x5ce8('0x3b')](_0x5ce8('0x51'))){_0xb459f[_0x5ce8('0x20')]=qs['limit'](_0x3778b0[_0x5ce8('0x34')][_0x5ce8('0x20')]);_0xb459f['offset']=qs['offset'](_0x3778b0[_0x5ce8('0x34')][_0x5ce8('0x1e')]);}return _0xa2e41d[_0x5ce8('0x52')](_0xb459f);}})[_0x5ce8('0x27')](function(_0x496bd9){if(_0x496bd9){return _0x496bd9?{'count':_0x333d51,'rows':_0x496bd9}:null;}})[_0x5ce8('0x27')](respondWithResult(_0x116d6e,null))[_0x5ce8('0x48')](handleError(_0x116d6e,null));};exports[_0x5ce8('0x53')]=function(_0x253e7b,_0x132c9e,_0x5e7d66){var _0x3ed1c9={};var _0x27aaba={};var _0x552584;var _0x3e18a2;return db[_0x5ce8('0x2f')][_0x5ce8('0x54')]({'where':{'id':_0x253e7b[_0x5ce8('0x4a')]['id']}})[_0x5ce8('0x27')](handleEntityNotFound(_0x132c9e,null))['then'](function(_0xa2dce7){if(_0xa2dce7){_0x552584=_0xa2dce7;_0x27aaba[_0x5ce8('0x33')]=_[_0x5ce8('0x35')](db['Tag'][_0x5ce8('0x30')]);_0x27aaba[_0x5ce8('0x34')]=_['keys'](_0x253e7b[_0x5ce8('0x34')]);_0x27aaba['filters']=_['intersection'](_0x27aaba[_0x5ce8('0x33')],_0x27aaba[_0x5ce8('0x34')]);_0x3ed1c9[_0x5ce8('0x38')]=_[_0x5ce8('0x37')](_0x27aaba[_0x5ce8('0x33')],qs[_0x5ce8('0x39')](_0x253e7b[_0x5ce8('0x34')][_0x5ce8('0x39')]));_0x3ed1c9[_0x5ce8('0x38')]=_0x3ed1c9['attributes']['length']?_0x3ed1c9['attributes']:_0x27aaba['model'];_0x3ed1c9[_0x5ce8('0x3c')]=qs[_0x5ce8('0x3d')](_0x253e7b[_0x5ce8('0x34')][_0x5ce8('0x3d')]);_0x3ed1c9[_0x5ce8('0x40')]=qs[_0x5ce8('0x36')](_[_0x5ce8('0x3e')](_0x253e7b[_0x5ce8('0x34')],_0x27aaba[_0x5ce8('0x36')]));if(_0x253e7b[_0x5ce8('0x34')][_0x5ce8('0x3f')]){_0x3ed1c9[_0x5ce8('0x40')]=_[_0x5ce8('0x41')](_0x3ed1c9[_0x5ce8('0x40')],{'$or':_[_0x5ce8('0x2e')](_0x3ed1c9[_0x5ce8('0x38')],function(_0x2196ac){var _0x4ff61a={};_0x4ff61a[_0x2196ac]={'$like':'%'+_0x253e7b[_0x5ce8('0x34')][_0x5ce8('0x3f')]+'%'};return _0x4ff61a;})});}_0x3ed1c9=_['merge']({},_0x3ed1c9,_0x253e7b['options']);return _0x552584[_0x5ce8('0x53')](_0x3ed1c9);}})['then'](function(_0x259328){if(_0x259328){_0x3e18a2=_0x259328[_0x5ce8('0x3a')];if(!_0x253e7b[_0x5ce8('0x34')]['hasOwnProperty'](_0x5ce8('0x51'))){_0x3ed1c9[_0x5ce8('0x20')]=qs[_0x5ce8('0x20')](_0x253e7b['query'][_0x5ce8('0x20')]);_0x3ed1c9[_0x5ce8('0x1e')]=qs[_0x5ce8('0x1e')](_0x253e7b[_0x5ce8('0x34')][_0x5ce8('0x1e')]);}return _0x552584[_0x5ce8('0x53')](_0x3ed1c9);}})[_0x5ce8('0x27')](function(_0xe32f9b){if(_0xe32f9b){return _0xe32f9b?{'count':_0x3e18a2,'rows':_0xe32f9b}:null;}})[_0x5ce8('0x27')](respondWithResult(_0x132c9e,null))[_0x5ce8('0x48')](handleError(_0x132c9e,null));};exports[_0x5ce8('0x55')]=function(_0x47f3f9,_0x3d7089,_0x519de6){if(_0x47f3f9[_0x5ce8('0x4d')]['id']){delete _0x47f3f9['body']['id'];}return db[_0x5ce8('0x2f')][_0x5ce8('0x54')]({'where':{'id':_0x47f3f9[_0x5ce8('0x4a')]['id']}})[_0x5ce8('0x27')](handleEntityNotFound(_0x3d7089,null))['then'](function(_0x70005b){if(_0x70005b){return _0x70005b[_0x5ce8('0x55')](_0x47f3f9['body'][_0x5ce8('0x56')]||[]);}return null;})[_0x5ce8('0x27')](respondWithResult(_0x3d7089,null))[_0x5ce8('0x48')](handleError(_0x3d7089,null));}; \ No newline at end of file +var _0xfb63=['ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then','sendStatus','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','getFields','DeskField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','options','getTags','Tag','setTags'];(function(_0x532d5d,_0x5cee31){var _0x515d9a=function(_0x4fe2bc){while(--_0x4fe2bc){_0x532d5d['push'](_0x532d5d['shift']());}};_0x515d9a(++_0x5cee31);}(_0xfb63,0x16d));var _0x3fb6=function(_0x247a9d,_0x2424a5){_0x247a9d=_0x247a9d-0x0;var _0x7d0e78=_0xfb63[_0x247a9d];return _0x7d0e78;};'use strict';var emlformat=require(_0x3fb6('0x0'));var rimraf=require(_0x3fb6('0x1'));var zipdir=require(_0x3fb6('0x2'));var jsonpatch=require(_0x3fb6('0x3'));var rp=require(_0x3fb6('0x4'));var moment=require(_0x3fb6('0x5'));var BPromise=require(_0x3fb6('0x6'));var Mustache=require(_0x3fb6('0x7'));var util=require(_0x3fb6('0x8'));var path=require(_0x3fb6('0x9'));var sox=require(_0x3fb6('0xa'));var csv=require(_0x3fb6('0xb'));var ejs=require(_0x3fb6('0xc'));var fs=require('fs');var fs_extra=require(_0x3fb6('0xd'));var _=require(_0x3fb6('0xe'));var squel=require(_0x3fb6('0xf'));var crypto=require(_0x3fb6('0x10'));var jsforce=require(_0x3fb6('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x3fb6('0xb'));var querystring=require(_0x3fb6('0x12'));var Papa=require(_0x3fb6('0x13'));var Redis=require(_0x3fb6('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x3fb6('0x15'));var as=require(_0x3fb6('0x16'));var hardwareService=require(_0x3fb6('0x17'));var logger=require(_0x3fb6('0x18'))(_0x3fb6('0x19'));var utils=require(_0x3fb6('0x1a'));var config=require(_0x3fb6('0x1b'));var licenseUtil=require(_0x3fb6('0x1c'));var db=require(_0x3fb6('0x1d'))['db'];function respondWithStatusCode(_0x6e35a2,_0x3ca8c4){_0x3ca8c4=_0x3ca8c4||0xcc;return function(_0x4de369){if(_0x4de369){return _0x6e35a2['sendStatus'](_0x3ca8c4);}return _0x6e35a2[_0x3fb6('0x1e')](_0x3ca8c4)[_0x3fb6('0x1f')]();};}function respondWithResult(_0x4ac0a9,_0x1a408e){_0x1a408e=_0x1a408e||0xc8;return function(_0x5f0fdb){if(_0x5f0fdb){return _0x4ac0a9['status'](_0x1a408e)['json'](_0x5f0fdb);}};}function respondWithFilteredResult(_0x16c21e,_0xbdc23f){return function(_0x17365f){if(_0x17365f){var _0x3a0e20=typeof _0xbdc23f[_0x3fb6('0x20')]===_0x3fb6('0x21')&&typeof _0xbdc23f[_0x3fb6('0x22')]===_0x3fb6('0x21');var _0xae2b58=_0x17365f['count'];var _0x30728e=_0x3a0e20?0x0:_0xbdc23f[_0x3fb6('0x20')];var _0x3f9934=_0x3a0e20?_0x17365f[_0x3fb6('0x23')]:_0xbdc23f[_0x3fb6('0x20')]+_0xbdc23f['limit'];var _0x212c95;if(_0x3f9934>=_0xae2b58){_0x3f9934=_0xae2b58;_0x212c95=0xc8;}else{_0x212c95=0xce;}_0x16c21e[_0x3fb6('0x1e')](_0x212c95);return _0x16c21e['set'](_0x3fb6('0x24'),_0x30728e+'-'+_0x3f9934+'/'+_0xae2b58)[_0x3fb6('0x25')](_0x17365f);}return null;};}function patchUpdates(_0x5727a3){return function(_0x1a3392){try{jsonpatch[_0x3fb6('0x26')](_0x1a3392,_0x5727a3,!![]);}catch(_0x1eb907){return BPromise['reject'](_0x1eb907);}return _0x1a3392[_0x3fb6('0x27')]();};}function saveUpdates(_0x25fb84,_0x4d5b5f){return function(_0x43f4b){if(_0x43f4b){return _0x43f4b['update'](_0x25fb84)[_0x3fb6('0x28')](function(_0x12978c){return _0x12978c;});}return null;};}function removeEntity(_0x2b5db3,_0x2b2c25){return function(_0x423729){if(_0x423729){return _0x423729['destroy']()[_0x3fb6('0x28')](function(){_0x2b5db3[_0x3fb6('0x1e')](0xcc)[_0x3fb6('0x1f')]();});}};}function handleEntityNotFound(_0x1f9510,_0x368820){return function(_0xe0596){if(!_0xe0596){_0x1f9510[_0x3fb6('0x29')](0x194);}return _0xe0596;};}function handleError(_0x494160,_0x37e5c0){_0x37e5c0=_0x37e5c0||0x1f4;return function(_0x32351f){logger['error'](_0x32351f[_0x3fb6('0x2a')]);if(_0x32351f[_0x3fb6('0x2b')]){delete _0x32351f['name'];}_0x494160[_0x3fb6('0x1e')](_0x37e5c0)[_0x3fb6('0x2c')](_0x32351f);};}exports[_0x3fb6('0x2d')]=function(_0x8c269b,_0x532b94){var _0x55917c={},_0x8f3f15={},_0x4a9b7c={'count':0x0,'rows':[]};var _0x7aac33=_[_0x3fb6('0x2e')](db[_0x3fb6('0x2f')][_0x3fb6('0x30')],function(_0x4023e4){return{'name':_0x4023e4[_0x3fb6('0x31')],'type':_0x4023e4[_0x3fb6('0x32')][_0x3fb6('0x33')]};});_0x8f3f15[_0x3fb6('0x34')]=_[_0x3fb6('0x2e')](_0x7aac33,_0x3fb6('0x2b'));_0x8f3f15[_0x3fb6('0x35')]=_[_0x3fb6('0x36')](_0x8c269b['query']);_0x8f3f15['filters']=_[_0x3fb6('0x37')](_0x8f3f15['model'],_0x8f3f15[_0x3fb6('0x35')]);_0x55917c[_0x3fb6('0x38')]=_[_0x3fb6('0x37')](_0x8f3f15['model'],qs[_0x3fb6('0x39')](_0x8c269b[_0x3fb6('0x35')][_0x3fb6('0x39')]));_0x55917c[_0x3fb6('0x38')]=_0x55917c['attributes'][_0x3fb6('0x3a')]?_0x55917c['attributes']:_0x8f3f15[_0x3fb6('0x34')];if(!_0x8c269b['query']['hasOwnProperty'](_0x3fb6('0x3b'))){_0x55917c[_0x3fb6('0x22')]=qs[_0x3fb6('0x22')](_0x8c269b[_0x3fb6('0x35')]['limit']);_0x55917c[_0x3fb6('0x20')]=qs[_0x3fb6('0x20')](_0x8c269b[_0x3fb6('0x35')]['offset']);}_0x55917c['order']=qs['sort'](_0x8c269b[_0x3fb6('0x35')][_0x3fb6('0x3c')]);_0x55917c['where']=qs[_0x3fb6('0x3d')](_[_0x3fb6('0x3e')](_0x8c269b[_0x3fb6('0x35')],_0x8f3f15[_0x3fb6('0x3d')]),_0x7aac33);if(_0x8c269b[_0x3fb6('0x35')][_0x3fb6('0x3f')]){_0x55917c['where']=_[_0x3fb6('0x40')](_0x55917c[_0x3fb6('0x41')],{'$or':_[_0x3fb6('0x2e')](_0x7aac33,function(_0x36e35a){if(_0x36e35a[_0x3fb6('0x32')]!==_0x3fb6('0x42')){var _0x11b2c3={};_0x11b2c3[_0x36e35a[_0x3fb6('0x2b')]]={'$like':'%'+_0x8c269b[_0x3fb6('0x35')][_0x3fb6('0x3f')]+'%'};return _0x11b2c3;}})});}_0x55917c=_['merge']({},_0x55917c,_0x8c269b['options']);var _0x394ddc={'where':_0x55917c['where']};return db['DeskConfiguration'][_0x3fb6('0x23')](_0x394ddc)[_0x3fb6('0x28')](function(_0x19bb35){_0x4a9b7c[_0x3fb6('0x23')]=_0x19bb35;if(_0x8c269b['query'][_0x3fb6('0x43')]){_0x55917c[_0x3fb6('0x44')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x3fb6('0x45')](_0x55917c);})[_0x3fb6('0x28')](function(_0x249367){_0x4a9b7c[_0x3fb6('0x46')]=_0x249367;return _0x4a9b7c;})[_0x3fb6('0x28')](respondWithFilteredResult(_0x532b94,_0x55917c))[_0x3fb6('0x47')](handleError(_0x532b94,null));};exports[_0x3fb6('0x48')]=function(_0x30aa2b,_0x3d348d){var _0xeea034={'raw':![],'where':{'id':_0x30aa2b[_0x3fb6('0x49')]['id']}},_0x21d5ec={};_0x21d5ec[_0x3fb6('0x34')]=_['keys'](db[_0x3fb6('0x2f')][_0x3fb6('0x30')]);_0x21d5ec['query']=_[_0x3fb6('0x36')](_0x30aa2b[_0x3fb6('0x35')]);_0x21d5ec['filters']=_[_0x3fb6('0x37')](_0x21d5ec['model'],_0x21d5ec[_0x3fb6('0x35')]);_0xeea034['attributes']=_['intersection'](_0x21d5ec[_0x3fb6('0x34')],qs[_0x3fb6('0x39')](_0x30aa2b[_0x3fb6('0x35')][_0x3fb6('0x39')]));_0xeea034[_0x3fb6('0x38')]=_0xeea034[_0x3fb6('0x38')][_0x3fb6('0x3a')]?_0xeea034[_0x3fb6('0x38')]:_0x21d5ec['model'];if(_0x30aa2b[_0x3fb6('0x35')][_0x3fb6('0x43')]){_0xeea034[_0x3fb6('0x44')]=[{'all':!![]}];}_0xeea034=_[_0x3fb6('0x40')]({},_0xeea034,_0x30aa2b['options']);return db[_0x3fb6('0x2f')][_0x3fb6('0x4a')](_0xeea034)[_0x3fb6('0x28')](handleEntityNotFound(_0x3d348d,null))[_0x3fb6('0x28')](respondWithResult(_0x3d348d,null))[_0x3fb6('0x47')](handleError(_0x3d348d,null));};exports[_0x3fb6('0x4b')]=function(_0x21645c,_0x3d87ac){return db['DeskConfiguration'][_0x3fb6('0x4b')](_0x21645c[_0x3fb6('0x4c')],{})[_0x3fb6('0x28')](respondWithResult(_0x3d87ac,0xc9))[_0x3fb6('0x47')](handleError(_0x3d87ac,null));};exports[_0x3fb6('0x4d')]=function(_0x414fe7,_0x37881f){if(_0x414fe7[_0x3fb6('0x4c')]['id']){delete _0x414fe7[_0x3fb6('0x4c')]['id'];}return db['DeskConfiguration'][_0x3fb6('0x4a')]({'where':{'id':_0x414fe7[_0x3fb6('0x49')]['id']}})[_0x3fb6('0x28')](handleEntityNotFound(_0x37881f,null))[_0x3fb6('0x28')](saveUpdates(_0x414fe7[_0x3fb6('0x4c')],null))[_0x3fb6('0x28')](respondWithResult(_0x37881f,null))['catch'](handleError(_0x37881f,null));};exports[_0x3fb6('0x4e')]=function(_0xe13688,_0xc9a908){return db[_0x3fb6('0x2f')][_0x3fb6('0x4a')]({'where':{'id':_0xe13688[_0x3fb6('0x49')]['id']}})[_0x3fb6('0x28')](handleEntityNotFound(_0xc9a908,null))[_0x3fb6('0x28')](removeEntity(_0xc9a908,null))[_0x3fb6('0x47')](handleError(_0xc9a908,null));};exports[_0x3fb6('0x4f')]=function(_0x2d7c8b,_0x4009ec,_0x35f303){var _0x597df3={};var _0x556c28={};var _0x3b5ff3;var _0xc0e308;return db[_0x3fb6('0x2f')]['findOne']({'where':{'id':_0x2d7c8b[_0x3fb6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4009ec,null))[_0x3fb6('0x28')](function(_0x4b17c7){if(_0x4b17c7){_0x3b5ff3=_0x4b17c7;_0x556c28[_0x3fb6('0x34')]=_[_0x3fb6('0x36')](db[_0x3fb6('0x50')][_0x3fb6('0x30')]);_0x556c28[_0x3fb6('0x35')]=_[_0x3fb6('0x36')](_0x2d7c8b[_0x3fb6('0x35')]);_0x556c28[_0x3fb6('0x3d')]=_[_0x3fb6('0x37')](_0x556c28[_0x3fb6('0x34')],_0x556c28[_0x3fb6('0x35')]);_0x597df3['attributes']=_[_0x3fb6('0x37')](_0x556c28[_0x3fb6('0x34')],qs['fields'](_0x2d7c8b[_0x3fb6('0x35')][_0x3fb6('0x39')]));_0x597df3[_0x3fb6('0x38')]=_0x597df3[_0x3fb6('0x38')][_0x3fb6('0x3a')]?_0x597df3[_0x3fb6('0x38')]:_0x556c28[_0x3fb6('0x34')];_0x597df3[_0x3fb6('0x51')]=qs[_0x3fb6('0x3c')](_0x2d7c8b['query']['sort']);_0x597df3['where']=qs[_0x3fb6('0x3d')](_[_0x3fb6('0x3e')](_0x2d7c8b[_0x3fb6('0x35')],_0x556c28['filters']));if(_0x2d7c8b[_0x3fb6('0x35')]['filter']){_0x597df3[_0x3fb6('0x41')]=_['merge'](_0x597df3['where'],{'$or':_[_0x3fb6('0x2e')](_0x597df3[_0x3fb6('0x38')],function(_0xf3e6a8){var _0x23e70e={};_0x23e70e[_0xf3e6a8]={'$like':'%'+_0x2d7c8b['query'][_0x3fb6('0x3f')]+'%'};return _0x23e70e;})});}_0x597df3=_['merge']({},_0x597df3,_0x2d7c8b['options']);return _0x3b5ff3[_0x3fb6('0x4f')](_0x597df3);}})['then'](function(_0x9a7bb6){if(_0x9a7bb6){_0xc0e308=_0x9a7bb6[_0x3fb6('0x3a')];if(!_0x2d7c8b['query'][_0x3fb6('0x52')](_0x3fb6('0x3b'))){_0x597df3[_0x3fb6('0x22')]=qs[_0x3fb6('0x22')](_0x2d7c8b[_0x3fb6('0x35')][_0x3fb6('0x22')]);_0x597df3[_0x3fb6('0x20')]=qs['offset'](_0x2d7c8b[_0x3fb6('0x35')]['offset']);}return _0x3b5ff3[_0x3fb6('0x4f')](_0x597df3);}})['then'](function(_0x59704b){if(_0x59704b){return _0x59704b?{'count':_0xc0e308,'rows':_0x59704b}:null;}})[_0x3fb6('0x28')](respondWithResult(_0x4009ec,null))[_0x3fb6('0x47')](handleError(_0x4009ec,null));};exports[_0x3fb6('0x53')]=function(_0x4575b9,_0x383237,_0x1d579b){var _0x13bb9f={};var _0x4ab117={};var _0x29bf12;var _0x13b382;return db[_0x3fb6('0x2f')][_0x3fb6('0x54')]({'where':{'id':_0x4575b9[_0x3fb6('0x49')]['id']}})[_0x3fb6('0x28')](handleEntityNotFound(_0x383237,null))['then'](function(_0x5c03d9){if(_0x5c03d9){_0x29bf12=_0x5c03d9;_0x4ab117[_0x3fb6('0x34')]=_['keys'](db['DeskField'][_0x3fb6('0x30')]);_0x4ab117[_0x3fb6('0x35')]=_[_0x3fb6('0x36')](_0x4575b9[_0x3fb6('0x35')]);_0x4ab117[_0x3fb6('0x3d')]=_[_0x3fb6('0x37')](_0x4ab117['model'],_0x4ab117[_0x3fb6('0x35')]);_0x13bb9f[_0x3fb6('0x38')]=_[_0x3fb6('0x37')](_0x4ab117[_0x3fb6('0x34')],qs[_0x3fb6('0x39')](_0x4575b9[_0x3fb6('0x35')]['fields']));_0x13bb9f[_0x3fb6('0x38')]=_0x13bb9f[_0x3fb6('0x38')][_0x3fb6('0x3a')]?_0x13bb9f['attributes']:_0x4ab117[_0x3fb6('0x34')];_0x13bb9f['order']=qs['sort'](_0x4575b9[_0x3fb6('0x35')][_0x3fb6('0x3c')]);_0x13bb9f['where']=qs[_0x3fb6('0x3d')](_[_0x3fb6('0x3e')](_0x4575b9['query'],_0x4ab117[_0x3fb6('0x3d')]));if(_0x4575b9[_0x3fb6('0x35')][_0x3fb6('0x3f')]){_0x13bb9f[_0x3fb6('0x41')]=_[_0x3fb6('0x40')](_0x13bb9f[_0x3fb6('0x41')],{'$or':_['map'](_0x13bb9f['attributes'],function(_0x33c394){var _0x4b178c={};_0x4b178c[_0x33c394]={'$like':'%'+_0x4575b9['query'][_0x3fb6('0x3f')]+'%'};return _0x4b178c;})});}_0x13bb9f=_[_0x3fb6('0x40')]({},_0x13bb9f,_0x4575b9['options']);return _0x29bf12[_0x3fb6('0x53')](_0x13bb9f);}})[_0x3fb6('0x28')](function(_0x113a36){if(_0x113a36){_0x13b382=_0x113a36[_0x3fb6('0x3a')];if(!_0x4575b9['query'][_0x3fb6('0x52')](_0x3fb6('0x3b'))){_0x13bb9f[_0x3fb6('0x22')]=qs['limit'](_0x4575b9[_0x3fb6('0x35')][_0x3fb6('0x22')]);_0x13bb9f[_0x3fb6('0x20')]=qs[_0x3fb6('0x20')](_0x4575b9['query']['offset']);}return _0x29bf12[_0x3fb6('0x53')](_0x13bb9f);}})[_0x3fb6('0x28')](function(_0x4ef3d0){if(_0x4ef3d0){return _0x4ef3d0?{'count':_0x13b382,'rows':_0x4ef3d0}:null;}})[_0x3fb6('0x28')](respondWithResult(_0x383237,null))['catch'](handleError(_0x383237,null));};exports[_0x3fb6('0x55')]=function(_0x47ed74,_0x18e775,_0x463df4){var _0x4d7269={};var _0x4847ba={};var _0x2a15f3;var _0x29a92e;return db['DeskConfiguration']['findOne']({'where':{'id':_0x47ed74[_0x3fb6('0x49')]['id']}})[_0x3fb6('0x28')](handleEntityNotFound(_0x18e775,null))[_0x3fb6('0x28')](function(_0x39aebf){if(_0x39aebf){_0x2a15f3=_0x39aebf;_0x4847ba[_0x3fb6('0x34')]=_[_0x3fb6('0x36')](db[_0x3fb6('0x50')][_0x3fb6('0x30')]);_0x4847ba[_0x3fb6('0x35')]=_[_0x3fb6('0x36')](_0x47ed74['query']);_0x4847ba[_0x3fb6('0x3d')]=_[_0x3fb6('0x37')](_0x4847ba[_0x3fb6('0x34')],_0x4847ba['query']);_0x4d7269['attributes']=_[_0x3fb6('0x37')](_0x4847ba[_0x3fb6('0x34')],qs['fields'](_0x47ed74[_0x3fb6('0x35')][_0x3fb6('0x39')]));_0x4d7269[_0x3fb6('0x38')]=_0x4d7269[_0x3fb6('0x38')][_0x3fb6('0x3a')]?_0x4d7269['attributes']:_0x4847ba[_0x3fb6('0x34')];_0x4d7269[_0x3fb6('0x51')]=qs[_0x3fb6('0x3c')](_0x47ed74['query'][_0x3fb6('0x3c')]);_0x4d7269[_0x3fb6('0x41')]=qs[_0x3fb6('0x3d')](_[_0x3fb6('0x3e')](_0x47ed74['query'],_0x4847ba[_0x3fb6('0x3d')]));if(_0x47ed74['query'][_0x3fb6('0x3f')]){_0x4d7269['where']=_['merge'](_0x4d7269[_0x3fb6('0x41')],{'$or':_['map'](_0x4d7269[_0x3fb6('0x38')],function(_0x5da2df){var _0x426ee1={};_0x426ee1[_0x5da2df]={'$like':'%'+_0x47ed74['query'][_0x3fb6('0x3f')]+'%'};return _0x426ee1;})});}_0x4d7269=_['merge']({},_0x4d7269,_0x47ed74[_0x3fb6('0x56')]);return _0x2a15f3['getDescriptions'](_0x4d7269);}})['then'](function(_0x289ff4){if(_0x289ff4){_0x29a92e=_0x289ff4['length'];if(!_0x47ed74['query'][_0x3fb6('0x52')](_0x3fb6('0x3b'))){_0x4d7269[_0x3fb6('0x22')]=qs[_0x3fb6('0x22')](_0x47ed74['query'][_0x3fb6('0x22')]);_0x4d7269[_0x3fb6('0x20')]=qs[_0x3fb6('0x20')](_0x47ed74[_0x3fb6('0x35')][_0x3fb6('0x20')]);}return _0x2a15f3[_0x3fb6('0x55')](_0x4d7269);}})[_0x3fb6('0x28')](function(_0x47bd1d){if(_0x47bd1d){return _0x47bd1d?{'count':_0x29a92e,'rows':_0x47bd1d}:null;}})[_0x3fb6('0x28')](respondWithResult(_0x18e775,null))['catch'](handleError(_0x18e775,null));};exports[_0x3fb6('0x57')]=function(_0x5f29eb,_0x484d20,_0x75ebd9){var _0x377c87={};var _0x3d71cb={};var _0x4428c6;var _0x4e9843;return db[_0x3fb6('0x2f')][_0x3fb6('0x54')]({'where':{'id':_0x5f29eb['params']['id']}})[_0x3fb6('0x28')](handleEntityNotFound(_0x484d20,null))[_0x3fb6('0x28')](function(_0x325d38){if(_0x325d38){_0x4428c6=_0x325d38;_0x3d71cb[_0x3fb6('0x34')]=_[_0x3fb6('0x36')](db[_0x3fb6('0x58')]['rawAttributes']);_0x3d71cb[_0x3fb6('0x35')]=_[_0x3fb6('0x36')](_0x5f29eb['query']);_0x3d71cb[_0x3fb6('0x3d')]=_[_0x3fb6('0x37')](_0x3d71cb['model'],_0x3d71cb['query']);_0x377c87[_0x3fb6('0x38')]=_[_0x3fb6('0x37')](_0x3d71cb[_0x3fb6('0x34')],qs[_0x3fb6('0x39')](_0x5f29eb[_0x3fb6('0x35')][_0x3fb6('0x39')]));_0x377c87[_0x3fb6('0x38')]=_0x377c87[_0x3fb6('0x38')][_0x3fb6('0x3a')]?_0x377c87[_0x3fb6('0x38')]:_0x3d71cb['model'];_0x377c87[_0x3fb6('0x51')]=qs[_0x3fb6('0x3c')](_0x5f29eb['query'][_0x3fb6('0x3c')]);_0x377c87[_0x3fb6('0x41')]=qs['filters'](_[_0x3fb6('0x3e')](_0x5f29eb[_0x3fb6('0x35')],_0x3d71cb['filters']));if(_0x5f29eb['query']['filter']){_0x377c87[_0x3fb6('0x41')]=_[_0x3fb6('0x40')](_0x377c87[_0x3fb6('0x41')],{'$or':_['map'](_0x377c87[_0x3fb6('0x38')],function(_0x518084){var _0x5822be={};_0x5822be[_0x518084]={'$like':'%'+_0x5f29eb[_0x3fb6('0x35')][_0x3fb6('0x3f')]+'%'};return _0x5822be;})});}_0x377c87=_[_0x3fb6('0x40')]({},_0x377c87,_0x5f29eb[_0x3fb6('0x56')]);return _0x4428c6['getTags'](_0x377c87);}})[_0x3fb6('0x28')](function(_0x288d06){if(_0x288d06){_0x4e9843=_0x288d06[_0x3fb6('0x3a')];if(!_0x5f29eb[_0x3fb6('0x35')][_0x3fb6('0x52')]('nolimit')){_0x377c87[_0x3fb6('0x22')]=qs['limit'](_0x5f29eb['query'][_0x3fb6('0x22')]);_0x377c87['offset']=qs['offset'](_0x5f29eb[_0x3fb6('0x35')][_0x3fb6('0x20')]);}return _0x4428c6[_0x3fb6('0x57')](_0x377c87);}})[_0x3fb6('0x28')](function(_0x3de7ae){if(_0x3de7ae){return _0x3de7ae?{'count':_0x4e9843,'rows':_0x3de7ae}:null;}})[_0x3fb6('0x28')](respondWithResult(_0x484d20,null))[_0x3fb6('0x47')](handleError(_0x484d20,null));};exports[_0x3fb6('0x59')]=function(_0x3e4007,_0x214f7b,_0x27e60d){if(_0x3e4007[_0x3fb6('0x4c')]['id']){delete _0x3e4007[_0x3fb6('0x4c')]['id'];}return db[_0x3fb6('0x2f')][_0x3fb6('0x54')]({'where':{'id':_0x3e4007[_0x3fb6('0x49')]['id']}})[_0x3fb6('0x28')](handleEntityNotFound(_0x214f7b,null))[_0x3fb6('0x28')](function(_0x26d4fe){if(_0x26d4fe){return _0x26d4fe[_0x3fb6('0x59')](_0x3e4007[_0x3fb6('0x4c')][_0x3fb6('0x5a')]||[]);}return null;})['then'](respondWithResult(_0x214f7b,null))[_0x3fb6('0x47')](handleError(_0x214f7b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2ab95c3..0e8270e 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 _0x3e1f=['api','moment','bluebird','request-promise','path','rimraf','exports','DeskConfiguration','int_desk_configurations','lodash','../../config/logger'];(function(_0x3f3378,_0x4aaad2){var _0x14c01f=function(_0x8e3c71){while(--_0x8e3c71){_0x3f3378['push'](_0x3f3378['shift']());}};_0x14c01f(++_0x4aaad2);}(_0x3e1f,0xe5));var _0xf3e1=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0x3e1f[_0x4932a6];return _0x3b45b9;};'use strict';var _=require(_0xf3e1('0x0'));var util=require('util');var logger=require(_0xf3e1('0x1'))(_0xf3e1('0x2'));var moment=require(_0xf3e1('0x3'));var BPromise=require(_0xf3e1('0x4'));var rp=require(_0xf3e1('0x5'));var fs=require('fs');var path=require(_0xf3e1('0x6'));var rimraf=require(_0xf3e1('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0xf3e1('0x8')]=function(_0x3ee96e,_0x4e24f3){return _0x3ee96e['define'](_0xf3e1('0x9'),attributes,{'tableName':_0xf3e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1807=['api','moment','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x5e6544,_0xb9f05b){var _0x18580d=function(_0x2a3fdf){while(--_0x2a3fdf){_0x5e6544['push'](_0x5e6544['shift']());}};_0x18580d(++_0xb9f05b);}(_0x1807,0xdb));var _0x7180=function(_0x39c745,_0xa4b72a){_0x39c745=_0x39c745-0x0;var _0x3b4c9c=_0x1807[_0x39c745];return _0x3b4c9c;};'use strict';var _=require(_0x7180('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7180('0x1'));var moment=require(_0x7180('0x2'));var BPromise=require('bluebird');var rp=require(_0x7180('0x3'));var fs=require('fs');var path=require(_0x7180('0x4'));var rimraf=require(_0x7180('0x5'));var config=require('../../config/environment');var attributes=require(_0x7180('0x6'));module[_0x7180('0x7')]=function(_0x21a9ef,_0x5640ae){return _0x21a9ef[_0x7180('0x8')](_0x7180('0x9'),attributes,{'tableName':_0x7180('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 579e740..3ce626d 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 _0xf7f7=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x235f97,_0x109c62){var _0x17e666=function(_0x50770f){while(--_0x50770f){_0x235f97['push'](_0x235f97['shift']());}};_0x17e666(++_0x109c62);}(_0xf7f7,0x192));var _0x7f7f=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xf7f7[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var moment=require(_0x7f7f('0x2'));var BPromise=require(_0x7f7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f7f('0x4'))['db'];var utils=require(_0x7f7f('0x5'));var logger=require(_0x7f7f('0x6'))(_0x7f7f('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f7f('0x8'));var client=jayson[_0x7f7f('0x9')][_0x7f7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce9ad,_0x5c40ac,_0x2cb854){return new BPromise(function(_0x58ac2b,_0xebd8af){return client['request'](_0x2ce9ad,_0x2cb854)[_0x7f7f('0xb')](function(_0x4e5cc7){logger[_0x7f7f('0xc')](_0x7f7f('0xd'),_0x5c40ac,_0x7f7f('0xe'));logger['debug'](_0x7f7f('0xf'),_0x5c40ac,_0x7f7f('0xe'),JSON[_0x7f7f('0x10')](_0x4e5cc7));if(_0x4e5cc7['error']){if(_0x4e5cc7['error']['code']===0x1f4){logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);return _0xebd8af(_0x4e5cc7['error']['message']);}logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);return _0x58ac2b(_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);}else{logger[_0x7f7f('0xc')](_0x7f7f('0xd'),_0x5c40ac,_0x7f7f('0xe'));_0x58ac2b(_0x4e5cc7[_0x7f7f('0x13')][_0x7f7f('0x12')]);}})[_0x7f7f('0x14')](function(_0x175970){logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x175970);_0xebd8af(_0x175970);});});} \ No newline at end of file +var _0xffb1=['message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xffb1,0x93));var _0x1ffb=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xffb1[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0x1ffb('0x0'));var util=require(_0x1ffb('0x1'));var moment=require(_0x1ffb('0x2'));var BPromise=require(_0x1ffb('0x3'));var rs=require(_0x1ffb('0x4'));var fs=require('fs');var Redis=require(_0x1ffb('0x5'));var db=require(_0x1ffb('0x6'))['db'];var utils=require(_0x1ffb('0x7'));var logger=require(_0x1ffb('0x8'))(_0x1ffb('0x9'));var config=require('../../config/environment');var jayson=require(_0x1ffb('0xa'));var client=jayson[_0x1ffb('0xb')][_0x1ffb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bfa98,_0x1d294a,_0x5bae77){return new BPromise(function(_0x1787b1,_0x4bcfb6){return client['request'](_0x2bfa98,_0x5bae77)[_0x1ffb('0xd')](function(_0x251538){logger[_0x1ffb('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x1d294a,'request\x20sent');logger[_0x1ffb('0xf')](_0x1ffb('0x10'),_0x1d294a,'request\x20sent',JSON[_0x1ffb('0x11')](_0x251538));if(_0x251538['error']){if(_0x251538[_0x1ffb('0x12')][_0x1ffb('0x13')]===0x1f4){logger[_0x1ffb('0x12')](_0x1ffb('0x14'),_0x1d294a,_0x251538[_0x1ffb('0x12')][_0x1ffb('0x15')]);return _0x4bcfb6(_0x251538['error'][_0x1ffb('0x15')]);}logger[_0x1ffb('0x12')](_0x1ffb('0x14'),_0x1d294a,_0x251538['error'][_0x1ffb('0x15')]);return _0x1787b1(_0x251538['error']['message']);}else{logger['info'](_0x1ffb('0x14'),_0x1d294a,_0x1ffb('0x16'));_0x1787b1(_0x251538['result'][_0x1ffb('0x15')]);}})[_0x1ffb('0x17')](function(_0x1a1f21){logger[_0x1ffb('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x1d294a,_0x1a1f21);_0x4bcfb6(_0x1a1f21);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ee3241e..6f23ac4 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 _0x5432=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports'];(function(_0x321829,_0x3874c1){var _0x5946d0=function(_0x410ed9){while(--_0x410ed9){_0x321829['push'](_0x321829['shift']());}};_0x5946d0(++_0x3874c1);}(_0x5432,0xc8));var _0x2543=function(_0xc2cd00,_0x2a3745){_0xc2cd00=_0xc2cd00-0x0;var _0x250d23=_0x5432[_0xc2cd00];return _0x250d23;};'use strict';var multer=require(_0x2543('0x0'));var util=require(_0x2543('0x1'));var path=require(_0x2543('0x2'));var timeout=require(_0x2543('0x3'));var express=require(_0x2543('0x4'));var router=express[_0x2543('0x5')]();var fs_extra=require(_0x2543('0x6'));var auth=require(_0x2543('0x7'));var interaction=require(_0x2543('0x8'));var config=require(_0x2543('0x9'));var controller=require(_0x2543('0xa'));router[_0x2543('0xb')]('/',auth[_0x2543('0xc')](),controller['index']);router[_0x2543('0xb')](_0x2543('0xd'),auth[_0x2543('0xc')](),controller[_0x2543('0xe')]);router[_0x2543('0xf')]('/',auth[_0x2543('0xc')](),controller[_0x2543('0x10')]);router[_0x2543('0x11')]('/:id',auth[_0x2543('0xc')](),controller[_0x2543('0x12')]);router['delete'](_0x2543('0xd'),auth[_0x2543('0xc')](),controller['destroy']);module[_0x2543('0x13')]=router; \ No newline at end of file +var _0xec0a=['path','connect-timeout','express','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1cf349,_0x91d616){var _0xf55d22=function(_0x5d78f1){while(--_0x5d78f1){_0x1cf349['push'](_0x1cf349['shift']());}};_0xf55d22(++_0x91d616);}(_0xec0a,0x86));var _0xaec0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xec0a[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xaec0('0x0'));var util=require(_0xaec0('0x1'));var path=require(_0xaec0('0x2'));var timeout=require(_0xaec0('0x3'));var express=require(_0xaec0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaec0('0x5'));var controller=require(_0xaec0('0x6'));router[_0xaec0('0x7')]('/',auth[_0xaec0('0x8')](),controller[_0xaec0('0x9')]);router[_0xaec0('0x7')](_0xaec0('0xa'),auth[_0xaec0('0x8')](),controller['show']);router['post']('/',auth[_0xaec0('0x8')](),controller[_0xaec0('0xb')]);router[_0xaec0('0xc')](_0xaec0('0xa'),auth[_0xaec0('0x8')](),controller[_0xaec0('0xd')]);router[_0xaec0('0xe')](_0xaec0('0xa'),auth[_0xaec0('0x8')](),controller[_0xaec0('0xf')]);module[_0xaec0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f1004ed..c00c7b5 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 _0x8969=['sequelize','exports','ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x17d1cc,_0x4d382e){var _0x3b217a=function(_0x474cfa){while(--_0x474cfa){_0x17d1cc['push'](_0x17d1cc['shift']());}};_0x3b217a(++_0x4d382e);}(_0x8969,0x168));var _0x9896=function(_0x3ef054,_0x240cc6){_0x3ef054=_0x3ef054-0x0;var _0x333df6=_0x8969[_0x3ef054];return _0x333df6;};'use strict';var Sequelize=require(_0x9896('0x0'));module[_0x9896('0x1')]={'type':{'type':Sequelize[_0x9896('0x2')](_0x9896('0x3'),'variable',_0x9896('0x4'),'keyValue',_0x9896('0x5')),'defaultValue':_0x9896('0x3')},'content':{'type':Sequelize[_0x9896('0x6')]},'key':{'type':Sequelize[_0x9896('0x6')]},'keyType':{'type':Sequelize[_0x9896('0x2')](_0x9896('0x3'),_0x9896('0x7'),_0x9896('0x4'))},'keyContent':{'type':Sequelize[_0x9896('0x6')]},'idField':{'type':Sequelize[_0x9896('0x6')]},'nameField':{'type':Sequelize[_0x9896('0x6')]},'customField':{'type':Sequelize[_0x9896('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9896('0x6')]}}; \ No newline at end of file +var _0xcaa6=['exports','ENUM','variable','STRING','string','customVariable','BOOLEAN'];(function(_0x58bd2c,_0x3fa881){var _0x2aa29b=function(_0x5b1b71){while(--_0x5b1b71){_0x58bd2c['push'](_0x58bd2c['shift']());}};_0x2aa29b(++_0x3fa881);}(_0xcaa6,0x149));var _0x6caa=function(_0x179357,_0x4afeae){_0x179357=_0x179357-0x0;var _0x4e3d5a=_0xcaa6[_0x179357];return _0x4e3d5a;};'use strict';var Sequelize=require('sequelize');module[_0x6caa('0x0')]={'type':{'type':Sequelize[_0x6caa('0x1')]('string',_0x6caa('0x2'),'customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6caa('0x3')]},'key':{'type':Sequelize[_0x6caa('0x3')]},'keyType':{'type':Sequelize[_0x6caa('0x1')](_0x6caa('0x4'),_0x6caa('0x2'),_0x6caa('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6caa('0x3')]},'nameField':{'type':Sequelize[_0x6caa('0x3')]},'customField':{'type':Sequelize[_0x6caa('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6caa('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 158d120..6b35ce9 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 _0xd484=['end','error','stack','name','index','map','DeskField','fieldName','type','key','model','query','keys','filters','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','rawAttributes','intersection','fields','length','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xd484,0xff));var _0x4d48=function(_0x41855e,_0x138618){_0x41855e=_0x41855e-0x0;var _0x4dc97d=_0xd484[_0x41855e];return _0x4dc97d;};'use strict';var emlformat=require(_0x4d48('0x0'));var rimraf=require(_0x4d48('0x1'));var zipdir=require(_0x4d48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d48('0x3'));var moment=require('moment');var BPromise=require(_0x4d48('0x4'));var Mustache=require(_0x4d48('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4d48('0x6'));var csv=require(_0x4d48('0x7'));var ejs=require(_0x4d48('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d48('0x9'));var squel=require(_0x4d48('0xa'));var crypto=require(_0x4d48('0xb'));var jsforce=require(_0x4d48('0xc'));var deskjs=require(_0x4d48('0xd'));var toCsv=require(_0x4d48('0x7'));var querystring=require('querystring');var Papa=require(_0x4d48('0xe'));var Redis=require('ioredis');var authService=require(_0x4d48('0xf'));var qs=require(_0x4d48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d48('0x11'));var logger=require('../../config/logger')(_0x4d48('0x12'));var utils=require(_0x4d48('0x13'));var config=require(_0x4d48('0x14'));var licenseUtil=require(_0x4d48('0x15'));var db=require(_0x4d48('0x16'))['db'];function respondWithStatusCode(_0xd3799b,_0x108c0c){_0x108c0c=_0x108c0c||0xcc;return function(_0xea2440){if(_0xea2440){return _0xd3799b[_0x4d48('0x17')](_0x108c0c);}return _0xd3799b[_0x4d48('0x18')](_0x108c0c)['end']();};}function respondWithResult(_0x12eab4,_0x4a4cec){_0x4a4cec=_0x4a4cec||0xc8;return function(_0x40be89){if(_0x40be89){return _0x12eab4[_0x4d48('0x18')](_0x4a4cec)[_0x4d48('0x19')](_0x40be89);}};}function respondWithFilteredResult(_0x5bdb48,_0x1be7f9){return function(_0x115267){if(_0x115267){var _0x3249c5=typeof _0x1be7f9[_0x4d48('0x1a')]==='undefined'&&typeof _0x1be7f9[_0x4d48('0x1b')]===_0x4d48('0x1c');var _0x14f45f=_0x115267[_0x4d48('0x1d')];var _0x12c933=_0x3249c5?0x0:_0x1be7f9[_0x4d48('0x1a')];var _0x376bb=_0x3249c5?_0x115267[_0x4d48('0x1d')]:_0x1be7f9[_0x4d48('0x1a')]+_0x1be7f9[_0x4d48('0x1b')];var _0xe87a65;if(_0x376bb>=_0x14f45f){_0x376bb=_0x14f45f;_0xe87a65=0xc8;}else{_0xe87a65=0xce;}_0x5bdb48[_0x4d48('0x18')](_0xe87a65);return _0x5bdb48[_0x4d48('0x1e')](_0x4d48('0x1f'),_0x12c933+'-'+_0x376bb+'/'+_0x14f45f)[_0x4d48('0x19')](_0x115267);}return null;};}function patchUpdates(_0x8f3636){return function(_0x5ec013){try{jsonpatch['apply'](_0x5ec013,_0x8f3636,!![]);}catch(_0x17176c){return BPromise[_0x4d48('0x20')](_0x17176c);}return _0x5ec013[_0x4d48('0x21')]();};}function saveUpdates(_0x5e0ce1,_0x1a7467){return function(_0x4595f7){if(_0x4595f7){return _0x4595f7[_0x4d48('0x22')](_0x5e0ce1)[_0x4d48('0x23')](function(_0x2d775a){return _0x2d775a;});}return null;};}function removeEntity(_0x4657f,_0x1e375a){return function(_0x58c27d){if(_0x58c27d){return _0x58c27d[_0x4d48('0x24')]()[_0x4d48('0x23')](function(){_0x4657f[_0x4d48('0x18')](0xcc)[_0x4d48('0x25')]();});}};}function handleEntityNotFound(_0x730685,_0x5a9acc){return function(_0x30a1a2){if(!_0x30a1a2){_0x730685[_0x4d48('0x17')](0x194);}return _0x30a1a2;};}function handleError(_0x3f48e5,_0x1c3da6){_0x1c3da6=_0x1c3da6||0x1f4;return function(_0x5a1b2d){logger[_0x4d48('0x26')](_0x5a1b2d[_0x4d48('0x27')]);if(_0x5a1b2d['name']){delete _0x5a1b2d[_0x4d48('0x28')];}_0x3f48e5[_0x4d48('0x18')](_0x1c3da6)['send'](_0x5a1b2d);};}exports[_0x4d48('0x29')]=function(_0x39f4f7,_0xad79a1){var _0x5c852b={},_0x31d37b={},_0xa84c7={'count':0x0,'rows':[]};var _0x300d1e=_[_0x4d48('0x2a')](db[_0x4d48('0x2b')]['rawAttributes'],function(_0x528f06){return{'name':_0x528f06[_0x4d48('0x2c')],'type':_0x528f06[_0x4d48('0x2d')][_0x4d48('0x2e')]};});_0x31d37b[_0x4d48('0x2f')]=_[_0x4d48('0x2a')](_0x300d1e,_0x4d48('0x28'));_0x31d37b[_0x4d48('0x30')]=_[_0x4d48('0x31')](_0x39f4f7[_0x4d48('0x30')]);_0x31d37b[_0x4d48('0x32')]=_['intersection'](_0x31d37b[_0x4d48('0x2f')],_0x31d37b[_0x4d48('0x30')]);_0x5c852b[_0x4d48('0x33')]=_['intersection'](_0x31d37b[_0x4d48('0x2f')],qs['fields'](_0x39f4f7[_0x4d48('0x30')]['fields']));_0x5c852b[_0x4d48('0x33')]=_0x5c852b['attributes']['length']?_0x5c852b[_0x4d48('0x33')]:_0x31d37b['model'];if(!_0x39f4f7[_0x4d48('0x30')]['hasOwnProperty'](_0x4d48('0x34'))){_0x5c852b[_0x4d48('0x1b')]=qs[_0x4d48('0x1b')](_0x39f4f7[_0x4d48('0x30')][_0x4d48('0x1b')]);_0x5c852b['offset']=qs[_0x4d48('0x1a')](_0x39f4f7[_0x4d48('0x30')][_0x4d48('0x1a')]);}_0x5c852b[_0x4d48('0x35')]=qs[_0x4d48('0x36')](_0x39f4f7['query']['sort']);_0x5c852b[_0x4d48('0x37')]=qs[_0x4d48('0x32')](_[_0x4d48('0x38')](_0x39f4f7[_0x4d48('0x30')],_0x31d37b[_0x4d48('0x32')]),_0x300d1e);if(_0x39f4f7['query'][_0x4d48('0x39')]){_0x5c852b['where']=_[_0x4d48('0x3a')](_0x5c852b[_0x4d48('0x37')],{'$or':_[_0x4d48('0x2a')](_0x300d1e,function(_0x32a446){if(_0x32a446[_0x4d48('0x2d')]!==_0x4d48('0x3b')){var _0x481b06={};_0x481b06[_0x32a446['name']]={'$like':'%'+_0x39f4f7['query'][_0x4d48('0x39')]+'%'};return _0x481b06;}})});}_0x5c852b=_[_0x4d48('0x3a')]({},_0x5c852b,_0x39f4f7[_0x4d48('0x3c')]);var _0x4a8f55={'where':_0x5c852b['where']};return db[_0x4d48('0x2b')][_0x4d48('0x1d')](_0x4a8f55)[_0x4d48('0x23')](function(_0x395ada){_0xa84c7['count']=_0x395ada;if(_0x39f4f7[_0x4d48('0x30')][_0x4d48('0x3d')]){_0x5c852b['include']=[{'all':!![]}];}return db[_0x4d48('0x2b')][_0x4d48('0x3e')](_0x5c852b);})['then'](function(_0x86fad9){_0xa84c7['rows']=_0x86fad9;return _0xa84c7;})[_0x4d48('0x23')](respondWithFilteredResult(_0xad79a1,_0x5c852b))[_0x4d48('0x3f')](handleError(_0xad79a1,null));};exports[_0x4d48('0x40')]=function(_0x390afd,_0x2e7705){var _0x2cb42f={'raw':!![],'where':{'id':_0x390afd['params']['id']}},_0x314cf2={};_0x314cf2[_0x4d48('0x2f')]=_[_0x4d48('0x31')](db[_0x4d48('0x2b')][_0x4d48('0x41')]);_0x314cf2[_0x4d48('0x30')]=_[_0x4d48('0x31')](_0x390afd[_0x4d48('0x30')]);_0x314cf2['filters']=_[_0x4d48('0x42')](_0x314cf2[_0x4d48('0x2f')],_0x314cf2['query']);_0x2cb42f['attributes']=_['intersection'](_0x314cf2['model'],qs[_0x4d48('0x43')](_0x390afd['query'][_0x4d48('0x43')]));_0x2cb42f[_0x4d48('0x33')]=_0x2cb42f[_0x4d48('0x33')][_0x4d48('0x44')]?_0x2cb42f[_0x4d48('0x33')]:_0x314cf2['model'];if(_0x390afd[_0x4d48('0x30')][_0x4d48('0x3d')]){_0x2cb42f['include']=[{'all':!![]}];}_0x2cb42f=_[_0x4d48('0x3a')]({},_0x2cb42f,_0x390afd[_0x4d48('0x3c')]);return db[_0x4d48('0x2b')]['find'](_0x2cb42f)[_0x4d48('0x23')](handleEntityNotFound(_0x2e7705,null))[_0x4d48('0x23')](respondWithResult(_0x2e7705,null))['catch'](handleError(_0x2e7705,null));};exports[_0x4d48('0x45')]=function(_0x2f25d8,_0x16c9c9){return db['DeskField'][_0x4d48('0x45')](_0x2f25d8[_0x4d48('0x46')],{})['then'](respondWithResult(_0x16c9c9,0xc9))[_0x4d48('0x3f')](handleError(_0x16c9c9,null));};exports[_0x4d48('0x22')]=function(_0x1eaf49,_0x881cc2){if(_0x1eaf49['body']['id']){delete _0x1eaf49['body']['id'];}return db[_0x4d48('0x2b')][_0x4d48('0x47')]({'where':{'id':_0x1eaf49['params']['id']}})['then'](handleEntityNotFound(_0x881cc2,null))['then'](saveUpdates(_0x1eaf49[_0x4d48('0x46')],null))[_0x4d48('0x23')](respondWithResult(_0x881cc2,null))[_0x4d48('0x3f')](handleError(_0x881cc2,null));};exports[_0x4d48('0x24')]=function(_0x28b168,_0x57b670){return db[_0x4d48('0x2b')]['find']({'where':{'id':_0x28b168[_0x4d48('0x48')]['id']}})['then'](handleEntityNotFound(_0x57b670,null))[_0x4d48('0x23')](removeEntity(_0x57b670,null))['catch'](handleError(_0x57b670,null));}; \ No newline at end of file +var _0x81f8=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','name','send','index','map','DeskField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81f8,0x186));var _0x881f=function(_0xe454c8,_0x3486d4){_0xe454c8=_0xe454c8-0x0;var _0x5724dd=_0x81f8[_0xe454c8];return _0x5724dd;};'use strict';var emlformat=require(_0x881f('0x0'));var rimraf=require(_0x881f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x881f('0x2'));var rp=require(_0x881f('0x3'));var moment=require(_0x881f('0x4'));var BPromise=require(_0x881f('0x5'));var Mustache=require(_0x881f('0x6'));var util=require('util');var path=require(_0x881f('0x7'));var sox=require(_0x881f('0x8'));var csv=require(_0x881f('0x9'));var ejs=require(_0x881f('0xa'));var fs=require('fs');var fs_extra=require(_0x881f('0xb'));var _=require(_0x881f('0xc'));var squel=require(_0x881f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x881f('0xe'));var toCsv=require(_0x881f('0x9'));var querystring=require('querystring');var Papa=require(_0x881f('0xf'));var Redis=require(_0x881f('0x10'));var authService=require(_0x881f('0x11'));var qs=require(_0x881f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x881f('0x13'))(_0x881f('0x14'));var utils=require(_0x881f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x881f('0x16'))['db'];function respondWithStatusCode(_0x422ee5,_0x5ca80e){_0x5ca80e=_0x5ca80e||0xcc;return function(_0x5184bc){if(_0x5184bc){return _0x422ee5[_0x881f('0x17')](_0x5ca80e);}return _0x422ee5[_0x881f('0x18')](_0x5ca80e)[_0x881f('0x19')]();};}function respondWithResult(_0x52c140,_0x20036f){_0x20036f=_0x20036f||0xc8;return function(_0x1f51aa){if(_0x1f51aa){return _0x52c140['status'](_0x20036f)[_0x881f('0x1a')](_0x1f51aa);}};}function respondWithFilteredResult(_0x3d9e50,_0x4b7378){return function(_0x301d66){if(_0x301d66){var _0x167107=typeof _0x4b7378[_0x881f('0x1b')]===_0x881f('0x1c')&&typeof _0x4b7378[_0x881f('0x1d')]===_0x881f('0x1c');var _0x5e897f=_0x301d66[_0x881f('0x1e')];var _0x4f0540=_0x167107?0x0:_0x4b7378['offset'];var _0x1ed77=_0x167107?_0x301d66[_0x881f('0x1e')]:_0x4b7378[_0x881f('0x1b')]+_0x4b7378['limit'];var _0x49c605;if(_0x1ed77>=_0x5e897f){_0x1ed77=_0x5e897f;_0x49c605=0xc8;}else{_0x49c605=0xce;}_0x3d9e50[_0x881f('0x18')](_0x49c605);return _0x3d9e50['set'](_0x881f('0x1f'),_0x4f0540+'-'+_0x1ed77+'/'+_0x5e897f)[_0x881f('0x1a')](_0x301d66);}return null;};}function patchUpdates(_0x2f66d8){return function(_0x537c77){try{jsonpatch['apply'](_0x537c77,_0x2f66d8,!![]);}catch(_0x38f7a7){return BPromise[_0x881f('0x20')](_0x38f7a7);}return _0x537c77[_0x881f('0x21')]();};}function saveUpdates(_0x3fbbd1,_0x4f43ee){return function(_0x1b434d){if(_0x1b434d){return _0x1b434d[_0x881f('0x22')](_0x3fbbd1)[_0x881f('0x23')](function(_0x59c60e){return _0x59c60e;});}return null;};}function removeEntity(_0x16392b,_0x51bbb2){return function(_0x30d73b){if(_0x30d73b){return _0x30d73b['destroy']()[_0x881f('0x23')](function(){_0x16392b[_0x881f('0x18')](0xcc)[_0x881f('0x19')]();});}};}function handleEntityNotFound(_0x341e3c,_0x5f39cc){return function(_0x666de5){if(!_0x666de5){_0x341e3c[_0x881f('0x17')](0x194);}return _0x666de5;};}function handleError(_0x6f6a7e,_0xdcb6b7){_0xdcb6b7=_0xdcb6b7||0x1f4;return function(_0x393433){logger[_0x881f('0x24')](_0x393433['stack']);if(_0x393433[_0x881f('0x25')]){delete _0x393433[_0x881f('0x25')];}_0x6f6a7e[_0x881f('0x18')](_0xdcb6b7)[_0x881f('0x26')](_0x393433);};}exports[_0x881f('0x27')]=function(_0x518ddb,_0x56cc05){var _0x40d75b={},_0x11f353={},_0x2a5c8f={'count':0x0,'rows':[]};var _0x51f20f=_[_0x881f('0x28')](db[_0x881f('0x29')][_0x881f('0x2a')],function(_0x42ba3b){return{'name':_0x42ba3b[_0x881f('0x2b')],'type':_0x42ba3b[_0x881f('0x2c')][_0x881f('0x2d')]};});_0x11f353[_0x881f('0x2e')]=_[_0x881f('0x28')](_0x51f20f,_0x881f('0x25'));_0x11f353[_0x881f('0x2f')]=_[_0x881f('0x30')](_0x518ddb[_0x881f('0x2f')]);_0x11f353['filters']=_[_0x881f('0x31')](_0x11f353[_0x881f('0x2e')],_0x11f353[_0x881f('0x2f')]);_0x40d75b['attributes']=_[_0x881f('0x31')](_0x11f353[_0x881f('0x2e')],qs['fields'](_0x518ddb[_0x881f('0x2f')][_0x881f('0x32')]));_0x40d75b[_0x881f('0x33')]=_0x40d75b[_0x881f('0x33')][_0x881f('0x34')]?_0x40d75b[_0x881f('0x33')]:_0x11f353[_0x881f('0x2e')];if(!_0x518ddb[_0x881f('0x2f')][_0x881f('0x35')](_0x881f('0x36'))){_0x40d75b[_0x881f('0x1d')]=qs['limit'](_0x518ddb[_0x881f('0x2f')][_0x881f('0x1d')]);_0x40d75b['offset']=qs[_0x881f('0x1b')](_0x518ddb[_0x881f('0x2f')][_0x881f('0x1b')]);}_0x40d75b[_0x881f('0x37')]=qs[_0x881f('0x38')](_0x518ddb['query']['sort']);_0x40d75b[_0x881f('0x39')]=qs[_0x881f('0x3a')](_['pick'](_0x518ddb[_0x881f('0x2f')],_0x11f353['filters']),_0x51f20f);if(_0x518ddb[_0x881f('0x2f')][_0x881f('0x3b')]){_0x40d75b[_0x881f('0x39')]=_[_0x881f('0x3c')](_0x40d75b[_0x881f('0x39')],{'$or':_[_0x881f('0x28')](_0x51f20f,function(_0x5bab6b){if(_0x5bab6b[_0x881f('0x2c')]!==_0x881f('0x3d')){var _0x202e93={};_0x202e93[_0x5bab6b['name']]={'$like':'%'+_0x518ddb[_0x881f('0x2f')][_0x881f('0x3b')]+'%'};return _0x202e93;}})});}_0x40d75b=_[_0x881f('0x3c')]({},_0x40d75b,_0x518ddb['options']);var _0x47ff69={'where':_0x40d75b[_0x881f('0x39')]};return db[_0x881f('0x29')][_0x881f('0x1e')](_0x47ff69)[_0x881f('0x23')](function(_0x1557f2){_0x2a5c8f[_0x881f('0x1e')]=_0x1557f2;if(_0x518ddb['query']['includeAll']){_0x40d75b[_0x881f('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x881f('0x3f')](_0x40d75b);})['then'](function(_0x430a5e){_0x2a5c8f[_0x881f('0x40')]=_0x430a5e;return _0x2a5c8f;})[_0x881f('0x23')](respondWithFilteredResult(_0x56cc05,_0x40d75b))[_0x881f('0x41')](handleError(_0x56cc05,null));};exports['show']=function(_0x29369b,_0x506939){var _0x5a6aa8={'raw':!![],'where':{'id':_0x29369b[_0x881f('0x42')]['id']}},_0x2aa0aa={};_0x2aa0aa['model']=_[_0x881f('0x30')](db[_0x881f('0x29')][_0x881f('0x2a')]);_0x2aa0aa[_0x881f('0x2f')]=_[_0x881f('0x30')](_0x29369b['query']);_0x2aa0aa['filters']=_['intersection'](_0x2aa0aa[_0x881f('0x2e')],_0x2aa0aa[_0x881f('0x2f')]);_0x5a6aa8[_0x881f('0x33')]=_[_0x881f('0x31')](_0x2aa0aa[_0x881f('0x2e')],qs[_0x881f('0x32')](_0x29369b[_0x881f('0x2f')][_0x881f('0x32')]));_0x5a6aa8['attributes']=_0x5a6aa8[_0x881f('0x33')][_0x881f('0x34')]?_0x5a6aa8['attributes']:_0x2aa0aa[_0x881f('0x2e')];if(_0x29369b[_0x881f('0x2f')]['includeAll']){_0x5a6aa8['include']=[{'all':!![]}];}_0x5a6aa8=_[_0x881f('0x3c')]({},_0x5a6aa8,_0x29369b[_0x881f('0x43')]);return db['DeskField'][_0x881f('0x44')](_0x5a6aa8)['then'](handleEntityNotFound(_0x506939,null))['then'](respondWithResult(_0x506939,null))['catch'](handleError(_0x506939,null));};exports[_0x881f('0x45')]=function(_0x4db36c,_0xa3a79e){return db[_0x881f('0x29')][_0x881f('0x45')](_0x4db36c[_0x881f('0x46')],{})[_0x881f('0x23')](respondWithResult(_0xa3a79e,0xc9))[_0x881f('0x41')](handleError(_0xa3a79e,null));};exports[_0x881f('0x22')]=function(_0x3d7229,_0x13bee8){if(_0x3d7229[_0x881f('0x46')]['id']){delete _0x3d7229[_0x881f('0x46')]['id'];}return db[_0x881f('0x29')][_0x881f('0x44')]({'where':{'id':_0x3d7229[_0x881f('0x42')]['id']}})[_0x881f('0x23')](handleEntityNotFound(_0x13bee8,null))['then'](saveUpdates(_0x3d7229[_0x881f('0x46')],null))[_0x881f('0x23')](respondWithResult(_0x13bee8,null))['catch'](handleError(_0x13bee8,null));};exports[_0x881f('0x47')]=function(_0x3e051c,_0x424104){return db[_0x881f('0x29')][_0x881f('0x44')]({'where':{'id':_0x3e051c[_0x881f('0x42')]['id']}})[_0x881f('0x23')](handleEntityNotFound(_0x424104,null))[_0x881f('0x23')](removeEntity(_0x424104,null))[_0x881f('0x41')](handleError(_0x424104,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 800cf0d..64d2a8b 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 _0x51d4=['exports','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','api','bluebird','path','../../config/environment','./intDeskField.attributes'];(function(_0x519de3,_0xe7c04e){var _0x3e21d9=function(_0x1c98fb){while(--_0x1c98fb){_0x519de3['push'](_0x519de3['shift']());}};_0x3e21d9(++_0xe7c04e);}(_0x51d4,0x1d9));var _0x451d=function(_0x1ac5bb,_0x25f3d8){_0x1ac5bb=_0x1ac5bb-0x0;var _0x424d60=_0x51d4[_0x1ac5bb];return _0x424d60;};'use strict';var _=require(_0x451d('0x0'));var util=require(_0x451d('0x1'));var logger=require('../../config/logger')(_0x451d('0x2'));var moment=require('moment');var BPromise=require(_0x451d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x451d('0x4'));var rimraf=require('rimraf');var config=require(_0x451d('0x5'));var attributes=require(_0x451d('0x6'));module[_0x451d('0x7')]=function(_0x36650c,_0x16b48c){return _0x36650c['define'](_0x451d('0x8'),attributes,{'tableName':_0x451d('0x9'),'paranoid':![],'indexes':[{'name':_0x451d('0xa'),'fields':['idField',_0x451d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1350=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x543ea3,_0x30e149){var _0x10f95c=function(_0x3082c4){while(--_0x3082c4){_0x543ea3['push'](_0x543ea3['shift']());}};_0x10f95c(++_0x30e149);}(_0x1350,0x109));var _0x0135=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1350[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0135('0x0'));var util=require(_0x0135('0x1'));var logger=require(_0x0135('0x2'))(_0x0135('0x3'));var moment=require(_0x0135('0x4'));var BPromise=require('bluebird');var rp=require(_0x0135('0x5'));var fs=require('fs');var path=require(_0x0135('0x6'));var rimraf=require(_0x0135('0x7'));var config=require(_0x0135('0x8'));var attributes=require(_0x0135('0x9'));module[_0x0135('0xa')]=function(_0x543103,_0x1ffe12){return _0x543103[_0x0135('0xb')](_0x0135('0xc'),attributes,{'tableName':_0x0135('0xd'),'paranoid':![],'indexes':[{'name':_0x0135('0xe'),'fields':[_0x0135('0xf'),_0x0135('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 307c76e..eaef863 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 _0x8191=['DeskField,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x37a301,_0x2490ae){var _0x1bb565=function(_0x47670a){while(--_0x47670a){_0x37a301['push'](_0x37a301['shift']());}};_0x1bb565(++_0x2490ae);}(_0x8191,0x1a5));var _0x1819=function(_0x89100d,_0x59c43d){_0x89100d=_0x89100d-0x0;var _0x15974a=_0x8191[_0x89100d];return _0x15974a;};'use strict';var _=require(_0x1819('0x0'));var util=require('util');var moment=require(_0x1819('0x1'));var BPromise=require(_0x1819('0x2'));var rs=require(_0x1819('0x3'));var fs=require('fs');var Redis=require(_0x1819('0x4'));var db=require(_0x1819('0x5'))['db'];var utils=require(_0x1819('0x6'));var logger=require(_0x1819('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1819('0x8'));var client=jayson[_0x1819('0x9')][_0x1819('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44219b,_0x43e391,_0x5c8ec3){return new BPromise(function(_0x597eb3,_0x723b27){return client['request'](_0x44219b,_0x5c8ec3)['then'](function(_0x5d6294){logger['info'](_0x1819('0xb'),_0x43e391,'request\x20sent');logger[_0x1819('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x43e391,_0x1819('0xd'),JSON['stringify'](_0x5d6294));if(_0x5d6294[_0x1819('0xe')]){if(_0x5d6294[_0x1819('0xe')]['code']===0x1f4){logger[_0x1819('0xe')](_0x1819('0xb'),_0x43e391,_0x5d6294[_0x1819('0xe')][_0x1819('0xf')]);return _0x723b27(_0x5d6294['error'][_0x1819('0xf')]);}logger[_0x1819('0xe')](_0x1819('0xb'),_0x43e391,_0x5d6294['error'][_0x1819('0xf')]);return _0x597eb3(_0x5d6294[_0x1819('0xe')][_0x1819('0xf')]);}else{logger[_0x1819('0x10')](_0x1819('0xb'),_0x43e391,_0x1819('0xd'));_0x597eb3(_0x5d6294[_0x1819('0x11')][_0x1819('0xf')]);}})['catch'](function(_0x27d0af){logger[_0x1819('0xe')](_0x1819('0xb'),_0x43e391,_0x27d0af);_0x723b27(_0x27d0af);});});} \ No newline at end of file +var _0xdec0=['moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdec0,0x18e));var _0x0dec=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0xdec0[_0x3c6ae2];return _0x4edda;};'use strict';var _=require(_0x0dec('0x0'));var util=require(_0x0dec('0x1'));var moment=require(_0x0dec('0x2'));var BPromise=require(_0x0dec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0dec('0x5'))('rpc');var config=require(_0x0dec('0x6'));var jayson=require(_0x0dec('0x7'));var client=jayson[_0x0dec('0x8')][_0x0dec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x333fd5,_0x53d8f7,_0x49eb55){return new BPromise(function(_0x468388,_0x3f25f6){return client[_0x0dec('0xa')](_0x333fd5,_0x49eb55)['then'](function(_0x57af48){logger['info'](_0x0dec('0xb'),_0x53d8f7,_0x0dec('0xc'));logger['debug'](_0x0dec('0xd'),_0x53d8f7,_0x0dec('0xc'),JSON[_0x0dec('0xe')](_0x57af48));if(_0x57af48[_0x0dec('0xf')]){if(_0x57af48[_0x0dec('0xf')]['code']===0x1f4){logger[_0x0dec('0xf')](_0x0dec('0xb'),_0x53d8f7,_0x57af48['error'][_0x0dec('0x10')]);return _0x3f25f6(_0x57af48[_0x0dec('0xf')][_0x0dec('0x10')]);}logger[_0x0dec('0xf')]('DeskField,\x20%s,\x20%s',_0x53d8f7,_0x57af48[_0x0dec('0xf')][_0x0dec('0x10')]);return _0x468388(_0x57af48[_0x0dec('0xf')][_0x0dec('0x10')]);}else{logger[_0x0dec('0x11')](_0x0dec('0xb'),_0x53d8f7,_0x0dec('0xc'));_0x468388(_0x57af48[_0x0dec('0x12')][_0x0dec('0x10')]);}})[_0x0dec('0x13')](function(_0x1f962c){logger[_0x0dec('0xf')](_0x0dec('0xb'),_0x53d8f7,_0x1f962c);_0x3f25f6(_0x1f962c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 660dd9d..69ff684 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 _0x91c9=['./intDynamics365Account.controller','get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x91c9,0xa6));var _0x991c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x91c9[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0x991c('0x0'));var util=require('util');var path=require(_0x991c('0x1'));var timeout=require(_0x991c('0x2'));var express=require(_0x991c('0x3'));var router=express[_0x991c('0x4')]();var fs_extra=require(_0x991c('0x5'));var auth=require(_0x991c('0x6'));var interaction=require(_0x991c('0x7'));var config=require(_0x991c('0x8'));var controller=require(_0x991c('0x9'));router[_0x991c('0xa')]('/',auth['isAuthenticated'](),controller[_0x991c('0xb')]);router[_0x991c('0xa')](_0x991c('0xc'),auth['isAuthenticated'](),controller[_0x991c('0xd')]);router[_0x991c('0xa')]('/:id/configurations',auth[_0x991c('0xe')](),controller[_0x991c('0xf')]);router[_0x991c('0xa')](_0x991c('0x10'),auth['isAuthenticated'](),controller[_0x991c('0x11')]);router[_0x991c('0x12')]('/',auth[_0x991c('0xe')](),controller['create']);router[_0x991c('0x12')](_0x991c('0x13'),auth['isAuthenticated'](),controller[_0x991c('0x14')]);router[_0x991c('0x15')](_0x991c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x991c('0x16')](_0x991c('0xc'),auth[_0x991c('0xe')](),controller[_0x991c('0x17')]);module[_0x991c('0x18')]=router; \ No newline at end of file +var _0xc68b=['/:id','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0xe3e87d,_0x39daf1){var _0xe32f2e=function(_0x4dbfa7){while(--_0x4dbfa7){_0xe3e87d['push'](_0xe3e87d['shift']());}};_0xe32f2e(++_0x39daf1);}(_0xc68b,0x12b));var _0xbc68=function(_0xd70101,_0xab204d){_0xd70101=_0xd70101-0x0;var _0x516276=_0xc68b[_0xd70101];return _0x516276;};'use strict';var multer=require(_0xbc68('0x0'));var util=require(_0xbc68('0x1'));var path=require(_0xbc68('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc68('0x3'));var router=express['Router']();var fs_extra=require(_0xbc68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc68('0x5'));var config=require(_0xbc68('0x6'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xbc68('0x7')](),controller[_0xbc68('0x8')]);router['get'](_0xbc68('0x9'),auth[_0xbc68('0x7')](),controller['show']);router[_0xbc68('0xa')](_0xbc68('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xbc68('0xa')](_0xbc68('0xc'),auth[_0xbc68('0x7')](),controller[_0xbc68('0xd')]);router[_0xbc68('0xe')]('/',auth[_0xbc68('0x7')](),controller[_0xbc68('0xf')]);router['post'](_0xbc68('0xb'),auth[_0xbc68('0x7')](),controller[_0xbc68('0x10')]);router[_0xbc68('0x11')](_0xbc68('0x9'),auth[_0xbc68('0x7')](),controller[_0xbc68('0x12')]);router[_0xbc68('0x13')]('/:id',auth[_0xbc68('0x7')](),controller[_0xbc68('0x14')]);module[_0xbc68('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9f429cd..a4d006b 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 _0xd7c3=['sequelize','exports','STRING'];(function(_0x26ecfa,_0x5a70dd){var _0x9f567f=function(_0x1de37d){while(--_0x1de37d){_0x26ecfa['push'](_0x26ecfa['shift']());}};_0x9f567f(++_0x5a70dd);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x4407d5,_0x4eb1d8){_0x4407d5=_0x4407d5-0x0;var _0x3024a2=_0xd7c3[_0x4407d5];return _0x3024a2;};'use strict';var Sequelize=require(_0x3d7c('0x0'));module[_0x3d7c('0x1')]={'name':{'type':Sequelize[_0x3d7c('0x2')]},'username':{'type':Sequelize[_0x3d7c('0x2')]},'password':{'type':Sequelize[_0x3d7c('0x2')]},'remoteUri':{'type':Sequelize[_0x3d7c('0x2')]},'tenantId':{'type':Sequelize[_0x3d7c('0x2')]},'clientId':{'type':Sequelize[_0x3d7c('0x2')]},'clientSecret':{'type':Sequelize[_0x3d7c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3d7c('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe75a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x97acee,_0x202957){var _0x16cc43=function(_0x22969b){while(--_0x22969b){_0x97acee['push'](_0x97acee['shift']());}};_0x16cc43(++_0x202957);}(_0xe75a,0x1de));var _0xae75=function(_0x3da72b,_0x4fd809){_0x3da72b=_0x3da72b-0x0;var _0xc64ac4=_0xe75a[_0x3da72b];return _0xc64ac4;};'use strict';var Sequelize=require(_0xae75('0x0'));module[_0xae75('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xae75('0x2')]},'password':{'type':Sequelize[_0xae75('0x2')]},'remoteUri':{'type':Sequelize[_0xae75('0x2')]},'tenantId':{'type':Sequelize[_0xae75('0x2')]},'clientId':{'type':Sequelize[_0xae75('0x2')]},'clientSecret':{'type':Sequelize[_0xae75('0x2')]},'serverUrl':{'type':Sequelize[_0xae75('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xae75('0x2')]},'modernAuthentication':{'type':Sequelize[_0xae75('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 6eb724e..bda3825 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 _0x05e3=['addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Subjects','substring','format','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName','OptionSet','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','api','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','end','sendStatus','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','merge','find','create','body','getConfigurations','findOne'];(function(_0x343965,_0x17ec9c){var _0x4149e4=function(_0x568d43){while(--_0x568d43){_0x343965['push'](_0x343965['shift']());}};_0x4149e4(++_0x17ec9c);}(_0x05e3,0x86));var _0x305e=function(_0x997ede,_0x5a0814){_0x997ede=_0x997ede-0x0;var _0x1f3288=_0x05e3[_0x997ede];return _0x1f3288;};'use strict';var rp=require(_0x305e('0x0'));var util=require(_0x305e('0x1'));var _=require(_0x305e('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x305e('0x3'));var db=require(_0x305e('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x409b14,_0x112f54){_0x112f54=_0x112f54||0xc8;return function(_0x47b973){if(_0x47b973){return _0x409b14[_0x305e('0x5')](_0x112f54)[_0x305e('0x6')](_0x47b973);}};}function respondWithFilteredResult(_0xfadd27,_0x143428){return function(_0x72ac4b){if(_0x72ac4b){var _0x22b00b=typeof _0x143428[_0x305e('0x7')]===_0x305e('0x8')&&typeof _0x143428['limit']===_0x305e('0x8');var _0x4a66fd=_0x72ac4b[_0x305e('0x9')];var _0x768a4a=_0x22b00b?0x0:_0x143428['offset'];var _0x38ead1=_0x22b00b?_0x72ac4b[_0x305e('0x9')]:_0x143428[_0x305e('0x7')]+_0x143428[_0x305e('0xa')];var _0x3bba0e;if(_0x38ead1>=_0x4a66fd){_0x38ead1=_0x4a66fd;_0x3bba0e=0xc8;}else{_0x3bba0e=0xce;}_0xfadd27[_0x305e('0x5')](_0x3bba0e);return _0xfadd27[_0x305e('0xb')](_0x305e('0xc'),_0x768a4a+'-'+_0x38ead1+'/'+_0x4a66fd)[_0x305e('0x6')](_0x72ac4b);}return null;};}function saveUpdates(_0x301068){return function(_0x3535b9){if(_0x3535b9){return _0x3535b9[_0x305e('0xd')](_0x301068)['then'](function(_0x1cc151){return _0x1cc151;});}return null;};}function removeEntity(_0xf813ca){return function(_0x5964c4){if(_0x5964c4){return _0x5964c4[_0x305e('0xe')]()[_0x305e('0xf')](function(){_0xf813ca[_0x305e('0x5')](0xcc)[_0x305e('0x10')]();});}};}function handleEntityNotFound(_0x21f147){return function(_0xc5b3dc){if(!_0xc5b3dc){_0x21f147[_0x305e('0x11')](0x194);}return _0xc5b3dc;};}function handleError(_0x5e6d87,_0x1637e6){_0x1637e6=_0x1637e6||0x1f4;return function(_0x455e78){logger['error'](_0x455e78[_0x305e('0x12')]);if(_0x455e78[_0x305e('0x13')]){delete _0x455e78[_0x305e('0x13')];}_0x5e6d87[_0x305e('0x5')](_0x1637e6)[_0x305e('0x14')](_0x455e78);};}exports['index']=function(_0x55f0fb,_0x58ea75){var _0x5f2bad={},_0x488b7b={},_0x567ccd={'count':0x0,'rows':[]};var _0x498c44=_[_0x305e('0x15')](db[_0x305e('0x16')][_0x305e('0x17')],function(_0x886382){return{'name':_0x886382[_0x305e('0x18')],'type':_0x886382[_0x305e('0x19')]['key']};});_0x488b7b[_0x305e('0x1a')]=_['map'](_0x498c44,_0x305e('0x13'));_0x488b7b[_0x305e('0x1b')]=_['keys'](_0x55f0fb[_0x305e('0x1b')]);_0x488b7b[_0x305e('0x1c')]=_[_0x305e('0x1d')](_0x488b7b[_0x305e('0x1a')],_0x488b7b[_0x305e('0x1b')]);_0x5f2bad[_0x305e('0x1e')]=_[_0x305e('0x1d')](_0x488b7b[_0x305e('0x1a')],qs[_0x305e('0x1f')](_0x55f0fb['query']['fields']));_0x5f2bad[_0x305e('0x1e')]=_0x5f2bad[_0x305e('0x1e')][_0x305e('0x20')]?_0x5f2bad[_0x305e('0x1e')]:_0x488b7b[_0x305e('0x1a')];if(!_0x55f0fb['query']['hasOwnProperty'](_0x305e('0x21'))){_0x5f2bad[_0x305e('0xa')]=qs[_0x305e('0xa')](_0x55f0fb[_0x305e('0x1b')][_0x305e('0xa')]);_0x5f2bad['offset']=qs['offset'](_0x55f0fb[_0x305e('0x1b')][_0x305e('0x7')]);}_0x5f2bad[_0x305e('0x22')]=qs[_0x305e('0x23')](_0x55f0fb['query'][_0x305e('0x23')]);_0x5f2bad[_0x305e('0x24')]=qs['filters'](_[_0x305e('0x25')](_0x55f0fb[_0x305e('0x1b')],_0x488b7b[_0x305e('0x1c')]),_0x498c44);if(_0x55f0fb[_0x305e('0x1b')][_0x305e('0x26')]){_0x5f2bad['where']=_['merge'](_0x5f2bad[_0x305e('0x24')],{'$or':_[_0x305e('0x15')](_0x498c44,function(_0x4929d8){if(_0x4929d8['type']!==_0x305e('0x27')){var _0xff7921={};_0xff7921[_0x4929d8[_0x305e('0x13')]]={'$like':'%'+_0x55f0fb['query'][_0x305e('0x26')]+'%'};return _0xff7921;}})});}_0x5f2bad=_['merge']({},_0x5f2bad,_0x55f0fb[_0x305e('0x28')]);var _0x288d6f={'where':_0x5f2bad[_0x305e('0x24')]};return db[_0x305e('0x16')][_0x305e('0x9')](_0x288d6f)[_0x305e('0xf')](function(_0x3c4409){_0x567ccd['count']=_0x3c4409;if(_0x55f0fb[_0x305e('0x1b')][_0x305e('0x29')]){_0x5f2bad[_0x305e('0x2a')]=[{'all':!![]}];}return db[_0x305e('0x16')][_0x305e('0x2b')](_0x5f2bad);})['then'](function(_0x431de3){_0x567ccd['rows']=_0x431de3;return _0x567ccd;})[_0x305e('0xf')](respondWithFilteredResult(_0x58ea75,_0x5f2bad))[_0x305e('0x2c')](handleError(_0x58ea75,null));};exports[_0x305e('0x2d')]=function(_0x22e194,_0x376998){var _0x378250={'raw':![],'where':{'id':_0x22e194[_0x305e('0x2e')]['id']}},_0x25fb0a={};_0x25fb0a[_0x305e('0x1a')]=_[_0x305e('0x2f')](db[_0x305e('0x16')]['rawAttributes']);_0x25fb0a[_0x305e('0x1b')]=_[_0x305e('0x2f')](_0x22e194[_0x305e('0x1b')]);_0x25fb0a[_0x305e('0x1c')]=_[_0x305e('0x1d')](_0x25fb0a[_0x305e('0x1a')],_0x25fb0a[_0x305e('0x1b')]);_0x378250[_0x305e('0x1e')]=_[_0x305e('0x1d')](_0x25fb0a[_0x305e('0x1a')],qs[_0x305e('0x1f')](_0x22e194[_0x305e('0x1b')]['fields']));_0x378250['attributes']=_0x378250[_0x305e('0x1e')]['length']?_0x378250[_0x305e('0x1e')]:_0x25fb0a[_0x305e('0x1a')];if(_0x22e194[_0x305e('0x1b')][_0x305e('0x29')]){_0x378250['include']=[{'all':!![]}];}_0x378250=_[_0x305e('0x30')]({},_0x378250,_0x22e194[_0x305e('0x28')]);return db[_0x305e('0x16')][_0x305e('0x31')](_0x378250)[_0x305e('0xf')](handleEntityNotFound(_0x376998,null))['then'](respondWithResult(_0x376998,null))[_0x305e('0x2c')](handleError(_0x376998,null));};exports[_0x305e('0x32')]=function(_0x5eab2e,_0x5a0600){return db[_0x305e('0x16')]['create'](_0x5eab2e['body'],{})[_0x305e('0xf')](respondWithResult(_0x5a0600,0xc9))[_0x305e('0x2c')](handleError(_0x5a0600,null));};exports['update']=function(_0x1f64e8,_0x7c8338){if(_0x1f64e8[_0x305e('0x33')]['id']){delete _0x1f64e8[_0x305e('0x33')]['id'];}return db[_0x305e('0x16')][_0x305e('0x31')]({'where':{'id':_0x1f64e8[_0x305e('0x2e')]['id']}})[_0x305e('0xf')](handleEntityNotFound(_0x7c8338,null))[_0x305e('0xf')](saveUpdates(_0x1f64e8[_0x305e('0x33')],null))[_0x305e('0xf')](respondWithResult(_0x7c8338,null))[_0x305e('0x2c')](handleError(_0x7c8338,null));};exports[_0x305e('0xe')]=function(_0x339464,_0x190ef2){return db['Dynamics365Account'][_0x305e('0x31')]({'where':{'id':_0x339464['params']['id']}})[_0x305e('0xf')](handleEntityNotFound(_0x190ef2,null))[_0x305e('0xf')](removeEntity(_0x190ef2,null))[_0x305e('0x2c')](handleError(_0x190ef2,null));};exports[_0x305e('0x34')]=function(_0x3cce7f,_0x2c24ae){var _0x45027e={};var _0xea932d={};var _0x1c19f9;var _0xd2d844;return db[_0x305e('0x16')][_0x305e('0x35')]({'where':{'id':_0x3cce7f[_0x305e('0x2e')]['id']}})[_0x305e('0xf')](handleEntityNotFound(_0x2c24ae,null))[_0x305e('0xf')](function(_0x4a2095){if(_0x4a2095){_0x1c19f9=_0x4a2095;_0xea932d[_0x305e('0x1a')]=_[_0x305e('0x2f')](db['Dynamics365Configuration'][_0x305e('0x17')]);_0xea932d[_0x305e('0x1b')]=_[_0x305e('0x2f')](_0x3cce7f[_0x305e('0x1b')]);_0xea932d[_0x305e('0x1c')]=_[_0x305e('0x1d')](_0xea932d[_0x305e('0x1a')],_0xea932d[_0x305e('0x1b')]);_0x45027e[_0x305e('0x1e')]=_[_0x305e('0x1d')](_0xea932d['model'],qs[_0x305e('0x1f')](_0x3cce7f['query']['fields']));_0x45027e[_0x305e('0x1e')]=_0x45027e['attributes']['length']?_0x45027e['attributes']:_0xea932d['model'];_0x45027e[_0x305e('0x22')]=qs[_0x305e('0x23')](_0x3cce7f[_0x305e('0x1b')][_0x305e('0x23')]);_0x45027e['where']=qs[_0x305e('0x1c')](_[_0x305e('0x25')](_0x3cce7f[_0x305e('0x1b')],_0xea932d['filters']));if(_0x3cce7f[_0x305e('0x1b')][_0x305e('0x26')]){_0x45027e['where']=_['merge'](_0x45027e['where'],{'$or':_[_0x305e('0x15')](_0x45027e[_0x305e('0x1e')],function(_0x36376b){var _0x498c26={};_0x498c26[_0x36376b]={'$like':'%'+_0x3cce7f[_0x305e('0x1b')][_0x305e('0x26')]+'%'};return _0x498c26;})});}_0x45027e=_[_0x305e('0x30')]({},_0x45027e,_0x3cce7f[_0x305e('0x28')]);return _0x1c19f9[_0x305e('0x34')](_0x45027e);}})['then'](function(_0x377010){if(_0x377010){_0xd2d844=_0x377010[_0x305e('0x20')];if(!_0x3cce7f['query']['hasOwnProperty'](_0x305e('0x21'))){_0x45027e[_0x305e('0xa')]=qs[_0x305e('0xa')](_0x3cce7f[_0x305e('0x1b')]['limit']);_0x45027e['offset']=qs[_0x305e('0x7')](_0x3cce7f['query']['offset']);}return _0x1c19f9[_0x305e('0x34')](_0x45027e);}})[_0x305e('0xf')](function(_0x5a76dd){if(_0x5a76dd){return _0x5a76dd?{'count':_0xd2d844,'rows':_0x5a76dd}:null;}})['then'](respondWithResult(_0x2c24ae,null))[_0x305e('0x2c')](handleError(_0x2c24ae,null));};exports[_0x305e('0x36')]=function(_0x38134d,_0x460a6e){if(_0x38134d[_0x305e('0x33')]['id']){delete _0x38134d['body']['id'];}return db[_0x305e('0x16')]['findOne']({'where':{'id':_0x38134d[_0x305e('0x2e')]['id']}})[_0x305e('0xf')](handleEntityNotFound(_0x460a6e,null))[_0x305e('0xf')](function(_0x361f92){if(_0x361f92){_0x38134d[_0x305e('0x33')]['AccountId']=_0x361f92['id'];_0x38134d[_0x305e('0x33')]['Subjects']=integrations[_0x305e('0x37')](_0x38134d[_0x305e('0x33')][_0x305e('0x38')],_0x38134d['body']['type']);_0x38134d[_0x305e('0x33')][_0x305e('0x39')]=integrations[_0x305e('0x3a')](_0x38134d[_0x305e('0x33')][_0x305e('0x38')],_0x38134d[_0x305e('0x33')]['type']);return db[_0x305e('0x3b')][_0x305e('0x32')](_0x38134d[_0x305e('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':_0x305e('0x3c')},{'model':db['Dynamics365Field'],'as':_0x305e('0x39')}]});}return null;})[_0x305e('0xf')](respondWithResult(_0x460a6e,null))[_0x305e('0x2c')](handleError(_0x460a6e,null));};function sanitizeRemoteUri(_0x12301e){var _0x1f4285=_0x12301e['slice'](-0x1);if(_0x1f4285==='/')return _0x12301e[_0x305e('0x3d')](0x0,_0x12301e['lastIndexOf'](_0x1f4285));return _0x12301e;}function getWebApiUrl(_0x2f73a2){return util[_0x305e('0x3e')]('%s/api/data/v9.0/',_0x2f73a2);}exports[_0x305e('0x3f')]=function(_0x4efe8a,_0x388c0c){var _0x36856b=_0x4efe8a[_0x305e('0x1b')][_0x305e('0x40')];var _0x1b4ace=_0x36856b===_0x305e('0x41')?_0x305e('0x42'):_0x305e('0x43');var _0x7d3d58='';var _0x1f93d8='';var _0x4117d2='';var _0x4c0cd6='';var _0x27882a='';var _0x35b054='';var _0x3e8b94='';var _0x3d44d5='';var _0x4a8047=[_0x305e('0x44'),'description',_0x305e('0x45'),_0x305e('0x46'),_0x305e('0x47'),'subject',_0x305e('0x48'),_0x305e('0x49'),_0x305e('0x4a'),_0x305e('0x4b')];var _0x55de30=['accountidname','accountidyominame',_0x305e('0x4c'),_0x305e('0x4d'),'contactidname',_0x305e('0x4e'),_0x305e('0x4f'),_0x305e('0x50'),_0x305e('0x51'),_0x305e('0x52'),'createdbyname',_0x305e('0x53'),_0x305e('0x54'),_0x305e('0x55'),_0x305e('0x56'),'customeridname',_0x305e('0x57'),_0x305e('0x58'),_0x305e('0x59'),_0x305e('0x5a'),'entityimage_timestamp',_0x305e('0x5b'),'escalatedon',_0x305e('0x5c'),_0x305e('0x5d'),_0x305e('0x5e'),_0x305e('0x5f'),_0x305e('0x60'),_0x305e('0x61'),_0x305e('0x62'),_0x305e('0x63'),_0x305e('0x64'),_0x305e('0x65'),_0x305e('0x66'),_0x305e('0x67'),'modifiedon','modifiedonbehalfbyname',_0x305e('0x68'),_0x305e('0x69'),_0x305e('0x6a'),_0x305e('0x6b'),_0x305e('0x6c'),_0x305e('0x6d'),'owneridname',_0x305e('0x6e'),_0x305e('0x6f'),_0x305e('0x70'),_0x305e('0x71'),'primarycontactidyominame','prioritycodename',_0x305e('0x72'),_0x305e('0x73'),_0x305e('0x74'),_0x305e('0x75'),_0x305e('0x76'),'responsiblecontactidname',_0x305e('0x77'),_0x305e('0x78'),_0x305e('0x79'),_0x305e('0x7a'),_0x305e('0x7b'),'statecode',_0x305e('0x7c'),'subjectidname',_0x305e('0x7d'),_0x305e('0x7e'),_0x305e('0x7f'),_0x305e('0x80'),_0x305e('0x81'),'versionnumber'];var _0x387e61=_0x4a8047[_0x305e('0x82')](_0x55de30);return db[_0x305e('0x16')][_0x305e('0x35')]({'where':{'id':_0x4efe8a[_0x305e('0x2e')]['id']},'attributes':['id',_0x305e('0x83'),_0x305e('0x84'),_0x305e('0x85'),_0x305e('0x86'),'clientId',_0x305e('0x87'),_0x305e('0x88')],'include':[{'model':db[_0x305e('0x89')],'as':_0x305e('0x89'),'attributes':['id',_0x305e('0x8a'),_0x305e('0x8b')]}]})['then'](handleEntityNotFound(_0x388c0c,null))[_0x305e('0xf')](function(_0x55c61c){if(_0x55c61c){if(_0x55c61c['modernAuthentication']){_0x55c61c[_0x305e('0x8c')]=_0x55c61c['CloudProvider'][_0x305e('0x8a')];_0x3d44d5=sanitizeRemoteUri(_0x55c61c[_0x305e('0x89')][_0x305e('0x8b')]);_0x3e8b94=getWebApiUrl(_0x3d44d5);return _0x55c61c;}_0x3d44d5=sanitizeRemoteUri(_0x55c61c[_0x305e('0x85')]);_0x3e8b94=getWebApiUrl(_0x3d44d5);var _0x2bad24={'method':'POST','uri':_0x305e('0x8d')+_0x55c61c[_0x305e('0x86')]+_0x305e('0x8e'),'form':{'client_id':_0x55c61c[_0x305e('0x8f')],'resource':_0x3d44d5,'username':_0x55c61c[_0x305e('0x83')],'password':_0x55c61c['password'],'grant_type':'password','client_secret':_0x55c61c[_0x305e('0x87')]},'json':!![]};return rp(_0x2bad24);}})[_0x305e('0xf')](function(_0x4cff1e){_0x35b054=_0x4cff1e[_0x305e('0x8c')];var _0x50ee49={'method':_0x305e('0x90'),'uri':encodeURI(_0x3e8b94+_0x305e('0x91')+_0x1b4ace+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x35b054,'If-None-Match':null,'OData-Version':_0x305e('0x92')},'json':!![]};return rp(_0x50ee49);})[_0x305e('0xf')](function(_0x5ec438){var _0x5d187=_0x5ec438[_0x305e('0x93')][0x0];var _0x4bc1dd=_0x5d187[_0x305e('0x94')];var _0x5ecb6d={'method':'GET','uri':_0x3e8b94+_0x305e('0x95')+_0x4bc1dd+_0x305e('0x96'),'headers':{'Authorization':_0x305e('0x97')+_0x35b054,'If-None-Match':null,'OData-Version':_0x305e('0x92')},'json':!![]};return rp(_0x5ecb6d);})[_0x305e('0xf')](function(_0x7b8d2e){_0x7d3d58=_0x7b8d2e;_0x1f93d8=_0x7d3d58[_0x305e('0x98')];_0x1f93d8=_[_0x305e('0x99')](_0x1f93d8,function(_0x167ff1){return!_0x387e61[_0x305e('0x9a')](_0x167ff1[_0x305e('0x9b')]);});var _0x191ee2=[];var _0x1ebaaf=[];_0x1f93d8[_0x305e('0x9c')](function(_0x5ac8da){if(_0x5ac8da[_0x305e('0x9d')]){var _0x88196a=_0x5ac8da[_0x305e('0x9d')][_0x305e('0x3d')](_0x5ac8da[_0x305e('0x9d')][_0x305e('0x9e')]('.')+0x1);if(_0x88196a===_0x305e('0x9f')){_0x191ee2[_0x305e('0xa0')](getSelectList(_0x3e8b94,_0x36856b,_0x1ebaaf,_0x7d3d58[_0x305e('0x94')],_0x5ac8da[_0x305e('0x94')],_0x35b054));}}});return Promise[_0x305e('0xa1')](_0x191ee2);})[_0x305e('0xf')](function(_0x51015c){_0x4117d2=_0x51015c[0x0];var _0x3f3613=[];var _0x34981a=[];_0x1f93d8[_0x305e('0x9c')](function(_0x1e8b31){if(!_['isNil'](_0x1e8b31[_0x305e('0x9d')])){var _0x2a2081=_0x1e8b31[_0x305e('0x9d')][_0x305e('0x3d')](_0x1e8b31[_0x305e('0x9d')][_0x305e('0x9e')]('.')+0x1);if(_0x2a2081==='BooleanAttributeMetadata'){_0x3f3613['push'](getBooleanList(_0x3e8b94,_0x36856b,_0x34981a,_0x7d3d58[_0x305e('0x94')],_0x1e8b31['MetadataId'],_0x35b054));}}});return Promise['all'](_0x3f3613);})[_0x305e('0xf')](function(_0x5526a9){_0x4c0cd6=_0x5526a9[0x0];var _0x21ebd4=[];var _0x4ea1d9=[];_0x1f93d8[_0x305e('0x9c')](function(_0xb36138){if(_0xb36138[_0x305e('0x9d')]){var _0x192994=_0xb36138[_0x305e('0x9d')][_0x305e('0x3d')](_0xb36138[_0x305e('0x9d')][_0x305e('0x9e')]('.')+0x1);if(_0x192994===_0x305e('0xa2')||_0x192994===_0x305e('0xa3')||_0x192994===_0x305e('0xa4')||_0x192994===_0x305e('0xa5')||_0x192994===_0x305e('0xa6')||_0x192994===_0x305e('0xa7')||_0x192994===_0x305e('0xa8')||_0x192994===_0x305e('0xa9')||_0x192994===_0x305e('0xaa')||_0x192994===_0x305e('0xab')){_0x21ebd4[_0x305e('0xa0')](getInputList(_0x3e8b94,_0x36856b,_0x192994,_0x4ea1d9,_0x7d3d58['MetadataId'],_0xb36138[_0x305e('0x94')],_0x35b054));}}});return Promise[_0x305e('0xa1')](_0x21ebd4);})[_0x305e('0xf')](function(_0x4da2a7){_0x27882a=_0x4da2a7[0x0];var _0x2d883e=_0x4117d2['concat'](_0x4c0cd6)['concat'](_0x27882a);var _0x27c15a={'count':_0x2d883e[_0x305e('0x20')],'rows':_0x2d883e};return _0x27c15a;})['then'](respondWithResult(_0x388c0c,null))[_0x305e('0x2c')](function(_0x3edc12){var _0x49fc61=_0x4efe8a[_0x305e('0x1b')]['test']?0x1f4:_0x3edc12[_0x305e('0xac')]||0x1f4;logger[_0x305e('0xad')](_0x3edc12['stack']);delete _0x3edc12[_0x305e('0x13')];if(_0x49fc61===0x191){_0x49fc61=0x190;}_0x388c0c['status'](_0x49fc61)[_0x305e('0x14')](_0x4efe8a[_0x305e('0x1b')][_0x305e('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x3edc12['statusCode']}:_0x3edc12);});};function getSelectList(_0xb55956,_0x54be48,_0x3d3af9,_0x21320c,_0x26fc1f,_0x2d0d3e){var _0x224f6a={'method':_0x305e('0x90'),'uri':_0xb55956+_0x305e('0x95')+_0x21320c+_0x305e('0xaf')+_0x26fc1f+_0x305e('0xb0')+_0x305e('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0x2d0d3e,'If-None-Match':null,'OData-Version':_0x305e('0x92')},'json':!![]};return rp(_0x224f6a)[_0x305e('0xf')](function(_0x26cc29){var _0x2e75c2=[];var _0x56dcb6=_0x26cc29['OptionSet'][_0x305e('0xb2')];_0x56dcb6['forEach'](function(_0x3d82f2){_0x2e75c2[_0x305e('0xa0')]({'name':_0x3d82f2[_0x305e('0xb3')][_0x305e('0xb4')][_0x305e('0xb3')],'value':String(_0x3d82f2[_0x305e('0xb5')])});});var _0x38e9a1={'id':_0x54be48+'_'+_0x26cc29['LogicalName'],'name':_0x26cc29[_0x305e('0xb6')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x2e75c2};_0x3d3af9[_0x305e('0xa0')](_0x38e9a1);return _0x3d3af9;});}function getBooleanList(_0x410712,_0x33d23b,_0x3545d2,_0x43a3e9,_0x3404d9,_0x273e8a){var _0x380ca4={'method':'GET','uri':_0x410712+_0x305e('0x95')+_0x43a3e9+_0x305e('0xaf')+_0x3404d9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x305e('0x97')+_0x273e8a,'If-None-Match':null,'OData-Version':_0x305e('0x92')},'json':!![]};return rp(_0x380ca4)['then'](function(_0x47d440){var _0x60c363=[];_0x60c363[_0x305e('0xa0')]({'name':_0x47d440[_0x305e('0xb7')][_0x305e('0xb8')][_0x305e('0xb3')]['UserLocalizedLabel'][_0x305e('0xb3')],'value':'true'},{'name':_0x47d440[_0x305e('0xb7')][_0x305e('0xb9')][_0x305e('0xb3')]['UserLocalizedLabel']['Label'],'value':_0x305e('0xba')});var _0x3d3180={'id':_0x33d23b+'_'+_0x47d440[_0x305e('0x9b')],'name':_0x47d440[_0x305e('0xb6')][_0x305e('0xb4')][_0x305e('0xb3')],'custom':![],'options':_0x60c363};_0x3545d2[_0x305e('0xa0')](_0x3d3180);return _0x3545d2;});}function getInputList(_0x45c109,_0x252d5a,_0x5a07e8,_0x23773f,_0x197655,_0x572da7,_0x492fe9){var _0x5ea99d={'method':_0x305e('0x90'),'uri':_0x45c109+_0x305e('0x95')+_0x197655+_0x305e('0xaf')+_0x572da7+')/Microsoft.Dynamics.CRM.'+_0x5a07e8+_0x305e('0xbb'),'headers':{'Authorization':_0x305e('0x97')+_0x492fe9,'If-None-Match':null,'OData-Version':_0x305e('0x92')},'json':!![]};return rp(_0x5ea99d)['then'](function(_0x4e4bcb){var _0x1b0c75={'id':_0x252d5a+'_'+_0x4e4bcb['LogicalName'],'name':_0x4e4bcb[_0x305e('0xb6')]['UserLocalizedLabel']?_0x4e4bcb[_0x305e('0xb6')][_0x305e('0xb4')][_0x305e('0xb3')]:_0x4e4bcb['LogicalName'],'custom':![],'options':[]};_0x23773f[_0x305e('0xa0')](_0x1b0c75);return _0x23773f;});} \ No newline at end of file +var _0x8830=['@odata.type','push','all','forEach','isNil','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','update','destroy','then','end','sendStatus','error','stack','name','send','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','incident','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','/oauth2/token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName'];(function(_0x2a74f5,_0x542b0b){var _0x358258=function(_0x52e19e){while(--_0x52e19e){_0x2a74f5['push'](_0x2a74f5['shift']());}};_0x358258(++_0x542b0b);}(_0x8830,0x181));var _0x0883=function(_0x2bda4c,_0x5ab9b5){_0x2bda4c=_0x2bda4c-0x0;var _0x1c7ac5=_0x8830[_0x2bda4c];return _0x1c7ac5;};'use strict';var rp=require(_0x0883('0x0'));var util=require(_0x0883('0x1'));var _=require(_0x0883('0x2'));var qs=require(_0x0883('0x3'));var logger=require('../../config/logger')(_0x0883('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0883('0x5'));function respondWithResult(_0x711297,_0x433f26){_0x433f26=_0x433f26||0xc8;return function(_0x3e597b){if(_0x3e597b){return _0x711297['status'](_0x433f26)[_0x0883('0x6')](_0x3e597b);}};}function respondWithFilteredResult(_0x45b832,_0x2e9384){return function(_0x503b86){if(_0x503b86){var _0x3da72f=typeof _0x2e9384[_0x0883('0x7')]===_0x0883('0x8')&&typeof _0x2e9384[_0x0883('0x9')]===_0x0883('0x8');var _0x2d6500=_0x503b86[_0x0883('0xa')];var _0x108984=_0x3da72f?0x0:_0x2e9384[_0x0883('0x7')];var _0x1ca124=_0x3da72f?_0x503b86[_0x0883('0xa')]:_0x2e9384[_0x0883('0x7')]+_0x2e9384['limit'];var _0x21c1d3;if(_0x1ca124>=_0x2d6500){_0x1ca124=_0x2d6500;_0x21c1d3=0xc8;}else{_0x21c1d3=0xce;}_0x45b832[_0x0883('0xb')](_0x21c1d3);return _0x45b832[_0x0883('0xc')]('Content-Range',_0x108984+'-'+_0x1ca124+'/'+_0x2d6500)[_0x0883('0x6')](_0x503b86);}return null;};}function saveUpdates(_0x559942){return function(_0x49b1e8){if(_0x49b1e8){return _0x49b1e8[_0x0883('0xd')](_0x559942)['then'](function(_0x1f26c0){return _0x1f26c0;});}return null;};}function removeEntity(_0x431d93){return function(_0x56bcf8){if(_0x56bcf8){return _0x56bcf8[_0x0883('0xe')]()[_0x0883('0xf')](function(){_0x431d93[_0x0883('0xb')](0xcc)[_0x0883('0x10')]();});}};}function handleEntityNotFound(_0x3d4d7a){return function(_0x399f22){if(!_0x399f22){_0x3d4d7a[_0x0883('0x11')](0x194);}return _0x399f22;};}function handleError(_0x1fb81d,_0x5165e7){_0x5165e7=_0x5165e7||0x1f4;return function(_0x4dc614){logger[_0x0883('0x12')](_0x4dc614[_0x0883('0x13')]);if(_0x4dc614[_0x0883('0x14')]){delete _0x4dc614['name'];}_0x1fb81d['status'](_0x5165e7)[_0x0883('0x15')](_0x4dc614);};}exports['index']=function(_0x146794,_0x473341){var _0x205435={},_0x35da48={},_0x468c79={'count':0x0,'rows':[]};var _0xa8c242=_['map'](db[_0x0883('0x16')][_0x0883('0x17')],function(_0x15836e){return{'name':_0x15836e[_0x0883('0x18')],'type':_0x15836e[_0x0883('0x19')][_0x0883('0x1a')]};});_0x35da48[_0x0883('0x1b')]=_[_0x0883('0x1c')](_0xa8c242,_0x0883('0x14'));_0x35da48[_0x0883('0x1d')]=_[_0x0883('0x1e')](_0x146794[_0x0883('0x1d')]);_0x35da48[_0x0883('0x1f')]=_[_0x0883('0x20')](_0x35da48[_0x0883('0x1b')],_0x35da48['query']);_0x205435[_0x0883('0x21')]=_[_0x0883('0x20')](_0x35da48[_0x0883('0x1b')],qs[_0x0883('0x22')](_0x146794[_0x0883('0x1d')][_0x0883('0x22')]));_0x205435[_0x0883('0x21')]=_0x205435[_0x0883('0x21')]['length']?_0x205435[_0x0883('0x21')]:_0x35da48[_0x0883('0x1b')];if(!_0x146794['query'][_0x0883('0x23')](_0x0883('0x24'))){_0x205435[_0x0883('0x9')]=qs['limit'](_0x146794[_0x0883('0x1d')]['limit']);_0x205435['offset']=qs[_0x0883('0x7')](_0x146794['query'][_0x0883('0x7')]);}_0x205435[_0x0883('0x25')]=qs['sort'](_0x146794[_0x0883('0x1d')][_0x0883('0x26')]);_0x205435[_0x0883('0x27')]=qs[_0x0883('0x1f')](_[_0x0883('0x28')](_0x146794[_0x0883('0x1d')],_0x35da48[_0x0883('0x1f')]),_0xa8c242);if(_0x146794['query'][_0x0883('0x29')]){_0x205435[_0x0883('0x27')]=_[_0x0883('0x2a')](_0x205435[_0x0883('0x27')],{'$or':_[_0x0883('0x1c')](_0xa8c242,function(_0x4e0009){if(_0x4e0009['type']!==_0x0883('0x2b')){var _0x4e9900={};_0x4e9900[_0x4e0009[_0x0883('0x14')]]={'$like':'%'+_0x146794[_0x0883('0x1d')][_0x0883('0x29')]+'%'};return _0x4e9900;}})});}_0x205435=_[_0x0883('0x2a')]({},_0x205435,_0x146794[_0x0883('0x2c')]);var _0x35de32={'where':_0x205435[_0x0883('0x27')]};return db[_0x0883('0x16')][_0x0883('0xa')](_0x35de32)[_0x0883('0xf')](function(_0x43c7b3){_0x468c79[_0x0883('0xa')]=_0x43c7b3;if(_0x146794[_0x0883('0x1d')][_0x0883('0x2d')]){_0x205435[_0x0883('0x2e')]=[{'all':!![]}];}return db[_0x0883('0x16')][_0x0883('0x2f')](_0x205435);})[_0x0883('0xf')](function(_0x486740){_0x468c79[_0x0883('0x30')]=_0x486740;return _0x468c79;})['then'](respondWithFilteredResult(_0x473341,_0x205435))[_0x0883('0x31')](handleError(_0x473341,null));};exports[_0x0883('0x32')]=function(_0x1b6a91,_0x204b49){var _0x1f15cc={'raw':![],'where':{'id':_0x1b6a91[_0x0883('0x33')]['id']}},_0x41d2e0={};_0x41d2e0['model']=_[_0x0883('0x1e')](db[_0x0883('0x16')][_0x0883('0x17')]);_0x41d2e0['query']=_[_0x0883('0x1e')](_0x1b6a91['query']);_0x41d2e0[_0x0883('0x1f')]=_[_0x0883('0x20')](_0x41d2e0['model'],_0x41d2e0[_0x0883('0x1d')]);_0x1f15cc[_0x0883('0x21')]=_[_0x0883('0x20')](_0x41d2e0['model'],qs['fields'](_0x1b6a91[_0x0883('0x1d')][_0x0883('0x22')]));_0x1f15cc[_0x0883('0x21')]=_0x1f15cc[_0x0883('0x21')][_0x0883('0x34')]?_0x1f15cc[_0x0883('0x21')]:_0x41d2e0[_0x0883('0x1b')];if(_0x1b6a91[_0x0883('0x1d')]['includeAll']){_0x1f15cc[_0x0883('0x2e')]=[{'all':!![]}];}_0x1f15cc=_[_0x0883('0x2a')]({},_0x1f15cc,_0x1b6a91['options']);return db[_0x0883('0x16')][_0x0883('0x35')](_0x1f15cc)['then'](handleEntityNotFound(_0x204b49,null))['then'](respondWithResult(_0x204b49,null))['catch'](handleError(_0x204b49,null));};exports[_0x0883('0x36')]=function(_0x34bc19,_0x39d29d){return db[_0x0883('0x16')]['create'](_0x34bc19[_0x0883('0x37')],{})[_0x0883('0xf')](respondWithResult(_0x39d29d,0xc9))[_0x0883('0x31')](handleError(_0x39d29d,null));};exports['update']=function(_0x5160a5,_0x3cc1f3){if(_0x5160a5['body']['id']){delete _0x5160a5[_0x0883('0x37')]['id'];}return db[_0x0883('0x16')]['find']({'where':{'id':_0x5160a5[_0x0883('0x33')]['id']}})[_0x0883('0xf')](handleEntityNotFound(_0x3cc1f3,null))[_0x0883('0xf')](saveUpdates(_0x5160a5['body'],null))[_0x0883('0xf')](respondWithResult(_0x3cc1f3,null))[_0x0883('0x31')](handleError(_0x3cc1f3,null));};exports[_0x0883('0xe')]=function(_0x6b5ddc,_0x405ba7){return db['Dynamics365Account']['find']({'where':{'id':_0x6b5ddc[_0x0883('0x33')]['id']}})['then'](handleEntityNotFound(_0x405ba7,null))[_0x0883('0xf')](removeEntity(_0x405ba7,null))[_0x0883('0x31')](handleError(_0x405ba7,null));};exports[_0x0883('0x38')]=function(_0x23cd0e,_0x2baef3){var _0xf551f3={};var _0x5f0200={};var _0x5d646d;var _0x339841;return db[_0x0883('0x16')][_0x0883('0x39')]({'where':{'id':_0x23cd0e[_0x0883('0x33')]['id']}})[_0x0883('0xf')](handleEntityNotFound(_0x2baef3,null))[_0x0883('0xf')](function(_0x5e7cd9){if(_0x5e7cd9){_0x5d646d=_0x5e7cd9;_0x5f0200[_0x0883('0x1b')]=_[_0x0883('0x1e')](db['Dynamics365Configuration'][_0x0883('0x17')]);_0x5f0200['query']=_['keys'](_0x23cd0e[_0x0883('0x1d')]);_0x5f0200['filters']=_['intersection'](_0x5f0200[_0x0883('0x1b')],_0x5f0200['query']);_0xf551f3[_0x0883('0x21')]=_[_0x0883('0x20')](_0x5f0200[_0x0883('0x1b')],qs[_0x0883('0x22')](_0x23cd0e[_0x0883('0x1d')][_0x0883('0x22')]));_0xf551f3['attributes']=_0xf551f3[_0x0883('0x21')]['length']?_0xf551f3['attributes']:_0x5f0200[_0x0883('0x1b')];_0xf551f3[_0x0883('0x25')]=qs[_0x0883('0x26')](_0x23cd0e['query'][_0x0883('0x26')]);_0xf551f3[_0x0883('0x27')]=qs['filters'](_[_0x0883('0x28')](_0x23cd0e[_0x0883('0x1d')],_0x5f0200[_0x0883('0x1f')]));if(_0x23cd0e[_0x0883('0x1d')][_0x0883('0x29')]){_0xf551f3[_0x0883('0x27')]=_[_0x0883('0x2a')](_0xf551f3[_0x0883('0x27')],{'$or':_['map'](_0xf551f3[_0x0883('0x21')],function(_0x13e096){var _0x425f83={};_0x425f83[_0x13e096]={'$like':'%'+_0x23cd0e['query']['filter']+'%'};return _0x425f83;})});}_0xf551f3=_[_0x0883('0x2a')]({},_0xf551f3,_0x23cd0e[_0x0883('0x2c')]);return _0x5d646d[_0x0883('0x38')](_0xf551f3);}})[_0x0883('0xf')](function(_0x510a39){if(_0x510a39){_0x339841=_0x510a39[_0x0883('0x34')];if(!_0x23cd0e[_0x0883('0x1d')][_0x0883('0x23')](_0x0883('0x24'))){_0xf551f3[_0x0883('0x9')]=qs['limit'](_0x23cd0e[_0x0883('0x1d')][_0x0883('0x9')]);_0xf551f3['offset']=qs[_0x0883('0x7')](_0x23cd0e[_0x0883('0x1d')][_0x0883('0x7')]);}return _0x5d646d['getConfigurations'](_0xf551f3);}})[_0x0883('0xf')](function(_0x4bc02c){if(_0x4bc02c){return _0x4bc02c?{'count':_0x339841,'rows':_0x4bc02c}:null;}})[_0x0883('0xf')](respondWithResult(_0x2baef3,null))['catch'](handleError(_0x2baef3,null));};exports[_0x0883('0x3a')]=function(_0x18bba7,_0x1d3468){if(_0x18bba7[_0x0883('0x37')]['id']){delete _0x18bba7[_0x0883('0x37')]['id'];}return db[_0x0883('0x16')][_0x0883('0x39')]({'where':{'id':_0x18bba7[_0x0883('0x33')]['id']}})[_0x0883('0xf')](handleEntityNotFound(_0x1d3468,null))[_0x0883('0xf')](function(_0x352956){if(_0x352956){_0x18bba7['body'][_0x0883('0x3b')]=_0x352956['id'];_0x18bba7[_0x0883('0x37')][_0x0883('0x3c')]=integrations[_0x0883('0x3d')](_0x18bba7['body'][_0x0883('0x3e')],_0x18bba7[_0x0883('0x37')][_0x0883('0x19')]);_0x18bba7['body'][_0x0883('0x3f')]=integrations['getDescriptions'](_0x18bba7[_0x0883('0x37')][_0x0883('0x3e')],_0x18bba7[_0x0883('0x37')][_0x0883('0x19')]);return db[_0x0883('0x40')][_0x0883('0x36')](_0x18bba7[_0x0883('0x37')],{'include':[{'model':db[_0x0883('0x41')],'as':_0x0883('0x3c')},{'model':db[_0x0883('0x41')],'as':_0x0883('0x3f')}]});}return null;})[_0x0883('0xf')](respondWithResult(_0x1d3468,null))['catch'](handleError(_0x1d3468,null));};function sanitizeRemoteUri(_0x3e0acd){var _0x577f10=_0x3e0acd[_0x0883('0x42')](-0x1);if(_0x577f10==='/')return _0x3e0acd[_0x0883('0x43')](0x0,_0x3e0acd[_0x0883('0x44')](_0x577f10));return _0x3e0acd;}function getWebApiUrl(_0xd31eb1){return util[_0x0883('0x45')](_0x0883('0x46'),_0xd31eb1);}exports['getFields']=function(_0x4f0b25,_0x2f3b79){var _0x2d2fa8=_0x4f0b25[_0x0883('0x1d')]['ticketType'];var _0x1f3aae=_0x2d2fa8===_0x0883('0x47')?'Incident':'PhoneCall';var _0x304ebd='';var _0x12b35a='';var _0x48f617='';var _0xce7ffb='';var _0x266fe1='';var _0x369cff='';var _0x212f69='';var _0x215dfc='';var _0x3f7176=[_0x0883('0x48'),_0x0883('0x49'),_0x0883('0x4a'),'ownerid',_0x0883('0x4b'),_0x0883('0x4c'),'phonenumber',_0x0883('0x4d'),_0x0883('0x4e'),_0x0883('0x4f')];var _0x5b84c7=[_0x0883('0x50'),_0x0883('0x51'),_0x0883('0x52'),'billedserviceunits','contactidname',_0x0883('0x53'),_0x0883('0x54'),_0x0883('0x55'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x0883('0x56'),'createdbyyominame',_0x0883('0x57'),'createdonbehalfbyname',_0x0883('0x58'),_0x0883('0x59'),'customeridtype',_0x0883('0x5a'),'emailaddress',_0x0883('0x5b'),_0x0883('0x5c'),_0x0883('0x5d'),'escalatedon','exchangerate','firstresponsebykpiidname',_0x0883('0x5e'),_0x0883('0x5f'),_0x0883('0x60'),_0x0883('0x61'),_0x0883('0x62'),'masteridname',_0x0883('0x63'),_0x0883('0x64'),_0x0883('0x65'),'modifiedbyyominame',_0x0883('0x66'),'modifiedonbehalfbyname',_0x0883('0x67'),_0x0883('0x68'),_0x0883('0x69'),_0x0883('0x6a'),_0x0883('0x6b'),'overriddencreatedon',_0x0883('0x6c'),'owneridtype',_0x0883('0x6d'),_0x0883('0x6e'),_0x0883('0x6f'),_0x0883('0x70'),_0x0883('0x71'),'productidname','productserialnumber',_0x0883('0x72'),_0x0883('0x73'),_0x0883('0x74'),'responsiblecontactidname',_0x0883('0x75'),_0x0883('0x76'),_0x0883('0x77'),'slaname',_0x0883('0x78'),'statecode',_0x0883('0x79'),_0x0883('0x7a'),_0x0883('0x7b'),_0x0883('0x7c'),'transactioncurrencyidname',_0x0883('0x7d'),_0x0883('0x7e'),_0x0883('0x7f')];var _0x3e4ed6=_0x3f7176['concat'](_0x5b84c7);return db['Dynamics365Account'][_0x0883('0x39')]({'where':{'id':_0x4f0b25[_0x0883('0x33')]['id']},'attributes':['id',_0x0883('0x80'),_0x0883('0x81'),'remoteUri',_0x0883('0x82'),_0x0883('0x83'),_0x0883('0x84'),_0x0883('0x85')],'include':[{'model':db[_0x0883('0x86')],'as':_0x0883('0x86'),'attributes':['id',_0x0883('0x87'),_0x0883('0x88')]}]})['then'](handleEntityNotFound(_0x2f3b79,null))[_0x0883('0xf')](function(_0x2d475a){if(_0x2d475a){if(_0x2d475a[_0x0883('0x85')]){_0x2d475a['access_token']=_0x2d475a[_0x0883('0x86')][_0x0883('0x87')];_0x215dfc=sanitizeRemoteUri(_0x2d475a['CloudProvider'][_0x0883('0x88')]);_0x212f69=getWebApiUrl(_0x215dfc);return _0x2d475a;}_0x215dfc=sanitizeRemoteUri(_0x2d475a['remoteUri']);_0x212f69=getWebApiUrl(_0x215dfc);var _0x1f83c1={'method':_0x0883('0x89'),'uri':'https://login.microsoftonline.com/'+_0x2d475a[_0x0883('0x82')]+_0x0883('0x8a'),'form':{'client_id':_0x2d475a[_0x0883('0x83')],'resource':_0x215dfc,'username':_0x2d475a[_0x0883('0x80')],'password':_0x2d475a[_0x0883('0x81')],'grant_type':'password','client_secret':_0x2d475a[_0x0883('0x84')]},'json':!![]};return rp(_0x1f83c1);}})['then'](function(_0x403eac){_0x369cff=_0x403eac['access_token'];var _0x43f8b6={'method':_0x0883('0x8b'),'uri':encodeURI(_0x212f69+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1f3aae+'\x27'),'headers':{'Authorization':_0x0883('0x8c')+_0x369cff,'If-None-Match':null,'OData-Version':_0x0883('0x8d')},'json':!![]};return rp(_0x43f8b6);})['then'](function(_0x51a9d4){var _0x211b1c=_0x51a9d4[_0x0883('0x8e')][0x0];var _0x5f4326=_0x211b1c[_0x0883('0x8f')];var _0x101f45={'method':_0x0883('0x8b'),'uri':_0x212f69+_0x0883('0x90')+_0x5f4326+_0x0883('0x91'),'headers':{'Authorization':_0x0883('0x8c')+_0x369cff,'If-None-Match':null,'OData-Version':_0x0883('0x8d')},'json':!![]};return rp(_0x101f45);})[_0x0883('0xf')](function(_0x9c2894){_0x304ebd=_0x9c2894;_0x12b35a=_0x304ebd[_0x0883('0x92')];_0x12b35a=_['remove'](_0x12b35a,function(_0x18c04c){return!_0x3e4ed6[_0x0883('0x93')](_0x18c04c[_0x0883('0x94')]);});var _0x2998fa=[];var _0x518f75=[];_0x12b35a['forEach'](function(_0x513af3){if(_0x513af3[_0x0883('0x95')]){var _0x2d72ae=_0x513af3[_0x0883('0x95')][_0x0883('0x43')](_0x513af3[_0x0883('0x95')][_0x0883('0x44')]('.')+0x1);if(_0x2d72ae==='PicklistAttributeMetadata'){_0x2998fa[_0x0883('0x96')](getSelectList(_0x212f69,_0x2d2fa8,_0x518f75,_0x304ebd[_0x0883('0x8f')],_0x513af3[_0x0883('0x8f')],_0x369cff));}}});return Promise[_0x0883('0x97')](_0x2998fa);})[_0x0883('0xf')](function(_0x21b361){_0x48f617=_0x21b361[0x0];var _0x311bc4=[];var _0x3d7df0=[];_0x12b35a[_0x0883('0x98')](function(_0x9efcfb){if(!_[_0x0883('0x99')](_0x9efcfb[_0x0883('0x95')])){var _0x2c14f2=_0x9efcfb['@odata.type'][_0x0883('0x43')](_0x9efcfb[_0x0883('0x95')][_0x0883('0x44')]('.')+0x1);if(_0x2c14f2==='BooleanAttributeMetadata'){_0x311bc4[_0x0883('0x96')](getBooleanList(_0x212f69,_0x2d2fa8,_0x3d7df0,_0x304ebd[_0x0883('0x8f')],_0x9efcfb[_0x0883('0x8f')],_0x369cff));}}});return Promise['all'](_0x311bc4);})['then'](function(_0x44c405){_0xce7ffb=_0x44c405[0x0];var _0x5302a0=[];var _0xf07fac=[];_0x12b35a[_0x0883('0x98')](function(_0x56fd1e){if(_0x56fd1e[_0x0883('0x95')]){var _0x190a1f=_0x56fd1e['@odata.type'][_0x0883('0x43')](_0x56fd1e[_0x0883('0x95')]['lastIndexOf']('.')+0x1);if(_0x190a1f==='StringAttributeMetadata'||_0x190a1f==='DoubleAttributeMetadata'||_0x190a1f===_0x0883('0x9a')||_0x190a1f===_0x0883('0x9b')||_0x190a1f===_0x0883('0x9c')||_0x190a1f==='DateTimeAttributeMetadata'||_0x190a1f==='StatusAttributeMetadata'||_0x190a1f===_0x0883('0x9d')||_0x190a1f===_0x0883('0x9e')||_0x190a1f===_0x0883('0x9f')){_0x5302a0['push'](getInputList(_0x212f69,_0x2d2fa8,_0x190a1f,_0xf07fac,_0x304ebd[_0x0883('0x8f')],_0x56fd1e[_0x0883('0x8f')],_0x369cff));}}});return Promise[_0x0883('0x97')](_0x5302a0);})[_0x0883('0xf')](function(_0x5e7b6b){_0x266fe1=_0x5e7b6b[0x0];var _0x69a2ef=_0x48f617[_0x0883('0xa0')](_0xce7ffb)[_0x0883('0xa0')](_0x266fe1);var _0x155ac6={'count':_0x69a2ef[_0x0883('0x34')],'rows':_0x69a2ef};return _0x155ac6;})[_0x0883('0xf')](respondWithResult(_0x2f3b79,null))[_0x0883('0x31')](function(_0x2b9637){var _0x46a4a5=_0x4f0b25[_0x0883('0x1d')][_0x0883('0xa1')]?0x1f4:_0x2b9637['statusCode']||0x1f4;logger[_0x0883('0x12')](_0x2b9637[_0x0883('0x13')]);delete _0x2b9637[_0x0883('0x14')];if(_0x46a4a5===0x191){_0x46a4a5=0x190;}_0x2f3b79[_0x0883('0xb')](_0x46a4a5)['send'](_0x4f0b25['query']['test']?{'message':_0x0883('0xa2'),'statusCode':_0x2b9637[_0x0883('0xa3')]}:_0x2b9637);});};function getSelectList(_0x4e226a,_0x5c71f4,_0x4d6162,_0x1f9e80,_0x4756ed,_0x3dce8b){var _0x1ac76e={'method':_0x0883('0x8b'),'uri':_0x4e226a+_0x0883('0x90')+_0x1f9e80+_0x0883('0xa4')+_0x4756ed+_0x0883('0xa5')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x0883('0x8c')+_0x3dce8b,'If-None-Match':null,'OData-Version':_0x0883('0x8d')},'json':!![]};return rp(_0x1ac76e)[_0x0883('0xf')](function(_0x526e4b){var _0x2112fe=[];var _0x1d455f=_0x526e4b['OptionSet'][_0x0883('0xa6')];_0x1d455f[_0x0883('0x98')](function(_0x264404){_0x2112fe[_0x0883('0x96')]({'name':_0x264404[_0x0883('0xa7')][_0x0883('0xa8')]['Label'],'value':String(_0x264404['Value'])});});var _0x242147={'id':_0x5c71f4+'_'+_0x526e4b[_0x0883('0x94')],'name':_0x526e4b[_0x0883('0xa9')][_0x0883('0xa8')][_0x0883('0xa7')],'custom':![],'options':_0x2112fe};_0x4d6162[_0x0883('0x96')](_0x242147);return _0x4d6162;});}function getBooleanList(_0x384aab,_0x40be35,_0x141202,_0x146bcf,_0x4d8a93,_0x5b04fc){var _0x576cba={'method':'GET','uri':_0x384aab+_0x0883('0x90')+_0x146bcf+_0x0883('0xa4')+_0x4d8a93+_0x0883('0xaa'),'headers':{'Authorization':_0x0883('0x8c')+_0x5b04fc,'If-None-Match':null,'OData-Version':_0x0883('0x8d')},'json':!![]};return rp(_0x576cba)[_0x0883('0xf')](function(_0x275004){var _0x1f7bf0=[];_0x1f7bf0['push']({'name':_0x275004[_0x0883('0xab')][_0x0883('0xac')][_0x0883('0xa7')][_0x0883('0xa8')][_0x0883('0xa7')],'value':_0x0883('0xad')},{'name':_0x275004['OptionSet'][_0x0883('0xae')][_0x0883('0xa7')][_0x0883('0xa8')][_0x0883('0xa7')],'value':_0x0883('0xaf')});var _0x47e6ce={'id':_0x40be35+'_'+_0x275004[_0x0883('0x94')],'name':_0x275004[_0x0883('0xa9')][_0x0883('0xa8')][_0x0883('0xa7')],'custom':![],'options':_0x1f7bf0};_0x141202[_0x0883('0x96')](_0x47e6ce);return _0x141202;});}function getInputList(_0xd69705,_0x21b396,_0x30a068,_0x176277,_0x3a960d,_0x5d3a84,_0x759803){var _0x4f22ec={'method':'GET','uri':_0xd69705+_0x0883('0x90')+_0x3a960d+')/Attributes('+_0x5d3a84+_0x0883('0xb0')+_0x30a068+_0x0883('0xb1'),'headers':{'Authorization':_0x0883('0x8c')+_0x759803,'If-None-Match':null,'OData-Version':_0x0883('0x8d')},'json':!![]};return rp(_0x4f22ec)['then'](function(_0x35b7a1){var _0x47c9dd={'id':_0x21b396+'_'+_0x35b7a1['LogicalName'],'name':_0x35b7a1[_0x0883('0xa9')][_0x0883('0xa8')]?_0x35b7a1[_0x0883('0xa9')]['UserLocalizedLabel']['Label']:_0x35b7a1['LogicalName'],'custom':![],'options':[]};_0x176277['push'](_0x47c9dd);return _0x176277;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 054373e..8b543f7 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x124f2e,_0x1c0f90){var _0x224535=function(_0x14b6b4){while(--_0x14b6b4){_0x124f2e['push'](_0x124f2e['shift']());}};_0x224535(++_0x1c0f90);}(_0xe706,0xa3));var _0x6e70=function(_0x3d7365,_0x13ccfb){_0x3d7365=_0x3d7365-0x0;var _0x3d96ac=_0xe706[_0x3d7365];return _0x3d96ac;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x24b15f,_0x5b6df7){var _0x81ebe4=function(_0x5eb42b){while(--_0x5eb42b){_0x24b15f['push'](_0x24b15f['shift']());}};_0x81ebe4(++_0x5b6df7);}(_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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index fb00e69..72356ea 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 _0xabd6=['error','code','Dynamics365Account,\x20%s,\x20%s','message','result','options','raw','where','attributes','limit','include','model','map','GetDynamics365Account','catch','ShowDynamics365Account','Dynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x580a96,_0x1e8426){var _0x37f9eb=function(_0x246f83){while(--_0x246f83){_0x580a96['push'](_0x580a96['shift']());}};_0x37f9eb(++_0x1e8426);}(_0xabd6,0xde));var _0x6abd=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0xabd6[_0x596f6e];return _0x1e0803;};'use strict';var _=require('lodash');var util=require(_0x6abd('0x0'));var moment=require(_0x6abd('0x1'));var BPromise=require(_0x6abd('0x2'));var rs=require(_0x6abd('0x3'));var fs=require('fs');var Redis=require(_0x6abd('0x4'));var db=require(_0x6abd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6abd('0x6'))('rpc');var config=require(_0x6abd('0x7'));var jayson=require(_0x6abd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6ec1a2,_0xbab6c,_0x3f61e5){return new BPromise(function(_0x4ca8dc,_0x2b8d5e){return client[_0x6abd('0x9')](_0x6ec1a2,_0x3f61e5)[_0x6abd('0xa')](function(_0x1c17d9){logger[_0x6abd('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0xbab6c,_0x6abd('0xc'));logger[_0x6abd('0xd')](_0x6abd('0xe'),_0xbab6c,_0x6abd('0xc'),JSON[_0x6abd('0xf')](_0x1c17d9));if(_0x1c17d9[_0x6abd('0x10')]){if(_0x1c17d9[_0x6abd('0x10')][_0x6abd('0x11')]===0x1f4){logger[_0x6abd('0x10')](_0x6abd('0x12'),_0xbab6c,_0x1c17d9[_0x6abd('0x10')][_0x6abd('0x13')]);return _0x2b8d5e(_0x1c17d9[_0x6abd('0x10')][_0x6abd('0x13')]);}logger[_0x6abd('0x10')](_0x6abd('0x12'),_0xbab6c,_0x1c17d9['error'][_0x6abd('0x13')]);return _0x4ca8dc(_0x1c17d9[_0x6abd('0x10')]['message']);}else{logger[_0x6abd('0xb')](_0x6abd('0x12'),_0xbab6c,_0x6abd('0xc'));_0x4ca8dc(_0x1c17d9[_0x6abd('0x14')][_0x6abd('0x13')]);}})['catch'](function(_0x57707e){logger['error'](_0x6abd('0x12'),_0xbab6c,_0x57707e);_0x2b8d5e(_0x57707e);});});}exports['GetDynamics365Account']=function(_0x24d7a4){var _0x3dea8d=this;return new Promise(function(_0x2ee123,_0x3ed9ca){return db['Dynamics365Account']['findAll']({'raw':_0x24d7a4[_0x6abd('0x15')]?_0x24d7a4[_0x6abd('0x15')][_0x6abd('0x16')]===undefined?!![]:![]:!![],'where':_0x24d7a4[_0x6abd('0x15')]?_0x24d7a4[_0x6abd('0x15')][_0x6abd('0x17')]||null:null,'attributes':_0x24d7a4['options']?_0x24d7a4['options'][_0x6abd('0x18')]||null:null,'limit':_0x24d7a4[_0x6abd('0x15')]?_0x24d7a4['options'][_0x6abd('0x19')]||null:null,'include':_0x24d7a4[_0x6abd('0x15')]?_0x24d7a4['options'][_0x6abd('0x1a')]?_['map'](_0x24d7a4['options'][_0x6abd('0x1a')],function(_0x1fb98a){return{'model':db[_0x1fb98a[_0x6abd('0x1b')]],'as':_0x1fb98a['as'],'attributes':_0x1fb98a['attributes'],'include':_0x1fb98a[_0x6abd('0x1a')]?_[_0x6abd('0x1c')](_0x1fb98a[_0x6abd('0x1a')],function(_0x459eff){return{'model':db[_0x459eff[_0x6abd('0x1b')]],'as':_0x459eff['as'],'attributes':_0x459eff[_0x6abd('0x18')],'include':_0x459eff[_0x6abd('0x1a')]?_[_0x6abd('0x1c')](_0x459eff['include'],function(_0x14e4c9){return{'model':db[_0x14e4c9[_0x6abd('0x1b')]],'as':_0x14e4c9['as'],'attributes':_0x14e4c9[_0x6abd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6abd('0xa')](function(_0x385f63){logger['info'](_0x6abd('0x1d'),_0x24d7a4);logger[_0x6abd('0xd')](_0x6abd('0x1d'),_0x24d7a4,JSON['stringify'](_0x385f63));_0x2ee123(_0x385f63);})[_0x6abd('0x1e')](function(_0x25811d){logger[_0x6abd('0x10')](_0x6abd('0x1d'),_0x25811d['message'],_0x24d7a4);_0x3ed9ca(_0x3dea8d[_0x6abd('0x10')](0x1f4,_0x25811d[_0x6abd('0x13')]));});});};exports[_0x6abd('0x1f')]=function(_0x178cf6){var _0x3c64ec=this;return new Promise(function(_0x27bb86,_0x323bca){return db[_0x6abd('0x20')][_0x6abd('0x21')]({'raw':_0x178cf6['options']?_0x178cf6[_0x6abd('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x178cf6[_0x6abd('0x15')]?_0x178cf6[_0x6abd('0x15')][_0x6abd('0x17')]||null:null,'attributes':_0x178cf6[_0x6abd('0x15')]?_0x178cf6['options']['attributes']||null:null,'include':_0x178cf6[_0x6abd('0x15')]?_0x178cf6[_0x6abd('0x15')][_0x6abd('0x1a')]?_[_0x6abd('0x1c')](_0x178cf6[_0x6abd('0x15')][_0x6abd('0x1a')],function(_0x3c33d1){return{'model':db[_0x3c33d1[_0x6abd('0x1b')]],'as':_0x3c33d1['as'],'attributes':_0x3c33d1[_0x6abd('0x18')],'include':_0x3c33d1[_0x6abd('0x1a')]?_[_0x6abd('0x1c')](_0x3c33d1[_0x6abd('0x1a')],function(_0x13837e){return{'model':db[_0x13837e[_0x6abd('0x1b')]],'as':_0x13837e['as'],'attributes':_0x13837e[_0x6abd('0x18')],'include':_0x13837e[_0x6abd('0x1a')]?_[_0x6abd('0x1c')](_0x13837e['include'],function(_0x206d01){return{'model':db[_0x206d01[_0x6abd('0x1b')]],'as':_0x206d01['as'],'attributes':_0x206d01[_0x6abd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6abd('0xa')](function(_0x322189){logger['info'](_0x6abd('0x1f'),_0x178cf6);logger[_0x6abd('0xd')](_0x6abd('0x1f'),_0x178cf6,JSON['stringify'](_0x322189));_0x27bb86(_0x322189);})['catch'](function(_0x583fa4){logger[_0x6abd('0x10')]('ShowDynamics365Account',_0x583fa4[_0x6abd('0x13')],_0x178cf6);_0x323bca(_0x3c64ec[_0x6abd('0x10')](0x1f4,_0x583fa4['message']));});});}; \ No newline at end of file +var _0x9c8a=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','debug','ShowDynamics365Account','lodash','moment','bluebird','randomstring'];(function(_0x1900a3,_0x5c9e62){var _0x434e6e=function(_0x36ee8e){while(--_0x36ee8e){_0x1900a3['push'](_0x1900a3['shift']());}};_0x434e6e(++_0x5c9e62);}(_0x9c8a,0x78));var _0xa9c8=function(_0x138b09,_0x5ec698){_0x138b09=_0x138b09-0x0;var _0x56733d=_0x9c8a[_0x138b09];return _0x56733d;};'use strict';var _=require(_0xa9c8('0x0'));var util=require('util');var moment=require(_0xa9c8('0x1'));var BPromise=require(_0xa9c8('0x2'));var rs=require(_0xa9c8('0x3'));var fs=require('fs');var Redis=require(_0xa9c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9c8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa9c8('0x6'));var jayson=require(_0xa9c8('0x7'));var client=jayson[_0xa9c8('0x8')][_0xa9c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298dfd,_0x2dc700,_0x83bb75){return new BPromise(function(_0x91e98c,_0x379010){return client['request'](_0x298dfd,_0x83bb75)[_0xa9c8('0xa')](function(_0x242dd1){logger[_0xa9c8('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x2dc700,_0xa9c8('0xc'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2dc700,_0xa9c8('0xc'),JSON[_0xa9c8('0xd')](_0x242dd1));if(_0x242dd1['error']){if(_0x242dd1[_0xa9c8('0xe')][_0xa9c8('0xf')]===0x1f4){logger[_0xa9c8('0xe')](_0xa9c8('0x10'),_0x2dc700,_0x242dd1[_0xa9c8('0xe')][_0xa9c8('0x11')]);return _0x379010(_0x242dd1[_0xa9c8('0xe')][_0xa9c8('0x11')]);}logger[_0xa9c8('0xe')](_0xa9c8('0x10'),_0x2dc700,_0x242dd1[_0xa9c8('0xe')]['message']);return _0x91e98c(_0x242dd1[_0xa9c8('0xe')][_0xa9c8('0x11')]);}else{logger[_0xa9c8('0xb')](_0xa9c8('0x10'),_0x2dc700,_0xa9c8('0xc'));_0x91e98c(_0x242dd1[_0xa9c8('0x12')]['message']);}})[_0xa9c8('0x13')](function(_0x54933a){logger['error'](_0xa9c8('0x10'),_0x2dc700,_0x54933a);_0x379010(_0x54933a);});});}exports['GetDynamics365Account']=function(_0x39ed63){var _0x27ee80=this;return new Promise(function(_0x3d89f2,_0xb25b5a){return db['Dynamics365Account']['findAll']({'raw':_0x39ed63[_0xa9c8('0x14')]?_0x39ed63[_0xa9c8('0x14')][_0xa9c8('0x15')]===undefined?!![]:![]:!![],'where':_0x39ed63[_0xa9c8('0x14')]?_0x39ed63[_0xa9c8('0x14')][_0xa9c8('0x16')]||null:null,'attributes':_0x39ed63[_0xa9c8('0x14')]?_0x39ed63[_0xa9c8('0x14')][_0xa9c8('0x17')]||null:null,'limit':_0x39ed63[_0xa9c8('0x14')]?_0x39ed63[_0xa9c8('0x14')][_0xa9c8('0x18')]||null:null,'include':_0x39ed63[_0xa9c8('0x14')]?_0x39ed63[_0xa9c8('0x14')][_0xa9c8('0x19')]?_[_0xa9c8('0x1a')](_0x39ed63[_0xa9c8('0x14')]['include'],function(_0x4c8de2){return{'model':db[_0x4c8de2[_0xa9c8('0x1b')]],'as':_0x4c8de2['as'],'attributes':_0x4c8de2[_0xa9c8('0x17')],'include':_0x4c8de2[_0xa9c8('0x19')]?_[_0xa9c8('0x1a')](_0x4c8de2['include'],function(_0x2ba558){return{'model':db[_0x2ba558[_0xa9c8('0x1b')]],'as':_0x2ba558['as'],'attributes':_0x2ba558[_0xa9c8('0x17')],'include':_0x2ba558[_0xa9c8('0x19')]?_[_0xa9c8('0x1a')](_0x2ba558['include'],function(_0x1678d3){return{'model':db[_0x1678d3[_0xa9c8('0x1b')]],'as':_0x1678d3['as'],'attributes':_0x1678d3[_0xa9c8('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57c332){logger['info'](_0xa9c8('0x1c'),_0x39ed63);logger[_0xa9c8('0x1d')](_0xa9c8('0x1c'),_0x39ed63,JSON[_0xa9c8('0xd')](_0x57c332));_0x3d89f2(_0x57c332);})[_0xa9c8('0x13')](function(_0x40f2fa){logger[_0xa9c8('0xe')](_0xa9c8('0x1c'),_0x40f2fa[_0xa9c8('0x11')],_0x39ed63);_0xb25b5a(_0x27ee80[_0xa9c8('0xe')](0x1f4,_0x40f2fa[_0xa9c8('0x11')]));});});};exports[_0xa9c8('0x1e')]=function(_0x12fe6b){var _0x44f536=this;return new Promise(function(_0x50af57,_0x393a7d){return db['Dynamics365Account']['find']({'raw':_0x12fe6b[_0xa9c8('0x14')]?_0x12fe6b[_0xa9c8('0x14')][_0xa9c8('0x15')]===undefined?!![]:![]:!![],'where':_0x12fe6b[_0xa9c8('0x14')]?_0x12fe6b[_0xa9c8('0x14')][_0xa9c8('0x16')]||null:null,'attributes':_0x12fe6b[_0xa9c8('0x14')]?_0x12fe6b[_0xa9c8('0x14')][_0xa9c8('0x17')]||null:null,'include':_0x12fe6b[_0xa9c8('0x14')]?_0x12fe6b[_0xa9c8('0x14')][_0xa9c8('0x19')]?_[_0xa9c8('0x1a')](_0x12fe6b[_0xa9c8('0x14')]['include'],function(_0x16e445){return{'model':db[_0x16e445[_0xa9c8('0x1b')]],'as':_0x16e445['as'],'attributes':_0x16e445['attributes'],'include':_0x16e445[_0xa9c8('0x19')]?_[_0xa9c8('0x1a')](_0x16e445[_0xa9c8('0x19')],function(_0x53d487){return{'model':db[_0x53d487[_0xa9c8('0x1b')]],'as':_0x53d487['as'],'attributes':_0x53d487[_0xa9c8('0x17')],'include':_0x53d487['include']?_[_0xa9c8('0x1a')](_0x53d487[_0xa9c8('0x19')],function(_0x1c137){return{'model':db[_0x1c137[_0xa9c8('0x1b')]],'as':_0x1c137['as'],'attributes':_0x1c137['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9c8('0xa')](function(_0x1ecf37){logger[_0xa9c8('0xb')]('ShowDynamics365Account',_0x12fe6b);logger[_0xa9c8('0x1d')]('ShowDynamics365Account',_0x12fe6b,JSON[_0xa9c8('0xd')](_0x1ecf37));_0x50af57(_0x1ecf37);})['catch'](function(_0x41e622){logger[_0xa9c8('0xe')](_0xa9c8('0x1e'),_0x41e622[_0xa9c8('0x11')],_0x12fe6b);_0x393a7d(_0x44f536[_0xa9c8('0xe')](0x1f4,_0x41e622[_0xa9c8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6491b3b..ac3d7f7 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 _0xd3cc=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','show'];(function(_0x6fb570,_0x16944e){var _0x270b7c=function(_0x2d937a){while(--_0x2d937a){_0x6fb570['push'](_0x6fb570['shift']());}};_0x270b7c(++_0x16944e);}(_0xd3cc,0xd4));var _0xcd3c=function(_0x3f62a3,_0x3ef048){_0x3f62a3=_0x3f62a3-0x0;var _0x33b714=_0xd3cc[_0x3f62a3];return _0x33b714;};'use strict';var multer=require(_0xcd3c('0x0'));var util=require(_0xcd3c('0x1'));var path=require(_0xcd3c('0x2'));var timeout=require(_0xcd3c('0x3'));var express=require(_0xcd3c('0x4'));var router=express[_0xcd3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcd3c('0x6'));var interaction=require(_0xcd3c('0x7'));var config=require(_0xcd3c('0x8'));var controller=require(_0xcd3c('0x9'));router[_0xcd3c('0xa')]('/',auth[_0xcd3c('0xb')](),controller['index']);router[_0xcd3c('0xa')]('/:id',auth[_0xcd3c('0xb')](),controller[_0xcd3c('0xc')]);router[_0xcd3c('0xa')](_0xcd3c('0xd'),auth[_0xcd3c('0xb')](),controller[_0xcd3c('0xe')]);router[_0xcd3c('0xa')](_0xcd3c('0xf'),auth['isAuthenticated'](),controller[_0xcd3c('0x10')]);router[_0xcd3c('0xa')](_0xcd3c('0x11'),auth[_0xcd3c('0xb')](),controller['getDescriptions']);router[_0xcd3c('0x12')]('/',auth[_0xcd3c('0xb')](),controller['create']);router[_0xcd3c('0x13')]('/:id',auth[_0xcd3c('0xb')](),controller[_0xcd3c('0x14')]);router[_0xcd3c('0x15')](_0xcd3c('0x16'),auth[_0xcd3c('0xb')](),controller[_0xcd3c('0x17')]);module[_0xcd3c('0x18')]=router; \ No newline at end of file +var _0x48ae=['/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x28dffc,_0x7a3366){var _0xc3c48a=function(_0x43b062){while(--_0x43b062){_0x28dffc['push'](_0x28dffc['shift']());}};_0xc3c48a(++_0x7a3366);}(_0x48ae,0xd2));var _0xe48a=function(_0x3d3025,_0x191566){_0x3d3025=_0x3d3025-0x0;var _0xfb148e=_0x48ae[_0x3d3025];return _0xfb148e;};'use strict';var multer=require(_0xe48a('0x0'));var util=require(_0xe48a('0x1'));var path=require(_0xe48a('0x2'));var timeout=require(_0xe48a('0x3'));var express=require(_0xe48a('0x4'));var router=express[_0xe48a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe48a('0x6'));var interaction=require(_0xe48a('0x7'));var config=require(_0xe48a('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0xe48a('0x9')]('/',auth[_0xe48a('0xa')](),controller[_0xe48a('0xb')]);router[_0xe48a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe48a('0xc')]);router[_0xe48a('0x9')](_0xe48a('0xd'),auth['isAuthenticated'](),controller[_0xe48a('0xe')]);router[_0xe48a('0x9')](_0xe48a('0xf'),auth['isAuthenticated'](),controller[_0xe48a('0x10')]);router['get'](_0xe48a('0x11'),auth[_0xe48a('0xa')](),controller['getDescriptions']);router[_0xe48a('0x12')]('/',auth[_0xe48a('0xa')](),controller[_0xe48a('0x13')]);router[_0xe48a('0x14')](_0xe48a('0x15'),auth['isAuthenticated'](),controller[_0xe48a('0x16')]);router[_0xe48a('0x17')]('/:id',auth[_0xe48a('0xa')](),controller[_0xe48a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 902eb6a..df35d64 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 _0xad4a=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x4c85e4,_0x24d438){var _0x424be6=function(_0x4f9e44){while(--_0x4f9e44){_0x4c85e4['push'](_0x4c85e4['shift']());}};_0x424be6(++_0x24d438);}(_0xad4a,0x135));var _0xaad4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad4a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaad4('0x0'));module['exports']={'name':{'type':Sequelize[_0xaad4('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xaad4('0x2')](_0xaad4('0x3'),_0xaad4('0x4')),'defaultValue':_0xaad4('0x3')},'moduleCreate':{'type':Sequelize[_0xaad4('0x2')](_0xaad4('0x5'),_0xaad4('0x6')),'defaultValue':_0xaad4('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xaad4('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1b6a=['ENUM','incident','contact','nothing','sequelize','exports','STRING'];(function(_0x46aa6f,_0x571a72){var _0x3d4679=function(_0x2bcbbb){while(--_0x2bcbbb){_0x46aa6f['push'](_0x46aa6f['shift']());}};_0x3d4679(++_0x571a72);}(_0x1b6a,0x10e));var _0xa1b6=function(_0x20e295,_0x308599){_0x20e295=_0x20e295-0x0;var _0x33ffbe=_0x1b6a[_0x20e295];return _0x33ffbe;};'use strict';var Sequelize=require(_0xa1b6('0x0'));module[_0xa1b6('0x1')]={'name':{'type':Sequelize[_0xa1b6('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa1b6('0x3')](_0xa1b6('0x4'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xa1b6('0x3')](_0xa1b6('0x5'),_0xa1b6('0x6')),'defaultValue':_0xa1b6('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 20fee07..f44215a 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 _0xf9d3=['status','end','offset','undefined','limit','count','json','apply','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','filters','includeAll','find','create','body','update','getFields','findOne','Dynamics365Field','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xf9d3,0x173));var _0x3f9d=function(_0x44a68c,_0x54876d){_0x44a68c=_0x44a68c-0x0;var _0x4d1728=_0xf9d3[_0x44a68c];return _0x4d1728;};'use strict';var emlformat=require(_0x3f9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f9d('0x1'));var jsonpatch=require(_0x3f9d('0x2'));var rp=require(_0x3f9d('0x3'));var moment=require(_0x3f9d('0x4'));var BPromise=require(_0x3f9d('0x5'));var Mustache=require('mustache');var util=require(_0x3f9d('0x6'));var path=require(_0x3f9d('0x7'));var sox=require(_0x3f9d('0x8'));var csv=require(_0x3f9d('0x9'));var ejs=require(_0x3f9d('0xa'));var fs=require('fs');var fs_extra=require(_0x3f9d('0xb'));var _=require('lodash');var squel=require(_0x3f9d('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f9d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3f9d('0x9'));var querystring=require(_0x3f9d('0xe'));var Papa=require('papaparse');var Redis=require(_0x3f9d('0xf'));var authService=require(_0x3f9d('0x10'));var qs=require(_0x3f9d('0x11'));var as=require(_0x3f9d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f9d('0x13'))(_0x3f9d('0x14'));var utils=require(_0x3f9d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f9d('0x16'))['db'];function respondWithStatusCode(_0x4190f4,_0x235ff0){_0x235ff0=_0x235ff0||0xcc;return function(_0x3da8e9){if(_0x3da8e9){return _0x4190f4[_0x3f9d('0x17')](_0x235ff0);}return _0x4190f4[_0x3f9d('0x18')](_0x235ff0)[_0x3f9d('0x19')]();};}function respondWithResult(_0x26bfb7,_0x41bec5){_0x41bec5=_0x41bec5||0xc8;return function(_0x26da14){if(_0x26da14){return _0x26bfb7[_0x3f9d('0x18')](_0x41bec5)['json'](_0x26da14);}};}function respondWithFilteredResult(_0x25a891,_0x36b004){return function(_0x19515a){if(_0x19515a){var _0x5b409c=typeof _0x36b004[_0x3f9d('0x1a')]===_0x3f9d('0x1b')&&typeof _0x36b004[_0x3f9d('0x1c')]==='undefined';var _0xfa0879=_0x19515a[_0x3f9d('0x1d')];var _0x4ab23e=_0x5b409c?0x0:_0x36b004[_0x3f9d('0x1a')];var _0x12af04=_0x5b409c?_0x19515a[_0x3f9d('0x1d')]:_0x36b004[_0x3f9d('0x1a')]+_0x36b004[_0x3f9d('0x1c')];var _0x33f9f9;if(_0x12af04>=_0xfa0879){_0x12af04=_0xfa0879;_0x33f9f9=0xc8;}else{_0x33f9f9=0xce;}_0x25a891[_0x3f9d('0x18')](_0x33f9f9);return _0x25a891['set']('Content-Range',_0x4ab23e+'-'+_0x12af04+'/'+_0xfa0879)[_0x3f9d('0x1e')](_0x19515a);}return null;};}function patchUpdates(_0x3c9745){return function(_0x2e0d6d){try{jsonpatch[_0x3f9d('0x1f')](_0x2e0d6d,_0x3c9745,!![]);}catch(_0x1c6c24){return BPromise['reject'](_0x1c6c24);}return _0x2e0d6d['save']();};}function saveUpdates(_0x3e353d,_0xb85bde){return function(_0x29c444){if(_0x29c444){return _0x29c444['update'](_0x3e353d)[_0x3f9d('0x20')](function(_0x1c211b){return _0x1c211b;});}return null;};}function removeEntity(_0x2731b3,_0x114eff){return function(_0x4e7e36){if(_0x4e7e36){return _0x4e7e36[_0x3f9d('0x21')]()['then'](function(){_0x2731b3[_0x3f9d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1322,_0x3dd83f){return function(_0xe67615){if(!_0xe67615){_0x1f1322[_0x3f9d('0x17')](0x194);}return _0xe67615;};}function handleError(_0xd8ce72,_0x1f5aee){_0x1f5aee=_0x1f5aee||0x1f4;return function(_0x45dac9){logger[_0x3f9d('0x22')](_0x45dac9[_0x3f9d('0x23')]);if(_0x45dac9['name']){delete _0x45dac9[_0x3f9d('0x24')];}_0xd8ce72['status'](_0x1f5aee)[_0x3f9d('0x25')](_0x45dac9);};}exports[_0x3f9d('0x26')]=function(_0x22dd8f,_0x2a3afb){var _0x31e854={},_0x59e2de={},_0x34519f={'count':0x0,'rows':[]};var _0x5b61e4=_[_0x3f9d('0x27')](db[_0x3f9d('0x28')][_0x3f9d('0x29')],function(_0x45cd5f){return{'name':_0x45cd5f[_0x3f9d('0x2a')],'type':_0x45cd5f['type'][_0x3f9d('0x2b')]};});_0x59e2de['model']=_['map'](_0x5b61e4,_0x3f9d('0x24'));_0x59e2de[_0x3f9d('0x2c')]=_['keys'](_0x22dd8f['query']);_0x59e2de['filters']=_[_0x3f9d('0x2d')](_0x59e2de[_0x3f9d('0x2e')],_0x59e2de[_0x3f9d('0x2c')]);_0x31e854[_0x3f9d('0x2f')]=_[_0x3f9d('0x2d')](_0x59e2de[_0x3f9d('0x2e')],qs['fields'](_0x22dd8f['query'][_0x3f9d('0x30')]));_0x31e854[_0x3f9d('0x2f')]=_0x31e854[_0x3f9d('0x2f')][_0x3f9d('0x31')]?_0x31e854[_0x3f9d('0x2f')]:_0x59e2de[_0x3f9d('0x2e')];if(!_0x22dd8f['query']['hasOwnProperty'](_0x3f9d('0x32'))){_0x31e854[_0x3f9d('0x1c')]=qs[_0x3f9d('0x1c')](_0x22dd8f[_0x3f9d('0x2c')][_0x3f9d('0x1c')]);_0x31e854[_0x3f9d('0x1a')]=qs[_0x3f9d('0x1a')](_0x22dd8f[_0x3f9d('0x2c')][_0x3f9d('0x1a')]);}_0x31e854[_0x3f9d('0x33')]=qs['sort'](_0x22dd8f[_0x3f9d('0x2c')][_0x3f9d('0x34')]);_0x31e854[_0x3f9d('0x35')]=qs['filters'](_['pick'](_0x22dd8f[_0x3f9d('0x2c')],_0x59e2de['filters']),_0x5b61e4);if(_0x22dd8f[_0x3f9d('0x2c')][_0x3f9d('0x36')]){_0x31e854[_0x3f9d('0x35')]=_[_0x3f9d('0x37')](_0x31e854['where'],{'$or':_[_0x3f9d('0x27')](_0x5b61e4,function(_0x4832f4){if(_0x4832f4[_0x3f9d('0x38')]!==_0x3f9d('0x39')){var _0x31750f={};_0x31750f[_0x4832f4['name']]={'$like':'%'+_0x22dd8f[_0x3f9d('0x2c')][_0x3f9d('0x36')]+'%'};return _0x31750f;}})});}_0x31e854=_[_0x3f9d('0x37')]({},_0x31e854,_0x22dd8f[_0x3f9d('0x3a')]);var _0x115435={'where':_0x31e854['where']};return db[_0x3f9d('0x28')]['count'](_0x115435)[_0x3f9d('0x20')](function(_0x4d6e15){_0x34519f['count']=_0x4d6e15;if(_0x22dd8f[_0x3f9d('0x2c')]['includeAll']){_0x31e854[_0x3f9d('0x3b')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x3f9d('0x3c')](_0x31e854);})[_0x3f9d('0x20')](function(_0x169a41){_0x34519f[_0x3f9d('0x3d')]=_0x169a41;return _0x34519f;})[_0x3f9d('0x20')](respondWithFilteredResult(_0x2a3afb,_0x31e854))[_0x3f9d('0x3e')](handleError(_0x2a3afb,null));};exports[_0x3f9d('0x3f')]=function(_0x419f08,_0x21d556){var _0x4c77c6={'raw':![],'where':{'id':_0x419f08[_0x3f9d('0x40')]['id']}},_0x516c6b={};_0x516c6b['model']=_[_0x3f9d('0x41')](db[_0x3f9d('0x28')][_0x3f9d('0x29')]);_0x516c6b[_0x3f9d('0x2c')]=_[_0x3f9d('0x41')](_0x419f08[_0x3f9d('0x2c')]);_0x516c6b[_0x3f9d('0x42')]=_['intersection'](_0x516c6b['model'],_0x516c6b['query']);_0x4c77c6[_0x3f9d('0x2f')]=_['intersection'](_0x516c6b[_0x3f9d('0x2e')],qs[_0x3f9d('0x30')](_0x419f08[_0x3f9d('0x2c')][_0x3f9d('0x30')]));_0x4c77c6[_0x3f9d('0x2f')]=_0x4c77c6[_0x3f9d('0x2f')]['length']?_0x4c77c6[_0x3f9d('0x2f')]:_0x516c6b[_0x3f9d('0x2e')];if(_0x419f08['query'][_0x3f9d('0x43')]){_0x4c77c6['include']=[{'all':!![]}];}_0x4c77c6=_[_0x3f9d('0x37')]({},_0x4c77c6,_0x419f08['options']);return db['Dynamics365Configuration'][_0x3f9d('0x44')](_0x4c77c6)[_0x3f9d('0x20')](handleEntityNotFound(_0x21d556,null))[_0x3f9d('0x20')](respondWithResult(_0x21d556,null))[_0x3f9d('0x3e')](handleError(_0x21d556,null));};exports[_0x3f9d('0x45')]=function(_0x266fd2,_0x12e5e3){return db[_0x3f9d('0x28')][_0x3f9d('0x45')](_0x266fd2[_0x3f9d('0x46')],{})[_0x3f9d('0x20')](respondWithResult(_0x12e5e3,0xc9))[_0x3f9d('0x3e')](handleError(_0x12e5e3,null));};exports[_0x3f9d('0x47')]=function(_0x27b5b2,_0x20f513){if(_0x27b5b2[_0x3f9d('0x46')]['id']){delete _0x27b5b2[_0x3f9d('0x46')]['id'];}return db[_0x3f9d('0x28')]['find']({'where':{'id':_0x27b5b2[_0x3f9d('0x40')]['id']}})[_0x3f9d('0x20')](handleEntityNotFound(_0x20f513,null))[_0x3f9d('0x20')](saveUpdates(_0x27b5b2[_0x3f9d('0x46')],null))[_0x3f9d('0x20')](respondWithResult(_0x20f513,null))[_0x3f9d('0x3e')](handleError(_0x20f513,null));};exports['destroy']=function(_0x8f00af,_0xa8caea){return db[_0x3f9d('0x28')][_0x3f9d('0x44')]({'where':{'id':_0x8f00af['params']['id']}})[_0x3f9d('0x20')](handleEntityNotFound(_0xa8caea,null))['then'](removeEntity(_0xa8caea,null))[_0x3f9d('0x3e')](handleError(_0xa8caea,null));};exports[_0x3f9d('0x48')]=function(_0x226cad,_0x3ea032,_0x1de8e4){var _0x24ec53={};var _0x534e15={};var _0x3598f4;var _0x48c45f;return db[_0x3f9d('0x28')][_0x3f9d('0x49')]({'where':{'id':_0x226cad[_0x3f9d('0x40')]['id']}})[_0x3f9d('0x20')](handleEntityNotFound(_0x3ea032,null))[_0x3f9d('0x20')](function(_0x3f74ef){if(_0x3f74ef){_0x3598f4=_0x3f74ef;_0x534e15[_0x3f9d('0x2e')]=_[_0x3f9d('0x41')](db[_0x3f9d('0x4a')][_0x3f9d('0x29')]);_0x534e15[_0x3f9d('0x2c')]=_[_0x3f9d('0x41')](_0x226cad[_0x3f9d('0x2c')]);_0x534e15['filters']=_[_0x3f9d('0x2d')](_0x534e15['model'],_0x534e15[_0x3f9d('0x2c')]);_0x24ec53[_0x3f9d('0x2f')]=_['intersection'](_0x534e15[_0x3f9d('0x2e')],qs[_0x3f9d('0x30')](_0x226cad[_0x3f9d('0x2c')][_0x3f9d('0x30')]));_0x24ec53[_0x3f9d('0x2f')]=_0x24ec53[_0x3f9d('0x2f')][_0x3f9d('0x31')]?_0x24ec53[_0x3f9d('0x2f')]:_0x534e15['model'];_0x24ec53[_0x3f9d('0x33')]=qs[_0x3f9d('0x34')](_0x226cad[_0x3f9d('0x2c')][_0x3f9d('0x34')]);_0x24ec53[_0x3f9d('0x35')]=qs['filters'](_[_0x3f9d('0x4b')](_0x226cad[_0x3f9d('0x2c')],_0x534e15[_0x3f9d('0x42')]));if(_0x226cad[_0x3f9d('0x2c')][_0x3f9d('0x36')]){_0x24ec53[_0x3f9d('0x35')]=_[_0x3f9d('0x37')](_0x24ec53[_0x3f9d('0x35')],{'$or':_['map'](_0x24ec53[_0x3f9d('0x2f')],function(_0x1ce12e){var _0x1d30b4={};_0x1d30b4[_0x1ce12e]={'$like':'%'+_0x226cad[_0x3f9d('0x2c')][_0x3f9d('0x36')]+'%'};return _0x1d30b4;})});}_0x24ec53=_[_0x3f9d('0x37')]({},_0x24ec53,_0x226cad[_0x3f9d('0x3a')]);return _0x3598f4[_0x3f9d('0x48')](_0x24ec53);}})[_0x3f9d('0x20')](function(_0x328c18){if(_0x328c18){_0x48c45f=_0x328c18[_0x3f9d('0x31')];if(!_0x226cad[_0x3f9d('0x2c')][_0x3f9d('0x4c')](_0x3f9d('0x32'))){_0x24ec53[_0x3f9d('0x1c')]=qs['limit'](_0x226cad[_0x3f9d('0x2c')][_0x3f9d('0x1c')]);_0x24ec53[_0x3f9d('0x1a')]=qs['offset'](_0x226cad[_0x3f9d('0x2c')]['offset']);}return _0x3598f4['getFields'](_0x24ec53);}})[_0x3f9d('0x20')](function(_0x565095){if(_0x565095){return _0x565095?{'count':_0x48c45f,'rows':_0x565095}:null;}})[_0x3f9d('0x20')](respondWithResult(_0x3ea032,null))[_0x3f9d('0x3e')](handleError(_0x3ea032,null));};exports['getSubjects']=function(_0x2bf14e,_0x3b66ca,_0x5bdc41){var _0x2abc18={};var _0x50e37b={};var _0x3fc9bb;var _0x1aeb0f;return db['Dynamics365Configuration'][_0x3f9d('0x49')]({'where':{'id':_0x2bf14e['params']['id']}})['then'](handleEntityNotFound(_0x3b66ca,null))[_0x3f9d('0x20')](function(_0x36d89c){if(_0x36d89c){_0x3fc9bb=_0x36d89c;_0x50e37b['model']=_[_0x3f9d('0x41')](db['Dynamics365Field']['rawAttributes']);_0x50e37b[_0x3f9d('0x2c')]=_[_0x3f9d('0x41')](_0x2bf14e[_0x3f9d('0x2c')]);_0x50e37b[_0x3f9d('0x42')]=_['intersection'](_0x50e37b[_0x3f9d('0x2e')],_0x50e37b[_0x3f9d('0x2c')]);_0x2abc18[_0x3f9d('0x2f')]=_[_0x3f9d('0x2d')](_0x50e37b[_0x3f9d('0x2e')],qs['fields'](_0x2bf14e[_0x3f9d('0x2c')][_0x3f9d('0x30')]));_0x2abc18[_0x3f9d('0x2f')]=_0x2abc18[_0x3f9d('0x2f')][_0x3f9d('0x31')]?_0x2abc18[_0x3f9d('0x2f')]:_0x50e37b[_0x3f9d('0x2e')];_0x2abc18['order']=qs[_0x3f9d('0x34')](_0x2bf14e[_0x3f9d('0x2c')][_0x3f9d('0x34')]);_0x2abc18[_0x3f9d('0x35')]=qs[_0x3f9d('0x42')](_[_0x3f9d('0x4b')](_0x2bf14e[_0x3f9d('0x2c')],_0x50e37b[_0x3f9d('0x42')]));if(_0x2bf14e[_0x3f9d('0x2c')][_0x3f9d('0x36')]){_0x2abc18['where']=_['merge'](_0x2abc18['where'],{'$or':_['map'](_0x2abc18[_0x3f9d('0x2f')],function(_0x369dd6){var _0x5dfa99={};_0x5dfa99[_0x369dd6]={'$like':'%'+_0x2bf14e[_0x3f9d('0x2c')][_0x3f9d('0x36')]+'%'};return _0x5dfa99;})});}_0x2abc18=_['merge']({},_0x2abc18,_0x2bf14e['options']);return _0x3fc9bb[_0x3f9d('0x4d')](_0x2abc18);}})[_0x3f9d('0x20')](function(_0x56b283){if(_0x56b283){_0x1aeb0f=_0x56b283[_0x3f9d('0x31')];if(!_0x2bf14e[_0x3f9d('0x2c')][_0x3f9d('0x4c')](_0x3f9d('0x32'))){_0x2abc18['limit']=qs[_0x3f9d('0x1c')](_0x2bf14e['query'][_0x3f9d('0x1c')]);_0x2abc18['offset']=qs[_0x3f9d('0x1a')](_0x2bf14e[_0x3f9d('0x2c')]['offset']);}return _0x3fc9bb[_0x3f9d('0x4d')](_0x2abc18);}})[_0x3f9d('0x20')](function(_0x58dd87){if(_0x58dd87){return _0x58dd87?{'count':_0x1aeb0f,'rows':_0x58dd87}:null;}})[_0x3f9d('0x20')](respondWithResult(_0x3b66ca,null))[_0x3f9d('0x3e')](handleError(_0x3b66ca,null));};exports[_0x3f9d('0x4e')]=function(_0x2980a0,_0x43d61f,_0x32177e){var _0x71d55d={};var _0x5542d0={};var _0x4713e8;var _0xac7839;return db[_0x3f9d('0x28')][_0x3f9d('0x49')]({'where':{'id':_0x2980a0[_0x3f9d('0x40')]['id']}})['then'](handleEntityNotFound(_0x43d61f,null))[_0x3f9d('0x20')](function(_0x1c1e1c){if(_0x1c1e1c){_0x4713e8=_0x1c1e1c;_0x5542d0[_0x3f9d('0x2e')]=_[_0x3f9d('0x41')](db[_0x3f9d('0x4a')][_0x3f9d('0x29')]);_0x5542d0['query']=_[_0x3f9d('0x41')](_0x2980a0[_0x3f9d('0x2c')]);_0x5542d0[_0x3f9d('0x42')]=_['intersection'](_0x5542d0[_0x3f9d('0x2e')],_0x5542d0[_0x3f9d('0x2c')]);_0x71d55d['attributes']=_['intersection'](_0x5542d0['model'],qs['fields'](_0x2980a0[_0x3f9d('0x2c')][_0x3f9d('0x30')]));_0x71d55d['attributes']=_0x71d55d[_0x3f9d('0x2f')][_0x3f9d('0x31')]?_0x71d55d[_0x3f9d('0x2f')]:_0x5542d0[_0x3f9d('0x2e')];_0x71d55d[_0x3f9d('0x33')]=qs[_0x3f9d('0x34')](_0x2980a0[_0x3f9d('0x2c')]['sort']);_0x71d55d[_0x3f9d('0x35')]=qs[_0x3f9d('0x42')](_[_0x3f9d('0x4b')](_0x2980a0[_0x3f9d('0x2c')],_0x5542d0[_0x3f9d('0x42')]));if(_0x2980a0[_0x3f9d('0x2c')][_0x3f9d('0x36')]){_0x71d55d[_0x3f9d('0x35')]=_[_0x3f9d('0x37')](_0x71d55d[_0x3f9d('0x35')],{'$or':_[_0x3f9d('0x27')](_0x71d55d[_0x3f9d('0x2f')],function(_0x102bb5){var _0x637b41={};_0x637b41[_0x102bb5]={'$like':'%'+_0x2980a0['query'][_0x3f9d('0x36')]+'%'};return _0x637b41;})});}_0x71d55d=_[_0x3f9d('0x37')]({},_0x71d55d,_0x2980a0[_0x3f9d('0x3a')]);return _0x4713e8[_0x3f9d('0x4e')](_0x71d55d);}})[_0x3f9d('0x20')](function(_0x54842f){if(_0x54842f){_0xac7839=_0x54842f[_0x3f9d('0x31')];if(!_0x2980a0[_0x3f9d('0x2c')][_0x3f9d('0x4c')](_0x3f9d('0x32'))){_0x71d55d[_0x3f9d('0x1c')]=qs[_0x3f9d('0x1c')](_0x2980a0[_0x3f9d('0x2c')][_0x3f9d('0x1c')]);_0x71d55d[_0x3f9d('0x1a')]=qs['offset'](_0x2980a0['query'][_0x3f9d('0x1a')]);}return _0x4713e8[_0x3f9d('0x4e')](_0x71d55d);}})[_0x3f9d('0x20')](function(_0x48b177){if(_0x48b177){return _0x48b177?{'count':_0xac7839,'rows':_0x48b177}:null;}})['then'](respondWithResult(_0x43d61f,null))[_0x3f9d('0x3e')](handleError(_0x43d61f,null));}; \ No newline at end of file +var _0x7e0f=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','getFields','findOne','Dynamics365Field','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x1ac542,_0xd599d7){var _0x4a865b=function(_0x445b16){while(--_0x445b16){_0x1ac542['push'](_0x1ac542['shift']());}};_0x4a865b(++_0xd599d7);}(_0x7e0f,0x19a));var _0xf7e0=function(_0x4e1852,_0x11988f){_0x4e1852=_0x4e1852-0x0;var _0x1dc35f=_0x7e0f[_0x4e1852];return _0x1dc35f;};'use strict';var emlformat=require(_0xf7e0('0x0'));var rimraf=require(_0xf7e0('0x1'));var zipdir=require(_0xf7e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7e0('0x3'));var moment=require(_0xf7e0('0x4'));var BPromise=require(_0xf7e0('0x5'));var Mustache=require(_0xf7e0('0x6'));var util=require(_0xf7e0('0x7'));var path=require(_0xf7e0('0x8'));var sox=require(_0xf7e0('0x9'));var csv=require(_0xf7e0('0xa'));var ejs=require(_0xf7e0('0xb'));var fs=require('fs');var fs_extra=require(_0xf7e0('0xc'));var _=require(_0xf7e0('0xd'));var squel=require(_0xf7e0('0xe'));var crypto=require(_0xf7e0('0xf'));var jsforce=require(_0xf7e0('0x10'));var deskjs=require(_0xf7e0('0x11'));var toCsv=require(_0xf7e0('0xa'));var querystring=require(_0xf7e0('0x12'));var Papa=require(_0xf7e0('0x13'));var Redis=require(_0xf7e0('0x14'));var authService=require(_0xf7e0('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7e0('0x16'));var logger=require(_0xf7e0('0x17'))(_0xf7e0('0x18'));var utils=require(_0xf7e0('0x19'));var config=require(_0xf7e0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8aaf13,_0x4ebdd8){_0x4ebdd8=_0x4ebdd8||0xcc;return function(_0x54b6c0){if(_0x54b6c0){return _0x8aaf13[_0xf7e0('0x1b')](_0x4ebdd8);}return _0x8aaf13[_0xf7e0('0x1c')](_0x4ebdd8)[_0xf7e0('0x1d')]();};}function respondWithResult(_0x5b4df4,_0x5a35b5){_0x5a35b5=_0x5a35b5||0xc8;return function(_0xd794d3){if(_0xd794d3){return _0x5b4df4[_0xf7e0('0x1c')](_0x5a35b5)[_0xf7e0('0x1e')](_0xd794d3);}};}function respondWithFilteredResult(_0x387b34,_0x24c4e7){return function(_0x3351cb){if(_0x3351cb){var _0x5b25d6=typeof _0x24c4e7[_0xf7e0('0x1f')]==='undefined'&&typeof _0x24c4e7['limit']==='undefined';var _0x5068da=_0x3351cb[_0xf7e0('0x20')];var _0x12009f=_0x5b25d6?0x0:_0x24c4e7[_0xf7e0('0x1f')];var _0x4c40d7=_0x5b25d6?_0x3351cb['count']:_0x24c4e7[_0xf7e0('0x1f')]+_0x24c4e7['limit'];var _0x435cc2;if(_0x4c40d7>=_0x5068da){_0x4c40d7=_0x5068da;_0x435cc2=0xc8;}else{_0x435cc2=0xce;}_0x387b34['status'](_0x435cc2);return _0x387b34[_0xf7e0('0x21')](_0xf7e0('0x22'),_0x12009f+'-'+_0x4c40d7+'/'+_0x5068da)['json'](_0x3351cb);}return null;};}function patchUpdates(_0xdf4fc){return function(_0x31b722){try{jsonpatch[_0xf7e0('0x23')](_0x31b722,_0xdf4fc,!![]);}catch(_0x2dcc5f){return BPromise[_0xf7e0('0x24')](_0x2dcc5f);}return _0x31b722[_0xf7e0('0x25')]();};}function saveUpdates(_0x401c4d,_0x2283db){return function(_0x1c379c){if(_0x1c379c){return _0x1c379c['update'](_0x401c4d)[_0xf7e0('0x26')](function(_0x5c896a){return _0x5c896a;});}return null;};}function removeEntity(_0x221fa9,_0x2a0437){return function(_0x876d0c){if(_0x876d0c){return _0x876d0c[_0xf7e0('0x27')]()[_0xf7e0('0x26')](function(){_0x221fa9[_0xf7e0('0x1c')](0xcc)[_0xf7e0('0x1d')]();});}};}function handleEntityNotFound(_0x548e33,_0x4cf5e5){return function(_0x317fe9){if(!_0x317fe9){_0x548e33[_0xf7e0('0x1b')](0x194);}return _0x317fe9;};}function handleError(_0x1a7287,_0x28dad4){_0x28dad4=_0x28dad4||0x1f4;return function(_0x2894a4){logger['error'](_0x2894a4[_0xf7e0('0x28')]);if(_0x2894a4['name']){delete _0x2894a4[_0xf7e0('0x29')];}_0x1a7287[_0xf7e0('0x1c')](_0x28dad4)[_0xf7e0('0x2a')](_0x2894a4);};}exports['index']=function(_0x5cd5fc,_0x36b214){var _0x3cefdb={},_0x3fb5ee={},_0x3e27dd={'count':0x0,'rows':[]};var _0x4ebc4a=_[_0xf7e0('0x2b')](db[_0xf7e0('0x2c')][_0xf7e0('0x2d')],function(_0x5555c9){return{'name':_0x5555c9['fieldName'],'type':_0x5555c9[_0xf7e0('0x2e')][_0xf7e0('0x2f')]};});_0x3fb5ee[_0xf7e0('0x30')]=_[_0xf7e0('0x2b')](_0x4ebc4a,_0xf7e0('0x29'));_0x3fb5ee[_0xf7e0('0x31')]=_[_0xf7e0('0x32')](_0x5cd5fc['query']);_0x3fb5ee[_0xf7e0('0x33')]=_['intersection'](_0x3fb5ee[_0xf7e0('0x30')],_0x3fb5ee[_0xf7e0('0x31')]);_0x3cefdb[_0xf7e0('0x34')]=_[_0xf7e0('0x35')](_0x3fb5ee[_0xf7e0('0x30')],qs[_0xf7e0('0x36')](_0x5cd5fc[_0xf7e0('0x31')][_0xf7e0('0x36')]));_0x3cefdb[_0xf7e0('0x34')]=_0x3cefdb[_0xf7e0('0x34')][_0xf7e0('0x37')]?_0x3cefdb[_0xf7e0('0x34')]:_0x3fb5ee[_0xf7e0('0x30')];if(!_0x5cd5fc['query'][_0xf7e0('0x38')](_0xf7e0('0x39'))){_0x3cefdb[_0xf7e0('0x3a')]=qs['limit'](_0x5cd5fc[_0xf7e0('0x31')][_0xf7e0('0x3a')]);_0x3cefdb['offset']=qs['offset'](_0x5cd5fc[_0xf7e0('0x31')][_0xf7e0('0x1f')]);}_0x3cefdb[_0xf7e0('0x3b')]=qs[_0xf7e0('0x3c')](_0x5cd5fc[_0xf7e0('0x31')][_0xf7e0('0x3c')]);_0x3cefdb['where']=qs[_0xf7e0('0x33')](_[_0xf7e0('0x3d')](_0x5cd5fc['query'],_0x3fb5ee[_0xf7e0('0x33')]),_0x4ebc4a);if(_0x5cd5fc[_0xf7e0('0x31')][_0xf7e0('0x3e')]){_0x3cefdb['where']=_[_0xf7e0('0x3f')](_0x3cefdb[_0xf7e0('0x40')],{'$or':_[_0xf7e0('0x2b')](_0x4ebc4a,function(_0x1fe674){if(_0x1fe674[_0xf7e0('0x2e')]!==_0xf7e0('0x41')){var _0x7c4f35={};_0x7c4f35[_0x1fe674[_0xf7e0('0x29')]]={'$like':'%'+_0x5cd5fc[_0xf7e0('0x31')][_0xf7e0('0x3e')]+'%'};return _0x7c4f35;}})});}_0x3cefdb=_[_0xf7e0('0x3f')]({},_0x3cefdb,_0x5cd5fc['options']);var _0x4c6fe9={'where':_0x3cefdb[_0xf7e0('0x40')]};return db[_0xf7e0('0x2c')][_0xf7e0('0x20')](_0x4c6fe9)[_0xf7e0('0x26')](function(_0x210e07){_0x3e27dd[_0xf7e0('0x20')]=_0x210e07;if(_0x5cd5fc[_0xf7e0('0x31')][_0xf7e0('0x42')]){_0x3cefdb['include']=[{'all':!![]}];}return db[_0xf7e0('0x2c')][_0xf7e0('0x43')](_0x3cefdb);})[_0xf7e0('0x26')](function(_0x1e8b72){_0x3e27dd[_0xf7e0('0x44')]=_0x1e8b72;return _0x3e27dd;})[_0xf7e0('0x26')](respondWithFilteredResult(_0x36b214,_0x3cefdb))[_0xf7e0('0x45')](handleError(_0x36b214,null));};exports[_0xf7e0('0x46')]=function(_0x1ab176,_0x2b8237){var _0x40056c={'raw':![],'where':{'id':_0x1ab176[_0xf7e0('0x47')]['id']}},_0x545f4d={};_0x545f4d[_0xf7e0('0x30')]=_[_0xf7e0('0x32')](db[_0xf7e0('0x2c')]['rawAttributes']);_0x545f4d[_0xf7e0('0x31')]=_[_0xf7e0('0x32')](_0x1ab176[_0xf7e0('0x31')]);_0x545f4d[_0xf7e0('0x33')]=_[_0xf7e0('0x35')](_0x545f4d[_0xf7e0('0x30')],_0x545f4d['query']);_0x40056c[_0xf7e0('0x34')]=_[_0xf7e0('0x35')](_0x545f4d[_0xf7e0('0x30')],qs['fields'](_0x1ab176[_0xf7e0('0x31')][_0xf7e0('0x36')]));_0x40056c[_0xf7e0('0x34')]=_0x40056c[_0xf7e0('0x34')]['length']?_0x40056c[_0xf7e0('0x34')]:_0x545f4d[_0xf7e0('0x30')];if(_0x1ab176['query'][_0xf7e0('0x42')]){_0x40056c[_0xf7e0('0x48')]=[{'all':!![]}];}_0x40056c=_[_0xf7e0('0x3f')]({},_0x40056c,_0x1ab176['options']);return db[_0xf7e0('0x2c')][_0xf7e0('0x49')](_0x40056c)[_0xf7e0('0x26')](handleEntityNotFound(_0x2b8237,null))[_0xf7e0('0x26')](respondWithResult(_0x2b8237,null))[_0xf7e0('0x45')](handleError(_0x2b8237,null));};exports[_0xf7e0('0x4a')]=function(_0x120b1d,_0xae31b1){return db[_0xf7e0('0x2c')][_0xf7e0('0x4a')](_0x120b1d[_0xf7e0('0x4b')],{})[_0xf7e0('0x26')](respondWithResult(_0xae31b1,0xc9))[_0xf7e0('0x45')](handleError(_0xae31b1,null));};exports[_0xf7e0('0x4c')]=function(_0x120e43,_0x713a70){if(_0x120e43[_0xf7e0('0x4b')]['id']){delete _0x120e43[_0xf7e0('0x4b')]['id'];}return db[_0xf7e0('0x2c')][_0xf7e0('0x49')]({'where':{'id':_0x120e43[_0xf7e0('0x47')]['id']}})[_0xf7e0('0x26')](handleEntityNotFound(_0x713a70,null))['then'](saveUpdates(_0x120e43['body'],null))[_0xf7e0('0x26')](respondWithResult(_0x713a70,null))[_0xf7e0('0x45')](handleError(_0x713a70,null));};exports[_0xf7e0('0x27')]=function(_0x39b55d,_0x13d785){return db[_0xf7e0('0x2c')][_0xf7e0('0x49')]({'where':{'id':_0x39b55d[_0xf7e0('0x47')]['id']}})[_0xf7e0('0x26')](handleEntityNotFound(_0x13d785,null))['then'](removeEntity(_0x13d785,null))['catch'](handleError(_0x13d785,null));};exports[_0xf7e0('0x4d')]=function(_0x1fd6d5,_0x3737d0,_0x1a7070){var _0x393413={};var _0x117c14={};var _0x161876;var _0x2a1b46;return db[_0xf7e0('0x2c')][_0xf7e0('0x4e')]({'where':{'id':_0x1fd6d5[_0xf7e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x3737d0,null))['then'](function(_0x2b1f80){if(_0x2b1f80){_0x161876=_0x2b1f80;_0x117c14['model']=_[_0xf7e0('0x32')](db[_0xf7e0('0x4f')][_0xf7e0('0x2d')]);_0x117c14[_0xf7e0('0x31')]=_[_0xf7e0('0x32')](_0x1fd6d5['query']);_0x117c14[_0xf7e0('0x33')]=_[_0xf7e0('0x35')](_0x117c14[_0xf7e0('0x30')],_0x117c14[_0xf7e0('0x31')]);_0x393413[_0xf7e0('0x34')]=_[_0xf7e0('0x35')](_0x117c14[_0xf7e0('0x30')],qs['fields'](_0x1fd6d5[_0xf7e0('0x31')][_0xf7e0('0x36')]));_0x393413[_0xf7e0('0x34')]=_0x393413['attributes'][_0xf7e0('0x37')]?_0x393413[_0xf7e0('0x34')]:_0x117c14['model'];_0x393413[_0xf7e0('0x3b')]=qs[_0xf7e0('0x3c')](_0x1fd6d5['query']['sort']);_0x393413[_0xf7e0('0x40')]=qs['filters'](_['pick'](_0x1fd6d5['query'],_0x117c14['filters']));if(_0x1fd6d5[_0xf7e0('0x31')][_0xf7e0('0x3e')]){_0x393413[_0xf7e0('0x40')]=_['merge'](_0x393413[_0xf7e0('0x40')],{'$or':_[_0xf7e0('0x2b')](_0x393413[_0xf7e0('0x34')],function(_0x13332a){var _0x29a614={};_0x29a614[_0x13332a]={'$like':'%'+_0x1fd6d5[_0xf7e0('0x31')]['filter']+'%'};return _0x29a614;})});}_0x393413=_[_0xf7e0('0x3f')]({},_0x393413,_0x1fd6d5[_0xf7e0('0x50')]);return _0x161876[_0xf7e0('0x4d')](_0x393413);}})[_0xf7e0('0x26')](function(_0x16dd17){if(_0x16dd17){_0x2a1b46=_0x16dd17['length'];if(!_0x1fd6d5[_0xf7e0('0x31')][_0xf7e0('0x38')](_0xf7e0('0x39'))){_0x393413['limit']=qs[_0xf7e0('0x3a')](_0x1fd6d5[_0xf7e0('0x31')]['limit']);_0x393413['offset']=qs['offset'](_0x1fd6d5[_0xf7e0('0x31')][_0xf7e0('0x1f')]);}return _0x161876[_0xf7e0('0x4d')](_0x393413);}})[_0xf7e0('0x26')](function(_0x2c37c8){if(_0x2c37c8){return _0x2c37c8?{'count':_0x2a1b46,'rows':_0x2c37c8}:null;}})[_0xf7e0('0x26')](respondWithResult(_0x3737d0,null))[_0xf7e0('0x45')](handleError(_0x3737d0,null));};exports[_0xf7e0('0x51')]=function(_0x37e388,_0x3f403e,_0x509f22){var _0x3e623b={};var _0x52d751={};var _0x1c6878;var _0x1b9b16;return db[_0xf7e0('0x2c')][_0xf7e0('0x4e')]({'where':{'id':_0x37e388[_0xf7e0('0x47')]['id']}})[_0xf7e0('0x26')](handleEntityNotFound(_0x3f403e,null))[_0xf7e0('0x26')](function(_0x2b8fbf){if(_0x2b8fbf){_0x1c6878=_0x2b8fbf;_0x52d751[_0xf7e0('0x30')]=_[_0xf7e0('0x32')](db[_0xf7e0('0x4f')][_0xf7e0('0x2d')]);_0x52d751[_0xf7e0('0x31')]=_['keys'](_0x37e388[_0xf7e0('0x31')]);_0x52d751['filters']=_[_0xf7e0('0x35')](_0x52d751[_0xf7e0('0x30')],_0x52d751['query']);_0x3e623b[_0xf7e0('0x34')]=_[_0xf7e0('0x35')](_0x52d751['model'],qs[_0xf7e0('0x36')](_0x37e388[_0xf7e0('0x31')][_0xf7e0('0x36')]));_0x3e623b[_0xf7e0('0x34')]=_0x3e623b['attributes'][_0xf7e0('0x37')]?_0x3e623b[_0xf7e0('0x34')]:_0x52d751['model'];_0x3e623b[_0xf7e0('0x3b')]=qs[_0xf7e0('0x3c')](_0x37e388[_0xf7e0('0x31')][_0xf7e0('0x3c')]);_0x3e623b[_0xf7e0('0x40')]=qs[_0xf7e0('0x33')](_[_0xf7e0('0x3d')](_0x37e388[_0xf7e0('0x31')],_0x52d751[_0xf7e0('0x33')]));if(_0x37e388[_0xf7e0('0x31')][_0xf7e0('0x3e')]){_0x3e623b[_0xf7e0('0x40')]=_[_0xf7e0('0x3f')](_0x3e623b[_0xf7e0('0x40')],{'$or':_[_0xf7e0('0x2b')](_0x3e623b['attributes'],function(_0x4a5ad2){var _0x35f8b9={};_0x35f8b9[_0x4a5ad2]={'$like':'%'+_0x37e388[_0xf7e0('0x31')][_0xf7e0('0x3e')]+'%'};return _0x35f8b9;})});}_0x3e623b=_['merge']({},_0x3e623b,_0x37e388[_0xf7e0('0x50')]);return _0x1c6878[_0xf7e0('0x51')](_0x3e623b);}})['then'](function(_0x41b861){if(_0x41b861){_0x1b9b16=_0x41b861[_0xf7e0('0x37')];if(!_0x37e388[_0xf7e0('0x31')][_0xf7e0('0x38')]('nolimit')){_0x3e623b['limit']=qs[_0xf7e0('0x3a')](_0x37e388['query'][_0xf7e0('0x3a')]);_0x3e623b[_0xf7e0('0x1f')]=qs['offset'](_0x37e388[_0xf7e0('0x31')][_0xf7e0('0x1f')]);}return _0x1c6878[_0xf7e0('0x51')](_0x3e623b);}})[_0xf7e0('0x26')](function(_0x1bf4a6){if(_0x1bf4a6){return _0x1bf4a6?{'count':_0x1b9b16,'rows':_0x1bf4a6}:null;}})[_0xf7e0('0x26')](respondWithResult(_0x3f403e,null))[_0xf7e0('0x45')](handleError(_0x3f403e,null));};exports[_0xf7e0('0x52')]=function(_0x43ea3b,_0x3c86da,_0x57f85c){var _0x2f788e={};var _0x391330={};var _0x8c7a62;var _0x3a2f77;return db['Dynamics365Configuration'][_0xf7e0('0x4e')]({'where':{'id':_0x43ea3b[_0xf7e0('0x47')]['id']}})[_0xf7e0('0x26')](handleEntityNotFound(_0x3c86da,null))[_0xf7e0('0x26')](function(_0x140b75){if(_0x140b75){_0x8c7a62=_0x140b75;_0x391330[_0xf7e0('0x30')]=_[_0xf7e0('0x32')](db['Dynamics365Field']['rawAttributes']);_0x391330[_0xf7e0('0x31')]=_[_0xf7e0('0x32')](_0x43ea3b[_0xf7e0('0x31')]);_0x391330[_0xf7e0('0x33')]=_[_0xf7e0('0x35')](_0x391330[_0xf7e0('0x30')],_0x391330[_0xf7e0('0x31')]);_0x2f788e['attributes']=_[_0xf7e0('0x35')](_0x391330[_0xf7e0('0x30')],qs[_0xf7e0('0x36')](_0x43ea3b[_0xf7e0('0x31')][_0xf7e0('0x36')]));_0x2f788e['attributes']=_0x2f788e['attributes'][_0xf7e0('0x37')]?_0x2f788e[_0xf7e0('0x34')]:_0x391330['model'];_0x2f788e[_0xf7e0('0x3b')]=qs[_0xf7e0('0x3c')](_0x43ea3b[_0xf7e0('0x31')][_0xf7e0('0x3c')]);_0x2f788e[_0xf7e0('0x40')]=qs['filters'](_[_0xf7e0('0x3d')](_0x43ea3b[_0xf7e0('0x31')],_0x391330[_0xf7e0('0x33')]));if(_0x43ea3b['query'][_0xf7e0('0x3e')]){_0x2f788e['where']=_[_0xf7e0('0x3f')](_0x2f788e[_0xf7e0('0x40')],{'$or':_[_0xf7e0('0x2b')](_0x2f788e['attributes'],function(_0x2d6e21){var _0x4fff85={};_0x4fff85[_0x2d6e21]={'$like':'%'+_0x43ea3b[_0xf7e0('0x31')][_0xf7e0('0x3e')]+'%'};return _0x4fff85;})});}_0x2f788e=_[_0xf7e0('0x3f')]({},_0x2f788e,_0x43ea3b[_0xf7e0('0x50')]);return _0x8c7a62[_0xf7e0('0x52')](_0x2f788e);}})[_0xf7e0('0x26')](function(_0x1ea307){if(_0x1ea307){_0x3a2f77=_0x1ea307[_0xf7e0('0x37')];if(!_0x43ea3b['query'][_0xf7e0('0x38')](_0xf7e0('0x39'))){_0x2f788e['limit']=qs[_0xf7e0('0x3a')](_0x43ea3b[_0xf7e0('0x31')][_0xf7e0('0x3a')]);_0x2f788e[_0xf7e0('0x1f')]=qs['offset'](_0x43ea3b['query'][_0xf7e0('0x1f')]);}return _0x8c7a62[_0xf7e0('0x52')](_0x2f788e);}})[_0xf7e0('0x26')](function(_0x36ebd2){if(_0x36ebd2){return _0x36ebd2?{'count':_0x3a2f77,'rows':_0x36ebd2}:null;}})['then'](respondWithResult(_0x3c86da,null))[_0xf7e0('0x45')](handleError(_0x3c86da,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 9797823..664f45a 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x4de5b5,_0x448872){var _0x13a04d=function(_0x376386){while(--_0x376386){_0x4de5b5['push'](_0x4de5b5['shift']());}};_0x13a04d(++_0x448872);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1b58cd,_0x1a7c1b){_0x1b58cd=_0x1b58cd-0x0;var _0x5db4f5=_0x6f0d[_0x1b58cd];return _0x5db4f5;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f76f8ef..d1f74fc 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 _0x77e5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','Dynamics365Configuration,\x20%s,\x20%s','lodash','util'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x77e5,0xc6));var _0x577e=function(_0x5baa75,_0x3c2d52){_0x5baa75=_0x5baa75-0x0;var _0x3030aa=_0x77e5[_0x5baa75];return _0x3030aa;};'use strict';var _=require(_0x577e('0x0'));var util=require(_0x577e('0x1'));var moment=require(_0x577e('0x2'));var BPromise=require(_0x577e('0x3'));var rs=require(_0x577e('0x4'));var fs=require('fs');var Redis=require(_0x577e('0x5'));var db=require(_0x577e('0x6'))['db'];var utils=require(_0x577e('0x7'));var logger=require(_0x577e('0x8'))(_0x577e('0x9'));var config=require(_0x577e('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2834b5,_0x1da321,_0xa67d27){return new BPromise(function(_0x5c185b,_0x29489e){return client[_0x577e('0xb')](_0x2834b5,_0xa67d27)[_0x577e('0xc')](function(_0x4e70d7){logger[_0x577e('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1da321,_0x577e('0xe'));logger[_0x577e('0xf')](_0x577e('0x10'),_0x1da321,'request\x20sent',JSON['stringify'](_0x4e70d7));if(_0x4e70d7['error']){if(_0x4e70d7[_0x577e('0x11')]['code']===0x1f4){logger[_0x577e('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1da321,_0x4e70d7[_0x577e('0x11')][_0x577e('0x12')]);return _0x29489e(_0x4e70d7[_0x577e('0x11')][_0x577e('0x12')]);}logger[_0x577e('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1da321,_0x4e70d7[_0x577e('0x11')][_0x577e('0x12')]);return _0x5c185b(_0x4e70d7['error'][_0x577e('0x12')]);}else{logger[_0x577e('0xd')](_0x577e('0x13'),_0x1da321,_0x577e('0xe'));_0x5c185b(_0x4e70d7['result'][_0x577e('0x12')]);}})['catch'](function(_0x99321d){logger[_0x577e('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1da321,_0x99321d);_0x29489e(_0x99321d);});});} \ No newline at end of file +var _0x7989=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7989,0x1bc));var _0x9798=function(_0x41d9e7,_0x33ef4a){_0x41d9e7=_0x41d9e7-0x0;var _0x282c36=_0x7989[_0x41d9e7];return _0x282c36;};'use strict';var _=require(_0x9798('0x0'));var util=require(_0x9798('0x1'));var moment=require(_0x9798('0x2'));var BPromise=require(_0x9798('0x3'));var rs=require(_0x9798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9798('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9798('0x6'))(_0x9798('0x7'));var config=require('../../config/environment');var jayson=require(_0x9798('0x8'));var client=jayson[_0x9798('0x9')][_0x9798('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dfa08,_0x398417,_0xeea361){return new BPromise(function(_0x5e20bd,_0x444139){return client['request'](_0x1dfa08,_0xeea361)[_0x9798('0xb')](function(_0x4381da){logger[_0x9798('0xc')](_0x9798('0xd'),_0x398417,'request\x20sent');logger[_0x9798('0xe')](_0x9798('0xf'),_0x398417,_0x9798('0x10'),JSON['stringify'](_0x4381da));if(_0x4381da[_0x9798('0x11')]){if(_0x4381da['error'][_0x9798('0x12')]===0x1f4){logger['error'](_0x9798('0xd'),_0x398417,_0x4381da[_0x9798('0x11')]['message']);return _0x444139(_0x4381da[_0x9798('0x11')]['message']);}logger[_0x9798('0x11')](_0x9798('0xd'),_0x398417,_0x4381da['error']['message']);return _0x5e20bd(_0x4381da[_0x9798('0x11')][_0x9798('0x13')]);}else{logger['info'](_0x9798('0xd'),_0x398417,_0x9798('0x10'));_0x5e20bd(_0x4381da[_0x9798('0x14')][_0x9798('0x13')]);}})[_0x9798('0x15')](function(_0x5ecc10){logger[_0x9798('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x398417,_0x5ecc10);_0x444139(_0x5ecc10);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e94cea7..47c3e5a 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 _0x5c8b=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21fb44,_0x178b49){var _0x4efe2f=function(_0x68d2e6){while(--_0x68d2e6){_0x21fb44['push'](_0x21fb44['shift']());}};_0x4efe2f(++_0x178b49);}(_0x5c8b,0x191));var _0xb5c8=function(_0x477f84,_0x40f9b2){_0x477f84=_0x477f84-0x0;var _0x32eb54=_0x5c8b[_0x477f84];return _0x32eb54;};'use strict';var multer=require(_0xb5c8('0x0'));var util=require(_0xb5c8('0x1'));var path=require('path');var timeout=require(_0xb5c8('0x2'));var express=require(_0xb5c8('0x3'));var router=express['Router']();var fs_extra=require(_0xb5c8('0x4'));var auth=require(_0xb5c8('0x5'));var interaction=require(_0xb5c8('0x6'));var config=require(_0xb5c8('0x7'));var controller=require(_0xb5c8('0x8'));router[_0xb5c8('0x9')]('/',auth[_0xb5c8('0xa')](),controller['index']);router[_0xb5c8('0x9')](_0xb5c8('0xb'),auth[_0xb5c8('0xa')](),controller['show']);router[_0xb5c8('0xc')]('/',auth[_0xb5c8('0xa')](),controller['create']);router[_0xb5c8('0xd')](_0xb5c8('0xb'),auth['isAuthenticated'](),controller[_0xb5c8('0xe')]);router['delete'](_0xb5c8('0xb'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xf')]);module[_0xb5c8('0x10')]=router; \ No newline at end of file +var _0xb162=['update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0xb162,0x1a6));var _0x2b16=function(_0x2693c7,_0x49d88c){_0x2693c7=_0x2693c7-0x0;var _0x562112=_0xb162[_0x2693c7];return _0x562112;};'use strict';var multer=require(_0x2b16('0x0'));var util=require('util');var path=require(_0x2b16('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b16('0x2'));var router=express[_0x2b16('0x3')]();var fs_extra=require(_0x2b16('0x4'));var auth=require(_0x2b16('0x5'));var interaction=require(_0x2b16('0x6'));var config=require(_0x2b16('0x7'));var controller=require(_0x2b16('0x8'));router[_0x2b16('0x9')]('/',auth[_0x2b16('0xa')](),controller[_0x2b16('0xb')]);router['get'](_0x2b16('0xc'),auth[_0x2b16('0xa')](),controller[_0x2b16('0xd')]);router[_0x2b16('0xe')]('/',auth[_0x2b16('0xa')](),controller['create']);router['put'](_0x2b16('0xc'),auth['isAuthenticated'](),controller[_0x2b16('0xf')]);router[_0x2b16('0x10')]('/:id',auth[_0x2b16('0xa')](),controller[_0x2b16('0x11')]);module[_0x2b16('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 17c0702..828a8f9 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 _0xfe2f=['variable','BOOLEAN','exports','ENUM','string','customVariable','picklist','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfe2f,0x112));var _0xffe2=function(_0x3194b5,_0x57cb90){_0x3194b5=_0x3194b5-0x0;var _0xd8d147=_0xfe2f[_0x3194b5];return _0xd8d147;};'use strict';var Sequelize=require('sequelize');module[_0xffe2('0x0')]={'type':{'type':Sequelize[_0xffe2('0x1')](_0xffe2('0x2'),'variable',_0xffe2('0x3'),'keyValue',_0xffe2('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xffe2('0x5')]},'key':{'type':Sequelize[_0xffe2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xffe2('0x2'),_0xffe2('0x6'),_0xffe2('0x3'))},'keyContent':{'type':Sequelize[_0xffe2('0x5')]},'idField':{'type':Sequelize[_0xffe2('0x5')]},'nameField':{'type':Sequelize[_0xffe2('0x5')]},'customField':{'type':Sequelize[_0xffe2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd3fe=['exports','ENUM','string','customVariable','picklist','STRING','variable','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd3fe,0x10f));var _0xed3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xed3f('0x0'));module[_0xed3f('0x1')]={'type':{'type':Sequelize[_0xed3f('0x2')](_0xed3f('0x3'),'variable',_0xed3f('0x4'),'keyValue',_0xed3f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xed3f('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xed3f('0x3'),_0xed3f('0x7'),_0xed3f('0x4'))},'keyContent':{'type':Sequelize[_0xed3f('0x6')]},'idField':{'type':Sequelize[_0xed3f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1b4f538..c8180ab 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 _0xbb89=['keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','Dynamics365Field','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','map'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xbb89,0x1a3));var _0x9bb8=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbb89[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x9bb8('0x0'));var rimraf=require(_0x9bb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bb8('0x2'));var rp=require(_0x9bb8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bb8('0x4'));var path=require(_0x9bb8('0x5'));var sox=require(_0x9bb8('0x6'));var csv=require(_0x9bb8('0x7'));var ejs=require(_0x9bb8('0x8'));var fs=require('fs');var fs_extra=require(_0x9bb8('0x9'));var _=require(_0x9bb8('0xa'));var squel=require(_0x9bb8('0xb'));var crypto=require(_0x9bb8('0xc'));var jsforce=require(_0x9bb8('0xd'));var deskjs=require(_0x9bb8('0xe'));var toCsv=require(_0x9bb8('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9bb8('0xf'));var authService=require(_0x9bb8('0x10'));var qs=require(_0x9bb8('0x11'));var as=require(_0x9bb8('0x12'));var hardwareService=require(_0x9bb8('0x13'));var logger=require(_0x9bb8('0x14'))('api');var utils=require(_0x9bb8('0x15'));var config=require(_0x9bb8('0x16'));var licenseUtil=require(_0x9bb8('0x17'));var db=require(_0x9bb8('0x18'))['db'];function respondWithStatusCode(_0x11aeac,_0x3d2a0d){_0x3d2a0d=_0x3d2a0d||0xcc;return function(_0x221f49){if(_0x221f49){return _0x11aeac[_0x9bb8('0x19')](_0x3d2a0d);}return _0x11aeac[_0x9bb8('0x1a')](_0x3d2a0d)[_0x9bb8('0x1b')]();};}function respondWithResult(_0x3b460a,_0x257438){_0x257438=_0x257438||0xc8;return function(_0xb331d1){if(_0xb331d1){return _0x3b460a[_0x9bb8('0x1a')](_0x257438)['json'](_0xb331d1);}};}function respondWithFilteredResult(_0x4cace2,_0x3bec27){return function(_0x46f8b4){if(_0x46f8b4){var _0x3abfbb=typeof _0x3bec27[_0x9bb8('0x1c')]===_0x9bb8('0x1d')&&typeof _0x3bec27['limit']==='undefined';var _0x52996f=_0x46f8b4[_0x9bb8('0x1e')];var _0x48e176=_0x3abfbb?0x0:_0x3bec27[_0x9bb8('0x1c')];var _0x41897c=_0x3abfbb?_0x46f8b4[_0x9bb8('0x1e')]:_0x3bec27['offset']+_0x3bec27[_0x9bb8('0x1f')];var _0x4a31e2;if(_0x41897c>=_0x52996f){_0x41897c=_0x52996f;_0x4a31e2=0xc8;}else{_0x4a31e2=0xce;}_0x4cace2[_0x9bb8('0x1a')](_0x4a31e2);return _0x4cace2[_0x9bb8('0x20')](_0x9bb8('0x21'),_0x48e176+'-'+_0x41897c+'/'+_0x52996f)[_0x9bb8('0x22')](_0x46f8b4);}return null;};}function patchUpdates(_0x451b43){return function(_0x1f62ad){try{jsonpatch[_0x9bb8('0x23')](_0x1f62ad,_0x451b43,!![]);}catch(_0x4e6421){return BPromise[_0x9bb8('0x24')](_0x4e6421);}return _0x1f62ad[_0x9bb8('0x25')]();};}function saveUpdates(_0x4a3328,_0x26b1fb){return function(_0x560793){if(_0x560793){return _0x560793[_0x9bb8('0x26')](_0x4a3328)[_0x9bb8('0x27')](function(_0x3ccef7){return _0x3ccef7;});}return null;};}function removeEntity(_0x357638,_0x2fddba){return function(_0x3370ca){if(_0x3370ca){return _0x3370ca[_0x9bb8('0x28')]()[_0x9bb8('0x27')](function(){_0x357638['status'](0xcc)[_0x9bb8('0x1b')]();});}};}function handleEntityNotFound(_0x485c5b,_0x318006){return function(_0x5dd82a){if(!_0x5dd82a){_0x485c5b[_0x9bb8('0x19')](0x194);}return _0x5dd82a;};}function handleError(_0x1cbb5d,_0x528c3e){_0x528c3e=_0x528c3e||0x1f4;return function(_0x1c82b4){logger[_0x9bb8('0x29')](_0x1c82b4[_0x9bb8('0x2a')]);if(_0x1c82b4[_0x9bb8('0x2b')]){delete _0x1c82b4[_0x9bb8('0x2b')];}_0x1cbb5d[_0x9bb8('0x1a')](_0x528c3e)[_0x9bb8('0x2c')](_0x1c82b4);};}exports[_0x9bb8('0x2d')]=function(_0x7fb3ab,_0x337a95){var _0xeeb8ea={},_0xdaa404={},_0xf28e88={'count':0x0,'rows':[]};var _0x43a19c=_['map'](db['Dynamics365Field'][_0x9bb8('0x2e')],function(_0x124b97){return{'name':_0x124b97['fieldName'],'type':_0x124b97[_0x9bb8('0x2f')]['key']};});_0xdaa404['model']=_[_0x9bb8('0x30')](_0x43a19c,_0x9bb8('0x2b'));_0xdaa404['query']=_[_0x9bb8('0x31')](_0x7fb3ab[_0x9bb8('0x32')]);_0xdaa404[_0x9bb8('0x33')]=_[_0x9bb8('0x34')](_0xdaa404['model'],_0xdaa404[_0x9bb8('0x32')]);_0xeeb8ea['attributes']=_[_0x9bb8('0x34')](_0xdaa404[_0x9bb8('0x35')],qs[_0x9bb8('0x36')](_0x7fb3ab['query'][_0x9bb8('0x36')]));_0xeeb8ea[_0x9bb8('0x37')]=_0xeeb8ea[_0x9bb8('0x37')][_0x9bb8('0x38')]?_0xeeb8ea['attributes']:_0xdaa404[_0x9bb8('0x35')];if(!_0x7fb3ab[_0x9bb8('0x32')][_0x9bb8('0x39')](_0x9bb8('0x3a'))){_0xeeb8ea[_0x9bb8('0x1f')]=qs['limit'](_0x7fb3ab[_0x9bb8('0x32')][_0x9bb8('0x1f')]);_0xeeb8ea[_0x9bb8('0x1c')]=qs['offset'](_0x7fb3ab[_0x9bb8('0x32')][_0x9bb8('0x1c')]);}_0xeeb8ea[_0x9bb8('0x3b')]=qs[_0x9bb8('0x3c')](_0x7fb3ab[_0x9bb8('0x32')]['sort']);_0xeeb8ea['where']=qs['filters'](_[_0x9bb8('0x3d')](_0x7fb3ab[_0x9bb8('0x32')],_0xdaa404[_0x9bb8('0x33')]),_0x43a19c);if(_0x7fb3ab[_0x9bb8('0x32')][_0x9bb8('0x3e')]){_0xeeb8ea[_0x9bb8('0x3f')]=_[_0x9bb8('0x40')](_0xeeb8ea[_0x9bb8('0x3f')],{'$or':_['map'](_0x43a19c,function(_0xf34d7c){if(_0xf34d7c[_0x9bb8('0x2f')]!==_0x9bb8('0x41')){var _0x2e03e5={};_0x2e03e5[_0xf34d7c[_0x9bb8('0x2b')]]={'$like':'%'+_0x7fb3ab[_0x9bb8('0x32')][_0x9bb8('0x3e')]+'%'};return _0x2e03e5;}})});}_0xeeb8ea=_[_0x9bb8('0x40')]({},_0xeeb8ea,_0x7fb3ab[_0x9bb8('0x42')]);var _0x4a7fc6={'where':_0xeeb8ea[_0x9bb8('0x3f')]};return db['Dynamics365Field'][_0x9bb8('0x1e')](_0x4a7fc6)[_0x9bb8('0x27')](function(_0x32c8d3){_0xf28e88[_0x9bb8('0x1e')]=_0x32c8d3;if(_0x7fb3ab[_0x9bb8('0x32')][_0x9bb8('0x43')]){_0xeeb8ea['include']=[{'all':!![]}];}return db[_0x9bb8('0x44')][_0x9bb8('0x45')](_0xeeb8ea);})[_0x9bb8('0x27')](function(_0xe92057){_0xf28e88[_0x9bb8('0x46')]=_0xe92057;return _0xf28e88;})['then'](respondWithFilteredResult(_0x337a95,_0xeeb8ea))[_0x9bb8('0x47')](handleError(_0x337a95,null));};exports[_0x9bb8('0x48')]=function(_0x2cf1d8,_0x1bed33){var _0x4722e5={'raw':!![],'where':{'id':_0x2cf1d8[_0x9bb8('0x49')]['id']}},_0x24352c={};_0x24352c[_0x9bb8('0x35')]=_[_0x9bb8('0x31')](db[_0x9bb8('0x44')]['rawAttributes']);_0x24352c['query']=_['keys'](_0x2cf1d8[_0x9bb8('0x32')]);_0x24352c[_0x9bb8('0x33')]=_[_0x9bb8('0x34')](_0x24352c[_0x9bb8('0x35')],_0x24352c[_0x9bb8('0x32')]);_0x4722e5['attributes']=_[_0x9bb8('0x34')](_0x24352c[_0x9bb8('0x35')],qs[_0x9bb8('0x36')](_0x2cf1d8[_0x9bb8('0x32')]['fields']));_0x4722e5[_0x9bb8('0x37')]=_0x4722e5[_0x9bb8('0x37')]['length']?_0x4722e5[_0x9bb8('0x37')]:_0x24352c['model'];if(_0x2cf1d8[_0x9bb8('0x32')][_0x9bb8('0x43')]){_0x4722e5[_0x9bb8('0x4a')]=[{'all':!![]}];}_0x4722e5=_['merge']({},_0x4722e5,_0x2cf1d8[_0x9bb8('0x42')]);return db['Dynamics365Field'][_0x9bb8('0x4b')](_0x4722e5)[_0x9bb8('0x27')](handleEntityNotFound(_0x1bed33,null))[_0x9bb8('0x27')](respondWithResult(_0x1bed33,null))[_0x9bb8('0x47')](handleError(_0x1bed33,null));};exports['create']=function(_0x4acf2e,_0x2ff21f){return db[_0x9bb8('0x44')][_0x9bb8('0x4c')](_0x4acf2e[_0x9bb8('0x4d')],{})[_0x9bb8('0x27')](respondWithResult(_0x2ff21f,0xc9))[_0x9bb8('0x47')](handleError(_0x2ff21f,null));};exports['update']=function(_0x5d4cca,_0x130035){if(_0x5d4cca['body']['id']){delete _0x5d4cca[_0x9bb8('0x4d')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x5d4cca[_0x9bb8('0x49')]['id']}})[_0x9bb8('0x27')](handleEntityNotFound(_0x130035,null))[_0x9bb8('0x27')](saveUpdates(_0x5d4cca[_0x9bb8('0x4d')],null))['then'](respondWithResult(_0x130035,null))[_0x9bb8('0x47')](handleError(_0x130035,null));};exports['destroy']=function(_0x411d29,_0x286c1d){return db['Dynamics365Field'][_0x9bb8('0x4b')]({'where':{'id':_0x411d29[_0x9bb8('0x49')]['id']}})['then'](handleEntityNotFound(_0x286c1d,null))['then'](removeEntity(_0x286c1d,null))['catch'](handleError(_0x286c1d,null));}; \ No newline at end of file +var _0xe4c1=['where','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','filter'];(function(_0x106afb,_0x264767){var _0x49a6aa=function(_0x185660){while(--_0x185660){_0x106afb['push'](_0x106afb['shift']());}};_0x49a6aa(++_0x264767);}(_0xe4c1,0xab));var _0x1e4c=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xe4c1[_0x44946b];return _0x249bc4;};'use strict';var emlformat=require(_0x1e4c('0x0'));var rimraf=require(_0x1e4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e4c('0x2'));var rp=require(_0x1e4c('0x3'));var moment=require(_0x1e4c('0x4'));var BPromise=require(_0x1e4c('0x5'));var Mustache=require(_0x1e4c('0x6'));var util=require(_0x1e4c('0x7'));var path=require(_0x1e4c('0x8'));var sox=require(_0x1e4c('0x9'));var csv=require(_0x1e4c('0xa'));var ejs=require(_0x1e4c('0xb'));var fs=require('fs');var fs_extra=require(_0x1e4c('0xc'));var _=require(_0x1e4c('0xd'));var squel=require(_0x1e4c('0xe'));var crypto=require(_0x1e4c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1e4c('0x10'));var toCsv=require(_0x1e4c('0xa'));var querystring=require(_0x1e4c('0x11'));var Papa=require(_0x1e4c('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e4c('0x13'));var as=require(_0x1e4c('0x14'));var hardwareService=require(_0x1e4c('0x15'));var logger=require('../../config/logger')(_0x1e4c('0x16'));var utils=require(_0x1e4c('0x17'));var config=require(_0x1e4c('0x18'));var licenseUtil=require(_0x1e4c('0x19'));var db=require(_0x1e4c('0x1a'))['db'];function respondWithStatusCode(_0x499245,_0x25d584){_0x25d584=_0x25d584||0xcc;return function(_0x3879bb){if(_0x3879bb){return _0x499245[_0x1e4c('0x1b')](_0x25d584);}return _0x499245['status'](_0x25d584)['end']();};}function respondWithResult(_0x5d8f07,_0x3c0a11){_0x3c0a11=_0x3c0a11||0xc8;return function(_0x509aa0){if(_0x509aa0){return _0x5d8f07[_0x1e4c('0x1c')](_0x3c0a11)[_0x1e4c('0x1d')](_0x509aa0);}};}function respondWithFilteredResult(_0x1879e5,_0x32aa9c){return function(_0x3fe349){if(_0x3fe349){var _0x4dfd60=typeof _0x32aa9c[_0x1e4c('0x1e')]===_0x1e4c('0x1f')&&typeof _0x32aa9c['limit']===_0x1e4c('0x1f');var _0x42f893=_0x3fe349[_0x1e4c('0x20')];var _0x4a7505=_0x4dfd60?0x0:_0x32aa9c['offset'];var _0x231f71=_0x4dfd60?_0x3fe349[_0x1e4c('0x20')]:_0x32aa9c[_0x1e4c('0x1e')]+_0x32aa9c['limit'];var _0x4cdaca;if(_0x231f71>=_0x42f893){_0x231f71=_0x42f893;_0x4cdaca=0xc8;}else{_0x4cdaca=0xce;}_0x1879e5[_0x1e4c('0x1c')](_0x4cdaca);return _0x1879e5[_0x1e4c('0x21')](_0x1e4c('0x22'),_0x4a7505+'-'+_0x231f71+'/'+_0x42f893)[_0x1e4c('0x1d')](_0x3fe349);}return null;};}function patchUpdates(_0x495ce8){return function(_0x30f2ea){try{jsonpatch[_0x1e4c('0x23')](_0x30f2ea,_0x495ce8,!![]);}catch(_0xbe8152){return BPromise[_0x1e4c('0x24')](_0xbe8152);}return _0x30f2ea[_0x1e4c('0x25')]();};}function saveUpdates(_0x2646cd,_0x5c5904){return function(_0x4586d7){if(_0x4586d7){return _0x4586d7[_0x1e4c('0x26')](_0x2646cd)['then'](function(_0x46ab58){return _0x46ab58;});}return null;};}function removeEntity(_0x578ac7,_0x331469){return function(_0x148fc5){if(_0x148fc5){return _0x148fc5[_0x1e4c('0x27')]()[_0x1e4c('0x28')](function(){_0x578ac7[_0x1e4c('0x1c')](0xcc)[_0x1e4c('0x29')]();});}};}function handleEntityNotFound(_0x3d9bd9,_0x24d5e9){return function(_0x3c20d1){if(!_0x3c20d1){_0x3d9bd9['sendStatus'](0x194);}return _0x3c20d1;};}function handleError(_0x1ccd2d,_0x4c1202){_0x4c1202=_0x4c1202||0x1f4;return function(_0x4b7e13){logger[_0x1e4c('0x2a')](_0x4b7e13[_0x1e4c('0x2b')]);if(_0x4b7e13[_0x1e4c('0x2c')]){delete _0x4b7e13['name'];}_0x1ccd2d[_0x1e4c('0x1c')](_0x4c1202)[_0x1e4c('0x2d')](_0x4b7e13);};}exports[_0x1e4c('0x2e')]=function(_0x420255,_0x3c787b){var _0x5e2b49={},_0x1c50b5={},_0x2f495a={'count':0x0,'rows':[]};var _0x6fbc87=_[_0x1e4c('0x2f')](db[_0x1e4c('0x30')][_0x1e4c('0x31')],function(_0x169e2c){return{'name':_0x169e2c['fieldName'],'type':_0x169e2c[_0x1e4c('0x32')][_0x1e4c('0x33')]};});_0x1c50b5[_0x1e4c('0x34')]=_[_0x1e4c('0x2f')](_0x6fbc87,'name');_0x1c50b5[_0x1e4c('0x35')]=_[_0x1e4c('0x36')](_0x420255['query']);_0x1c50b5['filters']=_[_0x1e4c('0x37')](_0x1c50b5[_0x1e4c('0x34')],_0x1c50b5[_0x1e4c('0x35')]);_0x5e2b49[_0x1e4c('0x38')]=_[_0x1e4c('0x37')](_0x1c50b5['model'],qs[_0x1e4c('0x39')](_0x420255[_0x1e4c('0x35')]['fields']));_0x5e2b49[_0x1e4c('0x38')]=_0x5e2b49['attributes'][_0x1e4c('0x3a')]?_0x5e2b49[_0x1e4c('0x38')]:_0x1c50b5['model'];if(!_0x420255[_0x1e4c('0x35')][_0x1e4c('0x3b')](_0x1e4c('0x3c'))){_0x5e2b49[_0x1e4c('0x3d')]=qs[_0x1e4c('0x3d')](_0x420255['query'][_0x1e4c('0x3d')]);_0x5e2b49[_0x1e4c('0x1e')]=qs['offset'](_0x420255[_0x1e4c('0x35')]['offset']);}_0x5e2b49['order']=qs[_0x1e4c('0x3e')](_0x420255[_0x1e4c('0x35')][_0x1e4c('0x3e')]);_0x5e2b49['where']=qs['filters'](_[_0x1e4c('0x3f')](_0x420255[_0x1e4c('0x35')],_0x1c50b5[_0x1e4c('0x40')]),_0x6fbc87);if(_0x420255[_0x1e4c('0x35')][_0x1e4c('0x41')]){_0x5e2b49['where']=_['merge'](_0x5e2b49[_0x1e4c('0x42')],{'$or':_[_0x1e4c('0x2f')](_0x6fbc87,function(_0x263b32){if(_0x263b32[_0x1e4c('0x32')]!==_0x1e4c('0x43')){var _0xe3b2ab={};_0xe3b2ab[_0x263b32[_0x1e4c('0x2c')]]={'$like':'%'+_0x420255[_0x1e4c('0x35')][_0x1e4c('0x41')]+'%'};return _0xe3b2ab;}})});}_0x5e2b49=_[_0x1e4c('0x44')]({},_0x5e2b49,_0x420255[_0x1e4c('0x45')]);var _0x3b0cc0={'where':_0x5e2b49[_0x1e4c('0x42')]};return db[_0x1e4c('0x30')][_0x1e4c('0x20')](_0x3b0cc0)[_0x1e4c('0x28')](function(_0x449b2e){_0x2f495a[_0x1e4c('0x20')]=_0x449b2e;if(_0x420255[_0x1e4c('0x35')]['includeAll']){_0x5e2b49[_0x1e4c('0x46')]=[{'all':!![]}];}return db[_0x1e4c('0x30')][_0x1e4c('0x47')](_0x5e2b49);})[_0x1e4c('0x28')](function(_0x309ad5){_0x2f495a[_0x1e4c('0x48')]=_0x309ad5;return _0x2f495a;})[_0x1e4c('0x28')](respondWithFilteredResult(_0x3c787b,_0x5e2b49))[_0x1e4c('0x49')](handleError(_0x3c787b,null));};exports[_0x1e4c('0x4a')]=function(_0x15f931,_0x4731da){var _0x2beedb={'raw':!![],'where':{'id':_0x15f931['params']['id']}},_0x20656c={};_0x20656c[_0x1e4c('0x34')]=_[_0x1e4c('0x36')](db[_0x1e4c('0x30')][_0x1e4c('0x31')]);_0x20656c[_0x1e4c('0x35')]=_['keys'](_0x15f931[_0x1e4c('0x35')]);_0x20656c[_0x1e4c('0x40')]=_['intersection'](_0x20656c['model'],_0x20656c[_0x1e4c('0x35')]);_0x2beedb[_0x1e4c('0x38')]=_[_0x1e4c('0x37')](_0x20656c[_0x1e4c('0x34')],qs['fields'](_0x15f931[_0x1e4c('0x35')]['fields']));_0x2beedb[_0x1e4c('0x38')]=_0x2beedb[_0x1e4c('0x38')]['length']?_0x2beedb[_0x1e4c('0x38')]:_0x20656c[_0x1e4c('0x34')];if(_0x15f931['query'][_0x1e4c('0x4b')]){_0x2beedb[_0x1e4c('0x46')]=[{'all':!![]}];}_0x2beedb=_[_0x1e4c('0x44')]({},_0x2beedb,_0x15f931['options']);return db[_0x1e4c('0x30')][_0x1e4c('0x4c')](_0x2beedb)[_0x1e4c('0x28')](handleEntityNotFound(_0x4731da,null))[_0x1e4c('0x28')](respondWithResult(_0x4731da,null))[_0x1e4c('0x49')](handleError(_0x4731da,null));};exports[_0x1e4c('0x4d')]=function(_0x27bf2d,_0x3d5fad){return db[_0x1e4c('0x30')]['create'](_0x27bf2d[_0x1e4c('0x4e')],{})[_0x1e4c('0x28')](respondWithResult(_0x3d5fad,0xc9))[_0x1e4c('0x49')](handleError(_0x3d5fad,null));};exports['update']=function(_0xe2dc9f,_0x3b645e){if(_0xe2dc9f['body']['id']){delete _0xe2dc9f[_0x1e4c('0x4e')]['id'];}return db['Dynamics365Field'][_0x1e4c('0x4c')]({'where':{'id':_0xe2dc9f['params']['id']}})[_0x1e4c('0x28')](handleEntityNotFound(_0x3b645e,null))[_0x1e4c('0x28')](saveUpdates(_0xe2dc9f[_0x1e4c('0x4e')],null))['then'](respondWithResult(_0x3b645e,null))['catch'](handleError(_0x3b645e,null));};exports[_0x1e4c('0x27')]=function(_0x1d0f6b,_0x48a946){return db['Dynamics365Field'][_0x1e4c('0x4c')]({'where':{'id':_0x1d0f6b['params']['id']}})[_0x1e4c('0x28')](handleEntityNotFound(_0x48a946,null))['then'](removeEntity(_0x48a946,null))['catch'](handleError(_0x48a946,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 28a1e79..5576957 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 _0xbca5=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','api','moment','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x56d77d,_0xdec1b8){var _0x1651e3=function(_0x399d40){while(--_0x399d40){_0x56d77d['push'](_0x56d77d['shift']());}};_0x1651e3(++_0xdec1b8);}(_0xbca5,0xa0));var _0x5bca=function(_0x1eec3a,_0x168828){_0x1eec3a=_0x1eec3a-0x0;var _0x133cf7=_0xbca5[_0x1eec3a];return _0x133cf7;};'use strict';var _=require(_0x5bca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5bca('0x1'));var moment=require(_0x5bca('0x2'));var BPromise=require('bluebird');var rp=require(_0x5bca('0x3'));var fs=require('fs');var path=require(_0x5bca('0x4'));var rimraf=require('rimraf');var config=require(_0x5bca('0x5'));var attributes=require(_0x5bca('0x6'));module[_0x5bca('0x7')]=function(_0x14867d,_0x249e15){return _0x14867d['define'](_0x5bca('0x8'),attributes,{'tableName':_0x5bca('0x9'),'paranoid':![],'indexes':[{'name':_0x5bca('0xa'),'fields':['idField',_0x5bca('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92bf=['util','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define','Dynamics365Field','dynamics365_unique_index','FieldId','lodash'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0x92bf,0x14f));var _0xf92b=function(_0x3a799d,_0x36f890){_0x3a799d=_0x3a799d-0x0;var _0x20fe69=_0x92bf[_0x3a799d];return _0x20fe69;};'use strict';var _=require(_0xf92b('0x0'));var util=require(_0xf92b('0x1'));var logger=require(_0xf92b('0x2'))('api');var moment=require(_0xf92b('0x3'));var BPromise=require(_0xf92b('0x4'));var rp=require(_0xf92b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf92b('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xf92b('0x7')]=function(_0x11080d,_0x3b6f81){return _0x11080d[_0xf92b('0x8')](_0xf92b('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xf92b('0xa'),'fields':['idField',_0xf92b('0xb')],'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 42f2cf3..9eb75cb 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 _0x99aa=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d1652,_0x28a324){var _0x54286b=function(_0x48653d){while(--_0x48653d){_0x5d1652['push'](_0x5d1652['shift']());}};_0x54286b(++_0x28a324);}(_0x99aa,0x192));var _0xa99a=function(_0x397eb2,_0x3a92f1){_0x397eb2=_0x397eb2-0x0;var _0x183633=_0x99aa[_0x397eb2];return _0x183633;};'use strict';var _=require(_0xa99a('0x0'));var util=require(_0xa99a('0x1'));var moment=require(_0xa99a('0x2'));var BPromise=require(_0xa99a('0x3'));var rs=require(_0xa99a('0x4'));var fs=require('fs');var Redis=require(_0xa99a('0x5'));var db=require(_0xa99a('0x6'))['db'];var utils=require(_0xa99a('0x7'));var logger=require('../../config/logger')(_0xa99a('0x8'));var config=require(_0xa99a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa99a('0xa')][_0xa99a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19bfac,_0x30a42b,_0x4a3051){return new BPromise(function(_0x49ec52,_0x506f37){return client[_0xa99a('0xc')](_0x19bfac,_0x4a3051)[_0xa99a('0xd')](function(_0x1e93e6){logger[_0xa99a('0xe')](_0xa99a('0xf'),_0x30a42b,_0xa99a('0x10'));logger[_0xa99a('0x11')](_0xa99a('0x12'),_0x30a42b,'request\x20sent',JSON[_0xa99a('0x13')](_0x1e93e6));if(_0x1e93e6[_0xa99a('0x14')]){if(_0x1e93e6['error'][_0xa99a('0x15')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x30a42b,_0x1e93e6['error'][_0xa99a('0x16')]);return _0x506f37(_0x1e93e6['error'][_0xa99a('0x16')]);}logger['error'](_0xa99a('0xf'),_0x30a42b,_0x1e93e6[_0xa99a('0x14')][_0xa99a('0x16')]);return _0x49ec52(_0x1e93e6[_0xa99a('0x14')]['message']);}else{logger[_0xa99a('0xe')](_0xa99a('0xf'),_0x30a42b,'request\x20sent');_0x49ec52(_0x1e93e6[_0xa99a('0x17')][_0xa99a('0x16')]);}})[_0xa99a('0x18')](function(_0x582fcf){logger[_0xa99a('0x14')](_0xa99a('0xf'),_0x30a42b,_0x582fcf);_0x506f37(_0x582fcf);});});} \ No newline at end of file +var _0xf057=['message','Dynamics365Field,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','code'];(function(_0x7299d0,_0x19edbf){var _0xc2fddb=function(_0x126a42){while(--_0x126a42){_0x7299d0['push'](_0x7299d0['shift']());}};_0xc2fddb(++_0x19edbf);}(_0xf057,0x143));var _0x7f05=function(_0x3d9901,_0x1a7a2c){_0x3d9901=_0x3d9901-0x0;var _0x11938c=_0xf057[_0x3d9901];return _0x11938c;};'use strict';var _=require(_0x7f05('0x0'));var util=require(_0x7f05('0x1'));var moment=require('moment');var BPromise=require(_0x7f05('0x2'));var rs=require(_0x7f05('0x3'));var fs=require('fs');var Redis=require(_0x7f05('0x4'));var db=require(_0x7f05('0x5'))['db'];var utils=require(_0x7f05('0x6'));var logger=require('../../config/logger')(_0x7f05('0x7'));var config=require(_0x7f05('0x8'));var jayson=require(_0x7f05('0x9'));var client=jayson[_0x7f05('0xa')][_0x7f05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf099,_0x3f2b61,_0x3f4514){return new BPromise(function(_0x35923b,_0x26951f){return client[_0x7f05('0xc')](_0x1bf099,_0x3f4514)['then'](function(_0x5775ef){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3f2b61,_0x7f05('0xd'));logger[_0x7f05('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3f2b61,'request\x20sent',JSON['stringify'](_0x5775ef));if(_0x5775ef[_0x7f05('0xf')]){if(_0x5775ef[_0x7f05('0xf')][_0x7f05('0x10')]===0x1f4){logger[_0x7f05('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3f2b61,_0x5775ef['error'][_0x7f05('0x11')]);return _0x26951f(_0x5775ef[_0x7f05('0xf')][_0x7f05('0x11')]);}logger['error'](_0x7f05('0x12'),_0x3f2b61,_0x5775ef[_0x7f05('0xf')]['message']);return _0x35923b(_0x5775ef[_0x7f05('0xf')][_0x7f05('0x11')]);}else{logger['info'](_0x7f05('0x12'),_0x3f2b61,'request\x20sent');_0x35923b(_0x5775ef['result'][_0x7f05('0x11')]);}})[_0x7f05('0x13')](function(_0x202446){logger[_0x7f05('0xf')](_0x7f05('0x12'),_0x3f2b61,_0x202446);_0x26951f(_0x202446);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e660a8a..c31c889 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 _0xe485=['put','/:id','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe485,0x1a6));var _0x5e48=function(_0x3c8f06,_0x382956){_0x3c8f06=_0x3c8f06-0x0;var _0x50ace0=_0xe485[_0x3c8f06];return _0x50ace0;};'use strict';var multer=require('multer');var util=require(_0x5e48('0x0'));var path=require('path');var timeout=require(_0x5e48('0x1'));var express=require(_0x5e48('0x2'));var router=express[_0x5e48('0x3')]();var fs_extra=require(_0x5e48('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e48('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x5e48('0x6')]('/',auth['isAuthenticated'](),controller[_0x5e48('0x7')]);router['get']('/:id',auth[_0x5e48('0x8')](),controller['show']);router[_0x5e48('0x6')](_0x5e48('0x9'),auth[_0x5e48('0x8')](),controller[_0x5e48('0xa')]);router[_0x5e48('0x6')]('/:id/fields',auth[_0x5e48('0x8')](),controller[_0x5e48('0xb')]);router[_0x5e48('0xc')]('/',auth[_0x5e48('0x8')](),controller[_0x5e48('0xd')]);router[_0x5e48('0xc')](_0x5e48('0x9'),auth[_0x5e48('0x8')](),controller[_0x5e48('0xe')]);router[_0x5e48('0xf')](_0x5e48('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5e48('0x11')](_0x5e48('0x10'),auth[_0x5e48('0x8')](),controller['destroy']);module[_0x5e48('0x12')]=router; \ No newline at end of file +var _0x8952=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','put','update'];(function(_0x3e7d27,_0xbbf73a){var _0xc8b3c8=function(_0x5be708){while(--_0x5be708){_0x3e7d27['push'](_0x3e7d27['shift']());}};_0xc8b3c8(++_0xbbf73a);}(_0x8952,0x87));var _0x2895=function(_0x2784cb,_0x5bc7de){_0x2784cb=_0x2784cb-0x0;var _0x35e84a=_0x8952[_0x2784cb];return _0x35e84a;};'use strict';var multer=require(_0x2895('0x0'));var util=require(_0x2895('0x1'));var path=require(_0x2895('0x2'));var timeout=require(_0x2895('0x3'));var express=require(_0x2895('0x4'));var router=express[_0x2895('0x5')]();var fs_extra=require(_0x2895('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2895('0x7'));router[_0x2895('0x8')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xa')]);router[_0x2895('0x8')](_0x2895('0xb'),auth['isAuthenticated'](),controller[_0x2895('0xc')]);router[_0x2895('0x8')]('/:id/configurations',auth[_0x2895('0x9')](),controller[_0x2895('0xd')]);router[_0x2895('0x8')](_0x2895('0xe'),auth[_0x2895('0x9')](),controller[_0x2895('0xf')]);router[_0x2895('0x10')]('/',auth[_0x2895('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0x2895('0x9')](),controller['addConfiguration']);router[_0x2895('0x11')](_0x2895('0xb'),auth[_0x2895('0x9')](),controller[_0x2895('0x12')]);router[_0x2895('0x13')](_0x2895('0xb'),auth['isAuthenticated'](),controller[_0x2895('0x14')]);module[_0x2895('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b2c7a36..6be8c47 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 _0xda2d=['exports','STRING','username'];(function(_0x4b0604,_0x549d7f){var _0x5a80e0=function(_0x124759){while(--_0x124759){_0x4b0604['push'](_0x4b0604['shift']());}};_0x5a80e0(++_0x549d7f);}(_0xda2d,0x102));var _0xdda2=function(_0x3a6f34,_0x20dd08){_0x3a6f34=_0x3a6f34-0x0;var _0x35eecc=_0xda2d[_0x3a6f34];return _0x35eecc;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'name':{'type':Sequelize[_0xdda2('0x1')]},'description':{'type':Sequelize[_0xdda2('0x1')]},'username':{'type':Sequelize[_0xdda2('0x1')],'unique':_0xdda2('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xdda2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5b12,0xa3));var _0x25b1=function(_0x2f959d,_0x3f7039){_0x2f959d=_0x2f959d-0x0;var _0x2f506e=_0x5b12[_0x2f959d];return _0x2f506e;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('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 8602f2e..d88977f 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 _0x39cb=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','FreshdeskConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status'];(function(_0xe3cdae,_0x152d75){var _0x427679=function(_0x58539b){while(--_0x58539b){_0xe3cdae['push'](_0xe3cdae['shift']());}};_0x427679(++_0x152d75);}(_0x39cb,0x1bd));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb39c('0x0'));var zipdir=require(_0xb39c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb39c('0x4'));var util=require(_0xb39c('0x5'));var path=require(_0xb39c('0x6'));var sox=require(_0xb39c('0x7'));var csv=require(_0xb39c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb39c('0x9'));var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0x8'));var querystring=require(_0xb39c('0xd'));var Papa=require(_0xb39c('0xe'));var Redis=require(_0xb39c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x10'));var logger=require(_0xb39c('0x11'))(_0xb39c('0x12'));var utils=require(_0xb39c('0x13'));var config=require(_0xb39c('0x14'));var licenseUtil=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];var integrations=require(_0xb39c('0x17'));function respondWithStatusCode(_0x51ff24,_0x31e07e){_0x31e07e=_0x31e07e||0xcc;return function(_0x468995){if(_0x468995){return _0x51ff24[_0xb39c('0x18')](_0x31e07e);}return _0x51ff24['status'](_0x31e07e)[_0xb39c('0x19')]();};}function respondWithResult(_0x40a6d3,_0x42a203){_0x42a203=_0x42a203||0xc8;return function(_0x386c80){if(_0x386c80){return _0x40a6d3[_0xb39c('0x1a')](_0x42a203)[_0xb39c('0x1b')](_0x386c80);}};}function respondWithFilteredResult(_0x8e9181,_0x5277ce){return function(_0x316c9b){if(_0x316c9b){var _0x3223f6=typeof _0x5277ce[_0xb39c('0x1c')]===_0xb39c('0x1d')&&typeof _0x5277ce[_0xb39c('0x1e')]===_0xb39c('0x1d');var _0x1a2f48=_0x316c9b[_0xb39c('0x1f')];var _0x35dade=_0x3223f6?0x0:_0x5277ce[_0xb39c('0x1c')];var _0x559ad6=_0x3223f6?_0x316c9b[_0xb39c('0x1f')]:_0x5277ce[_0xb39c('0x1c')]+_0x5277ce[_0xb39c('0x1e')];var _0x447352;if(_0x559ad6>=_0x1a2f48){_0x559ad6=_0x1a2f48;_0x447352=0xc8;}else{_0x447352=0xce;}_0x8e9181['status'](_0x447352);return _0x8e9181[_0xb39c('0x20')](_0xb39c('0x21'),_0x35dade+'-'+_0x559ad6+'/'+_0x1a2f48)['json'](_0x316c9b);}return null;};}function patchUpdates(_0x2d8e93){return function(_0x363e52){try{jsonpatch[_0xb39c('0x22')](_0x363e52,_0x2d8e93,!![]);}catch(_0x4ebfca){return BPromise['reject'](_0x4ebfca);}return _0x363e52[_0xb39c('0x23')]();};}function saveUpdates(_0x1a5b9d,_0x3c8dfd){return function(_0x5719e2){if(_0x5719e2){return _0x5719e2[_0xb39c('0x24')](_0x1a5b9d)[_0xb39c('0x25')](function(_0x1bb895){return _0x1bb895;});}return null;};}function removeEntity(_0x16f3b0,_0x3b03ed){return function(_0x4a32f6){if(_0x4a32f6){return _0x4a32f6[_0xb39c('0x26')]()[_0xb39c('0x25')](function(){_0x16f3b0['status'](0xcc)[_0xb39c('0x19')]();});}};}function handleEntityNotFound(_0x4492a4,_0x39116b){return function(_0x12be70){if(!_0x12be70){_0x4492a4[_0xb39c('0x18')](0x194);}return _0x12be70;};}function handleError(_0x5453a6,_0x23a2f1){_0x23a2f1=_0x23a2f1||0x1f4;return function(_0x299c27){logger[_0xb39c('0x27')](_0x299c27['stack']);if(_0x299c27[_0xb39c('0x28')]){delete _0x299c27[_0xb39c('0x28')];}_0x5453a6['status'](_0x23a2f1)[_0xb39c('0x29')](_0x299c27);};}exports[_0xb39c('0x2a')]=function(_0x328db1,_0x4e9672){var _0x714d20={},_0x45fed4={},_0x59172f={'count':0x0,'rows':[]};var _0x2bc742=_['map'](db[_0xb39c('0x2b')][_0xb39c('0x2c')],function(_0x309697){return{'name':_0x309697[_0xb39c('0x2d')],'type':_0x309697[_0xb39c('0x2e')]['key']};});_0x45fed4[_0xb39c('0x2f')]=_['map'](_0x2bc742,_0xb39c('0x28'));_0x45fed4['query']=_[_0xb39c('0x30')](_0x328db1[_0xb39c('0x31')]);_0x45fed4[_0xb39c('0x32')]=_[_0xb39c('0x33')](_0x45fed4['model'],_0x45fed4['query']);_0x714d20[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x45fed4['model'],qs[_0xb39c('0x35')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x35')]));_0x714d20[_0xb39c('0x34')]=_0x714d20[_0xb39c('0x34')][_0xb39c('0x36')]?_0x714d20[_0xb39c('0x34')]:_0x45fed4[_0xb39c('0x2f')];if(!_0x328db1[_0xb39c('0x31')][_0xb39c('0x37')](_0xb39c('0x38'))){_0x714d20[_0xb39c('0x1e')]=qs[_0xb39c('0x1e')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x1e')]);_0x714d20[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x1c')]);}_0x714d20['order']=qs[_0xb39c('0x39')](_0x328db1[_0xb39c('0x31')]['sort']);_0x714d20['where']=qs['filters'](_[_0xb39c('0x3a')](_0x328db1[_0xb39c('0x31')],_0x45fed4[_0xb39c('0x32')]),_0x2bc742);if(_0x328db1['query'][_0xb39c('0x3b')]){_0x714d20[_0xb39c('0x3c')]=_[_0xb39c('0x3d')](_0x714d20[_0xb39c('0x3c')],{'$or':_[_0xb39c('0x3e')](_0x2bc742,function(_0x4b51ac){if(_0x4b51ac[_0xb39c('0x2e')]!==_0xb39c('0x3f')){var _0x51b489={};_0x51b489[_0x4b51ac[_0xb39c('0x28')]]={'$like':'%'+_0x328db1['query'][_0xb39c('0x3b')]+'%'};return _0x51b489;}})});}_0x714d20=_[_0xb39c('0x3d')]({},_0x714d20,_0x328db1[_0xb39c('0x40')]);var _0x4c043a={'where':_0x714d20[_0xb39c('0x3c')]};return db[_0xb39c('0x2b')][_0xb39c('0x1f')](_0x4c043a)[_0xb39c('0x25')](function(_0x10b87b){_0x59172f[_0xb39c('0x1f')]=_0x10b87b;if(_0x328db1[_0xb39c('0x31')][_0xb39c('0x41')]){_0x714d20[_0xb39c('0x42')]=[{'all':!![]}];}return db[_0xb39c('0x2b')][_0xb39c('0x43')](_0x714d20);})[_0xb39c('0x25')](function(_0x53347e){_0x59172f[_0xb39c('0x44')]=_0x53347e;return _0x59172f;})[_0xb39c('0x25')](respondWithFilteredResult(_0x4e9672,_0x714d20))[_0xb39c('0x45')](handleError(_0x4e9672,null));};exports[_0xb39c('0x46')]=function(_0x3d301e,_0x390cd7){var _0x1db549={'raw':![],'where':{'id':_0x3d301e[_0xb39c('0x47')]['id']}},_0x8cb33a={};_0x8cb33a['model']=_['keys'](db[_0xb39c('0x2b')][_0xb39c('0x2c')]);_0x8cb33a['query']=_['keys'](_0x3d301e[_0xb39c('0x31')]);_0x8cb33a['filters']=_[_0xb39c('0x33')](_0x8cb33a[_0xb39c('0x2f')],_0x8cb33a[_0xb39c('0x31')]);_0x1db549[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x8cb33a['model'],qs[_0xb39c('0x35')](_0x3d301e[_0xb39c('0x31')]['fields']));_0x1db549['attributes']=_0x1db549[_0xb39c('0x34')]['length']?_0x1db549['attributes']:_0x8cb33a[_0xb39c('0x2f')];if(_0x3d301e[_0xb39c('0x31')][_0xb39c('0x41')]){_0x1db549[_0xb39c('0x42')]=[{'all':!![]}];}_0x1db549=_[_0xb39c('0x3d')]({},_0x1db549,_0x3d301e[_0xb39c('0x40')]);return db[_0xb39c('0x2b')][_0xb39c('0x48')](_0x1db549)[_0xb39c('0x25')](handleEntityNotFound(_0x390cd7,null))[_0xb39c('0x25')](respondWithResult(_0x390cd7,null))['catch'](handleError(_0x390cd7,null));};exports[_0xb39c('0x49')]=function(_0x7e9750,_0xe329bf){return db[_0xb39c('0x2b')][_0xb39c('0x49')](_0x7e9750[_0xb39c('0x4a')],{})[_0xb39c('0x25')](respondWithResult(_0xe329bf,0xc9))[_0xb39c('0x45')](handleError(_0xe329bf,null));};exports[_0xb39c('0x24')]=function(_0x1ae2cb,_0x2150aa){if(_0x1ae2cb[_0xb39c('0x4a')]['id']){delete _0x1ae2cb[_0xb39c('0x4a')]['id'];}return db[_0xb39c('0x2b')][_0xb39c('0x48')]({'where':{'id':_0x1ae2cb[_0xb39c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2150aa,null))[_0xb39c('0x25')](saveUpdates(_0x1ae2cb[_0xb39c('0x4a')],null))[_0xb39c('0x25')](respondWithResult(_0x2150aa,null))[_0xb39c('0x45')](handleError(_0x2150aa,null));};exports[_0xb39c('0x26')]=function(_0x18db8f,_0xd4f368){return db[_0xb39c('0x2b')]['find']({'where':{'id':_0x18db8f['params']['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0xd4f368,null))[_0xb39c('0x25')](removeEntity(_0xd4f368,null))['catch'](handleError(_0xd4f368,null));};exports['getConfigurations']=function(_0x226f60,_0x1d1abf,_0x538258){var _0x2a55db={};var _0x55b6b1={};var _0x5e367e;var _0x2d88dd;return db['FreshdeskAccount'][_0xb39c('0x4b')]({'where':{'id':_0x226f60[_0xb39c('0x47')]['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0x1d1abf,null))[_0xb39c('0x25')](function(_0x2f2944){if(_0x2f2944){_0x5e367e=_0x2f2944;_0x55b6b1[_0xb39c('0x2f')]=_['keys'](db[_0xb39c('0x4c')][_0xb39c('0x2c')]);_0x55b6b1[_0xb39c('0x31')]=_[_0xb39c('0x30')](_0x226f60[_0xb39c('0x31')]);_0x55b6b1['filters']=_[_0xb39c('0x33')](_0x55b6b1['model'],_0x55b6b1[_0xb39c('0x31')]);_0x2a55db[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x55b6b1[_0xb39c('0x2f')],qs[_0xb39c('0x35')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x35')]));_0x2a55db[_0xb39c('0x34')]=_0x2a55db[_0xb39c('0x34')][_0xb39c('0x36')]?_0x2a55db[_0xb39c('0x34')]:_0x55b6b1[_0xb39c('0x2f')];_0x2a55db[_0xb39c('0x4d')]=qs[_0xb39c('0x39')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x39')]);_0x2a55db[_0xb39c('0x3c')]=qs[_0xb39c('0x32')](_[_0xb39c('0x3a')](_0x226f60['query'],_0x55b6b1['filters']));if(_0x226f60[_0xb39c('0x31')][_0xb39c('0x3b')]){_0x2a55db['where']=_[_0xb39c('0x3d')](_0x2a55db[_0xb39c('0x3c')],{'$or':_['map'](_0x2a55db[_0xb39c('0x34')],function(_0x121545){var _0x129d1f={};_0x129d1f[_0x121545]={'$like':'%'+_0x226f60[_0xb39c('0x31')][_0xb39c('0x3b')]+'%'};return _0x129d1f;})});}_0x2a55db=_[_0xb39c('0x3d')]({},_0x2a55db,_0x226f60['options']);return _0x5e367e[_0xb39c('0x4e')](_0x2a55db);}})[_0xb39c('0x25')](function(_0x1c16c5){if(_0x1c16c5){_0x2d88dd=_0x1c16c5[_0xb39c('0x36')];if(!_0x226f60[_0xb39c('0x31')][_0xb39c('0x37')](_0xb39c('0x38'))){_0x2a55db['limit']=qs[_0xb39c('0x1e')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x1e')]);_0x2a55db[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x226f60['query']['offset']);}return _0x5e367e[_0xb39c('0x4e')](_0x2a55db);}})[_0xb39c('0x25')](function(_0x26b55f){if(_0x26b55f){return _0x26b55f?{'count':_0x2d88dd,'rows':_0x26b55f}:null;}})['then'](respondWithResult(_0x1d1abf,null))[_0xb39c('0x45')](handleError(_0x1d1abf,null));};exports['addConfiguration']=function(_0x2f3c24,_0x5ce5fb,_0x1abe57){if(_0x2f3c24[_0xb39c('0x4a')]['id']){delete _0x2f3c24[_0xb39c('0x4a')]['id'];}return db['FreshdeskAccount'][_0xb39c('0x4b')]({'where':{'id':_0x2f3c24[_0xb39c('0x47')]['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0x5ce5fb,null))[_0xb39c('0x25')](function(_0x3e8783){if(_0x3e8783){_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x4f')]=_0x3e8783['id'];_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x50')]=integrations[_0xb39c('0x51')](_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x52')],_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x2e')]);_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x53')]=integrations[_0xb39c('0x54')](_0x2f3c24['body'][_0xb39c('0x52')],_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x2e')]);return db['FreshdeskConfiguration'][_0xb39c('0x49')](_0x2f3c24['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xb39c('0x50')},{'model':db[_0xb39c('0x55')],'as':_0xb39c('0x53')}]});}return null;})[_0xb39c('0x25')](respondWithResult(_0x5ce5fb,null))[_0xb39c('0x45')](handleError(_0x5ce5fb,null));};exports['getFields']=function(_0x5de073,_0x26d08c,_0x27723c){var _0x5cfd2a='';return db[_0xb39c('0x2b')][_0xb39c('0x4b')]({'where':{'id':_0x5de073[_0xb39c('0x47')]['id']},'attributes':['id',_0xb39c('0x56'),_0xb39c('0x57')]})[_0xb39c('0x25')](handleEntityNotFound(_0x26d08c,null))[_0xb39c('0x25')](function(_0xfe586){if(_0xfe586){_0x5cfd2a=_0xfe586[_0xb39c('0x56')];var _0x2f7fc1=_0x5cfd2a[_0xb39c('0x58')](-0x1);if(_0x2f7fc1==='/'){_0x5cfd2a=_0x5cfd2a[_0xb39c('0x59')](0x0,_0x5cfd2a[_0xb39c('0x5a')](_0x2f7fc1));}return rp({'method':_0xb39c('0x5b'),'uri':util[_0xb39c('0x5c')]('%s/%s',_0x5cfd2a,_0xb39c('0x5d')),'headers':{'Authorization':util['format'](_0xb39c('0x5e'),new Buffer(util[_0xb39c('0x5c')]('%s:X',_0xfe586[_0xb39c('0x57')]))[_0xb39c('0x5f')](_0xb39c('0x60')))},'json':!![]});}})[_0xb39c('0x25')](function(_0x2021f0){if(_0x2021f0){var _0x382640=['requester',_0xb39c('0x61'),_0xb39c('0x62'),_0xb39c('0x63'),_0xb39c('0x1a'),_0xb39c('0x64'),_0xb39c('0x65'),_0xb39c('0x66'),_0xb39c('0x67'),_0xb39c('0x65'),'company'];_[_0xb39c('0x68')](_0x2021f0,function(_0x20610f){return _0x382640[_0xb39c('0x69')](_0x20610f[_0xb39c('0x28')])||!_0x20610f[_0xb39c('0x6a')]&&_0x20610f[_0xb39c('0x2e')]!==_0xb39c('0x6b')&&_0x20610f['type']!==_0xb39c('0x6c');});return{'count':_0x2021f0[_0xb39c('0x36')],'rows':_[_0xb39c('0x3e')](_0x2021f0,function(_0x205329){return{'id':_0x205329[_0xb39c('0x28')],'name':_0x205329[_0xb39c('0x6d')],'custom':!_0x205329[_0xb39c('0x6a')],'options':_0x205329[_0xb39c('0x6e')]?_['map'](_0x205329[_0xb39c('0x6e')],function(_0x52cb9d){return{'name':_[_0xb39c('0x6f')](_0x52cb9d),'value':_0x52cb9d};}):[]};})};}})[_0xb39c('0x25')](respondWithResult(_0x26d08c,null))[_0xb39c('0x45')](function(_0xeab93a){var _0x37f395=_0x5de073[_0xb39c('0x31')][_0xb39c('0x70')]?0x1f4:_0xeab93a[_0xb39c('0x71')]||0x1f4;logger['error'](_0xb39c('0x72'),_0xb39c('0x73'),_0x37f395,JSON[_0xb39c('0x74')](_0xeab93a));delete _0xeab93a[_0xb39c('0x28')];if(_0x37f395===0x191){_0x37f395=0x190;}_0x26d08c[_0xb39c('0x1a')](_0x37f395)[_0xb39c('0x29')](_0x5de073[_0xb39c('0x31')][_0xb39c('0x70')]?{'message':_0xb39c('0x75'),'statusCode':_0xeab93a[_0xb39c('0x71')]}:_0xeab93a);});}; \ No newline at end of file +var _0x2179=['end','name','send','map','FreshdeskAccount','fieldName','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','fields','length','include','create','body','find','destroy','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','description','priority','group','source','company','remove','includes','default','custom_dropdown','choices','error','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x584bd7,_0x3fd50f){var _0x36671e=function(_0x1e7fc7){while(--_0x1e7fc7){_0x584bd7['push'](_0x584bd7['shift']());}};_0x36671e(++_0x3fd50f);}(_0x2179,0xc0));var _0x9217=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0x2179[_0x12aba8];return _0x2aac66;};'use strict';var emlformat=require(_0x9217('0x0'));var rimraf=require(_0x9217('0x1'));var zipdir=require(_0x9217('0x2'));var jsonpatch=require(_0x9217('0x3'));var rp=require(_0x9217('0x4'));var moment=require(_0x9217('0x5'));var BPromise=require(_0x9217('0x6'));var Mustache=require(_0x9217('0x7'));var util=require(_0x9217('0x8'));var path=require(_0x9217('0x9'));var sox=require(_0x9217('0xa'));var csv=require(_0x9217('0xb'));var ejs=require(_0x9217('0xc'));var fs=require('fs');var fs_extra=require(_0x9217('0xd'));var _=require(_0x9217('0xe'));var squel=require('squel');var crypto=require(_0x9217('0xf'));var jsforce=require(_0x9217('0x10'));var deskjs=require(_0x9217('0x11'));var toCsv=require(_0x9217('0xb'));var querystring=require(_0x9217('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9217('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9217('0x14'));var hardwareService=require(_0x9217('0x15'));var logger=require(_0x9217('0x16'))('api');var utils=require(_0x9217('0x17'));var config=require(_0x9217('0x18'));var licenseUtil=require(_0x9217('0x19'));var db=require(_0x9217('0x1a'))['db'];var integrations=require(_0x9217('0x1b'));function respondWithStatusCode(_0xb21639,_0x11c99d){_0x11c99d=_0x11c99d||0xcc;return function(_0x1f69bb){if(_0x1f69bb){return _0xb21639['sendStatus'](_0x11c99d);}return _0xb21639[_0x9217('0x1c')](_0x11c99d)['end']();};}function respondWithResult(_0x3a4473,_0x21da75){_0x21da75=_0x21da75||0xc8;return function(_0x249f1d){if(_0x249f1d){return _0x3a4473[_0x9217('0x1c')](_0x21da75)[_0x9217('0x1d')](_0x249f1d);}};}function respondWithFilteredResult(_0x1e1a2e,_0x3f6977){return function(_0x13c330){if(_0x13c330){var _0x2c3ba9=typeof _0x3f6977[_0x9217('0x1e')]===_0x9217('0x1f')&&typeof _0x3f6977[_0x9217('0x20')]===_0x9217('0x1f');var _0x234634=_0x13c330[_0x9217('0x21')];var _0x2499b5=_0x2c3ba9?0x0:_0x3f6977[_0x9217('0x1e')];var _0x31410c=_0x2c3ba9?_0x13c330[_0x9217('0x21')]:_0x3f6977[_0x9217('0x1e')]+_0x3f6977[_0x9217('0x20')];var _0xe81f49;if(_0x31410c>=_0x234634){_0x31410c=_0x234634;_0xe81f49=0xc8;}else{_0xe81f49=0xce;}_0x1e1a2e[_0x9217('0x1c')](_0xe81f49);return _0x1e1a2e[_0x9217('0x22')](_0x9217('0x23'),_0x2499b5+'-'+_0x31410c+'/'+_0x234634)[_0x9217('0x1d')](_0x13c330);}return null;};}function patchUpdates(_0x32c877){return function(_0x3cc2fa){try{jsonpatch[_0x9217('0x24')](_0x3cc2fa,_0x32c877,!![]);}catch(_0x1c4676){return BPromise['reject'](_0x1c4676);}return _0x3cc2fa[_0x9217('0x25')]();};}function saveUpdates(_0x1f9a22,_0x15f107){return function(_0x37287f){if(_0x37287f){return _0x37287f[_0x9217('0x26')](_0x1f9a22)[_0x9217('0x27')](function(_0x53f2b8){return _0x53f2b8;});}return null;};}function removeEntity(_0x1205eb,_0x362c5b){return function(_0x3a6384){if(_0x3a6384){return _0x3a6384['destroy']()[_0x9217('0x27')](function(){_0x1205eb[_0x9217('0x1c')](0xcc)[_0x9217('0x28')]();});}};}function handleEntityNotFound(_0x3740fd,_0x41b16c){return function(_0x121cb8){if(!_0x121cb8){_0x3740fd['sendStatus'](0x194);}return _0x121cb8;};}function handleError(_0x28656d,_0x1fb79c){_0x1fb79c=_0x1fb79c||0x1f4;return function(_0x48412e){logger['error'](_0x48412e['stack']);if(_0x48412e[_0x9217('0x29')]){delete _0x48412e[_0x9217('0x29')];}_0x28656d[_0x9217('0x1c')](_0x1fb79c)[_0x9217('0x2a')](_0x48412e);};}exports['index']=function(_0xc30fc9,_0x3947b4){var _0x5c0563={},_0x4ca793={},_0xfa9b0f={'count':0x0,'rows':[]};var _0xdbf544=_[_0x9217('0x2b')](db[_0x9217('0x2c')]['rawAttributes'],function(_0x5c90f4){return{'name':_0x5c90f4[_0x9217('0x2d')],'type':_0x5c90f4['type'][_0x9217('0x2e')]};});_0x4ca793[_0x9217('0x2f')]=_[_0x9217('0x2b')](_0xdbf544,_0x9217('0x29'));_0x4ca793[_0x9217('0x30')]=_[_0x9217('0x31')](_0xc30fc9[_0x9217('0x30')]);_0x4ca793['filters']=_[_0x9217('0x32')](_0x4ca793[_0x9217('0x2f')],_0x4ca793[_0x9217('0x30')]);_0x5c0563['attributes']=_[_0x9217('0x32')](_0x4ca793[_0x9217('0x2f')],qs['fields'](_0xc30fc9[_0x9217('0x30')]['fields']));_0x5c0563['attributes']=_0x5c0563[_0x9217('0x33')]['length']?_0x5c0563['attributes']:_0x4ca793[_0x9217('0x2f')];if(!_0xc30fc9['query'][_0x9217('0x34')](_0x9217('0x35'))){_0x5c0563[_0x9217('0x20')]=qs['limit'](_0xc30fc9[_0x9217('0x30')][_0x9217('0x20')]);_0x5c0563[_0x9217('0x1e')]=qs['offset'](_0xc30fc9[_0x9217('0x30')]['offset']);}_0x5c0563[_0x9217('0x36')]=qs[_0x9217('0x37')](_0xc30fc9[_0x9217('0x30')]['sort']);_0x5c0563['where']=qs[_0x9217('0x38')](_[_0x9217('0x39')](_0xc30fc9[_0x9217('0x30')],_0x4ca793['filters']),_0xdbf544);if(_0xc30fc9[_0x9217('0x30')]['filter']){_0x5c0563[_0x9217('0x3a')]=_[_0x9217('0x3b')](_0x5c0563['where'],{'$or':_[_0x9217('0x2b')](_0xdbf544,function(_0x5ad8b4){if(_0x5ad8b4[_0x9217('0x3c')]!==_0x9217('0x3d')){var _0x327b1f={};_0x327b1f[_0x5ad8b4['name']]={'$like':'%'+_0xc30fc9[_0x9217('0x30')][_0x9217('0x3e')]+'%'};return _0x327b1f;}})});}_0x5c0563=_[_0x9217('0x3b')]({},_0x5c0563,_0xc30fc9[_0x9217('0x3f')]);var _0x47b77d={'where':_0x5c0563[_0x9217('0x3a')]};return db[_0x9217('0x2c')][_0x9217('0x21')](_0x47b77d)[_0x9217('0x27')](function(_0x58b2e3){_0xfa9b0f[_0x9217('0x21')]=_0x58b2e3;if(_0xc30fc9['query'][_0x9217('0x40')]){_0x5c0563['include']=[{'all':!![]}];}return db[_0x9217('0x2c')][_0x9217('0x41')](_0x5c0563);})[_0x9217('0x27')](function(_0x5d65cb){_0xfa9b0f['rows']=_0x5d65cb;return _0xfa9b0f;})[_0x9217('0x27')](respondWithFilteredResult(_0x3947b4,_0x5c0563))[_0x9217('0x42')](handleError(_0x3947b4,null));};exports[_0x9217('0x43')]=function(_0x461b25,_0x4b1946){var _0x4eb1b6={'raw':![],'where':{'id':_0x461b25[_0x9217('0x44')]['id']}},_0x186004={};_0x186004[_0x9217('0x2f')]=_[_0x9217('0x31')](db[_0x9217('0x2c')][_0x9217('0x45')]);_0x186004[_0x9217('0x30')]=_[_0x9217('0x31')](_0x461b25['query']);_0x186004[_0x9217('0x38')]=_['intersection'](_0x186004[_0x9217('0x2f')],_0x186004['query']);_0x4eb1b6['attributes']=_[_0x9217('0x32')](_0x186004[_0x9217('0x2f')],qs[_0x9217('0x46')](_0x461b25[_0x9217('0x30')]['fields']));_0x4eb1b6[_0x9217('0x33')]=_0x4eb1b6[_0x9217('0x33')][_0x9217('0x47')]?_0x4eb1b6['attributes']:_0x186004[_0x9217('0x2f')];if(_0x461b25[_0x9217('0x30')][_0x9217('0x40')]){_0x4eb1b6[_0x9217('0x48')]=[{'all':!![]}];}_0x4eb1b6=_[_0x9217('0x3b')]({},_0x4eb1b6,_0x461b25[_0x9217('0x3f')]);return db[_0x9217('0x2c')]['find'](_0x4eb1b6)['then'](handleEntityNotFound(_0x4b1946,null))['then'](respondWithResult(_0x4b1946,null))[_0x9217('0x42')](handleError(_0x4b1946,null));};exports[_0x9217('0x49')]=function(_0x8f7698,_0x3c39c6){return db['FreshdeskAccount']['create'](_0x8f7698[_0x9217('0x4a')],{})[_0x9217('0x27')](respondWithResult(_0x3c39c6,0xc9))[_0x9217('0x42')](handleError(_0x3c39c6,null));};exports[_0x9217('0x26')]=function(_0x2a9c5a,_0x395f16){if(_0x2a9c5a['body']['id']){delete _0x2a9c5a[_0x9217('0x4a')]['id'];}return db[_0x9217('0x2c')][_0x9217('0x4b')]({'where':{'id':_0x2a9c5a[_0x9217('0x44')]['id']}})['then'](handleEntityNotFound(_0x395f16,null))['then'](saveUpdates(_0x2a9c5a['body'],null))['then'](respondWithResult(_0x395f16,null))['catch'](handleError(_0x395f16,null));};exports[_0x9217('0x4c')]=function(_0x30ddbb,_0x7342a9){return db[_0x9217('0x2c')][_0x9217('0x4b')]({'where':{'id':_0x30ddbb[_0x9217('0x44')]['id']}})[_0x9217('0x27')](handleEntityNotFound(_0x7342a9,null))[_0x9217('0x27')](removeEntity(_0x7342a9,null))[_0x9217('0x42')](handleError(_0x7342a9,null));};exports[_0x9217('0x4d')]=function(_0xac1b51,_0x34eba2,_0x30ed77){var _0x5d3569={};var _0x4c9a0c={};var _0x28722b;var _0x2f9670;return db[_0x9217('0x2c')]['findOne']({'where':{'id':_0xac1b51[_0x9217('0x44')]['id']}})[_0x9217('0x27')](handleEntityNotFound(_0x34eba2,null))[_0x9217('0x27')](function(_0x13df44){if(_0x13df44){_0x28722b=_0x13df44;_0x4c9a0c['model']=_['keys'](db[_0x9217('0x4e')][_0x9217('0x45')]);_0x4c9a0c[_0x9217('0x30')]=_[_0x9217('0x31')](_0xac1b51['query']);_0x4c9a0c['filters']=_['intersection'](_0x4c9a0c[_0x9217('0x2f')],_0x4c9a0c['query']);_0x5d3569[_0x9217('0x33')]=_[_0x9217('0x32')](_0x4c9a0c[_0x9217('0x2f')],qs[_0x9217('0x46')](_0xac1b51[_0x9217('0x30')][_0x9217('0x46')]));_0x5d3569[_0x9217('0x33')]=_0x5d3569[_0x9217('0x33')][_0x9217('0x47')]?_0x5d3569[_0x9217('0x33')]:_0x4c9a0c[_0x9217('0x2f')];_0x5d3569[_0x9217('0x36')]=qs['sort'](_0xac1b51['query'][_0x9217('0x37')]);_0x5d3569[_0x9217('0x3a')]=qs[_0x9217('0x38')](_[_0x9217('0x39')](_0xac1b51[_0x9217('0x30')],_0x4c9a0c[_0x9217('0x38')]));if(_0xac1b51['query']['filter']){_0x5d3569[_0x9217('0x3a')]=_['merge'](_0x5d3569[_0x9217('0x3a')],{'$or':_['map'](_0x5d3569[_0x9217('0x33')],function(_0x16b43b){var _0x7fbc96={};_0x7fbc96[_0x16b43b]={'$like':'%'+_0xac1b51[_0x9217('0x30')]['filter']+'%'};return _0x7fbc96;})});}_0x5d3569=_[_0x9217('0x3b')]({},_0x5d3569,_0xac1b51[_0x9217('0x3f')]);return _0x28722b[_0x9217('0x4d')](_0x5d3569);}})[_0x9217('0x27')](function(_0x9a05ae){if(_0x9a05ae){_0x2f9670=_0x9a05ae[_0x9217('0x47')];if(!_0xac1b51['query']['hasOwnProperty'](_0x9217('0x35'))){_0x5d3569['limit']=qs[_0x9217('0x20')](_0xac1b51[_0x9217('0x30')][_0x9217('0x20')]);_0x5d3569[_0x9217('0x1e')]=qs[_0x9217('0x1e')](_0xac1b51[_0x9217('0x30')][_0x9217('0x1e')]);}return _0x28722b[_0x9217('0x4d')](_0x5d3569);}})[_0x9217('0x27')](function(_0x31ba44){if(_0x31ba44){return _0x31ba44?{'count':_0x2f9670,'rows':_0x31ba44}:null;}})[_0x9217('0x27')](respondWithResult(_0x34eba2,null))['catch'](handleError(_0x34eba2,null));};exports[_0x9217('0x4f')]=function(_0x4c36a8,_0xb037aa,_0x3f00a5){if(_0x4c36a8[_0x9217('0x4a')]['id']){delete _0x4c36a8[_0x9217('0x4a')]['id'];}return db['FreshdeskAccount'][_0x9217('0x50')]({'where':{'id':_0x4c36a8[_0x9217('0x44')]['id']}})['then'](handleEntityNotFound(_0xb037aa,null))[_0x9217('0x27')](function(_0x37d106){if(_0x37d106){_0x4c36a8[_0x9217('0x4a')][_0x9217('0x51')]=_0x37d106['id'];_0x4c36a8[_0x9217('0x4a')]['Subjects']=integrations[_0x9217('0x52')](_0x4c36a8[_0x9217('0x4a')][_0x9217('0x53')],_0x4c36a8['body']['type']);_0x4c36a8[_0x9217('0x4a')][_0x9217('0x54')]=integrations[_0x9217('0x55')](_0x4c36a8[_0x9217('0x4a')][_0x9217('0x53')],_0x4c36a8[_0x9217('0x4a')][_0x9217('0x3c')]);return db['FreshdeskConfiguration'][_0x9217('0x49')](_0x4c36a8[_0x9217('0x4a')],{'include':[{'model':db['FreshdeskField'],'as':_0x9217('0x56')},{'model':db[_0x9217('0x57')],'as':_0x9217('0x54')}]});}return null;})[_0x9217('0x27')](respondWithResult(_0xb037aa,null))[_0x9217('0x42')](handleError(_0xb037aa,null));};exports['getFields']=function(_0x2d6b95,_0x5da262,_0x423181){var _0x2380fb='';return db[_0x9217('0x2c')][_0x9217('0x50')]({'where':{'id':_0x2d6b95[_0x9217('0x44')]['id']},'attributes':['id',_0x9217('0x58'),_0x9217('0x59')]})[_0x9217('0x27')](handleEntityNotFound(_0x5da262,null))['then'](function(_0xd9d95){if(_0xd9d95){_0x2380fb=_0xd9d95[_0x9217('0x58')];var _0x57029b=_0x2380fb[_0x9217('0x5a')](-0x1);if(_0x57029b==='/'){_0x2380fb=_0x2380fb[_0x9217('0x5b')](0x0,_0x2380fb[_0x9217('0x5c')](_0x57029b));}return rp({'method':_0x9217('0x5d'),'uri':util[_0x9217('0x5e')](_0x9217('0x5f'),_0x2380fb,_0x9217('0x60')),'headers':{'Authorization':util['format'](_0x9217('0x61'),new Buffer(util[_0x9217('0x5e')](_0x9217('0x62'),_0xd9d95[_0x9217('0x59')]))['toString']('base64'))},'json':!![]});}})[_0x9217('0x27')](function(_0xc4ec5f){if(_0xc4ec5f){var _0x2b34c1=[_0x9217('0x63'),'subject','agent',_0x9217('0x64'),_0x9217('0x1c'),_0x9217('0x65'),_0x9217('0x66'),_0x9217('0x67'),'ticket_type',_0x9217('0x66'),_0x9217('0x68')];_[_0x9217('0x69')](_0xc4ec5f,function(_0x166f82){return _0x2b34c1[_0x9217('0x6a')](_0x166f82[_0x9217('0x29')])||!_0x166f82[_0x9217('0x6b')]&&_0x166f82[_0x9217('0x3c')]!=='custom_text'&&_0x166f82['type']!==_0x9217('0x6c');});return{'count':_0xc4ec5f[_0x9217('0x47')],'rows':_['map'](_0xc4ec5f,function(_0x296aa4){return{'id':_0x296aa4['name'],'name':_0x296aa4['label'],'custom':!_0x296aa4['default'],'options':_0x296aa4[_0x9217('0x6d')]?_[_0x9217('0x2b')](_0x296aa4[_0x9217('0x6d')],function(_0x530ee6){return{'name':_['capitalize'](_0x530ee6),'value':_0x530ee6};}):[]};})};}})[_0x9217('0x27')](respondWithResult(_0x5da262,null))['catch'](function(_0x583819){var _0x329cc1=_0x2d6b95['query']['test']?0x1f4:_0x583819['statusCode']||0x1f4;logger[_0x9217('0x6e')](_0x9217('0x6f'),_0x9217('0x70'),_0x329cc1,JSON['stringify'](_0x583819));delete _0x583819[_0x9217('0x29')];if(_0x329cc1===0x191){_0x329cc1=0x190;}_0x5da262[_0x9217('0x1c')](_0x329cc1)['send'](_0x2d6b95[_0x9217('0x30')][_0x9217('0x71')]?{'message':_0x9217('0x72'),'statusCode':_0x583819[_0x9217('0x73')]}:_0x583819);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 943f7bd..8b51573 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 _0x11cf=['bluebird','request-promise','path','rimraf','exports','FreshdeskAccount','util','../../config/logger','api'];(function(_0x15f0bf,_0x426976){var _0x5c303f=function(_0x4d703f){while(--_0x4d703f){_0x15f0bf['push'](_0x15f0bf['shift']());}};_0x5c303f(++_0x426976);}(_0x11cf,0x9f));var _0xf11c=function(_0x1f4d6f,_0x51aac7){_0x1f4d6f=_0x1f4d6f-0x0;var _0x389e47=_0x11cf[_0x1f4d6f];return _0x389e47;};'use strict';var _=require('lodash');var util=require(_0xf11c('0x0'));var logger=require(_0xf11c('0x1'))(_0xf11c('0x2'));var moment=require('moment');var BPromise=require(_0xf11c('0x3'));var rp=require(_0xf11c('0x4'));var fs=require('fs');var path=require(_0xf11c('0x5'));var rimraf=require(_0xf11c('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xf11c('0x7')]=function(_0x9743c5,_0x441cec){return _0x9743c5['define'](_0xf11c('0x8'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ffc=['./intFreshdeskAccount.attributes','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3ffc,0x7c));var _0xc3ff=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x3ffc[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xc3ff('0x0'));var util=require(_0xc3ff('0x1'));var logger=require('../../config/logger')(_0xc3ff('0x2'));var moment=require(_0xc3ff('0x3'));var BPromise=require(_0xc3ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3ff('0x5'));var rimraf=require(_0xc3ff('0x6'));var config=require(_0xc3ff('0x7'));var attributes=require(_0xc3ff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc3ff('0x9')]=function(_0x2685a0,_0x100a87){return _0x2685a0['define'](_0xc3ff('0xa'),attributes,{'tableName':_0xc3ff('0xb'),'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 15ae2cb..d2968f7 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 _0x7550=['raw','options','where','attributes','limit','map','include','model','ShowFreshdeskAccount','FreshdeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','findAll'];(function(_0x21084d,_0x24bc55){var _0x19712b=function(_0x3937a8){while(--_0x3937a8){_0x21084d['push'](_0x21084d['shift']());}};_0x19712b(++_0x24bc55);}(_0x7550,0x133));var _0x0755=function(_0x5b81db,_0xa06414){_0x5b81db=_0x5b81db-0x0;var _0x5a2af6=_0x7550[_0x5b81db];return _0x5a2af6;};'use strict';var _=require('lodash');var util=require(_0x0755('0x0'));var moment=require(_0x0755('0x1'));var BPromise=require(_0x0755('0x2'));var rs=require(_0x0755('0x3'));var fs=require('fs');var Redis=require(_0x0755('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0755('0x5'));var logger=require(_0x0755('0x6'))(_0x0755('0x7'));var config=require(_0x0755('0x8'));var jayson=require(_0x0755('0x9'));var client=jayson[_0x0755('0xa')][_0x0755('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ffbf,_0x31f1a5,_0x556da8){return new BPromise(function(_0x4e09b6,_0x25345e){return client[_0x0755('0xc')](_0x11ffbf,_0x556da8)[_0x0755('0xd')](function(_0x4d05bc){logger[_0x0755('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x31f1a5,_0x0755('0xf'));logger[_0x0755('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x31f1a5,'request\x20sent',JSON[_0x0755('0x11')](_0x4d05bc));if(_0x4d05bc[_0x0755('0x12')]){if(_0x4d05bc[_0x0755('0x12')][_0x0755('0x13')]===0x1f4){logger['error'](_0x0755('0x14'),_0x31f1a5,_0x4d05bc[_0x0755('0x12')][_0x0755('0x15')]);return _0x25345e(_0x4d05bc['error'][_0x0755('0x15')]);}logger[_0x0755('0x12')](_0x0755('0x14'),_0x31f1a5,_0x4d05bc[_0x0755('0x12')][_0x0755('0x15')]);return _0x4e09b6(_0x4d05bc['error']['message']);}else{logger[_0x0755('0xe')](_0x0755('0x14'),_0x31f1a5,_0x0755('0xf'));_0x4e09b6(_0x4d05bc[_0x0755('0x16')][_0x0755('0x15')]);}})[_0x0755('0x17')](function(_0x30ce0b){logger[_0x0755('0x12')](_0x0755('0x14'),_0x31f1a5,_0x30ce0b);_0x25345e(_0x30ce0b);});});}exports[_0x0755('0x18')]=function(_0x8dea61){var _0x3541f5=this;return new Promise(function(_0x2e839f,_0x1b34d0){return db['FreshdeskAccount'][_0x0755('0x19')]({'raw':_0x8dea61['options']?_0x8dea61['options'][_0x0755('0x1a')]===undefined?!![]:![]:!![],'where':_0x8dea61[_0x0755('0x1b')]?_0x8dea61[_0x0755('0x1b')][_0x0755('0x1c')]||null:null,'attributes':_0x8dea61[_0x0755('0x1b')]?_0x8dea61[_0x0755('0x1b')][_0x0755('0x1d')]||null:null,'limit':_0x8dea61['options']?_0x8dea61[_0x0755('0x1b')][_0x0755('0x1e')]||null:null,'include':_0x8dea61[_0x0755('0x1b')]?_0x8dea61[_0x0755('0x1b')]['include']?_[_0x0755('0x1f')](_0x8dea61[_0x0755('0x1b')][_0x0755('0x20')],function(_0x272158){return{'model':db[_0x272158[_0x0755('0x21')]],'as':_0x272158['as'],'attributes':_0x272158['attributes'],'include':_0x272158[_0x0755('0x20')]?_['map'](_0x272158[_0x0755('0x20')],function(_0x92e7e3){return{'model':db[_0x92e7e3[_0x0755('0x21')]],'as':_0x92e7e3['as'],'attributes':_0x92e7e3[_0x0755('0x1d')],'include':_0x92e7e3[_0x0755('0x20')]?_['map'](_0x92e7e3[_0x0755('0x20')],function(_0x453c3c){return{'model':db[_0x453c3c[_0x0755('0x21')]],'as':_0x453c3c['as'],'attributes':_0x453c3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0755('0xd')](function(_0x4633cf){logger['info'](_0x0755('0x18'),_0x8dea61);logger[_0x0755('0x10')](_0x0755('0x18'),_0x8dea61,JSON[_0x0755('0x11')](_0x4633cf));_0x2e839f(_0x4633cf);})[_0x0755('0x17')](function(_0x4de9b1){logger[_0x0755('0x12')]('GetFreshdeskAccount',_0x4de9b1[_0x0755('0x15')],_0x8dea61);_0x1b34d0(_0x3541f5['error'](0x1f4,_0x4de9b1[_0x0755('0x15')]));});});};exports[_0x0755('0x22')]=function(_0x1b2608){var _0x1d6156=this;return new Promise(function(_0x20cc4c,_0x38e1cf){return db[_0x0755('0x23')][_0x0755('0x24')]({'raw':_0x1b2608[_0x0755('0x1b')]?_0x1b2608[_0x0755('0x1b')][_0x0755('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b2608[_0x0755('0x1b')]?_0x1b2608[_0x0755('0x1b')][_0x0755('0x1c')]||null:null,'attributes':_0x1b2608[_0x0755('0x1b')]?_0x1b2608[_0x0755('0x1b')][_0x0755('0x1d')]||null:null,'include':_0x1b2608[_0x0755('0x1b')]?_0x1b2608[_0x0755('0x1b')]['include']?_[_0x0755('0x1f')](_0x1b2608[_0x0755('0x1b')][_0x0755('0x20')],function(_0x2c46ed){return{'model':db[_0x2c46ed[_0x0755('0x21')]],'as':_0x2c46ed['as'],'attributes':_0x2c46ed[_0x0755('0x1d')],'include':_0x2c46ed['include']?_['map'](_0x2c46ed[_0x0755('0x20')],function(_0x54be0b){return{'model':db[_0x54be0b[_0x0755('0x21')]],'as':_0x54be0b['as'],'attributes':_0x54be0b[_0x0755('0x1d')],'include':_0x54be0b[_0x0755('0x20')]?_[_0x0755('0x1f')](_0x54be0b['include'],function(_0x4775e1){return{'model':db[_0x4775e1['model']],'as':_0x4775e1['as'],'attributes':_0x4775e1[_0x0755('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0755('0xd')](function(_0x5d7050){logger[_0x0755('0xe')](_0x0755('0x22'),_0x1b2608);logger['debug'](_0x0755('0x22'),_0x1b2608,JSON['stringify'](_0x5d7050));_0x20cc4c(_0x5d7050);})[_0x0755('0x17')](function(_0x9323da){logger[_0x0755('0x12')](_0x0755('0x22'),_0x9323da[_0x0755('0x15')],_0x1b2608);_0x38e1cf(_0x1d6156['error'](0x1f4,_0x9323da[_0x0755('0x15')]));});});}; \ No newline at end of file +var _0x8eba=['raw','where','attributes','include','map','model','GetFreshdeskAccount','stringify','FreshdeskAccount','then','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options'];(function(_0x1716ac,_0x245897){var _0xa54aaa=function(_0x4f919b){while(--_0x4f919b){_0x1716ac['push'](_0x1716ac['shift']());}};_0xa54aaa(++_0x245897);}(_0x8eba,0x97));var _0xa8eb=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x8eba[_0x126f47];return _0x49508a;};'use strict';var _=require(_0xa8eb('0x0'));var util=require(_0xa8eb('0x1'));var moment=require(_0xa8eb('0x2'));var BPromise=require(_0xa8eb('0x3'));var rs=require(_0xa8eb('0x4'));var fs=require('fs');var Redis=require(_0xa8eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8eb('0x6'));var logger=require(_0xa8eb('0x7'))(_0xa8eb('0x8'));var config=require(_0xa8eb('0x9'));var jayson=require(_0xa8eb('0xa'));var client=jayson[_0xa8eb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b3eb,_0x12b972,_0xc8c1dc){return new BPromise(function(_0x1076b7,_0x3ec6a0){return client[_0xa8eb('0xc')](_0x32b3eb,_0xc8c1dc)['then'](function(_0x22d4af){logger[_0xa8eb('0xd')](_0xa8eb('0xe'),_0x12b972,_0xa8eb('0xf'));logger[_0xa8eb('0x10')](_0xa8eb('0x11'),_0x12b972,_0xa8eb('0xf'),JSON['stringify'](_0x22d4af));if(_0x22d4af[_0xa8eb('0x12')]){if(_0x22d4af[_0xa8eb('0x12')]['code']===0x1f4){logger['error'](_0xa8eb('0xe'),_0x12b972,_0x22d4af[_0xa8eb('0x12')][_0xa8eb('0x13')]);return _0x3ec6a0(_0x22d4af[_0xa8eb('0x12')][_0xa8eb('0x13')]);}logger[_0xa8eb('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x12b972,_0x22d4af[_0xa8eb('0x12')][_0xa8eb('0x13')]);return _0x1076b7(_0x22d4af[_0xa8eb('0x12')][_0xa8eb('0x13')]);}else{logger[_0xa8eb('0xd')](_0xa8eb('0xe'),_0x12b972,'request\x20sent');_0x1076b7(_0x22d4af[_0xa8eb('0x14')]['message']);}})[_0xa8eb('0x15')](function(_0x39a0f2){logger[_0xa8eb('0x12')](_0xa8eb('0xe'),_0x12b972,_0x39a0f2);_0x3ec6a0(_0x39a0f2);});});}exports['GetFreshdeskAccount']=function(_0x45da7d){var _0x190c92=this;return new Promise(function(_0x54dc82,_0x1c4bbb){return db['FreshdeskAccount'][_0xa8eb('0x16')]({'raw':_0x45da7d[_0xa8eb('0x17')]?_0x45da7d[_0xa8eb('0x17')][_0xa8eb('0x18')]===undefined?!![]:![]:!![],'where':_0x45da7d['options']?_0x45da7d[_0xa8eb('0x17')][_0xa8eb('0x19')]||null:null,'attributes':_0x45da7d['options']?_0x45da7d['options'][_0xa8eb('0x1a')]||null:null,'limit':_0x45da7d[_0xa8eb('0x17')]?_0x45da7d[_0xa8eb('0x17')]['limit']||null:null,'include':_0x45da7d[_0xa8eb('0x17')]?_0x45da7d[_0xa8eb('0x17')][_0xa8eb('0x1b')]?_[_0xa8eb('0x1c')](_0x45da7d[_0xa8eb('0x17')][_0xa8eb('0x1b')],function(_0x3adb61){return{'model':db[_0x3adb61[_0xa8eb('0x1d')]],'as':_0x3adb61['as'],'attributes':_0x3adb61['attributes'],'include':_0x3adb61[_0xa8eb('0x1b')]?_[_0xa8eb('0x1c')](_0x3adb61[_0xa8eb('0x1b')],function(_0x109303){return{'model':db[_0x109303['model']],'as':_0x109303['as'],'attributes':_0x109303[_0xa8eb('0x1a')],'include':_0x109303[_0xa8eb('0x1b')]?_[_0xa8eb('0x1c')](_0x109303['include'],function(_0x1d22ef){return{'model':db[_0x1d22ef[_0xa8eb('0x1d')]],'as':_0x1d22ef['as'],'attributes':_0x1d22ef[_0xa8eb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x380310){logger[_0xa8eb('0xd')](_0xa8eb('0x1e'),_0x45da7d);logger[_0xa8eb('0x10')](_0xa8eb('0x1e'),_0x45da7d,JSON[_0xa8eb('0x1f')](_0x380310));_0x54dc82(_0x380310);})[_0xa8eb('0x15')](function(_0x391450){logger[_0xa8eb('0x12')](_0xa8eb('0x1e'),_0x391450[_0xa8eb('0x13')],_0x45da7d);_0x1c4bbb(_0x190c92['error'](0x1f4,_0x391450['message']));});});};exports['ShowFreshdeskAccount']=function(_0x32046d){var _0x5c4b58=this;return new Promise(function(_0x19b32c,_0xa454f1){return db[_0xa8eb('0x20')]['find']({'raw':_0x32046d[_0xa8eb('0x17')]?_0x32046d[_0xa8eb('0x17')][_0xa8eb('0x18')]===undefined?!![]:![]:!![],'where':_0x32046d['options']?_0x32046d[_0xa8eb('0x17')][_0xa8eb('0x19')]||null:null,'attributes':_0x32046d[_0xa8eb('0x17')]?_0x32046d[_0xa8eb('0x17')][_0xa8eb('0x1a')]||null:null,'include':_0x32046d[_0xa8eb('0x17')]?_0x32046d[_0xa8eb('0x17')]['include']?_['map'](_0x32046d[_0xa8eb('0x17')]['include'],function(_0x5a72da){return{'model':db[_0x5a72da[_0xa8eb('0x1d')]],'as':_0x5a72da['as'],'attributes':_0x5a72da[_0xa8eb('0x1a')],'include':_0x5a72da[_0xa8eb('0x1b')]?_[_0xa8eb('0x1c')](_0x5a72da[_0xa8eb('0x1b')],function(_0x1b27af){return{'model':db[_0x1b27af['model']],'as':_0x1b27af['as'],'attributes':_0x1b27af[_0xa8eb('0x1a')],'include':_0x1b27af[_0xa8eb('0x1b')]?_[_0xa8eb('0x1c')](_0x1b27af[_0xa8eb('0x1b')],function(_0x338308){return{'model':db[_0x338308[_0xa8eb('0x1d')]],'as':_0x338308['as'],'attributes':_0x338308[_0xa8eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa8eb('0x21')](function(_0x52e207){logger['info'](_0xa8eb('0x22'),_0x32046d);logger[_0xa8eb('0x10')](_0xa8eb('0x22'),_0x32046d,JSON[_0xa8eb('0x1f')](_0x52e207));_0x19b32c(_0x52e207);})['catch'](function(_0x5d7525){logger[_0xa8eb('0x12')](_0xa8eb('0x22'),_0x5d7525[_0xa8eb('0x13')],_0x32046d);_0xa454f1(_0x5c4b58[_0xa8eb('0x12')](0x1f4,_0x5d7525[_0xa8eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c06a81d..a4d01a2 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 _0x63b7=['delete','/:id','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x63b7,0xab));var _0x763b=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0x63b7[_0x1b5a05];return _0x347931;};'use strict';var multer=require(_0x763b('0x0'));var util=require('util');var path=require(_0x763b('0x1'));var timeout=require(_0x763b('0x2'));var express=require('express');var router=express[_0x763b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x763b('0x4'));var interaction=require(_0x763b('0x5'));var config=require(_0x763b('0x6'));var controller=require(_0x763b('0x7'));router[_0x763b('0x8')]('/',auth[_0x763b('0x9')](),controller['index']);router[_0x763b('0x8')]('/:id',auth[_0x763b('0x9')](),controller['show']);router[_0x763b('0x8')](_0x763b('0xa'),auth[_0x763b('0x9')](),controller[_0x763b('0xb')]);router[_0x763b('0x8')](_0x763b('0xc'),auth[_0x763b('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x763b('0xd')]);router[_0x763b('0x8')](_0x763b('0xe'),auth['isAuthenticated'](),controller[_0x763b('0xf')]);router[_0x763b('0x10')]('/',auth[_0x763b('0x9')](),controller[_0x763b('0x11')]);router[_0x763b('0x10')](_0x763b('0xe'),auth[_0x763b('0x9')](),controller['setTags']);router['put']('/:id',auth[_0x763b('0x9')](),controller['update']);router[_0x763b('0x12')](_0x763b('0x13'),auth[_0x763b('0x9')](),controller['destroy']);module[_0x763b('0x14')]=router; \ No newline at end of file +var _0x898d=['getTags','post','create','setTags','update','delete','util','path','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/tags'];(function(_0xe491e7,_0x58c131){var _0x331825=function(_0x363de2){while(--_0x363de2){_0xe491e7['push'](_0xe491e7['shift']());}};_0x331825(++_0x58c131);}(_0x898d,0x1e9));var _0xd898=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x898d[_0x43a6cd];return _0x5acb36;};'use strict';var multer=require('multer');var util=require(_0xd898('0x0'));var path=require(_0xd898('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd898('0x2')]();var fs_extra=require(_0xd898('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd898('0x4'));var controller=require(_0xd898('0x5'));router[_0xd898('0x6')]('/',auth[_0xd898('0x7')](),controller[_0xd898('0x8')]);router['get'](_0xd898('0x9'),auth['isAuthenticated'](),controller[_0xd898('0xa')]);router[_0xd898('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xd898('0x6')](_0xd898('0xb'),auth[_0xd898('0x7')](),controller[_0xd898('0xc')]);router[_0xd898('0x6')]('/:id/descriptions',auth[_0xd898('0x7')](),controller[_0xd898('0xd')]);router[_0xd898('0x6')](_0xd898('0xe'),auth[_0xd898('0x7')](),controller[_0xd898('0xf')]);router[_0xd898('0x10')]('/',auth[_0xd898('0x7')](),controller[_0xd898('0x11')]);router[_0xd898('0x10')](_0xd898('0xe'),auth[_0xd898('0x7')](),controller[_0xd898('0x12')]);router['put']('/:id',auth[_0xd898('0x7')](),controller[_0xd898('0x13')]);router[_0xd898('0x14')]('/:id',auth[_0xd898('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index bea4f73..3afe972 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 _0xb9c7=['sequelize','exports','STRING'];(function(_0x42a50b,_0x514af8){var _0x4ea5cd=function(_0x173659){while(--_0x173659){_0x42a50b['push'](_0x42a50b['shift']());}};_0x4ea5cd(++_0x514af8);}(_0xb9c7,0xea));var _0x7b9c=function(_0x23899b,_0x15ded7){_0x23899b=_0x23899b-0x0;var _0x395dfb=_0xb9c7[_0x23899b];return _0x395dfb;};'use strict';var Sequelize=require(_0x7b9c('0x0'));module[_0x7b9c('0x1')]={'name':{'type':Sequelize[_0x7b9c('0x2')]},'description':{'type':Sequelize[_0x7b9c('0x2')]}}; \ No newline at end of file +var _0xff6f=['STRING','sequelize'];(function(_0x3c34dc,_0x39cf86){var _0x59fab8=function(_0x26ea7d){while(--_0x26ea7d){_0x3c34dc['push'](_0x3c34dc['shift']());}};_0x59fab8(++_0x39cf86);}(_0xff6f,0x85));var _0xfff6=function(_0x4fc9f7,_0x447243){_0x4fc9f7=_0x4fc9f7-0x0;var _0x5349e5=_0xff6f[_0x4fc9f7];return _0x5349e5;};'use strict';var Sequelize=require(_0xfff6('0x0'));module['exports']={'name':{'type':Sequelize[_0xfff6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8a02246..ff81a51 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 _0xe6c1=['offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','FreshdeskConfiguration','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','FreshdeskField','filter','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x444c9b,_0x5cc7c8){var _0x5c12b9=function(_0x583b48){while(--_0x583b48){_0x444c9b['push'](_0x444c9b['shift']());}};_0x5c12b9(++_0x5cc7c8);}(_0xe6c1,0x1e7));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x1e6c('0x0'));var rimraf=require(_0x1e6c('0x1'));var zipdir=require(_0x1e6c('0x2'));var jsonpatch=require(_0x1e6c('0x3'));var rp=require(_0x1e6c('0x4'));var moment=require(_0x1e6c('0x5'));var BPromise=require(_0x1e6c('0x6'));var Mustache=require(_0x1e6c('0x7'));var util=require(_0x1e6c('0x8'));var path=require('path');var sox=require(_0x1e6c('0x9'));var csv=require(_0x1e6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e6c('0xb'));var squel=require(_0x1e6c('0xc'));var crypto=require(_0x1e6c('0xd'));var jsforce=require(_0x1e6c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1e6c('0xa'));var querystring=require(_0x1e6c('0xf'));var Papa=require(_0x1e6c('0x10'));var Redis=require(_0x1e6c('0x11'));var authService=require(_0x1e6c('0x12'));var qs=require(_0x1e6c('0x13'));var as=require(_0x1e6c('0x14'));var hardwareService=require(_0x1e6c('0x15'));var logger=require('../../config/logger')(_0x1e6c('0x16'));var utils=require(_0x1e6c('0x17'));var config=require(_0x1e6c('0x18'));var licenseUtil=require(_0x1e6c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dfb4d,_0xe8b299){_0xe8b299=_0xe8b299||0xcc;return function(_0x555f21){if(_0x555f21){return _0x3dfb4d[_0x1e6c('0x1a')](_0xe8b299);}return _0x3dfb4d['status'](_0xe8b299)[_0x1e6c('0x1b')]();};}function respondWithResult(_0xa22c77,_0x14d1d1){_0x14d1d1=_0x14d1d1||0xc8;return function(_0x1813c1){if(_0x1813c1){return _0xa22c77[_0x1e6c('0x1c')](_0x14d1d1)['json'](_0x1813c1);}};}function respondWithFilteredResult(_0x48b728,_0x63686){return function(_0x3db138){if(_0x3db138){var _0x270438=typeof _0x63686[_0x1e6c('0x1d')]==='undefined'&&typeof _0x63686[_0x1e6c('0x1e')]===_0x1e6c('0x1f');var _0x467bc7=_0x3db138[_0x1e6c('0x20')];var _0x2237ef=_0x270438?0x0:_0x63686[_0x1e6c('0x1d')];var _0x28e94f=_0x270438?_0x3db138[_0x1e6c('0x20')]:_0x63686['offset']+_0x63686[_0x1e6c('0x1e')];var _0x8643fa;if(_0x28e94f>=_0x467bc7){_0x28e94f=_0x467bc7;_0x8643fa=0xc8;}else{_0x8643fa=0xce;}_0x48b728[_0x1e6c('0x1c')](_0x8643fa);return _0x48b728[_0x1e6c('0x21')]('Content-Range',_0x2237ef+'-'+_0x28e94f+'/'+_0x467bc7)[_0x1e6c('0x22')](_0x3db138);}return null;};}function patchUpdates(_0x46118a){return function(_0x2769b3){try{jsonpatch[_0x1e6c('0x23')](_0x2769b3,_0x46118a,!![]);}catch(_0x314833){return BPromise[_0x1e6c('0x24')](_0x314833);}return _0x2769b3[_0x1e6c('0x25')]();};}function saveUpdates(_0x5f1b24,_0x48a2f6){return function(_0x107b14){if(_0x107b14){return _0x107b14[_0x1e6c('0x26')](_0x5f1b24)[_0x1e6c('0x27')](function(_0x3e7b82){return _0x3e7b82;});}return null;};}function removeEntity(_0x12102d,_0x4610c9){return function(_0x3e4b1f){if(_0x3e4b1f){return _0x3e4b1f[_0x1e6c('0x28')]()['then'](function(){_0x12102d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x295001,_0x174d7f){return function(_0x39f26c){if(!_0x39f26c){_0x295001[_0x1e6c('0x1a')](0x194);}return _0x39f26c;};}function handleError(_0xa04b03,_0x54f4bf){_0x54f4bf=_0x54f4bf||0x1f4;return function(_0xd5d037){logger['error'](_0xd5d037['stack']);if(_0xd5d037[_0x1e6c('0x29')]){delete _0xd5d037[_0x1e6c('0x29')];}_0xa04b03[_0x1e6c('0x1c')](_0x54f4bf)[_0x1e6c('0x2a')](_0xd5d037);};}exports[_0x1e6c('0x2b')]=function(_0x117c32,_0x11f514){var _0x5231d4={},_0x33096e={},_0x448915={'count':0x0,'rows':[]};var _0x31992e=_[_0x1e6c('0x2c')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x54affc){return{'name':_0x54affc[_0x1e6c('0x2d')],'type':_0x54affc[_0x1e6c('0x2e')][_0x1e6c('0x2f')]};});_0x33096e[_0x1e6c('0x30')]=_[_0x1e6c('0x2c')](_0x31992e,_0x1e6c('0x29'));_0x33096e[_0x1e6c('0x31')]=_[_0x1e6c('0x32')](_0x117c32['query']);_0x33096e[_0x1e6c('0x33')]=_[_0x1e6c('0x34')](_0x33096e['model'],_0x33096e[_0x1e6c('0x31')]);_0x5231d4[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x33096e[_0x1e6c('0x30')],qs['fields'](_0x117c32[_0x1e6c('0x31')][_0x1e6c('0x36')]));_0x5231d4[_0x1e6c('0x35')]=_0x5231d4[_0x1e6c('0x35')][_0x1e6c('0x37')]?_0x5231d4[_0x1e6c('0x35')]:_0x33096e[_0x1e6c('0x30')];if(!_0x117c32[_0x1e6c('0x31')][_0x1e6c('0x38')](_0x1e6c('0x39'))){_0x5231d4['limit']=qs['limit'](_0x117c32[_0x1e6c('0x31')]['limit']);_0x5231d4[_0x1e6c('0x1d')]=qs['offset'](_0x117c32[_0x1e6c('0x31')][_0x1e6c('0x1d')]);}_0x5231d4[_0x1e6c('0x3a')]=qs[_0x1e6c('0x3b')](_0x117c32[_0x1e6c('0x31')][_0x1e6c('0x3b')]);_0x5231d4[_0x1e6c('0x3c')]=qs[_0x1e6c('0x33')](_[_0x1e6c('0x3d')](_0x117c32[_0x1e6c('0x31')],_0x33096e[_0x1e6c('0x33')]),_0x31992e);if(_0x117c32[_0x1e6c('0x31')]['filter']){_0x5231d4[_0x1e6c('0x3c')]=_[_0x1e6c('0x3e')](_0x5231d4['where'],{'$or':_[_0x1e6c('0x2c')](_0x31992e,function(_0x3b734a){if(_0x3b734a[_0x1e6c('0x2e')]!==_0x1e6c('0x3f')){var _0x2e5653={};_0x2e5653[_0x3b734a['name']]={'$like':'%'+_0x117c32[_0x1e6c('0x31')]['filter']+'%'};return _0x2e5653;}})});}_0x5231d4=_[_0x1e6c('0x3e')]({},_0x5231d4,_0x117c32[_0x1e6c('0x40')]);var _0x287f8b={'where':_0x5231d4[_0x1e6c('0x3c')]};return db[_0x1e6c('0x41')][_0x1e6c('0x20')](_0x287f8b)['then'](function(_0x566145){_0x448915[_0x1e6c('0x20')]=_0x566145;if(_0x117c32[_0x1e6c('0x31')]['includeAll']){_0x5231d4[_0x1e6c('0x42')]=[{'all':!![]}];}return db[_0x1e6c('0x41')][_0x1e6c('0x43')](_0x5231d4);})[_0x1e6c('0x27')](function(_0x426d9e){_0x448915[_0x1e6c('0x44')]=_0x426d9e;return _0x448915;})[_0x1e6c('0x27')](respondWithFilteredResult(_0x11f514,_0x5231d4))[_0x1e6c('0x45')](handleError(_0x11f514,null));};exports[_0x1e6c('0x46')]=function(_0x2e2241,_0x1f2204){var _0x1a6af9={'raw':![],'where':{'id':_0x2e2241[_0x1e6c('0x47')]['id']}},_0x52de18={};_0x52de18[_0x1e6c('0x30')]=_[_0x1e6c('0x32')](db[_0x1e6c('0x41')][_0x1e6c('0x48')]);_0x52de18['query']=_['keys'](_0x2e2241['query']);_0x52de18[_0x1e6c('0x33')]=_[_0x1e6c('0x34')](_0x52de18[_0x1e6c('0x30')],_0x52de18['query']);_0x1a6af9[_0x1e6c('0x35')]=_['intersection'](_0x52de18['model'],qs[_0x1e6c('0x36')](_0x2e2241['query'][_0x1e6c('0x36')]));_0x1a6af9[_0x1e6c('0x35')]=_0x1a6af9['attributes']['length']?_0x1a6af9['attributes']:_0x52de18['model'];if(_0x2e2241[_0x1e6c('0x31')]['includeAll']){_0x1a6af9[_0x1e6c('0x42')]=[{'all':!![]}];}_0x1a6af9=_[_0x1e6c('0x3e')]({},_0x1a6af9,_0x2e2241['options']);return db[_0x1e6c('0x41')][_0x1e6c('0x49')](_0x1a6af9)[_0x1e6c('0x27')](handleEntityNotFound(_0x1f2204,null))['then'](respondWithResult(_0x1f2204,null))[_0x1e6c('0x45')](handleError(_0x1f2204,null));};exports[_0x1e6c('0x4a')]=function(_0x49dfdb,_0x9e5690){return db[_0x1e6c('0x41')][_0x1e6c('0x4a')](_0x49dfdb[_0x1e6c('0x4b')],{})[_0x1e6c('0x27')](respondWithResult(_0x9e5690,0xc9))[_0x1e6c('0x45')](handleError(_0x9e5690,null));};exports[_0x1e6c('0x26')]=function(_0x548107,_0x2e8368){if(_0x548107[_0x1e6c('0x4b')]['id']){delete _0x548107[_0x1e6c('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x1e6c('0x49')]({'where':{'id':_0x548107[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x27')](handleEntityNotFound(_0x2e8368,null))[_0x1e6c('0x27')](saveUpdates(_0x548107[_0x1e6c('0x4b')],null))[_0x1e6c('0x27')](respondWithResult(_0x2e8368,null))[_0x1e6c('0x45')](handleError(_0x2e8368,null));};exports[_0x1e6c('0x28')]=function(_0x520a51,_0x1c5bcb){return db[_0x1e6c('0x41')][_0x1e6c('0x49')]({'where':{'id':_0x520a51['params']['id']}})['then'](handleEntityNotFound(_0x1c5bcb,null))[_0x1e6c('0x27')](removeEntity(_0x1c5bcb,null))[_0x1e6c('0x45')](handleError(_0x1c5bcb,null));};exports[_0x1e6c('0x4c')]=function(_0x4eb4c5,_0x58b684,_0x36ad01){var _0x2b81c6={};var _0x5720d4={};var _0x5822d6;var _0x5e1da7;return db['FreshdeskConfiguration'][_0x1e6c('0x4d')]({'where':{'id':_0x4eb4c5[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x27')](handleEntityNotFound(_0x58b684,null))[_0x1e6c('0x27')](function(_0x17572f){if(_0x17572f){_0x5822d6=_0x17572f;_0x5720d4[_0x1e6c('0x30')]=_[_0x1e6c('0x32')](db[_0x1e6c('0x4e')][_0x1e6c('0x48')]);_0x5720d4[_0x1e6c('0x31')]=_['keys'](_0x4eb4c5[_0x1e6c('0x31')]);_0x5720d4[_0x1e6c('0x33')]=_[_0x1e6c('0x34')](_0x5720d4[_0x1e6c('0x30')],_0x5720d4['query']);_0x2b81c6[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x5720d4[_0x1e6c('0x30')],qs[_0x1e6c('0x36')](_0x4eb4c5[_0x1e6c('0x31')][_0x1e6c('0x36')]));_0x2b81c6['attributes']=_0x2b81c6[_0x1e6c('0x35')][_0x1e6c('0x37')]?_0x2b81c6[_0x1e6c('0x35')]:_0x5720d4[_0x1e6c('0x30')];_0x2b81c6[_0x1e6c('0x3a')]=qs[_0x1e6c('0x3b')](_0x4eb4c5['query'][_0x1e6c('0x3b')]);_0x2b81c6['where']=qs['filters'](_['pick'](_0x4eb4c5[_0x1e6c('0x31')],_0x5720d4[_0x1e6c('0x33')]));if(_0x4eb4c5[_0x1e6c('0x31')][_0x1e6c('0x4f')]){_0x2b81c6[_0x1e6c('0x3c')]=_[_0x1e6c('0x3e')](_0x2b81c6['where'],{'$or':_[_0x1e6c('0x2c')](_0x2b81c6[_0x1e6c('0x35')],function(_0x15ec74){var _0x14711b={};_0x14711b[_0x15ec74]={'$like':'%'+_0x4eb4c5[_0x1e6c('0x31')][_0x1e6c('0x4f')]+'%'};return _0x14711b;})});}_0x2b81c6=_[_0x1e6c('0x3e')]({},_0x2b81c6,_0x4eb4c5['options']);return _0x5822d6['getFields'](_0x2b81c6);}})[_0x1e6c('0x27')](function(_0x2530be){if(_0x2530be){_0x5e1da7=_0x2530be['length'];if(!_0x4eb4c5[_0x1e6c('0x31')][_0x1e6c('0x38')](_0x1e6c('0x39'))){_0x2b81c6[_0x1e6c('0x1e')]=qs[_0x1e6c('0x1e')](_0x4eb4c5['query'][_0x1e6c('0x1e')]);_0x2b81c6[_0x1e6c('0x1d')]=qs['offset'](_0x4eb4c5[_0x1e6c('0x31')][_0x1e6c('0x1d')]);}return _0x5822d6[_0x1e6c('0x4c')](_0x2b81c6);}})[_0x1e6c('0x27')](function(_0x38643d){if(_0x38643d){return _0x38643d?{'count':_0x5e1da7,'rows':_0x38643d}:null;}})['then'](respondWithResult(_0x58b684,null))[_0x1e6c('0x45')](handleError(_0x58b684,null));};exports[_0x1e6c('0x50')]=function(_0x4d72e5,_0x23fa30,_0x5d01dc){var _0x1b681e={};var _0x46009d={};var _0x1e390c;var _0x2e4788;return db[_0x1e6c('0x41')]['findOne']({'where':{'id':_0x4d72e5['params']['id']}})['then'](handleEntityNotFound(_0x23fa30,null))[_0x1e6c('0x27')](function(_0x4b0550){if(_0x4b0550){_0x1e390c=_0x4b0550;_0x46009d[_0x1e6c('0x30')]=_[_0x1e6c('0x32')](db[_0x1e6c('0x4e')][_0x1e6c('0x48')]);_0x46009d['query']=_[_0x1e6c('0x32')](_0x4d72e5[_0x1e6c('0x31')]);_0x46009d[_0x1e6c('0x33')]=_[_0x1e6c('0x34')](_0x46009d[_0x1e6c('0x30')],_0x46009d[_0x1e6c('0x31')]);_0x1b681e[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x46009d[_0x1e6c('0x30')],qs['fields'](_0x4d72e5[_0x1e6c('0x31')][_0x1e6c('0x36')]));_0x1b681e[_0x1e6c('0x35')]=_0x1b681e[_0x1e6c('0x35')][_0x1e6c('0x37')]?_0x1b681e[_0x1e6c('0x35')]:_0x46009d[_0x1e6c('0x30')];_0x1b681e[_0x1e6c('0x3a')]=qs[_0x1e6c('0x3b')](_0x4d72e5[_0x1e6c('0x31')]['sort']);_0x1b681e[_0x1e6c('0x3c')]=qs[_0x1e6c('0x33')](_[_0x1e6c('0x3d')](_0x4d72e5[_0x1e6c('0x31')],_0x46009d['filters']));if(_0x4d72e5[_0x1e6c('0x31')][_0x1e6c('0x4f')]){_0x1b681e[_0x1e6c('0x3c')]=_[_0x1e6c('0x3e')](_0x1b681e['where'],{'$or':_[_0x1e6c('0x2c')](_0x1b681e[_0x1e6c('0x35')],function(_0x1a2d0f){var _0x3c737d={};_0x3c737d[_0x1a2d0f]={'$like':'%'+_0x4d72e5['query'][_0x1e6c('0x4f')]+'%'};return _0x3c737d;})});}_0x1b681e=_[_0x1e6c('0x3e')]({},_0x1b681e,_0x4d72e5[_0x1e6c('0x40')]);return _0x1e390c['getSubjects'](_0x1b681e);}})['then'](function(_0x2a22f9){if(_0x2a22f9){_0x2e4788=_0x2a22f9[_0x1e6c('0x37')];if(!_0x4d72e5[_0x1e6c('0x31')][_0x1e6c('0x38')](_0x1e6c('0x39'))){_0x1b681e[_0x1e6c('0x1e')]=qs[_0x1e6c('0x1e')](_0x4d72e5[_0x1e6c('0x31')][_0x1e6c('0x1e')]);_0x1b681e[_0x1e6c('0x1d')]=qs[_0x1e6c('0x1d')](_0x4d72e5[_0x1e6c('0x31')][_0x1e6c('0x1d')]);}return _0x1e390c[_0x1e6c('0x50')](_0x1b681e);}})[_0x1e6c('0x27')](function(_0xa46ed7){if(_0xa46ed7){return _0xa46ed7?{'count':_0x2e4788,'rows':_0xa46ed7}:null;}})['then'](respondWithResult(_0x23fa30,null))[_0x1e6c('0x45')](handleError(_0x23fa30,null));};exports[_0x1e6c('0x51')]=function(_0x69c53,_0x351af3,_0x457366){var _0x4a8fbc={};var _0x3758cf={};var _0x30e8d8;var _0xb57dfe;return db[_0x1e6c('0x41')][_0x1e6c('0x4d')]({'where':{'id':_0x69c53[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x27')](handleEntityNotFound(_0x351af3,null))[_0x1e6c('0x27')](function(_0x442658){if(_0x442658){_0x30e8d8=_0x442658;_0x3758cf[_0x1e6c('0x30')]=_[_0x1e6c('0x32')](db[_0x1e6c('0x4e')][_0x1e6c('0x48')]);_0x3758cf[_0x1e6c('0x31')]=_[_0x1e6c('0x32')](_0x69c53[_0x1e6c('0x31')]);_0x3758cf[_0x1e6c('0x33')]=_[_0x1e6c('0x34')](_0x3758cf[_0x1e6c('0x30')],_0x3758cf['query']);_0x4a8fbc[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x3758cf[_0x1e6c('0x30')],qs[_0x1e6c('0x36')](_0x69c53[_0x1e6c('0x31')]['fields']));_0x4a8fbc['attributes']=_0x4a8fbc['attributes'][_0x1e6c('0x37')]?_0x4a8fbc['attributes']:_0x3758cf[_0x1e6c('0x30')];_0x4a8fbc[_0x1e6c('0x3a')]=qs[_0x1e6c('0x3b')](_0x69c53['query'][_0x1e6c('0x3b')]);_0x4a8fbc[_0x1e6c('0x3c')]=qs['filters'](_[_0x1e6c('0x3d')](_0x69c53[_0x1e6c('0x31')],_0x3758cf[_0x1e6c('0x33')]));if(_0x69c53[_0x1e6c('0x31')][_0x1e6c('0x4f')]){_0x4a8fbc[_0x1e6c('0x3c')]=_[_0x1e6c('0x3e')](_0x4a8fbc[_0x1e6c('0x3c')],{'$or':_[_0x1e6c('0x2c')](_0x4a8fbc[_0x1e6c('0x35')],function(_0x26d2ef){var _0x4661e6={};_0x4661e6[_0x26d2ef]={'$like':'%'+_0x69c53[_0x1e6c('0x31')]['filter']+'%'};return _0x4661e6;})});}_0x4a8fbc=_['merge']({},_0x4a8fbc,_0x69c53['options']);return _0x30e8d8[_0x1e6c('0x51')](_0x4a8fbc);}})[_0x1e6c('0x27')](function(_0x16707b){if(_0x16707b){_0xb57dfe=_0x16707b[_0x1e6c('0x37')];if(!_0x69c53[_0x1e6c('0x31')][_0x1e6c('0x38')](_0x1e6c('0x39'))){_0x4a8fbc[_0x1e6c('0x1e')]=qs[_0x1e6c('0x1e')](_0x69c53[_0x1e6c('0x31')][_0x1e6c('0x1e')]);_0x4a8fbc['offset']=qs[_0x1e6c('0x1d')](_0x69c53[_0x1e6c('0x31')][_0x1e6c('0x1d')]);}return _0x30e8d8['getDescriptions'](_0x4a8fbc);}})[_0x1e6c('0x27')](function(_0x4f1c24){if(_0x4f1c24){return _0x4f1c24?{'count':_0xb57dfe,'rows':_0x4f1c24}:null;}})[_0x1e6c('0x27')](respondWithResult(_0x351af3,null))[_0x1e6c('0x45')](handleError(_0x351af3,null));};exports[_0x1e6c('0x52')]=function(_0x1e8511,_0x1f55e4,_0x35cc2c){var _0x1bc935={};var _0x1ca861={};var _0x542a17;var _0x236373;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1e8511[_0x1e6c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f55e4,null))[_0x1e6c('0x27')](function(_0x14de86){if(_0x14de86){_0x542a17=_0x14de86;_0x1ca861[_0x1e6c('0x30')]=_[_0x1e6c('0x32')](db[_0x1e6c('0x53')][_0x1e6c('0x48')]);_0x1ca861[_0x1e6c('0x31')]=_[_0x1e6c('0x32')](_0x1e8511[_0x1e6c('0x31')]);_0x1ca861[_0x1e6c('0x33')]=_[_0x1e6c('0x34')](_0x1ca861[_0x1e6c('0x30')],_0x1ca861[_0x1e6c('0x31')]);_0x1bc935[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x1ca861[_0x1e6c('0x30')],qs[_0x1e6c('0x36')](_0x1e8511[_0x1e6c('0x31')][_0x1e6c('0x36')]));_0x1bc935[_0x1e6c('0x35')]=_0x1bc935[_0x1e6c('0x35')][_0x1e6c('0x37')]?_0x1bc935[_0x1e6c('0x35')]:_0x1ca861[_0x1e6c('0x30')];_0x1bc935[_0x1e6c('0x3a')]=qs['sort'](_0x1e8511[_0x1e6c('0x31')][_0x1e6c('0x3b')]);_0x1bc935[_0x1e6c('0x3c')]=qs[_0x1e6c('0x33')](_['pick'](_0x1e8511[_0x1e6c('0x31')],_0x1ca861['filters']));if(_0x1e8511[_0x1e6c('0x31')][_0x1e6c('0x4f')]){_0x1bc935[_0x1e6c('0x3c')]=_[_0x1e6c('0x3e')](_0x1bc935[_0x1e6c('0x3c')],{'$or':_[_0x1e6c('0x2c')](_0x1bc935['attributes'],function(_0x279844){var _0xace377={};_0xace377[_0x279844]={'$like':'%'+_0x1e8511[_0x1e6c('0x31')][_0x1e6c('0x4f')]+'%'};return _0xace377;})});}_0x1bc935=_['merge']({},_0x1bc935,_0x1e8511[_0x1e6c('0x40')]);return _0x542a17['getTags'](_0x1bc935);}})[_0x1e6c('0x27')](function(_0x399638){if(_0x399638){_0x236373=_0x399638[_0x1e6c('0x37')];if(!_0x1e8511['query'][_0x1e6c('0x38')](_0x1e6c('0x39'))){_0x1bc935[_0x1e6c('0x1e')]=qs[_0x1e6c('0x1e')](_0x1e8511[_0x1e6c('0x31')]['limit']);_0x1bc935['offset']=qs['offset'](_0x1e8511['query'][_0x1e6c('0x1d')]);}return _0x542a17['getTags'](_0x1bc935);}})['then'](function(_0x5a0e90){if(_0x5a0e90){return _0x5a0e90?{'count':_0x236373,'rows':_0x5a0e90}:null;}})[_0x1e6c('0x27')](respondWithResult(_0x1f55e4,null))[_0x1e6c('0x45')](handleError(_0x1f55e4,null));};exports[_0x1e6c('0x54')]=function(_0x454555,_0x3d350d,_0x19f21d){if(_0x454555[_0x1e6c('0x4b')]['id']){delete _0x454555[_0x1e6c('0x4b')]['id'];}return db[_0x1e6c('0x41')][_0x1e6c('0x4d')]({'where':{'id':_0x454555[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x27')](handleEntityNotFound(_0x3d350d,null))['then'](function(_0x1ef08d){if(_0x1ef08d){return _0x1ef08d[_0x1e6c('0x54')](_0x454555[_0x1e6c('0x4b')][_0x1e6c('0x55')]||[]);}return null;})['then'](respondWithResult(_0x3d350d,null))['catch'](handleError(_0x3d350d,null));}; \ No newline at end of file +var _0x5c73=['catch','show','params','includeAll','options','find','create','update','body','getFields','FreshdeskField','pick','getSubjects','getDescriptions','getTags','findOne','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','include','rows'];(function(_0x281ea6,_0x2af4e0){var _0x1445e9=function(_0x547433){while(--_0x547433){_0x281ea6['push'](_0x281ea6['shift']());}};_0x1445e9(++_0x2af4e0);}(_0x5c73,0xc0));var _0x35c7=function(_0x53ebc0,_0x13a560){_0x53ebc0=_0x53ebc0-0x0;var _0x286172=_0x5c73[_0x53ebc0];return _0x286172;};'use strict';var emlformat=require(_0x35c7('0x0'));var rimraf=require(_0x35c7('0x1'));var zipdir=require(_0x35c7('0x2'));var jsonpatch=require(_0x35c7('0x3'));var rp=require(_0x35c7('0x4'));var moment=require(_0x35c7('0x5'));var BPromise=require(_0x35c7('0x6'));var Mustache=require(_0x35c7('0x7'));var util=require('util');var path=require(_0x35c7('0x8'));var sox=require(_0x35c7('0x9'));var csv=require('to-csv');var ejs=require(_0x35c7('0xa'));var fs=require('fs');var fs_extra=require(_0x35c7('0xb'));var _=require(_0x35c7('0xc'));var squel=require(_0x35c7('0xd'));var crypto=require(_0x35c7('0xe'));var jsforce=require(_0x35c7('0xf'));var deskjs=require(_0x35c7('0x10'));var toCsv=require(_0x35c7('0x11'));var querystring=require(_0x35c7('0x12'));var Papa=require(_0x35c7('0x13'));var Redis=require(_0x35c7('0x14'));var authService=require(_0x35c7('0x15'));var qs=require(_0x35c7('0x16'));var as=require(_0x35c7('0x17'));var hardwareService=require(_0x35c7('0x18'));var logger=require('../../config/logger')(_0x35c7('0x19'));var utils=require('../../config/utils');var config=require(_0x35c7('0x1a'));var licenseUtil=require(_0x35c7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3db7e1,_0x1c7208){_0x1c7208=_0x1c7208||0xcc;return function(_0x2d7a49){if(_0x2d7a49){return _0x3db7e1['sendStatus'](_0x1c7208);}return _0x3db7e1[_0x35c7('0x1c')](_0x1c7208)[_0x35c7('0x1d')]();};}function respondWithResult(_0x2046b6,_0x49f9aa){_0x49f9aa=_0x49f9aa||0xc8;return function(_0x1604a6){if(_0x1604a6){return _0x2046b6[_0x35c7('0x1c')](_0x49f9aa)[_0x35c7('0x1e')](_0x1604a6);}};}function respondWithFilteredResult(_0x17999f,_0x4594c1){return function(_0x354456){if(_0x354456){var _0x7520d3=typeof _0x4594c1[_0x35c7('0x1f')]===_0x35c7('0x20')&&typeof _0x4594c1[_0x35c7('0x21')]===_0x35c7('0x20');var _0x56d32e=_0x354456[_0x35c7('0x22')];var _0x105bb9=_0x7520d3?0x0:_0x4594c1['offset'];var _0x1d8d52=_0x7520d3?_0x354456[_0x35c7('0x22')]:_0x4594c1[_0x35c7('0x1f')]+_0x4594c1['limit'];var _0x3b265e;if(_0x1d8d52>=_0x56d32e){_0x1d8d52=_0x56d32e;_0x3b265e=0xc8;}else{_0x3b265e=0xce;}_0x17999f[_0x35c7('0x1c')](_0x3b265e);return _0x17999f[_0x35c7('0x23')](_0x35c7('0x24'),_0x105bb9+'-'+_0x1d8d52+'/'+_0x56d32e)['json'](_0x354456);}return null;};}function patchUpdates(_0x900dc9){return function(_0x161aad){try{jsonpatch[_0x35c7('0x25')](_0x161aad,_0x900dc9,!![]);}catch(_0xab67b6){return BPromise['reject'](_0xab67b6);}return _0x161aad[_0x35c7('0x26')]();};}function saveUpdates(_0x3bbba5,_0xcbd295){return function(_0x3af4c5){if(_0x3af4c5){return _0x3af4c5['update'](_0x3bbba5)[_0x35c7('0x27')](function(_0x5b7534){return _0x5b7534;});}return null;};}function removeEntity(_0x273ca9,_0x53b062){return function(_0x4543b4){if(_0x4543b4){return _0x4543b4[_0x35c7('0x28')]()[_0x35c7('0x27')](function(){_0x273ca9[_0x35c7('0x1c')](0xcc)[_0x35c7('0x1d')]();});}};}function handleEntityNotFound(_0x2c57ad,_0xb7c67){return function(_0x53afb2){if(!_0x53afb2){_0x2c57ad[_0x35c7('0x29')](0x194);}return _0x53afb2;};}function handleError(_0x4cab3b,_0x4f70ac){_0x4f70ac=_0x4f70ac||0x1f4;return function(_0x2dd707){logger['error'](_0x2dd707[_0x35c7('0x2a')]);if(_0x2dd707['name']){delete _0x2dd707[_0x35c7('0x2b')];}_0x4cab3b[_0x35c7('0x1c')](_0x4f70ac)[_0x35c7('0x2c')](_0x2dd707);};}exports[_0x35c7('0x2d')]=function(_0x4c6485,_0x49958c){var _0x507a69={},_0x5abd0c={},_0x517df5={'count':0x0,'rows':[]};var _0x57eefc=_['map'](db[_0x35c7('0x2e')][_0x35c7('0x2f')],function(_0x57c5ad){return{'name':_0x57c5ad['fieldName'],'type':_0x57c5ad[_0x35c7('0x30')][_0x35c7('0x31')]};});_0x5abd0c[_0x35c7('0x32')]=_['map'](_0x57eefc,_0x35c7('0x2b'));_0x5abd0c[_0x35c7('0x33')]=_[_0x35c7('0x34')](_0x4c6485[_0x35c7('0x33')]);_0x5abd0c[_0x35c7('0x35')]=_[_0x35c7('0x36')](_0x5abd0c[_0x35c7('0x32')],_0x5abd0c[_0x35c7('0x33')]);_0x507a69[_0x35c7('0x37')]=_['intersection'](_0x5abd0c['model'],qs[_0x35c7('0x38')](_0x4c6485[_0x35c7('0x33')]['fields']));_0x507a69[_0x35c7('0x37')]=_0x507a69['attributes'][_0x35c7('0x39')]?_0x507a69[_0x35c7('0x37')]:_0x5abd0c['model'];if(!_0x4c6485[_0x35c7('0x33')][_0x35c7('0x3a')](_0x35c7('0x3b'))){_0x507a69[_0x35c7('0x21')]=qs['limit'](_0x4c6485[_0x35c7('0x33')]['limit']);_0x507a69[_0x35c7('0x1f')]=qs[_0x35c7('0x1f')](_0x4c6485[_0x35c7('0x33')][_0x35c7('0x1f')]);}_0x507a69[_0x35c7('0x3c')]=qs[_0x35c7('0x3d')](_0x4c6485[_0x35c7('0x33')]['sort']);_0x507a69[_0x35c7('0x3e')]=qs[_0x35c7('0x35')](_['pick'](_0x4c6485[_0x35c7('0x33')],_0x5abd0c[_0x35c7('0x35')]),_0x57eefc);if(_0x4c6485['query'][_0x35c7('0x3f')]){_0x507a69['where']=_[_0x35c7('0x40')](_0x507a69['where'],{'$or':_[_0x35c7('0x41')](_0x57eefc,function(_0x381d71){if(_0x381d71[_0x35c7('0x30')]!==_0x35c7('0x42')){var _0x3ea1ac={};_0x3ea1ac[_0x381d71[_0x35c7('0x2b')]]={'$like':'%'+_0x4c6485[_0x35c7('0x33')][_0x35c7('0x3f')]+'%'};return _0x3ea1ac;}})});}_0x507a69=_[_0x35c7('0x40')]({},_0x507a69,_0x4c6485['options']);var _0x1f7bff={'where':_0x507a69[_0x35c7('0x3e')]};return db['FreshdeskConfiguration'][_0x35c7('0x22')](_0x1f7bff)['then'](function(_0xfeee06){_0x517df5['count']=_0xfeee06;if(_0x4c6485[_0x35c7('0x33')]['includeAll']){_0x507a69[_0x35c7('0x43')]=[{'all':!![]}];}return db[_0x35c7('0x2e')]['findAll'](_0x507a69);})['then'](function(_0x10ab84){_0x517df5[_0x35c7('0x44')]=_0x10ab84;return _0x517df5;})[_0x35c7('0x27')](respondWithFilteredResult(_0x49958c,_0x507a69))[_0x35c7('0x45')](handleError(_0x49958c,null));};exports[_0x35c7('0x46')]=function(_0x2f2a1f,_0x316ff1){var _0x4f00a2={'raw':![],'where':{'id':_0x2f2a1f[_0x35c7('0x47')]['id']}},_0x20b253={};_0x20b253[_0x35c7('0x32')]=_[_0x35c7('0x34')](db[_0x35c7('0x2e')]['rawAttributes']);_0x20b253[_0x35c7('0x33')]=_[_0x35c7('0x34')](_0x2f2a1f['query']);_0x20b253[_0x35c7('0x35')]=_[_0x35c7('0x36')](_0x20b253[_0x35c7('0x32')],_0x20b253[_0x35c7('0x33')]);_0x4f00a2[_0x35c7('0x37')]=_[_0x35c7('0x36')](_0x20b253[_0x35c7('0x32')],qs[_0x35c7('0x38')](_0x2f2a1f[_0x35c7('0x33')]['fields']));_0x4f00a2[_0x35c7('0x37')]=_0x4f00a2['attributes'][_0x35c7('0x39')]?_0x4f00a2[_0x35c7('0x37')]:_0x20b253['model'];if(_0x2f2a1f[_0x35c7('0x33')][_0x35c7('0x48')]){_0x4f00a2[_0x35c7('0x43')]=[{'all':!![]}];}_0x4f00a2=_[_0x35c7('0x40')]({},_0x4f00a2,_0x2f2a1f[_0x35c7('0x49')]);return db[_0x35c7('0x2e')][_0x35c7('0x4a')](_0x4f00a2)[_0x35c7('0x27')](handleEntityNotFound(_0x316ff1,null))[_0x35c7('0x27')](respondWithResult(_0x316ff1,null))['catch'](handleError(_0x316ff1,null));};exports[_0x35c7('0x4b')]=function(_0x26bbf1,_0x2237cc){return db[_0x35c7('0x2e')][_0x35c7('0x4b')](_0x26bbf1['body'],{})[_0x35c7('0x27')](respondWithResult(_0x2237cc,0xc9))[_0x35c7('0x45')](handleError(_0x2237cc,null));};exports[_0x35c7('0x4c')]=function(_0x433bbd,_0x20debb){if(_0x433bbd[_0x35c7('0x4d')]['id']){delete _0x433bbd[_0x35c7('0x4d')]['id'];}return db[_0x35c7('0x2e')][_0x35c7('0x4a')]({'where':{'id':_0x433bbd['params']['id']}})['then'](handleEntityNotFound(_0x20debb,null))[_0x35c7('0x27')](saveUpdates(_0x433bbd['body'],null))['then'](respondWithResult(_0x20debb,null))[_0x35c7('0x45')](handleError(_0x20debb,null));};exports[_0x35c7('0x28')]=function(_0x248cfe,_0x42dc90){return db[_0x35c7('0x2e')][_0x35c7('0x4a')]({'where':{'id':_0x248cfe[_0x35c7('0x47')]['id']}})[_0x35c7('0x27')](handleEntityNotFound(_0x42dc90,null))[_0x35c7('0x27')](removeEntity(_0x42dc90,null))[_0x35c7('0x45')](handleError(_0x42dc90,null));};exports[_0x35c7('0x4e')]=function(_0x44bdb0,_0x5013fd,_0x32d733){var _0x339a99={};var _0x492a0c={};var _0xcd8b6d;var _0x450959;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x44bdb0[_0x35c7('0x47')]['id']}})[_0x35c7('0x27')](handleEntityNotFound(_0x5013fd,null))[_0x35c7('0x27')](function(_0x90205d){if(_0x90205d){_0xcd8b6d=_0x90205d;_0x492a0c[_0x35c7('0x32')]=_[_0x35c7('0x34')](db[_0x35c7('0x4f')][_0x35c7('0x2f')]);_0x492a0c[_0x35c7('0x33')]=_['keys'](_0x44bdb0['query']);_0x492a0c[_0x35c7('0x35')]=_[_0x35c7('0x36')](_0x492a0c[_0x35c7('0x32')],_0x492a0c[_0x35c7('0x33')]);_0x339a99['attributes']=_[_0x35c7('0x36')](_0x492a0c['model'],qs[_0x35c7('0x38')](_0x44bdb0[_0x35c7('0x33')][_0x35c7('0x38')]));_0x339a99[_0x35c7('0x37')]=_0x339a99[_0x35c7('0x37')][_0x35c7('0x39')]?_0x339a99[_0x35c7('0x37')]:_0x492a0c[_0x35c7('0x32')];_0x339a99[_0x35c7('0x3c')]=qs['sort'](_0x44bdb0[_0x35c7('0x33')]['sort']);_0x339a99[_0x35c7('0x3e')]=qs[_0x35c7('0x35')](_[_0x35c7('0x50')](_0x44bdb0[_0x35c7('0x33')],_0x492a0c[_0x35c7('0x35')]));if(_0x44bdb0[_0x35c7('0x33')]['filter']){_0x339a99[_0x35c7('0x3e')]=_[_0x35c7('0x40')](_0x339a99[_0x35c7('0x3e')],{'$or':_['map'](_0x339a99[_0x35c7('0x37')],function(_0x1b2fbc){var _0x2f1eb8={};_0x2f1eb8[_0x1b2fbc]={'$like':'%'+_0x44bdb0['query'][_0x35c7('0x3f')]+'%'};return _0x2f1eb8;})});}_0x339a99=_[_0x35c7('0x40')]({},_0x339a99,_0x44bdb0[_0x35c7('0x49')]);return _0xcd8b6d[_0x35c7('0x4e')](_0x339a99);}})[_0x35c7('0x27')](function(_0x593716){if(_0x593716){_0x450959=_0x593716[_0x35c7('0x39')];if(!_0x44bdb0[_0x35c7('0x33')][_0x35c7('0x3a')](_0x35c7('0x3b'))){_0x339a99['limit']=qs['limit'](_0x44bdb0['query'][_0x35c7('0x21')]);_0x339a99[_0x35c7('0x1f')]=qs[_0x35c7('0x1f')](_0x44bdb0[_0x35c7('0x33')]['offset']);}return _0xcd8b6d[_0x35c7('0x4e')](_0x339a99);}})['then'](function(_0x2edc4f){if(_0x2edc4f){return _0x2edc4f?{'count':_0x450959,'rows':_0x2edc4f}:null;}})['then'](respondWithResult(_0x5013fd,null))[_0x35c7('0x45')](handleError(_0x5013fd,null));};exports['getSubjects']=function(_0x1af408,_0x374887,_0x337220){var _0x4a4050={};var _0x3483d2={};var _0x5932fe;var _0x57a72f;return db[_0x35c7('0x2e')]['findOne']({'where':{'id':_0x1af408['params']['id']}})[_0x35c7('0x27')](handleEntityNotFound(_0x374887,null))[_0x35c7('0x27')](function(_0x12fcc9){if(_0x12fcc9){_0x5932fe=_0x12fcc9;_0x3483d2[_0x35c7('0x32')]=_[_0x35c7('0x34')](db['FreshdeskField'][_0x35c7('0x2f')]);_0x3483d2[_0x35c7('0x33')]=_[_0x35c7('0x34')](_0x1af408[_0x35c7('0x33')]);_0x3483d2[_0x35c7('0x35')]=_['intersection'](_0x3483d2[_0x35c7('0x32')],_0x3483d2[_0x35c7('0x33')]);_0x4a4050[_0x35c7('0x37')]=_[_0x35c7('0x36')](_0x3483d2['model'],qs[_0x35c7('0x38')](_0x1af408[_0x35c7('0x33')][_0x35c7('0x38')]));_0x4a4050[_0x35c7('0x37')]=_0x4a4050[_0x35c7('0x37')][_0x35c7('0x39')]?_0x4a4050[_0x35c7('0x37')]:_0x3483d2[_0x35c7('0x32')];_0x4a4050[_0x35c7('0x3c')]=qs[_0x35c7('0x3d')](_0x1af408[_0x35c7('0x33')][_0x35c7('0x3d')]);_0x4a4050[_0x35c7('0x3e')]=qs[_0x35c7('0x35')](_[_0x35c7('0x50')](_0x1af408[_0x35c7('0x33')],_0x3483d2['filters']));if(_0x1af408[_0x35c7('0x33')][_0x35c7('0x3f')]){_0x4a4050['where']=_['merge'](_0x4a4050[_0x35c7('0x3e')],{'$or':_[_0x35c7('0x41')](_0x4a4050['attributes'],function(_0x545de7){var _0x2b927b={};_0x2b927b[_0x545de7]={'$like':'%'+_0x1af408[_0x35c7('0x33')]['filter']+'%'};return _0x2b927b;})});}_0x4a4050=_['merge']({},_0x4a4050,_0x1af408[_0x35c7('0x49')]);return _0x5932fe[_0x35c7('0x51')](_0x4a4050);}})['then'](function(_0x3a4195){if(_0x3a4195){_0x57a72f=_0x3a4195[_0x35c7('0x39')];if(!_0x1af408[_0x35c7('0x33')][_0x35c7('0x3a')](_0x35c7('0x3b'))){_0x4a4050[_0x35c7('0x21')]=qs[_0x35c7('0x21')](_0x1af408['query'][_0x35c7('0x21')]);_0x4a4050[_0x35c7('0x1f')]=qs[_0x35c7('0x1f')](_0x1af408[_0x35c7('0x33')][_0x35c7('0x1f')]);}return _0x5932fe['getSubjects'](_0x4a4050);}})['then'](function(_0x1f1b8b){if(_0x1f1b8b){return _0x1f1b8b?{'count':_0x57a72f,'rows':_0x1f1b8b}:null;}})[_0x35c7('0x27')](respondWithResult(_0x374887,null))[_0x35c7('0x45')](handleError(_0x374887,null));};exports['getDescriptions']=function(_0x12e83a,_0x10df69,_0x39c43c){var _0x105431={};var _0x2bc076={};var _0x4c60c5;var _0x2fd452;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x12e83a[_0x35c7('0x47')]['id']}})[_0x35c7('0x27')](handleEntityNotFound(_0x10df69,null))['then'](function(_0x3452e){if(_0x3452e){_0x4c60c5=_0x3452e;_0x2bc076['model']=_[_0x35c7('0x34')](db[_0x35c7('0x4f')][_0x35c7('0x2f')]);_0x2bc076[_0x35c7('0x33')]=_[_0x35c7('0x34')](_0x12e83a[_0x35c7('0x33')]);_0x2bc076[_0x35c7('0x35')]=_[_0x35c7('0x36')](_0x2bc076[_0x35c7('0x32')],_0x2bc076[_0x35c7('0x33')]);_0x105431[_0x35c7('0x37')]=_[_0x35c7('0x36')](_0x2bc076[_0x35c7('0x32')],qs[_0x35c7('0x38')](_0x12e83a[_0x35c7('0x33')][_0x35c7('0x38')]));_0x105431['attributes']=_0x105431['attributes'][_0x35c7('0x39')]?_0x105431['attributes']:_0x2bc076['model'];_0x105431[_0x35c7('0x3c')]=qs[_0x35c7('0x3d')](_0x12e83a[_0x35c7('0x33')]['sort']);_0x105431['where']=qs['filters'](_[_0x35c7('0x50')](_0x12e83a[_0x35c7('0x33')],_0x2bc076[_0x35c7('0x35')]));if(_0x12e83a[_0x35c7('0x33')][_0x35c7('0x3f')]){_0x105431[_0x35c7('0x3e')]=_['merge'](_0x105431['where'],{'$or':_[_0x35c7('0x41')](_0x105431['attributes'],function(_0x3a74a9){var _0x48f4b4={};_0x48f4b4[_0x3a74a9]={'$like':'%'+_0x12e83a['query'][_0x35c7('0x3f')]+'%'};return _0x48f4b4;})});}_0x105431=_[_0x35c7('0x40')]({},_0x105431,_0x12e83a[_0x35c7('0x49')]);return _0x4c60c5[_0x35c7('0x52')](_0x105431);}})[_0x35c7('0x27')](function(_0x464d3b){if(_0x464d3b){_0x2fd452=_0x464d3b[_0x35c7('0x39')];if(!_0x12e83a[_0x35c7('0x33')][_0x35c7('0x3a')]('nolimit')){_0x105431[_0x35c7('0x21')]=qs[_0x35c7('0x21')](_0x12e83a[_0x35c7('0x33')][_0x35c7('0x21')]);_0x105431['offset']=qs[_0x35c7('0x1f')](_0x12e83a[_0x35c7('0x33')][_0x35c7('0x1f')]);}return _0x4c60c5[_0x35c7('0x52')](_0x105431);}})[_0x35c7('0x27')](function(_0x4d5453){if(_0x4d5453){return _0x4d5453?{'count':_0x2fd452,'rows':_0x4d5453}:null;}})[_0x35c7('0x27')](respondWithResult(_0x10df69,null))[_0x35c7('0x45')](handleError(_0x10df69,null));};exports[_0x35c7('0x53')]=function(_0x223048,_0x565f27,_0x57c83d){var _0x5e52fa={};var _0x27c8ac={};var _0x34647c;var _0x35a384;return db['FreshdeskConfiguration'][_0x35c7('0x54')]({'where':{'id':_0x223048[_0x35c7('0x47')]['id']}})[_0x35c7('0x27')](handleEntityNotFound(_0x565f27,null))['then'](function(_0x4b5543){if(_0x4b5543){_0x34647c=_0x4b5543;_0x27c8ac[_0x35c7('0x32')]=_[_0x35c7('0x34')](db['Tag'][_0x35c7('0x2f')]);_0x27c8ac[_0x35c7('0x33')]=_[_0x35c7('0x34')](_0x223048['query']);_0x27c8ac['filters']=_[_0x35c7('0x36')](_0x27c8ac[_0x35c7('0x32')],_0x27c8ac[_0x35c7('0x33')]);_0x5e52fa[_0x35c7('0x37')]=_['intersection'](_0x27c8ac['model'],qs[_0x35c7('0x38')](_0x223048[_0x35c7('0x33')][_0x35c7('0x38')]));_0x5e52fa['attributes']=_0x5e52fa[_0x35c7('0x37')][_0x35c7('0x39')]?_0x5e52fa[_0x35c7('0x37')]:_0x27c8ac[_0x35c7('0x32')];_0x5e52fa[_0x35c7('0x3c')]=qs[_0x35c7('0x3d')](_0x223048['query'][_0x35c7('0x3d')]);_0x5e52fa[_0x35c7('0x3e')]=qs[_0x35c7('0x35')](_[_0x35c7('0x50')](_0x223048['query'],_0x27c8ac['filters']));if(_0x223048[_0x35c7('0x33')]['filter']){_0x5e52fa['where']=_[_0x35c7('0x40')](_0x5e52fa[_0x35c7('0x3e')],{'$or':_[_0x35c7('0x41')](_0x5e52fa[_0x35c7('0x37')],function(_0x454e73){var _0x49d92={};_0x49d92[_0x454e73]={'$like':'%'+_0x223048[_0x35c7('0x33')]['filter']+'%'};return _0x49d92;})});}_0x5e52fa=_[_0x35c7('0x40')]({},_0x5e52fa,_0x223048['options']);return _0x34647c[_0x35c7('0x53')](_0x5e52fa);}})['then'](function(_0x3ad851){if(_0x3ad851){_0x35a384=_0x3ad851['length'];if(!_0x223048['query']['hasOwnProperty'](_0x35c7('0x3b'))){_0x5e52fa[_0x35c7('0x21')]=qs[_0x35c7('0x21')](_0x223048[_0x35c7('0x33')][_0x35c7('0x21')]);_0x5e52fa[_0x35c7('0x1f')]=qs[_0x35c7('0x1f')](_0x223048[_0x35c7('0x33')][_0x35c7('0x1f')]);}return _0x34647c['getTags'](_0x5e52fa);}})[_0x35c7('0x27')](function(_0x44f5be){if(_0x44f5be){return _0x44f5be?{'count':_0x35a384,'rows':_0x44f5be}:null;}})['then'](respondWithResult(_0x565f27,null))['catch'](handleError(_0x565f27,null));};exports[_0x35c7('0x55')]=function(_0x533407,_0x6105af,_0x2b6cd6){if(_0x533407[_0x35c7('0x4d')]['id']){delete _0x533407['body']['id'];}return db[_0x35c7('0x2e')][_0x35c7('0x54')]({'where':{'id':_0x533407[_0x35c7('0x47')]['id']}})[_0x35c7('0x27')](handleEntityNotFound(_0x6105af,null))[_0x35c7('0x27')](function(_0x19e627){if(_0x19e627){return _0x19e627[_0x35c7('0x55')](_0x533407[_0x35c7('0x4d')][_0x35c7('0x56')]||[]);}return null;})[_0x35c7('0x27')](respondWithResult(_0x6105af,null))[_0x35c7('0x45')](handleError(_0x6105af,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5a9f90d..be0e76a 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 _0x762e=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x22c5d7,_0x8f776){var _0x130606=function(_0x3788ea){while(--_0x3788ea){_0x22c5d7['push'](_0x22c5d7['shift']());}};_0x130606(++_0x8f776);}(_0x762e,0x156));var _0xe762=function(_0x26dc8a,_0x55c361){_0x26dc8a=_0x26dc8a-0x0;var _0x3f8fe8=_0x762e[_0x26dc8a];return _0x3f8fe8;};'use strict';var _=require(_0xe762('0x0'));var util=require(_0xe762('0x1'));var logger=require(_0xe762('0x2'))(_0xe762('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe762('0x4'));var fs=require('fs');var path=require(_0xe762('0x5'));var rimraf=require(_0xe762('0x6'));var config=require(_0xe762('0x7'));var attributes=require(_0xe762('0x8'));module[_0xe762('0x9')]=function(_0x4b9080,_0x2c3e30){return _0x4b9080[_0xe762('0xa')](_0xe762('0xb'),attributes,{'tableName':_0xe762('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb353=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x5d9b80,_0xa34fa7){var _0x562a70=function(_0x131ec3){while(--_0x131ec3){_0x5d9b80['push'](_0x5d9b80['shift']());}};_0x562a70(++_0xa34fa7);}(_0xb353,0x13b));var _0x3b35=function(_0x3b93f9,_0x4cdddc){_0x3b93f9=_0x3b93f9-0x0;var _0x341982=_0xb353[_0x3b93f9];return _0x341982;};'use strict';var _=require(_0x3b35('0x0'));var util=require(_0x3b35('0x1'));var logger=require(_0x3b35('0x2'))('api');var moment=require(_0x3b35('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b35('0x4'));var fs=require('fs');var path=require(_0x3b35('0x5'));var rimraf=require(_0x3b35('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x3b6f79,_0x3dabe8){return _0x3b6f79['define'](_0x3b35('0x7'),attributes,{'tableName':_0x3b35('0x8'),'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 714e28e..bffd108 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 _0xbfd0=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0xbfd0,0x64));var _0x0bfd=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xbfd0[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x0bfd('0x0'));var util=require(_0x0bfd('0x1'));var moment=require(_0x0bfd('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bfd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0bfd('0x4'));var logger=require(_0x0bfd('0x5'))(_0x0bfd('0x6'));var config=require(_0x0bfd('0x7'));var jayson=require(_0x0bfd('0x8'));var client=jayson[_0x0bfd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eb41a,_0x327db6,_0x1798a5){return new BPromise(function(_0x3585b9,_0x47b90b){return client[_0x0bfd('0xa')](_0x2eb41a,_0x1798a5)[_0x0bfd('0xb')](function(_0x35f63e){logger[_0x0bfd('0xc')](_0x0bfd('0xd'),_0x327db6,_0x0bfd('0xe'));logger[_0x0bfd('0xf')](_0x0bfd('0x10'),_0x327db6,_0x0bfd('0xe'),JSON[_0x0bfd('0x11')](_0x35f63e));if(_0x35f63e[_0x0bfd('0x12')]){if(_0x35f63e[_0x0bfd('0x12')][_0x0bfd('0x13')]===0x1f4){logger[_0x0bfd('0x12')](_0x0bfd('0xd'),_0x327db6,_0x35f63e[_0x0bfd('0x12')][_0x0bfd('0x14')]);return _0x47b90b(_0x35f63e[_0x0bfd('0x12')]['message']);}logger[_0x0bfd('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x327db6,_0x35f63e[_0x0bfd('0x12')][_0x0bfd('0x14')]);return _0x3585b9(_0x35f63e['error']['message']);}else{logger[_0x0bfd('0xc')](_0x0bfd('0xd'),_0x327db6,_0x0bfd('0xe'));_0x3585b9(_0x35f63e[_0x0bfd('0x15')]['message']);}})['catch'](function(_0x52c472){logger['error'](_0x0bfd('0xd'),_0x327db6,_0x52c472);_0x47b90b(_0x52c472);});});} \ No newline at end of file +var _0x9f3a=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x5778ab,_0x58c8a0){var _0x476057=function(_0x349e2a){while(--_0x349e2a){_0x5778ab['push'](_0x5778ab['shift']());}};_0x476057(++_0x58c8a0);}(_0x9f3a,0x172));var _0xa9f3=function(_0x4c70c4,_0x963969){_0x4c70c4=_0x4c70c4-0x0;var _0x437865=_0x9f3a[_0x4c70c4];return _0x437865;};'use strict';var _=require(_0xa9f3('0x0'));var util=require(_0xa9f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa9f3('0x2'));var logger=require(_0xa9f3('0x3'))(_0xa9f3('0x4'));var config=require(_0xa9f3('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa9f3('0x6')][_0xa9f3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x295158,_0x350598,_0x11cbd2){return new BPromise(function(_0x11ccc4,_0x2bcd4c){return client['request'](_0x295158,_0x11cbd2)[_0xa9f3('0x8')](function(_0x339f5e){logger['info'](_0xa9f3('0x9'),_0x350598,_0xa9f3('0xa'));logger[_0xa9f3('0xb')](_0xa9f3('0xc'),_0x350598,_0xa9f3('0xa'),JSON[_0xa9f3('0xd')](_0x339f5e));if(_0x339f5e[_0xa9f3('0xe')]){if(_0x339f5e[_0xa9f3('0xe')][_0xa9f3('0xf')]===0x1f4){logger[_0xa9f3('0xe')](_0xa9f3('0x9'),_0x350598,_0x339f5e[_0xa9f3('0xe')][_0xa9f3('0x10')]);return _0x2bcd4c(_0x339f5e[_0xa9f3('0xe')][_0xa9f3('0x10')]);}logger['error'](_0xa9f3('0x9'),_0x350598,_0x339f5e[_0xa9f3('0xe')][_0xa9f3('0x10')]);return _0x11ccc4(_0x339f5e[_0xa9f3('0xe')][_0xa9f3('0x10')]);}else{logger[_0xa9f3('0x11')](_0xa9f3('0x9'),_0x350598,_0xa9f3('0xa'));_0x11ccc4(_0x339f5e[_0xa9f3('0x12')][_0xa9f3('0x10')]);}})[_0xa9f3('0x13')](function(_0x41ba7a){logger[_0xa9f3('0xe')](_0xa9f3('0x9'),_0x350598,_0x41ba7a);_0x2bcd4c(_0x41ba7a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a740efd..b69cfab 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 _0xdf53=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','Router'];(function(_0x1c0da2,_0xc5aa9e){var _0x2b19b1=function(_0x5b27a6){while(--_0x5b27a6){_0x1c0da2['push'](_0x1c0da2['shift']());}};_0x2b19b1(++_0xc5aa9e);}(_0xdf53,0x173));var _0x3df5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf53[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3df5('0x0'));var timeout=require(_0x3df5('0x1'));var express=require('express');var router=express[_0x3df5('0x2')]();var fs_extra=require(_0x3df5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3df5('0x4'));var config=require(_0x3df5('0x5'));var controller=require(_0x3df5('0x6'));router['get']('/',auth[_0x3df5('0x7')](),controller[_0x3df5('0x8')]);router[_0x3df5('0x9')](_0x3df5('0xa'),auth['isAuthenticated'](),controller[_0x3df5('0xb')]);router['post']('/',auth[_0x3df5('0x7')](),controller['create']);router[_0x3df5('0xc')](_0x3df5('0xa'),auth[_0x3df5('0x7')](),controller[_0x3df5('0xd')]);router[_0x3df5('0xe')](_0x3df5('0xa'),auth[_0x3df5('0x7')](),controller[_0x3df5('0xf')]);module[_0x3df5('0x10')]=router; \ No newline at end of file +var _0xfe2a=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show'];(function(_0xd60f97,_0x189a11){var _0x2e71d1=function(_0x215b4a){while(--_0x215b4a){_0xd60f97['push'](_0xd60f97['shift']());}};_0x2e71d1(++_0x189a11);}(_0xfe2a,0x1c0));var _0xafe2=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0xfe2a[_0x2bb66c];return _0x1e0f98;};'use strict';var multer=require(_0xafe2('0x0'));var util=require(_0xafe2('0x1'));var path=require(_0xafe2('0x2'));var timeout=require('connect-timeout');var express=require(_0xafe2('0x3'));var router=express[_0xafe2('0x4')]();var fs_extra=require(_0xafe2('0x5'));var auth=require(_0xafe2('0x6'));var interaction=require(_0xafe2('0x7'));var config=require(_0xafe2('0x8'));var controller=require(_0xafe2('0x9'));router['get']('/',auth[_0xafe2('0xa')](),controller[_0xafe2('0xb')]);router[_0xafe2('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xafe2('0xd')]);router[_0xafe2('0xe')]('/',auth[_0xafe2('0xa')](),controller[_0xafe2('0xf')]);router[_0xafe2('0x10')](_0xafe2('0x11'),auth['isAuthenticated'](),controller[_0xafe2('0x12')]);router[_0xafe2('0x13')](_0xafe2('0x11'),auth[_0xafe2('0xa')](),controller[_0xafe2('0x14')]);module[_0xafe2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 90a4973..5d63a19 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 _0xe99d=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xe99d,0x1d7));var _0xde99=function(_0x30ee6c,_0x13748d){_0x30ee6c=_0x30ee6c-0x0;var _0x203f54=_0xe99d[_0x30ee6c];return _0x203f54;};'use strict';var Sequelize=require(_0xde99('0x0'));module[_0xde99('0x1')]={'type':{'type':Sequelize['ENUM'](_0xde99('0x2'),_0xde99('0x3'),_0xde99('0x4'),_0xde99('0x5'),_0xde99('0x6')),'defaultValue':_0xde99('0x2')},'content':{'type':Sequelize[_0xde99('0x7')]},'key':{'type':Sequelize[_0xde99('0x7')]},'keyType':{'type':Sequelize[_0xde99('0x8')](_0xde99('0x2'),_0xde99('0x3'),_0xde99('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde99('0x7')]},'nameField':{'type':Sequelize[_0xde99('0x7')]},'customField':{'type':Sequelize[_0xde99('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde99('0x7')]}}; \ No newline at end of file +var _0xc1cf=['customVariable','BOOLEAN','exports','ENUM','string','picklist','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc1cf,0xf0));var _0xfc1c=function(_0x19576f,_0x169212){_0x19576f=_0x19576f-0x0;var _0x4041bf=_0xc1cf[_0x19576f];return _0x4041bf;};'use strict';var Sequelize=require('sequelize');module[_0xfc1c('0x0')]={'type':{'type':Sequelize[_0xfc1c('0x1')](_0xfc1c('0x2'),'variable','customVariable','keyValue',_0xfc1c('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfc1c('0x4')]},'key':{'type':Sequelize[_0xfc1c('0x4')]},'keyType':{'type':Sequelize[_0xfc1c('0x1')](_0xfc1c('0x2'),'variable',_0xfc1c('0x5'))},'keyContent':{'type':Sequelize[_0xfc1c('0x4')]},'idField':{'type':Sequelize[_0xfc1c('0x4')]},'nameField':{'type':Sequelize[_0xfc1c('0x4')]},'customField':{'type':Sequelize[_0xfc1c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc1c('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 0bb2a34..8d4dbc0 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 _0xe605=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x133825,_0x1cac51){var _0x1e4b28=function(_0x27798d){while(--_0x27798d){_0x133825['push'](_0x133825['shift']());}};_0x1e4b28(++_0x1cac51);}(_0xe605,0x92));var _0x5e60=function(_0xf2ab9f,_0x33ce17){_0xf2ab9f=_0xf2ab9f-0x0;var _0x6c7c80=_0xe605[_0xf2ab9f];return _0x6c7c80;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2a499e[_0x5e60('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cb62,_0x56e3a5){return function(_0x2d8aac){if(!_0x2d8aac){_0x45cb62[_0x5e60('0x19')](0x194);}return _0x2d8aac;};}function handleError(_0x4a0dbc,_0x3bedea){_0x3bedea=_0x3bedea||0x1f4;return function(_0x5712f7){logger[_0x5e60('0x28')](_0x5712f7[_0x5e60('0x29')]);if(_0x5712f7['name']){delete _0x5712f7[_0x5e60('0x2a')];}_0x4a0dbc[_0x5e60('0x1a')](_0x3bedea)['send'](_0x5712f7);};}exports[_0x5e60('0x2b')]=function(_0xac9c7a,_0x52c97c){var _0x5431a8={},_0x52f668={},_0xf25956={'count':0x0,'rows':[]};var _0x235cc7=_[_0x5e60('0x2c')](db[_0x5e60('0x2d')][_0x5e60('0x2e')],function(_0x558197){return{'name':_0x558197[_0x5e60('0x2f')],'type':_0x558197[_0x5e60('0x30')]['key']};});_0x52f668[_0x5e60('0x31')]=_['map'](_0x235cc7,'name');_0x52f668[_0x5e60('0x32')]=_[_0x5e60('0x33')](_0xac9c7a[_0x5e60('0x32')]);_0x52f668[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],_0x52f668[_0x5e60('0x32')]);_0x5431a8[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],qs['fields'](_0xac9c7a[_0x5e60('0x32')]['fields']));_0x5431a8['attributes']=_0x5431a8[_0x5e60('0x36')][_0x5e60('0x37')]?_0x5431a8['attributes']:_0x52f668[_0x5e60('0x31')];if(!_0xac9c7a['query'][_0x5e60('0x38')](_0x5e60('0x39'))){_0x5431a8[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x1e')]);_0x5431a8[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0xac9c7a['query'][_0x5e60('0x1d')]);}_0x5431a8[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3b')]);_0x5431a8[_0x5e60('0x3c')]=qs[_0x5e60('0x34')](_['pick'](_0xac9c7a[_0x5e60('0x32')],_0x52f668[_0x5e60('0x34')]),_0x235cc7);if(_0xac9c7a['query']['filter']){_0x5431a8[_0x5e60('0x3c')]=_[_0x5e60('0x3d')](_0x5431a8[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2c')](_0x235cc7,function(_0x31b900){if(_0x31b900['type']!==_0x5e60('0x3e')){var _0x413bf0={};_0x413bf0[_0x31b900[_0x5e60('0x2a')]]={'$like':'%'+_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3f')]+'%'};return _0x413bf0;}})});}_0x5431a8=_[_0x5e60('0x3d')]({},_0x5431a8,_0xac9c7a[_0x5e60('0x40')]);var _0x54022a={'where':_0x5431a8[_0x5e60('0x3c')]};return db[_0x5e60('0x2d')]['count'](_0x54022a)['then'](function(_0x47a6df){_0xf25956[_0x5e60('0x20')]=_0x47a6df;if(_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x41')]){_0x5431a8[_0x5e60('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0x5e60('0x43')](_0x5431a8);})[_0x5e60('0x26')](function(_0x4b6192){_0xf25956['rows']=_0x4b6192;return _0xf25956;})[_0x5e60('0x26')](respondWithFilteredResult(_0x52c97c,_0x5431a8))[_0x5e60('0x44')](handleError(_0x52c97c,null));};exports[_0x5e60('0x45')]=function(_0x38ff1d,_0x39ab09){var _0x3899ae={'raw':!![],'where':{'id':_0x38ff1d[_0x5e60('0x46')]['id']}},_0x2522d2={};_0x2522d2[_0x5e60('0x31')]=_['keys'](db[_0x5e60('0x2d')][_0x5e60('0x2e')]);_0x2522d2['query']=_[_0x5e60('0x33')](_0x38ff1d[_0x5e60('0x32')]);_0x2522d2[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],_0x2522d2['query']);_0x3899ae[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],qs[_0x5e60('0x47')](_0x38ff1d['query']['fields']));_0x3899ae['attributes']=_0x3899ae[_0x5e60('0x36')][_0x5e60('0x37')]?_0x3899ae[_0x5e60('0x36')]:_0x2522d2[_0x5e60('0x31')];if(_0x38ff1d[_0x5e60('0x32')][_0x5e60('0x41')]){_0x3899ae['include']=[{'all':!![]}];}_0x3899ae=_[_0x5e60('0x3d')]({},_0x3899ae,_0x38ff1d[_0x5e60('0x40')]);return db[_0x5e60('0x2d')][_0x5e60('0x48')](_0x3899ae)[_0x5e60('0x26')](handleEntityNotFound(_0x39ab09,null))[_0x5e60('0x26')](respondWithResult(_0x39ab09,null))[_0x5e60('0x44')](handleError(_0x39ab09,null));};exports['create']=function(_0x24c757,_0x3ed45d){return db[_0x5e60('0x2d')][_0x5e60('0x49')](_0x24c757[_0x5e60('0x4a')],{})[_0x5e60('0x26')](respondWithResult(_0x3ed45d,0xc9))[_0x5e60('0x44')](handleError(_0x3ed45d,null));};exports[_0x5e60('0x25')]=function(_0x1518bd,_0x350d6d){if(_0x1518bd[_0x5e60('0x4a')]['id']){delete _0x1518bd[_0x5e60('0x4a')]['id'];}return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x1518bd[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x350d6d,null))[_0x5e60('0x26')](saveUpdates(_0x1518bd[_0x5e60('0x4a')],null))['then'](respondWithResult(_0x350d6d,null))['catch'](handleError(_0x350d6d,null));};exports[_0x5e60('0x27')]=function(_0x4d3588,_0x3525d){return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x4d3588[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x3525d,null))[_0x5e60('0x26')](removeEntity(_0x3525d,null))['catch'](handleError(_0x3525d,null));}; \ No newline at end of file +var _0x0bb5=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','FreshdeskField','fieldName','type','key'];(function(_0x533589,_0x7ea74f){var _0x1370ed=function(_0x1c573c){while(--_0x1c573c){_0x533589['push'](_0x533589['shift']());}};_0x1370ed(++_0x7ea74f);}(_0x0bb5,0x148));var _0x50bb=function(_0x37a3ff,_0x5a1b78){_0x37a3ff=_0x37a3ff-0x0;var _0x51f5bb=_0x0bb5[_0x37a3ff];return _0x51f5bb;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['FreshdeskField'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 8261aad..8dbe462 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 _0xc18a=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x3d50d3,_0x495bf1){var _0x1b955a=function(_0x27bc4b){while(--_0x27bc4b){_0x3d50d3['push'](_0x3d50d3['shift']());}};_0x1b955a(++_0x495bf1);}(_0xc18a,0x1cf));var _0xac18=function(_0x3c95bd,_0x14ef6d){_0x3c95bd=_0x3c95bd-0x0;var _0x5a67f5=_0xc18a[_0x3c95bd];return _0x5a67f5;};'use strict';var _=require(_0xac18('0x0'));var util=require(_0xac18('0x1'));var logger=require(_0xac18('0x2'))(_0xac18('0x3'));var moment=require('moment');var BPromise=require(_0xac18('0x4'));var rp=require(_0xac18('0x5'));var fs=require('fs');var path=require(_0xac18('0x6'));var rimraf=require(_0xac18('0x7'));var config=require(_0xac18('0x8'));var attributes=require(_0xac18('0x9'));module[_0xac18('0xa')]=function(_0x395493,_0x49136f){return _0x395493[_0xac18('0xb')](_0xac18('0xc'),attributes,{'tableName':_0xac18('0xd'),'paranoid':![],'indexes':[{'name':_0xac18('0xe'),'fields':[_0xac18('0xf'),_0xac18('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3d0=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0xb3d0,0x182));var _0x0b3d=function(_0x3613fe,_0x139120){_0x3613fe=_0x3613fe-0x0;var _0x272b8a=_0xb3d0[_0x3613fe];return _0x272b8a;};'use strict';var _=require(_0x0b3d('0x0'));var util=require(_0x0b3d('0x1'));var logger=require(_0x0b3d('0x2'))(_0x0b3d('0x3'));var moment=require('moment');var BPromise=require(_0x0b3d('0x4'));var rp=require(_0x0b3d('0x5'));var fs=require('fs');var path=require(_0x0b3d('0x6'));var rimraf=require(_0x0b3d('0x7'));var config=require(_0x0b3d('0x8'));var attributes=require(_0x0b3d('0x9'));module[_0x0b3d('0xa')]=function(_0xbb3a1c,_0x2fd0a2){return _0xbb3a1c['define'](_0x0b3d('0xb'),attributes,{'tableName':_0x0b3d('0xc'),'paranoid':![],'indexes':[{'name':_0x0b3d('0xd'),'fields':[_0x0b3d('0xe'),_0x0b3d('0xf')],'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 552e65e..389e360 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 _0x48a4=['../../config/environment','jayson/promise','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x392a6d,_0x444fd3){var _0x804380=function(_0x468044){while(--_0x468044){_0x392a6d['push'](_0x392a6d['shift']());}};_0x804380(++_0x444fd3);}(_0x48a4,0x186));var _0x448a=function(_0x9fcd95,_0x230411){_0x9fcd95=_0x9fcd95-0x0;var _0x117099=_0x48a4[_0x9fcd95];return _0x117099;};'use strict';var _=require('lodash');var util=require(_0x448a('0x0'));var moment=require(_0x448a('0x1'));var BPromise=require(_0x448a('0x2'));var rs=require(_0x448a('0x3'));var fs=require('fs');var Redis=require(_0x448a('0x4'));var db=require(_0x448a('0x5'))['db'];var utils=require(_0x448a('0x6'));var logger=require(_0x448a('0x7'))(_0x448a('0x8'));var config=require(_0x448a('0x9'));var jayson=require(_0x448a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4994ec,_0x38d187,_0x22dc77){return new BPromise(function(_0x581e41,_0x5118ee){return client['request'](_0x4994ec,_0x22dc77)['then'](function(_0x4be5d9){logger['info'](_0x448a('0xb'),_0x38d187,_0x448a('0xc'));logger[_0x448a('0xd')](_0x448a('0xe'),_0x38d187,_0x448a('0xc'),JSON['stringify'](_0x4be5d9));if(_0x4be5d9[_0x448a('0xf')]){if(_0x4be5d9[_0x448a('0xf')][_0x448a('0x10')]===0x1f4){logger[_0x448a('0xf')](_0x448a('0xb'),_0x38d187,_0x4be5d9[_0x448a('0xf')][_0x448a('0x11')]);return _0x5118ee(_0x4be5d9[_0x448a('0xf')][_0x448a('0x11')]);}logger[_0x448a('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x38d187,_0x4be5d9['error']['message']);return _0x581e41(_0x4be5d9['error'][_0x448a('0x11')]);}else{logger[_0x448a('0x12')](_0x448a('0xb'),_0x38d187,'request\x20sent');_0x581e41(_0x4be5d9[_0x448a('0x13')][_0x448a('0x11')]);}})[_0x448a('0x14')](function(_0x26f217){logger[_0x448a('0xf')](_0x448a('0xb'),_0x38d187,_0x26f217);_0x5118ee(_0x26f217);});});} \ No newline at end of file +var _0x7655=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../mysqldb'];(function(_0x15edde,_0x5ddcd6){var _0x1091b0=function(_0x505673){while(--_0x505673){_0x15edde['push'](_0x15edde['shift']());}};_0x1091b0(++_0x5ddcd6);}(_0x7655,0x172));var _0x5765=function(_0x2aaf37,_0x4c5bda){_0x2aaf37=_0x2aaf37-0x0;var _0x43ae4e=_0x7655[_0x2aaf37];return _0x43ae4e;};'use strict';var _=require('lodash');var util=require(_0x5765('0x0'));var moment=require(_0x5765('0x1'));var BPromise=require(_0x5765('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5765('0x3'))['db'];var utils=require(_0x5765('0x4'));var logger=require(_0x5765('0x5'))(_0x5765('0x6'));var config=require(_0x5765('0x7'));var jayson=require(_0x5765('0x8'));var client=jayson[_0x5765('0x9')][_0x5765('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8ba66d,_0x4dd85f,_0x24dd4){return new BPromise(function(_0x4c1da3,_0x454766){return client['request'](_0x8ba66d,_0x24dd4)[_0x5765('0xb')](function(_0x14445d){logger[_0x5765('0xc')](_0x5765('0xd'),_0x4dd85f,_0x5765('0xe'));logger[_0x5765('0xf')](_0x5765('0x10'),_0x4dd85f,_0x5765('0xe'),JSON[_0x5765('0x11')](_0x14445d));if(_0x14445d[_0x5765('0x12')]){if(_0x14445d[_0x5765('0x12')][_0x5765('0x13')]===0x1f4){logger[_0x5765('0x12')](_0x5765('0xd'),_0x4dd85f,_0x14445d[_0x5765('0x12')]['message']);return _0x454766(_0x14445d[_0x5765('0x12')][_0x5765('0x14')]);}logger[_0x5765('0x12')](_0x5765('0xd'),_0x4dd85f,_0x14445d['error'][_0x5765('0x14')]);return _0x4c1da3(_0x14445d[_0x5765('0x12')][_0x5765('0x14')]);}else{logger[_0x5765('0xc')](_0x5765('0xd'),_0x4dd85f,_0x5765('0xe'));_0x4c1da3(_0x14445d[_0x5765('0x15')][_0x5765('0x14')]);}})['catch'](function(_0x22a0e5){logger[_0x5765('0x12')](_0x5765('0xd'),_0x4dd85f,_0x22a0e5);_0x454766(_0x22a0e5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 5cd7342..ae51aa1 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 _0x0bb5=['./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x498cc9,_0x3cb602){var _0x5e4cb3=function(_0x377c39){while(--_0x377c39){_0x498cc9['push'](_0x498cc9['shift']());}};_0x5e4cb3(++_0x3cb602);}(_0x0bb5,0x148));var _0x50bb=function(_0x1e33d3,_0x456c60){_0x1e33d3=_0x1e33d3-0x0;var _0x41fdb3=_0x0bb5[_0x1e33d3];return _0x41fdb3;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/configurations',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x10')]('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x10')](_0x50bb('0x12'),auth[_0x50bb('0xb')](),controller['addConfiguration']);router[_0x50bb('0x13')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);module[_0x50bb('0x17')]=router; \ No newline at end of file +var _0x80ed=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path'];(function(_0xe24e7e,_0x24b30c){var _0x1068d6=function(_0x487bf9){while(--_0x487bf9){_0xe24e7e['push'](_0xe24e7e['shift']());}};_0x1068d6(++_0x24b30c);}(_0x80ed,0x11c));var _0xd80e=function(_0xdb8341,_0x211d09){_0xdb8341=_0xdb8341-0x0;var _0x5ed03f=_0x80ed[_0xdb8341];return _0x5ed03f;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getFields']);router[_0xd80e('0x10')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x10')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x12')]);router[_0xd80e('0x13')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x14')]);module[_0xd80e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ab8ee0c..fa69326 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 _0x0598=['exports','STRING','sequelize'];(function(_0x4b281a,_0x1733de){var _0x3149a7=function(_0x3a6b40){while(--_0x3a6b40){_0x4b281a['push'](_0x4b281a['shift']());}};_0x3149a7(++_0x1733de);}(_0x0598,0x92));var _0x8059=function(_0x20403b,_0x2c83e2){_0x20403b=_0x20403b-0x0;var _0x818d12=_0x0598[_0x20403b];return _0x818d12;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x77e6=['STRING','username','sequelize','exports'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x77e6,0x1a6));var _0x677e=function(_0x30695f,_0xde6f19){_0x30695f=_0x30695f-0x0;var _0x2740ec=_0x77e6[_0x30695f];return _0x2740ec;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'name':{'type':Sequelize[_0x677e('0x2')]},'description':{'type':Sequelize[_0x677e('0x2')]},'username':{'type':Sequelize[_0x677e('0x2')],'unique':_0x677e('0x3')},'apiKey':{'type':Sequelize[_0x677e('0x2')]},'remoteUri':{'type':Sequelize[_0x677e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x677e('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 6d04cba..3054826 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 _0x2843=['error','name','send','index','map','FreshsalesAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','catch','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy'];(function(_0x15ad3f,_0x1d6280){var _0xfb1d10=function(_0x2730f7){while(--_0x2730f7){_0x15ad3f['push'](_0x15ad3f['shift']());}};_0xfb1d10(++_0x1d6280);}(_0x2843,0x174));var _0x3284=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x2843[_0x373096];return _0x14a6d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3284('0x0'));var zipdir=require(_0x3284('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3284('0x2'));var Mustache=require(_0x3284('0x3'));var util=require(_0x3284('0x4'));var path=require('path');var sox=require(_0x3284('0x5'));var csv=require(_0x3284('0x6'));var ejs=require(_0x3284('0x7'));var fs=require('fs');var fs_extra=require(_0x3284('0x8'));var _=require('lodash');var squel=require(_0x3284('0x9'));var crypto=require('crypto');var jsforce=require(_0x3284('0xa'));var deskjs=require(_0x3284('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3284('0xc'));var Papa=require('papaparse');var Redis=require(_0x3284('0xd'));var authService=require(_0x3284('0xe'));var qs=require(_0x3284('0xf'));var as=require(_0x3284('0x10'));var hardwareService=require(_0x3284('0x11'));var logger=require('../../config/logger')(_0x3284('0x12'));var utils=require(_0x3284('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3284('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x48bb26,_0x37548d){_0x37548d=_0x37548d||0xcc;return function(_0x2f97dc){if(_0x2f97dc){return _0x48bb26[_0x3284('0x15')](_0x37548d);}return _0x48bb26[_0x3284('0x16')](_0x37548d)[_0x3284('0x17')]();};}function respondWithResult(_0x1a6da3,_0x104eff){_0x104eff=_0x104eff||0xc8;return function(_0x57a52e){if(_0x57a52e){return _0x1a6da3[_0x3284('0x16')](_0x104eff)['json'](_0x57a52e);}};}function respondWithFilteredResult(_0x21632a,_0x172b58){return function(_0x54816b){if(_0x54816b){var _0x43cb34=typeof _0x172b58[_0x3284('0x18')]===_0x3284('0x19')&&typeof _0x172b58[_0x3284('0x1a')]===_0x3284('0x19');var _0x55e709=_0x54816b[_0x3284('0x1b')];var _0x436546=_0x43cb34?0x0:_0x172b58[_0x3284('0x18')];var _0x525ce5=_0x43cb34?_0x54816b[_0x3284('0x1b')]:_0x172b58[_0x3284('0x18')]+_0x172b58[_0x3284('0x1a')];var _0x27cc95;if(_0x525ce5>=_0x55e709){_0x525ce5=_0x55e709;_0x27cc95=0xc8;}else{_0x27cc95=0xce;}_0x21632a[_0x3284('0x16')](_0x27cc95);return _0x21632a[_0x3284('0x1c')](_0x3284('0x1d'),_0x436546+'-'+_0x525ce5+'/'+_0x55e709)[_0x3284('0x1e')](_0x54816b);}return null;};}function patchUpdates(_0x18a65c){return function(_0x109a78){try{jsonpatch['apply'](_0x109a78,_0x18a65c,!![]);}catch(_0x5dd92c){return BPromise[_0x3284('0x1f')](_0x5dd92c);}return _0x109a78[_0x3284('0x20')]();};}function saveUpdates(_0x38a3da,_0x874cd){return function(_0x3c418a){if(_0x3c418a){return _0x3c418a[_0x3284('0x21')](_0x38a3da)[_0x3284('0x22')](function(_0x47a9e6){return _0x47a9e6;});}return null;};}function removeEntity(_0x492dca,_0xaf7284){return function(_0x541683){if(_0x541683){return _0x541683[_0x3284('0x23')]()[_0x3284('0x22')](function(){_0x492dca[_0x3284('0x16')](0xcc)[_0x3284('0x17')]();});}};}function handleEntityNotFound(_0x3149b5,_0xe0e8a5){return function(_0x1a15fe){if(!_0x1a15fe){_0x3149b5['sendStatus'](0x194);}return _0x1a15fe;};}function handleError(_0x59a787,_0x362152){_0x362152=_0x362152||0x1f4;return function(_0x2ac826){logger[_0x3284('0x24')](_0x2ac826['stack']);if(_0x2ac826[_0x3284('0x25')]){delete _0x2ac826[_0x3284('0x25')];}_0x59a787[_0x3284('0x16')](_0x362152)[_0x3284('0x26')](_0x2ac826);};}exports[_0x3284('0x27')]=function(_0x49ad6d,_0x35574b){var _0x12a059={},_0x4f1f33={},_0x2a60bf={'count':0x0,'rows':[]};var _0x237dac=_[_0x3284('0x28')](db[_0x3284('0x29')][_0x3284('0x2a')],function(_0x5eb501){return{'name':_0x5eb501['fieldName'],'type':_0x5eb501['type'][_0x3284('0x2b')]};});_0x4f1f33[_0x3284('0x2c')]=_[_0x3284('0x28')](_0x237dac,_0x3284('0x25'));_0x4f1f33[_0x3284('0x2d')]=_[_0x3284('0x2e')](_0x49ad6d[_0x3284('0x2d')]);_0x4f1f33[_0x3284('0x2f')]=_[_0x3284('0x30')](_0x4f1f33[_0x3284('0x2c')],_0x4f1f33[_0x3284('0x2d')]);_0x12a059[_0x3284('0x31')]=_['intersection'](_0x4f1f33['model'],qs['fields'](_0x49ad6d[_0x3284('0x2d')][_0x3284('0x32')]));_0x12a059[_0x3284('0x31')]=_0x12a059[_0x3284('0x31')][_0x3284('0x33')]?_0x12a059[_0x3284('0x31')]:_0x4f1f33[_0x3284('0x2c')];if(!_0x49ad6d['query']['hasOwnProperty'](_0x3284('0x34'))){_0x12a059[_0x3284('0x1a')]=qs[_0x3284('0x1a')](_0x49ad6d[_0x3284('0x2d')][_0x3284('0x1a')]);_0x12a059[_0x3284('0x18')]=qs['offset'](_0x49ad6d[_0x3284('0x2d')][_0x3284('0x18')]);}_0x12a059[_0x3284('0x35')]=qs[_0x3284('0x36')](_0x49ad6d[_0x3284('0x2d')][_0x3284('0x36')]);_0x12a059['where']=qs[_0x3284('0x2f')](_[_0x3284('0x37')](_0x49ad6d[_0x3284('0x2d')],_0x4f1f33[_0x3284('0x2f')]),_0x237dac);if(_0x49ad6d[_0x3284('0x2d')]['filter']){_0x12a059[_0x3284('0x38')]=_[_0x3284('0x39')](_0x12a059['where'],{'$or':_['map'](_0x237dac,function(_0x2f995f){if(_0x2f995f[_0x3284('0x3a')]!==_0x3284('0x3b')){var _0x672ee1={};_0x672ee1[_0x2f995f[_0x3284('0x25')]]={'$like':'%'+_0x49ad6d[_0x3284('0x2d')][_0x3284('0x3c')]+'%'};return _0x672ee1;}})});}_0x12a059=_[_0x3284('0x39')]({},_0x12a059,_0x49ad6d[_0x3284('0x3d')]);var _0x5abc20={'where':_0x12a059[_0x3284('0x38')]};return db[_0x3284('0x29')][_0x3284('0x1b')](_0x5abc20)[_0x3284('0x22')](function(_0x14fd1b){_0x2a60bf['count']=_0x14fd1b;if(_0x49ad6d[_0x3284('0x2d')][_0x3284('0x3e')]){_0x12a059[_0x3284('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x3284('0x40')](_0x12a059);})['then'](function(_0x3f0650){_0x2a60bf['rows']=_0x3f0650;return _0x2a60bf;})['then'](respondWithFilteredResult(_0x35574b,_0x12a059))['catch'](handleError(_0x35574b,null));};exports[_0x3284('0x41')]=function(_0x4b464a,_0x2b0b47){var _0x5c687d={'raw':![],'where':{'id':_0x4b464a['params']['id']}},_0x4f1f36={};_0x4f1f36[_0x3284('0x2c')]=_[_0x3284('0x2e')](db['FreshsalesAccount']['rawAttributes']);_0x4f1f36[_0x3284('0x2d')]=_[_0x3284('0x2e')](_0x4b464a[_0x3284('0x2d')]);_0x4f1f36['filters']=_[_0x3284('0x30')](_0x4f1f36['model'],_0x4f1f36[_0x3284('0x2d')]);_0x5c687d[_0x3284('0x31')]=_[_0x3284('0x30')](_0x4f1f36['model'],qs[_0x3284('0x32')](_0x4b464a['query']['fields']));_0x5c687d[_0x3284('0x31')]=_0x5c687d[_0x3284('0x31')][_0x3284('0x33')]?_0x5c687d[_0x3284('0x31')]:_0x4f1f36[_0x3284('0x2c')];if(_0x4b464a[_0x3284('0x2d')][_0x3284('0x3e')]){_0x5c687d[_0x3284('0x3f')]=[{'all':!![]}];}_0x5c687d=_[_0x3284('0x39')]({},_0x5c687d,_0x4b464a[_0x3284('0x3d')]);return db[_0x3284('0x29')][_0x3284('0x42')](_0x5c687d)[_0x3284('0x22')](handleEntityNotFound(_0x2b0b47,null))['then'](respondWithResult(_0x2b0b47,null))['catch'](handleError(_0x2b0b47,null));};exports[_0x3284('0x43')]=function(_0x4d9d70,_0x180d14){return db[_0x3284('0x29')][_0x3284('0x43')](_0x4d9d70[_0x3284('0x44')],{})['then'](respondWithResult(_0x180d14,0xc9))['catch'](handleError(_0x180d14,null));};exports[_0x3284('0x21')]=function(_0x5731fb,_0x4af963){if(_0x5731fb[_0x3284('0x44')]['id']){delete _0x5731fb[_0x3284('0x44')]['id'];}return db[_0x3284('0x29')][_0x3284('0x42')]({'where':{'id':_0x5731fb[_0x3284('0x45')]['id']}})['then'](handleEntityNotFound(_0x4af963,null))[_0x3284('0x22')](saveUpdates(_0x5731fb[_0x3284('0x44')],null))[_0x3284('0x22')](respondWithResult(_0x4af963,null))['catch'](handleError(_0x4af963,null));};exports[_0x3284('0x23')]=function(_0x353e53,_0x47e7f7){return db['FreshsalesAccount']['find']({'where':{'id':_0x353e53[_0x3284('0x45')]['id']}})['then'](handleEntityNotFound(_0x47e7f7,null))[_0x3284('0x22')](removeEntity(_0x47e7f7,null))['catch'](handleError(_0x47e7f7,null));};exports[_0x3284('0x46')]=function(_0x392edd,_0x578489,_0x9188cf){var _0x7f5892={};var _0x12f47e={};var _0x3aae11;var _0x125c93;return db[_0x3284('0x29')][_0x3284('0x47')]({'where':{'id':_0x392edd['params']['id']}})['then'](handleEntityNotFound(_0x578489,null))[_0x3284('0x22')](function(_0x243600){if(_0x243600){_0x3aae11=_0x243600;_0x12f47e[_0x3284('0x2c')]=_[_0x3284('0x2e')](db[_0x3284('0x48')][_0x3284('0x2a')]);_0x12f47e[_0x3284('0x2d')]=_[_0x3284('0x2e')](_0x392edd['query']);_0x12f47e[_0x3284('0x2f')]=_['intersection'](_0x12f47e['model'],_0x12f47e['query']);_0x7f5892['attributes']=_[_0x3284('0x30')](_0x12f47e['model'],qs[_0x3284('0x32')](_0x392edd[_0x3284('0x2d')][_0x3284('0x32')]));_0x7f5892['attributes']=_0x7f5892[_0x3284('0x31')][_0x3284('0x33')]?_0x7f5892[_0x3284('0x31')]:_0x12f47e[_0x3284('0x2c')];_0x7f5892[_0x3284('0x35')]=qs[_0x3284('0x36')](_0x392edd[_0x3284('0x2d')][_0x3284('0x36')]);_0x7f5892['where']=qs[_0x3284('0x2f')](_[_0x3284('0x37')](_0x392edd[_0x3284('0x2d')],_0x12f47e[_0x3284('0x2f')]));if(_0x392edd[_0x3284('0x2d')][_0x3284('0x3c')]){_0x7f5892['where']=_[_0x3284('0x39')](_0x7f5892[_0x3284('0x38')],{'$or':_[_0x3284('0x28')](_0x7f5892[_0x3284('0x31')],function(_0x2eccfd){var _0x449a01={};_0x449a01[_0x2eccfd]={'$like':'%'+_0x392edd[_0x3284('0x2d')][_0x3284('0x3c')]+'%'};return _0x449a01;})});}_0x7f5892=_[_0x3284('0x39')]({},_0x7f5892,_0x392edd['options']);return _0x3aae11[_0x3284('0x46')](_0x7f5892);}})[_0x3284('0x22')](function(_0x41277a){if(_0x41277a){_0x125c93=_0x41277a[_0x3284('0x33')];if(!_0x392edd['query'][_0x3284('0x49')]('nolimit')){_0x7f5892['limit']=qs['limit'](_0x392edd['query'][_0x3284('0x1a')]);_0x7f5892[_0x3284('0x18')]=qs[_0x3284('0x18')](_0x392edd[_0x3284('0x2d')]['offset']);}return _0x3aae11[_0x3284('0x46')](_0x7f5892);}})[_0x3284('0x22')](function(_0xe675c8){if(_0xe675c8){return _0xe675c8?{'count':_0x125c93,'rows':_0xe675c8}:null;}})['then'](respondWithResult(_0x578489,null))[_0x3284('0x4a')](handleError(_0x578489,null));};exports[_0x3284('0x4b')]=function(_0x5d3dd3,_0x52ab77,_0x2a4e15){if(_0x5d3dd3[_0x3284('0x44')]['id']){delete _0x5d3dd3['body']['id'];}return db[_0x3284('0x29')]['findOne']({'where':{'id':_0x5d3dd3[_0x3284('0x45')]['id']}})[_0x3284('0x22')](handleEntityNotFound(_0x52ab77,null))[_0x3284('0x22')](function(_0x3380a9){if(_0x3380a9){_0x5d3dd3[_0x3284('0x44')][_0x3284('0x4c')]=_0x3380a9['id'];_0x5d3dd3[_0x3284('0x44')][_0x3284('0x4d')]=integrations[_0x3284('0x4e')](_0x5d3dd3[_0x3284('0x44')][_0x3284('0x4f')],_0x5d3dd3['body'][_0x3284('0x3a')]);_0x5d3dd3[_0x3284('0x44')][_0x3284('0x50')]=integrations[_0x3284('0x51')](_0x5d3dd3[_0x3284('0x44')]['channel'],_0x5d3dd3[_0x3284('0x44')][_0x3284('0x3a')]);return db[_0x3284('0x48')][_0x3284('0x43')](_0x5d3dd3['body'],{'include':[{'model':db[_0x3284('0x52')],'as':_0x3284('0x4d')},{'model':db[_0x3284('0x52')],'as':_0x3284('0x50')}]});}return null;})[_0x3284('0x22')](respondWithResult(_0x52ab77,null))['catch'](handleError(_0x52ab77,null));};exports[_0x3284('0x53')]=function(_0x133e93,_0x4bf53e,_0x123cfb){var _0x5d15d6='';var _0x1b158f='';return db[_0x3284('0x29')][_0x3284('0x47')]({'where':{'id':_0x133e93[_0x3284('0x45')]['id']},'attributes':['id',_0x3284('0x54'),'remoteUri',_0x3284('0x55')]})['then'](handleEntityNotFound(_0x4bf53e,null))[_0x3284('0x22')](function(_0x15a3bb){if(_0x15a3bb){_0x1b158f=_0x15a3bb[_0x3284('0x54')];_0x5d15d6=_0x15a3bb[_0x3284('0x56')];var _0x37ec78=_0x15a3bb['remoteUri'][_0x3284('0x57')](-0x1);if(_0x37ec78==='/'){_0x5d15d6=_0x5d15d6[_0x3284('0x58')](0x0,_0x5d15d6['lastIndexOf'](_0x37ec78));}return rp({'method':_0x3284('0x59'),'uri':util[_0x3284('0x5a')](_0x3284('0x5b'),_0x5d15d6,_0x3284('0x5c')),'headers':{'Authorization':_0x3284('0x5d')+_0x15a3bb[_0x3284('0x55')]},'json':!![]});}})[_0x3284('0x22')](function(_0x2ef499){if(_0x2ef499){var _0x46d240=_0x2ef499[_0x3284('0x5e')];var _0x4e7146=![];var _0x1b4c95=null;for(_0x1b4c95=0x0;_0x1b4c95<_0x46d240[_0x3284('0x33')];_0x1b4c95++){if(_0x46d240[_0x1b4c95][_0x3284('0x5f')]===_0x1b158f){_0x4e7146=!![];}}if(_0x4e7146){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3284('0x60')});}}})['then'](respondWithResult(_0x4bf53e,null))[_0x3284('0x4a')](function(_0x5659f9){var _0x21b91c=_0x133e93[_0x3284('0x2d')][_0x3284('0x61')]?0x1f4:_0x5659f9['statusCode']||0x1f4;logger[_0x3284('0x24')](_0x3284('0x62'),_0x3284('0x53'),_0x21b91c,JSON[_0x3284('0x63')](_0x5659f9));delete _0x5659f9[_0x3284('0x25')];if(_0x21b91c===0x191){_0x21b91c=0x190;}_0x4bf53e[_0x3284('0x16')](_0x21b91c)[_0x3284('0x26')](_0x133e93[_0x3284('0x2d')]['test']?{'message':_0x3284('0x64'),'statusCode':_0x5659f9[_0x3284('0x65')]}:_0x5659f9);});}; \ No newline at end of file +var _0xddc9=['FreshsalesAccount','rawAttributes','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','destroy','findOne','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map'];(function(_0x31a590,_0x2368d0){var _0xedf547=function(_0x47d9b6){while(--_0x47d9b6){_0x31a590['push'](_0x31a590['shift']());}};_0xedf547(++_0x2368d0);}(_0xddc9,0x1e3));var _0x9ddc=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0xddc9[_0x59145a];return _0xf04d7;};'use strict';var emlformat=require(_0x9ddc('0x0'));var rimraf=require(_0x9ddc('0x1'));var zipdir=require(_0x9ddc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ddc('0x3'));var moment=require(_0x9ddc('0x4'));var BPromise=require(_0x9ddc('0x5'));var Mustache=require(_0x9ddc('0x6'));var util=require(_0x9ddc('0x7'));var path=require(_0x9ddc('0x8'));var sox=require(_0x9ddc('0x9'));var csv=require(_0x9ddc('0xa'));var ejs=require(_0x9ddc('0xb'));var fs=require('fs');var fs_extra=require(_0x9ddc('0xc'));var _=require(_0x9ddc('0xd'));var squel=require(_0x9ddc('0xe'));var crypto=require(_0x9ddc('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9ddc('0x10'));var toCsv=require(_0x9ddc('0xa'));var querystring=require(_0x9ddc('0x11'));var Papa=require(_0x9ddc('0x12'));var Redis=require(_0x9ddc('0x13'));var authService=require(_0x9ddc('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9ddc('0x15'));var hardwareService=require(_0x9ddc('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9ddc('0x17'));var config=require(_0x9ddc('0x18'));var licenseUtil=require(_0x9ddc('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9ddc('0x1a'));function respondWithStatusCode(_0xda9093,_0x3445c9){_0x3445c9=_0x3445c9||0xcc;return function(_0x597fdc){if(_0x597fdc){return _0xda9093[_0x9ddc('0x1b')](_0x3445c9);}return _0xda9093['status'](_0x3445c9)['end']();};}function respondWithResult(_0x265739,_0x50c759){_0x50c759=_0x50c759||0xc8;return function(_0x157bcc){if(_0x157bcc){return _0x265739['status'](_0x50c759)[_0x9ddc('0x1c')](_0x157bcc);}};}function respondWithFilteredResult(_0x32ddf9,_0x57f229){return function(_0x4d850){if(_0x4d850){var _0x5458cc=typeof _0x57f229[_0x9ddc('0x1d')]===_0x9ddc('0x1e')&&typeof _0x57f229[_0x9ddc('0x1f')]==='undefined';var _0x12ec99=_0x4d850[_0x9ddc('0x20')];var _0x2b6bb7=_0x5458cc?0x0:_0x57f229[_0x9ddc('0x1d')];var _0x2c2726=_0x5458cc?_0x4d850[_0x9ddc('0x20')]:_0x57f229[_0x9ddc('0x1d')]+_0x57f229[_0x9ddc('0x1f')];var _0x43eae4;if(_0x2c2726>=_0x12ec99){_0x2c2726=_0x12ec99;_0x43eae4=0xc8;}else{_0x43eae4=0xce;}_0x32ddf9[_0x9ddc('0x21')](_0x43eae4);return _0x32ddf9[_0x9ddc('0x22')](_0x9ddc('0x23'),_0x2b6bb7+'-'+_0x2c2726+'/'+_0x12ec99)['json'](_0x4d850);}return null;};}function patchUpdates(_0x3057e){return function(_0x500ad0){try{jsonpatch[_0x9ddc('0x24')](_0x500ad0,_0x3057e,!![]);}catch(_0x518011){return BPromise['reject'](_0x518011);}return _0x500ad0[_0x9ddc('0x25')]();};}function saveUpdates(_0x4f49bc,_0x4d5473){return function(_0x2c5930){if(_0x2c5930){return _0x2c5930[_0x9ddc('0x26')](_0x4f49bc)[_0x9ddc('0x27')](function(_0x313fd0){return _0x313fd0;});}return null;};}function removeEntity(_0x53fd70,_0x322707){return function(_0x26787){if(_0x26787){return _0x26787['destroy']()[_0x9ddc('0x27')](function(){_0x53fd70[_0x9ddc('0x21')](0xcc)[_0x9ddc('0x28')]();});}};}function handleEntityNotFound(_0x391f1d,_0x179edc){return function(_0xa839c1){if(!_0xa839c1){_0x391f1d[_0x9ddc('0x1b')](0x194);}return _0xa839c1;};}function handleError(_0x34462a,_0x3943ef){_0x3943ef=_0x3943ef||0x1f4;return function(_0x7ba03d){logger[_0x9ddc('0x29')](_0x7ba03d[_0x9ddc('0x2a')]);if(_0x7ba03d[_0x9ddc('0x2b')]){delete _0x7ba03d[_0x9ddc('0x2b')];}_0x34462a['status'](_0x3943ef)[_0x9ddc('0x2c')](_0x7ba03d);};}exports[_0x9ddc('0x2d')]=function(_0x160691,_0x2ed987){var _0x27e805={},_0x57ef1d={},_0x3436d3={'count':0x0,'rows':[]};var _0x1efccc=_[_0x9ddc('0x2e')](db[_0x9ddc('0x2f')][_0x9ddc('0x30')],function(_0x47b79f){return{'name':_0x47b79f['fieldName'],'type':_0x47b79f[_0x9ddc('0x31')]['key']};});_0x57ef1d[_0x9ddc('0x32')]=_[_0x9ddc('0x2e')](_0x1efccc,_0x9ddc('0x2b'));_0x57ef1d['query']=_['keys'](_0x160691['query']);_0x57ef1d[_0x9ddc('0x33')]=_[_0x9ddc('0x34')](_0x57ef1d[_0x9ddc('0x32')],_0x57ef1d[_0x9ddc('0x35')]);_0x27e805[_0x9ddc('0x36')]=_['intersection'](_0x57ef1d[_0x9ddc('0x32')],qs[_0x9ddc('0x37')](_0x160691[_0x9ddc('0x35')][_0x9ddc('0x37')]));_0x27e805[_0x9ddc('0x36')]=_0x27e805[_0x9ddc('0x36')][_0x9ddc('0x38')]?_0x27e805[_0x9ddc('0x36')]:_0x57ef1d['model'];if(!_0x160691[_0x9ddc('0x35')][_0x9ddc('0x39')](_0x9ddc('0x3a'))){_0x27e805['limit']=qs[_0x9ddc('0x1f')](_0x160691[_0x9ddc('0x35')][_0x9ddc('0x1f')]);_0x27e805[_0x9ddc('0x1d')]=qs[_0x9ddc('0x1d')](_0x160691[_0x9ddc('0x35')]['offset']);}_0x27e805[_0x9ddc('0x3b')]=qs[_0x9ddc('0x3c')](_0x160691['query'][_0x9ddc('0x3c')]);_0x27e805[_0x9ddc('0x3d')]=qs[_0x9ddc('0x33')](_['pick'](_0x160691[_0x9ddc('0x35')],_0x57ef1d['filters']),_0x1efccc);if(_0x160691[_0x9ddc('0x35')]['filter']){_0x27e805[_0x9ddc('0x3d')]=_[_0x9ddc('0x3e')](_0x27e805[_0x9ddc('0x3d')],{'$or':_['map'](_0x1efccc,function(_0x3554d0){if(_0x3554d0[_0x9ddc('0x31')]!==_0x9ddc('0x3f')){var _0x122735={};_0x122735[_0x3554d0[_0x9ddc('0x2b')]]={'$like':'%'+_0x160691[_0x9ddc('0x35')][_0x9ddc('0x40')]+'%'};return _0x122735;}})});}_0x27e805=_[_0x9ddc('0x3e')]({},_0x27e805,_0x160691[_0x9ddc('0x41')]);var _0x2f42c6={'where':_0x27e805[_0x9ddc('0x3d')]};return db[_0x9ddc('0x2f')][_0x9ddc('0x20')](_0x2f42c6)['then'](function(_0x510ead){_0x3436d3['count']=_0x510ead;if(_0x160691[_0x9ddc('0x35')][_0x9ddc('0x42')]){_0x27e805['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x9ddc('0x43')](_0x27e805);})[_0x9ddc('0x27')](function(_0x48a1f8){_0x3436d3[_0x9ddc('0x44')]=_0x48a1f8;return _0x3436d3;})[_0x9ddc('0x27')](respondWithFilteredResult(_0x2ed987,_0x27e805))[_0x9ddc('0x45')](handleError(_0x2ed987,null));};exports['show']=function(_0x159986,_0x266262){var _0x1dde47={'raw':![],'where':{'id':_0x159986[_0x9ddc('0x46')]['id']}},_0x19b6f7={};_0x19b6f7['model']=_[_0x9ddc('0x47')](db[_0x9ddc('0x2f')]['rawAttributes']);_0x19b6f7[_0x9ddc('0x35')]=_[_0x9ddc('0x47')](_0x159986['query']);_0x19b6f7[_0x9ddc('0x33')]=_[_0x9ddc('0x34')](_0x19b6f7[_0x9ddc('0x32')],_0x19b6f7['query']);_0x1dde47[_0x9ddc('0x36')]=_[_0x9ddc('0x34')](_0x19b6f7[_0x9ddc('0x32')],qs['fields'](_0x159986[_0x9ddc('0x35')][_0x9ddc('0x37')]));_0x1dde47['attributes']=_0x1dde47[_0x9ddc('0x36')]['length']?_0x1dde47['attributes']:_0x19b6f7[_0x9ddc('0x32')];if(_0x159986['query'][_0x9ddc('0x42')]){_0x1dde47[_0x9ddc('0x48')]=[{'all':!![]}];}_0x1dde47=_[_0x9ddc('0x3e')]({},_0x1dde47,_0x159986[_0x9ddc('0x41')]);return db[_0x9ddc('0x2f')][_0x9ddc('0x49')](_0x1dde47)[_0x9ddc('0x27')](handleEntityNotFound(_0x266262,null))[_0x9ddc('0x27')](respondWithResult(_0x266262,null))[_0x9ddc('0x45')](handleError(_0x266262,null));};exports[_0x9ddc('0x4a')]=function(_0x94ee00,_0x2ea27e){return db[_0x9ddc('0x2f')]['create'](_0x94ee00[_0x9ddc('0x4b')],{})['then'](respondWithResult(_0x2ea27e,0xc9))[_0x9ddc('0x45')](handleError(_0x2ea27e,null));};exports['update']=function(_0x5bfdda,_0x3fb7b7){if(_0x5bfdda[_0x9ddc('0x4b')]['id']){delete _0x5bfdda[_0x9ddc('0x4b')]['id'];}return db[_0x9ddc('0x2f')][_0x9ddc('0x49')]({'where':{'id':_0x5bfdda['params']['id']}})['then'](handleEntityNotFound(_0x3fb7b7,null))[_0x9ddc('0x27')](saveUpdates(_0x5bfdda[_0x9ddc('0x4b')],null))[_0x9ddc('0x27')](respondWithResult(_0x3fb7b7,null))[_0x9ddc('0x45')](handleError(_0x3fb7b7,null));};exports[_0x9ddc('0x4c')]=function(_0x2012a5,_0x2a7012){return db[_0x9ddc('0x2f')][_0x9ddc('0x49')]({'where':{'id':_0x2012a5[_0x9ddc('0x46')]['id']}})[_0x9ddc('0x27')](handleEntityNotFound(_0x2a7012,null))[_0x9ddc('0x27')](removeEntity(_0x2a7012,null))[_0x9ddc('0x45')](handleError(_0x2a7012,null));};exports['getConfigurations']=function(_0xa8edbd,_0xdf378a,_0x2187de){var _0x1d3354={};var _0x3706dc={};var _0x20e06b;var _0x348c82;return db['FreshsalesAccount'][_0x9ddc('0x4d')]({'where':{'id':_0xa8edbd[_0x9ddc('0x46')]['id']}})[_0x9ddc('0x27')](handleEntityNotFound(_0xdf378a,null))['then'](function(_0x5912c0){if(_0x5912c0){_0x20e06b=_0x5912c0;_0x3706dc[_0x9ddc('0x32')]=_[_0x9ddc('0x47')](db['FreshsalesConfiguration'][_0x9ddc('0x30')]);_0x3706dc[_0x9ddc('0x35')]=_[_0x9ddc('0x47')](_0xa8edbd[_0x9ddc('0x35')]);_0x3706dc['filters']=_[_0x9ddc('0x34')](_0x3706dc[_0x9ddc('0x32')],_0x3706dc[_0x9ddc('0x35')]);_0x1d3354[_0x9ddc('0x36')]=_['intersection'](_0x3706dc[_0x9ddc('0x32')],qs['fields'](_0xa8edbd[_0x9ddc('0x35')]['fields']));_0x1d3354[_0x9ddc('0x36')]=_0x1d3354[_0x9ddc('0x36')][_0x9ddc('0x38')]?_0x1d3354[_0x9ddc('0x36')]:_0x3706dc[_0x9ddc('0x32')];_0x1d3354[_0x9ddc('0x3b')]=qs['sort'](_0xa8edbd['query'][_0x9ddc('0x3c')]);_0x1d3354[_0x9ddc('0x3d')]=qs[_0x9ddc('0x33')](_[_0x9ddc('0x4e')](_0xa8edbd[_0x9ddc('0x35')],_0x3706dc[_0x9ddc('0x33')]));if(_0xa8edbd['query'][_0x9ddc('0x40')]){_0x1d3354[_0x9ddc('0x3d')]=_[_0x9ddc('0x3e')](_0x1d3354['where'],{'$or':_['map'](_0x1d3354[_0x9ddc('0x36')],function(_0x8aba0e){var _0x33ce2d={};_0x33ce2d[_0x8aba0e]={'$like':'%'+_0xa8edbd[_0x9ddc('0x35')]['filter']+'%'};return _0x33ce2d;})});}_0x1d3354=_['merge']({},_0x1d3354,_0xa8edbd['options']);return _0x20e06b[_0x9ddc('0x4f')](_0x1d3354);}})['then'](function(_0x29594d){if(_0x29594d){_0x348c82=_0x29594d[_0x9ddc('0x38')];if(!_0xa8edbd[_0x9ddc('0x35')][_0x9ddc('0x39')](_0x9ddc('0x3a'))){_0x1d3354[_0x9ddc('0x1f')]=qs[_0x9ddc('0x1f')](_0xa8edbd[_0x9ddc('0x35')][_0x9ddc('0x1f')]);_0x1d3354['offset']=qs[_0x9ddc('0x1d')](_0xa8edbd['query'][_0x9ddc('0x1d')]);}return _0x20e06b[_0x9ddc('0x4f')](_0x1d3354);}})[_0x9ddc('0x27')](function(_0x31e52d){if(_0x31e52d){return _0x31e52d?{'count':_0x348c82,'rows':_0x31e52d}:null;}})[_0x9ddc('0x27')](respondWithResult(_0xdf378a,null))[_0x9ddc('0x45')](handleError(_0xdf378a,null));};exports[_0x9ddc('0x50')]=function(_0x40fb80,_0x4e202f,_0x5f2825){if(_0x40fb80[_0x9ddc('0x4b')]['id']){delete _0x40fb80[_0x9ddc('0x4b')]['id'];}return db[_0x9ddc('0x2f')][_0x9ddc('0x4d')]({'where':{'id':_0x40fb80[_0x9ddc('0x46')]['id']}})[_0x9ddc('0x27')](handleEntityNotFound(_0x4e202f,null))[_0x9ddc('0x27')](function(_0x2c1887){if(_0x2c1887){_0x40fb80[_0x9ddc('0x4b')][_0x9ddc('0x51')]=_0x2c1887['id'];_0x40fb80['body'][_0x9ddc('0x52')]=integrations[_0x9ddc('0x53')](_0x40fb80[_0x9ddc('0x4b')][_0x9ddc('0x54')],_0x40fb80[_0x9ddc('0x4b')]['type']);_0x40fb80[_0x9ddc('0x4b')][_0x9ddc('0x55')]=integrations[_0x9ddc('0x56')](_0x40fb80['body']['channel'],_0x40fb80['body']['type']);return db[_0x9ddc('0x57')][_0x9ddc('0x4a')](_0x40fb80[_0x9ddc('0x4b')],{'include':[{'model':db[_0x9ddc('0x58')],'as':_0x9ddc('0x52')},{'model':db[_0x9ddc('0x58')],'as':_0x9ddc('0x55')}]});}return null;})[_0x9ddc('0x27')](respondWithResult(_0x4e202f,null))[_0x9ddc('0x45')](handleError(_0x4e202f,null));};exports[_0x9ddc('0x59')]=function(_0x4a25a2,_0x2b5cba,_0x42f5ee){var _0x4dcfac='';var _0x3b3fb1='';return db[_0x9ddc('0x2f')][_0x9ddc('0x4d')]({'where':{'id':_0x4a25a2[_0x9ddc('0x46')]['id']},'attributes':['id',_0x9ddc('0x5a'),_0x9ddc('0x5b'),_0x9ddc('0x5c')]})[_0x9ddc('0x27')](handleEntityNotFound(_0x2b5cba,null))[_0x9ddc('0x27')](function(_0x2aa6db){if(_0x2aa6db){_0x3b3fb1=_0x2aa6db[_0x9ddc('0x5a')];_0x4dcfac=_0x2aa6db[_0x9ddc('0x5b')];var _0x2310da=_0x2aa6db[_0x9ddc('0x5b')]['slice'](-0x1);if(_0x2310da==='/'){_0x4dcfac=_0x4dcfac['substring'](0x0,_0x4dcfac[_0x9ddc('0x5d')](_0x2310da));}return rp({'method':_0x9ddc('0x5e'),'uri':util[_0x9ddc('0x5f')]('%s%s',_0x4dcfac,_0x9ddc('0x60')),'headers':{'Authorization':_0x9ddc('0x61')+_0x2aa6db[_0x9ddc('0x5c')]},'json':!![]});}})[_0x9ddc('0x27')](function(_0x3735c4){if(_0x3735c4){var _0x331266=_0x3735c4[_0x9ddc('0x62')];var _0x288887=![];var _0x27ce94=null;for(_0x27ce94=0x0;_0x27ce94<_0x331266[_0x9ddc('0x38')];_0x27ce94++){if(_0x331266[_0x27ce94][_0x9ddc('0x63')]===_0x3b3fb1){_0x288887=!![];}}if(_0x288887){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9ddc('0x64')});}}})[_0x9ddc('0x27')](respondWithResult(_0x2b5cba,null))[_0x9ddc('0x45')](function(_0x10f2b9){var _0x54530d=_0x4a25a2[_0x9ddc('0x35')]['test']?0x1f4:_0x10f2b9[_0x9ddc('0x65')]||0x1f4;logger[_0x9ddc('0x29')](_0x9ddc('0x66'),_0x9ddc('0x59'),_0x54530d,JSON[_0x9ddc('0x67')](_0x10f2b9));delete _0x10f2b9[_0x9ddc('0x2b')];if(_0x54530d===0x191){_0x54530d=0x190;}_0x2b5cba[_0x9ddc('0x21')](_0x54530d)['send'](_0x4a25a2['query'][_0x9ddc('0x68')]?{'message':_0x9ddc('0x69'),'statusCode':_0x10f2b9[_0x9ddc('0x65')]}:_0x10f2b9);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 40af8c4..7d5b90d 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 _0xb091=['request-promise','../../config/environment','./intFreshsalesAccount.attributes','exports','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0x5a66ef,_0x32c4ec){var _0x4f2ec7=function(_0x594fa9){while(--_0x594fa9){_0x5a66ef['push'](_0x5a66ef['shift']());}};_0x4f2ec7(++_0x32c4ec);}(_0xb091,0x16e));var _0x1b09=function(_0x2a56d6,_0x2d92b3){_0x2a56d6=_0x2a56d6-0x0;var _0x153223=_0xb091[_0x2a56d6];return _0x153223;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x1b09('0x7')]=function(_0x5fa348,_0x2bf4f6){return _0x5fa348['define'](_0x1b09('0x8'),attributes,{'tableName':_0x1b09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4e99d8,_0x20cf5d){var _0xd6c96d=function(_0x106f47){while(--_0x106f47){_0x4e99d8['push'](_0x4e99d8['shift']());}};_0xd6c96d(++_0x20cf5d);}(_0xafc4,0x69));var _0x4afc=function(_0x81204a,_0x12cacb){_0x81204a=_0x81204a-0x0;var _0x402659=_0xafc4[_0x81204a];return _0x402659;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x4afc('0x6'));module[_0x4afc('0x7')]=function(_0x16953b,_0x1bb281){return _0x16953b[_0x4afc('0x8')](_0x4afc('0x9'),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 21d42fa..82b1884 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 _0xa456=['message','result','GetFreshsalesAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x2297d2,_0x190853){var _0x3b8610=function(_0x47e003){while(--_0x47e003){_0x2297d2['push'](_0x2297d2['shift']());}};_0x3b8610(++_0x190853);}(_0xa456,0x142));var _0x6a45=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xa456[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});}exports[_0x6a45('0x14')]=function(_0x52a055){var _0x379c22=this;return new Promise(function(_0x102981,_0x3439c8){return db['FreshsalesAccount']['findAll']({'raw':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x17')]||null:null,'attributes':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'limit':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')][_0x6a45('0x19')]||null:null,'include':_0x52a055['options']?_0x52a055['options'][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x52a055[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x25a380){return{'model':db[_0x25a380[_0x6a45('0x1c')]],'as':_0x25a380['as'],'attributes':_0x25a380[_0x6a45('0x18')],'include':_0x25a380[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x25a380[_0x6a45('0x1a')],function(_0x1310d7){return{'model':db[_0x1310d7[_0x6a45('0x1c')]],'as':_0x1310d7['as'],'attributes':_0x1310d7['attributes'],'include':_0x1310d7[_0x6a45('0x1a')]?_['map'](_0x1310d7[_0x6a45('0x1a')],function(_0x25467d){return{'model':db[_0x25467d[_0x6a45('0x1c')]],'as':_0x25467d['as'],'attributes':_0x25467d[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x526062){logger[_0x6a45('0xc')](_0x6a45('0x14'),_0x52a055);logger[_0x6a45('0xf')](_0x6a45('0x14'),_0x52a055,JSON[_0x6a45('0x1d')](_0x526062));_0x102981(_0x526062);})[_0x6a45('0x1e')](function(_0x3fac9b){logger[_0x6a45('0x11')]('GetFreshsalesAccount',_0x3fac9b[_0x6a45('0x12')],_0x52a055);_0x3439c8(_0x379c22[_0x6a45('0x11')](0x1f4,_0x3fac9b[_0x6a45('0x12')]));});});};exports[_0x6a45('0x1f')]=function(_0x3b07a1){var _0x5dc288=this;return new Promise(function(_0x1f95d4,_0x1f96bf){return db[_0x6a45('0x20')][_0x6a45('0x21')]({'raw':_0x3b07a1['options']?_0x3b07a1['options'][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x3b07a1['options']?_0x3b07a1[_0x6a45('0x15')]['where']||null:null,'attributes':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'include':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x36f4a4){return{'model':db[_0x36f4a4[_0x6a45('0x1c')]],'as':_0x36f4a4['as'],'attributes':_0x36f4a4[_0x6a45('0x18')],'include':_0x36f4a4[_0x6a45('0x1a')]?_['map'](_0x36f4a4[_0x6a45('0x1a')],function(_0x4ae2ac){return{'model':db[_0x4ae2ac[_0x6a45('0x1c')]],'as':_0x4ae2ac['as'],'attributes':_0x4ae2ac[_0x6a45('0x18')],'include':_0x4ae2ac[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x4ae2ac[_0x6a45('0x1a')],function(_0x2199c1){return{'model':db[_0x2199c1['model']],'as':_0x2199c1['as'],'attributes':_0x2199c1[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x2b75f6){logger[_0x6a45('0xc')](_0x6a45('0x1f'),_0x3b07a1);logger[_0x6a45('0xf')]('ShowFreshsalesAccount',_0x3b07a1,JSON[_0x6a45('0x1d')](_0x2b75f6));_0x1f95d4(_0x2b75f6);})[_0x6a45('0x1e')](function(_0x5c76bd){logger[_0x6a45('0x11')](_0x6a45('0x1f'),_0x5c76bd[_0x6a45('0x12')],_0x3b07a1);_0x1f96bf(_0x5dc288[_0x6a45('0x11')](0x1f4,_0x5c76bd[_0x6a45('0x12')]));});});}; \ No newline at end of file +var _0x25e7=['find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x25e7,0x1d6));var _0x725e=function(_0x3e3f94,_0x27528b){_0x3e3f94=_0x3e3f94-0x0;var _0x5548bb=_0x25e7[_0x3e3f94];return _0x5548bb;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')]({'raw':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x397e33[_0x725e('0x19')]?_0x397e33['options'][_0x725e('0x1b')]||null:null,'attributes':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1c')]||null:null,'limit':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1d')]||null:null,'include':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')]['include']?_[_0x725e('0x1e')](_0x397e33[_0x725e('0x19')][_0x725e('0x1f')],function(_0x3facae){return{'model':db[_0x3facae['model']],'as':_0x3facae['as'],'attributes':_0x3facae[_0x725e('0x1c')],'include':_0x3facae['include']?_['map'](_0x3facae['include'],function(_0x2aad7b){return{'model':db[_0x2aad7b[_0x725e('0x20')]],'as':_0x2aad7b['as'],'attributes':_0x2aad7b[_0x725e('0x1c')],'include':_0x2aad7b['include']?_[_0x725e('0x1e')](_0x2aad7b[_0x725e('0x1f')],function(_0x5a5bef){return{'model':db[_0x5a5bef[_0x725e('0x20')]],'as':_0x5a5bef['as'],'attributes':_0x5a5bef[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x378ace){logger['info']('GetFreshsalesAccount',_0x397e33);logger[_0x725e('0x10')]('GetFreshsalesAccount',_0x397e33,JSON[_0x725e('0x21')](_0x378ace));_0x2811e7(_0x378ace);})['catch'](function(_0x4de2e0){logger[_0x725e('0x12')](_0x725e('0x16'),_0x4de2e0[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438['error'](0x1f4,_0x4de2e0[_0x725e('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x85d29c){var _0x1ce9c8=this;return new Promise(function(_0x39932f,_0x28951f){return db[_0x725e('0x17')][_0x725e('0x22')]({'raw':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['where']||null:null,'attributes':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['attributes']||null:null,'include':_0x85d29c[_0x725e('0x19')]?_0x85d29c['options'][_0x725e('0x1f')]?_['map'](_0x85d29c[_0x725e('0x19')][_0x725e('0x1f')],function(_0x1f2898){return{'model':db[_0x1f2898[_0x725e('0x20')]],'as':_0x1f2898['as'],'attributes':_0x1f2898[_0x725e('0x1c')],'include':_0x1f2898[_0x725e('0x1f')]?_['map'](_0x1f2898['include'],function(_0x35e5e7){return{'model':db[_0x35e5e7[_0x725e('0x20')]],'as':_0x35e5e7['as'],'attributes':_0x35e5e7[_0x725e('0x1c')],'include':_0x35e5e7['include']?_[_0x725e('0x1e')](_0x35e5e7['include'],function(_0x3ce327){return{'model':db[_0x3ce327[_0x725e('0x20')]],'as':_0x3ce327['as'],'attributes':_0x3ce327[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x725e('0xc')](function(_0x4f15f3){logger['info'](_0x725e('0x23'),_0x85d29c);logger[_0x725e('0x10')](_0x725e('0x23'),_0x85d29c,JSON['stringify'](_0x4f15f3));_0x39932f(_0x4f15f3);})[_0x725e('0x15')](function(_0xec3b9d){logger[_0x725e('0x12')]('ShowFreshsalesAccount',_0xec3b9d[_0x725e('0x13')],_0x85d29c);_0x28951f(_0x1ce9c8['error'](0x1f4,_0xec3b9d[_0x725e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 53f2421..71c5ca7 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 _0x8f10=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','delete','destroy','exports','multer','util'];(function(_0x5d92b0,_0xd8c969){var _0x4d2bf5=function(_0x3c710a){while(--_0x3c710a){_0x5d92b0['push'](_0x5d92b0['shift']());}};_0x4d2bf5(++_0xd8c969);}(_0x8f10,0xd6));var _0x08f1=function(_0x1309ba,_0x321982){_0x1309ba=_0x1309ba-0x0;var _0x92d913=_0x8f10[_0x1309ba];return _0x92d913;};'use strict';var multer=require(_0x08f1('0x0'));var util=require(_0x08f1('0x1'));var path=require(_0x08f1('0x2'));var timeout=require('connect-timeout');var express=require(_0x08f1('0x3'));var router=express[_0x08f1('0x4')]();var fs_extra=require(_0x08f1('0x5'));var auth=require(_0x08f1('0x6'));var interaction=require(_0x08f1('0x7'));var config=require(_0x08f1('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x08f1('0x9')]('/',auth[_0x08f1('0xa')](),controller[_0x08f1('0xb')]);router['get'](_0x08f1('0xc'),auth[_0x08f1('0xa')](),controller[_0x08f1('0xd')]);router[_0x08f1('0x9')](_0x08f1('0xe'),auth[_0x08f1('0xa')](),controller['getSubjects']);router[_0x08f1('0x9')](_0x08f1('0xf'),auth[_0x08f1('0xa')](),controller[_0x08f1('0x10')]);router['get'](_0x08f1('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0x08f1('0x12')]('/',auth[_0x08f1('0xa')](),controller[_0x08f1('0x13')]);router[_0x08f1('0x14')](_0x08f1('0xc'),auth[_0x08f1('0xa')](),controller['update']);router[_0x08f1('0x15')]('/:id',auth[_0x08f1('0xa')](),controller[_0x08f1('0x16')]);module[_0x08f1('0x17')]=router; \ No newline at end of file +var _0xddad=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','create','put','update'];(function(_0x10c6db,_0x280f62){var _0x26d9c3=function(_0x146229){while(--_0x146229){_0x10c6db['push'](_0x10c6db['shift']());}};_0x26d9c3(++_0x280f62);}(_0xddad,0x115));var _0xddda=function(_0x25e3d3,_0x1d2882){_0x25e3d3=_0x25e3d3-0x0;var _0x42ad83=_0xddad[_0x25e3d3];return _0x42ad83;};'use strict';var multer=require(_0xddda('0x0'));var util=require(_0xddda('0x1'));var path=require(_0xddda('0x2'));var timeout=require(_0xddda('0x3'));var express=require(_0xddda('0x4'));var router=express[_0xddda('0x5')]();var fs_extra=require(_0xddda('0x6'));var auth=require(_0xddda('0x7'));var interaction=require(_0xddda('0x8'));var config=require('../../config/environment');var controller=require(_0xddda('0x9'));router[_0xddda('0xa')]('/',auth[_0xddda('0xb')](),controller[_0xddda('0xc')]);router[_0xddda('0xa')](_0xddda('0xd'),auth[_0xddda('0xb')](),controller['show']);router[_0xddda('0xa')](_0xddda('0xe'),auth[_0xddda('0xb')](),controller[_0xddda('0xf')]);router[_0xddda('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xddda('0x10')]);router[_0xddda('0xa')](_0xddda('0x11'),auth[_0xddda('0xb')](),controller['getFields']);router[_0xddda('0x12')]('/',auth['isAuthenticated'](),controller[_0xddda('0x13')]);router[_0xddda('0x14')](_0xddda('0xd'),auth[_0xddda('0xb')](),controller[_0xddda('0x15')]);router['delete'](_0xddda('0xd'),auth['isAuthenticated'](),controller[_0xddda('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 61091e5..6bffe3c 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 _0x14da=['STRING','sequelize'];(function(_0x4cf54d,_0x1d544b){var _0x1dd27e=function(_0x3b0ab3){while(--_0x3b0ab3){_0x4cf54d['push'](_0x4cf54d['shift']());}};_0x1dd27e(++_0x1d544b);}(_0x14da,0x165));var _0xa14d=function(_0xfbaa1b,_0x457818){_0xfbaa1b=_0xfbaa1b-0x0;var _0x54d340=_0x14da[_0xfbaa1b];return _0x54d340;};'use strict';var Sequelize=require(_0xa14d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa14d('0x1')]}}; \ No newline at end of file +var _0xa643=['STRING','sequelize'];(function(_0x9d679d,_0x4dd38a){var _0x3ce1dc=function(_0x2cbc68){while(--_0x2cbc68){_0x9d679d['push'](_0x9d679d['shift']());}};_0x3ce1dc(++_0x4dd38a);}(_0xa643,0x18f));var _0x3a64=function(_0x1f5e89,_0x2b23bf){_0x1f5e89=_0x1f5e89-0x0;var _0x50b787=_0xa643[_0x1f5e89];return _0x50b787;};'use strict';var Sequelize=require(_0x3a64('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a64('0x1')]},'description':{'type':Sequelize[_0x3a64('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9a40e83..4e08444 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 _0xdb7f=['key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','params','includeAll','include','merge','find','catch','create','body','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','rimraf','fast-json-patch','request-promise','moment','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xdb7f,0x1b5));var _0xfdb7=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdb7f[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdb7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdb7('0x1'));var rp=require(_0xfdb7('0x2'));var moment=require(_0xfdb7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfdb7('0x4'));var util=require(_0xfdb7('0x5'));var path=require('path');var sox=require(_0xfdb7('0x6'));var csv=require(_0xfdb7('0x7'));var ejs=require(_0xfdb7('0x8'));var fs=require('fs');var fs_extra=require(_0xfdb7('0x9'));var _=require('lodash');var squel=require(_0xfdb7('0xa'));var crypto=require(_0xfdb7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfdb7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfdb7('0xd'));var Papa=require(_0xfdb7('0xe'));var Redis=require(_0xfdb7('0xf'));var authService=require(_0xfdb7('0x10'));var qs=require(_0xfdb7('0x11'));var as=require(_0xfdb7('0x12'));var hardwareService=require(_0xfdb7('0x13'));var logger=require(_0xfdb7('0x14'))(_0xfdb7('0x15'));var utils=require('../../config/utils');var config=require(_0xfdb7('0x16'));var licenseUtil=require(_0xfdb7('0x17'));var db=require(_0xfdb7('0x18'))['db'];function respondWithStatusCode(_0x135204,_0x49790a){_0x49790a=_0x49790a||0xcc;return function(_0x20d528){if(_0x20d528){return _0x135204[_0xfdb7('0x19')](_0x49790a);}return _0x135204[_0xfdb7('0x1a')](_0x49790a)['end']();};}function respondWithResult(_0x191493,_0x4f0e20){_0x4f0e20=_0x4f0e20||0xc8;return function(_0x342eba){if(_0x342eba){return _0x191493[_0xfdb7('0x1a')](_0x4f0e20)[_0xfdb7('0x1b')](_0x342eba);}};}function respondWithFilteredResult(_0x4e360d,_0x3f0e38){return function(_0xd6a022){if(_0xd6a022){var _0x53ebb3=typeof _0x3f0e38['offset']===_0xfdb7('0x1c')&&typeof _0x3f0e38[_0xfdb7('0x1d')]===_0xfdb7('0x1c');var _0x5e3056=_0xd6a022[_0xfdb7('0x1e')];var _0x20f089=_0x53ebb3?0x0:_0x3f0e38[_0xfdb7('0x1f')];var _0x5ee730=_0x53ebb3?_0xd6a022[_0xfdb7('0x1e')]:_0x3f0e38[_0xfdb7('0x1f')]+_0x3f0e38[_0xfdb7('0x1d')];var _0x4218c6;if(_0x5ee730>=_0x5e3056){_0x5ee730=_0x5e3056;_0x4218c6=0xc8;}else{_0x4218c6=0xce;}_0x4e360d[_0xfdb7('0x1a')](_0x4218c6);return _0x4e360d[_0xfdb7('0x20')](_0xfdb7('0x21'),_0x20f089+'-'+_0x5ee730+'/'+_0x5e3056)[_0xfdb7('0x1b')](_0xd6a022);}return null;};}function patchUpdates(_0x5518da){return function(_0x44bddb){try{jsonpatch[_0xfdb7('0x22')](_0x44bddb,_0x5518da,!![]);}catch(_0x3709cd){return BPromise[_0xfdb7('0x23')](_0x3709cd);}return _0x44bddb[_0xfdb7('0x24')]();};}function saveUpdates(_0x24e000,_0x5b94f1){return function(_0x5add0d){if(_0x5add0d){return _0x5add0d[_0xfdb7('0x25')](_0x24e000)['then'](function(_0x42ab67){return _0x42ab67;});}return null;};}function removeEntity(_0x1ba387,_0x1cf20d){return function(_0x17cc81){if(_0x17cc81){return _0x17cc81[_0xfdb7('0x26')]()[_0xfdb7('0x27')](function(){_0x1ba387[_0xfdb7('0x1a')](0xcc)[_0xfdb7('0x28')]();});}};}function handleEntityNotFound(_0x4d0d2c,_0x9c6f44){return function(_0x1b584b){if(!_0x1b584b){_0x4d0d2c[_0xfdb7('0x19')](0x194);}return _0x1b584b;};}function handleError(_0x360d92,_0x1a3f60){_0x1a3f60=_0x1a3f60||0x1f4;return function(_0x349d40){logger[_0xfdb7('0x29')](_0x349d40['stack']);if(_0x349d40['name']){delete _0x349d40[_0xfdb7('0x2a')];}_0x360d92[_0xfdb7('0x1a')](_0x1a3f60)[_0xfdb7('0x2b')](_0x349d40);};}exports[_0xfdb7('0x2c')]=function(_0x30c4f2,_0x2800ea){var _0x29d45c={},_0x405023={},_0x30cd24={'count':0x0,'rows':[]};var _0xb8bdac=_['map'](db[_0xfdb7('0x2d')][_0xfdb7('0x2e')],function(_0x59c443){return{'name':_0x59c443[_0xfdb7('0x2f')],'type':_0x59c443[_0xfdb7('0x30')][_0xfdb7('0x31')]};});_0x405023['model']=_[_0xfdb7('0x32')](_0xb8bdac,_0xfdb7('0x2a'));_0x405023[_0xfdb7('0x33')]=_[_0xfdb7('0x34')](_0x30c4f2[_0xfdb7('0x33')]);_0x405023[_0xfdb7('0x35')]=_[_0xfdb7('0x36')](_0x405023[_0xfdb7('0x37')],_0x405023['query']);_0x29d45c['attributes']=_[_0xfdb7('0x36')](_0x405023['model'],qs[_0xfdb7('0x38')](_0x30c4f2[_0xfdb7('0x33')][_0xfdb7('0x38')]));_0x29d45c[_0xfdb7('0x39')]=_0x29d45c[_0xfdb7('0x39')][_0xfdb7('0x3a')]?_0x29d45c[_0xfdb7('0x39')]:_0x405023[_0xfdb7('0x37')];if(!_0x30c4f2['query'][_0xfdb7('0x3b')](_0xfdb7('0x3c'))){_0x29d45c[_0xfdb7('0x1d')]=qs[_0xfdb7('0x1d')](_0x30c4f2[_0xfdb7('0x33')][_0xfdb7('0x1d')]);_0x29d45c['offset']=qs[_0xfdb7('0x1f')](_0x30c4f2[_0xfdb7('0x33')][_0xfdb7('0x1f')]);}_0x29d45c['order']=qs['sort'](_0x30c4f2[_0xfdb7('0x33')][_0xfdb7('0x3d')]);_0x29d45c[_0xfdb7('0x3e')]=qs[_0xfdb7('0x35')](_[_0xfdb7('0x3f')](_0x30c4f2[_0xfdb7('0x33')],_0x405023['filters']),_0xb8bdac);if(_0x30c4f2[_0xfdb7('0x33')][_0xfdb7('0x40')]){_0x29d45c['where']=_['merge'](_0x29d45c['where'],{'$or':_[_0xfdb7('0x32')](_0xb8bdac,function(_0x68ef31){if(_0x68ef31[_0xfdb7('0x30')]!==_0xfdb7('0x41')){var _0x1f26df={};_0x1f26df[_0x68ef31[_0xfdb7('0x2a')]]={'$like':'%'+_0x30c4f2['query'][_0xfdb7('0x40')]+'%'};return _0x1f26df;}})});}_0x29d45c=_['merge']({},_0x29d45c,_0x30c4f2[_0xfdb7('0x42')]);var _0x28c56e={'where':_0x29d45c[_0xfdb7('0x3e')]};return db[_0xfdb7('0x2d')][_0xfdb7('0x1e')](_0x28c56e)[_0xfdb7('0x27')](function(_0x11575f){_0x30cd24['count']=_0x11575f;if(_0x30c4f2['query']['includeAll']){_0x29d45c['include']=[{'all':!![]}];}return db[_0xfdb7('0x2d')]['findAll'](_0x29d45c);})[_0xfdb7('0x27')](function(_0x3a12cb){_0x30cd24['rows']=_0x3a12cb;return _0x30cd24;})['then'](respondWithFilteredResult(_0x2800ea,_0x29d45c))['catch'](handleError(_0x2800ea,null));};exports['show']=function(_0x1ed946,_0x39bff8){var _0x114f7c={'raw':![],'where':{'id':_0x1ed946[_0xfdb7('0x43')]['id']}},_0x2dd0ff={};_0x2dd0ff['model']=_[_0xfdb7('0x34')](db[_0xfdb7('0x2d')][_0xfdb7('0x2e')]);_0x2dd0ff[_0xfdb7('0x33')]=_[_0xfdb7('0x34')](_0x1ed946['query']);_0x2dd0ff[_0xfdb7('0x35')]=_[_0xfdb7('0x36')](_0x2dd0ff[_0xfdb7('0x37')],_0x2dd0ff[_0xfdb7('0x33')]);_0x114f7c[_0xfdb7('0x39')]=_[_0xfdb7('0x36')](_0x2dd0ff[_0xfdb7('0x37')],qs[_0xfdb7('0x38')](_0x1ed946['query'][_0xfdb7('0x38')]));_0x114f7c['attributes']=_0x114f7c[_0xfdb7('0x39')][_0xfdb7('0x3a')]?_0x114f7c['attributes']:_0x2dd0ff['model'];if(_0x1ed946[_0xfdb7('0x33')][_0xfdb7('0x44')]){_0x114f7c[_0xfdb7('0x45')]=[{'all':!![]}];}_0x114f7c=_[_0xfdb7('0x46')]({},_0x114f7c,_0x1ed946[_0xfdb7('0x42')]);return db[_0xfdb7('0x2d')][_0xfdb7('0x47')](_0x114f7c)[_0xfdb7('0x27')](handleEntityNotFound(_0x39bff8,null))[_0xfdb7('0x27')](respondWithResult(_0x39bff8,null))[_0xfdb7('0x48')](handleError(_0x39bff8,null));};exports['create']=function(_0x1a8789,_0x59f115){return db[_0xfdb7('0x2d')][_0xfdb7('0x49')](_0x1a8789[_0xfdb7('0x4a')],{})[_0xfdb7('0x27')](respondWithResult(_0x59f115,0xc9))[_0xfdb7('0x48')](handleError(_0x59f115,null));};exports[_0xfdb7('0x25')]=function(_0x5230ea,_0x2b8af0){if(_0x5230ea[_0xfdb7('0x4a')]['id']){delete _0x5230ea[_0xfdb7('0x4a')]['id'];}return db[_0xfdb7('0x2d')][_0xfdb7('0x47')]({'where':{'id':_0x5230ea[_0xfdb7('0x43')]['id']}})[_0xfdb7('0x27')](handleEntityNotFound(_0x2b8af0,null))['then'](saveUpdates(_0x5230ea[_0xfdb7('0x4a')],null))[_0xfdb7('0x27')](respondWithResult(_0x2b8af0,null))[_0xfdb7('0x48')](handleError(_0x2b8af0,null));};exports[_0xfdb7('0x26')]=function(_0x2e606d,_0x3eae8d){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2e606d[_0xfdb7('0x43')]['id']}})[_0xfdb7('0x27')](handleEntityNotFound(_0x3eae8d,null))[_0xfdb7('0x27')](removeEntity(_0x3eae8d,null))[_0xfdb7('0x48')](handleError(_0x3eae8d,null));};exports[_0xfdb7('0x4b')]=function(_0x2147a4,_0x1ba4e2,_0x58167b){var _0x33ec3e={};var _0x4a3da8={};var _0x1d1a9e;var _0x559ab0;return db[_0xfdb7('0x2d')][_0xfdb7('0x4c')]({'where':{'id':_0x2147a4[_0xfdb7('0x43')]['id']}})[_0xfdb7('0x27')](handleEntityNotFound(_0x1ba4e2,null))[_0xfdb7('0x27')](function(_0x7ed1c1){if(_0x7ed1c1){_0x1d1a9e=_0x7ed1c1;_0x4a3da8[_0xfdb7('0x37')]=_[_0xfdb7('0x34')](db[_0xfdb7('0x4d')]['rawAttributes']);_0x4a3da8['query']=_[_0xfdb7('0x34')](_0x2147a4['query']);_0x4a3da8[_0xfdb7('0x35')]=_['intersection'](_0x4a3da8[_0xfdb7('0x37')],_0x4a3da8['query']);_0x33ec3e[_0xfdb7('0x39')]=_['intersection'](_0x4a3da8[_0xfdb7('0x37')],qs[_0xfdb7('0x38')](_0x2147a4[_0xfdb7('0x33')][_0xfdb7('0x38')]));_0x33ec3e[_0xfdb7('0x39')]=_0x33ec3e['attributes']['length']?_0x33ec3e[_0xfdb7('0x39')]:_0x4a3da8['model'];_0x33ec3e[_0xfdb7('0x4e')]=qs[_0xfdb7('0x3d')](_0x2147a4['query'][_0xfdb7('0x3d')]);_0x33ec3e[_0xfdb7('0x3e')]=qs[_0xfdb7('0x35')](_[_0xfdb7('0x3f')](_0x2147a4[_0xfdb7('0x33')],_0x4a3da8[_0xfdb7('0x35')]));if(_0x2147a4[_0xfdb7('0x33')]['filter']){_0x33ec3e[_0xfdb7('0x3e')]=_[_0xfdb7('0x46')](_0x33ec3e[_0xfdb7('0x3e')],{'$or':_[_0xfdb7('0x32')](_0x33ec3e[_0xfdb7('0x39')],function(_0x564534){var _0x4b592c={};_0x4b592c[_0x564534]={'$like':'%'+_0x2147a4['query'][_0xfdb7('0x40')]+'%'};return _0x4b592c;})});}_0x33ec3e=_['merge']({},_0x33ec3e,_0x2147a4[_0xfdb7('0x42')]);return _0x1d1a9e['getSubjects'](_0x33ec3e);}})[_0xfdb7('0x27')](function(_0x14797c){if(_0x14797c){_0x559ab0=_0x14797c['length'];if(!_0x2147a4[_0xfdb7('0x33')][_0xfdb7('0x3b')](_0xfdb7('0x3c'))){_0x33ec3e[_0xfdb7('0x1d')]=qs['limit'](_0x2147a4['query'][_0xfdb7('0x1d')]);_0x33ec3e[_0xfdb7('0x1f')]=qs['offset'](_0x2147a4[_0xfdb7('0x33')]['offset']);}return _0x1d1a9e[_0xfdb7('0x4b')](_0x33ec3e);}})[_0xfdb7('0x27')](function(_0x35ce81){if(_0x35ce81){return _0x35ce81?{'count':_0x559ab0,'rows':_0x35ce81}:null;}})[_0xfdb7('0x27')](respondWithResult(_0x1ba4e2,null))[_0xfdb7('0x48')](handleError(_0x1ba4e2,null));};exports[_0xfdb7('0x4f')]=function(_0xed64df,_0xd35bf4,_0x3a1939){var _0x1ba868={};var _0x41663c={};var _0x43b196;var _0x5ab95d;return db[_0xfdb7('0x2d')]['findOne']({'where':{'id':_0xed64df['params']['id']}})[_0xfdb7('0x27')](handleEntityNotFound(_0xd35bf4,null))[_0xfdb7('0x27')](function(_0x18ac70){if(_0x18ac70){_0x43b196=_0x18ac70;_0x41663c[_0xfdb7('0x37')]=_['keys'](db[_0xfdb7('0x4d')][_0xfdb7('0x2e')]);_0x41663c['query']=_[_0xfdb7('0x34')](_0xed64df[_0xfdb7('0x33')]);_0x41663c['filters']=_[_0xfdb7('0x36')](_0x41663c[_0xfdb7('0x37')],_0x41663c['query']);_0x1ba868[_0xfdb7('0x39')]=_['intersection'](_0x41663c[_0xfdb7('0x37')],qs[_0xfdb7('0x38')](_0xed64df[_0xfdb7('0x33')][_0xfdb7('0x38')]));_0x1ba868[_0xfdb7('0x39')]=_0x1ba868[_0xfdb7('0x39')][_0xfdb7('0x3a')]?_0x1ba868[_0xfdb7('0x39')]:_0x41663c['model'];_0x1ba868[_0xfdb7('0x4e')]=qs[_0xfdb7('0x3d')](_0xed64df[_0xfdb7('0x33')][_0xfdb7('0x3d')]);_0x1ba868['where']=qs['filters'](_['pick'](_0xed64df[_0xfdb7('0x33')],_0x41663c[_0xfdb7('0x35')]));if(_0xed64df[_0xfdb7('0x33')][_0xfdb7('0x40')]){_0x1ba868[_0xfdb7('0x3e')]=_[_0xfdb7('0x46')](_0x1ba868[_0xfdb7('0x3e')],{'$or':_[_0xfdb7('0x32')](_0x1ba868[_0xfdb7('0x39')],function(_0x124c9c){var _0x5e8420={};_0x5e8420[_0x124c9c]={'$like':'%'+_0xed64df[_0xfdb7('0x33')][_0xfdb7('0x40')]+'%'};return _0x5e8420;})});}_0x1ba868=_['merge']({},_0x1ba868,_0xed64df[_0xfdb7('0x42')]);return _0x43b196[_0xfdb7('0x4f')](_0x1ba868);}})[_0xfdb7('0x27')](function(_0x2a1dcd){if(_0x2a1dcd){_0x5ab95d=_0x2a1dcd['length'];if(!_0xed64df[_0xfdb7('0x33')][_0xfdb7('0x3b')](_0xfdb7('0x3c'))){_0x1ba868[_0xfdb7('0x1d')]=qs[_0xfdb7('0x1d')](_0xed64df[_0xfdb7('0x33')][_0xfdb7('0x1d')]);_0x1ba868[_0xfdb7('0x1f')]=qs[_0xfdb7('0x1f')](_0xed64df[_0xfdb7('0x33')][_0xfdb7('0x1f')]);}return _0x43b196[_0xfdb7('0x4f')](_0x1ba868);}})[_0xfdb7('0x27')](function(_0x3b84a4){if(_0x3b84a4){return _0x3b84a4?{'count':_0x5ab95d,'rows':_0x3b84a4}:null;}})[_0xfdb7('0x27')](respondWithResult(_0xd35bf4,null))[_0xfdb7('0x48')](handleError(_0xd35bf4,null));};exports[_0xfdb7('0x50')]=function(_0x5bf049,_0x5107f7,_0x1f4dcc){var _0xcad2d={};var _0x520c55={};var _0x11ca6f;var _0x18b3f1;return db['FreshsalesConfiguration'][_0xfdb7('0x4c')]({'where':{'id':_0x5bf049['params']['id']}})[_0xfdb7('0x27')](handleEntityNotFound(_0x5107f7,null))[_0xfdb7('0x27')](function(_0x10034e){if(_0x10034e){_0x11ca6f=_0x10034e;_0x520c55[_0xfdb7('0x37')]=_[_0xfdb7('0x34')](db['FreshsalesField'][_0xfdb7('0x2e')]);_0x520c55[_0xfdb7('0x33')]=_[_0xfdb7('0x34')](_0x5bf049[_0xfdb7('0x33')]);_0x520c55['filters']=_[_0xfdb7('0x36')](_0x520c55[_0xfdb7('0x37')],_0x520c55['query']);_0xcad2d[_0xfdb7('0x39')]=_[_0xfdb7('0x36')](_0x520c55['model'],qs[_0xfdb7('0x38')](_0x5bf049[_0xfdb7('0x33')][_0xfdb7('0x38')]));_0xcad2d[_0xfdb7('0x39')]=_0xcad2d['attributes'][_0xfdb7('0x3a')]?_0xcad2d[_0xfdb7('0x39')]:_0x520c55[_0xfdb7('0x37')];_0xcad2d['order']=qs[_0xfdb7('0x3d')](_0x5bf049[_0xfdb7('0x33')][_0xfdb7('0x3d')]);_0xcad2d[_0xfdb7('0x3e')]=qs[_0xfdb7('0x35')](_[_0xfdb7('0x3f')](_0x5bf049[_0xfdb7('0x33')],_0x520c55[_0xfdb7('0x35')]));if(_0x5bf049[_0xfdb7('0x33')][_0xfdb7('0x40')]){_0xcad2d[_0xfdb7('0x3e')]=_[_0xfdb7('0x46')](_0xcad2d[_0xfdb7('0x3e')],{'$or':_[_0xfdb7('0x32')](_0xcad2d[_0xfdb7('0x39')],function(_0x3ce340){var _0x24c9aa={};_0x24c9aa[_0x3ce340]={'$like':'%'+_0x5bf049[_0xfdb7('0x33')][_0xfdb7('0x40')]+'%'};return _0x24c9aa;})});}_0xcad2d=_['merge']({},_0xcad2d,_0x5bf049[_0xfdb7('0x42')]);return _0x11ca6f[_0xfdb7('0x50')](_0xcad2d);}})['then'](function(_0xffebfe){if(_0xffebfe){_0x18b3f1=_0xffebfe[_0xfdb7('0x3a')];if(!_0x5bf049[_0xfdb7('0x33')][_0xfdb7('0x3b')]('nolimit')){_0xcad2d[_0xfdb7('0x1d')]=qs[_0xfdb7('0x1d')](_0x5bf049[_0xfdb7('0x33')][_0xfdb7('0x1d')]);_0xcad2d[_0xfdb7('0x1f')]=qs[_0xfdb7('0x1f')](_0x5bf049[_0xfdb7('0x33')][_0xfdb7('0x1f')]);}return _0x11ca6f[_0xfdb7('0x50')](_0xcad2d);}})['then'](function(_0x61e335){if(_0x61e335){return _0x61e335?{'count':_0x18b3f1,'rows':_0x61e335}:null;}})[_0xfdb7('0x27')](respondWithResult(_0x5107f7,null))[_0xfdb7('0x48')](handleError(_0x5107f7,null));}; \ No newline at end of file +var _0x75b8=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','stack','name','map','FreshsalesConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','then','findAll','rows','catch','show','params','keys','rawAttributes','fields','includeAll','include','merge','find','create','body','destroy','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x26e892,_0x17b607){var _0x3e62ec=function(_0x2874db){while(--_0x2874db){_0x26e892['push'](_0x26e892['shift']());}};_0x3e62ec(++_0x17b607);}(_0x75b8,0x1e8));var _0x875b=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x75b8[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0x875b('0x0'));var rimraf=require(_0x875b('0x1'));var zipdir=require(_0x875b('0x2'));var jsonpatch=require(_0x875b('0x3'));var rp=require(_0x875b('0x4'));var moment=require(_0x875b('0x5'));var BPromise=require(_0x875b('0x6'));var Mustache=require(_0x875b('0x7'));var util=require(_0x875b('0x8'));var path=require(_0x875b('0x9'));var sox=require(_0x875b('0xa'));var csv=require(_0x875b('0xb'));var ejs=require(_0x875b('0xc'));var fs=require('fs');var fs_extra=require(_0x875b('0xd'));var _=require(_0x875b('0xe'));var squel=require(_0x875b('0xf'));var crypto=require(_0x875b('0x10'));var jsforce=require(_0x875b('0x11'));var deskjs=require(_0x875b('0x12'));var toCsv=require(_0x875b('0xb'));var querystring=require(_0x875b('0x13'));var Papa=require(_0x875b('0x14'));var Redis=require('ioredis');var authService=require(_0x875b('0x15'));var qs=require(_0x875b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x875b('0x17'))(_0x875b('0x18'));var utils=require('../../config/utils');var config=require(_0x875b('0x19'));var licenseUtil=require(_0x875b('0x1a'));var db=require(_0x875b('0x1b'))['db'];function respondWithStatusCode(_0xf0daf6,_0x1a32f6){_0x1a32f6=_0x1a32f6||0xcc;return function(_0x50148d){if(_0x50148d){return _0xf0daf6[_0x875b('0x1c')](_0x1a32f6);}return _0xf0daf6[_0x875b('0x1d')](_0x1a32f6)['end']();};}function respondWithResult(_0x6c339e,_0x1db377){_0x1db377=_0x1db377||0xc8;return function(_0x445832){if(_0x445832){return _0x6c339e[_0x875b('0x1d')](_0x1db377)[_0x875b('0x1e')](_0x445832);}};}function respondWithFilteredResult(_0x48d331,_0x1215c4){return function(_0x5b6baa){if(_0x5b6baa){var _0x387913=typeof _0x1215c4[_0x875b('0x1f')]==='undefined'&&typeof _0x1215c4[_0x875b('0x20')]===_0x875b('0x21');var _0x2c965a=_0x5b6baa[_0x875b('0x22')];var _0x220f7b=_0x387913?0x0:_0x1215c4['offset'];var _0x28cb9e=_0x387913?_0x5b6baa[_0x875b('0x22')]:_0x1215c4[_0x875b('0x1f')]+_0x1215c4[_0x875b('0x20')];var _0x5c26bd;if(_0x28cb9e>=_0x2c965a){_0x28cb9e=_0x2c965a;_0x5c26bd=0xc8;}else{_0x5c26bd=0xce;}_0x48d331['status'](_0x5c26bd);return _0x48d331[_0x875b('0x23')](_0x875b('0x24'),_0x220f7b+'-'+_0x28cb9e+'/'+_0x2c965a)[_0x875b('0x1e')](_0x5b6baa);}return null;};}function patchUpdates(_0x30b181){return function(_0x5d49a4){try{jsonpatch[_0x875b('0x25')](_0x5d49a4,_0x30b181,!![]);}catch(_0x13dc2b){return BPromise[_0x875b('0x26')](_0x13dc2b);}return _0x5d49a4[_0x875b('0x27')]();};}function saveUpdates(_0x117faf,_0x85f667){return function(_0x2bbcd9){if(_0x2bbcd9){return _0x2bbcd9[_0x875b('0x28')](_0x117faf)['then'](function(_0x356dbb){return _0x356dbb;});}return null;};}function removeEntity(_0x416936,_0x425efe){return function(_0x2094b7){if(_0x2094b7){return _0x2094b7['destroy']()['then'](function(){_0x416936[_0x875b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e28b,_0x537f6a){return function(_0x4f720f){if(!_0x4f720f){_0x1e28b[_0x875b('0x1c')](0x194);}return _0x4f720f;};}function handleError(_0x37982d,_0x2f6868){_0x2f6868=_0x2f6868||0x1f4;return function(_0x34975b){logger['error'](_0x34975b[_0x875b('0x29')]);if(_0x34975b[_0x875b('0x2a')]){delete _0x34975b[_0x875b('0x2a')];}_0x37982d[_0x875b('0x1d')](_0x2f6868)['send'](_0x34975b);};}exports['index']=function(_0x59cbd0,_0x226fb9){var _0x36327c={},_0x3e9500={},_0x5c7e91={'count':0x0,'rows':[]};var _0x5aee2d=_[_0x875b('0x2b')](db[_0x875b('0x2c')]['rawAttributes'],function(_0x50844a){return{'name':_0x50844a[_0x875b('0x2d')],'type':_0x50844a[_0x875b('0x2e')][_0x875b('0x2f')]};});_0x3e9500[_0x875b('0x30')]=_['map'](_0x5aee2d,_0x875b('0x2a'));_0x3e9500[_0x875b('0x31')]=_['keys'](_0x59cbd0['query']);_0x3e9500[_0x875b('0x32')]=_[_0x875b('0x33')](_0x3e9500['model'],_0x3e9500[_0x875b('0x31')]);_0x36327c[_0x875b('0x34')]=_[_0x875b('0x33')](_0x3e9500[_0x875b('0x30')],qs['fields'](_0x59cbd0[_0x875b('0x31')]['fields']));_0x36327c['attributes']=_0x36327c[_0x875b('0x34')][_0x875b('0x35')]?_0x36327c[_0x875b('0x34')]:_0x3e9500[_0x875b('0x30')];if(!_0x59cbd0[_0x875b('0x31')][_0x875b('0x36')](_0x875b('0x37'))){_0x36327c[_0x875b('0x20')]=qs[_0x875b('0x20')](_0x59cbd0[_0x875b('0x31')][_0x875b('0x20')]);_0x36327c[_0x875b('0x1f')]=qs['offset'](_0x59cbd0['query']['offset']);}_0x36327c[_0x875b('0x38')]=qs[_0x875b('0x39')](_0x59cbd0[_0x875b('0x31')][_0x875b('0x39')]);_0x36327c[_0x875b('0x3a')]=qs['filters'](_[_0x875b('0x3b')](_0x59cbd0[_0x875b('0x31')],_0x3e9500[_0x875b('0x32')]),_0x5aee2d);if(_0x59cbd0[_0x875b('0x31')]['filter']){_0x36327c[_0x875b('0x3a')]=_['merge'](_0x36327c[_0x875b('0x3a')],{'$or':_['map'](_0x5aee2d,function(_0x1fc727){if(_0x1fc727[_0x875b('0x2e')]!==_0x875b('0x3c')){var _0x29dbca={};_0x29dbca[_0x1fc727[_0x875b('0x2a')]]={'$like':'%'+_0x59cbd0[_0x875b('0x31')][_0x875b('0x3d')]+'%'};return _0x29dbca;}})});}_0x36327c=_['merge']({},_0x36327c,_0x59cbd0[_0x875b('0x3e')]);var _0x204d80={'where':_0x36327c['where']};return db[_0x875b('0x2c')][_0x875b('0x22')](_0x204d80)[_0x875b('0x3f')](function(_0x259293){_0x5c7e91[_0x875b('0x22')]=_0x259293;if(_0x59cbd0[_0x875b('0x31')]['includeAll']){_0x36327c['include']=[{'all':!![]}];}return db[_0x875b('0x2c')][_0x875b('0x40')](_0x36327c);})[_0x875b('0x3f')](function(_0x5709d0){_0x5c7e91[_0x875b('0x41')]=_0x5709d0;return _0x5c7e91;})['then'](respondWithFilteredResult(_0x226fb9,_0x36327c))[_0x875b('0x42')](handleError(_0x226fb9,null));};exports[_0x875b('0x43')]=function(_0x4672b1,_0x5009ff){var _0x4e929d={'raw':![],'where':{'id':_0x4672b1[_0x875b('0x44')]['id']}},_0x2b59a5={};_0x2b59a5[_0x875b('0x30')]=_[_0x875b('0x45')](db[_0x875b('0x2c')][_0x875b('0x46')]);_0x2b59a5['query']=_[_0x875b('0x45')](_0x4672b1[_0x875b('0x31')]);_0x2b59a5[_0x875b('0x32')]=_['intersection'](_0x2b59a5[_0x875b('0x30')],_0x2b59a5[_0x875b('0x31')]);_0x4e929d[_0x875b('0x34')]=_[_0x875b('0x33')](_0x2b59a5['model'],qs[_0x875b('0x47')](_0x4672b1[_0x875b('0x31')][_0x875b('0x47')]));_0x4e929d[_0x875b('0x34')]=_0x4e929d[_0x875b('0x34')][_0x875b('0x35')]?_0x4e929d[_0x875b('0x34')]:_0x2b59a5['model'];if(_0x4672b1[_0x875b('0x31')][_0x875b('0x48')]){_0x4e929d[_0x875b('0x49')]=[{'all':!![]}];}_0x4e929d=_[_0x875b('0x4a')]({},_0x4e929d,_0x4672b1['options']);return db[_0x875b('0x2c')][_0x875b('0x4b')](_0x4e929d)[_0x875b('0x3f')](handleEntityNotFound(_0x5009ff,null))[_0x875b('0x3f')](respondWithResult(_0x5009ff,null))[_0x875b('0x42')](handleError(_0x5009ff,null));};exports[_0x875b('0x4c')]=function(_0x5169ee,_0x33e941){return db[_0x875b('0x2c')][_0x875b('0x4c')](_0x5169ee[_0x875b('0x4d')],{})[_0x875b('0x3f')](respondWithResult(_0x33e941,0xc9))[_0x875b('0x42')](handleError(_0x33e941,null));};exports['update']=function(_0x418338,_0x26852d){if(_0x418338[_0x875b('0x4d')]['id']){delete _0x418338['body']['id'];}return db['FreshsalesConfiguration'][_0x875b('0x4b')]({'where':{'id':_0x418338[_0x875b('0x44')]['id']}})['then'](handleEntityNotFound(_0x26852d,null))[_0x875b('0x3f')](saveUpdates(_0x418338[_0x875b('0x4d')],null))[_0x875b('0x3f')](respondWithResult(_0x26852d,null))[_0x875b('0x42')](handleError(_0x26852d,null));};exports[_0x875b('0x4e')]=function(_0x573f96,_0x39637f){return db[_0x875b('0x2c')][_0x875b('0x4b')]({'where':{'id':_0x573f96[_0x875b('0x44')]['id']}})[_0x875b('0x3f')](handleEntityNotFound(_0x39637f,null))[_0x875b('0x3f')](removeEntity(_0x39637f,null))['catch'](handleError(_0x39637f,null));};exports[_0x875b('0x4f')]=function(_0x5e8fbb,_0x124378,_0x846557){var _0x1d270d={};var _0x51b1ad={};var _0x5da5dd;var _0xab04f9;return db[_0x875b('0x2c')]['findOne']({'where':{'id':_0x5e8fbb['params']['id']}})['then'](handleEntityNotFound(_0x124378,null))[_0x875b('0x3f')](function(_0x296267){if(_0x296267){_0x5da5dd=_0x296267;_0x51b1ad['model']=_['keys'](db['FreshsalesField'][_0x875b('0x46')]);_0x51b1ad['query']=_[_0x875b('0x45')](_0x5e8fbb['query']);_0x51b1ad[_0x875b('0x32')]=_[_0x875b('0x33')](_0x51b1ad['model'],_0x51b1ad['query']);_0x1d270d[_0x875b('0x34')]=_['intersection'](_0x51b1ad[_0x875b('0x30')],qs[_0x875b('0x47')](_0x5e8fbb[_0x875b('0x31')]['fields']));_0x1d270d['attributes']=_0x1d270d['attributes'][_0x875b('0x35')]?_0x1d270d[_0x875b('0x34')]:_0x51b1ad[_0x875b('0x30')];_0x1d270d[_0x875b('0x38')]=qs['sort'](_0x5e8fbb[_0x875b('0x31')][_0x875b('0x39')]);_0x1d270d[_0x875b('0x3a')]=qs['filters'](_['pick'](_0x5e8fbb[_0x875b('0x31')],_0x51b1ad[_0x875b('0x32')]));if(_0x5e8fbb['query']['filter']){_0x1d270d[_0x875b('0x3a')]=_[_0x875b('0x4a')](_0x1d270d[_0x875b('0x3a')],{'$or':_[_0x875b('0x2b')](_0x1d270d['attributes'],function(_0x501215){var _0x18d916={};_0x18d916[_0x501215]={'$like':'%'+_0x5e8fbb['query'][_0x875b('0x3d')]+'%'};return _0x18d916;})});}_0x1d270d=_['merge']({},_0x1d270d,_0x5e8fbb[_0x875b('0x3e')]);return _0x5da5dd[_0x875b('0x4f')](_0x1d270d);}})[_0x875b('0x3f')](function(_0xc223aa){if(_0xc223aa){_0xab04f9=_0xc223aa[_0x875b('0x35')];if(!_0x5e8fbb[_0x875b('0x31')][_0x875b('0x36')](_0x875b('0x37'))){_0x1d270d['limit']=qs[_0x875b('0x20')](_0x5e8fbb[_0x875b('0x31')][_0x875b('0x20')]);_0x1d270d['offset']=qs[_0x875b('0x1f')](_0x5e8fbb[_0x875b('0x31')][_0x875b('0x1f')]);}return _0x5da5dd[_0x875b('0x4f')](_0x1d270d);}})['then'](function(_0x2e3647){if(_0x2e3647){return _0x2e3647?{'count':_0xab04f9,'rows':_0x2e3647}:null;}})[_0x875b('0x3f')](respondWithResult(_0x124378,null))[_0x875b('0x42')](handleError(_0x124378,null));};exports[_0x875b('0x50')]=function(_0x3974bd,_0xde129,_0x566c76){var _0x550979={};var _0x3401ce={};var _0x451cfc;var _0x4b0565;return db[_0x875b('0x2c')][_0x875b('0x51')]({'where':{'id':_0x3974bd[_0x875b('0x44')]['id']}})[_0x875b('0x3f')](handleEntityNotFound(_0xde129,null))[_0x875b('0x3f')](function(_0x3bda3f){if(_0x3bda3f){_0x451cfc=_0x3bda3f;_0x3401ce[_0x875b('0x30')]=_['keys'](db[_0x875b('0x52')][_0x875b('0x46')]);_0x3401ce[_0x875b('0x31')]=_['keys'](_0x3974bd[_0x875b('0x31')]);_0x3401ce[_0x875b('0x32')]=_[_0x875b('0x33')](_0x3401ce['model'],_0x3401ce['query']);_0x550979[_0x875b('0x34')]=_[_0x875b('0x33')](_0x3401ce[_0x875b('0x30')],qs[_0x875b('0x47')](_0x3974bd['query']['fields']));_0x550979[_0x875b('0x34')]=_0x550979[_0x875b('0x34')][_0x875b('0x35')]?_0x550979[_0x875b('0x34')]:_0x3401ce[_0x875b('0x30')];_0x550979[_0x875b('0x38')]=qs[_0x875b('0x39')](_0x3974bd[_0x875b('0x31')]['sort']);_0x550979[_0x875b('0x3a')]=qs['filters'](_[_0x875b('0x3b')](_0x3974bd[_0x875b('0x31')],_0x3401ce['filters']));if(_0x3974bd[_0x875b('0x31')][_0x875b('0x3d')]){_0x550979[_0x875b('0x3a')]=_[_0x875b('0x4a')](_0x550979[_0x875b('0x3a')],{'$or':_[_0x875b('0x2b')](_0x550979[_0x875b('0x34')],function(_0x1ae96c){var _0x11eb83={};_0x11eb83[_0x1ae96c]={'$like':'%'+_0x3974bd[_0x875b('0x31')][_0x875b('0x3d')]+'%'};return _0x11eb83;})});}_0x550979=_[_0x875b('0x4a')]({},_0x550979,_0x3974bd[_0x875b('0x3e')]);return _0x451cfc['getDescriptions'](_0x550979);}})[_0x875b('0x3f')](function(_0x3fa29f){if(_0x3fa29f){_0x4b0565=_0x3fa29f[_0x875b('0x35')];if(!_0x3974bd[_0x875b('0x31')][_0x875b('0x36')](_0x875b('0x37'))){_0x550979[_0x875b('0x20')]=qs[_0x875b('0x20')](_0x3974bd[_0x875b('0x31')]['limit']);_0x550979[_0x875b('0x1f')]=qs[_0x875b('0x1f')](_0x3974bd[_0x875b('0x31')][_0x875b('0x1f')]);}return _0x451cfc[_0x875b('0x50')](_0x550979);}})[_0x875b('0x3f')](function(_0x479e17){if(_0x479e17){return _0x479e17?{'count':_0x4b0565,'rows':_0x479e17}:null;}})['then'](respondWithResult(_0xde129,null))[_0x875b('0x42')](handleError(_0xde129,null));};exports[_0x875b('0x53')]=function(_0x3566a4,_0x885126,_0x345cd8){var _0x2d60ac={};var _0x4d667e={};var _0x1eef3d;var _0xbf149e;return db[_0x875b('0x2c')]['findOne']({'where':{'id':_0x3566a4[_0x875b('0x44')]['id']}})['then'](handleEntityNotFound(_0x885126,null))['then'](function(_0x141c91){if(_0x141c91){_0x1eef3d=_0x141c91;_0x4d667e[_0x875b('0x30')]=_['keys'](db[_0x875b('0x52')][_0x875b('0x46')]);_0x4d667e[_0x875b('0x31')]=_[_0x875b('0x45')](_0x3566a4['query']);_0x4d667e[_0x875b('0x32')]=_[_0x875b('0x33')](_0x4d667e[_0x875b('0x30')],_0x4d667e[_0x875b('0x31')]);_0x2d60ac[_0x875b('0x34')]=_['intersection'](_0x4d667e['model'],qs[_0x875b('0x47')](_0x3566a4['query']['fields']));_0x2d60ac[_0x875b('0x34')]=_0x2d60ac['attributes'][_0x875b('0x35')]?_0x2d60ac[_0x875b('0x34')]:_0x4d667e[_0x875b('0x30')];_0x2d60ac[_0x875b('0x38')]=qs['sort'](_0x3566a4[_0x875b('0x31')][_0x875b('0x39')]);_0x2d60ac[_0x875b('0x3a')]=qs[_0x875b('0x32')](_[_0x875b('0x3b')](_0x3566a4[_0x875b('0x31')],_0x4d667e[_0x875b('0x32')]));if(_0x3566a4[_0x875b('0x31')][_0x875b('0x3d')]){_0x2d60ac[_0x875b('0x3a')]=_[_0x875b('0x4a')](_0x2d60ac[_0x875b('0x3a')],{'$or':_[_0x875b('0x2b')](_0x2d60ac[_0x875b('0x34')],function(_0x17835b){var _0x1f5c9e={};_0x1f5c9e[_0x17835b]={'$like':'%'+_0x3566a4[_0x875b('0x31')][_0x875b('0x3d')]+'%'};return _0x1f5c9e;})});}_0x2d60ac=_['merge']({},_0x2d60ac,_0x3566a4[_0x875b('0x3e')]);return _0x1eef3d[_0x875b('0x53')](_0x2d60ac);}})[_0x875b('0x3f')](function(_0x2620e7){if(_0x2620e7){_0xbf149e=_0x2620e7[_0x875b('0x35')];if(!_0x3566a4[_0x875b('0x31')][_0x875b('0x36')](_0x875b('0x37'))){_0x2d60ac[_0x875b('0x20')]=qs[_0x875b('0x20')](_0x3566a4[_0x875b('0x31')][_0x875b('0x20')]);_0x2d60ac[_0x875b('0x1f')]=qs[_0x875b('0x1f')](_0x3566a4[_0x875b('0x31')][_0x875b('0x1f')]);}return _0x1eef3d[_0x875b('0x53')](_0x2d60ac);}})[_0x875b('0x3f')](function(_0x29d97e){if(_0x29d97e){return _0x29d97e?{'count':_0xbf149e,'rows':_0x29d97e}:null;}})[_0x875b('0x3f')](respondWithResult(_0x885126,null))[_0x875b('0x42')](handleError(_0x885126,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 93c6460..dc5097e 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 _0x83eb=['path','rimraf','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5c9a79,_0x1b0630){var _0x3c6686=function(_0x59754c){while(--_0x59754c){_0x5c9a79['push'](_0x5c9a79['shift']());}};_0x3c6686(++_0x1b0630);}(_0x83eb,0x1f2));var _0xb83e=function(_0x2ffbc0,_0x207fa1){_0x2ffbc0=_0x2ffbc0-0x0;var _0x1acdbc=_0x83eb[_0x2ffbc0];return _0x1acdbc;};'use strict';var _=require(_0xb83e('0x0'));var util=require(_0xb83e('0x1'));var logger=require('../../config/logger')(_0xb83e('0x2'));var moment=require(_0xb83e('0x3'));var BPromise=require(_0xb83e('0x4'));var rp=require(_0xb83e('0x5'));var fs=require('fs');var path=require(_0xb83e('0x6'));var rimraf=require(_0xb83e('0x7'));var config=require('../../config/environment');var attributes=require(_0xb83e('0x8'));module[_0xb83e('0x9')]=function(_0x4e632f,_0x2e0f94){return _0x4e632f['define'](_0xb83e('0xa'),attributes,{'tableName':_0xb83e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc73e=['bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api'];(function(_0x165925,_0x3735ee){var _0x364297=function(_0x16ff03){while(--_0x16ff03){_0x165925['push'](_0x165925['shift']());}};_0x364297(++_0x3735ee);}(_0xc73e,0x141));var _0xec73=function(_0x1f6371,_0x4bee2e){_0x1f6371=_0x1f6371-0x0;var _0x3c013f=_0xc73e[_0x1f6371];return _0x3c013f;};'use strict';var _=require('lodash');var util=require(_0xec73('0x0'));var logger=require(_0xec73('0x1'))(_0xec73('0x2'));var moment=require('moment');var BPromise=require(_0xec73('0x3'));var rp=require(_0xec73('0x4'));var fs=require('fs');var path=require(_0xec73('0x5'));var rimraf=require(_0xec73('0x6'));var config=require('../../config/environment');var attributes=require(_0xec73('0x7'));module[_0xec73('0x8')]=function(_0x29e76e,_0x19b435){return _0x29e76e[_0xec73('0x9')](_0xec73('0xa'),attributes,{'tableName':_0xec73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index b529eb9..5e841f2 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 _0xacbc=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x17017e,_0x509679){var _0xbc7086=function(_0x30679d){while(--_0x30679d){_0x17017e['push'](_0x17017e['shift']());}};_0xbc7086(++_0x509679);}(_0xacbc,0x183));var _0xcacb=function(_0x193857,_0x476b7d){_0x193857=_0x193857-0x0;var _0x2dbf2a=_0xacbc[_0x193857];return _0x2dbf2a;};'use strict';var _=require(_0xcacb('0x0'));var util=require(_0xcacb('0x1'));var moment=require(_0xcacb('0x2'));var BPromise=require(_0xcacb('0x3'));var rs=require(_0xcacb('0x4'));var fs=require('fs');var Redis=require(_0xcacb('0x5'));var db=require(_0xcacb('0x6'))['db'];var utils=require(_0xcacb('0x7'));var logger=require('../../config/logger')(_0xcacb('0x8'));var config=require('../../config/environment');var jayson=require(_0xcacb('0x9'));var client=jayson[_0xcacb('0xa')][_0xcacb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x353d66,_0x20cfb4,_0xf052a8){return new BPromise(function(_0x51a779,_0x166274){return client[_0xcacb('0xc')](_0x353d66,_0xf052a8)[_0xcacb('0xd')](function(_0x259c47){logger[_0xcacb('0xe')](_0xcacb('0xf'),_0x20cfb4,_0xcacb('0x10'));logger[_0xcacb('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x20cfb4,_0xcacb('0x10'),JSON[_0xcacb('0x12')](_0x259c47));if(_0x259c47[_0xcacb('0x13')]){if(_0x259c47[_0xcacb('0x13')][_0xcacb('0x14')]===0x1f4){logger[_0xcacb('0x13')](_0xcacb('0xf'),_0x20cfb4,_0x259c47[_0xcacb('0x13')][_0xcacb('0x15')]);return _0x166274(_0x259c47['error'][_0xcacb('0x15')]);}logger[_0xcacb('0x13')](_0xcacb('0xf'),_0x20cfb4,_0x259c47[_0xcacb('0x13')][_0xcacb('0x15')]);return _0x51a779(_0x259c47[_0xcacb('0x13')]['message']);}else{logger[_0xcacb('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x20cfb4,_0xcacb('0x10'));_0x51a779(_0x259c47[_0xcacb('0x16')][_0xcacb('0x15')]);}})['catch'](function(_0xf0392c){logger[_0xcacb('0x13')](_0xcacb('0xf'),_0x20cfb4,_0xf0392c);_0x166274(_0xf0392c);});});} \ No newline at end of file +var _0xd939=['http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x486efc,_0x1cca6a){var _0x42ae7e=function(_0x48f4c0){while(--_0x48f4c0){_0x486efc['push'](_0x486efc['shift']());}};_0x42ae7e(++_0x1cca6a);}(_0xd939,0x13a));var _0x9d93=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0xd939[_0x22f85a];return _0xaa717;};'use strict';var _=require(_0x9d93('0x0'));var util=require('util');var moment=require(_0x9d93('0x1'));var BPromise=require(_0x9d93('0x2'));var rs=require(_0x9d93('0x3'));var fs=require('fs');var Redis=require(_0x9d93('0x4'));var db=require(_0x9d93('0x5'))['db'];var utils=require(_0x9d93('0x6'));var logger=require(_0x9d93('0x7'))(_0x9d93('0x8'));var config=require(_0x9d93('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9d93('0xa')][_0x9d93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfed32b,_0x24c4bf,_0x8517cc){return new BPromise(function(_0x3e305e,_0x4d3e11){return client[_0x9d93('0xc')](_0xfed32b,_0x8517cc)[_0x9d93('0xd')](function(_0x2112d5){logger[_0x9d93('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x24c4bf,_0x9d93('0xf'));logger[_0x9d93('0x10')](_0x9d93('0x11'),_0x24c4bf,'request\x20sent',JSON[_0x9d93('0x12')](_0x2112d5));if(_0x2112d5[_0x9d93('0x13')]){if(_0x2112d5[_0x9d93('0x13')][_0x9d93('0x14')]===0x1f4){logger[_0x9d93('0x13')](_0x9d93('0x15'),_0x24c4bf,_0x2112d5[_0x9d93('0x13')][_0x9d93('0x16')]);return _0x4d3e11(_0x2112d5[_0x9d93('0x13')][_0x9d93('0x16')]);}logger[_0x9d93('0x13')](_0x9d93('0x15'),_0x24c4bf,_0x2112d5[_0x9d93('0x13')][_0x9d93('0x16')]);return _0x3e305e(_0x2112d5[_0x9d93('0x13')][_0x9d93('0x16')]);}else{logger[_0x9d93('0xe')](_0x9d93('0x15'),_0x24c4bf,_0x9d93('0xf'));_0x3e305e(_0x2112d5[_0x9d93('0x17')]['message']);}})[_0x9d93('0x18')](function(_0x4857c8){logger[_0x9d93('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x24c4bf,_0x4857c8);_0x4d3e11(_0x4857c8);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 1a5c7fe..cb608da 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 _0x12cc=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/:id','post','isAuthenticated','create','update'];(function(_0x24619a,_0xad4697){var _0x7a91a9=function(_0x480aa2){while(--_0x480aa2){_0x24619a['push'](_0x24619a['shift']());}};_0x7a91a9(++_0xad4697);}(_0x12cc,0xc2));var _0xc12c=function(_0x3b2aaf,_0x4422d2){_0x3b2aaf=_0x3b2aaf-0x0;var _0x35ed3f=_0x12cc[_0x3b2aaf];return _0x35ed3f;};'use strict';var multer=require('multer');var util=require(_0xc12c('0x0'));var path=require(_0xc12c('0x1'));var timeout=require(_0xc12c('0x2'));var express=require(_0xc12c('0x3'));var router=express[_0xc12c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc12c('0x5'));var config=require(_0xc12c('0x6'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc12c('0x7')]);router[_0xc12c('0x8')](_0xc12c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc12c('0xa')]('/',auth[_0xc12c('0xb')](),controller[_0xc12c('0xc')]);router['put'](_0xc12c('0x9'),auth[_0xc12c('0xb')](),controller[_0xc12c('0xd')]);router['delete'](_0xc12c('0x9'),auth[_0xc12c('0xb')](),controller[_0xc12c('0xe')]);module[_0xc12c('0xf')]=router; \ No newline at end of file +var _0x96a2=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x1843b3,_0x10995a){var _0x3c7de0=function(_0xe28643){while(--_0xe28643){_0x1843b3['push'](_0x1843b3['shift']());}};_0x3c7de0(++_0x10995a);}(_0x96a2,0x96));var _0x296a=function(_0x56c4a6,_0xfdcd91){_0x56c4a6=_0x56c4a6-0x0;var _0x217669=_0x96a2[_0x56c4a6];return _0x217669;};'use strict';var multer=require(_0x296a('0x0'));var util=require('util');var path=require(_0x296a('0x1'));var timeout=require(_0x296a('0x2'));var express=require(_0x296a('0x3'));var router=express[_0x296a('0x4')]();var fs_extra=require(_0x296a('0x5'));var auth=require(_0x296a('0x6'));var interaction=require(_0x296a('0x7'));var config=require(_0x296a('0x8'));var controller=require(_0x296a('0x9'));router[_0x296a('0xa')]('/',auth[_0x296a('0xb')](),controller[_0x296a('0xc')]);router[_0x296a('0xa')](_0x296a('0xd'),auth[_0x296a('0xb')](),controller[_0x296a('0xe')]);router[_0x296a('0xf')]('/',auth[_0x296a('0xb')](),controller['create']);router[_0x296a('0x10')](_0x296a('0xd'),auth['isAuthenticated'](),controller[_0x296a('0x11')]);router[_0x296a('0x12')](_0x296a('0xd'),auth[_0x296a('0xb')](),controller[_0x296a('0x13')]);module[_0x296a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index fa040e6..02166c4 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 _0x7d90=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','customVariable'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7d90,0x188));var _0x07d9=function(_0x3aeaa1,_0x4ac3ab){_0x3aeaa1=_0x3aeaa1-0x0;var _0x400016=_0x7d90[_0x3aeaa1];return _0x400016;};'use strict';var Sequelize=require(_0x07d9('0x0'));module[_0x07d9('0x1')]={'type':{'type':Sequelize[_0x07d9('0x2')](_0x07d9('0x3'),_0x07d9('0x4'),'customVariable',_0x07d9('0x5'),_0x07d9('0x6')),'defaultValue':_0x07d9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x07d9('0x3'),'variable',_0x07d9('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x07d9('0x8')]},'nameField':{'type':Sequelize[_0x07d9('0x8')]},'customField':{'type':Sequelize[_0x07d9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07d9('0x8')]}}; \ No newline at end of file +var _0xbdf6=['keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x457bf8,_0x209a0a){var _0x919f94=function(_0x4fc50c){while(--_0x4fc50c){_0x457bf8['push'](_0x457bf8['shift']());}};_0x919f94(++_0x209a0a);}(_0xbdf6,0x1dc));var _0x6bdf=function(_0x2571ac,_0x4f40d0){_0x2571ac=_0x2571ac-0x0;var _0x4587b1=_0xbdf6[_0x2571ac];return _0x4587b1;};'use strict';var Sequelize=require(_0x6bdf('0x0'));module[_0x6bdf('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6bdf('0x2'),_0x6bdf('0x3'),'customVariable',_0x6bdf('0x4'),_0x6bdf('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6bdf('0x6')]},'key':{'type':Sequelize[_0x6bdf('0x6')]},'keyType':{'type':Sequelize[_0x6bdf('0x7')]('string',_0x6bdf('0x3'),_0x6bdf('0x8'))},'keyContent':{'type':Sequelize[_0x6bdf('0x6')]},'idField':{'type':Sequelize[_0x6bdf('0x6')]},'nameField':{'type':Sequelize[_0x6bdf('0x6')]},'customField':{'type':Sequelize[_0x6bdf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 3ca93d2..ce6685d 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 _0x1ad0=['fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','merge','VIRTUAL','filter','includeAll','include','FreshsalesField','findAll','rows','show','params','keys','rawAttributes','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x1ad0,0x68));var _0x01ad=function(_0x492f45,_0x4bbf55){_0x492f45=_0x492f45-0x0;var _0x297b67=_0x1ad0[_0x492f45];return _0x297b67;};'use strict';var emlformat=require(_0x01ad('0x0'));var rimraf=require(_0x01ad('0x1'));var zipdir=require(_0x01ad('0x2'));var jsonpatch=require(_0x01ad('0x3'));var rp=require(_0x01ad('0x4'));var moment=require(_0x01ad('0x5'));var BPromise=require(_0x01ad('0x6'));var Mustache=require('mustache');var util=require(_0x01ad('0x7'));var path=require('path');var sox=require(_0x01ad('0x8'));var csv=require(_0x01ad('0x9'));var ejs=require(_0x01ad('0xa'));var fs=require('fs');var fs_extra=require(_0x01ad('0xb'));var _=require(_0x01ad('0xc'));var squel=require(_0x01ad('0xd'));var crypto=require(_0x01ad('0xe'));var jsforce=require(_0x01ad('0xf'));var deskjs=require(_0x01ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x01ad('0x11'));var Papa=require(_0x01ad('0x12'));var Redis=require(_0x01ad('0x13'));var authService=require(_0x01ad('0x14'));var qs=require(_0x01ad('0x15'));var as=require(_0x01ad('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x01ad('0x17'));var utils=require(_0x01ad('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x01ad('0x19'));var db=require(_0x01ad('0x1a'))['db'];function respondWithStatusCode(_0x1081c3,_0x2e53d2){_0x2e53d2=_0x2e53d2||0xcc;return function(_0x51a05c){if(_0x51a05c){return _0x1081c3[_0x01ad('0x1b')](_0x2e53d2);}return _0x1081c3[_0x01ad('0x1c')](_0x2e53d2)[_0x01ad('0x1d')]();};}function respondWithResult(_0x1b0486,_0x28949a){_0x28949a=_0x28949a||0xc8;return function(_0x5031e9){if(_0x5031e9){return _0x1b0486['status'](_0x28949a)['json'](_0x5031e9);}};}function respondWithFilteredResult(_0x48275b,_0x46ab2c){return function(_0x3b56b2){if(_0x3b56b2){var _0x517af0=typeof _0x46ab2c[_0x01ad('0x1e')]===_0x01ad('0x1f')&&typeof _0x46ab2c[_0x01ad('0x20')]===_0x01ad('0x1f');var _0x4727e9=_0x3b56b2[_0x01ad('0x21')];var _0x52ac65=_0x517af0?0x0:_0x46ab2c[_0x01ad('0x1e')];var _0x1a4e5b=_0x517af0?_0x3b56b2['count']:_0x46ab2c[_0x01ad('0x1e')]+_0x46ab2c[_0x01ad('0x20')];var _0x596d7f;if(_0x1a4e5b>=_0x4727e9){_0x1a4e5b=_0x4727e9;_0x596d7f=0xc8;}else{_0x596d7f=0xce;}_0x48275b[_0x01ad('0x1c')](_0x596d7f);return _0x48275b[_0x01ad('0x22')](_0x01ad('0x23'),_0x52ac65+'-'+_0x1a4e5b+'/'+_0x4727e9)[_0x01ad('0x24')](_0x3b56b2);}return null;};}function patchUpdates(_0x475dc6){return function(_0x4d3eea){try{jsonpatch['apply'](_0x4d3eea,_0x475dc6,!![]);}catch(_0x509825){return BPromise[_0x01ad('0x25')](_0x509825);}return _0x4d3eea[_0x01ad('0x26')]();};}function saveUpdates(_0x16cb4e,_0x23e7b4){return function(_0x352460){if(_0x352460){return _0x352460[_0x01ad('0x27')](_0x16cb4e)[_0x01ad('0x28')](function(_0x1e1638){return _0x1e1638;});}return null;};}function removeEntity(_0x366177,_0x47377e){return function(_0x2ab7ee){if(_0x2ab7ee){return _0x2ab7ee[_0x01ad('0x29')]()['then'](function(){_0x366177[_0x01ad('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xea873b,_0x1261ca){return function(_0x363d55){if(!_0x363d55){_0xea873b[_0x01ad('0x1b')](0x194);}return _0x363d55;};}function handleError(_0x22860a,_0x309e05){_0x309e05=_0x309e05||0x1f4;return function(_0x40b4f3){logger[_0x01ad('0x2a')](_0x40b4f3['stack']);if(_0x40b4f3[_0x01ad('0x2b')]){delete _0x40b4f3[_0x01ad('0x2b')];}_0x22860a[_0x01ad('0x1c')](_0x309e05)[_0x01ad('0x2c')](_0x40b4f3);};}exports['index']=function(_0x305290,_0x17f483){var _0x196553={},_0x65093c={},_0x4321bf={'count':0x0,'rows':[]};var _0x1597ae=_[_0x01ad('0x2d')](db['FreshsalesField']['rawAttributes'],function(_0x52b245){return{'name':_0x52b245[_0x01ad('0x2e')],'type':_0x52b245[_0x01ad('0x2f')][_0x01ad('0x30')]};});_0x65093c['model']=_[_0x01ad('0x2d')](_0x1597ae,_0x01ad('0x2b'));_0x65093c['query']=_['keys'](_0x305290[_0x01ad('0x31')]);_0x65093c[_0x01ad('0x32')]=_[_0x01ad('0x33')](_0x65093c[_0x01ad('0x34')],_0x65093c[_0x01ad('0x31')]);_0x196553[_0x01ad('0x35')]=_[_0x01ad('0x33')](_0x65093c[_0x01ad('0x34')],qs[_0x01ad('0x36')](_0x305290[_0x01ad('0x31')][_0x01ad('0x36')]));_0x196553['attributes']=_0x196553[_0x01ad('0x35')]['length']?_0x196553[_0x01ad('0x35')]:_0x65093c[_0x01ad('0x34')];if(!_0x305290[_0x01ad('0x31')][_0x01ad('0x37')]('nolimit')){_0x196553[_0x01ad('0x20')]=qs[_0x01ad('0x20')](_0x305290[_0x01ad('0x31')][_0x01ad('0x20')]);_0x196553['offset']=qs[_0x01ad('0x1e')](_0x305290[_0x01ad('0x31')][_0x01ad('0x1e')]);}_0x196553['order']=qs[_0x01ad('0x38')](_0x305290[_0x01ad('0x31')][_0x01ad('0x38')]);_0x196553[_0x01ad('0x39')]=qs[_0x01ad('0x32')](_['pick'](_0x305290[_0x01ad('0x31')],_0x65093c[_0x01ad('0x32')]),_0x1597ae);if(_0x305290['query']['filter']){_0x196553[_0x01ad('0x39')]=_[_0x01ad('0x3a')](_0x196553[_0x01ad('0x39')],{'$or':_[_0x01ad('0x2d')](_0x1597ae,function(_0x29883c){if(_0x29883c[_0x01ad('0x2f')]!==_0x01ad('0x3b')){var _0x115488={};_0x115488[_0x29883c[_0x01ad('0x2b')]]={'$like':'%'+_0x305290['query'][_0x01ad('0x3c')]+'%'};return _0x115488;}})});}_0x196553=_[_0x01ad('0x3a')]({},_0x196553,_0x305290['options']);var _0x26c80d={'where':_0x196553[_0x01ad('0x39')]};return db['FreshsalesField']['count'](_0x26c80d)[_0x01ad('0x28')](function(_0x40fd97){_0x4321bf['count']=_0x40fd97;if(_0x305290[_0x01ad('0x31')][_0x01ad('0x3d')]){_0x196553[_0x01ad('0x3e')]=[{'all':!![]}];}return db[_0x01ad('0x3f')][_0x01ad('0x40')](_0x196553);})[_0x01ad('0x28')](function(_0x1e828d){_0x4321bf[_0x01ad('0x41')]=_0x1e828d;return _0x4321bf;})[_0x01ad('0x28')](respondWithFilteredResult(_0x17f483,_0x196553))['catch'](handleError(_0x17f483,null));};exports[_0x01ad('0x42')]=function(_0x1e4d37,_0x3df2dc){var _0x19ee2b={'raw':!![],'where':{'id':_0x1e4d37[_0x01ad('0x43')]['id']}},_0x11d41d={};_0x11d41d['model']=_[_0x01ad('0x44')](db['FreshsalesField'][_0x01ad('0x45')]);_0x11d41d['query']=_[_0x01ad('0x44')](_0x1e4d37[_0x01ad('0x31')]);_0x11d41d[_0x01ad('0x32')]=_[_0x01ad('0x33')](_0x11d41d[_0x01ad('0x34')],_0x11d41d[_0x01ad('0x31')]);_0x19ee2b[_0x01ad('0x35')]=_[_0x01ad('0x33')](_0x11d41d[_0x01ad('0x34')],qs[_0x01ad('0x36')](_0x1e4d37[_0x01ad('0x31')]['fields']));_0x19ee2b[_0x01ad('0x35')]=_0x19ee2b['attributes'][_0x01ad('0x46')]?_0x19ee2b[_0x01ad('0x35')]:_0x11d41d[_0x01ad('0x34')];if(_0x1e4d37['query'][_0x01ad('0x3d')]){_0x19ee2b[_0x01ad('0x3e')]=[{'all':!![]}];}_0x19ee2b=_[_0x01ad('0x3a')]({},_0x19ee2b,_0x1e4d37['options']);return db[_0x01ad('0x3f')][_0x01ad('0x47')](_0x19ee2b)[_0x01ad('0x28')](handleEntityNotFound(_0x3df2dc,null))[_0x01ad('0x28')](respondWithResult(_0x3df2dc,null))[_0x01ad('0x48')](handleError(_0x3df2dc,null));};exports[_0x01ad('0x49')]=function(_0x190c55,_0x4394c6){return db[_0x01ad('0x3f')][_0x01ad('0x49')](_0x190c55[_0x01ad('0x4a')],{})[_0x01ad('0x28')](respondWithResult(_0x4394c6,0xc9))[_0x01ad('0x48')](handleError(_0x4394c6,null));};exports[_0x01ad('0x27')]=function(_0x572166,_0x591d27){if(_0x572166['body']['id']){delete _0x572166[_0x01ad('0x4a')]['id'];}return db[_0x01ad('0x3f')][_0x01ad('0x47')]({'where':{'id':_0x572166[_0x01ad('0x43')]['id']}})[_0x01ad('0x28')](handleEntityNotFound(_0x591d27,null))[_0x01ad('0x28')](saveUpdates(_0x572166[_0x01ad('0x4a')],null))[_0x01ad('0x28')](respondWithResult(_0x591d27,null))[_0x01ad('0x48')](handleError(_0x591d27,null));};exports[_0x01ad('0x29')]=function(_0x592022,_0x4e76b2){return db[_0x01ad('0x3f')]['find']({'where':{'id':_0x592022['params']['id']}})['then'](handleEntityNotFound(_0x4e76b2,null))[_0x01ad('0x28')](removeEntity(_0x4e76b2,null))[_0x01ad('0x48')](handleError(_0x4e76b2,null));}; \ No newline at end of file +var _0x88b4=['length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','filters','intersection','fields','attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x88b4,0x188));var _0x488b=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x88b4[_0x86b219];return _0x1f320c;};'use strict';var emlformat=require(_0x488b('0x0'));var rimraf=require(_0x488b('0x1'));var zipdir=require(_0x488b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x488b('0x3'));var moment=require(_0x488b('0x4'));var BPromise=require(_0x488b('0x5'));var Mustache=require(_0x488b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x488b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x488b('0x8'));var _=require(_0x488b('0x9'));var squel=require(_0x488b('0xa'));var crypto=require(_0x488b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x488b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x488b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x488b('0xe'));var as=require(_0x488b('0xf'));var hardwareService=require(_0x488b('0x10'));var logger=require(_0x488b('0x11'))(_0x488b('0x12'));var utils=require(_0x488b('0x13'));var config=require(_0x488b('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x208580,_0x482a9a){_0x482a9a=_0x482a9a||0xcc;return function(_0x4d5c29){if(_0x4d5c29){return _0x208580['sendStatus'](_0x482a9a);}return _0x208580[_0x488b('0x15')](_0x482a9a)[_0x488b('0x16')]();};}function respondWithResult(_0x57d641,_0x2d1a28){_0x2d1a28=_0x2d1a28||0xc8;return function(_0x4b9a){if(_0x4b9a){return _0x57d641[_0x488b('0x15')](_0x2d1a28)[_0x488b('0x17')](_0x4b9a);}};}function respondWithFilteredResult(_0x3d15b3,_0x4f543c){return function(_0x312e8e){if(_0x312e8e){var _0x16c085=typeof _0x4f543c[_0x488b('0x18')]===_0x488b('0x19')&&typeof _0x4f543c[_0x488b('0x1a')]==='undefined';var _0x346803=_0x312e8e[_0x488b('0x1b')];var _0x5557ce=_0x16c085?0x0:_0x4f543c['offset'];var _0x5a93a5=_0x16c085?_0x312e8e[_0x488b('0x1b')]:_0x4f543c['offset']+_0x4f543c['limit'];var _0x3fc233;if(_0x5a93a5>=_0x346803){_0x5a93a5=_0x346803;_0x3fc233=0xc8;}else{_0x3fc233=0xce;}_0x3d15b3[_0x488b('0x15')](_0x3fc233);return _0x3d15b3[_0x488b('0x1c')](_0x488b('0x1d'),_0x5557ce+'-'+_0x5a93a5+'/'+_0x346803)[_0x488b('0x17')](_0x312e8e);}return null;};}function patchUpdates(_0x2a770f){return function(_0x54c39a){try{jsonpatch[_0x488b('0x1e')](_0x54c39a,_0x2a770f,!![]);}catch(_0x2060b5){return BPromise[_0x488b('0x1f')](_0x2060b5);}return _0x54c39a[_0x488b('0x20')]();};}function saveUpdates(_0x568e76,_0x22437a){return function(_0x3cbf1a){if(_0x3cbf1a){return _0x3cbf1a[_0x488b('0x21')](_0x568e76)[_0x488b('0x22')](function(_0x30e06e){return _0x30e06e;});}return null;};}function removeEntity(_0x2515e7,_0x39dd04){return function(_0x2863a8){if(_0x2863a8){return _0x2863a8[_0x488b('0x23')]()[_0x488b('0x22')](function(){_0x2515e7[_0x488b('0x15')](0xcc)[_0x488b('0x16')]();});}};}function handleEntityNotFound(_0x1e1cdc,_0x32665b){return function(_0x43da42){if(!_0x43da42){_0x1e1cdc['sendStatus'](0x194);}return _0x43da42;};}function handleError(_0x5f2f0a,_0x2f0c0c){_0x2f0c0c=_0x2f0c0c||0x1f4;return function(_0x44cbcf){logger[_0x488b('0x24')](_0x44cbcf[_0x488b('0x25')]);if(_0x44cbcf['name']){delete _0x44cbcf[_0x488b('0x26')];}_0x5f2f0a[_0x488b('0x15')](_0x2f0c0c)[_0x488b('0x27')](_0x44cbcf);};}exports[_0x488b('0x28')]=function(_0x3d6fde,_0x3f62bd){var _0x16a790={},_0x28f409={},_0x1e5f9f={'count':0x0,'rows':[]};var _0x51298c=_[_0x488b('0x29')](db[_0x488b('0x2a')][_0x488b('0x2b')],function(_0x1bbb89){return{'name':_0x1bbb89[_0x488b('0x2c')],'type':_0x1bbb89[_0x488b('0x2d')][_0x488b('0x2e')]};});_0x28f409[_0x488b('0x2f')]=_[_0x488b('0x29')](_0x51298c,_0x488b('0x26'));_0x28f409['query']=_['keys'](_0x3d6fde['query']);_0x28f409[_0x488b('0x30')]=_[_0x488b('0x31')](_0x28f409[_0x488b('0x2f')],_0x28f409['query']);_0x16a790['attributes']=_[_0x488b('0x31')](_0x28f409[_0x488b('0x2f')],qs[_0x488b('0x32')](_0x3d6fde['query'][_0x488b('0x32')]));_0x16a790[_0x488b('0x33')]=_0x16a790[_0x488b('0x33')][_0x488b('0x34')]?_0x16a790[_0x488b('0x33')]:_0x28f409[_0x488b('0x2f')];if(!_0x3d6fde[_0x488b('0x35')][_0x488b('0x36')](_0x488b('0x37'))){_0x16a790[_0x488b('0x1a')]=qs[_0x488b('0x1a')](_0x3d6fde[_0x488b('0x35')]['limit']);_0x16a790[_0x488b('0x18')]=qs[_0x488b('0x18')](_0x3d6fde['query']['offset']);}_0x16a790[_0x488b('0x38')]=qs['sort'](_0x3d6fde[_0x488b('0x35')][_0x488b('0x39')]);_0x16a790[_0x488b('0x3a')]=qs['filters'](_[_0x488b('0x3b')](_0x3d6fde[_0x488b('0x35')],_0x28f409[_0x488b('0x30')]),_0x51298c);if(_0x3d6fde[_0x488b('0x35')][_0x488b('0x3c')]){_0x16a790[_0x488b('0x3a')]=_[_0x488b('0x3d')](_0x16a790[_0x488b('0x3a')],{'$or':_[_0x488b('0x29')](_0x51298c,function(_0x21b5aa){if(_0x21b5aa['type']!=='VIRTUAL'){var _0x408ef9={};_0x408ef9[_0x21b5aa[_0x488b('0x26')]]={'$like':'%'+_0x3d6fde[_0x488b('0x35')][_0x488b('0x3c')]+'%'};return _0x408ef9;}})});}_0x16a790=_['merge']({},_0x16a790,_0x3d6fde[_0x488b('0x3e')]);var _0x2aaa9b={'where':_0x16a790[_0x488b('0x3a')]};return db[_0x488b('0x2a')][_0x488b('0x1b')](_0x2aaa9b)[_0x488b('0x22')](function(_0x3eaa46){_0x1e5f9f['count']=_0x3eaa46;if(_0x3d6fde[_0x488b('0x35')][_0x488b('0x3f')]){_0x16a790[_0x488b('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x488b('0x41')](_0x16a790);})['then'](function(_0x363854){_0x1e5f9f[_0x488b('0x42')]=_0x363854;return _0x1e5f9f;})[_0x488b('0x22')](respondWithFilteredResult(_0x3f62bd,_0x16a790))[_0x488b('0x43')](handleError(_0x3f62bd,null));};exports[_0x488b('0x44')]=function(_0x536c55,_0x582b6d){var _0x10fbe0={'raw':!![],'where':{'id':_0x536c55[_0x488b('0x45')]['id']}},_0x5d80e7={};_0x5d80e7['model']=_['keys'](db[_0x488b('0x2a')][_0x488b('0x2b')]);_0x5d80e7[_0x488b('0x35')]=_[_0x488b('0x46')](_0x536c55[_0x488b('0x35')]);_0x5d80e7['filters']=_[_0x488b('0x31')](_0x5d80e7[_0x488b('0x2f')],_0x5d80e7[_0x488b('0x35')]);_0x10fbe0[_0x488b('0x33')]=_[_0x488b('0x31')](_0x5d80e7[_0x488b('0x2f')],qs[_0x488b('0x32')](_0x536c55[_0x488b('0x35')][_0x488b('0x32')]));_0x10fbe0['attributes']=_0x10fbe0[_0x488b('0x33')][_0x488b('0x34')]?_0x10fbe0[_0x488b('0x33')]:_0x5d80e7[_0x488b('0x2f')];if(_0x536c55[_0x488b('0x35')][_0x488b('0x3f')]){_0x10fbe0['include']=[{'all':!![]}];}_0x10fbe0=_['merge']({},_0x10fbe0,_0x536c55[_0x488b('0x3e')]);return db['FreshsalesField'][_0x488b('0x47')](_0x10fbe0)[_0x488b('0x22')](handleEntityNotFound(_0x582b6d,null))[_0x488b('0x22')](respondWithResult(_0x582b6d,null))[_0x488b('0x43')](handleError(_0x582b6d,null));};exports[_0x488b('0x48')]=function(_0x392bd1,_0x2c8c0c){return db[_0x488b('0x2a')][_0x488b('0x48')](_0x392bd1[_0x488b('0x49')],{})[_0x488b('0x22')](respondWithResult(_0x2c8c0c,0xc9))[_0x488b('0x43')](handleError(_0x2c8c0c,null));};exports[_0x488b('0x21')]=function(_0x757bd8,_0x43b4ed){if(_0x757bd8[_0x488b('0x49')]['id']){delete _0x757bd8[_0x488b('0x49')]['id'];}return db['FreshsalesField'][_0x488b('0x47')]({'where':{'id':_0x757bd8['params']['id']}})[_0x488b('0x22')](handleEntityNotFound(_0x43b4ed,null))[_0x488b('0x22')](saveUpdates(_0x757bd8[_0x488b('0x49')],null))[_0x488b('0x22')](respondWithResult(_0x43b4ed,null))[_0x488b('0x43')](handleError(_0x43b4ed,null));};exports[_0x488b('0x23')]=function(_0x432a86,_0x996169){return db[_0x488b('0x2a')]['find']({'where':{'id':_0x432a86['params']['id']}})[_0x488b('0x22')](handleEntityNotFound(_0x996169,null))[_0x488b('0x22')](removeEntity(_0x996169,null))[_0x488b('0x43')](handleError(_0x996169,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6d74775..e7dad71 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 _0x72a1=['util','api','bluebird','request-promise','path','../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x2ce97a,_0x17f5fb){var _0x4afe85=function(_0x35fa87){while(--_0x35fa87){_0x2ce97a['push'](_0x2ce97a['shift']());}};_0x4afe85(++_0x17f5fb);}(_0x72a1,0x1ce));var _0x172a=function(_0x312b03,_0x10f392){_0x312b03=_0x312b03-0x0;var _0x58dd5f=_0x72a1[_0x312b03];return _0x58dd5f;};'use strict';var _=require('lodash');var util=require(_0x172a('0x0'));var logger=require('../../config/logger')(_0x172a('0x1'));var moment=require('moment');var BPromise=require(_0x172a('0x2'));var rp=require(_0x172a('0x3'));var fs=require('fs');var path=require(_0x172a('0x4'));var rimraf=require('rimraf');var config=require(_0x172a('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0x172a('0x6')]=function(_0x5bc607,_0x13724a){return _0x5bc607['define'](_0x172a('0x7'),attributes,{'tableName':_0x172a('0x8'),'paranoid':![],'indexes':[{'name':_0x172a('0x9'),'fields':[_0x172a('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d3d=['int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField'];(function(_0x7b9f3f,_0x561363){var _0x27d78a=function(_0x40fede){while(--_0x40fede){_0x7b9f3f['push'](_0x7b9f3f['shift']());}};_0x27d78a(++_0x561363);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var logger=require(_0xd3d3('0x1'))('api');var moment=require(_0xd3d3('0x2'));var BPromise=require(_0xd3d3('0x3'));var rp=require(_0xd3d3('0x4'));var fs=require('fs');var path=require(_0xd3d3('0x5'));var rimraf=require(_0xd3d3('0x6'));var config=require(_0xd3d3('0x7'));var attributes=require(_0xd3d3('0x8'));module[_0xd3d3('0x9')]=function(_0x2d36ba,_0x1e9338){return _0x2d36ba['define'](_0xd3d3('0xa'),attributes,{'tableName':_0xd3d3('0xb'),'paranoid':![],'indexes':[{'name':_0xd3d3('0xc'),'fields':[_0xd3d3('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 958df32..5ad25c9 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 _0x2eb2=['request','then','info','request\x20sent','error','FreshsalesField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x23b0a8,_0x99204f){var _0x512363=function(_0x53446b){while(--_0x53446b){_0x23b0a8['push'](_0x23b0a8['shift']());}};_0x512363(++_0x99204f);}(_0x2eb2,0x19f));var _0x22eb=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x2eb2[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x31488d,_0x1bd750){var _0x2af3aa=function(_0x11f9a0){while(--_0x11f9a0){_0x31488d['push'](_0x31488d['shift']());}};_0x2af3aa(++_0x1bd750);}(_0xba34,0x119));var _0x4ba3=function(_0x14d328,_0x2d6aaf){_0x14d328=_0x14d328-0x0;var _0x32fb0a=_0xba34[_0x14d328];return _0x32fb0a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4225017..dc15d15 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(_0x12554a,_0x37a21b){var _0x2edf44=function(_0x164fdd){while(--_0x164fdd){_0x12554a['push'](_0x12554a['shift']());}};_0x2edf44(++_0x37a21b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x581b54,_0x3ad62f){var _0x128dc9=function(_0x21b693){while(--_0x21b693){_0x581b54['push'](_0x581b54['shift']());}};_0x128dc9(++_0x3ad62f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a246acf..2fd1f59 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 _0xf7a8=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x1c5adf,_0x12a026){var _0x3dd9c2=function(_0x25e4d9){while(--_0x25e4d9){_0x1c5adf['push'](_0x1c5adf['shift']());}};_0x3dd9c2(++_0x12a026);}(_0xf7a8,0xfa));var _0x8f7a=function(_0x284a72,_0x10da0b){_0x284a72=_0x284a72-0x0;var _0x5d6330=_0xf7a8[_0x284a72];return _0x5d6330;};'use strict';var Sequelize=require(_0x8f7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f7a('0x1')]},'description':{'type':Sequelize[_0x8f7a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x8f7a('0x2')},'remoteUri':{'type':Sequelize[_0x8f7a('0x1')]},'password':{'type':Sequelize[_0x8f7a('0x1')]},'clientId':{'type':Sequelize[_0x8f7a('0x1')]},'clientSecret':{'type':Sequelize[_0x8f7a('0x1')]},'securityToken':{'type':Sequelize[_0x8f7a('0x1')]},'serverUrl':{'type':Sequelize[_0x8f7a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8f7a('0x3')](_0x8f7a('0x4'),_0x8f7a('0x5')),'defaultValue':_0x8f7a('0x4')}}; \ No newline at end of file +var _0xaeeb=['ENUM','integrationTab','newTab','exports','STRING'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xaeeb,0x116));var _0xbaee=function(_0x13a11b,_0x5361b4){_0x13a11b=_0x13a11b-0x0;var _0xe65d31=_0xaeeb[_0x13a11b];return _0xe65d31;};'use strict';var Sequelize=require('sequelize');module[_0xbaee('0x0')]={'name':{'type':Sequelize[_0xbaee('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbaee('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xbaee('0x1')]},'password':{'type':Sequelize[_0xbaee('0x1')]},'clientId':{'type':Sequelize[_0xbaee('0x1')]},'clientSecret':{'type':Sequelize[_0xbaee('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbaee('0x2')](_0xbaee('0x3'),_0xbaee('0x4')),'defaultValue':_0xbaee('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a8f45a6..2db395a 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 _0x39d0=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','find','create','body','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','phone','includes','length','custom','picklistValues','label','value','True','False','false','test','statusCode','error','stringify','Wrong\x20credentials'];(function(_0x33a13d,_0x1073ec){var _0xbf0b74=function(_0x4b8719){while(--_0x4b8719){_0x33a13d['push'](_0x33a13d['shift']());}};_0xbf0b74(++_0x1073ec);}(_0x39d0,0x180));var _0x039d=function(_0x578ec6,_0x36e50e){_0x578ec6=_0x578ec6-0x0;var _0x5676ae=_0x39d0[_0x578ec6];return _0x5676ae;};'use strict';var emlformat=require(_0x039d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x039d('0x1'));var jsonpatch=require(_0x039d('0x2'));var rp=require(_0x039d('0x3'));var moment=require(_0x039d('0x4'));var BPromise=require(_0x039d('0x5'));var Mustache=require(_0x039d('0x6'));var util=require(_0x039d('0x7'));var path=require(_0x039d('0x8'));var sox=require(_0x039d('0x9'));var csv=require(_0x039d('0xa'));var ejs=require(_0x039d('0xb'));var fs=require('fs');var fs_extra=require(_0x039d('0xc'));var _=require(_0x039d('0xd'));var squel=require(_0x039d('0xe'));var crypto=require(_0x039d('0xf'));var jsforce=require(_0x039d('0x10'));var deskjs=require(_0x039d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x039d('0x12'));var Papa=require(_0x039d('0x13'));var Redis=require('ioredis');var authService=require(_0x039d('0x14'));var qs=require(_0x039d('0x15'));var as=require(_0x039d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x039d('0x17'))(_0x039d('0x18'));var utils=require(_0x039d('0x19'));var config=require(_0x039d('0x1a'));var licenseUtil=require(_0x039d('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x039d('0x1c'));function respondWithStatusCode(_0x5748a9,_0x3a7316){_0x3a7316=_0x3a7316||0xcc;return function(_0x2d26b0){if(_0x2d26b0){return _0x5748a9[_0x039d('0x1d')](_0x3a7316);}return _0x5748a9['status'](_0x3a7316)['end']();};}function respondWithResult(_0x2fc106,_0x18814e){_0x18814e=_0x18814e||0xc8;return function(_0x4dc26f){if(_0x4dc26f){return _0x2fc106[_0x039d('0x1e')](_0x18814e)[_0x039d('0x1f')](_0x4dc26f);}};}function respondWithFilteredResult(_0x1ffb08,_0x6dcf1f){return function(_0x30790d){if(_0x30790d){var _0x160dfd=typeof _0x6dcf1f[_0x039d('0x20')]===_0x039d('0x21')&&typeof _0x6dcf1f[_0x039d('0x22')]===_0x039d('0x21');var _0x4360c4=_0x30790d[_0x039d('0x23')];var _0x3c68c0=_0x160dfd?0x0:_0x6dcf1f[_0x039d('0x20')];var _0x34c3f2=_0x160dfd?_0x30790d[_0x039d('0x23')]:_0x6dcf1f[_0x039d('0x20')]+_0x6dcf1f[_0x039d('0x22')];var _0x97b894;if(_0x34c3f2>=_0x4360c4){_0x34c3f2=_0x4360c4;_0x97b894=0xc8;}else{_0x97b894=0xce;}_0x1ffb08[_0x039d('0x1e')](_0x97b894);return _0x1ffb08[_0x039d('0x24')](_0x039d('0x25'),_0x3c68c0+'-'+_0x34c3f2+'/'+_0x4360c4)[_0x039d('0x1f')](_0x30790d);}return null;};}function patchUpdates(_0x4e0dae){return function(_0x48c4fa){try{jsonpatch['apply'](_0x48c4fa,_0x4e0dae,!![]);}catch(_0x58acf0){return BPromise[_0x039d('0x26')](_0x58acf0);}return _0x48c4fa[_0x039d('0x27')]();};}function saveUpdates(_0x11bdd2,_0x34e9f7){return function(_0x3b0401){if(_0x3b0401){return _0x3b0401[_0x039d('0x28')](_0x11bdd2)[_0x039d('0x29')](function(_0x2dd89e){return _0x2dd89e;});}return null;};}function removeEntity(_0x2b70f0,_0x12ac93){return function(_0x362779){if(_0x362779){return _0x362779[_0x039d('0x2a')]()[_0x039d('0x29')](function(){_0x2b70f0['status'](0xcc)[_0x039d('0x2b')]();});}};}function handleEntityNotFound(_0x438e6b,_0x5ed260){return function(_0x421759){if(!_0x421759){_0x438e6b[_0x039d('0x1d')](0x194);}return _0x421759;};}function handleError(_0x4e3c1f,_0x448879){_0x448879=_0x448879||0x1f4;return function(_0x1f0ded){logger['error'](_0x1f0ded[_0x039d('0x2c')]);if(_0x1f0ded[_0x039d('0x2d')]){delete _0x1f0ded[_0x039d('0x2d')];}_0x4e3c1f['status'](_0x448879)[_0x039d('0x2e')](_0x1f0ded);};}exports['index']=function(_0xd1b2e6,_0x22a034){var _0x370f6d={},_0x2113b1={},_0x5a56e4={'count':0x0,'rows':[]};var _0x3069e1=_['map'](db['SalesforceAccount'][_0x039d('0x2f')],function(_0x22ad21){return{'name':_0x22ad21['fieldName'],'type':_0x22ad21['type'][_0x039d('0x30')]};});_0x2113b1[_0x039d('0x31')]=_[_0x039d('0x32')](_0x3069e1,_0x039d('0x2d'));_0x2113b1[_0x039d('0x33')]=_[_0x039d('0x34')](_0xd1b2e6[_0x039d('0x33')]);_0x2113b1[_0x039d('0x35')]=_[_0x039d('0x36')](_0x2113b1[_0x039d('0x31')],_0x2113b1[_0x039d('0x33')]);_0x370f6d[_0x039d('0x37')]=_[_0x039d('0x36')](_0x2113b1[_0x039d('0x31')],qs[_0x039d('0x38')](_0xd1b2e6[_0x039d('0x33')][_0x039d('0x38')]));_0x370f6d['attributes']=_0x370f6d[_0x039d('0x37')]['length']?_0x370f6d[_0x039d('0x37')]:_0x2113b1[_0x039d('0x31')];if(!_0xd1b2e6[_0x039d('0x33')][_0x039d('0x39')](_0x039d('0x3a'))){_0x370f6d[_0x039d('0x22')]=qs[_0x039d('0x22')](_0xd1b2e6[_0x039d('0x33')][_0x039d('0x22')]);_0x370f6d['offset']=qs[_0x039d('0x20')](_0xd1b2e6[_0x039d('0x33')][_0x039d('0x20')]);}_0x370f6d[_0x039d('0x3b')]=qs[_0x039d('0x3c')](_0xd1b2e6[_0x039d('0x33')]['sort']);_0x370f6d[_0x039d('0x3d')]=qs[_0x039d('0x35')](_[_0x039d('0x3e')](_0xd1b2e6[_0x039d('0x33')],_0x2113b1['filters']),_0x3069e1);if(_0xd1b2e6[_0x039d('0x33')][_0x039d('0x3f')]){_0x370f6d[_0x039d('0x3d')]=_[_0x039d('0x40')](_0x370f6d[_0x039d('0x3d')],{'$or':_[_0x039d('0x32')](_0x3069e1,function(_0x2a1305){if(_0x2a1305[_0x039d('0x41')]!==_0x039d('0x42')){var _0x547ffb={};_0x547ffb[_0x2a1305['name']]={'$like':'%'+_0xd1b2e6[_0x039d('0x33')][_0x039d('0x3f')]+'%'};return _0x547ffb;}})});}_0x370f6d=_[_0x039d('0x40')]({},_0x370f6d,_0xd1b2e6[_0x039d('0x43')]);var _0x242b58={'where':_0x370f6d[_0x039d('0x3d')]};return db[_0x039d('0x44')][_0x039d('0x23')](_0x242b58)[_0x039d('0x29')](function(_0xc8da91){_0x5a56e4[_0x039d('0x23')]=_0xc8da91;if(_0xd1b2e6[_0x039d('0x33')][_0x039d('0x45')]){_0x370f6d[_0x039d('0x46')]=[{'all':!![]}];}return db[_0x039d('0x44')][_0x039d('0x47')](_0x370f6d);})[_0x039d('0x29')](function(_0x171f5b){_0x5a56e4[_0x039d('0x48')]=_0x171f5b;return _0x5a56e4;})[_0x039d('0x29')](respondWithFilteredResult(_0x22a034,_0x370f6d))[_0x039d('0x49')](handleError(_0x22a034,null));};exports['show']=function(_0x2c7b07,_0x59c4a0){var _0xd10a9c={'raw':![],'where':{'id':_0x2c7b07['params']['id']}},_0x175e21={};_0x175e21['model']=_[_0x039d('0x34')](db[_0x039d('0x44')]['rawAttributes']);_0x175e21[_0x039d('0x33')]=_['keys'](_0x2c7b07[_0x039d('0x33')]);_0x175e21['filters']=_['intersection'](_0x175e21[_0x039d('0x31')],_0x175e21[_0x039d('0x33')]);_0xd10a9c['attributes']=_['intersection'](_0x175e21['model'],qs[_0x039d('0x38')](_0x2c7b07[_0x039d('0x33')]['fields']));_0xd10a9c[_0x039d('0x37')]=_0xd10a9c[_0x039d('0x37')]['length']?_0xd10a9c[_0x039d('0x37')]:_0x175e21[_0x039d('0x31')];if(_0x2c7b07[_0x039d('0x33')][_0x039d('0x45')]){_0xd10a9c[_0x039d('0x46')]=[{'all':!![]}];}_0xd10a9c=_['merge']({},_0xd10a9c,_0x2c7b07['options']);return db[_0x039d('0x44')][_0x039d('0x4a')](_0xd10a9c)[_0x039d('0x29')](handleEntityNotFound(_0x59c4a0,null))['then'](respondWithResult(_0x59c4a0,null))[_0x039d('0x49')](handleError(_0x59c4a0,null));};exports[_0x039d('0x4b')]=function(_0x1d7d6e,_0x453208){return db[_0x039d('0x44')]['create'](_0x1d7d6e['body'],{})[_0x039d('0x29')](respondWithResult(_0x453208,0xc9))[_0x039d('0x49')](handleError(_0x453208,null));};exports[_0x039d('0x28')]=function(_0xd1998a,_0x5534dd){if(_0xd1998a[_0x039d('0x4c')]['id']){delete _0xd1998a[_0x039d('0x4c')]['id'];}return db[_0x039d('0x44')][_0x039d('0x4a')]({'where':{'id':_0xd1998a[_0x039d('0x4d')]['id']}})[_0x039d('0x29')](handleEntityNotFound(_0x5534dd,null))[_0x039d('0x29')](saveUpdates(_0xd1998a[_0x039d('0x4c')],null))['then'](respondWithResult(_0x5534dd,null))[_0x039d('0x49')](handleError(_0x5534dd,null));};exports[_0x039d('0x2a')]=function(_0x34fa60,_0x441b14){return db[_0x039d('0x44')][_0x039d('0x4a')]({'where':{'id':_0x34fa60[_0x039d('0x4d')]['id']}})[_0x039d('0x29')](handleEntityNotFound(_0x441b14,null))[_0x039d('0x29')](removeEntity(_0x441b14,null))[_0x039d('0x49')](handleError(_0x441b14,null));};exports[_0x039d('0x4e')]=function(_0xe76bc3,_0x28cc0b,_0x45d996){var _0x246bef={};var _0x4a2ac0={};var _0x20b0cf;var _0x46f21a;return db[_0x039d('0x44')][_0x039d('0x4f')]({'where':{'id':_0xe76bc3[_0x039d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x28cc0b,null))[_0x039d('0x29')](function(_0x411a96){if(_0x411a96){_0x20b0cf=_0x411a96;_0x4a2ac0[_0x039d('0x31')]=_[_0x039d('0x34')](db['SalesforceConfiguration'][_0x039d('0x2f')]);_0x4a2ac0['query']=_[_0x039d('0x34')](_0xe76bc3[_0x039d('0x33')]);_0x4a2ac0[_0x039d('0x35')]=_[_0x039d('0x36')](_0x4a2ac0[_0x039d('0x31')],_0x4a2ac0[_0x039d('0x33')]);_0x246bef[_0x039d('0x37')]=_[_0x039d('0x36')](_0x4a2ac0[_0x039d('0x31')],qs[_0x039d('0x38')](_0xe76bc3['query'][_0x039d('0x38')]));_0x246bef['attributes']=_0x246bef[_0x039d('0x37')]['length']?_0x246bef['attributes']:_0x4a2ac0['model'];_0x246bef['order']=qs[_0x039d('0x3c')](_0xe76bc3[_0x039d('0x33')]['sort']);_0x246bef[_0x039d('0x3d')]=qs[_0x039d('0x35')](_[_0x039d('0x3e')](_0xe76bc3['query'],_0x4a2ac0[_0x039d('0x35')]));if(_0xe76bc3[_0x039d('0x33')]['filter']){_0x246bef[_0x039d('0x3d')]=_[_0x039d('0x40')](_0x246bef[_0x039d('0x3d')],{'$or':_[_0x039d('0x32')](_0x246bef[_0x039d('0x37')],function(_0x5d240a){var _0xabd286={};_0xabd286[_0x5d240a]={'$like':'%'+_0xe76bc3[_0x039d('0x33')]['filter']+'%'};return _0xabd286;})});}_0x246bef=_[_0x039d('0x40')]({},_0x246bef,_0xe76bc3[_0x039d('0x43')]);return _0x20b0cf[_0x039d('0x4e')](_0x246bef);}})[_0x039d('0x29')](function(_0x37681d){if(_0x37681d){_0x46f21a=_0x37681d['length'];if(!_0xe76bc3[_0x039d('0x33')][_0x039d('0x39')](_0x039d('0x3a'))){_0x246bef[_0x039d('0x22')]=qs[_0x039d('0x22')](_0xe76bc3[_0x039d('0x33')]['limit']);_0x246bef[_0x039d('0x20')]=qs[_0x039d('0x20')](_0xe76bc3[_0x039d('0x33')][_0x039d('0x20')]);}return _0x20b0cf['getConfigurations'](_0x246bef);}})[_0x039d('0x29')](function(_0x4832b8){if(_0x4832b8){return _0x4832b8?{'count':_0x46f21a,'rows':_0x4832b8}:null;}})[_0x039d('0x29')](respondWithResult(_0x28cc0b,null))[_0x039d('0x49')](handleError(_0x28cc0b,null));};exports[_0x039d('0x50')]=function(_0x34ef5e,_0x2c86db,_0x173bd2){if(_0x34ef5e[_0x039d('0x4c')]['id']){delete _0x34ef5e[_0x039d('0x4c')]['id'];}return db[_0x039d('0x44')][_0x039d('0x4f')]({'where':{'id':_0x34ef5e[_0x039d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c86db,null))['then'](function(_0x533754){if(_0x533754){_0x34ef5e['body'][_0x039d('0x51')]=_0x533754['id'];_0x34ef5e['body'][_0x039d('0x52')]=integrations[_0x039d('0x53')](_0x34ef5e[_0x039d('0x4c')][_0x039d('0x54')],_0x34ef5e[_0x039d('0x4c')][_0x039d('0x41')]);_0x34ef5e[_0x039d('0x4c')][_0x039d('0x55')]=integrations[_0x039d('0x56')](_0x34ef5e[_0x039d('0x4c')]['channel'],_0x34ef5e[_0x039d('0x4c')]['type']);return db[_0x039d('0x57')]['create'](_0x34ef5e['body'],{'include':[{'model':db[_0x039d('0x58')],'as':_0x039d('0x52')},{'model':db[_0x039d('0x58')],'as':'Descriptions'}]});}return null;})[_0x039d('0x29')](respondWithResult(_0x2c86db,null))[_0x039d('0x49')](handleError(_0x2c86db,null));};exports[_0x039d('0x59')]=function(_0x13b198,_0x2346ca,_0x518e8f){var _0x30bba9;var _0x45f02c='';var _0x435e8c='Task';return db[_0x039d('0x44')][_0x039d('0x4f')]({'where':{'id':_0x13b198[_0x039d('0x4d')]['id']},'attributes':['id',_0x039d('0x5a'),_0x039d('0x5b'),_0x039d('0x5c'),_0x039d('0x5d'),_0x039d('0x5e'),_0x039d('0x5f')]})['then'](handleEntityNotFound(_0x2346ca,null))['then'](function(_0x3908cf){if(_0x3908cf){_0x45f02c=_0x3908cf[_0x039d('0x5a')];var _0x21a0e0=_0x45f02c['slice'](-0x1);if(_0x21a0e0==='/'){_0x45f02c=_0x45f02c['substring'](0x0,_0x45f02c[_0x039d('0x60')](_0x21a0e0));}_0x30bba9=new jsforce[(_0x039d('0x61'))]({'oauth2':{'loginUrl':_0x45f02c,'clientId':_0x3908cf[_0x039d('0x5b')],'clientSecret':_0x3908cf[_0x039d('0x5c')]}});return _0x30bba9['login'](_0x3908cf[_0x039d('0x5d')],_0x3908cf[_0x039d('0x5e')][_0x039d('0x62')](_0x3908cf[_0x039d('0x5f')]));}})[_0x039d('0x29')](function(_0x4c82bc){if(_0x4c82bc){if(!_[_0x039d('0x63')](_0x13b198['query'][_0x039d('0x64')])){_0x435e8c=_0x13b198[_0x039d('0x33')][_0x039d('0x64')];}return _0x30bba9[_0x039d('0x65')](_0x435e8c)[_0x039d('0x66')]();}})[_0x039d('0x29')](function(_0x5d39d4){var _0xaa103f=[_0x039d('0x67'),_0x039d('0x68'),_0x039d('0x69'),_0x039d('0x6a'),_0x039d('0x6b'),_0x039d('0x6c')];var _0x8d20ef=[_0x039d('0x6d'),_0x039d('0x6e'),'picklist',_0x039d('0x6f'),'email',_0x039d('0x70'),_0x039d('0x71')];if(_0x5d39d4){_['remove'](_0x5d39d4[_0x039d('0x38')],function(_0x175124){return _0xaa103f['includes'](_0x175124[_0x039d('0x2d')])||!_0x8d20ef[_0x039d('0x72')](_0x175124[_0x039d('0x41')]);});return{'count':_0x5d39d4[_0x039d('0x38')][_0x039d('0x73')],'rows':_[_0x039d('0x32')](_0x5d39d4[_0x039d('0x38')],function(_0x62b883){return{'id':_0x62b883[_0x039d('0x2d')],'name':_0x62b883['label'],'custom':_0x62b883[_0x039d('0x74')],'options':_0x62b883[_0x039d('0x75')][_0x039d('0x73')]>0x0?_['map'](_0x62b883['picklistValues'],function(_0x4cd9f3){return{'name':_0x4cd9f3[_0x039d('0x76')],'value':_0x4cd9f3[_0x039d('0x77')]};}):_0x62b883[_0x039d('0x41')]==_0x039d('0x6f')?[{'name':_0x039d('0x78'),'value':'true'},{'name':_0x039d('0x79'),'value':_0x039d('0x7a')}]:[]};})};}})['then'](respondWithResult(_0x2346ca,null))['catch'](function(_0x38e60a){var _0xc872eb=_0x13b198[_0x039d('0x33')][_0x039d('0x7b')]?0x1f4:_0x38e60a[_0x039d('0x7c')]||0x1f4;logger[_0x039d('0x7d')]('getFields,\x20%s,\x20%s,\x20%s',_0x039d('0x59'),_0xc872eb,JSON[_0x039d('0x7e')](_0x38e60a));delete _0x38e60a[_0x039d('0x2d')];if(_0xc872eb===0x191){_0xc872eb=0x190;}_0x2346ca[_0x039d('0x1e')](_0xc872eb)[_0x039d('0x2e')](_0x13b198[_0x039d('0x33')][_0x039d('0x7b')]?{'message':_0x039d('0x7f'),'statusCode':_0x38e60a[_0x039d('0x7c')]}:_0x38e60a);});}; \ No newline at end of file +var _0xb03d=['map','SalesforceAccount','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','getConfigurations','SalesforceConfiguration','order','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','password','securityToken','substring','Connection','username','isNil','ticketType','sobject','IsReminderSet','IsRecurrence','Subject','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','True','False','false','statusCode','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index'];(function(_0x142ca6,_0xe88f8b){var _0x34c614=function(_0x457578){while(--_0x457578){_0x142ca6['push'](_0x142ca6['shift']());}};_0x34c614(++_0xe88f8b);}(_0xb03d,0xbf));var _0xdb03=function(_0x4a21cb,_0x1b0e50){_0x4a21cb=_0x4a21cb-0x0;var _0x584789=_0xb03d[_0x4a21cb];return _0x584789;};'use strict';var emlformat=require(_0xdb03('0x0'));var rimraf=require(_0xdb03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb03('0x2'));var rp=require(_0xdb03('0x3'));var moment=require(_0xdb03('0x4'));var BPromise=require(_0xdb03('0x5'));var Mustache=require(_0xdb03('0x6'));var util=require(_0xdb03('0x7'));var path=require(_0xdb03('0x8'));var sox=require(_0xdb03('0x9'));var csv=require(_0xdb03('0xa'));var ejs=require(_0xdb03('0xb'));var fs=require('fs');var fs_extra=require(_0xdb03('0xc'));var _=require(_0xdb03('0xd'));var squel=require(_0xdb03('0xe'));var crypto=require(_0xdb03('0xf'));var jsforce=require(_0xdb03('0x10'));var deskjs=require(_0xdb03('0x11'));var toCsv=require(_0xdb03('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdb03('0x12'));var qs=require(_0xdb03('0x13'));var as=require(_0xdb03('0x14'));var hardwareService=require(_0xdb03('0x15'));var logger=require(_0xdb03('0x16'))(_0xdb03('0x17'));var utils=require(_0xdb03('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdb03('0x19'));var db=require(_0xdb03('0x1a'))['db'];var integrations=require(_0xdb03('0x1b'));function respondWithStatusCode(_0x44c5a5,_0x1afc21){_0x1afc21=_0x1afc21||0xcc;return function(_0x415baa){if(_0x415baa){return _0x44c5a5[_0xdb03('0x1c')](_0x1afc21);}return _0x44c5a5['status'](_0x1afc21)[_0xdb03('0x1d')]();};}function respondWithResult(_0x35e366,_0xc1d8b7){_0xc1d8b7=_0xc1d8b7||0xc8;return function(_0x5e93d2){if(_0x5e93d2){return _0x35e366[_0xdb03('0x1e')](_0xc1d8b7)[_0xdb03('0x1f')](_0x5e93d2);}};}function respondWithFilteredResult(_0x282847,_0x12d7cb){return function(_0x31cc24){if(_0x31cc24){var _0x27eaf9=typeof _0x12d7cb[_0xdb03('0x20')]===_0xdb03('0x21')&&typeof _0x12d7cb[_0xdb03('0x22')]==='undefined';var _0x333879=_0x31cc24['count'];var _0x2d5b60=_0x27eaf9?0x0:_0x12d7cb[_0xdb03('0x20')];var _0x31a682=_0x27eaf9?_0x31cc24[_0xdb03('0x23')]:_0x12d7cb[_0xdb03('0x20')]+_0x12d7cb[_0xdb03('0x22')];var _0x995379;if(_0x31a682>=_0x333879){_0x31a682=_0x333879;_0x995379=0xc8;}else{_0x995379=0xce;}_0x282847[_0xdb03('0x1e')](_0x995379);return _0x282847[_0xdb03('0x24')](_0xdb03('0x25'),_0x2d5b60+'-'+_0x31a682+'/'+_0x333879)[_0xdb03('0x1f')](_0x31cc24);}return null;};}function patchUpdates(_0x2b6aec){return function(_0x31ef70){try{jsonpatch[_0xdb03('0x26')](_0x31ef70,_0x2b6aec,!![]);}catch(_0x5e7b83){return BPromise[_0xdb03('0x27')](_0x5e7b83);}return _0x31ef70[_0xdb03('0x28')]();};}function saveUpdates(_0x1749c0,_0x2d4984){return function(_0x80e83a){if(_0x80e83a){return _0x80e83a[_0xdb03('0x29')](_0x1749c0)[_0xdb03('0x2a')](function(_0x415565){return _0x415565;});}return null;};}function removeEntity(_0x170164,_0x1ba44c){return function(_0x1d2e1a){if(_0x1d2e1a){return _0x1d2e1a[_0xdb03('0x2b')]()[_0xdb03('0x2a')](function(){_0x170164[_0xdb03('0x1e')](0xcc)[_0xdb03('0x1d')]();});}};}function handleEntityNotFound(_0x2430ba,_0x40e9e8){return function(_0x2145ac){if(!_0x2145ac){_0x2430ba[_0xdb03('0x1c')](0x194);}return _0x2145ac;};}function handleError(_0x33f79f,_0x28d618){_0x28d618=_0x28d618||0x1f4;return function(_0x5c05f6){logger[_0xdb03('0x2c')](_0x5c05f6['stack']);if(_0x5c05f6[_0xdb03('0x2d')]){delete _0x5c05f6[_0xdb03('0x2d')];}_0x33f79f[_0xdb03('0x1e')](_0x28d618)['send'](_0x5c05f6);};}exports[_0xdb03('0x2e')]=function(_0x29f1eb,_0x2b109a){var _0x57c4aa={},_0x362881={},_0x1e47fe={'count':0x0,'rows':[]};var _0x51775d=_[_0xdb03('0x2f')](db[_0xdb03('0x30')][_0xdb03('0x31')],function(_0x34a96e){return{'name':_0x34a96e['fieldName'],'type':_0x34a96e['type'][_0xdb03('0x32')]};});_0x362881[_0xdb03('0x33')]=_[_0xdb03('0x2f')](_0x51775d,_0xdb03('0x2d'));_0x362881[_0xdb03('0x34')]=_['keys'](_0x29f1eb[_0xdb03('0x34')]);_0x362881['filters']=_[_0xdb03('0x35')](_0x362881[_0xdb03('0x33')],_0x362881['query']);_0x57c4aa[_0xdb03('0x36')]=_[_0xdb03('0x35')](_0x362881[_0xdb03('0x33')],qs[_0xdb03('0x37')](_0x29f1eb[_0xdb03('0x34')][_0xdb03('0x37')]));_0x57c4aa['attributes']=_0x57c4aa[_0xdb03('0x36')][_0xdb03('0x38')]?_0x57c4aa[_0xdb03('0x36')]:_0x362881[_0xdb03('0x33')];if(!_0x29f1eb[_0xdb03('0x34')][_0xdb03('0x39')](_0xdb03('0x3a'))){_0x57c4aa['limit']=qs[_0xdb03('0x22')](_0x29f1eb[_0xdb03('0x34')]['limit']);_0x57c4aa[_0xdb03('0x20')]=qs[_0xdb03('0x20')](_0x29f1eb[_0xdb03('0x34')][_0xdb03('0x20')]);}_0x57c4aa['order']=qs[_0xdb03('0x3b')](_0x29f1eb[_0xdb03('0x34')][_0xdb03('0x3b')]);_0x57c4aa['where']=qs[_0xdb03('0x3c')](_[_0xdb03('0x3d')](_0x29f1eb[_0xdb03('0x34')],_0x362881[_0xdb03('0x3c')]),_0x51775d);if(_0x29f1eb['query'][_0xdb03('0x3e')]){_0x57c4aa[_0xdb03('0x3f')]=_[_0xdb03('0x40')](_0x57c4aa['where'],{'$or':_[_0xdb03('0x2f')](_0x51775d,function(_0x4f1b11){if(_0x4f1b11[_0xdb03('0x41')]!=='VIRTUAL'){var _0x140052={};_0x140052[_0x4f1b11[_0xdb03('0x2d')]]={'$like':'%'+_0x29f1eb[_0xdb03('0x34')][_0xdb03('0x3e')]+'%'};return _0x140052;}})});}_0x57c4aa=_['merge']({},_0x57c4aa,_0x29f1eb[_0xdb03('0x42')]);var _0x33c092={'where':_0x57c4aa['where']};return db['SalesforceAccount']['count'](_0x33c092)['then'](function(_0x26d3e9){_0x1e47fe[_0xdb03('0x23')]=_0x26d3e9;if(_0x29f1eb['query'][_0xdb03('0x43')]){_0x57c4aa['include']=[{'all':!![]}];}return db[_0xdb03('0x30')][_0xdb03('0x44')](_0x57c4aa);})[_0xdb03('0x2a')](function(_0x313e9d){_0x1e47fe[_0xdb03('0x45')]=_0x313e9d;return _0x1e47fe;})['then'](respondWithFilteredResult(_0x2b109a,_0x57c4aa))[_0xdb03('0x46')](handleError(_0x2b109a,null));};exports[_0xdb03('0x47')]=function(_0x8a30b6,_0xd72aff){var _0x73e89b={'raw':![],'where':{'id':_0x8a30b6[_0xdb03('0x48')]['id']}},_0x397855={};_0x397855[_0xdb03('0x33')]=_['keys'](db[_0xdb03('0x30')][_0xdb03('0x31')]);_0x397855['query']=_[_0xdb03('0x49')](_0x8a30b6[_0xdb03('0x34')]);_0x397855[_0xdb03('0x3c')]=_[_0xdb03('0x35')](_0x397855['model'],_0x397855[_0xdb03('0x34')]);_0x73e89b[_0xdb03('0x36')]=_[_0xdb03('0x35')](_0x397855['model'],qs['fields'](_0x8a30b6['query']['fields']));_0x73e89b[_0xdb03('0x36')]=_0x73e89b[_0xdb03('0x36')]['length']?_0x73e89b[_0xdb03('0x36')]:_0x397855[_0xdb03('0x33')];if(_0x8a30b6[_0xdb03('0x34')][_0xdb03('0x43')]){_0x73e89b[_0xdb03('0x4a')]=[{'all':!![]}];}_0x73e89b=_[_0xdb03('0x40')]({},_0x73e89b,_0x8a30b6['options']);return db[_0xdb03('0x30')][_0xdb03('0x4b')](_0x73e89b)[_0xdb03('0x2a')](handleEntityNotFound(_0xd72aff,null))[_0xdb03('0x2a')](respondWithResult(_0xd72aff,null))[_0xdb03('0x46')](handleError(_0xd72aff,null));};exports[_0xdb03('0x4c')]=function(_0x108707,_0x424154){return db['SalesforceAccount'][_0xdb03('0x4c')](_0x108707[_0xdb03('0x4d')],{})['then'](respondWithResult(_0x424154,0xc9))[_0xdb03('0x46')](handleError(_0x424154,null));};exports[_0xdb03('0x29')]=function(_0xa8f230,_0x1664f6){if(_0xa8f230['body']['id']){delete _0xa8f230[_0xdb03('0x4d')]['id'];}return db[_0xdb03('0x30')]['find']({'where':{'id':_0xa8f230[_0xdb03('0x48')]['id']}})[_0xdb03('0x2a')](handleEntityNotFound(_0x1664f6,null))['then'](saveUpdates(_0xa8f230[_0xdb03('0x4d')],null))[_0xdb03('0x2a')](respondWithResult(_0x1664f6,null))[_0xdb03('0x46')](handleError(_0x1664f6,null));};exports[_0xdb03('0x2b')]=function(_0x892b0e,_0x374383){return db[_0xdb03('0x30')]['find']({'where':{'id':_0x892b0e[_0xdb03('0x48')]['id']}})['then'](handleEntityNotFound(_0x374383,null))['then'](removeEntity(_0x374383,null))[_0xdb03('0x46')](handleError(_0x374383,null));};exports[_0xdb03('0x4e')]=function(_0x2d1820,_0x332dcb,_0xa88daa){var _0x15899c={};var _0x11fa5b={};var _0x30bb52;var _0x505b0e;return db[_0xdb03('0x30')]['findOne']({'where':{'id':_0x2d1820[_0xdb03('0x48')]['id']}})['then'](handleEntityNotFound(_0x332dcb,null))[_0xdb03('0x2a')](function(_0x36511c){if(_0x36511c){_0x30bb52=_0x36511c;_0x11fa5b[_0xdb03('0x33')]=_['keys'](db[_0xdb03('0x4f')][_0xdb03('0x31')]);_0x11fa5b[_0xdb03('0x34')]=_['keys'](_0x2d1820[_0xdb03('0x34')]);_0x11fa5b[_0xdb03('0x3c')]=_[_0xdb03('0x35')](_0x11fa5b['model'],_0x11fa5b[_0xdb03('0x34')]);_0x15899c['attributes']=_[_0xdb03('0x35')](_0x11fa5b[_0xdb03('0x33')],qs[_0xdb03('0x37')](_0x2d1820[_0xdb03('0x34')][_0xdb03('0x37')]));_0x15899c['attributes']=_0x15899c['attributes']['length']?_0x15899c[_0xdb03('0x36')]:_0x11fa5b[_0xdb03('0x33')];_0x15899c[_0xdb03('0x50')]=qs[_0xdb03('0x3b')](_0x2d1820['query'][_0xdb03('0x3b')]);_0x15899c['where']=qs[_0xdb03('0x3c')](_[_0xdb03('0x3d')](_0x2d1820[_0xdb03('0x34')],_0x11fa5b[_0xdb03('0x3c')]));if(_0x2d1820[_0xdb03('0x34')][_0xdb03('0x3e')]){_0x15899c[_0xdb03('0x3f')]=_[_0xdb03('0x40')](_0x15899c[_0xdb03('0x3f')],{'$or':_[_0xdb03('0x2f')](_0x15899c[_0xdb03('0x36')],function(_0x353b6e){var _0x3ae3db={};_0x3ae3db[_0x353b6e]={'$like':'%'+_0x2d1820[_0xdb03('0x34')][_0xdb03('0x3e')]+'%'};return _0x3ae3db;})});}_0x15899c=_[_0xdb03('0x40')]({},_0x15899c,_0x2d1820[_0xdb03('0x42')]);return _0x30bb52['getConfigurations'](_0x15899c);}})[_0xdb03('0x2a')](function(_0x1db492){if(_0x1db492){_0x505b0e=_0x1db492[_0xdb03('0x38')];if(!_0x2d1820[_0xdb03('0x34')][_0xdb03('0x39')]('nolimit')){_0x15899c['limit']=qs[_0xdb03('0x22')](_0x2d1820[_0xdb03('0x34')][_0xdb03('0x22')]);_0x15899c['offset']=qs['offset'](_0x2d1820[_0xdb03('0x34')]['offset']);}return _0x30bb52[_0xdb03('0x4e')](_0x15899c);}})[_0xdb03('0x2a')](function(_0x5d7833){if(_0x5d7833){return _0x5d7833?{'count':_0x505b0e,'rows':_0x5d7833}:null;}})['then'](respondWithResult(_0x332dcb,null))['catch'](handleError(_0x332dcb,null));};exports[_0xdb03('0x51')]=function(_0x27644e,_0x3cdcad,_0x195114){if(_0x27644e[_0xdb03('0x4d')]['id']){delete _0x27644e['body']['id'];}return db[_0xdb03('0x30')]['findOne']({'where':{'id':_0x27644e['params']['id']}})[_0xdb03('0x2a')](handleEntityNotFound(_0x3cdcad,null))[_0xdb03('0x2a')](function(_0x2332c1){if(_0x2332c1){_0x27644e[_0xdb03('0x4d')]['AccountId']=_0x2332c1['id'];_0x27644e[_0xdb03('0x4d')][_0xdb03('0x52')]=integrations['getSubjects'](_0x27644e['body'][_0xdb03('0x53')],_0x27644e[_0xdb03('0x4d')][_0xdb03('0x41')]);_0x27644e['body'][_0xdb03('0x54')]=integrations[_0xdb03('0x55')](_0x27644e[_0xdb03('0x4d')][_0xdb03('0x53')],_0x27644e['body'][_0xdb03('0x41')]);return db[_0xdb03('0x4f')]['create'](_0x27644e['body'],{'include':[{'model':db['SalesforceField'],'as':_0xdb03('0x52')},{'model':db[_0xdb03('0x56')],'as':_0xdb03('0x54')}]});}return null;})[_0xdb03('0x2a')](respondWithResult(_0x3cdcad,null))[_0xdb03('0x46')](handleError(_0x3cdcad,null));};exports[_0xdb03('0x57')]=function(_0x33efc7,_0x4c1276,_0x39c782){var _0x5a03a7;var _0x1b39be='';var _0x2f76a7='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0x33efc7[_0xdb03('0x48')]['id']},'attributes':['id',_0xdb03('0x58'),_0xdb03('0x59'),_0xdb03('0x5a'),'username',_0xdb03('0x5b'),_0xdb03('0x5c')]})[_0xdb03('0x2a')](handleEntityNotFound(_0x4c1276,null))[_0xdb03('0x2a')](function(_0x15d53c){if(_0x15d53c){_0x1b39be=_0x15d53c[_0xdb03('0x58')];var _0xaab3=_0x1b39be['slice'](-0x1);if(_0xaab3==='/'){_0x1b39be=_0x1b39be[_0xdb03('0x5d')](0x0,_0x1b39be['lastIndexOf'](_0xaab3));}_0x5a03a7=new jsforce[(_0xdb03('0x5e'))]({'oauth2':{'loginUrl':_0x1b39be,'clientId':_0x15d53c[_0xdb03('0x59')],'clientSecret':_0x15d53c[_0xdb03('0x5a')]}});return _0x5a03a7['login'](_0x15d53c[_0xdb03('0x5f')],_0x15d53c[_0xdb03('0x5b')]['concat'](_0x15d53c[_0xdb03('0x5c')]));}})[_0xdb03('0x2a')](function(_0x378c05){if(_0x378c05){if(!_[_0xdb03('0x60')](_0x33efc7[_0xdb03('0x34')][_0xdb03('0x61')])){_0x2f76a7=_0x33efc7[_0xdb03('0x34')][_0xdb03('0x61')];}return _0x5a03a7[_0xdb03('0x62')](_0x2f76a7)['describe']();}})['then'](function(_0x4d2045){var _0x27a400=['OwnerId','ActivityDate',_0xdb03('0x63'),_0xdb03('0x64'),_0xdb03('0x65'),'Description'];var _0x15e30d=['string',_0xdb03('0x66'),_0xdb03('0x67'),_0xdb03('0x68'),_0xdb03('0x69'),_0xdb03('0x6a'),_0xdb03('0x6b')];if(_0x4d2045){_[_0xdb03('0x6c')](_0x4d2045[_0xdb03('0x37')],function(_0x447855){return _0x27a400[_0xdb03('0x6d')](_0x447855[_0xdb03('0x2d')])||!_0x15e30d['includes'](_0x447855['type']);});return{'count':_0x4d2045[_0xdb03('0x37')][_0xdb03('0x38')],'rows':_[_0xdb03('0x2f')](_0x4d2045[_0xdb03('0x37')],function(_0x511eda){return{'id':_0x511eda[_0xdb03('0x2d')],'name':_0x511eda['label'],'custom':_0x511eda[_0xdb03('0x6e')],'options':_0x511eda[_0xdb03('0x6f')]['length']>0x0?_['map'](_0x511eda['picklistValues'],function(_0x1da1c6){return{'name':_0x1da1c6[_0xdb03('0x70')],'value':_0x1da1c6['value']};}):_0x511eda[_0xdb03('0x41')]==_0xdb03('0x68')?[{'name':_0xdb03('0x71'),'value':'true'},{'name':_0xdb03('0x72'),'value':_0xdb03('0x73')}]:[]};})};}})[_0xdb03('0x2a')](respondWithResult(_0x4c1276,null))[_0xdb03('0x46')](function(_0x4aab72){var _0x2f007d=_0x33efc7[_0xdb03('0x34')]['test']?0x1f4:_0x4aab72[_0xdb03('0x74')]||0x1f4;logger[_0xdb03('0x2c')]('getFields,\x20%s,\x20%s,\x20%s',_0xdb03('0x57'),_0x2f007d,JSON['stringify'](_0x4aab72));delete _0x4aab72[_0xdb03('0x2d')];if(_0x2f007d===0x191){_0x2f007d=0x190;}_0x4c1276[_0xdb03('0x1e')](_0x2f007d)[_0xdb03('0x75')](_0x33efc7[_0xdb03('0x34')]['test']?{'message':_0xdb03('0x76'),'statusCode':_0x4aab72[_0xdb03('0x74')]}:_0x4aab72);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a0c0484..f86a1a2 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 _0x2560=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x28e476,_0x16a454){var _0x202ae6=function(_0x1c1159){while(--_0x1c1159){_0x28e476['push'](_0x28e476['shift']());}};_0x202ae6(++_0x16a454);}(_0x2560,0x103));var _0x0256=function(_0x5e6543,_0x1801aa){_0x5e6543=_0x5e6543-0x0;var _0x3e917a=_0x2560[_0x5e6543];return _0x3e917a;};'use strict';var _=require(_0x0256('0x0'));var util=require('util');var logger=require(_0x0256('0x1'))('api');var moment=require(_0x0256('0x2'));var BPromise=require(_0x0256('0x3'));var rp=require(_0x0256('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0256('0x5'));var config=require(_0x0256('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0256('0x7'));module[_0x0256('0x8')]=function(_0x3b0348,_0x344cf1){return _0x3b0348[_0x0256('0x9')]('SalesforceAccount',attributes,{'tableName':_0x0256('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0183=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0183,0x1ef));var _0x3018=function(_0x206e59,_0x204450){_0x206e59=_0x206e59-0x0;var _0x5f0aef=_0x0183[_0x206e59];return _0x5f0aef;};'use strict';var _=require('lodash');var util=require(_0x3018('0x0'));var logger=require(_0x3018('0x1'))(_0x3018('0x2'));var moment=require(_0x3018('0x3'));var BPromise=require(_0x3018('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3018('0x5'));var rimraf=require(_0x3018('0x6'));var config=require(_0x3018('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x3018('0x8'));module[_0x3018('0x9')]=function(_0x10e0cc,_0x5b08c8){return _0x10e0cc['define'](_0x3018('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 19954af..e5fa13c 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 _0xcfc7=['SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5635d2,_0x53be9a){var _0x10a23c=function(_0xb6ae8a){while(--_0xb6ae8a){_0x5635d2['push'](_0x5635d2['shift']());}};_0x10a23c(++_0x53be9a);}(_0xcfc7,0x13d));var _0x7cfc=function(_0x14bd02,_0x22e541){_0x14bd02=_0x14bd02-0x0;var _0x57f252=_0xcfc7[_0x14bd02];return _0x57f252;};'use strict';var _=require('lodash');var util=require(_0x7cfc('0x0'));var moment=require(_0x7cfc('0x1'));var BPromise=require(_0x7cfc('0x2'));var rs=require(_0x7cfc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7cfc('0x4'))(_0x7cfc('0x5'));var config=require('../../config/environment');var jayson=require(_0x7cfc('0x6'));var client=jayson['client'][_0x7cfc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3871a9,_0x2b71a0,_0x45ed3b){return new BPromise(function(_0x582a02,_0x59632c){return client[_0x7cfc('0x8')](_0x3871a9,_0x45ed3b)['then'](function(_0x103642){logger[_0x7cfc('0x9')](_0x7cfc('0xa'),_0x2b71a0,_0x7cfc('0xb'));logger[_0x7cfc('0xc')](_0x7cfc('0xd'),_0x2b71a0,_0x7cfc('0xb'),JSON['stringify'](_0x103642));if(_0x103642[_0x7cfc('0xe')]){if(_0x103642[_0x7cfc('0xe')]['code']===0x1f4){logger[_0x7cfc('0xe')](_0x7cfc('0xa'),_0x2b71a0,_0x103642[_0x7cfc('0xe')][_0x7cfc('0xf')]);return _0x59632c(_0x103642[_0x7cfc('0xe')]['message']);}logger[_0x7cfc('0xe')](_0x7cfc('0xa'),_0x2b71a0,_0x103642[_0x7cfc('0xe')][_0x7cfc('0xf')]);return _0x582a02(_0x103642['error']['message']);}else{logger[_0x7cfc('0x9')](_0x7cfc('0xa'),_0x2b71a0,_0x7cfc('0xb'));_0x582a02(_0x103642[_0x7cfc('0x10')][_0x7cfc('0xf')]);}})[_0x7cfc('0x11')](function(_0x1eb04c){logger[_0x7cfc('0xe')](_0x7cfc('0xa'),_0x2b71a0,_0x1eb04c);_0x59632c(_0x1eb04c);});});}exports[_0x7cfc('0x12')]=function(_0x17d21a){var _0x592a42=this;return new Promise(function(_0xc0993f,_0x100d91){return db[_0x7cfc('0x13')][_0x7cfc('0x14')]({'raw':_0x17d21a['options']?_0x17d21a[_0x7cfc('0x15')][_0x7cfc('0x16')]===undefined?!![]:![]:!![],'where':_0x17d21a[_0x7cfc('0x15')]?_0x17d21a['options'][_0x7cfc('0x17')]||null:null,'attributes':_0x17d21a[_0x7cfc('0x15')]?_0x17d21a[_0x7cfc('0x15')][_0x7cfc('0x18')]||null:null,'limit':_0x17d21a[_0x7cfc('0x15')]?_0x17d21a['options'][_0x7cfc('0x19')]||null:null,'include':_0x17d21a[_0x7cfc('0x15')]?_0x17d21a[_0x7cfc('0x15')]['include']?_[_0x7cfc('0x1a')](_0x17d21a[_0x7cfc('0x15')]['include'],function(_0x3a57e4){return{'model':db[_0x3a57e4['model']],'as':_0x3a57e4['as'],'attributes':_0x3a57e4[_0x7cfc('0x18')],'include':_0x3a57e4[_0x7cfc('0x1b')]?_[_0x7cfc('0x1a')](_0x3a57e4[_0x7cfc('0x1b')],function(_0xb72fc8){return{'model':db[_0xb72fc8[_0x7cfc('0x1c')]],'as':_0xb72fc8['as'],'attributes':_0xb72fc8[_0x7cfc('0x18')],'include':_0xb72fc8[_0x7cfc('0x1b')]?_['map'](_0xb72fc8[_0x7cfc('0x1b')],function(_0x529401){return{'model':db[_0x529401[_0x7cfc('0x1c')]],'as':_0x529401['as'],'attributes':_0x529401['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cfc('0x1d')](function(_0x5a3e56){logger[_0x7cfc('0x9')](_0x7cfc('0x12'),_0x17d21a);logger['debug'](_0x7cfc('0x12'),_0x17d21a,JSON[_0x7cfc('0x1e')](_0x5a3e56));_0xc0993f(_0x5a3e56);})[_0x7cfc('0x11')](function(_0x30a600){logger['error'](_0x7cfc('0x12'),_0x30a600[_0x7cfc('0xf')],_0x17d21a);_0x100d91(_0x592a42[_0x7cfc('0xe')](0x1f4,_0x30a600[_0x7cfc('0xf')]));});});};exports[_0x7cfc('0x1f')]=function(_0x1e5e8a){var _0x371550=this;return new Promise(function(_0x28d10a,_0x4b14c4){return db['SalesforceAccount'][_0x7cfc('0x20')]({'raw':_0x1e5e8a[_0x7cfc('0x15')]?_0x1e5e8a['options'][_0x7cfc('0x16')]===undefined?!![]:![]:!![],'where':_0x1e5e8a['options']?_0x1e5e8a['options'][_0x7cfc('0x17')]||null:null,'attributes':_0x1e5e8a[_0x7cfc('0x15')]?_0x1e5e8a[_0x7cfc('0x15')][_0x7cfc('0x18')]||null:null,'include':_0x1e5e8a[_0x7cfc('0x15')]?_0x1e5e8a[_0x7cfc('0x15')][_0x7cfc('0x1b')]?_['map'](_0x1e5e8a[_0x7cfc('0x15')][_0x7cfc('0x1b')],function(_0x2fbd82){return{'model':db[_0x2fbd82['model']],'as':_0x2fbd82['as'],'attributes':_0x2fbd82[_0x7cfc('0x18')],'include':_0x2fbd82[_0x7cfc('0x1b')]?_[_0x7cfc('0x1a')](_0x2fbd82[_0x7cfc('0x1b')],function(_0x2b6fac){return{'model':db[_0x2b6fac[_0x7cfc('0x1c')]],'as':_0x2b6fac['as'],'attributes':_0x2b6fac['attributes'],'include':_0x2b6fac[_0x7cfc('0x1b')]?_['map'](_0x2b6fac[_0x7cfc('0x1b')],function(_0x2c3454){return{'model':db[_0x2c3454[_0x7cfc('0x1c')]],'as':_0x2c3454['as'],'attributes':_0x2c3454[_0x7cfc('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8d6c02){logger['info'](_0x7cfc('0x1f'),_0x1e5e8a);logger['debug'](_0x7cfc('0x1f'),_0x1e5e8a,JSON[_0x7cfc('0x1e')](_0x8d6c02));_0x28d10a(_0x8d6c02);})[_0x7cfc('0x11')](function(_0x417ccf){logger[_0x7cfc('0xe')](_0x7cfc('0x1f'),_0x417ccf[_0x7cfc('0xf')],_0x1e5e8a);_0x4b14c4(_0x371550[_0x7cfc('0xe')](0x1f4,_0x417ccf[_0x7cfc('0xf')]));});});}; \ No newline at end of file +var _0x90c0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','ShowSalesforceAccount','find','lodash','moment'];(function(_0x4ac9c7,_0x11e4e1){var _0xed1cb2=function(_0x427a36){while(--_0x427a36){_0x4ac9c7['push'](_0x4ac9c7['shift']());}};_0xed1cb2(++_0x11e4e1);}(_0x90c0,0xec));var _0x090c=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0x90c0[_0x460fd7];return _0x44d1c2;};'use strict';var _=require(_0x090c('0x0'));var util=require('util');var moment=require(_0x090c('0x1'));var BPromise=require(_0x090c('0x2'));var rs=require(_0x090c('0x3'));var fs=require('fs');var Redis=require(_0x090c('0x4'));var db=require(_0x090c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x090c('0x6'));var jayson=require(_0x090c('0x7'));var client=jayson['client'][_0x090c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x128a83,_0x5bf883,_0x3f8a32){return new BPromise(function(_0x1c6324,_0x15bdc1){return client[_0x090c('0x9')](_0x128a83,_0x3f8a32)[_0x090c('0xa')](function(_0x3aba14){logger[_0x090c('0xb')](_0x090c('0xc'),_0x5bf883,_0x090c('0xd'));logger[_0x090c('0xe')](_0x090c('0xf'),_0x5bf883,_0x090c('0xd'),JSON[_0x090c('0x10')](_0x3aba14));if(_0x3aba14[_0x090c('0x11')]){if(_0x3aba14[_0x090c('0x11')][_0x090c('0x12')]===0x1f4){logger[_0x090c('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x5bf883,_0x3aba14[_0x090c('0x11')][_0x090c('0x13')]);return _0x15bdc1(_0x3aba14['error'][_0x090c('0x13')]);}logger[_0x090c('0x11')](_0x090c('0xc'),_0x5bf883,_0x3aba14[_0x090c('0x11')][_0x090c('0x13')]);return _0x1c6324(_0x3aba14[_0x090c('0x11')]['message']);}else{logger[_0x090c('0xb')](_0x090c('0xc'),_0x5bf883,_0x090c('0xd'));_0x1c6324(_0x3aba14[_0x090c('0x14')][_0x090c('0x13')]);}})[_0x090c('0x15')](function(_0x535ab7){logger[_0x090c('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x5bf883,_0x535ab7);_0x15bdc1(_0x535ab7);});});}exports[_0x090c('0x16')]=function(_0x1f7643){var _0xd685ad=this;return new Promise(function(_0x22fcf3,_0x5e3ccb){return db[_0x090c('0x17')][_0x090c('0x18')]({'raw':_0x1f7643['options']?_0x1f7643[_0x090c('0x19')][_0x090c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f7643[_0x090c('0x19')]?_0x1f7643[_0x090c('0x19')]['where']||null:null,'attributes':_0x1f7643[_0x090c('0x19')]?_0x1f7643[_0x090c('0x19')][_0x090c('0x1b')]||null:null,'limit':_0x1f7643[_0x090c('0x19')]?_0x1f7643[_0x090c('0x19')][_0x090c('0x1c')]||null:null,'include':_0x1f7643[_0x090c('0x19')]?_0x1f7643[_0x090c('0x19')][_0x090c('0x1d')]?_['map'](_0x1f7643[_0x090c('0x19')][_0x090c('0x1d')],function(_0x24a4c2){return{'model':db[_0x24a4c2[_0x090c('0x1e')]],'as':_0x24a4c2['as'],'attributes':_0x24a4c2['attributes'],'include':_0x24a4c2[_0x090c('0x1d')]?_[_0x090c('0x1f')](_0x24a4c2['include'],function(_0x2cb905){return{'model':db[_0x2cb905['model']],'as':_0x2cb905['as'],'attributes':_0x2cb905[_0x090c('0x1b')],'include':_0x2cb905['include']?_['map'](_0x2cb905[_0x090c('0x1d')],function(_0x131b76){return{'model':db[_0x131b76[_0x090c('0x1e')]],'as':_0x131b76['as'],'attributes':_0x131b76[_0x090c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x090c('0xa')](function(_0x1732a5){logger[_0x090c('0xb')]('GetSalesforceAccount',_0x1f7643);logger['debug'](_0x090c('0x16'),_0x1f7643,JSON[_0x090c('0x10')](_0x1732a5));_0x22fcf3(_0x1732a5);})[_0x090c('0x15')](function(_0x181aa9){logger['error'](_0x090c('0x16'),_0x181aa9[_0x090c('0x13')],_0x1f7643);_0x5e3ccb(_0xd685ad['error'](0x1f4,_0x181aa9[_0x090c('0x13')]));});});};exports[_0x090c('0x20')]=function(_0x1ab4c1){var _0x34889a=this;return new Promise(function(_0x17db13,_0x396071){return db[_0x090c('0x17')][_0x090c('0x21')]({'raw':_0x1ab4c1[_0x090c('0x19')]?_0x1ab4c1[_0x090c('0x19')][_0x090c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ab4c1[_0x090c('0x19')]?_0x1ab4c1['options']['where']||null:null,'attributes':_0x1ab4c1[_0x090c('0x19')]?_0x1ab4c1['options'][_0x090c('0x1b')]||null:null,'include':_0x1ab4c1['options']?_0x1ab4c1['options'][_0x090c('0x1d')]?_[_0x090c('0x1f')](_0x1ab4c1[_0x090c('0x19')]['include'],function(_0x368ff0){return{'model':db[_0x368ff0['model']],'as':_0x368ff0['as'],'attributes':_0x368ff0[_0x090c('0x1b')],'include':_0x368ff0[_0x090c('0x1d')]?_[_0x090c('0x1f')](_0x368ff0['include'],function(_0x33da45){return{'model':db[_0x33da45[_0x090c('0x1e')]],'as':_0x33da45['as'],'attributes':_0x33da45[_0x090c('0x1b')],'include':_0x33da45[_0x090c('0x1d')]?_['map'](_0x33da45[_0x090c('0x1d')],function(_0x5bfe3d){return{'model':db[_0x5bfe3d[_0x090c('0x1e')]],'as':_0x5bfe3d['as'],'attributes':_0x5bfe3d[_0x090c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x090c('0xa')](function(_0x335743){logger[_0x090c('0xb')](_0x090c('0x20'),_0x1ab4c1);logger[_0x090c('0xe')](_0x090c('0x20'),_0x1ab4c1,JSON[_0x090c('0x10')](_0x335743));_0x17db13(_0x335743);})['catch'](function(_0x7154d3){logger[_0x090c('0x11')](_0x090c('0x20'),_0x7154d3[_0x090c('0x13')],_0x1ab4c1);_0x396071(_0x34889a[_0x090c('0x11')](0x1f4,_0x7154d3[_0x090c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 45dc891..5b93909 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x4a7488,_0xa02ba2){var _0x19f233=function(_0x2b8d9c){while(--_0x2b8d9c){_0x4a7488['push'](_0x4a7488['shift']());}};_0x19f233(++_0xa02ba2);}(_0x7a54,0x106));var _0x47a5=function(_0x3060a5,_0x4b58ba){_0x3060a5=_0x3060a5-0x0;var _0x5f451a=_0x7a54[_0x3060a5];return _0x5f451a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x17a8bc,_0x41f207){var _0x51c76a=function(_0x2e9ab2){while(--_0x2e9ab2){_0x17a8bc['push'](_0x17a8bc['shift']());}};_0x51c76a(++_0x41f207);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a45c0c9..ae7146f 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 _0xbde8=['STRING','Task','Case','contact','lead','account_contact_lead','account','contact_lead'];(function(_0x2d423b,_0x1e17d3){var _0x3c9912=function(_0x67e81c){while(--_0x67e81c){_0x2d423b['push'](_0x2d423b['shift']());}};_0x3c9912(++_0x1e17d3);}(_0xbde8,0xd9));var _0x8bde=function(_0x55291a,_0x814018){_0x55291a=_0x55291a-0x0;var _0x3c870c=_0xbde8[_0x55291a];return _0x3c870c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x8bde('0x0'),_0x8bde('0x1')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x8bde('0x2'),_0x8bde('0x3'),_0x8bde('0x4'),_0x8bde('0x5')),'defaultValue':_0x8bde('0x6')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x8bde('0x2'),'lead','account'),'defaultValue':_0x8bde('0x3')},'leadId':{'type':Sequelize[_0x8bde('0x7')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x8bde('0x7')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4c37=['STRING','ENUM','Task','Case','contact','account','contact_lead','lead','sequelize','exports'];(function(_0x189db9,_0x52aa36){var _0x6adbd9=function(_0x3df173){while(--_0x3df173){_0x189db9['push'](_0x189db9['shift']());}};_0x6adbd9(++_0x52aa36);}(_0x4c37,0x8a));var _0x74c3=function(_0x18a81b,_0x29083c){_0x18a81b=_0x18a81b-0x0;var _0x180fa9=_0x4c37[_0x18a81b];return _0x180fa9;};'use strict';var Sequelize=require(_0x74c3('0x0'));module[_0x74c3('0x1')]={'name':{'type':Sequelize[_0x74c3('0x2')]},'description':{'type':Sequelize[_0x74c3('0x2')]},'ticketType':{'type':Sequelize[_0x74c3('0x3')](_0x74c3('0x4'),_0x74c3('0x5')),'defaultValue':_0x74c3('0x4')},'moduleSearch':{'type':Sequelize[_0x74c3('0x3')]('contact_lead',_0x74c3('0x6'),'lead','account_contact_lead',_0x74c3('0x7')),'defaultValue':_0x74c3('0x8')},'moduleCreate':{'type':Sequelize[_0x74c3('0x3')]('nothing',_0x74c3('0x6'),_0x74c3('0x9'),_0x74c3('0x7')),'defaultValue':_0x74c3('0x9')},'leadId':{'type':Sequelize[_0x74c3('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x74c3('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x74c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0340a3b..f7b1dfc 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 _0x9567=['type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','length','options','find','create','params','body','findOne','merge','getFields','getSubjects','SalesforceField','getDescriptions','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where'];(function(_0x2e8dbc,_0x2f047d){var _0x458158=function(_0x447b93){while(--_0x447b93){_0x2e8dbc['push'](_0x2e8dbc['shift']());}};_0x458158(++_0x2f047d);}(_0x9567,0x67));var _0x7956=function(_0x215ac9,_0x545a51){_0x215ac9=_0x215ac9-0x0;var _0xa1878e=_0x9567[_0x215ac9];return _0xa1878e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7956('0x0'));var zipdir=require(_0x7956('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var Mustache=require('mustache');var util=require(_0x7956('0x4'));var path=require(_0x7956('0x5'));var sox=require(_0x7956('0x6'));var csv=require(_0x7956('0x7'));var ejs=require(_0x7956('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7956('0x9'));var squel=require(_0x7956('0xa'));var crypto=require(_0x7956('0xb'));var jsforce=require(_0x7956('0xc'));var deskjs=require(_0x7956('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7956('0xe'));var Redis=require(_0x7956('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7956('0x10'));var as=require(_0x7956('0x11'));var hardwareService=require(_0x7956('0x12'));var logger=require(_0x7956('0x13'))(_0x7956('0x14'));var utils=require(_0x7956('0x15'));var config=require(_0x7956('0x16'));var licenseUtil=require(_0x7956('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36e1fc,_0x3c461){_0x3c461=_0x3c461||0xcc;return function(_0x1da563){if(_0x1da563){return _0x36e1fc[_0x7956('0x18')](_0x3c461);}return _0x36e1fc[_0x7956('0x19')](_0x3c461)[_0x7956('0x1a')]();};}function respondWithResult(_0x2dbc85,_0x3639e1){_0x3639e1=_0x3639e1||0xc8;return function(_0x596b30){if(_0x596b30){return _0x2dbc85[_0x7956('0x19')](_0x3639e1)[_0x7956('0x1b')](_0x596b30);}};}function respondWithFilteredResult(_0x4ba6b4,_0x17f5e2){return function(_0x3adcab){if(_0x3adcab){var _0x4ab00c=typeof _0x17f5e2[_0x7956('0x1c')]==='undefined'&&typeof _0x17f5e2[_0x7956('0x1d')]===_0x7956('0x1e');var _0x1f7e8c=_0x3adcab[_0x7956('0x1f')];var _0x482b07=_0x4ab00c?0x0:_0x17f5e2[_0x7956('0x1c')];var _0x55ec8e=_0x4ab00c?_0x3adcab[_0x7956('0x1f')]:_0x17f5e2[_0x7956('0x1c')]+_0x17f5e2[_0x7956('0x1d')];var _0x58dea2;if(_0x55ec8e>=_0x1f7e8c){_0x55ec8e=_0x1f7e8c;_0x58dea2=0xc8;}else{_0x58dea2=0xce;}_0x4ba6b4[_0x7956('0x19')](_0x58dea2);return _0x4ba6b4[_0x7956('0x20')](_0x7956('0x21'),_0x482b07+'-'+_0x55ec8e+'/'+_0x1f7e8c)[_0x7956('0x1b')](_0x3adcab);}return null;};}function patchUpdates(_0x3f1cab){return function(_0x3bbb1c){try{jsonpatch[_0x7956('0x22')](_0x3bbb1c,_0x3f1cab,!![]);}catch(_0x551b11){return BPromise['reject'](_0x551b11);}return _0x3bbb1c[_0x7956('0x23')]();};}function saveUpdates(_0x517415,_0x35c80d){return function(_0x5bf970){if(_0x5bf970){return _0x5bf970[_0x7956('0x24')](_0x517415)[_0x7956('0x25')](function(_0x23cc22){return _0x23cc22;});}return null;};}function removeEntity(_0x542ec5,_0x525538){return function(_0x1f9237){if(_0x1f9237){return _0x1f9237[_0x7956('0x26')]()['then'](function(){_0x542ec5['status'](0xcc)[_0x7956('0x1a')]();});}};}function handleEntityNotFound(_0x21c316,_0x4e793e){return function(_0x1deedd){if(!_0x1deedd){_0x21c316['sendStatus'](0x194);}return _0x1deedd;};}function handleError(_0x2b49ad,_0x169668){_0x169668=_0x169668||0x1f4;return function(_0x219fca){logger['error'](_0x219fca[_0x7956('0x27')]);if(_0x219fca[_0x7956('0x28')]){delete _0x219fca['name'];}_0x2b49ad[_0x7956('0x19')](_0x169668)[_0x7956('0x29')](_0x219fca);};}exports[_0x7956('0x2a')]=function(_0x2892d2,_0x324f0d){var _0x52e7ac={},_0x395a90={},_0x28094d={'count':0x0,'rows':[]};var _0x59f205=_[_0x7956('0x2b')](db[_0x7956('0x2c')][_0x7956('0x2d')],function(_0x258943){return{'name':_0x258943[_0x7956('0x2e')],'type':_0x258943['type'][_0x7956('0x2f')]};});_0x395a90[_0x7956('0x30')]=_[_0x7956('0x2b')](_0x59f205,'name');_0x395a90[_0x7956('0x31')]=_[_0x7956('0x32')](_0x2892d2[_0x7956('0x31')]);_0x395a90[_0x7956('0x33')]=_[_0x7956('0x34')](_0x395a90[_0x7956('0x30')],_0x395a90['query']);_0x52e7ac[_0x7956('0x35')]=_[_0x7956('0x34')](_0x395a90[_0x7956('0x30')],qs[_0x7956('0x36')](_0x2892d2[_0x7956('0x31')]['fields']));_0x52e7ac['attributes']=_0x52e7ac[_0x7956('0x35')]['length']?_0x52e7ac[_0x7956('0x35')]:_0x395a90[_0x7956('0x30')];if(!_0x2892d2['query'][_0x7956('0x37')](_0x7956('0x38'))){_0x52e7ac[_0x7956('0x1d')]=qs['limit'](_0x2892d2[_0x7956('0x31')]['limit']);_0x52e7ac[_0x7956('0x1c')]=qs[_0x7956('0x1c')](_0x2892d2[_0x7956('0x31')][_0x7956('0x1c')]);}_0x52e7ac[_0x7956('0x39')]=qs[_0x7956('0x3a')](_0x2892d2['query']['sort']);_0x52e7ac['where']=qs[_0x7956('0x33')](_[_0x7956('0x3b')](_0x2892d2[_0x7956('0x31')],_0x395a90['filters']),_0x59f205);if(_0x2892d2[_0x7956('0x31')]['filter']){_0x52e7ac[_0x7956('0x3c')]=_['merge'](_0x52e7ac[_0x7956('0x3c')],{'$or':_[_0x7956('0x2b')](_0x59f205,function(_0x3baa21){if(_0x3baa21[_0x7956('0x3d')]!==_0x7956('0x3e')){var _0x6fbcd2={};_0x6fbcd2[_0x3baa21['name']]={'$like':'%'+_0x2892d2[_0x7956('0x31')][_0x7956('0x3f')]+'%'};return _0x6fbcd2;}})});}_0x52e7ac=_['merge']({},_0x52e7ac,_0x2892d2['options']);var _0x13e927={'where':_0x52e7ac[_0x7956('0x3c')]};return db['SalesforceConfiguration'][_0x7956('0x1f')](_0x13e927)[_0x7956('0x25')](function(_0x4955ab){_0x28094d[_0x7956('0x1f')]=_0x4955ab;if(_0x2892d2[_0x7956('0x31')][_0x7956('0x40')]){_0x52e7ac[_0x7956('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7956('0x42')](_0x52e7ac);})[_0x7956('0x25')](function(_0x48b2dd){_0x28094d[_0x7956('0x43')]=_0x48b2dd;return _0x28094d;})[_0x7956('0x25')](respondWithFilteredResult(_0x324f0d,_0x52e7ac))[_0x7956('0x44')](handleError(_0x324f0d,null));};exports[_0x7956('0x45')]=function(_0x2a9548,_0x4dac6a){var _0x49f014={'raw':![],'where':{'id':_0x2a9548['params']['id']}},_0x2edb31={};_0x2edb31[_0x7956('0x30')]=_[_0x7956('0x32')](db[_0x7956('0x2c')][_0x7956('0x2d')]);_0x2edb31['query']=_[_0x7956('0x32')](_0x2a9548[_0x7956('0x31')]);_0x2edb31[_0x7956('0x33')]=_['intersection'](_0x2edb31[_0x7956('0x30')],_0x2edb31['query']);_0x49f014['attributes']=_['intersection'](_0x2edb31[_0x7956('0x30')],qs[_0x7956('0x36')](_0x2a9548[_0x7956('0x31')][_0x7956('0x36')]));_0x49f014[_0x7956('0x35')]=_0x49f014['attributes'][_0x7956('0x46')]?_0x49f014[_0x7956('0x35')]:_0x2edb31[_0x7956('0x30')];if(_0x2a9548[_0x7956('0x31')][_0x7956('0x40')]){_0x49f014[_0x7956('0x41')]=[{'all':!![]}];}_0x49f014=_['merge']({},_0x49f014,_0x2a9548[_0x7956('0x47')]);return db[_0x7956('0x2c')][_0x7956('0x48')](_0x49f014)[_0x7956('0x25')](handleEntityNotFound(_0x4dac6a,null))[_0x7956('0x25')](respondWithResult(_0x4dac6a,null))['catch'](handleError(_0x4dac6a,null));};exports['create']=function(_0x98aafa,_0x306043){return db[_0x7956('0x2c')][_0x7956('0x49')](_0x98aafa['body'],{})[_0x7956('0x25')](respondWithResult(_0x306043,0xc9))[_0x7956('0x44')](handleError(_0x306043,null));};exports['update']=function(_0x469e53,_0x2c6e9a){if(_0x469e53['body']['id']){delete _0x469e53['body']['id'];}return db[_0x7956('0x2c')]['find']({'where':{'id':_0x469e53[_0x7956('0x4a')]['id']}})[_0x7956('0x25')](handleEntityNotFound(_0x2c6e9a,null))[_0x7956('0x25')](saveUpdates(_0x469e53[_0x7956('0x4b')],null))['then'](respondWithResult(_0x2c6e9a,null))[_0x7956('0x44')](handleError(_0x2c6e9a,null));};exports['destroy']=function(_0x7da5c8,_0x3cd647){return db['SalesforceConfiguration']['find']({'where':{'id':_0x7da5c8[_0x7956('0x4a')]['id']}})[_0x7956('0x25')](handleEntityNotFound(_0x3cd647,null))[_0x7956('0x25')](removeEntity(_0x3cd647,null))[_0x7956('0x44')](handleError(_0x3cd647,null));};exports['getFields']=function(_0x587575,_0x249a37,_0x548cbb){var _0x39e5c0={};var _0x534aed={};var _0x292e73;var _0x40ef00;return db['SalesforceConfiguration'][_0x7956('0x4c')]({'where':{'id':_0x587575[_0x7956('0x4a')]['id']}})[_0x7956('0x25')](handleEntityNotFound(_0x249a37,null))[_0x7956('0x25')](function(_0x335eac){if(_0x335eac){_0x292e73=_0x335eac;_0x534aed[_0x7956('0x30')]=_[_0x7956('0x32')](db['SalesforceField'][_0x7956('0x2d')]);_0x534aed[_0x7956('0x31')]=_[_0x7956('0x32')](_0x587575[_0x7956('0x31')]);_0x534aed['filters']=_['intersection'](_0x534aed[_0x7956('0x30')],_0x534aed[_0x7956('0x31')]);_0x39e5c0[_0x7956('0x35')]=_[_0x7956('0x34')](_0x534aed[_0x7956('0x30')],qs[_0x7956('0x36')](_0x587575[_0x7956('0x31')][_0x7956('0x36')]));_0x39e5c0[_0x7956('0x35')]=_0x39e5c0[_0x7956('0x35')][_0x7956('0x46')]?_0x39e5c0[_0x7956('0x35')]:_0x534aed[_0x7956('0x30')];_0x39e5c0[_0x7956('0x39')]=qs[_0x7956('0x3a')](_0x587575[_0x7956('0x31')]['sort']);_0x39e5c0[_0x7956('0x3c')]=qs[_0x7956('0x33')](_[_0x7956('0x3b')](_0x587575['query'],_0x534aed[_0x7956('0x33')]));if(_0x587575[_0x7956('0x31')]['filter']){_0x39e5c0[_0x7956('0x3c')]=_[_0x7956('0x4d')](_0x39e5c0[_0x7956('0x3c')],{'$or':_[_0x7956('0x2b')](_0x39e5c0[_0x7956('0x35')],function(_0x4fcdc3){var _0x1498db={};_0x1498db[_0x4fcdc3]={'$like':'%'+_0x587575[_0x7956('0x31')]['filter']+'%'};return _0x1498db;})});}_0x39e5c0=_[_0x7956('0x4d')]({},_0x39e5c0,_0x587575[_0x7956('0x47')]);return _0x292e73[_0x7956('0x4e')](_0x39e5c0);}})[_0x7956('0x25')](function(_0x105ae6){if(_0x105ae6){_0x40ef00=_0x105ae6[_0x7956('0x46')];if(!_0x587575[_0x7956('0x31')]['hasOwnProperty'](_0x7956('0x38'))){_0x39e5c0[_0x7956('0x1d')]=qs[_0x7956('0x1d')](_0x587575[_0x7956('0x31')][_0x7956('0x1d')]);_0x39e5c0[_0x7956('0x1c')]=qs[_0x7956('0x1c')](_0x587575['query'][_0x7956('0x1c')]);}return _0x292e73[_0x7956('0x4e')](_0x39e5c0);}})[_0x7956('0x25')](function(_0x1f91d5){if(_0x1f91d5){return _0x1f91d5?{'count':_0x40ef00,'rows':_0x1f91d5}:null;}})[_0x7956('0x25')](respondWithResult(_0x249a37,null))['catch'](handleError(_0x249a37,null));};exports[_0x7956('0x4f')]=function(_0xd614f8,_0x44c5f8,_0x1685f2){var _0x21cef4={};var _0x282f76={};var _0x592c34;var _0x546abb;return db[_0x7956('0x2c')][_0x7956('0x4c')]({'where':{'id':_0xd614f8['params']['id']}})[_0x7956('0x25')](handleEntityNotFound(_0x44c5f8,null))[_0x7956('0x25')](function(_0x4bc4eb){if(_0x4bc4eb){_0x592c34=_0x4bc4eb;_0x282f76[_0x7956('0x30')]=_[_0x7956('0x32')](db[_0x7956('0x50')][_0x7956('0x2d')]);_0x282f76['query']=_[_0x7956('0x32')](_0xd614f8[_0x7956('0x31')]);_0x282f76[_0x7956('0x33')]=_[_0x7956('0x34')](_0x282f76[_0x7956('0x30')],_0x282f76[_0x7956('0x31')]);_0x21cef4[_0x7956('0x35')]=_[_0x7956('0x34')](_0x282f76[_0x7956('0x30')],qs[_0x7956('0x36')](_0xd614f8[_0x7956('0x31')][_0x7956('0x36')]));_0x21cef4[_0x7956('0x35')]=_0x21cef4[_0x7956('0x35')][_0x7956('0x46')]?_0x21cef4[_0x7956('0x35')]:_0x282f76[_0x7956('0x30')];_0x21cef4[_0x7956('0x39')]=qs['sort'](_0xd614f8[_0x7956('0x31')]['sort']);_0x21cef4[_0x7956('0x3c')]=qs[_0x7956('0x33')](_[_0x7956('0x3b')](_0xd614f8[_0x7956('0x31')],_0x282f76[_0x7956('0x33')]));if(_0xd614f8[_0x7956('0x31')]['filter']){_0x21cef4[_0x7956('0x3c')]=_[_0x7956('0x4d')](_0x21cef4['where'],{'$or':_[_0x7956('0x2b')](_0x21cef4[_0x7956('0x35')],function(_0x78821f){var _0x24c286={};_0x24c286[_0x78821f]={'$like':'%'+_0xd614f8['query'][_0x7956('0x3f')]+'%'};return _0x24c286;})});}_0x21cef4=_[_0x7956('0x4d')]({},_0x21cef4,_0xd614f8[_0x7956('0x47')]);return _0x592c34[_0x7956('0x4f')](_0x21cef4);}})[_0x7956('0x25')](function(_0x388cca){if(_0x388cca){_0x546abb=_0x388cca['length'];if(!_0xd614f8['query']['hasOwnProperty'](_0x7956('0x38'))){_0x21cef4['limit']=qs[_0x7956('0x1d')](_0xd614f8[_0x7956('0x31')][_0x7956('0x1d')]);_0x21cef4[_0x7956('0x1c')]=qs[_0x7956('0x1c')](_0xd614f8['query'][_0x7956('0x1c')]);}return _0x592c34[_0x7956('0x4f')](_0x21cef4);}})['then'](function(_0xb303be){if(_0xb303be){return _0xb303be?{'count':_0x546abb,'rows':_0xb303be}:null;}})[_0x7956('0x25')](respondWithResult(_0x44c5f8,null))[_0x7956('0x44')](handleError(_0x44c5f8,null));};exports[_0x7956('0x51')]=function(_0x3d339b,_0x17fce5,_0x2fe176){var _0x4be1b2={};var _0x1185cb={};var _0x87e0a8;var _0x58082f;return db['SalesforceConfiguration'][_0x7956('0x4c')]({'where':{'id':_0x3d339b[_0x7956('0x4a')]['id']}})['then'](handleEntityNotFound(_0x17fce5,null))[_0x7956('0x25')](function(_0x118d5c){if(_0x118d5c){_0x87e0a8=_0x118d5c;_0x1185cb[_0x7956('0x30')]=_[_0x7956('0x32')](db[_0x7956('0x50')][_0x7956('0x2d')]);_0x1185cb['query']=_[_0x7956('0x32')](_0x3d339b[_0x7956('0x31')]);_0x1185cb[_0x7956('0x33')]=_[_0x7956('0x34')](_0x1185cb['model'],_0x1185cb['query']);_0x4be1b2[_0x7956('0x35')]=_[_0x7956('0x34')](_0x1185cb[_0x7956('0x30')],qs[_0x7956('0x36')](_0x3d339b[_0x7956('0x31')]['fields']));_0x4be1b2[_0x7956('0x35')]=_0x4be1b2['attributes']['length']?_0x4be1b2[_0x7956('0x35')]:_0x1185cb[_0x7956('0x30')];_0x4be1b2['order']=qs['sort'](_0x3d339b['query']['sort']);_0x4be1b2[_0x7956('0x3c')]=qs[_0x7956('0x33')](_[_0x7956('0x3b')](_0x3d339b[_0x7956('0x31')],_0x1185cb[_0x7956('0x33')]));if(_0x3d339b[_0x7956('0x31')][_0x7956('0x3f')]){_0x4be1b2[_0x7956('0x3c')]=_[_0x7956('0x4d')](_0x4be1b2['where'],{'$or':_[_0x7956('0x2b')](_0x4be1b2['attributes'],function(_0x21e545){var _0x3cef89={};_0x3cef89[_0x21e545]={'$like':'%'+_0x3d339b[_0x7956('0x31')][_0x7956('0x3f')]+'%'};return _0x3cef89;})});}_0x4be1b2=_['merge']({},_0x4be1b2,_0x3d339b[_0x7956('0x47')]);return _0x87e0a8[_0x7956('0x51')](_0x4be1b2);}})[_0x7956('0x25')](function(_0x28e5b5){if(_0x28e5b5){_0x58082f=_0x28e5b5['length'];if(!_0x3d339b[_0x7956('0x31')][_0x7956('0x37')]('nolimit')){_0x4be1b2['limit']=qs[_0x7956('0x1d')](_0x3d339b[_0x7956('0x31')]['limit']);_0x4be1b2[_0x7956('0x1c')]=qs[_0x7956('0x1c')](_0x3d339b[_0x7956('0x31')][_0x7956('0x1c')]);}return _0x87e0a8['getDescriptions'](_0x4be1b2);}})[_0x7956('0x25')](function(_0x7af7b7){if(_0x7af7b7){return _0x7af7b7?{'count':_0x58082f,'rows':_0x7af7b7}:null;}})[_0x7956('0x25')](respondWithResult(_0x17fce5,null))['catch'](handleError(_0x17fce5,null));}; \ No newline at end of file +var _0x6a2a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','name','map','SalesforceConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','update','find','getFields','findOne','order','sort','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2a90b2,_0x5a41f2){var _0x2a9c8f=function(_0x434add){while(--_0x434add){_0x2a90b2['push'](_0x2a90b2['shift']());}};_0x2a9c8f(++_0x5a41f2);}(_0x6a2a,0x1ee));var _0xa6a2=function(_0x76517f,_0x325017){_0x76517f=_0x76517f-0x0;var _0x43cc3a=_0x6a2a[_0x76517f];return _0x43cc3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6a2('0x0'));var zipdir=require(_0xa6a2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa6a2('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa6a2('0x3'));var path=require('path');var sox=require(_0xa6a2('0x4'));var csv=require(_0xa6a2('0x5'));var ejs=require(_0xa6a2('0x6'));var fs=require('fs');var fs_extra=require(_0xa6a2('0x7'));var _=require(_0xa6a2('0x8'));var squel=require('squel');var crypto=require(_0xa6a2('0x9'));var jsforce=require(_0xa6a2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa6a2('0x5'));var querystring=require('querystring');var Papa=require(_0xa6a2('0xb'));var Redis=require('ioredis');var authService=require(_0xa6a2('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6a2('0xd'));var logger=require(_0xa6a2('0xe'))(_0xa6a2('0xf'));var utils=require(_0xa6a2('0x10'));var config=require(_0xa6a2('0x11'));var licenseUtil=require(_0xa6a2('0x12'));var db=require(_0xa6a2('0x13'))['db'];function respondWithStatusCode(_0x18f468,_0x868b20){_0x868b20=_0x868b20||0xcc;return function(_0x57dc6b){if(_0x57dc6b){return _0x18f468[_0xa6a2('0x14')](_0x868b20);}return _0x18f468[_0xa6a2('0x15')](_0x868b20)['end']();};}function respondWithResult(_0x48e96a,_0x38a882){_0x38a882=_0x38a882||0xc8;return function(_0x57bfe8){if(_0x57bfe8){return _0x48e96a[_0xa6a2('0x15')](_0x38a882)[_0xa6a2('0x16')](_0x57bfe8);}};}function respondWithFilteredResult(_0x42f96f,_0x3de654){return function(_0x5aafbf){if(_0x5aafbf){var _0x583b26=typeof _0x3de654[_0xa6a2('0x17')]==='undefined'&&typeof _0x3de654[_0xa6a2('0x18')]===_0xa6a2('0x19');var _0x58efe6=_0x5aafbf[_0xa6a2('0x1a')];var _0x15f15e=_0x583b26?0x0:_0x3de654['offset'];var _0x4e7180=_0x583b26?_0x5aafbf['count']:_0x3de654[_0xa6a2('0x17')]+_0x3de654[_0xa6a2('0x18')];var _0x5c7d04;if(_0x4e7180>=_0x58efe6){_0x4e7180=_0x58efe6;_0x5c7d04=0xc8;}else{_0x5c7d04=0xce;}_0x42f96f[_0xa6a2('0x15')](_0x5c7d04);return _0x42f96f[_0xa6a2('0x1b')](_0xa6a2('0x1c'),_0x15f15e+'-'+_0x4e7180+'/'+_0x58efe6)['json'](_0x5aafbf);}return null;};}function patchUpdates(_0x19e266){return function(_0x520c0c){try{jsonpatch[_0xa6a2('0x1d')](_0x520c0c,_0x19e266,!![]);}catch(_0x42cd4b){return BPromise[_0xa6a2('0x1e')](_0x42cd4b);}return _0x520c0c[_0xa6a2('0x1f')]();};}function saveUpdates(_0x2679cf,_0x1ae26b){return function(_0x4b9f50){if(_0x4b9f50){return _0x4b9f50['update'](_0x2679cf)[_0xa6a2('0x20')](function(_0xd10d58){return _0xd10d58;});}return null;};}function removeEntity(_0x507d44,_0x26ede7){return function(_0x4446ac){if(_0x4446ac){return _0x4446ac['destroy']()[_0xa6a2('0x20')](function(){_0x507d44[_0xa6a2('0x15')](0xcc)[_0xa6a2('0x21')]();});}};}function handleEntityNotFound(_0x575aec,_0x597613){return function(_0xde7a82){if(!_0xde7a82){_0x575aec['sendStatus'](0x194);}return _0xde7a82;};}function handleError(_0x113c43,_0x446757){_0x446757=_0x446757||0x1f4;return function(_0x2bf5c6){logger['error'](_0x2bf5c6['stack']);if(_0x2bf5c6['name']){delete _0x2bf5c6[_0xa6a2('0x22')];}_0x113c43[_0xa6a2('0x15')](_0x446757)['send'](_0x2bf5c6);};}exports['index']=function(_0x327fac,_0x34b4ba){var _0x1544f7={},_0x42886b={},_0x1779be={'count':0x0,'rows':[]};var _0x5223bb=_[_0xa6a2('0x23')](db[_0xa6a2('0x24')]['rawAttributes'],function(_0x14b87d){return{'name':_0x14b87d[_0xa6a2('0x25')],'type':_0x14b87d[_0xa6a2('0x26')]['key']};});_0x42886b[_0xa6a2('0x27')]=_[_0xa6a2('0x23')](_0x5223bb,_0xa6a2('0x22'));_0x42886b[_0xa6a2('0x28')]=_[_0xa6a2('0x29')](_0x327fac[_0xa6a2('0x28')]);_0x42886b[_0xa6a2('0x2a')]=_[_0xa6a2('0x2b')](_0x42886b['model'],_0x42886b[_0xa6a2('0x28')]);_0x1544f7[_0xa6a2('0x2c')]=_[_0xa6a2('0x2b')](_0x42886b[_0xa6a2('0x27')],qs[_0xa6a2('0x2d')](_0x327fac['query'][_0xa6a2('0x2d')]));_0x1544f7[_0xa6a2('0x2c')]=_0x1544f7[_0xa6a2('0x2c')][_0xa6a2('0x2e')]?_0x1544f7[_0xa6a2('0x2c')]:_0x42886b[_0xa6a2('0x27')];if(!_0x327fac[_0xa6a2('0x28')][_0xa6a2('0x2f')](_0xa6a2('0x30'))){_0x1544f7[_0xa6a2('0x18')]=qs[_0xa6a2('0x18')](_0x327fac['query'][_0xa6a2('0x18')]);_0x1544f7['offset']=qs[_0xa6a2('0x17')](_0x327fac[_0xa6a2('0x28')][_0xa6a2('0x17')]);}_0x1544f7['order']=qs['sort'](_0x327fac[_0xa6a2('0x28')]['sort']);_0x1544f7[_0xa6a2('0x31')]=qs[_0xa6a2('0x2a')](_[_0xa6a2('0x32')](_0x327fac[_0xa6a2('0x28')],_0x42886b[_0xa6a2('0x2a')]),_0x5223bb);if(_0x327fac['query'][_0xa6a2('0x33')]){_0x1544f7['where']=_[_0xa6a2('0x34')](_0x1544f7[_0xa6a2('0x31')],{'$or':_['map'](_0x5223bb,function(_0x3f8dfa){if(_0x3f8dfa['type']!==_0xa6a2('0x35')){var _0x731e47={};_0x731e47[_0x3f8dfa[_0xa6a2('0x22')]]={'$like':'%'+_0x327fac[_0xa6a2('0x28')]['filter']+'%'};return _0x731e47;}})});}_0x1544f7=_['merge']({},_0x1544f7,_0x327fac[_0xa6a2('0x36')]);var _0x311877={'where':_0x1544f7[_0xa6a2('0x31')]};return db['SalesforceConfiguration']['count'](_0x311877)['then'](function(_0x1e99e0){_0x1779be[_0xa6a2('0x1a')]=_0x1e99e0;if(_0x327fac[_0xa6a2('0x28')][_0xa6a2('0x37')]){_0x1544f7[_0xa6a2('0x38')]=[{'all':!![]}];}return db[_0xa6a2('0x24')][_0xa6a2('0x39')](_0x1544f7);})[_0xa6a2('0x20')](function(_0x40b7af){_0x1779be['rows']=_0x40b7af;return _0x1779be;})[_0xa6a2('0x20')](respondWithFilteredResult(_0x34b4ba,_0x1544f7))[_0xa6a2('0x3a')](handleError(_0x34b4ba,null));};exports[_0xa6a2('0x3b')]=function(_0x3befbb,_0x440172){var _0x5756fd={'raw':![],'where':{'id':_0x3befbb[_0xa6a2('0x3c')]['id']}},_0x2dcbe7={};_0x2dcbe7['model']=_[_0xa6a2('0x29')](db['SalesforceConfiguration'][_0xa6a2('0x3d')]);_0x2dcbe7[_0xa6a2('0x28')]=_[_0xa6a2('0x29')](_0x3befbb[_0xa6a2('0x28')]);_0x2dcbe7[_0xa6a2('0x2a')]=_[_0xa6a2('0x2b')](_0x2dcbe7[_0xa6a2('0x27')],_0x2dcbe7[_0xa6a2('0x28')]);_0x5756fd[_0xa6a2('0x2c')]=_[_0xa6a2('0x2b')](_0x2dcbe7[_0xa6a2('0x27')],qs['fields'](_0x3befbb[_0xa6a2('0x28')][_0xa6a2('0x2d')]));_0x5756fd['attributes']=_0x5756fd['attributes'][_0xa6a2('0x2e')]?_0x5756fd['attributes']:_0x2dcbe7[_0xa6a2('0x27')];if(_0x3befbb[_0xa6a2('0x28')][_0xa6a2('0x37')]){_0x5756fd[_0xa6a2('0x38')]=[{'all':!![]}];}_0x5756fd=_[_0xa6a2('0x34')]({},_0x5756fd,_0x3befbb['options']);return db[_0xa6a2('0x24')]['find'](_0x5756fd)[_0xa6a2('0x20')](handleEntityNotFound(_0x440172,null))[_0xa6a2('0x20')](respondWithResult(_0x440172,null))[_0xa6a2('0x3a')](handleError(_0x440172,null));};exports['create']=function(_0x348ea2,_0x1310f2){return db[_0xa6a2('0x24')][_0xa6a2('0x3e')](_0x348ea2[_0xa6a2('0x3f')],{})[_0xa6a2('0x20')](respondWithResult(_0x1310f2,0xc9))[_0xa6a2('0x3a')](handleError(_0x1310f2,null));};exports[_0xa6a2('0x40')]=function(_0x4761bd,_0x500bce){if(_0x4761bd['body']['id']){delete _0x4761bd[_0xa6a2('0x3f')]['id'];}return db[_0xa6a2('0x24')][_0xa6a2('0x41')]({'where':{'id':_0x4761bd[_0xa6a2('0x3c')]['id']}})[_0xa6a2('0x20')](handleEntityNotFound(_0x500bce,null))[_0xa6a2('0x20')](saveUpdates(_0x4761bd[_0xa6a2('0x3f')],null))[_0xa6a2('0x20')](respondWithResult(_0x500bce,null))[_0xa6a2('0x3a')](handleError(_0x500bce,null));};exports['destroy']=function(_0x4cee90,_0x5cff70){return db[_0xa6a2('0x24')][_0xa6a2('0x41')]({'where':{'id':_0x4cee90[_0xa6a2('0x3c')]['id']}})[_0xa6a2('0x20')](handleEntityNotFound(_0x5cff70,null))['then'](removeEntity(_0x5cff70,null))[_0xa6a2('0x3a')](handleError(_0x5cff70,null));};exports[_0xa6a2('0x42')]=function(_0x186602,_0x1dcac8,_0xec711b){var _0x5e3830={};var _0x2d6202={};var _0x431d9d;var _0x8dc989;return db[_0xa6a2('0x24')][_0xa6a2('0x43')]({'where':{'id':_0x186602[_0xa6a2('0x3c')]['id']}})[_0xa6a2('0x20')](handleEntityNotFound(_0x1dcac8,null))[_0xa6a2('0x20')](function(_0x278d4b){if(_0x278d4b){_0x431d9d=_0x278d4b;_0x2d6202[_0xa6a2('0x27')]=_[_0xa6a2('0x29')](db['SalesforceField'][_0xa6a2('0x3d')]);_0x2d6202['query']=_[_0xa6a2('0x29')](_0x186602[_0xa6a2('0x28')]);_0x2d6202['filters']=_[_0xa6a2('0x2b')](_0x2d6202[_0xa6a2('0x27')],_0x2d6202[_0xa6a2('0x28')]);_0x5e3830[_0xa6a2('0x2c')]=_[_0xa6a2('0x2b')](_0x2d6202[_0xa6a2('0x27')],qs[_0xa6a2('0x2d')](_0x186602[_0xa6a2('0x28')]['fields']));_0x5e3830[_0xa6a2('0x2c')]=_0x5e3830[_0xa6a2('0x2c')]['length']?_0x5e3830[_0xa6a2('0x2c')]:_0x2d6202[_0xa6a2('0x27')];_0x5e3830[_0xa6a2('0x44')]=qs[_0xa6a2('0x45')](_0x186602[_0xa6a2('0x28')]['sort']);_0x5e3830[_0xa6a2('0x31')]=qs[_0xa6a2('0x2a')](_[_0xa6a2('0x32')](_0x186602[_0xa6a2('0x28')],_0x2d6202[_0xa6a2('0x2a')]));if(_0x186602[_0xa6a2('0x28')][_0xa6a2('0x33')]){_0x5e3830[_0xa6a2('0x31')]=_[_0xa6a2('0x34')](_0x5e3830['where'],{'$or':_[_0xa6a2('0x23')](_0x5e3830[_0xa6a2('0x2c')],function(_0x49a7d4){var _0x1a3973={};_0x1a3973[_0x49a7d4]={'$like':'%'+_0x186602['query']['filter']+'%'};return _0x1a3973;})});}_0x5e3830=_[_0xa6a2('0x34')]({},_0x5e3830,_0x186602[_0xa6a2('0x36')]);return _0x431d9d['getFields'](_0x5e3830);}})['then'](function(_0x270e23){if(_0x270e23){_0x8dc989=_0x270e23['length'];if(!_0x186602[_0xa6a2('0x28')][_0xa6a2('0x2f')]('nolimit')){_0x5e3830[_0xa6a2('0x18')]=qs['limit'](_0x186602['query']['limit']);_0x5e3830[_0xa6a2('0x17')]=qs[_0xa6a2('0x17')](_0x186602['query'][_0xa6a2('0x17')]);}return _0x431d9d[_0xa6a2('0x42')](_0x5e3830);}})['then'](function(_0x2d446a){if(_0x2d446a){return _0x2d446a?{'count':_0x8dc989,'rows':_0x2d446a}:null;}})[_0xa6a2('0x20')](respondWithResult(_0x1dcac8,null))['catch'](handleError(_0x1dcac8,null));};exports['getSubjects']=function(_0x35c608,_0x233661,_0xfd277f){var _0x180618={};var _0x595f6d={};var _0x962d8c;var _0x2a5be4;return db[_0xa6a2('0x24')][_0xa6a2('0x43')]({'where':{'id':_0x35c608[_0xa6a2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x233661,null))[_0xa6a2('0x20')](function(_0x77fa4c){if(_0x77fa4c){_0x962d8c=_0x77fa4c;_0x595f6d[_0xa6a2('0x27')]=_[_0xa6a2('0x29')](db[_0xa6a2('0x46')][_0xa6a2('0x3d')]);_0x595f6d[_0xa6a2('0x28')]=_[_0xa6a2('0x29')](_0x35c608['query']);_0x595f6d[_0xa6a2('0x2a')]=_['intersection'](_0x595f6d[_0xa6a2('0x27')],_0x595f6d[_0xa6a2('0x28')]);_0x180618[_0xa6a2('0x2c')]=_['intersection'](_0x595f6d[_0xa6a2('0x27')],qs[_0xa6a2('0x2d')](_0x35c608[_0xa6a2('0x28')][_0xa6a2('0x2d')]));_0x180618['attributes']=_0x180618[_0xa6a2('0x2c')]['length']?_0x180618['attributes']:_0x595f6d[_0xa6a2('0x27')];_0x180618[_0xa6a2('0x44')]=qs[_0xa6a2('0x45')](_0x35c608[_0xa6a2('0x28')][_0xa6a2('0x45')]);_0x180618[_0xa6a2('0x31')]=qs['filters'](_[_0xa6a2('0x32')](_0x35c608['query'],_0x595f6d['filters']));if(_0x35c608[_0xa6a2('0x28')]['filter']){_0x180618[_0xa6a2('0x31')]=_[_0xa6a2('0x34')](_0x180618[_0xa6a2('0x31')],{'$or':_[_0xa6a2('0x23')](_0x180618['attributes'],function(_0x13e9b6){var _0x6f20a3={};_0x6f20a3[_0x13e9b6]={'$like':'%'+_0x35c608[_0xa6a2('0x28')]['filter']+'%'};return _0x6f20a3;})});}_0x180618=_[_0xa6a2('0x34')]({},_0x180618,_0x35c608[_0xa6a2('0x36')]);return _0x962d8c[_0xa6a2('0x47')](_0x180618);}})[_0xa6a2('0x20')](function(_0x102cc8){if(_0x102cc8){_0x2a5be4=_0x102cc8['length'];if(!_0x35c608[_0xa6a2('0x28')][_0xa6a2('0x2f')](_0xa6a2('0x30'))){_0x180618['limit']=qs[_0xa6a2('0x18')](_0x35c608[_0xa6a2('0x28')]['limit']);_0x180618[_0xa6a2('0x17')]=qs[_0xa6a2('0x17')](_0x35c608[_0xa6a2('0x28')][_0xa6a2('0x17')]);}return _0x962d8c[_0xa6a2('0x47')](_0x180618);}})[_0xa6a2('0x20')](function(_0x4599a9){if(_0x4599a9){return _0x4599a9?{'count':_0x2a5be4,'rows':_0x4599a9}:null;}})[_0xa6a2('0x20')](respondWithResult(_0x233661,null))[_0xa6a2('0x3a')](handleError(_0x233661,null));};exports[_0xa6a2('0x48')]=function(_0x228172,_0x346b06,_0x45b673){var _0xa8ecc2={};var _0x4972fd={};var _0x352cb0;var _0x515fb0;return db[_0xa6a2('0x24')]['findOne']({'where':{'id':_0x228172[_0xa6a2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x346b06,null))['then'](function(_0x68dc6f){if(_0x68dc6f){_0x352cb0=_0x68dc6f;_0x4972fd[_0xa6a2('0x27')]=_['keys'](db[_0xa6a2('0x46')][_0xa6a2('0x3d')]);_0x4972fd[_0xa6a2('0x28')]=_[_0xa6a2('0x29')](_0x228172[_0xa6a2('0x28')]);_0x4972fd[_0xa6a2('0x2a')]=_[_0xa6a2('0x2b')](_0x4972fd[_0xa6a2('0x27')],_0x4972fd['query']);_0xa8ecc2['attributes']=_['intersection'](_0x4972fd[_0xa6a2('0x27')],qs[_0xa6a2('0x2d')](_0x228172[_0xa6a2('0x28')][_0xa6a2('0x2d')]));_0xa8ecc2['attributes']=_0xa8ecc2[_0xa6a2('0x2c')][_0xa6a2('0x2e')]?_0xa8ecc2[_0xa6a2('0x2c')]:_0x4972fd['model'];_0xa8ecc2[_0xa6a2('0x44')]=qs['sort'](_0x228172['query'][_0xa6a2('0x45')]);_0xa8ecc2['where']=qs[_0xa6a2('0x2a')](_['pick'](_0x228172[_0xa6a2('0x28')],_0x4972fd[_0xa6a2('0x2a')]));if(_0x228172[_0xa6a2('0x28')][_0xa6a2('0x33')]){_0xa8ecc2['where']=_['merge'](_0xa8ecc2[_0xa6a2('0x31')],{'$or':_[_0xa6a2('0x23')](_0xa8ecc2[_0xa6a2('0x2c')],function(_0x41843b){var _0x1988fa={};_0x1988fa[_0x41843b]={'$like':'%'+_0x228172['query'][_0xa6a2('0x33')]+'%'};return _0x1988fa;})});}_0xa8ecc2=_['merge']({},_0xa8ecc2,_0x228172[_0xa6a2('0x36')]);return _0x352cb0[_0xa6a2('0x48')](_0xa8ecc2);}})[_0xa6a2('0x20')](function(_0x503d9b){if(_0x503d9b){_0x515fb0=_0x503d9b[_0xa6a2('0x2e')];if(!_0x228172['query'][_0xa6a2('0x2f')](_0xa6a2('0x30'))){_0xa8ecc2['limit']=qs[_0xa6a2('0x18')](_0x228172[_0xa6a2('0x28')][_0xa6a2('0x18')]);_0xa8ecc2[_0xa6a2('0x17')]=qs[_0xa6a2('0x17')](_0x228172[_0xa6a2('0x28')][_0xa6a2('0x17')]);}return _0x352cb0['getDescriptions'](_0xa8ecc2);}})[_0xa6a2('0x20')](function(_0x5740e0){if(_0x5740e0){return _0x5740e0?{'count':_0x515fb0,'rows':_0x5740e0}:null;}})[_0xa6a2('0x20')](respondWithResult(_0x346b06,null))['catch'](handleError(_0x346b06,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e3b85f9..99b8147 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 _0xeead=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xeead,0x1f1));var _0xdeea=function(_0x166653,_0xe6d3b6){_0x166653=_0x166653-0x0;var _0x11bffc=_0xeead[_0x166653];return _0x11bffc;};'use strict';var _=require(_0xdeea('0x0'));var util=require(_0xdeea('0x1'));var logger=require(_0xdeea('0x2'))(_0xdeea('0x3'));var moment=require(_0xdeea('0x4'));var BPromise=require(_0xdeea('0x5'));var rp=require(_0xdeea('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdeea('0x7'));var config=require(_0xdeea('0x8'));var attributes=require(_0xdeea('0x9'));module[_0xdeea('0xa')]=function(_0x544ed4,_0x1f6590){return _0x544ed4[_0xdeea('0xb')](_0xdeea('0xc'),attributes,{'tableName':_0xdeea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3804=['request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','bluebird'];(function(_0x71143a,_0x3ae3b3){var _0x5c4153=function(_0x2e2613){while(--_0x2e2613){_0x71143a['push'](_0x71143a['shift']());}};_0x5c4153(++_0x3ae3b3);}(_0x3804,0x1d0));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4380('0x0'));var util=require(_0x4380('0x1'));var logger=require('../../config/logger')(_0x4380('0x2'));var moment=require('moment');var BPromise=require(_0x4380('0x3'));var rp=require(_0x4380('0x4'));var fs=require('fs');var path=require(_0x4380('0x5'));var rimraf=require(_0x4380('0x6'));var config=require('../../config/environment');var attributes=require(_0x4380('0x7'));module[_0x4380('0x8')]=function(_0x255c7d,_0x3440fd){return _0x255c7d[_0x4380('0x9')](_0x4380('0xa'),attributes,{'tableName':_0x4380('0xb'),'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 f9e7462..e9cf3d1 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 _0xb2d8=['http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x4e45a3,_0x5e1190){var _0x387cbf=function(_0x1675f3){while(--_0x1675f3){_0x4e45a3['push'](_0x4e45a3['shift']());}};_0x387cbf(++_0x5e1190);}(_0xb2d8,0x1a5));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b2d('0x0'));var util=require(_0x8b2d('0x1'));var moment=require(_0x8b2d('0x2'));var BPromise=require(_0x8b2d('0x3'));var rs=require(_0x8b2d('0x4'));var fs=require('fs');var Redis=require(_0x8b2d('0x5'));var db=require(_0x8b2d('0x6'))['db'];var utils=require(_0x8b2d('0x7'));var logger=require(_0x8b2d('0x8'))(_0x8b2d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8b2d('0xa')][_0x8b2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fc414,_0x3bd459,_0x1c0985){return new BPromise(function(_0x5bced7,_0x15fe7e){return client[_0x8b2d('0xc')](_0x3fc414,_0x1c0985)[_0x8b2d('0xd')](function(_0x54a9fb){logger[_0x8b2d('0xe')](_0x8b2d('0xf'),_0x3bd459,'request\x20sent');logger[_0x8b2d('0x10')](_0x8b2d('0x11'),_0x3bd459,_0x8b2d('0x12'),JSON['stringify'](_0x54a9fb));if(_0x54a9fb['error']){if(_0x54a9fb['error'][_0x8b2d('0x13')]===0x1f4){logger[_0x8b2d('0x14')](_0x8b2d('0xf'),_0x3bd459,_0x54a9fb['error'][_0x8b2d('0x15')]);return _0x15fe7e(_0x54a9fb[_0x8b2d('0x14')][_0x8b2d('0x15')]);}logger[_0x8b2d('0x14')](_0x8b2d('0xf'),_0x3bd459,_0x54a9fb[_0x8b2d('0x14')][_0x8b2d('0x15')]);return _0x5bced7(_0x54a9fb[_0x8b2d('0x14')][_0x8b2d('0x15')]);}else{logger['info'](_0x8b2d('0xf'),_0x3bd459,'request\x20sent');_0x5bced7(_0x54a9fb[_0x8b2d('0x16')][_0x8b2d('0x15')]);}})[_0x8b2d('0x17')](function(_0x3fe5f3){logger[_0x8b2d('0x14')](_0x8b2d('0xf'),_0x3bd459,_0x3fe5f3);_0x15fe7e(_0x3fe5f3);});});} \ No newline at end of file +var _0x7e30=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then'];(function(_0x458328,_0xeb676b){var _0xb4e4a3=function(_0x1fcfaf){while(--_0x1fcfaf){_0x458328['push'](_0x458328['shift']());}};_0xb4e4a3(++_0xeb676b);}(_0x7e30,0x197));var _0x07e3=function(_0x143c75,_0x1e76dc){_0x143c75=_0x143c75-0x0;var _0x3b5d75=_0x7e30[_0x143c75];return _0x3b5d75;};'use strict';var _=require(_0x07e3('0x0'));var util=require(_0x07e3('0x1'));var moment=require(_0x07e3('0x2'));var BPromise=require(_0x07e3('0x3'));var rs=require(_0x07e3('0x4'));var fs=require('fs');var Redis=require(_0x07e3('0x5'));var db=require(_0x07e3('0x6'))['db'];var utils=require(_0x07e3('0x7'));var logger=require('../../config/logger')(_0x07e3('0x8'));var config=require(_0x07e3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x07e3('0xa')][_0x07e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e3b08,_0x4d3200,_0x41d399){return new BPromise(function(_0x4b6139,_0x2dce13){return client['request'](_0x1e3b08,_0x41d399)[_0x07e3('0xc')](function(_0x4aa5d0){logger[_0x07e3('0xd')](_0x07e3('0xe'),_0x4d3200,_0x07e3('0xf'));logger['debug'](_0x07e3('0x10'),_0x4d3200,'request\x20sent',JSON[_0x07e3('0x11')](_0x4aa5d0));if(_0x4aa5d0[_0x07e3('0x12')]){if(_0x4aa5d0[_0x07e3('0x12')]['code']===0x1f4){logger[_0x07e3('0x12')](_0x07e3('0xe'),_0x4d3200,_0x4aa5d0[_0x07e3('0x12')][_0x07e3('0x13')]);return _0x2dce13(_0x4aa5d0[_0x07e3('0x12')]['message']);}logger[_0x07e3('0x12')](_0x07e3('0xe'),_0x4d3200,_0x4aa5d0[_0x07e3('0x12')][_0x07e3('0x13')]);return _0x4b6139(_0x4aa5d0[_0x07e3('0x12')]['message']);}else{logger[_0x07e3('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4d3200,_0x07e3('0xf'));_0x4b6139(_0x4aa5d0['result'][_0x07e3('0x13')]);}})['catch'](function(_0x1bf08e){logger['error'](_0x07e3('0xe'),_0x4d3200,_0x1bf08e);_0x2dce13(_0x1bf08e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 92328c0..85a8676 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 _0x773a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x4f5da2,_0x5203f3){var _0x3f401b=function(_0x4b6250){while(--_0x4b6250){_0x4f5da2['push'](_0x4f5da2['shift']());}};_0x3f401b(++_0x5203f3);}(_0x773a,0xe0));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa773('0x0'));var util=require(_0xa773('0x1'));var path=require(_0xa773('0x2'));var timeout=require(_0xa773('0x3'));var express=require(_0xa773('0x4'));var router=express[_0xa773('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa773('0x6'));var interaction=require(_0xa773('0x7'));var config=require('../../config/environment');var controller=require(_0xa773('0x8'));router[_0xa773('0x9')]('/',auth[_0xa773('0xa')](),controller[_0xa773('0xb')]);router[_0xa773('0x9')]('/:id',auth[_0xa773('0xa')](),controller[_0xa773('0xc')]);router[_0xa773('0xd')]('/',auth[_0xa773('0xa')](),controller[_0xa773('0xe')]);router[_0xa773('0xf')]('/:id',auth[_0xa773('0xa')](),controller[_0xa773('0x10')]);router[_0xa773('0x11')]('/:id',auth[_0xa773('0xa')](),controller[_0xa773('0x12')]);module[_0xa773('0x13')]=router; \ No newline at end of file +var _0x220f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','index','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x369113,_0x5ddf07){var _0x231031=function(_0x126c48){while(--_0x126c48){_0x369113['push'](_0x369113['shift']());}};_0x231031(++_0x5ddf07);}(_0x220f,0x12c));var _0xf220=function(_0x18bf74,_0x5abebe){_0x18bf74=_0x18bf74-0x0;var _0x4e8703=_0x220f[_0x18bf74];return _0x4e8703;};'use strict';var multer=require(_0xf220('0x0'));var util=require(_0xf220('0x1'));var path=require(_0xf220('0x2'));var timeout=require(_0xf220('0x3'));var express=require(_0xf220('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf220('0x5'));var interaction=require(_0xf220('0x6'));var config=require(_0xf220('0x7'));var controller=require(_0xf220('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf220('0x9')]);router[_0xf220('0xa')](_0xf220('0xb'),auth['isAuthenticated'](),controller[_0xf220('0xc')]);router[_0xf220('0xd')]('/',auth[_0xf220('0xe')](),controller[_0xf220('0xf')]);router['put'](_0xf220('0xb'),auth['isAuthenticated'](),controller[_0xf220('0x10')]);router[_0xf220('0x11')](_0xf220('0xb'),auth['isAuthenticated'](),controller[_0xf220('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5a356b0..e584980 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 _0xa8fb=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x5d7548,_0x5f54ad){var _0x4a92c1=function(_0xedb597){while(--_0xedb597){_0x5d7548['push'](_0x5d7548['shift']());}};_0x4a92c1(++_0x5f54ad);}(_0xa8fb,0xe0));var _0xba8f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa8fb[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xba8f('0x0'));module[_0xba8f('0x1')]={'type':{'type':Sequelize[_0xba8f('0x2')](_0xba8f('0x3'),'variable',_0xba8f('0x4'),_0xba8f('0x5'),'picklist'),'defaultValue':_0xba8f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xba8f('0x6')]},'keyType':{'type':Sequelize[_0xba8f('0x2')](_0xba8f('0x3'),_0xba8f('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xba8f('0x6')]}}; \ No newline at end of file +var _0xea2a=['STRING','variable','sequelize','ENUM','string','customVariable','keyValue','picklist'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xea2a,0x72));var _0xaea2=function(_0x185241,_0x453cd6){_0x185241=_0x185241-0x0;var _0x1fa6c3=_0xea2a[_0x185241];return _0x1fa6c3;};'use strict';var Sequelize=require(_0xaea2('0x0'));module['exports']={'type':{'type':Sequelize[_0xaea2('0x1')](_0xaea2('0x2'),'variable',_0xaea2('0x3'),_0xaea2('0x4'),_0xaea2('0x5')),'defaultValue':_0xaea2('0x2')},'content':{'type':Sequelize[_0xaea2('0x6')]},'key':{'type':Sequelize[_0xaea2('0x6')]},'keyType':{'type':Sequelize[_0xaea2('0x1')](_0xaea2('0x2'),_0xaea2('0x7'),_0xaea2('0x3'))},'keyContent':{'type':Sequelize[_0xaea2('0x6')]},'idField':{'type':Sequelize[_0xaea2('0x6')]},'variableName':{'type':Sequelize[_0xaea2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b6c8f99..0b88eb8 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 _0x92cd=['order','sort','where','pick','filter','merge','options','rows','catch','show','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x44baf6,_0x1ec6f9){var _0x3b5c15=function(_0xb27fe0){while(--_0xb27fe0){_0x44baf6['push'](_0x44baf6['shift']());}};_0x3b5c15(++_0x1ec6f9);}(_0x92cd,0xee));var _0xd92c=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x92cd[_0x5cb1af];return _0x8d7940;};'use strict';var emlformat=require(_0xd92c('0x0'));var rimraf=require(_0xd92c('0x1'));var zipdir=require(_0xd92c('0x2'));var jsonpatch=require(_0xd92c('0x3'));var rp=require(_0xd92c('0x4'));var moment=require('moment');var BPromise=require(_0xd92c('0x5'));var Mustache=require(_0xd92c('0x6'));var util=require(_0xd92c('0x7'));var path=require(_0xd92c('0x8'));var sox=require(_0xd92c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd92c('0xa'));var _=require(_0xd92c('0xb'));var squel=require(_0xd92c('0xc'));var crypto=require(_0xd92c('0xd'));var jsforce=require(_0xd92c('0xe'));var deskjs=require(_0xd92c('0xf'));var toCsv=require(_0xd92c('0x10'));var querystring=require(_0xd92c('0x11'));var Papa=require(_0xd92c('0x12'));var Redis=require(_0xd92c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd92c('0x14'));var as=require(_0xd92c('0x15'));var hardwareService=require(_0xd92c('0x16'));var logger=require(_0xd92c('0x17'))(_0xd92c('0x18'));var utils=require('../../config/utils');var config=require(_0xd92c('0x19'));var licenseUtil=require(_0xd92c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd52b23,_0x199ea0){_0x199ea0=_0x199ea0||0xcc;return function(_0x38d957){if(_0x38d957){return _0xd52b23[_0xd92c('0x1b')](_0x199ea0);}return _0xd52b23[_0xd92c('0x1c')](_0x199ea0)[_0xd92c('0x1d')]();};}function respondWithResult(_0x17cfe8,_0x1e96cc){_0x1e96cc=_0x1e96cc||0xc8;return function(_0x3dca56){if(_0x3dca56){return _0x17cfe8[_0xd92c('0x1c')](_0x1e96cc)[_0xd92c('0x1e')](_0x3dca56);}};}function respondWithFilteredResult(_0x4cd209,_0x1b32a0){return function(_0x453e59){if(_0x453e59){var _0x5a4918=typeof _0x1b32a0[_0xd92c('0x1f')]===_0xd92c('0x20')&&typeof _0x1b32a0[_0xd92c('0x21')]===_0xd92c('0x20');var _0x21c843=_0x453e59[_0xd92c('0x22')];var _0x1c5d2f=_0x5a4918?0x0:_0x1b32a0[_0xd92c('0x1f')];var _0x480aa3=_0x5a4918?_0x453e59[_0xd92c('0x22')]:_0x1b32a0[_0xd92c('0x1f')]+_0x1b32a0[_0xd92c('0x21')];var _0x30676c;if(_0x480aa3>=_0x21c843){_0x480aa3=_0x21c843;_0x30676c=0xc8;}else{_0x30676c=0xce;}_0x4cd209[_0xd92c('0x1c')](_0x30676c);return _0x4cd209[_0xd92c('0x23')](_0xd92c('0x24'),_0x1c5d2f+'-'+_0x480aa3+'/'+_0x21c843)[_0xd92c('0x1e')](_0x453e59);}return null;};}function patchUpdates(_0x5130dd){return function(_0x190fb8){try{jsonpatch[_0xd92c('0x25')](_0x190fb8,_0x5130dd,!![]);}catch(_0x2d7276){return BPromise[_0xd92c('0x26')](_0x2d7276);}return _0x190fb8['save']();};}function saveUpdates(_0x48cf70,_0x1b4064){return function(_0x2352cb){if(_0x2352cb){return _0x2352cb[_0xd92c('0x27')](_0x48cf70)['then'](function(_0xeeadfd){return _0xeeadfd;});}return null;};}function removeEntity(_0x3cf276,_0x52cd65){return function(_0x577a5c){if(_0x577a5c){return _0x577a5c['destroy']()[_0xd92c('0x28')](function(){_0x3cf276[_0xd92c('0x1c')](0xcc)[_0xd92c('0x1d')]();});}};}function handleEntityNotFound(_0xafcfbc,_0x439a56){return function(_0x2c47b2){if(!_0x2c47b2){_0xafcfbc[_0xd92c('0x1b')](0x194);}return _0x2c47b2;};}function handleError(_0x4e5a45,_0x1d13ad){_0x1d13ad=_0x1d13ad||0x1f4;return function(_0xc18d0a){logger[_0xd92c('0x29')](_0xc18d0a[_0xd92c('0x2a')]);if(_0xc18d0a[_0xd92c('0x2b')]){delete _0xc18d0a[_0xd92c('0x2b')];}_0x4e5a45[_0xd92c('0x1c')](_0x1d13ad)[_0xd92c('0x2c')](_0xc18d0a);};}exports[_0xd92c('0x2d')]=function(_0x6571a5,_0x5e9129){var _0x3c6e8e={},_0x34e87f={},_0x4bd5ec={'count':0x0,'rows':[]};var _0x4b2e7a=_[_0xd92c('0x2e')](db[_0xd92c('0x2f')][_0xd92c('0x30')],function(_0x59fc37){return{'name':_0x59fc37['fieldName'],'type':_0x59fc37[_0xd92c('0x31')]['key']};});_0x34e87f[_0xd92c('0x32')]=_['map'](_0x4b2e7a,_0xd92c('0x2b'));_0x34e87f[_0xd92c('0x33')]=_[_0xd92c('0x34')](_0x6571a5[_0xd92c('0x33')]);_0x34e87f[_0xd92c('0x35')]=_[_0xd92c('0x36')](_0x34e87f[_0xd92c('0x32')],_0x34e87f['query']);_0x3c6e8e[_0xd92c('0x37')]=_[_0xd92c('0x36')](_0x34e87f[_0xd92c('0x32')],qs[_0xd92c('0x38')](_0x6571a5['query'][_0xd92c('0x38')]));_0x3c6e8e['attributes']=_0x3c6e8e['attributes'][_0xd92c('0x39')]?_0x3c6e8e[_0xd92c('0x37')]:_0x34e87f[_0xd92c('0x32')];if(!_0x6571a5[_0xd92c('0x33')]['hasOwnProperty']('nolimit')){_0x3c6e8e['limit']=qs['limit'](_0x6571a5[_0xd92c('0x33')][_0xd92c('0x21')]);_0x3c6e8e[_0xd92c('0x1f')]=qs[_0xd92c('0x1f')](_0x6571a5[_0xd92c('0x33')][_0xd92c('0x1f')]);}_0x3c6e8e[_0xd92c('0x3a')]=qs[_0xd92c('0x3b')](_0x6571a5[_0xd92c('0x33')][_0xd92c('0x3b')]);_0x3c6e8e[_0xd92c('0x3c')]=qs[_0xd92c('0x35')](_[_0xd92c('0x3d')](_0x6571a5[_0xd92c('0x33')],_0x34e87f[_0xd92c('0x35')]),_0x4b2e7a);if(_0x6571a5['query'][_0xd92c('0x3e')]){_0x3c6e8e[_0xd92c('0x3c')]=_[_0xd92c('0x3f')](_0x3c6e8e['where'],{'$or':_[_0xd92c('0x2e')](_0x4b2e7a,function(_0x1f393a){if(_0x1f393a[_0xd92c('0x31')]!=='VIRTUAL'){var _0x265277={};_0x265277[_0x1f393a[_0xd92c('0x2b')]]={'$like':'%'+_0x6571a5[_0xd92c('0x33')][_0xd92c('0x3e')]+'%'};return _0x265277;}})});}_0x3c6e8e=_[_0xd92c('0x3f')]({},_0x3c6e8e,_0x6571a5[_0xd92c('0x40')]);var _0x3adf5a={'where':_0x3c6e8e['where']};return db[_0xd92c('0x2f')][_0xd92c('0x22')](_0x3adf5a)[_0xd92c('0x28')](function(_0x22e4f6){_0x4bd5ec[_0xd92c('0x22')]=_0x22e4f6;if(_0x6571a5[_0xd92c('0x33')]['includeAll']){_0x3c6e8e['include']=[{'all':!![]}];}return db[_0xd92c('0x2f')]['findAll'](_0x3c6e8e);})[_0xd92c('0x28')](function(_0x47f445){_0x4bd5ec[_0xd92c('0x41')]=_0x47f445;return _0x4bd5ec;})[_0xd92c('0x28')](respondWithFilteredResult(_0x5e9129,_0x3c6e8e))[_0xd92c('0x42')](handleError(_0x5e9129,null));};exports[_0xd92c('0x43')]=function(_0x567c94,_0x2cf136){var _0x2f0db6={'raw':!![],'where':{'id':_0x567c94[_0xd92c('0x44')]['id']}},_0x278be3={};_0x278be3[_0xd92c('0x32')]=_[_0xd92c('0x34')](db[_0xd92c('0x2f')][_0xd92c('0x30')]);_0x278be3['query']=_[_0xd92c('0x34')](_0x567c94[_0xd92c('0x33')]);_0x278be3[_0xd92c('0x35')]=_[_0xd92c('0x36')](_0x278be3[_0xd92c('0x32')],_0x278be3[_0xd92c('0x33')]);_0x2f0db6[_0xd92c('0x37')]=_[_0xd92c('0x36')](_0x278be3[_0xd92c('0x32')],qs[_0xd92c('0x38')](_0x567c94[_0xd92c('0x33')][_0xd92c('0x38')]));_0x2f0db6[_0xd92c('0x37')]=_0x2f0db6[_0xd92c('0x37')][_0xd92c('0x39')]?_0x2f0db6[_0xd92c('0x37')]:_0x278be3[_0xd92c('0x32')];if(_0x567c94[_0xd92c('0x33')]['includeAll']){_0x2f0db6[_0xd92c('0x45')]=[{'all':!![]}];}_0x2f0db6=_[_0xd92c('0x3f')]({},_0x2f0db6,_0x567c94[_0xd92c('0x40')]);return db[_0xd92c('0x2f')][_0xd92c('0x46')](_0x2f0db6)[_0xd92c('0x28')](handleEntityNotFound(_0x2cf136,null))[_0xd92c('0x28')](respondWithResult(_0x2cf136,null))[_0xd92c('0x42')](handleError(_0x2cf136,null));};exports['create']=function(_0x16232f,_0x397143){return db[_0xd92c('0x2f')][_0xd92c('0x47')](_0x16232f[_0xd92c('0x48')],{})[_0xd92c('0x28')](respondWithResult(_0x397143,0xc9))[_0xd92c('0x42')](handleError(_0x397143,null));};exports[_0xd92c('0x27')]=function(_0x14dec7,_0x642575){if(_0x14dec7['body']['id']){delete _0x14dec7[_0xd92c('0x48')]['id'];}return db[_0xd92c('0x2f')][_0xd92c('0x46')]({'where':{'id':_0x14dec7[_0xd92c('0x44')]['id']}})[_0xd92c('0x28')](handleEntityNotFound(_0x642575,null))[_0xd92c('0x28')](saveUpdates(_0x14dec7[_0xd92c('0x48')],null))[_0xd92c('0x28')](respondWithResult(_0x642575,null))[_0xd92c('0x42')](handleError(_0x642575,null));};exports[_0xd92c('0x49')]=function(_0x6e88a3,_0x4f9c44){return db[_0xd92c('0x2f')]['find']({'where':{'id':_0x6e88a3[_0xd92c('0x44')]['id']}})[_0xd92c('0x28')](handleEntityNotFound(_0x4f9c44,null))[_0xd92c('0x28')](removeEntity(_0x4f9c44,null))[_0xd92c('0x42')](handleError(_0x4f9c44,null));}; \ No newline at end of file +var _0xbddc=['undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceField','fieldName','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset'];(function(_0xfa326c,_0x5d2cfb){var _0x3dfb20=function(_0xe93a6e){while(--_0xe93a6e){_0xfa326c['push'](_0xfa326c['shift']());}};_0x3dfb20(++_0x5d2cfb);}(_0xbddc,0x14e));var _0xcbdd=function(_0x4b0b45,_0x4800db){_0x4b0b45=_0x4b0b45-0x0;var _0x5ac99c=_0xbddc[_0x4b0b45];return _0x5ac99c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcbdd('0x0'));var zipdir=require(_0xcbdd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbdd('0x2'));var moment=require(_0xcbdd('0x3'));var BPromise=require(_0xcbdd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbdd('0x5'));var ejs=require(_0xcbdd('0x6'));var fs=require('fs');var fs_extra=require(_0xcbdd('0x7'));var _=require(_0xcbdd('0x8'));var squel=require(_0xcbdd('0x9'));var crypto=require('crypto');var jsforce=require(_0xcbdd('0xa'));var deskjs=require(_0xcbdd('0xb'));var toCsv=require(_0xcbdd('0x5'));var querystring=require(_0xcbdd('0xc'));var Papa=require(_0xcbdd('0xd'));var Redis=require(_0xcbdd('0xe'));var authService=require(_0xcbdd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcbdd('0x10'));var hardwareService=require(_0xcbdd('0x11'));var logger=require(_0xcbdd('0x12'))(_0xcbdd('0x13'));var utils=require(_0xcbdd('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24c2e4,_0x2d290f){_0x2d290f=_0x2d290f||0xcc;return function(_0x40b5e8){if(_0x40b5e8){return _0x24c2e4[_0xcbdd('0x15')](_0x2d290f);}return _0x24c2e4[_0xcbdd('0x16')](_0x2d290f)[_0xcbdd('0x17')]();};}function respondWithResult(_0x2c9e02,_0x35716f){_0x35716f=_0x35716f||0xc8;return function(_0x342841){if(_0x342841){return _0x2c9e02['status'](_0x35716f)[_0xcbdd('0x18')](_0x342841);}};}function respondWithFilteredResult(_0x51653b,_0x28e4e9){return function(_0x570704){if(_0x570704){var _0x30e65a=typeof _0x28e4e9[_0xcbdd('0x19')]==='undefined'&&typeof _0x28e4e9['limit']===_0xcbdd('0x1a');var _0x20f456=_0x570704[_0xcbdd('0x1b')];var _0x449c9e=_0x30e65a?0x0:_0x28e4e9[_0xcbdd('0x19')];var _0x2ba87d=_0x30e65a?_0x570704['count']:_0x28e4e9[_0xcbdd('0x19')]+_0x28e4e9['limit'];var _0x370780;if(_0x2ba87d>=_0x20f456){_0x2ba87d=_0x20f456;_0x370780=0xc8;}else{_0x370780=0xce;}_0x51653b[_0xcbdd('0x16')](_0x370780);return _0x51653b[_0xcbdd('0x1c')]('Content-Range',_0x449c9e+'-'+_0x2ba87d+'/'+_0x20f456)[_0xcbdd('0x18')](_0x570704);}return null;};}function patchUpdates(_0x120e74){return function(_0x26ca56){try{jsonpatch[_0xcbdd('0x1d')](_0x26ca56,_0x120e74,!![]);}catch(_0x260874){return BPromise[_0xcbdd('0x1e')](_0x260874);}return _0x26ca56[_0xcbdd('0x1f')]();};}function saveUpdates(_0x20a10b,_0x1cb3b2){return function(_0x2f1594){if(_0x2f1594){return _0x2f1594[_0xcbdd('0x20')](_0x20a10b)[_0xcbdd('0x21')](function(_0x2cd753){return _0x2cd753;});}return null;};}function removeEntity(_0x43c073,_0x122d23){return function(_0x280735){if(_0x280735){return _0x280735[_0xcbdd('0x22')]()[_0xcbdd('0x21')](function(){_0x43c073[_0xcbdd('0x16')](0xcc)[_0xcbdd('0x17')]();});}};}function handleEntityNotFound(_0x47255b,_0x49294a){return function(_0x2e80b3){if(!_0x2e80b3){_0x47255b[_0xcbdd('0x15')](0x194);}return _0x2e80b3;};}function handleError(_0x45835c,_0x411307){_0x411307=_0x411307||0x1f4;return function(_0x554985){logger['error'](_0x554985[_0xcbdd('0x23')]);if(_0x554985[_0xcbdd('0x24')]){delete _0x554985[_0xcbdd('0x24')];}_0x45835c['status'](_0x411307)[_0xcbdd('0x25')](_0x554985);};}exports[_0xcbdd('0x26')]=function(_0x2fd0a5,_0x23e3b5){var _0x525969={},_0x10302a={},_0x59b1b8={'count':0x0,'rows':[]};var _0x1adea8=_[_0xcbdd('0x27')](db[_0xcbdd('0x28')]['rawAttributes'],function(_0x29eaef){return{'name':_0x29eaef[_0xcbdd('0x29')],'type':_0x29eaef[_0xcbdd('0x2a')][_0xcbdd('0x2b')]};});_0x10302a['model']=_[_0xcbdd('0x27')](_0x1adea8,_0xcbdd('0x24'));_0x10302a['query']=_['keys'](_0x2fd0a5['query']);_0x10302a[_0xcbdd('0x2c')]=_[_0xcbdd('0x2d')](_0x10302a[_0xcbdd('0x2e')],_0x10302a[_0xcbdd('0x2f')]);_0x525969[_0xcbdd('0x30')]=_[_0xcbdd('0x2d')](_0x10302a[_0xcbdd('0x2e')],qs['fields'](_0x2fd0a5[_0xcbdd('0x2f')][_0xcbdd('0x31')]));_0x525969[_0xcbdd('0x30')]=_0x525969[_0xcbdd('0x30')][_0xcbdd('0x32')]?_0x525969[_0xcbdd('0x30')]:_0x10302a[_0xcbdd('0x2e')];if(!_0x2fd0a5['query'][_0xcbdd('0x33')]('nolimit')){_0x525969['limit']=qs[_0xcbdd('0x34')](_0x2fd0a5[_0xcbdd('0x2f')][_0xcbdd('0x34')]);_0x525969[_0xcbdd('0x19')]=qs['offset'](_0x2fd0a5[_0xcbdd('0x2f')][_0xcbdd('0x19')]);}_0x525969[_0xcbdd('0x35')]=qs[_0xcbdd('0x36')](_0x2fd0a5[_0xcbdd('0x2f')][_0xcbdd('0x36')]);_0x525969['where']=qs[_0xcbdd('0x2c')](_[_0xcbdd('0x37')](_0x2fd0a5[_0xcbdd('0x2f')],_0x10302a[_0xcbdd('0x2c')]),_0x1adea8);if(_0x2fd0a5[_0xcbdd('0x2f')][_0xcbdd('0x38')]){_0x525969[_0xcbdd('0x39')]=_['merge'](_0x525969[_0xcbdd('0x39')],{'$or':_['map'](_0x1adea8,function(_0x4b3f28){if(_0x4b3f28[_0xcbdd('0x2a')]!==_0xcbdd('0x3a')){var _0x282946={};_0x282946[_0x4b3f28[_0xcbdd('0x24')]]={'$like':'%'+_0x2fd0a5[_0xcbdd('0x2f')]['filter']+'%'};return _0x282946;}})});}_0x525969=_[_0xcbdd('0x3b')]({},_0x525969,_0x2fd0a5[_0xcbdd('0x3c')]);var _0x388365={'where':_0x525969[_0xcbdd('0x39')]};return db[_0xcbdd('0x28')][_0xcbdd('0x1b')](_0x388365)[_0xcbdd('0x21')](function(_0x4f6901){_0x59b1b8[_0xcbdd('0x1b')]=_0x4f6901;if(_0x2fd0a5[_0xcbdd('0x2f')][_0xcbdd('0x3d')]){_0x525969[_0xcbdd('0x3e')]=[{'all':!![]}];}return db[_0xcbdd('0x28')][_0xcbdd('0x3f')](_0x525969);})[_0xcbdd('0x21')](function(_0x31f650){_0x59b1b8[_0xcbdd('0x40')]=_0x31f650;return _0x59b1b8;})[_0xcbdd('0x21')](respondWithFilteredResult(_0x23e3b5,_0x525969))[_0xcbdd('0x41')](handleError(_0x23e3b5,null));};exports[_0xcbdd('0x42')]=function(_0x1ddcae,_0x542278){var _0x4da228={'raw':!![],'where':{'id':_0x1ddcae['params']['id']}},_0x4cb80e={};_0x4cb80e['model']=_[_0xcbdd('0x43')](db['SalesforceField'][_0xcbdd('0x44')]);_0x4cb80e[_0xcbdd('0x2f')]=_[_0xcbdd('0x43')](_0x1ddcae[_0xcbdd('0x2f')]);_0x4cb80e[_0xcbdd('0x2c')]=_[_0xcbdd('0x2d')](_0x4cb80e[_0xcbdd('0x2e')],_0x4cb80e[_0xcbdd('0x2f')]);_0x4da228[_0xcbdd('0x30')]=_[_0xcbdd('0x2d')](_0x4cb80e[_0xcbdd('0x2e')],qs[_0xcbdd('0x31')](_0x1ddcae['query'][_0xcbdd('0x31')]));_0x4da228[_0xcbdd('0x30')]=_0x4da228[_0xcbdd('0x30')]['length']?_0x4da228[_0xcbdd('0x30')]:_0x4cb80e[_0xcbdd('0x2e')];if(_0x1ddcae['query'][_0xcbdd('0x3d')]){_0x4da228[_0xcbdd('0x3e')]=[{'all':!![]}];}_0x4da228=_[_0xcbdd('0x3b')]({},_0x4da228,_0x1ddcae[_0xcbdd('0x3c')]);return db[_0xcbdd('0x28')]['find'](_0x4da228)[_0xcbdd('0x21')](handleEntityNotFound(_0x542278,null))[_0xcbdd('0x21')](respondWithResult(_0x542278,null))['catch'](handleError(_0x542278,null));};exports[_0xcbdd('0x45')]=function(_0x227842,_0x505f6a){return db[_0xcbdd('0x28')]['create'](_0x227842[_0xcbdd('0x46')],{})[_0xcbdd('0x21')](respondWithResult(_0x505f6a,0xc9))['catch'](handleError(_0x505f6a,null));};exports[_0xcbdd('0x20')]=function(_0x472fd1,_0x364a27){if(_0x472fd1[_0xcbdd('0x46')]['id']){delete _0x472fd1['body']['id'];}return db[_0xcbdd('0x28')]['find']({'where':{'id':_0x472fd1[_0xcbdd('0x47')]['id']}})[_0xcbdd('0x21')](handleEntityNotFound(_0x364a27,null))[_0xcbdd('0x21')](saveUpdates(_0x472fd1[_0xcbdd('0x46')],null))[_0xcbdd('0x21')](respondWithResult(_0x364a27,null))[_0xcbdd('0x41')](handleError(_0x364a27,null));};exports[_0xcbdd('0x22')]=function(_0x1e7412,_0xaae4e9){return db['SalesforceField']['find']({'where':{'id':_0x1e7412['params']['id']}})[_0xcbdd('0x21')](handleEntityNotFound(_0xaae4e9,null))[_0xcbdd('0x21')](removeEntity(_0xaae4e9,null))['catch'](handleError(_0xaae4e9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9ab6cfe..4fb60a7 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 _0x8bec=['FieldId','lodash','util','api','moment','request-promise','rimraf','exports','SalesforceField','int_salesforce_fields','idField'];(function(_0x27a878,_0x18055d){var _0x38a863=function(_0x3a71c5){while(--_0x3a71c5){_0x27a878['push'](_0x27a878['shift']());}};_0x38a863(++_0x18055d);}(_0x8bec,0x9b));var _0xc8be=function(_0x3574f9,_0x155a8b){_0x3574f9=_0x3574f9-0x0;var _0x2a22f5=_0x8bec[_0x3574f9];return _0x2a22f5;};'use strict';var _=require(_0xc8be('0x0'));var util=require(_0xc8be('0x1'));var logger=require('../../config/logger')(_0xc8be('0x2'));var moment=require(_0xc8be('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8be('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xc8be('0x6')]=function(_0x4f7156,_0x374b81){return _0x4f7156['define'](_0xc8be('0x7'),attributes,{'tableName':_0xc8be('0x8'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xc8be('0x9'),_0xc8be('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17fe=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util'];(function(_0x23e02e,_0x4d26cb){var _0x2a6db8=function(_0x46e7af){while(--_0x46e7af){_0x23e02e['push'](_0x23e02e['shift']());}};_0x2a6db8(++_0x4d26cb);}(_0x17fe,0x124));var _0xe17f=function(_0x4a8d3b,_0x1abfb5){_0x4a8d3b=_0x4a8d3b-0x0;var _0x359883=_0x17fe[_0x4a8d3b];return _0x359883;};'use strict';var _=require(_0xe17f('0x0'));var util=require(_0xe17f('0x1'));var logger=require(_0xe17f('0x2'))(_0xe17f('0x3'));var moment=require(_0xe17f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe17f('0x5'));var rimraf=require(_0xe17f('0x6'));var config=require(_0xe17f('0x7'));var attributes=require(_0xe17f('0x8'));module[_0xe17f('0x9')]=function(_0x4ca9a7,_0xf4ac7c){return _0x4ca9a7['define'](_0xe17f('0xa'),attributes,{'tableName':_0xe17f('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xe17f('0xc'),_0xe17f('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 b2816b3..940a2e4 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 _0xe95f=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x32d73d,_0x49d59c){var _0x287b5f=function(_0x20081c){while(--_0x20081c){_0x32d73d['push'](_0x32d73d['shift']());}};_0x287b5f(++_0x49d59c);}(_0xe95f,0xf9));var _0xfe95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe95f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe95('0x0'));var util=require(_0xfe95('0x1'));var moment=require(_0xfe95('0x2'));var BPromise=require(_0xfe95('0x3'));var rs=require(_0xfe95('0x4'));var fs=require('fs');var Redis=require(_0xfe95('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe95('0x6'));var logger=require('../../config/logger')(_0xfe95('0x7'));var config=require(_0xfe95('0x8'));var jayson=require(_0xfe95('0x9'));var client=jayson['client'][_0xfe95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d4e9,_0x51d337,_0x13ca49){return new BPromise(function(_0x1f6ebb,_0x598961){return client[_0xfe95('0xb')](_0x10d4e9,_0x13ca49)['then'](function(_0x4887d3){logger[_0xfe95('0xc')](_0xfe95('0xd'),_0x51d337,_0xfe95('0xe'));logger[_0xfe95('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x51d337,_0xfe95('0xe'),JSON[_0xfe95('0x10')](_0x4887d3));if(_0x4887d3[_0xfe95('0x11')]){if(_0x4887d3[_0xfe95('0x11')][_0xfe95('0x12')]===0x1f4){logger['error'](_0xfe95('0xd'),_0x51d337,_0x4887d3['error']['message']);return _0x598961(_0x4887d3[_0xfe95('0x11')][_0xfe95('0x13')]);}logger[_0xfe95('0x11')](_0xfe95('0xd'),_0x51d337,_0x4887d3['error']['message']);return _0x1f6ebb(_0x4887d3[_0xfe95('0x11')]['message']);}else{logger[_0xfe95('0xc')](_0xfe95('0xd'),_0x51d337,_0xfe95('0xe'));_0x1f6ebb(_0x4887d3[_0xfe95('0x14')][_0xfe95('0x13')]);}})[_0xfe95('0x15')](function(_0x217bd0){logger[_0xfe95('0x11')](_0xfe95('0xd'),_0x51d337,_0x217bd0);_0x598961(_0x217bd0);});});} \ No newline at end of file +var _0xe267=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x202686,_0x5c3908){var _0x35ade5=function(_0x4b8ed0){while(--_0x4b8ed0){_0x202686['push'](_0x202686['shift']());}};_0x35ade5(++_0x5c3908);}(_0xe267,0x182));var _0x7e26=function(_0x382868,_0xb5acfd){_0x382868=_0x382868-0x0;var _0x43e191=_0xe267[_0x382868];return _0x43e191;};'use strict';var _=require(_0x7e26('0x0'));var util=require(_0x7e26('0x1'));var moment=require(_0x7e26('0x2'));var BPromise=require(_0x7e26('0x3'));var rs=require(_0x7e26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e26('0x5'))['db'];var utils=require(_0x7e26('0x6'));var logger=require(_0x7e26('0x7'))('rpc');var config=require(_0x7e26('0x8'));var jayson=require(_0x7e26('0x9'));var client=jayson[_0x7e26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3072b7,_0x1baf0e,_0x366ac9){return new BPromise(function(_0x2a72b9,_0x270f3e){return client[_0x7e26('0xb')](_0x3072b7,_0x366ac9)[_0x7e26('0xc')](function(_0xf46a76){logger['info'](_0x7e26('0xd'),_0x1baf0e,_0x7e26('0xe'));logger[_0x7e26('0xf')](_0x7e26('0x10'),_0x1baf0e,_0x7e26('0xe'),JSON[_0x7e26('0x11')](_0xf46a76));if(_0xf46a76[_0x7e26('0x12')]){if(_0xf46a76[_0x7e26('0x12')][_0x7e26('0x13')]===0x1f4){logger[_0x7e26('0x12')]('SalesforceField,\x20%s,\x20%s',_0x1baf0e,_0xf46a76['error'][_0x7e26('0x14')]);return _0x270f3e(_0xf46a76[_0x7e26('0x12')]['message']);}logger[_0x7e26('0x12')](_0x7e26('0xd'),_0x1baf0e,_0xf46a76['error'][_0x7e26('0x14')]);return _0x2a72b9(_0xf46a76[_0x7e26('0x12')]['message']);}else{logger[_0x7e26('0x15')](_0x7e26('0xd'),_0x1baf0e,_0x7e26('0xe'));_0x2a72b9(_0xf46a76['result'][_0x7e26('0x14')]);}})[_0x7e26('0x16')](function(_0x127c0e){logger[_0x7e26('0x12')](_0x7e26('0xd'),_0x1baf0e,_0x127c0e);_0x270f3e(_0x127c0e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9aa740f..5639521 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 _0x0f88=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2c94cb,_0x4badfd){var _0x16fa09=function(_0x50d952){while(--_0x50d952){_0x2c94cb['push'](_0x2c94cb['shift']());}};_0x16fa09(++_0x4badfd);}(_0x0f88,0x1d9));var _0x80f8=function(_0x31c133,_0x3075f7){_0x31c133=_0x31c133-0x0;var _0x596121=_0x0f88[_0x31c133];return _0x596121;};'use strict';var multer=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var path=require(_0x80f8('0x2'));var timeout=require(_0x80f8('0x3'));var express=require(_0x80f8('0x4'));var router=express[_0x80f8('0x5')]();var fs_extra=require(_0x80f8('0x6'));var auth=require(_0x80f8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x80f8('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x80f8('0x9')]('/',auth[_0x80f8('0xa')](),controller[_0x80f8('0xb')]);router[_0x80f8('0x9')](_0x80f8('0xc'),auth[_0x80f8('0xa')](),controller[_0x80f8('0xd')]);router[_0x80f8('0x9')](_0x80f8('0xe'),auth[_0x80f8('0xa')](),controller[_0x80f8('0xf')]);router[_0x80f8('0x9')](_0x80f8('0x10'),auth[_0x80f8('0xa')](),controller[_0x80f8('0x11')]);router[_0x80f8('0x12')]('/',auth[_0x80f8('0xa')](),controller[_0x80f8('0x13')]);router[_0x80f8('0x12')](_0x80f8('0xe'),auth['isAuthenticated'](),controller[_0x80f8('0x14')]);router[_0x80f8('0x15')](_0x80f8('0xc'),auth['isAuthenticated'](),controller[_0x80f8('0x16')]);router[_0x80f8('0x17')](_0x80f8('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5c13=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x211527,_0x4d7d65){var _0x5d3ccc=function(_0x486aad){while(--_0x486aad){_0x211527['push'](_0x211527['shift']());}};_0x5d3ccc(++_0x4d7d65);}(_0x5c13,0x1ef));var _0x35c1=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x5c13[_0x41bdd4];return _0x5c03a6;};'use strict';var multer=require('multer');var util=require(_0x35c1('0x0'));var path=require(_0x35c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x35c1('0x2'));var router=express[_0x35c1('0x3')]();var fs_extra=require(_0x35c1('0x4'));var auth=require(_0x35c1('0x5'));var interaction=require(_0x35c1('0x6'));var config=require('../../config/environment');var controller=require(_0x35c1('0x7'));router[_0x35c1('0x8')]('/',auth[_0x35c1('0x9')](),controller[_0x35c1('0xa')]);router['get']('/:id',auth[_0x35c1('0x9')](),controller['show']);router[_0x35c1('0x8')](_0x35c1('0xb'),auth[_0x35c1('0x9')](),controller[_0x35c1('0xc')]);router[_0x35c1('0x8')](_0x35c1('0xd'),auth[_0x35c1('0x9')](),controller[_0x35c1('0xe')]);router[_0x35c1('0xf')]('/',auth[_0x35c1('0x9')](),controller['create']);router[_0x35c1('0xf')](_0x35c1('0xb'),auth['isAuthenticated'](),controller[_0x35c1('0x10')]);router[_0x35c1('0x11')](_0x35c1('0x12'),auth[_0x35c1('0x9')](),controller['update']);router[_0x35c1('0x13')](_0x35c1('0x12'),auth[_0x35c1('0x9')](),controller[_0x35c1('0x14')]);module[_0x35c1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index eedfc77..d162464 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 _0xad58=['sequelize','STRING','remoteUri'];(function(_0x3e606f,_0x1a505b){var _0x37c231=function(_0x296aea){while(--_0x296aea){_0x3e606f['push'](_0x3e606f['shift']());}};_0x37c231(++_0x1a505b);}(_0xad58,0xa8));var _0x8ad5=function(_0x1720fa,_0xa61b09){_0x1720fa=_0x1720fa-0x0;var _0x3ed31a=_0xad58[_0x1720fa];return _0x3ed31a;};'use strict';var Sequelize=require(_0x8ad5('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ad5('0x1')]},'description':{'type':Sequelize[_0x8ad5('0x1')]},'username':{'type':Sequelize[_0x8ad5('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x8ad5('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8ad5('0x1')],'unique':_0x8ad5('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7b37=['sequelize','STRING'];(function(_0x2adcf2,_0x2e82ff){var _0x2ebeff=function(_0x3a8374){while(--_0x3a8374){_0x2adcf2['push'](_0x2adcf2['shift']());}};_0x2ebeff(++_0x2e82ff);}(_0x7b37,0x84));var _0x77b3=function(_0x366655,_0x4d032){_0x366655=_0x366655-0x0;var _0x11e076=_0x7b37[_0x366655];return _0x11e076;};'use strict';var Sequelize=require(_0x77b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x77b3('0x1')]},'description':{'type':Sequelize[_0x77b3('0x1')]},'username':{'type':Sequelize[_0x77b3('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x77b3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index f9abdf1..5385cac 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 _0xdf97=['pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','update','params','findOne','ServicenowConfiguration','order','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','incident_state','severity','category','made_sla','caused_by','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','description','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','forEach','ServiceNow\x20error:\x20','test','statusCode','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x5444f2,_0x5dce2a){var _0x5dfbd7=function(_0x289a02){while(--_0x289a02){_0x5444f2['push'](_0x5444f2['shift']());}};_0x5dfbd7(++_0x5dce2a);}(_0xdf97,0x1eb));var _0x7df9=function(_0x1c6f53,_0x424633){_0x1c6f53=_0x1c6f53-0x0;var _0x1f60dc=_0xdf97[_0x1c6f53];return _0x1f60dc;};'use strict';var emlformat=require(_0x7df9('0x0'));var rimraf=require(_0x7df9('0x1'));var zipdir=require(_0x7df9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7df9('0x3'));var moment=require(_0x7df9('0x4'));var BPromise=require(_0x7df9('0x5'));var Mustache=require('mustache');var util=require(_0x7df9('0x6'));var path=require('path');var sox=require(_0x7df9('0x7'));var csv=require(_0x7df9('0x8'));var ejs=require(_0x7df9('0x9'));var fs=require('fs');var fs_extra=require(_0x7df9('0xa'));var _=require(_0x7df9('0xb'));var squel=require(_0x7df9('0xc'));var crypto=require(_0x7df9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7df9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7df9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7df9('0x10'));var qs=require(_0x7df9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7df9('0x12'))('api');var utils=require(_0x7df9('0x13'));var config=require(_0x7df9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7df9('0x15'))['db'];var integrations=require(_0x7df9('0x16'));function respondWithStatusCode(_0x4c5df9,_0x37f127){_0x37f127=_0x37f127||0xcc;return function(_0x1cfc53){if(_0x1cfc53){return _0x4c5df9[_0x7df9('0x17')](_0x37f127);}return _0x4c5df9[_0x7df9('0x18')](_0x37f127)[_0x7df9('0x19')]();};}function respondWithResult(_0x731e2b,_0x2043ac){_0x2043ac=_0x2043ac||0xc8;return function(_0x49f11e){if(_0x49f11e){return _0x731e2b[_0x7df9('0x18')](_0x2043ac)[_0x7df9('0x1a')](_0x49f11e);}};}function respondWithFilteredResult(_0x37a13f,_0xacc38c){return function(_0x328d4c){if(_0x328d4c){var _0x4d9502=typeof _0xacc38c[_0x7df9('0x1b')]===_0x7df9('0x1c')&&typeof _0xacc38c['limit']===_0x7df9('0x1c');var _0x4ae05d=_0x328d4c['count'];var _0x26adf8=_0x4d9502?0x0:_0xacc38c['offset'];var _0x16dd7c=_0x4d9502?_0x328d4c[_0x7df9('0x1d')]:_0xacc38c['offset']+_0xacc38c[_0x7df9('0x1e')];var _0x21e158;if(_0x16dd7c>=_0x4ae05d){_0x16dd7c=_0x4ae05d;_0x21e158=0xc8;}else{_0x21e158=0xce;}_0x37a13f['status'](_0x21e158);return _0x37a13f[_0x7df9('0x1f')](_0x7df9('0x20'),_0x26adf8+'-'+_0x16dd7c+'/'+_0x4ae05d)['json'](_0x328d4c);}return null;};}function patchUpdates(_0x14d8bf){return function(_0x26f133){try{jsonpatch[_0x7df9('0x21')](_0x26f133,_0x14d8bf,!![]);}catch(_0x4a7e70){return BPromise['reject'](_0x4a7e70);}return _0x26f133[_0x7df9('0x22')]();};}function saveUpdates(_0x325c9a,_0x2ed408){return function(_0x5586d3){if(_0x5586d3){return _0x5586d3['update'](_0x325c9a)[_0x7df9('0x23')](function(_0x3e94cc){return _0x3e94cc;});}return null;};}function removeEntity(_0x11e623,_0x49b249){return function(_0x2e40c6){if(_0x2e40c6){return _0x2e40c6[_0x7df9('0x24')]()[_0x7df9('0x23')](function(){_0x11e623[_0x7df9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5641db,_0x462ff3){return function(_0x3f9452){if(!_0x3f9452){_0x5641db[_0x7df9('0x17')](0x194);}return _0x3f9452;};}function handleError(_0xdaf297,_0x427a33){_0x427a33=_0x427a33||0x1f4;return function(_0x4568b1){logger[_0x7df9('0x25')](_0x4568b1[_0x7df9('0x26')]);if(_0x4568b1[_0x7df9('0x27')]){delete _0x4568b1[_0x7df9('0x27')];}_0xdaf297['status'](_0x427a33)[_0x7df9('0x28')](_0x4568b1);};}exports[_0x7df9('0x29')]=function(_0x232b03,_0x1e3f9d){var _0x3b383b={},_0x19768d={},_0x57e7fe={'count':0x0,'rows':[]};var _0x2cea5d=_[_0x7df9('0x2a')](db[_0x7df9('0x2b')][_0x7df9('0x2c')],function(_0x26e128){return{'name':_0x26e128['fieldName'],'type':_0x26e128[_0x7df9('0x2d')][_0x7df9('0x2e')]};});_0x19768d['model']=_[_0x7df9('0x2a')](_0x2cea5d,_0x7df9('0x27'));_0x19768d[_0x7df9('0x2f')]=_['keys'](_0x232b03[_0x7df9('0x2f')]);_0x19768d[_0x7df9('0x30')]=_['intersection'](_0x19768d[_0x7df9('0x31')],_0x19768d[_0x7df9('0x2f')]);_0x3b383b[_0x7df9('0x32')]=_[_0x7df9('0x33')](_0x19768d[_0x7df9('0x31')],qs[_0x7df9('0x34')](_0x232b03['query'][_0x7df9('0x34')]));_0x3b383b[_0x7df9('0x32')]=_0x3b383b[_0x7df9('0x32')][_0x7df9('0x35')]?_0x3b383b[_0x7df9('0x32')]:_0x19768d[_0x7df9('0x31')];if(!_0x232b03[_0x7df9('0x2f')][_0x7df9('0x36')](_0x7df9('0x37'))){_0x3b383b[_0x7df9('0x1e')]=qs[_0x7df9('0x1e')](_0x232b03[_0x7df9('0x2f')][_0x7df9('0x1e')]);_0x3b383b[_0x7df9('0x1b')]=qs[_0x7df9('0x1b')](_0x232b03[_0x7df9('0x2f')][_0x7df9('0x1b')]);}_0x3b383b['order']=qs[_0x7df9('0x38')](_0x232b03[_0x7df9('0x2f')][_0x7df9('0x38')]);_0x3b383b[_0x7df9('0x39')]=qs['filters'](_[_0x7df9('0x3a')](_0x232b03[_0x7df9('0x2f')],_0x19768d['filters']),_0x2cea5d);if(_0x232b03[_0x7df9('0x2f')][_0x7df9('0x3b')]){_0x3b383b[_0x7df9('0x39')]=_[_0x7df9('0x3c')](_0x3b383b['where'],{'$or':_[_0x7df9('0x2a')](_0x2cea5d,function(_0x525b30){if(_0x525b30[_0x7df9('0x2d')]!==_0x7df9('0x3d')){var _0x5991a0={};_0x5991a0[_0x525b30[_0x7df9('0x27')]]={'$like':'%'+_0x232b03['query'][_0x7df9('0x3b')]+'%'};return _0x5991a0;}})});}_0x3b383b=_[_0x7df9('0x3c')]({},_0x3b383b,_0x232b03[_0x7df9('0x3e')]);var _0x5f2180={'where':_0x3b383b[_0x7df9('0x39')]};return db['ServicenowAccount'][_0x7df9('0x1d')](_0x5f2180)[_0x7df9('0x23')](function(_0x51c4db){_0x57e7fe[_0x7df9('0x1d')]=_0x51c4db;if(_0x232b03['query']['includeAll']){_0x3b383b[_0x7df9('0x3f')]=[{'all':!![]}];}return db[_0x7df9('0x2b')][_0x7df9('0x40')](_0x3b383b);})['then'](function(_0x3a5ed3){_0x57e7fe[_0x7df9('0x41')]=_0x3a5ed3;return _0x57e7fe;})[_0x7df9('0x23')](respondWithFilteredResult(_0x1e3f9d,_0x3b383b))[_0x7df9('0x42')](handleError(_0x1e3f9d,null));};exports[_0x7df9('0x43')]=function(_0x3dcd0,_0x589969){var _0x4d7f63={'raw':![],'where':{'id':_0x3dcd0['params']['id']}},_0x2b33c6={};_0x2b33c6[_0x7df9('0x31')]=_['keys'](db[_0x7df9('0x2b')][_0x7df9('0x2c')]);_0x2b33c6[_0x7df9('0x2f')]=_[_0x7df9('0x44')](_0x3dcd0[_0x7df9('0x2f')]);_0x2b33c6[_0x7df9('0x30')]=_[_0x7df9('0x33')](_0x2b33c6[_0x7df9('0x31')],_0x2b33c6['query']);_0x4d7f63[_0x7df9('0x32')]=_[_0x7df9('0x33')](_0x2b33c6[_0x7df9('0x31')],qs[_0x7df9('0x34')](_0x3dcd0[_0x7df9('0x2f')][_0x7df9('0x34')]));_0x4d7f63[_0x7df9('0x32')]=_0x4d7f63['attributes'][_0x7df9('0x35')]?_0x4d7f63[_0x7df9('0x32')]:_0x2b33c6[_0x7df9('0x31')];if(_0x3dcd0[_0x7df9('0x2f')][_0x7df9('0x45')]){_0x4d7f63[_0x7df9('0x3f')]=[{'all':!![]}];}_0x4d7f63=_[_0x7df9('0x3c')]({},_0x4d7f63,_0x3dcd0[_0x7df9('0x3e')]);return db[_0x7df9('0x2b')][_0x7df9('0x46')](_0x4d7f63)['then'](handleEntityNotFound(_0x589969,null))[_0x7df9('0x23')](respondWithResult(_0x589969,null))['catch'](handleError(_0x589969,null));};exports[_0x7df9('0x47')]=function(_0x165532,_0x2564b5){return db[_0x7df9('0x2b')]['create'](_0x165532[_0x7df9('0x48')],{})['then'](respondWithResult(_0x2564b5,0xc9))[_0x7df9('0x42')](handleError(_0x2564b5,null));};exports[_0x7df9('0x49')]=function(_0x550f53,_0x3369c9){if(_0x550f53['body']['id']){delete _0x550f53['body']['id'];}return db[_0x7df9('0x2b')]['find']({'where':{'id':_0x550f53['params']['id']}})[_0x7df9('0x23')](handleEntityNotFound(_0x3369c9,null))[_0x7df9('0x23')](saveUpdates(_0x550f53['body'],null))[_0x7df9('0x23')](respondWithResult(_0x3369c9,null))[_0x7df9('0x42')](handleError(_0x3369c9,null));};exports[_0x7df9('0x24')]=function(_0x2fb30d,_0x49417f){return db[_0x7df9('0x2b')][_0x7df9('0x46')]({'where':{'id':_0x2fb30d[_0x7df9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x49417f,null))['then'](removeEntity(_0x49417f,null))[_0x7df9('0x42')](handleError(_0x49417f,null));};exports['getConfigurations']=function(_0x5f3fe4,_0x152c6d,_0x23e7b1){var _0x48108b={};var _0x1b50e2={};var _0x1bfcfe;var _0x486e29;return db[_0x7df9('0x2b')][_0x7df9('0x4b')]({'where':{'id':_0x5f3fe4['params']['id']}})[_0x7df9('0x23')](handleEntityNotFound(_0x152c6d,null))[_0x7df9('0x23')](function(_0x5e56e9){if(_0x5e56e9){_0x1bfcfe=_0x5e56e9;_0x1b50e2[_0x7df9('0x31')]=_[_0x7df9('0x44')](db[_0x7df9('0x4c')][_0x7df9('0x2c')]);_0x1b50e2[_0x7df9('0x2f')]=_['keys'](_0x5f3fe4[_0x7df9('0x2f')]);_0x1b50e2['filters']=_[_0x7df9('0x33')](_0x1b50e2['model'],_0x1b50e2[_0x7df9('0x2f')]);_0x48108b[_0x7df9('0x32')]=_[_0x7df9('0x33')](_0x1b50e2[_0x7df9('0x31')],qs[_0x7df9('0x34')](_0x5f3fe4[_0x7df9('0x2f')]['fields']));_0x48108b['attributes']=_0x48108b[_0x7df9('0x32')][_0x7df9('0x35')]?_0x48108b[_0x7df9('0x32')]:_0x1b50e2[_0x7df9('0x31')];_0x48108b[_0x7df9('0x4d')]=qs[_0x7df9('0x38')](_0x5f3fe4[_0x7df9('0x2f')][_0x7df9('0x38')]);_0x48108b[_0x7df9('0x39')]=qs[_0x7df9('0x30')](_[_0x7df9('0x3a')](_0x5f3fe4[_0x7df9('0x2f')],_0x1b50e2[_0x7df9('0x30')]));if(_0x5f3fe4[_0x7df9('0x2f')][_0x7df9('0x3b')]){_0x48108b['where']=_[_0x7df9('0x3c')](_0x48108b['where'],{'$or':_[_0x7df9('0x2a')](_0x48108b[_0x7df9('0x32')],function(_0x481cb0){var _0x3b07e4={};_0x3b07e4[_0x481cb0]={'$like':'%'+_0x5f3fe4[_0x7df9('0x2f')][_0x7df9('0x3b')]+'%'};return _0x3b07e4;})});}_0x48108b=_['merge']({},_0x48108b,_0x5f3fe4['options']);return _0x1bfcfe[_0x7df9('0x4e')](_0x48108b);}})[_0x7df9('0x23')](function(_0x45d5f6){if(_0x45d5f6){_0x486e29=_0x45d5f6[_0x7df9('0x35')];if(!_0x5f3fe4[_0x7df9('0x2f')][_0x7df9('0x36')](_0x7df9('0x37'))){_0x48108b[_0x7df9('0x1e')]=qs[_0x7df9('0x1e')](_0x5f3fe4['query'][_0x7df9('0x1e')]);_0x48108b[_0x7df9('0x1b')]=qs[_0x7df9('0x1b')](_0x5f3fe4[_0x7df9('0x2f')][_0x7df9('0x1b')]);}return _0x1bfcfe[_0x7df9('0x4e')](_0x48108b);}})[_0x7df9('0x23')](function(_0x39f11a){if(_0x39f11a){return _0x39f11a?{'count':_0x486e29,'rows':_0x39f11a}:null;}})[_0x7df9('0x23')](respondWithResult(_0x152c6d,null))[_0x7df9('0x42')](handleError(_0x152c6d,null));};exports['addConfiguration']=function(_0x27d52b,_0x44a488,_0x5a272f){if(_0x27d52b[_0x7df9('0x48')]['id']){delete _0x27d52b['body']['id'];}return db[_0x7df9('0x2b')]['findOne']({'where':{'id':_0x27d52b[_0x7df9('0x4a')]['id']}})[_0x7df9('0x23')](handleEntityNotFound(_0x44a488,null))['then'](function(_0x5a5ae6){if(_0x5a5ae6){_0x27d52b[_0x7df9('0x48')][_0x7df9('0x4f')]=_0x5a5ae6['id'];_0x27d52b[_0x7df9('0x48')][_0x7df9('0x50')]=integrations['getSubjects'](_0x27d52b['body'][_0x7df9('0x51')],_0x27d52b[_0x7df9('0x48')][_0x7df9('0x2d')]);_0x27d52b[_0x7df9('0x48')][_0x7df9('0x52')]=integrations[_0x7df9('0x53')](_0x27d52b[_0x7df9('0x48')][_0x7df9('0x51')],_0x27d52b[_0x7df9('0x48')][_0x7df9('0x2d')]);return db[_0x7df9('0x4c')]['create'](_0x27d52b['body'],{'include':[{'model':db[_0x7df9('0x54')],'as':_0x7df9('0x50')},{'model':db[_0x7df9('0x54')],'as':_0x7df9('0x52')}]});}return null;})[_0x7df9('0x23')](respondWithResult(_0x44a488,null))['catch'](handleError(_0x44a488,null));};exports[_0x7df9('0x55')]=function(_0x148c71,_0x5738ae,_0x58186b){var _0x56de20=['made_sla',_0x7df9('0x56'),_0x7df9('0x57'),'subcategory','close_code','notify',_0x7df9('0x58'),_0x7df9('0x59'),_0x7df9('0x5a')];var _0x4b27e1=['parent',_0x7df9('0x5b'),_0x7df9('0x5c'),'watch_list','upon_reject',_0x7df9('0x5d'),_0x7df9('0x5e'),_0x7df9('0x56'),_0x7df9('0x5f'),_0x7df9('0x60'),_0x7df9('0x61'),_0x7df9('0x62'),'opened_by',_0x7df9('0x63'),'sys_created_on',_0x7df9('0x64'),_0x7df9('0x65'),_0x7df9('0x66'),_0x7df9('0x57'),_0x7df9('0x4d'),'calendar_stc',_0x7df9('0x67'),_0x7df9('0x68'),_0x7df9('0x69'),_0x7df9('0x6a'),_0x7df9('0x6b'),_0x7df9('0x6c'),_0x7df9('0x6d'),_0x7df9('0x6e'),_0x7df9('0x6f'),_0x7df9('0x70'),_0x7df9('0x71'),_0x7df9('0x72'),_0x7df9('0x73'),_0x7df9('0x74'),_0x7df9('0x75'),_0x7df9('0x76'),_0x7df9('0x77'),_0x7df9('0x78'),_0x7df9('0x79'),'approval_set',_0x7df9('0x7a'),_0x7df9('0x7b'),_0x7df9('0x7c'),_0x7df9('0x7d'),_0x7df9('0x7e'),_0x7df9('0x7f'),_0x7df9('0x80'),_0x7df9('0x81'),'business_stc','additional_assignee_list',_0x7df9('0x82'),'calendar_duration','notify',_0x7df9('0x83'),_0x7df9('0x84'),_0x7df9('0x85'),_0x7df9('0x86'),'parent_incident',_0x7df9('0x87'),_0x7df9('0x88'),_0x7df9('0x89'),_0x7df9('0x58'),_0x7df9('0x8a'),_0x7df9('0x8b'),'company',_0x7df9('0x8c'),_0x7df9('0x8d'),_0x7df9('0x8e'),'severity',_0x7df9('0x8f'),_0x7df9('0x90'),_0x7df9('0x91'),_0x7df9('0x92'),_0x7df9('0x93'),'sys_mod_count',_0x7df9('0x94'),_0x7df9('0x95'),_0x7df9('0x96'),_0x7df9('0x97'),'correlation_id',_0x7df9('0x98'),_0x7df9('0x5a')];var _0x165dd7='';var _0x12704a='';var _0x37d2e0=[];var _0x42c3e8='';var _0x452877='';var _0x12a59b=[];var _0x58e5ee='';var _0x495470='';var _0x5e4f1c={};var _0x34f793='';return db[_0x7df9('0x2b')][_0x7df9('0x4b')]({'where':{'id':_0x148c71[_0x7df9('0x4a')]['id']},'attributes':['id',_0x7df9('0x99'),_0x7df9('0x9a'),'email',_0x7df9('0x9b'),_0x7df9('0x9c')]})[_0x7df9('0x23')](handleEntityNotFound(_0x5738ae,null))[_0x7df9('0x23')](function(_0x1fdbd5){if(_0x1fdbd5){_0x34f793=_0x1fdbd5['remoteUri'];var _0x4a2af2=_0x34f793[_0x7df9('0x9d')](-0x1);if(_0x4a2af2==='/'){_0x34f793=_0x34f793[_0x7df9('0x9e')](0x0,_0x34f793[_0x7df9('0x9f')](_0x4a2af2));}_0x495470=util[_0x7df9('0xa0')](_0x7df9('0xa1'),_0x34f793);_0x58e5ee=util['format']('%s/api/now/table/',_0x34f793);_0x5e4f1c={'user':_0x1fdbd5[_0x7df9('0x99')],'pass':_0x1fdbd5[_0x7df9('0x9a')]};var _0x5ed8c9={'method':_0x7df9('0xa2'),'uri':_0x495470+'incident?sysparm_display_value=all','auth':_0x5e4f1c,'json':!![]};return rp(_0x5ed8c9);}})['then'](function(_0x2e81bb){if(_0x2e81bb[_0x7df9('0xa3')][_0x7df9('0x35')]>0x0){_0x165dd7=_0x2e81bb[_0x7df9('0xa3')];}console[_0x7df9('0xa4')](_0x7df9('0xa5'),_0x165dd7);_0x12a59b=[];_0x12704a=Object[_0x7df9('0xa6')]([],_0x165dd7);_[_0x7df9('0xa7')](_0x12704a,function(_0xbc442){return!_0x56de20[_0x7df9('0xa8')](_0xbc442[_0x7df9('0x27')]);});_0x12704a['forEach'](function(_0x450d82){var _0x35bb9a=createFieldObject(_0x58e5ee,_0x5e4f1c,_0x450d82[_0x7df9('0xa9')],_0x450d82[_0x7df9('0x27')],_0x450d82[_0x7df9('0xaa')],![]);_0x12a59b[_0x7df9('0xab')](_0x35bb9a);});return Promise[_0x7df9('0xac')](_0x12a59b);})[_0x7df9('0x23')](function(_0xffe119){_0x37d2e0=_0xffe119;_0x42c3e8=Object[_0x7df9('0xa6')]([],_0x165dd7);console[_0x7df9('0xa4')](_0x7df9('0xad'),_0x165dd7);_[_0x7df9('0xa7')](_0x42c3e8,function(_0x50404b){return _0x4b27e1[_0x7df9('0xa8')](_0x50404b[_0x7df9('0x27')]);});console[_0x7df9('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x42c3e8);_0x12a59b=[];_0x42c3e8[_0x7df9('0xae')](function(_0xf92980){var _0x5ca6b9=createFieldObject(_0x58e5ee,_0x5e4f1c,_0xf92980[_0x7df9('0xa9')],_0xf92980[_0x7df9('0x27')],_0xf92980['label'],!![]);_0x12a59b[_0x7df9('0xab')](_0x5ca6b9);});return Promise[_0x7df9('0xac')](_0x12a59b);})['then'](function(_0x1f8bc6){_0x452877=_0x1f8bc6;var _0x30e49a=_0x37d2e0['concat'](_0x452877);return{'count':_0x30e49a[_0x7df9('0x35')],'rows':_0x30e49a};})[_0x7df9('0x23')](respondWithResult(_0x5738ae,null))[_0x7df9('0x42')](function(_0x4839c7){console[_0x7df9('0xa4')](_0x7df9('0xaf')+_0x4839c7);var _0x607f46=_0x148c71['query'][_0x7df9('0xb0')]?0x1f4:_0x4839c7[_0x7df9('0xb1')]||0x1f4;logger['error'](_0x4839c7[_0x7df9('0x26')]);delete _0x4839c7['name'];if(_0x607f46===0x191){_0x607f46=0x190;}_0x5738ae[_0x7df9('0x18')](_0x607f46)[_0x7df9('0x28')](_0x148c71[_0x7df9('0x2f')][_0x7df9('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x4839c7['statusCode']}:_0x4839c7);});};function createFieldObject(_0x22579f,_0x3ad51a,_0x5262e7,_0x213b9a,_0x241360,_0x1c688c){return new Promise(function(_0x1d3353,_0x54ee2c){var _0x5845eb={'id':_0x213b9a,'name':_0x241360,'custom':_0x1c688c};if(_0x5262e7===_0x7df9('0xb2')){_0x5845eb[_0x7df9('0x3e')]=[{'name':'True','value':'true'},{'name':_0x7df9('0xb3'),'value':_0x7df9('0xb4')}];_0x1d3353(_0x5845eb);}else{var _0x4e7afb={'method':_0x7df9('0xa2'),'uri':_0x22579f+_0x7df9('0xb5')+_0x213b9a,'auth':_0x3ad51a,'json':!![]};return rp(_0x4e7afb)[_0x7df9('0x23')](function(_0xc7ad0){var _0x73896c=[];if(_0xc7ad0[_0x7df9('0xa3')]['length']>0x0){_0xc7ad0[_0x7df9('0xa3')][_0x7df9('0xae')](function(_0xb8ed54){if(_0xb8ed54['inactive']==='false'){var _0x42271b={'name':_0xb8ed54[_0x7df9('0xaa')],'value':_0xb8ed54[_0x7df9('0xb6')]};_0x73896c[_0x7df9('0xab')](_0x42271b);}});}_0x5845eb['options']=_0x73896c;if(_0x5845eb['options']['length']>0x0){_0x1d3353(_0x5845eb);}else{if(_0x1c688c==![]){_0x1d3353();}else{_0x1d3353(_0x5845eb);}}});}});} \ No newline at end of file +var _0x54f3=['watch_list','sys_updated_on','child_incidents','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','follow_up','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','log','ServiceNow\x20error:\x20','statusCode','test','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','rows','catch','show','params','keys','length','include','create','body','find','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla','subcategory','notify','severity','category','parent','caused_by'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54f3,0x1d4));var _0x354f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x54f3[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x354f('0x0'));var rimraf=require(_0x354f('0x1'));var zipdir=require(_0x354f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x354f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x354f('0x4'));var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require(_0x354f('0x8'));var fs=require('fs');var fs_extra=require(_0x354f('0x9'));var _=require(_0x354f('0xa'));var squel=require(_0x354f('0xb'));var crypto=require(_0x354f('0xc'));var jsforce=require(_0x354f('0xd'));var deskjs=require(_0x354f('0xe'));var toCsv=require(_0x354f('0xf'));var querystring=require(_0x354f('0x10'));var Papa=require(_0x354f('0x11'));var Redis=require(_0x354f('0x12'));var authService=require(_0x354f('0x13'));var qs=require(_0x354f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x354f('0x15'));var utils=require('../../config/utils');var config=require(_0x354f('0x16'));var licenseUtil=require(_0x354f('0x17'));var db=require(_0x354f('0x18'))['db'];var integrations=require(_0x354f('0x19'));function respondWithStatusCode(_0x34c024,_0x180f72){_0x180f72=_0x180f72||0xcc;return function(_0x562b69){if(_0x562b69){return _0x34c024[_0x354f('0x1a')](_0x180f72);}return _0x34c024[_0x354f('0x1b')](_0x180f72)[_0x354f('0x1c')]();};}function respondWithResult(_0x5cd02a,_0x36b5fa){_0x36b5fa=_0x36b5fa||0xc8;return function(_0x4da5c4){if(_0x4da5c4){return _0x5cd02a[_0x354f('0x1b')](_0x36b5fa)[_0x354f('0x1d')](_0x4da5c4);}};}function respondWithFilteredResult(_0x2307a5,_0x464f87){return function(_0x3151f7){if(_0x3151f7){var _0x493794=typeof _0x464f87[_0x354f('0x1e')]===_0x354f('0x1f')&&typeof _0x464f87[_0x354f('0x20')]===_0x354f('0x1f');var _0x296e03=_0x3151f7[_0x354f('0x21')];var _0x17b932=_0x493794?0x0:_0x464f87[_0x354f('0x1e')];var _0x3f0d6d=_0x493794?_0x3151f7['count']:_0x464f87[_0x354f('0x1e')]+_0x464f87[_0x354f('0x20')];var _0x19ba4e;if(_0x3f0d6d>=_0x296e03){_0x3f0d6d=_0x296e03;_0x19ba4e=0xc8;}else{_0x19ba4e=0xce;}_0x2307a5[_0x354f('0x1b')](_0x19ba4e);return _0x2307a5[_0x354f('0x22')](_0x354f('0x23'),_0x17b932+'-'+_0x3f0d6d+'/'+_0x296e03)[_0x354f('0x1d')](_0x3151f7);}return null;};}function patchUpdates(_0x4ff9c5){return function(_0x275bd3){try{jsonpatch[_0x354f('0x24')](_0x275bd3,_0x4ff9c5,!![]);}catch(_0x4533fb){return BPromise[_0x354f('0x25')](_0x4533fb);}return _0x275bd3['save']();};}function saveUpdates(_0x310fe7,_0x393de6){return function(_0x3f3158){if(_0x3f3158){return _0x3f3158[_0x354f('0x26')](_0x310fe7)[_0x354f('0x27')](function(_0x18f882){return _0x18f882;});}return null;};}function removeEntity(_0x314220,_0x45c6ca){return function(_0x218871){if(_0x218871){return _0x218871[_0x354f('0x28')]()[_0x354f('0x27')](function(){_0x314220[_0x354f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa482c3,_0x352928){return function(_0x123d9f){if(!_0x123d9f){_0xa482c3[_0x354f('0x1a')](0x194);}return _0x123d9f;};}function handleError(_0x4e5a82,_0x26c666){_0x26c666=_0x26c666||0x1f4;return function(_0x19d138){logger[_0x354f('0x29')](_0x19d138[_0x354f('0x2a')]);if(_0x19d138[_0x354f('0x2b')]){delete _0x19d138['name'];}_0x4e5a82['status'](_0x26c666)[_0x354f('0x2c')](_0x19d138);};}exports[_0x354f('0x2d')]=function(_0x2ea6cd,_0x3136c2){var _0x4ada9c={},_0xc3f0a8={},_0xd844a7={'count':0x0,'rows':[]};var _0x230677=_[_0x354f('0x2e')](db['ServicenowAccount'][_0x354f('0x2f')],function(_0x4820c5){return{'name':_0x4820c5['fieldName'],'type':_0x4820c5[_0x354f('0x30')][_0x354f('0x31')]};});_0xc3f0a8[_0x354f('0x32')]=_[_0x354f('0x2e')](_0x230677,'name');_0xc3f0a8[_0x354f('0x33')]=_['keys'](_0x2ea6cd[_0x354f('0x33')]);_0xc3f0a8[_0x354f('0x34')]=_['intersection'](_0xc3f0a8[_0x354f('0x32')],_0xc3f0a8[_0x354f('0x33')]);_0x4ada9c[_0x354f('0x35')]=_[_0x354f('0x36')](_0xc3f0a8[_0x354f('0x32')],qs['fields'](_0x2ea6cd[_0x354f('0x33')][_0x354f('0x37')]));_0x4ada9c[_0x354f('0x35')]=_0x4ada9c[_0x354f('0x35')]['length']?_0x4ada9c['attributes']:_0xc3f0a8[_0x354f('0x32')];if(!_0x2ea6cd['query'][_0x354f('0x38')](_0x354f('0x39'))){_0x4ada9c[_0x354f('0x20')]=qs['limit'](_0x2ea6cd[_0x354f('0x33')]['limit']);_0x4ada9c[_0x354f('0x1e')]=qs[_0x354f('0x1e')](_0x2ea6cd[_0x354f('0x33')]['offset']);}_0x4ada9c[_0x354f('0x3a')]=qs[_0x354f('0x3b')](_0x2ea6cd[_0x354f('0x33')][_0x354f('0x3b')]);_0x4ada9c[_0x354f('0x3c')]=qs[_0x354f('0x34')](_[_0x354f('0x3d')](_0x2ea6cd[_0x354f('0x33')],_0xc3f0a8[_0x354f('0x34')]),_0x230677);if(_0x2ea6cd[_0x354f('0x33')][_0x354f('0x3e')]){_0x4ada9c[_0x354f('0x3c')]=_[_0x354f('0x3f')](_0x4ada9c['where'],{'$or':_[_0x354f('0x2e')](_0x230677,function(_0x33f653){if(_0x33f653[_0x354f('0x30')]!==_0x354f('0x40')){var _0x21f653={};_0x21f653[_0x33f653['name']]={'$like':'%'+_0x2ea6cd[_0x354f('0x33')][_0x354f('0x3e')]+'%'};return _0x21f653;}})});}_0x4ada9c=_[_0x354f('0x3f')]({},_0x4ada9c,_0x2ea6cd[_0x354f('0x41')]);var _0x3c1fe6={'where':_0x4ada9c['where']};return db[_0x354f('0x42')][_0x354f('0x21')](_0x3c1fe6)['then'](function(_0x6b4424){_0xd844a7[_0x354f('0x21')]=_0x6b4424;if(_0x2ea6cd[_0x354f('0x33')]['includeAll']){_0x4ada9c['include']=[{'all':!![]}];}return db[_0x354f('0x42')]['findAll'](_0x4ada9c);})[_0x354f('0x27')](function(_0x340738){_0xd844a7[_0x354f('0x43')]=_0x340738;return _0xd844a7;})[_0x354f('0x27')](respondWithFilteredResult(_0x3136c2,_0x4ada9c))[_0x354f('0x44')](handleError(_0x3136c2,null));};exports[_0x354f('0x45')]=function(_0x4df149,_0x3edcb9){var _0x43e026={'raw':![],'where':{'id':_0x4df149[_0x354f('0x46')]['id']}},_0x2f7799={};_0x2f7799[_0x354f('0x32')]=_[_0x354f('0x47')](db[_0x354f('0x42')]['rawAttributes']);_0x2f7799[_0x354f('0x33')]=_[_0x354f('0x47')](_0x4df149['query']);_0x2f7799['filters']=_[_0x354f('0x36')](_0x2f7799[_0x354f('0x32')],_0x2f7799[_0x354f('0x33')]);_0x43e026[_0x354f('0x35')]=_[_0x354f('0x36')](_0x2f7799[_0x354f('0x32')],qs[_0x354f('0x37')](_0x4df149['query']['fields']));_0x43e026['attributes']=_0x43e026[_0x354f('0x35')][_0x354f('0x48')]?_0x43e026[_0x354f('0x35')]:_0x2f7799[_0x354f('0x32')];if(_0x4df149[_0x354f('0x33')]['includeAll']){_0x43e026[_0x354f('0x49')]=[{'all':!![]}];}_0x43e026=_[_0x354f('0x3f')]({},_0x43e026,_0x4df149[_0x354f('0x41')]);return db[_0x354f('0x42')]['find'](_0x43e026)[_0x354f('0x27')](handleEntityNotFound(_0x3edcb9,null))[_0x354f('0x27')](respondWithResult(_0x3edcb9,null))[_0x354f('0x44')](handleError(_0x3edcb9,null));};exports[_0x354f('0x4a')]=function(_0x3562e5,_0xa9af4f){return db[_0x354f('0x42')][_0x354f('0x4a')](_0x3562e5[_0x354f('0x4b')],{})[_0x354f('0x27')](respondWithResult(_0xa9af4f,0xc9))[_0x354f('0x44')](handleError(_0xa9af4f,null));};exports[_0x354f('0x26')]=function(_0x9d43d,_0x3d7452){if(_0x9d43d['body']['id']){delete _0x9d43d[_0x354f('0x4b')]['id'];}return db[_0x354f('0x42')][_0x354f('0x4c')]({'where':{'id':_0x9d43d[_0x354f('0x46')]['id']}})[_0x354f('0x27')](handleEntityNotFound(_0x3d7452,null))[_0x354f('0x27')](saveUpdates(_0x9d43d[_0x354f('0x4b')],null))[_0x354f('0x27')](respondWithResult(_0x3d7452,null))[_0x354f('0x44')](handleError(_0x3d7452,null));};exports[_0x354f('0x28')]=function(_0x3d9355,_0x17562a){return db[_0x354f('0x42')][_0x354f('0x4c')]({'where':{'id':_0x3d9355[_0x354f('0x46')]['id']}})['then'](handleEntityNotFound(_0x17562a,null))[_0x354f('0x27')](removeEntity(_0x17562a,null))['catch'](handleError(_0x17562a,null));};exports['getConfigurations']=function(_0x2e4b22,_0x2be579,_0x5b0ea1){var _0x4fcb87={};var _0x3f420d={};var _0x934bf8;var _0x5d33f3;return db[_0x354f('0x42')][_0x354f('0x4d')]({'where':{'id':_0x2e4b22[_0x354f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2be579,null))['then'](function(_0xa20dbc){if(_0xa20dbc){_0x934bf8=_0xa20dbc;_0x3f420d['model']=_[_0x354f('0x47')](db[_0x354f('0x4e')][_0x354f('0x2f')]);_0x3f420d[_0x354f('0x33')]=_['keys'](_0x2e4b22['query']);_0x3f420d[_0x354f('0x34')]=_[_0x354f('0x36')](_0x3f420d[_0x354f('0x32')],_0x3f420d[_0x354f('0x33')]);_0x4fcb87['attributes']=_[_0x354f('0x36')](_0x3f420d['model'],qs[_0x354f('0x37')](_0x2e4b22[_0x354f('0x33')][_0x354f('0x37')]));_0x4fcb87[_0x354f('0x35')]=_0x4fcb87[_0x354f('0x35')][_0x354f('0x48')]?_0x4fcb87[_0x354f('0x35')]:_0x3f420d['model'];_0x4fcb87[_0x354f('0x3a')]=qs[_0x354f('0x3b')](_0x2e4b22[_0x354f('0x33')][_0x354f('0x3b')]);_0x4fcb87['where']=qs[_0x354f('0x34')](_[_0x354f('0x3d')](_0x2e4b22[_0x354f('0x33')],_0x3f420d[_0x354f('0x34')]));if(_0x2e4b22['query'][_0x354f('0x3e')]){_0x4fcb87[_0x354f('0x3c')]=_[_0x354f('0x3f')](_0x4fcb87[_0x354f('0x3c')],{'$or':_['map'](_0x4fcb87[_0x354f('0x35')],function(_0x29fedd){var _0x3c144e={};_0x3c144e[_0x29fedd]={'$like':'%'+_0x2e4b22[_0x354f('0x33')]['filter']+'%'};return _0x3c144e;})});}_0x4fcb87=_[_0x354f('0x3f')]({},_0x4fcb87,_0x2e4b22[_0x354f('0x41')]);return _0x934bf8[_0x354f('0x4f')](_0x4fcb87);}})['then'](function(_0x529e02){if(_0x529e02){_0x5d33f3=_0x529e02[_0x354f('0x48')];if(!_0x2e4b22[_0x354f('0x33')][_0x354f('0x38')](_0x354f('0x39'))){_0x4fcb87[_0x354f('0x20')]=qs[_0x354f('0x20')](_0x2e4b22['query'][_0x354f('0x20')]);_0x4fcb87[_0x354f('0x1e')]=qs['offset'](_0x2e4b22[_0x354f('0x33')][_0x354f('0x1e')]);}return _0x934bf8[_0x354f('0x4f')](_0x4fcb87);}})[_0x354f('0x27')](function(_0x485333){if(_0x485333){return _0x485333?{'count':_0x5d33f3,'rows':_0x485333}:null;}})[_0x354f('0x27')](respondWithResult(_0x2be579,null))[_0x354f('0x44')](handleError(_0x2be579,null));};exports[_0x354f('0x50')]=function(_0x22ffe2,_0x105297,_0xc4169b){if(_0x22ffe2[_0x354f('0x4b')]['id']){delete _0x22ffe2[_0x354f('0x4b')]['id'];}return db[_0x354f('0x42')][_0x354f('0x4d')]({'where':{'id':_0x22ffe2[_0x354f('0x46')]['id']}})[_0x354f('0x27')](handleEntityNotFound(_0x105297,null))[_0x354f('0x27')](function(_0x8f9adc){if(_0x8f9adc){_0x22ffe2[_0x354f('0x4b')]['AccountId']=_0x8f9adc['id'];_0x22ffe2[_0x354f('0x4b')][_0x354f('0x51')]=integrations[_0x354f('0x52')](_0x22ffe2[_0x354f('0x4b')][_0x354f('0x53')],_0x22ffe2['body'][_0x354f('0x30')]);_0x22ffe2[_0x354f('0x4b')][_0x354f('0x54')]=integrations['getDescriptions'](_0x22ffe2[_0x354f('0x4b')][_0x354f('0x53')],_0x22ffe2['body'][_0x354f('0x30')]);return db[_0x354f('0x4e')][_0x354f('0x4a')](_0x22ffe2[_0x354f('0x4b')],{'include':[{'model':db[_0x354f('0x55')],'as':_0x354f('0x51')},{'model':db[_0x354f('0x55')],'as':_0x354f('0x54')}]});}return null;})[_0x354f('0x27')](respondWithResult(_0x105297,null))[_0x354f('0x44')](handleError(_0x105297,null));};exports['getFields']=function(_0x32420c,_0x15e71c,_0xc5cb1b){var _0x191c25=[_0x354f('0x56'),'hold_reason','knowledge',_0x354f('0x57'),'close_code',_0x354f('0x58'),'incident_state',_0x354f('0x59'),_0x354f('0x5a')];var _0x18be9a=[_0x354f('0x5b'),_0x354f('0x56'),_0x354f('0x5c'),_0x354f('0x5d'),'upon_reject',_0x354f('0x5e'),_0x354f('0x5f'),_0x354f('0x60'),'approval_history',_0x354f('0x61'),_0x354f('0x62'),_0x354f('0x63'),_0x354f('0x64'),_0x354f('0x65'),_0x354f('0x66'),_0x354f('0x67'),_0x354f('0x68'),'sys_created_by',_0x354f('0x69'),_0x354f('0x3a'),_0x354f('0x6a'),_0x354f('0x6b'),_0x354f('0x6c'),'delivery_plan',_0x354f('0x6d'),_0x354f('0x6e'),_0x354f('0x6f'),'business_service',_0x354f('0x70'),_0x354f('0x71'),_0x354f('0x72'),_0x354f('0x73'),_0x354f('0x74'),_0x354f('0x75'),'business_duration',_0x354f('0x76'),_0x354f('0x77'),_0x354f('0x78'),'resolved_at',_0x354f('0x79'),_0x354f('0x7a'),_0x354f('0x57'),_0x354f('0x7b'),_0x354f('0x7c'),_0x354f('0x7d'),_0x354f('0x7e'),_0x354f('0x7f'),_0x354f('0x80'),_0x354f('0x81'),'business_stc',_0x354f('0x82'),_0x354f('0x83'),_0x354f('0x84'),_0x354f('0x58'),_0x354f('0x85'),'close_notes','closed_by',_0x354f('0x86'),_0x354f('0x87'),_0x354f('0x88'),'contact_type',_0x354f('0x89'),_0x354f('0x8a'),_0x354f('0x8b'),_0x354f('0x8c'),_0x354f('0x8d'),_0x354f('0x8e'),_0x354f('0x8f'),_0x354f('0x90'),'severity',_0x354f('0x91'),'sla_due',_0x354f('0x92'),_0x354f('0x93'),'due_date',_0x354f('0x94'),_0x354f('0x95'),_0x354f('0x96'),_0x354f('0x97'),_0x354f('0x98'),_0x354f('0x99'),_0x354f('0x9a'),_0x354f('0x5a')];var _0x216dab='';var _0x367f91='';var _0xe94bf0=[];var _0x1fa1a9='';var _0x2da3e1='';var _0x23bb22=[];var _0xbc011a='';var _0x566ac7='';var _0x2839e8={};var _0x5b6e60='';return db[_0x354f('0x42')][_0x354f('0x4d')]({'where':{'id':_0x32420c[_0x354f('0x46')]['id']},'attributes':['id',_0x354f('0x9b'),_0x354f('0x9c'),_0x354f('0x9d'),_0x354f('0x9e'),'serverUrl']})[_0x354f('0x27')](handleEntityNotFound(_0x15e71c,null))['then'](function(_0x439a57){if(_0x439a57){_0x5b6e60=_0x439a57[_0x354f('0x9e')];var _0xc039a8=_0x5b6e60[_0x354f('0x9f')](-0x1);if(_0xc039a8==='/'){_0x5b6e60=_0x5b6e60[_0x354f('0xa0')](0x0,_0x5b6e60['lastIndexOf'](_0xc039a8));}_0x566ac7=util[_0x354f('0xa1')](_0x354f('0xa2'),_0x5b6e60);_0xbc011a=util[_0x354f('0xa1')](_0x354f('0xa3'),_0x5b6e60);_0x2839e8={'user':_0x439a57['username'],'pass':_0x439a57[_0x354f('0x9c')]};var _0x486d3a={'method':_0x354f('0xa4'),'uri':_0x566ac7+'incident?sysparm_display_value=all','auth':_0x2839e8,'json':!![]};return rp(_0x486d3a);}})[_0x354f('0x27')](function(_0x2c00ac){if(_0x2c00ac[_0x354f('0xa5')][_0x354f('0x48')]>0x0){_0x216dab=_0x2c00ac[_0x354f('0xa5')];}console['log']('incident\x20table\x20objects',_0x216dab);_0x23bb22=[];_0x367f91=Object[_0x354f('0xa6')]([],_0x216dab);_[_0x354f('0xa7')](_0x367f91,function(_0x1e21ad){return!_0x191c25[_0x354f('0xa8')](_0x1e21ad[_0x354f('0x2b')]);});_0x367f91[_0x354f('0xa9')](function(_0x3bd595){var _0x164695=createFieldObject(_0xbc011a,_0x2839e8,_0x3bd595['internalType'],_0x3bd595[_0x354f('0x2b')],_0x3bd595[_0x354f('0xaa')],![]);_0x23bb22[_0x354f('0xab')](_0x164695);});return Promise[_0x354f('0xac')](_0x23bb22);})[_0x354f('0x27')](function(_0x5a041f){_0xe94bf0=_0x5a041f;_0x1fa1a9=Object[_0x354f('0xa6')]([],_0x216dab);console['log'](_0x354f('0xad'),_0x216dab);_['remove'](_0x1fa1a9,function(_0x445467){return _0x18be9a[_0x354f('0xa8')](_0x445467['name']);});console['log'](_0x354f('0xae'),_0x1fa1a9);_0x23bb22=[];_0x1fa1a9[_0x354f('0xa9')](function(_0x3ad938){var _0x32f007=createFieldObject(_0xbc011a,_0x2839e8,_0x3ad938[_0x354f('0xaf')],_0x3ad938[_0x354f('0x2b')],_0x3ad938['label'],!![]);_0x23bb22[_0x354f('0xab')](_0x32f007);});return Promise[_0x354f('0xac')](_0x23bb22);})['then'](function(_0x341136){_0x2da3e1=_0x341136;var _0x414a93=_0xe94bf0[_0x354f('0xb0')](_0x2da3e1);return{'count':_0x414a93[_0x354f('0x48')],'rows':_0x414a93};})[_0x354f('0x27')](respondWithResult(_0x15e71c,null))['catch'](function(_0x474213){console[_0x354f('0xb1')](_0x354f('0xb2')+_0x474213);var _0x191e2f=_0x32420c[_0x354f('0x33')]['test']?0x1f4:_0x474213[_0x354f('0xb3')]||0x1f4;logger[_0x354f('0x29')](_0x474213[_0x354f('0x2a')]);delete _0x474213[_0x354f('0x2b')];if(_0x191e2f===0x191){_0x191e2f=0x190;}_0x15e71c[_0x354f('0x1b')](_0x191e2f)[_0x354f('0x2c')](_0x32420c['query'][_0x354f('0xb4')]?{'message':'Wrong\x20credentials','statusCode':_0x474213['statusCode']}:_0x474213);});};function createFieldObject(_0x4d3675,_0x186798,_0x33a563,_0x340150,_0x2286eb,_0x21b38b){return new Promise(function(_0x325219,_0x2d3195){var _0x281edf={'id':_0x340150,'name':_0x2286eb,'custom':_0x21b38b};if(_0x33a563===_0x354f('0xb5')){_0x281edf[_0x354f('0x41')]=[{'name':'True','value':_0x354f('0xb6')},{'name':_0x354f('0xb7'),'value':'false'}];_0x325219(_0x281edf);}else{var _0x307478={'method':_0x354f('0xa4'),'uri':_0x4d3675+_0x354f('0xb8')+_0x340150,'auth':_0x186798,'json':!![]};return rp(_0x307478)[_0x354f('0x27')](function(_0x23103e){var _0x3d049c=[];if(_0x23103e[_0x354f('0xa5')]['length']>0x0){_0x23103e[_0x354f('0xa5')][_0x354f('0xa9')](function(_0x15b9fe){if(_0x15b9fe[_0x354f('0xb9')]==='false'){var _0x3713ec={'name':_0x15b9fe[_0x354f('0xaa')],'value':_0x15b9fe[_0x354f('0xba')]};_0x3d049c[_0x354f('0xab')](_0x3713ec);}});}_0x281edf[_0x354f('0x41')]=_0x3d049c;if(_0x281edf['options']['length']>0x0){_0x325219(_0x281edf);}else{if(_0x21b38b==![]){_0x325219();}else{_0x325219(_0x281edf);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6d8221a..5299230 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 _0xbd51=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x40bf8e,_0x4a6e8c){var _0x1e6de9=function(_0x488818){while(--_0x488818){_0x40bf8e['push'](_0x40bf8e['shift']());}};_0x1e6de9(++_0x4a6e8c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x4a91ac,_0x476378){_0x4a91ac=_0x4a91ac-0x0;var _0x6026a9=_0xbd51[_0x4a91ac];return _0x6026a9;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));var integrations=require(_0x1bd5('0x6'));module[_0x1bd5('0x7')]=function(_0x59ddfb,_0x29abea){return _0x59ddfb[_0x1bd5('0x8')](_0x1bd5('0x9'),attributes,{'tableName':_0x1bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x129f3f,_0x52d63){var _0x21d471=function(_0x2cc0ee){while(--_0x2cc0ee){_0x129f3f['push'](_0x129f3f['shift']());}};_0x21d471(++_0x52d63);}(_0x5d17,0x114));var _0x75d1=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x5d17[_0x4191bc];return _0x1ffd4e;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));var integrations=require(_0x75d1('0x8'));module['exports']=function(_0x458681,_0x116a51){return _0x458681[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 20223b1..3670ba2 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 _0x06da=['../../config/environment','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','include','map','model','attributes','ShowServicenowAccount','find','raw','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1515c9,_0x3db945){var _0x3e9c59=function(_0x56ef9f){while(--_0x56ef9f){_0x1515c9['push'](_0x1515c9['shift']());}};_0x3e9c59(++_0x3db945);}(_0x06da,0x118));var _0xa06d=function(_0x21324b,_0x553a29){_0x21324b=_0x21324b-0x0;var _0x37ed44=_0x06da[_0x21324b];return _0x37ed44;};'use strict';var _=require(_0xa06d('0x0'));var util=require(_0xa06d('0x1'));var moment=require(_0xa06d('0x2'));var BPromise=require('bluebird');var rs=require(_0xa06d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa06d('0x4'))['db'];var utils=require(_0xa06d('0x5'));var logger=require(_0xa06d('0x6'))(_0xa06d('0x7'));var config=require(_0xa06d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa06d('0x9')][_0xa06d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58dbc7,_0x5e88bf,_0x5747bb){return new BPromise(function(_0x29e6ac,_0x253fb2){return client[_0xa06d('0xb')](_0x58dbc7,_0x5747bb)[_0xa06d('0xc')](function(_0x1eccb9){logger['info'](_0xa06d('0xd'),_0x5e88bf,_0xa06d('0xe'));logger[_0xa06d('0xf')](_0xa06d('0x10'),_0x5e88bf,_0xa06d('0xe'),JSON[_0xa06d('0x11')](_0x1eccb9));if(_0x1eccb9['error']){if(_0x1eccb9[_0xa06d('0x12')][_0xa06d('0x13')]===0x1f4){logger[_0xa06d('0x12')](_0xa06d('0xd'),_0x5e88bf,_0x1eccb9[_0xa06d('0x12')]['message']);return _0x253fb2(_0x1eccb9[_0xa06d('0x12')][_0xa06d('0x14')]);}logger['error'](_0xa06d('0xd'),_0x5e88bf,_0x1eccb9[_0xa06d('0x12')][_0xa06d('0x14')]);return _0x29e6ac(_0x1eccb9[_0xa06d('0x12')][_0xa06d('0x14')]);}else{logger[_0xa06d('0x15')](_0xa06d('0xd'),_0x5e88bf,'request\x20sent');_0x29e6ac(_0x1eccb9[_0xa06d('0x16')][_0xa06d('0x14')]);}})['catch'](function(_0xb021d5){logger[_0xa06d('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5e88bf,_0xb021d5);_0x253fb2(_0xb021d5);});});}exports[_0xa06d('0x17')]=function(_0x375f53){var _0x3ec973=this;return new Promise(function(_0x327caa,_0x52afb6){return db[_0xa06d('0x18')][_0xa06d('0x19')]({'raw':_0x375f53[_0xa06d('0x1a')]?_0x375f53['options']['raw']===undefined?!![]:![]:!![],'where':_0x375f53['options']?_0x375f53[_0xa06d('0x1a')][_0xa06d('0x1b')]||null:null,'attributes':_0x375f53[_0xa06d('0x1a')]?_0x375f53[_0xa06d('0x1a')]['attributes']||null:null,'limit':_0x375f53[_0xa06d('0x1a')]?_0x375f53[_0xa06d('0x1a')]['limit']||null:null,'include':_0x375f53[_0xa06d('0x1a')]?_0x375f53[_0xa06d('0x1a')][_0xa06d('0x1c')]?_[_0xa06d('0x1d')](_0x375f53['options'][_0xa06d('0x1c')],function(_0x2278e1){return{'model':db[_0x2278e1[_0xa06d('0x1e')]],'as':_0x2278e1['as'],'attributes':_0x2278e1[_0xa06d('0x1f')],'include':_0x2278e1[_0xa06d('0x1c')]?_['map'](_0x2278e1[_0xa06d('0x1c')],function(_0x3dee51){return{'model':db[_0x3dee51[_0xa06d('0x1e')]],'as':_0x3dee51['as'],'attributes':_0x3dee51['attributes'],'include':_0x3dee51[_0xa06d('0x1c')]?_['map'](_0x3dee51['include'],function(_0x986c9c){return{'model':db[_0x986c9c[_0xa06d('0x1e')]],'as':_0x986c9c['as'],'attributes':_0x986c9c[_0xa06d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf2fc26){logger[_0xa06d('0x15')](_0xa06d('0x17'),_0x375f53);logger[_0xa06d('0xf')](_0xa06d('0x17'),_0x375f53,JSON[_0xa06d('0x11')](_0xf2fc26));_0x327caa(_0xf2fc26);})['catch'](function(_0x4d9060){logger[_0xa06d('0x12')]('GetServicenowAccount',_0x4d9060[_0xa06d('0x14')],_0x375f53);_0x52afb6(_0x3ec973[_0xa06d('0x12')](0x1f4,_0x4d9060[_0xa06d('0x14')]));});});};exports[_0xa06d('0x20')]=function(_0x1e1eb0){var _0x55127b=this;return new Promise(function(_0xfd4424,_0x3d0c73){return db[_0xa06d('0x18')][_0xa06d('0x21')]({'raw':_0x1e1eb0['options']?_0x1e1eb0['options'][_0xa06d('0x22')]===undefined?!![]:![]:!![],'where':_0x1e1eb0[_0xa06d('0x1a')]?_0x1e1eb0[_0xa06d('0x1a')]['where']||null:null,'attributes':_0x1e1eb0[_0xa06d('0x1a')]?_0x1e1eb0['options'][_0xa06d('0x1f')]||null:null,'include':_0x1e1eb0[_0xa06d('0x1a')]?_0x1e1eb0[_0xa06d('0x1a')]['include']?_[_0xa06d('0x1d')](_0x1e1eb0[_0xa06d('0x1a')][_0xa06d('0x1c')],function(_0x1d6c90){return{'model':db[_0x1d6c90[_0xa06d('0x1e')]],'as':_0x1d6c90['as'],'attributes':_0x1d6c90[_0xa06d('0x1f')],'include':_0x1d6c90[_0xa06d('0x1c')]?_[_0xa06d('0x1d')](_0x1d6c90[_0xa06d('0x1c')],function(_0x40ad41){return{'model':db[_0x40ad41[_0xa06d('0x1e')]],'as':_0x40ad41['as'],'attributes':_0x40ad41[_0xa06d('0x1f')],'include':_0x40ad41[_0xa06d('0x1c')]?_[_0xa06d('0x1d')](_0x40ad41[_0xa06d('0x1c')],function(_0x2f150a){return{'model':db[_0x2f150a['model']],'as':_0x2f150a['as'],'attributes':_0x2f150a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa06d('0xc')](function(_0x1f26dc){logger[_0xa06d('0x15')](_0xa06d('0x20'),_0x1e1eb0);logger[_0xa06d('0xf')](_0xa06d('0x20'),_0x1e1eb0,JSON['stringify'](_0x1f26dc));_0xfd4424(_0x1f26dc);})[_0xa06d('0x23')](function(_0x21e435){logger['error'](_0xa06d('0x20'),_0x21e435[_0xa06d('0x14')],_0x1e1eb0);_0x3d0c73(_0x55127b[_0xa06d('0x12')](0x1f4,_0x21e435['message']));});});}; \ No newline at end of file +var _0x93cd=['debug','catch','find','raw','ShowServicenowAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','model','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93cd,0x1b2));var _0xd93c=function(_0x57a4d0,_0xa6e6b){_0x57a4d0=_0x57a4d0-0x0;var _0xaaadee=_0x93cd[_0x57a4d0];return _0xaaadee;};'use strict';var _=require(_0xd93c('0x0'));var util=require(_0xd93c('0x1'));var moment=require('moment');var BPromise=require(_0xd93c('0x2'));var rs=require(_0xd93c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd93c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd93c('0x5'))('rpc');var config=require(_0xd93c('0x6'));var jayson=require(_0xd93c('0x7'));var client=jayson['client'][_0xd93c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19f6a8,_0x504203,_0x5ec773){return new BPromise(function(_0x333640,_0xbc7ce0){return client[_0xd93c('0x9')](_0x19f6a8,_0x5ec773)[_0xd93c('0xa')](function(_0x5e6dc7){logger[_0xd93c('0xb')](_0xd93c('0xc'),_0x504203,_0xd93c('0xd'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x504203,_0xd93c('0xd'),JSON['stringify'](_0x5e6dc7));if(_0x5e6dc7[_0xd93c('0xe')]){if(_0x5e6dc7[_0xd93c('0xe')][_0xd93c('0xf')]===0x1f4){logger[_0xd93c('0xe')](_0xd93c('0xc'),_0x504203,_0x5e6dc7[_0xd93c('0xe')][_0xd93c('0x10')]);return _0xbc7ce0(_0x5e6dc7[_0xd93c('0xe')][_0xd93c('0x10')]);}logger[_0xd93c('0xe')](_0xd93c('0xc'),_0x504203,_0x5e6dc7[_0xd93c('0xe')][_0xd93c('0x10')]);return _0x333640(_0x5e6dc7['error']['message']);}else{logger[_0xd93c('0xb')](_0xd93c('0xc'),_0x504203,_0xd93c('0xd'));_0x333640(_0x5e6dc7[_0xd93c('0x11')]['message']);}})['catch'](function(_0x50abc9){logger[_0xd93c('0xe')](_0xd93c('0xc'),_0x504203,_0x50abc9);_0xbc7ce0(_0x50abc9);});});}exports[_0xd93c('0x12')]=function(_0x47c524){var _0x37ef73=this;return new Promise(function(_0x4517de,_0x2e29f4){return db[_0xd93c('0x13')][_0xd93c('0x14')]({'raw':_0x47c524[_0xd93c('0x15')]?_0x47c524[_0xd93c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x47c524[_0xd93c('0x15')]?_0x47c524[_0xd93c('0x15')][_0xd93c('0x16')]||null:null,'attributes':_0x47c524[_0xd93c('0x15')]?_0x47c524[_0xd93c('0x15')][_0xd93c('0x17')]||null:null,'limit':_0x47c524[_0xd93c('0x15')]?_0x47c524[_0xd93c('0x15')][_0xd93c('0x18')]||null:null,'include':_0x47c524[_0xd93c('0x15')]?_0x47c524[_0xd93c('0x15')][_0xd93c('0x19')]?_['map'](_0x47c524['options']['include'],function(_0x2fbd3d){return{'model':db[_0x2fbd3d[_0xd93c('0x1a')]],'as':_0x2fbd3d['as'],'attributes':_0x2fbd3d[_0xd93c('0x17')],'include':_0x2fbd3d[_0xd93c('0x19')]?_[_0xd93c('0x1b')](_0x2fbd3d[_0xd93c('0x19')],function(_0x4f0bb9){return{'model':db[_0x4f0bb9['model']],'as':_0x4f0bb9['as'],'attributes':_0x4f0bb9[_0xd93c('0x17')],'include':_0x4f0bb9['include']?_[_0xd93c('0x1b')](_0x4f0bb9[_0xd93c('0x19')],function(_0x2b4db5){return{'model':db[_0x2b4db5['model']],'as':_0x2b4db5['as'],'attributes':_0x2b4db5[_0xd93c('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd93c('0xa')](function(_0x388cd4){logger[_0xd93c('0xb')]('GetServicenowAccount',_0x47c524);logger[_0xd93c('0x1c')](_0xd93c('0x12'),_0x47c524,JSON['stringify'](_0x388cd4));_0x4517de(_0x388cd4);})[_0xd93c('0x1d')](function(_0x29e3f3){logger[_0xd93c('0xe')](_0xd93c('0x12'),_0x29e3f3[_0xd93c('0x10')],_0x47c524);_0x2e29f4(_0x37ef73[_0xd93c('0xe')](0x1f4,_0x29e3f3[_0xd93c('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x5ef9d7){var _0x698c82=this;return new Promise(function(_0x3bdbea,_0x4d47e9){return db['ServicenowAccount'][_0xd93c('0x1e')]({'raw':_0x5ef9d7[_0xd93c('0x15')]?_0x5ef9d7[_0xd93c('0x15')][_0xd93c('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ef9d7['options']?_0x5ef9d7[_0xd93c('0x15')][_0xd93c('0x16')]||null:null,'attributes':_0x5ef9d7[_0xd93c('0x15')]?_0x5ef9d7['options']['attributes']||null:null,'include':_0x5ef9d7[_0xd93c('0x15')]?_0x5ef9d7[_0xd93c('0x15')][_0xd93c('0x19')]?_[_0xd93c('0x1b')](_0x5ef9d7[_0xd93c('0x15')][_0xd93c('0x19')],function(_0x546650){return{'model':db[_0x546650[_0xd93c('0x1a')]],'as':_0x546650['as'],'attributes':_0x546650[_0xd93c('0x17')],'include':_0x546650[_0xd93c('0x19')]?_[_0xd93c('0x1b')](_0x546650[_0xd93c('0x19')],function(_0x453003){return{'model':db[_0x453003[_0xd93c('0x1a')]],'as':_0x453003['as'],'attributes':_0x453003[_0xd93c('0x17')],'include':_0x453003[_0xd93c('0x19')]?_[_0xd93c('0x1b')](_0x453003[_0xd93c('0x19')],function(_0x3a1e71){return{'model':db[_0x3a1e71[_0xd93c('0x1a')]],'as':_0x3a1e71['as'],'attributes':_0x3a1e71[_0xd93c('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd93c('0xa')](function(_0x426509){logger['info'](_0xd93c('0x20'),_0x5ef9d7);logger[_0xd93c('0x1c')](_0xd93c('0x20'),_0x5ef9d7,JSON['stringify'](_0x426509));_0x3bdbea(_0x426509);})[_0xd93c('0x1d')](function(_0x2c971a){logger[_0xd93c('0xe')](_0xd93c('0x20'),_0x2c971a[_0xd93c('0x10')],_0x5ef9d7);_0x4d47e9(_0x698c82[_0xd93c('0xe')](0x1f4,_0x2c971a[_0xd93c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cb28db8..4a15ad8 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 _0x3d2a=['getDescriptions','post','create','put','update','delete','destroy','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x66112a,_0x214703){var _0x199323=function(_0x54cc15){while(--_0x54cc15){_0x66112a['push'](_0x66112a['shift']());}};_0x199323(++_0x214703);}(_0x3d2a,0x66));var _0xa3d2=function(_0x2f7be9,_0x173b28){_0x2f7be9=_0x2f7be9-0x0;var _0x22b2ad=_0x3d2a[_0x2f7be9];return _0x22b2ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3d2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa3d2('0x1')]();var fs_extra=require(_0xa3d2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xa3d2('0x3'));var config=require(_0xa3d2('0x4'));var controller=require('./intServicenowConfiguration.controller');router[_0xa3d2('0x5')]('/',auth['isAuthenticated'](),controller[_0xa3d2('0x6')]);router[_0xa3d2('0x5')]('/:id',auth[_0xa3d2('0x7')](),controller['show']);router[_0xa3d2('0x5')]('/:id/fields',auth[_0xa3d2('0x7')](),controller[_0xa3d2('0x8')]);router[_0xa3d2('0x5')](_0xa3d2('0x9'),auth[_0xa3d2('0x7')](),controller[_0xa3d2('0xa')]);router['get'](_0xa3d2('0xb'),auth[_0xa3d2('0x7')](),controller[_0xa3d2('0xc')]);router[_0xa3d2('0xd')]('/',auth[_0xa3d2('0x7')](),controller[_0xa3d2('0xe')]);router[_0xa3d2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa3d2('0x10')]);router[_0xa3d2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa3d2('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0f54=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update'];(function(_0x49de1b,_0x355ad9){var _0x39357e=function(_0x147876){while(--_0x147876){_0x49de1b['push'](_0x49de1b['shift']());}};_0x39357e(++_0x355ad9);}(_0x0f54,0xdf));var _0x40f5=function(_0x3c6bea,_0x587031){_0x3c6bea=_0x3c6bea-0x0;var _0x26b4ff=_0x0f54[_0x3c6bea];return _0x26b4ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40f5('0x0'));var timeout=require(_0x40f5('0x1'));var express=require(_0x40f5('0x2'));var router=express[_0x40f5('0x3')]();var fs_extra=require(_0x40f5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x40f5('0x5'));var config=require(_0x40f5('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x40f5('0x7')]('/',auth['isAuthenticated'](),controller[_0x40f5('0x8')]);router[_0x40f5('0x7')](_0x40f5('0x9'),auth[_0x40f5('0xa')](),controller[_0x40f5('0xb')]);router[_0x40f5('0x7')]('/:id/fields',auth[_0x40f5('0xa')](),controller['getFields']);router[_0x40f5('0x7')](_0x40f5('0xc'),auth[_0x40f5('0xa')](),controller[_0x40f5('0xd')]);router['get'](_0x40f5('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x40f5('0xf')]('/',auth[_0x40f5('0xa')](),controller[_0x40f5('0x10')]);router[_0x40f5('0x11')](_0x40f5('0x9'),auth[_0x40f5('0xa')](),controller[_0x40f5('0x12')]);router[_0x40f5('0x13')](_0x40f5('0x9'),auth[_0x40f5('0xa')](),controller[_0x40f5('0x14')]);module[_0x40f5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index edb0d33..e863130 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 _0x58c7=['exports','STRING'];(function(_0x4c97e2,_0x1549a5){var _0x57a577=function(_0x127144){while(--_0x127144){_0x4c97e2['push'](_0x4c97e2['shift']());}};_0x57a577(++_0x1549a5);}(_0x58c7,0x1f0));var _0x758c=function(_0x6a6ea4,_0x39aab0){_0x6a6ea4=_0x6a6ea4-0x0;var _0x30516e=_0x58c7[_0x6a6ea4];return _0x30516e;};'use strict';var Sequelize=require('sequelize');module[_0x758c('0x0')]={'name':{'type':Sequelize[_0x758c('0x1')]},'description':{'type':Sequelize[_0x758c('0x1')]}}; \ No newline at end of file +var _0x86cb=['STRING','exports'];(function(_0x92016c,_0x2c2f92){var _0x81f911=function(_0x5269bd){while(--_0x5269bd){_0x92016c['push'](_0x92016c['shift']());}};_0x81f911(++_0x2c2f92);}(_0x86cb,0x189));var _0xb86c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x86cb[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require('sequelize');module[_0xb86c('0x0')]={'name':{'type':Sequelize[_0xb86c('0x1')]},'description':{'type':Sequelize[_0xb86c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 6124c2e..09d92d5 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 _0x83fc=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ServicenowConfiguration','include','findAll','rows','show','params','options','catch','create','body','find','destroy','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','query'];(function(_0x1894e7,_0x1253e6){var _0x5e857f=function(_0x1b47c3){while(--_0x1b47c3){_0x1894e7['push'](_0x1894e7['shift']());}};_0x5e857f(++_0x1253e6);}(_0x83fc,0x168));var _0xc83f=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x83fc[_0x456fb1];return _0x4083d6;};'use strict';var emlformat=require(_0xc83f('0x0'));var rimraf=require(_0xc83f('0x1'));var zipdir=require(_0xc83f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc83f('0x3'));var moment=require(_0xc83f('0x4'));var BPromise=require(_0xc83f('0x5'));var Mustache=require(_0xc83f('0x6'));var util=require(_0xc83f('0x7'));var path=require(_0xc83f('0x8'));var sox=require(_0xc83f('0x9'));var csv=require(_0xc83f('0xa'));var ejs=require(_0xc83f('0xb'));var fs=require('fs');var fs_extra=require(_0xc83f('0xc'));var _=require(_0xc83f('0xd'));var squel=require(_0xc83f('0xe'));var crypto=require(_0xc83f('0xf'));var jsforce=require(_0xc83f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc83f('0xa'));var querystring=require(_0xc83f('0x11'));var Papa=require(_0xc83f('0x12'));var Redis=require(_0xc83f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc83f('0x14'));var as=require(_0xc83f('0x15'));var hardwareService=require(_0xc83f('0x16'));var logger=require(_0xc83f('0x17'))(_0xc83f('0x18'));var utils=require(_0xc83f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc83f('0x1a'));var db=require(_0xc83f('0x1b'))['db'];function respondWithStatusCode(_0x576ad7,_0x5c7434){_0x5c7434=_0x5c7434||0xcc;return function(_0xb3849f){if(_0xb3849f){return _0x576ad7['sendStatus'](_0x5c7434);}return _0x576ad7[_0xc83f('0x1c')](_0x5c7434)['end']();};}function respondWithResult(_0x4a0748,_0x365d40){_0x365d40=_0x365d40||0xc8;return function(_0x343c2b){if(_0x343c2b){return _0x4a0748['status'](_0x365d40)['json'](_0x343c2b);}};}function respondWithFilteredResult(_0x869c36,_0x3e64de){return function(_0x53d337){if(_0x53d337){var _0x1a11a4=typeof _0x3e64de[_0xc83f('0x1d')]===_0xc83f('0x1e')&&typeof _0x3e64de[_0xc83f('0x1f')]===_0xc83f('0x1e');var _0x423025=_0x53d337[_0xc83f('0x20')];var _0x1c9985=_0x1a11a4?0x0:_0x3e64de[_0xc83f('0x1d')];var _0x413a8a=_0x1a11a4?_0x53d337[_0xc83f('0x20')]:_0x3e64de[_0xc83f('0x1d')]+_0x3e64de[_0xc83f('0x1f')];var _0x347e27;if(_0x413a8a>=_0x423025){_0x413a8a=_0x423025;_0x347e27=0xc8;}else{_0x347e27=0xce;}_0x869c36['status'](_0x347e27);return _0x869c36[_0xc83f('0x21')](_0xc83f('0x22'),_0x1c9985+'-'+_0x413a8a+'/'+_0x423025)['json'](_0x53d337);}return null;};}function patchUpdates(_0x518ebd){return function(_0x3a6280){try{jsonpatch['apply'](_0x3a6280,_0x518ebd,!![]);}catch(_0x3227a7){return BPromise[_0xc83f('0x23')](_0x3227a7);}return _0x3a6280[_0xc83f('0x24')]();};}function saveUpdates(_0x5838f0,_0x5c6071){return function(_0x38a594){if(_0x38a594){return _0x38a594[_0xc83f('0x25')](_0x5838f0)[_0xc83f('0x26')](function(_0x25b390){return _0x25b390;});}return null;};}function removeEntity(_0x5cef98,_0x4d2084){return function(_0x3b6be6){if(_0x3b6be6){return _0x3b6be6['destroy']()['then'](function(){_0x5cef98[_0xc83f('0x1c')](0xcc)[_0xc83f('0x27')]();});}};}function handleEntityNotFound(_0x5d42ed,_0x1c03a9){return function(_0xc0d6dd){if(!_0xc0d6dd){_0x5d42ed[_0xc83f('0x28')](0x194);}return _0xc0d6dd;};}function handleError(_0x31c47c,_0x5b6640){_0x5b6640=_0x5b6640||0x1f4;return function(_0x4d0021){logger[_0xc83f('0x29')](_0x4d0021[_0xc83f('0x2a')]);if(_0x4d0021['name']){delete _0x4d0021[_0xc83f('0x2b')];}_0x31c47c[_0xc83f('0x1c')](_0x5b6640)['send'](_0x4d0021);};}exports[_0xc83f('0x2c')]=function(_0x581c8f,_0x202c7f){var _0x132b52={},_0x3b7de8={},_0x4cded3={'count':0x0,'rows':[]};var _0x264597=_[_0xc83f('0x2d')](db['ServicenowConfiguration'][_0xc83f('0x2e')],function(_0xc21530){return{'name':_0xc21530[_0xc83f('0x2f')],'type':_0xc21530[_0xc83f('0x30')]['key']};});_0x3b7de8['model']=_['map'](_0x264597,'name');_0x3b7de8[_0xc83f('0x31')]=_[_0xc83f('0x32')](_0x581c8f[_0xc83f('0x31')]);_0x3b7de8[_0xc83f('0x33')]=_[_0xc83f('0x34')](_0x3b7de8[_0xc83f('0x35')],_0x3b7de8['query']);_0x132b52['attributes']=_[_0xc83f('0x34')](_0x3b7de8[_0xc83f('0x35')],qs['fields'](_0x581c8f['query'][_0xc83f('0x36')]));_0x132b52[_0xc83f('0x37')]=_0x132b52['attributes'][_0xc83f('0x38')]?_0x132b52['attributes']:_0x3b7de8[_0xc83f('0x35')];if(!_0x581c8f[_0xc83f('0x31')][_0xc83f('0x39')](_0xc83f('0x3a'))){_0x132b52[_0xc83f('0x1f')]=qs[_0xc83f('0x1f')](_0x581c8f[_0xc83f('0x31')][_0xc83f('0x1f')]);_0x132b52[_0xc83f('0x1d')]=qs['offset'](_0x581c8f['query']['offset']);}_0x132b52[_0xc83f('0x3b')]=qs[_0xc83f('0x3c')](_0x581c8f[_0xc83f('0x31')][_0xc83f('0x3c')]);_0x132b52[_0xc83f('0x3d')]=qs[_0xc83f('0x33')](_[_0xc83f('0x3e')](_0x581c8f[_0xc83f('0x31')],_0x3b7de8[_0xc83f('0x33')]),_0x264597);if(_0x581c8f['query'][_0xc83f('0x3f')]){_0x132b52['where']=_['merge'](_0x132b52[_0xc83f('0x3d')],{'$or':_[_0xc83f('0x2d')](_0x264597,function(_0x3768ea){if(_0x3768ea[_0xc83f('0x30')]!=='VIRTUAL'){var _0x624e7e={};_0x624e7e[_0x3768ea[_0xc83f('0x2b')]]={'$like':'%'+_0x581c8f['query'][_0xc83f('0x3f')]+'%'};return _0x624e7e;}})});}_0x132b52=_[_0xc83f('0x40')]({},_0x132b52,_0x581c8f['options']);var _0x230ab9={'where':_0x132b52[_0xc83f('0x3d')]};return db[_0xc83f('0x41')][_0xc83f('0x20')](_0x230ab9)[_0xc83f('0x26')](function(_0x8fae82){_0x4cded3['count']=_0x8fae82;if(_0x581c8f[_0xc83f('0x31')]['includeAll']){_0x132b52[_0xc83f('0x42')]=[{'all':!![]}];}return db[_0xc83f('0x41')][_0xc83f('0x43')](_0x132b52);})[_0xc83f('0x26')](function(_0x208f2f){_0x4cded3[_0xc83f('0x44')]=_0x208f2f;return _0x4cded3;})[_0xc83f('0x26')](respondWithFilteredResult(_0x202c7f,_0x132b52))['catch'](handleError(_0x202c7f,null));};exports[_0xc83f('0x45')]=function(_0x40d6f6,_0x1b05cb){var _0x3dc268={'raw':![],'where':{'id':_0x40d6f6[_0xc83f('0x46')]['id']}},_0x4071f5={};_0x4071f5[_0xc83f('0x35')]=_[_0xc83f('0x32')](db[_0xc83f('0x41')][_0xc83f('0x2e')]);_0x4071f5[_0xc83f('0x31')]=_[_0xc83f('0x32')](_0x40d6f6['query']);_0x4071f5[_0xc83f('0x33')]=_[_0xc83f('0x34')](_0x4071f5[_0xc83f('0x35')],_0x4071f5[_0xc83f('0x31')]);_0x3dc268[_0xc83f('0x37')]=_[_0xc83f('0x34')](_0x4071f5[_0xc83f('0x35')],qs[_0xc83f('0x36')](_0x40d6f6[_0xc83f('0x31')]['fields']));_0x3dc268[_0xc83f('0x37')]=_0x3dc268['attributes'][_0xc83f('0x38')]?_0x3dc268[_0xc83f('0x37')]:_0x4071f5[_0xc83f('0x35')];if(_0x40d6f6[_0xc83f('0x31')]['includeAll']){_0x3dc268['include']=[{'all':!![]}];}_0x3dc268=_[_0xc83f('0x40')]({},_0x3dc268,_0x40d6f6[_0xc83f('0x47')]);return db['ServicenowConfiguration']['find'](_0x3dc268)[_0xc83f('0x26')](handleEntityNotFound(_0x1b05cb,null))[_0xc83f('0x26')](respondWithResult(_0x1b05cb,null))[_0xc83f('0x48')](handleError(_0x1b05cb,null));};exports[_0xc83f('0x49')]=function(_0x5b030e,_0x40d941){return db[_0xc83f('0x41')][_0xc83f('0x49')](_0x5b030e[_0xc83f('0x4a')],{})['then'](respondWithResult(_0x40d941,0xc9))[_0xc83f('0x48')](handleError(_0x40d941,null));};exports['update']=function(_0x2f56ba,_0xa4c41e){if(_0x2f56ba['body']['id']){delete _0x2f56ba['body']['id'];}return db[_0xc83f('0x41')][_0xc83f('0x4b')]({'where':{'id':_0x2f56ba[_0xc83f('0x46')]['id']}})['then'](handleEntityNotFound(_0xa4c41e,null))[_0xc83f('0x26')](saveUpdates(_0x2f56ba[_0xc83f('0x4a')],null))[_0xc83f('0x26')](respondWithResult(_0xa4c41e,null))['catch'](handleError(_0xa4c41e,null));};exports[_0xc83f('0x4c')]=function(_0xaa07c6,_0x15f435){return db[_0xc83f('0x41')][_0xc83f('0x4b')]({'where':{'id':_0xaa07c6[_0xc83f('0x46')]['id']}})[_0xc83f('0x26')](handleEntityNotFound(_0x15f435,null))[_0xc83f('0x26')](removeEntity(_0x15f435,null))[_0xc83f('0x48')](handleError(_0x15f435,null));};exports['getFields']=function(_0x4c9b70,_0x483ba7,_0x38b4f0){var _0x2085ad={};var _0x5c4ea9={};var _0x367f3a;var _0x479c43;return db[_0xc83f('0x41')][_0xc83f('0x4d')]({'where':{'id':_0x4c9b70[_0xc83f('0x46')]['id']}})[_0xc83f('0x26')](handleEntityNotFound(_0x483ba7,null))[_0xc83f('0x26')](function(_0x4059df){if(_0x4059df){_0x367f3a=_0x4059df;_0x5c4ea9[_0xc83f('0x35')]=_[_0xc83f('0x32')](db[_0xc83f('0x4e')]['rawAttributes']);_0x5c4ea9[_0xc83f('0x31')]=_[_0xc83f('0x32')](_0x4c9b70[_0xc83f('0x31')]);_0x5c4ea9[_0xc83f('0x33')]=_[_0xc83f('0x34')](_0x5c4ea9['model'],_0x5c4ea9['query']);_0x2085ad[_0xc83f('0x37')]=_[_0xc83f('0x34')](_0x5c4ea9['model'],qs[_0xc83f('0x36')](_0x4c9b70[_0xc83f('0x31')][_0xc83f('0x36')]));_0x2085ad[_0xc83f('0x37')]=_0x2085ad[_0xc83f('0x37')][_0xc83f('0x38')]?_0x2085ad[_0xc83f('0x37')]:_0x5c4ea9[_0xc83f('0x35')];_0x2085ad['order']=qs[_0xc83f('0x3c')](_0x4c9b70[_0xc83f('0x31')][_0xc83f('0x3c')]);_0x2085ad[_0xc83f('0x3d')]=qs[_0xc83f('0x33')](_[_0xc83f('0x3e')](_0x4c9b70[_0xc83f('0x31')],_0x5c4ea9[_0xc83f('0x33')]));if(_0x4c9b70[_0xc83f('0x31')][_0xc83f('0x3f')]){_0x2085ad[_0xc83f('0x3d')]=_['merge'](_0x2085ad[_0xc83f('0x3d')],{'$or':_[_0xc83f('0x2d')](_0x2085ad[_0xc83f('0x37')],function(_0x577fba){var _0x52bc5a={};_0x52bc5a[_0x577fba]={'$like':'%'+_0x4c9b70[_0xc83f('0x31')][_0xc83f('0x3f')]+'%'};return _0x52bc5a;})});}_0x2085ad=_[_0xc83f('0x40')]({},_0x2085ad,_0x4c9b70[_0xc83f('0x47')]);return _0x367f3a[_0xc83f('0x4f')](_0x2085ad);}})[_0xc83f('0x26')](function(_0x383841){if(_0x383841){_0x479c43=_0x383841['length'];if(!_0x4c9b70['query'][_0xc83f('0x39')](_0xc83f('0x3a'))){_0x2085ad[_0xc83f('0x1f')]=qs[_0xc83f('0x1f')](_0x4c9b70[_0xc83f('0x31')][_0xc83f('0x1f')]);_0x2085ad[_0xc83f('0x1d')]=qs['offset'](_0x4c9b70[_0xc83f('0x31')][_0xc83f('0x1d')]);}return _0x367f3a['getFields'](_0x2085ad);}})[_0xc83f('0x26')](function(_0x47184c){if(_0x47184c){return _0x47184c?{'count':_0x479c43,'rows':_0x47184c}:null;}})[_0xc83f('0x26')](respondWithResult(_0x483ba7,null))[_0xc83f('0x48')](handleError(_0x483ba7,null));};exports[_0xc83f('0x50')]=function(_0x455eb3,_0xac6545,_0x5dcfab){var _0x3d9a21={};var _0x5d2468={};var _0x524729;var _0x468024;return db[_0xc83f('0x41')][_0xc83f('0x4d')]({'where':{'id':_0x455eb3[_0xc83f('0x46')]['id']}})[_0xc83f('0x26')](handleEntityNotFound(_0xac6545,null))[_0xc83f('0x26')](function(_0x541a75){if(_0x541a75){_0x524729=_0x541a75;_0x5d2468['model']=_[_0xc83f('0x32')](db[_0xc83f('0x4e')][_0xc83f('0x2e')]);_0x5d2468['query']=_[_0xc83f('0x32')](_0x455eb3[_0xc83f('0x31')]);_0x5d2468[_0xc83f('0x33')]=_[_0xc83f('0x34')](_0x5d2468[_0xc83f('0x35')],_0x5d2468['query']);_0x3d9a21['attributes']=_[_0xc83f('0x34')](_0x5d2468[_0xc83f('0x35')],qs[_0xc83f('0x36')](_0x455eb3[_0xc83f('0x31')][_0xc83f('0x36')]));_0x3d9a21[_0xc83f('0x37')]=_0x3d9a21[_0xc83f('0x37')]['length']?_0x3d9a21[_0xc83f('0x37')]:_0x5d2468[_0xc83f('0x35')];_0x3d9a21[_0xc83f('0x3b')]=qs[_0xc83f('0x3c')](_0x455eb3['query'][_0xc83f('0x3c')]);_0x3d9a21[_0xc83f('0x3d')]=qs[_0xc83f('0x33')](_['pick'](_0x455eb3[_0xc83f('0x31')],_0x5d2468[_0xc83f('0x33')]));if(_0x455eb3['query'][_0xc83f('0x3f')]){_0x3d9a21[_0xc83f('0x3d')]=_['merge'](_0x3d9a21[_0xc83f('0x3d')],{'$or':_[_0xc83f('0x2d')](_0x3d9a21[_0xc83f('0x37')],function(_0x37235d){var _0x11047f={};_0x11047f[_0x37235d]={'$like':'%'+_0x455eb3[_0xc83f('0x31')][_0xc83f('0x3f')]+'%'};return _0x11047f;})});}_0x3d9a21=_[_0xc83f('0x40')]({},_0x3d9a21,_0x455eb3[_0xc83f('0x47')]);return _0x524729['getSubjects'](_0x3d9a21);}})[_0xc83f('0x26')](function(_0x82b353){if(_0x82b353){_0x468024=_0x82b353[_0xc83f('0x38')];if(!_0x455eb3['query']['hasOwnProperty'](_0xc83f('0x3a'))){_0x3d9a21['limit']=qs[_0xc83f('0x1f')](_0x455eb3[_0xc83f('0x31')][_0xc83f('0x1f')]);_0x3d9a21['offset']=qs[_0xc83f('0x1d')](_0x455eb3['query']['offset']);}return _0x524729[_0xc83f('0x50')](_0x3d9a21);}})[_0xc83f('0x26')](function(_0x39e974){if(_0x39e974){return _0x39e974?{'count':_0x468024,'rows':_0x39e974}:null;}})['then'](respondWithResult(_0xac6545,null))[_0xc83f('0x48')](handleError(_0xac6545,null));};exports[_0xc83f('0x51')]=function(_0x72cdeb,_0x597bed,_0x416724){var _0x16163c={};var _0x11d9a4={};var _0x226e62;var _0x5ecebb;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x72cdeb[_0xc83f('0x46')]['id']}})[_0xc83f('0x26')](handleEntityNotFound(_0x597bed,null))[_0xc83f('0x26')](function(_0x51c877){if(_0x51c877){_0x226e62=_0x51c877;_0x11d9a4[_0xc83f('0x35')]=_[_0xc83f('0x32')](db[_0xc83f('0x4e')][_0xc83f('0x2e')]);_0x11d9a4[_0xc83f('0x31')]=_[_0xc83f('0x32')](_0x72cdeb['query']);_0x11d9a4[_0xc83f('0x33')]=_[_0xc83f('0x34')](_0x11d9a4['model'],_0x11d9a4[_0xc83f('0x31')]);_0x16163c[_0xc83f('0x37')]=_[_0xc83f('0x34')](_0x11d9a4['model'],qs['fields'](_0x72cdeb[_0xc83f('0x31')]['fields']));_0x16163c[_0xc83f('0x37')]=_0x16163c['attributes']['length']?_0x16163c[_0xc83f('0x37')]:_0x11d9a4['model'];_0x16163c[_0xc83f('0x3b')]=qs[_0xc83f('0x3c')](_0x72cdeb[_0xc83f('0x31')]['sort']);_0x16163c[_0xc83f('0x3d')]=qs['filters'](_[_0xc83f('0x3e')](_0x72cdeb[_0xc83f('0x31')],_0x11d9a4[_0xc83f('0x33')]));if(_0x72cdeb[_0xc83f('0x31')]['filter']){_0x16163c[_0xc83f('0x3d')]=_[_0xc83f('0x40')](_0x16163c[_0xc83f('0x3d')],{'$or':_[_0xc83f('0x2d')](_0x16163c[_0xc83f('0x37')],function(_0x37efc5){var _0xb895f4={};_0xb895f4[_0x37efc5]={'$like':'%'+_0x72cdeb['query'][_0xc83f('0x3f')]+'%'};return _0xb895f4;})});}_0x16163c=_[_0xc83f('0x40')]({},_0x16163c,_0x72cdeb[_0xc83f('0x47')]);return _0x226e62['getDescriptions'](_0x16163c);}})[_0xc83f('0x26')](function(_0x4f64d9){if(_0x4f64d9){_0x5ecebb=_0x4f64d9[_0xc83f('0x38')];if(!_0x72cdeb[_0xc83f('0x31')][_0xc83f('0x39')](_0xc83f('0x3a'))){_0x16163c[_0xc83f('0x1f')]=qs[_0xc83f('0x1f')](_0x72cdeb[_0xc83f('0x31')]['limit']);_0x16163c[_0xc83f('0x1d')]=qs[_0xc83f('0x1d')](_0x72cdeb[_0xc83f('0x31')]['offset']);}return _0x226e62['getDescriptions'](_0x16163c);}})['then'](function(_0x1550fe){if(_0x1550fe){return _0x1550fe?{'count':_0x5ecebb,'rows':_0x1550fe}:null;}})[_0xc83f('0x26')](respondWithResult(_0x597bed,null))[_0xc83f('0x48')](handleError(_0x597bed,null));}; \ No newline at end of file +var _0x9761=['find','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','length','create','body'];(function(_0x18fad4,_0xd83752){var _0xd84fb0=function(_0x36e0fe){while(--_0x36e0fe){_0x18fad4['push'](_0x18fad4['shift']());}};_0xd84fb0(++_0xd83752);}(_0x9761,0x1e6));var _0x1976=function(_0x3b4cd7,_0xf3c8fa){_0x3b4cd7=_0x3b4cd7-0x0;var _0x3899d6=_0x9761[_0x3b4cd7];return _0x3899d6;};'use strict';var emlformat=require(_0x1976('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1976('0x1'));var jsonpatch=require(_0x1976('0x2'));var rp=require('request-promise');var moment=require(_0x1976('0x3'));var BPromise=require(_0x1976('0x4'));var Mustache=require('mustache');var util=require(_0x1976('0x5'));var path=require('path');var sox=require(_0x1976('0x6'));var csv=require(_0x1976('0x7'));var ejs=require(_0x1976('0x8'));var fs=require('fs');var fs_extra=require(_0x1976('0x9'));var _=require(_0x1976('0xa'));var squel=require(_0x1976('0xb'));var crypto=require(_0x1976('0xc'));var jsforce=require(_0x1976('0xd'));var deskjs=require(_0x1976('0xe'));var toCsv=require(_0x1976('0x7'));var querystring=require(_0x1976('0xf'));var Papa=require('papaparse');var Redis=require(_0x1976('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1976('0x11'));var as=require(_0x1976('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1976('0x13'));var utils=require('../../config/utils');var config=require(_0x1976('0x14'));var licenseUtil=require(_0x1976('0x15'));var db=require(_0x1976('0x16'))['db'];function respondWithStatusCode(_0x32d365,_0x46f454){_0x46f454=_0x46f454||0xcc;return function(_0x35fe72){if(_0x35fe72){return _0x32d365['sendStatus'](_0x46f454);}return _0x32d365[_0x1976('0x17')](_0x46f454)[_0x1976('0x18')]();};}function respondWithResult(_0x50c9e2,_0x3ada25){_0x3ada25=_0x3ada25||0xc8;return function(_0x4c11da){if(_0x4c11da){return _0x50c9e2[_0x1976('0x17')](_0x3ada25)[_0x1976('0x19')](_0x4c11da);}};}function respondWithFilteredResult(_0x59cbc4,_0x35cd1c){return function(_0x551ab4){if(_0x551ab4){var _0x7d2561=typeof _0x35cd1c[_0x1976('0x1a')]===_0x1976('0x1b')&&typeof _0x35cd1c[_0x1976('0x1c')]===_0x1976('0x1b');var _0x26cf0d=_0x551ab4[_0x1976('0x1d')];var _0x181756=_0x7d2561?0x0:_0x35cd1c[_0x1976('0x1a')];var _0x32ce55=_0x7d2561?_0x551ab4[_0x1976('0x1d')]:_0x35cd1c[_0x1976('0x1a')]+_0x35cd1c[_0x1976('0x1c')];var _0x3fb158;if(_0x32ce55>=_0x26cf0d){_0x32ce55=_0x26cf0d;_0x3fb158=0xc8;}else{_0x3fb158=0xce;}_0x59cbc4[_0x1976('0x17')](_0x3fb158);return _0x59cbc4[_0x1976('0x1e')](_0x1976('0x1f'),_0x181756+'-'+_0x32ce55+'/'+_0x26cf0d)[_0x1976('0x19')](_0x551ab4);}return null;};}function patchUpdates(_0x13b181){return function(_0x360423){try{jsonpatch[_0x1976('0x20')](_0x360423,_0x13b181,!![]);}catch(_0x50b822){return BPromise[_0x1976('0x21')](_0x50b822);}return _0x360423[_0x1976('0x22')]();};}function saveUpdates(_0x28f83c,_0x45bc50){return function(_0x2fc396){if(_0x2fc396){return _0x2fc396[_0x1976('0x23')](_0x28f83c)[_0x1976('0x24')](function(_0x38e9ee){return _0x38e9ee;});}return null;};}function removeEntity(_0x1c2c3d,_0x1cb2a7){return function(_0x2542c6){if(_0x2542c6){return _0x2542c6[_0x1976('0x25')]()[_0x1976('0x24')](function(){_0x1c2c3d[_0x1976('0x17')](0xcc)[_0x1976('0x18')]();});}};}function handleEntityNotFound(_0x2858fc,_0x1c290e){return function(_0x21f42e){if(!_0x21f42e){_0x2858fc['sendStatus'](0x194);}return _0x21f42e;};}function handleError(_0x11b628,_0x5ed36b){_0x5ed36b=_0x5ed36b||0x1f4;return function(_0x53dedc){logger[_0x1976('0x26')](_0x53dedc[_0x1976('0x27')]);if(_0x53dedc[_0x1976('0x28')]){delete _0x53dedc['name'];}_0x11b628[_0x1976('0x17')](_0x5ed36b)[_0x1976('0x29')](_0x53dedc);};}exports[_0x1976('0x2a')]=function(_0x37b0c7,_0x15da69){var _0xbcdf10={},_0x14c6fd={},_0x55d27d={'count':0x0,'rows':[]};var _0x5aa50f=_[_0x1976('0x2b')](db[_0x1976('0x2c')][_0x1976('0x2d')],function(_0x24b75a){return{'name':_0x24b75a[_0x1976('0x2e')],'type':_0x24b75a[_0x1976('0x2f')][_0x1976('0x30')]};});_0x14c6fd[_0x1976('0x31')]=_[_0x1976('0x2b')](_0x5aa50f,'name');_0x14c6fd['query']=_['keys'](_0x37b0c7[_0x1976('0x32')]);_0x14c6fd[_0x1976('0x33')]=_['intersection'](_0x14c6fd['model'],_0x14c6fd['query']);_0xbcdf10[_0x1976('0x34')]=_[_0x1976('0x35')](_0x14c6fd[_0x1976('0x31')],qs[_0x1976('0x36')](_0x37b0c7[_0x1976('0x32')][_0x1976('0x36')]));_0xbcdf10[_0x1976('0x34')]=_0xbcdf10[_0x1976('0x34')]['length']?_0xbcdf10[_0x1976('0x34')]:_0x14c6fd[_0x1976('0x31')];if(!_0x37b0c7[_0x1976('0x32')][_0x1976('0x37')](_0x1976('0x38'))){_0xbcdf10['limit']=qs[_0x1976('0x1c')](_0x37b0c7[_0x1976('0x32')]['limit']);_0xbcdf10[_0x1976('0x1a')]=qs[_0x1976('0x1a')](_0x37b0c7[_0x1976('0x32')]['offset']);}_0xbcdf10[_0x1976('0x39')]=qs[_0x1976('0x3a')](_0x37b0c7['query']['sort']);_0xbcdf10[_0x1976('0x3b')]=qs[_0x1976('0x33')](_[_0x1976('0x3c')](_0x37b0c7[_0x1976('0x32')],_0x14c6fd[_0x1976('0x33')]),_0x5aa50f);if(_0x37b0c7[_0x1976('0x32')][_0x1976('0x3d')]){_0xbcdf10[_0x1976('0x3b')]=_[_0x1976('0x3e')](_0xbcdf10[_0x1976('0x3b')],{'$or':_[_0x1976('0x2b')](_0x5aa50f,function(_0x331dd4){if(_0x331dd4[_0x1976('0x2f')]!==_0x1976('0x3f')){var _0x555b3d={};_0x555b3d[_0x331dd4[_0x1976('0x28')]]={'$like':'%'+_0x37b0c7[_0x1976('0x32')]['filter']+'%'};return _0x555b3d;}})});}_0xbcdf10=_['merge']({},_0xbcdf10,_0x37b0c7[_0x1976('0x40')]);var _0x1edfae={'where':_0xbcdf10['where']};return db[_0x1976('0x2c')][_0x1976('0x1d')](_0x1edfae)[_0x1976('0x24')](function(_0x35ffda){_0x55d27d[_0x1976('0x1d')]=_0x35ffda;if(_0x37b0c7[_0x1976('0x32')]['includeAll']){_0xbcdf10[_0x1976('0x41')]=[{'all':!![]}];}return db[_0x1976('0x2c')][_0x1976('0x42')](_0xbcdf10);})[_0x1976('0x24')](function(_0x36dcdf){_0x55d27d[_0x1976('0x43')]=_0x36dcdf;return _0x55d27d;})[_0x1976('0x24')](respondWithFilteredResult(_0x15da69,_0xbcdf10))[_0x1976('0x44')](handleError(_0x15da69,null));};exports['show']=function(_0xf55283,_0xce3297){var _0x3bd8fc={'raw':![],'where':{'id':_0xf55283[_0x1976('0x45')]['id']}},_0xabe17={};_0xabe17[_0x1976('0x31')]=_[_0x1976('0x46')](db[_0x1976('0x2c')][_0x1976('0x2d')]);_0xabe17[_0x1976('0x32')]=_[_0x1976('0x46')](_0xf55283[_0x1976('0x32')]);_0xabe17['filters']=_[_0x1976('0x35')](_0xabe17[_0x1976('0x31')],_0xabe17[_0x1976('0x32')]);_0x3bd8fc[_0x1976('0x34')]=_['intersection'](_0xabe17[_0x1976('0x31')],qs['fields'](_0xf55283['query'][_0x1976('0x36')]));_0x3bd8fc['attributes']=_0x3bd8fc[_0x1976('0x34')][_0x1976('0x47')]?_0x3bd8fc['attributes']:_0xabe17['model'];if(_0xf55283[_0x1976('0x32')]['includeAll']){_0x3bd8fc[_0x1976('0x41')]=[{'all':!![]}];}_0x3bd8fc=_[_0x1976('0x3e')]({},_0x3bd8fc,_0xf55283['options']);return db[_0x1976('0x2c')]['find'](_0x3bd8fc)[_0x1976('0x24')](handleEntityNotFound(_0xce3297,null))['then'](respondWithResult(_0xce3297,null))[_0x1976('0x44')](handleError(_0xce3297,null));};exports[_0x1976('0x48')]=function(_0x1fd876,_0x3faa18){return db[_0x1976('0x2c')]['create'](_0x1fd876[_0x1976('0x49')],{})[_0x1976('0x24')](respondWithResult(_0x3faa18,0xc9))[_0x1976('0x44')](handleError(_0x3faa18,null));};exports['update']=function(_0x2c6280,_0x19e35c){if(_0x2c6280['body']['id']){delete _0x2c6280[_0x1976('0x49')]['id'];}return db[_0x1976('0x2c')][_0x1976('0x4a')]({'where':{'id':_0x2c6280[_0x1976('0x45')]['id']}})['then'](handleEntityNotFound(_0x19e35c,null))[_0x1976('0x24')](saveUpdates(_0x2c6280[_0x1976('0x49')],null))[_0x1976('0x24')](respondWithResult(_0x19e35c,null))['catch'](handleError(_0x19e35c,null));};exports[_0x1976('0x25')]=function(_0x120999,_0x11c409){return db[_0x1976('0x2c')]['find']({'where':{'id':_0x120999[_0x1976('0x45')]['id']}})[_0x1976('0x24')](handleEntityNotFound(_0x11c409,null))[_0x1976('0x24')](removeEntity(_0x11c409,null))['catch'](handleError(_0x11c409,null));};exports[_0x1976('0x4b')]=function(_0x105d95,_0x4dabb8,_0x3b3034){var _0x467f8b={};var _0x46ce69={};var _0x224f08;var _0x35c108;return db[_0x1976('0x2c')][_0x1976('0x4c')]({'where':{'id':_0x105d95['params']['id']}})[_0x1976('0x24')](handleEntityNotFound(_0x4dabb8,null))[_0x1976('0x24')](function(_0x11ac52){if(_0x11ac52){_0x224f08=_0x11ac52;_0x46ce69[_0x1976('0x31')]=_['keys'](db[_0x1976('0x4d')][_0x1976('0x2d')]);_0x46ce69['query']=_[_0x1976('0x46')](_0x105d95[_0x1976('0x32')]);_0x46ce69[_0x1976('0x33')]=_[_0x1976('0x35')](_0x46ce69[_0x1976('0x31')],_0x46ce69[_0x1976('0x32')]);_0x467f8b[_0x1976('0x34')]=_['intersection'](_0x46ce69['model'],qs[_0x1976('0x36')](_0x105d95[_0x1976('0x32')]['fields']));_0x467f8b[_0x1976('0x34')]=_0x467f8b[_0x1976('0x34')]['length']?_0x467f8b[_0x1976('0x34')]:_0x46ce69[_0x1976('0x31')];_0x467f8b[_0x1976('0x39')]=qs[_0x1976('0x3a')](_0x105d95[_0x1976('0x32')][_0x1976('0x3a')]);_0x467f8b[_0x1976('0x3b')]=qs['filters'](_[_0x1976('0x3c')](_0x105d95['query'],_0x46ce69[_0x1976('0x33')]));if(_0x105d95[_0x1976('0x32')][_0x1976('0x3d')]){_0x467f8b[_0x1976('0x3b')]=_[_0x1976('0x3e')](_0x467f8b[_0x1976('0x3b')],{'$or':_[_0x1976('0x2b')](_0x467f8b['attributes'],function(_0x357ca2){var _0xdc8477={};_0xdc8477[_0x357ca2]={'$like':'%'+_0x105d95[_0x1976('0x32')][_0x1976('0x3d')]+'%'};return _0xdc8477;})});}_0x467f8b=_[_0x1976('0x3e')]({},_0x467f8b,_0x105d95[_0x1976('0x40')]);return _0x224f08[_0x1976('0x4b')](_0x467f8b);}})['then'](function(_0x500c54){if(_0x500c54){_0x35c108=_0x500c54[_0x1976('0x47')];if(!_0x105d95[_0x1976('0x32')][_0x1976('0x37')](_0x1976('0x38'))){_0x467f8b[_0x1976('0x1c')]=qs[_0x1976('0x1c')](_0x105d95['query']['limit']);_0x467f8b[_0x1976('0x1a')]=qs[_0x1976('0x1a')](_0x105d95['query']['offset']);}return _0x224f08[_0x1976('0x4b')](_0x467f8b);}})[_0x1976('0x24')](function(_0x329356){if(_0x329356){return _0x329356?{'count':_0x35c108,'rows':_0x329356}:null;}})['then'](respondWithResult(_0x4dabb8,null))[_0x1976('0x44')](handleError(_0x4dabb8,null));};exports[_0x1976('0x4e')]=function(_0x11da45,_0x220235,_0x55c338){var _0x561775={};var _0x334716={};var _0x93592c;var _0x1d0fbf;return db['ServicenowConfiguration'][_0x1976('0x4c')]({'where':{'id':_0x11da45[_0x1976('0x45')]['id']}})['then'](handleEntityNotFound(_0x220235,null))[_0x1976('0x24')](function(_0xa3d006){if(_0xa3d006){_0x93592c=_0xa3d006;_0x334716[_0x1976('0x31')]=_[_0x1976('0x46')](db[_0x1976('0x4d')][_0x1976('0x2d')]);_0x334716[_0x1976('0x32')]=_[_0x1976('0x46')](_0x11da45[_0x1976('0x32')]);_0x334716['filters']=_[_0x1976('0x35')](_0x334716[_0x1976('0x31')],_0x334716[_0x1976('0x32')]);_0x561775[_0x1976('0x34')]=_[_0x1976('0x35')](_0x334716['model'],qs[_0x1976('0x36')](_0x11da45[_0x1976('0x32')][_0x1976('0x36')]));_0x561775[_0x1976('0x34')]=_0x561775[_0x1976('0x34')][_0x1976('0x47')]?_0x561775[_0x1976('0x34')]:_0x334716[_0x1976('0x31')];_0x561775[_0x1976('0x39')]=qs['sort'](_0x11da45[_0x1976('0x32')]['sort']);_0x561775[_0x1976('0x3b')]=qs[_0x1976('0x33')](_['pick'](_0x11da45[_0x1976('0x32')],_0x334716[_0x1976('0x33')]));if(_0x11da45['query']['filter']){_0x561775[_0x1976('0x3b')]=_['merge'](_0x561775['where'],{'$or':_[_0x1976('0x2b')](_0x561775[_0x1976('0x34')],function(_0x1375f3){var _0x38b842={};_0x38b842[_0x1375f3]={'$like':'%'+_0x11da45[_0x1976('0x32')][_0x1976('0x3d')]+'%'};return _0x38b842;})});}_0x561775=_[_0x1976('0x3e')]({},_0x561775,_0x11da45[_0x1976('0x40')]);return _0x93592c[_0x1976('0x4e')](_0x561775);}})['then'](function(_0x2040f0){if(_0x2040f0){_0x1d0fbf=_0x2040f0['length'];if(!_0x11da45['query'][_0x1976('0x37')](_0x1976('0x38'))){_0x561775[_0x1976('0x1c')]=qs[_0x1976('0x1c')](_0x11da45[_0x1976('0x32')][_0x1976('0x1c')]);_0x561775[_0x1976('0x1a')]=qs[_0x1976('0x1a')](_0x11da45[_0x1976('0x32')]['offset']);}return _0x93592c[_0x1976('0x4e')](_0x561775);}})[_0x1976('0x24')](function(_0x297177){if(_0x297177){return _0x297177?{'count':_0x1d0fbf,'rows':_0x297177}:null;}})[_0x1976('0x24')](respondWithResult(_0x220235,null))[_0x1976('0x44')](handleError(_0x220235,null));};exports[_0x1976('0x4f')]=function(_0x3e4b92,_0x27dc82,_0x539b87){var _0x12fb7a={};var _0x2960e7={};var _0x208819;var _0x26958e;return db[_0x1976('0x2c')][_0x1976('0x4c')]({'where':{'id':_0x3e4b92[_0x1976('0x45')]['id']}})[_0x1976('0x24')](handleEntityNotFound(_0x27dc82,null))[_0x1976('0x24')](function(_0x5b362e){if(_0x5b362e){_0x208819=_0x5b362e;_0x2960e7['model']=_[_0x1976('0x46')](db[_0x1976('0x4d')]['rawAttributes']);_0x2960e7[_0x1976('0x32')]=_[_0x1976('0x46')](_0x3e4b92['query']);_0x2960e7['filters']=_[_0x1976('0x35')](_0x2960e7[_0x1976('0x31')],_0x2960e7['query']);_0x12fb7a[_0x1976('0x34')]=_[_0x1976('0x35')](_0x2960e7[_0x1976('0x31')],qs[_0x1976('0x36')](_0x3e4b92['query']['fields']));_0x12fb7a['attributes']=_0x12fb7a[_0x1976('0x34')]['length']?_0x12fb7a['attributes']:_0x2960e7['model'];_0x12fb7a[_0x1976('0x39')]=qs[_0x1976('0x3a')](_0x3e4b92[_0x1976('0x32')][_0x1976('0x3a')]);_0x12fb7a[_0x1976('0x3b')]=qs['filters'](_[_0x1976('0x3c')](_0x3e4b92[_0x1976('0x32')],_0x2960e7['filters']));if(_0x3e4b92[_0x1976('0x32')]['filter']){_0x12fb7a[_0x1976('0x3b')]=_[_0x1976('0x3e')](_0x12fb7a[_0x1976('0x3b')],{'$or':_[_0x1976('0x2b')](_0x12fb7a['attributes'],function(_0xcfd793){var _0x383b54={};_0x383b54[_0xcfd793]={'$like':'%'+_0x3e4b92[_0x1976('0x32')][_0x1976('0x3d')]+'%'};return _0x383b54;})});}_0x12fb7a=_[_0x1976('0x3e')]({},_0x12fb7a,_0x3e4b92['options']);return _0x208819[_0x1976('0x4f')](_0x12fb7a);}})[_0x1976('0x24')](function(_0x335fae){if(_0x335fae){_0x26958e=_0x335fae[_0x1976('0x47')];if(!_0x3e4b92['query'][_0x1976('0x37')](_0x1976('0x38'))){_0x12fb7a[_0x1976('0x1c')]=qs['limit'](_0x3e4b92[_0x1976('0x32')][_0x1976('0x1c')]);_0x12fb7a[_0x1976('0x1a')]=qs[_0x1976('0x1a')](_0x3e4b92[_0x1976('0x32')]['offset']);}return _0x208819[_0x1976('0x4f')](_0x12fb7a);}})[_0x1976('0x24')](function(_0x3b411f){if(_0x3b411f){return _0x3b411f?{'count':_0x26958e,'rows':_0x3b411f}:null;}})['then'](respondWithResult(_0x27dc82,null))[_0x1976('0x44')](handleError(_0x27dc82,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7915213..b76aba9 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 _0xb12d=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xb12d,0x124));var _0xdb12=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0xb12d[_0x4afac5];return _0x2404b3;};'use strict';var _=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var logger=require(_0xdb12('0x2'))('api');var moment=require(_0xdb12('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb12('0x4'));var fs=require('fs');var path=require(_0xdb12('0x5'));var rimraf=require(_0xdb12('0x6'));var config=require(_0xdb12('0x7'));var attributes=require(_0xdb12('0x8'));module[_0xdb12('0x9')]=function(_0x4c69e0,_0x16666d){return _0x4c69e0[_0xdb12('0xa')](_0xdb12('0xb'),attributes,{'tableName':_0xdb12('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2868=['path','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','lodash','../../config/logger','api','bluebird'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x2868,0x191));var _0x8286=function(_0x2a712c,_0x3268bf){_0x2a712c=_0x2a712c-0x0;var _0xce6290=_0x2868[_0x2a712c];return _0xce6290;};'use strict';var _=require(_0x8286('0x0'));var util=require('util');var logger=require(_0x8286('0x1'))(_0x8286('0x2'));var moment=require('moment');var BPromise=require(_0x8286('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8286('0x4'));var rimraf=require('rimraf');var config=require(_0x8286('0x5'));var attributes=require(_0x8286('0x6'));module['exports']=function(_0xa1b0f9,_0x9a8dcd){return _0xa1b0f9[_0x8286('0x7')](_0x8286('0x8'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 5373edf..617db32 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 _0x5e0c=['stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x5e0c,0x19f));var _0xc5e0=function(_0xbcc6e1,_0x4c42f6){_0xbcc6e1=_0xbcc6e1-0x0;var _0x4985f9=_0x5e0c[_0xbcc6e1];return _0x4985f9;};'use strict';var _=require('lodash');var util=require(_0xc5e0('0x0'));var moment=require(_0xc5e0('0x1'));var BPromise=require(_0xc5e0('0x2'));var rs=require(_0xc5e0('0x3'));var fs=require('fs');var Redis=require(_0xc5e0('0x4'));var db=require(_0xc5e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5e0('0x6'))(_0xc5e0('0x7'));var config=require(_0xc5e0('0x8'));var jayson=require(_0xc5e0('0x9'));var client=jayson[_0xc5e0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b46de,_0x12b5cb,_0x59063b){return new BPromise(function(_0x33ee0b,_0x398b67){return client[_0xc5e0('0xb')](_0x4b46de,_0x59063b)[_0xc5e0('0xc')](function(_0x5ce913){logger[_0xc5e0('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x12b5cb,_0xc5e0('0xe'));logger[_0xc5e0('0xf')](_0xc5e0('0x10'),_0x12b5cb,_0xc5e0('0xe'),JSON[_0xc5e0('0x11')](_0x5ce913));if(_0x5ce913[_0xc5e0('0x12')]){if(_0x5ce913['error'][_0xc5e0('0x13')]===0x1f4){logger[_0xc5e0('0x12')](_0xc5e0('0x14'),_0x12b5cb,_0x5ce913[_0xc5e0('0x12')][_0xc5e0('0x15')]);return _0x398b67(_0x5ce913['error'][_0xc5e0('0x15')]);}logger[_0xc5e0('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x12b5cb,_0x5ce913['error'][_0xc5e0('0x15')]);return _0x33ee0b(_0x5ce913['error']['message']);}else{logger[_0xc5e0('0xd')](_0xc5e0('0x14'),_0x12b5cb,_0xc5e0('0xe'));_0x33ee0b(_0x5ce913[_0xc5e0('0x16')][_0xc5e0('0x15')]);}})[_0xc5e0('0x17')](function(_0x1667b9){logger[_0xc5e0('0x12')](_0xc5e0('0x14'),_0x12b5cb,_0x1667b9);_0x398b67(_0x1667b9);});});} \ No newline at end of file +var _0x9bb8=['../../config/environment','jayson/promise','http','then','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x6c36fb,_0x3ecadf){var _0x1a428b=function(_0xa06c49){while(--_0xa06c49){_0x6c36fb['push'](_0x6c36fb['shift']());}};_0x1a428b(++_0x3ecadf);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89bb('0x0'));var util=require(_0x89bb('0x1'));var moment=require(_0x89bb('0x2'));var BPromise=require(_0x89bb('0x3'));var rs=require(_0x89bb('0x4'));var fs=require('fs');var Redis=require(_0x89bb('0x5'));var db=require(_0x89bb('0x6'))['db'];var utils=require(_0x89bb('0x7'));var logger=require(_0x89bb('0x8'))(_0x89bb('0x9'));var config=require(_0x89bb('0xa'));var jayson=require(_0x89bb('0xb'));var client=jayson['client'][_0x89bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b9e11,_0x3d85a5,_0x39c0eb){return new BPromise(function(_0x288ad3,_0x392260){return client['request'](_0x1b9e11,_0x39c0eb)[_0x89bb('0xd')](function(_0x19a3fd){logger['info'](_0x89bb('0xe'),_0x3d85a5,'request\x20sent');logger[_0x89bb('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3d85a5,_0x89bb('0x10'),JSON['stringify'](_0x19a3fd));if(_0x19a3fd[_0x89bb('0x11')]){if(_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x12')]===0x1f4){logger[_0x89bb('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3d85a5,_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);return _0x392260(_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x3d85a5,_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);return _0x288ad3(_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);}else{logger[_0x89bb('0x14')](_0x89bb('0xe'),_0x3d85a5,'request\x20sent');_0x288ad3(_0x19a3fd[_0x89bb('0x15')][_0x89bb('0x13')]);}})['catch'](function(_0x1c7666){logger[_0x89bb('0x11')](_0x89bb('0xe'),_0x3d85a5,_0x1c7666);_0x392260(_0x1c7666);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 35b76c2..ae53541 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 _0x5794=['util','path','connect-timeout','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x34ade2,_0x68da98){var _0x7d9194=function(_0x3cb775){while(--_0x3cb775){_0x34ade2['push'](_0x34ade2['shift']());}};_0x7d9194(++_0x68da98);}(_0x5794,0x100));var _0x4579=function(_0x1efb41,_0x12b465){_0x1efb41=_0x1efb41-0x0;var _0x559431=_0x5794[_0x1efb41];return _0x559431;};'use strict';var multer=require('multer');var util=require(_0x4579('0x0'));var path=require(_0x4579('0x1'));var timeout=require(_0x4579('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4579('0x3'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x4579('0x4')](),controller[_0x4579('0x5')]);router[_0x4579('0x6')](_0x4579('0x7'),auth[_0x4579('0x4')](),controller[_0x4579('0x8')]);router[_0x4579('0x9')]('/',auth['isAuthenticated'](),controller[_0x4579('0xa')]);router[_0x4579('0xb')](_0x4579('0x7'),auth[_0x4579('0x4')](),controller[_0x4579('0xc')]);router[_0x4579('0xd')](_0x4579('0x7'),auth[_0x4579('0x4')](),controller[_0x4579('0xe')]);module[_0x4579('0xf')]=router; \ No newline at end of file +var _0xb7c8=['post','create','put','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','/:id','show'];(function(_0x53b23b,_0x1a9901){var _0x30b7df=function(_0xdfd8d1){while(--_0xdfd8d1){_0x53b23b['push'](_0x53b23b['shift']());}};_0x30b7df(++_0x1a9901);}(_0xb7c8,0x85));var _0x8b7c=function(_0x1b1b8c,_0x5635d3){_0x1b1b8c=_0x1b1b8c-0x0;var _0x32baff=_0xb7c8[_0x1b1b8c];return _0x32baff;};'use strict';var multer=require(_0x8b7c('0x0'));var util=require('util');var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8b7c('0x3'));var interaction=require(_0x8b7c('0x4'));var config=require(_0x8b7c('0x5'));var controller=require(_0x8b7c('0x6'));router['get']('/',auth[_0x8b7c('0x7')](),controller[_0x8b7c('0x8')]);router['get'](_0x8b7c('0x9'),auth[_0x8b7c('0x7')](),controller[_0x8b7c('0xa')]);router[_0x8b7c('0xb')]('/',auth[_0x8b7c('0x7')](),controller[_0x8b7c('0xc')]);router[_0x8b7c('0xd')](_0x8b7c('0x9'),auth[_0x8b7c('0x7')](),controller['update']);router[_0x8b7c('0xe')](_0x8b7c('0x9'),auth[_0x8b7c('0x7')](),controller[_0x8b7c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9c429f2..4233032 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 _0xac45=['variable','customVariable','keyValue','STRING','sequelize','ENUM','string'];(function(_0x352407,_0xdc87ed){var _0x27fe34=function(_0x33188e){while(--_0x33188e){_0x352407['push'](_0x352407['shift']());}};_0x27fe34(++_0xdc87ed);}(_0xac45,0x10e));var _0x5ac4=function(_0x11ebec,_0x656a15){_0x11ebec=_0x11ebec-0x0;var _0x5d0fa0=_0xac45[_0x11ebec];return _0x5d0fa0;};'use strict';var Sequelize=require(_0x5ac4('0x0'));module['exports']={'type':{'type':Sequelize[_0x5ac4('0x1')](_0x5ac4('0x2'),_0x5ac4('0x3'),_0x5ac4('0x4'),_0x5ac4('0x5'),'picklist'),'defaultValue':_0x5ac4('0x2')},'content':{'type':Sequelize[_0x5ac4('0x6')]},'key':{'type':Sequelize[_0x5ac4('0x6')]},'keyType':{'type':Sequelize[_0x5ac4('0x1')](_0x5ac4('0x2'),'variable',_0x5ac4('0x4'))},'keyContent':{'type':Sequelize[_0x5ac4('0x6')]},'idField':{'type':Sequelize[_0x5ac4('0x6')]},'nameField':{'type':Sequelize[_0x5ac4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ac4('0x6')]}}; \ No newline at end of file +var _0x6a7a=['string','variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x3d070e,_0x22d705){var _0x9b50fd=function(_0x2f06cf){while(--_0x2f06cf){_0x3d070e['push'](_0x3d070e['shift']());}};_0x9b50fd(++_0x22d705);}(_0x6a7a,0x8d));var _0xa6a7=function(_0x367637,_0x2b9905){_0x367637=_0x367637-0x0;var _0x8e839e=_0x6a7a[_0x367637];return _0x8e839e;};'use strict';var Sequelize=require(_0xa6a7('0x0'));module[_0xa6a7('0x1')]={'type':{'type':Sequelize[_0xa6a7('0x2')](_0xa6a7('0x3'),_0xa6a7('0x4'),_0xa6a7('0x5'),_0xa6a7('0x6'),'picklist'),'defaultValue':_0xa6a7('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa6a7('0x7')]},'keyType':{'type':Sequelize[_0xa6a7('0x2')](_0xa6a7('0x3'),_0xa6a7('0x4'),_0xa6a7('0x5'))},'keyContent':{'type':Sequelize[_0xa6a7('0x7')]},'idField':{'type':Sequelize[_0xa6a7('0x7')]},'nameField':{'type':Sequelize[_0xa6a7('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6a7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 59c6c83..18ef6e8 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 _0x7650=['catch','show','params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowField','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','findAll'];(function(_0x53e9c9,_0x1e1a75){var _0x4b5c89=function(_0x470b6c){while(--_0x470b6c){_0x53e9c9['push'](_0x53e9c9['shift']());}};_0x4b5c89(++_0x1e1a75);}(_0x7650,0x134));var _0x0765=function(_0x4cbda5,_0x5b85eb){_0x4cbda5=_0x4cbda5-0x0;var _0x30450e=_0x7650[_0x4cbda5];return _0x30450e;};'use strict';var emlformat=require(_0x0765('0x0'));var rimraf=require(_0x0765('0x1'));var zipdir=require(_0x0765('0x2'));var jsonpatch=require(_0x0765('0x3'));var rp=require('request-promise');var moment=require(_0x0765('0x4'));var BPromise=require(_0x0765('0x5'));var Mustache=require(_0x0765('0x6'));var util=require('util');var path=require(_0x0765('0x7'));var sox=require(_0x0765('0x8'));var csv=require(_0x0765('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0765('0xa'));var squel=require(_0x0765('0xb'));var crypto=require(_0x0765('0xc'));var jsforce=require(_0x0765('0xd'));var deskjs=require(_0x0765('0xe'));var toCsv=require(_0x0765('0x9'));var querystring=require(_0x0765('0xf'));var Papa=require(_0x0765('0x10'));var Redis=require(_0x0765('0x11'));var authService=require(_0x0765('0x12'));var qs=require(_0x0765('0x13'));var as=require(_0x0765('0x14'));var hardwareService=require(_0x0765('0x15'));var logger=require('../../config/logger')(_0x0765('0x16'));var utils=require(_0x0765('0x17'));var config=require(_0x0765('0x18'));var licenseUtil=require(_0x0765('0x19'));var db=require(_0x0765('0x1a'))['db'];function respondWithStatusCode(_0x1c606c,_0x2fcf62){_0x2fcf62=_0x2fcf62||0xcc;return function(_0x42a7cd){if(_0x42a7cd){return _0x1c606c['sendStatus'](_0x2fcf62);}return _0x1c606c[_0x0765('0x1b')](_0x2fcf62)['end']();};}function respondWithResult(_0x5c4151,_0x1f43b1){_0x1f43b1=_0x1f43b1||0xc8;return function(_0x9c3b15){if(_0x9c3b15){return _0x5c4151[_0x0765('0x1b')](_0x1f43b1)[_0x0765('0x1c')](_0x9c3b15);}};}function respondWithFilteredResult(_0x38a328,_0x2e8ac0){return function(_0xdb104){if(_0xdb104){var _0x4394c2=typeof _0x2e8ac0['offset']===_0x0765('0x1d')&&typeof _0x2e8ac0['limit']===_0x0765('0x1d');var _0x279986=_0xdb104[_0x0765('0x1e')];var _0x183e14=_0x4394c2?0x0:_0x2e8ac0[_0x0765('0x1f')];var _0x123c3a=_0x4394c2?_0xdb104[_0x0765('0x1e')]:_0x2e8ac0[_0x0765('0x1f')]+_0x2e8ac0['limit'];var _0xaab69c;if(_0x123c3a>=_0x279986){_0x123c3a=_0x279986;_0xaab69c=0xc8;}else{_0xaab69c=0xce;}_0x38a328[_0x0765('0x1b')](_0xaab69c);return _0x38a328[_0x0765('0x20')]('Content-Range',_0x183e14+'-'+_0x123c3a+'/'+_0x279986)[_0x0765('0x1c')](_0xdb104);}return null;};}function patchUpdates(_0x54a681){return function(_0x28d9f8){try{jsonpatch[_0x0765('0x21')](_0x28d9f8,_0x54a681,!![]);}catch(_0x1875f6){return BPromise[_0x0765('0x22')](_0x1875f6);}return _0x28d9f8[_0x0765('0x23')]();};}function saveUpdates(_0x728bb2,_0x32eb3a){return function(_0x10c36a){if(_0x10c36a){return _0x10c36a[_0x0765('0x24')](_0x728bb2)[_0x0765('0x25')](function(_0x18cf57){return _0x18cf57;});}return null;};}function removeEntity(_0xc590b8,_0x150d89){return function(_0x44f7e2){if(_0x44f7e2){return _0x44f7e2[_0x0765('0x26')]()[_0x0765('0x25')](function(){_0xc590b8[_0x0765('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x169f59,_0x308c3c){return function(_0x5a518c){if(!_0x5a518c){_0x169f59[_0x0765('0x27')](0x194);}return _0x5a518c;};}function handleError(_0x27410c,_0x230c81){_0x230c81=_0x230c81||0x1f4;return function(_0x840940){logger[_0x0765('0x28')](_0x840940[_0x0765('0x29')]);if(_0x840940[_0x0765('0x2a')]){delete _0x840940[_0x0765('0x2a')];}_0x27410c[_0x0765('0x1b')](_0x230c81)[_0x0765('0x2b')](_0x840940);};}exports[_0x0765('0x2c')]=function(_0x4fb2d7,_0x505ce3){var _0x5e18c5={},_0x40539f={},_0x4d4649={'count':0x0,'rows':[]};var _0x3e94c6=_[_0x0765('0x2d')](db[_0x0765('0x2e')]['rawAttributes'],function(_0x5be602){return{'name':_0x5be602[_0x0765('0x2f')],'type':_0x5be602['type']['key']};});_0x40539f[_0x0765('0x30')]=_[_0x0765('0x2d')](_0x3e94c6,_0x0765('0x2a'));_0x40539f[_0x0765('0x31')]=_[_0x0765('0x32')](_0x4fb2d7[_0x0765('0x31')]);_0x40539f[_0x0765('0x33')]=_[_0x0765('0x34')](_0x40539f[_0x0765('0x30')],_0x40539f[_0x0765('0x31')]);_0x5e18c5[_0x0765('0x35')]=_[_0x0765('0x34')](_0x40539f['model'],qs[_0x0765('0x36')](_0x4fb2d7['query'][_0x0765('0x36')]));_0x5e18c5[_0x0765('0x35')]=_0x5e18c5[_0x0765('0x35')][_0x0765('0x37')]?_0x5e18c5['attributes']:_0x40539f[_0x0765('0x30')];if(!_0x4fb2d7[_0x0765('0x31')][_0x0765('0x38')]('nolimit')){_0x5e18c5[_0x0765('0x39')]=qs[_0x0765('0x39')](_0x4fb2d7['query'][_0x0765('0x39')]);_0x5e18c5[_0x0765('0x1f')]=qs['offset'](_0x4fb2d7[_0x0765('0x31')][_0x0765('0x1f')]);}_0x5e18c5[_0x0765('0x3a')]=qs[_0x0765('0x3b')](_0x4fb2d7[_0x0765('0x31')][_0x0765('0x3b')]);_0x5e18c5['where']=qs['filters'](_[_0x0765('0x3c')](_0x4fb2d7[_0x0765('0x31')],_0x40539f[_0x0765('0x33')]),_0x3e94c6);if(_0x4fb2d7[_0x0765('0x31')][_0x0765('0x3d')]){_0x5e18c5[_0x0765('0x3e')]=_[_0x0765('0x3f')](_0x5e18c5['where'],{'$or':_[_0x0765('0x2d')](_0x3e94c6,function(_0x4aaad7){if(_0x4aaad7['type']!=='VIRTUAL'){var _0x32cc2d={};_0x32cc2d[_0x4aaad7['name']]={'$like':'%'+_0x4fb2d7['query'][_0x0765('0x3d')]+'%'};return _0x32cc2d;}})});}_0x5e18c5=_[_0x0765('0x3f')]({},_0x5e18c5,_0x4fb2d7[_0x0765('0x40')]);var _0x6b0236={'where':_0x5e18c5[_0x0765('0x3e')]};return db['ServicenowField']['count'](_0x6b0236)[_0x0765('0x25')](function(_0x569f31){_0x4d4649[_0x0765('0x1e')]=_0x569f31;if(_0x4fb2d7[_0x0765('0x31')][_0x0765('0x41')]){_0x5e18c5['include']=[{'all':!![]}];}return db[_0x0765('0x2e')][_0x0765('0x42')](_0x5e18c5);})[_0x0765('0x25')](function(_0x1400b1){_0x4d4649['rows']=_0x1400b1;return _0x4d4649;})[_0x0765('0x25')](respondWithFilteredResult(_0x505ce3,_0x5e18c5))[_0x0765('0x43')](handleError(_0x505ce3,null));};exports[_0x0765('0x44')]=function(_0x22913a,_0x4e194c){var _0x17a466={'raw':!![],'where':{'id':_0x22913a[_0x0765('0x45')]['id']}},_0x190531={};_0x190531[_0x0765('0x30')]=_[_0x0765('0x32')](db[_0x0765('0x2e')][_0x0765('0x46')]);_0x190531['query']=_[_0x0765('0x32')](_0x22913a[_0x0765('0x31')]);_0x190531[_0x0765('0x33')]=_['intersection'](_0x190531[_0x0765('0x30')],_0x190531[_0x0765('0x31')]);_0x17a466['attributes']=_[_0x0765('0x34')](_0x190531[_0x0765('0x30')],qs['fields'](_0x22913a['query'][_0x0765('0x36')]));_0x17a466['attributes']=_0x17a466[_0x0765('0x35')][_0x0765('0x37')]?_0x17a466['attributes']:_0x190531[_0x0765('0x30')];if(_0x22913a[_0x0765('0x31')]['includeAll']){_0x17a466[_0x0765('0x47')]=[{'all':!![]}];}_0x17a466=_['merge']({},_0x17a466,_0x22913a[_0x0765('0x40')]);return db[_0x0765('0x2e')]['find'](_0x17a466)[_0x0765('0x25')](handleEntityNotFound(_0x4e194c,null))[_0x0765('0x25')](respondWithResult(_0x4e194c,null))[_0x0765('0x43')](handleError(_0x4e194c,null));};exports[_0x0765('0x48')]=function(_0x50952f,_0x2f633c){return db[_0x0765('0x2e')][_0x0765('0x48')](_0x50952f[_0x0765('0x49')],{})[_0x0765('0x25')](respondWithResult(_0x2f633c,0xc9))['catch'](handleError(_0x2f633c,null));};exports[_0x0765('0x24')]=function(_0x594a80,_0x3fddfb){if(_0x594a80[_0x0765('0x49')]['id']){delete _0x594a80[_0x0765('0x49')]['id'];}return db['ServicenowField'][_0x0765('0x4a')]({'where':{'id':_0x594a80['params']['id']}})[_0x0765('0x25')](handleEntityNotFound(_0x3fddfb,null))[_0x0765('0x25')](saveUpdates(_0x594a80[_0x0765('0x49')],null))['then'](respondWithResult(_0x3fddfb,null))[_0x0765('0x43')](handleError(_0x3fddfb,null));};exports['destroy']=function(_0x506402,_0x5a0e69){return db['ServicenowField'][_0x0765('0x4a')]({'where':{'id':_0x506402[_0x0765('0x45')]['id']}})[_0x0765('0x25')](handleEntityNotFound(_0x5a0e69,null))[_0x0765('0x25')](removeEntity(_0x5a0e69,null))['catch'](handleError(_0x5a0e69,null));}; \ No newline at end of file +var _0x6444=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','offset','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','intersection','fields','find','create','body','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','path'];(function(_0x39174c,_0x147b9e){var _0x407757=function(_0x46a418){while(--_0x46a418){_0x39174c['push'](_0x39174c['shift']());}};_0x407757(++_0x147b9e);}(_0x6444,0x116));var _0x4644=function(_0x175479,_0x101985){_0x175479=_0x175479-0x0;var _0x224b3c=_0x6444[_0x175479];return _0x224b3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4644('0x0'));var zipdir=require(_0x4644('0x1'));var jsonpatch=require(_0x4644('0x2'));var rp=require(_0x4644('0x3'));var moment=require(_0x4644('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4644('0x5'));var sox=require(_0x4644('0x6'));var csv=require(_0x4644('0x7'));var ejs=require(_0x4644('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4644('0x9'));var squel=require('squel');var crypto=require(_0x4644('0xa'));var jsforce=require(_0x4644('0xb'));var deskjs=require(_0x4644('0xc'));var toCsv=require(_0x4644('0x7'));var querystring=require('querystring');var Papa=require(_0x4644('0xd'));var Redis=require(_0x4644('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4644('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4644('0x10'));var logger=require(_0x4644('0x11'))(_0x4644('0x12'));var utils=require(_0x4644('0x13'));var config=require(_0x4644('0x14'));var licenseUtil=require(_0x4644('0x15'));var db=require(_0x4644('0x16'))['db'];function respondWithStatusCode(_0x1f5bbe,_0x8a197f){_0x8a197f=_0x8a197f||0xcc;return function(_0xee0185){if(_0xee0185){return _0x1f5bbe[_0x4644('0x17')](_0x8a197f);}return _0x1f5bbe['status'](_0x8a197f)[_0x4644('0x18')]();};}function respondWithResult(_0x232808,_0x5cff55){_0x5cff55=_0x5cff55||0xc8;return function(_0x5ce6c7){if(_0x5ce6c7){return _0x232808[_0x4644('0x19')](_0x5cff55)['json'](_0x5ce6c7);}};}function respondWithFilteredResult(_0x2f5d26,_0x1a73d2){return function(_0x10eaf1){if(_0x10eaf1){var _0x52d3e5=typeof _0x1a73d2['offset']===_0x4644('0x1a')&&typeof _0x1a73d2['limit']===_0x4644('0x1a');var _0x331a44=_0x10eaf1[_0x4644('0x1b')];var _0x4809c7=_0x52d3e5?0x0:_0x1a73d2['offset'];var _0x336652=_0x52d3e5?_0x10eaf1['count']:_0x1a73d2['offset']+_0x1a73d2[_0x4644('0x1c')];var _0x521061;if(_0x336652>=_0x331a44){_0x336652=_0x331a44;_0x521061=0xc8;}else{_0x521061=0xce;}_0x2f5d26[_0x4644('0x19')](_0x521061);return _0x2f5d26[_0x4644('0x1d')](_0x4644('0x1e'),_0x4809c7+'-'+_0x336652+'/'+_0x331a44)[_0x4644('0x1f')](_0x10eaf1);}return null;};}function patchUpdates(_0x32f479){return function(_0x17e821){try{jsonpatch[_0x4644('0x20')](_0x17e821,_0x32f479,!![]);}catch(_0x508375){return BPromise['reject'](_0x508375);}return _0x17e821[_0x4644('0x21')]();};}function saveUpdates(_0x311557,_0x2899a0){return function(_0x513da9){if(_0x513da9){return _0x513da9[_0x4644('0x22')](_0x311557)['then'](function(_0x5b748b){return _0x5b748b;});}return null;};}function removeEntity(_0x501629,_0x51d904){return function(_0x43aaef){if(_0x43aaef){return _0x43aaef[_0x4644('0x23')]()[_0x4644('0x24')](function(){_0x501629[_0x4644('0x19')](0xcc)[_0x4644('0x18')]();});}};}function handleEntityNotFound(_0x1edfba,_0x5e4d76){return function(_0x550cd8){if(!_0x550cd8){_0x1edfba[_0x4644('0x17')](0x194);}return _0x550cd8;};}function handleError(_0x3e8404,_0x40c298){_0x40c298=_0x40c298||0x1f4;return function(_0x31ae1b){logger[_0x4644('0x25')](_0x31ae1b[_0x4644('0x26')]);if(_0x31ae1b[_0x4644('0x27')]){delete _0x31ae1b[_0x4644('0x27')];}_0x3e8404[_0x4644('0x19')](_0x40c298)['send'](_0x31ae1b);};}exports['index']=function(_0x4d6b18,_0x25deb9){var _0x25f63b={},_0x5555ac={},_0x33718c={'count':0x0,'rows':[]};var _0x45906a=_[_0x4644('0x28')](db[_0x4644('0x29')][_0x4644('0x2a')],function(_0x5ba823){return{'name':_0x5ba823[_0x4644('0x2b')],'type':_0x5ba823[_0x4644('0x2c')][_0x4644('0x2d')]};});_0x5555ac[_0x4644('0x2e')]=_['map'](_0x45906a,_0x4644('0x27'));_0x5555ac[_0x4644('0x2f')]=_[_0x4644('0x30')](_0x4d6b18['query']);_0x5555ac[_0x4644('0x31')]=_['intersection'](_0x5555ac[_0x4644('0x2e')],_0x5555ac[_0x4644('0x2f')]);_0x25f63b['attributes']=_['intersection'](_0x5555ac['model'],qs['fields'](_0x4d6b18['query']['fields']));_0x25f63b[_0x4644('0x32')]=_0x25f63b[_0x4644('0x32')][_0x4644('0x33')]?_0x25f63b[_0x4644('0x32')]:_0x5555ac[_0x4644('0x2e')];if(!_0x4d6b18[_0x4644('0x2f')][_0x4644('0x34')]('nolimit')){_0x25f63b[_0x4644('0x1c')]=qs['limit'](_0x4d6b18[_0x4644('0x2f')]['limit']);_0x25f63b[_0x4644('0x35')]=qs['offset'](_0x4d6b18['query']['offset']);}_0x25f63b['order']=qs[_0x4644('0x36')](_0x4d6b18['query'][_0x4644('0x36')]);_0x25f63b[_0x4644('0x37')]=qs[_0x4644('0x31')](_[_0x4644('0x38')](_0x4d6b18[_0x4644('0x2f')],_0x5555ac[_0x4644('0x31')]),_0x45906a);if(_0x4d6b18[_0x4644('0x2f')]['filter']){_0x25f63b[_0x4644('0x37')]=_[_0x4644('0x39')](_0x25f63b[_0x4644('0x37')],{'$or':_[_0x4644('0x28')](_0x45906a,function(_0x27b4c7){if(_0x27b4c7[_0x4644('0x2c')]!==_0x4644('0x3a')){var _0x16bb33={};_0x16bb33[_0x27b4c7['name']]={'$like':'%'+_0x4d6b18['query'][_0x4644('0x3b')]+'%'};return _0x16bb33;}})});}_0x25f63b=_['merge']({},_0x25f63b,_0x4d6b18[_0x4644('0x3c')]);var _0x37b383={'where':_0x25f63b['where']};return db['ServicenowField'][_0x4644('0x1b')](_0x37b383)[_0x4644('0x24')](function(_0x16272e){_0x33718c[_0x4644('0x1b')]=_0x16272e;if(_0x4d6b18[_0x4644('0x2f')][_0x4644('0x3d')]){_0x25f63b[_0x4644('0x3e')]=[{'all':!![]}];}return db[_0x4644('0x29')]['findAll'](_0x25f63b);})[_0x4644('0x24')](function(_0x24856f){_0x33718c[_0x4644('0x3f')]=_0x24856f;return _0x33718c;})[_0x4644('0x24')](respondWithFilteredResult(_0x25deb9,_0x25f63b))['catch'](handleError(_0x25deb9,null));};exports['show']=function(_0x371d1f,_0x5a35d1){var _0x372ad0={'raw':!![],'where':{'id':_0x371d1f['params']['id']}},_0xc21f4f={};_0xc21f4f['model']=_['keys'](db[_0x4644('0x29')]['rawAttributes']);_0xc21f4f[_0x4644('0x2f')]=_[_0x4644('0x30')](_0x371d1f[_0x4644('0x2f')]);_0xc21f4f[_0x4644('0x31')]=_[_0x4644('0x40')](_0xc21f4f[_0x4644('0x2e')],_0xc21f4f[_0x4644('0x2f')]);_0x372ad0[_0x4644('0x32')]=_[_0x4644('0x40')](_0xc21f4f[_0x4644('0x2e')],qs[_0x4644('0x41')](_0x371d1f[_0x4644('0x2f')][_0x4644('0x41')]));_0x372ad0[_0x4644('0x32')]=_0x372ad0['attributes'][_0x4644('0x33')]?_0x372ad0[_0x4644('0x32')]:_0xc21f4f[_0x4644('0x2e')];if(_0x371d1f[_0x4644('0x2f')]['includeAll']){_0x372ad0['include']=[{'all':!![]}];}_0x372ad0=_[_0x4644('0x39')]({},_0x372ad0,_0x371d1f['options']);return db['ServicenowField'][_0x4644('0x42')](_0x372ad0)[_0x4644('0x24')](handleEntityNotFound(_0x5a35d1,null))[_0x4644('0x24')](respondWithResult(_0x5a35d1,null))['catch'](handleError(_0x5a35d1,null));};exports[_0x4644('0x43')]=function(_0x45285c,_0x20299a){return db['ServicenowField'][_0x4644('0x43')](_0x45285c[_0x4644('0x44')],{})[_0x4644('0x24')](respondWithResult(_0x20299a,0xc9))[_0x4644('0x45')](handleError(_0x20299a,null));};exports[_0x4644('0x22')]=function(_0x38a57d,_0x1cea24){if(_0x38a57d[_0x4644('0x44')]['id']){delete _0x38a57d[_0x4644('0x44')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x38a57d['params']['id']}})['then'](handleEntityNotFound(_0x1cea24,null))['then'](saveUpdates(_0x38a57d[_0x4644('0x44')],null))[_0x4644('0x24')](respondWithResult(_0x1cea24,null))[_0x4644('0x45')](handleError(_0x1cea24,null));};exports[_0x4644('0x23')]=function(_0x27f50a,_0x12a425){return db[_0x4644('0x29')]['find']({'where':{'id':_0x27f50a[_0x4644('0x46')]['id']}})[_0x4644('0x24')](handleEntityNotFound(_0x12a425,null))['then'](removeEntity(_0x12a425,null))[_0x4644('0x45')](handleError(_0x12a425,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index caadbd6..5232246 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 _0xfea6=['request-promise','rimraf','../../config/environment','define','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','../../config/logger','moment','bluebird'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xfea6,0xb7));var _0x6fea=function(_0x57f757,_0x10bb57){_0x57f757=_0x57f757-0x0;var _0x90979f=_0xfea6[_0x57f757];return _0x90979f;};'use strict';var _=require(_0x6fea('0x0'));var util=require('util');var logger=require(_0x6fea('0x1'))('api');var moment=require(_0x6fea('0x2'));var BPromise=require(_0x6fea('0x3'));var rp=require(_0x6fea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fea('0x5'));var config=require(_0x6fea('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x4f4406,_0x24ddf6){return _0x4f4406[_0x6fea('0x7')]('ServicenowField',attributes,{'tableName':_0x6fea('0x8'),'paranoid':![],'indexes':[{'name':_0x6fea('0x9'),'fields':['idField',_0x6fea('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9017=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intServicenowField.attributes','ServicenowField'];(function(_0x4c158f,_0x52abc1){var _0x2e7474=function(_0x48ae2b){while(--_0x48ae2b){_0x4c158f['push'](_0x4c158f['shift']());}};_0x2e7474(++_0x52abc1);}(_0x9017,0x10e));var _0x7901=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9017[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7901('0x0'));var util=require(_0x7901('0x1'));var logger=require(_0x7901('0x2'))(_0x7901('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7901('0x4'));var fs=require('fs');var path=require(_0x7901('0x5'));var rimraf=require('rimraf');var config=require(_0x7901('0x6'));var attributes=require(_0x7901('0x7'));module['exports']=function(_0x4a3e17,_0x273e9c){return _0x4a3e17['define'](_0x7901('0x8'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','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 5be5a57..eac789d 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x3888e7,_0x9832ff){var _0x551617=function(_0x1e5e55){while(--_0x1e5e55){_0x3888e7['push'](_0x3888e7['shift']());}};_0x551617(++_0x9832ff);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0xcb91[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x20cabf,_0x1db98a){var _0xec410c=function(_0x3f49b9){while(--_0x3f49b9){_0x20cabf['push'](_0x20cabf['shift']());}};_0xec410c(++_0x1db98a);}(_0x70e0,0x17b));var _0x070e=function(_0xf88370,_0x33fcc6){_0xf88370=_0xf88370-0x0;var _0x383c88=_0x70e0[_0xf88370];return _0x383c88;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 987b83d..aa4120b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x32d56e,_0x4b7271){var _0x4db26c=function(_0x3272cd){while(--_0x3272cd){_0x32d56e['push'](_0x32d56e['shift']());}};_0x4db26c(++_0x4b7271);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2c6ccd,_0x2c3a69){var _0x2104de=function(_0x3b22b1){while(--_0x3b22b1){_0x2c6ccd['push'](_0x2c6ccd['shift']());}};_0x2104de(++_0x2c3a69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 9c36a32..735da5a 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(_0x1ad0fd,_0x1af73f){var _0x45c721=function(_0x573d5d){while(--_0x573d5d){_0x1ad0fd['push'](_0x1ad0fd['shift']());}};_0x45c721(++_0x1af73f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x5356f9,_0x258d3b){var _0x121cb6=function(_0x3f37c7){while(--_0x3f37c7){_0x5356f9['push'](_0x5356f9['shift']());}};_0x121cb6(++_0x258d3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 a67a3be..e234e8f 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 _0x8d64=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','format','%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','stringify','Calls','values','module_fields','remove','label','endsWith','value','statusCode','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x4cb640,_0x54d047){var _0x45f980=function(_0x1c19b0){while(--_0x1c19b0){_0x4cb640['push'](_0x4cb640['shift']());}};_0x45f980(++_0x54d047);}(_0x8d64,0xea));var _0x48d6=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x8d64[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x48d6('0x0'));var rimraf=require(_0x48d6('0x1'));var zipdir=require(_0x48d6('0x2'));var jsonpatch=require(_0x48d6('0x3'));var rp=require(_0x48d6('0x4'));var moment=require(_0x48d6('0x5'));var BPromise=require(_0x48d6('0x6'));var Mustache=require(_0x48d6('0x7'));var util=require('util');var path=require(_0x48d6('0x8'));var sox=require(_0x48d6('0x9'));var csv=require('to-csv');var ejs=require(_0x48d6('0xa'));var fs=require('fs');var fs_extra=require(_0x48d6('0xb'));var _=require(_0x48d6('0xc'));var squel=require(_0x48d6('0xd'));var crypto=require(_0x48d6('0xe'));var jsforce=require(_0x48d6('0xf'));var deskjs=require(_0x48d6('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x48d6('0x11'));var Redis=require(_0x48d6('0x12'));var authService=require(_0x48d6('0x13'));var qs=require(_0x48d6('0x14'));var as=require(_0x48d6('0x15'));var hardwareService=require(_0x48d6('0x16'));var logger=require(_0x48d6('0x17'))('api');var utils=require(_0x48d6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x48d6('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x48d6('0x1a'));function respondWithStatusCode(_0x4b2c7d,_0x474373){_0x474373=_0x474373||0xcc;return function(_0x40c8f6){if(_0x40c8f6){return _0x4b2c7d[_0x48d6('0x1b')](_0x474373);}return _0x4b2c7d[_0x48d6('0x1c')](_0x474373)[_0x48d6('0x1d')]();};}function respondWithResult(_0x42e570,_0x16754d){_0x16754d=_0x16754d||0xc8;return function(_0x29f7f6){if(_0x29f7f6){return _0x42e570[_0x48d6('0x1c')](_0x16754d)[_0x48d6('0x1e')](_0x29f7f6);}};}function respondWithFilteredResult(_0x276fa1,_0x14660b){return function(_0x436c23){if(_0x436c23){var _0x1bfebc=typeof _0x14660b['offset']==='undefined'&&typeof _0x14660b['limit']===_0x48d6('0x1f');var _0x470487=_0x436c23[_0x48d6('0x20')];var _0x1917e7=_0x1bfebc?0x0:_0x14660b[_0x48d6('0x21')];var _0x2eb2cf=_0x1bfebc?_0x436c23[_0x48d6('0x20')]:_0x14660b[_0x48d6('0x21')]+_0x14660b[_0x48d6('0x22')];var _0x33e7dc;if(_0x2eb2cf>=_0x470487){_0x2eb2cf=_0x470487;_0x33e7dc=0xc8;}else{_0x33e7dc=0xce;}_0x276fa1[_0x48d6('0x1c')](_0x33e7dc);return _0x276fa1[_0x48d6('0x23')](_0x48d6('0x24'),_0x1917e7+'-'+_0x2eb2cf+'/'+_0x470487)[_0x48d6('0x1e')](_0x436c23);}return null;};}function patchUpdates(_0x2e6bd4){return function(_0x21c105){try{jsonpatch[_0x48d6('0x25')](_0x21c105,_0x2e6bd4,!![]);}catch(_0x5e5b76){return BPromise[_0x48d6('0x26')](_0x5e5b76);}return _0x21c105['save']();};}function saveUpdates(_0x523bda,_0x49170c){return function(_0x3b9e50){if(_0x3b9e50){return _0x3b9e50['update'](_0x523bda)[_0x48d6('0x27')](function(_0x51a71a){return _0x51a71a;});}return null;};}function removeEntity(_0x69318c,_0x3a2b93){return function(_0x329f0e){if(_0x329f0e){return _0x329f0e[_0x48d6('0x28')]()[_0x48d6('0x27')](function(){_0x69318c[_0x48d6('0x1c')](0xcc)[_0x48d6('0x1d')]();});}};}function handleEntityNotFound(_0x2e32af,_0x5f2fe7){return function(_0x4566b7){if(!_0x4566b7){_0x2e32af[_0x48d6('0x1b')](0x194);}return _0x4566b7;};}function handleError(_0x101f6c,_0x5cbccf){_0x5cbccf=_0x5cbccf||0x1f4;return function(_0x2cf5b4){logger[_0x48d6('0x29')](_0x2cf5b4[_0x48d6('0x2a')]);if(_0x2cf5b4[_0x48d6('0x2b')]){delete _0x2cf5b4['name'];}_0x101f6c['status'](_0x5cbccf)['send'](_0x2cf5b4);};}exports['index']=function(_0x4cd0f1,_0x181ca5){var _0x3cf5e0={},_0x4de603={},_0x435913={'count':0x0,'rows':[]};var _0x26d313=_[_0x48d6('0x2c')](db['SugarcrmAccount'][_0x48d6('0x2d')],function(_0x2c2604){return{'name':_0x2c2604['fieldName'],'type':_0x2c2604[_0x48d6('0x2e')][_0x48d6('0x2f')]};});_0x4de603[_0x48d6('0x30')]=_['map'](_0x26d313,_0x48d6('0x2b'));_0x4de603[_0x48d6('0x31')]=_[_0x48d6('0x32')](_0x4cd0f1[_0x48d6('0x31')]);_0x4de603[_0x48d6('0x33')]=_[_0x48d6('0x34')](_0x4de603[_0x48d6('0x30')],_0x4de603[_0x48d6('0x31')]);_0x3cf5e0[_0x48d6('0x35')]=_['intersection'](_0x4de603[_0x48d6('0x30')],qs[_0x48d6('0x36')](_0x4cd0f1[_0x48d6('0x31')][_0x48d6('0x36')]));_0x3cf5e0[_0x48d6('0x35')]=_0x3cf5e0[_0x48d6('0x35')][_0x48d6('0x37')]?_0x3cf5e0['attributes']:_0x4de603[_0x48d6('0x30')];if(!_0x4cd0f1[_0x48d6('0x31')][_0x48d6('0x38')](_0x48d6('0x39'))){_0x3cf5e0[_0x48d6('0x22')]=qs[_0x48d6('0x22')](_0x4cd0f1['query'][_0x48d6('0x22')]);_0x3cf5e0['offset']=qs[_0x48d6('0x21')](_0x4cd0f1[_0x48d6('0x31')][_0x48d6('0x21')]);}_0x3cf5e0[_0x48d6('0x3a')]=qs[_0x48d6('0x3b')](_0x4cd0f1[_0x48d6('0x31')]['sort']);_0x3cf5e0[_0x48d6('0x3c')]=qs[_0x48d6('0x33')](_[_0x48d6('0x3d')](_0x4cd0f1[_0x48d6('0x31')],_0x4de603['filters']),_0x26d313);if(_0x4cd0f1[_0x48d6('0x31')]['filter']){_0x3cf5e0[_0x48d6('0x3c')]=_[_0x48d6('0x3e')](_0x3cf5e0[_0x48d6('0x3c')],{'$or':_['map'](_0x26d313,function(_0x4cd443){if(_0x4cd443[_0x48d6('0x2e')]!==_0x48d6('0x3f')){var _0x39e132={};_0x39e132[_0x4cd443[_0x48d6('0x2b')]]={'$like':'%'+_0x4cd0f1['query'][_0x48d6('0x40')]+'%'};return _0x39e132;}})});}_0x3cf5e0=_['merge']({},_0x3cf5e0,_0x4cd0f1[_0x48d6('0x41')]);var _0x10c4ac={'where':_0x3cf5e0['where']};return db[_0x48d6('0x42')][_0x48d6('0x20')](_0x10c4ac)[_0x48d6('0x27')](function(_0xc3b8e7){_0x435913[_0x48d6('0x20')]=_0xc3b8e7;if(_0x4cd0f1[_0x48d6('0x31')][_0x48d6('0x43')]){_0x3cf5e0[_0x48d6('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x48d6('0x45')](_0x3cf5e0);})[_0x48d6('0x27')](function(_0x585c67){_0x435913[_0x48d6('0x46')]=_0x585c67;return _0x435913;})[_0x48d6('0x27')](respondWithFilteredResult(_0x181ca5,_0x3cf5e0))[_0x48d6('0x47')](handleError(_0x181ca5,null));};exports[_0x48d6('0x48')]=function(_0x4ef230,_0x630375){var _0x250411={'raw':![],'where':{'id':_0x4ef230[_0x48d6('0x49')]['id']}},_0x3c0f62={};_0x3c0f62[_0x48d6('0x30')]=_[_0x48d6('0x32')](db['SugarcrmAccount'][_0x48d6('0x2d')]);_0x3c0f62[_0x48d6('0x31')]=_[_0x48d6('0x32')](_0x4ef230[_0x48d6('0x31')]);_0x3c0f62['filters']=_['intersection'](_0x3c0f62[_0x48d6('0x30')],_0x3c0f62[_0x48d6('0x31')]);_0x250411[_0x48d6('0x35')]=_['intersection'](_0x3c0f62['model'],qs[_0x48d6('0x36')](_0x4ef230[_0x48d6('0x31')]['fields']));_0x250411[_0x48d6('0x35')]=_0x250411['attributes'][_0x48d6('0x37')]?_0x250411[_0x48d6('0x35')]:_0x3c0f62[_0x48d6('0x30')];if(_0x4ef230['query'][_0x48d6('0x43')]){_0x250411[_0x48d6('0x44')]=[{'all':!![]}];}_0x250411=_[_0x48d6('0x3e')]({},_0x250411,_0x4ef230[_0x48d6('0x41')]);return db[_0x48d6('0x42')][_0x48d6('0x4a')](_0x250411)[_0x48d6('0x27')](handleEntityNotFound(_0x630375,null))[_0x48d6('0x27')](respondWithResult(_0x630375,null))['catch'](handleError(_0x630375,null));};exports[_0x48d6('0x4b')]=function(_0x12a028,_0x1b382f){return db[_0x48d6('0x42')]['create'](_0x12a028[_0x48d6('0x4c')],{})[_0x48d6('0x27')](respondWithResult(_0x1b382f,0xc9))[_0x48d6('0x47')](handleError(_0x1b382f,null));};exports[_0x48d6('0x4d')]=function(_0x18c531,_0x1751a4){if(_0x18c531[_0x48d6('0x4c')]['id']){delete _0x18c531[_0x48d6('0x4c')]['id'];}return db[_0x48d6('0x42')][_0x48d6('0x4a')]({'where':{'id':_0x18c531[_0x48d6('0x49')]['id']}})['then'](handleEntityNotFound(_0x1751a4,null))[_0x48d6('0x27')](saveUpdates(_0x18c531[_0x48d6('0x4c')],null))['then'](respondWithResult(_0x1751a4,null))['catch'](handleError(_0x1751a4,null));};exports[_0x48d6('0x28')]=function(_0x550b3a,_0x1561d9){return db[_0x48d6('0x42')][_0x48d6('0x4a')]({'where':{'id':_0x550b3a[_0x48d6('0x49')]['id']}})[_0x48d6('0x27')](handleEntityNotFound(_0x1561d9,null))[_0x48d6('0x27')](removeEntity(_0x1561d9,null))[_0x48d6('0x47')](handleError(_0x1561d9,null));};exports[_0x48d6('0x4e')]=function(_0x50ed94,_0xe572be,_0x13f6b6){var _0x2353fa={};var _0x27e527={};var _0x531b27;var _0x4f3110;return db[_0x48d6('0x42')][_0x48d6('0x4f')]({'where':{'id':_0x50ed94['params']['id']}})['then'](handleEntityNotFound(_0xe572be,null))[_0x48d6('0x27')](function(_0x5e29ab){if(_0x5e29ab){_0x531b27=_0x5e29ab;_0x27e527[_0x48d6('0x30')]=_[_0x48d6('0x32')](db['SugarcrmConfiguration']['rawAttributes']);_0x27e527[_0x48d6('0x31')]=_[_0x48d6('0x32')](_0x50ed94[_0x48d6('0x31')]);_0x27e527[_0x48d6('0x33')]=_[_0x48d6('0x34')](_0x27e527[_0x48d6('0x30')],_0x27e527['query']);_0x2353fa[_0x48d6('0x35')]=_[_0x48d6('0x34')](_0x27e527['model'],qs[_0x48d6('0x36')](_0x50ed94['query'][_0x48d6('0x36')]));_0x2353fa[_0x48d6('0x35')]=_0x2353fa['attributes']['length']?_0x2353fa['attributes']:_0x27e527[_0x48d6('0x30')];_0x2353fa[_0x48d6('0x3a')]=qs[_0x48d6('0x3b')](_0x50ed94[_0x48d6('0x31')]['sort']);_0x2353fa[_0x48d6('0x3c')]=qs[_0x48d6('0x33')](_[_0x48d6('0x3d')](_0x50ed94['query'],_0x27e527[_0x48d6('0x33')]));if(_0x50ed94['query']['filter']){_0x2353fa[_0x48d6('0x3c')]=_[_0x48d6('0x3e')](_0x2353fa['where'],{'$or':_[_0x48d6('0x2c')](_0x2353fa[_0x48d6('0x35')],function(_0x3fe9e7){var _0x4c4c05={};_0x4c4c05[_0x3fe9e7]={'$like':'%'+_0x50ed94[_0x48d6('0x31')][_0x48d6('0x40')]+'%'};return _0x4c4c05;})});}_0x2353fa=_['merge']({},_0x2353fa,_0x50ed94[_0x48d6('0x41')]);return _0x531b27['getConfigurations'](_0x2353fa);}})['then'](function(_0x41ac7f){if(_0x41ac7f){_0x4f3110=_0x41ac7f[_0x48d6('0x37')];if(!_0x50ed94[_0x48d6('0x31')][_0x48d6('0x38')](_0x48d6('0x39'))){_0x2353fa[_0x48d6('0x22')]=qs[_0x48d6('0x22')](_0x50ed94['query']['limit']);_0x2353fa[_0x48d6('0x21')]=qs[_0x48d6('0x21')](_0x50ed94[_0x48d6('0x31')][_0x48d6('0x21')]);}return _0x531b27[_0x48d6('0x4e')](_0x2353fa);}})[_0x48d6('0x27')](function(_0x5d73d3){if(_0x5d73d3){return _0x5d73d3?{'count':_0x4f3110,'rows':_0x5d73d3}:null;}})[_0x48d6('0x27')](respondWithResult(_0xe572be,null))[_0x48d6('0x47')](handleError(_0xe572be,null));};exports[_0x48d6('0x50')]=function(_0x463218,_0x47f82b,_0x5283d9){if(_0x463218[_0x48d6('0x4c')]['id']){delete _0x463218[_0x48d6('0x4c')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x463218[_0x48d6('0x49')]['id']}})['then'](handleEntityNotFound(_0x47f82b,null))['then'](function(_0x3066ce){if(_0x3066ce){_0x463218[_0x48d6('0x4c')][_0x48d6('0x51')]=_0x3066ce['id'];_0x463218[_0x48d6('0x4c')][_0x48d6('0x52')]=integrations[_0x48d6('0x53')](_0x463218[_0x48d6('0x4c')][_0x48d6('0x54')],_0x463218[_0x48d6('0x4c')][_0x48d6('0x2e')]);_0x463218[_0x48d6('0x4c')][_0x48d6('0x55')]=integrations[_0x48d6('0x56')](_0x463218[_0x48d6('0x4c')]['channel'],_0x463218[_0x48d6('0x4c')][_0x48d6('0x2e')]);return db[_0x48d6('0x57')][_0x48d6('0x4b')](_0x463218['body'],{'include':[{'model':db[_0x48d6('0x58')],'as':_0x48d6('0x52')},{'model':db[_0x48d6('0x58')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x47f82b,null))[_0x48d6('0x47')](handleError(_0x47f82b,null));};exports[_0x48d6('0x59')]=function(_0x291d41,_0x1ea190,_0x3c6467){var _0x260754='';var _0x585978=['id',_0x48d6('0x2b'),_0x48d6('0x5a'),_0x48d6('0x5b'),_0x48d6('0x5c'),_0x48d6('0x5d'),_0x48d6('0x5e'),_0x48d6('0x5f'),_0x48d6('0x60'),_0x48d6('0x61'),_0x48d6('0x62'),_0x48d6('0x63')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x291d41[_0x48d6('0x49')]['id']},'attributes':['id',_0x48d6('0x64'),_0x48d6('0x65'),_0x48d6('0x66')]})[_0x48d6('0x27')](handleEntityNotFound(_0x1ea190,null))[_0x48d6('0x27')](function(_0x2cdc5e){if(_0x2cdc5e){_0x260754=_0x2cdc5e[_0x48d6('0x66')];var _0x40f40e=_0x260754[_0x48d6('0x67')](-0x1);if(_0x40f40e==='/'){_0x260754=_0x260754[_0x48d6('0x68')](0x0,_0x260754['lastIndexOf'](_0x40f40e));}return rp({'method':'POST','uri':util[_0x48d6('0x69')](_0x48d6('0x6a'),_0x260754,_0x48d6('0x6b')),'json':!![],'form':{'method':_0x48d6('0x6c'),'input_type':_0x48d6('0x6d'),'response_type':_0x48d6('0x6d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2cdc5e['username'],'password':_0x2cdc5e[_0x48d6('0x65')],'encryption':'PLAIN'},'application':_0x48d6('0x6e')})}});}})['then'](function(_0x48bf70){if(_0x48bf70&&_0x48bf70[_0x48d6('0x2b')]!==_0x48d6('0x6f')&&_0x48bf70['name']!==_0x48d6('0x70')){return rp({'method':_0x48d6('0x71'),'uri':util[_0x48d6('0x69')](_0x48d6('0x6a'),_0x260754,_0x48d6('0x6b')),'json':!![],'form':{'method':_0x48d6('0x72'),'input_type':_0x48d6('0x6d'),'response_type':'JSON','rest_data':JSON[_0x48d6('0x73')]({'session':_0x48bf70['id'],'module_name':_0x48d6('0x74')})}})['then'](function(_0x57dd98){if(_0x57dd98){var _0x119441=_[_0x48d6('0x75')](_0x57dd98[_0x48d6('0x76')]);_[_0x48d6('0x77')](_0x119441,function(_0x3c4dcd){return _0x585978['includes'](_0x3c4dcd[_0x48d6('0x2b')]);});return{'count':_0x119441[_0x48d6('0x37')],'rows':_[_0x48d6('0x2c')](_0x119441,function(_0x58672f){return{'id':_0x58672f[_0x48d6('0x2b')],'name':_0x58672f[_0x48d6('0x78')],'custom':_[_0x48d6('0x79')](_0x58672f['name'],'_c')?!![]:![],'options':_0x58672f[_0x48d6('0x41')]?_[_0x48d6('0x2c')](_[_0x48d6('0x75')](_0x58672f[_0x48d6('0x41')]),function(_0x6bbdab){return{'name':_0x6bbdab[_0x48d6('0x7a')],'value':_0x6bbdab[_0x48d6('0x2b')]};}):[]};})};}})[_0x48d6('0x27')](respondWithResult(_0x1ea190,null))[_0x48d6('0x47')](function(_0x3da29a){var _0xcef378=_0x291d41[_0x48d6('0x31')]['test']?0x1f4:_0x3da29a[_0x48d6('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xcef378,JSON[_0x48d6('0x73')](_0x3da29a));delete _0x3da29a['name'];if(_0xcef378===0x191){_0xcef378=0x190;}_0x1ea190[_0x48d6('0x1c')](_0xcef378)[_0x48d6('0x7c')](_0x291d41[_0x48d6('0x31')][_0x48d6('0x7d')]?{'message':_0x48d6('0x7e'),'statusCode':_0x3da29a[_0x48d6('0x7b')]}:_0x3da29a);});}else{var _0x191ff8=0x1f4;_0x1ea190[_0x48d6('0x1c')](_0x191ff8)['send']({'message':_0x48d6('0x7e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xcb31=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','keys','filters','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','params','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','value','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','papaparse','ioredis','../../components/auth/service'];(function(_0x5f34ad,_0x19f168){var _0x29970e=function(_0x5a8d5c){while(--_0x5a8d5c){_0x5f34ad['push'](_0x5f34ad['shift']());}};_0x29970e(++_0x19f168);}(_0xcb31,0x149));var _0x1cb3=function(_0x4736bc,_0x3db411){_0x4736bc=_0x4736bc-0x0;var _0x1a237d=_0xcb31[_0x4736bc];return _0x1a237d;};'use strict';var emlformat=require(_0x1cb3('0x0'));var rimraf=require(_0x1cb3('0x1'));var zipdir=require(_0x1cb3('0x2'));var jsonpatch=require(_0x1cb3('0x3'));var rp=require(_0x1cb3('0x4'));var moment=require(_0x1cb3('0x5'));var BPromise=require(_0x1cb3('0x6'));var Mustache=require('mustache');var util=require(_0x1cb3('0x7'));var path=require(_0x1cb3('0x8'));var sox=require(_0x1cb3('0x9'));var csv=require(_0x1cb3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1cb3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cb3('0xd'));var Redis=require(_0x1cb3('0xe'));var authService=require(_0x1cb3('0xf'));var qs=require(_0x1cb3('0x10'));var as=require(_0x1cb3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cb3('0x12'))(_0x1cb3('0x13'));var utils=require(_0x1cb3('0x14'));var config=require(_0x1cb3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cb3('0x16'))['db'];var integrations=require(_0x1cb3('0x17'));function respondWithStatusCode(_0x40bd04,_0x2d90de){_0x2d90de=_0x2d90de||0xcc;return function(_0x3edfb3){if(_0x3edfb3){return _0x40bd04[_0x1cb3('0x18')](_0x2d90de);}return _0x40bd04[_0x1cb3('0x19')](_0x2d90de)[_0x1cb3('0x1a')]();};}function respondWithResult(_0x504023,_0x5dd514){_0x5dd514=_0x5dd514||0xc8;return function(_0x214f3a){if(_0x214f3a){return _0x504023[_0x1cb3('0x19')](_0x5dd514)[_0x1cb3('0x1b')](_0x214f3a);}};}function respondWithFilteredResult(_0x129f69,_0x1e6173){return function(_0x246745){if(_0x246745){var _0x353ef8=typeof _0x1e6173[_0x1cb3('0x1c')]===_0x1cb3('0x1d')&&typeof _0x1e6173[_0x1cb3('0x1e')]===_0x1cb3('0x1d');var _0x524640=_0x246745[_0x1cb3('0x1f')];var _0x5d9ba3=_0x353ef8?0x0:_0x1e6173['offset'];var _0x3cdfbf=_0x353ef8?_0x246745[_0x1cb3('0x1f')]:_0x1e6173[_0x1cb3('0x1c')]+_0x1e6173[_0x1cb3('0x1e')];var _0x2500ea;if(_0x3cdfbf>=_0x524640){_0x3cdfbf=_0x524640;_0x2500ea=0xc8;}else{_0x2500ea=0xce;}_0x129f69[_0x1cb3('0x19')](_0x2500ea);return _0x129f69[_0x1cb3('0x20')](_0x1cb3('0x21'),_0x5d9ba3+'-'+_0x3cdfbf+'/'+_0x524640)['json'](_0x246745);}return null;};}function patchUpdates(_0x65c4a){return function(_0x212d78){try{jsonpatch[_0x1cb3('0x22')](_0x212d78,_0x65c4a,!![]);}catch(_0x22c0b9){return BPromise[_0x1cb3('0x23')](_0x22c0b9);}return _0x212d78['save']();};}function saveUpdates(_0x477398,_0x239c69){return function(_0x525c71){if(_0x525c71){return _0x525c71[_0x1cb3('0x24')](_0x477398)[_0x1cb3('0x25')](function(_0x2e0041){return _0x2e0041;});}return null;};}function removeEntity(_0x57bcdb,_0x3ff798){return function(_0x679824){if(_0x679824){return _0x679824[_0x1cb3('0x26')]()['then'](function(){_0x57bcdb[_0x1cb3('0x19')](0xcc)[_0x1cb3('0x1a')]();});}};}function handleEntityNotFound(_0x2768fc,_0xa19950){return function(_0x46929d){if(!_0x46929d){_0x2768fc[_0x1cb3('0x18')](0x194);}return _0x46929d;};}function handleError(_0x3b40f4,_0x4fb983){_0x4fb983=_0x4fb983||0x1f4;return function(_0x524693){logger[_0x1cb3('0x27')](_0x524693[_0x1cb3('0x28')]);if(_0x524693[_0x1cb3('0x29')]){delete _0x524693[_0x1cb3('0x29')];}_0x3b40f4['status'](_0x4fb983)[_0x1cb3('0x2a')](_0x524693);};}exports[_0x1cb3('0x2b')]=function(_0x10bcd7,_0x5a19ed){var _0x8ea177={},_0x400d5b={},_0x307ca7={'count':0x0,'rows':[]};var _0x14c634=_[_0x1cb3('0x2c')](db[_0x1cb3('0x2d')][_0x1cb3('0x2e')],function(_0x35b79f){return{'name':_0x35b79f[_0x1cb3('0x2f')],'type':_0x35b79f[_0x1cb3('0x30')][_0x1cb3('0x31')]};});_0x400d5b['model']=_['map'](_0x14c634,_0x1cb3('0x29'));_0x400d5b['query']=_[_0x1cb3('0x32')](_0x10bcd7['query']);_0x400d5b[_0x1cb3('0x33')]=_[_0x1cb3('0x34')](_0x400d5b['model'],_0x400d5b['query']);_0x8ea177[_0x1cb3('0x35')]=_['intersection'](_0x400d5b[_0x1cb3('0x36')],qs[_0x1cb3('0x37')](_0x10bcd7[_0x1cb3('0x38')][_0x1cb3('0x37')]));_0x8ea177[_0x1cb3('0x35')]=_0x8ea177[_0x1cb3('0x35')][_0x1cb3('0x39')]?_0x8ea177['attributes']:_0x400d5b['model'];if(!_0x10bcd7[_0x1cb3('0x38')][_0x1cb3('0x3a')](_0x1cb3('0x3b'))){_0x8ea177[_0x1cb3('0x1e')]=qs[_0x1cb3('0x1e')](_0x10bcd7[_0x1cb3('0x38')]['limit']);_0x8ea177[_0x1cb3('0x1c')]=qs[_0x1cb3('0x1c')](_0x10bcd7[_0x1cb3('0x38')][_0x1cb3('0x1c')]);}_0x8ea177[_0x1cb3('0x3c')]=qs[_0x1cb3('0x3d')](_0x10bcd7[_0x1cb3('0x38')][_0x1cb3('0x3d')]);_0x8ea177[_0x1cb3('0x3e')]=qs[_0x1cb3('0x33')](_[_0x1cb3('0x3f')](_0x10bcd7[_0x1cb3('0x38')],_0x400d5b[_0x1cb3('0x33')]),_0x14c634);if(_0x10bcd7[_0x1cb3('0x38')]['filter']){_0x8ea177[_0x1cb3('0x3e')]=_['merge'](_0x8ea177[_0x1cb3('0x3e')],{'$or':_['map'](_0x14c634,function(_0x25388e){if(_0x25388e[_0x1cb3('0x30')]!==_0x1cb3('0x40')){var _0x4a76f6={};_0x4a76f6[_0x25388e[_0x1cb3('0x29')]]={'$like':'%'+_0x10bcd7[_0x1cb3('0x38')][_0x1cb3('0x41')]+'%'};return _0x4a76f6;}})});}_0x8ea177=_[_0x1cb3('0x42')]({},_0x8ea177,_0x10bcd7[_0x1cb3('0x43')]);var _0x5c644b={'where':_0x8ea177[_0x1cb3('0x3e')]};return db['SugarcrmAccount'][_0x1cb3('0x1f')](_0x5c644b)[_0x1cb3('0x25')](function(_0x3868ac){_0x307ca7[_0x1cb3('0x1f')]=_0x3868ac;if(_0x10bcd7[_0x1cb3('0x38')][_0x1cb3('0x44')]){_0x8ea177[_0x1cb3('0x45')]=[{'all':!![]}];}return db[_0x1cb3('0x2d')]['findAll'](_0x8ea177);})[_0x1cb3('0x25')](function(_0x55f37e){_0x307ca7[_0x1cb3('0x46')]=_0x55f37e;return _0x307ca7;})[_0x1cb3('0x25')](respondWithFilteredResult(_0x5a19ed,_0x8ea177))[_0x1cb3('0x47')](handleError(_0x5a19ed,null));};exports['show']=function(_0x2b149f,_0x2df709){var _0x5c98dd={'raw':![],'where':{'id':_0x2b149f[_0x1cb3('0x48')]['id']}},_0x157e8a={};_0x157e8a[_0x1cb3('0x36')]=_[_0x1cb3('0x32')](db['SugarcrmAccount']['rawAttributes']);_0x157e8a[_0x1cb3('0x38')]=_[_0x1cb3('0x32')](_0x2b149f[_0x1cb3('0x38')]);_0x157e8a[_0x1cb3('0x33')]=_['intersection'](_0x157e8a['model'],_0x157e8a['query']);_0x5c98dd[_0x1cb3('0x35')]=_[_0x1cb3('0x34')](_0x157e8a['model'],qs[_0x1cb3('0x37')](_0x2b149f[_0x1cb3('0x38')][_0x1cb3('0x37')]));_0x5c98dd[_0x1cb3('0x35')]=_0x5c98dd['attributes'][_0x1cb3('0x39')]?_0x5c98dd[_0x1cb3('0x35')]:_0x157e8a[_0x1cb3('0x36')];if(_0x2b149f[_0x1cb3('0x38')][_0x1cb3('0x44')]){_0x5c98dd['include']=[{'all':!![]}];}_0x5c98dd=_['merge']({},_0x5c98dd,_0x2b149f[_0x1cb3('0x43')]);return db['SugarcrmAccount'][_0x1cb3('0x49')](_0x5c98dd)[_0x1cb3('0x25')](handleEntityNotFound(_0x2df709,null))[_0x1cb3('0x25')](respondWithResult(_0x2df709,null))[_0x1cb3('0x47')](handleError(_0x2df709,null));};exports[_0x1cb3('0x4a')]=function(_0x22311c,_0x1a86a2){return db[_0x1cb3('0x2d')][_0x1cb3('0x4a')](_0x22311c[_0x1cb3('0x4b')],{})['then'](respondWithResult(_0x1a86a2,0xc9))[_0x1cb3('0x47')](handleError(_0x1a86a2,null));};exports['update']=function(_0x1b30e8,_0x47d702){if(_0x1b30e8['body']['id']){delete _0x1b30e8[_0x1cb3('0x4b')]['id'];}return db[_0x1cb3('0x2d')][_0x1cb3('0x49')]({'where':{'id':_0x1b30e8['params']['id']}})[_0x1cb3('0x25')](handleEntityNotFound(_0x47d702,null))[_0x1cb3('0x25')](saveUpdates(_0x1b30e8[_0x1cb3('0x4b')],null))[_0x1cb3('0x25')](respondWithResult(_0x47d702,null))[_0x1cb3('0x47')](handleError(_0x47d702,null));};exports[_0x1cb3('0x26')]=function(_0x5d1e21,_0x1b9567){return db[_0x1cb3('0x2d')][_0x1cb3('0x49')]({'where':{'id':_0x5d1e21[_0x1cb3('0x48')]['id']}})[_0x1cb3('0x25')](handleEntityNotFound(_0x1b9567,null))[_0x1cb3('0x25')](removeEntity(_0x1b9567,null))[_0x1cb3('0x47')](handleError(_0x1b9567,null));};exports['getConfigurations']=function(_0x2edbf7,_0x2f5349,_0x229dfd){var _0xf319a8={};var _0x27f1de={};var _0x589800;var _0x52cb8a;return db[_0x1cb3('0x2d')][_0x1cb3('0x4c')]({'where':{'id':_0x2edbf7['params']['id']}})[_0x1cb3('0x25')](handleEntityNotFound(_0x2f5349,null))[_0x1cb3('0x25')](function(_0x2bcad9){if(_0x2bcad9){_0x589800=_0x2bcad9;_0x27f1de[_0x1cb3('0x36')]=_['keys'](db[_0x1cb3('0x4d')][_0x1cb3('0x2e')]);_0x27f1de[_0x1cb3('0x38')]=_[_0x1cb3('0x32')](_0x2edbf7[_0x1cb3('0x38')]);_0x27f1de['filters']=_['intersection'](_0x27f1de[_0x1cb3('0x36')],_0x27f1de[_0x1cb3('0x38')]);_0xf319a8[_0x1cb3('0x35')]=_[_0x1cb3('0x34')](_0x27f1de[_0x1cb3('0x36')],qs['fields'](_0x2edbf7[_0x1cb3('0x38')][_0x1cb3('0x37')]));_0xf319a8[_0x1cb3('0x35')]=_0xf319a8['attributes'][_0x1cb3('0x39')]?_0xf319a8[_0x1cb3('0x35')]:_0x27f1de['model'];_0xf319a8[_0x1cb3('0x3c')]=qs[_0x1cb3('0x3d')](_0x2edbf7[_0x1cb3('0x38')]['sort']);_0xf319a8[_0x1cb3('0x3e')]=qs[_0x1cb3('0x33')](_[_0x1cb3('0x3f')](_0x2edbf7[_0x1cb3('0x38')],_0x27f1de[_0x1cb3('0x33')]));if(_0x2edbf7['query'][_0x1cb3('0x41')]){_0xf319a8['where']=_[_0x1cb3('0x42')](_0xf319a8['where'],{'$or':_[_0x1cb3('0x2c')](_0xf319a8[_0x1cb3('0x35')],function(_0x2f2992){var _0x16f0d7={};_0x16f0d7[_0x2f2992]={'$like':'%'+_0x2edbf7[_0x1cb3('0x38')][_0x1cb3('0x41')]+'%'};return _0x16f0d7;})});}_0xf319a8=_['merge']({},_0xf319a8,_0x2edbf7[_0x1cb3('0x43')]);return _0x589800[_0x1cb3('0x4e')](_0xf319a8);}})[_0x1cb3('0x25')](function(_0x3d228d){if(_0x3d228d){_0x52cb8a=_0x3d228d['length'];if(!_0x2edbf7['query'][_0x1cb3('0x3a')](_0x1cb3('0x3b'))){_0xf319a8[_0x1cb3('0x1e')]=qs[_0x1cb3('0x1e')](_0x2edbf7['query'][_0x1cb3('0x1e')]);_0xf319a8[_0x1cb3('0x1c')]=qs[_0x1cb3('0x1c')](_0x2edbf7['query'][_0x1cb3('0x1c')]);}return _0x589800[_0x1cb3('0x4e')](_0xf319a8);}})['then'](function(_0x991ac9){if(_0x991ac9){return _0x991ac9?{'count':_0x52cb8a,'rows':_0x991ac9}:null;}})[_0x1cb3('0x25')](respondWithResult(_0x2f5349,null))[_0x1cb3('0x47')](handleError(_0x2f5349,null));};exports['addConfiguration']=function(_0x2ccfa7,_0x448ad5,_0x233eec){if(_0x2ccfa7['body']['id']){delete _0x2ccfa7[_0x1cb3('0x4b')]['id'];}return db['SugarcrmAccount'][_0x1cb3('0x4c')]({'where':{'id':_0x2ccfa7[_0x1cb3('0x48')]['id']}})[_0x1cb3('0x25')](handleEntityNotFound(_0x448ad5,null))['then'](function(_0x553d67){if(_0x553d67){_0x2ccfa7['body'][_0x1cb3('0x4f')]=_0x553d67['id'];_0x2ccfa7[_0x1cb3('0x4b')][_0x1cb3('0x50')]=integrations[_0x1cb3('0x51')](_0x2ccfa7[_0x1cb3('0x4b')]['channel'],_0x2ccfa7[_0x1cb3('0x4b')][_0x1cb3('0x30')]);_0x2ccfa7[_0x1cb3('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x2ccfa7['body'][_0x1cb3('0x52')],_0x2ccfa7[_0x1cb3('0x4b')]['type']);return db[_0x1cb3('0x4d')][_0x1cb3('0x4a')](_0x2ccfa7['body'],{'include':[{'model':db[_0x1cb3('0x53')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x1cb3('0x54')}]});}return null;})[_0x1cb3('0x25')](respondWithResult(_0x448ad5,null))['catch'](handleError(_0x448ad5,null));};exports[_0x1cb3('0x55')]=function(_0x1e0107,_0x4710d5,_0x11d84d){var _0x145ad8='';var _0x4f7716=['id','name','assigned_user_id','created_by',_0x1cb3('0x56'),_0x1cb3('0x57'),_0x1cb3('0x58'),_0x1cb3('0x59'),_0x1cb3('0x5a'),_0x1cb3('0x5b'),_0x1cb3('0x5c'),'direction'];return db[_0x1cb3('0x2d')][_0x1cb3('0x4c')]({'where':{'id':_0x1e0107['params']['id']},'attributes':['id','username',_0x1cb3('0x5d'),'remoteUri']})[_0x1cb3('0x25')](handleEntityNotFound(_0x4710d5,null))[_0x1cb3('0x25')](function(_0x3ca673){if(_0x3ca673){_0x145ad8=_0x3ca673[_0x1cb3('0x5e')];var _0x19c3f1=_0x145ad8[_0x1cb3('0x5f')](-0x1);if(_0x19c3f1==='/'){_0x145ad8=_0x145ad8[_0x1cb3('0x60')](0x0,_0x145ad8['lastIndexOf'](_0x19c3f1));}return rp({'method':_0x1cb3('0x61'),'uri':util[_0x1cb3('0x62')](_0x1cb3('0x63'),_0x145ad8,_0x1cb3('0x64')),'json':!![],'form':{'method':_0x1cb3('0x65'),'input_type':_0x1cb3('0x66'),'response_type':_0x1cb3('0x66'),'rest_data':JSON[_0x1cb3('0x67')]({'user_auth':{'user_name':_0x3ca673['username'],'password':_0x3ca673[_0x1cb3('0x5d')],'encryption':_0x1cb3('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x1cb3('0x25')](function(_0x5e13a2){if(_0x5e13a2&&_0x5e13a2['name']!=='Invalid\x20Login'&&_0x5e13a2[_0x1cb3('0x29')]!==_0x1cb3('0x69')){return rp({'method':_0x1cb3('0x61'),'uri':util[_0x1cb3('0x62')](_0x1cb3('0x63'),_0x145ad8,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1cb3('0x6a'),'input_type':_0x1cb3('0x66'),'response_type':'JSON','rest_data':JSON[_0x1cb3('0x67')]({'session':_0x5e13a2['id'],'module_name':_0x1cb3('0x6b')})}})['then'](function(_0x52eb60){if(_0x52eb60){var _0x3f8d63=_[_0x1cb3('0x6c')](_0x52eb60[_0x1cb3('0x6d')]);_[_0x1cb3('0x6e')](_0x3f8d63,function(_0xf428cc){return _0x4f7716[_0x1cb3('0x6f')](_0xf428cc[_0x1cb3('0x29')]);});return{'count':_0x3f8d63[_0x1cb3('0x39')],'rows':_[_0x1cb3('0x2c')](_0x3f8d63,function(_0x4e7a7c){return{'id':_0x4e7a7c[_0x1cb3('0x29')],'name':_0x4e7a7c['label'],'custom':_['endsWith'](_0x4e7a7c[_0x1cb3('0x29')],'_c')?!![]:![],'options':_0x4e7a7c[_0x1cb3('0x43')]?_['map'](_['values'](_0x4e7a7c['options']),function(_0x230f21){return{'name':_0x230f21[_0x1cb3('0x70')],'value':_0x230f21[_0x1cb3('0x29')]};}):[]};})};}})[_0x1cb3('0x25')](respondWithResult(_0x4710d5,null))[_0x1cb3('0x47')](function(_0x57145a){var _0x18283f=_0x1e0107[_0x1cb3('0x38')]['test']?0x1f4:_0x57145a[_0x1cb3('0x71')]||0x1f4;logger[_0x1cb3('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x1cb3('0x55'),_0x18283f,JSON[_0x1cb3('0x67')](_0x57145a));delete _0x57145a[_0x1cb3('0x29')];if(_0x18283f===0x191){_0x18283f=0x190;}_0x4710d5[_0x1cb3('0x19')](_0x18283f)[_0x1cb3('0x2a')](_0x1e0107[_0x1cb3('0x38')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x57145a['statusCode']}:_0x57145a);});}else{var _0x38c99f=0x1f4;_0x4710d5['status'](_0x38c99f)[_0x1cb3('0x2a')]({'message':_0x1cb3('0x72'),'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 d0c55c1..b51fb20 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 _0x111c=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x111c,0x11d));var _0xc111=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x111c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc111('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc111('0x1'));var rp=require(_0xc111('0x2'));var fs=require('fs');var path=require(_0xc111('0x3'));var rimraf=require(_0xc111('0x4'));var config=require(_0xc111('0x5'));var attributes=require(_0xc111('0x6'));var integrations=require(_0xc111('0x7'));module[_0xc111('0x8')]=function(_0x56c879,_0x55108f){return _0x56c879['define'](_0xc111('0x9'),attributes,{'tableName':_0xc111('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10ff=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','lodash','api','moment'];(function(_0xb7f0e4,_0x2d8a58){var _0x160d98=function(_0x5ce7eb){while(--_0x5ce7eb){_0xb7f0e4['push'](_0xb7f0e4['shift']());}};_0x160d98(++_0x2d8a58);}(_0x10ff,0x1b5));var _0xf10f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x10ff[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf10f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf10f('0x1'));var moment=require(_0xf10f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf10f('0x3'));var fs=require('fs');var path=require(_0xf10f('0x4'));var rimraf=require(_0xf10f('0x5'));var config=require(_0xf10f('0x6'));var attributes=require(_0xf10f('0x7'));var integrations=require(_0xf10f('0x8'));module[_0xf10f('0x9')]=function(_0x38820d,_0x357f86){return _0x38820d[_0xf10f('0xa')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','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 c3bd591..c361946 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 _0x5a3c=['../../config/logger','rpc','../../config/environment','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','ShowSugarcrmAccount','raw','lodash','util','moment','bluebird'];(function(_0x336f68,_0x20634f){var _0x12a77e=function(_0xc62923){while(--_0xc62923){_0x336f68['push'](_0x336f68['shift']());}};_0x12a77e(++_0x20634f);}(_0x5a3c,0x19c));var _0xc5a3=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x5a3c[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var moment=require(_0xc5a3('0x2'));var BPromise=require(_0xc5a3('0x3'));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(_0xc5a3('0x4'))(_0xc5a3('0x5'));var config=require(_0xc5a3('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc5a3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14521a,_0x41f642,_0x170877){return new BPromise(function(_0x30072e,_0x88a166){return client[_0xc5a3('0x8')](_0x14521a,_0x170877)[_0xc5a3('0x9')](function(_0xf432d0){logger[_0xc5a3('0xa')](_0xc5a3('0xb'),_0x41f642,'request\x20sent');logger[_0xc5a3('0xc')](_0xc5a3('0xd'),_0x41f642,_0xc5a3('0xe'),JSON[_0xc5a3('0xf')](_0xf432d0));if(_0xf432d0['error']){if(_0xf432d0[_0xc5a3('0x10')]['code']===0x1f4){logger[_0xc5a3('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x41f642,_0xf432d0[_0xc5a3('0x10')]['message']);return _0x88a166(_0xf432d0[_0xc5a3('0x10')][_0xc5a3('0x11')]);}logger['error'](_0xc5a3('0xb'),_0x41f642,_0xf432d0[_0xc5a3('0x10')][_0xc5a3('0x11')]);return _0x30072e(_0xf432d0[_0xc5a3('0x10')][_0xc5a3('0x11')]);}else{logger[_0xc5a3('0xa')](_0xc5a3('0xb'),_0x41f642,'request\x20sent');_0x30072e(_0xf432d0[_0xc5a3('0x12')][_0xc5a3('0x11')]);}})[_0xc5a3('0x13')](function(_0x2474a0){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x41f642,_0x2474a0);_0x88a166(_0x2474a0);});});}exports[_0xc5a3('0x14')]=function(_0x495c72){var _0x3ab0e1=this;return new Promise(function(_0x50b912,_0x4fc41c){return db[_0xc5a3('0x15')][_0xc5a3('0x16')]({'raw':_0x495c72[_0xc5a3('0x17')]?_0x495c72[_0xc5a3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x495c72[_0xc5a3('0x17')]?_0x495c72[_0xc5a3('0x17')][_0xc5a3('0x18')]||null:null,'attributes':_0x495c72[_0xc5a3('0x17')]?_0x495c72['options'][_0xc5a3('0x19')]||null:null,'limit':_0x495c72[_0xc5a3('0x17')]?_0x495c72[_0xc5a3('0x17')][_0xc5a3('0x1a')]||null:null,'include':_0x495c72[_0xc5a3('0x17')]?_0x495c72[_0xc5a3('0x17')][_0xc5a3('0x1b')]?_[_0xc5a3('0x1c')](_0x495c72[_0xc5a3('0x17')][_0xc5a3('0x1b')],function(_0x57c7b4){return{'model':db[_0x57c7b4['model']],'as':_0x57c7b4['as'],'attributes':_0x57c7b4[_0xc5a3('0x19')],'include':_0x57c7b4[_0xc5a3('0x1b')]?_[_0xc5a3('0x1c')](_0x57c7b4[_0xc5a3('0x1b')],function(_0x2c3c46){return{'model':db[_0x2c3c46[_0xc5a3('0x1d')]],'as':_0x2c3c46['as'],'attributes':_0x2c3c46[_0xc5a3('0x19')],'include':_0x2c3c46[_0xc5a3('0x1b')]?_[_0xc5a3('0x1c')](_0x2c3c46[_0xc5a3('0x1b')],function(_0x56a9b1){return{'model':db[_0x56a9b1[_0xc5a3('0x1d')]],'as':_0x56a9b1['as'],'attributes':_0x56a9b1[_0xc5a3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc5a3('0x9')](function(_0x3e4d11){logger[_0xc5a3('0xa')](_0xc5a3('0x14'),_0x495c72);logger[_0xc5a3('0xc')]('GetSugarcrmAccount',_0x495c72,JSON[_0xc5a3('0xf')](_0x3e4d11));_0x50b912(_0x3e4d11);})[_0xc5a3('0x13')](function(_0x3a9602){logger[_0xc5a3('0x10')](_0xc5a3('0x14'),_0x3a9602['message'],_0x495c72);_0x4fc41c(_0x3ab0e1[_0xc5a3('0x10')](0x1f4,_0x3a9602[_0xc5a3('0x11')]));});});};exports[_0xc5a3('0x1e')]=function(_0x223efe){var _0x411481=this;return new Promise(function(_0x5e1b63,_0x104841){return db['SugarcrmAccount']['find']({'raw':_0x223efe[_0xc5a3('0x17')]?_0x223efe['options'][_0xc5a3('0x1f')]===undefined?!![]:![]:!![],'where':_0x223efe[_0xc5a3('0x17')]?_0x223efe[_0xc5a3('0x17')][_0xc5a3('0x18')]||null:null,'attributes':_0x223efe[_0xc5a3('0x17')]?_0x223efe['options'][_0xc5a3('0x19')]||null:null,'include':_0x223efe[_0xc5a3('0x17')]?_0x223efe['options'][_0xc5a3('0x1b')]?_[_0xc5a3('0x1c')](_0x223efe[_0xc5a3('0x17')][_0xc5a3('0x1b')],function(_0x984d26){return{'model':db[_0x984d26[_0xc5a3('0x1d')]],'as':_0x984d26['as'],'attributes':_0x984d26['attributes'],'include':_0x984d26['include']?_[_0xc5a3('0x1c')](_0x984d26[_0xc5a3('0x1b')],function(_0x25db7e){return{'model':db[_0x25db7e[_0xc5a3('0x1d')]],'as':_0x25db7e['as'],'attributes':_0x25db7e['attributes'],'include':_0x25db7e[_0xc5a3('0x1b')]?_['map'](_0x25db7e[_0xc5a3('0x1b')],function(_0x49ca89){return{'model':db[_0x49ca89[_0xc5a3('0x1d')]],'as':_0x49ca89['as'],'attributes':_0x49ca89[_0xc5a3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc5a3('0x9')](function(_0x329059){logger[_0xc5a3('0xa')](_0xc5a3('0x1e'),_0x223efe);logger[_0xc5a3('0xc')](_0xc5a3('0x1e'),_0x223efe,JSON[_0xc5a3('0xf')](_0x329059));_0x5e1b63(_0x329059);})[_0xc5a3('0x13')](function(_0x1cf2db){logger['error'](_0xc5a3('0x1e'),_0x1cf2db[_0xc5a3('0x11')],_0x223efe);_0x104841(_0x411481['error'](0x1f4,_0x1cf2db[_0xc5a3('0x11')]));});});}; \ No newline at end of file +var _0xfad5=['lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','raw','options','where','attributes','limit','include','model','map','then','debug','ShowSugarcrmAccount'];(function(_0x16dbb9,_0x32e899){var _0x4ae6c0=function(_0x3b02bc){while(--_0x3b02bc){_0x16dbb9['push'](_0x16dbb9['shift']());}};_0x4ae6c0(++_0x32e899);}(_0xfad5,0xc0));var _0x5fad=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xfad5[_0x238671];return _0x474844;};'use strict';var _=require(_0x5fad('0x0'));var util=require(_0x5fad('0x1'));var moment=require(_0x5fad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fad('0x3'))['db'];var utils=require(_0x5fad('0x4'));var logger=require(_0x5fad('0x5'))('rpc');var config=require(_0x5fad('0x6'));var jayson=require(_0x5fad('0x7'));var client=jayson[_0x5fad('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7447,_0x131a61,_0x2422c5){return new BPromise(function(_0x5d8881,_0x2ed140){return client[_0x5fad('0x9')](_0x4e7447,_0x2422c5)['then'](function(_0x3ec1cd){logger[_0x5fad('0xa')](_0x5fad('0xb'),_0x131a61,_0x5fad('0xc'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x131a61,_0x5fad('0xc'),JSON[_0x5fad('0xd')](_0x3ec1cd));if(_0x3ec1cd[_0x5fad('0xe')]){if(_0x3ec1cd['error'][_0x5fad('0xf')]===0x1f4){logger[_0x5fad('0xe')](_0x5fad('0xb'),_0x131a61,_0x3ec1cd[_0x5fad('0xe')][_0x5fad('0x10')]);return _0x2ed140(_0x3ec1cd['error'][_0x5fad('0x10')]);}logger[_0x5fad('0xe')](_0x5fad('0xb'),_0x131a61,_0x3ec1cd[_0x5fad('0xe')]['message']);return _0x5d8881(_0x3ec1cd['error'][_0x5fad('0x10')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x131a61,_0x5fad('0xc'));_0x5d8881(_0x3ec1cd[_0x5fad('0x11')][_0x5fad('0x10')]);}})[_0x5fad('0x12')](function(_0x21f607){logger['error'](_0x5fad('0xb'),_0x131a61,_0x21f607);_0x2ed140(_0x21f607);});});}exports[_0x5fad('0x13')]=function(_0x4896f9){var _0x590ed4=this;return new Promise(function(_0x39fedc,_0x1c8205){return db['SugarcrmAccount'][_0x5fad('0x14')]({'raw':_0x4896f9['options']?_0x4896f9['options'][_0x5fad('0x15')]===undefined?!![]:![]:!![],'where':_0x4896f9[_0x5fad('0x16')]?_0x4896f9[_0x5fad('0x16')][_0x5fad('0x17')]||null:null,'attributes':_0x4896f9[_0x5fad('0x16')]?_0x4896f9['options'][_0x5fad('0x18')]||null:null,'limit':_0x4896f9[_0x5fad('0x16')]?_0x4896f9[_0x5fad('0x16')][_0x5fad('0x19')]||null:null,'include':_0x4896f9[_0x5fad('0x16')]?_0x4896f9['options'][_0x5fad('0x1a')]?_['map'](_0x4896f9[_0x5fad('0x16')]['include'],function(_0x52f061){return{'model':db[_0x52f061[_0x5fad('0x1b')]],'as':_0x52f061['as'],'attributes':_0x52f061[_0x5fad('0x18')],'include':_0x52f061[_0x5fad('0x1a')]?_[_0x5fad('0x1c')](_0x52f061[_0x5fad('0x1a')],function(_0x36ae60){return{'model':db[_0x36ae60[_0x5fad('0x1b')]],'as':_0x36ae60['as'],'attributes':_0x36ae60[_0x5fad('0x18')],'include':_0x36ae60['include']?_[_0x5fad('0x1c')](_0x36ae60[_0x5fad('0x1a')],function(_0x3dc117){return{'model':db[_0x3dc117[_0x5fad('0x1b')]],'as':_0x3dc117['as'],'attributes':_0x3dc117['attributes']};}):[]};}):[]};}):[]:[]})[_0x5fad('0x1d')](function(_0x85048f){logger['info'](_0x5fad('0x13'),_0x4896f9);logger['debug'](_0x5fad('0x13'),_0x4896f9,JSON['stringify'](_0x85048f));_0x39fedc(_0x85048f);})[_0x5fad('0x12')](function(_0x4d0cac){logger[_0x5fad('0xe')]('GetSugarcrmAccount',_0x4d0cac[_0x5fad('0x10')],_0x4896f9);_0x1c8205(_0x590ed4[_0x5fad('0xe')](0x1f4,_0x4d0cac[_0x5fad('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x492cbf){var _0x5b7ac9=this;return new Promise(function(_0x1b0c4d,_0x3bc77c){return db['SugarcrmAccount']['find']({'raw':_0x492cbf['options']?_0x492cbf[_0x5fad('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x492cbf['options']?_0x492cbf[_0x5fad('0x16')][_0x5fad('0x17')]||null:null,'attributes':_0x492cbf[_0x5fad('0x16')]?_0x492cbf['options']['attributes']||null:null,'include':_0x492cbf['options']?_0x492cbf[_0x5fad('0x16')][_0x5fad('0x1a')]?_[_0x5fad('0x1c')](_0x492cbf['options'][_0x5fad('0x1a')],function(_0x43eb76){return{'model':db[_0x43eb76['model']],'as':_0x43eb76['as'],'attributes':_0x43eb76['attributes'],'include':_0x43eb76[_0x5fad('0x1a')]?_[_0x5fad('0x1c')](_0x43eb76['include'],function(_0x11d6a2){return{'model':db[_0x11d6a2['model']],'as':_0x11d6a2['as'],'attributes':_0x11d6a2[_0x5fad('0x18')],'include':_0x11d6a2[_0x5fad('0x1a')]?_[_0x5fad('0x1c')](_0x11d6a2[_0x5fad('0x1a')],function(_0x4e2b8b){return{'model':db[_0x4e2b8b['model']],'as':_0x4e2b8b['as'],'attributes':_0x4e2b8b[_0x5fad('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5fad('0x1d')](function(_0x861ea9){logger['info']('ShowSugarcrmAccount',_0x492cbf);logger[_0x5fad('0x1e')](_0x5fad('0x1f'),_0x492cbf,JSON[_0x5fad('0xd')](_0x861ea9));_0x1b0c4d(_0x861ea9);})[_0x5fad('0x12')](function(_0x1fa118){logger[_0x5fad('0xe')](_0x5fad('0x1f'),_0x1fa118[_0x5fad('0x10')],_0x492cbf);_0x3bc77c(_0x5b7ac9[_0x5fad('0xe')](0x1f4,_0x1fa118[_0x5fad('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9969f9e..1dfa7d0 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 _0x9e96=['isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4b1576,_0x28e92e){var _0x293a2f=function(_0x5e40e7){while(--_0x5e40e7){_0x4b1576['push'](_0x4b1576['shift']());}};_0x293a2f(++_0x28e92e);}(_0x9e96,0xa7));var _0x69e9=function(_0x127e8c,_0x88fe39){_0x127e8c=_0x127e8c-0x0;var _0x1b3a39=_0x9e96[_0x127e8c];return _0x1b3a39;};'use strict';var multer=require(_0x69e9('0x0'));var util=require(_0x69e9('0x1'));var path=require(_0x69e9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x69e9('0x3')]();var fs_extra=require(_0x69e9('0x4'));var auth=require(_0x69e9('0x5'));var interaction=require(_0x69e9('0x6'));var config=require(_0x69e9('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x69e9('0x8')]('/',auth[_0x69e9('0x9')](),controller[_0x69e9('0xa')]);router['get'](_0x69e9('0xb'),auth[_0x69e9('0x9')](),controller['show']);router['get']('/:id/fields',auth[_0x69e9('0x9')](),controller['getFields']);router[_0x69e9('0x8')](_0x69e9('0xc'),auth[_0x69e9('0x9')](),controller[_0x69e9('0xd')]);router[_0x69e9('0x8')](_0x69e9('0xe'),auth[_0x69e9('0x9')](),controller[_0x69e9('0xf')]);router[_0x69e9('0x10')]('/',auth[_0x69e9('0x9')](),controller[_0x69e9('0x11')]);router[_0x69e9('0x12')](_0x69e9('0xb'),auth[_0x69e9('0x9')](),controller[_0x69e9('0x13')]);router[_0x69e9('0x14')](_0x69e9('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x69e9('0x15')]=router; \ No newline at end of file +var _0xc669=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x60d301,_0x4f9e52){var _0x35dd11=function(_0x22f6d7){while(--_0x22f6d7){_0x60d301['push'](_0x60d301['shift']());}};_0x35dd11(++_0x4f9e52);}(_0xc669,0x92));var _0x9c66=function(_0x433158,_0x597ca8){_0x433158=_0x433158-0x0;var _0x3cd712=_0xc669[_0x433158];return _0x3cd712;};'use strict';var multer=require(_0x9c66('0x0'));var util=require(_0x9c66('0x1'));var path=require(_0x9c66('0x2'));var timeout=require(_0x9c66('0x3'));var express=require(_0x9c66('0x4'));var router=express[_0x9c66('0x5')]();var fs_extra=require(_0x9c66('0x6'));var auth=require(_0x9c66('0x7'));var interaction=require(_0x9c66('0x8'));var config=require(_0x9c66('0x9'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x9c66('0xa')](),controller['index']);router[_0x9c66('0xb')](_0x9c66('0xc'),auth['isAuthenticated'](),controller[_0x9c66('0xd')]);router[_0x9c66('0xb')](_0x9c66('0xe'),auth[_0x9c66('0xa')](),controller[_0x9c66('0xf')]);router[_0x9c66('0xb')](_0x9c66('0x10'),auth[_0x9c66('0xa')](),controller[_0x9c66('0x11')]);router[_0x9c66('0xb')]('/:id/descriptions',auth[_0x9c66('0xa')](),controller['getDescriptions']);router[_0x9c66('0x12')]('/',auth[_0x9c66('0xa')](),controller[_0x9c66('0x13')]);router['put'](_0x9c66('0xc'),auth[_0x9c66('0xa')](),controller['update']);router['delete'](_0x9c66('0xc'),auth[_0x9c66('0xa')](),controller[_0x9c66('0x14')]);module[_0x9c66('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c05ed43..a688135 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 _0x3f38=['STRING','sequelize'];(function(_0xa0a04e,_0x28a8cb){var _0x5d378c=function(_0x244dfb){while(--_0x244dfb){_0xa0a04e['push'](_0xa0a04e['shift']());}};_0x5d378c(++_0x28a8cb);}(_0x3f38,0xc9));var _0x83f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f38[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x83f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x83f3('0x1')]},'description':{'type':Sequelize[_0x83f3('0x1')]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 22037c5..db89c44 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 _0xaf8b=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','error','send','index','map','SugarcrmConfiguration','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','create','body','find','destroy','getFields','findOne','SugarcrmField','nolimit','getSubjects','rawAttributes','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf8b,0xdf));var _0xbaf8=function(_0x3ad1d9,_0xd08cff){_0x3ad1d9=_0x3ad1d9-0x0;var _0x179d10=_0xaf8b[_0x3ad1d9];return _0x179d10;};'use strict';var emlformat=require(_0xbaf8('0x0'));var rimraf=require(_0xbaf8('0x1'));var zipdir=require(_0xbaf8('0x2'));var jsonpatch=require(_0xbaf8('0x3'));var rp=require(_0xbaf8('0x4'));var moment=require(_0xbaf8('0x5'));var BPromise=require(_0xbaf8('0x6'));var Mustache=require(_0xbaf8('0x7'));var util=require(_0xbaf8('0x8'));var path=require(_0xbaf8('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbaf8('0xa'));var fs=require('fs');var fs_extra=require(_0xbaf8('0xb'));var _=require(_0xbaf8('0xc'));var squel=require(_0xbaf8('0xd'));var crypto=require(_0xbaf8('0xe'));var jsforce=require(_0xbaf8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbaf8('0x10'));var Redis=require(_0xbaf8('0x11'));var authService=require(_0xbaf8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbaf8('0x13'));var logger=require(_0xbaf8('0x14'))(_0xbaf8('0x15'));var utils=require(_0xbaf8('0x16'));var config=require(_0xbaf8('0x17'));var licenseUtil=require(_0xbaf8('0x18'));var db=require(_0xbaf8('0x19'))['db'];function respondWithStatusCode(_0x42e9b5,_0x4c97c0){_0x4c97c0=_0x4c97c0||0xcc;return function(_0xc869da){if(_0xc869da){return _0x42e9b5[_0xbaf8('0x1a')](_0x4c97c0);}return _0x42e9b5[_0xbaf8('0x1b')](_0x4c97c0)[_0xbaf8('0x1c')]();};}function respondWithResult(_0x556ef9,_0x8d483a){_0x8d483a=_0x8d483a||0xc8;return function(_0x99d35a){if(_0x99d35a){return _0x556ef9[_0xbaf8('0x1b')](_0x8d483a)['json'](_0x99d35a);}};}function respondWithFilteredResult(_0x35463a,_0x1447e7){return function(_0x517e5c){if(_0x517e5c){var _0x537a93=typeof _0x1447e7['offset']===_0xbaf8('0x1d')&&typeof _0x1447e7[_0xbaf8('0x1e')]===_0xbaf8('0x1d');var _0x44e171=_0x517e5c[_0xbaf8('0x1f')];var _0x2dfe6b=_0x537a93?0x0:_0x1447e7['offset'];var _0x14fb80=_0x537a93?_0x517e5c[_0xbaf8('0x1f')]:_0x1447e7[_0xbaf8('0x20')]+_0x1447e7[_0xbaf8('0x1e')];var _0x4b773c;if(_0x14fb80>=_0x44e171){_0x14fb80=_0x44e171;_0x4b773c=0xc8;}else{_0x4b773c=0xce;}_0x35463a[_0xbaf8('0x1b')](_0x4b773c);return _0x35463a[_0xbaf8('0x21')]('Content-Range',_0x2dfe6b+'-'+_0x14fb80+'/'+_0x44e171)[_0xbaf8('0x22')](_0x517e5c);}return null;};}function patchUpdates(_0x524ba6){return function(_0x2d365e){try{jsonpatch[_0xbaf8('0x23')](_0x2d365e,_0x524ba6,!![]);}catch(_0x21f976){return BPromise[_0xbaf8('0x24')](_0x21f976);}return _0x2d365e[_0xbaf8('0x25')]();};}function saveUpdates(_0x36161e,_0x373bf6){return function(_0x5f13cb){if(_0x5f13cb){return _0x5f13cb[_0xbaf8('0x26')](_0x36161e)[_0xbaf8('0x27')](function(_0x3a3c7d){return _0x3a3c7d;});}return null;};}function removeEntity(_0x38da97,_0x2b80e0){return function(_0xa00187){if(_0xa00187){return _0xa00187['destroy']()[_0xbaf8('0x27')](function(){_0x38da97['status'](0xcc)[_0xbaf8('0x1c')]();});}};}function handleEntityNotFound(_0x179aa4,_0x59bb6f){return function(_0x278c50){if(!_0x278c50){_0x179aa4[_0xbaf8('0x1a')](0x194);}return _0x278c50;};}function handleError(_0x4b8ade,_0x321d81){_0x321d81=_0x321d81||0x1f4;return function(_0x15e21b){logger[_0xbaf8('0x28')](_0x15e21b['stack']);if(_0x15e21b['name']){delete _0x15e21b['name'];}_0x4b8ade['status'](_0x321d81)[_0xbaf8('0x29')](_0x15e21b);};}exports[_0xbaf8('0x2a')]=function(_0x4fa241,_0x51733b){var _0x51c8c5={},_0x97a66b={},_0x221267={'count':0x0,'rows':[]};var _0x3beadb=_[_0xbaf8('0x2b')](db[_0xbaf8('0x2c')]['rawAttributes'],function(_0x2e0055){return{'name':_0x2e0055['fieldName'],'type':_0x2e0055[_0xbaf8('0x2d')][_0xbaf8('0x2e')]};});_0x97a66b['model']=_[_0xbaf8('0x2b')](_0x3beadb,_0xbaf8('0x2f'));_0x97a66b[_0xbaf8('0x30')]=_[_0xbaf8('0x31')](_0x4fa241[_0xbaf8('0x30')]);_0x97a66b[_0xbaf8('0x32')]=_['intersection'](_0x97a66b[_0xbaf8('0x33')],_0x97a66b['query']);_0x51c8c5[_0xbaf8('0x34')]=_[_0xbaf8('0x35')](_0x97a66b[_0xbaf8('0x33')],qs[_0xbaf8('0x36')](_0x4fa241['query'][_0xbaf8('0x36')]));_0x51c8c5[_0xbaf8('0x34')]=_0x51c8c5['attributes'][_0xbaf8('0x37')]?_0x51c8c5[_0xbaf8('0x34')]:_0x97a66b[_0xbaf8('0x33')];if(!_0x4fa241[_0xbaf8('0x30')][_0xbaf8('0x38')]('nolimit')){_0x51c8c5[_0xbaf8('0x1e')]=qs['limit'](_0x4fa241[_0xbaf8('0x30')][_0xbaf8('0x1e')]);_0x51c8c5['offset']=qs[_0xbaf8('0x20')](_0x4fa241[_0xbaf8('0x30')]['offset']);}_0x51c8c5[_0xbaf8('0x39')]=qs[_0xbaf8('0x3a')](_0x4fa241[_0xbaf8('0x30')][_0xbaf8('0x3a')]);_0x51c8c5[_0xbaf8('0x3b')]=qs['filters'](_[_0xbaf8('0x3c')](_0x4fa241[_0xbaf8('0x30')],_0x97a66b[_0xbaf8('0x32')]),_0x3beadb);if(_0x4fa241['query'][_0xbaf8('0x3d')]){_0x51c8c5['where']=_['merge'](_0x51c8c5[_0xbaf8('0x3b')],{'$or':_[_0xbaf8('0x2b')](_0x3beadb,function(_0x12eb9d){if(_0x12eb9d[_0xbaf8('0x2d')]!=='VIRTUAL'){var _0x49b079={};_0x49b079[_0x12eb9d[_0xbaf8('0x2f')]]={'$like':'%'+_0x4fa241['query'][_0xbaf8('0x3d')]+'%'};return _0x49b079;}})});}_0x51c8c5=_[_0xbaf8('0x3e')]({},_0x51c8c5,_0x4fa241['options']);var _0x3feeb3={'where':_0x51c8c5[_0xbaf8('0x3b')]};return db[_0xbaf8('0x2c')]['count'](_0x3feeb3)[_0xbaf8('0x27')](function(_0x271898){_0x221267[_0xbaf8('0x1f')]=_0x271898;if(_0x4fa241['query'][_0xbaf8('0x3f')]){_0x51c8c5[_0xbaf8('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x51c8c5);})[_0xbaf8('0x27')](function(_0x3fc792){_0x221267[_0xbaf8('0x41')]=_0x3fc792;return _0x221267;})[_0xbaf8('0x27')](respondWithFilteredResult(_0x51733b,_0x51c8c5))[_0xbaf8('0x42')](handleError(_0x51733b,null));};exports[_0xbaf8('0x43')]=function(_0x3302b3,_0x5c1427){var _0x20d92f={'raw':![],'where':{'id':_0x3302b3[_0xbaf8('0x44')]['id']}},_0x33503c={};_0x33503c[_0xbaf8('0x33')]=_[_0xbaf8('0x31')](db['SugarcrmConfiguration']['rawAttributes']);_0x33503c[_0xbaf8('0x30')]=_[_0xbaf8('0x31')](_0x3302b3[_0xbaf8('0x30')]);_0x33503c['filters']=_[_0xbaf8('0x35')](_0x33503c[_0xbaf8('0x33')],_0x33503c[_0xbaf8('0x30')]);_0x20d92f[_0xbaf8('0x34')]=_[_0xbaf8('0x35')](_0x33503c[_0xbaf8('0x33')],qs[_0xbaf8('0x36')](_0x3302b3[_0xbaf8('0x30')][_0xbaf8('0x36')]));_0x20d92f[_0xbaf8('0x34')]=_0x20d92f['attributes'][_0xbaf8('0x37')]?_0x20d92f[_0xbaf8('0x34')]:_0x33503c[_0xbaf8('0x33')];if(_0x3302b3[_0xbaf8('0x30')]['includeAll']){_0x20d92f[_0xbaf8('0x40')]=[{'all':!![]}];}_0x20d92f=_[_0xbaf8('0x3e')]({},_0x20d92f,_0x3302b3[_0xbaf8('0x45')]);return db[_0xbaf8('0x2c')]['find'](_0x20d92f)[_0xbaf8('0x27')](handleEntityNotFound(_0x5c1427,null))[_0xbaf8('0x27')](respondWithResult(_0x5c1427,null))[_0xbaf8('0x42')](handleError(_0x5c1427,null));};exports[_0xbaf8('0x46')]=function(_0x9392c1,_0x3bea1a){return db[_0xbaf8('0x2c')][_0xbaf8('0x46')](_0x9392c1[_0xbaf8('0x47')],{})['then'](respondWithResult(_0x3bea1a,0xc9))[_0xbaf8('0x42')](handleError(_0x3bea1a,null));};exports[_0xbaf8('0x26')]=function(_0x24f05d,_0x236299){if(_0x24f05d[_0xbaf8('0x47')]['id']){delete _0x24f05d[_0xbaf8('0x47')]['id'];}return db['SugarcrmConfiguration'][_0xbaf8('0x48')]({'where':{'id':_0x24f05d[_0xbaf8('0x44')]['id']}})[_0xbaf8('0x27')](handleEntityNotFound(_0x236299,null))['then'](saveUpdates(_0x24f05d[_0xbaf8('0x47')],null))[_0xbaf8('0x27')](respondWithResult(_0x236299,null))[_0xbaf8('0x42')](handleError(_0x236299,null));};exports[_0xbaf8('0x49')]=function(_0x8df8c5,_0x2f31cc){return db[_0xbaf8('0x2c')][_0xbaf8('0x48')]({'where':{'id':_0x8df8c5[_0xbaf8('0x44')]['id']}})[_0xbaf8('0x27')](handleEntityNotFound(_0x2f31cc,null))[_0xbaf8('0x27')](removeEntity(_0x2f31cc,null))['catch'](handleError(_0x2f31cc,null));};exports[_0xbaf8('0x4a')]=function(_0x141828,_0x11b26a,_0x275df4){var _0x61f5bf={};var _0x50e69b={};var _0x3599eb;var _0x4e353b;return db[_0xbaf8('0x2c')][_0xbaf8('0x4b')]({'where':{'id':_0x141828[_0xbaf8('0x44')]['id']}})[_0xbaf8('0x27')](handleEntityNotFound(_0x11b26a,null))[_0xbaf8('0x27')](function(_0x21b8e9){if(_0x21b8e9){_0x3599eb=_0x21b8e9;_0x50e69b[_0xbaf8('0x33')]=_[_0xbaf8('0x31')](db[_0xbaf8('0x4c')]['rawAttributes']);_0x50e69b[_0xbaf8('0x30')]=_['keys'](_0x141828['query']);_0x50e69b[_0xbaf8('0x32')]=_[_0xbaf8('0x35')](_0x50e69b[_0xbaf8('0x33')],_0x50e69b[_0xbaf8('0x30')]);_0x61f5bf['attributes']=_[_0xbaf8('0x35')](_0x50e69b['model'],qs[_0xbaf8('0x36')](_0x141828[_0xbaf8('0x30')][_0xbaf8('0x36')]));_0x61f5bf['attributes']=_0x61f5bf[_0xbaf8('0x34')][_0xbaf8('0x37')]?_0x61f5bf['attributes']:_0x50e69b[_0xbaf8('0x33')];_0x61f5bf[_0xbaf8('0x39')]=qs[_0xbaf8('0x3a')](_0x141828['query'][_0xbaf8('0x3a')]);_0x61f5bf[_0xbaf8('0x3b')]=qs[_0xbaf8('0x32')](_[_0xbaf8('0x3c')](_0x141828[_0xbaf8('0x30')],_0x50e69b[_0xbaf8('0x32')]));if(_0x141828['query'][_0xbaf8('0x3d')]){_0x61f5bf[_0xbaf8('0x3b')]=_[_0xbaf8('0x3e')](_0x61f5bf[_0xbaf8('0x3b')],{'$or':_[_0xbaf8('0x2b')](_0x61f5bf['attributes'],function(_0x1e30ee){var _0x164ec5={};_0x164ec5[_0x1e30ee]={'$like':'%'+_0x141828[_0xbaf8('0x30')][_0xbaf8('0x3d')]+'%'};return _0x164ec5;})});}_0x61f5bf=_[_0xbaf8('0x3e')]({},_0x61f5bf,_0x141828[_0xbaf8('0x45')]);return _0x3599eb[_0xbaf8('0x4a')](_0x61f5bf);}})['then'](function(_0x37af8a){if(_0x37af8a){_0x4e353b=_0x37af8a[_0xbaf8('0x37')];if(!_0x141828[_0xbaf8('0x30')][_0xbaf8('0x38')](_0xbaf8('0x4d'))){_0x61f5bf[_0xbaf8('0x1e')]=qs[_0xbaf8('0x1e')](_0x141828[_0xbaf8('0x30')][_0xbaf8('0x1e')]);_0x61f5bf['offset']=qs[_0xbaf8('0x20')](_0x141828[_0xbaf8('0x30')][_0xbaf8('0x20')]);}return _0x3599eb['getFields'](_0x61f5bf);}})[_0xbaf8('0x27')](function(_0x3eefd7){if(_0x3eefd7){return _0x3eefd7?{'count':_0x4e353b,'rows':_0x3eefd7}:null;}})[_0xbaf8('0x27')](respondWithResult(_0x11b26a,null))[_0xbaf8('0x42')](handleError(_0x11b26a,null));};exports[_0xbaf8('0x4e')]=function(_0x178246,_0x4372fa,_0x1d4b3c){var _0x332008={};var _0x26fa5f={};var _0x259178;var _0x2f6974;return db[_0xbaf8('0x2c')][_0xbaf8('0x4b')]({'where':{'id':_0x178246[_0xbaf8('0x44')]['id']}})[_0xbaf8('0x27')](handleEntityNotFound(_0x4372fa,null))['then'](function(_0x1d4d7b){if(_0x1d4d7b){_0x259178=_0x1d4d7b;_0x26fa5f['model']=_[_0xbaf8('0x31')](db[_0xbaf8('0x4c')][_0xbaf8('0x4f')]);_0x26fa5f['query']=_['keys'](_0x178246[_0xbaf8('0x30')]);_0x26fa5f[_0xbaf8('0x32')]=_[_0xbaf8('0x35')](_0x26fa5f[_0xbaf8('0x33')],_0x26fa5f[_0xbaf8('0x30')]);_0x332008[_0xbaf8('0x34')]=_[_0xbaf8('0x35')](_0x26fa5f[_0xbaf8('0x33')],qs[_0xbaf8('0x36')](_0x178246[_0xbaf8('0x30')][_0xbaf8('0x36')]));_0x332008[_0xbaf8('0x34')]=_0x332008['attributes'][_0xbaf8('0x37')]?_0x332008[_0xbaf8('0x34')]:_0x26fa5f[_0xbaf8('0x33')];_0x332008[_0xbaf8('0x39')]=qs[_0xbaf8('0x3a')](_0x178246[_0xbaf8('0x30')]['sort']);_0x332008[_0xbaf8('0x3b')]=qs[_0xbaf8('0x32')](_[_0xbaf8('0x3c')](_0x178246[_0xbaf8('0x30')],_0x26fa5f['filters']));if(_0x178246[_0xbaf8('0x30')][_0xbaf8('0x3d')]){_0x332008['where']=_[_0xbaf8('0x3e')](_0x332008[_0xbaf8('0x3b')],{'$or':_[_0xbaf8('0x2b')](_0x332008[_0xbaf8('0x34')],function(_0x4803b1){var _0x302ded={};_0x302ded[_0x4803b1]={'$like':'%'+_0x178246['query']['filter']+'%'};return _0x302ded;})});}_0x332008=_['merge']({},_0x332008,_0x178246[_0xbaf8('0x45')]);return _0x259178[_0xbaf8('0x4e')](_0x332008);}})[_0xbaf8('0x27')](function(_0x2c774a){if(_0x2c774a){_0x2f6974=_0x2c774a[_0xbaf8('0x37')];if(!_0x178246[_0xbaf8('0x30')][_0xbaf8('0x38')]('nolimit')){_0x332008['limit']=qs[_0xbaf8('0x1e')](_0x178246['query'][_0xbaf8('0x1e')]);_0x332008[_0xbaf8('0x20')]=qs['offset'](_0x178246[_0xbaf8('0x30')][_0xbaf8('0x20')]);}return _0x259178[_0xbaf8('0x4e')](_0x332008);}})['then'](function(_0x5c2a3e){if(_0x5c2a3e){return _0x5c2a3e?{'count':_0x2f6974,'rows':_0x5c2a3e}:null;}})[_0xbaf8('0x27')](respondWithResult(_0x4372fa,null))['catch'](handleError(_0x4372fa,null));};exports[_0xbaf8('0x50')]=function(_0x3ef207,_0x19d4c6,_0xb9e3e2){var _0x4830e2={};var _0x18de42={};var _0x3b2e31;var _0x391644;return db[_0xbaf8('0x2c')][_0xbaf8('0x4b')]({'where':{'id':_0x3ef207['params']['id']}})[_0xbaf8('0x27')](handleEntityNotFound(_0x19d4c6,null))[_0xbaf8('0x27')](function(_0x1858d8){if(_0x1858d8){_0x3b2e31=_0x1858d8;_0x18de42[_0xbaf8('0x33')]=_[_0xbaf8('0x31')](db['SugarcrmField']['rawAttributes']);_0x18de42[_0xbaf8('0x30')]=_[_0xbaf8('0x31')](_0x3ef207['query']);_0x18de42['filters']=_[_0xbaf8('0x35')](_0x18de42[_0xbaf8('0x33')],_0x18de42[_0xbaf8('0x30')]);_0x4830e2[_0xbaf8('0x34')]=_[_0xbaf8('0x35')](_0x18de42[_0xbaf8('0x33')],qs[_0xbaf8('0x36')](_0x3ef207[_0xbaf8('0x30')][_0xbaf8('0x36')]));_0x4830e2[_0xbaf8('0x34')]=_0x4830e2['attributes'][_0xbaf8('0x37')]?_0x4830e2[_0xbaf8('0x34')]:_0x18de42['model'];_0x4830e2[_0xbaf8('0x39')]=qs[_0xbaf8('0x3a')](_0x3ef207['query']['sort']);_0x4830e2[_0xbaf8('0x3b')]=qs[_0xbaf8('0x32')](_[_0xbaf8('0x3c')](_0x3ef207['query'],_0x18de42[_0xbaf8('0x32')]));if(_0x3ef207[_0xbaf8('0x30')][_0xbaf8('0x3d')]){_0x4830e2['where']=_['merge'](_0x4830e2[_0xbaf8('0x3b')],{'$or':_['map'](_0x4830e2[_0xbaf8('0x34')],function(_0x29ffaa){var _0x290dda={};_0x290dda[_0x29ffaa]={'$like':'%'+_0x3ef207[_0xbaf8('0x30')][_0xbaf8('0x3d')]+'%'};return _0x290dda;})});}_0x4830e2=_[_0xbaf8('0x3e')]({},_0x4830e2,_0x3ef207[_0xbaf8('0x45')]);return _0x3b2e31[_0xbaf8('0x50')](_0x4830e2);}})[_0xbaf8('0x27')](function(_0x70030e){if(_0x70030e){_0x391644=_0x70030e[_0xbaf8('0x37')];if(!_0x3ef207[_0xbaf8('0x30')][_0xbaf8('0x38')]('nolimit')){_0x4830e2[_0xbaf8('0x1e')]=qs['limit'](_0x3ef207[_0xbaf8('0x30')]['limit']);_0x4830e2[_0xbaf8('0x20')]=qs[_0xbaf8('0x20')](_0x3ef207[_0xbaf8('0x30')][_0xbaf8('0x20')]);}return _0x3b2e31[_0xbaf8('0x50')](_0x4830e2);}})['then'](function(_0x57c192){if(_0x57c192){return _0x57c192?{'count':_0x391644,'rows':_0x57c192}:null;}})[_0xbaf8('0x27')](respondWithResult(_0x19d4c6,null))[_0xbaf8('0x42')](handleError(_0x19d4c6,null));}; \ No newline at end of file +var _0x2589=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','filter','merge','options','show','params','include','catch','create','body','find','getFields','findOne','SugarcrmField','order','length','nolimit','getSubjects','getDescriptions','pick','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x5debe1,_0x6123c5){var _0x2c4f85=function(_0x1658a7){while(--_0x1658a7){_0x5debe1['push'](_0x5debe1['shift']());}};_0x2c4f85(++_0x6123c5);}(_0x2589,0x140));var _0x9258=function(_0x40f98b,_0x5ca525){_0x40f98b=_0x40f98b-0x0;var _0x12ef5c=_0x2589[_0x40f98b];return _0x12ef5c;};'use strict';var emlformat=require(_0x9258('0x0'));var rimraf=require(_0x9258('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9258('0x2'));var rp=require(_0x9258('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9258('0x4'));var util=require(_0x9258('0x5'));var path=require(_0x9258('0x6'));var sox=require('sox');var csv=require(_0x9258('0x7'));var ejs=require(_0x9258('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9258('0x9'));var squel=require(_0x9258('0xa'));var crypto=require(_0x9258('0xb'));var jsforce=require(_0x9258('0xc'));var deskjs=require(_0x9258('0xd'));var toCsv=require(_0x9258('0x7'));var querystring=require('querystring');var Papa=require(_0x9258('0xe'));var Redis=require(_0x9258('0xf'));var authService=require(_0x9258('0x10'));var qs=require(_0x9258('0x11'));var as=require(_0x9258('0x12'));var hardwareService=require(_0x9258('0x13'));var logger=require(_0x9258('0x14'))('api');var utils=require(_0x9258('0x15'));var config=require(_0x9258('0x16'));var licenseUtil=require(_0x9258('0x17'));var db=require(_0x9258('0x18'))['db'];function respondWithStatusCode(_0x1fe507,_0x534c76){_0x534c76=_0x534c76||0xcc;return function(_0x56e919){if(_0x56e919){return _0x1fe507[_0x9258('0x19')](_0x534c76);}return _0x1fe507['status'](_0x534c76)[_0x9258('0x1a')]();};}function respondWithResult(_0x2bfd76,_0x4ecb4f){_0x4ecb4f=_0x4ecb4f||0xc8;return function(_0x2ed5a2){if(_0x2ed5a2){return _0x2bfd76[_0x9258('0x1b')](_0x4ecb4f)[_0x9258('0x1c')](_0x2ed5a2);}};}function respondWithFilteredResult(_0x168e15,_0x187718){return function(_0x2bb8af){if(_0x2bb8af){var _0x11456f=typeof _0x187718[_0x9258('0x1d')]===_0x9258('0x1e')&&typeof _0x187718[_0x9258('0x1f')]===_0x9258('0x1e');var _0x1bbb5a=_0x2bb8af[_0x9258('0x20')];var _0x3ce6d7=_0x11456f?0x0:_0x187718[_0x9258('0x1d')];var _0x1b1131=_0x11456f?_0x2bb8af[_0x9258('0x20')]:_0x187718[_0x9258('0x1d')]+_0x187718['limit'];var _0x3873d8;if(_0x1b1131>=_0x1bbb5a){_0x1b1131=_0x1bbb5a;_0x3873d8=0xc8;}else{_0x3873d8=0xce;}_0x168e15[_0x9258('0x1b')](_0x3873d8);return _0x168e15[_0x9258('0x21')](_0x9258('0x22'),_0x3ce6d7+'-'+_0x1b1131+'/'+_0x1bbb5a)[_0x9258('0x1c')](_0x2bb8af);}return null;};}function patchUpdates(_0x156818){return function(_0x46c33c){try{jsonpatch[_0x9258('0x23')](_0x46c33c,_0x156818,!![]);}catch(_0x5b735e){return BPromise[_0x9258('0x24')](_0x5b735e);}return _0x46c33c[_0x9258('0x25')]();};}function saveUpdates(_0x261601,_0x563a9b){return function(_0x1785a3){if(_0x1785a3){return _0x1785a3[_0x9258('0x26')](_0x261601)[_0x9258('0x27')](function(_0x5279ab){return _0x5279ab;});}return null;};}function removeEntity(_0x5b4a29,_0x57b2e8){return function(_0x4c08d0){if(_0x4c08d0){return _0x4c08d0[_0x9258('0x28')]()[_0x9258('0x27')](function(){_0x5b4a29[_0x9258('0x1b')](0xcc)[_0x9258('0x1a')]();});}};}function handleEntityNotFound(_0x5d0c3b,_0x382faf){return function(_0x4a986b){if(!_0x4a986b){_0x5d0c3b[_0x9258('0x19')](0x194);}return _0x4a986b;};}function handleError(_0x4f68c3,_0x5834ab){_0x5834ab=_0x5834ab||0x1f4;return function(_0x1d15a6){logger[_0x9258('0x29')](_0x1d15a6[_0x9258('0x2a')]);if(_0x1d15a6['name']){delete _0x1d15a6[_0x9258('0x2b')];}_0x4f68c3[_0x9258('0x1b')](_0x5834ab)[_0x9258('0x2c')](_0x1d15a6);};}exports[_0x9258('0x2d')]=function(_0x4cce35,_0x2045c9){var _0x128dde={},_0x5a18ca={},_0x287ab3={'count':0x0,'rows':[]};var _0x59157f=_[_0x9258('0x2e')](db[_0x9258('0x2f')][_0x9258('0x30')],function(_0x50e2c2){return{'name':_0x50e2c2[_0x9258('0x31')],'type':_0x50e2c2[_0x9258('0x32')][_0x9258('0x33')]};});_0x5a18ca[_0x9258('0x34')]=_[_0x9258('0x2e')](_0x59157f,_0x9258('0x2b'));_0x5a18ca[_0x9258('0x35')]=_[_0x9258('0x36')](_0x4cce35[_0x9258('0x35')]);_0x5a18ca[_0x9258('0x37')]=_['intersection'](_0x5a18ca['model'],_0x5a18ca[_0x9258('0x35')]);_0x128dde[_0x9258('0x38')]=_[_0x9258('0x39')](_0x5a18ca[_0x9258('0x34')],qs[_0x9258('0x3a')](_0x4cce35[_0x9258('0x35')][_0x9258('0x3a')]));_0x128dde[_0x9258('0x38')]=_0x128dde['attributes']['length']?_0x128dde[_0x9258('0x38')]:_0x5a18ca['model'];if(!_0x4cce35[_0x9258('0x35')][_0x9258('0x3b')]('nolimit')){_0x128dde[_0x9258('0x1f')]=qs[_0x9258('0x1f')](_0x4cce35[_0x9258('0x35')][_0x9258('0x1f')]);_0x128dde['offset']=qs['offset'](_0x4cce35['query'][_0x9258('0x1d')]);}_0x128dde['order']=qs[_0x9258('0x3c')](_0x4cce35[_0x9258('0x35')][_0x9258('0x3c')]);_0x128dde[_0x9258('0x3d')]=qs[_0x9258('0x37')](_['pick'](_0x4cce35[_0x9258('0x35')],_0x5a18ca[_0x9258('0x37')]),_0x59157f);if(_0x4cce35[_0x9258('0x35')][_0x9258('0x3e')]){_0x128dde[_0x9258('0x3d')]=_[_0x9258('0x3f')](_0x128dde['where'],{'$or':_[_0x9258('0x2e')](_0x59157f,function(_0xe9c7fd){if(_0xe9c7fd['type']!=='VIRTUAL'){var _0x3d0cfc={};_0x3d0cfc[_0xe9c7fd['name']]={'$like':'%'+_0x4cce35[_0x9258('0x35')][_0x9258('0x3e')]+'%'};return _0x3d0cfc;}})});}_0x128dde=_[_0x9258('0x3f')]({},_0x128dde,_0x4cce35[_0x9258('0x40')]);var _0x3d51be={'where':_0x128dde[_0x9258('0x3d')]};return db['SugarcrmConfiguration']['count'](_0x3d51be)['then'](function(_0x423a2b){_0x287ab3[_0x9258('0x20')]=_0x423a2b;if(_0x4cce35['query']['includeAll']){_0x128dde['include']=[{'all':!![]}];}return db[_0x9258('0x2f')]['findAll'](_0x128dde);})[_0x9258('0x27')](function(_0x45d744){_0x287ab3['rows']=_0x45d744;return _0x287ab3;})['then'](respondWithFilteredResult(_0x2045c9,_0x128dde))['catch'](handleError(_0x2045c9,null));};exports[_0x9258('0x41')]=function(_0x5ddeb9,_0x382986){var _0x393acd={'raw':![],'where':{'id':_0x5ddeb9[_0x9258('0x42')]['id']}},_0x103ea9={};_0x103ea9[_0x9258('0x34')]=_['keys'](db[_0x9258('0x2f')][_0x9258('0x30')]);_0x103ea9['query']=_[_0x9258('0x36')](_0x5ddeb9[_0x9258('0x35')]);_0x103ea9[_0x9258('0x37')]=_[_0x9258('0x39')](_0x103ea9[_0x9258('0x34')],_0x103ea9[_0x9258('0x35')]);_0x393acd[_0x9258('0x38')]=_[_0x9258('0x39')](_0x103ea9[_0x9258('0x34')],qs['fields'](_0x5ddeb9[_0x9258('0x35')][_0x9258('0x3a')]));_0x393acd['attributes']=_0x393acd[_0x9258('0x38')]['length']?_0x393acd[_0x9258('0x38')]:_0x103ea9[_0x9258('0x34')];if(_0x5ddeb9['query']['includeAll']){_0x393acd[_0x9258('0x43')]=[{'all':!![]}];}_0x393acd=_[_0x9258('0x3f')]({},_0x393acd,_0x5ddeb9[_0x9258('0x40')]);return db[_0x9258('0x2f')]['find'](_0x393acd)['then'](handleEntityNotFound(_0x382986,null))[_0x9258('0x27')](respondWithResult(_0x382986,null))[_0x9258('0x44')](handleError(_0x382986,null));};exports['create']=function(_0x13d894,_0x3f101f){return db[_0x9258('0x2f')][_0x9258('0x45')](_0x13d894[_0x9258('0x46')],{})[_0x9258('0x27')](respondWithResult(_0x3f101f,0xc9))[_0x9258('0x44')](handleError(_0x3f101f,null));};exports[_0x9258('0x26')]=function(_0x3f4c21,_0x26f99c){if(_0x3f4c21['body']['id']){delete _0x3f4c21[_0x9258('0x46')]['id'];}return db[_0x9258('0x2f')][_0x9258('0x47')]({'where':{'id':_0x3f4c21[_0x9258('0x42')]['id']}})['then'](handleEntityNotFound(_0x26f99c,null))[_0x9258('0x27')](saveUpdates(_0x3f4c21[_0x9258('0x46')],null))[_0x9258('0x27')](respondWithResult(_0x26f99c,null))[_0x9258('0x44')](handleError(_0x26f99c,null));};exports[_0x9258('0x28')]=function(_0x56f1ea,_0x4f0a4e){return db[_0x9258('0x2f')]['find']({'where':{'id':_0x56f1ea['params']['id']}})[_0x9258('0x27')](handleEntityNotFound(_0x4f0a4e,null))[_0x9258('0x27')](removeEntity(_0x4f0a4e,null))[_0x9258('0x44')](handleError(_0x4f0a4e,null));};exports[_0x9258('0x48')]=function(_0x124d27,_0x57c21f,_0x3223a4){var _0x10c102={};var _0x2281da={};var _0x404097;var _0x434196;return db['SugarcrmConfiguration'][_0x9258('0x49')]({'where':{'id':_0x124d27['params']['id']}})[_0x9258('0x27')](handleEntityNotFound(_0x57c21f,null))[_0x9258('0x27')](function(_0x3e1b56){if(_0x3e1b56){_0x404097=_0x3e1b56;_0x2281da[_0x9258('0x34')]=_[_0x9258('0x36')](db[_0x9258('0x4a')][_0x9258('0x30')]);_0x2281da[_0x9258('0x35')]=_[_0x9258('0x36')](_0x124d27[_0x9258('0x35')]);_0x2281da['filters']=_[_0x9258('0x39')](_0x2281da[_0x9258('0x34')],_0x2281da['query']);_0x10c102['attributes']=_[_0x9258('0x39')](_0x2281da[_0x9258('0x34')],qs[_0x9258('0x3a')](_0x124d27[_0x9258('0x35')][_0x9258('0x3a')]));_0x10c102[_0x9258('0x38')]=_0x10c102[_0x9258('0x38')]['length']?_0x10c102['attributes']:_0x2281da[_0x9258('0x34')];_0x10c102[_0x9258('0x4b')]=qs[_0x9258('0x3c')](_0x124d27['query'][_0x9258('0x3c')]);_0x10c102[_0x9258('0x3d')]=qs['filters'](_['pick'](_0x124d27['query'],_0x2281da['filters']));if(_0x124d27[_0x9258('0x35')]['filter']){_0x10c102[_0x9258('0x3d')]=_['merge'](_0x10c102[_0x9258('0x3d')],{'$or':_[_0x9258('0x2e')](_0x10c102[_0x9258('0x38')],function(_0x4fbe2e){var _0x2a9a5e={};_0x2a9a5e[_0x4fbe2e]={'$like':'%'+_0x124d27['query']['filter']+'%'};return _0x2a9a5e;})});}_0x10c102=_[_0x9258('0x3f')]({},_0x10c102,_0x124d27['options']);return _0x404097['getFields'](_0x10c102);}})[_0x9258('0x27')](function(_0x11b744){if(_0x11b744){_0x434196=_0x11b744[_0x9258('0x4c')];if(!_0x124d27[_0x9258('0x35')][_0x9258('0x3b')](_0x9258('0x4d'))){_0x10c102['limit']=qs[_0x9258('0x1f')](_0x124d27[_0x9258('0x35')][_0x9258('0x1f')]);_0x10c102['offset']=qs[_0x9258('0x1d')](_0x124d27[_0x9258('0x35')]['offset']);}return _0x404097['getFields'](_0x10c102);}})[_0x9258('0x27')](function(_0x593841){if(_0x593841){return _0x593841?{'count':_0x434196,'rows':_0x593841}:null;}})[_0x9258('0x27')](respondWithResult(_0x57c21f,null))[_0x9258('0x44')](handleError(_0x57c21f,null));};exports[_0x9258('0x4e')]=function(_0x43f1b7,_0x4edb6f,_0x14e57c){var _0x5bbce8={};var _0x59fca3={};var _0x3131c5;var _0x603cb5;return db[_0x9258('0x2f')][_0x9258('0x49')]({'where':{'id':_0x43f1b7['params']['id']}})['then'](handleEntityNotFound(_0x4edb6f,null))[_0x9258('0x27')](function(_0x308b14){if(_0x308b14){_0x3131c5=_0x308b14;_0x59fca3['model']=_[_0x9258('0x36')](db[_0x9258('0x4a')]['rawAttributes']);_0x59fca3[_0x9258('0x35')]=_[_0x9258('0x36')](_0x43f1b7[_0x9258('0x35')]);_0x59fca3[_0x9258('0x37')]=_[_0x9258('0x39')](_0x59fca3[_0x9258('0x34')],_0x59fca3['query']);_0x5bbce8[_0x9258('0x38')]=_[_0x9258('0x39')](_0x59fca3['model'],qs['fields'](_0x43f1b7[_0x9258('0x35')][_0x9258('0x3a')]));_0x5bbce8[_0x9258('0x38')]=_0x5bbce8[_0x9258('0x38')][_0x9258('0x4c')]?_0x5bbce8['attributes']:_0x59fca3[_0x9258('0x34')];_0x5bbce8[_0x9258('0x4b')]=qs[_0x9258('0x3c')](_0x43f1b7[_0x9258('0x35')][_0x9258('0x3c')]);_0x5bbce8[_0x9258('0x3d')]=qs[_0x9258('0x37')](_['pick'](_0x43f1b7[_0x9258('0x35')],_0x59fca3[_0x9258('0x37')]));if(_0x43f1b7[_0x9258('0x35')][_0x9258('0x3e')]){_0x5bbce8[_0x9258('0x3d')]=_[_0x9258('0x3f')](_0x5bbce8[_0x9258('0x3d')],{'$or':_['map'](_0x5bbce8[_0x9258('0x38')],function(_0xc4d253){var _0x1cb50e={};_0x1cb50e[_0xc4d253]={'$like':'%'+_0x43f1b7[_0x9258('0x35')][_0x9258('0x3e')]+'%'};return _0x1cb50e;})});}_0x5bbce8=_[_0x9258('0x3f')]({},_0x5bbce8,_0x43f1b7[_0x9258('0x40')]);return _0x3131c5[_0x9258('0x4e')](_0x5bbce8);}})[_0x9258('0x27')](function(_0x3811a9){if(_0x3811a9){_0x603cb5=_0x3811a9[_0x9258('0x4c')];if(!_0x43f1b7['query'][_0x9258('0x3b')](_0x9258('0x4d'))){_0x5bbce8[_0x9258('0x1f')]=qs[_0x9258('0x1f')](_0x43f1b7[_0x9258('0x35')][_0x9258('0x1f')]);_0x5bbce8[_0x9258('0x1d')]=qs['offset'](_0x43f1b7[_0x9258('0x35')][_0x9258('0x1d')]);}return _0x3131c5[_0x9258('0x4e')](_0x5bbce8);}})['then'](function(_0x509818){if(_0x509818){return _0x509818?{'count':_0x603cb5,'rows':_0x509818}:null;}})[_0x9258('0x27')](respondWithResult(_0x4edb6f,null))[_0x9258('0x44')](handleError(_0x4edb6f,null));};exports[_0x9258('0x4f')]=function(_0x58767b,_0x566840,_0x1324bc){var _0x44f3a5={};var _0x3cbfae={};var _0x16112f;var _0x2ad7d2;return db[_0x9258('0x2f')]['findOne']({'where':{'id':_0x58767b['params']['id']}})[_0x9258('0x27')](handleEntityNotFound(_0x566840,null))[_0x9258('0x27')](function(_0x2026fb){if(_0x2026fb){_0x16112f=_0x2026fb;_0x3cbfae[_0x9258('0x34')]=_[_0x9258('0x36')](db['SugarcrmField'][_0x9258('0x30')]);_0x3cbfae[_0x9258('0x35')]=_[_0x9258('0x36')](_0x58767b[_0x9258('0x35')]);_0x3cbfae[_0x9258('0x37')]=_[_0x9258('0x39')](_0x3cbfae[_0x9258('0x34')],_0x3cbfae[_0x9258('0x35')]);_0x44f3a5[_0x9258('0x38')]=_['intersection'](_0x3cbfae[_0x9258('0x34')],qs[_0x9258('0x3a')](_0x58767b['query']['fields']));_0x44f3a5[_0x9258('0x38')]=_0x44f3a5['attributes']['length']?_0x44f3a5[_0x9258('0x38')]:_0x3cbfae[_0x9258('0x34')];_0x44f3a5[_0x9258('0x4b')]=qs[_0x9258('0x3c')](_0x58767b[_0x9258('0x35')]['sort']);_0x44f3a5[_0x9258('0x3d')]=qs[_0x9258('0x37')](_[_0x9258('0x50')](_0x58767b[_0x9258('0x35')],_0x3cbfae['filters']));if(_0x58767b[_0x9258('0x35')][_0x9258('0x3e')]){_0x44f3a5[_0x9258('0x3d')]=_[_0x9258('0x3f')](_0x44f3a5[_0x9258('0x3d')],{'$or':_[_0x9258('0x2e')](_0x44f3a5[_0x9258('0x38')],function(_0x111e4f){var _0x1ed45b={};_0x1ed45b[_0x111e4f]={'$like':'%'+_0x58767b[_0x9258('0x35')][_0x9258('0x3e')]+'%'};return _0x1ed45b;})});}_0x44f3a5=_[_0x9258('0x3f')]({},_0x44f3a5,_0x58767b[_0x9258('0x40')]);return _0x16112f[_0x9258('0x4f')](_0x44f3a5);}})[_0x9258('0x27')](function(_0x1d4073){if(_0x1d4073){_0x2ad7d2=_0x1d4073[_0x9258('0x4c')];if(!_0x58767b['query'][_0x9258('0x3b')](_0x9258('0x4d'))){_0x44f3a5['limit']=qs[_0x9258('0x1f')](_0x58767b[_0x9258('0x35')][_0x9258('0x1f')]);_0x44f3a5['offset']=qs[_0x9258('0x1d')](_0x58767b[_0x9258('0x35')][_0x9258('0x1d')]);}return _0x16112f[_0x9258('0x4f')](_0x44f3a5);}})[_0x9258('0x27')](function(_0x4a39cc){if(_0x4a39cc){return _0x4a39cc?{'count':_0x2ad7d2,'rows':_0x4a39cc}:null;}})[_0x9258('0x27')](respondWithResult(_0x566840,null))[_0x9258('0x44')](handleError(_0x566840,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ebb374f..a0063e1 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 _0x2f37=['./intSugarcrmConfiguration.attributes','int_sugarcrm_configurations','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2f37,0xba));var _0x72f3=function(_0xeb5901,_0x203aaa){_0xeb5901=_0xeb5901-0x0;var _0x57c69a=_0x2f37[_0xeb5901];return _0x57c69a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x72f3('0x0'));var BPromise=require(_0x72f3('0x1'));var rp=require(_0x72f3('0x2'));var fs=require('fs');var path=require(_0x72f3('0x3'));var rimraf=require(_0x72f3('0x4'));var config=require(_0x72f3('0x5'));var attributes=require(_0x72f3('0x6'));module['exports']=function(_0x4acdc8,_0x4500bf){return _0x4acdc8['define']('SugarcrmConfiguration',attributes,{'tableName':_0x72f3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5380=['request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31b70c,_0x31ad2c){var _0x4c856b=function(_0x752779){while(--_0x752779){_0x31b70c['push'](_0x31b70c['shift']());}};_0x4c856b(++_0x31ad2c);}(_0x5380,0x173));var _0x0538=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5380[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0538('0x0'));var util=require(_0x0538('0x1'));var logger=require(_0x0538('0x2'))(_0x0538('0x3'));var moment=require(_0x0538('0x4'));var BPromise=require(_0x0538('0x5'));var rp=require(_0x0538('0x6'));var fs=require('fs');var path=require(_0x0538('0x7'));var rimraf=require('rimraf');var config=require(_0x0538('0x8'));var attributes=require(_0x0538('0x9'));module[_0x0538('0xa')]=function(_0x180f15,_0x8bc860){return _0x180f15[_0x0538('0xb')](_0x0538('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 2cc72f5..ac66c18 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 _0x4422=['error','SugarcrmConfiguration,\x20%s,\x20%s','message','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','code'];(function(_0x5008c6,_0x18e53e){var _0x1bf3e0=function(_0x586e89){while(--_0x586e89){_0x5008c6['push'](_0x5008c6['shift']());}};_0x1bf3e0(++_0x18e53e);}(_0x4422,0x1a5));var _0x2442=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4422[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x2442('0x0'));var moment=require('moment');var BPromise=require(_0x2442('0x1'));var rs=require(_0x2442('0x2'));var fs=require('fs');var Redis=require(_0x2442('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2442('0x4'));var logger=require(_0x2442('0x5'))(_0x2442('0x6'));var config=require(_0x2442('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2442('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2d3e,_0x74301c,_0x1889eb){return new BPromise(function(_0x48ad87,_0x2c74b6){return client[_0x2442('0x9')](_0x1d2d3e,_0x1889eb)[_0x2442('0xa')](function(_0x2e8f84){logger[_0x2442('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x74301c,_0x2442('0xc'));logger[_0x2442('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x74301c,_0x2442('0xc'),JSON[_0x2442('0xe')](_0x2e8f84));if(_0x2e8f84['error']){if(_0x2e8f84['error'][_0x2442('0xf')]===0x1f4){logger[_0x2442('0x10')](_0x2442('0x11'),_0x74301c,_0x2e8f84[_0x2442('0x10')]['message']);return _0x2c74b6(_0x2e8f84[_0x2442('0x10')]['message']);}logger[_0x2442('0x10')](_0x2442('0x11'),_0x74301c,_0x2e8f84['error'][_0x2442('0x12')]);return _0x48ad87(_0x2e8f84[_0x2442('0x10')]['message']);}else{logger[_0x2442('0xb')](_0x2442('0x11'),_0x74301c,_0x2442('0xc'));_0x48ad87(_0x2e8f84['result']['message']);}})['catch'](function(_0x2ccdaf){logger[_0x2442('0x10')](_0x2442('0x11'),_0x74301c,_0x2ccdaf);_0x2c74b6(_0x2ccdaf);});});} \ No newline at end of file +var _0xfdd0=['info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfdd0,0x1d4));var _0x0fdd=function(_0x44a9c8,_0x19facb){_0x44a9c8=_0x44a9c8-0x0;var _0x3a3d70=_0xfdd0[_0x44a9c8];return _0x3a3d70;};'use strict';var _=require(_0x0fdd('0x0'));var util=require(_0x0fdd('0x1'));var moment=require(_0x0fdd('0x2'));var BPromise=require(_0x0fdd('0x3'));var rs=require(_0x0fdd('0x4'));var fs=require('fs');var Redis=require(_0x0fdd('0x5'));var db=require(_0x0fdd('0x6'))['db'];var utils=require(_0x0fdd('0x7'));var logger=require(_0x0fdd('0x8'))(_0x0fdd('0x9'));var config=require('../../config/environment');var jayson=require(_0x0fdd('0xa'));var client=jayson[_0x0fdd('0xb')][_0x0fdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13adb8,_0x372332,_0x3cae2c){return new BPromise(function(_0x3109c6,_0x2d78ca){return client[_0x0fdd('0xd')](_0x13adb8,_0x3cae2c)[_0x0fdd('0xe')](function(_0x112565){logger[_0x0fdd('0xf')](_0x0fdd('0x10'),_0x372332,'request\x20sent');logger['debug'](_0x0fdd('0x11'),_0x372332,_0x0fdd('0x12'),JSON['stringify'](_0x112565));if(_0x112565[_0x0fdd('0x13')]){if(_0x112565[_0x0fdd('0x13')][_0x0fdd('0x14')]===0x1f4){logger[_0x0fdd('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x372332,_0x112565[_0x0fdd('0x13')][_0x0fdd('0x15')]);return _0x2d78ca(_0x112565['error'][_0x0fdd('0x15')]);}logger[_0x0fdd('0x13')](_0x0fdd('0x10'),_0x372332,_0x112565[_0x0fdd('0x13')][_0x0fdd('0x15')]);return _0x3109c6(_0x112565[_0x0fdd('0x13')][_0x0fdd('0x15')]);}else{logger[_0x0fdd('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x372332,_0x0fdd('0x12'));_0x3109c6(_0x112565['result']['message']);}})[_0x0fdd('0x16')](function(_0x25d5d3){logger['error'](_0x0fdd('0x10'),_0x372332,_0x25d5d3);_0x2d78ca(_0x25d5d3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 12fc82c..163b47c 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 _0x4a77=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0x4a77,0x6b));var _0x74a7=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0x4a77[_0x122fe6];return _0x36b7d2;};'use strict';var multer=require(_0x74a7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74a7('0x1'));var router=express['Router']();var fs_extra=require(_0x74a7('0x2'));var auth=require(_0x74a7('0x3'));var interaction=require(_0x74a7('0x4'));var config=require(_0x74a7('0x5'));var controller=require(_0x74a7('0x6'));router[_0x74a7('0x7')]('/',auth[_0x74a7('0x8')](),controller[_0x74a7('0x9')]);router[_0x74a7('0x7')](_0x74a7('0xa'),auth[_0x74a7('0x8')](),controller[_0x74a7('0xb')]);router[_0x74a7('0xc')]('/',auth[_0x74a7('0x8')](),controller[_0x74a7('0xd')]);router['put'](_0x74a7('0xa'),auth[_0x74a7('0x8')](),controller[_0x74a7('0xe')]);router[_0x74a7('0xf')](_0x74a7('0xa'),auth[_0x74a7('0x8')](),controller[_0x74a7('0x10')]);module[_0x74a7('0x11')]=router; \ No newline at end of file +var _0x8d86=['/:id','isAuthenticated','show','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./intSugarcrmField.controller','get','index'];(function(_0x46e749,_0x9b62a){var _0x1b776f=function(_0xe39362){while(--_0xe39362){_0x46e749['push'](_0x46e749['shift']());}};_0x1b776f(++_0x9b62a);}(_0x8d86,0xc6));var _0x68d8=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x8d86[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0x68d8('0x0'));var util=require(_0x68d8('0x1'));var path=require(_0x68d8('0x2'));var timeout=require(_0x68d8('0x3'));var express=require(_0x68d8('0x4'));var router=express['Router']();var fs_extra=require(_0x68d8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x68d8('0x6'));var controller=require(_0x68d8('0x7'));router[_0x68d8('0x8')]('/',auth['isAuthenticated'](),controller[_0x68d8('0x9')]);router[_0x68d8('0x8')](_0x68d8('0xa'),auth[_0x68d8('0xb')](),controller[_0x68d8('0xc')]);router['post']('/',auth[_0x68d8('0xb')](),controller['create']);router[_0x68d8('0xd')](_0x68d8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x68d8('0xe')](_0x68d8('0xa'),auth[_0x68d8('0xb')](),controller['destroy']);module[_0x68d8('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9d7412a..968ee83 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 _0x7889=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5102c4,_0x29555f){var _0x49cdb2=function(_0x21417d){while(--_0x21417d){_0x5102c4['push'](_0x5102c4['shift']());}};_0x49cdb2(++_0x29555f);}(_0x7889,0x182));var _0x9788=function(_0xaea87b,_0x260631){_0xaea87b=_0xaea87b-0x0;var _0x4b819c=_0x7889[_0xaea87b];return _0x4b819c;};'use strict';var Sequelize=require(_0x9788('0x0'));module[_0x9788('0x1')]={'type':{'type':Sequelize[_0x9788('0x2')](_0x9788('0x3'),_0x9788('0x4'),_0x9788('0x5'),_0x9788('0x6'),_0x9788('0x7')),'defaultValue':_0x9788('0x3')},'content':{'type':Sequelize[_0x9788('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9788('0x2')](_0x9788('0x3'),_0x9788('0x4'),_0x9788('0x5'))},'keyContent':{'type':Sequelize[_0x9788('0x8')]},'idField':{'type':Sequelize[_0x9788('0x8')]},'nameField':{'type':Sequelize[_0x9788('0x8')]},'customField':{'type':Sequelize[_0x9788('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9788('0x8')]}}; \ No newline at end of file +var _0xea4e=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x1c00bc,_0xb17e9e){var _0x4806e1=function(_0x40ef1f){while(--_0x40ef1f){_0x1c00bc['push'](_0x1c00bc['shift']());}};_0x4806e1(++_0xb17e9e);}(_0xea4e,0x114));var _0xeea4=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0xea4e[_0x52a6e3];return _0x8910d0;};'use strict';var Sequelize=require('sequelize');module[_0xeea4('0x0')]={'type':{'type':Sequelize[_0xeea4('0x1')](_0xeea4('0x2'),_0xeea4('0x3'),_0xeea4('0x4'),_0xeea4('0x5'),_0xeea4('0x6')),'defaultValue':_0xeea4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xeea4('0x7')]},'keyType':{'type':Sequelize[_0xeea4('0x1')](_0xeea4('0x2'),_0xeea4('0x3'),_0xeea4('0x4'))},'keyContent':{'type':Sequelize[_0xeea4('0x7')]},'idField':{'type':Sequelize[_0xeea4('0x7')]},'nameField':{'type':Sequelize[_0xeea4('0x7')]},'customField':{'type':Sequelize[_0xeea4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d3e8dad..24fdc2d 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 _0xcd3c=['to-csv','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','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1e3cef,_0xab63e5){var _0x3fdaa0=function(_0x14c07f){while(--_0x14c07f){_0x1e3cef['push'](_0x1e3cef['shift']());}};_0x3fdaa0(++_0xab63e5);}(_0xcd3c,0x1b8));var _0xccd3=function(_0x17ab57,_0x1516e9){_0x17ab57=_0x17ab57-0x0;var _0x572c03=_0xcd3c[_0x17ab57];return _0x572c03;};'use strict';var emlformat=require(_0xccd3('0x0'));var rimraf=require(_0xccd3('0x1'));var zipdir=require(_0xccd3('0x2'));var jsonpatch=require(_0xccd3('0x3'));var rp=require(_0xccd3('0x4'));var moment=require(_0xccd3('0x5'));var BPromise=require(_0xccd3('0x6'));var Mustache=require(_0xccd3('0x7'));var util=require('util');var path=require(_0xccd3('0x8'));var sox=require(_0xccd3('0x9'));var csv=require('to-csv');var ejs=require(_0xccd3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccd3('0xb'));var squel=require(_0xccd3('0xc'));var crypto=require(_0xccd3('0xd'));var jsforce=require(_0xccd3('0xe'));var deskjs=require(_0xccd3('0xf'));var toCsv=require(_0xccd3('0x10'));var querystring=require(_0xccd3('0x11'));var Papa=require(_0xccd3('0x12'));var Redis=require(_0xccd3('0x13'));var authService=require(_0xccd3('0x14'));var qs=require(_0xccd3('0x15'));var as=require(_0xccd3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccd3('0x17'))(_0xccd3('0x18'));var utils=require(_0xccd3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xccd3('0x1a'));var db=require(_0xccd3('0x1b'))['db'];function respondWithStatusCode(_0x5b5f7e,_0xadf9e4){_0xadf9e4=_0xadf9e4||0xcc;return function(_0x4ba63a){if(_0x4ba63a){return _0x5b5f7e[_0xccd3('0x1c')](_0xadf9e4);}return _0x5b5f7e[_0xccd3('0x1d')](_0xadf9e4)[_0xccd3('0x1e')]();};}function respondWithResult(_0x55b962,_0x1fe486){_0x1fe486=_0x1fe486||0xc8;return function(_0x389ac8){if(_0x389ac8){return _0x55b962[_0xccd3('0x1d')](_0x1fe486)[_0xccd3('0x1f')](_0x389ac8);}};}function respondWithFilteredResult(_0x2f97ff,_0x2df313){return function(_0x3133c0){if(_0x3133c0){var _0x5daabb=typeof _0x2df313[_0xccd3('0x20')]===_0xccd3('0x21')&&typeof _0x2df313[_0xccd3('0x22')]===_0xccd3('0x21');var _0x52906b=_0x3133c0[_0xccd3('0x23')];var _0x19aae4=_0x5daabb?0x0:_0x2df313['offset'];var _0x467cc0=_0x5daabb?_0x3133c0[_0xccd3('0x23')]:_0x2df313[_0xccd3('0x20')]+_0x2df313['limit'];var _0x5045e4;if(_0x467cc0>=_0x52906b){_0x467cc0=_0x52906b;_0x5045e4=0xc8;}else{_0x5045e4=0xce;}_0x2f97ff[_0xccd3('0x1d')](_0x5045e4);return _0x2f97ff['set']('Content-Range',_0x19aae4+'-'+_0x467cc0+'/'+_0x52906b)[_0xccd3('0x1f')](_0x3133c0);}return null;};}function patchUpdates(_0x5784e2){return function(_0x5e5bc9){try{jsonpatch[_0xccd3('0x24')](_0x5e5bc9,_0x5784e2,!![]);}catch(_0x2a4c48){return BPromise[_0xccd3('0x25')](_0x2a4c48);}return _0x5e5bc9['save']();};}function saveUpdates(_0x11d5d2,_0x4d7d68){return function(_0xa0fb68){if(_0xa0fb68){return _0xa0fb68[_0xccd3('0x26')](_0x11d5d2)[_0xccd3('0x27')](function(_0x326005){return _0x326005;});}return null;};}function removeEntity(_0x5e238c,_0x9b92e5){return function(_0x497768){if(_0x497768){return _0x497768[_0xccd3('0x28')]()[_0xccd3('0x27')](function(){_0x5e238c[_0xccd3('0x1d')](0xcc)[_0xccd3('0x1e')]();});}};}function handleEntityNotFound(_0x2544cb,_0x4f435c){return function(_0x1bdb1e){if(!_0x1bdb1e){_0x2544cb[_0xccd3('0x1c')](0x194);}return _0x1bdb1e;};}function handleError(_0x9c53ac,_0x4ec1ff){_0x4ec1ff=_0x4ec1ff||0x1f4;return function(_0xa5e64d){logger[_0xccd3('0x29')](_0xa5e64d[_0xccd3('0x2a')]);if(_0xa5e64d[_0xccd3('0x2b')]){delete _0xa5e64d[_0xccd3('0x2b')];}_0x9c53ac[_0xccd3('0x1d')](_0x4ec1ff)[_0xccd3('0x2c')](_0xa5e64d);};}exports[_0xccd3('0x2d')]=function(_0x22b93e,_0xc80b30){var _0xf39080={},_0x313363={},_0x16a888={'count':0x0,'rows':[]};var _0x4bd77b=_[_0xccd3('0x2e')](db[_0xccd3('0x2f')][_0xccd3('0x30')],function(_0x2411b7){return{'name':_0x2411b7['fieldName'],'type':_0x2411b7['type'][_0xccd3('0x31')]};});_0x313363[_0xccd3('0x32')]=_['map'](_0x4bd77b,'name');_0x313363[_0xccd3('0x33')]=_[_0xccd3('0x34')](_0x22b93e[_0xccd3('0x33')]);_0x313363[_0xccd3('0x35')]=_[_0xccd3('0x36')](_0x313363[_0xccd3('0x32')],_0x313363[_0xccd3('0x33')]);_0xf39080['attributes']=_[_0xccd3('0x36')](_0x313363[_0xccd3('0x32')],qs[_0xccd3('0x37')](_0x22b93e[_0xccd3('0x33')][_0xccd3('0x37')]));_0xf39080['attributes']=_0xf39080['attributes'][_0xccd3('0x38')]?_0xf39080[_0xccd3('0x39')]:_0x313363['model'];if(!_0x22b93e['query'][_0xccd3('0x3a')](_0xccd3('0x3b'))){_0xf39080['limit']=qs[_0xccd3('0x22')](_0x22b93e[_0xccd3('0x33')][_0xccd3('0x22')]);_0xf39080['offset']=qs[_0xccd3('0x20')](_0x22b93e[_0xccd3('0x33')]['offset']);}_0xf39080['order']=qs[_0xccd3('0x3c')](_0x22b93e[_0xccd3('0x33')][_0xccd3('0x3c')]);_0xf39080[_0xccd3('0x3d')]=qs[_0xccd3('0x35')](_[_0xccd3('0x3e')](_0x22b93e[_0xccd3('0x33')],_0x313363[_0xccd3('0x35')]),_0x4bd77b);if(_0x22b93e[_0xccd3('0x33')][_0xccd3('0x3f')]){_0xf39080[_0xccd3('0x3d')]=_[_0xccd3('0x40')](_0xf39080[_0xccd3('0x3d')],{'$or':_[_0xccd3('0x2e')](_0x4bd77b,function(_0x325e3c){if(_0x325e3c['type']!==_0xccd3('0x41')){var _0x45b019={};_0x45b019[_0x325e3c[_0xccd3('0x2b')]]={'$like':'%'+_0x22b93e[_0xccd3('0x33')][_0xccd3('0x3f')]+'%'};return _0x45b019;}})});}_0xf39080=_[_0xccd3('0x40')]({},_0xf39080,_0x22b93e['options']);var _0x2e3cbb={'where':_0xf39080['where']};return db[_0xccd3('0x2f')]['count'](_0x2e3cbb)[_0xccd3('0x27')](function(_0x4e2abb){_0x16a888[_0xccd3('0x23')]=_0x4e2abb;if(_0x22b93e[_0xccd3('0x33')]['includeAll']){_0xf39080[_0xccd3('0x42')]=[{'all':!![]}];}return db[_0xccd3('0x2f')][_0xccd3('0x43')](_0xf39080);})['then'](function(_0x133090){_0x16a888['rows']=_0x133090;return _0x16a888;})['then'](respondWithFilteredResult(_0xc80b30,_0xf39080))['catch'](handleError(_0xc80b30,null));};exports[_0xccd3('0x44')]=function(_0x1d6807,_0x485dad){var _0x29934c={'raw':!![],'where':{'id':_0x1d6807[_0xccd3('0x45')]['id']}},_0x12ec95={};_0x12ec95['model']=_[_0xccd3('0x34')](db[_0xccd3('0x2f')][_0xccd3('0x30')]);_0x12ec95[_0xccd3('0x33')]=_[_0xccd3('0x34')](_0x1d6807[_0xccd3('0x33')]);_0x12ec95[_0xccd3('0x35')]=_['intersection'](_0x12ec95['model'],_0x12ec95['query']);_0x29934c[_0xccd3('0x39')]=_['intersection'](_0x12ec95['model'],qs[_0xccd3('0x37')](_0x1d6807[_0xccd3('0x33')]['fields']));_0x29934c[_0xccd3('0x39')]=_0x29934c[_0xccd3('0x39')][_0xccd3('0x38')]?_0x29934c[_0xccd3('0x39')]:_0x12ec95[_0xccd3('0x32')];if(_0x1d6807[_0xccd3('0x33')][_0xccd3('0x46')]){_0x29934c['include']=[{'all':!![]}];}_0x29934c=_[_0xccd3('0x40')]({},_0x29934c,_0x1d6807[_0xccd3('0x47')]);return db[_0xccd3('0x2f')][_0xccd3('0x48')](_0x29934c)[_0xccd3('0x27')](handleEntityNotFound(_0x485dad,null))[_0xccd3('0x27')](respondWithResult(_0x485dad,null))[_0xccd3('0x49')](handleError(_0x485dad,null));};exports[_0xccd3('0x4a')]=function(_0x523c77,_0x1907c4){return db[_0xccd3('0x2f')]['create'](_0x523c77[_0xccd3('0x4b')],{})[_0xccd3('0x27')](respondWithResult(_0x1907c4,0xc9))['catch'](handleError(_0x1907c4,null));};exports[_0xccd3('0x26')]=function(_0x4a46f9,_0x556c14){if(_0x4a46f9['body']['id']){delete _0x4a46f9['body']['id'];}return db[_0xccd3('0x2f')][_0xccd3('0x48')]({'where':{'id':_0x4a46f9[_0xccd3('0x45')]['id']}})[_0xccd3('0x27')](handleEntityNotFound(_0x556c14,null))[_0xccd3('0x27')](saveUpdates(_0x4a46f9[_0xccd3('0x4b')],null))['then'](respondWithResult(_0x556c14,null))[_0xccd3('0x49')](handleError(_0x556c14,null));};exports[_0xccd3('0x28')]=function(_0x2c1436,_0x2880d8){return db['SugarcrmField'][_0xccd3('0x48')]({'where':{'id':_0x2c1436['params']['id']}})['then'](handleEntityNotFound(_0x2880d8,null))['then'](removeEntity(_0x2880d8,null))['catch'](handleError(_0x2880d8,null));}; \ No newline at end of file +var _0x63f0=['filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','query'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x63f0,0x66));var _0x063f=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x63f0[_0x102ff9];return _0x24fa97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x063f('0x0'));var zipdir=require(_0x063f('0x1'));var jsonpatch=require(_0x063f('0x2'));var rp=require(_0x063f('0x3'));var moment=require(_0x063f('0x4'));var BPromise=require(_0x063f('0x5'));var Mustache=require('mustache');var util=require(_0x063f('0x6'));var path=require(_0x063f('0x7'));var sox=require(_0x063f('0x8'));var csv=require(_0x063f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x063f('0xa'));var _=require('lodash');var squel=require(_0x063f('0xb'));var crypto=require(_0x063f('0xc'));var jsforce=require(_0x063f('0xd'));var deskjs=require(_0x063f('0xe'));var toCsv=require(_0x063f('0x9'));var querystring=require(_0x063f('0xf'));var Papa=require(_0x063f('0x10'));var Redis=require(_0x063f('0x11'));var authService=require(_0x063f('0x12'));var qs=require(_0x063f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x063f('0x14'));var utils=require(_0x063f('0x15'));var config=require(_0x063f('0x16'));var licenseUtil=require(_0x063f('0x17'));var db=require(_0x063f('0x18'))['db'];function respondWithStatusCode(_0xf68e58,_0x504d02){_0x504d02=_0x504d02||0xcc;return function(_0x2a0933){if(_0x2a0933){return _0xf68e58[_0x063f('0x19')](_0x504d02);}return _0xf68e58[_0x063f('0x1a')](_0x504d02)[_0x063f('0x1b')]();};}function respondWithResult(_0x5a5893,_0x30a0c3){_0x30a0c3=_0x30a0c3||0xc8;return function(_0x37e9f6){if(_0x37e9f6){return _0x5a5893['status'](_0x30a0c3)[_0x063f('0x1c')](_0x37e9f6);}};}function respondWithFilteredResult(_0x1c6801,_0xcdd612){return function(_0x1532f9){if(_0x1532f9){var _0x134ea7=typeof _0xcdd612[_0x063f('0x1d')]===_0x063f('0x1e')&&typeof _0xcdd612[_0x063f('0x1f')]===_0x063f('0x1e');var _0x4b23cc=_0x1532f9[_0x063f('0x20')];var _0x29d0f7=_0x134ea7?0x0:_0xcdd612[_0x063f('0x1d')];var _0x1311d1=_0x134ea7?_0x1532f9[_0x063f('0x20')]:_0xcdd612[_0x063f('0x1d')]+_0xcdd612[_0x063f('0x1f')];var _0x26833f;if(_0x1311d1>=_0x4b23cc){_0x1311d1=_0x4b23cc;_0x26833f=0xc8;}else{_0x26833f=0xce;}_0x1c6801[_0x063f('0x1a')](_0x26833f);return _0x1c6801['set'](_0x063f('0x21'),_0x29d0f7+'-'+_0x1311d1+'/'+_0x4b23cc)[_0x063f('0x1c')](_0x1532f9);}return null;};}function patchUpdates(_0x232a17){return function(_0x2d4195){try{jsonpatch[_0x063f('0x22')](_0x2d4195,_0x232a17,!![]);}catch(_0x51a79b){return BPromise[_0x063f('0x23')](_0x51a79b);}return _0x2d4195[_0x063f('0x24')]();};}function saveUpdates(_0x5a0c4d,_0x4f979d){return function(_0x4bee3f){if(_0x4bee3f){return _0x4bee3f[_0x063f('0x25')](_0x5a0c4d)[_0x063f('0x26')](function(_0x5af33e){return _0x5af33e;});}return null;};}function removeEntity(_0x31e410,_0x47f0cd){return function(_0x9e3c61){if(_0x9e3c61){return _0x9e3c61[_0x063f('0x27')]()[_0x063f('0x26')](function(){_0x31e410['status'](0xcc)[_0x063f('0x1b')]();});}};}function handleEntityNotFound(_0x3a6a57,_0x2938fa){return function(_0x167129){if(!_0x167129){_0x3a6a57[_0x063f('0x19')](0x194);}return _0x167129;};}function handleError(_0x20c998,_0x51a918){_0x51a918=_0x51a918||0x1f4;return function(_0x4f7388){logger[_0x063f('0x28')](_0x4f7388['stack']);if(_0x4f7388[_0x063f('0x29')]){delete _0x4f7388[_0x063f('0x29')];}_0x20c998[_0x063f('0x1a')](_0x51a918)[_0x063f('0x2a')](_0x4f7388);};}exports[_0x063f('0x2b')]=function(_0x5337ce,_0x435cd7){var _0x44a70b={},_0x2c1fb6={},_0x5decbb={'count':0x0,'rows':[]};var _0x2689e6=_[_0x063f('0x2c')](db[_0x063f('0x2d')][_0x063f('0x2e')],function(_0xafecd0){return{'name':_0xafecd0[_0x063f('0x2f')],'type':_0xafecd0[_0x063f('0x30')]['key']};});_0x2c1fb6['model']=_[_0x063f('0x2c')](_0x2689e6,'name');_0x2c1fb6[_0x063f('0x31')]=_['keys'](_0x5337ce[_0x063f('0x31')]);_0x2c1fb6[_0x063f('0x32')]=_['intersection'](_0x2c1fb6['model'],_0x2c1fb6[_0x063f('0x31')]);_0x44a70b[_0x063f('0x33')]=_[_0x063f('0x34')](_0x2c1fb6['model'],qs[_0x063f('0x35')](_0x5337ce[_0x063f('0x31')][_0x063f('0x35')]));_0x44a70b[_0x063f('0x33')]=_0x44a70b[_0x063f('0x33')][_0x063f('0x36')]?_0x44a70b[_0x063f('0x33')]:_0x2c1fb6[_0x063f('0x37')];if(!_0x5337ce[_0x063f('0x31')][_0x063f('0x38')](_0x063f('0x39'))){_0x44a70b['limit']=qs[_0x063f('0x1f')](_0x5337ce['query'][_0x063f('0x1f')]);_0x44a70b[_0x063f('0x1d')]=qs['offset'](_0x5337ce[_0x063f('0x31')][_0x063f('0x1d')]);}_0x44a70b[_0x063f('0x3a')]=qs[_0x063f('0x3b')](_0x5337ce[_0x063f('0x31')][_0x063f('0x3b')]);_0x44a70b[_0x063f('0x3c')]=qs[_0x063f('0x32')](_[_0x063f('0x3d')](_0x5337ce[_0x063f('0x31')],_0x2c1fb6[_0x063f('0x32')]),_0x2689e6);if(_0x5337ce[_0x063f('0x31')][_0x063f('0x3e')]){_0x44a70b[_0x063f('0x3c')]=_['merge'](_0x44a70b[_0x063f('0x3c')],{'$or':_[_0x063f('0x2c')](_0x2689e6,function(_0x574d54){if(_0x574d54[_0x063f('0x30')]!==_0x063f('0x3f')){var _0x1accfc={};_0x1accfc[_0x574d54['name']]={'$like':'%'+_0x5337ce['query']['filter']+'%'};return _0x1accfc;}})});}_0x44a70b=_[_0x063f('0x40')]({},_0x44a70b,_0x5337ce[_0x063f('0x41')]);var _0x87d1e6={'where':_0x44a70b[_0x063f('0x3c')]};return db[_0x063f('0x2d')][_0x063f('0x20')](_0x87d1e6)[_0x063f('0x26')](function(_0x95d568){_0x5decbb[_0x063f('0x20')]=_0x95d568;if(_0x5337ce[_0x063f('0x31')][_0x063f('0x42')]){_0x44a70b[_0x063f('0x43')]=[{'all':!![]}];}return db[_0x063f('0x2d')][_0x063f('0x44')](_0x44a70b);})[_0x063f('0x26')](function(_0x44fde5){_0x5decbb[_0x063f('0x45')]=_0x44fde5;return _0x5decbb;})['then'](respondWithFilteredResult(_0x435cd7,_0x44a70b))[_0x063f('0x46')](handleError(_0x435cd7,null));};exports[_0x063f('0x47')]=function(_0xb66f50,_0x4a27b9){var _0x16f10d={'raw':!![],'where':{'id':_0xb66f50[_0x063f('0x48')]['id']}},_0x3dbf3f={};_0x3dbf3f['model']=_[_0x063f('0x49')](db[_0x063f('0x2d')]['rawAttributes']);_0x3dbf3f[_0x063f('0x31')]=_[_0x063f('0x49')](_0xb66f50['query']);_0x3dbf3f[_0x063f('0x32')]=_[_0x063f('0x34')](_0x3dbf3f[_0x063f('0x37')],_0x3dbf3f[_0x063f('0x31')]);_0x16f10d[_0x063f('0x33')]=_[_0x063f('0x34')](_0x3dbf3f[_0x063f('0x37')],qs[_0x063f('0x35')](_0xb66f50[_0x063f('0x31')][_0x063f('0x35')]));_0x16f10d['attributes']=_0x16f10d['attributes']['length']?_0x16f10d[_0x063f('0x33')]:_0x3dbf3f[_0x063f('0x37')];if(_0xb66f50[_0x063f('0x31')][_0x063f('0x42')]){_0x16f10d[_0x063f('0x43')]=[{'all':!![]}];}_0x16f10d=_[_0x063f('0x40')]({},_0x16f10d,_0xb66f50[_0x063f('0x41')]);return db[_0x063f('0x2d')][_0x063f('0x4a')](_0x16f10d)[_0x063f('0x26')](handleEntityNotFound(_0x4a27b9,null))[_0x063f('0x26')](respondWithResult(_0x4a27b9,null))[_0x063f('0x46')](handleError(_0x4a27b9,null));};exports['create']=function(_0x242eae,_0x514d6d){return db[_0x063f('0x2d')]['create'](_0x242eae['body'],{})[_0x063f('0x26')](respondWithResult(_0x514d6d,0xc9))[_0x063f('0x46')](handleError(_0x514d6d,null));};exports[_0x063f('0x25')]=function(_0x4a6b35,_0x4f7c5d){if(_0x4a6b35[_0x063f('0x4b')]['id']){delete _0x4a6b35[_0x063f('0x4b')]['id'];}return db['SugarcrmField'][_0x063f('0x4a')]({'where':{'id':_0x4a6b35[_0x063f('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f7c5d,null))[_0x063f('0x26')](saveUpdates(_0x4a6b35[_0x063f('0x4b')],null))[_0x063f('0x26')](respondWithResult(_0x4f7c5d,null))[_0x063f('0x46')](handleError(_0x4f7c5d,null));};exports[_0x063f('0x27')]=function(_0x51d3d8,_0x3510ce){return db[_0x063f('0x2d')][_0x063f('0x4a')]({'where':{'id':_0x51d3d8['params']['id']}})['then'](handleEntityNotFound(_0x3510ce,null))[_0x063f('0x26')](removeEntity(_0x3510ce,null))[_0x063f('0x46')](handleError(_0x3510ce,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6976d2c..05c58e4 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 _0x721d=['../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','../../config/logger','request-promise','path'];(function(_0x3c8bea,_0x3de5f4){var _0x3cd2b3=function(_0x48718e){while(--_0x48718e){_0x3c8bea['push'](_0x3c8bea['shift']());}};_0x3cd2b3(++_0x3de5f4);}(_0x721d,0x164));var _0xd721=function(_0x487ec9,_0x351700){_0x487ec9=_0x487ec9-0x0;var _0x5224f1=_0x721d[_0x487ec9];return _0x5224f1;};'use strict';var _=require(_0xd721('0x0'));var util=require('util');var logger=require(_0xd721('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd721('0x2'));var fs=require('fs');var path=require(_0xd721('0x3'));var rimraf=require('rimraf');var config=require(_0xd721('0x4'));var attributes=require(_0xd721('0x5'));module[_0xd721('0x6')]=function(_0x563a8b,_0x4bc02f){return _0x563a8b[_0xd721('0x7')](_0xd721('0x8'),attributes,{'tableName':_0xd721('0x9'),'paranoid':![],'indexes':[{'name':_0xd721('0xa'),'fields':['idField',_0xd721('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa242=['../../config/environment','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0xa242,0x96));var _0x2a24=function(_0x30bcfb,_0x2a4bb1){_0x30bcfb=_0x30bcfb-0x0;var _0x3276f8=_0xa242[_0x30bcfb];return _0x3276f8;};'use strict';var _=require('lodash');var util=require(_0x2a24('0x0'));var logger=require(_0x2a24('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2a24('0x2'));var rp=require(_0x2a24('0x3'));var fs=require('fs');var path=require(_0x2a24('0x4'));var rimraf=require(_0x2a24('0x5'));var config=require(_0x2a24('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x2a24('0x7')]=function(_0x272637,_0x57bdc7){return _0x272637['define'](_0x2a24('0x8'),attributes,{'tableName':_0x2a24('0x9'),'paranoid':![],'indexes':[{'name':_0x2a24('0xa'),'fields':[_0x2a24('0xb'),'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 cf2f7c7..336aa3b 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 _0x7c83=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info'];(function(_0x53d7de,_0x33310b){var _0x28c61b=function(_0x2270e0){while(--_0x2270e0){_0x53d7de['push'](_0x53d7de['shift']());}};_0x28c61b(++_0x33310b);}(_0x7c83,0x125));var _0x37c8=function(_0x28ce9c,_0x51b314){_0x28ce9c=_0x28ce9c-0x0;var _0x3ecb9e=_0x7c83[_0x28ce9c];return _0x3ecb9e;};'use strict';var _=require('lodash');var util=require(_0x37c8('0x0'));var moment=require('moment');var BPromise=require(_0x37c8('0x1'));var rs=require(_0x37c8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37c8('0x3'))['db'];var utils=require(_0x37c8('0x4'));var logger=require(_0x37c8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x37c8('0x6')][_0x37c8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x74681d,_0x20cb30,_0x4d3c28){return new BPromise(function(_0x44ddc9,_0x1d2d3f){return client[_0x37c8('0x8')](_0x74681d,_0x4d3c28)[_0x37c8('0x9')](function(_0x4c7461){logger[_0x37c8('0xa')](_0x37c8('0xb'),_0x20cb30,_0x37c8('0xc'));logger[_0x37c8('0xd')](_0x37c8('0xe'),_0x20cb30,_0x37c8('0xc'),JSON['stringify'](_0x4c7461));if(_0x4c7461[_0x37c8('0xf')]){if(_0x4c7461[_0x37c8('0xf')]['code']===0x1f4){logger['error'](_0x37c8('0xb'),_0x20cb30,_0x4c7461[_0x37c8('0xf')]['message']);return _0x1d2d3f(_0x4c7461[_0x37c8('0xf')][_0x37c8('0x10')]);}logger['error'](_0x37c8('0xb'),_0x20cb30,_0x4c7461[_0x37c8('0xf')][_0x37c8('0x10')]);return _0x44ddc9(_0x4c7461[_0x37c8('0xf')][_0x37c8('0x10')]);}else{logger['info'](_0x37c8('0xb'),_0x20cb30,'request\x20sent');_0x44ddc9(_0x4c7461[_0x37c8('0x11')]['message']);}})[_0x37c8('0x12')](function(_0x3f59d9){logger['error'](_0x37c8('0xb'),_0x20cb30,_0x3f59d9);_0x1d2d3f(_0x3f59d9);});});} \ No newline at end of file +var _0x76f3=['bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x76f3,0x189));var _0x376f=function(_0x182f69,_0x302e45){_0x182f69=_0x182f69-0x0;var _0x1fc911=_0x76f3[_0x182f69];return _0x1fc911;};'use strict';var _=require(_0x376f('0x0'));var util=require(_0x376f('0x1'));var moment=require(_0x376f('0x2'));var BPromise=require(_0x376f('0x3'));var rs=require(_0x376f('0x4'));var fs=require('fs');var Redis=require(_0x376f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x376f('0x6'));var config=require('../../config/environment');var jayson=require(_0x376f('0x7'));var client=jayson[_0x376f('0x8')][_0x376f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x379665,_0x250749,_0x351515){return new BPromise(function(_0xb3a5ad,_0x1c7533){return client[_0x376f('0xa')](_0x379665,_0x351515)['then'](function(_0x31ad67){logger['info'](_0x376f('0xb'),_0x250749,_0x376f('0xc'));logger[_0x376f('0xd')](_0x376f('0xe'),_0x250749,'request\x20sent',JSON[_0x376f('0xf')](_0x31ad67));if(_0x31ad67[_0x376f('0x10')]){if(_0x31ad67[_0x376f('0x10')]['code']===0x1f4){logger[_0x376f('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x250749,_0x31ad67[_0x376f('0x10')][_0x376f('0x11')]);return _0x1c7533(_0x31ad67[_0x376f('0x10')][_0x376f('0x11')]);}logger[_0x376f('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x250749,_0x31ad67[_0x376f('0x10')][_0x376f('0x11')]);return _0xb3a5ad(_0x31ad67[_0x376f('0x10')][_0x376f('0x11')]);}else{logger['info'](_0x376f('0xb'),_0x250749,_0x376f('0xc'));_0xb3a5ad(_0x31ad67['result'][_0x376f('0x11')]);}})['catch'](function(_0x49c31f){logger['error'](_0x376f('0xb'),_0x250749,_0x49c31f);_0x1c7533(_0x49c31f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 384f773..7b2c428 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 _0xa5ca=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x20fdb2,_0x18defb){var _0x5ea81c=function(_0x4eadf3){while(--_0x4eadf3){_0x20fdb2['push'](_0x20fdb2['shift']());}};_0x5ea81c(++_0x18defb);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xa5ca[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var path=require(_0xaa5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa5c('0x3')]();var fs_extra=require(_0xaa5c('0x4'));var auth=require(_0xaa5c('0x5'));var interaction=require(_0xaa5c('0x6'));var config=require(_0xaa5c('0x7'));var controller=require(_0xaa5c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaa5c('0x9')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller['show']);router['get'](_0xaa5c('0xc'),auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xd')]);router['get'](_0xaa5c('0xe'),auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xf')]);router[_0xaa5c('0x10')]('/',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0x11')]);router[_0xaa5c('0x10')](_0xaa5c('0xc'),auth[_0xaa5c('0xb')](),controller[_0xaa5c('0x12')]);router[_0xaa5c('0x13')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller['update']);router[_0xaa5c('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xaa5c('0x15')]=router; \ No newline at end of file +var _0xb8f7=['get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb8f7,0x1af));var _0x7b8f=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb8f7[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x7b8f('0x0'));var util=require('util');var path=require(_0x7b8f('0x1'));var timeout=require(_0x7b8f('0x2'));var express=require(_0x7b8f('0x3'));var router=express['Router']();var fs_extra=require(_0x7b8f('0x4'));var auth=require(_0x7b8f('0x5'));var interaction=require(_0x7b8f('0x6'));var config=require(_0x7b8f('0x7'));var controller=require(_0x7b8f('0x8'));router[_0x7b8f('0x9')]('/',auth[_0x7b8f('0xa')](),controller['index']);router['get']('/:id',auth[_0x7b8f('0xa')](),controller[_0x7b8f('0xb')]);router[_0x7b8f('0x9')](_0x7b8f('0xc'),auth[_0x7b8f('0xa')](),controller[_0x7b8f('0xd')]);router[_0x7b8f('0x9')]('/:id/fields',auth[_0x7b8f('0xa')](),controller[_0x7b8f('0xe')]);router['post']('/',auth[_0x7b8f('0xa')](),controller['create']);router[_0x7b8f('0xf')]('/:id/configurations',auth[_0x7b8f('0xa')](),controller['addConfiguration']);router[_0x7b8f('0x10')]('/:id',auth[_0x7b8f('0xa')](),controller['update']);router[_0x7b8f('0x11')]('/:id',auth[_0x7b8f('0xa')](),controller[_0x7b8f('0x12')]);module[_0x7b8f('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 42e5686..087c949 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 _0xc124=['exports','STRING'];(function(_0x511e3a,_0x12ec04){var _0x233ac5=function(_0x53acdd){while(--_0x53acdd){_0x511e3a['push'](_0x511e3a['shift']());}};_0x233ac5(++_0x12ec04);}(_0xc124,0x1c6));var _0x4c12=function(_0x4143e8,_0x4ddf23){_0x4143e8=_0x4143e8-0x0;var _0x5706c8=_0xc124[_0x4143e8];return _0x5706c8;};'use strict';var Sequelize=require('sequelize');module[_0x4c12('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4c12('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4c12('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4c12('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4c12('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb56c=['sequelize','STRING','HelpDesk'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb56c,0x159));var _0xcb56=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xb56c[_0x349148];return _0x2f2b0f;};'use strict';var Sequelize=require(_0xcb56('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcb56('0x1')]},'username':{'type':Sequelize[_0xcb56('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcb56('0x2')},'remoteUri':{'type':Sequelize[_0xcb56('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcb56('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xcb56('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b24fd67..5c39990 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 _0x0c55=['owner','includes','remove','editable','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','key','name','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','VtigerAccount','findAll','rows','keys','includeAll','include','find','catch','create','body','params','getConfigurations','findOne','VtigerConfiguration','order','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','sessionName','autogenerated','reference'];(function(_0x1a3dfe,_0x57e5b9){var _0x54393b=function(_0x3ea99d){while(--_0x3ea99d){_0x1a3dfe['push'](_0x1a3dfe['shift']());}};_0x54393b(++_0x57e5b9);}(_0x0c55,0x8f));var _0x50c5=function(_0x5a2340,_0x570c28){_0x5a2340=_0x5a2340-0x0;var _0xf57582=_0x0c55[_0x5a2340];return _0xf57582;};'use strict';var emlformat=require(_0x50c5('0x0'));var rimraf=require(_0x50c5('0x1'));var zipdir=require(_0x50c5('0x2'));var jsonpatch=require(_0x50c5('0x3'));var rp=require(_0x50c5('0x4'));var moment=require(_0x50c5('0x5'));var BPromise=require(_0x50c5('0x6'));var Mustache=require(_0x50c5('0x7'));var util=require(_0x50c5('0x8'));var path=require(_0x50c5('0x9'));var sox=require(_0x50c5('0xa'));var csv=require(_0x50c5('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50c5('0xc'));var squel=require(_0x50c5('0xd'));var crypto=require('crypto');var jsforce=require(_0x50c5('0xe'));var deskjs=require(_0x50c5('0xf'));var toCsv=require(_0x50c5('0xb'));var querystring=require(_0x50c5('0x10'));var Papa=require(_0x50c5('0x11'));var Redis=require(_0x50c5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x50c5('0x13'));var as=require(_0x50c5('0x14'));var hardwareService=require(_0x50c5('0x15'));var logger=require(_0x50c5('0x16'))(_0x50c5('0x17'));var utils=require(_0x50c5('0x18'));var config=require(_0x50c5('0x19'));var licenseUtil=require(_0x50c5('0x1a'));var db=require(_0x50c5('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x17cc10,_0x5058ec){_0x5058ec=_0x5058ec||0xcc;return function(_0x5e3c3a){if(_0x5e3c3a){return _0x17cc10[_0x50c5('0x1c')](_0x5058ec);}return _0x17cc10[_0x50c5('0x1d')](_0x5058ec)[_0x50c5('0x1e')]();};}function respondWithResult(_0x33aef2,_0x4b6829){_0x4b6829=_0x4b6829||0xc8;return function(_0x4b44ec){if(_0x4b44ec){return _0x33aef2[_0x50c5('0x1d')](_0x4b6829)['json'](_0x4b44ec);}};}function respondWithFilteredResult(_0x594147,_0x2a53de){return function(_0x458f64){if(_0x458f64){var _0x19a965=typeof _0x2a53de[_0x50c5('0x1f')]===_0x50c5('0x20')&&typeof _0x2a53de['limit']===_0x50c5('0x20');var _0x36967d=_0x458f64['count'];var _0x548737=_0x19a965?0x0:_0x2a53de[_0x50c5('0x1f')];var _0x3d142b=_0x19a965?_0x458f64[_0x50c5('0x21')]:_0x2a53de['offset']+_0x2a53de[_0x50c5('0x22')];var _0x1221d6;if(_0x3d142b>=_0x36967d){_0x3d142b=_0x36967d;_0x1221d6=0xc8;}else{_0x1221d6=0xce;}_0x594147['status'](_0x1221d6);return _0x594147[_0x50c5('0x23')](_0x50c5('0x24'),_0x548737+'-'+_0x3d142b+'/'+_0x36967d)[_0x50c5('0x25')](_0x458f64);}return null;};}function patchUpdates(_0x1a5f93){return function(_0x27a8f9){try{jsonpatch['apply'](_0x27a8f9,_0x1a5f93,!![]);}catch(_0x473e9b){return BPromise['reject'](_0x473e9b);}return _0x27a8f9[_0x50c5('0x26')]();};}function saveUpdates(_0x149450,_0x26d84c){return function(_0x555b6a){if(_0x555b6a){return _0x555b6a[_0x50c5('0x27')](_0x149450)[_0x50c5('0x28')](function(_0x266bfd){return _0x266bfd;});}return null;};}function removeEntity(_0x27cd42,_0x35465f){return function(_0x472786){if(_0x472786){return _0x472786[_0x50c5('0x29')]()[_0x50c5('0x28')](function(){_0x27cd42[_0x50c5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5473cf,_0x36cc0a){return function(_0x403fbd){if(!_0x403fbd){_0x5473cf[_0x50c5('0x1c')](0x194);}return _0x403fbd;};}function handleError(_0xaff2df,_0xd0102){_0xd0102=_0xd0102||0x1f4;return function(_0x18ca40){logger[_0x50c5('0x2a')](_0x18ca40[_0x50c5('0x2b')]);if(_0x18ca40['name']){delete _0x18ca40['name'];}_0xaff2df[_0x50c5('0x1d')](_0xd0102)[_0x50c5('0x2c')](_0x18ca40);};}exports['index']=function(_0x95884e,_0x1f9c56){var _0x11d4fd={},_0x1e0f0a={},_0x4eec1f={'count':0x0,'rows':[]};var _0x158e40=_[_0x50c5('0x2d')](db['VtigerAccount'][_0x50c5('0x2e')],function(_0xe7ba5d){return{'name':_0xe7ba5d[_0x50c5('0x2f')],'type':_0xe7ba5d['type'][_0x50c5('0x30')]};});_0x1e0f0a['model']=_['map'](_0x158e40,_0x50c5('0x31'));_0x1e0f0a[_0x50c5('0x32')]=_['keys'](_0x95884e['query']);_0x1e0f0a[_0x50c5('0x33')]=_[_0x50c5('0x34')](_0x1e0f0a['model'],_0x1e0f0a['query']);_0x11d4fd['attributes']=_[_0x50c5('0x34')](_0x1e0f0a['model'],qs['fields'](_0x95884e[_0x50c5('0x32')][_0x50c5('0x35')]));_0x11d4fd['attributes']=_0x11d4fd[_0x50c5('0x36')][_0x50c5('0x37')]?_0x11d4fd[_0x50c5('0x36')]:_0x1e0f0a[_0x50c5('0x38')];if(!_0x95884e[_0x50c5('0x32')][_0x50c5('0x39')](_0x50c5('0x3a'))){_0x11d4fd[_0x50c5('0x22')]=qs[_0x50c5('0x22')](_0x95884e[_0x50c5('0x32')]['limit']);_0x11d4fd['offset']=qs[_0x50c5('0x1f')](_0x95884e[_0x50c5('0x32')]['offset']);}_0x11d4fd['order']=qs[_0x50c5('0x3b')](_0x95884e[_0x50c5('0x32')][_0x50c5('0x3b')]);_0x11d4fd[_0x50c5('0x3c')]=qs['filters'](_[_0x50c5('0x3d')](_0x95884e[_0x50c5('0x32')],_0x1e0f0a[_0x50c5('0x33')]),_0x158e40);if(_0x95884e[_0x50c5('0x32')]['filter']){_0x11d4fd['where']=_[_0x50c5('0x3e')](_0x11d4fd[_0x50c5('0x3c')],{'$or':_[_0x50c5('0x2d')](_0x158e40,function(_0x39dde3){if(_0x39dde3[_0x50c5('0x3f')]!==_0x50c5('0x40')){var _0x1a7b70={};_0x1a7b70[_0x39dde3[_0x50c5('0x31')]]={'$like':'%'+_0x95884e[_0x50c5('0x32')][_0x50c5('0x41')]+'%'};return _0x1a7b70;}})});}_0x11d4fd=_[_0x50c5('0x3e')]({},_0x11d4fd,_0x95884e[_0x50c5('0x42')]);var _0x478643={'where':_0x11d4fd['where']};return db['VtigerAccount'][_0x50c5('0x21')](_0x478643)[_0x50c5('0x28')](function(_0x2436a6){_0x4eec1f[_0x50c5('0x21')]=_0x2436a6;if(_0x95884e[_0x50c5('0x32')]['includeAll']){_0x11d4fd['include']=[{'all':!![]}];}return db[_0x50c5('0x43')][_0x50c5('0x44')](_0x11d4fd);})[_0x50c5('0x28')](function(_0x215d1e){_0x4eec1f[_0x50c5('0x45')]=_0x215d1e;return _0x4eec1f;})[_0x50c5('0x28')](respondWithFilteredResult(_0x1f9c56,_0x11d4fd))['catch'](handleError(_0x1f9c56,null));};exports['show']=function(_0x316701,_0x378e8a){var _0x1a9f03={'raw':![],'where':{'id':_0x316701['params']['id']}},_0xd405c1={};_0xd405c1['model']=_[_0x50c5('0x46')](db[_0x50c5('0x43')][_0x50c5('0x2e')]);_0xd405c1[_0x50c5('0x32')]=_[_0x50c5('0x46')](_0x316701[_0x50c5('0x32')]);_0xd405c1[_0x50c5('0x33')]=_[_0x50c5('0x34')](_0xd405c1['model'],_0xd405c1[_0x50c5('0x32')]);_0x1a9f03[_0x50c5('0x36')]=_[_0x50c5('0x34')](_0xd405c1[_0x50c5('0x38')],qs[_0x50c5('0x35')](_0x316701[_0x50c5('0x32')][_0x50c5('0x35')]));_0x1a9f03['attributes']=_0x1a9f03[_0x50c5('0x36')][_0x50c5('0x37')]?_0x1a9f03[_0x50c5('0x36')]:_0xd405c1[_0x50c5('0x38')];if(_0x316701[_0x50c5('0x32')][_0x50c5('0x47')]){_0x1a9f03[_0x50c5('0x48')]=[{'all':!![]}];}_0x1a9f03=_[_0x50c5('0x3e')]({},_0x1a9f03,_0x316701[_0x50c5('0x42')]);return db[_0x50c5('0x43')][_0x50c5('0x49')](_0x1a9f03)[_0x50c5('0x28')](handleEntityNotFound(_0x378e8a,null))[_0x50c5('0x28')](respondWithResult(_0x378e8a,null))[_0x50c5('0x4a')](handleError(_0x378e8a,null));};exports[_0x50c5('0x4b')]=function(_0x283871,_0x11c753){return db['VtigerAccount'][_0x50c5('0x4b')](_0x283871[_0x50c5('0x4c')],{})['then'](respondWithResult(_0x11c753,0xc9))[_0x50c5('0x4a')](handleError(_0x11c753,null));};exports[_0x50c5('0x27')]=function(_0x137695,_0x27359e){if(_0x137695[_0x50c5('0x4c')]['id']){delete _0x137695[_0x50c5('0x4c')]['id'];}return db[_0x50c5('0x43')][_0x50c5('0x49')]({'where':{'id':_0x137695['params']['id']}})[_0x50c5('0x28')](handleEntityNotFound(_0x27359e,null))['then'](saveUpdates(_0x137695[_0x50c5('0x4c')],null))[_0x50c5('0x28')](respondWithResult(_0x27359e,null))[_0x50c5('0x4a')](handleError(_0x27359e,null));};exports[_0x50c5('0x29')]=function(_0x1e5eb0,_0x1173e3){return db[_0x50c5('0x43')][_0x50c5('0x49')]({'where':{'id':_0x1e5eb0[_0x50c5('0x4d')]['id']}})[_0x50c5('0x28')](handleEntityNotFound(_0x1173e3,null))[_0x50c5('0x28')](removeEntity(_0x1173e3,null))[_0x50c5('0x4a')](handleError(_0x1173e3,null));};exports[_0x50c5('0x4e')]=function(_0x1eac99,_0x3133b4,_0x3f6b93){var _0x4883d7={};var _0x52512e={};var _0x59d570;var _0x5f31c0;return db[_0x50c5('0x43')][_0x50c5('0x4f')]({'where':{'id':_0x1eac99['params']['id']}})[_0x50c5('0x28')](handleEntityNotFound(_0x3133b4,null))[_0x50c5('0x28')](function(_0x43bf01){if(_0x43bf01){_0x59d570=_0x43bf01;_0x52512e[_0x50c5('0x38')]=_[_0x50c5('0x46')](db[_0x50c5('0x50')][_0x50c5('0x2e')]);_0x52512e[_0x50c5('0x32')]=_[_0x50c5('0x46')](_0x1eac99['query']);_0x52512e['filters']=_[_0x50c5('0x34')](_0x52512e[_0x50c5('0x38')],_0x52512e[_0x50c5('0x32')]);_0x4883d7[_0x50c5('0x36')]=_[_0x50c5('0x34')](_0x52512e[_0x50c5('0x38')],qs[_0x50c5('0x35')](_0x1eac99['query'][_0x50c5('0x35')]));_0x4883d7[_0x50c5('0x36')]=_0x4883d7[_0x50c5('0x36')][_0x50c5('0x37')]?_0x4883d7[_0x50c5('0x36')]:_0x52512e[_0x50c5('0x38')];_0x4883d7[_0x50c5('0x51')]=qs['sort'](_0x1eac99[_0x50c5('0x32')][_0x50c5('0x3b')]);_0x4883d7[_0x50c5('0x3c')]=qs[_0x50c5('0x33')](_[_0x50c5('0x3d')](_0x1eac99[_0x50c5('0x32')],_0x52512e[_0x50c5('0x33')]));if(_0x1eac99[_0x50c5('0x32')][_0x50c5('0x41')]){_0x4883d7[_0x50c5('0x3c')]=_[_0x50c5('0x3e')](_0x4883d7['where'],{'$or':_[_0x50c5('0x2d')](_0x4883d7['attributes'],function(_0x1d258e){var _0x3d15e7={};_0x3d15e7[_0x1d258e]={'$like':'%'+_0x1eac99[_0x50c5('0x32')]['filter']+'%'};return _0x3d15e7;})});}_0x4883d7=_['merge']({},_0x4883d7,_0x1eac99['options']);return _0x59d570['getConfigurations'](_0x4883d7);}})[_0x50c5('0x28')](function(_0x468745){if(_0x468745){_0x5f31c0=_0x468745[_0x50c5('0x37')];if(!_0x1eac99[_0x50c5('0x32')][_0x50c5('0x39')](_0x50c5('0x3a'))){_0x4883d7[_0x50c5('0x22')]=qs['limit'](_0x1eac99['query'][_0x50c5('0x22')]);_0x4883d7['offset']=qs['offset'](_0x1eac99[_0x50c5('0x32')][_0x50c5('0x1f')]);}return _0x59d570['getConfigurations'](_0x4883d7);}})[_0x50c5('0x28')](function(_0x1dd525){if(_0x1dd525){return _0x1dd525?{'count':_0x5f31c0,'rows':_0x1dd525}:null;}})[_0x50c5('0x28')](respondWithResult(_0x3133b4,null))[_0x50c5('0x4a')](handleError(_0x3133b4,null));};exports['addConfiguration']=function(_0x24b179,_0x4ad3e4,_0x44fb85){if(_0x24b179['body']['id']){delete _0x24b179[_0x50c5('0x4c')]['id'];}return db[_0x50c5('0x43')][_0x50c5('0x4f')]({'where':{'id':_0x24b179[_0x50c5('0x4d')]['id']}})[_0x50c5('0x28')](handleEntityNotFound(_0x4ad3e4,null))[_0x50c5('0x28')](function(_0x20a443){if(_0x20a443){_0x24b179[_0x50c5('0x4c')][_0x50c5('0x52')]=_0x20a443['id'];_0x24b179[_0x50c5('0x4c')][_0x50c5('0x53')]=integrations[_0x50c5('0x54')](_0x24b179[_0x50c5('0x4c')][_0x50c5('0x55')],_0x24b179[_0x50c5('0x4c')][_0x50c5('0x3f')]);_0x24b179[_0x50c5('0x4c')][_0x50c5('0x56')]=integrations[_0x50c5('0x57')](_0x24b179[_0x50c5('0x4c')][_0x50c5('0x55')],_0x24b179[_0x50c5('0x4c')][_0x50c5('0x3f')]);return db[_0x50c5('0x50')]['create'](_0x24b179[_0x50c5('0x4c')],{'include':[{'model':db['VtigerField'],'as':_0x50c5('0x53')},{'model':db[_0x50c5('0x58')],'as':_0x50c5('0x56')}]});}return null;})[_0x50c5('0x28')](respondWithResult(_0x4ad3e4,null))[_0x50c5('0x4a')](handleError(_0x4ad3e4,null));};var md5=require(_0x50c5('0x59'));exports[_0x50c5('0x5a')]=function(_0x1ead98,_0x2acae5,_0x1c894a){var _0x3f138f=null;var _0x36dfa8=null;var _0x4eebd5=null;var _0x352058=null;var _0x3c1fc1='';return db[_0x50c5('0x43')][_0x50c5('0x4f')]({'where':{'id':_0x1ead98[_0x50c5('0x4d')]['id']},'attributes':['id',_0x50c5('0x31'),_0x50c5('0x5b'),_0x50c5('0x5c'),'moduleName',_0x50c5('0x5d'),_0x50c5('0x5e'),_0x50c5('0x5f')]})[_0x50c5('0x28')](handleEntityNotFound(_0x2acae5,null))[_0x50c5('0x28')](function(_0x42b055){if(_0x42b055){_0x3f138f=_0x42b055[_0x50c5('0x5b')];_0x36dfa8=_0x42b055[_0x50c5('0x5f')];_0x4eebd5=_0x42b055[_0x50c5('0x60')];_0x3c1fc1=_0x42b055['remoteUri'];var _0x18a117=_0x3c1fc1[_0x50c5('0x61')](-0x1);if(_0x18a117==='/'){_0x3c1fc1=_0x3c1fc1[_0x50c5('0x62')](0x0,_0x3c1fc1[_0x50c5('0x63')](_0x18a117));}_0x352058=util[_0x50c5('0x64')](_0x50c5('0x65'),_0x3c1fc1);var _0x3fe53f={'method':_0x50c5('0x66'),'uri':_0x352058,'qs':{'operation':_0x50c5('0x67'),'username':_0x42b055[_0x50c5('0x5b')]},'json':!![]};return rp(_0x3fe53f);}})[_0x50c5('0x28')](function(_0xa7d65d){if(_0xa7d65d[_0x50c5('0x68')]){var _0x1e69bc={'method':_0x50c5('0x69'),'uri':_0x352058,'form':{'operation':_0x50c5('0x6a'),'username':_0x3f138f,'accessKey':md5(_0xa7d65d[_0x50c5('0x6b')]['token']+_0x36dfa8)},'json':!![]};return rp(_0x1e69bc);}})[_0x50c5('0x28')](function(_0x546e8b){if(_0x546e8b[_0x50c5('0x68')]){var _0x4e9f57={'method':_0x50c5('0x66'),'uri':_0x352058,'qs':{'operation':'describe','username':_0x3f138f,'sessionName':_0x546e8b[_0x50c5('0x6b')][_0x50c5('0x6c')],'elementType':_0x4eebd5},'json':!![]};return rp(_0x4e9f57);}})[_0x50c5('0x28')](function(_0x56758e){if(_0x56758e[_0x50c5('0x68')]){var _0x511244=[_0x50c5('0x6d'),_0x50c5('0x6e'),_0x50c5('0x6f')];_['remove'](_0x56758e[_0x50c5('0x6b')][_0x50c5('0x35')],function(_0x53fef3){return _0x511244[_0x50c5('0x70')](_0x53fef3[_0x50c5('0x3f')]['name']);});_[_0x50c5('0x71')](_0x56758e[_0x50c5('0x6b')]['fields'],function(_0x3c2a03){return _0x3c2a03[_0x50c5('0x72')]==='false';});return{'count':_0x56758e[_0x50c5('0x6b')][_0x50c5('0x35')][_0x50c5('0x37')],'rows':_[_0x50c5('0x2d')](_0x56758e[_0x50c5('0x6b')][_0x50c5('0x35')],function(_0xc085a5){return{'id':_0xc085a5[_0x50c5('0x31')],'name':_0xc085a5[_0x50c5('0x73')],'custom':_[_0x50c5('0x74')](_0xc085a5[_0x50c5('0x31')],'cf_')?!![]:![],'options':_0xc085a5['type'][_0x50c5('0x31')]===_0x50c5('0x75')&&_0xc085a5[_0x50c5('0x3f')][_0x50c5('0x76')][_0x50c5('0x37')]>0x0?_[_0x50c5('0x2d')](_0xc085a5[_0x50c5('0x3f')][_0x50c5('0x76')],function(_0x388fac){return{'name':_0x388fac[_0x50c5('0x73')],'value':_0x388fac[_0x50c5('0x77')]};}):[]};})};}})[_0x50c5('0x28')](respondWithResult(_0x2acae5,null))[_0x50c5('0x4a')](function(_0x2b662d){console[_0x50c5('0x78')](_0x50c5('0x79')+_0x2b662d);var _0x4e7a5d=_0x1ead98[_0x50c5('0x32')]['test']?0x1f4:_0x2b662d[_0x50c5('0x7a')]||0x1f4;logger[_0x50c5('0x2a')](_0x50c5('0x7b'),_0x50c5('0x5a'),_0x4e7a5d,JSON[_0x50c5('0x7c')](_0x2b662d));delete _0x2b662d[_0x50c5('0x31')];if(_0x4e7a5d===0x191){_0x4e7a5d=0x190;}_0x2acae5[_0x50c5('0x1d')](_0x4e7a5d)['send'](_0x1ead98['query'][_0x50c5('0x7d')]?{'message':_0x50c5('0x7e'),'statusCode':_0x2b662d[_0x50c5('0x7a')]}:_0x2b662d);});}; \ No newline at end of file +var _0xc14f=['index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','rows','catch','show','params','length','include','options','find','create','body','destroy','getConfigurations','VtigerConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','remoteUri','accessKey','username','moduleName','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','token','GET','describe','result','sessionName','autogenerated','reference','owner','remove','includes','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send'];(function(_0x42f244,_0x2ec48c){var _0xdc18d1=function(_0x3493ca){while(--_0x3493ca){_0x42f244['push'](_0x42f244['shift']());}};_0xdc18d1(++_0x2ec48c);}(_0xc14f,0x1b8));var _0xfc14=function(_0x23f8a5,_0x1e7544){_0x23f8a5=_0x23f8a5-0x0;var _0x3e48b3=_0xc14f[_0x23f8a5];return _0x3e48b3;};'use strict';var emlformat=require(_0xfc14('0x0'));var rimraf=require(_0xfc14('0x1'));var zipdir=require(_0xfc14('0x2'));var jsonpatch=require(_0xfc14('0x3'));var rp=require(_0xfc14('0x4'));var moment=require('moment');var BPromise=require(_0xfc14('0x5'));var Mustache=require(_0xfc14('0x6'));var util=require(_0xfc14('0x7'));var path=require(_0xfc14('0x8'));var sox=require(_0xfc14('0x9'));var csv=require('to-csv');var ejs=require(_0xfc14('0xa'));var fs=require('fs');var fs_extra=require(_0xfc14('0xb'));var _=require('lodash');var squel=require(_0xfc14('0xc'));var crypto=require(_0xfc14('0xd'));var jsforce=require(_0xfc14('0xe'));var deskjs=require(_0xfc14('0xf'));var toCsv=require(_0xfc14('0x10'));var querystring=require('querystring');var Papa=require(_0xfc14('0x11'));var Redis=require(_0xfc14('0x12'));var authService=require(_0xfc14('0x13'));var qs=require(_0xfc14('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc14('0x15'));var logger=require(_0xfc14('0x16'))(_0xfc14('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xfc14('0x18'));function respondWithStatusCode(_0x46115a,_0x9925e3){_0x9925e3=_0x9925e3||0xcc;return function(_0x7b1559){if(_0x7b1559){return _0x46115a[_0xfc14('0x19')](_0x9925e3);}return _0x46115a[_0xfc14('0x1a')](_0x9925e3)[_0xfc14('0x1b')]();};}function respondWithResult(_0x534c9b,_0x3a678a){_0x3a678a=_0x3a678a||0xc8;return function(_0x2a5577){if(_0x2a5577){return _0x534c9b[_0xfc14('0x1a')](_0x3a678a)[_0xfc14('0x1c')](_0x2a5577);}};}function respondWithFilteredResult(_0x3cf040,_0x1c3e8f){return function(_0x5a4e48){if(_0x5a4e48){var _0x2b065c=typeof _0x1c3e8f[_0xfc14('0x1d')]===_0xfc14('0x1e')&&typeof _0x1c3e8f[_0xfc14('0x1f')]===_0xfc14('0x1e');var _0x2f5b7e=_0x5a4e48[_0xfc14('0x20')];var _0x5cfe8b=_0x2b065c?0x0:_0x1c3e8f[_0xfc14('0x1d')];var _0x4ec3f3=_0x2b065c?_0x5a4e48[_0xfc14('0x20')]:_0x1c3e8f[_0xfc14('0x1d')]+_0x1c3e8f[_0xfc14('0x1f')];var _0x52faf9;if(_0x4ec3f3>=_0x2f5b7e){_0x4ec3f3=_0x2f5b7e;_0x52faf9=0xc8;}else{_0x52faf9=0xce;}_0x3cf040[_0xfc14('0x1a')](_0x52faf9);return _0x3cf040[_0xfc14('0x21')](_0xfc14('0x22'),_0x5cfe8b+'-'+_0x4ec3f3+'/'+_0x2f5b7e)[_0xfc14('0x1c')](_0x5a4e48);}return null;};}function patchUpdates(_0x2d2016){return function(_0x3de469){try{jsonpatch[_0xfc14('0x23')](_0x3de469,_0x2d2016,!![]);}catch(_0x4e80f5){return BPromise[_0xfc14('0x24')](_0x4e80f5);}return _0x3de469[_0xfc14('0x25')]();};}function saveUpdates(_0x3e0597,_0x54b566){return function(_0x519b96){if(_0x519b96){return _0x519b96[_0xfc14('0x26')](_0x3e0597)['then'](function(_0x2e35a9){return _0x2e35a9;});}return null;};}function removeEntity(_0x4af472,_0x18aaba){return function(_0x5e6450){if(_0x5e6450){return _0x5e6450['destroy']()[_0xfc14('0x27')](function(){_0x4af472[_0xfc14('0x1a')](0xcc)[_0xfc14('0x1b')]();});}};}function handleEntityNotFound(_0x40f810,_0x4a8f37){return function(_0x2a10fe){if(!_0x2a10fe){_0x40f810['sendStatus'](0x194);}return _0x2a10fe;};}function handleError(_0x3d9dd2,_0x15f132){_0x15f132=_0x15f132||0x1f4;return function(_0x3f1ce7){logger[_0xfc14('0x28')](_0x3f1ce7[_0xfc14('0x29')]);if(_0x3f1ce7[_0xfc14('0x2a')]){delete _0x3f1ce7['name'];}_0x3d9dd2[_0xfc14('0x1a')](_0x15f132)[_0xfc14('0x2b')](_0x3f1ce7);};}exports[_0xfc14('0x2c')]=function(_0x4da454,_0x25c3ab){var _0x530076={},_0x54915b={},_0x1873e1={'count':0x0,'rows':[]};var _0x1666a8=_[_0xfc14('0x2d')](db[_0xfc14('0x2e')][_0xfc14('0x2f')],function(_0xdc14cf){return{'name':_0xdc14cf[_0xfc14('0x30')],'type':_0xdc14cf['type'][_0xfc14('0x31')]};});_0x54915b[_0xfc14('0x32')]=_[_0xfc14('0x2d')](_0x1666a8,'name');_0x54915b[_0xfc14('0x33')]=_[_0xfc14('0x34')](_0x4da454['query']);_0x54915b['filters']=_['intersection'](_0x54915b[_0xfc14('0x32')],_0x54915b[_0xfc14('0x33')]);_0x530076[_0xfc14('0x35')]=_[_0xfc14('0x36')](_0x54915b[_0xfc14('0x32')],qs[_0xfc14('0x37')](_0x4da454[_0xfc14('0x33')]['fields']));_0x530076[_0xfc14('0x35')]=_0x530076[_0xfc14('0x35')]['length']?_0x530076['attributes']:_0x54915b[_0xfc14('0x32')];if(!_0x4da454['query'][_0xfc14('0x38')](_0xfc14('0x39'))){_0x530076[_0xfc14('0x1f')]=qs[_0xfc14('0x1f')](_0x4da454[_0xfc14('0x33')][_0xfc14('0x1f')]);_0x530076['offset']=qs[_0xfc14('0x1d')](_0x4da454[_0xfc14('0x33')]['offset']);}_0x530076[_0xfc14('0x3a')]=qs[_0xfc14('0x3b')](_0x4da454['query'][_0xfc14('0x3b')]);_0x530076[_0xfc14('0x3c')]=qs[_0xfc14('0x3d')](_[_0xfc14('0x3e')](_0x4da454[_0xfc14('0x33')],_0x54915b[_0xfc14('0x3d')]),_0x1666a8);if(_0x4da454[_0xfc14('0x33')][_0xfc14('0x3f')]){_0x530076[_0xfc14('0x3c')]=_[_0xfc14('0x40')](_0x530076['where'],{'$or':_[_0xfc14('0x2d')](_0x1666a8,function(_0x9d53f1){if(_0x9d53f1[_0xfc14('0x41')]!=='VIRTUAL'){var _0x3a9091={};_0x3a9091[_0x9d53f1[_0xfc14('0x2a')]]={'$like':'%'+_0x4da454[_0xfc14('0x33')][_0xfc14('0x3f')]+'%'};return _0x3a9091;}})});}_0x530076=_[_0xfc14('0x40')]({},_0x530076,_0x4da454['options']);var _0x2bfd36={'where':_0x530076['where']};return db['VtigerAccount']['count'](_0x2bfd36)[_0xfc14('0x27')](function(_0x44a18f){_0x1873e1[_0xfc14('0x20')]=_0x44a18f;if(_0x4da454[_0xfc14('0x33')][_0xfc14('0x42')]){_0x530076['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x530076);})[_0xfc14('0x27')](function(_0x358365){_0x1873e1[_0xfc14('0x43')]=_0x358365;return _0x1873e1;})[_0xfc14('0x27')](respondWithFilteredResult(_0x25c3ab,_0x530076))[_0xfc14('0x44')](handleError(_0x25c3ab,null));};exports[_0xfc14('0x45')]=function(_0x3f6b97,_0x662c5f){var _0x1097d6={'raw':![],'where':{'id':_0x3f6b97[_0xfc14('0x46')]['id']}},_0x594a6c={};_0x594a6c['model']=_['keys'](db['VtigerAccount'][_0xfc14('0x2f')]);_0x594a6c['query']=_[_0xfc14('0x34')](_0x3f6b97[_0xfc14('0x33')]);_0x594a6c[_0xfc14('0x3d')]=_['intersection'](_0x594a6c['model'],_0x594a6c['query']);_0x1097d6[_0xfc14('0x35')]=_[_0xfc14('0x36')](_0x594a6c[_0xfc14('0x32')],qs[_0xfc14('0x37')](_0x3f6b97[_0xfc14('0x33')][_0xfc14('0x37')]));_0x1097d6[_0xfc14('0x35')]=_0x1097d6['attributes'][_0xfc14('0x47')]?_0x1097d6[_0xfc14('0x35')]:_0x594a6c[_0xfc14('0x32')];if(_0x3f6b97[_0xfc14('0x33')][_0xfc14('0x42')]){_0x1097d6[_0xfc14('0x48')]=[{'all':!![]}];}_0x1097d6=_[_0xfc14('0x40')]({},_0x1097d6,_0x3f6b97[_0xfc14('0x49')]);return db['VtigerAccount'][_0xfc14('0x4a')](_0x1097d6)[_0xfc14('0x27')](handleEntityNotFound(_0x662c5f,null))['then'](respondWithResult(_0x662c5f,null))[_0xfc14('0x44')](handleError(_0x662c5f,null));};exports[_0xfc14('0x4b')]=function(_0x5f1082,_0xc96426){return db[_0xfc14('0x2e')][_0xfc14('0x4b')](_0x5f1082[_0xfc14('0x4c')],{})[_0xfc14('0x27')](respondWithResult(_0xc96426,0xc9))['catch'](handleError(_0xc96426,null));};exports['update']=function(_0x39bb7f,_0x249b3c){if(_0x39bb7f[_0xfc14('0x4c')]['id']){delete _0x39bb7f[_0xfc14('0x4c')]['id'];}return db['VtigerAccount'][_0xfc14('0x4a')]({'where':{'id':_0x39bb7f[_0xfc14('0x46')]['id']}})['then'](handleEntityNotFound(_0x249b3c,null))[_0xfc14('0x27')](saveUpdates(_0x39bb7f[_0xfc14('0x4c')],null))[_0xfc14('0x27')](respondWithResult(_0x249b3c,null))[_0xfc14('0x44')](handleError(_0x249b3c,null));};exports[_0xfc14('0x4d')]=function(_0x3f2906,_0x4f89de){return db[_0xfc14('0x2e')][_0xfc14('0x4a')]({'where':{'id':_0x3f2906[_0xfc14('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f89de,null))['then'](removeEntity(_0x4f89de,null))[_0xfc14('0x44')](handleError(_0x4f89de,null));};exports[_0xfc14('0x4e')]=function(_0xcae353,_0x46c4e1,_0x1f36eb){var _0x30c9f1={};var _0xcf47b4={};var _0x30b901;var _0x72a7da;return db[_0xfc14('0x2e')]['findOne']({'where':{'id':_0xcae353[_0xfc14('0x46')]['id']}})['then'](handleEntityNotFound(_0x46c4e1,null))[_0xfc14('0x27')](function(_0x3a0d22){if(_0x3a0d22){_0x30b901=_0x3a0d22;_0xcf47b4[_0xfc14('0x32')]=_[_0xfc14('0x34')](db[_0xfc14('0x4f')][_0xfc14('0x2f')]);_0xcf47b4[_0xfc14('0x33')]=_['keys'](_0xcae353[_0xfc14('0x33')]);_0xcf47b4[_0xfc14('0x3d')]=_['intersection'](_0xcf47b4['model'],_0xcf47b4[_0xfc14('0x33')]);_0x30c9f1[_0xfc14('0x35')]=_[_0xfc14('0x36')](_0xcf47b4['model'],qs['fields'](_0xcae353[_0xfc14('0x33')][_0xfc14('0x37')]));_0x30c9f1['attributes']=_0x30c9f1[_0xfc14('0x35')]['length']?_0x30c9f1[_0xfc14('0x35')]:_0xcf47b4[_0xfc14('0x32')];_0x30c9f1[_0xfc14('0x3a')]=qs['sort'](_0xcae353[_0xfc14('0x33')][_0xfc14('0x3b')]);_0x30c9f1['where']=qs[_0xfc14('0x3d')](_[_0xfc14('0x3e')](_0xcae353[_0xfc14('0x33')],_0xcf47b4[_0xfc14('0x3d')]));if(_0xcae353[_0xfc14('0x33')]['filter']){_0x30c9f1[_0xfc14('0x3c')]=_['merge'](_0x30c9f1[_0xfc14('0x3c')],{'$or':_['map'](_0x30c9f1[_0xfc14('0x35')],function(_0x189a82){var _0x404c9d={};_0x404c9d[_0x189a82]={'$like':'%'+_0xcae353[_0xfc14('0x33')]['filter']+'%'};return _0x404c9d;})});}_0x30c9f1=_[_0xfc14('0x40')]({},_0x30c9f1,_0xcae353[_0xfc14('0x49')]);return _0x30b901['getConfigurations'](_0x30c9f1);}})[_0xfc14('0x27')](function(_0x6f59e){if(_0x6f59e){_0x72a7da=_0x6f59e[_0xfc14('0x47')];if(!_0xcae353['query'][_0xfc14('0x38')]('nolimit')){_0x30c9f1[_0xfc14('0x1f')]=qs[_0xfc14('0x1f')](_0xcae353[_0xfc14('0x33')]['limit']);_0x30c9f1[_0xfc14('0x1d')]=qs[_0xfc14('0x1d')](_0xcae353[_0xfc14('0x33')][_0xfc14('0x1d')]);}return _0x30b901[_0xfc14('0x4e')](_0x30c9f1);}})[_0xfc14('0x27')](function(_0x2c093f){if(_0x2c093f){return _0x2c093f?{'count':_0x72a7da,'rows':_0x2c093f}:null;}})[_0xfc14('0x27')](respondWithResult(_0x46c4e1,null))['catch'](handleError(_0x46c4e1,null));};exports[_0xfc14('0x50')]=function(_0x323e27,_0x26e4d4,_0x4e94b4){if(_0x323e27[_0xfc14('0x4c')]['id']){delete _0x323e27[_0xfc14('0x4c')]['id'];}return db['VtigerAccount'][_0xfc14('0x51')]({'where':{'id':_0x323e27[_0xfc14('0x46')]['id']}})['then'](handleEntityNotFound(_0x26e4d4,null))[_0xfc14('0x27')](function(_0x313201){if(_0x313201){_0x323e27[_0xfc14('0x4c')]['AccountId']=_0x313201['id'];_0x323e27[_0xfc14('0x4c')][_0xfc14('0x52')]=integrations[_0xfc14('0x53')](_0x323e27[_0xfc14('0x4c')][_0xfc14('0x54')],_0x323e27[_0xfc14('0x4c')]['type']);_0x323e27['body'][_0xfc14('0x55')]=integrations['getDescriptions'](_0x323e27[_0xfc14('0x4c')][_0xfc14('0x54')],_0x323e27[_0xfc14('0x4c')][_0xfc14('0x41')]);return db[_0xfc14('0x4f')][_0xfc14('0x4b')](_0x323e27[_0xfc14('0x4c')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xfc14('0x56')],'as':_0xfc14('0x55')}]});}return null;})['then'](respondWithResult(_0x26e4d4,null))['catch'](handleError(_0x26e4d4,null));};var md5=require('md5');exports[_0xfc14('0x57')]=function(_0x554416,_0x55e440,_0x58d672){var _0x48ed82=null;var _0x1c1771=null;var _0x4781b7=null;var _0x3fe0c4=null;var _0x28165d='';return db['VtigerAccount'][_0xfc14('0x51')]({'where':{'id':_0x554416['params']['id']},'attributes':['id',_0xfc14('0x2a'),'username','description','moduleName',_0xfc14('0x58'),'serverUrl',_0xfc14('0x59')]})[_0xfc14('0x27')](handleEntityNotFound(_0x55e440,null))['then'](function(_0x1dc86b){if(_0x1dc86b){_0x48ed82=_0x1dc86b[_0xfc14('0x5a')];_0x1c1771=_0x1dc86b['accessKey'];_0x4781b7=_0x1dc86b[_0xfc14('0x5b')];_0x28165d=_0x1dc86b[_0xfc14('0x58')];var _0x3631dd=_0x28165d[_0xfc14('0x5c')](-0x1);if(_0x3631dd==='/'){_0x28165d=_0x28165d[_0xfc14('0x5d')](0x0,_0x28165d[_0xfc14('0x5e')](_0x3631dd));}_0x3fe0c4=util['format'](_0xfc14('0x5f'),_0x28165d);var _0x3260ac={'method':'GET','uri':_0x3fe0c4,'qs':{'operation':_0xfc14('0x60'),'username':_0x1dc86b[_0xfc14('0x5a')]},'json':!![]};return rp(_0x3260ac);}})[_0xfc14('0x27')](function(_0x487c87){if(_0x487c87[_0xfc14('0x61')]){var _0x5d5dcc={'method':'POST','uri':_0x3fe0c4,'form':{'operation':'login','username':_0x48ed82,'accessKey':md5(_0x487c87['result'][_0xfc14('0x62')]+_0x1c1771)},'json':!![]};return rp(_0x5d5dcc);}})['then'](function(_0x24ba7c){if(_0x24ba7c[_0xfc14('0x61')]){var _0x2a25f1={'method':_0xfc14('0x63'),'uri':_0x3fe0c4,'qs':{'operation':_0xfc14('0x64'),'username':_0x48ed82,'sessionName':_0x24ba7c[_0xfc14('0x65')][_0xfc14('0x66')],'elementType':_0x4781b7},'json':!![]};return rp(_0x2a25f1);}})[_0xfc14('0x27')](function(_0x4fd367){if(_0x4fd367[_0xfc14('0x61')]){var _0x9d79d0=[_0xfc14('0x67'),_0xfc14('0x68'),_0xfc14('0x69')];_[_0xfc14('0x6a')](_0x4fd367['result'][_0xfc14('0x37')],function(_0x2521a7){return _0x9d79d0[_0xfc14('0x6b')](_0x2521a7['type']['name']);});_[_0xfc14('0x6a')](_0x4fd367['result']['fields'],function(_0x3136a0){return _0x3136a0['editable']===_0xfc14('0x6c');});return{'count':_0x4fd367['result'][_0xfc14('0x37')][_0xfc14('0x47')],'rows':_['map'](_0x4fd367[_0xfc14('0x65')][_0xfc14('0x37')],function(_0x21bf1b){return{'id':_0x21bf1b['name'],'name':_0x21bf1b[_0xfc14('0x6d')],'custom':_[_0xfc14('0x6e')](_0x21bf1b[_0xfc14('0x2a')],'cf_')?!![]:![],'options':_0x21bf1b[_0xfc14('0x41')]['name']===_0xfc14('0x6f')&&_0x21bf1b[_0xfc14('0x41')][_0xfc14('0x70')][_0xfc14('0x47')]>0x0?_['map'](_0x21bf1b[_0xfc14('0x41')][_0xfc14('0x70')],function(_0x31ab1a){return{'name':_0x31ab1a[_0xfc14('0x6d')],'value':_0x31ab1a[_0xfc14('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x55e440,null))['catch'](function(_0x478c8b){console[_0xfc14('0x72')](_0xfc14('0x73')+_0x478c8b);var _0x4969a6=_0x554416['query'][_0xfc14('0x74')]?0x1f4:_0x478c8b[_0xfc14('0x75')]||0x1f4;logger[_0xfc14('0x28')](_0xfc14('0x76'),_0xfc14('0x57'),_0x4969a6,JSON[_0xfc14('0x77')](_0x478c8b));delete _0x478c8b[_0xfc14('0x2a')];if(_0x4969a6===0x191){_0x4969a6=0x190;}_0x55e440['status'](_0x4969a6)[_0xfc14('0x2b')](_0x554416[_0xfc14('0x33')][_0xfc14('0x74')]?{'message':_0xfc14('0x78'),'statusCode':_0x478c8b[_0xfc14('0x75')]}:_0x478c8b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7fb5887..369b99b 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 _0xf0ea=['request-promise','path','rimraf','./intVtigerAccount.attributes','exports','VtigerAccount','util','bluebird'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0xf0ea,0x10e));var _0xaf0e=function(_0x1e3ee9,_0x2b0ffb){_0x1e3ee9=_0x1e3ee9-0x0;var _0x185bb8=_0xf0ea[_0x1e3ee9];return _0x185bb8;};'use strict';var _=require('lodash');var util=require(_0xaf0e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaf0e('0x1'));var rp=require(_0xaf0e('0x2'));var fs=require('fs');var path=require(_0xaf0e('0x3'));var rimraf=require(_0xaf0e('0x4'));var config=require('../../config/environment');var attributes=require(_0xaf0e('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xaf0e('0x6')]=function(_0x3f71bb,_0x3ba80b){return _0x3f71bb['define'](_0xaf0e('0x7'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a23=['define','VtigerAccount','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x58c9a,_0x4f49d8){var _0x1d8d2d=function(_0x5a8578){while(--_0x5a8578){_0x58c9a['push'](_0x58c9a['shift']());}};_0x1d8d2d(++_0x4f49d8);}(_0x9a23,0x1be));var _0x39a2=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x9a23[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x39a2('0x0'));var util=require('util');var logger=require(_0x39a2('0x1'))(_0x39a2('0x2'));var moment=require(_0x39a2('0x3'));var BPromise=require(_0x39a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39a2('0x5'));var rimraf=require(_0x39a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x39a2('0x7'));var integrations=require(_0x39a2('0x8'));module[_0x39a2('0x9')]=function(_0x58d69d,_0x3164ab){return _0x58d69d[_0x39a2('0xa')](_0x39a2('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 4848058..b6c8c5e 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','findAll'];(function(_0x182c41,_0x58ac89){var _0x32e955=function(_0x1869e1){while(--_0x1869e1){_0x182c41['push'](_0x182c41['shift']());}};_0x32e955(++_0x58ac89);}(_0xe706,0xa3));var _0x6e70=function(_0x40cff7,_0x5c3eb5){_0x40cff7=_0x40cff7-0x0;var _0x38006f=_0xe706[_0x40cff7];return _0x38006f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['VtigerAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetVtigerAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0x065e=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','find','ShowVtigerAccount','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x441d01,_0xf8a9c6){var _0x10578d=function(_0x3a0721){while(--_0x3a0721){_0x441d01['push'](_0x441d01['shift']());}};_0x10578d(++_0xf8a9c6);}(_0x065e,0x1a7));var _0xe065=function(_0x4be000,_0x1c7319){_0x4be000=_0x4be000-0x0;var _0x4c6c89=_0x065e[_0x4be000];return _0x4c6c89;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')]({'raw':_0x1d2f7a['options']?_0x1d2f7a[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')]['where']||null:null,'attributes':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]||null:null,'limit':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x18')]||null:null,'include':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1d2f7a[_0xe065('0x16')]['include'],function(_0x7208af){return{'model':db[_0x7208af[_0xe065('0x1b')]],'as':_0x7208af['as'],'attributes':_0x7208af[_0xe065('0x17')],'include':_0x7208af[_0xe065('0x19')]?_['map'](_0x7208af['include'],function(_0x164965){return{'model':db[_0x164965['model']],'as':_0x164965['as'],'attributes':_0x164965[_0xe065('0x17')],'include':_0x164965[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x164965[_0xe065('0x19')],function(_0x418731){return{'model':db[_0x418731[_0xe065('0x1b')]],'as':_0x418731['as'],'attributes':_0x418731[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x52cd9c){logger['info'](_0xe065('0x13'),_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x52cd9c));_0x14c97c(_0x52cd9c);})['catch'](function(_0x23f573){logger['error']('GetVtigerAccount',_0x23f573[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x23f573[_0xe065('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x883747){var _0x59b915=this;return new Promise(function(_0x12679d,_0x46db7e){return db[_0xe065('0x14')][_0xe065('0x1c')]({'raw':_0x883747['options']?_0x883747[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x883747[_0xe065('0x16')]?_0x883747[_0xe065('0x16')]['where']||null:null,'attributes':_0x883747[_0xe065('0x16')]?_0x883747['options'][_0xe065('0x17')]||null:null,'include':_0x883747['options']?_0x883747[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x883747[_0xe065('0x16')]['include'],function(_0x1fe1dc){return{'model':db[_0x1fe1dc[_0xe065('0x1b')]],'as':_0x1fe1dc['as'],'attributes':_0x1fe1dc[_0xe065('0x17')],'include':_0x1fe1dc[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1fe1dc[_0xe065('0x19')],function(_0x4b822a){return{'model':db[_0x4b822a[_0xe065('0x1b')]],'as':_0x4b822a['as'],'attributes':_0x4b822a[_0xe065('0x17')],'include':_0x4b822a['include']?_[_0xe065('0x1a')](_0x4b822a[_0xe065('0x19')],function(_0x5afc23){return{'model':db[_0x5afc23[_0xe065('0x1b')]],'as':_0x5afc23['as'],'attributes':_0x5afc23[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x35135f){logger['info'](_0xe065('0x1d'),_0x883747);logger['debug'](_0xe065('0x1d'),_0x883747,JSON[_0xe065('0xe')](_0x35135f));_0x12679d(_0x35135f);})[_0xe065('0x1e')](function(_0xcceb12){logger[_0xe065('0xf')](_0xe065('0x1d'),_0xcceb12['message'],_0x883747);_0x46db7e(_0x59b915[_0xe065('0xf')](0x1f4,_0xcceb12[_0xe065('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a343307..3d87ab7 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 _0x609e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1a25dc,_0x5c8c74){var _0x1d0447=function(_0x522d35){while(--_0x522d35){_0x1a25dc['push'](_0x1a25dc['shift']());}};_0x1d0447(++_0x5c8c74);}(_0x609e,0x19a));var _0xe609=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x609e[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xe609('0x0'));var util=require(_0xe609('0x1'));var path=require(_0xe609('0x2'));var timeout=require(_0xe609('0x3'));var express=require(_0xe609('0x4'));var router=express[_0xe609('0x5')]();var fs_extra=require(_0xe609('0x6'));var auth=require(_0xe609('0x7'));var interaction=require(_0xe609('0x8'));var config=require(_0xe609('0x9'));var controller=require(_0xe609('0xa'));router['get']('/',auth[_0xe609('0xb')](),controller[_0xe609('0xc')]);router[_0xe609('0xd')](_0xe609('0xe'),auth[_0xe609('0xb')](),controller[_0xe609('0xf')]);router[_0xe609('0xd')]('/:id/fields',auth[_0xe609('0xb')](),controller[_0xe609('0x10')]);router[_0xe609('0xd')](_0xe609('0x11'),auth[_0xe609('0xb')](),controller[_0xe609('0x12')]);router[_0xe609('0xd')](_0xe609('0x13'),auth[_0xe609('0xb')](),controller[_0xe609('0x14')]);router[_0xe609('0x15')]('/',auth['isAuthenticated'](),controller[_0xe609('0x16')]);router[_0xe609('0x17')](_0xe609('0xe'),auth[_0xe609('0xb')](),controller[_0xe609('0x18')]);router['delete']('/:id',auth[_0xe609('0xb')](),controller['destroy']);module[_0xe609('0x19')]=router; \ No newline at end of file +var _0x2fc1=['delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x2d920f,_0x3283fc){var _0x3494ff=function(_0x11bef6){while(--_0x11bef6){_0x2d920f['push'](_0x2d920f['shift']());}};_0x3494ff(++_0x3283fc);}(_0x2fc1,0x1bc));var _0x12fc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2fc1[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x12fc('0x0'));var router=express[_0x12fc('0x1')]();var fs_extra=require(_0x12fc('0x2'));var auth=require(_0x12fc('0x3'));var interaction=require(_0x12fc('0x4'));var config=require('../../config/environment');var controller=require(_0x12fc('0x5'));router[_0x12fc('0x6')]('/',auth[_0x12fc('0x7')](),controller['index']);router['get'](_0x12fc('0x8'),auth[_0x12fc('0x7')](),controller['show']);router[_0x12fc('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x12fc('0x9')]);router[_0x12fc('0x6')](_0x12fc('0xa'),auth['isAuthenticated'](),controller[_0x12fc('0xb')]);router[_0x12fc('0x6')](_0x12fc('0xc'),auth[_0x12fc('0x7')](),controller[_0x12fc('0xd')]);router[_0x12fc('0xe')]('/',auth[_0x12fc('0x7')](),controller[_0x12fc('0xf')]);router[_0x12fc('0x10')](_0x12fc('0x8'),auth['isAuthenticated'](),controller[_0x12fc('0x11')]);router[_0x12fc('0x12')](_0x12fc('0x8'),auth[_0x12fc('0x7')](),controller[_0x12fc('0x13')]);module[_0x12fc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ecc59a5..0429927 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 _0xaff0=['sequelize','STRING'];(function(_0x5c41ff,_0x1a3269){var _0x28c10a=function(_0x35cc79){while(--_0x35cc79){_0x5c41ff['push'](_0x5c41ff['shift']());}};_0x28c10a(++_0x1a3269);}(_0xaff0,0x118));var _0x0aff=function(_0x1d6d5b,_0x1b66d3){_0x1d6d5b=_0x1d6d5b-0x0;var _0x5ca039=_0xaff0[_0x1d6d5b];return _0x5ca039;};'use strict';var Sequelize=require(_0x0aff('0x0'));module['exports']={'name':{'type':Sequelize[_0x0aff('0x1')]},'description':{'type':Sequelize[_0x0aff('0x1')]}}; \ No newline at end of file +var _0x004b=['exports','STRING','sequelize'];(function(_0x3dbcd1,_0x519892){var _0x506230=function(_0x2896ef){while(--_0x2896ef){_0x3dbcd1['push'](_0x3dbcd1['shift']());}};_0x506230(++_0x519892);}(_0x004b,0xa7));var _0xb004=function(_0x374ab7,_0x39593b){_0x374ab7=_0x374ab7-0x0;var _0xdc0059=_0x004b[_0x374ab7];return _0xdc0059;};'use strict';var Sequelize=require(_0xb004('0x0'));module[_0xb004('0x1')]={'name':{'type':Sequelize[_0xb004('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ce17a7c..c7a487d 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 _0x5216=['findAll','show','params','find','catch','create','body','getFields','VtigerField','order','findOne','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x5ce211,_0x1ad95b){var _0x514a81=function(_0x46e439){while(--_0x46e439){_0x5ce211['push'](_0x5ce211['shift']());}};_0x514a81(++_0x1ad95b);}(_0x5216,0x146));var _0x6521=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5216[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6521('0x0'));var zipdir=require(_0x6521('0x1'));var jsonpatch=require(_0x6521('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6521('0x3'));var Mustache=require(_0x6521('0x4'));var util=require(_0x6521('0x5'));var path=require(_0x6521('0x6'));var sox=require(_0x6521('0x7'));var csv=require('to-csv');var ejs=require(_0x6521('0x8'));var fs=require('fs');var fs_extra=require(_0x6521('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6521('0xa'));var jsforce=require(_0x6521('0xb'));var deskjs=require(_0x6521('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6521('0xd'));var Papa=require(_0x6521('0xe'));var Redis=require(_0x6521('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6521('0x10'));var as=require(_0x6521('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6521('0x12'));var utils=require(_0x6521('0x13'));var config=require(_0x6521('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6521('0x15'))['db'];function respondWithStatusCode(_0x45c1bf,_0x22bb92){_0x22bb92=_0x22bb92||0xcc;return function(_0x194fa6){if(_0x194fa6){return _0x45c1bf[_0x6521('0x16')](_0x22bb92);}return _0x45c1bf[_0x6521('0x17')](_0x22bb92)[_0x6521('0x18')]();};}function respondWithResult(_0x4820da,_0x2b4c0a){_0x2b4c0a=_0x2b4c0a||0xc8;return function(_0x465f07){if(_0x465f07){return _0x4820da[_0x6521('0x17')](_0x2b4c0a)[_0x6521('0x19')](_0x465f07);}};}function respondWithFilteredResult(_0x3bc87c,_0x5bfeb7){return function(_0x3cac98){if(_0x3cac98){var _0x4b7321=typeof _0x5bfeb7['offset']==='undefined'&&typeof _0x5bfeb7[_0x6521('0x1a')]==='undefined';var _0x3e1506=_0x3cac98[_0x6521('0x1b')];var _0x54d297=_0x4b7321?0x0:_0x5bfeb7[_0x6521('0x1c')];var _0x2c41e1=_0x4b7321?_0x3cac98[_0x6521('0x1b')]:_0x5bfeb7[_0x6521('0x1c')]+_0x5bfeb7[_0x6521('0x1a')];var _0x259e98;if(_0x2c41e1>=_0x3e1506){_0x2c41e1=_0x3e1506;_0x259e98=0xc8;}else{_0x259e98=0xce;}_0x3bc87c[_0x6521('0x17')](_0x259e98);return _0x3bc87c[_0x6521('0x1d')](_0x6521('0x1e'),_0x54d297+'-'+_0x2c41e1+'/'+_0x3e1506)[_0x6521('0x19')](_0x3cac98);}return null;};}function patchUpdates(_0x45e655){return function(_0x4f6e8f){try{jsonpatch[_0x6521('0x1f')](_0x4f6e8f,_0x45e655,!![]);}catch(_0x63df29){return BPromise['reject'](_0x63df29);}return _0x4f6e8f[_0x6521('0x20')]();};}function saveUpdates(_0x458609,_0x5ac8c9){return function(_0x41e181){if(_0x41e181){return _0x41e181[_0x6521('0x21')](_0x458609)[_0x6521('0x22')](function(_0x3bad82){return _0x3bad82;});}return null;};}function removeEntity(_0x42bbe0,_0x199aae){return function(_0x292a40){if(_0x292a40){return _0x292a40[_0x6521('0x23')]()['then'](function(){_0x42bbe0[_0x6521('0x17')](0xcc)[_0x6521('0x18')]();});}};}function handleEntityNotFound(_0x584bdf,_0x5e9b88){return function(_0x34c076){if(!_0x34c076){_0x584bdf[_0x6521('0x16')](0x194);}return _0x34c076;};}function handleError(_0x5cbea6,_0x30fd14){_0x30fd14=_0x30fd14||0x1f4;return function(_0x22ffb5){logger[_0x6521('0x24')](_0x22ffb5[_0x6521('0x25')]);if(_0x22ffb5['name']){delete _0x22ffb5[_0x6521('0x26')];}_0x5cbea6[_0x6521('0x17')](_0x30fd14)['send'](_0x22ffb5);};}exports[_0x6521('0x27')]=function(_0x2a6d88,_0x3f55a0){var _0x402322={},_0x1073e9={},_0x32b825={'count':0x0,'rows':[]};var _0x2fe415=_[_0x6521('0x28')](db[_0x6521('0x29')][_0x6521('0x2a')],function(_0x4046f6){return{'name':_0x4046f6[_0x6521('0x2b')],'type':_0x4046f6[_0x6521('0x2c')][_0x6521('0x2d')]};});_0x1073e9[_0x6521('0x2e')]=_[_0x6521('0x28')](_0x2fe415,_0x6521('0x26'));_0x1073e9[_0x6521('0x2f')]=_[_0x6521('0x30')](_0x2a6d88[_0x6521('0x2f')]);_0x1073e9[_0x6521('0x31')]=_[_0x6521('0x32')](_0x1073e9['model'],_0x1073e9[_0x6521('0x2f')]);_0x402322['attributes']=_[_0x6521('0x32')](_0x1073e9['model'],qs[_0x6521('0x33')](_0x2a6d88[_0x6521('0x2f')]['fields']));_0x402322['attributes']=_0x402322[_0x6521('0x34')][_0x6521('0x35')]?_0x402322[_0x6521('0x34')]:_0x1073e9[_0x6521('0x2e')];if(!_0x2a6d88[_0x6521('0x2f')][_0x6521('0x36')](_0x6521('0x37'))){_0x402322['limit']=qs[_0x6521('0x1a')](_0x2a6d88['query'][_0x6521('0x1a')]);_0x402322[_0x6521('0x1c')]=qs['offset'](_0x2a6d88[_0x6521('0x2f')][_0x6521('0x1c')]);}_0x402322['order']=qs[_0x6521('0x38')](_0x2a6d88[_0x6521('0x2f')][_0x6521('0x38')]);_0x402322['where']=qs[_0x6521('0x31')](_[_0x6521('0x39')](_0x2a6d88[_0x6521('0x2f')],_0x1073e9['filters']),_0x2fe415);if(_0x2a6d88[_0x6521('0x2f')][_0x6521('0x3a')]){_0x402322[_0x6521('0x3b')]=_[_0x6521('0x3c')](_0x402322[_0x6521('0x3b')],{'$or':_[_0x6521('0x28')](_0x2fe415,function(_0x5d3736){if(_0x5d3736[_0x6521('0x2c')]!==_0x6521('0x3d')){var _0x355e40={};_0x355e40[_0x5d3736[_0x6521('0x26')]]={'$like':'%'+_0x2a6d88[_0x6521('0x2f')][_0x6521('0x3a')]+'%'};return _0x355e40;}})});}_0x402322=_[_0x6521('0x3c')]({},_0x402322,_0x2a6d88['options']);var _0x3edd9b={'where':_0x402322[_0x6521('0x3b')]};return db['VtigerConfiguration'][_0x6521('0x1b')](_0x3edd9b)[_0x6521('0x22')](function(_0x517fc2){_0x32b825[_0x6521('0x1b')]=_0x517fc2;if(_0x2a6d88['query'][_0x6521('0x3e')]){_0x402322[_0x6521('0x3f')]=[{'all':!![]}];}return db[_0x6521('0x29')][_0x6521('0x40')](_0x402322);})['then'](function(_0x4b2828){_0x32b825['rows']=_0x4b2828;return _0x32b825;})['then'](respondWithFilteredResult(_0x3f55a0,_0x402322))['catch'](handleError(_0x3f55a0,null));};exports[_0x6521('0x41')]=function(_0x14f400,_0x1438df){var _0x483b57={'raw':![],'where':{'id':_0x14f400[_0x6521('0x42')]['id']}},_0x543d08={};_0x543d08[_0x6521('0x2e')]=_[_0x6521('0x30')](db['VtigerConfiguration'][_0x6521('0x2a')]);_0x543d08['query']=_['keys'](_0x14f400[_0x6521('0x2f')]);_0x543d08[_0x6521('0x31')]=_['intersection'](_0x543d08[_0x6521('0x2e')],_0x543d08[_0x6521('0x2f')]);_0x483b57[_0x6521('0x34')]=_[_0x6521('0x32')](_0x543d08[_0x6521('0x2e')],qs['fields'](_0x14f400[_0x6521('0x2f')][_0x6521('0x33')]));_0x483b57[_0x6521('0x34')]=_0x483b57['attributes']['length']?_0x483b57[_0x6521('0x34')]:_0x543d08[_0x6521('0x2e')];if(_0x14f400['query'][_0x6521('0x3e')]){_0x483b57[_0x6521('0x3f')]=[{'all':!![]}];}_0x483b57=_[_0x6521('0x3c')]({},_0x483b57,_0x14f400['options']);return db[_0x6521('0x29')][_0x6521('0x43')](_0x483b57)[_0x6521('0x22')](handleEntityNotFound(_0x1438df,null))['then'](respondWithResult(_0x1438df,null))[_0x6521('0x44')](handleError(_0x1438df,null));};exports[_0x6521('0x45')]=function(_0x1da735,_0x998a8f){return db[_0x6521('0x29')][_0x6521('0x45')](_0x1da735[_0x6521('0x46')],{})[_0x6521('0x22')](respondWithResult(_0x998a8f,0xc9))[_0x6521('0x44')](handleError(_0x998a8f,null));};exports['update']=function(_0x4a3193,_0x5039f){if(_0x4a3193[_0x6521('0x46')]['id']){delete _0x4a3193[_0x6521('0x46')]['id'];}return db[_0x6521('0x29')]['find']({'where':{'id':_0x4a3193[_0x6521('0x42')]['id']}})[_0x6521('0x22')](handleEntityNotFound(_0x5039f,null))[_0x6521('0x22')](saveUpdates(_0x4a3193[_0x6521('0x46')],null))[_0x6521('0x22')](respondWithResult(_0x5039f,null))[_0x6521('0x44')](handleError(_0x5039f,null));};exports['destroy']=function(_0x6d1a99,_0x37e015){return db[_0x6521('0x29')]['find']({'where':{'id':_0x6d1a99['params']['id']}})[_0x6521('0x22')](handleEntityNotFound(_0x37e015,null))[_0x6521('0x22')](removeEntity(_0x37e015,null))['catch'](handleError(_0x37e015,null));};exports[_0x6521('0x47')]=function(_0x1f0724,_0x5d6882,_0x3a32a2){var _0x1040d1={};var _0x43a51c={};var _0xfcc175;var _0x1dc0c4;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1f0724[_0x6521('0x42')]['id']}})[_0x6521('0x22')](handleEntityNotFound(_0x5d6882,null))[_0x6521('0x22')](function(_0x4cfc7f){if(_0x4cfc7f){_0xfcc175=_0x4cfc7f;_0x43a51c[_0x6521('0x2e')]=_[_0x6521('0x30')](db[_0x6521('0x48')][_0x6521('0x2a')]);_0x43a51c[_0x6521('0x2f')]=_['keys'](_0x1f0724[_0x6521('0x2f')]);_0x43a51c[_0x6521('0x31')]=_[_0x6521('0x32')](_0x43a51c[_0x6521('0x2e')],_0x43a51c['query']);_0x1040d1[_0x6521('0x34')]=_[_0x6521('0x32')](_0x43a51c[_0x6521('0x2e')],qs[_0x6521('0x33')](_0x1f0724['query'][_0x6521('0x33')]));_0x1040d1['attributes']=_0x1040d1[_0x6521('0x34')][_0x6521('0x35')]?_0x1040d1['attributes']:_0x43a51c[_0x6521('0x2e')];_0x1040d1[_0x6521('0x49')]=qs[_0x6521('0x38')](_0x1f0724[_0x6521('0x2f')][_0x6521('0x38')]);_0x1040d1[_0x6521('0x3b')]=qs[_0x6521('0x31')](_[_0x6521('0x39')](_0x1f0724[_0x6521('0x2f')],_0x43a51c['filters']));if(_0x1f0724[_0x6521('0x2f')][_0x6521('0x3a')]){_0x1040d1[_0x6521('0x3b')]=_['merge'](_0x1040d1[_0x6521('0x3b')],{'$or':_[_0x6521('0x28')](_0x1040d1[_0x6521('0x34')],function(_0x548603){var _0x12030e={};_0x12030e[_0x548603]={'$like':'%'+_0x1f0724['query'][_0x6521('0x3a')]+'%'};return _0x12030e;})});}_0x1040d1=_[_0x6521('0x3c')]({},_0x1040d1,_0x1f0724['options']);return _0xfcc175['getFields'](_0x1040d1);}})['then'](function(_0x4e6e60){if(_0x4e6e60){_0x1dc0c4=_0x4e6e60[_0x6521('0x35')];if(!_0x1f0724[_0x6521('0x2f')]['hasOwnProperty'](_0x6521('0x37'))){_0x1040d1[_0x6521('0x1a')]=qs['limit'](_0x1f0724[_0x6521('0x2f')][_0x6521('0x1a')]);_0x1040d1[_0x6521('0x1c')]=qs[_0x6521('0x1c')](_0x1f0724[_0x6521('0x2f')][_0x6521('0x1c')]);}return _0xfcc175[_0x6521('0x47')](_0x1040d1);}})['then'](function(_0x1778f1){if(_0x1778f1){return _0x1778f1?{'count':_0x1dc0c4,'rows':_0x1778f1}:null;}})['then'](respondWithResult(_0x5d6882,null))[_0x6521('0x44')](handleError(_0x5d6882,null));};exports['getSubjects']=function(_0x4e3a0f,_0x4714d7,_0x2f319b){var _0x2dd945={};var _0x357d47={};var _0x27bd33;var _0x304645;return db[_0x6521('0x29')][_0x6521('0x4a')]({'where':{'id':_0x4e3a0f[_0x6521('0x42')]['id']}})[_0x6521('0x22')](handleEntityNotFound(_0x4714d7,null))[_0x6521('0x22')](function(_0x3ceedc){if(_0x3ceedc){_0x27bd33=_0x3ceedc;_0x357d47[_0x6521('0x2e')]=_[_0x6521('0x30')](db['VtigerField']['rawAttributes']);_0x357d47[_0x6521('0x2f')]=_[_0x6521('0x30')](_0x4e3a0f[_0x6521('0x2f')]);_0x357d47[_0x6521('0x31')]=_['intersection'](_0x357d47[_0x6521('0x2e')],_0x357d47['query']);_0x2dd945['attributes']=_[_0x6521('0x32')](_0x357d47[_0x6521('0x2e')],qs[_0x6521('0x33')](_0x4e3a0f['query'][_0x6521('0x33')]));_0x2dd945[_0x6521('0x34')]=_0x2dd945[_0x6521('0x34')][_0x6521('0x35')]?_0x2dd945[_0x6521('0x34')]:_0x357d47[_0x6521('0x2e')];_0x2dd945[_0x6521('0x49')]=qs[_0x6521('0x38')](_0x4e3a0f[_0x6521('0x2f')][_0x6521('0x38')]);_0x2dd945[_0x6521('0x3b')]=qs[_0x6521('0x31')](_[_0x6521('0x39')](_0x4e3a0f[_0x6521('0x2f')],_0x357d47[_0x6521('0x31')]));if(_0x4e3a0f['query'][_0x6521('0x3a')]){_0x2dd945[_0x6521('0x3b')]=_[_0x6521('0x3c')](_0x2dd945[_0x6521('0x3b')],{'$or':_[_0x6521('0x28')](_0x2dd945[_0x6521('0x34')],function(_0xc4ace1){var _0x1d7a30={};_0x1d7a30[_0xc4ace1]={'$like':'%'+_0x4e3a0f['query'][_0x6521('0x3a')]+'%'};return _0x1d7a30;})});}_0x2dd945=_['merge']({},_0x2dd945,_0x4e3a0f[_0x6521('0x4b')]);return _0x27bd33[_0x6521('0x4c')](_0x2dd945);}})[_0x6521('0x22')](function(_0x2c5a3e){if(_0x2c5a3e){_0x304645=_0x2c5a3e[_0x6521('0x35')];if(!_0x4e3a0f[_0x6521('0x2f')][_0x6521('0x36')](_0x6521('0x37'))){_0x2dd945['limit']=qs['limit'](_0x4e3a0f[_0x6521('0x2f')][_0x6521('0x1a')]);_0x2dd945[_0x6521('0x1c')]=qs['offset'](_0x4e3a0f[_0x6521('0x2f')][_0x6521('0x1c')]);}return _0x27bd33['getSubjects'](_0x2dd945);}})[_0x6521('0x22')](function(_0x308f1a){if(_0x308f1a){return _0x308f1a?{'count':_0x304645,'rows':_0x308f1a}:null;}})[_0x6521('0x22')](respondWithResult(_0x4714d7,null))['catch'](handleError(_0x4714d7,null));};exports[_0x6521('0x4d')]=function(_0x58c636,_0x4046d1,_0x9c3bf8){var _0x2de41c={};var _0x20612a={};var _0x3ed23d;var _0x5ac984;return db[_0x6521('0x29')]['findOne']({'where':{'id':_0x58c636[_0x6521('0x42')]['id']}})[_0x6521('0x22')](handleEntityNotFound(_0x4046d1,null))[_0x6521('0x22')](function(_0xe3fcad){if(_0xe3fcad){_0x3ed23d=_0xe3fcad;_0x20612a[_0x6521('0x2e')]=_[_0x6521('0x30')](db[_0x6521('0x48')][_0x6521('0x2a')]);_0x20612a[_0x6521('0x2f')]=_[_0x6521('0x30')](_0x58c636[_0x6521('0x2f')]);_0x20612a[_0x6521('0x31')]=_[_0x6521('0x32')](_0x20612a[_0x6521('0x2e')],_0x20612a[_0x6521('0x2f')]);_0x2de41c[_0x6521('0x34')]=_[_0x6521('0x32')](_0x20612a[_0x6521('0x2e')],qs[_0x6521('0x33')](_0x58c636[_0x6521('0x2f')][_0x6521('0x33')]));_0x2de41c[_0x6521('0x34')]=_0x2de41c[_0x6521('0x34')][_0x6521('0x35')]?_0x2de41c[_0x6521('0x34')]:_0x20612a[_0x6521('0x2e')];_0x2de41c[_0x6521('0x49')]=qs['sort'](_0x58c636['query']['sort']);_0x2de41c[_0x6521('0x3b')]=qs['filters'](_[_0x6521('0x39')](_0x58c636[_0x6521('0x2f')],_0x20612a[_0x6521('0x31')]));if(_0x58c636[_0x6521('0x2f')]['filter']){_0x2de41c[_0x6521('0x3b')]=_['merge'](_0x2de41c[_0x6521('0x3b')],{'$or':_[_0x6521('0x28')](_0x2de41c[_0x6521('0x34')],function(_0x3697bc){var _0x306499={};_0x306499[_0x3697bc]={'$like':'%'+_0x58c636[_0x6521('0x2f')][_0x6521('0x3a')]+'%'};return _0x306499;})});}_0x2de41c=_[_0x6521('0x3c')]({},_0x2de41c,_0x58c636[_0x6521('0x4b')]);return _0x3ed23d['getDescriptions'](_0x2de41c);}})['then'](function(_0x27332d){if(_0x27332d){_0x5ac984=_0x27332d['length'];if(!_0x58c636[_0x6521('0x2f')][_0x6521('0x36')](_0x6521('0x37'))){_0x2de41c[_0x6521('0x1a')]=qs['limit'](_0x58c636[_0x6521('0x2f')]['limit']);_0x2de41c['offset']=qs[_0x6521('0x1c')](_0x58c636[_0x6521('0x2f')][_0x6521('0x1c')]);}return _0x3ed23d[_0x6521('0x4d')](_0x2de41c);}})['then'](function(_0xd6f90b){if(_0xd6f90b){return _0xd6f90b?{'count':_0x5ac984,'rows':_0xd6f90b}:null;}})['then'](respondWithResult(_0x4046d1,null))[_0x6521('0x44')](handleError(_0x4046d1,null));}; \ No newline at end of file +var _0x12aa=['filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','then','error','stack','name','send','index','map','VtigerConfiguration','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0x2183fe,_0x541df0){var _0x5c9708=function(_0x5f3369){while(--_0x5f3369){_0x2183fe['push'](_0x2183fe['shift']());}};_0x5c9708(++_0x541df0);}(_0x12aa,0x1a0));var _0xa12a=function(_0x4a5a50,_0x542767){_0x4a5a50=_0x4a5a50-0x0;var _0x547e5d=_0x12aa[_0x4a5a50];return _0x547e5d;};'use strict';var emlformat=require(_0xa12a('0x0'));var rimraf=require(_0xa12a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa12a('0x2'));var rp=require(_0xa12a('0x3'));var moment=require(_0xa12a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa12a('0x5'));var util=require(_0xa12a('0x6'));var path=require('path');var sox=require(_0xa12a('0x7'));var csv=require(_0xa12a('0x8'));var ejs=require(_0xa12a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa12a('0xa'));var squel=require(_0xa12a('0xb'));var crypto=require(_0xa12a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa12a('0xd'));var toCsv=require(_0xa12a('0x8'));var querystring=require(_0xa12a('0xe'));var Papa=require(_0xa12a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa12a('0x10'));var as=require(_0xa12a('0x11'));var hardwareService=require(_0xa12a('0x12'));var logger=require(_0xa12a('0x13'))(_0xa12a('0x14'));var utils=require('../../config/utils');var config=require(_0xa12a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa12a('0x16'))['db'];function respondWithStatusCode(_0x23a197,_0x386399){_0x386399=_0x386399||0xcc;return function(_0x4ea49f){if(_0x4ea49f){return _0x23a197[_0xa12a('0x17')](_0x386399);}return _0x23a197[_0xa12a('0x18')](_0x386399)[_0xa12a('0x19')]();};}function respondWithResult(_0x183696,_0x47f28c){_0x47f28c=_0x47f28c||0xc8;return function(_0x2204e7){if(_0x2204e7){return _0x183696[_0xa12a('0x18')](_0x47f28c)['json'](_0x2204e7);}};}function respondWithFilteredResult(_0x39242e,_0x1de578){return function(_0x3730b3){if(_0x3730b3){var _0x348a77=typeof _0x1de578['offset']===_0xa12a('0x1a')&&typeof _0x1de578[_0xa12a('0x1b')]==='undefined';var _0x2527a2=_0x3730b3[_0xa12a('0x1c')];var _0x31e7e8=_0x348a77?0x0:_0x1de578[_0xa12a('0x1d')];var _0x573435=_0x348a77?_0x3730b3[_0xa12a('0x1c')]:_0x1de578[_0xa12a('0x1d')]+_0x1de578[_0xa12a('0x1b')];var _0x383f1a;if(_0x573435>=_0x2527a2){_0x573435=_0x2527a2;_0x383f1a=0xc8;}else{_0x383f1a=0xce;}_0x39242e['status'](_0x383f1a);return _0x39242e[_0xa12a('0x1e')](_0xa12a('0x1f'),_0x31e7e8+'-'+_0x573435+'/'+_0x2527a2)[_0xa12a('0x20')](_0x3730b3);}return null;};}function patchUpdates(_0x61e903){return function(_0x20bb8b){try{jsonpatch['apply'](_0x20bb8b,_0x61e903,!![]);}catch(_0xc8a229){return BPromise['reject'](_0xc8a229);}return _0x20bb8b[_0xa12a('0x21')]();};}function saveUpdates(_0x57fd9c,_0x1531cf){return function(_0x38e59e){if(_0x38e59e){return _0x38e59e[_0xa12a('0x22')](_0x57fd9c)[_0xa12a('0x23')](function(_0x5587e7){return _0x5587e7;});}return null;};}function removeEntity(_0x3503c6,_0x4eab45){return function(_0x310e30){if(_0x310e30){return _0x310e30['destroy']()[_0xa12a('0x23')](function(){_0x3503c6['status'](0xcc)[_0xa12a('0x19')]();});}};}function handleEntityNotFound(_0x1d2410,_0x2ea49b){return function(_0x4812c){if(!_0x4812c){_0x1d2410[_0xa12a('0x17')](0x194);}return _0x4812c;};}function handleError(_0x2480f8,_0x1cebcb){_0x1cebcb=_0x1cebcb||0x1f4;return function(_0x1a6923){logger[_0xa12a('0x24')](_0x1a6923[_0xa12a('0x25')]);if(_0x1a6923[_0xa12a('0x26')]){delete _0x1a6923[_0xa12a('0x26')];}_0x2480f8[_0xa12a('0x18')](_0x1cebcb)[_0xa12a('0x27')](_0x1a6923);};}exports[_0xa12a('0x28')]=function(_0x190fa8,_0x124d04){var _0x1713d8={},_0x5d9367={},_0x2d33ec={'count':0x0,'rows':[]};var _0x12f439=_[_0xa12a('0x29')](db[_0xa12a('0x2a')]['rawAttributes'],function(_0x432f02){return{'name':_0x432f02['fieldName'],'type':_0x432f02[_0xa12a('0x2b')]['key']};});_0x5d9367[_0xa12a('0x2c')]=_[_0xa12a('0x29')](_0x12f439,_0xa12a('0x26'));_0x5d9367[_0xa12a('0x2d')]=_[_0xa12a('0x2e')](_0x190fa8[_0xa12a('0x2d')]);_0x5d9367[_0xa12a('0x2f')]=_['intersection'](_0x5d9367['model'],_0x5d9367[_0xa12a('0x2d')]);_0x1713d8[_0xa12a('0x30')]=_[_0xa12a('0x31')](_0x5d9367[_0xa12a('0x2c')],qs[_0xa12a('0x32')](_0x190fa8[_0xa12a('0x2d')][_0xa12a('0x32')]));_0x1713d8[_0xa12a('0x30')]=_0x1713d8[_0xa12a('0x30')][_0xa12a('0x33')]?_0x1713d8[_0xa12a('0x30')]:_0x5d9367['model'];if(!_0x190fa8[_0xa12a('0x2d')]['hasOwnProperty'](_0xa12a('0x34'))){_0x1713d8['limit']=qs[_0xa12a('0x1b')](_0x190fa8[_0xa12a('0x2d')][_0xa12a('0x1b')]);_0x1713d8['offset']=qs[_0xa12a('0x1d')](_0x190fa8[_0xa12a('0x2d')][_0xa12a('0x1d')]);}_0x1713d8[_0xa12a('0x35')]=qs[_0xa12a('0x36')](_0x190fa8['query'][_0xa12a('0x36')]);_0x1713d8[_0xa12a('0x37')]=qs['filters'](_[_0xa12a('0x38')](_0x190fa8[_0xa12a('0x2d')],_0x5d9367['filters']),_0x12f439);if(_0x190fa8[_0xa12a('0x2d')]['filter']){_0x1713d8[_0xa12a('0x37')]=_['merge'](_0x1713d8[_0xa12a('0x37')],{'$or':_[_0xa12a('0x29')](_0x12f439,function(_0x19006b){if(_0x19006b['type']!==_0xa12a('0x39')){var _0x1ca4a1={};_0x1ca4a1[_0x19006b[_0xa12a('0x26')]]={'$like':'%'+_0x190fa8[_0xa12a('0x2d')][_0xa12a('0x3a')]+'%'};return _0x1ca4a1;}})});}_0x1713d8=_[_0xa12a('0x3b')]({},_0x1713d8,_0x190fa8[_0xa12a('0x3c')]);var _0x150267={'where':_0x1713d8[_0xa12a('0x37')]};return db[_0xa12a('0x2a')]['count'](_0x150267)['then'](function(_0x2a0f77){_0x2d33ec[_0xa12a('0x1c')]=_0x2a0f77;if(_0x190fa8[_0xa12a('0x2d')][_0xa12a('0x3d')]){_0x1713d8[_0xa12a('0x3e')]=[{'all':!![]}];}return db[_0xa12a('0x2a')][_0xa12a('0x3f')](_0x1713d8);})['then'](function(_0x5194ae){_0x2d33ec[_0xa12a('0x40')]=_0x5194ae;return _0x2d33ec;})[_0xa12a('0x23')](respondWithFilteredResult(_0x124d04,_0x1713d8))[_0xa12a('0x41')](handleError(_0x124d04,null));};exports[_0xa12a('0x42')]=function(_0x42e139,_0x58091e){var _0x1106f9={'raw':![],'where':{'id':_0x42e139['params']['id']}},_0x35a36c={};_0x35a36c['model']=_[_0xa12a('0x2e')](db[_0xa12a('0x2a')][_0xa12a('0x43')]);_0x35a36c[_0xa12a('0x2d')]=_[_0xa12a('0x2e')](_0x42e139['query']);_0x35a36c[_0xa12a('0x2f')]=_['intersection'](_0x35a36c[_0xa12a('0x2c')],_0x35a36c[_0xa12a('0x2d')]);_0x1106f9[_0xa12a('0x30')]=_[_0xa12a('0x31')](_0x35a36c['model'],qs['fields'](_0x42e139['query'][_0xa12a('0x32')]));_0x1106f9['attributes']=_0x1106f9[_0xa12a('0x30')]['length']?_0x1106f9[_0xa12a('0x30')]:_0x35a36c['model'];if(_0x42e139['query'][_0xa12a('0x3d')]){_0x1106f9[_0xa12a('0x3e')]=[{'all':!![]}];}_0x1106f9=_[_0xa12a('0x3b')]({},_0x1106f9,_0x42e139[_0xa12a('0x3c')]);return db[_0xa12a('0x2a')]['find'](_0x1106f9)['then'](handleEntityNotFound(_0x58091e,null))['then'](respondWithResult(_0x58091e,null))['catch'](handleError(_0x58091e,null));};exports['create']=function(_0x385e34,_0x5dece0){return db[_0xa12a('0x2a')][_0xa12a('0x44')](_0x385e34[_0xa12a('0x45')],{})[_0xa12a('0x23')](respondWithResult(_0x5dece0,0xc9))[_0xa12a('0x41')](handleError(_0x5dece0,null));};exports[_0xa12a('0x22')]=function(_0x2599ec,_0x4d3a69){if(_0x2599ec[_0xa12a('0x45')]['id']){delete _0x2599ec[_0xa12a('0x45')]['id'];}return db[_0xa12a('0x2a')][_0xa12a('0x46')]({'where':{'id':_0x2599ec[_0xa12a('0x47')]['id']}})[_0xa12a('0x23')](handleEntityNotFound(_0x4d3a69,null))['then'](saveUpdates(_0x2599ec[_0xa12a('0x45')],null))['then'](respondWithResult(_0x4d3a69,null))[_0xa12a('0x41')](handleError(_0x4d3a69,null));};exports[_0xa12a('0x48')]=function(_0x1f56c9,_0x2b4f50){return db[_0xa12a('0x2a')][_0xa12a('0x46')]({'where':{'id':_0x1f56c9[_0xa12a('0x47')]['id']}})[_0xa12a('0x23')](handleEntityNotFound(_0x2b4f50,null))[_0xa12a('0x23')](removeEntity(_0x2b4f50,null))[_0xa12a('0x41')](handleError(_0x2b4f50,null));};exports[_0xa12a('0x49')]=function(_0x408dcf,_0x3a8d5a,_0x21ed03){var _0x5f2f09={};var _0x581848={};var _0x265797;var _0xbc05a6;return db[_0xa12a('0x2a')][_0xa12a('0x4a')]({'where':{'id':_0x408dcf[_0xa12a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a8d5a,null))[_0xa12a('0x23')](function(_0x496e15){if(_0x496e15){_0x265797=_0x496e15;_0x581848[_0xa12a('0x2c')]=_['keys'](db[_0xa12a('0x4b')][_0xa12a('0x43')]);_0x581848[_0xa12a('0x2d')]=_[_0xa12a('0x2e')](_0x408dcf['query']);_0x581848[_0xa12a('0x2f')]=_[_0xa12a('0x31')](_0x581848[_0xa12a('0x2c')],_0x581848[_0xa12a('0x2d')]);_0x5f2f09['attributes']=_['intersection'](_0x581848['model'],qs[_0xa12a('0x32')](_0x408dcf[_0xa12a('0x2d')]['fields']));_0x5f2f09[_0xa12a('0x30')]=_0x5f2f09[_0xa12a('0x30')][_0xa12a('0x33')]?_0x5f2f09['attributes']:_0x581848['model'];_0x5f2f09[_0xa12a('0x35')]=qs[_0xa12a('0x36')](_0x408dcf['query'][_0xa12a('0x36')]);_0x5f2f09['where']=qs['filters'](_[_0xa12a('0x38')](_0x408dcf['query'],_0x581848['filters']));if(_0x408dcf[_0xa12a('0x2d')][_0xa12a('0x3a')]){_0x5f2f09[_0xa12a('0x37')]=_[_0xa12a('0x3b')](_0x5f2f09[_0xa12a('0x37')],{'$or':_['map'](_0x5f2f09['attributes'],function(_0x2ddb7a){var _0x270091={};_0x270091[_0x2ddb7a]={'$like':'%'+_0x408dcf['query'][_0xa12a('0x3a')]+'%'};return _0x270091;})});}_0x5f2f09=_[_0xa12a('0x3b')]({},_0x5f2f09,_0x408dcf['options']);return _0x265797[_0xa12a('0x49')](_0x5f2f09);}})[_0xa12a('0x23')](function(_0x15f32b){if(_0x15f32b){_0xbc05a6=_0x15f32b['length'];if(!_0x408dcf[_0xa12a('0x2d')]['hasOwnProperty'](_0xa12a('0x34'))){_0x5f2f09[_0xa12a('0x1b')]=qs['limit'](_0x408dcf[_0xa12a('0x2d')]['limit']);_0x5f2f09['offset']=qs[_0xa12a('0x1d')](_0x408dcf['query'][_0xa12a('0x1d')]);}return _0x265797[_0xa12a('0x49')](_0x5f2f09);}})[_0xa12a('0x23')](function(_0x16467d){if(_0x16467d){return _0x16467d?{'count':_0xbc05a6,'rows':_0x16467d}:null;}})['then'](respondWithResult(_0x3a8d5a,null))[_0xa12a('0x41')](handleError(_0x3a8d5a,null));};exports[_0xa12a('0x4c')]=function(_0x386f83,_0x5aea99,_0x3f5d92){var _0x1419fb={};var _0x59d225={};var _0x4f181c;var _0x380a4e;return db[_0xa12a('0x2a')]['findOne']({'where':{'id':_0x386f83[_0xa12a('0x47')]['id']}})[_0xa12a('0x23')](handleEntityNotFound(_0x5aea99,null))[_0xa12a('0x23')](function(_0x317467){if(_0x317467){_0x4f181c=_0x317467;_0x59d225[_0xa12a('0x2c')]=_[_0xa12a('0x2e')](db[_0xa12a('0x4b')][_0xa12a('0x43')]);_0x59d225[_0xa12a('0x2d')]=_[_0xa12a('0x2e')](_0x386f83[_0xa12a('0x2d')]);_0x59d225['filters']=_[_0xa12a('0x31')](_0x59d225[_0xa12a('0x2c')],_0x59d225[_0xa12a('0x2d')]);_0x1419fb[_0xa12a('0x30')]=_['intersection'](_0x59d225[_0xa12a('0x2c')],qs[_0xa12a('0x32')](_0x386f83['query'][_0xa12a('0x32')]));_0x1419fb[_0xa12a('0x30')]=_0x1419fb[_0xa12a('0x30')][_0xa12a('0x33')]?_0x1419fb[_0xa12a('0x30')]:_0x59d225[_0xa12a('0x2c')];_0x1419fb[_0xa12a('0x35')]=qs[_0xa12a('0x36')](_0x386f83['query'][_0xa12a('0x36')]);_0x1419fb['where']=qs[_0xa12a('0x2f')](_['pick'](_0x386f83['query'],_0x59d225['filters']));if(_0x386f83[_0xa12a('0x2d')][_0xa12a('0x3a')]){_0x1419fb[_0xa12a('0x37')]=_[_0xa12a('0x3b')](_0x1419fb[_0xa12a('0x37')],{'$or':_[_0xa12a('0x29')](_0x1419fb[_0xa12a('0x30')],function(_0x5bf584){var _0x1f51ad={};_0x1f51ad[_0x5bf584]={'$like':'%'+_0x386f83[_0xa12a('0x2d')][_0xa12a('0x3a')]+'%'};return _0x1f51ad;})});}_0x1419fb=_[_0xa12a('0x3b')]({},_0x1419fb,_0x386f83[_0xa12a('0x3c')]);return _0x4f181c['getSubjects'](_0x1419fb);}})['then'](function(_0x216b3f){if(_0x216b3f){_0x380a4e=_0x216b3f[_0xa12a('0x33')];if(!_0x386f83[_0xa12a('0x2d')]['hasOwnProperty']('nolimit')){_0x1419fb['limit']=qs[_0xa12a('0x1b')](_0x386f83['query'][_0xa12a('0x1b')]);_0x1419fb[_0xa12a('0x1d')]=qs['offset'](_0x386f83[_0xa12a('0x2d')][_0xa12a('0x1d')]);}return _0x4f181c[_0xa12a('0x4c')](_0x1419fb);}})[_0xa12a('0x23')](function(_0x4dfd74){if(_0x4dfd74){return _0x4dfd74?{'count':_0x380a4e,'rows':_0x4dfd74}:null;}})[_0xa12a('0x23')](respondWithResult(_0x5aea99,null))[_0xa12a('0x41')](handleError(_0x5aea99,null));};exports[_0xa12a('0x4d')]=function(_0x36d22f,_0x5cdc2f,_0xb662ea){var _0x28ddf4={};var _0x1e05eb={};var _0xbd2dd7;var _0x2c9aeb;return db[_0xa12a('0x2a')]['findOne']({'where':{'id':_0x36d22f['params']['id']}})[_0xa12a('0x23')](handleEntityNotFound(_0x5cdc2f,null))[_0xa12a('0x23')](function(_0x2f19c2){if(_0x2f19c2){_0xbd2dd7=_0x2f19c2;_0x1e05eb['model']=_['keys'](db[_0xa12a('0x4b')][_0xa12a('0x43')]);_0x1e05eb['query']=_[_0xa12a('0x2e')](_0x36d22f[_0xa12a('0x2d')]);_0x1e05eb['filters']=_[_0xa12a('0x31')](_0x1e05eb['model'],_0x1e05eb[_0xa12a('0x2d')]);_0x28ddf4['attributes']=_[_0xa12a('0x31')](_0x1e05eb[_0xa12a('0x2c')],qs['fields'](_0x36d22f[_0xa12a('0x2d')][_0xa12a('0x32')]));_0x28ddf4[_0xa12a('0x30')]=_0x28ddf4[_0xa12a('0x30')][_0xa12a('0x33')]?_0x28ddf4[_0xa12a('0x30')]:_0x1e05eb['model'];_0x28ddf4[_0xa12a('0x35')]=qs['sort'](_0x36d22f['query']['sort']);_0x28ddf4[_0xa12a('0x37')]=qs[_0xa12a('0x2f')](_[_0xa12a('0x38')](_0x36d22f[_0xa12a('0x2d')],_0x1e05eb[_0xa12a('0x2f')]));if(_0x36d22f['query'][_0xa12a('0x3a')]){_0x28ddf4[_0xa12a('0x37')]=_[_0xa12a('0x3b')](_0x28ddf4[_0xa12a('0x37')],{'$or':_['map'](_0x28ddf4['attributes'],function(_0x59cc5f){var _0x2df111={};_0x2df111[_0x59cc5f]={'$like':'%'+_0x36d22f[_0xa12a('0x2d')][_0xa12a('0x3a')]+'%'};return _0x2df111;})});}_0x28ddf4=_[_0xa12a('0x3b')]({},_0x28ddf4,_0x36d22f[_0xa12a('0x3c')]);return _0xbd2dd7[_0xa12a('0x4d')](_0x28ddf4);}})[_0xa12a('0x23')](function(_0x5499e1){if(_0x5499e1){_0x2c9aeb=_0x5499e1['length'];if(!_0x36d22f[_0xa12a('0x2d')][_0xa12a('0x4e')]('nolimit')){_0x28ddf4[_0xa12a('0x1b')]=qs[_0xa12a('0x1b')](_0x36d22f['query'][_0xa12a('0x1b')]);_0x28ddf4['offset']=qs[_0xa12a('0x1d')](_0x36d22f[_0xa12a('0x2d')][_0xa12a('0x1d')]);}return _0xbd2dd7['getDescriptions'](_0x28ddf4);}})[_0xa12a('0x23')](function(_0x3f0c04){if(_0x3f0c04){return _0x3f0c04?{'count':_0x2c9aeb,'rows':_0x3f0c04}:null;}})[_0xa12a('0x23')](respondWithResult(_0x5cdc2f,null))[_0xa12a('0x41')](handleError(_0x5cdc2f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e4fc2db..63a6d79 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 _0x7add=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x1b1394,_0x1d8d87){var _0x4d378c=function(_0x4bde78){while(--_0x4bde78){_0x1b1394['push'](_0x1b1394['shift']());}};_0x4d378c(++_0x1d8d87);}(_0x7add,0xef));var _0xd7ad=function(_0x43ee20,_0x596c78){_0x43ee20=_0x43ee20-0x0;var _0x4cf943=_0x7add[_0x43ee20];return _0x4cf943;};'use strict';var _=require('lodash');var util=require(_0xd7ad('0x0'));var logger=require('../../config/logger')(_0xd7ad('0x1'));var moment=require(_0xd7ad('0x2'));var BPromise=require(_0xd7ad('0x3'));var rp=require(_0xd7ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7ad('0x5'));var config=require(_0xd7ad('0x6'));var attributes=require(_0xd7ad('0x7'));module[_0xd7ad('0x8')]=function(_0x2aaf7f,_0x36d565){return _0x2aaf7f[_0xd7ad('0x9')](_0xd7ad('0xa'),attributes,{'tableName':_0xd7ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80e4=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','moment'];(function(_0x325526,_0x275689){var _0x7e4a51=function(_0x42861e){while(--_0x42861e){_0x325526['push'](_0x325526['shift']());}};_0x7e4a51(++_0x275689);}(_0x80e4,0x1ad));var _0x480e=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x80e4[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0x480e('0x0'));var util=require('util');var logger=require(_0x480e('0x1'))('api');var moment=require(_0x480e('0x2'));var BPromise=require(_0x480e('0x3'));var rp=require(_0x480e('0x4'));var fs=require('fs');var path=require(_0x480e('0x5'));var rimraf=require(_0x480e('0x6'));var config=require(_0x480e('0x7'));var attributes=require(_0x480e('0x8'));module['exports']=function(_0x5a6c00,_0x516dad){return _0x5a6c00[_0x480e('0x9')](_0x480e('0xa'),attributes,{'tableName':_0x480e('0xb'),'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 6abf4a7..d8bb6d1 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 _0xd6e4=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x211311,_0x5e08e9){var _0x12d89b=function(_0x19390f){while(--_0x19390f){_0x211311['push'](_0x211311['shift']());}};_0x12d89b(++_0x5e08e9);}(_0xd6e4,0x117));var _0x4d6e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd6e4[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x4d6e('0x0'));var util=require(_0x4d6e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d6e('0x2'));var fs=require('fs');var Redis=require(_0x4d6e('0x3'));var db=require(_0x4d6e('0x4'))['db'];var utils=require(_0x4d6e('0x5'));var logger=require(_0x4d6e('0x6'))('rpc');var config=require(_0x4d6e('0x7'));var jayson=require(_0x4d6e('0x8'));var client=jayson[_0x4d6e('0x9')][_0x4d6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x251db6,_0x5d9a12,_0x39edfe){return new BPromise(function(_0x340bac,_0x5aa405){return client['request'](_0x251db6,_0x39edfe)[_0x4d6e('0xb')](function(_0x5d97da){logger[_0x4d6e('0xc')](_0x4d6e('0xd'),_0x5d9a12,_0x4d6e('0xe'));logger[_0x4d6e('0xf')](_0x4d6e('0x10'),_0x5d9a12,_0x4d6e('0xe'),JSON[_0x4d6e('0x11')](_0x5d97da));if(_0x5d97da[_0x4d6e('0x12')]){if(_0x5d97da[_0x4d6e('0x12')]['code']===0x1f4){logger['error'](_0x4d6e('0xd'),_0x5d9a12,_0x5d97da[_0x4d6e('0x12')]['message']);return _0x5aa405(_0x5d97da['error'][_0x4d6e('0x13')]);}logger[_0x4d6e('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x5d9a12,_0x5d97da[_0x4d6e('0x12')][_0x4d6e('0x13')]);return _0x340bac(_0x5d97da[_0x4d6e('0x12')][_0x4d6e('0x13')]);}else{logger['info'](_0x4d6e('0xd'),_0x5d9a12,_0x4d6e('0xe'));_0x340bac(_0x5d97da['result'][_0x4d6e('0x13')]);}})[_0x4d6e('0x14')](function(_0x262c52){logger['error'](_0x4d6e('0xd'),_0x5d9a12,_0x262c52);_0x5aa405(_0x262c52);});});} \ No newline at end of file +var _0xaf5d=['then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request'];(function(_0x36f80c,_0x443cdc){var _0x28b842=function(_0x56e478){while(--_0x56e478){_0x36f80c['push'](_0x36f80c['shift']());}};_0x28b842(++_0x443cdc);}(_0xaf5d,0xa9));var _0xdaf5=function(_0x5ef653,_0x12363f){_0x5ef653=_0x5ef653-0x0;var _0x78bcd9=_0xaf5d[_0x5ef653];return _0x78bcd9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdaf5('0x0'));var BPromise=require('bluebird');var rs=require(_0xdaf5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaf5('0x2'))['db'];var utils=require(_0xdaf5('0x3'));var logger=require(_0xdaf5('0x4'))(_0xdaf5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x197dcc,_0x2f07b9,_0x1db54b){return new BPromise(function(_0x28d615,_0x961504){return client[_0xdaf5('0x6')](_0x197dcc,_0x1db54b)[_0xdaf5('0x7')](function(_0x49690c){logger['info'](_0xdaf5('0x8'),_0x2f07b9,'request\x20sent');logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2f07b9,_0xdaf5('0x9'),JSON[_0xdaf5('0xa')](_0x49690c));if(_0x49690c['error']){if(_0x49690c[_0xdaf5('0xb')][_0xdaf5('0xc')]===0x1f4){logger['error'](_0xdaf5('0x8'),_0x2f07b9,_0x49690c[_0xdaf5('0xb')][_0xdaf5('0xd')]);return _0x961504(_0x49690c[_0xdaf5('0xb')][_0xdaf5('0xd')]);}logger[_0xdaf5('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f07b9,_0x49690c[_0xdaf5('0xb')][_0xdaf5('0xd')]);return _0x28d615(_0x49690c['error']['message']);}else{logger['info'](_0xdaf5('0x8'),_0x2f07b9,_0xdaf5('0x9'));_0x28d615(_0x49690c[_0xdaf5('0xe')]['message']);}})[_0xdaf5('0xf')](function(_0x3b74df){logger['error'](_0xdaf5('0x8'),_0x2f07b9,_0x3b74df);_0x961504(_0x3b74df);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index b18ff9f..bd1e681 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 _0xe798=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xe798,0xfb));var _0x8e79=function(_0x8458d3,_0x4073fe){_0x8458d3=_0x8458d3-0x0;var _0x2d8034=_0xe798[_0x8458d3];return _0x2d8034;};'use strict';var multer=require(_0x8e79('0x0'));var util=require(_0x8e79('0x1'));var path=require(_0x8e79('0x2'));var timeout=require(_0x8e79('0x3'));var express=require('express');var router=express[_0x8e79('0x4')]();var fs_extra=require(_0x8e79('0x5'));var auth=require(_0x8e79('0x6'));var interaction=require(_0x8e79('0x7'));var config=require('../../config/environment');var controller=require(_0x8e79('0x8'));router[_0x8e79('0x9')]('/',auth[_0x8e79('0xa')](),controller['index']);router[_0x8e79('0x9')](_0x8e79('0xb'),auth[_0x8e79('0xa')](),controller[_0x8e79('0xc')]);router[_0x8e79('0xd')]('/',auth[_0x8e79('0xa')](),controller[_0x8e79('0xe')]);router[_0x8e79('0xf')]('/:id',auth[_0x8e79('0xa')](),controller[_0x8e79('0x10')]);router[_0x8e79('0x11')](_0x8e79('0xb'),auth[_0x8e79('0xa')](),controller[_0x8e79('0x12')]);module[_0x8e79('0x13')]=router; \ No newline at end of file +var _0x99b9=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','get','/:id','show','post','isAuthenticated','create'];(function(_0x26b1b8,_0x35bfd4){var _0x401762=function(_0x49b4f4){while(--_0x49b4f4){_0x26b1b8['push'](_0x26b1b8['shift']());}};_0x401762(++_0x35bfd4);}(_0x99b9,0x114));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x999b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x999b('0x1'));var express=require(_0x999b('0x2'));var router=express[_0x999b('0x3')]();var fs_extra=require(_0x999b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x999b('0x5'));var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x999b('0x6')](_0x999b('0x7'),auth['isAuthenticated'](),controller[_0x999b('0x8')]);router[_0x999b('0x9')]('/',auth[_0x999b('0xa')](),controller[_0x999b('0xb')]);router['put'](_0x999b('0x7'),auth[_0x999b('0xa')](),controller[_0x999b('0xc')]);router[_0x999b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x999b('0xe')]);module[_0x999b('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 40be763..a32c027 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 _0xe5bc=['keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x20bd7a,_0x15aed9){var _0x22bad3=function(_0x4f0150){while(--_0x4f0150){_0x20bd7a['push'](_0x20bd7a['shift']());}};_0x22bad3(++_0x15aed9);}(_0xe5bc,0x124));var _0xce5b=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0xe5bc[_0x4226d6];return _0x19655b;};'use strict';var Sequelize=require(_0xce5b('0x0'));module[_0xce5b('0x1')]={'type':{'type':Sequelize[_0xce5b('0x2')](_0xce5b('0x3'),_0xce5b('0x4'),'customVariable',_0xce5b('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xce5b('0x6')]},'keyType':{'type':Sequelize[_0xce5b('0x2')](_0xce5b('0x3'),_0xce5b('0x4'),_0xce5b('0x7'))},'keyContent':{'type':Sequelize[_0xce5b('0x6')]},'idField':{'type':Sequelize[_0xce5b('0x6')]},'nameField':{'type':Sequelize[_0xce5b('0x6')]},'customField':{'type':Sequelize[_0xce5b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce5b('0x6')]}}; \ No newline at end of file +var _0xb197=['keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x89c40f,_0xd92eb2){var _0x17acbb=function(_0xd57d85){while(--_0xd57d85){_0x89c40f['push'](_0x89c40f['shift']());}};_0x17acbb(++_0xd92eb2);}(_0xb197,0x114));var _0x7b19=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xb197[_0xea35d1];return _0x1d7a7c;};'use strict';var Sequelize=require(_0x7b19('0x0'));module['exports']={'type':{'type':Sequelize[_0x7b19('0x1')](_0x7b19('0x2'),_0x7b19('0x3'),'customVariable',_0x7b19('0x4'),_0x7b19('0x5')),'defaultValue':_0x7b19('0x2')},'content':{'type':Sequelize[_0x7b19('0x6')]},'key':{'type':Sequelize[_0x7b19('0x6')]},'keyType':{'type':Sequelize[_0x7b19('0x1')](_0x7b19('0x2'),_0x7b19('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7b19('0x6')]},'idField':{'type':Sequelize[_0x7b19('0x6')]},'nameField':{'type':Sequelize[_0x7b19('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b19('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3ddb0ed..19fdc14 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 _0x1b3c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','VtigerField','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x66498b,_0xfa22bb){var _0x4d4dfd=function(_0x6c6453){while(--_0x6c6453){_0x66498b['push'](_0x66498b['shift']());}};_0x4d4dfd(++_0xfa22bb);}(_0x1b3c,0xc7));var _0xc1b3=function(_0x25d0c9,_0x56d564){_0x25d0c9=_0x25d0c9-0x0;var _0x3f2cea=_0x1b3c[_0x25d0c9];return _0x3f2cea;};'use strict';var emlformat=require(_0xc1b3('0x0'));var rimraf=require(_0xc1b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1b3('0x2'));var rp=require(_0xc1b3('0x3'));var moment=require(_0xc1b3('0x4'));var BPromise=require(_0xc1b3('0x5'));var Mustache=require(_0xc1b3('0x6'));var util=require(_0xc1b3('0x7'));var path=require(_0xc1b3('0x8'));var sox=require(_0xc1b3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1b3('0xa'));var _=require(_0xc1b3('0xb'));var squel=require(_0xc1b3('0xc'));var crypto=require(_0xc1b3('0xd'));var jsforce=require(_0xc1b3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc1b3('0xf'));var Papa=require(_0xc1b3('0x10'));var Redis=require(_0xc1b3('0x11'));var authService=require(_0xc1b3('0x12'));var qs=require(_0xc1b3('0x13'));var as=require(_0xc1b3('0x14'));var hardwareService=require(_0xc1b3('0x15'));var logger=require(_0xc1b3('0x16'))(_0xc1b3('0x17'));var utils=require('../../config/utils');var config=require(_0xc1b3('0x18'));var licenseUtil=require(_0xc1b3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a4c6,_0x2ed96b){_0x2ed96b=_0x2ed96b||0xcc;return function(_0x20df6c){if(_0x20df6c){return _0x41a4c6[_0xc1b3('0x1a')](_0x2ed96b);}return _0x41a4c6[_0xc1b3('0x1b')](_0x2ed96b)[_0xc1b3('0x1c')]();};}function respondWithResult(_0x255fd3,_0x148b7f){_0x148b7f=_0x148b7f||0xc8;return function(_0x22a395){if(_0x22a395){return _0x255fd3['status'](_0x148b7f)['json'](_0x22a395);}};}function respondWithFilteredResult(_0x192a75,_0x5aec5b){return function(_0x59606b){if(_0x59606b){var _0x273e6d=typeof _0x5aec5b[_0xc1b3('0x1d')]==='undefined'&&typeof _0x5aec5b['limit']==='undefined';var _0x1e37aa=_0x59606b[_0xc1b3('0x1e')];var _0x16462e=_0x273e6d?0x0:_0x5aec5b['offset'];var _0x4b6420=_0x273e6d?_0x59606b['count']:_0x5aec5b['offset']+_0x5aec5b[_0xc1b3('0x1f')];var _0x202df2;if(_0x4b6420>=_0x1e37aa){_0x4b6420=_0x1e37aa;_0x202df2=0xc8;}else{_0x202df2=0xce;}_0x192a75['status'](_0x202df2);return _0x192a75[_0xc1b3('0x20')](_0xc1b3('0x21'),_0x16462e+'-'+_0x4b6420+'/'+_0x1e37aa)[_0xc1b3('0x22')](_0x59606b);}return null;};}function patchUpdates(_0x4fea06){return function(_0x45913a){try{jsonpatch[_0xc1b3('0x23')](_0x45913a,_0x4fea06,!![]);}catch(_0x307c19){return BPromise['reject'](_0x307c19);}return _0x45913a[_0xc1b3('0x24')]();};}function saveUpdates(_0x35f22e,_0x49d8ae){return function(_0x44c403){if(_0x44c403){return _0x44c403['update'](_0x35f22e)[_0xc1b3('0x25')](function(_0x1ba8f5){return _0x1ba8f5;});}return null;};}function removeEntity(_0x1d5198,_0x128cbf){return function(_0x38f4f2){if(_0x38f4f2){return _0x38f4f2[_0xc1b3('0x26')]()[_0xc1b3('0x25')](function(){_0x1d5198[_0xc1b3('0x1b')](0xcc)[_0xc1b3('0x1c')]();});}};}function handleEntityNotFound(_0x44cd67,_0x1a66f4){return function(_0x35509e){if(!_0x35509e){_0x44cd67[_0xc1b3('0x1a')](0x194);}return _0x35509e;};}function handleError(_0x72e8a6,_0x55eb28){_0x55eb28=_0x55eb28||0x1f4;return function(_0x53dc88){logger['error'](_0x53dc88[_0xc1b3('0x27')]);if(_0x53dc88[_0xc1b3('0x28')]){delete _0x53dc88[_0xc1b3('0x28')];}_0x72e8a6[_0xc1b3('0x1b')](_0x55eb28)[_0xc1b3('0x29')](_0x53dc88);};}exports[_0xc1b3('0x2a')]=function(_0x485816,_0x19b033){var _0xc0c222={},_0x1a90a2={},_0x22fbea={'count':0x0,'rows':[]};var _0x31f319=_['map'](db[_0xc1b3('0x2b')]['rawAttributes'],function(_0x3a6b84){return{'name':_0x3a6b84[_0xc1b3('0x2c')],'type':_0x3a6b84[_0xc1b3('0x2d')][_0xc1b3('0x2e')]};});_0x1a90a2[_0xc1b3('0x2f')]=_[_0xc1b3('0x30')](_0x31f319,_0xc1b3('0x28'));_0x1a90a2[_0xc1b3('0x31')]=_['keys'](_0x485816[_0xc1b3('0x31')]);_0x1a90a2['filters']=_[_0xc1b3('0x32')](_0x1a90a2[_0xc1b3('0x2f')],_0x1a90a2[_0xc1b3('0x31')]);_0xc0c222[_0xc1b3('0x33')]=_[_0xc1b3('0x32')](_0x1a90a2[_0xc1b3('0x2f')],qs[_0xc1b3('0x34')](_0x485816[_0xc1b3('0x31')][_0xc1b3('0x34')]));_0xc0c222['attributes']=_0xc0c222['attributes']['length']?_0xc0c222[_0xc1b3('0x33')]:_0x1a90a2[_0xc1b3('0x2f')];if(!_0x485816['query'][_0xc1b3('0x35')](_0xc1b3('0x36'))){_0xc0c222[_0xc1b3('0x1f')]=qs[_0xc1b3('0x1f')](_0x485816[_0xc1b3('0x31')][_0xc1b3('0x1f')]);_0xc0c222[_0xc1b3('0x1d')]=qs[_0xc1b3('0x1d')](_0x485816[_0xc1b3('0x31')][_0xc1b3('0x1d')]);}_0xc0c222[_0xc1b3('0x37')]=qs['sort'](_0x485816['query']['sort']);_0xc0c222[_0xc1b3('0x38')]=qs[_0xc1b3('0x39')](_[_0xc1b3('0x3a')](_0x485816['query'],_0x1a90a2[_0xc1b3('0x39')]),_0x31f319);if(_0x485816['query'][_0xc1b3('0x3b')]){_0xc0c222[_0xc1b3('0x38')]=_[_0xc1b3('0x3c')](_0xc0c222[_0xc1b3('0x38')],{'$or':_['map'](_0x31f319,function(_0x44fa0a){if(_0x44fa0a['type']!==_0xc1b3('0x3d')){var _0x12467d={};_0x12467d[_0x44fa0a[_0xc1b3('0x28')]]={'$like':'%'+_0x485816['query'][_0xc1b3('0x3b')]+'%'};return _0x12467d;}})});}_0xc0c222=_[_0xc1b3('0x3c')]({},_0xc0c222,_0x485816['options']);var _0x23f3f6={'where':_0xc0c222['where']};return db['VtigerField'][_0xc1b3('0x1e')](_0x23f3f6)[_0xc1b3('0x25')](function(_0x2105ec){_0x22fbea[_0xc1b3('0x1e')]=_0x2105ec;if(_0x485816[_0xc1b3('0x31')][_0xc1b3('0x3e')]){_0xc0c222[_0xc1b3('0x3f')]=[{'all':!![]}];}return db[_0xc1b3('0x2b')][_0xc1b3('0x40')](_0xc0c222);})[_0xc1b3('0x25')](function(_0x2eec56){_0x22fbea['rows']=_0x2eec56;return _0x22fbea;})[_0xc1b3('0x25')](respondWithFilteredResult(_0x19b033,_0xc0c222))[_0xc1b3('0x41')](handleError(_0x19b033,null));};exports[_0xc1b3('0x42')]=function(_0x1576f1,_0x5e512e){var _0x1adbd1={'raw':!![],'where':{'id':_0x1576f1[_0xc1b3('0x43')]['id']}},_0xe5b2fd={};_0xe5b2fd[_0xc1b3('0x2f')]=_[_0xc1b3('0x44')](db[_0xc1b3('0x2b')]['rawAttributes']);_0xe5b2fd[_0xc1b3('0x31')]=_[_0xc1b3('0x44')](_0x1576f1[_0xc1b3('0x31')]);_0xe5b2fd[_0xc1b3('0x39')]=_['intersection'](_0xe5b2fd[_0xc1b3('0x2f')],_0xe5b2fd['query']);_0x1adbd1['attributes']=_[_0xc1b3('0x32')](_0xe5b2fd[_0xc1b3('0x2f')],qs[_0xc1b3('0x34')](_0x1576f1['query'][_0xc1b3('0x34')]));_0x1adbd1[_0xc1b3('0x33')]=_0x1adbd1[_0xc1b3('0x33')][_0xc1b3('0x45')]?_0x1adbd1[_0xc1b3('0x33')]:_0xe5b2fd[_0xc1b3('0x2f')];if(_0x1576f1['query']['includeAll']){_0x1adbd1[_0xc1b3('0x3f')]=[{'all':!![]}];}_0x1adbd1=_[_0xc1b3('0x3c')]({},_0x1adbd1,_0x1576f1['options']);return db['VtigerField'][_0xc1b3('0x46')](_0x1adbd1)[_0xc1b3('0x25')](handleEntityNotFound(_0x5e512e,null))['then'](respondWithResult(_0x5e512e,null))[_0xc1b3('0x41')](handleError(_0x5e512e,null));};exports[_0xc1b3('0x47')]=function(_0x19bc5e,_0x4c54ef){return db[_0xc1b3('0x2b')][_0xc1b3('0x47')](_0x19bc5e[_0xc1b3('0x48')],{})[_0xc1b3('0x25')](respondWithResult(_0x4c54ef,0xc9))['catch'](handleError(_0x4c54ef,null));};exports['update']=function(_0x20932e,_0x111f82){if(_0x20932e[_0xc1b3('0x48')]['id']){delete _0x20932e['body']['id'];}return db[_0xc1b3('0x2b')][_0xc1b3('0x46')]({'where':{'id':_0x20932e[_0xc1b3('0x43')]['id']}})['then'](handleEntityNotFound(_0x111f82,null))[_0xc1b3('0x25')](saveUpdates(_0x20932e[_0xc1b3('0x48')],null))[_0xc1b3('0x25')](respondWithResult(_0x111f82,null))['catch'](handleError(_0x111f82,null));};exports[_0xc1b3('0x26')]=function(_0x558ea2,_0x54ee22){return db[_0xc1b3('0x2b')]['find']({'where':{'id':_0x558ea2['params']['id']}})[_0xc1b3('0x25')](handleEntityNotFound(_0x54ee22,null))[_0xc1b3('0x25')](removeEntity(_0x54ee22,null))['catch'](handleError(_0x54ee22,null));}; \ No newline at end of file +var _0x94cc=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','reject','update','then','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','eml-format'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x94cc,0x167));var _0xc94c=function(_0x30d2c1,_0x119be7){_0x30d2c1=_0x30d2c1-0x0;var _0x1e376a=_0x94cc[_0x30d2c1];return _0x1e376a;};'use strict';var emlformat=require(_0xc94c('0x0'));var rimraf=require(_0xc94c('0x1'));var zipdir=require(_0xc94c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc94c('0x3'));var moment=require(_0xc94c('0x4'));var BPromise=require(_0xc94c('0x5'));var Mustache=require(_0xc94c('0x6'));var util=require(_0xc94c('0x7'));var path=require(_0xc94c('0x8'));var sox=require(_0xc94c('0x9'));var csv=require(_0xc94c('0xa'));var ejs=require(_0xc94c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc94c('0xc'));var jsforce=require(_0xc94c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc94c('0xa'));var querystring=require(_0xc94c('0xe'));var Papa=require(_0xc94c('0xf'));var Redis=require(_0xc94c('0x10'));var authService=require(_0xc94c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc94c('0x12'));var hardwareService=require(_0xc94c('0x13'));var logger=require(_0xc94c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc94c('0x15'));var licenseUtil=require(_0xc94c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42f0c2,_0x4b8bb9){_0x4b8bb9=_0x4b8bb9||0xcc;return function(_0x141c37){if(_0x141c37){return _0x42f0c2[_0xc94c('0x17')](_0x4b8bb9);}return _0x42f0c2[_0xc94c('0x18')](_0x4b8bb9)[_0xc94c('0x19')]();};}function respondWithResult(_0xc57f07,_0x470628){_0x470628=_0x470628||0xc8;return function(_0x303c9d){if(_0x303c9d){return _0xc57f07[_0xc94c('0x18')](_0x470628)[_0xc94c('0x1a')](_0x303c9d);}};}function respondWithFilteredResult(_0x305779,_0x40879a){return function(_0x2f8b40){if(_0x2f8b40){var _0x350495=typeof _0x40879a[_0xc94c('0x1b')]===_0xc94c('0x1c')&&typeof _0x40879a['limit']===_0xc94c('0x1c');var _0x4f04bd=_0x2f8b40['count'];var _0x57690a=_0x350495?0x0:_0x40879a[_0xc94c('0x1b')];var _0x4e6337=_0x350495?_0x2f8b40[_0xc94c('0x1d')]:_0x40879a[_0xc94c('0x1b')]+_0x40879a['limit'];var _0x114944;if(_0x4e6337>=_0x4f04bd){_0x4e6337=_0x4f04bd;_0x114944=0xc8;}else{_0x114944=0xce;}_0x305779[_0xc94c('0x18')](_0x114944);return _0x305779[_0xc94c('0x1e')]('Content-Range',_0x57690a+'-'+_0x4e6337+'/'+_0x4f04bd)[_0xc94c('0x1a')](_0x2f8b40);}return null;};}function patchUpdates(_0x8c7e){return function(_0x290c64){try{jsonpatch['apply'](_0x290c64,_0x8c7e,!![]);}catch(_0x57941f){return BPromise[_0xc94c('0x1f')](_0x57941f);}return _0x290c64['save']();};}function saveUpdates(_0x419370,_0x531fdb){return function(_0x57b785){if(_0x57b785){return _0x57b785[_0xc94c('0x20')](_0x419370)[_0xc94c('0x21')](function(_0x5df03e){return _0x5df03e;});}return null;};}function removeEntity(_0x367632,_0x525622){return function(_0x18f532){if(_0x18f532){return _0x18f532['destroy']()['then'](function(){_0x367632['status'](0xcc)[_0xc94c('0x19')]();});}};}function handleEntityNotFound(_0x1da61f,_0x48233d){return function(_0x1e2444){if(!_0x1e2444){_0x1da61f[_0xc94c('0x17')](0x194);}return _0x1e2444;};}function handleError(_0x851fa4,_0x21fbf2){_0x21fbf2=_0x21fbf2||0x1f4;return function(_0x34786c){logger[_0xc94c('0x22')](_0x34786c[_0xc94c('0x23')]);if(_0x34786c[_0xc94c('0x24')]){delete _0x34786c['name'];}_0x851fa4[_0xc94c('0x18')](_0x21fbf2)['send'](_0x34786c);};}exports[_0xc94c('0x25')]=function(_0x49ff07,_0x438293){var _0x131469={},_0x34872f={},_0x3d5057={'count':0x0,'rows':[]};var _0x44788a=_[_0xc94c('0x26')](db[_0xc94c('0x27')][_0xc94c('0x28')],function(_0xeb4fd3){return{'name':_0xeb4fd3[_0xc94c('0x29')],'type':_0xeb4fd3[_0xc94c('0x2a')][_0xc94c('0x2b')]};});_0x34872f[_0xc94c('0x2c')]=_['map'](_0x44788a,_0xc94c('0x24'));_0x34872f[_0xc94c('0x2d')]=_[_0xc94c('0x2e')](_0x49ff07[_0xc94c('0x2d')]);_0x34872f[_0xc94c('0x2f')]=_['intersection'](_0x34872f[_0xc94c('0x2c')],_0x34872f[_0xc94c('0x2d')]);_0x131469[_0xc94c('0x30')]=_[_0xc94c('0x31')](_0x34872f[_0xc94c('0x2c')],qs[_0xc94c('0x32')](_0x49ff07['query']['fields']));_0x131469['attributes']=_0x131469['attributes'][_0xc94c('0x33')]?_0x131469[_0xc94c('0x30')]:_0x34872f['model'];if(!_0x49ff07[_0xc94c('0x2d')][_0xc94c('0x34')]('nolimit')){_0x131469[_0xc94c('0x35')]=qs[_0xc94c('0x35')](_0x49ff07[_0xc94c('0x2d')]['limit']);_0x131469[_0xc94c('0x1b')]=qs['offset'](_0x49ff07[_0xc94c('0x2d')]['offset']);}_0x131469['order']=qs[_0xc94c('0x36')](_0x49ff07['query'][_0xc94c('0x36')]);_0x131469['where']=qs['filters'](_[_0xc94c('0x37')](_0x49ff07['query'],_0x34872f[_0xc94c('0x2f')]),_0x44788a);if(_0x49ff07['query']['filter']){_0x131469['where']=_[_0xc94c('0x38')](_0x131469[_0xc94c('0x39')],{'$or':_['map'](_0x44788a,function(_0x30473c){if(_0x30473c[_0xc94c('0x2a')]!==_0xc94c('0x3a')){var _0x40c3b4={};_0x40c3b4[_0x30473c[_0xc94c('0x24')]]={'$like':'%'+_0x49ff07[_0xc94c('0x2d')][_0xc94c('0x3b')]+'%'};return _0x40c3b4;}})});}_0x131469=_[_0xc94c('0x38')]({},_0x131469,_0x49ff07[_0xc94c('0x3c')]);var _0x6d33ed={'where':_0x131469[_0xc94c('0x39')]};return db['VtigerField'][_0xc94c('0x1d')](_0x6d33ed)[_0xc94c('0x21')](function(_0x427ca9){_0x3d5057[_0xc94c('0x1d')]=_0x427ca9;if(_0x49ff07[_0xc94c('0x2d')]['includeAll']){_0x131469[_0xc94c('0x3d')]=[{'all':!![]}];}return db[_0xc94c('0x27')][_0xc94c('0x3e')](_0x131469);})[_0xc94c('0x21')](function(_0x226d83){_0x3d5057[_0xc94c('0x3f')]=_0x226d83;return _0x3d5057;})[_0xc94c('0x21')](respondWithFilteredResult(_0x438293,_0x131469))[_0xc94c('0x40')](handleError(_0x438293,null));};exports[_0xc94c('0x41')]=function(_0x567db8,_0x245e13){var _0x3e068e={'raw':!![],'where':{'id':_0x567db8['params']['id']}},_0x20eb5f={};_0x20eb5f[_0xc94c('0x2c')]=_[_0xc94c('0x2e')](db[_0xc94c('0x27')]['rawAttributes']);_0x20eb5f[_0xc94c('0x2d')]=_[_0xc94c('0x2e')](_0x567db8[_0xc94c('0x2d')]);_0x20eb5f[_0xc94c('0x2f')]=_['intersection'](_0x20eb5f['model'],_0x20eb5f[_0xc94c('0x2d')]);_0x3e068e[_0xc94c('0x30')]=_[_0xc94c('0x31')](_0x20eb5f['model'],qs[_0xc94c('0x32')](_0x567db8[_0xc94c('0x2d')][_0xc94c('0x32')]));_0x3e068e[_0xc94c('0x30')]=_0x3e068e[_0xc94c('0x30')][_0xc94c('0x33')]?_0x3e068e[_0xc94c('0x30')]:_0x20eb5f[_0xc94c('0x2c')];if(_0x567db8[_0xc94c('0x2d')][_0xc94c('0x42')]){_0x3e068e['include']=[{'all':!![]}];}_0x3e068e=_[_0xc94c('0x38')]({},_0x3e068e,_0x567db8['options']);return db[_0xc94c('0x27')][_0xc94c('0x43')](_0x3e068e)[_0xc94c('0x21')](handleEntityNotFound(_0x245e13,null))[_0xc94c('0x21')](respondWithResult(_0x245e13,null))['catch'](handleError(_0x245e13,null));};exports['create']=function(_0x451681,_0x3bde06){return db[_0xc94c('0x27')][_0xc94c('0x44')](_0x451681[_0xc94c('0x45')],{})[_0xc94c('0x21')](respondWithResult(_0x3bde06,0xc9))[_0xc94c('0x40')](handleError(_0x3bde06,null));};exports['update']=function(_0x2de7d6,_0x1f9c9f){if(_0x2de7d6[_0xc94c('0x45')]['id']){delete _0x2de7d6['body']['id'];}return db[_0xc94c('0x27')][_0xc94c('0x43')]({'where':{'id':_0x2de7d6[_0xc94c('0x46')]['id']}})[_0xc94c('0x21')](handleEntityNotFound(_0x1f9c9f,null))[_0xc94c('0x21')](saveUpdates(_0x2de7d6[_0xc94c('0x45')],null))[_0xc94c('0x21')](respondWithResult(_0x1f9c9f,null))[_0xc94c('0x40')](handleError(_0x1f9c9f,null));};exports[_0xc94c('0x47')]=function(_0x3e75f7,_0xaf3b9b){return db[_0xc94c('0x27')][_0xc94c('0x43')]({'where':{'id':_0x3e75f7[_0xc94c('0x46')]['id']}})['then'](handleEntityNotFound(_0xaf3b9b,null))[_0xc94c('0x21')](removeEntity(_0xaf3b9b,null))[_0xc94c('0x40')](handleError(_0xaf3b9b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b02a79c..df43af0 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 _0x06cf=['exports','define','VtigerField','idField','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x19cce8,_0x23a814){var _0x575f93=function(_0x515f8b){while(--_0x515f8b){_0x19cce8['push'](_0x19cce8['shift']());}};_0x575f93(++_0x23a814);}(_0x06cf,0x154));var _0xf06c=function(_0x58298c,_0xef6394){_0x58298c=_0x58298c-0x0;var _0x218fed=_0x06cf[_0x58298c];return _0x218fed;};'use strict';var _=require(_0xf06c('0x0'));var util=require(_0xf06c('0x1'));var logger=require(_0xf06c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf06c('0x3'));var rp=require(_0xf06c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf06c('0x5'));var config=require(_0xf06c('0x6'));var attributes=require(_0xf06c('0x7'));module[_0xf06c('0x8')]=function(_0x4d1355,_0xe2942e){return _0x4d1355[_0xf06c('0x9')](_0xf06c('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xf06c('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe642=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','request-promise','./intVtigerField.attributes','define','VtigerField'];(function(_0x2ea6d7,_0xa73e9d){var _0x2a1349=function(_0x545919){while(--_0x545919){_0x2ea6d7['push'](_0x2ea6d7['shift']());}};_0x2a1349(++_0xa73e9d);}(_0xe642,0xd5));var _0x2e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2e64('0x0'));var logger=require(_0x2e64('0x1'))(_0x2e64('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2e64('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e64('0x4'));module['exports']=function(_0x3a5f62,_0x526d78){return _0x3a5f62[_0x2e64('0x5')](_0x2e64('0x6'),attributes,{'tableName':_0x2e64('0x7'),'paranoid':![],'indexes':[{'name':_0x2e64('0x8'),'fields':[_0x2e64('0x9'),_0x2e64('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 15091e0..b86b4d7 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 _0x0e42=['then','info','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x386bf2,_0x45ad12){var _0x2a0821=function(_0x27de2d){while(--_0x27de2d){_0x386bf2['push'](_0x386bf2['shift']());}};_0x2a0821(++_0x45ad12);}(_0x0e42,0xdc));var _0x20e4=function(_0x709cfb,_0xbc4c9b){_0x709cfb=_0x709cfb-0x0;var _0x3f98c3=_0x0e42[_0x709cfb];return _0x3f98c3;};'use strict';var _=require('lodash');var util=require(_0x20e4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x20e4('0x1'));var fs=require('fs');var Redis=require(_0x20e4('0x2'));var db=require(_0x20e4('0x3'))['db'];var utils=require(_0x20e4('0x4'));var logger=require(_0x20e4('0x5'))(_0x20e4('0x6'));var config=require(_0x20e4('0x7'));var jayson=require(_0x20e4('0x8'));var client=jayson['client'][_0x20e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x481bfa,_0x102c8c,_0x26a5f1){return new BPromise(function(_0x1d97f7,_0x4b0027){return client[_0x20e4('0xa')](_0x481bfa,_0x26a5f1)[_0x20e4('0xb')](function(_0x5cb137){logger[_0x20e4('0xc')](_0x20e4('0xd'),_0x102c8c,'request\x20sent');logger[_0x20e4('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x102c8c,_0x20e4('0xf'),JSON[_0x20e4('0x10')](_0x5cb137));if(_0x5cb137[_0x20e4('0x11')]){if(_0x5cb137['error'][_0x20e4('0x12')]===0x1f4){logger[_0x20e4('0x11')](_0x20e4('0xd'),_0x102c8c,_0x5cb137[_0x20e4('0x11')][_0x20e4('0x13')]);return _0x4b0027(_0x5cb137[_0x20e4('0x11')][_0x20e4('0x13')]);}logger['error'](_0x20e4('0xd'),_0x102c8c,_0x5cb137[_0x20e4('0x11')][_0x20e4('0x13')]);return _0x1d97f7(_0x5cb137[_0x20e4('0x11')][_0x20e4('0x13')]);}else{logger[_0x20e4('0xc')]('VtigerField,\x20%s,\x20%s',_0x102c8c,'request\x20sent');_0x1d97f7(_0x5cb137['result'][_0x20e4('0x13')]);}})[_0x20e4('0x14')](function(_0x4bcf4f){logger['error'](_0x20e4('0xd'),_0x102c8c,_0x4bcf4f);_0x4b0027(_0x4bcf4f);});});} \ No newline at end of file +var _0xe73e=['moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x4f00fd,_0x173b7c){var _0x1004a4=function(_0x114ed5){while(--_0x114ed5){_0x4f00fd['push'](_0x4f00fd['shift']());}};_0x1004a4(++_0x173b7c);}(_0xe73e,0x102));var _0xee73=function(_0x4c3dac,_0x275cac){_0x4c3dac=_0x4c3dac-0x0;var _0x214d5a=_0xe73e[_0x4c3dac];return _0x214d5a;};'use strict';var _=require(_0xee73('0x0'));var util=require(_0xee73('0x1'));var moment=require(_0xee73('0x2'));var BPromise=require(_0xee73('0x3'));var rs=require(_0xee73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee73('0x5'));var logger=require(_0xee73('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee73('0x7'));var client=jayson[_0xee73('0x8')][_0xee73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30d938,_0x4f3e9e,_0x24ba29){return new BPromise(function(_0x4075d2,_0x3300c1){return client[_0xee73('0xa')](_0x30d938,_0x24ba29)['then'](function(_0x4665e2){logger[_0xee73('0xb')](_0xee73('0xc'),_0x4f3e9e,_0xee73('0xd'));logger[_0xee73('0xe')](_0xee73('0xf'),_0x4f3e9e,'request\x20sent',JSON[_0xee73('0x10')](_0x4665e2));if(_0x4665e2[_0xee73('0x11')]){if(_0x4665e2[_0xee73('0x11')][_0xee73('0x12')]===0x1f4){logger[_0xee73('0x11')](_0xee73('0xc'),_0x4f3e9e,_0x4665e2[_0xee73('0x11')][_0xee73('0x13')]);return _0x3300c1(_0x4665e2[_0xee73('0x11')]['message']);}logger[_0xee73('0x11')](_0xee73('0xc'),_0x4f3e9e,_0x4665e2['error'][_0xee73('0x13')]);return _0x4075d2(_0x4665e2[_0xee73('0x11')][_0xee73('0x13')]);}else{logger[_0xee73('0xb')](_0xee73('0xc'),_0x4f3e9e,_0xee73('0xd'));_0x4075d2(_0x4665e2['result'][_0xee73('0x13')]);}})['catch'](function(_0x113a6f){logger[_0xee73('0x11')](_0xee73('0xc'),_0x4f3e9e,_0x113a6f);_0x3300c1(_0x113a6f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 15e93c2..d9a7d0a 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 _0xbcc2=['create','addConfiguration','put','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x14d57b,_0x77593a){var _0x2e7f7d=function(_0x514a70){while(--_0x514a70){_0x14d57b['push'](_0x14d57b['shift']());}};_0x2e7f7d(++_0x77593a);}(_0xbcc2,0x17f));var _0x2bcc=function(_0x534897,_0x51d8ef){_0x534897=_0x534897-0x0;var _0x37d0fb=_0xbcc2[_0x534897];return _0x37d0fb;};'use strict';var multer=require(_0x2bcc('0x0'));var util=require(_0x2bcc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2bcc('0x2')]();var fs_extra=require(_0x2bcc('0x3'));var auth=require(_0x2bcc('0x4'));var interaction=require(_0x2bcc('0x5'));var config=require(_0x2bcc('0x6'));var controller=require(_0x2bcc('0x7'));router[_0x2bcc('0x8')]('/',auth[_0x2bcc('0x9')](),controller['index']);router[_0x2bcc('0x8')](_0x2bcc('0xa'),auth[_0x2bcc('0x9')](),controller[_0x2bcc('0xb')]);router[_0x2bcc('0x8')](_0x2bcc('0xc'),auth[_0x2bcc('0x9')](),controller[_0x2bcc('0xd')]);router[_0x2bcc('0x8')](_0x2bcc('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x2bcc('0xf')]('/',auth[_0x2bcc('0x9')](),controller[_0x2bcc('0x10')]);router[_0x2bcc('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2bcc('0x11')]);router[_0x2bcc('0x12')](_0x2bcc('0xa'),auth[_0x2bcc('0x9')](),controller['update']);router[_0x2bcc('0x13')](_0x2bcc('0xa'),auth[_0x2bcc('0x9')](),controller[_0x2bcc('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdd0c=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x490772,_0x103e1b){var _0x2d828a=function(_0x468094){while(--_0x468094){_0x490772['push'](_0x490772['shift']());}};_0x2d828a(++_0x103e1b);}(_0xdd0c,0x1ad));var _0xcdd0=function(_0x4d5512,_0x589ac3){_0x4d5512=_0x4d5512-0x0;var _0x5c067b=_0xdd0c[_0x4d5512];return _0x5c067b;};'use strict';var multer=require(_0xcdd0('0x0'));var util=require(_0xcdd0('0x1'));var path=require(_0xcdd0('0x2'));var timeout=require(_0xcdd0('0x3'));var express=require('express');var router=express[_0xcdd0('0x4')]();var fs_extra=require(_0xcdd0('0x5'));var auth=require(_0xcdd0('0x6'));var interaction=require(_0xcdd0('0x7'));var config=require(_0xcdd0('0x8'));var controller=require('./intZendeskAccount.controller');router[_0xcdd0('0x9')]('/',auth[_0xcdd0('0xa')](),controller['index']);router[_0xcdd0('0x9')](_0xcdd0('0xb'),auth[_0xcdd0('0xa')](),controller[_0xcdd0('0xc')]);router[_0xcdd0('0x9')](_0xcdd0('0xd'),auth[_0xcdd0('0xa')](),controller[_0xcdd0('0xe')]);router[_0xcdd0('0x9')](_0xcdd0('0xf'),auth[_0xcdd0('0xa')](),controller[_0xcdd0('0x10')]);router[_0xcdd0('0x11')]('/',auth[_0xcdd0('0xa')](),controller[_0xcdd0('0x12')]);router[_0xcdd0('0x11')](_0xcdd0('0xd'),auth[_0xcdd0('0xa')](),controller[_0xcdd0('0x13')]);router['put'](_0xcdd0('0xb'),auth[_0xcdd0('0xa')](),controller['update']);router[_0xcdd0('0x14')](_0xcdd0('0xb'),auth[_0xcdd0('0xa')](),controller[_0xcdd0('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 2b789fd..0308c77 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 _0x80c3=['password','ENUM','integrationTab','sequelize','STRING','username'];(function(_0x1e4207,_0x2a0ac7){var _0x1668fb=function(_0x2c2740){while(--_0x2c2740){_0x1e4207['push'](_0x1e4207['shift']());}};_0x1668fb(++_0x2a0ac7);}(_0x80c3,0x18f));var _0x380c=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x80c3[_0x311909];return _0x8d3163;};'use strict';var Sequelize=require(_0x380c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x380c('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x380c('0x2')},'password':{'type':Sequelize[_0x380c('0x1')]},'token':{'type':Sequelize[_0x380c('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x380c('0x3'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x380c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x380c('0x4')](_0x380c('0x5'),'newTab'),'defaultValue':_0x380c('0x5')}}; \ No newline at end of file +var _0x5fab=['ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x125b6a,_0x1631b6){var _0x28e051=function(_0x3ac247){while(--_0x3ac247){_0x125b6a['push'](_0x125b6a['shift']());}};_0x28e051(++_0x1631b6);}(_0x5fab,0x177));var _0xb5fa=function(_0x3ebe6b,_0x50bbf7){_0x3ebe6b=_0x3ebe6b-0x0;var _0x334cfc=_0x5fab[_0x3ebe6b];return _0x334cfc;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'password':{'type':Sequelize[_0xb5fa('0x2')]},'token':{'type':Sequelize[_0xb5fa('0x2')]},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x4')},'authType':{'type':Sequelize[_0xb5fa('0x5')](_0xb5fa('0x6'),_0xb5fa('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x5')](_0xb5fa('0x8'),_0xb5fa('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4b03d95..d03bc9d 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 _0x3f8c=['%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','substring','lastIndexOf','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f8c,0x104));var _0xc3f8=function(_0x37c121,_0x35aaeb){_0x37c121=_0x37c121-0x0;var _0xdab86d=_0x3f8c[_0x37c121];return _0xdab86d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];var integrations=require(_0xc3f8('0x16'));function respondWithStatusCode(_0x155c80,_0x511763){_0x511763=_0x511763||0xcc;return function(_0x84f489){if(_0x84f489){return _0x155c80[_0xc3f8('0x17')](_0x511763);}return _0x155c80[_0xc3f8('0x18')](_0x511763)[_0xc3f8('0x19')]();};}function respondWithResult(_0x6155e9,_0x47754c){_0x47754c=_0x47754c||0xc8;return function(_0x29e2b6){if(_0x29e2b6){return _0x6155e9[_0xc3f8('0x18')](_0x47754c)[_0xc3f8('0x1a')](_0x29e2b6);}};}function respondWithFilteredResult(_0x2fd8e8,_0x3cb28a){return function(_0x2a9f64){if(_0x2a9f64){var _0x29d031=typeof _0x3cb28a['offset']===_0xc3f8('0x1b')&&typeof _0x3cb28a['limit']==='undefined';var _0x3df137=_0x2a9f64[_0xc3f8('0x1c')];var _0x35500f=_0x29d031?0x0:_0x3cb28a[_0xc3f8('0x1d')];var _0x47a185=_0x29d031?_0x2a9f64[_0xc3f8('0x1c')]:_0x3cb28a[_0xc3f8('0x1d')]+_0x3cb28a['limit'];var _0xe14074;if(_0x47a185>=_0x3df137){_0x47a185=_0x3df137;_0xe14074=0xc8;}else{_0xe14074=0xce;}_0x2fd8e8['status'](_0xe14074);return _0x2fd8e8[_0xc3f8('0x1e')](_0xc3f8('0x1f'),_0x35500f+'-'+_0x47a185+'/'+_0x3df137)[_0xc3f8('0x1a')](_0x2a9f64);}return null;};}function patchUpdates(_0x53ada5){return function(_0x543dca){try{jsonpatch[_0xc3f8('0x20')](_0x543dca,_0x53ada5,!![]);}catch(_0x2a7096){return BPromise[_0xc3f8('0x21')](_0x2a7096);}return _0x543dca[_0xc3f8('0x22')]();};}function saveUpdates(_0x6522e9,_0x251bf7){return function(_0x43b2b4){if(_0x43b2b4){return _0x43b2b4[_0xc3f8('0x23')](_0x6522e9)['then'](function(_0x571f92){return _0x571f92;});}return null;};}function removeEntity(_0x4b83f0,_0x2559a4){return function(_0x5e1d14){if(_0x5e1d14){return _0x5e1d14[_0xc3f8('0x24')]()[_0xc3f8('0x25')](function(){_0x4b83f0['status'](0xcc)[_0xc3f8('0x19')]();});}};}function handleEntityNotFound(_0x327b2d,_0x2d237e){return function(_0xb883b5){if(!_0xb883b5){_0x327b2d[_0xc3f8('0x17')](0x194);}return _0xb883b5;};}function handleError(_0x9d43b4,_0xf1d460){_0xf1d460=_0xf1d460||0x1f4;return function(_0x7f14ad){logger[_0xc3f8('0x26')](_0x7f14ad[_0xc3f8('0x27')]);if(_0x7f14ad[_0xc3f8('0x28')]){delete _0x7f14ad[_0xc3f8('0x28')];}_0x9d43b4[_0xc3f8('0x18')](_0xf1d460)[_0xc3f8('0x29')](_0x7f14ad);};}exports['index']=function(_0x58b303,_0x2909f8){var _0x218029={},_0x5bf6e2={},_0x151bba={'count':0x0,'rows':[]};var _0x4d39a0=_[_0xc3f8('0x2a')](db[_0xc3f8('0x2b')]['rawAttributes'],function(_0x48b32e){return{'name':_0x48b32e[_0xc3f8('0x2c')],'type':_0x48b32e[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x5bf6e2[_0xc3f8('0x2f')]=_[_0xc3f8('0x2a')](_0x4d39a0,_0xc3f8('0x28'));_0x5bf6e2[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x58b303[_0xc3f8('0x30')]);_0x5bf6e2[_0xc3f8('0x32')]=_['intersection'](_0x5bf6e2[_0xc3f8('0x2f')],_0x5bf6e2[_0xc3f8('0x30')]);_0x218029[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x5bf6e2[_0xc3f8('0x2f')],qs['fields'](_0x58b303['query'][_0xc3f8('0x35')]));_0x218029[_0xc3f8('0x33')]=_0x218029[_0xc3f8('0x33')][_0xc3f8('0x36')]?_0x218029[_0xc3f8('0x33')]:_0x5bf6e2['model'];if(!_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x218029['limit']=qs[_0xc3f8('0x39')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x218029['offset']=qs[_0xc3f8('0x1d')](_0x58b303[_0xc3f8('0x30')]['offset']);}_0x218029[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3b')]);_0x218029[_0xc3f8('0x3c')]=qs[_0xc3f8('0x32')](_['pick'](_0x58b303[_0xc3f8('0x30')],_0x5bf6e2[_0xc3f8('0x32')]),_0x4d39a0);if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3d')]){_0x218029[_0xc3f8('0x3c')]=_['merge'](_0x218029[_0xc3f8('0x3c')],{'$or':_[_0xc3f8('0x2a')](_0x4d39a0,function(_0xaa4c98){if(_0xaa4c98['type']!==_0xc3f8('0x3e')){var _0x83b7ab={};_0x83b7ab[_0xaa4c98[_0xc3f8('0x28')]]={'$like':'%'+_0x58b303[_0xc3f8('0x30')]['filter']+'%'};return _0x83b7ab;}})});}_0x218029=_[_0xc3f8('0x3f')]({},_0x218029,_0x58b303[_0xc3f8('0x40')]);var _0x2df096={'where':_0x218029[_0xc3f8('0x3c')]};return db['ZendeskAccount'][_0xc3f8('0x1c')](_0x2df096)['then'](function(_0x5d144b){_0x151bba[_0xc3f8('0x1c')]=_0x5d144b;if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x218029[_0xc3f8('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x218029);})[_0xc3f8('0x25')](function(_0x16805c){_0x151bba[_0xc3f8('0x43')]=_0x16805c;return _0x151bba;})[_0xc3f8('0x25')](respondWithFilteredResult(_0x2909f8,_0x218029))[_0xc3f8('0x44')](handleError(_0x2909f8,null));};exports[_0xc3f8('0x45')]=function(_0x3113b4,_0x45e6ea){var _0x13d8dc={'raw':![],'where':{'id':_0x3113b4[_0xc3f8('0x46')]['id']}},_0x34bccd={};_0x34bccd['model']=_[_0xc3f8('0x31')](db[_0xc3f8('0x2b')]['rawAttributes']);_0x34bccd[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x3113b4['query']);_0x34bccd[_0xc3f8('0x32')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],_0x34bccd[_0xc3f8('0x30')]);_0x13d8dc[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x13d8dc[_0xc3f8('0x33')]=_0x13d8dc['attributes'][_0xc3f8('0x36')]?_0x13d8dc[_0xc3f8('0x33')]:_0x34bccd['model'];if(_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x13d8dc[_0xc3f8('0x42')]=[{'all':!![]}];}_0x13d8dc=_[_0xc3f8('0x3f')]({},_0x13d8dc,_0x3113b4['options']);return db['ZendeskAccount'][_0xc3f8('0x47')](_0x13d8dc)[_0xc3f8('0x25')](handleEntityNotFound(_0x45e6ea,null))[_0xc3f8('0x25')](respondWithResult(_0x45e6ea,null))['catch'](handleError(_0x45e6ea,null));};exports[_0xc3f8('0x48')]=function(_0x3a665e,_0x418961){return db[_0xc3f8('0x2b')][_0xc3f8('0x48')](_0x3a665e['body'],{})[_0xc3f8('0x25')](respondWithResult(_0x418961,0xc9))[_0xc3f8('0x44')](handleError(_0x418961,null));};exports['update']=function(_0x1becae,_0x3fcb6a){if(_0x1becae[_0xc3f8('0x49')]['id']){delete _0x1becae[_0xc3f8('0x49')]['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x1becae[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fcb6a,null))[_0xc3f8('0x25')](saveUpdates(_0x1becae[_0xc3f8('0x49')],null))['then'](respondWithResult(_0x3fcb6a,null))[_0xc3f8('0x44')](handleError(_0x3fcb6a,null));};exports[_0xc3f8('0x24')]=function(_0x2448bf,_0x33e5c5){return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x2448bf[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x33e5c5,null))[_0xc3f8('0x25')](removeEntity(_0x33e5c5,null))[_0xc3f8('0x44')](handleError(_0x33e5c5,null));};exports[_0xc3f8('0x4a')]=function(_0x267c95,_0x3e6c1d,_0x3d752a){var _0x97a88e={};var _0x920f4b={};var _0x4fc02c;var _0x51249a;return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x267c95['params']['id']}})['then'](handleEntityNotFound(_0x3e6c1d,null))[_0xc3f8('0x25')](function(_0x4b4adb){if(_0x4b4adb){_0x4fc02c=_0x4b4adb;_0x920f4b[_0xc3f8('0x2f')]=_[_0xc3f8('0x31')](db[_0xc3f8('0x4c')]['rawAttributes']);_0x920f4b[_0xc3f8('0x30')]=_['keys'](_0x267c95['query']);_0x920f4b[_0xc3f8('0x32')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],_0x920f4b[_0xc3f8('0x30')]);_0x97a88e[_0xc3f8('0x33')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x97a88e[_0xc3f8('0x33')]=_0x97a88e['attributes']['length']?_0x97a88e[_0xc3f8('0x33')]:_0x920f4b[_0xc3f8('0x2f')];_0x97a88e[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x267c95[_0xc3f8('0x30')]['sort']);_0x97a88e[_0xc3f8('0x3c')]=qs['filters'](_[_0xc3f8('0x4d')](_0x267c95[_0xc3f8('0x30')],_0x920f4b[_0xc3f8('0x32')]));if(_0x267c95[_0xc3f8('0x30')]['filter']){_0x97a88e[_0xc3f8('0x3c')]=_['merge'](_0x97a88e['where'],{'$or':_['map'](_0x97a88e['attributes'],function(_0x12df02){var _0x143d50={};_0x143d50[_0x12df02]={'$like':'%'+_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x3d')]+'%'};return _0x143d50;})});}_0x97a88e=_[_0xc3f8('0x3f')]({},_0x97a88e,_0x267c95[_0xc3f8('0x40')]);return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x5250df){if(_0x5250df){_0x51249a=_0x5250df[_0xc3f8('0x36')];if(!_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x97a88e[_0xc3f8('0x39')]=qs['limit'](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x97a88e[_0xc3f8('0x1d')]=qs[_0xc3f8('0x1d')](_0x267c95[_0xc3f8('0x30')]['offset']);}return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x42b255){if(_0x42b255){return _0x42b255?{'count':_0x51249a,'rows':_0x42b255}:null;}})[_0xc3f8('0x25')](respondWithResult(_0x3e6c1d,null))[_0xc3f8('0x44')](handleError(_0x3e6c1d,null));};exports[_0xc3f8('0x4e')]=function(_0x56fd61,_0x2f199d,_0x4ca426){if(_0x56fd61[_0xc3f8('0x49')]['id']){delete _0x56fd61['body']['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x56fd61['params']['id']}})['then'](handleEntityNotFound(_0x2f199d,null))[_0xc3f8('0x25')](function(_0x2c7ab9){if(_0x2c7ab9){_0x56fd61['body'][_0xc3f8('0x4f')]=_0x2c7ab9['id'];_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x50')]=integrations[_0xc3f8('0x51')](_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x52')],_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x2d')]);_0x56fd61['body']['Descriptions']=integrations[_0xc3f8('0x53')](_0x56fd61['body']['channel'],_0x56fd61['body']['type']);return db['ZendeskConfiguration'][_0xc3f8('0x48')](_0x56fd61[_0xc3f8('0x49')],{'include':[{'model':db[_0xc3f8('0x54')],'as':_0xc3f8('0x50')},{'model':db['ZendeskField'],'as':_0xc3f8('0x55')}]});}return null;})[_0xc3f8('0x25')](respondWithResult(_0x2f199d,null))['catch'](handleError(_0x2f199d,null));};exports[_0xc3f8('0x56')]=function(_0x273faf,_0x104eec,_0x531de8){var _0xaedf89='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x273faf['params']['id']},'attributes':['id',_0xc3f8('0x57'),_0xc3f8('0x58'),'token',_0xc3f8('0x59'),_0xc3f8('0x5a')]})['then'](handleEntityNotFound(_0x104eec,null))[_0xc3f8('0x25')](function(_0x2f957a){if(_0x2f957a){_0xaedf89=_0x2f957a['remoteUri'];var _0x34edb9=_0xaedf89['slice'](-0x1);if(_0x34edb9==='/'){_0xaedf89=_0xaedf89[_0xc3f8('0x5b')](0x0,_0xaedf89[_0xc3f8('0x5c')](_0x34edb9));}var _0x4cc654={'method':'GET','uri':util[_0xc3f8('0x5d')](_0xc3f8('0x5e'),_0xaedf89,'ticket_fields'),'json':!![]};switch(_0x2f957a[_0xc3f8('0x59')]){case'password':_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x61'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x58')]))[_0xc3f8('0x62')](_0xc3f8('0x63')))};break;case _0xc3f8('0x64'):_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x65'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x64')]))['toString'](_0xc3f8('0x63')))};break;default:throw new db[(_0xc3f8('0x66'))][(_0xc3f8('0x67'))](_0xc3f8('0x68'));}return rp(_0x4cc654);}})[_0xc3f8('0x25')](function(_0x53c815){if(_0x53c815){var _0x2f69f7=[_0xc3f8('0x69'),_0xc3f8('0x6a'),'group','assignee'];_[_0xc3f8('0x6b')](_0x53c815[_0xc3f8('0x6c')],function(_0x1a9c33){return _0x2f69f7[_0xc3f8('0x6d')](_0x1a9c33['type']);});return{'count':_0x53c815[_0xc3f8('0x6c')][_0xc3f8('0x36')],'rows':_[_0xc3f8('0x2a')](_0x53c815['ticket_fields'],function(_0x2a29fa){return{'id':_0x2a29fa['id'],'name':_0x2a29fa[_0xc3f8('0x6e')]>0x7?_0x2a29fa['title']:_0x2a29fa['type'],'custom':_0x2a29fa[_0xc3f8('0x6e')]>0x7?!![]:![],'options':_0x2a29fa[_0xc3f8('0x6f')]?_0x2a29fa['system_field_options']:_0x2a29fa[_0xc3f8('0x70')]?_0x2a29fa[_0xc3f8('0x70')]:[]};})};}})['then'](respondWithResult(_0x104eec,null))[_0xc3f8('0x44')](function(_0x5f2d86){var _0x3d080a=_0x273faf['query'][_0xc3f8('0x71')]?0x1f4:_0x5f2d86[_0xc3f8('0x72')]||0x1f4;logger[_0xc3f8('0x26')](_0xc3f8('0x73'),_0xc3f8('0x56'),_0x3d080a,JSON[_0xc3f8('0x74')](_0x5f2d86));delete _0x5f2d86[_0xc3f8('0x28')];if(_0x3d080a===0x191){_0x3d080a=0x190;}_0x104eec[_0xc3f8('0x18')](_0x3d080a)[_0xc3f8('0x29')](_0x273faf['query']['test']?{'message':_0xc3f8('0x75'),'statusCode':_0x5f2d86['statusCode']}:_0x5f2d86);});}; \ No newline at end of file +var _0x4024=['token','authType','remoteUri','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','findAll','catch','params','keys','length','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','Subjects','channel','getDescriptions','ZendeskField','getFields','username','password'];(function(_0x27415d,_0x293739){var _0x110228=function(_0x177cda){while(--_0x177cda){_0x27415d['push'](_0x27415d['shift']());}};_0x110228(++_0x293739);}(_0x4024,0x89));var _0x4402=function(_0x9d1ab9,_0x123272){_0x9d1ab9=_0x9d1ab9-0x0;var _0x99dc7a=_0x4024[_0x9d1ab9];return _0x99dc7a;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];var integrations=require(_0x4402('0x13'));function respondWithStatusCode(_0x4c9032,_0x7e4475){_0x7e4475=_0x7e4475||0xcc;return function(_0x34d952){if(_0x34d952){return _0x4c9032[_0x4402('0x14')](_0x7e4475);}return _0x4c9032[_0x4402('0x15')](_0x7e4475)[_0x4402('0x16')]();};}function respondWithResult(_0x31710c,_0x18c7a8){_0x18c7a8=_0x18c7a8||0xc8;return function(_0x3c7dd2){if(_0x3c7dd2){return _0x31710c[_0x4402('0x15')](_0x18c7a8)[_0x4402('0x17')](_0x3c7dd2);}};}function respondWithFilteredResult(_0x375166,_0xc03f65){return function(_0x2a2ce8){if(_0x2a2ce8){var _0x19fe7b=typeof _0xc03f65[_0x4402('0x18')]===_0x4402('0x19')&&typeof _0xc03f65[_0x4402('0x1a')]===_0x4402('0x19');var _0x186c22=_0x2a2ce8[_0x4402('0x1b')];var _0x5b127f=_0x19fe7b?0x0:_0xc03f65['offset'];var _0x663ab7=_0x19fe7b?_0x2a2ce8[_0x4402('0x1b')]:_0xc03f65['offset']+_0xc03f65[_0x4402('0x1a')];var _0x192855;if(_0x663ab7>=_0x186c22){_0x663ab7=_0x186c22;_0x192855=0xc8;}else{_0x192855=0xce;}_0x375166['status'](_0x192855);return _0x375166[_0x4402('0x1c')]('Content-Range',_0x5b127f+'-'+_0x663ab7+'/'+_0x186c22)['json'](_0x2a2ce8);}return null;};}function patchUpdates(_0x1b9599){return function(_0x46a1ad){try{jsonpatch[_0x4402('0x1d')](_0x46a1ad,_0x1b9599,!![]);}catch(_0x49bc21){return BPromise[_0x4402('0x1e')](_0x49bc21);}return _0x46a1ad['save']();};}function saveUpdates(_0x47ab54,_0x6f1f72){return function(_0x275c70){if(_0x275c70){return _0x275c70[_0x4402('0x1f')](_0x47ab54)[_0x4402('0x20')](function(_0x258d10){return _0x258d10;});}return null;};}function removeEntity(_0x2e6fee,_0x289a3e){return function(_0x6b1fc5){if(_0x6b1fc5){return _0x6b1fc5[_0x4402('0x21')]()['then'](function(){_0x2e6fee[_0x4402('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3733cd,_0x5ab28d){return function(_0x29f56b){if(!_0x29f56b){_0x3733cd[_0x4402('0x14')](0x194);}return _0x29f56b;};}function handleError(_0x5a43d0,_0x15c19f){_0x15c19f=_0x15c19f||0x1f4;return function(_0x4e9cb5){logger['error'](_0x4e9cb5[_0x4402('0x22')]);if(_0x4e9cb5[_0x4402('0x23')]){delete _0x4e9cb5[_0x4402('0x23')];}_0x5a43d0[_0x4402('0x15')](_0x15c19f)[_0x4402('0x24')](_0x4e9cb5);};}exports['index']=function(_0x41de44,_0x52e625){var _0x71da2f={},_0x1e2340={},_0x42dd32={'count':0x0,'rows':[]};var _0x48d20d=_[_0x4402('0x25')](db[_0x4402('0x26')][_0x4402('0x27')],function(_0x3f4bcb){return{'name':_0x3f4bcb[_0x4402('0x28')],'type':_0x3f4bcb[_0x4402('0x29')][_0x4402('0x2a')]};});_0x1e2340[_0x4402('0x2b')]=_[_0x4402('0x25')](_0x48d20d,_0x4402('0x23'));_0x1e2340[_0x4402('0x2c')]=_['keys'](_0x41de44[_0x4402('0x2c')]);_0x1e2340['filters']=_[_0x4402('0x2d')](_0x1e2340['model'],_0x1e2340[_0x4402('0x2c')]);_0x71da2f[_0x4402('0x2e')]=_[_0x4402('0x2d')](_0x1e2340[_0x4402('0x2b')],qs[_0x4402('0x2f')](_0x41de44['query'][_0x4402('0x2f')]));_0x71da2f[_0x4402('0x2e')]=_0x71da2f[_0x4402('0x2e')]['length']?_0x71da2f[_0x4402('0x2e')]:_0x1e2340[_0x4402('0x2b')];if(!_0x41de44['query'][_0x4402('0x30')](_0x4402('0x31'))){_0x71da2f[_0x4402('0x1a')]=qs[_0x4402('0x1a')](_0x41de44[_0x4402('0x2c')][_0x4402('0x1a')]);_0x71da2f[_0x4402('0x18')]=qs[_0x4402('0x18')](_0x41de44[_0x4402('0x2c')]['offset']);}_0x71da2f[_0x4402('0x32')]=qs[_0x4402('0x33')](_0x41de44[_0x4402('0x2c')]['sort']);_0x71da2f[_0x4402('0x34')]=qs[_0x4402('0x35')](_['pick'](_0x41de44['query'],_0x1e2340[_0x4402('0x35')]),_0x48d20d);if(_0x41de44[_0x4402('0x2c')][_0x4402('0x36')]){_0x71da2f[_0x4402('0x34')]=_['merge'](_0x71da2f['where'],{'$or':_['map'](_0x48d20d,function(_0x3a5e62){if(_0x3a5e62[_0x4402('0x29')]!==_0x4402('0x37')){var _0x3fd8ce={};_0x3fd8ce[_0x3a5e62['name']]={'$like':'%'+_0x41de44[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x3fd8ce;}})});}_0x71da2f=_[_0x4402('0x38')]({},_0x71da2f,_0x41de44['options']);var _0x2b92b7={'where':_0x71da2f['where']};return db[_0x4402('0x26')][_0x4402('0x1b')](_0x2b92b7)['then'](function(_0x16ef2e){_0x42dd32['count']=_0x16ef2e;if(_0x41de44[_0x4402('0x2c')][_0x4402('0x39')]){_0x71da2f['include']=[{'all':!![]}];}return db[_0x4402('0x26')][_0x4402('0x3a')](_0x71da2f);})[_0x4402('0x20')](function(_0x23c43a){_0x42dd32['rows']=_0x23c43a;return _0x42dd32;})['then'](respondWithFilteredResult(_0x52e625,_0x71da2f))[_0x4402('0x3b')](handleError(_0x52e625,null));};exports['show']=function(_0x3a589b,_0x2a6d78){var _0xb9cf85={'raw':![],'where':{'id':_0x3a589b[_0x4402('0x3c')]['id']}},_0x2e2391={};_0x2e2391[_0x4402('0x2b')]=_[_0x4402('0x3d')](db[_0x4402('0x26')][_0x4402('0x27')]);_0x2e2391[_0x4402('0x2c')]=_['keys'](_0x3a589b[_0x4402('0x2c')]);_0x2e2391[_0x4402('0x35')]=_['intersection'](_0x2e2391[_0x4402('0x2b')],_0x2e2391[_0x4402('0x2c')]);_0xb9cf85['attributes']=_[_0x4402('0x2d')](_0x2e2391[_0x4402('0x2b')],qs[_0x4402('0x2f')](_0x3a589b[_0x4402('0x2c')][_0x4402('0x2f')]));_0xb9cf85['attributes']=_0xb9cf85[_0x4402('0x2e')][_0x4402('0x3e')]?_0xb9cf85[_0x4402('0x2e')]:_0x2e2391[_0x4402('0x2b')];if(_0x3a589b[_0x4402('0x2c')][_0x4402('0x39')]){_0xb9cf85[_0x4402('0x3f')]=[{'all':!![]}];}_0xb9cf85=_[_0x4402('0x38')]({},_0xb9cf85,_0x3a589b[_0x4402('0x40')]);return db[_0x4402('0x26')][_0x4402('0x41')](_0xb9cf85)['then'](handleEntityNotFound(_0x2a6d78,null))[_0x4402('0x20')](respondWithResult(_0x2a6d78,null))['catch'](handleError(_0x2a6d78,null));};exports[_0x4402('0x42')]=function(_0x34ce00,_0x54e67a){return db[_0x4402('0x26')][_0x4402('0x42')](_0x34ce00[_0x4402('0x43')],{})[_0x4402('0x20')](respondWithResult(_0x54e67a,0xc9))[_0x4402('0x3b')](handleError(_0x54e67a,null));};exports[_0x4402('0x1f')]=function(_0x5b094b,_0xd0c9a5){if(_0x5b094b[_0x4402('0x43')]['id']){delete _0x5b094b[_0x4402('0x43')]['id'];}return db[_0x4402('0x26')][_0x4402('0x41')]({'where':{'id':_0x5b094b[_0x4402('0x3c')]['id']}})[_0x4402('0x20')](handleEntityNotFound(_0xd0c9a5,null))[_0x4402('0x20')](saveUpdates(_0x5b094b[_0x4402('0x43')],null))['then'](respondWithResult(_0xd0c9a5,null))['catch'](handleError(_0xd0c9a5,null));};exports['destroy']=function(_0x4c2d2e,_0x257010){return db[_0x4402('0x26')][_0x4402('0x41')]({'where':{'id':_0x4c2d2e[_0x4402('0x3c')]['id']}})['then'](handleEntityNotFound(_0x257010,null))[_0x4402('0x20')](removeEntity(_0x257010,null))[_0x4402('0x3b')](handleError(_0x257010,null));};exports[_0x4402('0x44')]=function(_0x2a4ea7,_0x196b2f,_0x352898){var _0x12f1fa={};var _0x53d306={};var _0x325b20;var _0x2a8085;return db[_0x4402('0x26')][_0x4402('0x45')]({'where':{'id':_0x2a4ea7[_0x4402('0x3c')]['id']}})[_0x4402('0x20')](handleEntityNotFound(_0x196b2f,null))['then'](function(_0xe8a8e9){if(_0xe8a8e9){_0x325b20=_0xe8a8e9;_0x53d306[_0x4402('0x2b')]=_[_0x4402('0x3d')](db[_0x4402('0x46')][_0x4402('0x27')]);_0x53d306[_0x4402('0x2c')]=_[_0x4402('0x3d')](_0x2a4ea7['query']);_0x53d306['filters']=_[_0x4402('0x2d')](_0x53d306[_0x4402('0x2b')],_0x53d306[_0x4402('0x2c')]);_0x12f1fa['attributes']=_['intersection'](_0x53d306[_0x4402('0x2b')],qs[_0x4402('0x2f')](_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x2f')]));_0x12f1fa[_0x4402('0x2e')]=_0x12f1fa[_0x4402('0x2e')][_0x4402('0x3e')]?_0x12f1fa[_0x4402('0x2e')]:_0x53d306[_0x4402('0x2b')];_0x12f1fa[_0x4402('0x32')]=qs[_0x4402('0x33')](_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x33')]);_0x12f1fa['where']=qs[_0x4402('0x35')](_['pick'](_0x2a4ea7[_0x4402('0x2c')],_0x53d306['filters']));if(_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x36')]){_0x12f1fa[_0x4402('0x34')]=_[_0x4402('0x38')](_0x12f1fa[_0x4402('0x34')],{'$or':_[_0x4402('0x25')](_0x12f1fa['attributes'],function(_0xe425d0){var _0x25c1fc={};_0x25c1fc[_0xe425d0]={'$like':'%'+_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x25c1fc;})});}_0x12f1fa=_[_0x4402('0x38')]({},_0x12f1fa,_0x2a4ea7['options']);return _0x325b20[_0x4402('0x44')](_0x12f1fa);}})[_0x4402('0x20')](function(_0x474b04){if(_0x474b04){_0x2a8085=_0x474b04[_0x4402('0x3e')];if(!_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x30')](_0x4402('0x31'))){_0x12f1fa[_0x4402('0x1a')]=qs['limit'](_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x1a')]);_0x12f1fa['offset']=qs[_0x4402('0x18')](_0x2a4ea7[_0x4402('0x2c')]['offset']);}return _0x325b20['getConfigurations'](_0x12f1fa);}})[_0x4402('0x20')](function(_0x1746c6){if(_0x1746c6){return _0x1746c6?{'count':_0x2a8085,'rows':_0x1746c6}:null;}})[_0x4402('0x20')](respondWithResult(_0x196b2f,null))['catch'](handleError(_0x196b2f,null));};exports[_0x4402('0x47')]=function(_0x12f3ac,_0x30e49b,_0x55f261){if(_0x12f3ac[_0x4402('0x43')]['id']){delete _0x12f3ac[_0x4402('0x43')]['id'];}return db[_0x4402('0x26')]['findOne']({'where':{'id':_0x12f3ac[_0x4402('0x3c')]['id']}})[_0x4402('0x20')](handleEntityNotFound(_0x30e49b,null))['then'](function(_0x5cef56){if(_0x5cef56){_0x12f3ac[_0x4402('0x43')]['AccountId']=_0x5cef56['id'];_0x12f3ac[_0x4402('0x43')][_0x4402('0x48')]=integrations['getSubjects'](_0x12f3ac['body'][_0x4402('0x49')],_0x12f3ac[_0x4402('0x43')][_0x4402('0x29')]);_0x12f3ac[_0x4402('0x43')]['Descriptions']=integrations[_0x4402('0x4a')](_0x12f3ac[_0x4402('0x43')][_0x4402('0x49')],_0x12f3ac[_0x4402('0x43')][_0x4402('0x29')]);return db[_0x4402('0x46')][_0x4402('0x42')](_0x12f3ac['body'],{'include':[{'model':db[_0x4402('0x4b')],'as':_0x4402('0x48')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x4402('0x20')](respondWithResult(_0x30e49b,null))['catch'](handleError(_0x30e49b,null));};exports[_0x4402('0x4c')]=function(_0x586689,_0xc2ac06,_0x10b89a){var _0x22260b='';return db[_0x4402('0x26')][_0x4402('0x45')]({'where':{'id':_0x586689[_0x4402('0x3c')]['id']},'attributes':['id',_0x4402('0x4d'),_0x4402('0x4e'),_0x4402('0x4f'),_0x4402('0x50'),_0x4402('0x51')]})[_0x4402('0x20')](handleEntityNotFound(_0xc2ac06,null))[_0x4402('0x20')](function(_0xcf5c20){if(_0xcf5c20){_0x22260b=_0xcf5c20[_0x4402('0x51')];var _0x1d6af2=_0x22260b['slice'](-0x1);if(_0x1d6af2==='/'){_0x22260b=_0x22260b[_0x4402('0x52')](0x0,_0x22260b[_0x4402('0x53')](_0x1d6af2));}var _0xccb64f={'method':'GET','uri':util[_0x4402('0x54')]('%s/%s',_0x22260b,_0x4402('0x55')),'json':!![]};switch(_0xcf5c20[_0x4402('0x50')]){case _0x4402('0x4e'):_0xccb64f[_0x4402('0x56')]={'Authorization':util['format'](_0x4402('0x57'),new Buffer(util['format'](_0x4402('0x58'),_0xcf5c20[_0x4402('0x4d')],_0xcf5c20[_0x4402('0x4e')]))['toString'](_0x4402('0x59')))};break;case'token':_0xccb64f[_0x4402('0x56')]={'Authorization':util[_0x4402('0x54')](_0x4402('0x57'),new Buffer(util[_0x4402('0x54')](_0x4402('0x5a'),_0xcf5c20[_0x4402('0x4d')],_0xcf5c20[_0x4402('0x4f')]))[_0x4402('0x5b')](_0x4402('0x59')))};break;default:throw new db['Sequelize'][(_0x4402('0x5c'))](_0x4402('0x5d'));}return rp(_0xccb64f);}})[_0x4402('0x20')](function(_0x221889){if(_0x221889){var _0x4734ef=[_0x4402('0x5e'),_0x4402('0x5f'),_0x4402('0x60'),_0x4402('0x61')];_['remove'](_0x221889[_0x4402('0x55')],function(_0x2a6dc1){return _0x4734ef[_0x4402('0x62')](_0x2a6dc1['type']);});return{'count':_0x221889[_0x4402('0x55')]['length'],'rows':_[_0x4402('0x25')](_0x221889['ticket_fields'],function(_0xc1d540){return{'id':_0xc1d540['id'],'name':_0xc1d540[_0x4402('0x63')]>0x7?_0xc1d540['title']:_0xc1d540[_0x4402('0x29')],'custom':_0xc1d540['position']>0x7?!![]:![],'options':_0xc1d540[_0x4402('0x64')]?_0xc1d540[_0x4402('0x64')]:_0xc1d540['custom_field_options']?_0xc1d540[_0x4402('0x65')]:[]};})};}})[_0x4402('0x20')](respondWithResult(_0xc2ac06,null))['catch'](function(_0x189259){var _0x13c47e=_0x586689['query'][_0x4402('0x66')]?0x1f4:_0x189259[_0x4402('0x67')]||0x1f4;logger[_0x4402('0x68')](_0x4402('0x69'),_0x4402('0x4c'),_0x13c47e,JSON[_0x4402('0x6a')](_0x189259));delete _0x189259[_0x4402('0x23')];if(_0x13c47e===0x191){_0x13c47e=0x190;}_0xc2ac06[_0x4402('0x15')](_0x13c47e)[_0x4402('0x24')](_0x586689[_0x4402('0x2c')][_0x4402('0x66')]?{'message':_0x4402('0x6b'),'statusCode':_0x189259[_0x4402('0x67')]}:_0x189259);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e55a2b7..6a17f1e 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 _0x4a59=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x4a59,0x190));var _0x94a5=function(_0x598ca3,_0x28e7cd){_0x598ca3=_0x598ca3-0x0;var _0x21c006=_0x4a59[_0x598ca3];return _0x21c006;};'use strict';var _=require(_0x94a5('0x0'));var util=require(_0x94a5('0x1'));var logger=require(_0x94a5('0x2'))(_0x94a5('0x3'));var moment=require(_0x94a5('0x4'));var BPromise=require(_0x94a5('0x5'));var rp=require(_0x94a5('0x6'));var fs=require('fs');var path=require(_0x94a5('0x7'));var rimraf=require(_0x94a5('0x8'));var config=require(_0x94a5('0x9'));var attributes=require(_0x94a5('0xa'));var integrations=require(_0x94a5('0xb'));module[_0x94a5('0xc')]=function(_0x3dec77,_0x48637c){return _0x3dec77[_0x94a5('0xd')](_0x94a5('0xe'),attributes,{'tableName':_0x94a5('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce9=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash'];(function(_0x5e6d5a,_0x4be123){var _0x4e4e79=function(_0x2d6a95){while(--_0x2d6a95){_0x5e6d5a['push'](_0x5e6d5a['shift']());}};_0x4e4e79(++_0x4be123);}(_0x4ce9,0x197));var _0x94ce=function(_0x3137d0,_0xc0262c){_0x3137d0=_0x3137d0-0x0;var _0x15f644=_0x4ce9[_0x3137d0];return _0x15f644;};'use strict';var _=require(_0x94ce('0x0'));var util=require('util');var logger=require(_0x94ce('0x1'))(_0x94ce('0x2'));var moment=require(_0x94ce('0x3'));var BPromise=require(_0x94ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94ce('0x5'));var rimraf=require(_0x94ce('0x6'));var config=require(_0x94ce('0x7'));var attributes=require(_0x94ce('0x8'));var integrations=require(_0x94ce('0x9'));module[_0x94ce('0xa')]=function(_0x54a261,_0x31f1b7){return _0x54a261['define'](_0x94ce('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 02c5758..7d8573d 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 _0x973f=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1ff2c7,_0x506fa9){var _0xe6362=function(_0x171054){while(--_0x171054){_0x1ff2c7['push'](_0x1ff2c7['shift']());}};_0xe6362(++_0x506fa9);}(_0x973f,0x7b));var _0xf973=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x973f[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf973('0x0'));var BPromise=require(_0xf973('0x1'));var rs=require(_0xf973('0x2'));var fs=require('fs');var Redis=require(_0xf973('0x3'));var db=require(_0xf973('0x4'))['db'];var utils=require(_0xf973('0x5'));var logger=require(_0xf973('0x6'))('rpc');var config=require(_0xf973('0x7'));var jayson=require(_0xf973('0x8'));var client=jayson['client'][_0xf973('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x312378,_0x45322a,_0x3f2a75){return new BPromise(function(_0x457d85,_0x3de5eb){return client[_0xf973('0xa')](_0x312378,_0x3f2a75)[_0xf973('0xb')](function(_0x4b1b81){logger[_0xf973('0xc')](_0xf973('0xd'),_0x45322a,_0xf973('0xe'));logger[_0xf973('0xf')](_0xf973('0x10'),_0x45322a,_0xf973('0xe'),JSON[_0xf973('0x11')](_0x4b1b81));if(_0x4b1b81[_0xf973('0x12')]){if(_0x4b1b81[_0xf973('0x12')]['code']===0x1f4){logger['error'](_0xf973('0xd'),_0x45322a,_0x4b1b81['error']['message']);return _0x3de5eb(_0x4b1b81['error'][_0xf973('0x13')]);}logger[_0xf973('0x12')](_0xf973('0xd'),_0x45322a,_0x4b1b81[_0xf973('0x12')][_0xf973('0x13')]);return _0x457d85(_0x4b1b81[_0xf973('0x12')][_0xf973('0x13')]);}else{logger['info'](_0xf973('0xd'),_0x45322a,_0xf973('0xe'));_0x457d85(_0x4b1b81[_0xf973('0x14')][_0xf973('0x13')]);}})[_0xf973('0x15')](function(_0x35246d){logger[_0xf973('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x45322a,_0x35246d);_0x3de5eb(_0x35246d);});});}exports[_0xf973('0x16')]=function(_0x2d71a6){var _0x14e811=this;return new Promise(function(_0x32cbdc,_0x5e369a){return db[_0xf973('0x17')]['findAll']({'raw':_0x2d71a6[_0xf973('0x18')]?_0x2d71a6[_0xf973('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d71a6['options']?_0x2d71a6[_0xf973('0x18')][_0xf973('0x19')]||null:null,'attributes':_0x2d71a6[_0xf973('0x18')]?_0x2d71a6['options'][_0xf973('0x1a')]||null:null,'limit':_0x2d71a6[_0xf973('0x18')]?_0x2d71a6[_0xf973('0x18')][_0xf973('0x1b')]||null:null,'include':_0x2d71a6[_0xf973('0x18')]?_0x2d71a6[_0xf973('0x18')][_0xf973('0x1c')]?_[_0xf973('0x1d')](_0x2d71a6[_0xf973('0x18')][_0xf973('0x1c')],function(_0x348378){return{'model':db[_0x348378[_0xf973('0x1e')]],'as':_0x348378['as'],'attributes':_0x348378[_0xf973('0x1a')],'include':_0x348378['include']?_[_0xf973('0x1d')](_0x348378[_0xf973('0x1c')],function(_0x15a721){return{'model':db[_0x15a721[_0xf973('0x1e')]],'as':_0x15a721['as'],'attributes':_0x15a721[_0xf973('0x1a')],'include':_0x15a721['include']?_[_0xf973('0x1d')](_0x15a721[_0xf973('0x1c')],function(_0x2309ab){return{'model':db[_0x2309ab[_0xf973('0x1e')]],'as':_0x2309ab['as'],'attributes':_0x2309ab[_0xf973('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x521ad9){logger[_0xf973('0xc')](_0xf973('0x16'),_0x2d71a6);logger['debug'](_0xf973('0x16'),_0x2d71a6,JSON[_0xf973('0x11')](_0x521ad9));_0x32cbdc(_0x521ad9);})['catch'](function(_0x3526b0){logger['error'](_0xf973('0x16'),_0x3526b0['message'],_0x2d71a6);_0x5e369a(_0x14e811[_0xf973('0x12')](0x1f4,_0x3526b0[_0xf973('0x13')]));});});};exports[_0xf973('0x1f')]=function(_0x298271){var _0x35fc25=this;return new Promise(function(_0x2758d2,_0x2df801){return db['ZendeskAccount'][_0xf973('0x20')]({'raw':_0x298271[_0xf973('0x18')]?_0x298271[_0xf973('0x18')][_0xf973('0x21')]===undefined?!![]:![]:!![],'where':_0x298271[_0xf973('0x18')]?_0x298271['options']['where']||null:null,'attributes':_0x298271[_0xf973('0x18')]?_0x298271['options'][_0xf973('0x1a')]||null:null,'include':_0x298271['options']?_0x298271[_0xf973('0x18')]['include']?_[_0xf973('0x1d')](_0x298271[_0xf973('0x18')]['include'],function(_0x2175c1){return{'model':db[_0x2175c1[_0xf973('0x1e')]],'as':_0x2175c1['as'],'attributes':_0x2175c1[_0xf973('0x1a')],'include':_0x2175c1[_0xf973('0x1c')]?_[_0xf973('0x1d')](_0x2175c1[_0xf973('0x1c')],function(_0x3010fd){return{'model':db[_0x3010fd[_0xf973('0x1e')]],'as':_0x3010fd['as'],'attributes':_0x3010fd[_0xf973('0x1a')],'include':_0x3010fd[_0xf973('0x1c')]?_[_0xf973('0x1d')](_0x3010fd[_0xf973('0x1c')],function(_0x48c716){return{'model':db[_0x48c716[_0xf973('0x1e')]],'as':_0x48c716['as'],'attributes':_0x48c716['attributes']};}):[]};}):[]};}):[]:[]})[_0xf973('0xb')](function(_0x433016){logger[_0xf973('0xc')](_0xf973('0x1f'),_0x298271);logger[_0xf973('0xf')](_0xf973('0x1f'),_0x298271,JSON[_0xf973('0x11')](_0x433016));_0x2758d2(_0x433016);})[_0xf973('0x15')](function(_0x47723c){logger[_0xf973('0x12')]('ShowZendeskAccount',_0x47723c['message'],_0x298271);_0x2df801(_0x35fc25[_0xf973('0x12')](0x1f4,_0x47723c['message']));});});}; \ No newline at end of file +var _0x2e82=['ShowZendeskAccount','find','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x4bfa46,_0x21c584){var _0x268499=function(_0x3d12c6){while(--_0x3d12c6){_0x4bfa46['push'](_0x4bfa46['shift']());}};_0x268499(++_0x21c584);}(_0x2e82,0x70));var _0x22e8=function(_0x18f46a,_0x3b64ba){_0x18f46a=_0x18f46a-0x0;var _0x371d44=_0x2e82[_0x18f46a];return _0x371d44;};'use strict';var _=require(_0x22e8('0x0'));var util=require('util');var moment=require(_0x22e8('0x1'));var BPromise=require(_0x22e8('0x2'));var rs=require(_0x22e8('0x3'));var fs=require('fs');var Redis=require(_0x22e8('0x4'));var db=require(_0x22e8('0x5'))['db'];var utils=require(_0x22e8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x22e8('0x7'));var jayson=require(_0x22e8('0x8'));var client=jayson[_0x22e8('0x9')][_0x22e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22a14f,_0x232771,_0x186dfd){return new BPromise(function(_0x4e4617,_0x439a5b){return client[_0x22e8('0xb')](_0x22a14f,_0x186dfd)[_0x22e8('0xc')](function(_0x4f8e62){logger[_0x22e8('0xd')](_0x22e8('0xe'),_0x232771,_0x22e8('0xf'));logger[_0x22e8('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x232771,_0x22e8('0xf'),JSON[_0x22e8('0x11')](_0x4f8e62));if(_0x4f8e62[_0x22e8('0x12')]){if(_0x4f8e62[_0x22e8('0x12')][_0x22e8('0x13')]===0x1f4){logger['error'](_0x22e8('0xe'),_0x232771,_0x4f8e62[_0x22e8('0x12')][_0x22e8('0x14')]);return _0x439a5b(_0x4f8e62[_0x22e8('0x12')]['message']);}logger[_0x22e8('0x12')](_0x22e8('0xe'),_0x232771,_0x4f8e62[_0x22e8('0x12')]['message']);return _0x4e4617(_0x4f8e62['error']['message']);}else{logger[_0x22e8('0xd')](_0x22e8('0xe'),_0x232771,_0x22e8('0xf'));_0x4e4617(_0x4f8e62[_0x22e8('0x15')][_0x22e8('0x14')]);}})['catch'](function(_0x2f1c7c){logger[_0x22e8('0x12')](_0x22e8('0xe'),_0x232771,_0x2f1c7c);_0x439a5b(_0x2f1c7c);});});}exports[_0x22e8('0x16')]=function(_0x1a002e){var _0x49ef3a=this;return new Promise(function(_0x13d9c3,_0x1d8938){return db[_0x22e8('0x17')][_0x22e8('0x18')]({'raw':_0x1a002e[_0x22e8('0x19')]?_0x1a002e[_0x22e8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a002e[_0x22e8('0x19')]?_0x1a002e[_0x22e8('0x19')][_0x22e8('0x1a')]||null:null,'attributes':_0x1a002e['options']?_0x1a002e[_0x22e8('0x19')][_0x22e8('0x1b')]||null:null,'limit':_0x1a002e[_0x22e8('0x19')]?_0x1a002e[_0x22e8('0x19')][_0x22e8('0x1c')]||null:null,'include':_0x1a002e[_0x22e8('0x19')]?_0x1a002e[_0x22e8('0x19')][_0x22e8('0x1d')]?_[_0x22e8('0x1e')](_0x1a002e[_0x22e8('0x19')][_0x22e8('0x1d')],function(_0x362dbe){return{'model':db[_0x362dbe[_0x22e8('0x1f')]],'as':_0x362dbe['as'],'attributes':_0x362dbe[_0x22e8('0x1b')],'include':_0x362dbe[_0x22e8('0x1d')]?_[_0x22e8('0x1e')](_0x362dbe['include'],function(_0x3912f0){return{'model':db[_0x3912f0[_0x22e8('0x1f')]],'as':_0x3912f0['as'],'attributes':_0x3912f0[_0x22e8('0x1b')],'include':_0x3912f0[_0x22e8('0x1d')]?_[_0x22e8('0x1e')](_0x3912f0[_0x22e8('0x1d')],function(_0x17bf62){return{'model':db[_0x17bf62[_0x22e8('0x1f')]],'as':_0x17bf62['as'],'attributes':_0x17bf62[_0x22e8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x22e8('0xc')](function(_0x3b3fe2){logger['info']('GetZendeskAccount',_0x1a002e);logger[_0x22e8('0x10')](_0x22e8('0x16'),_0x1a002e,JSON[_0x22e8('0x11')](_0x3b3fe2));_0x13d9c3(_0x3b3fe2);})['catch'](function(_0x285dd7){logger['error']('GetZendeskAccount',_0x285dd7[_0x22e8('0x14')],_0x1a002e);_0x1d8938(_0x49ef3a[_0x22e8('0x12')](0x1f4,_0x285dd7['message']));});});};exports[_0x22e8('0x20')]=function(_0x54f62f){var _0x4dd255=this;return new Promise(function(_0x52d015,_0x1032b9){return db[_0x22e8('0x17')][_0x22e8('0x21')]({'raw':_0x54f62f[_0x22e8('0x19')]?_0x54f62f['options'][_0x22e8('0x22')]===undefined?!![]:![]:!![],'where':_0x54f62f[_0x22e8('0x19')]?_0x54f62f[_0x22e8('0x19')][_0x22e8('0x1a')]||null:null,'attributes':_0x54f62f[_0x22e8('0x19')]?_0x54f62f['options'][_0x22e8('0x1b')]||null:null,'include':_0x54f62f[_0x22e8('0x19')]?_0x54f62f[_0x22e8('0x19')][_0x22e8('0x1d')]?_[_0x22e8('0x1e')](_0x54f62f[_0x22e8('0x19')][_0x22e8('0x1d')],function(_0x2900ed){return{'model':db[_0x2900ed[_0x22e8('0x1f')]],'as':_0x2900ed['as'],'attributes':_0x2900ed[_0x22e8('0x1b')],'include':_0x2900ed['include']?_['map'](_0x2900ed[_0x22e8('0x1d')],function(_0x3cc4e2){return{'model':db[_0x3cc4e2[_0x22e8('0x1f')]],'as':_0x3cc4e2['as'],'attributes':_0x3cc4e2[_0x22e8('0x1b')],'include':_0x3cc4e2[_0x22e8('0x1d')]?_['map'](_0x3cc4e2[_0x22e8('0x1d')],function(_0x1ceaeb){return{'model':db[_0x1ceaeb['model']],'as':_0x1ceaeb['as'],'attributes':_0x1ceaeb['attributes']};}):[]};}):[]};}):[]:[]})[_0x22e8('0xc')](function(_0x35dab7){logger[_0x22e8('0xd')](_0x22e8('0x20'),_0x54f62f);logger[_0x22e8('0x10')]('ShowZendeskAccount',_0x54f62f,JSON['stringify'](_0x35dab7));_0x52d015(_0x35dab7);})[_0x22e8('0x23')](function(_0x1db5a5){logger[_0x22e8('0x12')](_0x22e8('0x20'),_0x1db5a5['message'],_0x54f62f);_0x1032b9(_0x4dd255[_0x22e8('0x12')](0x1f4,_0x1db5a5[_0x22e8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f2bf6af..0c4ace9 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 _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(_0x19d043,_0x2dbb80){var _0x25c755=function(_0x22d61b){while(--_0x22d61b){_0x19d043['push'](_0x19d043['shift']());}};_0x25c755(++_0x2dbb80);}(_0xa571,0x107));var _0x1a57=function(_0x37e486,_0x5d91ec){_0x37e486=_0x37e486-0x0;var _0x4c3c82=_0xa571[_0x37e486];return _0x4c3c82;};'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 +var _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x4f6fb3,_0x2426bb){var _0x258638=function(_0x4ea653){while(--_0x4ea653){_0x4f6fb3['push'](_0x4f6fb3['shift']());}};_0x258638(++_0x2426bb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2ff9ec,_0x57f784){_0x2ff9ec=_0x2ff9ec-0x0;var _0x5e8dae=_0xf4eb[_0x2ff9ec];return _0x5e8dae;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d36ef20..a48c424 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 _0x3263=['STRING','sequelize','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x3263,0x1cc));var _0x3326=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x3263[_0x467488];return _0x56107f;};'use strict';var Sequelize=require(_0x3326('0x0'));module[_0x3326('0x1')]={'name':{'type':Sequelize[_0x3326('0x2')]},'description':{'type':Sequelize[_0x3326('0x2')]}}; \ No newline at end of file +var _0x4967=['sequelize','exports','STRING'];(function(_0xb4ee05,_0x2c7b64){var _0x5d227e=function(_0x5c7681){while(--_0x5c7681){_0xb4ee05['push'](_0xb4ee05['shift']());}};_0x5d227e(++_0x2c7b64);}(_0x4967,0xbd));var _0x7496=function(_0x44b5d9,_0xe28bb1){_0x44b5d9=_0x44b5d9-0x0;var _0x25d599=_0x4967[_0x44b5d9];return _0x25d599;};'use strict';var Sequelize=require(_0x7496('0x0'));module[_0x7496('0x1')]={'name':{'type':Sequelize[_0x7496('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d9cdb71..acd948d 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 _0xb614=['order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getFields','findOne','ZendeskField','options','getSubjects','nolimit','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty'];(function(_0x29d849,_0x209ceb){var _0x30b104=function(_0x2a1669){while(--_0x2a1669){_0x29d849['push'](_0x29d849['shift']());}};_0x30b104(++_0x209ceb);}(_0xb614,0x1d0));var _0x4b61=function(_0x50c176,_0x4f0fd6){_0x50c176=_0x50c176-0x0;var _0x1a0aff=_0xb614[_0x50c176];return _0x1a0aff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b61('0x0'));var zipdir=require(_0x4b61('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b61('0x2'));var moment=require(_0x4b61('0x3'));var BPromise=require(_0x4b61('0x4'));var Mustache=require(_0x4b61('0x5'));var util=require('util');var path=require(_0x4b61('0x6'));var sox=require(_0x4b61('0x7'));var csv=require(_0x4b61('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b61('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b61('0xa'));var jsforce=require(_0x4b61('0xb'));var deskjs=require(_0x4b61('0xc'));var toCsv=require(_0x4b61('0x8'));var querystring=require('querystring');var Papa=require(_0x4b61('0xd'));var Redis=require(_0x4b61('0xe'));var authService=require(_0x4b61('0xf'));var qs=require(_0x4b61('0x10'));var as=require(_0x4b61('0x11'));var hardwareService=require(_0x4b61('0x12'));var logger=require(_0x4b61('0x13'))(_0x4b61('0x14'));var utils=require(_0x4b61('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4b61('0x16'));var db=require(_0x4b61('0x17'))['db'];function respondWithStatusCode(_0x4465c4,_0x2ef8c3){_0x2ef8c3=_0x2ef8c3||0xcc;return function(_0x50db44){if(_0x50db44){return _0x4465c4[_0x4b61('0x18')](_0x2ef8c3);}return _0x4465c4['status'](_0x2ef8c3)[_0x4b61('0x19')]();};}function respondWithResult(_0x5d56c7,_0x17050e){_0x17050e=_0x17050e||0xc8;return function(_0x41a3a7){if(_0x41a3a7){return _0x5d56c7['status'](_0x17050e)[_0x4b61('0x1a')](_0x41a3a7);}};}function respondWithFilteredResult(_0x23cfd6,_0x53e6f0){return function(_0x3f5739){if(_0x3f5739){var _0x197b23=typeof _0x53e6f0[_0x4b61('0x1b')]===_0x4b61('0x1c')&&typeof _0x53e6f0['limit']==='undefined';var _0x45560f=_0x3f5739[_0x4b61('0x1d')];var _0x53a553=_0x197b23?0x0:_0x53e6f0[_0x4b61('0x1b')];var _0x26ca91=_0x197b23?_0x3f5739['count']:_0x53e6f0[_0x4b61('0x1b')]+_0x53e6f0[_0x4b61('0x1e')];var _0x4138fb;if(_0x26ca91>=_0x45560f){_0x26ca91=_0x45560f;_0x4138fb=0xc8;}else{_0x4138fb=0xce;}_0x23cfd6[_0x4b61('0x1f')](_0x4138fb);return _0x23cfd6['set'](_0x4b61('0x20'),_0x53a553+'-'+_0x26ca91+'/'+_0x45560f)[_0x4b61('0x1a')](_0x3f5739);}return null;};}function patchUpdates(_0x28b85f){return function(_0x38c839){try{jsonpatch[_0x4b61('0x21')](_0x38c839,_0x28b85f,!![]);}catch(_0x357610){return BPromise[_0x4b61('0x22')](_0x357610);}return _0x38c839[_0x4b61('0x23')]();};}function saveUpdates(_0x32774a,_0x3f331e){return function(_0x10c6a6){if(_0x10c6a6){return _0x10c6a6['update'](_0x32774a)[_0x4b61('0x24')](function(_0x5c7c49){return _0x5c7c49;});}return null;};}function removeEntity(_0x1e66c4,_0x48f346){return function(_0x14a8cb){if(_0x14a8cb){return _0x14a8cb[_0x4b61('0x25')]()[_0x4b61('0x24')](function(){_0x1e66c4[_0x4b61('0x1f')](0xcc)[_0x4b61('0x19')]();});}};}function handleEntityNotFound(_0x4962f2,_0x5cee16){return function(_0x2b4559){if(!_0x2b4559){_0x4962f2[_0x4b61('0x18')](0x194);}return _0x2b4559;};}function handleError(_0x52210a,_0x58f2d3){_0x58f2d3=_0x58f2d3||0x1f4;return function(_0x1b9395){logger[_0x4b61('0x26')](_0x1b9395[_0x4b61('0x27')]);if(_0x1b9395[_0x4b61('0x28')]){delete _0x1b9395[_0x4b61('0x28')];}_0x52210a['status'](_0x58f2d3)[_0x4b61('0x29')](_0x1b9395);};}exports[_0x4b61('0x2a')]=function(_0x20b804,_0x52cc1a){var _0x39c48a={},_0x51cca8={},_0x996b41={'count':0x0,'rows':[]};var _0x3850c3=_['map'](db[_0x4b61('0x2b')][_0x4b61('0x2c')],function(_0x4c2e3f){return{'name':_0x4c2e3f[_0x4b61('0x2d')],'type':_0x4c2e3f[_0x4b61('0x2e')][_0x4b61('0x2f')]};});_0x51cca8[_0x4b61('0x30')]=_[_0x4b61('0x31')](_0x3850c3,_0x4b61('0x28'));_0x51cca8['query']=_[_0x4b61('0x32')](_0x20b804['query']);_0x51cca8[_0x4b61('0x33')]=_[_0x4b61('0x34')](_0x51cca8['model'],_0x51cca8[_0x4b61('0x35')]);_0x39c48a[_0x4b61('0x36')]=_[_0x4b61('0x34')](_0x51cca8[_0x4b61('0x30')],qs['fields'](_0x20b804['query'][_0x4b61('0x37')]));_0x39c48a[_0x4b61('0x36')]=_0x39c48a[_0x4b61('0x36')][_0x4b61('0x38')]?_0x39c48a['attributes']:_0x51cca8[_0x4b61('0x30')];if(!_0x20b804[_0x4b61('0x35')][_0x4b61('0x39')]('nolimit')){_0x39c48a[_0x4b61('0x1e')]=qs[_0x4b61('0x1e')](_0x20b804[_0x4b61('0x35')]['limit']);_0x39c48a['offset']=qs[_0x4b61('0x1b')](_0x20b804[_0x4b61('0x35')]['offset']);}_0x39c48a[_0x4b61('0x3a')]=qs[_0x4b61('0x3b')](_0x20b804[_0x4b61('0x35')][_0x4b61('0x3b')]);_0x39c48a['where']=qs[_0x4b61('0x33')](_[_0x4b61('0x3c')](_0x20b804[_0x4b61('0x35')],_0x51cca8[_0x4b61('0x33')]),_0x3850c3);if(_0x20b804[_0x4b61('0x35')][_0x4b61('0x3d')]){_0x39c48a[_0x4b61('0x3e')]=_['merge'](_0x39c48a[_0x4b61('0x3e')],{'$or':_['map'](_0x3850c3,function(_0x204b01){if(_0x204b01[_0x4b61('0x2e')]!==_0x4b61('0x3f')){var _0x1a7654={};_0x1a7654[_0x204b01[_0x4b61('0x28')]]={'$like':'%'+_0x20b804['query'][_0x4b61('0x3d')]+'%'};return _0x1a7654;}})});}_0x39c48a=_[_0x4b61('0x40')]({},_0x39c48a,_0x20b804['options']);var _0x492f79={'where':_0x39c48a[_0x4b61('0x3e')]};return db[_0x4b61('0x2b')][_0x4b61('0x1d')](_0x492f79)[_0x4b61('0x24')](function(_0x44c0c3){_0x996b41[_0x4b61('0x1d')]=_0x44c0c3;if(_0x20b804[_0x4b61('0x35')][_0x4b61('0x41')]){_0x39c48a[_0x4b61('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4b61('0x43')](_0x39c48a);})['then'](function(_0x2913a2){_0x996b41[_0x4b61('0x44')]=_0x2913a2;return _0x996b41;})[_0x4b61('0x24')](respondWithFilteredResult(_0x52cc1a,_0x39c48a))[_0x4b61('0x45')](handleError(_0x52cc1a,null));};exports[_0x4b61('0x46')]=function(_0x1c18c5,_0x411187){var _0x23d516={'raw':![],'where':{'id':_0x1c18c5[_0x4b61('0x47')]['id']}},_0x1660dc={};_0x1660dc['model']=_[_0x4b61('0x32')](db[_0x4b61('0x2b')][_0x4b61('0x2c')]);_0x1660dc[_0x4b61('0x35')]=_[_0x4b61('0x32')](_0x1c18c5[_0x4b61('0x35')]);_0x1660dc['filters']=_['intersection'](_0x1660dc['model'],_0x1660dc[_0x4b61('0x35')]);_0x23d516[_0x4b61('0x36')]=_[_0x4b61('0x34')](_0x1660dc[_0x4b61('0x30')],qs['fields'](_0x1c18c5[_0x4b61('0x35')][_0x4b61('0x37')]));_0x23d516[_0x4b61('0x36')]=_0x23d516['attributes'][_0x4b61('0x38')]?_0x23d516[_0x4b61('0x36')]:_0x1660dc[_0x4b61('0x30')];if(_0x1c18c5[_0x4b61('0x35')][_0x4b61('0x41')]){_0x23d516['include']=[{'all':!![]}];}_0x23d516=_[_0x4b61('0x40')]({},_0x23d516,_0x1c18c5['options']);return db['ZendeskConfiguration'][_0x4b61('0x48')](_0x23d516)['then'](handleEntityNotFound(_0x411187,null))[_0x4b61('0x24')](respondWithResult(_0x411187,null))[_0x4b61('0x45')](handleError(_0x411187,null));};exports[_0x4b61('0x49')]=function(_0x5bc487,_0x25ad7b){return db['ZendeskConfiguration'][_0x4b61('0x49')](_0x5bc487[_0x4b61('0x4a')],{})[_0x4b61('0x24')](respondWithResult(_0x25ad7b,0xc9))['catch'](handleError(_0x25ad7b,null));};exports[_0x4b61('0x4b')]=function(_0x2b1617,_0x34305e){if(_0x2b1617[_0x4b61('0x4a')]['id']){delete _0x2b1617['body']['id'];}return db[_0x4b61('0x2b')][_0x4b61('0x48')]({'where':{'id':_0x2b1617[_0x4b61('0x47')]['id']}})['then'](handleEntityNotFound(_0x34305e,null))['then'](saveUpdates(_0x2b1617[_0x4b61('0x4a')],null))[_0x4b61('0x24')](respondWithResult(_0x34305e,null))[_0x4b61('0x45')](handleError(_0x34305e,null));};exports['destroy']=function(_0x52ab45,_0x478ffd){return db[_0x4b61('0x2b')]['find']({'where':{'id':_0x52ab45[_0x4b61('0x47')]['id']}})[_0x4b61('0x24')](handleEntityNotFound(_0x478ffd,null))['then'](removeEntity(_0x478ffd,null))['catch'](handleError(_0x478ffd,null));};exports[_0x4b61('0x4c')]=function(_0x4f1f2d,_0x30aac3,_0x2faaf5){var _0x8ae8f={};var _0x41e0ef={};var _0x2ce59b;var _0x8a1a72;return db[_0x4b61('0x2b')][_0x4b61('0x4d')]({'where':{'id':_0x4f1f2d[_0x4b61('0x47')]['id']}})[_0x4b61('0x24')](handleEntityNotFound(_0x30aac3,null))[_0x4b61('0x24')](function(_0x85166c){if(_0x85166c){_0x2ce59b=_0x85166c;_0x41e0ef[_0x4b61('0x30')]=_[_0x4b61('0x32')](db[_0x4b61('0x4e')][_0x4b61('0x2c')]);_0x41e0ef[_0x4b61('0x35')]=_[_0x4b61('0x32')](_0x4f1f2d[_0x4b61('0x35')]);_0x41e0ef[_0x4b61('0x33')]=_[_0x4b61('0x34')](_0x41e0ef[_0x4b61('0x30')],_0x41e0ef['query']);_0x8ae8f['attributes']=_['intersection'](_0x41e0ef[_0x4b61('0x30')],qs[_0x4b61('0x37')](_0x4f1f2d[_0x4b61('0x35')][_0x4b61('0x37')]));_0x8ae8f[_0x4b61('0x36')]=_0x8ae8f[_0x4b61('0x36')][_0x4b61('0x38')]?_0x8ae8f[_0x4b61('0x36')]:_0x41e0ef[_0x4b61('0x30')];_0x8ae8f[_0x4b61('0x3a')]=qs[_0x4b61('0x3b')](_0x4f1f2d[_0x4b61('0x35')]['sort']);_0x8ae8f[_0x4b61('0x3e')]=qs[_0x4b61('0x33')](_[_0x4b61('0x3c')](_0x4f1f2d['query'],_0x41e0ef['filters']));if(_0x4f1f2d[_0x4b61('0x35')]['filter']){_0x8ae8f[_0x4b61('0x3e')]=_[_0x4b61('0x40')](_0x8ae8f['where'],{'$or':_['map'](_0x8ae8f[_0x4b61('0x36')],function(_0x2b417b){var _0x7086ae={};_0x7086ae[_0x2b417b]={'$like':'%'+_0x4f1f2d[_0x4b61('0x35')][_0x4b61('0x3d')]+'%'};return _0x7086ae;})});}_0x8ae8f=_['merge']({},_0x8ae8f,_0x4f1f2d[_0x4b61('0x4f')]);return _0x2ce59b['getFields'](_0x8ae8f);}})['then'](function(_0x55a6f3){if(_0x55a6f3){_0x8a1a72=_0x55a6f3[_0x4b61('0x38')];if(!_0x4f1f2d[_0x4b61('0x35')][_0x4b61('0x39')]('nolimit')){_0x8ae8f[_0x4b61('0x1e')]=qs['limit'](_0x4f1f2d[_0x4b61('0x35')]['limit']);_0x8ae8f[_0x4b61('0x1b')]=qs[_0x4b61('0x1b')](_0x4f1f2d[_0x4b61('0x35')][_0x4b61('0x1b')]);}return _0x2ce59b[_0x4b61('0x4c')](_0x8ae8f);}})['then'](function(_0x3dde76){if(_0x3dde76){return _0x3dde76?{'count':_0x8a1a72,'rows':_0x3dde76}:null;}})[_0x4b61('0x24')](respondWithResult(_0x30aac3,null))[_0x4b61('0x45')](handleError(_0x30aac3,null));};exports[_0x4b61('0x50')]=function(_0x301980,_0x5428ca,_0x1f4292){var _0x502d52={};var _0xd745f5={};var _0x507e70;var _0x1ba54f;return db[_0x4b61('0x2b')][_0x4b61('0x4d')]({'where':{'id':_0x301980[_0x4b61('0x47')]['id']}})['then'](handleEntityNotFound(_0x5428ca,null))[_0x4b61('0x24')](function(_0x360617){if(_0x360617){_0x507e70=_0x360617;_0xd745f5['model']=_[_0x4b61('0x32')](db[_0x4b61('0x4e')][_0x4b61('0x2c')]);_0xd745f5[_0x4b61('0x35')]=_[_0x4b61('0x32')](_0x301980['query']);_0xd745f5[_0x4b61('0x33')]=_[_0x4b61('0x34')](_0xd745f5[_0x4b61('0x30')],_0xd745f5[_0x4b61('0x35')]);_0x502d52[_0x4b61('0x36')]=_[_0x4b61('0x34')](_0xd745f5[_0x4b61('0x30')],qs[_0x4b61('0x37')](_0x301980[_0x4b61('0x35')][_0x4b61('0x37')]));_0x502d52[_0x4b61('0x36')]=_0x502d52[_0x4b61('0x36')][_0x4b61('0x38')]?_0x502d52['attributes']:_0xd745f5['model'];_0x502d52[_0x4b61('0x3a')]=qs['sort'](_0x301980[_0x4b61('0x35')][_0x4b61('0x3b')]);_0x502d52['where']=qs[_0x4b61('0x33')](_['pick'](_0x301980[_0x4b61('0x35')],_0xd745f5[_0x4b61('0x33')]));if(_0x301980[_0x4b61('0x35')][_0x4b61('0x3d')]){_0x502d52[_0x4b61('0x3e')]=_[_0x4b61('0x40')](_0x502d52[_0x4b61('0x3e')],{'$or':_[_0x4b61('0x31')](_0x502d52[_0x4b61('0x36')],function(_0x4a19b0){var _0x3250cf={};_0x3250cf[_0x4a19b0]={'$like':'%'+_0x301980['query']['filter']+'%'};return _0x3250cf;})});}_0x502d52=_[_0x4b61('0x40')]({},_0x502d52,_0x301980[_0x4b61('0x4f')]);return _0x507e70['getSubjects'](_0x502d52);}})['then'](function(_0x57814c){if(_0x57814c){_0x1ba54f=_0x57814c[_0x4b61('0x38')];if(!_0x301980[_0x4b61('0x35')][_0x4b61('0x39')](_0x4b61('0x51'))){_0x502d52[_0x4b61('0x1e')]=qs[_0x4b61('0x1e')](_0x301980[_0x4b61('0x35')][_0x4b61('0x1e')]);_0x502d52[_0x4b61('0x1b')]=qs[_0x4b61('0x1b')](_0x301980['query'][_0x4b61('0x1b')]);}return _0x507e70[_0x4b61('0x50')](_0x502d52);}})[_0x4b61('0x24')](function(_0x3905b5){if(_0x3905b5){return _0x3905b5?{'count':_0x1ba54f,'rows':_0x3905b5}:null;}})['then'](respondWithResult(_0x5428ca,null))[_0x4b61('0x45')](handleError(_0x5428ca,null));};exports[_0x4b61('0x52')]=function(_0x1c3113,_0x20fe43,_0x8d3a1a){var _0x41e124={};var _0x5f019c={};var _0x578f58;var _0x422d61;return db[_0x4b61('0x2b')][_0x4b61('0x4d')]({'where':{'id':_0x1c3113['params']['id']}})[_0x4b61('0x24')](handleEntityNotFound(_0x20fe43,null))[_0x4b61('0x24')](function(_0x20c9bb){if(_0x20c9bb){_0x578f58=_0x20c9bb;_0x5f019c['model']=_[_0x4b61('0x32')](db[_0x4b61('0x4e')][_0x4b61('0x2c')]);_0x5f019c[_0x4b61('0x35')]=_[_0x4b61('0x32')](_0x1c3113[_0x4b61('0x35')]);_0x5f019c['filters']=_[_0x4b61('0x34')](_0x5f019c['model'],_0x5f019c['query']);_0x41e124[_0x4b61('0x36')]=_[_0x4b61('0x34')](_0x5f019c[_0x4b61('0x30')],qs[_0x4b61('0x37')](_0x1c3113[_0x4b61('0x35')][_0x4b61('0x37')]));_0x41e124[_0x4b61('0x36')]=_0x41e124[_0x4b61('0x36')][_0x4b61('0x38')]?_0x41e124[_0x4b61('0x36')]:_0x5f019c[_0x4b61('0x30')];_0x41e124['order']=qs['sort'](_0x1c3113[_0x4b61('0x35')][_0x4b61('0x3b')]);_0x41e124[_0x4b61('0x3e')]=qs[_0x4b61('0x33')](_[_0x4b61('0x3c')](_0x1c3113[_0x4b61('0x35')],_0x5f019c[_0x4b61('0x33')]));if(_0x1c3113[_0x4b61('0x35')][_0x4b61('0x3d')]){_0x41e124[_0x4b61('0x3e')]=_[_0x4b61('0x40')](_0x41e124[_0x4b61('0x3e')],{'$or':_[_0x4b61('0x31')](_0x41e124[_0x4b61('0x36')],function(_0x123cd0){var _0x3cee4d={};_0x3cee4d[_0x123cd0]={'$like':'%'+_0x1c3113[_0x4b61('0x35')][_0x4b61('0x3d')]+'%'};return _0x3cee4d;})});}_0x41e124=_['merge']({},_0x41e124,_0x1c3113[_0x4b61('0x4f')]);return _0x578f58['getDescriptions'](_0x41e124);}})[_0x4b61('0x24')](function(_0x5eea7a){if(_0x5eea7a){_0x422d61=_0x5eea7a[_0x4b61('0x38')];if(!_0x1c3113[_0x4b61('0x35')][_0x4b61('0x39')](_0x4b61('0x51'))){_0x41e124['limit']=qs['limit'](_0x1c3113[_0x4b61('0x35')][_0x4b61('0x1e')]);_0x41e124[_0x4b61('0x1b')]=qs['offset'](_0x1c3113['query'][_0x4b61('0x1b')]);}return _0x578f58[_0x4b61('0x52')](_0x41e124);}})[_0x4b61('0x24')](function(_0x52900f){if(_0x52900f){return _0x52900f?{'count':_0x422d61,'rows':_0x52900f}:null;}})[_0x4b61('0x24')](respondWithResult(_0x20fe43,null))[_0x4b61('0x45')](handleError(_0x20fe43,null));};exports['getTags']=function(_0x2e80af,_0x4e1faa,_0x4bc95c){var _0x14b1a5={};var _0x402433={};var _0x1347d6;var _0x394c76;return db[_0x4b61('0x2b')][_0x4b61('0x4d')]({'where':{'id':_0x2e80af[_0x4b61('0x47')]['id']}})[_0x4b61('0x24')](handleEntityNotFound(_0x4e1faa,null))['then'](function(_0x1b5a0d){if(_0x1b5a0d){_0x1347d6=_0x1b5a0d;_0x402433[_0x4b61('0x30')]=_[_0x4b61('0x32')](db[_0x4b61('0x53')][_0x4b61('0x2c')]);_0x402433['query']=_[_0x4b61('0x32')](_0x2e80af[_0x4b61('0x35')]);_0x402433['filters']=_[_0x4b61('0x34')](_0x402433['model'],_0x402433[_0x4b61('0x35')]);_0x14b1a5[_0x4b61('0x36')]=_[_0x4b61('0x34')](_0x402433[_0x4b61('0x30')],qs[_0x4b61('0x37')](_0x2e80af[_0x4b61('0x35')][_0x4b61('0x37')]));_0x14b1a5['attributes']=_0x14b1a5['attributes'][_0x4b61('0x38')]?_0x14b1a5['attributes']:_0x402433[_0x4b61('0x30')];_0x14b1a5[_0x4b61('0x3a')]=qs['sort'](_0x2e80af[_0x4b61('0x35')]['sort']);_0x14b1a5[_0x4b61('0x3e')]=qs['filters'](_[_0x4b61('0x3c')](_0x2e80af[_0x4b61('0x35')],_0x402433[_0x4b61('0x33')]));if(_0x2e80af[_0x4b61('0x35')][_0x4b61('0x3d')]){_0x14b1a5[_0x4b61('0x3e')]=_[_0x4b61('0x40')](_0x14b1a5[_0x4b61('0x3e')],{'$or':_['map'](_0x14b1a5[_0x4b61('0x36')],function(_0x8a02cb){var _0x223053={};_0x223053[_0x8a02cb]={'$like':'%'+_0x2e80af[_0x4b61('0x35')][_0x4b61('0x3d')]+'%'};return _0x223053;})});}_0x14b1a5=_[_0x4b61('0x40')]({},_0x14b1a5,_0x2e80af[_0x4b61('0x4f')]);return _0x1347d6[_0x4b61('0x54')](_0x14b1a5);}})['then'](function(_0x2bde9a){if(_0x2bde9a){_0x394c76=_0x2bde9a[_0x4b61('0x38')];if(!_0x2e80af[_0x4b61('0x35')][_0x4b61('0x39')](_0x4b61('0x51'))){_0x14b1a5[_0x4b61('0x1e')]=qs[_0x4b61('0x1e')](_0x2e80af['query'][_0x4b61('0x1e')]);_0x14b1a5['offset']=qs[_0x4b61('0x1b')](_0x2e80af[_0x4b61('0x35')]['offset']);}return _0x1347d6[_0x4b61('0x54')](_0x14b1a5);}})[_0x4b61('0x24')](function(_0x4b3f5b){if(_0x4b3f5b){return _0x4b3f5b?{'count':_0x394c76,'rows':_0x4b3f5b}:null;}})['then'](respondWithResult(_0x4e1faa,null))[_0x4b61('0x45')](handleError(_0x4e1faa,null));};exports[_0x4b61('0x55')]=function(_0x329d02,_0x12ba12,_0x3556be){if(_0x329d02[_0x4b61('0x4a')]['id']){delete _0x329d02[_0x4b61('0x4a')]['id'];}return db[_0x4b61('0x2b')]['findOne']({'where':{'id':_0x329d02[_0x4b61('0x47')]['id']}})[_0x4b61('0x24')](handleEntityNotFound(_0x12ba12,null))[_0x4b61('0x24')](function(_0x524583){if(_0x524583){return _0x524583['setTags'](_0x329d02[_0x4b61('0x4a')][_0x4b61('0x56')]||[]);}return null;})[_0x4b61('0x24')](respondWithResult(_0x12ba12,null))[_0x4b61('0x45')](handleError(_0x12ba12,null));}; \ No newline at end of file +var _0x80ab=['set','reject','update','then','destroy','sendStatus','error','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','hasOwnProperty','order','sort','where','pick','filter','rows','show','params','fields','length','includeAll','include','options','catch','create','body','find','getFields','findOne','merge','getSubjects','ZendeskField','nolimit','getDescriptions','getTags','Tag','setTags','ids','rimraf','bluebird','mustache','util','path','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','../../mysqldb','end','json','limit','undefined','count','offset','status'];(function(_0x5c5bf0,_0x1daf30){var _0x1bf966=function(_0x19453e){while(--_0x19453e){_0x5c5bf0['push'](_0x5c5bf0['shift']());}};_0x1bf966(++_0x1daf30);}(_0x80ab,0xce));var _0xb80a=function(_0x1d079d,_0x5b93f2){_0x1d079d=_0x1d079d-0x0;var _0x2a48b0=_0x80ab[_0x1d079d];return _0x2a48b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb80a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb80a('0x1'));var Mustache=require(_0xb80a('0x2'));var util=require(_0xb80a('0x3'));var path=require(_0xb80a('0x4'));var sox=require('sox');var csv=require(_0xb80a('0x5'));var ejs=require(_0xb80a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb80a('0x7'));var squel=require(_0xb80a('0x8'));var crypto=require(_0xb80a('0x9'));var jsforce=require(_0xb80a('0xa'));var deskjs=require(_0xb80a('0xb'));var toCsv=require(_0xb80a('0x5'));var querystring=require(_0xb80a('0xc'));var Papa=require('papaparse');var Redis=require(_0xb80a('0xd'));var authService=require(_0xb80a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb80a('0xf'));var hardwareService=require(_0xb80a('0x10'));var logger=require(_0xb80a('0x11'))(_0xb80a('0x12'));var utils=require('../../config/utils');var config=require(_0xb80a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb80a('0x14'))['db'];function respondWithStatusCode(_0x2075c0,_0x48f5ba){_0x48f5ba=_0x48f5ba||0xcc;return function(_0x65f14f){if(_0x65f14f){return _0x2075c0['sendStatus'](_0x48f5ba);}return _0x2075c0['status'](_0x48f5ba)[_0xb80a('0x15')]();};}function respondWithResult(_0xa6d4de,_0x4562f0){_0x4562f0=_0x4562f0||0xc8;return function(_0x229685){if(_0x229685){return _0xa6d4de['status'](_0x4562f0)[_0xb80a('0x16')](_0x229685);}};}function respondWithFilteredResult(_0x454fd6,_0x6edc35){return function(_0x56fc55){if(_0x56fc55){var _0x49e3ed=typeof _0x6edc35['offset']==='undefined'&&typeof _0x6edc35[_0xb80a('0x17')]===_0xb80a('0x18');var _0x2d2e77=_0x56fc55[_0xb80a('0x19')];var _0x42d109=_0x49e3ed?0x0:_0x6edc35[_0xb80a('0x1a')];var _0x7ea205=_0x49e3ed?_0x56fc55['count']:_0x6edc35[_0xb80a('0x1a')]+_0x6edc35[_0xb80a('0x17')];var _0x2dd59f;if(_0x7ea205>=_0x2d2e77){_0x7ea205=_0x2d2e77;_0x2dd59f=0xc8;}else{_0x2dd59f=0xce;}_0x454fd6[_0xb80a('0x1b')](_0x2dd59f);return _0x454fd6[_0xb80a('0x1c')]('Content-Range',_0x42d109+'-'+_0x7ea205+'/'+_0x2d2e77)[_0xb80a('0x16')](_0x56fc55);}return null;};}function patchUpdates(_0x13dca8){return function(_0x4695ff){try{jsonpatch['apply'](_0x4695ff,_0x13dca8,!![]);}catch(_0x5afe84){return BPromise[_0xb80a('0x1d')](_0x5afe84);}return _0x4695ff['save']();};}function saveUpdates(_0x2aad62,_0x3dfec4){return function(_0x234a28){if(_0x234a28){return _0x234a28[_0xb80a('0x1e')](_0x2aad62)[_0xb80a('0x1f')](function(_0xd9093c){return _0xd9093c;});}return null;};}function removeEntity(_0x1d7331,_0x1ca1e3){return function(_0x36e03e){if(_0x36e03e){return _0x36e03e[_0xb80a('0x20')]()[_0xb80a('0x1f')](function(){_0x1d7331[_0xb80a('0x1b')](0xcc)[_0xb80a('0x15')]();});}};}function handleEntityNotFound(_0x4038df,_0x41ca92){return function(_0x3776b4){if(!_0x3776b4){_0x4038df[_0xb80a('0x21')](0x194);}return _0x3776b4;};}function handleError(_0x3b731b,_0x5072d1){_0x5072d1=_0x5072d1||0x1f4;return function(_0x12c789){logger[_0xb80a('0x22')](_0x12c789['stack']);if(_0x12c789['name']){delete _0x12c789[_0xb80a('0x23')];}_0x3b731b['status'](_0x5072d1)[_0xb80a('0x24')](_0x12c789);};}exports[_0xb80a('0x25')]=function(_0x31c2cc,_0x3ba8ae){var _0x470755={},_0x240c35={},_0x1677c5={'count':0x0,'rows':[]};var _0x4224d7=_[_0xb80a('0x26')](db[_0xb80a('0x27')][_0xb80a('0x28')],function(_0x5e14e7){return{'name':_0x5e14e7['fieldName'],'type':_0x5e14e7[_0xb80a('0x29')][_0xb80a('0x2a')]};});_0x240c35['model']=_[_0xb80a('0x26')](_0x4224d7,'name');_0x240c35[_0xb80a('0x2b')]=_[_0xb80a('0x2c')](_0x31c2cc[_0xb80a('0x2b')]);_0x240c35[_0xb80a('0x2d')]=_[_0xb80a('0x2e')](_0x240c35['model'],_0x240c35[_0xb80a('0x2b')]);_0x470755[_0xb80a('0x2f')]=_['intersection'](_0x240c35[_0xb80a('0x30')],qs['fields'](_0x31c2cc[_0xb80a('0x2b')]['fields']));_0x470755[_0xb80a('0x2f')]=_0x470755[_0xb80a('0x2f')]['length']?_0x470755['attributes']:_0x240c35[_0xb80a('0x30')];if(!_0x31c2cc[_0xb80a('0x2b')][_0xb80a('0x31')]('nolimit')){_0x470755[_0xb80a('0x17')]=qs[_0xb80a('0x17')](_0x31c2cc[_0xb80a('0x2b')][_0xb80a('0x17')]);_0x470755[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x31c2cc[_0xb80a('0x2b')]['offset']);}_0x470755[_0xb80a('0x32')]=qs[_0xb80a('0x33')](_0x31c2cc[_0xb80a('0x2b')][_0xb80a('0x33')]);_0x470755[_0xb80a('0x34')]=qs['filters'](_[_0xb80a('0x35')](_0x31c2cc[_0xb80a('0x2b')],_0x240c35[_0xb80a('0x2d')]),_0x4224d7);if(_0x31c2cc[_0xb80a('0x2b')]['filter']){_0x470755[_0xb80a('0x34')]=_['merge'](_0x470755[_0xb80a('0x34')],{'$or':_[_0xb80a('0x26')](_0x4224d7,function(_0x9482a){if(_0x9482a[_0xb80a('0x29')]!=='VIRTUAL'){var _0x4fcaca={};_0x4fcaca[_0x9482a[_0xb80a('0x23')]]={'$like':'%'+_0x31c2cc[_0xb80a('0x2b')][_0xb80a('0x36')]+'%'};return _0x4fcaca;}})});}_0x470755=_['merge']({},_0x470755,_0x31c2cc['options']);var _0x290642={'where':_0x470755[_0xb80a('0x34')]};return db[_0xb80a('0x27')][_0xb80a('0x19')](_0x290642)[_0xb80a('0x1f')](function(_0x281f29){_0x1677c5['count']=_0x281f29;if(_0x31c2cc[_0xb80a('0x2b')]['includeAll']){_0x470755['include']=[{'all':!![]}];}return db[_0xb80a('0x27')]['findAll'](_0x470755);})[_0xb80a('0x1f')](function(_0x188194){_0x1677c5[_0xb80a('0x37')]=_0x188194;return _0x1677c5;})[_0xb80a('0x1f')](respondWithFilteredResult(_0x3ba8ae,_0x470755))['catch'](handleError(_0x3ba8ae,null));};exports[_0xb80a('0x38')]=function(_0x523b97,_0x28f897){var _0x4a500d={'raw':![],'where':{'id':_0x523b97[_0xb80a('0x39')]['id']}},_0x2c3a17={};_0x2c3a17[_0xb80a('0x30')]=_[_0xb80a('0x2c')](db[_0xb80a('0x27')][_0xb80a('0x28')]);_0x2c3a17['query']=_['keys'](_0x523b97[_0xb80a('0x2b')]);_0x2c3a17[_0xb80a('0x2d')]=_['intersection'](_0x2c3a17[_0xb80a('0x30')],_0x2c3a17[_0xb80a('0x2b')]);_0x4a500d[_0xb80a('0x2f')]=_['intersection'](_0x2c3a17['model'],qs[_0xb80a('0x3a')](_0x523b97[_0xb80a('0x2b')]['fields']));_0x4a500d['attributes']=_0x4a500d[_0xb80a('0x2f')][_0xb80a('0x3b')]?_0x4a500d['attributes']:_0x2c3a17[_0xb80a('0x30')];if(_0x523b97[_0xb80a('0x2b')][_0xb80a('0x3c')]){_0x4a500d[_0xb80a('0x3d')]=[{'all':!![]}];}_0x4a500d=_['merge']({},_0x4a500d,_0x523b97[_0xb80a('0x3e')]);return db[_0xb80a('0x27')]['find'](_0x4a500d)[_0xb80a('0x1f')](handleEntityNotFound(_0x28f897,null))['then'](respondWithResult(_0x28f897,null))[_0xb80a('0x3f')](handleError(_0x28f897,null));};exports['create']=function(_0x24806b,_0x51d4ff){return db[_0xb80a('0x27')][_0xb80a('0x40')](_0x24806b[_0xb80a('0x41')],{})[_0xb80a('0x1f')](respondWithResult(_0x51d4ff,0xc9))[_0xb80a('0x3f')](handleError(_0x51d4ff,null));};exports[_0xb80a('0x1e')]=function(_0x528b15,_0x31161f){if(_0x528b15['body']['id']){delete _0x528b15[_0xb80a('0x41')]['id'];}return db['ZendeskConfiguration'][_0xb80a('0x42')]({'where':{'id':_0x528b15[_0xb80a('0x39')]['id']}})[_0xb80a('0x1f')](handleEntityNotFound(_0x31161f,null))[_0xb80a('0x1f')](saveUpdates(_0x528b15[_0xb80a('0x41')],null))['then'](respondWithResult(_0x31161f,null))[_0xb80a('0x3f')](handleError(_0x31161f,null));};exports[_0xb80a('0x20')]=function(_0x27a028,_0xe07fd6){return db[_0xb80a('0x27')][_0xb80a('0x42')]({'where':{'id':_0x27a028['params']['id']}})[_0xb80a('0x1f')](handleEntityNotFound(_0xe07fd6,null))[_0xb80a('0x1f')](removeEntity(_0xe07fd6,null))[_0xb80a('0x3f')](handleError(_0xe07fd6,null));};exports[_0xb80a('0x43')]=function(_0x4c8556,_0x185025,_0x4fa653){var _0x135be9={};var _0x5ac6ef={};var _0x30855d;var _0x23e552;return db[_0xb80a('0x27')][_0xb80a('0x44')]({'where':{'id':_0x4c8556['params']['id']}})[_0xb80a('0x1f')](handleEntityNotFound(_0x185025,null))[_0xb80a('0x1f')](function(_0xa44388){if(_0xa44388){_0x30855d=_0xa44388;_0x5ac6ef[_0xb80a('0x30')]=_[_0xb80a('0x2c')](db['ZendeskField'][_0xb80a('0x28')]);_0x5ac6ef[_0xb80a('0x2b')]=_[_0xb80a('0x2c')](_0x4c8556[_0xb80a('0x2b')]);_0x5ac6ef[_0xb80a('0x2d')]=_[_0xb80a('0x2e')](_0x5ac6ef['model'],_0x5ac6ef[_0xb80a('0x2b')]);_0x135be9[_0xb80a('0x2f')]=_[_0xb80a('0x2e')](_0x5ac6ef['model'],qs['fields'](_0x4c8556[_0xb80a('0x2b')][_0xb80a('0x3a')]));_0x135be9[_0xb80a('0x2f')]=_0x135be9[_0xb80a('0x2f')][_0xb80a('0x3b')]?_0x135be9[_0xb80a('0x2f')]:_0x5ac6ef['model'];_0x135be9[_0xb80a('0x32')]=qs[_0xb80a('0x33')](_0x4c8556[_0xb80a('0x2b')][_0xb80a('0x33')]);_0x135be9[_0xb80a('0x34')]=qs[_0xb80a('0x2d')](_[_0xb80a('0x35')](_0x4c8556[_0xb80a('0x2b')],_0x5ac6ef[_0xb80a('0x2d')]));if(_0x4c8556[_0xb80a('0x2b')]['filter']){_0x135be9[_0xb80a('0x34')]=_[_0xb80a('0x45')](_0x135be9['where'],{'$or':_[_0xb80a('0x26')](_0x135be9[_0xb80a('0x2f')],function(_0xcf5df8){var _0x7ebd84={};_0x7ebd84[_0xcf5df8]={'$like':'%'+_0x4c8556[_0xb80a('0x2b')][_0xb80a('0x36')]+'%'};return _0x7ebd84;})});}_0x135be9=_[_0xb80a('0x45')]({},_0x135be9,_0x4c8556[_0xb80a('0x3e')]);return _0x30855d[_0xb80a('0x43')](_0x135be9);}})[_0xb80a('0x1f')](function(_0x7bec9b){if(_0x7bec9b){_0x23e552=_0x7bec9b[_0xb80a('0x3b')];if(!_0x4c8556[_0xb80a('0x2b')]['hasOwnProperty']('nolimit')){_0x135be9[_0xb80a('0x17')]=qs[_0xb80a('0x17')](_0x4c8556['query'][_0xb80a('0x17')]);_0x135be9[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x4c8556['query'][_0xb80a('0x1a')]);}return _0x30855d[_0xb80a('0x43')](_0x135be9);}})[_0xb80a('0x1f')](function(_0x13ffe2){if(_0x13ffe2){return _0x13ffe2?{'count':_0x23e552,'rows':_0x13ffe2}:null;}})[_0xb80a('0x1f')](respondWithResult(_0x185025,null))[_0xb80a('0x3f')](handleError(_0x185025,null));};exports[_0xb80a('0x46')]=function(_0x543514,_0x41c0eb,_0x29601f){var _0x2fc457={};var _0x2664fa={};var _0x286184;var _0x42733e;return db[_0xb80a('0x27')][_0xb80a('0x44')]({'where':{'id':_0x543514['params']['id']}})[_0xb80a('0x1f')](handleEntityNotFound(_0x41c0eb,null))['then'](function(_0x2fe193){if(_0x2fe193){_0x286184=_0x2fe193;_0x2664fa[_0xb80a('0x30')]=_[_0xb80a('0x2c')](db[_0xb80a('0x47')]['rawAttributes']);_0x2664fa[_0xb80a('0x2b')]=_[_0xb80a('0x2c')](_0x543514[_0xb80a('0x2b')]);_0x2664fa[_0xb80a('0x2d')]=_[_0xb80a('0x2e')](_0x2664fa[_0xb80a('0x30')],_0x2664fa['query']);_0x2fc457['attributes']=_[_0xb80a('0x2e')](_0x2664fa['model'],qs['fields'](_0x543514[_0xb80a('0x2b')][_0xb80a('0x3a')]));_0x2fc457[_0xb80a('0x2f')]=_0x2fc457[_0xb80a('0x2f')][_0xb80a('0x3b')]?_0x2fc457['attributes']:_0x2664fa['model'];_0x2fc457[_0xb80a('0x32')]=qs[_0xb80a('0x33')](_0x543514[_0xb80a('0x2b')][_0xb80a('0x33')]);_0x2fc457[_0xb80a('0x34')]=qs[_0xb80a('0x2d')](_['pick'](_0x543514['query'],_0x2664fa[_0xb80a('0x2d')]));if(_0x543514[_0xb80a('0x2b')][_0xb80a('0x36')]){_0x2fc457[_0xb80a('0x34')]=_[_0xb80a('0x45')](_0x2fc457[_0xb80a('0x34')],{'$or':_[_0xb80a('0x26')](_0x2fc457[_0xb80a('0x2f')],function(_0x167e8c){var _0x58bc51={};_0x58bc51[_0x167e8c]={'$like':'%'+_0x543514['query'][_0xb80a('0x36')]+'%'};return _0x58bc51;})});}_0x2fc457=_[_0xb80a('0x45')]({},_0x2fc457,_0x543514[_0xb80a('0x3e')]);return _0x286184[_0xb80a('0x46')](_0x2fc457);}})[_0xb80a('0x1f')](function(_0x59978f){if(_0x59978f){_0x42733e=_0x59978f[_0xb80a('0x3b')];if(!_0x543514[_0xb80a('0x2b')][_0xb80a('0x31')](_0xb80a('0x48'))){_0x2fc457[_0xb80a('0x17')]=qs[_0xb80a('0x17')](_0x543514[_0xb80a('0x2b')][_0xb80a('0x17')]);_0x2fc457[_0xb80a('0x1a')]=qs['offset'](_0x543514[_0xb80a('0x2b')][_0xb80a('0x1a')]);}return _0x286184[_0xb80a('0x46')](_0x2fc457);}})[_0xb80a('0x1f')](function(_0x572e92){if(_0x572e92){return _0x572e92?{'count':_0x42733e,'rows':_0x572e92}:null;}})['then'](respondWithResult(_0x41c0eb,null))[_0xb80a('0x3f')](handleError(_0x41c0eb,null));};exports['getDescriptions']=function(_0x4f692c,_0x3a5318,_0x522fce){var _0x23372f={};var _0x352810={};var _0x3c1d06;var _0x37df19;return db[_0xb80a('0x27')][_0xb80a('0x44')]({'where':{'id':_0x4f692c['params']['id']}})['then'](handleEntityNotFound(_0x3a5318,null))[_0xb80a('0x1f')](function(_0x3bfdab){if(_0x3bfdab){_0x3c1d06=_0x3bfdab;_0x352810['model']=_[_0xb80a('0x2c')](db[_0xb80a('0x47')][_0xb80a('0x28')]);_0x352810['query']=_['keys'](_0x4f692c[_0xb80a('0x2b')]);_0x352810[_0xb80a('0x2d')]=_[_0xb80a('0x2e')](_0x352810['model'],_0x352810[_0xb80a('0x2b')]);_0x23372f[_0xb80a('0x2f')]=_['intersection'](_0x352810[_0xb80a('0x30')],qs[_0xb80a('0x3a')](_0x4f692c['query']['fields']));_0x23372f[_0xb80a('0x2f')]=_0x23372f[_0xb80a('0x2f')][_0xb80a('0x3b')]?_0x23372f[_0xb80a('0x2f')]:_0x352810['model'];_0x23372f[_0xb80a('0x32')]=qs[_0xb80a('0x33')](_0x4f692c[_0xb80a('0x2b')][_0xb80a('0x33')]);_0x23372f[_0xb80a('0x34')]=qs[_0xb80a('0x2d')](_[_0xb80a('0x35')](_0x4f692c[_0xb80a('0x2b')],_0x352810[_0xb80a('0x2d')]));if(_0x4f692c[_0xb80a('0x2b')][_0xb80a('0x36')]){_0x23372f[_0xb80a('0x34')]=_[_0xb80a('0x45')](_0x23372f[_0xb80a('0x34')],{'$or':_['map'](_0x23372f[_0xb80a('0x2f')],function(_0x5920de){var _0x489514={};_0x489514[_0x5920de]={'$like':'%'+_0x4f692c['query'][_0xb80a('0x36')]+'%'};return _0x489514;})});}_0x23372f=_[_0xb80a('0x45')]({},_0x23372f,_0x4f692c[_0xb80a('0x3e')]);return _0x3c1d06[_0xb80a('0x49')](_0x23372f);}})[_0xb80a('0x1f')](function(_0x502106){if(_0x502106){_0x37df19=_0x502106['length'];if(!_0x4f692c[_0xb80a('0x2b')][_0xb80a('0x31')]('nolimit')){_0x23372f[_0xb80a('0x17')]=qs['limit'](_0x4f692c[_0xb80a('0x2b')][_0xb80a('0x17')]);_0x23372f['offset']=qs[_0xb80a('0x1a')](_0x4f692c[_0xb80a('0x2b')][_0xb80a('0x1a')]);}return _0x3c1d06['getDescriptions'](_0x23372f);}})[_0xb80a('0x1f')](function(_0x5ef593){if(_0x5ef593){return _0x5ef593?{'count':_0x37df19,'rows':_0x5ef593}:null;}})[_0xb80a('0x1f')](respondWithResult(_0x3a5318,null))['catch'](handleError(_0x3a5318,null));};exports[_0xb80a('0x4a')]=function(_0x51e7a6,_0x1f2e6a,_0x1fda5a){var _0xf0145b={};var _0x4be703={};var _0x2b7c83;var _0x186c83;return db[_0xb80a('0x27')][_0xb80a('0x44')]({'where':{'id':_0x51e7a6[_0xb80a('0x39')]['id']}})['then'](handleEntityNotFound(_0x1f2e6a,null))['then'](function(_0x177008){if(_0x177008){_0x2b7c83=_0x177008;_0x4be703[_0xb80a('0x30')]=_[_0xb80a('0x2c')](db[_0xb80a('0x4b')][_0xb80a('0x28')]);_0x4be703[_0xb80a('0x2b')]=_[_0xb80a('0x2c')](_0x51e7a6[_0xb80a('0x2b')]);_0x4be703[_0xb80a('0x2d')]=_[_0xb80a('0x2e')](_0x4be703['model'],_0x4be703[_0xb80a('0x2b')]);_0xf0145b[_0xb80a('0x2f')]=_['intersection'](_0x4be703['model'],qs[_0xb80a('0x3a')](_0x51e7a6[_0xb80a('0x2b')][_0xb80a('0x3a')]));_0xf0145b['attributes']=_0xf0145b[_0xb80a('0x2f')][_0xb80a('0x3b')]?_0xf0145b[_0xb80a('0x2f')]:_0x4be703[_0xb80a('0x30')];_0xf0145b[_0xb80a('0x32')]=qs[_0xb80a('0x33')](_0x51e7a6['query']['sort']);_0xf0145b['where']=qs['filters'](_[_0xb80a('0x35')](_0x51e7a6[_0xb80a('0x2b')],_0x4be703[_0xb80a('0x2d')]));if(_0x51e7a6['query']['filter']){_0xf0145b[_0xb80a('0x34')]=_[_0xb80a('0x45')](_0xf0145b['where'],{'$or':_[_0xb80a('0x26')](_0xf0145b['attributes'],function(_0x786c6d){var _0x159eb3={};_0x159eb3[_0x786c6d]={'$like':'%'+_0x51e7a6[_0xb80a('0x2b')][_0xb80a('0x36')]+'%'};return _0x159eb3;})});}_0xf0145b=_[_0xb80a('0x45')]({},_0xf0145b,_0x51e7a6[_0xb80a('0x3e')]);return _0x2b7c83[_0xb80a('0x4a')](_0xf0145b);}})['then'](function(_0x143f0d){if(_0x143f0d){_0x186c83=_0x143f0d['length'];if(!_0x51e7a6[_0xb80a('0x2b')]['hasOwnProperty']('nolimit')){_0xf0145b[_0xb80a('0x17')]=qs[_0xb80a('0x17')](_0x51e7a6[_0xb80a('0x2b')]['limit']);_0xf0145b[_0xb80a('0x1a')]=qs['offset'](_0x51e7a6[_0xb80a('0x2b')][_0xb80a('0x1a')]);}return _0x2b7c83[_0xb80a('0x4a')](_0xf0145b);}})['then'](function(_0x562064){if(_0x562064){return _0x562064?{'count':_0x186c83,'rows':_0x562064}:null;}})['then'](respondWithResult(_0x1f2e6a,null))[_0xb80a('0x3f')](handleError(_0x1f2e6a,null));};exports[_0xb80a('0x4c')]=function(_0xbd624,_0x92d54c,_0x5aecaa){if(_0xbd624[_0xb80a('0x41')]['id']){delete _0xbd624[_0xb80a('0x41')]['id'];}return db[_0xb80a('0x27')][_0xb80a('0x44')]({'where':{'id':_0xbd624[_0xb80a('0x39')]['id']}})[_0xb80a('0x1f')](handleEntityNotFound(_0x92d54c,null))[_0xb80a('0x1f')](function(_0x184d96){if(_0x184d96){return _0x184d96[_0xb80a('0x4c')](_0xbd624[_0xb80a('0x41')][_0xb80a('0x4d')]||[]);}return null;})[_0xb80a('0x1f')](respondWithResult(_0x92d54c,null))[_0xb80a('0x3f')](handleError(_0x92d54c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 4e12cad..133a9b0 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 _0xb574=['./intZendeskConfiguration.attributes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x18088b,_0x210323){var _0x4f5f1f=function(_0x5d7e57){while(--_0x5d7e57){_0x18088b['push'](_0x18088b['shift']());}};_0x4f5f1f(++_0x210323);}(_0xb574,0x106));var _0x4b57=function(_0x3adbdc,_0x247a7d){_0x3adbdc=_0x3adbdc-0x0;var _0x4dc6ce=_0xb574[_0x3adbdc];return _0x4dc6ce;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x300d13,_0x412659){var _0x39541d=function(_0x4dd523){while(--_0x4dd523){_0x300d13['push'](_0x300d13['shift']());}};_0x39541d(++_0x412659);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x5820ac,_0x3f0a72){_0x5820ac=_0x5820ac-0x0;var _0xae88c7=_0xe1e3[_0x5820ac];return _0xae88c7;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 45d4a42..45b1cb5 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 _0x5f5f=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x5f5f,0x130));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5f5('0x0'));var util=require(_0xf5f5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf5f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5f5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5f5('0x4'))(_0xf5f5('0x5'));var config=require('../../config/environment');var jayson=require(_0xf5f5('0x6'));var client=jayson[_0xf5f5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1325a4,_0x31776b,_0x40b0ef){return new BPromise(function(_0x5dd33c,_0x34b8ae){return client[_0xf5f5('0x8')](_0x1325a4,_0x40b0ef)['then'](function(_0x1c4f74){logger[_0xf5f5('0x9')](_0xf5f5('0xa'),_0x31776b,_0xf5f5('0xb'));logger[_0xf5f5('0xc')](_0xf5f5('0xd'),_0x31776b,_0xf5f5('0xb'),JSON[_0xf5f5('0xe')](_0x1c4f74));if(_0x1c4f74[_0xf5f5('0xf')]){if(_0x1c4f74['error'][_0xf5f5('0x10')]===0x1f4){logger[_0xf5f5('0xf')](_0xf5f5('0xa'),_0x31776b,_0x1c4f74[_0xf5f5('0xf')]['message']);return _0x34b8ae(_0x1c4f74[_0xf5f5('0xf')][_0xf5f5('0x11')]);}logger[_0xf5f5('0xf')](_0xf5f5('0xa'),_0x31776b,_0x1c4f74['error'][_0xf5f5('0x11')]);return _0x5dd33c(_0x1c4f74['error']['message']);}else{logger['info'](_0xf5f5('0xa'),_0x31776b,_0xf5f5('0xb'));_0x5dd33c(_0x1c4f74[_0xf5f5('0x12')][_0xf5f5('0x11')]);}})[_0xf5f5('0x13')](function(_0x4d7935){logger[_0xf5f5('0xf')](_0xf5f5('0xa'),_0x31776b,_0x4d7935);_0x34b8ae(_0x4d7935);});});} \ No newline at end of file +var _0x7425=['stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3accdb,_0x187888){var _0x4dab57=function(_0x2ac22b){while(--_0x2ac22b){_0x3accdb['push'](_0x3accdb['shift']());}};_0x4dab57(++_0x187888);}(_0x7425,0x65));var _0x5742=function(_0x2474a5,_0x421c0a){_0x2474a5=_0x2474a5-0x0;var _0x30fdc2=_0x7425[_0x2474a5];return _0x30fdc2;};'use strict';var _=require(_0x5742('0x0'));var util=require('util');var moment=require(_0x5742('0x1'));var BPromise=require(_0x5742('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5742('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5742('0x4'));var logger=require('../../config/logger')(_0x5742('0x5'));var config=require(_0x5742('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5742('0x7')][_0x5742('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5616f4,_0x198289,_0x856fbb){return new BPromise(function(_0x12d59a,_0x464216){return client['request'](_0x5616f4,_0x856fbb)['then'](function(_0x1cb31e){logger[_0x5742('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x198289,_0x5742('0xa'));logger[_0x5742('0xb')](_0x5742('0xc'),_0x198289,_0x5742('0xa'),JSON[_0x5742('0xd')](_0x1cb31e));if(_0x1cb31e[_0x5742('0xe')]){if(_0x1cb31e[_0x5742('0xe')]['code']===0x1f4){logger[_0x5742('0xe')](_0x5742('0xf'),_0x198289,_0x1cb31e[_0x5742('0xe')]['message']);return _0x464216(_0x1cb31e['error'][_0x5742('0x10')]);}logger[_0x5742('0xe')](_0x5742('0xf'),_0x198289,_0x1cb31e[_0x5742('0xe')][_0x5742('0x10')]);return _0x12d59a(_0x1cb31e['error'][_0x5742('0x10')]);}else{logger[_0x5742('0x9')](_0x5742('0xf'),_0x198289,_0x5742('0xa'));_0x12d59a(_0x1cb31e[_0x5742('0x11')][_0x5742('0x10')]);}})[_0x5742('0x12')](function(_0x435433){logger['error'](_0x5742('0xf'),_0x198289,_0x435433);_0x464216(_0x435433);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d26f066..2854c24 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 _0xef70=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xef70,0x13d));var _0x0ef7=function(_0x21c749,_0x13a0f7){_0x21c749=_0x21c749-0x0;var _0x3ed5c4=_0xef70[_0x21c749];return _0x3ed5c4;};'use strict';var multer=require(_0x0ef7('0x0'));var util=require(_0x0ef7('0x1'));var path=require(_0x0ef7('0x2'));var timeout=require(_0x0ef7('0x3'));var express=require(_0x0ef7('0x4'));var router=express[_0x0ef7('0x5')]();var fs_extra=require(_0x0ef7('0x6'));var auth=require(_0x0ef7('0x7'));var interaction=require(_0x0ef7('0x8'));var config=require(_0x0ef7('0x9'));var controller=require(_0x0ef7('0xa'));router[_0x0ef7('0xb')]('/',auth[_0x0ef7('0xc')](),controller['index']);router[_0x0ef7('0xb')](_0x0ef7('0xd'),auth[_0x0ef7('0xc')](),controller['show']);router[_0x0ef7('0xe')]('/',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0xf')]);router[_0x0ef7('0x10')](_0x0ef7('0xd'),auth[_0x0ef7('0xc')](),controller['update']);router[_0x0ef7('0x11')]('/:id',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0x12')]);module[_0x0ef7('0x13')]=router; \ No newline at end of file +var _0x5787=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x5787,0x92));var _0x7578=function(_0x536409,_0x4e3a13){_0x536409=_0x536409-0x0;var _0x2cc36a=_0x5787[_0x536409];return _0x2cc36a;};'use strict';var multer=require(_0x7578('0x0'));var util=require(_0x7578('0x1'));var path=require(_0x7578('0x2'));var timeout=require('connect-timeout');var express=require(_0x7578('0x3'));var router=express['Router']();var fs_extra=require(_0x7578('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7578('0x5'));var config=require(_0x7578('0x6'));var controller=require('./intZendeskField.controller');router[_0x7578('0x7')]('/',auth[_0x7578('0x8')](),controller[_0x7578('0x9')]);router[_0x7578('0x7')](_0x7578('0xa'),auth['isAuthenticated'](),controller[_0x7578('0xb')]);router[_0x7578('0xc')]('/',auth[_0x7578('0x8')](),controller['create']);router[_0x7578('0xd')](_0x7578('0xa'),auth[_0x7578('0x8')](),controller[_0x7578('0xe')]);router['delete']('/:id',auth[_0x7578('0x8')](),controller[_0x7578('0xf')]);module[_0x7578('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 23d2bfe..0edce61 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 _0x2291=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0xd118a2,_0x39db74){var _0x18c67a=function(_0x263e30){while(--_0x263e30){_0xd118a2['push'](_0xd118a2['shift']());}};_0x18c67a(++_0x39db74);}(_0x2291,0xd4));var _0x1229=function(_0x5d4f35,_0x20b13e){_0x5d4f35=_0x5d4f35-0x0;var _0x5c59bc=_0x2291[_0x5d4f35];return _0x5c59bc;};'use strict';var Sequelize=require(_0x1229('0x0'));module[_0x1229('0x1')]={'type':{'type':Sequelize[_0x1229('0x2')]('string',_0x1229('0x3'),_0x1229('0x4'),_0x1229('0x5'),'picklist'),'defaultValue':_0x1229('0x6')},'content':{'type':Sequelize[_0x1229('0x7')]},'key':{'type':Sequelize[_0x1229('0x7')]},'keyType':{'type':Sequelize[_0x1229('0x2')](_0x1229('0x6'),_0x1229('0x3'),_0x1229('0x4'))},'keyContent':{'type':Sequelize[_0x1229('0x7')]},'idField':{'type':Sequelize[_0x1229('0x7')]},'nameField':{'type':Sequelize[_0x1229('0x7')]},'customField':{'type':Sequelize[_0x1229('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7dec=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x255d77,_0xea430c){var _0x48a519=function(_0x5c8b4b){while(--_0x5c8b4b){_0x255d77['push'](_0x255d77['shift']());}};_0x48a519(++_0xea430c);}(_0x7dec,0xa4));var _0xc7de=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x7dec[_0x817d9b];return _0x2752e1;};'use strict';var Sequelize=require(_0xc7de('0x0'));module[_0xc7de('0x1')]={'type':{'type':Sequelize[_0xc7de('0x2')](_0xc7de('0x3'),_0xc7de('0x4'),_0xc7de('0x5'),_0xc7de('0x6'),_0xc7de('0x7')),'defaultValue':_0xc7de('0x3')},'content':{'type':Sequelize[_0xc7de('0x8')]},'key':{'type':Sequelize[_0xc7de('0x8')]},'keyType':{'type':Sequelize[_0xc7de('0x2')]('string',_0xc7de('0x4'),_0xc7de('0x5'))},'keyContent':{'type':Sequelize[_0xc7de('0x8')]},'idField':{'type':Sequelize[_0xc7de('0x8')]},'nameField':{'type':Sequelize[_0xc7de('0x8')]},'customField':{'type':Sequelize[_0xc7de('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc7de('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 06b81bc..89d3537 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 _0xdba7=['status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x138396,_0x292e62){var _0x3e024e=function(_0x1dfc0d){while(--_0x1dfc0d){_0x138396['push'](_0x138396['shift']());}};_0x3e024e(++_0x292e62);}(_0xdba7,0x125));var _0x7dba=function(_0x250894,_0x52694e){_0x250894=_0x250894-0x0;var _0x5184dc=_0xdba7[_0x250894];return _0x5184dc;};'use strict';var emlformat=require(_0x7dba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7dba('0x1'));var rp=require(_0x7dba('0x2'));var moment=require(_0x7dba('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7dba('0x4'));var util=require(_0x7dba('0x5'));var path=require(_0x7dba('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7dba('0x7'));var fs=require('fs');var fs_extra=require(_0x7dba('0x8'));var _=require(_0x7dba('0x9'));var squel=require(_0x7dba('0xa'));var crypto=require(_0x7dba('0xb'));var jsforce=require(_0x7dba('0xc'));var deskjs=require(_0x7dba('0xd'));var toCsv=require(_0x7dba('0xe'));var querystring=require(_0x7dba('0xf'));var Papa=require(_0x7dba('0x10'));var Redis=require(_0x7dba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7dba('0x12'));var as=require(_0x7dba('0x13'));var hardwareService=require(_0x7dba('0x14'));var logger=require(_0x7dba('0x15'))(_0x7dba('0x16'));var utils=require(_0x7dba('0x17'));var config=require(_0x7dba('0x18'));var licenseUtil=require(_0x7dba('0x19'));var db=require(_0x7dba('0x1a'))['db'];function respondWithStatusCode(_0x25439a,_0x1d3c8d){_0x1d3c8d=_0x1d3c8d||0xcc;return function(_0x17d431){if(_0x17d431){return _0x25439a['sendStatus'](_0x1d3c8d);}return _0x25439a[_0x7dba('0x1b')](_0x1d3c8d)[_0x7dba('0x1c')]();};}function respondWithResult(_0x1fea5c,_0x56ebe4){_0x56ebe4=_0x56ebe4||0xc8;return function(_0x442b92){if(_0x442b92){return _0x1fea5c[_0x7dba('0x1b')](_0x56ebe4)['json'](_0x442b92);}};}function respondWithFilteredResult(_0x13e7d0,_0x1da758){return function(_0x28a92b){if(_0x28a92b){var _0x2a33bb=typeof _0x1da758[_0x7dba('0x1d')]===_0x7dba('0x1e')&&typeof _0x1da758[_0x7dba('0x1f')]===_0x7dba('0x1e');var _0x44b6a2=_0x28a92b[_0x7dba('0x20')];var _0xff6f10=_0x2a33bb?0x0:_0x1da758[_0x7dba('0x1d')];var _0x10914f=_0x2a33bb?_0x28a92b[_0x7dba('0x20')]:_0x1da758[_0x7dba('0x1d')]+_0x1da758[_0x7dba('0x1f')];var _0x599cf6;if(_0x10914f>=_0x44b6a2){_0x10914f=_0x44b6a2;_0x599cf6=0xc8;}else{_0x599cf6=0xce;}_0x13e7d0[_0x7dba('0x1b')](_0x599cf6);return _0x13e7d0[_0x7dba('0x21')](_0x7dba('0x22'),_0xff6f10+'-'+_0x10914f+'/'+_0x44b6a2)[_0x7dba('0x23')](_0x28a92b);}return null;};}function patchUpdates(_0x3feb49){return function(_0xf6b888){try{jsonpatch[_0x7dba('0x24')](_0xf6b888,_0x3feb49,!![]);}catch(_0x5a7a3c){return BPromise[_0x7dba('0x25')](_0x5a7a3c);}return _0xf6b888[_0x7dba('0x26')]();};}function saveUpdates(_0x1d6543,_0x20b81b){return function(_0x348f6e){if(_0x348f6e){return _0x348f6e[_0x7dba('0x27')](_0x1d6543)['then'](function(_0x6cae2d){return _0x6cae2d;});}return null;};}function removeEntity(_0x8a3fb4,_0x228cb8){return function(_0x34f964){if(_0x34f964){return _0x34f964[_0x7dba('0x28')]()['then'](function(){_0x8a3fb4['status'](0xcc)[_0x7dba('0x1c')]();});}};}function handleEntityNotFound(_0x161283,_0x518df2){return function(_0x11033e){if(!_0x11033e){_0x161283[_0x7dba('0x29')](0x194);}return _0x11033e;};}function handleError(_0x45d9a9,_0x2b848d){_0x2b848d=_0x2b848d||0x1f4;return function(_0x237de5){logger[_0x7dba('0x2a')](_0x237de5[_0x7dba('0x2b')]);if(_0x237de5[_0x7dba('0x2c')]){delete _0x237de5['name'];}_0x45d9a9['status'](_0x2b848d)[_0x7dba('0x2d')](_0x237de5);};}exports['index']=function(_0x212c36,_0x18b557){var _0x36720d={},_0x3ff887={},_0x368b2b={'count':0x0,'rows':[]};var _0x502d77=_[_0x7dba('0x2e')](db[_0x7dba('0x2f')][_0x7dba('0x30')],function(_0xe49409){return{'name':_0xe49409[_0x7dba('0x31')],'type':_0xe49409[_0x7dba('0x32')]['key']};});_0x3ff887[_0x7dba('0x33')]=_[_0x7dba('0x2e')](_0x502d77,'name');_0x3ff887[_0x7dba('0x34')]=_['keys'](_0x212c36[_0x7dba('0x34')]);_0x3ff887[_0x7dba('0x35')]=_[_0x7dba('0x36')](_0x3ff887[_0x7dba('0x33')],_0x3ff887['query']);_0x36720d[_0x7dba('0x37')]=_[_0x7dba('0x36')](_0x3ff887[_0x7dba('0x33')],qs['fields'](_0x212c36['query'][_0x7dba('0x38')]));_0x36720d[_0x7dba('0x37')]=_0x36720d['attributes'][_0x7dba('0x39')]?_0x36720d[_0x7dba('0x37')]:_0x3ff887[_0x7dba('0x33')];if(!_0x212c36[_0x7dba('0x34')][_0x7dba('0x3a')](_0x7dba('0x3b'))){_0x36720d[_0x7dba('0x1f')]=qs[_0x7dba('0x1f')](_0x212c36[_0x7dba('0x34')]['limit']);_0x36720d[_0x7dba('0x1d')]=qs[_0x7dba('0x1d')](_0x212c36[_0x7dba('0x34')][_0x7dba('0x1d')]);}_0x36720d[_0x7dba('0x3c')]=qs[_0x7dba('0x3d')](_0x212c36[_0x7dba('0x34')]['sort']);_0x36720d[_0x7dba('0x3e')]=qs[_0x7dba('0x35')](_[_0x7dba('0x3f')](_0x212c36[_0x7dba('0x34')],_0x3ff887[_0x7dba('0x35')]),_0x502d77);if(_0x212c36['query'][_0x7dba('0x40')]){_0x36720d[_0x7dba('0x3e')]=_[_0x7dba('0x41')](_0x36720d[_0x7dba('0x3e')],{'$or':_[_0x7dba('0x2e')](_0x502d77,function(_0x5aaf98){if(_0x5aaf98[_0x7dba('0x32')]!==_0x7dba('0x42')){var _0x4af8db={};_0x4af8db[_0x5aaf98[_0x7dba('0x2c')]]={'$like':'%'+_0x212c36[_0x7dba('0x34')][_0x7dba('0x40')]+'%'};return _0x4af8db;}})});}_0x36720d=_[_0x7dba('0x41')]({},_0x36720d,_0x212c36[_0x7dba('0x43')]);var _0x4d2a02={'where':_0x36720d[_0x7dba('0x3e')]};return db['ZendeskField']['count'](_0x4d2a02)[_0x7dba('0x44')](function(_0x9df998){_0x368b2b[_0x7dba('0x20')]=_0x9df998;if(_0x212c36[_0x7dba('0x34')][_0x7dba('0x45')]){_0x36720d['include']=[{'all':!![]}];}return db[_0x7dba('0x2f')][_0x7dba('0x46')](_0x36720d);})[_0x7dba('0x44')](function(_0x59e269){_0x368b2b[_0x7dba('0x47')]=_0x59e269;return _0x368b2b;})[_0x7dba('0x44')](respondWithFilteredResult(_0x18b557,_0x36720d))['catch'](handleError(_0x18b557,null));};exports[_0x7dba('0x48')]=function(_0x1da115,_0x2ca808){var _0x59d13c={'raw':!![],'where':{'id':_0x1da115[_0x7dba('0x49')]['id']}},_0x1f5a04={};_0x1f5a04[_0x7dba('0x33')]=_[_0x7dba('0x4a')](db[_0x7dba('0x2f')]['rawAttributes']);_0x1f5a04[_0x7dba('0x34')]=_['keys'](_0x1da115[_0x7dba('0x34')]);_0x1f5a04[_0x7dba('0x35')]=_[_0x7dba('0x36')](_0x1f5a04['model'],_0x1f5a04['query']);_0x59d13c[_0x7dba('0x37')]=_[_0x7dba('0x36')](_0x1f5a04[_0x7dba('0x33')],qs['fields'](_0x1da115[_0x7dba('0x34')]['fields']));_0x59d13c['attributes']=_0x59d13c[_0x7dba('0x37')][_0x7dba('0x39')]?_0x59d13c[_0x7dba('0x37')]:_0x1f5a04[_0x7dba('0x33')];if(_0x1da115[_0x7dba('0x34')]['includeAll']){_0x59d13c[_0x7dba('0x4b')]=[{'all':!![]}];}_0x59d13c=_[_0x7dba('0x41')]({},_0x59d13c,_0x1da115[_0x7dba('0x43')]);return db['ZendeskField'][_0x7dba('0x4c')](_0x59d13c)[_0x7dba('0x44')](handleEntityNotFound(_0x2ca808,null))[_0x7dba('0x44')](respondWithResult(_0x2ca808,null))[_0x7dba('0x4d')](handleError(_0x2ca808,null));};exports[_0x7dba('0x4e')]=function(_0xef01a6,_0x1da0e6){return db[_0x7dba('0x2f')][_0x7dba('0x4e')](_0xef01a6[_0x7dba('0x4f')],{})[_0x7dba('0x44')](respondWithResult(_0x1da0e6,0xc9))[_0x7dba('0x4d')](handleError(_0x1da0e6,null));};exports[_0x7dba('0x27')]=function(_0x40492a,_0x4a3149){if(_0x40492a[_0x7dba('0x4f')]['id']){delete _0x40492a[_0x7dba('0x4f')]['id'];}return db[_0x7dba('0x2f')][_0x7dba('0x4c')]({'where':{'id':_0x40492a[_0x7dba('0x49')]['id']}})[_0x7dba('0x44')](handleEntityNotFound(_0x4a3149,null))[_0x7dba('0x44')](saveUpdates(_0x40492a[_0x7dba('0x4f')],null))[_0x7dba('0x44')](respondWithResult(_0x4a3149,null))[_0x7dba('0x4d')](handleError(_0x4a3149,null));};exports[_0x7dba('0x28')]=function(_0x1ac891,_0x3dd7cd){return db['ZendeskField']['find']({'where':{'id':_0x1ac891[_0x7dba('0x49')]['id']}})[_0x7dba('0x44')](handleEntityNotFound(_0x3dd7cd,null))[_0x7dba('0x44')](removeEntity(_0x3dd7cd,null))[_0x7dba('0x4d')](handleError(_0x3dd7cd,null));}; \ No newline at end of file +var _0x3cec=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','index','ZendeskField','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3b9bfc,_0x19b9f4){var _0x3c5df6=function(_0x5ed983){while(--_0x5ed983){_0x3b9bfc['push'](_0x3b9bfc['shift']());}};_0x3c5df6(++_0x19b9f4);}(_0x3cec,0x1ab));var _0xc3ce=function(_0xc85952,_0x325c13){_0xc85952=_0xc85952-0x0;var _0x1d8b16=_0x3cec[_0xc85952];return _0x1d8b16;};'use strict';var emlformat=require(_0xc3ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3ce('0x1'));var jsonpatch=require(_0xc3ce('0x2'));var rp=require(_0xc3ce('0x3'));var moment=require(_0xc3ce('0x4'));var BPromise=require(_0xc3ce('0x5'));var Mustache=require(_0xc3ce('0x6'));var util=require(_0xc3ce('0x7'));var path=require(_0xc3ce('0x8'));var sox=require('sox');var csv=require(_0xc3ce('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3ce('0xa'));var _=require(_0xc3ce('0xb'));var squel=require(_0xc3ce('0xc'));var crypto=require(_0xc3ce('0xd'));var jsforce=require(_0xc3ce('0xe'));var deskjs=require(_0xc3ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3ce('0x10'));var Papa=require(_0xc3ce('0x11'));var Redis=require('ioredis');var authService=require(_0xc3ce('0x12'));var qs=require(_0xc3ce('0x13'));var as=require(_0xc3ce('0x14'));var hardwareService=require(_0xc3ce('0x15'));var logger=require(_0xc3ce('0x16'))('api');var utils=require(_0xc3ce('0x17'));var config=require(_0xc3ce('0x18'));var licenseUtil=require(_0xc3ce('0x19'));var db=require(_0xc3ce('0x1a'))['db'];function respondWithStatusCode(_0x1764c9,_0x3c707d){_0x3c707d=_0x3c707d||0xcc;return function(_0x1127bb){if(_0x1127bb){return _0x1764c9['sendStatus'](_0x3c707d);}return _0x1764c9[_0xc3ce('0x1b')](_0x3c707d)['end']();};}function respondWithResult(_0x96d02b,_0x2ba71c){_0x2ba71c=_0x2ba71c||0xc8;return function(_0x487c2a){if(_0x487c2a){return _0x96d02b[_0xc3ce('0x1b')](_0x2ba71c)[_0xc3ce('0x1c')](_0x487c2a);}};}function respondWithFilteredResult(_0x40108b,_0x2c176){return function(_0x5a60e3){if(_0x5a60e3){var _0xde273c=typeof _0x2c176[_0xc3ce('0x1d')]==='undefined'&&typeof _0x2c176['limit']===_0xc3ce('0x1e');var _0x10af3b=_0x5a60e3[_0xc3ce('0x1f')];var _0x1ddfc3=_0xde273c?0x0:_0x2c176[_0xc3ce('0x1d')];var _0x423518=_0xde273c?_0x5a60e3[_0xc3ce('0x1f')]:_0x2c176[_0xc3ce('0x1d')]+_0x2c176[_0xc3ce('0x20')];var _0x29b1e8;if(_0x423518>=_0x10af3b){_0x423518=_0x10af3b;_0x29b1e8=0xc8;}else{_0x29b1e8=0xce;}_0x40108b[_0xc3ce('0x1b')](_0x29b1e8);return _0x40108b[_0xc3ce('0x21')](_0xc3ce('0x22'),_0x1ddfc3+'-'+_0x423518+'/'+_0x10af3b)[_0xc3ce('0x1c')](_0x5a60e3);}return null;};}function patchUpdates(_0x5b9132){return function(_0x1cbb2d){try{jsonpatch[_0xc3ce('0x23')](_0x1cbb2d,_0x5b9132,!![]);}catch(_0x40d606){return BPromise[_0xc3ce('0x24')](_0x40d606);}return _0x1cbb2d[_0xc3ce('0x25')]();};}function saveUpdates(_0x5e5f2c,_0x8b3053){return function(_0x1e7ca9){if(_0x1e7ca9){return _0x1e7ca9[_0xc3ce('0x26')](_0x5e5f2c)['then'](function(_0x16b6aa){return _0x16b6aa;});}return null;};}function removeEntity(_0x4f6d7a,_0x5b2f89){return function(_0x428406){if(_0x428406){return _0x428406[_0xc3ce('0x27')]()[_0xc3ce('0x28')](function(){_0x4f6d7a[_0xc3ce('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe48d,_0x1fb5ad){return function(_0x1cea90){if(!_0x1cea90){_0x4fe48d[_0xc3ce('0x29')](0x194);}return _0x1cea90;};}function handleError(_0x3d6761,_0x306156){_0x306156=_0x306156||0x1f4;return function(_0x4b18d3){logger['error'](_0x4b18d3['stack']);if(_0x4b18d3['name']){delete _0x4b18d3[_0xc3ce('0x2a')];}_0x3d6761[_0xc3ce('0x1b')](_0x306156)['send'](_0x4b18d3);};}exports[_0xc3ce('0x2b')]=function(_0x4e77ad,_0x4589fc){var _0x3c8bc3={},_0x60531f={},_0x398622={'count':0x0,'rows':[]};var _0xb834da=_['map'](db[_0xc3ce('0x2c')]['rawAttributes'],function(_0x10513b){return{'name':_0x10513b[_0xc3ce('0x2d')],'type':_0x10513b[_0xc3ce('0x2e')]['key']};});_0x60531f[_0xc3ce('0x2f')]=_['map'](_0xb834da,'name');_0x60531f['query']=_[_0xc3ce('0x30')](_0x4e77ad[_0xc3ce('0x31')]);_0x60531f[_0xc3ce('0x32')]=_[_0xc3ce('0x33')](_0x60531f[_0xc3ce('0x2f')],_0x60531f['query']);_0x3c8bc3['attributes']=_[_0xc3ce('0x33')](_0x60531f[_0xc3ce('0x2f')],qs[_0xc3ce('0x34')](_0x4e77ad[_0xc3ce('0x31')][_0xc3ce('0x34')]));_0x3c8bc3[_0xc3ce('0x35')]=_0x3c8bc3['attributes'][_0xc3ce('0x36')]?_0x3c8bc3['attributes']:_0x60531f[_0xc3ce('0x2f')];if(!_0x4e77ad[_0xc3ce('0x31')][_0xc3ce('0x37')](_0xc3ce('0x38'))){_0x3c8bc3[_0xc3ce('0x20')]=qs[_0xc3ce('0x20')](_0x4e77ad[_0xc3ce('0x31')][_0xc3ce('0x20')]);_0x3c8bc3['offset']=qs['offset'](_0x4e77ad[_0xc3ce('0x31')][_0xc3ce('0x1d')]);}_0x3c8bc3[_0xc3ce('0x39')]=qs[_0xc3ce('0x3a')](_0x4e77ad[_0xc3ce('0x31')][_0xc3ce('0x3a')]);_0x3c8bc3[_0xc3ce('0x3b')]=qs[_0xc3ce('0x32')](_[_0xc3ce('0x3c')](_0x4e77ad[_0xc3ce('0x31')],_0x60531f[_0xc3ce('0x32')]),_0xb834da);if(_0x4e77ad[_0xc3ce('0x31')][_0xc3ce('0x3d')]){_0x3c8bc3[_0xc3ce('0x3b')]=_[_0xc3ce('0x3e')](_0x3c8bc3[_0xc3ce('0x3b')],{'$or':_[_0xc3ce('0x3f')](_0xb834da,function(_0x3202f6){if(_0x3202f6['type']!==_0xc3ce('0x40')){var _0x2769b6={};_0x2769b6[_0x3202f6['name']]={'$like':'%'+_0x4e77ad['query'][_0xc3ce('0x3d')]+'%'};return _0x2769b6;}})});}_0x3c8bc3=_[_0xc3ce('0x3e')]({},_0x3c8bc3,_0x4e77ad['options']);var _0x493831={'where':_0x3c8bc3['where']};return db[_0xc3ce('0x2c')]['count'](_0x493831)[_0xc3ce('0x28')](function(_0x4c8504){_0x398622['count']=_0x4c8504;if(_0x4e77ad[_0xc3ce('0x31')][_0xc3ce('0x41')]){_0x3c8bc3[_0xc3ce('0x42')]=[{'all':!![]}];}return db[_0xc3ce('0x2c')][_0xc3ce('0x43')](_0x3c8bc3);})['then'](function(_0x3a4e76){_0x398622['rows']=_0x3a4e76;return _0x398622;})[_0xc3ce('0x28')](respondWithFilteredResult(_0x4589fc,_0x3c8bc3))[_0xc3ce('0x44')](handleError(_0x4589fc,null));};exports[_0xc3ce('0x45')]=function(_0x351d25,_0x40f5f9){var _0x2026ad={'raw':!![],'where':{'id':_0x351d25[_0xc3ce('0x46')]['id']}},_0x4582f7={};_0x4582f7['model']=_[_0xc3ce('0x30')](db[_0xc3ce('0x2c')][_0xc3ce('0x47')]);_0x4582f7[_0xc3ce('0x31')]=_[_0xc3ce('0x30')](_0x351d25[_0xc3ce('0x31')]);_0x4582f7['filters']=_[_0xc3ce('0x33')](_0x4582f7['model'],_0x4582f7[_0xc3ce('0x31')]);_0x2026ad[_0xc3ce('0x35')]=_[_0xc3ce('0x33')](_0x4582f7[_0xc3ce('0x2f')],qs[_0xc3ce('0x34')](_0x351d25[_0xc3ce('0x31')][_0xc3ce('0x34')]));_0x2026ad[_0xc3ce('0x35')]=_0x2026ad[_0xc3ce('0x35')][_0xc3ce('0x36')]?_0x2026ad[_0xc3ce('0x35')]:_0x4582f7[_0xc3ce('0x2f')];if(_0x351d25[_0xc3ce('0x31')]['includeAll']){_0x2026ad['include']=[{'all':!![]}];}_0x2026ad=_[_0xc3ce('0x3e')]({},_0x2026ad,_0x351d25['options']);return db[_0xc3ce('0x2c')][_0xc3ce('0x48')](_0x2026ad)[_0xc3ce('0x28')](handleEntityNotFound(_0x40f5f9,null))['then'](respondWithResult(_0x40f5f9,null))[_0xc3ce('0x44')](handleError(_0x40f5f9,null));};exports[_0xc3ce('0x49')]=function(_0x2597dd,_0x212160){return db[_0xc3ce('0x2c')]['create'](_0x2597dd[_0xc3ce('0x4a')],{})[_0xc3ce('0x28')](respondWithResult(_0x212160,0xc9))[_0xc3ce('0x44')](handleError(_0x212160,null));};exports[_0xc3ce('0x26')]=function(_0x5db1e6,_0x53fd78){if(_0x5db1e6['body']['id']){delete _0x5db1e6[_0xc3ce('0x4a')]['id'];}return db[_0xc3ce('0x2c')][_0xc3ce('0x48')]({'where':{'id':_0x5db1e6['params']['id']}})[_0xc3ce('0x28')](handleEntityNotFound(_0x53fd78,null))[_0xc3ce('0x28')](saveUpdates(_0x5db1e6[_0xc3ce('0x4a')],null))['then'](respondWithResult(_0x53fd78,null))[_0xc3ce('0x44')](handleError(_0x53fd78,null));};exports['destroy']=function(_0x558325,_0x579e24){return db[_0xc3ce('0x2c')]['find']({'where':{'id':_0x558325[_0xc3ce('0x46')]['id']}})[_0xc3ce('0x28')](handleEntityNotFound(_0x579e24,null))[_0xc3ce('0x28')](removeEntity(_0x579e24,null))[_0xc3ce('0x44')](handleError(_0x579e24,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 03b48de..c184859 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 _0x6bba=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId'];(function(_0x40f355,_0x27fac0){var _0x1ebb62=function(_0x5e94f4){while(--_0x5e94f4){_0x40f355['push'](_0x40f355['shift']());}};_0x1ebb62(++_0x27fac0);}(_0x6bba,0x7e));var _0xa6bb=function(_0x3b5e32,_0x1e6275){_0x3b5e32=_0x3b5e32-0x0;var _0x3f7670=_0x6bba[_0x3b5e32];return _0x3f7670;};'use strict';var _=require(_0xa6bb('0x0'));var util=require(_0xa6bb('0x1'));var logger=require('../../config/logger')(_0xa6bb('0x2'));var moment=require(_0xa6bb('0x3'));var BPromise=require(_0xa6bb('0x4'));var rp=require(_0xa6bb('0x5'));var fs=require('fs');var path=require(_0xa6bb('0x6'));var rimraf=require('rimraf');var config=require(_0xa6bb('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xa6bb('0x8')]=function(_0x667e05,_0xb2e7a5){return _0x667e05[_0xa6bb('0x9')](_0xa6bb('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xa6bb('0xb'),'fields':[_0xa6bb('0xc'),_0xa6bb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e79=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x34f668,_0x325c6e){var _0x10ce18=function(_0x5ba958){while(--_0x5ba958){_0x34f668['push'](_0x34f668['shift']());}};_0x10ce18(++_0x325c6e);}(_0x2e79,0x16a));var _0x92e7=function(_0x50ed95,_0x138612){_0x50ed95=_0x50ed95-0x0;var _0x4fbfcb=_0x2e79[_0x50ed95];return _0x4fbfcb;};'use strict';var _=require(_0x92e7('0x0'));var util=require('util');var logger=require(_0x92e7('0x1'))(_0x92e7('0x2'));var moment=require(_0x92e7('0x3'));var BPromise=require(_0x92e7('0x4'));var rp=require(_0x92e7('0x5'));var fs=require('fs');var path=require(_0x92e7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x92e7('0x7'));module[_0x92e7('0x8')]=function(_0x297a22,_0x164c68){return _0x297a22[_0x92e7('0x9')](_0x92e7('0xa'),attributes,{'tableName':_0x92e7('0xb'),'paranoid':![],'indexes':[{'name':_0x92e7('0xc'),'fields':[_0x92e7('0xd'),_0x92e7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5945b22..6849b44 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 _0x3a15=['http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5099fd,_0xa0192a){var _0x38ae34=function(_0xd3c30d){while(--_0xd3c30d){_0x5099fd['push'](_0x5099fd['shift']());}};_0x38ae34(++_0xa0192a);}(_0x3a15,0xc7));var _0x53a1=function(_0x5df7e6,_0x12d771){_0x5df7e6=_0x5df7e6-0x0;var _0xfaba1b=_0x3a15[_0x5df7e6];return _0xfaba1b;};'use strict';var _=require(_0x53a1('0x0'));var util=require('util');var moment=require(_0x53a1('0x1'));var BPromise=require(_0x53a1('0x2'));var rs=require(_0x53a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53a1('0x4'))['db'];var utils=require(_0x53a1('0x5'));var logger=require(_0x53a1('0x6'))(_0x53a1('0x7'));var config=require(_0x53a1('0x8'));var jayson=require(_0x53a1('0x9'));var client=jayson[_0x53a1('0xa')][_0x53a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc2a5d7,_0x16e29a,_0x1f180a){return new BPromise(function(_0x1a5dd5,_0x2c244a){return client[_0x53a1('0xc')](_0xc2a5d7,_0x1f180a)[_0x53a1('0xd')](function(_0x45e001){logger['info'](_0x53a1('0xe'),_0x16e29a,_0x53a1('0xf'));logger[_0x53a1('0x10')](_0x53a1('0x11'),_0x16e29a,'request\x20sent',JSON['stringify'](_0x45e001));if(_0x45e001[_0x53a1('0x12')]){if(_0x45e001[_0x53a1('0x12')]['code']===0x1f4){logger[_0x53a1('0x12')](_0x53a1('0xe'),_0x16e29a,_0x45e001['error'][_0x53a1('0x13')]);return _0x2c244a(_0x45e001['error'][_0x53a1('0x13')]);}logger[_0x53a1('0x12')](_0x53a1('0xe'),_0x16e29a,_0x45e001[_0x53a1('0x12')][_0x53a1('0x13')]);return _0x1a5dd5(_0x45e001['error']['message']);}else{logger[_0x53a1('0x14')]('ZendeskField,\x20%s,\x20%s',_0x16e29a,_0x53a1('0xf'));_0x1a5dd5(_0x45e001['result']['message']);}})['catch'](function(_0xb8db19){logger[_0x53a1('0x12')](_0x53a1('0xe'),_0x16e29a,_0xb8db19);_0x2c244a(_0xb8db19);});});} \ No newline at end of file +var _0xb81d=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x10e30e,_0x5189b8){var _0x5729f1=function(_0x473bd8){while(--_0x473bd8){_0x10e30e['push'](_0x10e30e['shift']());}};_0x5729f1(++_0x5189b8);}(_0xb81d,0x95));var _0xdb81=function(_0x310535,_0x2468bf){_0x310535=_0x310535-0x0;var _0x48257e=_0xb81d[_0x310535];return _0x48257e;};'use strict';var _=require(_0xdb81('0x0'));var util=require(_0xdb81('0x1'));var moment=require(_0xdb81('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb81('0x3'));var fs=require('fs');var Redis=require(_0xdb81('0x4'));var db=require(_0xdb81('0x5'))['db'];var utils=require(_0xdb81('0x6'));var logger=require(_0xdb81('0x7'))(_0xdb81('0x8'));var config=require(_0xdb81('0x9'));var jayson=require(_0xdb81('0xa'));var client=jayson[_0xdb81('0xb')][_0xdb81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ef750,_0x1a1829,_0xa99753){return new BPromise(function(_0x3f97dc,_0x1141a9){return client[_0xdb81('0xd')](_0x1ef750,_0xa99753)[_0xdb81('0xe')](function(_0x122edf){logger[_0xdb81('0xf')](_0xdb81('0x10'),_0x1a1829,_0xdb81('0x11'));logger[_0xdb81('0x12')](_0xdb81('0x13'),_0x1a1829,_0xdb81('0x11'),JSON['stringify'](_0x122edf));if(_0x122edf['error']){if(_0x122edf['error']['code']===0x1f4){logger['error'](_0xdb81('0x10'),_0x1a1829,_0x122edf[_0xdb81('0x14')][_0xdb81('0x15')]);return _0x1141a9(_0x122edf[_0xdb81('0x14')][_0xdb81('0x15')]);}logger[_0xdb81('0x14')]('ZendeskField,\x20%s,\x20%s',_0x1a1829,_0x122edf[_0xdb81('0x14')][_0xdb81('0x15')]);return _0x3f97dc(_0x122edf[_0xdb81('0x14')][_0xdb81('0x15')]);}else{logger[_0xdb81('0xf')](_0xdb81('0x10'),_0x1a1829,'request\x20sent');_0x3f97dc(_0x122edf['result'][_0xdb81('0x15')]);}})[_0xdb81('0x16')](function(_0x51c7fb){logger[_0xdb81('0x14')]('ZendeskField,\x20%s,\x20%s',_0x1a1829,_0x51c7fb);_0x1141a9(_0x51c7fb);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9c59515..1718e26 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 _0x4bdb=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x4bdb,0x7f));var _0xb4bd=function(_0x50cec4,_0x3121c3){_0x50cec4=_0x50cec4-0x0;var _0x1f4caa=_0x4bdb[_0x50cec4];return _0x1f4caa;};'use strict';var multer=require(_0xb4bd('0x0'));var util=require(_0xb4bd('0x1'));var path=require(_0xb4bd('0x2'));var timeout=require(_0xb4bd('0x3'));var express=require(_0xb4bd('0x4'));var router=express['Router']();var fs_extra=require(_0xb4bd('0x5'));var auth=require(_0xb4bd('0x6'));var interaction=require(_0xb4bd('0x7'));var config=require(_0xb4bd('0x8'));var controller=require(_0xb4bd('0x9'));router[_0xb4bd('0xa')]('/',auth[_0xb4bd('0xb')](),controller[_0xb4bd('0xc')]);router[_0xb4bd('0xa')](_0xb4bd('0xd'),auth[_0xb4bd('0xb')](),controller[_0xb4bd('0xe')]);router[_0xb4bd('0xa')](_0xb4bd('0xf'),auth[_0xb4bd('0xb')](),controller[_0xb4bd('0x10')]);router[_0xb4bd('0xa')](_0xb4bd('0x11'),auth[_0xb4bd('0xb')](),controller[_0xb4bd('0x12')]);router[_0xb4bd('0x13')]('/',auth[_0xb4bd('0xb')](),controller['create']);router[_0xb4bd('0x13')](_0xb4bd('0xf'),auth['isAuthenticated'](),controller[_0xb4bd('0x14')]);router[_0xb4bd('0x15')](_0xb4bd('0xd'),auth[_0xb4bd('0xb')](),controller['update']);router[_0xb4bd('0x16')](_0xb4bd('0xd'),auth[_0xb4bd('0xb')](),controller[_0xb4bd('0x17')]);module[_0xb4bd('0x18')]=router; \ No newline at end of file +var _0xbfd1=['update','delete','/:id','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xbfd1,0x1bd));var _0x1bfd=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xbfd1[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require(_0x1bfd('0x0'));var path=require(_0x1bfd('0x1'));var timeout=require('connect-timeout');var express=require(_0x1bfd('0x2'));var router=express['Router']();var fs_extra=require(_0x1bfd('0x3'));var auth=require(_0x1bfd('0x4'));var interaction=require(_0x1bfd('0x5'));var config=require(_0x1bfd('0x6'));var controller=require(_0x1bfd('0x7'));router[_0x1bfd('0x8')]('/',auth[_0x1bfd('0x9')](),controller['index']);router['get']('/:id',auth[_0x1bfd('0x9')](),controller[_0x1bfd('0xa')]);router[_0x1bfd('0x8')]('/:id/configurations',auth[_0x1bfd('0x9')](),controller[_0x1bfd('0xb')]);router[_0x1bfd('0x8')](_0x1bfd('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x1bfd('0xd')]('/',auth[_0x1bfd('0x9')](),controller[_0x1bfd('0xe')]);router[_0x1bfd('0xd')]('/:id/configurations',auth[_0x1bfd('0x9')](),controller[_0x1bfd('0xf')]);router[_0x1bfd('0x10')]('/:id',auth[_0x1bfd('0x9')](),controller[_0x1bfd('0x11')]);router[_0x1bfd('0x12')](_0x1bfd('0x13'),auth[_0x1bfd('0x9')](),controller[_0x1bfd('0x14')]);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 5e61c1e..d9e8578 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 _0xd0bb=['exports','STRING','sequelize'];(function(_0x3a9ae6,_0x58a23d){var _0x41b130=function(_0x905aa8){while(--_0x905aa8){_0x3a9ae6['push'](_0x3a9ae6['shift']());}};_0x41b130(++_0x58a23d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x470170,_0x454483){_0x470170=_0x470170-0x0;var _0x2cc1cc=_0xd0bb[_0x470170];return _0x2cc1cc;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd64b=['STRING','sequelize'];(function(_0x184a8c,_0x2fd008){var _0x2a93f8=function(_0x15c7c9){while(--_0x15c7c9){_0x184a8c['push'](_0x184a8c['shift']());}};_0x2a93f8(++_0x2fd008);}(_0xd64b,0xc1));var _0xbd64=function(_0x3cdd7a,_0x266f22){_0x3cdd7a=_0x3cdd7a-0x0;var _0xca7994=_0xd64b[_0x3cdd7a];return _0xca7994;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7d9efc4..992f062 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 _0x6ae0=['nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','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','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','zoho.eu','slice','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x14832f,_0x23174e){var _0x4fd8ef=function(_0x2429de){while(--_0x2429de){_0x14832f['push'](_0x14832f['shift']());}};_0x4fd8ef(++_0x23174e);}(_0x6ae0,0x1da));var _0x06ae=function(_0x517f19,_0x164202){_0x517f19=_0x517f19-0x0;var _0x5acce3=_0x6ae0[_0x517f19];return _0x5acce3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06ae('0x0'));var zipdir=require(_0x06ae('0x1'));var jsonpatch=require(_0x06ae('0x2'));var rp=require('request-promise');var moment=require(_0x06ae('0x3'));var BPromise=require(_0x06ae('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x06ae('0x5'));var sox=require(_0x06ae('0x6'));var csv=require(_0x06ae('0x7'));var ejs=require(_0x06ae('0x8'));var fs=require('fs');var fs_extra=require(_0x06ae('0x9'));var _=require(_0x06ae('0xa'));var squel=require('squel');var crypto=require(_0x06ae('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x06ae('0xc'));var toCsv=require(_0x06ae('0x7'));var querystring=require(_0x06ae('0xd'));var Papa=require('papaparse');var Redis=require(_0x06ae('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x06ae('0xf'));var as=require(_0x06ae('0x10'));var hardwareService=require(_0x06ae('0x11'));var logger=require(_0x06ae('0x12'))(_0x06ae('0x13'));var utils=require('../../config/utils');var config=require(_0x06ae('0x14'));var licenseUtil=require(_0x06ae('0x15'));var db=require(_0x06ae('0x16'))['db'];var integrations=require(_0x06ae('0x17'));function respondWithStatusCode(_0x327243,_0x3968ab){_0x3968ab=_0x3968ab||0xcc;return function(_0x2fd541){if(_0x2fd541){return _0x327243[_0x06ae('0x18')](_0x3968ab);}return _0x327243[_0x06ae('0x19')](_0x3968ab)[_0x06ae('0x1a')]();};}function respondWithResult(_0x2eb7ad,_0x13101d){_0x13101d=_0x13101d||0xc8;return function(_0x37e7e2){if(_0x37e7e2){return _0x2eb7ad['status'](_0x13101d)['json'](_0x37e7e2);}};}function respondWithFilteredResult(_0x2cd675,_0x389387){return function(_0x23cdf9){if(_0x23cdf9){var _0x552b3c=typeof _0x389387[_0x06ae('0x1b')]===_0x06ae('0x1c')&&typeof _0x389387[_0x06ae('0x1d')]===_0x06ae('0x1c');var _0x4ff711=_0x23cdf9[_0x06ae('0x1e')];var _0xdc5dca=_0x552b3c?0x0:_0x389387[_0x06ae('0x1b')];var _0x155833=_0x552b3c?_0x23cdf9[_0x06ae('0x1e')]:_0x389387['offset']+_0x389387[_0x06ae('0x1d')];var _0x2d43a2;if(_0x155833>=_0x4ff711){_0x155833=_0x4ff711;_0x2d43a2=0xc8;}else{_0x2d43a2=0xce;}_0x2cd675[_0x06ae('0x19')](_0x2d43a2);return _0x2cd675[_0x06ae('0x1f')](_0x06ae('0x20'),_0xdc5dca+'-'+_0x155833+'/'+_0x4ff711)[_0x06ae('0x21')](_0x23cdf9);}return null;};}function patchUpdates(_0x3216e6){return function(_0x549306){try{jsonpatch['apply'](_0x549306,_0x3216e6,!![]);}catch(_0x2ef7a3){return BPromise[_0x06ae('0x22')](_0x2ef7a3);}return _0x549306[_0x06ae('0x23')]();};}function saveUpdates(_0xbe53fa,_0x16f5e1){return function(_0x32b69b){if(_0x32b69b){return _0x32b69b[_0x06ae('0x24')](_0xbe53fa)[_0x06ae('0x25')](function(_0x317e4b){return _0x317e4b;});}return null;};}function removeEntity(_0x4d0239,_0x204694){return function(_0x3f3080){if(_0x3f3080){return _0x3f3080[_0x06ae('0x26')]()[_0x06ae('0x25')](function(){_0x4d0239[_0x06ae('0x19')](0xcc)[_0x06ae('0x1a')]();});}};}function handleEntityNotFound(_0x23feed,_0x2fc9ad){return function(_0x278daa){if(!_0x278daa){_0x23feed[_0x06ae('0x18')](0x194);}return _0x278daa;};}function handleError(_0x24f067,_0x221964){_0x221964=_0x221964||0x1f4;return function(_0x2f6d6f){logger[_0x06ae('0x27')](_0x2f6d6f[_0x06ae('0x28')]);if(_0x2f6d6f[_0x06ae('0x29')]){delete _0x2f6d6f['name'];}_0x24f067['status'](_0x221964)[_0x06ae('0x2a')](_0x2f6d6f);};}exports[_0x06ae('0x2b')]=function(_0xee3d41,_0x57d793){var _0x14c9d6={},_0x4c2ebb={},_0x37202e={'count':0x0,'rows':[]};var _0x13c668=_['map'](db[_0x06ae('0x2c')][_0x06ae('0x2d')],function(_0x3c8f8f){return{'name':_0x3c8f8f[_0x06ae('0x2e')],'type':_0x3c8f8f[_0x06ae('0x2f')][_0x06ae('0x30')]};});_0x4c2ebb[_0x06ae('0x31')]=_['map'](_0x13c668,'name');_0x4c2ebb[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0xee3d41[_0x06ae('0x32')]);_0x4c2ebb[_0x06ae('0x34')]=_[_0x06ae('0x35')](_0x4c2ebb[_0x06ae('0x31')],_0x4c2ebb[_0x06ae('0x32')]);_0x14c9d6[_0x06ae('0x36')]=_[_0x06ae('0x35')](_0x4c2ebb[_0x06ae('0x31')],qs[_0x06ae('0x37')](_0xee3d41[_0x06ae('0x32')]['fields']));_0x14c9d6[_0x06ae('0x36')]=_0x14c9d6[_0x06ae('0x36')][_0x06ae('0x38')]?_0x14c9d6['attributes']:_0x4c2ebb[_0x06ae('0x31')];if(!_0xee3d41[_0x06ae('0x32')][_0x06ae('0x39')](_0x06ae('0x3a'))){_0x14c9d6[_0x06ae('0x1d')]=qs['limit'](_0xee3d41[_0x06ae('0x32')][_0x06ae('0x1d')]);_0x14c9d6[_0x06ae('0x1b')]=qs['offset'](_0xee3d41[_0x06ae('0x32')]['offset']);}_0x14c9d6[_0x06ae('0x3b')]=qs[_0x06ae('0x3c')](_0xee3d41[_0x06ae('0x32')][_0x06ae('0x3c')]);_0x14c9d6[_0x06ae('0x3d')]=qs[_0x06ae('0x34')](_['pick'](_0xee3d41['query'],_0x4c2ebb['filters']),_0x13c668);if(_0xee3d41['query']['filter']){_0x14c9d6[_0x06ae('0x3d')]=_[_0x06ae('0x3e')](_0x14c9d6[_0x06ae('0x3d')],{'$or':_[_0x06ae('0x3f')](_0x13c668,function(_0x22638c){if(_0x22638c[_0x06ae('0x2f')]!==_0x06ae('0x40')){var _0x2680c4={};_0x2680c4[_0x22638c['name']]={'$like':'%'+_0xee3d41['query'][_0x06ae('0x41')]+'%'};return _0x2680c4;}})});}_0x14c9d6=_['merge']({},_0x14c9d6,_0xee3d41[_0x06ae('0x42')]);var _0x28d802={'where':_0x14c9d6['where']};return db[_0x06ae('0x2c')][_0x06ae('0x1e')](_0x28d802)[_0x06ae('0x25')](function(_0x425320){_0x37202e[_0x06ae('0x1e')]=_0x425320;if(_0xee3d41[_0x06ae('0x32')][_0x06ae('0x43')]){_0x14c9d6[_0x06ae('0x44')]=[{'all':!![]}];}return db[_0x06ae('0x2c')][_0x06ae('0x45')](_0x14c9d6);})[_0x06ae('0x25')](function(_0x1a0cce){_0x37202e[_0x06ae('0x46')]=_0x1a0cce;return _0x37202e;})['then'](respondWithFilteredResult(_0x57d793,_0x14c9d6))[_0x06ae('0x47')](handleError(_0x57d793,null));};exports[_0x06ae('0x48')]=function(_0x2ebf5e,_0x570712){var _0x1f82c1={'raw':![],'where':{'id':_0x2ebf5e[_0x06ae('0x49')]['id']}},_0x16b3ae={};_0x16b3ae[_0x06ae('0x31')]=_[_0x06ae('0x33')](db[_0x06ae('0x2c')][_0x06ae('0x2d')]);_0x16b3ae[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x2ebf5e['query']);_0x16b3ae['filters']=_['intersection'](_0x16b3ae[_0x06ae('0x31')],_0x16b3ae[_0x06ae('0x32')]);_0x1f82c1[_0x06ae('0x36')]=_['intersection'](_0x16b3ae[_0x06ae('0x31')],qs['fields'](_0x2ebf5e['query'][_0x06ae('0x37')]));_0x1f82c1[_0x06ae('0x36')]=_0x1f82c1[_0x06ae('0x36')]['length']?_0x1f82c1[_0x06ae('0x36')]:_0x16b3ae['model'];if(_0x2ebf5e[_0x06ae('0x32')][_0x06ae('0x43')]){_0x1f82c1['include']=[{'all':!![]}];}_0x1f82c1=_['merge']({},_0x1f82c1,_0x2ebf5e[_0x06ae('0x42')]);return db['ZohoAccount']['find'](_0x1f82c1)[_0x06ae('0x25')](handleEntityNotFound(_0x570712,null))[_0x06ae('0x25')](respondWithResult(_0x570712,null))[_0x06ae('0x47')](handleError(_0x570712,null));};exports[_0x06ae('0x4a')]=function(_0x2d5ab9,_0x1008ff){return db[_0x06ae('0x2c')]['create'](_0x2d5ab9['body'],{})[_0x06ae('0x25')](respondWithResult(_0x1008ff,0xc9))[_0x06ae('0x47')](handleError(_0x1008ff,null));};exports[_0x06ae('0x24')]=function(_0x1e535c,_0x4a4286){if(_0x1e535c[_0x06ae('0x4b')]['id']){delete _0x1e535c[_0x06ae('0x4b')]['id'];}return db[_0x06ae('0x2c')][_0x06ae('0x4c')]({'where':{'id':_0x1e535c[_0x06ae('0x49')]['id']}})[_0x06ae('0x25')](handleEntityNotFound(_0x4a4286,null))[_0x06ae('0x25')](saveUpdates(_0x1e535c[_0x06ae('0x4b')],null))[_0x06ae('0x25')](respondWithResult(_0x4a4286,null))[_0x06ae('0x47')](handleError(_0x4a4286,null));};exports[_0x06ae('0x26')]=function(_0x5e26a0,_0x347dea){return db[_0x06ae('0x2c')][_0x06ae('0x4c')]({'where':{'id':_0x5e26a0['params']['id']}})['then'](handleEntityNotFound(_0x347dea,null))[_0x06ae('0x25')](removeEntity(_0x347dea,null))[_0x06ae('0x47')](handleError(_0x347dea,null));};exports[_0x06ae('0x4d')]=function(_0x429a65,_0x12af55,_0x6f8315){var _0x44e76d={};var _0x3efa39={};var _0x42e751;var _0x1b27f1;return db[_0x06ae('0x2c')][_0x06ae('0x4e')]({'where':{'id':_0x429a65[_0x06ae('0x49')]['id']}})[_0x06ae('0x25')](handleEntityNotFound(_0x12af55,null))[_0x06ae('0x25')](function(_0x4e15f6){if(_0x4e15f6){_0x42e751=_0x4e15f6;_0x3efa39[_0x06ae('0x31')]=_['keys'](db[_0x06ae('0x4f')]['rawAttributes']);_0x3efa39[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x429a65[_0x06ae('0x32')]);_0x3efa39['filters']=_[_0x06ae('0x35')](_0x3efa39[_0x06ae('0x31')],_0x3efa39['query']);_0x44e76d[_0x06ae('0x36')]=_[_0x06ae('0x35')](_0x3efa39[_0x06ae('0x31')],qs[_0x06ae('0x37')](_0x429a65[_0x06ae('0x32')][_0x06ae('0x37')]));_0x44e76d['attributes']=_0x44e76d[_0x06ae('0x36')][_0x06ae('0x38')]?_0x44e76d['attributes']:_0x3efa39[_0x06ae('0x31')];_0x44e76d[_0x06ae('0x3b')]=qs[_0x06ae('0x3c')](_0x429a65['query'][_0x06ae('0x3c')]);_0x44e76d[_0x06ae('0x3d')]=qs[_0x06ae('0x34')](_[_0x06ae('0x50')](_0x429a65[_0x06ae('0x32')],_0x3efa39[_0x06ae('0x34')]));if(_0x429a65[_0x06ae('0x32')][_0x06ae('0x41')]){_0x44e76d['where']=_[_0x06ae('0x3e')](_0x44e76d[_0x06ae('0x3d')],{'$or':_[_0x06ae('0x3f')](_0x44e76d['attributes'],function(_0x3e1772){var _0x59ccda={};_0x59ccda[_0x3e1772]={'$like':'%'+_0x429a65[_0x06ae('0x32')][_0x06ae('0x41')]+'%'};return _0x59ccda;})});}_0x44e76d=_[_0x06ae('0x3e')]({},_0x44e76d,_0x429a65[_0x06ae('0x42')]);return _0x42e751['getConfigurations'](_0x44e76d);}})['then'](function(_0x2a78e0){if(_0x2a78e0){_0x1b27f1=_0x2a78e0[_0x06ae('0x38')];if(!_0x429a65[_0x06ae('0x32')][_0x06ae('0x39')](_0x06ae('0x3a'))){_0x44e76d[_0x06ae('0x1d')]=qs[_0x06ae('0x1d')](_0x429a65[_0x06ae('0x32')][_0x06ae('0x1d')]);_0x44e76d[_0x06ae('0x1b')]=qs[_0x06ae('0x1b')](_0x429a65[_0x06ae('0x32')][_0x06ae('0x1b')]);}return _0x42e751['getConfigurations'](_0x44e76d);}})['then'](function(_0x3eeb9c){if(_0x3eeb9c){return _0x3eeb9c?{'count':_0x1b27f1,'rows':_0x3eeb9c}:null;}})['then'](respondWithResult(_0x12af55,null))['catch'](handleError(_0x12af55,null));};exports[_0x06ae('0x51')]=function(_0x1cca38,_0x2154e1,_0x6dac61){if(_0x1cca38[_0x06ae('0x4b')]['id']){delete _0x1cca38[_0x06ae('0x4b')]['id'];}return db['ZohoAccount'][_0x06ae('0x4e')]({'where':{'id':_0x1cca38[_0x06ae('0x49')]['id']}})[_0x06ae('0x25')](handleEntityNotFound(_0x2154e1,null))[_0x06ae('0x25')](function(_0x474579){if(_0x474579){_0x1cca38[_0x06ae('0x4b')][_0x06ae('0x52')]=_0x474579['id'];_0x1cca38[_0x06ae('0x4b')][_0x06ae('0x53')]=integrations[_0x06ae('0x54')](_0x1cca38['body'][_0x06ae('0x55')],_0x1cca38['body'][_0x06ae('0x2f')]);_0x1cca38[_0x06ae('0x4b')][_0x06ae('0x56')]=integrations[_0x06ae('0x57')](_0x1cca38[_0x06ae('0x4b')][_0x06ae('0x55')],_0x1cca38[_0x06ae('0x4b')][_0x06ae('0x2f')]);return db['ZohoConfiguration'][_0x06ae('0x4a')](_0x1cca38[_0x06ae('0x4b')],{'include':[{'model':db[_0x06ae('0x58')],'as':_0x06ae('0x53')},{'model':db[_0x06ae('0x58')],'as':_0x06ae('0x56')}]});}return null;})[_0x06ae('0x25')](respondWithResult(_0x2154e1,null))[_0x06ae('0x47')](handleError(_0x2154e1,null));};function getAccessToken(_0x68e326){return new Promise(function(_0x2f8872,_0x450b60){var _0x1c275d;switch(_0x68e326[_0x06ae('0x59')]){case'US':_0x1c275d=_0x06ae('0x5a');break;case'AU':_0x1c275d=_0x06ae('0x5b');break;case'EU':_0x1c275d=_0x06ae('0x5c');break;case'IN':_0x1c275d=_0x06ae('0x5d');break;case'CN':_0x1c275d=_0x06ae('0x5e');break;default:_0x1c275d=_0x06ae('0x5c');break;}var _0x219593={'method':_0x06ae('0x5f'),'uri':_0x1c275d+_0x06ae('0x60'),'qs':{'refresh_token':_0x68e326['refreshToken'],'client_id':_0x68e326[_0x06ae('0x61')],'client_secret':_0x68e326[_0x06ae('0x62')],'grant_type':_0x06ae('0x63')},'json':!![]};return rp(_0x219593)[_0x06ae('0x25')](function(_0x80fba2){if(_0x80fba2['access_token']){_0x2f8872(_0x80fba2[_0x06ae('0x64')]);}else{_0x450b60('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x06ae('0x47')](function(_0x4e11ed){_0x450b60(_0x4e11ed);});});}exports[_0x06ae('0x65')]=function(_0x13d586,_0xb4650a,_0x4aba07){var _0x58f06d,_0x135275,_0x1939a9,_0x2e6ee6,_0x3fb890;return db[_0x06ae('0x2c')]['findOne']({'where':{'id':_0x13d586[_0x06ae('0x49')]['id']},'attributes':['id',_0x06ae('0x66'),_0x06ae('0x59'),'clientId',_0x06ae('0x62'),_0x06ae('0x67'),_0x06ae('0x68'),'refreshToken']})['then'](handleEntityNotFound(_0xb4650a,null))[_0x06ae('0x25')](function(_0x5a705b){_0x3fb890=_0x5a705b;_0x58f06d=_0x3fb890[_0x06ae('0x66')];_0x135275=_0x58f06d===_0x06ae('0x69')?'eu':'com';_0x1939a9=_0x3fb890[_0x06ae('0x67')];var _0x4d5812=_0x1939a9[_0x06ae('0x6a')](-0x1);if(_0x4d5812==='/'||_0x4d5812==='\x5c'||_0x4d5812===':'){_0x1939a9=_0x1939a9['substring'](0x0,_0x1939a9[_0x06ae('0x6b')](_0x4d5812));}if(!_0x3fb890[_0x06ae('0x6c')]){throw new Error(_0x06ae('0x6d'));}return getAccessToken(_0x3fb890);})[_0x06ae('0x25')](function(_0x15ff29){if(_0x15ff29){return rp({'method':_0x06ae('0x6e'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x135275),'qs':{'module':_0x06ae('0x6f')},'headers':{'Authorization':_0x06ae('0x70')+_0x15ff29},'json':!![]});}})[_0x06ae('0x25')](function(_0x3ab501){if(_0x3ab501){if(_0x3ab501[_0x06ae('0x71')]&&_0x3ab501['response'][_0x06ae('0x27')]){throw new Error(_0x3ab501['response'][_0x06ae('0x27')]['message']);}var _0x3d4065=[];var _0xe96dea=[];var _0x3c6c8d=[_0x06ae('0x72'),'Subject',_0x06ae('0x73'),_0x06ae('0x74'),_0x06ae('0x75'),'Call_Result','Call_Start_Time',_0x06ae('0x76')];_0xe96dea=_['remove'](_0x3ab501[_0x06ae('0x37')],function(_0x1bb9cf){return _0x3c6c8d[_0x06ae('0x77')](_0x1bb9cf[_0x06ae('0x78')]);});for(var _0x5ee2a1=0x0;_0x5ee2a1<_0xe96dea[_0x06ae('0x38')];_0x5ee2a1++){if(_0xe96dea[_0x5ee2a1][_0x06ae('0x79')]===![]){_0x3d4065[_0x06ae('0x7a')]({'id':_0xe96dea[_0x5ee2a1]['id'],'name':_0xe96dea[_0x5ee2a1][_0x06ae('0x7b')],'custom':_0xe96dea[_0x5ee2a1][_0x06ae('0x7c')],'options':_0xe96dea[_0x5ee2a1][_0x06ae('0x7d')]===_0x06ae('0x7e')&&_0xe96dea[_0x5ee2a1][_0x06ae('0x7f')][_0x06ae('0x38')]>-0x1?_[_0x06ae('0x3f')](_0xe96dea[_0x5ee2a1][_0x06ae('0x7f')],function(_0x362f8c){return{'name':_0x362f8c,'value':_0x362f8c};}):[]});}}return{'count':_0x3d4065[_0x06ae('0x38')],'rows':_0x3d4065};}else{return{'count':0x0,'rows':[]};}})[_0x06ae('0x25')](respondWithResult(_0xb4650a,null))['catch'](function(_0x5ee988){var _0x1c65a5=_0x13d586[_0x06ae('0x32')][_0x06ae('0x80')]?0x1f4:_0x5ee988['statusCode']||0x1f4;logger['error'](_0x06ae('0x81'),_0x06ae('0x65'),_0x1c65a5,JSON[_0x06ae('0x82')](_0x5ee988));delete _0x5ee988[_0x06ae('0x29')];if(_0x1c65a5===0x191){_0x1c65a5=0x190;}_0xb4650a[_0x06ae('0x19')](_0x1c65a5)[_0x06ae('0x2a')](_0x13d586[_0x06ae('0x32')][_0x06ae('0x80')]?{'message':_0x06ae('0x83'),'statusCode':_0x5ee988[_0x06ae('0x84')]}:_0x5ee988);});}; \ No newline at end of file +var _0xe94c=['body','update','params','findOne','ZohoConfiguration','sort','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','merge','type','VIRTUAL','filter','options','includeAll','rows','show','length','include','find','catch','create'];(function(_0x861d0f,_0x131abb){var _0x28c9f1=function(_0x507420){while(--_0x507420){_0x861d0f['push'](_0x861d0f['shift']());}};_0x28c9f1(++_0x131abb);}(_0xe94c,0xcc));var _0xce94=function(_0x56cfa2,_0x5c937c){_0x56cfa2=_0x56cfa2-0x0;var _0x57461e=_0xe94c[_0x56cfa2];return _0x57461e;};'use strict';var emlformat=require(_0xce94('0x0'));var rimraf=require(_0xce94('0x1'));var zipdir=require(_0xce94('0x2'));var jsonpatch=require(_0xce94('0x3'));var rp=require(_0xce94('0x4'));var moment=require(_0xce94('0x5'));var BPromise=require(_0xce94('0x6'));var Mustache=require(_0xce94('0x7'));var util=require(_0xce94('0x8'));var path=require(_0xce94('0x9'));var sox=require(_0xce94('0xa'));var csv=require(_0xce94('0xb'));var ejs=require(_0xce94('0xc'));var fs=require('fs');var fs_extra=require(_0xce94('0xd'));var _=require(_0xce94('0xe'));var squel=require(_0xce94('0xf'));var crypto=require(_0xce94('0x10'));var jsforce=require(_0xce94('0x11'));var deskjs=require(_0xce94('0x12'));var toCsv=require(_0xce94('0xb'));var querystring=require(_0xce94('0x13'));var Papa=require('papaparse');var Redis=require(_0xce94('0x14'));var authService=require(_0xce94('0x15'));var qs=require(_0xce94('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce94('0x17'));var logger=require(_0xce94('0x18'))(_0xce94('0x19'));var utils=require(_0xce94('0x1a'));var config=require(_0xce94('0x1b'));var licenseUtil=require(_0xce94('0x1c'));var db=require(_0xce94('0x1d'))['db'];var integrations=require(_0xce94('0x1e'));function respondWithStatusCode(_0x86a1bc,_0x575c38){_0x575c38=_0x575c38||0xcc;return function(_0x535005){if(_0x535005){return _0x86a1bc['sendStatus'](_0x575c38);}return _0x86a1bc[_0xce94('0x1f')](_0x575c38)[_0xce94('0x20')]();};}function respondWithResult(_0x94003f,_0x4ede8a){_0x4ede8a=_0x4ede8a||0xc8;return function(_0x1ae586){if(_0x1ae586){return _0x94003f[_0xce94('0x1f')](_0x4ede8a)[_0xce94('0x21')](_0x1ae586);}};}function respondWithFilteredResult(_0x28602f,_0xd8e868){return function(_0x5cb0bc){if(_0x5cb0bc){var _0x36a0e2=typeof _0xd8e868[_0xce94('0x22')]===_0xce94('0x23')&&typeof _0xd8e868[_0xce94('0x24')]==='undefined';var _0x8ffbee=_0x5cb0bc[_0xce94('0x25')];var _0x1d3b4a=_0x36a0e2?0x0:_0xd8e868[_0xce94('0x22')];var _0x3ffc64=_0x36a0e2?_0x5cb0bc[_0xce94('0x25')]:_0xd8e868['offset']+_0xd8e868[_0xce94('0x24')];var _0x54b864;if(_0x3ffc64>=_0x8ffbee){_0x3ffc64=_0x8ffbee;_0x54b864=0xc8;}else{_0x54b864=0xce;}_0x28602f['status'](_0x54b864);return _0x28602f[_0xce94('0x26')](_0xce94('0x27'),_0x1d3b4a+'-'+_0x3ffc64+'/'+_0x8ffbee)['json'](_0x5cb0bc);}return null;};}function patchUpdates(_0x4b91b3){return function(_0x779b7e){try{jsonpatch['apply'](_0x779b7e,_0x4b91b3,!![]);}catch(_0xa7be0b){return BPromise[_0xce94('0x28')](_0xa7be0b);}return _0x779b7e[_0xce94('0x29')]();};}function saveUpdates(_0x50e09b,_0xbf72c0){return function(_0x241f3a){if(_0x241f3a){return _0x241f3a['update'](_0x50e09b)[_0xce94('0x2a')](function(_0xf4b79d){return _0xf4b79d;});}return null;};}function removeEntity(_0x20ef27,_0x48578a){return function(_0x391228){if(_0x391228){return _0x391228[_0xce94('0x2b')]()['then'](function(){_0x20ef27[_0xce94('0x1f')](0xcc)[_0xce94('0x20')]();});}};}function handleEntityNotFound(_0x4e573d,_0x15cba6){return function(_0x5539ca){if(!_0x5539ca){_0x4e573d[_0xce94('0x2c')](0x194);}return _0x5539ca;};}function handleError(_0x34f7c1,_0x4aaf82){_0x4aaf82=_0x4aaf82||0x1f4;return function(_0x1a24a2){logger[_0xce94('0x2d')](_0x1a24a2[_0xce94('0x2e')]);if(_0x1a24a2[_0xce94('0x2f')]){delete _0x1a24a2['name'];}_0x34f7c1['status'](_0x4aaf82)['send'](_0x1a24a2);};}exports[_0xce94('0x30')]=function(_0x58d77a,_0x1b5f78){var _0x2e88b7={},_0x282f45={},_0x823596={'count':0x0,'rows':[]};var _0x925558=_[_0xce94('0x31')](db[_0xce94('0x32')][_0xce94('0x33')],function(_0x551410){return{'name':_0x551410[_0xce94('0x34')],'type':_0x551410['type'][_0xce94('0x35')]};});_0x282f45[_0xce94('0x36')]=_[_0xce94('0x31')](_0x925558,_0xce94('0x2f'));_0x282f45[_0xce94('0x37')]=_[_0xce94('0x38')](_0x58d77a[_0xce94('0x37')]);_0x282f45[_0xce94('0x39')]=_[_0xce94('0x3a')](_0x282f45[_0xce94('0x36')],_0x282f45['query']);_0x2e88b7[_0xce94('0x3b')]=_[_0xce94('0x3a')](_0x282f45[_0xce94('0x36')],qs[_0xce94('0x3c')](_0x58d77a[_0xce94('0x37')][_0xce94('0x3c')]));_0x2e88b7[_0xce94('0x3b')]=_0x2e88b7[_0xce94('0x3b')]['length']?_0x2e88b7['attributes']:_0x282f45['model'];if(!_0x58d77a['query'][_0xce94('0x3d')](_0xce94('0x3e'))){_0x2e88b7[_0xce94('0x24')]=qs[_0xce94('0x24')](_0x58d77a[_0xce94('0x37')][_0xce94('0x24')]);_0x2e88b7[_0xce94('0x22')]=qs[_0xce94('0x22')](_0x58d77a[_0xce94('0x37')][_0xce94('0x22')]);}_0x2e88b7[_0xce94('0x3f')]=qs['sort'](_0x58d77a[_0xce94('0x37')]['sort']);_0x2e88b7[_0xce94('0x40')]=qs[_0xce94('0x39')](_['pick'](_0x58d77a['query'],_0x282f45[_0xce94('0x39')]),_0x925558);if(_0x58d77a[_0xce94('0x37')]['filter']){_0x2e88b7[_0xce94('0x40')]=_[_0xce94('0x41')](_0x2e88b7[_0xce94('0x40')],{'$or':_['map'](_0x925558,function(_0x20ae4e){if(_0x20ae4e[_0xce94('0x42')]!==_0xce94('0x43')){var _0x52aca5={};_0x52aca5[_0x20ae4e['name']]={'$like':'%'+_0x58d77a[_0xce94('0x37')][_0xce94('0x44')]+'%'};return _0x52aca5;}})});}_0x2e88b7=_[_0xce94('0x41')]({},_0x2e88b7,_0x58d77a[_0xce94('0x45')]);var _0x277641={'where':_0x2e88b7[_0xce94('0x40')]};return db[_0xce94('0x32')]['count'](_0x277641)[_0xce94('0x2a')](function(_0x5574f1){_0x823596[_0xce94('0x25')]=_0x5574f1;if(_0x58d77a['query'][_0xce94('0x46')]){_0x2e88b7['include']=[{'all':!![]}];}return db[_0xce94('0x32')]['findAll'](_0x2e88b7);})[_0xce94('0x2a')](function(_0x36ffca){_0x823596[_0xce94('0x47')]=_0x36ffca;return _0x823596;})[_0xce94('0x2a')](respondWithFilteredResult(_0x1b5f78,_0x2e88b7))['catch'](handleError(_0x1b5f78,null));};exports[_0xce94('0x48')]=function(_0x1c7377,_0x1de9e9){var _0x5e549c={'raw':![],'where':{'id':_0x1c7377['params']['id']}},_0x208215={};_0x208215[_0xce94('0x36')]=_[_0xce94('0x38')](db[_0xce94('0x32')][_0xce94('0x33')]);_0x208215[_0xce94('0x37')]=_[_0xce94('0x38')](_0x1c7377[_0xce94('0x37')]);_0x208215[_0xce94('0x39')]=_['intersection'](_0x208215['model'],_0x208215[_0xce94('0x37')]);_0x5e549c[_0xce94('0x3b')]=_[_0xce94('0x3a')](_0x208215[_0xce94('0x36')],qs['fields'](_0x1c7377[_0xce94('0x37')][_0xce94('0x3c')]));_0x5e549c[_0xce94('0x3b')]=_0x5e549c[_0xce94('0x3b')][_0xce94('0x49')]?_0x5e549c[_0xce94('0x3b')]:_0x208215[_0xce94('0x36')];if(_0x1c7377[_0xce94('0x37')][_0xce94('0x46')]){_0x5e549c[_0xce94('0x4a')]=[{'all':!![]}];}_0x5e549c=_[_0xce94('0x41')]({},_0x5e549c,_0x1c7377[_0xce94('0x45')]);return db[_0xce94('0x32')][_0xce94('0x4b')](_0x5e549c)[_0xce94('0x2a')](handleEntityNotFound(_0x1de9e9,null))[_0xce94('0x2a')](respondWithResult(_0x1de9e9,null))[_0xce94('0x4c')](handleError(_0x1de9e9,null));};exports[_0xce94('0x4d')]=function(_0x206b24,_0x40e548){return db[_0xce94('0x32')][_0xce94('0x4d')](_0x206b24[_0xce94('0x4e')],{})['then'](respondWithResult(_0x40e548,0xc9))[_0xce94('0x4c')](handleError(_0x40e548,null));};exports[_0xce94('0x4f')]=function(_0xc9b4a7,_0x38be7a){if(_0xc9b4a7[_0xce94('0x4e')]['id']){delete _0xc9b4a7['body']['id'];}return db[_0xce94('0x32')][_0xce94('0x4b')]({'where':{'id':_0xc9b4a7[_0xce94('0x50')]['id']}})['then'](handleEntityNotFound(_0x38be7a,null))[_0xce94('0x2a')](saveUpdates(_0xc9b4a7[_0xce94('0x4e')],null))[_0xce94('0x2a')](respondWithResult(_0x38be7a,null))['catch'](handleError(_0x38be7a,null));};exports[_0xce94('0x2b')]=function(_0x1b2ccf,_0x2176c2){return db['ZohoAccount'][_0xce94('0x4b')]({'where':{'id':_0x1b2ccf[_0xce94('0x50')]['id']}})[_0xce94('0x2a')](handleEntityNotFound(_0x2176c2,null))[_0xce94('0x2a')](removeEntity(_0x2176c2,null))['catch'](handleError(_0x2176c2,null));};exports['getConfigurations']=function(_0x11037d,_0x89ed82,_0x3fe9f3){var _0xe9edd0={};var _0x418142={};var _0x272bde;var _0x38e526;return db[_0xce94('0x32')][_0xce94('0x51')]({'where':{'id':_0x11037d['params']['id']}})['then'](handleEntityNotFound(_0x89ed82,null))[_0xce94('0x2a')](function(_0x14425c){if(_0x14425c){_0x272bde=_0x14425c;_0x418142[_0xce94('0x36')]=_[_0xce94('0x38')](db[_0xce94('0x52')][_0xce94('0x33')]);_0x418142['query']=_['keys'](_0x11037d['query']);_0x418142[_0xce94('0x39')]=_[_0xce94('0x3a')](_0x418142[_0xce94('0x36')],_0x418142[_0xce94('0x37')]);_0xe9edd0[_0xce94('0x3b')]=_['intersection'](_0x418142[_0xce94('0x36')],qs[_0xce94('0x3c')](_0x11037d[_0xce94('0x37')][_0xce94('0x3c')]));_0xe9edd0['attributes']=_0xe9edd0[_0xce94('0x3b')][_0xce94('0x49')]?_0xe9edd0[_0xce94('0x3b')]:_0x418142[_0xce94('0x36')];_0xe9edd0[_0xce94('0x3f')]=qs['sort'](_0x11037d[_0xce94('0x37')][_0xce94('0x53')]);_0xe9edd0[_0xce94('0x40')]=qs[_0xce94('0x39')](_['pick'](_0x11037d[_0xce94('0x37')],_0x418142[_0xce94('0x39')]));if(_0x11037d[_0xce94('0x37')][_0xce94('0x44')]){_0xe9edd0[_0xce94('0x40')]=_['merge'](_0xe9edd0[_0xce94('0x40')],{'$or':_[_0xce94('0x31')](_0xe9edd0['attributes'],function(_0xae918a){var _0x4b1878={};_0x4b1878[_0xae918a]={'$like':'%'+_0x11037d[_0xce94('0x37')][_0xce94('0x44')]+'%'};return _0x4b1878;})});}_0xe9edd0=_[_0xce94('0x41')]({},_0xe9edd0,_0x11037d[_0xce94('0x45')]);return _0x272bde[_0xce94('0x54')](_0xe9edd0);}})[_0xce94('0x2a')](function(_0x2dfb6f){if(_0x2dfb6f){_0x38e526=_0x2dfb6f['length'];if(!_0x11037d['query'][_0xce94('0x3d')](_0xce94('0x3e'))){_0xe9edd0[_0xce94('0x24')]=qs[_0xce94('0x24')](_0x11037d['query'][_0xce94('0x24')]);_0xe9edd0['offset']=qs[_0xce94('0x22')](_0x11037d['query'][_0xce94('0x22')]);}return _0x272bde[_0xce94('0x54')](_0xe9edd0);}})['then'](function(_0x4536b4){if(_0x4536b4){return _0x4536b4?{'count':_0x38e526,'rows':_0x4536b4}:null;}})[_0xce94('0x2a')](respondWithResult(_0x89ed82,null))[_0xce94('0x4c')](handleError(_0x89ed82,null));};exports[_0xce94('0x55')]=function(_0x138082,_0x3bff24,_0x6e77d9){if(_0x138082[_0xce94('0x4e')]['id']){delete _0x138082[_0xce94('0x4e')]['id'];}return db[_0xce94('0x32')][_0xce94('0x51')]({'where':{'id':_0x138082[_0xce94('0x50')]['id']}})[_0xce94('0x2a')](handleEntityNotFound(_0x3bff24,null))['then'](function(_0x249a2a){if(_0x249a2a){_0x138082[_0xce94('0x4e')][_0xce94('0x56')]=_0x249a2a['id'];_0x138082[_0xce94('0x4e')][_0xce94('0x57')]=integrations['getSubjects'](_0x138082[_0xce94('0x4e')]['channel'],_0x138082[_0xce94('0x4e')][_0xce94('0x42')]);_0x138082['body'][_0xce94('0x58')]=integrations[_0xce94('0x59')](_0x138082[_0xce94('0x4e')][_0xce94('0x5a')],_0x138082[_0xce94('0x4e')]['type']);return db[_0xce94('0x52')]['create'](_0x138082[_0xce94('0x4e')],{'include':[{'model':db[_0xce94('0x5b')],'as':'Subjects'},{'model':db[_0xce94('0x5b')],'as':_0xce94('0x58')}]});}return null;})[_0xce94('0x2a')](respondWithResult(_0x3bff24,null))['catch'](handleError(_0x3bff24,null));};function getAccessToken(_0x27a1b9){return new Promise(function(_0x25b40f,_0x374ea1){var _0x59ed71;switch(_0x27a1b9[_0xce94('0x5c')]){case'US':_0x59ed71=_0xce94('0x5d');break;case'AU':_0x59ed71=_0xce94('0x5e');break;case'EU':_0x59ed71=_0xce94('0x5f');break;case'IN':_0x59ed71=_0xce94('0x60');break;case'CN':_0x59ed71=_0xce94('0x61');break;default:_0x59ed71='https://accounts.zoho.eu';break;}var _0x354b72={'method':_0xce94('0x62'),'uri':_0x59ed71+'/oauth/v2/token','qs':{'refresh_token':_0x27a1b9[_0xce94('0x63')],'client_id':_0x27a1b9[_0xce94('0x64')],'client_secret':_0x27a1b9['clientSecret'],'grant_type':_0xce94('0x65')},'json':!![]};return rp(_0x354b72)[_0xce94('0x2a')](function(_0x131ee9){if(_0x131ee9[_0xce94('0x66')]){_0x25b40f(_0x131ee9[_0xce94('0x66')]);}else{_0x374ea1(_0xce94('0x67'));}})[_0xce94('0x4c')](function(_0x4ea02e){_0x374ea1(_0x4ea02e);});});}exports[_0xce94('0x68')]=function(_0xa7bcf,_0x469e8d,_0x5d200d){var _0x2a4b22,_0x41ab19,_0x597da0,_0x46d7d8,_0x2d13b0;return db['ZohoAccount']['findOne']({'where':{'id':_0xa7bcf[_0xce94('0x50')]['id']},'attributes':['id',_0xce94('0x69'),'zone',_0xce94('0x64'),_0xce94('0x6a'),_0xce94('0x6b'),_0xce94('0x6c'),'refreshToken']})[_0xce94('0x2a')](handleEntityNotFound(_0x469e8d,null))[_0xce94('0x2a')](function(_0x512135){_0x2d13b0=_0x512135;_0x2a4b22=_0x2d13b0[_0xce94('0x69')];_0x41ab19=_0x2a4b22===_0xce94('0x6d')?'eu':_0xce94('0x6e');_0x597da0=_0x2d13b0['serverUrl'];var _0x2442e2=_0x597da0['slice'](-0x1);if(_0x2442e2==='/'||_0x2442e2==='\x5c'||_0x2442e2===':'){_0x597da0=_0x597da0[_0xce94('0x6f')](0x0,_0x597da0[_0xce94('0x70')](_0x2442e2));}if(!_0x2d13b0[_0xce94('0x63')]){throw new Error(_0xce94('0x71'));}return getAccessToken(_0x2d13b0);})[_0xce94('0x2a')](function(_0x39ceb1){if(_0x39ceb1){return rp({'method':_0xce94('0x72'),'uri':util['format'](_0xce94('0x73'),_0x41ab19),'qs':{'module':'Calls'},'headers':{'Authorization':_0xce94('0x74')+_0x39ceb1},'json':!![]});}})['then'](function(_0x49aea3){if(_0x49aea3){if(_0x49aea3[_0xce94('0x75')]&&_0x49aea3[_0xce94('0x75')]['error']){throw new Error(_0x49aea3['response']['error']['message']);}var _0x31d3b5=[];var _0x274d25=[];var _0x1c8855=[_0xce94('0x76'),_0xce94('0x77'),_0xce94('0x78'),_0xce94('0x79'),_0xce94('0x7a'),_0xce94('0x7b'),_0xce94('0x7c'),_0xce94('0x7d')];_0x274d25=_[_0xce94('0x7e')](_0x49aea3['fields'],function(_0x4f6401){return _0x1c8855[_0xce94('0x7f')](_0x4f6401[_0xce94('0x80')]);});for(var _0x2c4027=0x0;_0x2c4027<_0x274d25[_0xce94('0x49')];_0x2c4027++){if(_0x274d25[_0x2c4027][_0xce94('0x81')]===![]){_0x31d3b5[_0xce94('0x82')]({'id':_0x274d25[_0x2c4027]['id'],'name':_0x274d25[_0x2c4027][_0xce94('0x83')],'custom':_0x274d25[_0x2c4027][_0xce94('0x84')],'options':_0x274d25[_0x2c4027][_0xce94('0x85')]===_0xce94('0x86')&&_0x274d25[_0x2c4027][_0xce94('0x87')][_0xce94('0x49')]>-0x1?_[_0xce94('0x31')](_0x274d25[_0x2c4027][_0xce94('0x87')],function(_0x15119e){return{'name':_0x15119e,'value':_0x15119e};}):[]});}}return{'count':_0x31d3b5[_0xce94('0x49')],'rows':_0x31d3b5};}else{return{'count':0x0,'rows':[]};}})[_0xce94('0x2a')](respondWithResult(_0x469e8d,null))[_0xce94('0x4c')](function(_0x2f472a){var _0x24fe5e=_0xa7bcf['query'][_0xce94('0x88')]?0x1f4:_0x2f472a[_0xce94('0x89')]||0x1f4;logger[_0xce94('0x2d')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x24fe5e,JSON[_0xce94('0x8a')](_0x2f472a));delete _0x2f472a[_0xce94('0x2f')];if(_0x24fe5e===0x191){_0x24fe5e=0x190;}_0x469e8d[_0xce94('0x1f')](_0x24fe5e)[_0xce94('0x8b')](_0xa7bcf[_0xce94('0x37')][_0xce94('0x88')]?{'message':_0xce94('0x8c'),'statusCode':_0x2f472a['statusCode']}:_0x2f472a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 539b76d..65cd6f0 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 _0x8e3c=['define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','zone','refreshToken','util','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0xb0c40d,_0x233ac4){var _0x471a21=function(_0x563b58){while(--_0x563b58){_0xb0c40d['push'](_0xb0c40d['shift']());}};_0x471a21(++_0x233ac4);}(_0x8e3c,0x1e4));var _0xc8e3=function(_0x5cd47e,_0x584d23){_0x5cd47e=_0x5cd47e-0x0;var _0x1043ab=_0x8e3c[_0x5cd47e];return _0x1043ab;};'use strict';var _=require('lodash');var util=require(_0xc8e3('0x0'));var logger=require('../../config/logger')(_0xc8e3('0x1'));var moment=require('moment');var BPromise=require(_0xc8e3('0x2'));var rp=require(_0xc8e3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8e3('0x4'));var config=require(_0xc8e3('0x5'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xc8e3('0x6'));module[_0xc8e3('0x7')]=function(_0x34d211,_0x2e73ab){return _0x34d211[_0xc8e3('0x8')](_0xc8e3('0x9'),attributes,{'tableName':_0xc8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ad949,_0x2fbdef,_0x540522){if(_0x2ad949[_0xc8e3('0xb')]('zone')||_0x2ad949['changed']('serverUrl')||_0x2ad949[_0xc8e3('0xb')](_0xc8e3('0xc'))||_0x2ad949[_0xc8e3('0xb')](_0xc8e3('0xd'))||_0x2ad949[_0xc8e3('0xb')](_0xc8e3('0xe'))||_0x2ad949['changed'](_0xc8e3('0xf'))){var _0x3cb8a5,_0x494382;_0x3cb8a5=_0x2ad949[_0xc8e3('0x10')];var _0x228b79=_0x3cb8a5[_0xc8e3('0x11')](-0x1);if(_0x228b79==='/'||_0x228b79==='\x5c'||_0x228b79===':'){_0x3cb8a5=_0x3cb8a5[_0xc8e3('0x12')](0x0,_0x3cb8a5[_0xc8e3('0x13')](_0x228b79));}switch(_0x2ad949['zone']){case'US':_0x494382=_0xc8e3('0x14');break;case'AU':_0x494382=_0xc8e3('0x15');break;case'IN':_0x494382=_0xc8e3('0x16');break;case'CN':_0x494382=_0xc8e3('0x17');break;default:_0x494382=_0xc8e3('0x18');break;}var _0x3a5bde={'method':_0xc8e3('0x19'),'uri':_0x494382+_0xc8e3('0x1a'),'form':{'grant_type':_0xc8e3('0x1b'),'client_id':_0x2ad949['clientId'],'client_secret':_0x2ad949[_0xc8e3('0xd')],'redirect_uri':_0x2ad949['serverUrl'],'code':_0x2ad949[_0xc8e3('0xe')]},'headers':{'Content-Type':_0xc8e3('0x1c')}};return rp(_0x3a5bde)[_0xc8e3('0x1d')](function(_0x323d04){var _0x391e37=JSON[_0xc8e3('0x1e')](_0x323d04);if(_0x391e37[_0xc8e3('0x1f')]){_0x2ad949['refreshToken']=_0x391e37[_0xc8e3('0x1f')];logger['info'](util[_0xc8e3('0x20')](_0xc8e3('0x21'),_0x2ad949[_0xc8e3('0x22')],_0x2ad949['id']));}else{logger[_0xc8e3('0x23')](util[_0xc8e3('0x20')](_0xc8e3('0x24'),_0x2ad949[_0xc8e3('0x22')],_0x2ad949['id']),util['inspect'](_0x391e37,{'showHidden':![],'depth':null}));}return _0x540522(null,_0x2fbdef);})[_0xc8e3('0x25')](function(_0x1311b2){logger['error'](util[_0xc8e3('0x20')](_0xc8e3('0x24'),_0x2ad949['name'],_0x2ad949['id']),util[_0xc8e3('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x540522(_0x1311b2);});}else{return _0x540522(null,_0x2fbdef);}},'beforeUpdate':function(_0x333359,_0x5b4cb0,_0x466db9){if(_0x333359[_0xc8e3('0xb')](_0xc8e3('0x27'))||_0x333359[_0xc8e3('0xb')](_0xc8e3('0x10'))||_0x333359[_0xc8e3('0xb')]('clientId')||_0x333359['changed'](_0xc8e3('0xd'))||_0x333359[_0xc8e3('0xb')]('code')||_0x333359[_0xc8e3('0xb')](_0xc8e3('0xf'))){var _0x15e3d9,_0x2ead9c;_0x15e3d9=_0x333359[_0xc8e3('0x10')];var _0x39ad78=_0x15e3d9[_0xc8e3('0x11')](-0x1);if(_0x39ad78==='/'||_0x39ad78==='\x5c'||_0x39ad78===':'){_0x15e3d9=_0x15e3d9[_0xc8e3('0x12')](0x0,_0x15e3d9[_0xc8e3('0x13')](_0x39ad78));}switch(_0x333359[_0xc8e3('0x27')]){case'US':_0x2ead9c='https://accounts.zoho.com';break;case'AU':_0x2ead9c='https://accounts.zoho.com.au';break;case'IN':_0x2ead9c=_0xc8e3('0x16');break;case'CN':_0x2ead9c=_0xc8e3('0x17');break;default:_0x2ead9c=_0xc8e3('0x18');break;}var _0x149639={'method':'POST','uri':_0x2ead9c+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x333359[_0xc8e3('0xc')],'client_secret':_0x333359[_0xc8e3('0xd')],'redirect_uri':_0x333359[_0xc8e3('0x10')],'code':_0x333359[_0xc8e3('0xe')]},'headers':{'Content-Type':_0xc8e3('0x1c')}};return rp(_0x149639)[_0xc8e3('0x1d')](function(_0x2da83d){var _0x47db3e=JSON[_0xc8e3('0x1e')](_0x2da83d);if(_0x47db3e[_0xc8e3('0x1f')]){_0x333359[_0xc8e3('0x28')]=_0x47db3e[_0xc8e3('0x1f')];logger['info'](util['format'](_0xc8e3('0x21'),_0x333359[_0xc8e3('0x22')],_0x333359['id']));}else{logger[_0xc8e3('0x23')](util[_0xc8e3('0x20')](_0xc8e3('0x24'),_0x333359[_0xc8e3('0x22')],_0x333359['id']),util['inspect'](_0x47db3e,{'showHidden':![],'depth':null}));}return _0x466db9(null,_0x5b4cb0);})[_0xc8e3('0x25')](function(_0x29ce1f){logger[_0xc8e3('0x23')](util['format'](_0xc8e3('0x24'),_0x333359['name'],_0x333359['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x466db9(_0x29ce1f);});}else{return _0x466db9(null,_0x5b4cb0);}}}});}; \ No newline at end of file +var _0x483c=['parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','/oauth/v2/token','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then'];(function(_0x734de8,_0xaa4ecc){var _0x2a8de1=function(_0xa253b3){while(--_0xa253b3){_0x734de8['push'](_0x734de8['shift']());}};_0x2a8de1(++_0xaa4ecc);}(_0x483c,0x1d8));var _0xc483=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x483c[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xc483('0x0'));var util=require(_0xc483('0x1'));var logger=require(_0xc483('0x2'))(_0xc483('0x3'));var moment=require(_0xc483('0x4'));var BPromise=require(_0xc483('0x5'));var rp=require(_0xc483('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc483('0x7'));var config=require(_0xc483('0x8'));var attributes=require(_0xc483('0x9'));var integrations=require(_0xc483('0xa'));module[_0xc483('0xb')]=function(_0x300a12,_0x5bab42){return _0x300a12[_0xc483('0xc')](_0xc483('0xd'),attributes,{'tableName':_0xc483('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xdfc1d9,_0x293793,_0x2e43bc){if(_0xdfc1d9[_0xc483('0xf')](_0xc483('0x10'))||_0xdfc1d9['changed'](_0xc483('0x11'))||_0xdfc1d9[_0xc483('0xf')](_0xc483('0x12'))||_0xdfc1d9[_0xc483('0xf')](_0xc483('0x13'))||_0xdfc1d9['changed'](_0xc483('0x14'))||_0xdfc1d9['changed'](_0xc483('0x15'))){var _0x182132,_0x215bc3;_0x182132=_0xdfc1d9['serverUrl'];var _0x1dd1f8=_0x182132[_0xc483('0x16')](-0x1);if(_0x1dd1f8==='/'||_0x1dd1f8==='\x5c'||_0x1dd1f8===':'){_0x182132=_0x182132[_0xc483('0x17')](0x0,_0x182132[_0xc483('0x18')](_0x1dd1f8));}switch(_0xdfc1d9['zone']){case'US':_0x215bc3=_0xc483('0x19');break;case'AU':_0x215bc3=_0xc483('0x1a');break;case'IN':_0x215bc3=_0xc483('0x1b');break;case'CN':_0x215bc3=_0xc483('0x1c');break;default:_0x215bc3=_0xc483('0x1d');break;}var _0x398d2b={'method':_0xc483('0x1e'),'uri':_0x215bc3+'/oauth/v2/token','form':{'grant_type':_0xc483('0x1f'),'client_id':_0xdfc1d9[_0xc483('0x12')],'client_secret':_0xdfc1d9[_0xc483('0x13')],'redirect_uri':_0xdfc1d9[_0xc483('0x11')],'code':_0xdfc1d9[_0xc483('0x14')]},'headers':{'Content-Type':_0xc483('0x20')}};return rp(_0x398d2b)[_0xc483('0x21')](function(_0x198836){var _0x2012d7=JSON[_0xc483('0x22')](_0x198836);if(_0x2012d7[_0xc483('0x23')]){_0xdfc1d9[_0xc483('0x24')]=_0x2012d7[_0xc483('0x23')];logger[_0xc483('0x25')](util[_0xc483('0x26')](_0xc483('0x27'),_0xdfc1d9[_0xc483('0x28')],_0xdfc1d9['id']));}else{logger[_0xc483('0x29')](util['format'](_0xc483('0x2a'),_0xdfc1d9['name'],_0xdfc1d9['id']),util[_0xc483('0x2b')](_0x2012d7,{'showHidden':![],'depth':null}));}return _0x2e43bc(null,_0x293793);})[_0xc483('0x2c')](function(_0x34471a){logger[_0xc483('0x29')](util[_0xc483('0x26')](_0xc483('0x2a'),_0xdfc1d9[_0xc483('0x28')],_0xdfc1d9['id']),util[_0xc483('0x2b')](parsedResult,{'showHidden':![],'depth':null}));return _0x2e43bc(_0x34471a);});}else{return _0x2e43bc(null,_0x293793);}},'beforeUpdate':function(_0x636a93,_0x516b27,_0xc7dabd){if(_0x636a93[_0xc483('0xf')]('zone')||_0x636a93['changed'](_0xc483('0x11'))||_0x636a93[_0xc483('0xf')](_0xc483('0x12'))||_0x636a93[_0xc483('0xf')](_0xc483('0x13'))||_0x636a93[_0xc483('0xf')](_0xc483('0x14'))||_0x636a93[_0xc483('0xf')](_0xc483('0x15'))){var _0x4b70d0,_0x5616ec;_0x4b70d0=_0x636a93[_0xc483('0x11')];var _0x27bf49=_0x4b70d0[_0xc483('0x16')](-0x1);if(_0x27bf49==='/'||_0x27bf49==='\x5c'||_0x27bf49===':'){_0x4b70d0=_0x4b70d0[_0xc483('0x17')](0x0,_0x4b70d0[_0xc483('0x18')](_0x27bf49));}switch(_0x636a93['zone']){case'US':_0x5616ec=_0xc483('0x19');break;case'AU':_0x5616ec=_0xc483('0x1a');break;case'IN':_0x5616ec=_0xc483('0x1b');break;case'CN':_0x5616ec=_0xc483('0x1c');break;default:_0x5616ec='https://accounts.zoho.eu';break;}var _0x22aa2f={'method':'POST','uri':_0x5616ec+_0xc483('0x2d'),'form':{'grant_type':_0xc483('0x1f'),'client_id':_0x636a93['clientId'],'client_secret':_0x636a93[_0xc483('0x13')],'redirect_uri':_0x636a93['serverUrl'],'code':_0x636a93[_0xc483('0x14')]},'headers':{'Content-Type':_0xc483('0x20')}};return rp(_0x22aa2f)[_0xc483('0x21')](function(_0x5a9db7){var _0x59cd2f=JSON[_0xc483('0x22')](_0x5a9db7);if(_0x59cd2f[_0xc483('0x23')]){_0x636a93[_0xc483('0x24')]=_0x59cd2f[_0xc483('0x23')];logger[_0xc483('0x25')](util[_0xc483('0x26')](_0xc483('0x27'),_0x636a93[_0xc483('0x28')],_0x636a93['id']));}else{logger[_0xc483('0x29')](util['format'](_0xc483('0x2a'),_0x636a93[_0xc483('0x28')],_0x636a93['id']),util[_0xc483('0x2b')](_0x59cd2f,{'showHidden':![],'depth':null}));}return _0xc7dabd(null,_0x516b27);})[_0xc483('0x2c')](function(_0x17635){logger[_0xc483('0x29')](util['format'](_0xc483('0x2a'),_0x636a93[_0xc483('0x28')],_0x636a93['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xc7dabd(_0x17635);});}else{return _0xc7dabd(null,_0x516b27);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 6595f44..4c89f93 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 _0x6d5e=['info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetZohoAccount','options','raw','attributes','limit','include','map','model','stringify','ShowZohoAccount','ZohoAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x2c6af3,_0x3ce442){var _0x4895bf=function(_0x5566cf){while(--_0x5566cf){_0x2c6af3['push'](_0x2c6af3['shift']());}};_0x4895bf(++_0x3ce442);}(_0x6d5e,0x103));var _0xe6d5=function(_0x19f82a,_0x531cac){_0x19f82a=_0x19f82a-0x0;var _0x3e00e3=_0x6d5e[_0x19f82a];return _0x3e00e3;};'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);});});}exports[_0xe6d5('0x16')]=function(_0x5f5d7a){var _0x1f4ce6=this;return new Promise(function(_0x5d83a3,_0x3d4fb7){return db['ZohoAccount']['findAll']({'raw':_0x5f5d7a[_0xe6d5('0x17')]?_0x5f5d7a['options'][_0xe6d5('0x18')]===undefined?!![]:![]:!![],'where':_0x5f5d7a[_0xe6d5('0x17')]?_0x5f5d7a[_0xe6d5('0x17')]['where']||null:null,'attributes':_0x5f5d7a['options']?_0x5f5d7a[_0xe6d5('0x17')][_0xe6d5('0x19')]||null:null,'limit':_0x5f5d7a[_0xe6d5('0x17')]?_0x5f5d7a[_0xe6d5('0x17')][_0xe6d5('0x1a')]||null:null,'include':_0x5f5d7a['options']?_0x5f5d7a[_0xe6d5('0x17')][_0xe6d5('0x1b')]?_['map'](_0x5f5d7a[_0xe6d5('0x17')][_0xe6d5('0x1b')],function(_0x150aaf){return{'model':db[_0x150aaf['model']],'as':_0x150aaf['as'],'attributes':_0x150aaf[_0xe6d5('0x19')],'include':_0x150aaf[_0xe6d5('0x1b')]?_[_0xe6d5('0x1c')](_0x150aaf[_0xe6d5('0x1b')],function(_0x1be7b0){return{'model':db[_0x1be7b0[_0xe6d5('0x1d')]],'as':_0x1be7b0['as'],'attributes':_0x1be7b0[_0xe6d5('0x19')],'include':_0x1be7b0[_0xe6d5('0x1b')]?_['map'](_0x1be7b0[_0xe6d5('0x1b')],function(_0x210b00){return{'model':db[_0x210b00[_0xe6d5('0x1d')]],'as':_0x210b00['as'],'attributes':_0x210b00[_0xe6d5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c90dc){logger['info'](_0xe6d5('0x16'),_0x5f5d7a);logger[_0xe6d5('0xf')]('GetZohoAccount',_0x5f5d7a,JSON[_0xe6d5('0x1e')](_0x3c90dc));_0x5d83a3(_0x3c90dc);})['catch'](function(_0x4377bc){logger[_0xe6d5('0x12')](_0xe6d5('0x16'),_0x4377bc[_0xe6d5('0x14')],_0x5f5d7a);_0x3d4fb7(_0x1f4ce6[_0xe6d5('0x12')](0x1f4,_0x4377bc[_0xe6d5('0x14')]));});});};exports[_0xe6d5('0x1f')]=function(_0x53da30){var _0x392551=this;return new Promise(function(_0x2973b6,_0x2f780d){return db[_0xe6d5('0x20')]['find']({'raw':_0x53da30[_0xe6d5('0x17')]?_0x53da30[_0xe6d5('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x53da30[_0xe6d5('0x17')]?_0x53da30['options'][_0xe6d5('0x21')]||null:null,'attributes':_0x53da30['options']?_0x53da30[_0xe6d5('0x17')]['attributes']||null:null,'include':_0x53da30[_0xe6d5('0x17')]?_0x53da30[_0xe6d5('0x17')][_0xe6d5('0x1b')]?_[_0xe6d5('0x1c')](_0x53da30['options'][_0xe6d5('0x1b')],function(_0x350441){return{'model':db[_0x350441['model']],'as':_0x350441['as'],'attributes':_0x350441[_0xe6d5('0x19')],'include':_0x350441[_0xe6d5('0x1b')]?_['map'](_0x350441[_0xe6d5('0x1b')],function(_0x28466a){return{'model':db[_0x28466a['model']],'as':_0x28466a['as'],'attributes':_0x28466a[_0xe6d5('0x19')],'include':_0x28466a[_0xe6d5('0x1b')]?_[_0xe6d5('0x1c')](_0x28466a[_0xe6d5('0x1b')],function(_0x28cedb){return{'model':db[_0x28cedb[_0xe6d5('0x1d')]],'as':_0x28cedb['as'],'attributes':_0x28cedb[_0xe6d5('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe6d5('0xc')](function(_0x56f90d){logger['info'](_0xe6d5('0x1f'),_0x53da30);logger[_0xe6d5('0xf')](_0xe6d5('0x1f'),_0x53da30,JSON[_0xe6d5('0x1e')](_0x56f90d));_0x2973b6(_0x56f90d);})[_0xe6d5('0x15')](function(_0x4f604d){logger[_0xe6d5('0x12')](_0xe6d5('0x1f'),_0x4f604d[_0xe6d5('0x14')],_0x53da30);_0x2f780d(_0x392551[_0xe6d5('0x12')](0x1f4,_0x4f604d[_0xe6d5('0x14')]));});});}; \ No newline at end of file +var _0x1c63=['map','model','ShowZohoAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','raw','options','where','attributes','limit','include'];(function(_0x30233a,_0x24c736){var _0x314b7d=function(_0x4db730){while(--_0x4db730){_0x30233a['push'](_0x30233a['shift']());}};_0x314b7d(++_0x24c736);}(_0x1c63,0xdc));var _0x31c6=function(_0x1afadf,_0x357131){_0x1afadf=_0x1afadf-0x0;var _0x3a3b4a=_0x1c63[_0x1afadf];return _0x3a3b4a;};'use strict';var _=require(_0x31c6('0x0'));var util=require(_0x31c6('0x1'));var moment=require(_0x31c6('0x2'));var BPromise=require(_0x31c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31c6('0x4'));var db=require(_0x31c6('0x5'))['db'];var utils=require(_0x31c6('0x6'));var logger=require('../../config/logger')(_0x31c6('0x7'));var config=require(_0x31c6('0x8'));var jayson=require(_0x31c6('0x9'));var client=jayson[_0x31c6('0xa')][_0x31c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ac1b7,_0x560053,_0x30185e){return new BPromise(function(_0x184d7d,_0x37cc89){return client[_0x31c6('0xc')](_0x4ac1b7,_0x30185e)[_0x31c6('0xd')](function(_0x487e6e){logger[_0x31c6('0xe')](_0x31c6('0xf'),_0x560053,_0x31c6('0x10'));logger[_0x31c6('0x11')](_0x31c6('0x12'),_0x560053,'request\x20sent',JSON[_0x31c6('0x13')](_0x487e6e));if(_0x487e6e['error']){if(_0x487e6e[_0x31c6('0x14')][_0x31c6('0x15')]===0x1f4){logger['error'](_0x31c6('0xf'),_0x560053,_0x487e6e[_0x31c6('0x14')][_0x31c6('0x16')]);return _0x37cc89(_0x487e6e[_0x31c6('0x14')][_0x31c6('0x16')]);}logger[_0x31c6('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x560053,_0x487e6e[_0x31c6('0x14')][_0x31c6('0x16')]);return _0x184d7d(_0x487e6e[_0x31c6('0x14')][_0x31c6('0x16')]);}else{logger[_0x31c6('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x560053,'request\x20sent');_0x184d7d(_0x487e6e['result']['message']);}})[_0x31c6('0x17')](function(_0x512d53){logger[_0x31c6('0x14')](_0x31c6('0xf'),_0x560053,_0x512d53);_0x37cc89(_0x512d53);});});}exports[_0x31c6('0x18')]=function(_0xf352af){var _0x20f9a2=this;return new Promise(function(_0x4c7f34,_0x162061){return db[_0x31c6('0x19')]['findAll']({'raw':_0xf352af['options']?_0xf352af['options'][_0x31c6('0x1a')]===undefined?!![]:![]:!![],'where':_0xf352af[_0x31c6('0x1b')]?_0xf352af[_0x31c6('0x1b')][_0x31c6('0x1c')]||null:null,'attributes':_0xf352af['options']?_0xf352af['options'][_0x31c6('0x1d')]||null:null,'limit':_0xf352af[_0x31c6('0x1b')]?_0xf352af['options'][_0x31c6('0x1e')]||null:null,'include':_0xf352af[_0x31c6('0x1b')]?_0xf352af[_0x31c6('0x1b')][_0x31c6('0x1f')]?_[_0x31c6('0x20')](_0xf352af['options'][_0x31c6('0x1f')],function(_0x536e57){return{'model':db[_0x536e57[_0x31c6('0x21')]],'as':_0x536e57['as'],'attributes':_0x536e57[_0x31c6('0x1d')],'include':_0x536e57['include']?_['map'](_0x536e57['include'],function(_0x412a8a){return{'model':db[_0x412a8a[_0x31c6('0x21')]],'as':_0x412a8a['as'],'attributes':_0x412a8a['attributes'],'include':_0x412a8a[_0x31c6('0x1f')]?_[_0x31c6('0x20')](_0x412a8a[_0x31c6('0x1f')],function(_0x2fb5f3){return{'model':db[_0x2fb5f3['model']],'as':_0x2fb5f3['as'],'attributes':_0x2fb5f3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x53fa6c){logger[_0x31c6('0xe')]('GetZohoAccount',_0xf352af);logger['debug'](_0x31c6('0x18'),_0xf352af,JSON[_0x31c6('0x13')](_0x53fa6c));_0x4c7f34(_0x53fa6c);})['catch'](function(_0x41100c){logger['error'](_0x31c6('0x18'),_0x41100c[_0x31c6('0x16')],_0xf352af);_0x162061(_0x20f9a2['error'](0x1f4,_0x41100c[_0x31c6('0x16')]));});});};exports[_0x31c6('0x22')]=function(_0x28937c){var _0x3399fe=this;return new Promise(function(_0x202f45,_0x35c366){return db['ZohoAccount'][_0x31c6('0x23')]({'raw':_0x28937c[_0x31c6('0x1b')]?_0x28937c['options'][_0x31c6('0x1a')]===undefined?!![]:![]:!![],'where':_0x28937c[_0x31c6('0x1b')]?_0x28937c['options']['where']||null:null,'attributes':_0x28937c['options']?_0x28937c[_0x31c6('0x1b')][_0x31c6('0x1d')]||null:null,'include':_0x28937c['options']?_0x28937c[_0x31c6('0x1b')][_0x31c6('0x1f')]?_[_0x31c6('0x20')](_0x28937c[_0x31c6('0x1b')][_0x31c6('0x1f')],function(_0x57143f){return{'model':db[_0x57143f[_0x31c6('0x21')]],'as':_0x57143f['as'],'attributes':_0x57143f[_0x31c6('0x1d')],'include':_0x57143f[_0x31c6('0x1f')]?_[_0x31c6('0x20')](_0x57143f[_0x31c6('0x1f')],function(_0xb25a7e){return{'model':db[_0xb25a7e[_0x31c6('0x21')]],'as':_0xb25a7e['as'],'attributes':_0xb25a7e[_0x31c6('0x1d')],'include':_0xb25a7e[_0x31c6('0x1f')]?_['map'](_0xb25a7e[_0x31c6('0x1f')],function(_0x2cc3d1){return{'model':db[_0x2cc3d1['model']],'as':_0x2cc3d1['as'],'attributes':_0x2cc3d1[_0x31c6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x31c6('0xd')](function(_0x488b35){logger[_0x31c6('0xe')](_0x31c6('0x22'),_0x28937c);logger[_0x31c6('0x11')]('ShowZohoAccount',_0x28937c,JSON[_0x31c6('0x13')](_0x488b35));_0x202f45(_0x488b35);})['catch'](function(_0x2a776d){logger[_0x31c6('0x14')](_0x31c6('0x22'),_0x2a776d['message'],_0x28937c);_0x35c366(_0x3399fe[_0x31c6('0x14')](0x1f4,_0x2a776d[_0x31c6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7569cab..29bcf1d 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 _0x532e=['fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x140ec1,_0x434ad1){var _0x3ca125=function(_0x41a1e3){while(--_0x41a1e3){_0x140ec1['push'](_0x140ec1['shift']());}};_0x3ca125(++_0x434ad1);}(_0x532e,0xff));var _0xe532=function(_0x4824e9,_0x3ce660){_0x4824e9=_0x4824e9-0x0;var _0x2cae0c=_0x532e[_0x4824e9];return _0x2cae0c;};'use strict';var multer=require(_0xe532('0x0'));var util=require(_0xe532('0x1'));var path=require(_0xe532('0x2'));var timeout=require('connect-timeout');var express=require(_0xe532('0x3'));var router=express[_0xe532('0x4')]();var fs_extra=require(_0xe532('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe532('0x6'));var config=require(_0xe532('0x7'));var controller=require(_0xe532('0x8'));router[_0xe532('0x9')]('/',auth[_0xe532('0xa')](),controller[_0xe532('0xb')]);router[_0xe532('0x9')](_0xe532('0xc'),auth[_0xe532('0xa')](),controller['show']);router[_0xe532('0x9')](_0xe532('0xd'),auth['isAuthenticated'](),controller[_0xe532('0xe')]);router[_0xe532('0x9')](_0xe532('0xf'),auth[_0xe532('0xa')](),controller['getSubjects']);router[_0xe532('0x9')]('/:id/descriptions',auth[_0xe532('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0xe532('0xa')](),controller['create']);router[_0xe532('0x10')]('/:id',auth[_0xe532('0xa')](),controller[_0xe532('0x11')]);router[_0xe532('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe532('0x13')]=router; \ No newline at end of file +var _0xb21d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5a7933,_0x44921a){var _0x3a6dd1=function(_0x556cc8){while(--_0x556cc8){_0x5a7933['push'](_0x5a7933['shift']());}};_0x3a6dd1(++_0x44921a);}(_0xb21d,0x84));var _0xdb21=function(_0x255fec,_0x29327a){_0x255fec=_0x255fec-0x0;var _0x3321f6=_0xb21d[_0x255fec];return _0x3321f6;};'use strict';var multer=require(_0xdb21('0x0'));var util=require(_0xdb21('0x1'));var path=require(_0xdb21('0x2'));var timeout=require(_0xdb21('0x3'));var express=require(_0xdb21('0x4'));var router=express[_0xdb21('0x5')]();var fs_extra=require(_0xdb21('0x6'));var auth=require(_0xdb21('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdb21('0x8'));var controller=require(_0xdb21('0x9'));router['get']('/',auth[_0xdb21('0xa')](),controller[_0xdb21('0xb')]);router[_0xdb21('0xc')](_0xdb21('0xd'),auth['isAuthenticated'](),controller[_0xdb21('0xe')]);router[_0xdb21('0xc')]('/:id/fields',auth[_0xdb21('0xa')](),controller[_0xdb21('0xf')]);router[_0xdb21('0xc')](_0xdb21('0x10'),auth[_0xdb21('0xa')](),controller[_0xdb21('0x11')]);router[_0xdb21('0xc')](_0xdb21('0x12'),auth[_0xdb21('0xa')](),controller[_0xdb21('0x13')]);router[_0xdb21('0x14')]('/',auth[_0xdb21('0xa')](),controller[_0xdb21('0x15')]);router[_0xdb21('0x16')](_0xdb21('0xd'),auth[_0xdb21('0xa')](),controller[_0xdb21('0x17')]);router[_0xdb21('0x18')](_0xdb21('0xd'),auth[_0xdb21('0xa')](),controller[_0xdb21('0x19')]);module[_0xdb21('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 11677e0..277ed4f 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 _0x474d=['contact','STRING','sequelize','ENUM','lead','contact_lead'];(function(_0x1f5210,_0xb187a1){var _0x58e9fd=function(_0x57020c){while(--_0x57020c){_0x1f5210['push'](_0x1f5210['shift']());}};_0x58e9fd(++_0xb187a1);}(_0x474d,0x13a));var _0xd474=function(_0x42346f,_0x45a7e7){_0x42346f=_0x42346f-0x0;var _0x4993d0=_0x474d[_0x42346f];return _0x4993d0;};'use strict';var Sequelize=require(_0xd474('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xd474('0x1')](_0xd474('0x2'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xd474('0x1')](_0xd474('0x3'),_0xd474('0x4'),_0xd474('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xd474('0x5')]}}; \ No newline at end of file +var _0x9ea3=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9ea3,0x126));var _0x39ea=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x9ea3[_0x39e283];return _0x7de89f;};'use strict';var Sequelize=require(_0x39ea('0x0'));module[_0x39ea('0x1')]={'name':{'type':Sequelize[_0x39ea('0x2')]},'moduleCreate':{'type':Sequelize[_0x39ea('0x3')](_0x39ea('0x4'),_0x39ea('0x5'),_0x39ea('0x6')),'defaultValue':_0x39ea('0x4')},'moduleSearch':{'type':Sequelize[_0x39ea('0x3')]('contact_lead',_0x39ea('0x5'),'lead'),'defaultValue':_0x39ea('0x7')},'description':{'type':Sequelize[_0x39ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 19ea658..5c6cb00 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 _0x275f=['includeAll','include','findAll','rows','catch','params','intersection','options','create','body','find','getFields','findOne','pick','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../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','apply','reject','save','update','then','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x275f,0x1df));var _0xf275=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x275f[_0x23a79e];return _0x3dab57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf275('0x0'));var zipdir=require(_0xf275('0x1'));var jsonpatch=require(_0xf275('0x2'));var rp=require(_0xf275('0x3'));var moment=require('moment');var BPromise=require(_0xf275('0x4'));var Mustache=require(_0xf275('0x5'));var util=require(_0xf275('0x6'));var path=require('path');var sox=require(_0xf275('0x7'));var csv=require(_0xf275('0x8'));var ejs=require(_0xf275('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf275('0xa'));var squel=require(_0xf275('0xb'));var crypto=require(_0xf275('0xc'));var jsforce=require(_0xf275('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf275('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf275('0xe'));var as=require(_0xf275('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf275('0x10'))(_0xf275('0x11'));var utils=require(_0xf275('0x12'));var config=require(_0xf275('0x13'));var licenseUtil=require(_0xf275('0x14'));var db=require(_0xf275('0x15'))['db'];function respondWithStatusCode(_0x39410a,_0x44d764){_0x44d764=_0x44d764||0xcc;return function(_0x402ddb){if(_0x402ddb){return _0x39410a[_0xf275('0x16')](_0x44d764);}return _0x39410a[_0xf275('0x17')](_0x44d764)[_0xf275('0x18')]();};}function respondWithResult(_0x2f4e41,_0x27808e){_0x27808e=_0x27808e||0xc8;return function(_0x139a64){if(_0x139a64){return _0x2f4e41[_0xf275('0x17')](_0x27808e)[_0xf275('0x19')](_0x139a64);}};}function respondWithFilteredResult(_0x2566ce,_0x270758){return function(_0x22af43){if(_0x22af43){var _0x435d43=typeof _0x270758[_0xf275('0x1a')]===_0xf275('0x1b')&&typeof _0x270758[_0xf275('0x1c')]===_0xf275('0x1b');var _0x1642a7=_0x22af43[_0xf275('0x1d')];var _0x21b8dd=_0x435d43?0x0:_0x270758[_0xf275('0x1a')];var _0x108966=_0x435d43?_0x22af43[_0xf275('0x1d')]:_0x270758[_0xf275('0x1a')]+_0x270758[_0xf275('0x1c')];var _0x4fa207;if(_0x108966>=_0x1642a7){_0x108966=_0x1642a7;_0x4fa207=0xc8;}else{_0x4fa207=0xce;}_0x2566ce[_0xf275('0x17')](_0x4fa207);return _0x2566ce[_0xf275('0x1e')]('Content-Range',_0x21b8dd+'-'+_0x108966+'/'+_0x1642a7)[_0xf275('0x19')](_0x22af43);}return null;};}function patchUpdates(_0xf741af){return function(_0x528c3d){try{jsonpatch[_0xf275('0x1f')](_0x528c3d,_0xf741af,!![]);}catch(_0x2cf8a7){return BPromise[_0xf275('0x20')](_0x2cf8a7);}return _0x528c3d[_0xf275('0x21')]();};}function saveUpdates(_0x88df8e,_0x41ef4f){return function(_0x360e96){if(_0x360e96){return _0x360e96[_0xf275('0x22')](_0x88df8e)['then'](function(_0x1066df){return _0x1066df;});}return null;};}function removeEntity(_0x59fd3e,_0x2f65b1){return function(_0x5189cc){if(_0x5189cc){return _0x5189cc['destroy']()[_0xf275('0x23')](function(){_0x59fd3e['status'](0xcc)[_0xf275('0x18')]();});}};}function handleEntityNotFound(_0x454f6c,_0x39d297){return function(_0x4c923e){if(!_0x4c923e){_0x454f6c[_0xf275('0x16')](0x194);}return _0x4c923e;};}function handleError(_0x507f24,_0x5f37f0){_0x5f37f0=_0x5f37f0||0x1f4;return function(_0x1e6d9f){logger['error'](_0x1e6d9f[_0xf275('0x24')]);if(_0x1e6d9f['name']){delete _0x1e6d9f[_0xf275('0x25')];}_0x507f24[_0xf275('0x17')](_0x5f37f0)[_0xf275('0x26')](_0x1e6d9f);};}exports[_0xf275('0x27')]=function(_0x5858ef,_0xd05431){var _0x5c8425={},_0x4b038f={},_0x3fedd5={'count':0x0,'rows':[]};var _0x5ef801=_[_0xf275('0x28')](db[_0xf275('0x29')][_0xf275('0x2a')],function(_0x2f78c7){return{'name':_0x2f78c7[_0xf275('0x2b')],'type':_0x2f78c7[_0xf275('0x2c')][_0xf275('0x2d')]};});_0x4b038f[_0xf275('0x2e')]=_[_0xf275('0x28')](_0x5ef801,_0xf275('0x25'));_0x4b038f[_0xf275('0x2f')]=_[_0xf275('0x30')](_0x5858ef['query']);_0x4b038f[_0xf275('0x31')]=_['intersection'](_0x4b038f[_0xf275('0x2e')],_0x4b038f[_0xf275('0x2f')]);_0x5c8425[_0xf275('0x32')]=_['intersection'](_0x4b038f[_0xf275('0x2e')],qs[_0xf275('0x33')](_0x5858ef[_0xf275('0x2f')][_0xf275('0x33')]));_0x5c8425[_0xf275('0x32')]=_0x5c8425[_0xf275('0x32')][_0xf275('0x34')]?_0x5c8425['attributes']:_0x4b038f[_0xf275('0x2e')];if(!_0x5858ef[_0xf275('0x2f')][_0xf275('0x35')](_0xf275('0x36'))){_0x5c8425[_0xf275('0x1c')]=qs[_0xf275('0x1c')](_0x5858ef['query'][_0xf275('0x1c')]);_0x5c8425[_0xf275('0x1a')]=qs[_0xf275('0x1a')](_0x5858ef['query'][_0xf275('0x1a')]);}_0x5c8425[_0xf275('0x37')]=qs[_0xf275('0x38')](_0x5858ef['query'][_0xf275('0x38')]);_0x5c8425['where']=qs[_0xf275('0x31')](_['pick'](_0x5858ef[_0xf275('0x2f')],_0x4b038f[_0xf275('0x31')]),_0x5ef801);if(_0x5858ef[_0xf275('0x2f')][_0xf275('0x39')]){_0x5c8425[_0xf275('0x3a')]=_[_0xf275('0x3b')](_0x5c8425[_0xf275('0x3a')],{'$or':_[_0xf275('0x28')](_0x5ef801,function(_0x20f40e){if(_0x20f40e[_0xf275('0x2c')]!=='VIRTUAL'){var _0x17e7a4={};_0x17e7a4[_0x20f40e[_0xf275('0x25')]]={'$like':'%'+_0x5858ef['query'][_0xf275('0x39')]+'%'};return _0x17e7a4;}})});}_0x5c8425=_[_0xf275('0x3b')]({},_0x5c8425,_0x5858ef['options']);var _0x91a2ab={'where':_0x5c8425['where']};return db[_0xf275('0x29')][_0xf275('0x1d')](_0x91a2ab)[_0xf275('0x23')](function(_0x3548e1){_0x3fedd5[_0xf275('0x1d')]=_0x3548e1;if(_0x5858ef[_0xf275('0x2f')][_0xf275('0x3c')]){_0x5c8425[_0xf275('0x3d')]=[{'all':!![]}];}return db[_0xf275('0x29')][_0xf275('0x3e')](_0x5c8425);})['then'](function(_0x194baa){_0x3fedd5[_0xf275('0x3f')]=_0x194baa;return _0x3fedd5;})[_0xf275('0x23')](respondWithFilteredResult(_0xd05431,_0x5c8425))[_0xf275('0x40')](handleError(_0xd05431,null));};exports['show']=function(_0x2fc708,_0x15dc7c){var _0x5a976d={'raw':![],'where':{'id':_0x2fc708[_0xf275('0x41')]['id']}},_0x16497c={};_0x16497c[_0xf275('0x2e')]=_[_0xf275('0x30')](db[_0xf275('0x29')]['rawAttributes']);_0x16497c[_0xf275('0x2f')]=_[_0xf275('0x30')](_0x2fc708[_0xf275('0x2f')]);_0x16497c[_0xf275('0x31')]=_['intersection'](_0x16497c[_0xf275('0x2e')],_0x16497c[_0xf275('0x2f')]);_0x5a976d[_0xf275('0x32')]=_[_0xf275('0x42')](_0x16497c[_0xf275('0x2e')],qs['fields'](_0x2fc708[_0xf275('0x2f')][_0xf275('0x33')]));_0x5a976d['attributes']=_0x5a976d[_0xf275('0x32')][_0xf275('0x34')]?_0x5a976d[_0xf275('0x32')]:_0x16497c[_0xf275('0x2e')];if(_0x2fc708[_0xf275('0x2f')][_0xf275('0x3c')]){_0x5a976d[_0xf275('0x3d')]=[{'all':!![]}];}_0x5a976d=_[_0xf275('0x3b')]({},_0x5a976d,_0x2fc708[_0xf275('0x43')]);return db['ZohoConfiguration']['find'](_0x5a976d)['then'](handleEntityNotFound(_0x15dc7c,null))[_0xf275('0x23')](respondWithResult(_0x15dc7c,null))[_0xf275('0x40')](handleError(_0x15dc7c,null));};exports[_0xf275('0x44')]=function(_0x5a9685,_0x2856c9){return db[_0xf275('0x29')][_0xf275('0x44')](_0x5a9685[_0xf275('0x45')],{})[_0xf275('0x23')](respondWithResult(_0x2856c9,0xc9))['catch'](handleError(_0x2856c9,null));};exports[_0xf275('0x22')]=function(_0x2d298c,_0x6e2e7b){if(_0x2d298c[_0xf275('0x45')]['id']){delete _0x2d298c[_0xf275('0x45')]['id'];}return db['ZohoConfiguration'][_0xf275('0x46')]({'where':{'id':_0x2d298c[_0xf275('0x41')]['id']}})['then'](handleEntityNotFound(_0x6e2e7b,null))[_0xf275('0x23')](saveUpdates(_0x2d298c[_0xf275('0x45')],null))[_0xf275('0x23')](respondWithResult(_0x6e2e7b,null))[_0xf275('0x40')](handleError(_0x6e2e7b,null));};exports['destroy']=function(_0x4007d4,_0x2f5559){return db['ZohoConfiguration']['find']({'where':{'id':_0x4007d4['params']['id']}})[_0xf275('0x23')](handleEntityNotFound(_0x2f5559,null))[_0xf275('0x23')](removeEntity(_0x2f5559,null))[_0xf275('0x40')](handleError(_0x2f5559,null));};exports[_0xf275('0x47')]=function(_0x40c82a,_0x49c293,_0x1fd039){var _0x210cbf={};var _0x5b0479={};var _0x333612;var _0x47486a;return db[_0xf275('0x29')][_0xf275('0x48')]({'where':{'id':_0x40c82a[_0xf275('0x41')]['id']}})['then'](handleEntityNotFound(_0x49c293,null))[_0xf275('0x23')](function(_0x679008){if(_0x679008){_0x333612=_0x679008;_0x5b0479[_0xf275('0x2e')]=_[_0xf275('0x30')](db['ZohoField'][_0xf275('0x2a')]);_0x5b0479[_0xf275('0x2f')]=_[_0xf275('0x30')](_0x40c82a[_0xf275('0x2f')]);_0x5b0479[_0xf275('0x31')]=_[_0xf275('0x42')](_0x5b0479['model'],_0x5b0479[_0xf275('0x2f')]);_0x210cbf['attributes']=_[_0xf275('0x42')](_0x5b0479[_0xf275('0x2e')],qs['fields'](_0x40c82a[_0xf275('0x2f')][_0xf275('0x33')]));_0x210cbf['attributes']=_0x210cbf[_0xf275('0x32')][_0xf275('0x34')]?_0x210cbf[_0xf275('0x32')]:_0x5b0479['model'];_0x210cbf[_0xf275('0x37')]=qs[_0xf275('0x38')](_0x40c82a[_0xf275('0x2f')][_0xf275('0x38')]);_0x210cbf[_0xf275('0x3a')]=qs[_0xf275('0x31')](_[_0xf275('0x49')](_0x40c82a[_0xf275('0x2f')],_0x5b0479[_0xf275('0x31')]));if(_0x40c82a[_0xf275('0x2f')][_0xf275('0x39')]){_0x210cbf[_0xf275('0x3a')]=_['merge'](_0x210cbf[_0xf275('0x3a')],{'$or':_[_0xf275('0x28')](_0x210cbf['attributes'],function(_0x5576fc){var _0x5c9b97={};_0x5c9b97[_0x5576fc]={'$like':'%'+_0x40c82a['query'][_0xf275('0x39')]+'%'};return _0x5c9b97;})});}_0x210cbf=_[_0xf275('0x3b')]({},_0x210cbf,_0x40c82a[_0xf275('0x43')]);return _0x333612[_0xf275('0x47')](_0x210cbf);}})[_0xf275('0x23')](function(_0x32deba){if(_0x32deba){_0x47486a=_0x32deba[_0xf275('0x34')];if(!_0x40c82a['query'][_0xf275('0x35')](_0xf275('0x36'))){_0x210cbf[_0xf275('0x1c')]=qs[_0xf275('0x1c')](_0x40c82a[_0xf275('0x2f')][_0xf275('0x1c')]);_0x210cbf[_0xf275('0x1a')]=qs[_0xf275('0x1a')](_0x40c82a['query']['offset']);}return _0x333612[_0xf275('0x47')](_0x210cbf);}})[_0xf275('0x23')](function(_0xe74005){if(_0xe74005){return _0xe74005?{'count':_0x47486a,'rows':_0xe74005}:null;}})[_0xf275('0x23')](respondWithResult(_0x49c293,null))['catch'](handleError(_0x49c293,null));};exports[_0xf275('0x4a')]=function(_0x38a372,_0x323743,_0x598027){var _0x248323={};var _0x465da4={};var _0x400949;var _0x15dae1;return db['ZohoConfiguration'][_0xf275('0x48')]({'where':{'id':_0x38a372[_0xf275('0x41')]['id']}})[_0xf275('0x23')](handleEntityNotFound(_0x323743,null))['then'](function(_0x4ae989){if(_0x4ae989){_0x400949=_0x4ae989;_0x465da4[_0xf275('0x2e')]=_[_0xf275('0x30')](db[_0xf275('0x4b')]['rawAttributes']);_0x465da4[_0xf275('0x2f')]=_[_0xf275('0x30')](_0x38a372[_0xf275('0x2f')]);_0x465da4[_0xf275('0x31')]=_['intersection'](_0x465da4['model'],_0x465da4['query']);_0x248323[_0xf275('0x32')]=_[_0xf275('0x42')](_0x465da4['model'],qs[_0xf275('0x33')](_0x38a372[_0xf275('0x2f')][_0xf275('0x33')]));_0x248323[_0xf275('0x32')]=_0x248323[_0xf275('0x32')][_0xf275('0x34')]?_0x248323[_0xf275('0x32')]:_0x465da4['model'];_0x248323[_0xf275('0x37')]=qs['sort'](_0x38a372[_0xf275('0x2f')]['sort']);_0x248323[_0xf275('0x3a')]=qs[_0xf275('0x31')](_[_0xf275('0x49')](_0x38a372[_0xf275('0x2f')],_0x465da4['filters']));if(_0x38a372[_0xf275('0x2f')][_0xf275('0x39')]){_0x248323['where']=_[_0xf275('0x3b')](_0x248323['where'],{'$or':_[_0xf275('0x28')](_0x248323['attributes'],function(_0x38b443){var _0x466351={};_0x466351[_0x38b443]={'$like':'%'+_0x38a372[_0xf275('0x2f')][_0xf275('0x39')]+'%'};return _0x466351;})});}_0x248323=_['merge']({},_0x248323,_0x38a372[_0xf275('0x43')]);return _0x400949[_0xf275('0x4a')](_0x248323);}})[_0xf275('0x23')](function(_0x2e1f9a){if(_0x2e1f9a){_0x15dae1=_0x2e1f9a[_0xf275('0x34')];if(!_0x38a372[_0xf275('0x2f')][_0xf275('0x35')]('nolimit')){_0x248323[_0xf275('0x1c')]=qs['limit'](_0x38a372[_0xf275('0x2f')][_0xf275('0x1c')]);_0x248323[_0xf275('0x1a')]=qs['offset'](_0x38a372[_0xf275('0x2f')][_0xf275('0x1a')]);}return _0x400949[_0xf275('0x4a')](_0x248323);}})[_0xf275('0x23')](function(_0x232b9e){if(_0x232b9e){return _0x232b9e?{'count':_0x15dae1,'rows':_0x232b9e}:null;}})[_0xf275('0x23')](respondWithResult(_0x323743,null))[_0xf275('0x40')](handleError(_0x323743,null));};exports[_0xf275('0x4c')]=function(_0x171d2d,_0x2da93f,_0x5c07da){var _0x5f4bb4={};var _0x1c6c7a={};var _0x30ecf9;var _0x118c24;return db[_0xf275('0x29')][_0xf275('0x48')]({'where':{'id':_0x171d2d['params']['id']}})[_0xf275('0x23')](handleEntityNotFound(_0x2da93f,null))['then'](function(_0x50b5e5){if(_0x50b5e5){_0x30ecf9=_0x50b5e5;_0x1c6c7a['model']=_['keys'](db['ZohoField'][_0xf275('0x2a')]);_0x1c6c7a[_0xf275('0x2f')]=_[_0xf275('0x30')](_0x171d2d['query']);_0x1c6c7a[_0xf275('0x31')]=_['intersection'](_0x1c6c7a[_0xf275('0x2e')],_0x1c6c7a['query']);_0x5f4bb4[_0xf275('0x32')]=_[_0xf275('0x42')](_0x1c6c7a[_0xf275('0x2e')],qs['fields'](_0x171d2d[_0xf275('0x2f')]['fields']));_0x5f4bb4['attributes']=_0x5f4bb4[_0xf275('0x32')][_0xf275('0x34')]?_0x5f4bb4[_0xf275('0x32')]:_0x1c6c7a[_0xf275('0x2e')];_0x5f4bb4[_0xf275('0x37')]=qs[_0xf275('0x38')](_0x171d2d[_0xf275('0x2f')][_0xf275('0x38')]);_0x5f4bb4[_0xf275('0x3a')]=qs[_0xf275('0x31')](_[_0xf275('0x49')](_0x171d2d[_0xf275('0x2f')],_0x1c6c7a[_0xf275('0x31')]));if(_0x171d2d[_0xf275('0x2f')][_0xf275('0x39')]){_0x5f4bb4[_0xf275('0x3a')]=_['merge'](_0x5f4bb4[_0xf275('0x3a')],{'$or':_[_0xf275('0x28')](_0x5f4bb4['attributes'],function(_0x1add33){var _0x1f491b={};_0x1f491b[_0x1add33]={'$like':'%'+_0x171d2d['query'][_0xf275('0x39')]+'%'};return _0x1f491b;})});}_0x5f4bb4=_[_0xf275('0x3b')]({},_0x5f4bb4,_0x171d2d[_0xf275('0x43')]);return _0x30ecf9[_0xf275('0x4c')](_0x5f4bb4);}})[_0xf275('0x23')](function(_0x5430b3){if(_0x5430b3){_0x118c24=_0x5430b3[_0xf275('0x34')];if(!_0x171d2d['query'][_0xf275('0x35')](_0xf275('0x36'))){_0x5f4bb4['limit']=qs[_0xf275('0x1c')](_0x171d2d[_0xf275('0x2f')][_0xf275('0x1c')]);_0x5f4bb4['offset']=qs[_0xf275('0x1a')](_0x171d2d['query'][_0xf275('0x1a')]);}return _0x30ecf9[_0xf275('0x4c')](_0x5f4bb4);}})[_0xf275('0x23')](function(_0x5b910e){if(_0x5b910e){return _0x5b910e?{'count':_0x118c24,'rows':_0x5b910e}:null;}})[_0xf275('0x23')](respondWithResult(_0x2da93f,null))[_0xf275('0x40')](handleError(_0x2da93f,null));}; \ No newline at end of file +var _0x7104=['update','then','destroy','error','stack','name','send','ZohoConfiguration','rawAttributes','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','catch','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7104,0x197));var _0x4710=function(_0x5cfc8b,_0x28b20e){_0x5cfc8b=_0x5cfc8b-0x0;var _0x42170e=_0x7104[_0x5cfc8b];return _0x42170e;};'use strict';var emlformat=require(_0x4710('0x0'));var rimraf=require(_0x4710('0x1'));var zipdir=require(_0x4710('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4710('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4710('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4710('0x5'));var csv=require(_0x4710('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4710('0x7'));var _=require(_0x4710('0x8'));var squel=require('squel');var crypto=require(_0x4710('0x9'));var jsforce=require(_0x4710('0xa'));var deskjs=require(_0x4710('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4710('0xc'));var Papa=require('papaparse');var Redis=require(_0x4710('0xd'));var authService=require(_0x4710('0xe'));var qs=require(_0x4710('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4710('0x10'))(_0x4710('0x11'));var utils=require('../../config/utils');var config=require(_0x4710('0x12'));var licenseUtil=require(_0x4710('0x13'));var db=require(_0x4710('0x14'))['db'];function respondWithStatusCode(_0x1d76da,_0x25f07d){_0x25f07d=_0x25f07d||0xcc;return function(_0x513061){if(_0x513061){return _0x1d76da['sendStatus'](_0x25f07d);}return _0x1d76da[_0x4710('0x15')](_0x25f07d)[_0x4710('0x16')]();};}function respondWithResult(_0x3c5195,_0x233a19){_0x233a19=_0x233a19||0xc8;return function(_0x290ae5){if(_0x290ae5){return _0x3c5195[_0x4710('0x15')](_0x233a19)['json'](_0x290ae5);}};}function respondWithFilteredResult(_0x311ec0,_0x1b4a6a){return function(_0x559c64){if(_0x559c64){var _0x311ff1=typeof _0x1b4a6a[_0x4710('0x17')]===_0x4710('0x18')&&typeof _0x1b4a6a[_0x4710('0x19')]===_0x4710('0x18');var _0x1b5e53=_0x559c64[_0x4710('0x1a')];var _0x1ffeee=_0x311ff1?0x0:_0x1b4a6a['offset'];var _0x2dbbcb=_0x311ff1?_0x559c64['count']:_0x1b4a6a[_0x4710('0x17')]+_0x1b4a6a['limit'];var _0x3e35ca;if(_0x2dbbcb>=_0x1b5e53){_0x2dbbcb=_0x1b5e53;_0x3e35ca=0xc8;}else{_0x3e35ca=0xce;}_0x311ec0[_0x4710('0x15')](_0x3e35ca);return _0x311ec0[_0x4710('0x1b')](_0x4710('0x1c'),_0x1ffeee+'-'+_0x2dbbcb+'/'+_0x1b5e53)['json'](_0x559c64);}return null;};}function patchUpdates(_0x4a40a2){return function(_0x28b53f){try{jsonpatch['apply'](_0x28b53f,_0x4a40a2,!![]);}catch(_0x15c69a){return BPromise[_0x4710('0x1d')](_0x15c69a);}return _0x28b53f[_0x4710('0x1e')]();};}function saveUpdates(_0x38ecc8,_0xa890a8){return function(_0x2f4e82){if(_0x2f4e82){return _0x2f4e82[_0x4710('0x1f')](_0x38ecc8)[_0x4710('0x20')](function(_0x477d50){return _0x477d50;});}return null;};}function removeEntity(_0x177aa8,_0x599464){return function(_0x32f057){if(_0x32f057){return _0x32f057[_0x4710('0x21')]()[_0x4710('0x20')](function(){_0x177aa8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a9c1d,_0x94dee7){return function(_0x539677){if(!_0x539677){_0x5a9c1d['sendStatus'](0x194);}return _0x539677;};}function handleError(_0x141bcd,_0x38f1b9){_0x38f1b9=_0x38f1b9||0x1f4;return function(_0x3dfdc9){logger[_0x4710('0x22')](_0x3dfdc9[_0x4710('0x23')]);if(_0x3dfdc9[_0x4710('0x24')]){delete _0x3dfdc9[_0x4710('0x24')];}_0x141bcd[_0x4710('0x15')](_0x38f1b9)[_0x4710('0x25')](_0x3dfdc9);};}exports['index']=function(_0x805f79,_0x17683e){var _0x3ecaa4={},_0x24cc49={},_0x4e9a2b={'count':0x0,'rows':[]};var _0x31fb50=_['map'](db[_0x4710('0x26')][_0x4710('0x27')],function(_0x16e8aa){return{'name':_0x16e8aa['fieldName'],'type':_0x16e8aa[_0x4710('0x28')]['key']};});_0x24cc49[_0x4710('0x29')]=_[_0x4710('0x2a')](_0x31fb50,_0x4710('0x24'));_0x24cc49[_0x4710('0x2b')]=_['keys'](_0x805f79[_0x4710('0x2b')]);_0x24cc49['filters']=_['intersection'](_0x24cc49[_0x4710('0x29')],_0x24cc49[_0x4710('0x2b')]);_0x3ecaa4['attributes']=_[_0x4710('0x2c')](_0x24cc49[_0x4710('0x29')],qs['fields'](_0x805f79['query'][_0x4710('0x2d')]));_0x3ecaa4[_0x4710('0x2e')]=_0x3ecaa4[_0x4710('0x2e')][_0x4710('0x2f')]?_0x3ecaa4[_0x4710('0x2e')]:_0x24cc49[_0x4710('0x29')];if(!_0x805f79[_0x4710('0x2b')][_0x4710('0x30')](_0x4710('0x31'))){_0x3ecaa4[_0x4710('0x19')]=qs[_0x4710('0x19')](_0x805f79[_0x4710('0x2b')]['limit']);_0x3ecaa4[_0x4710('0x17')]=qs[_0x4710('0x17')](_0x805f79[_0x4710('0x2b')][_0x4710('0x17')]);}_0x3ecaa4[_0x4710('0x32')]=qs[_0x4710('0x33')](_0x805f79[_0x4710('0x2b')]['sort']);_0x3ecaa4[_0x4710('0x34')]=qs[_0x4710('0x35')](_[_0x4710('0x36')](_0x805f79[_0x4710('0x2b')],_0x24cc49[_0x4710('0x35')]),_0x31fb50);if(_0x805f79[_0x4710('0x2b')][_0x4710('0x37')]){_0x3ecaa4['where']=_[_0x4710('0x38')](_0x3ecaa4['where'],{'$or':_['map'](_0x31fb50,function(_0x185f1e){if(_0x185f1e[_0x4710('0x28')]!=='VIRTUAL'){var _0x400112={};_0x400112[_0x185f1e[_0x4710('0x24')]]={'$like':'%'+_0x805f79[_0x4710('0x2b')][_0x4710('0x37')]+'%'};return _0x400112;}})});}_0x3ecaa4=_[_0x4710('0x38')]({},_0x3ecaa4,_0x805f79[_0x4710('0x39')]);var _0x15526b={'where':_0x3ecaa4[_0x4710('0x34')]};return db[_0x4710('0x26')][_0x4710('0x1a')](_0x15526b)['then'](function(_0x31aa18){_0x4e9a2b[_0x4710('0x1a')]=_0x31aa18;if(_0x805f79[_0x4710('0x2b')][_0x4710('0x3a')]){_0x3ecaa4[_0x4710('0x3b')]=[{'all':!![]}];}return db[_0x4710('0x26')][_0x4710('0x3c')](_0x3ecaa4);})[_0x4710('0x20')](function(_0x201c61){_0x4e9a2b['rows']=_0x201c61;return _0x4e9a2b;})[_0x4710('0x20')](respondWithFilteredResult(_0x17683e,_0x3ecaa4))['catch'](handleError(_0x17683e,null));};exports[_0x4710('0x3d')]=function(_0x56841d,_0x1f3dd3){var _0x318d17={'raw':![],'where':{'id':_0x56841d[_0x4710('0x3e')]['id']}},_0x395b13={};_0x395b13['model']=_[_0x4710('0x3f')](db[_0x4710('0x26')][_0x4710('0x27')]);_0x395b13[_0x4710('0x2b')]=_[_0x4710('0x3f')](_0x56841d[_0x4710('0x2b')]);_0x395b13[_0x4710('0x35')]=_['intersection'](_0x395b13[_0x4710('0x29')],_0x395b13[_0x4710('0x2b')]);_0x318d17['attributes']=_[_0x4710('0x2c')](_0x395b13[_0x4710('0x29')],qs[_0x4710('0x2d')](_0x56841d[_0x4710('0x2b')][_0x4710('0x2d')]));_0x318d17['attributes']=_0x318d17[_0x4710('0x2e')][_0x4710('0x2f')]?_0x318d17[_0x4710('0x2e')]:_0x395b13['model'];if(_0x56841d[_0x4710('0x2b')][_0x4710('0x3a')]){_0x318d17['include']=[{'all':!![]}];}_0x318d17=_['merge']({},_0x318d17,_0x56841d[_0x4710('0x39')]);return db['ZohoConfiguration']['find'](_0x318d17)['then'](handleEntityNotFound(_0x1f3dd3,null))[_0x4710('0x20')](respondWithResult(_0x1f3dd3,null))[_0x4710('0x40')](handleError(_0x1f3dd3,null));};exports['create']=function(_0x348190,_0x2d8ed8){return db[_0x4710('0x26')][_0x4710('0x41')](_0x348190[_0x4710('0x42')],{})['then'](respondWithResult(_0x2d8ed8,0xc9))[_0x4710('0x40')](handleError(_0x2d8ed8,null));};exports['update']=function(_0x45985f,_0x537f4a){if(_0x45985f[_0x4710('0x42')]['id']){delete _0x45985f[_0x4710('0x42')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x45985f['params']['id']}})['then'](handleEntityNotFound(_0x537f4a,null))[_0x4710('0x20')](saveUpdates(_0x45985f['body'],null))[_0x4710('0x20')](respondWithResult(_0x537f4a,null))['catch'](handleError(_0x537f4a,null));};exports['destroy']=function(_0x4d32f4,_0x7d5171){return db[_0x4710('0x26')][_0x4710('0x43')]({'where':{'id':_0x4d32f4[_0x4710('0x3e')]['id']}})[_0x4710('0x20')](handleEntityNotFound(_0x7d5171,null))['then'](removeEntity(_0x7d5171,null))['catch'](handleError(_0x7d5171,null));};exports[_0x4710('0x44')]=function(_0x27459c,_0x3cf194,_0x85a3ad){var _0x4b2566={};var _0x45f2fa={};var _0x5f447b;var _0x4a8d8d;return db[_0x4710('0x26')][_0x4710('0x45')]({'where':{'id':_0x27459c[_0x4710('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3cf194,null))[_0x4710('0x20')](function(_0xdd446e){if(_0xdd446e){_0x5f447b=_0xdd446e;_0x45f2fa[_0x4710('0x29')]=_['keys'](db[_0x4710('0x46')]['rawAttributes']);_0x45f2fa[_0x4710('0x2b')]=_[_0x4710('0x3f')](_0x27459c[_0x4710('0x2b')]);_0x45f2fa[_0x4710('0x35')]=_[_0x4710('0x2c')](_0x45f2fa[_0x4710('0x29')],_0x45f2fa['query']);_0x4b2566[_0x4710('0x2e')]=_[_0x4710('0x2c')](_0x45f2fa[_0x4710('0x29')],qs['fields'](_0x27459c['query'][_0x4710('0x2d')]));_0x4b2566[_0x4710('0x2e')]=_0x4b2566[_0x4710('0x2e')][_0x4710('0x2f')]?_0x4b2566[_0x4710('0x2e')]:_0x45f2fa['model'];_0x4b2566['order']=qs[_0x4710('0x33')](_0x27459c['query'][_0x4710('0x33')]);_0x4b2566[_0x4710('0x34')]=qs[_0x4710('0x35')](_[_0x4710('0x36')](_0x27459c[_0x4710('0x2b')],_0x45f2fa[_0x4710('0x35')]));if(_0x27459c['query']['filter']){_0x4b2566[_0x4710('0x34')]=_[_0x4710('0x38')](_0x4b2566['where'],{'$or':_[_0x4710('0x2a')](_0x4b2566[_0x4710('0x2e')],function(_0x56ed08){var _0x2a27c5={};_0x2a27c5[_0x56ed08]={'$like':'%'+_0x27459c[_0x4710('0x2b')]['filter']+'%'};return _0x2a27c5;})});}_0x4b2566=_[_0x4710('0x38')]({},_0x4b2566,_0x27459c[_0x4710('0x39')]);return _0x5f447b[_0x4710('0x44')](_0x4b2566);}})[_0x4710('0x20')](function(_0x580ac6){if(_0x580ac6){_0x4a8d8d=_0x580ac6[_0x4710('0x2f')];if(!_0x27459c['query']['hasOwnProperty']('nolimit')){_0x4b2566['limit']=qs[_0x4710('0x19')](_0x27459c[_0x4710('0x2b')][_0x4710('0x19')]);_0x4b2566[_0x4710('0x17')]=qs[_0x4710('0x17')](_0x27459c[_0x4710('0x2b')][_0x4710('0x17')]);}return _0x5f447b['getFields'](_0x4b2566);}})[_0x4710('0x20')](function(_0x25d732){if(_0x25d732){return _0x25d732?{'count':_0x4a8d8d,'rows':_0x25d732}:null;}})['then'](respondWithResult(_0x3cf194,null))[_0x4710('0x40')](handleError(_0x3cf194,null));};exports['getSubjects']=function(_0x46ddae,_0x1e6293,_0x53e15c){var _0x2c9a40={};var _0x131444={};var _0x4fe120;var _0x52405d;return db[_0x4710('0x26')]['findOne']({'where':{'id':_0x46ddae[_0x4710('0x3e')]['id']}})[_0x4710('0x20')](handleEntityNotFound(_0x1e6293,null))[_0x4710('0x20')](function(_0xf7bada){if(_0xf7bada){_0x4fe120=_0xf7bada;_0x131444[_0x4710('0x29')]=_['keys'](db[_0x4710('0x46')][_0x4710('0x27')]);_0x131444[_0x4710('0x2b')]=_[_0x4710('0x3f')](_0x46ddae['query']);_0x131444[_0x4710('0x35')]=_[_0x4710('0x2c')](_0x131444[_0x4710('0x29')],_0x131444[_0x4710('0x2b')]);_0x2c9a40[_0x4710('0x2e')]=_[_0x4710('0x2c')](_0x131444[_0x4710('0x29')],qs[_0x4710('0x2d')](_0x46ddae[_0x4710('0x2b')][_0x4710('0x2d')]));_0x2c9a40[_0x4710('0x2e')]=_0x2c9a40[_0x4710('0x2e')][_0x4710('0x2f')]?_0x2c9a40[_0x4710('0x2e')]:_0x131444[_0x4710('0x29')];_0x2c9a40[_0x4710('0x32')]=qs[_0x4710('0x33')](_0x46ddae[_0x4710('0x2b')][_0x4710('0x33')]);_0x2c9a40[_0x4710('0x34')]=qs[_0x4710('0x35')](_[_0x4710('0x36')](_0x46ddae[_0x4710('0x2b')],_0x131444[_0x4710('0x35')]));if(_0x46ddae['query'][_0x4710('0x37')]){_0x2c9a40[_0x4710('0x34')]=_[_0x4710('0x38')](_0x2c9a40[_0x4710('0x34')],{'$or':_[_0x4710('0x2a')](_0x2c9a40['attributes'],function(_0xe02acd){var _0x4905b4={};_0x4905b4[_0xe02acd]={'$like':'%'+_0x46ddae[_0x4710('0x2b')][_0x4710('0x37')]+'%'};return _0x4905b4;})});}_0x2c9a40=_['merge']({},_0x2c9a40,_0x46ddae[_0x4710('0x39')]);return _0x4fe120[_0x4710('0x47')](_0x2c9a40);}})[_0x4710('0x20')](function(_0x37706e){if(_0x37706e){_0x52405d=_0x37706e[_0x4710('0x2f')];if(!_0x46ddae['query'][_0x4710('0x30')]('nolimit')){_0x2c9a40['limit']=qs[_0x4710('0x19')](_0x46ddae[_0x4710('0x2b')][_0x4710('0x19')]);_0x2c9a40['offset']=qs[_0x4710('0x17')](_0x46ddae['query'][_0x4710('0x17')]);}return _0x4fe120[_0x4710('0x47')](_0x2c9a40);}})[_0x4710('0x20')](function(_0x29f6de){if(_0x29f6de){return _0x29f6de?{'count':_0x52405d,'rows':_0x29f6de}:null;}})[_0x4710('0x20')](respondWithResult(_0x1e6293,null))[_0x4710('0x40')](handleError(_0x1e6293,null));};exports['getDescriptions']=function(_0x4437fe,_0x513e29,_0x4e19ee){var _0x3063cf={};var _0x13f340={};var _0x10ae81;var _0x245d75;return db[_0x4710('0x26')][_0x4710('0x45')]({'where':{'id':_0x4437fe[_0x4710('0x3e')]['id']}})[_0x4710('0x20')](handleEntityNotFound(_0x513e29,null))[_0x4710('0x20')](function(_0x363a34){if(_0x363a34){_0x10ae81=_0x363a34;_0x13f340[_0x4710('0x29')]=_[_0x4710('0x3f')](db['ZohoField']['rawAttributes']);_0x13f340[_0x4710('0x2b')]=_['keys'](_0x4437fe[_0x4710('0x2b')]);_0x13f340['filters']=_['intersection'](_0x13f340[_0x4710('0x29')],_0x13f340[_0x4710('0x2b')]);_0x3063cf[_0x4710('0x2e')]=_['intersection'](_0x13f340[_0x4710('0x29')],qs[_0x4710('0x2d')](_0x4437fe['query'][_0x4710('0x2d')]));_0x3063cf[_0x4710('0x2e')]=_0x3063cf[_0x4710('0x2e')][_0x4710('0x2f')]?_0x3063cf[_0x4710('0x2e')]:_0x13f340[_0x4710('0x29')];_0x3063cf[_0x4710('0x32')]=qs[_0x4710('0x33')](_0x4437fe[_0x4710('0x2b')][_0x4710('0x33')]);_0x3063cf[_0x4710('0x34')]=qs[_0x4710('0x35')](_[_0x4710('0x36')](_0x4437fe[_0x4710('0x2b')],_0x13f340['filters']));if(_0x4437fe[_0x4710('0x2b')]['filter']){_0x3063cf['where']=_[_0x4710('0x38')](_0x3063cf['where'],{'$or':_[_0x4710('0x2a')](_0x3063cf[_0x4710('0x2e')],function(_0x4f1955){var _0xe81200={};_0xe81200[_0x4f1955]={'$like':'%'+_0x4437fe['query'][_0x4710('0x37')]+'%'};return _0xe81200;})});}_0x3063cf=_[_0x4710('0x38')]({},_0x3063cf,_0x4437fe[_0x4710('0x39')]);return _0x10ae81[_0x4710('0x48')](_0x3063cf);}})[_0x4710('0x20')](function(_0x31bc01){if(_0x31bc01){_0x245d75=_0x31bc01[_0x4710('0x2f')];if(!_0x4437fe[_0x4710('0x2b')][_0x4710('0x30')](_0x4710('0x31'))){_0x3063cf[_0x4710('0x19')]=qs[_0x4710('0x19')](_0x4437fe[_0x4710('0x2b')][_0x4710('0x19')]);_0x3063cf['offset']=qs['offset'](_0x4437fe['query'][_0x4710('0x17')]);}return _0x10ae81[_0x4710('0x48')](_0x3063cf);}})['then'](function(_0x5a2a07){if(_0x5a2a07){return _0x5a2a07?{'count':_0x245d75,'rows':_0x5a2a07}:null;}})['then'](respondWithResult(_0x513e29,null))[_0x4710('0x40')](handleError(_0x513e29,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 202cbe2..37cf83a 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 _0xbc30=['rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','moment','request-promise'];(function(_0x5b6b74,_0x4db7dd){var _0x3a37b2=function(_0x14c2e9){while(--_0x14c2e9){_0x5b6b74['push'](_0x5b6b74['shift']());}};_0x3a37b2(++_0x4db7dd);}(_0xbc30,0x83));var _0x0bc3=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xbc30[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x0bc3('0x0'));var util=require('util');var logger=require(_0x0bc3('0x1'))('api');var moment=require(_0x0bc3('0x2'));var BPromise=require('bluebird');var rp=require(_0x0bc3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bc3('0x4'));var config=require('../../config/environment');var attributes=require(_0x0bc3('0x5'));module[_0x0bc3('0x6')]=function(_0x295803,_0x28c456){return _0x295803['define'](_0x0bc3('0x7'),attributes,{'tableName':_0x0bc3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c96=['path','rimraf','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','moment','bluebird'];(function(_0x5521ee,_0x79f420){var _0x547f6a=function(_0xf54d7c){while(--_0xf54d7c){_0x5521ee['push'](_0x5521ee['shift']());}};_0x547f6a(++_0x79f420);}(_0x4c96,0xa7));var _0x64c9=function(_0x933876,_0x5e99d8){_0x933876=_0x933876-0x0;var _0x39dea5=_0x4c96[_0x933876];return _0x39dea5;};'use strict';var _=require('lodash');var util=require(_0x64c9('0x0'));var logger=require(_0x64c9('0x1'))('api');var moment=require(_0x64c9('0x2'));var BPromise=require(_0x64c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64c9('0x4'));var rimraf=require(_0x64c9('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x64c9('0x6')]=function(_0x1de155,_0x43a4ed){return _0x1de155['define'](_0x64c9('0x7'),attributes,{'tableName':_0x64c9('0x8'),'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 5c316ac..b708da3 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 _0xd96f=['client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x599fdc,_0x1f1138){var _0x98ea0f=function(_0x2bfd54){while(--_0x2bfd54){_0x599fdc['push'](_0x599fdc['shift']());}};_0x98ea0f(++_0x1f1138);}(_0xd96f,0x6a));var _0xfd96=function(_0x5b8b24,_0x30d30c){_0x5b8b24=_0x5b8b24-0x0;var _0x39eb97=_0xd96f[_0x5b8b24];return _0x39eb97;};'use strict';var _=require(_0xfd96('0x0'));var util=require(_0xfd96('0x1'));var moment=require(_0xfd96('0x2'));var BPromise=require(_0xfd96('0x3'));var rs=require(_0xfd96('0x4'));var fs=require('fs');var Redis=require(_0xfd96('0x5'));var db=require(_0xfd96('0x6'))['db'];var utils=require(_0xfd96('0x7'));var logger=require(_0xfd96('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd96('0x9')][_0xfd96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a08ce,_0x3997ca,_0x26299f){return new BPromise(function(_0x316bb1,_0x14d47b){return client[_0xfd96('0xb')](_0x3a08ce,_0x26299f)[_0xfd96('0xc')](function(_0x17e4d3){logger[_0xfd96('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x3997ca,_0xfd96('0xe'));logger[_0xfd96('0xf')](_0xfd96('0x10'),_0x3997ca,_0xfd96('0xe'),JSON['stringify'](_0x17e4d3));if(_0x17e4d3[_0xfd96('0x11')]){if(_0x17e4d3['error'][_0xfd96('0x12')]===0x1f4){logger['error'](_0xfd96('0x13'),_0x3997ca,_0x17e4d3[_0xfd96('0x11')][_0xfd96('0x14')]);return _0x14d47b(_0x17e4d3['error'][_0xfd96('0x14')]);}logger[_0xfd96('0x11')](_0xfd96('0x13'),_0x3997ca,_0x17e4d3[_0xfd96('0x11')]['message']);return _0x316bb1(_0x17e4d3[_0xfd96('0x11')][_0xfd96('0x14')]);}else{logger[_0xfd96('0xd')](_0xfd96('0x13'),_0x3997ca,_0xfd96('0xe'));_0x316bb1(_0x17e4d3[_0xfd96('0x15')][_0xfd96('0x14')]);}})[_0xfd96('0x16')](function(_0x13d1db){logger[_0xfd96('0x11')](_0xfd96('0x13'),_0x3997ca,_0x13d1db);_0x14d47b(_0x13d1db);});});} \ No newline at end of file +var _0xc46f=['http','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x231ee5,_0x27a8ce){var _0x13ffb3=function(_0x170ac7){while(--_0x170ac7){_0x231ee5['push'](_0x231ee5['shift']());}};_0x13ffb3(++_0x27a8ce);}(_0xc46f,0x1e6));var _0xfc46=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc46f[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xfc46('0x0'));var util=require(_0xfc46('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfc46('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc46('0x3'))['db'];var utils=require(_0xfc46('0x4'));var logger=require('../../config/logger')(_0xfc46('0x5'));var config=require(_0xfc46('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc46('0x7')][_0xfc46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x390af2,_0x8013a0,_0x221e9b){return new BPromise(function(_0x5bf9c1,_0x409377){return client['request'](_0x390af2,_0x221e9b)['then'](function(_0x4c1dba){logger[_0xfc46('0x9')]('ZohoConfiguration,\x20%s,\x20%s',_0x8013a0,_0xfc46('0xa'));logger[_0xfc46('0xb')](_0xfc46('0xc'),_0x8013a0,_0xfc46('0xa'),JSON[_0xfc46('0xd')](_0x4c1dba));if(_0x4c1dba[_0xfc46('0xe')]){if(_0x4c1dba[_0xfc46('0xe')][_0xfc46('0xf')]===0x1f4){logger[_0xfc46('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x8013a0,_0x4c1dba['error'][_0xfc46('0x10')]);return _0x409377(_0x4c1dba[_0xfc46('0xe')]['message']);}logger[_0xfc46('0xe')](_0xfc46('0x11'),_0x8013a0,_0x4c1dba['error'][_0xfc46('0x10')]);return _0x5bf9c1(_0x4c1dba[_0xfc46('0xe')]['message']);}else{logger[_0xfc46('0x9')](_0xfc46('0x11'),_0x8013a0,_0xfc46('0xa'));_0x5bf9c1(_0x4c1dba['result'][_0xfc46('0x10')]);}})[_0xfc46('0x12')](function(_0x509198){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x8013a0,_0x509198);_0x409377(_0x509198);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9892e34..712215e 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 _0xb9e9=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x5ead32,_0x8c736d){var _0x18db62=function(_0x2ba6f8){while(--_0x2ba6f8){_0x5ead32['push'](_0x5ead32['shift']());}};_0x18db62(++_0x8c736d);}(_0xb9e9,0xf0));var _0x9b9e=function(_0x8969c2,_0xc524b7){_0x8969c2=_0x8969c2-0x0;var _0x519f23=_0xb9e9[_0x8969c2];return _0x519f23;};'use strict';var multer=require(_0x9b9e('0x0'));var util=require(_0x9b9e('0x1'));var path=require(_0x9b9e('0x2'));var timeout=require(_0x9b9e('0x3'));var express=require('express');var router=express[_0x9b9e('0x4')]();var fs_extra=require(_0x9b9e('0x5'));var auth=require(_0x9b9e('0x6'));var interaction=require(_0x9b9e('0x7'));var config=require(_0x9b9e('0x8'));var controller=require(_0x9b9e('0x9'));router[_0x9b9e('0xa')]('/',auth[_0x9b9e('0xb')](),controller[_0x9b9e('0xc')]);router[_0x9b9e('0xa')](_0x9b9e('0xd'),auth[_0x9b9e('0xb')](),controller[_0x9b9e('0xe')]);router[_0x9b9e('0xf')]('/',auth[_0x9b9e('0xb')](),controller[_0x9b9e('0x10')]);router[_0x9b9e('0x11')](_0x9b9e('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9b9e('0x12')](_0x9b9e('0xd'),auth['isAuthenticated'](),controller[_0x9b9e('0x13')]);module[_0x9b9e('0x14')]=router; \ No newline at end of file +var _0x3479=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','post','put','/:id','delete','destroy','exports','multer','path'];(function(_0x8b195b,_0x1d4f6c){var _0x5697a4=function(_0x31d865){while(--_0x31d865){_0x8b195b['push'](_0x8b195b['shift']());}};_0x5697a4(++_0x1d4f6c);}(_0x3479,0x1c6));var _0x9347=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x3479[_0x57f345];return _0x255e43;};'use strict';var multer=require(_0x9347('0x0'));var util=require('util');var path=require(_0x9347('0x1'));var timeout=require(_0x9347('0x2'));var express=require(_0x9347('0x3'));var router=express[_0x9347('0x4')]();var fs_extra=require(_0x9347('0x5'));var auth=require(_0x9347('0x6'));var interaction=require(_0x9347('0x7'));var config=require(_0x9347('0x8'));var controller=require(_0x9347('0x9'));router[_0x9347('0xa')]('/',auth[_0x9347('0xb')](),controller[_0x9347('0xc')]);router[_0x9347('0xa')]('/:id',auth[_0x9347('0xb')](),controller['show']);router[_0x9347('0xd')]('/',auth[_0x9347('0xb')](),controller['create']);router[_0x9347('0xe')](_0x9347('0xf'),auth[_0x9347('0xb')](),controller['update']);router[_0x9347('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9347('0x11')]);module[_0x9347('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 5e1724a..1710269 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 _0x05cd=['ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN','exports'];(function(_0x4f4949,_0x249115){var _0x3a934b=function(_0x16a311){while(--_0x16a311){_0x4f4949['push'](_0x4f4949['shift']());}};_0x3a934b(++_0x249115);}(_0x05cd,0x11f));var _0xd05c=function(_0x51541b,_0x2f4b47){_0x51541b=_0x51541b-0x0;var _0x4e5585=_0x05cd[_0x51541b];return _0x4e5585;};'use strict';var Sequelize=require('sequelize');module[_0xd05c('0x0')]={'type':{'type':Sequelize[_0xd05c('0x1')](_0xd05c('0x2'),_0xd05c('0x3'),'customVariable','keyValue',_0xd05c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd05c('0x5')]},'key':{'type':Sequelize[_0xd05c('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xd05c('0x2'),_0xd05c('0x3'),_0xd05c('0x6'))},'keyContent':{'type':Sequelize[_0xd05c('0x5')]},'idField':{'type':Sequelize[_0xd05c('0x5')]},'nameField':{'type':Sequelize[_0xd05c('0x5')]},'customField':{'type':Sequelize[_0xd05c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd05c('0x5')]}}; \ No newline at end of file +var _0x9d14=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xdc12c9,_0x2587c3){var _0x333db0=function(_0x46dc2a){while(--_0x46dc2a){_0xdc12c9['push'](_0xdc12c9['shift']());}};_0x333db0(++_0x2587c3);}(_0x9d14,0x111));var _0x49d1=function(_0x1cccdd,_0x1a5fb1){_0x1cccdd=_0x1cccdd-0x0;var _0x1cf002=_0x9d14[_0x1cccdd];return _0x1cf002;};'use strict';var Sequelize=require(_0x49d1('0x0'));module[_0x49d1('0x1')]={'type':{'type':Sequelize[_0x49d1('0x2')](_0x49d1('0x3'),_0x49d1('0x4'),_0x49d1('0x5'),_0x49d1('0x6'),_0x49d1('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x49d1('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x49d1('0x3'),_0x49d1('0x4'),_0x49d1('0x5'))},'keyContent':{'type':Sequelize[_0x49d1('0x8')]},'idField':{'type':Sequelize[_0x49d1('0x8')]},'nameField':{'type':Sequelize[_0x49d1('0x8')]},'customField':{'type':Sequelize[_0x49d1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49d1('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 14ef05e..9a7410c 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 _0x0111=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','name','send','index','map','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','ZohoField','includeAll','include','findAll','catch','show','params','keys','rawAttributes','intersection','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x192029,_0x374ea7){var _0x542f9e=function(_0x346882){while(--_0x346882){_0x192029['push'](_0x192029['shift']());}};_0x542f9e(++_0x374ea7);}(_0x0111,0x1cb));var _0x1011=function(_0x110cdc,_0x245a35){_0x110cdc=_0x110cdc-0x0;var _0x4ed9e7=_0x0111[_0x110cdc];return _0x4ed9e7;};'use strict';var emlformat=require(_0x1011('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1011('0x1'));var jsonpatch=require(_0x1011('0x2'));var rp=require(_0x1011('0x3'));var moment=require(_0x1011('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1011('0x5'));var util=require(_0x1011('0x6'));var path=require('path');var sox=require(_0x1011('0x7'));var csv=require('to-csv');var ejs=require(_0x1011('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1011('0x9'));var crypto=require(_0x1011('0xa'));var jsforce=require(_0x1011('0xb'));var deskjs=require(_0x1011('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1011('0xd'));var Papa=require('papaparse');var Redis=require(_0x1011('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1011('0xf'));var as=require(_0x1011('0x10'));var hardwareService=require(_0x1011('0x11'));var logger=require(_0x1011('0x12'))(_0x1011('0x13'));var utils=require(_0x1011('0x14'));var config=require(_0x1011('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1011('0x16'))['db'];function respondWithStatusCode(_0x13c930,_0x5b809a){_0x5b809a=_0x5b809a||0xcc;return function(_0x4d0444){if(_0x4d0444){return _0x13c930[_0x1011('0x17')](_0x5b809a);}return _0x13c930[_0x1011('0x18')](_0x5b809a)['end']();};}function respondWithResult(_0x2c6170,_0x241aa5){_0x241aa5=_0x241aa5||0xc8;return function(_0x345e06){if(_0x345e06){return _0x2c6170[_0x1011('0x18')](_0x241aa5)[_0x1011('0x19')](_0x345e06);}};}function respondWithFilteredResult(_0x13d540,_0x5b4dee){return function(_0x16c10d){if(_0x16c10d){var _0x1ea20e=typeof _0x5b4dee[_0x1011('0x1a')]===_0x1011('0x1b')&&typeof _0x5b4dee['limit']===_0x1011('0x1b');var _0x111e5e=_0x16c10d[_0x1011('0x1c')];var _0x4b30c9=_0x1ea20e?0x0:_0x5b4dee[_0x1011('0x1a')];var _0xb65c9e=_0x1ea20e?_0x16c10d['count']:_0x5b4dee[_0x1011('0x1a')]+_0x5b4dee[_0x1011('0x1d')];var _0x3bd145;if(_0xb65c9e>=_0x111e5e){_0xb65c9e=_0x111e5e;_0x3bd145=0xc8;}else{_0x3bd145=0xce;}_0x13d540['status'](_0x3bd145);return _0x13d540['set']('Content-Range',_0x4b30c9+'-'+_0xb65c9e+'/'+_0x111e5e)['json'](_0x16c10d);}return null;};}function patchUpdates(_0x1bb1a1){return function(_0x3ee5c8){try{jsonpatch[_0x1011('0x1e')](_0x3ee5c8,_0x1bb1a1,!![]);}catch(_0x19773d){return BPromise[_0x1011('0x1f')](_0x19773d);}return _0x3ee5c8[_0x1011('0x20')]();};}function saveUpdates(_0x58a9c9,_0x1ec060){return function(_0x35c55b){if(_0x35c55b){return _0x35c55b[_0x1011('0x21')](_0x58a9c9)[_0x1011('0x22')](function(_0x1d0616){return _0x1d0616;});}return null;};}function removeEntity(_0x2e03e8,_0x2670fd){return function(_0x43c991){if(_0x43c991){return _0x43c991[_0x1011('0x23')]()[_0x1011('0x22')](function(){_0x2e03e8[_0x1011('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249410,_0x3f9c3c){return function(_0x2b7366){if(!_0x2b7366){_0x249410['sendStatus'](0x194);}return _0x2b7366;};}function handleError(_0x5bbe8a,_0x51fda4){_0x51fda4=_0x51fda4||0x1f4;return function(_0x43434a){logger[_0x1011('0x24')](_0x43434a['stack']);if(_0x43434a[_0x1011('0x25')]){delete _0x43434a[_0x1011('0x25')];}_0x5bbe8a[_0x1011('0x18')](_0x51fda4)[_0x1011('0x26')](_0x43434a);};}exports[_0x1011('0x27')]=function(_0x5282a7,_0x50f1ad){var _0xbf9554={},_0x316e67={},_0x457296={'count':0x0,'rows':[]};var _0x4a68a3=_[_0x1011('0x28')](db['ZohoField']['rawAttributes'],function(_0x5ceb76){return{'name':_0x5ceb76['fieldName'],'type':_0x5ceb76[_0x1011('0x29')][_0x1011('0x2a')]};});_0x316e67[_0x1011('0x2b')]=_[_0x1011('0x28')](_0x4a68a3,_0x1011('0x25'));_0x316e67[_0x1011('0x2c')]=_['keys'](_0x5282a7['query']);_0x316e67['filters']=_['intersection'](_0x316e67[_0x1011('0x2b')],_0x316e67[_0x1011('0x2c')]);_0xbf9554['attributes']=_['intersection'](_0x316e67[_0x1011('0x2b')],qs[_0x1011('0x2d')](_0x5282a7[_0x1011('0x2c')][_0x1011('0x2d')]));_0xbf9554[_0x1011('0x2e')]=_0xbf9554['attributes'][_0x1011('0x2f')]?_0xbf9554['attributes']:_0x316e67['model'];if(!_0x5282a7['query'][_0x1011('0x30')](_0x1011('0x31'))){_0xbf9554[_0x1011('0x1d')]=qs['limit'](_0x5282a7[_0x1011('0x2c')][_0x1011('0x1d')]);_0xbf9554[_0x1011('0x1a')]=qs[_0x1011('0x1a')](_0x5282a7[_0x1011('0x2c')]['offset']);}_0xbf9554['order']=qs['sort'](_0x5282a7[_0x1011('0x2c')][_0x1011('0x32')]);_0xbf9554[_0x1011('0x33')]=qs[_0x1011('0x34')](_['pick'](_0x5282a7['query'],_0x316e67['filters']),_0x4a68a3);if(_0x5282a7[_0x1011('0x2c')][_0x1011('0x35')]){_0xbf9554['where']=_[_0x1011('0x36')](_0xbf9554[_0x1011('0x33')],{'$or':_['map'](_0x4a68a3,function(_0x4600c7){if(_0x4600c7[_0x1011('0x29')]!=='VIRTUAL'){var _0x320d82={};_0x320d82[_0x4600c7['name']]={'$like':'%'+_0x5282a7[_0x1011('0x2c')]['filter']+'%'};return _0x320d82;}})});}_0xbf9554=_[_0x1011('0x36')]({},_0xbf9554,_0x5282a7[_0x1011('0x37')]);var _0x3a3ddc={'where':_0xbf9554['where']};return db[_0x1011('0x38')][_0x1011('0x1c')](_0x3a3ddc)[_0x1011('0x22')](function(_0x1e46ad){_0x457296['count']=_0x1e46ad;if(_0x5282a7[_0x1011('0x2c')][_0x1011('0x39')]){_0xbf9554[_0x1011('0x3a')]=[{'all':!![]}];}return db[_0x1011('0x38')][_0x1011('0x3b')](_0xbf9554);})[_0x1011('0x22')](function(_0x2f8ad2){_0x457296['rows']=_0x2f8ad2;return _0x457296;})[_0x1011('0x22')](respondWithFilteredResult(_0x50f1ad,_0xbf9554))[_0x1011('0x3c')](handleError(_0x50f1ad,null));};exports[_0x1011('0x3d')]=function(_0x22595b,_0x1e338a){var _0xf72883={'raw':!![],'where':{'id':_0x22595b[_0x1011('0x3e')]['id']}},_0x2f28c7={};_0x2f28c7['model']=_[_0x1011('0x3f')](db[_0x1011('0x38')][_0x1011('0x40')]);_0x2f28c7['query']=_[_0x1011('0x3f')](_0x22595b[_0x1011('0x2c')]);_0x2f28c7[_0x1011('0x34')]=_['intersection'](_0x2f28c7['model'],_0x2f28c7[_0x1011('0x2c')]);_0xf72883[_0x1011('0x2e')]=_[_0x1011('0x41')](_0x2f28c7[_0x1011('0x2b')],qs['fields'](_0x22595b[_0x1011('0x2c')]['fields']));_0xf72883['attributes']=_0xf72883[_0x1011('0x2e')][_0x1011('0x2f')]?_0xf72883[_0x1011('0x2e')]:_0x2f28c7[_0x1011('0x2b')];if(_0x22595b['query'][_0x1011('0x39')]){_0xf72883[_0x1011('0x3a')]=[{'all':!![]}];}_0xf72883=_[_0x1011('0x36')]({},_0xf72883,_0x22595b[_0x1011('0x37')]);return db[_0x1011('0x38')]['find'](_0xf72883)[_0x1011('0x22')](handleEntityNotFound(_0x1e338a,null))[_0x1011('0x22')](respondWithResult(_0x1e338a,null))[_0x1011('0x3c')](handleError(_0x1e338a,null));};exports[_0x1011('0x42')]=function(_0x4cabda,_0x360168){return db[_0x1011('0x38')][_0x1011('0x42')](_0x4cabda[_0x1011('0x43')],{})[_0x1011('0x22')](respondWithResult(_0x360168,0xc9))['catch'](handleError(_0x360168,null));};exports[_0x1011('0x21')]=function(_0x30881f,_0xe7c243){if(_0x30881f[_0x1011('0x43')]['id']){delete _0x30881f[_0x1011('0x43')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x30881f[_0x1011('0x3e')]['id']}})[_0x1011('0x22')](handleEntityNotFound(_0xe7c243,null))['then'](saveUpdates(_0x30881f[_0x1011('0x43')],null))[_0x1011('0x22')](respondWithResult(_0xe7c243,null))[_0x1011('0x3c')](handleError(_0xe7c243,null));};exports[_0x1011('0x23')]=function(_0x57a1f6,_0x110683){return db['ZohoField']['find']({'where':{'id':_0x57a1f6[_0x1011('0x3e')]['id']}})[_0x1011('0x22')](handleEntityNotFound(_0x110683,null))[_0x1011('0x22')](removeEntity(_0x110683,null))['catch'](handleError(_0x110683,null));}; \ No newline at end of file +var _0xf374=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','then','destroy','error','name','send','index','map','ZohoField','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xf374,0x118));var _0x4f37=function(_0x497a09,_0x218a4b){_0x497a09=_0x497a09-0x0;var _0x38468c=_0xf374[_0x497a09];return _0x38468c;};'use strict';var emlformat=require(_0x4f37('0x0'));var rimraf=require(_0x4f37('0x1'));var zipdir=require(_0x4f37('0x2'));var jsonpatch=require(_0x4f37('0x3'));var rp=require(_0x4f37('0x4'));var moment=require(_0x4f37('0x5'));var BPromise=require(_0x4f37('0x6'));var Mustache=require('mustache');var util=require(_0x4f37('0x7'));var path=require(_0x4f37('0x8'));var sox=require(_0x4f37('0x9'));var csv=require(_0x4f37('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f37('0xb'));var _=require('lodash');var squel=require(_0x4f37('0xc'));var crypto=require(_0x4f37('0xd'));var jsforce=require(_0x4f37('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f37('0xa'));var querystring=require('querystring');var Papa=require(_0x4f37('0xf'));var Redis=require(_0x4f37('0x10'));var authService=require(_0x4f37('0x11'));var qs=require(_0x4f37('0x12'));var as=require(_0x4f37('0x13'));var hardwareService=require(_0x4f37('0x14'));var logger=require('../../config/logger')(_0x4f37('0x15'));var utils=require('../../config/utils');var config=require(_0x4f37('0x16'));var licenseUtil=require(_0x4f37('0x17'));var db=require(_0x4f37('0x18'))['db'];function respondWithStatusCode(_0xb52b81,_0x34003d){_0x34003d=_0x34003d||0xcc;return function(_0x176f88){if(_0x176f88){return _0xb52b81[_0x4f37('0x19')](_0x34003d);}return _0xb52b81['status'](_0x34003d)[_0x4f37('0x1a')]();};}function respondWithResult(_0x317187,_0x1ebad3){_0x1ebad3=_0x1ebad3||0xc8;return function(_0x94f97c){if(_0x94f97c){return _0x317187[_0x4f37('0x1b')](_0x1ebad3)['json'](_0x94f97c);}};}function respondWithFilteredResult(_0xd9d4fd,_0x1c7115){return function(_0x4ae325){if(_0x4ae325){var _0xbca7c9=typeof _0x1c7115['offset']===_0x4f37('0x1c')&&typeof _0x1c7115[_0x4f37('0x1d')]==='undefined';var _0x55aa5c=_0x4ae325[_0x4f37('0x1e')];var _0x56b836=_0xbca7c9?0x0:_0x1c7115[_0x4f37('0x1f')];var _0x38314d=_0xbca7c9?_0x4ae325[_0x4f37('0x1e')]:_0x1c7115[_0x4f37('0x1f')]+_0x1c7115[_0x4f37('0x1d')];var _0x1879f1;if(_0x38314d>=_0x55aa5c){_0x38314d=_0x55aa5c;_0x1879f1=0xc8;}else{_0x1879f1=0xce;}_0xd9d4fd[_0x4f37('0x1b')](_0x1879f1);return _0xd9d4fd[_0x4f37('0x20')](_0x4f37('0x21'),_0x56b836+'-'+_0x38314d+'/'+_0x55aa5c)[_0x4f37('0x22')](_0x4ae325);}return null;};}function patchUpdates(_0x31d0c8){return function(_0x28558e){try{jsonpatch['apply'](_0x28558e,_0x31d0c8,!![]);}catch(_0x58025b){return BPromise['reject'](_0x58025b);}return _0x28558e['save']();};}function saveUpdates(_0x2936a4,_0x53580c){return function(_0x954a66){if(_0x954a66){return _0x954a66['update'](_0x2936a4)[_0x4f37('0x23')](function(_0x515e12){return _0x515e12;});}return null;};}function removeEntity(_0x3bb542,_0x5778d1){return function(_0x4820b5){if(_0x4820b5){return _0x4820b5[_0x4f37('0x24')]()[_0x4f37('0x23')](function(){_0x3bb542[_0x4f37('0x1b')](0xcc)[_0x4f37('0x1a')]();});}};}function handleEntityNotFound(_0x5dc45d,_0x53b0c){return function(_0x51034d){if(!_0x51034d){_0x5dc45d[_0x4f37('0x19')](0x194);}return _0x51034d;};}function handleError(_0x2d7a84,_0x55f552){_0x55f552=_0x55f552||0x1f4;return function(_0x16f3f5){logger[_0x4f37('0x25')](_0x16f3f5['stack']);if(_0x16f3f5[_0x4f37('0x26')]){delete _0x16f3f5[_0x4f37('0x26')];}_0x2d7a84[_0x4f37('0x1b')](_0x55f552)[_0x4f37('0x27')](_0x16f3f5);};}exports[_0x4f37('0x28')]=function(_0x3f035c,_0x58a84e){var _0x2c456a={},_0x5e85f0={},_0x4f5b88={'count':0x0,'rows':[]};var _0x174eda=_[_0x4f37('0x29')](db[_0x4f37('0x2a')]['rawAttributes'],function(_0x4f4527){return{'name':_0x4f4527[_0x4f37('0x2b')],'type':_0x4f4527[_0x4f37('0x2c')][_0x4f37('0x2d')]};});_0x5e85f0[_0x4f37('0x2e')]=_['map'](_0x174eda,_0x4f37('0x26'));_0x5e85f0['query']=_[_0x4f37('0x2f')](_0x3f035c['query']);_0x5e85f0['filters']=_['intersection'](_0x5e85f0['model'],_0x5e85f0[_0x4f37('0x30')]);_0x2c456a['attributes']=_[_0x4f37('0x31')](_0x5e85f0[_0x4f37('0x2e')],qs[_0x4f37('0x32')](_0x3f035c['query'][_0x4f37('0x32')]));_0x2c456a[_0x4f37('0x33')]=_0x2c456a[_0x4f37('0x33')][_0x4f37('0x34')]?_0x2c456a[_0x4f37('0x33')]:_0x5e85f0[_0x4f37('0x2e')];if(!_0x3f035c[_0x4f37('0x30')]['hasOwnProperty'](_0x4f37('0x35'))){_0x2c456a[_0x4f37('0x1d')]=qs[_0x4f37('0x1d')](_0x3f035c[_0x4f37('0x30')]['limit']);_0x2c456a[_0x4f37('0x1f')]=qs[_0x4f37('0x1f')](_0x3f035c[_0x4f37('0x30')]['offset']);}_0x2c456a['order']=qs[_0x4f37('0x36')](_0x3f035c['query'][_0x4f37('0x36')]);_0x2c456a['where']=qs[_0x4f37('0x37')](_[_0x4f37('0x38')](_0x3f035c[_0x4f37('0x30')],_0x5e85f0['filters']),_0x174eda);if(_0x3f035c[_0x4f37('0x30')]['filter']){_0x2c456a[_0x4f37('0x39')]=_[_0x4f37('0x3a')](_0x2c456a[_0x4f37('0x39')],{'$or':_[_0x4f37('0x29')](_0x174eda,function(_0x1b3f9f){if(_0x1b3f9f[_0x4f37('0x2c')]!==_0x4f37('0x3b')){var _0xcce0b0={};_0xcce0b0[_0x1b3f9f[_0x4f37('0x26')]]={'$like':'%'+_0x3f035c['query']['filter']+'%'};return _0xcce0b0;}})});}_0x2c456a=_[_0x4f37('0x3a')]({},_0x2c456a,_0x3f035c[_0x4f37('0x3c')]);var _0x127050={'where':_0x2c456a[_0x4f37('0x39')]};return db[_0x4f37('0x2a')]['count'](_0x127050)[_0x4f37('0x23')](function(_0x188f3a){_0x4f5b88['count']=_0x188f3a;if(_0x3f035c[_0x4f37('0x30')][_0x4f37('0x3d')]){_0x2c456a['include']=[{'all':!![]}];}return db[_0x4f37('0x2a')][_0x4f37('0x3e')](_0x2c456a);})[_0x4f37('0x23')](function(_0x59539f){_0x4f5b88[_0x4f37('0x3f')]=_0x59539f;return _0x4f5b88;})[_0x4f37('0x23')](respondWithFilteredResult(_0x58a84e,_0x2c456a))[_0x4f37('0x40')](handleError(_0x58a84e,null));};exports[_0x4f37('0x41')]=function(_0x8a8069,_0xbad421){var _0x1455e4={'raw':!![],'where':{'id':_0x8a8069[_0x4f37('0x42')]['id']}},_0x153c63={};_0x153c63[_0x4f37('0x2e')]=_[_0x4f37('0x2f')](db['ZohoField'][_0x4f37('0x43')]);_0x153c63[_0x4f37('0x30')]=_[_0x4f37('0x2f')](_0x8a8069[_0x4f37('0x30')]);_0x153c63[_0x4f37('0x37')]=_[_0x4f37('0x31')](_0x153c63[_0x4f37('0x2e')],_0x153c63[_0x4f37('0x30')]);_0x1455e4[_0x4f37('0x33')]=_['intersection'](_0x153c63[_0x4f37('0x2e')],qs[_0x4f37('0x32')](_0x8a8069[_0x4f37('0x30')]['fields']));_0x1455e4[_0x4f37('0x33')]=_0x1455e4['attributes'][_0x4f37('0x34')]?_0x1455e4['attributes']:_0x153c63[_0x4f37('0x2e')];if(_0x8a8069['query'][_0x4f37('0x3d')]){_0x1455e4[_0x4f37('0x44')]=[{'all':!![]}];}_0x1455e4=_[_0x4f37('0x3a')]({},_0x1455e4,_0x8a8069['options']);return db[_0x4f37('0x2a')][_0x4f37('0x45')](_0x1455e4)[_0x4f37('0x23')](handleEntityNotFound(_0xbad421,null))[_0x4f37('0x23')](respondWithResult(_0xbad421,null))[_0x4f37('0x40')](handleError(_0xbad421,null));};exports[_0x4f37('0x46')]=function(_0x4d37f0,_0x1ee18c){return db[_0x4f37('0x2a')][_0x4f37('0x46')](_0x4d37f0['body'],{})['then'](respondWithResult(_0x1ee18c,0xc9))[_0x4f37('0x40')](handleError(_0x1ee18c,null));};exports[_0x4f37('0x47')]=function(_0x4bef45,_0xdf2542){if(_0x4bef45[_0x4f37('0x48')]['id']){delete _0x4bef45[_0x4f37('0x48')]['id'];}return db[_0x4f37('0x2a')][_0x4f37('0x45')]({'where':{'id':_0x4bef45[_0x4f37('0x42')]['id']}})[_0x4f37('0x23')](handleEntityNotFound(_0xdf2542,null))[_0x4f37('0x23')](saveUpdates(_0x4bef45[_0x4f37('0x48')],null))[_0x4f37('0x23')](respondWithResult(_0xdf2542,null))[_0x4f37('0x40')](handleError(_0xdf2542,null));};exports[_0x4f37('0x24')]=function(_0x94fa3d,_0xe49fcc){return db['ZohoField']['find']({'where':{'id':_0x94fa3d[_0x4f37('0x42')]['id']}})['then'](handleEntityNotFound(_0xe49fcc,null))[_0x4f37('0x23')](removeEntity(_0xe49fcc,null))[_0x4f37('0x40')](handleError(_0xe49fcc,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index dce9388..6771dab 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 _0x0295=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','idField','lodash','api','request-promise','path'];(function(_0x40302c,_0x59913c){var _0x5ead02=function(_0x55882b){while(--_0x55882b){_0x40302c['push'](_0x40302c['shift']());}};_0x5ead02(++_0x59913c);}(_0x0295,0x1f0));var _0x5029=function(_0xa43518,_0x2a4c6b){_0xa43518=_0xa43518-0x0;var _0x5e9b94=_0x0295[_0xa43518];return _0x5e9b94;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x5029('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6b=['int_zoho_fields','zoho_unique_index','lodash','moment','request-promise','path','rimraf','./intZohoField.attributes','ZohoField'];(function(_0x270e0f,_0x28655f){var _0x1b2848=function(_0x5ce816){while(--_0x5ce816){_0x270e0f['push'](_0x270e0f['shift']());}};_0x1b2848(++_0x28655f);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x3ed49f,_0x26efc3){_0x3ed49f=_0x3ed49f-0x0;var _0x36d4cf=_0x0a6b[_0x3ed49f];return _0x36d4cf;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'paranoid':![],'indexes':[{'name':_0xb0a6('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index ba8df8e..7456340 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 _0xd021=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c3c59,_0x5f251a){var _0x1100b7=function(_0x1cf80c){while(--_0x1cf80c){_0x1c3c59['push'](_0x1c3c59['shift']());}};_0x1100b7(++_0x5f251a);}(_0xd021,0x95));var _0x1d02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd021[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d02('0x0'));var util=require(_0x1d02('0x1'));var moment=require('moment');var BPromise=require(_0x1d02('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d02('0x3'))['db'];var utils=require(_0x1d02('0x4'));var logger=require(_0x1d02('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1d02('0x6'));var client=jayson[_0x1d02('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x294744,_0x199d00,_0xd11a0b){return new BPromise(function(_0x1b1690,_0x4c273a){return client['request'](_0x294744,_0xd11a0b)[_0x1d02('0x8')](function(_0x5b3804){logger[_0x1d02('0x9')](_0x1d02('0xa'),_0x199d00,_0x1d02('0xb'));logger[_0x1d02('0xc')](_0x1d02('0xd'),_0x199d00,_0x1d02('0xb'),JSON[_0x1d02('0xe')](_0x5b3804));if(_0x5b3804[_0x1d02('0xf')]){if(_0x5b3804['error']['code']===0x1f4){logger[_0x1d02('0xf')](_0x1d02('0xa'),_0x199d00,_0x5b3804[_0x1d02('0xf')][_0x1d02('0x10')]);return _0x4c273a(_0x5b3804[_0x1d02('0xf')][_0x1d02('0x10')]);}logger[_0x1d02('0xf')](_0x1d02('0xa'),_0x199d00,_0x5b3804[_0x1d02('0xf')][_0x1d02('0x10')]);return _0x1b1690(_0x5b3804['error']['message']);}else{logger[_0x1d02('0x9')](_0x1d02('0xa'),_0x199d00,_0x1d02('0xb'));_0x1b1690(_0x5b3804[_0x1d02('0x11')][_0x1d02('0x10')]);}})['catch'](function(_0x3af8f6){logger['error'](_0x1d02('0xa'),_0x199d00,_0x3af8f6);_0x4c273a(_0x3af8f6);});});} \ No newline at end of file +var _0x03a1=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x38d7ed,_0x202cd6){var _0x5c6684=function(_0x422ec5){while(--_0x422ec5){_0x38d7ed['push'](_0x38d7ed['shift']());}};_0x5c6684(++_0x202cd6);}(_0x03a1,0xf3));var _0x103a=function(_0x45750d,_0x5c3ba6){_0x45750d=_0x45750d-0x0;var _0x47e77e=_0x03a1[_0x45750d];return _0x47e77e;};'use strict';var _=require(_0x103a('0x0'));var util=require(_0x103a('0x1'));var moment=require(_0x103a('0x2'));var BPromise=require(_0x103a('0x3'));var rs=require(_0x103a('0x4'));var fs=require('fs');var Redis=require(_0x103a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x103a('0x6'));var logger=require('../../config/logger')(_0x103a('0x7'));var config=require('../../config/environment');var jayson=require(_0x103a('0x8'));var client=jayson[_0x103a('0x9')][_0x103a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35af72,_0x41ef12,_0x513b94){return new BPromise(function(_0x324e54,_0x516f76){return client[_0x103a('0xb')](_0x35af72,_0x513b94)['then'](function(_0x26b540){logger[_0x103a('0xc')](_0x103a('0xd'),_0x41ef12,_0x103a('0xe'));logger[_0x103a('0xf')](_0x103a('0x10'),_0x41ef12,_0x103a('0xe'),JSON[_0x103a('0x11')](_0x26b540));if(_0x26b540[_0x103a('0x12')]){if(_0x26b540[_0x103a('0x12')][_0x103a('0x13')]===0x1f4){logger[_0x103a('0x12')](_0x103a('0xd'),_0x41ef12,_0x26b540[_0x103a('0x12')]['message']);return _0x516f76(_0x26b540[_0x103a('0x12')]['message']);}logger[_0x103a('0x12')](_0x103a('0xd'),_0x41ef12,_0x26b540[_0x103a('0x12')][_0x103a('0x14')]);return _0x324e54(_0x26b540[_0x103a('0x12')][_0x103a('0x14')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x41ef12,_0x103a('0xe'));_0x324e54(_0x26b540['result']['message']);}})[_0x103a('0x15')](function(_0x33c450){logger[_0x103a('0x12')]('ZohoField,\x20%s,\x20%s',_0x41ef12,_0x33c450);_0x516f76(_0x33c450);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1f9ff74..cf382a3 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(_0x334c32,_0x40a65d){var _0x2985a4=function(_0x3dbe74){while(--_0x3dbe74){_0x334c32['push'](_0x334c32['shift']());}};_0x2985a4(++_0x40a65d);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x483888,_0x2ff778){var _0x4be161=function(_0x1c1915){while(--_0x1c1915){_0x483888['push'](_0x483888['shift']());}};_0x4be161(++_0x2ff778);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4a58a32..e83d9b7 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 _0x62c0=['INTEGER','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x34a060,_0x1d540b){var _0xecee64=function(_0x2ae76f){while(--_0x2ae76f){_0x34a060['push'](_0x34a060['shift']());}};_0xecee64(++_0x1d540b);}(_0x62c0,0xdb));var _0x062c=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x62c0[_0x1ab180];return _0xfb2c2d;};'use strict';var Sequelize=require(_0x062c('0x0'));module[_0x062c('0x1')]={'name':{'type':Sequelize[_0x062c('0x2')],'allowNull':![],'unique':_0x062c('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x062c('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x062c('0x2')]},'type':{'type':Sequelize[_0x062c('0x2')]},'size':{'type':Sequelize[_0x062c('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x062c('0x2')]},'logo':{'type':Sequelize[_0x062c('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x062c('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x062c('0x2')]},'remoteUri':{'type':Sequelize[_0x062c('0x2')]},'link':{'type':Sequelize[_0x062c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb11e=['exports','STRING','unique_name_and_version','app.js','BOOLEAN','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb11e,0x7d));var _0xeb11=function(_0x4d7c51,_0x1b7582){_0x4d7c51=_0x4d7c51-0x0;var _0x32efac=_0xb11e[_0x4d7c51];return _0x32efac;};'use strict';var Sequelize=require(_0xeb11('0x0'));module[_0xeb11('0x1')]={'name':{'type':Sequelize[_0xeb11('0x2')],'allowNull':![],'unique':_0xeb11('0x3')},'version':{'type':Sequelize[_0xeb11('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xeb11('0x4')},'filename':{'type':Sequelize[_0xeb11('0x2')]},'path':{'type':Sequelize[_0xeb11('0x2')]},'type':{'type':Sequelize[_0xeb11('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xeb11('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xeb11('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xeb11('0x2')]},'remoteUri':{'type':Sequelize[_0xeb11('0x2')]},'link':{'type':Sequelize[_0xeb11('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b11b3c2..ebc4335 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 _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1261,0x144));var _0x1126=function(_0x55e059,_0x2df2c5){_0x55e059=_0x55e059-0x0;var _0x1e6bb7=_0x1261[_0x55e059];return _0x1e6bb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file +var _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x1967,0x173));var _0x7196=function(_0x319c3d,_0x22973d){_0x319c3d=_0x319c3d-0x0;var _0x4ee24a=_0x1967[_0x319c3d];return _0x4ee24a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 71eca64..0dc8283 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 _0x3a66=['api','moment','bluebird','path','rimraf','./integration.attributes','exports','define','lodash','util'];(function(_0x8b6dde,_0x2df0fd){var _0x1e59c4=function(_0x2dc055){while(--_0x2dc055){_0x8b6dde['push'](_0x8b6dde['shift']());}};_0x1e59c4(++_0x2df0fd);}(_0x3a66,0x6c));var _0x63a6=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0x3a66[_0x31b31b];return _0x2c8fc2;};'use strict';var _=require(_0x63a6('0x0'));var util=require(_0x63a6('0x1'));var logger=require('../../config/logger')(_0x63a6('0x2'));var moment=require(_0x63a6('0x3'));var BPromise=require(_0x63a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63a6('0x5'));var rimraf=require(_0x63a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x63a6('0x7'));module[_0x63a6('0x8')]=function(_0x4dae50,_0x2a57bf){return _0x4dae50[_0x63a6('0x9')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa97e=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa97e,0x120));var _0xea97=function(_0x1a746f,_0x207926){_0x1a746f=_0x1a746f-0x0;var _0x25bebd=_0xa97e[_0x1a746f];return _0x25bebd;};'use strict';var _=require(_0xea97('0x0'));var util=require('util');var logger=require(_0xea97('0x1'))(_0xea97('0x2'));var moment=require('moment');var BPromise=require(_0xea97('0x3'));var rp=require(_0xea97('0x4'));var fs=require('fs');var path=require(_0xea97('0x5'));var rimraf=require(_0xea97('0x6'));var config=require(_0xea97('0x7'));var attributes=require(_0xea97('0x8'));module[_0xea97('0x9')]=function(_0x49b016,_0x4e8248){return _0x49b016['define'](_0xea97('0xa'),attributes,{'tableName':_0xea97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 64cf9ca..6f7a7d0 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3cc4c8,_0x114636){var _0xdc0123=function(_0x1c3078){while(--_0x1c3078){_0x3cc4c8['push'](_0x3cc4c8['shift']());}};_0xdc0123(++_0x114636);}(_0x14a0,0x8e));var _0x014a=function(_0x56d5a8,_0x1f6ea2){_0x56d5a8=_0x56d5a8-0x0;var _0x325c47=_0x14a0[_0x56d5a8];return _0x325c47;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x2657f7,_0x15c229){var _0x6d956=function(_0x2cb0cf){while(--_0x2cb0cf){_0x2657f7['push'](_0x2657f7['shift']());}};_0x6d956(++_0x15c229);}(_0xda2d,0x102));var _0xdda2=function(_0x15f628,_0x4e2a1){_0x15f628=_0x15f628-0x0;var _0x519601=_0xda2d[_0x15f628];return _0x519601;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6cfe131..57b810e 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2ffd05,_0x13182f){var _0x472ed3=function(_0x3b3ed7){while(--_0x3b3ed7){_0x2ffd05['push'](_0x2ffd05['shift']());}};_0x472ed3(++_0x13182f);}(_0xef0f,0x168));var _0xfef0=function(_0x5a916c,_0x56aa26){_0x5a916c=_0x5a916c-0x0;var _0x25576c=_0xef0f[_0x5a916c];return _0x25576c;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2da17b5..aadd640 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 _0xe54e=['ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xa4a869,_0x332b7){var _0x31700f=function(_0x2146c5){while(--_0x2146c5){_0xa4a869['push'](_0xa4a869['shift']());}};_0x31700f(++_0x332b7);}(_0xe54e,0x1e8));var _0xee54=function(_0x4d21b5,_0x178e33){_0x4d21b5=_0x4d21b5-0x0;var _0x22ac41=_0xe54e[_0x4d21b5];return _0x22ac41;};'use strict';var Sequelize=require(_0xee54('0x0'));module[_0xee54('0x1')]={'integration':{'type':Sequelize[_0xee54('0x2')]},'eventChannel':{'type':Sequelize[_0xee54('0x2')]},'exitStatus':{'type':Sequelize[_0xee54('0x2')]},'ticketId':{'type':Sequelize[_0xee54('0x2')]},'integrationId':{'type':Sequelize[_0xee54('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xee54('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xee54('0x2')]},'queue':{'type':Sequelize[_0xee54('0x2')]},'interface':{'type':Sequelize[_0xee54('0x2')]},'membername':{'type':Sequelize[_0xee54('0x2')]},'agentcalledAt':{'type':Sequelize[_0xee54('0x4')]},'agentconnectAt':{'type':Sequelize[_0xee54('0x4')]},'holdtime':{'type':Sequelize[_0xee54('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xee54('0x4')]},'talktime':{'type':Sequelize[_0xee54('0x3')]},'agentacw':{'type':Sequelize[_0xee54('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xee54('0x3')]},'reason':{'type':Sequelize[_0xee54('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xee54('0x4')]},'agentdump':{'type':Sequelize[_0xee54('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xee54('0x2')]},'channel':{'type':Sequelize[_0xee54('0x2')]},'channelstate':{'type':Sequelize[_0xee54('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xee54('0x2')]},'connectedlinename':{'type':Sequelize[_0xee54('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xee54('0x2')]},'exten':{'type':Sequelize[_0xee54('0x2')]},'priority':{'type':Sequelize[_0xee54('0x2')]},'destchannel':{'type':Sequelize[_0xee54('0x2')]},'destchannelstate':{'type':Sequelize[_0xee54('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xee54('0x2')]},'destcalleridnum':{'type':Sequelize[_0xee54('0x2')]},'destcalleridname':{'type':Sequelize[_0xee54('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xee54('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xee54('0x2')]},'destpriority':{'type':Sequelize[_0xee54('0x2')]},'destuniqueid':{'type':Sequelize[_0xee54('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xee54('0x2')]},'subject':{'type':Sequelize[_0xee54('0x2')]},'from':{'type':Sequelize[_0xee54('0x2')]},'to':{'type':Sequelize[_0xee54('0x2')]},'cc':{'type':Sequelize[_0xee54('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xee54('0x6')]},'status':{'type':Sequelize[_0xee54('0x7')](_0xee54('0x8'),'SENDING',_0xee54('0x9'),_0xee54('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xee54('0x2')]},'appdata':{'type':Sequelize[_0xee54('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbbe3=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x38418a,_0x57aa63){var _0x452056=function(_0x17d9be){while(--_0x17d9be){_0x38418a['push'](_0x38418a['shift']());}};_0x452056(++_0x57aa63);}(_0xbbe3,0x185));var _0x3bbe=function(_0x3863d0,_0x418873){_0x3863d0=_0x3863d0-0x0;var _0x2ec046=_0xbbe3[_0x3863d0];return _0x2ec046;};'use strict';var Sequelize=require(_0x3bbe('0x0'));module[_0x3bbe('0x1')]={'integration':{'type':Sequelize[_0x3bbe('0x2')]},'eventChannel':{'type':Sequelize[_0x3bbe('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3bbe('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3bbe('0x2')]},'calleridnum':{'type':Sequelize[_0x3bbe('0x2')]},'calleridname':{'type':Sequelize[_0x3bbe('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3bbe('0x2')]},'membername':{'type':Sequelize[_0x3bbe('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3bbe('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3bbe('0x3')]},'holdtime':{'type':Sequelize[_0x3bbe('0x4')]},'agentcomplete':{'type':Sequelize[_0x3bbe('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3bbe('0x3')]},'talktime':{'type':Sequelize[_0x3bbe('0x4')]},'agentacw':{'type':Sequelize[_0x3bbe('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3bbe('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x3bbe('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3bbe('0x3')]},'agentdump':{'type':Sequelize[_0x3bbe('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3bbe('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3bbe('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3bbe('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3bbe('0x2')]},'accountcode':{'type':Sequelize[_0x3bbe('0x2')]},'context':{'type':Sequelize[_0x3bbe('0x2')]},'exten':{'type':Sequelize[_0x3bbe('0x2')]},'priority':{'type':Sequelize[_0x3bbe('0x2')]},'destchannel':{'type':Sequelize[_0x3bbe('0x2')]},'destchannelstate':{'type':Sequelize[_0x3bbe('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x3bbe('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3bbe('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3bbe('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3bbe('0x2')]},'destlanguage':{'type':Sequelize[_0x3bbe('0x2')]},'destaccountcode':{'type':Sequelize[_0x3bbe('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3bbe('0x2')]},'destpriority':{'type':Sequelize[_0x3bbe('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x3bbe('0x2')]},'subject':{'type':Sequelize[_0x3bbe('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x3bbe('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3bbe('0x6')]},'html':{'type':Sequelize[_0x3bbe('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x3bbe('0x7')](_0x3bbe('0x8'),_0x3bbe('0x9'),_0x3bbe('0xa'),_0x3bbe('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x3bbe('0x2')]},'appdata':{'type':Sequelize[_0x3bbe('0x2')]},'projectId':{'type':Sequelize[_0x3bbe('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 309527a..fdd6c12 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 _0xd1e1=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4117c7,_0x134763){var _0x4927bb=function(_0x134905){while(--_0x134905){_0x4117c7['push'](_0x4117c7['shift']());}};_0x4927bb(++_0x134763);}(_0xd1e1,0xa2));var _0x1d1e=function(_0x1a1086,_0x467b57){_0x1a1086=_0x1a1086-0x0;var _0x2e3a21=_0xd1e1[_0x1a1086];return _0x2e3a21;};'use strict';var emlformat=require(_0x1d1e('0x0'));var rimraf=require(_0x1d1e('0x1'));var zipdir=require(_0x1d1e('0x2'));var jsonpatch=require(_0x1d1e('0x3'));var rp=require(_0x1d1e('0x4'));var moment=require(_0x1d1e('0x5'));var BPromise=require(_0x1d1e('0x6'));var Mustache=require(_0x1d1e('0x7'));var util=require(_0x1d1e('0x8'));var path=require(_0x1d1e('0x9'));var sox=require(_0x1d1e('0xa'));var csv=require(_0x1d1e('0xb'));var ejs=require(_0x1d1e('0xc'));var fs=require('fs');var fs_extra=require(_0x1d1e('0xd'));var _=require(_0x1d1e('0xe'));var squel=require(_0x1d1e('0xf'));var crypto=require(_0x1d1e('0x10'));var jsforce=require(_0x1d1e('0x11'));var deskjs=require(_0x1d1e('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d1e('0x13'));var Redis=require(_0x1d1e('0x14'));var authService=require(_0x1d1e('0x15'));var qs=require(_0x1d1e('0x16'));var as=require(_0x1d1e('0x17'));var hardwareService=require(_0x1d1e('0x18'));var logger=require(_0x1d1e('0x19'))('api');var utils=require(_0x1d1e('0x1a'));var config=require(_0x1d1e('0x1b'));var licenseUtil=require(_0x1d1e('0x1c'));var db=require(_0x1d1e('0x1d'))['db'];function respondWithStatusCode(_0x4c7f90,_0x1fe198){_0x1fe198=_0x1fe198||0xcc;return function(_0x525ae7){if(_0x525ae7){return _0x4c7f90[_0x1d1e('0x1e')](_0x1fe198);}return _0x4c7f90[_0x1d1e('0x1f')](_0x1fe198)['end']();};}function respondWithResult(_0x328147,_0x480cc2){_0x480cc2=_0x480cc2||0xc8;return function(_0x3b889d){if(_0x3b889d){return _0x328147['status'](_0x480cc2)['json'](_0x3b889d);}};}function respondWithFilteredResult(_0x1f6d58,_0x529bef){return function(_0x37b186){if(_0x37b186){var _0x44fb41=typeof _0x529bef['offset']==='undefined'&&typeof _0x529bef['limit']===_0x1d1e('0x20');var _0x42f1dd=_0x37b186[_0x1d1e('0x21')];var _0x1920e1=_0x44fb41?0x0:_0x529bef[_0x1d1e('0x22')];var _0x445030=_0x44fb41?_0x37b186[_0x1d1e('0x21')]:_0x529bef[_0x1d1e('0x22')]+_0x529bef[_0x1d1e('0x23')];var _0x2b18fa;if(_0x445030>=_0x42f1dd){_0x445030=_0x42f1dd;_0x2b18fa=0xc8;}else{_0x2b18fa=0xce;}_0x1f6d58[_0x1d1e('0x1f')](_0x2b18fa);return _0x1f6d58[_0x1d1e('0x24')](_0x1d1e('0x25'),_0x1920e1+'-'+_0x445030+'/'+_0x42f1dd)[_0x1d1e('0x26')](_0x37b186);}return null;};}function patchUpdates(_0x56e970){return function(_0x2cd3f0){try{jsonpatch[_0x1d1e('0x27')](_0x2cd3f0,_0x56e970,!![]);}catch(_0x3e273b){return BPromise[_0x1d1e('0x28')](_0x3e273b);}return _0x2cd3f0[_0x1d1e('0x29')]();};}function saveUpdates(_0x1b1fef,_0x13d5a8){return function(_0xf76c0){if(_0xf76c0){return _0xf76c0[_0x1d1e('0x2a')](_0x1b1fef)[_0x1d1e('0x2b')](function(_0x49965b){return _0x49965b;});}return null;};}function removeEntity(_0x4c1c6c,_0x215eab){return function(_0x457b08){if(_0x457b08){return _0x457b08[_0x1d1e('0x2c')]()['then'](function(){_0x4c1c6c[_0x1d1e('0x1f')](0xcc)[_0x1d1e('0x2d')]();});}};}function handleEntityNotFound(_0x1b8c60,_0x10b2c7){return function(_0x52d8d4){if(!_0x52d8d4){_0x1b8c60[_0x1d1e('0x1e')](0x194);}return _0x52d8d4;};}function handleError(_0x4a87ac,_0x53266d){_0x53266d=_0x53266d||0x1f4;return function(_0x3d1b6c){logger[_0x1d1e('0x2e')](_0x3d1b6c[_0x1d1e('0x2f')]);if(_0x3d1b6c['name']){delete _0x3d1b6c['name'];}_0x4a87ac['status'](_0x53266d)[_0x1d1e('0x30')](_0x3d1b6c);};}exports[_0x1d1e('0x31')]=function(_0x418c4f,_0x41b4ff){var _0x165324={},_0x15ab57={},_0xaa40d6={'count':0x0,'rows':[]};var _0x120b89=_[_0x1d1e('0x32')](db[_0x1d1e('0x33')][_0x1d1e('0x34')],function(_0x168e03){return{'name':_0x168e03[_0x1d1e('0x35')],'type':_0x168e03[_0x1d1e('0x36')]['key']};});_0x15ab57[_0x1d1e('0x37')]=_['map'](_0x120b89,_0x1d1e('0x38'));_0x15ab57[_0x1d1e('0x39')]=_[_0x1d1e('0x3a')](_0x418c4f[_0x1d1e('0x39')]);_0x15ab57[_0x1d1e('0x3b')]=_[_0x1d1e('0x3c')](_0x15ab57[_0x1d1e('0x37')],_0x15ab57[_0x1d1e('0x39')]);_0x165324['attributes']=_[_0x1d1e('0x3c')](_0x15ab57[_0x1d1e('0x37')],qs['fields'](_0x418c4f[_0x1d1e('0x39')]['fields']));_0x165324[_0x1d1e('0x3d')]=_0x165324[_0x1d1e('0x3d')][_0x1d1e('0x3e')]?_0x165324['attributes']:_0x15ab57[_0x1d1e('0x37')];if(!_0x418c4f[_0x1d1e('0x39')][_0x1d1e('0x3f')](_0x1d1e('0x40'))){_0x165324[_0x1d1e('0x23')]=qs['limit'](_0x418c4f[_0x1d1e('0x39')]['limit']);_0x165324['offset']=qs[_0x1d1e('0x22')](_0x418c4f['query'][_0x1d1e('0x22')]);}_0x165324[_0x1d1e('0x41')]=qs[_0x1d1e('0x42')](_0x418c4f[_0x1d1e('0x39')][_0x1d1e('0x42')]);_0x165324['where']=qs[_0x1d1e('0x3b')](_[_0x1d1e('0x43')](_0x418c4f['query'],_0x15ab57[_0x1d1e('0x3b')]),_0x120b89);if(_0x418c4f['query'][_0x1d1e('0x44')]){_0x165324['where']=_['merge'](_0x165324['where'],{'$or':_['map'](_0x120b89,function(_0x36140f){if(_0x36140f[_0x1d1e('0x36')]!==_0x1d1e('0x45')){var _0x40bbb4={};_0x40bbb4[_0x36140f[_0x1d1e('0x38')]]={'$like':'%'+_0x418c4f[_0x1d1e('0x39')][_0x1d1e('0x44')]+'%'};return _0x40bbb4;}})});}_0x165324=_[_0x1d1e('0x46')]({},_0x165324,_0x418c4f[_0x1d1e('0x47')]);var _0x5bff25={'where':_0x165324[_0x1d1e('0x48')]};return db[_0x1d1e('0x33')][_0x1d1e('0x21')](_0x5bff25)[_0x1d1e('0x2b')](function(_0x489d5a){_0xaa40d6[_0x1d1e('0x21')]=_0x489d5a;if(_0x418c4f['query'][_0x1d1e('0x49')]){_0x165324[_0x1d1e('0x4a')]=[{'all':!![]}];}return db[_0x1d1e('0x33')][_0x1d1e('0x4b')](_0x165324);})[_0x1d1e('0x2b')](function(_0x52623b){_0xaa40d6['rows']=_0x52623b;return _0xaa40d6;})[_0x1d1e('0x2b')](respondWithFilteredResult(_0x41b4ff,_0x165324))[_0x1d1e('0x4c')](handleError(_0x41b4ff,null));};exports[_0x1d1e('0x4d')]=function(_0x4b54df,_0x2b6c18){var _0x57ec67={'raw':![],'where':{'id':_0x4b54df[_0x1d1e('0x4e')]['id']}},_0x4e3c3a={};_0x4e3c3a[_0x1d1e('0x37')]=_[_0x1d1e('0x3a')](db[_0x1d1e('0x33')]['rawAttributes']);_0x4e3c3a[_0x1d1e('0x39')]=_['keys'](_0x4b54df[_0x1d1e('0x39')]);_0x4e3c3a[_0x1d1e('0x3b')]=_[_0x1d1e('0x3c')](_0x4e3c3a[_0x1d1e('0x37')],_0x4e3c3a[_0x1d1e('0x39')]);_0x57ec67[_0x1d1e('0x3d')]=_[_0x1d1e('0x3c')](_0x4e3c3a[_0x1d1e('0x37')],qs['fields'](_0x4b54df[_0x1d1e('0x39')][_0x1d1e('0x4f')]));_0x57ec67[_0x1d1e('0x3d')]=_0x57ec67[_0x1d1e('0x3d')][_0x1d1e('0x3e')]?_0x57ec67['attributes']:_0x4e3c3a[_0x1d1e('0x37')];if(_0x4b54df['query'][_0x1d1e('0x49')]){_0x57ec67[_0x1d1e('0x4a')]=[{'all':!![]}];}_0x57ec67=_[_0x1d1e('0x46')]({},_0x57ec67,_0x4b54df['options']);return db[_0x1d1e('0x33')][_0x1d1e('0x50')](_0x57ec67)[_0x1d1e('0x2b')](handleEntityNotFound(_0x2b6c18,null))[_0x1d1e('0x2b')](respondWithResult(_0x2b6c18,null))['catch'](handleError(_0x2b6c18,null));};exports['create']=function(_0x2366f7,_0x2e03aa){return db[_0x1d1e('0x33')][_0x1d1e('0x51')](_0x2366f7[_0x1d1e('0x52')],{})['then'](respondWithResult(_0x2e03aa,0xc9))['catch'](handleError(_0x2e03aa,null));};exports[_0x1d1e('0x2a')]=function(_0x14ea7c,_0x4b7d52){if(_0x14ea7c[_0x1d1e('0x52')]['id']){delete _0x14ea7c[_0x1d1e('0x52')]['id'];}return db[_0x1d1e('0x33')][_0x1d1e('0x50')]({'where':{'id':_0x14ea7c['params']['id']}})[_0x1d1e('0x2b')](handleEntityNotFound(_0x4b7d52,null))[_0x1d1e('0x2b')](saveUpdates(_0x14ea7c['body'],null))[_0x1d1e('0x2b')](respondWithResult(_0x4b7d52,null))[_0x1d1e('0x4c')](handleError(_0x4b7d52,null));};exports[_0x1d1e('0x2c')]=function(_0x493e8e,_0x15df0d){return db[_0x1d1e('0x33')]['find']({'where':{'id':_0x493e8e[_0x1d1e('0x4e')]['id']}})[_0x1d1e('0x2b')](handleEntityNotFound(_0x15df0d,null))[_0x1d1e('0x2b')](removeEntity(_0x15df0d,null))[_0x1d1e('0x4c')](handleError(_0x15df0d,null));};exports[_0x1d1e('0x53')]=function(_0x26e98a,_0xc3456){return db[_0x1d1e('0x33')][_0x1d1e('0x53')]()[_0x1d1e('0x2b')](respondWithResult(_0xc3456,null))[_0x1d1e('0x4c')](handleError(_0xc3456,null));}; \ No newline at end of file +var _0x0c2d=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','jsforce'];(function(_0x12cc42,_0x9602c1){var _0x3c10c3=function(_0x45a821){while(--_0x45a821){_0x12cc42['push'](_0x12cc42['shift']());}};_0x3c10c3(++_0x9602c1);}(_0x0c2d,0x8a));var _0xd0c2=function(_0x58550d,_0x2b282e){_0x58550d=_0x58550d-0x0;var _0x19cd6b=_0x0c2d[_0x58550d];return _0x19cd6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0c2('0x0'));var zipdir=require(_0xd0c2('0x1'));var jsonpatch=require(_0xd0c2('0x2'));var rp=require(_0xd0c2('0x3'));var moment=require(_0xd0c2('0x4'));var BPromise=require(_0xd0c2('0x5'));var Mustache=require('mustache');var util=require(_0xd0c2('0x6'));var path=require('path');var sox=require(_0xd0c2('0x7'));var csv=require(_0xd0c2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0c2('0x9'));var _=require(_0xd0c2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0c2('0xb'));var deskjs=require(_0xd0c2('0xc'));var toCsv=require(_0xd0c2('0x8'));var querystring=require(_0xd0c2('0xd'));var Papa=require('papaparse');var Redis=require(_0xd0c2('0xe'));var authService=require(_0xd0c2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd0c2('0x10'));var hardwareService=require(_0xd0c2('0x11'));var logger=require(_0xd0c2('0x12'))('api');var utils=require(_0xd0c2('0x13'));var config=require(_0xd0c2('0x14'));var licenseUtil=require(_0xd0c2('0x15'));var db=require(_0xd0c2('0x16'))['db'];function respondWithStatusCode(_0x5c6b59,_0xa3cf36){_0xa3cf36=_0xa3cf36||0xcc;return function(_0x2220f8){if(_0x2220f8){return _0x5c6b59['sendStatus'](_0xa3cf36);}return _0x5c6b59[_0xd0c2('0x17')](_0xa3cf36)[_0xd0c2('0x18')]();};}function respondWithResult(_0x26e6c8,_0x49b02f){_0x49b02f=_0x49b02f||0xc8;return function(_0x48dbf4){if(_0x48dbf4){return _0x26e6c8['status'](_0x49b02f)[_0xd0c2('0x19')](_0x48dbf4);}};}function respondWithFilteredResult(_0x34699c,_0x134378){return function(_0x1f03bc){if(_0x1f03bc){var _0x4a0cd5=typeof _0x134378[_0xd0c2('0x1a')]==='undefined'&&typeof _0x134378['limit']===_0xd0c2('0x1b');var _0x479e9d=_0x1f03bc['count'];var _0x5917dc=_0x4a0cd5?0x0:_0x134378['offset'];var _0x1a900d=_0x4a0cd5?_0x1f03bc['count']:_0x134378[_0xd0c2('0x1a')]+_0x134378['limit'];var _0x24790d;if(_0x1a900d>=_0x479e9d){_0x1a900d=_0x479e9d;_0x24790d=0xc8;}else{_0x24790d=0xce;}_0x34699c[_0xd0c2('0x17')](_0x24790d);return _0x34699c['set'](_0xd0c2('0x1c'),_0x5917dc+'-'+_0x1a900d+'/'+_0x479e9d)[_0xd0c2('0x19')](_0x1f03bc);}return null;};}function patchUpdates(_0x131485){return function(_0xa70aad){try{jsonpatch[_0xd0c2('0x1d')](_0xa70aad,_0x131485,!![]);}catch(_0x5bc682){return BPromise[_0xd0c2('0x1e')](_0x5bc682);}return _0xa70aad[_0xd0c2('0x1f')]();};}function saveUpdates(_0x518690,_0x1cc965){return function(_0x45ca6d){if(_0x45ca6d){return _0x45ca6d[_0xd0c2('0x20')](_0x518690)[_0xd0c2('0x21')](function(_0x41e565){return _0x41e565;});}return null;};}function removeEntity(_0x304927,_0x5ae41a){return function(_0x352dd2){if(_0x352dd2){return _0x352dd2[_0xd0c2('0x22')]()[_0xd0c2('0x21')](function(){_0x304927[_0xd0c2('0x17')](0xcc)[_0xd0c2('0x18')]();});}};}function handleEntityNotFound(_0x122f18,_0x543a95){return function(_0x3da2d6){if(!_0x3da2d6){_0x122f18[_0xd0c2('0x23')](0x194);}return _0x3da2d6;};}function handleError(_0x10b970,_0x47c833){_0x47c833=_0x47c833||0x1f4;return function(_0x3e7d2a){logger['error'](_0x3e7d2a[_0xd0c2('0x24')]);if(_0x3e7d2a[_0xd0c2('0x25')]){delete _0x3e7d2a[_0xd0c2('0x25')];}_0x10b970[_0xd0c2('0x17')](_0x47c833)[_0xd0c2('0x26')](_0x3e7d2a);};}exports['index']=function(_0x31a2a8,_0x176661){var _0x46dab4={},_0x3e49b0={},_0x4eb09d={'count':0x0,'rows':[]};var _0x435122=_[_0xd0c2('0x27')](db[_0xd0c2('0x28')][_0xd0c2('0x29')],function(_0x288b07){return{'name':_0x288b07[_0xd0c2('0x2a')],'type':_0x288b07[_0xd0c2('0x2b')][_0xd0c2('0x2c')]};});_0x3e49b0[_0xd0c2('0x2d')]=_[_0xd0c2('0x27')](_0x435122,'name');_0x3e49b0[_0xd0c2('0x2e')]=_[_0xd0c2('0x2f')](_0x31a2a8[_0xd0c2('0x2e')]);_0x3e49b0['filters']=_[_0xd0c2('0x30')](_0x3e49b0[_0xd0c2('0x2d')],_0x3e49b0[_0xd0c2('0x2e')]);_0x46dab4[_0xd0c2('0x31')]=_[_0xd0c2('0x30')](_0x3e49b0[_0xd0c2('0x2d')],qs[_0xd0c2('0x32')](_0x31a2a8[_0xd0c2('0x2e')][_0xd0c2('0x32')]));_0x46dab4[_0xd0c2('0x31')]=_0x46dab4[_0xd0c2('0x31')][_0xd0c2('0x33')]?_0x46dab4['attributes']:_0x3e49b0[_0xd0c2('0x2d')];if(!_0x31a2a8['query']['hasOwnProperty'](_0xd0c2('0x34'))){_0x46dab4[_0xd0c2('0x35')]=qs['limit'](_0x31a2a8['query'][_0xd0c2('0x35')]);_0x46dab4[_0xd0c2('0x1a')]=qs['offset'](_0x31a2a8[_0xd0c2('0x2e')]['offset']);}_0x46dab4[_0xd0c2('0x36')]=qs[_0xd0c2('0x37')](_0x31a2a8[_0xd0c2('0x2e')][_0xd0c2('0x37')]);_0x46dab4[_0xd0c2('0x38')]=qs[_0xd0c2('0x39')](_[_0xd0c2('0x3a')](_0x31a2a8['query'],_0x3e49b0[_0xd0c2('0x39')]),_0x435122);if(_0x31a2a8[_0xd0c2('0x2e')][_0xd0c2('0x3b')]){_0x46dab4['where']=_[_0xd0c2('0x3c')](_0x46dab4[_0xd0c2('0x38')],{'$or':_[_0xd0c2('0x27')](_0x435122,function(_0x1842c1){if(_0x1842c1[_0xd0c2('0x2b')]!==_0xd0c2('0x3d')){var _0x22c82a={};_0x22c82a[_0x1842c1[_0xd0c2('0x25')]]={'$like':'%'+_0x31a2a8[_0xd0c2('0x2e')][_0xd0c2('0x3b')]+'%'};return _0x22c82a;}})});}_0x46dab4=_['merge']({},_0x46dab4,_0x31a2a8[_0xd0c2('0x3e')]);var _0x58523e={'where':_0x46dab4['where']};return db['IntegrationReport'][_0xd0c2('0x3f')](_0x58523e)[_0xd0c2('0x21')](function(_0xb95262){_0x4eb09d[_0xd0c2('0x3f')]=_0xb95262;if(_0x31a2a8[_0xd0c2('0x2e')][_0xd0c2('0x40')]){_0x46dab4[_0xd0c2('0x41')]=[{'all':!![]}];}return db[_0xd0c2('0x28')][_0xd0c2('0x42')](_0x46dab4);})['then'](function(_0xba4915){_0x4eb09d[_0xd0c2('0x43')]=_0xba4915;return _0x4eb09d;})[_0xd0c2('0x21')](respondWithFilteredResult(_0x176661,_0x46dab4))[_0xd0c2('0x44')](handleError(_0x176661,null));};exports[_0xd0c2('0x45')]=function(_0x32367a,_0x56a9bf){var _0x438882={'raw':![],'where':{'id':_0x32367a[_0xd0c2('0x46')]['id']}},_0x506f9a={};_0x506f9a[_0xd0c2('0x2d')]=_[_0xd0c2('0x2f')](db[_0xd0c2('0x28')][_0xd0c2('0x29')]);_0x506f9a['query']=_[_0xd0c2('0x2f')](_0x32367a['query']);_0x506f9a['filters']=_[_0xd0c2('0x30')](_0x506f9a[_0xd0c2('0x2d')],_0x506f9a['query']);_0x438882[_0xd0c2('0x31')]=_[_0xd0c2('0x30')](_0x506f9a[_0xd0c2('0x2d')],qs[_0xd0c2('0x32')](_0x32367a['query']['fields']));_0x438882[_0xd0c2('0x31')]=_0x438882[_0xd0c2('0x31')][_0xd0c2('0x33')]?_0x438882['attributes']:_0x506f9a[_0xd0c2('0x2d')];if(_0x32367a[_0xd0c2('0x2e')][_0xd0c2('0x40')]){_0x438882['include']=[{'all':!![]}];}_0x438882=_[_0xd0c2('0x3c')]({},_0x438882,_0x32367a[_0xd0c2('0x3e')]);return db[_0xd0c2('0x28')][_0xd0c2('0x47')](_0x438882)[_0xd0c2('0x21')](handleEntityNotFound(_0x56a9bf,null))[_0xd0c2('0x21')](respondWithResult(_0x56a9bf,null))[_0xd0c2('0x44')](handleError(_0x56a9bf,null));};exports[_0xd0c2('0x48')]=function(_0x49c975,_0x19429d){return db['IntegrationReport'][_0xd0c2('0x48')](_0x49c975[_0xd0c2('0x49')],{})[_0xd0c2('0x21')](respondWithResult(_0x19429d,0xc9))[_0xd0c2('0x44')](handleError(_0x19429d,null));};exports[_0xd0c2('0x20')]=function(_0x5abce0,_0x3afa9a){if(_0x5abce0[_0xd0c2('0x49')]['id']){delete _0x5abce0['body']['id'];}return db[_0xd0c2('0x28')][_0xd0c2('0x47')]({'where':{'id':_0x5abce0['params']['id']}})[_0xd0c2('0x21')](handleEntityNotFound(_0x3afa9a,null))[_0xd0c2('0x21')](saveUpdates(_0x5abce0[_0xd0c2('0x49')],null))[_0xd0c2('0x21')](respondWithResult(_0x3afa9a,null))[_0xd0c2('0x44')](handleError(_0x3afa9a,null));};exports[_0xd0c2('0x22')]=function(_0xf1be2b,_0x19b9b5){return db[_0xd0c2('0x28')][_0xd0c2('0x47')]({'where':{'id':_0xf1be2b['params']['id']}})['then'](handleEntityNotFound(_0x19b9b5,null))[_0xd0c2('0x21')](removeEntity(_0x19b9b5,null))['catch'](handleError(_0x19b9b5,null));};exports[_0xd0c2('0x4a')]=function(_0x3a0c1f,_0x586e88){return db[_0xd0c2('0x28')][_0xd0c2('0x4a')]()['then'](respondWithResult(_0x586e88,null))[_0xd0c2('0x44')](handleError(_0x586e88,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 78bda38..a01e8da 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 _0xc71a=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','IntegrationReport','lodash'];(function(_0x8ab270,_0x12951b){var _0x485347=function(_0x5c236){while(--_0x5c236){_0x8ab270['push'](_0x8ab270['shift']());}};_0x485347(++_0x12951b);}(_0xc71a,0x6b));var _0xac71=function(_0x16af22,_0x57d609){_0x16af22=_0x16af22-0x0;var _0x2ad12c=_0xc71a[_0x16af22];return _0x2ad12c;};'use strict';var _=require(_0xac71('0x0'));var util=require(_0xac71('0x1'));var logger=require(_0xac71('0x2'))(_0xac71('0x3'));var moment=require('moment');var BPromise=require(_0xac71('0x4'));var rp=require(_0xac71('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac71('0x6'));var config=require(_0xac71('0x7'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0xbcb827,_0x29b5f7){return _0xbcb827['define'](_0xac71('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa30a=['request-promise','rimraf','../../config/environment','exports','IntegrationReport','util','api','bluebird'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xa30a,0xad));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xaa30('0x0'));var logger=require('../../config/logger')(_0xaa30('0x1'));var moment=require('moment');var BPromise=require(_0xaa30('0x2'));var rp=require(_0xaa30('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa30('0x4'));var config=require(_0xaa30('0x5'));var attributes=require('./integrationReport.attributes');module[_0xaa30('0x6')]=function(_0x4c4dab,_0x20f004){return _0x4c4dab['define'](_0xaa30('0x7'),attributes,{'tableName':'report_integration','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 ab47a7a..0c17aa7 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 _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x2ce2d4,_0x43a4ca){_0x2ce2d4=_0x2ce2d4-0x0;var _0xb0f65d=_0x7a54[_0x2ce2d4];return _0xb0f65d;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0xff9afd,_0xf2213a){var _0x26ce52=function(_0x11665d){while(--_0x11665d){_0xff9afd['push'](_0xff9afd['shift']());}};_0x26ce52(++_0xf2213a);}(_0x187d,0x93));var _0xd187=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x187d[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 80933fa..c7306ba 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 _0x510e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer'];(function(_0x4dabb1,_0xabfb29){var _0xe28e92=function(_0x148341){while(--_0x148341){_0x4dabb1['push'](_0x4dabb1['shift']());}};_0xe28e92(++_0xabfb29);}(_0x510e,0x1ed));var _0xe510=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x510e[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0xe510('0x0'));var util=require(_0xe510('0x1'));var path=require(_0xe510('0x2'));var timeout=require(_0xe510('0x3'));var express=require(_0xe510('0x4'));var router=express[_0xe510('0x5')]();var fs_extra=require(_0xe510('0x6'));var auth=require(_0xe510('0x7'));var interaction=require(_0xe510('0x8'));var config=require('../../config/environment');var controller=require(_0xe510('0x9'));router[_0xe510('0xa')]('/',auth[_0xe510('0xb')](),controller[_0xe510('0xc')]);router[_0xe510('0xa')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller[_0xe510('0xe')]);router[_0xe510('0xa')](_0xe510('0xf'),auth[_0xe510('0xb')](),controller[_0xe510('0x10')]);router[_0xe510('0x11')]('/',auth[_0xe510('0xb')](),controller['create']);router[_0xe510('0x11')](_0xe510('0xf'),auth[_0xe510('0xb')](),controller[_0xe510('0x12')]);router[_0xe510('0x11')](_0xe510('0x13'),auth['isAuthenticated'](),controller[_0xe510('0x14')]);router[_0xe510('0x15')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller[_0xe510('0x16')]);router[_0xe510('0x17')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller[_0xe510('0x18')]);module[_0xe510('0x19')]=router; \ No newline at end of file +var _0x3432=['/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./interval.controller','get','index','/:id','isAuthenticated','show'];(function(_0x118a51,_0x612bb){var _0x5d8cd3=function(_0x25272f){while(--_0x25272f){_0x118a51['push'](_0x118a51['shift']());}};_0x5d8cd3(++_0x612bb);}(_0x3432,0x182));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2343('0x0'));var util=require(_0x2343('0x1'));var path=require(_0x2343('0x2'));var timeout=require(_0x2343('0x3'));var express=require(_0x2343('0x4'));var router=express[_0x2343('0x5')]();var fs_extra=require(_0x2343('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2343('0x7'));var config=require('../../config/environment');var controller=require(_0x2343('0x8'));router[_0x2343('0x9')]('/',auth['isAuthenticated'](),controller[_0x2343('0xa')]);router[_0x2343('0x9')](_0x2343('0xb'),auth[_0x2343('0xc')](),controller[_0x2343('0xd')]);router[_0x2343('0x9')](_0x2343('0xe'),auth[_0x2343('0xc')](),controller[_0x2343('0xf')]);router[_0x2343('0x10')]('/',auth[_0x2343('0xc')](),controller[_0x2343('0x11')]);router[_0x2343('0x10')](_0x2343('0xe'),auth[_0x2343('0xc')](),controller[_0x2343('0x12')]);router[_0x2343('0x10')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x2343('0x13')]);router[_0x2343('0x14')](_0x2343('0xb'),auth[_0x2343('0xc')](),controller[_0x2343('0x15')]);router[_0x2343('0x16')]('/:id',auth[_0x2343('0xc')](),controller[_0x2343('0x17')]);module[_0x2343('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3333e02..fec672a 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 _0xdf59=['sequelize','exports','STRING'];(function(_0x1378ac,_0xc51cb1){var _0x338a39=function(_0x25de84){while(--_0x25de84){_0x1378ac['push'](_0x1378ac['shift']());}};_0x338a39(++_0xc51cb1);}(_0xdf59,0x1ce));var _0x9df5=function(_0x3d2a89,_0x4a0b21){_0x3d2a89=_0x3d2a89-0x0;var _0x12578f=_0xdf59[_0x3d2a89];return _0x12578f;};'use strict';var Sequelize=require(_0x9df5('0x0'));module[_0x9df5('0x1')]={'name':{'type':Sequelize[_0x9df5('0x2')]},'description':{'type':Sequelize[_0x9df5('0x2')]},'interval':{'type':Sequelize[_0x9df5('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6ac2=['STRING'];(function(_0x50cac0,_0x4b5f41){var _0xa66bb8=function(_0x57474c){while(--_0x57474c){_0x50cac0['push'](_0x50cac0['shift']());}};_0xa66bb8(++_0x4b5f41);}(_0x6ac2,0x1cf));var _0x26ac=function(_0x244f63,_0x52087a){_0x244f63=_0x244f63-0x0;var _0x3ee295=_0x6ac2[_0x244f63];return _0x3ee295;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x26ac('0x0')]},'description':{'type':Sequelize[_0x26ac('0x0')]},'interval':{'type':Sequelize[_0x26ac('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 28ac62c..e8eae75 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 _0x175c=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','Interval','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','addIntervals','sequelize','findAll'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x175c,0xb6));var _0xc175=function(_0x5d9ef6,_0x1720c4){_0x5d9ef6=_0x5d9ef6-0x0;var _0x1e3da0=_0x175c[_0x5d9ef6];return _0x1e3da0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc175('0x0'));var zipdir=require(_0xc175('0x1'));var jsonpatch=require(_0xc175('0x2'));var rp=require('request-promise');var moment=require(_0xc175('0x3'));var BPromise=require(_0xc175('0x4'));var Mustache=require(_0xc175('0x5'));var util=require(_0xc175('0x6'));var path=require('path');var sox=require(_0xc175('0x7'));var csv=require(_0xc175('0x8'));var ejs=require(_0xc175('0x9'));var fs=require('fs');var fs_extra=require(_0xc175('0xa'));var _=require(_0xc175('0xb'));var squel=require(_0xc175('0xc'));var crypto=require(_0xc175('0xd'));var jsforce=require(_0xc175('0xe'));var deskjs=require(_0xc175('0xf'));var toCsv=require(_0xc175('0x8'));var querystring=require('querystring');var Papa=require(_0xc175('0x10'));var Redis=require(_0xc175('0x11'));var authService=require(_0xc175('0x12'));var qs=require(_0xc175('0x13'));var as=require(_0xc175('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc175('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0xc175('0x16'));function respondWithStatusCode(_0x502976,_0x4daa55){_0x4daa55=_0x4daa55||0xcc;return function(_0x3106d7){if(_0x3106d7){return _0x502976[_0xc175('0x17')](_0x4daa55);}return _0x502976[_0xc175('0x18')](_0x4daa55)[_0xc175('0x19')]();};}function respondWithResult(_0x2a98b5,_0x4de01c){_0x4de01c=_0x4de01c||0xc8;return function(_0x3fefa4){if(_0x3fefa4){return _0x2a98b5[_0xc175('0x18')](_0x4de01c)[_0xc175('0x1a')](_0x3fefa4);}};}function respondWithFilteredResult(_0x1ff756,_0x5bff8a){return function(_0x2f081e){if(_0x2f081e){var _0x3d81f4=typeof _0x5bff8a[_0xc175('0x1b')]===_0xc175('0x1c')&&typeof _0x5bff8a[_0xc175('0x1d')]===_0xc175('0x1c');var _0x5a4727=_0x2f081e[_0xc175('0x1e')];var _0x5119de=_0x3d81f4?0x0:_0x5bff8a['offset'];var _0x228d87=_0x3d81f4?_0x2f081e[_0xc175('0x1e')]:_0x5bff8a[_0xc175('0x1b')]+_0x5bff8a['limit'];var _0x3d5fa0;if(_0x228d87>=_0x5a4727){_0x228d87=_0x5a4727;_0x3d5fa0=0xc8;}else{_0x3d5fa0=0xce;}_0x1ff756[_0xc175('0x18')](_0x3d5fa0);return _0x1ff756[_0xc175('0x1f')](_0xc175('0x20'),_0x5119de+'-'+_0x228d87+'/'+_0x5a4727)['json'](_0x2f081e);}return null;};}function patchUpdates(_0x346ec5){return function(_0x3680ef){try{jsonpatch[_0xc175('0x21')](_0x3680ef,_0x346ec5,!![]);}catch(_0x2e97bc){return BPromise[_0xc175('0x22')](_0x2e97bc);}return _0x3680ef[_0xc175('0x23')]();};}function saveUpdates(_0x326369,_0x4fd852){return function(_0x6ebf6c){if(_0x6ebf6c){return _0x6ebf6c[_0xc175('0x24')](_0x326369)[_0xc175('0x25')](function(_0x519356){return _0x519356;});}return null;};}function removeEntity(_0x100daa,_0x588a56){return function(_0xcd913f){if(_0xcd913f){return _0xcd913f[_0xc175('0x26')]()[_0xc175('0x25')](function(){var _0x3c7085=_0xcd913f[_0xc175('0x27')]({'plain':!![]});var _0x4426eb=_0xc175('0x28');return db[_0xc175('0x29')][_0xc175('0x26')]({'where':{'type':_0x4426eb,'resourceId':_0x3c7085['id']}})['then'](function(){return _0xcd913f;});})[_0xc175('0x25')](function(){_0x100daa[_0xc175('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x468032,_0x2f902e){return function(_0xd83928){if(!_0xd83928){_0x468032[_0xc175('0x17')](0x194);}return _0xd83928;};}function handleError(_0xe24383,_0x5e92da){_0x5e92da=_0x5e92da||0x1f4;return function(_0x30c135){logger[_0xc175('0x2a')](_0x30c135[_0xc175('0x2b')]);if(_0x30c135[_0xc175('0x2c')]){delete _0x30c135[_0xc175('0x2c')];}_0xe24383[_0xc175('0x18')](_0x5e92da)[_0xc175('0x2d')](_0x30c135);};}exports[_0xc175('0x2e')]=function(_0x320a3c,_0x2dde09){var _0x427b5a={},_0x5ae61a={},_0x2e432c={'count':0x0,'rows':[]};var _0x279235=_['map'](db[_0xc175('0x2f')][_0xc175('0x30')],function(_0x2c46ed){return{'name':_0x2c46ed[_0xc175('0x31')],'type':_0x2c46ed['type'][_0xc175('0x32')]};});_0x5ae61a[_0xc175('0x33')]=_[_0xc175('0x34')](_0x279235,'name');_0x5ae61a['query']=_[_0xc175('0x35')](_0x320a3c[_0xc175('0x36')]);_0x5ae61a[_0xc175('0x37')]=_[_0xc175('0x38')](_0x5ae61a['model'],_0x5ae61a['query']);_0x427b5a['attributes']=_[_0xc175('0x38')](_0x5ae61a[_0xc175('0x33')],qs['fields'](_0x320a3c[_0xc175('0x36')][_0xc175('0x39')]));_0x427b5a[_0xc175('0x3a')]=_0x427b5a['attributes'][_0xc175('0x3b')]?_0x427b5a[_0xc175('0x3a')]:_0x5ae61a[_0xc175('0x33')];if(!_0x320a3c['query'][_0xc175('0x3c')](_0xc175('0x3d'))){_0x427b5a[_0xc175('0x1d')]=qs[_0xc175('0x1d')](_0x320a3c[_0xc175('0x36')][_0xc175('0x1d')]);_0x427b5a[_0xc175('0x1b')]=qs[_0xc175('0x1b')](_0x320a3c['query']['offset']);}_0x427b5a[_0xc175('0x3e')]=qs[_0xc175('0x3f')](_0x320a3c[_0xc175('0x36')]['sort']);_0x427b5a['where']=qs[_0xc175('0x37')](_[_0xc175('0x40')](_0x320a3c[_0xc175('0x36')],_0x5ae61a[_0xc175('0x37')]),_0x279235);if(_0x320a3c[_0xc175('0x36')][_0xc175('0x41')]){_0x427b5a['where']=_['merge'](_0x427b5a[_0xc175('0x42')],{'$or':_[_0xc175('0x34')](_0x279235,function(_0x4b6239){if(_0x4b6239[_0xc175('0x43')]!==_0xc175('0x44')){var _0x1cebf8={};_0x1cebf8[_0x4b6239['name']]={'$like':'%'+_0x320a3c['query']['filter']+'%'};return _0x1cebf8;}})});}_0x427b5a=_[_0xc175('0x45')]({},_0x427b5a,_0x320a3c[_0xc175('0x46')]);var _0x3d9cd5={'where':_0x427b5a['where']};return db[_0xc175('0x2f')][_0xc175('0x1e')](_0x3d9cd5)['then'](function(_0x135eb2){_0x2e432c[_0xc175('0x1e')]=_0x135eb2;if(_0x320a3c[_0xc175('0x36')]['includeAll']){_0x427b5a[_0xc175('0x47')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x427b5a);})[_0xc175('0x25')](function(_0x358096){_0x2e432c[_0xc175('0x48')]=_0x358096;return _0x2e432c;})[_0xc175('0x25')](respondWithFilteredResult(_0x2dde09,_0x427b5a))[_0xc175('0x49')](handleError(_0x2dde09,null));};exports[_0xc175('0x4a')]=function(_0x474e5e,_0x4a9d85){var _0x5d0e2f={'raw':!![],'where':{'id':_0x474e5e[_0xc175('0x4b')]['id']}},_0x306240={};_0x306240[_0xc175('0x33')]=_['keys'](db['Interval'][_0xc175('0x30')]);_0x306240['query']=_[_0xc175('0x35')](_0x474e5e[_0xc175('0x36')]);_0x306240[_0xc175('0x37')]=_[_0xc175('0x38')](_0x306240[_0xc175('0x33')],_0x306240[_0xc175('0x36')]);_0x5d0e2f[_0xc175('0x3a')]=_['intersection'](_0x306240[_0xc175('0x33')],qs[_0xc175('0x39')](_0x474e5e[_0xc175('0x36')][_0xc175('0x39')]));_0x5d0e2f[_0xc175('0x3a')]=_0x5d0e2f[_0xc175('0x3a')][_0xc175('0x3b')]?_0x5d0e2f[_0xc175('0x3a')]:_0x306240[_0xc175('0x33')];if(_0x474e5e['query'][_0xc175('0x4c')]){_0x5d0e2f['include']=[{'all':!![]}];}_0x5d0e2f=_[_0xc175('0x45')]({},_0x5d0e2f,_0x474e5e[_0xc175('0x46')]);return db[_0xc175('0x2f')][_0xc175('0x4d')](_0x5d0e2f)[_0xc175('0x25')](handleEntityNotFound(_0x4a9d85,null))[_0xc175('0x25')](respondWithResult(_0x4a9d85,null))['catch'](handleError(_0x4a9d85,null));};exports[_0xc175('0x4e')]=function(_0x2c5820,_0x38106a){return db['Interval'][_0xc175('0x4e')](_0x2c5820[_0xc175('0x4f')],{})[_0xc175('0x25')](function(_0x21ad78){var _0x221819=_0x2c5820[_0xc175('0x50')][_0xc175('0x27')]({'plain':!![]});if(!_0x221819)throw new Error(_0xc175('0x51'));if(_0x221819[_0xc175('0x52')]==='user'){var _0x499efa=_0x21ad78[_0xc175('0x27')]({'plain':!![]});var _0x75b273='Intervals';return db['UserProfileSection'][_0xc175('0x4d')]({'where':{'name':_0x75b273,'userProfileId':_0x221819['userProfileId']},'raw':!![]})[_0xc175('0x25')](function(_0x39c7b9){if(_0x39c7b9&&_0x39c7b9[_0xc175('0x53')]===0x0){return db[_0xc175('0x29')]['create']({'name':_0x499efa[_0xc175('0x2c')],'resourceId':_0x499efa['id'],'type':_0x39c7b9[_0xc175('0x2c')],'sectionId':_0x39c7b9['id']},{})['then'](function(){return _0x21ad78;});}else{return _0x21ad78;}})[_0xc175('0x49')](function(_0x1802a6){logger['error'](_0xc175('0x54'),_0x1802a6);throw _0x1802a6;});}return _0x21ad78;})[_0xc175('0x25')](respondWithResult(_0x38106a,0xc9))[_0xc175('0x49')](handleError(_0x38106a,null));};exports[_0xc175('0x24')]=function(_0x36426d,_0x2aaa52){if(_0x36426d[_0xc175('0x4f')]['id']){delete _0x36426d[_0xc175('0x4f')]['id'];}return db[_0xc175('0x2f')][_0xc175('0x4d')]({'where':{'id':_0x36426d['params']['id']}})['then'](handleEntityNotFound(_0x2aaa52,null))[_0xc175('0x25')](saveUpdates(_0x36426d[_0xc175('0x4f')],null))['then'](respondWithResult(_0x2aaa52,null))[_0xc175('0x49')](handleError(_0x2aaa52,null));};exports[_0xc175('0x26')]=function(_0x367b31,_0x7f4e2){return db[_0xc175('0x2f')][_0xc175('0x4d')]({'where':{'id':_0x367b31[_0xc175('0x4b')]['id']}})['then'](handleEntityNotFound(_0x7f4e2,null))[_0xc175('0x25')](removeEntity(_0x7f4e2,null))[_0xc175('0x49')](handleError(_0x7f4e2,null));};exports[_0xc175('0x55')]=function(_0x59aa2e,_0x5d8bb4,_0x464ec6){if(_0x59aa2e['body']['id']){delete _0x59aa2e[_0xc175('0x4f')]['id'];}return db[_0xc175('0x2f')]['find']({'where':{'id':_0x59aa2e[_0xc175('0x4b')]['id']}})[_0xc175('0x25')](handleEntityNotFound(_0x5d8bb4,null))['then'](function(_0xaa08fb){if(_0xaa08fb){_0x59aa2e['body'][_0xc175('0x56')]=_0xaa08fb['id'];return db[_0xc175('0x2f')][_0xc175('0x4e')](_0x59aa2e['body']);}})[_0xc175('0x25')](respondWithResult(_0x5d8bb4,null))[_0xc175('0x49')](handleError(_0x5d8bb4,null));};exports[_0xc175('0x57')]=function(_0x59e54a,_0x3ac092,_0xccb4a8){var _0x57019f={};var _0x58d344={};var _0x362c17;var _0x2010bc;return db[_0xc175('0x2f')]['findOne']({'where':{'id':_0x59e54a[_0xc175('0x4b')]['id']}})[_0xc175('0x25')](handleEntityNotFound(_0x3ac092,null))[_0xc175('0x25')](function(_0x2fafe3){if(_0x2fafe3){_0x362c17=_0x2fafe3;_0x58d344[_0xc175('0x33')]=_[_0xc175('0x35')](db['Interval'][_0xc175('0x30')]);_0x58d344[_0xc175('0x36')]=_['keys'](_0x59e54a[_0xc175('0x36')]);_0x58d344[_0xc175('0x37')]=_['intersection'](_0x58d344[_0xc175('0x33')],_0x58d344[_0xc175('0x36')]);_0x57019f[_0xc175('0x3a')]=_[_0xc175('0x38')](_0x58d344[_0xc175('0x33')],qs['fields'](_0x59e54a[_0xc175('0x36')][_0xc175('0x39')]));_0x57019f[_0xc175('0x3a')]=_0x57019f['attributes'][_0xc175('0x3b')]?_0x57019f[_0xc175('0x3a')]:_0x58d344['model'];_0x57019f['order']=qs[_0xc175('0x3f')](_0x59e54a[_0xc175('0x36')][_0xc175('0x3f')]);_0x57019f['where']=qs['filters'](_['pick'](_0x59e54a[_0xc175('0x36')],_0x58d344[_0xc175('0x37')]));if(_0x59e54a[_0xc175('0x36')][_0xc175('0x41')]){_0x57019f[_0xc175('0x42')]=_[_0xc175('0x45')](_0x57019f[_0xc175('0x42')],{'$or':_[_0xc175('0x34')](_0x57019f[_0xc175('0x3a')],function(_0x206f28){var _0x168eec={};_0x168eec[_0x206f28]={'$like':'%'+_0x59e54a[_0xc175('0x36')][_0xc175('0x41')]+'%'};return _0x168eec;})});}_0x57019f=_[_0xc175('0x45')]({},_0x57019f,_0x59e54a[_0xc175('0x46')]);return _0x362c17[_0xc175('0x57')](_0x57019f);}})['then'](function(_0x391c76){if(_0x391c76){_0x2010bc=_0x391c76[_0xc175('0x3b')];if(!_0x59e54a[_0xc175('0x36')][_0xc175('0x3c')](_0xc175('0x3d'))){_0x57019f[_0xc175('0x1d')]=qs['limit'](_0x59e54a[_0xc175('0x36')][_0xc175('0x1d')]);_0x57019f[_0xc175('0x1b')]=qs[_0xc175('0x1b')](_0x59e54a[_0xc175('0x36')][_0xc175('0x1b')]);}return _0x362c17[_0xc175('0x57')](_0x57019f);}})[_0xc175('0x25')](function(_0x3c3f98){if(_0x3c3f98){return _0x3c3f98?{'count':_0x2010bc,'rows':_0x3c3f98}:null;}})[_0xc175('0x25')](respondWithResult(_0x3ac092,null))[_0xc175('0x49')](handleError(_0x3ac092,null));};exports[_0xc175('0x58')]=function(_0x555221,_0x38edf2,_0x4a7db0){return db[_0xc175('0x2f')]['findOne']({'where':{'id':_0x555221[_0xc175('0x4b')]['id']}})[_0xc175('0x25')](handleEntityNotFound(_0x38edf2,null))[_0xc175('0x25')](function(_0x987030){if(_0x987030){return db[_0xc175('0x59')]['transaction'](function(_0x348f24){return db[_0xc175('0x2f')]['destroy']({'where':{'IntervalId':_0x555221[_0xc175('0x4b')]['id']},'transaction':_0x348f24})[_0xc175('0x25')](function(_0x3316a9){var _0x3d5aa0=_[_0xc175('0x34')](_0x555221[_0xc175('0x4f')],function(_0x474cee){delete _0x474cee['id'];_0x474cee['IntervalId']=_0x555221[_0xc175('0x4b')]['id'];return _0x474cee;});return db[_0xc175('0x2f')]['bulkCreate'](_0x3d5aa0,{'transaction':_0x348f24});});})[_0xc175('0x25')](function(){return db['Interval'][_0xc175('0x5a')]({'where':{'IntervalId':_0x555221[_0xc175('0x4b')]['id']}});});}})[_0xc175('0x25')](respondWithResult(_0x38edf2,null))[_0xc175('0x49')](handleError(_0x38edf2,null));}; \ No newline at end of file +var _0x9935=['role','Intervals','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','order','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','get','error','stack','name','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user'];(function(_0x373dd1,_0x4b7e91){var _0xea4901=function(_0x4de379){while(--_0x4de379){_0x373dd1['push'](_0x373dd1['shift']());}};_0xea4901(++_0x4b7e91);}(_0x9935,0xc3));var _0x5993=function(_0x490adb,_0x1e7ec9){_0x490adb=_0x490adb-0x0;var _0x2b29de=_0x9935[_0x490adb];return _0x2b29de;};'use strict';var emlformat=require(_0x5993('0x0'));var rimraf=require(_0x5993('0x1'));var zipdir=require(_0x5993('0x2'));var jsonpatch=require(_0x5993('0x3'));var rp=require('request-promise');var moment=require(_0x5993('0x4'));var BPromise=require(_0x5993('0x5'));var Mustache=require(_0x5993('0x6'));var util=require(_0x5993('0x7'));var path=require(_0x5993('0x8'));var sox=require(_0x5993('0x9'));var csv=require(_0x5993('0xa'));var ejs=require(_0x5993('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5993('0xc'));var squel=require(_0x5993('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5993('0xe'));var toCsv=require(_0x5993('0xa'));var querystring=require(_0x5993('0xf'));var Papa=require('papaparse');var Redis=require(_0x5993('0x10'));var authService=require(_0x5993('0x11'));var qs=require(_0x5993('0x12'));var as=require(_0x5993('0x13'));var hardwareService=require(_0x5993('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5993('0x15'));var db=require(_0x5993('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x36660d,_0x32531b){_0x32531b=_0x32531b||0xcc;return function(_0xf51bf1){if(_0xf51bf1){return _0x36660d['sendStatus'](_0x32531b);}return _0x36660d['status'](_0x32531b)[_0x5993('0x17')]();};}function respondWithResult(_0xb2bf2b,_0x398e8d){_0x398e8d=_0x398e8d||0xc8;return function(_0x39b698){if(_0x39b698){return _0xb2bf2b[_0x5993('0x18')](_0x398e8d)['json'](_0x39b698);}};}function respondWithFilteredResult(_0x496634,_0x370d04){return function(_0x3fa755){if(_0x3fa755){var _0x9ce0f=typeof _0x370d04[_0x5993('0x19')]==='undefined'&&typeof _0x370d04['limit']===_0x5993('0x1a');var _0x57a871=_0x3fa755[_0x5993('0x1b')];var _0x478ad6=_0x9ce0f?0x0:_0x370d04[_0x5993('0x19')];var _0x44b8de=_0x9ce0f?_0x3fa755['count']:_0x370d04[_0x5993('0x19')]+_0x370d04[_0x5993('0x1c')];var _0x3ba809;if(_0x44b8de>=_0x57a871){_0x44b8de=_0x57a871;_0x3ba809=0xc8;}else{_0x3ba809=0xce;}_0x496634[_0x5993('0x18')](_0x3ba809);return _0x496634['set']('Content-Range',_0x478ad6+'-'+_0x44b8de+'/'+_0x57a871)[_0x5993('0x1d')](_0x3fa755);}return null;};}function patchUpdates(_0x2f28ce){return function(_0x1dda38){try{jsonpatch[_0x5993('0x1e')](_0x1dda38,_0x2f28ce,!![]);}catch(_0xc71b81){return BPromise[_0x5993('0x1f')](_0xc71b81);}return _0x1dda38[_0x5993('0x20')]();};}function saveUpdates(_0x125cbf,_0x3165d0){return function(_0x308bc7){if(_0x308bc7){return _0x308bc7[_0x5993('0x21')](_0x125cbf)[_0x5993('0x22')](function(_0x2763a6){return _0x2763a6;});}return null;};}function removeEntity(_0x1f3e38,_0x393d69){return function(_0x355ba5){if(_0x355ba5){return _0x355ba5[_0x5993('0x23')]()['then'](function(){var _0x407a07=_0x355ba5[_0x5993('0x24')]({'plain':!![]});var _0x75b00e='Intervals';return db['UserProfileResource'][_0x5993('0x23')]({'where':{'type':_0x75b00e,'resourceId':_0x407a07['id']}})['then'](function(){return _0x355ba5;});})[_0x5993('0x22')](function(){_0x1f3e38[_0x5993('0x18')](0xcc)[_0x5993('0x17')]();});}};}function handleEntityNotFound(_0x3a5849,_0x5c96f8){return function(_0x16c2e1){if(!_0x16c2e1){_0x3a5849['sendStatus'](0x194);}return _0x16c2e1;};}function handleError(_0x587acb,_0x4a95b1){_0x4a95b1=_0x4a95b1||0x1f4;return function(_0x3fe14f){logger[_0x5993('0x25')](_0x3fe14f[_0x5993('0x26')]);if(_0x3fe14f[_0x5993('0x27')]){delete _0x3fe14f[_0x5993('0x27')];}_0x587acb['status'](_0x4a95b1)['send'](_0x3fe14f);};}exports['index']=function(_0x4aa2e4,_0x506863){var _0x4155a7={},_0xc4587a={},_0x4390a2={'count':0x0,'rows':[]};var _0x44c5f3=_[_0x5993('0x28')](db[_0x5993('0x29')][_0x5993('0x2a')],function(_0x5a5932){return{'name':_0x5a5932[_0x5993('0x2b')],'type':_0x5a5932[_0x5993('0x2c')][_0x5993('0x2d')]};});_0xc4587a[_0x5993('0x2e')]=_[_0x5993('0x28')](_0x44c5f3,_0x5993('0x27'));_0xc4587a[_0x5993('0x2f')]=_[_0x5993('0x30')](_0x4aa2e4[_0x5993('0x2f')]);_0xc4587a['filters']=_[_0x5993('0x31')](_0xc4587a[_0x5993('0x2e')],_0xc4587a['query']);_0x4155a7[_0x5993('0x32')]=_[_0x5993('0x31')](_0xc4587a[_0x5993('0x2e')],qs[_0x5993('0x33')](_0x4aa2e4[_0x5993('0x2f')]['fields']));_0x4155a7[_0x5993('0x32')]=_0x4155a7[_0x5993('0x32')][_0x5993('0x34')]?_0x4155a7[_0x5993('0x32')]:_0xc4587a[_0x5993('0x2e')];if(!_0x4aa2e4[_0x5993('0x2f')][_0x5993('0x35')]('nolimit')){_0x4155a7[_0x5993('0x1c')]=qs[_0x5993('0x1c')](_0x4aa2e4[_0x5993('0x2f')][_0x5993('0x1c')]);_0x4155a7[_0x5993('0x19')]=qs[_0x5993('0x19')](_0x4aa2e4[_0x5993('0x2f')][_0x5993('0x19')]);}_0x4155a7['order']=qs['sort'](_0x4aa2e4['query'][_0x5993('0x36')]);_0x4155a7[_0x5993('0x37')]=qs[_0x5993('0x38')](_[_0x5993('0x39')](_0x4aa2e4[_0x5993('0x2f')],_0xc4587a[_0x5993('0x38')]),_0x44c5f3);if(_0x4aa2e4[_0x5993('0x2f')][_0x5993('0x3a')]){_0x4155a7[_0x5993('0x37')]=_[_0x5993('0x3b')](_0x4155a7[_0x5993('0x37')],{'$or':_['map'](_0x44c5f3,function(_0x5129cb){if(_0x5129cb[_0x5993('0x2c')]!==_0x5993('0x3c')){var _0x4cb62d={};_0x4cb62d[_0x5129cb[_0x5993('0x27')]]={'$like':'%'+_0x4aa2e4[_0x5993('0x2f')][_0x5993('0x3a')]+'%'};return _0x4cb62d;}})});}_0x4155a7=_[_0x5993('0x3b')]({},_0x4155a7,_0x4aa2e4[_0x5993('0x3d')]);var _0x29e3b3={'where':_0x4155a7['where']};return db['Interval'][_0x5993('0x1b')](_0x29e3b3)[_0x5993('0x22')](function(_0x47b98d){_0x4390a2[_0x5993('0x1b')]=_0x47b98d;if(_0x4aa2e4[_0x5993('0x2f')][_0x5993('0x3e')]){_0x4155a7[_0x5993('0x3f')]=[{'all':!![]}];}return db['Interval'][_0x5993('0x40')](_0x4155a7);})[_0x5993('0x22')](function(_0x4909cf){_0x4390a2[_0x5993('0x41')]=_0x4909cf;return _0x4390a2;})[_0x5993('0x22')](respondWithFilteredResult(_0x506863,_0x4155a7))[_0x5993('0x42')](handleError(_0x506863,null));};exports[_0x5993('0x43')]=function(_0x5a9851,_0x56eec6){var _0x462127={'raw':!![],'where':{'id':_0x5a9851['params']['id']}},_0x51f3ac={};_0x51f3ac[_0x5993('0x2e')]=_[_0x5993('0x30')](db[_0x5993('0x29')]['rawAttributes']);_0x51f3ac[_0x5993('0x2f')]=_[_0x5993('0x30')](_0x5a9851['query']);_0x51f3ac['filters']=_['intersection'](_0x51f3ac[_0x5993('0x2e')],_0x51f3ac[_0x5993('0x2f')]);_0x462127[_0x5993('0x32')]=_[_0x5993('0x31')](_0x51f3ac['model'],qs[_0x5993('0x33')](_0x5a9851[_0x5993('0x2f')][_0x5993('0x33')]));_0x462127[_0x5993('0x32')]=_0x462127[_0x5993('0x32')]['length']?_0x462127[_0x5993('0x32')]:_0x51f3ac[_0x5993('0x2e')];if(_0x5a9851[_0x5993('0x2f')][_0x5993('0x3e')]){_0x462127['include']=[{'all':!![]}];}_0x462127=_[_0x5993('0x3b')]({},_0x462127,_0x5a9851[_0x5993('0x3d')]);return db['Interval'][_0x5993('0x44')](_0x462127)[_0x5993('0x22')](handleEntityNotFound(_0x56eec6,null))[_0x5993('0x22')](respondWithResult(_0x56eec6,null))[_0x5993('0x42')](handleError(_0x56eec6,null));};exports['create']=function(_0x73b323,_0x3c113c){return db['Interval'][_0x5993('0x45')](_0x73b323[_0x5993('0x46')],{})[_0x5993('0x22')](function(_0x391af9){var _0x12dc66=_0x73b323[_0x5993('0x47')][_0x5993('0x24')]({'plain':!![]});if(!_0x12dc66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12dc66[_0x5993('0x48')]===_0x5993('0x47')){var _0x2898d9=_0x391af9[_0x5993('0x24')]({'plain':!![]});var _0x1b64ba=_0x5993('0x49');return db[_0x5993('0x4a')][_0x5993('0x44')]({'where':{'name':_0x1b64ba,'userProfileId':_0x12dc66[_0x5993('0x4b')]},'raw':!![]})[_0x5993('0x22')](function(_0x7bd486){if(_0x7bd486&&_0x7bd486[_0x5993('0x4c')]===0x0){return db[_0x5993('0x4d')][_0x5993('0x45')]({'name':_0x2898d9['name'],'resourceId':_0x2898d9['id'],'type':_0x7bd486[_0x5993('0x27')],'sectionId':_0x7bd486['id']},{})['then'](function(){return _0x391af9;});}else{return _0x391af9;}})[_0x5993('0x42')](function(_0x4397c9){logger['error'](_0x5993('0x4e'),_0x4397c9);throw _0x4397c9;});}return _0x391af9;})[_0x5993('0x22')](respondWithResult(_0x3c113c,0xc9))['catch'](handleError(_0x3c113c,null));};exports[_0x5993('0x21')]=function(_0x306517,_0x232fff){if(_0x306517['body']['id']){delete _0x306517[_0x5993('0x46')]['id'];}return db['Interval'][_0x5993('0x44')]({'where':{'id':_0x306517[_0x5993('0x4f')]['id']}})[_0x5993('0x22')](handleEntityNotFound(_0x232fff,null))[_0x5993('0x22')](saveUpdates(_0x306517[_0x5993('0x46')],null))[_0x5993('0x22')](respondWithResult(_0x232fff,null))['catch'](handleError(_0x232fff,null));};exports[_0x5993('0x23')]=function(_0x44d971,_0x530a83){return db[_0x5993('0x29')][_0x5993('0x44')]({'where':{'id':_0x44d971[_0x5993('0x4f')]['id']}})[_0x5993('0x22')](handleEntityNotFound(_0x530a83,null))[_0x5993('0x22')](removeEntity(_0x530a83,null))[_0x5993('0x42')](handleError(_0x530a83,null));};exports['addInterval']=function(_0x5940d5,_0x26cf29,_0x2a00a6){if(_0x5940d5['body']['id']){delete _0x5940d5[_0x5993('0x46')]['id'];}return db[_0x5993('0x29')]['find']({'where':{'id':_0x5940d5[_0x5993('0x4f')]['id']}})[_0x5993('0x22')](handleEntityNotFound(_0x26cf29,null))[_0x5993('0x22')](function(_0x4a7907){if(_0x4a7907){_0x5940d5[_0x5993('0x46')][_0x5993('0x50')]=_0x4a7907['id'];return db[_0x5993('0x29')]['create'](_0x5940d5[_0x5993('0x46')]);}})[_0x5993('0x22')](respondWithResult(_0x26cf29,null))['catch'](handleError(_0x26cf29,null));};exports[_0x5993('0x51')]=function(_0x5570da,_0x11d067,_0x2751ba){var _0x35abe7={};var _0x249522={};var _0x44c014;var _0x4bacf3;return db[_0x5993('0x29')][_0x5993('0x52')]({'where':{'id':_0x5570da[_0x5993('0x4f')]['id']}})[_0x5993('0x22')](handleEntityNotFound(_0x11d067,null))[_0x5993('0x22')](function(_0x1c94ad){if(_0x1c94ad){_0x44c014=_0x1c94ad;_0x249522[_0x5993('0x2e')]=_['keys'](db[_0x5993('0x29')]['rawAttributes']);_0x249522[_0x5993('0x2f')]=_[_0x5993('0x30')](_0x5570da['query']);_0x249522[_0x5993('0x38')]=_['intersection'](_0x249522[_0x5993('0x2e')],_0x249522[_0x5993('0x2f')]);_0x35abe7[_0x5993('0x32')]=_['intersection'](_0x249522['model'],qs[_0x5993('0x33')](_0x5570da[_0x5993('0x2f')]['fields']));_0x35abe7[_0x5993('0x32')]=_0x35abe7[_0x5993('0x32')][_0x5993('0x34')]?_0x35abe7[_0x5993('0x32')]:_0x249522[_0x5993('0x2e')];_0x35abe7[_0x5993('0x53')]=qs[_0x5993('0x36')](_0x5570da[_0x5993('0x2f')][_0x5993('0x36')]);_0x35abe7[_0x5993('0x37')]=qs[_0x5993('0x38')](_[_0x5993('0x39')](_0x5570da[_0x5993('0x2f')],_0x249522[_0x5993('0x38')]));if(_0x5570da[_0x5993('0x2f')][_0x5993('0x3a')]){_0x35abe7['where']=_['merge'](_0x35abe7[_0x5993('0x37')],{'$or':_[_0x5993('0x28')](_0x35abe7[_0x5993('0x32')],function(_0xe4ca7a){var _0x58b740={};_0x58b740[_0xe4ca7a]={'$like':'%'+_0x5570da[_0x5993('0x2f')][_0x5993('0x3a')]+'%'};return _0x58b740;})});}_0x35abe7=_[_0x5993('0x3b')]({},_0x35abe7,_0x5570da[_0x5993('0x3d')]);return _0x44c014[_0x5993('0x51')](_0x35abe7);}})['then'](function(_0x1c36e8){if(_0x1c36e8){_0x4bacf3=_0x1c36e8['length'];if(!_0x5570da[_0x5993('0x2f')]['hasOwnProperty'](_0x5993('0x54'))){_0x35abe7[_0x5993('0x1c')]=qs['limit'](_0x5570da[_0x5993('0x2f')]['limit']);_0x35abe7[_0x5993('0x19')]=qs[_0x5993('0x19')](_0x5570da[_0x5993('0x2f')]['offset']);}return _0x44c014['getIntervals'](_0x35abe7);}})['then'](function(_0x4bb58a){if(_0x4bb58a){return _0x4bb58a?{'count':_0x4bacf3,'rows':_0x4bb58a}:null;}})['then'](respondWithResult(_0x11d067,null))[_0x5993('0x42')](handleError(_0x11d067,null));};exports[_0x5993('0x55')]=function(_0x219b08,_0x43fcf5,_0x347531){return db[_0x5993('0x29')]['findOne']({'where':{'id':_0x219b08[_0x5993('0x4f')]['id']}})[_0x5993('0x22')](handleEntityNotFound(_0x43fcf5,null))[_0x5993('0x22')](function(_0x44466f){if(_0x44466f){return db[_0x5993('0x56')][_0x5993('0x57')](function(_0x51433c){return db[_0x5993('0x29')]['destroy']({'where':{'IntervalId':_0x219b08[_0x5993('0x4f')]['id']},'transaction':_0x51433c})[_0x5993('0x22')](function(_0x43d222){var _0x4a9313=_[_0x5993('0x28')](_0x219b08['body'],function(_0x2eba74){delete _0x2eba74['id'];_0x2eba74[_0x5993('0x50')]=_0x219b08[_0x5993('0x4f')]['id'];return _0x2eba74;});return db[_0x5993('0x29')][_0x5993('0x58')](_0x4a9313,{'transaction':_0x51433c});});})[_0x5993('0x22')](function(){return db[_0x5993('0x29')][_0x5993('0x40')]({'where':{'IntervalId':_0x219b08[_0x5993('0x4f')]['id']}});});}})['then'](respondWithResult(_0x43fcf5,null))['catch'](handleError(_0x43fcf5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 364aab0..2306edd 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 _0x5a59=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite'];(function(_0x3d2a2c,_0x16ee83){var _0x11ed17=function(_0x58e8fa){while(--_0x58e8fa){_0x3d2a2c['push'](_0x3d2a2c['shift']());}};_0x11ed17(++_0x16ee83);}(_0x5a59,0xb6));var _0x95a5=function(_0x2e160c,_0x15f43e){_0x2e160c=_0x2e160c-0x0;var _0x4ea3c6=_0x5a59[_0x2e160c];return _0x4ea3c6;};'use strict';var _=require(_0x95a5('0x0'));var util=require('util');var logger=require(_0x95a5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x95a5('0x2'));var rp=require(_0x95a5('0x3'));var fs=require('fs');var path=require(_0x95a5('0x4'));var rimraf=require(_0x95a5('0x5'));var config=require(_0x95a5('0x6'));var attributes=require(_0x95a5('0x7'));var extensions=require(_0x95a5('0x8'));module[_0x95a5('0x9')]=function(_0x5af0d1,_0x296351){return _0x5af0d1[_0x95a5('0xa')](_0x95a5('0xb'),attributes,{'tableName':_0x95a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b0307,_0x43a320){extensions[_0x95a5('0xd')](_0x5af0d1,_0x2b0307);},'afterBulkCreate':function(_0x19ae0a,_0x21e407,_0x42356e){_0x42356e();extensions[_0x95a5('0xd')](_0x5af0d1,_0x19ae0a[0x0]);},'afterUpdate':function(_0x535af4,_0x217528){extensions[_0x95a5('0xd')](_0x5af0d1,_0x535af4);},'afterDestroy':function(_0x13bd16,_0x3ecc53){extensions[_0x95a5('0xd')](_0x5af0d1,_0x13bd16);}}});}; \ No newline at end of file +var _0xfd5b=['rewrite','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals'];(function(_0x28185e,_0x5cc01c){var _0x19cd89=function(_0x1ab604){while(--_0x1ab604){_0x28185e['push'](_0x28185e['shift']());}};_0x19cd89(++_0x5cc01c);}(_0xfd5b,0x15a));var _0xbfd5=function(_0x18b554,_0x1af747){_0x18b554=_0x18b554-0x0;var _0x13ef64=_0xfd5b[_0x18b554];return _0x13ef64;};'use strict';var _=require(_0xbfd5('0x0'));var util=require(_0xbfd5('0x1'));var logger=require('../../config/logger')(_0xbfd5('0x2'));var moment=require(_0xbfd5('0x3'));var BPromise=require(_0xbfd5('0x4'));var rp=require(_0xbfd5('0x5'));var fs=require('fs');var path=require(_0xbfd5('0x6'));var rimraf=require(_0xbfd5('0x7'));var config=require(_0xbfd5('0x8'));var attributes=require(_0xbfd5('0x9'));var extensions=require(_0xbfd5('0xa'));module[_0xbfd5('0xb')]=function(_0x2914f2,_0x32cc50){return _0x2914f2['define'](_0xbfd5('0xc'),attributes,{'tableName':_0xbfd5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13c096,_0x5d7b05){extensions[_0xbfd5('0xe')](_0x2914f2,_0x13c096);},'afterBulkCreate':function(_0x47ce6f,_0x102021,_0x1672f5){_0x1672f5();extensions[_0xbfd5('0xe')](_0x2914f2,_0x47ce6f[0x0]);},'afterUpdate':function(_0x5b00ff,_0x5cdfc3){extensions[_0xbfd5('0xe')](_0x2914f2,_0x5b00ff);},'afterDestroy':function(_0x34e96f,_0x79e75){extensions['rewrite'](_0x2914f2,_0x34e96f);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8d029ba..90e2df0 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index cc2d235..acd9a5e 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x570d85,_0x2016d4){var _0x313902=function(_0x503b6f){while(--_0x503b6f){_0x570d85['push'](_0x570d85['shift']());}};_0x313902(++_0x2016d4);}(_0xadb5,0xad));var _0x5adb=function(_0x370466,_0x46a0c8){_0x370466=_0x370466-0x0;var _0x4cc4ba=_0xadb5[_0x370466];return _0x4cc4ba;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x1e1b5a,_0x13b534){var _0x3206db=function(_0x5d6c2f){while(--_0x5d6c2f){_0x1e1b5a['push'](_0x1e1b5a['shift']());}};_0x3206db(++_0x13b534);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34bb03,_0x3c4f28){_0x34bb03=_0x34bb03-0x0;var _0x165928=_0x5f2f[_0x34bb03];return _0x165928;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 99f9e5e..07031be 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 _0x03b2=['description','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','setEncoding','utf8','data','end','statusCode','json','parse','error','status','api.jira','write','openIssue','send','body','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','Report','\x20from\x20'];(function(_0x4d2938,_0x332d65){var _0x5e7d9b=function(_0x135e24){while(--_0x135e24){_0x4d2938['push'](_0x4d2938['shift']());}};_0x5e7d9b(++_0x332d65);}(_0x03b2,0x11e));var _0x203b=function(_0x286595,_0x29f350){_0x286595=_0x286595-0x0;var _0x3ea6b8=_0x03b2[_0x286595];return _0x3ea6b8;};'use strict';var BPromise=require(_0x203b('0x0'));var https=require(_0x203b('0x1'));var logger=require(_0x203b('0x2'))('api');var USERNAME=_0x203b('0x3');var PASSWORD=_0x203b('0x4');function openIssue(_0x39c312,_0x4240a3){var _0x4c0a86={'fields':{'project':{'key':_0x39c312[_0x203b('0x5')]||'MOTGUI'},'summary':(_0x39c312['summary']||_0x203b('0x6'))+_0x203b('0x7')+_0x39c312['ip'],'description':_0x39c312[_0x203b('0x8')]||JSON['stringify'](_0x39c312),'issuetype':{'name':_0x39c312[_0x203b('0x9')]||'Bug'}}};_0x4c0a86[_0x203b('0xa')][_0x203b('0xb')]=_0x39c312[_0x203b('0xc')];_0x4c0a86[_0x203b('0xa')][_0x203b('0xd')]=_0x39c312[_0x203b('0xe')];_0x4c0a86['fields'][_0x203b('0xf')]=_0x39c312['newToken'];_0x4c0a86[_0x203b('0xa')]['customfield_11503']=_0x39c312['name'];_0x4c0a86[_0x203b('0xa')][_0x203b('0x10')]=_0x39c312['reason'];_0x4c0a86[_0x203b('0xa')][_0x203b('0x11')]=_0x39c312['ip'];var _0x1a7743={'host':_0x203b('0x12'),'port':0x1bb,'path':_0x203b('0x13'),'method':_0x203b('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x203b('0x15'),'Authorization':_0x203b('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x203b('0x17')]('base64')}};var _0x3eb13a=JSON[_0x203b('0x18')](_0x4c0a86);var _0x5cd501=https['request'](_0x1a7743,function(_0x4dd60d){_0x4dd60d[_0x203b('0x19')](_0x203b('0x1a'));var _0x44cbf6='';_0x4dd60d['on'](_0x203b('0x1b'),function(_0xefebd9){_0x44cbf6+=_0xefebd9;});_0x4dd60d['on'](_0x203b('0x1c'),function(){if(_0x4240a3){return _0x4240a3['status'](_0x4dd60d[_0x203b('0x1d')])[_0x203b('0x1e')](JSON[_0x203b('0x1f')](_0x44cbf6));}});});_0x5cd501['on'](_0x203b('0x20'),function(_0x34606b){if(_0x4240a3){return _0x4240a3[_0x203b('0x21')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x203b('0x22')}]});}});_0x5cd501[_0x203b('0x23')](_0x3eb13a);_0x5cd501[_0x203b('0x1c')]();}exports[_0x203b('0x24')]=openIssue;exports[_0x203b('0x25')]=function(_0x4352ed,_0x4ac2a0){_0x4352ed[_0x203b('0x26')]['ip']=_0x4352ed['headers']['x-forwarded-for']||_0x4352ed[_0x203b('0x27')][_0x203b('0x28')]||_0x4352ed[_0x203b('0x29')][_0x203b('0x28')]||_0x4352ed[_0x203b('0x27')][_0x203b('0x29')]['remoteAddress'];return openIssue(_0x4352ed['body'],_0x4ac2a0);}; \ No newline at end of file +var _0xeb0f=['Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary'];(function(_0x1f83d6,_0x58d5c3){var _0x27fda7=function(_0x4a571d){while(--_0x4a571d){_0x1f83d6['push'](_0x1f83d6['shift']());}};_0x27fda7(++_0x58d5c3);}(_0xeb0f,0xec));var _0xfeb0=function(_0x2f28bd,_0x36e333){_0x2f28bd=_0x2f28bd-0x0;var _0x320dc5=_0xeb0f[_0x2f28bd];return _0x320dc5;};'use strict';var BPromise=require(_0xfeb0('0x0'));var https=require(_0xfeb0('0x1'));var logger=require(_0xfeb0('0x2'))(_0xfeb0('0x3'));var USERNAME=_0xfeb0('0x4');var PASSWORD=_0xfeb0('0x5');function openIssue(_0x365611,_0x1824f7){var _0x191afc={'fields':{'project':{'key':_0x365611[_0xfeb0('0x6')]||_0xfeb0('0x7')},'summary':(_0x365611[_0xfeb0('0x8')]||_0xfeb0('0x9'))+_0xfeb0('0xa')+_0x365611['ip'],'description':_0x365611[_0xfeb0('0xb')]||JSON[_0xfeb0('0xc')](_0x365611),'issuetype':{'name':_0x365611['issuetype']||_0xfeb0('0xd')}}};_0x191afc[_0xfeb0('0xe')][_0xfeb0('0xf')]=_0x365611[_0xfeb0('0x10')];_0x191afc['fields']['customfield_11501']=_0x365611[_0xfeb0('0x11')];_0x191afc[_0xfeb0('0xe')][_0xfeb0('0x12')]=_0x365611[_0xfeb0('0x13')];_0x191afc['fields'][_0xfeb0('0x14')]=_0x365611['name'];_0x191afc[_0xfeb0('0xe')][_0xfeb0('0x15')]=_0x365611[_0xfeb0('0x16')];_0x191afc[_0xfeb0('0xe')][_0xfeb0('0x17')]=_0x365611['ip'];var _0x87e652={'host':_0xfeb0('0x18'),'port':0x1bb,'path':_0xfeb0('0x19'),'method':_0xfeb0('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0xfeb0('0x1b'),'Authorization':_0xfeb0('0x1c')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xfeb0('0x1d'))}};var _0x5f269a=JSON[_0xfeb0('0xc')](_0x191afc);var _0x4ac475=https[_0xfeb0('0x1e')](_0x87e652,function(_0x23238b){_0x23238b[_0xfeb0('0x1f')](_0xfeb0('0x20'));var _0x3ef8bf='';_0x23238b['on'](_0xfeb0('0x21'),function(_0x572694){_0x3ef8bf+=_0x572694;});_0x23238b['on']('end',function(){if(_0x1824f7){return _0x1824f7[_0xfeb0('0x22')](_0x23238b['statusCode'])[_0xfeb0('0x23')](JSON[_0xfeb0('0x24')](_0x3ef8bf));}});});_0x4ac475['on'](_0xfeb0('0x25'),function(_0x1196bc){if(_0x1824f7){return _0x1824f7[_0xfeb0('0x22')](0x1f4)[_0xfeb0('0x23')]({'errors':[{'message':_0xfeb0('0x26'),'type':_0xfeb0('0x27')}]});}});_0x4ac475[_0xfeb0('0x28')](_0x5f269a);_0x4ac475[_0xfeb0('0x29')]();}exports['openIssue']=openIssue;exports[_0xfeb0('0x2a')]=function(_0x37bddf,_0x3fa650){_0x37bddf[_0xfeb0('0x2b')]['ip']=_0x37bddf[_0xfeb0('0x2c')][_0xfeb0('0x2d')]||_0x37bddf[_0xfeb0('0x2e')][_0xfeb0('0x2f')]||_0x37bddf['socket'][_0xfeb0('0x2f')]||_0x37bddf[_0xfeb0('0x2e')][_0xfeb0('0x30')][_0xfeb0('0x2f')];return openIssue(_0x37bddf['body'],_0x3fa650);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b0aa550..59ceca5 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 _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(_0x2139b1,_0x1318ad){var _0x13639b=function(_0x5bf590){while(--_0x5bf590){_0x2139b1['push'](_0x2139b1['shift']());}};_0x13639b(++_0x1318ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x592c54,_0x142737){_0x592c54=_0x592c54-0x0;var _0x34e4b1=_0xedd9[_0x592c54];return _0x34e4b1;};'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 +var _0x9f62=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','post','/:id','delete','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0x9f62,0x154));var _0x29f6=function(_0x3288ae,_0x274ea3){_0x3288ae=_0x3288ae-0x0;var _0x573cf8=_0x9f62[_0x3288ae];return _0x573cf8;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),auth[_0x29f6('0xa')](),controller[_0x29f6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x29f6('0xc')]('/',auth[_0x29f6('0xa')](),controller['create']);router['put'](_0x29f6('0xd'),auth[_0x29f6('0xa')](),controller['update']);router[_0x29f6('0xe')](_0x29f6('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 710ed97..7d799da 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x5856ce,_0x2fbfb9){_0x5856ce=_0x5856ce-0x0;var _0x97a6d5=_0x7a54[_0x5856ce];return _0x97a6d5;};'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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x4d7beb,_0x352d47){_0x4d7beb=_0x4d7beb-0x0;var _0x5c2aad=_0x7a54[_0x4d7beb];return _0x5c2aad;};'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 8efb1f2..ce54d77 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 _0x943c=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','includeAll','include','rows','show','params','fields','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc943('0x0'));var rimraf=require(_0xc943('0x1'));var zipdir=require(_0xc943('0x2'));var jsonpatch=require(_0xc943('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc943('0x4'));var Mustache=require(_0xc943('0x5'));var util=require(_0xc943('0x6'));var path=require('path');var sox=require(_0xc943('0x7'));var csv=require(_0xc943('0x8'));var ejs=require(_0xc943('0x9'));var fs=require('fs');var fs_extra=require(_0xc943('0xa'));var _=require(_0xc943('0xb'));var squel=require(_0xc943('0xc'));var crypto=require(_0xc943('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc943('0xe'));var toCsv=require(_0xc943('0x8'));var querystring=require(_0xc943('0xf'));var Papa=require(_0xc943('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc943('0x11'));var as=require(_0xc943('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc943('0x13'));var utils=require(_0xc943('0x14'));var config=require(_0xc943('0x15'));var licenseUtil=require(_0xc943('0x16'));var db=require(_0xc943('0x17'))['db'];function respondWithStatusCode(_0x21c3e7,_0x5ee50d){_0x5ee50d=_0x5ee50d||0xcc;return function(_0xf11802){if(_0xf11802){return _0x21c3e7[_0xc943('0x18')](_0x5ee50d);}return _0x21c3e7['status'](_0x5ee50d)['end']();};}function respondWithResult(_0x4e9f88,_0x334fe2){_0x334fe2=_0x334fe2||0xc8;return function(_0xbdc5c4){if(_0xbdc5c4){return _0x4e9f88['status'](_0x334fe2)[_0xc943('0x19')](_0xbdc5c4);}};}function respondWithFilteredResult(_0x537a11,_0x559fb0){return function(_0x2fa39b){if(_0x2fa39b){var _0x5541d8=typeof _0x559fb0[_0xc943('0x1a')]===_0xc943('0x1b')&&typeof _0x559fb0[_0xc943('0x1c')]===_0xc943('0x1b');var _0x4b6a28=_0x2fa39b[_0xc943('0x1d')];var _0x3b3661=_0x5541d8?0x0:_0x559fb0[_0xc943('0x1a')];var _0x4fd8f5=_0x5541d8?_0x2fa39b[_0xc943('0x1d')]:_0x559fb0[_0xc943('0x1a')]+_0x559fb0[_0xc943('0x1c')];var _0x200cba;if(_0x4fd8f5>=_0x4b6a28){_0x4fd8f5=_0x4b6a28;_0x200cba=0xc8;}else{_0x200cba=0xce;}_0x537a11[_0xc943('0x1e')](_0x200cba);return _0x537a11[_0xc943('0x1f')](_0xc943('0x20'),_0x3b3661+'-'+_0x4fd8f5+'/'+_0x4b6a28)[_0xc943('0x19')](_0x2fa39b);}return null;};}function patchUpdates(_0x2dbb35){return function(_0x1765c5){try{jsonpatch[_0xc943('0x21')](_0x1765c5,_0x2dbb35,!![]);}catch(_0x6ca3c6){return BPromise[_0xc943('0x22')](_0x6ca3c6);}return _0x1765c5[_0xc943('0x23')]();};}function saveUpdates(_0x47082e,_0x19f93e){return function(_0x43712d){if(_0x43712d){return _0x43712d[_0xc943('0x24')](_0x47082e)[_0xc943('0x25')](function(_0x59055e){return _0x59055e;});}return null;};}function removeEntity(_0x454c48,_0x469b9e){return function(_0x2a0731){if(_0x2a0731){return _0x2a0731[_0xc943('0x26')]()[_0xc943('0x25')](function(){_0x454c48[_0xc943('0x1e')](0xcc)[_0xc943('0x27')]();});}};}function handleEntityNotFound(_0x319a7a,_0x3dbaef){return function(_0x41b83e){if(!_0x41b83e){_0x319a7a[_0xc943('0x18')](0x194);}return _0x41b83e;};}function handleError(_0x462bfc,_0x1d2bf4){_0x1d2bf4=_0x1d2bf4||0x1f4;return function(_0x1a87fd){logger['error'](_0x1a87fd[_0xc943('0x28')]);if(_0x1a87fd[_0xc943('0x29')]){delete _0x1a87fd[_0xc943('0x29')];}_0x462bfc[_0xc943('0x1e')](_0x1d2bf4)[_0xc943('0x2a')](_0x1a87fd);};}exports[_0xc943('0x2b')]=function(_0x4e77b3,_0x282cca){var _0x4ac0ad={},_0x7ada76={},_0x288700={'count':0x0,'rows':[]};var _0x280434=_[_0xc943('0x2c')](db[_0xc943('0x2d')][_0xc943('0x2e')],function(_0x4a7bce){return{'name':_0x4a7bce['fieldName'],'type':_0x4a7bce[_0xc943('0x2f')][_0xc943('0x30')]};});_0x7ada76[_0xc943('0x31')]=_[_0xc943('0x2c')](_0x280434,'name');_0x7ada76['query']=_[_0xc943('0x32')](_0x4e77b3[_0xc943('0x33')]);_0x7ada76['filters']=_[_0xc943('0x34')](_0x7ada76['model'],_0x7ada76[_0xc943('0x33')]);_0x4ac0ad[_0xc943('0x35')]=_[_0xc943('0x34')](_0x7ada76[_0xc943('0x31')],qs['fields'](_0x4e77b3[_0xc943('0x33')]['fields']));_0x4ac0ad[_0xc943('0x35')]=_0x4ac0ad[_0xc943('0x35')][_0xc943('0x36')]?_0x4ac0ad['attributes']:_0x7ada76[_0xc943('0x31')];if(!_0x4e77b3[_0xc943('0x33')][_0xc943('0x37')](_0xc943('0x38'))){_0x4ac0ad[_0xc943('0x1c')]=qs[_0xc943('0x1c')](_0x4e77b3['query']['limit']);_0x4ac0ad['offset']=qs[_0xc943('0x1a')](_0x4e77b3[_0xc943('0x33')][_0xc943('0x1a')]);}_0x4ac0ad[_0xc943('0x39')]=qs[_0xc943('0x3a')](_0x4e77b3[_0xc943('0x33')][_0xc943('0x3a')]);_0x4ac0ad[_0xc943('0x3b')]=qs[_0xc943('0x3c')](_['pick'](_0x4e77b3['query'],_0x7ada76[_0xc943('0x3c')]),_0x280434);if(_0x4e77b3[_0xc943('0x33')]['filter']){_0x4ac0ad['where']=_[_0xc943('0x3d')](_0x4ac0ad[_0xc943('0x3b')],{'$or':_[_0xc943('0x2c')](_0x280434,function(_0x5e8344){if(_0x5e8344[_0xc943('0x2f')]!=='VIRTUAL'){var _0x79cc0d={};_0x79cc0d[_0x5e8344['name']]={'$like':'%'+_0x4e77b3[_0xc943('0x33')][_0xc943('0x3e')]+'%'};return _0x79cc0d;}})});}_0x4ac0ad=_[_0xc943('0x3d')]({},_0x4ac0ad,_0x4e77b3['options']);var _0x5797d7={'where':_0x4ac0ad[_0xc943('0x3b')]};return db[_0xc943('0x2d')][_0xc943('0x1d')](_0x5797d7)[_0xc943('0x25')](function(_0x5e6f15){_0x288700[_0xc943('0x1d')]=_0x5e6f15;if(_0x4e77b3[_0xc943('0x33')][_0xc943('0x3f')]){_0x4ac0ad[_0xc943('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4ac0ad);})['then'](function(_0x573fba){_0x288700[_0xc943('0x41')]=_0x573fba;return _0x288700;})[_0xc943('0x25')](respondWithFilteredResult(_0x282cca,_0x4ac0ad))['catch'](handleError(_0x282cca,null));};exports[_0xc943('0x42')]=function(_0x476393,_0x40cc60){var _0x3a172c={'raw':!![],'where':{'id':_0x476393[_0xc943('0x43')]['id']}},_0x127e4e={};_0x127e4e[_0xc943('0x31')]=_[_0xc943('0x32')](db['JscriptyAnswerReport'][_0xc943('0x2e')]);_0x127e4e[_0xc943('0x33')]=_[_0xc943('0x32')](_0x476393[_0xc943('0x33')]);_0x127e4e[_0xc943('0x3c')]=_['intersection'](_0x127e4e[_0xc943('0x31')],_0x127e4e['query']);_0x3a172c['attributes']=_['intersection'](_0x127e4e[_0xc943('0x31')],qs[_0xc943('0x44')](_0x476393['query'][_0xc943('0x44')]));_0x3a172c[_0xc943('0x35')]=_0x3a172c[_0xc943('0x35')][_0xc943('0x36')]?_0x3a172c[_0xc943('0x35')]:_0x127e4e[_0xc943('0x31')];if(_0x476393[_0xc943('0x33')][_0xc943('0x3f')]){_0x3a172c[_0xc943('0x40')]=[{'all':!![]}];}_0x3a172c=_[_0xc943('0x3d')]({},_0x3a172c,_0x476393[_0xc943('0x45')]);return db[_0xc943('0x2d')][_0xc943('0x46')](_0x3a172c)['then'](handleEntityNotFound(_0x40cc60,null))[_0xc943('0x25')](respondWithResult(_0x40cc60,null))['catch'](handleError(_0x40cc60,null));};exports['create']=function(_0xc138e0,_0x388fdc){return db[_0xc943('0x2d')]['create'](_0xc138e0['body'],{})[_0xc943('0x25')](respondWithResult(_0x388fdc,0xc9))[_0xc943('0x47')](handleError(_0x388fdc,null));};exports[_0xc943('0x24')]=function(_0x37a29d,_0x26ff18){if(_0x37a29d[_0xc943('0x48')]['id']){delete _0x37a29d[_0xc943('0x48')]['id'];}return db[_0xc943('0x2d')]['find']({'where':{'id':_0x37a29d['params']['id']}})[_0xc943('0x25')](handleEntityNotFound(_0x26ff18,null))[_0xc943('0x25')](saveUpdates(_0x37a29d[_0xc943('0x48')],null))['then'](respondWithResult(_0x26ff18,null))[_0xc943('0x47')](handleError(_0x26ff18,null));};exports[_0xc943('0x26')]=function(_0x1a0934,_0x3f264b){return db[_0xc943('0x2d')]['find']({'where':{'id':_0x1a0934[_0xc943('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f264b,null))[_0xc943('0x25')](removeEntity(_0x3f264b,null))[_0xc943('0x47')](handleError(_0x3f264b,null));};exports[_0xc943('0x49')]=function(_0x2e2eac,_0x3eb2da){return db[_0xc943('0x2d')][_0xc943('0x49')]()[_0xc943('0x25')](respondWithResult(_0x3eb2da,null))[_0xc943('0x47')](handleError(_0x3eb2da,null));}; \ No newline at end of file +var _0xbd10=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','map','JscriptyAnswerReport','fieldName','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x405e6f,_0x4023ab){var _0x2d16ba=function(_0x3a97bc){while(--_0x3a97bc){_0x405e6f['push'](_0x405e6f['shift']());}};_0x2d16ba(++_0x4023ab);}(_0xbd10,0x85));var _0x0bd1=function(_0x1ef740,_0x14ad56){_0x1ef740=_0x1ef740-0x0;var _0x11e7b0=_0xbd10[_0x1ef740];return _0x11e7b0;};'use strict';var emlformat=require(_0x0bd1('0x0'));var rimraf=require(_0x0bd1('0x1'));var zipdir=require(_0x0bd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd1('0x3'));var moment=require(_0x0bd1('0x4'));var BPromise=require(_0x0bd1('0x5'));var Mustache=require('mustache');var util=require(_0x0bd1('0x6'));var path=require(_0x0bd1('0x7'));var sox=require(_0x0bd1('0x8'));var csv=require(_0x0bd1('0x9'));var ejs=require(_0x0bd1('0xa'));var fs=require('fs');var fs_extra=require(_0x0bd1('0xb'));var _=require('lodash');var squel=require(_0x0bd1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0bd1('0xd'));var deskjs=require(_0x0bd1('0xe'));var toCsv=require(_0x0bd1('0x9'));var querystring=require(_0x0bd1('0xf'));var Papa=require('papaparse');var Redis=require(_0x0bd1('0x10'));var authService=require(_0x0bd1('0x11'));var qs=require(_0x0bd1('0x12'));var as=require(_0x0bd1('0x13'));var hardwareService=require(_0x0bd1('0x14'));var logger=require(_0x0bd1('0x15'))('api');var utils=require(_0x0bd1('0x16'));var config=require(_0x0bd1('0x17'));var licenseUtil=require(_0x0bd1('0x18'));var db=require(_0x0bd1('0x19'))['db'];function respondWithStatusCode(_0x4009e4,_0x1f441f){_0x1f441f=_0x1f441f||0xcc;return function(_0x57fd1d){if(_0x57fd1d){return _0x4009e4[_0x0bd1('0x1a')](_0x1f441f);}return _0x4009e4[_0x0bd1('0x1b')](_0x1f441f)[_0x0bd1('0x1c')]();};}function respondWithResult(_0x5025e1,_0x51f988){_0x51f988=_0x51f988||0xc8;return function(_0x3e2f49){if(_0x3e2f49){return _0x5025e1[_0x0bd1('0x1b')](_0x51f988)[_0x0bd1('0x1d')](_0x3e2f49);}};}function respondWithFilteredResult(_0x56055b,_0x5ab8a5){return function(_0x180809){if(_0x180809){var _0x88e088=typeof _0x5ab8a5[_0x0bd1('0x1e')]==='undefined'&&typeof _0x5ab8a5[_0x0bd1('0x1f')]===_0x0bd1('0x20');var _0x2f2969=_0x180809[_0x0bd1('0x21')];var _0x4790eb=_0x88e088?0x0:_0x5ab8a5[_0x0bd1('0x1e')];var _0x3d1170=_0x88e088?_0x180809['count']:_0x5ab8a5[_0x0bd1('0x1e')]+_0x5ab8a5[_0x0bd1('0x1f')];var _0x59d106;if(_0x3d1170>=_0x2f2969){_0x3d1170=_0x2f2969;_0x59d106=0xc8;}else{_0x59d106=0xce;}_0x56055b['status'](_0x59d106);return _0x56055b[_0x0bd1('0x22')](_0x0bd1('0x23'),_0x4790eb+'-'+_0x3d1170+'/'+_0x2f2969)[_0x0bd1('0x1d')](_0x180809);}return null;};}function patchUpdates(_0x6959b7){return function(_0x1f8536){try{jsonpatch[_0x0bd1('0x24')](_0x1f8536,_0x6959b7,!![]);}catch(_0xc5ece1){return BPromise[_0x0bd1('0x25')](_0xc5ece1);}return _0x1f8536['save']();};}function saveUpdates(_0x2d5861,_0x44095f){return function(_0x31eaf5){if(_0x31eaf5){return _0x31eaf5[_0x0bd1('0x26')](_0x2d5861)[_0x0bd1('0x27')](function(_0x569b09){return _0x569b09;});}return null;};}function removeEntity(_0x35a8ca,_0x4d6828){return function(_0x5f0742){if(_0x5f0742){return _0x5f0742[_0x0bd1('0x28')]()[_0x0bd1('0x27')](function(){_0x35a8ca[_0x0bd1('0x1b')](0xcc)[_0x0bd1('0x1c')]();});}};}function handleEntityNotFound(_0x237f4a,_0x16eb7b){return function(_0x3e0c07){if(!_0x3e0c07){_0x237f4a[_0x0bd1('0x1a')](0x194);}return _0x3e0c07;};}function handleError(_0x2cacfc,_0x58a565){_0x58a565=_0x58a565||0x1f4;return function(_0x5cb236){logger[_0x0bd1('0x29')](_0x5cb236['stack']);if(_0x5cb236[_0x0bd1('0x2a')]){delete _0x5cb236[_0x0bd1('0x2a')];}_0x2cacfc['status'](_0x58a565)['send'](_0x5cb236);};}exports['index']=function(_0x4b64cb,_0x551fcd){var _0x4616b9={},_0x2ac8bb={},_0x38e655={'count':0x0,'rows':[]};var _0x5b07cd=_[_0x0bd1('0x2b')](db[_0x0bd1('0x2c')]['rawAttributes'],function(_0x49debf){return{'name':_0x49debf[_0x0bd1('0x2d')],'type':_0x49debf['type']['key']};});_0x2ac8bb['model']=_[_0x0bd1('0x2b')](_0x5b07cd,_0x0bd1('0x2a'));_0x2ac8bb[_0x0bd1('0x2e')]=_['keys'](_0x4b64cb[_0x0bd1('0x2e')]);_0x2ac8bb[_0x0bd1('0x2f')]=_['intersection'](_0x2ac8bb['model'],_0x2ac8bb[_0x0bd1('0x2e')]);_0x4616b9['attributes']=_[_0x0bd1('0x30')](_0x2ac8bb[_0x0bd1('0x31')],qs['fields'](_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x32')]));_0x4616b9[_0x0bd1('0x33')]=_0x4616b9['attributes'][_0x0bd1('0x34')]?_0x4616b9['attributes']:_0x2ac8bb[_0x0bd1('0x31')];if(!_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x35')](_0x0bd1('0x36'))){_0x4616b9['limit']=qs[_0x0bd1('0x1f')](_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x1f')]);_0x4616b9[_0x0bd1('0x1e')]=qs[_0x0bd1('0x1e')](_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x1e')]);}_0x4616b9['order']=qs[_0x0bd1('0x37')](_0x4b64cb[_0x0bd1('0x2e')]['sort']);_0x4616b9[_0x0bd1('0x38')]=qs[_0x0bd1('0x2f')](_[_0x0bd1('0x39')](_0x4b64cb[_0x0bd1('0x2e')],_0x2ac8bb[_0x0bd1('0x2f')]),_0x5b07cd);if(_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x3a')]){_0x4616b9[_0x0bd1('0x38')]=_[_0x0bd1('0x3b')](_0x4616b9[_0x0bd1('0x38')],{'$or':_[_0x0bd1('0x2b')](_0x5b07cd,function(_0x3715f6){if(_0x3715f6[_0x0bd1('0x3c')]!==_0x0bd1('0x3d')){var _0x28b835={};_0x28b835[_0x3715f6[_0x0bd1('0x2a')]]={'$like':'%'+_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x3a')]+'%'};return _0x28b835;}})});}_0x4616b9=_['merge']({},_0x4616b9,_0x4b64cb['options']);var _0x2fe9da={'where':_0x4616b9[_0x0bd1('0x38')]};return db[_0x0bd1('0x2c')][_0x0bd1('0x21')](_0x2fe9da)[_0x0bd1('0x27')](function(_0x5fcd17){_0x38e655['count']=_0x5fcd17;if(_0x4b64cb['query'][_0x0bd1('0x3e')]){_0x4616b9[_0x0bd1('0x3f')]=[{'all':!![]}];}return db[_0x0bd1('0x2c')][_0x0bd1('0x40')](_0x4616b9);})['then'](function(_0x12c010){_0x38e655['rows']=_0x12c010;return _0x38e655;})[_0x0bd1('0x27')](respondWithFilteredResult(_0x551fcd,_0x4616b9))['catch'](handleError(_0x551fcd,null));};exports[_0x0bd1('0x41')]=function(_0x3b7677,_0x32cff5){var _0xd4217c={'raw':!![],'where':{'id':_0x3b7677[_0x0bd1('0x42')]['id']}},_0x5894f4={};_0x5894f4[_0x0bd1('0x31')]=_[_0x0bd1('0x43')](db['JscriptyAnswerReport'][_0x0bd1('0x44')]);_0x5894f4[_0x0bd1('0x2e')]=_[_0x0bd1('0x43')](_0x3b7677[_0x0bd1('0x2e')]);_0x5894f4[_0x0bd1('0x2f')]=_[_0x0bd1('0x30')](_0x5894f4[_0x0bd1('0x31')],_0x5894f4[_0x0bd1('0x2e')]);_0xd4217c[_0x0bd1('0x33')]=_[_0x0bd1('0x30')](_0x5894f4[_0x0bd1('0x31')],qs['fields'](_0x3b7677['query'][_0x0bd1('0x32')]));_0xd4217c['attributes']=_0xd4217c[_0x0bd1('0x33')]['length']?_0xd4217c[_0x0bd1('0x33')]:_0x5894f4[_0x0bd1('0x31')];if(_0x3b7677[_0x0bd1('0x2e')][_0x0bd1('0x3e')]){_0xd4217c[_0x0bd1('0x3f')]=[{'all':!![]}];}_0xd4217c=_[_0x0bd1('0x3b')]({},_0xd4217c,_0x3b7677[_0x0bd1('0x45')]);return db[_0x0bd1('0x2c')][_0x0bd1('0x46')](_0xd4217c)[_0x0bd1('0x27')](handleEntityNotFound(_0x32cff5,null))['then'](respondWithResult(_0x32cff5,null))[_0x0bd1('0x47')](handleError(_0x32cff5,null));};exports[_0x0bd1('0x48')]=function(_0x34a20d,_0x1ef213){return db['JscriptyAnswerReport']['create'](_0x34a20d[_0x0bd1('0x49')],{})[_0x0bd1('0x27')](respondWithResult(_0x1ef213,0xc9))[_0x0bd1('0x47')](handleError(_0x1ef213,null));};exports['update']=function(_0x3cc311,_0x2cf6cb){if(_0x3cc311[_0x0bd1('0x49')]['id']){delete _0x3cc311[_0x0bd1('0x49')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3cc311[_0x0bd1('0x42')]['id']}})['then'](handleEntityNotFound(_0x2cf6cb,null))[_0x0bd1('0x27')](saveUpdates(_0x3cc311['body'],null))[_0x0bd1('0x27')](respondWithResult(_0x2cf6cb,null))['catch'](handleError(_0x2cf6cb,null));};exports[_0x0bd1('0x28')]=function(_0x43ecb5,_0x53b563){return db['JscriptyAnswerReport'][_0x0bd1('0x46')]({'where':{'id':_0x43ecb5[_0x0bd1('0x42')]['id']}})['then'](handleEntityNotFound(_0x53b563,null))['then'](removeEntity(_0x53b563,null))[_0x0bd1('0x47')](handleError(_0x53b563,null));};exports[_0x0bd1('0x4a')]=function(_0x1adf77,_0x4ca2e8){return db['JscriptyAnswerReport'][_0x0bd1('0x4a')]()[_0x0bd1('0x27')](respondWithResult(_0x4ca2e8,null))[_0x0bd1('0x47')](handleError(_0x4ca2e8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1fab69b..e7d3420 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 _0x2b99=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x3e74c9,_0x2e5975){var _0x500782=function(_0x27fb4d){while(--_0x27fb4d){_0x3e74c9['push'](_0x3e74c9['shift']());}};_0x500782(++_0x2e5975);}(_0x2b99,0x13b));var _0x92b9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2b99[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var logger=require(_0x92b9('0x2'))(_0x92b9('0x3'));var moment=require(_0x92b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x92b9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92b9('0x6'));var config=require(_0x92b9('0x7'));var attributes=require(_0x92b9('0x8'));module[_0x92b9('0x9')]=function(_0x377ee1,_0x19d0ee){return _0x377ee1[_0x92b9('0xa')](_0x92b9('0xb'),attributes,{'tableName':_0x92b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61de=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','bluebird','path'];(function(_0x17a1e4,_0x2672fa){var _0x172b8a=function(_0x1add7a){while(--_0x1add7a){_0x17a1e4['push'](_0x17a1e4['shift']());}};_0x172b8a(++_0x2672fa);}(_0x61de,0x14b));var _0xe61d=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x61de[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xe61d('0x0'));var util=require(_0xe61d('0x1'));var logger=require(_0xe61d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe61d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe61d('0x4'));var rimraf=require(_0xe61d('0x5'));var config=require(_0xe61d('0x6'));var attributes=require(_0xe61d('0x7'));module[_0xe61d('0x8')]=function(_0x4c254f,_0xf8a84f){return _0x4c254f[_0xe61d('0x9')](_0xe61d('0xa'),attributes,{'tableName':_0xe61d('0xb'),'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 5d290bd..bd67169 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 _0x6693=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0x6693,0x142));var _0x3669=function(_0x5e782b,_0x14fc3c){_0x5e782b=_0x5e782b-0x0;var _0xf0b880=_0x6693[_0x5e782b];return _0xf0b880;};'use strict';var _=require(_0x3669('0x0'));var util=require('util');var moment=require(_0x3669('0x1'));var BPromise=require('bluebird');var rs=require(_0x3669('0x2'));var fs=require('fs');var Redis=require(_0x3669('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3669('0x4'));var logger=require(_0x3669('0x5'))(_0x3669('0x6'));var config=require(_0x3669('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3669('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40191f,_0x27d9df,_0x5c990f){return new BPromise(function(_0x390ce8,_0x18f2a9){return client['request'](_0x40191f,_0x5c990f)[_0x3669('0x9')](function(_0x5308c3){logger[_0x3669('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27d9df,_0x3669('0xb'));logger[_0x3669('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x27d9df,_0x3669('0xb'),JSON[_0x3669('0xd')](_0x5308c3));if(_0x5308c3[_0x3669('0xe')]){if(_0x5308c3[_0x3669('0xe')]['code']===0x1f4){logger['error'](_0x3669('0xf'),_0x27d9df,_0x5308c3[_0x3669('0xe')][_0x3669('0x10')]);return _0x18f2a9(_0x5308c3[_0x3669('0xe')][_0x3669('0x10')]);}logger[_0x3669('0xe')](_0x3669('0xf'),_0x27d9df,_0x5308c3[_0x3669('0xe')][_0x3669('0x10')]);return _0x390ce8(_0x5308c3[_0x3669('0xe')][_0x3669('0x10')]);}else{logger[_0x3669('0xa')](_0x3669('0xf'),_0x27d9df,_0x3669('0xb'));_0x390ce8(_0x5308c3[_0x3669('0x11')][_0x3669('0x10')]);}})[_0x3669('0x12')](function(_0x4eb00f){logger[_0x3669('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27d9df,_0x4eb00f);_0x18f2a9(_0x4eb00f);});});} \ No newline at end of file +var _0xe8d2=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','debug'];(function(_0x586e19,_0x2ff252){var _0x268623=function(_0x5a1c9e){while(--_0x5a1c9e){_0x586e19['push'](_0x586e19['shift']());}};_0x268623(++_0x2ff252);}(_0xe8d2,0x14a));var _0x2e8d=function(_0x435a6d,_0x13843e){_0x435a6d=_0x435a6d-0x0;var _0x1b4cc4=_0xe8d2[_0x435a6d];return _0x1b4cc4;};'use strict';var _=require(_0x2e8d('0x0'));var util=require(_0x2e8d('0x1'));var moment=require(_0x2e8d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e8d('0x3'));var fs=require('fs');var Redis=require(_0x2e8d('0x4'));var db=require(_0x2e8d('0x5'))['db'];var utils=require(_0x2e8d('0x6'));var logger=require(_0x2e8d('0x7'))('rpc');var config=require(_0x2e8d('0x8'));var jayson=require(_0x2e8d('0x9'));var client=jayson[_0x2e8d('0xa')][_0x2e8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dbdd0,_0x4ed767,_0x1d2e40){return new BPromise(function(_0xa96999,_0x3944bb){return client[_0x2e8d('0xc')](_0x2dbdd0,_0x1d2e40)['then'](function(_0x31ef01){logger['info'](_0x2e8d('0xd'),_0x4ed767,'request\x20sent');logger[_0x2e8d('0xe')](_0x2e8d('0xf'),_0x4ed767,_0x2e8d('0x10'),JSON[_0x2e8d('0x11')](_0x31ef01));if(_0x31ef01['error']){if(_0x31ef01[_0x2e8d('0x12')]['code']===0x1f4){logger['error'](_0x2e8d('0xd'),_0x4ed767,_0x31ef01[_0x2e8d('0x12')][_0x2e8d('0x13')]);return _0x3944bb(_0x31ef01[_0x2e8d('0x12')][_0x2e8d('0x13')]);}logger['error'](_0x2e8d('0xd'),_0x4ed767,_0x31ef01['error']['message']);return _0xa96999(_0x31ef01[_0x2e8d('0x12')][_0x2e8d('0x13')]);}else{logger[_0x2e8d('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4ed767,_0x2e8d('0x10'));_0xa96999(_0x31ef01[_0x2e8d('0x15')][_0x2e8d('0x13')]);}})[_0x2e8d('0x16')](function(_0x2f29e3){logger[_0x2e8d('0x12')](_0x2e8d('0xd'),_0x4ed767,_0x2f29e3);_0x3944bb(_0x2f29e3);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1213cfe..ca37250 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 _0x552b=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','getSessions','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','put','/:id','update'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x552b,0x1c5));var _0xb552=function(_0x32d922,_0x1e6072){_0x32d922=_0x32d922-0x0;var _0x3745aa=_0x552b[_0x32d922];return _0x3745aa;};'use strict';var multer=require(_0xb552('0x0'));var util=require('util');var path=require(_0xb552('0x1'));var timeout=require(_0xb552('0x2'));var express=require(_0xb552('0x3'));var router=express[_0xb552('0x4')]();var fs_extra=require(_0xb552('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb552('0x6'));var config=require(_0xb552('0x7'));var controller=require(_0xb552('0x8'));router[_0xb552('0x9')]('/',auth[_0xb552('0xa')](),controller['index']);router[_0xb552('0x9')]('/:id',auth[_0xb552('0xa')](),controller[_0xb552('0xb')]);router[_0xb552('0x9')]('/:id/sessions',auth[_0xb552('0xa')](),controller[_0xb552('0xc')]);router[_0xb552('0x9')]('/:id/answers',auth[_0xb552('0xa')](),controller[_0xb552('0xd')]);router['get'](_0xb552('0xe'),auth['isAuthenticated'](),timeout('30s'),controller[_0xb552('0xf')]);router[_0xb552('0x10')]('/',auth[_0xb552('0xa')](),controller[_0xb552('0x11')]);router['post'](_0xb552('0x12'),auth[_0xb552('0xa')](),controller['clone']);router[_0xb552('0x13')](_0xb552('0x14'),auth['isAuthenticated'](),controller[_0xb552('0x15')]);router[_0xb552('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb552('0x17')]);module[_0xb552('0x18')]=router; \ No newline at end of file +var _0x0ef2=['../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','create','post','/:id/clone','clone','put','update','delete','destroy','multer','path','fs-extra','../../components/auth/service'];(function(_0x43d75c,_0x1722b3){var _0x3adb93=function(_0x8ca594){while(--_0x8ca594){_0x43d75c['push'](_0x43d75c['shift']());}};_0x3adb93(++_0x1722b3);}(_0x0ef2,0x1ac));var _0x20ef=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x0ef2[_0x4e1a49];return _0x136aae;};'use strict';var multer=require(_0x20ef('0x0'));var util=require('util');var path=require(_0x20ef('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x20ef('0x2'));var auth=require(_0x20ef('0x3'));var interaction=require(_0x20ef('0x4'));var config=require('../../config/environment');var controller=require(_0x20ef('0x5'));router[_0x20ef('0x6')]('/',auth[_0x20ef('0x7')](),controller[_0x20ef('0x8')]);router[_0x20ef('0x6')](_0x20ef('0x9'),auth['isAuthenticated'](),controller[_0x20ef('0xa')]);router[_0x20ef('0x6')](_0x20ef('0xb'),auth[_0x20ef('0x7')](),controller[_0x20ef('0xc')]);router[_0x20ef('0x6')](_0x20ef('0xd'),auth[_0x20ef('0x7')](),controller[_0x20ef('0xe')]);router[_0x20ef('0x6')](_0x20ef('0xf'),auth[_0x20ef('0x7')](),timeout('30s'),controller['getSummary']);router['post']('/',auth[_0x20ef('0x7')](),controller[_0x20ef('0x10')]);router[_0x20ef('0x11')](_0x20ef('0x12'),auth[_0x20ef('0x7')](),controller[_0x20ef('0x13')]);router[_0x20ef('0x14')]('/:id',auth[_0x20ef('0x7')](),controller[_0x20ef('0x15')]);router[_0x20ef('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x20ef('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 058a9a6..8a8244d 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 _0xce92=['exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x5b2c7e,_0x3d22f0){var _0x5ec399=function(_0x1a87ad){while(--_0x1a87ad){_0x5b2c7e['push'](_0x5b2c7e['shift']());}};_0x5ec399(++_0x3d22f0);}(_0xce92,0xdb));var _0x2ce9=function(_0xf915a7,_0x3c5104){_0xf915a7=_0xf915a7-0x0;var _0x714195=_0xce92[_0xf915a7];return _0x714195;};'use strict';var Sequelize=require(_0x2ce9('0x0'));var _=require(_0x2ce9('0x1'));var util=require('util');module[_0x2ce9('0x2')]={'name':{'type':Sequelize[_0x2ce9('0x3')],'unique':_0x2ce9('0x4')},'description':{'type':Sequelize[_0x2ce9('0x3')]},'formData':{'type':Sequelize[_0x2ce9('0x5')](_0x2ce9('0x6')),'set':function(_0x38e50c){if(_[_0x2ce9('0x7')](_0x38e50c)){this[_0x2ce9('0x8')](_0x2ce9('0x9'),JSON[_0x2ce9('0xa')](_0x38e50c));}else if(_[_0x2ce9('0xb')](_0x38e50c)){this[_0x2ce9('0x8')](_0x2ce9('0x9'),_0x38e50c);}else{this['setDataValue'](_0x2ce9('0x9'),util[_0x2ce9('0xc')](_0x2ce9('0xd'),this[_0x2ce9('0xe')](_0x2ce9('0x4'))||'',this[_0x2ce9('0xe')](_0x2ce9('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2ce9('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x1752=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x1de817,_0xdc6de3){var _0x7814b3=function(_0x1ecc00){while(--_0x1ecc00){_0x1de817['push'](_0x1de817['shift']());}};_0x7814b3(++_0xdc6de3);}(_0x1752,0x19a));var _0x2175=function(_0x46b630,_0x3da461){_0x46b630=_0x46b630-0x0;var _0x545d96=_0x1752[_0x46b630];return _0x545d96;};'use strict';var Sequelize=require(_0x2175('0x0'));var _=require(_0x2175('0x1'));var util=require(_0x2175('0x2'));module[_0x2175('0x3')]={'name':{'type':Sequelize[_0x2175('0x4')],'unique':_0x2175('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2175('0x6')]('long'),'set':function(_0x19ba7a){if(_[_0x2175('0x7')](_0x19ba7a)){this[_0x2175('0x8')](_0x2175('0x9'),JSON[_0x2175('0xa')](_0x19ba7a));}else if(_[_0x2175('0xb')](_0x19ba7a)){this[_0x2175('0x8')](_0x2175('0x9'),_0x19ba7a);}else{this['setDataValue'](_0x2175('0x9'),util[_0x2175('0xc')](_0x2175('0xd'),this[_0x2175('0xe')](_0x2175('0x5'))||'',this['getDataValue'](_0x2175('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2175('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2175('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0de1451..5b0bdb4 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 _0xaadd=['includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','JscriptySessionReport','order','pick','ProjectId','JscriptyAnswerReport','rows','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','Projects','UserProfileResource','destroy','error','name','send','map','JscriptyProject','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','catch','params'];(function(_0x2c099a,_0x5e7131){var _0x218a50=function(_0x40d873){while(--_0x40d873){_0x2c099a['push'](_0x2c099a['shift']());}};_0x218a50(++_0x5e7131);}(_0xaadd,0x19b));var _0xdaad=function(_0x272e19,_0x1fbcc2){_0x272e19=_0x272e19-0x0;var _0x835bfb=_0xaadd[_0x272e19];return _0x835bfb;};'use strict';var emlformat=require(_0xdaad('0x0'));var rimraf=require(_0xdaad('0x1'));var zipdir=require(_0xdaad('0x2'));var jsonpatch=require(_0xdaad('0x3'));var rp=require(_0xdaad('0x4'));var moment=require(_0xdaad('0x5'));var BPromise=require(_0xdaad('0x6'));var Mustache=require(_0xdaad('0x7'));var util=require('util');var path=require(_0xdaad('0x8'));var sox=require(_0xdaad('0x9'));var csv=require(_0xdaad('0xa'));var ejs=require(_0xdaad('0xb'));var fs=require('fs');var fs_extra=require(_0xdaad('0xc'));var _=require('lodash');var squel=require(_0xdaad('0xd'));var crypto=require(_0xdaad('0xe'));var jsforce=require(_0xdaad('0xf'));var deskjs=require(_0xdaad('0x10'));var toCsv=require(_0xdaad('0xa'));var querystring=require(_0xdaad('0x11'));var Papa=require(_0xdaad('0x12'));var Redis=require(_0xdaad('0x13'));var authService=require(_0xdaad('0x14'));var qs=require(_0xdaad('0x15'));var as=require(_0xdaad('0x16'));var hardwareService=require(_0xdaad('0x17'));var logger=require('../../config/logger')(_0xdaad('0x18'));var utils=require('../../config/utils');var config=require(_0xdaad('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaad('0x1a'))['db'];function respondWithStatusCode(_0x5f313e,_0x28d373){_0x28d373=_0x28d373||0xcc;return function(_0x4c1eaa){if(_0x4c1eaa){return _0x5f313e[_0xdaad('0x1b')](_0x28d373);}return _0x5f313e[_0xdaad('0x1c')](_0x28d373)[_0xdaad('0x1d')]();};}function respondWithResult(_0x2942cf,_0x173af0){_0x173af0=_0x173af0||0xc8;return function(_0x3b968e){if(_0x3b968e){return _0x2942cf[_0xdaad('0x1c')](_0x173af0)[_0xdaad('0x1e')](_0x3b968e);}};}function respondWithFilteredResult(_0x10ca7b,_0x565db8){return function(_0x4b527f){if(_0x4b527f){var _0x3ea4dc=typeof _0x565db8[_0xdaad('0x1f')]===_0xdaad('0x20')&&typeof _0x565db8[_0xdaad('0x21')]===_0xdaad('0x20');var _0x2c95bf=_0x4b527f[_0xdaad('0x22')];var _0x5ba570=_0x3ea4dc?0x0:_0x565db8[_0xdaad('0x1f')];var _0x28e5d4=_0x3ea4dc?_0x4b527f[_0xdaad('0x22')]:_0x565db8[_0xdaad('0x1f')]+_0x565db8[_0xdaad('0x21')];var _0x157fda;if(_0x28e5d4>=_0x2c95bf){_0x28e5d4=_0x2c95bf;_0x157fda=0xc8;}else{_0x157fda=0xce;}_0x10ca7b[_0xdaad('0x1c')](_0x157fda);return _0x10ca7b['set'](_0xdaad('0x23'),_0x5ba570+'-'+_0x28e5d4+'/'+_0x2c95bf)['json'](_0x4b527f);}return null;};}function patchUpdates(_0x1d68cd){return function(_0x27edff){try{jsonpatch[_0xdaad('0x24')](_0x27edff,_0x1d68cd,!![]);}catch(_0x252bf2){return BPromise['reject'](_0x252bf2);}return _0x27edff[_0xdaad('0x25')]();};}function saveUpdates(_0x47778,_0x445c78){return function(_0x1775e6){if(_0x1775e6){return _0x1775e6[_0xdaad('0x26')](_0x47778)[_0xdaad('0x27')](function(_0x189f1d){return _0x189f1d;});}return null;};}function removeEntity(_0x548302,_0x214045){return function(_0x5dbcfb){if(_0x5dbcfb){return _0x5dbcfb['destroy']()[_0xdaad('0x27')](function(){var _0x36ed69=_0x5dbcfb[_0xdaad('0x28')]({'plain':!![]});var _0x4e021b=_0xdaad('0x29');return db[_0xdaad('0x2a')][_0xdaad('0x2b')]({'where':{'type':_0x4e021b,'resourceId':_0x36ed69['id']}})[_0xdaad('0x27')](function(){return _0x5dbcfb;});})[_0xdaad('0x27')](function(){_0x548302[_0xdaad('0x1c')](0xcc)[_0xdaad('0x1d')]();});}};}function handleEntityNotFound(_0x8b8d82,_0x3f24b3){return function(_0xc45141){if(!_0xc45141){_0x8b8d82['sendStatus'](0x194);}return _0xc45141;};}function handleError(_0x5e07b2,_0x3d1fea){_0x3d1fea=_0x3d1fea||0x1f4;return function(_0x13ae73){logger[_0xdaad('0x2c')](_0x13ae73['stack']);if(_0x13ae73['name']){delete _0x13ae73[_0xdaad('0x2d')];}_0x5e07b2['status'](_0x3d1fea)[_0xdaad('0x2e')](_0x13ae73);};}exports['index']=function(_0x344518,_0x137b9b){var _0x2919b6={},_0x5cb67f={},_0x105852={'count':0x0,'rows':[]};var _0x1fff88=_[_0xdaad('0x2f')](db[_0xdaad('0x30')][_0xdaad('0x31')],function(_0x132c87){return{'name':_0x132c87[_0xdaad('0x32')],'type':_0x132c87['type'][_0xdaad('0x33')]};});_0x5cb67f[_0xdaad('0x34')]=_[_0xdaad('0x2f')](_0x1fff88,_0xdaad('0x2d'));_0x5cb67f['query']=_[_0xdaad('0x35')](_0x344518[_0xdaad('0x36')]);_0x5cb67f[_0xdaad('0x37')]=_['intersection'](_0x5cb67f[_0xdaad('0x34')],_0x5cb67f[_0xdaad('0x36')]);_0x2919b6['attributes']=_[_0xdaad('0x38')](_0x5cb67f[_0xdaad('0x34')],qs[_0xdaad('0x39')](_0x344518[_0xdaad('0x36')]['fields']));_0x2919b6[_0xdaad('0x3a')]=_0x2919b6[_0xdaad('0x3a')][_0xdaad('0x3b')]?_0x2919b6[_0xdaad('0x3a')]:_0x5cb67f[_0xdaad('0x34')];if(!_0x344518[_0xdaad('0x36')][_0xdaad('0x3c')](_0xdaad('0x3d'))){_0x2919b6[_0xdaad('0x21')]=qs[_0xdaad('0x21')](_0x344518['query'][_0xdaad('0x21')]);_0x2919b6[_0xdaad('0x1f')]=qs[_0xdaad('0x1f')](_0x344518[_0xdaad('0x36')][_0xdaad('0x1f')]);}_0x2919b6['order']=qs[_0xdaad('0x3e')](_0x344518[_0xdaad('0x36')][_0xdaad('0x3e')]);_0x2919b6[_0xdaad('0x3f')]=qs[_0xdaad('0x37')](_['pick'](_0x344518[_0xdaad('0x36')],_0x5cb67f[_0xdaad('0x37')]),_0x1fff88);if(_0x344518[_0xdaad('0x36')][_0xdaad('0x40')]){_0x2919b6[_0xdaad('0x3f')]=_[_0xdaad('0x41')](_0x2919b6['where'],{'$or':_[_0xdaad('0x2f')](_0x1fff88,function(_0x411b17){if(_0x411b17[_0xdaad('0x42')]!==_0xdaad('0x43')){var _0xb2cddb={};_0xb2cddb[_0x411b17[_0xdaad('0x2d')]]={'$like':'%'+_0x344518['query']['filter']+'%'};return _0xb2cddb;}})});}_0x2919b6=_[_0xdaad('0x41')]({},_0x2919b6,_0x344518[_0xdaad('0x44')]);var _0x452fd3={'where':_0x2919b6[_0xdaad('0x3f')]};return db['JscriptyProject'][_0xdaad('0x22')](_0x452fd3)[_0xdaad('0x27')](function(_0x429f2e){_0x105852[_0xdaad('0x22')]=_0x429f2e;if(_0x344518[_0xdaad('0x36')]['includeAll']){_0x2919b6[_0xdaad('0x45')]=[{'all':!![]}];}return db[_0xdaad('0x30')][_0xdaad('0x46')](_0x2919b6);})['then'](function(_0x1b8251){_0x105852['rows']=_0x1b8251;return _0x105852;})[_0xdaad('0x27')](respondWithFilteredResult(_0x137b9b,_0x2919b6))[_0xdaad('0x47')](handleError(_0x137b9b,null));};exports['show']=function(_0x47eba8,_0x908065){var _0xaa0381={'raw':![],'where':{'id':_0x47eba8[_0xdaad('0x48')]['id']}},_0x29cdbb={};_0x29cdbb['model']=_[_0xdaad('0x35')](db['JscriptyProject'][_0xdaad('0x31')]);_0x29cdbb[_0xdaad('0x36')]=_[_0xdaad('0x35')](_0x47eba8[_0xdaad('0x36')]);_0x29cdbb['filters']=_['intersection'](_0x29cdbb[_0xdaad('0x34')],_0x29cdbb['query']);_0xaa0381[_0xdaad('0x3a')]=_['intersection'](_0x29cdbb[_0xdaad('0x34')],qs['fields'](_0x47eba8[_0xdaad('0x36')]['fields']));_0xaa0381['attributes']=_0xaa0381[_0xdaad('0x3a')]['length']?_0xaa0381[_0xdaad('0x3a')]:_0x29cdbb['model'];if(_0x47eba8['query'][_0xdaad('0x49')]){_0xaa0381['include']=[{'all':!![]}];}_0xaa0381=_[_0xdaad('0x41')]({},_0xaa0381,_0x47eba8[_0xdaad('0x44')]);return db[_0xdaad('0x30')][_0xdaad('0x4a')](_0xaa0381)['then'](handleEntityNotFound(_0x908065,null))[_0xdaad('0x27')](respondWithResult(_0x908065,null))['catch'](handleError(_0x908065,null));};exports['create']=function(_0x459df0,_0x5571aa){return db[_0xdaad('0x30')][_0xdaad('0x4b')](_0x459df0[_0xdaad('0x4c')],{})[_0xdaad('0x27')](function(_0x13be92){var _0x33bbb7=_0x459df0['user'][_0xdaad('0x28')]({'plain':!![]});if(!_0x33bbb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33bbb7[_0xdaad('0x4d')]===_0xdaad('0x4e')){var _0x32a215=_0x13be92[_0xdaad('0x28')]({'plain':!![]});var _0x24339a=_0xdaad('0x29');return db[_0xdaad('0x4f')][_0xdaad('0x4a')]({'where':{'name':_0x24339a,'userProfileId':_0x33bbb7[_0xdaad('0x50')]},'raw':!![]})[_0xdaad('0x27')](function(_0xee1d17){if(_0xee1d17&&_0xee1d17[_0xdaad('0x51')]===0x0){return db[_0xdaad('0x2a')][_0xdaad('0x4b')]({'name':_0x32a215[_0xdaad('0x2d')],'resourceId':_0x32a215['id'],'type':_0xee1d17['name'],'sectionId':_0xee1d17['id']},{})['then'](function(){return _0x13be92;});}else{return _0x13be92;}})[_0xdaad('0x47')](function(_0xa69ea2){logger[_0xdaad('0x2c')](_0xdaad('0x52'),_0xa69ea2);throw _0xa69ea2;});}return _0x13be92;})[_0xdaad('0x27')](respondWithResult(_0x5571aa,0xc9))[_0xdaad('0x47')](handleError(_0x5571aa,null));};exports[_0xdaad('0x53')]=function(_0x410879,_0x48d280){var _0x1a890d={'where':{'id':_0x410879['params']['id']}},_0xa64518={};_0xa64518[_0xdaad('0x34')]=_[_0xdaad('0x35')](db[_0xdaad('0x30')][_0xdaad('0x31')]);_0x1a890d['attributes']=_[_0xdaad('0x38')](_0xa64518[_0xdaad('0x34')],qs[_0xdaad('0x39')](_0x410879[_0xdaad('0x36')]['fields']));_0x1a890d[_0xdaad('0x3a')]=_0x1a890d[_0xdaad('0x3a')]['length']?_0x1a890d[_0xdaad('0x3a')]:_0xa64518[_0xdaad('0x34')];if(_0x410879[_0xdaad('0x36')]['includeAll']){_0x1a890d['include']=[{'all':!![]}];}_0x1a890d=_['merge']({},_0x1a890d,_0x410879['options']);return db[_0xdaad('0x30')][_0xdaad('0x4a')](_0x1a890d)[_0xdaad('0x27')](handleEntityNotFound(_0x48d280,null))['then'](function(_0x2e26dd){if(_0x2e26dd){var _0xa3937e=_0x2e26dd[_0xdaad('0x28')]({'plain':!![]});_0xa3937e=qs[_0xdaad('0x54')](_0xa3937e,['id',_0xdaad('0x55'),_0xdaad('0x56')]);_0x410879[_0xdaad('0x4c')]=_[_0xdaad('0x54')](_0x410879[_0xdaad('0x4c')],['id','createdAt',_0xdaad('0x56')]);return db[_0xdaad('0x30')][_0xdaad('0x4b')](_[_0xdaad('0x41')](_0xa3937e,_0x410879[_0xdaad('0x4c')]),{'include':_0x410879[_0xdaad('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0xdaad('0x27')](function(_0x1a4d9a){var _0x1515e0=_0x410879[_0xdaad('0x4e')][_0xdaad('0x28')]({'plain':!![]});if(!_0x1515e0)throw new Error(_0xdaad('0x57'));if(_0x1515e0[_0xdaad('0x4d')]==='user'){var _0x39475e=_0x1a4d9a[_0xdaad('0x28')]({'plain':!![]});var _0x5ab455='Projects';return db[_0xdaad('0x4f')]['find']({'where':{'name':_0x5ab455,'userProfileId':_0x1515e0[_0xdaad('0x50')]},'raw':!![]})[_0xdaad('0x27')](function(_0x310669){if(_0x310669&&_0x310669[_0xdaad('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x39475e['name'],'resourceId':_0x39475e['id'],'type':_0x310669[_0xdaad('0x2d')],'sectionId':_0x310669['id']},{})[_0xdaad('0x27')](function(){return _0x1a4d9a;});}else{return _0x1a4d9a;}})[_0xdaad('0x47')](function(_0x261345){logger['error'](_0xdaad('0x52'),_0x261345);throw _0x261345;});}return _0x1a4d9a;});}})[_0xdaad('0x27')](respondWithResult(_0x48d280,0xc9))[_0xdaad('0x47')](handleError(_0x48d280,null));};exports['update']=function(_0x1ee1aa,_0x28f4f3){if(_0x1ee1aa['body']['id']){delete _0x1ee1aa[_0xdaad('0x4c')]['id'];}return db[_0xdaad('0x30')][_0xdaad('0x4a')]({'where':{'id':_0x1ee1aa[_0xdaad('0x48')]['id']}})[_0xdaad('0x27')](handleEntityNotFound(_0x28f4f3,null))['then'](saveUpdates(_0x1ee1aa[_0xdaad('0x4c')],null))['then'](respondWithResult(_0x28f4f3,null))[_0xdaad('0x47')](handleError(_0x28f4f3,null));};exports[_0xdaad('0x2b')]=function(_0x536024,_0x1cd3c4){return db[_0xdaad('0x30')][_0xdaad('0x4a')]({'where':{'id':_0x536024['params']['id']}})[_0xdaad('0x27')](handleEntityNotFound(_0x1cd3c4,null))[_0xdaad('0x27')](removeEntity(_0x1cd3c4,null))[_0xdaad('0x47')](handleError(_0x1cd3c4,null));};exports['getSessions']=function(_0x419336,_0x5d2d8e,_0x34fbb2){var _0x3db360={'raw':!![],'where':{}};var _0x49d673={};var _0x251ff2={'count':0x0,'rows':[]};return db[_0xdaad('0x30')][_0xdaad('0x58')]({'where':{'id':_0x419336['params']['id']}})[_0xdaad('0x27')](handleEntityNotFound(_0x5d2d8e,null))[_0xdaad('0x27')](function(_0x56a4b2){if(_0x56a4b2){_0x49d673[_0xdaad('0x34')]=_[_0xdaad('0x35')](db[_0xdaad('0x59')][_0xdaad('0x31')]);_0x49d673['query']=_['keys'](_0x419336[_0xdaad('0x36')]);_0x49d673['filters']=_[_0xdaad('0x38')](_0x49d673[_0xdaad('0x34')],_0x49d673[_0xdaad('0x36')]);_0x3db360[_0xdaad('0x3a')]=_[_0xdaad('0x38')](_0x49d673['model'],qs[_0xdaad('0x39')](_0x419336[_0xdaad('0x36')]['fields']));_0x3db360[_0xdaad('0x3a')]=_0x3db360[_0xdaad('0x3a')][_0xdaad('0x3b')]?_0x3db360['attributes']:_0x49d673[_0xdaad('0x34')];if(!_0x419336['query']['hasOwnProperty'](_0xdaad('0x3d'))){_0x3db360[_0xdaad('0x21')]=qs['limit'](_0x419336['query'][_0xdaad('0x21')]);_0x3db360['offset']=qs[_0xdaad('0x1f')](_0x419336[_0xdaad('0x36')]['offset']);}_0x3db360[_0xdaad('0x5a')]=qs[_0xdaad('0x3e')](_0x419336[_0xdaad('0x36')][_0xdaad('0x3e')]);_0x3db360[_0xdaad('0x3f')]=qs[_0xdaad('0x37')](_[_0xdaad('0x5b')](_0x419336[_0xdaad('0x36')],_0x49d673['filters']));_0x3db360[_0xdaad('0x3f')][_0xdaad('0x5c')]=_0x56a4b2['id'];if(_0x419336[_0xdaad('0x36')][_0xdaad('0x40')]){_0x3db360[_0xdaad('0x3f')]=_[_0xdaad('0x41')](_0x3db360['where'],{'$or':_[_0xdaad('0x2f')](_0x3db360[_0xdaad('0x3a')],function(_0x3319f8){var _0x19281a={};_0x19281a[_0x3319f8]={'$like':'%'+_0x419336['query'][_0xdaad('0x40')]+'%'};return _0x19281a;})});}_0x3db360=_['merge']({},_0x3db360,_0x419336[_0xdaad('0x44')]);return db[_0xdaad('0x59')][_0xdaad('0x22')]({'where':_0x3db360[_0xdaad('0x3f')]})[_0xdaad('0x27')](function(_0x26400c){_0x251ff2[_0xdaad('0x22')]=_0x26400c;if(_0x419336[_0xdaad('0x36')][_0xdaad('0x49')]){_0x3db360[_0xdaad('0x45')]=[{'all':!![]}];}return db[_0xdaad('0x59')][_0xdaad('0x46')](_0x3db360);})[_0xdaad('0x27')](function(_0x569d61){_0x251ff2['rows']=_0x569d61;return _0x251ff2;});}})['then'](respondWithFilteredResult(_0x5d2d8e,_0x3db360))[_0xdaad('0x47')](handleError(_0x5d2d8e,null));};exports['getAnswers']=function(_0x2063b6,_0x590fee,_0x4ead0e){var _0x41e80a={'raw':!![],'where':{}};var _0x2bb497={};var _0x472f1f={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdaad('0x58')]({'where':{'id':_0x2063b6[_0xdaad('0x48')]['id']}})[_0xdaad('0x27')](handleEntityNotFound(_0x590fee,null))[_0xdaad('0x27')](function(_0x2a5964){if(_0x2a5964){_0x2bb497['model']=_[_0xdaad('0x35')](db[_0xdaad('0x5d')][_0xdaad('0x31')]);_0x2bb497[_0xdaad('0x36')]=_[_0xdaad('0x35')](_0x2063b6[_0xdaad('0x36')]);_0x2bb497['filters']=_[_0xdaad('0x38')](_0x2bb497[_0xdaad('0x34')],_0x2bb497[_0xdaad('0x36')]);_0x41e80a['attributes']=_['intersection'](_0x2bb497[_0xdaad('0x34')],qs['fields'](_0x2063b6[_0xdaad('0x36')]['fields']));_0x41e80a[_0xdaad('0x3a')]=_0x41e80a[_0xdaad('0x3a')][_0xdaad('0x3b')]?_0x41e80a[_0xdaad('0x3a')]:_0x2bb497[_0xdaad('0x34')];if(!_0x2063b6['query'][_0xdaad('0x3c')](_0xdaad('0x3d'))){_0x41e80a[_0xdaad('0x21')]=qs[_0xdaad('0x21')](_0x2063b6[_0xdaad('0x36')][_0xdaad('0x21')]);_0x41e80a[_0xdaad('0x1f')]=qs[_0xdaad('0x1f')](_0x2063b6[_0xdaad('0x36')][_0xdaad('0x1f')]);}_0x41e80a['order']=qs[_0xdaad('0x3e')](_0x2063b6[_0xdaad('0x36')][_0xdaad('0x3e')]);_0x41e80a[_0xdaad('0x3f')]=qs['filters'](_[_0xdaad('0x5b')](_0x2063b6[_0xdaad('0x36')],_0x2bb497[_0xdaad('0x37')]));_0x41e80a[_0xdaad('0x3f')][_0xdaad('0x5c')]=_0x2a5964['id'];if(_0x2063b6[_0xdaad('0x36')][_0xdaad('0x40')]){_0x41e80a[_0xdaad('0x3f')]=_['merge'](_0x41e80a['where'],{'$or':_['map'](_0x41e80a[_0xdaad('0x3a')],function(_0x3aa04d){var _0x302627={};_0x302627[_0x3aa04d]={'$like':'%'+_0x2063b6[_0xdaad('0x36')][_0xdaad('0x40')]+'%'};return _0x302627;})});}_0x41e80a=_[_0xdaad('0x41')]({},_0x41e80a,_0x2063b6['options']);return db[_0xdaad('0x5d')][_0xdaad('0x22')]({'where':_0x41e80a['where']})[_0xdaad('0x27')](function(_0x3f54ce){_0x472f1f['count']=_0x3f54ce;if(_0x2063b6['query'][_0xdaad('0x49')]){_0x41e80a[_0xdaad('0x45')]=[{'all':!![]}];}return db[_0xdaad('0x5d')][_0xdaad('0x46')](_0x41e80a);})['then'](function(_0x585592){_0x472f1f[_0xdaad('0x5e')]=_0x585592;return _0x472f1f;});}})['then'](respondWithFilteredResult(_0x590fee,_0x41e80a))[_0xdaad('0x47')](handleError(_0x590fee,null));};function char(_0x4bd8b9){return _0xdaad('0x5f')===typeof _0x4bd8b9?String[_0xdaad('0x60')][_0xdaad('0x24')](null,arguments):_0x4bd8b9;}function needsEncapsulation(_0x486ecb){return!!_0x486ecb&&(_0x486ecb['toString']()[_0xdaad('0x61')](char(0xd))>=0x0||_0x486ecb['toString']()[_0xdaad('0x61')](char(0xa))>=0x0||_0x486ecb[_0xdaad('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x486ecb[_0xdaad('0x62')]()[_0xdaad('0x61')](char(0x22))>=0x0);}function encapsulate(_0x4c56b1){var _0x5caf5b=char(0x22),_0x2ec3e5='\x5c'+char(0x22),_0x1cc8b2=_0x4c56b1[_0xdaad('0x62')]()[_0xdaad('0x63')](new RegExp(_0x5caf5b,'g'),_0x2ec3e5);return _0x5caf5b+_0x1cc8b2+_0x5caf5b;}exports[_0xdaad('0x64')]=function(_0x4e1da3,_0x15cfc0,_0x4958c3){var _0x4ac608,_0x4adc97;var _0x3e5f71={'where':{'ProjectId':_0x4e1da3[_0xdaad('0x48')]['id']}};if(_0x4e1da3[_0xdaad('0x36')][_0xdaad('0x65')]){_0x3e5f71[_0xdaad('0x3f')]['starttime']=JSON[_0xdaad('0x66')](_0x4e1da3[_0xdaad('0x36')][_0xdaad('0x65')]);}return db[_0xdaad('0x59')][_0xdaad('0x46')](_0x3e5f71)[_0xdaad('0x27')](handleEntityNotFound(_0x15cfc0,null))[_0xdaad('0x27')](function(_0x1871e4){if(_0x1871e4){_0x4ac608=_0x1871e4;return db[_0xdaad('0x67')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x4ac608,'id')},'ProjectId':_0x4e1da3[_0xdaad('0x48')]['id']},'order':_0xdaad('0x68')});}})[_0xdaad('0x27')](handleEntityNotFound(_0x15cfc0,null))['then'](function(_0x5ddb6c){if(_0x5ddb6c){_0x4adc97=_0x5ddb6c;var _0x5a8b81={};for(var _0x3d15c8=0x0,_0xc05e00=_0x4adc97[_0xdaad('0x3b')];_0x3d15c8<_0xc05e00;_0x3d15c8++){if(!_0x5a8b81[_0xdaad('0x3c')](_0x4adc97[_0x3d15c8]['questionId'])){_0x5a8b81[_0x4adc97[_0x3d15c8][_0xdaad('0x69')]]=needsEncapsulation(_0x4adc97[_0x3d15c8][_0xdaad('0x6a')])?encapsulate(_0x4adc97[_0x3d15c8][_0xdaad('0x6a')]):_0x4adc97[_0x3d15c8][_0xdaad('0x6a')];}}var _0x27a84a=[],_0x8112e2={};for(var _0x5af5ed=0x0,_0x2ac2c5=_0x4ac608['length'];_0x5af5ed<_0x2ac2c5;_0x5af5ed++){_0x8112e2={'ProjectId':_0x4e1da3[_0xdaad('0x48')]['id'],'SessionId':_0x4ac608[_0x5af5ed]['id'],'StartTime':moment(_0x4ac608[_0x5af5ed][_0xdaad('0x6b')])[_0xdaad('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x336ec9=0x0,_0x55259a=_0x4adc97[_0xdaad('0x3b')];_0x336ec9<_0x55259a;_0x336ec9++){if(_0x4adc97[_0x336ec9][_0xdaad('0x6d')]==_0x4ac608[_0x5af5ed]['id']&&_0x5a8b81[_0xdaad('0x3c')](_0x4adc97[_0x336ec9][_0xdaad('0x69')])){_0x8112e2[_0x5a8b81[_0x4adc97[_0x336ec9][_0xdaad('0x69')]]]=_0x4adc97[_0x336ec9][_0xdaad('0x6e')];}}for(var _0xf1f80b in _0x5a8b81){if(!_0x8112e2[_0xdaad('0x3c')](_0x5a8b81[_0xf1f80b])){_0x8112e2[_0x5a8b81[_0xf1f80b]]=null;}}_0x27a84a[_0xdaad('0x6f')](_0x8112e2);}return _0x27a84a;}})[_0xdaad('0x27')](function(_0x52dee4){if(!_[_0xdaad('0x70')](_0x52dee4)){var _0x2b5410=toCsv(_0x52dee4);var _0xa3b9f2=Date[_0xdaad('0x71')]();fs[_0xdaad('0x72')](util[_0xdaad('0x6c')](_0xdaad('0x73'),_0x4e1da3[_0xdaad('0x48')]['id'],_0xa3b9f2),_0x2b5410);_0x15cfc0[_0xdaad('0x74')](_0xdaad('0x75'),_0xdaad('0x76')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x4e1da3[_0xdaad('0x48')]['id'],_0xa3b9f2));_0x15cfc0[_0xdaad('0x74')](_0xdaad('0x77'),'text/csv');return _0x15cfc0[_0xdaad('0x78')](util[_0xdaad('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4e1da3['params']['id'],_0xa3b9f2));}else{return _0x15cfc0[_0xdaad('0x1b')](0xcc);}})[_0xdaad('0x47')](handleError(_0x15cfc0,null));}; \ No newline at end of file +var _0xd3f5=['UserProfileResource','destroy','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','findAll','catch','show','params','keys','rawAttributes','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','user','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','rows','number','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Projects'];(function(_0x300fd1,_0x17acd6){var _0x4afb4a=function(_0x5c1f41){while(--_0x5c1f41){_0x300fd1['push'](_0x300fd1['shift']());}};_0x4afb4a(++_0x17acd6);}(_0xd3f5,0x147));var _0x5d3f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd3f5[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x5d3f('0x0'));var rimraf=require(_0x5d3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d3f('0x2'));var rp=require(_0x5d3f('0x3'));var moment=require(_0x5d3f('0x4'));var BPromise=require(_0x5d3f('0x5'));var Mustache=require(_0x5d3f('0x6'));var util=require(_0x5d3f('0x7'));var path=require(_0x5d3f('0x8'));var sox=require(_0x5d3f('0x9'));var csv=require('to-csv');var ejs=require(_0x5d3f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d3f('0xb'));var squel=require(_0x5d3f('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d3f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5d3f('0xe'));var querystring=require('querystring');var Papa=require(_0x5d3f('0xf'));var Redis=require('ioredis');var authService=require(_0x5d3f('0x10'));var qs=require(_0x5d3f('0x11'));var as=require(_0x5d3f('0x12'));var hardwareService=require(_0x5d3f('0x13'));var logger=require(_0x5d3f('0x14'))(_0x5d3f('0x15'));var utils=require(_0x5d3f('0x16'));var config=require(_0x5d3f('0x17'));var licenseUtil=require(_0x5d3f('0x18'));var db=require(_0x5d3f('0x19'))['db'];function respondWithStatusCode(_0x41afec,_0x513884){_0x513884=_0x513884||0xcc;return function(_0x2359ae){if(_0x2359ae){return _0x41afec[_0x5d3f('0x1a')](_0x513884);}return _0x41afec[_0x5d3f('0x1b')](_0x513884)[_0x5d3f('0x1c')]();};}function respondWithResult(_0x4d0dbc,_0xaeb8b){_0xaeb8b=_0xaeb8b||0xc8;return function(_0x2d917a){if(_0x2d917a){return _0x4d0dbc['status'](_0xaeb8b)[_0x5d3f('0x1d')](_0x2d917a);}};}function respondWithFilteredResult(_0x5d1342,_0xcb108e){return function(_0x3e03ed){if(_0x3e03ed){var _0x1f55bb=typeof _0xcb108e[_0x5d3f('0x1e')]===_0x5d3f('0x1f')&&typeof _0xcb108e[_0x5d3f('0x20')]===_0x5d3f('0x1f');var _0x56b671=_0x3e03ed[_0x5d3f('0x21')];var _0x4cdf5e=_0x1f55bb?0x0:_0xcb108e[_0x5d3f('0x1e')];var _0x31f573=_0x1f55bb?_0x3e03ed[_0x5d3f('0x21')]:_0xcb108e[_0x5d3f('0x1e')]+_0xcb108e['limit'];var _0x40d075;if(_0x31f573>=_0x56b671){_0x31f573=_0x56b671;_0x40d075=0xc8;}else{_0x40d075=0xce;}_0x5d1342['status'](_0x40d075);return _0x5d1342[_0x5d3f('0x22')](_0x5d3f('0x23'),_0x4cdf5e+'-'+_0x31f573+'/'+_0x56b671)['json'](_0x3e03ed);}return null;};}function patchUpdates(_0x5c22c2){return function(_0x108e78){try{jsonpatch[_0x5d3f('0x24')](_0x108e78,_0x5c22c2,!![]);}catch(_0x3edc42){return BPromise[_0x5d3f('0x25')](_0x3edc42);}return _0x108e78['save']();};}function saveUpdates(_0x4b0a35,_0x3a31e0){return function(_0x33fa94){if(_0x33fa94){return _0x33fa94[_0x5d3f('0x26')](_0x4b0a35)['then'](function(_0x3a7f56){return _0x3a7f56;});}return null;};}function removeEntity(_0x32a554,_0x59620d){return function(_0x345514){if(_0x345514){return _0x345514['destroy']()[_0x5d3f('0x27')](function(){var _0x56634d=_0x345514[_0x5d3f('0x28')]({'plain':!![]});var _0x65449=_0x5d3f('0x29');return db[_0x5d3f('0x2a')][_0x5d3f('0x2b')]({'where':{'type':_0x65449,'resourceId':_0x56634d['id']}})[_0x5d3f('0x27')](function(){return _0x345514;});})['then'](function(){_0x32a554[_0x5d3f('0x1b')](0xcc)[_0x5d3f('0x1c')]();});}};}function handleEntityNotFound(_0x2e0f23,_0x59a1a8){return function(_0x1f5e07){if(!_0x1f5e07){_0x2e0f23['sendStatus'](0x194);}return _0x1f5e07;};}function handleError(_0x5f41c3,_0x4ced45){_0x4ced45=_0x4ced45||0x1f4;return function(_0x2f2c74){logger[_0x5d3f('0x2c')](_0x2f2c74[_0x5d3f('0x2d')]);if(_0x2f2c74['name']){delete _0x2f2c74[_0x5d3f('0x2e')];}_0x5f41c3[_0x5d3f('0x1b')](_0x4ced45)[_0x5d3f('0x2f')](_0x2f2c74);};}exports[_0x5d3f('0x30')]=function(_0x5ed9ba,_0x5c97f0){var _0x12c691={},_0x15ff9f={},_0x5dd308={'count':0x0,'rows':[]};var _0x5407d4=_[_0x5d3f('0x31')](db[_0x5d3f('0x32')]['rawAttributes'],function(_0x3d424a){return{'name':_0x3d424a[_0x5d3f('0x33')],'type':_0x3d424a[_0x5d3f('0x34')][_0x5d3f('0x35')]};});_0x15ff9f[_0x5d3f('0x36')]=_[_0x5d3f('0x31')](_0x5407d4,_0x5d3f('0x2e'));_0x15ff9f[_0x5d3f('0x37')]=_['keys'](_0x5ed9ba[_0x5d3f('0x37')]);_0x15ff9f[_0x5d3f('0x38')]=_[_0x5d3f('0x39')](_0x15ff9f['model'],_0x15ff9f[_0x5d3f('0x37')]);_0x12c691[_0x5d3f('0x3a')]=_[_0x5d3f('0x39')](_0x15ff9f[_0x5d3f('0x36')],qs[_0x5d3f('0x3b')](_0x5ed9ba[_0x5d3f('0x37')][_0x5d3f('0x3b')]));_0x12c691[_0x5d3f('0x3a')]=_0x12c691[_0x5d3f('0x3a')]['length']?_0x12c691[_0x5d3f('0x3a')]:_0x15ff9f['model'];if(!_0x5ed9ba[_0x5d3f('0x37')][_0x5d3f('0x3c')](_0x5d3f('0x3d'))){_0x12c691['limit']=qs[_0x5d3f('0x20')](_0x5ed9ba[_0x5d3f('0x37')]['limit']);_0x12c691[_0x5d3f('0x1e')]=qs[_0x5d3f('0x1e')](_0x5ed9ba[_0x5d3f('0x37')][_0x5d3f('0x1e')]);}_0x12c691[_0x5d3f('0x3e')]=qs[_0x5d3f('0x3f')](_0x5ed9ba[_0x5d3f('0x37')][_0x5d3f('0x3f')]);_0x12c691['where']=qs[_0x5d3f('0x38')](_[_0x5d3f('0x40')](_0x5ed9ba[_0x5d3f('0x37')],_0x15ff9f[_0x5d3f('0x38')]),_0x5407d4);if(_0x5ed9ba[_0x5d3f('0x37')][_0x5d3f('0x41')]){_0x12c691[_0x5d3f('0x42')]=_[_0x5d3f('0x43')](_0x12c691['where'],{'$or':_[_0x5d3f('0x31')](_0x5407d4,function(_0x57568e){if(_0x57568e[_0x5d3f('0x34')]!=='VIRTUAL'){var _0x2612d1={};_0x2612d1[_0x57568e[_0x5d3f('0x2e')]]={'$like':'%'+_0x5ed9ba[_0x5d3f('0x37')]['filter']+'%'};return _0x2612d1;}})});}_0x12c691=_['merge']({},_0x12c691,_0x5ed9ba[_0x5d3f('0x44')]);var _0x1771c3={'where':_0x12c691[_0x5d3f('0x42')]};return db[_0x5d3f('0x32')]['count'](_0x1771c3)[_0x5d3f('0x27')](function(_0x13f796){_0x5dd308[_0x5d3f('0x21')]=_0x13f796;if(_0x5ed9ba[_0x5d3f('0x37')]['includeAll']){_0x12c691['include']=[{'all':!![]}];}return db[_0x5d3f('0x32')][_0x5d3f('0x45')](_0x12c691);})[_0x5d3f('0x27')](function(_0x13d7f5){_0x5dd308['rows']=_0x13d7f5;return _0x5dd308;})[_0x5d3f('0x27')](respondWithFilteredResult(_0x5c97f0,_0x12c691))[_0x5d3f('0x46')](handleError(_0x5c97f0,null));};exports[_0x5d3f('0x47')]=function(_0x226e22,_0xe91c45){var _0x5aae0a={'raw':![],'where':{'id':_0x226e22[_0x5d3f('0x48')]['id']}},_0x24e04c={};_0x24e04c['model']=_[_0x5d3f('0x49')](db[_0x5d3f('0x32')][_0x5d3f('0x4a')]);_0x24e04c[_0x5d3f('0x37')]=_['keys'](_0x226e22[_0x5d3f('0x37')]);_0x24e04c[_0x5d3f('0x38')]=_[_0x5d3f('0x39')](_0x24e04c['model'],_0x24e04c[_0x5d3f('0x37')]);_0x5aae0a[_0x5d3f('0x3a')]=_[_0x5d3f('0x39')](_0x24e04c[_0x5d3f('0x36')],qs[_0x5d3f('0x3b')](_0x226e22[_0x5d3f('0x37')][_0x5d3f('0x3b')]));_0x5aae0a[_0x5d3f('0x3a')]=_0x5aae0a[_0x5d3f('0x3a')][_0x5d3f('0x4b')]?_0x5aae0a[_0x5d3f('0x3a')]:_0x24e04c[_0x5d3f('0x36')];if(_0x226e22[_0x5d3f('0x37')]['includeAll']){_0x5aae0a[_0x5d3f('0x4c')]=[{'all':!![]}];}_0x5aae0a=_[_0x5d3f('0x43')]({},_0x5aae0a,_0x226e22[_0x5d3f('0x44')]);return db[_0x5d3f('0x32')]['find'](_0x5aae0a)[_0x5d3f('0x27')](handleEntityNotFound(_0xe91c45,null))['then'](respondWithResult(_0xe91c45,null))[_0x5d3f('0x46')](handleError(_0xe91c45,null));};exports['create']=function(_0x124456,_0x1e9dd6){return db[_0x5d3f('0x32')][_0x5d3f('0x4d')](_0x124456[_0x5d3f('0x4e')],{})[_0x5d3f('0x27')](function(_0x311c8f){var _0x1d1d8f=_0x124456['user'][_0x5d3f('0x28')]({'plain':!![]});if(!_0x1d1d8f)throw new Error(_0x5d3f('0x4f'));if(_0x1d1d8f[_0x5d3f('0x50')]==='user'){var _0x58932e=_0x311c8f[_0x5d3f('0x28')]({'plain':!![]});var _0x237765=_0x5d3f('0x29');return db[_0x5d3f('0x51')][_0x5d3f('0x52')]({'where':{'name':_0x237765,'userProfileId':_0x1d1d8f[_0x5d3f('0x53')]},'raw':!![]})[_0x5d3f('0x27')](function(_0x248b57){if(_0x248b57&&_0x248b57[_0x5d3f('0x54')]===0x0){return db[_0x5d3f('0x2a')]['create']({'name':_0x58932e[_0x5d3f('0x2e')],'resourceId':_0x58932e['id'],'type':_0x248b57[_0x5d3f('0x2e')],'sectionId':_0x248b57['id']},{})[_0x5d3f('0x27')](function(){return _0x311c8f;});}else{return _0x311c8f;}})[_0x5d3f('0x46')](function(_0x164fbd){logger[_0x5d3f('0x2c')](_0x5d3f('0x55'),_0x164fbd);throw _0x164fbd;});}return _0x311c8f;})['then'](respondWithResult(_0x1e9dd6,0xc9))[_0x5d3f('0x46')](handleError(_0x1e9dd6,null));};exports[_0x5d3f('0x56')]=function(_0x2402f9,_0x1d1b25){var _0x5899c1={'where':{'id':_0x2402f9[_0x5d3f('0x48')]['id']}},_0x231c0d={};_0x231c0d[_0x5d3f('0x36')]=_[_0x5d3f('0x49')](db['JscriptyProject'][_0x5d3f('0x4a')]);_0x5899c1[_0x5d3f('0x3a')]=_[_0x5d3f('0x39')](_0x231c0d[_0x5d3f('0x36')],qs[_0x5d3f('0x3b')](_0x2402f9[_0x5d3f('0x37')]['fields']));_0x5899c1[_0x5d3f('0x3a')]=_0x5899c1['attributes'][_0x5d3f('0x4b')]?_0x5899c1[_0x5d3f('0x3a')]:_0x231c0d[_0x5d3f('0x36')];if(_0x2402f9['query'][_0x5d3f('0x57')]){_0x5899c1[_0x5d3f('0x4c')]=[{'all':!![]}];}_0x5899c1=_[_0x5d3f('0x43')]({},_0x5899c1,_0x2402f9['options']);return db[_0x5d3f('0x32')][_0x5d3f('0x52')](_0x5899c1)[_0x5d3f('0x27')](handleEntityNotFound(_0x1d1b25,null))['then'](function(_0x966bdf){if(_0x966bdf){var _0xc11a5=_0x966bdf[_0x5d3f('0x28')]({'plain':!![]});_0xc11a5=qs['omit'](_0xc11a5,['id','createdAt','updatedAt']);_0x2402f9['body']=_[_0x5d3f('0x58')](_0x2402f9[_0x5d3f('0x4e')],['id',_0x5d3f('0x59'),_0x5d3f('0x5a')]);return db[_0x5d3f('0x32')]['create'](_['merge'](_0xc11a5,_0x2402f9[_0x5d3f('0x4e')]),{'include':_0x2402f9[_0x5d3f('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x5d3f('0x27')](function(_0x928455){var _0x2e5d2b=_0x2402f9[_0x5d3f('0x5b')][_0x5d3f('0x28')]({'plain':!![]});if(!_0x2e5d2b)throw new Error(_0x5d3f('0x4f'));if(_0x2e5d2b[_0x5d3f('0x50')]===_0x5d3f('0x5b')){var _0x493fc5=_0x928455[_0x5d3f('0x28')]({'plain':!![]});var _0x348e2b=_0x5d3f('0x29');return db[_0x5d3f('0x51')][_0x5d3f('0x52')]({'where':{'name':_0x348e2b,'userProfileId':_0x2e5d2b['userProfileId']},'raw':!![]})[_0x5d3f('0x27')](function(_0x4a2d1d){if(_0x4a2d1d&&_0x4a2d1d['autoAssociation']===0x0){return db[_0x5d3f('0x2a')][_0x5d3f('0x4d')]({'name':_0x493fc5[_0x5d3f('0x2e')],'resourceId':_0x493fc5['id'],'type':_0x4a2d1d[_0x5d3f('0x2e')],'sectionId':_0x4a2d1d['id']},{})[_0x5d3f('0x27')](function(){return _0x928455;});}else{return _0x928455;}})['catch'](function(_0xd49353){logger[_0x5d3f('0x2c')](_0x5d3f('0x55'),_0xd49353);throw _0xd49353;});}return _0x928455;});}})[_0x5d3f('0x27')](respondWithResult(_0x1d1b25,0xc9))[_0x5d3f('0x46')](handleError(_0x1d1b25,null));};exports[_0x5d3f('0x26')]=function(_0xa33579,_0x367bbe){if(_0xa33579['body']['id']){delete _0xa33579['body']['id'];}return db[_0x5d3f('0x32')]['find']({'where':{'id':_0xa33579[_0x5d3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x367bbe,null))[_0x5d3f('0x27')](saveUpdates(_0xa33579[_0x5d3f('0x4e')],null))[_0x5d3f('0x27')](respondWithResult(_0x367bbe,null))[_0x5d3f('0x46')](handleError(_0x367bbe,null));};exports[_0x5d3f('0x2b')]=function(_0x5c46da,_0x30b33f){return db[_0x5d3f('0x32')]['find']({'where':{'id':_0x5c46da[_0x5d3f('0x48')]['id']}})[_0x5d3f('0x27')](handleEntityNotFound(_0x30b33f,null))['then'](removeEntity(_0x30b33f,null))[_0x5d3f('0x46')](handleError(_0x30b33f,null));};exports[_0x5d3f('0x5c')]=function(_0x3a5fec,_0x1500c7,_0x1d47e7){var _0x1cb57b={'raw':!![],'where':{}};var _0x195b86={};var _0x50a007={'count':0x0,'rows':[]};return db[_0x5d3f('0x32')][_0x5d3f('0x5d')]({'where':{'id':_0x3a5fec['params']['id']}})[_0x5d3f('0x27')](handleEntityNotFound(_0x1500c7,null))[_0x5d3f('0x27')](function(_0x231741){if(_0x231741){_0x195b86[_0x5d3f('0x36')]=_[_0x5d3f('0x49')](db[_0x5d3f('0x5e')][_0x5d3f('0x4a')]);_0x195b86[_0x5d3f('0x37')]=_[_0x5d3f('0x49')](_0x3a5fec[_0x5d3f('0x37')]);_0x195b86['filters']=_[_0x5d3f('0x39')](_0x195b86[_0x5d3f('0x36')],_0x195b86[_0x5d3f('0x37')]);_0x1cb57b[_0x5d3f('0x3a')]=_[_0x5d3f('0x39')](_0x195b86[_0x5d3f('0x36')],qs[_0x5d3f('0x3b')](_0x3a5fec[_0x5d3f('0x37')][_0x5d3f('0x3b')]));_0x1cb57b['attributes']=_0x1cb57b[_0x5d3f('0x3a')][_0x5d3f('0x4b')]?_0x1cb57b[_0x5d3f('0x3a')]:_0x195b86['model'];if(!_0x3a5fec[_0x5d3f('0x37')]['hasOwnProperty']('nolimit')){_0x1cb57b[_0x5d3f('0x20')]=qs[_0x5d3f('0x20')](_0x3a5fec[_0x5d3f('0x37')][_0x5d3f('0x20')]);_0x1cb57b[_0x5d3f('0x1e')]=qs[_0x5d3f('0x1e')](_0x3a5fec[_0x5d3f('0x37')]['offset']);}_0x1cb57b[_0x5d3f('0x3e')]=qs['sort'](_0x3a5fec[_0x5d3f('0x37')][_0x5d3f('0x3f')]);_0x1cb57b[_0x5d3f('0x42')]=qs[_0x5d3f('0x38')](_[_0x5d3f('0x40')](_0x3a5fec[_0x5d3f('0x37')],_0x195b86[_0x5d3f('0x38')]));_0x1cb57b[_0x5d3f('0x42')][_0x5d3f('0x5f')]=_0x231741['id'];if(_0x3a5fec[_0x5d3f('0x37')][_0x5d3f('0x41')]){_0x1cb57b[_0x5d3f('0x42')]=_[_0x5d3f('0x43')](_0x1cb57b[_0x5d3f('0x42')],{'$or':_[_0x5d3f('0x31')](_0x1cb57b[_0x5d3f('0x3a')],function(_0x4c9c91){var _0x1e01b0={};_0x1e01b0[_0x4c9c91]={'$like':'%'+_0x3a5fec['query'][_0x5d3f('0x41')]+'%'};return _0x1e01b0;})});}_0x1cb57b=_[_0x5d3f('0x43')]({},_0x1cb57b,_0x3a5fec[_0x5d3f('0x44')]);return db[_0x5d3f('0x5e')]['count']({'where':_0x1cb57b['where']})[_0x5d3f('0x27')](function(_0x551512){_0x50a007[_0x5d3f('0x21')]=_0x551512;if(_0x3a5fec[_0x5d3f('0x37')][_0x5d3f('0x57')]){_0x1cb57b[_0x5d3f('0x4c')]=[{'all':!![]}];}return db[_0x5d3f('0x5e')][_0x5d3f('0x45')](_0x1cb57b);})[_0x5d3f('0x27')](function(_0x5f0a1e){_0x50a007['rows']=_0x5f0a1e;return _0x50a007;});}})[_0x5d3f('0x27')](respondWithFilteredResult(_0x1500c7,_0x1cb57b))[_0x5d3f('0x46')](handleError(_0x1500c7,null));};exports[_0x5d3f('0x60')]=function(_0xa3546d,_0x3ce946,_0x11d766){var _0x1036f8={'raw':!![],'where':{}};var _0x3a685d={};var _0x6f87da={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x5d3f('0x5d')]({'where':{'id':_0xa3546d[_0x5d3f('0x48')]['id']}})[_0x5d3f('0x27')](handleEntityNotFound(_0x3ce946,null))[_0x5d3f('0x27')](function(_0x26fbb2){if(_0x26fbb2){_0x3a685d[_0x5d3f('0x36')]=_[_0x5d3f('0x49')](db[_0x5d3f('0x61')]['rawAttributes']);_0x3a685d[_0x5d3f('0x37')]=_[_0x5d3f('0x49')](_0xa3546d[_0x5d3f('0x37')]);_0x3a685d[_0x5d3f('0x38')]=_['intersection'](_0x3a685d['model'],_0x3a685d['query']);_0x1036f8[_0x5d3f('0x3a')]=_['intersection'](_0x3a685d[_0x5d3f('0x36')],qs[_0x5d3f('0x3b')](_0xa3546d['query']['fields']));_0x1036f8[_0x5d3f('0x3a')]=_0x1036f8[_0x5d3f('0x3a')][_0x5d3f('0x4b')]?_0x1036f8[_0x5d3f('0x3a')]:_0x3a685d[_0x5d3f('0x36')];if(!_0xa3546d[_0x5d3f('0x37')][_0x5d3f('0x3c')](_0x5d3f('0x3d'))){_0x1036f8[_0x5d3f('0x20')]=qs['limit'](_0xa3546d[_0x5d3f('0x37')][_0x5d3f('0x20')]);_0x1036f8[_0x5d3f('0x1e')]=qs[_0x5d3f('0x1e')](_0xa3546d[_0x5d3f('0x37')][_0x5d3f('0x1e')]);}_0x1036f8['order']=qs['sort'](_0xa3546d['query'][_0x5d3f('0x3f')]);_0x1036f8[_0x5d3f('0x42')]=qs[_0x5d3f('0x38')](_[_0x5d3f('0x40')](_0xa3546d[_0x5d3f('0x37')],_0x3a685d[_0x5d3f('0x38')]));_0x1036f8[_0x5d3f('0x42')]['ProjectId']=_0x26fbb2['id'];if(_0xa3546d[_0x5d3f('0x37')][_0x5d3f('0x41')]){_0x1036f8['where']=_[_0x5d3f('0x43')](_0x1036f8[_0x5d3f('0x42')],{'$or':_[_0x5d3f('0x31')](_0x1036f8[_0x5d3f('0x3a')],function(_0x577c5e){var _0x3c18dd={};_0x3c18dd[_0x577c5e]={'$like':'%'+_0xa3546d[_0x5d3f('0x37')][_0x5d3f('0x41')]+'%'};return _0x3c18dd;})});}_0x1036f8=_[_0x5d3f('0x43')]({},_0x1036f8,_0xa3546d[_0x5d3f('0x44')]);return db['JscriptyAnswerReport'][_0x5d3f('0x21')]({'where':_0x1036f8['where']})[_0x5d3f('0x27')](function(_0x2568b5){_0x6f87da[_0x5d3f('0x21')]=_0x2568b5;if(_0xa3546d[_0x5d3f('0x37')][_0x5d3f('0x57')]){_0x1036f8['include']=[{'all':!![]}];}return db[_0x5d3f('0x61')][_0x5d3f('0x45')](_0x1036f8);})[_0x5d3f('0x27')](function(_0x55b45c){_0x6f87da[_0x5d3f('0x62')]=_0x55b45c;return _0x6f87da;});}})[_0x5d3f('0x27')](respondWithFilteredResult(_0x3ce946,_0x1036f8))[_0x5d3f('0x46')](handleError(_0x3ce946,null));};function char(_0x10eea5){return _0x5d3f('0x63')===typeof _0x10eea5?String['fromCharCode']['apply'](null,arguments):_0x10eea5;}function needsEncapsulation(_0x234691){return!!_0x234691&&(_0x234691[_0x5d3f('0x64')]()[_0x5d3f('0x65')](char(0xd))>=0x0||_0x234691['toString']()[_0x5d3f('0x65')](char(0xa))>=0x0||_0x234691[_0x5d3f('0x64')]()[_0x5d3f('0x65')](char(0x2c))>=0x0||_0x234691['toString']()[_0x5d3f('0x65')](char(0x22))>=0x0);}function encapsulate(_0x88010e){var _0x2f7ab7=char(0x22),_0x4f1173='\x5c'+char(0x22),_0x178f11=_0x88010e[_0x5d3f('0x64')]()['replace'](new RegExp(_0x2f7ab7,'g'),_0x4f1173);return _0x2f7ab7+_0x178f11+_0x2f7ab7;}exports[_0x5d3f('0x66')]=function(_0x2c0cde,_0x422e5e,_0x2ef75c){var _0x1fdfcf,_0xf7b610;var _0x4e6d83={'where':{'ProjectId':_0x2c0cde['params']['id']}};if(_0x2c0cde[_0x5d3f('0x37')][_0x5d3f('0x67')]){_0x4e6d83[_0x5d3f('0x42')][_0x5d3f('0x68')]=JSON['parse'](_0x2c0cde[_0x5d3f('0x37')][_0x5d3f('0x67')]);}return db[_0x5d3f('0x5e')][_0x5d3f('0x45')](_0x4e6d83)['then'](handleEntityNotFound(_0x422e5e,null))[_0x5d3f('0x27')](function(_0x49d83d){if(_0x49d83d){_0x1fdfcf=_0x49d83d;return db[_0x5d3f('0x69')][_0x5d3f('0x45')]({'where':{'SessionId':{'$in':_[_0x5d3f('0x31')](_0x1fdfcf,'id')},'ProjectId':_0x2c0cde[_0x5d3f('0x48')]['id']},'order':_0x5d3f('0x6a')});}})[_0x5d3f('0x27')](handleEntityNotFound(_0x422e5e,null))[_0x5d3f('0x27')](function(_0x2aa918){if(_0x2aa918){_0xf7b610=_0x2aa918;var _0x3b697c={};for(var _0x4e1c9d=0x0,_0x5bbb13=_0xf7b610[_0x5d3f('0x4b')];_0x4e1c9d<_0x5bbb13;_0x4e1c9d++){if(!_0x3b697c['hasOwnProperty'](_0xf7b610[_0x4e1c9d][_0x5d3f('0x6b')])){_0x3b697c[_0xf7b610[_0x4e1c9d][_0x5d3f('0x6b')]]=needsEncapsulation(_0xf7b610[_0x4e1c9d][_0x5d3f('0x6c')])?encapsulate(_0xf7b610[_0x4e1c9d][_0x5d3f('0x6c')]):_0xf7b610[_0x4e1c9d][_0x5d3f('0x6c')];}}var _0x67d0e3=[],_0x297671={};for(var _0x4b3002=0x0,_0x52dbf7=_0x1fdfcf['length'];_0x4b3002<_0x52dbf7;_0x4b3002++){_0x297671={'ProjectId':_0x2c0cde[_0x5d3f('0x48')]['id'],'SessionId':_0x1fdfcf[_0x4b3002]['id'],'StartTime':moment(_0x1fdfcf[_0x4b3002][_0x5d3f('0x68')])['format'](_0x5d3f('0x6d'))};for(var _0x33e34c=0x0,_0x56db8e=_0xf7b610[_0x5d3f('0x4b')];_0x33e34c<_0x56db8e;_0x33e34c++){if(_0xf7b610[_0x33e34c][_0x5d3f('0x6e')]==_0x1fdfcf[_0x4b3002]['id']&&_0x3b697c['hasOwnProperty'](_0xf7b610[_0x33e34c][_0x5d3f('0x6b')])){_0x297671[_0x3b697c[_0xf7b610[_0x33e34c][_0x5d3f('0x6b')]]]=_0xf7b610[_0x33e34c][_0x5d3f('0x6f')];}}for(var _0x231397 in _0x3b697c){if(!_0x297671[_0x5d3f('0x3c')](_0x3b697c[_0x231397])){_0x297671[_0x3b697c[_0x231397]]=null;}}_0x67d0e3['push'](_0x297671);}return _0x67d0e3;}})['then'](function(_0x14d3a2){if(!_[_0x5d3f('0x70')](_0x14d3a2)){var _0x3b076e=toCsv(_0x14d3a2);var _0x5b36e4=Date[_0x5d3f('0x71')]();fs[_0x5d3f('0x72')](util['format'](_0x5d3f('0x73'),_0x2c0cde[_0x5d3f('0x48')]['id'],_0x5b36e4),_0x3b076e);_0x422e5e[_0x5d3f('0x74')](_0x5d3f('0x75'),_0x5d3f('0x76')+util[_0x5d3f('0x77')]('Jscripty_Project_%d_Summary_%s.csv',_0x2c0cde['params']['id'],_0x5b36e4));_0x422e5e[_0x5d3f('0x74')](_0x5d3f('0x78'),_0x5d3f('0x79'));return _0x422e5e[_0x5d3f('0x7a')](util[_0x5d3f('0x77')](_0x5d3f('0x73'),_0x2c0cde[_0x5d3f('0x48')]['id'],_0x5b36e4));}else{return _0x422e5e['sendStatus'](0xcc);}})[_0x5d3f('0x46')](handleError(_0x422e5e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 38893f7..3d04822 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 _0xa9b1=['bluebird','request-promise','path','exports','define','JscriptyProject','jscripty_projects','../../config/logger','api','moment'];(function(_0x1fe456,_0x3b586f){var _0x312469=function(_0x5bf5ff){while(--_0x5bf5ff){_0x1fe456['push'](_0x1fe456['shift']());}};_0x312469(++_0x3b586f);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1a9b('0x0'))(_0x1a9b('0x1'));var moment=require(_0x1a9b('0x2'));var BPromise=require(_0x1a9b('0x3'));var rp=require(_0x1a9b('0x4'));var fs=require('fs');var path=require(_0x1a9b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x1a9b('0x6')]=function(_0x15861d,_0x1a78b6){return _0x15861d[_0x1a9b('0x7')](_0x1a9b('0x8'),attributes,{'tableName':_0x1a9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c96=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','lodash','../../config/logger'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x6c96,0x1c1));var _0x66c9=function(_0x3882eb,_0x247db1){_0x3882eb=_0x3882eb-0x0;var _0x5ed58d=_0x6c96[_0x3882eb];return _0x5ed58d;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var logger=require(_0x66c9('0x1'))(_0x66c9('0x2'));var moment=require('moment');var BPromise=require(_0x66c9('0x3'));var rp=require(_0x66c9('0x4'));var fs=require('fs');var path=require(_0x66c9('0x5'));var rimraf=require(_0x66c9('0x6'));var config=require(_0x66c9('0x7'));var attributes=require(_0x66c9('0x8'));module[_0x66c9('0x9')]=function(_0x55b24d,_0x1c8b59){return _0x55b24d['define'](_0x66c9('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 74caa97..6cff782 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 _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x426cad,_0x45810d){_0x426cad=_0x426cad-0x0;var _0x50c00f=_0xbdb7[_0x426cad];return _0x50c00f;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4caea4,_0x4f02e4){var _0x207c7c=function(_0x1dc16a){while(--_0x1dc16a){_0x4caea4['push'](_0x4caea4['shift']());}};_0x207c7c(++_0x4f02e4);}(_0xaa88,0x137));var _0x8aa8=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0xaa88[_0x43c8b8];return _0x413be3;};'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')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ebd59d7..2ce86ba 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 _0xeb8c=['put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','describe','/:id','isAuthenticated','show','post','create'];(function(_0x2bf00b,_0xc27791){var _0x1bc255=function(_0x280f48){while(--_0x280f48){_0x2bf00b['push'](_0x2bf00b['shift']());}};_0x1bc255(++_0xc27791);}(_0xeb8c,0x1a7));var _0xceb8=function(_0x22d9c3,_0x304b0d){_0x22d9c3=_0x22d9c3-0x0;var _0x4b208c=_0xeb8c[_0x22d9c3];return _0x4b208c;};'use strict';var multer=require(_0xceb8('0x0'));var util=require(_0xceb8('0x1'));var path=require(_0xceb8('0x2'));var timeout=require(_0xceb8('0x3'));var express=require('express');var router=express[_0xceb8('0x4')]();var fs_extra=require(_0xceb8('0x5'));var auth=require(_0xceb8('0x6'));var interaction=require(_0xceb8('0x7'));var config=require(_0xceb8('0x8'));var controller=require(_0xceb8('0x9'));router[_0xceb8('0xa')]('/',auth['isAuthenticated'](),controller[_0xceb8('0xb')]);router[_0xceb8('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xceb8('0xc')]);router[_0xceb8('0xa')](_0xceb8('0xd'),auth[_0xceb8('0xe')](),controller[_0xceb8('0xf')]);router[_0xceb8('0x10')]('/',auth[_0xceb8('0xe')](),controller[_0xceb8('0x11')]);router[_0xceb8('0x12')](_0xceb8('0xd'),auth['isAuthenticated'](),controller[_0xceb8('0x13')]);router['delete'](_0xceb8('0xd'),auth[_0xceb8('0xe')](),controller['destroy']);module[_0xceb8('0x14')]=router; \ No newline at end of file +var _0x7f72=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','describe','/:id','isAuthenticated','show','post','update','delete','destroy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7f72,0x144));var _0x27f7=function(_0x962de1,_0x361057){_0x962de1=_0x962de1-0x0;var _0x14085a=_0x7f72[_0x962de1];return _0x14085a;};'use strict';var multer=require(_0x27f7('0x0'));var util=require(_0x27f7('0x1'));var path=require(_0x27f7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x27f7('0x3')]();var fs_extra=require(_0x27f7('0x4'));var auth=require(_0x27f7('0x5'));var interaction=require(_0x27f7('0x6'));var config=require(_0x27f7('0x7'));var controller=require(_0x27f7('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x27f7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x27f7('0xa')]);router[_0x27f7('0x9')](_0x27f7('0xb'),auth[_0x27f7('0xc')](),controller[_0x27f7('0xd')]);router[_0x27f7('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x27f7('0xf')]);router[_0x27f7('0x10')](_0x27f7('0xb'),auth['isAuthenticated'](),controller[_0x27f7('0x11')]);module[_0x27f7('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 45c40cf..8ee2e64 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(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7a54,0x106));var _0x47a5=function(_0x2f78f7,_0x2dd147){_0x2f78f7=_0x2f78f7-0x0;var _0x3b58cf=_0x7a54[_0x2f78f7];return _0x3b58cf;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x12e18e,_0x5920d0){_0x12e18e=_0x12e18e-0x0;var _0x35a3a7=_0x7a54[_0x12e18e];return _0x35a3a7;};'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 4cceeaa..03bd0dd 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 _0xf2ea=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf2ea,0xce));var _0xaf2e=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf2ea[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0xaf2e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2e('0x1'));var rp=require(_0xaf2e('0x2'));var moment=require(_0xaf2e('0x3'));var BPromise=require(_0xaf2e('0x4'));var Mustache=require(_0xaf2e('0x5'));var util=require(_0xaf2e('0x6'));var path=require(_0xaf2e('0x7'));var sox=require(_0xaf2e('0x8'));var csv=require(_0xaf2e('0x9'));var ejs=require(_0xaf2e('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2e('0xb'));var _=require(_0xaf2e('0xc'));var squel=require('squel');var crypto=require(_0xaf2e('0xd'));var jsforce=require(_0xaf2e('0xe'));var deskjs=require(_0xaf2e('0xf'));var toCsv=require(_0xaf2e('0x9'));var querystring=require(_0xaf2e('0x10'));var Papa=require(_0xaf2e('0x11'));var Redis=require(_0xaf2e('0x12'));var authService=require(_0xaf2e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf2e('0x14'))(_0xaf2e('0x15'));var utils=require(_0xaf2e('0x16'));var config=require(_0xaf2e('0x17'));var licenseUtil=require(_0xaf2e('0x18'));var db=require(_0xaf2e('0x19'))['db'];function respondWithStatusCode(_0x444885,_0x4b4ccb){_0x4b4ccb=_0x4b4ccb||0xcc;return function(_0x3c03c2){if(_0x3c03c2){return _0x444885[_0xaf2e('0x1a')](_0x4b4ccb);}return _0x444885[_0xaf2e('0x1b')](_0x4b4ccb)[_0xaf2e('0x1c')]();};}function respondWithResult(_0x593fc9,_0x5f1e52){_0x5f1e52=_0x5f1e52||0xc8;return function(_0x374c40){if(_0x374c40){return _0x593fc9[_0xaf2e('0x1b')](_0x5f1e52)[_0xaf2e('0x1d')](_0x374c40);}};}function respondWithFilteredResult(_0x348fb9,_0x58afe6){return function(_0x8c67b2){if(_0x8c67b2){var _0x330cab=typeof _0x58afe6[_0xaf2e('0x1e')]===_0xaf2e('0x1f')&&typeof _0x58afe6[_0xaf2e('0x20')]===_0xaf2e('0x1f');var _0x2e40ee=_0x8c67b2[_0xaf2e('0x21')];var _0x251387=_0x330cab?0x0:_0x58afe6['offset'];var _0x479a91=_0x330cab?_0x8c67b2[_0xaf2e('0x21')]:_0x58afe6['offset']+_0x58afe6[_0xaf2e('0x20')];var _0x22e243;if(_0x479a91>=_0x2e40ee){_0x479a91=_0x2e40ee;_0x22e243=0xc8;}else{_0x22e243=0xce;}_0x348fb9[_0xaf2e('0x1b')](_0x22e243);return _0x348fb9[_0xaf2e('0x22')](_0xaf2e('0x23'),_0x251387+'-'+_0x479a91+'/'+_0x2e40ee)[_0xaf2e('0x1d')](_0x8c67b2);}return null;};}function patchUpdates(_0x349b10){return function(_0x5af1df){try{jsonpatch[_0xaf2e('0x24')](_0x5af1df,_0x349b10,!![]);}catch(_0x4357b8){return BPromise['reject'](_0x4357b8);}return _0x5af1df[_0xaf2e('0x25')]();};}function saveUpdates(_0x40c3f9,_0x501943){return function(_0x530390){if(_0x530390){return _0x530390[_0xaf2e('0x26')](_0x40c3f9)['then'](function(_0x5e3fa8){return _0x5e3fa8;});}return null;};}function removeEntity(_0xa92a7e,_0x237727){return function(_0x1243da){if(_0x1243da){return _0x1243da['destroy']()[_0xaf2e('0x27')](function(){_0xa92a7e[_0xaf2e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1d6f,_0x581b86){return function(_0x426020){if(!_0x426020){_0x4b1d6f['sendStatus'](0x194);}return _0x426020;};}function handleError(_0x53690d,_0x441af2){_0x441af2=_0x441af2||0x1f4;return function(_0xc3875){logger[_0xaf2e('0x28')](_0xc3875[_0xaf2e('0x29')]);if(_0xc3875['name']){delete _0xc3875['name'];}_0x53690d[_0xaf2e('0x1b')](_0x441af2)[_0xaf2e('0x2a')](_0xc3875);};}exports[_0xaf2e('0x2b')]=function(_0x57fd5e,_0x16520b){var _0x236352={},_0x5f5341={},_0x4a7135={'count':0x0,'rows':[]};var _0x49709a=_[_0xaf2e('0x2c')](db[_0xaf2e('0x2d')][_0xaf2e('0x2e')],function(_0x1235da){return{'name':_0x1235da[_0xaf2e('0x2f')],'type':_0x1235da[_0xaf2e('0x30')][_0xaf2e('0x31')]};});_0x5f5341[_0xaf2e('0x32')]=_[_0xaf2e('0x2c')](_0x49709a,_0xaf2e('0x33'));_0x5f5341[_0xaf2e('0x34')]=_[_0xaf2e('0x35')](_0x57fd5e['query']);_0x5f5341[_0xaf2e('0x36')]=_['intersection'](_0x5f5341[_0xaf2e('0x32')],_0x5f5341[_0xaf2e('0x34')]);_0x236352[_0xaf2e('0x37')]=_[_0xaf2e('0x38')](_0x5f5341[_0xaf2e('0x32')],qs['fields'](_0x57fd5e[_0xaf2e('0x34')]['fields']));_0x236352[_0xaf2e('0x37')]=_0x236352[_0xaf2e('0x37')]['length']?_0x236352[_0xaf2e('0x37')]:_0x5f5341[_0xaf2e('0x32')];if(!_0x57fd5e[_0xaf2e('0x34')][_0xaf2e('0x39')](_0xaf2e('0x3a'))){_0x236352[_0xaf2e('0x20')]=qs[_0xaf2e('0x20')](_0x57fd5e[_0xaf2e('0x34')][_0xaf2e('0x20')]);_0x236352[_0xaf2e('0x1e')]=qs['offset'](_0x57fd5e[_0xaf2e('0x34')][_0xaf2e('0x1e')]);}_0x236352[_0xaf2e('0x3b')]=qs[_0xaf2e('0x3c')](_0x57fd5e['query'][_0xaf2e('0x3c')]);_0x236352[_0xaf2e('0x3d')]=qs['filters'](_[_0xaf2e('0x3e')](_0x57fd5e['query'],_0x5f5341[_0xaf2e('0x36')]),_0x49709a);if(_0x57fd5e[_0xaf2e('0x34')][_0xaf2e('0x3f')]){_0x236352[_0xaf2e('0x3d')]=_['merge'](_0x236352['where'],{'$or':_[_0xaf2e('0x2c')](_0x49709a,function(_0x22f4e3){if(_0x22f4e3[_0xaf2e('0x30')]!=='VIRTUAL'){var _0x413c10={};_0x413c10[_0x22f4e3['name']]={'$like':'%'+_0x57fd5e['query'][_0xaf2e('0x3f')]+'%'};return _0x413c10;}})});}_0x236352=_[_0xaf2e('0x40')]({},_0x236352,_0x57fd5e[_0xaf2e('0x41')]);var _0x3ebc43={'where':_0x236352['where']};return db[_0xaf2e('0x2d')][_0xaf2e('0x21')](_0x3ebc43)[_0xaf2e('0x27')](function(_0x5ad65c){_0x4a7135[_0xaf2e('0x21')]=_0x5ad65c;if(_0x57fd5e[_0xaf2e('0x34')][_0xaf2e('0x42')]){_0x236352['include']=[{'all':!![]}];}return db[_0xaf2e('0x2d')][_0xaf2e('0x43')](_0x236352);})[_0xaf2e('0x27')](function(_0x53ceab){_0x4a7135['rows']=_0x53ceab;return _0x4a7135;})['then'](respondWithFilteredResult(_0x16520b,_0x236352))[_0xaf2e('0x44')](handleError(_0x16520b,null));};exports[_0xaf2e('0x45')]=function(_0x292537,_0x3a1970){var _0x51bdb9={'raw':!![],'where':{'id':_0x292537[_0xaf2e('0x46')]['id']}},_0x2f98d7={};_0x2f98d7[_0xaf2e('0x32')]=_['keys'](db[_0xaf2e('0x2d')][_0xaf2e('0x2e')]);_0x2f98d7[_0xaf2e('0x34')]=_[_0xaf2e('0x35')](_0x292537[_0xaf2e('0x34')]);_0x2f98d7['filters']=_[_0xaf2e('0x38')](_0x2f98d7[_0xaf2e('0x32')],_0x2f98d7[_0xaf2e('0x34')]);_0x51bdb9['attributes']=_[_0xaf2e('0x38')](_0x2f98d7[_0xaf2e('0x32')],qs['fields'](_0x292537[_0xaf2e('0x34')]['fields']));_0x51bdb9[_0xaf2e('0x37')]=_0x51bdb9[_0xaf2e('0x37')][_0xaf2e('0x47')]?_0x51bdb9[_0xaf2e('0x37')]:_0x2f98d7['model'];if(_0x292537[_0xaf2e('0x34')]['includeAll']){_0x51bdb9['include']=[{'all':!![]}];}_0x51bdb9=_[_0xaf2e('0x40')]({},_0x51bdb9,_0x292537['options']);return db[_0xaf2e('0x2d')][_0xaf2e('0x48')](_0x51bdb9)[_0xaf2e('0x27')](handleEntityNotFound(_0x3a1970,null))[_0xaf2e('0x27')](respondWithResult(_0x3a1970,null))['catch'](handleError(_0x3a1970,null));};exports[_0xaf2e('0x49')]=function(_0x420420,_0x3598c7){return db[_0xaf2e('0x2d')]['create'](_0x420420[_0xaf2e('0x4a')],{})[_0xaf2e('0x27')](respondWithResult(_0x3598c7,0xc9))['catch'](handleError(_0x3598c7,null));};exports['update']=function(_0xbd9246,_0x4d72dc){if(_0xbd9246['body']['id']){delete _0xbd9246[_0xaf2e('0x4a')]['id'];}return db[_0xaf2e('0x2d')][_0xaf2e('0x48')]({'where':{'id':_0xbd9246[_0xaf2e('0x46')]['id']}})[_0xaf2e('0x27')](handleEntityNotFound(_0x4d72dc,null))[_0xaf2e('0x27')](saveUpdates(_0xbd9246[_0xaf2e('0x4a')],null))['then'](respondWithResult(_0x4d72dc,null))[_0xaf2e('0x44')](handleError(_0x4d72dc,null));};exports['destroy']=function(_0x1db1f1,_0x47db80){return db[_0xaf2e('0x2d')][_0xaf2e('0x48')]({'where':{'id':_0x1db1f1[_0xaf2e('0x46')]['id']}})[_0xaf2e('0x27')](handleEntityNotFound(_0x47db80,null))[_0xaf2e('0x27')](removeEntity(_0x47db80,null))[_0xaf2e('0x44')](handleError(_0x47db80,null));};exports[_0xaf2e('0x4b')]=function(_0x56cfbb,_0x167f66){return db[_0xaf2e('0x2d')][_0xaf2e('0x4b')]()[_0xaf2e('0x27')](respondWithResult(_0x167f66,null))['catch'](handleError(_0x167f66,null));}; \ No newline at end of file +var _0x83ff=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','json','reject','save','update','then','destroy','error','stack','name','status','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','JscriptyQuestionReport','count','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x83ff,0x7c));var _0xf83f=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x83ff[_0x4e6ae6];return _0x23c108;};'use strict';var emlformat=require(_0xf83f('0x0'));var rimraf=require(_0xf83f('0x1'));var zipdir=require(_0xf83f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf83f('0x3'));var util=require(_0xf83f('0x4'));var path=require('path');var sox=require(_0xf83f('0x5'));var csv=require(_0xf83f('0x6'));var ejs=require(_0xf83f('0x7'));var fs=require('fs');var fs_extra=require(_0xf83f('0x8'));var _=require(_0xf83f('0x9'));var squel=require('squel');var crypto=require(_0xf83f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf83f('0x6'));var querystring=require(_0xf83f('0xb'));var Papa=require(_0xf83f('0xc'));var Redis=require(_0xf83f('0xd'));var authService=require(_0xf83f('0xe'));var qs=require(_0xf83f('0xf'));var as=require(_0xf83f('0x10'));var hardwareService=require(_0xf83f('0x11'));var logger=require(_0xf83f('0x12'))(_0xf83f('0x13'));var utils=require(_0xf83f('0x14'));var config=require(_0xf83f('0x15'));var licenseUtil=require(_0xf83f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x324353,_0x1e7ea5){_0x1e7ea5=_0x1e7ea5||0xcc;return function(_0x34271f){if(_0x34271f){return _0x324353[_0xf83f('0x17')](_0x1e7ea5);}return _0x324353['status'](_0x1e7ea5)[_0xf83f('0x18')]();};}function respondWithResult(_0x29f5ad,_0x431473){_0x431473=_0x431473||0xc8;return function(_0x29afbd){if(_0x29afbd){return _0x29f5ad['status'](_0x431473)['json'](_0x29afbd);}};}function respondWithFilteredResult(_0x385c78,_0x44a397){return function(_0x17e7cf){if(_0x17e7cf){var _0x135164=typeof _0x44a397[_0xf83f('0x19')]===_0xf83f('0x1a')&&typeof _0x44a397[_0xf83f('0x1b')]==='undefined';var _0x3e3a82=_0x17e7cf['count'];var _0x51e571=_0x135164?0x0:_0x44a397[_0xf83f('0x19')];var _0x350dfa=_0x135164?_0x17e7cf['count']:_0x44a397[_0xf83f('0x19')]+_0x44a397[_0xf83f('0x1b')];var _0x28e911;if(_0x350dfa>=_0x3e3a82){_0x350dfa=_0x3e3a82;_0x28e911=0xc8;}else{_0x28e911=0xce;}_0x385c78['status'](_0x28e911);return _0x385c78['set']('Content-Range',_0x51e571+'-'+_0x350dfa+'/'+_0x3e3a82)[_0xf83f('0x1c')](_0x17e7cf);}return null;};}function patchUpdates(_0x3006f8){return function(_0xfc49b0){try{jsonpatch['apply'](_0xfc49b0,_0x3006f8,!![]);}catch(_0x5ab886){return BPromise[_0xf83f('0x1d')](_0x5ab886);}return _0xfc49b0[_0xf83f('0x1e')]();};}function saveUpdates(_0x24c82d,_0x1ebaab){return function(_0x271b21){if(_0x271b21){return _0x271b21[_0xf83f('0x1f')](_0x24c82d)[_0xf83f('0x20')](function(_0x43e99c){return _0x43e99c;});}return null;};}function removeEntity(_0x3a8fb4,_0x136e22){return function(_0x46b426){if(_0x46b426){return _0x46b426[_0xf83f('0x21')]()[_0xf83f('0x20')](function(){_0x3a8fb4['status'](0xcc)[_0xf83f('0x18')]();});}};}function handleEntityNotFound(_0x4e0ccd,_0x2bf840){return function(_0x464443){if(!_0x464443){_0x4e0ccd[_0xf83f('0x17')](0x194);}return _0x464443;};}function handleError(_0x1621e7,_0x4b7a94){_0x4b7a94=_0x4b7a94||0x1f4;return function(_0x4a0815){logger[_0xf83f('0x22')](_0x4a0815[_0xf83f('0x23')]);if(_0x4a0815[_0xf83f('0x24')]){delete _0x4a0815['name'];}_0x1621e7[_0xf83f('0x25')](_0x4b7a94)[_0xf83f('0x26')](_0x4a0815);};}exports[_0xf83f('0x27')]=function(_0x42e9b2,_0x1d7ea5){var _0x11faa8={},_0x404ec0={},_0xb3b52c={'count':0x0,'rows':[]};var _0x1943bf=_[_0xf83f('0x28')](db['JscriptyQuestionReport'][_0xf83f('0x29')],function(_0x5e8eaf){return{'name':_0x5e8eaf[_0xf83f('0x2a')],'type':_0x5e8eaf[_0xf83f('0x2b')][_0xf83f('0x2c')]};});_0x404ec0[_0xf83f('0x2d')]=_[_0xf83f('0x28')](_0x1943bf,_0xf83f('0x24'));_0x404ec0['query']=_[_0xf83f('0x2e')](_0x42e9b2[_0xf83f('0x2f')]);_0x404ec0['filters']=_[_0xf83f('0x30')](_0x404ec0[_0xf83f('0x2d')],_0x404ec0[_0xf83f('0x2f')]);_0x11faa8[_0xf83f('0x31')]=_['intersection'](_0x404ec0[_0xf83f('0x2d')],qs[_0xf83f('0x32')](_0x42e9b2[_0xf83f('0x2f')]['fields']));_0x11faa8[_0xf83f('0x31')]=_0x11faa8[_0xf83f('0x31')][_0xf83f('0x33')]?_0x11faa8[_0xf83f('0x31')]:_0x404ec0[_0xf83f('0x2d')];if(!_0x42e9b2[_0xf83f('0x2f')][_0xf83f('0x34')]('nolimit')){_0x11faa8['limit']=qs[_0xf83f('0x1b')](_0x42e9b2[_0xf83f('0x2f')][_0xf83f('0x1b')]);_0x11faa8[_0xf83f('0x19')]=qs[_0xf83f('0x19')](_0x42e9b2[_0xf83f('0x2f')][_0xf83f('0x19')]);}_0x11faa8['order']=qs[_0xf83f('0x35')](_0x42e9b2[_0xf83f('0x2f')]['sort']);_0x11faa8[_0xf83f('0x36')]=qs[_0xf83f('0x37')](_['pick'](_0x42e9b2['query'],_0x404ec0['filters']),_0x1943bf);if(_0x42e9b2[_0xf83f('0x2f')][_0xf83f('0x38')]){_0x11faa8['where']=_[_0xf83f('0x39')](_0x11faa8[_0xf83f('0x36')],{'$or':_['map'](_0x1943bf,function(_0x1f691c){if(_0x1f691c[_0xf83f('0x2b')]!==_0xf83f('0x3a')){var _0xbcee6b={};_0xbcee6b[_0x1f691c[_0xf83f('0x24')]]={'$like':'%'+_0x42e9b2[_0xf83f('0x2f')][_0xf83f('0x38')]+'%'};return _0xbcee6b;}})});}_0x11faa8=_['merge']({},_0x11faa8,_0x42e9b2[_0xf83f('0x3b')]);var _0x223a18={'where':_0x11faa8[_0xf83f('0x36')]};return db[_0xf83f('0x3c')][_0xf83f('0x3d')](_0x223a18)[_0xf83f('0x20')](function(_0x317c0){_0xb3b52c[_0xf83f('0x3d')]=_0x317c0;if(_0x42e9b2['query'][_0xf83f('0x3e')]){_0x11faa8[_0xf83f('0x3f')]=[{'all':!![]}];}return db[_0xf83f('0x3c')]['findAll'](_0x11faa8);})[_0xf83f('0x20')](function(_0x25a275){_0xb3b52c[_0xf83f('0x40')]=_0x25a275;return _0xb3b52c;})[_0xf83f('0x20')](respondWithFilteredResult(_0x1d7ea5,_0x11faa8))[_0xf83f('0x41')](handleError(_0x1d7ea5,null));};exports['show']=function(_0xfb88e,_0x368ac1){var _0x128bf6={'raw':!![],'where':{'id':_0xfb88e[_0xf83f('0x42')]['id']}},_0x30e20a={};_0x30e20a[_0xf83f('0x2d')]=_[_0xf83f('0x2e')](db[_0xf83f('0x3c')]['rawAttributes']);_0x30e20a[_0xf83f('0x2f')]=_['keys'](_0xfb88e['query']);_0x30e20a[_0xf83f('0x37')]=_[_0xf83f('0x30')](_0x30e20a[_0xf83f('0x2d')],_0x30e20a[_0xf83f('0x2f')]);_0x128bf6[_0xf83f('0x31')]=_['intersection'](_0x30e20a[_0xf83f('0x2d')],qs[_0xf83f('0x32')](_0xfb88e[_0xf83f('0x2f')][_0xf83f('0x32')]));_0x128bf6['attributes']=_0x128bf6[_0xf83f('0x31')]['length']?_0x128bf6[_0xf83f('0x31')]:_0x30e20a[_0xf83f('0x2d')];if(_0xfb88e['query'][_0xf83f('0x3e')]){_0x128bf6[_0xf83f('0x3f')]=[{'all':!![]}];}_0x128bf6=_[_0xf83f('0x39')]({},_0x128bf6,_0xfb88e[_0xf83f('0x3b')]);return db[_0xf83f('0x3c')][_0xf83f('0x43')](_0x128bf6)['then'](handleEntityNotFound(_0x368ac1,null))[_0xf83f('0x20')](respondWithResult(_0x368ac1,null))['catch'](handleError(_0x368ac1,null));};exports['create']=function(_0x2b310a,_0x5369cd){return db[_0xf83f('0x3c')][_0xf83f('0x44')](_0x2b310a[_0xf83f('0x45')],{})[_0xf83f('0x20')](respondWithResult(_0x5369cd,0xc9))[_0xf83f('0x41')](handleError(_0x5369cd,null));};exports[_0xf83f('0x1f')]=function(_0xc1c3fb,_0x51ce30){if(_0xc1c3fb[_0xf83f('0x45')]['id']){delete _0xc1c3fb[_0xf83f('0x45')]['id'];}return db['JscriptyQuestionReport'][_0xf83f('0x43')]({'where':{'id':_0xc1c3fb[_0xf83f('0x42')]['id']}})[_0xf83f('0x20')](handleEntityNotFound(_0x51ce30,null))[_0xf83f('0x20')](saveUpdates(_0xc1c3fb['body'],null))[_0xf83f('0x20')](respondWithResult(_0x51ce30,null))[_0xf83f('0x41')](handleError(_0x51ce30,null));};exports[_0xf83f('0x21')]=function(_0x5a3d1e,_0x46485d){return db[_0xf83f('0x3c')][_0xf83f('0x43')]({'where':{'id':_0x5a3d1e[_0xf83f('0x42')]['id']}})[_0xf83f('0x20')](handleEntityNotFound(_0x46485d,null))[_0xf83f('0x20')](removeEntity(_0x46485d,null))[_0xf83f('0x41')](handleError(_0x46485d,null));};exports[_0xf83f('0x46')]=function(_0x6b3d5a,_0x2257db){return db[_0xf83f('0x3c')][_0xf83f('0x46')]()['then'](respondWithResult(_0x2257db,null))['catch'](handleError(_0x2257db,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d11ab5c..3691bfa 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 _0xa363=['path','rimraf','define','JscriptyQuestionReport','lodash','moment','bluebird','request-promise'];(function(_0x200276,_0x10724d){var _0x44c773=function(_0x958cc9){while(--_0x958cc9){_0x200276['push'](_0x200276['shift']());}};_0x44c773(++_0x10724d);}(_0xa363,0xa4));var _0x3a36=function(_0x26dff3,_0x153176){_0x26dff3=_0x26dff3-0x0;var _0x5425ec=_0xa363[_0x26dff3];return _0x5425ec;};'use strict';var _=require(_0x3a36('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3a36('0x1'));var BPromise=require(_0x3a36('0x2'));var rp=require(_0x3a36('0x3'));var fs=require('fs');var path=require(_0x3a36('0x4'));var rimraf=require(_0x3a36('0x5'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x271a6c,_0x47ec18){return _0x271a6c[_0x3a36('0x6')](_0x3a36('0x7'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd5=['../../config/logger','api','moment','bluebird','request-promise','path','define','report_jscripty_questions','lodash'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x0cd5,0xe9));var _0x50cd=function(_0x2ba054,_0x4cfa79){_0x2ba054=_0x2ba054-0x0;var _0x5d2153=_0x0cd5[_0x2ba054];return _0x5d2153;};'use strict';var _=require(_0x50cd('0x0'));var util=require('util');var logger=require(_0x50cd('0x1'))(_0x50cd('0x2'));var moment=require(_0x50cd('0x3'));var BPromise=require(_0x50cd('0x4'));var rp=require(_0x50cd('0x5'));var fs=require('fs');var path=require(_0x50cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x5c1e87,_0x28a400){return _0x5c1e87[_0x50cd('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0x50cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 13bd90a..7260fdd 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 _0xe74b=['JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x54a6f5,_0x45f860){var _0x2db454=function(_0x28015e){while(--_0x28015e){_0x54a6f5['push'](_0x54a6f5['shift']());}};_0x2db454(++_0x45f860);}(_0xe74b,0x1a9));var _0xbe74=function(_0x10610a,_0x4837e5){_0x10610a=_0x10610a-0x0;var _0x44bd4d=_0xe74b[_0x10610a];return _0x44bd4d;};'use strict';var _=require('lodash');var util=require(_0xbe74('0x0'));var moment=require(_0xbe74('0x1'));var BPromise=require(_0xbe74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe74('0x3'));var db=require(_0xbe74('0x4'))['db'];var utils=require(_0xbe74('0x5'));var logger=require(_0xbe74('0x6'))(_0xbe74('0x7'));var config=require(_0xbe74('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbe74('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe884ad,_0x5cf1da,_0x36cabb){return new BPromise(function(_0xf7dcdb,_0x3e9c7b){return client['request'](_0xe884ad,_0x36cabb)[_0xbe74('0xa')](function(_0x446991){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5cf1da,_0xbe74('0xb'));logger[_0xbe74('0xc')](_0xbe74('0xd'),_0x5cf1da,_0xbe74('0xb'),JSON[_0xbe74('0xe')](_0x446991));if(_0x446991['error']){if(_0x446991[_0xbe74('0xf')]['code']===0x1f4){logger[_0xbe74('0xf')](_0xbe74('0x10'),_0x5cf1da,_0x446991[_0xbe74('0xf')][_0xbe74('0x11')]);return _0x3e9c7b(_0x446991[_0xbe74('0xf')]['message']);}logger[_0xbe74('0xf')](_0xbe74('0x10'),_0x5cf1da,_0x446991[_0xbe74('0xf')][_0xbe74('0x11')]);return _0xf7dcdb(_0x446991['error'][_0xbe74('0x11')]);}else{logger[_0xbe74('0x12')](_0xbe74('0x10'),_0x5cf1da,'request\x20sent');_0xf7dcdb(_0x446991[_0xbe74('0x13')][_0xbe74('0x11')]);}})[_0xbe74('0x14')](function(_0x56a9a1){logger[_0xbe74('0xf')](_0xbe74('0x10'),_0x5cf1da,_0x56a9a1);_0x3e9c7b(_0x56a9a1);});});} \ No newline at end of file +var _0xbccb=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0xbccb,0xc9));var _0xbbcc=function(_0x527c39,_0x3ea2a6){_0x527c39=_0x527c39-0x0;var _0x3f4dd6=_0xbccb[_0x527c39];return _0x3f4dd6;};'use strict';var _=require(_0xbbcc('0x0'));var util=require(_0xbbcc('0x1'));var moment=require(_0xbbcc('0x2'));var BPromise=require(_0xbbcc('0x3'));var rs=require(_0xbbcc('0x4'));var fs=require('fs');var Redis=require(_0xbbcc('0x5'));var db=require(_0xbbcc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbcc('0x7'))('rpc');var config=require(_0xbbcc('0x8'));var jayson=require(_0xbbcc('0x9'));var client=jayson[_0xbbcc('0xa')][_0xbbcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b121a,_0x1e126d,_0x4e19ac){return new BPromise(function(_0x5aa5e6,_0x16a043){return client[_0xbbcc('0xc')](_0x5b121a,_0x4e19ac)['then'](function(_0xc97cff){logger[_0xbbcc('0xd')](_0xbbcc('0xe'),_0x1e126d,_0xbbcc('0xf'));logger[_0xbbcc('0x10')](_0xbbcc('0x11'),_0x1e126d,_0xbbcc('0xf'),JSON[_0xbbcc('0x12')](_0xc97cff));if(_0xc97cff['error']){if(_0xc97cff[_0xbbcc('0x13')][_0xbbcc('0x14')]===0x1f4){logger[_0xbbcc('0x13')](_0xbbcc('0xe'),_0x1e126d,_0xc97cff[_0xbbcc('0x13')]['message']);return _0x16a043(_0xc97cff[_0xbbcc('0x13')][_0xbbcc('0x15')]);}logger[_0xbbcc('0x13')](_0xbbcc('0xe'),_0x1e126d,_0xc97cff[_0xbbcc('0x13')][_0xbbcc('0x15')]);return _0x5aa5e6(_0xc97cff['error'][_0xbbcc('0x15')]);}else{logger[_0xbbcc('0xd')](_0xbbcc('0xe'),_0x1e126d,_0xbbcc('0xf'));_0x5aa5e6(_0xc97cff[_0xbbcc('0x16')][_0xbbcc('0x15')]);}})[_0xbbcc('0x17')](function(_0x5a6230){logger['error'](_0xbbcc('0xe'),_0x1e126d,_0x5a6230);_0x16a043(_0x5a6230);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 96fc4d9..9176696 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 _0x066e=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','post','create','put','update'];(function(_0x5486d6,_0x4ef5e7){var _0x4a9e6d=function(_0x5788b7){while(--_0x5788b7){_0x5486d6['push'](_0x5486d6['shift']());}};_0x4a9e6d(++_0x4ef5e7);}(_0x066e,0xf5));var _0xe066=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x066e[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require(_0xe066('0x0'));var util=require(_0xe066('0x1'));var path=require(_0xe066('0x2'));var timeout=require(_0xe066('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe066('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe066('0x5'));var controller=require(_0xe066('0x6'));router[_0xe066('0x7')]('/',auth[_0xe066('0x8')](),controller[_0xe066('0x9')]);router[_0xe066('0x7')](_0xe066('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xe066('0xb'),auth[_0xe066('0x8')](),controller[_0xe066('0xc')]);router[_0xe066('0x7')](_0xe066('0xd'),auth['isAuthenticated'](),controller[_0xe066('0xe')]);router[_0xe066('0xf')]('/',auth[_0xe066('0x8')](),controller[_0xe066('0x10')]);router[_0xe066('0x11')](_0xe066('0xb'),auth[_0xe066('0x8')](),controller[_0xe066('0x12')]);router[_0xe066('0x13')](_0xe066('0xb'),auth[_0xe066('0x8')](),controller[_0xe066('0x14')]);module[_0xe066('0x15')]=router; \ No newline at end of file +var _0xe96f=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/questions','getQuestions','post','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1843c0,_0x19f8f4){var _0x2b488a=function(_0x1728f5){while(--_0x1728f5){_0x1843c0['push'](_0x1843c0['shift']());}};_0x2b488a(++_0x19f8f4);}(_0xe96f,0x13b));var _0xfe96=function(_0x3615e2,_0xa5890f){_0x3615e2=_0x3615e2-0x0;var _0x2fe119=_0xe96f[_0x3615e2];return _0x2fe119;};'use strict';var multer=require('multer');var util=require(_0xfe96('0x0'));var path=require(_0xfe96('0x1'));var timeout=require(_0xfe96('0x2'));var express=require(_0xfe96('0x3'));var router=express[_0xfe96('0x4')]();var fs_extra=require(_0xfe96('0x5'));var auth=require(_0xfe96('0x6'));var interaction=require(_0xfe96('0x7'));var config=require(_0xfe96('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xfe96('0x9')]('/',auth[_0xfe96('0xa')](),controller['index']);router[_0xfe96('0x9')](_0xfe96('0xb'),auth[_0xfe96('0xa')](),controller[_0xfe96('0xc')]);router[_0xfe96('0x9')](_0xfe96('0xd'),auth[_0xfe96('0xa')](),controller['show']);router[_0xfe96('0x9')](_0xfe96('0xe'),auth[_0xfe96('0xa')](),controller[_0xfe96('0xf')]);router[_0xfe96('0x10')]('/',auth[_0xfe96('0xa')](),controller['create']);router[_0xfe96('0x11')](_0xfe96('0xd'),auth['isAuthenticated'](),controller[_0xfe96('0x12')]);router['delete'](_0xfe96('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index cea3a30..397f2f9 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 _0x45a4=['format','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0x45a4,0xf3));var _0x445a=function(_0x39a39b,_0x18fccf){_0x39a39b=_0x39a39b-0x0;var _0x38dfdc=_0x45a4[_0x39a39b];return _0x38dfdc;};'use strict';var moment=require(_0x445a('0x0'));var Sequelize=require(_0x445a('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x445a('0x2')],'set':function(_0x30f8a7){this[_0x445a('0x3')](_0x445a('0x4'),_0x30f8a7);this[_0x445a('0x3')]('endtime',moment()[_0x445a('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x445a('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x445a('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x445a('0x6')]},'completed':{'type':Sequelize[_0x445a('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9861=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','setDataValue'];(function(_0x5ad5a1,_0x1d0842){var _0xb1a068=function(_0x5a4228){while(--_0x5a4228){_0x5ad5a1['push'](_0x5ad5a1['shift']());}};_0xb1a068(++_0x1d0842);}(_0x9861,0x1f1));var _0x1986=function(_0x253c96,_0x17c2a7){_0x253c96=_0x253c96-0x0;var _0x21ee93=_0x9861[_0x253c96];return _0x21ee93;};'use strict';var moment=require(_0x1986('0x0'));var Sequelize=require(_0x1986('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5d833d){this[_0x1986('0x2')](_0x1986('0x3'),_0x5d833d);this[_0x1986('0x2')](_0x1986('0x4'),moment()[_0x1986('0x5')](_0x1986('0x6')));}},'endtime':{'type':Sequelize[_0x1986('0x7')]},'membername':{'type':Sequelize[_0x1986('0x8')]},'projectname':{'type':Sequelize[_0x1986('0x8')]},'queue':{'type':Sequelize[_0x1986('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x1986('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e71d242..1535cb9 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 _0x10bf=['include','eml-format','rimraf','request-promise','moment','util','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x10bf,0x135));var _0xf10b=function(_0x7564d,_0x40270f){_0x7564d=_0x7564d-0x0;var _0x1e520d=_0x10bf[_0x7564d];return _0x1e520d;};'use strict';var emlformat=require(_0xf10b('0x0'));var rimraf=require(_0xf10b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf10b('0x2'));var moment=require(_0xf10b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf10b('0x4'));var path=require('path');var sox=require(_0xf10b('0x5'));var csv=require('to-csv');var ejs=require(_0xf10b('0x6'));var fs=require('fs');var fs_extra=require(_0xf10b('0x7'));var _=require('lodash');var squel=require(_0xf10b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf10b('0x9'));var toCsv=require(_0xf10b('0xa'));var querystring=require(_0xf10b('0xb'));var Papa=require('papaparse');var Redis=require(_0xf10b('0xc'));var authService=require(_0xf10b('0xd'));var qs=require(_0xf10b('0xe'));var as=require(_0xf10b('0xf'));var hardwareService=require(_0xf10b('0x10'));var logger=require(_0xf10b('0x11'))(_0xf10b('0x12'));var utils=require(_0xf10b('0x13'));var config=require(_0xf10b('0x14'));var licenseUtil=require(_0xf10b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2828d0,_0x396c2a){_0x396c2a=_0x396c2a||0xcc;return function(_0x22269c){if(_0x22269c){return _0x2828d0[_0xf10b('0x16')](_0x396c2a);}return _0x2828d0[_0xf10b('0x17')](_0x396c2a)[_0xf10b('0x18')]();};}function respondWithResult(_0x58685a,_0x340bcd){_0x340bcd=_0x340bcd||0xc8;return function(_0x61aa88){if(_0x61aa88){return _0x58685a[_0xf10b('0x17')](_0x340bcd)[_0xf10b('0x19')](_0x61aa88);}};}function respondWithFilteredResult(_0x562026,_0x2fcc59){return function(_0x2774bb){if(_0x2774bb){var _0x51d102=typeof _0x2fcc59[_0xf10b('0x1a')]===_0xf10b('0x1b')&&typeof _0x2fcc59[_0xf10b('0x1c')]==='undefined';var _0x365bc8=_0x2774bb[_0xf10b('0x1d')];var _0x2281df=_0x51d102?0x0:_0x2fcc59[_0xf10b('0x1a')];var _0xd33290=_0x51d102?_0x2774bb[_0xf10b('0x1d')]:_0x2fcc59['offset']+_0x2fcc59[_0xf10b('0x1c')];var _0x25ebe3;if(_0xd33290>=_0x365bc8){_0xd33290=_0x365bc8;_0x25ebe3=0xc8;}else{_0x25ebe3=0xce;}_0x562026[_0xf10b('0x17')](_0x25ebe3);return _0x562026[_0xf10b('0x1e')]('Content-Range',_0x2281df+'-'+_0xd33290+'/'+_0x365bc8)[_0xf10b('0x19')](_0x2774bb);}return null;};}function patchUpdates(_0x56cd3b){return function(_0x51673f){try{jsonpatch[_0xf10b('0x1f')](_0x51673f,_0x56cd3b,!![]);}catch(_0xcd8a3){return BPromise[_0xf10b('0x20')](_0xcd8a3);}return _0x51673f['save']();};}function saveUpdates(_0x391b37,_0x29911e){return function(_0x85478c){if(_0x85478c){return _0x85478c[_0xf10b('0x21')](_0x391b37)[_0xf10b('0x22')](function(_0x56e8c6){return _0x56e8c6;});}return null;};}function removeEntity(_0x34f95a,_0x2768f8){return function(_0x19384d){if(_0x19384d){return _0x19384d['destroy']()[_0xf10b('0x22')](function(){_0x34f95a[_0xf10b('0x17')](0xcc)[_0xf10b('0x18')]();});}};}function handleEntityNotFound(_0x371856,_0x4a48d7){return function(_0x584ef8){if(!_0x584ef8){_0x371856[_0xf10b('0x16')](0x194);}return _0x584ef8;};}function handleError(_0x43c107,_0x4655bb){_0x4655bb=_0x4655bb||0x1f4;return function(_0x525395){logger[_0xf10b('0x23')](_0x525395['stack']);if(_0x525395[_0xf10b('0x24')]){delete _0x525395[_0xf10b('0x24')];}_0x43c107[_0xf10b('0x17')](_0x4655bb)[_0xf10b('0x25')](_0x525395);};}exports[_0xf10b('0x26')]=function(_0x35eda8,_0x441035){var _0x352900={},_0x4597d8={},_0x52ae6c={'count':0x0,'rows':[]};var _0x4f427d=_[_0xf10b('0x27')](db[_0xf10b('0x28')][_0xf10b('0x29')],function(_0x32f733){return{'name':_0x32f733[_0xf10b('0x2a')],'type':_0x32f733[_0xf10b('0x2b')][_0xf10b('0x2c')]};});_0x4597d8[_0xf10b('0x2d')]=_[_0xf10b('0x27')](_0x4f427d,_0xf10b('0x24'));_0x4597d8[_0xf10b('0x2e')]=_[_0xf10b('0x2f')](_0x35eda8[_0xf10b('0x2e')]);_0x4597d8['filters']=_[_0xf10b('0x30')](_0x4597d8['model'],_0x4597d8[_0xf10b('0x2e')]);_0x352900['attributes']=_[_0xf10b('0x30')](_0x4597d8[_0xf10b('0x2d')],qs[_0xf10b('0x31')](_0x35eda8['query'][_0xf10b('0x31')]));_0x352900[_0xf10b('0x32')]=_0x352900[_0xf10b('0x32')][_0xf10b('0x33')]?_0x352900['attributes']:_0x4597d8['model'];if(!_0x35eda8[_0xf10b('0x2e')][_0xf10b('0x34')](_0xf10b('0x35'))){_0x352900[_0xf10b('0x1c')]=qs[_0xf10b('0x1c')](_0x35eda8['query'][_0xf10b('0x1c')]);_0x352900[_0xf10b('0x1a')]=qs[_0xf10b('0x1a')](_0x35eda8[_0xf10b('0x2e')][_0xf10b('0x1a')]);}_0x352900[_0xf10b('0x36')]=qs[_0xf10b('0x37')](_0x35eda8[_0xf10b('0x2e')][_0xf10b('0x37')]);_0x352900['where']=qs[_0xf10b('0x38')](_[_0xf10b('0x39')](_0x35eda8[_0xf10b('0x2e')],_0x4597d8[_0xf10b('0x38')]),_0x4f427d);if(_0x35eda8['query'][_0xf10b('0x3a')]){_0x352900[_0xf10b('0x3b')]=_[_0xf10b('0x3c')](_0x352900[_0xf10b('0x3b')],{'$or':_[_0xf10b('0x27')](_0x4f427d,function(_0x38a79e){if(_0x38a79e[_0xf10b('0x2b')]!==_0xf10b('0x3d')){var _0x4c713c={};_0x4c713c[_0x38a79e['name']]={'$like':'%'+_0x35eda8[_0xf10b('0x2e')][_0xf10b('0x3a')]+'%'};return _0x4c713c;}})});}_0x352900=_[_0xf10b('0x3c')]({},_0x352900,_0x35eda8[_0xf10b('0x3e')]);var _0x2f995c={'where':_0x352900[_0xf10b('0x3b')]};return db['JscriptySessionReport'][_0xf10b('0x1d')](_0x2f995c)[_0xf10b('0x22')](function(_0xb6fda6){_0x52ae6c[_0xf10b('0x1d')]=_0xb6fda6;if(_0x35eda8[_0xf10b('0x2e')][_0xf10b('0x3f')]){_0x352900['include']=[{'all':!![]}];}return db[_0xf10b('0x28')]['findAll'](_0x352900);})['then'](function(_0x1aa414){_0x52ae6c[_0xf10b('0x40')]=_0x1aa414;return _0x52ae6c;})[_0xf10b('0x22')](respondWithFilteredResult(_0x441035,_0x352900))['catch'](handleError(_0x441035,null));};exports[_0xf10b('0x41')]=function(_0x11be4a,_0x486c57){var _0x21c418={'raw':!![],'where':{'id':_0x11be4a[_0xf10b('0x42')]['id']}},_0x195139={};_0x195139['model']=_[_0xf10b('0x2f')](db[_0xf10b('0x28')][_0xf10b('0x29')]);_0x195139[_0xf10b('0x2e')]=_[_0xf10b('0x2f')](_0x11be4a[_0xf10b('0x2e')]);_0x195139[_0xf10b('0x38')]=_[_0xf10b('0x30')](_0x195139['model'],_0x195139[_0xf10b('0x2e')]);_0x21c418[_0xf10b('0x32')]=_[_0xf10b('0x30')](_0x195139[_0xf10b('0x2d')],qs['fields'](_0x11be4a['query'][_0xf10b('0x31')]));_0x21c418[_0xf10b('0x32')]=_0x21c418['attributes'][_0xf10b('0x33')]?_0x21c418[_0xf10b('0x32')]:_0x195139[_0xf10b('0x2d')];if(_0x11be4a['query']['includeAll']){_0x21c418['include']=[{'all':!![]}];}_0x21c418=_[_0xf10b('0x3c')]({},_0x21c418,_0x11be4a['options']);return db[_0xf10b('0x28')][_0xf10b('0x43')](_0x21c418)['then'](handleEntityNotFound(_0x486c57,null))[_0xf10b('0x22')](respondWithResult(_0x486c57,null))[_0xf10b('0x44')](handleError(_0x486c57,null));};exports[_0xf10b('0x45')]=function(_0x25e484,_0x4d480a){return db[_0xf10b('0x28')][_0xf10b('0x45')](_0x25e484[_0xf10b('0x46')],{})[_0xf10b('0x22')](respondWithResult(_0x4d480a,0xc9))[_0xf10b('0x44')](handleError(_0x4d480a,null));};exports[_0xf10b('0x21')]=function(_0x4141e0,_0x4f183e){if(_0x4141e0['body']['id']){delete _0x4141e0[_0xf10b('0x46')]['id'];}return db[_0xf10b('0x28')][_0xf10b('0x43')]({'where':{'id':_0x4141e0[_0xf10b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f183e,null))['then'](saveUpdates(_0x4141e0[_0xf10b('0x46')],null))[_0xf10b('0x22')](respondWithResult(_0x4f183e,null))[_0xf10b('0x44')](handleError(_0x4f183e,null));};exports['destroy']=function(_0x3ac48e,_0x53de96){return db[_0xf10b('0x28')][_0xf10b('0x43')]({'where':{'id':_0x3ac48e[_0xf10b('0x42')]['id']}})[_0xf10b('0x22')](handleEntityNotFound(_0x53de96,null))['then'](removeEntity(_0x53de96,null))[_0xf10b('0x44')](handleError(_0x53de96,null));};exports[_0xf10b('0x47')]=function(_0x4fb802,_0x23fc86){return db[_0xf10b('0x28')]['describe']()[_0xf10b('0x22')](respondWithResult(_0x23fc86,null))['catch'](handleError(_0x23fc86,null));};exports[_0xf10b('0x48')]=function(_0x40d0d5,_0x3aeba5,_0x4fa19b){var _0x1fa5b0={'raw':!![],'where':{}};var _0x33d68b={};var _0x2ec056={'count':0x0,'rows':[]};return db[_0xf10b('0x28')][_0xf10b('0x49')]({'where':{'id':_0x40d0d5[_0xf10b('0x42')]['id']}})[_0xf10b('0x22')](handleEntityNotFound(_0x3aeba5,null))[_0xf10b('0x22')](function(_0x5bcd86){if(_0x5bcd86){_0x33d68b[_0xf10b('0x2d')]=_[_0xf10b('0x2f')](db[_0xf10b('0x4a')]['rawAttributes']);_0x33d68b[_0xf10b('0x2e')]=_[_0xf10b('0x2f')](_0x40d0d5[_0xf10b('0x2e')]);_0x33d68b[_0xf10b('0x38')]=_[_0xf10b('0x30')](_0x33d68b[_0xf10b('0x2d')],_0x33d68b[_0xf10b('0x2e')]);_0x1fa5b0[_0xf10b('0x32')]=_['intersection'](_0x33d68b[_0xf10b('0x2d')],qs[_0xf10b('0x31')](_0x40d0d5[_0xf10b('0x2e')][_0xf10b('0x31')]));_0x1fa5b0[_0xf10b('0x32')]=_0x1fa5b0[_0xf10b('0x32')][_0xf10b('0x33')]?_0x1fa5b0[_0xf10b('0x32')]:_0x33d68b['model'];if(!_0x40d0d5[_0xf10b('0x2e')]['hasOwnProperty']('nolimit')){_0x1fa5b0[_0xf10b('0x1c')]=qs['limit'](_0x40d0d5[_0xf10b('0x2e')][_0xf10b('0x1c')]);_0x1fa5b0[_0xf10b('0x1a')]=qs['offset'](_0x40d0d5[_0xf10b('0x2e')][_0xf10b('0x1a')]);}_0x1fa5b0[_0xf10b('0x36')]=qs[_0xf10b('0x37')](_0x40d0d5['query']['sort']);_0x1fa5b0[_0xf10b('0x3b')]=qs[_0xf10b('0x38')](_[_0xf10b('0x39')](_0x40d0d5[_0xf10b('0x2e')],_0x33d68b['filters']));_0x1fa5b0[_0xf10b('0x3b')][_0xf10b('0x4b')]=_0x5bcd86['id'];if(_0x40d0d5[_0xf10b('0x2e')][_0xf10b('0x3a')]){_0x1fa5b0[_0xf10b('0x3b')]=_['merge'](_0x1fa5b0['where'],{'$or':_['map'](_0x1fa5b0[_0xf10b('0x32')],function(_0x378d0d){var _0x4fc7c6={};_0x4fc7c6[_0x378d0d]={'$like':'%'+_0x40d0d5[_0xf10b('0x2e')]['filter']+'%'};return _0x4fc7c6;})});}_0x1fa5b0=_[_0xf10b('0x3c')]({},_0x1fa5b0,_0x40d0d5[_0xf10b('0x3e')]);return db[_0xf10b('0x4a')][_0xf10b('0x1d')]({'where':_0x1fa5b0[_0xf10b('0x3b')]})['then'](function(_0x22de02){_0x2ec056['count']=_0x22de02;if(_0x40d0d5[_0xf10b('0x2e')]['includeAll']){_0x1fa5b0[_0xf10b('0x4c')]=[{'all':!![]}];}return db[_0xf10b('0x4a')]['findAll'](_0x1fa5b0);})[_0xf10b('0x22')](function(_0x2cd261){_0x2ec056[_0xf10b('0x40')]=_0x2cd261;return _0x2ec056;});}})[_0xf10b('0x22')](respondWithFilteredResult(_0x3aeba5,_0x1fa5b0))[_0xf10b('0x44')](handleError(_0x3aeba5,null));}; \ No newline at end of file +var _0x016c=['sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','describe','findOne','JscriptyQuestionReport','length','order','SessionId','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x016c,0x157));var _0xc016=function(_0x2ceb49,_0x2c1410){_0x2ceb49=_0x2ceb49-0x0;var _0x542361=_0x016c[_0x2ceb49];return _0x542361;};'use strict';var emlformat=require(_0xc016('0x0'));var rimraf=require(_0xc016('0x1'));var zipdir=require(_0xc016('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc016('0x3'));var moment=require(_0xc016('0x4'));var BPromise=require(_0xc016('0x5'));var Mustache=require(_0xc016('0x6'));var util=require(_0xc016('0x7'));var path=require(_0xc016('0x8'));var sox=require(_0xc016('0x9'));var csv=require(_0xc016('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc016('0xb'));var _=require(_0xc016('0xc'));var squel=require(_0xc016('0xd'));var crypto=require(_0xc016('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc016('0xa'));var querystring=require('querystring');var Papa=require(_0xc016('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc016('0x10'));var as=require(_0xc016('0x11'));var hardwareService=require(_0xc016('0x12'));var logger=require(_0xc016('0x13'))(_0xc016('0x14'));var utils=require(_0xc016('0x15'));var config=require(_0xc016('0x16'));var licenseUtil=require(_0xc016('0x17'));var db=require(_0xc016('0x18'))['db'];function respondWithStatusCode(_0x251e67,_0x5ecc93){_0x5ecc93=_0x5ecc93||0xcc;return function(_0x5bd80f){if(_0x5bd80f){return _0x251e67[_0xc016('0x19')](_0x5ecc93);}return _0x251e67[_0xc016('0x1a')](_0x5ecc93)[_0xc016('0x1b')]();};}function respondWithResult(_0x2fc2ac,_0x1ed6bd){_0x1ed6bd=_0x1ed6bd||0xc8;return function(_0x23671f){if(_0x23671f){return _0x2fc2ac['status'](_0x1ed6bd)[_0xc016('0x1c')](_0x23671f);}};}function respondWithFilteredResult(_0x3a6be6,_0xd2a9c2){return function(_0x30d614){if(_0x30d614){var _0x5a832f=typeof _0xd2a9c2[_0xc016('0x1d')]===_0xc016('0x1e')&&typeof _0xd2a9c2[_0xc016('0x1f')]===_0xc016('0x1e');var _0x3d85a8=_0x30d614[_0xc016('0x20')];var _0x5c93b6=_0x5a832f?0x0:_0xd2a9c2[_0xc016('0x1d')];var _0x2ac1f7=_0x5a832f?_0x30d614[_0xc016('0x20')]:_0xd2a9c2[_0xc016('0x1d')]+_0xd2a9c2[_0xc016('0x1f')];var _0x5d72e3;if(_0x2ac1f7>=_0x3d85a8){_0x2ac1f7=_0x3d85a8;_0x5d72e3=0xc8;}else{_0x5d72e3=0xce;}_0x3a6be6['status'](_0x5d72e3);return _0x3a6be6['set'](_0xc016('0x21'),_0x5c93b6+'-'+_0x2ac1f7+'/'+_0x3d85a8)['json'](_0x30d614);}return null;};}function patchUpdates(_0xeba30d){return function(_0x46b6a4){try{jsonpatch['apply'](_0x46b6a4,_0xeba30d,!![]);}catch(_0x6e8bbb){return BPromise['reject'](_0x6e8bbb);}return _0x46b6a4[_0xc016('0x22')]();};}function saveUpdates(_0x366f84,_0x4ad9f8){return function(_0x40fc71){if(_0x40fc71){return _0x40fc71['update'](_0x366f84)['then'](function(_0x261166){return _0x261166;});}return null;};}function removeEntity(_0x51bda3,_0x55d65e){return function(_0x24b028){if(_0x24b028){return _0x24b028[_0xc016('0x23')]()[_0xc016('0x24')](function(){_0x51bda3[_0xc016('0x1a')](0xcc)[_0xc016('0x1b')]();});}};}function handleEntityNotFound(_0x2a067d,_0x5e1a0f){return function(_0x3cee1c){if(!_0x3cee1c){_0x2a067d[_0xc016('0x19')](0x194);}return _0x3cee1c;};}function handleError(_0x316795,_0x22dcc3){_0x22dcc3=_0x22dcc3||0x1f4;return function(_0x910d8d){logger[_0xc016('0x25')](_0x910d8d[_0xc016('0x26')]);if(_0x910d8d[_0xc016('0x27')]){delete _0x910d8d['name'];}_0x316795[_0xc016('0x1a')](_0x22dcc3)[_0xc016('0x28')](_0x910d8d);};}exports[_0xc016('0x29')]=function(_0x316b62,_0x3dfdf5){var _0x4fab6d={},_0x5a65a1={},_0x1343d5={'count':0x0,'rows':[]};var _0x16327d=_[_0xc016('0x2a')](db[_0xc016('0x2b')][_0xc016('0x2c')],function(_0x25fbe7){return{'name':_0x25fbe7[_0xc016('0x2d')],'type':_0x25fbe7[_0xc016('0x2e')][_0xc016('0x2f')]};});_0x5a65a1[_0xc016('0x30')]=_['map'](_0x16327d,_0xc016('0x27'));_0x5a65a1['query']=_[_0xc016('0x31')](_0x316b62[_0xc016('0x32')]);_0x5a65a1[_0xc016('0x33')]=_[_0xc016('0x34')](_0x5a65a1[_0xc016('0x30')],_0x5a65a1['query']);_0x4fab6d['attributes']=_[_0xc016('0x34')](_0x5a65a1['model'],qs[_0xc016('0x35')](_0x316b62[_0xc016('0x32')]['fields']));_0x4fab6d[_0xc016('0x36')]=_0x4fab6d[_0xc016('0x36')]['length']?_0x4fab6d[_0xc016('0x36')]:_0x5a65a1[_0xc016('0x30')];if(!_0x316b62[_0xc016('0x32')][_0xc016('0x37')](_0xc016('0x38'))){_0x4fab6d['limit']=qs[_0xc016('0x1f')](_0x316b62[_0xc016('0x32')][_0xc016('0x1f')]);_0x4fab6d[_0xc016('0x1d')]=qs[_0xc016('0x1d')](_0x316b62[_0xc016('0x32')]['offset']);}_0x4fab6d['order']=qs[_0xc016('0x39')](_0x316b62['query'][_0xc016('0x39')]);_0x4fab6d['where']=qs[_0xc016('0x33')](_[_0xc016('0x3a')](_0x316b62[_0xc016('0x32')],_0x5a65a1[_0xc016('0x33')]),_0x16327d);if(_0x316b62[_0xc016('0x32')][_0xc016('0x3b')]){_0x4fab6d[_0xc016('0x3c')]=_[_0xc016('0x3d')](_0x4fab6d[_0xc016('0x3c')],{'$or':_[_0xc016('0x2a')](_0x16327d,function(_0x597997){if(_0x597997[_0xc016('0x2e')]!==_0xc016('0x3e')){var _0xcc9f27={};_0xcc9f27[_0x597997[_0xc016('0x27')]]={'$like':'%'+_0x316b62['query']['filter']+'%'};return _0xcc9f27;}})});}_0x4fab6d=_[_0xc016('0x3d')]({},_0x4fab6d,_0x316b62[_0xc016('0x3f')]);var _0x49703c={'where':_0x4fab6d['where']};return db[_0xc016('0x2b')][_0xc016('0x20')](_0x49703c)[_0xc016('0x24')](function(_0x437494){_0x1343d5['count']=_0x437494;if(_0x316b62[_0xc016('0x32')][_0xc016('0x40')]){_0x4fab6d[_0xc016('0x41')]=[{'all':!![]}];}return db[_0xc016('0x2b')]['findAll'](_0x4fab6d);})[_0xc016('0x24')](function(_0x1580cc){_0x1343d5[_0xc016('0x42')]=_0x1580cc;return _0x1343d5;})[_0xc016('0x24')](respondWithFilteredResult(_0x3dfdf5,_0x4fab6d))[_0xc016('0x43')](handleError(_0x3dfdf5,null));};exports[_0xc016('0x44')]=function(_0x35d115,_0x352547){var _0x304726={'raw':!![],'where':{'id':_0x35d115[_0xc016('0x45')]['id']}},_0x128d7e={};_0x128d7e['model']=_[_0xc016('0x31')](db[_0xc016('0x2b')][_0xc016('0x2c')]);_0x128d7e[_0xc016('0x32')]=_['keys'](_0x35d115['query']);_0x128d7e[_0xc016('0x33')]=_[_0xc016('0x34')](_0x128d7e[_0xc016('0x30')],_0x128d7e[_0xc016('0x32')]);_0x304726[_0xc016('0x36')]=_[_0xc016('0x34')](_0x128d7e[_0xc016('0x30')],qs[_0xc016('0x35')](_0x35d115[_0xc016('0x32')][_0xc016('0x35')]));_0x304726[_0xc016('0x36')]=_0x304726['attributes']['length']?_0x304726[_0xc016('0x36')]:_0x128d7e['model'];if(_0x35d115['query'][_0xc016('0x40')]){_0x304726['include']=[{'all':!![]}];}_0x304726=_[_0xc016('0x3d')]({},_0x304726,_0x35d115['options']);return db[_0xc016('0x2b')]['find'](_0x304726)[_0xc016('0x24')](handleEntityNotFound(_0x352547,null))[_0xc016('0x24')](respondWithResult(_0x352547,null))[_0xc016('0x43')](handleError(_0x352547,null));};exports['create']=function(_0x4bbc4c,_0x5484ac){return db[_0xc016('0x2b')][_0xc016('0x46')](_0x4bbc4c['body'],{})[_0xc016('0x24')](respondWithResult(_0x5484ac,0xc9))[_0xc016('0x43')](handleError(_0x5484ac,null));};exports['update']=function(_0x1c513d,_0x16ddee){if(_0x1c513d[_0xc016('0x47')]['id']){delete _0x1c513d[_0xc016('0x47')]['id'];}return db[_0xc016('0x2b')][_0xc016('0x48')]({'where':{'id':_0x1c513d[_0xc016('0x45')]['id']}})[_0xc016('0x24')](handleEntityNotFound(_0x16ddee,null))[_0xc016('0x24')](saveUpdates(_0x1c513d[_0xc016('0x47')],null))[_0xc016('0x24')](respondWithResult(_0x16ddee,null))[_0xc016('0x43')](handleError(_0x16ddee,null));};exports[_0xc016('0x23')]=function(_0xa06f49,_0x36769c){return db[_0xc016('0x2b')][_0xc016('0x48')]({'where':{'id':_0xa06f49[_0xc016('0x45')]['id']}})[_0xc016('0x24')](handleEntityNotFound(_0x36769c,null))[_0xc016('0x24')](removeEntity(_0x36769c,null))[_0xc016('0x43')](handleError(_0x36769c,null));};exports[_0xc016('0x49')]=function(_0x219c79,_0x1885ec){return db['JscriptySessionReport'][_0xc016('0x49')]()['then'](respondWithResult(_0x1885ec,null))[_0xc016('0x43')](handleError(_0x1885ec,null));};exports['getQuestions']=function(_0x54f446,_0x149b79,_0x3e2387){var _0x50ef41={'raw':!![],'where':{}};var _0x483347={};var _0x221b33={'count':0x0,'rows':[]};return db[_0xc016('0x2b')][_0xc016('0x4a')]({'where':{'id':_0x54f446[_0xc016('0x45')]['id']}})[_0xc016('0x24')](handleEntityNotFound(_0x149b79,null))[_0xc016('0x24')](function(_0x55a01e){if(_0x55a01e){_0x483347[_0xc016('0x30')]=_[_0xc016('0x31')](db[_0xc016('0x4b')][_0xc016('0x2c')]);_0x483347[_0xc016('0x32')]=_[_0xc016('0x31')](_0x54f446[_0xc016('0x32')]);_0x483347[_0xc016('0x33')]=_[_0xc016('0x34')](_0x483347[_0xc016('0x30')],_0x483347[_0xc016('0x32')]);_0x50ef41[_0xc016('0x36')]=_[_0xc016('0x34')](_0x483347['model'],qs['fields'](_0x54f446[_0xc016('0x32')][_0xc016('0x35')]));_0x50ef41['attributes']=_0x50ef41[_0xc016('0x36')][_0xc016('0x4c')]?_0x50ef41['attributes']:_0x483347['model'];if(!_0x54f446[_0xc016('0x32')]['hasOwnProperty'](_0xc016('0x38'))){_0x50ef41[_0xc016('0x1f')]=qs[_0xc016('0x1f')](_0x54f446[_0xc016('0x32')][_0xc016('0x1f')]);_0x50ef41[_0xc016('0x1d')]=qs['offset'](_0x54f446[_0xc016('0x32')][_0xc016('0x1d')]);}_0x50ef41[_0xc016('0x4d')]=qs[_0xc016('0x39')](_0x54f446['query'][_0xc016('0x39')]);_0x50ef41[_0xc016('0x3c')]=qs[_0xc016('0x33')](_[_0xc016('0x3a')](_0x54f446[_0xc016('0x32')],_0x483347[_0xc016('0x33')]));_0x50ef41[_0xc016('0x3c')][_0xc016('0x4e')]=_0x55a01e['id'];if(_0x54f446[_0xc016('0x32')][_0xc016('0x3b')]){_0x50ef41['where']=_[_0xc016('0x3d')](_0x50ef41[_0xc016('0x3c')],{'$or':_[_0xc016('0x2a')](_0x50ef41['attributes'],function(_0x4cf4c5){var _0x2e0764={};_0x2e0764[_0x4cf4c5]={'$like':'%'+_0x54f446[_0xc016('0x32')][_0xc016('0x3b')]+'%'};return _0x2e0764;})});}_0x50ef41=_[_0xc016('0x3d')]({},_0x50ef41,_0x54f446['options']);return db[_0xc016('0x4b')][_0xc016('0x20')]({'where':_0x50ef41[_0xc016('0x3c')]})[_0xc016('0x24')](function(_0x13a19b){_0x221b33['count']=_0x13a19b;if(_0x54f446['query'][_0xc016('0x40')]){_0x50ef41[_0xc016('0x41')]=[{'all':!![]}];}return db[_0xc016('0x4b')][_0xc016('0x4f')](_0x50ef41);})[_0xc016('0x24')](function(_0x2f2855){_0x221b33[_0xc016('0x42')]=_0x2f2855;return _0x221b33;});}})['then'](respondWithFilteredResult(_0x149b79,_0x50ef41))['catch'](handleError(_0x149b79,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ac624f7..a916f42 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 _0xeff8=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path'];(function(_0x1d5f41,_0x4cfe2c){var _0x4b2140=function(_0x266a6b){while(--_0x266a6b){_0x1d5f41['push'](_0x1d5f41['shift']());}};_0x4b2140(++_0x4cfe2c);}(_0xeff8,0x186));var _0x8eff=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xeff8[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash'];(function(_0x6f003b,_0x3386a0){var _0x178eee=function(_0x2dbfb5){while(--_0x2dbfb5){_0x6f003b['push'](_0x6f003b['shift']());}};_0x178eee(++_0x3386a0);}(_0xabce,0x103));var _0xeabc=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xabce[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xeabc('0x9'),'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 82e2910..526f61f 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 _0x5204=['rpc','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5204,0xdf));var _0x4520=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x5204[_0x30c2ae];return _0x1ee1cc;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file +var _0x4e2e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3fcfd5,_0x4532dc){var _0x5ee108=function(_0x1cfd65){while(--_0x1cfd65){_0x3fcfd5['push'](_0x3fcfd5['shift']());}};_0x5ee108(++_0x4532dc);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x5560ca,_0x4019b7){_0x5560ca=_0x5560ca-0x0;var _0x41bd55=_0x4e2e[_0x5560ca];return _0x41bd55;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 326a9b5..c57721e 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 _0x6003=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x6003,0x1d1));var _0x3600=function(_0x4b9fda,_0x4e7016){_0x4b9fda=_0x4b9fda-0x0;var _0x1d9415=_0x6003[_0x4b9fda];return _0x1d9415;};'use strict';var multer=require(_0x3600('0x0'));var util=require('util');var path=require(_0x3600('0x1'));var timeout=require(_0x3600('0x2'));var express=require(_0x3600('0x3'));var router=express[_0x3600('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3600('0x5'));var interaction=require(_0x3600('0x6'));var config=require('../../config/environment');var controller=require(_0x3600('0x7'));router[_0x3600('0x8')]('/',controller['index']);router[_0x3600('0x9')](_0x3600('0xa'),auth[_0x3600('0xb')](),controller[_0x3600('0xc')]);router['get'](_0x3600('0xd'),auth['isAuthenticated'](),controller[_0x3600('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8dcc=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer'];(function(_0x5c950f,_0x216bd2){var _0x5d2e74=function(_0x2c146c){while(--_0x2c146c){_0x5c950f['push'](_0x5c950f['shift']());}};_0x5d2e74(++_0x216bd2);}(_0x8dcc,0x1af));var _0xc8dc=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0x8dcc[_0x3beea0];return _0x314eb1;};'use strict';var multer=require(_0xc8dc('0x0'));var util=require(_0xc8dc('0x1'));var path=require(_0xc8dc('0x2'));var timeout=require(_0xc8dc('0x3'));var express=require(_0xc8dc('0x4'));var router=express[_0xc8dc('0x5')]();var fs_extra=require(_0xc8dc('0x6'));var auth=require(_0xc8dc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc8dc('0x8'));var controller=require(_0xc8dc('0x9'));router[_0xc8dc('0xa')]('/',controller[_0xc8dc('0xb')]);router[_0xc8dc('0xc')](_0xc8dc('0xd'),auth[_0xc8dc('0xe')](),controller['update']);router['get'](_0xc8dc('0xf'),auth[_0xc8dc('0xe')](),controller[_0xc8dc('0x10')]);module[_0xc8dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 5d11e67..c8f00cb 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 _0x0d8b=['TEXT','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d8b,0xab));var _0xb0d8=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x0d8b[_0x5a5395];return _0x4da43d;};'use strict';var Sequelize=require('sequelize');module[_0xb0d8('0x0')]={'license':{'type':Sequelize[_0xb0d8('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd25b=['exports','TEXT','STRING','sequelize'];(function(_0x1947f1,_0x4ccfdc){var _0xcd501f=function(_0x396efa){while(--_0x396efa){_0x1947f1['push'](_0x1947f1['shift']());}};_0xcd501f(++_0x4ccfdc);}(_0xd25b,0x16f));var _0xbd25=function(_0x206c5c,_0x4b257b){_0x206c5c=_0x206c5c-0x0;var _0x2b6302=_0xd25b[_0x206c5c];return _0x2b6302;};'use strict';var Sequelize=require(_0xbd25('0x0'));module[_0xbd25('0x1')]={'license':{'type':Sequelize[_0xbd25('0x2')]},'data1':{'type':Sequelize[_0xbd25('0x3')]},'data2':{'type':Sequelize[_0xbd25('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index f746224..7722dee 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 _0x18eb=['stack','send','index','keys','License','rawAttributes','query','filters','model','attributes','intersection','fields','length','merge','options','getLicense','then','catch','body','find','params','get','checkLicense','demo','downloadLogFile','license-info.log','join','/var','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','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','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error'];(function(_0x27d6ce,_0x2b665d){var _0x1dfd08=function(_0x4ea42d){while(--_0x4ea42d){_0x27d6ce['push'](_0x27d6ce['shift']());}};_0x1dfd08(++_0x2b665d);}(_0x18eb,0x1f0));var _0xb18e=function(_0x4d2f57,_0x126876){_0x4d2f57=_0x4d2f57-0x0;var _0x98fbe=_0x18eb[_0x4d2f57];return _0x98fbe;};'use strict';var emlformat=require(_0xb18e('0x0'));var rimraf=require(_0xb18e('0x1'));var zipdir=require(_0xb18e('0x2'));var jsonpatch=require(_0xb18e('0x3'));var rp=require(_0xb18e('0x4'));var moment=require(_0xb18e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb18e('0x6'));var util=require(_0xb18e('0x7'));var path=require(_0xb18e('0x8'));var sox=require(_0xb18e('0x9'));var csv=require('to-csv');var ejs=require(_0xb18e('0xa'));var fs=require('fs');var fs_extra=require(_0xb18e('0xb'));var _=require(_0xb18e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb18e('0xd'));var deskjs=require(_0xb18e('0xe'));var toCsv=require(_0xb18e('0xf'));var querystring=require(_0xb18e('0x10'));var Papa=require(_0xb18e('0x11'));var Redis=require(_0xb18e('0x12'));var authService=require(_0xb18e('0x13'));var qs=require(_0xb18e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb18e('0x15'));var logger=require(_0xb18e('0x16'))(_0xb18e('0x17'));var utils=require(_0xb18e('0x18'));var config=require(_0xb18e('0x19'));var licenseUtil=require(_0xb18e('0x1a'));var db=require(_0xb18e('0x1b'))['db'];function respondWithStatusCode(_0x2ee771,_0x54b05d){_0x54b05d=_0x54b05d||0xcc;return function(_0x2570ea){if(_0x2570ea){return _0x2ee771['sendStatus'](_0x54b05d);}return _0x2ee771[_0xb18e('0x1c')](_0x54b05d)[_0xb18e('0x1d')]();};}function respondWithResult(_0x46b947,_0xb04c38){_0xb04c38=_0xb04c38||0xc8;return function(_0x525bcf){if(_0x525bcf){return _0x46b947[_0xb18e('0x1c')](_0xb04c38)[_0xb18e('0x1e')](_0x525bcf);}};}function respondWithFilteredResult(_0x1ea41d,_0x576d6c){return function(_0x3da7a9){if(_0x3da7a9){var _0x389eb3=typeof _0x576d6c[_0xb18e('0x1f')]===_0xb18e('0x20')&&typeof _0x576d6c['limit']===_0xb18e('0x20');var _0x555971=_0x3da7a9[_0xb18e('0x21')];var _0x216b18=_0x389eb3?0x0:_0x576d6c[_0xb18e('0x1f')];var _0x286dff=_0x389eb3?_0x3da7a9[_0xb18e('0x21')]:_0x576d6c[_0xb18e('0x1f')]+_0x576d6c['limit'];var _0x238db5;if(_0x286dff>=_0x555971){_0x286dff=_0x555971;_0x238db5=0xc8;}else{_0x238db5=0xce;}_0x1ea41d['status'](_0x238db5);return _0x1ea41d[_0xb18e('0x22')](_0xb18e('0x23'),_0x216b18+'-'+_0x286dff+'/'+_0x555971)[_0xb18e('0x1e')](_0x3da7a9);}return null;};}function patchUpdates(_0x5ca8d0){return function(_0x187838){try{jsonpatch[_0xb18e('0x24')](_0x187838,_0x5ca8d0,!![]);}catch(_0x467819){return BPromise[_0xb18e('0x25')](_0x467819);}return _0x187838[_0xb18e('0x26')]();};}function saveUpdates(_0x16b442,_0x4ff0a6){return function(_0x3bdb94){if(_0x3bdb94){return _0x3bdb94[_0xb18e('0x27')](_0x16b442)['then'](function(_0x1a7888){return _0x1a7888;});}return null;};}function removeEntity(_0x55dc7a,_0x53be95){return function(_0x301f78){if(_0x301f78){return _0x301f78[_0xb18e('0x28')]()['then'](function(){_0x55dc7a['status'](0xcc)[_0xb18e('0x1d')]();});}};}function handleEntityNotFound(_0x4f87d4,_0x554738){return function(_0x1debe2){if(!_0x1debe2){_0x4f87d4[_0xb18e('0x29')](0x194);}return _0x1debe2;};}function handleError(_0x334959,_0x4be49b){_0x4be49b=_0x4be49b||0x1f4;return function(_0x2c7a84){logger[_0xb18e('0x2a')](_0x2c7a84[_0xb18e('0x2b')]);if(_0x2c7a84['name']){delete _0x2c7a84['name'];}_0x334959[_0xb18e('0x1c')](_0x4be49b)[_0xb18e('0x2c')](_0x2c7a84);};}var utilLicense=require(_0xb18e('0x1a'));exports[_0xb18e('0x2d')]=function(_0xa90fe,_0x503cbe){var _0x3f1889={'raw':!![],'where':{'id':0x1}},_0x54b7f7={};_0x54b7f7['model']=_[_0xb18e('0x2e')](db[_0xb18e('0x2f')][_0xb18e('0x30')]);_0x54b7f7[_0xb18e('0x31')]=_['keys'](_0xa90fe[_0xb18e('0x31')]);_0x54b7f7[_0xb18e('0x32')]=_['intersection'](_0x54b7f7[_0xb18e('0x33')],_0x54b7f7[_0xb18e('0x31')]);_0x3f1889[_0xb18e('0x34')]=_[_0xb18e('0x35')](_0x54b7f7[_0xb18e('0x33')],qs['fields'](_0xa90fe[_0xb18e('0x31')][_0xb18e('0x36')]));_0x3f1889['attributes']=_0x3f1889[_0xb18e('0x34')][_0xb18e('0x37')]?_0x3f1889[_0xb18e('0x34')]:_0x54b7f7[_0xb18e('0x33')];_0x3f1889=_[_0xb18e('0x38')]({},_0x3f1889,_0xa90fe[_0xb18e('0x39')]);return utilLicense[_0xb18e('0x3a')](_0x3f1889)[_0xb18e('0x3b')](respondWithResult(_0x503cbe,null))[_0xb18e('0x3c')](handleError(_0x503cbe,null));};exports[_0xb18e('0x27')]=function(_0x202389,_0x3deae5){if(_0x202389[_0xb18e('0x3d')]['id']){delete _0x202389[_0xb18e('0x3d')]['id'];}return db['License'][_0xb18e('0x3e')]({'where':{'id':_0x202389[_0xb18e('0x3f')]['id']}})[_0xb18e('0x3b')](handleEntityNotFound(_0x3deae5,null))[_0xb18e('0x3b')](function(_0xe0a24a){var _0x435d23=_0xe0a24a[_0xb18e('0x40')]({'plain':!![]});return utilLicense[_0xb18e('0x41')](_0x435d23,_0x202389[_0xb18e('0x3d')]['key']);})[_0xb18e('0x3b')](function(_0x364950){if(!_0x364950[_0xb18e('0x42')]){return saveUpdates(_0x202389[_0xb18e('0x3d')],null);}return _0x364950;})['then'](respondWithResult(_0x3deae5,null))['catch'](handleError(_0x3deae5,null));};exports[_0xb18e('0x43')]=function(_0x2a9feb,_0x4dc51c){var _0x177c94=_0xb18e('0x44');var _0x158560=path[_0xb18e('0x45')](_0xb18e('0x46'),'log',_0xb18e('0x47'),_0x177c94);_0x4dc51c['setHeader'](_0xb18e('0x48'),_0xb18e('0x49')+_0x177c94);_0x4dc51c['set'](_0xb18e('0x4a'),_0xb18e('0x4b'));_0x4dc51c[_0xb18e('0x4c')](_0x158560);}; \ No newline at end of file +var _0x083d=['License','rawAttributes','query','intersection','model','attributes','fields','merge','options','getLicense','catch','body','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','keys'];(function(_0x18cff5,_0x936d0){var _0xddaf1e=function(_0x502196){while(--_0x502196){_0x18cff5['push'](_0x18cff5['shift']());}};_0xddaf1e(++_0x936d0);}(_0x083d,0xec));var _0xd083=function(_0x2e52c5,_0x2cbde1){_0x2e52c5=_0x2e52c5-0x0;var _0x3ae965=_0x083d[_0x2e52c5];return _0x3ae965;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd083('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd083('0x1'));var rp=require(_0xd083('0x2'));var moment=require('moment');var BPromise=require(_0xd083('0x3'));var Mustache=require(_0xd083('0x4'));var util=require(_0xd083('0x5'));var path=require(_0xd083('0x6'));var sox=require(_0xd083('0x7'));var csv=require(_0xd083('0x8'));var ejs=require(_0xd083('0x9'));var fs=require('fs');var fs_extra=require(_0xd083('0xa'));var _=require(_0xd083('0xb'));var squel=require(_0xd083('0xc'));var crypto=require(_0xd083('0xd'));var jsforce=require(_0xd083('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd083('0x8'));var querystring=require(_0xd083('0xf'));var Papa=require(_0xd083('0x10'));var Redis=require(_0xd083('0x11'));var authService=require(_0xd083('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd083('0x13'));var hardwareService=require(_0xd083('0x14'));var logger=require(_0xd083('0x15'))('api');var utils=require(_0xd083('0x16'));var config=require(_0xd083('0x17'));var licenseUtil=require(_0xd083('0x18'));var db=require(_0xd083('0x19'))['db'];function respondWithStatusCode(_0x357a2d,_0x40ce9c){_0x40ce9c=_0x40ce9c||0xcc;return function(_0x5b40da){if(_0x5b40da){return _0x357a2d[_0xd083('0x1a')](_0x40ce9c);}return _0x357a2d['status'](_0x40ce9c)[_0xd083('0x1b')]();};}function respondWithResult(_0x46a4b5,_0x38feb6){_0x38feb6=_0x38feb6||0xc8;return function(_0x224016){if(_0x224016){return _0x46a4b5[_0xd083('0x1c')](_0x38feb6)['json'](_0x224016);}};}function respondWithFilteredResult(_0x1a0d79,_0x4dfc10){return function(_0x5d6b04){if(_0x5d6b04){var _0x3f5d47=typeof _0x4dfc10['offset']===_0xd083('0x1d')&&typeof _0x4dfc10['limit']===_0xd083('0x1d');var _0x5d110d=_0x5d6b04['count'];var _0x3b6923=_0x3f5d47?0x0:_0x4dfc10[_0xd083('0x1e')];var _0x290966=_0x3f5d47?_0x5d6b04['count']:_0x4dfc10['offset']+_0x4dfc10[_0xd083('0x1f')];var _0x1c0c43;if(_0x290966>=_0x5d110d){_0x290966=_0x5d110d;_0x1c0c43=0xc8;}else{_0x1c0c43=0xce;}_0x1a0d79['status'](_0x1c0c43);return _0x1a0d79[_0xd083('0x20')](_0xd083('0x21'),_0x3b6923+'-'+_0x290966+'/'+_0x5d110d)['json'](_0x5d6b04);}return null;};}function patchUpdates(_0x42a561){return function(_0x31cada){try{jsonpatch['apply'](_0x31cada,_0x42a561,!![]);}catch(_0x47fb0c){return BPromise[_0xd083('0x22')](_0x47fb0c);}return _0x31cada[_0xd083('0x23')]();};}function saveUpdates(_0x138bba,_0x287d23){return function(_0x39a111){if(_0x39a111){return _0x39a111[_0xd083('0x24')](_0x138bba)['then'](function(_0x384e65){return _0x384e65;});}return null;};}function removeEntity(_0x28d157,_0x98e967){return function(_0x1c8113){if(_0x1c8113){return _0x1c8113[_0xd083('0x25')]()[_0xd083('0x26')](function(){_0x28d157[_0xd083('0x1c')](0xcc)[_0xd083('0x1b')]();});}};}function handleEntityNotFound(_0x152a7d,_0x3548d8){return function(_0x4e96c3){if(!_0x4e96c3){_0x152a7d['sendStatus'](0x194);}return _0x4e96c3;};}function handleError(_0x54f65c,_0x44fddd){_0x44fddd=_0x44fddd||0x1f4;return function(_0x4a175d){logger[_0xd083('0x27')](_0x4a175d[_0xd083('0x28')]);if(_0x4a175d['name']){delete _0x4a175d[_0xd083('0x29')];}_0x54f65c[_0xd083('0x1c')](_0x44fddd)['send'](_0x4a175d);};}var utilLicense=require(_0xd083('0x18'));exports[_0xd083('0x2a')]=function(_0x3ba3fc,_0x11b4d9){var _0x2cb0c9={'raw':!![],'where':{'id':0x1}},_0x4e003c={};_0x4e003c['model']=_[_0xd083('0x2b')](db[_0xd083('0x2c')][_0xd083('0x2d')]);_0x4e003c[_0xd083('0x2e')]=_[_0xd083('0x2b')](_0x3ba3fc[_0xd083('0x2e')]);_0x4e003c['filters']=_[_0xd083('0x2f')](_0x4e003c[_0xd083('0x30')],_0x4e003c[_0xd083('0x2e')]);_0x2cb0c9[_0xd083('0x31')]=_[_0xd083('0x2f')](_0x4e003c[_0xd083('0x30')],qs[_0xd083('0x32')](_0x3ba3fc[_0xd083('0x2e')][_0xd083('0x32')]));_0x2cb0c9[_0xd083('0x31')]=_0x2cb0c9[_0xd083('0x31')]['length']?_0x2cb0c9[_0xd083('0x31')]:_0x4e003c[_0xd083('0x30')];_0x2cb0c9=_[_0xd083('0x33')]({},_0x2cb0c9,_0x3ba3fc[_0xd083('0x34')]);return utilLicense[_0xd083('0x35')](_0x2cb0c9)[_0xd083('0x26')](respondWithResult(_0x11b4d9,null))[_0xd083('0x36')](handleError(_0x11b4d9,null));};exports[_0xd083('0x24')]=function(_0x5358cc,_0x3f2553){if(_0x5358cc[_0xd083('0x37')]['id']){delete _0x5358cc[_0xd083('0x37')]['id'];}return db[_0xd083('0x2c')]['find']({'where':{'id':_0x5358cc['params']['id']}})['then'](handleEntityNotFound(_0x3f2553,null))['then'](function(_0x5bf9ff){var _0x1ea716=_0x5bf9ff[_0xd083('0x38')]({'plain':!![]});return utilLicense[_0xd083('0x39')](_0x1ea716,_0x5358cc['body'][_0xd083('0x3a')]);})[_0xd083('0x26')](function(_0x20f166){if(!_0x20f166[_0xd083('0x3b')]){return saveUpdates(_0x5358cc[_0xd083('0x37')],null);}return _0x20f166;})['then'](respondWithResult(_0x3f2553,null))[_0xd083('0x36')](handleError(_0x3f2553,null));};exports[_0xd083('0x3c')]=function(_0x120cbe,_0xee5a3e){var _0xf7b2e1=_0xd083('0x3d');var _0x339095=path[_0xd083('0x3e')](_0xd083('0x3f'),_0xd083('0x40'),_0xd083('0x41'),_0xf7b2e1);_0xee5a3e['setHeader']('Content-disposition',_0xd083('0x42')+_0xf7b2e1);_0xee5a3e[_0xd083('0x20')](_0xd083('0x43'),_0xd083('0x44'));_0xee5a3e[_0xd083('0x45')](_0x339095);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2f4b92c..a218c8e 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 _0x3ceb=['License','license','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x46ea96,_0x2ada2a){var _0x23be1a=function(_0x41fe97){while(--_0x41fe97){_0x46ea96['push'](_0x46ea96['shift']());}};_0x23be1a(++_0x2ada2a);}(_0x3ceb,0x183));var _0xb3ce=function(_0x1b4902,_0x516b9b){_0x1b4902=_0x1b4902-0x0;var _0x599720=_0x3ceb[_0x1b4902];return _0x599720;};'use strict';var _=require('lodash');var util=require(_0xb3ce('0x0'));var logger=require('../../config/logger')(_0xb3ce('0x1'));var moment=require(_0xb3ce('0x2'));var BPromise=require(_0xb3ce('0x3'));var rp=require(_0xb3ce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3ce('0x5'));var config=require(_0xb3ce('0x6'));var attributes=require('./license.attributes');module[_0xb3ce('0x7')]=function(_0x42a2d5,_0x38bb21){return _0x42a2d5[_0xb3ce('0x8')](_0xb3ce('0x9'),attributes,{'tableName':_0xb3ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0de7=['request-promise','path','rimraf','../../config/environment','./license.attributes','define','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x0de7,0xca));var _0x70de=function(_0xe32db,_0x2bde07){_0xe32db=_0xe32db-0x0;var _0x238889=_0x0de7[_0xe32db];return _0x238889;};'use strict';var _=require(_0x70de('0x0'));var util=require(_0x70de('0x1'));var logger=require(_0x70de('0x2'))(_0x70de('0x3'));var moment=require(_0x70de('0x4'));var BPromise=require(_0x70de('0x5'));var rp=require(_0x70de('0x6'));var fs=require('fs');var path=require(_0x70de('0x7'));var rimraf=require(_0x70de('0x8'));var config=require(_0x70de('0x9'));var attributes=require(_0x70de('0xa'));module['exports']=function(_0x21d4ad,_0x491ddd){return _0x21d4ad[_0x70de('0xb')]('License',attributes,{'tableName':_0x70de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index fcb5486..88a6183 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 _0xc665=['ioredis','../../mysqldb','../../config/utils','rpc','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xc665,0x160));var _0x5c66=function(_0x380ef7,_0x385df7){_0x380ef7=_0x380ef7-0x0;var _0x4be299=_0xc665[_0x380ef7];return _0x4be299;};'use strict';var _=require(_0x5c66('0x0'));var util=require(_0x5c66('0x1'));var moment=require(_0x5c66('0x2'));var BPromise=require(_0x5c66('0x3'));var rs=require(_0x5c66('0x4'));var fs=require('fs');var Redis=require(_0x5c66('0x5'));var db=require(_0x5c66('0x6'))['db'];var utils=require(_0x5c66('0x7'));var logger=require('../../config/logger')(_0x5c66('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5c66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a29fa,_0x2bf667,_0x140d01){return new BPromise(function(_0x1fd6d9,_0x22fdc1){return client['request'](_0x2a29fa,_0x140d01)[_0x5c66('0xa')](function(_0x49c3d7){logger[_0x5c66('0xb')](_0x5c66('0xc'),_0x2bf667,_0x5c66('0xd'));logger[_0x5c66('0xe')](_0x5c66('0xf'),_0x2bf667,_0x5c66('0xd'),JSON[_0x5c66('0x10')](_0x49c3d7));if(_0x49c3d7[_0x5c66('0x11')]){if(_0x49c3d7[_0x5c66('0x11')][_0x5c66('0x12')]===0x1f4){logger['error'](_0x5c66('0xc'),_0x2bf667,_0x49c3d7[_0x5c66('0x11')][_0x5c66('0x13')]);return _0x22fdc1(_0x49c3d7[_0x5c66('0x11')][_0x5c66('0x13')]);}logger['error']('License,\x20%s,\x20%s',_0x2bf667,_0x49c3d7[_0x5c66('0x11')]['message']);return _0x1fd6d9(_0x49c3d7[_0x5c66('0x11')]['message']);}else{logger[_0x5c66('0xb')](_0x5c66('0xc'),_0x2bf667,_0x5c66('0xd'));_0x1fd6d9(_0x49c3d7[_0x5c66('0x14')][_0x5c66('0x13')]);}})['catch'](function(_0x1aceb1){logger[_0x5c66('0x11')](_0x5c66('0xc'),_0x2bf667,_0x1aceb1);_0x22fdc1(_0x1aceb1);});});} \ No newline at end of file +var _0xeb81=['rpc','../../config/environment','jayson/promise','http','request','then','License,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x410489,_0x215fe3){var _0x451843=function(_0x117330){while(--_0x117330){_0x410489['push'](_0x410489['shift']());}};_0x451843(++_0x215fe3);}(_0xeb81,0xd4));var _0x1eb8=function(_0x6a2857,_0x507f15){_0x6a2857=_0x6a2857-0x0;var _0x32be04=_0xeb81[_0x6a2857];return _0x32be04;};'use strict';var _=require(_0x1eb8('0x0'));var util=require(_0x1eb8('0x1'));var moment=require(_0x1eb8('0x2'));var BPromise=require(_0x1eb8('0x3'));var rs=require(_0x1eb8('0x4'));var fs=require('fs');var Redis=require(_0x1eb8('0x5'));var db=require(_0x1eb8('0x6'))['db'];var utils=require(_0x1eb8('0x7'));var logger=require('../../config/logger')(_0x1eb8('0x8'));var config=require(_0x1eb8('0x9'));var jayson=require(_0x1eb8('0xa'));var client=jayson['client'][_0x1eb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6e7c97,_0x463e7a,_0xf59ea9){return new BPromise(function(_0x16e1eb,_0x5a69fa){return client[_0x1eb8('0xc')](_0x6e7c97,_0xf59ea9)[_0x1eb8('0xd')](function(_0x3e338e){logger['info'](_0x1eb8('0xe'),_0x463e7a,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x463e7a,_0x1eb8('0xf'),JSON[_0x1eb8('0x10')](_0x3e338e));if(_0x3e338e[_0x1eb8('0x11')]){if(_0x3e338e['error']['code']===0x1f4){logger['error'](_0x1eb8('0xe'),_0x463e7a,_0x3e338e[_0x1eb8('0x11')][_0x1eb8('0x12')]);return _0x5a69fa(_0x3e338e[_0x1eb8('0x11')][_0x1eb8('0x12')]);}logger['error']('License,\x20%s,\x20%s',_0x463e7a,_0x3e338e[_0x1eb8('0x11')][_0x1eb8('0x12')]);return _0x16e1eb(_0x3e338e[_0x1eb8('0x11')][_0x1eb8('0x12')]);}else{logger[_0x1eb8('0x13')](_0x1eb8('0xe'),_0x463e7a,_0x1eb8('0xf'));_0x16e1eb(_0x3e338e[_0x1eb8('0x14')][_0x1eb8('0x12')]);}})[_0x1eb8('0x15')](function(_0x27392a){logger['error']('License,\x20%s,\x20%s',_0x463e7a,_0x27392a);_0x5a69fa(_0x27392a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index eaa19f1..7963bcc 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 _0x7b0d=['index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/verify','verifySmtp','post','addDisposition','/:id/canned_answers','addAnswer','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated'];(function(_0x5e1592,_0x1dc178){var _0x2062b5=function(_0x1ba0ba){while(--_0x1ba0ba){_0x5e1592['push'](_0x5e1592['shift']());}};_0x2062b5(++_0x1dc178);}(_0x7b0d,0x89));var _0xd7b0=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7b0d[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0xd7b0('0x0'));var util=require('util');var path=require(_0xd7b0('0x1'));var timeout=require(_0xd7b0('0x2'));var express=require(_0xd7b0('0x3'));var router=express['Router']();var fs_extra=require(_0xd7b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd7b0('0x5'));var config=require(_0xd7b0('0x6'));var controller=require(_0xd7b0('0x7'));router[_0xd7b0('0x8')]('/',auth[_0xd7b0('0x9')](),controller[_0xd7b0('0xa')]);router['get'](_0xd7b0('0xb'),auth[_0xd7b0('0x9')](),controller['describe']);router[_0xd7b0('0x8')](_0xd7b0('0xc'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0xd')]);router[_0xd7b0('0x8')](_0xd7b0('0xe'),auth['isAuthenticated'](),controller[_0xd7b0('0xf')]);router[_0xd7b0('0x8')]('/:id/canned_answers',auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x10')]);router[_0xd7b0('0x8')](_0xd7b0('0x11'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x12')]);router[_0xd7b0('0x8')](_0xd7b0('0x13'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x14')]);router['get'](_0xd7b0('0x15'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x16')]);router[_0xd7b0('0x8')]('/:id/applications',auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x17')]);router['get'](_0xd7b0('0x18'),auth[_0xd7b0('0x9')](),controller['getMessages']);router[_0xd7b0('0x8')](_0xd7b0('0x19'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x1a')]);router['get']('/:id/users',auth[_0xd7b0('0x9')](),controller['getAgents']);router[_0xd7b0('0x1b')](_0xd7b0('0xe'),auth['isAuthenticated'](),controller[_0xd7b0('0x1c')]);router[_0xd7b0('0x1b')](_0xd7b0('0x1d'),auth['isAuthenticated'](),controller[_0xd7b0('0x1e')]);router[_0xd7b0('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd7b0('0x1b')]('/:id/in_servers',auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x1f')]);router['post'](_0xd7b0('0x13'),auth['isAuthenticated'](),controller[_0xd7b0('0x20')]);router[_0xd7b0('0x1b')](_0xd7b0('0x15'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x21')]);router['post'](_0xd7b0('0x22'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x23')]);router[_0xd7b0('0x1b')](_0xd7b0('0x24'),auth[_0xd7b0('0x9')](),controller['send']);router[_0xd7b0('0x1b')](_0xd7b0('0x25'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x26')]);router[_0xd7b0('0x27')]('/:id',auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x28')]);router[_0xd7b0('0x29')]('/:id/dispositions',auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x2a')]);router[_0xd7b0('0x29')](_0xd7b0('0x1d'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x2b')]);router['delete'](_0xd7b0('0x11'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x2c')]);router['delete'](_0xd7b0('0x13'),auth[_0xd7b0('0x9')](),controller[_0xd7b0('0x2d')]);router[_0xd7b0('0x29')](_0xd7b0('0xc'),auth['isAuthenticated'](),controller[_0xd7b0('0x2e')]);router[_0xd7b0('0x29')](_0xd7b0('0x25'),auth['isAuthenticated'](),controller[_0xd7b0('0x2f')]);module[_0xd7b0('0x30')]=router; \ No newline at end of file +var _0xb2e0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/out_servers','getSmtp','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/in_servers','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb2e0,0x193));var _0x0b2e=function(_0x49c14b,_0x60238f){_0x49c14b=_0x49c14b-0x0;var _0x1adf97=_0xb2e0[_0x49c14b];return _0x1adf97;};'use strict';var multer=require(_0x0b2e('0x0'));var util=require('util');var path=require(_0x0b2e('0x1'));var timeout=require(_0x0b2e('0x2'));var express=require(_0x0b2e('0x3'));var router=express[_0x0b2e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b2e('0x5'));var interaction=require(_0x0b2e('0x6'));var config=require(_0x0b2e('0x7'));var controller=require(_0x0b2e('0x8'));router[_0x0b2e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0b2e('0x9')](_0x0b2e('0xa'),auth[_0x0b2e('0xb')](),controller['describe']);router[_0x0b2e('0x9')](_0x0b2e('0xc'),auth[_0x0b2e('0xb')](),controller['show']);router[_0x0b2e('0x9')](_0x0b2e('0xd'),auth['isAuthenticated'](),controller[_0x0b2e('0xe')]);router[_0x0b2e('0x9')](_0x0b2e('0xf'),auth['isAuthenticated'](),controller[_0x0b2e('0x10')]);router[_0x0b2e('0x9')]('/:id/in_servers',auth[_0x0b2e('0xb')](),controller['getImap']);router[_0x0b2e('0x9')](_0x0b2e('0x11'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x12')]);router['get'](_0x0b2e('0x13'),auth[_0x0b2e('0xb')](),controller['getInteractions']);router[_0x0b2e('0x9')]('/:id/applications',auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x14')]);router['get'](_0x0b2e('0x15'),auth['isAuthenticated'](),controller[_0x0b2e('0x16')]);router[_0x0b2e('0x9')](_0x0b2e('0x17'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x18')]);router[_0x0b2e('0x9')](_0x0b2e('0x19'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x1a')]);router[_0x0b2e('0x1b')](_0x0b2e('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x0b2e('0x1b')]('/:id/canned_answers',auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x1c')]);router[_0x0b2e('0x1b')]('/',auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x1d')]);router['post'](_0x0b2e('0x1e'),auth[_0x0b2e('0xb')](),controller['addImap']);router[_0x0b2e('0x1b')](_0x0b2e('0x11'),auth[_0x0b2e('0xb')](),controller['addSmtp']);router['post'](_0x0b2e('0x13'),auth[_0x0b2e('0xb')](),controller['addInteraction']);router[_0x0b2e('0x1b')](_0x0b2e('0x1f'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x20')]);router[_0x0b2e('0x1b')](_0x0b2e('0x21'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x22')]);router[_0x0b2e('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0x0b2e('0x23')]);router[_0x0b2e('0x24')](_0x0b2e('0xc'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x25')]);router['delete'](_0x0b2e('0xd'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x26')]);router[_0x0b2e('0x27')](_0x0b2e('0xf'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x28')]);router[_0x0b2e('0x27')](_0x0b2e('0x1e'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x29')]);router[_0x0b2e('0x27')]('/:id/out_servers',auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x2a')]);router['delete'](_0x0b2e('0xc'),auth[_0x0b2e('0xb')](),controller[_0x0b2e('0x2b')]);router[_0x0b2e('0x27')]('/:id/users',auth[_0x0b2e('0xb')](),controller['removeAgents']);module[_0x0b2e('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4d6eaf9..527c9bc 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 _0x158c=['hotmail','yahoo','outlook365','getDataValue','custom','provider','sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','gmail'];(function(_0x21f13e,_0x2c7cda){var _0x7804d4=function(_0x261863){while(--_0x261863){_0x21f13e['push'](_0x21f13e['shift']());}};_0x7804d4(++_0x2c7cda);}(_0x158c,0xe3));var _0xc158=function(_0x12dd0b,_0x311e55){_0x12dd0b=_0x12dd0b-0x0;var _0x476d9a=_0x158c[_0x12dd0b];return _0x476d9a;};'use strict';var Sequelize=require(_0xc158('0x0'));module['exports']={'description':{'type':Sequelize[_0xc158('0x1')]},'name':{'type':Sequelize[_0xc158('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xc158('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc158('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc158('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc158('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xc158('0x3')]},'markAsUnread':{'type':Sequelize[_0xc158('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc158('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xc158('0x4')](0x2)[_0xc158('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc158('0x3')],'defaultValue':function(){return _0xc158('0x6');}},'notificationSound':{'type':Sequelize[_0xc158('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc158('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc158('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc158('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc158('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc158('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xc158('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xc158('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1dc2b7){if(!_0x1dc2b7)this[_0xc158('0x8')](_0xc158('0x9'),null);this[_0xc158('0x8')]('mandatoryDisposition',_0x1dc2b7);}},'provider':{'type':Sequelize['ENUM'](_0xc158('0xa'),_0xc158('0xb'),_0xc158('0xc'),_0xc158('0xd')),'defaultValue':null,'get':function(){if(!this[_0xc158('0xe')]('provider'))return _0xc158('0xf');return this['getDataValue'](_0xc158('0x10'));},'set':function(_0x542719){if(_0x542719==='custom')_0x542719=null;return this[_0xc158('0x8')](_0xc158('0x10'),_0x542719);}}}; \ No newline at end of file +var _0xbf07=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','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}}'];(function(_0x21c531,_0x52878c){var _0x70431c=function(_0x4e96fb){while(--_0x4e96fb){_0x21c531['push'](_0x21c531['shift']());}};_0x70431c(++_0x52878c);}(_0xbf07,0xee));var _0x7bf0=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xbf07[_0x469ac7];return _0x22f3b0;};'use strict';var Sequelize=require(_0x7bf0('0x0'));module[_0x7bf0('0x1')]={'description':{'type':Sequelize[_0x7bf0('0x2')]},'name':{'type':Sequelize[_0x7bf0('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7bf0('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7bf0('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7bf0('0x4')]},'markAsUnread':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7bf0('0x5')},'fontSize':{'type':Sequelize[_0x7bf0('0x6')](0x2)[_0x7bf0('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7bf0('0x4')],'defaultValue':function(){return _0x7bf0('0x8');}},'notificationSound':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7bf0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7bf0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7bf0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7bf0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7bf0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':![],'comment':_0x7bf0('0xa'),'set':function(_0x58729a){if(!_0x58729a)this[_0x7bf0('0xb')]('mandatoryDispositionPauseId',null);this[_0x7bf0('0xb')](_0x7bf0('0xc'),_0x58729a);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x7bf0('0xd'),_0x7bf0('0xe'),_0x7bf0('0xf')),'defaultValue':null,'get':function(){if(!this[_0x7bf0('0x10')](_0x7bf0('0x11')))return _0x7bf0('0x12');return this[_0x7bf0('0x10')](_0x7bf0('0x11'));},'set':function(_0x24473a){if(_0x24473a===_0x7bf0('0x12'))_0x24473a=null;return this[_0x7bf0('0xb')](_0x7bf0('0x11'),_0x24473a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ed7a910..71e0eb8 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 _0x721b=['modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','length','find','catch','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','filter','map','rows','removeDispositions','CannedAnswer','getAnswers','nolimit','removeAnswers','key','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','addInteraction','MailInteraction','ids','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','json','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','subject','attach','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','util','path','juice','ioredis','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','undefined','limit','count','update','then','destroy','get','MailAccounts','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass'];(function(_0x368304,_0x5590aa){var _0x4fe9f6=function(_0x138620){while(--_0x138620){_0x368304['push'](_0x368304['shift']());}};_0x4fe9f6(++_0x5590aa);}(_0x721b,0x14d));var _0xb721=function(_0x3ebed2,_0x4ca3fe){_0x3ebed2=_0x3ebed2-0x0;var _0x36db88=_0x721b[_0x3ebed2];return _0x36db88;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xb721('0x0'));var path=require(_0xb721('0x1'));var _=require('lodash');var juice=require(_0xb721('0x2'));var Redis=require(_0xb721('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb721('0x4'));var config=require(_0xb721('0x5'));var db=require('../../mysqldb')['db'];config[_0xb721('0x6')]=_[_0xb721('0x7')](config[_0xb721('0x6')],{'host':_0xb721('0x8'),'port':0x18eb});var socket=require(_0xb721('0x9'))(new Redis(config[_0xb721('0x6')]));require(_0xb721('0xa'))[_0xb721('0xb')](socket);var jayson=require(_0xb721('0xc'));var client=jayson[_0xb721('0xd')][_0xb721('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x1c6fdd,_0x5b144d,_0x1444f3,_0x44a8a3){return new BPromise(function(_0x3ad548,_0x501399){var _0x2e5034=_0x44a8a3||client;return _0x2e5034[_0xb721('0xf')](_0x1c6fdd,_0x1444f3)['then'](function(_0x235d8e){logger[_0xb721('0x10')]('MailAccount,\x20%s,\x20%s',_0x5b144d,'request\x20sent');logger['debug'](_0xb721('0x11'),_0x5b144d,_0xb721('0x12'),JSON[_0xb721('0x13')](_0x235d8e));if(_0x235d8e['error']){if(_0x235d8e[_0xb721('0x14')]['code']===0x1f4){logger[_0xb721('0x14')](_0xb721('0x15'),_0x5b144d,_0x235d8e[_0xb721('0x14')][_0xb721('0x16')]);return _0x501399(_0x235d8e[_0xb721('0x14')][_0xb721('0x16')]);}logger['error'](_0xb721('0x15'),_0x5b144d,_0x235d8e[_0xb721('0x14')][_0xb721('0x16')]);return _0x3ad548(_0x235d8e['error'][_0xb721('0x16')]);}else{logger[_0xb721('0x10')]('MailAccount,\x20%s,\x20%s',_0x5b144d,_0xb721('0x12'));_0x3ad548(_0x235d8e[_0xb721('0x17')][_0xb721('0x16')]);}})['catch'](function(_0x4b72df){logger[_0xb721('0x14')]('MailAccount,\x20%s,\x20%s',_0x5b144d,_0x4b72df);_0x501399(_0x4b72df);});});}function respondWithStatusCode(_0x1ff29f,_0x1d7308){_0x1d7308=_0x1d7308||0xcc;return function(_0x3c974d){if(_0x3c974d){return _0x1ff29f[_0xb721('0x18')](_0x1d7308);}return _0x1ff29f[_0xb721('0x19')](_0x1d7308)[_0xb721('0x1a')]();};}function respondWithResult(_0x1dc5f8,_0x3a5a10){_0x3a5a10=_0x3a5a10||0xc8;return function(_0xdeffbc){if(_0xdeffbc){return _0x1dc5f8['status'](_0x3a5a10)['json'](_0xdeffbc);}};}function respondWithFilteredResult(_0x1fb68f,_0x12031b){return function(_0x2ce75b){if(_0x2ce75b){var _0x2f084f=typeof _0x12031b[_0xb721('0x1b')]===_0xb721('0x1c')&&typeof _0x12031b[_0xb721('0x1d')]===_0xb721('0x1c');var _0x713495=_0x2ce75b['count'];var _0x3ef072=_0x2f084f?0x0:_0x12031b[_0xb721('0x1b')];var _0x2afe6a=_0x2f084f?_0x2ce75b[_0xb721('0x1e')]:_0x12031b[_0xb721('0x1b')]+_0x12031b[_0xb721('0x1d')];var _0x555b03;if(_0x2afe6a>=_0x713495){_0x2afe6a=_0x713495;_0x555b03=0xc8;}else{_0x555b03=0xce;}_0x1fb68f[_0xb721('0x19')](_0x555b03);return _0x1fb68f['set']('Content-Range',_0x3ef072+'-'+_0x2afe6a+'/'+_0x713495)['json'](_0x2ce75b);}return null;};}function saveUpdates(_0x5a0c60){return function(_0x44bf9d){if(_0x44bf9d){return _0x44bf9d[_0xb721('0x1f')](_0x5a0c60)[_0xb721('0x20')](function(_0x24dd5c){return _0x24dd5c;});}return null;};}function removeEntity(_0x4f86ed){return function(_0x3924c6){if(_0x3924c6){return _0x3924c6[_0xb721('0x21')]()['then'](function(){var _0x4de32b=_0x3924c6[_0xb721('0x22')]({'plain':!![]});var _0x3b1cce=_0xb721('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b1cce,'resourceId':_0x4de32b['id']}})['then'](function(){return _0x3924c6;});})[_0xb721('0x20')](function(){_0x4f86ed[_0xb721('0x19')](0xcc)[_0xb721('0x1a')]();});}};}function handleEntityNotFound(_0x37989b){return function(_0x55a8f4){if(!_0x55a8f4){_0x37989b[_0xb721('0x18')](0x194);}return _0x55a8f4;};}function handleError(_0x5ca7cc,_0x59f616){_0x59f616=_0x59f616||0x1f4;return function(_0x3d0c65){logger[_0xb721('0x14')](_0x3d0c65[_0xb721('0x24')]);if(_0x3d0c65[_0xb721('0x25')]){delete _0x3d0c65['name'];}_0x5ca7cc[_0xb721('0x19')](_0x59f616)[_0xb721('0x26')](_0x3d0c65);};}function getImapHost(_0x329bda){switch(_0x329bda){case _0xb721('0x27'):return'imap.gmail.com';case _0xb721('0x28'):return _0xb721('0x29');case _0xb721('0x2a'):return _0xb721('0x2b');case _0xb721('0x2c'):return'outlook.office365.com';}throw new Error(_0xb721('0x2d'),_0x329bda);}function getSmtpHost(_0x5d07d4){switch(_0x5d07d4){case _0xb721('0x27'):return _0xb721('0x2e');case _0xb721('0x28'):return _0xb721('0x2f');case _0xb721('0x2a'):return _0xb721('0x30');case _0xb721('0x2c'):return _0xb721('0x31');}throw new Error(_0xb721('0x2d'),_0x5d07d4);}function getAuthenticationOptions(_0x18300b,_0x5c75b7){var _0x23adad={};var _0x3f5953={};if(_0x18300b){_0x23adad[_0xb721('0x32')]=_0x3f5953['user']=_0x5c75b7['username'];_0x23adad[_0xb721('0x33')]=_0x3f5953[_0xb721('0x34')]=_0x5c75b7[_0xb721('0x33')];if(_0x5c75b7[_0xb721('0x35')]){_0x23adad[_0xb721('0x35')]=_0x3f5953[_0xb721('0x35')]=!![];_0x23adad[_0xb721('0x36')]=_0x3f5953['CloudProviderId']=_0x5c75b7[_0xb721('0x36')];_0x23adad['password']=_0x3f5953['pass']=null;}else{_0x23adad['CloudProviderId']=_0x3f5953['CloudProviderId']=null;}_0x23adad['host']=getImapHost(_0x18300b);_0x23adad['port']=0x3e1;_0x3f5953[_0xb721('0x37')]=getSmtpHost(_0x18300b);_0x3f5953[_0xb721('0x38')]=0x24b;_0x3f5953[_0xb721('0x39')]=![];_0x23adad[_0xb721('0x3a')]=_0x3f5953[_0xb721('0x3a')]=null;}else{if(_0x5c75b7[_0xb721('0x3b')]){_0x23adad[_0xb721('0x32')]=_0x3f5953[_0xb721('0x32')]=_0x5c75b7[_0xb721('0x3c')];_0x23adad['password']=_0x3f5953[_0xb721('0x34')]=_0x5c75b7[_0xb721('0x33')];}else{_0x23adad[_0xb721('0x3b')]=_0x3f5953['authentication']=![];_0x23adad[_0xb721('0x32')]=_0x3f5953[_0xb721('0x32')]=null;_0x23adad['password']=_0x3f5953[_0xb721('0x34')]=null;}_0x23adad['host']=_0x5c75b7[_0xb721('0x3d')][_0xb721('0x37')];_0x23adad[_0xb721('0x38')]=_0x5c75b7[_0xb721('0x3d')][_0xb721('0x38')];_0x3f5953['host']=_0x5c75b7[_0xb721('0x3e')][_0xb721('0x37')];_0x3f5953[_0xb721('0x38')]=_0x5c75b7[_0xb721('0x3e')][_0xb721('0x38')];}return{'Imap':_0x23adad,'Smtp':_0x3f5953};}exports[_0xb721('0x3f')]=function(_0x3ab77d,_0x87977b){var _0x3d4bf0={'include':[{'model':db[_0xb721('0x40')],'as':_0xb721('0x3d')},{'model':db[_0xb721('0x41')],'as':_0xb721('0x3e')},{'model':db[_0xb721('0x42')],'as':_0xb721('0x43')}]},_0x588174={},_0x4f1f9f={'count':0x0,'rows':[]};var _0x37dc3e=_['map'](db[_0xb721('0x44')]['rawAttributes'],function(_0x48ae98){return{'name':_0x48ae98[_0xb721('0x45')],'type':_0x48ae98[_0xb721('0x46')]['key']};});_0x588174[_0xb721('0x47')]=_['map'](_0x37dc3e,_0xb721('0x25'));_0x588174['query']=_['keys'](_0x3ab77d[_0xb721('0x48')]);_0x588174[_0xb721('0x49')]=_[_0xb721('0x4a')](_0x588174[_0xb721('0x47')],_0x588174['query']);_0x3d4bf0[_0xb721('0x4b')]=_[_0xb721('0x4a')](_0x588174[_0xb721('0x47')],qs[_0xb721('0x4c')](_0x3ab77d[_0xb721('0x48')][_0xb721('0x4c')]));_0x3d4bf0[_0xb721('0x4b')]=_0x3d4bf0['attributes']['length']?_0x3d4bf0[_0xb721('0x4b')]:_0x588174[_0xb721('0x47')];if(!_0x3ab77d[_0xb721('0x48')][_0xb721('0x4d')]('nolimit')){_0x3d4bf0['limit']=qs[_0xb721('0x1d')](_0x3ab77d['query'][_0xb721('0x1d')]);_0x3d4bf0[_0xb721('0x1b')]=qs[_0xb721('0x1b')](_0x3ab77d['query']['offset']);}_0x3d4bf0[_0xb721('0x4e')]=qs[_0xb721('0x4f')](_0x3ab77d[_0xb721('0x48')][_0xb721('0x4f')]);_0x3d4bf0[_0xb721('0x50')]=qs[_0xb721('0x49')](_[_0xb721('0x51')](_0x3ab77d[_0xb721('0x48')],_0x588174['filters']),_0x37dc3e);if(_0x3ab77d['query']['filter']){_0x3d4bf0['where']=_[_0xb721('0x52')](_0x3d4bf0[_0xb721('0x50')],{'$or':_['map'](_0x37dc3e,function(_0x5cef8d){if(_0x5cef8d[_0xb721('0x46')]!==_0xb721('0x53')){var _0x428162={};_0x428162[_0x5cef8d['name']]={'$like':'%'+_0x3ab77d[_0xb721('0x48')]['filter']+'%'};return _0x428162;}})});}_0x3d4bf0=_[_0xb721('0x52')]({},_0x3d4bf0,_0x3ab77d[_0xb721('0x54')]);var _0x56dcbc={'where':_0x3d4bf0[_0xb721('0x50')]};return db['MailAccount'][_0xb721('0x1e')](_0x56dcbc)[_0xb721('0x20')](function(_0x50e4ab){_0x4f1f9f[_0xb721('0x1e')]=_0x50e4ab;if(_0x3ab77d[_0xb721('0x48')][_0xb721('0x55')]){_0x3d4bf0[_0xb721('0x56')]=[{'all':!![]}];}return db[_0xb721('0x44')][_0xb721('0x57')](_0x3d4bf0);})['then'](function(_0xba0e4e){_0x4f1f9f['rows']=_0xba0e4e;return _0x4f1f9f;})[_0xb721('0x20')](respondWithFilteredResult(_0x87977b,_0x3d4bf0))['catch'](handleError(_0x87977b,null));};exports[_0xb721('0x58')]=function(_0x49fe5c,_0x1dd01b){var _0xbd966b={'raw':![],'where':{'id':_0x49fe5c[_0xb721('0x59')]['id']},'include':[{'model':db[_0xb721('0x40')],'as':_0xb721('0x3d')},{'model':db[_0xb721('0x41')],'as':_0xb721('0x3e')},{'model':db['Pause'],'as':_0xb721('0x43')}]},_0x1e5f04={};_0x1e5f04[_0xb721('0x47')]=_[_0xb721('0x5a')](db[_0xb721('0x44')][_0xb721('0x5b')]);_0x1e5f04[_0xb721('0x48')]=_['keys'](_0x49fe5c[_0xb721('0x48')]);_0x1e5f04[_0xb721('0x49')]=_[_0xb721('0x4a')](_0x1e5f04[_0xb721('0x47')],_0x1e5f04[_0xb721('0x48')]);_0xbd966b[_0xb721('0x4b')]=_[_0xb721('0x4a')](_0x1e5f04[_0xb721('0x47')],qs['fields'](_0x49fe5c['query'][_0xb721('0x4c')]));_0xbd966b[_0xb721('0x4b')]=_0xbd966b[_0xb721('0x4b')][_0xb721('0x5c')]?_0xbd966b[_0xb721('0x4b')]:_0x1e5f04[_0xb721('0x47')];if(_0x49fe5c[_0xb721('0x48')][_0xb721('0x55')]){_0xbd966b[_0xb721('0x56')]=[{'all':!![]}];}_0xbd966b=_[_0xb721('0x52')]({},_0xbd966b,_0x49fe5c[_0xb721('0x54')]);return db[_0xb721('0x44')][_0xb721('0x5d')](_0xbd966b)[_0xb721('0x20')](handleEntityNotFound(_0x1dd01b,null))[_0xb721('0x20')](respondWithResult(_0x1dd01b,null))[_0xb721('0x5e')](handleError(_0x1dd01b,null));};exports['update']=function(_0x597f9a,_0x27dda0){if(_0x597f9a[_0xb721('0x5f')]['id']){delete _0x597f9a[_0xb721('0x5f')]['id'];}var _0x237963=_0x597f9a[_0xb721('0x5f')][_0xb721('0x60')]===_0xb721('0x61')?null:_0x597f9a[_0xb721('0x5f')][_0xb721('0x60')];var _0x3553a2=_0x597f9a[_0xb721('0x5f')][_0xb721('0x3d')]||{};var _0x378233=_0x597f9a[_0xb721('0x5f')][_0xb721('0x3e')]||{};if(_0x237963){_0x3553a2['host']=getImapHost(_0x237963);_0x3553a2[_0xb721('0x38')]=0x3e1;_0x378233[_0xb721('0x37')]=getSmtpHost(_0x237963);_0x378233[_0xb721('0x38')]=0x24b;_0x378233['secure']=![];}if(_0x378233['modernAuthentication']){_0x378233[_0xb721('0x39')]=![];}else{_0x378233[_0xb721('0x36')]=null;}if(!_0x3553a2[_0xb721('0x35')])_0x3553a2[_0xb721('0x36')]=null;_0x597f9a[_0xb721('0x5f')][_0xb721('0x3d')]=_0x3553a2;_0x597f9a[_0xb721('0x5f')][_0xb721('0x3e')]=_0x378233;return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x597f9a['params']['id']},'include':[{'model':db[_0xb721('0x40')],'as':'Imap'},{'model':db[_0xb721('0x41')],'as':_0xb721('0x3e')},{'model':db['Pause'],'as':_0xb721('0x43')}]})[_0xb721('0x20')](handleEntityNotFound(_0x27dda0,null))[_0xb721('0x20')](function(_0x4eb503){if(!_0x4eb503)throw new Error(_0xb721('0x62'));if(_0x4eb503[_0xb721('0x3a')])delete _0x597f9a[_0xb721('0x5f')]['Imap'];return _0x4eb503;})['then'](saveUpdates(_0x597f9a[_0xb721('0x5f')],null))['then'](function(_0x140ce1){if(!_0x597f9a[_0xb721('0x5f')]['Imap'])return _0x140ce1;return db[_0xb721('0x40')][_0xb721('0x1f')](_0x597f9a[_0xb721('0x5f')]['Imap'],{'where':{'MailAccountId':_0x140ce1['id']}})[_0xb721('0x20')](function(){return _0x140ce1;});})[_0xb721('0x20')](function(_0x854703){if(!_0x597f9a['body'][_0xb721('0x3e')])return _0x854703;return db[_0xb721('0x41')][_0xb721('0x1f')](_0x597f9a[_0xb721('0x5f')][_0xb721('0x3e')],{'where':{'MailAccountId':_0x854703['id']}})[_0xb721('0x20')](function(){return _0x854703;});})[_0xb721('0x20')](respondWithResult(_0x27dda0,null))[_0xb721('0x5e')](handleError(_0x27dda0,null));};exports[_0xb721('0x63')]=function(_0x1eb758,_0x3e1dc1){return db[_0xb721('0x44')][_0xb721('0x63')]()[_0xb721('0x20')](respondWithResult(_0x3e1dc1,null))[_0xb721('0x5e')](handleError(_0x3e1dc1,null));};exports[_0xb721('0x64')]=function(_0x27b103,_0x27ef6a){if(_0x27b103[_0xb721('0x5f')]['id']){delete _0x27b103[_0xb721('0x5f')]['id'];}return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x27b103[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x27ef6a,null))[_0xb721('0x20')](function(_0x2c1674){if(_0x2c1674){_0x27b103['body'][_0xb721('0x65')]=_0x2c1674['id'];return db[_0xb721('0x66')][_0xb721('0x67')](_0x27b103[_0xb721('0x5f')]);}})[_0xb721('0x20')](respondWithResult(_0x27ef6a,null))['catch'](handleError(_0x27ef6a,null));};exports[_0xb721('0x68')]=function(_0x4fe73d,_0x54f46a){var _0x5ecc0c={'raw':![],'where':{}};var _0x4d0971={};var _0x48c321={'count':0x0,'rows':[]};return db[_0xb721('0x44')][_0xb721('0x69')]({'where':{'id':_0x4fe73d[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x54f46a,null))[_0xb721('0x20')](function(_0x408ddc){if(_0x408ddc){_0x4d0971[_0xb721('0x47')]=_['keys'](db[_0xb721('0x66')]['rawAttributes']);_0x4d0971[_0xb721('0x48')]=_[_0xb721('0x5a')](_0x4fe73d[_0xb721('0x48')]);_0x4d0971[_0xb721('0x49')]=_[_0xb721('0x4a')](_0x4d0971[_0xb721('0x47')],_0x4d0971[_0xb721('0x48')]);_0x5ecc0c[_0xb721('0x4b')]=_[_0xb721('0x4a')](_0x4d0971['model'],qs[_0xb721('0x4c')](_0x4fe73d[_0xb721('0x48')][_0xb721('0x4c')]));_0x5ecc0c[_0xb721('0x4b')]=_0x5ecc0c[_0xb721('0x4b')][_0xb721('0x5c')]?_0x5ecc0c[_0xb721('0x4b')]:_0x4d0971[_0xb721('0x47')];if(!_0x4fe73d[_0xb721('0x48')]['hasOwnProperty']('nolimit')){_0x5ecc0c[_0xb721('0x1d')]=qs['limit'](_0x4fe73d['query'][_0xb721('0x1d')]);_0x5ecc0c[_0xb721('0x1b')]=qs[_0xb721('0x1b')](_0x4fe73d[_0xb721('0x48')]['offset']);}_0x5ecc0c[_0xb721('0x4e')]=qs['sort'](_0x4fe73d[_0xb721('0x48')][_0xb721('0x4f')]);_0x5ecc0c[_0xb721('0x50')]=qs[_0xb721('0x49')](_[_0xb721('0x51')](_0x4fe73d['query'],_0x4d0971[_0xb721('0x49')]));_0x5ecc0c['where'][_0xb721('0x65')]=_0x408ddc['id'];if(_0x4fe73d['query'][_0xb721('0x6a')]){_0x5ecc0c[_0xb721('0x50')]=_[_0xb721('0x52')](_0x5ecc0c[_0xb721('0x50')],{'$or':_[_0xb721('0x6b')](_0x5ecc0c[_0xb721('0x4b')],function(_0xab4c85){var _0x4c74a3={};_0x4c74a3[_0xab4c85]={'$like':'%'+_0x4fe73d[_0xb721('0x48')][_0xb721('0x6a')]+'%'};return _0x4c74a3;})});}_0x5ecc0c=_[_0xb721('0x52')]({},_0x5ecc0c,_0x4fe73d['options']);return db[_0xb721('0x66')]['count']({'where':_0x5ecc0c[_0xb721('0x50')]})[_0xb721('0x20')](function(_0x555cb0){_0x48c321[_0xb721('0x1e')]=_0x555cb0;if(_0x4fe73d[_0xb721('0x48')]['includeAll']){_0x5ecc0c[_0xb721('0x56')]=[{'all':!![]}];}return db[_0xb721('0x66')][_0xb721('0x57')](_0x5ecc0c);})['then'](function(_0x348f51){_0x48c321[_0xb721('0x6c')]=_0x348f51;return _0x48c321;});}})['then'](respondWithFilteredResult(_0x54f46a,_0x5ecc0c))[_0xb721('0x5e')](handleError(_0x54f46a,null));};exports[_0xb721('0x6d')]=function(_0x39d18e,_0x48cd97){return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x39d18e[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x48cd97,null))[_0xb721('0x20')](function(_0x5ee4df){if(_0x5ee4df){return _0x5ee4df[_0xb721('0x6d')](_0x39d18e[_0xb721('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x48cd97,null))[_0xb721('0x5e')](handleError(_0x48cd97,null));};exports['addAnswer']=function(_0x4c3768,_0x11ef4d){if(_0x4c3768[_0xb721('0x5f')]['id']){delete _0x4c3768[_0xb721('0x5f')]['id'];}return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x4c3768['params']['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x11ef4d,null))[_0xb721('0x20')](function(_0x49f646){if(_0x49f646){_0x4c3768[_0xb721('0x5f')][_0xb721('0x65')]=_0x49f646['id'];return db[_0xb721('0x6e')][_0xb721('0x67')](_0x4c3768[_0xb721('0x5f')]);}})[_0xb721('0x20')](respondWithResult(_0x11ef4d,null))[_0xb721('0x5e')](handleError(_0x11ef4d,null));};exports[_0xb721('0x6f')]=function(_0x131691,_0x50b507){var _0x4d067b={'raw':![],'where':{}};var _0x55fc28={};var _0x296d68={'count':0x0,'rows':[]};return db[_0xb721('0x44')][_0xb721('0x69')]({'where':{'id':_0x131691['params']['id']}})['then'](handleEntityNotFound(_0x50b507,null))[_0xb721('0x20')](function(_0x300d25){if(_0x300d25){_0x55fc28['model']=_[_0xb721('0x5a')](db[_0xb721('0x6e')][_0xb721('0x5b')]);_0x55fc28[_0xb721('0x48')]=_[_0xb721('0x5a')](_0x131691[_0xb721('0x48')]);_0x55fc28[_0xb721('0x49')]=_[_0xb721('0x4a')](_0x55fc28[_0xb721('0x47')],_0x55fc28[_0xb721('0x48')]);_0x4d067b[_0xb721('0x4b')]=_[_0xb721('0x4a')](_0x55fc28['model'],qs['fields'](_0x131691['query']['fields']));_0x4d067b[_0xb721('0x4b')]=_0x4d067b[_0xb721('0x4b')]['length']?_0x4d067b[_0xb721('0x4b')]:_0x55fc28['model'];if(!_0x131691['query'][_0xb721('0x4d')](_0xb721('0x70'))){_0x4d067b['limit']=qs[_0xb721('0x1d')](_0x131691['query'][_0xb721('0x1d')]);_0x4d067b[_0xb721('0x1b')]=qs[_0xb721('0x1b')](_0x131691['query'][_0xb721('0x1b')]);}_0x4d067b[_0xb721('0x4e')]=qs[_0xb721('0x4f')](_0x131691[_0xb721('0x48')][_0xb721('0x4f')]);_0x4d067b[_0xb721('0x50')]=qs[_0xb721('0x49')](_[_0xb721('0x51')](_0x131691[_0xb721('0x48')],_0x55fc28[_0xb721('0x49')]));_0x4d067b['where'][_0xb721('0x65')]=_0x300d25['id'];if(_0x131691[_0xb721('0x48')][_0xb721('0x6a')]){_0x4d067b[_0xb721('0x50')]=_[_0xb721('0x52')](_0x4d067b[_0xb721('0x50')],{'$or':_[_0xb721('0x6b')](_0x4d067b[_0xb721('0x4b')],function(_0x5ed63a){var _0x2da0c9={};_0x2da0c9[_0x5ed63a]={'$like':'%'+_0x131691[_0xb721('0x48')][_0xb721('0x6a')]+'%'};return _0x2da0c9;})});}_0x4d067b=_[_0xb721('0x52')]({},_0x4d067b,_0x131691['options']);return db['CannedAnswer'][_0xb721('0x1e')]({'where':_0x4d067b[_0xb721('0x50')]})[_0xb721('0x20')](function(_0x27e97e){_0x296d68[_0xb721('0x1e')]=_0x27e97e;if(_0x131691['query'][_0xb721('0x55')]){_0x4d067b[_0xb721('0x56')]=[{'all':!![]}];}return db[_0xb721('0x6e')]['findAll'](_0x4d067b);})[_0xb721('0x20')](function(_0x5106f3){_0x296d68[_0xb721('0x6c')]=_0x5106f3;return _0x296d68;});}})[_0xb721('0x20')](respondWithFilteredResult(_0x50b507,_0x4d067b))['catch'](handleError(_0x50b507,null));};exports[_0xb721('0x71')]=function(_0x51df30,_0x290ac8){return db['MailAccount'][_0xb721('0x5d')]({'where':{'id':_0x51df30['params']['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x290ac8,null))[_0xb721('0x20')](function(_0x1276ec){if(_0x1276ec){return _0x1276ec[_0xb721('0x71')](_0x51df30[_0xb721('0x48')]['ids']);}})[_0xb721('0x20')](respondWithStatusCode(_0x290ac8,null))[_0xb721('0x5e')](handleError(_0x290ac8,null));};exports[_0xb721('0x67')]=function(_0x24bd1b,_0x112539){var _0x3b613a={'name':_0x24bd1b[_0xb721('0x5f')][_0xb721('0x25')],'key':_0x24bd1b[_0xb721('0x5f')][_0xb721('0x72')],'provider':_0x24bd1b[_0xb721('0x5f')]['provider']===_0xb721('0x61')?null:_0x24bd1b['body']['provider'],'email':_0x24bd1b[_0xb721('0x5f')][_0xb721('0x73')],'ListId':_0x24bd1b[_0xb721('0x5f')][_0xb721('0x74')],'active':!_[_0xb721('0x75')](_0x24bd1b['body'][_0xb721('0x76')])?_0x24bd1b[_0xb721('0x5f')][_0xb721('0x76')]:!![],'description':_0x24bd1b['body'][_0xb721('0x77')]||null};var _0x6b36e2=getAuthenticationOptions(_0x3b613a[_0xb721('0x60')],_0x24bd1b[_0xb721('0x5f')]);_0x3b613a[_0xb721('0x3d')]=_0x6b36e2[_0xb721('0x3d')];_0x3b613a[_0xb721('0x3e')]=_0x6b36e2[_0xb721('0x3e')];return db['MailAccount'][_0xb721('0x67')](_0x3b613a,{'include':[{'model':db[_0xb721('0x41')],'as':_0xb721('0x3e')},{'model':db[_0xb721('0x40')],'as':'Imap'}]})[_0xb721('0x20')](function(_0x25ee4b){var _0xb95969=_0x24bd1b[_0xb721('0x32')][_0xb721('0x22')]({'plain':!![]});if(!_0xb95969)throw new Error(_0xb721('0x78'));if(_0xb95969[_0xb721('0x79')]===_0xb721('0x32')){var _0x22c328=_0x25ee4b['get']({'plain':!![]});return db[_0xb721('0x7a')][_0xb721('0x5d')]({'where':{'name':_0xb721('0x23'),'userProfileId':_0xb95969[_0xb721('0x7b')]},'raw':!![]})['then'](function(_0x56788a){if(_0x56788a&&_0x56788a[_0xb721('0x7c')]===0x0){return db[_0xb721('0x7d')][_0xb721('0x67')]({'name':_0x22c328['name'],'resourceId':_0x22c328['id'],'type':_0x56788a[_0xb721('0x25')],'sectionId':_0x56788a['id']},{})[_0xb721('0x20')](function(){return _0x25ee4b;});}else{return _0x25ee4b;}})[_0xb721('0x5e')](function(_0x42d047){logger[_0xb721('0x14')](_0xb721('0x7e'),_0x42d047);throw _0x42d047;});}return _0x25ee4b;})['then'](respondWithResult(_0x112539,0xc9))[_0xb721('0x5e')](handleError(_0x112539,null));};exports[_0xb721('0x7f')]=function(_0x5010d8,_0x4f06f5){return db['MailAccount'][_0xb721('0x69')]({'where':{'id':_0x5010d8[_0xb721('0x59')]['id']}})['then'](handleEntityNotFound(_0x4f06f5,null))[_0xb721('0x20')](function(_0x55d361){if(_0x55d361){return _0x55d361[_0xb721('0x7f')]();}return null;})[_0xb721('0x20')](respondWithResult(_0x4f06f5,null))[_0xb721('0x5e')](handleError(_0x4f06f5,null));};exports[_0xb721('0x80')]=function(_0x41144f,_0x27bc77){if(_0x41144f['body']['id']){delete _0x41144f[_0xb721('0x5f')]['id'];}return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x41144f[_0xb721('0x59')]['id']}})['then'](handleEntityNotFound(_0x27bc77,null))[_0xb721('0x20')](function(_0x3c4ed4){if(_0x3c4ed4){_0x41144f['body']['MailAccountId']=_0x3c4ed4['id'];return db[_0xb721('0x40')][_0xb721('0x67')](_0x41144f[_0xb721('0x5f')]);}})[_0xb721('0x20')](respondWithResult(_0x27bc77,null))[_0xb721('0x5e')](handleError(_0x27bc77,null));};exports[_0xb721('0x81')]=function(_0x17fb20,_0x3252a5){return db[_0xb721('0x44')][_0xb721('0x69')]({'where':{'id':_0x17fb20[_0xb721('0x59')]['id']}})['then'](handleEntityNotFound(_0x3252a5,null))[_0xb721('0x20')](function(_0x14f37e){if(_0x14f37e){return _0x14f37e[_0xb721('0x82')](null);}return null;})[_0xb721('0x20')](respondWithStatusCode(_0x3252a5,null))['catch'](handleError(_0x3252a5,null));};exports['getSmtp']=function(_0x5a0da1,_0x2d7b80){return db[_0xb721('0x44')][_0xb721('0x69')]({'where':{'id':_0x5a0da1[_0xb721('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d7b80,null))['then'](function(_0x30b0c4){if(_0x30b0c4){return _0x30b0c4['getSmtp']();}return null;})['then'](respondWithResult(_0x2d7b80,null))[_0xb721('0x5e')](handleError(_0x2d7b80,null));};exports[_0xb721('0x83')]=function(_0x5b6363,_0x3a8552){if(_0x5b6363[_0xb721('0x5f')]['id']){delete _0x5b6363[_0xb721('0x5f')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5b6363[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x3a8552,null))[_0xb721('0x20')](function(_0x49e062){if(_0x49e062){_0x5b6363[_0xb721('0x5f')][_0xb721('0x65')]=_0x49e062['id'];return db[_0xb721('0x41')][_0xb721('0x67')](_0x5b6363[_0xb721('0x5f')]);}})[_0xb721('0x20')](respondWithResult(_0x3a8552,null))[_0xb721('0x5e')](handleError(_0x3a8552,null));};exports[_0xb721('0x84')]=function(_0x40b810,_0x25bbb2){return db[_0xb721('0x44')][_0xb721('0x69')]({'where':{'id':_0x40b810[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x25bbb2,null))[_0xb721('0x20')](function(_0x400c61){if(_0x400c61){return _0x400c61['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x25bbb2,null))[_0xb721('0x5e')](handleError(_0x25bbb2,null));};exports[_0xb721('0x85')]=function(_0x2b115a,_0x327811){return db[_0xb721('0x86')][_0xb721('0x5d')]({'where':{'id':_0x2b115a[_0xb721('0x59')]['id']}})['then'](handleEntityNotFound(_0x327811,null))[_0xb721('0x20')](function(_0x1b0b87){if(_0x1b0b87){return _0x1b0b87[_0xb721('0x85')](_0x2b115a[_0xb721('0x5f')][_0xb721('0x87')],_[_0xb721('0x88')](_0x2b115a[_0xb721('0x5f')],[_0xb721('0x87'),'id'])||{});}})[_0xb721('0x20')](respondWithResult(_0x327811,null))[_0xb721('0x5e')](handleError(_0x327811,null));};exports[_0xb721('0x89')]=function(_0x33cbd8,_0x56db5d){var _0x2fb03a={'raw':![],'where':{}};var _0x808ec0={};var _0x7108aa={'count':0x0,'rows':[]};return db['MailAccount'][_0xb721('0x69')]({'where':{'id':_0x33cbd8[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x56db5d,null))[_0xb721('0x20')](function(_0x4d9e57){if(_0x4d9e57){_0x808ec0[_0xb721('0x47')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x808ec0[_0xb721('0x48')]=_[_0xb721('0x5a')](_0x33cbd8[_0xb721('0x48')]);_0x808ec0['filters']=_[_0xb721('0x4a')](_0x808ec0[_0xb721('0x47')],_0x808ec0['query']);_0x2fb03a['attributes']=_[_0xb721('0x4a')](_0x808ec0['model'],qs[_0xb721('0x4c')](_0x33cbd8[_0xb721('0x48')][_0xb721('0x4c')]));_0x2fb03a[_0xb721('0x4b')]=_0x2fb03a[_0xb721('0x4b')][_0xb721('0x5c')]?_0x2fb03a['attributes']:_0x808ec0[_0xb721('0x47')];if(!_0x33cbd8[_0xb721('0x48')][_0xb721('0x4d')]('nolimit')){_0x2fb03a[_0xb721('0x1d')]=qs['limit'](_0x33cbd8['query'][_0xb721('0x1d')]);_0x2fb03a[_0xb721('0x1b')]=qs['offset'](_0x33cbd8['query'][_0xb721('0x1b')]);}_0x2fb03a['order']=qs[_0xb721('0x4f')](_0x33cbd8[_0xb721('0x48')][_0xb721('0x4f')]);_0x2fb03a[_0xb721('0x50')]=qs[_0xb721('0x49')](_['pick'](_0x33cbd8[_0xb721('0x48')],_0x808ec0[_0xb721('0x49')]));_0x2fb03a[_0xb721('0x50')][_0xb721('0x65')]=_0x4d9e57['id'];if(_0x33cbd8['query'][_0xb721('0x6a')]){_0x2fb03a[_0xb721('0x50')]=_[_0xb721('0x52')](_0x2fb03a[_0xb721('0x50')],{'$or':_[_0xb721('0x6b')](_0x2fb03a[_0xb721('0x4b')],function(_0x417e88){var _0x335981={};_0x335981[_0x417e88]={'$like':'%'+_0x33cbd8[_0xb721('0x48')][_0xb721('0x6a')]+'%'};return _0x335981;})});}_0x2fb03a=_[_0xb721('0x52')]({},_0x2fb03a,_0x33cbd8[_0xb721('0x54')]);return db[_0xb721('0x86')][_0xb721('0x1e')]({'where':_0x2fb03a['where']})['then'](function(_0x387b21){_0x7108aa['count']=_0x387b21;if(_0x33cbd8[_0xb721('0x48')][_0xb721('0x55')]){_0x2fb03a['include']=[{'model':db[_0xb721('0x8a')],'as':_0xb721('0x8b'),'required':![]},{'model':db[_0xb721('0x8c')],'as':_0xb721('0x8d'),'attributes':[_0xb721('0x25'),'fullname',_0xb721('0x8e')],'required':![]},{'model':db[_0xb721('0x8f')],'as':_0xb721('0x90'),'attributes':['id',_0xb721('0x25'),'color'],'where':_0x33cbd8[_0xb721('0x48')]['tag']?{'id':_0x33cbd8[_0xb721('0x48')][_0xb721('0x91')]}:undefined,'required':_0x33cbd8['query']['tag']?!![]:![]}];}return db['MailInteraction'][_0xb721('0x57')](_0x2fb03a);})[_0xb721('0x20')](function(_0x30e6d0){_0x7108aa[_0xb721('0x6c')]=_0x30e6d0;return _0x7108aa;});}})[_0xb721('0x20')](respondWithFilteredResult(_0x56db5d,_0x2fb03a))['catch'](handleError(_0x56db5d,null));};exports['addApplications']=function addApplications(_0x803ea2,_0x490c72){var _0x1f2092=_0x803ea2['params']['id'];var _0x19fc1e=_0x803ea2[_0xb721('0x5f')];var _0x23cbf6=0xc8;var _0x4e5fc4=null;return db[_0xb721('0x92')][_0xb721('0x93')]({'isolationLevel':db['sequelize']['Transaction'][_0xb721('0x94')][_0xb721('0x95')]},function(_0x5470c1){return db['MailAccount']['findOne']({'where':{'id':_0x1f2092},'transaction':_0x5470c1})['then'](function(_0xb4a275){if(_0xb4a275){return db['MailApplication'][_0xb721('0x21')]({'where':{'MailAccountId':_0x1f2092},'transaction':_0x5470c1})[_0xb721('0x20')](function(){var _0x34f6cf=_['map'](_0x19fc1e,function(_0x4781a6){_0x4781a6[_0xb721('0x65')]=_0x1f2092;return _0x4781a6;});return db[_0xb721('0x96')]['bulkCreate'](_0x34f6cf,{'transaction':_0x5470c1});});}else{_0x23cbf6=0x194;_0x4e5fc4=[];}});})[_0xb721('0x20')](function(){if(_0x23cbf6!==0x194){return db['MailApplication'][_0xb721('0x97')]({'where':{'MailAccountId':_0x1f2092},'order':'priority'})['then'](function(_0x2eacf0){_0x4e5fc4=_0x2eacf0;});}})[_0xb721('0x5e')](function(_0x4e3a8f){_0x23cbf6=0x1f4;logger[_0xb721('0x14')](_0x4e3a8f['stack']);if(_0x4e3a8f[_0xb721('0x25')]){delete _0x4e3a8f[_0xb721('0x25')];}_0x4e5fc4=_0x4e3a8f;})[_0xb721('0x98')](function(){if(_0x4e5fc4===null){_0x490c72[_0xb721('0x18')](_0x23cbf6);}else{if(_0x23cbf6===0x1f4){_0x490c72[_0xb721('0x19')](_0x23cbf6)[_0xb721('0x26')](_0x4e5fc4);}else{_0x490c72['status'](_0x23cbf6)[_0xb721('0x99')](_0x4e5fc4);}}});};exports[_0xb721('0x9a')]=function(_0x4764d8,_0x1a7465){var _0x15b2db={};var _0x3d241d={};var _0x13294c;var _0x3fcc78;return db[_0xb721('0x44')][_0xb721('0x69')]({'where':{'id':_0x4764d8[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x1a7465,null))[_0xb721('0x20')](function(_0x1e0255){if(_0x1e0255){_0x13294c=_0x1e0255;_0x3d241d[_0xb721('0x47')]=_['keys'](db[_0xb721('0x96')]['rawAttributes']);_0x3d241d['query']=_['keys'](_0x4764d8[_0xb721('0x48')]);_0x3d241d['filters']=_[_0xb721('0x4a')](_0x3d241d[_0xb721('0x47')],_0x3d241d['query']);_0x15b2db[_0xb721('0x4b')]=_['intersection'](_0x3d241d[_0xb721('0x47')],qs[_0xb721('0x4c')](_0x4764d8[_0xb721('0x48')][_0xb721('0x4c')]));_0x15b2db[_0xb721('0x4b')]=_0x15b2db['attributes'][_0xb721('0x5c')]?_0x15b2db[_0xb721('0x4b')]:_0x3d241d[_0xb721('0x47')];_0x15b2db['order']=qs[_0xb721('0x4f')](_0x4764d8['query'][_0xb721('0x4f')]);_0x15b2db[_0xb721('0x50')]=qs[_0xb721('0x49')](_[_0xb721('0x51')](_0x4764d8['query'],_0x3d241d[_0xb721('0x49')]));if(_0x4764d8['query'][_0xb721('0x6a')]){_0x15b2db[_0xb721('0x50')]=_[_0xb721('0x52')](_0x15b2db[_0xb721('0x50')],{'$or':_[_0xb721('0x6b')](_0x15b2db[_0xb721('0x4b')],function(_0x385fe3){var _0x151653={};_0x151653[_0x385fe3]={'$like':'%'+_0x4764d8[_0xb721('0x48')][_0xb721('0x6a')]+'%'};return _0x151653;})});}_0x15b2db=_['merge']({},_0x15b2db,_0x4764d8['options']);return _0x13294c[_0xb721('0x9a')](_0x15b2db);}})[_0xb721('0x20')](function(_0x16e6ca){if(_0x16e6ca){_0x3fcc78=_0x16e6ca[_0xb721('0x5c')];if(!_0x4764d8[_0xb721('0x48')][_0xb721('0x4d')]('nolimit')){_0x15b2db[_0xb721('0x1d')]=qs[_0xb721('0x1d')](_0x4764d8[_0xb721('0x48')]['limit']);_0x15b2db['offset']=qs['offset'](_0x4764d8[_0xb721('0x48')][_0xb721('0x1b')]);}return _0x13294c[_0xb721('0x9a')](_0x15b2db);}})[_0xb721('0x20')](function(_0x6d6660){if(_0x6d6660){return _0x6d6660?{'count':_0x3fcc78,'rows':_0x6d6660}:null;}})['then'](respondWithResult(_0x1a7465,null))[_0xb721('0x5e')](handleError(_0x1a7465,null));};exports[_0xb721('0x9b')]=function(_0xf2db65,_0x10f63a){var _0x1d265e={'raw':!![],'where':{}};var _0x614823={};var _0x44ca97={'count':0x0,'rows':[]};return db[_0xb721('0x44')][_0xb721('0x69')]({'where':{'id':_0xf2db65[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x10f63a,null))['then'](function(_0x54dc48){if(_0x54dc48){_0x614823[_0xb721('0x47')]=_[_0xb721('0x5a')](db[_0xb721('0x9c')][_0xb721('0x5b')]);_0x614823['query']=_['keys'](_0xf2db65[_0xb721('0x48')]);_0x614823[_0xb721('0x49')]=_[_0xb721('0x4a')](_0x614823[_0xb721('0x47')],_0x614823[_0xb721('0x48')]);_0x1d265e[_0xb721('0x4b')]=_[_0xb721('0x4a')](_0x614823['model'],qs[_0xb721('0x4c')](_0xf2db65[_0xb721('0x48')][_0xb721('0x4c')]));_0x1d265e[_0xb721('0x4b')]=_0x1d265e['attributes'][_0xb721('0x5c')]?_0x1d265e[_0xb721('0x4b')]:_0x614823['model'];if(!_0xf2db65['query'][_0xb721('0x4d')](_0xb721('0x70'))){_0x1d265e[_0xb721('0x1d')]=qs[_0xb721('0x1d')](_0xf2db65[_0xb721('0x48')][_0xb721('0x1d')]);_0x1d265e['offset']=qs[_0xb721('0x1b')](_0xf2db65['query']['offset']);}_0x1d265e[_0xb721('0x4e')]=qs[_0xb721('0x4f')](_0xf2db65[_0xb721('0x48')]['sort']);_0x1d265e[_0xb721('0x50')]=qs[_0xb721('0x49')](_[_0xb721('0x51')](_0xf2db65[_0xb721('0x48')],_0x614823[_0xb721('0x49')]));_0x1d265e[_0xb721('0x50')][_0xb721('0x65')]=_0x54dc48['id'];if(_0xf2db65['query'][_0xb721('0x6a')]){_0x1d265e[_0xb721('0x50')]=_[_0xb721('0x52')](_0x1d265e[_0xb721('0x50')],{'$or':_[_0xb721('0x6b')](_0x1d265e[_0xb721('0x4b')],function(_0x1b70db){var _0x4e661d={};_0x4e661d[_0x1b70db]={'$like':'%'+_0xf2db65['query'][_0xb721('0x6a')]+'%'};return _0x4e661d;})});}if(_0xf2db65['query'][_0xb721('0x9d')]){var _0xe72cbb=_0xf2db65['query'][_0xb721('0x9d')][_0xb721('0x9e')](',');var _0x5485af={};_0x5485af[_0xe72cbb[0x0]]={'$gte':moment(_0xe72cbb[0x1])[_0xb721('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d265e[_0xb721('0x50')]=_[_0xb721('0x52')](_0x1d265e[_0xb721('0x50')],_0x5485af);}_0x1d265e=_[_0xb721('0x52')]({},_0x1d265e,_0xf2db65[_0xb721('0x54')]);return db[_0xb721('0x9c')]['count']({'where':_0x1d265e['where']})[_0xb721('0x20')](function(_0x5c4b4b){_0x44ca97[_0xb721('0x1e')]=_0x5c4b4b;if(_0xf2db65[_0xb721('0x48')]['includeAll']){_0x1d265e[_0xb721('0x56')]=[{'all':!![]}];}return db[_0xb721('0x9c')][_0xb721('0x57')](_0x1d265e);})[_0xb721('0x20')](function(_0x1c970f){if(_0xf2db65['query']['inlineCss']==='true'){for(var _0xec82f2=0x0;_0xec82f2<_0x1c970f[_0xb721('0x5c')];_0xec82f2++){_0x1c970f[_0xec82f2][_0xb721('0x5f')]=juice(_0x1c970f[_0xec82f2][_0xb721('0x5f')]);}}_0x44ca97['rows']=_0x1c970f;return _0x44ca97;});}})[_0xb721('0x20')](respondWithFilteredResult(_0x10f63a,_0x1d265e))[_0xb721('0x5e')](handleError(_0x10f63a,null));};exports[_0xb721('0x26')]=function(_0x1a0c5f,_0x5e2eee){var _0xa35ab5,_0x879bf1={},_0x450690;if(_0x1a0c5f[_0xb721('0x5f')]['to']){_0x450690=_0x1a0c5f[_0xb721('0x5f')]['to'][_0xb721('0x9e')](',')[0x0];}return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x1a0c5f['params']['id']},'include':[{'model':db[_0xb721('0xa0')],'as':_0xb721('0xa1'),'include':[{'model':db[_0xb721('0x8a')],'as':_0xb721('0xa2'),'where':{'email':_0x450690},'limit':0x1,'order':[[_0xb721('0xa3'),_0xb721('0xa4')]]}]},{'model':db[_0xb721('0x41')],'as':_0xb721('0x3e'),'raw':!![],'include':[{'model':db[_0xb721('0xa5')],'as':_0xb721('0xa5'),'raw':!![]}]}]})[_0xb721('0x20')](handleEntityNotFound(_0x5e2eee,null))[_0xb721('0x20')](function(_0x353588){if(!_0x353588)return;_0xa35ab5=_0x353588;if(!_0x353588[_0xb721('0x3e')])throw new Error(_0xb721('0xa6'));if(_[_0xb721('0x75')](_0x1a0c5f[_0xb721('0x5f')][_0xb721('0xa7')])){_0x1a0c5f[_0xb721('0x5f')]['from']=util['format'](_0xb721('0xa8'),_0x353588['name'],_0x353588[_0xb721('0x73')]||_0x353588[_0xb721('0x3e')]['user']);}if(_0x1a0c5f['body'][_0xb721('0xa9')]&&_0x1a0c5f[_0xb721('0x5f')][_0xb721('0xa9')]['length']){for(var _0x31bacc=0x0;_0x31bacc<_0x1a0c5f[_0xb721('0x5f')]['attachments'][_0xb721('0x5c')];_0x31bacc+=0x1){_0x1a0c5f[_0xb721('0x5f')][_0xb721('0xa9')][_0x31bacc]={'filename':_0x1a0c5f[_0xb721('0x5f')]['attachments'][_0x31bacc][_0xb721('0x25')],'path':path[_0xb721('0xaa')](config['root'],'server/files/attachments',_0x1a0c5f['body'][_0xb721('0xa9')][_0x31bacc]['basename'])};}}var _0x2ed263=_0x353588[_0xb721('0xab')]();return respondWithRpcPromise(_0xb721('0xac'),_0xb721('0xad'),{'account':_0x2ed263,'message':_0x1a0c5f['body']});})['then'](function(_0x3c1791){if(!_0x3c1791)return;_0x879bf1=_0x3c1791;if(!_0xa35ab5[_0xb721('0xa1')])throw new Error(_0xb721('0xae'));if(_0xa35ab5[_0xb721('0xa1')][_0xb721('0xa2')][_0xb721('0x5c')])return _0xa35ab5[_0xb721('0xa1')]['Contacts'][0x0];return db['CmContact']['create'](_[_0xb721('0x7')](_0x1a0c5f[_0xb721('0x5f')],{'firstName':_0x1a0c5f[_0xb721('0x5f')]['to'],'email':_0x1a0c5f[_0xb721('0x5f')]['to'],'phone':_0x1a0c5f[_0xb721('0x5f')]['to'],'ListId':_0xa35ab5[_0xb721('0x74')]}));})['then'](function(_0x24b3af){if(!_0x24b3af)return;var _0x1dacbc={'UserId':_0x1a0c5f[_0xb721('0x32')]['id'],'ContactId':_0x24b3af['id'],'MailAccountId':_0xa35ab5['id'],'inReplyTo':_0x879bf1['messageId'],'to':_0x1a0c5f['body'][_0xb721('0xa7')],'cc':_0x1a0c5f[_0xb721('0x5f')]['cc'],'subject':_0x1a0c5f[_0xb721('0x5f')][_0xb721('0xaf')],'attach':_0x1a0c5f[_0xb721('0x5f')][_0xb721('0xb0')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb721('0x9f')](_0xb721('0xb1')),'lastMsgDirection':'out','Messages':[_[_0xb721('0x52')](_0x1a0c5f[_0xb721('0x5f')],{'messageId':_0x879bf1[_0xb721('0xb2')],'sentAt':moment()[_0xb721('0x9f')](_0xb721('0xb1')),'read':!![],'MailAccountId':_0xa35ab5['id'],'UserId':_0x1a0c5f['user']['id'],'ContactId':_0x24b3af['id']})]};if(_0x1a0c5f['body'][_0xb721('0xb3')]){_0x1dacbc=_[_0xb721('0x52')](_0x1dacbc,_0x1a0c5f[_0xb721('0x5f')]['Interaction']);}return db[_0xb721('0x86')][_0xb721('0x67')](_0x1dacbc,{'include':[{'model':db[_0xb721('0x9c')],'as':_0xb721('0xb4')}]});})[_0xb721('0x20')](respondWithResult(_0x5e2eee,null))[_0xb721('0x5e')](handleError(_0x5e2eee,null));};exports[_0xb721('0xb5')]=function(_0x3a20f1,_0x485472){return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x3a20f1['params']['id']},'include':[{'model':db[_0xb721('0x41')],'as':_0xb721('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb721('0xa5'),'raw':!![]}]}]})[_0xb721('0x20')](handleEntityNotFound(_0x485472,null))[_0xb721('0x20')](function(_0x256d1a){if(!_0x256d1a[_0xb721('0x3e')])return;var _0x1d2488=_0x256d1a[_0xb721('0xab')]();return respondWithRpcPromise(_0xb721('0xb6'),_0xb721('0xb5'),{'account':_0x1d2488});})[_0xb721('0x20')](respondWithResult(_0x485472,null))[_0xb721('0x5e')](handleError(_0x485472,null));};exports[_0xb721('0x21')]=function(_0x54f48e,_0x4da02f){return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x54f48e[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x4da02f,null))[_0xb721('0x20')](function(_0x1e49a9){if(_0x1e49a9&&_0x1e49a9['service']){throw new db[(_0xb721('0xb7'))][(_0xb721('0xb8'))](_0xb721('0xb9'));}return _0x1e49a9;})[_0xb721('0x20')](removeEntity(_0x4da02f,null))['catch'](handleError(_0x4da02f,null));};exports['addAgents']=function(_0x595597,_0x265d78){return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x595597[_0xb721('0x59')]['id']}})['then'](handleEntityNotFound(_0x265d78,null))[_0xb721('0x20')](function(_0x49fdbe){if(_0x49fdbe){return _0x49fdbe[_0xb721('0xba')](_0x595597[_0xb721('0x5f')][_0xb721('0x87')],_['omit'](_0x595597[_0xb721('0x5f')],[_0xb721('0x87'),'id'])||{})[_0xb721('0xbb')](function(_0x2ca1e0){for(var _0x8900de=0x0;_0x8900de<_0x595597[_0xb721('0x5f')][_0xb721('0x87')][_0xb721('0x5c')];_0x8900de+=0x1){socket[_0xb721('0xbc')](_0xb721('0xbd'),{'UserId':Number(_0x595597['body'][_0xb721('0x87')][_0x8900de]),'MailAccountId':Number(_0x595597[_0xb721('0x59')]['id'])});}return _0x2ca1e0;});}})[_0xb721('0x20')](respondWithResult(_0x265d78,null))['catch'](handleError(_0x265d78,null));};exports['removeAgents']=function(_0x58576c,_0x598152){return db[_0xb721('0x44')][_0xb721('0x5d')]({'where':{'id':_0x58576c[_0xb721('0x59')]['id']}})[_0xb721('0x20')](handleEntityNotFound(_0x598152,null))['then'](function(_0x159f65){if(_0x159f65){return _0x159f65['removeAgents'](_0x58576c[_0xb721('0x48')][_0xb721('0x87')])[_0xb721('0x20')](function(){if(_[_0xb721('0xbe')](_0x58576c[_0xb721('0x48')][_0xb721('0x87')])){for(var _0x1b91e9=0x0;_0x1b91e9<_0x58576c[_0xb721('0x48')]['ids']['length'];_0x1b91e9+=0x1){socket[_0xb721('0xbc')](_0xb721('0xbf'),{'UserId':Number(_0x58576c['query'][_0xb721('0x87')][_0x1b91e9]),'MailAccountId':Number(_0x58576c[_0xb721('0x59')]['id'])});}}else{socket[_0xb721('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x58576c['query'][_0xb721('0x87')]),'MailAccountId':Number(_0x58576c[_0xb721('0x59')]['id'])});}});}})[_0xb721('0x20')](respondWithStatusCode(_0x598152,null))['catch'](handleError(_0x598152,null));};exports['getAgents']=function(_0x2a2699,_0x2b3a38){var _0x335a22={};var _0x53d37b={};var _0x3a97a3;var _0x2f622c;return db['MailAccount'][_0xb721('0x69')]({'where':{'id':_0x2a2699[_0xb721('0x59')]['id']}})['then'](handleEntityNotFound(_0x2b3a38,null))[_0xb721('0x20')](function(_0x419cb2){if(_0x419cb2){_0x3a97a3=_0x419cb2;_0x53d37b[_0xb721('0x47')]=_['keys'](db[_0xb721('0x8c')]['rawAttributes']);_0x53d37b[_0xb721('0x48')]=_[_0xb721('0x5a')](_0x2a2699[_0xb721('0x48')]);_0x53d37b[_0xb721('0x49')]=_[_0xb721('0x4a')](_0x53d37b[_0xb721('0x47')],_0x53d37b['query']);_0x335a22['attributes']=_[_0xb721('0x4a')](_0x53d37b[_0xb721('0x47')],qs[_0xb721('0x4c')](_0x2a2699[_0xb721('0x48')][_0xb721('0x4c')]));_0x335a22[_0xb721('0x4b')]=_0x335a22['attributes']['length']?_0x335a22[_0xb721('0x4b')]:_0x53d37b[_0xb721('0x47')];_0x335a22[_0xb721('0x4e')]=qs['sort'](_0x2a2699[_0xb721('0x48')]['sort']);_0x335a22[_0xb721('0x50')]=qs[_0xb721('0x49')](_[_0xb721('0x51')](_0x2a2699[_0xb721('0x48')],_0x53d37b['filters']));if(_0x2a2699[_0xb721('0x48')][_0xb721('0x6a')]){_0x335a22[_0xb721('0x50')]=_[_0xb721('0x52')](_0x335a22[_0xb721('0x50')],{'$or':_[_0xb721('0x6b')](_0x335a22['attributes'],function(_0xe2120a){var _0x5d5112={};_0x5d5112[_0xe2120a]={'$like':'%'+_0x2a2699[_0xb721('0x48')][_0xb721('0x6a')]+'%'};return _0x5d5112;})});}_0x335a22=_[_0xb721('0x52')]({},_0x335a22,_0x2a2699[_0xb721('0x54')]);return _0x3a97a3[_0xb721('0xc0')](_0x335a22);}})[_0xb721('0x20')](function(_0x5534da){if(_0x5534da){_0x2f622c=_0x5534da[_0xb721('0x5c')];if(!_0x2a2699[_0xb721('0x48')][_0xb721('0x4d')](_0xb721('0x70'))){_0x335a22['limit']=qs[_0xb721('0x1d')](_0x2a2699[_0xb721('0x48')][_0xb721('0x1d')]);_0x335a22['offset']=qs['offset'](_0x2a2699[_0xb721('0x48')][_0xb721('0x1b')]);}return _0x3a97a3[_0xb721('0xc0')](_0x335a22);}})['then'](function(_0x55349e){if(_0x55349e){return _0x55349e?{'count':_0x2f622c,'rows':_0x55349e}:null;}})[_0xb721('0x20')](respondWithResult(_0x2b3a38,null))[_0xb721('0x5e')](handleError(_0x2b3a38,null));}; \ No newline at end of file +var _0xa038=['MailAccountId','Disposition','create','getDispositions','findOne','pick','addAnswer','CannedAnswer','length','removeAnswers','ids','key','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','format','inlineCss','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','out','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','update','destroy','get','MailAccounts','stack','name','gmail','yahoo','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','MailServerOut','MailAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','count','include','findAll','rows','show','MailServerIn','mandatoryDispositionPause','keys','includeAll','body','provider','custom','secure','find','params','Mail\x20Account\x20not\x20found','describe','addDisposition'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xa038,0x11f));var _0x8a03=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xa038[_0xe73080];return _0x12cbc4;};'use strict';var moment=require(_0x8a03('0x0'));var BPromise=require(_0x8a03('0x1'));var util=require(_0x8a03('0x2'));var path=require(_0x8a03('0x3'));var _=require(_0x8a03('0x4'));var juice=require('juice');var Redis=require(_0x8a03('0x5'));var qs=require(_0x8a03('0x6'));var logger=require(_0x8a03('0x7'))('api');var config=require(_0x8a03('0x8'));var db=require('../../mysqldb')['db'];config[_0x8a03('0x9')]=_['defaults'](config[_0x8a03('0x9')],{'host':_0x8a03('0xa'),'port':0x18eb});var socket=require(_0x8a03('0xb'))(new Redis(config[_0x8a03('0x9')]));require(_0x8a03('0xc'))[_0x8a03('0xd')](socket);var jayson=require(_0x8a03('0xe'));var client=jayson[_0x8a03('0xf')][_0x8a03('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x24545b,_0x1ffb01,_0x37607d,_0x480b51){return new BPromise(function(_0x116e39,_0x1f2a1){var _0x20ebf0=_0x480b51||client;return _0x20ebf0[_0x8a03('0x11')](_0x24545b,_0x37607d)[_0x8a03('0x12')](function(_0x262f4d){logger['info'](_0x8a03('0x13'),_0x1ffb01,_0x8a03('0x14'));logger['debug'](_0x8a03('0x15'),_0x1ffb01,_0x8a03('0x14'),JSON[_0x8a03('0x16')](_0x262f4d));if(_0x262f4d['error']){if(_0x262f4d['error'][_0x8a03('0x17')]===0x1f4){logger['error'](_0x8a03('0x13'),_0x1ffb01,_0x262f4d[_0x8a03('0x18')][_0x8a03('0x19')]);return _0x1f2a1(_0x262f4d[_0x8a03('0x18')][_0x8a03('0x19')]);}logger[_0x8a03('0x18')](_0x8a03('0x13'),_0x1ffb01,_0x262f4d[_0x8a03('0x18')][_0x8a03('0x19')]);return _0x116e39(_0x262f4d[_0x8a03('0x18')][_0x8a03('0x19')]);}else{logger[_0x8a03('0x1a')](_0x8a03('0x13'),_0x1ffb01,_0x8a03('0x14'));_0x116e39(_0x262f4d['result'][_0x8a03('0x19')]);}})[_0x8a03('0x1b')](function(_0x2f5572){logger[_0x8a03('0x18')]('MailAccount,\x20%s,\x20%s',_0x1ffb01,_0x2f5572);_0x1f2a1(_0x2f5572);});});}function respondWithStatusCode(_0x402eba,_0x125854){_0x125854=_0x125854||0xcc;return function(_0x121c39){if(_0x121c39){return _0x402eba[_0x8a03('0x1c')](_0x125854);}return _0x402eba['status'](_0x125854)[_0x8a03('0x1d')]();};}function respondWithResult(_0x163db7,_0x3d5a38){_0x3d5a38=_0x3d5a38||0xc8;return function(_0x2d2f32){if(_0x2d2f32){return _0x163db7['status'](_0x3d5a38)[_0x8a03('0x1e')](_0x2d2f32);}};}function respondWithFilteredResult(_0x1244c5,_0x43923d){return function(_0xd69f46){if(_0xd69f46){var _0x4c808d=typeof _0x43923d[_0x8a03('0x1f')]===_0x8a03('0x20')&&typeof _0x43923d[_0x8a03('0x21')]==='undefined';var _0x3b7c68=_0xd69f46['count'];var _0x315807=_0x4c808d?0x0:_0x43923d['offset'];var _0x14a5a7=_0x4c808d?_0xd69f46['count']:_0x43923d[_0x8a03('0x1f')]+_0x43923d['limit'];var _0x234557;if(_0x14a5a7>=_0x3b7c68){_0x14a5a7=_0x3b7c68;_0x234557=0xc8;}else{_0x234557=0xce;}_0x1244c5[_0x8a03('0x22')](_0x234557);return _0x1244c5[_0x8a03('0x23')](_0x8a03('0x24'),_0x315807+'-'+_0x14a5a7+'/'+_0x3b7c68)[_0x8a03('0x1e')](_0xd69f46);}return null;};}function saveUpdates(_0x2539e6){return function(_0x57f71b){if(_0x57f71b){return _0x57f71b[_0x8a03('0x25')](_0x2539e6)[_0x8a03('0x12')](function(_0x3b54f8){return _0x3b54f8;});}return null;};}function removeEntity(_0x1bbaa2){return function(_0x4fd4cb){if(_0x4fd4cb){return _0x4fd4cb[_0x8a03('0x26')]()['then'](function(){var _0x4f50e9=_0x4fd4cb[_0x8a03('0x27')]({'plain':!![]});var _0x3a9999=_0x8a03('0x28');return db['UserProfileResource'][_0x8a03('0x26')]({'where':{'type':_0x3a9999,'resourceId':_0x4f50e9['id']}})[_0x8a03('0x12')](function(){return _0x4fd4cb;});})['then'](function(){_0x1bbaa2[_0x8a03('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ed92){return function(_0x8ec103){if(!_0x8ec103){_0x36ed92[_0x8a03('0x1c')](0x194);}return _0x8ec103;};}function handleError(_0x3d4c0d,_0xb60de7){_0xb60de7=_0xb60de7||0x1f4;return function(_0x5a0373){logger['error'](_0x5a0373[_0x8a03('0x29')]);if(_0x5a0373[_0x8a03('0x2a')]){delete _0x5a0373[_0x8a03('0x2a')];}_0x3d4c0d['status'](_0xb60de7)['send'](_0x5a0373);};}function getImapHost(_0x269b1e){switch(_0x269b1e){case _0x8a03('0x2b'):return'imap.gmail.com';case _0x8a03('0x2c'):return'imap.mail.yahoo.com';case'hotmail':return _0x8a03('0x2d');case'outlook365':return _0x8a03('0x2e');}throw new Error(_0x8a03('0x2f'),_0x269b1e);}function getSmtpHost(_0xbdff35){switch(_0xbdff35){case _0x8a03('0x2b'):return _0x8a03('0x30');case'yahoo':return'smtp.mail.yahoo.com';case _0x8a03('0x31'):return _0x8a03('0x32');case _0x8a03('0x33'):return _0x8a03('0x34');}throw new Error(_0x8a03('0x2f'),_0xbdff35);}function getAuthenticationOptions(_0x482039,_0x4f7083){var _0x561c4c={};var _0x514208={};if(_0x482039){_0x561c4c[_0x8a03('0x35')]=_0x514208[_0x8a03('0x35')]=_0x4f7083[_0x8a03('0x36')];_0x561c4c[_0x8a03('0x37')]=_0x514208[_0x8a03('0x38')]=_0x4f7083[_0x8a03('0x37')];if(_0x4f7083[_0x8a03('0x39')]){_0x561c4c[_0x8a03('0x39')]=_0x514208['modernAuthentication']=!![];_0x561c4c[_0x8a03('0x3a')]=_0x514208[_0x8a03('0x3a')]=_0x4f7083[_0x8a03('0x3a')];_0x561c4c['password']=_0x514208[_0x8a03('0x38')]=null;}else{_0x561c4c[_0x8a03('0x3a')]=_0x514208['CloudProviderId']=null;}_0x561c4c[_0x8a03('0x3b')]=getImapHost(_0x482039);_0x561c4c['port']=0x3e1;_0x514208[_0x8a03('0x3b')]=getSmtpHost(_0x482039);_0x514208[_0x8a03('0x3c')]=0x24b;_0x514208['secure']=![];_0x561c4c['service']=_0x514208[_0x8a03('0x3d')]=null;}else{if(_0x4f7083[_0x8a03('0x3e')]){_0x561c4c[_0x8a03('0x35')]=_0x514208[_0x8a03('0x35')]=_0x4f7083['username'];_0x561c4c['password']=_0x514208[_0x8a03('0x38')]=_0x4f7083[_0x8a03('0x37')];}else{_0x561c4c['authentication']=_0x514208[_0x8a03('0x3e')]=![];_0x561c4c[_0x8a03('0x35')]=_0x514208[_0x8a03('0x35')]=null;_0x561c4c[_0x8a03('0x37')]=_0x514208['pass']=null;}_0x561c4c[_0x8a03('0x3b')]=_0x4f7083[_0x8a03('0x3f')][_0x8a03('0x3b')];_0x561c4c[_0x8a03('0x3c')]=_0x4f7083['Imap'][_0x8a03('0x3c')];_0x514208[_0x8a03('0x3b')]=_0x4f7083[_0x8a03('0x40')][_0x8a03('0x3b')];_0x514208[_0x8a03('0x3c')]=_0x4f7083[_0x8a03('0x40')][_0x8a03('0x3c')];}return{'Imap':_0x561c4c,'Smtp':_0x514208};}exports['index']=function(_0x51535f,_0x2b6c88){var _0x409fc9={'include':[{'model':db['MailServerIn'],'as':_0x8a03('0x3f')},{'model':db[_0x8a03('0x41')],'as':_0x8a03('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4b96ed={},_0x290666={'count':0x0,'rows':[]};var _0x580acc=_['map'](db[_0x8a03('0x42')][_0x8a03('0x43')],function(_0x15b803){return{'name':_0x15b803[_0x8a03('0x44')],'type':_0x15b803['type']['key']};});_0x4b96ed[_0x8a03('0x45')]=_['map'](_0x580acc,'name');_0x4b96ed[_0x8a03('0x46')]=_['keys'](_0x51535f[_0x8a03('0x46')]);_0x4b96ed[_0x8a03('0x47')]=_[_0x8a03('0x48')](_0x4b96ed['model'],_0x4b96ed['query']);_0x409fc9[_0x8a03('0x49')]=_[_0x8a03('0x48')](_0x4b96ed[_0x8a03('0x45')],qs[_0x8a03('0x4a')](_0x51535f[_0x8a03('0x46')]['fields']));_0x409fc9['attributes']=_0x409fc9[_0x8a03('0x49')]['length']?_0x409fc9[_0x8a03('0x49')]:_0x4b96ed[_0x8a03('0x45')];if(!_0x51535f[_0x8a03('0x46')][_0x8a03('0x4b')](_0x8a03('0x4c'))){_0x409fc9[_0x8a03('0x21')]=qs[_0x8a03('0x21')](_0x51535f[_0x8a03('0x46')]['limit']);_0x409fc9[_0x8a03('0x1f')]=qs[_0x8a03('0x1f')](_0x51535f['query'][_0x8a03('0x1f')]);}_0x409fc9[_0x8a03('0x4d')]=qs[_0x8a03('0x4e')](_0x51535f[_0x8a03('0x46')][_0x8a03('0x4e')]);_0x409fc9[_0x8a03('0x4f')]=qs[_0x8a03('0x47')](_['pick'](_0x51535f[_0x8a03('0x46')],_0x4b96ed[_0x8a03('0x47')]),_0x580acc);if(_0x51535f['query'][_0x8a03('0x50')]){_0x409fc9[_0x8a03('0x4f')]=_[_0x8a03('0x51')](_0x409fc9[_0x8a03('0x4f')],{'$or':_[_0x8a03('0x52')](_0x580acc,function(_0x3335cd){if(_0x3335cd['type']!==_0x8a03('0x53')){var _0x501577={};_0x501577[_0x3335cd[_0x8a03('0x2a')]]={'$like':'%'+_0x51535f[_0x8a03('0x46')]['filter']+'%'};return _0x501577;}})});}_0x409fc9=_[_0x8a03('0x51')]({},_0x409fc9,_0x51535f[_0x8a03('0x54')]);var _0x40c030={'where':_0x409fc9[_0x8a03('0x4f')]};return db['MailAccount'][_0x8a03('0x55')](_0x40c030)['then'](function(_0x25c7a1){_0x290666[_0x8a03('0x55')]=_0x25c7a1;if(_0x51535f[_0x8a03('0x46')]['includeAll']){_0x409fc9[_0x8a03('0x56')]=[{'all':!![]}];}return db['MailAccount'][_0x8a03('0x57')](_0x409fc9);})[_0x8a03('0x12')](function(_0x5a69b9){_0x290666[_0x8a03('0x58')]=_0x5a69b9;return _0x290666;})[_0x8a03('0x12')](respondWithFilteredResult(_0x2b6c88,_0x409fc9))[_0x8a03('0x1b')](handleError(_0x2b6c88,null));};exports[_0x8a03('0x59')]=function(_0x22662b,_0x563c3a){var _0x36a5b9={'raw':![],'where':{'id':_0x22662b['params']['id']},'include':[{'model':db[_0x8a03('0x5a')],'as':_0x8a03('0x3f')},{'model':db[_0x8a03('0x41')],'as':'Smtp'},{'model':db['Pause'],'as':_0x8a03('0x5b')}]},_0xc9a90b={};_0xc9a90b[_0x8a03('0x45')]=_[_0x8a03('0x5c')](db[_0x8a03('0x42')][_0x8a03('0x43')]);_0xc9a90b['query']=_['keys'](_0x22662b[_0x8a03('0x46')]);_0xc9a90b['filters']=_['intersection'](_0xc9a90b['model'],_0xc9a90b['query']);_0x36a5b9[_0x8a03('0x49')]=_[_0x8a03('0x48')](_0xc9a90b['model'],qs['fields'](_0x22662b['query'][_0x8a03('0x4a')]));_0x36a5b9['attributes']=_0x36a5b9[_0x8a03('0x49')]['length']?_0x36a5b9['attributes']:_0xc9a90b['model'];if(_0x22662b[_0x8a03('0x46')][_0x8a03('0x5d')]){_0x36a5b9['include']=[{'all':!![]}];}_0x36a5b9=_[_0x8a03('0x51')]({},_0x36a5b9,_0x22662b[_0x8a03('0x54')]);return db['MailAccount']['find'](_0x36a5b9)[_0x8a03('0x12')](handleEntityNotFound(_0x563c3a,null))[_0x8a03('0x12')](respondWithResult(_0x563c3a,null))[_0x8a03('0x1b')](handleError(_0x563c3a,null));};exports['update']=function(_0x20e0f9,_0x2a4373){if(_0x20e0f9[_0x8a03('0x5e')]['id']){delete _0x20e0f9[_0x8a03('0x5e')]['id'];}var _0xccd53a=_0x20e0f9['body'][_0x8a03('0x5f')]===_0x8a03('0x60')?null:_0x20e0f9[_0x8a03('0x5e')][_0x8a03('0x5f')];var _0x1dbdb4=_0x20e0f9[_0x8a03('0x5e')][_0x8a03('0x3f')]||{};var _0x221937=_0x20e0f9[_0x8a03('0x5e')][_0x8a03('0x40')]||{};if(_0xccd53a){_0x1dbdb4[_0x8a03('0x3b')]=getImapHost(_0xccd53a);_0x1dbdb4[_0x8a03('0x3c')]=0x3e1;_0x221937[_0x8a03('0x3b')]=getSmtpHost(_0xccd53a);_0x221937[_0x8a03('0x3c')]=0x24b;_0x221937[_0x8a03('0x61')]=![];}if(_0x221937[_0x8a03('0x39')]){_0x221937['secure']=![];}else{_0x221937[_0x8a03('0x3a')]=null;}if(!_0x1dbdb4[_0x8a03('0x39')])_0x1dbdb4[_0x8a03('0x3a')]=null;_0x20e0f9[_0x8a03('0x5e')][_0x8a03('0x3f')]=_0x1dbdb4;_0x20e0f9[_0x8a03('0x5e')]['Smtp']=_0x221937;return db[_0x8a03('0x42')][_0x8a03('0x62')]({'where':{'id':_0x20e0f9[_0x8a03('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x8a03('0x40')},{'model':db['Pause'],'as':_0x8a03('0x5b')}]})[_0x8a03('0x12')](handleEntityNotFound(_0x2a4373,null))[_0x8a03('0x12')](function(_0x82e291){if(!_0x82e291)throw new Error(_0x8a03('0x64'));if(_0x82e291[_0x8a03('0x3d')])delete _0x20e0f9['body'][_0x8a03('0x3f')];return _0x82e291;})[_0x8a03('0x12')](saveUpdates(_0x20e0f9[_0x8a03('0x5e')],null))[_0x8a03('0x12')](function(_0x5da021){if(!_0x20e0f9['body']['Imap'])return _0x5da021;return db[_0x8a03('0x5a')][_0x8a03('0x25')](_0x20e0f9[_0x8a03('0x5e')][_0x8a03('0x3f')],{'where':{'MailAccountId':_0x5da021['id']}})[_0x8a03('0x12')](function(){return _0x5da021;});})[_0x8a03('0x12')](function(_0xcc44f8){if(!_0x20e0f9[_0x8a03('0x5e')][_0x8a03('0x40')])return _0xcc44f8;return db['MailServerOut'][_0x8a03('0x25')](_0x20e0f9[_0x8a03('0x5e')]['Smtp'],{'where':{'MailAccountId':_0xcc44f8['id']}})['then'](function(){return _0xcc44f8;});})[_0x8a03('0x12')](respondWithResult(_0x2a4373,null))['catch'](handleError(_0x2a4373,null));};exports[_0x8a03('0x65')]=function(_0x18028e,_0x3e1338){return db[_0x8a03('0x42')][_0x8a03('0x65')]()[_0x8a03('0x12')](respondWithResult(_0x3e1338,null))[_0x8a03('0x1b')](handleError(_0x3e1338,null));};exports[_0x8a03('0x66')]=function(_0xc8a416,_0x49a29f){if(_0xc8a416['body']['id']){delete _0xc8a416[_0x8a03('0x5e')]['id'];}return db['MailAccount'][_0x8a03('0x62')]({'where':{'id':_0xc8a416[_0x8a03('0x63')]['id']}})['then'](handleEntityNotFound(_0x49a29f,null))[_0x8a03('0x12')](function(_0x430241){if(_0x430241){_0xc8a416[_0x8a03('0x5e')][_0x8a03('0x67')]=_0x430241['id'];return db[_0x8a03('0x68')][_0x8a03('0x69')](_0xc8a416[_0x8a03('0x5e')]);}})[_0x8a03('0x12')](respondWithResult(_0x49a29f,null))[_0x8a03('0x1b')](handleError(_0x49a29f,null));};exports[_0x8a03('0x6a')]=function(_0x41fcff,_0x4e38e0){var _0xac3bb8={'raw':![],'where':{}};var _0x3759cf={};var _0x10581b={'count':0x0,'rows':[]};return db['MailAccount'][_0x8a03('0x6b')]({'where':{'id':_0x41fcff[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x4e38e0,null))['then'](function(_0x39bbf6){if(_0x39bbf6){_0x3759cf[_0x8a03('0x45')]=_[_0x8a03('0x5c')](db[_0x8a03('0x68')][_0x8a03('0x43')]);_0x3759cf[_0x8a03('0x46')]=_[_0x8a03('0x5c')](_0x41fcff[_0x8a03('0x46')]);_0x3759cf[_0x8a03('0x47')]=_[_0x8a03('0x48')](_0x3759cf[_0x8a03('0x45')],_0x3759cf[_0x8a03('0x46')]);_0xac3bb8[_0x8a03('0x49')]=_[_0x8a03('0x48')](_0x3759cf[_0x8a03('0x45')],qs[_0x8a03('0x4a')](_0x41fcff[_0x8a03('0x46')][_0x8a03('0x4a')]));_0xac3bb8[_0x8a03('0x49')]=_0xac3bb8[_0x8a03('0x49')]['length']?_0xac3bb8[_0x8a03('0x49')]:_0x3759cf[_0x8a03('0x45')];if(!_0x41fcff['query'][_0x8a03('0x4b')]('nolimit')){_0xac3bb8[_0x8a03('0x21')]=qs['limit'](_0x41fcff[_0x8a03('0x46')][_0x8a03('0x21')]);_0xac3bb8['offset']=qs[_0x8a03('0x1f')](_0x41fcff[_0x8a03('0x46')]['offset']);}_0xac3bb8[_0x8a03('0x4d')]=qs[_0x8a03('0x4e')](_0x41fcff[_0x8a03('0x46')][_0x8a03('0x4e')]);_0xac3bb8[_0x8a03('0x4f')]=qs[_0x8a03('0x47')](_[_0x8a03('0x6c')](_0x41fcff[_0x8a03('0x46')],_0x3759cf[_0x8a03('0x47')]));_0xac3bb8[_0x8a03('0x4f')][_0x8a03('0x67')]=_0x39bbf6['id'];if(_0x41fcff[_0x8a03('0x46')][_0x8a03('0x50')]){_0xac3bb8[_0x8a03('0x4f')]=_[_0x8a03('0x51')](_0xac3bb8[_0x8a03('0x4f')],{'$or':_[_0x8a03('0x52')](_0xac3bb8[_0x8a03('0x49')],function(_0x1951b9){var _0x47317b={};_0x47317b[_0x1951b9]={'$like':'%'+_0x41fcff[_0x8a03('0x46')][_0x8a03('0x50')]+'%'};return _0x47317b;})});}_0xac3bb8=_[_0x8a03('0x51')]({},_0xac3bb8,_0x41fcff[_0x8a03('0x54')]);return db['Disposition'][_0x8a03('0x55')]({'where':_0xac3bb8[_0x8a03('0x4f')]})[_0x8a03('0x12')](function(_0x5eb5a5){_0x10581b['count']=_0x5eb5a5;if(_0x41fcff[_0x8a03('0x46')][_0x8a03('0x5d')]){_0xac3bb8[_0x8a03('0x56')]=[{'all':!![]}];}return db[_0x8a03('0x68')][_0x8a03('0x57')](_0xac3bb8);})['then'](function(_0x5b4592){_0x10581b['rows']=_0x5b4592;return _0x10581b;});}})[_0x8a03('0x12')](respondWithFilteredResult(_0x4e38e0,_0xac3bb8))[_0x8a03('0x1b')](handleError(_0x4e38e0,null));};exports['removeDispositions']=function(_0x156747,_0x126172){return db[_0x8a03('0x42')]['find']({'where':{'id':_0x156747[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x126172,null))[_0x8a03('0x12')](function(_0xf6a8f3){if(_0xf6a8f3){return _0xf6a8f3['removeDispositions'](_0x156747['query']['ids']);}})[_0x8a03('0x12')](respondWithStatusCode(_0x126172,null))['catch'](handleError(_0x126172,null));};exports[_0x8a03('0x6d')]=function(_0xf9f649,_0x490bdb){if(_0xf9f649[_0x8a03('0x5e')]['id']){delete _0xf9f649[_0x8a03('0x5e')]['id'];}return db[_0x8a03('0x42')][_0x8a03('0x62')]({'where':{'id':_0xf9f649['params']['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x490bdb,null))[_0x8a03('0x12')](function(_0x4776ae){if(_0x4776ae){_0xf9f649[_0x8a03('0x5e')][_0x8a03('0x67')]=_0x4776ae['id'];return db[_0x8a03('0x6e')]['create'](_0xf9f649[_0x8a03('0x5e')]);}})[_0x8a03('0x12')](respondWithResult(_0x490bdb,null))['catch'](handleError(_0x490bdb,null));};exports['getAnswers']=function(_0x363401,_0x2ac00a){var _0x3c4c87={'raw':![],'where':{}};var _0x4011be={};var _0xc1bf2a={'count':0x0,'rows':[]};return db[_0x8a03('0x42')][_0x8a03('0x6b')]({'where':{'id':_0x363401['params']['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x2ac00a,null))[_0x8a03('0x12')](function(_0x302ce8){if(_0x302ce8){_0x4011be[_0x8a03('0x45')]=_[_0x8a03('0x5c')](db['CannedAnswer'][_0x8a03('0x43')]);_0x4011be[_0x8a03('0x46')]=_['keys'](_0x363401[_0x8a03('0x46')]);_0x4011be[_0x8a03('0x47')]=_['intersection'](_0x4011be['model'],_0x4011be[_0x8a03('0x46')]);_0x3c4c87['attributes']=_[_0x8a03('0x48')](_0x4011be['model'],qs[_0x8a03('0x4a')](_0x363401['query'][_0x8a03('0x4a')]));_0x3c4c87[_0x8a03('0x49')]=_0x3c4c87[_0x8a03('0x49')][_0x8a03('0x6f')]?_0x3c4c87[_0x8a03('0x49')]:_0x4011be['model'];if(!_0x363401[_0x8a03('0x46')][_0x8a03('0x4b')](_0x8a03('0x4c'))){_0x3c4c87['limit']=qs[_0x8a03('0x21')](_0x363401['query'][_0x8a03('0x21')]);_0x3c4c87[_0x8a03('0x1f')]=qs[_0x8a03('0x1f')](_0x363401[_0x8a03('0x46')][_0x8a03('0x1f')]);}_0x3c4c87[_0x8a03('0x4d')]=qs[_0x8a03('0x4e')](_0x363401['query'][_0x8a03('0x4e')]);_0x3c4c87[_0x8a03('0x4f')]=qs['filters'](_['pick'](_0x363401['query'],_0x4011be['filters']));_0x3c4c87['where'][_0x8a03('0x67')]=_0x302ce8['id'];if(_0x363401['query'][_0x8a03('0x50')]){_0x3c4c87[_0x8a03('0x4f')]=_[_0x8a03('0x51')](_0x3c4c87[_0x8a03('0x4f')],{'$or':_[_0x8a03('0x52')](_0x3c4c87[_0x8a03('0x49')],function(_0x4c9f70){var _0x4fa35d={};_0x4fa35d[_0x4c9f70]={'$like':'%'+_0x363401[_0x8a03('0x46')]['filter']+'%'};return _0x4fa35d;})});}_0x3c4c87=_[_0x8a03('0x51')]({},_0x3c4c87,_0x363401['options']);return db[_0x8a03('0x6e')][_0x8a03('0x55')]({'where':_0x3c4c87['where']})[_0x8a03('0x12')](function(_0x17d9d7){_0xc1bf2a['count']=_0x17d9d7;if(_0x363401['query'][_0x8a03('0x5d')]){_0x3c4c87['include']=[{'all':!![]}];}return db[_0x8a03('0x6e')][_0x8a03('0x57')](_0x3c4c87);})[_0x8a03('0x12')](function(_0x3fd852){_0xc1bf2a[_0x8a03('0x58')]=_0x3fd852;return _0xc1bf2a;});}})[_0x8a03('0x12')](respondWithFilteredResult(_0x2ac00a,_0x3c4c87))['catch'](handleError(_0x2ac00a,null));};exports[_0x8a03('0x70')]=function(_0x449978,_0x161673){return db[_0x8a03('0x42')][_0x8a03('0x62')]({'where':{'id':_0x449978[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x161673,null))[_0x8a03('0x12')](function(_0x112200){if(_0x112200){return _0x112200[_0x8a03('0x70')](_0x449978[_0x8a03('0x46')][_0x8a03('0x71')]);}})[_0x8a03('0x12')](respondWithStatusCode(_0x161673,null))[_0x8a03('0x1b')](handleError(_0x161673,null));};exports[_0x8a03('0x69')]=function(_0x475deb,_0x300957){var _0x5531ff={'name':_0x475deb['body']['name'],'key':_0x475deb[_0x8a03('0x5e')][_0x8a03('0x72')],'provider':_0x475deb[_0x8a03('0x5e')][_0x8a03('0x5f')]===_0x8a03('0x60')?null:_0x475deb[_0x8a03('0x5e')]['provider'],'email':_0x475deb[_0x8a03('0x5e')][_0x8a03('0x73')],'ListId':_0x475deb[_0x8a03('0x5e')][_0x8a03('0x74')],'active':!_[_0x8a03('0x75')](_0x475deb[_0x8a03('0x5e')][_0x8a03('0x76')])?_0x475deb[_0x8a03('0x5e')][_0x8a03('0x76')]:!![],'description':_0x475deb[_0x8a03('0x5e')][_0x8a03('0x77')]||null};var _0x70dd05=getAuthenticationOptions(_0x5531ff[_0x8a03('0x5f')],_0x475deb[_0x8a03('0x5e')]);_0x5531ff[_0x8a03('0x3f')]=_0x70dd05[_0x8a03('0x3f')];_0x5531ff['Smtp']=_0x70dd05[_0x8a03('0x40')];return db['MailAccount'][_0x8a03('0x69')](_0x5531ff,{'include':[{'model':db[_0x8a03('0x41')],'as':_0x8a03('0x40')},{'model':db[_0x8a03('0x5a')],'as':'Imap'}]})[_0x8a03('0x12')](function(_0x23e7f8){var _0x1f8da2=_0x475deb[_0x8a03('0x35')][_0x8a03('0x27')]({'plain':!![]});if(!_0x1f8da2)throw new Error(_0x8a03('0x78'));if(_0x1f8da2[_0x8a03('0x79')]===_0x8a03('0x35')){var _0x4bb244=_0x23e7f8[_0x8a03('0x27')]({'plain':!![]});return db[_0x8a03('0x7a')]['find']({'where':{'name':_0x8a03('0x28'),'userProfileId':_0x1f8da2[_0x8a03('0x7b')]},'raw':!![]})[_0x8a03('0x12')](function(_0x908b54){if(_0x908b54&&_0x908b54[_0x8a03('0x7c')]===0x0){return db['UserProfileResource'][_0x8a03('0x69')]({'name':_0x4bb244['name'],'resourceId':_0x4bb244['id'],'type':_0x908b54[_0x8a03('0x2a')],'sectionId':_0x908b54['id']},{})[_0x8a03('0x12')](function(){return _0x23e7f8;});}else{return _0x23e7f8;}})[_0x8a03('0x1b')](function(_0x921c1b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x921c1b);throw _0x921c1b;});}return _0x23e7f8;})[_0x8a03('0x12')](respondWithResult(_0x300957,0xc9))[_0x8a03('0x1b')](handleError(_0x300957,null));};exports[_0x8a03('0x7d')]=function(_0x21170d,_0x13a223){return db['MailAccount'][_0x8a03('0x6b')]({'where':{'id':_0x21170d[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x13a223,null))['then'](function(_0x4e0bfa){if(_0x4e0bfa){return _0x4e0bfa['getImap']();}return null;})[_0x8a03('0x12')](respondWithResult(_0x13a223,null))[_0x8a03('0x1b')](handleError(_0x13a223,null));};exports['addImap']=function(_0x1f1593,_0x3d4ee9){if(_0x1f1593[_0x8a03('0x5e')]['id']){delete _0x1f1593[_0x8a03('0x5e')]['id'];}return db[_0x8a03('0x42')][_0x8a03('0x62')]({'where':{'id':_0x1f1593['params']['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x3d4ee9,null))[_0x8a03('0x12')](function(_0x870056){if(_0x870056){_0x1f1593['body']['MailAccountId']=_0x870056['id'];return db[_0x8a03('0x5a')][_0x8a03('0x69')](_0x1f1593[_0x8a03('0x5e')]);}})['then'](respondWithResult(_0x3d4ee9,null))[_0x8a03('0x1b')](handleError(_0x3d4ee9,null));};exports['removeImap']=function(_0x51ab10,_0x36c624){return db[_0x8a03('0x42')][_0x8a03('0x6b')]({'where':{'id':_0x51ab10[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x36c624,null))['then'](function(_0x431e1c){if(_0x431e1c){return _0x431e1c[_0x8a03('0x7e')](null);}return null;})[_0x8a03('0x12')](respondWithStatusCode(_0x36c624,null))['catch'](handleError(_0x36c624,null));};exports[_0x8a03('0x7f')]=function(_0x498981,_0x1ca6a8){return db[_0x8a03('0x42')][_0x8a03('0x6b')]({'where':{'id':_0x498981[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x1ca6a8,null))[_0x8a03('0x12')](function(_0x2f0ef6){if(_0x2f0ef6){return _0x2f0ef6[_0x8a03('0x7f')]();}return null;})['then'](respondWithResult(_0x1ca6a8,null))[_0x8a03('0x1b')](handleError(_0x1ca6a8,null));};exports[_0x8a03('0x80')]=function(_0x3584a8,_0x193fb1){if(_0x3584a8['body']['id']){delete _0x3584a8[_0x8a03('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3584a8[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x193fb1,null))[_0x8a03('0x12')](function(_0x336cb1){if(_0x336cb1){_0x3584a8[_0x8a03('0x5e')]['MailAccountId']=_0x336cb1['id'];return db[_0x8a03('0x41')]['create'](_0x3584a8[_0x8a03('0x5e')]);}})['then'](respondWithResult(_0x193fb1,null))[_0x8a03('0x1b')](handleError(_0x193fb1,null));};exports[_0x8a03('0x81')]=function(_0x19732f,_0x341214){return db[_0x8a03('0x42')]['findOne']({'where':{'id':_0x19732f[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x341214,null))[_0x8a03('0x12')](function(_0x970d81){if(_0x970d81){return _0x970d81['setSmtp'](null);}return null;})[_0x8a03('0x12')](respondWithStatusCode(_0x341214,null))[_0x8a03('0x1b')](handleError(_0x341214,null));};exports[_0x8a03('0x82')]=function(_0x1fe0c3,_0x477dd7){return db[_0x8a03('0x83')]['find']({'where':{'id':_0x1fe0c3[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x477dd7,null))[_0x8a03('0x12')](function(_0x55aba4){if(_0x55aba4){return _0x55aba4[_0x8a03('0x82')](_0x1fe0c3[_0x8a03('0x5e')]['ids'],_[_0x8a03('0x84')](_0x1fe0c3['body'],[_0x8a03('0x71'),'id'])||{});}})['then'](respondWithResult(_0x477dd7,null))[_0x8a03('0x1b')](handleError(_0x477dd7,null));};exports['getInteractions']=function(_0x2cc039,_0x41bc67){var _0x5da763={'raw':![],'where':{}};var _0x3d233a={};var _0x1faa68={'count':0x0,'rows':[]};return db[_0x8a03('0x42')][_0x8a03('0x6b')]({'where':{'id':_0x2cc039[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x41bc67,null))[_0x8a03('0x12')](function(_0x15aa91){if(_0x15aa91){_0x3d233a[_0x8a03('0x45')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x3d233a['query']=_['keys'](_0x2cc039[_0x8a03('0x46')]);_0x3d233a[_0x8a03('0x47')]=_[_0x8a03('0x48')](_0x3d233a[_0x8a03('0x45')],_0x3d233a[_0x8a03('0x46')]);_0x5da763['attributes']=_[_0x8a03('0x48')](_0x3d233a[_0x8a03('0x45')],qs['fields'](_0x2cc039[_0x8a03('0x46')][_0x8a03('0x4a')]));_0x5da763[_0x8a03('0x49')]=_0x5da763['attributes']['length']?_0x5da763[_0x8a03('0x49')]:_0x3d233a[_0x8a03('0x45')];if(!_0x2cc039[_0x8a03('0x46')][_0x8a03('0x4b')]('nolimit')){_0x5da763[_0x8a03('0x21')]=qs['limit'](_0x2cc039['query'][_0x8a03('0x21')]);_0x5da763['offset']=qs['offset'](_0x2cc039[_0x8a03('0x46')]['offset']);}_0x5da763[_0x8a03('0x4d')]=qs['sort'](_0x2cc039['query']['sort']);_0x5da763[_0x8a03('0x4f')]=qs[_0x8a03('0x47')](_['pick'](_0x2cc039[_0x8a03('0x46')],_0x3d233a[_0x8a03('0x47')]));_0x5da763[_0x8a03('0x4f')][_0x8a03('0x67')]=_0x15aa91['id'];if(_0x2cc039['query'][_0x8a03('0x50')]){_0x5da763[_0x8a03('0x4f')]=_[_0x8a03('0x51')](_0x5da763[_0x8a03('0x4f')],{'$or':_[_0x8a03('0x52')](_0x5da763[_0x8a03('0x49')],function(_0xbc4c7e){var _0x4bdefc={};_0x4bdefc[_0xbc4c7e]={'$like':'%'+_0x2cc039['query'][_0x8a03('0x50')]+'%'};return _0x4bdefc;})});}_0x5da763=_[_0x8a03('0x51')]({},_0x5da763,_0x2cc039[_0x8a03('0x54')]);return db['MailInteraction']['count']({'where':_0x5da763[_0x8a03('0x4f')]})[_0x8a03('0x12')](function(_0x507f46){_0x1faa68[_0x8a03('0x55')]=_0x507f46;if(_0x2cc039[_0x8a03('0x46')][_0x8a03('0x5d')]){_0x5da763[_0x8a03('0x56')]=[{'model':db[_0x8a03('0x85')],'as':_0x8a03('0x86'),'required':![]},{'model':db[_0x8a03('0x87')],'as':'Owner','attributes':[_0x8a03('0x2a'),_0x8a03('0x88'),_0x8a03('0x89')],'required':![]},{'model':db[_0x8a03('0x8a')],'as':_0x8a03('0x8b'),'attributes':['id','name',_0x8a03('0x8c')],'where':_0x2cc039[_0x8a03('0x46')]['tag']?{'id':_0x2cc039[_0x8a03('0x46')][_0x8a03('0x8d')]}:undefined,'required':_0x2cc039['query']['tag']?!![]:![]}];}return db[_0x8a03('0x83')]['findAll'](_0x5da763);})[_0x8a03('0x12')](function(_0x3a5335){_0x1faa68[_0x8a03('0x58')]=_0x3a5335;return _0x1faa68;});}})['then'](respondWithFilteredResult(_0x41bc67,_0x5da763))[_0x8a03('0x1b')](handleError(_0x41bc67,null));};exports[_0x8a03('0x8e')]=function addApplications(_0x388baa,_0x579cce){var _0x1a9c8d=_0x388baa[_0x8a03('0x63')]['id'];var _0x23da48=_0x388baa[_0x8a03('0x5e')];var _0x65e142=0xc8;var _0x520eee=null;return db[_0x8a03('0x8f')][_0x8a03('0x90')]({'isolationLevel':db['sequelize']['Transaction'][_0x8a03('0x91')][_0x8a03('0x92')]},function(_0x2a69cc){return db[_0x8a03('0x42')][_0x8a03('0x6b')]({'where':{'id':_0x1a9c8d},'transaction':_0x2a69cc})[_0x8a03('0x12')](function(_0x282539){if(_0x282539){return db['MailApplication'][_0x8a03('0x26')]({'where':{'MailAccountId':_0x1a9c8d},'transaction':_0x2a69cc})[_0x8a03('0x12')](function(){var _0x54fa97=_[_0x8a03('0x52')](_0x23da48,function(_0x4e62d4){_0x4e62d4[_0x8a03('0x67')]=_0x1a9c8d;return _0x4e62d4;});return db[_0x8a03('0x93')][_0x8a03('0x94')](_0x54fa97,{'transaction':_0x2a69cc});});}else{_0x65e142=0x194;_0x520eee=[];}});})[_0x8a03('0x12')](function(){if(_0x65e142!==0x194){return db[_0x8a03('0x93')][_0x8a03('0x95')]({'where':{'MailAccountId':_0x1a9c8d},'order':_0x8a03('0x96')})['then'](function(_0x2fa795){_0x520eee=_0x2fa795;});}})['catch'](function(_0x440be7){_0x65e142=0x1f4;logger[_0x8a03('0x18')](_0x440be7[_0x8a03('0x29')]);if(_0x440be7['name']){delete _0x440be7[_0x8a03('0x2a')];}_0x520eee=_0x440be7;})[_0x8a03('0x97')](function(){if(_0x520eee===null){_0x579cce[_0x8a03('0x1c')](_0x65e142);}else{if(_0x65e142===0x1f4){_0x579cce[_0x8a03('0x22')](_0x65e142)[_0x8a03('0x98')](_0x520eee);}else{_0x579cce[_0x8a03('0x22')](_0x65e142)[_0x8a03('0x1e')](_0x520eee);}}});};exports[_0x8a03('0x99')]=function(_0x2137f9,_0x48e3af){var _0x47a010={};var _0x4a5df1={};var _0x3650d7;var _0xdbc773;return db[_0x8a03('0x42')]['findOne']({'where':{'id':_0x2137f9[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x48e3af,null))[_0x8a03('0x12')](function(_0x16c4b5){if(_0x16c4b5){_0x3650d7=_0x16c4b5;_0x4a5df1[_0x8a03('0x45')]=_['keys'](db[_0x8a03('0x93')][_0x8a03('0x43')]);_0x4a5df1[_0x8a03('0x46')]=_['keys'](_0x2137f9[_0x8a03('0x46')]);_0x4a5df1[_0x8a03('0x47')]=_[_0x8a03('0x48')](_0x4a5df1[_0x8a03('0x45')],_0x4a5df1['query']);_0x47a010[_0x8a03('0x49')]=_[_0x8a03('0x48')](_0x4a5df1['model'],qs[_0x8a03('0x4a')](_0x2137f9[_0x8a03('0x46')][_0x8a03('0x4a')]));_0x47a010['attributes']=_0x47a010[_0x8a03('0x49')][_0x8a03('0x6f')]?_0x47a010['attributes']:_0x4a5df1[_0x8a03('0x45')];_0x47a010[_0x8a03('0x4d')]=qs[_0x8a03('0x4e')](_0x2137f9[_0x8a03('0x46')][_0x8a03('0x4e')]);_0x47a010[_0x8a03('0x4f')]=qs['filters'](_[_0x8a03('0x6c')](_0x2137f9[_0x8a03('0x46')],_0x4a5df1[_0x8a03('0x47')]));if(_0x2137f9[_0x8a03('0x46')][_0x8a03('0x50')]){_0x47a010[_0x8a03('0x4f')]=_[_0x8a03('0x51')](_0x47a010[_0x8a03('0x4f')],{'$or':_['map'](_0x47a010[_0x8a03('0x49')],function(_0x5c4ea3){var _0x5988d3={};_0x5988d3[_0x5c4ea3]={'$like':'%'+_0x2137f9['query'][_0x8a03('0x50')]+'%'};return _0x5988d3;})});}_0x47a010=_[_0x8a03('0x51')]({},_0x47a010,_0x2137f9[_0x8a03('0x54')]);return _0x3650d7[_0x8a03('0x99')](_0x47a010);}})[_0x8a03('0x12')](function(_0x2ec97a){if(_0x2ec97a){_0xdbc773=_0x2ec97a[_0x8a03('0x6f')];if(!_0x2137f9[_0x8a03('0x46')][_0x8a03('0x4b')](_0x8a03('0x4c'))){_0x47a010[_0x8a03('0x21')]=qs[_0x8a03('0x21')](_0x2137f9['query'][_0x8a03('0x21')]);_0x47a010[_0x8a03('0x1f')]=qs['offset'](_0x2137f9[_0x8a03('0x46')][_0x8a03('0x1f')]);}return _0x3650d7[_0x8a03('0x99')](_0x47a010);}})['then'](function(_0xc90307){if(_0xc90307){return _0xc90307?{'count':_0xdbc773,'rows':_0xc90307}:null;}})[_0x8a03('0x12')](respondWithResult(_0x48e3af,null))[_0x8a03('0x1b')](handleError(_0x48e3af,null));};exports[_0x8a03('0x9a')]=function(_0x3e9267,_0x232a6a){var _0x56853e={'raw':!![],'where':{}};var _0x134f22={};var _0x4dae1e={'count':0x0,'rows':[]};return db['MailAccount'][_0x8a03('0x6b')]({'where':{'id':_0x3e9267[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x232a6a,null))[_0x8a03('0x12')](function(_0x3dc2db){if(_0x3dc2db){_0x134f22['model']=_['keys'](db[_0x8a03('0x9b')]['rawAttributes']);_0x134f22[_0x8a03('0x46')]=_['keys'](_0x3e9267[_0x8a03('0x46')]);_0x134f22[_0x8a03('0x47')]=_[_0x8a03('0x48')](_0x134f22['model'],_0x134f22[_0x8a03('0x46')]);_0x56853e[_0x8a03('0x49')]=_['intersection'](_0x134f22[_0x8a03('0x45')],qs['fields'](_0x3e9267[_0x8a03('0x46')]['fields']));_0x56853e[_0x8a03('0x49')]=_0x56853e[_0x8a03('0x49')]['length']?_0x56853e[_0x8a03('0x49')]:_0x134f22[_0x8a03('0x45')];if(!_0x3e9267[_0x8a03('0x46')][_0x8a03('0x4b')]('nolimit')){_0x56853e[_0x8a03('0x21')]=qs[_0x8a03('0x21')](_0x3e9267[_0x8a03('0x46')][_0x8a03('0x21')]);_0x56853e[_0x8a03('0x1f')]=qs['offset'](_0x3e9267[_0x8a03('0x46')]['offset']);}_0x56853e[_0x8a03('0x4d')]=qs[_0x8a03('0x4e')](_0x3e9267[_0x8a03('0x46')][_0x8a03('0x4e')]);_0x56853e['where']=qs[_0x8a03('0x47')](_[_0x8a03('0x6c')](_0x3e9267['query'],_0x134f22['filters']));_0x56853e[_0x8a03('0x4f')][_0x8a03('0x67')]=_0x3dc2db['id'];if(_0x3e9267[_0x8a03('0x46')][_0x8a03('0x50')]){_0x56853e[_0x8a03('0x4f')]=_[_0x8a03('0x51')](_0x56853e['where'],{'$or':_[_0x8a03('0x52')](_0x56853e[_0x8a03('0x49')],function(_0x5b26ab){var _0x14d756={};_0x14d756[_0x5b26ab]={'$like':'%'+_0x3e9267['query'][_0x8a03('0x50')]+'%'};return _0x14d756;})});}if(_0x3e9267[_0x8a03('0x46')][_0x8a03('0x9c')]){var _0x7421b=_0x3e9267[_0x8a03('0x46')]['$gte']['split'](',');var _0x571eee={};_0x571eee[_0x7421b[0x0]]={'$gte':moment(_0x7421b[0x1])[_0x8a03('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x56853e[_0x8a03('0x4f')]=_['merge'](_0x56853e['where'],_0x571eee);}_0x56853e=_[_0x8a03('0x51')]({},_0x56853e,_0x3e9267[_0x8a03('0x54')]);return db['MailMessage'][_0x8a03('0x55')]({'where':_0x56853e[_0x8a03('0x4f')]})[_0x8a03('0x12')](function(_0xa8b8cc){_0x4dae1e[_0x8a03('0x55')]=_0xa8b8cc;if(_0x3e9267['query'][_0x8a03('0x5d')]){_0x56853e[_0x8a03('0x56')]=[{'all':!![]}];}return db[_0x8a03('0x9b')]['findAll'](_0x56853e);})[_0x8a03('0x12')](function(_0x584792){if(_0x3e9267['query'][_0x8a03('0x9e')]==='true'){for(var _0x51725c=0x0;_0x51725c<_0x584792[_0x8a03('0x6f')];_0x51725c++){_0x584792[_0x51725c][_0x8a03('0x5e')]=juice(_0x584792[_0x51725c][_0x8a03('0x5e')]);}}_0x4dae1e[_0x8a03('0x58')]=_0x584792;return _0x4dae1e;});}})[_0x8a03('0x12')](respondWithFilteredResult(_0x232a6a,_0x56853e))[_0x8a03('0x1b')](handleError(_0x232a6a,null));};exports[_0x8a03('0x98')]=function(_0xa3f705,_0x29d5c5){var _0x5392ed,_0x308fec={},_0x3fdb10;if(_0xa3f705[_0x8a03('0x5e')]['to']){_0x3fdb10=_0xa3f705['body']['to'][_0x8a03('0x9f')](',')[0x0];}return db[_0x8a03('0x42')][_0x8a03('0x62')]({'where':{'id':_0xa3f705['params']['id']},'include':[{'model':db[_0x8a03('0xa0')],'as':_0x8a03('0xa1'),'include':[{'model':db[_0x8a03('0x85')],'as':_0x8a03('0xa2'),'where':{'email':_0x3fdb10},'limit':0x1,'order':[[_0x8a03('0xa3'),_0x8a03('0xa4')]]}]},{'model':db[_0x8a03('0x41')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8a03('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0x8a03('0x12')](handleEntityNotFound(_0x29d5c5,null))['then'](function(_0x329429){if(!_0x329429)return;_0x5392ed=_0x329429;if(!_0x329429[_0x8a03('0x40')])throw new Error(_0x8a03('0xa6'));if(_[_0x8a03('0x75')](_0xa3f705[_0x8a03('0x5e')][_0x8a03('0xa7')])){_0xa3f705[_0x8a03('0x5e')][_0x8a03('0xa7')]=util[_0x8a03('0x9d')](_0x8a03('0xa8'),_0x329429[_0x8a03('0x2a')],_0x329429[_0x8a03('0x73')]||_0x329429[_0x8a03('0x40')][_0x8a03('0x35')]);}if(_0xa3f705[_0x8a03('0x5e')]['attachments']&&_0xa3f705[_0x8a03('0x5e')][_0x8a03('0xa9')][_0x8a03('0x6f')]){for(var _0x4124ad=0x0;_0x4124ad<_0xa3f705[_0x8a03('0x5e')][_0x8a03('0xa9')][_0x8a03('0x6f')];_0x4124ad+=0x1){_0xa3f705[_0x8a03('0x5e')][_0x8a03('0xa9')][_0x4124ad]={'filename':_0xa3f705[_0x8a03('0x5e')]['attachments'][_0x4124ad][_0x8a03('0x2a')],'path':path['join'](config[_0x8a03('0xaa')],_0x8a03('0xab'),_0xa3f705['body'][_0x8a03('0xa9')][_0x4124ad][_0x8a03('0xac')])};}}var _0x5a52d2=_0x329429[_0x8a03('0xad')]();return respondWithRpcPromise(_0x8a03('0xae'),_0x8a03('0xaf'),{'account':_0x5a52d2,'message':_0xa3f705[_0x8a03('0x5e')]});})[_0x8a03('0x12')](function(_0x33f093){if(!_0x33f093)return;_0x308fec=_0x33f093;if(!_0x5392ed[_0x8a03('0xa1')])throw new Error(_0x8a03('0xb0'));if(_0x5392ed[_0x8a03('0xa1')][_0x8a03('0xa2')][_0x8a03('0x6f')])return _0x5392ed['List'][_0x8a03('0xa2')][0x0];return db[_0x8a03('0x85')][_0x8a03('0x69')](_[_0x8a03('0xb1')](_0xa3f705['body'],{'firstName':_0xa3f705[_0x8a03('0x5e')]['to'],'email':_0xa3f705[_0x8a03('0x5e')]['to'],'phone':_0xa3f705[_0x8a03('0x5e')]['to'],'ListId':_0x5392ed[_0x8a03('0x74')]}));})['then'](function(_0xcc2921){if(!_0xcc2921)return;var _0x4761fc={'UserId':_0xa3f705[_0x8a03('0x35')]['id'],'ContactId':_0xcc2921['id'],'MailAccountId':_0x5392ed['id'],'inReplyTo':_0x308fec[_0x8a03('0xb2')],'to':_0xa3f705[_0x8a03('0x5e')][_0x8a03('0xa7')],'cc':_0xa3f705['body']['cc'],'subject':_0xa3f705[_0x8a03('0x5e')]['subject'],'attach':_0xa3f705[_0x8a03('0x5e')][_0x8a03('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x8a03('0xb4')),'lastMsgDirection':_0x8a03('0xb5'),'Messages':[_[_0x8a03('0x51')](_0xa3f705[_0x8a03('0x5e')],{'messageId':_0x308fec[_0x8a03('0xb2')],'sentAt':moment()[_0x8a03('0x9d')](_0x8a03('0xb4')),'read':!![],'MailAccountId':_0x5392ed['id'],'UserId':_0xa3f705[_0x8a03('0x35')]['id'],'ContactId':_0xcc2921['id']})]};if(_0xa3f705[_0x8a03('0x5e')]['Interaction']){_0x4761fc=_[_0x8a03('0x51')](_0x4761fc,_0xa3f705[_0x8a03('0x5e')]['Interaction']);}return db[_0x8a03('0x83')][_0x8a03('0x69')](_0x4761fc,{'include':[{'model':db[_0x8a03('0x9b')],'as':_0x8a03('0xb6')}]});})[_0x8a03('0x12')](respondWithResult(_0x29d5c5,null))[_0x8a03('0x1b')](handleError(_0x29d5c5,null));};exports[_0x8a03('0xb7')]=function(_0x428f74,_0x4c1ba1){return db[_0x8a03('0x42')]['find']({'where':{'id':_0x428f74[_0x8a03('0x63')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x8a03('0x40'),'raw':!![],'include':[{'model':db[_0x8a03('0xa5')],'as':_0x8a03('0xa5'),'raw':!![]}]}]})[_0x8a03('0x12')](handleEntityNotFound(_0x4c1ba1,null))['then'](function(_0x15f118){if(!_0x15f118[_0x8a03('0x40')])return;var _0x23ea82=_0x15f118[_0x8a03('0xad')]();return respondWithRpcPromise(_0x8a03('0xb8'),_0x8a03('0xb7'),{'account':_0x23ea82});})[_0x8a03('0x12')](respondWithResult(_0x4c1ba1,null))['catch'](handleError(_0x4c1ba1,null));};exports['destroy']=function(_0x111fd0,_0x5c8164){return db[_0x8a03('0x42')][_0x8a03('0x62')]({'where':{'id':_0x111fd0[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x5c8164,null))['then'](function(_0x3627fb){if(_0x3627fb&&_0x3627fb['service']){throw new db[(_0x8a03('0xb9'))][(_0x8a03('0xba'))](_0x8a03('0xbb'));}return _0x3627fb;})[_0x8a03('0x12')](removeEntity(_0x5c8164,null))[_0x8a03('0x1b')](handleError(_0x5c8164,null));};exports[_0x8a03('0xbc')]=function(_0x1a5c95,_0x4cc145){return db[_0x8a03('0x42')]['find']({'where':{'id':_0x1a5c95['params']['id']}})['then'](handleEntityNotFound(_0x4cc145,null))['then'](function(_0x27bb25){if(_0x27bb25){return _0x27bb25['addAgents'](_0x1a5c95[_0x8a03('0x5e')]['ids'],_[_0x8a03('0x84')](_0x1a5c95[_0x8a03('0x5e')],[_0x8a03('0x71'),'id'])||{})[_0x8a03('0xbd')](function(_0x3499b9){for(var _0x55b32e=0x0;_0x55b32e<_0x1a5c95[_0x8a03('0x5e')][_0x8a03('0x71')][_0x8a03('0x6f')];_0x55b32e+=0x1){socket[_0x8a03('0xbe')](_0x8a03('0xbf'),{'UserId':Number(_0x1a5c95[_0x8a03('0x5e')][_0x8a03('0x71')][_0x55b32e]),'MailAccountId':Number(_0x1a5c95[_0x8a03('0x63')]['id'])});}return _0x3499b9;});}})[_0x8a03('0x12')](respondWithResult(_0x4cc145,null))[_0x8a03('0x1b')](handleError(_0x4cc145,null));};exports['removeAgents']=function(_0x1be37a,_0x2da1b9){return db[_0x8a03('0x42')]['find']({'where':{'id':_0x1be37a[_0x8a03('0x63')]['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x2da1b9,null))[_0x8a03('0x12')](function(_0x20a0fc){if(_0x20a0fc){return _0x20a0fc['removeAgents'](_0x1be37a[_0x8a03('0x46')][_0x8a03('0x71')])[_0x8a03('0x12')](function(){if(_[_0x8a03('0xc0')](_0x1be37a[_0x8a03('0x46')][_0x8a03('0x71')])){for(var _0x5b8946=0x0;_0x5b8946<_0x1be37a['query']['ids'][_0x8a03('0x6f')];_0x5b8946+=0x1){socket[_0x8a03('0xbe')](_0x8a03('0xc1'),{'UserId':Number(_0x1be37a[_0x8a03('0x46')][_0x8a03('0x71')][_0x5b8946]),'MailAccountId':Number(_0x1be37a[_0x8a03('0x63')]['id'])});}}else{socket[_0x8a03('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x1be37a[_0x8a03('0x46')]['ids']),'MailAccountId':Number(_0x1be37a[_0x8a03('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x2da1b9,null))['catch'](handleError(_0x2da1b9,null));};exports[_0x8a03('0xc2')]=function(_0x1f3481,_0x31e798){var _0x148f2b={};var _0x1fc3e8={};var _0x2d4a82;var _0x4a50e7;return db[_0x8a03('0x42')][_0x8a03('0x6b')]({'where':{'id':_0x1f3481['params']['id']}})[_0x8a03('0x12')](handleEntityNotFound(_0x31e798,null))[_0x8a03('0x12')](function(_0x43db61){if(_0x43db61){_0x2d4a82=_0x43db61;_0x1fc3e8['model']=_['keys'](db[_0x8a03('0x87')][_0x8a03('0x43')]);_0x1fc3e8[_0x8a03('0x46')]=_[_0x8a03('0x5c')](_0x1f3481[_0x8a03('0x46')]);_0x1fc3e8[_0x8a03('0x47')]=_['intersection'](_0x1fc3e8[_0x8a03('0x45')],_0x1fc3e8[_0x8a03('0x46')]);_0x148f2b['attributes']=_['intersection'](_0x1fc3e8['model'],qs[_0x8a03('0x4a')](_0x1f3481[_0x8a03('0x46')]['fields']));_0x148f2b[_0x8a03('0x49')]=_0x148f2b[_0x8a03('0x49')][_0x8a03('0x6f')]?_0x148f2b[_0x8a03('0x49')]:_0x1fc3e8[_0x8a03('0x45')];_0x148f2b[_0x8a03('0x4d')]=qs[_0x8a03('0x4e')](_0x1f3481[_0x8a03('0x46')][_0x8a03('0x4e')]);_0x148f2b[_0x8a03('0x4f')]=qs[_0x8a03('0x47')](_['pick'](_0x1f3481[_0x8a03('0x46')],_0x1fc3e8['filters']));if(_0x1f3481['query'][_0x8a03('0x50')]){_0x148f2b[_0x8a03('0x4f')]=_['merge'](_0x148f2b['where'],{'$or':_[_0x8a03('0x52')](_0x148f2b[_0x8a03('0x49')],function(_0xb7251b){var _0x32a076={};_0x32a076[_0xb7251b]={'$like':'%'+_0x1f3481[_0x8a03('0x46')][_0x8a03('0x50')]+'%'};return _0x32a076;})});}_0x148f2b=_[_0x8a03('0x51')]({},_0x148f2b,_0x1f3481[_0x8a03('0x54')]);return _0x2d4a82[_0x8a03('0xc2')](_0x148f2b);}})[_0x8a03('0x12')](function(_0x16d555){if(_0x16d555){_0x4a50e7=_0x16d555['length'];if(!_0x1f3481[_0x8a03('0x46')]['hasOwnProperty'](_0x8a03('0x4c'))){_0x148f2b[_0x8a03('0x21')]=qs['limit'](_0x1f3481[_0x8a03('0x46')][_0x8a03('0x21')]);_0x148f2b['offset']=qs[_0x8a03('0x1f')](_0x1f3481[_0x8a03('0x46')]['offset']);}return _0x2d4a82[_0x8a03('0xc2')](_0x148f2b);}})['then'](function(_0x574ed1){if(_0x574ed1){return _0x574ed1?{'count':_0x4a50e7,'rows':_0x574ed1}:null;}})['then'](respondWithResult(_0x31e798,null))[_0x8a03('0x1b')](handleError(_0x31e798,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c76d28f..9f86098 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 _0xfbc5=['MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xfbc5,0x1ab));var _0x5fbc=function(_0x341271,_0x234e68){_0x341271=_0x341271-0x0;var _0x42afdf=_0xfbc5[_0x341271];return _0x42afdf;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x5fbc('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5fbc('0x1')](0x0);var events={'afterCreate':_0x5fbc('0x2'),'afterUpdate':_0x5fbc('0x3'),'afterDestroy':'remove'};function emitEvent(_0xe26562){return function(_0x778a40,_0x244bdd,_0x5e142c){MailAccountEvents['emit'](_0xe26562+':'+_0x778a40['id'],_0x778a40);MailAccountEvents[_0x5fbc('0x4')](_0xe26562,_0x778a40);_0x5e142c(null);};}for(var e in events){if(events[_0x5fbc('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x5fbc('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x8fd4=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x897bb5,_0x4a8ce9){var _0x1b3382=function(_0x2248dd){while(--_0x2248dd){_0x897bb5['push'](_0x897bb5['shift']());}};_0x1b3382(++_0x4a8ce9);}(_0x8fd4,0x178));var _0x48fd=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x8fd4[_0x4e9d3c];return _0x2d0825;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x48fd('0x0'))['db'][_0x48fd('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x48fd('0x2')](0x0);var events={'afterCreate':_0x48fd('0x3'),'afterUpdate':_0x48fd('0x4'),'afterDestroy':_0x48fd('0x5')};function emitEvent(_0x40b428){return function(_0x50943a,_0x2e14ba,_0x211c3c){MailAccountEvents['emit'](_0x40b428+':'+_0x50943a['id'],_0x50943a);MailAccountEvents[_0x48fd('0x6')](_0x40b428,_0x50943a);_0x211c3c(null);};}for(var e in events){if(events[_0x48fd('0x7')](e)){var event=events[e];MailAccount[_0x48fd('0x8')](e,emitEvent(event));}}module[_0x48fd('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index caf27ea..591a8c3 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 _0x93ff=['MailAccount','mail_accounts','provider','custom','host','Smtp','port','secure','authentication','CloudProvider','auth','data5','user','pass','./mailAccount.attributes','exports','define'];(function(_0xe4d41c,_0x2f15ca){var _0xc0a09d=function(_0x579c15){while(--_0x579c15){_0xe4d41c['push'](_0xe4d41c['shift']());}};_0xc0a09d(++_0x2f15ca);}(_0x93ff,0xa7));var _0xf93f=function(_0x57d11b,_0x2a4299){_0x57d11b=_0x57d11b-0x0;var _0x63ad6e=_0x93ff[_0x57d11b];return _0x63ad6e;};'use strict';var attributes=require(_0xf93f('0x0'));module[_0xf93f('0x1')]=function(_0x51587f){return _0x51587f[_0xf93f('0x2')](_0xf93f('0x3'),attributes,{'tableName':_0xf93f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1bb901=this;var _0x33225a={'id':_0x1bb901['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1bb901[_0xf93f('0x5')]!==_0xf93f('0x6')){_0x33225a['service']=_0x1bb901[_0xf93f('0x5')];}else{_0x33225a[_0xf93f('0x7')]=_0x1bb901['Smtp'][_0xf93f('0x7')];_0x33225a['port']=_0x1bb901[_0xf93f('0x8')][_0xf93f('0x9')];_0x33225a[_0xf93f('0xa')]=_0x1bb901[_0xf93f('0x8')]['secure'];}if(_0x1bb901[_0xf93f('0x8')][_0xf93f('0xb')]){if(_0x1bb901[_0xf93f('0x8')]['modernAuthentication']){if(!_0x1bb901['Smtp'][_0xf93f('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x33225a[_0xf93f('0xd')]={'type':'OAuth2','user':_0x1bb901[_0xf93f('0x8')]['user'],'accessToken':_0x1bb901[_0xf93f('0x8')]['CloudProvider'][_0xf93f('0xe')]};}else{_0x33225a['auth']={'user':_0x1bb901[_0xf93f('0x8')][_0xf93f('0xf')],'pass':_0x1bb901[_0xf93f('0x8')][_0xf93f('0x10')]};}}return _0x33225a;}}});}; \ No newline at end of file +var _0x4392=['port','authentication','modernAuthentication','auth','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','host','Smtp'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x4392,0xb7));var _0x2439=function(_0x1d219c,_0x50820a){_0x1d219c=_0x1d219c-0x0;var _0x3d9fde=_0x4392[_0x1d219c];return _0x3d9fde;};'use strict';var attributes=require(_0x2439('0x0'));module[_0x2439('0x1')]=function(_0x5a018a){return _0x5a018a[_0x2439('0x2')](_0x2439('0x3'),attributes,{'tableName':_0x2439('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1b5528=this;var _0x3e6930={'id':_0x1b5528['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1b5528['provider']!==_0x2439('0x5')){_0x3e6930[_0x2439('0x6')]=_0x1b5528['provider'];}else{_0x3e6930[_0x2439('0x7')]=_0x1b5528[_0x2439('0x8')][_0x2439('0x7')];_0x3e6930[_0x2439('0x9')]=_0x1b5528[_0x2439('0x8')]['port'];_0x3e6930['secure']=_0x1b5528['Smtp']['secure'];}if(_0x1b5528[_0x2439('0x8')][_0x2439('0xa')]){if(_0x1b5528[_0x2439('0x8')][_0x2439('0xb')]){if(!_0x1b5528[_0x2439('0x8')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3e6930[_0x2439('0xc')]={'type':'OAuth2','user':_0x1b5528[_0x2439('0x8')][_0x2439('0xd')],'accessToken':_0x1b5528['Smtp']['CloudProvider'][_0x2439('0xe')]};}else{_0x3e6930[_0x2439('0xc')]={'user':_0x1b5528[_0x2439('0x8')]['user'],'pass':_0x1b5528[_0x2439('0x8')][_0x2439('0xf')]};}}return _0x3e6930;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c69545f..022a300 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 _0xadb5=['ShowMailAccount','smtp','setDataValue','getSmtpOptions','body','mail','difference','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','Smtp','account','list','applications','orderBy','priority','asc','autoclose','push','length','close','from','then','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','interaction','get','created','attachments','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify'];(function(_0x2725c5,_0xcb756e){var _0x5de0e0=function(_0x1e80a0){while(--_0x1e80a0){_0x2725c5['push'](_0x2725c5['shift']());}};_0x5de0e0(++_0xcb756e);}(_0xadb5,0xad));var _0x5adb=function(_0x7fe8bf,_0x47384c){_0x7fe8bf=_0x7fe8bf-0x0;var _0x11c286=_0xadb5[_0x7fe8bf];return _0x11c286;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var BPromise=require('bluebird');var rs=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var db=require(_0x5adb('0x3'))['db'];var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var jayson=require(_0x5adb('0x6'));var client=jayson['client'][_0x5adb('0x7')]({'port':0x232c});config[_0x5adb('0x8')]=_[_0x5adb('0x9')](config[_0x5adb('0x8')],{'host':_0x5adb('0xa'),'port':0x18eb});var socket=require(_0x5adb('0xb'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xc'))[_0x5adb('0xd')](socket);function respondWithRpcPromise(_0x7293ab,_0x34f59d,_0x336bad){return new BPromise(function(_0x129f5a,_0x275428){return client['request'](_0x7293ab,_0x336bad)['then'](function(_0x1a8f66){logger[_0x5adb('0xe')](_0x5adb('0xf'),_0x34f59d,'request\x20sent');logger[_0x5adb('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x34f59d,_0x5adb('0x11'),JSON['stringify'](_0x1a8f66));if(_0x1a8f66[_0x5adb('0x12')]){if(_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x13')]===0x1f4){logger['error'](_0x5adb('0xf'),_0x34f59d,_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);return _0x275428(_0x1a8f66['error'][_0x5adb('0x14')]);}logger['error'](_0x5adb('0xf'),_0x34f59d,_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);return _0x129f5a(_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);}else{logger[_0x5adb('0xe')](_0x5adb('0xf'),_0x34f59d,_0x5adb('0x11'));_0x129f5a(_0x1a8f66[_0x5adb('0x15')]['message']);}})[_0x5adb('0x16')](function(_0x5de028){logger[_0x5adb('0x12')]('MailAccount,\x20%s,\x20%s',_0x34f59d,_0x5de028);_0x275428(_0x5de028);});});}exports[_0x5adb('0x17')]=function(_0x50e84f){var _0x5e218c=this;return new Promise(function(_0x1fbaa5,_0x1bed20){return db[_0x5adb('0x18')][_0x5adb('0x19')]({'raw':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f['options'][_0x5adb('0x1b')]===undefined?!![]:![]:!![],'where':_0x50e84f['options']?_0x50e84f['options'][_0x5adb('0x1c')]||null:null,'attributes':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1d')]||null:null,'limit':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1e')]||null:null,'include':_0x50e84f['options']?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1f')],function(_0x49f203){return{'model':db[_0x49f203[_0x5adb('0x21')]],'as':_0x49f203['as'],'attributes':_0x49f203[_0x5adb('0x1d')],'include':_0x49f203['include']?_[_0x5adb('0x20')](_0x49f203[_0x5adb('0x1f')],function(_0x1a0acd){return{'model':db[_0x1a0acd['model']],'as':_0x1a0acd['as'],'attributes':_0x1a0acd[_0x5adb('0x1d')],'include':_0x1a0acd[_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x1a0acd[_0x5adb('0x1f')],function(_0x36459b){return{'model':db[_0x36459b[_0x5adb('0x21')]],'as':_0x36459b['as'],'attributes':_0x36459b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d457e){logger[_0x5adb('0xe')](_0x5adb('0x17'),_0x50e84f);logger[_0x5adb('0x10')](_0x5adb('0x17'),_0x50e84f,JSON[_0x5adb('0x22')](_0x5d457e));_0x1fbaa5(_0x5d457e);})['catch'](function(_0x11ec2a){logger[_0x5adb('0x12')](_0x5adb('0x17'),_0x11ec2a[_0x5adb('0x14')],_0x50e84f);_0x1bed20(_0x5e218c[_0x5adb('0x12')](0x1f4,_0x11ec2a[_0x5adb('0x14')]));});});};exports[_0x5adb('0x23')]=function(_0x28bf1f){var _0x138bf6=this;return new Promise(function(_0x260295,_0x4790f1){return db[_0x5adb('0x18')]['find']({'raw':_0x28bf1f[_0x5adb('0x1a')]?_0x28bf1f[_0x5adb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28bf1f[_0x5adb('0x1a')]?_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1c')]||null:null,'attributes':_0x28bf1f['options']?_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1d')]||null:null,'include':_0x28bf1f['options']?_0x28bf1f['options'][_0x5adb('0x1f')]?_['map'](_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1f')],function(_0x3c2b07){return{'model':db[_0x3c2b07[_0x5adb('0x21')]],'as':_0x3c2b07['as'],'attributes':_0x3c2b07[_0x5adb('0x1d')],'include':_0x3c2b07['include']?_[_0x5adb('0x20')](_0x3c2b07[_0x5adb('0x1f')],function(_0x1c3a5c){return{'model':db[_0x1c3a5c['model']],'as':_0x1c3a5c['as'],'attributes':_0x1c3a5c['attributes'],'include':_0x1c3a5c[_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x1c3a5c['include'],function(_0x2355bc){return{'model':db[_0x2355bc['model']],'as':_0x2355bc['as'],'attributes':_0x2355bc[_0x5adb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11cb37){if(_0x28bf1f['options'][_0x5adb('0x24')]===!![])_0x11cb37[_0x5adb('0x25')]('smtpOptions',_0x11cb37[_0x5adb('0x26')]());logger['info'](_0x5adb('0x23'),_0x28bf1f);logger[_0x5adb('0x10')](_0x5adb('0x23'),_0x28bf1f,JSON['stringify'](_0x11cb37));_0x260295(_0x11cb37);})[_0x5adb('0x16')](function(_0x2b3b0b){logger[_0x5adb('0x12')](_0x5adb('0x23'),_0x2b3b0b[_0x5adb('0x14')],_0x28bf1f);_0x4790f1(_0x138bf6['error'](0x1f4,_0x2b3b0b['message']));});});};exports['NotifyMailAccount']=function(_0x599999){var _0x427c71=this;return new Promise(function(_0x2fbe14,_0x3a104a){var _0x399489={'body':_0x599999[_0x5adb('0x27')],'channel':_0x5adb('0x28')};var _0x2c69a8=_[_0x5adb('0x29')](_['keys'](db['CmContact'][_0x5adb('0x2a')]),['createdAt',_0x5adb('0x2b'),_0x5adb('0x2c'),_0x5adb('0x2d')]);var _0x121714=![];if(_0x599999[_0x5adb('0x27')]['id']){delete _0x599999['body']['id'];}if(_[_0x5adb('0x2e')](_0x599999[_0x5adb('0x27')]['from'])){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x2f')));}if(_['isNil'](_0x599999[_0x5adb('0x27')][_0x5adb('0x27')])||_0x599999[_0x5adb('0x27')][_0x5adb('0x27')]===''){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x30')));}if(_[_0x5adb('0x2e')](_0x599999['body']['mapKey'])){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x31')+_0x2c69a8));}if(!_[_0x5adb('0x32')](_0x2c69a8,_0x599999[_0x5adb('0x27')]['mapKey'])){return _0x3a104a(_0x427c71['error'](0x1f4,_0x5adb('0x33')+_0x2c69a8));}var _0x4d7d86={};_0x4d7d86[_0x599999[_0x5adb('0x27')][_0x5adb('0x34')]]=_0x599999[_0x5adb('0x27')]['from'];return db[_0x5adb('0x18')][_0x5adb('0x35')]({'where':{'id':_0x599999['account']['id']},'include':[{'model':db[_0x5adb('0x36')],'as':_0x5adb('0x37'),'include':[{'model':db[_0x5adb('0x38')],'as':_0x5adb('0x39'),'where':_0x4d7d86,'limit':0x1,'order':[[_0x5adb('0x2b'),_0x5adb('0x3a')]]}]},{'model':db[_0x5adb('0x3b')],'as':_0x5adb('0x3c')},{'model':db['MailServerOut'],'as':_0x5adb('0x3d'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x3cd211){if(_0x3cd211&&_0x3cd211[_0x5adb('0x37')]){var _0x207a81=_0x3cd211['get']({'plain':!![]});_0x399489[_0x5adb('0x3e')]=_['omit'](_0x207a81,[_0x5adb('0x3c'),_0x5adb('0x37')]);_0x399489[_0x5adb('0x3e')]['smtpOptions']=_0x3cd211[_0x5adb('0x26')]();_0x399489['applications']=_0x207a81[_0x5adb('0x3c')];_0x399489[_0x5adb('0x3f')]=_0x207a81['List'];_0x399489[_0x5adb('0x40')]=_[_0x5adb('0x41')](_0x399489[_0x5adb('0x40')],[_0x5adb('0x42')],[_0x5adb('0x43')]);if(_0x399489['account']&&_0x399489[_0x5adb('0x3e')][_0x5adb('0x44')]){_0x399489[_0x5adb('0x40')][_0x5adb('0x45')]({'id':0x0,'priority':_0x399489['applications'][_0x5adb('0x46')]+0x1,'app':_0x5adb('0x47'),'appdata':_0x5adb('0x44'),'interval':'*,*,*,*'});}if(_0x399489[_0x5adb('0x3e')][_0x5adb('0x3c')]){delete _0x399489[_0x5adb('0x3e')][_0x5adb('0x3c')];}if(_0x399489['account'][_0x5adb('0x37')]){delete _0x399489[_0x5adb('0x3e')][_0x5adb('0x37')];}if(_0x207a81[_0x5adb('0x37')][_0x5adb('0x39')]['length']){return _0x207a81[_0x5adb('0x37')]['Contacts'][0x0];}var _0x2b790d=_['defaults'](_0x599999[_0x5adb('0x27')],{'firstName':_0x599999[_0x5adb('0x27')][_0x5adb('0x48')],'ListId':_0x207a81[_0x5adb('0x2d')]});_0x2b790d[_0x599999['body'][_0x5adb('0x34')]]=_0x599999[_0x5adb('0x27')][_0x5adb('0x48')];return db['CmContact']['create'](_0x2b790d);}else{throw new Error('List\x20not\x20found');}})[_0x5adb('0x49')](function(_0x31a1f9){_0x399489[_0x5adb('0x4a')]=_0x31a1f9;if(_0x31a1f9){if(!_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')]){_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')]=rs[_0x5adb('0x4c')]()+'\x20'+_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x48')];}var _0x511746={'ContactId':_0x31a1f9['id'],'MailAccountId':_0x599999['account']['id'],'inReplyTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'to':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x48')],'cc':_0x599999[_0x5adb('0x27')]['message']['cc'],'subject':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4d')],'attach':_0x599999['body'][_0x5adb('0x14')][_0x5adb('0x4e')],'lastMsgAt':moment()[_0x5adb('0x4f')](_0x5adb('0x50')),'lastMsgDirection':'in'};return db[_0x5adb('0x51')][_0x5adb('0x35')]({'where':{'closed':![],'MailAccountId':_0x599999['account']['id']},'include':[{'model':db[_0x5adb('0x52')],'as':_0x5adb('0x53'),'attributes':[_0x5adb('0x4b')],'where':{'messageId':_0x599999['body'][_0x5adb('0x14')][_0x5adb('0x54')]}}]})[_0x5adb('0x49')](function(_0x4f6107){if(_0x4f6107){return[_0x4f6107,![]];}return db[_0x5adb('0x51')]['create'](_0x511746)[_0x5adb('0x49')](function(_0x1e7e3a){return[_0x1e7e3a,!![]];});});}else{throw new Error(_0x5adb('0x55'));}})['spread'](function(_0x192b1f,_0x3627d1){if(_0x192b1f){_0x121714=_0x3627d1;if(!_0x3627d1){return _0x192b1f['update']({'inReplyTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'to':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x48')],'cc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['cc'],'subject':_0x599999[_0x5adb('0x27')]['message']['subject'],'attach':_0x192b1f[_0x5adb('0x4e')]?_0x192b1f['attach']:_0x599999['body']['message'][_0x5adb('0x4e')],'substatus':null,'substatusAt':moment()[_0x5adb('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x5adb('0x4f')](_0x5adb('0x50')),'lastMsgDirection':'in'});}else{return _0x192b1f;}}})[_0x5adb('0x49')](function(_0xf6ef8a){_0x399489[_0x5adb('0x56')]=_0xf6ef8a[_0x5adb('0x57')]({'plain':!![]});_0x399489[_0x5adb('0x56')][_0x5adb('0x58')]=_0x121714;return db['MailMessage']['create']({'body':_0x599999['body'][_0x5adb('0x27')],'MailAccountId':_0x599999[_0x5adb('0x3e')]['id'],'MailInteractionId':_0xf6ef8a['id'],'direction':'in','ContactId':_0x399489[_0x5adb('0x4a')]['id'],'messageId':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'from':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['from'],'to':_0x599999['body'][_0x5adb('0x14')]['to'],'cc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['cc'],'subject':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4d')],'attach':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4e')],'Attachments':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x59')],'originTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['originTo'],'originCc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['originCc'],'bcc':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x5a')],'ChatWebsiteId':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x5b')]||null,'originChannel':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x5c')]||_0x5adb('0x5d'),'ChatOfflineMessageId':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x5adb('0x5f')}]});})[_0x5adb('0x49')](function(_0x2362b8){_0x399489['message']=_0x2362b8;if(_0x399489['interaction'][_0x5adb('0x60')]){return db['User'][_0x5adb('0x35')]({'attributes':['id',_0x5adb('0x61')],'where':{'id':_0x399489[_0x5adb('0x56')]['UserId']}})[_0x5adb('0x49')](function(_0x288e4f){if(_0x288e4f){_0x399489[_0x5adb('0x40')][_0x5adb('0x62')]({'id':0x0,'priority':0x0,'app':_0x5adb('0x63'),'appdata':_0x288e4f['name']+','+(_0x399489[_0x5adb('0x3e')][_0x5adb('0x64')]||0xa),'interval':_0x5adb('0x65')});}return respondWithRpcPromise(_0x5adb('0x66'),'startRouting',_0x399489);});}return respondWithRpcPromise(_0x5adb('0x66'),_0x5adb('0x67'),_0x399489);})[_0x5adb('0x49')](function(_0x1e9cd1){_0x2fbe14(_0x1e9cd1);})[_0x5adb('0x16')](function(_0x20faf6){_0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x20faf6['message']));});});}; \ No newline at end of file +var _0x6d38=['result','catch','findAll','options','raw','attributes','limit','map','include','model','then','GetMailAccount','debug','ShowMailAccount','find','smtp','setDataValue','smtpOptions','body','mail','difference','rawAttributes','CompanyId','ListId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','get','account','omit','getSmtpOptions','list','applications','orderBy','autoclose','push','length','close','create','List\x20not\x20found','messageId','generate','subject','attach','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','contact','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var moment=require(_0x86d3('0x0'));var BPromise=require(_0x86d3('0x1'));var rs=require(_0x86d3('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x86d3('0x3'))('rpc');var config=require(_0x86d3('0x4'));var jayson=require(_0x86d3('0x5'));var client=jayson[_0x86d3('0x6')]['http']({'port':0x232c});config[_0x86d3('0x7')]=_[_0x86d3('0x8')](config[_0x86d3('0x7')],{'host':_0x86d3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x86d3('0xa'))[_0x86d3('0xb')](socket);function respondWithRpcPromise(_0xf273f5,_0x499640,_0x4a277e){return new BPromise(function(_0x3ed317,_0x555e6d){return client['request'](_0xf273f5,_0x4a277e)['then'](function(_0x4300e2){logger[_0x86d3('0xc')]('MailAccount,\x20%s,\x20%s',_0x499640,_0x86d3('0xd'));logger['debug'](_0x86d3('0xe'),_0x499640,_0x86d3('0xd'),JSON[_0x86d3('0xf')](_0x4300e2));if(_0x4300e2[_0x86d3('0x10')]){if(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x11')]===0x1f4){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2['error'][_0x86d3('0x13')]);return _0x555e6d(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);}logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);return _0x3ed317(_0x4300e2[_0x86d3('0x10')]['message']);}else{logger[_0x86d3('0xc')](_0x86d3('0x12'),_0x499640,_0x86d3('0xd'));_0x3ed317(_0x4300e2[_0x86d3('0x14')][_0x86d3('0x13')]);}})[_0x86d3('0x15')](function(_0x33e459){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x33e459);_0x555e6d(_0x33e459);});});}exports['GetMailAccount']=function(_0x191ba5){var _0x57c340=this;return new Promise(function(_0x6ced9e,_0x5c4d55){return db['MailAccount'][_0x86d3('0x16')]({'raw':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x18')]===undefined?!![]:![]:!![],'where':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')]['where']||null:null,'attributes':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'limit':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x1a')]||null:null,'include':_0x191ba5[_0x86d3('0x17')]?_0x191ba5['options']['include']?_[_0x86d3('0x1b')](_0x191ba5['options'][_0x86d3('0x1c')],function(_0x1bea5e){return{'model':db[_0x1bea5e[_0x86d3('0x1d')]],'as':_0x1bea5e['as'],'attributes':_0x1bea5e[_0x86d3('0x19')],'include':_0x1bea5e['include']?_['map'](_0x1bea5e[_0x86d3('0x1c')],function(_0x611764){return{'model':db[_0x611764['model']],'as':_0x611764['as'],'attributes':_0x611764[_0x86d3('0x19')],'include':_0x611764['include']?_[_0x86d3('0x1b')](_0x611764[_0x86d3('0x1c')],function(_0x287b96){return{'model':db[_0x287b96[_0x86d3('0x1d')]],'as':_0x287b96['as'],'attributes':_0x287b96[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x1f203e){logger[_0x86d3('0xc')](_0x86d3('0x1f'),_0x191ba5);logger[_0x86d3('0x20')](_0x86d3('0x1f'),_0x191ba5,JSON[_0x86d3('0xf')](_0x1f203e));_0x6ced9e(_0x1f203e);})[_0x86d3('0x15')](function(_0x28c25e){logger['error'](_0x86d3('0x1f'),_0x28c25e[_0x86d3('0x13')],_0x191ba5);_0x5c4d55(_0x57c340[_0x86d3('0x10')](0x1f4,_0x28c25e[_0x86d3('0x13')]));});});};exports[_0x86d3('0x21')]=function(_0x245e39){var _0x4a5ff0=this;return new Promise(function(_0xba2f49,_0x5c71df){return db['MailAccount'][_0x86d3('0x22')]({'raw':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['where']||null:null,'attributes':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'include':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x245e39[_0x86d3('0x17')]['include'],function(_0x4cdf45){return{'model':db[_0x4cdf45['model']],'as':_0x4cdf45['as'],'attributes':_0x4cdf45[_0x86d3('0x19')],'include':_0x4cdf45['include']?_[_0x86d3('0x1b')](_0x4cdf45['include'],function(_0x366943){return{'model':db[_0x366943[_0x86d3('0x1d')]],'as':_0x366943['as'],'attributes':_0x366943[_0x86d3('0x19')],'include':_0x366943[_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x366943[_0x86d3('0x1c')],function(_0x2d15b9){return{'model':db[_0x2d15b9['model']],'as':_0x2d15b9['as'],'attributes':_0x2d15b9[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x5e2519){if(_0x245e39[_0x86d3('0x17')][_0x86d3('0x23')]===!![])_0x5e2519[_0x86d3('0x24')](_0x86d3('0x25'),_0x5e2519['getSmtpOptions']());logger[_0x86d3('0xc')](_0x86d3('0x21'),_0x245e39);logger[_0x86d3('0x20')]('ShowMailAccount',_0x245e39,JSON[_0x86d3('0xf')](_0x5e2519));_0xba2f49(_0x5e2519);})[_0x86d3('0x15')](function(_0x1a1c06){logger[_0x86d3('0x10')](_0x86d3('0x21'),_0x1a1c06[_0x86d3('0x13')],_0x245e39);_0x5c71df(_0x4a5ff0[_0x86d3('0x10')](0x1f4,_0x1a1c06[_0x86d3('0x13')]));});});};exports['NotifyMailAccount']=function(_0x22bc98){var _0x470978=this;return new Promise(function(_0x2bdc67,_0x461052){var _0x5ebb4d={'body':_0x22bc98[_0x86d3('0x26')],'channel':_0x86d3('0x27')};var _0x6f72be=_[_0x86d3('0x28')](_['keys'](db['CmContact'][_0x86d3('0x29')]),['createdAt','updatedAt',_0x86d3('0x2a'),_0x86d3('0x2b')]);var _0x43490a=![];if(_0x22bc98[_0x86d3('0x26')]['id']){delete _0x22bc98[_0x86d3('0x26')]['id'];}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x86d3('0x2d')](_0x22bc98[_0x86d3('0x26')]['body'])||_0x22bc98[_0x86d3('0x26')][_0x86d3('0x26')]===''){return _0x461052(_0x470978['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x2f')+_0x6f72be));}if(!_[_0x86d3('0x30')](_0x6f72be,_0x22bc98[_0x86d3('0x26')]['mapKey'])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x31')+_0x6f72be));}var _0x5d9dad={};_0x5d9dad[_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')]]=_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')];return db[_0x86d3('0x32')][_0x86d3('0x22')]({'where':{'id':_0x22bc98['account']['id']},'include':[{'model':db[_0x86d3('0x33')],'as':_0x86d3('0x34'),'include':[{'model':db['CmContact'],'as':_0x86d3('0x35'),'where':_0x5d9dad,'limit':0x1,'order':[[_0x86d3('0x36'),_0x86d3('0x37')]]}]},{'model':db[_0x86d3('0x38')],'as':_0x86d3('0x39')},{'model':db['MailServerOut'],'as':_0x86d3('0x3a'),'include':[{'model':db[_0x86d3('0x3b')],'as':_0x86d3('0x3b')}]}]})[_0x86d3('0x1e')](function(_0x369b75){if(_0x369b75&&_0x369b75[_0x86d3('0x34')]){var _0x1a4345=_0x369b75[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x1a4345,[_0x86d3('0x39'),_0x86d3('0x34')]);_0x5ebb4d['account'][_0x86d3('0x25')]=_0x369b75[_0x86d3('0x3f')]();_0x5ebb4d['applications']=_0x1a4345[_0x86d3('0x39')];_0x5ebb4d[_0x86d3('0x40')]=_0x1a4345[_0x86d3('0x34')];_0x5ebb4d[_0x86d3('0x41')]=_[_0x86d3('0x42')](_0x5ebb4d[_0x86d3('0x41')],['priority'],['asc']);if(_0x5ebb4d['account']&&_0x5ebb4d['account'][_0x86d3('0x43')]){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x44')]({'id':0x0,'priority':_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x45')]+0x1,'app':_0x86d3('0x46'),'appdata':_0x86d3('0x43'),'interval':'*,*,*,*'});}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')]){delete _0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')];}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x34')]){delete _0x5ebb4d[_0x86d3('0x3d')]['List'];}if(_0x1a4345[_0x86d3('0x34')]['Contacts'][_0x86d3('0x45')]){return _0x1a4345[_0x86d3('0x34')][_0x86d3('0x35')][0x0];}var _0x3ffd22=_[_0x86d3('0x8')](_0x22bc98['body'],{'firstName':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')],'ListId':_0x1a4345[_0x86d3('0x2b')]});_0x3ffd22[_0x22bc98['body']['mapKey']]=_0x22bc98['body'][_0x86d3('0x2c')];return db['CmContact'][_0x86d3('0x47')](_0x3ffd22);}else{throw new Error(_0x86d3('0x48'));}})[_0x86d3('0x1e')](function(_0x319ea0){_0x5ebb4d['contact']=_0x319ea0;if(_0x319ea0){if(!_0x22bc98['body']['message'][_0x86d3('0x49')]){_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')]=rs[_0x86d3('0x4a')]()+'\x20'+_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')];}var _0x5123fd={'ContactId':_0x319ea0['id'],'MailAccountId':_0x22bc98[_0x86d3('0x3d')]['id'],'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98['body'][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98['body'][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4c')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x86d3('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x22bc98['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x86d3('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x4f')]}}]})[_0x86d3('0x1e')](function(_0xa48003){if(_0xa48003){return[_0xa48003,![]];}return db['MailInteraction']['create'](_0x5123fd)[_0x86d3('0x1e')](function(_0xf2c179){return[_0xf2c179,!![]];});});}else{throw new Error(_0x86d3('0x50'));}})[_0x86d3('0x51')](function(_0x22d8eb,_0x1952af){if(_0x22d8eb){_0x43490a=_0x1952af;if(!_0x1952af){return _0x22d8eb[_0x86d3('0x52')]({'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22d8eb['attach']?_0x22d8eb[_0x86d3('0x4c')]:_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'substatus':null,'substatusAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgDirection':'in'});}else{return _0x22d8eb;}}})['then'](function(_0x41d448){_0x5ebb4d['interaction']=_0x41d448[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x55')][_0x86d3('0x56')]=_0x43490a;return db[_0x86d3('0x57')][_0x86d3('0x47')]({'body':_0x22bc98['body'][_0x86d3('0x26')],'MailAccountId':_0x22bc98['account']['id'],'MailInteractionId':_0x41d448['id'],'direction':'in','ContactId':_0x5ebb4d[_0x86d3('0x58')]['id'],'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')],'from':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['to'],'cc':_0x22bc98[_0x86d3('0x26')]['message']['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'Attachments':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attachments'],'originTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x59')],'originCc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5a')],'bcc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5b')],'ChatWebsiteId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5c')]||null,'originChannel':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['originChannel']||_0x86d3('0x5d'),'ChatOfflineMessageId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x86d3('0x5f')}]});})[_0x86d3('0x1e')](function(_0x1a97f3){_0x5ebb4d[_0x86d3('0x13')]=_0x1a97f3;if(_0x5ebb4d['interaction']['UserId']){return db[_0x86d3('0x60')]['find']({'attributes':['id',_0x86d3('0x61')],'where':{'id':_0x5ebb4d['interaction']['UserId']}})[_0x86d3('0x1e')](function(_0x28bd40){if(_0x28bd40){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x62')]({'id':0x0,'priority':0x0,'app':_0x86d3('0x63'),'appdata':_0x28bd40['name']+','+(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x86d3('0x65'),_0x86d3('0x66'),_0x5ebb4d);});}return respondWithRpcPromise('Start',_0x86d3('0x66'),_0x5ebb4d);})['then'](function(_0x1867fc){_0x2bdc67(_0x1867fc);})['catch'](function(_0x5bb2e5){_0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x5bb2e5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2f986dc..bb0667a 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 _0x4972=['emit','removeListener','length','mailAccount:','save','remove'];(function(_0x55efcf,_0x348b2e){var _0xb2a688=function(_0x16b6a6){while(--_0x16b6a6){_0x55efcf['push'](_0x55efcf['shift']());}};_0xb2a688(++_0x348b2e);}(_0x4972,0x130));var _0x2497=function(_0x5c009a,_0x5d760e){_0x5c009a=_0x5c009a-0x0;var _0x454565=_0x4972[_0x5c009a];return _0x454565;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x2497('0x0'),_0x2497('0x1'),'update'];function createListener(_0x3bcf43,_0x2fe54c){return function(_0x27c1d){_0x2fe54c[_0x2497('0x2')](_0x3bcf43,_0x27c1d);};}function removeListener(_0x2ecf2e,_0x1b4216){return function(){MailAccountEvents[_0x2497('0x3')](_0x2ecf2e,_0x1b4216);};}exports['register']=function(_0x28e49b){for(var _0xbe4feb=0x0,_0x5124b2=events[_0x2497('0x4')];_0xbe4feb<_0x5124b2;_0xbe4feb++){var _0x24c0c5=events[_0xbe4feb];var _0x12130d=createListener(_0x2497('0x5')+_0x24c0c5,_0x28e49b);MailAccountEvents['on'](_0x24c0c5,_0x12130d);}}; \ No newline at end of file +var _0x6629=['save','update','emit','length','mailAccount:','./mailAccount.events'];(function(_0x6a5d57,_0x33f38d){var _0x424e4a=function(_0xcc3011){while(--_0xcc3011){_0x6a5d57['push'](_0x6a5d57['shift']());}};_0x424e4a(++_0x33f38d);}(_0x6629,0x1a9));var _0x9662=function(_0x41b541,_0x9ae4ae){_0x41b541=_0x41b541-0x0;var _0x11efba=_0x6629[_0x41b541];return _0x11efba;};'use strict';var MailAccountEvents=require(_0x9662('0x0'));var events=[_0x9662('0x1'),'remove',_0x9662('0x2')];function createListener(_0x520671,_0x43b945){return function(_0xe63d4f){_0x43b945[_0x9662('0x3')](_0x520671,_0xe63d4f);};}function removeListener(_0x4e765a,_0x54a4cf){return function(){MailAccountEvents['removeListener'](_0x4e765a,_0x54a4cf);};}exports['register']=function(_0xed6e5c){for(var _0xbc3676=0x0,_0x88b34b=events[_0x9662('0x4')];_0xbc3676<_0x88b34b;_0xbc3676++){var _0x3a6f57=events[_0xbc3676];var _0xbd5747=createListener(_0x9662('0x5')+_0x3a6f57,_0xed6e5c);MailAccountEvents['on'](_0x3a6f57,_0xbd5747);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0f2d9ce..b3e9ab4 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 _0x7b09=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x517456,_0x18c8d2){var _0x239445=function(_0x1f8d73){while(--_0x1f8d73){_0x517456['push'](_0x517456['shift']());}};_0x239445(++_0x18c8d2);}(_0x7b09,0x165));var _0x97b0=function(_0x1db89b,_0x5d756b){_0x1db89b=_0x1db89b-0x0;var _0x2d7662=_0x7b09[_0x1db89b];return _0x2d7662;};'use strict';var multer=require(_0x97b0('0x0'));var util=require(_0x97b0('0x1'));var path=require(_0x97b0('0x2'));var timeout=require(_0x97b0('0x3'));var express=require(_0x97b0('0x4'));var router=express[_0x97b0('0x5')]();var fs_extra=require(_0x97b0('0x6'));var auth=require(_0x97b0('0x7'));var interaction=require(_0x97b0('0x8'));var config=require(_0x97b0('0x9'));var controller=require(_0x97b0('0xa'));router['get'](_0x97b0('0xb'),auth[_0x97b0('0xc')](),controller['show']);router['put'](_0x97b0('0xb'),auth[_0x97b0('0xc')](),controller[_0x97b0('0xd')]);router[_0x97b0('0xe')]('/:id',auth[_0x97b0('0xc')](),controller[_0x97b0('0xf')]);module[_0x97b0('0x10')]=router; \ No newline at end of file +var _0x9738=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','show','put','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x9738,0xa6));var _0x8973=function(_0x37a810,_0x8cf781){_0x37a810=_0x37a810-0x0;var _0x21854d=_0x9738[_0x37a810];return _0x21854d;};'use strict';var multer=require(_0x8973('0x0'));var util=require(_0x8973('0x1'));var path=require(_0x8973('0x2'));var timeout=require(_0x8973('0x3'));var express=require('express');var router=express[_0x8973('0x4')]();var fs_extra=require(_0x8973('0x5'));var auth=require(_0x8973('0x6'));var interaction=require(_0x8973('0x7'));var config=require(_0x8973('0x8'));var controller=require(_0x8973('0x9'));router['get'](_0x8973('0xa'),auth['isAuthenticated'](),controller[_0x8973('0xb')]);router[_0x8973('0xc')]('/:id',auth[_0x8973('0xd')](),controller[_0x8973('0xe')]);router[_0x8973('0xf')]('/:id',auth[_0x8973('0xd')](),controller['destroy']);module[_0x8973('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index bebd854..26173d0 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 _0x37bf=['TEXT','STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37bf,0x1e9));var _0xf37b=function(_0x53bd08,_0x15de5c){_0x53bd08=_0x53bd08-0x0;var _0x57e61b=_0x37bf[_0x53bd08];return _0x57e61b;};'use strict';var Sequelize=require(_0xf37b('0x0'));module[_0xf37b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf37b('0x2')},'appdata':{'type':Sequelize[_0xf37b('0x3')]()},'description':{'type':Sequelize[_0xf37b('0x4')]},'interval':{'type':Sequelize[_0xf37b('0x4')],'defaultValue':_0xf37b('0x5')}}; \ No newline at end of file +var _0xd638=['*,*,*,*','sequelize','exports','TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd638,0x12d));var _0x8d63=function(_0x541f70,_0x5781d0){_0x541f70=_0x541f70-0x0;var _0x1794de=_0xd638[_0x541f70];return _0x1794de;};'use strict';var Sequelize=require(_0x8d63('0x0'));module[_0x8d63('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8d63('0x2')]()},'description':{'type':Sequelize[_0x8d63('0x3')]},'interval':{'type':Sequelize[_0x8d63('0x3')],'defaultValue':_0x8d63('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c5e7f17..b7069da 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(_0x11247f,_0x53a749){var _0x3bc116=function(_0x10eb7d){while(--_0x10eb7d){_0x11247f['push'](_0x11247f['shift']());}};_0x3bc116(++_0x53a749);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x380fe0,_0x4693c0){var _0x158d94=function(_0x3bdf3b){while(--_0x3bdf3b){_0x380fe0['push'](_0x380fe0['shift']());}};_0x158d94(++_0x4693c0);}(_0xda3f,0xec));var _0xfda3=function(_0xbdc843,_0x330c07){_0xbdc843=_0xbdc843-0x0;var _0x8d8aba=_0xda3f[_0xbdc843];return _0x8d8aba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5287d4a..4655c28 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 _0x0ab8=['./mailApplication.attributes','exports','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c5bf5,_0x2b3e1b){var _0x188b4b=function(_0x2e7ea8){while(--_0x2e7ea8){_0x5c5bf5['push'](_0x5c5bf5['shift']());}};_0x188b4b(++_0x2b3e1b);}(_0x0ab8,0x1a4));var _0x80ab=function(_0x363d06,_0x3abc68){_0x363d06=_0x363d06-0x0;var _0x48654a=_0x0ab8[_0x363d06];return _0x48654a;};'use strict';var _=require('lodash');var util=require(_0x80ab('0x0'));var logger=require(_0x80ab('0x1'))(_0x80ab('0x2'));var moment=require(_0x80ab('0x3'));var BPromise=require(_0x80ab('0x4'));var rp=require(_0x80ab('0x5'));var fs=require('fs');var path=require(_0x80ab('0x6'));var rimraf=require(_0x80ab('0x7'));var config=require(_0x80ab('0x8'));var attributes=require(_0x80ab('0x9'));module[_0x80ab('0xa')]=function(_0x31bcb4,_0x3cc490){return _0x31bcb4['define']('MailApplication',attributes,{'tableName':_0x80ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x80ab('0xc')});}; \ No newline at end of file +var _0x197a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x14d35f,_0x30e439){var _0x18416b=function(_0x8556ad){while(--_0x8556ad){_0x14d35f['push'](_0x14d35f['shift']());}};_0x18416b(++_0x30e439);}(_0x197a,0x168));var _0xa197=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x197a[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0xa197('0x0'));var util=require(_0xa197('0x1'));var logger=require(_0xa197('0x2'))(_0xa197('0x3'));var moment=require(_0xa197('0x4'));var BPromise=require(_0xa197('0x5'));var rp=require(_0xa197('0x6'));var fs=require('fs');var path=require(_0xa197('0x7'));var rimraf=require(_0xa197('0x8'));var config=require(_0xa197('0x9'));var attributes=require(_0xa197('0xa'));module[_0xa197('0xb')]=function(_0x324308,_0x15cdaa){return _0x324308[_0xa197('0xc')](_0xa197('0xd'),attributes,{'tableName':_0xa197('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e547226..37dbe07 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 _0x611f=['where','attributes','limit','then','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x611f,0x18c));var _0xf611=function(_0x267408,_0x761995){_0x267408=_0x267408-0x0;var _0x3f8d10=_0x611f[_0x267408];return _0x3f8d10;};'use strict';var _=require(_0xf611('0x0'));var util=require('util');var moment=require(_0xf611('0x1'));var BPromise=require(_0xf611('0x2'));var rs=require(_0xf611('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf611('0x4'))('rpc');var config=require(_0xf611('0x5'));var jayson=require(_0xf611('0x6'));var client=jayson[_0xf611('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59bc32,_0x32bab2,_0x26fe10){return new BPromise(function(_0x410886,_0x12c295){return client[_0xf611('0x8')](_0x59bc32,_0x26fe10)['then'](function(_0x40fa12){logger[_0xf611('0x9')](_0xf611('0xa'),_0x32bab2,_0xf611('0xb'));logger[_0xf611('0xc')](_0xf611('0xd'),_0x32bab2,_0xf611('0xb'),JSON[_0xf611('0xe')](_0x40fa12));if(_0x40fa12[_0xf611('0xf')]){if(_0x40fa12[_0xf611('0xf')][_0xf611('0x10')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x32bab2,_0x40fa12[_0xf611('0xf')][_0xf611('0x11')]);return _0x12c295(_0x40fa12[_0xf611('0xf')][_0xf611('0x11')]);}logger[_0xf611('0xf')](_0xf611('0xa'),_0x32bab2,_0x40fa12[_0xf611('0xf')]['message']);return _0x410886(_0x40fa12[_0xf611('0xf')][_0xf611('0x11')]);}else{logger[_0xf611('0x9')]('MailApplication,\x20%s,\x20%s',_0x32bab2,_0xf611('0xb'));_0x410886(_0x40fa12[_0xf611('0x12')][_0xf611('0x11')]);}})[_0xf611('0x13')](function(_0x50c21c){logger[_0xf611('0xf')]('MailApplication,\x20%s,\x20%s',_0x32bab2,_0x50c21c);_0x12c295(_0x50c21c);});});}exports[_0xf611('0x14')]=function(_0x3f7314){var _0xdcf4fb=this;return new Promise(function(_0x3645c6,_0x12ef4d){return db['MailApplication'][_0xf611('0x15')](_0x3f7314['body'],{'raw':_0x3f7314[_0xf611('0x16')]?_0x3f7314[_0xf611('0x16')][_0xf611('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7314[_0xf611('0x16')]?_0x3f7314[_0xf611('0x16')][_0xf611('0x18')]||null:null,'attributes':_0x3f7314[_0xf611('0x16')]?_0x3f7314[_0xf611('0x16')][_0xf611('0x19')]||null:null,'limit':_0x3f7314[_0xf611('0x16')]?_0x3f7314['options'][_0xf611('0x1a')]||null:null})[_0xf611('0x1b')](function(_0x18dd3b){logger[_0xf611('0x9')]('UpdateMailApplication',_0x3f7314);logger['debug'](_0xf611('0x14'),_0x3f7314,JSON[_0xf611('0xe')](_0x18dd3b));_0x3645c6(_0x18dd3b);})[_0xf611('0x13')](function(_0x2fee33){logger[_0xf611('0xf')]('UpdateMailApplication',_0x2fee33[_0xf611('0x11')],_0x3f7314);_0x12ef4d(_0xdcf4fb['error'](0x1f4,_0x2fee33['message']));});});}; \ No newline at end of file +var _0xe5d6=['http','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x214089,_0xb880e6){var _0x20c571=function(_0xcc8487){while(--_0xcc8487){_0x214089['push'](_0x214089['shift']());}};_0x20c571(++_0xb880e6);}(_0xe5d6,0xba));var _0x6e5d=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xe5d6[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x6e5d('0x0'));var util=require(_0x6e5d('0x1'));var moment=require(_0x6e5d('0x2'));var BPromise=require(_0x6e5d('0x3'));var rs=require(_0x6e5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e5d('0x5'))['db'];var utils=require(_0x6e5d('0x6'));var logger=require(_0x6e5d('0x7'))(_0x6e5d('0x8'));var config=require(_0x6e5d('0x9'));var jayson=require(_0x6e5d('0xa'));var client=jayson[_0x6e5d('0xb')][_0x6e5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18f7b4,_0x25152b,_0x264e29){return new BPromise(function(_0x52387b,_0x5b8f3c){return client[_0x6e5d('0xd')](_0x18f7b4,_0x264e29)['then'](function(_0x28ac0a){logger['info'](_0x6e5d('0xe'),_0x25152b,_0x6e5d('0xf'));logger[_0x6e5d('0x10')](_0x6e5d('0x11'),_0x25152b,_0x6e5d('0xf'),JSON[_0x6e5d('0x12')](_0x28ac0a));if(_0x28ac0a['error']){if(_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x14')]===0x1f4){logger[_0x6e5d('0x13')](_0x6e5d('0xe'),_0x25152b,_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x15')]);return _0x5b8f3c(_0x28ac0a[_0x6e5d('0x13')]['message']);}logger[_0x6e5d('0x13')](_0x6e5d('0xe'),_0x25152b,_0x28ac0a[_0x6e5d('0x13')]['message']);return _0x52387b(_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x15')]);}else{logger[_0x6e5d('0x16')](_0x6e5d('0xe'),_0x25152b,'request\x20sent');_0x52387b(_0x28ac0a[_0x6e5d('0x17')][_0x6e5d('0x15')]);}})[_0x6e5d('0x18')](function(_0x3e4745){logger['error'](_0x6e5d('0xe'),_0x25152b,_0x3e4745);_0x5b8f3c(_0x3e4745);});});}exports[_0x6e5d('0x19')]=function(_0x3b11ad){var _0x1a8b08=this;return new Promise(function(_0x71f6be,_0x4606f3){return db[_0x6e5d('0x1a')]['update'](_0x3b11ad[_0x6e5d('0x1b')],{'raw':_0x3b11ad['options']?_0x3b11ad[_0x6e5d('0x1c')][_0x6e5d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b11ad['options']?_0x3b11ad[_0x6e5d('0x1c')][_0x6e5d('0x1e')]||null:null,'attributes':_0x3b11ad['options']?_0x3b11ad[_0x6e5d('0x1c')][_0x6e5d('0x1f')]||null:null,'limit':_0x3b11ad['options']?_0x3b11ad[_0x6e5d('0x1c')][_0x6e5d('0x20')]||null:null})['then'](function(_0x4c5d17){logger['info'](_0x6e5d('0x19'),_0x3b11ad);logger[_0x6e5d('0x10')](_0x6e5d('0x19'),_0x3b11ad,JSON[_0x6e5d('0x12')](_0x4c5d17));_0x71f6be(_0x4c5d17);})[_0x6e5d('0x18')](function(_0x323bc4){logger[_0x6e5d('0x13')]('UpdateMailApplication',_0x323bc4[_0x6e5d('0x15')],_0x3b11ad);_0x4606f3(_0x1a8b08[_0x6e5d('0x13')](0x1f4,_0x323bc4[_0x6e5d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4d4107d..9b48055 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 _0x6660=['download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','mail','update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages'];(function(_0x133ff4,_0x406945){var _0x25eac7=function(_0x34f43f){while(--_0x34f43f){_0x133ff4['push'](_0x133ff4['shift']());}};_0x25eac7(++_0x406945);}(_0x6660,0xaf));var _0x0666=function(_0x1d8de9,_0x3c853a){_0x1d8de9=_0x1d8de9-0x0;var _0x4bc43d=_0x6660[_0x1d8de9];return _0x4bc43d;};'use strict';var express=require(_0x0666('0x0'));var router=express[_0x0666('0x1')]();var auth=require(_0x0666('0x2'));var interaction=require(_0x0666('0x3'));var controller=require(_0x0666('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x0666('0x5')]);router[_0x0666('0x6')](_0x0666('0x7'),auth[_0x0666('0x8')](),controller[_0x0666('0x9')]);router[_0x0666('0x6')](_0x0666('0xa'),auth[_0x0666('0x8')](),controller[_0x0666('0xb')]);router[_0x0666('0x6')](_0x0666('0xc'),auth[_0x0666('0x8')](),controller[_0x0666('0xd')]);router[_0x0666('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x0666('0xe')]);router[_0x0666('0xf')]('/',auth['isAuthenticated'](),controller[_0x0666('0x10')]);router[_0x0666('0xf')](_0x0666('0xc'),auth['isAuthenticated'](),controller[_0x0666('0x11')]);router[_0x0666('0xf')](_0x0666('0x12'),auth[_0x0666('0x8')](),interaction[_0x0666('0x13')]('mail',_0x0666('0x14')),controller['addTags']);router['put'](_0x0666('0xa'),auth[_0x0666('0x8')](),interaction[_0x0666('0x13')](_0x0666('0x15'),'mailinteraction:update'),controller[_0x0666('0x16')]);router[_0x0666('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x0666('0x13')](_0x0666('0x15'),_0x0666('0x18')),controller['destroy']);router[_0x0666('0x17')](_0x0666('0x12'),auth[_0x0666('0x8')](),controller[_0x0666('0x19')]);module[_0x0666('0x1a')]=router; \ No newline at end of file +var _0x1d97=['describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1d97,0x171));var _0x71d9=function(_0x12b5ab,_0x4a304a){_0x12b5ab=_0x12b5ab-0x0;var _0x17d6c3=_0x1d97[_0x12b5ab];return _0x17d6c3;};'use strict';var express=require(_0x71d9('0x0'));var router=express[_0x71d9('0x1')]();var auth=require(_0x71d9('0x2'));var interaction=require(_0x71d9('0x3'));var controller=require('./mailInteraction.controller');router[_0x71d9('0x4')]('/',auth[_0x71d9('0x5')](),controller[_0x71d9('0x6')]);router[_0x71d9('0x4')](_0x71d9('0x7'),auth[_0x71d9('0x5')](),controller[_0x71d9('0x8')]);router[_0x71d9('0x4')](_0x71d9('0x9'),auth[_0x71d9('0x5')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x71d9('0xa')]);router['get'](_0x71d9('0xb'),auth['isAuthenticated'](),controller[_0x71d9('0xc')]);router[_0x71d9('0xd')]('/',auth[_0x71d9('0x5')](),controller[_0x71d9('0xe')]);router[_0x71d9('0xd')](_0x71d9('0xf'),auth[_0x71d9('0x5')](),controller[_0x71d9('0x10')]);router['post'](_0x71d9('0x11'),auth['isAuthenticated'](),interaction[_0x71d9('0x12')](_0x71d9('0x13'),_0x71d9('0x14')),controller[_0x71d9('0x15')]);router[_0x71d9('0x16')](_0x71d9('0x9'),auth[_0x71d9('0x5')](),interaction[_0x71d9('0x12')](_0x71d9('0x13'),_0x71d9('0x17')),controller[_0x71d9('0x18')]);router[_0x71d9('0x19')](_0x71d9('0x9'),auth['isAuthenticated'](),interaction[_0x71d9('0x12')](_0x71d9('0x13'),_0x71d9('0x1a')),controller[_0x71d9('0x1b')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x71d9('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9e26944..07d6956 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 _0xe385=['TEXT','long','BOOLEAN','ENUM','out','iconv','exports','DATE','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe385,0x11c));var _0x5e38=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe385[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x5e38('0x0'));module[_0x5e38('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5e38('0x2')]},'disposition':{'type':Sequelize[_0x5e38('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5e38('0x3')]},'note':{'type':Sequelize[_0x5e38('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5e38('0x3')]},'cc':{'type':Sequelize[_0x5e38('0x4')](_0x5e38('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x5e38('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5e38('0x2')]},'substatus':{'type':Sequelize[_0x5e38('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5e38('0x7')]('in',_0x5e38('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5e38('0x7')]('in',_0x5e38('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5e38('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0503=['ENUM','sequelize','iconv','exports','STRING','TEXT','BOOLEAN','DATE'];(function(_0x30bddf,_0x5c91f8){var _0x5efdeb=function(_0x486740){while(--_0x486740){_0x30bddf['push'](_0x30bddf['shift']());}};_0x5efdeb(++_0x5c91f8);}(_0x0503,0x199));var _0x3050=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x0503[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0x3050('0x0'));var iconv=require(_0x3050('0x1'));module[_0x3050('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3050('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3050('0x3')]},'note':{'type':Sequelize[_0x3050('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3050('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x3050('0x4')]()},'attach':{'type':Sequelize[_0x3050('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3050('0x6')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3050('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3050('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3050('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index bc904be..f8299b2 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 _0xd6eb=['bcc','createdAt','get','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','name','send','index','MailInteraction','rawAttributes','type','key','findAll','mail','user','catch','show','params','keys','query','filters','intersection','fields','attributes','includeAll','merge','options','find','create','body','destroy','describe','addMessage','MailMessage','omit','ids','getMessages','findOne','model','length','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','from'];(function(_0x40f73a,_0x54716a){var _0x1b42f6=function(_0x3bc09a){while(--_0x3bc09a){_0x40f73a['push'](_0x40f73a['shift']());}};_0x1b42f6(++_0x54716a);}(_0xd6eb,0x83));var _0xbd6e=function(_0x709b2e,_0x41683e){_0x709b2e=_0x709b2e-0x0;var _0x497113=_0xd6eb[_0x709b2e];return _0x497113;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd6e('0x0'));var zipdir=require(_0xbd6e('0x1'));var moment=require(_0xbd6e('0x2'));var BPromise=require('bluebird');var util=require(_0xbd6e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xbd6e('0x4'));var juice=require(_0xbd6e('0x5'));var Redis=require(_0xbd6e('0x6'));var interaction=require(_0xbd6e('0x7'));var qs=require(_0xbd6e('0x8'));var logger=require('../../config/logger')(_0xbd6e('0x9'));var config=require('../../config/environment');var db=require(_0xbd6e('0xa'))['db'];var htmlEntities=require(_0xbd6e('0xb'));config[_0xbd6e('0xc')]=_[_0xbd6e('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbd6e('0xe'))(new Redis(config['redis']));require(_0xbd6e('0xf'))[_0xbd6e('0x10')](socket);function respondWithStatusCode(_0x945c10,_0x2dc74a){_0x2dc74a=_0x2dc74a||0xcc;return function(_0x346e97){if(_0x346e97){return _0x945c10[_0xbd6e('0x11')](_0x2dc74a);}return _0x945c10[_0xbd6e('0x12')](_0x2dc74a)[_0xbd6e('0x13')]();};}function respondWithResult(_0x43947e,_0x41c7c8){_0x41c7c8=_0x41c7c8||0xc8;return function(_0x18bbd5){if(_0x18bbd5){return _0x43947e['status'](_0x41c7c8)[_0xbd6e('0x14')](_0x18bbd5);}};}function respondWithFilteredResult(_0x21b8b0,_0xf83493){return function(_0x51a9fa){if(_0x51a9fa){var _0x1e36cc=typeof _0xf83493[_0xbd6e('0x15')]===_0xbd6e('0x16')&&typeof _0xf83493[_0xbd6e('0x17')]===_0xbd6e('0x16');var _0x3d436d=_0x51a9fa[_0xbd6e('0x18')];var _0x71d1f5=_0x1e36cc?0x0:_0xf83493['offset'];var _0x30e5e7=_0x1e36cc?_0x51a9fa[_0xbd6e('0x18')]:_0xf83493[_0xbd6e('0x15')]+_0xf83493[_0xbd6e('0x17')];var _0x5c543d;if(_0x30e5e7>=_0x3d436d){_0x30e5e7=_0x3d436d;_0x5c543d=0xc8;}else{_0x5c543d=0xce;}_0x21b8b0[_0xbd6e('0x12')](_0x5c543d);return _0x21b8b0[_0xbd6e('0x19')](_0xbd6e('0x1a'),_0x71d1f5+'-'+_0x30e5e7+'/'+_0x3d436d)[_0xbd6e('0x14')](_0x51a9fa);}return null;};}function saveUpdates(_0x1b8965){return function(_0x1e24e7){if(_0x1e24e7){return _0x1e24e7[_0xbd6e('0x1b')](_0x1b8965)[_0xbd6e('0x1c')](function(_0x1b7d19){return _0x1b7d19;});}return null;};}function removeEntity(_0x25850f){return function(_0x5d2544){if(_0x5d2544){return _0x5d2544['destroy']()['then'](function(){_0x25850f[_0xbd6e('0x12')](0xcc)[_0xbd6e('0x13')]();});}};}function handleEntityNotFound(_0x113dc0){return function(_0x4e5a37){if(!_0x4e5a37){_0x113dc0[_0xbd6e('0x11')](0x194);}return _0x4e5a37;};}function handleError(_0x369455,_0x3a2e47){_0x3a2e47=_0x3a2e47||0x1f4;return function(_0x5422b5){logger['error'](_0x5422b5['stack']);if(_0x5422b5[_0xbd6e('0x1d')]){delete _0x5422b5[_0xbd6e('0x1d')];}_0x369455[_0xbd6e('0x12')](_0x3a2e47)[_0xbd6e('0x1e')](_0x5422b5);};}exports[_0xbd6e('0x1f')]=function(_0x4bebec,_0x464cb7){var _0x1c142c={};var _0x32b01d=_['map'](db[_0xbd6e('0x20')][_0xbd6e('0x21')],function(_0x4c231d){return{'name':_0x4c231d['fieldName'],'type':_0x4c231d[_0xbd6e('0x22')][_0xbd6e('0x23')]};});_0x1c142c=qs['getOptions'](_0x32b01d,_0x4bebec);return interaction[_0xbd6e('0x24')](_0xbd6e('0x25'),_0x4bebec['query'],_0x4bebec[_0xbd6e('0x26')],_0x1c142c,_0x32b01d)[_0xbd6e('0x1c')](respondWithFilteredResult(_0x464cb7,_0x1c142c))[_0xbd6e('0x27')](handleError(_0x464cb7,null));};exports[_0xbd6e('0x28')]=function(_0x22b637,_0x50cd00){var _0xa18c34={'raw':![],'where':{'id':_0x22b637[_0xbd6e('0x29')]['id']}},_0x1a6926={};_0x1a6926['model']=_[_0xbd6e('0x2a')](db['MailInteraction'][_0xbd6e('0x21')]);_0x1a6926[_0xbd6e('0x2b')]=_['keys'](_0x22b637[_0xbd6e('0x2b')]);_0x1a6926[_0xbd6e('0x2c')]=_[_0xbd6e('0x2d')](_0x1a6926['model'],_0x1a6926[_0xbd6e('0x2b')]);_0xa18c34['attributes']=_[_0xbd6e('0x2d')](_0x1a6926['model'],qs[_0xbd6e('0x2e')](_0x22b637[_0xbd6e('0x2b')]['fields']));_0xa18c34['attributes']=_0xa18c34[_0xbd6e('0x2f')]['length']?_0xa18c34[_0xbd6e('0x2f')]:_0x1a6926['model'];if(_0x22b637['query'][_0xbd6e('0x30')]){_0xa18c34['include']=[{'all':!![]}];}_0xa18c34=_[_0xbd6e('0x31')]({},_0xa18c34,_0x22b637[_0xbd6e('0x32')]);return db[_0xbd6e('0x20')][_0xbd6e('0x33')](_0xa18c34)[_0xbd6e('0x1c')](handleEntityNotFound(_0x50cd00,null))[_0xbd6e('0x1c')](respondWithResult(_0x50cd00,null))[_0xbd6e('0x27')](handleError(_0x50cd00,null));};exports[_0xbd6e('0x34')]=function(_0x5014bf,_0x54f0cb){return db[_0xbd6e('0x20')][_0xbd6e('0x34')](_0x5014bf['body'],{})['then'](respondWithResult(_0x54f0cb,0xc9))[_0xbd6e('0x27')](handleError(_0x54f0cb,null));};exports['update']=function(_0x533fcc,_0x29e1d1){if(_0x533fcc['body']['id']){delete _0x533fcc[_0xbd6e('0x35')]['id'];}return db[_0xbd6e('0x20')]['find']({'where':{'id':_0x533fcc[_0xbd6e('0x29')]['id']}})['then'](handleEntityNotFound(_0x29e1d1,null))[_0xbd6e('0x1c')](saveUpdates(_0x533fcc[_0xbd6e('0x35')],null))[_0xbd6e('0x1c')](respondWithResult(_0x29e1d1,null))['catch'](handleError(_0x29e1d1,null));};exports[_0xbd6e('0x36')]=function(_0x48728c,_0x1ff8bc){return db[_0xbd6e('0x20')][_0xbd6e('0x33')]({'where':{'id':_0x48728c[_0xbd6e('0x29')]['id']}})[_0xbd6e('0x1c')](handleEntityNotFound(_0x1ff8bc,null))[_0xbd6e('0x1c')](removeEntity(_0x1ff8bc,null))[_0xbd6e('0x27')](handleError(_0x1ff8bc,null));};exports[_0xbd6e('0x37')]=function(_0x2e0a4e,_0x1432cf){return db['MailInteraction'][_0xbd6e('0x37')]()[_0xbd6e('0x1c')](respondWithResult(_0x1432cf,null))[_0xbd6e('0x27')](handleError(_0x1432cf,null));};exports[_0xbd6e('0x38')]=function(_0xe03954,_0x37023a){return db[_0xbd6e('0x39')]['find']({'where':{'id':_0xe03954['params']['id']}})[_0xbd6e('0x1c')](handleEntityNotFound(_0x37023a,null))[_0xbd6e('0x1c')](function(_0x15b019){if(_0x15b019){return _0x15b019[_0xbd6e('0x38')](_0xe03954[_0xbd6e('0x35')]['ids'],_[_0xbd6e('0x3a')](_0xe03954[_0xbd6e('0x35')],[_0xbd6e('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x37023a,null))[_0xbd6e('0x27')](handleError(_0x37023a,null));};exports[_0xbd6e('0x3c')]=function(_0x379d6e,_0x584c0d){var _0x19c19b={'raw':![],'where':{}};var _0x3913fc={};var _0x5139f6={'count':0x0,'rows':[]};return db[_0xbd6e('0x20')][_0xbd6e('0x3d')]({'where':{'id':_0x379d6e[_0xbd6e('0x29')]['id']}})[_0xbd6e('0x1c')](handleEntityNotFound(_0x584c0d,null))['then'](function(_0xab6d2){if(_0xab6d2){_0x3913fc[_0xbd6e('0x3e')]=_[_0xbd6e('0x2a')](db[_0xbd6e('0x39')][_0xbd6e('0x21')]);_0x3913fc[_0xbd6e('0x2b')]=_['keys'](_0x379d6e[_0xbd6e('0x2b')]);_0x3913fc[_0xbd6e('0x2c')]=_['intersection'](_0x3913fc[_0xbd6e('0x3e')],_0x3913fc[_0xbd6e('0x2b')]);_0x19c19b[_0xbd6e('0x2f')]=_[_0xbd6e('0x2d')](_0x3913fc[_0xbd6e('0x3e')],qs[_0xbd6e('0x2e')](_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x2e')]));_0x19c19b[_0xbd6e('0x2f')]=_0x19c19b[_0xbd6e('0x2f')][_0xbd6e('0x3f')]?_0x19c19b[_0xbd6e('0x2f')]:_0x3913fc[_0xbd6e('0x3e')];if(!_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x40')](_0xbd6e('0x41'))){_0x19c19b[_0xbd6e('0x17')]=qs[_0xbd6e('0x17')](_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x17')]);_0x19c19b[_0xbd6e('0x15')]=qs[_0xbd6e('0x15')](_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x15')]);}_0x19c19b[_0xbd6e('0x42')]=qs[_0xbd6e('0x43')](_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x43')]);_0x19c19b[_0xbd6e('0x44')]=qs[_0xbd6e('0x2c')](_['pick'](_0x379d6e[_0xbd6e('0x2b')],_0x3913fc[_0xbd6e('0x2c')]));_0x19c19b[_0xbd6e('0x44')][_0xbd6e('0x45')]=_0xab6d2['id'];if(_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x46')]){_0x19c19b[_0xbd6e('0x44')]=_[_0xbd6e('0x31')](_0x19c19b['where'],{'$or':_['map'](_0x19c19b[_0xbd6e('0x2f')],function(_0x224a20){var _0x2ba600={};_0x2ba600[_0x224a20]={'$like':'%'+_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x46')]+'%'};return _0x2ba600;})});}if(_0x379d6e['query'][_0xbd6e('0x47')]){var _0x3eb2e=_0x379d6e[_0xbd6e('0x2b')][_0xbd6e('0x47')]['split'](',');var _0x56d9bd={};_0x56d9bd[_0x3eb2e[0x0]]={'$gte':moment(_0x3eb2e[0x1])['format'](_0xbd6e('0x48'))};_0x19c19b[_0xbd6e('0x44')]=_[_0xbd6e('0x31')](_0x19c19b[_0xbd6e('0x44')],_0x56d9bd);}_0x19c19b=_[_0xbd6e('0x31')]({},_0x19c19b,_0x379d6e['options']);return db[_0xbd6e('0x39')][_0xbd6e('0x18')]({'where':_0x19c19b['where']})[_0xbd6e('0x1c')](function(_0x218e78){_0x5139f6[_0xbd6e('0x18')]=_0x218e78;if(_0x379d6e[_0xbd6e('0x2b')]['includeAll']){_0x19c19b[_0xbd6e('0x49')]=[{'all':!![]}];}return db[_0xbd6e('0x39')][_0xbd6e('0x24')](_0x19c19b);})[_0xbd6e('0x1c')](function(_0x2689e7){if(_0x379d6e['query'][_0xbd6e('0x4a')]===_0xbd6e('0x4b')){for(var _0x58a5f2=0x0;_0x58a5f2<_0x2689e7[_0xbd6e('0x3f')];_0x58a5f2++){_0x2689e7[_0x58a5f2][_0xbd6e('0x35')]=juice(_0x2689e7[_0x58a5f2][_0xbd6e('0x35')]);}}_0x5139f6['rows']=_0x2689e7;return _0x5139f6;});}})['then'](respondWithFilteredResult(_0x584c0d,_0x19c19b))[_0xbd6e('0x27')](handleError(_0x584c0d,null));};exports[_0xbd6e('0x4c')]=function(_0x4a4214,_0x487885){return db[_0xbd6e('0x20')][_0xbd6e('0x33')]({'where':{'id':_0x4a4214[_0xbd6e('0x29')]['id']}})['then'](handleEntityNotFound(_0x487885,null))[_0xbd6e('0x1c')](function(_0x16e235){if(_0x16e235){return _0x16e235[_0xbd6e('0x4d')](_0x4a4214[_0xbd6e('0x35')][_0xbd6e('0x3b')],_[_0xbd6e('0x3a')](_0x4a4214[_0xbd6e('0x35')],[_0xbd6e('0x3b'),'id'])||{})[_0xbd6e('0x4e')](function(){return db[_0xbd6e('0x4f')][_0xbd6e('0x24')]({'attributes':['id','name',_0xbd6e('0x50')],'where':{'id':_0x4a4214['body'][_0xbd6e('0x3b')]}});})[_0xbd6e('0x1c')](function(_0x528103){socket[_0xbd6e('0x51')](_0xbd6e('0x52'),{'id':Number(_0x4a4214['params']['id']),'tags':_0x528103||[]});return{'id':Number(_0x4a4214[_0xbd6e('0x29')]['id']),'tags':_0x528103||[]};});}})[_0xbd6e('0x1c')](respondWithResult(_0x487885,null))['catch'](handleError(_0x487885,null));};exports[_0xbd6e('0x53')]=function(_0x561902,_0x2329ea){return db[_0xbd6e('0x20')]['find']({'where':{'id':_0x561902[_0xbd6e('0x29')]['id']}})['then'](handleEntityNotFound(_0x2329ea,null))[_0xbd6e('0x1c')](function(_0x420436){if(_0x420436){return _0x420436['removeTags'](_0x561902[_0xbd6e('0x2b')][_0xbd6e('0x3b')]);}})[_0xbd6e('0x1c')](respondWithStatusCode(_0x2329ea,null))[_0xbd6e('0x27')](handleError(_0x2329ea,null));};exports['download']=function(_0xea4783,_0x2c378a){var _0x506b62=moment()[_0xbd6e('0x54')]()['toString']();var _0x21232a=path[_0xbd6e('0x55')](config[_0xbd6e('0x56')],_0xbd6e('0x57'),_0xbd6e('0x58'),_0xbd6e('0x59'));var _0x4ed14f=path['join'](config[_0xbd6e('0x56')],_0xbd6e('0x57'),_0xbd6e('0x58'),_0xbd6e('0x5a'));var _0x587d01=path[_0xbd6e('0x55')](_0x21232a,_0x506b62);var _0x130dce=util[_0xbd6e('0x5b')](_0xbd6e('0x5c'),_0xea4783[_0xbd6e('0x29')]['id'],_0x506b62);var _0x17e11d=path[_0xbd6e('0x55')](_0x21232a,_0x130dce);var _0x346d88=[];if(_0xea4783['query'][_0xbd6e('0x5a')]){_0x346d88['push']({'model':db[_0xbd6e('0x5d')],'as':_0xbd6e('0x5e'),'raw':!![]});}var _0x2acc59=[{'model':db[_0xbd6e('0x39')],'as':_0xbd6e('0x5f'),'attributes':['id',_0xbd6e('0x35'),_0xbd6e('0x60'),'to','cc',_0xbd6e('0x61'),'subject',_0xbd6e('0x62')],'where':{'secret':![]},'order':qs[_0xbd6e('0x43')]('id'),'include':_0x346d88}];return db[_0xbd6e('0x20')][_0xbd6e('0x33')]({'where':{'id':_0xea4783[_0xbd6e('0x29')]['id']},'include':_0x2acc59})[_0xbd6e('0x1c')](handleEntityNotFound(_0x2c378a,null))[_0xbd6e('0x1c')](function(_0x58d24b){if(_0x58d24b&&_0x58d24b['Messages']){var _0x357932=_0x58d24b[_0xbd6e('0x63')]({'plain':!![]});fs[_0xbd6e('0x64')](_0x587d01);return BPromise[_0xbd6e('0x65')](_0x357932[_0xbd6e('0x5f')],function(_0x55f692,_0x4b360c){var _0x1fa467={'from':_0x55f692[_0xbd6e('0x60')],'to':_0x55f692['to']||'missing.recipient@your.company.com','subject':_0x55f692[_0xbd6e('0x66')],'html':htmlEntities[_0xbd6e('0x67')](_0x55f692['body']),'headers':{'Date':moment(_0x55f692[_0xbd6e('0x62')])[_0xbd6e('0x5b')](_0xbd6e('0x68'))},'attachments':[]};if(_0x55f692['cc']){_0x1fa467[_0xbd6e('0x69')]['Cc']=_0x55f692['cc'];}if(_0x55f692[_0xbd6e('0x61')]){_0x1fa467[_0xbd6e('0x69')][_0xbd6e('0x6a')]=_0x55f692[_0xbd6e('0x61')];}return new BPromise(function(_0x324179,_0x51bc9e){if(_0x55f692[_0xbd6e('0x5e')]){for(var _0xb7e9f1=0x0;_0xb7e9f1<_0x55f692['Attachments'][_0xbd6e('0x3f')];_0xb7e9f1++){var _0x14a149=_0x55f692[_0xbd6e('0x5e')][_0xb7e9f1];var _0x2149d2=path['join'](_0x4ed14f,_0x14a149[_0xbd6e('0x6b')]);if(fs[_0xbd6e('0x6c')](_0x2149d2)){_0x1fa467[_0xbd6e('0x5a')][_0xbd6e('0x6d')]({'name':_0x14a149[_0xbd6e('0x1d')],'contentType':_0x14a149[_0xbd6e('0x22')],'data':fs['readFileSync'](_0x2149d2)});}}}emlformat[_0xbd6e('0x6e')](_0x1fa467,function(_0x151ddc,_0x9afde){if(_0x151ddc)return _0x51bc9e(_0x151ddc);fs[_0xbd6e('0x6f')](path['join'](_0x587d01,util[_0xbd6e('0x5b')](_0xbd6e('0x70'),_0x4b360c)),_0x9afde);return _0x324179(_0x9afde);});});})[_0xbd6e('0x1c')](function(){return new BPromise(function(_0x5ca4f3,_0x168e94){zipdir(_0x587d01,{'saveTo':_0x17e11d},function(_0x1a9ab2,_0x2da863){if(_0x1a9ab2)return _0x168e94(_0x1a9ab2);return _0x5ca4f3(_0x2da863);});})[_0xbd6e('0x1c')](function(){return new BPromise(function(_0x57b9f4,_0x575cae){rimraf(_0x587d01,function(_0x291a2b){if(_0x291a2b)_0x575cae(_0x291a2b);return _0x57b9f4();});});})[_0xbd6e('0x1c')](function(){return _0x2c378a['download'](_0x17e11d,_0x130dce,function(_0x2789a6){if(!_0x2789a6)fs[_0xbd6e('0x71')](_0x17e11d);});});});}else{return _0x2c378a[_0xbd6e('0x11')](0xc8);}})[_0xbd6e('0x27')](handleError(_0x2c378a,null));}; \ No newline at end of file +var _0x9396=['message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','name','map','MailInteraction','rawAttributes','fieldName','getOptions','findAll','mail','query','user','then','catch','show','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','getMessages','findOne','MailMessage','hasOwnProperty','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','server','files','join','root','attachments','push','Attachment','Messages','bcc','subject','mkdirSync','each','from','missing.recipient@your.company.com','decode','createdAt','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync'];(function(_0x268736,_0x10c763){var _0x449243=function(_0x302f00){while(--_0x302f00){_0x268736['push'](_0x268736['shift']());}};_0x449243(++_0x10c763);}(_0x9396,0x14c));var _0x6939=function(_0x3d65f4,_0xe14c3){_0x3d65f4=_0x3d65f4-0x0;var _0x128310=_0x9396[_0x3d65f4];return _0x128310;};'use strict';var emlformat=require(_0x6939('0x0'));var rimraf=require(_0x6939('0x1'));var zipdir=require('zip-dir');var moment=require(_0x6939('0x2'));var BPromise=require(_0x6939('0x3'));var util=require('util');var path=require(_0x6939('0x4'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0x6939('0x5'));var interaction=require(_0x6939('0x6'));var qs=require(_0x6939('0x7'));var logger=require(_0x6939('0x8'))(_0x6939('0x9'));var config=require(_0x6939('0xa'));var db=require(_0x6939('0xb'))['db'];var htmlEntities=require(_0x6939('0xc'));config[_0x6939('0xd')]=_['defaults'](config[_0x6939('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6939('0xe'))(new Redis(config['redis']));require(_0x6939('0xf'))[_0x6939('0x10')](socket);function respondWithStatusCode(_0x3e7f50,_0x130042){_0x130042=_0x130042||0xcc;return function(_0x41e4ec){if(_0x41e4ec){return _0x3e7f50[_0x6939('0x11')](_0x130042);}return _0x3e7f50[_0x6939('0x12')](_0x130042)[_0x6939('0x13')]();};}function respondWithResult(_0x47d343,_0x58b2fb){_0x58b2fb=_0x58b2fb||0xc8;return function(_0x3c2070){if(_0x3c2070){return _0x47d343[_0x6939('0x12')](_0x58b2fb)[_0x6939('0x14')](_0x3c2070);}};}function respondWithFilteredResult(_0x1c65b4,_0x364dbb){return function(_0xf18693){if(_0xf18693){var _0x1c6b83=typeof _0x364dbb['offset']===_0x6939('0x15')&&typeof _0x364dbb[_0x6939('0x16')]===_0x6939('0x15');var _0x4368fd=_0xf18693[_0x6939('0x17')];var _0x9ef86c=_0x1c6b83?0x0:_0x364dbb[_0x6939('0x18')];var _0x56177c=_0x1c6b83?_0xf18693[_0x6939('0x17')]:_0x364dbb[_0x6939('0x18')]+_0x364dbb[_0x6939('0x16')];var _0x365d6d;if(_0x56177c>=_0x4368fd){_0x56177c=_0x4368fd;_0x365d6d=0xc8;}else{_0x365d6d=0xce;}_0x1c65b4[_0x6939('0x12')](_0x365d6d);return _0x1c65b4['set'](_0x6939('0x19'),_0x9ef86c+'-'+_0x56177c+'/'+_0x4368fd)[_0x6939('0x14')](_0xf18693);}return null;};}function saveUpdates(_0x3e2792){return function(_0x26e035){if(_0x26e035){return _0x26e035[_0x6939('0x1a')](_0x3e2792)['then'](function(_0x5bcc2e){return _0x5bcc2e;});}return null;};}function removeEntity(_0x4ca0f8){return function(_0x2d3018){if(_0x2d3018){return _0x2d3018[_0x6939('0x1b')]()['then'](function(){_0x4ca0f8['status'](0xcc)[_0x6939('0x13')]();});}};}function handleEntityNotFound(_0x5aa33a){return function(_0x143239){if(!_0x143239){_0x5aa33a[_0x6939('0x11')](0x194);}return _0x143239;};}function handleError(_0x46a375,_0x4b51ab){_0x4b51ab=_0x4b51ab||0x1f4;return function(_0x26d4a0){logger['error'](_0x26d4a0['stack']);if(_0x26d4a0[_0x6939('0x1c')]){delete _0x26d4a0[_0x6939('0x1c')];}_0x46a375[_0x6939('0x12')](_0x4b51ab)['send'](_0x26d4a0);};}exports['index']=function(_0x12926a,_0x2a762c){var _0x37e398={};var _0x707d7a=_[_0x6939('0x1d')](db[_0x6939('0x1e')][_0x6939('0x1f')],function(_0x466137){return{'name':_0x466137[_0x6939('0x20')],'type':_0x466137['type']['key']};});_0x37e398=qs[_0x6939('0x21')](_0x707d7a,_0x12926a);return interaction[_0x6939('0x22')](_0x6939('0x23'),_0x12926a[_0x6939('0x24')],_0x12926a[_0x6939('0x25')],_0x37e398,_0x707d7a)[_0x6939('0x26')](respondWithFilteredResult(_0x2a762c,_0x37e398))[_0x6939('0x27')](handleError(_0x2a762c,null));};exports[_0x6939('0x28')]=function(_0x45aa67,_0x3dbde1){var _0x5affe9={'raw':![],'where':{'id':_0x45aa67[_0x6939('0x29')]['id']}},_0x3df4c6={};_0x3df4c6['model']=_[_0x6939('0x2a')](db['MailInteraction'][_0x6939('0x1f')]);_0x3df4c6['query']=_['keys'](_0x45aa67[_0x6939('0x24')]);_0x3df4c6[_0x6939('0x2b')]=_[_0x6939('0x2c')](_0x3df4c6[_0x6939('0x2d')],_0x3df4c6[_0x6939('0x24')]);_0x5affe9['attributes']=_[_0x6939('0x2c')](_0x3df4c6['model'],qs['fields'](_0x45aa67[_0x6939('0x24')][_0x6939('0x2e')]));_0x5affe9[_0x6939('0x2f')]=_0x5affe9[_0x6939('0x2f')][_0x6939('0x30')]?_0x5affe9[_0x6939('0x2f')]:_0x3df4c6[_0x6939('0x2d')];if(_0x45aa67[_0x6939('0x24')][_0x6939('0x31')]){_0x5affe9[_0x6939('0x32')]=[{'all':!![]}];}_0x5affe9=_[_0x6939('0x33')]({},_0x5affe9,_0x45aa67[_0x6939('0x34')]);return db[_0x6939('0x1e')][_0x6939('0x35')](_0x5affe9)[_0x6939('0x26')](handleEntityNotFound(_0x3dbde1,null))[_0x6939('0x26')](respondWithResult(_0x3dbde1,null))[_0x6939('0x27')](handleError(_0x3dbde1,null));};exports['create']=function(_0x1539be,_0x4ef30d){return db[_0x6939('0x1e')][_0x6939('0x36')](_0x1539be['body'],{})['then'](respondWithResult(_0x4ef30d,0xc9))[_0x6939('0x27')](handleError(_0x4ef30d,null));};exports[_0x6939('0x1a')]=function(_0x2a5b62,_0x7161d4){if(_0x2a5b62[_0x6939('0x37')]['id']){delete _0x2a5b62[_0x6939('0x37')]['id'];}return db[_0x6939('0x1e')]['find']({'where':{'id':_0x2a5b62[_0x6939('0x29')]['id']}})[_0x6939('0x26')](handleEntityNotFound(_0x7161d4,null))['then'](saveUpdates(_0x2a5b62['body'],null))[_0x6939('0x26')](respondWithResult(_0x7161d4,null))[_0x6939('0x27')](handleError(_0x7161d4,null));};exports[_0x6939('0x1b')]=function(_0x1cb754,_0x222c59){return db['MailInteraction'][_0x6939('0x35')]({'where':{'id':_0x1cb754[_0x6939('0x29')]['id']}})[_0x6939('0x26')](handleEntityNotFound(_0x222c59,null))[_0x6939('0x26')](removeEntity(_0x222c59,null))[_0x6939('0x27')](handleError(_0x222c59,null));};exports['describe']=function(_0xb9e86b,_0x1603db){return db[_0x6939('0x1e')][_0x6939('0x38')]()[_0x6939('0x26')](respondWithResult(_0x1603db,null))[_0x6939('0x27')](handleError(_0x1603db,null));};exports['addMessage']=function(_0xaba4b,_0x2e26ce){return db['MailMessage'][_0x6939('0x35')]({'where':{'id':_0xaba4b[_0x6939('0x29')]['id']}})[_0x6939('0x26')](handleEntityNotFound(_0x2e26ce,null))[_0x6939('0x26')](function(_0x5ac46e){if(_0x5ac46e){return _0x5ac46e[_0x6939('0x39')](_0xaba4b[_0x6939('0x37')][_0x6939('0x3a')],_['omit'](_0xaba4b[_0x6939('0x37')],['ids','id'])||{});}})[_0x6939('0x26')](respondWithResult(_0x2e26ce,null))['catch'](handleError(_0x2e26ce,null));};exports[_0x6939('0x3b')]=function(_0xeba107,_0x1d05ac){var _0x185cd4={'raw':![],'where':{}};var _0x38924b={};var _0x4e9861={'count':0x0,'rows':[]};return db[_0x6939('0x1e')][_0x6939('0x3c')]({'where':{'id':_0xeba107[_0x6939('0x29')]['id']}})[_0x6939('0x26')](handleEntityNotFound(_0x1d05ac,null))['then'](function(_0x26a589){if(_0x26a589){_0x38924b[_0x6939('0x2d')]=_[_0x6939('0x2a')](db[_0x6939('0x3d')]['rawAttributes']);_0x38924b[_0x6939('0x24')]=_[_0x6939('0x2a')](_0xeba107['query']);_0x38924b[_0x6939('0x2b')]=_[_0x6939('0x2c')](_0x38924b[_0x6939('0x2d')],_0x38924b[_0x6939('0x24')]);_0x185cd4['attributes']=_[_0x6939('0x2c')](_0x38924b[_0x6939('0x2d')],qs[_0x6939('0x2e')](_0xeba107[_0x6939('0x24')][_0x6939('0x2e')]));_0x185cd4[_0x6939('0x2f')]=_0x185cd4[_0x6939('0x2f')][_0x6939('0x30')]?_0x185cd4[_0x6939('0x2f')]:_0x38924b[_0x6939('0x2d')];if(!_0xeba107[_0x6939('0x24')][_0x6939('0x3e')]('nolimit')){_0x185cd4[_0x6939('0x16')]=qs[_0x6939('0x16')](_0xeba107['query'][_0x6939('0x16')]);_0x185cd4[_0x6939('0x18')]=qs[_0x6939('0x18')](_0xeba107['query'][_0x6939('0x18')]);}_0x185cd4[_0x6939('0x3f')]=qs[_0x6939('0x40')](_0xeba107[_0x6939('0x24')][_0x6939('0x40')]);_0x185cd4['where']=qs['filters'](_['pick'](_0xeba107[_0x6939('0x24')],_0x38924b[_0x6939('0x2b')]));_0x185cd4['where']['MailInteractionId']=_0x26a589['id'];if(_0xeba107[_0x6939('0x24')]['filter']){_0x185cd4[_0x6939('0x41')]=_['merge'](_0x185cd4[_0x6939('0x41')],{'$or':_['map'](_0x185cd4[_0x6939('0x2f')],function(_0x1bc841){var _0x3dc668={};_0x3dc668[_0x1bc841]={'$like':'%'+_0xeba107[_0x6939('0x24')][_0x6939('0x42')]+'%'};return _0x3dc668;})});}if(_0xeba107['query'][_0x6939('0x43')]){var _0x33ae08=_0xeba107['query'][_0x6939('0x43')][_0x6939('0x44')](',');var _0x3524bc={};_0x3524bc[_0x33ae08[0x0]]={'$gte':moment(_0x33ae08[0x1])[_0x6939('0x45')](_0x6939('0x46'))};_0x185cd4[_0x6939('0x41')]=_[_0x6939('0x33')](_0x185cd4[_0x6939('0x41')],_0x3524bc);}_0x185cd4=_[_0x6939('0x33')]({},_0x185cd4,_0xeba107[_0x6939('0x34')]);return db[_0x6939('0x3d')][_0x6939('0x17')]({'where':_0x185cd4[_0x6939('0x41')]})[_0x6939('0x26')](function(_0x50b2cb){_0x4e9861[_0x6939('0x17')]=_0x50b2cb;if(_0xeba107[_0x6939('0x24')][_0x6939('0x31')]){_0x185cd4[_0x6939('0x32')]=[{'all':!![]}];}return db[_0x6939('0x3d')][_0x6939('0x22')](_0x185cd4);})[_0x6939('0x26')](function(_0x2966ed){if(_0xeba107[_0x6939('0x24')][_0x6939('0x47')]===_0x6939('0x48')){for(var _0x1720f4=0x0;_0x1720f4<_0x2966ed[_0x6939('0x30')];_0x1720f4++){_0x2966ed[_0x1720f4][_0x6939('0x37')]=juice(_0x2966ed[_0x1720f4][_0x6939('0x37')]);}}_0x4e9861[_0x6939('0x49')]=_0x2966ed;return _0x4e9861;});}})['then'](respondWithFilteredResult(_0x1d05ac,_0x185cd4))[_0x6939('0x27')](handleError(_0x1d05ac,null));};exports[_0x6939('0x4a')]=function(_0x1be406,_0x54ae94){return db[_0x6939('0x1e')]['find']({'where':{'id':_0x1be406['params']['id']}})[_0x6939('0x26')](handleEntityNotFound(_0x54ae94,null))[_0x6939('0x26')](function(_0x41f20b){if(_0x41f20b){return _0x41f20b['setTags'](_0x1be406[_0x6939('0x37')][_0x6939('0x3a')],_[_0x6939('0x4b')](_0x1be406[_0x6939('0x37')],[_0x6939('0x3a'),'id'])||{})[_0x6939('0x4c')](function(){return db[_0x6939('0x4d')][_0x6939('0x22')]({'attributes':['id',_0x6939('0x1c'),_0x6939('0x4e')],'where':{'id':_0x1be406[_0x6939('0x37')][_0x6939('0x3a')]}});})['then'](function(_0x1a7701){socket[_0x6939('0x4f')](_0x6939('0x50'),{'id':Number(_0x1be406[_0x6939('0x29')]['id']),'tags':_0x1a7701||[]});return{'id':Number(_0x1be406[_0x6939('0x29')]['id']),'tags':_0x1a7701||[]};});}})['then'](respondWithResult(_0x54ae94,null))[_0x6939('0x27')](handleError(_0x54ae94,null));};exports[_0x6939('0x51')]=function(_0x5b6dcb,_0x4a6188){return db[_0x6939('0x1e')][_0x6939('0x35')]({'where':{'id':_0x5b6dcb[_0x6939('0x29')]['id']}})[_0x6939('0x26')](handleEntityNotFound(_0x4a6188,null))[_0x6939('0x26')](function(_0x50c0f6){if(_0x50c0f6){return _0x50c0f6[_0x6939('0x51')](_0x5b6dcb[_0x6939('0x24')][_0x6939('0x3a')]);}})[_0x6939('0x26')](respondWithStatusCode(_0x4a6188,null))['catch'](handleError(_0x4a6188,null));};exports[_0x6939('0x52')]=function(_0x354b29,_0x4ed4d1){var _0x3c4157=moment()[_0x6939('0x53')]()['toString']();var _0x31b2c1=path['join'](config['root'],_0x6939('0x54'),_0x6939('0x55'),'tmp');var _0x1bd6f4=path[_0x6939('0x56')](config[_0x6939('0x57')],'server','files',_0x6939('0x58'));var _0x47f7fc=path[_0x6939('0x56')](_0x31b2c1,_0x3c4157);var _0x1de72c=util[_0x6939('0x45')]('transcript-%d-%s.zip',_0x354b29['params']['id'],_0x3c4157);var _0xe068b2=path[_0x6939('0x56')](_0x31b2c1,_0x1de72c);var _0x55f649=[];if(_0x354b29[_0x6939('0x24')][_0x6939('0x58')]){_0x55f649[_0x6939('0x59')]({'model':db[_0x6939('0x5a')],'as':'Attachments','raw':!![]});}var _0x8abcdd=[{'model':db[_0x6939('0x3d')],'as':_0x6939('0x5b'),'attributes':['id',_0x6939('0x37'),'from','to','cc',_0x6939('0x5c'),_0x6939('0x5d'),'createdAt'],'where':{'secret':![]},'order':qs[_0x6939('0x40')]('id'),'include':_0x55f649}];return db[_0x6939('0x1e')]['find']({'where':{'id':_0x354b29['params']['id']},'include':_0x8abcdd})['then'](handleEntityNotFound(_0x4ed4d1,null))['then'](function(_0x2942d7){if(_0x2942d7&&_0x2942d7['Messages']){var _0x443926=_0x2942d7['get']({'plain':!![]});fs[_0x6939('0x5e')](_0x47f7fc);return BPromise[_0x6939('0x5f')](_0x443926[_0x6939('0x5b')],function(_0x1acda6,_0x1a9306){var _0xb9dea0={'from':_0x1acda6[_0x6939('0x60')],'to':_0x1acda6['to']||_0x6939('0x61'),'subject':_0x1acda6['subject'],'html':htmlEntities[_0x6939('0x62')](_0x1acda6[_0x6939('0x37')]),'headers':{'Date':moment(_0x1acda6[_0x6939('0x63')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1acda6['cc']){_0xb9dea0[_0x6939('0x64')]['Cc']=_0x1acda6['cc'];}if(_0x1acda6[_0x6939('0x5c')]){_0xb9dea0[_0x6939('0x64')][_0x6939('0x65')]=_0x1acda6['bcc'];}return new BPromise(function(_0x5c1c27,_0x27a474){if(_0x1acda6['Attachments']){for(var _0x50ff23=0x0;_0x50ff23<_0x1acda6[_0x6939('0x66')][_0x6939('0x30')];_0x50ff23++){var _0x7cdb76=_0x1acda6['Attachments'][_0x50ff23];var _0x44064a=path[_0x6939('0x56')](_0x1bd6f4,_0x7cdb76[_0x6939('0x67')]);if(fs[_0x6939('0x68')](_0x44064a)){_0xb9dea0['attachments'][_0x6939('0x59')]({'name':_0x7cdb76[_0x6939('0x1c')],'contentType':_0x7cdb76['type'],'data':fs[_0x6939('0x69')](_0x44064a)});}}}emlformat[_0x6939('0x6a')](_0xb9dea0,function(_0x26f0f0,_0x56c427){if(_0x26f0f0)return _0x27a474(_0x26f0f0);fs[_0x6939('0x6b')](path[_0x6939('0x56')](_0x47f7fc,util['format'](_0x6939('0x6c'),_0x1a9306)),_0x56c427);return _0x5c1c27(_0x56c427);});});})[_0x6939('0x26')](function(){return new BPromise(function(_0x335f5c,_0x21edef){zipdir(_0x47f7fc,{'saveTo':_0xe068b2},function(_0x4b99f3,_0x4f568b){if(_0x4b99f3)return _0x21edef(_0x4b99f3);return _0x335f5c(_0x4f568b);});})[_0x6939('0x26')](function(){return new BPromise(function(_0x3e85f2,_0x31d3a9){rimraf(_0x47f7fc,function(_0x4f929f){if(_0x4f929f)_0x31d3a9(_0x4f929f);return _0x3e85f2();});});})['then'](function(){return _0x4ed4d1[_0x6939('0x52')](_0xe068b2,_0x1de72c,function(_0x2bf79f){if(!_0x2bf79f)fs[_0x6939('0x6d')](_0xe068b2);});});});}else{return _0x4ed4d1[_0x6939('0x11')](0xc8);}})[_0x6939('0x27')](handleError(_0x4ed4d1,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9ec88bf..937d956 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 _0xe7c1=['then','setDataValue','map','unreadMessages','length','emit','catch','hook','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers'];(function(_0x1df966,_0x3e42fe){var _0x170815=function(_0x16d991){while(--_0x16d991){_0x1df966['push'](_0x1df966['shift']());}};_0x170815(++_0x3e42fe);}(_0xe7c1,0x178));var _0x1e7c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe7c1[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x1e7c('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x1e7c('0x1')];var MailMessage=require(_0x1e7c('0x2'))['db'][_0x1e7c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1e7c('0x4')](0x0);var events={'afterCreate':_0x1e7c('0x5'),'afterUpdate':_0x1e7c('0x6'),'afterDestroy':'remove'};function emitEvent(_0x5555da){return function(_0x54f450,_0x12eab5,_0x2eff1a){_0x54f450[_0x1e7c('0x7')]({'attributes':['id'],'raw':!![]})[_0x1e7c('0x8')](function(_0x554d75){_0x54f450[_0x1e7c('0x9')]('Users',_0x554d75[_0x1e7c('0xa')](function(_0x66e682){return{'id':_0x66e682['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x54f450['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e7c('0x8')](function(_0x41402d){_0x54f450[_0x1e7c('0x9')](_0x1e7c('0xb'),_0x41402d[_0x1e7c('0xc')]);MailInteractionEvents[_0x1e7c('0xd')](_0x5555da+':'+_0x54f450['id'],_0x54f450);MailInteractionEvents[_0x1e7c('0xd')](_0x5555da,_0x54f450);_0x2eff1a(null);})[_0x1e7c('0xe')](_0x2eff1a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x1e7c('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x5a88=['update','remove','getUsers','then','setDataValue','Users','findAll','length','catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x11459c,_0x55d931){var _0x47068a=function(_0x55e9aa){while(--_0x55e9aa){_0x11459c['push'](_0x11459c['shift']());}};_0x47068a(++_0x55d931);}(_0x5a88,0x17b));var _0x85a8=function(_0x14c04c,_0x4dde85){_0x14c04c=_0x14c04c-0x0;var _0xaa13b6=_0x5a88[_0x14c04c];return _0xaa13b6;};'use strict';var EventEmitter=require(_0x85a8('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x85a8('0x1'))['db'][_0x85a8('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x85a8('0x3')](0x0);var events={'afterCreate':_0x85a8('0x4'),'afterUpdate':_0x85a8('0x5'),'afterDestroy':_0x85a8('0x6')};function emitEvent(_0xbbbfaf){return function(_0x55dc54,_0x23c5a1,_0x4b208f){_0x55dc54[_0x85a8('0x7')]({'attributes':['id'],'raw':!![]})[_0x85a8('0x8')](function(_0xee85cd){_0x55dc54[_0x85a8('0x9')](_0x85a8('0xa'),_0xee85cd['map'](function(_0x2e3e71){return{'id':_0x2e3e71['id']};}));return MailMessage[_0x85a8('0xb')]({'where':{'MailInteractionId':_0x55dc54['id'],'direction':'in','read':![]},'raw':!![]});})[_0x85a8('0x8')](function(_0x591f6d){_0x55dc54[_0x85a8('0x9')]('unreadMessages',_0x591f6d[_0x85a8('0xc')]);MailInteractionEvents['emit'](_0xbbbfaf+':'+_0x55dc54['id'],_0x55dc54);MailInteractionEvents['emit'](_0xbbbfaf,_0x55dc54);_0x4b208f(null);})[_0x85a8('0xd')](_0x4b208f(null));};}for(var e in events){if(events[_0x85a8('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x85a8('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0aeeceb..1621402 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 _0x585d=['MailMessage','update','catch','utf8mb4','api','bluebird','path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get'];(function(_0x17b62f,_0x525601){var _0x30b276=function(_0x4b9b88){while(--_0x4b9b88){_0x17b62f['push'](_0x17b62f['shift']());}};_0x30b276(++_0x525601);}(_0x585d,0x124));var _0xd585=function(_0x1e906e,_0x590353){_0x1e906e=_0x1e906e-0x0;var _0x308688=_0x585d[_0x1e906e];return _0x308688;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd585('0x0'));var moment=require('moment');var BPromise=require(_0xd585('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd585('0x2'));var rimraf=require('rimraf');var config=require(_0xd585('0x3'));var attributes=require(_0xd585('0x4'));module[_0xd585('0x5')]=function(_0x1873dd,_0x21da93){return _0x1873dd[_0xd585('0x6')](_0xd585('0x7'),attributes,{'tableName':_0xd585('0x8'),'paranoid':![],'indexes':[{'name':_0xd585('0x9'),'fields':['subject','to'],'type':_0xd585('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d15da,_0x480079,_0x3eeabb){if(_0x2d15da[_0xd585('0xb')]){_0x2d15da[_0xd585('0xc')]=moment()[_0xd585('0xd')](_0xd585('0xe'));}if(_0x2d15da[_0xd585('0xf')]){_0x2d15da[_0xd585('0x10')]=moment()['format'](_0xd585('0xe'));}_0x3eeabb(null,_0x480079);},'beforeUpdate':function(_0xf55218,_0x1f2880,_0x13039d){if(_0xf55218[_0xd585('0x11')](_0xd585('0xb'))){_0xf55218[_0xd585('0xc')]=_0xf55218[_0xd585('0xb')]?moment()[_0xd585('0xd')](_0xd585('0xe')):null;}if(_0xf55218[_0xd585('0x11')](_0xd585('0xf'))){_0xf55218[_0xd585('0x10')]=moment()[_0xd585('0xd')](_0xd585('0xe'));_0xf55218[_0xd585('0xb')]=null;_0xf55218[_0xd585('0xc')]=null;}_0x13039d(null,_0xf55218);},'afterUpdate':function(_0x2b9889,_0x2a1e07,_0x377942){var _0x26010e=_0x1873dd[_0xd585('0x12')];var _0x41b5cd=_0x2b9889[_0xd585('0x13')]({'plain':!![]});if(_0x41b5cd[_0xd585('0xf')]){return _0x26010e[_0xd585('0x14')][_0xd585('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x41b5cd['id']}})['then'](function(){_0x377942();})[_0xd585('0x16')](function(_0x109eba){_0x377942(_0x109eba);});}else{_0x377942();}}},'charset':_0xd585('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x85cc=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT'];(function(_0x576b8e,_0x2d7317){var _0x389f9f=function(_0x4d1657){while(--_0x4d1657){_0x576b8e['push'](_0x576b8e['shift']());}};_0x389f9f(++_0x2d7317);}(_0x85cc,0x84));var _0xc85c=function(_0x49f7ef,_0x434f8a){_0x49f7ef=_0x49f7ef-0x0;var _0x1435d8=_0x85cc[_0x49f7ef];return _0x1435d8;};'use strict';var _=require('lodash');var util=require(_0xc85c('0x0'));var logger=require(_0xc85c('0x1'))(_0xc85c('0x2'));var moment=require(_0xc85c('0x3'));var BPromise=require('bluebird');var rp=require(_0xc85c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc85c('0x5'));module[_0xc85c('0x6')]=function(_0x5f42cb,_0x20cc18){return _0x5f42cb[_0xc85c('0x7')](_0xc85c('0x8'),attributes,{'tableName':_0xc85c('0x9'),'paranoid':![],'indexes':[{'name':_0xc85c('0xa'),'fields':['subject','to'],'type':_0xc85c('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5807fa,_0x503865,_0x1a5677){if(_0x5807fa[_0xc85c('0xc')]){_0x5807fa[_0xc85c('0xd')]=moment()[_0xc85c('0xe')](_0xc85c('0xf'));}if(_0x5807fa[_0xc85c('0x10')]){_0x5807fa[_0xc85c('0x11')]=moment()[_0xc85c('0xe')](_0xc85c('0xf'));}_0x1a5677(null,_0x503865);},'beforeUpdate':function(_0x3e9d11,_0x3139fa,_0x170052){if(_0x3e9d11[_0xc85c('0x12')](_0xc85c('0xc'))){_0x3e9d11[_0xc85c('0xd')]=_0x3e9d11['substatus']?moment()[_0xc85c('0xe')](_0xc85c('0xf')):null;}if(_0x3e9d11[_0xc85c('0x12')](_0xc85c('0x10'))){_0x3e9d11['closedAt']=moment()[_0xc85c('0xe')](_0xc85c('0xf'));_0x3e9d11[_0xc85c('0xc')]=null;_0x3e9d11[_0xc85c('0xd')]=null;}_0x170052(null,_0x3e9d11);},'afterUpdate':function(_0x41e48e,_0x574fdf,_0x3fddbb){var _0x42bccc=_0x5f42cb['models'];var _0x5ad953=_0x41e48e['get']({'plain':!![]});if(_0x5ad953[_0xc85c('0x10')]){return _0x42bccc[_0xc85c('0x13')][_0xc85c('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x5ad953['id']}})['then'](function(){_0x3fddbb();})[_0xc85c('0x15')](function(_0x11a68b){_0x3fddbb(_0x11a68b);});}else{_0x3fddbb();}}},'charset':_0xc85c('0x16'),'collate':_0xc85c('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 511066a..17e9164 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 _0xd714=['raw','where','attributes','then','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','catch','MailInteraction','update','body','options'];(function(_0x1c9fc4,_0x240343){var _0x2efcba=function(_0x57faea){while(--_0x57faea){_0x1c9fc4['push'](_0x1c9fc4['shift']());}};_0x2efcba(++_0x240343);}(_0xd714,0x1e4));var _0x4d71=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0xd714[_0xcfeda9];return _0x4826c7;};'use strict';var _=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var moment=require('moment');var BPromise=require(_0x4d71('0x2'));var rs=require(_0x4d71('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d71('0x4'));var logger=require(_0x4d71('0x5'))(_0x4d71('0x6'));var config=require(_0x4d71('0x7'));var jayson=require(_0x4d71('0x8'));var client=jayson[_0x4d71('0x9')][_0x4d71('0xa')]({'port':0x232a});config[_0x4d71('0xb')]=_[_0x4d71('0xc')](config[_0x4d71('0xb')],{'host':_0x4d71('0xd'),'port':0x18eb});var socket=require(_0x4d71('0xe'))(new Redis(config[_0x4d71('0xb')]));require(_0x4d71('0xf'))[_0x4d71('0x10')](socket);function respondWithRpcPromise(_0x446578,_0x4cd105,_0x35c38e){return new BPromise(function(_0x30d21b,_0x26babc){return client[_0x4d71('0x11')](_0x446578,_0x35c38e)['then'](function(_0x2c1a57){logger[_0x4d71('0x12')]('MailInteraction,\x20%s,\x20%s',_0x4cd105,_0x4d71('0x13'));logger[_0x4d71('0x14')](_0x4d71('0x15'),_0x4cd105,_0x4d71('0x13'),JSON[_0x4d71('0x16')](_0x2c1a57));if(_0x2c1a57[_0x4d71('0x17')]){if(_0x2c1a57['error'][_0x4d71('0x18')]===0x1f4){logger[_0x4d71('0x17')](_0x4d71('0x19'),_0x4cd105,_0x2c1a57['error'][_0x4d71('0x1a')]);return _0x26babc(_0x2c1a57[_0x4d71('0x17')][_0x4d71('0x1a')]);}logger[_0x4d71('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4cd105,_0x2c1a57['error']['message']);return _0x30d21b(_0x2c1a57[_0x4d71('0x17')][_0x4d71('0x1a')]);}else{logger[_0x4d71('0x12')](_0x4d71('0x19'),_0x4cd105,_0x4d71('0x13'));_0x30d21b(_0x2c1a57['result'][_0x4d71('0x1a')]);}})[_0x4d71('0x1b')](function(_0x13bb1e){logger['error'](_0x4d71('0x19'),_0x4cd105,_0x13bb1e);_0x26babc(_0x13bb1e);});});}exports['UpdateMailInteraction']=function(_0x25ac24){var _0x58a6f4=this;return new Promise(function(_0x453d30,_0x184dbe){return db[_0x4d71('0x1c')][_0x4d71('0x1d')](_0x25ac24[_0x4d71('0x1e')],{'raw':_0x25ac24[_0x4d71('0x1f')]?_0x25ac24[_0x4d71('0x1f')][_0x4d71('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25ac24['options']?_0x25ac24[_0x4d71('0x1f')][_0x4d71('0x21')]||null:null,'attributes':_0x25ac24[_0x4d71('0x1f')]?_0x25ac24[_0x4d71('0x1f')][_0x4d71('0x22')]||null:null,'limit':_0x25ac24[_0x4d71('0x1f')]?_0x25ac24[_0x4d71('0x1f')]['limit']||null:null})[_0x4d71('0x23')](function(_0x289e5e){logger[_0x4d71('0x12')](_0x4d71('0x24'),_0x25ac24);logger[_0x4d71('0x14')](_0x4d71('0x24'),_0x25ac24,JSON['stringify'](_0x289e5e));_0x453d30(_0x289e5e);})[_0x4d71('0x1b')](function(_0x121eab){logger[_0x4d71('0x17')](_0x4d71('0x24'),_0x121eab[_0x4d71('0x1a')],_0x25ac24);_0x184dbe(_0x58a6f4[_0x4d71('0x17')](0x1f4,_0x121eab[_0x4d71('0x1a')]));});});};exports[_0x4d71('0x25')]=function(_0x3c4d0a){return new Promise(function(_0x21f6f2,_0x47755e){return db[_0x4d71('0x1c')][_0x4d71('0x26')]({'where':_0x3c4d0a[_0x4d71('0x1f')]?_0x3c4d0a[_0x4d71('0x1f')][_0x4d71('0x21')]||null:null})[_0x4d71('0x23')](function(_0x4fbfcb){if(_0x4fbfcb){return _0x4fbfcb[_0x4d71('0x27')](_0x3c4d0a[_0x4d71('0x1e')][_0x4d71('0x28')],_[_0x4d71('0x29')](_0x3c4d0a[_0x4d71('0x1e')],['ids','id'])||{});}})['spread'](function(_0x557a10){logger[_0x4d71('0x12')](_0x4d71('0x2a'),_0x3c4d0a);logger['debug'](_0x4d71('0x2a'),_0x3c4d0a,JSON[_0x4d71('0x16')](_0x557a10));_0x21f6f2(_0x557a10);})[_0x4d71('0x1b')](function(_0x159f6e){logger['error'](_0x4d71('0x2a'),_0x159f6e['message'],_0x3c4d0a);_0x47755e(_this[_0x4d71('0x17')](0x1f4,_0x159f6e[_0x4d71('0x1a')]));});});}; \ No newline at end of file +var _0x9fee=['spread','AddTags','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','then','debug','AddTagsToMailInteraction','find','addTags','ids','omit'];(function(_0x14055b,_0xe87ef6){var _0x55ff29=function(_0x35bdb4){while(--_0x35bdb4){_0x14055b['push'](_0x14055b['shift']());}};_0x55ff29(++_0xe87ef6);}(_0x9fee,0x1e7));var _0xe9fe=function(_0x2cd19,_0x5f4e46){_0x2cd19=_0x2cd19-0x0;var _0x19c8fe=_0x9fee[_0x2cd19];return _0x19c8fe;};'use strict';var _=require('lodash');var util=require(_0xe9fe('0x0'));var moment=require(_0xe9fe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9fe('0x2'));var db=require(_0xe9fe('0x3'))['db'];var utils=require(_0xe9fe('0x4'));var logger=require(_0xe9fe('0x5'))(_0xe9fe('0x6'));var config=require(_0xe9fe('0x7'));var jayson=require(_0xe9fe('0x8'));var client=jayson['client'][_0xe9fe('0x9')]({'port':0x232a});config[_0xe9fe('0xa')]=_[_0xe9fe('0xb')](config['redis'],{'host':_0xe9fe('0xc'),'port':0x18eb});var socket=require(_0xe9fe('0xd'))(new Redis(config[_0xe9fe('0xa')]));require(_0xe9fe('0xe'))[_0xe9fe('0xf')](socket);function respondWithRpcPromise(_0x885f3d,_0x124d25,_0x2fb93c){return new BPromise(function(_0x548660,_0x2631c5){return client[_0xe9fe('0x10')](_0x885f3d,_0x2fb93c)['then'](function(_0x59449e){logger[_0xe9fe('0x11')]('MailInteraction,\x20%s,\x20%s',_0x124d25,_0xe9fe('0x12'));logger['debug'](_0xe9fe('0x13'),_0x124d25,'request\x20sent',JSON['stringify'](_0x59449e));if(_0x59449e[_0xe9fe('0x14')]){if(_0x59449e[_0xe9fe('0x14')][_0xe9fe('0x15')]===0x1f4){logger[_0xe9fe('0x14')](_0xe9fe('0x16'),_0x124d25,_0x59449e['error']['message']);return _0x2631c5(_0x59449e['error'][_0xe9fe('0x17')]);}logger[_0xe9fe('0x14')](_0xe9fe('0x16'),_0x124d25,_0x59449e[_0xe9fe('0x14')]['message']);return _0x548660(_0x59449e['error']['message']);}else{logger['info'](_0xe9fe('0x16'),_0x124d25,'request\x20sent');_0x548660(_0x59449e[_0xe9fe('0x18')]['message']);}})[_0xe9fe('0x19')](function(_0x16c44d){logger[_0xe9fe('0x14')]('MailInteraction,\x20%s,\x20%s',_0x124d25,_0x16c44d);_0x2631c5(_0x16c44d);});});}exports[_0xe9fe('0x1a')]=function(_0x39db72){var _0x23b607=this;return new Promise(function(_0x447359,_0x36658b){return db[_0xe9fe('0x1b')]['update'](_0x39db72[_0xe9fe('0x1c')],{'raw':_0x39db72[_0xe9fe('0x1d')]?_0x39db72[_0xe9fe('0x1d')][_0xe9fe('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39db72['options']?_0x39db72[_0xe9fe('0x1d')][_0xe9fe('0x1f')]||null:null,'attributes':_0x39db72[_0xe9fe('0x1d')]?_0x39db72[_0xe9fe('0x1d')][_0xe9fe('0x20')]||null:null,'limit':_0x39db72['options']?_0x39db72[_0xe9fe('0x1d')][_0xe9fe('0x21')]||null:null})[_0xe9fe('0x22')](function(_0x486970){logger[_0xe9fe('0x11')]('UpdateMailInteraction',_0x39db72);logger[_0xe9fe('0x23')](_0xe9fe('0x1a'),_0x39db72,JSON['stringify'](_0x486970));_0x447359(_0x486970);})[_0xe9fe('0x19')](function(_0x28c43e){logger['error'](_0xe9fe('0x1a'),_0x28c43e[_0xe9fe('0x17')],_0x39db72);_0x36658b(_0x23b607[_0xe9fe('0x14')](0x1f4,_0x28c43e[_0xe9fe('0x17')]));});});};exports[_0xe9fe('0x24')]=function(_0x3b4b2b){return new Promise(function(_0x5308d3,_0x8ee56b){return db['MailInteraction'][_0xe9fe('0x25')]({'where':_0x3b4b2b[_0xe9fe('0x1d')]?_0x3b4b2b[_0xe9fe('0x1d')]['where']||null:null})['then'](function(_0x478db8){if(_0x478db8){return _0x478db8[_0xe9fe('0x26')](_0x3b4b2b[_0xe9fe('0x1c')][_0xe9fe('0x27')],_[_0xe9fe('0x28')](_0x3b4b2b[_0xe9fe('0x1c')],[_0xe9fe('0x27'),'id'])||{});}})[_0xe9fe('0x29')](function(_0x56bbf5){logger[_0xe9fe('0x11')](_0xe9fe('0x2a'),_0x3b4b2b);logger['debug'](_0xe9fe('0x2a'),_0x3b4b2b,JSON[_0xe9fe('0x2b')](_0x56bbf5));_0x5308d3(_0x56bbf5);})[_0xe9fe('0x19')](function(_0x2231ef){logger[_0xe9fe('0x14')](_0xe9fe('0x2a'),_0x2231ef[_0xe9fe('0x17')],_0x3b4b2b);_0x8ee56b(_this[_0xe9fe('0x14')](0x1f4,_0x2231ef[_0xe9fe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index cda12ca..ed432df 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 _0xa051=['update','removeListener','register'];(function(_0x4c9fa9,_0x478b86){var _0x3ca7e0=function(_0x3ae043){while(--_0x3ae043){_0x4c9fa9['push'](_0x4c9fa9['shift']());}};_0x3ca7e0(++_0x478b86);}(_0xa051,0x75));var _0x1a05=function(_0x137768,_0x2bab24){_0x137768=_0x137768-0x0;var _0x608edf=_0xa051[_0x137768];return _0x608edf;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove',_0x1a05('0x0')];function createListener(_0x328e0c,_0x55c75a){return function(_0x27ee87){_0x55c75a['emit'](_0x328e0c,_0x27ee87);};}function removeListener(_0x446354,_0x25cae3){return function(){MailInteractionEvents[_0x1a05('0x1')](_0x446354,_0x25cae3);};}exports[_0x1a05('0x2')]=function(_0x268ff1){for(var _0x40a48a=0x0,_0x36d44c=events['length'];_0x40a48a<_0x36d44c;_0x40a48a++){var _0x2eae1a=events[_0x40a48a];var _0x59fd8e=createListener('mailInteraction:'+_0x2eae1a,_0x268ff1);MailInteractionEvents['on'](_0x2eae1a,_0x59fd8e);}}; \ No newline at end of file +var _0x06f9=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','register'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x06f9,0x95));var _0x906f=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x06f9[_0x15c421];return _0x5e5ed5;};'use strict';var MailInteractionEvents=require(_0x906f('0x0'));var events=[_0x906f('0x1'),_0x906f('0x2'),'update'];function createListener(_0x35426e,_0x2a4016){return function(_0x3bbad5){_0x2a4016[_0x906f('0x3')](_0x35426e,_0x3bbad5);};}function removeListener(_0x199b4b,_0x2e1bc4){return function(){MailInteractionEvents['removeListener'](_0x199b4b,_0x2e1bc4);};}exports[_0x906f('0x4')]=function(_0x22c023){for(var _0x293422=0x0,_0x5936fa=events[_0x906f('0x5')];_0x293422<_0x5936fa;_0x293422++){var _0x492713=events[_0x293422];var _0x3064e5=createListener(_0x906f('0x6')+_0x492713,_0x22c023);MailInteractionEvents['on'](_0x492713,_0x3064e5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5853513..96eab98 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 _0xbca8=['/:id','show','download','post','mail','create','put','update','/:id/accept','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x129ea5,_0xa0cde5){var _0x4f13ea=function(_0x5d623a){while(--_0x5d623a){_0x129ea5['push'](_0x129ea5['shift']());}};_0x4f13ea(++_0xa0cde5);}(_0xbca8,0xcc));var _0x8bca=function(_0x31db82,_0x578aeb){_0x31db82=_0x31db82-0x0;var _0x2e7f4f=_0xbca8[_0x31db82];return _0x2e7f4f;};'use strict';var multer=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var path=require(_0x8bca('0x2'));var timeout=require(_0x8bca('0x3'));var express=require(_0x8bca('0x4'));var router=express['Router']();var fs_extra=require(_0x8bca('0x5'));var auth=require(_0x8bca('0x6'));var interaction=require(_0x8bca('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x8bca('0x8')]('/',auth[_0x8bca('0x9')](),controller[_0x8bca('0xa')]);router[_0x8bca('0x8')]('/describe',auth[_0x8bca('0x9')](),controller[_0x8bca('0xb')]);router[_0x8bca('0x8')](_0x8bca('0xc'),auth[_0x8bca('0x9')](),controller[_0x8bca('0xd')]);router[_0x8bca('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x8bca('0xe')]);router[_0x8bca('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x8bca('0x10'),'mailmessage:create'),controller[_0x8bca('0x11')]);router[_0x8bca('0x12')]('/:id',auth[_0x8bca('0x9')](),controller[_0x8bca('0x13')]);router[_0x8bca('0x12')](_0x8bca('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0x8bca('0x12')]('/:id/reject',auth[_0x8bca('0x9')](),controller[_0x8bca('0x15')]);router[_0x8bca('0x16')](_0x8bca('0xc'),auth[_0x8bca('0x9')](),controller[_0x8bca('0x17')]);module['exports']=router; \ No newline at end of file +var _0x99cd=['download','post','tracked','mail','mailmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/download'];(function(_0x275680,_0x1f67c1){var _0x3814dd=function(_0x24e51a){while(--_0x24e51a){_0x275680['push'](_0x275680['shift']());}};_0x3814dd(++_0x1f67c1);}(_0x99cd,0x1df));var _0xd99c=function(_0x1ac31a,_0x236da2){_0x1ac31a=_0x1ac31a-0x0;var _0x54a0c1=_0x99cd[_0x1ac31a];return _0x54a0c1;};'use strict';var multer=require(_0xd99c('0x0'));var util=require('util');var path=require(_0xd99c('0x1'));var timeout=require(_0xd99c('0x2'));var express=require(_0xd99c('0x3'));var router=express[_0xd99c('0x4')]();var fs_extra=require(_0xd99c('0x5'));var auth=require(_0xd99c('0x6'));var interaction=require(_0xd99c('0x7'));var config=require(_0xd99c('0x8'));var controller=require(_0xd99c('0x9'));router[_0xd99c('0xa')]('/',auth['isAuthenticated'](),controller[_0xd99c('0xb')]);router['get'](_0xd99c('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xd99c('0xa')](_0xd99c('0xd'),auth[_0xd99c('0xe')](),controller[_0xd99c('0xf')]);router[_0xd99c('0xa')](_0xd99c('0x10'),auth[_0xd99c('0xe')](),controller[_0xd99c('0x11')]);router[_0xd99c('0x12')]('/',auth[_0xd99c('0xe')](),interaction[_0xd99c('0x13')](_0xd99c('0x14'),_0xd99c('0x15')),controller[_0xd99c('0x16')]);router['put'](_0xd99c('0xd'),auth[_0xd99c('0xe')](),controller[_0xd99c('0x17')]);router[_0xd99c('0x18')](_0xd99c('0x19'),auth['isAuthenticated'](),controller[_0xd99c('0x1a')]);router[_0xd99c('0x18')](_0xd99c('0x1b'),auth[_0xd99c('0xe')](),controller[_0xd99c('0x1c')]);router['delete'](_0xd99c('0xd'),auth[_0xd99c('0xe')](),controller[_0xd99c('0x1d')]);module[_0xd99c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index a24d42e..072c8d5 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 _0x9dab=['DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x37dc02,_0x3fdfe6){var _0x151ffc=function(_0x1ec95e){while(--_0x1ec95e){_0x37dc02['push'](_0x37dc02['shift']());}};_0x151ffc(++_0x3fdfe6);}(_0x9dab,0x17e));var _0xb9da=function(_0xb9a53b,_0x4716f5){_0xb9a53b=_0xb9a53b-0x0;var _0x49b305=_0x9dab[_0xb9a53b];return _0x49b305;};'use strict';var Sequelize=require(_0xb9da('0x0'));var _=require(_0xb9da('0x1'));module[_0xb9da('0x2')]={'body':{'type':Sequelize[_0xb9da('0x3')](_0xb9da('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xb9da('0x5'))},'read':{'type':Sequelize[_0xb9da('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb9da('0x7')]('in','out'),'defaultValue':_0xb9da('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb9da('0x9')](0x1fe)},'from':{'type':Sequelize[_0xb9da('0x9')]},'to':{'type':Sequelize[_0xb9da('0x3')]('long')},'cc':{'type':Sequelize[_0xb9da('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xb9da('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xb9da('0xa')]},'attach':{'type':Sequelize[_0xb9da('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb9da('0xa')]},'originTo':{'type':Sequelize[_0xb9da('0x3')](_0xb9da('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xb9da('0x4'))},'originChannel':{'type':Sequelize[_0xb9da('0x7')](_0xb9da('0xc'),_0xb9da('0xd')),'defaultValue':_0xb9da('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xd049=['ENUM','out','STRING','long','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','lodash','exports','TEXT','medium'];(function(_0x237adf,_0xb52753){var _0x4411b2=function(_0x3571f0){while(--_0x3571f0){_0x237adf['push'](_0x237adf['shift']());}};_0x4411b2(++_0xb52753);}(_0xd049,0x87));var _0x9d04=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd049[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x9d04('0x0'));var _=require(_0x9d04('0x1'));module[_0x9d04('0x2')]={'body':{'type':Sequelize[_0x9d04('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9d04('0x3')](_0x9d04('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9d04('0x5')]('in',_0x9d04('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9d04('0x7')](0x1fe)},'from':{'type':Sequelize[_0x9d04('0x7')]},'to':{'type':Sequelize[_0x9d04('0x3')]('long')},'cc':{'type':Sequelize[_0x9d04('0x3')](_0x9d04('0x8'))},'bcc':{'type':Sequelize[_0x9d04('0x3')](_0x9d04('0x8'))},'subject':{'type':Sequelize[_0x9d04('0x3')]},'sentAt':{'type':Sequelize[_0x9d04('0x9')]},'attach':{'type':Sequelize[_0x9d04('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9d04('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x9d04('0x3')](_0x9d04('0x8'))},'originCc':{'type':Sequelize['TEXT'](_0x9d04('0x8'))},'originChannel':{'type':Sequelize[_0x9d04('0x5')](_0x9d04('0xc'),_0x9d04('0xd')),'defaultValue':_0x9d04('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 b976acd..f16bbff 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 _0xb862=['QueryTypes','SELECT','event','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','Attachment','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','VIRTUAL','merge','options','MailMessage','include','findAll','rows','show','params','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','user','agent','MailInteraction','MailInteractionId','UserId','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','contact','User','fullname','email','internal','interface','SIP/%s','channel','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage'];(function(_0x4f0212,_0x369712){var _0x23a3e5=function(_0x2acbfa){while(--_0x2acbfa){_0x4f0212['push'](_0x4f0212['shift']());}};_0x23a3e5(++_0x369712);}(_0xb862,0xbe));var _0x2b86=function(_0x10b55b,_0x1d29a7){_0x10b55b=_0x10b55b-0x0;var _0x1e478d=_0xb862[_0x10b55b];return _0x1e478d;};'use strict';var emlformat=require(_0x2b86('0x0'));var moment=require(_0x2b86('0x1'));var BPromise=require(_0x2b86('0x2'));var util=require('util');var path=require(_0x2b86('0x3'));var fs=require('fs');var _=require(_0x2b86('0x4'));var Redis=require('ioredis');var htmlToText=require(_0x2b86('0x5'));var qs=require(_0x2b86('0x6'));var logger=require('../../config/logger')(_0x2b86('0x7'));var interaction_log=require(_0x2b86('0x8'))('mail-interactions');var config=require(_0x2b86('0x9'));var db=require(_0x2b86('0xa'))['db'];config[_0x2b86('0xb')]=_[_0x2b86('0xc')](config[_0x2b86('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b86('0xd'))(new Redis(config[_0x2b86('0xb')]));var htmlEntities=require('html-entities');require(_0x2b86('0xe'))[_0x2b86('0xf')](socket);var jayson=require(_0x2b86('0x10'));var client=jayson[_0x2b86('0x11')][_0x2b86('0x12')]({'port':0x232c});var client9003=jayson[_0x2b86('0x11')][_0x2b86('0x12')]({'port':0x232b});var client9002=jayson[_0x2b86('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5765,_0x413d73,_0x3b9621,_0x3bc594){return new BPromise(function(_0x4365d1,_0x592838){var _0x480c02=_0x3bc594||client;return _0x480c02[_0x2b86('0x13')](_0x4a5765,_0x3b9621)[_0x2b86('0x14')](function(_0x303f65){logger[_0x2b86('0x15')](_0x2b86('0x16'),_0x413d73,'request\x20sent');logger[_0x2b86('0x17')](_0x2b86('0x18'),_0x413d73,_0x2b86('0x19'),JSON[_0x2b86('0x1a')](_0x303f65));if(_0x303f65[_0x2b86('0x1b')]){if(_0x303f65[_0x2b86('0x1b')][_0x2b86('0x1c')]===0x1f4){logger[_0x2b86('0x1b')](_0x2b86('0x16'),_0x413d73,_0x303f65[_0x2b86('0x1b')][_0x2b86('0x1d')]);return _0x592838(_0x303f65[_0x2b86('0x1b')]['message']);}logger[_0x2b86('0x1b')](_0x2b86('0x16'),_0x413d73,_0x303f65[_0x2b86('0x1b')][_0x2b86('0x1d')]);return _0x4365d1(_0x303f65['error'][_0x2b86('0x1d')]);}else{logger[_0x2b86('0x15')](_0x2b86('0x16'),_0x413d73,_0x2b86('0x19'));_0x4365d1(_0x303f65[_0x2b86('0x1e')][_0x2b86('0x1d')]);}})[_0x2b86('0x1f')](function(_0x875d22){logger[_0x2b86('0x1b')](_0x2b86('0x16'),_0x413d73,_0x875d22);_0x592838(_0x875d22);});});}function respondWithResult(_0x2c3351,_0xa5015){_0xa5015=_0xa5015||0xc8;return function(_0x2af423){if(_0x2af423){return _0x2c3351[_0x2b86('0x20')](_0xa5015)[_0x2b86('0x21')](_0x2af423);}};}function respondWithFilteredResult(_0xb3edc4,_0x51e145){return function(_0x1989ab){if(_0x1989ab){var _0x1aef73=typeof _0x51e145[_0x2b86('0x22')]===_0x2b86('0x23')&&typeof _0x51e145['limit']===_0x2b86('0x23');var _0xd59c5c=_0x1989ab[_0x2b86('0x24')];var _0x10245f=_0x1aef73?0x0:_0x51e145['offset'];var _0x59a9b6=_0x1aef73?_0x1989ab[_0x2b86('0x24')]:_0x51e145[_0x2b86('0x22')]+_0x51e145[_0x2b86('0x25')];var _0x10760e;if(_0x59a9b6>=_0xd59c5c){_0x59a9b6=_0xd59c5c;_0x10760e=0xc8;}else{_0x10760e=0xce;}_0xb3edc4[_0x2b86('0x20')](_0x10760e);return _0xb3edc4[_0x2b86('0x26')](_0x2b86('0x27'),_0x10245f+'-'+_0x59a9b6+'/'+_0xd59c5c)['json'](_0x1989ab);}return null;};}function saveUpdates(_0x5cf664){return function(_0x285a95){if(_0x285a95){return _0x285a95[_0x2b86('0x28')](_0x5cf664)[_0x2b86('0x14')](function(_0x1bc045){return _0x1bc045;});}return null;};}function removeEntity(_0x4a450d){return function(_0x191a35){if(_0x191a35){return _0x191a35[_0x2b86('0x29')]()['then'](function(){_0x4a450d['status'](0xcc)[_0x2b86('0x2a')]();});}};}function handleEntityNotFound(_0x47e340){return function(_0xe34402){if(!_0xe34402){_0x47e340['sendStatus'](0x194);}return _0xe34402;};}function handleError(_0x5511cf,_0x103269){_0x103269=_0x103269||0x1f4;return function(_0x4617fe){logger[_0x2b86('0x1b')](_0x4617fe[_0x2b86('0x2b')]);if(_0x4617fe[_0x2b86('0x2c')]){delete _0x4617fe[_0x2b86('0x2c')];}_0x5511cf['status'](_0x103269)[_0x2b86('0x2d')](_0x4617fe);};}exports[_0x2b86('0x2e')]=function(_0x23dc99,_0x3c38e4){var _0x2cf17d={},_0x5bb3f3={},_0x5115d9={'count':0x0,'rows':[]};var _0x42a028=_[_0x2b86('0x2f')](db['MailMessage'][_0x2b86('0x30')],function(_0x4057a3){return{'name':_0x4057a3[_0x2b86('0x31')],'type':_0x4057a3['type']['key']};});_0x5bb3f3[_0x2b86('0x32')]=_[_0x2b86('0x2f')](_0x42a028,_0x2b86('0x2c'));_0x5bb3f3[_0x2b86('0x33')]=_[_0x2b86('0x34')](_0x23dc99[_0x2b86('0x33')]);_0x5bb3f3['filters']=_[_0x2b86('0x35')](_0x5bb3f3[_0x2b86('0x32')],_0x5bb3f3['query']);_0x2cf17d[_0x2b86('0x36')]=_[_0x2b86('0x35')](_0x5bb3f3['model'],qs['fields'](_0x23dc99[_0x2b86('0x33')][_0x2b86('0x37')]));_0x2cf17d[_0x2b86('0x36')]=_0x2cf17d[_0x2b86('0x36')][_0x2b86('0x38')]?_0x2cf17d[_0x2b86('0x36')]:_0x5bb3f3[_0x2b86('0x32')];if(!_0x23dc99[_0x2b86('0x33')][_0x2b86('0x39')](_0x2b86('0x3a'))){_0x2cf17d[_0x2b86('0x25')]=qs[_0x2b86('0x25')](_0x23dc99[_0x2b86('0x33')]['limit']);_0x2cf17d[_0x2b86('0x22')]=qs[_0x2b86('0x22')](_0x23dc99[_0x2b86('0x33')]['offset']);}_0x2cf17d[_0x2b86('0x3b')]=qs[_0x2b86('0x3c')](_0x23dc99['query'][_0x2b86('0x3c')]);_0x2cf17d['where']=qs[_0x2b86('0x3d')](_[_0x2b86('0x3e')](_0x23dc99[_0x2b86('0x33')],_0x5bb3f3[_0x2b86('0x3d')]),_0x42a028);if(_0x23dc99[_0x2b86('0x33')]['filter']){_0x2cf17d[_0x2b86('0x3f')]=_['merge'](_0x2cf17d[_0x2b86('0x3f')],{'$or':_[_0x2b86('0x2f')](_0x42a028,function(_0x58f840){if(_0x58f840[_0x2b86('0x40')]!==_0x2b86('0x41')){var _0x54860d={};_0x54860d[_0x58f840['name']]={'$like':'%'+_0x23dc99['query']['filter']+'%'};return _0x54860d;}})});}_0x2cf17d=_[_0x2b86('0x42')]({},_0x2cf17d,_0x23dc99[_0x2b86('0x43')]);var _0x395b51={'where':_0x2cf17d[_0x2b86('0x3f')]};return db[_0x2b86('0x44')][_0x2b86('0x24')](_0x395b51)['then'](function(_0x4a6129){_0x5115d9[_0x2b86('0x24')]=_0x4a6129;if(_0x23dc99['query']['includeAll']){_0x2cf17d[_0x2b86('0x45')]=[{'all':!![]}];}return db[_0x2b86('0x44')][_0x2b86('0x46')](_0x2cf17d);})['then'](function(_0x81c273){_0x5115d9[_0x2b86('0x47')]=_0x81c273;return _0x5115d9;})[_0x2b86('0x14')](respondWithFilteredResult(_0x3c38e4,_0x2cf17d))['catch'](handleError(_0x3c38e4,null));};exports[_0x2b86('0x48')]=function(_0x80864c,_0x2cd33f){var _0x44b4f4={'raw':!![],'where':{'id':_0x80864c[_0x2b86('0x49')]['id']}},_0x3cd0de={};_0x3cd0de['model']=_[_0x2b86('0x34')](db['MailMessage'][_0x2b86('0x30')]);_0x3cd0de[_0x2b86('0x33')]=_[_0x2b86('0x34')](_0x80864c[_0x2b86('0x33')]);_0x3cd0de['filters']=_[_0x2b86('0x35')](_0x3cd0de[_0x2b86('0x32')],_0x3cd0de['query']);_0x44b4f4[_0x2b86('0x36')]=_['intersection'](_0x3cd0de['model'],qs[_0x2b86('0x37')](_0x80864c[_0x2b86('0x33')][_0x2b86('0x37')]));_0x44b4f4[_0x2b86('0x36')]=_0x44b4f4[_0x2b86('0x36')][_0x2b86('0x38')]?_0x44b4f4['attributes']:_0x3cd0de[_0x2b86('0x32')];if(_0x80864c[_0x2b86('0x33')][_0x2b86('0x4a')]){_0x44b4f4['include']=[{'all':!![]}];}_0x44b4f4=_[_0x2b86('0x42')]({},_0x44b4f4,_0x80864c[_0x2b86('0x43')]);return db[_0x2b86('0x44')][_0x2b86('0x4b')](_0x44b4f4)['then'](handleEntityNotFound(_0x2cd33f,null))[_0x2b86('0x14')](respondWithResult(_0x2cd33f,null))[_0x2b86('0x1f')](handleError(_0x2cd33f,null));};exports['update']=function(_0x22a1ec,_0x1a3af3){if(_0x22a1ec[_0x2b86('0x4c')]['id']){delete _0x22a1ec[_0x2b86('0x4c')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x22a1ec[_0x2b86('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a3af3,null))[_0x2b86('0x14')](saveUpdates(_0x22a1ec['body'],null))[_0x2b86('0x14')](respondWithResult(_0x1a3af3,null))[_0x2b86('0x1f')](handleError(_0x1a3af3,null));};exports[_0x2b86('0x29')]=function(_0x50cba0,_0x3580b7){return db[_0x2b86('0x44')]['find']({'where':{'id':_0x50cba0[_0x2b86('0x49')]['id']}})[_0x2b86('0x14')](handleEntityNotFound(_0x3580b7,null))[_0x2b86('0x14')](removeEntity(_0x3580b7,null))[_0x2b86('0x1f')](handleError(_0x3580b7,null));};exports[_0x2b86('0x4d')]=function(_0x5233c7,_0xf39cfe){return db[_0x2b86('0x44')][_0x2b86('0x4d')]()[_0x2b86('0x14')](respondWithResult(_0xf39cfe,null))[_0x2b86('0x1f')](handleError(_0xf39cfe,null));};exports[_0x2b86('0x4e')]=function(_0x2f4d84,_0x2f5c45){return db[_0x2b86('0x44')][_0x2b86('0x4e')](_0x2f4d84[_0x2b86('0x4c')])[_0x2b86('0x14')](function(_0x35dd3c){if(_0x35dd3c){if(_0x35dd3c[_0x2b86('0x4f')]===_0x2b86('0x50')&&!_0x35dd3c[_0x2b86('0x51')]){var _0x54af02,_0x5a2b9f,_0x3d17c7;if(_0x2f4d84[_0x2b86('0x4c')]['to']){_0x5a2b9f=_0x2f4d84['body']['to'][_0x2b86('0x52')](',')[0x0];}return db[_0x2b86('0x53')][_0x2b86('0x54')]({'where':{'id':_0x35dd3c[_0x2b86('0x55')]},'include':[{'model':db['CmList'],'as':_0x2b86('0x56'),'include':[{'model':db[_0x2b86('0x57')],'as':'Contacts','where':{'email':_0x5a2b9f},'limit':0x1,'order':[[_0x2b86('0x58'),_0x2b86('0x59')]]}]},{'model':db[_0x2b86('0x5a')],'as':_0x2b86('0x5b'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2b86('0x5c'),'raw':!![]}]}]})[_0x2b86('0x14')](function(_0x18a691){_0x54af02=_0x18a691;if(!_0x54af02||!_0x54af02[_0x2b86('0x5b')])return;var _0x46fcbd=_0x54af02[_0x2b86('0x5d')]();if(_0x2f4d84[_0x2b86('0x4c')][_0x2b86('0x5e')]&&_0x2f4d84['body']['attachments']['length']){for(var _0x56c63b=0x0;_0x56c63b<_0x2f4d84[_0x2b86('0x4c')][_0x2b86('0x5e')][_0x2b86('0x38')];_0x56c63b+=0x1){_0x2f4d84[_0x2b86('0x4c')][_0x2b86('0x5e')][_0x56c63b]={'filename':_0x2f4d84[_0x2b86('0x4c')]['attachments'][_0x56c63b][_0x2b86('0x2c')],'path':path[_0x2b86('0x5f')](config[_0x2b86('0x60')],_0x2b86('0x61'),_0x2f4d84[_0x2b86('0x4c')][_0x2b86('0x5e')][_0x56c63b][_0x2b86('0x62')])};}}_0x3d17c7={'account':_0x46fcbd,'message':_0x2f4d84[_0x2b86('0x4c')]};return;})[_0x2b86('0x14')](function(){if(_0x54af02[_0x2b86('0x56')]){if(_0x54af02[_0x2b86('0x56')][_0x2b86('0x63')][_0x2b86('0x38')]){return _0x54af02[_0x2b86('0x56')][_0x2b86('0x63')][0x0];}else{return db[_0x2b86('0x57')][_0x2b86('0x4e')](_[_0x2b86('0xc')](_0x2f4d84[_0x2b86('0x4c')],{'firstName':_0x2f4d84[_0x2b86('0x4c')]['to'],'email':_0x2f4d84[_0x2b86('0x4c')]['to'],'phone':_0x2f4d84[_0x2b86('0x4c')]['to'],'ListId':_0x54af02[_0x2b86('0x64')]}));}}else{throw new Error(_0x2b86('0x65'));}})[_0x2b86('0x14')](function(){if(_0x3d17c7){return respondWithRpcPromise(_0x2b86('0x66'),_0x2b86('0x67'),_0x3d17c7,client9003)[_0x2b86('0x14')](function(_0x110c64){return _0x35dd3c[_0x2b86('0x28')]({'read':!![],'messageId':_0x110c64[_0x2b86('0x68')],'sentAt':moment()['format'](_0x2b86('0x69'))});})[_0x2b86('0x1f')](function(_0x5c376c){logger[_0x2b86('0x1b')]('%s',JSON['stringify'](_0x5c376c));return _0x35dd3c;});}return _0x35dd3c;});}return _0x35dd3c;}})[_0x2b86('0x14')](respondWithResult(_0x2f5c45,0xc9))[_0x2b86('0x1f')](handleError(_0x2f5c45,null));};exports[_0x2b86('0x6a')]=function(_0x436000,_0x1faa50){var _0x5a3bb3={'agent':{},'channel':_0x2b86('0x6b')};if(_0x436000['body']['id']){delete _0x436000[_0x2b86('0x4c')]['id'];}_0x436000['body'][_0x2b86('0x6c')]=!![];_0x436000['body'][_0x2b86('0x6d')]=moment()[_0x2b86('0x6e')](_0x2b86('0x69'));_0x436000[_0x2b86('0x4c')]['UserId']=_0x436000[_0x2b86('0x4c')]['UserId']||_0x436000[_0x2b86('0x6f')]['id'];_0x5a3bb3[_0x2b86('0x70')]['id']=_0x436000[_0x2b86('0x4c')]['UserId'];return db['MailMessage'][_0x2b86('0x4b')]({'where':{'id':_0x436000[_0x2b86('0x49')]['id'],'UserId':null}})[_0x2b86('0x14')](handleEntityNotFound(_0x1faa50,null))[_0x2b86('0x14')](saveUpdates(_0x436000[_0x2b86('0x4c')],null))[_0x2b86('0x14')](function(_0x1d2ad7){if(_0x1d2ad7){_0x5a3bb3[_0x2b86('0x1d')]=_0x1d2ad7['get']({'plain':!![]});return db[_0x2b86('0x71')][_0x2b86('0x4b')]({'where':{'id':_0x1d2ad7[_0x2b86('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x1faa50,null))['then'](function(_0x194475){if(_0x194475){return _0x194475[_0x2b86('0x28')]({'UserId':_0x436000[_0x2b86('0x4c')][_0x2b86('0x73')],'read1stAt':_[_0x2b86('0x74')](_0x194475[_0x2b86('0x75')])?moment()[_0x2b86('0x6e')](_0x2b86('0x69')):undefined});}return null;})[_0x2b86('0x14')](function(_0x4f0f55){if(_0x4f0f55){_0x5a3bb3['interaction']=_0x4f0f55[_0x2b86('0x76')]({'plain':!![]});interaction_log[_0x2b86('0x15')](_0x2b86('0x77'),_0x436000[_0x2b86('0x6f')]['id'],_0x436000[_0x2b86('0x6f')][_0x2b86('0x2c')],_0x436000[_0x2b86('0x6f')][_0x2b86('0x78')],_0x5a3bb3['interaction']['id'],_0x436000[_0x2b86('0x4c')]?JSON[_0x2b86('0x1a')](_0x436000[_0x2b86('0x4c')]):_0x2b86('0x79'));return respondWithRpcPromise(_0x2b86('0x7a'),_0x2b86('0x7b'),_0x5a3bb3);}return null;})[_0x2b86('0x14')](function(_0x551f6c){var _0x3519bb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x551f6c[_0x2b86('0x1d')][_0x2b86('0x7c')];return db[_0x2b86('0x7d')][_0x2b86('0x33')](_0x3519bb,{'type':db[_0x2b86('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x389bc6){return _0x389bc6;});})[_0x2b86('0x14')](function(_0x5a6111){if(_0x5a6111){_0x5a3bb3[_0x2b86('0x1d')][_0x2b86('0x7f')]=_0x5a6111[0x0];if(!_0x436000['body'][_0x2b86('0x73')])return;return db[_0x2b86('0x80')][_0x2b86('0x4b')]({'where':{'id':_0x436000[_0x2b86('0x4c')][_0x2b86('0x73')],'role':_0x2b86('0x70')},'attributes':['id',_0x2b86('0x2c'),_0x2b86('0x81'),_0x2b86('0x82'),_0x2b86('0x83')],'raw':!![]});}return null;})[_0x2b86('0x14')](function(_0x354791){if(!_0x354791)return null;_0x5a3bb3['message']['agent']=_0x354791;return _0x5a3bb3;})[_0x2b86('0x14')](function(_0x1db7f2){if(_0x1db7f2){if(_0x436000[_0x2b86('0x4c')]['manual']){_0x5a3bb3[_0x2b86('0x1d')][_0x2b86('0x84')]=util['format'](_0x2b86('0x85'),_0x436000['user'][_0x2b86('0x2c')]);_0x5a3bb3[_0x2b86('0x1d')][_0x2b86('0x86')]=_0x5a3bb3[_0x2b86('0x86')];_0x5a3bb3[_0x2b86('0x1d')]['motionChannel']=_0x5a3bb3[_0x2b86('0x86')];_0x5a3bb3['message']['event']='accept';_0x5a3bb3[_0x2b86('0x1d')][_0x2b86('0x4c')]=htmlToText[_0x2b86('0x87')](_0x5a3bb3[_0x2b86('0x1d')][_0x2b86('0x4c')]);return respondWithRpcPromise(_0x2b86('0x88'),_0x2b86('0x88'),{'event':'acceptmessage','message':_0x5a3bb3['message']},client9002)[_0x2b86('0x14')](function(){return _0x5a3bb3;});}return _0x5a3bb3;}return null;})['then'](respondWithResult(_0x1faa50,null))['catch'](handleError(_0x1faa50,null));};exports[_0x2b86('0x89')]=function(_0x70a50d,_0x4fde7c){var _0xe37911={'agent':{},'channel':_0x2b86('0x6b')};if(_0x70a50d['body']['id']){delete _0x70a50d[_0x2b86('0x4c')]['id'];}_0x70a50d[_0x2b86('0x4c')][_0x2b86('0x73')]=_0x70a50d[_0x2b86('0x4c')][_0x2b86('0x73')]||_0x70a50d[_0x2b86('0x6f')]['id'];_0xe37911[_0x2b86('0x70')]['id']=_0x70a50d[_0x2b86('0x4c')][_0x2b86('0x73')];return db['MailMessage'][_0x2b86('0x4b')]({'where':{'id':_0x70a50d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4fde7c,null))[_0x2b86('0x14')](function(_0x56f93e){if(_0x56f93e){_0xe37911['message']=_0x56f93e[_0x2b86('0x76')]({'plain':!![]});return db[_0x2b86('0x71')][_0x2b86('0x4b')]({'where':{'id':_0x56f93e[_0x2b86('0x72')]}});}return null;})[_0x2b86('0x14')](handleEntityNotFound(_0x4fde7c,null))['then'](function(_0x1a1d88){if(_0x1a1d88){_0xe37911['interaction']=_0x1a1d88[_0x2b86('0x76')]({'plain':!![]});interaction_log[_0x2b86('0x15')](_0x2b86('0x8a'),_0x70a50d[_0x2b86('0x6f')]['id'],_0x70a50d[_0x2b86('0x6f')]['name'],_0x70a50d[_0x2b86('0x6f')][_0x2b86('0x78')],_0xe37911[_0x2b86('0x8b')]['id'],_0x70a50d['body']?JSON[_0x2b86('0x1a')](_0x70a50d[_0x2b86('0x4c')]):_0x2b86('0x79'));return respondWithRpcPromise(_0x2b86('0x8c'),_0x2b86('0x8d'),_0xe37911);}return null;})[_0x2b86('0x14')](function(_0x4783ea){var _0x5538c2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4783ea[_0x2b86('0x1d')][_0x2b86('0x7c')];return db[_0x2b86('0x7d')]['query'](_0x5538c2,{'type':db[_0x2b86('0x7e')][_0x2b86('0x8e')][_0x2b86('0x8f')],'raw':!![]})[_0x2b86('0x14')](function(_0xe118e2){return _0xe118e2;});})['then'](function(_0x1687bb){if(_0x1687bb){_0xe37911[_0x2b86('0x1d')][_0x2b86('0x7f')]=_0x1687bb[0x0];if(!_0x70a50d[_0x2b86('0x4c')]['UserId'])return;return db[_0x2b86('0x80')][_0x2b86('0x4b')]({'where':{'id':_0x70a50d['body'][_0x2b86('0x73')],'role':_0x2b86('0x70')},'attributes':['id',_0x2b86('0x2c'),_0x2b86('0x81'),_0x2b86('0x82'),_0x2b86('0x83')],'raw':!![]});}return null;})[_0x2b86('0x14')](function(_0x4c3c06){if(!_0x4c3c06)return null;_0xe37911[_0x2b86('0x1d')]['agent']=_0x4c3c06;return _0xe37911;})['then'](function(_0x1dc0cc){if(_0x1dc0cc){_0x1dc0cc[_0x2b86('0x1d')][_0x2b86('0x84')]=util[_0x2b86('0x6e')](_0x2b86('0x85'),_0x70a50d[_0x2b86('0x6f')]['name']);_0x1dc0cc[_0x2b86('0x1d')]['channel']=_0xe37911[_0x2b86('0x86')];_0x1dc0cc[_0x2b86('0x1d')]['motionChannel']=_0xe37911[_0x2b86('0x86')];_0x1dc0cc[_0x2b86('0x1d')][_0x2b86('0x90')]=_0x2b86('0x89');_0x1dc0cc[_0x2b86('0x1d')][_0x2b86('0x4c')]=htmlToText['fromString'](_0xe37911[_0x2b86('0x1d')][_0x2b86('0x4c')]);respondWithRpcPromise(_0x2b86('0x88'),_0x2b86('0x88'),{'event':_0x2b86('0x91'),'message':_0x1dc0cc['message']},client9002);return _0xe37911;}return null;})[_0x2b86('0x14')](respondWithResult(_0x4fde7c,null))[_0x2b86('0x1f')](handleError(_0x4fde7c,null));};exports[_0x2b86('0x92')]=function(_0x4bd109,_0x4fcd0d){var _0x25547a=moment()[_0x2b86('0x93')]()[_0x2b86('0x94')]();var _0x5b55a5=path[_0x2b86('0x5f')](config[_0x2b86('0x60')],_0x2b86('0x95'),_0x2b86('0x96'),_0x2b86('0x97'));var _0x4b231c=path[_0x2b86('0x5f')](config[_0x2b86('0x60')],_0x2b86('0x95'),'files',_0x2b86('0x5e'));var _0x412bdd=util[_0x2b86('0x6e')]('message-%s.eml',_0x25547a);return db[_0x2b86('0x44')][_0x2b86('0x4b')]({'where':{'id':_0x4bd109[_0x2b86('0x49')]['id']},'attributes':['id',_0x2b86('0x4c'),_0x2b86('0x98'),'to','cc',_0x2b86('0x99'),_0x2b86('0x9a'),'createdAt'],'include':_0x4bd109[_0x2b86('0x33')][_0x2b86('0x5e')]?[{'model':db[_0x2b86('0x9b')],'as':'Attachments'}]:undefined})[_0x2b86('0x14')](handleEntityNotFound(_0x4fcd0d,null))[_0x2b86('0x14')](function(_0x541c43){if(_0x541c43){var _0x500add=_0x541c43;var _0x47b4a4={'from':_0x500add[_0x2b86('0x98')],'to':_0x500add['to'],'subject':_0x500add[_0x2b86('0x9a')],'html':htmlEntities[_0x2b86('0x9c')](_0x500add['body']),'headers':{'Date':moment(_0x500add[_0x2b86('0x9d')])[_0x2b86('0x6e')](_0x2b86('0x9e'))},'attachments':[]};if(_0x541c43['cc']){_0x47b4a4[_0x2b86('0x9f')]['Cc']=_0x541c43['cc'];}if(_0x541c43[_0x2b86('0x99')]){_0x47b4a4[_0x2b86('0x9f')][_0x2b86('0xa0')]=_0x541c43[_0x2b86('0x99')];}return new BPromise(function(_0x5dba7b,_0x5aaa58){if(_0x541c43[_0x2b86('0xa1')]){for(var _0x4c1cb4=0x0;_0x4c1cb4<_0x541c43[_0x2b86('0xa1')][_0x2b86('0x38')];_0x4c1cb4++){var _0x50ce87=_0x541c43[_0x2b86('0xa1')][_0x4c1cb4];var _0x365f2d=path[_0x2b86('0x5f')](_0x4b231c,_0x50ce87[_0x2b86('0x62')]);if(fs[_0x2b86('0xa2')](_0x365f2d)){_0x47b4a4[_0x2b86('0x5e')]['push']({'name':_0x50ce87[_0x2b86('0x2c')],'contentType':_0x50ce87[_0x2b86('0x40')],'data':fs[_0x2b86('0xa3')](_0x365f2d)});}}}emlformat['build'](_0x47b4a4,function(_0x5bcc26,_0x5b9432){if(_0x5bcc26)return _0x5aaa58(_0x5bcc26);fs[_0x2b86('0xa4')](path[_0x2b86('0x5f')](_0x5b55a5,_0x412bdd),_0x5b9432);return _0x5dba7b(_0x5b9432);});});}})[_0x2b86('0x14')](function(_0x2cf883){if(_0x2cf883){return _0x4fcd0d[_0x2b86('0x92')](path['join'](_0x5b55a5,_0x412bdd),_0x412bdd,function(_0x4d3eec){if(!_0x4d3eec)fs[_0x2b86('0xa5')](path[_0x2b86('0x5f')](_0x5b55a5,_0x412bdd));});}})[_0x2b86('0x1f')](handleError(_0x4fcd0d,null));}; \ No newline at end of file +var _0x1e47=['subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','util','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','./mailMessage.socket','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','rows','show','params','keys','rawAttributes','length','options','find','body','describe','create','out','secret','split','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','basename','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc'];(function(_0x423035,_0x51ddeb){var _0x3645fc=function(_0x2205f8){while(--_0x2205f8){_0x423035['push'](_0x423035['shift']());}};_0x3645fc(++_0x51ddeb);}(_0x1e47,0xac));var _0x71e4=function(_0x557d18,_0x548311){_0x557d18=_0x557d18-0x0;var _0x4783eb=_0x1e47[_0x557d18];return _0x4783eb;};'use strict';var emlformat=require(_0x71e4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x71e4('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x71e4('0x2'));var htmlToText=require(_0x71e4('0x3'));var qs=require(_0x71e4('0x4'));var logger=require(_0x71e4('0x5'))(_0x71e4('0x6'));var interaction_log=require('../../config/logger')(_0x71e4('0x7'));var config=require(_0x71e4('0x8'));var db=require(_0x71e4('0x9'))['db'];config[_0x71e4('0xa')]=_['defaults'](config[_0x71e4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71e4('0xa')]));var htmlEntities=require('html-entities');require(_0x71e4('0xb'))['register'](socket);var jayson=require(_0x71e4('0xc'));var client=jayson['client'][_0x71e4('0xd')]({'port':0x232c});var client9003=jayson[_0x71e4('0xe')][_0x71e4('0xd')]({'port':0x232b});var client9002=jayson[_0x71e4('0xe')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4191f1,_0x14152c,_0x27c23d,_0xf0b16a){return new BPromise(function(_0x9a9f40,_0x1f5d29){var _0x4445aa=_0xf0b16a||client;return _0x4445aa['request'](_0x4191f1,_0x27c23d)[_0x71e4('0xf')](function(_0x4582e7){logger[_0x71e4('0x10')](_0x71e4('0x11'),_0x14152c,_0x71e4('0x12'));logger[_0x71e4('0x13')](_0x71e4('0x14'),_0x14152c,_0x71e4('0x12'),JSON[_0x71e4('0x15')](_0x4582e7));if(_0x4582e7[_0x71e4('0x16')]){if(_0x4582e7[_0x71e4('0x16')][_0x71e4('0x17')]===0x1f4){logger[_0x71e4('0x16')](_0x71e4('0x11'),_0x14152c,_0x4582e7[_0x71e4('0x16')]['message']);return _0x1f5d29(_0x4582e7[_0x71e4('0x16')]['message']);}logger[_0x71e4('0x16')]('MailMessage,\x20%s,\x20%s',_0x14152c,_0x4582e7[_0x71e4('0x16')][_0x71e4('0x18')]);return _0x9a9f40(_0x4582e7[_0x71e4('0x16')][_0x71e4('0x18')]);}else{logger[_0x71e4('0x10')](_0x71e4('0x11'),_0x14152c,_0x71e4('0x12'));_0x9a9f40(_0x4582e7[_0x71e4('0x19')][_0x71e4('0x18')]);}})[_0x71e4('0x1a')](function(_0x4253ec){logger[_0x71e4('0x16')](_0x71e4('0x11'),_0x14152c,_0x4253ec);_0x1f5d29(_0x4253ec);});});}function respondWithResult(_0x1a3843,_0x11fb9c){_0x11fb9c=_0x11fb9c||0xc8;return function(_0x5536c8){if(_0x5536c8){return _0x1a3843[_0x71e4('0x1b')](_0x11fb9c)[_0x71e4('0x1c')](_0x5536c8);}};}function respondWithFilteredResult(_0x31645f,_0x50a537){return function(_0x18f576){if(_0x18f576){var _0x582fb3=typeof _0x50a537[_0x71e4('0x1d')]==='undefined'&&typeof _0x50a537[_0x71e4('0x1e')]===_0x71e4('0x1f');var _0x57c239=_0x18f576[_0x71e4('0x20')];var _0x4dc82d=_0x582fb3?0x0:_0x50a537[_0x71e4('0x1d')];var _0x8bc566=_0x582fb3?_0x18f576[_0x71e4('0x20')]:_0x50a537[_0x71e4('0x1d')]+_0x50a537['limit'];var _0x4fd199;if(_0x8bc566>=_0x57c239){_0x8bc566=_0x57c239;_0x4fd199=0xc8;}else{_0x4fd199=0xce;}_0x31645f[_0x71e4('0x1b')](_0x4fd199);return _0x31645f[_0x71e4('0x21')](_0x71e4('0x22'),_0x4dc82d+'-'+_0x8bc566+'/'+_0x57c239)[_0x71e4('0x1c')](_0x18f576);}return null;};}function saveUpdates(_0x309d59){return function(_0x30ea4c){if(_0x30ea4c){return _0x30ea4c[_0x71e4('0x23')](_0x309d59)[_0x71e4('0xf')](function(_0x54143c){return _0x54143c;});}return null;};}function removeEntity(_0x4d731c){return function(_0xc47971){if(_0xc47971){return _0xc47971[_0x71e4('0x24')]()[_0x71e4('0xf')](function(){_0x4d731c[_0x71e4('0x1b')](0xcc)[_0x71e4('0x25')]();});}};}function handleEntityNotFound(_0x270578){return function(_0x29e983){if(!_0x29e983){_0x270578[_0x71e4('0x26')](0x194);}return _0x29e983;};}function handleError(_0x26f8c9,_0x8c5329){_0x8c5329=_0x8c5329||0x1f4;return function(_0x3ffece){logger[_0x71e4('0x16')](_0x3ffece[_0x71e4('0x27')]);if(_0x3ffece[_0x71e4('0x28')]){delete _0x3ffece[_0x71e4('0x28')];}_0x26f8c9[_0x71e4('0x1b')](_0x8c5329)[_0x71e4('0x29')](_0x3ffece);};}exports[_0x71e4('0x2a')]=function(_0x2ad4ef,_0x32161b){var _0x470b0e={},_0x2c5642={},_0x3f5007={'count':0x0,'rows':[]};var _0x23e31f=_[_0x71e4('0x2b')](db[_0x71e4('0x2c')]['rawAttributes'],function(_0x2d12f6){return{'name':_0x2d12f6[_0x71e4('0x2d')],'type':_0x2d12f6[_0x71e4('0x2e')][_0x71e4('0x2f')]};});_0x2c5642['model']=_[_0x71e4('0x2b')](_0x23e31f,_0x71e4('0x28'));_0x2c5642[_0x71e4('0x30')]=_['keys'](_0x2ad4ef['query']);_0x2c5642[_0x71e4('0x31')]=_[_0x71e4('0x32')](_0x2c5642[_0x71e4('0x33')],_0x2c5642['query']);_0x470b0e[_0x71e4('0x34')]=_[_0x71e4('0x32')](_0x2c5642[_0x71e4('0x33')],qs[_0x71e4('0x35')](_0x2ad4ef[_0x71e4('0x30')]['fields']));_0x470b0e[_0x71e4('0x34')]=_0x470b0e[_0x71e4('0x34')]['length']?_0x470b0e['attributes']:_0x2c5642['model'];if(!_0x2ad4ef[_0x71e4('0x30')][_0x71e4('0x36')](_0x71e4('0x37'))){_0x470b0e[_0x71e4('0x1e')]=qs[_0x71e4('0x1e')](_0x2ad4ef[_0x71e4('0x30')][_0x71e4('0x1e')]);_0x470b0e[_0x71e4('0x1d')]=qs['offset'](_0x2ad4ef['query'][_0x71e4('0x1d')]);}_0x470b0e[_0x71e4('0x38')]=qs[_0x71e4('0x39')](_0x2ad4ef[_0x71e4('0x30')][_0x71e4('0x39')]);_0x470b0e[_0x71e4('0x3a')]=qs[_0x71e4('0x31')](_[_0x71e4('0x3b')](_0x2ad4ef[_0x71e4('0x30')],_0x2c5642['filters']),_0x23e31f);if(_0x2ad4ef['query'][_0x71e4('0x3c')]){_0x470b0e[_0x71e4('0x3a')]=_['merge'](_0x470b0e[_0x71e4('0x3a')],{'$or':_[_0x71e4('0x2b')](_0x23e31f,function(_0x12bfc8){if(_0x12bfc8[_0x71e4('0x2e')]!==_0x71e4('0x3d')){var _0x52ae32={};_0x52ae32[_0x12bfc8['name']]={'$like':'%'+_0x2ad4ef[_0x71e4('0x30')][_0x71e4('0x3c')]+'%'};return _0x52ae32;}})});}_0x470b0e=_[_0x71e4('0x3e')]({},_0x470b0e,_0x2ad4ef['options']);var _0x401155={'where':_0x470b0e[_0x71e4('0x3a')]};return db[_0x71e4('0x2c')][_0x71e4('0x20')](_0x401155)[_0x71e4('0xf')](function(_0x59005b){_0x3f5007[_0x71e4('0x20')]=_0x59005b;if(_0x2ad4ef[_0x71e4('0x30')]['includeAll']){_0x470b0e[_0x71e4('0x3f')]=[{'all':!![]}];}return db[_0x71e4('0x2c')]['findAll'](_0x470b0e);})[_0x71e4('0xf')](function(_0x2b6e1f){_0x3f5007[_0x71e4('0x40')]=_0x2b6e1f;return _0x3f5007;})[_0x71e4('0xf')](respondWithFilteredResult(_0x32161b,_0x470b0e))[_0x71e4('0x1a')](handleError(_0x32161b,null));};exports[_0x71e4('0x41')]=function(_0x1a8c76,_0x11e4e0){var _0x4f4e65={'raw':!![],'where':{'id':_0x1a8c76[_0x71e4('0x42')]['id']}},_0x23d2e5={};_0x23d2e5[_0x71e4('0x33')]=_[_0x71e4('0x43')](db[_0x71e4('0x2c')][_0x71e4('0x44')]);_0x23d2e5[_0x71e4('0x30')]=_[_0x71e4('0x43')](_0x1a8c76[_0x71e4('0x30')]);_0x23d2e5['filters']=_[_0x71e4('0x32')](_0x23d2e5[_0x71e4('0x33')],_0x23d2e5[_0x71e4('0x30')]);_0x4f4e65['attributes']=_['intersection'](_0x23d2e5[_0x71e4('0x33')],qs['fields'](_0x1a8c76[_0x71e4('0x30')]['fields']));_0x4f4e65['attributes']=_0x4f4e65[_0x71e4('0x34')][_0x71e4('0x45')]?_0x4f4e65[_0x71e4('0x34')]:_0x23d2e5[_0x71e4('0x33')];if(_0x1a8c76['query']['includeAll']){_0x4f4e65['include']=[{'all':!![]}];}_0x4f4e65=_[_0x71e4('0x3e')]({},_0x4f4e65,_0x1a8c76[_0x71e4('0x46')]);return db[_0x71e4('0x2c')][_0x71e4('0x47')](_0x4f4e65)[_0x71e4('0xf')](handleEntityNotFound(_0x11e4e0,null))[_0x71e4('0xf')](respondWithResult(_0x11e4e0,null))[_0x71e4('0x1a')](handleError(_0x11e4e0,null));};exports[_0x71e4('0x23')]=function(_0x44fa0c,_0x151d4e){if(_0x44fa0c['body']['id']){delete _0x44fa0c[_0x71e4('0x48')]['id'];}return db[_0x71e4('0x2c')][_0x71e4('0x47')]({'where':{'id':_0x44fa0c[_0x71e4('0x42')]['id']}})[_0x71e4('0xf')](handleEntityNotFound(_0x151d4e,null))['then'](saveUpdates(_0x44fa0c[_0x71e4('0x48')],null))[_0x71e4('0xf')](respondWithResult(_0x151d4e,null))[_0x71e4('0x1a')](handleError(_0x151d4e,null));};exports[_0x71e4('0x24')]=function(_0xdbf51f,_0x2885f2){return db[_0x71e4('0x2c')][_0x71e4('0x47')]({'where':{'id':_0xdbf51f['params']['id']}})[_0x71e4('0xf')](handleEntityNotFound(_0x2885f2,null))[_0x71e4('0xf')](removeEntity(_0x2885f2,null))[_0x71e4('0x1a')](handleError(_0x2885f2,null));};exports['describe']=function(_0x3b015a,_0x357481){return db[_0x71e4('0x2c')][_0x71e4('0x49')]()[_0x71e4('0xf')](respondWithResult(_0x357481,null))['catch'](handleError(_0x357481,null));};exports[_0x71e4('0x4a')]=function(_0x3a062e,_0x8b99ff){return db[_0x71e4('0x2c')]['create'](_0x3a062e[_0x71e4('0x48')])[_0x71e4('0xf')](function(_0xe987d0){if(_0xe987d0){if(_0xe987d0['direction']===_0x71e4('0x4b')&&!_0xe987d0[_0x71e4('0x4c')]){var _0x3d8a4a,_0x579532,_0x4ad3ed;if(_0x3a062e[_0x71e4('0x48')]['to']){_0x579532=_0x3a062e['body']['to'][_0x71e4('0x4d')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0xe987d0[_0x71e4('0x4e')]},'include':[{'model':db[_0x71e4('0x4f')],'as':_0x71e4('0x50'),'include':[{'model':db[_0x71e4('0x51')],'as':_0x71e4('0x52'),'where':{'email':_0x579532},'limit':0x1,'order':[[_0x71e4('0x53'),_0x71e4('0x54')]]}]},{'model':db[_0x71e4('0x55')],'as':_0x71e4('0x56'),'raw':!![],'include':[{'model':db[_0x71e4('0x57')],'as':_0x71e4('0x57'),'raw':!![]}]}]})[_0x71e4('0xf')](function(_0x2c620b){_0x3d8a4a=_0x2c620b;if(!_0x3d8a4a||!_0x3d8a4a[_0x71e4('0x56')])return;var _0x332f6b=_0x3d8a4a[_0x71e4('0x58')]();if(_0x3a062e[_0x71e4('0x48')][_0x71e4('0x59')]&&_0x3a062e[_0x71e4('0x48')][_0x71e4('0x59')]['length']){for(var _0x5b3899=0x0;_0x5b3899<_0x3a062e[_0x71e4('0x48')][_0x71e4('0x59')][_0x71e4('0x45')];_0x5b3899+=0x1){_0x3a062e[_0x71e4('0x48')][_0x71e4('0x59')][_0x5b3899]={'filename':_0x3a062e[_0x71e4('0x48')]['attachments'][_0x5b3899][_0x71e4('0x28')],'path':path['join'](config[_0x71e4('0x5a')],'server/files/attachments',_0x3a062e['body']['attachments'][_0x5b3899][_0x71e4('0x5b')])};}}_0x4ad3ed={'account':_0x332f6b,'message':_0x3a062e[_0x71e4('0x48')]};return;})[_0x71e4('0xf')](function(){if(_0x3d8a4a[_0x71e4('0x50')]){if(_0x3d8a4a[_0x71e4('0x50')]['Contacts']['length']){return _0x3d8a4a['List'][_0x71e4('0x52')][0x0];}else{return db[_0x71e4('0x51')][_0x71e4('0x4a')](_['defaults'](_0x3a062e[_0x71e4('0x48')],{'firstName':_0x3a062e[_0x71e4('0x48')]['to'],'email':_0x3a062e[_0x71e4('0x48')]['to'],'phone':_0x3a062e[_0x71e4('0x48')]['to'],'ListId':_0x3d8a4a['ListId']}));}}else{throw new Error(_0x71e4('0x5c'));}})['then'](function(){if(_0x4ad3ed){return respondWithRpcPromise(_0x71e4('0x5d'),_0x71e4('0x5e'),_0x4ad3ed,client9003)[_0x71e4('0xf')](function(_0x4bacf0){return _0xe987d0[_0x71e4('0x23')]({'read':!![],'messageId':_0x4bacf0['messageId'],'sentAt':moment()[_0x71e4('0x5f')](_0x71e4('0x60'))});})[_0x71e4('0x1a')](function(_0x14d7cb){logger[_0x71e4('0x16')]('%s',JSON['stringify'](_0x14d7cb));return _0xe987d0;});}return _0xe987d0;});}return _0xe987d0;}})[_0x71e4('0xf')](respondWithResult(_0x8b99ff,0xc9))[_0x71e4('0x1a')](handleError(_0x8b99ff,null));};exports['accept']=function(_0x205125,_0x31d829){var _0x15579c={'agent':{},'channel':'mail'};if(_0x205125['body']['id']){delete _0x205125[_0x71e4('0x48')]['id'];}_0x205125[_0x71e4('0x48')]['read']=!![];_0x205125['body'][_0x71e4('0x61')]=moment()[_0x71e4('0x5f')](_0x71e4('0x60'));_0x205125[_0x71e4('0x48')][_0x71e4('0x62')]=_0x205125[_0x71e4('0x48')][_0x71e4('0x62')]||_0x205125[_0x71e4('0x63')]['id'];_0x15579c[_0x71e4('0x64')]['id']=_0x205125['body']['UserId'];return db['MailMessage'][_0x71e4('0x47')]({'where':{'id':_0x205125[_0x71e4('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31d829,null))[_0x71e4('0xf')](saveUpdates(_0x205125[_0x71e4('0x48')],null))[_0x71e4('0xf')](function(_0x5c4ee9){if(_0x5c4ee9){_0x15579c['message']=_0x5c4ee9[_0x71e4('0x65')]({'plain':!![]});return db[_0x71e4('0x66')]['find']({'where':{'id':_0x5c4ee9[_0x71e4('0x67')]}});}return null;})[_0x71e4('0xf')](handleEntityNotFound(_0x31d829,null))[_0x71e4('0xf')](function(_0xa3107e){if(_0xa3107e){return _0xa3107e[_0x71e4('0x23')]({'UserId':_0x205125['body'][_0x71e4('0x62')],'read1stAt':_[_0x71e4('0x68')](_0xa3107e[_0x71e4('0x69')])?moment()[_0x71e4('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x406b73){if(_0x406b73){_0x15579c['interaction']=_0x406b73['get']({'plain':!![]});interaction_log['info'](_0x71e4('0x6a'),_0x205125['user']['id'],_0x205125[_0x71e4('0x63')][_0x71e4('0x28')],_0x205125[_0x71e4('0x63')][_0x71e4('0x6b')],_0x15579c[_0x71e4('0x6c')]['id'],_0x205125[_0x71e4('0x48')]?JSON[_0x71e4('0x15')](_0x205125[_0x71e4('0x48')]):_0x71e4('0x6d'));return respondWithRpcPromise(_0x71e4('0x6e'),_0x71e4('0x6f'),_0x15579c);}return null;})[_0x71e4('0xf')](function(_0x45a4c3){var _0x2fdefe=_0x71e4('0x70')+_0x45a4c3['message'][_0x71e4('0x71')];return db[_0x71e4('0x72')][_0x71e4('0x30')](_0x2fdefe,{'type':db[_0x71e4('0x73')]['QueryTypes'][_0x71e4('0x74')],'raw':!![]})['then'](function(_0x3fb227){return _0x3fb227;});})['then'](function(_0x3e69c7){if(_0x3e69c7){_0x15579c['message'][_0x71e4('0x75')]=_0x3e69c7[0x0];if(!_0x205125[_0x71e4('0x48')][_0x71e4('0x62')])return;return db['User'][_0x71e4('0x47')]({'where':{'id':_0x205125[_0x71e4('0x48')][_0x71e4('0x62')],'role':_0x71e4('0x64')},'attributes':['id',_0x71e4('0x28'),_0x71e4('0x76'),_0x71e4('0x77'),_0x71e4('0x78')],'raw':!![]});}return null;})['then'](function(_0x312b76){if(!_0x312b76)return null;_0x15579c[_0x71e4('0x18')][_0x71e4('0x64')]=_0x312b76;return _0x15579c;})[_0x71e4('0xf')](function(_0x1cb9bd){if(_0x1cb9bd){if(_0x205125[_0x71e4('0x48')]['manual']){_0x15579c[_0x71e4('0x18')][_0x71e4('0x79')]=util[_0x71e4('0x5f')](_0x71e4('0x7a'),_0x205125[_0x71e4('0x63')][_0x71e4('0x28')]);_0x15579c[_0x71e4('0x18')][_0x71e4('0x7b')]=_0x15579c[_0x71e4('0x7b')];_0x15579c['message'][_0x71e4('0x7c')]=_0x15579c[_0x71e4('0x7b')];_0x15579c[_0x71e4('0x18')][_0x71e4('0x7d')]=_0x71e4('0x7e');_0x15579c[_0x71e4('0x18')][_0x71e4('0x48')]=htmlToText[_0x71e4('0x7f')](_0x15579c[_0x71e4('0x18')][_0x71e4('0x48')]);return respondWithRpcPromise(_0x71e4('0x80'),_0x71e4('0x80'),{'event':_0x71e4('0x81'),'message':_0x15579c[_0x71e4('0x18')]},client9002)[_0x71e4('0xf')](function(){return _0x15579c;});}return _0x15579c;}return null;})[_0x71e4('0xf')](respondWithResult(_0x31d829,null))['catch'](handleError(_0x31d829,null));};exports['reject']=function(_0x15f26e,_0x2702b7){var _0x496f08={'agent':{},'channel':'mail'};if(_0x15f26e[_0x71e4('0x48')]['id']){delete _0x15f26e['body']['id'];}_0x15f26e[_0x71e4('0x48')][_0x71e4('0x62')]=_0x15f26e[_0x71e4('0x48')][_0x71e4('0x62')]||_0x15f26e[_0x71e4('0x63')]['id'];_0x496f08[_0x71e4('0x64')]['id']=_0x15f26e[_0x71e4('0x48')][_0x71e4('0x62')];return db[_0x71e4('0x2c')][_0x71e4('0x47')]({'where':{'id':_0x15f26e[_0x71e4('0x42')]['id'],'UserId':null}})[_0x71e4('0xf')](handleEntityNotFound(_0x2702b7,null))['then'](function(_0x14a763){if(_0x14a763){_0x496f08['message']=_0x14a763['get']({'plain':!![]});return db[_0x71e4('0x66')][_0x71e4('0x47')]({'where':{'id':_0x14a763[_0x71e4('0x67')]}});}return null;})[_0x71e4('0xf')](handleEntityNotFound(_0x2702b7,null))['then'](function(_0x3e490f){if(_0x3e490f){_0x496f08[_0x71e4('0x6c')]=_0x3e490f[_0x71e4('0x65')]({'plain':!![]});interaction_log[_0x71e4('0x10')](_0x71e4('0x82'),_0x15f26e[_0x71e4('0x63')]['id'],_0x15f26e['user'][_0x71e4('0x28')],_0x15f26e[_0x71e4('0x63')][_0x71e4('0x6b')],_0x496f08[_0x71e4('0x6c')]['id'],_0x15f26e[_0x71e4('0x48')]?JSON['stringify'](_0x15f26e['body']):_0x71e4('0x6d'));return respondWithRpcPromise(_0x71e4('0x83'),_0x71e4('0x84'),_0x496f08);}return null;})[_0x71e4('0xf')](function(_0x3943a4){var _0xa2bf7d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3943a4[_0x71e4('0x18')][_0x71e4('0x71')];return db[_0x71e4('0x72')][_0x71e4('0x30')](_0xa2bf7d,{'type':db[_0x71e4('0x73')][_0x71e4('0x85')][_0x71e4('0x74')],'raw':!![]})[_0x71e4('0xf')](function(_0x22736c){return _0x22736c;});})[_0x71e4('0xf')](function(_0x540bbe){if(_0x540bbe){_0x496f08[_0x71e4('0x18')][_0x71e4('0x75')]=_0x540bbe[0x0];if(!_0x15f26e[_0x71e4('0x48')][_0x71e4('0x62')])return;return db[_0x71e4('0x86')][_0x71e4('0x47')]({'where':{'id':_0x15f26e['body'][_0x71e4('0x62')],'role':_0x71e4('0x64')},'attributes':['id','name','fullname',_0x71e4('0x77'),_0x71e4('0x78')],'raw':!![]});}return null;})[_0x71e4('0xf')](function(_0x340da6){if(!_0x340da6)return null;_0x496f08['message']['agent']=_0x340da6;return _0x496f08;})[_0x71e4('0xf')](function(_0x449667){if(_0x449667){_0x449667[_0x71e4('0x18')]['interface']=util['format'](_0x71e4('0x7a'),_0x15f26e[_0x71e4('0x63')][_0x71e4('0x28')]);_0x449667[_0x71e4('0x18')]['channel']=_0x496f08[_0x71e4('0x7b')];_0x449667['message']['motionChannel']=_0x496f08[_0x71e4('0x7b')];_0x449667['message'][_0x71e4('0x7d')]='reject';_0x449667[_0x71e4('0x18')][_0x71e4('0x48')]=htmlToText[_0x71e4('0x7f')](_0x496f08['message']['body']);respondWithRpcPromise(_0x71e4('0x80'),'EventManager',{'event':_0x71e4('0x87'),'message':_0x449667['message']},client9002);return _0x496f08;}return null;})['then'](respondWithResult(_0x2702b7,null))[_0x71e4('0x1a')](handleError(_0x2702b7,null));};exports[_0x71e4('0x88')]=function(_0x413a2d,_0x4024a6){var _0x3c2a22=moment()[_0x71e4('0x89')]()[_0x71e4('0x8a')]();var _0x560ba8=path[_0x71e4('0x8b')](config[_0x71e4('0x5a')],_0x71e4('0x8c'),_0x71e4('0x8d'),_0x71e4('0x8e'));var _0x118e54=path[_0x71e4('0x8b')](config[_0x71e4('0x5a')],_0x71e4('0x8c'),_0x71e4('0x8d'),_0x71e4('0x59'));var _0x2c7c59=util[_0x71e4('0x5f')](_0x71e4('0x8f'),_0x3c2a22);return db[_0x71e4('0x2c')][_0x71e4('0x47')]({'where':{'id':_0x413a2d[_0x71e4('0x42')]['id']},'attributes':['id',_0x71e4('0x48'),_0x71e4('0x90'),'to','cc',_0x71e4('0x91'),_0x71e4('0x92'),_0x71e4('0x93')],'include':_0x413a2d[_0x71e4('0x30')][_0x71e4('0x59')]?[{'model':db[_0x71e4('0x94')],'as':_0x71e4('0x95')}]:undefined})['then'](handleEntityNotFound(_0x4024a6,null))['then'](function(_0x4dba82){if(_0x4dba82){var _0x4abdc7=_0x4dba82;var _0x215777={'from':_0x4abdc7[_0x71e4('0x90')],'to':_0x4abdc7['to'],'subject':_0x4abdc7[_0x71e4('0x92')],'html':htmlEntities[_0x71e4('0x96')](_0x4abdc7['body']),'headers':{'Date':moment(_0x4abdc7[_0x71e4('0x93')])[_0x71e4('0x5f')](_0x71e4('0x97'))},'attachments':[]};if(_0x4dba82['cc']){_0x215777['headers']['Cc']=_0x4dba82['cc'];}if(_0x4dba82[_0x71e4('0x91')]){_0x215777[_0x71e4('0x98')]['Bcc']=_0x4dba82[_0x71e4('0x91')];}return new BPromise(function(_0x9b975c,_0x5f3f74){if(_0x4dba82[_0x71e4('0x95')]){for(var _0x289137=0x0;_0x289137<_0x4dba82[_0x71e4('0x95')][_0x71e4('0x45')];_0x289137++){var _0x48926c=_0x4dba82['Attachments'][_0x289137];var _0x259257=path[_0x71e4('0x8b')](_0x118e54,_0x48926c[_0x71e4('0x5b')]);if(fs[_0x71e4('0x99')](_0x259257)){_0x215777[_0x71e4('0x59')][_0x71e4('0x9a')]({'name':_0x48926c[_0x71e4('0x28')],'contentType':_0x48926c['type'],'data':fs[_0x71e4('0x9b')](_0x259257)});}}}emlformat[_0x71e4('0x9c')](_0x215777,function(_0x49dd4a,_0x2e92bf){if(_0x49dd4a)return _0x5f3f74(_0x49dd4a);fs[_0x71e4('0x9d')](path[_0x71e4('0x8b')](_0x560ba8,_0x2c7c59),_0x2e92bf);return _0x9b975c(_0x2e92bf);});});}})[_0x71e4('0xf')](function(_0x1006df){if(_0x1006df){return _0x4024a6['download'](path[_0x71e4('0x8b')](_0x560ba8,_0x2c7c59),_0x2c7c59,function(_0x171aba){if(!_0x171aba)fs[_0x71e4('0x9e')](path[_0x71e4('0x8b')](_0x560ba8,_0x2c7c59));});}})[_0x71e4('0x1a')](handleError(_0x4024a6,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b517a7c..7d08076 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 _0xd9e1=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x589d24,_0x23ec30){var _0x20ed0b=function(_0x2eee23){while(--_0x2eee23){_0x589d24['push'](_0x589d24['shift']());}};_0x20ed0b(++_0x23ec30);}(_0xd9e1,0x1f2));var _0x1d9e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd9e1[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x1d9e('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1d9e('0x1')](0x0);var events={'afterCreate':_0x1d9e('0x2'),'afterUpdate':_0x1d9e('0x3'),'afterDestroy':_0x1d9e('0x4')};function emitEvent(_0x229ef5){return function(_0x1bb679,_0x197613,_0x493ec4){MailMessageEvents['emit'](_0x229ef5+':'+_0x1bb679['id'],_0x1bb679);MailMessageEvents[_0x1d9e('0x5')](_0x229ef5,_0x1bb679);_0x493ec4(null);};}for(var e in events){if(events[_0x1d9e('0x6')](e)){var event=events[e];MailMessage[_0x1d9e('0x7')](e,emitEvent(event));}}module[_0x1d9e('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x217a=['MailMessage','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x217a,0x194));var _0xa217=function(_0xb8d6ec,_0x46c31d){_0xb8d6ec=_0xb8d6ec-0x0;var _0x513565=_0x217a[_0xb8d6ec];return _0x513565;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xa217('0x0'))['db'][_0xa217('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa217('0x2'),'afterUpdate':_0xa217('0x3'),'afterDestroy':_0xa217('0x4')};function emitEvent(_0x1c6c51){return function(_0x1b787e,_0x22ffb2,_0x5949fb){MailMessageEvents[_0xa217('0x5')](_0x1c6c51+':'+_0x1b787e['id'],_0x1b787e);MailMessageEvents[_0xa217('0x5')](_0x1c6c51,_0x1b787e);_0x5949fb(null);};}for(var e in events){if(events[_0xa217('0x6')](e)){var event=events[e];MailMessage[_0xa217('0x7')](e,emitEvent(event));}}module[_0xa217('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e806e58..edcd1a1 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 _0x48f5=['mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','MailMessage'];(function(_0x1b09c6,_0x448443){var _0x4ccaee=function(_0x4de392){while(--_0x4de392){_0x1b09c6['push'](_0x1b09c6['shift']());}};_0x4ccaee(++_0x448443);}(_0x48f5,0x161));var _0x548f=function(_0x57ac3c,_0x20112e){_0x57ac3c=_0x57ac3c-0x0;var _0x387f48=_0x48f5[_0x57ac3c];return _0x387f48;};'use strict';var _=require(_0x548f('0x0'));var util=require(_0x548f('0x1'));var logger=require('../../config/logger')(_0x548f('0x2'));var moment=require('moment');var BPromise=require(_0x548f('0x3'));var rp=require(_0x548f('0x4'));var htmlToText=require(_0x548f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x548f('0x6'));var config=require(_0x548f('0x7'));var attributes=require(_0x548f('0x8'));module['exports']=function(_0x36dfa2,_0xcb03c7){return _0x36dfa2['define'](_0x548f('0x9'),attributes,{'tableName':_0x548f('0xa'),'paranoid':![],'indexes':[{'name':_0x548f('0xb'),'fields':[_0x548f('0xb')]},{'name':_0x548f('0xc'),'fields':[_0x548f('0xd'),'subject'],'type':_0x548f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15a367,_0x410f8a,_0x232fe3){if(_0x15a367['body']){_0x15a367['plainBody']=htmlToText[_0x548f('0xf')](_0x15a367[_0x548f('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x232fe3(null,_0x410f8a);},'afterCreate':function(_0x3262f9,_0x4e9d6b,_0x31298b){var _0x42d7ac=_0x36dfa2[_0x548f('0x11')];var _0x1393f2=_0x3262f9[_0x548f('0x12')]({'plain':!![]});if(_0x1393f2[_0x548f('0x13')][_0x548f('0x14')]()==='in'||_0x1393f2['direction'][_0x548f('0x14')]()===_0x548f('0x15')&&!_0x1393f2[_0x548f('0x16')]&&!_[_0x548f('0x17')](_0x1393f2['UserId'])){_0x42d7ac[_0x548f('0x18')][_0x548f('0x19')]({'where':{'id':_0x1393f2['MailInteractionId']}})[_0x548f('0x1a')](function(_0x499899){if(_0x499899){_0x499899[_0x548f('0x1b')]({'lastMsgAt':_0x1393f2[_0x548f('0x1c')],'lastMsgDirection':_0x1393f2[_0x548f('0x13')][_0x548f('0x14')]()});}})[_0x548f('0x1d')](function(_0x57b99f){console[_0x548f('0x1e')](_0x57b99f);});}_0x31298b();}},'charset':_0x548f('0x1f'),'collate':_0x548f('0x20')});}; \ No newline at end of file +var _0xce4d=['path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','out','secret','UserId','MailInteraction','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x5c61fc,_0x4a91c){var _0x23b189=function(_0x47bb8f){while(--_0x47bb8f){_0x5c61fc['push'](_0x5c61fc['shift']());}};_0x23b189(++_0x4a91c);}(_0xce4d,0x19c));var _0xdce4=function(_0xf306d3,_0x2ba983){_0xf306d3=_0xf306d3-0x0;var _0x2df9a6=_0xce4d[_0xf306d3];return _0x2df9a6;};'use strict';var _=require(_0xdce4('0x0'));var util=require(_0xdce4('0x1'));var logger=require(_0xdce4('0x2'))(_0xdce4('0x3'));var moment=require(_0xdce4('0x4'));var BPromise=require(_0xdce4('0x5'));var rp=require(_0xdce4('0x6'));var htmlToText=require(_0xdce4('0x7'));var fs=require('fs');var path=require(_0xdce4('0x8'));var rimraf=require(_0xdce4('0x9'));var config=require('../../config/environment');var attributes=require(_0xdce4('0xa'));module[_0xdce4('0xb')]=function(_0xe86e1e,_0x6f7099){return _0xe86e1e[_0xdce4('0xc')](_0xdce4('0xd'),attributes,{'tableName':_0xdce4('0xe'),'paranoid':![],'indexes':[{'name':_0xdce4('0xf'),'fields':[_0xdce4('0xf')]},{'name':_0xdce4('0x10'),'fields':[_0xdce4('0x11'),_0xdce4('0x12')],'type':_0xdce4('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48b1ca,_0x1bcaee,_0xde43a6){if(_0x48b1ca[_0xdce4('0x14')]){_0x48b1ca[_0xdce4('0x11')]=htmlToText['fromString'](_0x48b1ca[_0xdce4('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xde43a6(null,_0x1bcaee);},'afterCreate':function(_0x1a792b,_0x426c61,_0xe717d9){var _0x52412d=_0xe86e1e[_0xdce4('0x15')];var _0x840ff7=_0x1a792b['get']({'plain':!![]});if(_0x840ff7[_0xdce4('0x16')][_0xdce4('0x17')]()==='in'||_0x840ff7[_0xdce4('0x16')][_0xdce4('0x17')]()===_0xdce4('0x18')&&!_0x840ff7[_0xdce4('0x19')]&&!_['isNil'](_0x840ff7[_0xdce4('0x1a')])){_0x52412d[_0xdce4('0x1b')]['findOne']({'where':{'id':_0x840ff7[_0xdce4('0x1c')]}})[_0xdce4('0x1d')](function(_0x27204b){if(_0x27204b){_0x27204b[_0xdce4('0x1e')]({'lastMsgAt':_0x840ff7['createdAt'],'lastMsgDirection':_0x840ff7[_0xdce4('0x16')][_0xdce4('0x17')]()});}})[_0xdce4('0x1f')](function(_0x1c7efd){console[_0xdce4('0x20')](_0x1c7efd);});}_0xe717d9();}},'charset':_0xdce4('0x21'),'collate':_0xdce4('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9b2a6c3..2417dc5 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 _0x4325=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','debug','lodash','util'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});config['redis']=_[_0x5432('0xa')](config['redis'],{'host':_0x5432('0xb'),'port':0x18eb});var socket=require(_0x5432('0xc'))(new Redis(config[_0x5432('0xd')]));require(_0x5432('0xe'))[_0x5432('0xf')](socket);function respondWithRpcPromise(_0x4a9a51,_0xcc52a,_0x58348a){return new BPromise(function(_0x28ff19,_0x35faac){return client[_0x5432('0x10')](_0x4a9a51,_0x58348a)[_0x5432('0x11')](function(_0x4ac11f){logger['info'](_0x5432('0x12'),_0xcc52a,_0x5432('0x13'));logger['debug'](_0x5432('0x14'),_0xcc52a,_0x5432('0x13'),JSON[_0x5432('0x15')](_0x4ac11f));if(_0x4ac11f[_0x5432('0x16')]){if(_0x4ac11f[_0x5432('0x16')][_0x5432('0x17')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xcc52a,_0x4ac11f[_0x5432('0x16')][_0x5432('0x18')]);return _0x35faac(_0x4ac11f[_0x5432('0x16')][_0x5432('0x18')]);}logger[_0x5432('0x16')](_0x5432('0x12'),_0xcc52a,_0x4ac11f['error'][_0x5432('0x18')]);return _0x28ff19(_0x4ac11f['error'][_0x5432('0x18')]);}else{logger[_0x5432('0x19')](_0x5432('0x12'),_0xcc52a,_0x5432('0x13'));_0x28ff19(_0x4ac11f[_0x5432('0x1a')]['message']);}})[_0x5432('0x1b')](function(_0x22f030){logger[_0x5432('0x16')](_0x5432('0x12'),_0xcc52a,_0x22f030);_0x35faac(_0x22f030);});});}exports[_0x5432('0x1c')]=function(_0x451de4){var _0x29e699=this;return new Promise(function(_0x5da6ea,_0x66911a){return db[_0x5432('0x1d')][_0x5432('0x1e')](_0x451de4[_0x5432('0x1f')],{'raw':_0x451de4[_0x5432('0x20')]?_0x451de4['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x61827e){logger[_0x5432('0x19')](_0x5432('0x1c'),_0x451de4);logger[_0x5432('0x21')]('CreateMailMessage',_0x451de4,JSON['stringify'](_0x61827e));_0x5da6ea(_0x61827e);})[_0x5432('0x1b')](function(_0x8ed74b){logger['error'](_0x5432('0x1c'),_0x8ed74b[_0x5432('0x18')],_0x451de4);_0x66911a(_0x29e699[_0x5432('0x16')](0x1f4,_0x8ed74b['message']));});});}; \ No newline at end of file +var _0x8952=['error','message','MailMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','stringify','code'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8952,0x17e));var _0x2895=function(_0x1b8f0d,_0x142a52){_0x1b8f0d=_0x1b8f0d-0x0;var _0x32ba16=_0x8952[_0x1b8f0d];return _0x32ba16;};'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});config['redis']=_['defaults'](config[_0x2895('0xb')],{'host':_0x2895('0xc'),'port':0x18eb});var socket=require(_0x2895('0xd'))(new Redis(config[_0x2895('0xb')]));require(_0x2895('0xe'))['register'](socket);function respondWithRpcPromise(_0x14fb67,_0x5f2632,_0x428772){return new BPromise(function(_0x5af454,_0x5e66fc){return client['request'](_0x14fb67,_0x428772)[_0x2895('0xf')](function(_0x1829a2){logger[_0x2895('0x10')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'));logger[_0x2895('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'),JSON[_0x2895('0x13')](_0x1829a2));if(_0x1829a2['error']){if(_0x1829a2['error'][_0x2895('0x14')]===0x1f4){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5e66fc(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}logger[_0x2895('0x15')](_0x2895('0x17'),_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5af454(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}else{logger[_0x2895('0x10')](_0x2895('0x17'),_0x5f2632,_0x2895('0x11'));_0x5af454(_0x1829a2[_0x2895('0x18')][_0x2895('0x16')]);}})[_0x2895('0x19')](function(_0x2fe8fe){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2fe8fe);_0x5e66fc(_0x2fe8fe);});});}exports['CreateMailMessage']=function(_0x493851){var _0x442cfa=this;return new Promise(function(_0x12c2fb,_0x3ec4da){return db['MailMessage'][_0x2895('0x1a')](_0x493851[_0x2895('0x1b')],{'raw':_0x493851[_0x2895('0x1c')]?_0x493851[_0x2895('0x1c')][_0x2895('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x30c6c3){logger[_0x2895('0x10')]('CreateMailMessage',_0x493851);logger[_0x2895('0x12')](_0x2895('0x1e'),_0x493851,JSON[_0x2895('0x13')](_0x30c6c3));_0x12c2fb(_0x30c6c3);})['catch'](function(_0x4e884f){logger[_0x2895('0x15')](_0x2895('0x1e'),_0x4e884f[_0x2895('0x16')],_0x493851);_0x3ec4da(_0x442cfa['error'](0x1f4,_0x4e884f[_0x2895('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 22f8c31..eb732a9 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 _0xdd5f=['./mailMessage.events','remove','removeListener','register','length'];(function(_0x15a10d,_0x46fb64){var _0x57c6ed=function(_0x442e3f){while(--_0x442e3f){_0x15a10d['push'](_0x15a10d['shift']());}};_0x57c6ed(++_0x46fb64);}(_0xdd5f,0x195));var _0xfdd5=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xdd5f[_0x55abd9];return _0x3e5669;};'use strict';var MailMessageEvents=require(_0xfdd5('0x0'));var events=['save',_0xfdd5('0x1'),'update'];function createListener(_0x188263,_0x1e2377){return function(_0x5a9824){_0x1e2377['emit'](_0x188263,_0x5a9824);};}function removeListener(_0x478feb,_0x2938e5){return function(){MailMessageEvents[_0xfdd5('0x2')](_0x478feb,_0x2938e5);};}exports[_0xfdd5('0x3')]=function(_0x102410){for(var _0x305ab3=0x0,_0xd0a5c7=events[_0xfdd5('0x4')];_0x305ab3<_0xd0a5c7;_0x305ab3++){var _0x4985b4=events[_0x305ab3];var _0x4ddf16=createListener('mailMessage:'+_0x4985b4,_0x102410);MailMessageEvents['on'](_0x4985b4,_0x4ddf16);}}; \ No newline at end of file +var _0x6cb7=['register','save','remove','update','emit','removeListener'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6cb7,0x19f));var _0x76cb=function(_0x531670,_0x194ee2){_0x531670=_0x531670-0x0;var _0x4d5ede=_0x6cb7[_0x531670];return _0x4d5ede;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x76cb('0x0'),_0x76cb('0x1'),_0x76cb('0x2')];function createListener(_0x554f8f,_0x2d4af7){return function(_0x4b2da5){_0x2d4af7[_0x76cb('0x3')](_0x554f8f,_0x4b2da5);};}function removeListener(_0x1dc2af,_0x1a9b4c){return function(){MailMessageEvents[_0x76cb('0x4')](_0x1dc2af,_0x1a9b4c);};}exports[_0x76cb('0x5')]=function(_0x257a1f){for(var _0x8e4b16=0x0,_0x5a8f15=events['length'];_0x8e4b16<_0x5a8f15;_0x8e4b16++){var _0x52ec5c=events[_0x8e4b16];var _0x30fd58=createListener('mailMessage:'+_0x52ec5c,_0x257a1f);MailMessageEvents['on'](_0x52ec5c,_0x30fd58);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 824d8f1..2c496fd 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 _0xe847=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0xe847,0x188));var _0x7e84=function(_0x2d85db,_0x1be56b){_0x2d85db=_0x2d85db-0x0;var _0x2d2faa=_0xe847[_0x2d85db];return _0x2d2faa;};'use strict';var multer=require(_0x7e84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7e84('0x1'));var express=require(_0x7e84('0x2'));var router=express[_0x7e84('0x3')]();var fs_extra=require(_0x7e84('0x4'));var auth=require(_0x7e84('0x5'));var interaction=require(_0x7e84('0x6'));var config=require(_0x7e84('0x7'));var controller=require(_0x7e84('0x8'));router[_0x7e84('0x9')]('/',auth[_0x7e84('0xa')](),controller[_0x7e84('0xb')]);router[_0x7e84('0x9')](_0x7e84('0xc'),auth[_0x7e84('0xa')](),controller[_0x7e84('0xd')]);router[_0x7e84('0x9')](_0x7e84('0xe'),auth[_0x7e84('0xa')](),controller[_0x7e84('0xf')]);router[_0x7e84('0x9')](_0x7e84('0x10'),auth[_0x7e84('0xa')](),controller[_0x7e84('0x11')]);router[_0x7e84('0x9')](_0x7e84('0x12'),auth['isAuthenticated'](),controller[_0x7e84('0x13')]);router[_0x7e84('0x9')](_0x7e84('0x14'),auth[_0x7e84('0xa')](),controller[_0x7e84('0x15')]);router[_0x7e84('0x16')]('/',auth[_0x7e84('0xa')](),controller[_0x7e84('0x17')]);router[_0x7e84('0x16')]('/:id/teams',auth[_0x7e84('0xa')](),controller['addTeams']);router[_0x7e84('0x16')](_0x7e84('0x14'),auth['isAuthenticated'](),controller[_0x7e84('0x18')]);router[_0x7e84('0x19')](_0x7e84('0xe'),auth['isAuthenticated'](),controller[_0x7e84('0x1a')]);router[_0x7e84('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x7e84('0x1c')]);router[_0x7e84('0x1b')](_0x7e84('0x12'),auth[_0x7e84('0xa')](),controller[_0x7e84('0x1d')]);router[_0x7e84('0x1b')](_0x7e84('0x14'),auth[_0x7e84('0xa')](),controller[_0x7e84('0x1e')]);module[_0x7e84('0x1f')]=router; \ No newline at end of file +var _0x89ed=['getTeams','/:id/users','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0x89ed,0x167));var _0xd89e=function(_0x141993,_0x5cd8c2){_0x141993=_0x141993-0x0;var _0x55203a=_0x89ed[_0x141993];return _0x55203a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd89e('0x0'));var timeout=require(_0xd89e('0x1'));var express=require(_0xd89e('0x2'));var router=express[_0xd89e('0x3')]();var fs_extra=require(_0xd89e('0x4'));var auth=require(_0xd89e('0x5'));var interaction=require(_0xd89e('0x6'));var config=require(_0xd89e('0x7'));var controller=require(_0xd89e('0x8'));router[_0xd89e('0x9')]('/',auth[_0xd89e('0xa')](),controller[_0xd89e('0xb')]);router[_0xd89e('0x9')](_0xd89e('0xc'),auth[_0xd89e('0xa')](),controller[_0xd89e('0xd')]);router[_0xd89e('0x9')](_0xd89e('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xd89e('0x9')](_0xd89e('0xf'),auth[_0xd89e('0xa')](),controller[_0xd89e('0x10')]);router[_0xd89e('0x9')](_0xd89e('0x11'),auth[_0xd89e('0xa')](),controller[_0xd89e('0x12')]);router[_0xd89e('0x9')](_0xd89e('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd89e('0x14')]('/',auth[_0xd89e('0xa')](),controller['create']);router[_0xd89e('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xd89e('0x13'),auth[_0xd89e('0xa')](),controller[_0xd89e('0x15')]);router[_0xd89e('0x16')](_0xd89e('0xe'),auth[_0xd89e('0xa')](),controller[_0xd89e('0x17')]);router[_0xd89e('0x18')](_0xd89e('0xe'),auth['isAuthenticated'](),controller[_0xd89e('0x19')]);router[_0xd89e('0x18')](_0xd89e('0x11'),auth[_0xd89e('0xa')](),controller[_0xd89e('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xd89e('0x1b')]);module[_0xd89e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 58d5758..9d3aaec 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 _0xf42f=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4b2b57,_0xbeaad3){var _0x360eba=function(_0x1db7f6){while(--_0x1db7f6){_0x4b2b57['push'](_0x4b2b57['shift']());}};_0x360eba(++_0xbeaad3);}(_0xf42f,0x1a7));var _0xff42=function(_0x5a25d8,_0x1c868f){_0x5a25d8=_0x5a25d8-0x0;var _0x4127ea=_0xf42f[_0x5a25d8];return _0x4127ea;};'use strict';var Sequelize=require(_0xff42('0x0'));module[_0xff42('0x1')]={'name':{'type':Sequelize[_0xff42('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xff42('0x2')]},'timeout':{'type':Sequelize[_0xff42('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xff42('0x4')](_0xff42('0x5'),_0xff42('0x6'),_0xff42('0x7'))}}; \ No newline at end of file +var _0xace1=['STRING','name','rrmemory'];(function(_0x311202,_0x19d54d){var _0x4f80da=function(_0x4b0492){while(--_0x4b0492){_0x311202['push'](_0x311202['shift']());}};_0x4f80da(++_0x19d54d);}(_0xace1,0xe4));var _0x1ace=function(_0x372fd0,_0xa56142){_0x372fd0=_0x372fd0-0x0;var _0x1ef2bc=_0xace1[_0x372fd0];return _0x1ef2bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ace('0x0')],'unique':_0x1ace('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ace('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1ace('0x2'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 462e403..c186746 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 _0x86e4=['%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format'];(function(_0x35d2ec,_0x30848c){var _0x1ca87d=function(_0x5634d1){while(--_0x5634d1){_0x35d2ec['push'](_0x35d2ec['shift']());}};_0x1ca87d(++_0x30848c);}(_0x86e4,0x149));var _0x486e=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0x86e4[_0x3c1312];return _0x5b4831;};'use strict';var emlformat=require(_0x486e('0x0'));var rimraf=require(_0x486e('0x1'));var zipdir=require(_0x486e('0x2'));var jsonpatch=require(_0x486e('0x3'));var rp=require(_0x486e('0x4'));var moment=require(_0x486e('0x5'));var BPromise=require(_0x486e('0x6'));var Mustache=require(_0x486e('0x7'));var util=require(_0x486e('0x8'));var path=require(_0x486e('0x9'));var sox=require(_0x486e('0xa'));var csv=require(_0x486e('0xb'));var ejs=require(_0x486e('0xc'));var fs=require('fs');var fs_extra=require(_0x486e('0xd'));var _=require('lodash');var squel=require(_0x486e('0xe'));var crypto=require(_0x486e('0xf'));var jsforce=require(_0x486e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x486e('0xb'));var querystring=require(_0x486e('0x11'));var Papa=require(_0x486e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x486e('0x13'));var as=require(_0x486e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x486e('0x15'))(_0x486e('0x16'));var utils=require(_0x486e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x486e('0x18'));var db=require(_0x486e('0x19'))['db'];config[_0x486e('0x1a')]=_[_0x486e('0x1b')](config[_0x486e('0x1a')],{'host':_0x486e('0x1c'),'port':0x18eb});var socket=require(_0x486e('0x1d'))(new Redis(config[_0x486e('0x1a')]));require('./mailQueue.socket')[_0x486e('0x1e')](socket);function respondWithStatusCode(_0x3882e7,_0x44a56f){_0x44a56f=_0x44a56f||0xcc;return function(_0x421462){if(_0x421462){return _0x3882e7['sendStatus'](_0x44a56f);}return _0x3882e7['status'](_0x44a56f)[_0x486e('0x1f')]();};}function respondWithResult(_0xd32291,_0x37a2d7){_0x37a2d7=_0x37a2d7||0xc8;return function(_0x2be5a5){if(_0x2be5a5){return _0xd32291[_0x486e('0x20')](_0x37a2d7)[_0x486e('0x21')](_0x2be5a5);}};}function respondWithFilteredResult(_0x217f24,_0x1cffe7){return function(_0x4bc2ed){if(_0x4bc2ed){var _0x171c8f=typeof _0x1cffe7[_0x486e('0x22')]===_0x486e('0x23')&&typeof _0x1cffe7[_0x486e('0x24')]==='undefined';var _0x2f12ec=_0x4bc2ed['count'];var _0x4c9c4e=_0x171c8f?0x0:_0x1cffe7[_0x486e('0x22')];var _0x3f5a62=_0x171c8f?_0x4bc2ed[_0x486e('0x25')]:_0x1cffe7['offset']+_0x1cffe7['limit'];var _0xa33730;if(_0x3f5a62>=_0x2f12ec){_0x3f5a62=_0x2f12ec;_0xa33730=0xc8;}else{_0xa33730=0xce;}_0x217f24[_0x486e('0x20')](_0xa33730);return _0x217f24['set']('Content-Range',_0x4c9c4e+'-'+_0x3f5a62+'/'+_0x2f12ec)[_0x486e('0x21')](_0x4bc2ed);}return null;};}function patchUpdates(_0x2069f1){return function(_0x57d29c){try{jsonpatch[_0x486e('0x26')](_0x57d29c,_0x2069f1,!![]);}catch(_0x122425){return BPromise[_0x486e('0x27')](_0x122425);}return _0x57d29c[_0x486e('0x28')]();};}function saveUpdates(_0x1a9244,_0xf6979f){return function(_0x12d1b5){if(_0x12d1b5){return _0x12d1b5[_0x486e('0x29')](_0x1a9244)[_0x486e('0x2a')](function(_0x18ed34){return _0x18ed34;});}return null;};}function removeEntity(_0x2e704e,_0x5ee66e){return function(_0x170202){if(_0x170202){return _0x170202[_0x486e('0x2b')]()[_0x486e('0x2a')](function(){var _0x1daf71=_0x170202[_0x486e('0x2c')]({'plain':!![]});var _0x518577=_0x486e('0x2d');return db[_0x486e('0x2e')]['destroy']({'where':{'type':_0x518577,'resourceId':_0x1daf71['id']}})[_0x486e('0x2a')](function(){return _0x170202;});})['then'](function(){_0x2e704e[_0x486e('0x20')](0xcc)[_0x486e('0x1f')]();});}};}function handleEntityNotFound(_0x357aa8,_0x39c872){return function(_0x2874d3){if(!_0x2874d3){_0x357aa8['sendStatus'](0x194);}return _0x2874d3;};}function handleError(_0x14bdc7,_0xf51698){_0xf51698=_0xf51698||0x1f4;return function(_0xef599b){logger[_0x486e('0x2f')](_0xef599b['stack']);if(_0xef599b[_0x486e('0x30')]){delete _0xef599b[_0x486e('0x30')];}_0x14bdc7['status'](_0xf51698)[_0x486e('0x31')](_0xef599b);};}exports[_0x486e('0x32')]=function(_0x2880b1,_0x571452){var _0x5c7d4c={},_0x37ac19={},_0x3ec5e6={'count':0x0,'rows':[]};var _0x12cb6f=_[_0x486e('0x33')](db[_0x486e('0x34')][_0x486e('0x35')],function(_0x45e26b){return{'name':_0x45e26b[_0x486e('0x36')],'type':_0x45e26b[_0x486e('0x37')]['key']};});_0x37ac19[_0x486e('0x38')]=_['map'](_0x12cb6f,_0x486e('0x30'));_0x37ac19[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x2880b1[_0x486e('0x39')]);_0x37ac19[_0x486e('0x3b')]=_[_0x486e('0x3c')](_0x37ac19[_0x486e('0x38')],_0x37ac19['query']);_0x5c7d4c[_0x486e('0x3d')]=_[_0x486e('0x3c')](_0x37ac19[_0x486e('0x38')],qs[_0x486e('0x3e')](_0x2880b1[_0x486e('0x39')]['fields']));_0x5c7d4c[_0x486e('0x3d')]=_0x5c7d4c[_0x486e('0x3d')]['length']?_0x5c7d4c[_0x486e('0x3d')]:_0x37ac19[_0x486e('0x38')];if(!_0x2880b1[_0x486e('0x39')][_0x486e('0x3f')](_0x486e('0x40'))){_0x5c7d4c['limit']=qs[_0x486e('0x24')](_0x2880b1[_0x486e('0x39')][_0x486e('0x24')]);_0x5c7d4c[_0x486e('0x22')]=qs[_0x486e('0x22')](_0x2880b1[_0x486e('0x39')][_0x486e('0x22')]);}_0x5c7d4c[_0x486e('0x41')]=qs[_0x486e('0x42')](_0x2880b1[_0x486e('0x39')][_0x486e('0x42')]);_0x5c7d4c[_0x486e('0x43')]=qs[_0x486e('0x3b')](_[_0x486e('0x44')](_0x2880b1['query'],_0x37ac19[_0x486e('0x3b')]),_0x12cb6f);if(_0x2880b1['query'][_0x486e('0x45')]){_0x5c7d4c['where']=_[_0x486e('0x46')](_0x5c7d4c[_0x486e('0x43')],{'$or':_[_0x486e('0x33')](_0x12cb6f,function(_0x174060){if(_0x174060['type']!==_0x486e('0x47')){var _0x198e47={};_0x198e47[_0x174060['name']]={'$like':'%'+_0x2880b1[_0x486e('0x39')][_0x486e('0x45')]+'%'};return _0x198e47;}})});}_0x5c7d4c=_[_0x486e('0x46')]({},_0x5c7d4c,_0x2880b1[_0x486e('0x48')]);var _0x2b9271={'where':_0x5c7d4c[_0x486e('0x43')]};return db['MailQueue'][_0x486e('0x25')](_0x2b9271)[_0x486e('0x2a')](function(_0x9a4cd8){_0x3ec5e6[_0x486e('0x25')]=_0x9a4cd8;if(_0x2880b1[_0x486e('0x39')]['includeAll']){_0x5c7d4c[_0x486e('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0x486e('0x4a')](_0x5c7d4c);})[_0x486e('0x2a')](function(_0x5f1de2){_0x3ec5e6['rows']=_0x5f1de2;return _0x3ec5e6;})[_0x486e('0x2a')](respondWithFilteredResult(_0x571452,_0x5c7d4c))['catch'](handleError(_0x571452,null));};exports['show']=function(_0x3aeb08,_0x5de816){var _0x5d422={'raw':!![],'where':{'id':_0x3aeb08[_0x486e('0x4b')]['id']}},_0x4978c4={};_0x4978c4['model']=_['keys'](db[_0x486e('0x34')]['rawAttributes']);_0x4978c4[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x3aeb08[_0x486e('0x39')]);_0x4978c4['filters']=_[_0x486e('0x3c')](_0x4978c4['model'],_0x4978c4[_0x486e('0x39')]);_0x5d422['attributes']=_[_0x486e('0x3c')](_0x4978c4['model'],qs[_0x486e('0x3e')](_0x3aeb08[_0x486e('0x39')]['fields']));_0x5d422[_0x486e('0x3d')]=_0x5d422[_0x486e('0x3d')][_0x486e('0x4c')]?_0x5d422['attributes']:_0x4978c4[_0x486e('0x38')];if(_0x3aeb08[_0x486e('0x39')][_0x486e('0x4d')]){_0x5d422['include']=[{'all':!![]}];}_0x5d422=_['merge']({},_0x5d422,_0x3aeb08[_0x486e('0x48')]);return db['MailQueue'][_0x486e('0x4e')](_0x5d422)['then'](handleEntityNotFound(_0x5de816,null))['then'](respondWithResult(_0x5de816,null))['catch'](handleError(_0x5de816,null));};exports[_0x486e('0x4f')]=function(_0x50ecaf,_0x5eea4b){return db[_0x486e('0x34')]['create'](_0x50ecaf[_0x486e('0x50')],{})['then'](function(_0x133fac){var _0x40bfcf=_0x50ecaf[_0x486e('0x51')][_0x486e('0x2c')]({'plain':!![]});if(!_0x40bfcf)throw new Error(_0x486e('0x52'));if(_0x40bfcf[_0x486e('0x53')]===_0x486e('0x51')){var _0x3dfaa4=_0x133fac[_0x486e('0x2c')]({'plain':!![]});var _0x123ff8=_0x486e('0x2d');return db[_0x486e('0x54')][_0x486e('0x4e')]({'where':{'name':_0x123ff8,'userProfileId':_0x40bfcf[_0x486e('0x55')]},'raw':!![]})[_0x486e('0x2a')](function(_0x1c5598){if(_0x1c5598&&_0x1c5598[_0x486e('0x56')]===0x0){return db[_0x486e('0x2e')][_0x486e('0x4f')]({'name':_0x3dfaa4[_0x486e('0x30')],'resourceId':_0x3dfaa4['id'],'type':_0x1c5598['name'],'sectionId':_0x1c5598['id']},{})[_0x486e('0x2a')](function(){return _0x133fac;});}else{return _0x133fac;}})[_0x486e('0x57')](function(_0x3b9f3e){logger['error'](_0x486e('0x58'),_0x3b9f3e);throw _0x3b9f3e;});}return _0x133fac;})[_0x486e('0x2a')](respondWithResult(_0x5eea4b,0xc9))[_0x486e('0x57')](handleError(_0x5eea4b,null));};exports[_0x486e('0x29')]=function(_0x2a6be6,_0x77ce3e){if(_0x2a6be6[_0x486e('0x50')]['id']){delete _0x2a6be6[_0x486e('0x50')]['id'];}return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x2a6be6['params']['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x77ce3e,null))[_0x486e('0x2a')](saveUpdates(_0x2a6be6[_0x486e('0x50')],null))['then'](respondWithResult(_0x77ce3e,null))['catch'](handleError(_0x77ce3e,null));};exports[_0x486e('0x2b')]=function(_0x3465d5,_0xfd3065){return db['MailQueue'][_0x486e('0x4e')]({'where':{'id':_0x3465d5[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0xfd3065,null))['then'](removeEntity(_0xfd3065,null))[_0x486e('0x57')](handleError(_0xfd3065,null));};exports['describe']=function(_0x1d75a3,_0x164d0c){return db[_0x486e('0x34')][_0x486e('0x59')]()['then'](respondWithResult(_0x164d0c,null))[_0x486e('0x57')](handleError(_0x164d0c,null));};exports[_0x486e('0x5a')]=function(_0x313b25,_0x25ab80,_0x5da41d){var _0x1ed638={'raw':!![],'where':{}},_0x13e2ba={},_0x19a579;return db[_0x486e('0x34')][_0x486e('0x5b')]({'where':{'id':_0x313b25['params']['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x25ab80,null))['then'](function(_0x252c92){if(_0x252c92){_0x19a579=_0x252c92[_0x486e('0x2c')]({'plain':!![]});_0x13e2ba[_0x486e('0x38')]=_[_0x486e('0x3a')](db[_0x486e('0x5c')]['rawAttributes']);_0x13e2ba[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x313b25[_0x486e('0x39')]);_0x13e2ba['filters']=_[_0x486e('0x3c')](_0x13e2ba[_0x486e('0x38')],_0x13e2ba[_0x486e('0x39')]);_0x1ed638['attributes']=_[_0x486e('0x3c')](_0x13e2ba[_0x486e('0x38')],qs[_0x486e('0x3e')](_0x313b25[_0x486e('0x39')][_0x486e('0x3e')]));_0x1ed638[_0x486e('0x3d')]=_0x1ed638[_0x486e('0x3d')][_0x486e('0x4c')]?_0x1ed638['attributes']:_0x13e2ba[_0x486e('0x38')];if(!_0x313b25['query']['hasOwnProperty'](_0x486e('0x40'))){_0x1ed638['limit']=qs[_0x486e('0x24')](_0x313b25[_0x486e('0x39')]['limit']);_0x1ed638[_0x486e('0x22')]=qs[_0x486e('0x22')](_0x313b25[_0x486e('0x39')][_0x486e('0x22')]);}_0x1ed638[_0x486e('0x41')]=qs[_0x486e('0x42')](_0x313b25[_0x486e('0x39')][_0x486e('0x42')]);_0x1ed638[_0x486e('0x43')]=qs['filters'](_[_0x486e('0x44')](_0x313b25['query'],_0x13e2ba[_0x486e('0x3b')]));_0x1ed638['where'][_0x486e('0x5d')]=_0x252c92['id'];if(_0x313b25[_0x486e('0x39')][_0x486e('0x45')]){_0x1ed638[_0x486e('0x43')]=_['merge'](_0x1ed638[_0x486e('0x43')],{'$or':_['map'](_0x1ed638['attributes'],function(_0x395d83){var _0x1fce07={};_0x1fce07[_0x395d83]={'$like':'%'+_0x313b25['query'][_0x486e('0x45')]+'%'};return _0x1fce07;})});}_0x1ed638=_[_0x486e('0x46')]({},_0x1ed638,_0x313b25[_0x486e('0x48')]);return db[_0x486e('0x5c')]['findAll'](_0x1ed638);}})[_0x486e('0x2a')](function(_0x50a461){if(_0x50a461){return db[_0x486e('0x5e')][_0x486e('0x5f')]({'where':{'id':_[_0x486e('0x33')](_0x50a461,_0x486e('0x60')),'role':_0x486e('0x61')},'attributes':['id',_0x486e('0x30'),_0x486e('0x62'),_0x486e('0x63'),_0x486e('0x64')]});}})['then'](function(_0x43b176){if(_0x43b176){return{'count':_0x43b176[_0x486e('0x25')],'rows':_['map'](_0x43b176[_0x486e('0x65')],function(_0xf853d6){return{'membername':_0xf853d6['name'],'UserId':_0xf853d6['id'],'queue_name':_0x19a579[_0x486e('0x30')],'MailQueueId':_0x19a579['id'],'interface':util[_0x486e('0x66')](_0x486e('0x67'),_0x486e('0x68'),_0xf853d6['name']),'penalty':0x0,'paused':_0xf853d6[_0x486e('0x62')],'createdAt':_0xf853d6[_0x486e('0x64')],'updatedAt':_0xf853d6[_0x486e('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x486e('0x2a')](respondWithFilteredResult(_0x25ab80,_0x1ed638))[_0x486e('0x57')](handleError(_0x25ab80,null));};exports[_0x486e('0x69')]=function(_0x293275,_0x48a0ac,_0x19e583){var _0x4da50d={};var _0x263668={};var _0xc00ce6;var _0x201a3e;return db[_0x486e('0x34')][_0x486e('0x5b')]({'where':{'id':_0x293275[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x48a0ac,null))['then'](function(_0x2e283b){if(_0x2e283b){_0xc00ce6=_0x2e283b;_0x263668[_0x486e('0x38')]=_['keys'](db[_0x486e('0x6a')]['rawAttributes']);_0x263668['query']=_['keys'](_0x293275[_0x486e('0x39')]);_0x263668[_0x486e('0x3b')]=_[_0x486e('0x3c')](_0x263668[_0x486e('0x38')],_0x263668[_0x486e('0x39')]);_0x4da50d[_0x486e('0x3d')]=_[_0x486e('0x3c')](_0x263668['model'],qs[_0x486e('0x3e')](_0x293275[_0x486e('0x39')]['fields']));_0x4da50d['attributes']=_0x4da50d[_0x486e('0x3d')][_0x486e('0x4c')]?_0x4da50d[_0x486e('0x3d')]:_0x263668[_0x486e('0x38')];_0x4da50d[_0x486e('0x41')]=qs[_0x486e('0x42')](_0x293275[_0x486e('0x39')][_0x486e('0x42')]);_0x4da50d[_0x486e('0x43')]=qs['filters'](_[_0x486e('0x44')](_0x293275[_0x486e('0x39')],_0x263668[_0x486e('0x3b')]));if(_0x293275[_0x486e('0x39')][_0x486e('0x45')]){_0x4da50d[_0x486e('0x43')]=_[_0x486e('0x46')](_0x4da50d[_0x486e('0x43')],{'$or':_[_0x486e('0x33')](_0x4da50d[_0x486e('0x3d')],function(_0x5b18ea){var _0x53e449={};_0x53e449[_0x5b18ea]={'$like':'%'+_0x293275[_0x486e('0x39')][_0x486e('0x45')]+'%'};return _0x53e449;})});}_0x4da50d=_[_0x486e('0x46')]({},_0x4da50d,_0x293275[_0x486e('0x48')]);return _0xc00ce6[_0x486e('0x69')](_0x4da50d);}})[_0x486e('0x2a')](function(_0x40bf19){if(_0x40bf19){_0x201a3e=_0x40bf19['length'];if(!_0x293275['query'][_0x486e('0x3f')](_0x486e('0x40'))){_0x4da50d[_0x486e('0x24')]=qs['limit'](_0x293275['query'][_0x486e('0x24')]);_0x4da50d['offset']=qs[_0x486e('0x22')](_0x293275[_0x486e('0x39')][_0x486e('0x22')]);}return _0xc00ce6[_0x486e('0x69')](_0x4da50d);}})[_0x486e('0x2a')](function(_0x4ae26b){if(_0x4ae26b){return _0x4ae26b?{'count':_0x201a3e,'rows':_0x4ae26b}:null;}})[_0x486e('0x2a')](respondWithResult(_0x48a0ac,null))[_0x486e('0x57')](handleError(_0x48a0ac,null));};exports[_0x486e('0x6b')]=function(_0x5bd70e,_0x2b0a89,_0x3cd750){var _0xb8f388=_0x5bd70e[_0x486e('0x50')][_0x486e('0x6c')];return db[_0x486e('0x6a')]['findAll']({'where':{'id':_0xb8f388},'attributes':['id'],'include':[{'model':db['User'],'as':_0x486e('0x6d'),'attributes':['id',_0x486e('0x30'),_0x486e('0x6e'),'voicePause',_0x486e('0x6f')],'raw':!![]}]})[_0x486e('0x2a')](function(_0x42e215){if(_0x42e215){var _0x3b6d49=_[_0x486e('0x70')](_0x42e215,function(_0xba54d7){var _0x24155b=_0xba54d7['get']({'plain':!![]});return _0x24155b[_0x486e('0x6d')];});return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x5bd70e[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](function(_0x23bd7d){return db[_0x486e('0x71')][_0x486e('0x72')](function(_0x12f795){return _0x23bd7d[_0x486e('0x6b')](_0xb8f388,{'transaction':_0x12f795})['then'](function(){return BPromise[_0x486e('0x73')](_0x3b6d49,function(_0x1a749f){return db[_0x486e('0x5c')][_0x486e('0x74')]({'where':{'UserId':_0x1a749f['id'],'MailQueueId':_0x5bd70e[_0x486e('0x4b')]['id']},'transaction':_0x12f795});});})[_0x486e('0x2a')](function(){_0x3b6d49[_0x486e('0x75')](function(_0xa47223){socket[_0x486e('0x76')](_0x486e('0x77'),{'UserId':_0xa47223['id'],'MailQueueId':_0x23bd7d['id']});});});});});}})['then'](respondWithStatusCode(_0x2b0a89,null))['catch'](handleError(_0x2b0a89,null));};exports['removeTeams']=function(_0x5f03c9,_0x4b9c16,_0x175576){return db['Team'][_0x486e('0x4a')]({'where':{'id':_0x5f03c9[_0x486e('0x39')][_0x486e('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x486e('0x5e')],'as':_0x486e('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x486e('0x2a')](handleEntityNotFound(_0x4b9c16,null))[_0x486e('0x2a')](function(_0x4a6756){var _0x287d15=_['map'](_0x4a6756,'id');var _0x3226c0=[];var _0x4cf187=[];var _0x310424=squel['select']();_0x310424[_0x486e('0x78')](_0x486e('0x79'))[_0x486e('0x7a')](_0x486e('0x7b'),'tq')[_0x486e('0x7c')](_0x486e('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x486e('0x43')]('MailQueueId\x20=\x20?',_0x5f03c9[_0x486e('0x4b')]['id']);for(var _0xdb52bf=0x0;_0xdb52bf<_0x4a6756[_0x486e('0x4c')];_0xdb52bf+=0x1){let _0x1403d0=_0x4a6756[_0xdb52bf];for(var _0x36dbaa=0x0;_0x36dbaa<_0x1403d0[_0x486e('0x6d')][_0x486e('0x4c')];_0x36dbaa+=0x1){let _0x2b6c77=_0x1403d0['Agents'][_0x36dbaa];var _0x287b80=_0x310424['clone']();_0x287b80[_0x486e('0x43')](_0x486e('0x7e'),_0x2b6c77['id']);_0x4cf187[_0x486e('0x7f')](db[_0x486e('0x71')][_0x486e('0x39')](_0x287b80[_0x486e('0x80')](),{'type':db[_0x486e('0x71')][_0x486e('0x81')]['SELECT']})[_0x486e('0x2a')](function(_0x5e4031){if(_0x5e4031[_0x486e('0x4c')]===0x1){return _0x2b6c77['id'];}else{var _0x266dd3=_['every'](_['map'](_0x5e4031,'TeamId'),function(_0x4d9568){return _[_0x486e('0x82')](_0x287d15,_0x4d9568);});if(_0x266dd3){return _0x2b6c77['id'];}}}));}}return BPromise[_0x486e('0x83')](_0x4cf187)['then'](function(_0x19943e){_0x3226c0=_(_0x3226c0)[_0x486e('0x84')](_0x19943e)[_0x486e('0x85')]()[_0x486e('0x86')]();return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x5f03c9[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](function(_0x3b4ed6){return db[_0x486e('0x71')][_0x486e('0x72')](function(_0x5a54be){return _0x3b4ed6[_0x486e('0x87')](_0x5f03c9[_0x486e('0x39')][_0x486e('0x6c')],{'transaction':_0x5a54be})['then'](function(){if(!_[_0x486e('0x88')](_0x3226c0)){return _0x3b4ed6[_0x486e('0x89')](_0x3226c0,{'transaction':_0x5a54be});}})['then'](function(){_0x3226c0['forEach'](function(_0x548f4b){socket[_0x486e('0x76')](_0x486e('0x8a'),{'UserId':_0x548f4b,'MailQueueId':_0x3b4ed6['id']});});});});});});})[_0x486e('0x2a')](respondWithStatusCode(_0x4b9c16,null))[_0x486e('0x57')](handleError(_0x4b9c16,null));};exports[_0x486e('0x8b')]=function(_0x356ae4,_0x5b0240,_0x51b48b){return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x356ae4[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x5b0240,null))['then'](function(_0x37ad63){if(_0x37ad63){return _0x37ad63['addAgents'](_0x356ae4[_0x486e('0x50')]['ids'],_[_0x486e('0x8c')](_0x356ae4[_0x486e('0x50')],['ids','id'])||{})[_0x486e('0x8d')](function(_0x3cfa52){for(var _0x3de47a=0x0;_0x3de47a<_0x356ae4['body'][_0x486e('0x6c')][_0x486e('0x4c')];_0x3de47a+=0x1){socket[_0x486e('0x76')](_0x486e('0x77'),{'UserId':Number(_0x356ae4[_0x486e('0x50')]['ids'][_0x3de47a]),'MailQueueId':Number(_0x356ae4[_0x486e('0x4b')]['id'])});}return _0x3cfa52;});}})[_0x486e('0x2a')](respondWithResult(_0x5b0240,null))[_0x486e('0x57')](handleError(_0x5b0240,null));};exports[_0x486e('0x89')]=function(_0x4bd6ac,_0x1a304d,_0x368755){return db['MailQueue'][_0x486e('0x4e')]({'where':{'id':_0x4bd6ac[_0x486e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a304d,null))[_0x486e('0x2a')](function(_0x34437f){if(_0x34437f){return _0x34437f[_0x486e('0x89')](_0x4bd6ac[_0x486e('0x39')]['ids'])[_0x486e('0x2a')](function(){if(_[_0x486e('0x8e')](_0x4bd6ac[_0x486e('0x39')][_0x486e('0x6c')])){for(var _0x42965a=0x0;_0x42965a<_0x4bd6ac[_0x486e('0x39')][_0x486e('0x6c')][_0x486e('0x4c')];_0x42965a+=0x1){socket[_0x486e('0x76')](_0x486e('0x8a'),{'UserId':Number(_0x4bd6ac[_0x486e('0x39')]['ids'][_0x42965a]),'MailQueueId':Number(_0x4bd6ac[_0x486e('0x4b')]['id'])});}}else{socket['emit'](_0x486e('0x8a'),{'UserId':Number(_0x4bd6ac[_0x486e('0x39')][_0x486e('0x6c')]),'MailQueueId':Number(_0x4bd6ac[_0x486e('0x4b')]['id'])});}});}})[_0x486e('0x2a')](respondWithStatusCode(_0x1a304d,null))[_0x486e('0x57')](handleError(_0x1a304d,null));};exports[_0x486e('0x8f')]=function(_0x2924d9,_0x1eadc0,_0x368307){var _0x5d14dd={};var _0x1a6fcf={};var _0x4b7f56;var _0x489073;return db[_0x486e('0x34')][_0x486e('0x5b')]({'where':{'id':_0x2924d9['params']['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x1eadc0,null))[_0x486e('0x2a')](function(_0x885c13){if(_0x885c13){_0x4b7f56=_0x885c13;_0x1a6fcf['model']=_[_0x486e('0x3a')](db[_0x486e('0x5e')][_0x486e('0x35')]);_0x1a6fcf[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x2924d9[_0x486e('0x39')]);_0x1a6fcf[_0x486e('0x3b')]=_[_0x486e('0x3c')](_0x1a6fcf['model'],_0x1a6fcf[_0x486e('0x39')]);_0x5d14dd['attributes']=_['intersection'](_0x1a6fcf['model'],qs[_0x486e('0x3e')](_0x2924d9['query']['fields']));_0x5d14dd[_0x486e('0x3d')]=_0x5d14dd[_0x486e('0x3d')][_0x486e('0x4c')]?_0x5d14dd[_0x486e('0x3d')]:_0x1a6fcf[_0x486e('0x38')];_0x5d14dd['order']=qs[_0x486e('0x42')](_0x2924d9['query'][_0x486e('0x42')]);_0x5d14dd[_0x486e('0x43')]=qs[_0x486e('0x3b')](_[_0x486e('0x44')](_0x2924d9['query'],_0x1a6fcf[_0x486e('0x3b')]));if(_0x2924d9[_0x486e('0x39')][_0x486e('0x45')]){_0x5d14dd[_0x486e('0x43')]=_[_0x486e('0x46')](_0x5d14dd[_0x486e('0x43')],{'$or':_[_0x486e('0x33')](_0x5d14dd[_0x486e('0x3d')],function(_0x3ed3e4){var _0x336c29={};_0x336c29[_0x3ed3e4]={'$like':'%'+_0x2924d9[_0x486e('0x39')][_0x486e('0x45')]+'%'};return _0x336c29;})});}_0x5d14dd=_['merge']({},_0x5d14dd,_0x2924d9[_0x486e('0x48')]);return _0x4b7f56[_0x486e('0x8f')](_0x5d14dd);}})['then'](function(_0x5c6834){if(_0x5c6834){_0x489073=_0x5c6834[_0x486e('0x4c')];if(!_0x2924d9[_0x486e('0x39')][_0x486e('0x3f')]('nolimit')){_0x5d14dd['limit']=qs[_0x486e('0x24')](_0x2924d9['query']['limit']);_0x5d14dd[_0x486e('0x22')]=qs['offset'](_0x2924d9[_0x486e('0x39')][_0x486e('0x22')]);}return _0x4b7f56[_0x486e('0x8f')](_0x5d14dd);}})[_0x486e('0x2a')](function(_0x894386){if(_0x894386){return _0x894386?{'count':_0x489073,'rows':_0x894386}:null;}})['then'](respondWithResult(_0x1eadc0,null))['catch'](handleError(_0x1eadc0,null));}; \ No newline at end of file +var _0x2632=['Team','addTeams','ids','interface','Agents','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','emit','userMailQueue:remove','addAgents','omit','isArray','getAgents','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailQueue.socket','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','MailQueueId','map','UserMailQueue','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP'];(function(_0x3e5275,_0x2ca07a){var _0x2fd0a2=function(_0x5558e3){while(--_0x5558e3){_0x3e5275['push'](_0x3e5275['shift']());}};_0x2fd0a2(++_0x2ca07a);}(_0x2632,0xae));var _0x2263=function(_0x464c71,_0xfdded5){_0x464c71=_0x464c71-0x0;var _0x552a29=_0x2632[_0x464c71];return _0x552a29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2263('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2263('0x1'));var moment=require('moment');var BPromise=require(_0x2263('0x2'));var Mustache=require(_0x2263('0x3'));var util=require(_0x2263('0x4'));var path=require(_0x2263('0x5'));var sox=require(_0x2263('0x6'));var csv=require('to-csv');var ejs=require(_0x2263('0x7'));var fs=require('fs');var fs_extra=require(_0x2263('0x8'));var _=require('lodash');var squel=require(_0x2263('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2263('0xa'));var querystring=require(_0x2263('0xb'));var Papa=require(_0x2263('0xc'));var Redis=require(_0x2263('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2263('0xe'));var as=require(_0x2263('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2263('0x10'));var utils=require(_0x2263('0x11'));var config=require(_0x2263('0x12'));var licenseUtil=require(_0x2263('0x13'));var db=require(_0x2263('0x14'))['db'];config[_0x2263('0x15')]=_[_0x2263('0x16')](config[_0x2263('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2263('0x15')]));require(_0x2263('0x17'))['register'](socket);function respondWithStatusCode(_0x212cd9,_0x4e011c){_0x4e011c=_0x4e011c||0xcc;return function(_0x3b0f19){if(_0x3b0f19){return _0x212cd9[_0x2263('0x18')](_0x4e011c);}return _0x212cd9['status'](_0x4e011c)[_0x2263('0x19')]();};}function respondWithResult(_0x2f7517,_0x43b47c){_0x43b47c=_0x43b47c||0xc8;return function(_0x52c036){if(_0x52c036){return _0x2f7517[_0x2263('0x1a')](_0x43b47c)['json'](_0x52c036);}};}function respondWithFilteredResult(_0x269f5a,_0x270925){return function(_0x3bd16e){if(_0x3bd16e){var _0x13fb98=typeof _0x270925[_0x2263('0x1b')]==='undefined'&&typeof _0x270925['limit']===_0x2263('0x1c');var _0xd0159e=_0x3bd16e[_0x2263('0x1d')];var _0x428647=_0x13fb98?0x0:_0x270925[_0x2263('0x1b')];var _0x55d5f7=_0x13fb98?_0x3bd16e[_0x2263('0x1d')]:_0x270925[_0x2263('0x1b')]+_0x270925[_0x2263('0x1e')];var _0xb24148;if(_0x55d5f7>=_0xd0159e){_0x55d5f7=_0xd0159e;_0xb24148=0xc8;}else{_0xb24148=0xce;}_0x269f5a[_0x2263('0x1a')](_0xb24148);return _0x269f5a[_0x2263('0x1f')](_0x2263('0x20'),_0x428647+'-'+_0x55d5f7+'/'+_0xd0159e)['json'](_0x3bd16e);}return null;};}function patchUpdates(_0x58389c){return function(_0x1df1de){try{jsonpatch[_0x2263('0x21')](_0x1df1de,_0x58389c,!![]);}catch(_0x4bcc1d){return BPromise['reject'](_0x4bcc1d);}return _0x1df1de[_0x2263('0x22')]();};}function saveUpdates(_0xbe0ee9,_0x199b7e){return function(_0x573881){if(_0x573881){return _0x573881['update'](_0xbe0ee9)[_0x2263('0x23')](function(_0x505655){return _0x505655;});}return null;};}function removeEntity(_0x1e9bf8,_0x3a078d){return function(_0x5b8789){if(_0x5b8789){return _0x5b8789[_0x2263('0x24')]()['then'](function(){var _0x42615c=_0x5b8789[_0x2263('0x25')]({'plain':!![]});var _0x1ec728=_0x2263('0x26');return db[_0x2263('0x27')][_0x2263('0x24')]({'where':{'type':_0x1ec728,'resourceId':_0x42615c['id']}})[_0x2263('0x23')](function(){return _0x5b8789;});})[_0x2263('0x23')](function(){_0x1e9bf8['status'](0xcc)[_0x2263('0x19')]();});}};}function handleEntityNotFound(_0x388de0,_0x11af5e){return function(_0x32d78d){if(!_0x32d78d){_0x388de0[_0x2263('0x18')](0x194);}return _0x32d78d;};}function handleError(_0x1514c3,_0x34d0c6){_0x34d0c6=_0x34d0c6||0x1f4;return function(_0xaa9f6f){logger[_0x2263('0x28')](_0xaa9f6f[_0x2263('0x29')]);if(_0xaa9f6f['name']){delete _0xaa9f6f[_0x2263('0x2a')];}_0x1514c3[_0x2263('0x1a')](_0x34d0c6)['send'](_0xaa9f6f);};}exports[_0x2263('0x2b')]=function(_0x60cd2f,_0x16ce0e){var _0x34f4ce={},_0x141a4b={},_0x5972f2={'count':0x0,'rows':[]};var _0xb0c997=_['map'](db['MailQueue'][_0x2263('0x2c')],function(_0x89e40d){return{'name':_0x89e40d[_0x2263('0x2d')],'type':_0x89e40d[_0x2263('0x2e')]['key']};});_0x141a4b[_0x2263('0x2f')]=_['map'](_0xb0c997,_0x2263('0x2a'));_0x141a4b[_0x2263('0x30')]=_[_0x2263('0x31')](_0x60cd2f[_0x2263('0x30')]);_0x141a4b['filters']=_[_0x2263('0x32')](_0x141a4b[_0x2263('0x2f')],_0x141a4b[_0x2263('0x30')]);_0x34f4ce[_0x2263('0x33')]=_[_0x2263('0x32')](_0x141a4b[_0x2263('0x2f')],qs[_0x2263('0x34')](_0x60cd2f[_0x2263('0x30')][_0x2263('0x34')]));_0x34f4ce['attributes']=_0x34f4ce['attributes'][_0x2263('0x35')]?_0x34f4ce['attributes']:_0x141a4b['model'];if(!_0x60cd2f['query'][_0x2263('0x36')](_0x2263('0x37'))){_0x34f4ce[_0x2263('0x1e')]=qs['limit'](_0x60cd2f[_0x2263('0x30')][_0x2263('0x1e')]);_0x34f4ce[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x60cd2f[_0x2263('0x30')]['offset']);}_0x34f4ce[_0x2263('0x38')]=qs[_0x2263('0x39')](_0x60cd2f['query'][_0x2263('0x39')]);_0x34f4ce[_0x2263('0x3a')]=qs[_0x2263('0x3b')](_[_0x2263('0x3c')](_0x60cd2f[_0x2263('0x30')],_0x141a4b[_0x2263('0x3b')]),_0xb0c997);if(_0x60cd2f['query'][_0x2263('0x3d')]){_0x34f4ce[_0x2263('0x3a')]=_[_0x2263('0x3e')](_0x34f4ce[_0x2263('0x3a')],{'$or':_['map'](_0xb0c997,function(_0x14ee2c){if(_0x14ee2c[_0x2263('0x2e')]!==_0x2263('0x3f')){var _0x5f246f={};_0x5f246f[_0x14ee2c[_0x2263('0x2a')]]={'$like':'%'+_0x60cd2f['query'][_0x2263('0x3d')]+'%'};return _0x5f246f;}})});}_0x34f4ce=_[_0x2263('0x3e')]({},_0x34f4ce,_0x60cd2f[_0x2263('0x40')]);var _0x22ef8a={'where':_0x34f4ce[_0x2263('0x3a')]};return db[_0x2263('0x41')][_0x2263('0x1d')](_0x22ef8a)['then'](function(_0x2108f5){_0x5972f2[_0x2263('0x1d')]=_0x2108f5;if(_0x60cd2f['query'][_0x2263('0x42')]){_0x34f4ce['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x34f4ce);})[_0x2263('0x23')](function(_0x472eb0){_0x5972f2['rows']=_0x472eb0;return _0x5972f2;})[_0x2263('0x23')](respondWithFilteredResult(_0x16ce0e,_0x34f4ce))[_0x2263('0x43')](handleError(_0x16ce0e,null));};exports[_0x2263('0x44')]=function(_0xb1442c,_0x1dc640){var _0x2e4d09={'raw':!![],'where':{'id':_0xb1442c[_0x2263('0x45')]['id']}},_0x3fe219={};_0x3fe219['model']=_['keys'](db[_0x2263('0x41')][_0x2263('0x2c')]);_0x3fe219[_0x2263('0x30')]=_[_0x2263('0x31')](_0xb1442c[_0x2263('0x30')]);_0x3fe219[_0x2263('0x3b')]=_[_0x2263('0x32')](_0x3fe219[_0x2263('0x2f')],_0x3fe219[_0x2263('0x30')]);_0x2e4d09[_0x2263('0x33')]=_[_0x2263('0x32')](_0x3fe219[_0x2263('0x2f')],qs['fields'](_0xb1442c[_0x2263('0x30')][_0x2263('0x34')]));_0x2e4d09[_0x2263('0x33')]=_0x2e4d09[_0x2263('0x33')]['length']?_0x2e4d09[_0x2263('0x33')]:_0x3fe219[_0x2263('0x2f')];if(_0xb1442c['query'][_0x2263('0x42')]){_0x2e4d09[_0x2263('0x46')]=[{'all':!![]}];}_0x2e4d09=_[_0x2263('0x3e')]({},_0x2e4d09,_0xb1442c[_0x2263('0x40')]);return db[_0x2263('0x41')][_0x2263('0x47')](_0x2e4d09)[_0x2263('0x23')](handleEntityNotFound(_0x1dc640,null))[_0x2263('0x23')](respondWithResult(_0x1dc640,null))[_0x2263('0x43')](handleError(_0x1dc640,null));};exports[_0x2263('0x48')]=function(_0x455b00,_0x5ca110){return db[_0x2263('0x41')]['create'](_0x455b00['body'],{})[_0x2263('0x23')](function(_0x5c7502){var _0x52f947=_0x455b00[_0x2263('0x49')][_0x2263('0x25')]({'plain':!![]});if(!_0x52f947)throw new Error(_0x2263('0x4a'));if(_0x52f947[_0x2263('0x4b')]===_0x2263('0x49')){var _0x541b66=_0x5c7502[_0x2263('0x25')]({'plain':!![]});var _0x15b917=_0x2263('0x26');return db[_0x2263('0x4c')][_0x2263('0x47')]({'where':{'name':_0x15b917,'userProfileId':_0x52f947[_0x2263('0x4d')]},'raw':!![]})[_0x2263('0x23')](function(_0x43f72c){if(_0x43f72c&&_0x43f72c[_0x2263('0x4e')]===0x0){return db[_0x2263('0x27')]['create']({'name':_0x541b66['name'],'resourceId':_0x541b66['id'],'type':_0x43f72c[_0x2263('0x2a')],'sectionId':_0x43f72c['id']},{})[_0x2263('0x23')](function(){return _0x5c7502;});}else{return _0x5c7502;}})[_0x2263('0x43')](function(_0x24d840){logger['error'](_0x2263('0x4f'),_0x24d840);throw _0x24d840;});}return _0x5c7502;})[_0x2263('0x23')](respondWithResult(_0x5ca110,0xc9))['catch'](handleError(_0x5ca110,null));};exports[_0x2263('0x50')]=function(_0x55e921,_0x41efdd){if(_0x55e921['body']['id']){delete _0x55e921[_0x2263('0x51')]['id'];}return db[_0x2263('0x41')][_0x2263('0x47')]({'where':{'id':_0x55e921[_0x2263('0x45')]['id']}})[_0x2263('0x23')](handleEntityNotFound(_0x41efdd,null))['then'](saveUpdates(_0x55e921[_0x2263('0x51')],null))['then'](respondWithResult(_0x41efdd,null))[_0x2263('0x43')](handleError(_0x41efdd,null));};exports[_0x2263('0x24')]=function(_0x298411,_0x395078){return db[_0x2263('0x41')][_0x2263('0x47')]({'where':{'id':_0x298411[_0x2263('0x45')]['id']}})[_0x2263('0x23')](handleEntityNotFound(_0x395078,null))[_0x2263('0x23')](removeEntity(_0x395078,null))[_0x2263('0x43')](handleError(_0x395078,null));};exports[_0x2263('0x52')]=function(_0x3fb096,_0x3ee854){return db[_0x2263('0x41')][_0x2263('0x52')]()[_0x2263('0x23')](respondWithResult(_0x3ee854,null))[_0x2263('0x43')](handleError(_0x3ee854,null));};exports[_0x2263('0x53')]=function(_0x28e532,_0x2a663a,_0x41d206){var _0x5629d2={'raw':!![],'where':{}},_0x598c4c={},_0x4e6495;return db[_0x2263('0x41')][_0x2263('0x54')]({'where':{'id':_0x28e532[_0x2263('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a663a,null))[_0x2263('0x23')](function(_0x16f74d){if(_0x16f74d){_0x4e6495=_0x16f74d[_0x2263('0x25')]({'plain':!![]});_0x598c4c[_0x2263('0x2f')]=_[_0x2263('0x31')](db['UserMailQueue']['rawAttributes']);_0x598c4c['query']=_[_0x2263('0x31')](_0x28e532[_0x2263('0x30')]);_0x598c4c[_0x2263('0x3b')]=_[_0x2263('0x32')](_0x598c4c[_0x2263('0x2f')],_0x598c4c[_0x2263('0x30')]);_0x5629d2[_0x2263('0x33')]=_[_0x2263('0x32')](_0x598c4c['model'],qs[_0x2263('0x34')](_0x28e532['query'][_0x2263('0x34')]));_0x5629d2[_0x2263('0x33')]=_0x5629d2[_0x2263('0x33')][_0x2263('0x35')]?_0x5629d2['attributes']:_0x598c4c[_0x2263('0x2f')];if(!_0x28e532[_0x2263('0x30')][_0x2263('0x36')]('nolimit')){_0x5629d2[_0x2263('0x1e')]=qs['limit'](_0x28e532[_0x2263('0x30')]['limit']);_0x5629d2[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x28e532[_0x2263('0x30')][_0x2263('0x1b')]);}_0x5629d2[_0x2263('0x38')]=qs[_0x2263('0x39')](_0x28e532[_0x2263('0x30')][_0x2263('0x39')]);_0x5629d2['where']=qs[_0x2263('0x3b')](_['pick'](_0x28e532[_0x2263('0x30')],_0x598c4c['filters']));_0x5629d2['where'][_0x2263('0x55')]=_0x16f74d['id'];if(_0x28e532['query'][_0x2263('0x3d')]){_0x5629d2['where']=_[_0x2263('0x3e')](_0x5629d2[_0x2263('0x3a')],{'$or':_[_0x2263('0x56')](_0x5629d2[_0x2263('0x33')],function(_0x4fcc1a){var _0x488c6f={};_0x488c6f[_0x4fcc1a]={'$like':'%'+_0x28e532[_0x2263('0x30')]['filter']+'%'};return _0x488c6f;})});}_0x5629d2=_['merge']({},_0x5629d2,_0x28e532[_0x2263('0x40')]);return db[_0x2263('0x57')][_0x2263('0x58')](_0x5629d2);}})[_0x2263('0x23')](function(_0x1dbfc8){if(_0x1dbfc8){return db[_0x2263('0x59')][_0x2263('0x5a')]({'where':{'id':_[_0x2263('0x56')](_0x1dbfc8,_0x2263('0x5b')),'role':'agent'},'attributes':['id',_0x2263('0x2a'),_0x2263('0x5c'),_0x2263('0x5d'),_0x2263('0x5e')]});}})[_0x2263('0x23')](function(_0x5ca208){if(_0x5ca208){return{'count':_0x5ca208['count'],'rows':_[_0x2263('0x56')](_0x5ca208['rows'],function(_0x3a32ee){return{'membername':_0x3a32ee[_0x2263('0x2a')],'UserId':_0x3a32ee['id'],'queue_name':_0x4e6495[_0x2263('0x2a')],'MailQueueId':_0x4e6495['id'],'interface':util[_0x2263('0x5f')](_0x2263('0x60'),_0x2263('0x61'),_0x3a32ee['name']),'penalty':0x0,'paused':_0x3a32ee['mailPause'],'createdAt':_0x3a32ee[_0x2263('0x5e')],'updatedAt':_0x3a32ee[_0x2263('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2a663a,_0x5629d2))['catch'](handleError(_0x2a663a,null));};exports['getTeams']=function(_0x2d447b,_0x550120,_0x1dc71f){var _0xb30fa3={};var _0x1b6654={};var _0x30e31d;var _0x2dc647;return db[_0x2263('0x41')]['findOne']({'where':{'id':_0x2d447b[_0x2263('0x45')]['id']}})[_0x2263('0x23')](handleEntityNotFound(_0x550120,null))[_0x2263('0x23')](function(_0x50f04c){if(_0x50f04c){_0x30e31d=_0x50f04c;_0x1b6654[_0x2263('0x2f')]=_['keys'](db[_0x2263('0x62')]['rawAttributes']);_0x1b6654[_0x2263('0x30')]=_[_0x2263('0x31')](_0x2d447b[_0x2263('0x30')]);_0x1b6654[_0x2263('0x3b')]=_[_0x2263('0x32')](_0x1b6654['model'],_0x1b6654[_0x2263('0x30')]);_0xb30fa3['attributes']=_[_0x2263('0x32')](_0x1b6654[_0x2263('0x2f')],qs[_0x2263('0x34')](_0x2d447b['query']['fields']));_0xb30fa3[_0x2263('0x33')]=_0xb30fa3[_0x2263('0x33')][_0x2263('0x35')]?_0xb30fa3[_0x2263('0x33')]:_0x1b6654[_0x2263('0x2f')];_0xb30fa3['order']=qs[_0x2263('0x39')](_0x2d447b[_0x2263('0x30')][_0x2263('0x39')]);_0xb30fa3['where']=qs[_0x2263('0x3b')](_[_0x2263('0x3c')](_0x2d447b[_0x2263('0x30')],_0x1b6654[_0x2263('0x3b')]));if(_0x2d447b[_0x2263('0x30')][_0x2263('0x3d')]){_0xb30fa3[_0x2263('0x3a')]=_[_0x2263('0x3e')](_0xb30fa3[_0x2263('0x3a')],{'$or':_['map'](_0xb30fa3['attributes'],function(_0x2c5332){var _0x2a3127={};_0x2a3127[_0x2c5332]={'$like':'%'+_0x2d447b[_0x2263('0x30')][_0x2263('0x3d')]+'%'};return _0x2a3127;})});}_0xb30fa3=_[_0x2263('0x3e')]({},_0xb30fa3,_0x2d447b[_0x2263('0x40')]);return _0x30e31d['getTeams'](_0xb30fa3);}})['then'](function(_0x49f338){if(_0x49f338){_0x2dc647=_0x49f338[_0x2263('0x35')];if(!_0x2d447b['query']['hasOwnProperty']('nolimit')){_0xb30fa3[_0x2263('0x1e')]=qs['limit'](_0x2d447b[_0x2263('0x30')][_0x2263('0x1e')]);_0xb30fa3[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x2d447b['query'][_0x2263('0x1b')]);}return _0x30e31d['getTeams'](_0xb30fa3);}})['then'](function(_0x3cd567){if(_0x3cd567){return _0x3cd567?{'count':_0x2dc647,'rows':_0x3cd567}:null;}})['then'](respondWithResult(_0x550120,null))[_0x2263('0x43')](handleError(_0x550120,null));};exports[_0x2263('0x63')]=function(_0x414be0,_0x4eb0b3,_0x3f6216){var _0x11580e=_0x414be0['body'][_0x2263('0x64')];return db[_0x2263('0x62')][_0x2263('0x58')]({'where':{'id':_0x11580e},'attributes':['id'],'include':[{'model':db[_0x2263('0x59')],'as':'Agents','attributes':['id',_0x2263('0x2a'),'online','voicePause',_0x2263('0x65')],'raw':!![]}]})[_0x2263('0x23')](function(_0x43e17c){if(_0x43e17c){var _0xa69bfd=_['flatMap'](_0x43e17c,function(_0xcedbde){var _0x334551=_0xcedbde[_0x2263('0x25')]({'plain':!![]});return _0x334551[_0x2263('0x66')];});return db[_0x2263('0x41')][_0x2263('0x47')]({'where':{'id':_0x414be0[_0x2263('0x45')]['id']}})[_0x2263('0x23')](function(_0xfee6de){return db['sequelize'][_0x2263('0x67')](function(_0x1ad75b){return _0xfee6de[_0x2263('0x63')](_0x11580e,{'transaction':_0x1ad75b})[_0x2263('0x23')](function(){return BPromise[_0x2263('0x68')](_0xa69bfd,function(_0x2ad2a1){return db[_0x2263('0x57')][_0x2263('0x69')]({'where':{'UserId':_0x2ad2a1['id'],'MailQueueId':_0x414be0[_0x2263('0x45')]['id']},'transaction':_0x1ad75b});});})[_0x2263('0x23')](function(){_0xa69bfd[_0x2263('0x6a')](function(_0xd0f9ab){socket['emit'](_0x2263('0x6b'),{'UserId':_0xd0f9ab['id'],'MailQueueId':_0xfee6de['id']});});});});});}})[_0x2263('0x23')](respondWithStatusCode(_0x4eb0b3,null))[_0x2263('0x43')](handleError(_0x4eb0b3,null));};exports[_0x2263('0x6c')]=function(_0x14dbd2,_0xd4405e,_0x12de03){return db[_0x2263('0x62')][_0x2263('0x58')]({'where':{'id':_0x14dbd2[_0x2263('0x30')][_0x2263('0x64')]},'attributes':['id'],'include':[{'model':db[_0x2263('0x59')],'as':_0x2263('0x66'),'attributes':['id'],'raw':!![]}]})[_0x2263('0x23')](handleEntityNotFound(_0xd4405e,null))[_0x2263('0x23')](function(_0xf297b0){var _0x206118=_[_0x2263('0x56')](_0xf297b0,'id');var _0x10002b=[];var _0x5b8ea3=[];var _0x352519=squel['select']();_0x352519[_0x2263('0x6d')](_0x2263('0x6e'))['from'](_0x2263('0x6f'),'tq')[_0x2263('0x70')](_0x2263('0x71'),'ut',_0x2263('0x72'))[_0x2263('0x3a')](_0x2263('0x73'),_0x14dbd2[_0x2263('0x45')]['id']);for(var _0x3242e7=0x0;_0x3242e7<_0xf297b0[_0x2263('0x35')];_0x3242e7+=0x1){let _0x4f64dd=_0xf297b0[_0x3242e7];for(var _0x47f782=0x0;_0x47f782<_0x4f64dd[_0x2263('0x66')]['length'];_0x47f782+=0x1){let _0x38221f=_0x4f64dd[_0x2263('0x66')][_0x47f782];var _0x2943d3=_0x352519[_0x2263('0x74')]();_0x2943d3['where'](_0x2263('0x75'),_0x38221f['id']);_0x5b8ea3[_0x2263('0x76')](db[_0x2263('0x77')][_0x2263('0x30')](_0x2943d3[_0x2263('0x78')](),{'type':db[_0x2263('0x77')][_0x2263('0x79')][_0x2263('0x7a')]})['then'](function(_0x126eac){if(_0x126eac[_0x2263('0x35')]===0x1){return _0x38221f['id'];}else{var _0x48eab1=_[_0x2263('0x7b')](_['map'](_0x126eac,_0x2263('0x7c')),function(_0x5b8e6f){return _[_0x2263('0x7d')](_0x206118,_0x5b8e6f);});if(_0x48eab1){return _0x38221f['id'];}}}));}}return BPromise[_0x2263('0x7e')](_0x5b8ea3)['then'](function(_0x3a7d4b){_0x10002b=_(_0x10002b)[_0x2263('0x7f')](_0x3a7d4b)[_0x2263('0x80')]()['value']();return db[_0x2263('0x41')]['find']({'where':{'id':_0x14dbd2['params']['id']}})[_0x2263('0x23')](function(_0x429e1f){return db[_0x2263('0x77')][_0x2263('0x67')](function(_0x299b40){return _0x429e1f[_0x2263('0x6c')](_0x14dbd2['query'][_0x2263('0x64')],{'transaction':_0x299b40})['then'](function(){if(!_['isEmpty'](_0x10002b)){return _0x429e1f[_0x2263('0x81')](_0x10002b,{'transaction':_0x299b40});}})[_0x2263('0x23')](function(){_0x10002b['forEach'](function(_0x51ccaf){socket[_0x2263('0x82')](_0x2263('0x83'),{'UserId':_0x51ccaf,'MailQueueId':_0x429e1f['id']});});});});});});})[_0x2263('0x23')](respondWithStatusCode(_0xd4405e,null))[_0x2263('0x43')](handleError(_0xd4405e,null));};exports['addAgents']=function(_0x114494,_0x52c31d,_0xf97ea5){return db[_0x2263('0x41')][_0x2263('0x47')]({'where':{'id':_0x114494[_0x2263('0x45')]['id']}})[_0x2263('0x23')](handleEntityNotFound(_0x52c31d,null))[_0x2263('0x23')](function(_0x11ab1c){if(_0x11ab1c){return _0x11ab1c[_0x2263('0x84')](_0x114494['body']['ids'],_[_0x2263('0x85')](_0x114494['body'],[_0x2263('0x64'),'id'])||{})['spread'](function(_0x480e0b){for(var _0x50054e=0x0;_0x50054e<_0x114494['body'][_0x2263('0x64')][_0x2263('0x35')];_0x50054e+=0x1){socket[_0x2263('0x82')](_0x2263('0x6b'),{'UserId':Number(_0x114494[_0x2263('0x51')][_0x2263('0x64')][_0x50054e]),'MailQueueId':Number(_0x114494[_0x2263('0x45')]['id'])});}return _0x480e0b;});}})['then'](respondWithResult(_0x52c31d,null))[_0x2263('0x43')](handleError(_0x52c31d,null));};exports[_0x2263('0x81')]=function(_0x2a6254,_0x31ff57,_0x4a9a83){return db[_0x2263('0x41')][_0x2263('0x47')]({'where':{'id':_0x2a6254[_0x2263('0x45')]['id']}})[_0x2263('0x23')](handleEntityNotFound(_0x31ff57,null))[_0x2263('0x23')](function(_0x245d11){if(_0x245d11){return _0x245d11[_0x2263('0x81')](_0x2a6254[_0x2263('0x30')][_0x2263('0x64')])[_0x2263('0x23')](function(){if(_[_0x2263('0x86')](_0x2a6254[_0x2263('0x30')]['ids'])){for(var _0x390351=0x0;_0x390351<_0x2a6254[_0x2263('0x30')]['ids'][_0x2263('0x35')];_0x390351+=0x1){socket[_0x2263('0x82')](_0x2263('0x83'),{'UserId':Number(_0x2a6254[_0x2263('0x30')][_0x2263('0x64')][_0x390351]),'MailQueueId':Number(_0x2a6254[_0x2263('0x45')]['id'])});}}else{socket[_0x2263('0x82')](_0x2263('0x83'),{'UserId':Number(_0x2a6254['query'][_0x2263('0x64')]),'MailQueueId':Number(_0x2a6254[_0x2263('0x45')]['id'])});}});}})[_0x2263('0x23')](respondWithStatusCode(_0x31ff57,null))[_0x2263('0x43')](handleError(_0x31ff57,null));};exports[_0x2263('0x87')]=function(_0x9440e8,_0x4f8c61,_0x159623){var _0x1bb6d7={};var _0x7b0009={};var _0x4fa592;var _0x435c8f;return db[_0x2263('0x41')][_0x2263('0x54')]({'where':{'id':_0x9440e8['params']['id']}})[_0x2263('0x23')](handleEntityNotFound(_0x4f8c61,null))[_0x2263('0x23')](function(_0x5dede7){if(_0x5dede7){_0x4fa592=_0x5dede7;_0x7b0009[_0x2263('0x2f')]=_['keys'](db[_0x2263('0x59')]['rawAttributes']);_0x7b0009['query']=_[_0x2263('0x31')](_0x9440e8['query']);_0x7b0009[_0x2263('0x3b')]=_[_0x2263('0x32')](_0x7b0009['model'],_0x7b0009['query']);_0x1bb6d7[_0x2263('0x33')]=_[_0x2263('0x32')](_0x7b0009[_0x2263('0x2f')],qs[_0x2263('0x34')](_0x9440e8['query'][_0x2263('0x34')]));_0x1bb6d7[_0x2263('0x33')]=_0x1bb6d7[_0x2263('0x33')][_0x2263('0x35')]?_0x1bb6d7[_0x2263('0x33')]:_0x7b0009[_0x2263('0x2f')];_0x1bb6d7[_0x2263('0x38')]=qs[_0x2263('0x39')](_0x9440e8[_0x2263('0x30')][_0x2263('0x39')]);_0x1bb6d7['where']=qs[_0x2263('0x3b')](_[_0x2263('0x3c')](_0x9440e8['query'],_0x7b0009[_0x2263('0x3b')]));if(_0x9440e8[_0x2263('0x30')][_0x2263('0x3d')]){_0x1bb6d7[_0x2263('0x3a')]=_[_0x2263('0x3e')](_0x1bb6d7[_0x2263('0x3a')],{'$or':_[_0x2263('0x56')](_0x1bb6d7[_0x2263('0x33')],function(_0xa8606d){var _0x40a8d8={};_0x40a8d8[_0xa8606d]={'$like':'%'+_0x9440e8[_0x2263('0x30')][_0x2263('0x3d')]+'%'};return _0x40a8d8;})});}_0x1bb6d7=_[_0x2263('0x3e')]({},_0x1bb6d7,_0x9440e8[_0x2263('0x40')]);return _0x4fa592[_0x2263('0x87')](_0x1bb6d7);}})[_0x2263('0x23')](function(_0x1f2564){if(_0x1f2564){_0x435c8f=_0x1f2564[_0x2263('0x35')];if(!_0x9440e8[_0x2263('0x30')][_0x2263('0x36')]('nolimit')){_0x1bb6d7[_0x2263('0x1e')]=qs[_0x2263('0x1e')](_0x9440e8[_0x2263('0x30')]['limit']);_0x1bb6d7['offset']=qs['offset'](_0x9440e8[_0x2263('0x30')][_0x2263('0x1b')]);}return _0x4fa592['getAgents'](_0x1bb6d7);}})[_0x2263('0x23')](function(_0x1f5f26){if(_0x1f5f26){return _0x1f5f26?{'count':_0x435c8f,'rows':_0x1f5f26}:null;}})[_0x2263('0x23')](respondWithResult(_0x4f8c61,null))['catch'](handleError(_0x4f8c61,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e40898f..57700ec 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 _0x84d5=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','hasOwnProperty'];(function(_0x13642b,_0x3b6058){var _0x201f42=function(_0x1ff9f7){while(--_0x1ff9f7){_0x13642b['push'](_0x13642b['shift']());}};_0x201f42(++_0x3b6058);}(_0x84d5,0x1b2));var _0x584d=function(_0x5484a2,_0x3c0a71){_0x5484a2=_0x5484a2-0x0;var _0x318a49=_0x84d5[_0x5484a2];return _0x318a49;};'use strict';var EventEmitter=require(_0x584d('0x0'));var MailQueue=require(_0x584d('0x1'))['db'][_0x584d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x584d('0x3')](0x0);var events={'afterCreate':_0x584d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5aa0c7){return function(_0x19f33c,_0x5814c2,_0x30a7c6){MailQueueEvents['emit'](_0x5aa0c7+':'+_0x19f33c['id'],_0x19f33c);MailQueueEvents['emit'](_0x5aa0c7,_0x19f33c);_0x30a7c6(null);};}for(var e in events){if(events[_0x584d('0x5')](e)){var event=events[e];MailQueue[_0x584d('0x6')](e,emitEvent(event));}}module[_0x584d('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x0b16=['hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x0b16,0x17c));var _0x60b1=function(_0x595ebd,_0x409cb1){_0x595ebd=_0x595ebd-0x0;var _0x5a6e27=_0x0b16[_0x595ebd];return _0x5a6e27;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x60b1('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x60b1('0x1')](0x0);var events={'afterCreate':_0x60b1('0x2'),'afterUpdate':_0x60b1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5bb7d0){return function(_0x440cbf,_0x56c4e7,_0x42b766){MailQueueEvents[_0x60b1('0x4')](_0x5bb7d0+':'+_0x440cbf['id'],_0x440cbf);MailQueueEvents[_0x60b1('0x4')](_0x5bb7d0,_0x440cbf);_0x42b766(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x60b1('0x5')](e,emitEvent(event));}}module[_0x60b1('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 5ad5529..f91c549 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 _0x112d=['MailQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x445975,_0x3df67c){var _0x4bf86a=function(_0x3fffc5){while(--_0x3fffc5){_0x445975['push'](_0x445975['shift']());}};_0x4bf86a(++_0x3df67c);}(_0x112d,0xa9));var _0xd112=function(_0x3a7c8c,_0x2f954){_0x3a7c8c=_0x3a7c8c-0x0;var _0x1b00c5=_0x112d[_0x3a7c8c];return _0x1b00c5;};'use strict';var _=require(_0xd112('0x0'));var util=require(_0xd112('0x1'));var logger=require(_0xd112('0x2'))(_0xd112('0x3'));var moment=require(_0xd112('0x4'));var BPromise=require('bluebird');var rp=require(_0xd112('0x5'));var fs=require('fs');var path=require(_0xd112('0x6'));var rimraf=require(_0xd112('0x7'));var config=require(_0xd112('0x8'));var attributes=require(_0xd112('0x9'));module[_0xd112('0xa')]=function(_0xd8b31,_0x2a6792){return _0xd8b31['define'](_0xd112('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7759=['define','mail_queues','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x14dd10,_0x4900d6){var _0x5cb641=function(_0x499124){while(--_0x499124){_0x14dd10['push'](_0x14dd10['shift']());}};_0x5cb641(++_0x4900d6);}(_0x7759,0x66));var _0x9775=function(_0x1366d9,_0x65264b){_0x1366d9=_0x1366d9-0x0;var _0x5084c0=_0x7759[_0x1366d9];return _0x5084c0;};'use strict';var _=require(_0x9775('0x0'));var util=require('util');var logger=require(_0x9775('0x1'))('api');var moment=require(_0x9775('0x2'));var BPromise=require(_0x9775('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9775('0x4'));var rimraf=require(_0x9775('0x5'));var config=require(_0x9775('0x6'));var attributes=require(_0x9775('0x7'));module['exports']=function(_0x19f024,_0x1e35bc){return _0x19f024[_0x9775('0x8')]('MailQueue',attributes,{'tableName':_0x9775('0x9'),'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 b3608e3..f5a0eb1 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 _0x5d99=['socket.io-emitter','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMailQueue','MailQueue','options','where','attributes','limit','include','model','map','debug','stringify','ShowMailQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x28a20f,_0x25ddd9){var _0x46eb1b=function(_0x134afb){while(--_0x134afb){_0x28a20f['push'](_0x28a20f['shift']());}};_0x46eb1b(++_0x25ddd9);}(_0x5d99,0x150));var _0x95d9=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x5d99[_0x564821];return _0x2b604d;};'use strict';var _=require('lodash');var util=require(_0x95d9('0x0'));var moment=require(_0x95d9('0x1'));var BPromise=require(_0x95d9('0x2'));var rs=require(_0x95d9('0x3'));var fs=require('fs');var Redis=require(_0x95d9('0x4'));var db=require(_0x95d9('0x5'))['db'];var utils=require(_0x95d9('0x6'));var logger=require(_0x95d9('0x7'))(_0x95d9('0x8'));var config=require(_0x95d9('0x9'));var jayson=require(_0x95d9('0xa'));var client=jayson[_0x95d9('0xb')][_0x95d9('0xc')]({'port':0x232a});config[_0x95d9('0xd')]=_['defaults'](config[_0x95d9('0xd')],{'host':_0x95d9('0xe'),'port':0x18eb});var socket=require(_0x95d9('0xf'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x95d9('0x10')](socket);function respondWithRpcPromise(_0x423d4a,_0x2c9f99,_0x330dab){return new BPromise(function(_0x1ca57e,_0x39add8){return client['request'](_0x423d4a,_0x330dab)[_0x95d9('0x11')](function(_0x59d1e8){logger[_0x95d9('0x12')](_0x95d9('0x13'),_0x2c9f99,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x2c9f99,_0x95d9('0x14'),JSON['stringify'](_0x59d1e8));if(_0x59d1e8['error']){if(_0x59d1e8[_0x95d9('0x15')][_0x95d9('0x16')]===0x1f4){logger['error'](_0x95d9('0x13'),_0x2c9f99,_0x59d1e8[_0x95d9('0x15')][_0x95d9('0x17')]);return _0x39add8(_0x59d1e8[_0x95d9('0x15')][_0x95d9('0x17')]);}logger[_0x95d9('0x15')]('MailQueue,\x20%s,\x20%s',_0x2c9f99,_0x59d1e8[_0x95d9('0x15')]['message']);return _0x1ca57e(_0x59d1e8[_0x95d9('0x15')][_0x95d9('0x17')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x2c9f99,_0x95d9('0x14'));_0x1ca57e(_0x59d1e8[_0x95d9('0x18')][_0x95d9('0x17')]);}})['catch'](function(_0x1508b9){logger['error'](_0x95d9('0x13'),_0x2c9f99,_0x1508b9);_0x39add8(_0x1508b9);});});}exports[_0x95d9('0x19')]=function(_0x5e4d74){var _0x51ebc1=this;return new Promise(function(_0x5dc146,_0x498356){return db[_0x95d9('0x1a')]['findAll']({'raw':_0x5e4d74[_0x95d9('0x1b')]?_0x5e4d74['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e4d74[_0x95d9('0x1b')]?_0x5e4d74[_0x95d9('0x1b')][_0x95d9('0x1c')]||null:null,'attributes':_0x5e4d74[_0x95d9('0x1b')]?_0x5e4d74[_0x95d9('0x1b')][_0x95d9('0x1d')]||null:null,'limit':_0x5e4d74['options']?_0x5e4d74[_0x95d9('0x1b')][_0x95d9('0x1e')]||null:null,'include':_0x5e4d74[_0x95d9('0x1b')]?_0x5e4d74[_0x95d9('0x1b')][_0x95d9('0x1f')]?_['map'](_0x5e4d74[_0x95d9('0x1b')][_0x95d9('0x1f')],function(_0x509006){return{'model':db[_0x509006[_0x95d9('0x20')]],'as':_0x509006['as'],'attributes':_0x509006[_0x95d9('0x1d')],'include':_0x509006[_0x95d9('0x1f')]?_[_0x95d9('0x21')](_0x509006['include'],function(_0x5d173b){return{'model':db[_0x5d173b[_0x95d9('0x20')]],'as':_0x5d173b['as'],'attributes':_0x5d173b[_0x95d9('0x1d')],'include':_0x5d173b[_0x95d9('0x1f')]?_[_0x95d9('0x21')](_0x5d173b['include'],function(_0x3b1de4){return{'model':db[_0x3b1de4[_0x95d9('0x20')]],'as':_0x3b1de4['as'],'attributes':_0x3b1de4[_0x95d9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36c755){logger[_0x95d9('0x12')](_0x95d9('0x19'),_0x5e4d74);logger[_0x95d9('0x22')]('GetMailQueue',_0x5e4d74,JSON[_0x95d9('0x23')](_0x36c755));_0x5dc146(_0x36c755);})['catch'](function(_0x493fae){logger[_0x95d9('0x15')]('GetMailQueue',_0x493fae['message'],_0x5e4d74);_0x498356(_0x51ebc1[_0x95d9('0x15')](0x1f4,_0x493fae[_0x95d9('0x17')]));});});};exports[_0x95d9('0x24')]=function(_0x479015){var _0x3746b8=this;return new Promise(function(_0x3cfa22,_0x321867){return db['MailQueue'][_0x95d9('0x25')]({'raw':_0x479015['options']?_0x479015[_0x95d9('0x1b')][_0x95d9('0x26')]===undefined?!![]:![]:!![],'where':_0x479015['options']?_0x479015[_0x95d9('0x1b')][_0x95d9('0x1c')]||null:null,'attributes':_0x479015[_0x95d9('0x1b')]?_0x479015[_0x95d9('0x1b')][_0x95d9('0x1d')]||null:null,'include':_0x479015['options']?_0x479015[_0x95d9('0x1b')][_0x95d9('0x1f')]?_[_0x95d9('0x21')](_0x479015['options'][_0x95d9('0x1f')],function(_0x82b5){return{'model':db[_0x82b5[_0x95d9('0x20')]],'as':_0x82b5['as'],'attributes':_0x82b5[_0x95d9('0x1d')],'include':_0x82b5[_0x95d9('0x1f')]?_[_0x95d9('0x21')](_0x82b5[_0x95d9('0x1f')],function(_0xe0c77e){return{'model':db[_0xe0c77e[_0x95d9('0x20')]],'as':_0xe0c77e['as'],'attributes':_0xe0c77e[_0x95d9('0x1d')],'include':_0xe0c77e[_0x95d9('0x1f')]?_[_0x95d9('0x21')](_0xe0c77e[_0x95d9('0x1f')],function(_0x3326d5){return{'model':db[_0x3326d5[_0x95d9('0x20')]],'as':_0x3326d5['as'],'attributes':_0x3326d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x95d9('0x11')](function(_0x309c4e){logger[_0x95d9('0x12')](_0x95d9('0x24'),_0x479015);logger[_0x95d9('0x22')]('ShowMailQueue',_0x479015,JSON[_0x95d9('0x23')](_0x309c4e));_0x3cfa22(_0x309c4e);})['catch'](function(_0x188b60){logger[_0x95d9('0x15')](_0x95d9('0x24'),_0x188b60[_0x95d9('0x17')],_0x479015);_0x321867(_0x3746b8[_0x95d9('0x15')](0x1f4,_0x188b60['message']));});});}; \ No newline at end of file +var _0xdadd=['socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','options','where','limit','include','map','attributes','model','GetMailQueue','catch','MailQueue','find','raw','ShowMailQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x2cf3c6,_0x181a58){var _0xa83fd=function(_0x967f93){while(--_0x967f93){_0x2cf3c6['push'](_0x2cf3c6['shift']());}};_0xa83fd(++_0x181a58);}(_0xdadd,0x1c8));var _0xddad=function(_0x48ccc1,_0x55e9cb){_0x48ccc1=_0x48ccc1-0x0;var _0x9ffe13=_0xdadd[_0x48ccc1];return _0x9ffe13;};'use strict';var _=require(_0xddad('0x0'));var util=require('util');var moment=require(_0xddad('0x1'));var BPromise=require('bluebird');var rs=require(_0xddad('0x2'));var fs=require('fs');var Redis=require(_0xddad('0x3'));var db=require(_0xddad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddad('0x5'))(_0xddad('0x6'));var config=require(_0xddad('0x7'));var jayson=require(_0xddad('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xddad('0x9')]=_[_0xddad('0xa')](config['redis'],{'host':_0xddad('0xb'),'port':0x18eb});var socket=require(_0xddad('0xc'))(new Redis(config[_0xddad('0x9')]));require(_0xddad('0xd'))[_0xddad('0xe')](socket);function respondWithRpcPromise(_0x1dd5c3,_0x16fd0a,_0x350e04){return new BPromise(function(_0x166f04,_0x5075ed){return client[_0xddad('0xf')](_0x1dd5c3,_0x350e04)[_0xddad('0x10')](function(_0x59b7a5){logger['info'](_0xddad('0x11'),_0x16fd0a,'request\x20sent');logger[_0xddad('0x12')](_0xddad('0x13'),_0x16fd0a,_0xddad('0x14'),JSON[_0xddad('0x15')](_0x59b7a5));if(_0x59b7a5[_0xddad('0x16')]){if(_0x59b7a5[_0xddad('0x16')]['code']===0x1f4){logger[_0xddad('0x16')](_0xddad('0x11'),_0x16fd0a,_0x59b7a5[_0xddad('0x16')][_0xddad('0x17')]);return _0x5075ed(_0x59b7a5[_0xddad('0x16')][_0xddad('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x16fd0a,_0x59b7a5[_0xddad('0x16')][_0xddad('0x17')]);return _0x166f04(_0x59b7a5[_0xddad('0x16')][_0xddad('0x17')]);}else{logger[_0xddad('0x18')]('MailQueue,\x20%s,\x20%s',_0x16fd0a,_0xddad('0x14'));_0x166f04(_0x59b7a5[_0xddad('0x19')][_0xddad('0x17')]);}})['catch'](function(_0x21b284){logger['error'](_0xddad('0x11'),_0x16fd0a,_0x21b284);_0x5075ed(_0x21b284);});});}exports['GetMailQueue']=function(_0x55fd30){var _0x594f4a=this;return new Promise(function(_0x22bfdd,_0x49acbf){return db['MailQueue']['findAll']({'raw':_0x55fd30['options']?_0x55fd30[_0xddad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x55fd30[_0xddad('0x1a')]?_0x55fd30[_0xddad('0x1a')][_0xddad('0x1b')]||null:null,'attributes':_0x55fd30['options']?_0x55fd30['options']['attributes']||null:null,'limit':_0x55fd30[_0xddad('0x1a')]?_0x55fd30['options'][_0xddad('0x1c')]||null:null,'include':_0x55fd30[_0xddad('0x1a')]?_0x55fd30[_0xddad('0x1a')][_0xddad('0x1d')]?_[_0xddad('0x1e')](_0x55fd30['options'][_0xddad('0x1d')],function(_0x5b3a5b){return{'model':db[_0x5b3a5b['model']],'as':_0x5b3a5b['as'],'attributes':_0x5b3a5b[_0xddad('0x1f')],'include':_0x5b3a5b[_0xddad('0x1d')]?_[_0xddad('0x1e')](_0x5b3a5b['include'],function(_0x3a0851){return{'model':db[_0x3a0851[_0xddad('0x20')]],'as':_0x3a0851['as'],'attributes':_0x3a0851['attributes'],'include':_0x3a0851[_0xddad('0x1d')]?_['map'](_0x3a0851[_0xddad('0x1d')],function(_0x53c761){return{'model':db[_0x53c761[_0xddad('0x20')]],'as':_0x53c761['as'],'attributes':_0x53c761[_0xddad('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x108192){logger['info'](_0xddad('0x21'),_0x55fd30);logger['debug'](_0xddad('0x21'),_0x55fd30,JSON[_0xddad('0x15')](_0x108192));_0x22bfdd(_0x108192);})[_0xddad('0x22')](function(_0x36a7a8){logger['error'](_0xddad('0x21'),_0x36a7a8[_0xddad('0x17')],_0x55fd30);_0x49acbf(_0x594f4a['error'](0x1f4,_0x36a7a8[_0xddad('0x17')]));});});};exports['ShowMailQueue']=function(_0x58e520){var _0x8d0d42=this;return new Promise(function(_0x360e2e,_0x3455b8){return db[_0xddad('0x23')][_0xddad('0x24')]({'raw':_0x58e520['options']?_0x58e520[_0xddad('0x1a')][_0xddad('0x25')]===undefined?!![]:![]:!![],'where':_0x58e520[_0xddad('0x1a')]?_0x58e520['options'][_0xddad('0x1b')]||null:null,'attributes':_0x58e520['options']?_0x58e520[_0xddad('0x1a')]['attributes']||null:null,'include':_0x58e520[_0xddad('0x1a')]?_0x58e520[_0xddad('0x1a')]['include']?_[_0xddad('0x1e')](_0x58e520['options']['include'],function(_0x5884d2){return{'model':db[_0x5884d2['model']],'as':_0x5884d2['as'],'attributes':_0x5884d2[_0xddad('0x1f')],'include':_0x5884d2[_0xddad('0x1d')]?_['map'](_0x5884d2['include'],function(_0x53411f){return{'model':db[_0x53411f[_0xddad('0x20')]],'as':_0x53411f['as'],'attributes':_0x53411f['attributes'],'include':_0x53411f[_0xddad('0x1d')]?_['map'](_0x53411f['include'],function(_0x5315aa){return{'model':db[_0x5315aa['model']],'as':_0x5315aa['as'],'attributes':_0x5315aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xddad('0x10')](function(_0x41bb7b){logger[_0xddad('0x18')](_0xddad('0x26'),_0x58e520);logger[_0xddad('0x12')](_0xddad('0x26'),_0x58e520,JSON[_0xddad('0x15')](_0x41bb7b));_0x360e2e(_0x41bb7b);})[_0xddad('0x22')](function(_0x10c347){logger[_0xddad('0x16')](_0xddad('0x26'),_0x10c347[_0xddad('0x17')],_0x58e520);_0x3455b8(_0x8d0d42['error'](0x1f4,_0x10c347[_0xddad('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4e3a214..2d4d5ba 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 _0x89d9=['./mailQueue.events','save','update','emit','removeListener','register','length','mailQueue:'];(function(_0x53f539,_0x4b348a){var _0x5114ce=function(_0x3c027b){while(--_0x3c027b){_0x53f539['push'](_0x53f539['shift']());}};_0x5114ce(++_0x4b348a);}(_0x89d9,0x1c0));var _0x989d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x89d9[_0x2be8c2];return _0x97f531;};'use strict';var MailQueueEvents=require(_0x989d('0x0'));var events=[_0x989d('0x1'),'remove',_0x989d('0x2')];function createListener(_0x205d44,_0x5f55b4){return function(_0x57c9e8){_0x5f55b4[_0x989d('0x3')](_0x205d44,_0x57c9e8);};}function removeListener(_0x1defe5,_0x267226){return function(){MailQueueEvents[_0x989d('0x4')](_0x1defe5,_0x267226);};}exports[_0x989d('0x5')]=function(_0x3938d3){for(var _0x214e4f=0x0,_0x70ccd4=events[_0x989d('0x6')];_0x214e4f<_0x70ccd4;_0x214e4f++){var _0x21e60f=events[_0x214e4f];var _0x2e1327=createListener(_0x989d('0x7')+_0x21e60f,_0x3938d3);MailQueueEvents['on'](_0x21e60f,_0x2e1327);}}; \ No newline at end of file +var _0xba40=['removeListener','register','length','mailQueue:','remove','update','emit'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xba40,0x7b));var _0x0ba4=function(_0x21291a,_0x48d2fb){_0x21291a=_0x21291a-0x0;var _0x508d6f=_0xba40[_0x21291a];return _0x508d6f;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x0ba4('0x0'),_0x0ba4('0x1')];function createListener(_0x4bba10,_0x2ce210){return function(_0x36cc96){_0x2ce210[_0x0ba4('0x2')](_0x4bba10,_0x36cc96);};}function removeListener(_0x1fd109,_0x3fe778){return function(){MailQueueEvents[_0x0ba4('0x3')](_0x1fd109,_0x3fe778);};}exports[_0x0ba4('0x4')]=function(_0x3665ee){for(var _0x517498=0x0,_0x36ed85=events[_0x0ba4('0x5')];_0x517498<_0x36ed85;_0x517498++){var _0x45e3b4=events[_0x517498];var _0x4bd8e8=createListener(_0x0ba4('0x6')+_0x45e3b4,_0x3665ee);MailQueueEvents['on'](_0x45e3b4,_0x4bd8e8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1c4d37f..25e0e1c 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 _0x54d9=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x54d9,0xed));var _0x954d=function(_0xd76b33,_0x40a034){_0xd76b33=_0xd76b33-0x0;var _0x4a7aaa=_0x54d9[_0xd76b33];return _0x4a7aaa;};'use strict';var multer=require(_0x954d('0x0'));var util=require(_0x954d('0x1'));var path=require(_0x954d('0x2'));var timeout=require(_0x954d('0x3'));var express=require('express');var router=express[_0x954d('0x4')]();var fs_extra=require(_0x954d('0x5'));var auth=require(_0x954d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x954d('0x7'));var controller=require('./mailQueueReport.controller');router[_0x954d('0x8')]('/',auth['isAuthenticated'](),controller[_0x954d('0x9')]);router[_0x954d('0x8')](_0x954d('0xa'),auth[_0x954d('0xb')](),controller[_0x954d('0xc')]);router['get'](_0x954d('0xd'),auth['isAuthenticated'](),controller[_0x954d('0xe')]);router[_0x954d('0xf')]('/',auth[_0x954d('0xb')](),controller['create']);router[_0x954d('0x10')]('/:id',auth[_0x954d('0xb')](),controller[_0x954d('0x11')]);router[_0x954d('0x12')](_0x954d('0xd'),auth['isAuthenticated'](),controller[_0x954d('0x13')]);module[_0x954d('0x14')]=router; \ No newline at end of file +var _0x2bf5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','index','get','isAuthenticated','/:id','show','create','put','delete','exports','multer','util'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0x2bf5,0x1d2));var _0x52bf=function(_0x265204,_0x2c62ce){_0x265204=_0x265204-0x0;var _0x4a65b1=_0x2bf5[_0x265204];return _0x4a65b1;};'use strict';var multer=require(_0x52bf('0x0'));var util=require(_0x52bf('0x1'));var path=require(_0x52bf('0x2'));var timeout=require(_0x52bf('0x3'));var express=require('express');var router=express[_0x52bf('0x4')]();var fs_extra=require(_0x52bf('0x5'));var auth=require(_0x52bf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x52bf('0x7'));var controller=require(_0x52bf('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x52bf('0x9')]);router[_0x52bf('0xa')]('/describe',auth[_0x52bf('0xb')](),controller['describe']);router[_0x52bf('0xa')](_0x52bf('0xc'),auth[_0x52bf('0xb')](),controller[_0x52bf('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x52bf('0xe')]);router[_0x52bf('0xf')](_0x52bf('0xc'),auth[_0x52bf('0xb')](),controller['update']);router[_0x52bf('0x10')](_0x52bf('0xc'),auth[_0x52bf('0xb')](),controller['destroy']);module[_0x52bf('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6fd4be5..23c0677 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 _0x15ae=['DATE','sequelize','STRING'];(function(_0x14a86e,_0x5a2875){var _0x1e295f=function(_0x1d28c3){while(--_0x1d28c3){_0x14a86e['push'](_0x14a86e['shift']());}};_0x1e295f(++_0x5a2875);}(_0x15ae,0x10f));var _0xe15a=function(_0x442ce0,_0x479ef3){_0x442ce0=_0x442ce0-0x0;var _0x517d62=_0x15ae[_0x442ce0];return _0x517d62;};'use strict';var moment=require('moment');var Sequelize=require(_0xe15a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe15a('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe15a('0x2')]},'acceptAt':{'type':Sequelize[_0xe15a('0x2')]},'exitAt':{'type':Sequelize[_0xe15a('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc431=['DATE','moment','exports','STRING'];(function(_0x226e5c,_0x19e27e){var _0x1c3fd6=function(_0x1f190e){while(--_0x1f190e){_0x226e5c['push'](_0x226e5c['shift']());}};_0x1c3fd6(++_0x19e27e);}(_0xc431,0x89));var _0x1c43=function(_0x4dd1d7,_0x340966){_0x4dd1d7=_0x4dd1d7-0x0;var _0x38fbcd=_0xc431[_0x4dd1d7];return _0x38fbcd;};'use strict';var moment=require(_0x1c43('0x0'));var Sequelize=require('sequelize');module[_0x1c43('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1c43('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1c43('0x3')]},'acceptAt':{'type':Sequelize[_0x1c43('0x3')]},'exitAt':{'type':Sequelize[_0x1c43('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5a24c77..a9d122a 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 _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4677da,_0x7be02d){var _0x23ce72=function(_0x49dca1){while(--_0x49dca1){_0x4677da['push'](_0x4677da['shift']());}};_0x23ce72(++_0x7be02d);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file +var _0x8f4c=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','MailQueueReport','includeAll','include','findAll','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x2b4d01,_0x4c6044){var _0x4195d7=function(_0x59935){while(--_0x59935){_0x2b4d01['push'](_0x2b4d01['shift']());}};_0x4195d7(++_0x4c6044);}(_0x8f4c,0x113));var _0xc8f4=function(_0x466e6b,_0x4053fd){_0x466e6b=_0x466e6b-0x0;var _0x118deb=_0x8f4c[_0x466e6b];return _0x118deb;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];function respondWithStatusCode(_0x729f8f,_0x39b785){_0x39b785=_0x39b785||0xcc;return function(_0x4e31cf){if(_0x4e31cf){return _0x729f8f[_0xc8f4('0x17')](_0x39b785);}return _0x729f8f[_0xc8f4('0x18')](_0x39b785)[_0xc8f4('0x19')]();};}function respondWithResult(_0x14bc11,_0x1dcee5){_0x1dcee5=_0x1dcee5||0xc8;return function(_0x411c5c){if(_0x411c5c){return _0x14bc11['status'](_0x1dcee5)[_0xc8f4('0x1a')](_0x411c5c);}};}function respondWithFilteredResult(_0x2c7bc1,_0x1518a6){return function(_0x46ac15){if(_0x46ac15){var _0x22c08a=typeof _0x1518a6['offset']===_0xc8f4('0x1b')&&typeof _0x1518a6['limit']==='undefined';var _0x14bc02=_0x46ac15[_0xc8f4('0x1c')];var _0x108076=_0x22c08a?0x0:_0x1518a6[_0xc8f4('0x1d')];var _0x4763c1=_0x22c08a?_0x46ac15[_0xc8f4('0x1c')]:_0x1518a6[_0xc8f4('0x1d')]+_0x1518a6[_0xc8f4('0x1e')];var _0x1982bb;if(_0x4763c1>=_0x14bc02){_0x4763c1=_0x14bc02;_0x1982bb=0xc8;}else{_0x1982bb=0xce;}_0x2c7bc1[_0xc8f4('0x18')](_0x1982bb);return _0x2c7bc1[_0xc8f4('0x1f')](_0xc8f4('0x20'),_0x108076+'-'+_0x4763c1+'/'+_0x14bc02)[_0xc8f4('0x1a')](_0x46ac15);}return null;};}function patchUpdates(_0x5f3264){return function(_0x378f56){try{jsonpatch[_0xc8f4('0x21')](_0x378f56,_0x5f3264,!![]);}catch(_0x29e52d){return BPromise[_0xc8f4('0x22')](_0x29e52d);}return _0x378f56[_0xc8f4('0x23')]();};}function saveUpdates(_0x3b42ee,_0xaeee7d){return function(_0x43eb57){if(_0x43eb57){return _0x43eb57['update'](_0x3b42ee)[_0xc8f4('0x24')](function(_0x205c41){return _0x205c41;});}return null;};}function removeEntity(_0x3195ff,_0x1d159e){return function(_0x5d54a9){if(_0x5d54a9){return _0x5d54a9[_0xc8f4('0x25')]()['then'](function(){_0x3195ff[_0xc8f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x177a44,_0x3dd717){return function(_0x5c94c6){if(!_0x5c94c6){_0x177a44[_0xc8f4('0x17')](0x194);}return _0x5c94c6;};}function handleError(_0x21062f,_0x11f766){_0x11f766=_0x11f766||0x1f4;return function(_0x2fa052){logger['error'](_0x2fa052[_0xc8f4('0x26')]);if(_0x2fa052[_0xc8f4('0x27')]){delete _0x2fa052['name'];}_0x21062f[_0xc8f4('0x18')](_0x11f766)[_0xc8f4('0x28')](_0x2fa052);};}exports[_0xc8f4('0x29')]=function(_0x1b70bc,_0x24bef0){var _0x385e41={},_0x4a25da={},_0x45f972={'count':0x0,'rows':[]};var _0x24bb78=_[_0xc8f4('0x2a')](db['MailQueueReport'][_0xc8f4('0x2b')],function(_0x3a4b1b){return{'name':_0x3a4b1b['fieldName'],'type':_0x3a4b1b['type']['key']};});_0x4a25da[_0xc8f4('0x2c')]=_[_0xc8f4('0x2a')](_0x24bb78,_0xc8f4('0x27'));_0x4a25da[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x1b70bc[_0xc8f4('0x2d')]);_0x4a25da[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x4a25da['model'],_0x4a25da[_0xc8f4('0x2d')]);_0x385e41[_0xc8f4('0x31')]=_[_0xc8f4('0x30')](_0x4a25da['model'],qs[_0xc8f4('0x32')](_0x1b70bc[_0xc8f4('0x2d')]['fields']));_0x385e41[_0xc8f4('0x31')]=_0x385e41[_0xc8f4('0x31')][_0xc8f4('0x33')]?_0x385e41['attributes']:_0x4a25da[_0xc8f4('0x2c')];if(!_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x34')]('nolimit')){_0x385e41[_0xc8f4('0x1e')]=qs[_0xc8f4('0x1e')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1e')]);_0x385e41[_0xc8f4('0x1d')]=qs[_0xc8f4('0x1d')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1d')]);}_0x385e41[_0xc8f4('0x35')]=qs[_0xc8f4('0x36')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x36')]);_0x385e41[_0xc8f4('0x37')]=qs[_0xc8f4('0x2f')](_[_0xc8f4('0x38')](_0x1b70bc[_0xc8f4('0x2d')],_0x4a25da['filters']),_0x24bb78);if(_0x1b70bc[_0xc8f4('0x2d')]['filter']){_0x385e41[_0xc8f4('0x37')]=_['merge'](_0x385e41[_0xc8f4('0x37')],{'$or':_[_0xc8f4('0x2a')](_0x24bb78,function(_0x7ef69a){if(_0x7ef69a[_0xc8f4('0x39')]!==_0xc8f4('0x3a')){var _0x724060={};_0x724060[_0x7ef69a[_0xc8f4('0x27')]]={'$like':'%'+_0x1b70bc['query'][_0xc8f4('0x3b')]+'%'};return _0x724060;}})});}_0x385e41=_[_0xc8f4('0x3c')]({},_0x385e41,_0x1b70bc[_0xc8f4('0x3d')]);var _0x14ce2e={'where':_0x385e41['where']};return db[_0xc8f4('0x3e')][_0xc8f4('0x1c')](_0x14ce2e)[_0xc8f4('0x24')](function(_0x1d0b2d){_0x45f972[_0xc8f4('0x1c')]=_0x1d0b2d;if(_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x385e41[_0xc8f4('0x40')]=[{'all':!![]}];}return db[_0xc8f4('0x3e')][_0xc8f4('0x41')](_0x385e41);})[_0xc8f4('0x24')](function(_0xd56415){_0x45f972['rows']=_0xd56415;return _0x45f972;})[_0xc8f4('0x24')](respondWithFilteredResult(_0x24bef0,_0x385e41))[_0xc8f4('0x42')](handleError(_0x24bef0,null));};exports[_0xc8f4('0x43')]=function(_0x275f4a,_0x588ff9){var _0x49da16={'raw':!![],'where':{'id':_0x275f4a[_0xc8f4('0x44')]['id']}},_0x413a55={};_0x413a55['model']=_[_0xc8f4('0x2e')](db[_0xc8f4('0x3e')]['rawAttributes']);_0x413a55['query']=_[_0xc8f4('0x2e')](_0x275f4a[_0xc8f4('0x2d')]);_0x413a55[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x413a55[_0xc8f4('0x2c')],_0x413a55[_0xc8f4('0x2d')]);_0x49da16['attributes']=_['intersection'](_0x413a55[_0xc8f4('0x2c')],qs[_0xc8f4('0x32')](_0x275f4a[_0xc8f4('0x2d')]['fields']));_0x49da16['attributes']=_0x49da16['attributes']['length']?_0x49da16['attributes']:_0x413a55[_0xc8f4('0x2c')];if(_0x275f4a[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x49da16[_0xc8f4('0x40')]=[{'all':!![]}];}_0x49da16=_[_0xc8f4('0x3c')]({},_0x49da16,_0x275f4a[_0xc8f4('0x3d')]);return db['MailQueueReport'][_0xc8f4('0x45')](_0x49da16)[_0xc8f4('0x24')](handleEntityNotFound(_0x588ff9,null))['then'](respondWithResult(_0x588ff9,null))['catch'](handleError(_0x588ff9,null));};exports[_0xc8f4('0x46')]=function(_0x82a5e,_0x3ca0d6){return db[_0xc8f4('0x3e')]['create'](_0x82a5e['body'],{})[_0xc8f4('0x24')](respondWithResult(_0x3ca0d6,0xc9))[_0xc8f4('0x42')](handleError(_0x3ca0d6,null));};exports[_0xc8f4('0x47')]=function(_0x2bc4db,_0x141f81){if(_0x2bc4db[_0xc8f4('0x48')]['id']){delete _0x2bc4db['body']['id'];}return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x2bc4db[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x141f81,null))[_0xc8f4('0x24')](saveUpdates(_0x2bc4db[_0xc8f4('0x48')],null))[_0xc8f4('0x24')](respondWithResult(_0x141f81,null))[_0xc8f4('0x42')](handleError(_0x141f81,null));};exports[_0xc8f4('0x25')]=function(_0x3d9d67,_0x5b4035){return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x3d9d67[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x5b4035,null))[_0xc8f4('0x24')](removeEntity(_0x5b4035,null))[_0xc8f4('0x42')](handleError(_0x5b4035,null));};exports[_0xc8f4('0x49')]=function(_0x4715f3,_0x36c304){return db[_0xc8f4('0x3e')][_0xc8f4('0x49')]()[_0xc8f4('0x24')](respondWithResult(_0x36c304,null))[_0xc8f4('0x42')](handleError(_0x36c304,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 21408b0..e28cbe7 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 _0x35c8=['report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x35c8,0x152));var _0x835c=function(_0x18fb3d,_0x1e9f9d){_0x18fb3d=_0x18fb3d-0x0;var _0x3f4616=_0x35c8[_0x18fb3d];return _0x3f4616;};'use strict';var _=require('lodash');var util=require(_0x835c('0x0'));var logger=require(_0x835c('0x1'))(_0x835c('0x2'));var moment=require(_0x835c('0x3'));var BPromise=require(_0x835c('0x4'));var rp=require(_0x835c('0x5'));var fs=require('fs');var path=require(_0x835c('0x6'));var rimraf=require(_0x835c('0x7'));var config=require(_0x835c('0x8'));var attributes=require(_0x835c('0x9'));module[_0x835c('0xa')]=function(_0x2dc1e3,_0x3e5052){return _0x2dc1e3[_0x835c('0xb')]('MailQueueReport',attributes,{'tableName':_0x835c('0xc'),'paranoid':![],'indexes':[{'name':_0x835c('0xd'),'fields':[_0x835c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd85e=['api','rimraf','../../config/environment','define','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd85e,0x72));var _0xed85=function(_0xd24c64,_0x1b9d64){_0xd24c64=_0xd24c64-0x0;var _0x2fdace=_0xd85e[_0xd24c64];return _0x2fdace;};'use strict';var _=require(_0xed85('0x0'));var util=require(_0xed85('0x1'));var logger=require(_0xed85('0x2'))(_0xed85('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed85('0x4'));var config=require(_0xed85('0x5'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x495774,_0x26e566){return _0x495774[_0xed85('0x6')]('MailQueueReport',attributes,{'tableName':_0xed85('0x7'),'paranoid':![],'indexes':[{'name':_0xed85('0x8'),'fields':[_0xed85('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 19d8451..4a7edab 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 _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(_0x2554a2,_0x4b1e82){var _0x408846=function(_0xa161ab){while(--_0xa161ab){_0x2554a2['push'](_0x2554a2['shift']());}};_0x408846(++_0x4b1e82);}(_0x1261,0x144));var _0x1126=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x1261[_0x4147ff];return _0x1e71e6;};'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 +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x406e7e,_0x380eb3){var _0xb3960a=function(_0x377598){while(--_0x377598){_0x406e7e['push'](_0x406e7e['shift']());}};_0xb3960a(++_0x380eb3);}(_0x7a54,0x106));var _0x47a5=function(_0x5d96a4,_0x4f66f5){_0x5d96a4=_0x5d96a4-0x0;var _0x3487da=_0x7a54[_0x5d96a4];return _0x3487da;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 52617c9..18aec45 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1b0e66,_0x552dce){var _0x43f2a8=function(_0x3b0bae){while(--_0x3b0bae){_0x1b0e66['push'](_0x1b0e66['shift']());}};_0x43f2a8(++_0x552dce);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x26042f,_0x4cf1f1){var _0x10a8bf=function(_0x5ac0d6){while(--_0x5ac0d6){_0x26042f['push'](_0x26042f['shift']());}};_0x10a8bf(++_0x4cf1f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3812d34..8988c17 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 _0xd19f=['exports','STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x559175,_0x5ca900){var _0x37fcfc=function(_0x13c823){while(--_0x13c823){_0x559175['push'](_0x559175['shift']());}};_0x37fcfc(++_0x5ca900);}(_0xd19f,0x161));var _0xfd19=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xd19f[_0x23be51];return _0x47a26d;};'use strict';var Sequelize=require(_0xfd19('0x0'));module[_0xfd19('0x1')]={'description':{'type':Sequelize[_0xfd19('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xfd19('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xfd19('0x2')]},'password':{'type':Sequelize[_0xfd19('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xfd19('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xfd19('0x2')],'defaultValue':_0xfd19('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfd19('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xfd19('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x503d=['INBOX','exports','STRING','BOOLEAN','INTEGER'];(function(_0x48c03c,_0x3a0d41){var _0x33b898=function(_0x1d5f1a){while(--_0x1d5f1a){_0x48c03c['push'](_0x48c03c['shift']());}};_0x33b898(++_0x3a0d41);}(_0x503d,0x1d2));var _0xd503=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x503d[_0x1d80be];return _0xf9a4f3;};'use strict';var Sequelize=require('sequelize');module[_0xd503('0x0')]={'description':{'type':Sequelize[_0xd503('0x1')]},'host':{'type':Sequelize[_0xd503('0x1')]},'authentication':{'type':Sequelize[_0xd503('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd503('0x1')]},'password':{'type':Sequelize[_0xd503('0x1')]},'port':{'type':Sequelize[_0xd503('0x3')]},'tls':{'type':Sequelize[_0xd503('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd503('0x1')],'defaultValue':_0xd503('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xd503('0x1')]},'modernAuthentication':{'type':Sequelize[_0xd503('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index cc1a5a3..6ba27fa 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 _0xc61d=['api','moment','request-promise','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0x1ed511,_0x5bd8f0){var _0x32ab7b=function(_0x46066e){while(--_0x46066e){_0x1ed511['push'](_0x1ed511['shift']());}};_0x32ab7b(++_0x5bd8f0);}(_0xc61d,0x174));var _0xdc61=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xc61d[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require('lodash');var util=require(_0xdc61('0x0'));var logger=require(_0xdc61('0x1'))(_0xdc61('0x2'));var moment=require(_0xdc61('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc61('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc61('0x5'));var config=require(_0xdc61('0x6'));var attributes=require('./mailServerIn.attributes');module[_0xdc61('0x7')]=function(_0x5ae94e,_0x4d377f){return _0x5ae94e[_0xdc61('0x8')](_0xdc61('0x9'),attributes,{'tableName':_0xdc61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1def=['./mailServerIn.attributes','exports','MailServerIn','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5b21c9,_0x4352ef){var _0x241785=function(_0x407bc2){while(--_0x407bc2){_0x5b21c9['push'](_0x5b21c9['shift']());}};_0x241785(++_0x4352ef);}(_0x1def,0xea));var _0xf1de=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x1def[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xf1de('0x0'));var util=require(_0xf1de('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf1de('0x2'));var BPromise=require(_0xf1de('0x3'));var rp=require(_0xf1de('0x4'));var fs=require('fs');var path=require(_0xf1de('0x5'));var rimraf=require(_0xf1de('0x6'));var config=require(_0xf1de('0x7'));var attributes=require(_0xf1de('0x8'));module[_0xf1de('0x9')]=function(_0x51f225,_0x429625){return _0x51f225['define'](_0xf1de('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 4544eef..9db9935 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 _0x1177=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','model','map','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1177,0x10b));var _0x7117=function(_0x2d40a8,_0x4f1de0){_0x2d40a8=_0x2d40a8-0x0;var _0xe4ebc2=_0x1177[_0x2d40a8];return _0xe4ebc2;};'use strict';var _=require('lodash');var util=require(_0x7117('0x0'));var moment=require(_0x7117('0x1'));var BPromise=require(_0x7117('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7117('0x3'));var db=require(_0x7117('0x4'))['db'];var utils=require(_0x7117('0x5'));var logger=require(_0x7117('0x6'))('rpc');var config=require(_0x7117('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7117('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52e86b,_0x1b61fc,_0xee2736){return new BPromise(function(_0x52dd5e,_0x4f945c){return client[_0x7117('0x9')](_0x52e86b,_0xee2736)[_0x7117('0xa')](function(_0x58ccc4){logger[_0x7117('0xb')](_0x7117('0xc'),_0x1b61fc,_0x7117('0xd'));logger[_0x7117('0xe')](_0x7117('0xf'),_0x1b61fc,_0x7117('0xd'),JSON[_0x7117('0x10')](_0x58ccc4));if(_0x58ccc4[_0x7117('0x11')]){if(_0x58ccc4[_0x7117('0x11')][_0x7117('0x12')]===0x1f4){logger[_0x7117('0x11')](_0x7117('0xc'),_0x1b61fc,_0x58ccc4[_0x7117('0x11')]['message']);return _0x4f945c(_0x58ccc4[_0x7117('0x11')][_0x7117('0x13')]);}logger[_0x7117('0x11')](_0x7117('0xc'),_0x1b61fc,_0x58ccc4[_0x7117('0x11')][_0x7117('0x13')]);return _0x52dd5e(_0x58ccc4[_0x7117('0x11')]['message']);}else{logger['info'](_0x7117('0xc'),_0x1b61fc,_0x7117('0xd'));_0x52dd5e(_0x58ccc4['result'][_0x7117('0x13')]);}})[_0x7117('0x14')](function(_0x3d0fed){logger[_0x7117('0x11')](_0x7117('0xc'),_0x1b61fc,_0x3d0fed);_0x4f945c(_0x3d0fed);});});}exports[_0x7117('0x15')]=function(_0x495698){var _0x2f8075=this;return new Promise(function(_0x4116a6,_0x24a1d2){return db[_0x7117('0x16')][_0x7117('0x17')]({'raw':_0x495698[_0x7117('0x18')]?_0x495698['options'][_0x7117('0x19')]===undefined?!![]:![]:!![],'where':_0x495698[_0x7117('0x18')]?_0x495698[_0x7117('0x18')][_0x7117('0x1a')]||null:null,'attributes':_0x495698['options']?_0x495698[_0x7117('0x18')][_0x7117('0x1b')]||null:null,'limit':_0x495698[_0x7117('0x18')]?_0x495698[_0x7117('0x18')]['limit']||null:null,'include':_0x495698[_0x7117('0x18')]?_0x495698['options'][_0x7117('0x1c')]?_['map'](_0x495698[_0x7117('0x18')][_0x7117('0x1c')],function(_0x10314a){return{'model':db[_0x10314a[_0x7117('0x1d')]],'as':_0x10314a['as'],'attributes':_0x10314a[_0x7117('0x1b')],'include':_0x10314a['include']?_[_0x7117('0x1e')](_0x10314a['include'],function(_0x2d2c9d){return{'model':db[_0x2d2c9d[_0x7117('0x1d')]],'as':_0x2d2c9d['as'],'attributes':_0x2d2c9d[_0x7117('0x1b')],'include':_0x2d2c9d[_0x7117('0x1c')]?_[_0x7117('0x1e')](_0x2d2c9d[_0x7117('0x1c')],function(_0x36b7e2){return{'model':db[_0x36b7e2['model']],'as':_0x36b7e2['as'],'attributes':_0x36b7e2[_0x7117('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cb686){logger[_0x7117('0xb')](_0x7117('0x15'),_0x495698);logger[_0x7117('0xe')](_0x7117('0x15'),_0x495698,JSON[_0x7117('0x10')](_0x5cb686));_0x4116a6(_0x5cb686);})[_0x7117('0x14')](function(_0x4413d8){logger['error'](_0x7117('0x15'),_0x4413d8['message'],_0x495698);_0x24a1d2(_0x2f8075[_0x7117('0x11')](0x1f4,_0x4413d8[_0x7117('0x13')]));});});}; \ No newline at end of file +var _0x64e6=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailServerIn,\x20%s,\x20%s','result','catch','MailServerIn','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x5a550c,_0x4b1bc0){var _0x5f2417=function(_0x4c8528){while(--_0x4c8528){_0x5a550c['push'](_0x5a550c['shift']());}};_0x5f2417(++_0x4b1bc0);}(_0x64e6,0xcd));var _0x664e=function(_0x3a7c01,_0x124350){_0x3a7c01=_0x3a7c01-0x0;var _0x456b4c=_0x64e6[_0x3a7c01];return _0x456b4c;};'use strict';var _=require('lodash');var util=require(_0x664e('0x0'));var moment=require(_0x664e('0x1'));var BPromise=require(_0x664e('0x2'));var rs=require(_0x664e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x664e('0x4'))['db'];var utils=require(_0x664e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x664e('0x6'));var client=jayson['client'][_0x664e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2de47a,_0x5c4010,_0xf90091){return new BPromise(function(_0x394ab7,_0xc2f480){return client[_0x664e('0x8')](_0x2de47a,_0xf90091)[_0x664e('0x9')](function(_0x2f9fcb){logger['info']('MailServerIn,\x20%s,\x20%s',_0x5c4010,_0x664e('0xa'));logger[_0x664e('0xb')](_0x664e('0xc'),_0x5c4010,_0x664e('0xa'),JSON[_0x664e('0xd')](_0x2f9fcb));if(_0x2f9fcb[_0x664e('0xe')]){if(_0x2f9fcb['error'][_0x664e('0xf')]===0x1f4){logger[_0x664e('0xe')]('MailServerIn,\x20%s,\x20%s',_0x5c4010,_0x2f9fcb[_0x664e('0xe')]['message']);return _0xc2f480(_0x2f9fcb[_0x664e('0xe')][_0x664e('0x10')]);}logger[_0x664e('0xe')]('MailServerIn,\x20%s,\x20%s',_0x5c4010,_0x2f9fcb[_0x664e('0xe')]['message']);return _0x394ab7(_0x2f9fcb[_0x664e('0xe')][_0x664e('0x10')]);}else{logger[_0x664e('0x11')](_0x664e('0x12'),_0x5c4010,_0x664e('0xa'));_0x394ab7(_0x2f9fcb[_0x664e('0x13')][_0x664e('0x10')]);}})[_0x664e('0x14')](function(_0x55c63c){logger[_0x664e('0xe')](_0x664e('0x12'),_0x5c4010,_0x55c63c);_0xc2f480(_0x55c63c);});});}exports['GetMailServerIn']=function(_0x3e55cc){var _0x4d950e=this;return new Promise(function(_0x2766f0,_0x1b2c3f){return db[_0x664e('0x15')][_0x664e('0x16')]({'raw':_0x3e55cc[_0x664e('0x17')]?_0x3e55cc['options'][_0x664e('0x18')]===undefined?!![]:![]:!![],'where':_0x3e55cc[_0x664e('0x17')]?_0x3e55cc['options'][_0x664e('0x19')]||null:null,'attributes':_0x3e55cc['options']?_0x3e55cc[_0x664e('0x17')][_0x664e('0x1a')]||null:null,'limit':_0x3e55cc[_0x664e('0x17')]?_0x3e55cc[_0x664e('0x17')]['limit']||null:null,'include':_0x3e55cc[_0x664e('0x17')]?_0x3e55cc[_0x664e('0x17')][_0x664e('0x1b')]?_[_0x664e('0x1c')](_0x3e55cc[_0x664e('0x17')]['include'],function(_0x411ed8){return{'model':db[_0x411ed8[_0x664e('0x1d')]],'as':_0x411ed8['as'],'attributes':_0x411ed8[_0x664e('0x1a')],'include':_0x411ed8[_0x664e('0x1b')]?_[_0x664e('0x1c')](_0x411ed8[_0x664e('0x1b')],function(_0x540a60){return{'model':db[_0x540a60[_0x664e('0x1d')]],'as':_0x540a60['as'],'attributes':_0x540a60[_0x664e('0x1a')],'include':_0x540a60[_0x664e('0x1b')]?_[_0x664e('0x1c')](_0x540a60[_0x664e('0x1b')],function(_0x58c1b1){return{'model':db[_0x58c1b1[_0x664e('0x1d')]],'as':_0x58c1b1['as'],'attributes':_0x58c1b1[_0x664e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x312d43){logger['info']('GetMailServerIn',_0x3e55cc);logger[_0x664e('0xb')](_0x664e('0x1e'),_0x3e55cc,JSON[_0x664e('0xd')](_0x312d43));_0x2766f0(_0x312d43);})['catch'](function(_0xa86fd0){logger[_0x664e('0xe')]('GetMailServerIn',_0xa86fd0[_0x664e('0x10')],_0x3e55cc);_0x1b2c3f(_0x4d950e['error'](0x1f4,_0xa86fd0[_0x664e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index fe1b272..7f152d2 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(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7a54,0x106));var _0x47a5=function(_0x49d196,_0x2c553d){_0x49d196=_0x49d196-0x0;var _0x1d065c=_0x7a54[_0x49d196];return _0x1d065c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7a54,0x106));var _0x47a5=function(_0x434eaa,_0x77f1b5){_0x434eaa=_0x434eaa-0x0;var _0x1d920a=_0x7a54[_0x434eaa];return _0x1d920a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 7f9b00b..69d4310 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 _0x7916=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x7916,0x128));var _0x6791=function(_0x20f8e8,_0x3c692c){_0x20f8e8=_0x20f8e8-0x0;var _0x313033=_0x7916[_0x20f8e8];return _0x313033;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'description':{'type':Sequelize[_0x6791('0x1')]},'host':{'type':Sequelize[_0x6791('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x6791('0x1')]},'port':{'type':Sequelize[_0x6791('0x2')]},'secure':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x6791('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe2cf=['BOOLEAN','exports','STRING','INTEGER'];(function(_0xcbdf64,_0x415908){var _0x3bd2ac=function(_0x32d221){while(--_0x32d221){_0xcbdf64['push'](_0xcbdf64['shift']());}};_0x3bd2ac(++_0x415908);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x19a490,_0x4627d9){_0x19a490=_0x19a490-0x0;var _0x52081c=_0xe2cf[_0x19a490];return _0x52081c;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfe2c('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfe2c('0x1')]},'port':{'type':Sequelize[_0xfe2c('0x2')]},'secure':{'type':Sequelize[_0xfe2c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xfe2c('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfe2c('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 e467512..012d061 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 _0xfe56=['stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','MailServerOut','includeAll','include','rows','show','params','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfe56,0x1e3));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x6fe5('0x0'));var rimraf=require(_0x6fe5('0x1'));var zipdir=require(_0x6fe5('0x2'));var jsonpatch=require(_0x6fe5('0x3'));var rp=require(_0x6fe5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6fe5('0x5'));var util=require(_0x6fe5('0x6'));var path=require(_0x6fe5('0x7'));var sox=require(_0x6fe5('0x8'));var csv=require(_0x6fe5('0x9'));var ejs=require(_0x6fe5('0xa'));var fs=require('fs');var fs_extra=require(_0x6fe5('0xb'));var _=require(_0x6fe5('0xc'));var squel=require(_0x6fe5('0xd'));var crypto=require(_0x6fe5('0xe'));var jsforce=require(_0x6fe5('0xf'));var deskjs=require(_0x6fe5('0x10'));var toCsv=require(_0x6fe5('0x9'));var querystring=require(_0x6fe5('0x11'));var Papa=require('papaparse');var Redis=require(_0x6fe5('0x12'));var authService=require(_0x6fe5('0x13'));var qs=require(_0x6fe5('0x14'));var as=require(_0x6fe5('0x15'));var hardwareService=require(_0x6fe5('0x16'));var logger=require('../../config/logger')(_0x6fe5('0x17'));var utils=require(_0x6fe5('0x18'));var config=require(_0x6fe5('0x19'));var licenseUtil=require(_0x6fe5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cbd76,_0x425f7f){_0x425f7f=_0x425f7f||0xcc;return function(_0x11b405){if(_0x11b405){return _0x1cbd76[_0x6fe5('0x1b')](_0x425f7f);}return _0x1cbd76[_0x6fe5('0x1c')](_0x425f7f)[_0x6fe5('0x1d')]();};}function respondWithResult(_0x2bf07f,_0x368fdf){_0x368fdf=_0x368fdf||0xc8;return function(_0x221592){if(_0x221592){return _0x2bf07f[_0x6fe5('0x1c')](_0x368fdf)[_0x6fe5('0x1e')](_0x221592);}};}function respondWithFilteredResult(_0x3c7205,_0x164e86){return function(_0x52fd06){if(_0x52fd06){var _0xb7971b=typeof _0x164e86[_0x6fe5('0x1f')]===_0x6fe5('0x20')&&typeof _0x164e86['limit']===_0x6fe5('0x20');var _0x565f6c=_0x52fd06[_0x6fe5('0x21')];var _0x1494df=_0xb7971b?0x0:_0x164e86[_0x6fe5('0x1f')];var _0x56dffb=_0xb7971b?_0x52fd06['count']:_0x164e86[_0x6fe5('0x1f')]+_0x164e86[_0x6fe5('0x22')];var _0x29ea3a;if(_0x56dffb>=_0x565f6c){_0x56dffb=_0x565f6c;_0x29ea3a=0xc8;}else{_0x29ea3a=0xce;}_0x3c7205['status'](_0x29ea3a);return _0x3c7205[_0x6fe5('0x23')](_0x6fe5('0x24'),_0x1494df+'-'+_0x56dffb+'/'+_0x565f6c)[_0x6fe5('0x1e')](_0x52fd06);}return null;};}function patchUpdates(_0x26bdce){return function(_0x1063b0){try{jsonpatch['apply'](_0x1063b0,_0x26bdce,!![]);}catch(_0x48f3e8){return BPromise[_0x6fe5('0x25')](_0x48f3e8);}return _0x1063b0[_0x6fe5('0x26')]();};}function saveUpdates(_0x1225e6,_0x3f55ad){return function(_0x30e212){if(_0x30e212){return _0x30e212[_0x6fe5('0x27')](_0x1225e6)[_0x6fe5('0x28')](function(_0x2b30c8){return _0x2b30c8;});}return null;};}function removeEntity(_0x58f27b,_0x50ffff){return function(_0x193efe){if(_0x193efe){return _0x193efe[_0x6fe5('0x29')]()[_0x6fe5('0x28')](function(){_0x58f27b['status'](0xcc)[_0x6fe5('0x1d')]();});}};}function handleEntityNotFound(_0x4417bc,_0x1ea023){return function(_0x258a38){if(!_0x258a38){_0x4417bc[_0x6fe5('0x1b')](0x194);}return _0x258a38;};}function handleError(_0x2687f8,_0x5b6915){_0x5b6915=_0x5b6915||0x1f4;return function(_0x3ccd71){logger['error'](_0x3ccd71[_0x6fe5('0x2a')]);if(_0x3ccd71[_0x6fe5('0x2b')]){delete _0x3ccd71['name'];}_0x2687f8[_0x6fe5('0x1c')](_0x5b6915)[_0x6fe5('0x2c')](_0x3ccd71);};}exports[_0x6fe5('0x2d')]=function(_0x2c8b09,_0x4cc5a2){var _0x3a5101={},_0x34c76b={},_0x47a781={'count':0x0,'rows':[]};var _0xc3bd82=_[_0x6fe5('0x2e')](db['MailServerOut'][_0x6fe5('0x2f')],function(_0x3bd93c){return{'name':_0x3bd93c['fieldName'],'type':_0x3bd93c[_0x6fe5('0x30')]['key']};});_0x34c76b['model']=_['map'](_0xc3bd82,_0x6fe5('0x2b'));_0x34c76b[_0x6fe5('0x31')]=_[_0x6fe5('0x32')](_0x2c8b09['query']);_0x34c76b[_0x6fe5('0x33')]=_[_0x6fe5('0x34')](_0x34c76b[_0x6fe5('0x35')],_0x34c76b[_0x6fe5('0x31')]);_0x3a5101['attributes']=_[_0x6fe5('0x34')](_0x34c76b[_0x6fe5('0x35')],qs[_0x6fe5('0x36')](_0x2c8b09['query'][_0x6fe5('0x36')]));_0x3a5101[_0x6fe5('0x37')]=_0x3a5101[_0x6fe5('0x37')]['length']?_0x3a5101[_0x6fe5('0x37')]:_0x34c76b['model'];if(!_0x2c8b09['query'][_0x6fe5('0x38')](_0x6fe5('0x39'))){_0x3a5101[_0x6fe5('0x22')]=qs[_0x6fe5('0x22')](_0x2c8b09[_0x6fe5('0x31')][_0x6fe5('0x22')]);_0x3a5101['offset']=qs[_0x6fe5('0x1f')](_0x2c8b09[_0x6fe5('0x31')][_0x6fe5('0x1f')]);}_0x3a5101['order']=qs[_0x6fe5('0x3a')](_0x2c8b09[_0x6fe5('0x31')][_0x6fe5('0x3a')]);_0x3a5101[_0x6fe5('0x3b')]=qs[_0x6fe5('0x33')](_[_0x6fe5('0x3c')](_0x2c8b09[_0x6fe5('0x31')],_0x34c76b['filters']),_0xc3bd82);if(_0x2c8b09[_0x6fe5('0x31')][_0x6fe5('0x3d')]){_0x3a5101[_0x6fe5('0x3b')]=_[_0x6fe5('0x3e')](_0x3a5101['where'],{'$or':_[_0x6fe5('0x2e')](_0xc3bd82,function(_0x1df235){if(_0x1df235[_0x6fe5('0x30')]!==_0x6fe5('0x3f')){var _0x5b2d99={};_0x5b2d99[_0x1df235[_0x6fe5('0x2b')]]={'$like':'%'+_0x2c8b09['query'][_0x6fe5('0x3d')]+'%'};return _0x5b2d99;}})});}_0x3a5101=_['merge']({},_0x3a5101,_0x2c8b09['options']);var _0x14c854={'where':_0x3a5101[_0x6fe5('0x3b')]};return db[_0x6fe5('0x40')][_0x6fe5('0x21')](_0x14c854)[_0x6fe5('0x28')](function(_0x172450){_0x47a781[_0x6fe5('0x21')]=_0x172450;if(_0x2c8b09[_0x6fe5('0x31')][_0x6fe5('0x41')]){_0x3a5101[_0x6fe5('0x42')]=[{'all':!![]}];}return db[_0x6fe5('0x40')]['findAll'](_0x3a5101);})[_0x6fe5('0x28')](function(_0x1300fc){_0x47a781[_0x6fe5('0x43')]=_0x1300fc;return _0x47a781;})[_0x6fe5('0x28')](respondWithFilteredResult(_0x4cc5a2,_0x3a5101))['catch'](handleError(_0x4cc5a2,null));};exports[_0x6fe5('0x44')]=function(_0x3ce818,_0x29555b){var _0x52735d={'raw':!![],'where':{'id':_0x3ce818[_0x6fe5('0x45')]['id']}},_0xe1d55c={};_0xe1d55c[_0x6fe5('0x35')]=_[_0x6fe5('0x32')](db[_0x6fe5('0x40')][_0x6fe5('0x2f')]);_0xe1d55c[_0x6fe5('0x31')]=_[_0x6fe5('0x32')](_0x3ce818[_0x6fe5('0x31')]);_0xe1d55c[_0x6fe5('0x33')]=_[_0x6fe5('0x34')](_0xe1d55c[_0x6fe5('0x35')],_0xe1d55c[_0x6fe5('0x31')]);_0x52735d[_0x6fe5('0x37')]=_[_0x6fe5('0x34')](_0xe1d55c[_0x6fe5('0x35')],qs['fields'](_0x3ce818[_0x6fe5('0x31')][_0x6fe5('0x36')]));_0x52735d[_0x6fe5('0x37')]=_0x52735d[_0x6fe5('0x37')]['length']?_0x52735d[_0x6fe5('0x37')]:_0xe1d55c[_0x6fe5('0x35')];if(_0x3ce818[_0x6fe5('0x31')][_0x6fe5('0x41')]){_0x52735d[_0x6fe5('0x42')]=[{'all':!![]}];}_0x52735d=_[_0x6fe5('0x3e')]({},_0x52735d,_0x3ce818[_0x6fe5('0x46')]);return db[_0x6fe5('0x40')]['find'](_0x52735d)['then'](handleEntityNotFound(_0x29555b,null))['then'](respondWithResult(_0x29555b,null))[_0x6fe5('0x47')](handleError(_0x29555b,null));};exports[_0x6fe5('0x48')]=function(_0x2b5454,_0x38071a){return db[_0x6fe5('0x40')][_0x6fe5('0x48')](_0x2b5454[_0x6fe5('0x49')],{})[_0x6fe5('0x28')](respondWithResult(_0x38071a,0xc9))['catch'](handleError(_0x38071a,null));};exports[_0x6fe5('0x27')]=function(_0x4dc7b3,_0x5e6c8f){if(_0x4dc7b3[_0x6fe5('0x49')]['id']){delete _0x4dc7b3['body']['id'];}return db[_0x6fe5('0x40')][_0x6fe5('0x4a')]({'where':{'id':_0x4dc7b3['params']['id']}})[_0x6fe5('0x28')](handleEntityNotFound(_0x5e6c8f,null))[_0x6fe5('0x28')](saveUpdates(_0x4dc7b3[_0x6fe5('0x49')],null))[_0x6fe5('0x28')](respondWithResult(_0x5e6c8f,null))['catch'](handleError(_0x5e6c8f,null));};exports[_0x6fe5('0x29')]=function(_0x135a51,_0x4264b2){return db[_0x6fe5('0x40')][_0x6fe5('0x4a')]({'where':{'id':_0x135a51[_0x6fe5('0x45')]['id']}})[_0x6fe5('0x28')](handleEntityNotFound(_0x4264b2,null))[_0x6fe5('0x28')](removeEntity(_0x4264b2,null))[_0x6fe5('0x47')](handleError(_0x4264b2,null));}; \ No newline at end of file +var _0x1747=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','MailServerOut','findAll','rows','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x40b483,_0xd53b77){var _0x4406e6=function(_0x6175da){while(--_0x6175da){_0x40b483['push'](_0x40b483['shift']());}};_0x4406e6(++_0xd53b77);}(_0x1747,0x7b));var _0x7174=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1747[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0x7174('0x0'));var rimraf=require(_0x7174('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7174('0x2'));var rp=require('request-promise');var moment=require(_0x7174('0x3'));var BPromise=require(_0x7174('0x4'));var Mustache=require('mustache');var util=require(_0x7174('0x5'));var path=require(_0x7174('0x6'));var sox=require(_0x7174('0x7'));var csv=require(_0x7174('0x8'));var ejs=require(_0x7174('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7174('0xa'));var squel=require(_0x7174('0xb'));var crypto=require(_0x7174('0xc'));var jsforce=require(_0x7174('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7174('0x8'));var querystring=require(_0x7174('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7174('0xf'));var qs=require(_0x7174('0x10'));var as=require(_0x7174('0x11'));var hardwareService=require(_0x7174('0x12'));var logger=require('../../config/logger')(_0x7174('0x13'));var utils=require(_0x7174('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7174('0x15'));var db=require(_0x7174('0x16'))['db'];function respondWithStatusCode(_0x27c7ba,_0x327ae4){_0x327ae4=_0x327ae4||0xcc;return function(_0x1da85a){if(_0x1da85a){return _0x27c7ba[_0x7174('0x17')](_0x327ae4);}return _0x27c7ba[_0x7174('0x18')](_0x327ae4)[_0x7174('0x19')]();};}function respondWithResult(_0x34d080,_0x86b179){_0x86b179=_0x86b179||0xc8;return function(_0x4c0c99){if(_0x4c0c99){return _0x34d080['status'](_0x86b179)[_0x7174('0x1a')](_0x4c0c99);}};}function respondWithFilteredResult(_0x2d33bd,_0x48a2c8){return function(_0x5437c0){if(_0x5437c0){var _0x577187=typeof _0x48a2c8[_0x7174('0x1b')]===_0x7174('0x1c')&&typeof _0x48a2c8[_0x7174('0x1d')]===_0x7174('0x1c');var _0x5ecf5a=_0x5437c0[_0x7174('0x1e')];var _0x9e6c2d=_0x577187?0x0:_0x48a2c8[_0x7174('0x1b')];var _0x11a785=_0x577187?_0x5437c0[_0x7174('0x1e')]:_0x48a2c8[_0x7174('0x1b')]+_0x48a2c8['limit'];var _0x513396;if(_0x11a785>=_0x5ecf5a){_0x11a785=_0x5ecf5a;_0x513396=0xc8;}else{_0x513396=0xce;}_0x2d33bd['status'](_0x513396);return _0x2d33bd[_0x7174('0x1f')](_0x7174('0x20'),_0x9e6c2d+'-'+_0x11a785+'/'+_0x5ecf5a)[_0x7174('0x1a')](_0x5437c0);}return null;};}function patchUpdates(_0x4f6dbf){return function(_0x4ed2c0){try{jsonpatch[_0x7174('0x21')](_0x4ed2c0,_0x4f6dbf,!![]);}catch(_0x234570){return BPromise[_0x7174('0x22')](_0x234570);}return _0x4ed2c0[_0x7174('0x23')]();};}function saveUpdates(_0x564190,_0x83a932){return function(_0x47569c){if(_0x47569c){return _0x47569c[_0x7174('0x24')](_0x564190)['then'](function(_0x1ba67b){return _0x1ba67b;});}return null;};}function removeEntity(_0x4bc46a,_0x116470){return function(_0x38b038){if(_0x38b038){return _0x38b038[_0x7174('0x25')]()[_0x7174('0x26')](function(){_0x4bc46a[_0x7174('0x18')](0xcc)[_0x7174('0x19')]();});}};}function handleEntityNotFound(_0x1c1656,_0x698169){return function(_0x3f5526){if(!_0x3f5526){_0x1c1656['sendStatus'](0x194);}return _0x3f5526;};}function handleError(_0x4920d0,_0x5ea8ff){_0x5ea8ff=_0x5ea8ff||0x1f4;return function(_0x2c74b2){logger[_0x7174('0x27')](_0x2c74b2[_0x7174('0x28')]);if(_0x2c74b2['name']){delete _0x2c74b2[_0x7174('0x29')];}_0x4920d0[_0x7174('0x18')](_0x5ea8ff)['send'](_0x2c74b2);};}exports[_0x7174('0x2a')]=function(_0x288f4c,_0x4cce8d){var _0x179229={},_0x50683a={},_0x12e27b={'count':0x0,'rows':[]};var _0x8e312f=_[_0x7174('0x2b')](db['MailServerOut']['rawAttributes'],function(_0x191afb){return{'name':_0x191afb['fieldName'],'type':_0x191afb[_0x7174('0x2c')]['key']};});_0x50683a[_0x7174('0x2d')]=_[_0x7174('0x2b')](_0x8e312f,_0x7174('0x29'));_0x50683a[_0x7174('0x2e')]=_['keys'](_0x288f4c['query']);_0x50683a[_0x7174('0x2f')]=_[_0x7174('0x30')](_0x50683a['model'],_0x50683a[_0x7174('0x2e')]);_0x179229[_0x7174('0x31')]=_[_0x7174('0x30')](_0x50683a[_0x7174('0x2d')],qs[_0x7174('0x32')](_0x288f4c[_0x7174('0x2e')][_0x7174('0x32')]));_0x179229[_0x7174('0x31')]=_0x179229[_0x7174('0x31')][_0x7174('0x33')]?_0x179229[_0x7174('0x31')]:_0x50683a[_0x7174('0x2d')];if(!_0x288f4c[_0x7174('0x2e')]['hasOwnProperty'](_0x7174('0x34'))){_0x179229[_0x7174('0x1d')]=qs['limit'](_0x288f4c[_0x7174('0x2e')][_0x7174('0x1d')]);_0x179229['offset']=qs[_0x7174('0x1b')](_0x288f4c['query'][_0x7174('0x1b')]);}_0x179229['order']=qs[_0x7174('0x35')](_0x288f4c[_0x7174('0x2e')]['sort']);_0x179229[_0x7174('0x36')]=qs[_0x7174('0x2f')](_[_0x7174('0x37')](_0x288f4c[_0x7174('0x2e')],_0x50683a[_0x7174('0x2f')]),_0x8e312f);if(_0x288f4c[_0x7174('0x2e')]['filter']){_0x179229[_0x7174('0x36')]=_['merge'](_0x179229[_0x7174('0x36')],{'$or':_[_0x7174('0x2b')](_0x8e312f,function(_0x374140){if(_0x374140[_0x7174('0x2c')]!==_0x7174('0x38')){var _0x465f30={};_0x465f30[_0x374140['name']]={'$like':'%'+_0x288f4c['query'][_0x7174('0x39')]+'%'};return _0x465f30;}})});}_0x179229=_['merge']({},_0x179229,_0x288f4c[_0x7174('0x3a')]);var _0x16b3b1={'where':_0x179229[_0x7174('0x36')]};return db['MailServerOut'][_0x7174('0x1e')](_0x16b3b1)[_0x7174('0x26')](function(_0x16e485){_0x12e27b[_0x7174('0x1e')]=_0x16e485;if(_0x288f4c['query'][_0x7174('0x3b')]){_0x179229[_0x7174('0x3c')]=[{'all':!![]}];}return db[_0x7174('0x3d')][_0x7174('0x3e')](_0x179229);})['then'](function(_0x4c9740){_0x12e27b[_0x7174('0x3f')]=_0x4c9740;return _0x12e27b;})['then'](respondWithFilteredResult(_0x4cce8d,_0x179229))['catch'](handleError(_0x4cce8d,null));};exports[_0x7174('0x40')]=function(_0x20fd66,_0x148881){var _0x552198={'raw':!![],'where':{'id':_0x20fd66[_0x7174('0x41')]['id']}},_0x2ac546={};_0x2ac546[_0x7174('0x2d')]=_['keys'](db[_0x7174('0x3d')][_0x7174('0x42')]);_0x2ac546[_0x7174('0x2e')]=_['keys'](_0x20fd66[_0x7174('0x2e')]);_0x2ac546[_0x7174('0x2f')]=_[_0x7174('0x30')](_0x2ac546[_0x7174('0x2d')],_0x2ac546['query']);_0x552198[_0x7174('0x31')]=_[_0x7174('0x30')](_0x2ac546[_0x7174('0x2d')],qs['fields'](_0x20fd66['query'][_0x7174('0x32')]));_0x552198[_0x7174('0x31')]=_0x552198[_0x7174('0x31')][_0x7174('0x33')]?_0x552198[_0x7174('0x31')]:_0x2ac546['model'];if(_0x20fd66[_0x7174('0x2e')][_0x7174('0x3b')]){_0x552198['include']=[{'all':!![]}];}_0x552198=_['merge']({},_0x552198,_0x20fd66['options']);return db[_0x7174('0x3d')][_0x7174('0x43')](_0x552198)[_0x7174('0x26')](handleEntityNotFound(_0x148881,null))[_0x7174('0x26')](respondWithResult(_0x148881,null))[_0x7174('0x44')](handleError(_0x148881,null));};exports[_0x7174('0x45')]=function(_0x24ba24,_0x28be39){return db[_0x7174('0x3d')][_0x7174('0x45')](_0x24ba24['body'],{})[_0x7174('0x26')](respondWithResult(_0x28be39,0xc9))[_0x7174('0x44')](handleError(_0x28be39,null));};exports[_0x7174('0x24')]=function(_0x155aea,_0x192431){if(_0x155aea[_0x7174('0x46')]['id']){delete _0x155aea['body']['id'];}return db[_0x7174('0x3d')][_0x7174('0x43')]({'where':{'id':_0x155aea[_0x7174('0x41')]['id']}})[_0x7174('0x26')](handleEntityNotFound(_0x192431,null))['then'](saveUpdates(_0x155aea[_0x7174('0x46')],null))['then'](respondWithResult(_0x192431,null))['catch'](handleError(_0x192431,null));};exports[_0x7174('0x25')]=function(_0x271355,_0x3202d3){return db[_0x7174('0x3d')]['find']({'where':{'id':_0x271355[_0x7174('0x41')]['id']}})[_0x7174('0x26')](handleEntityNotFound(_0x3202d3,null))[_0x7174('0x26')](removeEntity(_0x3202d3,null))[_0x7174('0x44')](handleError(_0x3202d3,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 5275fb6..3d771ba 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 _0x800c=['../../config/environment','./mailServerOut.attributes','define','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x800c,0xdb));var _0xc800=function(_0x54fc4c,_0x3861a8){_0x54fc4c=_0x54fc4c-0x0;var _0x9d8d9c=_0x800c[_0x54fc4c];return _0x9d8d9c;};'use strict';var _=require('lodash');var util=require(_0xc800('0x0'));var logger=require('../../config/logger')(_0xc800('0x1'));var moment=require(_0xc800('0x2'));var BPromise=require(_0xc800('0x3'));var rp=require(_0xc800('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc800('0x5'));var config=require(_0xc800('0x6'));var attributes=require(_0xc800('0x7'));module['exports']=function(_0x3c9505,_0x2caea2){return _0x3c9505[_0xc800('0x8')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6caa=['define','MailServerOut','mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x2c6749,_0x4fb7ba){var _0x4933df=function(_0x368b41){while(--_0x368b41){_0x2c6749['push'](_0x2c6749['shift']());}};_0x4933df(++_0x4fb7ba);}(_0x6caa,0x87));var _0xa6ca=function(_0x538231,_0x2fce66){_0x538231=_0x538231-0x0;var _0x3a2bcd=_0x6caa[_0x538231];return _0x3a2bcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa6ca('0x0'))(_0xa6ca('0x1'));var moment=require(_0xa6ca('0x2'));var BPromise=require(_0xa6ca('0x3'));var rp=require(_0xa6ca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa6ca('0x5'));var attributes=require(_0xa6ca('0x6'));module[_0xa6ca('0x7')]=function(_0x166531,_0x11051e){return _0x166531[_0xa6ca('0x8')](_0xa6ca('0x9'),attributes,{'tableName':_0xa6ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2462032..296d906 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x332775,_0x54ffac){var _0x694662=function(_0x1da11c){while(--_0x1da11c){_0x332775['push'](_0x332775['shift']());}};_0x694662(++_0x54ffac);}(_0xdb28,0x106));var _0x8db2=function(_0x32dcee,_0x4440d4){_0x32dcee=_0x32dcee-0x0;var _0x1a6523=_0xdb28[_0x32dcee];return _0x1a6523;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3ff52b,_0xcd6532){var _0x269857=function(_0x545b34){while(--_0x545b34){_0x3ff52b['push'](_0x3ff52b['shift']());}};_0x269857(++_0xcd6532);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7619852..68cc327 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 _0x0f2d=['../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service'];(function(_0xc58bc5,_0x4a3b7f){var _0x1014c9=function(_0x342901){while(--_0x342901){_0xc58bc5['push'](_0xc58bc5['shift']());}};_0x1014c9(++_0x4a3b7f);}(_0x0f2d,0x68));var _0xd0f2=function(_0x383bf6,_0x2478a1){_0x383bf6=_0x383bf6-0x0;var _0x5013bd=_0x0f2d[_0x383bf6];return _0x5013bd;};'use strict';var multer=require('multer');var util=require(_0xd0f2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd0f2('0x1'));var router=express[_0xd0f2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd0f2('0x3'));var interaction=require(_0xd0f2('0x4'));var config=require('../../config/environment');var controller=require(_0xd0f2('0x5'));router[_0xd0f2('0x6')]('/',auth[_0xd0f2('0x7')](),controller[_0xd0f2('0x8')]);router[_0xd0f2('0x6')](_0xd0f2('0x9'),auth[_0xd0f2('0x7')](),controller['describe']);router[_0xd0f2('0x6')](_0xd0f2('0xa'),auth[_0xd0f2('0x7')](),controller['show']);router[_0xd0f2('0xb')]('/',auth[_0xd0f2('0x7')](),controller[_0xd0f2('0xc')]);router[_0xd0f2('0xd')](_0xd0f2('0xa'),auth[_0xd0f2('0x7')](),controller[_0xd0f2('0xe')]);router[_0xd0f2('0xf')]('/:id',auth[_0xd0f2('0x7')](),controller[_0xd0f2('0x10')]);module[_0xd0f2('0x11')]=router; \ No newline at end of file +var _0xd445=['describe','/:id','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe'];(function(_0x2cce13,_0x535f87){var _0xf35fc0=function(_0x57d62a){while(--_0x57d62a){_0x2cce13['push'](_0x2cce13['shift']());}};_0xf35fc0(++_0x535f87);}(_0xd445,0xcd));var _0x5d44=function(_0x59de8b,_0x59ac7f){_0x59de8b=_0x59de8b-0x0;var _0xdb8f09=_0xd445[_0x59de8b];return _0xdb8f09;};'use strict';var multer=require(_0x5d44('0x0'));var util=require(_0x5d44('0x1'));var path=require(_0x5d44('0x2'));var timeout=require(_0x5d44('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d44('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5d44('0x5'));var config=require(_0x5d44('0x6'));var controller=require(_0x5d44('0x7'));router[_0x5d44('0x8')]('/',auth[_0x5d44('0x9')](),controller['index']);router[_0x5d44('0x8')](_0x5d44('0xa'),auth['isAuthenticated'](),controller[_0x5d44('0xb')]);router[_0x5d44('0x8')](_0x5d44('0xc'),auth[_0x5d44('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5d44('0xd')]);router['put'](_0x5d44('0xc'),auth[_0x5d44('0x9')](),controller[_0x5d44('0xe')]);router[_0x5d44('0xf')](_0x5d44('0xc'),auth['isAuthenticated'](),controller[_0x5d44('0x10')]);module[_0x5d44('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8c464bb..271f5a7 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 _0x7ee1=['STRING','sequelize'];(function(_0x289330,_0x54f85a){var _0x22d2d0=function(_0x4bdcf9){while(--_0x4bdcf9){_0x289330['push'](_0x289330['shift']());}};_0x22d2d0(++_0x54f85a);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5bd745,_0x3b9807){_0x5bd745=_0x5bd745-0x0;var _0x165ec8=_0x7ee1[_0x5bd745];return _0x165ec8;};'use strict';var Sequelize=require(_0x17ee('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x17ee('0x1')]}}; \ No newline at end of file +var _0xfd2e=['sequelize','STRING'];(function(_0x3cea33,_0x2f17db){var _0x208111=function(_0x4d5dcb){while(--_0x4d5dcb){_0x3cea33['push'](_0x3cea33['shift']());}};_0x208111(++_0x2f17db);}(_0xfd2e,0x6e));var _0xefd2=function(_0xd1f455,_0x2ff515){_0xd1f455=_0xd1f455-0x0;var _0x37c058=_0xfd2e[_0xd1f455];return _0x37c058;};'use strict';var Sequelize=require(_0xefd2('0x0'));module['exports']={'name':{'type':Sequelize[_0xefd2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xefd2('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index e384940..e7f540e 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 _0x1e50=['includeAll','include','findAll','catch','params','length','options','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type'];(function(_0x5ea26b,_0x40eda6){var _0x55f6f9=function(_0x21d6ed){while(--_0x21d6ed){_0x5ea26b['push'](_0x5ea26b['shift']());}};_0x55f6f9(++_0x40eda6);}(_0x1e50,0x1d4));var _0x01e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e50[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x01e5('0x0'));var rimraf=require(_0x01e5('0x1'));var zipdir=require(_0x01e5('0x2'));var jsonpatch=require(_0x01e5('0x3'));var rp=require(_0x01e5('0x4'));var moment=require('moment');var BPromise=require(_0x01e5('0x5'));var Mustache=require('mustache');var util=require(_0x01e5('0x6'));var path=require('path');var sox=require(_0x01e5('0x7'));var csv=require(_0x01e5('0x8'));var ejs=require(_0x01e5('0x9'));var fs=require('fs');var fs_extra=require(_0x01e5('0xa'));var _=require(_0x01e5('0xb'));var squel=require(_0x01e5('0xc'));var crypto=require(_0x01e5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x01e5('0x8'));var querystring=require(_0x01e5('0xe'));var Papa=require(_0x01e5('0xf'));var Redis=require(_0x01e5('0x10'));var authService=require(_0x01e5('0x11'));var qs=require(_0x01e5('0x12'));var as=require(_0x01e5('0x13'));var hardwareService=require(_0x01e5('0x14'));var logger=require(_0x01e5('0x15'))('api');var utils=require(_0x01e5('0x16'));var config=require(_0x01e5('0x17'));var licenseUtil=require(_0x01e5('0x18'));var db=require(_0x01e5('0x19'))['db'];function respondWithStatusCode(_0x29f2c7,_0x2736e1){_0x2736e1=_0x2736e1||0xcc;return function(_0x88a3){if(_0x88a3){return _0x29f2c7[_0x01e5('0x1a')](_0x2736e1);}return _0x29f2c7[_0x01e5('0x1b')](_0x2736e1)['end']();};}function respondWithResult(_0x50a45f,_0x616609){_0x616609=_0x616609||0xc8;return function(_0x1d3a9c){if(_0x1d3a9c){return _0x50a45f[_0x01e5('0x1b')](_0x616609)['json'](_0x1d3a9c);}};}function respondWithFilteredResult(_0x49c443,_0x1bd23a){return function(_0x20f210){if(_0x20f210){var _0x18f625=typeof _0x1bd23a[_0x01e5('0x1c')]==='undefined'&&typeof _0x1bd23a['limit']===_0x01e5('0x1d');var _0x466f1b=_0x20f210[_0x01e5('0x1e')];var _0x332f1b=_0x18f625?0x0:_0x1bd23a[_0x01e5('0x1c')];var _0x13603a=_0x18f625?_0x20f210[_0x01e5('0x1e')]:_0x1bd23a[_0x01e5('0x1c')]+_0x1bd23a[_0x01e5('0x1f')];var _0x504131;if(_0x13603a>=_0x466f1b){_0x13603a=_0x466f1b;_0x504131=0xc8;}else{_0x504131=0xce;}_0x49c443[_0x01e5('0x1b')](_0x504131);return _0x49c443[_0x01e5('0x20')](_0x01e5('0x21'),_0x332f1b+'-'+_0x13603a+'/'+_0x466f1b)[_0x01e5('0x22')](_0x20f210);}return null;};}function patchUpdates(_0x1849cd){return function(_0x1a96c3){try{jsonpatch[_0x01e5('0x23')](_0x1a96c3,_0x1849cd,!![]);}catch(_0x1ea6e2){return BPromise[_0x01e5('0x24')](_0x1ea6e2);}return _0x1a96c3[_0x01e5('0x25')]();};}function saveUpdates(_0x425f5e,_0x5a1fc1){return function(_0x5489c7){if(_0x5489c7){return _0x5489c7[_0x01e5('0x26')](_0x425f5e)[_0x01e5('0x27')](function(_0x446ad1){return _0x446ad1;});}return null;};}function removeEntity(_0x2ffa43,_0x194ab8){return function(_0x4e045e){if(_0x4e045e){return _0x4e045e['destroy']()[_0x01e5('0x27')](function(){_0x2ffa43['status'](0xcc)[_0x01e5('0x28')]();});}};}function handleEntityNotFound(_0x288f41,_0x2ffe84){return function(_0x1b7e51){if(!_0x1b7e51){_0x288f41[_0x01e5('0x1a')](0x194);}return _0x1b7e51;};}function handleError(_0x1708de,_0x1de47b){_0x1de47b=_0x1de47b||0x1f4;return function(_0x2e431c){logger['error'](_0x2e431c[_0x01e5('0x29')]);if(_0x2e431c[_0x01e5('0x2a')]){delete _0x2e431c['name'];}_0x1708de['status'](_0x1de47b)['send'](_0x2e431c);};}exports[_0x01e5('0x2b')]=function(_0x35e5b6,_0x173556){var _0x1a5997={},_0x224434={},_0x2f49f8={'count':0x0,'rows':[]};var _0x1a91b8=_[_0x01e5('0x2c')](db[_0x01e5('0x2d')][_0x01e5('0x2e')],function(_0x477f1a){return{'name':_0x477f1a[_0x01e5('0x2f')],'type':_0x477f1a['type'][_0x01e5('0x30')]};});_0x224434[_0x01e5('0x31')]=_[_0x01e5('0x2c')](_0x1a91b8,'name');_0x224434[_0x01e5('0x32')]=_[_0x01e5('0x33')](_0x35e5b6['query']);_0x224434[_0x01e5('0x34')]=_['intersection'](_0x224434[_0x01e5('0x31')],_0x224434[_0x01e5('0x32')]);_0x1a5997[_0x01e5('0x35')]=_[_0x01e5('0x36')](_0x224434['model'],qs[_0x01e5('0x37')](_0x35e5b6['query'][_0x01e5('0x37')]));_0x1a5997[_0x01e5('0x35')]=_0x1a5997[_0x01e5('0x35')]['length']?_0x1a5997[_0x01e5('0x35')]:_0x224434[_0x01e5('0x31')];if(!_0x35e5b6[_0x01e5('0x32')][_0x01e5('0x38')](_0x01e5('0x39'))){_0x1a5997[_0x01e5('0x1f')]=qs[_0x01e5('0x1f')](_0x35e5b6[_0x01e5('0x32')]['limit']);_0x1a5997[_0x01e5('0x1c')]=qs[_0x01e5('0x1c')](_0x35e5b6[_0x01e5('0x32')]['offset']);}_0x1a5997[_0x01e5('0x3a')]=qs[_0x01e5('0x3b')](_0x35e5b6[_0x01e5('0x32')]['sort']);_0x1a5997[_0x01e5('0x3c')]=qs[_0x01e5('0x34')](_['pick'](_0x35e5b6['query'],_0x224434[_0x01e5('0x34')]),_0x1a91b8);if(_0x35e5b6[_0x01e5('0x32')][_0x01e5('0x3d')]){_0x1a5997['where']=_[_0x01e5('0x3e')](_0x1a5997['where'],{'$or':_[_0x01e5('0x2c')](_0x1a91b8,function(_0x6a8395){if(_0x6a8395[_0x01e5('0x3f')]!=='VIRTUAL'){var _0x59b012={};_0x59b012[_0x6a8395[_0x01e5('0x2a')]]={'$like':'%'+_0x35e5b6['query']['filter']+'%'};return _0x59b012;}})});}_0x1a5997=_[_0x01e5('0x3e')]({},_0x1a5997,_0x35e5b6['options']);var _0x34cd27={'where':_0x1a5997['where']};return db[_0x01e5('0x2d')][_0x01e5('0x1e')](_0x34cd27)[_0x01e5('0x27')](function(_0x456d6f){_0x2f49f8[_0x01e5('0x1e')]=_0x456d6f;if(_0x35e5b6[_0x01e5('0x32')][_0x01e5('0x40')]){_0x1a5997[_0x01e5('0x41')]=[{'all':!![]}];}return db[_0x01e5('0x2d')][_0x01e5('0x42')](_0x1a5997);})[_0x01e5('0x27')](function(_0x2b49f1){_0x2f49f8['rows']=_0x2b49f1;return _0x2f49f8;})[_0x01e5('0x27')](respondWithFilteredResult(_0x173556,_0x1a5997))[_0x01e5('0x43')](handleError(_0x173556,null));};exports['show']=function(_0x2a28c3,_0x5d027f){var _0x1ad1d8={'raw':!![],'where':{'id':_0x2a28c3[_0x01e5('0x44')]['id']}},_0x4fdf32={};_0x4fdf32[_0x01e5('0x31')]=_[_0x01e5('0x33')](db['MailSubstatus'][_0x01e5('0x2e')]);_0x4fdf32[_0x01e5('0x32')]=_[_0x01e5('0x33')](_0x2a28c3[_0x01e5('0x32')]);_0x4fdf32[_0x01e5('0x34')]=_[_0x01e5('0x36')](_0x4fdf32[_0x01e5('0x31')],_0x4fdf32[_0x01e5('0x32')]);_0x1ad1d8[_0x01e5('0x35')]=_[_0x01e5('0x36')](_0x4fdf32[_0x01e5('0x31')],qs[_0x01e5('0x37')](_0x2a28c3['query'][_0x01e5('0x37')]));_0x1ad1d8['attributes']=_0x1ad1d8[_0x01e5('0x35')][_0x01e5('0x45')]?_0x1ad1d8['attributes']:_0x4fdf32[_0x01e5('0x31')];if(_0x2a28c3[_0x01e5('0x32')][_0x01e5('0x40')]){_0x1ad1d8['include']=[{'all':!![]}];}_0x1ad1d8=_[_0x01e5('0x3e')]({},_0x1ad1d8,_0x2a28c3[_0x01e5('0x46')]);return db[_0x01e5('0x2d')]['find'](_0x1ad1d8)[_0x01e5('0x27')](handleEntityNotFound(_0x5d027f,null))[_0x01e5('0x27')](respondWithResult(_0x5d027f,null))[_0x01e5('0x43')](handleError(_0x5d027f,null));};exports[_0x01e5('0x47')]=function(_0x502c43,_0x5d7ef3){return db[_0x01e5('0x2d')][_0x01e5('0x47')](_0x502c43[_0x01e5('0x48')],{})['then'](respondWithResult(_0x5d7ef3,0xc9))['catch'](handleError(_0x5d7ef3,null));};exports['update']=function(_0x5b3729,_0xa57769){if(_0x5b3729['body']['id']){delete _0x5b3729[_0x01e5('0x48')]['id'];}return db['MailSubstatus'][_0x01e5('0x49')]({'where':{'id':_0x5b3729[_0x01e5('0x44')]['id']}})['then'](handleEntityNotFound(_0xa57769,null))[_0x01e5('0x27')](saveUpdates(_0x5b3729['body'],null))[_0x01e5('0x27')](respondWithResult(_0xa57769,null))[_0x01e5('0x43')](handleError(_0xa57769,null));};exports[_0x01e5('0x4a')]=function(_0x42910c,_0x36d66b){return db[_0x01e5('0x2d')][_0x01e5('0x49')]({'where':{'id':_0x42910c[_0x01e5('0x44')]['id']}})[_0x01e5('0x27')](handleEntityNotFound(_0x36d66b,null))['then'](removeEntity(_0x36d66b,null))[_0x01e5('0x43')](handleError(_0x36d66b,null));};exports[_0x01e5('0x4b')]=function(_0x15a9a8,_0x1ed4f5){return db[_0x01e5('0x2d')][_0x01e5('0x4b')]()[_0x01e5('0x27')](respondWithResult(_0x1ed4f5,null))[_0x01e5('0x43')](handleError(_0x1ed4f5,null));}; \ No newline at end of file +var _0x0ca1=['crypto','jsforce','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','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','map','MailSubstatus','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','show','params','rawAttributes','intersection','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash'];(function(_0x40ab1b,_0x1746bb){var _0x7c5386=function(_0xbab9bf){while(--_0xbab9bf){_0x40ab1b['push'](_0x40ab1b['shift']());}};_0x7c5386(++_0x1746bb);}(_0x0ca1,0x86));var _0x10ca=function(_0x194ca8,_0xe3adb2){_0x194ca8=_0x194ca8-0x0;var _0x44bdb0=_0x0ca1[_0x194ca8];return _0x44bdb0;};'use strict';var emlformat=require(_0x10ca('0x0'));var rimraf=require(_0x10ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10ca('0x2'));var rp=require(_0x10ca('0x3'));var moment=require(_0x10ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x10ca('0x5'));var util=require('util');var path=require(_0x10ca('0x6'));var sox=require('sox');var csv=require(_0x10ca('0x7'));var ejs=require(_0x10ca('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10ca('0x9'));var squel=require('squel');var crypto=require(_0x10ca('0xa'));var jsforce=require(_0x10ca('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x10ca('0x7'));var querystring=require(_0x10ca('0xc'));var Papa=require(_0x10ca('0xd'));var Redis=require(_0x10ca('0xe'));var authService=require(_0x10ca('0xf'));var qs=require(_0x10ca('0x10'));var as=require(_0x10ca('0x11'));var hardwareService=require(_0x10ca('0x12'));var logger=require(_0x10ca('0x13'))(_0x10ca('0x14'));var utils=require('../../config/utils');var config=require(_0x10ca('0x15'));var licenseUtil=require(_0x10ca('0x16'));var db=require(_0x10ca('0x17'))['db'];function respondWithStatusCode(_0x741b70,_0x15ec44){_0x15ec44=_0x15ec44||0xcc;return function(_0x14af33){if(_0x14af33){return _0x741b70[_0x10ca('0x18')](_0x15ec44);}return _0x741b70[_0x10ca('0x19')](_0x15ec44)['end']();};}function respondWithResult(_0x56f6b9,_0x3a1adc){_0x3a1adc=_0x3a1adc||0xc8;return function(_0x5f14fd){if(_0x5f14fd){return _0x56f6b9[_0x10ca('0x19')](_0x3a1adc)['json'](_0x5f14fd);}};}function respondWithFilteredResult(_0x4885e4,_0x887ade){return function(_0x1708f5){if(_0x1708f5){var _0x3880cb=typeof _0x887ade[_0x10ca('0x1a')]===_0x10ca('0x1b')&&typeof _0x887ade[_0x10ca('0x1c')]===_0x10ca('0x1b');var _0x2babd8=_0x1708f5['count'];var _0x4c481b=_0x3880cb?0x0:_0x887ade[_0x10ca('0x1a')];var _0x50a76f=_0x3880cb?_0x1708f5['count']:_0x887ade['offset']+_0x887ade[_0x10ca('0x1c')];var _0x2f7533;if(_0x50a76f>=_0x2babd8){_0x50a76f=_0x2babd8;_0x2f7533=0xc8;}else{_0x2f7533=0xce;}_0x4885e4['status'](_0x2f7533);return _0x4885e4[_0x10ca('0x1d')](_0x10ca('0x1e'),_0x4c481b+'-'+_0x50a76f+'/'+_0x2babd8)[_0x10ca('0x1f')](_0x1708f5);}return null;};}function patchUpdates(_0x12009c){return function(_0x1b43c1){try{jsonpatch['apply'](_0x1b43c1,_0x12009c,!![]);}catch(_0xd3c9dc){return BPromise[_0x10ca('0x20')](_0xd3c9dc);}return _0x1b43c1[_0x10ca('0x21')]();};}function saveUpdates(_0xb132c,_0x1525f3){return function(_0x2f8ce7){if(_0x2f8ce7){return _0x2f8ce7[_0x10ca('0x22')](_0xb132c)[_0x10ca('0x23')](function(_0x49a69f){return _0x49a69f;});}return null;};}function removeEntity(_0x3f1fa2,_0x2ba13e){return function(_0x54936d){if(_0x54936d){return _0x54936d[_0x10ca('0x24')]()[_0x10ca('0x23')](function(){_0x3f1fa2[_0x10ca('0x19')](0xcc)[_0x10ca('0x25')]();});}};}function handleEntityNotFound(_0x15ec43,_0x44fe9a){return function(_0x448cb7){if(!_0x448cb7){_0x15ec43[_0x10ca('0x18')](0x194);}return _0x448cb7;};}function handleError(_0x3ada3a,_0x3e19e3){_0x3e19e3=_0x3e19e3||0x1f4;return function(_0x267ede){logger['error'](_0x267ede[_0x10ca('0x26')]);if(_0x267ede[_0x10ca('0x27')]){delete _0x267ede[_0x10ca('0x27')];}_0x3ada3a[_0x10ca('0x19')](_0x3e19e3)[_0x10ca('0x28')](_0x267ede);};}exports[_0x10ca('0x29')]=function(_0x108aca,_0x19cb67){var _0x3ceaa8={},_0xc6195b={},_0x1b4555={'count':0x0,'rows':[]};var _0xef2c06=_[_0x10ca('0x2a')](db[_0x10ca('0x2b')]['rawAttributes'],function(_0x591ffd){return{'name':_0x591ffd[_0x10ca('0x2c')],'type':_0x591ffd[_0x10ca('0x2d')][_0x10ca('0x2e')]};});_0xc6195b['model']=_[_0x10ca('0x2a')](_0xef2c06,_0x10ca('0x27'));_0xc6195b[_0x10ca('0x2f')]=_[_0x10ca('0x30')](_0x108aca['query']);_0xc6195b[_0x10ca('0x31')]=_['intersection'](_0xc6195b[_0x10ca('0x32')],_0xc6195b[_0x10ca('0x2f')]);_0x3ceaa8['attributes']=_['intersection'](_0xc6195b[_0x10ca('0x32')],qs[_0x10ca('0x33')](_0x108aca[_0x10ca('0x2f')][_0x10ca('0x33')]));_0x3ceaa8[_0x10ca('0x34')]=_0x3ceaa8[_0x10ca('0x34')][_0x10ca('0x35')]?_0x3ceaa8[_0x10ca('0x34')]:_0xc6195b[_0x10ca('0x32')];if(!_0x108aca['query'][_0x10ca('0x36')](_0x10ca('0x37'))){_0x3ceaa8['limit']=qs[_0x10ca('0x1c')](_0x108aca[_0x10ca('0x2f')][_0x10ca('0x1c')]);_0x3ceaa8[_0x10ca('0x1a')]=qs['offset'](_0x108aca[_0x10ca('0x2f')][_0x10ca('0x1a')]);}_0x3ceaa8['order']=qs[_0x10ca('0x38')](_0x108aca[_0x10ca('0x2f')][_0x10ca('0x38')]);_0x3ceaa8['where']=qs['filters'](_['pick'](_0x108aca[_0x10ca('0x2f')],_0xc6195b[_0x10ca('0x31')]),_0xef2c06);if(_0x108aca[_0x10ca('0x2f')][_0x10ca('0x39')]){_0x3ceaa8[_0x10ca('0x3a')]=_[_0x10ca('0x3b')](_0x3ceaa8[_0x10ca('0x3a')],{'$or':_[_0x10ca('0x2a')](_0xef2c06,function(_0xad7295){if(_0xad7295['type']!=='VIRTUAL'){var _0x4cce24={};_0x4cce24[_0xad7295[_0x10ca('0x27')]]={'$like':'%'+_0x108aca[_0x10ca('0x2f')]['filter']+'%'};return _0x4cce24;}})});}_0x3ceaa8=_[_0x10ca('0x3b')]({},_0x3ceaa8,_0x108aca[_0x10ca('0x3c')]);var _0x559846={'where':_0x3ceaa8[_0x10ca('0x3a')]};return db['MailSubstatus']['count'](_0x559846)[_0x10ca('0x23')](function(_0x7022dd){_0x1b4555['count']=_0x7022dd;if(_0x108aca['query'][_0x10ca('0x3d')]){_0x3ceaa8[_0x10ca('0x3e')]=[{'all':!![]}];}return db[_0x10ca('0x2b')]['findAll'](_0x3ceaa8);})[_0x10ca('0x23')](function(_0x4d1e31){_0x1b4555['rows']=_0x4d1e31;return _0x1b4555;})['then'](respondWithFilteredResult(_0x19cb67,_0x3ceaa8))['catch'](handleError(_0x19cb67,null));};exports[_0x10ca('0x3f')]=function(_0x5540ef,_0x3f8116){var _0x10d5fc={'raw':!![],'where':{'id':_0x5540ef[_0x10ca('0x40')]['id']}},_0x1914d9={};_0x1914d9[_0x10ca('0x32')]=_[_0x10ca('0x30')](db[_0x10ca('0x2b')][_0x10ca('0x41')]);_0x1914d9[_0x10ca('0x2f')]=_[_0x10ca('0x30')](_0x5540ef[_0x10ca('0x2f')]);_0x1914d9['filters']=_[_0x10ca('0x42')](_0x1914d9[_0x10ca('0x32')],_0x1914d9[_0x10ca('0x2f')]);_0x10d5fc[_0x10ca('0x34')]=_[_0x10ca('0x42')](_0x1914d9[_0x10ca('0x32')],qs[_0x10ca('0x33')](_0x5540ef[_0x10ca('0x2f')][_0x10ca('0x33')]));_0x10d5fc['attributes']=_0x10d5fc['attributes']['length']?_0x10d5fc['attributes']:_0x1914d9[_0x10ca('0x32')];if(_0x5540ef['query']['includeAll']){_0x10d5fc[_0x10ca('0x3e')]=[{'all':!![]}];}_0x10d5fc=_['merge']({},_0x10d5fc,_0x5540ef[_0x10ca('0x3c')]);return db['MailSubstatus'][_0x10ca('0x43')](_0x10d5fc)['then'](handleEntityNotFound(_0x3f8116,null))[_0x10ca('0x23')](respondWithResult(_0x3f8116,null))[_0x10ca('0x44')](handleError(_0x3f8116,null));};exports['create']=function(_0x1ab242,_0x237833){return db['MailSubstatus'][_0x10ca('0x45')](_0x1ab242['body'],{})[_0x10ca('0x23')](respondWithResult(_0x237833,0xc9))[_0x10ca('0x44')](handleError(_0x237833,null));};exports[_0x10ca('0x22')]=function(_0x5dd756,_0x15c090){if(_0x5dd756[_0x10ca('0x46')]['id']){delete _0x5dd756[_0x10ca('0x46')]['id'];}return db[_0x10ca('0x2b')][_0x10ca('0x43')]({'where':{'id':_0x5dd756[_0x10ca('0x40')]['id']}})[_0x10ca('0x23')](handleEntityNotFound(_0x15c090,null))[_0x10ca('0x23')](saveUpdates(_0x5dd756[_0x10ca('0x46')],null))[_0x10ca('0x23')](respondWithResult(_0x15c090,null))[_0x10ca('0x44')](handleError(_0x15c090,null));};exports['destroy']=function(_0x1656e3,_0x33e6fd){return db[_0x10ca('0x2b')][_0x10ca('0x43')]({'where':{'id':_0x1656e3['params']['id']}})[_0x10ca('0x23')](handleEntityNotFound(_0x33e6fd,null))[_0x10ca('0x23')](removeEntity(_0x33e6fd,null))[_0x10ca('0x44')](handleError(_0x33e6fd,null));};exports[_0x10ca('0x47')]=function(_0x103eb3,_0x210a5a){return db[_0x10ca('0x2b')]['describe']()['then'](respondWithResult(_0x210a5a,null))[_0x10ca('0x44')](handleError(_0x210a5a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 5108ff5..98a5c94 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 _0x0a5d=['hook','exports','../../mysqldb','MailSubstatus','update','emit','hasOwnProperty'];(function(_0x3b3064,_0x36bf5e){var _0x51eb6a=function(_0x52b27e){while(--_0x52b27e){_0x3b3064['push'](_0x3b3064['shift']());}};_0x51eb6a(++_0x36bf5e);}(_0x0a5d,0x80));var _0xd0a5=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x0a5d[_0x127783];return _0x14f298;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xd0a5('0x0'))['db'][_0xd0a5('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xd0a5('0x2')};function emitEvent(_0x578625){return function(_0x5b42a2,_0x14c5ce,_0x38ddbc){MailSubstatusEvents['emit'](_0x578625+':'+_0x5b42a2['id'],_0x5b42a2);MailSubstatusEvents[_0xd0a5('0x3')](_0x578625,_0x5b42a2);_0x38ddbc(null);};}for(var e in events){if(events[_0xd0a5('0x4')](e)){var event=events[e];MailSubstatus[_0xd0a5('0x5')](e,emitEvent(event));}}module[_0xd0a5('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x31fe=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','emit'];(function(_0x2150d9,_0x23c4aa){var _0x54fa94=function(_0x2b0c34){while(--_0x2b0c34){_0x2150d9['push'](_0x2150d9['shift']());}};_0x54fa94(++_0x23c4aa);}(_0x31fe,0xfe));var _0xe31f=function(_0x195b13,_0x4b6268){_0x195b13=_0x195b13-0x0;var _0x4caec9=_0x31fe[_0x195b13];return _0x4caec9;};'use strict';var EventEmitter=require(_0xe31f('0x0'));var MailSubstatus=require(_0xe31f('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe31f('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x3b1160){return function(_0x1edae9,_0x26998e,_0x31e60e){MailSubstatusEvents[_0xe31f('0x3')](_0x3b1160+':'+_0x1edae9['id'],_0x1edae9);MailSubstatusEvents['emit'](_0x3b1160,_0x1edae9);_0x31e60e(null);};}for(var e in events){if(events[_0xe31f('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xe31f('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 f2d4375..54e2d71 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 _0x20da=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','catch'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x20da,0x1ef));var _0xa20d=function(_0x469b35,_0x59629d){_0x469b35=_0x469b35-0x0;var _0x17a821=_0x20da[_0x469b35];return _0x17a821;};'use strict';var attributes=require(_0xa20d('0x0'));module[_0xa20d('0x1')]=function(_0x1bb4c4){var _0x12294e=_0x1bb4c4[_0xa20d('0x2')];return _0x1bb4c4[_0xa20d('0x3')](_0xa20d('0x4'),attributes,{'tableName':_0xa20d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x36c214,_0x59246c,_0x3ecf5c){return _0x12294e[_0xa20d('0x6')]['update']({'value':_0x36c214['name']},{'where':{'field':_0xa20d('0x7'),'value':_0x36c214[_0xa20d('0x8')][_0xa20d('0x9')]}})['then'](function(){_0x3ecf5c();})[_0xa20d('0xa')](function(_0xdbbdcc){_0x3ecf5c(_0xdbbdcc);});}}});}; \ No newline at end of file +var _0xcedb=['mail_substatuses','Condition','update','name','then','./mailSubstatus.attributes','define'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xcedb,0xde));var _0xbced=function(_0x1ac9f4,_0x5b796f){_0x1ac9f4=_0x1ac9f4-0x0;var _0x502020=_0xcedb[_0x1ac9f4];return _0x502020;};'use strict';var attributes=require(_0xbced('0x0'));module['exports']=function(_0x59c0a9){var _0x44ec90=_0x59c0a9['models'];return _0x59c0a9[_0xbced('0x1')]('MailSubstatus',attributes,{'tableName':_0xbced('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xaaf254,_0x493058,_0x2b8cb1){return _0x44ec90[_0xbced('0x3')][_0xbced('0x4')]({'value':_0xaaf254[_0xbced('0x5')]},{'where':{'field':'mailSubstatus','value':_0xaaf254['_previousDataValues'][_0xbced('0x5')]}})[_0xbced('0x6')](function(){_0x2b8cb1();})['catch'](function(_0x1b54da){_0x2b8cb1(_0x1b54da);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index eca0469..5a4b918 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 _0x9ac5=['MailSubstatus,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','debug','stringify','error'];(function(_0x10b4f2,_0x2d4ec8){var _0x1d9640=function(_0x5a55ab){while(--_0x5a55ab){_0x10b4f2['push'](_0x10b4f2['shift']());}};_0x1d9640(++_0x2d4ec8);}(_0x9ac5,0xdd));var _0x59ac=function(_0x27f56b,_0x486625){_0x27f56b=_0x27f56b-0x0;var _0x336446=_0x9ac5[_0x27f56b];return _0x336446;};'use strict';var _=require(_0x59ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x59ac('0x1'));var rs=require(_0x59ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59ac('0x3'))['db'];var utils=require(_0x59ac('0x4'));var logger=require(_0x59ac('0x5'))(_0x59ac('0x6'));var config=require(_0x59ac('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d8013,_0x1f436e,_0x2541a3){return new BPromise(function(_0x3fec3c,_0x393c00){return client[_0x59ac('0x8')](_0x3d8013,_0x2541a3)['then'](function(_0x89f343){logger[_0x59ac('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x1f436e,'request\x20sent');logger[_0x59ac('0xa')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1f436e,'request\x20sent',JSON[_0x59ac('0xb')](_0x89f343));if(_0x89f343[_0x59ac('0xc')]){if(_0x89f343[_0x59ac('0xc')]['code']===0x1f4){logger[_0x59ac('0xc')](_0x59ac('0xd'),_0x1f436e,_0x89f343['error']['message']);return _0x393c00(_0x89f343[_0x59ac('0xc')][_0x59ac('0xe')]);}logger[_0x59ac('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x1f436e,_0x89f343[_0x59ac('0xc')][_0x59ac('0xe')]);return _0x3fec3c(_0x89f343[_0x59ac('0xc')][_0x59ac('0xe')]);}else{logger[_0x59ac('0x9')](_0x59ac('0xd'),_0x1f436e,_0x59ac('0xf'));_0x3fec3c(_0x89f343[_0x59ac('0x10')][_0x59ac('0xe')]);}})[_0x59ac('0x11')](function(_0x598b4a){logger[_0x59ac('0xc')](_0x59ac('0xd'),_0x1f436e,_0x598b4a);_0x393c00(_0x598b4a);});});} \ No newline at end of file +var _0xc672=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0xbbcd53,_0x5cbcdf){var _0x1f27a0=function(_0x59e0ce){while(--_0x59e0ce){_0xbbcd53['push'](_0xbbcd53['shift']());}};_0x1f27a0(++_0x5cbcdf);}(_0xc672,0xf8));var _0x2c67=function(_0x1cfa82,_0x2b4f50){_0x1cfa82=_0x1cfa82-0x0;var _0x2226fb=_0xc672[_0x1cfa82];return _0x2226fb;};'use strict';var _=require(_0x2c67('0x0'));var util=require(_0x2c67('0x1'));var moment=require('moment');var BPromise=require(_0x2c67('0x2'));var rs=require(_0x2c67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c67('0x4'))['db'];var utils=require(_0x2c67('0x5'));var logger=require(_0x2c67('0x6'))(_0x2c67('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c67('0x8'));var client=jayson[_0x2c67('0x9')][_0x2c67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cffd2,_0x352b9e,_0x48f909){return new BPromise(function(_0x15ea50,_0x323200){return client[_0x2c67('0xb')](_0x2cffd2,_0x48f909)[_0x2c67('0xc')](function(_0x4e6701){logger[_0x2c67('0xd')](_0x2c67('0xe'),_0x352b9e,_0x2c67('0xf'));logger[_0x2c67('0x10')](_0x2c67('0x11'),_0x352b9e,_0x2c67('0xf'),JSON[_0x2c67('0x12')](_0x4e6701));if(_0x4e6701[_0x2c67('0x13')]){if(_0x4e6701['error'][_0x2c67('0x14')]===0x1f4){logger[_0x2c67('0x13')](_0x2c67('0xe'),_0x352b9e,_0x4e6701['error'][_0x2c67('0x15')]);return _0x323200(_0x4e6701[_0x2c67('0x13')][_0x2c67('0x15')]);}logger[_0x2c67('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x352b9e,_0x4e6701[_0x2c67('0x13')][_0x2c67('0x15')]);return _0x15ea50(_0x4e6701['error'][_0x2c67('0x15')]);}else{logger[_0x2c67('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x352b9e,_0x2c67('0xf'));_0x15ea50(_0x4e6701[_0x2c67('0x16')]['message']);}})[_0x2c67('0x17')](function(_0x47781f){logger[_0x2c67('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x352b9e,_0x47781f);_0x323200(_0x47781f);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 30e69de..e5fa3a1 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 _0x00a2=['update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','/describe','describe','post','create','put','/:id'];(function(_0x498194,_0x1632bc){var _0x1f6567=function(_0xa178b4){while(--_0xa178b4){_0x498194['push'](_0x498194['shift']());}};_0x1f6567(++_0x1632bc);}(_0x00a2,0x18f));var _0x200a=function(_0x496503,_0x1eea5b){_0x496503=_0x496503-0x0;var _0x1ba3d2=_0x00a2[_0x496503];return _0x1ba3d2;};'use strict';var multer=require(_0x200a('0x0'));var util=require('util');var path=require(_0x200a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x200a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x200a('0x3'));var interaction=require(_0x200a('0x4'));var config=require(_0x200a('0x5'));var controller=require(_0x200a('0x6'));router['get']('/',auth[_0x200a('0x7')](),controller[_0x200a('0x8')]);router['get'](_0x200a('0x9'),auth['isAuthenticated'](),controller[_0x200a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x200a('0xb')]('/',auth['isAuthenticated'](),controller[_0x200a('0xc')]);router[_0x200a('0xd')](_0x200a('0xe'),auth['isAuthenticated'](),controller[_0x200a('0xf')]);router[_0x200a('0x10')]('/:id',auth[_0x200a('0x7')](),controller[_0x200a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfe0a=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x55b037,_0x2d9392){var _0x5f1053=function(_0x7a13d4){while(--_0x7a13d4){_0x55b037['push'](_0x55b037['shift']());}};_0x5f1053(++_0x2d9392);}(_0xfe0a,0x100));var _0xafe0=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xfe0a[_0x5c72ee];return _0x231876;};'use strict';var multer=require(_0xafe0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xafe0('0x1'));var express=require(_0xafe0('0x2'));var router=express[_0xafe0('0x3')]();var fs_extra=require(_0xafe0('0x4'));var auth=require(_0xafe0('0x5'));var interaction=require(_0xafe0('0x6'));var config=require(_0xafe0('0x7'));var controller=require(_0xafe0('0x8'));router[_0xafe0('0x9')]('/',auth[_0xafe0('0xa')](),controller[_0xafe0('0xb')]);router[_0xafe0('0x9')](_0xafe0('0xc'),auth[_0xafe0('0xa')](),controller[_0xafe0('0xd')]);router['get'](_0xafe0('0xe'),auth[_0xafe0('0xa')](),controller[_0xafe0('0xf')]);router[_0xafe0('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xafe0('0xe'),auth[_0xafe0('0xa')](),controller[_0xafe0('0x11')]);router[_0xafe0('0x12')](_0xafe0('0xe'),auth[_0xafe0('0xa')](),controller[_0xafe0('0x13')]);module[_0xafe0('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 963bbc7..6fcd639 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x103c03,_0xfde8d3){var _0x39f4f6=function(_0x591c1d){while(--_0x591c1d){_0x103c03['push'](_0x103c03['shift']());}};_0x39f4f6(++_0xfde8d3);}(_0x4b84,0x1cc));var _0x44b8=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x4b84[_0x56e4e7];return _0x383618;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x51e347,_0x1b565a){var _0x49ab46=function(_0x5962cf){while(--_0x5962cf){_0x51e347['push'](_0x51e347['shift']());}};_0x49ab46(++_0x1b565a);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 27370a5..2e03e6b 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 _0xa6e4=['map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','MailTransferReport','include','catch','show','params','includeAll','merge','options','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','reject','then','destroy','stack','name','send','index'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xa6e4,0x17c));var _0x4a6e=function(_0x153eba,_0x43fc58){_0x153eba=_0x153eba-0x0;var _0x21a678=_0xa6e4[_0x153eba];return _0x21a678;};'use strict';var emlformat=require(_0x4a6e('0x0'));var rimraf=require(_0x4a6e('0x1'));var zipdir=require(_0x4a6e('0x2'));var jsonpatch=require(_0x4a6e('0x3'));var rp=require(_0x4a6e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4a6e('0x5'));var util=require(_0x4a6e('0x6'));var path=require(_0x4a6e('0x7'));var sox=require(_0x4a6e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a6e('0x9'));var _=require(_0x4a6e('0xa'));var squel=require(_0x4a6e('0xb'));var crypto=require(_0x4a6e('0xc'));var jsforce=require(_0x4a6e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4a6e('0xe'));var querystring=require('querystring');var Papa=require(_0x4a6e('0xf'));var Redis=require(_0x4a6e('0x10'));var authService=require(_0x4a6e('0x11'));var qs=require(_0x4a6e('0x12'));var as=require(_0x4a6e('0x13'));var hardwareService=require(_0x4a6e('0x14'));var logger=require(_0x4a6e('0x15'))(_0x4a6e('0x16'));var utils=require(_0x4a6e('0x17'));var config=require(_0x4a6e('0x18'));var licenseUtil=require(_0x4a6e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f57f0,_0x2fd67d){_0x2fd67d=_0x2fd67d||0xcc;return function(_0x168f91){if(_0x168f91){return _0x2f57f0[_0x4a6e('0x1a')](_0x2fd67d);}return _0x2f57f0[_0x4a6e('0x1b')](_0x2fd67d)[_0x4a6e('0x1c')]();};}function respondWithResult(_0x302603,_0x1c7bef){_0x1c7bef=_0x1c7bef||0xc8;return function(_0x531637){if(_0x531637){return _0x302603[_0x4a6e('0x1b')](_0x1c7bef)[_0x4a6e('0x1d')](_0x531637);}};}function respondWithFilteredResult(_0x440a91,_0x46f4db){return function(_0x236016){if(_0x236016){var _0x3be8fc=typeof _0x46f4db['offset']===_0x4a6e('0x1e')&&typeof _0x46f4db[_0x4a6e('0x1f')]===_0x4a6e('0x1e');var _0x10c8cb=_0x236016[_0x4a6e('0x20')];var _0x40cd75=_0x3be8fc?0x0:_0x46f4db['offset'];var _0x468365=_0x3be8fc?_0x236016[_0x4a6e('0x20')]:_0x46f4db['offset']+_0x46f4db[_0x4a6e('0x1f')];var _0x1f58b3;if(_0x468365>=_0x10c8cb){_0x468365=_0x10c8cb;_0x1f58b3=0xc8;}else{_0x1f58b3=0xce;}_0x440a91[_0x4a6e('0x1b')](_0x1f58b3);return _0x440a91['set']('Content-Range',_0x40cd75+'-'+_0x468365+'/'+_0x10c8cb)[_0x4a6e('0x1d')](_0x236016);}return null;};}function patchUpdates(_0x195d6e){return function(_0x5e5d69){try{jsonpatch['apply'](_0x5e5d69,_0x195d6e,!![]);}catch(_0x441931){return BPromise[_0x4a6e('0x21')](_0x441931);}return _0x5e5d69['save']();};}function saveUpdates(_0x4b7950,_0x418544){return function(_0x4b9ae8){if(_0x4b9ae8){return _0x4b9ae8['update'](_0x4b7950)[_0x4a6e('0x22')](function(_0xe2ce04){return _0xe2ce04;});}return null;};}function removeEntity(_0x3bdbee,_0x307863){return function(_0x24e4c1){if(_0x24e4c1){return _0x24e4c1[_0x4a6e('0x23')]()[_0x4a6e('0x22')](function(){_0x3bdbee[_0x4a6e('0x1b')](0xcc)[_0x4a6e('0x1c')]();});}};}function handleEntityNotFound(_0x356e2e,_0x497d59){return function(_0x25bc98){if(!_0x25bc98){_0x356e2e['sendStatus'](0x194);}return _0x25bc98;};}function handleError(_0x525f1d,_0x40178c){_0x40178c=_0x40178c||0x1f4;return function(_0x534ffa){logger['error'](_0x534ffa[_0x4a6e('0x24')]);if(_0x534ffa[_0x4a6e('0x25')]){delete _0x534ffa[_0x4a6e('0x25')];}_0x525f1d[_0x4a6e('0x1b')](_0x40178c)[_0x4a6e('0x26')](_0x534ffa);};}exports[_0x4a6e('0x27')]=function(_0x338196,_0x14999f){var _0x53ec9c={},_0xd2afc6={},_0x4b20a6={'count':0x0,'rows':[]};var _0x165d94=_[_0x4a6e('0x28')](db['MailTransferReport'][_0x4a6e('0x29')],function(_0x411882){return{'name':_0x411882[_0x4a6e('0x2a')],'type':_0x411882[_0x4a6e('0x2b')]['key']};});_0xd2afc6[_0x4a6e('0x2c')]=_[_0x4a6e('0x28')](_0x165d94,_0x4a6e('0x25'));_0xd2afc6[_0x4a6e('0x2d')]=_['keys'](_0x338196[_0x4a6e('0x2d')]);_0xd2afc6[_0x4a6e('0x2e')]=_[_0x4a6e('0x2f')](_0xd2afc6['model'],_0xd2afc6[_0x4a6e('0x2d')]);_0x53ec9c[_0x4a6e('0x30')]=_[_0x4a6e('0x2f')](_0xd2afc6[_0x4a6e('0x2c')],qs[_0x4a6e('0x31')](_0x338196[_0x4a6e('0x2d')][_0x4a6e('0x31')]));_0x53ec9c[_0x4a6e('0x30')]=_0x53ec9c[_0x4a6e('0x30')]['length']?_0x53ec9c[_0x4a6e('0x30')]:_0xd2afc6[_0x4a6e('0x2c')];if(!_0x338196[_0x4a6e('0x2d')][_0x4a6e('0x32')](_0x4a6e('0x33'))){_0x53ec9c[_0x4a6e('0x1f')]=qs[_0x4a6e('0x1f')](_0x338196[_0x4a6e('0x2d')][_0x4a6e('0x1f')]);_0x53ec9c[_0x4a6e('0x34')]=qs['offset'](_0x338196[_0x4a6e('0x2d')][_0x4a6e('0x34')]);}_0x53ec9c[_0x4a6e('0x35')]=qs['sort'](_0x338196[_0x4a6e('0x2d')][_0x4a6e('0x36')]);_0x53ec9c[_0x4a6e('0x37')]=qs[_0x4a6e('0x2e')](_[_0x4a6e('0x38')](_0x338196[_0x4a6e('0x2d')],_0xd2afc6[_0x4a6e('0x2e')]),_0x165d94);if(_0x338196[_0x4a6e('0x2d')][_0x4a6e('0x39')]){_0x53ec9c[_0x4a6e('0x37')]=_['merge'](_0x53ec9c['where'],{'$or':_[_0x4a6e('0x28')](_0x165d94,function(_0x5524c4){if(_0x5524c4['type']!==_0x4a6e('0x3a')){var _0x2525ce={};_0x2525ce[_0x5524c4[_0x4a6e('0x25')]]={'$like':'%'+_0x338196[_0x4a6e('0x2d')]['filter']+'%'};return _0x2525ce;}})});}_0x53ec9c=_['merge']({},_0x53ec9c,_0x338196['options']);var _0x55f623={'where':_0x53ec9c[_0x4a6e('0x37')]};return db[_0x4a6e('0x3b')][_0x4a6e('0x20')](_0x55f623)[_0x4a6e('0x22')](function(_0x4a37b1){_0x4b20a6[_0x4a6e('0x20')]=_0x4a37b1;if(_0x338196['query']['includeAll']){_0x53ec9c[_0x4a6e('0x3c')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x53ec9c);})[_0x4a6e('0x22')](function(_0x384b62){_0x4b20a6['rows']=_0x384b62;return _0x4b20a6;})[_0x4a6e('0x22')](respondWithFilteredResult(_0x14999f,_0x53ec9c))[_0x4a6e('0x3d')](handleError(_0x14999f,null));};exports[_0x4a6e('0x3e')]=function(_0x3d1449,_0x362234){var _0x59624b={'raw':!![],'where':{'id':_0x3d1449[_0x4a6e('0x3f')]['id']}},_0x2eee4d={};_0x2eee4d['model']=_['keys'](db[_0x4a6e('0x3b')]['rawAttributes']);_0x2eee4d['query']=_['keys'](_0x3d1449[_0x4a6e('0x2d')]);_0x2eee4d[_0x4a6e('0x2e')]=_[_0x4a6e('0x2f')](_0x2eee4d['model'],_0x2eee4d[_0x4a6e('0x2d')]);_0x59624b['attributes']=_[_0x4a6e('0x2f')](_0x2eee4d[_0x4a6e('0x2c')],qs[_0x4a6e('0x31')](_0x3d1449['query'][_0x4a6e('0x31')]));_0x59624b[_0x4a6e('0x30')]=_0x59624b['attributes']['length']?_0x59624b[_0x4a6e('0x30')]:_0x2eee4d[_0x4a6e('0x2c')];if(_0x3d1449[_0x4a6e('0x2d')][_0x4a6e('0x40')]){_0x59624b[_0x4a6e('0x3c')]=[{'all':!![]}];}_0x59624b=_[_0x4a6e('0x41')]({},_0x59624b,_0x3d1449[_0x4a6e('0x42')]);return db[_0x4a6e('0x3b')]['find'](_0x59624b)[_0x4a6e('0x22')](handleEntityNotFound(_0x362234,null))[_0x4a6e('0x22')](respondWithResult(_0x362234,null))[_0x4a6e('0x3d')](handleError(_0x362234,null));};exports[_0x4a6e('0x43')]=function(_0x46e424,_0x28bd1d){return db[_0x4a6e('0x3b')][_0x4a6e('0x43')](_0x46e424[_0x4a6e('0x44')],{})['then'](respondWithResult(_0x28bd1d,0xc9))[_0x4a6e('0x3d')](handleError(_0x28bd1d,null));};exports[_0x4a6e('0x45')]=function(_0xb9fff1,_0x1dccad){if(_0xb9fff1[_0x4a6e('0x44')]['id']){delete _0xb9fff1['body']['id'];}return db['MailTransferReport']['find']({'where':{'id':_0xb9fff1[_0x4a6e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1dccad,null))[_0x4a6e('0x22')](saveUpdates(_0xb9fff1[_0x4a6e('0x44')],null))[_0x4a6e('0x22')](respondWithResult(_0x1dccad,null))[_0x4a6e('0x3d')](handleError(_0x1dccad,null));};exports['destroy']=function(_0x2e94cd,_0x4d2978){return db[_0x4a6e('0x3b')]['find']({'where':{'id':_0x2e94cd[_0x4a6e('0x3f')]['id']}})[_0x4a6e('0x22')](handleEntityNotFound(_0x4d2978,null))[_0x4a6e('0x22')](removeEntity(_0x4d2978,null))[_0x4a6e('0x3d')](handleError(_0x4d2978,null));};exports['describe']=function(_0x1cff83,_0x381813){return db[_0x4a6e('0x3b')]['describe']()[_0x4a6e('0x22')](respondWithResult(_0x381813,null))['catch'](handleError(_0x381813,null));}; \ No newline at end of file +var _0xe558=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query'];(function(_0x4c3d39,_0x232f75){var _0x5b754c=function(_0x2a08d7){while(--_0x2a08d7){_0x4c3d39['push'](_0x4c3d39['shift']());}};_0x5b754c(++_0x232f75);}(_0xe558,0x67));var _0x8e55=function(_0x49828d,_0x27ddef){_0x49828d=_0x49828d-0x0;var _0x32bb03=_0xe558[_0x49828d];return _0x32bb03;};'use strict';var emlformat=require(_0x8e55('0x0'));var rimraf=require(_0x8e55('0x1'));var zipdir=require(_0x8e55('0x2'));var jsonpatch=require(_0x8e55('0x3'));var rp=require(_0x8e55('0x4'));var moment=require(_0x8e55('0x5'));var BPromise=require(_0x8e55('0x6'));var Mustache=require(_0x8e55('0x7'));var util=require(_0x8e55('0x8'));var path=require(_0x8e55('0x9'));var sox=require(_0x8e55('0xa'));var csv=require(_0x8e55('0xb'));var ejs=require(_0x8e55('0xc'));var fs=require('fs');var fs_extra=require(_0x8e55('0xd'));var _=require(_0x8e55('0xe'));var squel=require('squel');var crypto=require(_0x8e55('0xf'));var jsforce=require(_0x8e55('0x10'));var deskjs=require(_0x8e55('0x11'));var toCsv=require(_0x8e55('0xb'));var querystring=require(_0x8e55('0x12'));var Papa=require(_0x8e55('0x13'));var Redis=require(_0x8e55('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e55('0x15'));var hardwareService=require(_0x8e55('0x16'));var logger=require(_0x8e55('0x17'))(_0x8e55('0x18'));var utils=require(_0x8e55('0x19'));var config=require(_0x8e55('0x1a'));var licenseUtil=require(_0x8e55('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18503e,_0x44e33c){_0x44e33c=_0x44e33c||0xcc;return function(_0x549d72){if(_0x549d72){return _0x18503e[_0x8e55('0x1c')](_0x44e33c);}return _0x18503e['status'](_0x44e33c)[_0x8e55('0x1d')]();};}function respondWithResult(_0xe89d2b,_0x241210){_0x241210=_0x241210||0xc8;return function(_0xba742){if(_0xba742){return _0xe89d2b['status'](_0x241210)[_0x8e55('0x1e')](_0xba742);}};}function respondWithFilteredResult(_0xe7b901,_0x311d92){return function(_0x2d690a){if(_0x2d690a){var _0x379249=typeof _0x311d92[_0x8e55('0x1f')]===_0x8e55('0x20')&&typeof _0x311d92[_0x8e55('0x21')]===_0x8e55('0x20');var _0x3a70de=_0x2d690a[_0x8e55('0x22')];var _0x197ec6=_0x379249?0x0:_0x311d92[_0x8e55('0x1f')];var _0x234e04=_0x379249?_0x2d690a[_0x8e55('0x22')]:_0x311d92['offset']+_0x311d92['limit'];var _0x14f162;if(_0x234e04>=_0x3a70de){_0x234e04=_0x3a70de;_0x14f162=0xc8;}else{_0x14f162=0xce;}_0xe7b901[_0x8e55('0x23')](_0x14f162);return _0xe7b901[_0x8e55('0x24')](_0x8e55('0x25'),_0x197ec6+'-'+_0x234e04+'/'+_0x3a70de)[_0x8e55('0x1e')](_0x2d690a);}return null;};}function patchUpdates(_0x2f269b){return function(_0x2b5fdc){try{jsonpatch[_0x8e55('0x26')](_0x2b5fdc,_0x2f269b,!![]);}catch(_0x7dee81){return BPromise['reject'](_0x7dee81);}return _0x2b5fdc[_0x8e55('0x27')]();};}function saveUpdates(_0x1cc35d,_0x3eb9b0){return function(_0x197656){if(_0x197656){return _0x197656[_0x8e55('0x28')](_0x1cc35d)[_0x8e55('0x29')](function(_0x314b1a){return _0x314b1a;});}return null;};}function removeEntity(_0xb2e461,_0x254dec){return function(_0x790dcb){if(_0x790dcb){return _0x790dcb[_0x8e55('0x2a')]()['then'](function(){_0xb2e461['status'](0xcc)[_0x8e55('0x1d')]();});}};}function handleEntityNotFound(_0x2c84c8,_0x77bcc0){return function(_0x219578){if(!_0x219578){_0x2c84c8[_0x8e55('0x1c')](0x194);}return _0x219578;};}function handleError(_0x4fb170,_0x1ed7aa){_0x1ed7aa=_0x1ed7aa||0x1f4;return function(_0x50d740){logger[_0x8e55('0x2b')](_0x50d740[_0x8e55('0x2c')]);if(_0x50d740[_0x8e55('0x2d')]){delete _0x50d740[_0x8e55('0x2d')];}_0x4fb170[_0x8e55('0x23')](_0x1ed7aa)[_0x8e55('0x2e')](_0x50d740);};}exports[_0x8e55('0x2f')]=function(_0x2b7ca2,_0x132496){var _0x3ffefc={},_0x4e9e5c={},_0xe3019a={'count':0x0,'rows':[]};var _0x253631=_[_0x8e55('0x30')](db[_0x8e55('0x31')][_0x8e55('0x32')],function(_0x3f5897){return{'name':_0x3f5897[_0x8e55('0x33')],'type':_0x3f5897[_0x8e55('0x34')]['key']};});_0x4e9e5c[_0x8e55('0x35')]=_['map'](_0x253631,'name');_0x4e9e5c[_0x8e55('0x36')]=_['keys'](_0x2b7ca2[_0x8e55('0x36')]);_0x4e9e5c[_0x8e55('0x37')]=_[_0x8e55('0x38')](_0x4e9e5c[_0x8e55('0x35')],_0x4e9e5c[_0x8e55('0x36')]);_0x3ffefc[_0x8e55('0x39')]=_['intersection'](_0x4e9e5c[_0x8e55('0x35')],qs[_0x8e55('0x3a')](_0x2b7ca2[_0x8e55('0x36')][_0x8e55('0x3a')]));_0x3ffefc[_0x8e55('0x39')]=_0x3ffefc[_0x8e55('0x39')][_0x8e55('0x3b')]?_0x3ffefc['attributes']:_0x4e9e5c['model'];if(!_0x2b7ca2[_0x8e55('0x36')][_0x8e55('0x3c')](_0x8e55('0x3d'))){_0x3ffefc['limit']=qs[_0x8e55('0x21')](_0x2b7ca2[_0x8e55('0x36')]['limit']);_0x3ffefc['offset']=qs['offset'](_0x2b7ca2[_0x8e55('0x36')][_0x8e55('0x1f')]);}_0x3ffefc['order']=qs[_0x8e55('0x3e')](_0x2b7ca2[_0x8e55('0x36')][_0x8e55('0x3e')]);_0x3ffefc[_0x8e55('0x3f')]=qs[_0x8e55('0x37')](_[_0x8e55('0x40')](_0x2b7ca2[_0x8e55('0x36')],_0x4e9e5c[_0x8e55('0x37')]),_0x253631);if(_0x2b7ca2[_0x8e55('0x36')]['filter']){_0x3ffefc[_0x8e55('0x3f')]=_['merge'](_0x3ffefc['where'],{'$or':_[_0x8e55('0x30')](_0x253631,function(_0x3d3915){if(_0x3d3915['type']!==_0x8e55('0x41')){var _0xec121a={};_0xec121a[_0x3d3915[_0x8e55('0x2d')]]={'$like':'%'+_0x2b7ca2[_0x8e55('0x36')][_0x8e55('0x42')]+'%'};return _0xec121a;}})});}_0x3ffefc=_[_0x8e55('0x43')]({},_0x3ffefc,_0x2b7ca2[_0x8e55('0x44')]);var _0x3af274={'where':_0x3ffefc[_0x8e55('0x3f')]};return db['MailTransferReport']['count'](_0x3af274)[_0x8e55('0x29')](function(_0x73040e){_0xe3019a['count']=_0x73040e;if(_0x2b7ca2[_0x8e55('0x36')][_0x8e55('0x45')]){_0x3ffefc[_0x8e55('0x46')]=[{'all':!![]}];}return db['MailTransferReport'][_0x8e55('0x47')](_0x3ffefc);})['then'](function(_0x2944c3){_0xe3019a['rows']=_0x2944c3;return _0xe3019a;})[_0x8e55('0x29')](respondWithFilteredResult(_0x132496,_0x3ffefc))[_0x8e55('0x48')](handleError(_0x132496,null));};exports[_0x8e55('0x49')]=function(_0xc58996,_0x17db38){var _0x1b6213={'raw':!![],'where':{'id':_0xc58996[_0x8e55('0x4a')]['id']}},_0x1a920a={};_0x1a920a[_0x8e55('0x35')]=_['keys'](db['MailTransferReport'][_0x8e55('0x32')]);_0x1a920a[_0x8e55('0x36')]=_[_0x8e55('0x4b')](_0xc58996[_0x8e55('0x36')]);_0x1a920a[_0x8e55('0x37')]=_[_0x8e55('0x38')](_0x1a920a[_0x8e55('0x35')],_0x1a920a[_0x8e55('0x36')]);_0x1b6213['attributes']=_[_0x8e55('0x38')](_0x1a920a[_0x8e55('0x35')],qs[_0x8e55('0x3a')](_0xc58996[_0x8e55('0x36')]['fields']));_0x1b6213[_0x8e55('0x39')]=_0x1b6213['attributes'][_0x8e55('0x3b')]?_0x1b6213[_0x8e55('0x39')]:_0x1a920a['model'];if(_0xc58996['query']['includeAll']){_0x1b6213[_0x8e55('0x46')]=[{'all':!![]}];}_0x1b6213=_[_0x8e55('0x43')]({},_0x1b6213,_0xc58996['options']);return db[_0x8e55('0x31')]['find'](_0x1b6213)[_0x8e55('0x29')](handleEntityNotFound(_0x17db38,null))['then'](respondWithResult(_0x17db38,null))[_0x8e55('0x48')](handleError(_0x17db38,null));};exports[_0x8e55('0x4c')]=function(_0x174275,_0x5e86fa){return db[_0x8e55('0x31')]['create'](_0x174275['body'],{})['then'](respondWithResult(_0x5e86fa,0xc9))[_0x8e55('0x48')](handleError(_0x5e86fa,null));};exports[_0x8e55('0x28')]=function(_0x254810,_0x4f11d7){if(_0x254810[_0x8e55('0x4d')]['id']){delete _0x254810[_0x8e55('0x4d')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x254810[_0x8e55('0x4a')]['id']}})[_0x8e55('0x29')](handleEntityNotFound(_0x4f11d7,null))['then'](saveUpdates(_0x254810[_0x8e55('0x4d')],null))[_0x8e55('0x29')](respondWithResult(_0x4f11d7,null))[_0x8e55('0x48')](handleError(_0x4f11d7,null));};exports['destroy']=function(_0xa13a10,_0x190313){return db[_0x8e55('0x31')]['find']({'where':{'id':_0xa13a10[_0x8e55('0x4a')]['id']}})[_0x8e55('0x29')](handleEntityNotFound(_0x190313,null))[_0x8e55('0x29')](removeEntity(_0x190313,null))[_0x8e55('0x48')](handleError(_0x190313,null));};exports[_0x8e55('0x4e')]=function(_0x3a6db0,_0x3c8745){return db['MailTransferReport'][_0x8e55('0x4e')]()['then'](respondWithResult(_0x3c8745,null))[_0x8e55('0x48')](handleError(_0x3c8745,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ec556ea..8937831 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 _0xa234=['../../config/logger','api','moment','request-promise','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util'];(function(_0x7e03a4,_0x1a3647){var _0x10b7fa=function(_0x19bc01){while(--_0x19bc01){_0x7e03a4['push'](_0x7e03a4['shift']());}};_0x10b7fa(++_0x1a3647);}(_0xa234,0x142));var _0x4a23=function(_0x151acc,_0x1ac474){_0x151acc=_0x151acc-0x0;var _0x30197e=_0xa234[_0x151acc];return _0x30197e;};'use strict';var _=require(_0x4a23('0x0'));var util=require(_0x4a23('0x1'));var logger=require(_0x4a23('0x2'))(_0x4a23('0x3'));var moment=require(_0x4a23('0x4'));var BPromise=require('bluebird');var rp=require(_0x4a23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a23('0x6'));var config=require('../../config/environment');var attributes=require(_0x4a23('0x7'));module[_0x4a23('0x8')]=function(_0x21b7e0,_0x21f137){return _0x21b7e0[_0x4a23('0x9')](_0x4a23('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x4a23('0xb'),'fields':[_0x4a23('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe81d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x4dca36,_0x5c800b){var _0x23db63=function(_0x361230){while(--_0x361230){_0x4dca36['push'](_0x4dca36['shift']());}};_0x23db63(++_0x5c800b);}(_0xe81d,0xc4));var _0xde81=function(_0x476fad,_0x59d206){_0x476fad=_0x476fad-0x0;var _0x54fd2e=_0xe81d[_0x476fad];return _0x54fd2e;};'use strict';var _=require(_0xde81('0x0'));var util=require(_0xde81('0x1'));var logger=require(_0xde81('0x2'))(_0xde81('0x3'));var moment=require(_0xde81('0x4'));var BPromise=require(_0xde81('0x5'));var rp=require(_0xde81('0x6'));var fs=require('fs');var path=require(_0xde81('0x7'));var rimraf=require(_0xde81('0x8'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0xde81('0x9')]=function(_0x29bb24,_0x4b9051){return _0x29bb24[_0xde81('0xa')](_0xde81('0xb'),attributes,{'tableName':_0xde81('0xc'),'paranoid':![],'indexes':[{'name':_0xde81('0xd'),'fields':[_0xde81('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 6b6d2c9..d99970f 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 _0x0696=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2b78ba,_0x413855){var _0x3db271=function(_0x41d997){while(--_0x41d997){_0x2b78ba['push'](_0x2b78ba['shift']());}};_0x3db271(++_0x413855);}(_0x0696,0x15a));var _0x6069=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x0696[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x6069('0x0'));var util=require(_0x6069('0x1'));var moment=require(_0x6069('0x2'));var BPromise=require('bluebird');var rs=require(_0x6069('0x3'));var fs=require('fs');var Redis=require(_0x6069('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6069('0x5'));var logger=require(_0x6069('0x6'))('rpc');var config=require(_0x6069('0x7'));var jayson=require(_0x6069('0x8'));var client=jayson[_0x6069('0x9')][_0x6069('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18751b,_0x10731e,_0x290d2a){return new BPromise(function(_0x3cac42,_0x33e8ef){return client[_0x6069('0xb')](_0x18751b,_0x290d2a)['then'](function(_0x2162d7){logger['info'](_0x6069('0xc'),_0x10731e,_0x6069('0xd'));logger[_0x6069('0xe')](_0x6069('0xf'),_0x10731e,'request\x20sent',JSON['stringify'](_0x2162d7));if(_0x2162d7[_0x6069('0x10')]){if(_0x2162d7[_0x6069('0x10')][_0x6069('0x11')]===0x1f4){logger[_0x6069('0x10')](_0x6069('0xc'),_0x10731e,_0x2162d7[_0x6069('0x10')][_0x6069('0x12')]);return _0x33e8ef(_0x2162d7[_0x6069('0x10')][_0x6069('0x12')]);}logger[_0x6069('0x10')](_0x6069('0xc'),_0x10731e,_0x2162d7[_0x6069('0x10')][_0x6069('0x12')]);return _0x3cac42(_0x2162d7[_0x6069('0x10')]['message']);}else{logger['info'](_0x6069('0xc'),_0x10731e,_0x6069('0xd'));_0x3cac42(_0x2162d7['result']['message']);}})[_0x6069('0x13')](function(_0x35282e){logger[_0x6069('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x10731e,_0x35282e);_0x33e8ef(_0x35282e);});});} \ No newline at end of file +var _0xd146=['client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd146,0x139));var _0x6d14=function(_0x126266,_0x11557a){_0x126266=_0x126266-0x0;var _0x585932=_0xd146[_0x126266];return _0x585932;};'use strict';var _=require(_0x6d14('0x0'));var util=require('util');var moment=require(_0x6d14('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d14('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d14('0x3'));var logger=require(_0x6d14('0x4'))('rpc');var config=require(_0x6d14('0x5'));var jayson=require(_0x6d14('0x6'));var client=jayson[_0x6d14('0x7')][_0x6d14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bb74d,_0x2f1709,_0x2935a7){return new BPromise(function(_0x4430d3,_0x2d6749){return client[_0x6d14('0x9')](_0x2bb74d,_0x2935a7)['then'](function(_0x5a8652){logger[_0x6d14('0xa')](_0x6d14('0xb'),_0x2f1709,_0x6d14('0xc'));logger[_0x6d14('0xd')](_0x6d14('0xe'),_0x2f1709,_0x6d14('0xc'),JSON[_0x6d14('0xf')](_0x5a8652));if(_0x5a8652[_0x6d14('0x10')]){if(_0x5a8652['error'][_0x6d14('0x11')]===0x1f4){logger[_0x6d14('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x2f1709,_0x5a8652[_0x6d14('0x10')][_0x6d14('0x12')]);return _0x2d6749(_0x5a8652['error'][_0x6d14('0x12')]);}logger[_0x6d14('0x10')](_0x6d14('0xb'),_0x2f1709,_0x5a8652[_0x6d14('0x10')][_0x6d14('0x12')]);return _0x4430d3(_0x5a8652['error'][_0x6d14('0x12')]);}else{logger['info'](_0x6d14('0xb'),_0x2f1709,'request\x20sent');_0x4430d3(_0x5a8652['result'][_0x6d14('0x12')]);}})[_0x6d14('0x13')](function(_0x26c33b){logger[_0x6d14('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x2f1709,_0x26c33b);_0x2d6749(_0x26c33b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ad6372d..0f0414e 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 _0xe916=['index','/describe','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x30f110,_0x3088c7){var _0x547266=function(_0x446848){while(--_0x446848){_0x30f110['push'](_0x30f110['shift']());}};_0x547266(++_0x3088c7);}(_0xe916,0x184));var _0x6e91=function(_0x3cde46,_0x46d289){_0x3cde46=_0x3cde46-0x0;var _0x469b46=_0xe916[_0x3cde46];return _0x469b46;};'use strict';var multer=require(_0x6e91('0x0'));var util=require(_0x6e91('0x1'));var path=require(_0x6e91('0x2'));var timeout=require(_0x6e91('0x3'));var express=require(_0x6e91('0x4'));var router=express[_0x6e91('0x5')]();var fs_extra=require(_0x6e91('0x6'));var auth=require(_0x6e91('0x7'));var interaction=require(_0x6e91('0x8'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x6e91('0x9')]('/',auth[_0x6e91('0xa')](),controller[_0x6e91('0xb')]);router[_0x6e91('0x9')](_0x6e91('0xc'),auth[_0x6e91('0xa')](),controller['describe']);router[_0x6e91('0x9')](_0x6e91('0xd'),auth['isAuthenticated'](),controller[_0x6e91('0xe')]);router[_0x6e91('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e91('0x10')](_0x6e91('0xd'),auth[_0x6e91('0xa')](),controller['update']);router[_0x6e91('0x11')](_0x6e91('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e91('0x12')]=router; \ No newline at end of file +var _0xa589=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','put','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa589,0xd1));var _0x9a58=function(_0x5cd7fd,_0x4de617){_0x5cd7fd=_0x5cd7fd-0x0;var _0x5213ae=_0xa589[_0x5cd7fd];return _0x5213ae;};'use strict';var multer=require(_0x9a58('0x0'));var util=require(_0x9a58('0x1'));var path=require(_0x9a58('0x2'));var timeout=require(_0x9a58('0x3'));var express=require('express');var router=express[_0x9a58('0x4')]();var fs_extra=require(_0x9a58('0x5'));var auth=require(_0x9a58('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9a58('0x7'));var controller=require(_0x9a58('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9a58('0x9')]);router[_0x9a58('0xa')](_0x9a58('0xb'),auth[_0x9a58('0xc')](),controller[_0x9a58('0xd')]);router[_0x9a58('0xa')](_0x9a58('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x9a58('0xf')]('/',auth[_0x9a58('0xc')](),controller['create']);router[_0x9a58('0x10')](_0x9a58('0xe'),auth[_0x9a58('0xc')](),controller['update']);router[_0x9a58('0x11')]('/:id',auth[_0x9a58('0xc')](),controller[_0x9a58('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index cc15fe1..df5cd0e 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 _0x9a00=['moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x51cf29,_0x10397c){var _0x1998c8=function(_0x2b98f2){while(--_0x2b98f2){_0x51cf29['push'](_0x51cf29['shift']());}};_0x1998c8(++_0x10397c);}(_0x9a00,0x18f));var _0x09a0=function(_0x261405,_0x40f7b0){_0x261405=_0x261405-0x0;var _0x212710=_0x9a00[_0x261405];return _0x212710;};'use strict';var Sequelize=require(_0x09a0('0x0'));var moment=require(_0x09a0('0x1'));module['exports']={'channel':{'type':Sequelize[_0x09a0('0x2')]},'membername':{'type':Sequelize[_0x09a0('0x2')]},'interface':{'type':Sequelize[_0x09a0('0x2')]},'type':{'type':Sequelize[_0x09a0('0x2')],'defaultValue':_0x09a0('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x09a0('0x4')]},'enterAt':{'type':Sequelize[_0x09a0('0x5')]},'exitAt':{'type':Sequelize[_0x09a0('0x5')],'set':function(_0x4a7df5){var _0xfe9d7a=moment(_0x4a7df5);var _0x3e690e=moment(this['getDataValue'](_0x09a0('0x6')));var _0x912bc6=_0xfe9d7a[_0x09a0('0x7')](_0x3e690e,_0x09a0('0x8'));this[_0x09a0('0x9')](_0x09a0('0xa'),_0x4a7df5);this[_0x09a0('0x9')](_0x09a0('0xb'),_0x912bc6>=0x0?_0x912bc6:null);}},'data1':{'type':Sequelize[_0x09a0('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x09a0('0x2')],'comment':_0x09a0('0xc')},'data3':{'type':Sequelize[_0x09a0('0x2')],'comment':_0x09a0('0xd')},'data4':{'type':Sequelize[_0x09a0('0x2')],'comment':_0x09a0('0xe')},'data5':{'type':Sequelize[_0x09a0('0x2')],'comment':_0x09a0('0xf')},'role':{'type':Sequelize[_0x09a0('0x2')]},'internal':{'type':Sequelize[_0x09a0('0x4')]},'uniqueid':{'type':Sequelize[_0x09a0('0x2')]}}; \ No newline at end of file +var _0x4055=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x196a4d,_0x3f3691){var _0x38d2e6=function(_0xb55c14){while(--_0xb55c14){_0x196a4d['push'](_0x196a4d['shift']());}};_0x38d2e6(++_0x3f3691);}(_0x4055,0x7e));var _0x5405=function(_0x223b0c,_0x371c5a){_0x223b0c=_0x223b0c-0x0;var _0x4ce5ed=_0x4055[_0x223b0c];return _0x4ce5ed;};'use strict';var Sequelize=require(_0x5405('0x0'));var moment=require(_0x5405('0x1'));module[_0x5405('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5405('0x3')]},'interface':{'type':Sequelize[_0x5405('0x3')]},'type':{'type':Sequelize[_0x5405('0x3')],'defaultValue':_0x5405('0x4'),'comment':_0x5405('0x5')},'duration':{'type':Sequelize[_0x5405('0x6')]},'enterAt':{'type':Sequelize[_0x5405('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5c0255){var _0x439db9=moment(_0x5c0255);var _0x5275fc=moment(this[_0x5405('0x8')](_0x5405('0x9')));var _0x353fd7=_0x439db9[_0x5405('0xa')](_0x5275fc,_0x5405('0xb'));this[_0x5405('0xc')](_0x5405('0xd'),_0x5c0255);this[_0x5405('0xc')](_0x5405('0xe'),_0x353fd7>=0x0?_0x353fd7:null);}},'data1':{'type':Sequelize[_0x5405('0x3')],'comment':_0x5405('0xf')},'data2':{'type':Sequelize['STRING'],'comment':_0x5405('0x10')},'data3':{'type':Sequelize['STRING'],'comment':_0x5405('0x11')},'data4':{'type':Sequelize[_0x5405('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x5405('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5405('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 52969bb..eedf53b 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(_0x46c65b,_0x186add){var _0x2385d2=function(_0x41de85){while(--_0x41de85){_0x46c65b['push'](_0x46c65b['shift']());}};_0x2385d2(++_0x186add);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','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','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a327e,_0x63ea19){_0x1a327e=_0x1a327e-0x0;var _0x519df7=_0xedd9[_0x1a327e];return _0x519df7;};'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={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 21909c7..347c185 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 _0xadc2=['interface','lodash','../../config/logger','api','bluebird','request-promise','path','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername'];(function(_0x56f4f2,_0x2fd8c0){var _0x2a27e1=function(_0xa4498f){while(--_0xa4498f){_0x56f4f2['push'](_0x56f4f2['shift']());}};_0x2a27e1(++_0x2fd8c0);}(_0xadc2,0x187));var _0x2adc=function(_0x32bf57,_0x5b9afe){_0x32bf57=_0x32bf57-0x0;var _0x5b3549=_0xadc2[_0x32bf57];return _0x5b3549;};'use strict';var _=require(_0x2adc('0x0'));var util=require('util');var logger=require(_0x2adc('0x1'))(_0x2adc('0x2'));var moment=require('moment');var BPromise=require(_0x2adc('0x3'));var rp=require(_0x2adc('0x4'));var fs=require('fs');var path=require(_0x2adc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2adc('0x6'));module['exports']=function(_0x38b07c,_0x4ca949){return _0x38b07c[_0x2adc('0x7')](_0x2adc('0x8'),attributes,{'tableName':_0x2adc('0x9'),'paranoid':![],'indexes':[{'name':_0x2adc('0xa'),'fields':[_0x2adc('0xb'),_0x2adc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d54=['report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./memberReport.attributes','exports','MemberReport'];(function(_0x1304ed,_0x23e894){var _0x1592d7=function(_0x4bf87e){while(--_0x4bf87e){_0x1304ed['push'](_0x1304ed['shift']());}};_0x1592d7(++_0x23e894);}(_0x1d54,0x100));var _0x41d5=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x1d54[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x41d5('0x0'));var util=require('util');var logger=require(_0x41d5('0x1'))(_0x41d5('0x2'));var moment=require(_0x41d5('0x3'));var BPromise=require(_0x41d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41d5('0x5'));var rimraf=require(_0x41d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x41d5('0x7'));module[_0x41d5('0x8')]=function(_0x9e48ad,_0x44442b){return _0x9e48ad['define'](_0x41d5('0x9'),attributes,{'tableName':_0x41d5('0xa'),'paranoid':![],'indexes':[{'name':_0x41d5('0xb'),'fields':[_0x41d5('0xc'),_0x41d5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 0326b71..c537162 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 _0x9e2e=['map','model','info','debug','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMemberReport','findAll','options','where','attributes','include'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x5d4510,_0x5aa2c8){_0x5d4510=_0x5d4510-0x0;var _0x3dfae0=_0x9e2e[_0x5d4510];return _0x3dfae0;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var moment=require(_0xe9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9e2('0x4'));var logger=require(_0xe9e2('0x5'))(_0xe9e2('0x6'));var config=require(_0xe9e2('0x7'));var jayson=require(_0xe9e2('0x8'));var client=jayson[_0xe9e2('0x9')][_0xe9e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca0aa,_0x118600,_0x4f1ef7){return new BPromise(function(_0x2bec58,_0x1ade12){return client['request'](_0x5ca0aa,_0x4f1ef7)[_0xe9e2('0xb')](function(_0x48882a){logger['info'](_0xe9e2('0xc'),_0x118600,_0xe9e2('0xd'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x118600,_0xe9e2('0xd'),JSON[_0xe9e2('0xe')](_0x48882a));if(_0x48882a[_0xe9e2('0xf')]){if(_0x48882a[_0xe9e2('0xf')]['code']===0x1f4){logger['error'](_0xe9e2('0xc'),_0x118600,_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);return _0x1ade12(_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);}logger[_0xe9e2('0xf')](_0xe9e2('0xc'),_0x118600,_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);return _0x2bec58(_0x48882a[_0xe9e2('0xf')]['message']);}else{logger['info'](_0xe9e2('0xc'),_0x118600,'request\x20sent');_0x2bec58(_0x48882a['result'][_0xe9e2('0x10')]);}})[_0xe9e2('0x11')](function(_0x3550ce){logger[_0xe9e2('0xf')](_0xe9e2('0xc'),_0x118600,_0x3550ce);_0x1ade12(_0x3550ce);});});}exports[_0xe9e2('0x12')]=function(_0x5f3fc8){var _0xdf6f78=this;return new Promise(function(_0x2094fc,_0x3b6637){return db['MemberReport'][_0xe9e2('0x13')]({'raw':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x15')]||null:null,'attributes':_0x5f3fc8['options']?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x16')]||null:null,'limit':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')]['limit']||null:null,'include':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x17')],function(_0x26ce3d){return{'model':db[_0x26ce3d[_0xe9e2('0x19')]],'as':_0x26ce3d['as'],'attributes':_0x26ce3d[_0xe9e2('0x16')],'include':_0x26ce3d[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x26ce3d[_0xe9e2('0x17')],function(_0x2a3d69){return{'model':db[_0x2a3d69[_0xe9e2('0x19')]],'as':_0x2a3d69['as'],'attributes':_0x2a3d69[_0xe9e2('0x16')],'include':_0x2a3d69[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x2a3d69['include'],function(_0x43445d){return{'model':db[_0x43445d[_0xe9e2('0x19')]],'as':_0x43445d['as'],'attributes':_0x43445d[_0xe9e2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe9e2('0xb')](function(_0x57254c){logger[_0xe9e2('0x1a')](_0xe9e2('0x12'),_0x5f3fc8);logger[_0xe9e2('0x1b')](_0xe9e2('0x12'),_0x5f3fc8,JSON[_0xe9e2('0xe')](_0x57254c));_0x2094fc(_0x57254c);})['catch'](function(_0x4cf43f){logger[_0xe9e2('0xf')](_0xe9e2('0x12'),_0x4cf43f[_0xe9e2('0x10')],_0x5f3fc8);_0x3b6637(_0xdf6f78[_0xe9e2('0xf')](0x1f4,_0x4cf43f[_0xe9e2('0x10')]));});});};exports[_0xe9e2('0x1c')]=function(_0x5da7b3){var _0x29d238=this;return new Promise(function(_0x546961,_0x227b7e){return db[_0xe9e2('0x1d')][_0xe9e2('0x1e')](_0x5da7b3[_0xe9e2('0x1f')],{'raw':_0x5da7b3[_0xe9e2('0x14')]?_0x5da7b3['options']['raw']===undefined?!![]:![]:!![]})[_0xe9e2('0xb')](function(_0xecccbc){logger['info'](_0xe9e2('0x1c'),_0x5da7b3);logger[_0xe9e2('0x1b')](_0xe9e2('0x1c'),_0x5da7b3,JSON['stringify'](_0xecccbc));_0x546961(_0xecccbc);})[_0xe9e2('0x11')](function(_0x414eef){logger[_0xe9e2('0xf')](_0xe9e2('0x1c'),_0x414eef['message'],_0x5da7b3);_0x227b7e(_0x29d238[_0xe9e2('0xf')](0x1f4,_0x414eef[_0xe9e2('0x10')]));});});};exports[_0xe9e2('0x20')]=function(_0x4a84bd){var _0x47e133=this;return new Promise(function(_0x3f66ab,_0x102b06){return db[_0xe9e2('0x1d')][_0xe9e2('0x21')](_0x4a84bd[_0xe9e2('0x1f')],{'raw':_0x4a84bd[_0xe9e2('0x14')]?_0x4a84bd[_0xe9e2('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a84bd['options']?_0x4a84bd[_0xe9e2('0x14')]['where']||null:null,'attributes':_0x4a84bd[_0xe9e2('0x14')]?_0x4a84bd[_0xe9e2('0x14')]['attributes']||null:null,'limit':_0x4a84bd[_0xe9e2('0x14')]?_0x4a84bd[_0xe9e2('0x14')]['limit']||null:null})[_0xe9e2('0xb')](function(_0x302d4d){logger['info']('UpdateMemberReport',_0x4a84bd);logger[_0xe9e2('0x1b')](_0xe9e2('0x20'),_0x4a84bd,JSON[_0xe9e2('0xe')](_0x302d4d));_0x3f66ab(_0x302d4d);})['catch'](function(_0x41a3bb){logger['error'](_0xe9e2('0x20'),_0x41a3bb[_0xe9e2('0x10')],_0x4a84bd);_0x102b06(_0x47e133[_0xe9e2('0xf')](0x1f4,_0x41a3bb[_0xe9e2('0x10')]));});});}; \ No newline at end of file +var _0x8c46=['findAll','options','raw','where','attributes','limit','include','model','map','then','catch','CreateMemberReport','create','body','debug','update','UpdateMemberReport','stringify','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMemberReport','MemberReport'];(function(_0x345eaa,_0x2651bd){var _0x424f8f=function(_0x414d93){while(--_0x414d93){_0x345eaa['push'](_0x345eaa['shift']());}};_0x424f8f(++_0x2651bd);}(_0x8c46,0x171));var _0x68c4=function(_0x5c216f,_0x18cc2d){_0x5c216f=_0x5c216f-0x0;var _0x2c26cd=_0x8c46[_0x5c216f];return _0x2c26cd;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68c4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68c4('0x2'))['db'];var utils=require(_0x68c4('0x3'));var logger=require(_0x68c4('0x4'))(_0x68c4('0x5'));var config=require(_0x68c4('0x6'));var jayson=require(_0x68c4('0x7'));var client=jayson[_0x68c4('0x8')][_0x68c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3da9c3,_0x458a2b,_0x5e57ce){return new BPromise(function(_0x1754d7,_0x1d40a3){return client[_0x68c4('0xa')](_0x3da9c3,_0x5e57ce)['then'](function(_0x356698){logger[_0x68c4('0xb')](_0x68c4('0xc'),_0x458a2b,'request\x20sent');logger['debug'](_0x68c4('0xd'),_0x458a2b,_0x68c4('0xe'),JSON['stringify'](_0x356698));if(_0x356698['error']){if(_0x356698[_0x68c4('0xf')][_0x68c4('0x10')]===0x1f4){logger[_0x68c4('0xf')]('MemberReport,\x20%s,\x20%s',_0x458a2b,_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);return _0x1d40a3(_0x356698[_0x68c4('0xf')]['message']);}logger[_0x68c4('0xf')](_0x68c4('0xc'),_0x458a2b,_0x356698[_0x68c4('0xf')]['message']);return _0x1754d7(_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);}else{logger['info'](_0x68c4('0xc'),_0x458a2b,'request\x20sent');_0x1754d7(_0x356698[_0x68c4('0x12')]['message']);}})['catch'](function(_0xc2ea2f){logger[_0x68c4('0xf')]('MemberReport,\x20%s,\x20%s',_0x458a2b,_0xc2ea2f);_0x1d40a3(_0xc2ea2f);});});}exports[_0x68c4('0x13')]=function(_0x1d757c){var _0x38ac38=this;return new Promise(function(_0x33c5c5,_0x3a6300){return db[_0x68c4('0x14')][_0x68c4('0x15')]({'raw':_0x1d757c[_0x68c4('0x16')]?_0x1d757c[_0x68c4('0x16')][_0x68c4('0x17')]===undefined?!![]:![]:!![],'where':_0x1d757c[_0x68c4('0x16')]?_0x1d757c['options'][_0x68c4('0x18')]||null:null,'attributes':_0x1d757c['options']?_0x1d757c['options'][_0x68c4('0x19')]||null:null,'limit':_0x1d757c[_0x68c4('0x16')]?_0x1d757c[_0x68c4('0x16')][_0x68c4('0x1a')]||null:null,'include':_0x1d757c['options']?_0x1d757c[_0x68c4('0x16')][_0x68c4('0x1b')]?_['map'](_0x1d757c[_0x68c4('0x16')][_0x68c4('0x1b')],function(_0x45f9be){return{'model':db[_0x45f9be[_0x68c4('0x1c')]],'as':_0x45f9be['as'],'attributes':_0x45f9be[_0x68c4('0x19')],'include':_0x45f9be[_0x68c4('0x1b')]?_[_0x68c4('0x1d')](_0x45f9be['include'],function(_0x2ff4a5){return{'model':db[_0x2ff4a5['model']],'as':_0x2ff4a5['as'],'attributes':_0x2ff4a5[_0x68c4('0x19')],'include':_0x2ff4a5[_0x68c4('0x1b')]?_[_0x68c4('0x1d')](_0x2ff4a5['include'],function(_0x1e14db){return{'model':db[_0x1e14db[_0x68c4('0x1c')]],'as':_0x1e14db['as'],'attributes':_0x1e14db[_0x68c4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x68c4('0x1e')](function(_0x3b62a3){logger[_0x68c4('0xb')](_0x68c4('0x13'),_0x1d757c);logger['debug'](_0x68c4('0x13'),_0x1d757c,JSON['stringify'](_0x3b62a3));_0x33c5c5(_0x3b62a3);})[_0x68c4('0x1f')](function(_0x1442ba){logger['error'](_0x68c4('0x13'),_0x1442ba[_0x68c4('0x11')],_0x1d757c);_0x3a6300(_0x38ac38['error'](0x1f4,_0x1442ba[_0x68c4('0x11')]));});});};exports[_0x68c4('0x20')]=function(_0xc3131c){var _0x1d2b40=this;return new Promise(function(_0x233cea,_0x586dec){return db[_0x68c4('0x14')][_0x68c4('0x21')](_0xc3131c[_0x68c4('0x22')],{'raw':_0xc3131c[_0x68c4('0x16')]?_0xc3131c[_0x68c4('0x16')][_0x68c4('0x17')]===undefined?!![]:![]:!![]})[_0x68c4('0x1e')](function(_0x1ad882){logger[_0x68c4('0xb')](_0x68c4('0x20'),_0xc3131c);logger[_0x68c4('0x23')](_0x68c4('0x20'),_0xc3131c,JSON['stringify'](_0x1ad882));_0x233cea(_0x1ad882);})[_0x68c4('0x1f')](function(_0x194217){logger[_0x68c4('0xf')](_0x68c4('0x20'),_0x194217[_0x68c4('0x11')],_0xc3131c);_0x586dec(_0x1d2b40['error'](0x1f4,_0x194217[_0x68c4('0x11')]));});});};exports['UpdateMemberReport']=function(_0x586e9c){var _0x4dcd5b=this;return new Promise(function(_0xb86553,_0x3cc88f){return db[_0x68c4('0x14')][_0x68c4('0x24')](_0x586e9c['body'],{'raw':_0x586e9c[_0x68c4('0x16')]?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586e9c['options']?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x18')]||null:null,'attributes':_0x586e9c[_0x68c4('0x16')]?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x19')]||null:null,'limit':_0x586e9c[_0x68c4('0x16')]?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x1a')]||null:null})[_0x68c4('0x1e')](function(_0x54fdbe){logger['info']('UpdateMemberReport',_0x586e9c);logger[_0x68c4('0x23')](_0x68c4('0x25'),_0x586e9c,JSON[_0x68c4('0x26')](_0x54fdbe));_0xb86553(_0x54fdbe);})[_0x68c4('0x1f')](function(_0x260abf){logger[_0x68c4('0xf')](_0x68c4('0x25'),_0x260abf[_0x68c4('0x11')],_0x586e9c);_0x3cc88f(_0x4dcd5b[_0x68c4('0xf')](0x1f4,_0x260abf[_0x68c4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c5aa13f..4d4e8ab 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 _0x55ae=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','exports','path','connect-timeout','Router'];(function(_0x428de8,_0x1c46eb){var _0x4d4649=function(_0xd61ecd){while(--_0xd61ecd){_0x428de8['push'](_0x428de8['shift']());}};_0x4d4649(++_0x1c46eb);}(_0x55ae,0xde));var _0xe55a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x55ae[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe55a('0x0'));var timeout=require(_0xe55a('0x1'));var express=require('express');var router=express[_0xe55a('0x2')]();var fs_extra=require(_0xe55a('0x3'));var auth=require(_0xe55a('0x4'));var interaction=require(_0xe55a('0x5'));var config=require(_0xe55a('0x6'));var controller=require('./migration.controller');router['get']('/',controller[_0xe55a('0x7')]);module[_0xe55a('0x8')]=router; \ No newline at end of file +var _0x15c0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','path'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x15c0,0x77));var _0x015c=function(_0x585d51,_0x24d0c2){_0x585d51=_0x585d51-0x0;var _0x129e96=_0x15c0[_0x585d51];return _0x129e96;};'use strict';var multer=require(_0x015c('0x0'));var util=require('util');var path=require(_0x015c('0x1'));var timeout=require(_0x015c('0x2'));var express=require(_0x015c('0x3'));var router=express[_0x015c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x015c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x015c('0x6'));var controller=require(_0x015c('0x7'));router[_0x015c('0x8')]('/',controller[_0x015c('0x9')]);module[_0x015c('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 6086e4f..fd23101 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 _0x44ed=['exports','STRING','sequelize'];(function(_0x3eff40,_0x1cdf9e){var _0x4ee4fb=function(_0x4b7170){while(--_0x4b7170){_0x3eff40['push'](_0x3eff40['shift']());}};_0x4ee4fb(++_0x1cdf9e);}(_0x44ed,0xfe));var _0xd44e=function(_0x183a3c,_0xa4cc47){_0x183a3c=_0x183a3c-0x0;var _0x5c41d8=_0x44ed[_0x183a3c];return _0x5c41d8;};'use strict';var Sequelize=require(_0xd44e('0x0'));module[_0xd44e('0x1')]={'version':{'type':Sequelize[_0xd44e('0x2')],'unique':'version'}}; \ No newline at end of file +var _0x3129=['STRING','sequelize','exports'];(function(_0x5cb2ae,_0x5f47b1){var _0x41c89d=function(_0x2636cb){while(--_0x2636cb){_0x5cb2ae['push'](_0x5cb2ae['shift']());}};_0x41c89d(++_0x5f47b1);}(_0x3129,0x133));var _0x9312=function(_0x5ce12c,_0x14314d){_0x5ce12c=_0x5ce12c-0x0;var _0x528311=_0x3129[_0x5ce12c];return _0x528311;};'use strict';var Sequelize=require(_0x9312('0x0'));module[_0x9312('0x1')]={'version':{'type':Sequelize[_0x9312('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8ff516c..e1d58d2 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 _0xb935=['../../mysqldb','status','end','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','map','merge','options','Migration','includeAll','include','findAll','rows','catch','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x90c376,_0x1c154c){var _0xb3eff6=function(_0x198b46){while(--_0x198b46){_0x90c376['push'](_0x90c376['shift']());}};_0xb3eff6(++_0x1c154c);}(_0xb935,0xb0));var _0x5b93=function(_0x184404,_0x4eb401){_0x184404=_0x184404-0x0;var _0xef87a3=_0xb935[_0x184404];return _0xef87a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b93('0x0'));var zipdir=require(_0x5b93('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5b93('0x2'));var Mustache=require(_0x5b93('0x3'));var util=require(_0x5b93('0x4'));var path=require(_0x5b93('0x5'));var sox=require(_0x5b93('0x6'));var csv=require(_0x5b93('0x7'));var ejs=require(_0x5b93('0x8'));var fs=require('fs');var fs_extra=require(_0x5b93('0x9'));var _=require(_0x5b93('0xa'));var squel=require(_0x5b93('0xb'));var crypto=require('crypto');var jsforce=require(_0x5b93('0xc'));var deskjs=require(_0x5b93('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5b93('0xe'));var Papa=require(_0x5b93('0xf'));var Redis=require(_0x5b93('0x10'));var authService=require(_0x5b93('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5b93('0x12'));var hardwareService=require(_0x5b93('0x13'));var logger=require(_0x5b93('0x14'))(_0x5b93('0x15'));var utils=require(_0x5b93('0x16'));var config=require(_0x5b93('0x17'));var licenseUtil=require(_0x5b93('0x18'));var db=require(_0x5b93('0x19'))['db'];function respondWithStatusCode(_0x1e820d,_0x6e666d){_0x6e666d=_0x6e666d||0xcc;return function(_0x1fe7a0){if(_0x1fe7a0){return _0x1e820d['sendStatus'](_0x6e666d);}return _0x1e820d[_0x5b93('0x1a')](_0x6e666d)[_0x5b93('0x1b')]();};}function respondWithResult(_0x3c84b9,_0x2e82f5){_0x2e82f5=_0x2e82f5||0xc8;return function(_0x1523c1){if(_0x1523c1){return _0x3c84b9[_0x5b93('0x1a')](_0x2e82f5)['json'](_0x1523c1);}};}function respondWithFilteredResult(_0x4cf783,_0xe829c5){return function(_0x5e17f1){if(_0x5e17f1){var _0x17ae96=typeof _0xe829c5['offset']===_0x5b93('0x1c')&&typeof _0xe829c5['limit']==='undefined';var _0x2af7ae=_0x5e17f1[_0x5b93('0x1d')];var _0x347e48=_0x17ae96?0x0:_0xe829c5[_0x5b93('0x1e')];var _0x31051f=_0x17ae96?_0x5e17f1['count']:_0xe829c5['offset']+_0xe829c5['limit'];var _0x25af6d;if(_0x31051f>=_0x2af7ae){_0x31051f=_0x2af7ae;_0x25af6d=0xc8;}else{_0x25af6d=0xce;}_0x4cf783[_0x5b93('0x1a')](_0x25af6d);return _0x4cf783[_0x5b93('0x1f')](_0x5b93('0x20'),_0x347e48+'-'+_0x31051f+'/'+_0x2af7ae)['json'](_0x5e17f1);}return null;};}function patchUpdates(_0x3afd1){return function(_0x306ae9){try{jsonpatch[_0x5b93('0x21')](_0x306ae9,_0x3afd1,!![]);}catch(_0x31f3ce){return BPromise[_0x5b93('0x22')](_0x31f3ce);}return _0x306ae9[_0x5b93('0x23')]();};}function saveUpdates(_0x2446ff,_0x698b98){return function(_0x46103e){if(_0x46103e){return _0x46103e[_0x5b93('0x24')](_0x2446ff)[_0x5b93('0x25')](function(_0x4c8ed4){return _0x4c8ed4;});}return null;};}function removeEntity(_0x1a51ca,_0xc3e63d){return function(_0x4c98a3){if(_0x4c98a3){return _0x4c98a3['destroy']()['then'](function(){_0x1a51ca[_0x5b93('0x1a')](0xcc)[_0x5b93('0x1b')]();});}};}function handleEntityNotFound(_0x1e5649,_0x13d735){return function(_0x5f2456){if(!_0x5f2456){_0x1e5649['sendStatus'](0x194);}return _0x5f2456;};}function handleError(_0x2e90c9,_0x2c0181){_0x2c0181=_0x2c0181||0x1f4;return function(_0x3f7271){logger[_0x5b93('0x26')](_0x3f7271[_0x5b93('0x27')]);if(_0x3f7271[_0x5b93('0x28')]){delete _0x3f7271['name'];}_0x2e90c9[_0x5b93('0x1a')](_0x2c0181)[_0x5b93('0x29')](_0x3f7271);};}exports['index']=function(_0x5ab906,_0x4b7d06){var _0x32ce9d={},_0x5f2ef6={},_0x3bbb16={'count':0x0,'rows':[]};var _0x115eee=_['map'](db['Migration'][_0x5b93('0x2a')],function(_0x126ca0){return{'name':_0x126ca0[_0x5b93('0x2b')],'type':_0x126ca0['type'][_0x5b93('0x2c')]};});_0x5f2ef6['model']=_['map'](_0x115eee,_0x5b93('0x28'));_0x5f2ef6[_0x5b93('0x2d')]=_[_0x5b93('0x2e')](_0x5ab906[_0x5b93('0x2d')]);_0x5f2ef6[_0x5b93('0x2f')]=_[_0x5b93('0x30')](_0x5f2ef6['model'],_0x5f2ef6[_0x5b93('0x2d')]);_0x32ce9d['attributes']=_[_0x5b93('0x30')](_0x5f2ef6[_0x5b93('0x31')],qs['fields'](_0x5ab906[_0x5b93('0x2d')]['fields']));_0x32ce9d[_0x5b93('0x32')]=_0x32ce9d[_0x5b93('0x32')][_0x5b93('0x33')]?_0x32ce9d[_0x5b93('0x32')]:_0x5f2ef6['model'];if(!_0x5ab906[_0x5b93('0x2d')][_0x5b93('0x34')](_0x5b93('0x35'))){_0x32ce9d[_0x5b93('0x36')]=qs[_0x5b93('0x36')](_0x5ab906[_0x5b93('0x2d')][_0x5b93('0x36')]);_0x32ce9d['offset']=qs[_0x5b93('0x1e')](_0x5ab906[_0x5b93('0x2d')][_0x5b93('0x1e')]);}_0x32ce9d['order']=qs[_0x5b93('0x37')](_0x5ab906['query'][_0x5b93('0x37')]);_0x32ce9d[_0x5b93('0x38')]=qs['filters'](_['pick'](_0x5ab906[_0x5b93('0x2d')],_0x5f2ef6[_0x5b93('0x2f')]),_0x115eee);if(_0x5ab906['query'][_0x5b93('0x39')]){_0x32ce9d[_0x5b93('0x38')]=_['merge'](_0x32ce9d[_0x5b93('0x38')],{'$or':_[_0x5b93('0x3a')](_0x115eee,function(_0x41b79f){if(_0x41b79f['type']!=='VIRTUAL'){var _0x136aab={};_0x136aab[_0x41b79f['name']]={'$like':'%'+_0x5ab906['query'][_0x5b93('0x39')]+'%'};return _0x136aab;}})});}_0x32ce9d=_[_0x5b93('0x3b')]({},_0x32ce9d,_0x5ab906[_0x5b93('0x3c')]);var _0x4f4429={'where':_0x32ce9d[_0x5b93('0x38')]};return db[_0x5b93('0x3d')][_0x5b93('0x1d')](_0x4f4429)[_0x5b93('0x25')](function(_0x263b1b){_0x3bbb16['count']=_0x263b1b;if(_0x5ab906['query'][_0x5b93('0x3e')]){_0x32ce9d[_0x5b93('0x3f')]=[{'all':!![]}];}return db['Migration'][_0x5b93('0x40')](_0x32ce9d);})[_0x5b93('0x25')](function(_0x4df87b){_0x3bbb16[_0x5b93('0x41')]=_0x4df87b;return _0x3bbb16;})[_0x5b93('0x25')](respondWithFilteredResult(_0x4b7d06,_0x32ce9d))[_0x5b93('0x42')](handleError(_0x4b7d06,null));}; \ No newline at end of file +var _0xee51=['set','Content-Range','json','reject','update','error','name','send','map','Migration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xee51,0x13b));var _0x1ee5=function(_0x817eb6,_0x26399f){_0x817eb6=_0x817eb6-0x0;var _0xab0335=_0xee51[_0x817eb6];return _0xab0335;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ee5('0x0'));var zipdir=require(_0x1ee5('0x1'));var jsonpatch=require(_0x1ee5('0x2'));var rp=require(_0x1ee5('0x3'));var moment=require(_0x1ee5('0x4'));var BPromise=require(_0x1ee5('0x5'));var Mustache=require(_0x1ee5('0x6'));var util=require(_0x1ee5('0x7'));var path=require(_0x1ee5('0x8'));var sox=require(_0x1ee5('0x9'));var csv=require(_0x1ee5('0xa'));var ejs=require(_0x1ee5('0xb'));var fs=require('fs');var fs_extra=require(_0x1ee5('0xc'));var _=require('lodash');var squel=require(_0x1ee5('0xd'));var crypto=require(_0x1ee5('0xe'));var jsforce=require(_0x1ee5('0xf'));var deskjs=require(_0x1ee5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1ee5('0x11'));var Papa=require(_0x1ee5('0x12'));var Redis=require(_0x1ee5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1ee5('0x14'));var as=require(_0x1ee5('0x15'));var hardwareService=require(_0x1ee5('0x16'));var logger=require(_0x1ee5('0x17'))(_0x1ee5('0x18'));var utils=require(_0x1ee5('0x19'));var config=require(_0x1ee5('0x1a'));var licenseUtil=require(_0x1ee5('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c6ab,_0x1a4e99){_0x1a4e99=_0x1a4e99||0xcc;return function(_0x2c0675){if(_0x2c0675){return _0x50c6ab[_0x1ee5('0x1c')](_0x1a4e99);}return _0x50c6ab[_0x1ee5('0x1d')](_0x1a4e99)[_0x1ee5('0x1e')]();};}function respondWithResult(_0xefb515,_0x492f6b){_0x492f6b=_0x492f6b||0xc8;return function(_0x3626f8){if(_0x3626f8){return _0xefb515[_0x1ee5('0x1d')](_0x492f6b)['json'](_0x3626f8);}};}function respondWithFilteredResult(_0x32f60f,_0x37f614){return function(_0x28fade){if(_0x28fade){var _0x2c7c23=typeof _0x37f614[_0x1ee5('0x1f')]===_0x1ee5('0x20')&&typeof _0x37f614['limit']===_0x1ee5('0x20');var _0x3f7087=_0x28fade[_0x1ee5('0x21')];var _0x4d640c=_0x2c7c23?0x0:_0x37f614['offset'];var _0x2515e4=_0x2c7c23?_0x28fade[_0x1ee5('0x21')]:_0x37f614[_0x1ee5('0x1f')]+_0x37f614[_0x1ee5('0x22')];var _0x2b0d7d;if(_0x2515e4>=_0x3f7087){_0x2515e4=_0x3f7087;_0x2b0d7d=0xc8;}else{_0x2b0d7d=0xce;}_0x32f60f[_0x1ee5('0x1d')](_0x2b0d7d);return _0x32f60f[_0x1ee5('0x23')](_0x1ee5('0x24'),_0x4d640c+'-'+_0x2515e4+'/'+_0x3f7087)[_0x1ee5('0x25')](_0x28fade);}return null;};}function patchUpdates(_0x196af3){return function(_0x47bc2e){try{jsonpatch['apply'](_0x47bc2e,_0x196af3,!![]);}catch(_0x196c63){return BPromise[_0x1ee5('0x26')](_0x196c63);}return _0x47bc2e['save']();};}function saveUpdates(_0x1b2600,_0x2ffdea){return function(_0x5ef3d0){if(_0x5ef3d0){return _0x5ef3d0[_0x1ee5('0x27')](_0x1b2600)['then'](function(_0x3c95cd){return _0x3c95cd;});}return null;};}function removeEntity(_0x299818,_0x5e53a0){return function(_0x92b79e){if(_0x92b79e){return _0x92b79e['destroy']()['then'](function(){_0x299818[_0x1ee5('0x1d')](0xcc)[_0x1ee5('0x1e')]();});}};}function handleEntityNotFound(_0x1b89c1,_0x14cc6f){return function(_0x42ff39){if(!_0x42ff39){_0x1b89c1[_0x1ee5('0x1c')](0x194);}return _0x42ff39;};}function handleError(_0x18f561,_0x38ad05){_0x38ad05=_0x38ad05||0x1f4;return function(_0x5d5250){logger[_0x1ee5('0x28')](_0x5d5250['stack']);if(_0x5d5250['name']){delete _0x5d5250[_0x1ee5('0x29')];}_0x18f561[_0x1ee5('0x1d')](_0x38ad05)[_0x1ee5('0x2a')](_0x5d5250);};}exports['index']=function(_0x567f98,_0xc6dc3d){var _0x176507={},_0x3829da={},_0x175c97={'count':0x0,'rows':[]};var _0x49771f=_[_0x1ee5('0x2b')](db[_0x1ee5('0x2c')]['rawAttributes'],function(_0x512ddd){return{'name':_0x512ddd[_0x1ee5('0x2d')],'type':_0x512ddd[_0x1ee5('0x2e')][_0x1ee5('0x2f')]};});_0x3829da[_0x1ee5('0x30')]=_[_0x1ee5('0x2b')](_0x49771f,_0x1ee5('0x29'));_0x3829da[_0x1ee5('0x31')]=_[_0x1ee5('0x32')](_0x567f98[_0x1ee5('0x31')]);_0x3829da['filters']=_[_0x1ee5('0x33')](_0x3829da['model'],_0x3829da['query']);_0x176507[_0x1ee5('0x34')]=_['intersection'](_0x3829da['model'],qs[_0x1ee5('0x35')](_0x567f98[_0x1ee5('0x31')][_0x1ee5('0x35')]));_0x176507['attributes']=_0x176507[_0x1ee5('0x34')][_0x1ee5('0x36')]?_0x176507[_0x1ee5('0x34')]:_0x3829da[_0x1ee5('0x30')];if(!_0x567f98[_0x1ee5('0x31')][_0x1ee5('0x37')](_0x1ee5('0x38'))){_0x176507[_0x1ee5('0x22')]=qs[_0x1ee5('0x22')](_0x567f98[_0x1ee5('0x31')][_0x1ee5('0x22')]);_0x176507[_0x1ee5('0x1f')]=qs[_0x1ee5('0x1f')](_0x567f98['query']['offset']);}_0x176507[_0x1ee5('0x39')]=qs[_0x1ee5('0x3a')](_0x567f98[_0x1ee5('0x31')][_0x1ee5('0x3a')]);_0x176507[_0x1ee5('0x3b')]=qs[_0x1ee5('0x3c')](_[_0x1ee5('0x3d')](_0x567f98['query'],_0x3829da[_0x1ee5('0x3c')]),_0x49771f);if(_0x567f98[_0x1ee5('0x31')]['filter']){_0x176507[_0x1ee5('0x3b')]=_[_0x1ee5('0x3e')](_0x176507[_0x1ee5('0x3b')],{'$or':_[_0x1ee5('0x2b')](_0x49771f,function(_0xcc65d){if(_0xcc65d['type']!==_0x1ee5('0x3f')){var _0x225a51={};_0x225a51[_0xcc65d['name']]={'$like':'%'+_0x567f98[_0x1ee5('0x31')]['filter']+'%'};return _0x225a51;}})});}_0x176507=_[_0x1ee5('0x3e')]({},_0x176507,_0x567f98[_0x1ee5('0x40')]);var _0x227b81={'where':_0x176507[_0x1ee5('0x3b')]};return db['Migration']['count'](_0x227b81)[_0x1ee5('0x41')](function(_0x5f03ca){_0x175c97[_0x1ee5('0x21')]=_0x5f03ca;if(_0x567f98['query'][_0x1ee5('0x42')]){_0x176507[_0x1ee5('0x43')]=[{'all':!![]}];}return db['Migration'][_0x1ee5('0x44')](_0x176507);})[_0x1ee5('0x41')](function(_0x4bcf4a){_0x175c97[_0x1ee5('0x45')]=_0x4bcf4a;return _0x175c97;})[_0x1ee5('0x41')](respondWithFilteredResult(_0xc6dc3d,_0x176507))['catch'](handleError(_0xc6dc3d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ae8a7f6..c180958 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 _0x53c2=['../../config/logger','api','moment','path','rimraf','../../config/environment','./migration.attributes','define','migrations','lodash','util'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x53c2,0x82));var _0x253c=function(_0x47738b,_0x20fee6){_0x47738b=_0x47738b-0x0;var _0x2104b6=_0x53c2[_0x47738b];return _0x2104b6;};'use strict';var _=require(_0x253c('0x0'));var util=require(_0x253c('0x1'));var logger=require(_0x253c('0x2'))(_0x253c('0x3'));var moment=require(_0x253c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x253c('0x5'));var rimraf=require(_0x253c('0x6'));var config=require(_0x253c('0x7'));var attributes=require(_0x253c('0x8'));module['exports']=function(_0x5891c1,_0x5d72b6){return _0x5891c1[_0x253c('0x9')]('Migration',attributes,{'tableName':_0x253c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2087=['./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x17726f,_0x2a7c30){var _0x5696d2=function(_0x57367b){while(--_0x57367b){_0x17726f['push'](_0x17726f['shift']());}};_0x5696d2(++_0x2a7c30);}(_0x2087,0x198));var _0x7208=function(_0x5be211,_0x236afd){_0x5be211=_0x5be211-0x0;var _0x2f1a8c=_0x2087[_0x5be211];return _0x2f1a8c;};'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('rimraf');var config=require(_0x7208('0x7'));var attributes=require(_0x7208('0x8'));module[_0x7208('0x9')]=function(_0x1553d7,_0x29c566){return _0x1553d7[_0x7208('0xa')](_0x7208('0xb'),attributes,{'tableName':_0x7208('0xc'),'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 6d8dd93..2f32b54 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 _0x4065=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1cd742,_0xf883f3){var _0xc018e9=function(_0x251778){while(--_0x251778){_0x1cd742['push'](_0x1cd742['shift']());}};_0xc018e9(++_0xf883f3);}(_0x4065,0xdc));var _0x5406=function(_0x3710c2,_0x489b7d){_0x3710c2=_0x3710c2-0x0;var _0x849c1a=_0x4065[_0x3710c2];return _0x849c1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5406('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5406('0x1'));var db=require(_0x5406('0x2'))['db'];var utils=require(_0x5406('0x3'));var logger=require('../../config/logger')(_0x5406('0x4'));var config=require(_0x5406('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5406('0x6')][_0x5406('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a6577,_0x132fc5,_0x44f868){return new BPromise(function(_0x3acd44,_0x4aae49){return client[_0x5406('0x8')](_0x2a6577,_0x44f868)[_0x5406('0x9')](function(_0xd9e9d7){logger[_0x5406('0xa')](_0x5406('0xb'),_0x132fc5,_0x5406('0xc'));logger['debug'](_0x5406('0xd'),_0x132fc5,_0x5406('0xc'),JSON[_0x5406('0xe')](_0xd9e9d7));if(_0xd9e9d7[_0x5406('0xf')]){if(_0xd9e9d7[_0x5406('0xf')][_0x5406('0x10')]===0x1f4){logger['error'](_0x5406('0xb'),_0x132fc5,_0xd9e9d7[_0x5406('0xf')]['message']);return _0x4aae49(_0xd9e9d7[_0x5406('0xf')][_0x5406('0x11')]);}logger[_0x5406('0xf')](_0x5406('0xb'),_0x132fc5,_0xd9e9d7[_0x5406('0xf')][_0x5406('0x11')]);return _0x3acd44(_0xd9e9d7[_0x5406('0xf')][_0x5406('0x11')]);}else{logger[_0x5406('0xa')]('Migration,\x20%s,\x20%s',_0x132fc5,_0x5406('0xc'));_0x3acd44(_0xd9e9d7[_0x5406('0x12')][_0x5406('0x11')]);}})[_0x5406('0x13')](function(_0x505b25){logger[_0x5406('0xf')](_0x5406('0xb'),_0x132fc5,_0x505b25);_0x4aae49(_0x505b25);});});} \ No newline at end of file +var _0x3eec=['debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x523f4c,_0x31790d){_0x523f4c=_0x523f4c-0x0;var _0x384cf0=_0x3eec[_0x523f4c];return _0x384cf0;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('Migration,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('Migration,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 790be82..142c12c 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 _0x5c21=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','put','update','destroy','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x5c21,0x90));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x15c2('0x0'));var path=require(_0x15c2('0x1'));var timeout=require(_0x15c2('0x2'));var express=require(_0x15c2('0x3'));var router=express['Router']();var fs_extra=require(_0x15c2('0x4'));var auth=require(_0x15c2('0x5'));var interaction=require(_0x15c2('0x6'));var config=require(_0x15c2('0x7'));var controller=require(_0x15c2('0x8'));router[_0x15c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x15c2('0xa')]);router['get'](_0x15c2('0xb'),auth[_0x15c2('0xc')](),controller[_0x15c2('0xd')]);router['post']('/',auth[_0x15c2('0xc')](),controller['create']);router[_0x15c2('0xe')](_0x15c2('0xb'),auth[_0x15c2('0xc')](),controller[_0x15c2('0xf')]);router['delete'](_0x15c2('0xb'),auth['isAuthenticated'](),controller[_0x15c2('0x10')]);module[_0x15c2('0x11')]=router; \ No newline at end of file +var _0x6636=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy'];(function(_0x620aea,_0x5ee0b9){var _0x2d9bc9=function(_0x5f1947){while(--_0x5f1947){_0x620aea['push'](_0x620aea['shift']());}};_0x2d9bc9(++_0x5ee0b9);}(_0x6636,0x119));var _0x6663=function(_0x36a5c9,_0x2d9cb7){_0x36a5c9=_0x36a5c9-0x0;var _0x11bd25=_0x6636[_0x36a5c9];return _0x11bd25;};'use strict';var multer=require(_0x6663('0x0'));var util=require(_0x6663('0x1'));var path=require('path');var timeout=require(_0x6663('0x2'));var express=require(_0x6663('0x3'));var router=express[_0x6663('0x4')]();var fs_extra=require(_0x6663('0x5'));var auth=require(_0x6663('0x6'));var interaction=require(_0x6663('0x7'));var config=require(_0x6663('0x8'));var controller=require(_0x6663('0x9'));router[_0x6663('0xa')]('/',auth[_0x6663('0xb')](),controller[_0x6663('0xc')]);router[_0x6663('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6663('0xd')]);router[_0x6663('0xe')]('/',auth[_0x6663('0xb')](),controller[_0x6663('0xf')]);router['put'](_0x6663('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x6663('0x11')](_0x6663('0x10'),auth[_0x6663('0xb')](),controller[_0x6663('0x12')]);module[_0x6663('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 005a01f..da196b5 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 _0xf61a=['exports','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x545812,_0x197805){var _0x3f5766=function(_0x48f9ed){while(--_0x48f9ed){_0x545812['push'](_0x545812['shift']());}};_0x3f5766(++_0x197805);}(_0xf61a,0xf4));var _0xaf61=function(_0x15cd04,_0x17c0a8){_0x15cd04=_0x15cd04-0x0;var _0x49de30=_0xf61a[_0x15cd04];return _0x49de30;};'use strict';var Sequelize=require(_0xaf61('0x0'));module[_0xaf61('0x1')]={'type':{'type':Sequelize['ENUM'](_0xaf61('0x2'),_0xaf61('0x3'),_0xaf61('0x4'),_0xaf61('0x5'))},'value':{'type':Sequelize[_0xaf61('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xaf61('0x6')]}}; \ No newline at end of file +var _0x1b03=['stun','turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x1b03,0xff));var _0x31b0=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x1b03[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x31b0('0x0'));module[_0x31b0('0x1')]={'type':{'type':Sequelize[_0x31b0('0x2')]('localnet',_0x31b0('0x3'),_0x31b0('0x4'),_0x31b0('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x31b0('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9dbdb6a..ebcae02 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 _0xcc81=['render','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','format','toLowerCase','chan_sip.so','util','path','ejs','lodash','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','offset','undefined','limit','count','status','set','Content-Range','update','destroy','sendStatus','name','Network','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','merge','filter','include','findAll','rows','show','params','options','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0xcc81,0xfc));var _0x1cc8=function(_0x38a54d,_0x132fde){_0x38a54d=_0x38a54d-0x0;var _0x2d1b0e=_0xcc81[_0x38a54d];return _0x2d1b0e;};'use strict';var util=require(_0x1cc8('0x0'));var path=require(_0x1cc8('0x1'));var ejs=require(_0x1cc8('0x2'));var fs=require('fs');var _=require(_0x1cc8('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x1cc8('0x4'))('api');var config=require(_0x1cc8('0x5'));var db=require(_0x1cc8('0x6'))['db'];var jayson=require(_0x1cc8('0x7'));var client=jayson[_0x1cc8('0x8')][_0x1cc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x98f126,_0x3c8bc3,_0x967af,_0x122d2c){return new Promise(function(_0x212253,_0xe66969){var _0x32276f=_0x122d2c||client;return _0x32276f['request'](_0x98f126,_0x967af)[_0x1cc8('0xa')](function(_0x3aac04){logger[_0x1cc8('0xb')](_0x1cc8('0xc'),_0x3c8bc3,_0x1cc8('0xd'));logger[_0x1cc8('0xe')](_0x1cc8('0xf'),_0x3c8bc3,_0x1cc8('0xd'),JSON['stringify'](_0x3aac04));if(_0x3aac04['error']){if(_0x3aac04[_0x1cc8('0x10')][_0x1cc8('0x11')]===0x1f4){logger[_0x1cc8('0x10')]('Network,\x20%s,\x20%s',_0x3c8bc3,_0x3aac04[_0x1cc8('0x10')][_0x1cc8('0x12')]);return _0xe66969(_0x3aac04['error'][_0x1cc8('0x12')]);}logger[_0x1cc8('0x10')](_0x1cc8('0xc'),_0x3c8bc3,_0x3aac04['error'][_0x1cc8('0x12')]);return _0x212253(_0x3aac04[_0x1cc8('0x10')]['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x3c8bc3,_0x1cc8('0xd'));_0x212253(_0x3aac04[_0x1cc8('0x13')]['message']);}})[_0x1cc8('0x14')](function(_0x1defd7){logger['error'](_0x1cc8('0xc'),_0x3c8bc3,_0x1defd7);_0xe66969(_0x1defd7);});});}function respondWithResult(_0x106228,_0x1bbca1){_0x1bbca1=_0x1bbca1||0xc8;return function(_0x1c7389){if(_0x1c7389){return _0x106228['status'](_0x1bbca1)['json'](_0x1c7389);}};}function respondWithFilteredResult(_0x43d519,_0x556932){return function(_0x15435d){if(_0x15435d){var _0x134bba=typeof _0x556932[_0x1cc8('0x15')]===_0x1cc8('0x16')&&typeof _0x556932[_0x1cc8('0x17')]===_0x1cc8('0x16');var _0x486f65=_0x15435d[_0x1cc8('0x18')];var _0x4763b3=_0x134bba?0x0:_0x556932['offset'];var _0x3328d7=_0x134bba?_0x15435d[_0x1cc8('0x18')]:_0x556932[_0x1cc8('0x15')]+_0x556932[_0x1cc8('0x17')];var _0x46457b;if(_0x3328d7>=_0x486f65){_0x3328d7=_0x486f65;_0x46457b=0xc8;}else{_0x46457b=0xce;}_0x43d519[_0x1cc8('0x19')](_0x46457b);return _0x43d519[_0x1cc8('0x1a')](_0x1cc8('0x1b'),_0x4763b3+'-'+_0x3328d7+'/'+_0x486f65)['json'](_0x15435d);}return null;};}function saveUpdates(_0x5716c1){return function(_0x12df77){if(_0x12df77){return _0x12df77[_0x1cc8('0x1c')](_0x5716c1)[_0x1cc8('0xa')](function(_0x50d2f5){return _0x50d2f5;});}return null;};}function removeEntity(_0x20fdc6){return function(_0x2a7325){if(_0x2a7325){return _0x2a7325[_0x1cc8('0x1d')]()['then'](function(){_0x20fdc6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5babf1){return function(_0x291633){if(!_0x291633){_0x5babf1[_0x1cc8('0x1e')](0x194);}return _0x291633;};}function handleError(_0x571af5,_0x56d7c7){_0x56d7c7=_0x56d7c7||0x1f4;return function(_0x30b8ed){logger[_0x1cc8('0x10')](_0x30b8ed['stack']);if(_0x30b8ed[_0x1cc8('0x1f')]){delete _0x30b8ed[_0x1cc8('0x1f')];}_0x571af5[_0x1cc8('0x19')](_0x56d7c7)['send'](_0x30b8ed);};}exports['index']=function(_0x53442c,_0x5f1ba1){var _0x37c5aa={},_0x20143d={},_0x3cfee6={'count':0x0,'rows':[]};var _0x2992ee=_['map'](db[_0x1cc8('0x20')][_0x1cc8('0x21')],function(_0x5df0a5){return{'name':_0x5df0a5[_0x1cc8('0x22')],'type':_0x5df0a5[_0x1cc8('0x23')][_0x1cc8('0x24')]};});_0x20143d['model']=_[_0x1cc8('0x25')](_0x2992ee,'name');_0x20143d['query']=_[_0x1cc8('0x26')](_0x53442c[_0x1cc8('0x27')]);_0x20143d[_0x1cc8('0x28')]=_[_0x1cc8('0x29')](_0x20143d['model'],_0x20143d[_0x1cc8('0x27')]);_0x37c5aa[_0x1cc8('0x2a')]=_[_0x1cc8('0x29')](_0x20143d[_0x1cc8('0x2b')],qs[_0x1cc8('0x2c')](_0x53442c['query'][_0x1cc8('0x2c')]));_0x37c5aa[_0x1cc8('0x2a')]=_0x37c5aa[_0x1cc8('0x2a')][_0x1cc8('0x2d')]?_0x37c5aa[_0x1cc8('0x2a')]:_0x20143d[_0x1cc8('0x2b')];if(!_0x53442c['query'][_0x1cc8('0x2e')]('nolimit')){_0x37c5aa[_0x1cc8('0x17')]=qs[_0x1cc8('0x17')](_0x53442c[_0x1cc8('0x27')][_0x1cc8('0x17')]);_0x37c5aa[_0x1cc8('0x15')]=qs[_0x1cc8('0x15')](_0x53442c[_0x1cc8('0x27')][_0x1cc8('0x15')]);}_0x37c5aa['order']=qs[_0x1cc8('0x2f')](_0x53442c[_0x1cc8('0x27')][_0x1cc8('0x2f')]);_0x37c5aa[_0x1cc8('0x30')]=qs['filters'](_[_0x1cc8('0x31')](_0x53442c[_0x1cc8('0x27')],_0x20143d[_0x1cc8('0x28')]),_0x2992ee);if(_0x53442c[_0x1cc8('0x27')]['filter']){_0x37c5aa['where']=_[_0x1cc8('0x32')](_0x37c5aa[_0x1cc8('0x30')],{'$or':_[_0x1cc8('0x25')](_0x2992ee,function(_0x332639){if(_0x332639[_0x1cc8('0x23')]!=='VIRTUAL'){var _0x1be9f1={};_0x1be9f1[_0x332639['name']]={'$like':'%'+_0x53442c[_0x1cc8('0x27')][_0x1cc8('0x33')]+'%'};return _0x1be9f1;}})});}_0x37c5aa=_[_0x1cc8('0x32')]({},_0x37c5aa,_0x53442c['options']);var _0x307db2={'where':_0x37c5aa['where']};return db[_0x1cc8('0x20')][_0x1cc8('0x18')](_0x307db2)[_0x1cc8('0xa')](function(_0xeda02b){_0x3cfee6['count']=_0xeda02b;if(_0x53442c[_0x1cc8('0x27')]['includeAll']){_0x37c5aa[_0x1cc8('0x34')]=[{'all':!![]}];}return db[_0x1cc8('0x20')][_0x1cc8('0x35')](_0x37c5aa);})['then'](function(_0xb8227c){_0x3cfee6[_0x1cc8('0x36')]=_0xb8227c;return _0x3cfee6;})['then'](respondWithFilteredResult(_0x5f1ba1,_0x37c5aa))[_0x1cc8('0x14')](handleError(_0x5f1ba1,null));};exports[_0x1cc8('0x37')]=function(_0xd77bfb,_0x477cea){var _0x438404={'raw':!![],'where':{'id':_0xd77bfb[_0x1cc8('0x38')]['id']}},_0x8bce97={};_0x8bce97['model']=_[_0x1cc8('0x26')](db[_0x1cc8('0x20')]['rawAttributes']);_0x8bce97[_0x1cc8('0x27')]=_[_0x1cc8('0x26')](_0xd77bfb[_0x1cc8('0x27')]);_0x8bce97['filters']=_['intersection'](_0x8bce97['model'],_0x8bce97['query']);_0x438404[_0x1cc8('0x2a')]=_[_0x1cc8('0x29')](_0x8bce97[_0x1cc8('0x2b')],qs['fields'](_0xd77bfb[_0x1cc8('0x27')]['fields']));_0x438404['attributes']=_0x438404[_0x1cc8('0x2a')][_0x1cc8('0x2d')]?_0x438404['attributes']:_0x8bce97[_0x1cc8('0x2b')];if(_0xd77bfb[_0x1cc8('0x27')]['includeAll']){_0x438404[_0x1cc8('0x34')]=[{'all':!![]}];}_0x438404=_[_0x1cc8('0x32')]({},_0x438404,_0xd77bfb[_0x1cc8('0x39')]);return db[_0x1cc8('0x20')][_0x1cc8('0x3a')](_0x438404)[_0x1cc8('0xa')](handleEntityNotFound(_0x477cea,null))[_0x1cc8('0xa')](respondWithResult(_0x477cea,null))[_0x1cc8('0x14')](handleError(_0x477cea,null));};exports[_0x1cc8('0x3b')]=function(_0x34fe57,_0x2ce350){var _0x56047a;return db['Network'][_0x1cc8('0x3b')](_0x34fe57[_0x1cc8('0x3c')],{'raw':!![]})[_0x1cc8('0xa')](function(_0x45444a){_0x56047a=_0x45444a;return db[_0x1cc8('0x20')][_0x1cc8('0x35')]({'where':{'type':_0x34fe57[_0x1cc8('0x3c')][_0x1cc8('0x23')]},'raw':!![]});})['then'](function(_0x1db0ce){if(_0x56047a[_0x1cc8('0x23')][_0x1cc8('0x3d')]()==_0x1cc8('0x3e')){var _0x51e906=fs[_0x1cc8('0x3f')](path[_0x1cc8('0x40')](config[_0x1cc8('0x41')],_0x1cc8('0x42')),_0x1cc8('0x43'));var _0x2471e0=ejs['render'](_0x51e906,{'networks':_0x1db0ce||[]});fs[_0x1cc8('0x44')](_0x1cc8('0x45'),_0x2471e0);return respondWithRpcPromise('Reload',_0x1cc8('0x3b'),{'module':'res_stun_monitor.so'});}else if(_0x56047a[_0x1cc8('0x23')][_0x1cc8('0x3d')]()==_0x1cc8('0x46')){var _0x39a431=fs[_0x1cc8('0x3f')](path[_0x1cc8('0x40')](config['root'],_0x1cc8('0x47')),'utf8');var _0xbb8684=ejs[_0x1cc8('0x48')](_0x39a431,{'networks':_0x1db0ce||[]});fs['writeFileSync'](_0x1cc8('0x49'),_0xbb8684);return respondWithRpcPromise(_0x1cc8('0x4a'),_0x1cc8('0x3b'),{'module':_0x1cc8('0x4b')});}else{var _0x580038=fs['readFileSync'](path['join'](config[_0x1cc8('0x41')],_0x1cc8('0x4c')),_0x1cc8('0x43'));var _0x2115b2=ejs['render'](_0x580038,{'networks':_0x1db0ce||[]});fs[_0x1cc8('0x44')](util['format'](_0x1cc8('0x4d'),_0x34fe57[_0x1cc8('0x3c')][_0x1cc8('0x23')]['toLowerCase']()),_0x2115b2);return respondWithRpcPromise(_0x1cc8('0x4a'),'create',{'module':'chan_sip.so'});}})[_0x1cc8('0xa')](function(){return _0x56047a;})['then'](respondWithResult(_0x2ce350,0xc9))[_0x1cc8('0x14')](handleError(_0x2ce350,null));};exports['update']=function(_0x1eccfe,_0x19a75e){var _0x292823;return db['Network']['find']({'where':{'id':_0x1eccfe[_0x1cc8('0x38')]['id']}})[_0x1cc8('0xa')](handleEntityNotFound(_0x19a75e,null))[_0x1cc8('0xa')](saveUpdates(_0x1eccfe[_0x1cc8('0x3c')],null))[_0x1cc8('0xa')](function(_0x4d89f2){if(_0x4d89f2){_0x292823=_0x4d89f2;return db['Network'][_0x1cc8('0x35')]({'where':{'type':_0x292823['type']},'raw':!![]});}return null;})[_0x1cc8('0xa')](function(_0x3c7ce0){if(_0x292823['type'][_0x1cc8('0x3d')]()==_0x1cc8('0x3e')){var _0x4f4226=fs[_0x1cc8('0x3f')](path[_0x1cc8('0x40')](config[_0x1cc8('0x41')],_0x1cc8('0x42')),_0x1cc8('0x43'));var _0x5570bb=ejs[_0x1cc8('0x48')](_0x4f4226,{'networks':_0x3c7ce0||[]});fs[_0x1cc8('0x44')](_0x1cc8('0x45'),_0x5570bb);return respondWithRpcPromise(_0x1cc8('0x4a'),'update',{'module':_0x1cc8('0x4b')});}else if(_0x292823[_0x1cc8('0x23')]['toUpperCase']()==_0x1cc8('0x46')){var _0x37c856=fs[_0x1cc8('0x3f')](path[_0x1cc8('0x40')](config[_0x1cc8('0x41')],_0x1cc8('0x47')),_0x1cc8('0x43'));var _0x2ec40c=ejs[_0x1cc8('0x48')](_0x37c856,{'networks':_0x3c7ce0||[]});fs[_0x1cc8('0x44')](_0x1cc8('0x49'),_0x2ec40c);return respondWithRpcPromise('Reload',_0x1cc8('0x1c'),{'module':_0x1cc8('0x4b')});}else{var _0x660c8d=fs[_0x1cc8('0x3f')](path['join'](config[_0x1cc8('0x41')],'server/files/templates/network.ejs'),_0x1cc8('0x43'));var _0x4905c2=ejs[_0x1cc8('0x48')](_0x660c8d,{'networks':_0x3c7ce0||[]});fs['writeFileSync'](util[_0x1cc8('0x4e')](_0x1cc8('0x4d'),_0x1eccfe['body'][_0x1cc8('0x23')][_0x1cc8('0x4f')]()),_0x4905c2);return respondWithRpcPromise(_0x1cc8('0x4a'),_0x1cc8('0x1c'),{'module':'chan_sip.so'});}})[_0x1cc8('0xa')](function(_0x46d0d1){if(_0x46d0d1){return _0x292823;}return null;})[_0x1cc8('0xa')](respondWithResult(_0x19a75e,null))['catch'](handleError(_0x19a75e,null));};exports['destroy']=function(_0x176482,_0x269d69){var _0x8fe984;return db['Network'][_0x1cc8('0x3a')]({'where':{'id':_0x176482[_0x1cc8('0x38')]['id']}})[_0x1cc8('0xa')](function(_0x591113){_0x8fe984=_0x591113;return _0x591113;})[_0x1cc8('0xa')](handleEntityNotFound(_0x269d69,null))[_0x1cc8('0xa')](removeEntity(_0x269d69,null))[_0x1cc8('0xa')](function(){if(_0x8fe984){return db['Network'][_0x1cc8('0x35')]({'where':{'type':_0x8fe984['type']},'raw':!![]});}})[_0x1cc8('0xa')](function(_0x52fb05){if(_0x8fe984[_0x1cc8('0x23')][_0x1cc8('0x3d')]()=='STUN'){var _0x56efb6=fs[_0x1cc8('0x3f')](path[_0x1cc8('0x40')](config['root'],_0x1cc8('0x42')),_0x1cc8('0x43'));var _0x58d622=ejs[_0x1cc8('0x48')](_0x56efb6,{'networks':_0x52fb05||[]});fs['writeFileSync'](_0x1cc8('0x45'),_0x58d622);return respondWithRpcPromise(_0x1cc8('0x4a'),_0x1cc8('0x1d'),{'module':_0x1cc8('0x4b')});}else if(_0x8fe984[_0x1cc8('0x23')][_0x1cc8('0x3d')]()==_0x1cc8('0x46')){var _0x990851=fs[_0x1cc8('0x3f')](path[_0x1cc8('0x40')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x1cc8('0x43'));var _0x1c57be=ejs['render'](_0x990851,{'networks':_0x52fb05||[]});fs['writeFileSync'](_0x1cc8('0x49'),_0x1c57be);return respondWithRpcPromise('Reload',_0x1cc8('0x1d'),{'module':_0x1cc8('0x4b')});}else{var _0x2e4d1c=fs[_0x1cc8('0x3f')](path[_0x1cc8('0x40')](config[_0x1cc8('0x41')],_0x1cc8('0x4c')),_0x1cc8('0x43'));var _0x5c20b2=ejs[_0x1cc8('0x48')](_0x2e4d1c,{'networks':_0x52fb05||[]});fs[_0x1cc8('0x44')](util['format'](_0x1cc8('0x4d'),_0x8fe984[_0x1cc8('0x23')]['toLowerCase']()),_0x5c20b2);return respondWithRpcPromise('Reload',_0x1cc8('0x1d'),{'module':_0x1cc8('0x50')});}})[_0x1cc8('0x14')](handleError(_0x269d69,null));}; \ No newline at end of file +var _0x9ae6=['keys','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','create','TURN','server/files/templates/turn_multiple.ejs','render','writeFileSync','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','/etc/asterisk/turn_xcally.conf','format','util','path','ejs','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','offset','limit','undefined','count','set','Content-Range','json','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query'];(function(_0x385ba2,_0x1f8fd4){var _0xaed0d2=function(_0x4ebf5d){while(--_0x4ebf5d){_0x385ba2['push'](_0x385ba2['shift']());}};_0xaed0d2(++_0x1f8fd4);}(_0x9ae6,0x1d3));var _0x69ae=function(_0x415332,_0x1663c8){_0x415332=_0x415332-0x0;var _0x39c980=_0x9ae6[_0x415332];return _0x39c980;};'use strict';var util=require(_0x69ae('0x0'));var path=require(_0x69ae('0x1'));var ejs=require(_0x69ae('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x69ae('0x3'));var logger=require(_0x69ae('0x4'))('api');var config=require(_0x69ae('0x5'));var db=require(_0x69ae('0x6'))['db'];var jayson=require(_0x69ae('0x7'));var client=jayson[_0x69ae('0x8')][_0x69ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d27db,_0x58ca12,_0x5aa588,_0x130850){return new Promise(function(_0x35c099,_0x10700f){var _0xc00483=_0x130850||client;return _0xc00483[_0x69ae('0xa')](_0x3d27db,_0x5aa588)[_0x69ae('0xb')](function(_0x16dbc1){logger[_0x69ae('0xc')](_0x69ae('0xd'),_0x58ca12,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x58ca12,_0x69ae('0xe'),JSON[_0x69ae('0xf')](_0x16dbc1));if(_0x16dbc1[_0x69ae('0x10')]){if(_0x16dbc1['error'][_0x69ae('0x11')]===0x1f4){logger[_0x69ae('0x10')](_0x69ae('0xd'),_0x58ca12,_0x16dbc1['error'][_0x69ae('0x12')]);return _0x10700f(_0x16dbc1[_0x69ae('0x10')][_0x69ae('0x12')]);}logger[_0x69ae('0x10')](_0x69ae('0xd'),_0x58ca12,_0x16dbc1[_0x69ae('0x10')]['message']);return _0x35c099(_0x16dbc1[_0x69ae('0x10')][_0x69ae('0x12')]);}else{logger[_0x69ae('0xc')](_0x69ae('0xd'),_0x58ca12,_0x69ae('0xe'));_0x35c099(_0x16dbc1['result']['message']);}})[_0x69ae('0x13')](function(_0x5b680e){logger[_0x69ae('0x10')](_0x69ae('0xd'),_0x58ca12,_0x5b680e);_0x10700f(_0x5b680e);});});}function respondWithResult(_0x339ec2,_0x95f8e3){_0x95f8e3=_0x95f8e3||0xc8;return function(_0x39378f){if(_0x39378f){return _0x339ec2[_0x69ae('0x14')](_0x95f8e3)['json'](_0x39378f);}};}function respondWithFilteredResult(_0x446ee3,_0x159413){return function(_0x3bf43e){if(_0x3bf43e){var _0x5ce9de=typeof _0x159413[_0x69ae('0x15')]==='undefined'&&typeof _0x159413[_0x69ae('0x16')]===_0x69ae('0x17');var _0x2c2950=_0x3bf43e[_0x69ae('0x18')];var _0x236008=_0x5ce9de?0x0:_0x159413['offset'];var _0xaf7676=_0x5ce9de?_0x3bf43e[_0x69ae('0x18')]:_0x159413[_0x69ae('0x15')]+_0x159413['limit'];var _0x32aa31;if(_0xaf7676>=_0x2c2950){_0xaf7676=_0x2c2950;_0x32aa31=0xc8;}else{_0x32aa31=0xce;}_0x446ee3['status'](_0x32aa31);return _0x446ee3[_0x69ae('0x19')](_0x69ae('0x1a'),_0x236008+'-'+_0xaf7676+'/'+_0x2c2950)[_0x69ae('0x1b')](_0x3bf43e);}return null;};}function saveUpdates(_0x523f34){return function(_0x1a81d3){if(_0x1a81d3){return _0x1a81d3['update'](_0x523f34)[_0x69ae('0xb')](function(_0x41f4ae){return _0x41f4ae;});}return null;};}function removeEntity(_0x38dae0){return function(_0x25e819){if(_0x25e819){return _0x25e819[_0x69ae('0x1c')]()[_0x69ae('0xb')](function(){_0x38dae0['status'](0xcc)[_0x69ae('0x1d')]();});}};}function handleEntityNotFound(_0x2b6608){return function(_0x3f0dab){if(!_0x3f0dab){_0x2b6608[_0x69ae('0x1e')](0x194);}return _0x3f0dab;};}function handleError(_0x15799b,_0x1caec0){_0x1caec0=_0x1caec0||0x1f4;return function(_0x1ef95e){logger[_0x69ae('0x10')](_0x1ef95e[_0x69ae('0x1f')]);if(_0x1ef95e[_0x69ae('0x20')]){delete _0x1ef95e[_0x69ae('0x20')];}_0x15799b[_0x69ae('0x14')](_0x1caec0)[_0x69ae('0x21')](_0x1ef95e);};}exports[_0x69ae('0x22')]=function(_0x34934a,_0x29a3e9){var _0xc40187={},_0x64ad43={},_0x32363c={'count':0x0,'rows':[]};var _0x35264c=_[_0x69ae('0x23')](db[_0x69ae('0x24')][_0x69ae('0x25')],function(_0x4b764a){return{'name':_0x4b764a[_0x69ae('0x26')],'type':_0x4b764a[_0x69ae('0x27')][_0x69ae('0x28')]};});_0x64ad43[_0x69ae('0x29')]=_[_0x69ae('0x23')](_0x35264c,_0x69ae('0x20'));_0x64ad43[_0x69ae('0x2a')]=_[_0x69ae('0x2b')](_0x34934a[_0x69ae('0x2a')]);_0x64ad43['filters']=_['intersection'](_0x64ad43[_0x69ae('0x29')],_0x64ad43[_0x69ae('0x2a')]);_0xc40187[_0x69ae('0x2c')]=_['intersection'](_0x64ad43[_0x69ae('0x29')],qs[_0x69ae('0x2d')](_0x34934a[_0x69ae('0x2a')][_0x69ae('0x2d')]));_0xc40187['attributes']=_0xc40187['attributes'][_0x69ae('0x2e')]?_0xc40187[_0x69ae('0x2c')]:_0x64ad43[_0x69ae('0x29')];if(!_0x34934a['query'][_0x69ae('0x2f')]('nolimit')){_0xc40187['limit']=qs[_0x69ae('0x16')](_0x34934a[_0x69ae('0x2a')][_0x69ae('0x16')]);_0xc40187[_0x69ae('0x15')]=qs[_0x69ae('0x15')](_0x34934a['query']['offset']);}_0xc40187[_0x69ae('0x30')]=qs[_0x69ae('0x31')](_0x34934a['query'][_0x69ae('0x31')]);_0xc40187['where']=qs[_0x69ae('0x32')](_['pick'](_0x34934a[_0x69ae('0x2a')],_0x64ad43[_0x69ae('0x32')]),_0x35264c);if(_0x34934a[_0x69ae('0x2a')][_0x69ae('0x33')]){_0xc40187[_0x69ae('0x34')]=_[_0x69ae('0x35')](_0xc40187[_0x69ae('0x34')],{'$or':_[_0x69ae('0x23')](_0x35264c,function(_0x154823){if(_0x154823[_0x69ae('0x27')]!==_0x69ae('0x36')){var _0x4852d7={};_0x4852d7[_0x154823[_0x69ae('0x20')]]={'$like':'%'+_0x34934a[_0x69ae('0x2a')]['filter']+'%'};return _0x4852d7;}})});}_0xc40187=_[_0x69ae('0x35')]({},_0xc40187,_0x34934a[_0x69ae('0x37')]);var _0x56e54c={'where':_0xc40187[_0x69ae('0x34')]};return db[_0x69ae('0x24')]['count'](_0x56e54c)[_0x69ae('0xb')](function(_0xad5d4){_0x32363c[_0x69ae('0x18')]=_0xad5d4;if(_0x34934a[_0x69ae('0x2a')][_0x69ae('0x38')]){_0xc40187[_0x69ae('0x39')]=[{'all':!![]}];}return db['Network'][_0x69ae('0x3a')](_0xc40187);})[_0x69ae('0xb')](function(_0x6f4602){_0x32363c['rows']=_0x6f4602;return _0x32363c;})[_0x69ae('0xb')](respondWithFilteredResult(_0x29a3e9,_0xc40187))[_0x69ae('0x13')](handleError(_0x29a3e9,null));};exports[_0x69ae('0x3b')]=function(_0x367627,_0x5bba51){var _0xc1fd60={'raw':!![],'where':{'id':_0x367627[_0x69ae('0x3c')]['id']}},_0x663226={};_0x663226[_0x69ae('0x29')]=_[_0x69ae('0x2b')](db[_0x69ae('0x24')]['rawAttributes']);_0x663226[_0x69ae('0x2a')]=_[_0x69ae('0x2b')](_0x367627[_0x69ae('0x2a')]);_0x663226[_0x69ae('0x32')]=_[_0x69ae('0x3d')](_0x663226[_0x69ae('0x29')],_0x663226['query']);_0xc1fd60[_0x69ae('0x2c')]=_[_0x69ae('0x3d')](_0x663226['model'],qs[_0x69ae('0x2d')](_0x367627[_0x69ae('0x2a')][_0x69ae('0x2d')]));_0xc1fd60[_0x69ae('0x2c')]=_0xc1fd60[_0x69ae('0x2c')][_0x69ae('0x2e')]?_0xc1fd60[_0x69ae('0x2c')]:_0x663226[_0x69ae('0x29')];if(_0x367627[_0x69ae('0x2a')][_0x69ae('0x38')]){_0xc1fd60['include']=[{'all':!![]}];}_0xc1fd60=_['merge']({},_0xc1fd60,_0x367627['options']);return db['Network']['find'](_0xc1fd60)[_0x69ae('0xb')](handleEntityNotFound(_0x5bba51,null))[_0x69ae('0xb')](respondWithResult(_0x5bba51,null))[_0x69ae('0x13')](handleError(_0x5bba51,null));};exports['create']=function(_0x800da7,_0x3ed796){var _0x58ad30;return db[_0x69ae('0x24')]['create'](_0x800da7[_0x69ae('0x3e')],{'raw':!![]})['then'](function(_0x239d56){_0x58ad30=_0x239d56;return db[_0x69ae('0x24')][_0x69ae('0x3a')]({'where':{'type':_0x800da7[_0x69ae('0x3e')]['type']},'raw':!![]});})[_0x69ae('0xb')](function(_0x26e8bf){if(_0x58ad30['type'][_0x69ae('0x3f')]()==_0x69ae('0x40')){var _0x4b5704=fs[_0x69ae('0x41')](path[_0x69ae('0x42')](config[_0x69ae('0x43')],_0x69ae('0x44')),_0x69ae('0x45'));var _0xbe04e4=ejs['render'](_0x4b5704,{'networks':_0x26e8bf||[]});fs['writeFileSync'](_0x69ae('0x46'),_0xbe04e4);return respondWithRpcPromise(_0x69ae('0x47'),_0x69ae('0x48'),{'module':'res_stun_monitor.so'});}else if(_0x58ad30[_0x69ae('0x27')][_0x69ae('0x3f')]()==_0x69ae('0x49')){var _0x354059=fs['readFileSync'](path[_0x69ae('0x42')](config[_0x69ae('0x43')],_0x69ae('0x4a')),'utf8');var _0x44218c=ejs[_0x69ae('0x4b')](_0x354059,{'networks':_0x26e8bf||[]});fs[_0x69ae('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x44218c);return respondWithRpcPromise(_0x69ae('0x47'),'create',{'module':_0x69ae('0x4d')});}else{var _0x16c1e6=fs[_0x69ae('0x41')](path[_0x69ae('0x42')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x164a53=ejs[_0x69ae('0x4b')](_0x16c1e6,{'networks':_0x26e8bf||[]});fs[_0x69ae('0x4c')](util['format'](_0x69ae('0x4e'),_0x800da7['body'][_0x69ae('0x27')][_0x69ae('0x4f')]()),_0x164a53);return respondWithRpcPromise(_0x69ae('0x47'),_0x69ae('0x48'),{'module':_0x69ae('0x50')});}})['then'](function(){return _0x58ad30;})[_0x69ae('0xb')](respondWithResult(_0x3ed796,0xc9))[_0x69ae('0x13')](handleError(_0x3ed796,null));};exports[_0x69ae('0x51')]=function(_0x4dab73,_0xdc6540){var _0xebbb8;return db[_0x69ae('0x24')][_0x69ae('0x52')]({'where':{'id':_0x4dab73[_0x69ae('0x3c')]['id']}})['then'](handleEntityNotFound(_0xdc6540,null))[_0x69ae('0xb')](saveUpdates(_0x4dab73[_0x69ae('0x3e')],null))['then'](function(_0x529dfc){if(_0x529dfc){_0xebbb8=_0x529dfc;return db[_0x69ae('0x24')][_0x69ae('0x3a')]({'where':{'type':_0xebbb8[_0x69ae('0x27')]},'raw':!![]});}return null;})[_0x69ae('0xb')](function(_0x2bc13d){if(_0xebbb8[_0x69ae('0x27')][_0x69ae('0x3f')]()=='STUN'){var _0x384e58=fs[_0x69ae('0x41')](path[_0x69ae('0x42')](config['root'],_0x69ae('0x44')),_0x69ae('0x45'));var _0x1d4b99=ejs['render'](_0x384e58,{'networks':_0x2bc13d||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1d4b99);return respondWithRpcPromise(_0x69ae('0x47'),'update',{'module':_0x69ae('0x4d')});}else if(_0xebbb8['type'][_0x69ae('0x3f')]()=='TURN'){var _0x4e1fcd=fs[_0x69ae('0x41')](path['join'](config[_0x69ae('0x43')],_0x69ae('0x4a')),_0x69ae('0x45'));var _0x2decb3=ejs[_0x69ae('0x4b')](_0x4e1fcd,{'networks':_0x2bc13d||[]});fs[_0x69ae('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x2decb3);return respondWithRpcPromise(_0x69ae('0x47'),_0x69ae('0x51'),{'module':_0x69ae('0x4d')});}else{var _0x585211=fs[_0x69ae('0x41')](path[_0x69ae('0x42')](config[_0x69ae('0x43')],'server/files/templates/network.ejs'),_0x69ae('0x45'));var _0x3ddbf6=ejs[_0x69ae('0x4b')](_0x585211,{'networks':_0x2bc13d||[]});fs['writeFileSync'](util['format'](_0x69ae('0x4e'),_0x4dab73[_0x69ae('0x3e')][_0x69ae('0x27')][_0x69ae('0x4f')]()),_0x3ddbf6);return respondWithRpcPromise(_0x69ae('0x47'),_0x69ae('0x51'),{'module':'chan_sip.so'});}})[_0x69ae('0xb')](function(_0xb1929c){if(_0xb1929c){return _0xebbb8;}return null;})[_0x69ae('0xb')](respondWithResult(_0xdc6540,null))[_0x69ae('0x13')](handleError(_0xdc6540,null));};exports[_0x69ae('0x1c')]=function(_0x2ae9d9,_0x20be15){var _0x5ad7d7;return db['Network']['find']({'where':{'id':_0x2ae9d9[_0x69ae('0x3c')]['id']}})[_0x69ae('0xb')](function(_0x4af8e2){_0x5ad7d7=_0x4af8e2;return _0x4af8e2;})['then'](handleEntityNotFound(_0x20be15,null))[_0x69ae('0xb')](removeEntity(_0x20be15,null))[_0x69ae('0xb')](function(){if(_0x5ad7d7){return db[_0x69ae('0x24')][_0x69ae('0x3a')]({'where':{'type':_0x5ad7d7[_0x69ae('0x27')]},'raw':!![]});}})[_0x69ae('0xb')](function(_0x36c3b3){if(_0x5ad7d7[_0x69ae('0x27')]['toUpperCase']()==_0x69ae('0x40')){var _0x18c64c=fs[_0x69ae('0x41')](path[_0x69ae('0x42')](config[_0x69ae('0x43')],_0x69ae('0x44')),'utf8');var _0x414c79=ejs[_0x69ae('0x4b')](_0x18c64c,{'networks':_0x36c3b3||[]});fs[_0x69ae('0x4c')](_0x69ae('0x46'),_0x414c79);return respondWithRpcPromise(_0x69ae('0x47'),_0x69ae('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x5ad7d7['type']['toUpperCase']()==_0x69ae('0x49')){var _0x3dfc9e=fs[_0x69ae('0x41')](path[_0x69ae('0x42')](config[_0x69ae('0x43')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1a05d8=ejs[_0x69ae('0x4b')](_0x3dfc9e,{'networks':_0x36c3b3||[]});fs[_0x69ae('0x4c')](_0x69ae('0x53'),_0x1a05d8);return respondWithRpcPromise('Reload',_0x69ae('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x6ddac9=fs[_0x69ae('0x41')](path[_0x69ae('0x42')](config[_0x69ae('0x43')],'server/files/templates/network.ejs'),_0x69ae('0x45'));var _0x4dbfe4=ejs[_0x69ae('0x4b')](_0x6ddac9,{'networks':_0x36c3b3||[]});fs['writeFileSync'](util[_0x69ae('0x54')](_0x69ae('0x4e'),_0x5ad7d7[_0x69ae('0x27')][_0x69ae('0x4f')]()),_0x4dbfe4);return respondWithRpcPromise(_0x69ae('0x47'),'destroy',{'module':'chan_sip.so'});}})[_0x69ae('0x13')](handleError(_0x20be15,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 963fb39..bd3cd8e 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 _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','network','../../config/logger','api'];(function(_0x1debda,_0xe91aba){var _0x30cde6=function(_0x252ac3){while(--_0x252ac3){_0x1debda['push'](_0x1debda['shift']());}};_0x30cde6(++_0xe91aba);}(_0x1339,0x1ed));var _0x9133=function(_0x11fb3d,_0x418ee6){_0x11fb3d=_0x11fb3d-0x0;var _0x49dcb5=_0x1339[_0x11fb3d];return _0x49dcb5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./network.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee4f=['bluebird','path','../../config/environment','Network','network','lodash','api','moment'];(function(_0x38300c,_0x4618b9){var _0x591bf6=function(_0x3595d9){while(--_0x3595d9){_0x38300c['push'](_0x38300c['shift']());}};_0x591bf6(++_0x4618b9);}(_0xee4f,0xad));var _0xfee4=function(_0x5021f2,_0x647466){_0x5021f2=_0x5021f2-0x0;var _0x29e9a5=_0xee4f[_0x5021f2];return _0x29e9a5;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfee4('0x1'));var moment=require(_0xfee4('0x2'));var BPromise=require(_0xfee4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfee4('0x4'));var rimraf=require('rimraf');var config=require(_0xfee4('0x5'));var attributes=require('./network.attributes');module['exports']=function(_0x1c39b1,_0x498647){return _0x1c39b1['define'](_0xfee4('0x6'),attributes,{'tableName':_0xfee4('0x7'),'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 453a0c7..a66493e 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x58bdc8,_0x12330b){_0x58bdc8=_0x58bdc8-0x0;var _0x52ab51=_0x7a54[_0x58bdc8];return _0x52ab51;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x291689,_0x191f5a){var _0x4ad969=function(_0x4c6aa4){while(--_0x4c6aa4){_0x291689['push'](_0x291689['shift']());}};_0x4ad969(++_0x191f5a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 450613d..b93fa1c 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 _0x530b=['/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x5e00c5,_0x1c1d33){var _0x52cab8=function(_0x49c16c){while(--_0x49c16c){_0x5e00c5['push'](_0x5e00c5['shift']());}};_0x52cab8(++_0x1c1d33);}(_0x530b,0x1e2));var _0xb530=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x530b[_0x3239f5];return _0x3559c8;};'use strict';var multer=require(_0xb530('0x0'));var util=require('util');var path=require(_0xb530('0x1'));var timeout=require('connect-timeout');var express=require(_0xb530('0x2'));var router=express['Router']();var fs_extra=require(_0xb530('0x3'));var auth=require(_0xb530('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb530('0x5'));var controller=require(_0xb530('0x6'));router['get']('/',auth[_0xb530('0x7')](),controller[_0xb530('0x8')]);router[_0xb530('0x9')](_0xb530('0xa'),auth[_0xb530('0x7')](),controller[_0xb530('0xb')]);router['get'](_0xb530('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb530('0x9')](_0xb530('0xd'),auth[_0xb530('0x7')](),controller[_0xb530('0xe')]);router['get'](_0xb530('0xf'),auth[_0xb530('0x7')](),controller['getAnswers']);router[_0xb530('0x9')](_0xb530('0x10'),auth[_0xb530('0x7')](),controller[_0xb530('0x11')]);router[_0xb530('0x9')](_0xb530('0x12'),auth['isAuthenticated'](),controller[_0xb530('0x13')]);router[_0xb530('0x9')](_0xb530('0x14'),auth[_0xb530('0x7')](),controller[_0xb530('0x15')]);router[_0xb530('0x16')]('/',auth[_0xb530('0x7')](),controller[_0xb530('0x17')]);router['post'](_0xb530('0xd'),auth[_0xb530('0x7')](),controller[_0xb530('0x18')]);router['post'](_0xb530('0xf'),auth[_0xb530('0x7')](),controller[_0xb530('0x19')]);router[_0xb530('0x16')](_0xb530('0x1a'),controller[_0xb530('0x1b')]);router[_0xb530('0x16')](_0xb530('0x10'),auth['isAuthenticated'](),controller[_0xb530('0x1c')]);router['post'](_0xb530('0x14'),auth['isAuthenticated'](),controller[_0xb530('0x1d')]);router[_0xb530('0x16')](_0xb530('0x1e'),auth['isAuthenticated'](),controller[_0xb530('0x1f')]);router['put'](_0xb530('0xc'),auth[_0xb530('0x7')](),controller[_0xb530('0x20')]);router[_0xb530('0x21')](_0xb530('0xc'),auth[_0xb530('0x7')](),controller[_0xb530('0x22')]);router[_0xb530('0x21')](_0xb530('0xd'),auth[_0xb530('0x7')](),controller[_0xb530('0x23')]);router['delete'](_0xb530('0xf'),auth['isAuthenticated'](),controller[_0xb530('0x24')]);router[_0xb530('0x21')](_0xb530('0x14'),auth['isAuthenticated'](),controller[_0xb530('0x25')]);module['exports']=router; \ No newline at end of file +var _0x86ed=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','express','Router'];(function(_0xa67c22,_0x5d9beb){var _0x7acbf2=function(_0x13be06){while(--_0x13be06){_0xa67c22['push'](_0xa67c22['shift']());}};_0x7acbf2(++_0x5d9beb);}(_0x86ed,0x182));var _0xd86e=function(_0x46ca48,_0x40245e){_0x46ca48=_0x46ca48-0x0;var _0x590580=_0x86ed[_0x46ca48];return _0x590580;};'use strict';var multer=require('multer');var util=require(_0xd86e('0x0'));var path=require(_0xd86e('0x1'));var timeout=require('connect-timeout');var express=require(_0xd86e('0x2'));var router=express[_0xd86e('0x3')]();var fs_extra=require(_0xd86e('0x4'));var auth=require(_0xd86e('0x5'));var interaction=require(_0xd86e('0x6'));var config=require(_0xd86e('0x7'));var controller=require('./openchannelAccount.controller');router[_0xd86e('0x8')]('/',auth[_0xd86e('0x9')](),controller[_0xd86e('0xa')]);router['get'](_0xd86e('0xb'),auth[_0xd86e('0x9')](),controller[_0xd86e('0xc')]);router[_0xd86e('0x8')](_0xd86e('0xd'),auth[_0xd86e('0x9')](),controller[_0xd86e('0xe')]);router['get'](_0xd86e('0xf'),auth['isAuthenticated'](),controller[_0xd86e('0x10')]);router[_0xd86e('0x8')](_0xd86e('0x11'),auth[_0xd86e('0x9')](),controller['getAnswers']);router[_0xd86e('0x8')]('/:id/applications',auth[_0xd86e('0x9')](),controller[_0xd86e('0x12')]);router[_0xd86e('0x8')](_0xd86e('0x13'),auth['isAuthenticated'](),controller[_0xd86e('0x14')]);router[_0xd86e('0x8')](_0xd86e('0x15'),auth['isAuthenticated'](),controller[_0xd86e('0x16')]);router[_0xd86e('0x17')]('/',auth['isAuthenticated'](),controller[_0xd86e('0x18')]);router[_0xd86e('0x17')]('/:id/dispositions',auth[_0xd86e('0x9')](),controller['addDisposition']);router[_0xd86e('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xd86e('0x19'),controller[_0xd86e('0x1a')]);router[_0xd86e('0x17')](_0xd86e('0x1b'),auth[_0xd86e('0x9')](),controller[_0xd86e('0x1c')]);router[_0xd86e('0x17')](_0xd86e('0x15'),auth['isAuthenticated'](),controller[_0xd86e('0x1d')]);router['post'](_0xd86e('0x1e'),auth[_0xd86e('0x9')](),controller[_0xd86e('0x1f')]);router[_0xd86e('0x20')](_0xd86e('0xd'),auth['isAuthenticated'](),controller[_0xd86e('0x21')]);router[_0xd86e('0x22')]('/:id',auth['isAuthenticated'](),controller[_0xd86e('0x23')]);router['delete'](_0xd86e('0xf'),auth['isAuthenticated'](),controller[_0xd86e('0x24')]);router[_0xd86e('0x22')](_0xd86e('0x11'),auth[_0xd86e('0x9')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xd86e('0x25')]);module[_0xd86e('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 655d474..86d78ad 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 _0x3692=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','TEXT','BOOLEAN'];(function(_0x23fb80,_0x1acc9a){var _0xd39aaf=function(_0x11e6a9){while(--_0x11e6a9){_0x23fb80['push'](_0x23fb80['shift']());}};_0xd39aaf(++_0x1acc9a);}(_0x3692,0x1b3));var _0x2369=function(_0x5e570c,_0x233990){_0x5e570c=_0x5e570c-0x0;var _0xc62527=_0x3692[_0x5e570c];return _0xc62527;};'use strict';var Sequelize=require(_0x2369('0x0'));var rs=require('randomstring');module[_0x2369('0x1')]={'name':{'type':Sequelize[_0x2369('0x2')],'unique':_0x2369('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2369('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2369('0x4')]();}},'replyUri':{'type':Sequelize[_0x2369('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2369('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2369('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2369('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2369('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2369('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2369('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2369('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2369('0x6')],'defaultValue':![],'comment':_0x2369('0x9'),'set':function(_0x3840ce){if(!_0x3840ce)this['setDataValue'](_0x2369('0xa'),null);this[_0x2369('0xb')](_0x2369('0xc'),_0x3840ce);}}}; \ No newline at end of file +var _0x4d20=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','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'];(function(_0x3a5854,_0x17de60){var _0x33f545=function(_0x33cfaf){while(--_0x33cfaf){_0x3a5854['push'](_0x3a5854['shift']());}};_0x33f545(++_0x17de60);}(_0x4d20,0xd2));var _0x04d2=function(_0x2f27fe,_0x1284a6){_0x2f27fe=_0x2f27fe-0x0;var _0x1c03ca=_0x4d20[_0x2f27fe];return _0x1c03ca;};'use strict';var Sequelize=require(_0x04d2('0x0'));var rs=require(_0x04d2('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x04d2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x04d2('0x3')]},'token':{'type':Sequelize[_0x04d2('0x3')],'defaultValue':function(){return rs[_0x04d2('0x4')]();}},'replyUri':{'type':Sequelize[_0x04d2('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x04d2('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x04d2('0x5')],'defaultValue':function(){return _0x04d2('0x6');}},'notificationSound':{'type':Sequelize[_0x04d2('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04d2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x04d2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x04d2('0x7')],'defaultValue':![],'comment':_0x04d2('0x9'),'set':function(_0x21df0e){if(!_0x21df0e)this[_0x04d2('0xa')](_0x04d2('0xb'),null);this[_0x04d2('0xa')](_0x04d2('0xc'),_0x21df0e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fd1eb3a..65b08e0 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 _0xe6c1=['startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','dataValues','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','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','OpenchannelAccount','include','findAll','show','params','includeAll','catch','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','list','applications','orderBy','priority','asc','account','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start'];(function(_0x1b6617,_0x312ff5){var _0x5d02d1=function(_0x5be3e5){while(--_0x5be3e5){_0x1b6617['push'](_0x1b6617['shift']());}};_0x5d02d1(++_0x312ff5);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'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'];config[_0x1e6c('0x1a')]=_['defaults'](config[_0x1e6c('0x1a')],{'host':_0x1e6c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e6c('0x1a')]));require(_0x1e6c('0x1c'))[_0x1e6c('0x1d')](socket);var jayson=require(_0x1e6c('0x1e'));var client=jayson[_0x1e6c('0x1f')][_0x1e6c('0x20')]({'port':0x232c});var client9002=jayson[_0x1e6c('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e8769,_0x30cff0,_0x1f79bb,_0x373cc2){return new BPromise(function(_0x3e0c94,_0x5b0778){var _0x42a511=_0x373cc2||client;return _0x42a511[_0x1e6c('0x21')](_0x1e8769,_0x1f79bb)[_0x1e6c('0x22')](function(_0xa72404){logger['info'](_0x1e6c('0x23'),_0x30cff0,_0x1e6c('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x30cff0,_0x1e6c('0x24'),JSON[_0x1e6c('0x25')](_0xa72404));if(_0xa72404[_0x1e6c('0x26')]){if(_0xa72404[_0x1e6c('0x26')][_0x1e6c('0x27')]===0x1f4){logger['error'](_0x1e6c('0x23'),_0x30cff0,_0xa72404[_0x1e6c('0x26')][_0x1e6c('0x28')]);return _0x5b0778(_0xa72404['error']['message']);}logger[_0x1e6c('0x26')](_0x1e6c('0x23'),_0x30cff0,_0xa72404['error'][_0x1e6c('0x28')]);return _0x3e0c94(_0xa72404['error']['message']);}else{logger[_0x1e6c('0x29')](_0x1e6c('0x23'),_0x30cff0,_0x1e6c('0x24'));_0x3e0c94(_0xa72404[_0x1e6c('0x2a')][_0x1e6c('0x28')]);}})['catch'](function(_0x2bdd9e){logger[_0x1e6c('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x30cff0,_0x2bdd9e);_0x5b0778(_0x2bdd9e);});});}function respondWithStatusCode(_0x3c372d,_0x37df4b){_0x37df4b=_0x37df4b||0xcc;return function(_0x586cad){if(_0x586cad){return _0x3c372d['sendStatus'](_0x37df4b);}return _0x3c372d[_0x1e6c('0x2b')](_0x37df4b)[_0x1e6c('0x2c')]();};}function respondWithResult(_0x42e1c1,_0x2dad9a){_0x2dad9a=_0x2dad9a||0xc8;return function(_0x5df7e4){if(_0x5df7e4){return _0x42e1c1[_0x1e6c('0x2b')](_0x2dad9a)[_0x1e6c('0x2d')](_0x5df7e4);}};}function respondWithFilteredResult(_0x1f8d2b,_0x9e2f3c){return function(_0x247a57){if(_0x247a57){var _0x485620=typeof _0x9e2f3c['offset']===_0x1e6c('0x2e')&&typeof _0x9e2f3c[_0x1e6c('0x2f')]===_0x1e6c('0x2e');var _0x5afdd9=_0x247a57[_0x1e6c('0x30')];var _0x2b9dc4=_0x485620?0x0:_0x9e2f3c[_0x1e6c('0x31')];var _0x4335df=_0x485620?_0x247a57[_0x1e6c('0x30')]:_0x9e2f3c[_0x1e6c('0x31')]+_0x9e2f3c['limit'];var _0x2d63e8;if(_0x4335df>=_0x5afdd9){_0x4335df=_0x5afdd9;_0x2d63e8=0xc8;}else{_0x2d63e8=0xce;}_0x1f8d2b['status'](_0x2d63e8);return _0x1f8d2b[_0x1e6c('0x32')](_0x1e6c('0x33'),_0x2b9dc4+'-'+_0x4335df+'/'+_0x5afdd9)['json'](_0x247a57);}return null;};}function patchUpdates(_0x29a87a){return function(_0x1c3d31){try{jsonpatch[_0x1e6c('0x34')](_0x1c3d31,_0x29a87a,!![]);}catch(_0xf4122){return BPromise['reject'](_0xf4122);}return _0x1c3d31[_0x1e6c('0x35')]();};}function saveUpdates(_0x23a175,_0x3ec5e5){return function(_0xdf37ac){if(_0xdf37ac){return _0xdf37ac[_0x1e6c('0x36')](_0x23a175)['then'](function(_0x424db9){return _0x424db9;});}return null;};}function removeEntity(_0x44b801,_0x1509a0){return function(_0x3bb206){if(_0x3bb206){return _0x3bb206['destroy']()[_0x1e6c('0x22')](function(){var _0x4153d6=_0x3bb206[_0x1e6c('0x37')]({'plain':!![]});var _0x2c63af='OpenchannelAccounts';return db[_0x1e6c('0x38')]['destroy']({'where':{'type':_0x2c63af,'resourceId':_0x4153d6['id']}})[_0x1e6c('0x22')](function(){return _0x3bb206;});})[_0x1e6c('0x22')](function(){_0x44b801[_0x1e6c('0x2b')](0xcc)[_0x1e6c('0x2c')]();});}};}function handleEntityNotFound(_0x50bbfc,_0x21d848){return function(_0x34c45f){if(!_0x34c45f){_0x50bbfc[_0x1e6c('0x39')](0x194);}return _0x34c45f;};}function handleError(_0x2647fc,_0x5d79ed){_0x5d79ed=_0x5d79ed||0x1f4;return function(_0x534b0e){logger[_0x1e6c('0x26')](_0x534b0e['stack']);if(_0x534b0e[_0x1e6c('0x3a')]){delete _0x534b0e[_0x1e6c('0x3a')];}_0x2647fc[_0x1e6c('0x2b')](_0x5d79ed)[_0x1e6c('0x3b')](_0x534b0e);};}exports['index']=function(_0x4ef884,_0x4018cf){var _0x5840ae={'include':[{'model':db[_0x1e6c('0x3c')],'as':_0x1e6c('0x3d')}]},_0x4b4a5f={},_0x3800e0={'count':0x0,'rows':[]};var _0x45f638=_[_0x1e6c('0x3e')](db['OpenchannelAccount'][_0x1e6c('0x3f')],function(_0x142607){return{'name':_0x142607[_0x1e6c('0x40')],'type':_0x142607[_0x1e6c('0x41')][_0x1e6c('0x42')]};});_0x4b4a5f['model']=_[_0x1e6c('0x3e')](_0x45f638,_0x1e6c('0x3a'));_0x4b4a5f[_0x1e6c('0x43')]=_[_0x1e6c('0x44')](_0x4ef884[_0x1e6c('0x43')]);_0x4b4a5f[_0x1e6c('0x45')]=_['intersection'](_0x4b4a5f[_0x1e6c('0x46')],_0x4b4a5f['query']);_0x5840ae[_0x1e6c('0x47')]=_[_0x1e6c('0x48')](_0x4b4a5f[_0x1e6c('0x46')],qs[_0x1e6c('0x49')](_0x4ef884[_0x1e6c('0x43')][_0x1e6c('0x49')]));_0x5840ae[_0x1e6c('0x47')]=_0x5840ae[_0x1e6c('0x47')][_0x1e6c('0x4a')]?_0x5840ae[_0x1e6c('0x47')]:_0x4b4a5f[_0x1e6c('0x46')];if(!_0x4ef884[_0x1e6c('0x43')][_0x1e6c('0x4b')](_0x1e6c('0x4c'))){_0x5840ae[_0x1e6c('0x2f')]=qs[_0x1e6c('0x2f')](_0x4ef884[_0x1e6c('0x43')]['limit']);_0x5840ae[_0x1e6c('0x31')]=qs['offset'](_0x4ef884['query'][_0x1e6c('0x31')]);}_0x5840ae['order']=qs[_0x1e6c('0x4d')](_0x4ef884['query'][_0x1e6c('0x4d')]);_0x5840ae[_0x1e6c('0x4e')]=qs[_0x1e6c('0x45')](_[_0x1e6c('0x4f')](_0x4ef884[_0x1e6c('0x43')],_0x4b4a5f[_0x1e6c('0x45')]),_0x45f638);if(_0x4ef884[_0x1e6c('0x43')][_0x1e6c('0x50')]){_0x5840ae['where']=_[_0x1e6c('0x51')](_0x5840ae['where'],{'$or':_[_0x1e6c('0x3e')](_0x45f638,function(_0x52f844){if(_0x52f844[_0x1e6c('0x41')]!=='VIRTUAL'){var _0xfcdb85={};_0xfcdb85[_0x52f844[_0x1e6c('0x3a')]]={'$like':'%'+_0x4ef884[_0x1e6c('0x43')][_0x1e6c('0x50')]+'%'};return _0xfcdb85;}})});}_0x5840ae=_[_0x1e6c('0x51')]({},_0x5840ae,_0x4ef884[_0x1e6c('0x52')]);var _0x41738d={'where':_0x5840ae['where']};return db[_0x1e6c('0x53')]['count'](_0x41738d)[_0x1e6c('0x22')](function(_0x5a463f){_0x3800e0['count']=_0x5a463f;if(_0x4ef884[_0x1e6c('0x43')]['includeAll']){_0x5840ae[_0x1e6c('0x54')]=[{'all':!![]}];}return db[_0x1e6c('0x53')][_0x1e6c('0x55')](_0x5840ae);})[_0x1e6c('0x22')](function(_0x3ffd94){_0x3800e0['rows']=_0x3ffd94;return _0x3800e0;})[_0x1e6c('0x22')](respondWithFilteredResult(_0x4018cf,_0x5840ae))['catch'](handleError(_0x4018cf,null));};exports[_0x1e6c('0x56')]=function(_0x3201b5,_0x36235e){var _0x5ad964={'raw':![],'where':{'id':_0x3201b5[_0x1e6c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x1e6c('0x3d')}]},_0x3b30e2={};_0x3b30e2[_0x1e6c('0x46')]=_[_0x1e6c('0x44')](db[_0x1e6c('0x53')]['rawAttributes']);_0x3b30e2[_0x1e6c('0x43')]=_[_0x1e6c('0x44')](_0x3201b5[_0x1e6c('0x43')]);_0x3b30e2[_0x1e6c('0x45')]=_['intersection'](_0x3b30e2[_0x1e6c('0x46')],_0x3b30e2[_0x1e6c('0x43')]);_0x5ad964[_0x1e6c('0x47')]=_['intersection'](_0x3b30e2[_0x1e6c('0x46')],qs[_0x1e6c('0x49')](_0x3201b5[_0x1e6c('0x43')][_0x1e6c('0x49')]));_0x5ad964[_0x1e6c('0x47')]=_0x5ad964[_0x1e6c('0x47')][_0x1e6c('0x4a')]?_0x5ad964[_0x1e6c('0x47')]:_0x3b30e2[_0x1e6c('0x46')];if(_0x3201b5[_0x1e6c('0x43')][_0x1e6c('0x58')]){_0x5ad964[_0x1e6c('0x54')]=[{'all':!![]}];}_0x5ad964=_['merge']({},_0x5ad964,_0x3201b5[_0x1e6c('0x52')]);return db[_0x1e6c('0x53')]['find'](_0x5ad964)[_0x1e6c('0x22')](handleEntityNotFound(_0x36235e,null))[_0x1e6c('0x22')](respondWithResult(_0x36235e,null))[_0x1e6c('0x59')](handleError(_0x36235e,null));};exports['create']=function(_0x1fad72,_0x596466){return db['OpenchannelAccount'][_0x1e6c('0x5a')](_0x1fad72[_0x1e6c('0x5b')],{})['then'](function(_0x591a30){var _0x383c4f=_0x1fad72[_0x1e6c('0x5c')][_0x1e6c('0x37')]({'plain':!![]});if(!_0x383c4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x383c4f[_0x1e6c('0x5d')]==='user'){var _0x9bd68b=_0x591a30[_0x1e6c('0x37')]({'plain':!![]});var _0x3f0484='OpenchannelAccounts';return db[_0x1e6c('0x5e')]['find']({'where':{'name':_0x3f0484,'userProfileId':_0x383c4f[_0x1e6c('0x5f')]},'raw':!![]})[_0x1e6c('0x22')](function(_0x495ef4){if(_0x495ef4&&_0x495ef4['autoAssociation']===0x0){return db[_0x1e6c('0x38')][_0x1e6c('0x5a')]({'name':_0x9bd68b[_0x1e6c('0x3a')],'resourceId':_0x9bd68b['id'],'type':_0x495ef4[_0x1e6c('0x3a')],'sectionId':_0x495ef4['id']},{})[_0x1e6c('0x22')](function(){return _0x591a30;});}else{return _0x591a30;}})[_0x1e6c('0x59')](function(_0xd62229){logger['error'](_0x1e6c('0x60'),_0xd62229);throw _0xd62229;});}return _0x591a30;})[_0x1e6c('0x22')](respondWithResult(_0x596466,0xc9))[_0x1e6c('0x59')](handleError(_0x596466,null));};exports[_0x1e6c('0x36')]=function(_0x2b2ad2,_0x148f36){if(_0x2b2ad2['body']['id']){delete _0x2b2ad2[_0x1e6c('0x5b')]['id'];}return db[_0x1e6c('0x53')][_0x1e6c('0x61')]({'where':{'id':_0x2b2ad2[_0x1e6c('0x57')]['id']},'include':[{'model':db[_0x1e6c('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x1e6c('0x22')](handleEntityNotFound(_0x148f36,null))['then'](saveUpdates(_0x2b2ad2[_0x1e6c('0x5b')],null))['then'](respondWithResult(_0x148f36,null))[_0x1e6c('0x59')](handleError(_0x148f36,null));};exports[_0x1e6c('0x62')]=function(_0x5563fe,_0x241016){return db[_0x1e6c('0x53')][_0x1e6c('0x61')]({'where':{'id':_0x5563fe[_0x1e6c('0x57')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x241016,null))[_0x1e6c('0x22')](removeEntity(_0x241016,null))['catch'](handleError(_0x241016,null));};exports[_0x1e6c('0x63')]=function(_0x4af60a,_0x2eee16){return db[_0x1e6c('0x53')][_0x1e6c('0x63')]()['then'](respondWithResult(_0x2eee16,null))[_0x1e6c('0x59')](handleError(_0x2eee16,null));};exports[_0x1e6c('0x64')]=function(_0x3d3769,_0x1b0669,_0x33c238){if(_0x3d3769[_0x1e6c('0x5b')]['id']){delete _0x3d3769[_0x1e6c('0x5b')]['id'];}return db[_0x1e6c('0x53')]['find']({'where':{'id':_0x3d3769['params']['id']}})['then'](handleEntityNotFound(_0x1b0669,null))['then'](function(_0x16daf7){if(_0x16daf7){_0x3d3769['body'][_0x1e6c('0x65')]=_0x16daf7['id'];return db[_0x1e6c('0x66')][_0x1e6c('0x5a')](_0x3d3769[_0x1e6c('0x5b')]);}})[_0x1e6c('0x22')](respondWithResult(_0x1b0669,null))[_0x1e6c('0x59')](handleError(_0x1b0669,null));};exports['getDispositions']=function(_0x14436d,_0x2c9925,_0x442c90){var _0x24198d={'raw':![],'where':{}};var _0x19e688={};var _0x4670af={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1e6c('0x67')]({'where':{'id':_0x14436d['params']['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x2c9925,null))['then'](function(_0x595f43){if(_0x595f43){_0x19e688[_0x1e6c('0x46')]=_[_0x1e6c('0x44')](db[_0x1e6c('0x66')][_0x1e6c('0x3f')]);_0x19e688[_0x1e6c('0x43')]=_[_0x1e6c('0x44')](_0x14436d[_0x1e6c('0x43')]);_0x19e688[_0x1e6c('0x45')]=_[_0x1e6c('0x48')](_0x19e688[_0x1e6c('0x46')],_0x19e688['query']);_0x24198d['attributes']=_[_0x1e6c('0x48')](_0x19e688[_0x1e6c('0x46')],qs['fields'](_0x14436d[_0x1e6c('0x43')][_0x1e6c('0x49')]));_0x24198d[_0x1e6c('0x47')]=_0x24198d[_0x1e6c('0x47')]['length']?_0x24198d[_0x1e6c('0x47')]:_0x19e688['model'];if(!_0x14436d[_0x1e6c('0x43')][_0x1e6c('0x4b')]('nolimit')){_0x24198d['limit']=qs[_0x1e6c('0x2f')](_0x14436d['query'][_0x1e6c('0x2f')]);_0x24198d[_0x1e6c('0x31')]=qs[_0x1e6c('0x31')](_0x14436d[_0x1e6c('0x43')][_0x1e6c('0x31')]);}_0x24198d[_0x1e6c('0x68')]=qs[_0x1e6c('0x4d')](_0x14436d[_0x1e6c('0x43')][_0x1e6c('0x4d')]);_0x24198d['where']=qs[_0x1e6c('0x45')](_[_0x1e6c('0x4f')](_0x14436d[_0x1e6c('0x43')],_0x19e688[_0x1e6c('0x45')]));_0x24198d[_0x1e6c('0x4e')][_0x1e6c('0x65')]=_0x595f43['id'];if(_0x14436d['query'][_0x1e6c('0x50')]){_0x24198d['where']=_[_0x1e6c('0x51')](_0x24198d[_0x1e6c('0x4e')],{'$or':_[_0x1e6c('0x3e')](_0x24198d[_0x1e6c('0x47')],function(_0xbbe9a2){var _0x3fb467={};_0x3fb467[_0xbbe9a2]={'$like':'%'+_0x14436d[_0x1e6c('0x43')]['filter']+'%'};return _0x3fb467;})});}_0x24198d=_[_0x1e6c('0x51')]({},_0x24198d,_0x14436d[_0x1e6c('0x52')]);return db['Disposition']['count']({'where':_0x24198d[_0x1e6c('0x4e')]})[_0x1e6c('0x22')](function(_0x3007ce){_0x4670af['count']=_0x3007ce;if(_0x14436d[_0x1e6c('0x43')][_0x1e6c('0x58')]){_0x24198d[_0x1e6c('0x54')]=[{'all':!![]}];}return db[_0x1e6c('0x66')][_0x1e6c('0x55')](_0x24198d);})[_0x1e6c('0x22')](function(_0x1b8782){_0x4670af['rows']=_0x1b8782;return _0x4670af;});}})[_0x1e6c('0x22')](respondWithFilteredResult(_0x2c9925,_0x24198d))[_0x1e6c('0x59')](handleError(_0x2c9925,null));};exports['removeDispositions']=function(_0xdd021d,_0x2cff6b,_0x1ac35b){return db['OpenchannelAccount']['find']({'where':{'id':_0xdd021d['params']['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x2cff6b,null))[_0x1e6c('0x22')](function(_0x194a25){if(_0x194a25){return _0x194a25[_0x1e6c('0x69')](_0xdd021d[_0x1e6c('0x43')][_0x1e6c('0x6a')]);}})[_0x1e6c('0x22')](respondWithStatusCode(_0x2cff6b,null))[_0x1e6c('0x59')](handleError(_0x2cff6b,null));};exports[_0x1e6c('0x6b')]=function(_0x4fde98,_0x5e84f2,_0x1e9e23){if(_0x4fde98[_0x1e6c('0x5b')]['id']){delete _0x4fde98[_0x1e6c('0x5b')]['id'];}return db[_0x1e6c('0x53')][_0x1e6c('0x61')]({'where':{'id':_0x4fde98[_0x1e6c('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e84f2,null))['then'](function(_0x1671b3){if(_0x1671b3){_0x4fde98[_0x1e6c('0x5b')]['OpenchannelAccountId']=_0x1671b3['id'];return db[_0x1e6c('0x6c')][_0x1e6c('0x5a')](_0x4fde98[_0x1e6c('0x5b')]);}})[_0x1e6c('0x22')](respondWithResult(_0x5e84f2,null))[_0x1e6c('0x59')](handleError(_0x5e84f2,null));};exports[_0x1e6c('0x6d')]=function(_0x33f266,_0x23dc97,_0x5e9d0e){var _0xa4771d={'raw':![],'where':{}};var _0x56ffe8={};var _0x513e1b={'count':0x0,'rows':[]};return db[_0x1e6c('0x53')]['findOne']({'where':{'id':_0x33f266[_0x1e6c('0x57')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x23dc97,null))[_0x1e6c('0x22')](function(_0x5bdb1c){if(_0x5bdb1c){_0x56ffe8[_0x1e6c('0x46')]=_[_0x1e6c('0x44')](db[_0x1e6c('0x6c')]['rawAttributes']);_0x56ffe8[_0x1e6c('0x43')]=_[_0x1e6c('0x44')](_0x33f266['query']);_0x56ffe8[_0x1e6c('0x45')]=_[_0x1e6c('0x48')](_0x56ffe8[_0x1e6c('0x46')],_0x56ffe8[_0x1e6c('0x43')]);_0xa4771d[_0x1e6c('0x47')]=_[_0x1e6c('0x48')](_0x56ffe8[_0x1e6c('0x46')],qs[_0x1e6c('0x49')](_0x33f266[_0x1e6c('0x43')]['fields']));_0xa4771d[_0x1e6c('0x47')]=_0xa4771d[_0x1e6c('0x47')]['length']?_0xa4771d[_0x1e6c('0x47')]:_0x56ffe8['model'];if(!_0x33f266['query']['hasOwnProperty'](_0x1e6c('0x4c'))){_0xa4771d[_0x1e6c('0x2f')]=qs['limit'](_0x33f266[_0x1e6c('0x43')][_0x1e6c('0x2f')]);_0xa4771d[_0x1e6c('0x31')]=qs[_0x1e6c('0x31')](_0x33f266[_0x1e6c('0x43')][_0x1e6c('0x31')]);}_0xa4771d['order']=qs[_0x1e6c('0x4d')](_0x33f266['query'][_0x1e6c('0x4d')]);_0xa4771d[_0x1e6c('0x4e')]=qs[_0x1e6c('0x45')](_[_0x1e6c('0x4f')](_0x33f266[_0x1e6c('0x43')],_0x56ffe8[_0x1e6c('0x45')]));_0xa4771d[_0x1e6c('0x4e')][_0x1e6c('0x65')]=_0x5bdb1c['id'];if(_0x33f266[_0x1e6c('0x43')][_0x1e6c('0x50')]){_0xa4771d['where']=_['merge'](_0xa4771d[_0x1e6c('0x4e')],{'$or':_[_0x1e6c('0x3e')](_0xa4771d[_0x1e6c('0x47')],function(_0x159ddf){var _0x1503e9={};_0x1503e9[_0x159ddf]={'$like':'%'+_0x33f266[_0x1e6c('0x43')][_0x1e6c('0x50')]+'%'};return _0x1503e9;})});}_0xa4771d=_[_0x1e6c('0x51')]({},_0xa4771d,_0x33f266['options']);return db['CannedAnswer'][_0x1e6c('0x30')]({'where':_0xa4771d['where']})[_0x1e6c('0x22')](function(_0x5b1e8c){_0x513e1b[_0x1e6c('0x30')]=_0x5b1e8c;if(_0x33f266[_0x1e6c('0x43')][_0x1e6c('0x58')]){_0xa4771d['include']=[{'all':!![]}];}return db[_0x1e6c('0x6c')][_0x1e6c('0x55')](_0xa4771d);})[_0x1e6c('0x22')](function(_0x229a14){_0x513e1b[_0x1e6c('0x6e')]=_0x229a14;return _0x513e1b;});}})[_0x1e6c('0x22')](respondWithFilteredResult(_0x23dc97,_0xa4771d))[_0x1e6c('0x59')](handleError(_0x23dc97,null));};exports[_0x1e6c('0x6f')]=function(_0x49c245,_0x12b304,_0x4c9889){return db[_0x1e6c('0x53')][_0x1e6c('0x61')]({'where':{'id':_0x49c245[_0x1e6c('0x57')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x12b304,null))[_0x1e6c('0x22')](function(_0x44484d){if(_0x44484d){return _0x44484d[_0x1e6c('0x6f')](_0x49c245['query'][_0x1e6c('0x6a')]);}})[_0x1e6c('0x22')](respondWithStatusCode(_0x12b304,null))[_0x1e6c('0x59')](handleError(_0x12b304,null));};exports[_0x1e6c('0x70')]=function(_0x1e4a80,_0x5f0f54,_0x5efbcf){var _0x106e75={'body':_0x1e4a80['body'],'channel':_0x1e6c('0x71')};var _0x59d73d=[];var _0x1ac8bd=[];var _0x2d832a={};var _0x153e34=![];return db[_0x1e6c('0x72')][_0x1e6c('0x63')]()[_0x1e6c('0x22')](function(_0x34d1f4){if(!_0x34d1f4){throw new db['Sequelize'][(_0x1e6c('0x73'))]('no\x20available\x20attributes');}_0x59d73d=_[_0x1e6c('0x74')](_['keys'](_0x34d1f4),['createdAt',_0x1e6c('0x75')]);_0x1ac8bd=_['difference'](_['keys'](_0x34d1f4),[_0x1e6c('0x76'),_0x1e6c('0x75'),_0x1e6c('0x77'),_0x1e6c('0x78')]);if(_0x1e4a80[_0x1e6c('0x5b')]['id']){delete _0x1e4a80[_0x1e6c('0x5b')]['id'];}if(_[_0x1e6c('0x79')](_0x1e4a80[_0x1e6c('0x5b')]['from'])){throw new db[(_0x1e6c('0x7a'))][(_0x1e6c('0x73'))](_0x1e6c('0x7b'));}if(_[_0x1e6c('0x79')](_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x5b')])||_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x5b')]===''){throw new db[(_0x1e6c('0x7a'))][(_0x1e6c('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e6c('0x79')](_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x7c')])){throw new db[(_0x1e6c('0x7a'))][(_0x1e6c('0x73'))](_0x1e6c('0x7d')+_0x1ac8bd);}if(!_[_0x1e6c('0x7e')](_0x1ac8bd,_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x7c')])){throw new db[(_0x1e6c('0x7a'))][(_0x1e6c('0x73'))](_0x1e6c('0x7f')+_0x1ac8bd);}_0x2d832a[_0x1e4a80['body'][_0x1e6c('0x7c')]]=_0x1e4a80['body'][_0x1e6c('0x80')];})['then'](function(){return db[_0x1e6c('0x53')][_0x1e6c('0x61')]({'where':{'id':_0x1e4a80[_0x1e6c('0x57')]['id']},'include':[{'model':db[_0x1e6c('0x81')],'as':_0x1e6c('0x82'),'include':[{'model':db[_0x1e6c('0x72')],'as':_0x1e6c('0x83'),'where':_0x2d832a,'limit':0x1,'order':[[_0x1e6c('0x75'),_0x1e6c('0x84')]]}]},{'model':db[_0x1e6c('0x85')],'as':_0x1e6c('0x86')}]});})['then'](handleEntityNotFound(_0x5f0f54,null))['then'](function(_0x52ff08){if(_0x52ff08&&_0x52ff08[_0x1e6c('0x82')]){_0x106e75['account']=_0x52ff08;_0x106e75['applications']=_0x52ff08[_0x1e6c('0x86')];_0x106e75[_0x1e6c('0x87')]=_0x52ff08['List'];_0x106e75[_0x1e6c('0x88')]=_[_0x1e6c('0x89')](_0x106e75[_0x1e6c('0x88')],[_0x1e6c('0x8a')],[_0x1e6c('0x8b')]);if(_0x106e75[_0x1e6c('0x8c')]['Applications']){delete _0x106e75['account']['Applications'];}if(_0x106e75[_0x1e6c('0x8c')][_0x1e6c('0x82')]&&_0x106e75[_0x1e6c('0x8c')][_0x1e6c('0x82')][_0x1e6c('0x83')][_0x1e6c('0x4a')]){return _0x106e75['account'][_0x1e6c('0x82')][_0x1e6c('0x83')][0x0];}var _0x1a476a=_[_0x1e6c('0x8d')](_0x1e4a80[_0x1e6c('0x5b')],{'firstName':_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x80')],'ListId':_0x52ff08[_0x1e6c('0x78')]});_0x1a476a[_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x7c')]]=_0x1e4a80['body'][_0x1e6c('0x80')];return db[_0x1e6c('0x72')][_0x1e6c('0x5a')](_0x1a476a,{'fields':_0x59d73d,'raw':!![]});}})[_0x1e6c('0x22')](handleEntityNotFound(_0x5f0f54,null))[_0x1e6c('0x22')](function(_0x2f1e11){_0x106e75['contact']=_0x2f1e11;if(_0x2f1e11){var _0x5b1db7={'ContactId':_0x2f1e11['id'],'OpenchannelAccountId':_0x1e4a80[_0x1e6c('0x57')]['id'],'from':(_0x2f1e11[_0x1e6c('0x8e')]||'')+'\x20'+(_0x2f1e11[_0x1e6c('0x8f')]||'')};var _0x42c65e={'OpenchannelAccountId':_0x1e4a80[_0x1e6c('0x57')]['id'],'closed':![]};if(_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x90')]){_0x42c65e[_0x1e6c('0x90')]=_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x90')];return db[_0x1e6c('0x91')]['find']({'where':_0x42c65e})[_0x1e6c('0x22')](function(_0xf5df6f){if(_0xf5df6f){return[_0xf5df6f,![]];}_0x5b1db7[_0x1e6c('0x90')]=_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x90')];_0x5b1db7[_0x1e6c('0x92')]=_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x92')];return db[_0x1e6c('0x91')][_0x1e6c('0x5a')](_0x5b1db7)['then'](function(_0xb72c30){return[_0xb72c30,!![]];});});}else{_0x42c65e['threadId']=null;}_0x42c65e[_0x1e6c('0x93')]=_0x2f1e11['id'];return db['OpenchannelInteraction'][_0x1e6c('0x61')]({'where':_0x42c65e})[_0x1e6c('0x22')](function(_0x4ff321){if(_0x4ff321){return[_0x4ff321,![]];}return db[_0x1e6c('0x91')][_0x1e6c('0x5a')](_0x5b1db7)[_0x1e6c('0x22')](function(_0x13c65c){return[_0x13c65c,!![]];});});}})[_0x1e6c('0x94')](function(_0x55475b,_0x190ff0){if(_0x55475b){_0x153e34=_0x190ff0;if(!_0x190ff0){var _0x2a31c1={'from':(_0x106e75[_0x1e6c('0x95')][_0x1e6c('0x8e')]||'')+'\x20'+(_0x106e75[_0x1e6c('0x95')][_0x1e6c('0x8f')]||'')};if(_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x90')]&&_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x96')]&&_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x90')]!=_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x96')]){_0x2a31c1[_0x1e6c('0x90')]=_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x96')];}return _0x55475b['update'](_0x2a31c1);}else{return _0x55475b;}}})[_0x1e6c('0x22')](function(_0x5adccf){_0x106e75[_0x1e6c('0x97')]=_0x5adccf['get']({'plain':!![]});_0x106e75[_0x1e6c('0x97')][_0x1e6c('0x98')]=_0x153e34;if(_0x106e75[_0x1e6c('0x97')]['created']){if(_0x106e75[_0x1e6c('0x8c')]['autoclose']){_0x106e75[_0x1e6c('0x88')]['push']({'id':0x0,'priority':_0x106e75[_0x1e6c('0x88')][_0x1e6c('0x4a')]+0x1,'app':'close','appdata':_0x1e6c('0x99'),'interval':'*,*,*,*'});}}return db[_0x1e6c('0x9a')][_0x1e6c('0x5a')]({'body':_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x5b')],'OpenchannelAccountId':_0x1e4a80['params']['id'],'OpenchannelInteractionId':_0x5adccf['id'],'direction':'in','ContactId':_0x106e75[_0x1e6c('0x95')]['id'],'AttachmentId':_0x1e4a80[_0x1e6c('0x5b')][_0x1e6c('0x9b')]});})[_0x1e6c('0x22')](function(_0x1dc255){_0x106e75['message']=_0x1dc255;if(_0x106e75[_0x1e6c('0x97')]['UserId']){return db[_0x1e6c('0x9c')][_0x1e6c('0x61')]({'attributes':['id',_0x1e6c('0x3a')],'where':{'id':_0x106e75[_0x1e6c('0x97')][_0x1e6c('0x9d')]}})['then'](function(_0x54fc7d){if(_0x54fc7d){_0x106e75['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x1e6c('0x9e'),'appdata':_0x54fc7d[_0x1e6c('0x3a')]+','+(_0x106e75[_0x1e6c('0x8c')][_0x1e6c('0x9f')]||0xa),'interval':'*,*,*,*'});_0x106e75[_0x1e6c('0xa0')]=![];}return respondWithRpcPromise(_0x1e6c('0xa1'),_0x1e6c('0xa2'),_0x106e75);});}return respondWithRpcPromise(_0x1e6c('0xa1'),_0x1e6c('0xa2'),_0x106e75);})[_0x1e6c('0x22')](function(_0x2ed855){respondWithRpcPromise(_0x1e6c('0xa3'),'EventManager',{'event':_0x1e6c('0x70'),'message':_0x2ed855},client9002);return _0x2ed855;})[_0x1e6c('0x22')](respondWithResult(_0x5f0f54,null))['catch'](handleError(_0x5f0f54,null));};exports[_0x1e6c('0xa4')]=function(_0x504924,_0x27f861){var _0x2799cb=_0x504924[_0x1e6c('0x57')]['id'];var _0x584724=_0x504924[_0x1e6c('0x5b')];var _0x5a14b5=0xc8;var _0x35bba0=null;return db[_0x1e6c('0xa5')][_0x1e6c('0xa6')]({'isolationLevel':db[_0x1e6c('0xa5')]['Transaction'][_0x1e6c('0xa7')]['READ_COMMITTED']},function(_0x251326){return db[_0x1e6c('0x53')]['findOne']({'where':{'id':_0x2799cb},'transaction':_0x251326})['then'](function(_0x521f9e){if(_0x521f9e){return db[_0x1e6c('0x85')][_0x1e6c('0x62')]({'where':{'OpenchannelAccountId':_0x2799cb},'transaction':_0x251326})['then'](function(){var _0x3d4789=_[_0x1e6c('0x3e')](_0x584724,function(_0x23057d){_0x23057d[_0x1e6c('0x65')]=_0x2799cb;return _0x23057d;});return db[_0x1e6c('0x85')]['bulkCreate'](_0x3d4789,{'transaction':_0x251326});});}else{_0x5a14b5=0x194;_0x35bba0=[];}});})[_0x1e6c('0x22')](function(){if(_0x5a14b5!==0x194){return db[_0x1e6c('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2799cb},'order':_0x1e6c('0x8a')})[_0x1e6c('0x22')](function(_0x1cfbff){_0x35bba0=_0x1cfbff;});}})[_0x1e6c('0x59')](function(_0x5315fd){_0x5a14b5=0x1f4;logger[_0x1e6c('0x26')](_0x5315fd[_0x1e6c('0xa8')]);if(_0x5315fd['name']){delete _0x5315fd[_0x1e6c('0x3a')];}_0x35bba0=_0x5315fd;})[_0x1e6c('0xa9')](function(){if(_0x35bba0===null){_0x27f861[_0x1e6c('0x39')](_0x5a14b5);}else{if(_0x5a14b5===0x1f4){_0x27f861[_0x1e6c('0x2b')](_0x5a14b5)[_0x1e6c('0x3b')](_0x35bba0);}else{_0x27f861[_0x1e6c('0x2b')](_0x5a14b5)[_0x1e6c('0x2d')](_0x35bba0);}}});};exports['getApplications']=function(_0x30c5c4,_0x3a60e7,_0x14c0f6){var _0x1ca165={};var _0x46c2ce={};var _0x2e7a7a;var _0x3f023a;return db[_0x1e6c('0x53')][_0x1e6c('0x67')]({'where':{'id':_0x30c5c4['params']['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x3a60e7,null))['then'](function(_0x45a7fa){if(_0x45a7fa){_0x2e7a7a=_0x45a7fa;_0x46c2ce[_0x1e6c('0x46')]=_['keys'](db[_0x1e6c('0x85')]['rawAttributes']);_0x46c2ce[_0x1e6c('0x43')]=_[_0x1e6c('0x44')](_0x30c5c4[_0x1e6c('0x43')]);_0x46c2ce[_0x1e6c('0x45')]=_['intersection'](_0x46c2ce[_0x1e6c('0x46')],_0x46c2ce[_0x1e6c('0x43')]);_0x1ca165['attributes']=_[_0x1e6c('0x48')](_0x46c2ce[_0x1e6c('0x46')],qs[_0x1e6c('0x49')](_0x30c5c4['query']['fields']));_0x1ca165[_0x1e6c('0x47')]=_0x1ca165[_0x1e6c('0x47')][_0x1e6c('0x4a')]?_0x1ca165[_0x1e6c('0x47')]:_0x46c2ce[_0x1e6c('0x46')];_0x1ca165[_0x1e6c('0x68')]=qs['sort'](_0x30c5c4[_0x1e6c('0x43')]['sort']);_0x1ca165[_0x1e6c('0x4e')]=qs[_0x1e6c('0x45')](_[_0x1e6c('0x4f')](_0x30c5c4[_0x1e6c('0x43')],_0x46c2ce[_0x1e6c('0x45')]));if(_0x30c5c4[_0x1e6c('0x43')][_0x1e6c('0x50')]){_0x1ca165[_0x1e6c('0x4e')]=_[_0x1e6c('0x51')](_0x1ca165[_0x1e6c('0x4e')],{'$or':_[_0x1e6c('0x3e')](_0x1ca165[_0x1e6c('0x47')],function(_0x7bef85){var _0x1e76a7={};_0x1e76a7[_0x7bef85]={'$like':'%'+_0x30c5c4[_0x1e6c('0x43')][_0x1e6c('0x50')]+'%'};return _0x1e76a7;})});}_0x1ca165=_[_0x1e6c('0x51')]({},_0x1ca165,_0x30c5c4[_0x1e6c('0x52')]);return _0x2e7a7a[_0x1e6c('0xaa')](_0x1ca165);}})[_0x1e6c('0x22')](function(_0x2c2388){if(_0x2c2388){_0x3f023a=_0x2c2388[_0x1e6c('0x4a')];if(!_0x30c5c4[_0x1e6c('0x43')][_0x1e6c('0x4b')](_0x1e6c('0x4c'))){_0x1ca165[_0x1e6c('0x2f')]=qs[_0x1e6c('0x2f')](_0x30c5c4[_0x1e6c('0x43')][_0x1e6c('0x2f')]);_0x1ca165[_0x1e6c('0x31')]=qs[_0x1e6c('0x31')](_0x30c5c4[_0x1e6c('0x43')][_0x1e6c('0x31')]);}return _0x2e7a7a[_0x1e6c('0xaa')](_0x1ca165);}})['then'](function(_0x399b35){if(_0x399b35){return _0x399b35?{'count':_0x3f023a,'rows':_0x399b35}:null;}})[_0x1e6c('0x22')](respondWithResult(_0x3a60e7,null))[_0x1e6c('0x59')](handleError(_0x3a60e7,null));};exports[_0x1e6c('0xab')]=function(_0x5755b2,_0x19d757,_0x123f00){var _0x52f47b={'raw':![],'where':{}};var _0x42ea96={};var _0x4d3a43={'count':0x0,'rows':[]};return db[_0x1e6c('0x53')][_0x1e6c('0x67')]({'where':{'id':_0x5755b2['params']['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x19d757,null))['then'](function(_0x57db05){if(_0x57db05){_0x42ea96[_0x1e6c('0x46')]=_['keys'](db[_0x1e6c('0x91')]['rawAttributes']);_0x42ea96[_0x1e6c('0x43')]=_[_0x1e6c('0x44')](_0x5755b2[_0x1e6c('0x43')]);_0x42ea96[_0x1e6c('0x45')]=_[_0x1e6c('0x48')](_0x42ea96[_0x1e6c('0x46')],_0x42ea96['query']);_0x52f47b[_0x1e6c('0x47')]=_['intersection'](_0x42ea96[_0x1e6c('0x46')],qs['fields'](_0x5755b2[_0x1e6c('0x43')]['fields']));_0x52f47b['attributes']=_0x52f47b[_0x1e6c('0x47')][_0x1e6c('0x4a')]?_0x52f47b['attributes']:_0x42ea96[_0x1e6c('0x46')];if(!_0x5755b2[_0x1e6c('0x43')][_0x1e6c('0x4b')](_0x1e6c('0x4c'))){_0x52f47b[_0x1e6c('0x2f')]=qs[_0x1e6c('0x2f')](_0x5755b2[_0x1e6c('0x43')][_0x1e6c('0x2f')]);_0x52f47b['offset']=qs[_0x1e6c('0x31')](_0x5755b2[_0x1e6c('0x43')]['offset']);}_0x52f47b[_0x1e6c('0x68')]=qs[_0x1e6c('0x4d')](_0x5755b2[_0x1e6c('0x43')][_0x1e6c('0x4d')]);_0x52f47b[_0x1e6c('0x4e')]=qs['filters'](_[_0x1e6c('0x4f')](_0x5755b2[_0x1e6c('0x43')],_0x42ea96[_0x1e6c('0x45')]));_0x52f47b[_0x1e6c('0x4e')]['OpenchannelAccountId']=_0x57db05['id'];if(_0x5755b2['query']['filter']){_0x52f47b[_0x1e6c('0x4e')]=_[_0x1e6c('0x51')](_0x52f47b[_0x1e6c('0x4e')],{'$or':_[_0x1e6c('0x3e')](_0x52f47b[_0x1e6c('0x47')],function(_0x44a902){var _0x2c1244={};_0x2c1244[_0x44a902]={'$like':'%'+_0x5755b2[_0x1e6c('0x43')][_0x1e6c('0x50')]+'%'};return _0x2c1244;})});}_0x52f47b=_['merge']({},_0x52f47b,_0x5755b2[_0x1e6c('0x52')]);return db[_0x1e6c('0x91')][_0x1e6c('0x30')]({'where':_0x52f47b['where']})[_0x1e6c('0x22')](function(_0x1f65af){_0x4d3a43[_0x1e6c('0x30')]=_0x1f65af;if(_0x5755b2['query'][_0x1e6c('0x58')]){_0x52f47b[_0x1e6c('0x54')]=[{'model':db[_0x1e6c('0x72')],'as':_0x1e6c('0xac'),'required':![]},{'model':db['User'],'as':_0x1e6c('0xad'),'attributes':[_0x1e6c('0x3a'),_0x1e6c('0xae'),_0x1e6c('0xaf')],'required':![]},{'model':db['Tag'],'as':_0x1e6c('0xb0'),'attributes':['id',_0x1e6c('0x3a'),_0x1e6c('0xb1')],'where':_0x5755b2['query'][_0x1e6c('0xb2')]?{'id':_0x5755b2['query'][_0x1e6c('0xb2')]}:undefined,'required':_0x5755b2[_0x1e6c('0x43')]['tag']?!![]:![]}];}return db[_0x1e6c('0x91')][_0x1e6c('0x55')](_0x52f47b);})[_0x1e6c('0x22')](function(_0x40156b){_0x4d3a43[_0x1e6c('0x6e')]=_0x40156b;return _0x4d3a43;});}})['then'](respondWithFilteredResult(_0x19d757,_0x52f47b))[_0x1e6c('0x59')](handleError(_0x19d757,null));};exports[_0x1e6c('0xb3')]=function(_0x4699dd,_0x3c035a,_0x5d5d9c){return db[_0x1e6c('0x53')]['find']({'where':{'id':_0x4699dd[_0x1e6c('0x57')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x3c035a,null))['then'](function(_0x271054){if(_0x271054){return _0x271054[_0x1e6c('0xb3')](_0x4699dd[_0x1e6c('0x5b')][_0x1e6c('0x6a')],_[_0x1e6c('0xb4')](_0x4699dd[_0x1e6c('0x5b')],[_0x1e6c('0x6a'),'id'])||{})['spread'](function(_0x2587bd){for(var _0x2094cc=0x0;_0x2094cc<_0x4699dd['body'][_0x1e6c('0x6a')]['length'];_0x2094cc+=0x1){socket['emit'](_0x1e6c('0xb5'),{'UserId':Number(_0x4699dd[_0x1e6c('0x5b')][_0x1e6c('0x6a')][_0x2094cc]),'OpenchannelAccountId':Number(_0x4699dd['params']['id'])});}return _0x2587bd;});}})[_0x1e6c('0x22')](respondWithResult(_0x3c035a,null))['catch'](handleError(_0x3c035a,null));};exports['removeAgents']=function(_0x532601,_0x300ff1,_0x1162e7){return db[_0x1e6c('0x53')][_0x1e6c('0x61')]({'where':{'id':_0x532601[_0x1e6c('0x57')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x300ff1,null))[_0x1e6c('0x22')](function(_0x4de65e){if(_0x4de65e){return _0x4de65e[_0x1e6c('0xb6')](_0x532601[_0x1e6c('0x43')][_0x1e6c('0x6a')])['then'](function(){if(_[_0x1e6c('0xb7')](_0x532601[_0x1e6c('0x43')][_0x1e6c('0x6a')])){for(var _0x164f52=0x0;_0x164f52<_0x532601[_0x1e6c('0x43')][_0x1e6c('0x6a')][_0x1e6c('0x4a')];_0x164f52+=0x1){socket[_0x1e6c('0xb8')](_0x1e6c('0xb9'),{'UserId':Number(_0x532601['query']['ids'][_0x164f52]),'OpenchannelAccountId':Number(_0x532601[_0x1e6c('0x57')]['id'])});}}else{socket[_0x1e6c('0xb8')](_0x1e6c('0xb9'),{'UserId':Number(_0x532601[_0x1e6c('0x43')][_0x1e6c('0x6a')]),'OpenchannelAccountId':Number(_0x532601[_0x1e6c('0x57')]['id'])});}});}})[_0x1e6c('0x22')](respondWithStatusCode(_0x300ff1,null))[_0x1e6c('0x59')](handleError(_0x300ff1,null));};exports[_0x1e6c('0xba')]=function(_0x43341f,_0x4228b4,_0x1ebea5){var _0x5d8572={};var _0x510a0f={};var _0x49b4f4;var _0x34f241;return db['OpenchannelAccount'][_0x1e6c('0x67')]({'where':{'id':_0x43341f[_0x1e6c('0x57')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x4228b4,null))['then'](function(_0x2a63f4){if(_0x2a63f4){_0x49b4f4=_0x2a63f4;_0x510a0f[_0x1e6c('0x46')]=_[_0x1e6c('0x44')](db['User']['rawAttributes']);_0x510a0f[_0x1e6c('0x43')]=_['keys'](_0x43341f[_0x1e6c('0x43')]);_0x510a0f['filters']=_['intersection'](_0x510a0f['model'],_0x510a0f[_0x1e6c('0x43')]);_0x5d8572[_0x1e6c('0x47')]=_[_0x1e6c('0x48')](_0x510a0f[_0x1e6c('0x46')],qs[_0x1e6c('0x49')](_0x43341f[_0x1e6c('0x43')][_0x1e6c('0x49')]));_0x5d8572[_0x1e6c('0x47')]=_0x5d8572[_0x1e6c('0x47')][_0x1e6c('0x4a')]?_0x5d8572[_0x1e6c('0x47')]:_0x510a0f[_0x1e6c('0x46')];_0x5d8572[_0x1e6c('0x68')]=qs[_0x1e6c('0x4d')](_0x43341f[_0x1e6c('0x43')][_0x1e6c('0x4d')]);_0x5d8572[_0x1e6c('0x4e')]=qs[_0x1e6c('0x45')](_[_0x1e6c('0x4f')](_0x43341f['query'],_0x510a0f[_0x1e6c('0x45')]));if(_0x43341f['query'][_0x1e6c('0x50')]){_0x5d8572['where']=_[_0x1e6c('0x51')](_0x5d8572[_0x1e6c('0x4e')],{'$or':_[_0x1e6c('0x3e')](_0x5d8572['attributes'],function(_0x4e3267){var _0x1076f7={};_0x1076f7[_0x4e3267]={'$like':'%'+_0x43341f[_0x1e6c('0x43')][_0x1e6c('0x50')]+'%'};return _0x1076f7;})});}_0x5d8572=_[_0x1e6c('0x51')]({},_0x5d8572,_0x43341f['options']);return _0x49b4f4['getAgents'](_0x5d8572);}})[_0x1e6c('0x22')](function(_0x14e06d){if(_0x14e06d){_0x34f241=_0x14e06d[_0x1e6c('0x4a')];if(!_0x43341f[_0x1e6c('0x43')]['hasOwnProperty'](_0x1e6c('0x4c'))){_0x5d8572[_0x1e6c('0x2f')]=qs[_0x1e6c('0x2f')](_0x43341f['query']['limit']);_0x5d8572[_0x1e6c('0x31')]=qs[_0x1e6c('0x31')](_0x43341f[_0x1e6c('0x43')][_0x1e6c('0x31')]);}return _0x49b4f4[_0x1e6c('0xba')](_0x5d8572);}})[_0x1e6c('0x22')](function(_0x1e6935){if(_0x1e6935){return _0x1e6935?{'count':_0x34f241,'rows':_0x1e6935}:null;}})[_0x1e6c('0x22')](respondWithResult(_0x4228b4,null))['catch'](handleError(_0x4228b4,null));};exports[_0x1e6c('0x3b')]=function(_0x1b8e3e,_0x46f05e,_0x2e05dc){var _0x53a0a4,_0xbf74a4,_0x176fe5;if(_['isNil'](_0x1b8e3e[_0x1e6c('0x5b')][_0x1e6c('0x5b')])||_0x1b8e3e[_0x1e6c('0x5b')][_0x1e6c('0x5b')]===''){throw new db[(_0x1e6c('0x7a'))][(_0x1e6c('0x73'))](_0x1e6c('0xbb'));}if(_[_0x1e6c('0x79')](_0x1b8e3e[_0x1e6c('0x5b')]['to'])){}_0x53a0a4=_0x1b8e3e[_0x1e6c('0x5b')]['to'];return db['OpenchannelAccount'][_0x1e6c('0x67')]({'where':{'id':_0x1b8e3e[_0x1e6c('0x57')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x46f05e,null))['then'](function(_0x51b023){if(_0x51b023){return db[_0x1e6c('0x53')][_0x1e6c('0x61')]({'where':{'id':_0x51b023['id']},'include':[{'model':db[_0x1e6c('0x81')],'as':_0x1e6c('0x82'),'include':[{'model':db[_0x1e6c('0x72')],'as':'Contacts','where':{[_0x51b023[_0x1e6c('0x7c')]]:_0x53a0a4},'limit':0x1,'order':[['updatedAt',_0x1e6c('0x84')]]}]}]})['then'](handleEntityNotFound(_0x46f05e,null))['then'](function(_0x2ed92b){if(_0x2ed92b&&_0x2ed92b[_0x1e6c('0x82')]){_0xbf74a4=_0x2ed92b['get']({'plain':!![]});if(_0xbf74a4[_0x1e6c('0x82')]&&_0xbf74a4['List'][_0x1e6c('0x83')][_0x1e6c('0x4a')]){return _0xbf74a4[_0x1e6c('0x82')][_0x1e6c('0x83')][0x0];}return db['CmContact']['create'](_['defaults'](_0x1b8e3e[_0x1e6c('0x5b')],{'firstName':_0x53a0a4,[_0x2ed92b['mapKey']]:_0x53a0a4,'phone':_0x53a0a4,'ListId':_0xbf74a4['ListId']}));}})[_0x1e6c('0x22')](handleEntityNotFound(_0x46f05e,null))[_0x1e6c('0x22')](function(_0x3636ba){if(_0x3636ba){_0x176fe5=_0x3636ba;return db[_0x1e6c('0x91')][_0x1e6c('0x61')]({'where':{'ContactId':_0x176fe5['id'],'closed':![],'OpenchannelAccountId':_0xbf74a4['id']}})[_0x1e6c('0x22')](function(_0x537bf0){if(_0x537bf0){return[_0x537bf0,![]];}return db[_0x1e6c('0x91')][_0x1e6c('0x5a')]({'UserId':_0x1b8e3e[_0x1e6c('0x5c')]['id'],'ContactId':_0x176fe5['id'],'OpenchannelAccountId':_0xbf74a4['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x1e6c('0x51')](_0x1b8e3e[_0x1e6c('0x5b')],{'read':![],'body':_0x1b8e3e[_0x1e6c('0x5b')][_0x1e6c('0x5b')],'OpenchannelAccountId':_0xbf74a4['id'],'UserId':_0x1b8e3e[_0x1e6c('0x5c')]['id'],'ContactId':_0x176fe5['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x3bca33){return[_0x3bca33,!![]];});});}})[_0x1e6c('0x94')](function(_0x225aa5,_0x14196f){if(_0x14196f){return _0x225aa5;}return db[_0x1e6c('0x9a')][_0x1e6c('0x5a')](_[_0x1e6c('0x51')](_0x1b8e3e['body'],{'read':![],'body':_0x1b8e3e[_0x1e6c('0x5b')]['body'],'OpenchannelAccountId':_0xbf74a4['id'],'OpenchannelInteractionId':_0x225aa5['id'],'UserId':_0x1b8e3e[_0x1e6c('0x5c')]['id'],'ContactId':_0x176fe5['id']}))[_0x1e6c('0x22')](function(_0x5bc025){_0x225aa5[_0x1e6c('0xbc')]['Messages']=[];_0x225aa5['dataValues']['Messages']['push'](_0x5bc025[_0x1e6c('0xbc')]);return _0x225aa5;});});}})[_0x1e6c('0x22')](respondWithResult(_0x46f05e,null))[_0x1e6c('0x59')](handleError(_0x46f05e,null));}; \ No newline at end of file +var _0x1542=['CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','account','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','sendStatus','getApplications','Contact','User','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','order','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel'];(function(_0x5604a4,_0x337319){var _0x27b32a=function(_0x5de008){while(--_0x5de008){_0x5604a4['push'](_0x5604a4['shift']());}};_0x27b32a(++_0x337319);}(_0x1542,0x116));var _0x2154=function(_0x31ca13,_0x18a0e4){_0x31ca13=_0x31ca13-0x0;var _0x3b290d=_0x1542[_0x31ca13];return _0x3b290d;};'use strict';var emlformat=require(_0x2154('0x0'));var rimraf=require(_0x2154('0x1'));var zipdir=require(_0x2154('0x2'));var jsonpatch=require(_0x2154('0x3'));var rp=require(_0x2154('0x4'));var moment=require('moment');var BPromise=require(_0x2154('0x5'));var Mustache=require(_0x2154('0x6'));var util=require(_0x2154('0x7'));var path=require('path');var sox=require(_0x2154('0x8'));var csv=require(_0x2154('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2154('0xa'));var _=require(_0x2154('0xb'));var squel=require(_0x2154('0xc'));var crypto=require(_0x2154('0xd'));var jsforce=require(_0x2154('0xe'));var deskjs=require(_0x2154('0xf'));var toCsv=require(_0x2154('0x9'));var querystring=require(_0x2154('0x10'));var Papa=require(_0x2154('0x11'));var Redis=require(_0x2154('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2154('0x13'));var as=require(_0x2154('0x14'));var hardwareService=require(_0x2154('0x15'));var logger=require(_0x2154('0x16'))('api');var utils=require(_0x2154('0x17'));var config=require(_0x2154('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2154('0x19'))['db'];config[_0x2154('0x1a')]=_[_0x2154('0x1b')](config[_0x2154('0x1a')],{'host':_0x2154('0x1c'),'port':0x18eb});var socket=require(_0x2154('0x1d'))(new Redis(config[_0x2154('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x2154('0x1e'));var client=jayson['client'][_0x2154('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b34b9,_0x46c995,_0x57e662,_0x157858){return new BPromise(function(_0x4f9308,_0x87257c){var _0x369ab6=_0x157858||client;return _0x369ab6[_0x2154('0x20')](_0x5b34b9,_0x57e662)[_0x2154('0x21')](function(_0x14d29a){logger[_0x2154('0x22')](_0x2154('0x23'),_0x46c995,_0x2154('0x24'));logger[_0x2154('0x25')](_0x2154('0x26'),_0x46c995,'request\x20sent',JSON[_0x2154('0x27')](_0x14d29a));if(_0x14d29a[_0x2154('0x28')]){if(_0x14d29a[_0x2154('0x28')]['code']===0x1f4){logger[_0x2154('0x28')](_0x2154('0x23'),_0x46c995,_0x14d29a[_0x2154('0x28')][_0x2154('0x29')]);return _0x87257c(_0x14d29a['error'][_0x2154('0x29')]);}logger[_0x2154('0x28')](_0x2154('0x23'),_0x46c995,_0x14d29a['error']['message']);return _0x4f9308(_0x14d29a[_0x2154('0x28')][_0x2154('0x29')]);}else{logger[_0x2154('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x46c995,'request\x20sent');_0x4f9308(_0x14d29a[_0x2154('0x2a')][_0x2154('0x29')]);}})[_0x2154('0x2b')](function(_0x3b4fa8){logger['error'](_0x2154('0x23'),_0x46c995,_0x3b4fa8);_0x87257c(_0x3b4fa8);});});}function respondWithStatusCode(_0x34c860,_0x4224e1){_0x4224e1=_0x4224e1||0xcc;return function(_0x5c5dbb){if(_0x5c5dbb){return _0x34c860['sendStatus'](_0x4224e1);}return _0x34c860[_0x2154('0x2c')](_0x4224e1)[_0x2154('0x2d')]();};}function respondWithResult(_0x2466eb,_0x5317b5){_0x5317b5=_0x5317b5||0xc8;return function(_0x1b68e7){if(_0x1b68e7){return _0x2466eb[_0x2154('0x2c')](_0x5317b5)[_0x2154('0x2e')](_0x1b68e7);}};}function respondWithFilteredResult(_0x83263d,_0x375a57){return function(_0x5cd152){if(_0x5cd152){var _0x23f1bc=typeof _0x375a57[_0x2154('0x2f')]===_0x2154('0x30')&&typeof _0x375a57[_0x2154('0x31')]===_0x2154('0x30');var _0x2dee3e=_0x5cd152[_0x2154('0x32')];var _0x5661d9=_0x23f1bc?0x0:_0x375a57[_0x2154('0x2f')];var _0x100f64=_0x23f1bc?_0x5cd152['count']:_0x375a57[_0x2154('0x2f')]+_0x375a57['limit'];var _0x4aa34f;if(_0x100f64>=_0x2dee3e){_0x100f64=_0x2dee3e;_0x4aa34f=0xc8;}else{_0x4aa34f=0xce;}_0x83263d[_0x2154('0x2c')](_0x4aa34f);return _0x83263d[_0x2154('0x33')](_0x2154('0x34'),_0x5661d9+'-'+_0x100f64+'/'+_0x2dee3e)['json'](_0x5cd152);}return null;};}function patchUpdates(_0x3feb60){return function(_0x223db8){try{jsonpatch[_0x2154('0x35')](_0x223db8,_0x3feb60,!![]);}catch(_0xd9e238){return BPromise[_0x2154('0x36')](_0xd9e238);}return _0x223db8[_0x2154('0x37')]();};}function saveUpdates(_0x24210b,_0x3d38f3){return function(_0x50198a){if(_0x50198a){return _0x50198a[_0x2154('0x38')](_0x24210b)['then'](function(_0x4eb04){return _0x4eb04;});}return null;};}function removeEntity(_0x1279fc,_0x10ad32){return function(_0x2bb9f4){if(_0x2bb9f4){return _0x2bb9f4[_0x2154('0x39')]()['then'](function(){var _0x549f73=_0x2bb9f4[_0x2154('0x3a')]({'plain':!![]});var _0x3ff05a=_0x2154('0x3b');return db[_0x2154('0x3c')][_0x2154('0x39')]({'where':{'type':_0x3ff05a,'resourceId':_0x549f73['id']}})[_0x2154('0x21')](function(){return _0x2bb9f4;});})[_0x2154('0x21')](function(){_0x1279fc[_0x2154('0x2c')](0xcc)[_0x2154('0x2d')]();});}};}function handleEntityNotFound(_0x490046,_0x4fa576){return function(_0x34582f){if(!_0x34582f){_0x490046['sendStatus'](0x194);}return _0x34582f;};}function handleError(_0x3a160f,_0x157e49){_0x157e49=_0x157e49||0x1f4;return function(_0x346c3e){logger[_0x2154('0x28')](_0x346c3e[_0x2154('0x3d')]);if(_0x346c3e[_0x2154('0x3e')]){delete _0x346c3e['name'];}_0x3a160f[_0x2154('0x2c')](_0x157e49)[_0x2154('0x3f')](_0x346c3e);};}exports[_0x2154('0x40')]=function(_0x349693,_0x1a4167){var _0x12e7c5={'include':[{'model':db[_0x2154('0x41')],'as':_0x2154('0x42')}]},_0x26d0c4={},_0x1e4206={'count':0x0,'rows':[]};var _0x593e35=_['map'](db[_0x2154('0x43')][_0x2154('0x44')],function(_0x5d0214){return{'name':_0x5d0214[_0x2154('0x45')],'type':_0x5d0214[_0x2154('0x46')]['key']};});_0x26d0c4[_0x2154('0x47')]=_[_0x2154('0x48')](_0x593e35,'name');_0x26d0c4['query']=_[_0x2154('0x49')](_0x349693[_0x2154('0x4a')]);_0x26d0c4[_0x2154('0x4b')]=_[_0x2154('0x4c')](_0x26d0c4[_0x2154('0x47')],_0x26d0c4[_0x2154('0x4a')]);_0x12e7c5[_0x2154('0x4d')]=_[_0x2154('0x4c')](_0x26d0c4[_0x2154('0x47')],qs[_0x2154('0x4e')](_0x349693[_0x2154('0x4a')]['fields']));_0x12e7c5['attributes']=_0x12e7c5[_0x2154('0x4d')]['length']?_0x12e7c5[_0x2154('0x4d')]:_0x26d0c4[_0x2154('0x47')];if(!_0x349693[_0x2154('0x4a')][_0x2154('0x4f')]('nolimit')){_0x12e7c5[_0x2154('0x31')]=qs[_0x2154('0x31')](_0x349693[_0x2154('0x4a')][_0x2154('0x31')]);_0x12e7c5[_0x2154('0x2f')]=qs[_0x2154('0x2f')](_0x349693['query']['offset']);}_0x12e7c5['order']=qs[_0x2154('0x50')](_0x349693['query']['sort']);_0x12e7c5[_0x2154('0x51')]=qs[_0x2154('0x4b')](_[_0x2154('0x52')](_0x349693[_0x2154('0x4a')],_0x26d0c4[_0x2154('0x4b')]),_0x593e35);if(_0x349693[_0x2154('0x4a')][_0x2154('0x53')]){_0x12e7c5[_0x2154('0x51')]=_['merge'](_0x12e7c5[_0x2154('0x51')],{'$or':_[_0x2154('0x48')](_0x593e35,function(_0x11705c){if(_0x11705c['type']!=='VIRTUAL'){var _0x14666c={};_0x14666c[_0x11705c[_0x2154('0x3e')]]={'$like':'%'+_0x349693[_0x2154('0x4a')]['filter']+'%'};return _0x14666c;}})});}_0x12e7c5=_[_0x2154('0x54')]({},_0x12e7c5,_0x349693[_0x2154('0x55')]);var _0x24f13b={'where':_0x12e7c5[_0x2154('0x51')]};return db[_0x2154('0x43')][_0x2154('0x32')](_0x24f13b)[_0x2154('0x21')](function(_0x120e12){_0x1e4206['count']=_0x120e12;if(_0x349693[_0x2154('0x4a')][_0x2154('0x56')]){_0x12e7c5[_0x2154('0x57')]=[{'all':!![]}];}return db[_0x2154('0x43')]['findAll'](_0x12e7c5);})[_0x2154('0x21')](function(_0x557f56){_0x1e4206['rows']=_0x557f56;return _0x1e4206;})[_0x2154('0x21')](respondWithFilteredResult(_0x1a4167,_0x12e7c5))[_0x2154('0x2b')](handleError(_0x1a4167,null));};exports[_0x2154('0x58')]=function(_0xff7e75,_0x14f08b){var _0x130fa5={'raw':![],'where':{'id':_0xff7e75[_0x2154('0x59')]['id']},'include':[{'model':db[_0x2154('0x41')],'as':_0x2154('0x42')}]},_0x1026d9={};_0x1026d9['model']=_['keys'](db[_0x2154('0x43')]['rawAttributes']);_0x1026d9[_0x2154('0x4a')]=_['keys'](_0xff7e75[_0x2154('0x4a')]);_0x1026d9[_0x2154('0x4b')]=_[_0x2154('0x4c')](_0x1026d9[_0x2154('0x47')],_0x1026d9[_0x2154('0x4a')]);_0x130fa5[_0x2154('0x4d')]=_[_0x2154('0x4c')](_0x1026d9[_0x2154('0x47')],qs[_0x2154('0x4e')](_0xff7e75[_0x2154('0x4a')][_0x2154('0x4e')]));_0x130fa5[_0x2154('0x4d')]=_0x130fa5[_0x2154('0x4d')][_0x2154('0x5a')]?_0x130fa5['attributes']:_0x1026d9['model'];if(_0xff7e75[_0x2154('0x4a')][_0x2154('0x56')]){_0x130fa5[_0x2154('0x57')]=[{'all':!![]}];}_0x130fa5=_[_0x2154('0x54')]({},_0x130fa5,_0xff7e75[_0x2154('0x55')]);return db['OpenchannelAccount']['find'](_0x130fa5)[_0x2154('0x21')](handleEntityNotFound(_0x14f08b,null))[_0x2154('0x21')](respondWithResult(_0x14f08b,null))[_0x2154('0x2b')](handleError(_0x14f08b,null));};exports[_0x2154('0x5b')]=function(_0xff4aa1,_0x4de278){return db[_0x2154('0x43')][_0x2154('0x5b')](_0xff4aa1[_0x2154('0x5c')],{})[_0x2154('0x21')](function(_0x28bb26){var _0x4f1d46=_0xff4aa1[_0x2154('0x5d')]['get']({'plain':!![]});if(!_0x4f1d46)throw new Error(_0x2154('0x5e'));if(_0x4f1d46[_0x2154('0x5f')]===_0x2154('0x5d')){var _0x93792e=_0x28bb26[_0x2154('0x3a')]({'plain':!![]});var _0xc9765c='OpenchannelAccounts';return db[_0x2154('0x60')][_0x2154('0x61')]({'where':{'name':_0xc9765c,'userProfileId':_0x4f1d46[_0x2154('0x62')]},'raw':!![]})[_0x2154('0x21')](function(_0xae4338){if(_0xae4338&&_0xae4338[_0x2154('0x63')]===0x0){return db[_0x2154('0x3c')]['create']({'name':_0x93792e[_0x2154('0x3e')],'resourceId':_0x93792e['id'],'type':_0xae4338[_0x2154('0x3e')],'sectionId':_0xae4338['id']},{})[_0x2154('0x21')](function(){return _0x28bb26;});}else{return _0x28bb26;}})['catch'](function(_0x5a8802){logger['error'](_0x2154('0x64'),_0x5a8802);throw _0x5a8802;});}return _0x28bb26;})['then'](respondWithResult(_0x4de278,0xc9))[_0x2154('0x2b')](handleError(_0x4de278,null));};exports['update']=function(_0x49c55a,_0x46c11b){if(_0x49c55a['body']['id']){delete _0x49c55a[_0x2154('0x5c')]['id'];}return db[_0x2154('0x43')][_0x2154('0x61')]({'where':{'id':_0x49c55a['params']['id']},'include':[{'model':db[_0x2154('0x41')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x46c11b,null))[_0x2154('0x21')](saveUpdates(_0x49c55a[_0x2154('0x5c')],null))[_0x2154('0x21')](respondWithResult(_0x46c11b,null))[_0x2154('0x2b')](handleError(_0x46c11b,null));};exports[_0x2154('0x39')]=function(_0x56c693,_0x393a1a){return db['OpenchannelAccount'][_0x2154('0x61')]({'where':{'id':_0x56c693[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x393a1a,null))[_0x2154('0x21')](removeEntity(_0x393a1a,null))['catch'](handleError(_0x393a1a,null));};exports[_0x2154('0x65')]=function(_0x582acf,_0x47301c){return db[_0x2154('0x43')]['describe']()[_0x2154('0x21')](respondWithResult(_0x47301c,null))[_0x2154('0x2b')](handleError(_0x47301c,null));};exports[_0x2154('0x66')]=function(_0x5730bc,_0x5076bd,_0x5503eb){if(_0x5730bc[_0x2154('0x5c')]['id']){delete _0x5730bc['body']['id'];}return db[_0x2154('0x43')][_0x2154('0x61')]({'where':{'id':_0x5730bc[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x5076bd,null))[_0x2154('0x21')](function(_0x478173){if(_0x478173){_0x5730bc[_0x2154('0x5c')][_0x2154('0x67')]=_0x478173['id'];return db[_0x2154('0x68')][_0x2154('0x5b')](_0x5730bc[_0x2154('0x5c')]);}})[_0x2154('0x21')](respondWithResult(_0x5076bd,null))[_0x2154('0x2b')](handleError(_0x5076bd,null));};exports[_0x2154('0x69')]=function(_0x170113,_0xf9333b,_0x2f300f){var _0x101d70={'raw':![],'where':{}};var _0x106df9={};var _0x54cd9b={'count':0x0,'rows':[]};return db[_0x2154('0x43')][_0x2154('0x6a')]({'where':{'id':_0x170113[_0x2154('0x59')]['id']}})['then'](handleEntityNotFound(_0xf9333b,null))['then'](function(_0x2d69cf){if(_0x2d69cf){_0x106df9['model']=_['keys'](db['Disposition'][_0x2154('0x44')]);_0x106df9[_0x2154('0x4a')]=_[_0x2154('0x49')](_0x170113[_0x2154('0x4a')]);_0x106df9[_0x2154('0x4b')]=_['intersection'](_0x106df9[_0x2154('0x47')],_0x106df9[_0x2154('0x4a')]);_0x101d70['attributes']=_[_0x2154('0x4c')](_0x106df9[_0x2154('0x47')],qs[_0x2154('0x4e')](_0x170113[_0x2154('0x4a')][_0x2154('0x4e')]));_0x101d70['attributes']=_0x101d70['attributes']['length']?_0x101d70['attributes']:_0x106df9[_0x2154('0x47')];if(!_0x170113[_0x2154('0x4a')]['hasOwnProperty'](_0x2154('0x6b'))){_0x101d70[_0x2154('0x31')]=qs[_0x2154('0x31')](_0x170113['query'][_0x2154('0x31')]);_0x101d70[_0x2154('0x2f')]=qs['offset'](_0x170113[_0x2154('0x4a')][_0x2154('0x2f')]);}_0x101d70[_0x2154('0x6c')]=qs[_0x2154('0x50')](_0x170113[_0x2154('0x4a')][_0x2154('0x50')]);_0x101d70['where']=qs[_0x2154('0x4b')](_[_0x2154('0x52')](_0x170113[_0x2154('0x4a')],_0x106df9[_0x2154('0x4b')]));_0x101d70[_0x2154('0x51')][_0x2154('0x67')]=_0x2d69cf['id'];if(_0x170113[_0x2154('0x4a')][_0x2154('0x53')]){_0x101d70['where']=_[_0x2154('0x54')](_0x101d70[_0x2154('0x51')],{'$or':_[_0x2154('0x48')](_0x101d70['attributes'],function(_0x284287){var _0x2dd51d={};_0x2dd51d[_0x284287]={'$like':'%'+_0x170113[_0x2154('0x4a')]['filter']+'%'};return _0x2dd51d;})});}_0x101d70=_[_0x2154('0x54')]({},_0x101d70,_0x170113[_0x2154('0x55')]);return db[_0x2154('0x68')][_0x2154('0x32')]({'where':_0x101d70[_0x2154('0x51')]})['then'](function(_0x332cfe){_0x54cd9b[_0x2154('0x32')]=_0x332cfe;if(_0x170113[_0x2154('0x4a')][_0x2154('0x56')]){_0x101d70['include']=[{'all':!![]}];}return db[_0x2154('0x68')][_0x2154('0x6d')](_0x101d70);})['then'](function(_0x4a641c){_0x54cd9b[_0x2154('0x6e')]=_0x4a641c;return _0x54cd9b;});}})[_0x2154('0x21')](respondWithFilteredResult(_0xf9333b,_0x101d70))['catch'](handleError(_0xf9333b,null));};exports[_0x2154('0x6f')]=function(_0x3f3791,_0x4c422c,_0x1feca3){return db['OpenchannelAccount'][_0x2154('0x61')]({'where':{'id':_0x3f3791[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x4c422c,null))[_0x2154('0x21')](function(_0x5dc1c7){if(_0x5dc1c7){return _0x5dc1c7[_0x2154('0x6f')](_0x3f3791[_0x2154('0x4a')][_0x2154('0x70')]);}})[_0x2154('0x21')](respondWithStatusCode(_0x4c422c,null))[_0x2154('0x2b')](handleError(_0x4c422c,null));};exports[_0x2154('0x71')]=function(_0x58690c,_0x3c8fc3,_0x39f189){if(_0x58690c[_0x2154('0x5c')]['id']){delete _0x58690c[_0x2154('0x5c')]['id'];}return db['OpenchannelAccount'][_0x2154('0x61')]({'where':{'id':_0x58690c[_0x2154('0x59')]['id']}})['then'](handleEntityNotFound(_0x3c8fc3,null))[_0x2154('0x21')](function(_0x132e80){if(_0x132e80){_0x58690c[_0x2154('0x5c')][_0x2154('0x67')]=_0x132e80['id'];return db[_0x2154('0x72')]['create'](_0x58690c[_0x2154('0x5c')]);}})[_0x2154('0x21')](respondWithResult(_0x3c8fc3,null))[_0x2154('0x2b')](handleError(_0x3c8fc3,null));};exports[_0x2154('0x73')]=function(_0x357414,_0x3e94e9,_0x1621f9){var _0x3a559e={'raw':![],'where':{}};var _0x127f36={};var _0x36c19d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2154('0x6a')]({'where':{'id':_0x357414[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x3e94e9,null))[_0x2154('0x21')](function(_0x349c57){if(_0x349c57){_0x127f36[_0x2154('0x47')]=_[_0x2154('0x49')](db[_0x2154('0x72')][_0x2154('0x44')]);_0x127f36['query']=_[_0x2154('0x49')](_0x357414[_0x2154('0x4a')]);_0x127f36['filters']=_[_0x2154('0x4c')](_0x127f36[_0x2154('0x47')],_0x127f36[_0x2154('0x4a')]);_0x3a559e['attributes']=_[_0x2154('0x4c')](_0x127f36[_0x2154('0x47')],qs[_0x2154('0x4e')](_0x357414[_0x2154('0x4a')][_0x2154('0x4e')]));_0x3a559e[_0x2154('0x4d')]=_0x3a559e['attributes'][_0x2154('0x5a')]?_0x3a559e[_0x2154('0x4d')]:_0x127f36[_0x2154('0x47')];if(!_0x357414[_0x2154('0x4a')][_0x2154('0x4f')](_0x2154('0x6b'))){_0x3a559e['limit']=qs[_0x2154('0x31')](_0x357414[_0x2154('0x4a')][_0x2154('0x31')]);_0x3a559e[_0x2154('0x2f')]=qs[_0x2154('0x2f')](_0x357414[_0x2154('0x4a')]['offset']);}_0x3a559e['order']=qs[_0x2154('0x50')](_0x357414[_0x2154('0x4a')][_0x2154('0x50')]);_0x3a559e[_0x2154('0x51')]=qs[_0x2154('0x4b')](_[_0x2154('0x52')](_0x357414[_0x2154('0x4a')],_0x127f36['filters']));_0x3a559e[_0x2154('0x51')][_0x2154('0x67')]=_0x349c57['id'];if(_0x357414[_0x2154('0x4a')][_0x2154('0x53')]){_0x3a559e['where']=_[_0x2154('0x54')](_0x3a559e[_0x2154('0x51')],{'$or':_['map'](_0x3a559e[_0x2154('0x4d')],function(_0xa29e79){var _0x15e46f={};_0x15e46f[_0xa29e79]={'$like':'%'+_0x357414['query'][_0x2154('0x53')]+'%'};return _0x15e46f;})});}_0x3a559e=_[_0x2154('0x54')]({},_0x3a559e,_0x357414[_0x2154('0x55')]);return db[_0x2154('0x72')][_0x2154('0x32')]({'where':_0x3a559e[_0x2154('0x51')]})[_0x2154('0x21')](function(_0x189965){_0x36c19d['count']=_0x189965;if(_0x357414[_0x2154('0x4a')][_0x2154('0x56')]){_0x3a559e[_0x2154('0x57')]=[{'all':!![]}];}return db[_0x2154('0x72')]['findAll'](_0x3a559e);})[_0x2154('0x21')](function(_0x5e8320){_0x36c19d['rows']=_0x5e8320;return _0x36c19d;});}})[_0x2154('0x21')](respondWithFilteredResult(_0x3e94e9,_0x3a559e))[_0x2154('0x2b')](handleError(_0x3e94e9,null));};exports['removeAnswers']=function(_0x37d742,_0xc5cb0a,_0x111b8d){return db[_0x2154('0x43')][_0x2154('0x61')]({'where':{'id':_0x37d742[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0xc5cb0a,null))['then'](function(_0x5015df){if(_0x5015df){return _0x5015df[_0x2154('0x74')](_0x37d742['query'][_0x2154('0x70')]);}})[_0x2154('0x21')](respondWithStatusCode(_0xc5cb0a,null))[_0x2154('0x2b')](handleError(_0xc5cb0a,null));};exports['notify']=function(_0x40b269,_0x2629b8,_0x4525c4){var _0x5db9cf={'body':_0x40b269[_0x2154('0x5c')],'channel':_0x2154('0x75')};var _0x4f467d=[];var _0x4e1c3c=[];var _0x331092={};var _0x3f85ad=![];return db[_0x2154('0x76')][_0x2154('0x65')]()[_0x2154('0x21')](function(_0x24f125){if(!_0x24f125){throw new db[(_0x2154('0x77'))][(_0x2154('0x78'))](_0x2154('0x79'));}_0x4f467d=_[_0x2154('0x7a')](_[_0x2154('0x49')](_0x24f125),[_0x2154('0x7b'),_0x2154('0x7c')]);_0x4e1c3c=_[_0x2154('0x7a')](_['keys'](_0x24f125),[_0x2154('0x7b'),_0x2154('0x7c'),_0x2154('0x7d'),_0x2154('0x7e')]);if(_0x40b269[_0x2154('0x5c')]['id']){delete _0x40b269[_0x2154('0x5c')]['id'];}if(_['isNil'](_0x40b269['body'][_0x2154('0x7f')])){throw new db[(_0x2154('0x77'))]['ValidationError'](_0x2154('0x80'));}if(_[_0x2154('0x81')](_0x40b269[_0x2154('0x5c')]['body'])||_0x40b269['body'][_0x2154('0x5c')]===''){throw new db[(_0x2154('0x77'))]['ValidationError'](_0x2154('0x82'));}if(_[_0x2154('0x81')](_0x40b269['body']['mapKey'])){throw new db[(_0x2154('0x77'))][(_0x2154('0x78'))](_0x2154('0x83')+_0x4e1c3c);}if(!_[_0x2154('0x84')](_0x4e1c3c,_0x40b269['body'][_0x2154('0x85')])){throw new db[(_0x2154('0x77'))][(_0x2154('0x78'))](_0x2154('0x86')+_0x4e1c3c);}_0x331092[_0x40b269[_0x2154('0x5c')]['mapKey']]=_0x40b269[_0x2154('0x5c')][_0x2154('0x7f')];})[_0x2154('0x21')](function(){return db[_0x2154('0x43')]['find']({'where':{'id':_0x40b269[_0x2154('0x59')]['id']},'include':[{'model':db[_0x2154('0x87')],'as':_0x2154('0x88'),'include':[{'model':db[_0x2154('0x76')],'as':_0x2154('0x89'),'where':_0x331092,'limit':0x1,'order':[['updatedAt',_0x2154('0x8a')]]}]},{'model':db[_0x2154('0x8b')],'as':_0x2154('0x8c')}]});})[_0x2154('0x21')](handleEntityNotFound(_0x2629b8,null))[_0x2154('0x21')](function(_0x1c6b90){if(_0x1c6b90&&_0x1c6b90[_0x2154('0x88')]){_0x5db9cf['account']=_0x1c6b90;_0x5db9cf[_0x2154('0x8d')]=_0x1c6b90[_0x2154('0x8c')];_0x5db9cf[_0x2154('0x8e')]=_0x1c6b90[_0x2154('0x88')];_0x5db9cf[_0x2154('0x8d')]=_[_0x2154('0x8f')](_0x5db9cf['applications'],['priority'],['asc']);if(_0x5db9cf['account'][_0x2154('0x8c')]){delete _0x5db9cf[_0x2154('0x90')]['Applications'];}if(_0x5db9cf[_0x2154('0x90')][_0x2154('0x88')]&&_0x5db9cf[_0x2154('0x90')]['List'][_0x2154('0x89')][_0x2154('0x5a')]){return _0x5db9cf['account'][_0x2154('0x88')][_0x2154('0x89')][0x0];}var _0x4d2457=_['defaults'](_0x40b269[_0x2154('0x5c')],{'firstName':_0x40b269['body'][_0x2154('0x7f')],'ListId':_0x1c6b90[_0x2154('0x7e')]});_0x4d2457[_0x40b269[_0x2154('0x5c')][_0x2154('0x85')]]=_0x40b269['body'][_0x2154('0x7f')];return db[_0x2154('0x76')][_0x2154('0x5b')](_0x4d2457,{'fields':_0x4f467d,'raw':!![]});}})[_0x2154('0x21')](handleEntityNotFound(_0x2629b8,null))[_0x2154('0x21')](function(_0x1409b4){_0x5db9cf['contact']=_0x1409b4;if(_0x1409b4){var _0x37590e={'ContactId':_0x1409b4['id'],'OpenchannelAccountId':_0x40b269[_0x2154('0x59')]['id'],'from':(_0x1409b4[_0x2154('0x91')]||'')+'\x20'+(_0x1409b4[_0x2154('0x92')]||'')};var _0x31317d={'OpenchannelAccountId':_0x40b269['params']['id'],'closed':![]};if(_0x40b269['body'][_0x2154('0x93')]){_0x31317d[_0x2154('0x93')]=_0x40b269[_0x2154('0x5c')][_0x2154('0x93')];return db[_0x2154('0x94')][_0x2154('0x61')]({'where':_0x31317d})[_0x2154('0x21')](function(_0x1c1227){if(_0x1c1227){return[_0x1c1227,![]];}_0x37590e['threadId']=_0x40b269['body'][_0x2154('0x93')];_0x37590e['externalUrl']=_0x40b269['body'][_0x2154('0x95')];return db['OpenchannelInteraction'][_0x2154('0x5b')](_0x37590e)[_0x2154('0x21')](function(_0x5c8617){return[_0x5c8617,!![]];});});}else{_0x31317d[_0x2154('0x93')]=null;}_0x31317d[_0x2154('0x96')]=_0x1409b4['id'];return db[_0x2154('0x94')][_0x2154('0x61')]({'where':_0x31317d})[_0x2154('0x21')](function(_0x201e4f){if(_0x201e4f){return[_0x201e4f,![]];}return db['OpenchannelInteraction'][_0x2154('0x5b')](_0x37590e)[_0x2154('0x21')](function(_0x2cb5cb){return[_0x2cb5cb,!![]];});});}})[_0x2154('0x97')](function(_0x10e7d7,_0x1ff29d){if(_0x10e7d7){_0x3f85ad=_0x1ff29d;if(!_0x1ff29d){var _0x4b4efb={'from':(_0x5db9cf[_0x2154('0x98')][_0x2154('0x91')]||'')+'\x20'+(_0x5db9cf[_0x2154('0x98')][_0x2154('0x92')]||'')};if(_0x40b269[_0x2154('0x5c')][_0x2154('0x93')]&&_0x40b269['body'][_0x2154('0x99')]&&_0x40b269[_0x2154('0x5c')][_0x2154('0x93')]!=_0x40b269['body']['messageId']){_0x4b4efb[_0x2154('0x93')]=_0x40b269[_0x2154('0x5c')]['messageId'];}return _0x10e7d7[_0x2154('0x38')](_0x4b4efb);}else{return _0x10e7d7;}}})[_0x2154('0x21')](function(_0x5aac0b){_0x5db9cf[_0x2154('0x9a')]=_0x5aac0b[_0x2154('0x3a')]({'plain':!![]});_0x5db9cf[_0x2154('0x9a')][_0x2154('0x9b')]=_0x3f85ad;if(_0x5db9cf[_0x2154('0x9a')]['created']){if(_0x5db9cf['account']['autoclose']){_0x5db9cf[_0x2154('0x8d')][_0x2154('0x9c')]({'id':0x0,'priority':_0x5db9cf[_0x2154('0x8d')][_0x2154('0x5a')]+0x1,'app':_0x2154('0x9d'),'appdata':'unmanaged','interval':_0x2154('0x9e')});}}return db[_0x2154('0x9f')][_0x2154('0x5b')]({'body':_0x40b269[_0x2154('0x5c')][_0x2154('0x5c')],'OpenchannelAccountId':_0x40b269[_0x2154('0x59')]['id'],'OpenchannelInteractionId':_0x5aac0b['id'],'direction':'in','ContactId':_0x5db9cf['contact']['id'],'AttachmentId':_0x40b269[_0x2154('0x5c')][_0x2154('0xa0')]});})['then'](function(_0x20a327){_0x5db9cf[_0x2154('0x29')]=_0x20a327;if(_0x5db9cf[_0x2154('0x9a')][_0x2154('0xa1')]){return db['User'][_0x2154('0x61')]({'attributes':['id',_0x2154('0x3e')],'where':{'id':_0x5db9cf[_0x2154('0x9a')]['UserId']}})[_0x2154('0x21')](function(_0x2fcc24){if(_0x2fcc24){_0x5db9cf[_0x2154('0x8d')][_0x2154('0xa2')]({'id':0x0,'priority':0x0,'app':_0x2154('0xa3'),'appdata':_0x2fcc24[_0x2154('0x3e')]+','+(_0x5db9cf[_0x2154('0x90')][_0x2154('0xa4')]||0xa),'interval':_0x2154('0x9e')});_0x5db9cf['forcedOwnership']=![];}return respondWithRpcPromise(_0x2154('0xa5'),_0x2154('0xa6'),_0x5db9cf);});}return respondWithRpcPromise(_0x2154('0xa5'),_0x2154('0xa6'),_0x5db9cf);})[_0x2154('0x21')](function(_0x1fde4e){respondWithRpcPromise(_0x2154('0xa7'),_0x2154('0xa7'),{'event':_0x2154('0xa8'),'message':_0x1fde4e},client9002);return _0x1fde4e;})[_0x2154('0x21')](respondWithResult(_0x2629b8,null))[_0x2154('0x2b')](handleError(_0x2629b8,null));};exports[_0x2154('0xa9')]=function(_0x3c01cf,_0x4209a9){var _0x5c173f=_0x3c01cf['params']['id'];var _0x293ff4=_0x3c01cf[_0x2154('0x5c')];var _0x4a5c95=0xc8;var _0x10e3e9=null;return db[_0x2154('0xaa')][_0x2154('0xab')]({'isolationLevel':db[_0x2154('0xaa')][_0x2154('0xac')][_0x2154('0xad')][_0x2154('0xae')]},function(_0xe12b87){return db[_0x2154('0x43')][_0x2154('0x6a')]({'where':{'id':_0x5c173f},'transaction':_0xe12b87})[_0x2154('0x21')](function(_0x5f0dc2){if(_0x5f0dc2){return db['OpenchannelApplication'][_0x2154('0x39')]({'where':{'OpenchannelAccountId':_0x5c173f},'transaction':_0xe12b87})[_0x2154('0x21')](function(){var _0x567e72=_[_0x2154('0x48')](_0x293ff4,function(_0x69f16b){_0x69f16b[_0x2154('0x67')]=_0x5c173f;return _0x69f16b;});return db['OpenchannelApplication'][_0x2154('0xaf')](_0x567e72,{'transaction':_0xe12b87});});}else{_0x4a5c95=0x194;_0x10e3e9=[];}});})['then'](function(){if(_0x4a5c95!==0x194){return db['OpenchannelApplication'][_0x2154('0xb0')]({'where':{'OpenchannelAccountId':_0x5c173f},'order':_0x2154('0xb1')})['then'](function(_0x63acdc){_0x10e3e9=_0x63acdc;});}})[_0x2154('0x2b')](function(_0x14279a){_0x4a5c95=0x1f4;logger[_0x2154('0x28')](_0x14279a[_0x2154('0x3d')]);if(_0x14279a[_0x2154('0x3e')]){delete _0x14279a[_0x2154('0x3e')];}_0x10e3e9=_0x14279a;})['finally'](function(){if(_0x10e3e9===null){_0x4209a9[_0x2154('0xb2')](_0x4a5c95);}else{if(_0x4a5c95===0x1f4){_0x4209a9[_0x2154('0x2c')](_0x4a5c95)[_0x2154('0x3f')](_0x10e3e9);}else{_0x4209a9[_0x2154('0x2c')](_0x4a5c95)['json'](_0x10e3e9);}}});};exports[_0x2154('0xb3')]=function(_0x805ac7,_0x1a7cf9,_0x486bd1){var _0x1ba893={};var _0x246f80={};var _0x4cd2bd;var _0x2a3f8d;return db['OpenchannelAccount'][_0x2154('0x6a')]({'where':{'id':_0x805ac7[_0x2154('0x59')]['id']}})['then'](handleEntityNotFound(_0x1a7cf9,null))[_0x2154('0x21')](function(_0x4520c0){if(_0x4520c0){_0x4cd2bd=_0x4520c0;_0x246f80[_0x2154('0x47')]=_[_0x2154('0x49')](db[_0x2154('0x8b')][_0x2154('0x44')]);_0x246f80[_0x2154('0x4a')]=_[_0x2154('0x49')](_0x805ac7[_0x2154('0x4a')]);_0x246f80[_0x2154('0x4b')]=_['intersection'](_0x246f80[_0x2154('0x47')],_0x246f80[_0x2154('0x4a')]);_0x1ba893[_0x2154('0x4d')]=_[_0x2154('0x4c')](_0x246f80[_0x2154('0x47')],qs[_0x2154('0x4e')](_0x805ac7[_0x2154('0x4a')]['fields']));_0x1ba893['attributes']=_0x1ba893[_0x2154('0x4d')][_0x2154('0x5a')]?_0x1ba893[_0x2154('0x4d')]:_0x246f80[_0x2154('0x47')];_0x1ba893[_0x2154('0x6c')]=qs[_0x2154('0x50')](_0x805ac7['query'][_0x2154('0x50')]);_0x1ba893['where']=qs[_0x2154('0x4b')](_[_0x2154('0x52')](_0x805ac7[_0x2154('0x4a')],_0x246f80['filters']));if(_0x805ac7[_0x2154('0x4a')]['filter']){_0x1ba893[_0x2154('0x51')]=_[_0x2154('0x54')](_0x1ba893[_0x2154('0x51')],{'$or':_['map'](_0x1ba893[_0x2154('0x4d')],function(_0x43f12c){var _0x53a59a={};_0x53a59a[_0x43f12c]={'$like':'%'+_0x805ac7[_0x2154('0x4a')]['filter']+'%'};return _0x53a59a;})});}_0x1ba893=_[_0x2154('0x54')]({},_0x1ba893,_0x805ac7[_0x2154('0x55')]);return _0x4cd2bd[_0x2154('0xb3')](_0x1ba893);}})[_0x2154('0x21')](function(_0x2fb133){if(_0x2fb133){_0x2a3f8d=_0x2fb133[_0x2154('0x5a')];if(!_0x805ac7[_0x2154('0x4a')][_0x2154('0x4f')](_0x2154('0x6b'))){_0x1ba893[_0x2154('0x31')]=qs[_0x2154('0x31')](_0x805ac7['query'][_0x2154('0x31')]);_0x1ba893[_0x2154('0x2f')]=qs['offset'](_0x805ac7[_0x2154('0x4a')][_0x2154('0x2f')]);}return _0x4cd2bd['getApplications'](_0x1ba893);}})[_0x2154('0x21')](function(_0x21f838){if(_0x21f838){return _0x21f838?{'count':_0x2a3f8d,'rows':_0x21f838}:null;}})[_0x2154('0x21')](respondWithResult(_0x1a7cf9,null))[_0x2154('0x2b')](handleError(_0x1a7cf9,null));};exports['getInteractions']=function(_0x83d77b,_0x52fa97,_0xe8ca58){var _0x174be5={'raw':![],'where':{}};var _0x2d2776={};var _0x2ebe7f={'count':0x0,'rows':[]};return db[_0x2154('0x43')][_0x2154('0x6a')]({'where':{'id':_0x83d77b[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x52fa97,null))[_0x2154('0x21')](function(_0x331ec5){if(_0x331ec5){_0x2d2776[_0x2154('0x47')]=_[_0x2154('0x49')](db[_0x2154('0x94')][_0x2154('0x44')]);_0x2d2776[_0x2154('0x4a')]=_[_0x2154('0x49')](_0x83d77b['query']);_0x2d2776[_0x2154('0x4b')]=_[_0x2154('0x4c')](_0x2d2776[_0x2154('0x47')],_0x2d2776[_0x2154('0x4a')]);_0x174be5['attributes']=_[_0x2154('0x4c')](_0x2d2776[_0x2154('0x47')],qs['fields'](_0x83d77b[_0x2154('0x4a')][_0x2154('0x4e')]));_0x174be5['attributes']=_0x174be5[_0x2154('0x4d')][_0x2154('0x5a')]?_0x174be5[_0x2154('0x4d')]:_0x2d2776[_0x2154('0x47')];if(!_0x83d77b['query'][_0x2154('0x4f')](_0x2154('0x6b'))){_0x174be5['limit']=qs[_0x2154('0x31')](_0x83d77b['query'][_0x2154('0x31')]);_0x174be5[_0x2154('0x2f')]=qs[_0x2154('0x2f')](_0x83d77b[_0x2154('0x4a')]['offset']);}_0x174be5[_0x2154('0x6c')]=qs[_0x2154('0x50')](_0x83d77b[_0x2154('0x4a')][_0x2154('0x50')]);_0x174be5['where']=qs['filters'](_['pick'](_0x83d77b[_0x2154('0x4a')],_0x2d2776[_0x2154('0x4b')]));_0x174be5[_0x2154('0x51')][_0x2154('0x67')]=_0x331ec5['id'];if(_0x83d77b[_0x2154('0x4a')][_0x2154('0x53')]){_0x174be5[_0x2154('0x51')]=_[_0x2154('0x54')](_0x174be5[_0x2154('0x51')],{'$or':_[_0x2154('0x48')](_0x174be5['attributes'],function(_0x38d2fb){var _0x34b226={};_0x34b226[_0x38d2fb]={'$like':'%'+_0x83d77b[_0x2154('0x4a')][_0x2154('0x53')]+'%'};return _0x34b226;})});}_0x174be5=_[_0x2154('0x54')]({},_0x174be5,_0x83d77b[_0x2154('0x55')]);return db['OpenchannelInteraction'][_0x2154('0x32')]({'where':_0x174be5['where']})['then'](function(_0x5bee1c){_0x2ebe7f[_0x2154('0x32')]=_0x5bee1c;if(_0x83d77b[_0x2154('0x4a')][_0x2154('0x56')]){_0x174be5[_0x2154('0x57')]=[{'model':db[_0x2154('0x76')],'as':_0x2154('0xb4'),'required':![]},{'model':db[_0x2154('0xb5')],'as':_0x2154('0xb6'),'attributes':['name','fullname',_0x2154('0xb7')],'required':![]},{'model':db[_0x2154('0xb8')],'as':_0x2154('0xb9'),'attributes':['id',_0x2154('0x3e'),_0x2154('0xba')],'where':_0x83d77b['query'][_0x2154('0xbb')]?{'id':_0x83d77b[_0x2154('0x4a')]['tag']}:undefined,'required':_0x83d77b[_0x2154('0x4a')]['tag']?!![]:![]}];}return db[_0x2154('0x94')][_0x2154('0x6d')](_0x174be5);})['then'](function(_0x2bb06f){_0x2ebe7f[_0x2154('0x6e')]=_0x2bb06f;return _0x2ebe7f;});}})[_0x2154('0x21')](respondWithFilteredResult(_0x52fa97,_0x174be5))['catch'](handleError(_0x52fa97,null));};exports[_0x2154('0xbc')]=function(_0x3aa5f4,_0x231d2f,_0x376563){return db[_0x2154('0x43')]['find']({'where':{'id':_0x3aa5f4[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x231d2f,null))[_0x2154('0x21')](function(_0x56ab08){if(_0x56ab08){return _0x56ab08[_0x2154('0xbc')](_0x3aa5f4[_0x2154('0x5c')][_0x2154('0x70')],_[_0x2154('0xbd')](_0x3aa5f4[_0x2154('0x5c')],[_0x2154('0x70'),'id'])||{})[_0x2154('0x97')](function(_0x5c7bac){for(var _0x107f97=0x0;_0x107f97<_0x3aa5f4[_0x2154('0x5c')][_0x2154('0x70')]['length'];_0x107f97+=0x1){socket[_0x2154('0xbe')](_0x2154('0xbf'),{'UserId':Number(_0x3aa5f4[_0x2154('0x5c')][_0x2154('0x70')][_0x107f97]),'OpenchannelAccountId':Number(_0x3aa5f4[_0x2154('0x59')]['id'])});}return _0x5c7bac;});}})[_0x2154('0x21')](respondWithResult(_0x231d2f,null))[_0x2154('0x2b')](handleError(_0x231d2f,null));};exports[_0x2154('0xc0')]=function(_0x2f3bae,_0x5bdf65,_0x3b23f7){return db[_0x2154('0x43')][_0x2154('0x61')]({'where':{'id':_0x2f3bae['params']['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x5bdf65,null))['then'](function(_0x3a60a8){if(_0x3a60a8){return _0x3a60a8[_0x2154('0xc0')](_0x2f3bae[_0x2154('0x4a')][_0x2154('0x70')])['then'](function(){if(_['isArray'](_0x2f3bae['query']['ids'])){for(var _0x3f0d24=0x0;_0x3f0d24<_0x2f3bae['query']['ids']['length'];_0x3f0d24+=0x1){socket['emit'](_0x2154('0xc1'),{'UserId':Number(_0x2f3bae[_0x2154('0x4a')][_0x2154('0x70')][_0x3f0d24]),'OpenchannelAccountId':Number(_0x2f3bae[_0x2154('0x59')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x2f3bae[_0x2154('0x4a')][_0x2154('0x70')]),'OpenchannelAccountId':Number(_0x2f3bae['params']['id'])});}});}})[_0x2154('0x21')](respondWithStatusCode(_0x5bdf65,null))[_0x2154('0x2b')](handleError(_0x5bdf65,null));};exports['getAgents']=function(_0x422c0a,_0x2dce66,_0x5b30e8){var _0x44b06b={};var _0x205a59={};var _0xf599ff;var _0x1d482c;return db['OpenchannelAccount'][_0x2154('0x6a')]({'where':{'id':_0x422c0a[_0x2154('0x59')]['id']}})['then'](handleEntityNotFound(_0x2dce66,null))[_0x2154('0x21')](function(_0x4744fa){if(_0x4744fa){_0xf599ff=_0x4744fa;_0x205a59[_0x2154('0x47')]=_[_0x2154('0x49')](db[_0x2154('0xb5')][_0x2154('0x44')]);_0x205a59[_0x2154('0x4a')]=_['keys'](_0x422c0a[_0x2154('0x4a')]);_0x205a59['filters']=_[_0x2154('0x4c')](_0x205a59[_0x2154('0x47')],_0x205a59[_0x2154('0x4a')]);_0x44b06b[_0x2154('0x4d')]=_[_0x2154('0x4c')](_0x205a59[_0x2154('0x47')],qs[_0x2154('0x4e')](_0x422c0a[_0x2154('0x4a')]['fields']));_0x44b06b[_0x2154('0x4d')]=_0x44b06b[_0x2154('0x4d')][_0x2154('0x5a')]?_0x44b06b[_0x2154('0x4d')]:_0x205a59['model'];_0x44b06b[_0x2154('0x6c')]=qs[_0x2154('0x50')](_0x422c0a[_0x2154('0x4a')][_0x2154('0x50')]);_0x44b06b['where']=qs[_0x2154('0x4b')](_[_0x2154('0x52')](_0x422c0a[_0x2154('0x4a')],_0x205a59['filters']));if(_0x422c0a[_0x2154('0x4a')][_0x2154('0x53')]){_0x44b06b[_0x2154('0x51')]=_[_0x2154('0x54')](_0x44b06b['where'],{'$or':_[_0x2154('0x48')](_0x44b06b[_0x2154('0x4d')],function(_0x3627fd){var _0x13e313={};_0x13e313[_0x3627fd]={'$like':'%'+_0x422c0a[_0x2154('0x4a')][_0x2154('0x53')]+'%'};return _0x13e313;})});}_0x44b06b=_[_0x2154('0x54')]({},_0x44b06b,_0x422c0a[_0x2154('0x55')]);return _0xf599ff[_0x2154('0xc2')](_0x44b06b);}})[_0x2154('0x21')](function(_0x14214c){if(_0x14214c){_0x1d482c=_0x14214c[_0x2154('0x5a')];if(!_0x422c0a[_0x2154('0x4a')]['hasOwnProperty']('nolimit')){_0x44b06b[_0x2154('0x31')]=qs[_0x2154('0x31')](_0x422c0a[_0x2154('0x4a')][_0x2154('0x31')]);_0x44b06b[_0x2154('0x2f')]=qs['offset'](_0x422c0a[_0x2154('0x4a')][_0x2154('0x2f')]);}return _0xf599ff[_0x2154('0xc2')](_0x44b06b);}})[_0x2154('0x21')](function(_0x5ba7e2){if(_0x5ba7e2){return _0x5ba7e2?{'count':_0x1d482c,'rows':_0x5ba7e2}:null;}})[_0x2154('0x21')](respondWithResult(_0x2dce66,null))[_0x2154('0x2b')](handleError(_0x2dce66,null));};exports['send']=function(_0x52d93b,_0x59484e,_0x1e891c){var _0x5eee3e,_0x2f86f1,_0x18dad3;if(_[_0x2154('0x81')](_0x52d93b['body'][_0x2154('0x5c')])||_0x52d93b['body'][_0x2154('0x5c')]===''){throw new db[(_0x2154('0x77'))][(_0x2154('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x52d93b[_0x2154('0x5c')]['to'])){}_0x5eee3e=_0x52d93b[_0x2154('0x5c')]['to'];return db[_0x2154('0x43')][_0x2154('0x6a')]({'where':{'id':_0x52d93b[_0x2154('0x59')]['id']}})[_0x2154('0x21')](handleEntityNotFound(_0x59484e,null))['then'](function(_0x2561ff){if(_0x2561ff){return db[_0x2154('0x43')][_0x2154('0x61')]({'where':{'id':_0x2561ff['id']},'include':[{'model':db[_0x2154('0x87')],'as':'List','include':[{'model':db[_0x2154('0x76')],'as':_0x2154('0x89'),'where':{[_0x2561ff[_0x2154('0x85')]]:_0x5eee3e},'limit':0x1,'order':[[_0x2154('0x7c'),_0x2154('0x8a')]]}]}]})['then'](handleEntityNotFound(_0x59484e,null))['then'](function(_0x4b0054){if(_0x4b0054&&_0x4b0054['List']){_0x2f86f1=_0x4b0054[_0x2154('0x3a')]({'plain':!![]});if(_0x2f86f1['List']&&_0x2f86f1[_0x2154('0x88')][_0x2154('0x89')]['length']){return _0x2f86f1[_0x2154('0x88')][_0x2154('0x89')][0x0];}return db[_0x2154('0x76')][_0x2154('0x5b')](_[_0x2154('0x1b')](_0x52d93b[_0x2154('0x5c')],{'firstName':_0x5eee3e,[_0x4b0054[_0x2154('0x85')]]:_0x5eee3e,'phone':_0x5eee3e,'ListId':_0x2f86f1['ListId']}));}})[_0x2154('0x21')](handleEntityNotFound(_0x59484e,null))[_0x2154('0x21')](function(_0x15398f){if(_0x15398f){_0x18dad3=_0x15398f;return db['OpenchannelInteraction'][_0x2154('0x61')]({'where':{'ContactId':_0x18dad3['id'],'closed':![],'OpenchannelAccountId':_0x2f86f1['id']}})[_0x2154('0x21')](function(_0x2bc71a){if(_0x2bc71a){return[_0x2bc71a,![]];}return db['OpenchannelInteraction'][_0x2154('0x5b')]({'UserId':_0x52d93b['user']['id'],'ContactId':_0x18dad3['id'],'OpenchannelAccountId':_0x2f86f1['id'],'lastMsgDirection':'out','firstMsgDirection':_0x2154('0xc3'),'Messages':[_[_0x2154('0x54')](_0x52d93b['body'],{'read':![],'body':_0x52d93b[_0x2154('0x5c')]['body'],'OpenchannelAccountId':_0x2f86f1['id'],'UserId':_0x52d93b[_0x2154('0x5d')]['id'],'ContactId':_0x18dad3['id']})]},{'include':[{'model':db[_0x2154('0x9f')],'as':_0x2154('0xc4')}]})['then'](function(_0x39c787){return[_0x39c787,!![]];});});}})[_0x2154('0x97')](function(_0x52d386,_0x326669){if(_0x326669){return _0x52d386;}return db[_0x2154('0x9f')][_0x2154('0x5b')](_[_0x2154('0x54')](_0x52d93b[_0x2154('0x5c')],{'read':![],'body':_0x52d93b[_0x2154('0x5c')]['body'],'OpenchannelAccountId':_0x2f86f1['id'],'OpenchannelInteractionId':_0x52d386['id'],'UserId':_0x52d93b[_0x2154('0x5d')]['id'],'ContactId':_0x18dad3['id']}))['then'](function(_0x1244bd){_0x52d386[_0x2154('0xc5')][_0x2154('0xc4')]=[];_0x52d386[_0x2154('0xc5')][_0x2154('0xc4')][_0x2154('0x9c')](_0x1244bd[_0x2154('0xc5')]);return _0x52d386;});});}})[_0x2154('0x21')](respondWithResult(_0x59484e,null))[_0x2154('0x2b')](handleError(_0x59484e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 09230e4..303ac4a 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','hasOwnProperty','exports','events'];(function(_0x1b9710,_0x2742b1){var _0x1cf532=function(_0x203423){while(--_0x203423){_0x1b9710['push'](_0x1b9710['shift']());}};_0x1cf532(++_0x2742b1);}(_0xaa88,0x137));var _0x8aa8=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0xaa88[_0x737a1f];return _0x16eba1;};'use strict';var EventEmitter=require(_0x8aa8('0x0'));var OpenchannelAccount=require(_0x8aa8('0x1'))['db'][_0x8aa8('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8aa8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8aa8('0x4'),'afterDestroy':_0x8aa8('0x5')};function emitEvent(_0x43f7e4){return function(_0x3b2c88,_0x3e3b70,_0x350e8b){OpenchannelAccountEvents['emit'](_0x43f7e4+':'+_0x3b2c88['id'],_0x3b2c88);OpenchannelAccountEvents['emit'](_0x43f7e4,_0x3b2c88);_0x350e8b(null);};}for(var e in events){if(events[_0x8aa8('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8aa8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x59ac04,_0xadf775){var _0x105174=function(_0x4566e4){while(--_0x4566e4){_0x59ac04['push'](_0x59ac04['shift']());}};_0x105174(++_0xadf775);}(_0x9348,0x10d));var _0x8934=function(_0x151225,_0x1c510a){_0x151225=_0x151225-0x0;var _0x4f24ab=_0x9348[_0x151225];return _0x4f24ab;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index ed8a62f..ebd2faf 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(_0x2b0afc,_0x1a73de){var _0x2c5a48=function(_0x583abf){while(--_0x583abf){_0x2b0afc['push'](_0x2b0afc['shift']());}};_0x2c5a48(++_0x1a73de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x24f819,_0x4097fb){var _0x120b95=function(_0x402f21){while(--_0x402f21){_0x24f819['push'](_0x24f819['shift']());}};_0x120b95(++_0x4097fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 50cff44..5293bc4 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 _0x9d5b=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket'];(function(_0xfd85c7,_0x43ea9b){var _0x166148=function(_0x292522){while(--_0x292522){_0xfd85c7['push'](_0xfd85c7['shift']());}};_0x166148(++_0x43ea9b);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x5132dd,_0x9e5c87){_0x5132dd=_0x5132dd-0x0;var _0x64c5ac=_0x9d5b[_0x5132dd];return _0x64c5ac;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});config['redis']=_[_0xb9d5('0xb')](config[_0xb9d5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9d5('0xd'))(new Redis(config[_0xb9d5('0xc')]));require(_0xb9d5('0xe'))[_0xb9d5('0xf')](socket);function respondWithRpcPromise(_0x5d0fc6,_0x1aec1b,_0x1ae073){return new BPromise(function(_0x4c1ce3,_0x35d69f){return client[_0xb9d5('0x10')](_0x5d0fc6,_0x1ae073)[_0xb9d5('0x11')](function(_0x422b36){logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));logger[_0xb9d5('0x15')](_0xb9d5('0x16'),_0x1aec1b,_0xb9d5('0x14'),JSON[_0xb9d5('0x17')](_0x422b36));if(_0x422b36['error']){if(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x19')]===0x1f4){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x35d69f(_0x422b36['error'][_0xb9d5('0x1a')]);}logger[_0xb9d5('0x18')](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x4c1ce3(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);}else{logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));_0x4c1ce3(_0x422b36[_0xb9d5('0x1b')][_0xb9d5('0x1a')]);}})[_0xb9d5('0x1c')](function(_0x171487){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x171487);_0x35d69f(_0x171487);});});} \ No newline at end of file +var _0x5ec6=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0x5ec6,0x7f));var _0x65ec=function(_0xc43c3e,_0x441479){_0xc43c3e=_0xc43c3e-0x0;var _0x37aad8=_0x5ec6[_0xc43c3e];return _0x37aad8;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});config['redis']=_[_0x65ec('0x9')](config[_0x65ec('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x65ec('0xb'))(new Redis(config[_0x65ec('0xa')]));require(_0x65ec('0xc'))['register'](socket);function respondWithRpcPromise(_0x49aacd,_0x3cf126,_0x5e78f8){return new BPromise(function(_0x136928,_0x28fe68){return client['request'](_0x49aacd,_0x5e78f8)[_0x65ec('0xd')](function(_0xd7cf80){logger['info'](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));logger['debug'](_0x65ec('0x10'),_0x3cf126,_0x65ec('0xf'),JSON[_0x65ec('0x11')](_0xd7cf80));if(_0xd7cf80[_0x65ec('0x12')]){if(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x13')]===0x1f4){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0xd7cf80['error'][_0x65ec('0x14')]);return _0x28fe68(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3cf126,_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);return _0x136928(_0xd7cf80[_0x65ec('0x12')]['message']);}else{logger[_0x65ec('0x15')](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));_0x136928(_0xd7cf80[_0x65ec('0x16')][_0x65ec('0x14')]);}})[_0x65ec('0x17')](function(_0x37c494){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0x37c494);_0x28fe68(_0x37c494);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 74d40de..8f42c86 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 _0x7846=['update','removeListener','register','openchannelAccount:','save','remove'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7846,0xf4));var _0x6784=function(_0x101dce,_0x3b887c){_0x101dce=_0x101dce-0x0;var _0x5a92bb=_0x7846[_0x101dce];return _0x5a92bb;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x6784('0x0'),_0x6784('0x1'),_0x6784('0x2')];function createListener(_0xebf76a,_0x3c868d){return function(_0x7653ef){_0x3c868d['emit'](_0xebf76a,_0x7653ef);};}function removeListener(_0x13ba3e,_0x24c16b){return function(){OpenchannelAccountEvents[_0x6784('0x3')](_0x13ba3e,_0x24c16b);};}exports[_0x6784('0x4')]=function(_0x327e26){for(var _0x409fe1=0x0,_0x43df2a=events['length'];_0x409fe1<_0x43df2a;_0x409fe1++){var _0x560e3f=events[_0x409fe1];var _0x289ae9=createListener(_0x6784('0x5')+_0x560e3f,_0x327e26);OpenchannelAccountEvents['on'](_0x560e3f,_0x289ae9);}}; \ No newline at end of file +var _0xd382=['./openchannelAccount.events','save','remove','update','emit','openchannelAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x4cd8fd,_0x377450){_0x4cd8fd=_0x4cd8fd-0x0;var _0x18d30f=_0xd382[_0x4cd8fd];return _0x18d30f;};'use strict';var OpenchannelAccountEvents=require(_0x2d38('0x0'));var events=[_0x2d38('0x1'),_0x2d38('0x2'),_0x2d38('0x3')];function createListener(_0x260d8e,_0xe32566){return function(_0x9ab754){_0xe32566[_0x2d38('0x4')](_0x260d8e,_0x9ab754);};}function removeListener(_0xf6bceb,_0x312012){return function(){OpenchannelAccountEvents['removeListener'](_0xf6bceb,_0x312012);};}exports['register']=function(_0x5a8219){for(var _0x30106c=0x0,_0x1e2919=events['length'];_0x30106c<_0x1e2919;_0x30106c++){var _0x1296cb=events[_0x30106c];var _0x3fb88f=createListener(_0x2d38('0x5')+_0x1296cb,_0x5a8219);OpenchannelAccountEvents['on'](_0x1296cb,_0x3fb88f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7de3431..a872cfc 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 _0xb0cb=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x338b15,_0x3202d8){var _0x466e43=function(_0x3c79ae){while(--_0x3c79ae){_0x338b15['push'](_0x338b15['shift']());}};_0x466e43(++_0x3202d8);}(_0xb0cb,0x1d0));var _0xbb0c=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xb0cb[_0x44946b];return _0x249bc4;};'use strict';var multer=require(_0xbb0c('0x0'));var util=require('util');var path=require(_0xbb0c('0x1'));var timeout=require(_0xbb0c('0x2'));var express=require(_0xbb0c('0x3'));var router=express[_0xbb0c('0x4')]();var fs_extra=require(_0xbb0c('0x5'));var auth=require(_0xbb0c('0x6'));var interaction=require(_0xbb0c('0x7'));var config=require(_0xbb0c('0x8'));var controller=require(_0xbb0c('0x9'));router[_0xbb0c('0xa')]('/',auth[_0xbb0c('0xb')](),controller[_0xbb0c('0xc')]);router[_0xbb0c('0xa')](_0xbb0c('0xd'),auth['isAuthenticated'](),controller[_0xbb0c('0xe')]);router[_0xbb0c('0xf')]('/',auth['isAuthenticated'](),controller[_0xbb0c('0x10')]);router[_0xbb0c('0x11')](_0xbb0c('0xd'),auth['isAuthenticated'](),controller[_0xbb0c('0x12')]);router[_0xbb0c('0x13')]('/:id',auth[_0xbb0c('0xb')](),controller[_0xbb0c('0x14')]);module[_0xbb0c('0x15')]=router; \ No newline at end of file +var _0xb80c=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0xb80c,0x150));var _0xcb80=function(_0x350d07,_0x28575d){_0x350d07=_0x350d07-0x0;var _0x358194=_0xb80c[_0x350d07];return _0x358194;};'use strict';var multer=require(_0xcb80('0x0'));var util=require(_0xcb80('0x1'));var path=require(_0xcb80('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb80('0x3'));var router=express[_0xcb80('0x4')]();var fs_extra=require(_0xcb80('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb80('0x6'));var config=require(_0xcb80('0x7'));var controller=require(_0xcb80('0x8'));router[_0xcb80('0x9')]('/',auth[_0xcb80('0xa')](),controller[_0xcb80('0xb')]);router[_0xcb80('0x9')]('/:id',auth[_0xcb80('0xa')](),controller[_0xcb80('0xc')]);router[_0xcb80('0xd')]('/',auth[_0xcb80('0xa')](),controller[_0xcb80('0xe')]);router['put']('/:id',auth[_0xcb80('0xa')](),controller['update']);router[_0xcb80('0xf')](_0xcb80('0x10'),auth[_0xcb80('0xa')](),controller[_0xcb80('0x11')]);module[_0xcb80('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 39e3c4a..37bb7a9 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 _0xcb55=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x5c5fea,_0x583f9d){var _0x2c0658=function(_0x3fec84){while(--_0x3fec84){_0x5c5fea['push'](_0x5c5fea['shift']());}};_0x2c0658(++_0x583f9d);}(_0xcb55,0x1c9));var _0x5cb5=function(_0x16fe53,_0x2b7d82){_0x16fe53=_0x16fe53-0x0;var _0x49096c=_0xcb55[_0x16fe53];return _0x49096c;};'use strict';var Sequelize=require(_0x5cb5('0x0'));module[_0x5cb5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5cb5('0x2')},'appdata':{'type':Sequelize[_0x5cb5('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5cb5('0x4')],'defaultValue':_0x5cb5('0x5')}}; \ No newline at end of file +var _0xd7c1=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xd7c1,0xa5));var _0x1d7c=function(_0x334fc1,_0x2f8855){_0x334fc1=_0x334fc1-0x0;var _0x1f942d=_0xd7c1[_0x334fc1];return _0x1f942d;};'use strict';var Sequelize=require(_0x1d7c('0x0'));module[_0x1d7c('0x1')]={'priority':{'type':Sequelize[_0x1d7c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1d7c('0x3')],'allowNull':![],'defaultValue':_0x1d7c('0x4')},'appdata':{'type':Sequelize[_0x1d7c('0x5')]()},'description':{'type':Sequelize[_0x1d7c('0x3')]},'interval':{'type':Sequelize[_0x1d7c('0x3')],'defaultValue':_0x1d7c('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 3c54275..3f0ade6 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 _0x5b88=['path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','destroy','then','error','stack','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','zip-dir','bluebird','mustache','util'];(function(_0x5eeec0,_0xd62abf){var _0x3ab639=function(_0x311aee){while(--_0x311aee){_0x5eeec0['push'](_0x5eeec0['shift']());}};_0x3ab639(++_0xd62abf);}(_0x5b88,0x1a6));var _0x85b8=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x5b88[_0x2adbeb];return _0x5e18a6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85b8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x85b8('0x1'));var Mustache=require(_0x85b8('0x2'));var util=require(_0x85b8('0x3'));var path=require(_0x85b8('0x4'));var sox=require(_0x85b8('0x5'));var csv=require('to-csv');var ejs=require(_0x85b8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85b8('0x7'));var squel=require(_0x85b8('0x8'));var crypto=require(_0x85b8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x85b8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x85b8('0xb'));var Redis=require(_0x85b8('0xc'));var authService=require(_0x85b8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x85b8('0xe'));var hardwareService=require(_0x85b8('0xf'));var logger=require(_0x85b8('0x10'))(_0x85b8('0x11'));var utils=require(_0x85b8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x85b8('0x13'));var db=require(_0x85b8('0x14'))['db'];function respondWithStatusCode(_0x4be530,_0x2169e8){_0x2169e8=_0x2169e8||0xcc;return function(_0x57f916){if(_0x57f916){return _0x4be530[_0x85b8('0x15')](_0x2169e8);}return _0x4be530['status'](_0x2169e8)[_0x85b8('0x16')]();};}function respondWithResult(_0x3b9773,_0xaf1556){_0xaf1556=_0xaf1556||0xc8;return function(_0x3d6678){if(_0x3d6678){return _0x3b9773[_0x85b8('0x17')](_0xaf1556)['json'](_0x3d6678);}};}function respondWithFilteredResult(_0xdc181,_0x14b248){return function(_0x4cb88d){if(_0x4cb88d){var _0x5c6a22=typeof _0x14b248[_0x85b8('0x18')]===_0x85b8('0x19')&&typeof _0x14b248[_0x85b8('0x1a')]==='undefined';var _0x10617=_0x4cb88d[_0x85b8('0x1b')];var _0x119edc=_0x5c6a22?0x0:_0x14b248[_0x85b8('0x18')];var _0x4181a0=_0x5c6a22?_0x4cb88d[_0x85b8('0x1b')]:_0x14b248[_0x85b8('0x18')]+_0x14b248[_0x85b8('0x1a')];var _0x3c292f;if(_0x4181a0>=_0x10617){_0x4181a0=_0x10617;_0x3c292f=0xc8;}else{_0x3c292f=0xce;}_0xdc181['status'](_0x3c292f);return _0xdc181[_0x85b8('0x1c')]('Content-Range',_0x119edc+'-'+_0x4181a0+'/'+_0x10617)[_0x85b8('0x1d')](_0x4cb88d);}return null;};}function patchUpdates(_0x2856c2){return function(_0xaf5cb1){try{jsonpatch[_0x85b8('0x1e')](_0xaf5cb1,_0x2856c2,!![]);}catch(_0x464b06){return BPromise[_0x85b8('0x1f')](_0x464b06);}return _0xaf5cb1['save']();};}function saveUpdates(_0x2fe648,_0x1ee1e5){return function(_0x5c1a86){if(_0x5c1a86){return _0x5c1a86['update'](_0x2fe648)['then'](function(_0x4d02d0){return _0x4d02d0;});}return null;};}function removeEntity(_0x5b5960,_0x1afba0){return function(_0x4cbc75){if(_0x4cbc75){return _0x4cbc75[_0x85b8('0x20')]()[_0x85b8('0x21')](function(){_0x5b5960[_0x85b8('0x17')](0xcc)[_0x85b8('0x16')]();});}};}function handleEntityNotFound(_0x3d319f,_0x3a8363){return function(_0xc7d188){if(!_0xc7d188){_0x3d319f[_0x85b8('0x15')](0x194);}return _0xc7d188;};}function handleError(_0x51a317,_0x44436b){_0x44436b=_0x44436b||0x1f4;return function(_0x3694a2){logger[_0x85b8('0x22')](_0x3694a2[_0x85b8('0x23')]);if(_0x3694a2['name']){delete _0x3694a2['name'];}_0x51a317[_0x85b8('0x17')](_0x44436b)['send'](_0x3694a2);};}exports[_0x85b8('0x24')]=function(_0x1bb211,_0x320a6b){var _0x42dd51={},_0x4044ce={},_0x27dfa2={'count':0x0,'rows':[]};var _0x450e76=_[_0x85b8('0x25')](db[_0x85b8('0x26')][_0x85b8('0x27')],function(_0x5ceaf0){return{'name':_0x5ceaf0[_0x85b8('0x28')],'type':_0x5ceaf0[_0x85b8('0x29')][_0x85b8('0x2a')]};});_0x4044ce[_0x85b8('0x2b')]=_['map'](_0x450e76,'name');_0x4044ce['query']=_['keys'](_0x1bb211[_0x85b8('0x2c')]);_0x4044ce[_0x85b8('0x2d')]=_[_0x85b8('0x2e')](_0x4044ce[_0x85b8('0x2b')],_0x4044ce[_0x85b8('0x2c')]);_0x42dd51[_0x85b8('0x2f')]=_[_0x85b8('0x2e')](_0x4044ce[_0x85b8('0x2b')],qs[_0x85b8('0x30')](_0x1bb211[_0x85b8('0x2c')]['fields']));_0x42dd51[_0x85b8('0x2f')]=_0x42dd51['attributes']['length']?_0x42dd51[_0x85b8('0x2f')]:_0x4044ce[_0x85b8('0x2b')];if(!_0x1bb211[_0x85b8('0x2c')]['hasOwnProperty'](_0x85b8('0x31'))){_0x42dd51[_0x85b8('0x1a')]=qs[_0x85b8('0x1a')](_0x1bb211[_0x85b8('0x2c')][_0x85b8('0x1a')]);_0x42dd51[_0x85b8('0x18')]=qs[_0x85b8('0x18')](_0x1bb211[_0x85b8('0x2c')][_0x85b8('0x18')]);}_0x42dd51[_0x85b8('0x32')]=qs[_0x85b8('0x33')](_0x1bb211[_0x85b8('0x2c')][_0x85b8('0x33')]);_0x42dd51['where']=qs[_0x85b8('0x2d')](_[_0x85b8('0x34')](_0x1bb211['query'],_0x4044ce['filters']),_0x450e76);if(_0x1bb211['query'][_0x85b8('0x35')]){_0x42dd51[_0x85b8('0x36')]=_[_0x85b8('0x37')](_0x42dd51[_0x85b8('0x36')],{'$or':_[_0x85b8('0x25')](_0x450e76,function(_0x219c1f){if(_0x219c1f[_0x85b8('0x29')]!==_0x85b8('0x38')){var _0x7e79a8={};_0x7e79a8[_0x219c1f[_0x85b8('0x39')]]={'$like':'%'+_0x1bb211[_0x85b8('0x2c')][_0x85b8('0x35')]+'%'};return _0x7e79a8;}})});}_0x42dd51=_[_0x85b8('0x37')]({},_0x42dd51,_0x1bb211[_0x85b8('0x3a')]);var _0x4318dc={'where':_0x42dd51[_0x85b8('0x36')]};return db[_0x85b8('0x26')][_0x85b8('0x1b')](_0x4318dc)[_0x85b8('0x21')](function(_0x508363){_0x27dfa2[_0x85b8('0x1b')]=_0x508363;if(_0x1bb211[_0x85b8('0x2c')][_0x85b8('0x3b')]){_0x42dd51['include']=[{'all':!![]}];}return db[_0x85b8('0x26')][_0x85b8('0x3c')](_0x42dd51);})[_0x85b8('0x21')](function(_0x3f5970){_0x27dfa2[_0x85b8('0x3d')]=_0x3f5970;return _0x27dfa2;})[_0x85b8('0x21')](respondWithFilteredResult(_0x320a6b,_0x42dd51))[_0x85b8('0x3e')](handleError(_0x320a6b,null));};exports[_0x85b8('0x3f')]=function(_0x1e34d4,_0x498e3e){var _0x2cceed={'raw':!![],'where':{'id':_0x1e34d4[_0x85b8('0x40')]['id']}},_0x54007c={};_0x54007c[_0x85b8('0x2b')]=_[_0x85b8('0x41')](db[_0x85b8('0x26')][_0x85b8('0x27')]);_0x54007c[_0x85b8('0x2c')]=_['keys'](_0x1e34d4[_0x85b8('0x2c')]);_0x54007c[_0x85b8('0x2d')]=_['intersection'](_0x54007c[_0x85b8('0x2b')],_0x54007c[_0x85b8('0x2c')]);_0x2cceed['attributes']=_['intersection'](_0x54007c[_0x85b8('0x2b')],qs[_0x85b8('0x30')](_0x1e34d4['query']['fields']));_0x2cceed[_0x85b8('0x2f')]=_0x2cceed[_0x85b8('0x2f')][_0x85b8('0x42')]?_0x2cceed['attributes']:_0x54007c[_0x85b8('0x2b')];if(_0x1e34d4[_0x85b8('0x2c')][_0x85b8('0x3b')]){_0x2cceed[_0x85b8('0x43')]=[{'all':!![]}];}_0x2cceed=_[_0x85b8('0x37')]({},_0x2cceed,_0x1e34d4[_0x85b8('0x3a')]);return db[_0x85b8('0x26')][_0x85b8('0x44')](_0x2cceed)[_0x85b8('0x21')](handleEntityNotFound(_0x498e3e,null))[_0x85b8('0x21')](respondWithResult(_0x498e3e,null))[_0x85b8('0x3e')](handleError(_0x498e3e,null));};exports[_0x85b8('0x45')]=function(_0x4c8488,_0x5aed85){return db['OpenchannelApplication'][_0x85b8('0x45')](_0x4c8488[_0x85b8('0x46')],{})[_0x85b8('0x21')](respondWithResult(_0x5aed85,0xc9))[_0x85b8('0x3e')](handleError(_0x5aed85,null));};exports['update']=function(_0x3be8d9,_0x31b2ed){if(_0x3be8d9[_0x85b8('0x46')]['id']){delete _0x3be8d9[_0x85b8('0x46')]['id'];}return db[_0x85b8('0x26')]['find']({'where':{'id':_0x3be8d9[_0x85b8('0x40')]['id']}})[_0x85b8('0x21')](handleEntityNotFound(_0x31b2ed,null))[_0x85b8('0x21')](saveUpdates(_0x3be8d9[_0x85b8('0x46')],null))[_0x85b8('0x21')](respondWithResult(_0x31b2ed,null))[_0x85b8('0x3e')](handleError(_0x31b2ed,null));};exports['destroy']=function(_0x1b0b71,_0x457aa3){return db['OpenchannelApplication'][_0x85b8('0x44')]({'where':{'id':_0x1b0b71[_0x85b8('0x40')]['id']}})['then'](handleEntityNotFound(_0x457aa3,null))[_0x85b8('0x21')](removeEntity(_0x457aa3,null))[_0x85b8('0x3e')](handleError(_0x457aa3,null));}; \ No newline at end of file +var _0xc183=['options','includeAll','include','findAll','rows','catch','show','keys','fields','find','create','body','params','destroy','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','end','sendStatus','error','name','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','attributes','intersection','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x3afb31,_0x324f2a){var _0x4a0a8b=function(_0x5cf8fc){while(--_0x5cf8fc){_0x3afb31['push'](_0x3afb31['shift']());}};_0x4a0a8b(++_0x324f2a);}(_0xc183,0x1ca));var _0x3c18=function(_0x256269,_0x21b246){_0x256269=_0x256269-0x0;var _0x236504=_0xc183[_0x256269];return _0x236504;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c18('0x0'));var zipdir=require(_0x3c18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c18('0x2'));var moment=require('moment');var BPromise=require(_0x3c18('0x3'));var Mustache=require(_0x3c18('0x4'));var util=require(_0x3c18('0x5'));var path=require('path');var sox=require(_0x3c18('0x6'));var csv=require(_0x3c18('0x7'));var ejs=require(_0x3c18('0x8'));var fs=require('fs');var fs_extra=require(_0x3c18('0x9'));var _=require(_0x3c18('0xa'));var squel=require(_0x3c18('0xb'));var crypto=require(_0x3c18('0xc'));var jsforce=require(_0x3c18('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3c18('0x7'));var querystring=require('querystring');var Papa=require(_0x3c18('0xe'));var Redis=require(_0x3c18('0xf'));var authService=require(_0x3c18('0x10'));var qs=require(_0x3c18('0x11'));var as=require(_0x3c18('0x12'));var hardwareService=require(_0x3c18('0x13'));var logger=require('../../config/logger')(_0x3c18('0x14'));var utils=require(_0x3c18('0x15'));var config=require(_0x3c18('0x16'));var licenseUtil=require(_0x3c18('0x17'));var db=require(_0x3c18('0x18'))['db'];function respondWithStatusCode(_0x3a8782,_0x377ebf){_0x377ebf=_0x377ebf||0xcc;return function(_0x4e0656){if(_0x4e0656){return _0x3a8782['sendStatus'](_0x377ebf);}return _0x3a8782[_0x3c18('0x19')](_0x377ebf)['end']();};}function respondWithResult(_0x28abbe,_0x2694cb){_0x2694cb=_0x2694cb||0xc8;return function(_0x51a5f7){if(_0x51a5f7){return _0x28abbe[_0x3c18('0x19')](_0x2694cb)[_0x3c18('0x1a')](_0x51a5f7);}};}function respondWithFilteredResult(_0x1cab2f,_0x535afb){return function(_0xd1863){if(_0xd1863){var _0x2ff93d=typeof _0x535afb[_0x3c18('0x1b')]===_0x3c18('0x1c')&&typeof _0x535afb['limit']===_0x3c18('0x1c');var _0x281373=_0xd1863[_0x3c18('0x1d')];var _0x2505e0=_0x2ff93d?0x0:_0x535afb[_0x3c18('0x1b')];var _0x11bc4b=_0x2ff93d?_0xd1863[_0x3c18('0x1d')]:_0x535afb[_0x3c18('0x1b')]+_0x535afb['limit'];var _0x37789a;if(_0x11bc4b>=_0x281373){_0x11bc4b=_0x281373;_0x37789a=0xc8;}else{_0x37789a=0xce;}_0x1cab2f[_0x3c18('0x19')](_0x37789a);return _0x1cab2f[_0x3c18('0x1e')](_0x3c18('0x1f'),_0x2505e0+'-'+_0x11bc4b+'/'+_0x281373)[_0x3c18('0x1a')](_0xd1863);}return null;};}function patchUpdates(_0x5928c7){return function(_0x34ce3b){try{jsonpatch[_0x3c18('0x20')](_0x34ce3b,_0x5928c7,!![]);}catch(_0x2e139e){return BPromise['reject'](_0x2e139e);}return _0x34ce3b[_0x3c18('0x21')]();};}function saveUpdates(_0x461f9,_0xdd8f7c){return function(_0xc8634f){if(_0xc8634f){return _0xc8634f[_0x3c18('0x22')](_0x461f9)[_0x3c18('0x23')](function(_0x2a77e6){return _0x2a77e6;});}return null;};}function removeEntity(_0x36fa18,_0x33b74e){return function(_0xbd5819){if(_0xbd5819){return _0xbd5819['destroy']()[_0x3c18('0x23')](function(){_0x36fa18['status'](0xcc)[_0x3c18('0x24')]();});}};}function handleEntityNotFound(_0x587a0f,_0x48bb66){return function(_0x5e4e38){if(!_0x5e4e38){_0x587a0f[_0x3c18('0x25')](0x194);}return _0x5e4e38;};}function handleError(_0x2b86bb,_0xe5a7ed){_0xe5a7ed=_0xe5a7ed||0x1f4;return function(_0x1013ee){logger[_0x3c18('0x26')](_0x1013ee['stack']);if(_0x1013ee[_0x3c18('0x27')]){delete _0x1013ee['name'];}_0x2b86bb[_0x3c18('0x19')](_0xe5a7ed)['send'](_0x1013ee);};}exports[_0x3c18('0x28')]=function(_0x2ef8a8,_0x2d4652){var _0x2230b4={},_0x5a9687={},_0x8b872e={'count':0x0,'rows':[]};var _0x49931d=_[_0x3c18('0x29')](db[_0x3c18('0x2a')][_0x3c18('0x2b')],function(_0x5a4814){return{'name':_0x5a4814['fieldName'],'type':_0x5a4814[_0x3c18('0x2c')][_0x3c18('0x2d')]};});_0x5a9687[_0x3c18('0x2e')]=_['map'](_0x49931d,_0x3c18('0x27'));_0x5a9687['query']=_['keys'](_0x2ef8a8[_0x3c18('0x2f')]);_0x5a9687['filters']=_['intersection'](_0x5a9687['model'],_0x5a9687[_0x3c18('0x2f')]);_0x2230b4[_0x3c18('0x30')]=_[_0x3c18('0x31')](_0x5a9687['model'],qs['fields'](_0x2ef8a8[_0x3c18('0x2f')]['fields']));_0x2230b4[_0x3c18('0x30')]=_0x2230b4['attributes'][_0x3c18('0x32')]?_0x2230b4[_0x3c18('0x30')]:_0x5a9687['model'];if(!_0x2ef8a8[_0x3c18('0x2f')][_0x3c18('0x33')]('nolimit')){_0x2230b4['limit']=qs[_0x3c18('0x34')](_0x2ef8a8[_0x3c18('0x2f')]['limit']);_0x2230b4['offset']=qs[_0x3c18('0x1b')](_0x2ef8a8[_0x3c18('0x2f')]['offset']);}_0x2230b4[_0x3c18('0x35')]=qs[_0x3c18('0x36')](_0x2ef8a8[_0x3c18('0x2f')]['sort']);_0x2230b4[_0x3c18('0x37')]=qs[_0x3c18('0x38')](_['pick'](_0x2ef8a8[_0x3c18('0x2f')],_0x5a9687[_0x3c18('0x38')]),_0x49931d);if(_0x2ef8a8[_0x3c18('0x2f')][_0x3c18('0x39')]){_0x2230b4[_0x3c18('0x37')]=_[_0x3c18('0x3a')](_0x2230b4[_0x3c18('0x37')],{'$or':_[_0x3c18('0x29')](_0x49931d,function(_0x2ea0d){if(_0x2ea0d[_0x3c18('0x2c')]!==_0x3c18('0x3b')){var _0x408bbd={};_0x408bbd[_0x2ea0d[_0x3c18('0x27')]]={'$like':'%'+_0x2ef8a8['query'][_0x3c18('0x39')]+'%'};return _0x408bbd;}})});}_0x2230b4=_[_0x3c18('0x3a')]({},_0x2230b4,_0x2ef8a8[_0x3c18('0x3c')]);var _0x5bb6fb={'where':_0x2230b4[_0x3c18('0x37')]};return db[_0x3c18('0x2a')][_0x3c18('0x1d')](_0x5bb6fb)['then'](function(_0x84efc9){_0x8b872e[_0x3c18('0x1d')]=_0x84efc9;if(_0x2ef8a8[_0x3c18('0x2f')][_0x3c18('0x3d')]){_0x2230b4[_0x3c18('0x3e')]=[{'all':!![]}];}return db[_0x3c18('0x2a')][_0x3c18('0x3f')](_0x2230b4);})['then'](function(_0x4e4a2d){_0x8b872e[_0x3c18('0x40')]=_0x4e4a2d;return _0x8b872e;})[_0x3c18('0x23')](respondWithFilteredResult(_0x2d4652,_0x2230b4))[_0x3c18('0x41')](handleError(_0x2d4652,null));};exports[_0x3c18('0x42')]=function(_0x1bc861,_0xa1f8a8){var _0x3d18ae={'raw':!![],'where':{'id':_0x1bc861['params']['id']}},_0xaee3={};_0xaee3[_0x3c18('0x2e')]=_[_0x3c18('0x43')](db[_0x3c18('0x2a')]['rawAttributes']);_0xaee3['query']=_[_0x3c18('0x43')](_0x1bc861[_0x3c18('0x2f')]);_0xaee3[_0x3c18('0x38')]=_[_0x3c18('0x31')](_0xaee3['model'],_0xaee3[_0x3c18('0x2f')]);_0x3d18ae[_0x3c18('0x30')]=_[_0x3c18('0x31')](_0xaee3[_0x3c18('0x2e')],qs['fields'](_0x1bc861[_0x3c18('0x2f')][_0x3c18('0x44')]));_0x3d18ae['attributes']=_0x3d18ae[_0x3c18('0x30')][_0x3c18('0x32')]?_0x3d18ae['attributes']:_0xaee3[_0x3c18('0x2e')];if(_0x1bc861['query']['includeAll']){_0x3d18ae['include']=[{'all':!![]}];}_0x3d18ae=_[_0x3c18('0x3a')]({},_0x3d18ae,_0x1bc861[_0x3c18('0x3c')]);return db[_0x3c18('0x2a')][_0x3c18('0x45')](_0x3d18ae)['then'](handleEntityNotFound(_0xa1f8a8,null))[_0x3c18('0x23')](respondWithResult(_0xa1f8a8,null))['catch'](handleError(_0xa1f8a8,null));};exports[_0x3c18('0x46')]=function(_0x15094a,_0x508f49){return db['OpenchannelApplication'][_0x3c18('0x46')](_0x15094a[_0x3c18('0x47')],{})['then'](respondWithResult(_0x508f49,0xc9))['catch'](handleError(_0x508f49,null));};exports[_0x3c18('0x22')]=function(_0x1bc83f,_0x46c014){if(_0x1bc83f[_0x3c18('0x47')]['id']){delete _0x1bc83f['body']['id'];}return db[_0x3c18('0x2a')][_0x3c18('0x45')]({'where':{'id':_0x1bc83f[_0x3c18('0x48')]['id']}})[_0x3c18('0x23')](handleEntityNotFound(_0x46c014,null))[_0x3c18('0x23')](saveUpdates(_0x1bc83f[_0x3c18('0x47')],null))[_0x3c18('0x23')](respondWithResult(_0x46c014,null))[_0x3c18('0x41')](handleError(_0x46c014,null));};exports[_0x3c18('0x49')]=function(_0xe03d68,_0x544a04){return db['OpenchannelApplication'][_0x3c18('0x45')]({'where':{'id':_0xe03d68[_0x3c18('0x48')]['id']}})[_0x3c18('0x23')](handleEntityNotFound(_0x544a04,null))[_0x3c18('0x23')](removeEntity(_0x544a04,null))[_0x3c18('0x41')](handleError(_0x544a04,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0d05fad..7e81ba6 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 _0xa219=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication'];(function(_0x486970,_0x3da57d){var _0x5aec14=function(_0x4e84ac){while(--_0x4e84ac){_0x486970['push'](_0x486970['shift']());}};_0x5aec14(++_0x3da57d);}(_0xa219,0x1a5));var _0x9a21=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xa219[_0x308213];return _0x2e1619;};'use strict';var _=require(_0x9a21('0x0'));var util=require(_0x9a21('0x1'));var logger=require(_0x9a21('0x2'))(_0x9a21('0x3'));var moment=require(_0x9a21('0x4'));var BPromise=require(_0x9a21('0x5'));var rp=require(_0x9a21('0x6'));var fs=require('fs');var path=require(_0x9a21('0x7'));var rimraf=require(_0x9a21('0x8'));var config=require(_0x9a21('0x9'));var attributes=require(_0x9a21('0xa'));module[_0x9a21('0xb')]=function(_0x4ca100,_0x183568){return _0x4ca100[_0x9a21('0xc')](_0x9a21('0xd'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9a21('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6b6c=['bluebird','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','api','moment'];(function(_0x419074,_0x1110b9){var _0x262df1=function(_0x2f7712){while(--_0x2f7712){_0x419074['push'](_0x419074['shift']());}};_0x262df1(++_0x1110b9);}(_0x6b6c,0xb2));var _0xc6b6=function(_0xc93ba2,_0x39a69f){_0xc93ba2=_0xc93ba2-0x0;var _0x4bdd64=_0x6b6c[_0xc93ba2];return _0x4bdd64;};'use strict';var _=require(_0xc6b6('0x0'));var util=require(_0xc6b6('0x1'));var logger=require('../../config/logger')(_0xc6b6('0x2'));var moment=require(_0xc6b6('0x3'));var BPromise=require(_0xc6b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6b6('0x5'));var rimraf=require('rimraf');var config=require(_0xc6b6('0x6'));var attributes=require(_0xc6b6('0x7'));module[_0xc6b6('0x8')]=function(_0x37e6e5,_0x5b38d5){return _0x37e6e5[_0xc6b6('0x9')](_0xc6b6('0xa'),attributes,{'tableName':_0xc6b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc6b6('0xc'),'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 9810dbf..4c86e40 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 _0xa0fc=['raw','where','then','UpdateOpenchannelApplication','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','OpenchannelApplication','update','body','options'];(function(_0x43316d,_0x5ebd8f){var _0x52d343=function(_0x231e52){while(--_0x231e52){_0x43316d['push'](_0x43316d['shift']());}};_0x52d343(++_0x5ebd8f);}(_0xa0fc,0x1f1));var _0xca0f=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xa0fc[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xca0f('0x0'));var BPromise=require(_0xca0f('0x1'));var rs=require(_0xca0f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca0f('0x3'))['db'];var utils=require(_0xca0f('0x4'));var logger=require(_0xca0f('0x5'))(_0xca0f('0x6'));var config=require(_0xca0f('0x7'));var jayson=require(_0xca0f('0x8'));var client=jayson[_0xca0f('0x9')][_0xca0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18966f,_0x4a5380,_0x35718f){return new BPromise(function(_0x391de5,_0x4f775f){return client['request'](_0x18966f,_0x35718f)['then'](function(_0x4c7326){logger[_0xca0f('0xb')](_0xca0f('0xc'),_0x4a5380,'request\x20sent');logger[_0xca0f('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x4a5380,_0xca0f('0xe'),JSON[_0xca0f('0xf')](_0x4c7326));if(_0x4c7326['error']){if(_0x4c7326[_0xca0f('0x10')][_0xca0f('0x11')]===0x1f4){logger[_0xca0f('0x10')](_0xca0f('0xc'),_0x4a5380,_0x4c7326[_0xca0f('0x10')]['message']);return _0x4f775f(_0x4c7326[_0xca0f('0x10')][_0xca0f('0x12')]);}logger[_0xca0f('0x10')](_0xca0f('0xc'),_0x4a5380,_0x4c7326['error']['message']);return _0x391de5(_0x4c7326[_0xca0f('0x10')]['message']);}else{logger[_0xca0f('0xb')](_0xca0f('0xc'),_0x4a5380,'request\x20sent');_0x391de5(_0x4c7326[_0xca0f('0x13')][_0xca0f('0x12')]);}})[_0xca0f('0x14')](function(_0x34b102){logger['error'](_0xca0f('0xc'),_0x4a5380,_0x34b102);_0x4f775f(_0x34b102);});});}exports['UpdateOpenchannelApplication']=function(_0x59e041){var _0x3a0935=this;return new Promise(function(_0x472122,_0x58c189){return db[_0xca0f('0x15')][_0xca0f('0x16')](_0x59e041[_0xca0f('0x17')],{'raw':_0x59e041[_0xca0f('0x18')]?_0x59e041[_0xca0f('0x18')][_0xca0f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59e041['options']?_0x59e041['options'][_0xca0f('0x1a')]||null:null,'attributes':_0x59e041['options']?_0x59e041['options']['attributes']||null:null,'limit':_0x59e041[_0xca0f('0x18')]?_0x59e041['options']['limit']||null:null})[_0xca0f('0x1b')](function(_0x1c7190){logger[_0xca0f('0xb')](_0xca0f('0x1c'),_0x59e041);logger['debug'](_0xca0f('0x1c'),_0x59e041,JSON[_0xca0f('0xf')](_0x1c7190));_0x472122(_0x1c7190);})['catch'](function(_0x39ebf3){logger[_0xca0f('0x10')]('UpdateOpenchannelApplication',_0x39ebf3[_0xca0f('0x12')],_0x59e041);_0x58c189(_0x3a0935[_0xca0f('0x10')](0x1f4,_0x39ebf3[_0xca0f('0x12')]));});});}; \ No newline at end of file +var _0x73ad=['code','message','catch','OpenchannelApplication','update','body','options','raw','where','limit','then','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error'];(function(_0x31473e,_0x47f326){var _0x18b209=function(_0xbd158f){while(--_0xbd158f){_0x31473e['push'](_0x31473e['shift']());}};_0x18b209(++_0x47f326);}(_0x73ad,0x1e0));var _0xd73a=function(_0x55cc63,_0x373228){_0x55cc63=_0x55cc63-0x0;var _0x14b538=_0x73ad[_0x55cc63];return _0x14b538;};'use strict';var _=require(_0xd73a('0x0'));var util=require(_0xd73a('0x1'));var moment=require(_0xd73a('0x2'));var BPromise=require(_0xd73a('0x3'));var rs=require(_0xd73a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd73a('0x5'))['db'];var utils=require(_0xd73a('0x6'));var logger=require(_0xd73a('0x7'))('rpc');var config=require(_0xd73a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd73a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebb57,_0x1fcb07,_0x3c1536){return new BPromise(function(_0x158298,_0x358cd3){return client['request'](_0x3ebb57,_0x3c1536)['then'](function(_0x4ed359){logger[_0xd73a('0xa')](_0xd73a('0xb'),_0x1fcb07,_0xd73a('0xc'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1fcb07,'request\x20sent',JSON['stringify'](_0x4ed359));if(_0x4ed359[_0xd73a('0xd')]){if(_0x4ed359[_0xd73a('0xd')][_0xd73a('0xe')]===0x1f4){logger['error'](_0xd73a('0xb'),_0x1fcb07,_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);return _0x358cd3(_0x4ed359['error']['message']);}logger[_0xd73a('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x1fcb07,_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);return _0x158298(_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);}else{logger['info'](_0xd73a('0xb'),_0x1fcb07,'request\x20sent');_0x158298(_0x4ed359['result']['message']);}})[_0xd73a('0x10')](function(_0x39339f){logger[_0xd73a('0xd')](_0xd73a('0xb'),_0x1fcb07,_0x39339f);_0x358cd3(_0x39339f);});});}exports['UpdateOpenchannelApplication']=function(_0x423ef7){var _0x17c5fd=this;return new Promise(function(_0x1f977d,_0x28b800){return db[_0xd73a('0x11')][_0xd73a('0x12')](_0x423ef7[_0xd73a('0x13')],{'raw':_0x423ef7[_0xd73a('0x14')]?_0x423ef7[_0xd73a('0x14')][_0xd73a('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x423ef7[_0xd73a('0x14')]?_0x423ef7['options'][_0xd73a('0x16')]||null:null,'attributes':_0x423ef7[_0xd73a('0x14')]?_0x423ef7[_0xd73a('0x14')]['attributes']||null:null,'limit':_0x423ef7['options']?_0x423ef7[_0xd73a('0x14')][_0xd73a('0x17')]||null:null})[_0xd73a('0x18')](function(_0x475cda){logger[_0xd73a('0xa')](_0xd73a('0x19'),_0x423ef7);logger['debug'](_0xd73a('0x19'),_0x423ef7,JSON['stringify'](_0x475cda));_0x1f977d(_0x475cda);})[_0xd73a('0x10')](function(_0x46d17a){logger[_0xd73a('0xd')](_0xd73a('0x19'),_0x46d17a[_0xd73a('0xf')],_0x423ef7);_0x28b800(_0x17c5fd['error'](0x1f4,_0x46d17a[_0xd73a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a76e193..c768700 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 _0xd5f4=['/:id/messages','getMessages','/:id/download','post','/:id/tags','openchannelinteraction:addtags','addTags','put','/:id','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','removeTags','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0xd5f4,0x11d));var _0x4d5f=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd5f4[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0x4d5f('0x0'));var util=require('util');var path=require(_0x4d5f('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d5f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4d5f('0x3'));var interaction=require(_0x4d5f('0x4'));var config=require(_0x4d5f('0x5'));var controller=require('./openchannelInteraction.controller');router[_0x4d5f('0x6')]('/',auth['isAuthenticated'](),controller[_0x4d5f('0x7')]);router[_0x4d5f('0x6')](_0x4d5f('0x8'),auth[_0x4d5f('0x9')](),controller[_0x4d5f('0xa')]);router[_0x4d5f('0x6')]('/:id',auth[_0x4d5f('0x9')](),controller[_0x4d5f('0xb')]);router[_0x4d5f('0x6')](_0x4d5f('0xc'),auth[_0x4d5f('0x9')](),controller[_0x4d5f('0xd')]);router[_0x4d5f('0x6')](_0x4d5f('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x4d5f('0xf')]('/',auth[_0x4d5f('0x9')](),controller['create']);router[_0x4d5f('0xf')](_0x4d5f('0xc'),auth[_0x4d5f('0x9')](),controller['addMessage']);router[_0x4d5f('0xf')](_0x4d5f('0x10'),auth[_0x4d5f('0x9')](),interaction['tracked']('openchannel',_0x4d5f('0x11')),controller[_0x4d5f('0x12')]);router[_0x4d5f('0x13')](_0x4d5f('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x4d5f('0x15'),_0x4d5f('0x16')),controller[_0x4d5f('0x17')]);router['delete']('/:id',auth[_0x4d5f('0x9')](),interaction['tracked'](_0x4d5f('0x15'),_0x4d5f('0x18')),controller[_0x4d5f('0x19')]);router['delete']('/:id/tags',auth[_0x4d5f('0x9')](),controller[_0x4d5f('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x6f5b=['isAuthenticated','show','/:id/messages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','/:id'];(function(_0x46399a,_0x108f44){var _0x3f97ca=function(_0xb8ca74){while(--_0xb8ca74){_0x46399a['push'](_0x46399a['shift']());}};_0x3f97ca(++_0x108f44);}(_0x6f5b,0x1a0));var _0xb6f5=function(_0x481265,_0x48b98a){_0x481265=_0x481265-0x0;var _0x56b5c4=_0x6f5b[_0x481265];return _0x56b5c4;};'use strict';var multer=require(_0xb6f5('0x0'));var util=require(_0xb6f5('0x1'));var path=require(_0xb6f5('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6f5('0x3'));var router=express['Router']();var fs_extra=require(_0xb6f5('0x4'));var auth=require(_0xb6f5('0x5'));var interaction=require(_0xb6f5('0x6'));var config=require(_0xb6f5('0x7'));var controller=require(_0xb6f5('0x8'));router[_0xb6f5('0x9')]('/',auth['isAuthenticated'](),controller[_0xb6f5('0xa')]);router['get'](_0xb6f5('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb6f5('0xc'),auth[_0xb6f5('0xd')](),controller[_0xb6f5('0xe')]);router[_0xb6f5('0x9')](_0xb6f5('0xf'),auth[_0xb6f5('0xd')](),controller['getMessages']);router[_0xb6f5('0x9')](_0xb6f5('0x10'),auth[_0xb6f5('0xd')](),controller[_0xb6f5('0x11')]);router[_0xb6f5('0x12')]('/',auth[_0xb6f5('0xd')](),controller[_0xb6f5('0x13')]);router['post'](_0xb6f5('0xf'),auth[_0xb6f5('0xd')](),controller[_0xb6f5('0x14')]);router[_0xb6f5('0x12')]('/:id/tags',auth[_0xb6f5('0xd')](),interaction['tracked'](_0xb6f5('0x15'),_0xb6f5('0x16')),controller[_0xb6f5('0x17')]);router[_0xb6f5('0x18')](_0xb6f5('0xc'),auth[_0xb6f5('0xd')](),interaction[_0xb6f5('0x19')](_0xb6f5('0x15'),_0xb6f5('0x1a')),controller[_0xb6f5('0x1b')]);router[_0xb6f5('0x1c')](_0xb6f5('0xc'),auth[_0xb6f5('0xd')](),interaction[_0xb6f5('0x19')](_0xb6f5('0x15'),_0xb6f5('0x1d')),controller[_0xb6f5('0x1e')]);router[_0xb6f5('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0xb6f5('0x1f')]);module[_0xb6f5('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 8dd85ad..86b7659 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 _0xf6fb=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x2f374a,_0x51448b){var _0x21f07a=function(_0x326bdc){while(--_0x326bdc){_0x2f374a['push'](_0x2f374a['shift']());}};_0x21f07a(++_0x51448b);}(_0xf6fb,0x111));var _0xbf6f=function(_0x20ddfa,_0x288ed2){_0x20ddfa=_0x20ddfa-0x0;var _0x3956f7=_0xf6fb[_0x20ddfa];return _0x3956f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xbf6f('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbf6f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbf6f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xbf6f('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbf6f('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xbf6f('0x2')]},'lastMsgAt':{'type':Sequelize[_0xbf6f('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xbf6f('0x3')]('in',_0xbf6f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xbf6f('0x3')]('in',_0xbf6f('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbf6f('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xbf6f('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x50a8=['sequelize','STRING','DATE','ENUM','out','BOOLEAN'];(function(_0x4eceae,_0x5b643d){var _0x1a8fec=function(_0x3692ce){while(--_0x3692ce){_0x4eceae['push'](_0x4eceae['shift']());}};_0x1a8fec(++_0x5b643d);}(_0x50a8,0x198));var _0x850a=function(_0x12d013,_0x286e4c){_0x12d013=_0x12d013-0x0;var _0x54220c=_0x50a8[_0x12d013];return _0x54220c;};'use strict';var Sequelize=require(_0x850a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x850a('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x850a('0x1')]},'note':{'type':Sequelize[_0x850a('0x1')]},'read1stAt':{'type':Sequelize[_0x850a('0x2')]},'threadId':{'type':Sequelize[_0x850a('0x1')]},'externalUrl':{'type':Sequelize[_0x850a('0x1')]},'lastMsgAt':{'type':Sequelize[_0x850a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x850a('0x3')]('in',_0x850a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x850a('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x850a('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 4bc5007..2e71f23 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 _0x8e54=['create','body','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','nolimit','order','sort','where','OpenchannelInteractionId','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','server','tmp','root','files','attachments','format','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','createdAt','closed','closedAt','disposition','Public','Private','Messages','createReadStream','pipe','basename','out','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','stack','name','map','OpenchannelInteraction','type','key','findAll','catch','show','query','from','params','model','rawAttributes','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8e54,0x146));var _0x48e5=function(_0xd600,_0x8d055e){_0xd600=_0xd600-0x0;var _0x3c8245=_0x8e54[_0xd600];return _0x3c8245;};'use strict';var rimraf=require(_0x48e5('0x0'));var zipdir=require(_0x48e5('0x1'));var moment=require(_0x48e5('0x2'));var util=require(_0x48e5('0x3'));var path=require('path');var ejs=require(_0x48e5('0x4'));var fs=require('fs');var _=require(_0x48e5('0x5'));var Redis=require(_0x48e5('0x6'));var interaction=require(_0x48e5('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x48e5('0x8'));var logger=require(_0x48e5('0x9'))(_0x48e5('0xa'));var config=require(_0x48e5('0xb'));var db=require(_0x48e5('0xc'))['db'];config['redis']=_['defaults'](config[_0x48e5('0xd')],{'host':_0x48e5('0xe'),'port':0x18eb});var socket=require(_0x48e5('0xf'))(new Redis(config[_0x48e5('0xd')]));require(_0x48e5('0x10'))[_0x48e5('0x11')](socket);function respondWithStatusCode(_0x4de5d2,_0x41060c){_0x41060c=_0x41060c||0xcc;return function(_0x2632a4){if(_0x2632a4){return _0x4de5d2[_0x48e5('0x12')](_0x41060c);}return _0x4de5d2[_0x48e5('0x13')](_0x41060c)[_0x48e5('0x14')]();};}function respondWithResult(_0x2af7aa,_0x25e01a){_0x25e01a=_0x25e01a||0xc8;return function(_0x1b8194){if(_0x1b8194){return _0x2af7aa[_0x48e5('0x13')](_0x25e01a)[_0x48e5('0x15')](_0x1b8194);}};}function respondWithFilteredResult(_0x31c8e6,_0x57fd05){return function(_0x5b0d4e){if(_0x5b0d4e){var _0x19b479=typeof _0x57fd05[_0x48e5('0x16')]===_0x48e5('0x17')&&typeof _0x57fd05[_0x48e5('0x18')]===_0x48e5('0x17');var _0x5bcec8=_0x5b0d4e[_0x48e5('0x19')];var _0x5041b9=_0x19b479?0x0:_0x57fd05[_0x48e5('0x16')];var _0x416628=_0x19b479?_0x5b0d4e[_0x48e5('0x19')]:_0x57fd05[_0x48e5('0x16')]+_0x57fd05['limit'];var _0x4f8c87;if(_0x416628>=_0x5bcec8){_0x416628=_0x5bcec8;_0x4f8c87=0xc8;}else{_0x4f8c87=0xce;}_0x31c8e6[_0x48e5('0x13')](_0x4f8c87);return _0x31c8e6[_0x48e5('0x1a')](_0x48e5('0x1b'),_0x5041b9+'-'+_0x416628+'/'+_0x5bcec8)[_0x48e5('0x15')](_0x5b0d4e);}return null;};}function saveUpdates(_0x13ef03){return function(_0x37eba7){if(_0x37eba7){return _0x37eba7[_0x48e5('0x1c')](_0x13ef03)['then'](function(_0x20f53d){return _0x20f53d;});}return null;};}function removeEntity(_0x5eedb4){return function(_0x326a42){if(_0x326a42){return _0x326a42[_0x48e5('0x1d')]()[_0x48e5('0x1e')](function(){_0x5eedb4[_0x48e5('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fb3b){return function(_0x121670){if(!_0x121670){_0x31fb3b[_0x48e5('0x12')](0x194);}return _0x121670;};}function handleError(_0x38d03e,_0x2ed4e3){_0x2ed4e3=_0x2ed4e3||0x1f4;return function(_0x262671){logger['error'](_0x262671[_0x48e5('0x1f')]);if(_0x262671['name']){delete _0x262671[_0x48e5('0x20')];}_0x38d03e['status'](_0x2ed4e3)['send'](_0x262671);};}exports['index']=function(_0x50c2d0,_0x2aabc6){var _0xb2973a={};var _0x1a077a=_[_0x48e5('0x21')](db[_0x48e5('0x22')]['rawAttributes'],function(_0x55ae56){return{'name':_0x55ae56['fieldName'],'type':_0x55ae56[_0x48e5('0x23')][_0x48e5('0x24')]};});_0xb2973a=qs['getOptions'](_0x1a077a,_0x50c2d0);return interaction[_0x48e5('0x25')]('openchannel',_0x50c2d0['query'],_0x50c2d0['user'],_0xb2973a,_0x1a077a)[_0x48e5('0x1e')](respondWithFilteredResult(_0x2aabc6,_0xb2973a))[_0x48e5('0x26')](handleError(_0x2aabc6,null));};exports[_0x48e5('0x27')]=function(_0x6f2133,_0x33e84b){var _0x10e042={};if(_0x6f2133['query'][_0x48e5('0x23')]&&_0x6f2133[_0x48e5('0x28')][_0x48e5('0x23')]===_0x48e5('0x29')){_0x10e042[_0x48e5('0x29')]=_0x6f2133[_0x48e5('0x2a')]['id'];}else{_0x10e042['id']=_0x6f2133['params']['id'];}var _0x4a947d={'raw':![],'where':_0x10e042},_0x2bc65e={};_0x2bc65e[_0x48e5('0x2b')]=_['keys'](db[_0x48e5('0x22')][_0x48e5('0x2c')]);_0x2bc65e[_0x48e5('0x28')]=_[_0x48e5('0x2d')](_0x6f2133[_0x48e5('0x28')]);_0x2bc65e[_0x48e5('0x2e')]=_[_0x48e5('0x2f')](_0x2bc65e['model'],_0x2bc65e['query']);_0x4a947d[_0x48e5('0x30')]=_[_0x48e5('0x2f')](_0x2bc65e[_0x48e5('0x2b')],qs[_0x48e5('0x31')](_0x6f2133[_0x48e5('0x28')][_0x48e5('0x31')]));_0x4a947d[_0x48e5('0x30')]=_0x4a947d[_0x48e5('0x30')][_0x48e5('0x32')]?_0x4a947d[_0x48e5('0x30')]:_0x2bc65e[_0x48e5('0x2b')];if(_0x6f2133[_0x48e5('0x28')][_0x48e5('0x33')]){_0x4a947d[_0x48e5('0x34')]=[{'all':!![]}];}_0x4a947d=_['merge']({},_0x4a947d,_0x6f2133[_0x48e5('0x35')]);return db[_0x48e5('0x22')][_0x48e5('0x36')](_0x4a947d)[_0x48e5('0x1e')](handleEntityNotFound(_0x33e84b,null))['then'](respondWithResult(_0x33e84b,null))[_0x48e5('0x26')](handleError(_0x33e84b,null));};exports[_0x48e5('0x37')]=function(_0x4d8ee7,_0x1038a0){return db[_0x48e5('0x22')][_0x48e5('0x37')](_0x4d8ee7[_0x48e5('0x38')],{})[_0x48e5('0x1e')](respondWithResult(_0x1038a0,0xc9))[_0x48e5('0x26')](handleError(_0x1038a0,null));};exports['update']=function(_0x32b9b7,_0x370aa1){if(_0x32b9b7['body']['id']){delete _0x32b9b7['body']['id'];}return db[_0x48e5('0x22')][_0x48e5('0x36')]({'where':{'id':_0x32b9b7['params']['id']}})[_0x48e5('0x1e')](handleEntityNotFound(_0x370aa1,null))['then'](saveUpdates(_0x32b9b7[_0x48e5('0x38')],null))[_0x48e5('0x1e')](respondWithResult(_0x370aa1,null))[_0x48e5('0x26')](handleError(_0x370aa1,null));};exports[_0x48e5('0x1d')]=function(_0x4f4adb,_0x433da8){return db[_0x48e5('0x22')][_0x48e5('0x36')]({'where':{'id':_0x4f4adb['params']['id']}})[_0x48e5('0x1e')](handleEntityNotFound(_0x433da8,null))[_0x48e5('0x1e')](removeEntity(_0x433da8,null))['catch'](handleError(_0x433da8,null));};exports[_0x48e5('0x39')]=function(_0x36e289,_0xbc949){return db[_0x48e5('0x22')][_0x48e5('0x39')]()[_0x48e5('0x1e')](respondWithResult(_0xbc949,null))[_0x48e5('0x26')](handleError(_0xbc949,null));};exports[_0x48e5('0x3a')]=function(_0x1cab3d,_0x52e23e){return db['OpenchannelMessage']['find']({'where':{'id':_0x1cab3d[_0x48e5('0x2a')]['id']}})[_0x48e5('0x1e')](handleEntityNotFound(_0x52e23e,null))[_0x48e5('0x1e')](function(_0x20843a){if(_0x20843a){return _0x20843a['addMessage'](_0x1cab3d[_0x48e5('0x38')]['ids'],_[_0x48e5('0x3b')](_0x1cab3d[_0x48e5('0x38')],[_0x48e5('0x3c'),'id'])||{});}})[_0x48e5('0x1e')](respondWithResult(_0x52e23e,null))[_0x48e5('0x26')](handleError(_0x52e23e,null));};exports[_0x48e5('0x3d')]=function(_0x116164,_0x490823){var _0x200eae={'raw':![],'where':{}};var _0x1aeb1d={};var _0x5dc3c0={'count':0x0,'rows':[]};return db[_0x48e5('0x22')][_0x48e5('0x3e')]({'where':{'id':_0x116164[_0x48e5('0x2a')]['id']}})[_0x48e5('0x1e')](handleEntityNotFound(_0x490823,null))['then'](function(_0x1243c6){if(_0x1243c6){_0x1aeb1d[_0x48e5('0x2b')]=_[_0x48e5('0x2d')](db[_0x48e5('0x3f')][_0x48e5('0x2c')]);_0x1aeb1d[_0x48e5('0x28')]=_[_0x48e5('0x2d')](_0x116164['query']);_0x1aeb1d[_0x48e5('0x2e')]=_[_0x48e5('0x2f')](_0x1aeb1d[_0x48e5('0x2b')],_0x1aeb1d[_0x48e5('0x28')]);_0x200eae[_0x48e5('0x30')]=_[_0x48e5('0x2f')](_0x1aeb1d[_0x48e5('0x2b')],qs[_0x48e5('0x31')](_0x116164[_0x48e5('0x28')][_0x48e5('0x31')]));_0x200eae[_0x48e5('0x30')]=_0x200eae[_0x48e5('0x30')]['length']?_0x200eae[_0x48e5('0x30')]:_0x1aeb1d[_0x48e5('0x2b')];if(!_0x116164['query']['hasOwnProperty'](_0x48e5('0x40'))){_0x200eae['limit']=qs[_0x48e5('0x18')](_0x116164[_0x48e5('0x28')]['limit']);_0x200eae['offset']=qs[_0x48e5('0x16')](_0x116164[_0x48e5('0x28')]['offset']);}_0x200eae[_0x48e5('0x41')]=qs[_0x48e5('0x42')](_0x116164[_0x48e5('0x28')][_0x48e5('0x42')]);_0x200eae[_0x48e5('0x43')]=qs[_0x48e5('0x2e')](_['pick'](_0x116164[_0x48e5('0x28')],_0x1aeb1d['filters']));_0x200eae[_0x48e5('0x43')][_0x48e5('0x44')]=_0x1243c6['id'];if(_0x116164[_0x48e5('0x28')]['filter']){_0x200eae[_0x48e5('0x43')]=_[_0x48e5('0x45')](_0x200eae['where'],{'$or':_[_0x48e5('0x21')](_0x200eae['attributes'],function(_0x3c6a0b){var _0x47d44a={};_0x47d44a[_0x3c6a0b]={'$like':'%'+_0x116164['query'][_0x48e5('0x46')]+'%'};return _0x47d44a;})});}if(_0x116164['query']['$gte']){var _0x36c63b=_0x116164['query'][_0x48e5('0x47')][_0x48e5('0x48')](',');var _0x3f86dd={};_0x3f86dd[_0x36c63b[0x0]]={'$gte':moment(_0x36c63b[0x1])['format'](_0x48e5('0x49'))};_0x200eae[_0x48e5('0x43')]=_[_0x48e5('0x45')](_0x200eae['where'],_0x3f86dd);}_0x200eae=_[_0x48e5('0x45')]({},_0x200eae,_0x116164[_0x48e5('0x35')]);return db['OpenchannelMessage'][_0x48e5('0x19')]({'where':_0x200eae[_0x48e5('0x43')]})['then'](function(_0x109836){_0x5dc3c0['count']=_0x109836;if(_0x116164[_0x48e5('0x28')][_0x48e5('0x33')]){_0x200eae[_0x48e5('0x34')]=[{'all':!![]}];}return db[_0x48e5('0x3f')][_0x48e5('0x25')](_0x200eae);})[_0x48e5('0x1e')](function(_0x9f725f){_0x5dc3c0[_0x48e5('0x4a')]=_0x9f725f;return _0x5dc3c0;});}})['then'](respondWithFilteredResult(_0x490823,_0x200eae))[_0x48e5('0x26')](handleError(_0x490823,null));};exports[_0x48e5('0x4b')]=function(_0x35b41b,_0x4ebb2f){return db['OpenchannelInteraction'][_0x48e5('0x36')]({'where':{'id':_0x35b41b[_0x48e5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4ebb2f,null))[_0x48e5('0x1e')](function(_0x2e30d4){if(_0x2e30d4){return _0x2e30d4['setTags'](_0x35b41b[_0x48e5('0x38')][_0x48e5('0x3c')],_[_0x48e5('0x3b')](_0x35b41b[_0x48e5('0x38')],[_0x48e5('0x3c'),'id'])||{})[_0x48e5('0x4c')](function(){return db[_0x48e5('0x4d')]['findAll']({'attributes':['id',_0x48e5('0x20'),_0x48e5('0x4e')],'where':{'id':_0x35b41b[_0x48e5('0x38')][_0x48e5('0x3c')]}});})[_0x48e5('0x1e')](function(_0x103840){socket[_0x48e5('0x4f')](_0x48e5('0x50'),{'id':Number(_0x35b41b['params']['id']),'tags':_0x103840||[]});return{'id':Number(_0x35b41b[_0x48e5('0x2a')]['id']),'tags':_0x103840||[]};});}})[_0x48e5('0x1e')](respondWithResult(_0x4ebb2f,null))['catch'](handleError(_0x4ebb2f,null));};exports[_0x48e5('0x51')]=function(_0x53b069,_0x110414){return db[_0x48e5('0x22')][_0x48e5('0x36')]({'where':{'id':_0x53b069[_0x48e5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x110414,null))['then'](function(_0x129224){if(_0x129224){return _0x129224['removeTags'](_0x53b069[_0x48e5('0x28')][_0x48e5('0x3c')]);}})[_0x48e5('0x1e')](respondWithStatusCode(_0x110414,null))[_0x48e5('0x26')](handleError(_0x110414,null));};exports[_0x48e5('0x52')]=function(_0x313e77,_0x4a13f6){var _0x127ca3=moment()['unix']()[_0x48e5('0x53')]();var _0x217d46=path[_0x48e5('0x54')](config['root'],_0x48e5('0x55'),'files',_0x48e5('0x56'));var _0x26a3a6=path[_0x48e5('0x54')](config[_0x48e5('0x57')],_0x48e5('0x55'),_0x48e5('0x58'),_0x48e5('0x59'));var _0x3a36bc=path[_0x48e5('0x54')](_0x217d46,_0x127ca3);var _0x2b3b84=util[_0x48e5('0x5a')]('transcript-%d-%s.zip',_0x313e77[_0x48e5('0x2a')]['id'],_0x127ca3);var _0xb1cc23=path[_0x48e5('0x54')](_0x217d46,_0x2b3b84);var _0x54abf3=[];_0x54abf3[_0x48e5('0x5b')]({'model':db[_0x48e5('0x5c')],'as':'User','attributes':['id',_0x48e5('0x5d')],'raw':!![]});_0x54abf3[_0x48e5('0x5b')]({'model':db[_0x48e5('0x5e')],'as':_0x48e5('0x5f'),'attributes':['id',_0x48e5('0x60'),_0x48e5('0x61')],'raw':!![]});if(_0x313e77[_0x48e5('0x28')][_0x48e5('0x59')]){_0x54abf3['push']({'model':db[_0x48e5('0x62')],'as':_0x48e5('0x62'),'raw':!![]});}var _0x558688=[{'model':db[_0x48e5('0x3f')],'as':'Messages','attributes':['id',_0x48e5('0x38'),'createdAt',_0x48e5('0x63'),_0x48e5('0x64'),'read'],'include':_0x54abf3}];_0x558688['push']({'model':db[_0x48e5('0x65')],'as':_0x48e5('0x66'),'attributes':['id',_0x48e5('0x20')]});_0x558688['push']({'model':db[_0x48e5('0x5c')],'as':'Owner','attributes':['id',_0x48e5('0x5d')]});return db[_0x48e5('0x22')][_0x48e5('0x36')]({'where':{'id':_0x313e77[_0x48e5('0x2a')]['id']},'include':_0x558688})['then'](handleEntityNotFound(_0x4a13f6,null))[_0x48e5('0x1e')](function(_0x44f3c6){if(_0x44f3c6){var _0x425c70=_0x44f3c6[_0x48e5('0x67')]({'plain':!![]});fs[_0x48e5('0x68')](_0x3a36bc);var _0x82a623={'channel':_0x48e5('0x69'),'account':_0x425c70[_0x48e5('0x66')][_0x48e5('0x20')],'agent':_0x425c70['Owner']?_0x425c70[_0x48e5('0x6a')]['fullname']:'N.A.','createdAt':moment(_0x425c70[_0x48e5('0x6b')])[_0x48e5('0x5a')](_0x48e5('0x49'))[_0x48e5('0x53')](),'closedAt':_0x425c70[_0x48e5('0x6c')]?moment(_0x425c70[_0x48e5('0x6d')])[_0x48e5('0x5a')](_0x48e5('0x49'))['toString']():'','disposition':_0x425c70[_0x48e5('0x6e')],'visibility':_0x425c70['threadId']?_0x48e5('0x6f'):_0x48e5('0x70'),'messages':_(_0x425c70[_0x48e5('0x71')])[_0x48e5('0x46')]({'secret':![]})[_0x48e5('0x21')](function(_0x5695c3){if(_0x5695c3[_0x48e5('0x62')]){var _0x52878a=path[_0x48e5('0x54')](_0x26a3a6,_0x5695c3[_0x48e5('0x62')]['basename']);if(fs['existsSync'](_0x52878a)){fs[_0x48e5('0x72')](_0x52878a)[_0x48e5('0x73')](fs['createWriteStream'](path[_0x48e5('0x54')](_0x3a36bc,_0x5695c3['Attachment'][_0x48e5('0x74')])));}}return{'date':moment(_0x5695c3[_0x48e5('0x6b')])[_0x48e5('0x5a')](_0x48e5('0x49'))[_0x48e5('0x53')](),'sender':_0x5695c3[_0x48e5('0x63')]===_0x48e5('0x75')?_0x5695c3[_0x48e5('0x5c')]?_0x5695c3['User'][_0x48e5('0x5d')]:'System':_0x5695c3['Contact']['firstName']+(_0x5695c3[_0x48e5('0x5f')]['lastName']?'\x20'+_0x5695c3['Contact'][_0x48e5('0x61')]:''),'body':_0x5695c3['Attachment']?_0x5695c3['Attachment'][_0x48e5('0x74')]:_0x5695c3[_0x48e5('0x38')],'direction':_0x5695c3[_0x48e5('0x63')]===_0x48e5('0x75')?'A':'C','secret':_0x5695c3['secret'],'read':_0x5695c3[_0x48e5('0x76')],'attachment':_0x5695c3[_0x48e5('0x62')]};})[_0x48e5('0x77')]()};return ejs[_0x48e5('0x78')](path[_0x48e5('0x54')](config[_0x48e5('0x57')],_0x48e5('0x55'),_0x48e5('0x79'),_0x48e5('0x7a')),{'interaction':_0x82a623})['then'](function(_0x50db9c){var _0x486237=path[_0x48e5('0x54')](_0x3a36bc,'transcript-'+_0x425c70['id']+'-'+_0x127ca3+_0x48e5('0x7b'));var _0x4428bb={'path':_0x486237,'channel':_0x48e5('0x69'),'interactionId':_0x425c70['id']};return pdf[_0x48e5('0x7c')](_0x50db9c,_0x4428bb);})[_0x48e5('0x1e')](function(){return new Promise(function(_0x5704ef,_0x591a6d){zipdir(_0x3a36bc,{'saveTo':_0xb1cc23},function(_0x2ab633,_0x466409){if(_0x2ab633)return _0x591a6d(_0x2ab633);return _0x5704ef(_0x466409);});})[_0x48e5('0x1e')](function(){return new Promise(function(_0x2b9b8b,_0x2539db){rimraf(_0x3a36bc,function(_0x51d591){if(_0x51d591)_0x2539db(_0x51d591);return _0x2b9b8b();});});})['then'](function(){return _0x4a13f6[_0x48e5('0x52')](_0xb1cc23,_0x2b3b84,function(_0xc26dbb){if(_0xc26dbb){logger[_0x48e5('0x7d')](_0x48e5('0x7e'),_0xc26dbb);}else{fs['unlinkSync'](_0xb1cc23);}});});});}else{return _0x4a13f6[_0x48e5('0x12')](0xc8);}})[_0x48e5('0x26')](handleError(_0x4a13f6,null));}; \ No newline at end of file +var _0xd5a5=['OpenchannelMessage','filters','fields','hasOwnProperty','nolimit','limit','OpenchannelInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','files','root','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','createdAt','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','openchannel','user','catch','show','query','from','params','model','keys','intersection','attributes','length','include','merge','create','body','find','destroy','describe','ids','omit','getMessages','findOne'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5a5,0xca));var _0x5d5a=function(_0x353874,_0x2d44e1){_0x353874=_0x353874-0x0;var _0x49a9a5=_0xd5a5[_0x353874];return _0x49a9a5;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5d5a('0x0'));var moment=require(_0x5d5a('0x1'));var util=require(_0x5d5a('0x2'));var path=require(_0x5d5a('0x3'));var ejs=require(_0x5d5a('0x4'));var fs=require('fs');var _=require(_0x5d5a('0x5'));var Redis=require(_0x5d5a('0x6'));var interaction=require(_0x5d5a('0x7'));var qs=require(_0x5d5a('0x8'));var pdf=require(_0x5d5a('0x9'));var logger=require(_0x5d5a('0xa'))(_0x5d5a('0xb'));var config=require('../../config/environment');var db=require(_0x5d5a('0xc'))['db'];config[_0x5d5a('0xd')]=_[_0x5d5a('0xe')](config[_0x5d5a('0xd')],{'host':_0x5d5a('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d5a('0xd')]));require(_0x5d5a('0x10'))[_0x5d5a('0x11')](socket);function respondWithStatusCode(_0x748d9e,_0x45e7d2){_0x45e7d2=_0x45e7d2||0xcc;return function(_0x2a2e00){if(_0x2a2e00){return _0x748d9e[_0x5d5a('0x12')](_0x45e7d2);}return _0x748d9e[_0x5d5a('0x13')](_0x45e7d2)[_0x5d5a('0x14')]();};}function respondWithResult(_0x4fe6cd,_0x28d629){_0x28d629=_0x28d629||0xc8;return function(_0x228717){if(_0x228717){return _0x4fe6cd['status'](_0x28d629)[_0x5d5a('0x15')](_0x228717);}};}function respondWithFilteredResult(_0x48098d,_0x5c249e){return function(_0x27b3a4){if(_0x27b3a4){var _0xa8bee4=typeof _0x5c249e[_0x5d5a('0x16')]==='undefined'&&typeof _0x5c249e['limit']===_0x5d5a('0x17');var _0x384a04=_0x27b3a4[_0x5d5a('0x18')];var _0x40ff6d=_0xa8bee4?0x0:_0x5c249e['offset'];var _0x35957a=_0xa8bee4?_0x27b3a4[_0x5d5a('0x18')]:_0x5c249e[_0x5d5a('0x16')]+_0x5c249e['limit'];var _0x2826ff;if(_0x35957a>=_0x384a04){_0x35957a=_0x384a04;_0x2826ff=0xc8;}else{_0x2826ff=0xce;}_0x48098d[_0x5d5a('0x13')](_0x2826ff);return _0x48098d[_0x5d5a('0x19')](_0x5d5a('0x1a'),_0x40ff6d+'-'+_0x35957a+'/'+_0x384a04)[_0x5d5a('0x15')](_0x27b3a4);}return null;};}function saveUpdates(_0x4049aa){return function(_0x5ed84b){if(_0x5ed84b){return _0x5ed84b[_0x5d5a('0x1b')](_0x4049aa)[_0x5d5a('0x1c')](function(_0x166a29){return _0x166a29;});}return null;};}function removeEntity(_0x13e0f4){return function(_0x200d02){if(_0x200d02){return _0x200d02['destroy']()[_0x5d5a('0x1c')](function(){_0x13e0f4[_0x5d5a('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb52ee3){return function(_0x5c3517){if(!_0x5c3517){_0xb52ee3[_0x5d5a('0x12')](0x194);}return _0x5c3517;};}function handleError(_0x524e2a,_0x2da2d8){_0x2da2d8=_0x2da2d8||0x1f4;return function(_0x4b20f4){logger[_0x5d5a('0x1d')](_0x4b20f4[_0x5d5a('0x1e')]);if(_0x4b20f4[_0x5d5a('0x1f')]){delete _0x4b20f4[_0x5d5a('0x1f')];}_0x524e2a[_0x5d5a('0x13')](_0x2da2d8)[_0x5d5a('0x20')](_0x4b20f4);};}exports[_0x5d5a('0x21')]=function(_0x36c9c7,_0x429d04){var _0x45ec70={};var _0x46e57b=_[_0x5d5a('0x22')](db[_0x5d5a('0x23')][_0x5d5a('0x24')],function(_0x552035){return{'name':_0x552035[_0x5d5a('0x25')],'type':_0x552035[_0x5d5a('0x26')]['key']};});_0x45ec70=qs[_0x5d5a('0x27')](_0x46e57b,_0x36c9c7);return interaction[_0x5d5a('0x28')](_0x5d5a('0x29'),_0x36c9c7['query'],_0x36c9c7[_0x5d5a('0x2a')],_0x45ec70,_0x46e57b)[_0x5d5a('0x1c')](respondWithFilteredResult(_0x429d04,_0x45ec70))[_0x5d5a('0x2b')](handleError(_0x429d04,null));};exports[_0x5d5a('0x2c')]=function(_0x9ae1ed,_0x3b68ab){var _0x9c3556={};if(_0x9ae1ed[_0x5d5a('0x2d')]['type']&&_0x9ae1ed[_0x5d5a('0x2d')][_0x5d5a('0x26')]===_0x5d5a('0x2e')){_0x9c3556[_0x5d5a('0x2e')]=_0x9ae1ed[_0x5d5a('0x2f')]['id'];}else{_0x9c3556['id']=_0x9ae1ed[_0x5d5a('0x2f')]['id'];}var _0x57ba81={'raw':![],'where':_0x9c3556},_0x540157={};_0x540157[_0x5d5a('0x30')]=_[_0x5d5a('0x31')](db[_0x5d5a('0x23')][_0x5d5a('0x24')]);_0x540157[_0x5d5a('0x2d')]=_[_0x5d5a('0x31')](_0x9ae1ed['query']);_0x540157['filters']=_[_0x5d5a('0x32')](_0x540157[_0x5d5a('0x30')],_0x540157['query']);_0x57ba81['attributes']=_[_0x5d5a('0x32')](_0x540157[_0x5d5a('0x30')],qs['fields'](_0x9ae1ed[_0x5d5a('0x2d')]['fields']));_0x57ba81[_0x5d5a('0x33')]=_0x57ba81[_0x5d5a('0x33')][_0x5d5a('0x34')]?_0x57ba81['attributes']:_0x540157['model'];if(_0x9ae1ed[_0x5d5a('0x2d')]['includeAll']){_0x57ba81[_0x5d5a('0x35')]=[{'all':!![]}];}_0x57ba81=_[_0x5d5a('0x36')]({},_0x57ba81,_0x9ae1ed['options']);return db['OpenchannelInteraction']['find'](_0x57ba81)['then'](handleEntityNotFound(_0x3b68ab,null))['then'](respondWithResult(_0x3b68ab,null))[_0x5d5a('0x2b')](handleError(_0x3b68ab,null));};exports[_0x5d5a('0x37')]=function(_0x1ccf85,_0x118106){return db[_0x5d5a('0x23')]['create'](_0x1ccf85[_0x5d5a('0x38')],{})[_0x5d5a('0x1c')](respondWithResult(_0x118106,0xc9))[_0x5d5a('0x2b')](handleError(_0x118106,null));};exports['update']=function(_0x4d8f16,_0x54986d){if(_0x4d8f16[_0x5d5a('0x38')]['id']){delete _0x4d8f16[_0x5d5a('0x38')]['id'];}return db[_0x5d5a('0x23')][_0x5d5a('0x39')]({'where':{'id':_0x4d8f16[_0x5d5a('0x2f')]['id']}})[_0x5d5a('0x1c')](handleEntityNotFound(_0x54986d,null))['then'](saveUpdates(_0x4d8f16['body'],null))[_0x5d5a('0x1c')](respondWithResult(_0x54986d,null))[_0x5d5a('0x2b')](handleError(_0x54986d,null));};exports[_0x5d5a('0x3a')]=function(_0x5457f4,_0x78ddac){return db['OpenchannelInteraction'][_0x5d5a('0x39')]({'where':{'id':_0x5457f4[_0x5d5a('0x2f')]['id']}})[_0x5d5a('0x1c')](handleEntityNotFound(_0x78ddac,null))[_0x5d5a('0x1c')](removeEntity(_0x78ddac,null))[_0x5d5a('0x2b')](handleError(_0x78ddac,null));};exports[_0x5d5a('0x3b')]=function(_0x1ed52e,_0x554f67){return db['OpenchannelInteraction'][_0x5d5a('0x3b')]()[_0x5d5a('0x1c')](respondWithResult(_0x554f67,null))['catch'](handleError(_0x554f67,null));};exports['addMessage']=function(_0x4a5b20,_0x42bb6e){return db['OpenchannelMessage'][_0x5d5a('0x39')]({'where':{'id':_0x4a5b20[_0x5d5a('0x2f')]['id']}})[_0x5d5a('0x1c')](handleEntityNotFound(_0x42bb6e,null))[_0x5d5a('0x1c')](function(_0x1d1639){if(_0x1d1639){return _0x1d1639['addMessage'](_0x4a5b20[_0x5d5a('0x38')][_0x5d5a('0x3c')],_[_0x5d5a('0x3d')](_0x4a5b20['body'],[_0x5d5a('0x3c'),'id'])||{});}})[_0x5d5a('0x1c')](respondWithResult(_0x42bb6e,null))[_0x5d5a('0x2b')](handleError(_0x42bb6e,null));};exports[_0x5d5a('0x3e')]=function(_0x5e8909,_0x4d5f1b){var _0x3919dc={'raw':![],'where':{}};var _0x55d383={};var _0x37ed77={'count':0x0,'rows':[]};return db[_0x5d5a('0x23')][_0x5d5a('0x3f')]({'where':{'id':_0x5e8909['params']['id']}})[_0x5d5a('0x1c')](handleEntityNotFound(_0x4d5f1b,null))[_0x5d5a('0x1c')](function(_0x26b821){if(_0x26b821){_0x55d383[_0x5d5a('0x30')]=_[_0x5d5a('0x31')](db[_0x5d5a('0x40')][_0x5d5a('0x24')]);_0x55d383[_0x5d5a('0x2d')]=_[_0x5d5a('0x31')](_0x5e8909['query']);_0x55d383[_0x5d5a('0x41')]=_['intersection'](_0x55d383['model'],_0x55d383[_0x5d5a('0x2d')]);_0x3919dc[_0x5d5a('0x33')]=_[_0x5d5a('0x32')](_0x55d383['model'],qs[_0x5d5a('0x42')](_0x5e8909[_0x5d5a('0x2d')][_0x5d5a('0x42')]));_0x3919dc[_0x5d5a('0x33')]=_0x3919dc[_0x5d5a('0x33')][_0x5d5a('0x34')]?_0x3919dc[_0x5d5a('0x33')]:_0x55d383[_0x5d5a('0x30')];if(!_0x5e8909[_0x5d5a('0x2d')][_0x5d5a('0x43')](_0x5d5a('0x44'))){_0x3919dc[_0x5d5a('0x45')]=qs['limit'](_0x5e8909[_0x5d5a('0x2d')][_0x5d5a('0x45')]);_0x3919dc['offset']=qs[_0x5d5a('0x16')](_0x5e8909[_0x5d5a('0x2d')][_0x5d5a('0x16')]);}_0x3919dc['order']=qs['sort'](_0x5e8909[_0x5d5a('0x2d')]['sort']);_0x3919dc['where']=qs['filters'](_['pick'](_0x5e8909[_0x5d5a('0x2d')],_0x55d383[_0x5d5a('0x41')]));_0x3919dc['where'][_0x5d5a('0x46')]=_0x26b821['id'];if(_0x5e8909['query'][_0x5d5a('0x47')]){_0x3919dc[_0x5d5a('0x48')]=_[_0x5d5a('0x36')](_0x3919dc[_0x5d5a('0x48')],{'$or':_['map'](_0x3919dc[_0x5d5a('0x33')],function(_0x281d69){var _0x16b3b0={};_0x16b3b0[_0x281d69]={'$like':'%'+_0x5e8909['query'][_0x5d5a('0x47')]+'%'};return _0x16b3b0;})});}if(_0x5e8909[_0x5d5a('0x2d')][_0x5d5a('0x49')]){var _0x23a8cd=_0x5e8909[_0x5d5a('0x2d')]['$gte'][_0x5d5a('0x4a')](',');var _0x2be01b={};_0x2be01b[_0x23a8cd[0x0]]={'$gte':moment(_0x23a8cd[0x1])[_0x5d5a('0x4b')](_0x5d5a('0x4c'))};_0x3919dc['where']=_['merge'](_0x3919dc[_0x5d5a('0x48')],_0x2be01b);}_0x3919dc=_[_0x5d5a('0x36')]({},_0x3919dc,_0x5e8909['options']);return db[_0x5d5a('0x40')][_0x5d5a('0x18')]({'where':_0x3919dc[_0x5d5a('0x48')]})[_0x5d5a('0x1c')](function(_0x5bbb4d){_0x37ed77[_0x5d5a('0x18')]=_0x5bbb4d;if(_0x5e8909[_0x5d5a('0x2d')][_0x5d5a('0x4d')]){_0x3919dc[_0x5d5a('0x35')]=[{'all':!![]}];}return db[_0x5d5a('0x40')][_0x5d5a('0x28')](_0x3919dc);})[_0x5d5a('0x1c')](function(_0x36d73f){_0x37ed77[_0x5d5a('0x4e')]=_0x36d73f;return _0x37ed77;});}})[_0x5d5a('0x1c')](respondWithFilteredResult(_0x4d5f1b,_0x3919dc))[_0x5d5a('0x2b')](handleError(_0x4d5f1b,null));};exports[_0x5d5a('0x4f')]=function(_0x278652,_0x2e3fe1){return db[_0x5d5a('0x23')]['find']({'where':{'id':_0x278652[_0x5d5a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2e3fe1,null))[_0x5d5a('0x1c')](function(_0x39af44){if(_0x39af44){return _0x39af44[_0x5d5a('0x50')](_0x278652[_0x5d5a('0x38')][_0x5d5a('0x3c')],_[_0x5d5a('0x3d')](_0x278652['body'],[_0x5d5a('0x3c'),'id'])||{})[_0x5d5a('0x51')](function(){return db['Tag']['findAll']({'attributes':['id',_0x5d5a('0x1f'),_0x5d5a('0x52')],'where':{'id':_0x278652['body'][_0x5d5a('0x3c')]}});})['then'](function(_0x165e00){socket[_0x5d5a('0x53')](_0x5d5a('0x54'),{'id':Number(_0x278652[_0x5d5a('0x2f')]['id']),'tags':_0x165e00||[]});return{'id':Number(_0x278652[_0x5d5a('0x2f')]['id']),'tags':_0x165e00||[]};});}})[_0x5d5a('0x1c')](respondWithResult(_0x2e3fe1,null))[_0x5d5a('0x2b')](handleError(_0x2e3fe1,null));};exports[_0x5d5a('0x55')]=function(_0xb27bd9,_0x55c592){return db[_0x5d5a('0x23')][_0x5d5a('0x39')]({'where':{'id':_0xb27bd9['params']['id']}})[_0x5d5a('0x1c')](handleEntityNotFound(_0x55c592,null))[_0x5d5a('0x1c')](function(_0x55459c){if(_0x55459c){return _0x55459c[_0x5d5a('0x55')](_0xb27bd9[_0x5d5a('0x2d')][_0x5d5a('0x3c')]);}})[_0x5d5a('0x1c')](respondWithStatusCode(_0x55c592,null))[_0x5d5a('0x2b')](handleError(_0x55c592,null));};exports[_0x5d5a('0x56')]=function(_0x3c66aa,_0x1fe2ce){var _0x51bf5e=moment()['unix']()[_0x5d5a('0x57')]();var _0x3649fd=path[_0x5d5a('0x58')](config['root'],'server',_0x5d5a('0x59'),'tmp');var _0x43d6a7=path[_0x5d5a('0x58')](config[_0x5d5a('0x5a')],_0x5d5a('0x5b'),'files',_0x5d5a('0x5c'));var _0xf7a5f3=path[_0x5d5a('0x58')](_0x3649fd,_0x51bf5e);var _0x1ec941=util[_0x5d5a('0x4b')](_0x5d5a('0x5d'),_0x3c66aa[_0x5d5a('0x2f')]['id'],_0x51bf5e);var _0x22964a=path[_0x5d5a('0x58')](_0x3649fd,_0x1ec941);var _0x49c46a=[];_0x49c46a[_0x5d5a('0x5e')]({'model':db[_0x5d5a('0x5f')],'as':_0x5d5a('0x5f'),'attributes':['id',_0x5d5a('0x60')],'raw':!![]});_0x49c46a['push']({'model':db[_0x5d5a('0x61')],'as':_0x5d5a('0x62'),'attributes':['id',_0x5d5a('0x63'),_0x5d5a('0x64')],'raw':!![]});if(_0x3c66aa[_0x5d5a('0x2d')][_0x5d5a('0x5c')]){_0x49c46a[_0x5d5a('0x5e')]({'model':db[_0x5d5a('0x65')],'as':_0x5d5a('0x65'),'raw':!![]});}var _0x1b3e60=[{'model':db[_0x5d5a('0x40')],'as':_0x5d5a('0x66'),'attributes':['id',_0x5d5a('0x38'),'createdAt',_0x5d5a('0x67'),_0x5d5a('0x68'),'read'],'include':_0x49c46a}];_0x1b3e60[_0x5d5a('0x5e')]({'model':db[_0x5d5a('0x69')],'as':_0x5d5a('0x6a'),'attributes':['id',_0x5d5a('0x1f')]});_0x1b3e60['push']({'model':db[_0x5d5a('0x5f')],'as':_0x5d5a('0x6b'),'attributes':['id','fullname']});return db[_0x5d5a('0x23')][_0x5d5a('0x39')]({'where':{'id':_0x3c66aa['params']['id']},'include':_0x1b3e60})[_0x5d5a('0x1c')](handleEntityNotFound(_0x1fe2ce,null))[_0x5d5a('0x1c')](function(_0x5b55ff){if(_0x5b55ff){var _0x52a8ba=_0x5b55ff[_0x5d5a('0x6c')]({'plain':!![]});fs[_0x5d5a('0x6d')](_0xf7a5f3);var _0x45a58b={'channel':_0x5d5a('0x6e'),'account':_0x52a8ba[_0x5d5a('0x6a')][_0x5d5a('0x1f')],'agent':_0x52a8ba['Owner']?_0x52a8ba['Owner'][_0x5d5a('0x60')]:'N.A.','createdAt':moment(_0x52a8ba[_0x5d5a('0x6f')])[_0x5d5a('0x4b')](_0x5d5a('0x4c'))[_0x5d5a('0x57')](),'closedAt':_0x52a8ba[_0x5d5a('0x70')]?moment(_0x52a8ba[_0x5d5a('0x71')])['format'](_0x5d5a('0x4c'))['toString']():'','disposition':_0x52a8ba[_0x5d5a('0x72')],'visibility':_0x52a8ba[_0x5d5a('0x73')]?'Public':_0x5d5a('0x74'),'messages':_(_0x52a8ba[_0x5d5a('0x66')])['filter']({'secret':![]})[_0x5d5a('0x22')](function(_0x43abde){if(_0x43abde[_0x5d5a('0x65')]){var _0x604815=path['join'](_0x43d6a7,_0x43abde[_0x5d5a('0x65')][_0x5d5a('0x75')]);if(fs[_0x5d5a('0x76')](_0x604815)){fs[_0x5d5a('0x77')](_0x604815)[_0x5d5a('0x78')](fs[_0x5d5a('0x79')](path['join'](_0xf7a5f3,_0x43abde['Attachment'][_0x5d5a('0x75')])));}}return{'date':moment(_0x43abde[_0x5d5a('0x6f')])['format'](_0x5d5a('0x4c'))['toString'](),'sender':_0x43abde[_0x5d5a('0x67')]===_0x5d5a('0x7a')?_0x43abde[_0x5d5a('0x5f')]?_0x43abde[_0x5d5a('0x5f')]['fullname']:_0x5d5a('0x7b'):_0x43abde['Contact'][_0x5d5a('0x63')]+(_0x43abde[_0x5d5a('0x62')][_0x5d5a('0x64')]?'\x20'+_0x43abde[_0x5d5a('0x62')][_0x5d5a('0x64')]:''),'body':_0x43abde[_0x5d5a('0x65')]?_0x43abde['Attachment'][_0x5d5a('0x75')]:_0x43abde['body'],'direction':_0x43abde[_0x5d5a('0x67')]==='out'?'A':'C','secret':_0x43abde['secret'],'read':_0x43abde[_0x5d5a('0x7c')],'attachment':_0x43abde[_0x5d5a('0x65')]};})[_0x5d5a('0x7d')]()};return ejs['renderFile'](path[_0x5d5a('0x58')](config[_0x5d5a('0x5a')],_0x5d5a('0x5b'),_0x5d5a('0x7e'),_0x5d5a('0x7f')),{'interaction':_0x45a58b})['then'](function(_0x324489){var _0x2ad4ce=path[_0x5d5a('0x58')](_0xf7a5f3,_0x5d5a('0x80')+_0x52a8ba['id']+'-'+_0x51bf5e+_0x5d5a('0x81'));var _0x3f8753={'path':_0x2ad4ce,'channel':'Openchannel','interactionId':_0x52a8ba['id']};return pdf[_0x5d5a('0x82')](_0x324489,_0x3f8753);})[_0x5d5a('0x1c')](function(){return new Promise(function(_0x3df62d,_0xc4c10c){zipdir(_0xf7a5f3,{'saveTo':_0x22964a},function(_0x20bcb8,_0x4cffad){if(_0x20bcb8)return _0xc4c10c(_0x20bcb8);return _0x3df62d(_0x4cffad);});})[_0x5d5a('0x1c')](function(){return new Promise(function(_0x533937,_0xcd4619){rimraf(_0xf7a5f3,function(_0x1bbd95){if(_0x1bbd95)_0xcd4619(_0x1bbd95);return _0x533937();});});})[_0x5d5a('0x1c')](function(){return _0x1fe2ce['download'](_0x22964a,_0x1ec941,function(_0x21ec39){if(_0x21ec39){logger['error'](_0x5d5a('0x83'),_0x21ec39);}else{fs[_0x5d5a('0x84')](_0x22964a);}});});});}else{return _0x1fe2ce[_0x5d5a('0x12')](0xc8);}})[_0x5d5a('0x2b')](handleError(_0x1fe2ce,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 05f57fe..ef02cc9 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 _0x1ce4=['Users','map','findAll','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','remove','getUsers','then','setDataValue'];(function(_0x22c979,_0x2c4733){var _0x3bdd3e=function(_0x3c272f){while(--_0x3c272f){_0x22c979['push'](_0x22c979['shift']());}};_0x3bdd3e(++_0x2c4733);}(_0x1ce4,0x12d));var _0x41ce=function(_0x2a3aae,_0x21359a){_0x2a3aae=_0x2a3aae-0x0;var _0x39989f=_0x1ce4[_0x2a3aae];return _0x39989f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x41ce('0x0'))['db'][_0x41ce('0x1')];var OpenchannelMessage=require(_0x41ce('0x0'))['db'][_0x41ce('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x41ce('0x3')};function emitEvent(_0x1babbb){return function(_0x2256bf,_0x1f9dde,_0x123b2c){_0x2256bf[_0x41ce('0x4')]({'attributes':['id'],'raw':!![]})[_0x41ce('0x5')](function(_0x46ab7d){_0x2256bf[_0x41ce('0x6')](_0x41ce('0x7'),_0x46ab7d[_0x41ce('0x8')](function(_0x580af2){return{'id':_0x580af2['id']};}));return OpenchannelMessage[_0x41ce('0x9')]({'where':{'OpenchannelInteractionId':_0x2256bf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x41ce('0x5')](function(_0x4c72e0){_0x2256bf[_0x41ce('0x6')]('unreadMessages',_0x4c72e0['length']);OpenchannelInteractionEvents[_0x41ce('0xa')](_0x1babbb+':'+_0x2256bf['id'],_0x2256bf);OpenchannelInteractionEvents[_0x41ce('0xa')](_0x1babbb,_0x2256bf);_0x123b2c(null);})['catch'](_0x123b2c(null));};}for(var e in events){if(events[_0x41ce('0xb')](e)){var event=events[e];OpenchannelInteraction[_0x41ce('0xc')](e,emitEvent(event));}}module[_0x41ce('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3292=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1b40fb,_0x32efba){var _0x34c36f=function(_0x2a62a7){while(--_0x2a62a7){_0x1b40fb['push'](_0x1b40fb['shift']());}};_0x34c36f(++_0x32efba);}(_0x3292,0x1c6));var _0x2329=function(_0x559af0,_0x2928a9){_0x559af0=_0x559af0-0x0;var _0x59c15e=_0x3292[_0x559af0];return _0x59c15e;};'use strict';var EventEmitter=require(_0x2329('0x0'));var OpenchannelInteraction=require(_0x2329('0x1'))['db'][_0x2329('0x2')];var OpenchannelMessage=require(_0x2329('0x1'))['db'][_0x2329('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2329('0x4')](0x0);var events={'afterCreate':_0x2329('0x5'),'afterUpdate':_0x2329('0x6'),'afterDestroy':_0x2329('0x7')};function emitEvent(_0x48aa19){return function(_0x355701,_0x559a83,_0x4aab06){_0x355701['getUsers']({'attributes':['id'],'raw':!![]})[_0x2329('0x8')](function(_0x887e92){_0x355701[_0x2329('0x9')](_0x2329('0xa'),_0x887e92['map'](function(_0x661da0){return{'id':_0x661da0['id']};}));return OpenchannelMessage[_0x2329('0xb')]({'where':{'OpenchannelInteractionId':_0x355701['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2329('0x8')](function(_0x481ba4){_0x355701[_0x2329('0x9')](_0x2329('0xc'),_0x481ba4[_0x2329('0xd')]);OpenchannelInteractionEvents[_0x2329('0xe')](_0x48aa19+':'+_0x355701['id'],_0x355701);OpenchannelInteractionEvents['emit'](_0x48aa19,_0x355701);_0x4aab06(null);})[_0x2329('0xf')](_0x4aab06(null));};}for(var e in events){if(events[_0x2329('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x2329('0x11')](e,emitEvent(event));}}module[_0x2329('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c1a6275..340d4f7 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 _0x6a7f=['define','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','exports'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0x6a7f,0x106));var _0xf6a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6a7('0x0'));var util=require(_0xf6a7('0x1'));var logger=require(_0xf6a7('0x2'))(_0xf6a7('0x3'));var moment=require(_0xf6a7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6a7('0x5'));var config=require(_0xf6a7('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0xf6a7('0x7')]=function(_0x30665d,_0x297896){return _0x30665d[_0xf6a7('0x8')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6a7('0x9'),'collate':_0xf6a7('0xa'),'hooks':{'beforeUpdate':function(_0x1bf33e,_0x45de80,_0x590fb1){if(_0x1bf33e['changed'](_0xf6a7('0xb'))){_0x1bf33e[_0xf6a7('0xc')]=moment()[_0xf6a7('0xd')](_0xf6a7('0xe'));}_0x590fb1(null,_0x1bf33e);}}});}; \ No newline at end of file +var _0x84e7=['openchannel_interactions','utf8mb4','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x2e1d74,_0x15b6fa){var _0x561adc=function(_0x290a9f){while(--_0x290a9f){_0x2e1d74['push'](_0x2e1d74['shift']());}};_0x561adc(++_0x15b6fa);}(_0x84e7,0x122));var _0x784e=function(_0x3b7df6,_0x1caf3a){_0x3b7df6=_0x3b7df6-0x0;var _0x4306dc=_0x84e7[_0x3b7df6];return _0x4306dc;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x784e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x784e('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x18be55,_0x46fda9,_0x237b5e){if(_0x18be55[_0x784e('0xc')]('closed')){_0x18be55['closedAt']=moment()[_0x784e('0xd')](_0x784e('0xe'));}_0x237b5e(null,_0x18be55);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3b04e12..eac997c 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 _0xf990=['result','OpenchannelInteraction','update','body','options','raw','where','attributes','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','info','AddTags','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','./openchannelInteraction.socket','register','request','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xf990,0x13a));var _0x0f99=function(_0x414a33,_0x5bf179){_0x414a33=_0x414a33-0x0;var _0x1922bd=_0xf990[_0x414a33];return _0x1922bd;};'use strict';var _=require('lodash');var util=require(_0x0f99('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0f99('0x1'));var fs=require('fs');var Redis=require(_0x0f99('0x2'));var db=require(_0x0f99('0x3'))['db'];var utils=require(_0x0f99('0x4'));var logger=require(_0x0f99('0x5'))('rpc');var config=require(_0x0f99('0x6'));var jayson=require(_0x0f99('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0f99('0x8')]=_[_0x0f99('0x9')](config[_0x0f99('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f99('0xa'))[_0x0f99('0xb')](socket);function respondWithRpcPromise(_0x45c9f7,_0x394008,_0x27c015){return new BPromise(function(_0x55a697,_0x21f200){return client[_0x0f99('0xc')](_0x45c9f7,_0x27c015)['then'](function(_0x15b5da){logger['info'](_0x0f99('0xd'),_0x394008,'request\x20sent');logger[_0x0f99('0xe')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x394008,_0x0f99('0xf'),JSON[_0x0f99('0x10')](_0x15b5da));if(_0x15b5da[_0x0f99('0x11')]){if(_0x15b5da[_0x0f99('0x11')]['code']===0x1f4){logger[_0x0f99('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x394008,_0x15b5da[_0x0f99('0x11')][_0x0f99('0x12')]);return _0x21f200(_0x15b5da['error']['message']);}logger[_0x0f99('0x11')](_0x0f99('0xd'),_0x394008,_0x15b5da[_0x0f99('0x11')][_0x0f99('0x12')]);return _0x55a697(_0x15b5da['error'][_0x0f99('0x12')]);}else{logger['info'](_0x0f99('0xd'),_0x394008,_0x0f99('0xf'));_0x55a697(_0x15b5da[_0x0f99('0x13')][_0x0f99('0x12')]);}})['catch'](function(_0x1b4f9c){logger['error'](_0x0f99('0xd'),_0x394008,_0x1b4f9c);_0x21f200(_0x1b4f9c);});});}exports['UpdateOpenchannelInteraction']=function(_0xd7d97f){var _0x436d29=this;return new Promise(function(_0x369cec,_0x55246e){return db[_0x0f99('0x14')][_0x0f99('0x15')](_0xd7d97f[_0x0f99('0x16')],{'raw':_0xd7d97f['options']?_0xd7d97f[_0x0f99('0x17')][_0x0f99('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd7d97f[_0x0f99('0x17')]?_0xd7d97f[_0x0f99('0x17')][_0x0f99('0x19')]||null:null,'attributes':_0xd7d97f[_0x0f99('0x17')]?_0xd7d97f[_0x0f99('0x17')][_0x0f99('0x1a')]||null:null,'limit':_0xd7d97f[_0x0f99('0x17')]?_0xd7d97f['options']['limit']||null:null})[_0x0f99('0x1b')](function(_0x2a5610){logger['info'](_0x0f99('0x1c'),_0xd7d97f);logger['debug'](_0x0f99('0x1c'),_0xd7d97f,JSON[_0x0f99('0x10')](_0x2a5610));_0x369cec(_0x2a5610);})['catch'](function(_0x2339bb){logger['error'](_0x0f99('0x1c'),_0x2339bb['message'],_0xd7d97f);_0x55246e(_0x436d29[_0x0f99('0x11')](0x1f4,_0x2339bb[_0x0f99('0x12')]));});});};exports[_0x0f99('0x1d')]=function(_0x3f326e){return new Promise(function(_0x2c4087,_0x37f7da){return db[_0x0f99('0x14')]['find']({'where':_0x3f326e['options']?_0x3f326e['options'][_0x0f99('0x19')]||null:null})[_0x0f99('0x1b')](function(_0x41fbc0){if(_0x41fbc0){return _0x41fbc0[_0x0f99('0x1e')](_0x3f326e[_0x0f99('0x16')][_0x0f99('0x1f')],_[_0x0f99('0x20')](_0x3f326e[_0x0f99('0x16')],[_0x0f99('0x1f'),'id'])||{});}})[_0x0f99('0x21')](function(_0x1a522e){logger[_0x0f99('0x22')]('AddTags',_0x3f326e);logger['debug'](_0x0f99('0x23'),_0x3f326e,JSON[_0x0f99('0x10')](_0x1a522e));_0x2c4087(_0x1a522e);})[_0x0f99('0x24')](function(_0x2d4514){logger[_0x0f99('0x11')](_0x0f99('0x23'),_0x2d4514[_0x0f99('0x12')],_0x3f326e);_0x37f7da(_this[_0x0f99('0x11')](0x1f4,_0x2d4514[_0x0f99('0x12')]));});});}; \ No newline at end of file +var _0x453c=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','OpenchannelInteraction','update','raw','options','where','attributes','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','addTags','body','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x453c,0x113));var _0xc453=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x453c[_0x47b15f];return _0x55bf25;};'use strict';var _=require('lodash');var util=require(_0xc453('0x0'));var moment=require('moment');var BPromise=require(_0xc453('0x1'));var rs=require(_0xc453('0x2'));var fs=require('fs');var Redis=require(_0xc453('0x3'));var db=require(_0xc453('0x4'))['db'];var utils=require(_0xc453('0x5'));var logger=require(_0xc453('0x6'))(_0xc453('0x7'));var config=require(_0xc453('0x8'));var jayson=require(_0xc453('0x9'));var client=jayson[_0xc453('0xa')][_0xc453('0xb')]({'port':0x232a});config[_0xc453('0xc')]=_[_0xc453('0xd')](config['redis'],{'host':_0xc453('0xe'),'port':0x18eb});var socket=require(_0xc453('0xf'))(new Redis(config[_0xc453('0xc')]));require(_0xc453('0x10'))[_0xc453('0x11')](socket);function respondWithRpcPromise(_0x520382,_0x52a905,_0x2558ad){return new BPromise(function(_0x9e9c8c,_0x5a856c){return client[_0xc453('0x12')](_0x520382,_0x2558ad)[_0xc453('0x13')](function(_0x16b61b){logger[_0xc453('0x14')](_0xc453('0x15'),_0x52a905,_0xc453('0x16'));logger['debug'](_0xc453('0x17'),_0x52a905,_0xc453('0x16'),JSON['stringify'](_0x16b61b));if(_0x16b61b['error']){if(_0x16b61b[_0xc453('0x18')]['code']===0x1f4){logger[_0xc453('0x18')](_0xc453('0x15'),_0x52a905,_0x16b61b['error']['message']);return _0x5a856c(_0x16b61b[_0xc453('0x18')][_0xc453('0x19')]);}logger[_0xc453('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x52a905,_0x16b61b[_0xc453('0x18')][_0xc453('0x19')]);return _0x9e9c8c(_0x16b61b['error'][_0xc453('0x19')]);}else{logger[_0xc453('0x14')](_0xc453('0x15'),_0x52a905,_0xc453('0x16'));_0x9e9c8c(_0x16b61b['result'][_0xc453('0x19')]);}})[_0xc453('0x1a')](function(_0x5e95eb){logger[_0xc453('0x18')](_0xc453('0x15'),_0x52a905,_0x5e95eb);_0x5a856c(_0x5e95eb);});});}exports['UpdateOpenchannelInteraction']=function(_0x364bd1){var _0x1ebeca=this;return new Promise(function(_0x46cf13,_0x508053){return db[_0xc453('0x1b')][_0xc453('0x1c')](_0x364bd1['body'],{'raw':_0x364bd1['options']?_0x364bd1['options'][_0xc453('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x364bd1[_0xc453('0x1e')]?_0x364bd1[_0xc453('0x1e')][_0xc453('0x1f')]||null:null,'attributes':_0x364bd1['options']?_0x364bd1[_0xc453('0x1e')][_0xc453('0x20')]||null:null,'limit':_0x364bd1['options']?_0x364bd1[_0xc453('0x1e')]['limit']||null:null})['then'](function(_0x1e9264){logger['info'](_0xc453('0x21'),_0x364bd1);logger['debug'](_0xc453('0x21'),_0x364bd1,JSON[_0xc453('0x22')](_0x1e9264));_0x46cf13(_0x1e9264);})[_0xc453('0x1a')](function(_0x1d10e9){logger[_0xc453('0x18')](_0xc453('0x21'),_0x1d10e9[_0xc453('0x19')],_0x364bd1);_0x508053(_0x1ebeca[_0xc453('0x18')](0x1f4,_0x1d10e9[_0xc453('0x19')]));});});};exports[_0xc453('0x23')]=function(_0x3f528c){return new Promise(function(_0x3b8731,_0x1aeed9){return db[_0xc453('0x1b')]['find']({'where':_0x3f528c[_0xc453('0x1e')]?_0x3f528c[_0xc453('0x1e')]['where']||null:null})['then'](function(_0x130f77){if(_0x130f77){return _0x130f77[_0xc453('0x24')](_0x3f528c[_0xc453('0x25')][_0xc453('0x26')],_['omit'](_0x3f528c[_0xc453('0x25')],[_0xc453('0x26'),'id'])||{});}})[_0xc453('0x27')](function(_0x5e3fe0){logger[_0xc453('0x14')](_0xc453('0x28'),_0x3f528c);logger['debug']('AddTags',_0x3f528c,JSON[_0xc453('0x22')](_0x5e3fe0));_0x3b8731(_0x5e3fe0);})['catch'](function(_0x4e9d4e){logger['error'](_0xc453('0x28'),_0x4e9d4e[_0xc453('0x19')],_0x3f528c);_0x1aeed9(_this[_0xc453('0x18')](0x1f4,_0x4e9d4e[_0xc453('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b3b13de..b3973c1 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 _0x1ee4=['remove','update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x29f2f0,_0x3112f7){var _0x332461=function(_0x5d5188){while(--_0x5d5188){_0x29f2f0['push'](_0x29f2f0['shift']());}};_0x332461(++_0x3112f7);}(_0x1ee4,0xbe));var _0x41ee=function(_0x81e56d,_0x291fd8){_0x81e56d=_0x81e56d-0x0;var _0x4ae667=_0x1ee4[_0x81e56d];return _0x4ae667;};'use strict';var OpenchannelInteractionEvents=require(_0x41ee('0x0'));var events=[_0x41ee('0x1'),_0x41ee('0x2'),_0x41ee('0x3')];function createListener(_0xfb9796,_0x17f8a2){return function(_0x53c7f6){_0x17f8a2[_0x41ee('0x4')](_0xfb9796,_0x53c7f6);};}function removeListener(_0x638d5b,_0x53b362){return function(){OpenchannelInteractionEvents[_0x41ee('0x5')](_0x638d5b,_0x53b362);};}exports['register']=function(_0x292295){for(var _0x1c584f=0x0,_0x1382bf=events[_0x41ee('0x6')];_0x1c584f<_0x1382bf;_0x1c584f++){var _0x4162bb=events[_0x1c584f];var _0x15eb07=createListener(_0x41ee('0x7')+_0x4162bb,_0x292295);OpenchannelInteractionEvents['on'](_0x4162bb,_0x15eb07);}}; \ No newline at end of file +var _0x7659=['openchannelInteraction:','./openchannelInteraction.events','save','update','emit','removeListener','length'];(function(_0x12b2f0,_0x13ece2){var _0x44d298=function(_0xcc188d){while(--_0xcc188d){_0x12b2f0['push'](_0x12b2f0['shift']());}};_0x44d298(++_0x13ece2);}(_0x7659,0x166));var _0x9765=function(_0x5b6002,_0x5e7ef3){_0x5b6002=_0x5b6002-0x0;var _0x8fb2d3=_0x7659[_0x5b6002];return _0x8fb2d3;};'use strict';var OpenchannelInteractionEvents=require(_0x9765('0x0'));var events=[_0x9765('0x1'),'remove',_0x9765('0x2')];function createListener(_0x168bd2,_0x29dfd){return function(_0x64d44b){_0x29dfd[_0x9765('0x3')](_0x168bd2,_0x64d44b);};}function removeListener(_0x56061e,_0x549d52){return function(){OpenchannelInteractionEvents[_0x9765('0x4')](_0x56061e,_0x549d52);};}exports['register']=function(_0x534d9e){for(var _0x16d6e7=0x0,_0x167815=events[_0x9765('0x5')];_0x16d6e7<_0x167815;_0x16d6e7++){var _0x4e472e=events[_0x16d6e7];var _0x3bbaa0=createListener(_0x9765('0x6')+_0x4e472e,_0x534d9e);OpenchannelInteractionEvents['on'](_0x4e472e,_0x3bbaa0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 63a5613..77d3dd7 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 _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(_0x1da306,_0x327f2b){var _0x97dda8=function(_0x69a2fc){while(--_0x69a2fc){_0x1da306['push'](_0x1da306['shift']());}};_0x97dda8(++_0x327f2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 +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(_0x3c8f59,_0x58b531){var _0xaa11c0=function(_0x2d3f9e){while(--_0x2d3f9e){_0x3c8f59['push'](_0x3c8f59['shift']());}};_0xaa11c0(++_0x58b531);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 00bdd5f..c846171 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 _0x1399=['ENUM','out','DATE','STRING','sequelize','exports','medium','BOOLEAN'];(function(_0x4acf04,_0x3f5682){var _0x29e0a8=function(_0x347614){while(--_0x347614){_0x4acf04['push'](_0x4acf04['shift']());}};_0x29e0a8(++_0x3f5682);}(_0x1399,0x16c));var _0x9139=function(_0x281ad3,_0x1602e0){_0x281ad3=_0x281ad3-0x0;var _0x30a754=_0x1399[_0x281ad3];return _0x30a754;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9139('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9139('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9139('0x4')]('in',_0x9139('0x5')),'defaultValue':_0x9139('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9139('0x6')]},'providerName':{'type':Sequelize[_0x9139('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd0e4=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x1898d1,_0x1a1552){var _0x37f8fe=function(_0x514ef3){while(--_0x514ef3){_0x1898d1['push'](_0x1898d1['shift']());}};_0x37f8fe(++_0x1a1552);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x8dd419,_0x58acff){_0x8dd419=_0x8dd419-0x0;var _0x4fadf8=_0xd0e4[_0x8dd419];return _0x4fadf8;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'body':{'type':Sequelize[_0x4d0e('0x2')](_0x4d0e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d0e('0x4')]('in',_0x4d0e('0x5')),'defaultValue':_0x4d0e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d0e('0x6')]},'providerName':{'type':Sequelize[_0x4d0e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 51016b1..e7b05da 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 _0x6df0=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','stack','name','send','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','reject','RejectMessage','rejectMessage','SELECT','fullname','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','redis','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x348bf0,_0x17a42e){var _0x201b52=function(_0x294aeb){while(--_0x294aeb){_0x348bf0['push'](_0x348bf0['shift']());}};_0x201b52(++_0x17a42e);}(_0x6df0,0x15d));var _0x06df=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x6df0[_0x1098db];return _0x14f090;};'use strict';var emlformat=require(_0x06df('0x0'));var rimraf=require(_0x06df('0x1'));var zipdir=require(_0x06df('0x2'));var jsonpatch=require(_0x06df('0x3'));var rp=require(_0x06df('0x4'));var moment=require(_0x06df('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x06df('0x6'));var util=require(_0x06df('0x7'));var path=require(_0x06df('0x8'));var sox=require(_0x06df('0x9'));var csv=require(_0x06df('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06df('0xb'));var squel=require(_0x06df('0xc'));var crypto=require(_0x06df('0xd'));var jsforce=require(_0x06df('0xe'));var deskjs=require(_0x06df('0xf'));var toCsv=require(_0x06df('0xa'));var querystring=require(_0x06df('0x10'));var Papa=require(_0x06df('0x11'));var Redis=require(_0x06df('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x06df('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06df('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x06df('0x15'));var licenseUtil=require(_0x06df('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x06df('0x17')]));require(_0x06df('0x18'))[_0x06df('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x06df('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x06df('0x1a')][_0x06df('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1d1127,_0xe78dc1,_0x3c575d,_0x36592b){return new BPromise(function(_0x5d764c,_0x3faf70){var _0x7cc169=_0x36592b||client;return _0x7cc169[_0x06df('0x1c')](_0x1d1127,_0x3c575d)[_0x06df('0x1d')](function(_0xd36ac3){logger[_0x06df('0x1e')](_0x06df('0x1f'),_0xe78dc1,_0x06df('0x20'));logger[_0x06df('0x21')](_0x06df('0x22'),_0xe78dc1,_0x06df('0x20'),JSON[_0x06df('0x23')](_0xd36ac3));if(_0xd36ac3[_0x06df('0x24')]){if(_0xd36ac3[_0x06df('0x24')][_0x06df('0x25')]===0x1f4){logger[_0x06df('0x24')](_0x06df('0x1f'),_0xe78dc1,_0xd36ac3[_0x06df('0x24')]['message']);return _0x3faf70(_0xd36ac3[_0x06df('0x24')][_0x06df('0x26')]);}logger[_0x06df('0x24')](_0x06df('0x1f'),_0xe78dc1,_0xd36ac3[_0x06df('0x24')][_0x06df('0x26')]);return _0x5d764c(_0xd36ac3['error'][_0x06df('0x26')]);}else{logger[_0x06df('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0xe78dc1,_0x06df('0x20'));_0x5d764c(_0xd36ac3[_0x06df('0x27')][_0x06df('0x26')]);}})[_0x06df('0x28')](function(_0x331b81){logger[_0x06df('0x24')](_0x06df('0x1f'),_0xe78dc1,_0x331b81);_0x3faf70(_0x331b81);});});}function respondWithStatusCode(_0xd9f8c5,_0x52a134){_0x52a134=_0x52a134||0xcc;return function(_0x59ece1){if(_0x59ece1){return _0xd9f8c5[_0x06df('0x29')](_0x52a134);}return _0xd9f8c5[_0x06df('0x2a')](_0x52a134)['end']();};}function respondWithResult(_0x5eaaf9,_0x1de1cd){_0x1de1cd=_0x1de1cd||0xc8;return function(_0x5dc58e){if(_0x5dc58e){return _0x5eaaf9[_0x06df('0x2a')](_0x1de1cd)[_0x06df('0x2b')](_0x5dc58e);}};}function respondWithFilteredResult(_0x2cad6a,_0x36bc16){return function(_0x5c6a9c){if(_0x5c6a9c){var _0x145fb9=typeof _0x36bc16[_0x06df('0x2c')]===_0x06df('0x2d')&&typeof _0x36bc16[_0x06df('0x2e')]===_0x06df('0x2d');var _0x521a80=_0x5c6a9c[_0x06df('0x2f')];var _0x2c03ca=_0x145fb9?0x0:_0x36bc16[_0x06df('0x2c')];var _0x552e1e=_0x145fb9?_0x5c6a9c['count']:_0x36bc16[_0x06df('0x2c')]+_0x36bc16['limit'];var _0x31225a;if(_0x552e1e>=_0x521a80){_0x552e1e=_0x521a80;_0x31225a=0xc8;}else{_0x31225a=0xce;}_0x2cad6a['status'](_0x31225a);return _0x2cad6a[_0x06df('0x30')](_0x06df('0x31'),_0x2c03ca+'-'+_0x552e1e+'/'+_0x521a80)[_0x06df('0x2b')](_0x5c6a9c);}return null;};}function patchUpdates(_0x13bef3){return function(_0x4e70ba){try{jsonpatch['apply'](_0x4e70ba,_0x13bef3,!![]);}catch(_0x24efcb){return BPromise['reject'](_0x24efcb);}return _0x4e70ba[_0x06df('0x32')]();};}function saveUpdates(_0x36f7e0,_0x417731){return function(_0x49820e){if(_0x49820e){return _0x49820e['update'](_0x36f7e0)['then'](function(_0x372e02){return _0x372e02;});}return null;};}function removeEntity(_0x3a84bb,_0x354ca8){return function(_0x2511dd){if(_0x2511dd){return _0x2511dd[_0x06df('0x33')]()[_0x06df('0x1d')](function(){_0x3a84bb[_0x06df('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d4c1,_0x22ade6){return function(_0x5675c4){if(!_0x5675c4){_0x50d4c1[_0x06df('0x29')](0x194);}return _0x5675c4;};}function handleError(_0x405810,_0x5d5918){_0x5d5918=_0x5d5918||0x1f4;return function(_0x264344){logger[_0x06df('0x24')](_0x264344[_0x06df('0x34')]);if(_0x264344[_0x06df('0x35')]){delete _0x264344[_0x06df('0x35')];}_0x405810[_0x06df('0x2a')](_0x5d5918)[_0x06df('0x36')](_0x264344);};}exports['index']=function(_0x3e9f9d,_0x274af6){var _0x41ffe4={},_0x2e1c20={},_0x48de98={'count':0x0,'rows':[]};var _0x1b6edd=_[_0x06df('0x37')](db['OpenchannelMessage']['rawAttributes'],function(_0x2a542a){return{'name':_0x2a542a[_0x06df('0x38')],'type':_0x2a542a[_0x06df('0x39')][_0x06df('0x3a')]};});_0x2e1c20['model']=_[_0x06df('0x37')](_0x1b6edd,_0x06df('0x35'));_0x2e1c20[_0x06df('0x3b')]=_[_0x06df('0x3c')](_0x3e9f9d['query']);_0x2e1c20[_0x06df('0x3d')]=_['intersection'](_0x2e1c20[_0x06df('0x3e')],_0x2e1c20[_0x06df('0x3b')]);_0x41ffe4[_0x06df('0x3f')]=_[_0x06df('0x40')](_0x2e1c20['model'],qs[_0x06df('0x41')](_0x3e9f9d['query']['fields']));_0x41ffe4[_0x06df('0x3f')]=_0x41ffe4[_0x06df('0x3f')][_0x06df('0x42')]?_0x41ffe4[_0x06df('0x3f')]:_0x2e1c20[_0x06df('0x3e')];if(!_0x3e9f9d['query'][_0x06df('0x43')]('nolimit')){_0x41ffe4[_0x06df('0x2e')]=qs['limit'](_0x3e9f9d[_0x06df('0x3b')][_0x06df('0x2e')]);_0x41ffe4['offset']=qs[_0x06df('0x2c')](_0x3e9f9d[_0x06df('0x3b')][_0x06df('0x2c')]);}_0x41ffe4['order']=qs[_0x06df('0x44')](_0x3e9f9d[_0x06df('0x3b')][_0x06df('0x44')]);_0x41ffe4['where']=qs['filters'](_['pick'](_0x3e9f9d[_0x06df('0x3b')],_0x2e1c20[_0x06df('0x3d')]),_0x1b6edd);if(_0x3e9f9d[_0x06df('0x3b')]['filter']){_0x41ffe4[_0x06df('0x45')]=_[_0x06df('0x46')](_0x41ffe4[_0x06df('0x45')],{'$or':_[_0x06df('0x37')](_0x1b6edd,function(_0x221577){if(_0x221577[_0x06df('0x39')]!==_0x06df('0x47')){var _0x3c968d={};_0x3c968d[_0x221577['name']]={'$like':'%'+_0x3e9f9d[_0x06df('0x3b')][_0x06df('0x48')]+'%'};return _0x3c968d;}})});}_0x41ffe4=_[_0x06df('0x46')]({},_0x41ffe4,_0x3e9f9d[_0x06df('0x49')]);var _0x5c5bdd={'where':_0x41ffe4[_0x06df('0x45')]};return db[_0x06df('0x4a')][_0x06df('0x2f')](_0x5c5bdd)[_0x06df('0x1d')](function(_0x3a0380){_0x48de98[_0x06df('0x2f')]=_0x3a0380;if(_0x3e9f9d[_0x06df('0x3b')][_0x06df('0x4b')]){_0x41ffe4[_0x06df('0x4c')]=[{'all':!![]}];}return db[_0x06df('0x4a')][_0x06df('0x4d')](_0x41ffe4);})['then'](function(_0x3d0261){_0x48de98[_0x06df('0x4e')]=_0x3d0261;return _0x48de98;})['then'](respondWithFilteredResult(_0x274af6,_0x41ffe4))[_0x06df('0x28')](handleError(_0x274af6,null));};exports[_0x06df('0x4f')]=function(_0x1f13ec,_0x521d09){var _0x285d34={'raw':!![],'where':{'id':_0x1f13ec[_0x06df('0x50')]['id']}},_0x452389={};_0x452389[_0x06df('0x3e')]=_[_0x06df('0x3c')](db[_0x06df('0x4a')]['rawAttributes']);_0x452389[_0x06df('0x3b')]=_[_0x06df('0x3c')](_0x1f13ec[_0x06df('0x3b')]);_0x452389['filters']=_['intersection'](_0x452389['model'],_0x452389[_0x06df('0x3b')]);_0x285d34[_0x06df('0x3f')]=_[_0x06df('0x40')](_0x452389[_0x06df('0x3e')],qs[_0x06df('0x41')](_0x1f13ec[_0x06df('0x3b')][_0x06df('0x41')]));_0x285d34[_0x06df('0x3f')]=_0x285d34[_0x06df('0x3f')][_0x06df('0x42')]?_0x285d34[_0x06df('0x3f')]:_0x452389[_0x06df('0x3e')];if(_0x1f13ec[_0x06df('0x3b')][_0x06df('0x4b')]){_0x285d34[_0x06df('0x4c')]=[{'all':!![]}];}_0x285d34=_[_0x06df('0x46')]({},_0x285d34,_0x1f13ec['options']);return db[_0x06df('0x4a')][_0x06df('0x51')](_0x285d34)[_0x06df('0x1d')](handleEntityNotFound(_0x521d09,null))[_0x06df('0x1d')](respondWithResult(_0x521d09,null))[_0x06df('0x28')](handleError(_0x521d09,null));};exports[_0x06df('0x52')]=function(_0x57b193,_0xead96c){return db['OpenchannelMessage'][_0x06df('0x52')](_0x57b193[_0x06df('0x53')],{})[_0x06df('0x1d')](respondWithResult(_0xead96c,0xc9))['catch'](handleError(_0xead96c,null));};exports[_0x06df('0x54')]=function(_0x525a4c,_0x4d1cbb){if(_0x525a4c['body']['id']){delete _0x525a4c[_0x06df('0x53')]['id'];}return db[_0x06df('0x4a')]['find']({'where':{'id':_0x525a4c[_0x06df('0x50')]['id']}})[_0x06df('0x1d')](handleEntityNotFound(_0x4d1cbb,null))['then'](saveUpdates(_0x525a4c[_0x06df('0x53')],null))[_0x06df('0x1d')](respondWithResult(_0x4d1cbb,null))[_0x06df('0x28')](handleError(_0x4d1cbb,null));};exports[_0x06df('0x33')]=function(_0x46893d,_0x7c30bb){return db[_0x06df('0x4a')][_0x06df('0x51')]({'where':{'id':_0x46893d[_0x06df('0x50')]['id']}})['then'](handleEntityNotFound(_0x7c30bb,null))[_0x06df('0x1d')](removeEntity(_0x7c30bb,null))[_0x06df('0x28')](handleError(_0x7c30bb,null));};exports[_0x06df('0x55')]=function(_0x408414,_0x331b30){return db[_0x06df('0x4a')][_0x06df('0x55')]()[_0x06df('0x1d')](respondWithResult(_0x331b30,null))['catch'](handleError(_0x331b30,null));};var interaction_log=require('../../config/logger')(_0x06df('0x56'));exports[_0x06df('0x57')]=function(_0x30deb3,_0xa4124b,_0x5a075e){var _0x5baeda={'agent':{},'channel':_0x06df('0x58')};if(_0x30deb3[_0x06df('0x53')]['id']){delete _0x30deb3[_0x06df('0x53')]['id'];}_0x30deb3[_0x06df('0x53')][_0x06df('0x59')]=!![];_0x30deb3[_0x06df('0x53')][_0x06df('0x5a')]=moment()[_0x06df('0x5b')](_0x06df('0x5c'));_0x30deb3[_0x06df('0x53')][_0x06df('0x5d')]=_0x30deb3[_0x06df('0x53')]['UserId']||_0x30deb3[_0x06df('0x5e')]['id'];_0x5baeda[_0x06df('0x5f')]['id']=_0x30deb3['body']['UserId'];return db[_0x06df('0x4a')][_0x06df('0x51')]({'where':{'id':_0x30deb3[_0x06df('0x50')]['id'],'UserId':null}})[_0x06df('0x1d')](handleEntityNotFound(_0xa4124b,null))[_0x06df('0x1d')](saveUpdates(_0x30deb3[_0x06df('0x53')],null))[_0x06df('0x1d')](function(_0x282683){if(_0x282683){_0x5baeda['message']=_0x282683[_0x06df('0x60')]({'plain':!![]});return db[_0x06df('0x61')][_0x06df('0x51')]({'where':{'id':_0x282683[_0x06df('0x62')]}});}return null;})[_0x06df('0x1d')](handleEntityNotFound(_0xa4124b,null))[_0x06df('0x1d')](function(_0x4662c6){if(_0x4662c6){return _0x4662c6[_0x06df('0x54')]({'UserId':_0x30deb3[_0x06df('0x53')][_0x06df('0x5d')],'read1stAt':_['isNil'](_0x4662c6[_0x06df('0x63')])?moment()[_0x06df('0x5b')](_0x06df('0x5c')):undefined});}return null;})[_0x06df('0x1d')](function(_0x1adc15){if(_0x1adc15){_0x5baeda[_0x06df('0x64')]=_0x1adc15['get']({'plain':!![]});interaction_log['info'](_0x06df('0x65'),_0x30deb3['user']['id'],_0x30deb3[_0x06df('0x5e')]['name'],_0x30deb3['user'][_0x06df('0x66')],_0x5baeda[_0x06df('0x64')]['id'],_0x30deb3[_0x06df('0x53')]?JSON[_0x06df('0x23')](_0x30deb3[_0x06df('0x53')]):_0x06df('0x67'));return respondWithRpcPromise(_0x06df('0x68'),_0x06df('0x69'),_0x5baeda);}return null;})[_0x06df('0x1d')](function(_0x5e3882){var _0x15a5e8=_0x06df('0x6a')+_0x5e3882['message'][_0x06df('0x6b')];return db[_0x06df('0x6c')][_0x06df('0x3b')](_0x15a5e8,{'type':db[_0x06df('0x6d')][_0x06df('0x6e')]['SELECT'],'raw':!![]})[_0x06df('0x1d')](function(_0x1e86f9){return _0x1e86f9;});})[_0x06df('0x1d')](function(_0x53a70b){if(_0x53a70b){_0x5baeda[_0x06df('0x26')][_0x06df('0x6f')]=_0x53a70b[0x0];if(!_0x30deb3['body'][_0x06df('0x5d')])return;return db[_0x06df('0x70')][_0x06df('0x51')]({'where':{'id':_0x30deb3[_0x06df('0x53')][_0x06df('0x5d')],'role':'agent'},'attributes':['id',_0x06df('0x35'),'fullname',_0x06df('0x71'),_0x06df('0x72')],'raw':!![]});}return null;})[_0x06df('0x1d')](function(_0x432c4d){if(!_0x432c4d)return null;_0x5baeda[_0x06df('0x26')][_0x06df('0x5f')]=_0x432c4d;return _0x5baeda;})[_0x06df('0x1d')](function(_0x30fc1a){if(_0x30fc1a){if(_0x30deb3['body'][_0x06df('0x73')]){_0x5baeda[_0x06df('0x26')][_0x06df('0x74')]=util[_0x06df('0x5b')](_0x06df('0x75'),_0x30deb3[_0x06df('0x5e')][_0x06df('0x35')]);_0x5baeda['message'][_0x06df('0x76')]=_0x5baeda[_0x06df('0x76')];_0x5baeda['message']['motionChannel']=_0x5baeda[_0x06df('0x76')];_0x5baeda[_0x06df('0x26')][_0x06df('0x77')]=_0x06df('0x57');return respondWithRpcPromise(_0x06df('0x78'),'EventManager',{'event':_0x06df('0x79'),'message':_0x5baeda[_0x06df('0x26')]},client9002)[_0x06df('0x1d')](function(){return _0x5baeda;});}return _0x5baeda;}return null;})[_0x06df('0x1d')](respondWithResult(_0xa4124b,null))[_0x06df('0x28')](handleError(_0xa4124b,null));};var interaction_log=require(_0x06df('0x7a'))(_0x06df('0x56'));exports[_0x06df('0x7b')]=function(_0x5db89e,_0x27fff,_0x421781){var _0x58805e={'agent':{},'channel':'openchannel'};if(_0x5db89e['body']['id']){delete _0x5db89e[_0x06df('0x53')]['id'];}_0x5db89e[_0x06df('0x53')][_0x06df('0x5d')]=_0x5db89e[_0x06df('0x53')]['UserId']||_0x5db89e[_0x06df('0x5e')]['id'];_0x58805e[_0x06df('0x5f')]['id']=_0x5db89e[_0x06df('0x53')][_0x06df('0x5d')];return db[_0x06df('0x4a')][_0x06df('0x51')]({'where':{'id':_0x5db89e['params']['id'],'UserId':null}})[_0x06df('0x1d')](handleEntityNotFound(_0x27fff,null))['then'](function(_0x5d999a){if(_0x5d999a){_0x58805e[_0x06df('0x26')]=_0x5d999a[_0x06df('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x06df('0x51')]({'where':{'id':_0x5d999a[_0x06df('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x27fff,null))[_0x06df('0x1d')](function(_0x3949cc){if(_0x3949cc){_0x58805e[_0x06df('0x64')]=_0x3949cc[_0x06df('0x60')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5db89e['user']['id'],_0x5db89e['user'][_0x06df('0x35')],_0x5db89e[_0x06df('0x5e')][_0x06df('0x66')],_0x58805e[_0x06df('0x64')]['id'],_0x5db89e[_0x06df('0x53')]?JSON[_0x06df('0x23')](_0x5db89e[_0x06df('0x53')]):'null');return respondWithRpcPromise(_0x06df('0x7c'),_0x06df('0x7d'),_0x58805e);}return null;})[_0x06df('0x1d')](function(_0x3c8e33){var _0xd2c0f=_0x06df('0x6a')+_0x3c8e33[_0x06df('0x26')]['ContactId'];return db['sequelize']['query'](_0xd2c0f,{'type':db['Sequelize']['QueryTypes'][_0x06df('0x7e')],'raw':!![]})[_0x06df('0x1d')](function(_0x43262f){return _0x43262f;});})['then'](function(_0x53c861){if(_0x53c861){_0x58805e[_0x06df('0x26')][_0x06df('0x6f')]=_0x53c861[0x0];if(!_0x5db89e[_0x06df('0x53')]['UserId'])return;return db[_0x06df('0x70')]['find']({'where':{'id':_0x5db89e[_0x06df('0x53')][_0x06df('0x5d')],'role':_0x06df('0x5f')},'attributes':['id',_0x06df('0x35'),_0x06df('0x7f'),'email',_0x06df('0x72')],'raw':!![]});}return null;})[_0x06df('0x1d')](function(_0x29c8ce){if(!_0x29c8ce)return null;_0x58805e['message']['agent']=_0x29c8ce;return _0x58805e;})[_0x06df('0x1d')](function(_0x2bbca2){if(_0x2bbca2){_0x2bbca2[_0x06df('0x26')][_0x06df('0x74')]=util[_0x06df('0x5b')]('SIP/%s',_0x5db89e[_0x06df('0x5e')][_0x06df('0x35')]);_0x2bbca2[_0x06df('0x26')]['channel']=_0x58805e['channel'];_0x2bbca2[_0x06df('0x26')][_0x06df('0x80')]=_0x58805e[_0x06df('0x76')];_0x2bbca2[_0x06df('0x26')][_0x06df('0x77')]='reject';respondWithRpcPromise(_0x06df('0x78'),_0x06df('0x78'),{'event':_0x06df('0x81'),'message':_0x2bbca2[_0x06df('0x26')]},client9002);return _0x58805e;}return null;})['then'](respondWithResult(_0x27fff,null))[_0x06df('0x28')](handleError(_0x27fff,null));}; \ No newline at end of file +var _0xc84c=['rows','params','rawAttributes','find','create','body','update','describe','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','acceptmessage','openchannel','info','RejectMessage','rejectMessage','QueryTypes','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','name','send','index','map','OpenchannelMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x724cf0,_0x567a16){var _0x182f26=function(_0x736a71){while(--_0x736a71){_0x724cf0['push'](_0x724cf0['shift']());}};_0x182f26(++_0x567a16);}(_0xc84c,0x12f));var _0xcc84=function(_0x67143c,_0x433024){_0x67143c=_0x67143c-0x0;var _0x1dbbc3=_0xc84c[_0x67143c];return _0x1dbbc3;};'use strict';var emlformat=require(_0xcc84('0x0'));var rimraf=require(_0xcc84('0x1'));var zipdir=require(_0xcc84('0x2'));var jsonpatch=require(_0xcc84('0x3'));var rp=require(_0xcc84('0x4'));var moment=require('moment');var BPromise=require(_0xcc84('0x5'));var Mustache=require('mustache');var util=require(_0xcc84('0x6'));var path=require(_0xcc84('0x7'));var sox=require(_0xcc84('0x8'));var csv=require('to-csv');var ejs=require(_0xcc84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc84('0xa'));var squel=require('squel');var crypto=require(_0xcc84('0xb'));var jsforce=require(_0xcc84('0xc'));var deskjs=require(_0xcc84('0xd'));var toCsv=require(_0xcc84('0xe'));var querystring=require(_0xcc84('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcc84('0x10'));var qs=require(_0xcc84('0x11'));var as=require(_0xcc84('0x12'));var hardwareService=require(_0xcc84('0x13'));var logger=require(_0xcc84('0x14'))(_0xcc84('0x15'));var utils=require(_0xcc84('0x16'));var config=require(_0xcc84('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc84('0x18'))['db'];config['redis']=_[_0xcc84('0x19')](config[_0xcc84('0x1a')],{'host':_0xcc84('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc84('0x1a')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xcc84('0x1c')]({'port':0x232c});var client9002=jayson[_0xcc84('0x1d')][_0xcc84('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2014be,_0x2ad3cb,_0x1e25e0,_0x46fa5f){return new BPromise(function(_0x334ec8,_0x174755){var _0x19d27c=_0x46fa5f||client;return _0x19d27c[_0xcc84('0x1e')](_0x2014be,_0x1e25e0)[_0xcc84('0x1f')](function(_0x4da9ba){logger['info'](_0xcc84('0x20'),_0x2ad3cb,'request\x20sent');logger[_0xcc84('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2ad3cb,_0xcc84('0x22'),JSON[_0xcc84('0x23')](_0x4da9ba));if(_0x4da9ba[_0xcc84('0x24')]){if(_0x4da9ba['error']['code']===0x1f4){logger[_0xcc84('0x24')](_0xcc84('0x20'),_0x2ad3cb,_0x4da9ba[_0xcc84('0x24')][_0xcc84('0x25')]);return _0x174755(_0x4da9ba['error'][_0xcc84('0x25')]);}logger[_0xcc84('0x24')](_0xcc84('0x20'),_0x2ad3cb,_0x4da9ba[_0xcc84('0x24')][_0xcc84('0x25')]);return _0x334ec8(_0x4da9ba[_0xcc84('0x24')]['message']);}else{logger['info'](_0xcc84('0x20'),_0x2ad3cb,'request\x20sent');_0x334ec8(_0x4da9ba[_0xcc84('0x26')][_0xcc84('0x25')]);}})[_0xcc84('0x27')](function(_0x9837e2){logger['error'](_0xcc84('0x20'),_0x2ad3cb,_0x9837e2);_0x174755(_0x9837e2);});});}function respondWithStatusCode(_0xcc72f1,_0x1a08a9){_0x1a08a9=_0x1a08a9||0xcc;return function(_0x296f6b){if(_0x296f6b){return _0xcc72f1[_0xcc84('0x28')](_0x1a08a9);}return _0xcc72f1[_0xcc84('0x29')](_0x1a08a9)[_0xcc84('0x2a')]();};}function respondWithResult(_0x580435,_0x4c95f1){_0x4c95f1=_0x4c95f1||0xc8;return function(_0x286c4a){if(_0x286c4a){return _0x580435[_0xcc84('0x29')](_0x4c95f1)[_0xcc84('0x2b')](_0x286c4a);}};}function respondWithFilteredResult(_0x5357a7,_0x1ad165){return function(_0x2053ef){if(_0x2053ef){var _0x436e7b=typeof _0x1ad165[_0xcc84('0x2c')]===_0xcc84('0x2d')&&typeof _0x1ad165[_0xcc84('0x2e')]===_0xcc84('0x2d');var _0xc3443e=_0x2053ef[_0xcc84('0x2f')];var _0x3ea072=_0x436e7b?0x0:_0x1ad165[_0xcc84('0x2c')];var _0x20186c=_0x436e7b?_0x2053ef[_0xcc84('0x2f')]:_0x1ad165[_0xcc84('0x2c')]+_0x1ad165[_0xcc84('0x2e')];var _0x343587;if(_0x20186c>=_0xc3443e){_0x20186c=_0xc3443e;_0x343587=0xc8;}else{_0x343587=0xce;}_0x5357a7[_0xcc84('0x29')](_0x343587);return _0x5357a7[_0xcc84('0x30')](_0xcc84('0x31'),_0x3ea072+'-'+_0x20186c+'/'+_0xc3443e)[_0xcc84('0x2b')](_0x2053ef);}return null;};}function patchUpdates(_0x1586e3){return function(_0x341f23){try{jsonpatch[_0xcc84('0x32')](_0x341f23,_0x1586e3,!![]);}catch(_0x14d0ef){return BPromise[_0xcc84('0x33')](_0x14d0ef);}return _0x341f23[_0xcc84('0x34')]();};}function saveUpdates(_0x222949,_0x4852e2){return function(_0x5347e4){if(_0x5347e4){return _0x5347e4['update'](_0x222949)[_0xcc84('0x1f')](function(_0x26d699){return _0x26d699;});}return null;};}function removeEntity(_0x1c0c5f,_0x135550){return function(_0x520067){if(_0x520067){return _0x520067[_0xcc84('0x35')]()[_0xcc84('0x1f')](function(){_0x1c0c5f[_0xcc84('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c8c3,_0xa5c62e){return function(_0x530ef1){if(!_0x530ef1){_0x41c8c3[_0xcc84('0x28')](0x194);}return _0x530ef1;};}function handleError(_0x403531,_0x46a006){_0x46a006=_0x46a006||0x1f4;return function(_0x18e3ab){logger['error'](_0x18e3ab['stack']);if(_0x18e3ab[_0xcc84('0x36')]){delete _0x18e3ab['name'];}_0x403531[_0xcc84('0x29')](_0x46a006)[_0xcc84('0x37')](_0x18e3ab);};}exports[_0xcc84('0x38')]=function(_0x4a8267,_0x584f74){var _0x486e7f={},_0x67870a={},_0x39b278={'count':0x0,'rows':[]};var _0x3f2365=_[_0xcc84('0x39')](db[_0xcc84('0x3a')]['rawAttributes'],function(_0x2f1b9e){return{'name':_0x2f1b9e[_0xcc84('0x3b')],'type':_0x2f1b9e['type']['key']};});_0x67870a[_0xcc84('0x3c')]=_[_0xcc84('0x39')](_0x3f2365,_0xcc84('0x36'));_0x67870a[_0xcc84('0x3d')]=_[_0xcc84('0x3e')](_0x4a8267['query']);_0x67870a[_0xcc84('0x3f')]=_[_0xcc84('0x40')](_0x67870a[_0xcc84('0x3c')],_0x67870a[_0xcc84('0x3d')]);_0x486e7f[_0xcc84('0x41')]=_[_0xcc84('0x40')](_0x67870a[_0xcc84('0x3c')],qs['fields'](_0x4a8267[_0xcc84('0x3d')][_0xcc84('0x42')]));_0x486e7f['attributes']=_0x486e7f[_0xcc84('0x41')][_0xcc84('0x43')]?_0x486e7f[_0xcc84('0x41')]:_0x67870a[_0xcc84('0x3c')];if(!_0x4a8267[_0xcc84('0x3d')][_0xcc84('0x44')](_0xcc84('0x45'))){_0x486e7f[_0xcc84('0x2e')]=qs[_0xcc84('0x2e')](_0x4a8267[_0xcc84('0x3d')][_0xcc84('0x2e')]);_0x486e7f[_0xcc84('0x2c')]=qs[_0xcc84('0x2c')](_0x4a8267['query']['offset']);}_0x486e7f[_0xcc84('0x46')]=qs[_0xcc84('0x47')](_0x4a8267[_0xcc84('0x3d')][_0xcc84('0x47')]);_0x486e7f[_0xcc84('0x48')]=qs[_0xcc84('0x3f')](_[_0xcc84('0x49')](_0x4a8267[_0xcc84('0x3d')],_0x67870a[_0xcc84('0x3f')]),_0x3f2365);if(_0x4a8267['query'][_0xcc84('0x4a')]){_0x486e7f[_0xcc84('0x48')]=_[_0xcc84('0x4b')](_0x486e7f[_0xcc84('0x48')],{'$or':_[_0xcc84('0x39')](_0x3f2365,function(_0x45dfe9){if(_0x45dfe9['type']!==_0xcc84('0x4c')){var _0x3648cd={};_0x3648cd[_0x45dfe9['name']]={'$like':'%'+_0x4a8267[_0xcc84('0x3d')][_0xcc84('0x4a')]+'%'};return _0x3648cd;}})});}_0x486e7f=_['merge']({},_0x486e7f,_0x4a8267[_0xcc84('0x4d')]);var _0x13c17c={'where':_0x486e7f[_0xcc84('0x48')]};return db[_0xcc84('0x3a')]['count'](_0x13c17c)[_0xcc84('0x1f')](function(_0x1fdcd4){_0x39b278[_0xcc84('0x2f')]=_0x1fdcd4;if(_0x4a8267[_0xcc84('0x3d')][_0xcc84('0x4e')]){_0x486e7f[_0xcc84('0x4f')]=[{'all':!![]}];}return db[_0xcc84('0x3a')][_0xcc84('0x50')](_0x486e7f);})[_0xcc84('0x1f')](function(_0x5f24f){_0x39b278[_0xcc84('0x51')]=_0x5f24f;return _0x39b278;})[_0xcc84('0x1f')](respondWithFilteredResult(_0x584f74,_0x486e7f))[_0xcc84('0x27')](handleError(_0x584f74,null));};exports['show']=function(_0x5628ad,_0x362f15){var _0x51f567={'raw':!![],'where':{'id':_0x5628ad[_0xcc84('0x52')]['id']}},_0x595610={};_0x595610[_0xcc84('0x3c')]=_[_0xcc84('0x3e')](db[_0xcc84('0x3a')][_0xcc84('0x53')]);_0x595610[_0xcc84('0x3d')]=_[_0xcc84('0x3e')](_0x5628ad[_0xcc84('0x3d')]);_0x595610[_0xcc84('0x3f')]=_[_0xcc84('0x40')](_0x595610['model'],_0x595610['query']);_0x51f567['attributes']=_['intersection'](_0x595610[_0xcc84('0x3c')],qs['fields'](_0x5628ad[_0xcc84('0x3d')][_0xcc84('0x42')]));_0x51f567[_0xcc84('0x41')]=_0x51f567[_0xcc84('0x41')][_0xcc84('0x43')]?_0x51f567[_0xcc84('0x41')]:_0x595610[_0xcc84('0x3c')];if(_0x5628ad[_0xcc84('0x3d')]['includeAll']){_0x51f567[_0xcc84('0x4f')]=[{'all':!![]}];}_0x51f567=_[_0xcc84('0x4b')]({},_0x51f567,_0x5628ad['options']);return db[_0xcc84('0x3a')][_0xcc84('0x54')](_0x51f567)[_0xcc84('0x1f')](handleEntityNotFound(_0x362f15,null))['then'](respondWithResult(_0x362f15,null))[_0xcc84('0x27')](handleError(_0x362f15,null));};exports[_0xcc84('0x55')]=function(_0x2bdd3c,_0x5f1a05){return db[_0xcc84('0x3a')][_0xcc84('0x55')](_0x2bdd3c[_0xcc84('0x56')],{})['then'](respondWithResult(_0x5f1a05,0xc9))[_0xcc84('0x27')](handleError(_0x5f1a05,null));};exports[_0xcc84('0x57')]=function(_0x570d77,_0x14be68){if(_0x570d77['body']['id']){delete _0x570d77[_0xcc84('0x56')]['id'];}return db[_0xcc84('0x3a')][_0xcc84('0x54')]({'where':{'id':_0x570d77[_0xcc84('0x52')]['id']}})['then'](handleEntityNotFound(_0x14be68,null))[_0xcc84('0x1f')](saveUpdates(_0x570d77[_0xcc84('0x56')],null))['then'](respondWithResult(_0x14be68,null))['catch'](handleError(_0x14be68,null));};exports[_0xcc84('0x35')]=function(_0x3ea8f4,_0x673b01){return db['OpenchannelMessage'][_0xcc84('0x54')]({'where':{'id':_0x3ea8f4[_0xcc84('0x52')]['id']}})[_0xcc84('0x1f')](handleEntityNotFound(_0x673b01,null))[_0xcc84('0x1f')](removeEntity(_0x673b01,null))[_0xcc84('0x27')](handleError(_0x673b01,null));};exports[_0xcc84('0x58')]=function(_0x505c38,_0x54d5de){return db['OpenchannelMessage'][_0xcc84('0x58')]()[_0xcc84('0x1f')](respondWithResult(_0x54d5de,null))['catch'](handleError(_0x54d5de,null));};var interaction_log=require(_0xcc84('0x14'))('openchannel-interactions');exports[_0xcc84('0x59')]=function(_0x20fd10,_0x3e45ca,_0x3328a4){var _0x5a618c={'agent':{},'channel':'openchannel'};if(_0x20fd10[_0xcc84('0x56')]['id']){delete _0x20fd10[_0xcc84('0x56')]['id'];}_0x20fd10[_0xcc84('0x56')]['read']=!![];_0x20fd10[_0xcc84('0x56')][_0xcc84('0x5a')]=moment()['format'](_0xcc84('0x5b'));_0x20fd10[_0xcc84('0x56')][_0xcc84('0x5c')]=_0x20fd10[_0xcc84('0x56')][_0xcc84('0x5c')]||_0x20fd10['user']['id'];_0x5a618c['agent']['id']=_0x20fd10[_0xcc84('0x56')][_0xcc84('0x5c')];return db[_0xcc84('0x3a')][_0xcc84('0x54')]({'where':{'id':_0x20fd10[_0xcc84('0x52')]['id'],'UserId':null}})[_0xcc84('0x1f')](handleEntityNotFound(_0x3e45ca,null))[_0xcc84('0x1f')](saveUpdates(_0x20fd10[_0xcc84('0x56')],null))[_0xcc84('0x1f')](function(_0x364ef2){if(_0x364ef2){_0x5a618c[_0xcc84('0x25')]=_0x364ef2[_0xcc84('0x5d')]({'plain':!![]});return db[_0xcc84('0x5e')][_0xcc84('0x54')]({'where':{'id':_0x364ef2[_0xcc84('0x5f')]}});}return null;})[_0xcc84('0x1f')](handleEntityNotFound(_0x3e45ca,null))[_0xcc84('0x1f')](function(_0x8cdf4e){if(_0x8cdf4e){return _0x8cdf4e[_0xcc84('0x57')]({'UserId':_0x20fd10[_0xcc84('0x56')][_0xcc84('0x5c')],'read1stAt':_[_0xcc84('0x60')](_0x8cdf4e['read1stAt'])?moment()['format'](_0xcc84('0x5b')):undefined});}return null;})[_0xcc84('0x1f')](function(_0x40ba3c){if(_0x40ba3c){_0x5a618c[_0xcc84('0x61')]=_0x40ba3c[_0xcc84('0x5d')]({'plain':!![]});interaction_log['info'](_0xcc84('0x62'),_0x20fd10[_0xcc84('0x63')]['id'],_0x20fd10['user'][_0xcc84('0x36')],_0x20fd10[_0xcc84('0x63')][_0xcc84('0x64')],_0x5a618c['interaction']['id'],_0x20fd10[_0xcc84('0x56')]?JSON[_0xcc84('0x23')](_0x20fd10[_0xcc84('0x56')]):_0xcc84('0x65'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5a618c);}return null;})['then'](function(_0x4eb0e3){var _0x7c638f=_0xcc84('0x66')+_0x4eb0e3[_0xcc84('0x25')][_0xcc84('0x67')];return db[_0xcc84('0x68')][_0xcc84('0x3d')](_0x7c638f,{'type':db[_0xcc84('0x69')]['QueryTypes'][_0xcc84('0x6a')],'raw':!![]})[_0xcc84('0x1f')](function(_0x5d43d7){return _0x5d43d7;});})[_0xcc84('0x1f')](function(_0x9bd913){if(_0x9bd913){_0x5a618c['message'][_0xcc84('0x6b')]=_0x9bd913[0x0];if(!_0x20fd10['body']['UserId'])return;return db[_0xcc84('0x6c')][_0xcc84('0x54')]({'where':{'id':_0x20fd10[_0xcc84('0x56')]['UserId'],'role':_0xcc84('0x6d')},'attributes':['id',_0xcc84('0x36'),_0xcc84('0x6e'),_0xcc84('0x6f'),_0xcc84('0x70')],'raw':!![]});}return null;})[_0xcc84('0x1f')](function(_0x2f1877){if(!_0x2f1877)return null;_0x5a618c['message']['agent']=_0x2f1877;return _0x5a618c;})[_0xcc84('0x1f')](function(_0x450e6d){if(_0x450e6d){if(_0x20fd10[_0xcc84('0x56')][_0xcc84('0x71')]){_0x5a618c['message'][_0xcc84('0x72')]=util[_0xcc84('0x73')](_0xcc84('0x74'),_0x20fd10[_0xcc84('0x63')][_0xcc84('0x36')]);_0x5a618c[_0xcc84('0x25')][_0xcc84('0x75')]=_0x5a618c['channel'];_0x5a618c['message'][_0xcc84('0x76')]=_0x5a618c[_0xcc84('0x75')];_0x5a618c[_0xcc84('0x25')][_0xcc84('0x77')]=_0xcc84('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xcc84('0x78'),'message':_0x5a618c[_0xcc84('0x25')]},client9002)[_0xcc84('0x1f')](function(){return _0x5a618c;});}return _0x5a618c;}return null;})[_0xcc84('0x1f')](respondWithResult(_0x3e45ca,null))[_0xcc84('0x27')](handleError(_0x3e45ca,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xcc84('0x33')]=function(_0x26303d,_0x37b1e4,_0x259d18){var _0x33b4c0={'agent':{},'channel':_0xcc84('0x79')};if(_0x26303d['body']['id']){delete _0x26303d['body']['id'];}_0x26303d[_0xcc84('0x56')][_0xcc84('0x5c')]=_0x26303d[_0xcc84('0x56')][_0xcc84('0x5c')]||_0x26303d['user']['id'];_0x33b4c0[_0xcc84('0x6d')]['id']=_0x26303d[_0xcc84('0x56')][_0xcc84('0x5c')];return db[_0xcc84('0x3a')][_0xcc84('0x54')]({'where':{'id':_0x26303d[_0xcc84('0x52')]['id'],'UserId':null}})[_0xcc84('0x1f')](handleEntityNotFound(_0x37b1e4,null))[_0xcc84('0x1f')](function(_0x114e6f){if(_0x114e6f){_0x33b4c0['message']=_0x114e6f[_0xcc84('0x5d')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcc84('0x54')]({'where':{'id':_0x114e6f[_0xcc84('0x5f')]}});}return null;})[_0xcc84('0x1f')](handleEntityNotFound(_0x37b1e4,null))[_0xcc84('0x1f')](function(_0x335fbb){if(_0x335fbb){_0x33b4c0[_0xcc84('0x61')]=_0x335fbb[_0xcc84('0x5d')]({'plain':!![]});interaction_log[_0xcc84('0x7a')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26303d[_0xcc84('0x63')]['id'],_0x26303d[_0xcc84('0x63')][_0xcc84('0x36')],_0x26303d[_0xcc84('0x63')][_0xcc84('0x64')],_0x33b4c0['interaction']['id'],_0x26303d[_0xcc84('0x56')]?JSON[_0xcc84('0x23')](_0x26303d[_0xcc84('0x56')]):_0xcc84('0x65'));return respondWithRpcPromise(_0xcc84('0x7b'),_0xcc84('0x7c'),_0x33b4c0);}return null;})[_0xcc84('0x1f')](function(_0x2a21fa){var _0x18b687=_0xcc84('0x66')+_0x2a21fa[_0xcc84('0x25')][_0xcc84('0x67')];return db[_0xcc84('0x68')]['query'](_0x18b687,{'type':db['Sequelize'][_0xcc84('0x7d')]['SELECT'],'raw':!![]})[_0xcc84('0x1f')](function(_0x2f34d7){return _0x2f34d7;});})[_0xcc84('0x1f')](function(_0x31d276){if(_0x31d276){_0x33b4c0[_0xcc84('0x25')]['contact']=_0x31d276[0x0];if(!_0x26303d[_0xcc84('0x56')][_0xcc84('0x5c')])return;return db[_0xcc84('0x6c')][_0xcc84('0x54')]({'where':{'id':_0x26303d[_0xcc84('0x56')][_0xcc84('0x5c')],'role':'agent'},'attributes':['id',_0xcc84('0x36'),'fullname',_0xcc84('0x6f'),_0xcc84('0x70')],'raw':!![]});}return null;})['then'](function(_0x2fec5a){if(!_0x2fec5a)return null;_0x33b4c0[_0xcc84('0x25')]['agent']=_0x2fec5a;return _0x33b4c0;})[_0xcc84('0x1f')](function(_0x53902a){if(_0x53902a){_0x53902a['message']['interface']=util['format'](_0xcc84('0x74'),_0x26303d[_0xcc84('0x63')]['name']);_0x53902a['message'][_0xcc84('0x75')]=_0x33b4c0[_0xcc84('0x75')];_0x53902a[_0xcc84('0x25')][_0xcc84('0x76')]=_0x33b4c0[_0xcc84('0x75')];_0x53902a['message'][_0xcc84('0x77')]='reject';respondWithRpcPromise(_0xcc84('0x7e'),_0xcc84('0x7e'),{'event':_0xcc84('0x7f'),'message':_0x53902a['message']},client9002);return _0x33b4c0;}return null;})[_0xcc84('0x1f')](respondWithResult(_0x37b1e4,null))[_0xcc84('0x27')](handleError(_0x37b1e4,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a9e14e5..54aabc0 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 _0x0b74=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x0b74,0x19b));var _0x40b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b74[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x40b7('0x0'));var OpenchannelMessage=require(_0x40b7('0x1'))['db'][_0x40b7('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x40b7('0x3')](0x0);var events={'afterCreate':_0x40b7('0x4'),'afterUpdate':_0x40b7('0x5'),'afterDestroy':_0x40b7('0x6')};function emitEvent(_0x3e017d){return function(_0x2a1b92,_0x128d17,_0x45cd9e){OpenchannelMessageEvents[_0x40b7('0x7')](_0x3e017d+':'+_0x2a1b92['id'],_0x2a1b92);OpenchannelMessageEvents[_0x40b7('0x7')](_0x3e017d,_0x2a1b92);_0x45cd9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x40b7('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x74a7=['events','OpenchannelMessage','setMaxListeners','save','update','emit','hook','exports'];(function(_0x464ca8,_0x28b0f0){var _0x1c2f2c=function(_0x128a9c){while(--_0x128a9c){_0x464ca8['push'](_0x464ca8['shift']());}};_0x1c2f2c(++_0x28b0f0);}(_0x74a7,0x130));var _0x774a=function(_0x7b37e2,_0x135b7e){_0x7b37e2=_0x7b37e2-0x0;var _0x137808=_0x74a7[_0x7b37e2];return _0x137808;};'use strict';var EventEmitter=require(_0x774a('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x774a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x774a('0x2')](0x0);var events={'afterCreate':_0x774a('0x3'),'afterUpdate':_0x774a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58d0e3){return function(_0x1c59f6,_0x2f56d4,_0x1c603c){OpenchannelMessageEvents['emit'](_0x58d0e3+':'+_0x1c59f6['id'],_0x1c59f6);OpenchannelMessageEvents[_0x774a('0x5')](_0x58d0e3,_0x1c59f6);_0x1c603c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x774a('0x6')](e,emitEvent(event));}}module[_0x774a('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 193a8ea..c8eea90 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 _0x1993=['method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','describe','OpenchannelAccount','find','OpenchannelAccountId','CmContact','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1993,0x1d9));var _0x3199=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1993[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3199('0x0'));var util=require(_0x3199('0x1'));var logger=require(_0x3199('0x2'))(_0x3199('0x3'));var moment=require(_0x3199('0x4'));var BPromise=require(_0x3199('0x5'));var rp=require(_0x3199('0x6'));var fs=require('fs');var path=require(_0x3199('0x7'));var rimraf=require(_0x3199('0x8'));var config=require(_0x3199('0x9'));var attributes=require(_0x3199('0xa'));module[_0x3199('0xb')]=function(_0x118883,_0x43dd7e){return _0x118883[_0x3199('0xc')](_0x3199('0xd'),attributes,{'tableName':_0x3199('0xe'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x3199('0xf')],'type':_0x3199('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2418a1,_0x6a7f96,_0xe812c){var _0x4795d8=_0x118883[_0x3199('0x11')];var _0x412b1e=_0x2418a1[_0x3199('0x12')]({'plain':!![]});if(_0x412b1e[_0x3199('0x13')][_0x3199('0x14')]()==='in'||_0x412b1e['direction']['toLowerCase']()===_0x3199('0x15')&&!_0x412b1e['secret']&&!_['isNil'](_0x412b1e[_0x3199('0x16')])){_0x4795d8[_0x3199('0x17')][_0x3199('0x18')]({'where':{'id':_0x412b1e[_0x3199('0x19')]}})[_0x3199('0x1a')](function(_0x151de8){if(_0x151de8){_0x151de8[_0x3199('0x1b')]({'lastMsgAt':_0x412b1e[_0x3199('0x1c')],'lastMsgDirection':_0x412b1e[_0x3199('0x13')][_0x3199('0x14')]()});}})[_0x3199('0x1d')](function(_0x5e5666){console[_0x3199('0x1e')](_0x5e5666);});}if(_0x412b1e[_0x3199('0x13')]===_0x3199('0x15')&&!_0x412b1e[_0x3199('0x1f')]){var _0x38dbdf;_0x4795d8['CmContact'][_0x3199('0x20')]()['then'](function(_0x502a50){return _0x4795d8[_0x3199('0x21')][_0x3199('0x22')]({'where':{'id':_0x412b1e[_0x3199('0x23')]},'include':[{'model':_0x4795d8[_0x3199('0x17')],'as':'Interactions','where':{'id':_0x412b1e[_0x3199('0x19')]},'limit':0x1,'include':[{'model':_0x4795d8[_0x3199('0x24')],'as':_0x3199('0x25'),'attributes':_[_0x3199('0x26')](_0x502a50)}]}]});})[_0x3199('0x1a')](function(_0x5a223b){_0x38dbdf=_0x5a223b[_0x3199('0x12')]({'plain':!![]});if(_0x38dbdf&&_0x38dbdf[_0x3199('0x27')]){logger[_0x3199('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x3199('0x29'),util[_0x3199('0x2a')](_0x3199('0x2b'),_0x412b1e['id'],_0x38dbdf['replyUri']));if(_0x38dbdf[_0x3199('0x2c')]&&_0x38dbdf['Interactions'][_0x3199('0x2d')]){_0x412b1e[_0x3199('0x2e')]=_[_0x3199('0x2f')](_0x38dbdf['Interactions'][0x0],'Contact');_0x412b1e[_0x3199('0x25')]=_0x38dbdf['Interactions'][0x0][_0x3199('0x25')];}var _0x6a7f96={'method':_0x3199('0x30'),'uri':encodeURI(_0x38dbdf['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x6a7f96[_0x3199('0x31')]){case _0x3199('0x32'):_0x6a7f96['qs']=_0x412b1e;break;case _0x3199('0x30'):_0x6a7f96[_0x3199('0xf')]=_0x412b1e;break;}return rp(_0x6a7f96)[_0x3199('0x1a')](function(_0x1e24ff){logger[_0x3199('0x28')](_0x3199('0x33'),_0x3199('0x29'),util[_0x3199('0x2a')](_0x3199('0x34'),_0x412b1e['id'],_0x38dbdf['replyUri']));if(_0x1e24ff[_0x3199('0xf')][_0x3199('0x35')]&&_0x1e24ff['body'][_0x3199('0x35')]!=_0x412b1e['Interaction'][_0x3199('0x35')]){return _0x4795d8['OpenchannelInteraction'][_0x3199('0x1b')]({'threadId':_0x1e24ff['body']['threadId']},{'where':{'id':_0x412b1e[_0x3199('0x2e')]['id']}});}else{return;}})[_0x3199('0x1a')](function(){return _0x2418a1[_0x3199('0x1b')]({'read':!![]});})[_0x3199('0x1d')](function(_0x26e998){logger[_0x3199('0x1e')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x3199('0x36')](_0x26e998,{'showHidden':![],'depth':null}));_0xe812c();});}else{_0xe812c();}})[_0x3199('0x37')](function(){_0xe812c();});}else{_0xe812c();}}},'charset':_0x3199('0x38'),'collate':_0x3199('0x39')});}; \ No newline at end of file +var _0xbdcb=['models','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Interactions','length','omit','POST','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x16d6dc,_0x15731b){var _0x30e93a=function(_0xeff79c){while(--_0xeff79c){_0x16d6dc['push'](_0x16d6dc['shift']());}};_0x30e93a(++_0x15731b);}(_0xbdcb,0x91));var _0xbbdc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xbdcb[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xbbdc('0x0'));var util=require(_0xbbdc('0x1'));var logger=require(_0xbbdc('0x2'))(_0xbbdc('0x3'));var moment=require(_0xbbdc('0x4'));var BPromise=require(_0xbbdc('0x5'));var rp=require(_0xbbdc('0x6'));var fs=require('fs');var path=require(_0xbbdc('0x7'));var rimraf=require(_0xbbdc('0x8'));var config=require(_0xbbdc('0x9'));var attributes=require('./openchannelMessage.attributes');module[_0xbbdc('0xa')]=function(_0x290e34,_0x472456){return _0x290e34['define'](_0xbbdc('0xb'),attributes,{'tableName':_0xbbdc('0xc'),'paranoid':![],'indexes':[{'name':_0xbbdc('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ae4b4,_0xb0dbbf,_0x57770d){var _0xa93281=_0x290e34[_0xbbdc('0xe')];var _0x20d219=_0x3ae4b4['get']({'plain':!![]});if(_0x20d219[_0xbbdc('0xf')][_0xbbdc('0x10')]()==='in'||_0x20d219['direction'][_0xbbdc('0x10')]()==='out'&&!_0x20d219[_0xbbdc('0x11')]&&!_[_0xbbdc('0x12')](_0x20d219[_0xbbdc('0x13')])){_0xa93281[_0xbbdc('0x14')][_0xbbdc('0x15')]({'where':{'id':_0x20d219[_0xbbdc('0x16')]}})[_0xbbdc('0x17')](function(_0x5ac254){if(_0x5ac254){_0x5ac254['update']({'lastMsgAt':_0x20d219[_0xbbdc('0x18')],'lastMsgDirection':_0x20d219[_0xbbdc('0xf')]['toLowerCase']()});}})['catch'](function(_0x5d0a72){console[_0xbbdc('0x19')](_0x5d0a72);});}if(_0x20d219[_0xbbdc('0xf')]==='out'&&!_0x20d219[_0xbbdc('0x11')]){var _0x97f361;_0xa93281[_0xbbdc('0x1a')][_0xbbdc('0x1b')]()[_0xbbdc('0x17')](function(_0x5eb43f){return _0xa93281[_0xbbdc('0x1c')][_0xbbdc('0x1d')]({'where':{'id':_0x20d219[_0xbbdc('0x1e')]},'include':[{'model':_0xa93281['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x20d219[_0xbbdc('0x16')]},'limit':0x1,'include':[{'model':_0xa93281[_0xbbdc('0x1a')],'as':_0xbbdc('0x1f'),'attributes':_[_0xbbdc('0x20')](_0x5eb43f)}]}]});})['then'](function(_0x57f671){_0x97f361=_0x57f671[_0xbbdc('0x21')]({'plain':!![]});if(_0x97f361&&_0x97f361[_0xbbdc('0x22')]){logger[_0xbbdc('0x23')](_0xbbdc('0x24'),_0xbbdc('0x25'),util[_0xbbdc('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x20d219['id'],_0x97f361[_0xbbdc('0x22')]));if(_0x97f361[_0xbbdc('0x27')]&&_0x97f361[_0xbbdc('0x27')][_0xbbdc('0x28')]){_0x20d219['Interaction']=_[_0xbbdc('0x29')](_0x97f361['Interactions'][0x0],_0xbbdc('0x1f'));_0x20d219[_0xbbdc('0x1f')]=_0x97f361[_0xbbdc('0x27')][0x0][_0xbbdc('0x1f')];}var _0xb0dbbf={'method':_0xbbdc('0x2a'),'uri':encodeURI(_0x97f361[_0xbbdc('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xb0dbbf['method']){case'GET':_0xb0dbbf['qs']=_0x20d219;break;case _0xbbdc('0x2a'):_0xb0dbbf[_0xbbdc('0x2b')]=_0x20d219;break;}return rp(_0xb0dbbf)['then'](function(_0x524a33){logger[_0xbbdc('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xbbdc('0x25'),util[_0xbbdc('0x26')](_0xbbdc('0x2c'),_0x20d219['id'],_0x97f361[_0xbbdc('0x22')]));if(_0x524a33[_0xbbdc('0x2b')][_0xbbdc('0x2d')]&&_0x524a33[_0xbbdc('0x2b')][_0xbbdc('0x2d')]!=_0x20d219[_0xbbdc('0x2e')]['threadId']){return _0xa93281[_0xbbdc('0x14')][_0xbbdc('0x2f')]({'threadId':_0x524a33[_0xbbdc('0x2b')][_0xbbdc('0x2d')]},{'where':{'id':_0x20d219[_0xbbdc('0x2e')]['id']}});}else{return;}})['then'](function(){return _0x3ae4b4[_0xbbdc('0x2f')]({'read':!![]});})[_0xbbdc('0x30')](function(_0x20d793){logger['error'](_0xbbdc('0x24'),'afterCreate',util[_0xbbdc('0x31')](_0x20d793,{'showHidden':![],'depth':null}));_0x57770d();});}else{_0x57770d();}})[_0xbbdc('0x32')](function(){_0x57770d();});}else{_0x57770d();}}},'charset':_0xbbdc('0x33'),'collate':_0xbbdc('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6356368..dd916bb 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e7214,_0x4314b4){var _0x26cab9=function(_0x589451){while(--_0x589451){_0x1e7214['push'](_0x1e7214['shift']());}};_0x26cab9(++_0x4314b4);}(_0x7a54,0x106));var _0x47a5=function(_0x43f36a,_0x3b963c){_0x43f36a=_0x43f36a-0x0;var _0x4229ee=_0x7a54[_0x43f36a];return _0x4229ee;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x1399ad,_0x3ff467){var _0x23107a=function(_0x6d5ada){while(--_0x6d5ada){_0x1399ad['push'](_0x1399ad['shift']());}};_0x23107a(++_0x3ff467);}(_0xadb5,0xad));var _0x5adb=function(_0xc63ca4,_0x56bfb5){_0xc63ca4=_0xc63ca4-0x0;var _0x388567=_0xadb5[_0xc63ca4];return _0x388567;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index d3eb59e..03f6447 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 _0xaa65=['update','emit','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x1d9ec8,_0x4efe9e){var _0x110f21=function(_0x4e13bf){while(--_0x4e13bf){_0x1d9ec8['push'](_0x1d9ec8['shift']());}};_0x110f21(++_0x4efe9e);}(_0xaa65,0x90));var _0x5aa6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa65[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelMessageEvents=require(_0x5aa6('0x0'));var events=[_0x5aa6('0x1'),_0x5aa6('0x2'),_0x5aa6('0x3')];function createListener(_0x532887,_0x19de04){return function(_0x367bb7){_0x19de04[_0x5aa6('0x4')](_0x532887,_0x367bb7);};}function removeListener(_0xc44f5f,_0x210b97){return function(){OpenchannelMessageEvents['removeListener'](_0xc44f5f,_0x210b97);};}exports['register']=function(_0x2cad25){for(var _0x3161f3=0x0,_0xc9e300=events[_0x5aa6('0x5')];_0x3161f3<_0xc9e300;_0x3161f3++){var _0x5a2153=events[_0x3161f3];var _0x326ba3=createListener(_0x5aa6('0x6')+_0x5a2153,_0x2cad25);OpenchannelMessageEvents['on'](_0x5a2153,_0x326ba3);}}; \ No newline at end of file +var _0x0275=['register','length','openchannelMessage:','save','remove','emit','removeListener'];(function(_0x5f1cc9,_0x211bdb){var _0x5dad3d=function(_0x47beb6){while(--_0x47beb6){_0x5f1cc9['push'](_0x5f1cc9['shift']());}};_0x5dad3d(++_0x211bdb);}(_0x0275,0xc0));var _0x5027=function(_0xdf6483,_0x98d1cd){_0xdf6483=_0xdf6483-0x0;var _0x30884e=_0x0275[_0xdf6483];return _0x30884e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x5027('0x0'),_0x5027('0x1'),'update'];function createListener(_0x14a597,_0xee3d7f){return function(_0x2fb690){_0xee3d7f[_0x5027('0x2')](_0x14a597,_0x2fb690);};}function removeListener(_0x3fc04a,_0x400849){return function(){OpenchannelMessageEvents[_0x5027('0x3')](_0x3fc04a,_0x400849);};}exports[_0x5027('0x4')]=function(_0x375c16){for(var _0x3a8b12=0x0,_0x4bd2ec=events[_0x5027('0x5')];_0x3a8b12<_0x4bd2ec;_0x3a8b12++){var _0x515a13=events[_0x3a8b12];var _0x335fb3=createListener(_0x5027('0x6')+_0x515a13,_0x375c16);OpenchannelMessageEvents['on'](_0x515a13,_0x335fb3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d2dd455..b003b0d 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 _0x00ce=['create','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x122dc7,_0x1b4806){var _0x3987bc=function(_0x2003c7){while(--_0x2003c7){_0x122dc7['push'](_0x122dc7['shift']());}};_0x3987bc(++_0x1b4806);}(_0x00ce,0x1e6));var _0xe00c=function(_0x3fa486,_0x2c196e){_0x3fa486=_0x3fa486-0x0;var _0x44451d=_0x00ce[_0x3fa486];return _0x44451d;};'use strict';var multer=require(_0xe00c('0x0'));var util=require(_0xe00c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe00c('0x2'));var router=express[_0xe00c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe00c('0x4'));var interaction=require(_0xe00c('0x5'));var config=require(_0xe00c('0x6'));var controller=require(_0xe00c('0x7'));router[_0xe00c('0x8')]('/',auth[_0xe00c('0x9')](),controller[_0xe00c('0xa')]);router[_0xe00c('0x8')](_0xe00c('0xb'),auth[_0xe00c('0x9')](),controller[_0xe00c('0xc')]);router['get']('/:id',auth[_0xe00c('0x9')](),controller[_0xe00c('0xd')]);router[_0xe00c('0x8')](_0xe00c('0xe'),auth[_0xe00c('0x9')](),controller[_0xe00c('0xf')]);router[_0xe00c('0x8')](_0xe00c('0x10'),auth[_0xe00c('0x9')](),controller['getTeams']);router[_0xe00c('0x8')](_0xe00c('0x11'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xe00c('0x9')](),controller[_0xe00c('0x12')]);router[_0xe00c('0x13')]('/:id/teams',auth[_0xe00c('0x9')](),controller[_0xe00c('0x14')]);router['post']('/:id/users',auth[_0xe00c('0x9')](),controller[_0xe00c('0x15')]);router[_0xe00c('0x16')](_0xe00c('0x17'),auth[_0xe00c('0x9')](),controller['update']);router[_0xe00c('0x18')](_0xe00c('0x17'),auth[_0xe00c('0x9')](),controller[_0xe00c('0x19')]);router[_0xe00c('0x18')](_0xe00c('0x10'),auth[_0xe00c('0x9')](),controller[_0xe00c('0x1a')]);router[_0xe00c('0x18')](_0xe00c('0x11'),auth[_0xe00c('0x9')](),controller['removeAgents']);module[_0xe00c('0x1b')]=router; \ No newline at end of file +var _0x4542=['./openchannelQueue.controller','get','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3b7ef7,_0x6dd4ba){var _0x1ea173=function(_0x27b6b5){while(--_0x27b6b5){_0x3b7ef7['push'](_0x3b7ef7['shift']());}};_0x1ea173(++_0x6dd4ba);}(_0x4542,0x181));var _0x2454=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4542[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var path=require('path');var timeout=require(_0x2454('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2454('0x3'));var auth=require(_0x2454('0x4'));var interaction=require(_0x2454('0x5'));var config=require(_0x2454('0x6'));var controller=require(_0x2454('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2454('0x8')]('/describe',auth[_0x2454('0x9')](),controller['describe']);router[_0x2454('0x8')](_0x2454('0xa'),auth[_0x2454('0x9')](),controller[_0x2454('0xb')]);router[_0x2454('0x8')](_0x2454('0xc'),auth[_0x2454('0x9')](),controller[_0x2454('0xd')]);router['get']('/:id/teams',auth[_0x2454('0x9')](),controller[_0x2454('0xe')]);router['get'](_0x2454('0xf'),auth['isAuthenticated'](),controller[_0x2454('0x10')]);router[_0x2454('0x11')]('/',auth[_0x2454('0x9')](),controller[_0x2454('0x12')]);router['post'](_0x2454('0x13'),auth[_0x2454('0x9')](),controller[_0x2454('0x14')]);router[_0x2454('0x11')](_0x2454('0xf'),auth[_0x2454('0x9')](),controller[_0x2454('0x15')]);router[_0x2454('0x16')](_0x2454('0xa'),auth['isAuthenticated'](),controller[_0x2454('0x17')]);router[_0x2454('0x18')](_0x2454('0xa'),auth[_0x2454('0x9')](),controller[_0x2454('0x19')]);router[_0x2454('0x18')](_0x2454('0x13'),auth['isAuthenticated'](),controller[_0x2454('0x1a')]);router[_0x2454('0x18')](_0x2454('0xf'),auth[_0x2454('0x9')](),controller['removeAgents']);module[_0x2454('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 150f7f5..cafa969 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 _0x2e2e=['name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2e2e,0x109));var _0xe2e2=function(_0x422a61,_0x414349){_0x422a61=_0x422a61-0x0;var _0x3e8e28=_0x2e2e[_0x422a61];return _0x3e8e28;};'use strict';var Sequelize=require(_0xe2e2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe2e2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe2e2('0x2')]},'timeout':{'type':Sequelize[_0xe2e2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe2e2('0x4')]('rrmemory',_0xe2e2('0x5'),_0xe2e2('0x6'))}}; \ No newline at end of file +var _0x9efa=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x9efa,0x6d));var _0xa9ef=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9efa[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xa9ef('0x0'));module[_0xa9ef('0x1')]={'name':{'type':Sequelize[_0xa9ef('0x2')],'unique':_0xa9ef('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa9ef('0x2')]},'timeout':{'type':Sequelize[_0xa9ef('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa9ef('0x5')](_0xa9ef('0x6'),_0xa9ef('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 436ce67..990865a 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 _0x3d07=['set','Content-Range','apply','reject','then','destroy','get','OpenchannelQueues','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserOpenchannelQueue','nolimit','OpenchannelQueueId','User','findAndCountAll','openchannelPause','format','%s/%s','updatedAt','getTeams','addTeams','Team','findAll','Agents','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','compact','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit'];(function(_0x26a8e5,_0xacbc6e){var _0x1bc013=function(_0x430ec1){while(--_0x430ec1){_0x26a8e5['push'](_0x26a8e5['shift']());}};_0x1bc013(++_0xacbc6e);}(_0x3d07,0xe9));var _0x73d0=function(_0x154cbb,_0x43c57f){_0x154cbb=_0x154cbb-0x0;var _0x494584=_0x3d07[_0x154cbb];return _0x494584;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73d0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73d0('0x1'));var moment=require('moment');var BPromise=require(_0x73d0('0x2'));var Mustache=require(_0x73d0('0x3'));var util=require(_0x73d0('0x4'));var path=require(_0x73d0('0x5'));var sox=require(_0x73d0('0x6'));var csv=require(_0x73d0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73d0('0x8'));var _=require(_0x73d0('0x9'));var squel=require(_0x73d0('0xa'));var crypto=require(_0x73d0('0xb'));var jsforce=require(_0x73d0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x73d0('0x7'));var querystring=require(_0x73d0('0xd'));var Papa=require(_0x73d0('0xe'));var Redis=require(_0x73d0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x73d0('0x10'));var hardwareService=require(_0x73d0('0x11'));var logger=require(_0x73d0('0x12'))(_0x73d0('0x13'));var utils=require('../../config/utils');var config=require(_0x73d0('0x14'));var licenseUtil=require(_0x73d0('0x15'));var db=require(_0x73d0('0x16'))['db'];config[_0x73d0('0x17')]=_[_0x73d0('0x18')](config['redis'],{'host':_0x73d0('0x19'),'port':0x18eb});var socket=require(_0x73d0('0x1a'))(new Redis(config['redis']));require(_0x73d0('0x1b'))[_0x73d0('0x1c')](socket);function respondWithStatusCode(_0x2f2a34,_0x3e994b){_0x3e994b=_0x3e994b||0xcc;return function(_0x5b8718){if(_0x5b8718){return _0x2f2a34[_0x73d0('0x1d')](_0x3e994b);}return _0x2f2a34[_0x73d0('0x1e')](_0x3e994b)[_0x73d0('0x1f')]();};}function respondWithResult(_0x353b87,_0x50438f){_0x50438f=_0x50438f||0xc8;return function(_0x1da3f1){if(_0x1da3f1){return _0x353b87['status'](_0x50438f)[_0x73d0('0x20')](_0x1da3f1);}};}function respondWithFilteredResult(_0x43b1c4,_0x6c0910){return function(_0x320c43){if(_0x320c43){var _0x13ad9b=typeof _0x6c0910['offset']===_0x73d0('0x21')&&typeof _0x6c0910['limit']===_0x73d0('0x21');var _0x115eaa=_0x320c43[_0x73d0('0x22')];var _0x8fd880=_0x13ad9b?0x0:_0x6c0910[_0x73d0('0x23')];var _0x2b3f28=_0x13ad9b?_0x320c43[_0x73d0('0x22')]:_0x6c0910[_0x73d0('0x23')]+_0x6c0910[_0x73d0('0x24')];var _0x2955da;if(_0x2b3f28>=_0x115eaa){_0x2b3f28=_0x115eaa;_0x2955da=0xc8;}else{_0x2955da=0xce;}_0x43b1c4[_0x73d0('0x1e')](_0x2955da);return _0x43b1c4[_0x73d0('0x25')](_0x73d0('0x26'),_0x8fd880+'-'+_0x2b3f28+'/'+_0x115eaa)[_0x73d0('0x20')](_0x320c43);}return null;};}function patchUpdates(_0x2c4bc9){return function(_0x267941){try{jsonpatch[_0x73d0('0x27')](_0x267941,_0x2c4bc9,!![]);}catch(_0x338f16){return BPromise[_0x73d0('0x28')](_0x338f16);}return _0x267941['save']();};}function saveUpdates(_0x1f0fe8,_0x4e452c){return function(_0x5eda31){if(_0x5eda31){return _0x5eda31['update'](_0x1f0fe8)[_0x73d0('0x29')](function(_0x4b22dc){return _0x4b22dc;});}return null;};}function removeEntity(_0x217cbe,_0x26c3f9){return function(_0x246b3c){if(_0x246b3c){return _0x246b3c[_0x73d0('0x2a')]()[_0x73d0('0x29')](function(){var _0x404834=_0x246b3c[_0x73d0('0x2b')]({'plain':!![]});var _0xc3dc8d=_0x73d0('0x2c');return db['UserProfileResource'][_0x73d0('0x2a')]({'where':{'type':_0xc3dc8d,'resourceId':_0x404834['id']}})[_0x73d0('0x29')](function(){return _0x246b3c;});})['then'](function(){_0x217cbe['status'](0xcc)[_0x73d0('0x1f')]();});}};}function handleEntityNotFound(_0x4afce9,_0xf8b645){return function(_0x1fe621){if(!_0x1fe621){_0x4afce9[_0x73d0('0x1d')](0x194);}return _0x1fe621;};}function handleError(_0x25e47b,_0x1bf46f){_0x1bf46f=_0x1bf46f||0x1f4;return function(_0x138f26){logger[_0x73d0('0x2d')](_0x138f26[_0x73d0('0x2e')]);if(_0x138f26[_0x73d0('0x2f')]){delete _0x138f26[_0x73d0('0x2f')];}_0x25e47b[_0x73d0('0x1e')](_0x1bf46f)[_0x73d0('0x30')](_0x138f26);};}exports[_0x73d0('0x31')]=function(_0x23ba81,_0x5e246c){var _0x2e4fcc={},_0x6fc40c={},_0x4dc7fa={'count':0x0,'rows':[]};var _0x156638=_[_0x73d0('0x32')](db[_0x73d0('0x33')][_0x73d0('0x34')],function(_0x1e71ee){return{'name':_0x1e71ee['fieldName'],'type':_0x1e71ee[_0x73d0('0x35')]['key']};});_0x6fc40c[_0x73d0('0x36')]=_[_0x73d0('0x32')](_0x156638,_0x73d0('0x2f'));_0x6fc40c[_0x73d0('0x37')]=_['keys'](_0x23ba81[_0x73d0('0x37')]);_0x6fc40c[_0x73d0('0x38')]=_['intersection'](_0x6fc40c[_0x73d0('0x36')],_0x6fc40c[_0x73d0('0x37')]);_0x2e4fcc[_0x73d0('0x39')]=_[_0x73d0('0x3a')](_0x6fc40c['model'],qs[_0x73d0('0x3b')](_0x23ba81[_0x73d0('0x37')]['fields']));_0x2e4fcc[_0x73d0('0x39')]=_0x2e4fcc[_0x73d0('0x39')][_0x73d0('0x3c')]?_0x2e4fcc[_0x73d0('0x39')]:_0x6fc40c[_0x73d0('0x36')];if(!_0x23ba81[_0x73d0('0x37')][_0x73d0('0x3d')]('nolimit')){_0x2e4fcc['limit']=qs['limit'](_0x23ba81[_0x73d0('0x37')]['limit']);_0x2e4fcc[_0x73d0('0x23')]=qs['offset'](_0x23ba81[_0x73d0('0x37')][_0x73d0('0x23')]);}_0x2e4fcc[_0x73d0('0x3e')]=qs['sort'](_0x23ba81['query'][_0x73d0('0x3f')]);_0x2e4fcc[_0x73d0('0x40')]=qs[_0x73d0('0x38')](_[_0x73d0('0x41')](_0x23ba81['query'],_0x6fc40c[_0x73d0('0x38')]),_0x156638);if(_0x23ba81[_0x73d0('0x37')][_0x73d0('0x42')]){_0x2e4fcc[_0x73d0('0x40')]=_[_0x73d0('0x43')](_0x2e4fcc['where'],{'$or':_[_0x73d0('0x32')](_0x156638,function(_0x1d2c1b){if(_0x1d2c1b[_0x73d0('0x35')]!==_0x73d0('0x44')){var _0x5de135={};_0x5de135[_0x1d2c1b[_0x73d0('0x2f')]]={'$like':'%'+_0x23ba81['query'][_0x73d0('0x42')]+'%'};return _0x5de135;}})});}_0x2e4fcc=_[_0x73d0('0x43')]({},_0x2e4fcc,_0x23ba81[_0x73d0('0x45')]);var _0x36e625={'where':_0x2e4fcc[_0x73d0('0x40')]};return db[_0x73d0('0x33')][_0x73d0('0x22')](_0x36e625)[_0x73d0('0x29')](function(_0x4d3dd0){_0x4dc7fa[_0x73d0('0x22')]=_0x4d3dd0;if(_0x23ba81['query']['includeAll']){_0x2e4fcc[_0x73d0('0x46')]=[{'all':!![]}];}return db[_0x73d0('0x33')]['findAll'](_0x2e4fcc);})[_0x73d0('0x29')](function(_0x32b498){_0x4dc7fa[_0x73d0('0x47')]=_0x32b498;return _0x4dc7fa;})[_0x73d0('0x29')](respondWithFilteredResult(_0x5e246c,_0x2e4fcc))['catch'](handleError(_0x5e246c,null));};exports[_0x73d0('0x48')]=function(_0x83740f,_0x441259){var _0x420868={'raw':!![],'where':{'id':_0x83740f[_0x73d0('0x49')]['id']}},_0x565655={};_0x565655[_0x73d0('0x36')]=_[_0x73d0('0x4a')](db[_0x73d0('0x33')][_0x73d0('0x34')]);_0x565655[_0x73d0('0x37')]=_[_0x73d0('0x4a')](_0x83740f[_0x73d0('0x37')]);_0x565655[_0x73d0('0x38')]=_['intersection'](_0x565655['model'],_0x565655[_0x73d0('0x37')]);_0x420868[_0x73d0('0x39')]=_['intersection'](_0x565655['model'],qs['fields'](_0x83740f[_0x73d0('0x37')][_0x73d0('0x3b')]));_0x420868[_0x73d0('0x39')]=_0x420868[_0x73d0('0x39')][_0x73d0('0x3c')]?_0x420868[_0x73d0('0x39')]:_0x565655[_0x73d0('0x36')];if(_0x83740f['query'][_0x73d0('0x4b')]){_0x420868[_0x73d0('0x46')]=[{'all':!![]}];}_0x420868=_[_0x73d0('0x43')]({},_0x420868,_0x83740f['options']);return db[_0x73d0('0x33')]['find'](_0x420868)[_0x73d0('0x29')](handleEntityNotFound(_0x441259,null))[_0x73d0('0x29')](respondWithResult(_0x441259,null))[_0x73d0('0x4c')](handleError(_0x441259,null));};exports['create']=function(_0x3e099e,_0x1455e4){return db[_0x73d0('0x33')][_0x73d0('0x4d')](_0x3e099e[_0x73d0('0x4e')],{})[_0x73d0('0x29')](function(_0x1bf062){var _0x2e26ea=_0x3e099e[_0x73d0('0x4f')][_0x73d0('0x2b')]({'plain':!![]});if(!_0x2e26ea)throw new Error(_0x73d0('0x50'));if(_0x2e26ea[_0x73d0('0x51')]==='user'){var _0xfede8c=_0x1bf062[_0x73d0('0x2b')]({'plain':!![]});var _0x4d8eb2=_0x73d0('0x2c');return db[_0x73d0('0x52')][_0x73d0('0x53')]({'where':{'name':_0x4d8eb2,'userProfileId':_0x2e26ea[_0x73d0('0x54')]},'raw':!![]})['then'](function(_0x1c95d1){if(_0x1c95d1&&_0x1c95d1['autoAssociation']===0x0){return db['UserProfileResource'][_0x73d0('0x4d')]({'name':_0xfede8c[_0x73d0('0x2f')],'resourceId':_0xfede8c['id'],'type':_0x1c95d1[_0x73d0('0x2f')],'sectionId':_0x1c95d1['id']},{})['then'](function(){return _0x1bf062;});}else{return _0x1bf062;}})['catch'](function(_0x2d0872){logger[_0x73d0('0x2d')](_0x73d0('0x55'),_0x2d0872);throw _0x2d0872;});}return _0x1bf062;})['then'](respondWithResult(_0x1455e4,0xc9))[_0x73d0('0x4c')](handleError(_0x1455e4,null));};exports[_0x73d0('0x56')]=function(_0x3472ee,_0x51a401){if(_0x3472ee[_0x73d0('0x4e')]['id']){delete _0x3472ee['body']['id'];}return db['OpenchannelQueue'][_0x73d0('0x53')]({'where':{'id':_0x3472ee[_0x73d0('0x49')]['id']}})[_0x73d0('0x29')](handleEntityNotFound(_0x51a401,null))[_0x73d0('0x29')](saveUpdates(_0x3472ee[_0x73d0('0x4e')],null))[_0x73d0('0x29')](respondWithResult(_0x51a401,null))[_0x73d0('0x4c')](handleError(_0x51a401,null));};exports[_0x73d0('0x2a')]=function(_0x3deb58,_0x447ac8){return db[_0x73d0('0x33')][_0x73d0('0x53')]({'where':{'id':_0x3deb58[_0x73d0('0x49')]['id']}})[_0x73d0('0x29')](handleEntityNotFound(_0x447ac8,null))[_0x73d0('0x29')](removeEntity(_0x447ac8,null))[_0x73d0('0x4c')](handleError(_0x447ac8,null));};exports[_0x73d0('0x57')]=function(_0x2dfda2,_0x3f2840){return db['OpenchannelQueue'][_0x73d0('0x57')]()[_0x73d0('0x29')](respondWithResult(_0x3f2840,null))[_0x73d0('0x4c')](handleError(_0x3f2840,null));};exports['getMembers']=function(_0x5532b6,_0x31b35b,_0x29f150){var _0x16a3e8={'raw':!![],'where':{}},_0x150daf={},_0x2fbe32;return db[_0x73d0('0x33')][_0x73d0('0x58')]({'where':{'id':_0x5532b6[_0x73d0('0x49')]['id']}})[_0x73d0('0x29')](handleEntityNotFound(_0x31b35b,null))[_0x73d0('0x29')](function(_0x7b4f){if(_0x7b4f){_0x2fbe32=_0x7b4f['get']({'plain':!![]});_0x150daf[_0x73d0('0x36')]=_[_0x73d0('0x4a')](db[_0x73d0('0x59')]['rawAttributes']);_0x150daf[_0x73d0('0x37')]=_[_0x73d0('0x4a')](_0x5532b6['query']);_0x150daf[_0x73d0('0x38')]=_[_0x73d0('0x3a')](_0x150daf['model'],_0x150daf['query']);_0x16a3e8[_0x73d0('0x39')]=_['intersection'](_0x150daf[_0x73d0('0x36')],qs[_0x73d0('0x3b')](_0x5532b6[_0x73d0('0x37')][_0x73d0('0x3b')]));_0x16a3e8[_0x73d0('0x39')]=_0x16a3e8[_0x73d0('0x39')]['length']?_0x16a3e8['attributes']:_0x150daf[_0x73d0('0x36')];if(!_0x5532b6[_0x73d0('0x37')][_0x73d0('0x3d')](_0x73d0('0x5a'))){_0x16a3e8['limit']=qs[_0x73d0('0x24')](_0x5532b6['query'][_0x73d0('0x24')]);_0x16a3e8[_0x73d0('0x23')]=qs[_0x73d0('0x23')](_0x5532b6['query']['offset']);}_0x16a3e8[_0x73d0('0x3e')]=qs[_0x73d0('0x3f')](_0x5532b6[_0x73d0('0x37')][_0x73d0('0x3f')]);_0x16a3e8['where']=qs[_0x73d0('0x38')](_[_0x73d0('0x41')](_0x5532b6[_0x73d0('0x37')],_0x150daf[_0x73d0('0x38')]));_0x16a3e8[_0x73d0('0x40')][_0x73d0('0x5b')]=_0x7b4f['id'];if(_0x5532b6['query'][_0x73d0('0x42')]){_0x16a3e8['where']=_[_0x73d0('0x43')](_0x16a3e8[_0x73d0('0x40')],{'$or':_['map'](_0x16a3e8[_0x73d0('0x39')],function(_0x1d626a){var _0x171809={};_0x171809[_0x1d626a]={'$like':'%'+_0x5532b6['query']['filter']+'%'};return _0x171809;})});}_0x16a3e8=_[_0x73d0('0x43')]({},_0x16a3e8,_0x5532b6[_0x73d0('0x45')]);return db[_0x73d0('0x59')]['findAll'](_0x16a3e8);}})[_0x73d0('0x29')](function(_0x5a4cf6){if(_0x5a4cf6){return db[_0x73d0('0x5c')][_0x73d0('0x5d')]({'where':{'id':_[_0x73d0('0x32')](_0x5a4cf6,'UserId'),'role':'agent'},'attributes':['id',_0x73d0('0x2f'),_0x73d0('0x5e'),'updatedAt','createdAt']});}})['then'](function(_0x398b33){if(_0x398b33){return{'count':_0x398b33[_0x73d0('0x22')],'rows':_[_0x73d0('0x32')](_0x398b33['rows'],function(_0x400e8a){return{'membername':_0x400e8a['name'],'UserId':_0x400e8a['id'],'queue_name':_0x2fbe32[_0x73d0('0x2f')],'OpenchannelQueueId':_0x2fbe32['id'],'interface':util[_0x73d0('0x5f')](_0x73d0('0x60'),'SIP',_0x400e8a[_0x73d0('0x2f')]),'penalty':0x0,'paused':_0x400e8a[_0x73d0('0x5e')],'createdAt':_0x400e8a['createdAt'],'updatedAt':_0x400e8a[_0x73d0('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x73d0('0x29')](respondWithFilteredResult(_0x31b35b,_0x16a3e8))[_0x73d0('0x4c')](handleError(_0x31b35b,null));};exports[_0x73d0('0x62')]=function(_0x4c4cbe,_0x339597,_0x41eea2){var _0xa39b84={};var _0x42cd2c={};var _0x5ca4dc;var _0x44c086;return db['OpenchannelQueue'][_0x73d0('0x58')]({'where':{'id':_0x4c4cbe[_0x73d0('0x49')]['id']}})['then'](handleEntityNotFound(_0x339597,null))['then'](function(_0x18ab14){if(_0x18ab14){_0x5ca4dc=_0x18ab14;_0x42cd2c[_0x73d0('0x36')]=_[_0x73d0('0x4a')](db['Team']['rawAttributes']);_0x42cd2c['query']=_[_0x73d0('0x4a')](_0x4c4cbe[_0x73d0('0x37')]);_0x42cd2c[_0x73d0('0x38')]=_[_0x73d0('0x3a')](_0x42cd2c[_0x73d0('0x36')],_0x42cd2c[_0x73d0('0x37')]);_0xa39b84['attributes']=_[_0x73d0('0x3a')](_0x42cd2c[_0x73d0('0x36')],qs[_0x73d0('0x3b')](_0x4c4cbe[_0x73d0('0x37')][_0x73d0('0x3b')]));_0xa39b84[_0x73d0('0x39')]=_0xa39b84[_0x73d0('0x39')][_0x73d0('0x3c')]?_0xa39b84[_0x73d0('0x39')]:_0x42cd2c[_0x73d0('0x36')];_0xa39b84['order']=qs[_0x73d0('0x3f')](_0x4c4cbe[_0x73d0('0x37')][_0x73d0('0x3f')]);_0xa39b84['where']=qs[_0x73d0('0x38')](_['pick'](_0x4c4cbe[_0x73d0('0x37')],_0x42cd2c[_0x73d0('0x38')]));if(_0x4c4cbe['query'][_0x73d0('0x42')]){_0xa39b84[_0x73d0('0x40')]=_[_0x73d0('0x43')](_0xa39b84[_0x73d0('0x40')],{'$or':_[_0x73d0('0x32')](_0xa39b84[_0x73d0('0x39')],function(_0x539676){var _0x121d74={};_0x121d74[_0x539676]={'$like':'%'+_0x4c4cbe[_0x73d0('0x37')][_0x73d0('0x42')]+'%'};return _0x121d74;})});}_0xa39b84=_[_0x73d0('0x43')]({},_0xa39b84,_0x4c4cbe['options']);return _0x5ca4dc[_0x73d0('0x62')](_0xa39b84);}})['then'](function(_0x3d571e){if(_0x3d571e){_0x44c086=_0x3d571e['length'];if(!_0x4c4cbe['query']['hasOwnProperty'](_0x73d0('0x5a'))){_0xa39b84[_0x73d0('0x24')]=qs[_0x73d0('0x24')](_0x4c4cbe[_0x73d0('0x37')]['limit']);_0xa39b84['offset']=qs[_0x73d0('0x23')](_0x4c4cbe['query']['offset']);}return _0x5ca4dc[_0x73d0('0x62')](_0xa39b84);}})[_0x73d0('0x29')](function(_0x37400b){if(_0x37400b){return _0x37400b?{'count':_0x44c086,'rows':_0x37400b}:null;}})[_0x73d0('0x29')](respondWithResult(_0x339597,null))[_0x73d0('0x4c')](handleError(_0x339597,null));};exports[_0x73d0('0x63')]=function(_0x13f3fe,_0x5b9dd6,_0x39544a){var _0x1c92e8=_0x13f3fe['body']['ids'];return db[_0x73d0('0x64')][_0x73d0('0x65')]({'where':{'id':_0x1c92e8},'attributes':['id'],'include':[{'model':db[_0x73d0('0x5c')],'as':_0x73d0('0x66'),'attributes':['id',_0x73d0('0x2f'),'online','voicePause',_0x73d0('0x67')],'raw':!![]}]})[_0x73d0('0x29')](function(_0x5c1bbf){if(_0x5c1bbf){var _0x4228db=_[_0x73d0('0x68')](_0x5c1bbf,function(_0x35ef01){var _0x45c779=_0x35ef01[_0x73d0('0x2b')]({'plain':!![]});return _0x45c779[_0x73d0('0x66')];});return db[_0x73d0('0x33')]['find']({'where':{'id':_0x13f3fe[_0x73d0('0x49')]['id']}})['then'](function(_0x4fa754){return db['sequelize'][_0x73d0('0x69')](function(_0x2f5ca8){return _0x4fa754[_0x73d0('0x63')](_0x1c92e8,{'transaction':_0x2f5ca8})['then'](function(){return BPromise[_0x73d0('0x6a')](_0x4228db,function(_0x75458e){return db[_0x73d0('0x59')][_0x73d0('0x6b')]({'where':{'UserId':_0x75458e['id'],'OpenchannelQueueId':_0x13f3fe[_0x73d0('0x49')]['id']},'transaction':_0x2f5ca8});});})[_0x73d0('0x29')](function(){_0x4228db[_0x73d0('0x6c')](function(_0x4d68d3){socket[_0x73d0('0x6d')]('userOpenchannelQueue:save',{'UserId':_0x4d68d3['id'],'OpenchannelQueueId':_0x4fa754['id']});});});});});}})[_0x73d0('0x29')](respondWithStatusCode(_0x5b9dd6,null))[_0x73d0('0x4c')](handleError(_0x5b9dd6,null));};exports[_0x73d0('0x6e')]=function(_0x1f1ce4,_0x78234b,_0x2f1b7d){return db[_0x73d0('0x64')][_0x73d0('0x65')]({'where':{'id':_0x1f1ce4['query'][_0x73d0('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x73d0('0x66'),'attributes':['id'],'raw':!![]}]})[_0x73d0('0x29')](handleEntityNotFound(_0x78234b,null))[_0x73d0('0x29')](function(_0x24017d){var _0x53a16e=_['map'](_0x24017d,'id');var _0x9ebb4b=[];var _0x3256e5=[];var _0x208a2e=squel[_0x73d0('0x70')]();_0x208a2e[_0x73d0('0x71')](_0x73d0('0x72'))[_0x73d0('0x73')](_0x73d0('0x74'),'tq')['join'](_0x73d0('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x73d0('0x40')](_0x73d0('0x76'),_0x1f1ce4[_0x73d0('0x49')]['id']);for(var _0x244a64=0x0;_0x244a64<_0x24017d[_0x73d0('0x3c')];_0x244a64+=0x1){let _0x2555b7=_0x24017d[_0x244a64];for(var _0x23aa7e=0x0;_0x23aa7e<_0x2555b7[_0x73d0('0x66')][_0x73d0('0x3c')];_0x23aa7e+=0x1){let _0x22925e=_0x2555b7[_0x73d0('0x66')][_0x23aa7e];var _0x3ff90d=_0x208a2e['clone']();_0x3ff90d[_0x73d0('0x40')]('ut.UserId\x20=\x20?',_0x22925e['id']);_0x3256e5['push'](db[_0x73d0('0x77')][_0x73d0('0x37')](_0x3ff90d[_0x73d0('0x78')](),{'type':db[_0x73d0('0x77')][_0x73d0('0x79')][_0x73d0('0x7a')]})[_0x73d0('0x29')](function(_0x2473b0){if(_0x2473b0['length']===0x1){return _0x22925e['id'];}else{var _0x131474=_['every'](_[_0x73d0('0x32')](_0x2473b0,_0x73d0('0x7b')),function(_0xee74a3){return _[_0x73d0('0x7c')](_0x53a16e,_0xee74a3);});if(_0x131474){return _0x22925e['id'];}}}));}}return BPromise[_0x73d0('0x7d')](_0x3256e5)['then'](function(_0x1061de){_0x9ebb4b=_(_0x9ebb4b)['union'](_0x1061de)[_0x73d0('0x7e')]()['value']();return db['OpenchannelQueue'][_0x73d0('0x53')]({'where':{'id':_0x1f1ce4[_0x73d0('0x49')]['id']}})['then'](function(_0x27fa47){return db[_0x73d0('0x77')][_0x73d0('0x69')](function(_0x52a066){return _0x27fa47[_0x73d0('0x6e')](_0x1f1ce4['query']['ids'],{'transaction':_0x52a066})['then'](function(){if(!_[_0x73d0('0x7f')](_0x9ebb4b)){return _0x27fa47['removeAgents'](_0x9ebb4b,{'transaction':_0x52a066});}})[_0x73d0('0x29')](function(){_0x9ebb4b[_0x73d0('0x6c')](function(_0x7513ef){socket[_0x73d0('0x6d')](_0x73d0('0x80'),{'UserId':_0x7513ef,'OpenchannelQueueId':_0x27fa47['id']});});});});});});})['then'](respondWithStatusCode(_0x78234b,null))[_0x73d0('0x4c')](handleError(_0x78234b,null));};exports[_0x73d0('0x81')]=function(_0x4ab403,_0x27f586,_0x3f4aad){return db[_0x73d0('0x33')][_0x73d0('0x53')]({'where':{'id':_0x4ab403[_0x73d0('0x49')]['id']}})[_0x73d0('0x29')](handleEntityNotFound(_0x27f586,null))[_0x73d0('0x29')](function(_0x1c1a16){if(_0x1c1a16){return _0x1c1a16[_0x73d0('0x81')](_0x4ab403[_0x73d0('0x4e')]['ids'],_[_0x73d0('0x82')](_0x4ab403[_0x73d0('0x4e')],['ids','id'])||{})[_0x73d0('0x83')](function(_0x104e79){for(var _0x2438f6=0x0;_0x2438f6<_0x4ab403[_0x73d0('0x4e')][_0x73d0('0x6f')]['length'];_0x2438f6+=0x1){socket[_0x73d0('0x6d')]('userOpenchannelQueue:save',{'UserId':Number(_0x4ab403[_0x73d0('0x4e')][_0x73d0('0x6f')][_0x2438f6]),'OpenchannelQueueId':Number(_0x4ab403['params']['id'])});}return _0x104e79;});}})['then'](respondWithResult(_0x27f586,null))['catch'](handleError(_0x27f586,null));};exports['removeAgents']=function(_0x3c03f8,_0x7ad730,_0x20f47e){return db[_0x73d0('0x33')][_0x73d0('0x53')]({'where':{'id':_0x3c03f8[_0x73d0('0x49')]['id']}})[_0x73d0('0x29')](handleEntityNotFound(_0x7ad730,null))[_0x73d0('0x29')](function(_0x476b44){if(_0x476b44){return _0x476b44[_0x73d0('0x84')](_0x3c03f8[_0x73d0('0x37')][_0x73d0('0x6f')])['then'](function(){if(_[_0x73d0('0x85')](_0x3c03f8['query']['ids'])){for(var _0x2f129e=0x0;_0x2f129e<_0x3c03f8[_0x73d0('0x37')][_0x73d0('0x6f')][_0x73d0('0x3c')];_0x2f129e+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x3c03f8['query']['ids'][_0x2f129e]),'OpenchannelQueueId':Number(_0x3c03f8['params']['id'])});}}else{socket[_0x73d0('0x6d')](_0x73d0('0x80'),{'UserId':Number(_0x3c03f8[_0x73d0('0x37')][_0x73d0('0x6f')]),'OpenchannelQueueId':Number(_0x3c03f8['params']['id'])});}});}})[_0x73d0('0x29')](respondWithStatusCode(_0x7ad730,null))[_0x73d0('0x4c')](handleError(_0x7ad730,null));};exports[_0x73d0('0x86')]=function(_0x5f209a,_0x46944e,_0x1505eb){var _0x22cd35={};var _0x1f7ffe={};var _0x597ba5;var _0x2a006b;return db[_0x73d0('0x33')][_0x73d0('0x58')]({'where':{'id':_0x5f209a[_0x73d0('0x49')]['id']}})[_0x73d0('0x29')](handleEntityNotFound(_0x46944e,null))['then'](function(_0x6287ba){if(_0x6287ba){_0x597ba5=_0x6287ba;_0x1f7ffe[_0x73d0('0x36')]=_[_0x73d0('0x4a')](db[_0x73d0('0x5c')][_0x73d0('0x34')]);_0x1f7ffe[_0x73d0('0x37')]=_['keys'](_0x5f209a[_0x73d0('0x37')]);_0x1f7ffe[_0x73d0('0x38')]=_['intersection'](_0x1f7ffe[_0x73d0('0x36')],_0x1f7ffe[_0x73d0('0x37')]);_0x22cd35[_0x73d0('0x39')]=_['intersection'](_0x1f7ffe['model'],qs['fields'](_0x5f209a['query'][_0x73d0('0x3b')]));_0x22cd35['attributes']=_0x22cd35['attributes'][_0x73d0('0x3c')]?_0x22cd35[_0x73d0('0x39')]:_0x1f7ffe['model'];_0x22cd35[_0x73d0('0x3e')]=qs[_0x73d0('0x3f')](_0x5f209a[_0x73d0('0x37')][_0x73d0('0x3f')]);_0x22cd35[_0x73d0('0x40')]=qs[_0x73d0('0x38')](_[_0x73d0('0x41')](_0x5f209a['query'],_0x1f7ffe['filters']));if(_0x5f209a['query'][_0x73d0('0x42')]){_0x22cd35['where']=_['merge'](_0x22cd35[_0x73d0('0x40')],{'$or':_[_0x73d0('0x32')](_0x22cd35[_0x73d0('0x39')],function(_0x43aeb2){var _0xcf0271={};_0xcf0271[_0x43aeb2]={'$like':'%'+_0x5f209a['query'][_0x73d0('0x42')]+'%'};return _0xcf0271;})});}_0x22cd35=_[_0x73d0('0x43')]({},_0x22cd35,_0x5f209a[_0x73d0('0x45')]);return _0x597ba5[_0x73d0('0x86')](_0x22cd35);}})[_0x73d0('0x29')](function(_0x3a2db4){if(_0x3a2db4){_0x2a006b=_0x3a2db4[_0x73d0('0x3c')];if(!_0x5f209a[_0x73d0('0x37')][_0x73d0('0x3d')](_0x73d0('0x5a'))){_0x22cd35[_0x73d0('0x24')]=qs[_0x73d0('0x24')](_0x5f209a['query'][_0x73d0('0x24')]);_0x22cd35[_0x73d0('0x23')]=qs[_0x73d0('0x23')](_0x5f209a[_0x73d0('0x37')]['offset']);}return _0x597ba5[_0x73d0('0x86')](_0x22cd35);}})['then'](function(_0x5a06f4){if(_0x5a06f4){return _0x5a06f4?{'count':_0x2a006b,'rows':_0x5a06f4}:null;}})[_0x73d0('0x29')](respondWithResult(_0x46944e,null))[_0x73d0('0x4c')](handleError(_0x46944e,null));}; \ No newline at end of file +var _0x052e=['count','set','Content-Range','reject','update','get','OpenchannelQueues','UserProfileResource','destroy','then','end','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','OpenchannelQueue','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','nolimit','addTeams','Team','findAll','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','addAgents','omit','spread','removeAgents','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','json','offset','undefined'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x052e,0x6a));var _0xe052=function(_0x5a6de0,_0xea7091){_0x5a6de0=_0x5a6de0-0x0;var _0x2513dc=_0x052e[_0x5a6de0];return _0x2513dc;};'use strict';var emlformat=require(_0xe052('0x0'));var rimraf=require(_0xe052('0x1'));var zipdir=require(_0xe052('0x2'));var jsonpatch=require(_0xe052('0x3'));var rp=require(_0xe052('0x4'));var moment=require(_0xe052('0x5'));var BPromise=require(_0xe052('0x6'));var Mustache=require(_0xe052('0x7'));var util=require('util');var path=require(_0xe052('0x8'));var sox=require(_0xe052('0x9'));var csv=require(_0xe052('0xa'));var ejs=require(_0xe052('0xb'));var fs=require('fs');var fs_extra=require(_0xe052('0xc'));var _=require(_0xe052('0xd'));var squel=require(_0xe052('0xe'));var crypto=require(_0xe052('0xf'));var jsforce=require(_0xe052('0x10'));var deskjs=require(_0xe052('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe052('0x12'));var Papa=require(_0xe052('0x13'));var Redis=require(_0xe052('0x14'));var authService=require(_0xe052('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe052('0x16'));var utils=require(_0xe052('0x17'));var config=require(_0xe052('0x18'));var licenseUtil=require(_0xe052('0x19'));var db=require(_0xe052('0x1a'))['db'];config[_0xe052('0x1b')]=_[_0xe052('0x1c')](config['redis'],{'host':_0xe052('0x1d'),'port':0x18eb});var socket=require(_0xe052('0x1e'))(new Redis(config[_0xe052('0x1b')]));require(_0xe052('0x1f'))[_0xe052('0x20')](socket);function respondWithStatusCode(_0x47b008,_0xea7c51){_0xea7c51=_0xea7c51||0xcc;return function(_0xd91704){if(_0xd91704){return _0x47b008['sendStatus'](_0xea7c51);}return _0x47b008[_0xe052('0x21')](_0xea7c51)['end']();};}function respondWithResult(_0x508154,_0xf0ae13){_0xf0ae13=_0xf0ae13||0xc8;return function(_0x4d5d7a){if(_0x4d5d7a){return _0x508154['status'](_0xf0ae13)[_0xe052('0x22')](_0x4d5d7a);}};}function respondWithFilteredResult(_0x466042,_0x4ffdc9){return function(_0x5dcacf){if(_0x5dcacf){var _0x474107=typeof _0x4ffdc9[_0xe052('0x23')]===_0xe052('0x24')&&typeof _0x4ffdc9['limit']===_0xe052('0x24');var _0x1312a9=_0x5dcacf[_0xe052('0x25')];var _0x57cd51=_0x474107?0x0:_0x4ffdc9[_0xe052('0x23')];var _0x236a11=_0x474107?_0x5dcacf[_0xe052('0x25')]:_0x4ffdc9['offset']+_0x4ffdc9['limit'];var _0x3ddd77;if(_0x236a11>=_0x1312a9){_0x236a11=_0x1312a9;_0x3ddd77=0xc8;}else{_0x3ddd77=0xce;}_0x466042[_0xe052('0x21')](_0x3ddd77);return _0x466042[_0xe052('0x26')](_0xe052('0x27'),_0x57cd51+'-'+_0x236a11+'/'+_0x1312a9)['json'](_0x5dcacf);}return null;};}function patchUpdates(_0x5ddd63){return function(_0x3712a0){try{jsonpatch['apply'](_0x3712a0,_0x5ddd63,!![]);}catch(_0x6c12eb){return BPromise[_0xe052('0x28')](_0x6c12eb);}return _0x3712a0['save']();};}function saveUpdates(_0xe034e6,_0x26f5a9){return function(_0x5d3314){if(_0x5d3314){return _0x5d3314[_0xe052('0x29')](_0xe034e6)['then'](function(_0x2686ee){return _0x2686ee;});}return null;};}function removeEntity(_0x417525,_0x47b5cf){return function(_0x39dcb6){if(_0x39dcb6){return _0x39dcb6['destroy']()['then'](function(){var _0x329eca=_0x39dcb6[_0xe052('0x2a')]({'plain':!![]});var _0x8a17e0=_0xe052('0x2b');return db[_0xe052('0x2c')][_0xe052('0x2d')]({'where':{'type':_0x8a17e0,'resourceId':_0x329eca['id']}})[_0xe052('0x2e')](function(){return _0x39dcb6;});})[_0xe052('0x2e')](function(){_0x417525['status'](0xcc)[_0xe052('0x2f')]();});}};}function handleEntityNotFound(_0x4295b1,_0x5bc3f4){return function(_0x3efaac){if(!_0x3efaac){_0x4295b1['sendStatus'](0x194);}return _0x3efaac;};}function handleError(_0x1835fd,_0x1a493e){_0x1a493e=_0x1a493e||0x1f4;return function(_0x54af5e){logger[_0xe052('0x30')](_0x54af5e[_0xe052('0x31')]);if(_0x54af5e[_0xe052('0x32')]){delete _0x54af5e[_0xe052('0x32')];}_0x1835fd[_0xe052('0x21')](_0x1a493e)['send'](_0x54af5e);};}exports[_0xe052('0x33')]=function(_0x340ae9,_0x529ef2){var _0x1b6a9b={},_0x2ad70a={},_0x483ecb={'count':0x0,'rows':[]};var _0x14b933=_[_0xe052('0x34')](db['OpenchannelQueue'][_0xe052('0x35')],function(_0x31a68e){return{'name':_0x31a68e['fieldName'],'type':_0x31a68e[_0xe052('0x36')][_0xe052('0x37')]};});_0x2ad70a[_0xe052('0x38')]=_['map'](_0x14b933,_0xe052('0x32'));_0x2ad70a[_0xe052('0x39')]=_[_0xe052('0x3a')](_0x340ae9[_0xe052('0x39')]);_0x2ad70a['filters']=_[_0xe052('0x3b')](_0x2ad70a[_0xe052('0x38')],_0x2ad70a['query']);_0x1b6a9b[_0xe052('0x3c')]=_[_0xe052('0x3b')](_0x2ad70a[_0xe052('0x38')],qs['fields'](_0x340ae9[_0xe052('0x39')][_0xe052('0x3d')]));_0x1b6a9b[_0xe052('0x3c')]=_0x1b6a9b[_0xe052('0x3c')][_0xe052('0x3e')]?_0x1b6a9b[_0xe052('0x3c')]:_0x2ad70a['model'];if(!_0x340ae9['query']['hasOwnProperty']('nolimit')){_0x1b6a9b[_0xe052('0x3f')]=qs[_0xe052('0x3f')](_0x340ae9['query'][_0xe052('0x3f')]);_0x1b6a9b[_0xe052('0x23')]=qs['offset'](_0x340ae9['query'][_0xe052('0x23')]);}_0x1b6a9b[_0xe052('0x40')]=qs[_0xe052('0x41')](_0x340ae9['query'][_0xe052('0x41')]);_0x1b6a9b['where']=qs[_0xe052('0x42')](_[_0xe052('0x43')](_0x340ae9['query'],_0x2ad70a['filters']),_0x14b933);if(_0x340ae9[_0xe052('0x39')][_0xe052('0x44')]){_0x1b6a9b['where']=_[_0xe052('0x45')](_0x1b6a9b[_0xe052('0x46')],{'$or':_[_0xe052('0x34')](_0x14b933,function(_0x592035){if(_0x592035[_0xe052('0x36')]!==_0xe052('0x47')){var _0x5c10a9={};_0x5c10a9[_0x592035['name']]={'$like':'%'+_0x340ae9[_0xe052('0x39')][_0xe052('0x44')]+'%'};return _0x5c10a9;}})});}_0x1b6a9b=_['merge']({},_0x1b6a9b,_0x340ae9[_0xe052('0x48')]);var _0x41e45b={'where':_0x1b6a9b[_0xe052('0x46')]};return db['OpenchannelQueue'][_0xe052('0x25')](_0x41e45b)['then'](function(_0x587a06){_0x483ecb[_0xe052('0x25')]=_0x587a06;if(_0x340ae9[_0xe052('0x39')][_0xe052('0x49')]){_0x1b6a9b['include']=[{'all':!![]}];}return db[_0xe052('0x4a')]['findAll'](_0x1b6a9b);})[_0xe052('0x2e')](function(_0x1481b0){_0x483ecb[_0xe052('0x4b')]=_0x1481b0;return _0x483ecb;})['then'](respondWithFilteredResult(_0x529ef2,_0x1b6a9b))[_0xe052('0x4c')](handleError(_0x529ef2,null));};exports[_0xe052('0x4d')]=function(_0x318db8,_0x20ecaa){var _0x317890={'raw':!![],'where':{'id':_0x318db8[_0xe052('0x4e')]['id']}},_0x4c7673={};_0x4c7673['model']=_['keys'](db[_0xe052('0x4a')][_0xe052('0x35')]);_0x4c7673['query']=_[_0xe052('0x3a')](_0x318db8['query']);_0x4c7673['filters']=_[_0xe052('0x3b')](_0x4c7673[_0xe052('0x38')],_0x4c7673['query']);_0x317890[_0xe052('0x3c')]=_['intersection'](_0x4c7673[_0xe052('0x38')],qs[_0xe052('0x3d')](_0x318db8[_0xe052('0x39')][_0xe052('0x3d')]));_0x317890[_0xe052('0x3c')]=_0x317890[_0xe052('0x3c')][_0xe052('0x3e')]?_0x317890[_0xe052('0x3c')]:_0x4c7673[_0xe052('0x38')];if(_0x318db8[_0xe052('0x39')][_0xe052('0x49')]){_0x317890['include']=[{'all':!![]}];}_0x317890=_['merge']({},_0x317890,_0x318db8['options']);return db[_0xe052('0x4a')][_0xe052('0x4f')](_0x317890)[_0xe052('0x2e')](handleEntityNotFound(_0x20ecaa,null))[_0xe052('0x2e')](respondWithResult(_0x20ecaa,null))['catch'](handleError(_0x20ecaa,null));};exports[_0xe052('0x50')]=function(_0x35274e,_0x52018f){return db[_0xe052('0x4a')][_0xe052('0x50')](_0x35274e['body'],{})[_0xe052('0x2e')](function(_0x2d0e9c){var _0x553d95=_0x35274e['user'][_0xe052('0x2a')]({'plain':!![]});if(!_0x553d95)throw new Error(_0xe052('0x51'));if(_0x553d95[_0xe052('0x52')]===_0xe052('0x53')){var _0x3191e8=_0x2d0e9c[_0xe052('0x2a')]({'plain':!![]});var _0x56a571=_0xe052('0x2b');return db[_0xe052('0x54')][_0xe052('0x4f')]({'where':{'name':_0x56a571,'userProfileId':_0x553d95[_0xe052('0x55')]},'raw':!![]})[_0xe052('0x2e')](function(_0x5d9f02){if(_0x5d9f02&&_0x5d9f02['autoAssociation']===0x0){return db[_0xe052('0x2c')][_0xe052('0x50')]({'name':_0x3191e8[_0xe052('0x32')],'resourceId':_0x3191e8['id'],'type':_0x5d9f02[_0xe052('0x32')],'sectionId':_0x5d9f02['id']},{})[_0xe052('0x2e')](function(){return _0x2d0e9c;});}else{return _0x2d0e9c;}})[_0xe052('0x4c')](function(_0x53073f){logger[_0xe052('0x30')](_0xe052('0x56'),_0x53073f);throw _0x53073f;});}return _0x2d0e9c;})[_0xe052('0x2e')](respondWithResult(_0x52018f,0xc9))[_0xe052('0x4c')](handleError(_0x52018f,null));};exports[_0xe052('0x29')]=function(_0x553e3f,_0x2bf805){if(_0x553e3f['body']['id']){delete _0x553e3f[_0xe052('0x57')]['id'];}return db[_0xe052('0x4a')]['find']({'where':{'id':_0x553e3f[_0xe052('0x4e')]['id']}})[_0xe052('0x2e')](handleEntityNotFound(_0x2bf805,null))['then'](saveUpdates(_0x553e3f['body'],null))[_0xe052('0x2e')](respondWithResult(_0x2bf805,null))['catch'](handleError(_0x2bf805,null));};exports[_0xe052('0x2d')]=function(_0x217fd2,_0x207c7e){return db[_0xe052('0x4a')]['find']({'where':{'id':_0x217fd2['params']['id']}})[_0xe052('0x2e')](handleEntityNotFound(_0x207c7e,null))[_0xe052('0x2e')](removeEntity(_0x207c7e,null))['catch'](handleError(_0x207c7e,null));};exports['describe']=function(_0x4ef787,_0x5b9908){return db[_0xe052('0x4a')][_0xe052('0x58')]()[_0xe052('0x2e')](respondWithResult(_0x5b9908,null))[_0xe052('0x4c')](handleError(_0x5b9908,null));};exports[_0xe052('0x59')]=function(_0x54295c,_0x4348b1,_0x26b8ea){var _0x1a3643={'raw':!![],'where':{}},_0x18f63b={},_0x4bb3e9;return db[_0xe052('0x4a')][_0xe052('0x5a')]({'where':{'id':_0x54295c[_0xe052('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4348b1,null))[_0xe052('0x2e')](function(_0x229e7f){if(_0x229e7f){_0x4bb3e9=_0x229e7f[_0xe052('0x2a')]({'plain':!![]});_0x18f63b[_0xe052('0x38')]=_[_0xe052('0x3a')](db['UserOpenchannelQueue']['rawAttributes']);_0x18f63b[_0xe052('0x39')]=_[_0xe052('0x3a')](_0x54295c['query']);_0x18f63b[_0xe052('0x42')]=_[_0xe052('0x3b')](_0x18f63b[_0xe052('0x38')],_0x18f63b[_0xe052('0x39')]);_0x1a3643['attributes']=_[_0xe052('0x3b')](_0x18f63b[_0xe052('0x38')],qs[_0xe052('0x3d')](_0x54295c[_0xe052('0x39')][_0xe052('0x3d')]));_0x1a3643['attributes']=_0x1a3643[_0xe052('0x3c')]['length']?_0x1a3643[_0xe052('0x3c')]:_0x18f63b['model'];if(!_0x54295c[_0xe052('0x39')][_0xe052('0x5b')]('nolimit')){_0x1a3643[_0xe052('0x3f')]=qs[_0xe052('0x3f')](_0x54295c[_0xe052('0x39')][_0xe052('0x3f')]);_0x1a3643[_0xe052('0x23')]=qs[_0xe052('0x23')](_0x54295c[_0xe052('0x39')][_0xe052('0x23')]);}_0x1a3643[_0xe052('0x40')]=qs['sort'](_0x54295c[_0xe052('0x39')][_0xe052('0x41')]);_0x1a3643['where']=qs[_0xe052('0x42')](_['pick'](_0x54295c[_0xe052('0x39')],_0x18f63b[_0xe052('0x42')]));_0x1a3643[_0xe052('0x46')]['OpenchannelQueueId']=_0x229e7f['id'];if(_0x54295c[_0xe052('0x39')][_0xe052('0x44')]){_0x1a3643[_0xe052('0x46')]=_['merge'](_0x1a3643['where'],{'$or':_[_0xe052('0x34')](_0x1a3643['attributes'],function(_0x104fa4){var _0x3c7fd2={};_0x3c7fd2[_0x104fa4]={'$like':'%'+_0x54295c[_0xe052('0x39')][_0xe052('0x44')]+'%'};return _0x3c7fd2;})});}_0x1a3643=_['merge']({},_0x1a3643,_0x54295c[_0xe052('0x48')]);return db[_0xe052('0x5c')]['findAll'](_0x1a3643);}})[_0xe052('0x2e')](function(_0x41546f){if(_0x41546f){return db[_0xe052('0x5d')][_0xe052('0x5e')]({'where':{'id':_[_0xe052('0x34')](_0x41546f,'UserId'),'role':_0xe052('0x5f')},'attributes':['id',_0xe052('0x32'),_0xe052('0x60'),_0xe052('0x61'),_0xe052('0x62')]});}})[_0xe052('0x2e')](function(_0x437e7b){if(_0x437e7b){return{'count':_0x437e7b[_0xe052('0x25')],'rows':_[_0xe052('0x34')](_0x437e7b[_0xe052('0x4b')],function(_0x3c6fc9){return{'membername':_0x3c6fc9[_0xe052('0x32')],'UserId':_0x3c6fc9['id'],'queue_name':_0x4bb3e9[_0xe052('0x32')],'OpenchannelQueueId':_0x4bb3e9['id'],'interface':util['format'](_0xe052('0x63'),_0xe052('0x64'),_0x3c6fc9[_0xe052('0x32')]),'penalty':0x0,'paused':_0x3c6fc9['openchannelPause'],'createdAt':_0x3c6fc9[_0xe052('0x62')],'updatedAt':_0x3c6fc9[_0xe052('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe052('0x2e')](respondWithFilteredResult(_0x4348b1,_0x1a3643))['catch'](handleError(_0x4348b1,null));};exports[_0xe052('0x65')]=function(_0x2cbc84,_0x32e5ba,_0x1ecb33){var _0x5dc756={};var _0x448ad3={};var _0x223728;var _0x593707;return db[_0xe052('0x4a')][_0xe052('0x5a')]({'where':{'id':_0x2cbc84['params']['id']}})[_0xe052('0x2e')](handleEntityNotFound(_0x32e5ba,null))[_0xe052('0x2e')](function(_0x3d1096){if(_0x3d1096){_0x223728=_0x3d1096;_0x448ad3[_0xe052('0x38')]=_[_0xe052('0x3a')](db['Team'][_0xe052('0x35')]);_0x448ad3['query']=_[_0xe052('0x3a')](_0x2cbc84[_0xe052('0x39')]);_0x448ad3['filters']=_[_0xe052('0x3b')](_0x448ad3[_0xe052('0x38')],_0x448ad3['query']);_0x5dc756['attributes']=_[_0xe052('0x3b')](_0x448ad3['model'],qs[_0xe052('0x3d')](_0x2cbc84[_0xe052('0x39')][_0xe052('0x3d')]));_0x5dc756[_0xe052('0x3c')]=_0x5dc756['attributes'][_0xe052('0x3e')]?_0x5dc756['attributes']:_0x448ad3[_0xe052('0x38')];_0x5dc756[_0xe052('0x40')]=qs[_0xe052('0x41')](_0x2cbc84[_0xe052('0x39')]['sort']);_0x5dc756['where']=qs[_0xe052('0x42')](_[_0xe052('0x43')](_0x2cbc84[_0xe052('0x39')],_0x448ad3[_0xe052('0x42')]));if(_0x2cbc84[_0xe052('0x39')][_0xe052('0x44')]){_0x5dc756[_0xe052('0x46')]=_[_0xe052('0x45')](_0x5dc756[_0xe052('0x46')],{'$or':_['map'](_0x5dc756[_0xe052('0x3c')],function(_0x47d6c3){var _0x45b925={};_0x45b925[_0x47d6c3]={'$like':'%'+_0x2cbc84[_0xe052('0x39')][_0xe052('0x44')]+'%'};return _0x45b925;})});}_0x5dc756=_[_0xe052('0x45')]({},_0x5dc756,_0x2cbc84[_0xe052('0x48')]);return _0x223728[_0xe052('0x65')](_0x5dc756);}})[_0xe052('0x2e')](function(_0x4fb084){if(_0x4fb084){_0x593707=_0x4fb084['length'];if(!_0x2cbc84[_0xe052('0x39')][_0xe052('0x5b')](_0xe052('0x66'))){_0x5dc756[_0xe052('0x3f')]=qs[_0xe052('0x3f')](_0x2cbc84[_0xe052('0x39')][_0xe052('0x3f')]);_0x5dc756['offset']=qs[_0xe052('0x23')](_0x2cbc84[_0xe052('0x39')][_0xe052('0x23')]);}return _0x223728[_0xe052('0x65')](_0x5dc756);}})['then'](function(_0x321fed){if(_0x321fed){return _0x321fed?{'count':_0x593707,'rows':_0x321fed}:null;}})[_0xe052('0x2e')](respondWithResult(_0x32e5ba,null))['catch'](handleError(_0x32e5ba,null));};exports[_0xe052('0x67')]=function(_0x42c094,_0x507fa1,_0x11f3ba){var _0x2a198f=_0x42c094[_0xe052('0x57')]['ids'];return db[_0xe052('0x68')][_0xe052('0x69')]({'where':{'id':_0x2a198f},'attributes':['id'],'include':[{'model':db[_0xe052('0x5d')],'as':_0xe052('0x6a'),'attributes':['id',_0xe052('0x32'),_0xe052('0x6b'),_0xe052('0x6c'),_0xe052('0x6d')],'raw':!![]}]})['then'](function(_0x38bddd){if(_0x38bddd){var _0x1dcc68=_['flatMap'](_0x38bddd,function(_0x277250){var _0x23b633=_0x277250['get']({'plain':!![]});return _0x23b633[_0xe052('0x6a')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x42c094[_0xe052('0x4e')]['id']}})[_0xe052('0x2e')](function(_0x1696a5){return db[_0xe052('0x6e')][_0xe052('0x6f')](function(_0x3a3e5a){return _0x1696a5['addTeams'](_0x2a198f,{'transaction':_0x3a3e5a})['then'](function(){return BPromise[_0xe052('0x70')](_0x1dcc68,function(_0x258e41){return db[_0xe052('0x5c')][_0xe052('0x71')]({'where':{'UserId':_0x258e41['id'],'OpenchannelQueueId':_0x42c094[_0xe052('0x4e')]['id']},'transaction':_0x3a3e5a});});})[_0xe052('0x2e')](function(){_0x1dcc68[_0xe052('0x72')](function(_0x2117ce){socket[_0xe052('0x73')](_0xe052('0x74'),{'UserId':_0x2117ce['id'],'OpenchannelQueueId':_0x1696a5['id']});});});});});}})[_0xe052('0x2e')](respondWithStatusCode(_0x507fa1,null))[_0xe052('0x4c')](handleError(_0x507fa1,null));};exports[_0xe052('0x75')]=function(_0x10840e,_0x48b4a5,_0x156b77){return db['Team']['findAll']({'where':{'id':_0x10840e['query'][_0xe052('0x76')]},'attributes':['id'],'include':[{'model':db[_0xe052('0x5d')],'as':_0xe052('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xe052('0x2e')](handleEntityNotFound(_0x48b4a5,null))[_0xe052('0x2e')](function(_0x2dae4c){var _0x2b17af=_[_0xe052('0x34')](_0x2dae4c,'id');var _0x2f9863=[];var _0x1deb91=[];var _0x2d8f66=squel[_0xe052('0x77')]();_0x2d8f66['field'](_0xe052('0x78'))[_0xe052('0x79')](_0xe052('0x7a'),'tq')[_0xe052('0x7b')](_0xe052('0x7c'),'ut',_0xe052('0x7d'))[_0xe052('0x46')](_0xe052('0x7e'),_0x10840e['params']['id']);for(var _0x390a33=0x0;_0x390a33<_0x2dae4c[_0xe052('0x3e')];_0x390a33+=0x1){let _0x176d48=_0x2dae4c[_0x390a33];for(var _0x1b0f21=0x0;_0x1b0f21<_0x176d48['Agents']['length'];_0x1b0f21+=0x1){let _0x2c72e2=_0x176d48[_0xe052('0x6a')][_0x1b0f21];var _0x3e4009=_0x2d8f66['clone']();_0x3e4009[_0xe052('0x46')]('ut.UserId\x20=\x20?',_0x2c72e2['id']);_0x1deb91[_0xe052('0x7f')](db[_0xe052('0x6e')][_0xe052('0x39')](_0x3e4009[_0xe052('0x80')](),{'type':db['sequelize'][_0xe052('0x81')][_0xe052('0x82')]})[_0xe052('0x2e')](function(_0x498351){if(_0x498351[_0xe052('0x3e')]===0x1){return _0x2c72e2['id'];}else{var _0x250930=_[_0xe052('0x83')](_[_0xe052('0x34')](_0x498351,_0xe052('0x84')),function(_0x5801db){return _[_0xe052('0x85')](_0x2b17af,_0x5801db);});if(_0x250930){return _0x2c72e2['id'];}}}));}}return BPromise[_0xe052('0x86')](_0x1deb91)[_0xe052('0x2e')](function(_0x36f8f7){_0x2f9863=_(_0x2f9863)[_0xe052('0x87')](_0x36f8f7)[_0xe052('0x88')]()['value']();return db[_0xe052('0x4a')]['find']({'where':{'id':_0x10840e[_0xe052('0x4e')]['id']}})[_0xe052('0x2e')](function(_0x2ad526){return db['sequelize'][_0xe052('0x6f')](function(_0x26019d){return _0x2ad526[_0xe052('0x75')](_0x10840e[_0xe052('0x39')][_0xe052('0x76')],{'transaction':_0x26019d})[_0xe052('0x2e')](function(){if(!_['isEmpty'](_0x2f9863)){return _0x2ad526['removeAgents'](_0x2f9863,{'transaction':_0x26019d});}})[_0xe052('0x2e')](function(){_0x2f9863[_0xe052('0x72')](function(_0x46c916){socket[_0xe052('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x46c916,'OpenchannelQueueId':_0x2ad526['id']});});});});});});})['then'](respondWithStatusCode(_0x48b4a5,null))[_0xe052('0x4c')](handleError(_0x48b4a5,null));};exports[_0xe052('0x89')]=function(_0x36af62,_0x34df4e,_0x385615){return db[_0xe052('0x4a')]['find']({'where':{'id':_0x36af62[_0xe052('0x4e')]['id']}})[_0xe052('0x2e')](handleEntityNotFound(_0x34df4e,null))[_0xe052('0x2e')](function(_0x736d01){if(_0x736d01){return _0x736d01['addAgents'](_0x36af62['body']['ids'],_[_0xe052('0x8a')](_0x36af62[_0xe052('0x57')],['ids','id'])||{})[_0xe052('0x8b')](function(_0x253b01){for(var _0x24d9a6=0x0;_0x24d9a6<_0x36af62['body']['ids'][_0xe052('0x3e')];_0x24d9a6+=0x1){socket[_0xe052('0x73')](_0xe052('0x74'),{'UserId':Number(_0x36af62[_0xe052('0x57')]['ids'][_0x24d9a6]),'OpenchannelQueueId':Number(_0x36af62[_0xe052('0x4e')]['id'])});}return _0x253b01;});}})['then'](respondWithResult(_0x34df4e,null))['catch'](handleError(_0x34df4e,null));};exports[_0xe052('0x8c')]=function(_0x196d54,_0x450598,_0x10f70e){return db['OpenchannelQueue']['find']({'where':{'id':_0x196d54[_0xe052('0x4e')]['id']}})[_0xe052('0x2e')](handleEntityNotFound(_0x450598,null))[_0xe052('0x2e')](function(_0x1b029e){if(_0x1b029e){return _0x1b029e[_0xe052('0x8c')](_0x196d54[_0xe052('0x39')][_0xe052('0x76')])[_0xe052('0x2e')](function(){if(_['isArray'](_0x196d54[_0xe052('0x39')]['ids'])){for(var _0x5daf1c=0x0;_0x5daf1c<_0x196d54[_0xe052('0x39')][_0xe052('0x76')][_0xe052('0x3e')];_0x5daf1c+=0x1){socket[_0xe052('0x73')](_0xe052('0x8d'),{'UserId':Number(_0x196d54[_0xe052('0x39')][_0xe052('0x76')][_0x5daf1c]),'OpenchannelQueueId':Number(_0x196d54[_0xe052('0x4e')]['id'])});}}else{socket[_0xe052('0x73')](_0xe052('0x8d'),{'UserId':Number(_0x196d54['query'][_0xe052('0x76')]),'OpenchannelQueueId':Number(_0x196d54[_0xe052('0x4e')]['id'])});}});}})[_0xe052('0x2e')](respondWithStatusCode(_0x450598,null))[_0xe052('0x4c')](handleError(_0x450598,null));};exports[_0xe052('0x8e')]=function(_0x295d24,_0x62638c,_0x25fef8){var _0xabbbc6={};var _0x17de78={};var _0x372f79;var _0x52efda;return db[_0xe052('0x4a')][_0xe052('0x5a')]({'where':{'id':_0x295d24[_0xe052('0x4e')]['id']}})[_0xe052('0x2e')](handleEntityNotFound(_0x62638c,null))[_0xe052('0x2e')](function(_0x36448e){if(_0x36448e){_0x372f79=_0x36448e;_0x17de78[_0xe052('0x38')]=_[_0xe052('0x3a')](db[_0xe052('0x5d')][_0xe052('0x35')]);_0x17de78['query']=_[_0xe052('0x3a')](_0x295d24[_0xe052('0x39')]);_0x17de78[_0xe052('0x42')]=_[_0xe052('0x3b')](_0x17de78[_0xe052('0x38')],_0x17de78['query']);_0xabbbc6[_0xe052('0x3c')]=_[_0xe052('0x3b')](_0x17de78[_0xe052('0x38')],qs[_0xe052('0x3d')](_0x295d24[_0xe052('0x39')][_0xe052('0x3d')]));_0xabbbc6[_0xe052('0x3c')]=_0xabbbc6[_0xe052('0x3c')][_0xe052('0x3e')]?_0xabbbc6[_0xe052('0x3c')]:_0x17de78[_0xe052('0x38')];_0xabbbc6[_0xe052('0x40')]=qs[_0xe052('0x41')](_0x295d24[_0xe052('0x39')][_0xe052('0x41')]);_0xabbbc6['where']=qs[_0xe052('0x42')](_[_0xe052('0x43')](_0x295d24[_0xe052('0x39')],_0x17de78[_0xe052('0x42')]));if(_0x295d24['query'][_0xe052('0x44')]){_0xabbbc6[_0xe052('0x46')]=_[_0xe052('0x45')](_0xabbbc6[_0xe052('0x46')],{'$or':_[_0xe052('0x34')](_0xabbbc6[_0xe052('0x3c')],function(_0x3be64e){var _0x49f0ff={};_0x49f0ff[_0x3be64e]={'$like':'%'+_0x295d24[_0xe052('0x39')][_0xe052('0x44')]+'%'};return _0x49f0ff;})});}_0xabbbc6=_[_0xe052('0x45')]({},_0xabbbc6,_0x295d24[_0xe052('0x48')]);return _0x372f79[_0xe052('0x8e')](_0xabbbc6);}})[_0xe052('0x2e')](function(_0x34fa23){if(_0x34fa23){_0x52efda=_0x34fa23[_0xe052('0x3e')];if(!_0x295d24['query'][_0xe052('0x5b')](_0xe052('0x66'))){_0xabbbc6[_0xe052('0x3f')]=qs['limit'](_0x295d24[_0xe052('0x39')][_0xe052('0x3f')]);_0xabbbc6[_0xe052('0x23')]=qs[_0xe052('0x23')](_0x295d24[_0xe052('0x39')][_0xe052('0x23')]);}return _0x372f79[_0xe052('0x8e')](_0xabbbc6);}})['then'](function(_0x4c3d05){if(_0x4c3d05){return _0x4c3d05?{'count':_0x52efda,'rows':_0x4c3d05}:null;}})['then'](respondWithResult(_0x62638c,null))['catch'](handleError(_0x62638c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 981528c..429e358 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 _0x0ab4=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x29c77f,_0x50f265){var _0x56a97b=function(_0x4119ac){while(--_0x4119ac){_0x29c77f['push'](_0x29c77f['shift']());}};_0x56a97b(++_0x50f265);}(_0x0ab4,0x68));var _0x40ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ab4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x40ab('0x0'));var OpenchannelQueue=require(_0x40ab('0x1'))['db'][_0x40ab('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x40ab('0x3')](0x0);var events={'afterCreate':_0x40ab('0x4'),'afterUpdate':_0x40ab('0x5'),'afterDestroy':_0x40ab('0x6')};function emitEvent(_0x6b9d86){return function(_0x5a06a8,_0x88f0c9,_0x5e1d50){OpenchannelQueueEvents[_0x40ab('0x7')](_0x6b9d86+':'+_0x5a06a8['id'],_0x5a06a8);OpenchannelQueueEvents[_0x40ab('0x7')](_0x6b9d86,_0x5a06a8);_0x5e1d50(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x40ab('0x8')](e,emitEvent(event));}}module[_0x40ab('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x08bb=['save','update','hasOwnProperty','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x1798a8,_0xd3b228){var _0x5e8bbb=function(_0x6f2bb8){while(--_0x6f2bb8){_0x1798a8['push'](_0x1798a8['shift']());}};_0x5e8bbb(++_0xd3b228);}(_0x08bb,0xc0));var _0xb08b=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x08bb[_0xaa1b3e];return _0x454d7d;};'use strict';var EventEmitter=require(_0xb08b('0x0'));var OpenchannelQueue=require(_0xb08b('0x1'))['db'][_0xb08b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb08b('0x3')](0x0);var events={'afterCreate':_0xb08b('0x4'),'afterUpdate':_0xb08b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x556c55){return function(_0x3328aa,_0x3f33b2,_0x22710e){OpenchannelQueueEvents['emit'](_0x556c55+':'+_0x3328aa['id'],_0x3328aa);OpenchannelQueueEvents['emit'](_0x556c55,_0x3328aa);_0x22710e(null);};}for(var e in events){if(events[_0xb08b('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 3e0ee14..701f627 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 _0xd37c=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api'];(function(_0x6942e0,_0x131e6d){var _0xb86490=function(_0x2fd5d7){while(--_0x2fd5d7){_0x6942e0['push'](_0x6942e0['shift']());}};_0xb86490(++_0x131e6d);}(_0xd37c,0x8c));var _0xcd37=function(_0x3d617b,_0x42f767){_0x3d617b=_0x3d617b-0x0;var _0x59e1b7=_0xd37c[_0x3d617b];return _0x59e1b7;};'use strict';var _=require('lodash');var util=require(_0xcd37('0x0'));var logger=require(_0xcd37('0x1'))(_0xcd37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd37('0x3'));var rimraf=require(_0xcd37('0x4'));var config=require(_0xcd37('0x5'));var attributes=require(_0xcd37('0x6'));module[_0xcd37('0x7')]=function(_0x56c223,_0x167072){return _0x56c223[_0xcd37('0x8')](_0xcd37('0x9'),attributes,{'tableName':_0xcd37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd909=['util','api','moment','bluebird','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xd909,0x1cb));var _0x9d90=function(_0x3fa899,_0x457428){_0x3fa899=_0x3fa899-0x0;var _0x575ef7=_0xd909[_0x3fa899];return _0x575ef7;};'use strict';var _=require(_0x9d90('0x0'));var util=require(_0x9d90('0x1'));var logger=require('../../config/logger')(_0x9d90('0x2'));var moment=require(_0x9d90('0x3'));var BPromise=require(_0x9d90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9d90('0x5'));var attributes=require(_0x9d90('0x6'));module[_0x9d90('0x7')]=function(_0x13db0d,_0x4a57d8){return _0x13db0d[_0x9d90('0x8')](_0x9d90('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 9f13f61..901574a 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 _0xde09=['redis','defaults','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http'];(function(_0x3b45e8,_0x628af6){var _0x370099=function(_0x80765f){while(--_0x80765f){_0x3b45e8['push'](_0x3b45e8['shift']());}};_0x370099(++_0x628af6);}(_0xde09,0x13c));var _0x9de0=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xde09[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x9de0('0x0'));var util=require('util');var moment=require(_0x9de0('0x1'));var BPromise=require('bluebird');var rs=require(_0x9de0('0x2'));var fs=require('fs');var Redis=require(_0x9de0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9de0('0x4'));var logger=require('../../config/logger')(_0x9de0('0x5'));var config=require(_0x9de0('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9de0('0x7')]({'port':0x232a});config[_0x9de0('0x8')]=_[_0x9de0('0x9')](config[_0x9de0('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9de0('0xa'))(new Redis(config[_0x9de0('0x8')]));require('./openchannelQueue.socket')[_0x9de0('0xb')](socket);function respondWithRpcPromise(_0x568ae1,_0x39ceae,_0x507d0e){return new BPromise(function(_0x36a298,_0xc62547){return client['request'](_0x568ae1,_0x507d0e)[_0x9de0('0xc')](function(_0x1c63e8){logger[_0x9de0('0xd')](_0x9de0('0xe'),_0x39ceae,_0x9de0('0xf'));logger[_0x9de0('0x10')](_0x9de0('0x11'),_0x39ceae,'request\x20sent',JSON['stringify'](_0x1c63e8));if(_0x1c63e8[_0x9de0('0x12')]){if(_0x1c63e8[_0x9de0('0x12')][_0x9de0('0x13')]===0x1f4){logger[_0x9de0('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x39ceae,_0x1c63e8['error'][_0x9de0('0x14')]);return _0xc62547(_0x1c63e8[_0x9de0('0x12')][_0x9de0('0x14')]);}logger[_0x9de0('0x12')](_0x9de0('0xe'),_0x39ceae,_0x1c63e8['error'][_0x9de0('0x14')]);return _0x36a298(_0x1c63e8[_0x9de0('0x12')][_0x9de0('0x14')]);}else{logger['info'](_0x9de0('0xe'),_0x39ceae,_0x9de0('0xf'));_0x36a298(_0x1c63e8['result']['message']);}})[_0x9de0('0x15')](function(_0x40a49c){logger[_0x9de0('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x39ceae,_0x40a49c);_0xc62547(_0x40a49c);});});}exports['GetOpenchannelQueue']=function(_0x4eefa0){var _0x4fe143=this;return new Promise(function(_0x49854c,_0x115861){return db['OpenchannelQueue'][_0x9de0('0x16')]({'raw':_0x4eefa0[_0x9de0('0x17')]?_0x4eefa0[_0x9de0('0x17')][_0x9de0('0x18')]===undefined?!![]:![]:!![],'where':_0x4eefa0[_0x9de0('0x17')]?_0x4eefa0[_0x9de0('0x17')][_0x9de0('0x19')]||null:null,'attributes':_0x4eefa0[_0x9de0('0x17')]?_0x4eefa0[_0x9de0('0x17')][_0x9de0('0x1a')]||null:null,'limit':_0x4eefa0['options']?_0x4eefa0[_0x9de0('0x17')][_0x9de0('0x1b')]||null:null,'include':_0x4eefa0[_0x9de0('0x17')]?_0x4eefa0[_0x9de0('0x17')][_0x9de0('0x1c')]?_['map'](_0x4eefa0[_0x9de0('0x17')][_0x9de0('0x1c')],function(_0x3e2c8d){return{'model':db[_0x3e2c8d[_0x9de0('0x1d')]],'as':_0x3e2c8d['as'],'attributes':_0x3e2c8d[_0x9de0('0x1a')],'include':_0x3e2c8d['include']?_[_0x9de0('0x1e')](_0x3e2c8d[_0x9de0('0x1c')],function(_0x26c87f){return{'model':db[_0x26c87f['model']],'as':_0x26c87f['as'],'attributes':_0x26c87f['attributes'],'include':_0x26c87f[_0x9de0('0x1c')]?_[_0x9de0('0x1e')](_0x26c87f[_0x9de0('0x1c')],function(_0x4fa76b){return{'model':db[_0x4fa76b[_0x9de0('0x1d')]],'as':_0x4fa76b['as'],'attributes':_0x4fa76b['attributes']};}):[]};}):[]};}):[]:[]})[_0x9de0('0xc')](function(_0x5a55f0){logger[_0x9de0('0xd')](_0x9de0('0x1f'),_0x4eefa0);logger['debug'](_0x9de0('0x1f'),_0x4eefa0,JSON[_0x9de0('0x20')](_0x5a55f0));_0x49854c(_0x5a55f0);})[_0x9de0('0x15')](function(_0x17e744){logger[_0x9de0('0x12')](_0x9de0('0x1f'),_0x17e744[_0x9de0('0x14')],_0x4eefa0);_0x115861(_0x4fe143['error'](0x1f4,_0x17e744['message']));});});};exports[_0x9de0('0x21')]=function(_0x59947a){var _0x206e48=this;return new Promise(function(_0x101b71,_0x3ea373){return db[_0x9de0('0x22')][_0x9de0('0x23')]({'raw':_0x59947a[_0x9de0('0x17')]?_0x59947a[_0x9de0('0x17')][_0x9de0('0x18')]===undefined?!![]:![]:!![],'where':_0x59947a[_0x9de0('0x17')]?_0x59947a[_0x9de0('0x17')][_0x9de0('0x19')]||null:null,'attributes':_0x59947a['options']?_0x59947a[_0x9de0('0x17')][_0x9de0('0x1a')]||null:null,'include':_0x59947a['options']?_0x59947a[_0x9de0('0x17')][_0x9de0('0x1c')]?_[_0x9de0('0x1e')](_0x59947a['options'][_0x9de0('0x1c')],function(_0x40444f){return{'model':db[_0x40444f['model']],'as':_0x40444f['as'],'attributes':_0x40444f[_0x9de0('0x1a')],'include':_0x40444f[_0x9de0('0x1c')]?_[_0x9de0('0x1e')](_0x40444f[_0x9de0('0x1c')],function(_0x4f66c5){return{'model':db[_0x4f66c5[_0x9de0('0x1d')]],'as':_0x4f66c5['as'],'attributes':_0x4f66c5[_0x9de0('0x1a')],'include':_0x4f66c5['include']?_[_0x9de0('0x1e')](_0x4f66c5[_0x9de0('0x1c')],function(_0x3a244c){return{'model':db[_0x3a244c[_0x9de0('0x1d')]],'as':_0x3a244c['as'],'attributes':_0x3a244c[_0x9de0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9de0('0xc')](function(_0x19c931){logger['info']('ShowOpenchannelQueue',_0x59947a);logger[_0x9de0('0x10')](_0x9de0('0x21'),_0x59947a,JSON[_0x9de0('0x20')](_0x19c931));_0x101b71(_0x19c931);})[_0x9de0('0x15')](function(_0x4e19e6){logger[_0x9de0('0x12')](_0x9de0('0x21'),_0x4e19e6[_0x9de0('0x14')],_0x59947a);_0x3ea373(_0x206e48[_0x9de0('0x12')](0x1f4,_0x4e19e6[_0x9de0('0x14')]));});});}; \ No newline at end of file +var _0x50a2=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','OpenchannelQueue','findAll','options','where','attributes','limit','map','include','model','GetOpenchannelQueue','debug','catch','ShowOpenchannelQueue','find','raw'];(function(_0x17044c,_0x208790){var _0x5e6db0=function(_0x3f5f50){while(--_0x3f5f50){_0x17044c['push'](_0x17044c['shift']());}};_0x5e6db0(++_0x208790);}(_0x50a2,0x17a));var _0x250a=function(_0x25346e,_0x168ee1){_0x25346e=_0x25346e-0x0;var _0x3021d2=_0x50a2[_0x25346e];return _0x3021d2;};'use strict';var _=require(_0x250a('0x0'));var util=require(_0x250a('0x1'));var moment=require(_0x250a('0x2'));var BPromise=require(_0x250a('0x3'));var rs=require(_0x250a('0x4'));var fs=require('fs');var Redis=require(_0x250a('0x5'));var db=require(_0x250a('0x6'))['db'];var utils=require(_0x250a('0x7'));var logger=require(_0x250a('0x8'))(_0x250a('0x9'));var config=require(_0x250a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x250a('0xb')][_0x250a('0xc')]({'port':0x232a});config[_0x250a('0xd')]=_[_0x250a('0xe')](config[_0x250a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x250a('0xf'))(new Redis(config[_0x250a('0xd')]));require(_0x250a('0x10'))['register'](socket);function respondWithRpcPromise(_0x46981c,_0x556735,_0x2f67a8){return new BPromise(function(_0x4fc3b6,_0x4cb95e){return client[_0x250a('0x11')](_0x46981c,_0x2f67a8)[_0x250a('0x12')](function(_0x2e62e2){logger[_0x250a('0x13')](_0x250a('0x14'),_0x556735,_0x250a('0x15'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x556735,_0x250a('0x15'),JSON[_0x250a('0x16')](_0x2e62e2));if(_0x2e62e2[_0x250a('0x17')]){if(_0x2e62e2[_0x250a('0x17')][_0x250a('0x18')]===0x1f4){logger[_0x250a('0x17')](_0x250a('0x14'),_0x556735,_0x2e62e2[_0x250a('0x17')]['message']);return _0x4cb95e(_0x2e62e2[_0x250a('0x17')][_0x250a('0x19')]);}logger[_0x250a('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x556735,_0x2e62e2[_0x250a('0x17')][_0x250a('0x19')]);return _0x4fc3b6(_0x2e62e2[_0x250a('0x17')][_0x250a('0x19')]);}else{logger[_0x250a('0x13')](_0x250a('0x14'),_0x556735,_0x250a('0x15'));_0x4fc3b6(_0x2e62e2[_0x250a('0x1a')][_0x250a('0x19')]);}})['catch'](function(_0x4e0975){logger['error'](_0x250a('0x14'),_0x556735,_0x4e0975);_0x4cb95e(_0x4e0975);});});}exports['GetOpenchannelQueue']=function(_0x1ea101){var _0x204420=this;return new Promise(function(_0x38f4e0,_0x4c147f){return db[_0x250a('0x1b')][_0x250a('0x1c')]({'raw':_0x1ea101[_0x250a('0x1d')]?_0x1ea101[_0x250a('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ea101[_0x250a('0x1d')]?_0x1ea101[_0x250a('0x1d')][_0x250a('0x1e')]||null:null,'attributes':_0x1ea101[_0x250a('0x1d')]?_0x1ea101[_0x250a('0x1d')][_0x250a('0x1f')]||null:null,'limit':_0x1ea101[_0x250a('0x1d')]?_0x1ea101['options'][_0x250a('0x20')]||null:null,'include':_0x1ea101[_0x250a('0x1d')]?_0x1ea101[_0x250a('0x1d')]['include']?_[_0x250a('0x21')](_0x1ea101['options'][_0x250a('0x22')],function(_0x12b4d6){return{'model':db[_0x12b4d6[_0x250a('0x23')]],'as':_0x12b4d6['as'],'attributes':_0x12b4d6[_0x250a('0x1f')],'include':_0x12b4d6[_0x250a('0x22')]?_['map'](_0x12b4d6[_0x250a('0x22')],function(_0x367979){return{'model':db[_0x367979[_0x250a('0x23')]],'as':_0x367979['as'],'attributes':_0x367979[_0x250a('0x1f')],'include':_0x367979[_0x250a('0x22')]?_[_0x250a('0x21')](_0x367979[_0x250a('0x22')],function(_0xfc878c){return{'model':db[_0xfc878c[_0x250a('0x23')]],'as':_0xfc878c['as'],'attributes':_0xfc878c['attributes']};}):[]};}):[]};}):[]:[]})[_0x250a('0x12')](function(_0x4f6084){logger[_0x250a('0x13')](_0x250a('0x24'),_0x1ea101);logger[_0x250a('0x25')]('GetOpenchannelQueue',_0x1ea101,JSON[_0x250a('0x16')](_0x4f6084));_0x38f4e0(_0x4f6084);})[_0x250a('0x26')](function(_0x35713a){logger[_0x250a('0x17')](_0x250a('0x24'),_0x35713a[_0x250a('0x19')],_0x1ea101);_0x4c147f(_0x204420[_0x250a('0x17')](0x1f4,_0x35713a[_0x250a('0x19')]));});});};exports[_0x250a('0x27')]=function(_0x3f663e){var _0x50d118=this;return new Promise(function(_0xbe24cf,_0x2e782f){return db['OpenchannelQueue'][_0x250a('0x28')]({'raw':_0x3f663e[_0x250a('0x1d')]?_0x3f663e['options'][_0x250a('0x29')]===undefined?!![]:![]:!![],'where':_0x3f663e['options']?_0x3f663e[_0x250a('0x1d')][_0x250a('0x1e')]||null:null,'attributes':_0x3f663e[_0x250a('0x1d')]?_0x3f663e[_0x250a('0x1d')][_0x250a('0x1f')]||null:null,'include':_0x3f663e[_0x250a('0x1d')]?_0x3f663e['options']['include']?_[_0x250a('0x21')](_0x3f663e[_0x250a('0x1d')][_0x250a('0x22')],function(_0x2096f7){return{'model':db[_0x2096f7[_0x250a('0x23')]],'as':_0x2096f7['as'],'attributes':_0x2096f7[_0x250a('0x1f')],'include':_0x2096f7[_0x250a('0x22')]?_['map'](_0x2096f7[_0x250a('0x22')],function(_0x7fe380){return{'model':db[_0x7fe380['model']],'as':_0x7fe380['as'],'attributes':_0x7fe380['attributes'],'include':_0x7fe380[_0x250a('0x22')]?_['map'](_0x7fe380[_0x250a('0x22')],function(_0x37509f){return{'model':db[_0x37509f['model']],'as':_0x37509f['as'],'attributes':_0x37509f[_0x250a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x250a('0x12')](function(_0x2773da){logger[_0x250a('0x13')](_0x250a('0x27'),_0x3f663e);logger[_0x250a('0x25')](_0x250a('0x27'),_0x3f663e,JSON[_0x250a('0x16')](_0x2773da));_0xbe24cf(_0x2773da);})[_0x250a('0x26')](function(_0xf67577){logger[_0x250a('0x17')](_0x250a('0x27'),_0xf67577[_0x250a('0x19')],_0x3f663e);_0x2e782f(_0x50d118['error'](0x1f4,_0xf67577['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index aa61c9d..c66c8d9 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 _0x7c4c=['length','openchannelQueue:','save','emit','removeListener'];(function(_0x41b69e,_0xbd8155){var _0x391ffb=function(_0x515dd2){while(--_0x515dd2){_0x41b69e['push'](_0x41b69e['shift']());}};_0x391ffb(++_0xbd8155);}(_0x7c4c,0x1b0));var _0xc7c4=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x7c4c[_0x28e74e];return _0xb45ac1;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xc7c4('0x0'),'remove','update'];function createListener(_0x21aeba,_0x1c2f4a){return function(_0x3a6177){_0x1c2f4a[_0xc7c4('0x1')](_0x21aeba,_0x3a6177);};}function removeListener(_0x46bb3a,_0x25e8e6){return function(){OpenchannelQueueEvents[_0xc7c4('0x2')](_0x46bb3a,_0x25e8e6);};}exports['register']=function(_0x1c9c56){for(var _0x8c4c99=0x0,_0x218828=events[_0xc7c4('0x3')];_0x8c4c99<_0x218828;_0x8c4c99++){var _0x4c70b4=events[_0x8c4c99];var _0x13b5c2=createListener(_0xc7c4('0x4')+_0x4c70b4,_0x1c9c56);OpenchannelQueueEvents['on'](_0x4c70b4,_0x13b5c2);}}; \ No newline at end of file +var _0xbc5e=['update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x40b6db,_0x2a1fbb){var _0x3eaa81=function(_0x203e91){while(--_0x203e91){_0x40b6db['push'](_0x40b6db['shift']());}};_0x3eaa81(++_0x2a1fbb);}(_0xbc5e,0x7d));var _0xebc5=function(_0x333936,_0x46708f){_0x333936=_0x333936-0x0;var _0x572f25=_0xbc5e[_0x333936];return _0x572f25;};'use strict';var OpenchannelQueueEvents=require(_0xebc5('0x0'));var events=[_0xebc5('0x1'),_0xebc5('0x2'),_0xebc5('0x3')];function createListener(_0x5d04c,_0x186362){return function(_0x3c8e31){_0x186362[_0xebc5('0x4')](_0x5d04c,_0x3c8e31);};}function removeListener(_0x37670c,_0x4a2201){return function(){OpenchannelQueueEvents[_0xebc5('0x5')](_0x37670c,_0x4a2201);};}exports[_0xebc5('0x6')]=function(_0x19f4c6){for(var _0x2cbf91=0x0,_0x3c2ff6=events['length'];_0x2cbf91<_0x3c2ff6;_0x2cbf91++){var _0x5c3136=events[_0x2cbf91];var _0x197a10=createListener(_0xebc5('0x7')+_0x5c3136,_0x19f4c6);OpenchannelQueueEvents['on'](_0x5c3136,_0x197a10);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 34369d3..b2d9be0 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 _0x4300=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x215324,_0x158c48){var _0x3ca3b3=function(_0x3f97d2){while(--_0x3f97d2){_0x215324['push'](_0x215324['shift']());}};_0x3ca3b3(++_0x158c48);}(_0x4300,0x153));var _0x0430=function(_0xd6ce67,_0x4ff7d4){_0xd6ce67=_0xd6ce67-0x0;var _0x4a0225=_0x4300[_0xd6ce67];return _0x4a0225;};'use strict';var multer=require(_0x0430('0x0'));var util=require(_0x0430('0x1'));var path=require(_0x0430('0x2'));var timeout=require(_0x0430('0x3'));var express=require(_0x0430('0x4'));var router=express[_0x0430('0x5')]();var fs_extra=require(_0x0430('0x6'));var auth=require(_0x0430('0x7'));var interaction=require(_0x0430('0x8'));var config=require(_0x0430('0x9'));var controller=require(_0x0430('0xa'));router[_0x0430('0xb')]('/',auth[_0x0430('0xc')](),controller['index']);router[_0x0430('0xb')](_0x0430('0xd'),auth[_0x0430('0xc')](),controller[_0x0430('0xe')]);router[_0x0430('0xb')](_0x0430('0xf'),auth[_0x0430('0xc')](),controller[_0x0430('0x10')]);router[_0x0430('0x11')]('/',auth[_0x0430('0xc')](),controller['create']);router[_0x0430('0x12')](_0x0430('0xf'),auth['isAuthenticated'](),controller[_0x0430('0x13')]);router[_0x0430('0x14')](_0x0430('0xf'),auth[_0x0430('0xc')](),controller[_0x0430('0x15')]);module[_0x0430('0x16')]=router; \ No newline at end of file +var _0x026b=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x2d7ad4,_0x51c03a){var _0x43925b=function(_0x77f9e6){while(--_0x77f9e6){_0x2d7ad4['push'](_0x2d7ad4['shift']());}};_0x43925b(++_0x51c03a);}(_0x026b,0x1eb));var _0xb026=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x026b[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0xb026('0x0'));var util=require(_0xb026('0x1'));var path=require(_0xb026('0x2'));var timeout=require(_0xb026('0x3'));var express=require('express');var router=express[_0xb026('0x4')]();var fs_extra=require(_0xb026('0x5'));var auth=require(_0xb026('0x6'));var interaction=require(_0xb026('0x7'));var config=require(_0xb026('0x8'));var controller=require(_0xb026('0x9'));router['get']('/',auth[_0xb026('0xa')](),controller[_0xb026('0xb')]);router[_0xb026('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xb026('0xd')]);router[_0xb026('0xc')](_0xb026('0xe'),auth['isAuthenticated'](),controller[_0xb026('0xf')]);router[_0xb026('0x10')]('/',auth[_0xb026('0xa')](),controller[_0xb026('0x11')]);router[_0xb026('0x12')](_0xb026('0xe'),auth['isAuthenticated'](),controller[_0xb026('0x13')]);router[_0xb026('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb026('0x15')]);module[_0xb026('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 13da86b..92177db 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 _0x7ee9=['exports','STRING','DATE','moment','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ee9,0x6c));var _0x97ee=function(_0x29436c,_0x260a6a){_0x29436c=_0x29436c-0x0;var _0x3760a2=_0x7ee9[_0x29436c];return _0x3760a2;};'use strict';var moment=require(_0x97ee('0x0'));var Sequelize=require(_0x97ee('0x1'));module[_0x97ee('0x2')]={'uniqueid':{'type':Sequelize[_0x97ee('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x97ee('0x3')]},'joinAt':{'type':Sequelize[_0x97ee('0x4')]},'leaveAt':{'type':Sequelize[_0x97ee('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x97ee('0x4')]},'reason':{'type':Sequelize[_0x97ee('0x3')]}}; \ No newline at end of file +var _0x00ba=['exports','STRING','DATE','moment','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x00ba,0x1ed));var _0xa00b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00ba[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xa00b('0x0'));var Sequelize=require(_0xa00b('0x1'));module[_0xa00b('0x2')]={'uniqueid':{'type':Sequelize[_0xa00b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa00b('0x3')]},'joinAt':{'type':Sequelize[_0xa00b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa00b('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ad1bbbb..515eab5 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 _0x6472=['find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options'];(function(_0x44113f,_0x1d5df6){var _0x5d7b28=function(_0x1ee247){while(--_0x1ee247){_0x44113f['push'](_0x44113f['shift']());}};_0x5d7b28(++_0x1d5df6);}(_0x6472,0xe2));var _0x2647=function(_0xc8cef4,_0x91ce94){_0xc8cef4=_0xc8cef4-0x0;var _0x2f5b3f=_0x6472[_0xc8cef4];return _0x2f5b3f;};'use strict';var emlformat=require(_0x2647('0x0'));var rimraf=require(_0x2647('0x1'));var zipdir=require(_0x2647('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2647('0x3'));var moment=require(_0x2647('0x4'));var BPromise=require(_0x2647('0x5'));var Mustache=require(_0x2647('0x6'));var util=require(_0x2647('0x7'));var path=require('path');var sox=require(_0x2647('0x8'));var csv=require(_0x2647('0x9'));var ejs=require(_0x2647('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2647('0xb'));var jsforce=require(_0x2647('0xc'));var deskjs=require(_0x2647('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2647('0xe'));var Redis=require('ioredis');var authService=require(_0x2647('0xf'));var qs=require(_0x2647('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2647('0x11'));var logger=require(_0x2647('0x12'))('api');var utils=require(_0x2647('0x13'));var config=require(_0x2647('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2647('0x15'))['db'];function respondWithStatusCode(_0x108ecc,_0x2283e0){_0x2283e0=_0x2283e0||0xcc;return function(_0x3e7b4f){if(_0x3e7b4f){return _0x108ecc[_0x2647('0x16')](_0x2283e0);}return _0x108ecc['status'](_0x2283e0)['end']();};}function respondWithResult(_0x2cc2f9,_0x57ecd6){_0x57ecd6=_0x57ecd6||0xc8;return function(_0x1db0f6){if(_0x1db0f6){return _0x2cc2f9['status'](_0x57ecd6)[_0x2647('0x17')](_0x1db0f6);}};}function respondWithFilteredResult(_0xb06215,_0x5f3071){return function(_0x2df967){if(_0x2df967){var _0x13cff8=typeof _0x5f3071[_0x2647('0x18')]===_0x2647('0x19')&&typeof _0x5f3071[_0x2647('0x1a')]==='undefined';var _0x4fad24=_0x2df967[_0x2647('0x1b')];var _0x1d964e=_0x13cff8?0x0:_0x5f3071[_0x2647('0x18')];var _0x43d556=_0x13cff8?_0x2df967[_0x2647('0x1b')]:_0x5f3071['offset']+_0x5f3071[_0x2647('0x1a')];var _0x1d4c7f;if(_0x43d556>=_0x4fad24){_0x43d556=_0x4fad24;_0x1d4c7f=0xc8;}else{_0x1d4c7f=0xce;}_0xb06215[_0x2647('0x1c')](_0x1d4c7f);return _0xb06215[_0x2647('0x1d')](_0x2647('0x1e'),_0x1d964e+'-'+_0x43d556+'/'+_0x4fad24)[_0x2647('0x17')](_0x2df967);}return null;};}function patchUpdates(_0xf7ab2b){return function(_0x8fb17c){try{jsonpatch[_0x2647('0x1f')](_0x8fb17c,_0xf7ab2b,!![]);}catch(_0x4e1740){return BPromise[_0x2647('0x20')](_0x4e1740);}return _0x8fb17c[_0x2647('0x21')]();};}function saveUpdates(_0x4e8a29,_0x3cbcc2){return function(_0x3e47d6){if(_0x3e47d6){return _0x3e47d6[_0x2647('0x22')](_0x4e8a29)['then'](function(_0x56d68b){return _0x56d68b;});}return null;};}function removeEntity(_0x2e609c,_0x23c5c4){return function(_0x2255f3){if(_0x2255f3){return _0x2255f3[_0x2647('0x23')]()[_0x2647('0x24')](function(){_0x2e609c['status'](0xcc)[_0x2647('0x25')]();});}};}function handleEntityNotFound(_0x59e547,_0x9a7382){return function(_0x2c780e){if(!_0x2c780e){_0x59e547[_0x2647('0x16')](0x194);}return _0x2c780e;};}function handleError(_0x38bb00,_0x441f8c){_0x441f8c=_0x441f8c||0x1f4;return function(_0x447b2b){logger[_0x2647('0x26')](_0x447b2b[_0x2647('0x27')]);if(_0x447b2b[_0x2647('0x28')]){delete _0x447b2b[_0x2647('0x28')];}_0x38bb00[_0x2647('0x1c')](_0x441f8c)['send'](_0x447b2b);};}exports[_0x2647('0x29')]=function(_0x32b84d,_0xfc2783){var _0x23d361={},_0x489419={},_0x308a14={'count':0x0,'rows':[]};var _0x176f28=_[_0x2647('0x2a')](db[_0x2647('0x2b')][_0x2647('0x2c')],function(_0x2c00ae){return{'name':_0x2c00ae[_0x2647('0x2d')],'type':_0x2c00ae[_0x2647('0x2e')][_0x2647('0x2f')]};});_0x489419['model']=_[_0x2647('0x2a')](_0x176f28,_0x2647('0x28'));_0x489419[_0x2647('0x30')]=_[_0x2647('0x31')](_0x32b84d['query']);_0x489419[_0x2647('0x32')]=_[_0x2647('0x33')](_0x489419[_0x2647('0x34')],_0x489419[_0x2647('0x30')]);_0x23d361['attributes']=_[_0x2647('0x33')](_0x489419[_0x2647('0x34')],qs[_0x2647('0x35')](_0x32b84d[_0x2647('0x30')]['fields']));_0x23d361[_0x2647('0x36')]=_0x23d361[_0x2647('0x36')][_0x2647('0x37')]?_0x23d361[_0x2647('0x36')]:_0x489419['model'];if(!_0x32b84d['query'][_0x2647('0x38')]('nolimit')){_0x23d361[_0x2647('0x1a')]=qs[_0x2647('0x1a')](_0x32b84d[_0x2647('0x30')][_0x2647('0x1a')]);_0x23d361[_0x2647('0x18')]=qs[_0x2647('0x18')](_0x32b84d[_0x2647('0x30')][_0x2647('0x18')]);}_0x23d361['order']=qs[_0x2647('0x39')](_0x32b84d['query'][_0x2647('0x39')]);_0x23d361[_0x2647('0x3a')]=qs['filters'](_[_0x2647('0x3b')](_0x32b84d[_0x2647('0x30')],_0x489419[_0x2647('0x32')]),_0x176f28);if(_0x32b84d[_0x2647('0x30')][_0x2647('0x3c')]){_0x23d361[_0x2647('0x3a')]=_['merge'](_0x23d361[_0x2647('0x3a')],{'$or':_[_0x2647('0x2a')](_0x176f28,function(_0x55eb61){if(_0x55eb61[_0x2647('0x2e')]!==_0x2647('0x3d')){var _0x2a86b4={};_0x2a86b4[_0x55eb61[_0x2647('0x28')]]={'$like':'%'+_0x32b84d['query'][_0x2647('0x3c')]+'%'};return _0x2a86b4;}})});}_0x23d361=_[_0x2647('0x3e')]({},_0x23d361,_0x32b84d['options']);var _0x5bb872={'where':_0x23d361[_0x2647('0x3a')]};return db[_0x2647('0x2b')][_0x2647('0x1b')](_0x5bb872)[_0x2647('0x24')](function(_0x130216){_0x308a14[_0x2647('0x1b')]=_0x130216;if(_0x32b84d[_0x2647('0x30')][_0x2647('0x3f')]){_0x23d361[_0x2647('0x40')]=[{'all':!![]}];}return db[_0x2647('0x2b')]['findAll'](_0x23d361);})[_0x2647('0x24')](function(_0x1dbd54){_0x308a14[_0x2647('0x41')]=_0x1dbd54;return _0x308a14;})['then'](respondWithFilteredResult(_0xfc2783,_0x23d361))[_0x2647('0x42')](handleError(_0xfc2783,null));};exports[_0x2647('0x43')]=function(_0x161805,_0x309aa6){var _0xc4c469={'raw':!![],'where':{'id':_0x161805[_0x2647('0x44')]['id']}},_0x30d6a4={};_0x30d6a4[_0x2647('0x34')]=_[_0x2647('0x31')](db[_0x2647('0x2b')][_0x2647('0x2c')]);_0x30d6a4[_0x2647('0x30')]=_[_0x2647('0x31')](_0x161805[_0x2647('0x30')]);_0x30d6a4[_0x2647('0x32')]=_[_0x2647('0x33')](_0x30d6a4[_0x2647('0x34')],_0x30d6a4[_0x2647('0x30')]);_0xc4c469[_0x2647('0x36')]=_[_0x2647('0x33')](_0x30d6a4[_0x2647('0x34')],qs[_0x2647('0x35')](_0x161805[_0x2647('0x30')][_0x2647('0x35')]));_0xc4c469['attributes']=_0xc4c469[_0x2647('0x36')]['length']?_0xc4c469['attributes']:_0x30d6a4['model'];if(_0x161805['query']['includeAll']){_0xc4c469[_0x2647('0x40')]=[{'all':!![]}];}_0xc4c469=_[_0x2647('0x3e')]({},_0xc4c469,_0x161805[_0x2647('0x45')]);return db[_0x2647('0x2b')][_0x2647('0x46')](_0xc4c469)[_0x2647('0x24')](handleEntityNotFound(_0x309aa6,null))[_0x2647('0x24')](respondWithResult(_0x309aa6,null))['catch'](handleError(_0x309aa6,null));};exports[_0x2647('0x47')]=function(_0x42a128,_0x37898d){return db[_0x2647('0x2b')][_0x2647('0x47')](_0x42a128[_0x2647('0x48')],{})[_0x2647('0x24')](respondWithResult(_0x37898d,0xc9))[_0x2647('0x42')](handleError(_0x37898d,null));};exports[_0x2647('0x22')]=function(_0xabf17d,_0x3e3ed0){if(_0xabf17d[_0x2647('0x48')]['id']){delete _0xabf17d[_0x2647('0x48')]['id'];}return db['OpenchannelQueueReport'][_0x2647('0x46')]({'where':{'id':_0xabf17d[_0x2647('0x44')]['id']}})[_0x2647('0x24')](handleEntityNotFound(_0x3e3ed0,null))['then'](saveUpdates(_0xabf17d[_0x2647('0x48')],null))[_0x2647('0x24')](respondWithResult(_0x3e3ed0,null))[_0x2647('0x42')](handleError(_0x3e3ed0,null));};exports[_0x2647('0x23')]=function(_0x126a48,_0xaed089){return db[_0x2647('0x2b')][_0x2647('0x46')]({'where':{'id':_0x126a48[_0x2647('0x44')]['id']}})[_0x2647('0x24')](handleEntityNotFound(_0xaed089,null))[_0x2647('0x24')](removeEntity(_0xaed089,null))[_0x2647('0x42')](handleError(_0xaed089,null));};exports[_0x2647('0x49')]=function(_0x281add,_0x166a07){return db['OpenchannelQueueReport'][_0x2647('0x49')]()['then'](respondWithResult(_0x166a07,null))['catch'](handleError(_0x166a07,null));}; \ No newline at end of file +var _0xbd57=['Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','include','rows','catch','params','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','json','undefined','limit','count','offset','set'];(function(_0x4b8f77,_0xc2cf28){var _0x5a7ded=function(_0x3bb073){while(--_0x3bb073){_0x4b8f77['push'](_0x4b8f77['shift']());}};_0x5a7ded(++_0xc2cf28);}(_0xbd57,0xbc));var _0x7bd5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbd57[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x7bd5('0x0'));var rimraf=require(_0x7bd5('0x1'));var zipdir=require(_0x7bd5('0x2'));var jsonpatch=require(_0x7bd5('0x3'));var rp=require(_0x7bd5('0x4'));var moment=require(_0x7bd5('0x5'));var BPromise=require(_0x7bd5('0x6'));var Mustache=require(_0x7bd5('0x7'));var util=require('util');var path=require(_0x7bd5('0x8'));var sox=require(_0x7bd5('0x9'));var csv=require(_0x7bd5('0xa'));var ejs=require(_0x7bd5('0xb'));var fs=require('fs');var fs_extra=require(_0x7bd5('0xc'));var _=require(_0x7bd5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bd5('0xe'));var deskjs=require(_0x7bd5('0xf'));var toCsv=require(_0x7bd5('0xa'));var querystring=require('querystring');var Papa=require(_0x7bd5('0x10'));var Redis=require(_0x7bd5('0x11'));var authService=require(_0x7bd5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7bd5('0x13'));var hardwareService=require(_0x7bd5('0x14'));var logger=require('../../config/logger')(_0x7bd5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bd5('0x16'))['db'];function respondWithStatusCode(_0x298924,_0x305edc){_0x305edc=_0x305edc||0xcc;return function(_0x1cda82){if(_0x1cda82){return _0x298924['sendStatus'](_0x305edc);}return _0x298924[_0x7bd5('0x17')](_0x305edc)[_0x7bd5('0x18')]();};}function respondWithResult(_0x2f0677,_0x35b36a){_0x35b36a=_0x35b36a||0xc8;return function(_0x200622){if(_0x200622){return _0x2f0677[_0x7bd5('0x17')](_0x35b36a)[_0x7bd5('0x19')](_0x200622);}};}function respondWithFilteredResult(_0x41d364,_0xed1671){return function(_0x596c7a){if(_0x596c7a){var _0x2e5d8d=typeof _0xed1671['offset']===_0x7bd5('0x1a')&&typeof _0xed1671[_0x7bd5('0x1b')]===_0x7bd5('0x1a');var _0x1c28fe=_0x596c7a[_0x7bd5('0x1c')];var _0x25ec66=_0x2e5d8d?0x0:_0xed1671[_0x7bd5('0x1d')];var _0x299215=_0x2e5d8d?_0x596c7a[_0x7bd5('0x1c')]:_0xed1671[_0x7bd5('0x1d')]+_0xed1671['limit'];var _0x4d73b3;if(_0x299215>=_0x1c28fe){_0x299215=_0x1c28fe;_0x4d73b3=0xc8;}else{_0x4d73b3=0xce;}_0x41d364['status'](_0x4d73b3);return _0x41d364[_0x7bd5('0x1e')](_0x7bd5('0x1f'),_0x25ec66+'-'+_0x299215+'/'+_0x1c28fe)['json'](_0x596c7a);}return null;};}function patchUpdates(_0x4bc8ab){return function(_0x28285a){try{jsonpatch[_0x7bd5('0x20')](_0x28285a,_0x4bc8ab,!![]);}catch(_0x492af5){return BPromise[_0x7bd5('0x21')](_0x492af5);}return _0x28285a[_0x7bd5('0x22')]();};}function saveUpdates(_0x1bb3e1,_0x41a768){return function(_0x3c2ffa){if(_0x3c2ffa){return _0x3c2ffa['update'](_0x1bb3e1)[_0x7bd5('0x23')](function(_0x103674){return _0x103674;});}return null;};}function removeEntity(_0x3c703d,_0x433d84){return function(_0x18a948){if(_0x18a948){return _0x18a948['destroy']()['then'](function(){_0x3c703d[_0x7bd5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373b11,_0x14ab03){return function(_0x258a4f){if(!_0x258a4f){_0x373b11[_0x7bd5('0x24')](0x194);}return _0x258a4f;};}function handleError(_0x491145,_0x5de85d){_0x5de85d=_0x5de85d||0x1f4;return function(_0x4168a9){logger[_0x7bd5('0x25')](_0x4168a9[_0x7bd5('0x26')]);if(_0x4168a9['name']){delete _0x4168a9[_0x7bd5('0x27')];}_0x491145[_0x7bd5('0x17')](_0x5de85d)[_0x7bd5('0x28')](_0x4168a9);};}exports['index']=function(_0x5213ca,_0x5617ca){var _0x36a98e={},_0x44692e={},_0x446b54={'count':0x0,'rows':[]};var _0x414723=_[_0x7bd5('0x29')](db[_0x7bd5('0x2a')][_0x7bd5('0x2b')],function(_0x236b7d){return{'name':_0x236b7d[_0x7bd5('0x2c')],'type':_0x236b7d['type'][_0x7bd5('0x2d')]};});_0x44692e['model']=_[_0x7bd5('0x29')](_0x414723,_0x7bd5('0x27'));_0x44692e['query']=_[_0x7bd5('0x2e')](_0x5213ca[_0x7bd5('0x2f')]);_0x44692e[_0x7bd5('0x30')]=_['intersection'](_0x44692e['model'],_0x44692e[_0x7bd5('0x2f')]);_0x36a98e[_0x7bd5('0x31')]=_[_0x7bd5('0x32')](_0x44692e[_0x7bd5('0x33')],qs['fields'](_0x5213ca[_0x7bd5('0x2f')][_0x7bd5('0x34')]));_0x36a98e['attributes']=_0x36a98e[_0x7bd5('0x31')][_0x7bd5('0x35')]?_0x36a98e[_0x7bd5('0x31')]:_0x44692e[_0x7bd5('0x33')];if(!_0x5213ca[_0x7bd5('0x2f')][_0x7bd5('0x36')]('nolimit')){_0x36a98e[_0x7bd5('0x1b')]=qs[_0x7bd5('0x1b')](_0x5213ca[_0x7bd5('0x2f')]['limit']);_0x36a98e[_0x7bd5('0x1d')]=qs[_0x7bd5('0x1d')](_0x5213ca[_0x7bd5('0x2f')][_0x7bd5('0x1d')]);}_0x36a98e[_0x7bd5('0x37')]=qs[_0x7bd5('0x38')](_0x5213ca['query']['sort']);_0x36a98e[_0x7bd5('0x39')]=qs[_0x7bd5('0x30')](_[_0x7bd5('0x3a')](_0x5213ca['query'],_0x44692e[_0x7bd5('0x30')]),_0x414723);if(_0x5213ca[_0x7bd5('0x2f')][_0x7bd5('0x3b')]){_0x36a98e[_0x7bd5('0x39')]=_['merge'](_0x36a98e[_0x7bd5('0x39')],{'$or':_[_0x7bd5('0x29')](_0x414723,function(_0x38af0a){if(_0x38af0a[_0x7bd5('0x3c')]!==_0x7bd5('0x3d')){var _0x4de305={};_0x4de305[_0x38af0a[_0x7bd5('0x27')]]={'$like':'%'+_0x5213ca[_0x7bd5('0x2f')][_0x7bd5('0x3b')]+'%'};return _0x4de305;}})});}_0x36a98e=_['merge']({},_0x36a98e,_0x5213ca['options']);var _0x1f6c59={'where':_0x36a98e['where']};return db[_0x7bd5('0x2a')][_0x7bd5('0x1c')](_0x1f6c59)[_0x7bd5('0x23')](function(_0x2fb2cb){_0x446b54['count']=_0x2fb2cb;if(_0x5213ca[_0x7bd5('0x2f')]['includeAll']){_0x36a98e[_0x7bd5('0x3e')]=[{'all':!![]}];}return db[_0x7bd5('0x2a')]['findAll'](_0x36a98e);})['then'](function(_0x541a53){_0x446b54[_0x7bd5('0x3f')]=_0x541a53;return _0x446b54;})['then'](respondWithFilteredResult(_0x5617ca,_0x36a98e))[_0x7bd5('0x40')](handleError(_0x5617ca,null));};exports['show']=function(_0x413e18,_0xa53a86){var _0x44c929={'raw':!![],'where':{'id':_0x413e18[_0x7bd5('0x41')]['id']}},_0x59800f={};_0x59800f[_0x7bd5('0x33')]=_[_0x7bd5('0x2e')](db[_0x7bd5('0x2a')]['rawAttributes']);_0x59800f[_0x7bd5('0x2f')]=_[_0x7bd5('0x2e')](_0x413e18[_0x7bd5('0x2f')]);_0x59800f['filters']=_[_0x7bd5('0x32')](_0x59800f['model'],_0x59800f[_0x7bd5('0x2f')]);_0x44c929[_0x7bd5('0x31')]=_[_0x7bd5('0x32')](_0x59800f[_0x7bd5('0x33')],qs['fields'](_0x413e18[_0x7bd5('0x2f')][_0x7bd5('0x34')]));_0x44c929['attributes']=_0x44c929[_0x7bd5('0x31')][_0x7bd5('0x35')]?_0x44c929['attributes']:_0x59800f['model'];if(_0x413e18[_0x7bd5('0x2f')]['includeAll']){_0x44c929[_0x7bd5('0x3e')]=[{'all':!![]}];}_0x44c929=_['merge']({},_0x44c929,_0x413e18[_0x7bd5('0x42')]);return db['OpenchannelQueueReport'][_0x7bd5('0x43')](_0x44c929)[_0x7bd5('0x23')](handleEntityNotFound(_0xa53a86,null))['then'](respondWithResult(_0xa53a86,null))['catch'](handleError(_0xa53a86,null));};exports[_0x7bd5('0x44')]=function(_0x31d959,_0x2e04bf){return db[_0x7bd5('0x2a')][_0x7bd5('0x44')](_0x31d959[_0x7bd5('0x45')],{})['then'](respondWithResult(_0x2e04bf,0xc9))[_0x7bd5('0x40')](handleError(_0x2e04bf,null));};exports[_0x7bd5('0x46')]=function(_0x1b9cb2,_0x1640a8){if(_0x1b9cb2[_0x7bd5('0x45')]['id']){delete _0x1b9cb2[_0x7bd5('0x45')]['id'];}return db[_0x7bd5('0x2a')][_0x7bd5('0x43')]({'where':{'id':_0x1b9cb2['params']['id']}})[_0x7bd5('0x23')](handleEntityNotFound(_0x1640a8,null))['then'](saveUpdates(_0x1b9cb2[_0x7bd5('0x45')],null))[_0x7bd5('0x23')](respondWithResult(_0x1640a8,null))[_0x7bd5('0x40')](handleError(_0x1640a8,null));};exports[_0x7bd5('0x47')]=function(_0x54010f,_0x49016e){return db[_0x7bd5('0x2a')]['find']({'where':{'id':_0x54010f['params']['id']}})[_0x7bd5('0x23')](handleEntityNotFound(_0x49016e,null))[_0x7bd5('0x23')](removeEntity(_0x49016e,null))['catch'](handleError(_0x49016e,null));};exports[_0x7bd5('0x48')]=function(_0xf1564d,_0x58ef6a){return db['OpenchannelQueueReport'][_0x7bd5('0x48')]()[_0x7bd5('0x23')](respondWithResult(_0x58ef6a,null))['catch'](handleError(_0x58ef6a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1a6f4d2..a0ed5d1 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x39c775,_0x607a3e){var _0x5822a9=function(_0x1fa7f9){while(--_0x1fa7f9){_0x39c775['push'](_0x39c775['shift']());}};_0x5822a9(++_0x607a3e);}(_0x2ef3,0xba));var _0x32ef=function(_0x6cbec4,_0x54c5c4){_0x6cbec4=_0x6cbec4-0x0;var _0x46e096=_0x2ef3[_0x6cbec4];return _0x46e096;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'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(_0x4cbc15,_0x10f442){var _0x4452c9=function(_0x1da9a2){while(--_0x1da9a2){_0x4cbc15['push'](_0x4cbc15['shift']());}};_0x4452c9(++_0x10f442);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x5fc3[_0x2e9187];return _0x1fc3a8;};'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 83c66de..6651a54 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 _0x2272=['raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options'];(function(_0x33c023,_0xc0e6c8){var _0x5bac59=function(_0x5ba88d){while(--_0x5ba88d){_0x33c023['push'](_0x33c023['shift']());}};_0x5bac59(++_0xc0e6c8);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')](_0x531f75[_0x2227('0x1b')],{'raw':_0x531f75[_0x2227('0x1c')]?_0x531f75['options'][_0x2227('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2b26b7){logger[_0x2227('0xd')](_0x2227('0x18'),_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON[_0x2227('0x11')](_0x2b26b7));_0x620012(_0x2b26b7);})[_0x2227('0x17')](function(_0x10d9ca){logger[_0x2227('0x12')](_0x2227('0x18'),_0x10d9ca[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80['error'](0x1f4,_0x10d9ca[_0x2227('0x15')]));});});};exports[_0x2227('0x1e')]=function(_0x5b3a09){var _0x2cef4b=this;return new Promise(function(_0xbfdce1,_0x5ea1c3){return db['OpenchannelQueueReport'][_0x2227('0x1f')](_0x5b3a09[_0x2227('0x1b')],{'raw':_0x5b3a09[_0x2227('0x1c')]?_0x5b3a09[_0x2227('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b3a09[_0x2227('0x1c')]?_0x5b3a09[_0x2227('0x1c')][_0x2227('0x20')]||null:null,'attributes':_0x5b3a09[_0x2227('0x1c')]?_0x5b3a09['options'][_0x2227('0x21')]||null:null,'limit':_0x5b3a09[_0x2227('0x1c')]?_0x5b3a09[_0x2227('0x1c')][_0x2227('0x22')]||null:null})[_0x2227('0xc')](function(_0x4789eb){logger['info']('UpdateOpenchannelQueueReport',_0x5b3a09);logger[_0x2227('0xf')]('UpdateOpenchannelQueueReport',_0x5b3a09,JSON[_0x2227('0x11')](_0x4789eb));_0xbfdce1(_0x4789eb);})[_0x2227('0x17')](function(_0x58609e){logger['error'](_0x2227('0x1e'),_0x58609e[_0x2227('0x15')],_0x5b3a09);_0x5ea1c3(_0x2cef4b[_0x2227('0x12')](0x1f4,_0x58609e['message']));});});}; \ No newline at end of file +var _0x958a=['http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x1b9868,_0x3823d1){var _0x42a9ce=function(_0x430ccb){while(--_0x430ccb){_0x1b9868['push'](_0x1b9868['shift']());}};_0x42a9ce(++_0x3823d1);}(_0x958a,0x128));var _0xa958=function(_0x2ebbbc,_0x486edb){_0x2ebbbc=_0x2ebbbc-0x0;var _0x3d48d3=_0x958a[_0x2ebbbc];return _0x3d48d3;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});}exports[_0xa958('0x17')]=function(_0x4eadc9){var _0x3a053f=this;return new Promise(function(_0x70d13e,_0x52a184){return db[_0xa958('0x18')][_0xa958('0x19')](_0x4eadc9[_0xa958('0x1a')],{'raw':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')][_0xa958('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4a90c2){logger[_0xa958('0xc')](_0xa958('0x17'),_0x4eadc9);logger[_0xa958('0xf')]('CreateOpenchannelQueueReport',_0x4eadc9,JSON[_0xa958('0x11')](_0x4a90c2));_0x70d13e(_0x4a90c2);})[_0xa958('0x16')](function(_0x5c091a){logger[_0xa958('0x12')](_0xa958('0x17'),_0x5c091a['message'],_0x4eadc9);_0x52a184(_0x3a053f['error'](0x1f4,_0x5c091a[_0xa958('0x14')]));});});};exports[_0xa958('0x1d')]=function(_0x50b3c3){var _0x25f461=this;return new Promise(function(_0x27097a,_0x2f03df){return db[_0xa958('0x18')][_0xa958('0x1e')](_0x50b3c3[_0xa958('0x1a')],{'raw':_0x50b3c3['options']?_0x50b3c3[_0xa958('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50b3c3[_0xa958('0x1b')]?_0x50b3c3[_0xa958('0x1b')][_0xa958('0x1f')]||null:null,'attributes':_0x50b3c3[_0xa958('0x1b')]?_0x50b3c3[_0xa958('0x1b')][_0xa958('0x20')]||null:null,'limit':_0x50b3c3[_0xa958('0x1b')]?_0x50b3c3[_0xa958('0x1b')][_0xa958('0x21')]||null:null})[_0xa958('0xb')](function(_0x4c4c37){logger['info'](_0xa958('0x1d'),_0x50b3c3);logger['debug'](_0xa958('0x1d'),_0x50b3c3,JSON[_0xa958('0x11')](_0x4c4c37));_0x27097a(_0x4c4c37);})['catch'](function(_0x23bdbf){logger[_0xa958('0x12')](_0xa958('0x1d'),_0x23bdbf[_0xa958('0x14')],_0x50b3c3);_0x2f03df(_0x25f461[_0xa958('0x12')](0x1f4,_0x23bdbf['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 3da9db6..a6ed14c 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 _0x9598=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x9598,0x97));var _0x8959=function(_0x38f86b,_0x45b662){_0x38f86b=_0x38f86b-0x0;var _0x10832f=_0x9598[_0x38f86b];return _0x10832f;};'use strict';var multer=require(_0x8959('0x0'));var util=require(_0x8959('0x1'));var path=require('path');var timeout=require(_0x8959('0x2'));var express=require(_0x8959('0x3'));var router=express[_0x8959('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8959('0x5'));var interaction=require(_0x8959('0x6'));var config=require(_0x8959('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x8959('0x8')]('/',auth[_0x8959('0x9')](),controller[_0x8959('0xa')]);router['get']('/describe',auth[_0x8959('0x9')](),controller['describe']);router[_0x8959('0x8')](_0x8959('0xb'),auth[_0x8959('0x9')](),controller[_0x8959('0xc')]);router[_0x8959('0xd')]('/',auth[_0x8959('0x9')](),controller[_0x8959('0xe')]);router[_0x8959('0xf')](_0x8959('0xb'),auth[_0x8959('0x9')](),controller[_0x8959('0x10')]);router[_0x8959('0x11')](_0x8959('0xb'),auth[_0x8959('0x9')](),controller[_0x8959('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc0d6=['show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','describe','get','/:id'];(function(_0x3754ca,_0x355e55){var _0x2718ce=function(_0x40de8e){while(--_0x40de8e){_0x3754ca['push'](_0x3754ca['shift']());}};_0x2718ce(++_0x355e55);}(_0xc0d6,0x137));var _0x6c0d=function(_0x30f3cb,_0x16119d){_0x30f3cb=_0x30f3cb-0x0;var _0x495035=_0xc0d6[_0x30f3cb];return _0x495035;};'use strict';var multer=require('multer');var util=require(_0x6c0d('0x0'));var path=require(_0x6c0d('0x1'));var timeout=require(_0x6c0d('0x2'));var express=require(_0x6c0d('0x3'));var router=express[_0x6c0d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c0d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c0d('0x6'));var controller=require(_0x6c0d('0x7'));router['get']('/',auth[_0x6c0d('0x8')](),controller['index']);router['get']('/describe',auth[_0x6c0d('0x8')](),controller[_0x6c0d('0x9')]);router[_0x6c0d('0xa')](_0x6c0d('0xb'),auth['isAuthenticated'](),controller[_0x6c0d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c0d('0xd')]);router[_0x6c0d('0xe')](_0x6c0d('0xb'),auth['isAuthenticated'](),controller[_0x6c0d('0xf')]);router[_0x6c0d('0x10')](_0x6c0d('0xb'),auth[_0x6c0d('0x8')](),controller[_0x6c0d('0x11')]);module[_0x6c0d('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 3d64bea..211a4eb 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0xa684c9,_0x452208){var _0x4a15f7=function(_0x5ca3e1){while(--_0x5ca3e1){_0xa684c9['push'](_0xa684c9['shift']());}};_0x4a15f7(++_0x452208);}(_0xe706,0xa3));var _0x6e70=function(_0x216008,_0x2d1023){_0x216008=_0x216008-0x0;var _0x4d384f=_0xe706[_0x216008];return _0x4d384f;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xee49f8,_0x52728b){var _0x1b98f6=function(_0x1769fd){while(--_0x1769fd){_0xee49f8['push'](_0xee49f8['shift']());}};_0x1b98f6(++_0x52728b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xcb91[_0x239dba];return _0x1ceb11;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c49695e..20b12c9 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 _0xb9ae=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','type','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys'];(function(_0x38729e,_0x506ae1){var _0x3d353f=function(_0x59e01d){while(--_0x59e01d){_0x38729e['push'](_0x38729e['shift']());}};_0x3d353f(++_0x506ae1);}(_0xb9ae,0xaf));var _0xeb9a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb9ae[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xeb9a('0x0'));var rimraf=require(_0xeb9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb9a('0x2'));var moment=require(_0xeb9a('0x3'));var BPromise=require(_0xeb9a('0x4'));var Mustache=require('mustache');var util=require(_0xeb9a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9a('0x6'));var ejs=require(_0xeb9a('0x7'));var fs=require('fs');var fs_extra=require(_0xeb9a('0x8'));var _=require(_0xeb9a('0x9'));var squel=require(_0xeb9a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb9a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeb9a('0xc'));var Papa=require(_0xeb9a('0xd'));var Redis=require(_0xeb9a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb9a('0xf'));var hardwareService=require(_0xeb9a('0x10'));var logger=require('../../config/logger')(_0xeb9a('0x11'));var utils=require(_0xeb9a('0x12'));var config=require(_0xeb9a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb9a('0x14'))['db'];function respondWithStatusCode(_0x6a3d2d,_0x2f1df6){_0x2f1df6=_0x2f1df6||0xcc;return function(_0x385508){if(_0x385508){return _0x6a3d2d[_0xeb9a('0x15')](_0x2f1df6);}return _0x6a3d2d[_0xeb9a('0x16')](_0x2f1df6)[_0xeb9a('0x17')]();};}function respondWithResult(_0x20c150,_0x593688){_0x593688=_0x593688||0xc8;return function(_0x6620b){if(_0x6620b){return _0x20c150['status'](_0x593688)[_0xeb9a('0x18')](_0x6620b);}};}function respondWithFilteredResult(_0x4eb934,_0x455d93){return function(_0x38a5f2){if(_0x38a5f2){var _0x20b1a4=typeof _0x455d93[_0xeb9a('0x19')]===_0xeb9a('0x1a')&&typeof _0x455d93['limit']===_0xeb9a('0x1a');var _0x3ecfa2=_0x38a5f2['count'];var _0x58a676=_0x20b1a4?0x0:_0x455d93[_0xeb9a('0x19')];var _0x44ff6a=_0x20b1a4?_0x38a5f2['count']:_0x455d93[_0xeb9a('0x19')]+_0x455d93[_0xeb9a('0x1b')];var _0x1e969a;if(_0x44ff6a>=_0x3ecfa2){_0x44ff6a=_0x3ecfa2;_0x1e969a=0xc8;}else{_0x1e969a=0xce;}_0x4eb934['status'](_0x1e969a);return _0x4eb934[_0xeb9a('0x1c')](_0xeb9a('0x1d'),_0x58a676+'-'+_0x44ff6a+'/'+_0x3ecfa2)[_0xeb9a('0x18')](_0x38a5f2);}return null;};}function patchUpdates(_0x434126){return function(_0x4f171f){try{jsonpatch[_0xeb9a('0x1e')](_0x4f171f,_0x434126,!![]);}catch(_0x2a81ce){return BPromise[_0xeb9a('0x1f')](_0x2a81ce);}return _0x4f171f[_0xeb9a('0x20')]();};}function saveUpdates(_0x3a7c7e,_0x30c701){return function(_0x37c2df){if(_0x37c2df){return _0x37c2df[_0xeb9a('0x21')](_0x3a7c7e)[_0xeb9a('0x22')](function(_0x1a4f06){return _0x1a4f06;});}return null;};}function removeEntity(_0x5ae975,_0x2fdc2d){return function(_0x360105){if(_0x360105){return _0x360105['destroy']()[_0xeb9a('0x22')](function(){_0x5ae975[_0xeb9a('0x16')](0xcc)[_0xeb9a('0x17')]();});}};}function handleEntityNotFound(_0x39fc95,_0x2bdb57){return function(_0x1cff9b){if(!_0x1cff9b){_0x39fc95[_0xeb9a('0x15')](0x194);}return _0x1cff9b;};}function handleError(_0x4c9228,_0x2d9bcb){_0x2d9bcb=_0x2d9bcb||0x1f4;return function(_0x27c30a){logger[_0xeb9a('0x23')](_0x27c30a[_0xeb9a('0x24')]);if(_0x27c30a[_0xeb9a('0x25')]){delete _0x27c30a[_0xeb9a('0x25')];}_0x4c9228['status'](_0x2d9bcb)['send'](_0x27c30a);};}exports[_0xeb9a('0x26')]=function(_0x3b4f7a,_0xbc4420){var _0x486391={},_0x158297={},_0x101de6={'count':0x0,'rows':[]};var _0x572052=_[_0xeb9a('0x27')](db[_0xeb9a('0x28')][_0xeb9a('0x29')],function(_0x52265f){return{'name':_0x52265f[_0xeb9a('0x2a')],'type':_0x52265f['type'][_0xeb9a('0x2b')]};});_0x158297[_0xeb9a('0x2c')]=_[_0xeb9a('0x27')](_0x572052,_0xeb9a('0x25'));_0x158297[_0xeb9a('0x2d')]=_[_0xeb9a('0x2e')](_0x3b4f7a[_0xeb9a('0x2d')]);_0x158297[_0xeb9a('0x2f')]=_[_0xeb9a('0x30')](_0x158297['model'],_0x158297[_0xeb9a('0x2d')]);_0x486391[_0xeb9a('0x31')]=_['intersection'](_0x158297[_0xeb9a('0x2c')],qs[_0xeb9a('0x32')](_0x3b4f7a[_0xeb9a('0x2d')][_0xeb9a('0x32')]));_0x486391['attributes']=_0x486391[_0xeb9a('0x31')][_0xeb9a('0x33')]?_0x486391[_0xeb9a('0x31')]:_0x158297[_0xeb9a('0x2c')];if(!_0x3b4f7a[_0xeb9a('0x2d')][_0xeb9a('0x34')](_0xeb9a('0x35'))){_0x486391['limit']=qs[_0xeb9a('0x1b')](_0x3b4f7a[_0xeb9a('0x2d')][_0xeb9a('0x1b')]);_0x486391[_0xeb9a('0x19')]=qs['offset'](_0x3b4f7a[_0xeb9a('0x2d')][_0xeb9a('0x19')]);}_0x486391['order']=qs[_0xeb9a('0x36')](_0x3b4f7a[_0xeb9a('0x2d')][_0xeb9a('0x36')]);_0x486391['where']=qs[_0xeb9a('0x2f')](_[_0xeb9a('0x37')](_0x3b4f7a[_0xeb9a('0x2d')],_0x158297[_0xeb9a('0x2f')]),_0x572052);if(_0x3b4f7a[_0xeb9a('0x2d')]['filter']){_0x486391['where']=_[_0xeb9a('0x38')](_0x486391['where'],{'$or':_[_0xeb9a('0x27')](_0x572052,function(_0x6f4e0a){if(_0x6f4e0a[_0xeb9a('0x39')]!==_0xeb9a('0x3a')){var _0x2bb87a={};_0x2bb87a[_0x6f4e0a['name']]={'$like':'%'+_0x3b4f7a[_0xeb9a('0x2d')]['filter']+'%'};return _0x2bb87a;}})});}_0x486391=_[_0xeb9a('0x38')]({},_0x486391,_0x3b4f7a[_0xeb9a('0x3b')]);var _0x51d054={'where':_0x486391[_0xeb9a('0x3c')]};return db[_0xeb9a('0x28')][_0xeb9a('0x3d')](_0x51d054)[_0xeb9a('0x22')](function(_0x5d394e){_0x101de6[_0xeb9a('0x3d')]=_0x5d394e;if(_0x3b4f7a[_0xeb9a('0x2d')][_0xeb9a('0x3e')]){_0x486391[_0xeb9a('0x3f')]=[{'all':!![]}];}return db[_0xeb9a('0x28')][_0xeb9a('0x40')](_0x486391);})[_0xeb9a('0x22')](function(_0x2f06c4){_0x101de6[_0xeb9a('0x41')]=_0x2f06c4;return _0x101de6;})['then'](respondWithFilteredResult(_0xbc4420,_0x486391))['catch'](handleError(_0xbc4420,null));};exports[_0xeb9a('0x42')]=function(_0x10d281,_0x7f64f4){var _0x47bba={'raw':!![],'where':{'id':_0x10d281['params']['id']}},_0x49c1a2={};_0x49c1a2[_0xeb9a('0x2c')]=_[_0xeb9a('0x2e')](db[_0xeb9a('0x28')][_0xeb9a('0x29')]);_0x49c1a2[_0xeb9a('0x2d')]=_['keys'](_0x10d281[_0xeb9a('0x2d')]);_0x49c1a2['filters']=_[_0xeb9a('0x30')](_0x49c1a2[_0xeb9a('0x2c')],_0x49c1a2[_0xeb9a('0x2d')]);_0x47bba[_0xeb9a('0x31')]=_['intersection'](_0x49c1a2[_0xeb9a('0x2c')],qs[_0xeb9a('0x32')](_0x10d281[_0xeb9a('0x2d')][_0xeb9a('0x32')]));_0x47bba[_0xeb9a('0x31')]=_0x47bba['attributes'][_0xeb9a('0x33')]?_0x47bba[_0xeb9a('0x31')]:_0x49c1a2[_0xeb9a('0x2c')];if(_0x10d281[_0xeb9a('0x2d')]['includeAll']){_0x47bba[_0xeb9a('0x3f')]=[{'all':!![]}];}_0x47bba=_['merge']({},_0x47bba,_0x10d281[_0xeb9a('0x3b')]);return db[_0xeb9a('0x28')][_0xeb9a('0x43')](_0x47bba)[_0xeb9a('0x22')](handleEntityNotFound(_0x7f64f4,null))[_0xeb9a('0x22')](respondWithResult(_0x7f64f4,null))[_0xeb9a('0x44')](handleError(_0x7f64f4,null));};exports[_0xeb9a('0x45')]=function(_0x3875c5,_0x923a9e){return db['OpenchannelTransferReport'][_0xeb9a('0x45')](_0x3875c5[_0xeb9a('0x46')],{})[_0xeb9a('0x22')](respondWithResult(_0x923a9e,0xc9))[_0xeb9a('0x44')](handleError(_0x923a9e,null));};exports[_0xeb9a('0x21')]=function(_0x8bf32b,_0x1e486c){if(_0x8bf32b[_0xeb9a('0x46')]['id']){delete _0x8bf32b[_0xeb9a('0x46')]['id'];}return db[_0xeb9a('0x28')]['find']({'where':{'id':_0x8bf32b[_0xeb9a('0x47')]['id']}})[_0xeb9a('0x22')](handleEntityNotFound(_0x1e486c,null))[_0xeb9a('0x22')](saveUpdates(_0x8bf32b[_0xeb9a('0x46')],null))[_0xeb9a('0x22')](respondWithResult(_0x1e486c,null))[_0xeb9a('0x44')](handleError(_0x1e486c,null));};exports[_0xeb9a('0x48')]=function(_0x548892,_0x246481){return db[_0xeb9a('0x28')][_0xeb9a('0x43')]({'where':{'id':_0x548892[_0xeb9a('0x47')]['id']}})[_0xeb9a('0x22')](handleEntityNotFound(_0x246481,null))[_0xeb9a('0x22')](removeEntity(_0x246481,null))[_0xeb9a('0x44')](handleError(_0x246481,null));};exports['describe']=function(_0x3a2412,_0x50c016){return db[_0xeb9a('0x28')][_0xeb9a('0x49')]()[_0xeb9a('0x22')](respondWithResult(_0x50c016,null))['catch'](handleError(_0x50c016,null));}; \ No newline at end of file +var _0xa3f3=['catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelTransferReport','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xa3f3,0x160));var _0x3a3f=function(_0x484f18,_0x48741e){_0x484f18=_0x484f18-0x0;var _0x4e0329=_0xa3f3[_0x484f18];return _0x4e0329;};'use strict';var emlformat=require(_0x3a3f('0x0'));var rimraf=require(_0x3a3f('0x1'));var zipdir=require(_0x3a3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a3f('0x3'));var moment=require('moment');var BPromise=require(_0x3a3f('0x4'));var Mustache=require(_0x3a3f('0x5'));var util=require(_0x3a3f('0x6'));var path=require(_0x3a3f('0x7'));var sox=require('sox');var csv=require(_0x3a3f('0x8'));var ejs=require(_0x3a3f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3a3f('0xa'));var crypto=require(_0x3a3f('0xb'));var jsforce=require(_0x3a3f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3a3f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3a3f('0xe'));var qs=require(_0x3a3f('0xf'));var as=require(_0x3a3f('0x10'));var hardwareService=require(_0x3a3f('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3a3f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a3f('0x13'))['db'];function respondWithStatusCode(_0x457b4c,_0xc73ebf){_0xc73ebf=_0xc73ebf||0xcc;return function(_0x3dcbf4){if(_0x3dcbf4){return _0x457b4c['sendStatus'](_0xc73ebf);}return _0x457b4c['status'](_0xc73ebf)['end']();};}function respondWithResult(_0x44ac72,_0x17d604){_0x17d604=_0x17d604||0xc8;return function(_0x566095){if(_0x566095){return _0x44ac72['status'](_0x17d604)[_0x3a3f('0x14')](_0x566095);}};}function respondWithFilteredResult(_0x503e6a,_0x14416b){return function(_0x2e5248){if(_0x2e5248){var _0x4eac10=typeof _0x14416b['offset']===_0x3a3f('0x15')&&typeof _0x14416b[_0x3a3f('0x16')]===_0x3a3f('0x15');var _0x929c4d=_0x2e5248[_0x3a3f('0x17')];var _0x25caf2=_0x4eac10?0x0:_0x14416b[_0x3a3f('0x18')];var _0x14fba6=_0x4eac10?_0x2e5248[_0x3a3f('0x17')]:_0x14416b[_0x3a3f('0x18')]+_0x14416b['limit'];var _0x3afc30;if(_0x14fba6>=_0x929c4d){_0x14fba6=_0x929c4d;_0x3afc30=0xc8;}else{_0x3afc30=0xce;}_0x503e6a[_0x3a3f('0x19')](_0x3afc30);return _0x503e6a['set'](_0x3a3f('0x1a'),_0x25caf2+'-'+_0x14fba6+'/'+_0x929c4d)[_0x3a3f('0x14')](_0x2e5248);}return null;};}function patchUpdates(_0x3c521b){return function(_0x1e1c9b){try{jsonpatch[_0x3a3f('0x1b')](_0x1e1c9b,_0x3c521b,!![]);}catch(_0x43a763){return BPromise[_0x3a3f('0x1c')](_0x43a763);}return _0x1e1c9b['save']();};}function saveUpdates(_0x11205d,_0x3d8861){return function(_0x388159){if(_0x388159){return _0x388159[_0x3a3f('0x1d')](_0x11205d)[_0x3a3f('0x1e')](function(_0x5e1c5c){return _0x5e1c5c;});}return null;};}function removeEntity(_0x13f36c,_0x4bb4a4){return function(_0x3be513){if(_0x3be513){return _0x3be513[_0x3a3f('0x1f')]()[_0x3a3f('0x1e')](function(){_0x13f36c[_0x3a3f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c1f6d,_0x25bd42){return function(_0x8b16dc){if(!_0x8b16dc){_0x5c1f6d[_0x3a3f('0x20')](0x194);}return _0x8b16dc;};}function handleError(_0x22f235,_0x508cf3){_0x508cf3=_0x508cf3||0x1f4;return function(_0x1b4525){logger[_0x3a3f('0x21')](_0x1b4525[_0x3a3f('0x22')]);if(_0x1b4525[_0x3a3f('0x23')]){delete _0x1b4525[_0x3a3f('0x23')];}_0x22f235['status'](_0x508cf3)[_0x3a3f('0x24')](_0x1b4525);};}exports[_0x3a3f('0x25')]=function(_0x27ddc2,_0x2c3b00){var _0x4de4c2={},_0x5b7aa5={},_0xb884b0={'count':0x0,'rows':[]};var _0x17166d=_['map'](db[_0x3a3f('0x26')]['rawAttributes'],function(_0x13f8f0){return{'name':_0x13f8f0[_0x3a3f('0x27')],'type':_0x13f8f0[_0x3a3f('0x28')]['key']};});_0x5b7aa5['model']=_[_0x3a3f('0x29')](_0x17166d,_0x3a3f('0x23'));_0x5b7aa5[_0x3a3f('0x2a')]=_[_0x3a3f('0x2b')](_0x27ddc2[_0x3a3f('0x2a')]);_0x5b7aa5[_0x3a3f('0x2c')]=_[_0x3a3f('0x2d')](_0x5b7aa5[_0x3a3f('0x2e')],_0x5b7aa5[_0x3a3f('0x2a')]);_0x4de4c2['attributes']=_[_0x3a3f('0x2d')](_0x5b7aa5[_0x3a3f('0x2e')],qs[_0x3a3f('0x2f')](_0x27ddc2[_0x3a3f('0x2a')][_0x3a3f('0x2f')]));_0x4de4c2[_0x3a3f('0x30')]=_0x4de4c2[_0x3a3f('0x30')][_0x3a3f('0x31')]?_0x4de4c2[_0x3a3f('0x30')]:_0x5b7aa5[_0x3a3f('0x2e')];if(!_0x27ddc2['query'][_0x3a3f('0x32')]('nolimit')){_0x4de4c2[_0x3a3f('0x16')]=qs[_0x3a3f('0x16')](_0x27ddc2[_0x3a3f('0x2a')][_0x3a3f('0x16')]);_0x4de4c2[_0x3a3f('0x18')]=qs['offset'](_0x27ddc2[_0x3a3f('0x2a')]['offset']);}_0x4de4c2[_0x3a3f('0x33')]=qs[_0x3a3f('0x34')](_0x27ddc2[_0x3a3f('0x2a')][_0x3a3f('0x34')]);_0x4de4c2['where']=qs[_0x3a3f('0x2c')](_[_0x3a3f('0x35')](_0x27ddc2[_0x3a3f('0x2a')],_0x5b7aa5[_0x3a3f('0x2c')]),_0x17166d);if(_0x27ddc2[_0x3a3f('0x2a')]['filter']){_0x4de4c2[_0x3a3f('0x36')]=_[_0x3a3f('0x37')](_0x4de4c2['where'],{'$or':_[_0x3a3f('0x29')](_0x17166d,function(_0x4a8f3e){if(_0x4a8f3e['type']!=='VIRTUAL'){var _0xc8c883={};_0xc8c883[_0x4a8f3e['name']]={'$like':'%'+_0x27ddc2[_0x3a3f('0x2a')][_0x3a3f('0x38')]+'%'};return _0xc8c883;}})});}_0x4de4c2=_[_0x3a3f('0x37')]({},_0x4de4c2,_0x27ddc2[_0x3a3f('0x39')]);var _0x1979f7={'where':_0x4de4c2[_0x3a3f('0x36')]};return db[_0x3a3f('0x26')][_0x3a3f('0x17')](_0x1979f7)[_0x3a3f('0x1e')](function(_0x50959a){_0xb884b0[_0x3a3f('0x17')]=_0x50959a;if(_0x27ddc2['query'][_0x3a3f('0x3a')]){_0x4de4c2[_0x3a3f('0x3b')]=[{'all':!![]}];}return db[_0x3a3f('0x26')][_0x3a3f('0x3c')](_0x4de4c2);})[_0x3a3f('0x1e')](function(_0x5824e2){_0xb884b0[_0x3a3f('0x3d')]=_0x5824e2;return _0xb884b0;})[_0x3a3f('0x1e')](respondWithFilteredResult(_0x2c3b00,_0x4de4c2))[_0x3a3f('0x3e')](handleError(_0x2c3b00,null));};exports['show']=function(_0x5643ae,_0x59afbd){var _0x13dfe6={'raw':!![],'where':{'id':_0x5643ae[_0x3a3f('0x3f')]['id']}},_0x29195e={};_0x29195e[_0x3a3f('0x2e')]=_['keys'](db[_0x3a3f('0x26')][_0x3a3f('0x40')]);_0x29195e['query']=_[_0x3a3f('0x2b')](_0x5643ae['query']);_0x29195e[_0x3a3f('0x2c')]=_[_0x3a3f('0x2d')](_0x29195e['model'],_0x29195e[_0x3a3f('0x2a')]);_0x13dfe6[_0x3a3f('0x30')]=_['intersection'](_0x29195e[_0x3a3f('0x2e')],qs[_0x3a3f('0x2f')](_0x5643ae['query'][_0x3a3f('0x2f')]));_0x13dfe6['attributes']=_0x13dfe6['attributes'][_0x3a3f('0x31')]?_0x13dfe6[_0x3a3f('0x30')]:_0x29195e[_0x3a3f('0x2e')];if(_0x5643ae[_0x3a3f('0x2a')][_0x3a3f('0x3a')]){_0x13dfe6['include']=[{'all':!![]}];}_0x13dfe6=_['merge']({},_0x13dfe6,_0x5643ae[_0x3a3f('0x39')]);return db[_0x3a3f('0x26')][_0x3a3f('0x41')](_0x13dfe6)['then'](handleEntityNotFound(_0x59afbd,null))[_0x3a3f('0x1e')](respondWithResult(_0x59afbd,null))[_0x3a3f('0x3e')](handleError(_0x59afbd,null));};exports[_0x3a3f('0x42')]=function(_0x1ebb72,_0x1e6e77){return db['OpenchannelTransferReport'][_0x3a3f('0x42')](_0x1ebb72[_0x3a3f('0x43')],{})[_0x3a3f('0x1e')](respondWithResult(_0x1e6e77,0xc9))[_0x3a3f('0x3e')](handleError(_0x1e6e77,null));};exports[_0x3a3f('0x1d')]=function(_0x429ab4,_0xd98b24){if(_0x429ab4[_0x3a3f('0x43')]['id']){delete _0x429ab4['body']['id'];}return db[_0x3a3f('0x26')]['find']({'where':{'id':_0x429ab4['params']['id']}})[_0x3a3f('0x1e')](handleEntityNotFound(_0xd98b24,null))[_0x3a3f('0x1e')](saveUpdates(_0x429ab4[_0x3a3f('0x43')],null))[_0x3a3f('0x1e')](respondWithResult(_0xd98b24,null))[_0x3a3f('0x3e')](handleError(_0xd98b24,null));};exports[_0x3a3f('0x1f')]=function(_0x1c78ee,_0x545e88){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x1c78ee[_0x3a3f('0x3f')]['id']}})[_0x3a3f('0x1e')](handleEntityNotFound(_0x545e88,null))[_0x3a3f('0x1e')](removeEntity(_0x545e88,null))['catch'](handleError(_0x545e88,null));};exports[_0x3a3f('0x44')]=function(_0x3fc8b9,_0x399888){return db[_0x3a3f('0x26')][_0x3a3f('0x44')]()[_0x3a3f('0x1e')](respondWithResult(_0x399888,null))['catch'](handleError(_0x399888,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6b1ef40..f49975e 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 _0xe85d=['request-promise','path','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2798e5,_0x965668){var _0x378745=function(_0x2efea8){while(--_0x2efea8){_0x2798e5['push'](_0x2798e5['shift']());}};_0x378745(++_0x965668);}(_0xe85d,0x1db));var _0xde85=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0xe85d[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0xde85('0x0'));var util=require(_0xde85('0x1'));var logger=require(_0xde85('0x2'))('api');var moment=require(_0xde85('0x3'));var BPromise=require(_0xde85('0x4'));var rp=require(_0xde85('0x5'));var fs=require('fs');var path=require(_0xde85('0x6'));var rimraf=require('rimraf');var config=require(_0xde85('0x7'));var attributes=require(_0xde85('0x8'));module['exports']=function(_0x1a1819,_0x4c03bc){return _0x1a1819[_0xde85('0x9')](_0xde85('0xa'),attributes,{'tableName':_0xde85('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x395e=['moment','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','uniqueid','util','../../config/logger','api'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x395e,0x195));var _0xe395=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x395e[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xe395('0x0'));var logger=require(_0xe395('0x1'))(_0xe395('0x2'));var moment=require(_0xe395('0x3'));var BPromise=require(_0xe395('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe395('0x5'));var rimraf=require(_0xe395('0x6'));var config=require(_0xe395('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xe395('0x8')]=function(_0x3f6dd0,_0xada7ce){return _0x3f6dd0[_0xe395('0x9')](_0xe395('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xe395('0xb'),'fields':[_0xe395('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index eca050a..f9bd162 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 _0x6596=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug'];(function(_0x425214,_0x11579f){var _0xc4bd3f=function(_0x29ef59){while(--_0x29ef59){_0x425214['push'](_0x425214['shift']());}};_0xc4bd3f(++_0x11579f);}(_0x6596,0x1d3));var _0x6659=function(_0x321cf9,_0x279102){_0x321cf9=_0x321cf9-0x0;var _0x205920=_0x6596[_0x321cf9];return _0x205920;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var moment=require('moment');var BPromise=require(_0x6659('0x2'));var rs=require(_0x6659('0x3'));var fs=require('fs');var Redis=require(_0x6659('0x4'));var db=require(_0x6659('0x5'))['db'];var utils=require(_0x6659('0x6'));var logger=require(_0x6659('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6659('0x8'));var client=jayson[_0x6659('0x9')][_0x6659('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ed458,_0x29292b,_0x4a900d){return new BPromise(function(_0x485ea0,_0x24bfdf){return client[_0x6659('0xb')](_0x1ed458,_0x4a900d)[_0x6659('0xc')](function(_0x2aee6e){logger[_0x6659('0xd')](_0x6659('0xe'),_0x29292b,'request\x20sent');logger[_0x6659('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x29292b,'request\x20sent',JSON[_0x6659('0x10')](_0x2aee6e));if(_0x2aee6e['error']){if(_0x2aee6e[_0x6659('0x11')][_0x6659('0x12')]===0x1f4){logger[_0x6659('0x11')](_0x6659('0xe'),_0x29292b,_0x2aee6e['error'][_0x6659('0x13')]);return _0x24bfdf(_0x2aee6e[_0x6659('0x11')]['message']);}logger[_0x6659('0x11')](_0x6659('0xe'),_0x29292b,_0x2aee6e[_0x6659('0x11')][_0x6659('0x13')]);return _0x485ea0(_0x2aee6e[_0x6659('0x11')][_0x6659('0x13')]);}else{logger['info'](_0x6659('0xe'),_0x29292b,_0x6659('0x14'));_0x485ea0(_0x2aee6e[_0x6659('0x15')][_0x6659('0x13')]);}})[_0x6659('0x16')](function(_0x75836a){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x29292b,_0x75836a);_0x24bfdf(_0x75836a);});});} \ No newline at end of file +var _0xfc76=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x30d719,_0x22729b){var _0x21358e=function(_0x9c8042){while(--_0x9c8042){_0x30d719['push'](_0x30d719['shift']());}};_0x21358e(++_0x22729b);}(_0xfc76,0xb5));var _0x6fc7=function(_0x1b7640,_0x44f5a6){_0x1b7640=_0x1b7640-0x0;var _0x4d3c3e=_0xfc76[_0x1b7640];return _0x4d3c3e;};'use strict';var _=require('lodash');var util=require(_0x6fc7('0x0'));var moment=require(_0x6fc7('0x1'));var BPromise=require(_0x6fc7('0x2'));var rs=require(_0x6fc7('0x3'));var fs=require('fs');var Redis=require(_0x6fc7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fc7('0x5'));var logger=require(_0x6fc7('0x6'))('rpc');var config=require(_0x6fc7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6fc7('0x8')][_0x6fc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x385a5a,_0x4da7c3,_0x21a64d){return new BPromise(function(_0x407b0a,_0x347c00){return client[_0x6fc7('0xa')](_0x385a5a,_0x21a64d)[_0x6fc7('0xb')](function(_0x23d12f){logger['info'](_0x6fc7('0xc'),_0x4da7c3,_0x6fc7('0xd'));logger[_0x6fc7('0xe')](_0x6fc7('0xf'),_0x4da7c3,_0x6fc7('0xd'),JSON[_0x6fc7('0x10')](_0x23d12f));if(_0x23d12f['error']){if(_0x23d12f[_0x6fc7('0x11')][_0x6fc7('0x12')]===0x1f4){logger['error'](_0x6fc7('0xc'),_0x4da7c3,_0x23d12f[_0x6fc7('0x11')]['message']);return _0x347c00(_0x23d12f[_0x6fc7('0x11')][_0x6fc7('0x13')]);}logger['error'](_0x6fc7('0xc'),_0x4da7c3,_0x23d12f[_0x6fc7('0x11')][_0x6fc7('0x13')]);return _0x407b0a(_0x23d12f['error']['message']);}else{logger[_0x6fc7('0x14')](_0x6fc7('0xc'),_0x4da7c3,'request\x20sent');_0x407b0a(_0x23d12f[_0x6fc7('0x15')][_0x6fc7('0x13')]);}})[_0x6fc7('0x16')](function(_0x41269a){logger['error'](_0x6fc7('0xc'),_0x4da7c3,_0x41269a);_0x347c00(_0x41269a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a05fe8b..4afe854 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 _0x4a33=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x3eb540,_0x4e517a){var _0x2e88d8=function(_0x5902aa){while(--_0x5902aa){_0x3eb540['push'](_0x3eb540['shift']());}};_0x2e88d8(++_0x4e517a);}(_0x4a33,0x8a));var _0x34a3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4a33[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x34a3('0x0'));var util=require(_0x34a3('0x1'));var path=require(_0x34a3('0x2'));var timeout=require(_0x34a3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x34a3('0x4'));var auth=require(_0x34a3('0x5'));var interaction=require(_0x34a3('0x6'));var config=require(_0x34a3('0x7'));var controller=require(_0x34a3('0x8'));router[_0x34a3('0x9')]('/',auth[_0x34a3('0xa')](),controller[_0x34a3('0xb')]);router[_0x34a3('0x9')](_0x34a3('0xc'),auth[_0x34a3('0xa')](),controller[_0x34a3('0xd')]);router[_0x34a3('0xe')]('/',auth[_0x34a3('0xa')](),controller[_0x34a3('0xf')]);router[_0x34a3('0x10')](_0x34a3('0xc'),auth['isAuthenticated'](),controller[_0x34a3('0x11')]);router[_0x34a3('0x12')]('/:id',auth[_0x34a3('0xa')](),controller['destroy']);module[_0x34a3('0x13')]=router; \ No newline at end of file +var _0x6208=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','put','update','delete'];(function(_0x4bdab5,_0x1a4985){var _0x4405e3=function(_0x557cdf){while(--_0x557cdf){_0x4bdab5['push'](_0x4bdab5['shift']());}};_0x4405e3(++_0x1a4985);}(_0x6208,0x192));var _0x8620=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0x6208[_0x223c0d];return _0x207827;};'use strict';var multer=require('multer');var util=require(_0x8620('0x0'));var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require(_0x8620('0x3'));var router=express[_0x8620('0x4')]();var fs_extra=require(_0x8620('0x5'));var auth=require(_0x8620('0x6'));var interaction=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var controller=require(_0x8620('0x9'));router['get']('/',auth[_0x8620('0xa')](),controller[_0x8620('0xb')]);router[_0x8620('0xc')](_0x8620('0xd'),auth[_0x8620('0xa')](),controller['show']);router[_0x8620('0xe')]('/',auth[_0x8620('0xa')](),controller['create']);router[_0x8620('0xf')](_0x8620('0xd'),auth['isAuthenticated'](),controller[_0x8620('0x10')]);router[_0x8620('0x11')]('/:id',auth[_0x8620('0xa')](),controller[_0x8620('0x12')]);module[_0x8620('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index d418301..d822d30 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 _0xed81=['exports','name','STRING'];(function(_0x24a207,_0x2fb85e){var _0x5b3829=function(_0x1f6e3e){while(--_0x1f6e3e){_0x24a207['push'](_0x24a207['shift']());}};_0x5b3829(++_0x2fb85e);}(_0xed81,0xc9));var _0x1ed8=function(_0xb65af8,_0x5de41f){_0xb65af8=_0xb65af8-0x0;var _0x3cfadb=_0xed81[_0xb65af8];return _0x3cfadb;};'use strict';var Sequelize=require('sequelize');module[_0x1ed8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1ed8('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x1ed8('0x2')]}}; \ No newline at end of file +var _0x36a7=['exports','STRING','name','sequelize'];(function(_0x1505da,_0x1d3ad0){var _0xb81eed=function(_0x556f19){while(--_0x556f19){_0x1505da['push'](_0x1505da['shift']());}};_0xb81eed(++_0x1d3ad0);}(_0x36a7,0x183));var _0x736a=function(_0x4587b5,_0x281512){_0x4587b5=_0x4587b5-0x0;var _0x39f7dd=_0x36a7[_0x4587b5];return _0x39f7dd;};'use strict';var Sequelize=require(_0x736a('0x0'));module[_0x736a('0x1')]={'name':{'type':Sequelize[_0x736a('0x2')],'unique':_0x736a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x736a('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ab84d41..9a1d719 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 _0xebdc=['map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','Pause','includeAll','include','findAll','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send'];(function(_0x2a9be3,_0x5a97f8){var _0x38adea=function(_0x367536){while(--_0x367536){_0x2a9be3['push'](_0x2a9be3['shift']());}};_0x38adea(++_0x5a97f8);}(_0xebdc,0x128));var _0xcebd=function(_0x2b69cc,_0x4f8294){_0x2b69cc=_0x2b69cc-0x0;var _0x458c08=_0xebdc[_0x2b69cc];return _0x458c08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcebd('0x0'));var zipdir=require(_0xcebd('0x1'));var jsonpatch=require(_0xcebd('0x2'));var rp=require(_0xcebd('0x3'));var moment=require(_0xcebd('0x4'));var BPromise=require(_0xcebd('0x5'));var Mustache=require(_0xcebd('0x6'));var util=require(_0xcebd('0x7'));var path=require(_0xcebd('0x8'));var sox=require(_0xcebd('0x9'));var csv=require(_0xcebd('0xa'));var ejs=require(_0xcebd('0xb'));var fs=require('fs');var fs_extra=require(_0xcebd('0xc'));var _=require(_0xcebd('0xd'));var squel=require(_0xcebd('0xe'));var crypto=require(_0xcebd('0xf'));var jsforce=require(_0xcebd('0x10'));var deskjs=require(_0xcebd('0x11'));var toCsv=require(_0xcebd('0xa'));var querystring=require(_0xcebd('0x12'));var Papa=require(_0xcebd('0x13'));var Redis=require(_0xcebd('0x14'));var authService=require(_0xcebd('0x15'));var qs=require(_0xcebd('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcebd('0x17'));var logger=require(_0xcebd('0x18'))(_0xcebd('0x19'));var utils=require('../../config/utils');var config=require(_0xcebd('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1603e7,_0x4d63c4){_0x4d63c4=_0x4d63c4||0xcc;return function(_0x11583f){if(_0x11583f){return _0x1603e7[_0xcebd('0x1b')](_0x4d63c4);}return _0x1603e7[_0xcebd('0x1c')](_0x4d63c4)['end']();};}function respondWithResult(_0x8e3ed8,_0x5462f7){_0x5462f7=_0x5462f7||0xc8;return function(_0x1abfe3){if(_0x1abfe3){return _0x8e3ed8[_0xcebd('0x1c')](_0x5462f7)[_0xcebd('0x1d')](_0x1abfe3);}};}function respondWithFilteredResult(_0x3e1984,_0x586c01){return function(_0x6bf53f){if(_0x6bf53f){var _0x2e3ec1=typeof _0x586c01[_0xcebd('0x1e')]===_0xcebd('0x1f')&&typeof _0x586c01[_0xcebd('0x20')]===_0xcebd('0x1f');var _0x44cc88=_0x6bf53f[_0xcebd('0x21')];var _0xbd67d3=_0x2e3ec1?0x0:_0x586c01['offset'];var _0x194203=_0x2e3ec1?_0x6bf53f['count']:_0x586c01[_0xcebd('0x1e')]+_0x586c01[_0xcebd('0x20')];var _0x28b0c1;if(_0x194203>=_0x44cc88){_0x194203=_0x44cc88;_0x28b0c1=0xc8;}else{_0x28b0c1=0xce;}_0x3e1984['status'](_0x28b0c1);return _0x3e1984[_0xcebd('0x22')]('Content-Range',_0xbd67d3+'-'+_0x194203+'/'+_0x44cc88)[_0xcebd('0x1d')](_0x6bf53f);}return null;};}function patchUpdates(_0x1c1821){return function(_0x4db4e7){try{jsonpatch[_0xcebd('0x23')](_0x4db4e7,_0x1c1821,!![]);}catch(_0x3d8ad2){return BPromise[_0xcebd('0x24')](_0x3d8ad2);}return _0x4db4e7[_0xcebd('0x25')]();};}function saveUpdates(_0x3d33fe,_0x20573f){return function(_0x7b1468){if(_0x7b1468){return _0x7b1468[_0xcebd('0x26')](_0x3d33fe)[_0xcebd('0x27')](function(_0x3de4c5){return _0x3de4c5;});}return null;};}function removeEntity(_0x229fc2,_0x2dc3f1){return function(_0x4d4280){if(_0x4d4280){return _0x4d4280['destroy']()['then'](function(){var _0xdcf0c1=_0x4d4280[_0xcebd('0x28')]({'plain':!![]});var _0x1b86c5='Pauses';return db[_0xcebd('0x29')][_0xcebd('0x2a')]({'where':{'type':_0x1b86c5,'resourceId':_0xdcf0c1['id']}})[_0xcebd('0x27')](function(){return _0x4d4280;});})[_0xcebd('0x27')](function(){_0x229fc2[_0xcebd('0x1c')](0xcc)[_0xcebd('0x2b')]();});}};}function handleEntityNotFound(_0xef8909,_0x2b28fa){return function(_0x4a1c42){if(!_0x4a1c42){_0xef8909[_0xcebd('0x1b')](0x194);}return _0x4a1c42;};}function handleError(_0x896ad3,_0x393f0a){_0x393f0a=_0x393f0a||0x1f4;return function(_0x3943a0){logger[_0xcebd('0x2c')](_0x3943a0[_0xcebd('0x2d')]);if(_0x3943a0[_0xcebd('0x2e')]){delete _0x3943a0['name'];}_0x896ad3[_0xcebd('0x1c')](_0x393f0a)[_0xcebd('0x2f')](_0x3943a0);};}exports['index']=function(_0x5b01eb,_0x2efb6c){var _0x57a86a={},_0x34bc20={},_0x46d7d1={'count':0x0,'rows':[]};var _0x2f4b5c=_[_0xcebd('0x30')](db['Pause'][_0xcebd('0x31')],function(_0x1275c2){return{'name':_0x1275c2[_0xcebd('0x32')],'type':_0x1275c2['type'][_0xcebd('0x33')]};});_0x34bc20[_0xcebd('0x34')]=_[_0xcebd('0x30')](_0x2f4b5c,_0xcebd('0x2e'));_0x34bc20['query']=_[_0xcebd('0x35')](_0x5b01eb['query']);_0x34bc20[_0xcebd('0x36')]=_[_0xcebd('0x37')](_0x34bc20[_0xcebd('0x34')],_0x34bc20[_0xcebd('0x38')]);_0x57a86a[_0xcebd('0x39')]=_[_0xcebd('0x37')](_0x34bc20[_0xcebd('0x34')],qs['fields'](_0x5b01eb[_0xcebd('0x38')][_0xcebd('0x3a')]));_0x57a86a[_0xcebd('0x39')]=_0x57a86a[_0xcebd('0x39')][_0xcebd('0x3b')]?_0x57a86a[_0xcebd('0x39')]:_0x34bc20[_0xcebd('0x34')];if(!_0x5b01eb['query'][_0xcebd('0x3c')](_0xcebd('0x3d'))){_0x57a86a[_0xcebd('0x20')]=qs[_0xcebd('0x20')](_0x5b01eb['query']['limit']);_0x57a86a[_0xcebd('0x1e')]=qs[_0xcebd('0x1e')](_0x5b01eb[_0xcebd('0x38')]['offset']);}_0x57a86a[_0xcebd('0x3e')]=qs['sort'](_0x5b01eb[_0xcebd('0x38')][_0xcebd('0x3f')]);_0x57a86a[_0xcebd('0x40')]=qs[_0xcebd('0x36')](_[_0xcebd('0x41')](_0x5b01eb[_0xcebd('0x38')],_0x34bc20[_0xcebd('0x36')]),_0x2f4b5c);if(_0x5b01eb['query']['filter']){_0x57a86a[_0xcebd('0x40')]=_['merge'](_0x57a86a[_0xcebd('0x40')],{'$or':_[_0xcebd('0x30')](_0x2f4b5c,function(_0x4b1c33){if(_0x4b1c33[_0xcebd('0x42')]!==_0xcebd('0x43')){var _0x258811={};_0x258811[_0x4b1c33[_0xcebd('0x2e')]]={'$like':'%'+_0x5b01eb[_0xcebd('0x38')]['filter']+'%'};return _0x258811;}})});}_0x57a86a=_[_0xcebd('0x44')]({},_0x57a86a,_0x5b01eb[_0xcebd('0x45')]);var _0x1528e4={'where':_0x57a86a[_0xcebd('0x40')]};return db[_0xcebd('0x46')][_0xcebd('0x21')](_0x1528e4)[_0xcebd('0x27')](function(_0x2e2ef0){_0x46d7d1['count']=_0x2e2ef0;if(_0x5b01eb[_0xcebd('0x38')][_0xcebd('0x47')]){_0x57a86a[_0xcebd('0x48')]=[{'all':!![]}];}return db['Pause'][_0xcebd('0x49')](_0x57a86a);})[_0xcebd('0x27')](function(_0x2cb9c9){_0x46d7d1['rows']=_0x2cb9c9;return _0x46d7d1;})[_0xcebd('0x27')](respondWithFilteredResult(_0x2efb6c,_0x57a86a))[_0xcebd('0x4a')](handleError(_0x2efb6c,null));};exports['show']=function(_0x2adcb5,_0x5810e2){var _0x4855f8={'raw':!![],'where':{'id':_0x2adcb5[_0xcebd('0x4b')]['id']}},_0x243c51={};_0x243c51[_0xcebd('0x34')]=_[_0xcebd('0x35')](db['Pause'][_0xcebd('0x31')]);_0x243c51[_0xcebd('0x38')]=_[_0xcebd('0x35')](_0x2adcb5[_0xcebd('0x38')]);_0x243c51['filters']=_[_0xcebd('0x37')](_0x243c51[_0xcebd('0x34')],_0x243c51[_0xcebd('0x38')]);_0x4855f8[_0xcebd('0x39')]=_['intersection'](_0x243c51[_0xcebd('0x34')],qs[_0xcebd('0x3a')](_0x2adcb5['query'][_0xcebd('0x3a')]));_0x4855f8[_0xcebd('0x39')]=_0x4855f8[_0xcebd('0x39')]['length']?_0x4855f8[_0xcebd('0x39')]:_0x243c51['model'];if(_0x2adcb5[_0xcebd('0x38')][_0xcebd('0x47')]){_0x4855f8['include']=[{'all':!![]}];}_0x4855f8=_[_0xcebd('0x44')]({},_0x4855f8,_0x2adcb5[_0xcebd('0x45')]);return db[_0xcebd('0x46')]['find'](_0x4855f8)['then'](handleEntityNotFound(_0x5810e2,null))[_0xcebd('0x27')](respondWithResult(_0x5810e2,null))[_0xcebd('0x4a')](handleError(_0x5810e2,null));};exports[_0xcebd('0x4c')]=function(_0x441c52,_0x3e35f8){return db[_0xcebd('0x46')][_0xcebd('0x4c')](_0x441c52[_0xcebd('0x4d')],{})[_0xcebd('0x27')](function(_0x58d498){var _0x3be327=_0x441c52[_0xcebd('0x4e')][_0xcebd('0x28')]({'plain':!![]});if(!_0x3be327)throw new Error(_0xcebd('0x4f'));if(_0x3be327['role']===_0xcebd('0x4e')){var _0x858b4a=_0x58d498['get']({'plain':!![]});var _0x5624e4=_0xcebd('0x50');return db[_0xcebd('0x51')][_0xcebd('0x52')]({'where':{'name':_0x5624e4,'userProfileId':_0x3be327[_0xcebd('0x53')]},'raw':!![]})[_0xcebd('0x27')](function(_0x4366b0){if(_0x4366b0&&_0x4366b0[_0xcebd('0x54')]===0x0){return db[_0xcebd('0x29')][_0xcebd('0x4c')]({'name':_0x858b4a[_0xcebd('0x2e')],'resourceId':_0x858b4a['id'],'type':_0x4366b0['name'],'sectionId':_0x4366b0['id']},{})[_0xcebd('0x27')](function(){return _0x58d498;});}else{return _0x58d498;}})[_0xcebd('0x4a')](function(_0x484ecc){logger[_0xcebd('0x2c')](_0xcebd('0x55'),_0x484ecc);throw _0x484ecc;});}return _0x58d498;})['then'](respondWithResult(_0x3e35f8,0xc9))[_0xcebd('0x4a')](handleError(_0x3e35f8,null));};exports[_0xcebd('0x26')]=function(_0x1e6e17,_0x3cfddb){if(_0x1e6e17[_0xcebd('0x4d')]['id']){delete _0x1e6e17[_0xcebd('0x4d')]['id'];}return db[_0xcebd('0x46')][_0xcebd('0x52')]({'where':{'id':_0x1e6e17[_0xcebd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3cfddb,null))[_0xcebd('0x27')](saveUpdates(_0x1e6e17['body'],null))['then'](respondWithResult(_0x3cfddb,null))['catch'](handleError(_0x3cfddb,null));};exports['destroy']=function(_0x3f7a65,_0x3eee53){return db[_0xcebd('0x46')]['find']({'where':{'id':_0x3f7a65[_0xcebd('0x4b')]['id']}})[_0xcebd('0x27')](handleEntityNotFound(_0x3eee53,null))[_0xcebd('0x27')](removeEntity(_0x3eee53,null))['catch'](handleError(_0x3eee53,null));}; \ No newline at end of file +var _0xbd57=['nolimit','limit','order','sort','where','pick','count','include','findAll','rows','catch','show','params','includeAll','merge','options','create','body','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','set','Content-Range','json','reject','save','then','destroy','get','Pauses','UserProfileResource','status','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes'];(function(_0xf714cf,_0x584b1b){var _0x4570d6=function(_0xd1eb1){while(--_0xd1eb1){_0xf714cf['push'](_0xf714cf['shift']());}};_0x4570d6(++_0x584b1b);}(_0xbd57,0x169));var _0x7bd5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbd57[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7bd5('0x0'));var rimraf=require(_0x7bd5('0x1'));var zipdir=require(_0x7bd5('0x2'));var jsonpatch=require(_0x7bd5('0x3'));var rp=require('request-promise');var moment=require(_0x7bd5('0x4'));var BPromise=require(_0x7bd5('0x5'));var Mustache=require(_0x7bd5('0x6'));var util=require(_0x7bd5('0x7'));var path=require('path');var sox=require(_0x7bd5('0x8'));var csv=require('to-csv');var ejs=require(_0x7bd5('0x9'));var fs=require('fs');var fs_extra=require(_0x7bd5('0xa'));var _=require(_0x7bd5('0xb'));var squel=require(_0x7bd5('0xc'));var crypto=require(_0x7bd5('0xd'));var jsforce=require(_0x7bd5('0xe'));var deskjs=require(_0x7bd5('0xf'));var toCsv=require(_0x7bd5('0x10'));var querystring=require(_0x7bd5('0x11'));var Papa=require(_0x7bd5('0x12'));var Redis=require('ioredis');var authService=require(_0x7bd5('0x13'));var qs=require(_0x7bd5('0x14'));var as=require(_0x7bd5('0x15'));var hardwareService=require(_0x7bd5('0x16'));var logger=require(_0x7bd5('0x17'))(_0x7bd5('0x18'));var utils=require('../../config/utils');var config=require(_0x7bd5('0x19'));var licenseUtil=require(_0x7bd5('0x1a'));var db=require(_0x7bd5('0x1b'))['db'];function respondWithStatusCode(_0xef21f6,_0x26b814){_0x26b814=_0x26b814||0xcc;return function(_0x3069a4){if(_0x3069a4){return _0xef21f6[_0x7bd5('0x1c')](_0x26b814);}return _0xef21f6['status'](_0x26b814)[_0x7bd5('0x1d')]();};}function respondWithResult(_0x145eeb,_0x30ddfa){_0x30ddfa=_0x30ddfa||0xc8;return function(_0x55c732){if(_0x55c732){return _0x145eeb['status'](_0x30ddfa)['json'](_0x55c732);}};}function respondWithFilteredResult(_0x2c0bbd,_0x2321e5){return function(_0x3eb2ab){if(_0x3eb2ab){var _0xe8e7fd=typeof _0x2321e5[_0x7bd5('0x1e')]===_0x7bd5('0x1f')&&typeof _0x2321e5['limit']===_0x7bd5('0x1f');var _0x1ef830=_0x3eb2ab['count'];var _0x266cbb=_0xe8e7fd?0x0:_0x2321e5[_0x7bd5('0x1e')];var _0xcdf817=_0xe8e7fd?_0x3eb2ab['count']:_0x2321e5[_0x7bd5('0x1e')]+_0x2321e5['limit'];var _0x73ca27;if(_0xcdf817>=_0x1ef830){_0xcdf817=_0x1ef830;_0x73ca27=0xc8;}else{_0x73ca27=0xce;}_0x2c0bbd['status'](_0x73ca27);return _0x2c0bbd[_0x7bd5('0x20')](_0x7bd5('0x21'),_0x266cbb+'-'+_0xcdf817+'/'+_0x1ef830)[_0x7bd5('0x22')](_0x3eb2ab);}return null;};}function patchUpdates(_0x372807){return function(_0x3a2957){try{jsonpatch['apply'](_0x3a2957,_0x372807,!![]);}catch(_0x4ab0d8){return BPromise[_0x7bd5('0x23')](_0x4ab0d8);}return _0x3a2957[_0x7bd5('0x24')]();};}function saveUpdates(_0x41b1df,_0x16121f){return function(_0x21dcc8){if(_0x21dcc8){return _0x21dcc8['update'](_0x41b1df)[_0x7bd5('0x25')](function(_0x7c5f65){return _0x7c5f65;});}return null;};}function removeEntity(_0x46eaa9,_0x28b50e){return function(_0x1db015){if(_0x1db015){return _0x1db015[_0x7bd5('0x26')]()[_0x7bd5('0x25')](function(){var _0x1dba56=_0x1db015[_0x7bd5('0x27')]({'plain':!![]});var _0x5b797f=_0x7bd5('0x28');return db[_0x7bd5('0x29')][_0x7bd5('0x26')]({'where':{'type':_0x5b797f,'resourceId':_0x1dba56['id']}})[_0x7bd5('0x25')](function(){return _0x1db015;});})[_0x7bd5('0x25')](function(){_0x46eaa9[_0x7bd5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ac27,_0x90724c){return function(_0x5aaabe){if(!_0x5aaabe){_0x52ac27[_0x7bd5('0x1c')](0x194);}return _0x5aaabe;};}function handleError(_0x5ab06a,_0x38712e){_0x38712e=_0x38712e||0x1f4;return function(_0x4c49ff){logger['error'](_0x4c49ff[_0x7bd5('0x2b')]);if(_0x4c49ff[_0x7bd5('0x2c')]){delete _0x4c49ff[_0x7bd5('0x2c')];}_0x5ab06a['status'](_0x38712e)[_0x7bd5('0x2d')](_0x4c49ff);};}exports[_0x7bd5('0x2e')]=function(_0x2f7a6c,_0x59718e){var _0x2abdc9={},_0x4ca7a6={},_0x3f4da5={'count':0x0,'rows':[]};var _0x539c40=_['map'](db[_0x7bd5('0x2f')][_0x7bd5('0x30')],function(_0xb030c){return{'name':_0xb030c[_0x7bd5('0x31')],'type':_0xb030c[_0x7bd5('0x32')][_0x7bd5('0x33')]};});_0x4ca7a6['model']=_['map'](_0x539c40,_0x7bd5('0x2c'));_0x4ca7a6[_0x7bd5('0x34')]=_[_0x7bd5('0x35')](_0x2f7a6c['query']);_0x4ca7a6[_0x7bd5('0x36')]=_[_0x7bd5('0x37')](_0x4ca7a6[_0x7bd5('0x38')],_0x4ca7a6[_0x7bd5('0x34')]);_0x2abdc9['attributes']=_[_0x7bd5('0x37')](_0x4ca7a6[_0x7bd5('0x38')],qs[_0x7bd5('0x39')](_0x2f7a6c[_0x7bd5('0x34')]['fields']));_0x2abdc9['attributes']=_0x2abdc9[_0x7bd5('0x3a')]['length']?_0x2abdc9['attributes']:_0x4ca7a6[_0x7bd5('0x38')];if(!_0x2f7a6c[_0x7bd5('0x34')]['hasOwnProperty'](_0x7bd5('0x3b'))){_0x2abdc9[_0x7bd5('0x3c')]=qs[_0x7bd5('0x3c')](_0x2f7a6c[_0x7bd5('0x34')]['limit']);_0x2abdc9[_0x7bd5('0x1e')]=qs['offset'](_0x2f7a6c[_0x7bd5('0x34')]['offset']);}_0x2abdc9[_0x7bd5('0x3d')]=qs[_0x7bd5('0x3e')](_0x2f7a6c['query'][_0x7bd5('0x3e')]);_0x2abdc9[_0x7bd5('0x3f')]=qs[_0x7bd5('0x36')](_[_0x7bd5('0x40')](_0x2f7a6c[_0x7bd5('0x34')],_0x4ca7a6[_0x7bd5('0x36')]),_0x539c40);if(_0x2f7a6c[_0x7bd5('0x34')]['filter']){_0x2abdc9['where']=_['merge'](_0x2abdc9[_0x7bd5('0x3f')],{'$or':_['map'](_0x539c40,function(_0x4ed1e1){if(_0x4ed1e1[_0x7bd5('0x32')]!=='VIRTUAL'){var _0x21c6ae={};_0x21c6ae[_0x4ed1e1[_0x7bd5('0x2c')]]={'$like':'%'+_0x2f7a6c['query']['filter']+'%'};return _0x21c6ae;}})});}_0x2abdc9=_['merge']({},_0x2abdc9,_0x2f7a6c['options']);var _0x443c8d={'where':_0x2abdc9['where']};return db['Pause'][_0x7bd5('0x41')](_0x443c8d)[_0x7bd5('0x25')](function(_0x4caf0e){_0x3f4da5['count']=_0x4caf0e;if(_0x2f7a6c[_0x7bd5('0x34')]['includeAll']){_0x2abdc9[_0x7bd5('0x42')]=[{'all':!![]}];}return db[_0x7bd5('0x2f')][_0x7bd5('0x43')](_0x2abdc9);})[_0x7bd5('0x25')](function(_0x617094){_0x3f4da5[_0x7bd5('0x44')]=_0x617094;return _0x3f4da5;})[_0x7bd5('0x25')](respondWithFilteredResult(_0x59718e,_0x2abdc9))[_0x7bd5('0x45')](handleError(_0x59718e,null));};exports[_0x7bd5('0x46')]=function(_0x53ebfd,_0x1bf6c7){var _0x4e9ab3={'raw':!![],'where':{'id':_0x53ebfd[_0x7bd5('0x47')]['id']}},_0x27139f={};_0x27139f['model']=_[_0x7bd5('0x35')](db[_0x7bd5('0x2f')]['rawAttributes']);_0x27139f[_0x7bd5('0x34')]=_[_0x7bd5('0x35')](_0x53ebfd[_0x7bd5('0x34')]);_0x27139f[_0x7bd5('0x36')]=_['intersection'](_0x27139f[_0x7bd5('0x38')],_0x27139f[_0x7bd5('0x34')]);_0x4e9ab3[_0x7bd5('0x3a')]=_['intersection'](_0x27139f[_0x7bd5('0x38')],qs[_0x7bd5('0x39')](_0x53ebfd['query'][_0x7bd5('0x39')]));_0x4e9ab3['attributes']=_0x4e9ab3[_0x7bd5('0x3a')]['length']?_0x4e9ab3[_0x7bd5('0x3a')]:_0x27139f[_0x7bd5('0x38')];if(_0x53ebfd['query'][_0x7bd5('0x48')]){_0x4e9ab3[_0x7bd5('0x42')]=[{'all':!![]}];}_0x4e9ab3=_[_0x7bd5('0x49')]({},_0x4e9ab3,_0x53ebfd[_0x7bd5('0x4a')]);return db[_0x7bd5('0x2f')]['find'](_0x4e9ab3)[_0x7bd5('0x25')](handleEntityNotFound(_0x1bf6c7,null))[_0x7bd5('0x25')](respondWithResult(_0x1bf6c7,null))[_0x7bd5('0x45')](handleError(_0x1bf6c7,null));};exports['create']=function(_0x668556,_0x389a21){return db[_0x7bd5('0x2f')][_0x7bd5('0x4b')](_0x668556[_0x7bd5('0x4c')],{})[_0x7bd5('0x25')](function(_0x10ac0e){var _0x25aa70=_0x668556['user'][_0x7bd5('0x27')]({'plain':!![]});if(!_0x25aa70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25aa70[_0x7bd5('0x4d')]==='user'){var _0x5f65a1=_0x10ac0e['get']({'plain':!![]});var _0x35476f='Pauses';return db[_0x7bd5('0x4e')][_0x7bd5('0x4f')]({'where':{'name':_0x35476f,'userProfileId':_0x25aa70[_0x7bd5('0x50')]},'raw':!![]})[_0x7bd5('0x25')](function(_0x5a29ea){if(_0x5a29ea&&_0x5a29ea['autoAssociation']===0x0){return db[_0x7bd5('0x29')]['create']({'name':_0x5f65a1[_0x7bd5('0x2c')],'resourceId':_0x5f65a1['id'],'type':_0x5a29ea[_0x7bd5('0x2c')],'sectionId':_0x5a29ea['id']},{})[_0x7bd5('0x25')](function(){return _0x10ac0e;});}else{return _0x10ac0e;}})[_0x7bd5('0x45')](function(_0x2381a4){logger[_0x7bd5('0x51')](_0x7bd5('0x52'),_0x2381a4);throw _0x2381a4;});}return _0x10ac0e;})[_0x7bd5('0x25')](respondWithResult(_0x389a21,0xc9))['catch'](handleError(_0x389a21,null));};exports[_0x7bd5('0x53')]=function(_0x114d23,_0x231d15){if(_0x114d23[_0x7bd5('0x4c')]['id']){delete _0x114d23[_0x7bd5('0x4c')]['id'];}return db['Pause'][_0x7bd5('0x4f')]({'where':{'id':_0x114d23[_0x7bd5('0x47')]['id']}})[_0x7bd5('0x25')](handleEntityNotFound(_0x231d15,null))['then'](saveUpdates(_0x114d23['body'],null))[_0x7bd5('0x25')](respondWithResult(_0x231d15,null))[_0x7bd5('0x45')](handleError(_0x231d15,null));};exports['destroy']=function(_0x3550e0,_0x31355a){return db[_0x7bd5('0x2f')]['find']({'where':{'id':_0x3550e0[_0x7bd5('0x47')]['id']}})[_0x7bd5('0x25')](handleEntityNotFound(_0x31355a,null))[_0x7bd5('0x25')](removeEntity(_0x31355a,null))['catch'](handleError(_0x31355a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 18c273e..4cac9a5 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x3439ef,_0x198707){var _0x3c7937=function(_0xaf5100){while(--_0xaf5100){_0x3439ef['push'](_0x3439ef['shift']());}};_0x3c7937(++_0x198707);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3b275b,_0x55a595){_0x3b275b=_0x3b275b-0x0;var _0x20b7b4=_0x8ef6[_0x3b275b];return _0x20b7b4;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 98241f2..6d5d4f0 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(_0x1c9f97,_0x2e8980){var _0x210f3a=function(_0x139dba){while(--_0x139dba){_0x1c9f97['push'](_0x1c9f97['shift']());}};_0x210f3a(++_0x2e8980);}(_0xb10b,0x12a));var _0xbb10=function(_0x52e251,_0x3b6303){_0x52e251=_0x52e251-0x0;var _0x5eee63=_0xb10b[_0x52e251];return _0x5eee63;};'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 _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(_0x4c956e,_0x1469ba){var _0x4682a5=function(_0x542ac3){while(--_0x542ac3){_0x4c956e['push'](_0x4c956e['shift']());}};_0x4682a5(++_0x1469ba);}(_0xb10b,0x12a));var _0xbb10=function(_0x137c34,_0x2ebd98){_0x137c34=_0x137c34-0x0;var _0x145d9b=_0xb10b[_0x137c34];return _0x145d9b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 07f6e3d..76bbb27 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 _0xfd28=['webhookPost','put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/:id','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','/webhook'];(function(_0x47c7bf,_0x569d29){var _0x178d0e=function(_0x43c7fc){while(--_0x43c7fc){_0x47c7bf['push'](_0x47c7bf['shift']());}};_0x178d0e(++_0x569d29);}(_0xfd28,0x148));var _0x8fd2=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xfd28[_0x4b5813];return _0x423465;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/webhook',controller['webhookGet']);router[_0x8fd2('0x7')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['show']);router[_0x8fd2('0x7')]('/:id/download',auth[_0x8fd2('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x8fd2('0xb')]({'destination':function(_0x4fdf0b,_0x1ca2a1,_0x5244ed){_0x5244ed(null,path[_0x8fd2('0xc')](config['root'],_0x8fd2('0xd')));},'filename':function(_0x207298,_0xfd78d,_0xa6d7ca){_0xfd78d[_0x8fd2('0xe')]=_0xfd78d[_0x8fd2('0xe')][_0x8fd2('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa6d7ca(null,util[_0x8fd2('0x10')](_0x8fd2('0x11'),path[_0x8fd2('0x12')](_0xfd78d[_0x8fd2('0xe')],path[_0x8fd2('0x13')](_0xfd78d[_0x8fd2('0xe')])),Date[_0x8fd2('0x14')](),path[_0x8fd2('0x13')](_0xfd78d['originalname'])));}})});router[_0x8fd2('0x15')]('/',upload['single']('file'),controller['upload']);router[_0x8fd2('0x15')](_0x8fd2('0x16'),controller[_0x8fd2('0x17')]);router[_0x8fd2('0x18')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x19')]);router[_0x8fd2('0x1a')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x6737=['diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','upload','webhookPost','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','index','/:id','show','get','download'];(function(_0x295777,_0x3ea943){var _0x201561=function(_0x55b2e9){while(--_0x55b2e9){_0x295777['push'](_0x295777['shift']());}};_0x201561(++_0x3ea943);}(_0x6737,0xe2));var _0x7673=function(_0x2075e5,_0x38847c){_0x2075e5=_0x2075e5-0x0;var _0x41aed6=_0x6737[_0x2075e5];return _0x41aed6;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x7673('0xa'),auth['isAuthenticated'](),controller[_0x7673('0xb')]);router[_0x7673('0xc')]('/:id/download',auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);var upload=multer({'storage':multer[_0x7673('0xe')]({'destination':function(_0x4d40ce,_0x49fcb2,_0x3ca258){_0x3ca258(null,path['join'](config[_0x7673('0xf')],_0x7673('0x10')));},'filename':function(_0x38090f,_0x451c87,_0x41d6bd){_0x451c87[_0x7673('0x11')]=_0x451c87[_0x7673('0x11')][_0x7673('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41d6bd(null,util[_0x7673('0x13')](_0x7673('0x14'),path['basename'](_0x451c87[_0x7673('0x11')],path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])),Date[_0x7673('0x16')](),path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])));}})});router[_0x7673('0x17')]('/',upload['single']('file'),controller[_0x7673('0x18')]);router[_0x7673('0x17')]('/webhook',controller[_0x7673('0x19')]);router[_0x7673('0x1a')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0x1b')]);router[_0x7673('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0x1c')]);module[_0x7673('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 906a42c..ba71bed 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 _0xa0d3=['html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x28def4,_0x3bbf72){var _0x126fcd=function(_0x3e2eee){while(--_0x3e2eee){_0x28def4['push'](_0x28def4['shift']());}};_0x126fcd(++_0x3bbf72);}(_0xa0d3,0x1a2));var _0x3a0d=function(_0x4f74a5,_0x1fd979){_0x4f74a5=_0x4f74a5-0x0;var _0x5be8b2=_0xa0d3[_0x4f74a5];return _0x5be8b2;};'use strict';var Sequelize=require(_0x3a0d('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a0d('0x1')]},'type':{'type':Sequelize['ENUM'](_0x3a0d('0x2'),_0x3a0d('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x3a0d('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3a0d('0x5')},'sidebar':{'type':Sequelize[_0x3a0d('0x6')](_0x3a0d('0x7'),_0x3a0d('0x8'),_0x3a0d('0x9'),_0x3a0d('0xa')),'defaultValue':'always','comment':_0x3a0d('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x3a0d('0x1')]},'agentUrl':{'type':Sequelize[_0x3a0d('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x3a0d('0x1')]}}; \ No newline at end of file +var _0x40a0=['script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM'];(function(_0x2af11a,_0x443532){var _0x40d52e=function(_0xcfe7b2){while(--_0xcfe7b2){_0x2af11a['push'](_0x2af11a['shift']());}};_0x40d52e(++_0x443532);}(_0x40a0,0x98));var _0x040a=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x40a0[_0xb301d4];return _0x3b5bde;};'use strict';var Sequelize=require(_0x040a('0x0'));module[_0x040a('0x1')]={'name':{'type':Sequelize[_0x040a('0x2')]},'type':{'type':Sequelize[_0x040a('0x3')]('html',_0x040a('0x4'))},'description':{'type':Sequelize[_0x040a('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x040a('0x2')],'comment':_0x040a('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x040a('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x040a('0x8'),_0x040a('0x9'),_0x040a('0xa'),_0x040a('0xb')),'defaultValue':_0x040a('0xa'),'comment':_0x040a('0xc')},'icon':{'type':Sequelize[_0x040a('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x040a('0x2')]},'scriptName':{'type':Sequelize[_0x040a('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3aba5b0..3bb1451 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 _0x4c77=['path','sox','squel','crypto','jsforce','to-csv','papaparse','extract-zip','rimraf','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./plugin.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','error','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','includeAll','options','find','download','params','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','node_modules/**/*','finalize','close','Plugin\x20not\x20found','format','Sequelize','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','plugins','scriptName','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c77,0x13f));var _0x74c7=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4c77[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x74c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74c7('0x1'));var rp=require(_0x74c7('0x2'));var moment=require(_0x74c7('0x3'));var BPromise=require(_0x74c7('0x4'));var Mustache=require(_0x74c7('0x5'));var util=require(_0x74c7('0x6'));var path=require(_0x74c7('0x7'));var sox=require(_0x74c7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x74c7('0x9'));var crypto=require(_0x74c7('0xa'));var jsforce=require(_0x74c7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x74c7('0xc'));var querystring=require('querystring');var Papa=require(_0x74c7('0xd'));var extract=require(_0x74c7('0xe'));var rimraf=require(_0x74c7('0xf'));var archiver=require(_0x74c7('0x10'));var Redis=require('ioredis');var authService=require(_0x74c7('0x11'));var qs=require(_0x74c7('0x12'));var as=require(_0x74c7('0x13'));var hardwareService=require(_0x74c7('0x14'));var logger=require('../../config/logger')(_0x74c7('0x15'));var utils=require(_0x74c7('0x16'));var config=require(_0x74c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x74c7('0x18')]=_[_0x74c7('0x19')](config['redis'],{'host':_0x74c7('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74c7('0x18')]));require(_0x74c7('0x1b'))['register'](socket);function respondWithStatusCode(_0x5044d0,_0x475c70){_0x475c70=_0x475c70||0xcc;return function(_0xa0d4a3){if(_0xa0d4a3){return _0x5044d0[_0x74c7('0x1c')](_0x475c70);}return _0x5044d0[_0x74c7('0x1d')](_0x475c70)[_0x74c7('0x1e')]();};}function respondWithResult(_0x53990c,_0x9be65c){_0x9be65c=_0x9be65c||0xc8;return function(_0x5c6047){if(_0x5c6047){return _0x53990c[_0x74c7('0x1d')](_0x9be65c)[_0x74c7('0x1f')](_0x5c6047);}};}function respondWithFilteredResult(_0x47cdcb,_0x2d32f8){return function(_0x449cd1){if(_0x449cd1){var _0x5057f0=typeof _0x2d32f8[_0x74c7('0x20')]==='undefined'&&typeof _0x2d32f8['limit']===_0x74c7('0x21');var _0x1a1224=_0x449cd1[_0x74c7('0x22')];var _0x2c5170=_0x5057f0?0x0:_0x2d32f8[_0x74c7('0x20')];var _0x4a7e69=_0x5057f0?_0x449cd1[_0x74c7('0x22')]:_0x2d32f8[_0x74c7('0x20')]+_0x2d32f8[_0x74c7('0x23')];var _0x2ad4b7;if(_0x4a7e69>=_0x1a1224){_0x4a7e69=_0x1a1224;_0x2ad4b7=0xc8;}else{_0x2ad4b7=0xce;}_0x47cdcb[_0x74c7('0x1d')](_0x2ad4b7);return _0x47cdcb[_0x74c7('0x24')](_0x74c7('0x25'),_0x2c5170+'-'+_0x4a7e69+'/'+_0x1a1224)['json'](_0x449cd1);}return null;};}function patchUpdates(_0xe47388){return function(_0x3c2413){try{jsonpatch[_0x74c7('0x26')](_0x3c2413,_0xe47388,!![]);}catch(_0x474839){return BPromise[_0x74c7('0x27')](_0x474839);}return _0x3c2413[_0x74c7('0x28')]();};}function saveUpdates(_0x3321a9,_0x123615){return function(_0x2de704){if(_0x2de704){return _0x2de704[_0x74c7('0x29')](_0x3321a9)[_0x74c7('0x2a')](function(_0xcdb377){return _0xcdb377;});}return null;};}function removeEntity(_0xfdaeec,_0xd9d429){return function(_0x4bbb77){if(_0x4bbb77){return _0x4bbb77['destroy']()['then'](function(){var _0x46e991=_0x4bbb77[_0x74c7('0x2b')]({'plain':!![]});var _0x29652e='Plugins';return db['UserProfileResource'][_0x74c7('0x2c')]({'where':{'type':_0x29652e,'resourceId':_0x46e991['id']}})[_0x74c7('0x2a')](function(){return _0x4bbb77;});})['then'](function(){_0xfdaeec[_0x74c7('0x1d')](0xcc)[_0x74c7('0x1e')]();});}};}function handleEntityNotFound(_0x395489,_0x4cecfb){return function(_0x1acbc8){if(!_0x1acbc8){_0x395489[_0x74c7('0x1c')](0x194);}return _0x1acbc8;};}function handleError(_0x1b2b08,_0x27b23e){_0x27b23e=_0x27b23e||0x1f4;return function(_0x293a8b){logger[_0x74c7('0x2d')](_0x293a8b['stack']);if(_0x293a8b[_0x74c7('0x2e')]){delete _0x293a8b[_0x74c7('0x2e')];}_0x1b2b08[_0x74c7('0x1d')](_0x27b23e)[_0x74c7('0x2f')](_0x293a8b);};}exports[_0x74c7('0x30')]=function(_0x56cf3a,_0x228a41){var _0x2bb2bb={},_0x1f7e54={},_0x3b0e93={'count':0x0,'rows':[]};var _0x1f064e=_[_0x74c7('0x31')](db[_0x74c7('0x32')][_0x74c7('0x33')],function(_0x226073){return{'name':_0x226073[_0x74c7('0x34')],'type':_0x226073['type'][_0x74c7('0x35')]};});_0x1f7e54[_0x74c7('0x36')]=_[_0x74c7('0x31')](_0x1f064e,_0x74c7('0x2e'));_0x1f7e54[_0x74c7('0x37')]=_[_0x74c7('0x38')](_0x56cf3a[_0x74c7('0x37')]);_0x1f7e54[_0x74c7('0x39')]=_[_0x74c7('0x3a')](_0x1f7e54['model'],_0x1f7e54[_0x74c7('0x37')]);_0x2bb2bb[_0x74c7('0x3b')]=_[_0x74c7('0x3a')](_0x1f7e54[_0x74c7('0x36')],qs[_0x74c7('0x3c')](_0x56cf3a[_0x74c7('0x37')][_0x74c7('0x3c')]));_0x2bb2bb['attributes']=_0x2bb2bb[_0x74c7('0x3b')][_0x74c7('0x3d')]?_0x2bb2bb['attributes']:_0x1f7e54[_0x74c7('0x36')];if(!_0x56cf3a[_0x74c7('0x37')]['hasOwnProperty'](_0x74c7('0x3e'))){_0x2bb2bb[_0x74c7('0x23')]=qs['limit'](_0x56cf3a[_0x74c7('0x37')][_0x74c7('0x23')]);_0x2bb2bb[_0x74c7('0x20')]=qs[_0x74c7('0x20')](_0x56cf3a[_0x74c7('0x37')]['offset']);}_0x2bb2bb[_0x74c7('0x3f')]=qs[_0x74c7('0x40')](_0x56cf3a['query']['sort']);_0x2bb2bb[_0x74c7('0x41')]=qs[_0x74c7('0x39')](_[_0x74c7('0x42')](_0x56cf3a['query'],_0x1f7e54[_0x74c7('0x39')]),_0x1f064e);if(_0x56cf3a[_0x74c7('0x37')][_0x74c7('0x43')]){_0x2bb2bb['where']=_[_0x74c7('0x44')](_0x2bb2bb[_0x74c7('0x41')],{'$or':_[_0x74c7('0x31')](_0x1f064e,function(_0x3b3c40){if(_0x3b3c40[_0x74c7('0x45')]!==_0x74c7('0x46')){var _0x224158={};_0x224158[_0x3b3c40[_0x74c7('0x2e')]]={'$like':'%'+_0x56cf3a[_0x74c7('0x37')][_0x74c7('0x43')]+'%'};return _0x224158;}})});}_0x2bb2bb=_[_0x74c7('0x44')]({},_0x2bb2bb,_0x56cf3a['options']);var _0x2017aa={'where':_0x2bb2bb[_0x74c7('0x41')]};return db[_0x74c7('0x32')][_0x74c7('0x22')](_0x2017aa)[_0x74c7('0x2a')](function(_0x38e57e){_0x3b0e93['count']=_0x38e57e;if(_0x56cf3a[_0x74c7('0x37')]['includeAll']){_0x2bb2bb[_0x74c7('0x47')]=[{'all':!![]}];}return db[_0x74c7('0x32')]['findAll'](_0x2bb2bb);})['then'](function(_0x23a9d5){_0x3b0e93[_0x74c7('0x48')]=_0x23a9d5;return _0x3b0e93;})['then'](respondWithFilteredResult(_0x228a41,_0x2bb2bb))[_0x74c7('0x49')](handleError(_0x228a41,null));};exports['show']=function(_0x297988,_0x2039d1){var _0x54cd06={'raw':!![],'where':{'id':_0x297988['params']['id']}},_0x3e216b={};_0x3e216b[_0x74c7('0x36')]=_[_0x74c7('0x38')](db[_0x74c7('0x32')][_0x74c7('0x33')]);_0x3e216b['query']=_[_0x74c7('0x38')](_0x297988[_0x74c7('0x37')]);_0x3e216b[_0x74c7('0x39')]=_[_0x74c7('0x3a')](_0x3e216b[_0x74c7('0x36')],_0x3e216b['query']);_0x54cd06[_0x74c7('0x3b')]=_[_0x74c7('0x3a')](_0x3e216b[_0x74c7('0x36')],qs[_0x74c7('0x3c')](_0x297988[_0x74c7('0x37')][_0x74c7('0x3c')]));_0x54cd06['attributes']=_0x54cd06[_0x74c7('0x3b')]['length']?_0x54cd06[_0x74c7('0x3b')]:_0x3e216b[_0x74c7('0x36')];if(_0x297988[_0x74c7('0x37')][_0x74c7('0x4a')]){_0x54cd06['include']=[{'all':!![]}];}_0x54cd06=_['merge']({},_0x54cd06,_0x297988[_0x74c7('0x4b')]);return db[_0x74c7('0x32')][_0x74c7('0x4c')](_0x54cd06)['then'](handleEntityNotFound(_0x2039d1,null))[_0x74c7('0x2a')](respondWithResult(_0x2039d1,null))[_0x74c7('0x49')](handleError(_0x2039d1,null));};exports[_0x74c7('0x4d')]=function(_0x459866,_0x35839a,_0x2823fd){return db[_0x74c7('0x32')]['find']({'where':{'id':_0x459866[_0x74c7('0x4e')]['id']},'attributes':[_0x74c7('0x2e'),_0x74c7('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x35839a,null))[_0x74c7('0x2a')](function(_0x4512c4){if(_0x4512c4){var _0x41ab18=path[_0x74c7('0x4f')](config[_0x74c7('0x50')],_0x74c7('0x51'),util['format'](_0x74c7('0x52'),path[_0x74c7('0x53')](_0x4512c4[_0x74c7('0x7')])));var _0x24a773=fs[_0x74c7('0x54')](_0x41ab18);var _0x4efc41=archiver(_0x74c7('0x55'),{'zlib':{'level':0x9}});_0x4efc41['on'](_0x74c7('0x56'),function(_0x594f8c){if(_0x594f8c[_0x74c7('0x57')]===_0x74c7('0x58')){logger['error'](_0x594f8c);}else{throw new db['Sequelize']['Error'](_0x74c7('0x59'));}});_0x4efc41['on'](_0x74c7('0x2d'),function(_0x1572d8){throw new db['Sequelize'][(_0x74c7('0x5a'))](_0x74c7('0x59'));});_0x4efc41[_0x74c7('0x5b')](_0x24a773);_0x4efc41[_0x74c7('0x5c')]('**/*',{'cwd':path[_0x74c7('0x4f')](config['root'],_0x74c7('0x51'),path['dirname'](_0x4512c4[_0x74c7('0x7')])),'ignore':[path[_0x74c7('0x4f')](path['basename'](_0x4512c4[_0x74c7('0x7')]),_0x74c7('0x5d')),path['join'](path[_0x74c7('0x53')](_0x4512c4[_0x74c7('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x74c7('0x5e')]();_0x24a773['on'](_0x74c7('0x5f'),function(){if(!fs['existsSync'](_0x41ab18)){throw new db['Sequelize'][(_0x74c7('0x5a'))](_0x74c7('0x60'));}return _0x35839a[_0x74c7('0x4d')](_0x41ab18,util[_0x74c7('0x61')]('%s.zip',path[_0x74c7('0x53')](_0x4512c4[_0x74c7('0x7')])),function(_0x1c436e){if(_0x1c436e){throw new db[(_0x74c7('0x62'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x74c7('0x63')](_0x41ab18);logger['info']('Download\x20completed');logger[_0x74c7('0x64')]('Temporary\x20file\x20removed');});});}return null;})[_0x74c7('0x49')](handleError(_0x35839a,null));};exports[_0x74c7('0x65')]=function(_0x156f5e,_0x5e9cb4,_0x6f5a8c){var _0x54291e=path['basename'](_0x156f5e[_0x74c7('0x66')][_0x74c7('0x67')],path[_0x74c7('0x68')](_0x156f5e[_0x74c7('0x66')]['filename']));var _0x51d569=path['join'](config[_0x74c7('0x50')],'server/files/plugins',_0x156f5e['file'][_0x74c7('0x67')]);var _0x468b89=path[_0x74c7('0x4f')](config['root'],'server/files/plugins',_0x54291e);logger['info'](_0x74c7('0x69'),_0x51d569);logger[_0x74c7('0x64')]('Plugin\x20upload\x20destination:\x20%s',_0x468b89);try{fs[_0x74c7('0x6a')](_0x51d569,parseInt(_0x74c7('0x6b'),0x8));extract(_0x51d569,{'dir':_0x468b89},function(_0x2f5621){if(_0x2f5621){logger[_0x74c7('0x2d')](_0x2f5621);handleError(_0x2f5621,!![]);};var _0x203997=fs[_0x74c7('0x6c')](_0x468b89);if(_0x203997['length']>0x1){removeReferences(_0x51d569,_0x468b89);logger['error'](_0x74c7('0x6d'));return _0x6f5a8c(new Error(_0x74c7('0x6d')));}var _0x2125c9=fs['lstatSync'](path[_0x74c7('0x4f')](_0x468b89,_0x203997[0x0]));if(_0x2125c9[_0x74c7('0x6e')]()){removeReferences(_0x51d569,_0x468b89);logger[_0x74c7('0x2d')](_0x74c7('0x6d'));return _0x6f5a8c(new Error(_0x74c7('0x6d')));}if(_0x2125c9['isDirectory']()){var _0x10c91c=fs['readdirSync'](path[_0x74c7('0x4f')](_0x468b89,_0x203997[0x0]));if(_0x10c91c[_0x74c7('0x3d')]===0x0){removeReferences(_0x51d569,_0x468b89);logger[_0x74c7('0x2d')]('Invalid\x20plugin\x20structure');return _0x6f5a8c(new Error('Invalid\x20plugin\x20structure'));}var _0x599c65=_0x10c91c[_0x74c7('0x6f')](function(_0x5eced4){return _0x5eced4===_0x74c7('0x70');});if(!_0x599c65){return _0x6f5a8c(new Error(_0x74c7('0x71')));}var _0x5a726d=fs['readFileSync'](path[_0x74c7('0x4f')](_0x468b89,_0x203997[0x0],_0x74c7('0x70')));var _0x412a23=JSON[_0x74c7('0x72')](_0x5a726d);if(_0x74c7('0x21')==typeof _0x412a23['name']){return _0x6f5a8c(new Error(_0x74c7('0x73')));}if(_0x74c7('0x21')==typeof _0x412a23[_0x74c7('0x45')]){return _0x6f5a8c(new Error(_0x74c7('0x74')));}if('undefined'==typeof _0x412a23[_0x74c7('0x75')]){return _0x6f5a8c(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x74c7('0x21')==typeof _0x412a23[_0x74c7('0x76')]){return _0x6f5a8c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x412a23[_0x74c7('0x45')]===_0x74c7('0x77')){if(_0x74c7('0x21')==typeof _0x412a23[_0x74c7('0x76')]['views']){return _0x6f5a8c(new Error(_0x74c7('0x78')));}if('undefined'==typeof _0x412a23[_0x74c7('0x76')][_0x74c7('0x79')][_0x74c7('0x7a')]&&_0x74c7('0x21')==typeof _0x412a23[_0x74c7('0x76')][_0x74c7('0x79')][_0x74c7('0x7b')]){return _0x6f5a8c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x412a23[_0x74c7('0x45')]===_0x74c7('0x7c')){if(_0x74c7('0x21')==typeof _0x412a23[_0x74c7('0x76')]['scriptName']){return _0x6f5a8c(new Error(_0x74c7('0x7d')));}if(_0x74c7('0x21')==typeof _0x412a23['parameters'][_0x74c7('0x7e')]){return _0x6f5a8c(new Error(_0x74c7('0x7f')));}}else{return _0x6f5a8c(new Error(_0x74c7('0x80')));}var _0x2e9ab4=_0x412a23[_0x74c7('0x2e')];var _0x36ee9f=_0x412a23[_0x74c7('0x81')];var _0x253dc8=_0x412a23[_0x74c7('0x45')];var _0x2fc394=_0x412a23[_0x74c7('0x82')]?_0x412a23[_0x74c7('0x82')]:_0x74c7('0x83');var _0x5a84ea=_0x412a23[_0x74c7('0x84')]?_0x412a23['icon']:'icon-apps';var _0x2fbe73='';var _0x3c6a70='';var _0x4c1e0e='';var _0x334204='';var _0xb95926=_0x412a23[_0x74c7('0x75')];if(_0x253dc8===_0x74c7('0x77')){if(_0x74c7('0x21')!=typeof _0x412a23[_0x74c7('0x76')][_0x74c7('0x79')][_0x74c7('0x7a')]){var _0x9c4c52=_0x412a23[_0x74c7('0x76')][_0x74c7('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x9c4c52)){_0x2fbe73=path[_0x74c7('0x4f')](_0x74c7('0x85'),_0x54291e,_0x203997[0x0],_0x9c4c52);}else{_0x2fbe73=_0x9c4c52;}}else{logger[_0x74c7('0x64')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x74c7('0x21')!=typeof _0x412a23[_0x74c7('0x76')]['views'][_0x74c7('0x7b')]){var _0x191467=_0x412a23[_0x74c7('0x76')][_0x74c7('0x79')][_0x74c7('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x191467)){_0x3c6a70=path[_0x74c7('0x4f')](_0x74c7('0x85'),_0x54291e,_0x203997[0x0],_0x191467);}else{_0x3c6a70=_0x191467;}}else{logger[_0x74c7('0x64')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x253dc8===_0x74c7('0x7c')){_0x4c1e0e=_0x412a23[_0x74c7('0x76')][_0x74c7('0x86')];_0x334204=_0x412a23[_0x74c7('0x76')][_0x74c7('0x7e')];if('undefined'!=typeof _0x412a23['parameters']['views']){if(_0x74c7('0x21')!=typeof _0x412a23[_0x74c7('0x76')][_0x74c7('0x79')][_0x74c7('0x7a')]){var _0x9c4c52=_0x412a23['parameters'][_0x74c7('0x79')][_0x74c7('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x74c7('0x87')](_0x9c4c52)){_0x2fbe73=path[_0x74c7('0x4f')](_0x74c7('0x85'),_0x54291e,_0x203997[0x0],_0x9c4c52);}else{_0x2fbe73=_0x9c4c52;}}if('undefined'!=typeof _0x412a23[_0x74c7('0x76')][_0x74c7('0x79')]['agent']){var _0x191467=_0x412a23['parameters'][_0x74c7('0x79')][_0x74c7('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x74c7('0x87')](_0x191467)){_0x3c6a70=path[_0x74c7('0x4f')](_0x74c7('0x85'),_0x54291e,_0x203997[0x0],_0x191467);}else{_0x3c6a70=_0x191467;}}}}var _0x38fadd={'name':_0x2e9ab4,'description':_0x36ee9f,'path':path[_0x74c7('0x4f')](_0x54291e,_0x203997[0x0]),'type':_0x253dc8,'sidebar':_0x2fc394,'icon':_0x5a84ea,'adminUrl':_0x2fbe73,'agentUrl':_0x3c6a70,'scriptName':_0x4c1e0e,'scriptPath':_0x334204,'version':_0xb95926};removeReferences(_0x51d569,null);return db[_0x74c7('0x32')][_0x74c7('0x88')](_0x38fadd)[_0x74c7('0x2a')](function(_0x19f57c){var _0x1b3d1d={'role':_0x156f5e[_0x74c7('0x89')][_0x74c7('0x8a')],'userProfileId':_0x156f5e['body'][_0x74c7('0x8b')]};if(!_0x1b3d1d)throw new Error(_0x74c7('0x8c'));if(_0x1b3d1d['role']===_0x74c7('0x8d')){var _0x565fe4=_0x19f57c['get']({'plain':!![]});return db[_0x74c7('0x8e')][_0x74c7('0x4c')]({'where':{'name':'Plugins','userProfileId':_0x1b3d1d[_0x74c7('0x8b')]},'raw':!![]})[_0x74c7('0x2a')](function(_0x39b5dd){if(_0x39b5dd&&_0x39b5dd[_0x74c7('0x8f')]===0x0){return db[_0x74c7('0x90')]['create']({'name':_0x565fe4[_0x74c7('0x2e')],'resourceId':_0x565fe4['id'],'type':_0x39b5dd[_0x74c7('0x2e')],'sectionId':_0x39b5dd['id']},{})['then'](function(){return _0x19f57c;});}else{return _0x19f57c;}})['catch'](function(_0x311aa7){logger[_0x74c7('0x2d')](_0x74c7('0x91'),_0x311aa7);throw _0x311aa7;});}return _0x19f57c;})[_0x74c7('0x2a')](respondWithResult(_0x5e9cb4,null))[_0x74c7('0x49')](handleError(_0x5e9cb4,null));}});}catch(_0x3a87a0){_0x5e9cb4[_0x74c7('0x1d')](0x1f4)[_0x74c7('0x2f')](_0x3a87a0);}};function removeReferences(_0x3f0bc1,_0xc64d11){try{if(_0x3f0bc1){fs[_0x74c7('0x63')](_0x3f0bc1);logger[_0x74c7('0x64')](_0x74c7('0x92'));}if(_0xc64d11){rimraf(_0xc64d11,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x88d748){logger[_0x74c7('0x2d')](_0x88d748);}}exports[_0x74c7('0x29')]=function(_0x195dbb,_0x5eade2,_0x3205ff){return db['Plugin']['find']({'where':{'id':_0x195dbb[_0x74c7('0x4e')]['id']}})[_0x74c7('0x2a')](handleEntityNotFound(_0x5eade2,null))['then'](saveUpdates(_0x195dbb['body'],null))['then'](respondWithResult(_0x5eade2,null))['catch'](handleError(_0x5eade2,null));};exports[_0x74c7('0x93')]=function(_0x37c934,_0x5b6991,_0x2c3764){return db[_0x74c7('0x32')]['find']({'where':{'id':_0x37c934[_0x74c7('0x4e')]['id']}})['then'](function(_0x12a238){if(_0x12a238){return _0x12a238[_0x74c7('0x2c')]();}})[_0x74c7('0x2a')](function(_0x129d8d){rimraf(path[_0x74c7('0x4f')](config[_0x74c7('0x50')],'server/files/plugins',path['dirname'](_0x129d8d[_0x74c7('0x7')])),function(){});return _0x129d8d;})['then'](handleEntityNotFound(_0x5b6991,null))[_0x74c7('0x2a')](respondWithStatusCode(_0x5b6991,null))[_0x74c7('0x49')](handleError(_0x5b6991,null));};exports[_0x74c7('0x94')]=function(_0x33166b,_0x484fbc,_0x40c0c1){return BPromise[_0x74c7('0x95')]()[_0x74c7('0x2a')](function(){if(!_0x33166b[_0x74c7('0x37')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x33166b[_0x74c7('0x37')][_0x74c7('0x96')]){throw new Error(_0x74c7('0x97'));}var _0x4e12d4=_0x33166b['query'][_0x74c7('0x98')]?_0x33166b['query']['hostname']+':'+_0x33166b[_0x74c7('0x37')][_0x74c7('0x96')]:_0x74c7('0x99')+_0x33166b['query']['port'];var _0x439019=_0x33166b['query'][_0x74c7('0x1f')]?_0x33166b['query'][_0x74c7('0x1f')]:!![];var _0x2da4dc=_0x33166b['query'][_0x74c7('0x9a')]?_0x33166b[_0x74c7('0x37')][_0x74c7('0x9a')]:null;var _0x292eae={'method':_0x33166b[_0x74c7('0x9b')],'uri':util[_0x74c7('0x61')](_0x74c7('0x9c'),_0x4e12d4,_0x33166b[_0x74c7('0x37')][_0x74c7('0x7')]),'json':_0x439019,'resolveWithFullResponse':!![],'encoding':_0x2da4dc,'qs':_0x33166b['query']};if(_0x33166b['headers']){_0x292eae['headers']=_0x33166b['headers'];if(_0x292eae[_0x74c7('0x9d')][_0x74c7('0x9e')]){delete _0x292eae[_0x74c7('0x9d')][_0x74c7('0x9e')];}}if(_0x292eae[_0x74c7('0x9d')][_0x74c7('0x9f')]){delete _0x292eae[_0x74c7('0x9d')][_0x74c7('0x9f')];}return rp(_0x292eae);})[_0x74c7('0x2a')](function(_0x5330d5){if(_0x5330d5){_0x484fbc[_0x74c7('0x24')](_0x5330d5[_0x74c7('0x9d')]);logger[_0x74c7('0x64')](_0x5330d5[_0x74c7('0x89')]);if(_[_0x74c7('0xa0')](_0x33166b[_0x74c7('0x37')][_0x74c7('0x7')],_0x74c7('0x4d'))&&_0x5330d5[_0x74c7('0xa1')]==0x1f4){return _0x484fbc[_0x74c7('0x1c')](_0x5330d5[_0x74c7('0xa1')]);}else{return _0x484fbc[_0x74c7('0x1d')](_0x5330d5[_0x74c7('0xa1')])['send'](_0x5330d5[_0x74c7('0x89')]);}}else{return _0x484fbc['sendStatus'](0xc8);}})[_0x74c7('0x49')](handleError(_0x484fbc,null));};exports['webhookPost']=function(_0x22204a,_0x4a8171,_0x595468){return BPromise[_0x74c7('0x95')]()['then'](function(){if(!_0x22204a[_0x74c7('0x37')][_0x74c7('0x7')]){throw new Error(_0x74c7('0xa2'));}if(!_0x22204a[_0x74c7('0x37')][_0x74c7('0x96')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x51aae5=_0x22204a[_0x74c7('0x37')]['hostname']?_0x22204a[_0x74c7('0x37')][_0x74c7('0x98')]+':'+_0x22204a['query'][_0x74c7('0x96')]:_0x74c7('0x99')+_0x22204a[_0x74c7('0x37')][_0x74c7('0x96')];var _0x4767d1=_0x22204a[_0x74c7('0x37')][_0x74c7('0x1f')]?_0x22204a[_0x74c7('0x37')][_0x74c7('0x1f')]:!![];var _0x3a1dca=_0x22204a[_0x74c7('0x37')][_0x74c7('0x9a')]?_0x22204a['query'][_0x74c7('0x9a')]:null;var _0x295ba0={'method':_0x22204a[_0x74c7('0x9b')],'uri':util[_0x74c7('0x61')](_0x74c7('0x9c'),_0x51aae5,_0x22204a[_0x74c7('0x37')][_0x74c7('0x7')]),'json':_0x4767d1,'resolveWithFullResponse':!![],'encoding':_0x3a1dca,'body':_0x22204a['body']};if(_0x22204a['headers']){_0x295ba0[_0x74c7('0x9d')]=_0x22204a[_0x74c7('0x9d')];if(_0x295ba0[_0x74c7('0x9d')][_0x74c7('0x9e')]){delete _0x295ba0[_0x74c7('0x9d')]['content-length'];}}if(_0x295ba0[_0x74c7('0x9d')][_0x74c7('0x9f')]){delete _0x295ba0['headers'][_0x74c7('0x9f')];}return rp(_0x295ba0);})[_0x74c7('0x2a')](function(_0x57d2a0){if(_0x57d2a0){_0x4a8171[_0x74c7('0x24')](_0x57d2a0[_0x74c7('0x9d')]);logger[_0x74c7('0x64')](_0x57d2a0['body']);return _0x4a8171[_0x74c7('0x1d')](_0x57d2a0[_0x74c7('0xa1')])[_0x74c7('0x2f')](_0x57d2a0[_0x74c7('0x89')]);}else{return _0x4a8171[_0x74c7('0x1c')](0xc8);}})['catch'](handleError(_0x4a8171,null));}; \ No newline at end of file +var _0x1d0e=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','filename','extname','file','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','sendStatus','webhookPost','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','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','./plugin.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Plugins','UserProfileResource','destroy','end','error','stack','name','send','index','Plugin','fieldName','type','key','model','filters','intersection','query','attributes','fields'];(function(_0x314c45,_0x15dde8){var _0x355cc8=function(_0x377b44){while(--_0x377b44){_0x314c45['push'](_0x314c45['shift']());}};_0x355cc8(++_0x15dde8);}(_0x1d0e,0x11b));var _0xe1d0=function(_0x4dfd20,_0x57adb9){_0x4dfd20=_0x4dfd20-0x0;var _0x465f49=_0x1d0e[_0x4dfd20];return _0x465f49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d0('0x0'));var zipdir=require(_0xe1d0('0x1'));var jsonpatch=require(_0xe1d0('0x2'));var rp=require(_0xe1d0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe1d0('0x4'));var util=require('util');var path=require(_0xe1d0('0x5'));var sox=require(_0xe1d0('0x6'));var csv=require(_0xe1d0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1d0('0x8'));var _=require(_0xe1d0('0x9'));var squel=require(_0xe1d0('0xa'));var crypto=require(_0xe1d0('0xb'));var jsforce=require(_0xe1d0('0xc'));var deskjs=require(_0xe1d0('0xd'));var toCsv=require(_0xe1d0('0x7'));var querystring=require(_0xe1d0('0xe'));var Papa=require(_0xe1d0('0xf'));var extract=require(_0xe1d0('0x10'));var rimraf=require('rimraf');var archiver=require(_0xe1d0('0x11'));var Redis=require(_0xe1d0('0x12'));var authService=require(_0xe1d0('0x13'));var qs=require(_0xe1d0('0x14'));var as=require(_0xe1d0('0x15'));var hardwareService=require(_0xe1d0('0x16'));var logger=require(_0xe1d0('0x17'))(_0xe1d0('0x18'));var utils=require(_0xe1d0('0x19'));var config=require(_0xe1d0('0x1a'));var licenseUtil=require(_0xe1d0('0x1b'));var db=require('../../mysqldb')['db'];config[_0xe1d0('0x1c')]=_[_0xe1d0('0x1d')](config[_0xe1d0('0x1c')],{'host':_0xe1d0('0x1e'),'port':0x18eb});var socket=require(_0xe1d0('0x1f'))(new Redis(config[_0xe1d0('0x1c')]));require(_0xe1d0('0x20'))[_0xe1d0('0x21')](socket);function respondWithStatusCode(_0xb1f83,_0x5d2a13){_0x5d2a13=_0x5d2a13||0xcc;return function(_0x4c5df1){if(_0x4c5df1){return _0xb1f83['sendStatus'](_0x5d2a13);}return _0xb1f83['status'](_0x5d2a13)['end']();};}function respondWithResult(_0x1ae722,_0x41d73d){_0x41d73d=_0x41d73d||0xc8;return function(_0x3fb8dd){if(_0x3fb8dd){return _0x1ae722[_0xe1d0('0x22')](_0x41d73d)[_0xe1d0('0x23')](_0x3fb8dd);}};}function respondWithFilteredResult(_0x23a358,_0x2f5874){return function(_0x1b3b28){if(_0x1b3b28){var _0x40dc49=typeof _0x2f5874[_0xe1d0('0x24')]===_0xe1d0('0x25')&&typeof _0x2f5874[_0xe1d0('0x26')]===_0xe1d0('0x25');var _0x1ca6bc=_0x1b3b28[_0xe1d0('0x27')];var _0x35154e=_0x40dc49?0x0:_0x2f5874[_0xe1d0('0x24')];var _0x3f4b7b=_0x40dc49?_0x1b3b28[_0xe1d0('0x27')]:_0x2f5874[_0xe1d0('0x24')]+_0x2f5874[_0xe1d0('0x26')];var _0x412f21;if(_0x3f4b7b>=_0x1ca6bc){_0x3f4b7b=_0x1ca6bc;_0x412f21=0xc8;}else{_0x412f21=0xce;}_0x23a358[_0xe1d0('0x22')](_0x412f21);return _0x23a358[_0xe1d0('0x28')](_0xe1d0('0x29'),_0x35154e+'-'+_0x3f4b7b+'/'+_0x1ca6bc)[_0xe1d0('0x23')](_0x1b3b28);}return null;};}function patchUpdates(_0x22e75c){return function(_0x324cb8){try{jsonpatch[_0xe1d0('0x2a')](_0x324cb8,_0x22e75c,!![]);}catch(_0xaa9064){return BPromise[_0xe1d0('0x2b')](_0xaa9064);}return _0x324cb8[_0xe1d0('0x2c')]();};}function saveUpdates(_0x137691,_0x533d30){return function(_0xfcd4b){if(_0xfcd4b){return _0xfcd4b[_0xe1d0('0x2d')](_0x137691)[_0xe1d0('0x2e')](function(_0x3c8e49){return _0x3c8e49;});}return null;};}function removeEntity(_0x333d90,_0x420d14){return function(_0x38ed50){if(_0x38ed50){return _0x38ed50['destroy']()[_0xe1d0('0x2e')](function(){var _0xed3ec0=_0x38ed50[_0xe1d0('0x2f')]({'plain':!![]});var _0x1eb520=_0xe1d0('0x30');return db[_0xe1d0('0x31')][_0xe1d0('0x32')]({'where':{'type':_0x1eb520,'resourceId':_0xed3ec0['id']}})['then'](function(){return _0x38ed50;});})[_0xe1d0('0x2e')](function(){_0x333d90[_0xe1d0('0x22')](0xcc)[_0xe1d0('0x33')]();});}};}function handleEntityNotFound(_0x5d6d31,_0x246d1f){return function(_0x2ae218){if(!_0x2ae218){_0x5d6d31['sendStatus'](0x194);}return _0x2ae218;};}function handleError(_0x1647eb,_0x353d7e){_0x353d7e=_0x353d7e||0x1f4;return function(_0x49fcae){logger[_0xe1d0('0x34')](_0x49fcae[_0xe1d0('0x35')]);if(_0x49fcae['name']){delete _0x49fcae[_0xe1d0('0x36')];}_0x1647eb['status'](_0x353d7e)[_0xe1d0('0x37')](_0x49fcae);};}exports[_0xe1d0('0x38')]=function(_0x28372c,_0x14505d){var _0x1fc288={},_0x500e11={},_0x5c8b20={'count':0x0,'rows':[]};var _0x3ed40d=_['map'](db[_0xe1d0('0x39')]['rawAttributes'],function(_0x25d9e5){return{'name':_0x25d9e5[_0xe1d0('0x3a')],'type':_0x25d9e5[_0xe1d0('0x3b')][_0xe1d0('0x3c')]};});_0x500e11[_0xe1d0('0x3d')]=_['map'](_0x3ed40d,'name');_0x500e11['query']=_['keys'](_0x28372c['query']);_0x500e11[_0xe1d0('0x3e')]=_[_0xe1d0('0x3f')](_0x500e11[_0xe1d0('0x3d')],_0x500e11[_0xe1d0('0x40')]);_0x1fc288[_0xe1d0('0x41')]=_[_0xe1d0('0x3f')](_0x500e11[_0xe1d0('0x3d')],qs[_0xe1d0('0x42')](_0x28372c[_0xe1d0('0x40')][_0xe1d0('0x42')]));_0x1fc288[_0xe1d0('0x41')]=_0x1fc288[_0xe1d0('0x41')][_0xe1d0('0x43')]?_0x1fc288['attributes']:_0x500e11['model'];if(!_0x28372c[_0xe1d0('0x40')][_0xe1d0('0x44')](_0xe1d0('0x45'))){_0x1fc288[_0xe1d0('0x26')]=qs[_0xe1d0('0x26')](_0x28372c[_0xe1d0('0x40')][_0xe1d0('0x26')]);_0x1fc288[_0xe1d0('0x24')]=qs[_0xe1d0('0x24')](_0x28372c[_0xe1d0('0x40')][_0xe1d0('0x24')]);}_0x1fc288[_0xe1d0('0x46')]=qs[_0xe1d0('0x47')](_0x28372c[_0xe1d0('0x40')][_0xe1d0('0x47')]);_0x1fc288['where']=qs[_0xe1d0('0x3e')](_[_0xe1d0('0x48')](_0x28372c[_0xe1d0('0x40')],_0x500e11['filters']),_0x3ed40d);if(_0x28372c[_0xe1d0('0x40')][_0xe1d0('0x49')]){_0x1fc288[_0xe1d0('0x4a')]=_[_0xe1d0('0x4b')](_0x1fc288['where'],{'$or':_[_0xe1d0('0x4c')](_0x3ed40d,function(_0x31789c){if(_0x31789c[_0xe1d0('0x3b')]!==_0xe1d0('0x4d')){var _0x39d380={};_0x39d380[_0x31789c[_0xe1d0('0x36')]]={'$like':'%'+_0x28372c['query'][_0xe1d0('0x49')]+'%'};return _0x39d380;}})});}_0x1fc288=_[_0xe1d0('0x4b')]({},_0x1fc288,_0x28372c['options']);var _0x464f5b={'where':_0x1fc288[_0xe1d0('0x4a')]};return db['Plugin'][_0xe1d0('0x27')](_0x464f5b)[_0xe1d0('0x2e')](function(_0x17315b){_0x5c8b20[_0xe1d0('0x27')]=_0x17315b;if(_0x28372c[_0xe1d0('0x40')][_0xe1d0('0x4e')]){_0x1fc288[_0xe1d0('0x4f')]=[{'all':!![]}];}return db[_0xe1d0('0x39')][_0xe1d0('0x50')](_0x1fc288);})[_0xe1d0('0x2e')](function(_0x134a5f){_0x5c8b20[_0xe1d0('0x51')]=_0x134a5f;return _0x5c8b20;})['then'](respondWithFilteredResult(_0x14505d,_0x1fc288))[_0xe1d0('0x52')](handleError(_0x14505d,null));};exports[_0xe1d0('0x53')]=function(_0x3208ff,_0x5a8f83){var _0x2cfdec={'raw':!![],'where':{'id':_0x3208ff[_0xe1d0('0x54')]['id']}},_0x41a80e={};_0x41a80e[_0xe1d0('0x3d')]=_[_0xe1d0('0x55')](db[_0xe1d0('0x39')][_0xe1d0('0x56')]);_0x41a80e[_0xe1d0('0x40')]=_[_0xe1d0('0x55')](_0x3208ff['query']);_0x41a80e[_0xe1d0('0x3e')]=_[_0xe1d0('0x3f')](_0x41a80e[_0xe1d0('0x3d')],_0x41a80e[_0xe1d0('0x40')]);_0x2cfdec[_0xe1d0('0x41')]=_[_0xe1d0('0x3f')](_0x41a80e[_0xe1d0('0x3d')],qs[_0xe1d0('0x42')](_0x3208ff[_0xe1d0('0x40')][_0xe1d0('0x42')]));_0x2cfdec['attributes']=_0x2cfdec[_0xe1d0('0x41')][_0xe1d0('0x43')]?_0x2cfdec[_0xe1d0('0x41')]:_0x41a80e[_0xe1d0('0x3d')];if(_0x3208ff['query']['includeAll']){_0x2cfdec[_0xe1d0('0x4f')]=[{'all':!![]}];}_0x2cfdec=_[_0xe1d0('0x4b')]({},_0x2cfdec,_0x3208ff['options']);return db[_0xe1d0('0x39')][_0xe1d0('0x57')](_0x2cfdec)[_0xe1d0('0x2e')](handleEntityNotFound(_0x5a8f83,null))[_0xe1d0('0x2e')](respondWithResult(_0x5a8f83,null))[_0xe1d0('0x52')](handleError(_0x5a8f83,null));};exports['download']=function(_0x5af20a,_0x3dc2c6,_0x515a98){return db[_0xe1d0('0x39')]['find']({'where':{'id':_0x5af20a['params']['id']},'attributes':[_0xe1d0('0x36'),_0xe1d0('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x3dc2c6,null))['then'](function(_0x5ecb79){if(_0x5ecb79){var _0x364267=path[_0xe1d0('0x58')](config[_0xe1d0('0x59')],_0xe1d0('0x5a'),util['format'](_0xe1d0('0x5b'),path[_0xe1d0('0x5c')](_0x5ecb79[_0xe1d0('0x5')])));var _0x98c5a9=fs[_0xe1d0('0x5d')](_0x364267);var _0x297414=archiver(_0xe1d0('0x5e'),{'zlib':{'level':0x9}});_0x297414['on']('warning',function(_0x242cab){if(_0x242cab[_0xe1d0('0x5f')]===_0xe1d0('0x60')){logger[_0xe1d0('0x34')](_0x242cab);}else{throw new db[(_0xe1d0('0x61'))][(_0xe1d0('0x62'))](_0xe1d0('0x63'));}});_0x297414['on'](_0xe1d0('0x34'),function(_0x275eb4){throw new db[(_0xe1d0('0x61'))]['Error'](_0xe1d0('0x63'));});_0x297414[_0xe1d0('0x64')](_0x98c5a9);_0x297414[_0xe1d0('0x65')]('**/*',{'cwd':path['join'](config['root'],_0xe1d0('0x5a'),path[_0xe1d0('0x66')](_0x5ecb79['path'])),'ignore':[path['join'](path[_0xe1d0('0x5c')](_0x5ecb79[_0xe1d0('0x5')]),_0xe1d0('0x67')),path['join'](path[_0xe1d0('0x5c')](_0x5ecb79['path']),_0xe1d0('0x68'))],'nodir':!![]})[_0xe1d0('0x69')]();_0x98c5a9['on'](_0xe1d0('0x6a'),function(){if(!fs[_0xe1d0('0x6b')](_0x364267)){throw new db[(_0xe1d0('0x61'))][(_0xe1d0('0x62'))](_0xe1d0('0x6c'));}return _0x3dc2c6[_0xe1d0('0x6d')](_0x364267,util[_0xe1d0('0x6e')](_0xe1d0('0x5b'),path[_0xe1d0('0x5c')](_0x5ecb79['path'])),function(_0x4895ea){if(_0x4895ea){throw new db[(_0xe1d0('0x61'))][(_0xe1d0('0x62'))](_0xe1d0('0x6f'));}fs['unlinkSync'](_0x364267);logger[_0xe1d0('0x70')](_0xe1d0('0x71'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0xe1d0('0x52')](handleError(_0x3dc2c6,null));};exports['upload']=function(_0x1f2bf4,_0x3943cf,_0x598360){var _0x290cba=path['basename'](_0x1f2bf4['file'][_0xe1d0('0x72')],path[_0xe1d0('0x73')](_0x1f2bf4['file'][_0xe1d0('0x72')]));var _0x2376ae=path[_0xe1d0('0x58')](config[_0xe1d0('0x59')],'server/files/plugins',_0x1f2bf4[_0xe1d0('0x74')]['filename']);var _0x408c2f=path[_0xe1d0('0x58')](config['root'],_0xe1d0('0x5a'),_0x290cba);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x2376ae);logger[_0xe1d0('0x70')]('Plugin\x20upload\x20destination:\x20%s',_0x408c2f);try{fs['chmodSync'](_0x2376ae,parseInt('0777',0x8));extract(_0x2376ae,{'dir':_0x408c2f},function(_0x11ba48){if(_0x11ba48){logger[_0xe1d0('0x34')](_0x11ba48);handleError(_0x11ba48,!![]);};var _0x490d10=fs[_0xe1d0('0x75')](_0x408c2f);if(_0x490d10[_0xe1d0('0x43')]>0x1){removeReferences(_0x2376ae,_0x408c2f);logger[_0xe1d0('0x34')]('Invalid\x20plugin\x20structure');return _0x598360(new Error(_0xe1d0('0x76')));}var _0x20173d=fs[_0xe1d0('0x77')](path[_0xe1d0('0x58')](_0x408c2f,_0x490d10[0x0]));if(_0x20173d['isFile']()){removeReferences(_0x2376ae,_0x408c2f);logger[_0xe1d0('0x34')](_0xe1d0('0x76'));return _0x598360(new Error(_0xe1d0('0x76')));}if(_0x20173d['isDirectory']()){var _0x91e6fb=fs['readdirSync'](path[_0xe1d0('0x58')](_0x408c2f,_0x490d10[0x0]));if(_0x91e6fb[_0xe1d0('0x43')]===0x0){removeReferences(_0x2376ae,_0x408c2f);logger['error'](_0xe1d0('0x76'));return _0x598360(new Error(_0xe1d0('0x76')));}var _0x3f758d=_0x91e6fb[_0xe1d0('0x78')](function(_0x4a9b96){return _0x4a9b96===_0xe1d0('0x79');});if(!_0x3f758d){return _0x598360(new Error(_0xe1d0('0x7a')));}var _0x37a7be=fs['readFileSync'](path[_0xe1d0('0x58')](_0x408c2f,_0x490d10[0x0],'manifest.json'));var _0x370a82=JSON['parse'](_0x37a7be);if(_0xe1d0('0x25')==typeof _0x370a82[_0xe1d0('0x36')]){return _0x598360(new Error(_0xe1d0('0x7b')));}if(_0xe1d0('0x25')==typeof _0x370a82['type']){return _0x598360(new Error(_0xe1d0('0x7c')));}if('undefined'==typeof _0x370a82[_0xe1d0('0x7d')]){return _0x598360(new Error(_0xe1d0('0x7e')));}if(_0xe1d0('0x25')==typeof _0x370a82[_0xe1d0('0x7f')]){return _0x598360(new Error(_0xe1d0('0x80')));}if(_0x370a82['type']===_0xe1d0('0x81')){if(_0xe1d0('0x25')==typeof _0x370a82[_0xe1d0('0x7f')]['views']){return _0x598360(new Error(_0xe1d0('0x82')));}if('undefined'==typeof _0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x83')][_0xe1d0('0x84')]&&'undefined'==typeof _0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x83')][_0xe1d0('0x85')]){return _0x598360(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x370a82[_0xe1d0('0x3b')]===_0xe1d0('0x86')){if(_0xe1d0('0x25')==typeof _0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x87')]){return _0x598360(new Error(_0xe1d0('0x88')));}if(_0xe1d0('0x25')==typeof _0x370a82[_0xe1d0('0x7f')]['scriptPath']){return _0x598360(new Error(_0xe1d0('0x89')));}}else{return _0x598360(new Error(_0xe1d0('0x8a')));}var _0x2d7dcd=_0x370a82[_0xe1d0('0x36')];var _0x4c225a=_0x370a82[_0xe1d0('0x8b')];var _0x4595f8=_0x370a82[_0xe1d0('0x3b')];var _0x3c8129=_0x370a82[_0xe1d0('0x8c')]?_0x370a82[_0xe1d0('0x8c')]:'always';var _0x95bee4=_0x370a82[_0xe1d0('0x8d')]?_0x370a82[_0xe1d0('0x8d')]:_0xe1d0('0x8e');var _0x223985='';var _0x40e941='';var _0x2188ba='';var _0x3c53d1='';var _0x4efbea=_0x370a82[_0xe1d0('0x7d')];if(_0x4595f8===_0xe1d0('0x81')){if('undefined'!=typeof _0x370a82['parameters'][_0xe1d0('0x83')]['admin']){var _0x2c5f6c=_0x370a82[_0xe1d0('0x7f')]['views'][_0xe1d0('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xe1d0('0x8f')](_0x2c5f6c)){_0x223985=path[_0xe1d0('0x58')](_0xe1d0('0x90'),_0x290cba,_0x490d10[0x0],_0x2c5f6c);}else{_0x223985=_0x2c5f6c;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xe1d0('0x25')!=typeof _0x370a82['parameters'][_0xe1d0('0x83')][_0xe1d0('0x85')]){var _0x1c387b=_0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1c387b)){_0x40e941=path[_0xe1d0('0x58')]('plugins',_0x290cba,_0x490d10[0x0],_0x1c387b);}else{_0x40e941=_0x1c387b;}}else{logger['info'](_0xe1d0('0x91'));}}else if(_0x4595f8===_0xe1d0('0x86')){_0x2188ba=_0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x87')];_0x3c53d1=_0x370a82['parameters'][_0xe1d0('0x92')];if('undefined'!=typeof _0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x83')]){if(_0xe1d0('0x25')!=typeof _0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x83')]['admin']){var _0x2c5f6c=_0x370a82['parameters'][_0xe1d0('0x83')][_0xe1d0('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xe1d0('0x8f')](_0x2c5f6c)){_0x223985=path[_0xe1d0('0x58')](_0xe1d0('0x90'),_0x290cba,_0x490d10[0x0],_0x2c5f6c);}else{_0x223985=_0x2c5f6c;}}if('undefined'!=typeof _0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x83')][_0xe1d0('0x85')]){var _0x1c387b=_0x370a82[_0xe1d0('0x7f')][_0xe1d0('0x83')][_0xe1d0('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xe1d0('0x8f')](_0x1c387b)){_0x40e941=path[_0xe1d0('0x58')](_0xe1d0('0x90'),_0x290cba,_0x490d10[0x0],_0x1c387b);}else{_0x40e941=_0x1c387b;}}}}var _0x465749={'name':_0x2d7dcd,'description':_0x4c225a,'path':path['join'](_0x290cba,_0x490d10[0x0]),'type':_0x4595f8,'sidebar':_0x3c8129,'icon':_0x95bee4,'adminUrl':_0x223985,'agentUrl':_0x40e941,'scriptName':_0x2188ba,'scriptPath':_0x3c53d1,'version':_0x4efbea};removeReferences(_0x2376ae,null);return db['Plugin'][_0xe1d0('0x93')](_0x465749)[_0xe1d0('0x2e')](function(_0x1517bb){var _0x31f231={'role':_0x1f2bf4[_0xe1d0('0x94')][_0xe1d0('0x95')],'userProfileId':_0x1f2bf4['body']['userProfileId']};if(!_0x31f231)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31f231[_0xe1d0('0x95')]===_0xe1d0('0x96')){var _0x4bfeb6=_0x1517bb['get']({'plain':!![]});return db[_0xe1d0('0x97')][_0xe1d0('0x57')]({'where':{'name':_0xe1d0('0x30'),'userProfileId':_0x31f231[_0xe1d0('0x98')]},'raw':!![]})[_0xe1d0('0x2e')](function(_0x128254){if(_0x128254&&_0x128254[_0xe1d0('0x99')]===0x0){return db['UserProfileResource'][_0xe1d0('0x93')]({'name':_0x4bfeb6['name'],'resourceId':_0x4bfeb6['id'],'type':_0x128254['name'],'sectionId':_0x128254['id']},{})[_0xe1d0('0x2e')](function(){return _0x1517bb;});}else{return _0x1517bb;}})[_0xe1d0('0x52')](function(_0x4a861b){logger[_0xe1d0('0x34')](_0xe1d0('0x9a'),_0x4a861b);throw _0x4a861b;});}return _0x1517bb;})[_0xe1d0('0x2e')](respondWithResult(_0x3943cf,null))[_0xe1d0('0x52')](handleError(_0x3943cf,null));}});}catch(_0xc14fb1){_0x3943cf['status'](0x1f4)[_0xe1d0('0x37')](_0xc14fb1);}};function removeReferences(_0x42bffc,_0xab7577){try{if(_0x42bffc){fs[_0xe1d0('0x9b')](_0x42bffc);logger[_0xe1d0('0x70')](_0xe1d0('0x9c'));}if(_0xab7577){rimraf(_0xab7577,function(){});logger[_0xe1d0('0x70')](_0xe1d0('0x9d'));}}catch(_0xde07d4){logger['error'](_0xde07d4);}}exports[_0xe1d0('0x2d')]=function(_0x32e222,_0x7ff23c,_0xff2433){return db['Plugin'][_0xe1d0('0x57')]({'where':{'id':_0x32e222['params']['id']}})['then'](handleEntityNotFound(_0x7ff23c,null))[_0xe1d0('0x2e')](saveUpdates(_0x32e222[_0xe1d0('0x94')],null))[_0xe1d0('0x2e')](respondWithResult(_0x7ff23c,null))['catch'](handleError(_0x7ff23c,null));};exports['delete']=function(_0x2dea4f,_0x3ee500,_0x2fe2ec){return db[_0xe1d0('0x39')][_0xe1d0('0x57')]({'where':{'id':_0x2dea4f[_0xe1d0('0x54')]['id']}})[_0xe1d0('0x2e')](function(_0x310541){if(_0x310541){return _0x310541[_0xe1d0('0x32')]();}})[_0xe1d0('0x2e')](function(_0x75362e){rimraf(path['join'](config['root'],_0xe1d0('0x5a'),path[_0xe1d0('0x66')](_0x75362e['path'])),function(){});return _0x75362e;})[_0xe1d0('0x2e')](handleEntityNotFound(_0x3ee500,null))[_0xe1d0('0x2e')](respondWithStatusCode(_0x3ee500,null))[_0xe1d0('0x52')](handleError(_0x3ee500,null));};exports[_0xe1d0('0x9e')]=function(_0x18d5d5,_0x299f4b,_0x138635){return BPromise[_0xe1d0('0x9f')]()[_0xe1d0('0x2e')](function(){if(!_0x18d5d5[_0xe1d0('0x40')][_0xe1d0('0x5')]){throw new Error(_0xe1d0('0xa0'));}if(!_0x18d5d5[_0xe1d0('0x40')][_0xe1d0('0xa1')]){throw new Error(_0xe1d0('0xa2'));}var _0x344220=_0x18d5d5['query']['hostname']?_0x18d5d5['query'][_0xe1d0('0xa3')]+':'+_0x18d5d5['query'][_0xe1d0('0xa1')]:_0xe1d0('0xa4')+_0x18d5d5[_0xe1d0('0x40')][_0xe1d0('0xa1')];var _0x5e4c3b=_0x18d5d5[_0xe1d0('0x40')][_0xe1d0('0x23')]?_0x18d5d5[_0xe1d0('0x40')][_0xe1d0('0x23')]:!![];var _0x24dd87=_0x18d5d5['query'][_0xe1d0('0xa5')]?_0x18d5d5['query']['encoding']:null;var _0x5032f0={'method':_0x18d5d5[_0xe1d0('0xa6')],'uri':util[_0xe1d0('0x6e')](_0xe1d0('0xa7'),_0x344220,_0x18d5d5[_0xe1d0('0x40')][_0xe1d0('0x5')]),'json':_0x5e4c3b,'resolveWithFullResponse':!![],'encoding':_0x24dd87,'qs':_0x18d5d5[_0xe1d0('0x40')]};if(_0x18d5d5[_0xe1d0('0xa8')]){_0x5032f0[_0xe1d0('0xa8')]=_0x18d5d5['headers'];if(_0x5032f0['headers'][_0xe1d0('0xa9')]){delete _0x5032f0['headers']['content-length'];}}if(_0x5032f0[_0xe1d0('0xa8')][_0xe1d0('0xaa')]){delete _0x5032f0[_0xe1d0('0xa8')]['content-type'];}return rp(_0x5032f0);})[_0xe1d0('0x2e')](function(_0x239ac9){if(_0x239ac9){_0x299f4b['set'](_0x239ac9[_0xe1d0('0xa8')]);logger[_0xe1d0('0x70')](_0x239ac9['body']);if(_[_0xe1d0('0xab')](_0x18d5d5[_0xe1d0('0x40')][_0xe1d0('0x5')],_0xe1d0('0x6d'))&&_0x239ac9[_0xe1d0('0xac')]==0x1f4){return _0x299f4b[_0xe1d0('0xad')](_0x239ac9[_0xe1d0('0xac')]);}else{return _0x299f4b[_0xe1d0('0x22')](_0x239ac9['statusCode'])['send'](_0x239ac9[_0xe1d0('0x94')]);}}else{return _0x299f4b[_0xe1d0('0xad')](0xc8);}})[_0xe1d0('0x52')](handleError(_0x299f4b,null));};exports[_0xe1d0('0xae')]=function(_0x53ce5,_0x54dfa6,_0x2e6405){return BPromise[_0xe1d0('0x9f')]()[_0xe1d0('0x2e')](function(){if(!_0x53ce5[_0xe1d0('0x40')][_0xe1d0('0x5')]){throw new Error(_0xe1d0('0xa0'));}if(!_0x53ce5['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x11ba13=_0x53ce5[_0xe1d0('0x40')][_0xe1d0('0xa3')]?_0x53ce5[_0xe1d0('0x40')][_0xe1d0('0xa3')]+':'+_0x53ce5['query']['port']:_0xe1d0('0xa4')+_0x53ce5['query'][_0xe1d0('0xa1')];var _0x2baf53=_0x53ce5[_0xe1d0('0x40')]['json']?_0x53ce5[_0xe1d0('0x40')][_0xe1d0('0x23')]:!![];var _0x4d2c90=_0x53ce5[_0xe1d0('0x40')][_0xe1d0('0xa5')]?_0x53ce5['query']['encoding']:null;var _0x2ad654={'method':_0x53ce5[_0xe1d0('0xa6')],'uri':util[_0xe1d0('0x6e')](_0xe1d0('0xa7'),_0x11ba13,_0x53ce5['query']['path']),'json':_0x2baf53,'resolveWithFullResponse':!![],'encoding':_0x4d2c90,'body':_0x53ce5[_0xe1d0('0x94')]};if(_0x53ce5['headers']){_0x2ad654['headers']=_0x53ce5[_0xe1d0('0xa8')];if(_0x2ad654[_0xe1d0('0xa8')][_0xe1d0('0xa9')]){delete _0x2ad654[_0xe1d0('0xa8')][_0xe1d0('0xa9')];}}if(_0x2ad654[_0xe1d0('0xa8')][_0xe1d0('0xaa')]){delete _0x2ad654['headers'][_0xe1d0('0xaa')];}return rp(_0x2ad654);})[_0xe1d0('0x2e')](function(_0x4a8c15){if(_0x4a8c15){_0x54dfa6[_0xe1d0('0x28')](_0x4a8c15[_0xe1d0('0xa8')]);logger[_0xe1d0('0x70')](_0x4a8c15[_0xe1d0('0x94')]);return _0x54dfa6['status'](_0x4a8c15['statusCode'])[_0xe1d0('0x37')](_0x4a8c15[_0xe1d0('0x94')]);}else{return _0x54dfa6[_0xe1d0('0xad')](0xc8);}})[_0xe1d0('0x52')](handleError(_0x54dfa6,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2fb5269..d86d5b5 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 _0x0967=['update','remove','emit','hasOwnProperty','hook','exports','events','Plugin','setMaxListeners','save'];(function(_0x592ca0,_0x30d956){var _0x2c2e71=function(_0x19310e){while(--_0x19310e){_0x592ca0['push'](_0x592ca0['shift']());}};_0x2c2e71(++_0x30d956);}(_0x0967,0x100));var _0x7096=function(_0x20c28a,_0xa13612){_0x20c28a=_0x20c28a-0x0;var _0x5ddb2b=_0x0967[_0x20c28a];return _0x5ddb2b;};'use strict';var EventEmitter=require(_0x7096('0x0'));var Plugin=require('../../mysqldb')['db'][_0x7096('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7096('0x2')](0x0);var events={'afterCreate':_0x7096('0x3'),'afterUpdate':_0x7096('0x4'),'afterDestroy':_0x7096('0x5')};function emitEvent(_0xe41170){return function(_0x4106a2,_0x2a50e2,_0x4eba77){PluginEvents[_0x7096('0x6')](_0xe41170+':'+_0x4106a2['id'],_0x4106a2);PluginEvents[_0x7096('0x6')](_0xe41170,_0x4106a2);_0x4eba77(null);};}for(var e in events){if(events[_0x7096('0x7')](e)){var event=events[e];Plugin[_0x7096('0x8')](e,emitEvent(event));}}module[_0x7096('0x9')]=PluginEvents; \ No newline at end of file +var _0xcb41=['../../mysqldb','Plugin','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x526a2e,_0x26b645){var _0x37b81a=function(_0x56af45){while(--_0x56af45){_0x526a2e['push'](_0x526a2e['shift']());}};_0x37b81a(++_0x26b645);}(_0xcb41,0x1df));var _0x1cb4=function(_0x171106,_0x10170c){_0x171106=_0x171106-0x0;var _0x3e0552=_0xcb41[_0x171106];return _0x3e0552;};'use strict';var EventEmitter=require(_0x1cb4('0x0'));var Plugin=require(_0x1cb4('0x1'))['db'][_0x1cb4('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1cb4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cb4('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb12e88){return function(_0x31d7b5,_0x19b235,_0x6ef253){PluginEvents[_0x1cb4('0x5')](_0xb12e88+':'+_0x31d7b5['id'],_0x31d7b5);PluginEvents[_0x1cb4('0x5')](_0xb12e88,_0x31d7b5);_0x6ef253(null);};}for(var e in events){if(events[_0x1cb4('0x6')](e)){var event=events[e];Plugin[_0x1cb4('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 656e40f..ea5314e 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 _0x4f80=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','plugins','lodash'];(function(_0x1d475a,_0x1872b0){var _0x3128fe=function(_0x246270){while(--_0x246270){_0x1d475a['push'](_0x1d475a['shift']());}};_0x3128fe(++_0x1872b0);}(_0x4f80,0xcb));var _0x04f8=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0x4f80[_0xac56ce];return _0x5105e1;};'use strict';var _=require(_0x04f8('0x0'));var util=require(_0x04f8('0x1'));var logger=require(_0x04f8('0x2'))('api');var moment=require(_0x04f8('0x3'));var BPromise=require(_0x04f8('0x4'));var rp=require(_0x04f8('0x5'));var fs=require('fs');var path=require(_0x04f8('0x6'));var rimraf=require(_0x04f8('0x7'));var config=require(_0x04f8('0x8'));var attributes=require('./plugin.attributes');module[_0x04f8('0x9')]=function(_0x520bd8,_0x56b3ad){return _0x520bd8[_0x04f8('0xa')]('Plugin',attributes,{'tableName':_0x04f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9208=['../../config/environment','exports','Plugin','plugins','lodash','util','api','request-promise','path','rimraf'];(function(_0x230d4e,_0x23d426){var _0xf84444=function(_0x3e4a82){while(--_0x3e4a82){_0x230d4e['push'](_0x230d4e['shift']());}};_0xf84444(++_0x23d426);}(_0x9208,0x108));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8920('0x0'));var util=require(_0x8920('0x1'));var logger=require('../../config/logger')(_0x8920('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8920('0x3'));var fs=require('fs');var path=require(_0x8920('0x4'));var rimraf=require(_0x8920('0x5'));var config=require(_0x8920('0x6'));var attributes=require('./plugin.attributes');module[_0x8920('0x7')]=function(_0x126772,_0x194026){return _0x126772['define'](_0x8920('0x8'),attributes,{'tableName':_0x8920('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a468c21..8ff814e 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 _0xf165=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','Plugin','body','options','raw','stringify','catch','moment','bluebird'];(function(_0x1ad0be,_0x201224){var _0x561fe0=function(_0x286b6d){while(--_0x286b6d){_0x1ad0be['push'](_0x1ad0be['shift']());}};_0x561fe0(++_0x201224);}(_0xf165,0x11e));var _0x5f16=function(_0x5ddb7a,_0x1b8eb7){_0x5ddb7a=_0x5ddb7a-0x0;var _0x55ae1d=_0xf165[_0x5ddb7a];return _0x55ae1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f16('0x0'));var BPromise=require(_0x5f16('0x1'));var rs=require(_0x5f16('0x2'));var fs=require('fs');var Redis=require(_0x5f16('0x3'));var db=require(_0x5f16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f16('0x5'))('rpc');var config=require(_0x5f16('0x6'));var jayson=require(_0x5f16('0x7'));var client=jayson[_0x5f16('0x8')]['http']({'port':0x232a});config[_0x5f16('0x9')]=_[_0x5f16('0xa')](config[_0x5f16('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f16('0xb'))(new Redis(config['redis']));require(_0x5f16('0xc'))[_0x5f16('0xd')](socket);function respondWithRpcPromise(_0x2386f0,_0x1de962,_0x38884f){return new BPromise(function(_0x5b0023,_0x358cfa){return client[_0x5f16('0xe')](_0x2386f0,_0x38884f)[_0x5f16('0xf')](function(_0x298972){logger[_0x5f16('0x10')](_0x5f16('0x11'),_0x1de962,_0x5f16('0x12'));logger[_0x5f16('0x13')](_0x5f16('0x14'),_0x1de962,'request\x20sent',JSON['stringify'](_0x298972));if(_0x298972[_0x5f16('0x15')]){if(_0x298972[_0x5f16('0x15')][_0x5f16('0x16')]===0x1f4){logger['error'](_0x5f16('0x11'),_0x1de962,_0x298972['error'][_0x5f16('0x17')]);return _0x358cfa(_0x298972[_0x5f16('0x15')][_0x5f16('0x17')]);}logger[_0x5f16('0x15')](_0x5f16('0x11'),_0x1de962,_0x298972[_0x5f16('0x15')][_0x5f16('0x17')]);return _0x5b0023(_0x298972[_0x5f16('0x15')]['message']);}else{logger[_0x5f16('0x10')](_0x5f16('0x11'),_0x1de962,_0x5f16('0x12'));_0x5b0023(_0x298972[_0x5f16('0x18')][_0x5f16('0x17')]);}})['catch'](function(_0x1e2d1a){logger[_0x5f16('0x15')](_0x5f16('0x11'),_0x1de962,_0x1e2d1a);_0x358cfa(_0x1e2d1a);});});}exports[_0x5f16('0x19')]=function(_0x2e4d78){var _0x5929ab=this;return new Promise(function(_0x36e4ad,_0x2745b3){return db[_0x5f16('0x1a')]['create'](_0x2e4d78[_0x5f16('0x1b')],{'raw':_0x2e4d78[_0x5f16('0x1c')]?_0x2e4d78['options'][_0x5f16('0x1d')]===undefined?!![]:![]:!![]})[_0x5f16('0xf')](function(_0x49f91a){logger[_0x5f16('0x10')](_0x5f16('0x19'),_0x2e4d78);logger[_0x5f16('0x13')](_0x5f16('0x19'),_0x2e4d78,JSON[_0x5f16('0x1e')](_0x49f91a));_0x36e4ad(_0x49f91a);})[_0x5f16('0x1f')](function(_0x218c1f){logger['error'](_0x5f16('0x19'),_0x218c1f[_0x5f16('0x17')],_0x2e4d78);_0x2745b3(_0x5929ab[_0x5f16('0x15')](0x1f4,_0x218c1f['message']));});});}; \ No newline at end of file +var _0x73f7=['../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','request\x20sent','debug','stringify','error','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x73f7,0x1ca));var _0x773f=function(_0x46374f,_0x4c5273){_0x46374f=_0x46374f-0x0;var _0x4945ea=_0x73f7[_0x46374f];return _0x4945ea;};'use strict';var _=require('lodash');var util=require(_0x773f('0x0'));var moment=require('moment');var BPromise=require(_0x773f('0x1'));var rs=require(_0x773f('0x2'));var fs=require('fs');var Redis=require(_0x773f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x773f('0x4'));var logger=require(_0x773f('0x5'))(_0x773f('0x6'));var config=require(_0x773f('0x7'));var jayson=require(_0x773f('0x8'));var client=jayson['client'][_0x773f('0x9')]({'port':0x232a});config[_0x773f('0xa')]=_[_0x773f('0xb')](config[_0x773f('0xa')],{'host':_0x773f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x773f('0xa')]));require('./plugin.socket')[_0x773f('0xd')](socket);function respondWithRpcPromise(_0x20f58a,_0x3f9fea,_0x1fe2b2){return new BPromise(function(_0x1920f7,_0x5ab06f){return client[_0x773f('0xe')](_0x20f58a,_0x1fe2b2)['then'](function(_0x2f8cf7){logger[_0x773f('0xf')]('Plugin,\x20%s,\x20%s',_0x3f9fea,_0x773f('0x10'));logger[_0x773f('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x3f9fea,_0x773f('0x10'),JSON[_0x773f('0x12')](_0x2f8cf7));if(_0x2f8cf7[_0x773f('0x13')]){if(_0x2f8cf7[_0x773f('0x13')]['code']===0x1f4){logger['error'](_0x773f('0x14'),_0x3f9fea,_0x2f8cf7[_0x773f('0x13')][_0x773f('0x15')]);return _0x5ab06f(_0x2f8cf7[_0x773f('0x13')][_0x773f('0x15')]);}logger['error'](_0x773f('0x14'),_0x3f9fea,_0x2f8cf7['error'][_0x773f('0x15')]);return _0x1920f7(_0x2f8cf7['error'][_0x773f('0x15')]);}else{logger[_0x773f('0xf')](_0x773f('0x14'),_0x3f9fea,_0x773f('0x10'));_0x1920f7(_0x2f8cf7[_0x773f('0x16')]['message']);}})[_0x773f('0x17')](function(_0x597f0f){logger[_0x773f('0x13')](_0x773f('0x14'),_0x3f9fea,_0x597f0f);_0x5ab06f(_0x597f0f);});});}exports[_0x773f('0x18')]=function(_0x200402){var _0x767a99=this;return new Promise(function(_0x455e69,_0x569b2b){return db[_0x773f('0x19')][_0x773f('0x1a')](_0x200402[_0x773f('0x1b')],{'raw':_0x200402[_0x773f('0x1c')]?_0x200402[_0x773f('0x1c')][_0x773f('0x1d')]===undefined?!![]:![]:!![]})[_0x773f('0x1e')](function(_0x1f2196){logger[_0x773f('0xf')](_0x773f('0x18'),_0x200402);logger[_0x773f('0x11')](_0x773f('0x18'),_0x200402,JSON[_0x773f('0x12')](_0x1f2196));_0x455e69(_0x1f2196);})['catch'](function(_0x3405bf){logger[_0x773f('0x13')]('CreatePlugin',_0x3405bf[_0x773f('0x15')],_0x200402);_0x569b2b(_0x767a99[_0x773f('0x13')](0x1f4,_0x3405bf[_0x773f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9d8326e..78a5ad6 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 _0x4044=['register','length','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x4044,0xda));var _0x4404=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4044[_0x3947c9];return _0x2e7871;};'use strict';var PluginEvents=require(_0x4404('0x0'));var events=[_0x4404('0x1'),_0x4404('0x2'),_0x4404('0x3')];function createListener(_0x1d4d2f,_0x461710){return function(_0x12170e){_0x461710[_0x4404('0x4')](_0x1d4d2f,_0x12170e);};}function removeListener(_0x306fa2,_0x3a0fc6){return function(){PluginEvents[_0x4404('0x5')](_0x306fa2,_0x3a0fc6);};}exports[_0x4404('0x6')]=function(_0x3687fa){for(var _0x16c9f8=0x0,_0x35ae8a=events[_0x4404('0x7')];_0x16c9f8<_0x35ae8a;_0x16c9f8++){var _0x5c6f8d=events[_0x16c9f8];var _0x4c442d=createListener('plugin:'+_0x5c6f8d,_0x3687fa);PluginEvents['on'](_0x5c6f8d,_0x4c442d);}}; \ No newline at end of file +var _0x439b=['length','plugin:','./plugin.events','save','update','emit','register'];(function(_0x245588,_0x5c4d88){var _0x58a9e4=function(_0x541894){while(--_0x541894){_0x245588['push'](_0x245588['shift']());}};_0x58a9e4(++_0x5c4d88);}(_0x439b,0xb8));var _0xb439=function(_0x44460,_0x3726a2){_0x44460=_0x44460-0x0;var _0x3d52dc=_0x439b[_0x44460];return _0x3d52dc;};'use strict';var PluginEvents=require(_0xb439('0x0'));var events=[_0xb439('0x1'),'remove',_0xb439('0x2')];function createListener(_0x20ee48,_0x2a15d8){return function(_0x282d87){_0x2a15d8[_0xb439('0x3')](_0x20ee48,_0x282d87);};}function removeListener(_0x3b2513,_0x48081a){return function(){PluginEvents['removeListener'](_0x3b2513,_0x48081a);};}exports[_0xb439('0x4')]=function(_0x9ec25c){for(var _0x4c3e86=0x0,_0x3375a1=events[_0xb439('0x5')];_0x4c3e86<_0x3375a1;_0x4c3e86++){var _0x3e99fe=events[_0x4c3e86];var _0x21900f=createListener(_0xb439('0x6')+_0x3e99fe,_0x9ec25c);PluginEvents['on'](_0x3e99fe,_0x21900f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 90e7988..0252348 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(_0x3daab4,_0x353666){var _0x3fc7ea=function(_0x1d37bd){while(--_0x1d37bd){_0x3daab4['push'](_0x3daab4['shift']());}};_0x3fc7ea(++_0x353666);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x21edd4,_0x51e6e7){var _0x2651c5=function(_0x4f7ec7){while(--_0x4f7ec7){_0x21edd4['push'](_0x21edd4['shift']());}};_0x2651c5(++_0x51e6e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 78aaa8f..e20bcef 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 _0xe706=['dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','index','express','motion2','then','catch','params','create','body','script','join','../../files/plugins','cwd'];(function(_0x25cb26,_0x3838e9){var _0x46c69f=function(_0x15f8ff){while(--_0x15f8ff){_0x25cb26['push'](_0x25cb26['shift']());}};_0x46c69f(++_0x3838e9);}(_0xe706,0xa3));var _0x6e70=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0xe706[_0x45f6cb];return _0x5b7f93;};'use strict';var _=require(_0x6e70('0x0'));var pm2=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var path=require(_0x6e70('0x3'));var exec=require(_0x6e70('0x4'))[_0x6e70('0x5')];var BPromise=require(_0x6e70('0x6'));function handleEntityNotFound(_0x142c27,_0x2164a4){return function(_0x376a8d){if(!_0x376a8d){_0x142c27[_0x6e70('0x7')](0x194);;}return _0x376a8d;};}function respondWithResult(_0x1b0389,_0x4381d1){_0x4381d1=_0x4381d1||0xc8;return function(_0x36357b){if(_0x36357b){return _0x1b0389[_0x6e70('0x8')](_0x4381d1)[_0x6e70('0x9')](_0x36357b);}return null;};}function handleError(_0x188ed3,_0x3c4843){_0x3c4843=_0x3c4843||0x1f4;return function(_0x449b48){logger[_0x6e70('0xa')](_0x449b48[_0x6e70('0xb')]);if(_0x449b48[_0x6e70('0xc')]){delete _0x449b48[_0x6e70('0xc')];}_0x188ed3[_0x6e70('0x8')](_0x3c4843)[_0x6e70('0xd')](_0x449b48);};}function execChildProcess(){return new BPromise(function(_0x37b3e0,_0x4600f9){exec('npm\x20install',function(_0x47f6b2,_0x3594c1,_0x15a1a5){logger[_0x6e70('0xe')](_0x3594c1);logger[_0x6e70('0xe')](_0x15a1a5);if(_0x47f6b2){logger[_0x6e70('0xa')](_0x47f6b2);return _0x4600f9(_0x47f6b2);}return _0x37b3e0(_0x3594c1);});});}exports[_0x6e70('0xf')]=function(_0xa1eb74,_0x181005){return pm2['list']()['then'](function(_0x48bc72){if(_0x48bc72){var _0x257e81=_['reject'](_0x48bc72,function(_0x53aed0){return _0x53aed0[_0x6e70('0xc')]===_0x6e70('0x10')||_0x53aed0['name']===_0x6e70('0x11');});return{'rows':_0x257e81,'count':_0x257e81['length']};}return null;})[_0x6e70('0x12')](respondWithResult(_0x181005,null))[_0x6e70('0x13')](handleError(_0x181005,null));};exports['show']=function(_0x49029f,_0x3bd572){return pm2['describe'](_0x49029f[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](respondWithResult(_0x3bd572,null))['then'](handleEntityNotFound(_0x3bd572,null))['catch'](handleError(_0x3bd572,null));};exports[_0x6e70('0x15')]=function(_0x208e21,_0x2368eb){if(_0x208e21[_0x6e70('0x16')][_0x6e70('0xc')]&&_0x208e21[_0x6e70('0x16')][_0x6e70('0x17')]){var _0x44a49f=path[_0x6e70('0x18')](__dirname,_0x6e70('0x19'),_0x208e21['body'][_0x6e70('0x17')]);var _0x344b65=process[_0x6e70('0x1a')]();process['chdir'](path[_0x6e70('0x1b')](_0x44a49f));return execChildProcess()[_0x6e70('0x12')](function(_0x3337a6){process['chdir'](_0x344b65);return pm2[_0x6e70('0x1c')]({'name':_0x208e21['body']['name'],'script':_0x44a49f});})['then'](function(_0x41e352){pm2[_0x6e70('0x1d')]();return _0x41e352[0x0];})['then'](respondWithResult(_0x2368eb,0xc9))[_0x6e70('0x13')](handleError(_0x2368eb,null));}else{return _0x2368eb[_0x6e70('0x8')](0x1f4)['send']({'message':_0x6e70('0x1e')});}};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){if(_0x2bb231['body']['id']){delete _0x2bb231[_0x6e70('0x16')]['id'];}var _0x3af17f={'online':_0x6e70('0x20'),'stopped':_0x6e70('0x21')};if(_0x3af17f[_0x6e70('0x22')](_0x2bb231['body'][_0x6e70('0x8')])){return pm2[_0x3af17f[_0x2bb231[_0x6e70('0x16')][_0x6e70('0x8')]]](_0x2bb231[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](respondWithResult(_0x4a67ac,0xc8))[_0x6e70('0x13')](handleError(_0x4a67ac,null));}else{return _0x4a67ac[_0x6e70('0x8')](0x1f4)[_0x6e70('0xd')]({'message':_0x6e70('0x23')});}};exports[_0x6e70('0x24')]=function(_0x4b1229,_0x1b27d8){if(_0x4b1229['body']['id']){delete _0x4b1229[_0x6e70('0x16')]['id'];}if(_0x4b1229['params']['id']){return pm2[_0x6e70('0x25')](_0x4b1229[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](function(_0x56f6f7){pm2[_0x6e70('0x1d')]();return _0x56f6f7[0x0];})[_0x6e70('0x12')](respondWithResult(_0x1b27d8,null))['catch'](handleError(_0x1b27d8,null));}else{return _0x1b27d8[_0x6e70('0x8')](0x1f4)[_0x6e70('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xb58b=['Unknown\x20status','destroy','params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','status','json','error','stack','name','npm\x20install','info','list','then','reject','motion2','length','describe','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x356cc4,_0x1095d6){var _0x2b64f8=function(_0xa34324){while(--_0xa34324){_0x356cc4['push'](_0x356cc4['shift']());}};_0x2b64f8(++_0x1095d6);}(_0xb58b,0x1f1));var _0xbb58=function(_0x24a68f,_0x9f1353){_0x24a68f=_0x24a68f-0x0;var _0x17ad9b=_0xb58b[_0x24a68f];return _0x17ad9b;};'use strict';var _=require('lodash');var pm2=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var path=require('path');var exec=require(_0xbb58('0x3'))[_0xbb58('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x226363,_0x546510){return function(_0x2edb10){if(!_0x2edb10){_0x226363[_0xbb58('0x5')](0x194);;}return _0x2edb10;};}function respondWithResult(_0x33fe85,_0x5cf8b1){_0x5cf8b1=_0x5cf8b1||0xc8;return function(_0x27cbda){if(_0x27cbda){return _0x33fe85[_0xbb58('0x6')](_0x5cf8b1)[_0xbb58('0x7')](_0x27cbda);}return null;};}function handleError(_0x5d7fe8,_0xd94f1){_0xd94f1=_0xd94f1||0x1f4;return function(_0x3e3144){logger[_0xbb58('0x8')](_0x3e3144[_0xbb58('0x9')]);if(_0x3e3144[_0xbb58('0xa')]){delete _0x3e3144[_0xbb58('0xa')];}_0x5d7fe8[_0xbb58('0x6')](_0xd94f1)['send'](_0x3e3144);};}function execChildProcess(){return new BPromise(function(_0x80ab3a,_0x5c3bf7){exec(_0xbb58('0xb'),function(_0x440392,_0x26d8e6,_0x19d185){logger['info'](_0x26d8e6);logger[_0xbb58('0xc')](_0x19d185);if(_0x440392){logger[_0xbb58('0x8')](_0x440392);return _0x5c3bf7(_0x440392);}return _0x80ab3a(_0x26d8e6);});});}exports['index']=function(_0x132511,_0xdc68b9){return pm2[_0xbb58('0xd')]()[_0xbb58('0xe')](function(_0x19ceda){if(_0x19ceda){var _0x58245f=_[_0xbb58('0xf')](_0x19ceda,function(_0x23fd15){return _0x23fd15['name']==='express'||_0x23fd15[_0xbb58('0xa')]===_0xbb58('0x10');});return{'rows':_0x58245f,'count':_0x58245f[_0xbb58('0x11')]};}return null;})['then'](respondWithResult(_0xdc68b9,null))['catch'](handleError(_0xdc68b9,null));};exports['show']=function(_0x55156e,_0x28637b){return pm2[_0xbb58('0x12')](_0x55156e['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x28637b,null))['then'](handleEntityNotFound(_0x28637b,null))[_0xbb58('0x13')](handleError(_0x28637b,null));};exports[_0xbb58('0x14')]=function(_0x3c33d9,_0xb8f982){if(_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')]&&_0x3c33d9[_0xbb58('0x15')]['script']){var _0x84f34=path[_0xbb58('0x16')](__dirname,_0xbb58('0x17'),_0x3c33d9[_0xbb58('0x15')][_0xbb58('0x18')]);var _0x5d4a91=process[_0xbb58('0x19')]();process[_0xbb58('0x1a')](path[_0xbb58('0x1b')](_0x84f34));return execChildProcess()['then'](function(_0x27806d){process['chdir'](_0x5d4a91);return pm2[_0xbb58('0x1c')]({'name':_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')],'script':_0x84f34});})[_0xbb58('0xe')](function(_0x2d111c){pm2[_0xbb58('0x1d')]();return _0x2d111c[0x0];})[_0xbb58('0xe')](respondWithResult(_0xb8f982,0xc9))[_0xbb58('0x13')](handleError(_0xb8f982,null));}else{return _0xb8f982['status'](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x1f')});}};exports[_0xbb58('0x20')]=function(_0x129094,_0x8e9ed9){if(_0x129094[_0xbb58('0x15')]['id']){delete _0x129094[_0xbb58('0x15')]['id'];}var _0x2ce7c3={'online':_0xbb58('0x21'),'stopped':_0xbb58('0x22')};if(_0x2ce7c3[_0xbb58('0x23')](_0x129094[_0xbb58('0x15')][_0xbb58('0x6')])){return pm2[_0x2ce7c3[_0x129094[_0xbb58('0x15')][_0xbb58('0x6')]]](_0x129094['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x8e9ed9,0xc8))[_0xbb58('0x13')](handleError(_0x8e9ed9,null));}else{return _0x8e9ed9[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x24')});}};exports[_0xbb58('0x25')]=function(_0x1ba526,_0x643e0e){if(_0x1ba526[_0xbb58('0x15')]['id']){delete _0x1ba526['body']['id'];}if(_0x1ba526[_0xbb58('0x26')]['id']){return pm2[_0xbb58('0x27')](_0x1ba526[_0xbb58('0x26')]['id'])[_0xbb58('0xe')](function(_0xdbbe7b){pm2[_0xbb58('0x1d')]();return _0xdbbe7b[0x0];})[_0xbb58('0xe')](respondWithResult(_0x643e0e,null))[_0xbb58('0x13')](handleError(_0x643e0e,null));}else{return _0x643e0e[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 8faf6bc..32257bd 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 _0xf8a6=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x294f88,_0x420d2e){var _0x3c2908=function(_0x56f077){while(--_0x56f077){_0x294f88['push'](_0x294f88['shift']());}};_0x3c2908(++_0x420d2e);}(_0xf8a6,0x14c));var _0x6f8a=function(_0x271002,_0x66459){_0x271002=_0x271002-0x0;var _0x3f63f7=_0xf8a6[_0x271002];return _0x3f63f7;};'use strict';var express=require(_0x6f8a('0x0'));var router=express[_0x6f8a('0x1')]();var auth=require(_0x6f8a('0x2'));var controller=require(_0x6f8a('0x3'));router[_0x6f8a('0x4')](_0x6f8a('0x5'),auth[_0x6f8a('0x6')](),controller[_0x6f8a('0x7')]);router[_0x6f8a('0x4')]('/queues',auth[_0x6f8a('0x6')](),controller[_0x6f8a('0x8')]);module[_0x6f8a('0x9')]=router; \ No newline at end of file +var _0x5e93=['../../components/auth/service','isAuthenticated','getAgents','/queues','getQueues','exports','Router'];(function(_0x3c5b0b,_0x7e8c6b){var _0x2a56bc=function(_0x5e906a){while(--_0x5e906a){_0x3c5b0b['push'](_0x3c5b0b['shift']());}};_0x2a56bc(++_0x7e8c6b);}(_0x5e93,0x109));var _0x35e9=function(_0x5c7c01,_0x4a542d){_0x5c7c01=_0x5c7c01-0x0;var _0x305135=_0x5e93[_0x5c7c01];return _0x305135;};'use strict';var express=require('express');var router=express[_0x35e9('0x0')]();var auth=require(_0x35e9('0x1'));var controller=require('./realtime.controller');router['get']('/agents',auth[_0x35e9('0x2')](),controller[_0x35e9('0x3')]);router['get'](_0x35e9('0x4'),auth['isAuthenticated'](),controller[_0x35e9('0x5')]);module[_0x35e9('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 16c445c..a1c1d5f 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 _0xf248=['merge','user','userProfileId','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','getAgentStatus','globalStatus','Status','all','util','lodash','../../components/realtime/agents','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','stack','name','send','startCase','Queues','then','error','format','result','catch','request','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','outbound','push','pTalking','message','dialActive','dialMethod','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','voice','busy','originated','find','pick','queue','length','some','internal','toString','getMembers','UserId','online','loggedInDb','paused','User','Queue','QueueId','getChannels','includes','toLowerCase','Invalid\x20channel','query','globalQueueFilter','pauseTypeFilter','pause','resolve','channel','sort','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','forEach','*pause','Pause','where'];(function(_0x1160ba,_0x1636d4){var _0xaa9749=function(_0x16674d){while(--_0x16674d){_0x1160ba['push'](_0x1160ba['shift']());}};_0xaa9749(++_0x1636d4);}(_0xf248,0x16f));var _0x8f24=function(_0x7b38e8,_0x711fad){_0x7b38e8=_0x7b38e8-0x0;var _0x1fbc8f=_0xf248[_0x7b38e8];return _0x1fbc8f;};'use strict';var util=require(_0x8f24('0x0'));var _=require(_0x8f24('0x1'));var jayson=require('jayson/promise');var rta=require(_0x8f24('0x2'));var qs=require(_0x8f24('0x3'));var utils=require('../../config/utils');var logger=require(_0x8f24('0x4'))(_0x8f24('0x5'));var db=require(_0x8f24('0x6'))['db'];var amiClient=jayson[_0x8f24('0x7')]['http']({'port':0x232a});var routingClient=jayson[_0x8f24('0x7')][_0x8f24('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x306402,_0x4439fa){return function(_0x3bd1bf){if(_0x3bd1bf){var _0xf74c0b=typeof _0x4439fa[_0x8f24('0x9')]===_0x8f24('0xa')&&typeof _0x4439fa[_0x8f24('0xb')]==='undefined';var _0x47705f=_0x3bd1bf[_0x8f24('0xc')];var _0x209209=_0xf74c0b?0x0:_0x4439fa[_0x8f24('0x9')];var _0x4ac2f4=_0xf74c0b?_0x3bd1bf[_0x8f24('0xc')]:_0x4439fa[_0x8f24('0x9')]+_0x4439fa['limit'];var _0x4c8a1a;if(_0x4ac2f4>=_0x47705f){_0x4ac2f4=_0x47705f;_0x4c8a1a=0xc8;}else{_0x4c8a1a=0xce;}_0x306402[_0x8f24('0xd')](_0x4c8a1a);return _0x306402[_0x8f24('0xe')](_0x8f24('0xf'),_0x209209+'-'+_0x4ac2f4+'/'+_0x47705f)[_0x8f24('0x10')](_0x3bd1bf);}return null;};}function handleError(_0x5172f9,_0x53a891){_0x53a891=_0x53a891||0x1f4;return function(_0x391933){logger['error'](_0x391933[_0x8f24('0x11')]);if(_0x391933[_0x8f24('0x12')]){delete _0x391933[_0x8f24('0x12')];}_0x5172f9['status'](_0x53a891)[_0x8f24('0x13')](_0x391933);};}function getRealtimeQueues(_0x595cc7,_0x3622e9){return new Promise(function(_0x5627d8,_0x3e3607){var _0x5bdc14=_0x3622e9==='voice'?amiClient:routingClient;return _0x5bdc14['request'](_[_0x8f24('0x14')](_0x3622e9)+_0x8f24('0x15'),_0x595cc7)[_0x8f24('0x16')](function(_0x17c93d){if(_0x17c93d[_0x8f24('0x17')])throw new Error(util[_0x8f24('0x18')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x3622e9));return _0x5627d8(_0x17c93d[_0x8f24('0x19')]);})[_0x8f24('0x1a')](function(_0x2c5482){_0x3e3607(_0x2c5482);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x491a6a,_0x3714a2){return amiClient[_0x8f24('0x1b')](_0x8f24('0x1c'),{})[_0x8f24('0x16')](function(_0x4d13ce){if(_0x4d13ce[_0x8f24('0x17')])throw new Error(_0x8f24('0x1d'));return _0x491a6a(_0x4d13ce[_0x8f24('0x19')]);})[_0x8f24('0x1a')](function(_0x3fe713){_0x3714a2(_0x3fe713);});});}function initializeQueues(_0x574523,_0x5c4328,_0x2fa0cd,_0x2fa992){var _0x390304=[_0x8f24('0x1e'),_0x8f24('0x1f'),_0x8f24('0x20'),_0x8f24('0x21'),'paused'];if(_0x2fa0cd==='voice'&&_0x2fa992===_0x8f24('0x22')){_0x390304[_0x8f24('0x23')](_0x8f24('0x24'),'originated',_0x8f24('0x25'),_0x8f24('0x26'),_0x8f24('0x27'),_0x8f24('0x28'),'startPredictive',_0x8f24('0x29'),'erlangCalls',_0x8f24('0x2a'),_0x8f24('0x2b'),_0x8f24('0x2c'),_0x8f24('0x2d'),'dialPredictiveIntervalMaxThreshold',_0x8f24('0x2e'),_0x8f24('0x2f'),'predictiveIntervalTotalCalls',_0x8f24('0x30'),'predictiveIntervalDroppedCallsTimeout',_0x8f24('0x31'),_0x8f24('0x32'),_0x8f24('0x33'));}return _0x574523[_0x8f24('0x34')](function(_0x2418ab){var _0xaebd74=_0x2418ab[_0x8f24('0x35')]({'plain':!![]});_0xaebd74[_0x8f24('0x36')]=[];_0xaebd74['paused']=0x0;_0xaebd74['loggedInDb']=0x0;_0xaebd74[_0x8f24('0x1e')]=0x0;_0xaebd74[_0x8f24('0x1f')]=0x0;_0xaebd74['waiting']=0x0;if(_0x2fa0cd===_0x8f24('0x37')){_0xaebd74[_0x8f24('0x21')]=0x0;_0xaebd74[_0x8f24('0x38')]=0x0;if(_0x2fa992===_0x8f24('0x22')){_0xaebd74[_0x8f24('0x24')]=0x0;_0xaebd74[_0x8f24('0x39')]=0x0;}}var _0x28bbbf=_[_0x8f24('0x3a')](_0x5c4328,['id',_0xaebd74['id']]);if(_0x28bbbf)_['merge'](_0xaebd74,_[_0x8f24('0x3b')](_0x28bbbf,_0x390304));return _0xaebd74;});}function updateAgentVoiceStatus(_0xa90613,_0x3bb986,_0x31c31f){var _0x46567e=_['filter'](_0x31c31f,[_0x8f24('0x3c'),_0x3bb986[_0x8f24('0x12')]]);if(_0x46567e[_0x8f24('0x3d')]===0x0)return _0xa90613[_0x8f24('0x38')]=!![];if(_[_0x8f24('0x3e')](_0x46567e,['connectedlinenum',_0xa90613[_0x8f24('0x3f')][_0x8f24('0x40')]()]))return _0xa90613[_0x8f24('0x21')]=!![];if(!_0xa90613[_0x8f24('0x21')])return _0xa90613[_0x8f24('0x38')]=!![];}function getVoiceQueueAgents(_0x3ed86f,_0x57b126,_0x375117,_0x5478be){var _0x2fdbdd=_[_0x8f24('0x3a')](_0x57b126,['id',_0x3ed86f['id']]);if(!_0x2fdbdd)return _0x3ed86f;return _0x2fdbdd[_0x8f24('0x41')]({'raw':!![]})[_0x8f24('0x16')](function(_0x30495e){for(var _0x329e20=0x0;_0x329e20<_0x30495e[_0x8f24('0x3d')];_0x329e20++){var _0x95aacc=_['find'](_0x375117,['id',_0x30495e[_0x329e20][_0x8f24('0x42')]]);if(!_0x95aacc){_0x95aacc={'id':_0x30495e[_0x329e20][_0x8f24('0x42')],'name':_0x30495e[_0x329e20][_0x8f24('0x42')],'accountcode':'','online':![]};}var _0x6b00a8={'id':_0x95aacc['id'],'name':_0x95aacc[_0x8f24('0x12')],'internal':_0x95aacc['accountcode'],'online':Boolean(_0x95aacc[_0x8f24('0x43')]),'paused':Boolean(_0x30495e[_0x329e20]['paused'])};if(_0x95aacc['voiceStatus']===_0x8f24('0x21'))updateAgentVoiceStatus(_0x6b00a8,_0x3ed86f,_0x5478be);if(_0x6b00a8['online'])_0x3ed86f[_0x8f24('0x44')]++;if(_0x6b00a8[_0x8f24('0x38')])_0x3ed86f[_0x8f24('0x38')]++;if(_0x6b00a8[_0x8f24('0x45')]&&!_0x6b00a8[_0x8f24('0x38')]&&!_0x6b00a8[_0x8f24('0x21')])_0x3ed86f['paused']++;_0x3ed86f[_0x8f24('0x36')]['push'](_0x6b00a8);}return _0x3ed86f;});}function getQueueAgents(_0x53b058,_0x62182b,_0x10352a){var _0x53b062=_0x8f24('0x46')+_[_0x8f24('0x14')](_0x10352a)+_0x8f24('0x47');var _0xb9fe61=_0x10352a+'Pause';return db[_0x53b062]['findAll']({'where':{[_[_0x8f24('0x14')](_0x10352a)+_0x8f24('0x48')]:_0x53b058['id']},'raw':!![]})['then'](function(_0x15745b){for(var _0x285777=0x0;_0x285777<_0x15745b[_0x8f24('0x3d')];_0x285777++){var _0x3da47c=_[_0x8f24('0x3a')](_0x62182b,['id',_0x15745b[_0x285777][_0x8f24('0x42')]]);if(!_0x3da47c){_0x3da47c={'id':_0x15745b[_0x285777]['UserId'],'name':_0x15745b[_0x285777][_0x8f24('0x42')],'online':![],['pauseField']:![]};}var _0x7c834a={'id':_0x3da47c['id'],'name':_0x3da47c[_0x8f24('0x12')],'online':Boolean(_0x3da47c['online']),'paused':Boolean(_0x3da47c[_0xb9fe61])};if(_0x7c834a[_0x8f24('0x43')])_0x53b058['loggedInDb']++;_0x53b058[_0x8f24('0x36')][_0x8f24('0x23')](_0x7c834a);}return _0x53b058;});}function validateChannel(_0x4af017){var _0x188d56=utils[_0x8f24('0x49')]();if(!_[_0x8f24('0x4a')](_0x188d56,_0x4af017[_0x8f24('0x4b')]()))throw new Error(_0x8f24('0x4c'));return _0x4af017[_0x8f24('0x4b')]();}exports['getAgents']=function(_0x1582a3,_0x5c52a1){var _0xc1d69e={'count':0x0,'rows':[]};var _0x503e09={};var _0x24196f;var _0x16f926;var _0xe302e;var _0x2c036f;var _0x4e18bd=utils[_0x8f24('0x49')]();var _0x17a4ce=_0x1582a3[_0x8f24('0x4d')][_0x8f24('0x4e')];var _0x45ee44=_0x1582a3[_0x8f24('0x4d')]['globalStatusFilter'];var _0x3983f4=_0x1582a3['query'][_0x8f24('0x4f')];var _0x48ca58=_0x45ee44===_0x8f24('0x50')||_0x45ee44==='*pause'?!![]:![];var _0x5dd886=[];var _0x2c178f;Promise[_0x8f24('0x51')]()[_0x8f24('0x16')](function(){if(_0x1582a3['query']['channel']){_0x24196f=validateChannel(_0x1582a3[_0x8f24('0x4d')][_0x8f24('0x52')]);}if(!_0x1582a3[_0x8f24('0x4d')]['sort']||!_0x1582a3[_0x8f24('0x4d')][_0x8f24('0x53')][_0x8f24('0x4a')]('globalStatus')){_0x1582a3[_0x8f24('0x4d')]['sort']=rta[_0x8f24('0x54')](_0x1582a3[_0x8f24('0x4d')][_0x8f24('0x53')]);return;}var _0x2ce060=rta[_0x8f24('0x55')](_0x1582a3[_0x8f24('0x4d')][_0x8f24('0x53')]);_0x1582a3[_0x8f24('0x4d')]['sort']=_0x2ce060['fields'][_0x8f24('0x56')](',');_0x16f926=_0x2ce060[_0x8f24('0x57')];})[_0x8f24('0x16')](function(){if(!_0x17a4ce){return[];}return rta[_0x8f24('0x58')](_0x17a4ce,_0x24196f);})[_0x8f24('0x16')](function(_0xbb6b0){_0x5dd886=_0xbb6b0;return rta[_0x8f24('0x59')]();})[_0x8f24('0x16')](function(_0x529ec5){_0x2c036f=_0x529ec5[_0x8f24('0x5a')];if((!_0x45ee44||_0x48ca58)&&!_0x16f926){return _0x5dd886;}if(_0x16f926&&!_0x45ee44){return rta['getSortedAgentsIdsByStatus'](_0x2c036f,_0x5dd886,_0x16f926);}else{return rta[_0x8f24('0x5b')](_0x2c036f,_0x5dd886,_0x45ee44);}})[_0x8f24('0x16')](function(_0x401a5d){_0x5dd886=_0x401a5d;var _0x25c800=![];if(_0x5dd886['length']===0x0){if(_0x17a4ce||_0x45ee44){_0x25c800=!![];}if(_0x48ca58){_0x25c800=![];}}if(_0x25c800){return _0xc1d69e;}var _0x490681=_[_0x8f24('0x34')](db[_0x8f24('0x46')]['rawAttributes'],function(_0x3f90ad){return{'name':_0x3f90ad[_0x8f24('0x5c')],'type':_0x3f90ad[_0x8f24('0x5d')][_0x8f24('0x5e')]};});_0x1582a3['query'][_0x8f24('0x5f')]=_0x8f24('0x60');_0x1582a3['query'][_0x8f24('0x43')]=!![];_0x503e09=qs[_0x8f24('0x61')](_0x490681,_0x1582a3);_0x503e09[_0x8f24('0x62')]=!![];var _0x3d283b=[];if(_0x5dd886[_0x8f24('0x3d')]>0x0){_0x3d283b['push']({'id':{'$in':_0x5dd886}});if(_0x16f926&&!_0x45ee44){_0x2c178f=[db[_0x8f24('0x63')][_0x8f24('0x64')]('FIELD(id,'+_0x5dd886+')')];_0x503e09[_0x8f24('0x57')]=_0x2c178f;}}if(_0x48ca58){_0x4e18bd[_0x8f24('0x65')](function(_0x558960){var _0x39d6ff=!![];if(_0x45ee44===_0x8f24('0x66')&&_0x24196f!==_0x558960){_0x39d6ff=![];}_0x3d283b[_0x8f24('0x23')]({[_0x558960+'Pause']:_0x39d6ff});});if(_0x3983f4){_0x3d283b[_0x8f24('0x23')]({'pauseType':_0x3983f4});}}else if(_0x45ee44){_0x4e18bd[_0x8f24('0x65')](function(_0x9bb8b3){_0x3d283b['push']({[_0x9bb8b3+_0x8f24('0x67')]:![]});});}_0x503e09[_0x8f24('0x68')]=_[_0x8f24('0x69')](_0x503e09['where'],{'$and':_0x3d283b});if(_0x1582a3['user'][_0x8f24('0x5f')]===_0x8f24('0x6a')){var _0x400f97={'params':{'id':_0x1582a3['user'][_0x8f24('0x6b')]},'query':{'section':'Agents','role':_0x8f24('0x60'),'online':!![],'raw':!![],'ids':_0x5dd886,'customSorting':_0x2c178f}};if(_0x48ca58){_0x400f97['query'][_0x8f24('0x6c')]=_0x3d283b;}_0x400f97['query']=Object[_0x8f24('0x6d')](_0x400f97[_0x8f24('0x4d')],_0x1582a3['query']);delete _0x400f97[_0x8f24('0x4d')]['id'];return db[_0x8f24('0x6e')][_0x8f24('0x6f')](_0x400f97);}return db['User'][_0x8f24('0x70')](_0x503e09);})['then'](function(_0x593648){_0xc1d69e[_0x8f24('0xc')]=_0x593648[_0x8f24('0xc')];_0xe302e=_0x593648['rows'];return _0xe302e['map'](function(_0x498cde){var _0x27ab81=_[_0x8f24('0x3a')](_0x2c036f,['id',_0x498cde['id']]);if(_0x27ab81){var _0x2cc6b6=rta[_0x8f24('0x71')](_0x27ab81);_[_0x8f24('0x69')](_0x498cde,_0x2cc6b6);}_0x498cde['globalStatus']=rta[_0x8f24('0x72')](_0x498cde);if(_0x498cde[_0x8f24('0x73')][_0x8f24('0x4a')]('pause')){_0x4e18bd[_0x8f24('0x65')](function(_0x1da66a){if(_0x498cde[_0x1da66a+_0x8f24('0x67')]){_0x498cde[_0x1da66a+_0x8f24('0x74')]=_0x8f24('0x50');}});}return _0x498cde;});})[_0x8f24('0x16')](function(_0x3bacb8){if(!_0x16f926||_0x2c178f){return _0x3bacb8;}return rta['sortAgentsByStatus'](_0x3bacb8,_0x16f926);})[_0x8f24('0x16')](function(_0x13e6e4){_0xc1d69e[_0x8f24('0x5a')]=_0x13e6e4;return _0xc1d69e;})['then'](respondWithFilteredResult(_0x5c52a1,_0x503e09))[_0x8f24('0x1a')](handleError(_0x5c52a1,null));};exports['getQueues']=function(_0x54c1ae,_0x5deab1){var _0x7b44b7={'count':0x0,'rows':[]},_0x26632b={},_0x1c66b7,_0xbbf9c5,_0x421de3,_0x32cda2,_0x4524e0;Promise[_0x8f24('0x51')]()['then'](function(){if(_0x54c1ae[_0x8f24('0x4d')][_0x8f24('0x52')])_0x1c66b7=validateChannel(_0x54c1ae[_0x8f24('0x4d')][_0x8f24('0x52')]);var _0x57f742=_[_0x8f24('0x14')](_0x1c66b7)+_0x8f24('0x47');var _0x23760f=_[_0x8f24('0x34')](db[_0x57f742]['rawAttributes'],function(_0x15ec88){return{'name':_0x15ec88[_0x8f24('0x5c')],'type':_0x15ec88[_0x8f24('0x5d')][_0x8f24('0x5e')]};});_0x26632b=qs['getOptions'](_0x23760f,_0x54c1ae);if(_0x54c1ae[_0x8f24('0x6a')][_0x8f24('0x5f')]===_0x8f24('0x6a')){var _0x26e895={'params':{'id':_0x54c1ae[_0x8f24('0x6a')][_0x8f24('0x6b')]},'query':{'section':_0x1c66b7===_0x8f24('0x37')&&_0x54c1ae[_0x8f24('0x4d')][_0x8f24('0x5d')]===_0x8f24('0x22')?'QueueCampaigns':_[_0x8f24('0x14')](_0x1c66b7)+_0x8f24('0x15'),'type':_0x54c1ae[_0x8f24('0x4d')][_0x8f24('0x5d')],'nolimit':!![],'sort':_0x8f24('0x12'),'filter':_0x54c1ae[_0x8f24('0x4d')]['filter']}};return db[_0x8f24('0x6e')][_0x8f24('0x6f')](_0x26e895);}return db[_0x57f742]['findAndCountAll'](_0x26632b);})[_0x8f24('0x16')](function(_0x87bda2){_0x7b44b7[_0x8f24('0xc')]=_0x87bda2[_0x8f24('0xc')];_0xbbf9c5=_0x87bda2[_0x8f24('0x5a')];return getRealtimeQueues(_0x54c1ae,_0x1c66b7);})[_0x8f24('0x16')](function(_0xedc35c){_0x32cda2=_0xedc35c[_0x8f24('0x5a')];return rta[_0x8f24('0x59')]();})[_0x8f24('0x16')](function(_0x2d3cff){_0x421de3=_0x2d3cff[_0x8f24('0x5a')];if(_0x1c66b7!=_0x8f24('0x37'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x18255f){_0x4524e0=_0x18255f?_0x18255f[_0x8f24('0x5a')]:[];return initializeQueues(_0xbbf9c5,_0x32cda2,_0x1c66b7,_0x54c1ae[_0x8f24('0x4d')]['type']);})[_0x8f24('0x16')](function(_0x35fe79){var _0x4b4ffb=_0x35fe79[_0x8f24('0x34')](function(_0x17107f){if(_0x1c66b7===_0x8f24('0x37'))return getVoiceQueueAgents(_0x17107f,_0xbbf9c5,_0x421de3,_0x4524e0);else return getQueueAgents(_0x17107f,_0x421de3,_0x1c66b7);});return Promise[_0x8f24('0x75')](_0x4b4ffb);})[_0x8f24('0x16')](function(_0xd3f60b){_0x7b44b7[_0x8f24('0x5a')]=_0xd3f60b;return _0x7b44b7;})['then'](respondWithFilteredResult(_0x5deab1,_0x26632b))[_0x8f24('0x1a')](handleError(_0x5deab1,null));}; \ No newline at end of file +var _0x39f9=['sortAgentsByStatus','key','getRealtimeAgents','util','lodash','jayson/promise','../../components/realtime/agents','../../config/utils','../../mysqldb','client','http','offset','undefined','limit','count','status','Content-Range','error','stack','name','send','Queues','then','format','result','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','voice','busy','find','pick','queue','length','some','connectedlinenum','internal','UserId','online','voiceStatus','push','Queue','Pause','startCase','getChannels','toLowerCase','Invalid\x20channel','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','includes','globalStatus','sort','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','type','role','agent','getOptions','literal','FIELD(id,','forEach','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','filterAgentAttributes','pause','Status'];(function(_0x546261,_0x44b70f){var _0x1c6263=function(_0x45a5de){while(--_0x45a5de){_0x546261['push'](_0x546261['shift']());}};_0x1c6263(++_0x44b70f);}(_0x39f9,0x76));var _0x939f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39f9[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x939f('0x0'));var _=require(_0x939f('0x1'));var jayson=require(_0x939f('0x2'));var rta=require(_0x939f('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0x939f('0x4'));var logger=require('../../config/logger')('api');var db=require(_0x939f('0x5'))['db'];var amiClient=jayson[_0x939f('0x6')][_0x939f('0x7')]({'port':0x232a});var routingClient=jayson[_0x939f('0x6')][_0x939f('0x7')]({'port':0x232c});function respondWithFilteredResult(_0xde0ff1,_0x22db91){return function(_0x238519){if(_0x238519){var _0x1ad53d=typeof _0x22db91[_0x939f('0x8')]===_0x939f('0x9')&&typeof _0x22db91[_0x939f('0xa')]===_0x939f('0x9');var _0x198ecb=_0x238519[_0x939f('0xb')];var _0x5227b4=_0x1ad53d?0x0:_0x22db91[_0x939f('0x8')];var _0x3ef42e=_0x1ad53d?_0x238519['count']:_0x22db91['offset']+_0x22db91[_0x939f('0xa')];var _0x243c49;if(_0x3ef42e>=_0x198ecb){_0x3ef42e=_0x198ecb;_0x243c49=0xc8;}else{_0x243c49=0xce;}_0xde0ff1[_0x939f('0xc')](_0x243c49);return _0xde0ff1['set'](_0x939f('0xd'),_0x5227b4+'-'+_0x3ef42e+'/'+_0x198ecb)['json'](_0x238519);}return null;};}function handleError(_0x8a7bd1,_0x15c986){_0x15c986=_0x15c986||0x1f4;return function(_0x1c77e7){logger[_0x939f('0xe')](_0x1c77e7[_0x939f('0xf')]);if(_0x1c77e7[_0x939f('0x10')]){delete _0x1c77e7[_0x939f('0x10')];}_0x8a7bd1[_0x939f('0xc')](_0x15c986)[_0x939f('0x11')](_0x1c77e7);};}function getRealtimeQueues(_0x45190a,_0x5732d9){return new Promise(function(_0x254792,_0x304edf){var _0x2e5533=_0x5732d9==='voice'?amiClient:routingClient;return _0x2e5533['request'](_['startCase'](_0x5732d9)+_0x939f('0x12'),_0x45190a)[_0x939f('0x13')](function(_0x30f928){if(_0x30f928[_0x939f('0xe')])throw new Error(util[_0x939f('0x14')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x5732d9));return _0x254792(_0x30f928[_0x939f('0x15')]);})[_0x939f('0x16')](function(_0x2ba708){_0x304edf(_0x2ba708);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x9dae6a,_0x236d67){return amiClient['request'](_0x939f('0x17'),{})[_0x939f('0x13')](function(_0x1739d5){if(_0x1739d5[_0x939f('0xe')])throw new Error(_0x939f('0x18'));return _0x9dae6a(_0x1739d5[_0x939f('0x15')]);})[_0x939f('0x16')](function(_0x2e9f32){_0x236d67(_0x2e9f32);});});}function initializeQueues(_0x26eaef,_0x84c092,_0x51f265,_0x6f8bd5){var _0x18b096=[_0x939f('0x19'),_0x939f('0x1a'),_0x939f('0x1b'),_0x939f('0x1c'),_0x939f('0x1d')];if(_0x51f265==='voice'&&_0x6f8bd5===_0x939f('0x1e')){_0x18b096['push']('pTalking','originated',_0x939f('0x1f'),_0x939f('0x20'),_0x939f('0x21'),_0x939f('0x22'),_0x939f('0x23'),_0x939f('0x24'),_0x939f('0x25'),'erlangCallToSecond',_0x939f('0x26'),_0x939f('0x27'),'dialPredictiveInterval',_0x939f('0x28'),_0x939f('0x29'),_0x939f('0x2a'),_0x939f('0x2b'),_0x939f('0x2c'),_0x939f('0x2d'),_0x939f('0x2e'),_0x939f('0x2f'),'predictiveIntervalAvgTalktime');}return _0x26eaef[_0x939f('0x30')](function(_0x4fa23f){var _0x19705d=_0x4fa23f[_0x939f('0x31')]({'plain':!![]});_0x19705d[_0x939f('0x32')]=[];_0x19705d[_0x939f('0x1d')]=0x0;_0x19705d[_0x939f('0x33')]=0x0;_0x19705d[_0x939f('0x19')]=0x0;_0x19705d[_0x939f('0x1a')]=0x0;_0x19705d[_0x939f('0x1b')]=0x0;if(_0x51f265===_0x939f('0x34')){_0x19705d[_0x939f('0x1c')]=0x0;_0x19705d[_0x939f('0x35')]=0x0;if(_0x6f8bd5==='outbound'){_0x19705d['pTalking']=0x0;_0x19705d['originated']=0x0;}}var _0x41cfb6=_[_0x939f('0x36')](_0x84c092,['id',_0x19705d['id']]);if(_0x41cfb6)_['merge'](_0x19705d,_[_0x939f('0x37')](_0x41cfb6,_0x18b096));return _0x19705d;});}function updateAgentVoiceStatus(_0x42b288,_0x267eb2,_0x322ff8){var _0x204f07=_['filter'](_0x322ff8,[_0x939f('0x38'),_0x267eb2[_0x939f('0x10')]]);if(_0x204f07[_0x939f('0x39')]===0x0)return _0x42b288['busy']=!![];if(_[_0x939f('0x3a')](_0x204f07,[_0x939f('0x3b'),_0x42b288[_0x939f('0x3c')]['toString']()]))return _0x42b288[_0x939f('0x1c')]=!![];if(!_0x42b288[_0x939f('0x1c')])return _0x42b288[_0x939f('0x35')]=!![];}function getVoiceQueueAgents(_0x1a9e81,_0x54365e,_0xb0e6a9,_0x5b23c6){var _0x2b0256=_[_0x939f('0x36')](_0x54365e,['id',_0x1a9e81['id']]);if(!_0x2b0256)return _0x1a9e81;return _0x2b0256['getMembers']({'raw':!![]})[_0x939f('0x13')](function(_0x18ed8f){for(var _0x1d1275=0x0;_0x1d1275<_0x18ed8f[_0x939f('0x39')];_0x1d1275++){var _0xccc2ad=_[_0x939f('0x36')](_0xb0e6a9,['id',_0x18ed8f[_0x1d1275][_0x939f('0x3d')]]);if(!_0xccc2ad){_0xccc2ad={'id':_0x18ed8f[_0x1d1275][_0x939f('0x3d')],'name':_0x18ed8f[_0x1d1275]['UserId'],'accountcode':'','online':![]};}var _0xdbcd7d={'id':_0xccc2ad['id'],'name':_0xccc2ad[_0x939f('0x10')],'internal':_0xccc2ad['accountcode'],'online':Boolean(_0xccc2ad[_0x939f('0x3e')]),'paused':Boolean(_0x18ed8f[_0x1d1275][_0x939f('0x1d')])};if(_0xccc2ad[_0x939f('0x3f')]==='talking')updateAgentVoiceStatus(_0xdbcd7d,_0x1a9e81,_0x5b23c6);if(_0xdbcd7d['online'])_0x1a9e81[_0x939f('0x33')]++;if(_0xdbcd7d[_0x939f('0x35')])_0x1a9e81[_0x939f('0x35')]++;if(_0xdbcd7d[_0x939f('0x1d')]&&!_0xdbcd7d[_0x939f('0x35')]&&!_0xdbcd7d[_0x939f('0x1c')])_0x1a9e81[_0x939f('0x1d')]++;_0x1a9e81[_0x939f('0x32')][_0x939f('0x40')](_0xdbcd7d);}return _0x1a9e81;});}function getQueueAgents(_0x1a8459,_0xd95b17,_0x2c8230){var _0x131b10='User'+_['startCase'](_0x2c8230)+_0x939f('0x41');var _0x30d4a5=_0x2c8230+_0x939f('0x42');return db[_0x131b10]['findAll']({'where':{[_[_0x939f('0x43')](_0x2c8230)+'QueueId']:_0x1a8459['id']},'raw':!![]})[_0x939f('0x13')](function(_0x203b3d){for(var _0x45fac3=0x0;_0x45fac3<_0x203b3d['length'];_0x45fac3++){var _0x155040=_['find'](_0xd95b17,['id',_0x203b3d[_0x45fac3][_0x939f('0x3d')]]);if(!_0x155040){_0x155040={'id':_0x203b3d[_0x45fac3][_0x939f('0x3d')],'name':_0x203b3d[_0x45fac3][_0x939f('0x3d')],'online':![],['pauseField']:![]};}var _0x437155={'id':_0x155040['id'],'name':_0x155040[_0x939f('0x10')],'online':Boolean(_0x155040['online']),'paused':Boolean(_0x155040[_0x30d4a5])};if(_0x437155[_0x939f('0x3e')])_0x1a8459[_0x939f('0x33')]++;_0x1a8459[_0x939f('0x32')][_0x939f('0x40')](_0x437155);}return _0x1a8459;});}function validateChannel(_0x347a80){var _0x12b809=utils[_0x939f('0x44')]();if(!_['includes'](_0x12b809,_0x347a80[_0x939f('0x45')]()))throw new Error(_0x939f('0x46'));return _0x347a80[_0x939f('0x45')]();}exports[_0x939f('0x47')]=function(_0x41a4b7,_0x28b758){var _0x5d8ee1={'count':0x0,'rows':[]};var _0x4db461={};var _0x5d9b18;var _0x27de43;var _0xe2300;var _0x3fad5b;var _0x59f2e0=utils[_0x939f('0x44')]();var _0x48a8c2=_0x41a4b7[_0x939f('0x48')][_0x939f('0x49')];var _0x1e3c4b=_0x41a4b7[_0x939f('0x48')][_0x939f('0x4a')];var _0xa3ef9d=_0x41a4b7[_0x939f('0x48')][_0x939f('0x4b')];var _0x580615=_0x1e3c4b==='pause'||_0x1e3c4b===_0x939f('0x4c')?!![]:![];var _0x46d964=[];var _0x51c730;Promise[_0x939f('0x4d')]()[_0x939f('0x13')](function(){if(_0x41a4b7['query']['channel']){_0x5d9b18=validateChannel(_0x41a4b7[_0x939f('0x48')][_0x939f('0x4e')]);}if(!_0x41a4b7[_0x939f('0x48')]['sort']||!_0x41a4b7['query']['sort'][_0x939f('0x4f')](_0x939f('0x50'))){_0x41a4b7['query'][_0x939f('0x51')]=rta['validateSortParameter'](_0x41a4b7[_0x939f('0x48')][_0x939f('0x51')]);return;}var _0x1ba60d=rta[_0x939f('0x52')](_0x41a4b7[_0x939f('0x48')][_0x939f('0x51')]);_0x41a4b7[_0x939f('0x48')][_0x939f('0x51')]=_0x1ba60d[_0x939f('0x53')][_0x939f('0x54')](',');_0x27de43=_0x1ba60d[_0x939f('0x55')];})[_0x939f('0x13')](function(){if(!_0x48a8c2){return[];}return rta[_0x939f('0x56')](_0x48a8c2,_0x5d9b18);})['then'](function(_0x3bd58a){_0x46d964=_0x3bd58a;return rta['getRealtimeAgents']();})['then'](function(_0x2cf0c){_0x3fad5b=_0x2cf0c[_0x939f('0x57')];if((!_0x1e3c4b||_0x580615)&&!_0x27de43){return _0x46d964;}if(_0x27de43&&!_0x1e3c4b){return rta[_0x939f('0x58')](_0x3fad5b,_0x46d964,_0x27de43);}else{return rta[_0x939f('0x59')](_0x3fad5b,_0x46d964,_0x1e3c4b);}})[_0x939f('0x13')](function(_0x511fd4){_0x46d964=_0x511fd4;var _0x32f2c2=![];if(_0x46d964[_0x939f('0x39')]===0x0){if(_0x48a8c2||_0x1e3c4b){_0x32f2c2=!![];}if(_0x580615){_0x32f2c2=![];}}if(_0x32f2c2){return _0x5d8ee1;}var _0x56cec3=_[_0x939f('0x30')](db[_0x939f('0x5a')][_0x939f('0x5b')],function(_0x37a5b1){return{'name':_0x37a5b1[_0x939f('0x5c')],'type':_0x37a5b1[_0x939f('0x5d')]['key']};});_0x41a4b7[_0x939f('0x48')][_0x939f('0x5e')]=_0x939f('0x5f');_0x41a4b7[_0x939f('0x48')][_0x939f('0x3e')]=!![];_0x4db461=qs[_0x939f('0x60')](_0x56cec3,_0x41a4b7);_0x4db461['raw']=!![];var _0x342cf6=[];if(_0x46d964[_0x939f('0x39')]>0x0){_0x342cf6[_0x939f('0x40')]({'id':{'$in':_0x46d964}});if(_0x27de43&&!_0x1e3c4b){_0x51c730=[db['sequelize'][_0x939f('0x61')](_0x939f('0x62')+_0x46d964+')')];_0x4db461[_0x939f('0x55')]=_0x51c730;}}if(_0x580615){_0x59f2e0[_0x939f('0x63')](function(_0x1442c0){var _0xf97897=!![];if(_0x1e3c4b===_0x939f('0x4c')&&_0x5d9b18!==_0x1442c0){_0xf97897=![];}_0x342cf6['push']({[_0x1442c0+'Pause']:_0xf97897});});if(_0xa3ef9d){_0x342cf6[_0x939f('0x40')]({'pauseType':_0xa3ef9d});}}else if(_0x1e3c4b){_0x59f2e0['forEach'](function(_0x194620){_0x342cf6['push']({[_0x194620+_0x939f('0x42')]:![]});});}_0x4db461[_0x939f('0x64')]=_[_0x939f('0x65')](_0x4db461[_0x939f('0x64')],{'$and':_0x342cf6});if(_0x41a4b7[_0x939f('0x66')][_0x939f('0x5e')]===_0x939f('0x66')){var _0x445f50={'params':{'id':_0x41a4b7[_0x939f('0x66')][_0x939f('0x67')]},'query':{'section':_0x939f('0x68'),'role':_0x939f('0x5f'),'online':!![],'raw':!![],'ids':_0x46d964,'customSorting':_0x51c730}};if(_0x580615){_0x445f50['query'][_0x939f('0x69')]=_0x342cf6;}_0x445f50[_0x939f('0x48')]=Object[_0x939f('0x6a')](_0x445f50['query'],_0x41a4b7[_0x939f('0x48')]);delete _0x445f50[_0x939f('0x48')]['id'];return db[_0x939f('0x6b')][_0x939f('0x6c')](_0x445f50);}return db['User']['findAndCountAll'](_0x4db461);})[_0x939f('0x13')](function(_0x4cb419){_0x5d8ee1['count']=_0x4cb419['count'];_0xe2300=_0x4cb419[_0x939f('0x57')];return _0xe2300[_0x939f('0x30')](function(_0x5a63b9){var _0x12e122=_['find'](_0x3fad5b,['id',_0x5a63b9['id']]);if(_0x12e122){var _0x487822=rta[_0x939f('0x6d')](_0x12e122);_['merge'](_0x5a63b9,_0x487822);}_0x5a63b9['globalStatus']=rta['getAgentStatus'](_0x5a63b9);if(_0x5a63b9['globalStatus'][_0x939f('0x4f')](_0x939f('0x6e'))){_0x59f2e0[_0x939f('0x63')](function(_0x2e05d1){if(_0x5a63b9[_0x2e05d1+_0x939f('0x42')]){_0x5a63b9[_0x2e05d1+_0x939f('0x6f')]='pause';}});}return _0x5a63b9;});})['then'](function(_0x1a4612){if(!_0x27de43||_0x51c730){return _0x1a4612;}return rta[_0x939f('0x70')](_0x1a4612,_0x27de43);})['then'](function(_0x71ef67){_0x5d8ee1['rows']=_0x71ef67;return _0x5d8ee1;})[_0x939f('0x13')](respondWithFilteredResult(_0x28b758,_0x4db461))['catch'](handleError(_0x28b758,null));};exports['getQueues']=function(_0xa5380c,_0x2fe678){var _0xcca90={'count':0x0,'rows':[]},_0x55eba8={},_0x2e4d89,_0x4f0bf2,_0x405e03,_0x2bd5e2,_0x26eaf1;Promise[_0x939f('0x4d')]()[_0x939f('0x13')](function(){if(_0xa5380c[_0x939f('0x48')]['channel'])_0x2e4d89=validateChannel(_0xa5380c[_0x939f('0x48')]['channel']);var _0x24117b=_[_0x939f('0x43')](_0x2e4d89)+_0x939f('0x41');var _0x34569b=_[_0x939f('0x30')](db[_0x24117b][_0x939f('0x5b')],function(_0xb45643){return{'name':_0xb45643['fieldName'],'type':_0xb45643[_0x939f('0x5d')][_0x939f('0x71')]};});_0x55eba8=qs[_0x939f('0x60')](_0x34569b,_0xa5380c);if(_0xa5380c[_0x939f('0x66')]['role']===_0x939f('0x66')){var _0x4e713b={'params':{'id':_0xa5380c[_0x939f('0x66')][_0x939f('0x67')]},'query':{'section':_0x2e4d89==='voice'&&_0xa5380c[_0x939f('0x48')][_0x939f('0x5d')]==='outbound'?'QueueCampaigns':_[_0x939f('0x43')](_0x2e4d89)+_0x939f('0x12'),'type':_0xa5380c[_0x939f('0x48')][_0x939f('0x5d')],'nolimit':!![],'sort':'name','filter':_0xa5380c['query']['filter']}};return db[_0x939f('0x6b')][_0x939f('0x6c')](_0x4e713b);}return db[_0x24117b]['findAndCountAll'](_0x55eba8);})[_0x939f('0x13')](function(_0x4dd9f2){_0xcca90[_0x939f('0xb')]=_0x4dd9f2[_0x939f('0xb')];_0x4f0bf2=_0x4dd9f2[_0x939f('0x57')];return getRealtimeQueues(_0xa5380c,_0x2e4d89);})['then'](function(_0x57f588){_0x2bd5e2=_0x57f588[_0x939f('0x57')];return rta[_0x939f('0x72')]();})['then'](function(_0x181811){_0x405e03=_0x181811['rows'];if(_0x2e4d89!=_0x939f('0x34'))return;return getRealtimeVoiceQueueChannels();})[_0x939f('0x13')](function(_0x3032d9){_0x26eaf1=_0x3032d9?_0x3032d9['rows']:[];return initializeQueues(_0x4f0bf2,_0x2bd5e2,_0x2e4d89,_0xa5380c[_0x939f('0x48')]['type']);})['then'](function(_0x5071d1){var _0x38077a=_0x5071d1[_0x939f('0x30')](function(_0x19c702){if(_0x2e4d89==='voice')return getVoiceQueueAgents(_0x19c702,_0x4f0bf2,_0x405e03,_0x26eaf1);else return getQueueAgents(_0x19c702,_0x405e03,_0x2e4d89);});return Promise['all'](_0x38077a);})['then'](function(_0x430eac){_0xcca90[_0x939f('0x57')]=_0x430eac;return _0xcca90;})[_0x939f('0x13')](respondWithFilteredResult(_0x2fe678,_0x55eba8))['catch'](handleError(_0x2fe678,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 68092b9..d83f05d 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2a8cb7,_0x314d29){var _0x183a1f=function(_0x7f65bc){while(--_0x7f65bc){_0x2a8cb7['push'](_0x2a8cb7['shift']());}};_0x183a1f(++_0x314d29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4519ca,_0x40ce42){var _0x616250=function(_0x23efbe){while(--_0x23efbe){_0x4519ca['push'](_0x4519ca['shift']());}};_0x616250(++_0x40ce42);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xcb91[_0x5c5c52];return _0x4229ff;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2d4ec56..92cadf1 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 _0xed20=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0x4b8e7f,_0x5eaa3c){var _0x28b12f=function(_0x146b64){while(--_0x146b64){_0x4b8e7f['push'](_0x4b8e7f['shift']());}};_0x28b12f(++_0x5eaa3c);}(_0xed20,0xce));var _0x0ed2=function(_0x90a0ed,_0x27e5d4){_0x90a0ed=_0x90a0ed-0x0;var _0xd1699d=_0xed20[_0x90a0ed];return _0xd1699d;};'use strict';var Sequelize=require(_0x0ed2('0x0'));module[_0x0ed2('0x1')]={'state':{'type':Sequelize[_0x0ed2('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0ed2('0x3')]},'uniqueid':{'type':Sequelize[_0x0ed2('0x4')]},'starttime':{'type':Sequelize[_0x0ed2('0x3')]},'responsetime':{'type':Sequelize[_0x0ed2('0x3')]},'ringtime':{'type':Sequelize[_0x0ed2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0ed2('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0ed2('0x4')]}}; \ No newline at end of file +var _0x5024=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x4bf4ea,_0x502a36){var _0x3b3c3a=function(_0x7e007d){while(--_0x7e007d){_0x4bf4ea['push'](_0x4bf4ea['shift']());}};_0x3b3c3a(++_0x502a36);}(_0x5024,0xf7));var _0x4502=function(_0x7b7f5f,_0x2d472b){_0x7b7f5f=_0x7b7f5f-0x0;var _0x35e97f=_0x5024[_0x7b7f5f];return _0x35e97f;};'use strict';var Sequelize=require(_0x4502('0x0'));module[_0x4502('0x1')]={'state':{'type':Sequelize[_0x4502('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4502('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x4502('0x3')]},'starttime':{'type':Sequelize[_0x4502('0x4')]},'responsetime':{'type':Sequelize[_0x4502('0x4')]},'ringtime':{'type':Sequelize[_0x4502('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4502('0x3')]},'campaigntype':{'type':Sequelize[_0x4502('0x3')]},'membername':{'type':Sequelize[_0x4502('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9f710da..e5450d4 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 _0xec00=['./reportAgentPreview.attributes','exports','ReportAgentPreview','lodash','util','api','bluebird','path','../../config/environment'];(function(_0x26ce19,_0x56cb79){var _0x3b923e=function(_0x54b832){while(--_0x54b832){_0x26ce19['push'](_0x26ce19['shift']());}};_0x3b923e(++_0x56cb79);}(_0xec00,0xed));var _0x0ec0=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xec00[_0x269ee8];return _0x4d98bd;};'use strict';var _=require(_0x0ec0('0x0'));var util=require(_0x0ec0('0x1'));var logger=require('../../config/logger')(_0x0ec0('0x2'));var moment=require('moment');var BPromise=require(_0x0ec0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ec0('0x4'));var rimraf=require('rimraf');var config=require(_0x0ec0('0x5'));var attributes=require(_0x0ec0('0x6'));module[_0x0ec0('0x7')]=function(_0xebcb33,_0x23e684){return _0xebcb33['define'](_0x0ec0('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11c8=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','bluebird'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x11c8,0x6b));var _0x811c=function(_0x25e2a5,_0x2d7270){_0x25e2a5=_0x25e2a5-0x0;var _0x429243=_0x11c8[_0x25e2a5];return _0x429243;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var logger=require(_0x811c('0x1'))(_0x811c('0x2'));var moment=require(_0x811c('0x3'));var BPromise=require(_0x811c('0x4'));var rp=require(_0x811c('0x5'));var fs=require('fs');var path=require(_0x811c('0x6'));var rimraf=require(_0x811c('0x7'));var config=require(_0x811c('0x8'));var attributes=require(_0x811c('0x9'));module[_0x811c('0xa')]=function(_0x20356d,_0x317f6f){return _0x20356d[_0x811c('0xb')](_0x811c('0xc'),attributes,{'tableName':_0x811c('0xd'),'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 5059843..c9cbb12 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 _0xbf34=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','options','CreateReportAgentPreview','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug'];(function(_0x44e6c9,_0x2e50fe){var _0x106f6e=function(_0xbf0d2f){while(--_0xbf0d2f){_0x44e6c9['push'](_0x44e6c9['shift']());}};_0x106f6e(++_0x2e50fe);}(_0xbf34,0xfe));var _0x4bf3=function(_0x2f9c01,_0x32eb3d){_0x2f9c01=_0x2f9c01-0x0;var _0x2e9aba=_0xbf34[_0x2f9c01];return _0x2e9aba;};'use strict';var _=require(_0x4bf3('0x0'));var util=require(_0x4bf3('0x1'));var moment=require(_0x4bf3('0x2'));var BPromise=require(_0x4bf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bf3('0x4'));var db=require(_0x4bf3('0x5'))['db'];var utils=require(_0x4bf3('0x6'));var logger=require('../../config/logger')(_0x4bf3('0x7'));var config=require('../../config/environment');var jayson=require(_0x4bf3('0x8'));var client=jayson[_0x4bf3('0x9')][_0x4bf3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e8c5a,_0x1333d6,_0x3f85c8){return new BPromise(function(_0x4939d0,_0x1026c7){return client[_0x4bf3('0xb')](_0x1e8c5a,_0x3f85c8)[_0x4bf3('0xc')](function(_0x4c9733){logger[_0x4bf3('0xd')](_0x4bf3('0xe'),_0x1333d6,'request\x20sent');logger[_0x4bf3('0xf')](_0x4bf3('0x10'),_0x1333d6,_0x4bf3('0x11'),JSON[_0x4bf3('0x12')](_0x4c9733));if(_0x4c9733[_0x4bf3('0x13')]){if(_0x4c9733[_0x4bf3('0x13')][_0x4bf3('0x14')]===0x1f4){logger[_0x4bf3('0x13')](_0x4bf3('0xe'),_0x1333d6,_0x4c9733[_0x4bf3('0x13')][_0x4bf3('0x15')]);return _0x1026c7(_0x4c9733[_0x4bf3('0x13')]['message']);}logger[_0x4bf3('0x13')](_0x4bf3('0xe'),_0x1333d6,_0x4c9733[_0x4bf3('0x13')][_0x4bf3('0x15')]);return _0x4939d0(_0x4c9733[_0x4bf3('0x13')][_0x4bf3('0x15')]);}else{logger[_0x4bf3('0xd')](_0x4bf3('0xe'),_0x1333d6,_0x4bf3('0x11'));_0x4939d0(_0x4c9733[_0x4bf3('0x16')][_0x4bf3('0x15')]);}})[_0x4bf3('0x17')](function(_0x3e80eb){logger['error'](_0x4bf3('0xe'),_0x1333d6,_0x3e80eb);_0x1026c7(_0x3e80eb);});});}exports['CreateReportAgentPreview']=function(_0x33c2e2){var _0x2fec6f=this;return new Promise(function(_0x225554,_0x1e1cb0){return db['ReportAgentPreview'][_0x4bf3('0x18')](_0x33c2e2['body'],{'raw':_0x33c2e2[_0x4bf3('0x19')]?_0x33c2e2['options']['raw']===undefined?!![]:![]:!![]})[_0x4bf3('0xc')](function(_0x1ec235){logger[_0x4bf3('0xd')](_0x4bf3('0x1a'),_0x33c2e2);logger['debug']('CreateReportAgentPreview',_0x33c2e2,JSON[_0x4bf3('0x12')](_0x1ec235));_0x225554(_0x1ec235);})[_0x4bf3('0x17')](function(_0x37a4bf){logger['error'](_0x4bf3('0x1a'),_0x37a4bf[_0x4bf3('0x15')],_0x33c2e2);_0x1e1cb0(_0x2fec6f[_0x4bf3('0x13')](0x1f4,_0x37a4bf[_0x4bf3('0x15')]));});});}; \ No newline at end of file +var _0x8c57=['code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c57,0x1ea));var _0x78c5=function(_0x37b44d,_0x372f63){_0x37b44d=_0x37b44d-0x0;var _0x300a9c=_0x8c57[_0x37b44d];return _0x300a9c;};'use strict';var _=require(_0x78c5('0x0'));var util=require(_0x78c5('0x1'));var moment=require(_0x78c5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x78c5('0x4'));var logger=require(_0x78c5('0x5'))(_0x78c5('0x6'));var config=require(_0x78c5('0x7'));var jayson=require(_0x78c5('0x8'));var client=jayson[_0x78c5('0x9')][_0x78c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f670f,_0x1a8ac7,_0x4032a2){return new BPromise(function(_0x2e248d,_0x5b555c){return client[_0x78c5('0xb')](_0x1f670f,_0x4032a2)[_0x78c5('0xc')](function(_0x1727de){logger[_0x78c5('0xd')](_0x78c5('0xe'),_0x1a8ac7,_0x78c5('0xf'));logger[_0x78c5('0x10')](_0x78c5('0x11'),_0x1a8ac7,_0x78c5('0xf'),JSON[_0x78c5('0x12')](_0x1727de));if(_0x1727de['error']){if(_0x1727de[_0x78c5('0x13')][_0x78c5('0x14')]===0x1f4){logger['error'](_0x78c5('0xe'),_0x1a8ac7,_0x1727de[_0x78c5('0x13')][_0x78c5('0x15')]);return _0x5b555c(_0x1727de['error'][_0x78c5('0x15')]);}logger[_0x78c5('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x1a8ac7,_0x1727de['error'][_0x78c5('0x15')]);return _0x2e248d(_0x1727de[_0x78c5('0x13')][_0x78c5('0x15')]);}else{logger[_0x78c5('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x1a8ac7,_0x78c5('0xf'));_0x2e248d(_0x1727de[_0x78c5('0x16')]['message']);}})[_0x78c5('0x17')](function(_0x49c3aa){logger[_0x78c5('0x13')](_0x78c5('0xe'),_0x1a8ac7,_0x49c3aa);_0x5b555c(_0x49c3aa);});});}exports[_0x78c5('0x18')]=function(_0x399b68){var _0x3c6aae=this;return new Promise(function(_0x3ec751,_0x2d6fad){return db[_0x78c5('0x19')][_0x78c5('0x1a')](_0x399b68[_0x78c5('0x1b')],{'raw':_0x399b68['options']?_0x399b68[_0x78c5('0x1c')][_0x78c5('0x1d')]===undefined?!![]:![]:!![]})[_0x78c5('0xc')](function(_0x4bb396){logger[_0x78c5('0xd')](_0x78c5('0x18'),_0x399b68);logger[_0x78c5('0x10')](_0x78c5('0x18'),_0x399b68,JSON[_0x78c5('0x12')](_0x4bb396));_0x3ec751(_0x4bb396);})[_0x78c5('0x17')](function(_0x37c73c){logger['error'](_0x78c5('0x18'),_0x37c73c[_0x78c5('0x15')],_0x399b68);_0x2d6fad(_0x3c6aae['error'](0x1f4,_0x37c73c['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 08f7584..7579bc4 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 _0x5d3a=['agentCapacity','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','./rpc.controller','isAuthenticated','voiceChannels','get','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','outbound','outboundChannels','/agents','agents','/agents/:id/capacity'];(function(_0x208754,_0x23ae4c){var _0x460398=function(_0xaddd45){while(--_0xaddd45){_0x208754['push'](_0x208754['shift']());}};_0x460398(++_0x23ae4c);}(_0x5d3a,0x13a));var _0xa5d3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5d3a[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xa5d3('0x0'));var util=require(_0xa5d3('0x1'));var path=require(_0xa5d3('0x2'));var express=require(_0xa5d3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xa5d3('0x4'));router['get']('/voice/channels',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x6')]);router[_0xa5d3('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xa5d3('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x8')]);router[_0xa5d3('0x7')](_0xa5d3('0x9'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0xa')]);router[_0xa5d3('0x7')]('/chat/queues',auth[_0xa5d3('0x5')](),controller['chatQueues']);router[_0xa5d3('0x7')](_0xa5d3('0xb'),auth['isAuthenticated'](),controller[_0xa5d3('0xc')]);router[_0xa5d3('0x7')](_0xa5d3('0xd'),auth['isAuthenticated'](),controller[_0xa5d3('0xe')]);router['get'](_0xa5d3('0xf'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x10')]);router[_0xa5d3('0x7')](_0xa5d3('0x11'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x12')]);router[_0xa5d3('0x7')](_0xa5d3('0x13'),auth[_0xa5d3('0x5')](),controller['whatsappQueues']);router[_0xa5d3('0x7')](_0xa5d3('0x14'),auth['isAuthenticated'](),controller['faxQueues']);router[_0xa5d3('0x7')](_0xa5d3('0x15'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x16')]);router[_0xa5d3('0x7')]('/voice/queues/channels',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x17')]);router[_0xa5d3('0x7')](_0xa5d3('0x18'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x19')]);router[_0xa5d3('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x1a')]);router[_0xa5d3('0x7')](_0xa5d3('0x1b'),auth[_0xa5d3('0x5')](),controller['voiceQueuesChannelRedirect']);router[_0xa5d3('0x7')](_0xa5d3('0x1c'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xa5d3('0x1d')](_0xa5d3('0x1c'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x1e')]);router['get']('/outbound',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x1f')]);router[_0xa5d3('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xa5d3('0x20')]);router['get'](_0xa5d3('0x21'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x22')]);router[_0xa5d3('0x1d')](_0xa5d3('0x23'),auth['isAuthenticated'](),controller[_0xa5d3('0x24')]);router[_0xa5d3('0x7')]('/telephones',auth[_0xa5d3('0x5')](),controller['telephones']);router[_0xa5d3('0x7')](_0xa5d3('0x25'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x26')]);router[_0xa5d3('0x7')](_0xa5d3('0x27'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x28')]);router[_0xa5d3('0x7')]('/fax/accounts',auth[_0xa5d3('0x5')](),controller['faxAccounts']);router['get'](_0xa5d3('0x29'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xa5d3('0x7')]('/mail/queues/waitinginteractions',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x2a')]);router[_0xa5d3('0x7')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xa5d3('0x2b')]);router[_0xa5d3('0x7')](_0xa5d3('0x2c'),auth['isAuthenticated'](),controller[_0xa5d3('0x2d')]);router['get'](_0xa5d3('0x2e'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x2f')]);router[_0xa5d3('0x7')](_0xa5d3('0x30'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x31')]);router[_0xa5d3('0x7')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xa5d3('0x32')]);router[_0xa5d3('0x33')]('/mail/queues/:id/notify',auth[_0xa5d3('0x5')](),controller['queueNotify'](_0xa5d3('0x34')));router['get'](_0xa5d3('0x35'),auth[_0xa5d3('0x5')](),controller['showMailQueues']);router['post'](_0xa5d3('0x36'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x37')]('chat'));router[_0xa5d3('0x7')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0xa5d3('0x38')]);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0xa5d3('0x37')](_0xa5d3('0x39')));router['get']('/fax/queues/:id',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x3a')]);router[_0xa5d3('0x33')](_0xa5d3('0x3b'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x37')](_0xa5d3('0x3c')));router['get']('/openchannel/queues/:id',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x3d')]);router[_0xa5d3('0x33')]('/sms/queues/:id/notify',auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x37')](_0xa5d3('0x3e')));router[_0xa5d3('0x33')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0xa5d3('0x37')](_0xa5d3('0x3f')));router[_0xa5d3('0x7')](_0xa5d3('0x40'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x41')]);router[_0xa5d3('0x7')](_0xa5d3('0x42'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x43')]);router[_0xa5d3('0x33')](_0xa5d3('0x44'),auth[_0xa5d3('0x5')](),controller[_0xa5d3('0x45')]);module['exports']=router; \ No newline at end of file +var _0xa2e1=['campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','mail','/mail/queues/:id','showMailQueues','post','queueNotify','chat','/chat/queues/:id','showChatQueues','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns'];(function(_0x509c51,_0x3dba4b){var _0x29d918=function(_0x2b6cd5){while(--_0x2b6cd5){_0x509c51['push'](_0x509c51['shift']());}};_0x29d918(++_0x3dba4b);}(_0xa2e1,0x1a9));var _0x1a2e=function(_0x5ecd57,_0x5ac446){_0x5ecd57=_0x5ecd57-0x0;var _0x647b4=_0xa2e1[_0x5ecd57];return _0x647b4;};'use strict';var multer=require(_0x1a2e('0x0'));var util=require(_0x1a2e('0x1'));var path=require(_0x1a2e('0x2'));var express=require(_0x1a2e('0x3'));var router=express[_0x1a2e('0x4')]();var auth=require(_0x1a2e('0x5'));var controller=require(_0x1a2e('0x6'));router[_0x1a2e('0x7')](_0x1a2e('0x8'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x1a2e('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x1a2e('0x9')](),controller[_0x1a2e('0xa')]);router[_0x1a2e('0x7')](_0x1a2e('0xb'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x1a2e('0x7')](_0x1a2e('0xc'),auth[_0x1a2e('0x9')](),controller['voiceQueues']);router['get'](_0x1a2e('0xd'),auth['isAuthenticated'](),controller['chatQueues']);router['get']('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x1a2e('0x7')](_0x1a2e('0xe'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0xf')]);router['get']('/openchannel/queues',auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x10')]);router[_0x1a2e('0x7')](_0x1a2e('0x11'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x12')]);router[_0x1a2e('0x7')](_0x1a2e('0x13'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x14')]);router[_0x1a2e('0x7')](_0x1a2e('0x15'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x16')]);router[_0x1a2e('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x1a2e('0x17')]);router[_0x1a2e('0x7')](_0x1a2e('0x18'),auth['isAuthenticated'](),controller[_0x1a2e('0x19')]);router[_0x1a2e('0x7')](_0x1a2e('0x1a'),auth[_0x1a2e('0x9')](),controller['voiceQueuesChannel']);router[_0x1a2e('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1a2e('0x9')](),controller['voiceQueuesChannelHangup']);router[_0x1a2e('0x7')](_0x1a2e('0x1b'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x1c')]);router['get'](_0x1a2e('0x1d'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x1e')]);router[_0x1a2e('0x1f')](_0x1a2e('0x1d'),auth[_0x1a2e('0x9')](),controller['updateVoiceQueue']);router[_0x1a2e('0x7')]('/outbound',auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x20')]);router[_0x1a2e('0x7')](_0x1a2e('0x21'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x22')]);router[_0x1a2e('0x7')](_0x1a2e('0x23'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x24')]);router[_0x1a2e('0x1f')](_0x1a2e('0x25'),auth['isAuthenticated'](),controller[_0x1a2e('0x26')]);router[_0x1a2e('0x7')]('/telephones',auth['isAuthenticated'](),controller[_0x1a2e('0x27')]);router[_0x1a2e('0x7')](_0x1a2e('0x28'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x29')]);router[_0x1a2e('0x7')](_0x1a2e('0x2a'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x2b')]);router[_0x1a2e('0x7')](_0x1a2e('0x2c'),auth['isAuthenticated'](),controller[_0x1a2e('0x2d')]);router['get'](_0x1a2e('0x2e'),auth[_0x1a2e('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x1a2e('0x7')](_0x1a2e('0x2f'),auth[_0x1a2e('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0x1a2e('0x7')](_0x1a2e('0x30'),auth['isAuthenticated'](),controller[_0x1a2e('0x31')]);router['get'](_0x1a2e('0x32'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x33')]);router[_0x1a2e('0x7')](_0x1a2e('0x34'),auth[_0x1a2e('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0x1a2e('0x7')](_0x1a2e('0x35'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x36')]);router[_0x1a2e('0x7')](_0x1a2e('0x37'),auth['isAuthenticated'](),controller[_0x1a2e('0x38')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x1a2e('0x39')));router['get'](_0x1a2e('0x3a'),auth['isAuthenticated'](),controller[_0x1a2e('0x3b')]);router[_0x1a2e('0x3c')]('/chat/queues/:id/notify',auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x3d')](_0x1a2e('0x3e')));router[_0x1a2e('0x7')](_0x1a2e('0x3f'),auth['isAuthenticated'](),controller[_0x1a2e('0x40')]);router[_0x1a2e('0x3c')]('/fax/queues/:id/notify',auth[_0x1a2e('0x9')](),controller['queueNotify'](_0x1a2e('0x41')));router[_0x1a2e('0x7')]('/fax/queues/:id',auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x42')]);router[_0x1a2e('0x3c')]('/openchannel/queues/:id/notify',auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x3d')](_0x1a2e('0x43')));router[_0x1a2e('0x7')](_0x1a2e('0x44'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x45')]);router[_0x1a2e('0x3c')](_0x1a2e('0x46'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x3d')]('sms'));router[_0x1a2e('0x3c')](_0x1a2e('0x47'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x3d')]('whatsapp'));router[_0x1a2e('0x7')](_0x1a2e('0x48'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x49')]);router[_0x1a2e('0x7')](_0x1a2e('0x4a'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0x4b')]);router['post'](_0x1a2e('0x4c'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x1a2e('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 365a041..bbf415e 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 _0x814b=['whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','create','Start','queue','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','voiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues'];(function(_0xbdaa0f,_0x20e63c){var _0x4332a7=function(_0x2af53a){while(--_0x2af53a){_0xbdaa0f['push'](_0xbdaa0f['shift']());}};_0x4332a7(++_0x20e63c);}(_0x814b,0x1a2));var _0xb814=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x814b[_0x5180c3];return _0x55c975;};'use strict';var BPromise=require(_0xb814('0x0'));var moment=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var db=require(_0xb814('0x4'))['db'];var logger=require(_0xb814('0x5'))('api');var jayson=require(_0xb814('0x6'));var amiClient=jayson[_0xb814('0x7')][_0xb814('0x8')]({'port':0x232a});var mailClient=jayson[_0xb814('0x7')][_0xb814('0x8')]({'port':0x232b});var routingClient=jayson[_0xb814('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){var _0x186d5a=_0x5c8539?_0x5c8539:amiClient;return _0x186d5a[_0xb814('0x9')](_0x3b0829,_0x2e6272)[_0xb814('0xa')](function(_0x21d4a5){if(_0x21d4a5[_0xb814('0xb')]){if(_0x21d4a5[_0xb814('0xb')][_0xb814('0xc')]===0x1f4){return _0x2913a6(_0x21d4a5[_0xb814('0xb')][_0xb814('0xd')]);}return _0x271af9(_0x21d4a5['error'][_0xb814('0xd')]);}else{_0x271af9(_0x21d4a5['result']);}})[_0xb814('0xe')](function(_0x15d6ef){_0x2913a6(_0x15d6ef);});});}function respondWithResult(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xc8;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0xf')](_0x2cc46b)[_0xb814('0x10')](_0x2ce718);}return _0x35b10d[_0xb814('0x11')](0x194);};}function handleError(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0x1f4;return function(_0x3f4881){logger[_0xb814('0xb')](_0x3f4881[_0xb814('0x12')]);if(_0x3f4881[_0xb814('0x13')]){delete _0x3f4881[_0xb814('0x13')];}_0xa0a2e5[_0xb814('0xf')](_0x2ab627)[_0xb814('0x14')](_0x3f4881);};}function findById(_0x265a83){return function(_0x125ce2){if(!_[_0xb814('0x15')](_0x265a83)&&!_[_0xb814('0x15')](_0x125ce2)&&!_['isNil'](_0x125ce2[_0xb814('0x16')])){return _['find'](_0x125ce2[_0xb814('0x16')],function(_0xfac75b){return _0xfac75b['id']==_0x265a83;});}return null;};}exports['voiceChannels']=function(_0x4b55a7,_0x55d63c){return respondWithRpcPromise(_0xb814('0x17'),_0x4b55a7['query'])['then'](respondWithResult(_0x55d63c,null))[_0xb814('0xe')](handleError(_0x55d63c,null));};exports[_0xb814('0x18')]=function(_0x25b6b6,_0x4e139e){return respondWithRpcPromise(_0xb814('0x19'),_['merge'](_0x25b6b6[_0xb814('0x1a')],_0x25b6b6[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4e139e,null))[_0xb814('0xe')](handleError(_0x4e139e,null));};exports[_0xb814('0x1c')]=function(_0x2bd039,_0x1f5d40){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xb814('0x1d')](_0x2bd039['query'],_0x2bd039[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x1f5d40,null))[_0xb814('0xe')](handleError(_0x1f5d40,null));};exports[_0xb814('0x1e')]=function(_0x1c8a2e,_0xb9e57d){return respondWithRpcPromise(_0xb814('0x1f'),_0x1c8a2e['query'])[_0xb814('0xa')](respondWithResult(_0xb9e57d,null))[_0xb814('0xe')](handleError(_0xb9e57d,null));};exports[_0xb814('0x20')]=function(_0x349394,_0x32ed56){return respondWithRpcPromise(_0xb814('0x1f'),_0x349394[_0xb814('0x1a')])[_0xb814('0xa')](findById(_0x349394['params']['id']))[_0xb814('0xa')](respondWithResult(_0x32ed56,null))[_0xb814('0xe')](handleError(_0x32ed56,null));};exports['updateVoiceQueue']=function(_0x9008b2,_0x37d24d){return respondWithRpcPromise(_0xb814('0x21'),_['merge'](_0x9008b2[_0xb814('0x22')],_0x9008b2[_0xb814('0x1b')]))['then'](respondWithResult(_0x37d24d,null))[_0xb814('0xe')](handleError(_0x37d24d,null));};exports['voiceQueuesPreview']=function(_0x6efe9a,_0x5f3e9b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xb814('0x1d')](_0x6efe9a['query'],_0x6efe9a[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x5f3e9b,null))[_0xb814('0xe')](handleError(_0x5f3e9b,null));};exports['voiceQueuesChannels']=function(_0x51d5ae,_0x26d3a9){return respondWithRpcPromise(_0xb814('0x23'),_0x51d5ae['query'])[_0xb814('0xa')](respondWithResult(_0x26d3a9,null))[_0xb814('0xe')](handleError(_0x26d3a9,null));};exports[_0xb814('0x24')]=function(_0x217b7e,_0x1b78de){return respondWithRpcPromise(_0xb814('0x25'),_[_0xb814('0x1d')](_0x217b7e['query'],_0x217b7e[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x1b78de,null))[_0xb814('0xe')](handleError(_0x1b78de,null));};exports[_0xb814('0x26')]=function(_0x14100d,_0x4ff31a){return respondWithRpcPromise(_0xb814('0x27'),_['merge'](_0x14100d[_0xb814('0x1a')],_0x14100d[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4ff31a,null))['catch'](handleError(_0x4ff31a,null));};exports[_0xb814('0x28')]=function(_0xbdb3e9,_0x4ea6f8){return respondWithRpcPromise(_0xb814('0x29'),_[_0xb814('0x1d')](_0xbdb3e9[_0xb814('0x1a')],_0xbdb3e9[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4ea6f8,null))[_0xb814('0xe')](handleError(_0x4ea6f8,null));};exports['outbound']=function(_0xa6ce87,_0x4e4684){return respondWithRpcPromise(_0xb814('0x2a'),_0xa6ce87['query'])[_0xb814('0xa')](respondWithResult(_0x4e4684,null))['catch'](handleError(_0x4e4684,null));};exports[_0xb814('0x2b')]=function(_0x26675a,_0x54a7fb){return respondWithRpcPromise('OutboundChannels',_0x26675a['query'])['then'](respondWithResult(_0x54a7fb,null))[_0xb814('0xe')](handleError(_0x54a7fb,null));};exports[_0xb814('0x2c')]=function(_0x38cdc2,_0x42c2ed){var _0x51cdba;return respondWithRpcPromise('Agents',_0x38cdc2[_0xb814('0x1a')])['then'](function(_0x2a93da){_0x51cdba=_0x2a93da;return respondWithRpcPromise(_0xb814('0x2d'),_0x38cdc2[_0xb814('0x1a')],routingClient);})[_0xb814('0xa')](function(_0x42653f){return _[_0xb814('0x1d')]({},_0x42653f,_0x51cdba);})[_0xb814('0xa')](respondWithResult(_0x42c2ed,null))[_0xb814('0xe')](handleError(_0x42c2ed,null));};exports[_0xb814('0x2e')]=function(_0x4b6ff8,_0x544d36){if(_0x4b6ff8['body']&&_0x4b6ff8[_0xb814('0x22')]['interaction']&&_0x4b6ff8[_0xb814('0x2f')]&&_0x4b6ff8['user'][_0xb814('0x13')]){for(var _0x44ff56 in _0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')]){if(_0x4b6ff8['body'][_0xb814('0x30')][_0xb814('0x31')](_0x44ff56)){db[_0xb814('0x32')][_0xb814('0x33')]({'where':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56]&&_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56][_0xb814('0x34')]?{'$notIn':_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56]}:{'$ne':null}}})['then'](function(_0x4a5e84){var _0xe751c3=moment()[_0xb814('0x35')](_0xb814('0x36'));for(var _0x2bf906=0x0,_0x43f1b=_0x4a5e84[_0xb814('0x34')];_0x2bf906<_0x43f1b;_0x2bf906+=0x1){_0x4a5e84[_0x2bf906][_0xb814('0x37')]({'exitAt':_0xe751c3});}});for(var _0x40af85=0x0;_0x40af85<_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56][_0xb814('0x34')];_0x40af85+=0x1){db['MemberReport'][_0xb814('0x38')]({'where':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')]['name'],'type':_0xb814('0x39'),'uniqueid':_0x4b6ff8['body'][_0xb814('0x30')][_0x44ff56][_0x40af85],'exitAt':null},'defaults':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')],'interface':_[_0xb814('0x15')](_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x3a')])?util[_0xb814('0x35')](_0xb814('0x3b'),_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')]):_0x4b6ff8['user']['interface'],'type':_0xb814('0x39'),'enterAt':moment()[_0xb814('0x35')](_0xb814('0x36')),'role':_0xb814('0x3c'),'internal':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x3d')],'uniqueid':_0x4b6ff8[_0xb814('0x22')]['interaction'][_0x44ff56][_0x40af85]}});}}}}return respondWithRpcPromise(_0xb814('0x3e'),{'id':_0x4b6ff8[_0xb814('0x1b')]['id'],'capacity':_0x4b6ff8[_0xb814('0x22')]['capacity']},routingClient)[_0xb814('0xa')](respondWithResult(_0x544d36,null))['catch'](handleError(_0x544d36,null));};exports[_0xb814('0x3f')]=function(_0x5dc28e,_0x403872){return respondWithRpcPromise(_0xb814('0x40'),_0x5dc28e['query'])[_0xb814('0xa')](respondWithResult(_0x403872,null))[_0xb814('0xe')](handleError(_0x403872,null));};exports[_0xb814('0x41')]=function(_0x5209d1,_0x3da050){return respondWithRpcPromise('Trunks',_0x5209d1[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0x3da050,null))['catch'](handleError(_0x3da050,null));};exports[_0xb814('0x42')]=function(_0x4a3f84,_0x539be7){return respondWithRpcPromise(_0xb814('0x43'),_0x4a3f84[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0x539be7,null))['catch'](handleError(_0x539be7,null));};exports[_0xb814('0x44')]=function(_0x538b0f,_0xf88d23){return respondWithRpcPromise(_0xb814('0x45'),_0x538b0f['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0xf88d23,null))['catch'](handleError(_0xf88d23,null));};exports[_0xb814('0x46')]=function(_0x1656ed,_0xb2bd82){return respondWithRpcPromise(_0xb814('0x45'),_0x1656ed[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x1656ed[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0xb2bd82,null))['catch'](handleError(_0xb2bd82,null));};exports[_0xb814('0x47')]=function(_0x5441c5,_0x5d71d5){return respondWithRpcPromise(_0xb814('0x48'),_0x5441c5[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x5d71d5,null))[_0xb814('0xe')](handleError(_0x5d71d5,null));};exports['showMailQueues']=function(_0x48362c,_0x2114ca){return respondWithRpcPromise('MailQueues',_0x48362c[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x48362c[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x2114ca,null))[_0xb814('0xe')](handleError(_0x2114ca,null));};exports['mailAccounts']=function(_0x2ef77d,_0x1e9196){return respondWithRpcPromise(_0xb814('0x49'),_0x2ef77d[_0xb814('0x1a')],mailClient)[_0xb814('0xa')](respondWithResult(_0x1e9196,null))[_0xb814('0xe')](handleError(_0x1e9196,null));};exports[_0xb814('0x4a')]=function(_0x113350,_0x46014f){return respondWithRpcPromise('OpenchannelQueues',_0x113350[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x46014f,null))[_0xb814('0xe')](handleError(_0x46014f,null));};exports[_0xb814('0x4b')]=function(_0x3b35a8,_0x3d4843){return respondWithRpcPromise('OpenchannelQueues',_0x3b35a8[_0xb814('0x1a')],routingClient)['then'](findById(_0x3b35a8[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0x3d4843,null))[_0xb814('0xe')](handleError(_0x3d4843,null));};exports['smsQueues']=function(_0x150e73,_0x579351){return respondWithRpcPromise(_0xb814('0x4c'),_0x150e73['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0x579351,null))[_0xb814('0xe')](handleError(_0x579351,null));};exports[_0xb814('0x4d')]=function(_0x1b024f,_0x3377d4){return respondWithRpcPromise(_0xb814('0x4c'),_0x1b024f[_0xb814('0x1a')],routingClient)['then'](findById(_0x1b024f[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x3377d4,null))[_0xb814('0xe')](handleError(_0x3377d4,null));};exports[_0xb814('0x4e')]=function(_0x1b989d,_0x3dcaeb){return respondWithRpcPromise(_0xb814('0x4f'),_0x1b989d[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x3dcaeb,null))[_0xb814('0xe')](handleError(_0x3dcaeb,null));};exports[_0xb814('0x50')]=function(_0x4a49ba,_0x3bb2b4){return respondWithRpcPromise(_0xb814('0x4f'),_0x4a49ba[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x4a49ba[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x3bb2b4,null))[_0xb814('0xe')](handleError(_0x3bb2b4,null));};exports['faxQueues']=function(_0x24594a,_0x16f8f2){return respondWithRpcPromise(_0xb814('0x51'),_0x24594a[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x16f8f2,null))[_0xb814('0xe')](handleError(_0x16f8f2,null));};exports['showFaxQueues']=function(_0x506bf2,_0x5d064b){return respondWithRpcPromise(_0xb814('0x51'),_0x506bf2['query'],routingClient)[_0xb814('0xa')](findById(_0x506bf2[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0x5d064b,null))['catch'](handleError(_0x5d064b,null));};exports[_0xb814('0x52')]=function(_0x3e5ce8,_0xee204){return respondWithRpcPromise('FaxAccounts',_0x3e5ce8[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0xee204,null))[_0xb814('0xe')](handleError(_0xee204,null));};exports[_0xb814('0x53')]=function(_0x555be0,_0x5dedd7){return respondWithRpcPromise(_0xb814('0x54'),_0x555be0[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x5dedd7,null))[_0xb814('0xe')](handleError(_0x5dedd7,null));};exports[_0xb814('0x55')]=function(_0xe5fc12,_0x34a0b3){return respondWithRpcPromise(_0xb814('0x56'),_0xe5fc12[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x34a0b3,null))[_0xb814('0xe')](handleError(_0x34a0b3,null));};exports[_0xb814('0x57')]=function(_0x3ef474,_0x21fc41){return respondWithRpcPromise(_0xb814('0x58'),_0x3ef474['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0x21fc41,null))[_0xb814('0xe')](handleError(_0x21fc41,null));};exports[_0xb814('0x59')]=function(_0x357b90,_0xec821a){return respondWithRpcPromise(_0xb814('0x58'),_0x357b90['query'],routingClient)[_0xb814('0xa')](function(_0x52e1fc){if(_0x357b90[_0xb814('0x1a')][_0xb814('0x5a')]!==undefined){var _0x3c5a58=_(_0x52e1fc[_0xb814('0x16')])[_0xb814('0x5b')]([_0x357b90['query']['type'],_0x357b90[_0xb814('0x1b')]['id']])[_0xb814('0x5c')](_0xb814('0x5d'))[_0xb814('0x5e')]()['value']();return _0x52e1fc[_0xb814('0x16')]['filter'](function(_0x39073c){return _0x3c5a58[_0xb814('0x5f')](_0x39073c['queue_id'])>-0x1;});}else{return _0x52e1fc['rows'][_0xb814('0x5b')](function(_0x52e17a){return _0x52e17a[_0xb814('0x5d')]===parseInt(_0x357b90[_0xb814('0x1b')]['id']);});}})[_0xb814('0xa')](respondWithResult(_0xec821a,null))[_0xb814('0xe')](handleError(_0xec821a,null));};exports[_0xb814('0x60')]=function(_0x420bde,_0x40fe4a){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x420bde[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x40fe4a,null))[_0xb814('0xe')](handleError(_0x40fe4a,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2838cb,_0x43ee60){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2838cb[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x43ee60,null))[_0xb814('0xe')](handleError(_0x43ee60,null));};exports[_0xb814('0x61')]=function(_0x4e15c2,_0x5a0c4a){return respondWithRpcPromise(_0xb814('0x62'),_0x4e15c2[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x5a0c4a,null))[_0xb814('0xe')](handleError(_0x5a0c4a,null));};exports[_0xb814('0x63')]=function(_0x4394da){return function(_0x2b12a9,_0x314600){var _0x8cb107,_0x34f49c;var _0x53e705=_['capitalize'](_0x4394da);var _0x5bee4d=_0x4394da==='chat'?'Website':_0xb814('0x64');return db[_0x53e705+_0xb814('0x65')][_0xb814('0x66')]({'raw':!![],'where':{'id':_0x2b12a9['params']['id']}})[_0xb814('0xa')](function(_0x1fb1ea){if(_[_0xb814('0x15')](_0x1fb1ea)){throw new Error(_0x53e705+_0xb814('0x67'));}_0x8cb107=_0x1fb1ea;return db[_0x53e705+_0xb814('0x68')][_0xb814('0x66')]({'where':{'id':_0x2b12a9[_0xb814('0x22')][_0xb814('0x69')]},'include':[{'model':db[_0x53e705+'Interaction'],'as':_0xb814('0x6a')},{'model':db[_0x53e705+_0x5bee4d],'as':_0xb814('0x64')}]});})[_0xb814('0xa')](function(_0x30faa0){if(_['isNil'](_0x30faa0)){throw new Error(_0x53e705+_0xb814('0x6b'));}_0x34f49c=_0x30faa0;return _0x30faa0[_0xb814('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb814('0xa')](function(){var _0x3037f2={'uniqueid':_0x4394da+'.'+_0x34f49c['id']+'.'+_0x34f49c[_0xb814('0x6a')]['id'],'FromUserId':_0x2b12a9['user']['id'],'type':'queue'};_0x3037f2[_0x53e705+_0xb814('0x6d')]=_0x34f49c['id'];_0x3037f2[_0x53e705+'InteractionId']=_0x34f49c[_0xb814('0x6a')]['id'];_0x3037f2[_0xb814('0x6e')+_0x53e705+_0x5bee4d+'Id']=_0x34f49c['Account']['id'];_0x3037f2['To'+_0x53e705+_0xb814('0x6f')]=_0x8cb107['id'];return db[_0x53e705+'TransferReport'][_0xb814('0x70')](_0x3037f2);})['then'](function(){return respondWithRpcPromise(_0xb814('0x71'),{'channel':_0x4394da,'interaction':_0x34f49c[_0xb814('0x6a')],'message':_0x34f49c,'account':_0x34f49c[_0xb814('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb814('0x72'),'appdata':_0x8cb107[_0xb814('0x13')]+','+(_0x34f49c[_0xb814('0x64')][_0xb814('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x314600,null))[_0xb814('0xe')](handleError(_0x314600,null));};};exports['agentNotify']=function(_0x511e03,_0x2d0061){var _0x8fbda1,_0x25d42d;if(_['isNil'](_0x511e03[_0xb814('0x22')]['channel'])){throw new Error(_0xb814('0x74'));}var _0x19d508=_0x511e03[_0xb814('0x22')][_0xb814('0x75')];var _0x4c8a00=_[_0xb814('0x76')](_0x19d508);var _0xc0ff3c=_0x19d508===_0xb814('0x77')?'Website':_0xb814('0x64');return db[_0xb814('0x78')][_0xb814('0x66')]({'raw':!![],'where':{'id':_0x511e03['params']['id'],'role':_0xb814('0x3c')}})[_0xb814('0xa')](function(_0x9dc06b){if(_[_0xb814('0x15')](_0x9dc06b)){throw new Error(_0xb814('0x79'));}_0x8fbda1=_0x9dc06b;return db[_0x4c8a00+_0xb814('0x68')][_0xb814('0x66')]({'where':{'id':_0x511e03[_0xb814('0x22')][_0xb814('0x69')]},'include':[{'model':db[_0x4c8a00+_0xb814('0x6a')],'as':_0xb814('0x6a')},{'model':db[_0x4c8a00+_0xc0ff3c],'as':_0xb814('0x64')}]});})[_0xb814('0xa')](function(_0x5b8d2e){if(_['isNil'](_0x5b8d2e)){throw new Error(_0x4c8a00+_0xb814('0x6b'));}_0x25d42d=_0x5b8d2e;return _0x5b8d2e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xb814('0xa')](function(){var _0x3949fd={'uniqueid':_0x19d508+'.'+_0x25d42d['id']+'.'+_0x25d42d[_0xb814('0x6a')]['id'],'FromUserId':_0x511e03[_0xb814('0x2f')]['id'],'type':_0xb814('0x72'),'ToUserId':_0x8fbda1['id']};_0x3949fd[_0x4c8a00+_0xb814('0x6d')]=_0x25d42d['id'];_0x3949fd[_0x4c8a00+_0xb814('0x7a')]=_0x25d42d['Interaction']['id'];_0x3949fd['From'+_0x4c8a00+_0xc0ff3c+'Id']=_0x25d42d[_0xb814('0x64')]['id'];return db[_0x4c8a00+'TransferReport'][_0xb814('0x70')](_0x3949fd);})[_0xb814('0xa')](function(){return respondWithRpcPromise(_0xb814('0x71'),{'channel':_0x19d508,'interaction':_0x25d42d['Interaction'],'message':_0x25d42d,'account':_0x25d42d[_0xb814('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb814('0x3c'),'appdata':_0x8fbda1[_0xb814('0x13')]+','+(_0x25d42d[_0xb814('0x64')][_0xb814('0x7b')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb814('0xa')](respondWithResult(_0x2d0061,null))[_0xb814('0xe')](handleError(_0x2d0061,null));}; \ No newline at end of file +var _0x98a8=['openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','TransferReport','create','Start','Account','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','messageId','From','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','result','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions'];(function(_0x12b641,_0x2c690a){var _0x6c5b57=function(_0xb355a6){while(--_0xb355a6){_0x12b641['push'](_0x12b641['shift']());}};_0x6c5b57(++_0x2c690a);}(_0x98a8,0x12c));var _0x898a=function(_0x284686,_0x103926){_0x284686=_0x284686-0x0;var _0x95d944=_0x98a8[_0x284686];return _0x95d944;};'use strict';var BPromise=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));var _=require(_0x898a('0x2'));var util=require(_0x898a('0x3'));var db=require(_0x898a('0x4'))['db'];var logger=require(_0x898a('0x5'))(_0x898a('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x898a('0x7')][_0x898a('0x8')]({'port':0x232a});var mailClient=jayson[_0x898a('0x7')][_0x898a('0x8')]({'port':0x232b});var routingClient=jayson[_0x898a('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){var _0x283c5=_0xfa8c50?_0xfa8c50:amiClient;return _0x283c5[_0x898a('0x9')](_0x3aadc2,_0x564583)[_0x898a('0xa')](function(_0x3150df){if(_0x3150df[_0x898a('0xb')]){if(_0x3150df[_0x898a('0xb')][_0x898a('0xc')]===0x1f4){return _0x42021d(_0x3150df[_0x898a('0xb')]['message']);}return _0x4fbce5(_0x3150df[_0x898a('0xb')]['message']);}else{_0x4fbce5(_0x3150df[_0x898a('0xd')]);}})['catch'](function(_0x25d7f2){_0x42021d(_0x25d7f2);});});}function respondWithResult(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xc8;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['status'](_0x364a23)['json'](_0x5f5e06);}return _0x2c76b7[_0x898a('0xe')](0x194);};}function handleError(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0x1f4;return function(_0x116fbe){logger[_0x898a('0xb')](_0x116fbe[_0x898a('0xf')]);if(_0x116fbe['name']){delete _0x116fbe[_0x898a('0x10')];}_0x1f5be4['status'](_0xb24335)[_0x898a('0x11')](_0x116fbe);};}function findById(_0x5c96a6){return function(_0x303321){if(!_['isNil'](_0x5c96a6)&&!_[_0x898a('0x12')](_0x303321)&&!_['isNil'](_0x303321[_0x898a('0x13')])){return _[_0x898a('0x14')](_0x303321[_0x898a('0x13')],function(_0x4ddd4d){return _0x4ddd4d['id']==_0x5c96a6;});}return null;};}exports[_0x898a('0x15')]=function(_0x5960e0,_0x54c8f3){return respondWithRpcPromise(_0x898a('0x16'),_0x5960e0[_0x898a('0x17')])['then'](respondWithResult(_0x54c8f3,null))['catch'](handleError(_0x54c8f3,null));};exports[_0x898a('0x18')]=function(_0x26449a,_0x38a8f0){return respondWithRpcPromise(_0x898a('0x19'),_[_0x898a('0x1a')](_0x26449a[_0x898a('0x17')],_0x26449a[_0x898a('0x1b')]))['then'](respondWithResult(_0x38a8f0,null))[_0x898a('0x1c')](handleError(_0x38a8f0,null));};exports[_0x898a('0x1d')]=function(_0x11cae2,_0x3cfd9c){return respondWithRpcPromise(_0x898a('0x1e'),_[_0x898a('0x1a')](_0x11cae2['query'],_0x11cae2[_0x898a('0x1b')]))[_0x898a('0xa')](respondWithResult(_0x3cfd9c,null))[_0x898a('0x1c')](handleError(_0x3cfd9c,null));};exports[_0x898a('0x1f')]=function(_0x3901ab,_0x1426e3){return respondWithRpcPromise('VoiceQueues',_0x3901ab[_0x898a('0x17')])['then'](respondWithResult(_0x1426e3,null))['catch'](handleError(_0x1426e3,null));};exports['showVoiceQueues']=function(_0x3678be,_0x1f4d86){return respondWithRpcPromise(_0x898a('0x20'),_0x3678be[_0x898a('0x17')])[_0x898a('0xa')](findById(_0x3678be[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x1f4d86,null))[_0x898a('0x1c')](handleError(_0x1f4d86,null));};exports[_0x898a('0x21')]=function(_0x58149d,_0x4b3e68){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x898a('0x1a')](_0x58149d[_0x898a('0x22')],_0x58149d[_0x898a('0x1b')]))[_0x898a('0xa')](respondWithResult(_0x4b3e68,null))[_0x898a('0x1c')](handleError(_0x4b3e68,null));};exports[_0x898a('0x23')]=function(_0xe3c983,_0xf74645){return respondWithRpcPromise(_0x898a('0x24'),_[_0x898a('0x1a')](_0xe3c983[_0x898a('0x17')],_0xe3c983[_0x898a('0x1b')]))['then'](respondWithResult(_0xf74645,null))[_0x898a('0x1c')](handleError(_0xf74645,null));};exports[_0x898a('0x25')]=function(_0x26eead,_0x17a980){return respondWithRpcPromise(_0x898a('0x26'),_0x26eead['query'])['then'](respondWithResult(_0x17a980,null))[_0x898a('0x1c')](handleError(_0x17a980,null));};exports[_0x898a('0x27')]=function(_0x1d6d66,_0x4de9bf){return respondWithRpcPromise(_0x898a('0x28'),_[_0x898a('0x1a')](_0x1d6d66[_0x898a('0x17')],_0x1d6d66[_0x898a('0x1b')]))[_0x898a('0xa')](respondWithResult(_0x4de9bf,null))[_0x898a('0x1c')](handleError(_0x4de9bf,null));};exports[_0x898a('0x29')]=function(_0x146f32,_0x50bb4b){return respondWithRpcPromise(_0x898a('0x2a'),_['merge'](_0x146f32['query'],_0x146f32[_0x898a('0x1b')]))['then'](respondWithResult(_0x50bb4b,null))[_0x898a('0x1c')](handleError(_0x50bb4b,null));};exports['voiceQueuesChannelRedirect']=function(_0x37cb11,_0x4f202c){return respondWithRpcPromise(_0x898a('0x2b'),_[_0x898a('0x1a')](_0x37cb11[_0x898a('0x17')],_0x37cb11['params']))['then'](respondWithResult(_0x4f202c,null))['catch'](handleError(_0x4f202c,null));};exports[_0x898a('0x2c')]=function(_0x429c32,_0x5a228f){return respondWithRpcPromise(_0x898a('0x2d'),_0x429c32[_0x898a('0x17')])[_0x898a('0xa')](respondWithResult(_0x5a228f,null))[_0x898a('0x1c')](handleError(_0x5a228f,null));};exports['outboundChannels']=function(_0x4b07bc,_0x3aed01){return respondWithRpcPromise(_0x898a('0x2e'),_0x4b07bc['query'])['then'](respondWithResult(_0x3aed01,null))[_0x898a('0x1c')](handleError(_0x3aed01,null));};exports[_0x898a('0x2f')]=function(_0x181cc8,_0xa45405){var _0x51681f;return respondWithRpcPromise(_0x898a('0x30'),_0x181cc8[_0x898a('0x17')])['then'](function(_0x516b8c){_0x51681f=_0x516b8c;return respondWithRpcPromise('Agents',_0x181cc8[_0x898a('0x17')],routingClient);})[_0x898a('0xa')](function(_0x35d767){return _[_0x898a('0x1a')]({},_0x35d767,_0x51681f);})[_0x898a('0xa')](respondWithResult(_0xa45405,null))[_0x898a('0x1c')](handleError(_0xa45405,null));};exports[_0x898a('0x31')]=function(_0x1432ec,_0x3292c2){if(_0x1432ec[_0x898a('0x22')]&&_0x1432ec[_0x898a('0x22')][_0x898a('0x32')]&&_0x1432ec[_0x898a('0x33')]&&_0x1432ec[_0x898a('0x33')][_0x898a('0x10')]){for(var _0x4c8628 in _0x1432ec[_0x898a('0x22')][_0x898a('0x32')]){if(_0x1432ec[_0x898a('0x22')]['interaction'][_0x898a('0x34')](_0x4c8628)){db[_0x898a('0x35')][_0x898a('0x36')]({'where':{'channel':_0x4c8628,'membername':_0x1432ec[_0x898a('0x33')][_0x898a('0x10')],'type':_0x898a('0x37'),'exitAt':null,'uniqueid':_0x1432ec[_0x898a('0x22')][_0x898a('0x32')][_0x4c8628]&&_0x1432ec['body'][_0x898a('0x32')][_0x4c8628][_0x898a('0x38')]?{'$notIn':_0x1432ec[_0x898a('0x22')][_0x898a('0x32')][_0x4c8628]}:{'$ne':null}}})['then'](function(_0x3d5fba){var _0x152060=moment()['format'](_0x898a('0x39'));for(var _0x4ce00e=0x0,_0x56a40c=_0x3d5fba['length'];_0x4ce00e<_0x56a40c;_0x4ce00e+=0x1){_0x3d5fba[_0x4ce00e]['updateAttributes']({'exitAt':_0x152060});}});for(var _0x322ecc=0x0;_0x322ecc<_0x1432ec['body'][_0x898a('0x32')][_0x4c8628][_0x898a('0x38')];_0x322ecc+=0x1){db['MemberReport'][_0x898a('0x3a')]({'where':{'channel':_0x4c8628,'membername':_0x1432ec[_0x898a('0x33')]['name'],'type':_0x898a('0x37'),'uniqueid':_0x1432ec[_0x898a('0x22')][_0x898a('0x32')][_0x4c8628][_0x322ecc],'exitAt':null},'defaults':{'channel':_0x4c8628,'membername':_0x1432ec[_0x898a('0x33')]['name'],'interface':_[_0x898a('0x12')](_0x1432ec[_0x898a('0x33')]['interface'])?util[_0x898a('0x3b')](_0x898a('0x3c'),_0x1432ec['user'][_0x898a('0x10')]):_0x1432ec['user'][_0x898a('0x3d')],'type':_0x898a('0x37'),'enterAt':moment()[_0x898a('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x898a('0x3e'),'internal':_0x1432ec[_0x898a('0x33')][_0x898a('0x3f')],'uniqueid':_0x1432ec[_0x898a('0x22')]['interaction'][_0x4c8628][_0x322ecc]}});}}}}return respondWithRpcPromise(_0x898a('0x40'),{'id':_0x1432ec['params']['id'],'capacity':_0x1432ec[_0x898a('0x22')][_0x898a('0x41')]},routingClient)[_0x898a('0xa')](respondWithResult(_0x3292c2,null))['catch'](handleError(_0x3292c2,null));};exports[_0x898a('0x42')]=function(_0x3c4db0,_0x195ac2){return respondWithRpcPromise('Telephones',_0x3c4db0['query'])[_0x898a('0xa')](respondWithResult(_0x195ac2,null))[_0x898a('0x1c')](handleError(_0x195ac2,null));};exports[_0x898a('0x43')]=function(_0x295f1e,_0x28b8c9){return respondWithRpcPromise(_0x898a('0x44'),_0x295f1e[_0x898a('0x17')])[_0x898a('0xa')](respondWithResult(_0x28b8c9,null))[_0x898a('0x1c')](handleError(_0x28b8c9,null));};exports[_0x898a('0x45')]=function(_0x2382a9,_0x5e9329){return respondWithRpcPromise(_0x898a('0x46'),_0x2382a9[_0x898a('0x17')])['then'](respondWithResult(_0x5e9329,null))[_0x898a('0x1c')](handleError(_0x5e9329,null));};exports['chatQueues']=function(_0x54c44b,_0x15f11e){return respondWithRpcPromise(_0x898a('0x47'),_0x54c44b[_0x898a('0x17')],routingClient)['then'](respondWithResult(_0x15f11e,null))['catch'](handleError(_0x15f11e,null));};exports[_0x898a('0x48')]=function(_0x1f5e4b,_0x515725){return respondWithRpcPromise(_0x898a('0x47'),_0x1f5e4b[_0x898a('0x17')],routingClient)['then'](findById(_0x1f5e4b[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x515725,null))[_0x898a('0x1c')](handleError(_0x515725,null));};exports['mailQueues']=function(_0xf29714,_0x2ef2f1){return respondWithRpcPromise(_0x898a('0x49'),_0xf29714[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x2ef2f1,null))[_0x898a('0x1c')](handleError(_0x2ef2f1,null));};exports['showMailQueues']=function(_0x22a08a,_0x4df5f0){return respondWithRpcPromise(_0x898a('0x49'),_0x22a08a[_0x898a('0x17')],routingClient)[_0x898a('0xa')](findById(_0x22a08a[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x4df5f0,null))[_0x898a('0x1c')](handleError(_0x4df5f0,null));};exports[_0x898a('0x4a')]=function(_0x75ff57,_0x3c761c){return respondWithRpcPromise('MailAccounts',_0x75ff57[_0x898a('0x17')],mailClient)[_0x898a('0xa')](respondWithResult(_0x3c761c,null))[_0x898a('0x1c')](handleError(_0x3c761c,null));};exports[_0x898a('0x4b')]=function(_0x219976,_0x2a1345){return respondWithRpcPromise(_0x898a('0x4c'),_0x219976[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x2a1345,null))[_0x898a('0x1c')](handleError(_0x2a1345,null));};exports[_0x898a('0x4d')]=function(_0x217dda,_0x3331c0){return respondWithRpcPromise(_0x898a('0x4c'),_0x217dda[_0x898a('0x17')],routingClient)['then'](findById(_0x217dda[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x3331c0,null))['catch'](handleError(_0x3331c0,null));};exports[_0x898a('0x4e')]=function(_0x4583a1,_0x5f0944){return respondWithRpcPromise(_0x898a('0x4f'),_0x4583a1[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x5f0944,null))[_0x898a('0x1c')](handleError(_0x5f0944,null));};exports['showSmsQueues']=function(_0xdc0cc4,_0x11def5){return respondWithRpcPromise(_0x898a('0x4f'),_0xdc0cc4[_0x898a('0x17')],routingClient)['then'](findById(_0xdc0cc4[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x11def5,null))['catch'](handleError(_0x11def5,null));};exports[_0x898a('0x50')]=function(_0x3c0bf6,_0x5b7019){return respondWithRpcPromise(_0x898a('0x51'),_0x3c0bf6['query'],routingClient)[_0x898a('0xa')](respondWithResult(_0x5b7019,null))['catch'](handleError(_0x5b7019,null));};exports['showWhatsappQueues']=function(_0x5ed35e,_0xfdd6d8){return respondWithRpcPromise(_0x898a('0x51'),_0x5ed35e[_0x898a('0x17')],routingClient)[_0x898a('0xa')](findById(_0x5ed35e['params']['id']))['then'](respondWithResult(_0xfdd6d8,null))[_0x898a('0x1c')](handleError(_0xfdd6d8,null));};exports[_0x898a('0x52')]=function(_0x1c2661,_0x5dc44e){return respondWithRpcPromise(_0x898a('0x53'),_0x1c2661[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x5dc44e,null))[_0x898a('0x1c')](handleError(_0x5dc44e,null));};exports['showFaxQueues']=function(_0xaac6d4,_0x43bf93){return respondWithRpcPromise('FaxQueues',_0xaac6d4[_0x898a('0x17')],routingClient)[_0x898a('0xa')](findById(_0xaac6d4[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x43bf93,null))[_0x898a('0x1c')](handleError(_0x43bf93,null));};exports[_0x898a('0x54')]=function(_0x3bcc3d,_0x2dc61c){return respondWithRpcPromise(_0x898a('0x55'),_0x3bcc3d[_0x898a('0x17')])[_0x898a('0xa')](respondWithResult(_0x2dc61c,null))[_0x898a('0x1c')](handleError(_0x2dc61c,null));};exports[_0x898a('0x56')]=function(_0x4a7705,_0x2d9a9c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4a7705[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x2d9a9c,null))[_0x898a('0x1c')](handleError(_0x2d9a9c,null));};exports['mailQueuesWaitingInteractions']=function(_0x31102d,_0x3f0d9f){return respondWithRpcPromise(_0x898a('0x57'),_0x31102d[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x3f0d9f,null))['catch'](handleError(_0x3f0d9f,null));};exports[_0x898a('0x58')]=function(_0x352ebb,_0x37b1d0){return respondWithRpcPromise(_0x898a('0x59'),_0x352ebb[_0x898a('0x17')],routingClient)['then'](respondWithResult(_0x37b1d0,null))[_0x898a('0x1c')](handleError(_0x37b1d0,null));};exports[_0x898a('0x5a')]=function(_0x474029,_0x37d205){return respondWithRpcPromise(_0x898a('0x59'),_0x474029[_0x898a('0x17')],routingClient)[_0x898a('0xa')](function(_0x1b0c09){if(_0x474029['query'][_0x898a('0x5b')]!==undefined){var _0x4607e1=_(_0x1b0c09['rows'])[_0x898a('0x5c')]([_0x474029['query'][_0x898a('0x5b')],_0x474029['params']['id']])[_0x898a('0x5d')](_0x898a('0x5e'))[_0x898a('0x5f')]()[_0x898a('0x60')]();return _0x1b0c09[_0x898a('0x13')][_0x898a('0x5c')](function(_0x170267){return _0x4607e1[_0x898a('0x61')](_0x170267[_0x898a('0x5e')])>-0x1;});}else{return _0x1b0c09['rows'][_0x898a('0x5c')](function(_0xd627d0){return _0xd627d0[_0x898a('0x5e')]===parseInt(_0x474029[_0x898a('0x1b')]['id']);});}})[_0x898a('0xa')](respondWithResult(_0x37d205,null))[_0x898a('0x1c')](handleError(_0x37d205,null));};exports[_0x898a('0x62')]=function(_0x4bcf85,_0x380f8c){return respondWithRpcPromise(_0x898a('0x63'),_0x4bcf85['query'],routingClient)['then'](respondWithResult(_0x380f8c,null))[_0x898a('0x1c')](handleError(_0x380f8c,null));};exports[_0x898a('0x64')]=function(_0x48e9c2,_0x5710a0){return respondWithRpcPromise(_0x898a('0x65'),_0x48e9c2['query'],routingClient)[_0x898a('0xa')](respondWithResult(_0x5710a0,null))[_0x898a('0x1c')](handleError(_0x5710a0,null));};exports['faxQueuesWaitingInteractions']=function(_0x3f6815,_0x1c782e){return respondWithRpcPromise(_0x898a('0x66'),_0x3f6815[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x1c782e,null))[_0x898a('0x1c')](handleError(_0x1c782e,null));};exports[_0x898a('0x67')]=function(_0x49f8ac){return function(_0x3237e8,_0x1efe1e){var _0x37ee4d,_0x50d978;var _0x27560f=_[_0x898a('0x68')](_0x49f8ac);var _0x5c6247=_0x49f8ac===_0x898a('0x69')?'Website':'Account';return db[_0x27560f+'Queue'][_0x898a('0x6a')]({'raw':!![],'where':{'id':_0x3237e8[_0x898a('0x1b')]['id']}})[_0x898a('0xa')](function(_0x2079d0){if(_[_0x898a('0x12')](_0x2079d0)){throw new Error(_0x27560f+_0x898a('0x6b'));}_0x37ee4d=_0x2079d0;return db[_0x27560f+_0x898a('0x6c')]['findOne']({'where':{'id':_0x3237e8[_0x898a('0x22')]['messageId']},'include':[{'model':db[_0x27560f+_0x898a('0x6d')],'as':_0x898a('0x6d')},{'model':db[_0x27560f+_0x5c6247],'as':'Account'}]});})[_0x898a('0xa')](function(_0x2269fb){if(_[_0x898a('0x12')](_0x2269fb)){throw new Error(_0x27560f+_0x898a('0x6e'));}_0x50d978=_0x2269fb;return _0x2269fb[_0x898a('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5847cb={'uniqueid':_0x49f8ac+'.'+_0x50d978['id']+'.'+_0x50d978['Interaction']['id'],'FromUserId':_0x3237e8[_0x898a('0x33')]['id'],'type':_0x898a('0x70')};_0x5847cb[_0x27560f+_0x898a('0x71')]=_0x50d978['id'];_0x5847cb[_0x27560f+'InteractionId']=_0x50d978[_0x898a('0x6d')]['id'];_0x5847cb['From'+_0x27560f+_0x5c6247+'Id']=_0x50d978['Account']['id'];_0x5847cb['To'+_0x27560f+_0x898a('0x72')]=_0x37ee4d['id'];return db[_0x27560f+_0x898a('0x73')][_0x898a('0x74')](_0x5847cb);})[_0x898a('0xa')](function(){return respondWithRpcPromise(_0x898a('0x75'),{'channel':_0x49f8ac,'interaction':_0x50d978[_0x898a('0x6d')],'message':_0x50d978,'account':_0x50d978[_0x898a('0x76')],'applications':[{'id':0x0,'priority':0x1,'app':_0x898a('0x70'),'appdata':_0x37ee4d[_0x898a('0x10')]+','+(_0x50d978[_0x898a('0x76')][_0x898a('0x77')]||0x12c),'interval':_0x898a('0x78')}]},routingClient);})[_0x898a('0xa')](respondWithResult(_0x1efe1e,null))[_0x898a('0x1c')](handleError(_0x1efe1e,null));};};exports[_0x898a('0x79')]=function(_0x3d9634,_0x54c440){var _0x435689,_0x3eaf3e;if(_[_0x898a('0x12')](_0x3d9634[_0x898a('0x22')][_0x898a('0x7a')])){throw new Error(_0x898a('0x7b'));}var _0xd45b78=_0x3d9634[_0x898a('0x22')][_0x898a('0x7a')];var _0x427eff=_[_0x898a('0x68')](_0xd45b78);var _0x381071=_0xd45b78==='chat'?_0x898a('0x7c'):'Account';return db[_0x898a('0x7d')][_0x898a('0x6a')]({'raw':!![],'where':{'id':_0x3d9634[_0x898a('0x1b')]['id'],'role':'agent'}})[_0x898a('0xa')](function(_0x223775){if(_['isNil'](_0x223775)){throw new Error(_0x898a('0x7e'));}_0x435689=_0x223775;return db[_0x427eff+_0x898a('0x6c')][_0x898a('0x6a')]({'where':{'id':_0x3d9634[_0x898a('0x22')][_0x898a('0x7f')]},'include':[{'model':db[_0x427eff+_0x898a('0x6d')],'as':'Interaction'},{'model':db[_0x427eff+_0x381071],'as':'Account'}]});})[_0x898a('0xa')](function(_0x4b7334){if(_[_0x898a('0x12')](_0x4b7334)){throw new Error(_0x427eff+_0x898a('0x6e'));}_0x3eaf3e=_0x4b7334;return _0x4b7334[_0x898a('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x898a('0xa')](function(){var _0x13b3f9={'uniqueid':_0xd45b78+'.'+_0x3eaf3e['id']+'.'+_0x3eaf3e[_0x898a('0x6d')]['id'],'FromUserId':_0x3d9634['user']['id'],'type':'queue','ToUserId':_0x435689['id']};_0x13b3f9[_0x427eff+_0x898a('0x71')]=_0x3eaf3e['id'];_0x13b3f9[_0x427eff+'InteractionId']=_0x3eaf3e[_0x898a('0x6d')]['id'];_0x13b3f9[_0x898a('0x80')+_0x427eff+_0x381071+'Id']=_0x3eaf3e['Account']['id'];return db[_0x427eff+_0x898a('0x73')]['create'](_0x13b3f9);})[_0x898a('0xa')](function(){return respondWithRpcPromise(_0x898a('0x75'),{'channel':_0xd45b78,'interaction':_0x3eaf3e[_0x898a('0x6d')],'message':_0x3eaf3e,'account':_0x3eaf3e['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x435689['name']+','+(_0x3eaf3e[_0x898a('0x76')][_0x898a('0x81')]||0x12c),'interval':_0x898a('0x78')}]},routingClient);})[_0x898a('0xa')](respondWithResult(_0x54c440,null))[_0x898a('0x1c')](handleError(_0x54c440,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 7748d3c..5f13213 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 _0x5dbe=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','show','/:id/run','isAuthenticated','run','post','create','put','/:id','destroy','multer','util','path'];(function(_0x252387,_0x2d3eb9){var _0x57aceb=function(_0xdde5ee){while(--_0xdde5ee){_0x252387['push'](_0x252387['shift']());}};_0x57aceb(++_0x2d3eb9);}(_0x5dbe,0x166));var _0xe5db=function(_0xc864d,_0x3443f2){_0xc864d=_0xc864d-0x0;var _0x4a1305=_0x5dbe[_0xc864d];return _0x4a1305;};'use strict';var multer=require(_0xe5db('0x0'));var util=require(_0xe5db('0x1'));var path=require(_0xe5db('0x2'));var timeout=require('connect-timeout');var express=require(_0xe5db('0x3'));var router=express['Router']();var fs_extra=require(_0xe5db('0x4'));var auth=require(_0xe5db('0x5'));var interaction=require(_0xe5db('0x6'));var config=require(_0xe5db('0x7'));var controller=require(_0xe5db('0x8'));router[_0xe5db('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe5db('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe5db('0xa')]);router[_0xe5db('0x9')](_0xe5db('0xb'),auth[_0xe5db('0xc')](),controller[_0xe5db('0xd')]);router[_0xe5db('0xe')]('/',auth[_0xe5db('0xc')](),controller[_0xe5db('0xf')]);router[_0xe5db('0x10')](_0xe5db('0x11'),auth[_0xe5db('0xc')](),controller['update']);router['delete']('/:id',auth[_0xe5db('0xc')](),controller[_0xe5db('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9651=['put','/:id','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','/:id/run','run','post','create'];(function(_0x277760,_0x481ca3){var _0x33544c=function(_0x4eb296){while(--_0x4eb296){_0x277760['push'](_0x277760['shift']());}};_0x33544c(++_0x481ca3);}(_0x9651,0x1b4));var _0x1965=function(_0x53530f,_0x2774de){_0x53530f=_0x53530f-0x0;var _0x595249=_0x9651[_0x53530f];return _0x595249;};'use strict';var multer=require('multer');var util=require(_0x1965('0x0'));var path=require(_0x1965('0x1'));var timeout=require(_0x1965('0x2'));var express=require('express');var router=express[_0x1965('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1965('0x4'));var interaction=require(_0x1965('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x1965('0x6')]('/',auth['isAuthenticated'](),controller[_0x1965('0x7')]);router[_0x1965('0x6')]('/:id',auth[_0x1965('0x8')](),controller[_0x1965('0x9')]);router[_0x1965('0x6')](_0x1965('0xa'),auth[_0x1965('0x8')](),controller[_0x1965('0xb')]);router[_0x1965('0xc')]('/',auth['isAuthenticated'](),controller[_0x1965('0xd')]);router[_0x1965('0xe')](_0x1965('0xf'),auth[_0x1965('0x8')](),controller['update']);router[_0x1965('0x10')]('/:id',auth[_0x1965('0x8')](),controller[_0x1965('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 1ce5cf0..6b89465 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 _0xcc4e=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','hours','days','xlsx','custom','default','TEXT'];(function(_0xafb7ab,_0x4ce28e){var _0x24e9b0=function(_0x442737){while(--_0x442737){_0xafb7ab['push'](_0xafb7ab['shift']());}};_0x24e9b0(++_0x4ce28e);}(_0xcc4e,0x177));var _0xecc4=function(_0x33e960,_0x100fe7){_0x33e960=_0x33e960-0x0;var _0x5225f0=_0xcc4e[_0x33e960];return _0x5225f0;};'use strict';var Sequelize=require('sequelize');module[_0xecc4('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xecc4('0x1')]},'active':{'type':Sequelize[_0xecc4('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xecc4('0x1')],'allowNull':![],'defaultValue':_0xecc4('0x3')},'startAt':{'type':Sequelize[_0xecc4('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xecc4('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xecc4('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xecc4('0x6')](_0xecc4('0x7'),_0xecc4('0x8'),'months','weeks','days',_0xecc4('0x9'),'minutes'),'allowNull':![],'defaultValue':_0xecc4('0xa')},'output':{'type':Sequelize[_0xecc4('0x6')]('csv','pdf',_0xecc4('0xb')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xecc4('0x6')](_0xecc4('0xc'),_0xecc4('0xd')),'allowNull':![],'defaultValue':_0xecc4('0xc')},'sendMail':{'type':Sequelize[_0xecc4('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xecc4('0x1')]},'cc':{'type':Sequelize[_0xecc4('0xe')]},'bcc':{'type':Sequelize[_0xecc4('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xecc4('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe3ae=['0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters','months','weeks','days','hours','minutes','ENUM','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xe3ae,0x1a5));var _0xee3a=function(_0x56c055,_0x352ca8){_0x56c055=_0x56c055-0x0;var _0x7b1c39=_0xe3ae[_0x56c055];return _0x7b1c39;};'use strict';var Sequelize=require(_0xee3a('0x0'));module[_0xee3a('0x1')]={'name':{'type':Sequelize[_0xee3a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xee3a('0x2')]},'active':{'type':Sequelize[_0xee3a('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xee3a('0x4')},'startAt':{'type':Sequelize[_0xee3a('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xee3a('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xee3a('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xee3a('0x7'),_0xee3a('0x8'),_0xee3a('0x9'),_0xee3a('0xa'),_0xee3a('0xb'),_0xee3a('0xc')),'allowNull':![],'defaultValue':_0xee3a('0xa')},'output':{'type':Sequelize[_0xee3a('0xd')]('csv','pdf',_0xee3a('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xee3a('0xd')]('custom','default'),'allowNull':![],'defaultValue':_0xee3a('0xf')},'sendMail':{'type':Sequelize[_0xee3a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xee3a('0x2')]},'cc':{'type':Sequelize[_0xee3a('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xee3a('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 7834dda..dbe8a17 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 _0xb500=['error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','undefined','offset','count','limit','set','apply','save','then','destroy','Scheduler','UserProfileResource'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xb500,0x86));var _0x0b50=function(_0x6ea106,_0x181b3d){_0x6ea106=_0x6ea106-0x0;var _0x49ecfe=_0xb500[_0x6ea106];return _0x49ecfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b50('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b50('0x1'));var rp=require(_0x0b50('0x2'));var moment=require(_0x0b50('0x3'));var BPromise=require(_0x0b50('0x4'));var Mustache=require('mustache');var util=require(_0x0b50('0x5'));var path=require(_0x0b50('0x6'));var sox=require(_0x0b50('0x7'));var csv=require(_0x0b50('0x8'));var ejs=require(_0x0b50('0x9'));var fs=require('fs');var fs_extra=require(_0x0b50('0xa'));var _=require(_0x0b50('0xb'));var squel=require(_0x0b50('0xc'));var crypto=require(_0x0b50('0xd'));var jsforce=require(_0x0b50('0xe'));var deskjs=require(_0x0b50('0xf'));var toCsv=require(_0x0b50('0x8'));var querystring=require(_0x0b50('0x10'));var Papa=require('papaparse');var Redis=require(_0x0b50('0x11'));var authService=require(_0x0b50('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b50('0x13'));var hardwareService=require(_0x0b50('0x14'));var logger=require(_0x0b50('0x15'))(_0x0b50('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0b50('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28254e,_0x2276d7){_0x2276d7=_0x2276d7||0xcc;return function(_0x30e615){if(_0x30e615){return _0x28254e[_0x0b50('0x18')](_0x2276d7);}return _0x28254e[_0x0b50('0x19')](_0x2276d7)['end']();};}function respondWithResult(_0x336b30,_0x482ff4){_0x482ff4=_0x482ff4||0xc8;return function(_0x31b29f){if(_0x31b29f){return _0x336b30[_0x0b50('0x19')](_0x482ff4)[_0x0b50('0x1a')](_0x31b29f);}};}function respondWithFilteredResult(_0x55d77f,_0x2f4f7a){return function(_0x4ff5dd){if(_0x4ff5dd){var _0x46fa67=typeof _0x2f4f7a['offset']===_0x0b50('0x1b')&&typeof _0x2f4f7a['limit']==='undefined';var _0x4cda73=_0x4ff5dd['count'];var _0x2c2075=_0x46fa67?0x0:_0x2f4f7a[_0x0b50('0x1c')];var _0x2ede24=_0x46fa67?_0x4ff5dd[_0x0b50('0x1d')]:_0x2f4f7a['offset']+_0x2f4f7a[_0x0b50('0x1e')];var _0x3b7279;if(_0x2ede24>=_0x4cda73){_0x2ede24=_0x4cda73;_0x3b7279=0xc8;}else{_0x3b7279=0xce;}_0x55d77f[_0x0b50('0x19')](_0x3b7279);return _0x55d77f[_0x0b50('0x1f')]('Content-Range',_0x2c2075+'-'+_0x2ede24+'/'+_0x4cda73)[_0x0b50('0x1a')](_0x4ff5dd);}return null;};}function patchUpdates(_0x5bf517){return function(_0x1a2254){try{jsonpatch[_0x0b50('0x20')](_0x1a2254,_0x5bf517,!![]);}catch(_0xfba45d){return BPromise['reject'](_0xfba45d);}return _0x1a2254[_0x0b50('0x21')]();};}function saveUpdates(_0x4d616f,_0x2e40d3){return function(_0xc25fb3){if(_0xc25fb3){return _0xc25fb3['update'](_0x4d616f)[_0x0b50('0x22')](function(_0x482770){return _0x482770;});}return null;};}function removeEntity(_0x1721a1,_0x311e62){return function(_0x5fc14a){if(_0x5fc14a){return _0x5fc14a[_0x0b50('0x23')]()[_0x0b50('0x22')](function(){var _0x126d0b=_0x5fc14a['get']({'plain':!![]});var _0x378a3c=_0x0b50('0x24');return db[_0x0b50('0x25')]['destroy']({'where':{'type':_0x378a3c,'resourceId':_0x126d0b['id']}})[_0x0b50('0x22')](function(){return _0x5fc14a;});})['then'](function(){_0x1721a1[_0x0b50('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d2592,_0x544465){return function(_0xe017a4){if(!_0xe017a4){_0x4d2592['sendStatus'](0x194);}return _0xe017a4;};}function handleError(_0x273e2a,_0x3153f7){_0x3153f7=_0x3153f7||0x1f4;return function(_0x611cbe){logger[_0x0b50('0x26')](_0x611cbe[_0x0b50('0x27')]);if(_0x611cbe[_0x0b50('0x28')]){delete _0x611cbe[_0x0b50('0x28')];}_0x273e2a['status'](_0x3153f7)['send'](_0x611cbe);};}exports[_0x0b50('0x29')]=function(_0x51db72,_0x27e473){var _0x5d1d41={},_0x16077c={},_0x5acab3={'count':0x0,'rows':[]};var _0xb53635=_[_0x0b50('0x2a')](db[_0x0b50('0x2b')][_0x0b50('0x2c')],function(_0x32b044){return{'name':_0x32b044[_0x0b50('0x2d')],'type':_0x32b044[_0x0b50('0x2e')][_0x0b50('0x2f')]};});_0x16077c['model']=_['map'](_0xb53635,_0x0b50('0x28'));_0x16077c[_0x0b50('0x30')]=_[_0x0b50('0x31')](_0x51db72['query']);_0x16077c[_0x0b50('0x32')]=_['intersection'](_0x16077c[_0x0b50('0x33')],_0x16077c['query']);_0x5d1d41[_0x0b50('0x34')]=_['intersection'](_0x16077c[_0x0b50('0x33')],qs[_0x0b50('0x35')](_0x51db72[_0x0b50('0x30')][_0x0b50('0x35')]));_0x5d1d41[_0x0b50('0x34')]=_0x5d1d41[_0x0b50('0x34')][_0x0b50('0x36')]?_0x5d1d41['attributes']:_0x16077c[_0x0b50('0x33')];if(!_0x51db72['query'][_0x0b50('0x37')](_0x0b50('0x38'))){_0x5d1d41[_0x0b50('0x1e')]=qs[_0x0b50('0x1e')](_0x51db72[_0x0b50('0x30')]['limit']);_0x5d1d41[_0x0b50('0x1c')]=qs[_0x0b50('0x1c')](_0x51db72[_0x0b50('0x30')][_0x0b50('0x1c')]);}_0x5d1d41[_0x0b50('0x39')]=qs[_0x0b50('0x3a')](_0x51db72[_0x0b50('0x30')][_0x0b50('0x3a')]);_0x5d1d41[_0x0b50('0x3b')]=qs['filters'](_[_0x0b50('0x3c')](_0x51db72[_0x0b50('0x30')],_0x16077c[_0x0b50('0x32')]),_0xb53635);if(_0x51db72[_0x0b50('0x30')][_0x0b50('0x3d')]){_0x5d1d41[_0x0b50('0x3b')]=_[_0x0b50('0x3e')](_0x5d1d41[_0x0b50('0x3b')],{'$or':_[_0x0b50('0x2a')](_0xb53635,function(_0x5550aa){if(_0x5550aa[_0x0b50('0x2e')]!==_0x0b50('0x3f')){var _0x3cda28={};_0x3cda28[_0x5550aa[_0x0b50('0x28')]]={'$like':'%'+_0x51db72[_0x0b50('0x30')][_0x0b50('0x3d')]+'%'};return _0x3cda28;}})});}_0x5d1d41=_[_0x0b50('0x3e')]({},_0x5d1d41,_0x51db72[_0x0b50('0x40')]);var _0x36e9fd={'where':_0x5d1d41['where']};return db['Schedule']['count'](_0x36e9fd)[_0x0b50('0x22')](function(_0x45b7f7){_0x5acab3[_0x0b50('0x1d')]=_0x45b7f7;if(_0x51db72[_0x0b50('0x30')][_0x0b50('0x41')]){_0x5d1d41[_0x0b50('0x42')]=[{'all':!![]}];}return db[_0x0b50('0x2b')][_0x0b50('0x43')](_0x5d1d41);})[_0x0b50('0x22')](function(_0x5cd647){_0x5acab3[_0x0b50('0x44')]=_0x5cd647;return _0x5acab3;})['then'](respondWithFilteredResult(_0x27e473,_0x5d1d41))[_0x0b50('0x45')](handleError(_0x27e473,null));};exports[_0x0b50('0x46')]=function(_0x246175,_0x401b4f){var _0x3074d6={'raw':![],'where':{'id':_0x246175[_0x0b50('0x47')]['id']}},_0x179ec7={};_0x179ec7[_0x0b50('0x33')]=_[_0x0b50('0x31')](db[_0x0b50('0x2b')]['rawAttributes']);_0x179ec7['query']=_[_0x0b50('0x31')](_0x246175['query']);_0x179ec7[_0x0b50('0x32')]=_[_0x0b50('0x48')](_0x179ec7[_0x0b50('0x33')],_0x179ec7['query']);_0x3074d6['attributes']=_[_0x0b50('0x48')](_0x179ec7[_0x0b50('0x33')],qs[_0x0b50('0x35')](_0x246175[_0x0b50('0x30')][_0x0b50('0x35')]));_0x3074d6[_0x0b50('0x34')]=_0x3074d6['attributes'][_0x0b50('0x36')]?_0x3074d6[_0x0b50('0x34')]:_0x179ec7[_0x0b50('0x33')];if(_0x246175[_0x0b50('0x30')][_0x0b50('0x41')]){_0x3074d6[_0x0b50('0x42')]=[{'all':!![]}];}_0x3074d6=_[_0x0b50('0x3e')]({},_0x3074d6,_0x246175[_0x0b50('0x40')]);return db['Schedule']['find'](_0x3074d6)['then'](handleEntityNotFound(_0x401b4f,null))[_0x0b50('0x22')](respondWithResult(_0x401b4f,null))[_0x0b50('0x45')](handleError(_0x401b4f,null));};exports['create']=function(_0x17c020,_0x1d38bd){return db[_0x0b50('0x2b')][_0x0b50('0x49')](_0x17c020[_0x0b50('0x4a')],{})[_0x0b50('0x22')](function(_0x4761ed){var _0x50fa30=_0x17c020[_0x0b50('0x4b')][_0x0b50('0x4c')]({'plain':!![]});if(!_0x50fa30)throw new Error(_0x0b50('0x4d'));if(_0x50fa30[_0x0b50('0x4e')]===_0x0b50('0x4b')){var _0x251e35=_0x4761ed['get']({'plain':!![]});var _0x186ca7='Scheduler';return db['UserProfileSection'][_0x0b50('0x4f')]({'where':{'name':_0x186ca7,'userProfileId':_0x50fa30[_0x0b50('0x50')]},'raw':!![]})[_0x0b50('0x22')](function(_0x29e00b){if(_0x29e00b&&_0x29e00b[_0x0b50('0x51')]===0x0){return db[_0x0b50('0x25')][_0x0b50('0x49')]({'name':_0x251e35[_0x0b50('0x28')],'resourceId':_0x251e35['id'],'type':_0x29e00b[_0x0b50('0x28')],'sectionId':_0x29e00b['id']},{})[_0x0b50('0x22')](function(){return _0x4761ed;});}else{return _0x4761ed;}})['catch'](function(_0x5f058e){logger[_0x0b50('0x26')](_0x0b50('0x52'),_0x5f058e);throw _0x5f058e;});}return _0x4761ed;})['then'](respondWithResult(_0x1d38bd,0xc9))[_0x0b50('0x45')](handleError(_0x1d38bd,null));};exports[_0x0b50('0x53')]=function(_0x165446,_0x5534a){if(_0x165446['body']['id']){delete _0x165446[_0x0b50('0x4a')]['id'];}return db[_0x0b50('0x2b')][_0x0b50('0x4f')]({'where':{'id':_0x165446[_0x0b50('0x47')]['id']}})['then'](handleEntityNotFound(_0x5534a,null))['then'](saveUpdates(_0x165446[_0x0b50('0x4a')],null))[_0x0b50('0x22')](respondWithResult(_0x5534a,null))[_0x0b50('0x45')](handleError(_0x5534a,null));};exports[_0x0b50('0x23')]=function(_0x660519,_0xbb81e6){return db['Schedule']['find']({'where':{'id':_0x660519[_0x0b50('0x47')]['id']}})[_0x0b50('0x22')](handleEntityNotFound(_0xbb81e6,null))[_0x0b50('0x22')](removeEntity(_0xbb81e6,null))[_0x0b50('0x45')](handleError(_0xbb81e6,null));};exports[_0x0b50('0x54')]=function(_0xc57e88,_0x3cdd8e,_0x11ab44){var _0x39fc64=require(_0x0b50('0x55'));return db['Schedule'][_0x0b50('0x4f')]({'where':{'id':_0xc57e88[_0x0b50('0x47')]['id']},'raw':!![]})[_0x0b50('0x22')](handleEntityNotFound(_0x3cdd8e,null))[_0x0b50('0x22')](function(){_0x39fc64[_0x0b50('0x54')](_0xc57e88['params']['id']);})[_0x0b50('0x22')](respondWithStatusCode(_0x3cdd8e,null))['catch'](handleError(_0x3cdd8e,null));}; \ No newline at end of file +var _0x2494=['run','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','options','Schedule','includeAll','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x29de04,_0x311161){var _0x93a60e=function(_0x36aa5b){while(--_0x36aa5b){_0x29de04['push'](_0x29de04['shift']());}};_0x93a60e(++_0x311161);}(_0x2494,0xa1));var _0x4249=function(_0x12a563,_0x463166){_0x12a563=_0x12a563-0x0;var _0xb30870=_0x2494[_0x12a563];return _0xb30870;};'use strict';var emlformat=require(_0x4249('0x0'));var rimraf=require(_0x4249('0x1'));var zipdir=require(_0x4249('0x2'));var jsonpatch=require(_0x4249('0x3'));var rp=require('request-promise');var moment=require(_0x4249('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4249('0x5'));var util=require(_0x4249('0x6'));var path=require('path');var sox=require(_0x4249('0x7'));var csv=require(_0x4249('0x8'));var ejs=require(_0x4249('0x9'));var fs=require('fs');var fs_extra=require(_0x4249('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4249('0x8'));var querystring=require(_0x4249('0xb'));var Papa=require(_0x4249('0xc'));var Redis=require(_0x4249('0xd'));var authService=require(_0x4249('0xe'));var qs=require(_0x4249('0xf'));var as=require(_0x4249('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4249('0x11'));var utils=require(_0x4249('0x12'));var config=require(_0x4249('0x13'));var licenseUtil=require(_0x4249('0x14'));var db=require(_0x4249('0x15'))['db'];function respondWithStatusCode(_0xc8a1d8,_0x116e06){_0x116e06=_0x116e06||0xcc;return function(_0x280230){if(_0x280230){return _0xc8a1d8[_0x4249('0x16')](_0x116e06);}return _0xc8a1d8['status'](_0x116e06)[_0x4249('0x17')]();};}function respondWithResult(_0x21957f,_0x237237){_0x237237=_0x237237||0xc8;return function(_0x4fa618){if(_0x4fa618){return _0x21957f[_0x4249('0x18')](_0x237237)[_0x4249('0x19')](_0x4fa618);}};}function respondWithFilteredResult(_0x3f316f,_0x4850ef){return function(_0x324b2b){if(_0x324b2b){var _0x1b7c86=typeof _0x4850ef[_0x4249('0x1a')]==='undefined'&&typeof _0x4850ef[_0x4249('0x1b')]===_0x4249('0x1c');var _0x43b04e=_0x324b2b['count'];var _0x43366c=_0x1b7c86?0x0:_0x4850ef[_0x4249('0x1a')];var _0x5e43e7=_0x1b7c86?_0x324b2b[_0x4249('0x1d')]:_0x4850ef[_0x4249('0x1a')]+_0x4850ef[_0x4249('0x1b')];var _0x3b43bb;if(_0x5e43e7>=_0x43b04e){_0x5e43e7=_0x43b04e;_0x3b43bb=0xc8;}else{_0x3b43bb=0xce;}_0x3f316f[_0x4249('0x18')](_0x3b43bb);return _0x3f316f[_0x4249('0x1e')](_0x4249('0x1f'),_0x43366c+'-'+_0x5e43e7+'/'+_0x43b04e)[_0x4249('0x19')](_0x324b2b);}return null;};}function patchUpdates(_0x4ec8bd){return function(_0x39a564){try{jsonpatch['apply'](_0x39a564,_0x4ec8bd,!![]);}catch(_0x24f585){return BPromise[_0x4249('0x20')](_0x24f585);}return _0x39a564['save']();};}function saveUpdates(_0x5ad289,_0x30e46c){return function(_0x18d6a3){if(_0x18d6a3){return _0x18d6a3[_0x4249('0x21')](_0x5ad289)[_0x4249('0x22')](function(_0x147c9f){return _0x147c9f;});}return null;};}function removeEntity(_0xc4e892,_0x5dbcf7){return function(_0x5c28e4){if(_0x5c28e4){return _0x5c28e4[_0x4249('0x23')]()[_0x4249('0x22')](function(){var _0x3cda82=_0x5c28e4[_0x4249('0x24')]({'plain':!![]});var _0x5690d4=_0x4249('0x25');return db[_0x4249('0x26')][_0x4249('0x23')]({'where':{'type':_0x5690d4,'resourceId':_0x3cda82['id']}})[_0x4249('0x22')](function(){return _0x5c28e4;});})[_0x4249('0x22')](function(){_0xc4e892['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2973b9,_0x8e68fb){return function(_0x3d033f){if(!_0x3d033f){_0x2973b9[_0x4249('0x16')](0x194);}return _0x3d033f;};}function handleError(_0x2cd00e,_0x4fb7d4){_0x4fb7d4=_0x4fb7d4||0x1f4;return function(_0x1231ba){logger[_0x4249('0x27')](_0x1231ba[_0x4249('0x28')]);if(_0x1231ba['name']){delete _0x1231ba[_0x4249('0x29')];}_0x2cd00e[_0x4249('0x18')](_0x4fb7d4)[_0x4249('0x2a')](_0x1231ba);};}exports['index']=function(_0x208c5d,_0x13cf5e){var _0x219b68={},_0x128d09={},_0x335448={'count':0x0,'rows':[]};var _0x389351=_['map'](db['Schedule'][_0x4249('0x2b')],function(_0x55b65b){return{'name':_0x55b65b[_0x4249('0x2c')],'type':_0x55b65b[_0x4249('0x2d')][_0x4249('0x2e')]};});_0x128d09[_0x4249('0x2f')]=_['map'](_0x389351,_0x4249('0x29'));_0x128d09[_0x4249('0x30')]=_[_0x4249('0x31')](_0x208c5d[_0x4249('0x30')]);_0x128d09[_0x4249('0x32')]=_['intersection'](_0x128d09['model'],_0x128d09[_0x4249('0x30')]);_0x219b68[_0x4249('0x33')]=_[_0x4249('0x34')](_0x128d09[_0x4249('0x2f')],qs[_0x4249('0x35')](_0x208c5d['query'][_0x4249('0x35')]));_0x219b68[_0x4249('0x33')]=_0x219b68[_0x4249('0x33')]['length']?_0x219b68[_0x4249('0x33')]:_0x128d09['model'];if(!_0x208c5d[_0x4249('0x30')][_0x4249('0x36')]('nolimit')){_0x219b68[_0x4249('0x1b')]=qs['limit'](_0x208c5d[_0x4249('0x30')][_0x4249('0x1b')]);_0x219b68[_0x4249('0x1a')]=qs[_0x4249('0x1a')](_0x208c5d[_0x4249('0x30')][_0x4249('0x1a')]);}_0x219b68[_0x4249('0x37')]=qs['sort'](_0x208c5d[_0x4249('0x30')][_0x4249('0x38')]);_0x219b68['where']=qs[_0x4249('0x32')](_['pick'](_0x208c5d['query'],_0x128d09[_0x4249('0x32')]),_0x389351);if(_0x208c5d[_0x4249('0x30')]['filter']){_0x219b68[_0x4249('0x39')]=_[_0x4249('0x3a')](_0x219b68[_0x4249('0x39')],{'$or':_[_0x4249('0x3b')](_0x389351,function(_0x128683){if(_0x128683[_0x4249('0x2d')]!==_0x4249('0x3c')){var _0x3b3d55={};_0x3b3d55[_0x128683[_0x4249('0x29')]]={'$like':'%'+_0x208c5d[_0x4249('0x30')]['filter']+'%'};return _0x3b3d55;}})});}_0x219b68=_[_0x4249('0x3a')]({},_0x219b68,_0x208c5d[_0x4249('0x3d')]);var _0x202999={'where':_0x219b68[_0x4249('0x39')]};return db[_0x4249('0x3e')][_0x4249('0x1d')](_0x202999)[_0x4249('0x22')](function(_0x44a3dc){_0x335448[_0x4249('0x1d')]=_0x44a3dc;if(_0x208c5d[_0x4249('0x30')][_0x4249('0x3f')]){_0x219b68['include']=[{'all':!![]}];}return db[_0x4249('0x3e')][_0x4249('0x40')](_0x219b68);})[_0x4249('0x22')](function(_0x14faee){_0x335448[_0x4249('0x41')]=_0x14faee;return _0x335448;})[_0x4249('0x22')](respondWithFilteredResult(_0x13cf5e,_0x219b68))[_0x4249('0x42')](handleError(_0x13cf5e,null));};exports[_0x4249('0x43')]=function(_0xb015bc,_0x3d177b){var _0x125204={'raw':![],'where':{'id':_0xb015bc[_0x4249('0x44')]['id']}},_0x5f3653={};_0x5f3653[_0x4249('0x2f')]=_[_0x4249('0x31')](db[_0x4249('0x3e')][_0x4249('0x2b')]);_0x5f3653[_0x4249('0x30')]=_[_0x4249('0x31')](_0xb015bc['query']);_0x5f3653[_0x4249('0x32')]=_[_0x4249('0x34')](_0x5f3653[_0x4249('0x2f')],_0x5f3653['query']);_0x125204[_0x4249('0x33')]=_[_0x4249('0x34')](_0x5f3653['model'],qs[_0x4249('0x35')](_0xb015bc[_0x4249('0x30')][_0x4249('0x35')]));_0x125204['attributes']=_0x125204['attributes'][_0x4249('0x45')]?_0x125204[_0x4249('0x33')]:_0x5f3653[_0x4249('0x2f')];if(_0xb015bc[_0x4249('0x30')][_0x4249('0x3f')]){_0x125204['include']=[{'all':!![]}];}_0x125204=_[_0x4249('0x3a')]({},_0x125204,_0xb015bc['options']);return db[_0x4249('0x3e')][_0x4249('0x46')](_0x125204)['then'](handleEntityNotFound(_0x3d177b,null))[_0x4249('0x22')](respondWithResult(_0x3d177b,null))['catch'](handleError(_0x3d177b,null));};exports[_0x4249('0x47')]=function(_0x54e983,_0x30b9a6){return db[_0x4249('0x3e')][_0x4249('0x47')](_0x54e983[_0x4249('0x48')],{})[_0x4249('0x22')](function(_0x2bdfd3){var _0x244bdc=_0x54e983[_0x4249('0x49')]['get']({'plain':!![]});if(!_0x244bdc)throw new Error(_0x4249('0x4a'));if(_0x244bdc['role']===_0x4249('0x49')){var _0x441217=_0x2bdfd3['get']({'plain':!![]});var _0x1193cf=_0x4249('0x25');return db[_0x4249('0x4b')][_0x4249('0x46')]({'where':{'name':_0x1193cf,'userProfileId':_0x244bdc[_0x4249('0x4c')]},'raw':!![]})[_0x4249('0x22')](function(_0x148848){if(_0x148848&&_0x148848[_0x4249('0x4d')]===0x0){return db[_0x4249('0x26')][_0x4249('0x47')]({'name':_0x441217['name'],'resourceId':_0x441217['id'],'type':_0x148848['name'],'sectionId':_0x148848['id']},{})[_0x4249('0x22')](function(){return _0x2bdfd3;});}else{return _0x2bdfd3;}})['catch'](function(_0x512b38){logger[_0x4249('0x27')](_0x4249('0x4e'),_0x512b38);throw _0x512b38;});}return _0x2bdfd3;})['then'](respondWithResult(_0x30b9a6,0xc9))[_0x4249('0x42')](handleError(_0x30b9a6,null));};exports[_0x4249('0x21')]=function(_0x451adb,_0x63c798){if(_0x451adb[_0x4249('0x48')]['id']){delete _0x451adb['body']['id'];}return db[_0x4249('0x3e')][_0x4249('0x46')]({'where':{'id':_0x451adb[_0x4249('0x44')]['id']}})['then'](handleEntityNotFound(_0x63c798,null))[_0x4249('0x22')](saveUpdates(_0x451adb['body'],null))[_0x4249('0x22')](respondWithResult(_0x63c798,null))[_0x4249('0x42')](handleError(_0x63c798,null));};exports[_0x4249('0x23')]=function(_0x40fcb8,_0x2c2cf4){return db[_0x4249('0x3e')][_0x4249('0x46')]({'where':{'id':_0x40fcb8[_0x4249('0x44')]['id']}})[_0x4249('0x22')](handleEntityNotFound(_0x2c2cf4,null))['then'](removeEntity(_0x2c2cf4,null))[_0x4249('0x42')](handleError(_0x2c2cf4,null));};exports[_0x4249('0x4f')]=function(_0xc0d8d5,_0x357bd1,_0x1200ec){var _0x54ccac=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0xc0d8d5[_0x4249('0x44')]['id']},'raw':!![]})[_0x4249('0x22')](handleEntityNotFound(_0x357bd1,null))[_0x4249('0x22')](function(){_0x54ccac[_0x4249('0x4f')](_0xc0d8d5[_0x4249('0x44')]['id']);})[_0x4249('0x22')](respondWithStatusCode(_0x357bd1,null))[_0x4249('0x42')](handleError(_0x357bd1,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index d2c45f0..89b1b97 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 _0xbe45=['exports','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c0dcb,_0x16cd83){var _0x183a0e=function(_0xfb292d){while(--_0xfb292d){_0x5c0dcb['push'](_0x5c0dcb['shift']());}};_0x183a0e(++_0x16cd83);}(_0xbe45,0xf9));var _0x5be4=function(_0x35f747,_0x1f2085){_0x35f747=_0x35f747-0x0;var _0x4c21bd=_0xbe45[_0x35f747];return _0x4c21bd;};'use strict';var _=require(_0x5be4('0x0'));var util=require('util');var logger=require(_0x5be4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5be4('0x2'));var rp=require(_0x5be4('0x3'));var fs=require('fs');var path=require(_0x5be4('0x4'));var rimraf=require(_0x5be4('0x5'));var config=require(_0x5be4('0x6'));var attributes=require('./schedule.attributes');module[_0x5be4('0x7')]=function(_0x51d4e2,_0x47abb5){return _0x51d4e2['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5e8=['tools_schedules','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes','Schedule'];(function(_0x16b8e4,_0x2a2c8f){var _0x3a9093=function(_0xfbbff4){while(--_0xfbbff4){_0x16b8e4['push'](_0x16b8e4['shift']());}};_0x3a9093(++_0x2a2c8f);}(_0xf5e8,0x137));var _0x8f5e=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0xf5e8[_0x46e523];return _0x5da0ee;};'use strict';var _=require('lodash');var util=require(_0x8f5e('0x0'));var logger=require(_0x8f5e('0x1'))('api');var moment=require(_0x8f5e('0x2'));var BPromise=require(_0x8f5e('0x3'));var rp=require(_0x8f5e('0x4'));var fs=require('fs');var path=require(_0x8f5e('0x5'));var rimraf=require('rimraf');var config=require(_0x8f5e('0x6'));var attributes=require(_0x8f5e('0x7'));module['exports']=function(_0x2dbb01,_0x24acd3){return _0x2dbb01['define'](_0x8f5e('0x8'),attributes,{'tableName':_0x8f5e('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 b6e7252..4cbd4b2 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 _0x486e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1237b1,_0x19ce6b){var _0x429a0c=function(_0x52144e){while(--_0x52144e){_0x1237b1['push'](_0x1237b1['shift']());}};_0x429a0c(++_0x19ce6b);}(_0x486e,0x1a0));var _0xe486=function(_0xf3c41c,_0x3b43b8){_0xf3c41c=_0xf3c41c-0x0;var _0x538994=_0x486e[_0xf3c41c];return _0x538994;};'use strict';var _=require(_0xe486('0x0'));var util=require(_0xe486('0x1'));var moment=require(_0xe486('0x2'));var BPromise=require(_0xe486('0x3'));var rs=require(_0xe486('0x4'));var fs=require('fs');var Redis=require(_0xe486('0x5'));var db=require(_0xe486('0x6'))['db'];var utils=require(_0xe486('0x7'));var logger=require(_0xe486('0x8'))(_0xe486('0x9'));var config=require(_0xe486('0xa'));var jayson=require(_0xe486('0xb'));var client=jayson[_0xe486('0xc')][_0xe486('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x579d94,_0x12ecb6,_0x5a0e3a){return new BPromise(function(_0x159fe2,_0x4cfe2a){return client[_0xe486('0xe')](_0x579d94,_0x5a0e3a)[_0xe486('0xf')](function(_0x32d6d0){logger[_0xe486('0x10')](_0xe486('0x11'),_0x12ecb6,_0xe486('0x12'));logger[_0xe486('0x13')](_0xe486('0x14'),_0x12ecb6,'request\x20sent',JSON[_0xe486('0x15')](_0x32d6d0));if(_0x32d6d0['error']){if(_0x32d6d0[_0xe486('0x16')]['code']===0x1f4){logger[_0xe486('0x16')]('Schedule,\x20%s,\x20%s',_0x12ecb6,_0x32d6d0['error']['message']);return _0x4cfe2a(_0x32d6d0['error'][_0xe486('0x17')]);}logger['error'](_0xe486('0x11'),_0x12ecb6,_0x32d6d0[_0xe486('0x16')][_0xe486('0x17')]);return _0x159fe2(_0x32d6d0[_0xe486('0x16')][_0xe486('0x17')]);}else{logger[_0xe486('0x10')](_0xe486('0x11'),_0x12ecb6,_0xe486('0x12'));_0x159fe2(_0x32d6d0[_0xe486('0x18')][_0xe486('0x17')]);}})[_0xe486('0x19')](function(_0x1b78ef){logger[_0xe486('0x16')]('Schedule,\x20%s,\x20%s',_0x12ecb6,_0x1b78ef);_0x4cfe2a(_0x1b78ef);});});} \ No newline at end of file +var _0xbd0e=['stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x112e6a,_0x4dfc41){var _0x1b691b=function(_0x9465e2){while(--_0x9465e2){_0x112e6a['push'](_0x112e6a['shift']());}};_0x1b691b(++_0x4dfc41);}(_0xbd0e,0x1e8));var _0xebd0=function(_0x37628a,_0x92e3c6){_0x37628a=_0x37628a-0x0;var _0x1cf2bf=_0xbd0e[_0x37628a];return _0x1cf2bf;};'use strict';var _=require(_0xebd0('0x0'));var util=require(_0xebd0('0x1'));var moment=require(_0xebd0('0x2'));var BPromise=require('bluebird');var rs=require(_0xebd0('0x3'));var fs=require('fs');var Redis=require(_0xebd0('0x4'));var db=require(_0xebd0('0x5'))['db'];var utils=require(_0xebd0('0x6'));var logger=require(_0xebd0('0x7'))('rpc');var config=require(_0xebd0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xebd0('0x9')][_0xebd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x481c75,_0x27eb8f,_0x3b72e5){return new BPromise(function(_0x396099,_0x411f6e){return client[_0xebd0('0xb')](_0x481c75,_0x3b72e5)[_0xebd0('0xc')](function(_0x46b5d6){logger[_0xebd0('0xd')](_0xebd0('0xe'),_0x27eb8f,'request\x20sent');logger[_0xebd0('0xf')](_0xebd0('0x10'),_0x27eb8f,_0xebd0('0x11'),JSON[_0xebd0('0x12')](_0x46b5d6));if(_0x46b5d6['error']){if(_0x46b5d6[_0xebd0('0x13')][_0xebd0('0x14')]===0x1f4){logger[_0xebd0('0x13')]('Schedule,\x20%s,\x20%s',_0x27eb8f,_0x46b5d6['error'][_0xebd0('0x15')]);return _0x411f6e(_0x46b5d6['error']['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x27eb8f,_0x46b5d6[_0xebd0('0x13')][_0xebd0('0x15')]);return _0x396099(_0x46b5d6['error'][_0xebd0('0x15')]);}else{logger['info'](_0xebd0('0xe'),_0x27eb8f,'request\x20sent');_0x396099(_0x46b5d6['result']['message']);}})[_0xebd0('0x16')](function(_0x396025){logger[_0xebd0('0x13')](_0xebd0('0xe'),_0x27eb8f,_0x396025);_0x411f6e(_0x396025);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c041335..20a494b 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 _0x268c=['/describe','describe','/:id','/:id/download','download','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x1aef65,_0x521e60){var _0x4a4594=function(_0x120020){while(--_0x120020){_0x1aef65['push'](_0x1aef65['shift']());}};_0x4a4594(++_0x521e60);}(_0x268c,0x11c));var _0xc268=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0x268c[_0x90f34f];return _0x4b18cf;};'use strict';var multer=require('multer');var util=require(_0xc268('0x0'));var path=require(_0xc268('0x1'));var timeout=require(_0xc268('0x2'));var express=require(_0xc268('0x3'));var router=express[_0xc268('0x4')]();var fs_extra=require(_0xc268('0x5'));var auth=require(_0xc268('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xc268('0x7')]('/',auth[_0xc268('0x8')](),controller[_0xc268('0x9')]);router[_0xc268('0x7')](_0xc268('0xa'),auth[_0xc268('0x8')](),controller[_0xc268('0xb')]);router['get'](_0xc268('0xc'),auth[_0xc268('0x8')](),controller['show']);router[_0xc268('0x7')](_0xc268('0xd'),auth[_0xc268('0x8')](),controller[_0xc268('0xe')]);router[_0xc268('0xf')]('/',auth[_0xc268('0x8')](),controller[_0xc268('0x10')]);router[_0xc268('0x11')]('/:id',auth[_0xc268('0x8')](),controller[_0xc268('0x12')]);router[_0xc268('0x13')](_0xc268('0xc'),auth[_0xc268('0x8')](),controller['destroy']);module[_0xc268('0x14')]=router; \ No newline at end of file +var _0xa2c7=['download','post','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/download'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xa2c7,0xaf));var _0x7a2c=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0xa2c7[_0x23ca4d];return _0x435432;};'use strict';var multer=require('multer');var util=require(_0x7a2c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a2c('0x1'));var router=express[_0x7a2c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7a2c('0x3'));var interaction=require(_0x7a2c('0x4'));var config=require(_0x7a2c('0x5'));var controller=require(_0x7a2c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7a2c('0x7')]);router[_0x7a2c('0x8')](_0x7a2c('0x9'),auth[_0x7a2c('0xa')](),controller[_0x7a2c('0xb')]);router[_0x7a2c('0x8')](_0x7a2c('0xc'),auth[_0x7a2c('0xa')](),controller[_0x7a2c('0xd')]);router['get'](_0x7a2c('0xe'),auth[_0x7a2c('0xa')](),controller[_0x7a2c('0xf')]);router[_0x7a2c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7a2c('0xc'),auth[_0x7a2c('0xa')](),controller['update']);router[_0x7a2c('0x11')](_0x7a2c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7a2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 2625db0..459af4b 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 _0xae6e=['format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','extname','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','duration','DATE'];(function(_0x16e875,_0x186dd3){var _0x2bb51d=function(_0x5ee3c0){while(--_0x5ee3c0){_0x16e875['push'](_0x16e875['shift']());}};_0x2bb51d(++_0x186dd3);}(_0xae6e,0x1e5));var _0xeae6=function(_0x5225f2,_0x22d220){_0x5225f2=_0x5225f2-0x0;var _0x43259e=_0xae6e[_0x5225f2];return _0x43259e;};'use strict';var Sequelize=require(_0xeae6('0x0'));var moment=require(_0xeae6('0x1'));var path=require(_0xeae6('0x2'));var config=require(_0xeae6('0x3'));module[_0xeae6('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xeae6('0x5')]('value')?path[_0xeae6('0x6')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeae6('0x7')]},'value':{'type':Sequelize[_0xeae6('0x7')],'set':function(_0x51854c){var _0x2b8f17=_0x51854c[_0xeae6('0x8')](/\\/g,'/');this['setDataValue']('value',_0x2b8f17);}},'rating':{'type':Sequelize[_0xeae6('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xeae6('0x9')],'set':function(_0x2bb3e0){this[_0xeae6('0xa')](_0xeae6('0xb'),moment()['subtract'](_0x2bb3e0,'ms'));this[_0xeae6('0xa')](_0xeae6('0xc'),moment());this[_0xeae6('0xa')](_0xeae6('0xd'),_0x2bb3e0);}},'startedAt':{'type':Sequelize[_0xeae6('0xe')],'get':function(){return moment(this[_0xeae6('0x5')](_0xeae6('0xb')))[_0xeae6('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xeae6('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xeae6('0xc')))[_0xeae6('0xf')](_0xeae6('0x11'))[_0xeae6('0x10')]();}},'createdAt':{'type':Sequelize[_0xeae6('0xe')],'get':function(){return moment(this[_0xeae6('0x5')](_0xeae6('0x12')))[_0xeae6('0xf')](_0xeae6('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xeae6('0x5')](_0xeae6('0x13')))[_0xeae6('0xf')](_0xeae6('0x11'))['toString']();}}}; \ No newline at end of file +var _0x9672=['closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract'];(function(_0x3dde9f,_0x2ecbda){var _0x505dda=function(_0xb0d0aa){while(--_0xb0d0aa){_0x3dde9f['push'](_0x3dde9f['shift']());}};_0x505dda(++_0x2ecbda);}(_0x9672,0xee));var _0x2967=function(_0x5b2126,_0x5e6087){_0x5b2126=_0x5b2126-0x0;var _0x4f25d1=_0x9672[_0x5b2126];return _0x4f25d1;};'use strict';var Sequelize=require(_0x2967('0x0'));var moment=require(_0x2967('0x1'));var path=require('path');var config=require(_0x2967('0x2'));module[_0x2967('0x3')]={'format':{'type':Sequelize[_0x2967('0x4')],'get':function(){return this[_0x2967('0x5')]('value')?path[_0x2967('0x6')](this[_0x2967('0x5')](_0x2967('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x2967('0x8')],'set':function(_0x355e82){var _0x1aa9a5=_0x355e82[_0x2967('0x9')](/\\/g,'/');this[_0x2967('0xa')](_0x2967('0x7'),_0x1aa9a5);}},'rating':{'type':Sequelize[_0x2967('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2967('0xb')],'set':function(_0x4aec0f){this[_0x2967('0xa')](_0x2967('0xc'),moment()[_0x2967('0xd')](_0x4aec0f,'ms'));this[_0x2967('0xa')](_0x2967('0xe'),moment());this[_0x2967('0xa')]('duration',_0x4aec0f);}},'startedAt':{'type':Sequelize[_0x2967('0xf')],'get':function(){return moment(this['getDataValue'](_0x2967('0xc')))['format'](_0x2967('0x10'))[_0x2967('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2967('0x5')]('closedAt'))[_0x2967('0x12')](_0x2967('0x10'))[_0x2967('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2967('0x13')))[_0x2967('0x12')](_0x2967('0x10'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2967('0x5')](_0x2967('0x14')))[_0x2967('0x12')](_0x2967('0x10'))[_0x2967('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8972859..1e9db5d 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 _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x394394,_0x143ead){var _0x37c397=function(_0x9feb8b){while(--_0x9feb8b){_0x394394['push'](_0x394394['shift']());}};_0x37c397(++_0x143ead);}(_0x98a8,0x12c));var _0x898a=function(_0xa57746,_0x2bcb06){_0xa57746=_0xa57746-0x0;var _0x1fcf1c=_0x98a8[_0xa57746];return _0x1fcf1c;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file +var _0x6aa7=['fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','catch','create','body','duration','createdAt','closedAt','params','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6aa7,0x178));var _0x76aa=function(_0x4b73d9,_0xf46055){_0x4b73d9=_0x4b73d9-0x0;var _0x25a358=_0x6aa7[_0x4b73d9];return _0x25a358;};'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(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x33')](_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b')),[_0x76aa('0x34')]);_0x365ff8[_0x76aa('0x35')]=_[_0x76aa('0x36')](_0x3fcb7f['query']);_0x365ff8[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x365ff8['model'],_0x365ff8[_0x76aa('0x35')]);_0x994550['attributes']=_[_0x76aa('0x38')](_0x365ff8['model'],qs[_0x76aa('0x39')](_0x3fcb7f['query']['fields']));_0x994550[_0x76aa('0x3a')]=_0x994550[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x994550[_0x76aa('0x3a')]:_0x365ff8['model'];if(!_0x3fcb7f['query'][_0x76aa('0x3c')](_0x76aa('0x3d'))){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x35')]['limit']);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f['query'][_0x76aa('0x1e')]);}_0x994550[_0x76aa('0x3e')]=qs[_0x76aa('0x3f')](_0x3fcb7f[_0x76aa('0x35')]['sort']);_0x994550[_0x76aa('0x40')]=qs[_0x76aa('0x37')](_[_0x76aa('0x41')](_0x3fcb7f['query'],_0x365ff8[_0x76aa('0x37')]),_0x1e90b9);if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]){_0x994550[_0x76aa('0x40')]=_[_0x76aa('0x43')](_0x994550[_0x76aa('0x40')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x307d67){if(_0x307d67[_0x76aa('0x31')]!=='VIRTUAL'){var _0x1525cb={};_0x1525cb[_0x307d67[_0x76aa('0x2b')]]={'$like':'%'+_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]+'%'};return _0x1525cb;}})});}_0x994550=_[_0x76aa('0x43')]({},_0x994550,_0x3fcb7f[_0x76aa('0x44')]);var _0x572fdb={'where':_0x994550['where']};return db[_0x76aa('0x2e')][_0x76aa('0x1d')](_0x572fdb)[_0x76aa('0x27')](function(_0x365612){_0x2dec94['count']=_0x365612;if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x45')]){_0x994550[_0x76aa('0x46')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x47')](_0x994550);})['then'](function(_0x13dafe){_0x2dec94['rows']=_0x13dafe;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports['show']=function(_0x4f7f3a,_0x144f0a){var _0x541594={'raw':![],'where':{'id':_0x4f7f3a['params']['id']}},_0x5cf314={};_0x5cf314[_0x76aa('0x32')]=_[_0x76aa('0x36')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x5cf314[_0x76aa('0x35')]=_['keys'](_0x4f7f3a[_0x76aa('0x35')]);_0x5cf314[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],_0x5cf314[_0x76aa('0x35')]);_0x541594['attributes']=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],qs['fields'](_0x4f7f3a[_0x76aa('0x35')]['fields']));_0x541594[_0x76aa('0x3a')]=_0x541594[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x541594[_0x76aa('0x3a')]:_0x5cf314[_0x76aa('0x32')];if(_0x4f7f3a[_0x76aa('0x35')][_0x76aa('0x45')]){_0x541594[_0x76aa('0x46')]=[{'all':!![]}];}_0x541594=_[_0x76aa('0x43')]({},_0x541594,_0x4f7f3a[_0x76aa('0x44')]);return db['ScreenRecording'][_0x76aa('0x48')](_0x541594)['then'](handleEntityNotFound(_0x144f0a,null))[_0x76aa('0x27')](respondWithResult(_0x144f0a,null))[_0x76aa('0x49')](handleError(_0x144f0a,null));};exports[_0x76aa('0x4a')]=function(_0x156d4e,_0x5ca721){return db['ScreenRecording'][_0x76aa('0x4a')](_0x156d4e['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5ca721,0xc9))[_0x76aa('0x49')](handleError(_0x5ca721,null));};exports[_0x76aa('0x26')]=function(_0x2e5633,_0x30c577){if(_0x2e5633[_0x76aa('0x4b')]['id']){delete _0x2e5633['body']['id'];}delete _0x2e5633['body'][_0x76aa('0x4c')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4d')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4e')];delete _0x2e5633[_0x76aa('0x4b')]['value'];return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x2e5633[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c577,null))[_0x76aa('0x27')](saveUpdates(_0x2e5633['body'],null))[_0x76aa('0x27')](respondWithResult(_0x30c577,null))['catch'](handleError(_0x30c577,null));};exports[_0x76aa('0x50')]=function(_0x4449c1,_0x3c63e5){return db[_0x76aa('0x2e')][_0x76aa('0x50')]()[_0x76aa('0x27')](respondWithResult(_0x3c63e5,null))[_0x76aa('0x49')](handleError(_0x3c63e5,null));};exports['download']=function(_0x186654,_0x5eeaa5,_0x3ee32){var _0x311bd5=require(_0x76aa('0x51'));var _0x53be10=![];var _0x3fa7ec={};if(_0x186654[_0x76aa('0x35')][_0x76aa('0x31')]&&_0x186654['query'][_0x76aa('0x31')]===_0x76aa('0x52')){_0x3fa7ec[_0x76aa('0x52')]=_0x186654[_0x76aa('0x4f')]['id'];}else{_0x3fa7ec['id']=_0x186654['params']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':_0x3fa7ec,'attributes':['id',_0x76aa('0x53')],'raw':!![]})[_0x76aa('0x27')](handleEntityNotFound(_0x5eeaa5,null))[_0x76aa('0x27')](function(_0xf7732){if(_0xf7732){var _0x4e6c09=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0xf7732[_0x76aa('0x53')]);var _0x3967f3=util[_0x76aa('0x34')](_0x76aa('0x57'),_0x4e6c09);if(fs['existsSync'](_0x3967f3)){_0x53be10=!![];return _0x311bd5['decryptFile'](_0x3967f3,_0x4e6c09,config[_0x76aa('0x58')][_0x76aa('0x59')])['then'](function(){return _0xf7732;});}return _0xf7732;}})[_0x76aa('0x27')](function(_0x1e6f3c){if(_0x1e6f3c){var _0x4f832d=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x1e6f3c[_0x76aa('0x53')]);if(!fs[_0x76aa('0x5a')](_0x4f832d)){throw new db[(_0x76aa('0x5b'))][(_0x76aa('0x5c'))](_0x76aa('0x5d'));}if(_0x1e6f3c[_0x76aa('0x5e')]){return _0x5eeaa5['download'](_0x4f832d,_0x1e6f3c[_0x76aa('0x5e')]+path['extname'](_0x4f832d),function(){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}else{return _0x5eeaa5[_0x76aa('0x60')](_0x4f832d,function(_0x2fef92){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}}})[_0x76aa('0x49')](function(_0x260ad2){if(_0x260ad2[_0x76aa('0x61')]===_0x76aa('0x5d')){_0x5eeaa5[_0x76aa('0x1a')](0x194)['send'](_0x76aa('0x62'));}else{return handleError(_0x5eeaa5,null);}});};exports[_0x76aa('0x28')]=function(_0x5c542b,_0xe5957d){return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x5c542b[_0x76aa('0x4f')]['id']}})[_0x76aa('0x27')](function(_0x5546b6){if(_[_0x76aa('0x63')](_0x5546b6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5546b6;})[_0x76aa('0x27')](function(_0x35881c){var _0x3e97f8=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x35881c[_0x76aa('0x53')]);logger['info'](_0x76aa('0x64'),_0x3e97f8);if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs['existsSync'](_0x3e97f8)){logger[_0x76aa('0x65')](_0x76aa('0x66')+_0x3e97f8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76aa('0x67')](_0x3e97f8);}_0x3e97f8=_0x3e97f8+_0x76aa('0x68');if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs[_0x76aa('0x5a')](_0x3e97f8)){logger['info'](_0x76aa('0x66')+_0x3e97f8+_0x76aa('0x69'));fs[_0x76aa('0x67')](_0x3e97f8);}return _0x35881c;})[_0x76aa('0x27')](function(_0x55ca84){if(!_0x55ca84)throw new InternalError();return _0x55ca84['destroy']();})[_0x76aa('0x27')](function(){_0xe5957d['status'](0xcc)[_0x76aa('0x1b')]();})[_0x76aa('0x49')](handleError(_0xe5957d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 9b2ab38..29a8710 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 _0x26e9=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x2d52c7,_0x40a804){var _0x2ce966=function(_0x544beb){while(--_0x544beb){_0x2d52c7['push'](_0x2d52c7['shift']());}};_0x2ce966(++_0x40a804);}(_0x26e9,0x142));var _0x926e=function(_0x245ac5,_0x4215f1){_0x245ac5=_0x245ac5-0x0;var _0x437858=_0x26e9[_0x245ac5];return _0x437858;};'use strict';var _=require(_0x926e('0x0'));var util=require(_0x926e('0x1'));var logger=require(_0x926e('0x2'))(_0x926e('0x3'));var moment=require(_0x926e('0x4'));var BPromise=require(_0x926e('0x5'));var rp=require(_0x926e('0x6'));var fs=require('fs');var path=require(_0x926e('0x7'));var rimraf=require(_0x926e('0x8'));var config=require(_0x926e('0x9'));var attributes=require(_0x926e('0xa'));module[_0x926e('0xb')]=function(_0x37c121,_0x428d20){return _0x37c121[_0x926e('0xc')](_0x926e('0xd'),attributes,{'tableName':_0x926e('0xe'),'paranoid':![],'indexes':[{'name':_0x926e('0xf'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ca4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash'];(function(_0x2df6ed,_0x1c9f74){var _0x43a706=function(_0x27df7f){while(--_0x27df7f){_0x2df6ed['push'](_0x2df6ed['shift']());}};_0x43a706(++_0x1c9f74);}(_0x9ca4,0x110));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49ca('0x0'));var util=require('util');var logger=require(_0x49ca('0x1'))(_0x49ca('0x2'));var moment=require(_0x49ca('0x3'));var BPromise=require(_0x49ca('0x4'));var rp=require(_0x49ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49ca('0x6'));var config=require(_0x49ca('0x7'));var attributes=require(_0x49ca('0x8'));module[_0x49ca('0x9')]=function(_0x1c74e3,_0x377450){return _0x1c74e3[_0x49ca('0xa')](_0x49ca('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x49ca('0xc'),'fields':[_0x49ca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 2b61e99..4038e13 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 _0x327e=['stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x2565c4,_0x2b1320){var _0xec7c1=function(_0x47adfe){while(--_0x47adfe){_0x2565c4['push'](_0x2565c4['shift']());}};_0xec7c1(++_0x2b1320);}(_0x327e,0xa5));var _0xe327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x327e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe327('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe327('0x1'));var rs=require(_0xe327('0x2'));var fs=require('fs');var Redis=require(_0xe327('0x3'));var db=require(_0xe327('0x4'))['db'];var utils=require(_0xe327('0x5'));var logger=require(_0xe327('0x6'))(_0xe327('0x7'));var config=require(_0xe327('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe327('0x9')][_0xe327('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55f5b7,_0x37462e,_0x20a21f){return new BPromise(function(_0x1baa10,_0xfd8158){return client[_0xe327('0xb')](_0x55f5b7,_0x20a21f)[_0xe327('0xc')](function(_0x49b601){logger['info'](_0xe327('0xd'),_0x37462e,_0xe327('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x37462e,_0xe327('0xe'),JSON[_0xe327('0xf')](_0x49b601));if(_0x49b601[_0xe327('0x10')]){if(_0x49b601[_0xe327('0x10')][_0xe327('0x11')]===0x1f4){logger[_0xe327('0x10')](_0xe327('0xd'),_0x37462e,_0x49b601[_0xe327('0x10')]['message']);return _0xfd8158(_0x49b601['error'][_0xe327('0x12')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x37462e,_0x49b601[_0xe327('0x10')][_0xe327('0x12')]);return _0x1baa10(_0x49b601[_0xe327('0x10')][_0xe327('0x12')]);}else{logger['info'](_0xe327('0xd'),_0x37462e,_0xe327('0xe'));_0x1baa10(_0x49b601[_0xe327('0x13')]['message']);}})['catch'](function(_0x1a84c5){logger[_0xe327('0x10')](_0xe327('0xd'),_0x37462e,_0x1a84c5);_0xfd8158(_0x1a84c5);});});} \ No newline at end of file +var _0xa7ca=['client','http','request','then','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ScreenRecording,\x20%s,\x20%s','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x197b20,_0x580b0c){var _0x1f63f8=function(_0x235c8c){while(--_0x235c8c){_0x197b20['push'](_0x197b20['shift']());}};_0x1f63f8(++_0x580b0c);}(_0xa7ca,0x1c7));var _0xaa7c=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa7ca[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7c('0x0'));var rs=require(_0xaa7c('0x1'));var fs=require('fs');var Redis=require(_0xaa7c('0x2'));var db=require(_0xaa7c('0x3'))['db'];var utils=require(_0xaa7c('0x4'));var logger=require(_0xaa7c('0x5'))('rpc');var config=require(_0xaa7c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaa7c('0x7')][_0xaa7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47db95,_0x433dfc,_0x4b9b84){return new BPromise(function(_0x1282f8,_0x5710d6){return client[_0xaa7c('0x9')](_0x47db95,_0x4b9b84)[_0xaa7c('0xa')](function(_0x5308e5){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x433dfc,_0xaa7c('0xb'));logger['debug'](_0xaa7c('0xc'),_0x433dfc,_0xaa7c('0xb'),JSON[_0xaa7c('0xd')](_0x5308e5));if(_0x5308e5[_0xaa7c('0xe')]){if(_0x5308e5[_0xaa7c('0xe')][_0xaa7c('0xf')]===0x1f4){logger[_0xaa7c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x433dfc,_0x5308e5['error']['message']);return _0x5710d6(_0x5308e5['error'][_0xaa7c('0x10')]);}logger[_0xaa7c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x433dfc,_0x5308e5['error'][_0xaa7c('0x10')]);return _0x1282f8(_0x5308e5[_0xaa7c('0xe')][_0xaa7c('0x10')]);}else{logger[_0xaa7c('0x11')](_0xaa7c('0x12'),_0x433dfc,_0xaa7c('0xb'));_0x1282f8(_0x5308e5[_0xaa7c('0x13')][_0xaa7c('0x10')]);}})[_0xaa7c('0x14')](function(_0xf38a35){logger[_0xaa7c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x433dfc,_0xf38a35);_0x5710d6(_0xf38a35);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6a501fb..b8a7a52 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 _0x93a9=['/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','single','file','addLogo','diskStorage','addLogoLogin','preferred','favicon','originalname','post','addFavicon','put','update','exports','multer','util','connect-timeout','get','isAuthenticated','getDate','/:id','/:id/logo','getLogo'];(function(_0x18cc93,_0x38d51a){var _0x2d6d5e=function(_0x10a5b2){while(--_0x10a5b2){_0x18cc93['push'](_0x18cc93['shift']());}};_0x2d6d5e(++_0x38d51a);}(_0x93a9,0x7f));var _0x993a=function(_0x27e9b3,_0x1b17af){_0x27e9b3=_0x27e9b3-0x0;var _0x553cac=_0x93a9[_0x27e9b3];return _0x553cac;};'use strict';var multer=require(_0x993a('0x0'));var util=require(_0x993a('0x1'));var path=require('path');var timeout=require(_0x993a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x993a('0x3')]('/',auth[_0x993a('0x4')](),controller['index']);router[_0x993a('0x3')]('/now',controller[_0x993a('0x5')]);router['get'](_0x993a('0x6'),controller['show']);router[_0x993a('0x3')](_0x993a('0x7'),controller[_0x993a('0x8')]);router['get'](_0x993a('0x9'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller[_0x993a('0xa')]);router[_0x993a('0x3')](_0x993a('0xb'),controller[_0x993a('0xc')]);router[_0x993a('0x3')](_0x993a('0xd'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e08c0,_0x56b11b,_0x1b5212){_0x1b5212(null,path[_0x993a('0xe')](config[_0x993a('0xf')],_0x993a('0x10')));},'filename':function(_0x22badd,_0x2c7217,_0x1ddc53){_0x1ddc53(null,util[_0x993a('0x11')](_0x993a('0x12'),_0x993a('0x13'),path[_0x993a('0x14')](_0x2c7217['originalname'])));}})});router['post'](_0x993a('0x7'),upload[_0x993a('0x15')](_0x993a('0x16')),controller[_0x993a('0x17')]);var upload=multer({'storage':multer[_0x993a('0x18')]({'destination':function(_0x25c36f,_0x516429,_0x11dcf6){_0x11dcf6(null,path[_0x993a('0xe')](config[_0x993a('0xf')],'server/files/images/logos/'));},'filename':function(_0x169cc0,_0x3d96e1,_0x1fd9a0){_0x1fd9a0(null,util[_0x993a('0x11')](_0x993a('0x12'),'logologin',path[_0x993a('0x14')](_0x3d96e1['originalname'])));}})});router['post'](_0x993a('0x9'),upload[_0x993a('0x15')](_0x993a('0x16')),controller[_0x993a('0x19')]);var upload=multer({'storage':multer[_0x993a('0x18')]({'destination':function(_0x37da6e,_0x415c0e,_0x4d4543){_0x4d4543(null,path[_0x993a('0xe')](config['root'],'server/files/images/logos/'));},'filename':function(_0x41db92,_0xd38d14,_0xfdf24){_0xfdf24(null,util[_0x993a('0x11')]('%s%s',_0x993a('0x1a'),path[_0x993a('0x14')](_0xd38d14['originalname'])));}})});router['post'](_0x993a('0xb'),upload[_0x993a('0x15')](_0x993a('0x16')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a0441,_0x4e7dfc,_0x319f96){_0x319f96(null,path[_0x993a('0xe')](config['root'],_0x993a('0x10')));},'filename':function(_0x459efb,_0x184c7c,_0x3a945c){_0x3a945c(null,util[_0x993a('0x11')](_0x993a('0x12'),_0x993a('0x1b'),path[_0x993a('0x14')](_0x184c7c[_0x993a('0x1c')])));}})});router[_0x993a('0x1d')]('/:id/favicon',upload[_0x993a('0x15')](_0x993a('0x16')),controller[_0x993a('0x1e')]);router[_0x993a('0x1f')]('/:id',auth[_0x993a('0x4')](),controller[_0x993a('0x20')]);module[_0x993a('0x21')]=router; \ No newline at end of file +var _0x5a4b=['originalname','post','single','file','addLogo','diskStorage','join','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','multer','util','path','connect-timeout','express','fs-extra','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','root','server/files/images/logos/','format','%s%s','logo','extname'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x5a4b,0xaa));var _0xb5a4=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x5a4b[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xb5a4('0x0'));var util=require(_0xb5a4('0x1'));var path=require(_0xb5a4('0x2'));var timeout=require(_0xb5a4('0x3'));var express=require(_0xb5a4('0x4'));var router=express['Router']();var fs_extra=require(_0xb5a4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xb5a4('0x6')]('/',auth[_0xb5a4('0x7')](),controller['index']);router[_0xb5a4('0x6')](_0xb5a4('0x8'),controller[_0xb5a4('0x9')]);router[_0xb5a4('0x6')](_0xb5a4('0xa'),controller[_0xb5a4('0xb')]);router['get'](_0xb5a4('0xc'),controller[_0xb5a4('0xd')]);router[_0xb5a4('0x6')](_0xb5a4('0xe'),controller['getLogoLogin']);router[_0xb5a4('0x6')](_0xb5a4('0xf'),controller['gdpr']);router[_0xb5a4('0x6')](_0xb5a4('0x10'),controller[_0xb5a4('0x11')]);router[_0xb5a4('0x6')]('/:id/favicon',controller[_0xb5a4('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56f620,_0x4efd53,_0x445dc7){_0x445dc7(null,path['join'](config[_0xb5a4('0x13')],_0xb5a4('0x14')));},'filename':function(_0x4c5086,_0x43e178,_0x28bbe2){_0x28bbe2(null,util[_0xb5a4('0x15')](_0xb5a4('0x16'),_0xb5a4('0x17'),path[_0xb5a4('0x18')](_0x43e178[_0xb5a4('0x19')])));}})});router[_0xb5a4('0x1a')](_0xb5a4('0xc'),upload[_0xb5a4('0x1b')](_0xb5a4('0x1c')),controller[_0xb5a4('0x1d')]);var upload=multer({'storage':multer[_0xb5a4('0x1e')]({'destination':function(_0x313736,_0x367034,_0x1563df){_0x1563df(null,path[_0xb5a4('0x1f')](config[_0xb5a4('0x13')],'server/files/images/logos/'));},'filename':function(_0x2142f6,_0x47c738,_0xdd5a8f){_0xdd5a8f(null,util['format']('%s%s','logologin',path[_0xb5a4('0x18')](_0x47c738[_0xb5a4('0x19')])));}})});router['post']('/:id/logo_login',upload[_0xb5a4('0x1b')](_0xb5a4('0x1c')),controller[_0xb5a4('0x20')]);var upload=multer({'storage':multer[_0xb5a4('0x1e')]({'destination':function(_0x2c5044,_0x569eb1,_0x1a24bd){_0x1a24bd(null,path[_0xb5a4('0x1f')](config['root'],_0xb5a4('0x14')));},'filename':function(_0x44755b,_0x127eac,_0x3bacb6){_0x3bacb6(null,util[_0xb5a4('0x15')](_0xb5a4('0x16'),_0xb5a4('0x21'),path['extname'](_0x127eac['originalname'])));}})});router[_0xb5a4('0x1a')](_0xb5a4('0x10'),upload[_0xb5a4('0x1b')](_0xb5a4('0x1c')),controller[_0xb5a4('0x22')]);var upload=multer({'storage':multer[_0xb5a4('0x1e')]({'destination':function(_0xe02f77,_0xca9035,_0x3f1d73){_0x3f1d73(null,path[_0xb5a4('0x1f')](config['root'],'server/files/images/logos/'));},'filename':function(_0xdfd6cf,_0x23831b,_0x246edb){_0x246edb(null,util[_0xb5a4('0x15')](_0xb5a4('0x16'),_0xb5a4('0x23'),path['extname'](_0x23831b[_0xb5a4('0x19')])));}})});router[_0xb5a4('0x1a')](_0xb5a4('0x24'),upload['single'](_0xb5a4('0x1c')),controller[_0xb5a4('0x25')]);router[_0xb5a4('0x26')](_0xb5a4('0xa'),auth[_0xb5a4('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index df6f2ea..3043d47 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(_0x270b8a,_0x11ac35){var _0x149c67=function(_0x19a347){while(--_0x19a347){_0x270b8a['push'](_0x270b8a['shift']());}};_0x149c67(++_0x11ac35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x227482,_0x4e3ffd){var _0x105b8b=function(_0x2a0e93){while(--_0x2a0e93){_0x227482['push'](_0x227482['shift']());}};_0x105b8b(++_0x4e3ffd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 d4e31a2..2764cd8 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 _0x94c0=['attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','find','body','file','params','filename','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','loginLogo','defaultLoginLogo','default_loginLogo.svg','default','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x94c0,0xaa));var _0x094c=function(_0x439662,_0x5defdb){_0x439662=_0x439662-0x0;var _0x251ec4=_0x94c0[_0x439662];return _0x251ec4;};'use strict';var emlformat=require(_0x094c('0x0'));var rimraf=require(_0x094c('0x1'));var zipdir=require(_0x094c('0x2'));var jsonpatch=require(_0x094c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x094c('0x4'));var Mustache=require(_0x094c('0x5'));var util=require(_0x094c('0x6'));var path=require(_0x094c('0x7'));var sox=require(_0x094c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x094c('0x9'));var _=require(_0x094c('0xa'));var squel=require(_0x094c('0xb'));var crypto=require('crypto');var jsforce=require(_0x094c('0xc'));var deskjs=require(_0x094c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x094c('0xe'));var Papa=require(_0x094c('0xf'));var Redis=require('ioredis');var authService=require(_0x094c('0x10'));var qs=require(_0x094c('0x11'));var as=require(_0x094c('0x12'));var hardwareService=require(_0x094c('0x13'));var logger=require(_0x094c('0x14'))(_0x094c('0x15'));var utils=require(_0x094c('0x16'));var config=require(_0x094c('0x17'));var licenseUtil=require(_0x094c('0x18'));var db=require(_0x094c('0x19'))['db'];var jayson=require(_0x094c('0x1a'));var client=jayson[_0x094c('0x1b')][_0x094c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2d22cf,_0x130f5a,_0x24b684,_0xba3e97){return new BPromise(function(_0x59cfeb,_0x256c84){var _0x353b47=_0xba3e97||client;return _0x353b47[_0x094c('0x1d')](_0x2d22cf,_0x24b684)[_0x094c('0x1e')](function(_0x5a1217){logger[_0x094c('0x1f')](_0x094c('0x20'),_0x130f5a,'request\x20sent');logger[_0x094c('0x21')](_0x094c('0x22'),_0x130f5a,_0x094c('0x23'),JSON['stringify'](_0x5a1217));if(_0x5a1217[_0x094c('0x24')]){if(_0x5a1217[_0x094c('0x24')]['code']===0x1f4){logger['error'](_0x094c('0x20'),_0x130f5a,_0x5a1217[_0x094c('0x24')]['message']);return _0x256c84(_0x5a1217[_0x094c('0x24')]['message']);}logger[_0x094c('0x24')]('Setting,\x20%s,\x20%s',_0x130f5a,_0x5a1217[_0x094c('0x24')][_0x094c('0x25')]);return _0x59cfeb(_0x5a1217[_0x094c('0x24')][_0x094c('0x25')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x130f5a,_0x094c('0x23'));_0x59cfeb(_0x5a1217[_0x094c('0x26')][_0x094c('0x25')]);}})['catch'](function(_0x4bb9d8){logger[_0x094c('0x24')](_0x094c('0x20'),_0x130f5a,_0x4bb9d8);_0x256c84(_0x4bb9d8);});});}function respondWithStatusCode(_0x21da16,_0x4a9a7b){_0x4a9a7b=_0x4a9a7b||0xcc;return function(_0x3c8647){if(_0x3c8647){return _0x21da16[_0x094c('0x27')](_0x4a9a7b);}return _0x21da16['status'](_0x4a9a7b)[_0x094c('0x28')]();};}function respondWithResult(_0xf73bc3,_0x23573a){_0x23573a=_0x23573a||0xc8;return function(_0x3d6dbb){if(_0x3d6dbb){return _0xf73bc3[_0x094c('0x29')](_0x23573a)[_0x094c('0x2a')](_0x3d6dbb);}};}function respondWithFilteredResult(_0x13d37b,_0xbc9953){return function(_0x253539){if(_0x253539){var _0x1708e5=typeof _0xbc9953[_0x094c('0x2b')]===_0x094c('0x2c')&&typeof _0xbc9953[_0x094c('0x2d')]===_0x094c('0x2c');var _0x1a5aa2=_0x253539[_0x094c('0x2e')];var _0x28af4e=_0x1708e5?0x0:_0xbc9953[_0x094c('0x2b')];var _0x2edd3f=_0x1708e5?_0x253539['count']:_0xbc9953[_0x094c('0x2b')]+_0xbc9953[_0x094c('0x2d')];var _0xe18ee3;if(_0x2edd3f>=_0x1a5aa2){_0x2edd3f=_0x1a5aa2;_0xe18ee3=0xc8;}else{_0xe18ee3=0xce;}_0x13d37b['status'](_0xe18ee3);return _0x13d37b[_0x094c('0x2f')]('Content-Range',_0x28af4e+'-'+_0x2edd3f+'/'+_0x1a5aa2)[_0x094c('0x2a')](_0x253539);}return null;};}function patchUpdates(_0x16976f){return function(_0x5d229d){try{jsonpatch[_0x094c('0x30')](_0x5d229d,_0x16976f,!![]);}catch(_0x3b057c){return BPromise['reject'](_0x3b057c);}return _0x5d229d[_0x094c('0x31')]();};}function saveUpdates(_0x478dd4,_0x4fa6b6){return function(_0x327d23){if(_0x327d23){return _0x327d23[_0x094c('0x32')](_0x478dd4)['then'](function(_0x57c38d){return _0x57c38d;});}return null;};}function removeEntity(_0x4352f3,_0x22bd35){return function(_0x13cd91){if(_0x13cd91){return _0x13cd91[_0x094c('0x33')]()[_0x094c('0x1e')](function(){_0x4352f3[_0x094c('0x29')](0xcc)[_0x094c('0x28')]();});}};}function handleEntityNotFound(_0xce860e,_0x3315e9){return function(_0x4d357c){if(!_0x4d357c){_0xce860e['sendStatus'](0x194);}return _0x4d357c;};}function handleError(_0x955e41,_0x4c59d8){_0x4c59d8=_0x4c59d8||0x1f4;return function(_0xa15387){logger[_0x094c('0x24')](_0xa15387['stack']);if(_0xa15387[_0x094c('0x34')]){delete _0xa15387[_0x094c('0x34')];}_0x955e41[_0x094c('0x29')](_0x4c59d8)[_0x094c('0x35')](_0xa15387);};}exports[_0x094c('0x36')]=function(_0x11c59a,_0x5c423c){var _0x1cb11c={},_0x5ad427={},_0x4431e5={'count':0x0,'rows':[]};var _0xcd107b=_[_0x094c('0x37')](db[_0x094c('0x38')][_0x094c('0x39')],function(_0x377bc2){return{'name':_0x377bc2[_0x094c('0x3a')],'type':_0x377bc2[_0x094c('0x3b')][_0x094c('0x3c')]};});_0x5ad427[_0x094c('0x3d')]=_['map'](_0xcd107b,_0x094c('0x34'));_0x5ad427[_0x094c('0x3e')]=_[_0x094c('0x3f')](_0x11c59a['query']);_0x5ad427[_0x094c('0x40')]=_[_0x094c('0x41')](_0x5ad427[_0x094c('0x3d')],_0x5ad427['query']);_0x1cb11c[_0x094c('0x42')]=_['intersection'](_0x5ad427[_0x094c('0x3d')],qs[_0x094c('0x43')](_0x11c59a[_0x094c('0x3e')][_0x094c('0x43')]));_0x1cb11c[_0x094c('0x42')]=_0x1cb11c[_0x094c('0x42')]['length']?_0x1cb11c['attributes']:_0x5ad427['model'];if(!_0x11c59a[_0x094c('0x3e')]['hasOwnProperty'](_0x094c('0x44'))){_0x1cb11c[_0x094c('0x2d')]=qs[_0x094c('0x2d')](_0x11c59a[_0x094c('0x3e')][_0x094c('0x2d')]);_0x1cb11c[_0x094c('0x2b')]=qs[_0x094c('0x2b')](_0x11c59a[_0x094c('0x3e')][_0x094c('0x2b')]);}_0x1cb11c[_0x094c('0x45')]=qs['sort'](_0x11c59a[_0x094c('0x3e')][_0x094c('0x46')]);_0x1cb11c['where']=qs[_0x094c('0x40')](_['pick'](_0x11c59a[_0x094c('0x3e')],_0x5ad427[_0x094c('0x40')]),_0xcd107b);if(_0x11c59a['query']['filter']){_0x1cb11c[_0x094c('0x47')]=_[_0x094c('0x48')](_0x1cb11c[_0x094c('0x47')],{'$or':_[_0x094c('0x37')](_0xcd107b,function(_0x25f092){if(_0x25f092[_0x094c('0x3b')]!==_0x094c('0x49')){var _0x4f5e7c={};_0x4f5e7c[_0x25f092[_0x094c('0x34')]]={'$like':'%'+_0x11c59a[_0x094c('0x3e')]['filter']+'%'};return _0x4f5e7c;}})});}_0x1cb11c=_[_0x094c('0x48')]({},_0x1cb11c,_0x11c59a[_0x094c('0x4a')]);var _0x21fa70={'where':_0x1cb11c[_0x094c('0x47')]};return db[_0x094c('0x38')][_0x094c('0x2e')](_0x21fa70)['then'](function(_0x22ec94){_0x4431e5['count']=_0x22ec94;if(_0x11c59a[_0x094c('0x3e')][_0x094c('0x4b')]){_0x1cb11c[_0x094c('0x4c')]=[{'all':!![]}];}return db[_0x094c('0x38')]['findAll'](_0x1cb11c);})[_0x094c('0x1e')](function(_0xd56b46){_0x4431e5[_0x094c('0x4d')]=_0xd56b46;return _0x4431e5;})[_0x094c('0x1e')](respondWithFilteredResult(_0x5c423c,_0x1cb11c))[_0x094c('0x4e')](handleError(_0x5c423c,null));};exports[_0x094c('0x4f')]=function(_0x8b697f,_0x426bf4){var _0x50b163={'raw':![],'where':{'id':_0x8b697f['params']['id']}},_0x4ca7a8={};_0x4ca7a8[_0x094c('0x3d')]=_[_0x094c('0x3f')](db['Setting']['rawAttributes']);_0x4ca7a8[_0x094c('0x3e')]=_[_0x094c('0x3f')](_0x8b697f['query']);_0x4ca7a8[_0x094c('0x40')]=_[_0x094c('0x41')](_0x4ca7a8[_0x094c('0x3d')],_0x4ca7a8['query']);_0x50b163[_0x094c('0x42')]=_[_0x094c('0x41')](_0x4ca7a8[_0x094c('0x3d')],qs[_0x094c('0x43')](_0x8b697f[_0x094c('0x3e')][_0x094c('0x43')]));_0x50b163['attributes']=_0x50b163[_0x094c('0x42')][_0x094c('0x50')]?_0x50b163[_0x094c('0x42')]:_0x4ca7a8[_0x094c('0x3d')];if(_0x8b697f['query'][_0x094c('0x4b')]){_0x50b163['include']=[{'all':!![]}];}_0x50b163=_[_0x094c('0x48')]({},_0x50b163,_0x8b697f['options']);return db['Setting'][_0x094c('0x51')](_0x50b163)['then'](handleEntityNotFound(_0x426bf4,null))[_0x094c('0x1e')](respondWithResult(_0x426bf4,null))[_0x094c('0x4e')](handleError(_0x426bf4,null));};exports[_0x094c('0x32')]=function(_0x235b97,_0x3b2eb4){if(_0x235b97[_0x094c('0x52')]['id']){delete _0x235b97['body']['id'];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x235b97['params']['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x3b2eb4,null))[_0x094c('0x1e')](saveUpdates(_0x235b97['body'],null))['then'](respondWithResult(_0x3b2eb4,null))[_0x094c('0x4e')](handleError(_0x3b2eb4,null));};exports['addLogo']=function(_0x554fae,_0x497f19,_0x2622c5){if(_0x554fae[_0x094c('0x53')]&&_0x554fae['file']['filename']){_0x554fae['body']['logo']=_0x554fae[_0x094c('0x53')]['filename'];}return db['Setting'][_0x094c('0x51')]({'where':{'id':_0x554fae[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x497f19,null))[_0x094c('0x1e')](saveUpdates(_0x554fae[_0x094c('0x52')],null))[_0x094c('0x1e')](respondWithResult(_0x497f19,null))['catch'](handleError(_0x497f19,null));};exports['addLogoLogin']=function(_0x2616d5,_0x18a09f,_0x2a0ad8){if(_0x2616d5[_0x094c('0x53')]&&_0x2616d5[_0x094c('0x53')]['filename']){_0x2616d5[_0x094c('0x52')]['loginLogo']=_0x2616d5[_0x094c('0x53')][_0x094c('0x55')];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x2616d5[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x18a09f,null))[_0x094c('0x1e')](saveUpdates(_0x2616d5[_0x094c('0x52')],null))['then'](respondWithResult(_0x18a09f,null))[_0x094c('0x4e')](handleError(_0x18a09f,null));};var utilLicense=require(_0x094c('0x18'));exports['getLogo']=function(_0x3b284e,_0x4f5c25,_0x52b4c6){var _0x355bfc=_0x094c('0x56');var _0x3ded14={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x26df1f){if(_0x26df1f){_0x3ded14=_0x26df1f;}return db[_0x094c('0x38')]['find']({'where':{'id':_0x3b284e['params']['id']},'attributes':[_0x094c('0x58'),'loginLogo',_0x094c('0x59'),_0x094c('0x5a'),_0x094c('0x5b'),'defaultLoginLogo',_0x094c('0x5c'),_0x094c('0x5d')],'raw':!![]});})[_0x094c('0x1e')](handleEntityNotFound(_0x4f5c25,null))[_0x094c('0x1e')](function(_0x23bca4){if(_0x23bca4){var _0x5825a0=_0x23bca4[_0x094c('0x58')]&&fs[_0x094c('0x5e')](path[_0x094c('0x5f')](config['root'],_0x355bfc,_['toLower'](_0x23bca4['logo'])))?path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x355bfc,_[_0x094c('0x61')](_0x23bca4['logo'])):path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x355bfc,_[_0x094c('0x61')]('default_logo.svg'));var _0x5e5ea9='default'+_['upperFirst'](_0x094c('0x58'));if(_0x23bca4[_0x5e5ea9]||!_0x3ded14[_0x094c('0x62')]){_0x5825a0=path[_0x094c('0x5f')](config['root'],_0x355bfc,_[_0x094c('0x61')]('default_logo.svg'));}if(!fs[_0x094c('0x5e')](_0x5825a0)){throw new db[(_0x094c('0x63'))][(_0x094c('0x64'))](_[_0x094c('0x65')](_0x094c('0x58'))+_0x094c('0x66'));}return _0x4f5c25['download'](_0x5825a0);}})[_0x094c('0x4e')](handleError(_0x4f5c25,null));};var utilLicense=require(_0x094c('0x18'));exports[_0x094c('0x67')]=function(_0x3ba3a6,_0x1350db,_0x5674dc){var _0x3ff4bb=_0x094c('0x56');var _0x5dfb09={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x447183){if(_0x447183){_0x5dfb09=_0x447183;}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x3ba3a6[_0x094c('0x54')]['id']},'attributes':[_0x094c('0x58'),_0x094c('0x68'),_0x094c('0x59'),'favicon',_0x094c('0x5b'),_0x094c('0x69'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x094c('0x1e')](handleEntityNotFound(_0x1350db,null))['then'](function(_0x525267){if(_0x525267){var _0x5c5f8f=_0x525267[_0x094c('0x68')]&&fs[_0x094c('0x5e')](path['join'](config['root'],_0x3ff4bb,_[_0x094c('0x61')](_0x525267[_0x094c('0x68')])))?path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x3ff4bb,_[_0x094c('0x61')](_0x525267[_0x094c('0x68')])):path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x3ff4bb,_['toLower'](_0x094c('0x6a')));var _0x2665e6=_0x094c('0x6b')+_['upperFirst'](_0x094c('0x68'));if(_0x525267[_0x2665e6]||!_0x5dfb09[_0x094c('0x62')]){_0x5c5f8f=path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x3ff4bb,_[_0x094c('0x61')](_0x094c('0x6a')));}if(!fs['existsSync'](_0x5c5f8f)){throw new db[(_0x094c('0x63'))][(_0x094c('0x64'))](_['upperFirst'](_0x094c('0x68'))+_0x094c('0x66'));}return _0x1350db['download'](_0x5c5f8f);}})[_0x094c('0x4e')](handleError(_0x1350db,null));};exports['gdpr']=function(_0x592097,_0x25d554){return db[_0x094c('0x38')]['find']({'where':{'id':_0x592097[_0x094c('0x54')]['id']},'attributes':[_0x094c('0x6c')]})[_0x094c('0x1e')](respondWithResult(_0x25d554,null))[_0x094c('0x4e')](handleError(_0x25d554,null));};exports[_0x094c('0x6d')]=function(_0x337bbc,_0x4925cf,_0x886d3e){if(_0x337bbc[_0x094c('0x53')]&&_0x337bbc[_0x094c('0x53')][_0x094c('0x55')]){_0x337bbc[_0x094c('0x52')][_0x094c('0x59')]=_0x337bbc[_0x094c('0x53')]['filename'];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x337bbc[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x4925cf,null))['then'](saveUpdates(_0x337bbc[_0x094c('0x52')],null))['then'](respondWithResult(_0x4925cf,null))['catch'](handleError(_0x4925cf,null));};var utilLicense=require(_0x094c('0x18'));exports[_0x094c('0x6e')]=function(_0xc2606c,_0x18a0ec,_0x5c6417){var _0x1b0351=_0x094c('0x56');var _0x3ee24f={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x25e738){if(_0x25e738){_0x3ee24f=_0x25e738;}return db['Setting'][_0x094c('0x51')]({'where':{'id':_0xc2606c['params']['id']},'attributes':[_0x094c('0x58'),_0x094c('0x68'),'preferred',_0x094c('0x5a'),_0x094c('0x5b'),_0x094c('0x69'),_0x094c('0x5c'),_0x094c('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x18a0ec,null))['then'](function(_0x448ebe){if(_0x448ebe){var _0x6bea7a=_0x448ebe[_0x094c('0x59')]&&fs['existsSync'](path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x1b0351,_['toLower'](_0x448ebe[_0x094c('0x59')])))?path['join'](config[_0x094c('0x60')],_0x1b0351,_[_0x094c('0x61')](_0x448ebe[_0x094c('0x59')])):path['join'](config['root'],_0x1b0351,_[_0x094c('0x61')](_0x094c('0x6f')));var _0x3a0bcd=_0x094c('0x6b')+_[_0x094c('0x65')](_0x094c('0x59'));if(_0x448ebe[_0x3a0bcd]||!_0x3ee24f[_0x094c('0x62')]||!_0x3ee24f[_0x094c('0x59')]){_0x6bea7a=path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x1b0351,_[_0x094c('0x61')](_0x094c('0x6f')));}if(!fs[_0x094c('0x5e')](_0x6bea7a)){throw new db['Sequelize'][(_0x094c('0x64'))](_[_0x094c('0x65')](_0x094c('0x59'))+_0x094c('0x66'));}return _0x18a0ec['download'](_0x6bea7a);}})[_0x094c('0x4e')](handleError(_0x18a0ec,null));};exports['addFavicon']=function(_0x1be953,_0x12e9c6,_0x52c4e0){if(_0x1be953[_0x094c('0x53')]&&_0x1be953[_0x094c('0x53')][_0x094c('0x55')]){_0x1be953[_0x094c('0x52')][_0x094c('0x5a')]=_0x1be953['file'][_0x094c('0x55')];}return db[_0x094c('0x38')][_0x094c('0x51')]({'where':{'id':_0x1be953[_0x094c('0x54')]['id']}})[_0x094c('0x1e')](handleEntityNotFound(_0x12e9c6,null))[_0x094c('0x1e')](saveUpdates(_0x1be953[_0x094c('0x52')],null))[_0x094c('0x1e')](respondWithResult(_0x12e9c6,null))[_0x094c('0x4e')](handleError(_0x12e9c6,null));};var utilLicense=require(_0x094c('0x18'));exports[_0x094c('0x70')]=function(_0x326318,_0x5e16d6,_0x1cc657){var _0x54bc3e=_0x094c('0x56');var _0x3bf5ee={'custom':![]};return utilLicense[_0x094c('0x57')]()[_0x094c('0x1e')](function(_0x16aab8){if(_0x16aab8){_0x3bf5ee=_0x16aab8;}return db['Setting'][_0x094c('0x51')]({'where':{'id':_0x326318[_0x094c('0x54')]['id']},'attributes':[_0x094c('0x58'),_0x094c('0x68'),_0x094c('0x59'),_0x094c('0x5a'),_0x094c('0x5b'),_0x094c('0x69'),_0x094c('0x5c'),_0x094c('0x5d')],'raw':!![]});})[_0x094c('0x1e')](handleEntityNotFound(_0x5e16d6,null))[_0x094c('0x1e')](function(_0x1dde0b){if(_0x1dde0b){var _0x28de66=_0x1dde0b['favicon']&&fs[_0x094c('0x5e')](path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x54bc3e,_[_0x094c('0x61')](_0x1dde0b[_0x094c('0x5a')])))?path['join'](config[_0x094c('0x60')],_0x54bc3e,_[_0x094c('0x61')](_0x1dde0b['favicon'])):path['join'](config['root'],_0x54bc3e,_[_0x094c('0x61')](_0x094c('0x71')));var _0x1bf308=_0x094c('0x6b')+_['upperFirst'](_0x094c('0x5a'));if(_0x1dde0b[_0x1bf308]||!_0x3bf5ee[_0x094c('0x62')]){_0x28de66=path[_0x094c('0x5f')](config[_0x094c('0x60')],_0x54bc3e,_[_0x094c('0x61')](_0x094c('0x71')));}if(!fs['existsSync'](_0x28de66)){throw new db[(_0x094c('0x63'))][(_0x094c('0x64'))](_[_0x094c('0x65')](_0x094c('0x5a'))+_0x094c('0x66'));}return _0x5e16d6['download'](_0x28de66);}})[_0x094c('0x4e')](handleError(_0x5e16d6,null));};exports[_0x094c('0x72')]=function(_0x499337,_0x58a4c0){var _0x58e383={'offset':moment()['utcOffset']()};_0x58e383[_0x094c('0x73')]=moment()[_0x094c('0x74')](_0x58e383['offset'])[_0x094c('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x58a4c0[_0x094c('0x29')](0xc8)['send'](_0x58e383);}; \ No newline at end of file +var _0x90cd=['map','Setting','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','rawAttributes','filters','include','options','find','body','addLogo','file','filename','logo','addLogoLogin','params','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','../../config/license/util','defaultLogo','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index'];(function(_0x14ae70,_0x5e8bf2){var _0x5011b5=function(_0x3a0aff){while(--_0x3a0aff){_0x14ae70['push'](_0x14ae70['shift']());}};_0x5011b5(++_0x5e8bf2);}(_0x90cd,0x1bf));var _0xd90c=function(_0xf6c032,_0x3515ad){_0xf6c032=_0xf6c032-0x0;var _0x5da177=_0x90cd[_0xf6c032];return _0x5da177;};'use strict';var emlformat=require(_0xd90c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd90c('0x1'));var jsonpatch=require(_0xd90c('0x2'));var rp=require('request-promise');var moment=require(_0xd90c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd90c('0x4'));var util=require(_0xd90c('0x5'));var path=require(_0xd90c('0x6'));var sox=require(_0xd90c('0x7'));var csv=require(_0xd90c('0x8'));var ejs=require(_0xd90c('0x9'));var fs=require('fs');var fs_extra=require(_0xd90c('0xa'));var _=require(_0xd90c('0xb'));var squel=require(_0xd90c('0xc'));var crypto=require(_0xd90c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd90c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd90c('0xf'));var Papa=require(_0xd90c('0x10'));var Redis=require(_0xd90c('0x11'));var authService=require(_0xd90c('0x12'));var qs=require(_0xd90c('0x13'));var as=require(_0xd90c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd90c('0x15'))(_0xd90c('0x16'));var utils=require('../../config/utils');var config=require(_0xd90c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd90c('0x18'))['db'];var jayson=require(_0xd90c('0x19'));var client=jayson[_0xd90c('0x1a')][_0xd90c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x45358f,_0x5e1da2,_0x3ba02e,_0x5d2c5c){return new BPromise(function(_0x5d1046,_0x554170){var _0xf3236e=_0x5d2c5c||client;return _0xf3236e[_0xd90c('0x1c')](_0x45358f,_0x3ba02e)[_0xd90c('0x1d')](function(_0x3ed34d){logger[_0xd90c('0x1e')](_0xd90c('0x1f'),_0x5e1da2,'request\x20sent');logger[_0xd90c('0x20')](_0xd90c('0x21'),_0x5e1da2,_0xd90c('0x22'),JSON[_0xd90c('0x23')](_0x3ed34d));if(_0x3ed34d['error']){if(_0x3ed34d['error'][_0xd90c('0x24')]===0x1f4){logger[_0xd90c('0x25')](_0xd90c('0x1f'),_0x5e1da2,_0x3ed34d['error'][_0xd90c('0x26')]);return _0x554170(_0x3ed34d['error'][_0xd90c('0x26')]);}logger['error'](_0xd90c('0x1f'),_0x5e1da2,_0x3ed34d[_0xd90c('0x25')]['message']);return _0x5d1046(_0x3ed34d[_0xd90c('0x25')]['message']);}else{logger[_0xd90c('0x1e')](_0xd90c('0x1f'),_0x5e1da2,_0xd90c('0x22'));_0x5d1046(_0x3ed34d[_0xd90c('0x27')][_0xd90c('0x26')]);}})[_0xd90c('0x28')](function(_0x5919ee){logger['error'](_0xd90c('0x1f'),_0x5e1da2,_0x5919ee);_0x554170(_0x5919ee);});});}function respondWithStatusCode(_0x2ca8c7,_0x28ece2){_0x28ece2=_0x28ece2||0xcc;return function(_0x5e6b3b){if(_0x5e6b3b){return _0x2ca8c7['sendStatus'](_0x28ece2);}return _0x2ca8c7[_0xd90c('0x29')](_0x28ece2)[_0xd90c('0x2a')]();};}function respondWithResult(_0x38476b,_0x9be5f1){_0x9be5f1=_0x9be5f1||0xc8;return function(_0x45332f){if(_0x45332f){return _0x38476b[_0xd90c('0x29')](_0x9be5f1)[_0xd90c('0x2b')](_0x45332f);}};}function respondWithFilteredResult(_0x1ebc57,_0x43b863){return function(_0x4bb4b9){if(_0x4bb4b9){var _0x5ae32d=typeof _0x43b863[_0xd90c('0x2c')]==='undefined'&&typeof _0x43b863[_0xd90c('0x2d')]==='undefined';var _0x78c71b=_0x4bb4b9[_0xd90c('0x2e')];var _0x7041d=_0x5ae32d?0x0:_0x43b863[_0xd90c('0x2c')];var _0x545f22=_0x5ae32d?_0x4bb4b9[_0xd90c('0x2e')]:_0x43b863['offset']+_0x43b863['limit'];var _0x5294f5;if(_0x545f22>=_0x78c71b){_0x545f22=_0x78c71b;_0x5294f5=0xc8;}else{_0x5294f5=0xce;}_0x1ebc57[_0xd90c('0x29')](_0x5294f5);return _0x1ebc57[_0xd90c('0x2f')](_0xd90c('0x30'),_0x7041d+'-'+_0x545f22+'/'+_0x78c71b)[_0xd90c('0x2b')](_0x4bb4b9);}return null;};}function patchUpdates(_0x1e8d85){return function(_0xce3c51){try{jsonpatch[_0xd90c('0x31')](_0xce3c51,_0x1e8d85,!![]);}catch(_0x1de50d){return BPromise[_0xd90c('0x32')](_0x1de50d);}return _0xce3c51[_0xd90c('0x33')]();};}function saveUpdates(_0x10dfb8,_0x395563){return function(_0x5b7bbe){if(_0x5b7bbe){return _0x5b7bbe[_0xd90c('0x34')](_0x10dfb8)['then'](function(_0x4122f9){return _0x4122f9;});}return null;};}function removeEntity(_0xfaa014,_0x2d6d81){return function(_0x16c251){if(_0x16c251){return _0x16c251[_0xd90c('0x35')]()[_0xd90c('0x1d')](function(){_0xfaa014[_0xd90c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x535f80,_0x419dc6){return function(_0xc1833f){if(!_0xc1833f){_0x535f80['sendStatus'](0x194);}return _0xc1833f;};}function handleError(_0xbb291,_0x23936e){_0x23936e=_0x23936e||0x1f4;return function(_0x21632f){logger[_0xd90c('0x25')](_0x21632f['stack']);if(_0x21632f['name']){delete _0x21632f[_0xd90c('0x36')];}_0xbb291[_0xd90c('0x29')](_0x23936e)[_0xd90c('0x37')](_0x21632f);};}exports[_0xd90c('0x38')]=function(_0x3d751f,_0x476f25){var _0xfcc846={},_0x231699={},_0x90569={'count':0x0,'rows':[]};var _0x45924a=_[_0xd90c('0x39')](db[_0xd90c('0x3a')]['rawAttributes'],function(_0x1a6d2){return{'name':_0x1a6d2[_0xd90c('0x3b')],'type':_0x1a6d2[_0xd90c('0x3c')]['key']};});_0x231699[_0xd90c('0x3d')]=_[_0xd90c('0x39')](_0x45924a,_0xd90c('0x36'));_0x231699['query']=_[_0xd90c('0x3e')](_0x3d751f[_0xd90c('0x3f')]);_0x231699['filters']=_[_0xd90c('0x40')](_0x231699['model'],_0x231699[_0xd90c('0x3f')]);_0xfcc846['attributes']=_[_0xd90c('0x40')](_0x231699['model'],qs['fields'](_0x3d751f[_0xd90c('0x3f')][_0xd90c('0x41')]));_0xfcc846[_0xd90c('0x42')]=_0xfcc846[_0xd90c('0x42')][_0xd90c('0x43')]?_0xfcc846[_0xd90c('0x42')]:_0x231699[_0xd90c('0x3d')];if(!_0x3d751f[_0xd90c('0x3f')][_0xd90c('0x44')](_0xd90c('0x45'))){_0xfcc846[_0xd90c('0x2d')]=qs['limit'](_0x3d751f[_0xd90c('0x3f')]['limit']);_0xfcc846[_0xd90c('0x2c')]=qs['offset'](_0x3d751f[_0xd90c('0x3f')][_0xd90c('0x2c')]);}_0xfcc846['order']=qs[_0xd90c('0x46')](_0x3d751f[_0xd90c('0x3f')][_0xd90c('0x46')]);_0xfcc846[_0xd90c('0x47')]=qs['filters'](_[_0xd90c('0x48')](_0x3d751f[_0xd90c('0x3f')],_0x231699['filters']),_0x45924a);if(_0x3d751f['query'][_0xd90c('0x49')]){_0xfcc846['where']=_[_0xd90c('0x4a')](_0xfcc846[_0xd90c('0x47')],{'$or':_[_0xd90c('0x39')](_0x45924a,function(_0x115e3f){if(_0x115e3f[_0xd90c('0x3c')]!==_0xd90c('0x4b')){var _0x4866aa={};_0x4866aa[_0x115e3f['name']]={'$like':'%'+_0x3d751f['query'][_0xd90c('0x49')]+'%'};return _0x4866aa;}})});}_0xfcc846=_[_0xd90c('0x4a')]({},_0xfcc846,_0x3d751f['options']);var _0x15aaa5={'where':_0xfcc846[_0xd90c('0x47')]};return db[_0xd90c('0x3a')]['count'](_0x15aaa5)[_0xd90c('0x1d')](function(_0x2a623b){_0x90569[_0xd90c('0x2e')]=_0x2a623b;if(_0x3d751f[_0xd90c('0x3f')][_0xd90c('0x4c')]){_0xfcc846['include']=[{'all':!![]}];}return db[_0xd90c('0x3a')]['findAll'](_0xfcc846);})[_0xd90c('0x1d')](function(_0x135fc3){_0x90569[_0xd90c('0x4d')]=_0x135fc3;return _0x90569;})[_0xd90c('0x1d')](respondWithFilteredResult(_0x476f25,_0xfcc846))[_0xd90c('0x28')](handleError(_0x476f25,null));};exports[_0xd90c('0x4e')]=function(_0x1e7dd0,_0x31a2ef){var _0x4c646f={'raw':![],'where':{'id':_0x1e7dd0['params']['id']}},_0x44d62f={};_0x44d62f[_0xd90c('0x3d')]=_[_0xd90c('0x3e')](db[_0xd90c('0x3a')][_0xd90c('0x4f')]);_0x44d62f[_0xd90c('0x3f')]=_[_0xd90c('0x3e')](_0x1e7dd0[_0xd90c('0x3f')]);_0x44d62f[_0xd90c('0x50')]=_[_0xd90c('0x40')](_0x44d62f[_0xd90c('0x3d')],_0x44d62f['query']);_0x4c646f['attributes']=_['intersection'](_0x44d62f[_0xd90c('0x3d')],qs[_0xd90c('0x41')](_0x1e7dd0[_0xd90c('0x3f')][_0xd90c('0x41')]));_0x4c646f[_0xd90c('0x42')]=_0x4c646f[_0xd90c('0x42')]['length']?_0x4c646f[_0xd90c('0x42')]:_0x44d62f['model'];if(_0x1e7dd0[_0xd90c('0x3f')]['includeAll']){_0x4c646f[_0xd90c('0x51')]=[{'all':!![]}];}_0x4c646f=_[_0xd90c('0x4a')]({},_0x4c646f,_0x1e7dd0[_0xd90c('0x52')]);return db['Setting'][_0xd90c('0x53')](_0x4c646f)[_0xd90c('0x1d')](handleEntityNotFound(_0x31a2ef,null))[_0xd90c('0x1d')](respondWithResult(_0x31a2ef,null))[_0xd90c('0x28')](handleError(_0x31a2ef,null));};exports[_0xd90c('0x34')]=function(_0x2cbc40,_0x3f92e7){if(_0x2cbc40[_0xd90c('0x54')]['id']){delete _0x2cbc40[_0xd90c('0x54')]['id'];}return db[_0xd90c('0x3a')]['find']({'where':{'id':_0x2cbc40['params']['id']}})[_0xd90c('0x1d')](handleEntityNotFound(_0x3f92e7,null))[_0xd90c('0x1d')](saveUpdates(_0x2cbc40['body'],null))['then'](respondWithResult(_0x3f92e7,null))[_0xd90c('0x28')](handleError(_0x3f92e7,null));};exports[_0xd90c('0x55')]=function(_0x139fd0,_0x3adc32,_0x51a105){if(_0x139fd0[_0xd90c('0x56')]&&_0x139fd0['file'][_0xd90c('0x57')]){_0x139fd0[_0xd90c('0x54')][_0xd90c('0x58')]=_0x139fd0['file'][_0xd90c('0x57')];}return db[_0xd90c('0x3a')][_0xd90c('0x53')]({'where':{'id':_0x139fd0['params']['id']}})[_0xd90c('0x1d')](handleEntityNotFound(_0x3adc32,null))['then'](saveUpdates(_0x139fd0['body'],null))[_0xd90c('0x1d')](respondWithResult(_0x3adc32,null))[_0xd90c('0x28')](handleError(_0x3adc32,null));};exports[_0xd90c('0x59')]=function(_0x1ae8fb,_0x5b3081,_0xe83572){if(_0x1ae8fb['file']&&_0x1ae8fb['file'][_0xd90c('0x57')]){_0x1ae8fb[_0xd90c('0x54')]['loginLogo']=_0x1ae8fb[_0xd90c('0x56')][_0xd90c('0x57')];}return db[_0xd90c('0x3a')]['find']({'where':{'id':_0x1ae8fb[_0xd90c('0x5a')]['id']}})[_0xd90c('0x1d')](handleEntityNotFound(_0x5b3081,null))[_0xd90c('0x1d')](saveUpdates(_0x1ae8fb[_0xd90c('0x54')],null))[_0xd90c('0x1d')](respondWithResult(_0x5b3081,null))[_0xd90c('0x28')](handleError(_0x5b3081,null));};var utilLicense=require('../../config/license/util');exports[_0xd90c('0x5b')]=function(_0x47e49a,_0x2c63a9,_0x4b9086){var _0x2ed140=_0xd90c('0x5c');var _0x1bf466={'custom':![]};return utilLicense[_0xd90c('0x5d')]()[_0xd90c('0x1d')](function(_0x551ca2){if(_0x551ca2){_0x1bf466=_0x551ca2;}return db[_0xd90c('0x3a')][_0xd90c('0x53')]({'where':{'id':_0x47e49a[_0xd90c('0x5a')]['id']},'attributes':[_0xd90c('0x58'),_0xd90c('0x5e'),_0xd90c('0x5f'),_0xd90c('0x60'),'defaultLogo',_0xd90c('0x61'),_0xd90c('0x62'),_0xd90c('0x63')],'raw':!![]});})[_0xd90c('0x1d')](handleEntityNotFound(_0x2c63a9,null))[_0xd90c('0x1d')](function(_0x3367f9){if(_0x3367f9){var _0x4b4531=_0x3367f9[_0xd90c('0x58')]&&fs[_0xd90c('0x64')](path[_0xd90c('0x65')](config['root'],_0x2ed140,_['toLower'](_0x3367f9['logo'])))?path[_0xd90c('0x65')](config['root'],_0x2ed140,_['toLower'](_0x3367f9[_0xd90c('0x58')])):path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x2ed140,_[_0xd90c('0x67')](_0xd90c('0x68')));var _0x419cc6=_0xd90c('0x69')+_[_0xd90c('0x6a')](_0xd90c('0x58'));if(_0x3367f9[_0x419cc6]||!_0x1bf466[_0xd90c('0x6b')]){_0x4b4531=path[_0xd90c('0x65')](config['root'],_0x2ed140,_[_0xd90c('0x67')]('default_logo.svg'));}if(!fs[_0xd90c('0x64')](_0x4b4531)){throw new db[(_0xd90c('0x6c'))][(_0xd90c('0x6d'))](_['upperFirst'](_0xd90c('0x58'))+_0xd90c('0x6e'));}return _0x2c63a9[_0xd90c('0x6f')](_0x4b4531);}})[_0xd90c('0x28')](handleError(_0x2c63a9,null));};var utilLicense=require(_0xd90c('0x70'));exports['getLogoLogin']=function(_0x5bdd88,_0x183f04,_0x8fe498){var _0x2e932f=_0xd90c('0x5c');var _0x33ccf8={'custom':![]};return utilLicense[_0xd90c('0x5d')]()[_0xd90c('0x1d')](function(_0x5b4bd2){if(_0x5b4bd2){_0x33ccf8=_0x5b4bd2;}return db['Setting'][_0xd90c('0x53')]({'where':{'id':_0x5bdd88[_0xd90c('0x5a')]['id']},'attributes':['logo',_0xd90c('0x5e'),_0xd90c('0x5f'),_0xd90c('0x60'),_0xd90c('0x71'),_0xd90c('0x61'),'defaultPreferred',_0xd90c('0x63')],'raw':!![]});})[_0xd90c('0x1d')](handleEntityNotFound(_0x183f04,null))[_0xd90c('0x1d')](function(_0x22679a){if(_0x22679a){var _0x268e67=_0x22679a[_0xd90c('0x5e')]&&fs[_0xd90c('0x64')](path[_0xd90c('0x65')](config['root'],_0x2e932f,_[_0xd90c('0x67')](_0x22679a[_0xd90c('0x5e')])))?path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x2e932f,_[_0xd90c('0x67')](_0x22679a[_0xd90c('0x5e')])):path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x2e932f,_[_0xd90c('0x67')](_0xd90c('0x72')));var _0x48ee6a=_0xd90c('0x69')+_[_0xd90c('0x6a')](_0xd90c('0x5e'));if(_0x22679a[_0x48ee6a]||!_0x33ccf8['custom']){_0x268e67=path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x2e932f,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xd90c('0x64')](_0x268e67)){throw new db[(_0xd90c('0x6c'))][(_0xd90c('0x6d'))](_[_0xd90c('0x6a')]('loginLogo')+_0xd90c('0x6e'));}return _0x183f04[_0xd90c('0x6f')](_0x268e67);}})[_0xd90c('0x28')](handleError(_0x183f04,null));};exports[_0xd90c('0x73')]=function(_0x1cd9a7,_0x1919bf){return db[_0xd90c('0x3a')][_0xd90c('0x53')]({'where':{'id':_0x1cd9a7[_0xd90c('0x5a')]['id']},'attributes':['securePassword']})[_0xd90c('0x1d')](respondWithResult(_0x1919bf,null))[_0xd90c('0x28')](handleError(_0x1919bf,null));};exports[_0xd90c('0x74')]=function(_0x10bc6e,_0x12cb76,_0x4a4dac){if(_0x10bc6e[_0xd90c('0x56')]&&_0x10bc6e['file']['filename']){_0x10bc6e[_0xd90c('0x54')]['preferred']=_0x10bc6e[_0xd90c('0x56')][_0xd90c('0x57')];}return db[_0xd90c('0x3a')][_0xd90c('0x53')]({'where':{'id':_0x10bc6e[_0xd90c('0x5a')]['id']}})[_0xd90c('0x1d')](handleEntityNotFound(_0x12cb76,null))[_0xd90c('0x1d')](saveUpdates(_0x10bc6e[_0xd90c('0x54')],null))[_0xd90c('0x1d')](respondWithResult(_0x12cb76,null))['catch'](handleError(_0x12cb76,null));};var utilLicense=require(_0xd90c('0x70'));exports[_0xd90c('0x75')]=function(_0x57d761,_0x5084f1,_0x1f1f21){var _0x3e7f9b='server/files/images/logos';var _0x253880={'custom':![]};return utilLicense[_0xd90c('0x5d')]()[_0xd90c('0x1d')](function(_0x6e8a00){if(_0x6e8a00){_0x253880=_0x6e8a00;}return db[_0xd90c('0x3a')][_0xd90c('0x53')]({'where':{'id':_0x57d761[_0xd90c('0x5a')]['id']},'attributes':[_0xd90c('0x58'),'loginLogo','preferred',_0xd90c('0x60'),_0xd90c('0x71'),_0xd90c('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xd90c('0x1d')](handleEntityNotFound(_0x5084f1,null))[_0xd90c('0x1d')](function(_0x27c78a){if(_0x27c78a){var _0x35db6f=_0x27c78a[_0xd90c('0x5f')]&&fs['existsSync'](path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x3e7f9b,_[_0xd90c('0x67')](_0x27c78a[_0xd90c('0x5f')])))?path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x3e7f9b,_['toLower'](_0x27c78a['preferred'])):path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x3e7f9b,_[_0xd90c('0x67')](_0xd90c('0x76')));var _0x59b18d='default'+_['upperFirst'](_0xd90c('0x5f'));if(_0x27c78a[_0x59b18d]||!_0x253880[_0xd90c('0x6b')]||!_0x253880['preferred']){_0x35db6f=path[_0xd90c('0x65')](config['root'],_0x3e7f9b,_['toLower'](_0xd90c('0x76')));}if(!fs[_0xd90c('0x64')](_0x35db6f)){throw new db[(_0xd90c('0x6c'))][(_0xd90c('0x6d'))](_['upperFirst']('preferred')+'\x20not\x20found');}return _0x5084f1[_0xd90c('0x6f')](_0x35db6f);}})['catch'](handleError(_0x5084f1,null));};exports[_0xd90c('0x77')]=function(_0x5dfc4d,_0x45438,_0x15f989){if(_0x5dfc4d[_0xd90c('0x56')]&&_0x5dfc4d[_0xd90c('0x56')][_0xd90c('0x57')]){_0x5dfc4d['body'][_0xd90c('0x60')]=_0x5dfc4d[_0xd90c('0x56')]['filename'];}return db[_0xd90c('0x3a')][_0xd90c('0x53')]({'where':{'id':_0x5dfc4d[_0xd90c('0x5a')]['id']}})[_0xd90c('0x1d')](handleEntityNotFound(_0x45438,null))['then'](saveUpdates(_0x5dfc4d[_0xd90c('0x54')],null))[_0xd90c('0x1d')](respondWithResult(_0x45438,null))['catch'](handleError(_0x45438,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x49daef,_0x454f0f,_0x4e3b8e){var _0x535832=_0xd90c('0x5c');var _0x16496f={'custom':![]};return utilLicense[_0xd90c('0x5d')]()['then'](function(_0x4bdbfc){if(_0x4bdbfc){_0x16496f=_0x4bdbfc;}return db['Setting'][_0xd90c('0x53')]({'where':{'id':_0x49daef[_0xd90c('0x5a')]['id']},'attributes':[_0xd90c('0x58'),'loginLogo',_0xd90c('0x5f'),'favicon',_0xd90c('0x71'),_0xd90c('0x61'),_0xd90c('0x62'),_0xd90c('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x454f0f,null))[_0xd90c('0x1d')](function(_0x2c936c){if(_0x2c936c){var _0x4d1c4d=_0x2c936c[_0xd90c('0x60')]&&fs[_0xd90c('0x64')](path[_0xd90c('0x65')](config['root'],_0x535832,_[_0xd90c('0x67')](_0x2c936c['favicon'])))?path[_0xd90c('0x65')](config['root'],_0x535832,_[_0xd90c('0x67')](_0x2c936c[_0xd90c('0x60')])):path[_0xd90c('0x65')](config[_0xd90c('0x66')],_0x535832,_['toLower'](_0xd90c('0x78')));var _0x3d5fef=_0xd90c('0x69')+_[_0xd90c('0x6a')](_0xd90c('0x60'));if(_0x2c936c[_0x3d5fef]||!_0x16496f[_0xd90c('0x6b')]){_0x4d1c4d=path[_0xd90c('0x65')](config['root'],_0x535832,_[_0xd90c('0x67')](_0xd90c('0x78')));}if(!fs[_0xd90c('0x64')](_0x4d1c4d)){throw new db[(_0xd90c('0x6c'))]['ValidationError'](_[_0xd90c('0x6a')](_0xd90c('0x60'))+_0xd90c('0x6e'));}return _0x454f0f['download'](_0x4d1c4d);}})[_0xd90c('0x28')](handleError(_0x454f0f,null));};exports[_0xd90c('0x79')]=function(_0x2f1043,_0x9a9c22){var _0x5eead4={'offset':moment()[_0xd90c('0x7a')]()};_0x5eead4[_0xd90c('0x7b')]=moment()[_0xd90c('0x7a')](_0x5eead4[_0xd90c('0x2c')])[_0xd90c('0x7c')](_0xd90c('0x7d'));return _0x9a9c22['status'](0xc8)['send'](_0x5eead4);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a4ad9f9..8d52f93 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x55ca,0x126));var _0xa55c=function(_0x5deb0a,_0xc192bb){_0x5deb0a=_0x5deb0a-0x0;var _0x33d0ce=_0x55ca[_0x5deb0a];return _0x33d0ce;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 4236d9e..a88224b 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 _0x9da5=['options','raw','where','include','model','attributes','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find'];(function(_0xa35c4e,_0x1c5d3b){var _0x3c946a=function(_0x1b28bd){while(--_0x1b28bd){_0xa35c4e['push'](_0xa35c4e['shift']());}};_0x3c946a(++_0x1c5d3b);}(_0x9da5,0x1b8));var _0x59da=function(_0x3e49fe,_0x552dba){_0x3e49fe=_0x3e49fe-0x0;var _0x150873=_0x9da5[_0x3e49fe];return _0x150873;};'use strict';var _=require(_0x59da('0x0'));var util=require(_0x59da('0x1'));var moment=require(_0x59da('0x2'));var BPromise=require(_0x59da('0x3'));var rs=require(_0x59da('0x4'));var fs=require('fs');var Redis=require(_0x59da('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x59da('0x6'));var logger=require(_0x59da('0x7'))(_0x59da('0x8'));var config=require(_0x59da('0x9'));var jayson=require(_0x59da('0xa'));var client=jayson[_0x59da('0xb')][_0x59da('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c3e1d,_0x290eda,_0x7996b1){return new BPromise(function(_0x4b3b3a,_0x3f1051){return client[_0x59da('0xd')](_0x2c3e1d,_0x7996b1)['then'](function(_0x869a56){logger[_0x59da('0xe')](_0x59da('0xf'),_0x290eda,_0x59da('0x10'));logger[_0x59da('0x11')](_0x59da('0x12'),_0x290eda,_0x59da('0x10'),JSON[_0x59da('0x13')](_0x869a56));if(_0x869a56[_0x59da('0x14')]){if(_0x869a56['error'][_0x59da('0x15')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x290eda,_0x869a56[_0x59da('0x14')][_0x59da('0x16')]);return _0x3f1051(_0x869a56[_0x59da('0x14')]['message']);}logger[_0x59da('0x14')](_0x59da('0xf'),_0x290eda,_0x869a56[_0x59da('0x14')][_0x59da('0x16')]);return _0x4b3b3a(_0x869a56[_0x59da('0x14')][_0x59da('0x16')]);}else{logger[_0x59da('0xe')](_0x59da('0xf'),_0x290eda,_0x59da('0x10'));_0x4b3b3a(_0x869a56[_0x59da('0x17')]['message']);}})[_0x59da('0x18')](function(_0x5316e0){logger[_0x59da('0x14')]('Setting,\x20%s,\x20%s',_0x290eda,_0x5316e0);_0x3f1051(_0x5316e0);});});}exports[_0x59da('0x19')]=function(_0x28ff2c){var _0x50c2e0=this;return new Promise(function(_0x5ac0c3,_0x1375c9){return db[_0x59da('0x1a')][_0x59da('0x1b')]({'raw':_0x28ff2c[_0x59da('0x1c')]?_0x28ff2c[_0x59da('0x1c')][_0x59da('0x1d')]===undefined?!![]:![]:!![],'where':_0x28ff2c[_0x59da('0x1c')]?_0x28ff2c[_0x59da('0x1c')][_0x59da('0x1e')]||null:null,'attributes':_0x28ff2c[_0x59da('0x1c')]?_0x28ff2c[_0x59da('0x1c')]['attributes']||null:null,'include':_0x28ff2c[_0x59da('0x1c')]?_0x28ff2c[_0x59da('0x1c')][_0x59da('0x1f')]?_['map'](_0x28ff2c[_0x59da('0x1c')][_0x59da('0x1f')],function(_0x530300){return{'model':db[_0x530300[_0x59da('0x20')]],'as':_0x530300['as'],'attributes':_0x530300[_0x59da('0x21')],'include':_0x530300[_0x59da('0x1f')]?_[_0x59da('0x22')](_0x530300['include'],function(_0x18bd63){return{'model':db[_0x18bd63['model']],'as':_0x18bd63['as'],'attributes':_0x18bd63[_0x59da('0x21')],'include':_0x18bd63['include']?_[_0x59da('0x22')](_0x18bd63[_0x59da('0x1f')],function(_0x597644){return{'model':db[_0x597644[_0x59da('0x20')]],'as':_0x597644['as'],'attributes':_0x597644[_0x59da('0x21')]};}):[]};}):[]};}):[]:[]})[_0x59da('0x23')](function(_0x745e2e){logger[_0x59da('0xe')](_0x59da('0x19'),_0x28ff2c);logger['debug'](_0x59da('0x19'),_0x28ff2c,JSON['stringify'](_0x745e2e));_0x5ac0c3(_0x745e2e);})[_0x59da('0x18')](function(_0x38ad5b){logger[_0x59da('0x14')]('ShowSetting',_0x38ad5b[_0x59da('0x16')],_0x28ff2c);_0x1375c9(_0x50c2e0[_0x59da('0x14')](0x1f4,_0x38ad5b[_0x59da('0x16')]));});});}; \ No newline at end of file +var _0x69e6=['ShowSetting','Setting','find','raw','options','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x11404d,_0x5214e2){var _0x15678c=function(_0x4af608){while(--_0x4af608){_0x11404d['push'](_0x11404d['shift']());}};_0x15678c(++_0x5214e2);}(_0x69e6,0x175));var _0x669e=function(_0x2276c2,_0x3b2feb){_0x2276c2=_0x2276c2-0x0;var _0x317eee=_0x69e6[_0x2276c2];return _0x317eee;};'use strict';var _=require(_0x669e('0x0'));var util=require(_0x669e('0x1'));var moment=require(_0x669e('0x2'));var BPromise=require(_0x669e('0x3'));var rs=require(_0x669e('0x4'));var fs=require('fs');var Redis=require(_0x669e('0x5'));var db=require(_0x669e('0x6'))['db'];var utils=require(_0x669e('0x7'));var logger=require('../../config/logger')(_0x669e('0x8'));var config=require('../../config/environment');var jayson=require(_0x669e('0x9'));var client=jayson[_0x669e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x176dc4,_0x4ff3ea,_0x547ad1){return new BPromise(function(_0x48fed6,_0x4c8078){return client['request'](_0x176dc4,_0x547ad1)[_0x669e('0xb')](function(_0x42e257){logger[_0x669e('0xc')](_0x669e('0xd'),_0x4ff3ea,_0x669e('0xe'));logger[_0x669e('0xf')](_0x669e('0x10'),_0x4ff3ea,_0x669e('0xe'),JSON[_0x669e('0x11')](_0x42e257));if(_0x42e257[_0x669e('0x12')]){if(_0x42e257[_0x669e('0x12')][_0x669e('0x13')]===0x1f4){logger[_0x669e('0x12')](_0x669e('0xd'),_0x4ff3ea,_0x42e257['error']['message']);return _0x4c8078(_0x42e257[_0x669e('0x12')][_0x669e('0x14')]);}logger[_0x669e('0x12')]('Setting,\x20%s,\x20%s',_0x4ff3ea,_0x42e257[_0x669e('0x12')][_0x669e('0x14')]);return _0x48fed6(_0x42e257[_0x669e('0x12')]['message']);}else{logger[_0x669e('0xc')](_0x669e('0xd'),_0x4ff3ea,_0x669e('0xe'));_0x48fed6(_0x42e257[_0x669e('0x15')][_0x669e('0x14')]);}})[_0x669e('0x16')](function(_0xe57973){logger['error'](_0x669e('0xd'),_0x4ff3ea,_0xe57973);_0x4c8078(_0xe57973);});});}exports[_0x669e('0x17')]=function(_0x213561){var _0x1772aa=this;return new Promise(function(_0x3a0ed7,_0x1dc237){return db[_0x669e('0x18')][_0x669e('0x19')]({'raw':_0x213561['options']?_0x213561['options'][_0x669e('0x1a')]===undefined?!![]:![]:!![],'where':_0x213561[_0x669e('0x1b')]?_0x213561['options'][_0x669e('0x1c')]||null:null,'attributes':_0x213561[_0x669e('0x1b')]?_0x213561[_0x669e('0x1b')][_0x669e('0x1d')]||null:null,'include':_0x213561[_0x669e('0x1b')]?_0x213561[_0x669e('0x1b')][_0x669e('0x1e')]?_['map'](_0x213561[_0x669e('0x1b')][_0x669e('0x1e')],function(_0x4e7d62){return{'model':db[_0x4e7d62[_0x669e('0x1f')]],'as':_0x4e7d62['as'],'attributes':_0x4e7d62[_0x669e('0x1d')],'include':_0x4e7d62[_0x669e('0x1e')]?_[_0x669e('0x20')](_0x4e7d62['include'],function(_0x191c37){return{'model':db[_0x191c37[_0x669e('0x1f')]],'as':_0x191c37['as'],'attributes':_0x191c37[_0x669e('0x1d')],'include':_0x191c37[_0x669e('0x1e')]?_[_0x669e('0x20')](_0x191c37[_0x669e('0x1e')],function(_0x2fa2a7){return{'model':db[_0x2fa2a7['model']],'as':_0x2fa2a7['as'],'attributes':_0x2fa2a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x669e('0xb')](function(_0x282dc5){logger['info']('ShowSetting',_0x213561);logger[_0x669e('0xf')](_0x669e('0x17'),_0x213561,JSON[_0x669e('0x11')](_0x282dc5));_0x3a0ed7(_0x282dc5);})[_0x669e('0x16')](function(_0x25fb25){logger[_0x669e('0x12')](_0x669e('0x17'),_0x25fb25['message'],_0x213561);_0x1dc237(_0x1772aa[_0x669e('0x12')](0x1f4,_0x25fb25[_0x669e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5323f7e..68a8de1 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x115034,_0x5157ec){var _0x1d8c93=function(_0x3f00e2){while(--_0x3f00e2){_0x115034['push'](_0x115034['shift']());}};_0x1d8c93(++_0x5157ec);}(_0x814b,0x1a2));var _0xb814=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x814b[_0x55fa03];return _0x2cd7cd;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x101154,_0x2d2f42){var _0x46ffa1=function(_0x59fb97){while(--_0x59fb97){_0x101154['push'](_0x101154['shift']());}};_0x46ffa1(++_0x2d2f42);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1c032e,_0x24044e){_0x1c032e=_0x1c032e-0x0;var _0x31b7ae=_0x8ef6[_0x1c032e];return _0x31b7ae;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 2643e29..80e1847 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 _0xe188=['plivo','bandwidth','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','generate','ENUM','twilio','skebby','connectel'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xe188,0x91));var _0x8e18=function(_0x453704,_0xcf42a8){_0x453704=_0x453704-0x0;var _0x1d1ba5=_0xe188[_0x453704];return _0x1d1ba5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8e18('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e18('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8e18('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x8e18('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8e18('0x2')]();}},'phone':{'type':Sequelize[_0x8e18('0x1')]},'type':{'type':Sequelize[_0x8e18('0x3')](_0x8e18('0x4'),_0x8e18('0x5'),_0x8e18('0x6'),'clicksend',_0x8e18('0x7'),'clickatell',_0x8e18('0x8'),'csc','infobip',_0x8e18('0x9'))},'accountSid':{'type':Sequelize[_0x8e18('0x1')]},'authId':{'type':Sequelize[_0x8e18('0x1')]},'authToken':{'type':Sequelize[_0x8e18('0x1')]},'smsMethod':{'type':Sequelize[_0x8e18('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8e18('0x1')]},'password':{'type':Sequelize[_0x8e18('0x1')]},'apiKey':{'type':Sequelize[_0x8e18('0x1')]},'applicationId':{'type':Sequelize[_0x8e18('0x1')]},'accountId':{'type':Sequelize[_0x8e18('0x1')]},'senderString':{'type':Sequelize[_0x8e18('0x1')]},'deliveryReport':{'type':Sequelize[_0x8e18('0xa')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8e18('0xb')],'defaultValue':function(){return _0x8e18('0xc');}},'notificationSound':{'type':Sequelize[_0x8e18('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8e18('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8e18('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8e18('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8e18('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8e18('0xd')],'comment':_0x8e18('0xe')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8e18('0xf'),'set':function(_0x4d54d6){if(!_0x4d54d6)this[_0x8e18('0x10')](_0x8e18('0x11'),null);this['setDataValue'](_0x8e18('0x12'),_0x4d54d6);}}}; \ No newline at end of file +var _0x6cb0=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x4fabbe,_0xc514f3){var _0x5510dd=function(_0x1e7d23){while(--_0x1e7d23){_0x4fabbe['push'](_0x4fabbe['shift']());}};_0x5510dd(++_0xc514f3);}(_0x6cb0,0xcb));var _0x06cb=function(_0x35245d,_0x193583){_0x35245d=_0x35245d-0x0;var _0x184a83=_0x6cb0[_0x35245d];return _0x184a83;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x06cb('0x0')]={'name':{'type':Sequelize[_0x06cb('0x1')],'unique':_0x06cb('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x06cb('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x06cb('0x1')],'defaultValue':function(){return rs[_0x06cb('0x3')]();}},'phone':{'type':Sequelize[_0x06cb('0x1')]},'type':{'type':Sequelize[_0x06cb('0x4')](_0x06cb('0x5'),_0x06cb('0x6'),_0x06cb('0x7'),_0x06cb('0x8'),_0x06cb('0x9'),_0x06cb('0xa'),_0x06cb('0xb'),_0x06cb('0xc'),'infobip',_0x06cb('0xd'))},'accountSid':{'type':Sequelize[_0x06cb('0x1')]},'authId':{'type':Sequelize[_0x06cb('0x1')]},'authToken':{'type':Sequelize[_0x06cb('0x1')]},'smsMethod':{'type':Sequelize[_0x06cb('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x06cb('0x1')]},'password':{'type':Sequelize[_0x06cb('0x1')]},'apiKey':{'type':Sequelize[_0x06cb('0x1')]},'applicationId':{'type':Sequelize[_0x06cb('0x1')]},'accountId':{'type':Sequelize[_0x06cb('0x1')]},'senderString':{'type':Sequelize[_0x06cb('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x06cb('0x1')]},'notificationTemplate':{'type':Sequelize[_0x06cb('0xe')],'defaultValue':function(){return _0x06cb('0xf');}},'notificationSound':{'type':Sequelize[_0x06cb('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x06cb('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x06cb('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x06cb('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x06cb('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x06cb('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x06cb('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x06cb('0x10')],'defaultValue':![],'comment':_0x06cb('0x12'),'set':function(_0x1dcb2c){if(!_0x1dcb2c)this[_0x06cb('0x13')](_0x06cb('0x14'),null);this[_0x06cb('0x13')](_0x06cb('0x15'),_0x1dcb2c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9e4b807..684983c 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 _0xe26b=['save','update','destroy','SmsAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','findAll','show','params','length','include','options','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','nolimit','SmsAccountId','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rows','removeAnswers','notify','Applications','account','applications','orderBy','priority','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','MessageSid','skebby','sender','plivo','messageId','results','text','csc','segmentedMessage','clickatell','fromNumber','bandwidth','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','updatedAt','DESC','omit','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','stack','finally','getApplications','getInteractions','Contact','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','infobip','intelepeer','redif','DELIVERED','connectel','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','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','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x7a6254,_0x3b4d97){var _0x47ea5a=function(_0x26eacb){while(--_0x26eacb){_0x7a6254['push'](_0x7a6254['shift']());}};_0x47ea5a(++_0x3b4d97);}(_0xe26b,0x193));var _0xbe26=function(_0x15653b,_0x3a8af9){_0x15653b=_0x15653b-0x0;var _0xb18aed=_0xe26b[_0x15653b];return _0xb18aed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe26('0x0'));var zipdir=require(_0xbe26('0x1'));var jsonpatch=require(_0xbe26('0x2'));var rp=require(_0xbe26('0x3'));var moment=require('moment');var BPromise=require(_0xbe26('0x4'));var Mustache=require(_0xbe26('0x5'));var util=require(_0xbe26('0x6'));var path=require(_0xbe26('0x7'));var sox=require(_0xbe26('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe26('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe26('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbe26('0xb'));var toCsv=require(_0xbe26('0xc'));var querystring=require(_0xbe26('0xd'));var Papa=require(_0xbe26('0xe'));var Redis=require(_0xbe26('0xf'));var authService=require(_0xbe26('0x10'));var qs=require(_0xbe26('0x11'));var as=require(_0xbe26('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe26('0x13'))(_0xbe26('0x14'));var utils=require(_0xbe26('0x15'));var config=require(_0xbe26('0x16'));var licenseUtil=require(_0xbe26('0x17'));var db=require(_0xbe26('0x18'))['db'];config[_0xbe26('0x19')]=_[_0xbe26('0x1a')](config[_0xbe26('0x19')],{'host':_0xbe26('0x1b'),'port':0x18eb});var socket=require(_0xbe26('0x1c'))(new Redis(config[_0xbe26('0x19')]));require(_0xbe26('0x1d'))[_0xbe26('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbe26('0x1f')][_0xbe26('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2a3299,_0x240688,_0x1ad43c,_0x2af3c0){return new BPromise(function(_0x28efc4,_0x1a260f){var _0x4e734b=_0x2af3c0||client;return _0x4e734b[_0xbe26('0x21')](_0x2a3299,_0x1ad43c)[_0xbe26('0x22')](function(_0x4762de){logger[_0xbe26('0x23')](_0xbe26('0x24'),_0x240688,_0xbe26('0x25'));logger['debug'](_0xbe26('0x26'),_0x240688,'request\x20sent',JSON[_0xbe26('0x27')](_0x4762de));if(_0x4762de[_0xbe26('0x28')]){if(_0x4762de[_0xbe26('0x28')][_0xbe26('0x29')]===0x1f4){logger['error'](_0xbe26('0x24'),_0x240688,_0x4762de['error'][_0xbe26('0x2a')]);return _0x1a260f(_0x4762de[_0xbe26('0x28')][_0xbe26('0x2a')]);}logger[_0xbe26('0x28')]('SmsAccount,\x20%s,\x20%s',_0x240688,_0x4762de['error'][_0xbe26('0x2a')]);return _0x28efc4(_0x4762de[_0xbe26('0x28')][_0xbe26('0x2a')]);}else{logger['info'](_0xbe26('0x24'),_0x240688,_0xbe26('0x25'));_0x28efc4(_0x4762de[_0xbe26('0x2b')][_0xbe26('0x2a')]);}})[_0xbe26('0x2c')](function(_0x1e9b04){logger[_0xbe26('0x28')](_0xbe26('0x24'),_0x240688,_0x1e9b04);_0x1a260f(_0x1e9b04);});});}function respondWithStatusCode(_0xbda57a,_0x9db203){_0x9db203=_0x9db203||0xcc;return function(_0x291d89){if(_0x291d89){return _0xbda57a[_0xbe26('0x2d')](_0x9db203);}return _0xbda57a['status'](_0x9db203)[_0xbe26('0x2e')]();};}function respondWithResult(_0x3b098d,_0x456377){_0x456377=_0x456377||0xc8;return function(_0xc4fa07){if(_0xc4fa07){return _0x3b098d[_0xbe26('0x2f')](_0x456377)[_0xbe26('0x30')](_0xc4fa07);}};}function respondWithFilteredResult(_0x327c13,_0x575205){return function(_0x26f96d){if(_0x26f96d){var _0x33ce09=typeof _0x575205[_0xbe26('0x31')]===_0xbe26('0x32')&&typeof _0x575205[_0xbe26('0x33')]===_0xbe26('0x32');var _0x123888=_0x26f96d[_0xbe26('0x34')];var _0xb9b93f=_0x33ce09?0x0:_0x575205[_0xbe26('0x31')];var _0x10230a=_0x33ce09?_0x26f96d[_0xbe26('0x34')]:_0x575205['offset']+_0x575205[_0xbe26('0x33')];var _0x5f22a3;if(_0x10230a>=_0x123888){_0x10230a=_0x123888;_0x5f22a3=0xc8;}else{_0x5f22a3=0xce;}_0x327c13[_0xbe26('0x2f')](_0x5f22a3);return _0x327c13[_0xbe26('0x35')](_0xbe26('0x36'),_0xb9b93f+'-'+_0x10230a+'/'+_0x123888)[_0xbe26('0x30')](_0x26f96d);}return null;};}function patchUpdates(_0x308c6){return function(_0x21ade1){try{jsonpatch['apply'](_0x21ade1,_0x308c6,!![]);}catch(_0x3b47ab){return BPromise['reject'](_0x3b47ab);}return _0x21ade1[_0xbe26('0x37')]();};}function saveUpdates(_0x1b5baf,_0x5ae30b){return function(_0x244b6e){if(_0x244b6e){return _0x244b6e[_0xbe26('0x38')](_0x1b5baf)[_0xbe26('0x22')](function(_0x411b0e){return _0x411b0e;});}return null;};}function removeEntity(_0x45df51,_0x486ac6){return function(_0x303e2d){if(_0x303e2d){return _0x303e2d[_0xbe26('0x39')]()['then'](function(){var _0x4ad2b5=_0x303e2d['get']({'plain':!![]});var _0x889198=_0xbe26('0x3a');return db[_0xbe26('0x3b')]['destroy']({'where':{'type':_0x889198,'resourceId':_0x4ad2b5['id']}})[_0xbe26('0x22')](function(){return _0x303e2d;});})['then'](function(){_0x45df51[_0xbe26('0x2f')](0xcc)[_0xbe26('0x2e')]();});}};}function handleEntityNotFound(_0x52bfd3,_0x33b383){return function(_0x3a4d56){if(!_0x3a4d56){_0x52bfd3[_0xbe26('0x2d')](0x194);}return _0x3a4d56;};}function handleError(_0x1e821f,_0x1cb661){_0x1cb661=_0x1cb661||0x1f4;return function(_0xb99e4e){logger[_0xbe26('0x28')](_0xb99e4e['stack']);if(_0xb99e4e[_0xbe26('0x3c')]){delete _0xb99e4e[_0xbe26('0x3c')];}_0x1e821f['status'](_0x1cb661)[_0xbe26('0x3d')](_0xb99e4e);};}exports[_0xbe26('0x3e')]=function(_0x3aa8d6,_0x174b7b){var _0x2a5d75={'include':[{'model':db[_0xbe26('0x3f')],'as':_0xbe26('0x40')}]},_0x437518={},_0x54c92b={'count':0x0,'rows':[]};var _0x4a50e0=_[_0xbe26('0x41')](db[_0xbe26('0x42')][_0xbe26('0x43')],function(_0x19f1fd){return{'name':_0x19f1fd['fieldName'],'type':_0x19f1fd[_0xbe26('0x44')]['key']};});_0x437518[_0xbe26('0x45')]=_[_0xbe26('0x41')](_0x4a50e0,_0xbe26('0x3c'));_0x437518[_0xbe26('0x46')]=_[_0xbe26('0x47')](_0x3aa8d6[_0xbe26('0x46')]);_0x437518[_0xbe26('0x48')]=_['intersection'](_0x437518[_0xbe26('0x45')],_0x437518[_0xbe26('0x46')]);_0x2a5d75[_0xbe26('0x49')]=_[_0xbe26('0x4a')](_0x437518[_0xbe26('0x45')],qs[_0xbe26('0x4b')](_0x3aa8d6['query']['fields']));_0x2a5d75[_0xbe26('0x49')]=_0x2a5d75[_0xbe26('0x49')]['length']?_0x2a5d75[_0xbe26('0x49')]:_0x437518['model'];if(!_0x3aa8d6[_0xbe26('0x46')][_0xbe26('0x4c')]('nolimit')){_0x2a5d75[_0xbe26('0x33')]=qs[_0xbe26('0x33')](_0x3aa8d6[_0xbe26('0x46')][_0xbe26('0x33')]);_0x2a5d75[_0xbe26('0x31')]=qs[_0xbe26('0x31')](_0x3aa8d6['query'][_0xbe26('0x31')]);}_0x2a5d75[_0xbe26('0x4d')]=qs[_0xbe26('0x4e')](_0x3aa8d6['query'][_0xbe26('0x4e')]);_0x2a5d75[_0xbe26('0x4f')]=qs[_0xbe26('0x48')](_[_0xbe26('0x50')](_0x3aa8d6[_0xbe26('0x46')],_0x437518[_0xbe26('0x48')]),_0x4a50e0);if(_0x3aa8d6[_0xbe26('0x46')][_0xbe26('0x51')]){_0x2a5d75['where']=_[_0xbe26('0x52')](_0x2a5d75[_0xbe26('0x4f')],{'$or':_[_0xbe26('0x41')](_0x4a50e0,function(_0x4c7558){if(_0x4c7558[_0xbe26('0x44')]!==_0xbe26('0x53')){var _0x2e1fba={};_0x2e1fba[_0x4c7558[_0xbe26('0x3c')]]={'$like':'%'+_0x3aa8d6[_0xbe26('0x46')][_0xbe26('0x51')]+'%'};return _0x2e1fba;}})});}_0x2a5d75=_['merge']({},_0x2a5d75,_0x3aa8d6['options']);var _0x1fad18={'where':_0x2a5d75[_0xbe26('0x4f')]};return db[_0xbe26('0x42')][_0xbe26('0x34')](_0x1fad18)['then'](function(_0x17bb6f){_0x54c92b['count']=_0x17bb6f;if(_0x3aa8d6[_0xbe26('0x46')]['includeAll']){_0x2a5d75['include']=[{'all':!![]}];}return db['SmsAccount'][_0xbe26('0x54')](_0x2a5d75);})[_0xbe26('0x22')](function(_0x536712){_0x54c92b['rows']=_0x536712;return _0x54c92b;})['then'](respondWithFilteredResult(_0x174b7b,_0x2a5d75))[_0xbe26('0x2c')](handleError(_0x174b7b,null));};exports[_0xbe26('0x55')]=function(_0x507d7e,_0x2387c6){var _0xa4ecaa={'raw':![],'where':{'id':_0x507d7e[_0xbe26('0x56')]['id']},'include':[{'model':db[_0xbe26('0x3f')],'as':_0xbe26('0x40')}]},_0x59857c={};_0x59857c['model']=_[_0xbe26('0x47')](db[_0xbe26('0x42')][_0xbe26('0x43')]);_0x59857c[_0xbe26('0x46')]=_[_0xbe26('0x47')](_0x507d7e[_0xbe26('0x46')]);_0x59857c[_0xbe26('0x48')]=_[_0xbe26('0x4a')](_0x59857c['model'],_0x59857c[_0xbe26('0x46')]);_0xa4ecaa[_0xbe26('0x49')]=_['intersection'](_0x59857c[_0xbe26('0x45')],qs[_0xbe26('0x4b')](_0x507d7e[_0xbe26('0x46')][_0xbe26('0x4b')]));_0xa4ecaa[_0xbe26('0x49')]=_0xa4ecaa['attributes'][_0xbe26('0x57')]?_0xa4ecaa[_0xbe26('0x49')]:_0x59857c[_0xbe26('0x45')];if(_0x507d7e[_0xbe26('0x46')]['includeAll']){_0xa4ecaa[_0xbe26('0x58')]=[{'all':!![]}];}_0xa4ecaa=_[_0xbe26('0x52')]({},_0xa4ecaa,_0x507d7e[_0xbe26('0x59')]);return db['SmsAccount'][_0xbe26('0x5a')](_0xa4ecaa)[_0xbe26('0x22')](handleEntityNotFound(_0x2387c6,null))[_0xbe26('0x22')](respondWithResult(_0x2387c6,null))[_0xbe26('0x2c')](handleError(_0x2387c6,null));};exports[_0xbe26('0x5b')]=function(_0x1b2ca9,_0x548e22){return db[_0xbe26('0x42')]['create'](_0x1b2ca9[_0xbe26('0x5c')],{})['then'](function(_0x147def){var _0x10f694=_0x1b2ca9['user'][_0xbe26('0x5d')]({'plain':!![]});if(!_0x10f694)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10f694[_0xbe26('0x5e')]===_0xbe26('0x5f')){var _0x53f366=_0x147def[_0xbe26('0x5d')]({'plain':!![]});var _0x58577e=_0xbe26('0x3a');return db[_0xbe26('0x60')][_0xbe26('0x5a')]({'where':{'name':_0x58577e,'userProfileId':_0x10f694[_0xbe26('0x61')]},'raw':!![]})[_0xbe26('0x22')](function(_0x26b695){if(_0x26b695&&_0x26b695[_0xbe26('0x62')]===0x0){return db[_0xbe26('0x3b')][_0xbe26('0x5b')]({'name':_0x53f366[_0xbe26('0x3c')],'resourceId':_0x53f366['id'],'type':_0x26b695[_0xbe26('0x3c')],'sectionId':_0x26b695['id']},{})[_0xbe26('0x22')](function(){return _0x147def;});}else{return _0x147def;}})[_0xbe26('0x2c')](function(_0x4084ef){logger[_0xbe26('0x28')](_0xbe26('0x63'),_0x4084ef);throw _0x4084ef;});}return _0x147def;})[_0xbe26('0x22')](respondWithResult(_0x548e22,0xc9))['catch'](handleError(_0x548e22,null));};exports[_0xbe26('0x38')]=function(_0x24dd0c,_0x17cb73){if(_0x24dd0c['body']['id']){delete _0x24dd0c[_0xbe26('0x5c')]['id'];}return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x24dd0c['params']['id']},'include':[{'model':db[_0xbe26('0x3f')],'as':_0xbe26('0x40')}]})['then'](handleEntityNotFound(_0x17cb73,null))[_0xbe26('0x22')](saveUpdates(_0x24dd0c[_0xbe26('0x5c')],null))['then'](respondWithResult(_0x17cb73,null))['catch'](handleError(_0x17cb73,null));};exports[_0xbe26('0x39')]=function(_0x1e2084,_0x5f2743){return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x1e2084[_0xbe26('0x56')]['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x5f2743,null))[_0xbe26('0x22')](removeEntity(_0x5f2743,null))[_0xbe26('0x2c')](handleError(_0x5f2743,null));};exports['describe']=function(_0x5aa4de,_0x12b168){return db[_0xbe26('0x42')][_0xbe26('0x64')]()[_0xbe26('0x22')](respondWithResult(_0x12b168,null))[_0xbe26('0x2c')](handleError(_0x12b168,null));};exports[_0xbe26('0x65')]=function(_0x21eebf,_0x4ad067,_0x1808b1){if(_0x21eebf['body']['id']){delete _0x21eebf[_0xbe26('0x5c')]['id'];}return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x21eebf[_0xbe26('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ad067,null))[_0xbe26('0x22')](function(_0x139298){if(_0x139298){_0x21eebf['body']['SmsAccountId']=_0x139298['id'];return db[_0xbe26('0x66')][_0xbe26('0x5b')](_0x21eebf['body']);}})[_0xbe26('0x22')](respondWithResult(_0x4ad067,null))[_0xbe26('0x2c')](handleError(_0x4ad067,null));};exports['getDispositions']=function(_0x49df26,_0xf3a060,_0x17fdf4){var _0x51cd92={'raw':![],'where':{}};var _0x16f88d={};var _0x133a5b={'count':0x0,'rows':[]};return db[_0xbe26('0x42')][_0xbe26('0x67')]({'where':{'id':_0x49df26[_0xbe26('0x56')]['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0xf3a060,null))[_0xbe26('0x22')](function(_0x41cbc8){if(_0x41cbc8){_0x16f88d[_0xbe26('0x45')]=_[_0xbe26('0x47')](db[_0xbe26('0x66')]['rawAttributes']);_0x16f88d['query']=_[_0xbe26('0x47')](_0x49df26[_0xbe26('0x46')]);_0x16f88d[_0xbe26('0x48')]=_[_0xbe26('0x4a')](_0x16f88d['model'],_0x16f88d[_0xbe26('0x46')]);_0x51cd92[_0xbe26('0x49')]=_['intersection'](_0x16f88d['model'],qs['fields'](_0x49df26[_0xbe26('0x46')][_0xbe26('0x4b')]));_0x51cd92[_0xbe26('0x49')]=_0x51cd92[_0xbe26('0x49')][_0xbe26('0x57')]?_0x51cd92[_0xbe26('0x49')]:_0x16f88d[_0xbe26('0x45')];if(!_0x49df26['query']['hasOwnProperty'](_0xbe26('0x68'))){_0x51cd92[_0xbe26('0x33')]=qs[_0xbe26('0x33')](_0x49df26[_0xbe26('0x46')][_0xbe26('0x33')]);_0x51cd92[_0xbe26('0x31')]=qs['offset'](_0x49df26['query'][_0xbe26('0x31')]);}_0x51cd92[_0xbe26('0x4d')]=qs[_0xbe26('0x4e')](_0x49df26['query'][_0xbe26('0x4e')]);_0x51cd92[_0xbe26('0x4f')]=qs[_0xbe26('0x48')](_[_0xbe26('0x50')](_0x49df26['query'],_0x16f88d['filters']));_0x51cd92['where'][_0xbe26('0x69')]=_0x41cbc8['id'];if(_0x49df26['query']['filter']){_0x51cd92['where']=_[_0xbe26('0x52')](_0x51cd92[_0xbe26('0x4f')],{'$or':_[_0xbe26('0x41')](_0x51cd92[_0xbe26('0x49')],function(_0x225542){var _0x5bed9a={};_0x5bed9a[_0x225542]={'$like':'%'+_0x49df26[_0xbe26('0x46')]['filter']+'%'};return _0x5bed9a;})});}_0x51cd92=_[_0xbe26('0x52')]({},_0x51cd92,_0x49df26[_0xbe26('0x59')]);return db['Disposition'][_0xbe26('0x34')]({'where':_0x51cd92[_0xbe26('0x4f')]})[_0xbe26('0x22')](function(_0x3f10ff){_0x133a5b[_0xbe26('0x34')]=_0x3f10ff;if(_0x49df26[_0xbe26('0x46')][_0xbe26('0x6a')]){_0x51cd92['include']=[{'all':!![]}];}return db[_0xbe26('0x66')][_0xbe26('0x54')](_0x51cd92);})['then'](function(_0x2cd171){_0x133a5b['rows']=_0x2cd171;return _0x133a5b;});}})['then'](respondWithFilteredResult(_0xf3a060,_0x51cd92))[_0xbe26('0x2c')](handleError(_0xf3a060,null));};exports[_0xbe26('0x6b')]=function(_0x407963,_0x25141c,_0xb1ebbc){return db['SmsAccount']['find']({'where':{'id':_0x407963[_0xbe26('0x56')]['id']}})['then'](handleEntityNotFound(_0x25141c,null))[_0xbe26('0x22')](function(_0x1eb428){if(_0x1eb428){return _0x1eb428[_0xbe26('0x6b')](_0x407963[_0xbe26('0x46')][_0xbe26('0x6c')]);}})[_0xbe26('0x22')](respondWithStatusCode(_0x25141c,null))[_0xbe26('0x2c')](handleError(_0x25141c,null));};exports[_0xbe26('0x6d')]=function(_0x332c7f,_0x4f15a8,_0x5b1d2f){if(_0x332c7f[_0xbe26('0x5c')]['id']){delete _0x332c7f[_0xbe26('0x5c')]['id'];}return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x332c7f[_0xbe26('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f15a8,null))['then'](function(_0x4ed122){if(_0x4ed122){_0x332c7f['body']['SmsAccountId']=_0x4ed122['id'];return db['CannedAnswer']['create'](_0x332c7f['body']);}})[_0xbe26('0x22')](respondWithResult(_0x4f15a8,null))[_0xbe26('0x2c')](handleError(_0x4f15a8,null));};exports[_0xbe26('0x6e')]=function(_0x441bd4,_0x22f969,_0x49e354){var _0x54f4bf={'raw':![],'where':{}};var _0x450e9b={};var _0x26817d={'count':0x0,'rows':[]};return db[_0xbe26('0x42')][_0xbe26('0x67')]({'where':{'id':_0x441bd4[_0xbe26('0x56')]['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x22f969,null))[_0xbe26('0x22')](function(_0x33b951){if(_0x33b951){_0x450e9b[_0xbe26('0x45')]=_['keys'](db[_0xbe26('0x6f')][_0xbe26('0x43')]);_0x450e9b[_0xbe26('0x46')]=_[_0xbe26('0x47')](_0x441bd4['query']);_0x450e9b[_0xbe26('0x48')]=_[_0xbe26('0x4a')](_0x450e9b[_0xbe26('0x45')],_0x450e9b[_0xbe26('0x46')]);_0x54f4bf[_0xbe26('0x49')]=_[_0xbe26('0x4a')](_0x450e9b[_0xbe26('0x45')],qs[_0xbe26('0x4b')](_0x441bd4[_0xbe26('0x46')]['fields']));_0x54f4bf[_0xbe26('0x49')]=_0x54f4bf['attributes']['length']?_0x54f4bf[_0xbe26('0x49')]:_0x450e9b[_0xbe26('0x45')];if(!_0x441bd4[_0xbe26('0x46')][_0xbe26('0x4c')](_0xbe26('0x68'))){_0x54f4bf['limit']=qs['limit'](_0x441bd4[_0xbe26('0x46')][_0xbe26('0x33')]);_0x54f4bf[_0xbe26('0x31')]=qs[_0xbe26('0x31')](_0x441bd4['query'][_0xbe26('0x31')]);}_0x54f4bf[_0xbe26('0x4d')]=qs[_0xbe26('0x4e')](_0x441bd4['query'][_0xbe26('0x4e')]);_0x54f4bf[_0xbe26('0x4f')]=qs[_0xbe26('0x48')](_['pick'](_0x441bd4[_0xbe26('0x46')],_0x450e9b['filters']));_0x54f4bf[_0xbe26('0x4f')][_0xbe26('0x69')]=_0x33b951['id'];if(_0x441bd4[_0xbe26('0x46')]['filter']){_0x54f4bf[_0xbe26('0x4f')]=_[_0xbe26('0x52')](_0x54f4bf[_0xbe26('0x4f')],{'$or':_['map'](_0x54f4bf[_0xbe26('0x49')],function(_0x4fe0cd){var _0x16ab00={};_0x16ab00[_0x4fe0cd]={'$like':'%'+_0x441bd4['query']['filter']+'%'};return _0x16ab00;})});}_0x54f4bf=_[_0xbe26('0x52')]({},_0x54f4bf,_0x441bd4[_0xbe26('0x59')]);return db[_0xbe26('0x6f')][_0xbe26('0x34')]({'where':_0x54f4bf[_0xbe26('0x4f')]})[_0xbe26('0x22')](function(_0x3f602c){_0x26817d[_0xbe26('0x34')]=_0x3f602c;if(_0x441bd4[_0xbe26('0x46')][_0xbe26('0x6a')]){_0x54f4bf['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xbe26('0x54')](_0x54f4bf);})[_0xbe26('0x22')](function(_0x3c67a3){_0x26817d[_0xbe26('0x70')]=_0x3c67a3;return _0x26817d;});}})['then'](respondWithFilteredResult(_0x22f969,_0x54f4bf))[_0xbe26('0x2c')](handleError(_0x22f969,null));};exports[_0xbe26('0x71')]=function(_0x20f340,_0x1bf52d,_0x495371){return db[_0xbe26('0x42')]['find']({'where':{'id':_0x20f340['params']['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x1bf52d,null))[_0xbe26('0x22')](function(_0x3923a3){if(_0x3923a3){return _0x3923a3[_0xbe26('0x71')](_0x20f340[_0xbe26('0x46')][_0xbe26('0x6c')]);}})[_0xbe26('0x22')](respondWithStatusCode(_0x1bf52d,null))[_0xbe26('0x2c')](handleError(_0x1bf52d,null));};exports[_0xbe26('0x72')]=function(_0x112c45,_0x740f13,_0x341c15){var _0x4ad2bc={'channel':'sms'};var _0x5a33de=[];var _0x553c51=[];var _0x3c81b5={};return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x112c45['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xbe26('0x73')}]})[_0xbe26('0x22')](handleEntityNotFound(_0x740f13,null))['then'](function(_0xc5f827){_0x4ad2bc[_0xbe26('0x74')]=_0xc5f827;_0x4ad2bc[_0xbe26('0x75')]=_[_0xbe26('0x76')](_0xc5f827[_0xbe26('0x73')],[_0xbe26('0x77')],[_0xbe26('0x78')]);if(_0x4ad2bc[_0xbe26('0x74')]['Applications']){delete _0x4ad2bc['account'][_0xbe26('0x73')];}return db['CmContact'][_0xbe26('0x64')]();})[_0xbe26('0x22')](function(_0x237fe5){if(!_0x237fe5){throw new db[(_0xbe26('0x79'))]['ValidationError'](_0xbe26('0x7a'));}_0x5a33de=_[_0xbe26('0x7b')](_['keys'](_0x237fe5),['createdAt','updatedAt']);_0x553c51=_[_0xbe26('0x7b')](_['keys'](_0x237fe5),[_0xbe26('0x7c'),'updatedAt',_0xbe26('0x7d'),_0xbe26('0x7e')]);_0x4ad2bc[_0xbe26('0x5c')]={'mapKey':_0xbe26('0x7f')};if(_0x4ad2bc[_0xbe26('0x74')][_0xbe26('0x44')]){switch(_0x4ad2bc['account'][_0xbe26('0x44')]){case _0xbe26('0x80'):_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')]=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x82')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45[_0xbe26('0x5c')]['Body'];_0x4ad2bc['body']['messageId']=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x83')];break;case _0xbe26('0x84'):_0x4ad2bc['body'][_0xbe26('0x81')]='+'+_0x112c45[_0xbe26('0x5c')][_0xbe26('0x85')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45['body']['text'];break;case'connectel':_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')]=_0x112c45['body'][_0xbe26('0x81')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45['body'][_0xbe26('0x2a')];break;case'clicksend':_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')]=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x81')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45[_0xbe26('0x5c')]['body'];_0x4ad2bc[_0xbe26('0x5c')]['messageId']=_0x112c45[_0xbe26('0x5c')]['message_id'];break;case _0xbe26('0x86'):_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')]=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x82')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45[_0xbe26('0x5c')]['Text'];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x87')]=_0x112c45[_0xbe26('0x5c')]['MessageUUID'];break;case'infobip':_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')]='+'+_0x112c45[_0xbe26('0x5c')][_0xbe26('0x88')][0x0]['from'];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45['body'][_0xbe26('0x88')][0x0][_0xbe26('0x89')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x87')]=_0x112c45['body'][_0xbe26('0x88')][0x0][_0xbe26('0x87')];break;case _0xbe26('0x8a'):_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')]=_0x112c45[_0xbe26('0x5c')]['originatingAddress'];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x8b')]['message'];break;case _0xbe26('0x8c'):_0x4ad2bc[_0xbe26('0x5c')]['from']=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x8d')];_0x4ad2bc[_0xbe26('0x5c')]['body']=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x89')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x87')]=_0x112c45[_0xbe26('0x5c')]['replyMessageId'];break;case _0xbe26('0x8e'):_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x87')]=_0x112c45[_0xbe26('0x5c')][0x0][_0xbe26('0x2a')]['id'];_0x4ad2bc['body']['from']=_0x112c45[_0xbe26('0x5c')][0x0][_0xbe26('0x2a')][_0xbe26('0x81')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45[_0xbe26('0x5c')][0x0][_0xbe26('0x2a')][_0xbe26('0x89')];break;case'intelepeer':_0x4ad2bc['body'][_0xbe26('0x81')]=_0x112c45['body'][_0xbe26('0x81')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x5c')]=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x2a')];_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x87')]=_0x112c45[_0xbe26('0x5c')][_0xbe26('0x8f')];break;}}if(_0x4ad2bc[_0xbe26('0x5c')]['id']){delete _0x4ad2bc[_0xbe26('0x5c')]['id'];}if(_[_0xbe26('0x90')](_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')])){throw new db[(_0xbe26('0x79'))][(_0xbe26('0x91'))](_0xbe26('0x92'));}if(_[_0xbe26('0x90')](_0x4ad2bc['body'][_0xbe26('0x5c')])||_0x4ad2bc[_0xbe26('0x5c')]['body']===''){throw new db[(_0xbe26('0x79'))][(_0xbe26('0x91'))](_0xbe26('0x93'));}if(_[_0xbe26('0x90')](_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x94')])){throw new db[(_0xbe26('0x79'))][(_0xbe26('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x553c51);}if(!_[_0xbe26('0x95')](_0x553c51,_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x94')])){throw new db[(_0xbe26('0x79'))][(_0xbe26('0x91'))](_0xbe26('0x96')+_0x553c51);}_0x3c81b5[_0x4ad2bc[_0xbe26('0x5c')]['mapKey']]=_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')];return db[_0xbe26('0x97')][_0xbe26('0x5a')]({'where':{'id':_0x4ad2bc[_0xbe26('0x74')][_0xbe26('0x7e')]},'include':[{'model':db[_0xbe26('0x98')],'as':_0xbe26('0x99'),'where':_0x3c81b5,'limit':0x1,'order':[[_0xbe26('0x9a'),_0xbe26('0x9b')]]}]});})['then'](handleEntityNotFound(_0x740f13,null))[_0xbe26('0x22')](function(_0x331e5c){if(_0x331e5c){_0x4ad2bc['list']=_[_0xbe26('0x9c')](_0x331e5c,[_0xbe26('0x99')]);if(_0x331e5c[_0xbe26('0x99')][_0xbe26('0x57')]){return _0x331e5c[_0xbe26('0x99')][0x0];}var _0x1881c7=_[_0xbe26('0x1a')](_0x4ad2bc[_0xbe26('0x5c')],{'firstName':_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')],'ListId':_0x331e5c['id']});_0x1881c7[_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x94')]]=_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')];return db[_0xbe26('0x98')][_0xbe26('0x5b')](_0x1881c7,{'fields':_0x5a33de,'raw':!![]});}})[_0xbe26('0x22')](handleEntityNotFound(_0x740f13,null))[_0xbe26('0x22')](function(_0x3998c4){if(_0x3998c4){_0x4ad2bc[_0xbe26('0x9d')]=_0x3998c4;var _0x4c5819={'ContactId':_0x3998c4['id'],'phone':_0x4ad2bc['body']['from'],'SmsAccountId':_0x112c45[_0xbe26('0x56')]['id']};var _0x51f4ee={'ContactId':_0x3998c4['id'],'SmsAccountId':_0x112c45[_0xbe26('0x56')]['id'],'closed':![]};return db[_0xbe26('0x9e')][_0xbe26('0x5a')]({'where':_0x51f4ee})[_0xbe26('0x22')](function(_0x121c5c){if(_0x121c5c){return[_0x121c5c,![]];}return db[_0xbe26('0x9e')][_0xbe26('0x5b')](_0x4c5819)['then'](function(_0x51e38a){return[_0x51e38a,!![]];});});}})[_0xbe26('0x9f')](function(_0x50be91,_0x20dc0a){_0x4ad2bc[_0xbe26('0xa0')]=_0x50be91[_0xbe26('0x5d')]({'plain':!![]});_0x4ad2bc[_0xbe26('0xa0')][_0xbe26('0xa1')]=![];if(_0x20dc0a){if(_0x4ad2bc[_0xbe26('0x74')]['autoclose']){_0x4ad2bc[_0xbe26('0x75')]['push']({'id':0x0,'priority':_0x4ad2bc[_0xbe26('0x75')][_0xbe26('0x57')]+0x1,'app':_0xbe26('0xa2'),'appdata':_0xbe26('0xa3'),'interval':_0xbe26('0xa4')});}_0x4ad2bc[_0xbe26('0xa0')][_0xbe26('0xa1')]=!![];}return db[_0xbe26('0xa5')][_0xbe26('0x5b')]({'phone':_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x81')],'messageId':_0x4ad2bc[_0xbe26('0x5c')][_0xbe26('0x87')],'body':_0x4ad2bc['body'][_0xbe26('0x5c')],'SmsAccountId':_0x112c45[_0xbe26('0x56')]['id'],'SmsInteractionId':_0x50be91['id'],'direction':'in','ContactId':_0x50be91['ContactId'],'AttachmentId':_0x4ad2bc['body'][_0xbe26('0xa6')]});})['then'](function(_0xe0a84d){_0x4ad2bc[_0xbe26('0x2a')]=_0xe0a84d;if(_0x4ad2bc[_0xbe26('0xa0')]['UserId']){return db[_0xbe26('0xa7')][_0xbe26('0x5a')]({'attributes':['id',_0xbe26('0x3c')],'where':{'id':_0x4ad2bc[_0xbe26('0xa0')][_0xbe26('0xa8')]}})[_0xbe26('0x22')](function(_0x42d6f8){if(_0x42d6f8){_0x4ad2bc[_0xbe26('0x75')][_0xbe26('0xa9')]({'id':0x0,'priority':0x0,'app':_0xbe26('0xaa'),'appdata':_0x42d6f8[_0xbe26('0x3c')]+','+(_0x4ad2bc[_0xbe26('0x74')][_0xbe26('0xab')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xbe26('0xac'),_0xbe26('0xad'),_0x4ad2bc);});}return respondWithRpcPromise('Start',_0xbe26('0xad'),_0x4ad2bc);})[_0xbe26('0x22')](function(_0x2ad3af){if(_0x2ad3af){var _0x45e88d=0xc8;var _0x4522d9=_0xbe26('0xae');logger[_0xbe26('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4522d9,_0x45e88d,_0xbe26('0xaf'));logger['debug'](_0xbe26('0xb0'),_0x4522d9,_0x45e88d,_0xbe26('0xaf'),JSON[_0xbe26('0x27')](_0x2ad3af));if(_0x4ad2bc['account'][_0xbe26('0x44')]===_0xbe26('0x80')){return _0x740f13['status'](_0x45e88d)[_0xbe26('0x35')](_0xbe26('0xb1'),_0xbe26('0xb2'))[_0xbe26('0x3d')](_0xbe26('0xb3'));}else{return _0x740f13[_0xbe26('0x2f')](_0x45e88d)[_0xbe26('0x30')](_0x2ad3af);}}})[_0xbe26('0x2c')](handleError(_0x740f13,null));};exports[_0xbe26('0xb4')]=function(_0x3682f9,_0x6f276a){var _0x154cc1=_0x3682f9['params']['id'];var _0x4a7804=_0x3682f9['body'];var _0x2acc3b=0xc8;var _0x2a466c=null;return db[_0xbe26('0xb5')][_0xbe26('0xb6')]({'isolationLevel':db['sequelize'][_0xbe26('0xb7')][_0xbe26('0xb8')][_0xbe26('0xb9')]},function(_0x362022){return db[_0xbe26('0x42')][_0xbe26('0x67')]({'where':{'id':_0x154cc1},'transaction':_0x362022})['then'](function(_0x5f1d6d){if(_0x5f1d6d){return db[_0xbe26('0xba')][_0xbe26('0x39')]({'where':{'SmsAccountId':_0x154cc1},'transaction':_0x362022})['then'](function(){var _0x2409d7=_[_0xbe26('0x41')](_0x4a7804,function(_0x1527c3){_0x1527c3[_0xbe26('0x69')]=_0x154cc1;return _0x1527c3;});return db[_0xbe26('0xba')][_0xbe26('0xbb')](_0x2409d7,{'transaction':_0x362022});});}else{_0x2acc3b=0x194;_0x2a466c=[];}});})[_0xbe26('0x22')](function(){if(_0x2acc3b!==0x194){return db[_0xbe26('0xba')]['findAndCountAll']({'where':{'SmsAccountId':_0x154cc1},'order':'priority'})[_0xbe26('0x22')](function(_0x5b58fd){_0x2a466c=_0x5b58fd;});}})[_0xbe26('0x2c')](function(_0x1216ce){_0x2acc3b=0x1f4;logger['error'](_0x1216ce[_0xbe26('0xbc')]);if(_0x1216ce[_0xbe26('0x3c')]){delete _0x1216ce[_0xbe26('0x3c')];}_0x2a466c=_0x1216ce;})[_0xbe26('0xbd')](function(){if(_0x2a466c===null){_0x6f276a['sendStatus'](_0x2acc3b);}else{if(_0x2acc3b===0x1f4){_0x6f276a['status'](_0x2acc3b)['send'](_0x2a466c);}else{_0x6f276a[_0xbe26('0x2f')](_0x2acc3b)['json'](_0x2a466c);}}});};exports[_0xbe26('0xbe')]=function(_0x2281e9,_0x59dc58,_0x12f8a8){var _0x5909ca={};var _0x81beac={};var _0x33d6f5;var _0x21f515;return db['SmsAccount'][_0xbe26('0x67')]({'where':{'id':_0x2281e9['params']['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x59dc58,null))['then'](function(_0x57f20b){if(_0x57f20b){_0x33d6f5=_0x57f20b;_0x81beac[_0xbe26('0x45')]=_[_0xbe26('0x47')](db[_0xbe26('0xba')][_0xbe26('0x43')]);_0x81beac['query']=_[_0xbe26('0x47')](_0x2281e9[_0xbe26('0x46')]);_0x81beac[_0xbe26('0x48')]=_['intersection'](_0x81beac[_0xbe26('0x45')],_0x81beac[_0xbe26('0x46')]);_0x5909ca['attributes']=_['intersection'](_0x81beac['model'],qs['fields'](_0x2281e9[_0xbe26('0x46')]['fields']));_0x5909ca['attributes']=_0x5909ca[_0xbe26('0x49')][_0xbe26('0x57')]?_0x5909ca[_0xbe26('0x49')]:_0x81beac[_0xbe26('0x45')];_0x5909ca[_0xbe26('0x4d')]=qs[_0xbe26('0x4e')](_0x2281e9['query']['sort']);_0x5909ca[_0xbe26('0x4f')]=qs[_0xbe26('0x48')](_[_0xbe26('0x50')](_0x2281e9[_0xbe26('0x46')],_0x81beac[_0xbe26('0x48')]));if(_0x2281e9[_0xbe26('0x46')][_0xbe26('0x51')]){_0x5909ca[_0xbe26('0x4f')]=_[_0xbe26('0x52')](_0x5909ca['where'],{'$or':_[_0xbe26('0x41')](_0x5909ca[_0xbe26('0x49')],function(_0x3caf3f){var _0x1e3783={};_0x1e3783[_0x3caf3f]={'$like':'%'+_0x2281e9[_0xbe26('0x46')][_0xbe26('0x51')]+'%'};return _0x1e3783;})});}_0x5909ca=_[_0xbe26('0x52')]({},_0x5909ca,_0x2281e9['options']);return _0x33d6f5[_0xbe26('0xbe')](_0x5909ca);}})['then'](function(_0x2285a9){if(_0x2285a9){_0x21f515=_0x2285a9[_0xbe26('0x57')];if(!_0x2281e9[_0xbe26('0x46')][_0xbe26('0x4c')](_0xbe26('0x68'))){_0x5909ca['limit']=qs[_0xbe26('0x33')](_0x2281e9[_0xbe26('0x46')][_0xbe26('0x33')]);_0x5909ca['offset']=qs[_0xbe26('0x31')](_0x2281e9[_0xbe26('0x46')]['offset']);}return _0x33d6f5[_0xbe26('0xbe')](_0x5909ca);}})[_0xbe26('0x22')](function(_0x395969){if(_0x395969){return _0x395969?{'count':_0x21f515,'rows':_0x395969}:null;}})['then'](respondWithResult(_0x59dc58,null))[_0xbe26('0x2c')](handleError(_0x59dc58,null));};exports[_0xbe26('0xbf')]=function(_0x228681,_0x39c948,_0x52b691){var _0x48e80a={'raw':![],'where':{}};var _0x221f0e={};var _0x15da32={'count':0x0,'rows':[]};return db[_0xbe26('0x42')][_0xbe26('0x67')]({'where':{'id':_0x228681['params']['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x39c948,null))[_0xbe26('0x22')](function(_0x3a24cb){if(_0x3a24cb){_0x221f0e[_0xbe26('0x45')]=_[_0xbe26('0x47')](db[_0xbe26('0x9e')][_0xbe26('0x43')]);_0x221f0e['query']=_[_0xbe26('0x47')](_0x228681['query']);_0x221f0e[_0xbe26('0x48')]=_[_0xbe26('0x4a')](_0x221f0e['model'],_0x221f0e[_0xbe26('0x46')]);_0x48e80a['attributes']=_['intersection'](_0x221f0e[_0xbe26('0x45')],qs[_0xbe26('0x4b')](_0x228681[_0xbe26('0x46')][_0xbe26('0x4b')]));_0x48e80a[_0xbe26('0x49')]=_0x48e80a[_0xbe26('0x49')][_0xbe26('0x57')]?_0x48e80a[_0xbe26('0x49')]:_0x221f0e[_0xbe26('0x45')];if(!_0x228681[_0xbe26('0x46')][_0xbe26('0x4c')](_0xbe26('0x68'))){_0x48e80a[_0xbe26('0x33')]=qs['limit'](_0x228681[_0xbe26('0x46')][_0xbe26('0x33')]);_0x48e80a['offset']=qs['offset'](_0x228681[_0xbe26('0x46')]['offset']);}_0x48e80a[_0xbe26('0x4d')]=qs[_0xbe26('0x4e')](_0x228681[_0xbe26('0x46')][_0xbe26('0x4e')]);_0x48e80a[_0xbe26('0x4f')]=qs[_0xbe26('0x48')](_['pick'](_0x228681[_0xbe26('0x46')],_0x221f0e[_0xbe26('0x48')]));_0x48e80a[_0xbe26('0x4f')][_0xbe26('0x69')]=_0x3a24cb['id'];if(_0x228681[_0xbe26('0x46')][_0xbe26('0x51')]){_0x48e80a['where']=_['merge'](_0x48e80a[_0xbe26('0x4f')],{'$or':_[_0xbe26('0x41')](_0x48e80a['attributes'],function(_0x2ecd00){var _0x4f7f8a={};_0x4f7f8a[_0x2ecd00]={'$like':'%'+_0x228681[_0xbe26('0x46')][_0xbe26('0x51')]+'%'};return _0x4f7f8a;})});}_0x48e80a=_[_0xbe26('0x52')]({},_0x48e80a,_0x228681[_0xbe26('0x59')]);return db[_0xbe26('0x9e')][_0xbe26('0x34')]({'where':_0x48e80a[_0xbe26('0x4f')]})['then'](function(_0x2e5ebc){_0x15da32['count']=_0x2e5ebc;if(_0x228681[_0xbe26('0x46')][_0xbe26('0x6a')]){_0x48e80a[_0xbe26('0x58')]=[{'model':db['CmContact'],'as':_0xbe26('0xc0'),'required':![]},{'model':db[_0xbe26('0xa7')],'as':'Owner','attributes':[_0xbe26('0x3c'),_0xbe26('0xc1'),'internal'],'required':![]},{'model':db[_0xbe26('0xc2')],'as':'Tags','attributes':['id','name',_0xbe26('0xc3')],'where':_0x228681['query'][_0xbe26('0xc4')]?{'id':_0x228681['query'][_0xbe26('0xc4')]}:undefined,'required':_0x228681[_0xbe26('0x46')][_0xbe26('0xc4')]?!![]:![]}];}return db[_0xbe26('0x9e')][_0xbe26('0x54')](_0x48e80a);})['then'](function(_0x45abeb){_0x15da32['rows']=_0x45abeb;return _0x15da32;});}})[_0xbe26('0x22')](respondWithFilteredResult(_0x39c948,_0x48e80a))[_0xbe26('0x2c')](handleError(_0x39c948,null));};exports[_0xbe26('0x3d')]=function(_0x3a36a2,_0x4fa962,_0x102c5c){var _0xf4cf42,_0x1c8bf3,_0x4dc14c;if(_[_0xbe26('0x90')](_0x3a36a2[_0xbe26('0x5c')]['body'])||_0x3a36a2['body']['body']===''){throw new db[(_0xbe26('0x79'))][(_0xbe26('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbe26('0x90')](_0x3a36a2['body']['to'])){throw new db[(_0xbe26('0x79'))][(_0xbe26('0x91'))](_0xbe26('0xc5'));}_0xf4cf42=_0x3a36a2[_0xbe26('0x5c')]['to'];return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x3a36a2['params']['id']},'include':[{'model':db[_0xbe26('0x97')],'as':_0xbe26('0xc6'),'include':[{'model':db['CmContact'],'as':_0xbe26('0x99'),'where':{'mobile':_0xf4cf42},'limit':0x1,'order':[[_0xbe26('0x9a'),_0xbe26('0x9b')]]}]}]})[_0xbe26('0x22')](handleEntityNotFound(_0x4fa962,null))['then'](function(_0x4f2feb){if(_0x4f2feb&&_0x4f2feb['List']){_0x1c8bf3=_0x4f2feb[_0xbe26('0x5d')]({'plain':!![]});if(_0x1c8bf3[_0xbe26('0xc6')]&&_0x1c8bf3[_0xbe26('0xc6')][_0xbe26('0x99')][_0xbe26('0x57')]){return _0x1c8bf3[_0xbe26('0xc6')][_0xbe26('0x99')][0x0];}return db[_0xbe26('0x98')][_0xbe26('0x5b')](_['defaults'](_0x3a36a2[_0xbe26('0x5c')],{'firstName':_0xf4cf42,'mobile':_0xf4cf42,'phone':_0xf4cf42,'ListId':_0x1c8bf3[_0xbe26('0x7e')]}));}})[_0xbe26('0x22')](handleEntityNotFound(_0x4fa962,null))[_0xbe26('0x22')](function(_0x43e173){if(_0x43e173){_0x4dc14c=_0x43e173;return db['SmsInteraction'][_0xbe26('0x5a')]({'where':{'ContactId':_0x4dc14c['id'],'closed':![],'SmsAccountId':_0x1c8bf3['id']}})[_0xbe26('0x22')](function(_0x4b5cd8){if(_0x4b5cd8){return[_0x4b5cd8,![]];}return db['SmsInteraction'][_0xbe26('0x5b')]({'UserId':_0x3a36a2[_0xbe26('0x5f')]['id'],'ContactId':_0x4dc14c['id'],'SmsAccountId':_0x1c8bf3['id'],'phone':_0xf4cf42,'firstMsgDirection':_0xbe26('0xc7'),'Messages':[_['merge'](_0x3a36a2[_0xbe26('0x5c')],{'read':![],'body':_0x3a36a2[_0xbe26('0x5c')][_0xbe26('0x5c')],'phone':_0xf4cf42,'SmsAccountId':_0x1c8bf3['id'],'UserId':_0x3a36a2[_0xbe26('0x5f')]['id'],'ContactId':_0x4dc14c['id']})]},{'include':[{'model':db[_0xbe26('0xa5')],'as':_0xbe26('0xc8')}]})[_0xbe26('0x22')](function(_0x49f910){return[_0x49f910,!![]];});});}})[_0xbe26('0x9f')](function(_0x4d1c89,_0x23c980){if(_0x23c980){return _0x4d1c89;}return db[_0xbe26('0xa5')][_0xbe26('0x5b')](_['merge'](_0x3a36a2['body'],{'read':![],'body':_0x3a36a2[_0xbe26('0x5c')][_0xbe26('0x5c')],'phone':_0xf4cf42,'SmsAccountId':_0x1c8bf3['id'],'SmsInteractionId':_0x4d1c89['id'],'UserId':_0x3a36a2['user']['id'],'ContactId':_0x4dc14c['id']}))[_0xbe26('0x22')](function(_0x50f017){_0x4d1c89['dataValues'][_0xbe26('0xc8')]=[];_0x4d1c89[_0xbe26('0xc9')][_0xbe26('0xc8')]['push'](_0x50f017['dataValues']);return _0x4d1c89;});})[_0xbe26('0x22')](respondWithResult(_0x4fa962,null))[_0xbe26('0x2c')](handleError(_0x4fa962,null));};exports['status']=function(_0x5e4ee9,_0x4f867a,_0x1c1532){if(_0x5e4ee9['body']['id']){delete _0x5e4ee9['body']['id'];}var _0xeb4158,_0x92fec4,_0x55a51e;return db['SmsAccount'][_0xbe26('0x5a')]({'where':{'id':_0x5e4ee9['params']['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x4f867a,null))[_0xbe26('0x22')](function(_0x1e1fe4){if(_0x1e1fe4){_0x55a51e=_0x1e1fe4;logger[_0xbe26('0xca')](_0xbe26('0x26'),_0xbe26('0x2f'),_0xbe26('0xcb'),_0x1e1fe4['type'],util[_0xbe26('0xcc')](_0x5e4ee9[_0xbe26('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1e1fe4[_0xbe26('0x44')]){case'skebby':if(_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0xcd')]&&_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0x2f')]){_0x92fec4=_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0x2f')];return db['SmsMessage'][_0xbe26('0x5a')]({'where':{'messageId':_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0xcd')]}});}break;case'connectel':if(_0x5e4ee9['body'][_0xbe26('0xce')]&&_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0xcf')]){_0x92fec4=_0x5e4ee9[_0xbe26('0x5c')]['statusInt'];return db[_0xbe26('0xa5')][_0xbe26('0x5a')]({'where':{'messageId':_0x5e4ee9['body'][_0xbe26('0xce')]}});}break;case _0xbe26('0xd0'):if(_0x5e4ee9['body'][_0xbe26('0xd1')]&&_0x5e4ee9[_0xbe26('0x5c')]['status_code']){_0x92fec4=_0x5e4ee9[_0xbe26('0x5c')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0xd1')]}});}break;case _0xbe26('0xd2'):var _0x1b52da=_0x5e4ee9['body'][_0xbe26('0x88')][0x0];if(_0x1b52da[_0xbe26('0x87')]&&_0x1b52da[_0xbe26('0x2f')]['groupName']==='DELIVERED'){_0x92fec4=_0x1b52da[_0xbe26('0x2f')]['groupName'];return db[_0xbe26('0xa5')][_0xbe26('0x5a')]({'where':{'messageId':_0x1b52da[_0xbe26('0x87')]}});}break;case _0xbe26('0x8c'):if(_0x5e4ee9[_0xbe26('0x5c')]['messageId']&&_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0x2f')]){_0x92fec4=_0x5e4ee9['body'][_0xbe26('0x2f')];return db[_0xbe26('0xa5')][_0xbe26('0x5a')]({'where':{'messageId':_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0x87')]}});}break;case _0xbe26('0x8e'):if(_0x5e4ee9['body'][0x0][_0xbe26('0x2a')]['id']){_0x92fec4=_0x5e4ee9[_0xbe26('0x5c')][0x0][_0xbe26('0x44')];return db[_0xbe26('0xa5')][_0xbe26('0x5a')]({'where':{'messageId':_0x5e4ee9['body'][0x0][_0xbe26('0x2a')]['id']}});}break;case _0xbe26('0xd3'):if(_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0xd4')]&&_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0x2f')]){_0x92fec4=_0x5e4ee9[_0xbe26('0x5c')]['status'];return db[_0xbe26('0xa5')][_0xbe26('0x5a')]({'where':{'messageId':_0x5e4ee9[_0xbe26('0x5c')]['redif']}});}break;}}})[_0xbe26('0x22')](handleEntityNotFound(_0x4f867a,null))[_0xbe26('0x22')](function(_0x36a2d0){if(_0x36a2d0){_0xeb4158=_0x36a2d0;switch(_0x55a51e['type']){case _0xbe26('0x84'):if(_0x92fec4===_0xbe26('0xd5')){return _0xeb4158['update']({'read':!![]});}else{logger[_0xbe26('0x28')](_0xbe26('0x26'),_0xbe26('0x2f'),_0xbe26('0x84'),util['inspect'](_0x5e4ee9[_0xbe26('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xbe26('0xd6'):if(_0x92fec4==='1'){return _0xeb4158[_0xbe26('0x38')]({'read':!![]});}else{logger[_0xbe26('0x28')](_0xbe26('0x26'),_0xbe26('0x2f'),_0xbe26('0x84'),util[_0xbe26('0xcc')](_0x5e4ee9['body'],{'showHidden':![],'depth':null}));}break;case _0xbe26('0xd0'):if(!_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0xd7')]&&_0x92fec4>=0xc8&&_0x92fec4<=0xce){return _0xeb4158[_0xbe26('0x38')]({'read':!![]});}else{logger[_0xbe26('0x28')](_0xbe26('0x26'),_0xbe26('0x2f'),_0xbe26('0xd0'),util[_0xbe26('0xcc')](_0x5e4ee9[_0xbe26('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xbe26('0xd2'):var _0x149abe=_0x5e4ee9[_0xbe26('0x5c')][_0xbe26('0x88')][0x0];if(_0x149abe['status'][_0xbe26('0xd8')]===_0xbe26('0xd5')){return _0xeb4158[_0xbe26('0x38')]({'read':!![]});}else{logger[_0xbe26('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbe26('0x2f'),_0xbe26('0xd2'),util[_0xbe26('0xcc')](_0x5e4ee9[_0xbe26('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xbe26('0x8c'):if(_0x92fec4==_0xbe26('0xd9')||_0x92fec4==_0xbe26('0xda')){return _0xeb4158[_0xbe26('0x38')]({'read':!![]});}else{logger[_0xbe26('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xbe26('0x8c'),util['inspect'](_0x5e4ee9[_0xbe26('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xbe26('0x8e'):if(_0x92fec4=='message-delivered'){return _0xeb4158[_0xbe26('0x38')]({'read':!![]});}else{logger[_0xbe26('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbe26('0x2f'),'bandwidth',util[_0xbe26('0xcc')](_0x5e4ee9['body'],{'showHidden':![],'depth':null}));}break;case _0xbe26('0xd3'):if(_0x92fec4===_0xbe26('0xdb')||_0x92fec4===_0xbe26('0xdc')){return _0xeb4158[_0xbe26('0x38')]({'read':!![]});}else{logger[_0xbe26('0x28')](_0xbe26('0x26'),_0xbe26('0x2f'),'intelepeer',util[_0xbe26('0xcc')](_0x5e4ee9[_0xbe26('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0xeb4158;}})['then'](respondWithResult(_0x4f867a,null))[_0xbe26('0x2c')](handleError(_0x4f867a,null));};exports['statusGet']=function(_0x16173e,_0x421d63,_0x750c89){var _0x38f86f,_0x275b6c,_0x3d0cf9;return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x16173e['params']['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x421d63,null))[_0xbe26('0x22')](function(_0x52781f){if(_0x52781f){_0x3d0cf9=_0x52781f;logger[_0xbe26('0xca')](_0xbe26('0x26'),_0xbe26('0x2f'),'received\x20delivery\x20report\x20from',_0x52781f['type'],util[_0xbe26('0xcc')](_0x16173e[_0xbe26('0x46')],{'showHidden':![],'depth':null}));switch(_0x52781f[_0xbe26('0x44')]){case _0xbe26('0x8a'):if(_0x16173e['query'][_0xbe26('0xdd')]&&_0x16173e[_0xbe26('0x46')][_0xbe26('0xde')]){_0x275b6c=_0x16173e[_0xbe26('0x46')]['state'];return db[_0xbe26('0xa5')][_0xbe26('0x5a')]({'where':{'messageId':_0x16173e[_0xbe26('0x46')][_0xbe26('0xdd')]}});}break;}}})[_0xbe26('0x22')](handleEntityNotFound(_0x421d63,null))[_0xbe26('0x22')](function(_0x5725b3){if(_0x5725b3){_0x38f86f=_0x5725b3;switch(_0x3d0cf9[_0xbe26('0x44')]){case _0xbe26('0x8a'):if(_0x275b6c==='2'||_0x275b6c==='6'){return _0x38f86f[_0xbe26('0x38')]({'read':!![]});}else{logger[_0xbe26('0x28')](_0xbe26('0x26'),_0xbe26('0x2f'),'csc',util[_0xbe26('0xcc')](_0x16173e[_0xbe26('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x38f86f;}})[_0xbe26('0x22')](respondWithResult(_0x421d63,null))[_0xbe26('0x2c')](handleError(_0x421d63,null));};exports[_0xbe26('0xdf')]=function(_0xaa641,_0x14c468,_0x148ccc){return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0xaa641[_0xbe26('0x56')]['id']}})['then'](handleEntityNotFound(_0x14c468,null))[_0xbe26('0x22')](function(_0x1db4da){if(_0x1db4da){return _0x1db4da['addAgents'](_0xaa641[_0xbe26('0x5c')]['ids'],_[_0xbe26('0x9c')](_0xaa641['body'],[_0xbe26('0x6c'),'id'])||{})[_0xbe26('0x9f')](function(_0x3f94fe){for(var _0x4540b4=0x0;_0x4540b4<_0xaa641['body'][_0xbe26('0x6c')][_0xbe26('0x57')];_0x4540b4+=0x1){socket[_0xbe26('0xe0')](_0xbe26('0xe1'),{'UserId':Number(_0xaa641[_0xbe26('0x5c')][_0xbe26('0x6c')][_0x4540b4]),'SmsAccountId':Number(_0xaa641[_0xbe26('0x56')]['id'])});}return _0x3f94fe;});}})[_0xbe26('0x22')](respondWithResult(_0x14c468,null))['catch'](handleError(_0x14c468,null));};exports[_0xbe26('0xe2')]=function(_0x377c62,_0x3a2aca,_0x5685b9){return db[_0xbe26('0x42')][_0xbe26('0x5a')]({'where':{'id':_0x377c62[_0xbe26('0x56')]['id']}})[_0xbe26('0x22')](handleEntityNotFound(_0x3a2aca,null))[_0xbe26('0x22')](function(_0x1843f8){if(_0x1843f8){return _0x1843f8[_0xbe26('0xe2')](_0x377c62[_0xbe26('0x46')][_0xbe26('0x6c')])['then'](function(){if(_['isArray'](_0x377c62['query'][_0xbe26('0x6c')])){for(var _0xf2e031=0x0;_0xf2e031<_0x377c62[_0xbe26('0x46')][_0xbe26('0x6c')]['length'];_0xf2e031+=0x1){socket['emit'](_0xbe26('0xe3'),{'UserId':Number(_0x377c62[_0xbe26('0x46')][_0xbe26('0x6c')][_0xf2e031]),'SmsAccountId':Number(_0x377c62['params']['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x377c62[_0xbe26('0x46')][_0xbe26('0x6c')]),'SmsAccountId':Number(_0x377c62[_0xbe26('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a2aca,null))[_0xbe26('0x2c')](handleError(_0x3a2aca,null));};exports[_0xbe26('0xe4')]=function(_0x519255,_0x2aa151,_0x3aba6c){var _0x2ca457={};var _0x305171={};var _0x12a609;var _0xc47b38;return db[_0xbe26('0x42')][_0xbe26('0x67')]({'where':{'id':_0x519255['params']['id']}})['then'](handleEntityNotFound(_0x2aa151,null))[_0xbe26('0x22')](function(_0xa7f514){if(_0xa7f514){_0x12a609=_0xa7f514;_0x305171[_0xbe26('0x45')]=_[_0xbe26('0x47')](db[_0xbe26('0xa7')][_0xbe26('0x43')]);_0x305171[_0xbe26('0x46')]=_[_0xbe26('0x47')](_0x519255[_0xbe26('0x46')]);_0x305171[_0xbe26('0x48')]=_[_0xbe26('0x4a')](_0x305171[_0xbe26('0x45')],_0x305171['query']);_0x2ca457[_0xbe26('0x49')]=_[_0xbe26('0x4a')](_0x305171[_0xbe26('0x45')],qs[_0xbe26('0x4b')](_0x519255['query'][_0xbe26('0x4b')]));_0x2ca457[_0xbe26('0x49')]=_0x2ca457[_0xbe26('0x49')][_0xbe26('0x57')]?_0x2ca457[_0xbe26('0x49')]:_0x305171[_0xbe26('0x45')];_0x2ca457[_0xbe26('0x4d')]=qs[_0xbe26('0x4e')](_0x519255[_0xbe26('0x46')][_0xbe26('0x4e')]);_0x2ca457[_0xbe26('0x4f')]=qs['filters'](_['pick'](_0x519255[_0xbe26('0x46')],_0x305171[_0xbe26('0x48')]));if(_0x519255[_0xbe26('0x46')]['filter']){_0x2ca457[_0xbe26('0x4f')]=_['merge'](_0x2ca457[_0xbe26('0x4f')],{'$or':_[_0xbe26('0x41')](_0x2ca457[_0xbe26('0x49')],function(_0x2fe6e0){var _0x415070={};_0x415070[_0x2fe6e0]={'$like':'%'+_0x519255[_0xbe26('0x46')][_0xbe26('0x51')]+'%'};return _0x415070;})});}_0x2ca457=_[_0xbe26('0x52')]({},_0x2ca457,_0x519255[_0xbe26('0x59')]);return _0x12a609[_0xbe26('0xe4')](_0x2ca457);}})['then'](function(_0x5738b0){if(_0x5738b0){_0xc47b38=_0x5738b0['length'];if(!_0x519255[_0xbe26('0x46')][_0xbe26('0x4c')](_0xbe26('0x68'))){_0x2ca457[_0xbe26('0x33')]=qs['limit'](_0x519255[_0xbe26('0x46')][_0xbe26('0x33')]);_0x2ca457['offset']=qs['offset'](_0x519255['query'][_0xbe26('0x31')]);}return _0x12a609[_0xbe26('0xe4')](_0x2ca457);}})['then'](function(_0x5ccf5c){if(_0x5ccf5c){return _0x5ccf5c?{'count':_0xc47b38,'rows':_0x5ccf5c}:null;}})[_0xbe26('0x22')](respondWithResult(_0x2aa151,null))[_0xbe26('0x2c')](handleError(_0x2aa151,null));}; \ No newline at end of file +var _0x2ec5=['message_id','plivo','Text','results','csc','originatingAddress','clickatell','fromNumber','bandwidth','refid','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','defaults','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','UserId','User','applications','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','twilio','text/xml','send','addApplications','sequelize','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','CmList','List','Messages','dataValues','debug','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','infobip','groupName','intelepeer','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','stack','name','index','mandatoryDispositionPause','SmsAccount','fieldName','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filters','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','Pause','rawAttributes','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','Disposition','length','order','map','removeDispositions','ids','addAnswer','CannedAnswer','findOne','notify','sms','SmsApplication','Applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','updatedAt','createdAt','CompanyId','ListId','mobile','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ec5,0x136));var _0x52ec=function(_0x16f13f,_0x1d3ffe){_0x16f13f=_0x16f13f-0x0;var _0x4183fc=_0x2ec5[_0x16f13f];return _0x4183fc;};'use strict';var emlformat=require(_0x52ec('0x0'));var rimraf=require(_0x52ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x52ec('0x2'));var moment=require(_0x52ec('0x3'));var BPromise=require(_0x52ec('0x4'));var Mustache=require(_0x52ec('0x5'));var util=require(_0x52ec('0x6'));var path=require(_0x52ec('0x7'));var sox=require(_0x52ec('0x8'));var csv=require('to-csv');var ejs=require(_0x52ec('0x9'));var fs=require('fs');var fs_extra=require(_0x52ec('0xa'));var _=require(_0x52ec('0xb'));var squel=require(_0x52ec('0xc'));var crypto=require(_0x52ec('0xd'));var jsforce=require(_0x52ec('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x52ec('0xf'));var Papa=require(_0x52ec('0x10'));var Redis=require(_0x52ec('0x11'));var authService=require(_0x52ec('0x12'));var qs=require(_0x52ec('0x13'));var as=require(_0x52ec('0x14'));var hardwareService=require(_0x52ec('0x15'));var logger=require(_0x52ec('0x16'))(_0x52ec('0x17'));var utils=require(_0x52ec('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x52ec('0x19'))['db'];config[_0x52ec('0x1a')]=_['defaults'](config[_0x52ec('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x52ec('0x1b'))(new Redis(config[_0x52ec('0x1a')]));require(_0x52ec('0x1c'))[_0x52ec('0x1d')](socket);var jayson=require(_0x52ec('0x1e'));var client=jayson[_0x52ec('0x1f')][_0x52ec('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5f3661,_0x82ab51,_0x3720a8,_0x35f299){return new BPromise(function(_0x2d2a72,_0x4899a8){var _0x29149f=_0x35f299||client;return _0x29149f[_0x52ec('0x21')](_0x5f3661,_0x3720a8)['then'](function(_0x4a4d04){logger['info'](_0x52ec('0x22'),_0x82ab51,_0x52ec('0x23'));logger['debug'](_0x52ec('0x24'),_0x82ab51,_0x52ec('0x23'),JSON['stringify'](_0x4a4d04));if(_0x4a4d04[_0x52ec('0x25')]){if(_0x4a4d04['error'][_0x52ec('0x26')]===0x1f4){logger[_0x52ec('0x25')](_0x52ec('0x22'),_0x82ab51,_0x4a4d04[_0x52ec('0x25')][_0x52ec('0x27')]);return _0x4899a8(_0x4a4d04['error'][_0x52ec('0x27')]);}logger[_0x52ec('0x25')](_0x52ec('0x22'),_0x82ab51,_0x4a4d04[_0x52ec('0x25')][_0x52ec('0x27')]);return _0x2d2a72(_0x4a4d04[_0x52ec('0x25')][_0x52ec('0x27')]);}else{logger[_0x52ec('0x28')](_0x52ec('0x22'),_0x82ab51,_0x52ec('0x23'));_0x2d2a72(_0x4a4d04['result'][_0x52ec('0x27')]);}})['catch'](function(_0x30bf1f){logger[_0x52ec('0x25')](_0x52ec('0x22'),_0x82ab51,_0x30bf1f);_0x4899a8(_0x30bf1f);});});}function respondWithStatusCode(_0x6c5888,_0x593c7b){_0x593c7b=_0x593c7b||0xcc;return function(_0x3d7455){if(_0x3d7455){return _0x6c5888[_0x52ec('0x29')](_0x593c7b);}return _0x6c5888[_0x52ec('0x2a')](_0x593c7b)[_0x52ec('0x2b')]();};}function respondWithResult(_0x214ff5,_0x5b9beb){_0x5b9beb=_0x5b9beb||0xc8;return function(_0x1ca9fe){if(_0x1ca9fe){return _0x214ff5[_0x52ec('0x2a')](_0x5b9beb)[_0x52ec('0x2c')](_0x1ca9fe);}};}function respondWithFilteredResult(_0x29c2d0,_0x1c76ca){return function(_0x1615c6){if(_0x1615c6){var _0x17de46=typeof _0x1c76ca['offset']===_0x52ec('0x2d')&&typeof _0x1c76ca[_0x52ec('0x2e')]===_0x52ec('0x2d');var _0x4e5e36=_0x1615c6[_0x52ec('0x2f')];var _0xa47b91=_0x17de46?0x0:_0x1c76ca[_0x52ec('0x30')];var _0x319a9e=_0x17de46?_0x1615c6['count']:_0x1c76ca[_0x52ec('0x30')]+_0x1c76ca[_0x52ec('0x2e')];var _0x5c7448;if(_0x319a9e>=_0x4e5e36){_0x319a9e=_0x4e5e36;_0x5c7448=0xc8;}else{_0x5c7448=0xce;}_0x29c2d0[_0x52ec('0x2a')](_0x5c7448);return _0x29c2d0[_0x52ec('0x31')]('Content-Range',_0xa47b91+'-'+_0x319a9e+'/'+_0x4e5e36)[_0x52ec('0x2c')](_0x1615c6);}return null;};}function patchUpdates(_0x20a17a){return function(_0x2ff6b3){try{jsonpatch[_0x52ec('0x32')](_0x2ff6b3,_0x20a17a,!![]);}catch(_0x30c5cf){return BPromise[_0x52ec('0x33')](_0x30c5cf);}return _0x2ff6b3['save']();};}function saveUpdates(_0x511e07,_0x124434){return function(_0x5a5fb5){if(_0x5a5fb5){return _0x5a5fb5[_0x52ec('0x34')](_0x511e07)[_0x52ec('0x35')](function(_0x547cd0){return _0x547cd0;});}return null;};}function removeEntity(_0x22ac04,_0x527bb3){return function(_0x51da25){if(_0x51da25){return _0x51da25[_0x52ec('0x36')]()[_0x52ec('0x35')](function(){var _0x4c5a9a=_0x51da25['get']({'plain':!![]});var _0x45cafd='SmsAccounts';return db['UserProfileResource'][_0x52ec('0x36')]({'where':{'type':_0x45cafd,'resourceId':_0x4c5a9a['id']}})[_0x52ec('0x35')](function(){return _0x51da25;});})[_0x52ec('0x35')](function(){_0x22ac04[_0x52ec('0x2a')](0xcc)[_0x52ec('0x2b')]();});}};}function handleEntityNotFound(_0x28ab6e,_0x1aae7c){return function(_0x53451c){if(!_0x53451c){_0x28ab6e[_0x52ec('0x29')](0x194);}return _0x53451c;};}function handleError(_0x3b66e6,_0x2229d3){_0x2229d3=_0x2229d3||0x1f4;return function(_0x824752){logger[_0x52ec('0x25')](_0x824752[_0x52ec('0x37')]);if(_0x824752['name']){delete _0x824752[_0x52ec('0x38')];}_0x3b66e6[_0x52ec('0x2a')](_0x2229d3)['send'](_0x824752);};}exports[_0x52ec('0x39')]=function(_0x2b0388,_0x5148d7){var _0x25c8e0={'include':[{'model':db['Pause'],'as':_0x52ec('0x3a')}]},_0x458a8a={},_0x1c8ece={'count':0x0,'rows':[]};var _0x345b56=_['map'](db[_0x52ec('0x3b')]['rawAttributes'],function(_0x153280){return{'name':_0x153280[_0x52ec('0x3c')],'type':_0x153280['type']['key']};});_0x458a8a['model']=_['map'](_0x345b56,_0x52ec('0x38'));_0x458a8a[_0x52ec('0x3d')]=_[_0x52ec('0x3e')](_0x2b0388['query']);_0x458a8a['filters']=_[_0x52ec('0x3f')](_0x458a8a[_0x52ec('0x40')],_0x458a8a[_0x52ec('0x3d')]);_0x25c8e0['attributes']=_[_0x52ec('0x3f')](_0x458a8a[_0x52ec('0x40')],qs[_0x52ec('0x41')](_0x2b0388[_0x52ec('0x3d')][_0x52ec('0x41')]));_0x25c8e0[_0x52ec('0x42')]=_0x25c8e0[_0x52ec('0x42')]['length']?_0x25c8e0[_0x52ec('0x42')]:_0x458a8a[_0x52ec('0x40')];if(!_0x2b0388['query'][_0x52ec('0x43')](_0x52ec('0x44'))){_0x25c8e0[_0x52ec('0x2e')]=qs['limit'](_0x2b0388[_0x52ec('0x3d')][_0x52ec('0x2e')]);_0x25c8e0[_0x52ec('0x30')]=qs['offset'](_0x2b0388[_0x52ec('0x3d')][_0x52ec('0x30')]);}_0x25c8e0['order']=qs[_0x52ec('0x45')](_0x2b0388[_0x52ec('0x3d')][_0x52ec('0x45')]);_0x25c8e0['where']=qs['filters'](_[_0x52ec('0x46')](_0x2b0388[_0x52ec('0x3d')],_0x458a8a[_0x52ec('0x47')]),_0x345b56);if(_0x2b0388[_0x52ec('0x3d')]['filter']){_0x25c8e0[_0x52ec('0x48')]=_[_0x52ec('0x49')](_0x25c8e0[_0x52ec('0x48')],{'$or':_['map'](_0x345b56,function(_0x512ad1){if(_0x512ad1[_0x52ec('0x4a')]!==_0x52ec('0x4b')){var _0x5aa60a={};_0x5aa60a[_0x512ad1[_0x52ec('0x38')]]={'$like':'%'+_0x2b0388['query'][_0x52ec('0x4c')]+'%'};return _0x5aa60a;}})});}_0x25c8e0=_[_0x52ec('0x49')]({},_0x25c8e0,_0x2b0388['options']);var _0x2cf692={'where':_0x25c8e0['where']};return db[_0x52ec('0x3b')]['count'](_0x2cf692)[_0x52ec('0x35')](function(_0x296c03){_0x1c8ece[_0x52ec('0x2f')]=_0x296c03;if(_0x2b0388[_0x52ec('0x3d')][_0x52ec('0x4d')]){_0x25c8e0[_0x52ec('0x4e')]=[{'all':!![]}];}return db[_0x52ec('0x3b')][_0x52ec('0x4f')](_0x25c8e0);})[_0x52ec('0x35')](function(_0xf2a377){_0x1c8ece[_0x52ec('0x50')]=_0xf2a377;return _0x1c8ece;})[_0x52ec('0x35')](respondWithFilteredResult(_0x5148d7,_0x25c8e0))['catch'](handleError(_0x5148d7,null));};exports[_0x52ec('0x51')]=function(_0x427c9c,_0x250923){var _0x441b3f={'raw':![],'where':{'id':_0x427c9c[_0x52ec('0x52')]['id']},'include':[{'model':db[_0x52ec('0x53')],'as':_0x52ec('0x3a')}]},_0x1a5cbc={};_0x1a5cbc['model']=_[_0x52ec('0x3e')](db[_0x52ec('0x3b')][_0x52ec('0x54')]);_0x1a5cbc[_0x52ec('0x3d')]=_[_0x52ec('0x3e')](_0x427c9c[_0x52ec('0x3d')]);_0x1a5cbc[_0x52ec('0x47')]=_[_0x52ec('0x3f')](_0x1a5cbc['model'],_0x1a5cbc[_0x52ec('0x3d')]);_0x441b3f[_0x52ec('0x42')]=_[_0x52ec('0x3f')](_0x1a5cbc[_0x52ec('0x40')],qs[_0x52ec('0x41')](_0x427c9c[_0x52ec('0x3d')][_0x52ec('0x41')]));_0x441b3f['attributes']=_0x441b3f[_0x52ec('0x42')]['length']?_0x441b3f[_0x52ec('0x42')]:_0x1a5cbc[_0x52ec('0x40')];if(_0x427c9c[_0x52ec('0x3d')]['includeAll']){_0x441b3f[_0x52ec('0x4e')]=[{'all':!![]}];}_0x441b3f=_['merge']({},_0x441b3f,_0x427c9c[_0x52ec('0x55')]);return db['SmsAccount']['find'](_0x441b3f)[_0x52ec('0x35')](handleEntityNotFound(_0x250923,null))['then'](respondWithResult(_0x250923,null))[_0x52ec('0x56')](handleError(_0x250923,null));};exports[_0x52ec('0x57')]=function(_0x2796ca,_0x460cc1){return db[_0x52ec('0x3b')][_0x52ec('0x57')](_0x2796ca[_0x52ec('0x58')],{})[_0x52ec('0x35')](function(_0x56804b){var _0x20160a=_0x2796ca[_0x52ec('0x59')][_0x52ec('0x5a')]({'plain':!![]});if(!_0x20160a)throw new Error(_0x52ec('0x5b'));if(_0x20160a['role']==='user'){var _0x257d7f=_0x56804b[_0x52ec('0x5a')]({'plain':!![]});var _0x10379f=_0x52ec('0x5c');return db['UserProfileSection'][_0x52ec('0x5d')]({'where':{'name':_0x10379f,'userProfileId':_0x20160a['userProfileId']},'raw':!![]})['then'](function(_0x33989d){if(_0x33989d&&_0x33989d['autoAssociation']===0x0){return db[_0x52ec('0x5e')][_0x52ec('0x57')]({'name':_0x257d7f['name'],'resourceId':_0x257d7f['id'],'type':_0x33989d['name'],'sectionId':_0x33989d['id']},{})[_0x52ec('0x35')](function(){return _0x56804b;});}else{return _0x56804b;}})[_0x52ec('0x56')](function(_0x3fc637){logger[_0x52ec('0x25')](_0x52ec('0x5f'),_0x3fc637);throw _0x3fc637;});}return _0x56804b;})['then'](respondWithResult(_0x460cc1,0xc9))[_0x52ec('0x56')](handleError(_0x460cc1,null));};exports[_0x52ec('0x34')]=function(_0x337021,_0x5391f8){if(_0x337021[_0x52ec('0x58')]['id']){delete _0x337021[_0x52ec('0x58')]['id'];}return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x337021[_0x52ec('0x52')]['id']},'include':[{'model':db[_0x52ec('0x53')],'as':_0x52ec('0x3a')}]})[_0x52ec('0x35')](handleEntityNotFound(_0x5391f8,null))[_0x52ec('0x35')](saveUpdates(_0x337021[_0x52ec('0x58')],null))[_0x52ec('0x35')](respondWithResult(_0x5391f8,null))[_0x52ec('0x56')](handleError(_0x5391f8,null));};exports[_0x52ec('0x36')]=function(_0x1fa6b6,_0x2fac51){return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x1fa6b6[_0x52ec('0x52')]['id']}})['then'](handleEntityNotFound(_0x2fac51,null))[_0x52ec('0x35')](removeEntity(_0x2fac51,null))[_0x52ec('0x56')](handleError(_0x2fac51,null));};exports[_0x52ec('0x60')]=function(_0x2a2bef,_0x5aa1d1){return db[_0x52ec('0x3b')]['describe']()[_0x52ec('0x35')](respondWithResult(_0x5aa1d1,null))[_0x52ec('0x56')](handleError(_0x5aa1d1,null));};exports[_0x52ec('0x61')]=function(_0x5e241d,_0x5749cc,_0x31bff9){if(_0x5e241d[_0x52ec('0x58')]['id']){delete _0x5e241d[_0x52ec('0x58')]['id'];}return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x5e241d[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x5749cc,null))[_0x52ec('0x35')](function(_0x3622af){if(_0x3622af){_0x5e241d['body'][_0x52ec('0x62')]=_0x3622af['id'];return db['Disposition'][_0x52ec('0x57')](_0x5e241d[_0x52ec('0x58')]);}})[_0x52ec('0x35')](respondWithResult(_0x5749cc,null))[_0x52ec('0x56')](handleError(_0x5749cc,null));};exports[_0x52ec('0x63')]=function(_0x12b182,_0x58eb64,_0x5914c1){var _0x2a2904={'raw':![],'where':{}};var _0x1ecc39={};var _0xac9298={'count':0x0,'rows':[]};return db[_0x52ec('0x3b')]['findOne']({'where':{'id':_0x12b182[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x58eb64,null))['then'](function(_0x3361c1){if(_0x3361c1){_0x1ecc39[_0x52ec('0x40')]=_[_0x52ec('0x3e')](db[_0x52ec('0x64')][_0x52ec('0x54')]);_0x1ecc39['query']=_[_0x52ec('0x3e')](_0x12b182[_0x52ec('0x3d')]);_0x1ecc39['filters']=_[_0x52ec('0x3f')](_0x1ecc39[_0x52ec('0x40')],_0x1ecc39[_0x52ec('0x3d')]);_0x2a2904[_0x52ec('0x42')]=_['intersection'](_0x1ecc39[_0x52ec('0x40')],qs[_0x52ec('0x41')](_0x12b182[_0x52ec('0x3d')][_0x52ec('0x41')]));_0x2a2904['attributes']=_0x2a2904[_0x52ec('0x42')][_0x52ec('0x65')]?_0x2a2904['attributes']:_0x1ecc39[_0x52ec('0x40')];if(!_0x12b182['query']['hasOwnProperty'](_0x52ec('0x44'))){_0x2a2904[_0x52ec('0x2e')]=qs['limit'](_0x12b182[_0x52ec('0x3d')][_0x52ec('0x2e')]);_0x2a2904['offset']=qs[_0x52ec('0x30')](_0x12b182[_0x52ec('0x3d')][_0x52ec('0x30')]);}_0x2a2904[_0x52ec('0x66')]=qs[_0x52ec('0x45')](_0x12b182[_0x52ec('0x3d')][_0x52ec('0x45')]);_0x2a2904[_0x52ec('0x48')]=qs[_0x52ec('0x47')](_['pick'](_0x12b182['query'],_0x1ecc39[_0x52ec('0x47')]));_0x2a2904[_0x52ec('0x48')][_0x52ec('0x62')]=_0x3361c1['id'];if(_0x12b182[_0x52ec('0x3d')][_0x52ec('0x4c')]){_0x2a2904[_0x52ec('0x48')]=_[_0x52ec('0x49')](_0x2a2904['where'],{'$or':_[_0x52ec('0x67')](_0x2a2904[_0x52ec('0x42')],function(_0x1e617a){var _0x54c4ae={};_0x54c4ae[_0x1e617a]={'$like':'%'+_0x12b182[_0x52ec('0x3d')][_0x52ec('0x4c')]+'%'};return _0x54c4ae;})});}_0x2a2904=_[_0x52ec('0x49')]({},_0x2a2904,_0x12b182[_0x52ec('0x55')]);return db['Disposition'][_0x52ec('0x2f')]({'where':_0x2a2904[_0x52ec('0x48')]})[_0x52ec('0x35')](function(_0x2b37b8){_0xac9298[_0x52ec('0x2f')]=_0x2b37b8;if(_0x12b182[_0x52ec('0x3d')][_0x52ec('0x4d')]){_0x2a2904[_0x52ec('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0x52ec('0x4f')](_0x2a2904);})[_0x52ec('0x35')](function(_0x1b6720){_0xac9298[_0x52ec('0x50')]=_0x1b6720;return _0xac9298;});}})[_0x52ec('0x35')](respondWithFilteredResult(_0x58eb64,_0x2a2904))[_0x52ec('0x56')](handleError(_0x58eb64,null));};exports['removeDispositions']=function(_0x3feca8,_0x3cc4a6,_0x23460f){return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x3feca8['params']['id']}})['then'](handleEntityNotFound(_0x3cc4a6,null))[_0x52ec('0x35')](function(_0x221bff){if(_0x221bff){return _0x221bff[_0x52ec('0x68')](_0x3feca8[_0x52ec('0x3d')][_0x52ec('0x69')]);}})[_0x52ec('0x35')](respondWithStatusCode(_0x3cc4a6,null))['catch'](handleError(_0x3cc4a6,null));};exports[_0x52ec('0x6a')]=function(_0x2d1227,_0x11a5e1,_0x14248c){if(_0x2d1227['body']['id']){delete _0x2d1227[_0x52ec('0x58')]['id'];}return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x2d1227[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x11a5e1,null))[_0x52ec('0x35')](function(_0x1675ea){if(_0x1675ea){_0x2d1227[_0x52ec('0x58')]['SmsAccountId']=_0x1675ea['id'];return db[_0x52ec('0x6b')][_0x52ec('0x57')](_0x2d1227[_0x52ec('0x58')]);}})['then'](respondWithResult(_0x11a5e1,null))[_0x52ec('0x56')](handleError(_0x11a5e1,null));};exports['getAnswers']=function(_0x7289a8,_0x245b18,_0x146a23){var _0x4894f7={'raw':![],'where':{}};var _0x2ade52={};var _0x26044b={'count':0x0,'rows':[]};return db[_0x52ec('0x3b')][_0x52ec('0x6c')]({'where':{'id':_0x7289a8[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x245b18,null))['then'](function(_0x26672f){if(_0x26672f){_0x2ade52[_0x52ec('0x40')]=_['keys'](db[_0x52ec('0x6b')]['rawAttributes']);_0x2ade52['query']=_[_0x52ec('0x3e')](_0x7289a8[_0x52ec('0x3d')]);_0x2ade52[_0x52ec('0x47')]=_[_0x52ec('0x3f')](_0x2ade52[_0x52ec('0x40')],_0x2ade52[_0x52ec('0x3d')]);_0x4894f7[_0x52ec('0x42')]=_['intersection'](_0x2ade52[_0x52ec('0x40')],qs['fields'](_0x7289a8['query'][_0x52ec('0x41')]));_0x4894f7[_0x52ec('0x42')]=_0x4894f7[_0x52ec('0x42')][_0x52ec('0x65')]?_0x4894f7[_0x52ec('0x42')]:_0x2ade52[_0x52ec('0x40')];if(!_0x7289a8[_0x52ec('0x3d')][_0x52ec('0x43')]('nolimit')){_0x4894f7[_0x52ec('0x2e')]=qs[_0x52ec('0x2e')](_0x7289a8[_0x52ec('0x3d')][_0x52ec('0x2e')]);_0x4894f7['offset']=qs[_0x52ec('0x30')](_0x7289a8['query'][_0x52ec('0x30')]);}_0x4894f7[_0x52ec('0x66')]=qs[_0x52ec('0x45')](_0x7289a8['query']['sort']);_0x4894f7['where']=qs['filters'](_['pick'](_0x7289a8[_0x52ec('0x3d')],_0x2ade52['filters']));_0x4894f7['where'][_0x52ec('0x62')]=_0x26672f['id'];if(_0x7289a8[_0x52ec('0x3d')][_0x52ec('0x4c')]){_0x4894f7[_0x52ec('0x48')]=_[_0x52ec('0x49')](_0x4894f7[_0x52ec('0x48')],{'$or':_[_0x52ec('0x67')](_0x4894f7['attributes'],function(_0x54f23e){var _0xe4d00c={};_0xe4d00c[_0x54f23e]={'$like':'%'+_0x7289a8[_0x52ec('0x3d')][_0x52ec('0x4c')]+'%'};return _0xe4d00c;})});}_0x4894f7=_[_0x52ec('0x49')]({},_0x4894f7,_0x7289a8['options']);return db['CannedAnswer']['count']({'where':_0x4894f7[_0x52ec('0x48')]})[_0x52ec('0x35')](function(_0x452009){_0x26044b[_0x52ec('0x2f')]=_0x452009;if(_0x7289a8[_0x52ec('0x3d')][_0x52ec('0x4d')]){_0x4894f7[_0x52ec('0x4e')]=[{'all':!![]}];}return db[_0x52ec('0x6b')][_0x52ec('0x4f')](_0x4894f7);})[_0x52ec('0x35')](function(_0x583e33){_0x26044b[_0x52ec('0x50')]=_0x583e33;return _0x26044b;});}})[_0x52ec('0x35')](respondWithFilteredResult(_0x245b18,_0x4894f7))[_0x52ec('0x56')](handleError(_0x245b18,null));};exports['removeAnswers']=function(_0x51267d,_0x4462cd,_0xf40c51){return db[_0x52ec('0x3b')]['find']({'where':{'id':_0x51267d[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x4462cd,null))[_0x52ec('0x35')](function(_0x2bba9e){if(_0x2bba9e){return _0x2bba9e['removeAnswers'](_0x51267d[_0x52ec('0x3d')][_0x52ec('0x69')]);}})['then'](respondWithStatusCode(_0x4462cd,null))[_0x52ec('0x56')](handleError(_0x4462cd,null));};exports[_0x52ec('0x6d')]=function(_0x1155a6,_0x4011be,_0x5651d9){var _0x3d7637={'channel':_0x52ec('0x6e')};var _0x1833d2=[];var _0x2a0468=[];var _0x2abc40={};return db['SmsAccount'][_0x52ec('0x5d')]({'where':{'id':_0x1155a6[_0x52ec('0x52')]['id']},'include':[{'model':db[_0x52ec('0x6f')],'as':_0x52ec('0x70')}]})['then'](handleEntityNotFound(_0x4011be,null))['then'](function(_0x9874aa){_0x3d7637['account']=_0x9874aa;_0x3d7637['applications']=_[_0x52ec('0x71')](_0x9874aa[_0x52ec('0x70')],[_0x52ec('0x72')],[_0x52ec('0x73')]);if(_0x3d7637[_0x52ec('0x74')]['Applications']){delete _0x3d7637[_0x52ec('0x74')]['Applications'];}return db[_0x52ec('0x75')]['describe']();})[_0x52ec('0x35')](function(_0x4d7e74){if(!_0x4d7e74){throw new db[(_0x52ec('0x76'))][(_0x52ec('0x77'))]('no\x20available\x20attributes');}_0x1833d2=_['difference'](_[_0x52ec('0x3e')](_0x4d7e74),['createdAt',_0x52ec('0x78')]);_0x2a0468=_['difference'](_[_0x52ec('0x3e')](_0x4d7e74),[_0x52ec('0x79'),'updatedAt',_0x52ec('0x7a'),_0x52ec('0x7b')]);_0x3d7637[_0x52ec('0x58')]={'mapKey':_0x52ec('0x7c')};if(_0x3d7637[_0x52ec('0x74')][_0x52ec('0x4a')]){switch(_0x3d7637[_0x52ec('0x74')][_0x52ec('0x4a')]){case'twilio':_0x3d7637[_0x52ec('0x58')]['from']=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x7d')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')]=_0x1155a6['body'][_0x52ec('0x7e')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x7f')]=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x80')];break;case _0x52ec('0x81'):_0x3d7637[_0x52ec('0x58')][_0x52ec('0x82')]='+'+_0x1155a6[_0x52ec('0x58')][_0x52ec('0x83')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')]=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x84')];break;case _0x52ec('0x85'):_0x3d7637[_0x52ec('0x58')]['from']=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x82')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')]=_0x1155a6['body'][_0x52ec('0x27')];break;case'clicksend':_0x3d7637[_0x52ec('0x58')][_0x52ec('0x82')]=_0x1155a6['body'][_0x52ec('0x82')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')]=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x58')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x7f')]=_0x1155a6['body'][_0x52ec('0x86')];break;case _0x52ec('0x87'):_0x3d7637[_0x52ec('0x58')]['from']=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x7d')];_0x3d7637['body'][_0x52ec('0x58')]=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x88')];_0x3d7637[_0x52ec('0x58')]['messageId']=_0x1155a6['body']['MessageUUID'];break;case'infobip':_0x3d7637[_0x52ec('0x58')][_0x52ec('0x82')]='+'+_0x1155a6['body'][_0x52ec('0x89')][0x0][_0x52ec('0x82')];_0x3d7637[_0x52ec('0x58')]['body']=_0x1155a6[_0x52ec('0x58')]['results'][0x0][_0x52ec('0x84')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x7f')]=_0x1155a6[_0x52ec('0x58')]['results'][0x0][_0x52ec('0x7f')];break;case _0x52ec('0x8a'):_0x3d7637[_0x52ec('0x58')]['from']=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x8b')];_0x3d7637['body']['body']=_0x1155a6[_0x52ec('0x58')]['segmentedMessage'][_0x52ec('0x27')];break;case _0x52ec('0x8c'):_0x3d7637['body'][_0x52ec('0x82')]=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x8d')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')]=_0x1155a6[_0x52ec('0x58')]['text'];_0x3d7637['body'][_0x52ec('0x7f')]=_0x1155a6[_0x52ec('0x58')]['replyMessageId'];break;case _0x52ec('0x8e'):_0x3d7637[_0x52ec('0x58')][_0x52ec('0x7f')]=_0x1155a6[_0x52ec('0x58')][0x0][_0x52ec('0x27')]['id'];_0x3d7637['body'][_0x52ec('0x82')]=_0x1155a6[_0x52ec('0x58')][0x0][_0x52ec('0x27')][_0x52ec('0x82')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')]=_0x1155a6[_0x52ec('0x58')][0x0][_0x52ec('0x27')][_0x52ec('0x84')];break;case'intelepeer':_0x3d7637[_0x52ec('0x58')][_0x52ec('0x82')]=_0x1155a6['body'][_0x52ec('0x82')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')]=_0x1155a6['body'][_0x52ec('0x27')];_0x3d7637[_0x52ec('0x58')][_0x52ec('0x7f')]=_0x1155a6[_0x52ec('0x58')][_0x52ec('0x8f')];break;}}if(_0x3d7637[_0x52ec('0x58')]['id']){delete _0x3d7637[_0x52ec('0x58')]['id'];}if(_[_0x52ec('0x90')](_0x3d7637[_0x52ec('0x58')]['from'])){throw new db['Sequelize'][(_0x52ec('0x77'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x3d7637[_0x52ec('0x58')]['body'])||_0x3d7637[_0x52ec('0x58')]['body']===''){throw new db[(_0x52ec('0x76'))][(_0x52ec('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3d7637[_0x52ec('0x58')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x52ec('0x91')+_0x2a0468);}if(!_[_0x52ec('0x92')](_0x2a0468,_0x3d7637[_0x52ec('0x58')][_0x52ec('0x93')])){throw new db['Sequelize']['ValidationError'](_0x52ec('0x94')+_0x2a0468);}_0x2abc40[_0x3d7637[_0x52ec('0x58')]['mapKey']]=_0x3d7637[_0x52ec('0x58')][_0x52ec('0x82')];return db['CmList']['find']({'where':{'id':_0x3d7637[_0x52ec('0x74')]['ListId']},'include':[{'model':db[_0x52ec('0x75')],'as':_0x52ec('0x95'),'where':_0x2abc40,'limit':0x1,'order':[['updatedAt',_0x52ec('0x96')]]}]});})['then'](handleEntityNotFound(_0x4011be,null))[_0x52ec('0x35')](function(_0x38f2b9){if(_0x38f2b9){_0x3d7637[_0x52ec('0x97')]=_['omit'](_0x38f2b9,['Contacts']);if(_0x38f2b9['Contacts'][_0x52ec('0x65')]){return _0x38f2b9[_0x52ec('0x95')][0x0];}var _0x20fc6e=_[_0x52ec('0x98')](_0x3d7637[_0x52ec('0x58')],{'firstName':_0x3d7637[_0x52ec('0x58')][_0x52ec('0x82')],'ListId':_0x38f2b9['id']});_0x20fc6e[_0x3d7637[_0x52ec('0x58')][_0x52ec('0x93')]]=_0x3d7637[_0x52ec('0x58')][_0x52ec('0x82')];return db[_0x52ec('0x75')]['create'](_0x20fc6e,{'fields':_0x1833d2,'raw':!![]});}})[_0x52ec('0x35')](handleEntityNotFound(_0x4011be,null))['then'](function(_0x493270){if(_0x493270){_0x3d7637['contact']=_0x493270;var _0x585ed5={'ContactId':_0x493270['id'],'phone':_0x3d7637[_0x52ec('0x58')]['from'],'SmsAccountId':_0x1155a6['params']['id']};var _0x419bfe={'ContactId':_0x493270['id'],'SmsAccountId':_0x1155a6[_0x52ec('0x52')]['id'],'closed':![]};return db[_0x52ec('0x99')][_0x52ec('0x5d')]({'where':_0x419bfe})[_0x52ec('0x35')](function(_0x7ff696){if(_0x7ff696){return[_0x7ff696,![]];}return db[_0x52ec('0x99')][_0x52ec('0x57')](_0x585ed5)[_0x52ec('0x35')](function(_0x34a2de){return[_0x34a2de,!![]];});});}})[_0x52ec('0x9a')](function(_0xdf2818,_0x5014a6){_0x3d7637[_0x52ec('0x9b')]=_0xdf2818[_0x52ec('0x5a')]({'plain':!![]});_0x3d7637[_0x52ec('0x9b')][_0x52ec('0x9c')]=![];if(_0x5014a6){if(_0x3d7637['account'][_0x52ec('0x9d')]){_0x3d7637['applications'][_0x52ec('0x9e')]({'id':0x0,'priority':_0x3d7637['applications'][_0x52ec('0x65')]+0x1,'app':_0x52ec('0x9f'),'appdata':'unmanaged','interval':_0x52ec('0xa0')});}_0x3d7637[_0x52ec('0x9b')]['created']=!![];}return db[_0x52ec('0xa1')][_0x52ec('0x57')]({'phone':_0x3d7637[_0x52ec('0x58')]['from'],'messageId':_0x3d7637[_0x52ec('0x58')]['messageId'],'body':_0x3d7637[_0x52ec('0x58')][_0x52ec('0x58')],'SmsAccountId':_0x1155a6[_0x52ec('0x52')]['id'],'SmsInteractionId':_0xdf2818['id'],'direction':'in','ContactId':_0xdf2818['ContactId'],'AttachmentId':_0x3d7637[_0x52ec('0x58')]['AttachmentId']});})['then'](function(_0x2d9aa5){_0x3d7637[_0x52ec('0x27')]=_0x2d9aa5;if(_0x3d7637[_0x52ec('0x9b')][_0x52ec('0xa2')]){return db[_0x52ec('0xa3')][_0x52ec('0x5d')]({'attributes':['id',_0x52ec('0x38')],'where':{'id':_0x3d7637['interaction'][_0x52ec('0xa2')]}})[_0x52ec('0x35')](function(_0x16d286){if(_0x16d286){_0x3d7637[_0x52ec('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x16d286[_0x52ec('0x38')]+','+(_0x3d7637[_0x52ec('0x74')][_0x52ec('0xa5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x52ec('0xa6'),_0x52ec('0xa7'),_0x3d7637);});}return respondWithRpcPromise(_0x52ec('0xa6'),_0x52ec('0xa7'),_0x3d7637);})[_0x52ec('0x35')](function(_0xb37241){if(_0xb37241){var _0x2c539a=0xc8;var _0x1477ab=_0x52ec('0xa8');logger[_0x52ec('0x28')](_0x52ec('0x24'),_0x1477ab,_0x2c539a,'entity\x20found');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1477ab,_0x2c539a,_0x52ec('0xa9'),JSON['stringify'](_0xb37241));if(_0x3d7637[_0x52ec('0x74')][_0x52ec('0x4a')]===_0x52ec('0xaa')){return _0x4011be[_0x52ec('0x2a')](_0x2c539a)[_0x52ec('0x31')]('Content-Type',_0x52ec('0xab'))[_0x52ec('0xac')]('\x0a');}else{return _0x4011be['status'](_0x2c539a)[_0x52ec('0x2c')](_0xb37241);}}})[_0x52ec('0x56')](handleError(_0x4011be,null));};exports[_0x52ec('0xad')]=function(_0x440fbf,_0x1c2f26){var _0x260bbb=_0x440fbf[_0x52ec('0x52')]['id'];var _0x10d1a8=_0x440fbf[_0x52ec('0x58')];var _0x39b7b5=0xc8;var _0x515d86=null;return db[_0x52ec('0xae')]['transaction']({'isolationLevel':db[_0x52ec('0xae')][_0x52ec('0xaf')]['ISOLATION_LEVELS'][_0x52ec('0xb0')]},function(_0x50d20b){return db['SmsAccount']['findOne']({'where':{'id':_0x260bbb},'transaction':_0x50d20b})[_0x52ec('0x35')](function(_0x3e7617){if(_0x3e7617){return db['SmsApplication'][_0x52ec('0x36')]({'where':{'SmsAccountId':_0x260bbb},'transaction':_0x50d20b})[_0x52ec('0x35')](function(){var _0x53030d=_['map'](_0x10d1a8,function(_0x2a0c7b){_0x2a0c7b[_0x52ec('0x62')]=_0x260bbb;return _0x2a0c7b;});return db[_0x52ec('0x6f')]['bulkCreate'](_0x53030d,{'transaction':_0x50d20b});});}else{_0x39b7b5=0x194;_0x515d86=[];}});})[_0x52ec('0x35')](function(){if(_0x39b7b5!==0x194){return db[_0x52ec('0x6f')][_0x52ec('0xb1')]({'where':{'SmsAccountId':_0x260bbb},'order':'priority'})[_0x52ec('0x35')](function(_0x511327){_0x515d86=_0x511327;});}})['catch'](function(_0x1e639b){_0x39b7b5=0x1f4;logger[_0x52ec('0x25')](_0x1e639b['stack']);if(_0x1e639b[_0x52ec('0x38')]){delete _0x1e639b['name'];}_0x515d86=_0x1e639b;})[_0x52ec('0xb2')](function(){if(_0x515d86===null){_0x1c2f26[_0x52ec('0x29')](_0x39b7b5);}else{if(_0x39b7b5===0x1f4){_0x1c2f26['status'](_0x39b7b5)[_0x52ec('0xac')](_0x515d86);}else{_0x1c2f26['status'](_0x39b7b5)[_0x52ec('0x2c')](_0x515d86);}}});};exports['getApplications']=function(_0x4174ea,_0x931db7,_0x19f691){var _0x2f9f38={};var _0x138e7e={};var _0x46ebcd;var _0x3989dc;return db[_0x52ec('0x3b')][_0x52ec('0x6c')]({'where':{'id':_0x4174ea['params']['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x931db7,null))[_0x52ec('0x35')](function(_0x4209e5){if(_0x4209e5){_0x46ebcd=_0x4209e5;_0x138e7e['model']=_['keys'](db[_0x52ec('0x6f')][_0x52ec('0x54')]);_0x138e7e[_0x52ec('0x3d')]=_[_0x52ec('0x3e')](_0x4174ea[_0x52ec('0x3d')]);_0x138e7e['filters']=_[_0x52ec('0x3f')](_0x138e7e[_0x52ec('0x40')],_0x138e7e[_0x52ec('0x3d')]);_0x2f9f38[_0x52ec('0x42')]=_['intersection'](_0x138e7e['model'],qs[_0x52ec('0x41')](_0x4174ea['query'][_0x52ec('0x41')]));_0x2f9f38['attributes']=_0x2f9f38[_0x52ec('0x42')][_0x52ec('0x65')]?_0x2f9f38[_0x52ec('0x42')]:_0x138e7e[_0x52ec('0x40')];_0x2f9f38[_0x52ec('0x66')]=qs[_0x52ec('0x45')](_0x4174ea[_0x52ec('0x3d')][_0x52ec('0x45')]);_0x2f9f38['where']=qs[_0x52ec('0x47')](_['pick'](_0x4174ea[_0x52ec('0x3d')],_0x138e7e['filters']));if(_0x4174ea[_0x52ec('0x3d')]['filter']){_0x2f9f38[_0x52ec('0x48')]=_[_0x52ec('0x49')](_0x2f9f38[_0x52ec('0x48')],{'$or':_[_0x52ec('0x67')](_0x2f9f38[_0x52ec('0x42')],function(_0x46ed36){var _0x3711e4={};_0x3711e4[_0x46ed36]={'$like':'%'+_0x4174ea[_0x52ec('0x3d')][_0x52ec('0x4c')]+'%'};return _0x3711e4;})});}_0x2f9f38=_[_0x52ec('0x49')]({},_0x2f9f38,_0x4174ea[_0x52ec('0x55')]);return _0x46ebcd[_0x52ec('0xb3')](_0x2f9f38);}})['then'](function(_0x4ea1cf){if(_0x4ea1cf){_0x3989dc=_0x4ea1cf[_0x52ec('0x65')];if(!_0x4174ea['query'][_0x52ec('0x43')](_0x52ec('0x44'))){_0x2f9f38[_0x52ec('0x2e')]=qs[_0x52ec('0x2e')](_0x4174ea[_0x52ec('0x3d')][_0x52ec('0x2e')]);_0x2f9f38[_0x52ec('0x30')]=qs[_0x52ec('0x30')](_0x4174ea[_0x52ec('0x3d')][_0x52ec('0x30')]);}return _0x46ebcd[_0x52ec('0xb3')](_0x2f9f38);}})[_0x52ec('0x35')](function(_0x286b95){if(_0x286b95){return _0x286b95?{'count':_0x3989dc,'rows':_0x286b95}:null;}})[_0x52ec('0x35')](respondWithResult(_0x931db7,null))[_0x52ec('0x56')](handleError(_0x931db7,null));};exports[_0x52ec('0xb4')]=function(_0x504300,_0x3ec089,_0x5e7f62){var _0x429bf3={'raw':![],'where':{}};var _0x357f74={};var _0x4cca6b={'count':0x0,'rows':[]};return db[_0x52ec('0x3b')][_0x52ec('0x6c')]({'where':{'id':_0x504300[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x3ec089,null))[_0x52ec('0x35')](function(_0x1aab98){if(_0x1aab98){_0x357f74['model']=_[_0x52ec('0x3e')](db[_0x52ec('0x99')][_0x52ec('0x54')]);_0x357f74[_0x52ec('0x3d')]=_[_0x52ec('0x3e')](_0x504300['query']);_0x357f74[_0x52ec('0x47')]=_[_0x52ec('0x3f')](_0x357f74['model'],_0x357f74[_0x52ec('0x3d')]);_0x429bf3['attributes']=_[_0x52ec('0x3f')](_0x357f74[_0x52ec('0x40')],qs[_0x52ec('0x41')](_0x504300[_0x52ec('0x3d')]['fields']));_0x429bf3[_0x52ec('0x42')]=_0x429bf3['attributes']['length']?_0x429bf3[_0x52ec('0x42')]:_0x357f74[_0x52ec('0x40')];if(!_0x504300[_0x52ec('0x3d')][_0x52ec('0x43')](_0x52ec('0x44'))){_0x429bf3['limit']=qs[_0x52ec('0x2e')](_0x504300[_0x52ec('0x3d')]['limit']);_0x429bf3[_0x52ec('0x30')]=qs[_0x52ec('0x30')](_0x504300['query']['offset']);}_0x429bf3[_0x52ec('0x66')]=qs[_0x52ec('0x45')](_0x504300[_0x52ec('0x3d')]['sort']);_0x429bf3[_0x52ec('0x48')]=qs[_0x52ec('0x47')](_[_0x52ec('0x46')](_0x504300[_0x52ec('0x3d')],_0x357f74[_0x52ec('0x47')]));_0x429bf3[_0x52ec('0x48')][_0x52ec('0x62')]=_0x1aab98['id'];if(_0x504300['query'][_0x52ec('0x4c')]){_0x429bf3[_0x52ec('0x48')]=_[_0x52ec('0x49')](_0x429bf3[_0x52ec('0x48')],{'$or':_['map'](_0x429bf3['attributes'],function(_0x4ffdf9){var _0x5189cb={};_0x5189cb[_0x4ffdf9]={'$like':'%'+_0x504300['query'][_0x52ec('0x4c')]+'%'};return _0x5189cb;})});}_0x429bf3=_[_0x52ec('0x49')]({},_0x429bf3,_0x504300[_0x52ec('0x55')]);return db[_0x52ec('0x99')][_0x52ec('0x2f')]({'where':_0x429bf3['where']})[_0x52ec('0x35')](function(_0x3af27a){_0x4cca6b[_0x52ec('0x2f')]=_0x3af27a;if(_0x504300[_0x52ec('0x3d')][_0x52ec('0x4d')]){_0x429bf3[_0x52ec('0x4e')]=[{'model':db[_0x52ec('0x75')],'as':_0x52ec('0xb5'),'required':![]},{'model':db[_0x52ec('0xa3')],'as':_0x52ec('0xb6'),'attributes':[_0x52ec('0x38'),_0x52ec('0xb7'),'internal'],'required':![]},{'model':db[_0x52ec('0xb8')],'as':'Tags','attributes':['id',_0x52ec('0x38'),_0x52ec('0xb9')],'where':_0x504300['query']['tag']?{'id':_0x504300[_0x52ec('0x3d')][_0x52ec('0xba')]}:undefined,'required':_0x504300[_0x52ec('0x3d')][_0x52ec('0xba')]?!![]:![]}];}return db[_0x52ec('0x99')][_0x52ec('0x4f')](_0x429bf3);})['then'](function(_0x832a9b){_0x4cca6b[_0x52ec('0x50')]=_0x832a9b;return _0x4cca6b;});}})['then'](respondWithFilteredResult(_0x3ec089,_0x429bf3))[_0x52ec('0x56')](handleError(_0x3ec089,null));};exports[_0x52ec('0xac')]=function(_0x258a8e,_0x492b2d,_0x37e153){var _0x5a5ca7,_0x57159a,_0x1b2a50;if(_['isNil'](_0x258a8e[_0x52ec('0x58')][_0x52ec('0x58')])||_0x258a8e['body'][_0x52ec('0x58')]===''){throw new db[(_0x52ec('0x76'))][(_0x52ec('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x52ec('0x90')](_0x258a8e[_0x52ec('0x58')]['to'])){throw new db['Sequelize']['ValidationError'](_0x52ec('0xbb'));}_0x5a5ca7=_0x258a8e[_0x52ec('0x58')]['to'];return db['SmsAccount'][_0x52ec('0x5d')]({'where':{'id':_0x258a8e['params']['id']},'include':[{'model':db[_0x52ec('0xbc')],'as':'List','include':[{'model':db[_0x52ec('0x75')],'as':'Contacts','where':{'mobile':_0x5a5ca7},'limit':0x1,'order':[['updatedAt',_0x52ec('0x96')]]}]}]})[_0x52ec('0x35')](handleEntityNotFound(_0x492b2d,null))[_0x52ec('0x35')](function(_0x4a585b){if(_0x4a585b&&_0x4a585b[_0x52ec('0xbd')]){_0x57159a=_0x4a585b['get']({'plain':!![]});if(_0x57159a['List']&&_0x57159a[_0x52ec('0xbd')]['Contacts'][_0x52ec('0x65')]){return _0x57159a['List'][_0x52ec('0x95')][0x0];}return db[_0x52ec('0x75')][_0x52ec('0x57')](_[_0x52ec('0x98')](_0x258a8e['body'],{'firstName':_0x5a5ca7,'mobile':_0x5a5ca7,'phone':_0x5a5ca7,'ListId':_0x57159a[_0x52ec('0x7b')]}));}})['then'](handleEntityNotFound(_0x492b2d,null))[_0x52ec('0x35')](function(_0x1675b2){if(_0x1675b2){_0x1b2a50=_0x1675b2;return db[_0x52ec('0x99')][_0x52ec('0x5d')]({'where':{'ContactId':_0x1b2a50['id'],'closed':![],'SmsAccountId':_0x57159a['id']}})['then'](function(_0x4d794e){if(_0x4d794e){return[_0x4d794e,![]];}return db['SmsInteraction'][_0x52ec('0x57')]({'UserId':_0x258a8e[_0x52ec('0x59')]['id'],'ContactId':_0x1b2a50['id'],'SmsAccountId':_0x57159a['id'],'phone':_0x5a5ca7,'firstMsgDirection':'out','Messages':[_[_0x52ec('0x49')](_0x258a8e[_0x52ec('0x58')],{'read':![],'body':_0x258a8e['body'][_0x52ec('0x58')],'phone':_0x5a5ca7,'SmsAccountId':_0x57159a['id'],'UserId':_0x258a8e['user']['id'],'ContactId':_0x1b2a50['id']})]},{'include':[{'model':db[_0x52ec('0xa1')],'as':_0x52ec('0xbe')}]})[_0x52ec('0x35')](function(_0x186aa3){return[_0x186aa3,!![]];});});}})['spread'](function(_0x444e3a,_0xcf1b7b){if(_0xcf1b7b){return _0x444e3a;}return db['SmsMessage'][_0x52ec('0x57')](_[_0x52ec('0x49')](_0x258a8e[_0x52ec('0x58')],{'read':![],'body':_0x258a8e[_0x52ec('0x58')][_0x52ec('0x58')],'phone':_0x5a5ca7,'SmsAccountId':_0x57159a['id'],'SmsInteractionId':_0x444e3a['id'],'UserId':_0x258a8e[_0x52ec('0x59')]['id'],'ContactId':_0x1b2a50['id']}))[_0x52ec('0x35')](function(_0x341f48){_0x444e3a[_0x52ec('0xbf')][_0x52ec('0xbe')]=[];_0x444e3a[_0x52ec('0xbf')][_0x52ec('0xbe')][_0x52ec('0x9e')](_0x341f48['dataValues']);return _0x444e3a;});})[_0x52ec('0x35')](respondWithResult(_0x492b2d,null))[_0x52ec('0x56')](handleError(_0x492b2d,null));};exports['status']=function(_0x2ab395,_0xaaba52,_0x58635e){if(_0x2ab395[_0x52ec('0x58')]['id']){delete _0x2ab395['body']['id'];}var _0x105d4c,_0x2c2917,_0x175067;return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x2ab395[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0xaaba52,null))[_0x52ec('0x35')](function(_0x5c57ee){if(_0x5c57ee){_0x175067=_0x5c57ee;logger[_0x52ec('0xc0')](_0x52ec('0x24'),_0x52ec('0x2a'),_0x52ec('0xc1'),_0x5c57ee[_0x52ec('0x4a')],util['inspect'](_0x2ab395['body'],{'showHidden':![],'depth':null}));switch(_0x5c57ee['type']){case _0x52ec('0x81'):if(_0x2ab395['body']['skebby_dispatch_id']&&_0x2ab395[_0x52ec('0x58')][_0x52ec('0x2a')]){_0x2c2917=_0x2ab395[_0x52ec('0x58')][_0x52ec('0x2a')];return db['SmsMessage'][_0x52ec('0x5d')]({'where':{'messageId':_0x2ab395[_0x52ec('0x58')][_0x52ec('0xc2')]}});}break;case'connectel':if(_0x2ab395[_0x52ec('0x58')][_0x52ec('0xc3')]&&_0x2ab395[_0x52ec('0x58')][_0x52ec('0xc4')]){_0x2c2917=_0x2ab395[_0x52ec('0x58')][_0x52ec('0xc4')];return db['SmsMessage'][_0x52ec('0x5d')]({'where':{'messageId':_0x2ab395['body']['requestid']}});}break;case _0x52ec('0xc5'):if(_0x2ab395[_0x52ec('0x58')]['message_id']&&_0x2ab395[_0x52ec('0x58')]['status_code']){_0x2c2917=_0x2ab395[_0x52ec('0x58')][_0x52ec('0xc6')];return db[_0x52ec('0xa1')][_0x52ec('0x5d')]({'where':{'messageId':_0x2ab395[_0x52ec('0x58')]['message_id']}});}break;case _0x52ec('0xc7'):var _0x4622f6=_0x2ab395[_0x52ec('0x58')][_0x52ec('0x89')][0x0];if(_0x4622f6[_0x52ec('0x7f')]&&_0x4622f6[_0x52ec('0x2a')][_0x52ec('0xc8')]==='DELIVERED'){_0x2c2917=_0x4622f6[_0x52ec('0x2a')][_0x52ec('0xc8')];return db[_0x52ec('0xa1')][_0x52ec('0x5d')]({'where':{'messageId':_0x4622f6[_0x52ec('0x7f')]}});}break;case _0x52ec('0x8c'):if(_0x2ab395[_0x52ec('0x58')][_0x52ec('0x7f')]&&_0x2ab395['body'][_0x52ec('0x2a')]){_0x2c2917=_0x2ab395[_0x52ec('0x58')][_0x52ec('0x2a')];return db[_0x52ec('0xa1')][_0x52ec('0x5d')]({'where':{'messageId':_0x2ab395[_0x52ec('0x58')][_0x52ec('0x7f')]}});}break;case _0x52ec('0x8e'):if(_0x2ab395[_0x52ec('0x58')][0x0][_0x52ec('0x27')]['id']){_0x2c2917=_0x2ab395['body'][0x0][_0x52ec('0x4a')];return db[_0x52ec('0xa1')][_0x52ec('0x5d')]({'where':{'messageId':_0x2ab395[_0x52ec('0x58')][0x0][_0x52ec('0x27')]['id']}});}break;case _0x52ec('0xc9'):if(_0x2ab395[_0x52ec('0x58')][_0x52ec('0xca')]&&_0x2ab395[_0x52ec('0x58')][_0x52ec('0x2a')]){_0x2c2917=_0x2ab395[_0x52ec('0x58')]['status'];return db[_0x52ec('0xa1')][_0x52ec('0x5d')]({'where':{'messageId':_0x2ab395[_0x52ec('0x58')][_0x52ec('0xca')]}});}break;}}})[_0x52ec('0x35')](handleEntityNotFound(_0xaaba52,null))[_0x52ec('0x35')](function(_0x56be0d){if(_0x56be0d){_0x105d4c=_0x56be0d;switch(_0x175067[_0x52ec('0x4a')]){case _0x52ec('0x81'):if(_0x2c2917===_0x52ec('0xcb')){return _0x105d4c[_0x52ec('0x34')]({'read':!![]});}else{logger[_0x52ec('0x25')](_0x52ec('0x24'),_0x52ec('0x2a'),_0x52ec('0x81'),util[_0x52ec('0xcc')](_0x2ab395['body'],{'showHidden':![],'depth':null}));}break;case _0x52ec('0x85'):if(_0x2c2917==='1'){return _0x105d4c[_0x52ec('0x34')]({'read':!![]});}else{logger['error'](_0x52ec('0x24'),_0x52ec('0x2a'),_0x52ec('0x81'),util[_0x52ec('0xcc')](_0x2ab395['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2ab395[_0x52ec('0x58')][_0x52ec('0xcd')]&&_0x2c2917>=0xc8&&_0x2c2917<=0xce){return _0x105d4c[_0x52ec('0x34')]({'read':!![]});}else{logger[_0x52ec('0x25')](_0x52ec('0x24'),'status',_0x52ec('0xc5'),util['inspect'](_0x2ab395[_0x52ec('0x58')],{'showHidden':![],'depth':null}));}break;case _0x52ec('0xc7'):var _0x3f332e=_0x2ab395[_0x52ec('0x58')]['results'][0x0];if(_0x3f332e[_0x52ec('0x2a')]['groupName']==='DELIVERED'){return _0x105d4c[_0x52ec('0x34')]({'read':!![]});}else{logger['error'](_0x52ec('0x24'),_0x52ec('0x2a'),_0x52ec('0xc7'),util[_0x52ec('0xcc')](_0x2ab395[_0x52ec('0x58')],{'showHidden':![],'depth':null}));}break;case _0x52ec('0x8c'):if(_0x2c2917==_0x52ec('0xce')||_0x2c2917==_0x52ec('0xcf')){return _0x105d4c[_0x52ec('0x34')]({'read':!![]});}else{logger[_0x52ec('0x25')](_0x52ec('0x24'),_0x52ec('0x2a'),_0x52ec('0x8c'),util[_0x52ec('0xcc')](_0x2ab395[_0x52ec('0x58')],{'showHidden':![],'depth':null}));}break;case _0x52ec('0x8e'):if(_0x2c2917==_0x52ec('0xd0')){return _0x105d4c['update']({'read':!![]});}else{logger[_0x52ec('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x52ec('0x8e'),util[_0x52ec('0xcc')](_0x2ab395[_0x52ec('0x58')],{'showHidden':![],'depth':null}));}break;case _0x52ec('0xc9'):if(_0x2c2917===_0x52ec('0xd1')||_0x2c2917===_0x52ec('0xd2')){return _0x105d4c[_0x52ec('0x34')]({'read':!![]});}else{logger[_0x52ec('0x25')](_0x52ec('0x24'),_0x52ec('0x2a'),_0x52ec('0xc9'),util[_0x52ec('0xcc')](_0x2ab395[_0x52ec('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x105d4c;}})['then'](respondWithResult(_0xaaba52,null))[_0x52ec('0x56')](handleError(_0xaaba52,null));};exports[_0x52ec('0xd3')]=function(_0x2a4c98,_0x4a513f,_0x247688){var _0xb8337c,_0x3afa4d,_0x1ffeed;return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x2a4c98['params']['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x4a513f,null))[_0x52ec('0x35')](function(_0xd8bfb2){if(_0xd8bfb2){_0x1ffeed=_0xd8bfb2;logger[_0x52ec('0xc0')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x52ec('0x2a'),_0x52ec('0xc1'),_0xd8bfb2[_0x52ec('0x4a')],util[_0x52ec('0xcc')](_0x2a4c98[_0x52ec('0x3d')],{'showHidden':![],'depth':null}));switch(_0xd8bfb2['type']){case _0x52ec('0x8a'):if(_0x2a4c98['query']['message-id']&&_0x2a4c98[_0x52ec('0x3d')][_0x52ec('0xd4')]){_0x3afa4d=_0x2a4c98[_0x52ec('0x3d')][_0x52ec('0xd4')];return db[_0x52ec('0xa1')][_0x52ec('0x5d')]({'where':{'messageId':_0x2a4c98[_0x52ec('0x3d')][_0x52ec('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x4a513f,null))[_0x52ec('0x35')](function(_0x53c988){if(_0x53c988){_0xb8337c=_0x53c988;switch(_0x1ffeed[_0x52ec('0x4a')]){case'csc':if(_0x3afa4d==='2'||_0x3afa4d==='6'){return _0xb8337c[_0x52ec('0x34')]({'read':!![]});}else{logger[_0x52ec('0x25')](_0x52ec('0x24'),'status',_0x52ec('0x8a'),util[_0x52ec('0xcc')](_0x2a4c98[_0x52ec('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0xb8337c;}})[_0x52ec('0x35')](respondWithResult(_0x4a513f,null))[_0x52ec('0x56')](handleError(_0x4a513f,null));};exports[_0x52ec('0xd6')]=function(_0x164c6c,_0x5170e7,_0x2eead2){return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x164c6c[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x5170e7,null))[_0x52ec('0x35')](function(_0x451b44){if(_0x451b44){return _0x451b44[_0x52ec('0xd6')](_0x164c6c[_0x52ec('0x58')][_0x52ec('0x69')],_[_0x52ec('0xd7')](_0x164c6c[_0x52ec('0x58')],[_0x52ec('0x69'),'id'])||{})[_0x52ec('0x9a')](function(_0x419b30){for(var _0x40aba2=0x0;_0x40aba2<_0x164c6c[_0x52ec('0x58')]['ids']['length'];_0x40aba2+=0x1){socket[_0x52ec('0xd8')](_0x52ec('0xd9'),{'UserId':Number(_0x164c6c[_0x52ec('0x58')][_0x52ec('0x69')][_0x40aba2]),'SmsAccountId':Number(_0x164c6c['params']['id'])});}return _0x419b30;});}})[_0x52ec('0x35')](respondWithResult(_0x5170e7,null))['catch'](handleError(_0x5170e7,null));};exports['removeAgents']=function(_0x8410d0,_0x1183ab,_0x5e46ed){return db[_0x52ec('0x3b')][_0x52ec('0x5d')]({'where':{'id':_0x8410d0[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x1183ab,null))['then'](function(_0x6478ec){if(_0x6478ec){return _0x6478ec[_0x52ec('0xda')](_0x8410d0['query']['ids'])['then'](function(){if(_[_0x52ec('0xdb')](_0x8410d0[_0x52ec('0x3d')][_0x52ec('0x69')])){for(var _0x12da9b=0x0;_0x12da9b<_0x8410d0[_0x52ec('0x3d')][_0x52ec('0x69')][_0x52ec('0x65')];_0x12da9b+=0x1){socket[_0x52ec('0xd8')]('userSmsAccount:remove',{'UserId':Number(_0x8410d0[_0x52ec('0x3d')][_0x52ec('0x69')][_0x12da9b]),'SmsAccountId':Number(_0x8410d0['params']['id'])});}}else{socket['emit'](_0x52ec('0xdc'),{'UserId':Number(_0x8410d0['query'][_0x52ec('0x69')]),'SmsAccountId':Number(_0x8410d0[_0x52ec('0x52')]['id'])});}});}})[_0x52ec('0x35')](respondWithStatusCode(_0x1183ab,null))[_0x52ec('0x56')](handleError(_0x1183ab,null));};exports[_0x52ec('0xdd')]=function(_0x560133,_0x17f007,_0x288fa4){var _0x283a85={};var _0x1db6da={};var _0x149c3a;var _0x460827;return db[_0x52ec('0x3b')][_0x52ec('0x6c')]({'where':{'id':_0x560133[_0x52ec('0x52')]['id']}})[_0x52ec('0x35')](handleEntityNotFound(_0x17f007,null))[_0x52ec('0x35')](function(_0x3256cd){if(_0x3256cd){_0x149c3a=_0x3256cd;_0x1db6da[_0x52ec('0x40')]=_[_0x52ec('0x3e')](db[_0x52ec('0xa3')][_0x52ec('0x54')]);_0x1db6da[_0x52ec('0x3d')]=_[_0x52ec('0x3e')](_0x560133[_0x52ec('0x3d')]);_0x1db6da[_0x52ec('0x47')]=_['intersection'](_0x1db6da[_0x52ec('0x40')],_0x1db6da[_0x52ec('0x3d')]);_0x283a85[_0x52ec('0x42')]=_[_0x52ec('0x3f')](_0x1db6da[_0x52ec('0x40')],qs[_0x52ec('0x41')](_0x560133[_0x52ec('0x3d')]['fields']));_0x283a85[_0x52ec('0x42')]=_0x283a85[_0x52ec('0x42')][_0x52ec('0x65')]?_0x283a85[_0x52ec('0x42')]:_0x1db6da[_0x52ec('0x40')];_0x283a85['order']=qs[_0x52ec('0x45')](_0x560133[_0x52ec('0x3d')][_0x52ec('0x45')]);_0x283a85['where']=qs[_0x52ec('0x47')](_[_0x52ec('0x46')](_0x560133['query'],_0x1db6da['filters']));if(_0x560133[_0x52ec('0x3d')]['filter']){_0x283a85['where']=_[_0x52ec('0x49')](_0x283a85[_0x52ec('0x48')],{'$or':_[_0x52ec('0x67')](_0x283a85[_0x52ec('0x42')],function(_0x2aad15){var _0x163c79={};_0x163c79[_0x2aad15]={'$like':'%'+_0x560133[_0x52ec('0x3d')][_0x52ec('0x4c')]+'%'};return _0x163c79;})});}_0x283a85=_['merge']({},_0x283a85,_0x560133[_0x52ec('0x55')]);return _0x149c3a['getAgents'](_0x283a85);}})[_0x52ec('0x35')](function(_0x110971){if(_0x110971){_0x460827=_0x110971[_0x52ec('0x65')];if(!_0x560133['query'][_0x52ec('0x43')](_0x52ec('0x44'))){_0x283a85[_0x52ec('0x2e')]=qs[_0x52ec('0x2e')](_0x560133[_0x52ec('0x3d')][_0x52ec('0x2e')]);_0x283a85['offset']=qs['offset'](_0x560133[_0x52ec('0x3d')][_0x52ec('0x30')]);}return _0x149c3a[_0x52ec('0xdd')](_0x283a85);}})[_0x52ec('0x35')](function(_0x2dd7c9){if(_0x2dd7c9){return _0x2dd7c9?{'count':_0x460827,'rows':_0x2dd7c9}:null;}})[_0x52ec('0x35')](respondWithResult(_0x17f007,null))[_0x52ec('0x56')](handleError(_0x17f007,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2258ca9..a7db728 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 _0x6505=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2d2d6e,_0x169581){var _0x3f5d0c=function(_0xca429f){while(--_0xca429f){_0x2d2d6e['push'](_0x2d2d6e['shift']());}};_0x3f5d0c(++_0x169581);}(_0x6505,0x1a4));var _0x5650=function(_0x35d360,_0x29e143){_0x35d360=_0x35d360-0x0;var _0x21343c=_0x6505[_0x35d360];return _0x21343c;};'use strict';var EventEmitter=require(_0x5650('0x0'));var SmsAccount=require(_0x5650('0x1'))['db'][_0x5650('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5650('0x3')](0x0);var events={'afterCreate':_0x5650('0x4'),'afterUpdate':_0x5650('0x5'),'afterDestroy':_0x5650('0x6')};function emitEvent(_0x101cd1){return function(_0x1693da,_0x1640b6,_0x5bf27f){SmsAccountEvents['emit'](_0x101cd1+':'+_0x1693da['id'],_0x1693da);SmsAccountEvents[_0x5650('0x7')](_0x101cd1,_0x1693da);_0x5bf27f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x5650('0x8')](e,emitEvent(event));}}module[_0x5650('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xb669=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove'];(function(_0x17f24f,_0x475b50){var _0x219333=function(_0x5e8684){while(--_0x5e8684){_0x17f24f['push'](_0x17f24f['shift']());}};_0x219333(++_0x475b50);}(_0xb669,0xa5));var _0x9b66=function(_0x1e64be,_0x14b476){_0x1e64be=_0x1e64be-0x0;var _0x51cc57=_0xb669[_0x1e64be];return _0x51cc57;};'use strict';var EventEmitter=require(_0x9b66('0x0'));var SmsAccount=require(_0x9b66('0x1'))['db'][_0x9b66('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9b66('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b66('0x4'),'afterDestroy':_0x9b66('0x5')};function emitEvent(_0x248891){return function(_0x11be77,_0x241707,_0x19393b){SmsAccountEvents[_0x9b66('0x6')](_0x248891+':'+_0x11be77['id'],_0x11be77);SmsAccountEvents[_0x9b66('0x6')](_0x248891,_0x11be77);_0x19393b(null);};}for(var e in events){if(events[_0x9b66('0x7')](e)){var event=events[e];SmsAccount[_0x9b66('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0a140d8..ca164c7 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 _0xe88b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util'];(function(_0x13c673,_0x73db44){var _0x27dd05=function(_0x3b1506){while(--_0x3b1506){_0x13c673['push'](_0x13c673['shift']());}};_0x27dd05(++_0x73db44);}(_0xe88b,0xdb));var _0xbe88=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xe88b[_0x31abee];return _0x3c1761;};'use strict';var _=require(_0xbe88('0x0'));var util=require(_0xbe88('0x1'));var logger=require(_0xbe88('0x2'))(_0xbe88('0x3'));var moment=require(_0xbe88('0x4'));var BPromise=require('bluebird');var rp=require(_0xbe88('0x5'));var fs=require('fs');var path=require(_0xbe88('0x6'));var rimraf=require(_0xbe88('0x7'));var config=require(_0xbe88('0x8'));var attributes=require(_0xbe88('0x9'));module[_0xbe88('0xa')]=function(_0x2e084c,_0x377fda){return _0x2e084c[_0xbe88('0xb')](_0xbe88('0xc'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fa7=['./smsAccount.attributes','exports','define','sms_accounts','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1a967c,_0xf23f82){var _0x139704=function(_0x5c8091){while(--_0x5c8091){_0x1a967c['push'](_0x1a967c['shift']());}};_0x139704(++_0xf23f82);}(_0x5fa7,0x9e));var _0x75fa=function(_0xc6f6a6,_0x4a3c44){_0xc6f6a6=_0xc6f6a6-0x0;var _0xa9b320=_0x5fa7[_0xc6f6a6];return _0xa9b320;};'use strict';var _=require(_0x75fa('0x0'));var util=require('util');var logger=require(_0x75fa('0x1'))('api');var moment=require(_0x75fa('0x2'));var BPromise=require('bluebird');var rp=require(_0x75fa('0x3'));var fs=require('fs');var path=require(_0x75fa('0x4'));var rimraf=require(_0x75fa('0x5'));var config=require(_0x75fa('0x6'));var attributes=require(_0x75fa('0x7'));module[_0x75fa('0x8')]=function(_0x5ca7ee,_0x387fbb){return _0x5ca7ee[_0x75fa('0x9')]('SmsAccount',attributes,{'tableName':_0x75fa('0xa'),'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 02d819c..ae204ad 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 _0xc7d6=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map','model','debug','lodash'];(function(_0x35ebbb,_0xe862ef){var _0x29d9b=function(_0x4fee98){while(--_0x4fee98){_0x35ebbb['push'](_0x35ebbb['shift']());}};_0x29d9b(++_0xe862ef);}(_0xc7d6,0x1ee));var _0x6c7d=function(_0x37022c,_0x14a219){_0x37022c=_0x37022c-0x0;var _0x527ae8=_0xc7d6[_0x37022c];return _0x527ae8;};'use strict';var _=require(_0x6c7d('0x0'));var util=require('util');var moment=require(_0x6c7d('0x1'));var BPromise=require(_0x6c7d('0x2'));var rs=require(_0x6c7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c7d('0x5'))(_0x6c7d('0x6'));var config=require(_0x6c7d('0x7'));var jayson=require(_0x6c7d('0x8'));var client=jayson[_0x6c7d('0x9')][_0x6c7d('0xa')]({'port':0x232a});config['redis']=_[_0x6c7d('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6c7d('0xc'))['register'](socket);function respondWithRpcPromise(_0xecd395,_0xa97b50,_0xaf7a4e){return new BPromise(function(_0x35ab9f,_0x277ae5){return client[_0x6c7d('0xd')](_0xecd395,_0xaf7a4e)[_0x6c7d('0xe')](function(_0x589683){logger[_0x6c7d('0xf')](_0x6c7d('0x10'),_0xa97b50,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa97b50,_0x6c7d('0x11'),JSON[_0x6c7d('0x12')](_0x589683));if(_0x589683['error']){if(_0x589683[_0x6c7d('0x13')][_0x6c7d('0x14')]===0x1f4){logger[_0x6c7d('0x13')]('SmsAccount,\x20%s,\x20%s',_0xa97b50,_0x589683[_0x6c7d('0x13')]['message']);return _0x277ae5(_0x589683['error'][_0x6c7d('0x15')]);}logger[_0x6c7d('0x13')]('SmsAccount,\x20%s,\x20%s',_0xa97b50,_0x589683[_0x6c7d('0x13')][_0x6c7d('0x15')]);return _0x35ab9f(_0x589683[_0x6c7d('0x13')][_0x6c7d('0x15')]);}else{logger[_0x6c7d('0xf')](_0x6c7d('0x10'),_0xa97b50,_0x6c7d('0x11'));_0x35ab9f(_0x589683[_0x6c7d('0x16')][_0x6c7d('0x15')]);}})[_0x6c7d('0x17')](function(_0xd8398e){logger['error']('SmsAccount,\x20%s,\x20%s',_0xa97b50,_0xd8398e);_0x277ae5(_0xd8398e);});});}exports[_0x6c7d('0x18')]=function(_0xf9077d){var _0x194fa0=this;return new Promise(function(_0x41c07e,_0x52465b){return db[_0x6c7d('0x19')]['find']({'raw':_0xf9077d['options']?_0xf9077d[_0x6c7d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xf9077d[_0x6c7d('0x1a')]?_0xf9077d[_0x6c7d('0x1a')][_0x6c7d('0x1b')]||null:null,'attributes':_0xf9077d[_0x6c7d('0x1a')]?_0xf9077d[_0x6c7d('0x1a')][_0x6c7d('0x1c')]||null:null,'include':_0xf9077d['options']?_0xf9077d[_0x6c7d('0x1a')][_0x6c7d('0x1d')]?_[_0x6c7d('0x1e')](_0xf9077d[_0x6c7d('0x1a')]['include'],function(_0x124b67){return{'model':db[_0x124b67['model']],'as':_0x124b67['as'],'attributes':_0x124b67[_0x6c7d('0x1c')],'include':_0x124b67[_0x6c7d('0x1d')]?_[_0x6c7d('0x1e')](_0x124b67[_0x6c7d('0x1d')],function(_0x2d8812){return{'model':db[_0x2d8812['model']],'as':_0x2d8812['as'],'attributes':_0x2d8812['attributes'],'include':_0x2d8812[_0x6c7d('0x1d')]?_[_0x6c7d('0x1e')](_0x2d8812['include'],function(_0x3b4f0e){return{'model':db[_0x3b4f0e[_0x6c7d('0x1f')]],'as':_0x3b4f0e['as'],'attributes':_0x3b4f0e[_0x6c7d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6c7d('0xe')](function(_0x14b3f8){logger[_0x6c7d('0xf')](_0x6c7d('0x18'),_0xf9077d);logger[_0x6c7d('0x20')](_0x6c7d('0x18'),_0xf9077d,JSON[_0x6c7d('0x12')](_0x14b3f8));_0x41c07e(_0x14b3f8);})[_0x6c7d('0x17')](function(_0x132a60){logger[_0x6c7d('0x13')](_0x6c7d('0x18'),_0x132a60['message'],_0xf9077d);_0x52465b(_0x194fa0[_0x6c7d('0x13')](0x1f4,_0x132a60[_0x6c7d('0x15')]));});});}; \ No newline at end of file +var _0x9822=['include','map','model','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','options','raw','attributes'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x9822,0x1cc));var _0x2982=function(_0x16f9e2,_0x4a56b3){_0x16f9e2=_0x16f9e2-0x0;var _0xd8200b=_0x9822[_0x16f9e2];return _0xd8200b;};'use strict';var _=require(_0x2982('0x0'));var util=require(_0x2982('0x1'));var moment=require(_0x2982('0x2'));var BPromise=require(_0x2982('0x3'));var rs=require(_0x2982('0x4'));var fs=require('fs');var Redis=require(_0x2982('0x5'));var db=require(_0x2982('0x6'))['db'];var utils=require(_0x2982('0x7'));var logger=require(_0x2982('0x8'))('rpc');var config=require(_0x2982('0x9'));var jayson=require(_0x2982('0xa'));var client=jayson[_0x2982('0xb')]['http']({'port':0x232a});config[_0x2982('0xc')]=_['defaults'](config['redis'],{'host':_0x2982('0xd'),'port':0x18eb});var socket=require(_0x2982('0xe'))(new Redis(config[_0x2982('0xc')]));require(_0x2982('0xf'))[_0x2982('0x10')](socket);function respondWithRpcPromise(_0x175f60,_0x8f7b94,_0x2644c3){return new BPromise(function(_0x27f4cf,_0x591d6c){return client[_0x2982('0x11')](_0x175f60,_0x2644c3)[_0x2982('0x12')](function(_0x35bfa3){logger[_0x2982('0x13')](_0x2982('0x14'),_0x8f7b94,_0x2982('0x15'));logger[_0x2982('0x16')](_0x2982('0x17'),_0x8f7b94,_0x2982('0x15'),JSON[_0x2982('0x18')](_0x35bfa3));if(_0x35bfa3[_0x2982('0x19')]){if(_0x35bfa3[_0x2982('0x19')][_0x2982('0x1a')]===0x1f4){logger['error'](_0x2982('0x14'),_0x8f7b94,_0x35bfa3[_0x2982('0x19')][_0x2982('0x1b')]);return _0x591d6c(_0x35bfa3[_0x2982('0x19')][_0x2982('0x1b')]);}logger['error'](_0x2982('0x14'),_0x8f7b94,_0x35bfa3[_0x2982('0x19')][_0x2982('0x1b')]);return _0x27f4cf(_0x35bfa3[_0x2982('0x19')][_0x2982('0x1b')]);}else{logger['info'](_0x2982('0x14'),_0x8f7b94,_0x2982('0x15'));_0x27f4cf(_0x35bfa3[_0x2982('0x1c')][_0x2982('0x1b')]);}})[_0x2982('0x1d')](function(_0x5fc410){logger['error'](_0x2982('0x14'),_0x8f7b94,_0x5fc410);_0x591d6c(_0x5fc410);});});}exports['ShowSmsAccount']=function(_0x4b8abd){var _0x3e11e5=this;return new Promise(function(_0x52dc26,_0xef55f8){return db[_0x2982('0x1e')]['find']({'raw':_0x4b8abd[_0x2982('0x1f')]?_0x4b8abd[_0x2982('0x1f')][_0x2982('0x20')]===undefined?!![]:![]:!![],'where':_0x4b8abd[_0x2982('0x1f')]?_0x4b8abd[_0x2982('0x1f')]['where']||null:null,'attributes':_0x4b8abd[_0x2982('0x1f')]?_0x4b8abd[_0x2982('0x1f')][_0x2982('0x21')]||null:null,'include':_0x4b8abd[_0x2982('0x1f')]?_0x4b8abd[_0x2982('0x1f')][_0x2982('0x22')]?_[_0x2982('0x23')](_0x4b8abd[_0x2982('0x1f')][_0x2982('0x22')],function(_0xb1b0bd){return{'model':db[_0xb1b0bd['model']],'as':_0xb1b0bd['as'],'attributes':_0xb1b0bd[_0x2982('0x21')],'include':_0xb1b0bd[_0x2982('0x22')]?_[_0x2982('0x23')](_0xb1b0bd['include'],function(_0x5287e0){return{'model':db[_0x5287e0[_0x2982('0x24')]],'as':_0x5287e0['as'],'attributes':_0x5287e0['attributes'],'include':_0x5287e0[_0x2982('0x22')]?_[_0x2982('0x23')](_0x5287e0[_0x2982('0x22')],function(_0x384928){return{'model':db[_0x384928['model']],'as':_0x384928['as'],'attributes':_0x384928['attributes']};}):[]};}):[]};}):[]:[]})[_0x2982('0x12')](function(_0x4236a2){logger[_0x2982('0x13')]('ShowSmsAccount',_0x4b8abd);logger['debug'](_0x2982('0x25'),_0x4b8abd,JSON[_0x2982('0x18')](_0x4236a2));_0x52dc26(_0x4236a2);})[_0x2982('0x1d')](function(_0x38c020){logger[_0x2982('0x19')](_0x2982('0x25'),_0x38c020[_0x2982('0x1b')],_0x4b8abd);_0xef55f8(_0x3e11e5[_0x2982('0x19')](0x1f4,_0x38c020[_0x2982('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7973515..50a7a7d 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(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 eb8fd7f..7c2d63b 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(_0x4f2296,_0x44f11b){var _0x39b10d=function(_0x786582){while(--_0x786582){_0x4f2296['push'](_0x4f2296['shift']());}};_0x39b10d(++_0x44f11b);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x3e74,0x175));var _0x43e7=function(_0x3c1a1d,_0x7f2dc){_0x3c1a1d=_0x3c1a1d-0x0;var _0x4a3543=_0x3e74[_0x3c1a1d];return _0x4a3543;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 4cb7d80..1bfe822 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 _0xfd94=['TEXT','INTEGER','STRING','noop'];(function(_0x8c149a,_0x7ee6c){var _0x501837=function(_0x2abf04){while(--_0x2abf04){_0x8c149a['push'](_0x8c149a['shift']());}};_0x501837(++_0x7ee6c);}(_0xfd94,0x1b1));var _0x4fd9=function(_0x525cde,_0xa049d7){_0x525cde=_0x525cde-0x0;var _0x4c25f1=_0xfd94[_0x525cde];return _0x4c25f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x4fd9('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x4fd9('0x1')],'allowNull':![],'defaultValue':_0x4fd9('0x2')},'appdata':{'type':Sequelize[_0x4fd9('0x3')]()},'description':{'type':Sequelize[_0x4fd9('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x00f1=['STRING','*,*,*,*','sequelize'];(function(_0x3ebfdf,_0x17a3bd){var _0x2c959f=function(_0x223df8){while(--_0x223df8){_0x3ebfdf['push'](_0x3ebfdf['shift']());}};_0x2c959f(++_0x17a3bd);}(_0x00f1,0x17c));var _0x100f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00f1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x100f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x100f('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x100f('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x100f('0x2')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 97df6b3..d4fab97 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 _0x0e91=['map','SmsApplication','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','end','status','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x34ffbd,_0x3e964d){var _0x15c800=function(_0x2bc1a8){while(--_0x2bc1a8){_0x34ffbd['push'](_0x34ffbd['shift']());}};_0x15c800(++_0x3e964d);}(_0x0e91,0xf1));var _0x10e9=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x0e91[_0x1d1d09];return _0x8827e;};'use strict';var emlformat=require(_0x10e9('0x0'));var rimraf=require(_0x10e9('0x1'));var zipdir=require(_0x10e9('0x2'));var jsonpatch=require(_0x10e9('0x3'));var rp=require(_0x10e9('0x4'));var moment=require('moment');var BPromise=require(_0x10e9('0x5'));var Mustache=require(_0x10e9('0x6'));var util=require('util');var path=require(_0x10e9('0x7'));var sox=require(_0x10e9('0x8'));var csv=require(_0x10e9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10e9('0xa'));var _=require(_0x10e9('0xb'));var squel=require(_0x10e9('0xc'));var crypto=require(_0x10e9('0xd'));var jsforce=require(_0x10e9('0xe'));var deskjs=require(_0x10e9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x10e9('0x10'));var Papa=require(_0x10e9('0x11'));var Redis=require(_0x10e9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10e9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x10e9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa1b557,_0x451fb6){_0x451fb6=_0x451fb6||0xcc;return function(_0x3962fa){if(_0x3962fa){return _0xa1b557['sendStatus'](_0x451fb6);}return _0xa1b557['status'](_0x451fb6)[_0x10e9('0x15')]();};}function respondWithResult(_0xd98fda,_0x3ef4c4){_0x3ef4c4=_0x3ef4c4||0xc8;return function(_0x45fcdd){if(_0x45fcdd){return _0xd98fda[_0x10e9('0x16')](_0x3ef4c4)['json'](_0x45fcdd);}};}function respondWithFilteredResult(_0x38357c,_0x2f5610){return function(_0x536ff8){if(_0x536ff8){var _0x24641e=typeof _0x2f5610[_0x10e9('0x17')]==='undefined'&&typeof _0x2f5610[_0x10e9('0x18')]===_0x10e9('0x19');var _0x447c06=_0x536ff8[_0x10e9('0x1a')];var _0x5a696e=_0x24641e?0x0:_0x2f5610[_0x10e9('0x17')];var _0x4325ed=_0x24641e?_0x536ff8['count']:_0x2f5610['offset']+_0x2f5610[_0x10e9('0x18')];var _0x48a49a;if(_0x4325ed>=_0x447c06){_0x4325ed=_0x447c06;_0x48a49a=0xc8;}else{_0x48a49a=0xce;}_0x38357c[_0x10e9('0x16')](_0x48a49a);return _0x38357c[_0x10e9('0x1b')](_0x10e9('0x1c'),_0x5a696e+'-'+_0x4325ed+'/'+_0x447c06)['json'](_0x536ff8);}return null;};}function patchUpdates(_0x35e849){return function(_0x94dff2){try{jsonpatch['apply'](_0x94dff2,_0x35e849,!![]);}catch(_0x2220b2){return BPromise[_0x10e9('0x1d')](_0x2220b2);}return _0x94dff2[_0x10e9('0x1e')]();};}function saveUpdates(_0x4e10e5,_0x40b53e){return function(_0x291b16){if(_0x291b16){return _0x291b16['update'](_0x4e10e5)[_0x10e9('0x1f')](function(_0x53b5f1){return _0x53b5f1;});}return null;};}function removeEntity(_0x408fa0,_0xc89076){return function(_0x483c51){if(_0x483c51){return _0x483c51[_0x10e9('0x20')]()[_0x10e9('0x1f')](function(){_0x408fa0[_0x10e9('0x16')](0xcc)[_0x10e9('0x15')]();});}};}function handleEntityNotFound(_0xfed1dd,_0x14a1ca){return function(_0x374f76){if(!_0x374f76){_0xfed1dd[_0x10e9('0x21')](0x194);}return _0x374f76;};}function handleError(_0x54a1f7,_0x3f77b1){_0x3f77b1=_0x3f77b1||0x1f4;return function(_0x2d38c7){logger[_0x10e9('0x22')](_0x2d38c7[_0x10e9('0x23')]);if(_0x2d38c7['name']){delete _0x2d38c7[_0x10e9('0x24')];}_0x54a1f7['status'](_0x3f77b1)[_0x10e9('0x25')](_0x2d38c7);};}exports[_0x10e9('0x26')]=function(_0xa3d542,_0x88bccd){var _0x5c8fc7={},_0x26433f={},_0x3074c6={'count':0x0,'rows':[]};var _0x4b2331=_[_0x10e9('0x27')](db[_0x10e9('0x28')]['rawAttributes'],function(_0x327186){return{'name':_0x327186[_0x10e9('0x29')],'type':_0x327186['type']['key']};});_0x26433f[_0x10e9('0x2a')]=_[_0x10e9('0x27')](_0x4b2331,_0x10e9('0x24'));_0x26433f[_0x10e9('0x2b')]=_[_0x10e9('0x2c')](_0xa3d542['query']);_0x26433f[_0x10e9('0x2d')]=_['intersection'](_0x26433f[_0x10e9('0x2a')],_0x26433f[_0x10e9('0x2b')]);_0x5c8fc7['attributes']=_[_0x10e9('0x2e')](_0x26433f[_0x10e9('0x2a')],qs[_0x10e9('0x2f')](_0xa3d542[_0x10e9('0x2b')][_0x10e9('0x2f')]));_0x5c8fc7['attributes']=_0x5c8fc7[_0x10e9('0x30')][_0x10e9('0x31')]?_0x5c8fc7['attributes']:_0x26433f[_0x10e9('0x2a')];if(!_0xa3d542[_0x10e9('0x2b')][_0x10e9('0x32')](_0x10e9('0x33'))){_0x5c8fc7[_0x10e9('0x18')]=qs[_0x10e9('0x18')](_0xa3d542['query'][_0x10e9('0x18')]);_0x5c8fc7[_0x10e9('0x17')]=qs[_0x10e9('0x17')](_0xa3d542[_0x10e9('0x2b')][_0x10e9('0x17')]);}_0x5c8fc7[_0x10e9('0x34')]=qs['sort'](_0xa3d542['query'][_0x10e9('0x35')]);_0x5c8fc7['where']=qs[_0x10e9('0x2d')](_[_0x10e9('0x36')](_0xa3d542[_0x10e9('0x2b')],_0x26433f[_0x10e9('0x2d')]),_0x4b2331);if(_0xa3d542[_0x10e9('0x2b')][_0x10e9('0x37')]){_0x5c8fc7[_0x10e9('0x38')]=_[_0x10e9('0x39')](_0x5c8fc7[_0x10e9('0x38')],{'$or':_[_0x10e9('0x27')](_0x4b2331,function(_0xb91d90){if(_0xb91d90[_0x10e9('0x3a')]!=='VIRTUAL'){var _0x11adbe={};_0x11adbe[_0xb91d90[_0x10e9('0x24')]]={'$like':'%'+_0xa3d542[_0x10e9('0x2b')][_0x10e9('0x37')]+'%'};return _0x11adbe;}})});}_0x5c8fc7=_['merge']({},_0x5c8fc7,_0xa3d542[_0x10e9('0x3b')]);var _0x16f7df={'where':_0x5c8fc7[_0x10e9('0x38')]};return db[_0x10e9('0x28')][_0x10e9('0x1a')](_0x16f7df)['then'](function(_0x8b3e80){_0x3074c6[_0x10e9('0x1a')]=_0x8b3e80;if(_0xa3d542[_0x10e9('0x2b')][_0x10e9('0x3c')]){_0x5c8fc7[_0x10e9('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x10e9('0x3e')](_0x5c8fc7);})[_0x10e9('0x1f')](function(_0x31b76e){_0x3074c6['rows']=_0x31b76e;return _0x3074c6;})[_0x10e9('0x1f')](respondWithFilteredResult(_0x88bccd,_0x5c8fc7))[_0x10e9('0x3f')](handleError(_0x88bccd,null));};exports[_0x10e9('0x40')]=function(_0x4ab13c,_0x266381){var _0x1dc778={'raw':!![],'where':{'id':_0x4ab13c[_0x10e9('0x41')]['id']}},_0x1ee431={};_0x1ee431['model']=_[_0x10e9('0x2c')](db[_0x10e9('0x28')][_0x10e9('0x42')]);_0x1ee431['query']=_['keys'](_0x4ab13c[_0x10e9('0x2b')]);_0x1ee431['filters']=_[_0x10e9('0x2e')](_0x1ee431[_0x10e9('0x2a')],_0x1ee431[_0x10e9('0x2b')]);_0x1dc778[_0x10e9('0x30')]=_[_0x10e9('0x2e')](_0x1ee431[_0x10e9('0x2a')],qs[_0x10e9('0x2f')](_0x4ab13c[_0x10e9('0x2b')][_0x10e9('0x2f')]));_0x1dc778[_0x10e9('0x30')]=_0x1dc778['attributes'][_0x10e9('0x31')]?_0x1dc778[_0x10e9('0x30')]:_0x1ee431[_0x10e9('0x2a')];if(_0x4ab13c['query'][_0x10e9('0x3c')]){_0x1dc778[_0x10e9('0x3d')]=[{'all':!![]}];}_0x1dc778=_[_0x10e9('0x39')]({},_0x1dc778,_0x4ab13c[_0x10e9('0x3b')]);return db[_0x10e9('0x28')][_0x10e9('0x43')](_0x1dc778)[_0x10e9('0x1f')](handleEntityNotFound(_0x266381,null))['then'](respondWithResult(_0x266381,null))[_0x10e9('0x3f')](handleError(_0x266381,null));};exports[_0x10e9('0x44')]=function(_0x334d75,_0x267cb0){return db['SmsApplication'][_0x10e9('0x44')](_0x334d75['body'],{})[_0x10e9('0x1f')](respondWithResult(_0x267cb0,0xc9))[_0x10e9('0x3f')](handleError(_0x267cb0,null));};exports['update']=function(_0x5ed4be,_0x965d90){if(_0x5ed4be[_0x10e9('0x45')]['id']){delete _0x5ed4be[_0x10e9('0x45')]['id'];}return db[_0x10e9('0x28')]['find']({'where':{'id':_0x5ed4be[_0x10e9('0x41')]['id']}})[_0x10e9('0x1f')](handleEntityNotFound(_0x965d90,null))[_0x10e9('0x1f')](saveUpdates(_0x5ed4be[_0x10e9('0x45')],null))[_0x10e9('0x1f')](respondWithResult(_0x965d90,null))['catch'](handleError(_0x965d90,null));};exports[_0x10e9('0x20')]=function(_0x305c25,_0x3eef54){return db[_0x10e9('0x28')][_0x10e9('0x43')]({'where':{'id':_0x305c25[_0x10e9('0x41')]['id']}})[_0x10e9('0x1f')](handleEntityNotFound(_0x3eef54,null))['then'](removeEntity(_0x3eef54,null))[_0x10e9('0x3f')](handleError(_0x3eef54,null));}; \ No newline at end of file +var _0x0814=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','reject','destroy','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','then','rows','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x0814,0x120));var _0x4081=function(_0x59ed2,_0x42694f){_0x59ed2=_0x59ed2-0x0;var _0xb23b85=_0x0814[_0x59ed2];return _0xb23b85;};'use strict';var emlformat=require(_0x4081('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4081('0x1'));var jsonpatch=require(_0x4081('0x2'));var rp=require(_0x4081('0x3'));var moment=require(_0x4081('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4081('0x5'));var util=require(_0x4081('0x6'));var path=require(_0x4081('0x7'));var sox=require(_0x4081('0x8'));var csv=require('to-csv');var ejs=require(_0x4081('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4081('0xa'));var crypto=require(_0x4081('0xb'));var jsforce=require(_0x4081('0xc'));var deskjs=require(_0x4081('0xd'));var toCsv=require(_0x4081('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4081('0xf'));var authService=require(_0x4081('0x10'));var qs=require(_0x4081('0x11'));var as=require(_0x4081('0x12'));var hardwareService=require(_0x4081('0x13'));var logger=require(_0x4081('0x14'))(_0x4081('0x15'));var utils=require(_0x4081('0x16'));var config=require(_0x4081('0x17'));var licenseUtil=require(_0x4081('0x18'));var db=require(_0x4081('0x19'))['db'];function respondWithStatusCode(_0x47f186,_0x10b8b7){_0x10b8b7=_0x10b8b7||0xcc;return function(_0x20335e){if(_0x20335e){return _0x47f186['sendStatus'](_0x10b8b7);}return _0x47f186[_0x4081('0x1a')](_0x10b8b7)[_0x4081('0x1b')]();};}function respondWithResult(_0xd3b73,_0x4ef95f){_0x4ef95f=_0x4ef95f||0xc8;return function(_0x4be2c1){if(_0x4be2c1){return _0xd3b73['status'](_0x4ef95f)[_0x4081('0x1c')](_0x4be2c1);}};}function respondWithFilteredResult(_0x4ba9f1,_0x98f6a){return function(_0x3a4774){if(_0x3a4774){var _0x462159=typeof _0x98f6a[_0x4081('0x1d')]===_0x4081('0x1e')&&typeof _0x98f6a[_0x4081('0x1f')]===_0x4081('0x1e');var _0x22c92c=_0x3a4774['count'];var _0x5f3d4d=_0x462159?0x0:_0x98f6a[_0x4081('0x1d')];var _0x6ecfbe=_0x462159?_0x3a4774['count']:_0x98f6a[_0x4081('0x1d')]+_0x98f6a[_0x4081('0x1f')];var _0x55e979;if(_0x6ecfbe>=_0x22c92c){_0x6ecfbe=_0x22c92c;_0x55e979=0xc8;}else{_0x55e979=0xce;}_0x4ba9f1[_0x4081('0x1a')](_0x55e979);return _0x4ba9f1[_0x4081('0x20')]('Content-Range',_0x5f3d4d+'-'+_0x6ecfbe+'/'+_0x22c92c)[_0x4081('0x1c')](_0x3a4774);}return null;};}function patchUpdates(_0x3025e5){return function(_0x193fea){try{jsonpatch[_0x4081('0x21')](_0x193fea,_0x3025e5,!![]);}catch(_0x43cc08){return BPromise[_0x4081('0x22')](_0x43cc08);}return _0x193fea['save']();};}function saveUpdates(_0x597f85,_0x531082){return function(_0x55145f){if(_0x55145f){return _0x55145f['update'](_0x597f85)['then'](function(_0x1433ef){return _0x1433ef;});}return null;};}function removeEntity(_0x2222c1,_0x5823b1){return function(_0xffdb9f){if(_0xffdb9f){return _0xffdb9f[_0x4081('0x23')]()['then'](function(){_0x2222c1[_0x4081('0x1a')](0xcc)[_0x4081('0x1b')]();});}};}function handleEntityNotFound(_0x482c8a,_0x193bc6){return function(_0x200316){if(!_0x200316){_0x482c8a[_0x4081('0x24')](0x194);}return _0x200316;};}function handleError(_0x37be8b,_0x26f967){_0x26f967=_0x26f967||0x1f4;return function(_0x11869f){logger[_0x4081('0x25')](_0x11869f[_0x4081('0x26')]);if(_0x11869f['name']){delete _0x11869f[_0x4081('0x27')];}_0x37be8b[_0x4081('0x1a')](_0x26f967)[_0x4081('0x28')](_0x11869f);};}exports[_0x4081('0x29')]=function(_0x1632b1,_0x590ac0){var _0x3800a9={},_0x4f009d={},_0x1ee0e3={'count':0x0,'rows':[]};var _0x3f3625=_['map'](db[_0x4081('0x2a')][_0x4081('0x2b')],function(_0x38ae49){return{'name':_0x38ae49[_0x4081('0x2c')],'type':_0x38ae49['type'][_0x4081('0x2d')]};});_0x4f009d[_0x4081('0x2e')]=_[_0x4081('0x2f')](_0x3f3625,'name');_0x4f009d['query']=_[_0x4081('0x30')](_0x1632b1[_0x4081('0x31')]);_0x4f009d['filters']=_[_0x4081('0x32')](_0x4f009d[_0x4081('0x2e')],_0x4f009d[_0x4081('0x31')]);_0x3800a9[_0x4081('0x33')]=_[_0x4081('0x32')](_0x4f009d['model'],qs['fields'](_0x1632b1[_0x4081('0x31')][_0x4081('0x34')]));_0x3800a9[_0x4081('0x33')]=_0x3800a9[_0x4081('0x33')][_0x4081('0x35')]?_0x3800a9[_0x4081('0x33')]:_0x4f009d[_0x4081('0x2e')];if(!_0x1632b1[_0x4081('0x31')][_0x4081('0x36')](_0x4081('0x37'))){_0x3800a9[_0x4081('0x1f')]=qs[_0x4081('0x1f')](_0x1632b1[_0x4081('0x31')][_0x4081('0x1f')]);_0x3800a9['offset']=qs[_0x4081('0x1d')](_0x1632b1['query']['offset']);}_0x3800a9[_0x4081('0x38')]=qs[_0x4081('0x39')](_0x1632b1[_0x4081('0x31')][_0x4081('0x39')]);_0x3800a9[_0x4081('0x3a')]=qs[_0x4081('0x3b')](_[_0x4081('0x3c')](_0x1632b1[_0x4081('0x31')],_0x4f009d[_0x4081('0x3b')]),_0x3f3625);if(_0x1632b1[_0x4081('0x31')]['filter']){_0x3800a9[_0x4081('0x3a')]=_[_0x4081('0x3d')](_0x3800a9['where'],{'$or':_[_0x4081('0x2f')](_0x3f3625,function(_0x11fecf){if(_0x11fecf['type']!==_0x4081('0x3e')){var _0x5058cf={};_0x5058cf[_0x11fecf[_0x4081('0x27')]]={'$like':'%'+_0x1632b1[_0x4081('0x31')][_0x4081('0x3f')]+'%'};return _0x5058cf;}})});}_0x3800a9=_[_0x4081('0x3d')]({},_0x3800a9,_0x1632b1[_0x4081('0x40')]);var _0x4cecdf={'where':_0x3800a9[_0x4081('0x3a')]};return db['SmsApplication'][_0x4081('0x41')](_0x4cecdf)['then'](function(_0x4f2484){_0x1ee0e3[_0x4081('0x41')]=_0x4f2484;if(_0x1632b1[_0x4081('0x31')][_0x4081('0x42')]){_0x3800a9[_0x4081('0x43')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x3800a9);})[_0x4081('0x44')](function(_0x5ab85b){_0x1ee0e3[_0x4081('0x45')]=_0x5ab85b;return _0x1ee0e3;})['then'](respondWithFilteredResult(_0x590ac0,_0x3800a9))[_0x4081('0x46')](handleError(_0x590ac0,null));};exports[_0x4081('0x47')]=function(_0x26137d,_0x5daabb){var _0x262c7e={'raw':!![],'where':{'id':_0x26137d['params']['id']}},_0x1a617c={};_0x1a617c[_0x4081('0x2e')]=_[_0x4081('0x30')](db[_0x4081('0x2a')][_0x4081('0x2b')]);_0x1a617c[_0x4081('0x31')]=_[_0x4081('0x30')](_0x26137d['query']);_0x1a617c[_0x4081('0x3b')]=_['intersection'](_0x1a617c[_0x4081('0x2e')],_0x1a617c[_0x4081('0x31')]);_0x262c7e[_0x4081('0x33')]=_[_0x4081('0x32')](_0x1a617c[_0x4081('0x2e')],qs[_0x4081('0x34')](_0x26137d[_0x4081('0x31')]['fields']));_0x262c7e[_0x4081('0x33')]=_0x262c7e[_0x4081('0x33')][_0x4081('0x35')]?_0x262c7e[_0x4081('0x33')]:_0x1a617c['model'];if(_0x26137d[_0x4081('0x31')][_0x4081('0x42')]){_0x262c7e['include']=[{'all':!![]}];}_0x262c7e=_['merge']({},_0x262c7e,_0x26137d['options']);return db['SmsApplication'][_0x4081('0x48')](_0x262c7e)['then'](handleEntityNotFound(_0x5daabb,null))[_0x4081('0x44')](respondWithResult(_0x5daabb,null))[_0x4081('0x46')](handleError(_0x5daabb,null));};exports[_0x4081('0x49')]=function(_0x4b07bf,_0x1ce74c){return db['SmsApplication'][_0x4081('0x49')](_0x4b07bf[_0x4081('0x4a')],{})[_0x4081('0x44')](respondWithResult(_0x1ce74c,0xc9))['catch'](handleError(_0x1ce74c,null));};exports['update']=function(_0xb59fb6,_0x1a5fed){if(_0xb59fb6[_0x4081('0x4a')]['id']){delete _0xb59fb6[_0x4081('0x4a')]['id'];}return db[_0x4081('0x2a')]['find']({'where':{'id':_0xb59fb6[_0x4081('0x4b')]['id']}})[_0x4081('0x44')](handleEntityNotFound(_0x1a5fed,null))[_0x4081('0x44')](saveUpdates(_0xb59fb6['body'],null))[_0x4081('0x44')](respondWithResult(_0x1a5fed,null))[_0x4081('0x46')](handleError(_0x1a5fed,null));};exports[_0x4081('0x23')]=function(_0xb8a21,_0x1dca2e){return db['SmsApplication']['find']({'where':{'id':_0xb8a21['params']['id']}})[_0x4081('0x44')](handleEntityNotFound(_0x1dca2e,null))['then'](removeEntity(_0x1dca2e,null))[_0x4081('0x46')](handleError(_0x1dca2e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c75d83f..def9c23 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 _0xecd5=['request-promise','path','rimraf','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x4c5b70,_0x4a6985){var _0x27be24=function(_0x45bdb8){while(--_0x45bdb8){_0x4c5b70['push'](_0x4c5b70['shift']());}};_0x27be24(++_0x4a6985);}(_0xecd5,0x110));var _0x5ecd=function(_0x218424,_0x48ab3d){_0x218424=_0x218424-0x0;var _0x158045=_0xecd5[_0x218424];return _0x158045;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var moment=require('moment');var BPromise=require(_0x5ecd('0x3'));var rp=require(_0x5ecd('0x4'));var fs=require('fs');var path=require(_0x5ecd('0x5'));var rimraf=require(_0x5ecd('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ecd('0x7'));module['exports']=function(_0x1ddbad,_0x492eba){return _0x1ddbad['define'](_0x5ecd('0x8'),attributes,{'tableName':_0x5ecd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ecd('0xa'),'collate':_0x5ecd('0xb')});}; \ No newline at end of file +var _0x9485=['bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x9485,0x8b));var _0x5948=function(_0x5a0bbb,_0x2a02f7){_0x5a0bbb=_0x5a0bbb-0x0;var _0x1dfbb8=_0x9485[_0x5a0bbb];return _0x1dfbb8;};'use strict';var _=require(_0x5948('0x0'));var util=require(_0x5948('0x1'));var logger=require(_0x5948('0x2'))(_0x5948('0x3'));var moment=require('moment');var BPromise=require(_0x5948('0x4'));var rp=require(_0x5948('0x5'));var fs=require('fs');var path=require(_0x5948('0x6'));var rimraf=require('rimraf');var config=require(_0x5948('0x7'));var attributes=require(_0x5948('0x8'));module[_0x5948('0x9')]=function(_0x4312a8,_0x19ccdd){return _0x4312a8[_0x5948('0xa')]('SmsApplication',attributes,{'tableName':_0x5948('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5948('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f862048..2154685 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 _0x3d2f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x4f3de9,_0x1411ab){_0x4f3de9=_0x4f3de9-0x0;var _0x533c9b=_0x3d2f[_0x4f3de9];return _0x533c9b;};'use strict';var _=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var moment=require('moment');var BPromise=require(_0xf3d2('0x2'));var rs=require(_0xf3d2('0x3'));var fs=require('fs');var Redis=require(_0xf3d2('0x4'));var db=require(_0xf3d2('0x5'))['db'];var utils=require(_0xf3d2('0x6'));var logger=require(_0xf3d2('0x7'))(_0xf3d2('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3d2('0x9'));var client=jayson[_0xf3d2('0xa')][_0xf3d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf9a0c9,_0x23edba,_0x57f94b){return new BPromise(function(_0x26f330,_0x3f86f6){return client['request'](_0xf9a0c9,_0x57f94b)[_0xf3d2('0xc')](function(_0x4ef134){logger[_0xf3d2('0xd')](_0xf3d2('0xe'),_0x23edba,_0xf3d2('0xf'));logger[_0xf3d2('0x10')](_0xf3d2('0x11'),_0x23edba,_0xf3d2('0xf'),JSON['stringify'](_0x4ef134));if(_0x4ef134[_0xf3d2('0x12')]){if(_0x4ef134[_0xf3d2('0x12')]['code']===0x1f4){logger[_0xf3d2('0x12')]('SmsApplication,\x20%s,\x20%s',_0x23edba,_0x4ef134[_0xf3d2('0x12')][_0xf3d2('0x13')]);return _0x3f86f6(_0x4ef134[_0xf3d2('0x12')]['message']);}logger[_0xf3d2('0x12')](_0xf3d2('0xe'),_0x23edba,_0x4ef134[_0xf3d2('0x12')][_0xf3d2('0x13')]);return _0x26f330(_0x4ef134[_0xf3d2('0x12')][_0xf3d2('0x13')]);}else{logger['info'](_0xf3d2('0xe'),_0x23edba,_0xf3d2('0xf'));_0x26f330(_0x4ef134[_0xf3d2('0x14')][_0xf3d2('0x13')]);}})[_0xf3d2('0x15')](function(_0x3daaaf){logger[_0xf3d2('0x12')](_0xf3d2('0xe'),_0x23edba,_0x3daaaf);_0x3f86f6(_0x3daaaf);});});} \ No newline at end of file +var _0x4b11=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2c8aa8,_0x23bb2b){var _0x36ac2d=function(_0x1e6697){while(--_0x1e6697){_0x2c8aa8['push'](_0x2c8aa8['shift']());}};_0x36ac2d(++_0x23bb2b);}(_0x4b11,0xf4));var _0x14b1=function(_0x119551,_0x27a501){_0x119551=_0x119551-0x0;var _0x4c4ceb=_0x4b11[_0x119551];return _0x4c4ceb;};'use strict';var _=require(_0x14b1('0x0'));var util=require(_0x14b1('0x1'));var moment=require(_0x14b1('0x2'));var BPromise=require(_0x14b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14b1('0x4'));var db=require(_0x14b1('0x5'))['db'];var utils=require(_0x14b1('0x6'));var logger=require('../../config/logger')(_0x14b1('0x7'));var config=require(_0x14b1('0x8'));var jayson=require(_0x14b1('0x9'));var client=jayson[_0x14b1('0xa')][_0x14b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4376d6,_0x36b3df,_0x1c39e1){return new BPromise(function(_0x14342a,_0x1ca5ea){return client[_0x14b1('0xc')](_0x4376d6,_0x1c39e1)[_0x14b1('0xd')](function(_0xc93256){logger[_0x14b1('0xe')](_0x14b1('0xf'),_0x36b3df,'request\x20sent');logger[_0x14b1('0x10')](_0x14b1('0x11'),_0x36b3df,'request\x20sent',JSON[_0x14b1('0x12')](_0xc93256));if(_0xc93256[_0x14b1('0x13')]){if(_0xc93256[_0x14b1('0x13')][_0x14b1('0x14')]===0x1f4){logger[_0x14b1('0x13')](_0x14b1('0xf'),_0x36b3df,_0xc93256['error'][_0x14b1('0x15')]);return _0x1ca5ea(_0xc93256['error']['message']);}logger[_0x14b1('0x13')](_0x14b1('0xf'),_0x36b3df,_0xc93256[_0x14b1('0x13')][_0x14b1('0x15')]);return _0x14342a(_0xc93256[_0x14b1('0x13')][_0x14b1('0x15')]);}else{logger['info'](_0x14b1('0xf'),_0x36b3df,_0x14b1('0x16'));_0x14342a(_0xc93256[_0x14b1('0x17')][_0x14b1('0x15')]);}})[_0x14b1('0x18')](function(_0x13e78b){logger[_0x14b1('0x13')](_0x14b1('0xf'),_0x36b3df,_0x13e78b);_0x1ca5ea(_0x13e78b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 590c590..c1ff448 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 _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x2d5342,_0x56416b){_0x2d5342=_0x2d5342-0x0;var _0x3ed5d6=_0x757a[_0x2d5342];return _0x3ed5d6;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms'];(function(_0x5b52aa,_0x15b96b){var _0x6d1438=function(_0x51d962){while(--_0x51d962){_0x5b52aa['push'](_0x5b52aa['shift']());}};_0x6d1438(++_0x15b96b);}(_0xb10b,0x12a));var _0xbb10=function(_0x368eb4,_0x1512b3){_0x368eb4=_0x368eb4-0x0;var _0x398603=_0xb10b[_0x368eb4];return _0x398603;};'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('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['download']);router[_0xbb10('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x11')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x11')]('/:id/tags',auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x16')),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),'smsinteraction:update'),controller[_0xbb10('0x19')]);router[_0xbb10('0x1a')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x1b')),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1a')](_0xbb10('0x1d'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);module[_0xbb10('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 f3ec296..fb264a7 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 _0x1134=['moment','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x395116,_0x36dfda){var _0xfb18ed=function(_0x515292){while(--_0x515292){_0x395116['push'](_0x395116['shift']());}};_0xfb18ed(++_0x36dfda);}(_0x1134,0x19c));var _0x4113=function(_0x3233c0,_0x2605b7){_0x3233c0=_0x3233c0-0x0;var _0x39f3f7=_0x1134[_0x3233c0];return _0x39f3f7;};'use strict';var Sequelize=require(_0x4113('0x0'));var moment=require(_0x4113('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4113('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4113('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4113('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4113('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4113('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4113('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4113('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4113('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4113('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x41f2=['moment','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x50a631,_0x18c452){var _0x1276d5=function(_0xa80d27){while(--_0xa80d27){_0x50a631['push'](_0x50a631['shift']());}};_0x1276d5(++_0x18c452);}(_0x41f2,0x14f));var _0x241f=function(_0x337070,_0x5c1d54){_0x337070=_0x337070-0x0;var _0x1b865c=_0x41f2[_0x337070];return _0x1b865c;};'use strict';var Sequelize=require(_0x241f('0x0'));var moment=require(_0x241f('0x1'));module['exports']={'closed':{'type':Sequelize[_0x241f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x241f('0x3')]},'disposition':{'type':Sequelize[_0x241f('0x4')]},'secondDisposition':{'type':Sequelize[_0x241f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x241f('0x4')]},'phone':{'type':Sequelize[_0x241f('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x241f('0x5')]('in',_0x241f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x241f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x241f('0x5')]('in',_0x241f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 2f8c363..1ad62a2 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 _0x0927=['read','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','toString','out','System','lastName','direction','value','renderFile','server','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','limit','set','Content-Range','then','destroy','end','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','update','find','params','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','filters','hasOwnProperty','nolimit','offset','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','unix','join','root','files','tmp','push','User','fullname','CmContact','Contact','Messages','createdAt','secret'];(function(_0x4bc166,_0x6b1657){var _0x4a785e=function(_0x222e87){while(--_0x222e87){_0x4bc166['push'](_0x4bc166['shift']());}};_0x4a785e(++_0x6b1657);}(_0x0927,0x18d));var _0x7092=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0927[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x7092('0x0'));var zipdir=require('zip-dir');var moment=require(_0x7092('0x1'));var BPromise=require(_0x7092('0x2'));var util=require(_0x7092('0x3'));var path=require(_0x7092('0x4'));var ejs=require(_0x7092('0x5'));var fs=require('fs');var _=require(_0x7092('0x6'));var Redis=require(_0x7092('0x7'));var interaction=require(_0x7092('0x8'));var qs=require(_0x7092('0x9'));var pdf=require(_0x7092('0xa'));var logger=require(_0x7092('0xb'))(_0x7092('0xc'));var config=require(_0x7092('0xd'));var db=require(_0x7092('0xe'))['db'];config['redis']=_[_0x7092('0xf')](config[_0x7092('0x10')],{'host':_0x7092('0x11'),'port':0x18eb});var socket=require(_0x7092('0x12'))(new Redis(config[_0x7092('0x10')]));require(_0x7092('0x13'))[_0x7092('0x14')](socket);function respondWithStatusCode(_0x5c24b5,_0xadd011){_0xadd011=_0xadd011||0xcc;return function(_0x1a25a1){if(_0x1a25a1){return _0x5c24b5[_0x7092('0x15')](_0xadd011);}return _0x5c24b5[_0x7092('0x16')](_0xadd011)['end']();};}function respondWithResult(_0x4be4e9,_0x315149){_0x315149=_0x315149||0xc8;return function(_0x20950e){if(_0x20950e){return _0x4be4e9[_0x7092('0x16')](_0x315149)[_0x7092('0x17')](_0x20950e);}};}function respondWithFilteredResult(_0x328bbc,_0x1b7b9d){return function(_0x451781){if(_0x451781){var _0x5d3640=typeof _0x1b7b9d['offset']==='undefined'&&typeof _0x1b7b9d[_0x7092('0x18')]==='undefined';var _0x3bf304=_0x451781['count'];var _0xe811b=_0x5d3640?0x0:_0x1b7b9d['offset'];var _0x527ef6=_0x5d3640?_0x451781['count']:_0x1b7b9d['offset']+_0x1b7b9d['limit'];var _0x255def;if(_0x527ef6>=_0x3bf304){_0x527ef6=_0x3bf304;_0x255def=0xc8;}else{_0x255def=0xce;}_0x328bbc[_0x7092('0x16')](_0x255def);return _0x328bbc[_0x7092('0x19')](_0x7092('0x1a'),_0xe811b+'-'+_0x527ef6+'/'+_0x3bf304)[_0x7092('0x17')](_0x451781);}return null;};}function saveUpdates(_0x5c4629){return function(_0x2243c0){if(_0x2243c0){return _0x2243c0['update'](_0x5c4629)[_0x7092('0x1b')](function(_0x2593ad){return _0x2593ad;});}return null;};}function removeEntity(_0x118099){return function(_0x1de2d5){if(_0x1de2d5){return _0x1de2d5[_0x7092('0x1c')]()['then'](function(){_0x118099[_0x7092('0x16')](0xcc)[_0x7092('0x1d')]();});}};}function handleEntityNotFound(_0x4aadb2){return function(_0x361e48){if(!_0x361e48){_0x4aadb2[_0x7092('0x15')](0x194);}return _0x361e48;};}function handleError(_0xbc86d6,_0x43ee0c){_0x43ee0c=_0x43ee0c||0x1f4;return function(_0x53dad5){logger['error'](_0x53dad5[_0x7092('0x1e')]);if(_0x53dad5[_0x7092('0x1f')]){delete _0x53dad5[_0x7092('0x1f')];}_0xbc86d6[_0x7092('0x16')](_0x43ee0c)[_0x7092('0x20')](_0x53dad5);};}exports[_0x7092('0x21')]=function(_0x3056d2,_0x5eef7e){var _0x2c0352={};var _0x3024ee=_[_0x7092('0x22')](db[_0x7092('0x23')][_0x7092('0x24')],function(_0x1425cf){return{'name':_0x1425cf[_0x7092('0x25')],'type':_0x1425cf[_0x7092('0x26')][_0x7092('0x27')]};});_0x2c0352=qs[_0x7092('0x28')](_0x3024ee,_0x3056d2);return interaction[_0x7092('0x29')](_0x7092('0x2a'),_0x3056d2[_0x7092('0x2b')],_0x3056d2[_0x7092('0x2c')],_0x2c0352,_0x3024ee)[_0x7092('0x1b')](respondWithFilteredResult(_0x5eef7e,_0x2c0352))[_0x7092('0x2d')](handleError(_0x5eef7e,null));};exports['show']=function(_0xddd06c,_0x2d6189){var _0x43d95d={'raw':![],'where':{'id':_0xddd06c['params']['id']}},_0x452b63={};_0x452b63[_0x7092('0x2e')]=_['keys'](db['SmsInteraction'][_0x7092('0x24')]);_0x452b63[_0x7092('0x2b')]=_[_0x7092('0x2f')](_0xddd06c[_0x7092('0x2b')]);_0x452b63['filters']=_[_0x7092('0x30')](_0x452b63[_0x7092('0x2e')],_0x452b63[_0x7092('0x2b')]);_0x43d95d[_0x7092('0x31')]=_[_0x7092('0x30')](_0x452b63['model'],qs[_0x7092('0x32')](_0xddd06c[_0x7092('0x2b')][_0x7092('0x32')]));_0x43d95d[_0x7092('0x31')]=_0x43d95d[_0x7092('0x31')][_0x7092('0x33')]?_0x43d95d['attributes']:_0x452b63[_0x7092('0x2e')];if(_0xddd06c[_0x7092('0x2b')][_0x7092('0x34')]){_0x43d95d[_0x7092('0x35')]=[{'all':!![]}];}_0x43d95d=_[_0x7092('0x36')]({},_0x43d95d,_0xddd06c[_0x7092('0x37')]);return db['SmsInteraction']['find'](_0x43d95d)[_0x7092('0x1b')](handleEntityNotFound(_0x2d6189,null))[_0x7092('0x1b')](respondWithResult(_0x2d6189,null))['catch'](handleError(_0x2d6189,null));};exports['create']=function(_0x5bee32,_0x6a8513){return db[_0x7092('0x23')][_0x7092('0x38')](_0x5bee32[_0x7092('0x39')],{})[_0x7092('0x1b')](respondWithResult(_0x6a8513,0xc9))[_0x7092('0x2d')](handleError(_0x6a8513,null));};exports[_0x7092('0x3a')]=function(_0x5702a0,_0x2cfb15){if(_0x5702a0['body']['id']){delete _0x5702a0[_0x7092('0x39')]['id'];}return db[_0x7092('0x23')][_0x7092('0x3b')]({'where':{'id':_0x5702a0[_0x7092('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2cfb15,null))[_0x7092('0x1b')](saveUpdates(_0x5702a0[_0x7092('0x39')],null))[_0x7092('0x1b')](respondWithResult(_0x2cfb15,null))[_0x7092('0x2d')](handleError(_0x2cfb15,null));};exports['destroy']=function(_0x1a9cd2,_0x5eec14){return db[_0x7092('0x23')][_0x7092('0x3b')]({'where':{'id':_0x1a9cd2['params']['id']}})[_0x7092('0x1b')](handleEntityNotFound(_0x5eec14,null))[_0x7092('0x1b')](removeEntity(_0x5eec14,null))[_0x7092('0x2d')](handleError(_0x5eec14,null));};exports['describe']=function(_0x162624,_0x44d2b6){return db[_0x7092('0x23')][_0x7092('0x3d')]()[_0x7092('0x1b')](respondWithResult(_0x44d2b6,null))[_0x7092('0x2d')](handleError(_0x44d2b6,null));};exports['addMessage']=function(_0x89160e,_0x1a0b5c){return db['SmsMessage'][_0x7092('0x3b')]({'where':{'id':_0x89160e[_0x7092('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1a0b5c,null))[_0x7092('0x1b')](function(_0x31858e){if(_0x31858e){return _0x31858e[_0x7092('0x3e')](_0x89160e['body'][_0x7092('0x3f')],_[_0x7092('0x40')](_0x89160e[_0x7092('0x39')],['ids','id'])||{});}})[_0x7092('0x1b')](respondWithResult(_0x1a0b5c,null))[_0x7092('0x2d')](handleError(_0x1a0b5c,null));};exports[_0x7092('0x41')]=function(_0x5289cb,_0x219711){var _0x13de68={'raw':![],'where':{}};var _0x169ca2={};var _0x27d389={'count':0x0,'rows':[]};return db[_0x7092('0x23')][_0x7092('0x42')]({'where':{'id':_0x5289cb[_0x7092('0x3c')]['id']}})[_0x7092('0x1b')](handleEntityNotFound(_0x219711,null))[_0x7092('0x1b')](function(_0x43b281){if(_0x43b281){_0x169ca2[_0x7092('0x2e')]=_[_0x7092('0x2f')](db[_0x7092('0x43')][_0x7092('0x24')]);_0x169ca2[_0x7092('0x2b')]=_['keys'](_0x5289cb[_0x7092('0x2b')]);_0x169ca2[_0x7092('0x44')]=_[_0x7092('0x30')](_0x169ca2['model'],_0x169ca2[_0x7092('0x2b')]);_0x13de68['attributes']=_[_0x7092('0x30')](_0x169ca2[_0x7092('0x2e')],qs[_0x7092('0x32')](_0x5289cb[_0x7092('0x2b')][_0x7092('0x32')]));_0x13de68[_0x7092('0x31')]=_0x13de68[_0x7092('0x31')]['length']?_0x13de68[_0x7092('0x31')]:_0x169ca2['model'];if(!_0x5289cb[_0x7092('0x2b')][_0x7092('0x45')](_0x7092('0x46'))){_0x13de68[_0x7092('0x18')]=qs[_0x7092('0x18')](_0x5289cb[_0x7092('0x2b')]['limit']);_0x13de68[_0x7092('0x47')]=qs[_0x7092('0x47')](_0x5289cb[_0x7092('0x2b')]['offset']);}_0x13de68['order']=qs[_0x7092('0x48')](_0x5289cb[_0x7092('0x2b')]['sort']);_0x13de68[_0x7092('0x49')]=qs['filters'](_[_0x7092('0x4a')](_0x5289cb[_0x7092('0x2b')],_0x169ca2[_0x7092('0x44')]));_0x13de68[_0x7092('0x49')][_0x7092('0x4b')]=_0x43b281['id'];if(_0x5289cb['query'][_0x7092('0x4c')]){_0x13de68['where']=_[_0x7092('0x36')](_0x13de68['where'],{'$or':_[_0x7092('0x22')](_0x13de68[_0x7092('0x31')],function(_0x2f31d1){var _0x4e49ab={};_0x4e49ab[_0x2f31d1]={'$like':'%'+_0x5289cb[_0x7092('0x2b')]['filter']+'%'};return _0x4e49ab;})});}if(_0x5289cb['query'][_0x7092('0x4d')]){var _0x10617b=_0x5289cb['query'][_0x7092('0x4d')][_0x7092('0x4e')](',');var _0x702320={};_0x702320[_0x10617b[0x0]]={'$gte':moment(_0x10617b[0x1])[_0x7092('0x4f')](_0x7092('0x50'))};_0x13de68['where']=_[_0x7092('0x36')](_0x13de68['where'],_0x702320);}_0x13de68=_[_0x7092('0x36')]({},_0x13de68,_0x5289cb[_0x7092('0x37')]);return db[_0x7092('0x43')][_0x7092('0x51')]({'where':_0x13de68[_0x7092('0x49')]})['then'](function(_0x18405f){_0x27d389['count']=_0x18405f;if(_0x5289cb[_0x7092('0x2b')]['includeAll']){_0x13de68[_0x7092('0x35')]=[{'all':!![]}];}return db[_0x7092('0x43')][_0x7092('0x29')](_0x13de68);})[_0x7092('0x1b')](function(_0x108a99){_0x27d389[_0x7092('0x52')]=_0x108a99;return _0x27d389;});}})[_0x7092('0x1b')](respondWithFilteredResult(_0x219711,_0x13de68))[_0x7092('0x2d')](handleError(_0x219711,null));};exports[_0x7092('0x53')]=function(_0x1b90e1,_0x2d5f62){return db[_0x7092('0x23')][_0x7092('0x3b')]({'where':{'id':_0x1b90e1[_0x7092('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2d5f62,null))[_0x7092('0x1b')](function(_0xac68a0){if(_0xac68a0){return _0xac68a0[_0x7092('0x54')](_0x1b90e1['body'][_0x7092('0x3f')],_[_0x7092('0x40')](_0x1b90e1[_0x7092('0x39')],[_0x7092('0x3f'),'id'])||{})[_0x7092('0x55')](function(){return db['Tag'][_0x7092('0x29')]({'attributes':['id','name',_0x7092('0x56')],'where':{'id':_0x1b90e1['body']['ids']}});})[_0x7092('0x1b')](function(_0xa6ba93){socket[_0x7092('0x57')](_0x7092('0x58'),{'id':Number(_0x1b90e1['params']['id']),'tags':_0xa6ba93||[]});return{'id':Number(_0x1b90e1[_0x7092('0x3c')]['id']),'tags':_0xa6ba93||[]};});}})['then'](respondWithResult(_0x2d5f62,null))[_0x7092('0x2d')](handleError(_0x2d5f62,null));};exports['removeTags']=function(_0x46a1e5,_0x6d1288){return db[_0x7092('0x23')][_0x7092('0x3b')]({'where':{'id':_0x46a1e5[_0x7092('0x3c')]['id']}})[_0x7092('0x1b')](handleEntityNotFound(_0x6d1288,null))[_0x7092('0x1b')](function(_0x5b7c86){if(_0x5b7c86){return _0x5b7c86[_0x7092('0x59')](_0x46a1e5['query'][_0x7092('0x3f')]);}})['then'](respondWithStatusCode(_0x6d1288,null))['catch'](handleError(_0x6d1288,null));};exports['download']=function(_0x3acba4,_0x5b3f41){var _0x13e5b2=moment()[_0x7092('0x5a')]()['toString']();var _0x2bc194=path[_0x7092('0x5b')](config[_0x7092('0x5c')],'server',_0x7092('0x5d'),_0x7092('0x5e'));var _0x29a71f=path[_0x7092('0x5b')](_0x2bc194,_0x13e5b2);var _0x30fc00=util[_0x7092('0x4f')]('transcript-%d-%s.zip',_0x3acba4[_0x7092('0x3c')]['id'],_0x13e5b2);var _0x740ab7=path[_0x7092('0x5b')](_0x2bc194,_0x30fc00);var _0x3a8b34=[];_0x3a8b34[_0x7092('0x5f')]({'model':db[_0x7092('0x60')],'as':'User','attributes':['id',_0x7092('0x61')],'raw':!![]});_0x3a8b34[_0x7092('0x5f')]({'model':db[_0x7092('0x62')],'as':_0x7092('0x63'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x3462b5=[{'model':db[_0x7092('0x43')],'as':_0x7092('0x64'),'attributes':['id',_0x7092('0x39'),_0x7092('0x65'),'direction',_0x7092('0x66'),_0x7092('0x67')],'include':_0x3a8b34}];_0x3462b5[_0x7092('0x5f')]({'model':db[_0x7092('0x68')],'as':'Account','attributes':['id',_0x7092('0x1f')]});_0x3462b5[_0x7092('0x5f')]({'model':db[_0x7092('0x60')],'as':_0x7092('0x69'),'attributes':['id',_0x7092('0x61')]});return db[_0x7092('0x23')][_0x7092('0x3b')]({'where':{'id':_0x3acba4[_0x7092('0x3c')]['id']},'include':_0x3462b5})[_0x7092('0x1b')](handleEntityNotFound(_0x5b3f41,null))[_0x7092('0x1b')](function(_0x578dd5){if(_0x578dd5){var _0x4bd905=_0x578dd5[_0x7092('0x6a')]({'plain':!![]});fs[_0x7092('0x6b')](_0x29a71f);var _0x20cb7c={'channel':_0x7092('0x6c'),'account':_0x4bd905[_0x7092('0x6d')]['name'],'agent':_0x4bd905[_0x7092('0x69')]?_0x4bd905[_0x7092('0x69')][_0x7092('0x61')]:_0x7092('0x6e'),'createdAt':moment(_0x4bd905[_0x7092('0x65')])[_0x7092('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4bd905['closed']?moment(_0x4bd905['closedAt'])[_0x7092('0x4f')](_0x7092('0x50'))[_0x7092('0x6f')]():'','disposition':_0x4bd905['disposition'],'messages':_(_0x4bd905[_0x7092('0x64')])[_0x7092('0x4c')]({'secret':![]})[_0x7092('0x22')](function(_0x46de1f){return{'date':moment(_0x46de1f[_0x7092('0x65')])[_0x7092('0x4f')](_0x7092('0x50'))[_0x7092('0x6f')](),'sender':_0x46de1f['direction']===_0x7092('0x70')?_0x46de1f['User']?_0x46de1f[_0x7092('0x60')][_0x7092('0x61')]:_0x7092('0x71'):_0x46de1f[_0x7092('0x63')]['firstName']+(_0x46de1f[_0x7092('0x63')][_0x7092('0x72')]?'\x20'+_0x46de1f[_0x7092('0x63')][_0x7092('0x72')]:''),'body':_0x46de1f[_0x7092('0x39')],'direction':_0x46de1f[_0x7092('0x73')]===_0x7092('0x70')?'A':'C','secret':_0x46de1f[_0x7092('0x66')],'read':_0x46de1f['read']};})[_0x7092('0x74')]()};return ejs[_0x7092('0x75')](path[_0x7092('0x5b')](config['root'],_0x7092('0x76'),'views','downloadInteraction.ejs'),{'interaction':_0x20cb7c})[_0x7092('0x1b')](function(_0x1d7961){var _0xb6b0f8=path[_0x7092('0x5b')](_0x29a71f,_0x7092('0x77')+_0x4bd905['id']+'-'+_0x13e5b2+_0x7092('0x78'));var _0xfd091d={'path':_0xb6b0f8,'channel':_0x7092('0x6c'),'interactionId':_0x4bd905['id']};return pdf[_0x7092('0x79')](_0x1d7961,_0xfd091d);})['then'](function(){return new BPromise(function(_0x42b595,_0x2211d2){zipdir(_0x29a71f,{'saveTo':_0x740ab7},function(_0x2e4738,_0x4a58b7){if(_0x2e4738)return _0x2211d2(_0x2e4738);return _0x42b595(_0x4a58b7);});})[_0x7092('0x1b')](function(){return new BPromise(function(_0x19cc21,_0x34bea8){rimraf(_0x29a71f,function(_0x358229){if(_0x358229)_0x34bea8(_0x358229);return _0x19cc21();});});})[_0x7092('0x1b')](function(){return _0x5b3f41['download'](_0x740ab7,_0x30fc00,function(_0x5c3984){if(_0x5c3984){console[_0x7092('0x7a')](_0x7092('0x7b'),_0x5c3984);}else{fs[_0x7092('0x7c')](_0x740ab7);}});});});}else{return _0x5b3f41[_0x7092('0x15')](0xc8);}})['catch'](handleError(_0x5b3f41,null));}; \ No newline at end of file +var _0xc3b9=['filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','omit','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','get','Sms','Account','Owner','closed','closedAt','disposition','out','read','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','util','path','lodash','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','type','getOptions','findAll','sms','query','user','model','keys','filters','intersection','fields','attributes','length','include','merge','catch','create','SmsInteraction','body','find','params','describe','SmsMessage','ids','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0xc3b9,0x114));var _0x9c3b=function(_0x85666,_0x403be2){_0x85666=_0x85666-0x0;var _0x233527=_0xc3b9[_0x85666];return _0x233527;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9c3b('0x0'));var moment=require(_0x9c3b('0x1'));var BPromise=require('bluebird');var util=require(_0x9c3b('0x2'));var path=require(_0x9c3b('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9c3b('0x4'));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(_0x9c3b('0x5'))(_0x9c3b('0x6'));var config=require('../../config/environment');var db=require(_0x9c3b('0x7'))['db'];config['redis']=_[_0x9c3b('0x8')](config[_0x9c3b('0x9')],{'host':_0x9c3b('0xa'),'port':0x18eb});var socket=require(_0x9c3b('0xb'))(new Redis(config[_0x9c3b('0x9')]));require('./smsInteraction.socket')[_0x9c3b('0xc')](socket);function respondWithStatusCode(_0x3b45a2,_0x35a3b9){_0x35a3b9=_0x35a3b9||0xcc;return function(_0x2eeaba){if(_0x2eeaba){return _0x3b45a2['sendStatus'](_0x35a3b9);}return _0x3b45a2[_0x9c3b('0xd')](_0x35a3b9)[_0x9c3b('0xe')]();};}function respondWithResult(_0xe6843e,_0x220425){_0x220425=_0x220425||0xc8;return function(_0x3701aa){if(_0x3701aa){return _0xe6843e[_0x9c3b('0xd')](_0x220425)[_0x9c3b('0xf')](_0x3701aa);}};}function respondWithFilteredResult(_0x14af23,_0x27f065){return function(_0x56e49d){if(_0x56e49d){var _0xed571d=typeof _0x27f065[_0x9c3b('0x10')]===_0x9c3b('0x11')&&typeof _0x27f065[_0x9c3b('0x12')]===_0x9c3b('0x11');var _0x10c86d=_0x56e49d[_0x9c3b('0x13')];var _0x1e34ae=_0xed571d?0x0:_0x27f065[_0x9c3b('0x10')];var _0x1a3cc6=_0xed571d?_0x56e49d['count']:_0x27f065[_0x9c3b('0x10')]+_0x27f065['limit'];var _0x505ae5;if(_0x1a3cc6>=_0x10c86d){_0x1a3cc6=_0x10c86d;_0x505ae5=0xc8;}else{_0x505ae5=0xce;}_0x14af23['status'](_0x505ae5);return _0x14af23['set'](_0x9c3b('0x14'),_0x1e34ae+'-'+_0x1a3cc6+'/'+_0x10c86d)[_0x9c3b('0xf')](_0x56e49d);}return null;};}function saveUpdates(_0x228a6a){return function(_0x13cd6e){if(_0x13cd6e){return _0x13cd6e[_0x9c3b('0x15')](_0x228a6a)[_0x9c3b('0x16')](function(_0x44beaa){return _0x44beaa;});}return null;};}function removeEntity(_0x19df17){return function(_0x1b19a0){if(_0x1b19a0){return _0x1b19a0[_0x9c3b('0x17')]()[_0x9c3b('0x16')](function(){_0x19df17['status'](0xcc)[_0x9c3b('0xe')]();});}};}function handleEntityNotFound(_0x1c4c6b){return function(_0x211e32){if(!_0x211e32){_0x1c4c6b[_0x9c3b('0x18')](0x194);}return _0x211e32;};}function handleError(_0x129112,_0x5272cf){_0x5272cf=_0x5272cf||0x1f4;return function(_0x8b6c49){logger[_0x9c3b('0x19')](_0x8b6c49[_0x9c3b('0x1a')]);if(_0x8b6c49[_0x9c3b('0x1b')]){delete _0x8b6c49[_0x9c3b('0x1b')];}_0x129112['status'](_0x5272cf)[_0x9c3b('0x1c')](_0x8b6c49);};}exports['index']=function(_0x2dcd49,_0x21185b){var _0xd00939={};var _0x220c55=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x240ed1){return{'name':_0x240ed1['fieldName'],'type':_0x240ed1[_0x9c3b('0x1d')]['key']};});_0xd00939=qs[_0x9c3b('0x1e')](_0x220c55,_0x2dcd49);return interaction[_0x9c3b('0x1f')](_0x9c3b('0x20'),_0x2dcd49[_0x9c3b('0x21')],_0x2dcd49[_0x9c3b('0x22')],_0xd00939,_0x220c55)[_0x9c3b('0x16')](respondWithFilteredResult(_0x21185b,_0xd00939))['catch'](handleError(_0x21185b,null));};exports['show']=function(_0x18f49c,_0x427157){var _0xc93edb={'raw':![],'where':{'id':_0x18f49c['params']['id']}},_0x4fc706={};_0x4fc706[_0x9c3b('0x23')]=_[_0x9c3b('0x24')](db['SmsInteraction']['rawAttributes']);_0x4fc706[_0x9c3b('0x21')]=_[_0x9c3b('0x24')](_0x18f49c['query']);_0x4fc706[_0x9c3b('0x25')]=_[_0x9c3b('0x26')](_0x4fc706[_0x9c3b('0x23')],_0x4fc706[_0x9c3b('0x21')]);_0xc93edb['attributes']=_[_0x9c3b('0x26')](_0x4fc706[_0x9c3b('0x23')],qs[_0x9c3b('0x27')](_0x18f49c[_0x9c3b('0x21')]['fields']));_0xc93edb[_0x9c3b('0x28')]=_0xc93edb[_0x9c3b('0x28')][_0x9c3b('0x29')]?_0xc93edb[_0x9c3b('0x28')]:_0x4fc706[_0x9c3b('0x23')];if(_0x18f49c[_0x9c3b('0x21')]['includeAll']){_0xc93edb[_0x9c3b('0x2a')]=[{'all':!![]}];}_0xc93edb=_[_0x9c3b('0x2b')]({},_0xc93edb,_0x18f49c['options']);return db['SmsInteraction']['find'](_0xc93edb)['then'](handleEntityNotFound(_0x427157,null))['then'](respondWithResult(_0x427157,null))[_0x9c3b('0x2c')](handleError(_0x427157,null));};exports[_0x9c3b('0x2d')]=function(_0x2cd265,_0x4ae48c){return db[_0x9c3b('0x2e')]['create'](_0x2cd265[_0x9c3b('0x2f')],{})[_0x9c3b('0x16')](respondWithResult(_0x4ae48c,0xc9))[_0x9c3b('0x2c')](handleError(_0x4ae48c,null));};exports[_0x9c3b('0x15')]=function(_0x12ded9,_0x1356de){if(_0x12ded9[_0x9c3b('0x2f')]['id']){delete _0x12ded9[_0x9c3b('0x2f')]['id'];}return db[_0x9c3b('0x2e')][_0x9c3b('0x30')]({'where':{'id':_0x12ded9[_0x9c3b('0x31')]['id']}})[_0x9c3b('0x16')](handleEntityNotFound(_0x1356de,null))[_0x9c3b('0x16')](saveUpdates(_0x12ded9[_0x9c3b('0x2f')],null))['then'](respondWithResult(_0x1356de,null))[_0x9c3b('0x2c')](handleError(_0x1356de,null));};exports['destroy']=function(_0x36cea0,_0x589089){return db[_0x9c3b('0x2e')]['find']({'where':{'id':_0x36cea0[_0x9c3b('0x31')]['id']}})[_0x9c3b('0x16')](handleEntityNotFound(_0x589089,null))['then'](removeEntity(_0x589089,null))[_0x9c3b('0x2c')](handleError(_0x589089,null));};exports[_0x9c3b('0x32')]=function(_0x1808b0,_0x399266){return db[_0x9c3b('0x2e')][_0x9c3b('0x32')]()[_0x9c3b('0x16')](respondWithResult(_0x399266,null))[_0x9c3b('0x2c')](handleError(_0x399266,null));};exports['addMessage']=function(_0x4fb49d,_0x569702){return db[_0x9c3b('0x33')][_0x9c3b('0x30')]({'where':{'id':_0x4fb49d['params']['id']}})['then'](handleEntityNotFound(_0x569702,null))['then'](function(_0x2bf3bc){if(_0x2bf3bc){return _0x2bf3bc['addMessage'](_0x4fb49d[_0x9c3b('0x2f')]['ids'],_['omit'](_0x4fb49d['body'],[_0x9c3b('0x34'),'id'])||{});}})[_0x9c3b('0x16')](respondWithResult(_0x569702,null))[_0x9c3b('0x2c')](handleError(_0x569702,null));};exports[_0x9c3b('0x35')]=function(_0x2639d4,_0x532c39){var _0x40d7ad={'raw':![],'where':{}};var _0x3d79b9={};var _0x596fea={'count':0x0,'rows':[]};return db[_0x9c3b('0x2e')][_0x9c3b('0x36')]({'where':{'id':_0x2639d4['params']['id']}})[_0x9c3b('0x16')](handleEntityNotFound(_0x532c39,null))[_0x9c3b('0x16')](function(_0xc84320){if(_0xc84320){_0x3d79b9[_0x9c3b('0x23')]=_[_0x9c3b('0x24')](db[_0x9c3b('0x33')][_0x9c3b('0x37')]);_0x3d79b9[_0x9c3b('0x21')]=_['keys'](_0x2639d4['query']);_0x3d79b9[_0x9c3b('0x25')]=_['intersection'](_0x3d79b9['model'],_0x3d79b9[_0x9c3b('0x21')]);_0x40d7ad[_0x9c3b('0x28')]=_[_0x9c3b('0x26')](_0x3d79b9[_0x9c3b('0x23')],qs[_0x9c3b('0x27')](_0x2639d4[_0x9c3b('0x21')][_0x9c3b('0x27')]));_0x40d7ad[_0x9c3b('0x28')]=_0x40d7ad['attributes'][_0x9c3b('0x29')]?_0x40d7ad[_0x9c3b('0x28')]:_0x3d79b9[_0x9c3b('0x23')];if(!_0x2639d4['query'][_0x9c3b('0x38')](_0x9c3b('0x39'))){_0x40d7ad[_0x9c3b('0x12')]=qs[_0x9c3b('0x12')](_0x2639d4[_0x9c3b('0x21')][_0x9c3b('0x12')]);_0x40d7ad[_0x9c3b('0x10')]=qs[_0x9c3b('0x10')](_0x2639d4[_0x9c3b('0x21')][_0x9c3b('0x10')]);}_0x40d7ad[_0x9c3b('0x3a')]=qs[_0x9c3b('0x3b')](_0x2639d4[_0x9c3b('0x21')]['sort']);_0x40d7ad['where']=qs[_0x9c3b('0x25')](_[_0x9c3b('0x3c')](_0x2639d4[_0x9c3b('0x21')],_0x3d79b9[_0x9c3b('0x25')]));_0x40d7ad[_0x9c3b('0x3d')][_0x9c3b('0x3e')]=_0xc84320['id'];if(_0x2639d4[_0x9c3b('0x21')][_0x9c3b('0x3f')]){_0x40d7ad['where']=_['merge'](_0x40d7ad['where'],{'$or':_[_0x9c3b('0x40')](_0x40d7ad['attributes'],function(_0x1a16f4){var _0x417681={};_0x417681[_0x1a16f4]={'$like':'%'+_0x2639d4[_0x9c3b('0x21')][_0x9c3b('0x3f')]+'%'};return _0x417681;})});}if(_0x2639d4[_0x9c3b('0x21')]['$gte']){var _0x268d46=_0x2639d4[_0x9c3b('0x21')][_0x9c3b('0x41')][_0x9c3b('0x42')](',');var _0x195ff6={};_0x195ff6[_0x268d46[0x0]]={'$gte':moment(_0x268d46[0x1])[_0x9c3b('0x43')](_0x9c3b('0x44'))};_0x40d7ad[_0x9c3b('0x3d')]=_[_0x9c3b('0x2b')](_0x40d7ad[_0x9c3b('0x3d')],_0x195ff6);}_0x40d7ad=_[_0x9c3b('0x2b')]({},_0x40d7ad,_0x2639d4['options']);return db[_0x9c3b('0x33')][_0x9c3b('0x13')]({'where':_0x40d7ad[_0x9c3b('0x3d')]})[_0x9c3b('0x16')](function(_0x55e463){_0x596fea[_0x9c3b('0x13')]=_0x55e463;if(_0x2639d4[_0x9c3b('0x21')]['includeAll']){_0x40d7ad['include']=[{'all':!![]}];}return db[_0x9c3b('0x33')]['findAll'](_0x40d7ad);})[_0x9c3b('0x16')](function(_0x29a347){_0x596fea[_0x9c3b('0x45')]=_0x29a347;return _0x596fea;});}})[_0x9c3b('0x16')](respondWithFilteredResult(_0x532c39,_0x40d7ad))['catch'](handleError(_0x532c39,null));};exports['addTags']=function(_0x2a108c,_0x5593ce){return db[_0x9c3b('0x2e')][_0x9c3b('0x30')]({'where':{'id':_0x2a108c['params']['id']}})[_0x9c3b('0x16')](handleEntityNotFound(_0x5593ce,null))[_0x9c3b('0x16')](function(_0x23ee35){if(_0x23ee35){return _0x23ee35['setTags'](_0x2a108c[_0x9c3b('0x2f')][_0x9c3b('0x34')],_[_0x9c3b('0x46')](_0x2a108c[_0x9c3b('0x2f')],[_0x9c3b('0x34'),'id'])||{})['spread'](function(){return db[_0x9c3b('0x47')][_0x9c3b('0x1f')]({'attributes':['id','name',_0x9c3b('0x48')],'where':{'id':_0x2a108c[_0x9c3b('0x2f')]['ids']}});})[_0x9c3b('0x16')](function(_0x1d3d80){socket[_0x9c3b('0x49')](_0x9c3b('0x4a'),{'id':Number(_0x2a108c['params']['id']),'tags':_0x1d3d80||[]});return{'id':Number(_0x2a108c[_0x9c3b('0x31')]['id']),'tags':_0x1d3d80||[]};});}})['then'](respondWithResult(_0x5593ce,null))[_0x9c3b('0x2c')](handleError(_0x5593ce,null));};exports[_0x9c3b('0x4b')]=function(_0x2b886e,_0x494b59){return db[_0x9c3b('0x2e')][_0x9c3b('0x30')]({'where':{'id':_0x2b886e[_0x9c3b('0x31')]['id']}})[_0x9c3b('0x16')](handleEntityNotFound(_0x494b59,null))[_0x9c3b('0x16')](function(_0x3db476){if(_0x3db476){return _0x3db476['removeTags'](_0x2b886e[_0x9c3b('0x21')]['ids']);}})[_0x9c3b('0x16')](respondWithStatusCode(_0x494b59,null))[_0x9c3b('0x2c')](handleError(_0x494b59,null));};exports[_0x9c3b('0x4c')]=function(_0x528e62,_0x477c3b){var _0x390b35=moment()[_0x9c3b('0x4d')]()[_0x9c3b('0x4e')]();var _0x4f4f5f=path[_0x9c3b('0x4f')](config[_0x9c3b('0x50')],_0x9c3b('0x51'),_0x9c3b('0x52'),_0x9c3b('0x53'));var _0x1a9f21=path[_0x9c3b('0x4f')](_0x4f4f5f,_0x390b35);var _0x39d7ce=util[_0x9c3b('0x43')](_0x9c3b('0x54'),_0x528e62['params']['id'],_0x390b35);var _0x4a6a12=path[_0x9c3b('0x4f')](_0x4f4f5f,_0x39d7ce);var _0x2e5e3c=[];_0x2e5e3c[_0x9c3b('0x55')]({'model':db[_0x9c3b('0x56')],'as':'User','attributes':['id',_0x9c3b('0x57')],'raw':!![]});_0x2e5e3c[_0x9c3b('0x55')]({'model':db['CmContact'],'as':_0x9c3b('0x58'),'attributes':['id',_0x9c3b('0x59'),_0x9c3b('0x5a')],'raw':!![]});var _0x353e8a=[{'model':db[_0x9c3b('0x33')],'as':_0x9c3b('0x5b'),'attributes':['id',_0x9c3b('0x2f'),_0x9c3b('0x5c'),_0x9c3b('0x5d'),_0x9c3b('0x5e'),'read'],'include':_0x2e5e3c}];_0x353e8a['push']({'model':db[_0x9c3b('0x5f')],'as':'Account','attributes':['id',_0x9c3b('0x1b')]});_0x353e8a[_0x9c3b('0x55')]({'model':db['User'],'as':'Owner','attributes':['id',_0x9c3b('0x57')]});return db[_0x9c3b('0x2e')]['find']({'where':{'id':_0x528e62[_0x9c3b('0x31')]['id']},'include':_0x353e8a})[_0x9c3b('0x16')](handleEntityNotFound(_0x477c3b,null))['then'](function(_0x58fa55){if(_0x58fa55){var _0x1f4c58=_0x58fa55[_0x9c3b('0x60')]({'plain':!![]});fs['mkdirSync'](_0x1a9f21);var _0x786611={'channel':_0x9c3b('0x61'),'account':_0x1f4c58[_0x9c3b('0x62')][_0x9c3b('0x1b')],'agent':_0x1f4c58[_0x9c3b('0x63')]?_0x1f4c58[_0x9c3b('0x63')]['fullname']:'N.A.','createdAt':moment(_0x1f4c58[_0x9c3b('0x5c')])[_0x9c3b('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9c3b('0x4e')](),'closedAt':_0x1f4c58[_0x9c3b('0x64')]?moment(_0x1f4c58[_0x9c3b('0x65')])[_0x9c3b('0x43')](_0x9c3b('0x44'))[_0x9c3b('0x4e')]():'','disposition':_0x1f4c58[_0x9c3b('0x66')],'messages':_(_0x1f4c58[_0x9c3b('0x5b')])[_0x9c3b('0x3f')]({'secret':![]})[_0x9c3b('0x40')](function(_0x104fb1){return{'date':moment(_0x104fb1[_0x9c3b('0x5c')])[_0x9c3b('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9c3b('0x4e')](),'sender':_0x104fb1['direction']==='out'?_0x104fb1[_0x9c3b('0x56')]?_0x104fb1[_0x9c3b('0x56')][_0x9c3b('0x57')]:'System':_0x104fb1[_0x9c3b('0x58')][_0x9c3b('0x59')]+(_0x104fb1[_0x9c3b('0x58')][_0x9c3b('0x5a')]?'\x20'+_0x104fb1['Contact'][_0x9c3b('0x5a')]:''),'body':_0x104fb1[_0x9c3b('0x2f')],'direction':_0x104fb1['direction']===_0x9c3b('0x67')?'A':'C','secret':_0x104fb1[_0x9c3b('0x5e')],'read':_0x104fb1[_0x9c3b('0x68')]};})[_0x9c3b('0x69')]()};return ejs[_0x9c3b('0x6a')](path['join'](config['root'],_0x9c3b('0x51'),_0x9c3b('0x6b'),_0x9c3b('0x6c')),{'interaction':_0x786611})[_0x9c3b('0x16')](function(_0xfbc15e){var _0xafcc50=path['join'](_0x1a9f21,'transcript-'+_0x1f4c58['id']+'-'+_0x390b35+'.pdf');var _0x104de4={'path':_0xafcc50,'channel':_0x9c3b('0x61'),'interactionId':_0x1f4c58['id']};return pdf[_0x9c3b('0x6d')](_0xfbc15e,_0x104de4);})[_0x9c3b('0x16')](function(){return new BPromise(function(_0x39bdce,_0x43c24b){zipdir(_0x1a9f21,{'saveTo':_0x4a6a12},function(_0x4889b4,_0x48c01a){if(_0x4889b4)return _0x43c24b(_0x4889b4);return _0x39bdce(_0x48c01a);});})[_0x9c3b('0x16')](function(){return new BPromise(function(_0x4821fd,_0x16d5af){rimraf(_0x1a9f21,function(_0x5eb7f1){if(_0x5eb7f1)_0x16d5af(_0x5eb7f1);return _0x4821fd();});});})[_0x9c3b('0x16')](function(){return _0x477c3b['download'](_0x4a6a12,_0x39d7ce,function(_0x2f5f53){if(_0x2f5f53){console[_0x9c3b('0x6e')](_0x9c3b('0x6f'),_0x2f5f53);}else{fs[_0x9c3b('0x70')](_0x4a6a12);}});});});}else{return _0x477c3b[_0x9c3b('0x18')](0xc8);}})[_0x9c3b('0x2c')](handleError(_0x477c3b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 550540b..476fbdd 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 _0x4cf8=['unreadMessages','length','emit','catch','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll'];(function(_0x9dfd69,_0x21bcc5){var _0x1efb5c=function(_0x482b34){while(--_0x482b34){_0x9dfd69['push'](_0x9dfd69['shift']());}};_0x1efb5c(++_0x21bcc5);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0x4cf8[_0xe480f0];return _0x57b198;};'use strict';var EventEmitter=require(_0x84cf('0x0'));var SmsInteraction=require(_0x84cf('0x1'))['db'][_0x84cf('0x2')];var SmsMessage=require(_0x84cf('0x1'))['db'][_0x84cf('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x84cf('0x4')](0x0);var events={'afterCreate':_0x84cf('0x5'),'afterUpdate':_0x84cf('0x6'),'afterDestroy':_0x84cf('0x7')};function emitEvent(_0x2d38c0){return function(_0x5844d7,_0x2c613d,_0x50ade2){_0x5844d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x84cf('0x8')](function(_0x56c5cc){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xa'),_0x56c5cc['map'](function(_0x2e0b79){return{'id':_0x2e0b79['id']};}));return SmsMessage[_0x84cf('0xb')]({'where':{'SmsInteractionId':_0x5844d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfb5398){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xc'),_0xfb5398[_0x84cf('0xd')]);SmsInteractionEvents['emit'](_0x2d38c0+':'+_0x5844d7['id'],_0x5844d7);SmsInteractionEvents[_0x84cf('0xe')](_0x2d38c0,_0x5844d7);_0x50ade2(null);})[_0x84cf('0xf')](_0x50ade2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x84cf('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x546f64,_0x38b8a5){var _0x554b6e=function(_0x2ee8aa){while(--_0x2ee8aa){_0x546f64['push'](_0x546f64['shift']());}};_0x554b6e(++_0x38b8a5);}(_0x5c3c,0x132));var _0xc5c3=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x5c3c[_0x174ef5];return _0x1cc379;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b36fff4..ff53421 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 _0x6775=['path','../../config/environment','exports','define','SmsInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4d937,_0x2d8298){var _0x28dbbd=function(_0x55415e){while(--_0x55415e){_0x4d937['push'](_0x4d937['shift']());}};_0x28dbbd(++_0x2d8298);}(_0x6775,0x159));var _0x5677=function(_0x1cb1e2,_0x267721){_0x1cb1e2=_0x1cb1e2-0x0;var _0x5c0b45=_0x6775[_0x1cb1e2];return _0x5c0b45;};'use strict';var _=require('lodash');var util=require(_0x5677('0x0'));var logger=require(_0x5677('0x1'))(_0x5677('0x2'));var moment=require('moment');var BPromise=require(_0x5677('0x3'));var rp=require(_0x5677('0x4'));var fs=require('fs');var path=require(_0x5677('0x5'));var rimraf=require('rimraf');var config=require(_0x5677('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x5677('0x7')]=function(_0x110856,_0x5f4889){return _0x110856[_0x5677('0x8')](_0x5677('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x426f20,_0x203ab3,_0x4022c0){if(_0x426f20[_0x5677('0xa')](_0x5677('0xb'))){_0x426f20[_0x5677('0xc')]=moment()['format'](_0x5677('0xd'));}_0x4022c0(null,_0x426f20);}}});}; \ No newline at end of file +var _0xba16=['moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x4ec0cc,_0x1a0ab6){var _0x5e6ce2=function(_0x515a1a){while(--_0x515a1a){_0x4ec0cc['push'](_0x4ec0cc['shift']());}};_0x5e6ce2(++_0x1a0ab6);}(_0xba16,0x10b));var _0x6ba1=function(_0x2e7c96,_0x27804d){_0x2e7c96=_0x2e7c96-0x0;var _0x36008e=_0xba16[_0x2e7c96];return _0x36008e;};'use strict';var _=require(_0x6ba1('0x0'));var util=require(_0x6ba1('0x1'));var logger=require(_0x6ba1('0x2'))('api');var moment=require(_0x6ba1('0x3'));var BPromise=require('bluebird');var rp=require(_0x6ba1('0x4'));var fs=require('fs');var path=require(_0x6ba1('0x5'));var rimraf=require(_0x6ba1('0x6'));var config=require(_0x6ba1('0x7'));var attributes=require(_0x6ba1('0x8'));module[_0x6ba1('0x9')]=function(_0x2b7451,_0x43604b){return _0x2b7451[_0x6ba1('0xa')](_0x6ba1('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4968cb,_0x3ed334,_0x1d8699){if(_0x4968cb['changed'](_0x6ba1('0xc'))){_0x4968cb[_0x6ba1('0xd')]=moment()['format'](_0x6ba1('0xe'));}_0x1d8699(null,_0x4968cb);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index cfd76e3..c66b3e9 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 _0xbe2a=['http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','info','request\x20sent','debug','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','then','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2a8761,_0x3259cb){var _0x3ad459=function(_0x5c25b3){while(--_0x5c25b3){_0x2a8761['push'](_0x2a8761['shift']());}};_0x3ad459(++_0x3259cb);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x1d1a60,_0x503284){_0x1d1a60=_0x1d1a60-0x0;var _0x3c5a6e=_0xbe2a[_0x1d1a60];return _0x3c5a6e;};'use strict';var _=require(_0xabe2('0x0'));var util=require(_0xabe2('0x1'));var moment=require(_0xabe2('0x2'));var BPromise=require(_0xabe2('0x3'));var rs=require(_0xabe2('0x4'));var fs=require('fs');var Redis=require(_0xabe2('0x5'));var db=require(_0xabe2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xabe2('0x7'))('rpc');var config=require(_0xabe2('0x8'));var jayson=require(_0xabe2('0x9'));var client=jayson[_0xabe2('0xa')][_0xabe2('0xb')]({'port':0x232a});config[_0xabe2('0xc')]=_[_0xabe2('0xd')](config['redis'],{'host':_0xabe2('0xe'),'port':0x18eb});var socket=require(_0xabe2('0xf'))(new Redis(config[_0xabe2('0xc')]));require(_0xabe2('0x10'))[_0xabe2('0x11')](socket);function respondWithRpcPromise(_0x1b6319,_0x53a91f,_0x27fbaa){return new BPromise(function(_0x307e01,_0x35ddd1){return client['request'](_0x1b6319,_0x27fbaa)['then'](function(_0x5742c5){logger[_0xabe2('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x53a91f,_0xabe2('0x13'));logger[_0xabe2('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x53a91f,'request\x20sent',JSON[_0xabe2('0x15')](_0x5742c5));if(_0x5742c5[_0xabe2('0x16')]){if(_0x5742c5[_0xabe2('0x16')][_0xabe2('0x17')]===0x1f4){logger[_0xabe2('0x16')](_0xabe2('0x18'),_0x53a91f,_0x5742c5[_0xabe2('0x16')][_0xabe2('0x19')]);return _0x35ddd1(_0x5742c5[_0xabe2('0x16')][_0xabe2('0x19')]);}logger['error'](_0xabe2('0x18'),_0x53a91f,_0x5742c5[_0xabe2('0x16')][_0xabe2('0x19')]);return _0x307e01(_0x5742c5['error'][_0xabe2('0x19')]);}else{logger[_0xabe2('0x12')](_0xabe2('0x18'),_0x53a91f,_0xabe2('0x13'));_0x307e01(_0x5742c5['result'][_0xabe2('0x19')]);}})[_0xabe2('0x1a')](function(_0x50a49a){logger[_0xabe2('0x16')](_0xabe2('0x18'),_0x53a91f,_0x50a49a);_0x35ddd1(_0x50a49a);});});}exports['UpdateSmsInteraction']=function(_0x55d89){var _0x3efadc=this;return new Promise(function(_0x2906f4,_0x4a5f75){return db[_0xabe2('0x1b')][_0xabe2('0x1c')](_0x55d89[_0xabe2('0x1d')],{'raw':_0x55d89[_0xabe2('0x1e')]?_0x55d89[_0xabe2('0x1e')][_0xabe2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55d89['options']?_0x55d89[_0xabe2('0x1e')][_0xabe2('0x20')]||null:null,'attributes':_0x55d89['options']?_0x55d89['options'][_0xabe2('0x21')]||null:null,'limit':_0x55d89[_0xabe2('0x1e')]?_0x55d89[_0xabe2('0x1e')][_0xabe2('0x22')]||null:null})['then'](function(_0x19d9ab){logger[_0xabe2('0x12')](_0xabe2('0x23'),_0x55d89);logger['debug'](_0xabe2('0x23'),_0x55d89,JSON[_0xabe2('0x15')](_0x19d9ab));_0x2906f4(_0x19d9ab);})['catch'](function(_0x7b1d){logger[_0xabe2('0x16')]('UpdateSmsInteraction',_0x7b1d[_0xabe2('0x19')],_0x55d89);_0x4a5f75(_0x3efadc['error'](0x1f4,_0x7b1d[_0xabe2('0x19')]));});});};exports[_0xabe2('0x24')]=function(_0x20aee1){return new Promise(function(_0x8a5517,_0x302919){return db[_0xabe2('0x1b')][_0xabe2('0x25')]({'where':_0x20aee1['options']?_0x20aee1[_0xabe2('0x1e')][_0xabe2('0x20')]||null:null})[_0xabe2('0x26')](function(_0x24485b){if(_0x24485b){return _0x24485b[_0xabe2('0x27')](_0x20aee1['body'][_0xabe2('0x28')],_[_0xabe2('0x29')](_0x20aee1[_0xabe2('0x1d')],['ids','id'])||{});}})[_0xabe2('0x2a')](function(_0x2ea99d){logger[_0xabe2('0x12')](_0xabe2('0x2b'),_0x20aee1);logger[_0xabe2('0x14')](_0xabe2('0x2b'),_0x20aee1,JSON['stringify'](_0x2ea99d));_0x8a5517(_0x2ea99d);})['catch'](function(_0x4c7782){logger['error'](_0xabe2('0x2b'),_0x4c7782[_0xabe2('0x19')],_0x20aee1);_0x302919(_this['error'](0x1f4,_0x4c7782[_0xabe2('0x19')]));});});}; \ No newline at end of file +var _0xc99a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','catch','lodash','util','bluebird','randomstring'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc99a,0xf2));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac99('0x0'));var util=require(_0xac99('0x1'));var moment=require('moment');var BPromise=require(_0xac99('0x2'));var rs=require(_0xac99('0x3'));var fs=require('fs');var Redis=require(_0xac99('0x4'));var db=require(_0xac99('0x5'))['db'];var utils=require(_0xac99('0x6'));var logger=require(_0xac99('0x7'))(_0xac99('0x8'));var config=require('../../config/environment');var jayson=require(_0xac99('0x9'));var client=jayson['client'][_0xac99('0xa')]({'port':0x232a});config[_0xac99('0xb')]=_[_0xac99('0xc')](config[_0xac99('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac99('0xb')]));require('./smsInteraction.socket')[_0xac99('0xd')](socket);function respondWithRpcPromise(_0x53a50c,_0x18a7f6,_0x4cda60){return new BPromise(function(_0x4f81d8,_0x2c15d5){return client[_0xac99('0xe')](_0x53a50c,_0x4cda60)[_0xac99('0xf')](function(_0x3ca520){logger[_0xac99('0x10')](_0xac99('0x11'),_0x18a7f6,_0xac99('0x12'));logger[_0xac99('0x13')](_0xac99('0x14'),_0x18a7f6,_0xac99('0x12'),JSON[_0xac99('0x15')](_0x3ca520));if(_0x3ca520[_0xac99('0x16')]){if(_0x3ca520[_0xac99('0x16')][_0xac99('0x17')]===0x1f4){logger['error'](_0xac99('0x11'),_0x18a7f6,_0x3ca520[_0xac99('0x16')][_0xac99('0x18')]);return _0x2c15d5(_0x3ca520['error']['message']);}logger[_0xac99('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x18a7f6,_0x3ca520[_0xac99('0x16')][_0xac99('0x18')]);return _0x4f81d8(_0x3ca520[_0xac99('0x16')][_0xac99('0x18')]);}else{logger[_0xac99('0x10')](_0xac99('0x11'),_0x18a7f6,_0xac99('0x12'));_0x4f81d8(_0x3ca520['result'][_0xac99('0x18')]);}})['catch'](function(_0xd14c79){logger[_0xac99('0x16')](_0xac99('0x11'),_0x18a7f6,_0xd14c79);_0x2c15d5(_0xd14c79);});});}exports[_0xac99('0x19')]=function(_0x4be781){var _0x3e6620=this;return new Promise(function(_0x4d5990,_0x46dfa1){return db[_0xac99('0x1a')][_0xac99('0x1b')](_0x4be781[_0xac99('0x1c')],{'raw':_0x4be781[_0xac99('0x1d')]?_0x4be781['options'][_0xac99('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4be781['options']?_0x4be781[_0xac99('0x1d')][_0xac99('0x1f')]||null:null,'attributes':_0x4be781[_0xac99('0x1d')]?_0x4be781[_0xac99('0x1d')][_0xac99('0x20')]||null:null,'limit':_0x4be781[_0xac99('0x1d')]?_0x4be781[_0xac99('0x1d')][_0xac99('0x21')]||null:null})[_0xac99('0xf')](function(_0x19400a){logger[_0xac99('0x10')]('UpdateSmsInteraction',_0x4be781);logger['debug']('UpdateSmsInteraction',_0x4be781,JSON[_0xac99('0x15')](_0x19400a));_0x4d5990(_0x19400a);})['catch'](function(_0x3dc075){logger['error'](_0xac99('0x19'),_0x3dc075[_0xac99('0x18')],_0x4be781);_0x46dfa1(_0x3e6620[_0xac99('0x16')](0x1f4,_0x3dc075[_0xac99('0x18')]));});});};exports[_0xac99('0x22')]=function(_0x3aa01d){return new Promise(function(_0x2790f6,_0x1be1fb){return db[_0xac99('0x1a')][_0xac99('0x23')]({'where':_0x3aa01d[_0xac99('0x1d')]?_0x3aa01d['options']['where']||null:null})[_0xac99('0xf')](function(_0x380a39){if(_0x380a39){return _0x380a39[_0xac99('0x24')](_0x3aa01d[_0xac99('0x1c')][_0xac99('0x25')],_[_0xac99('0x26')](_0x3aa01d[_0xac99('0x1c')],[_0xac99('0x25'),'id'])||{});}})['spread'](function(_0x1e1a61){logger[_0xac99('0x10')]('AddTags',_0x3aa01d);logger[_0xac99('0x13')](_0xac99('0x27'),_0x3aa01d,JSON['stringify'](_0x1e1a61));_0x2790f6(_0x1e1a61);})[_0xac99('0x28')](function(_0xaf786f){logger[_0xac99('0x16')](_0xac99('0x27'),_0xaf786f[_0xac99('0x18')],_0x3aa01d);_0x1be1fb(_this[_0xac99('0x16')](0x1f4,_0xaf786f[_0xac99('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a5462fb..fed9fdd 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 _0xd359=['length','smsInteraction:','remove','update','removeListener','register'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0xd359,0xfe));var _0x9d35=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd359[_0xfae23b];return _0x200640;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x9d35('0x0'),_0x9d35('0x1')];function createListener(_0x584f97,_0x1f740b){return function(_0x13bfac){_0x1f740b['emit'](_0x584f97,_0x13bfac);};}function removeListener(_0x5656ef,_0x2acd6d){return function(){SmsInteractionEvents[_0x9d35('0x2')](_0x5656ef,_0x2acd6d);};}exports[_0x9d35('0x3')]=function(_0x172718){for(var _0x51e611=0x0,_0x3a9152=events[_0x9d35('0x4')];_0x51e611<_0x3a9152;_0x51e611++){var _0x24807d=events[_0x51e611];var _0x2a484b=createListener(_0x9d35('0x5')+_0x24807d,_0x172718);SmsInteractionEvents['on'](_0x24807d,_0x2a484b);}}; \ No newline at end of file +var _0xba38=['smsInteraction:','./smsInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x41c358,_0xb928de){var _0x25a609=function(_0x390471){while(--_0x390471){_0x41c358['push'](_0x41c358['shift']());}};_0x25a609(++_0xb928de);}(_0xba38,0x89));var _0x8ba3=function(_0x5bdab9,_0x1c9a23){_0x5bdab9=_0x5bdab9-0x0;var _0x4aee89=_0xba38[_0x5bdab9];return _0x4aee89;};'use strict';var SmsInteractionEvents=require(_0x8ba3('0x0'));var events=['save',_0x8ba3('0x1'),_0x8ba3('0x2')];function createListener(_0x97618c,_0x2d0bef){return function(_0x54e3cb){_0x2d0bef[_0x8ba3('0x3')](_0x97618c,_0x54e3cb);};}function removeListener(_0x9bd662,_0x117459){return function(){SmsInteractionEvents[_0x8ba3('0x4')](_0x9bd662,_0x117459);};}exports[_0x8ba3('0x5')]=function(_0x15b5ff){for(var _0x1eff97=0x0,_0x81b60=events[_0x8ba3('0x6')];_0x1eff97<_0x81b60;_0x1eff97++){var _0x27583c=events[_0x1eff97];var _0x3931ed=createListener(_0x8ba3('0x7')+_0x27583c,_0x15b5ff);SmsInteractionEvents['on'](_0x27583c,_0x3931ed);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0154f72..18208f8 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 _0xe5a9=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','/:id','show','tracked','sms','post','status','put','update','/:id/accept','accept','reject','delete'];(function(_0x4896d8,_0x12405b){var _0x4dc3ae=function(_0x388561){while(--_0x388561){_0x4896d8['push'](_0x4896d8['shift']());}};_0x4dc3ae(++_0x12405b);}(_0xe5a9,0x9e));var _0x9e5a=function(_0x459c09,_0x596ed4){_0x459c09=_0x459c09-0x0;var _0x2aee20=_0xe5a9[_0x459c09];return _0x2aee20;};'use strict';var multer=require('multer');var util=require(_0x9e5a('0x0'));var path=require(_0x9e5a('0x1'));var timeout=require(_0x9e5a('0x2'));var express=require(_0x9e5a('0x3'));var router=express[_0x9e5a('0x4')]();var fs_extra=require(_0x9e5a('0x5'));var auth=require(_0x9e5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e5a('0x7'));var controller=require(_0x9e5a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9e5a('0x9')](_0x9e5a('0xa'),auth[_0x9e5a('0xb')](),controller['describe']);router[_0x9e5a('0x9')](_0x9e5a('0xc'),auth[_0x9e5a('0xb')](),controller[_0x9e5a('0xd')]);router['post']('/',auth[_0x9e5a('0xb')](),interaction[_0x9e5a('0xe')](_0x9e5a('0xf'),'smsmessage:create'),controller['create']);router[_0x9e5a('0x10')]('/:id/status',controller[_0x9e5a('0x11')]);router[_0x9e5a('0x12')](_0x9e5a('0xc'),auth['isAuthenticated'](),controller[_0x9e5a('0x13')]);router[_0x9e5a('0x12')](_0x9e5a('0x14'),auth['isAuthenticated'](),controller[_0x9e5a('0x15')]);router[_0x9e5a('0x12')]('/:id/reject',auth[_0x9e5a('0xb')](),controller[_0x9e5a('0x16')]);router[_0x9e5a('0x17')](_0x9e5a('0xc'),auth[_0x9e5a('0xb')](),controller[_0x9e5a('0x18')]);module[_0x9e5a('0x19')]=router; \ No newline at end of file +var _0x4e80=['index','/describe','isAuthenticated','describe','/:id','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x4e80,0xda));var _0x04e8=function(_0x2e1047,_0x546d79){_0x2e1047=_0x2e1047-0x0;var _0x1aba6d=_0x4e80[_0x2e1047];return _0x1aba6d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x04e8('0x0'));var timeout=require(_0x04e8('0x1'));var express=require('express');var router=express[_0x04e8('0x2')]();var fs_extra=require(_0x04e8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x04e8('0x4'));var config=require('../../config/environment');var controller=require(_0x04e8('0x5'));router[_0x04e8('0x6')]('/',auth['isAuthenticated'](),controller[_0x04e8('0x7')]);router[_0x04e8('0x6')](_0x04e8('0x8'),auth[_0x04e8('0x9')](),controller[_0x04e8('0xa')]);router[_0x04e8('0x6')](_0x04e8('0xb'),auth[_0x04e8('0x9')](),controller['show']);router[_0x04e8('0xc')]('/',auth['isAuthenticated'](),interaction[_0x04e8('0xd')]('sms',_0x04e8('0xe')),controller[_0x04e8('0xf')]);router[_0x04e8('0xc')](_0x04e8('0x10'),controller[_0x04e8('0x11')]);router[_0x04e8('0x12')]('/:id',auth[_0x04e8('0x9')](),controller[_0x04e8('0x13')]);router[_0x04e8('0x12')](_0x04e8('0x14'),auth[_0x04e8('0x9')](),controller[_0x04e8('0x15')]);router['put'](_0x04e8('0x16'),auth[_0x04e8('0x9')](),controller['reject']);router[_0x04e8('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x04e8('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 21b49bb..ac56825 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 _0x54ef=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1046e3,_0x323a21){var _0x1f04fa=function(_0x4e0dc2){while(--_0x4e0dc2){_0x1046e3['push'](_0x1046e3['shift']());}};_0x1f04fa(++_0x323a21);}(_0x54ef,0xc2));var _0xf54e=function(_0x1a1183,_0x168ae3){_0x1a1183=_0x1a1183-0x0;var _0x418b56=_0x54ef[_0x1a1183];return _0x418b56;};'use strict';var Sequelize=require(_0xf54e('0x0'));module['exports']={'body':{'type':Sequelize[_0xf54e('0x1')](_0xf54e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf54e('0x4')]('in',_0xf54e('0x5')),'defaultValue':_0xf54e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf54e('0x6')]},'readAt':{'type':Sequelize[_0xf54e('0x7')]},'secret':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf54e('0x1')]}}; \ No newline at end of file +var _0xe080=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x240dcf,_0x22f6c3){var _0x2cea70=function(_0x13108a){while(--_0x13108a){_0x240dcf['push'](_0x240dcf['shift']());}};_0x2cea70(++_0x22f6c3);}(_0xe080,0x141));var _0x0e08=function(_0x4e7587,_0x1bf07a){_0x4e7587=_0x4e7587-0x0;var _0x1d653f=_0xe080[_0x4e7587];return _0x1d653f;};'use strict';var Sequelize=require(_0x0e08('0x0'));module[_0x0e08('0x1')]={'body':{'type':Sequelize[_0x0e08('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0e08('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e08('0x4')]('in',_0x0e08('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0e08('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0e08('0x6')]},'readAt':{'type':Sequelize[_0x0e08('0x7')]},'secret':{'type':Sequelize[_0x0e08('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0e08('0x6')]},'providerResponse':{'type':Sequelize[_0x0e08('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 29e2338..c836d8c 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 _0xf156=['results','groupName','DELIVERED','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SmsMessage','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','interface','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','indexOf','sent','delivered','plivio','infobip'];(function(_0x52cc68,_0x440163){var _0x572cd4=function(_0xdd8786){while(--_0xdd8786){_0x52cc68['push'](_0x52cc68['shift']());}};_0x572cd4(++_0x440163);}(_0xf156,0x137));var _0x6f15=function(_0x5f5900,_0x2e9899){_0x5f5900=_0x5f5900-0x0;var _0x412aa6=_0xf156[_0x5f5900];return _0x412aa6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f15('0x0'));var zipdir=require(_0x6f15('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f15('0x2'));var moment=require('moment');var BPromise=require(_0x6f15('0x3'));var Mustache=require(_0x6f15('0x4'));var util=require(_0x6f15('0x5'));var path=require(_0x6f15('0x6'));var sox=require(_0x6f15('0x7'));var csv=require(_0x6f15('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f15('0x9'));var squel=require(_0x6f15('0xa'));var crypto=require('crypto');var jsforce=require(_0x6f15('0xb'));var deskjs=require(_0x6f15('0xc'));var toCsv=require(_0x6f15('0x8'));var querystring=require(_0x6f15('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6f15('0xe'));var qs=require(_0x6f15('0xf'));var as=require(_0x6f15('0x10'));var hardwareService=require(_0x6f15('0x11'));var logger=require(_0x6f15('0x12'))(_0x6f15('0x13'));var utils=require(_0x6f15('0x14'));var config=require(_0x6f15('0x15'));var licenseUtil=require(_0x6f15('0x16'));var db=require(_0x6f15('0x17'))['db'];config['redis']=_[_0x6f15('0x18')](config['redis'],{'host':_0x6f15('0x19'),'port':0x18eb});var socket=require(_0x6f15('0x1a'))(new Redis(config[_0x6f15('0x1b')]));require(_0x6f15('0x1c'))[_0x6f15('0x1d')](socket);var jayson=require(_0x6f15('0x1e'));var client=jayson[_0x6f15('0x1f')][_0x6f15('0x20')]({'port':0x232c});var client9002=jayson[_0x6f15('0x1f')][_0x6f15('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5b271f,_0x2e0e93,_0x4804a4,_0x28aa95){return new BPromise(function(_0x5e1620,_0x48e7f3){var _0x56615c=_0x28aa95||client;return _0x56615c[_0x6f15('0x21')](_0x5b271f,_0x4804a4)['then'](function(_0xa4525c){logger['info'](_0x6f15('0x22'),_0x2e0e93,_0x6f15('0x23'));logger[_0x6f15('0x24')](_0x6f15('0x25'),_0x2e0e93,'request\x20sent',JSON['stringify'](_0xa4525c));if(_0xa4525c[_0x6f15('0x26')]){if(_0xa4525c[_0x6f15('0x26')][_0x6f15('0x27')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2e0e93,_0xa4525c[_0x6f15('0x26')][_0x6f15('0x28')]);return _0x48e7f3(_0xa4525c['error'][_0x6f15('0x28')]);}logger['error'](_0x6f15('0x22'),_0x2e0e93,_0xa4525c[_0x6f15('0x26')]['message']);return _0x5e1620(_0xa4525c['error'][_0x6f15('0x28')]);}else{logger['info'](_0x6f15('0x22'),_0x2e0e93,_0x6f15('0x23'));_0x5e1620(_0xa4525c[_0x6f15('0x29')][_0x6f15('0x28')]);}})[_0x6f15('0x2a')](function(_0x49f55f){logger[_0x6f15('0x26')](_0x6f15('0x22'),_0x2e0e93,_0x49f55f);_0x48e7f3(_0x49f55f);});});}function respondWithStatusCode(_0x3bead0,_0x289763){_0x289763=_0x289763||0xcc;return function(_0x5ab978){if(_0x5ab978){return _0x3bead0[_0x6f15('0x2b')](_0x289763);}return _0x3bead0[_0x6f15('0x2c')](_0x289763)[_0x6f15('0x2d')]();};}function respondWithResult(_0x43b401,_0x5c27a2){_0x5c27a2=_0x5c27a2||0xc8;return function(_0x5b8b1d){if(_0x5b8b1d){return _0x43b401[_0x6f15('0x2c')](_0x5c27a2)[_0x6f15('0x2e')](_0x5b8b1d);}};}function respondWithFilteredResult(_0x3226cc,_0x4c9cfd){return function(_0x4cb5e3){if(_0x4cb5e3){var _0x3e4c55=typeof _0x4c9cfd['offset']==='undefined'&&typeof _0x4c9cfd[_0x6f15('0x2f')]===_0x6f15('0x30');var _0x586da9=_0x4cb5e3[_0x6f15('0x31')];var _0x26cfcd=_0x3e4c55?0x0:_0x4c9cfd['offset'];var _0x382ff8=_0x3e4c55?_0x4cb5e3[_0x6f15('0x31')]:_0x4c9cfd['offset']+_0x4c9cfd[_0x6f15('0x2f')];var _0x5f0111;if(_0x382ff8>=_0x586da9){_0x382ff8=_0x586da9;_0x5f0111=0xc8;}else{_0x5f0111=0xce;}_0x3226cc[_0x6f15('0x2c')](_0x5f0111);return _0x3226cc[_0x6f15('0x32')](_0x6f15('0x33'),_0x26cfcd+'-'+_0x382ff8+'/'+_0x586da9)['json'](_0x4cb5e3);}return null;};}function patchUpdates(_0x188ed8){return function(_0xb7ba68){try{jsonpatch[_0x6f15('0x34')](_0xb7ba68,_0x188ed8,!![]);}catch(_0x472756){return BPromise[_0x6f15('0x35')](_0x472756);}return _0xb7ba68[_0x6f15('0x36')]();};}function saveUpdates(_0x1739e5,_0x3687c6){return function(_0xfe7f45){if(_0xfe7f45){return _0xfe7f45[_0x6f15('0x37')](_0x1739e5)[_0x6f15('0x38')](function(_0xffc6ea){return _0xffc6ea;});}return null;};}function removeEntity(_0xc4b491,_0x4213ed){return function(_0x1a0c4e){if(_0x1a0c4e){return _0x1a0c4e[_0x6f15('0x39')]()[_0x6f15('0x38')](function(){_0xc4b491[_0x6f15('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530e35,_0x3b6b46){return function(_0x5e5413){if(!_0x5e5413){_0x530e35['sendStatus'](0x194);}return _0x5e5413;};}function handleError(_0x4b1665,_0x286de6){_0x286de6=_0x286de6||0x1f4;return function(_0x471005){logger[_0x6f15('0x26')](_0x471005[_0x6f15('0x3a')]);if(_0x471005[_0x6f15('0x3b')]){delete _0x471005['name'];}_0x4b1665[_0x6f15('0x2c')](_0x286de6)['send'](_0x471005);};}exports[_0x6f15('0x3c')]=function(_0x1c2f6c,_0x1561d6){var _0x2dbcd4={},_0x216073={},_0x4ceedc={'count':0x0,'rows':[]};var _0x2623d2=_[_0x6f15('0x3d')](db[_0x6f15('0x3e')]['rawAttributes'],function(_0x5ea823){return{'name':_0x5ea823['fieldName'],'type':_0x5ea823['type']['key']};});_0x216073[_0x6f15('0x3f')]=_[_0x6f15('0x3d')](_0x2623d2,_0x6f15('0x3b'));_0x216073[_0x6f15('0x40')]=_[_0x6f15('0x41')](_0x1c2f6c[_0x6f15('0x40')]);_0x216073[_0x6f15('0x42')]=_['intersection'](_0x216073['model'],_0x216073['query']);_0x2dbcd4['attributes']=_[_0x6f15('0x43')](_0x216073[_0x6f15('0x3f')],qs[_0x6f15('0x44')](_0x1c2f6c[_0x6f15('0x40')][_0x6f15('0x44')]));_0x2dbcd4['attributes']=_0x2dbcd4[_0x6f15('0x45')]['length']?_0x2dbcd4[_0x6f15('0x45')]:_0x216073[_0x6f15('0x3f')];if(!_0x1c2f6c[_0x6f15('0x40')][_0x6f15('0x46')](_0x6f15('0x47'))){_0x2dbcd4[_0x6f15('0x2f')]=qs[_0x6f15('0x2f')](_0x1c2f6c['query'][_0x6f15('0x2f')]);_0x2dbcd4[_0x6f15('0x48')]=qs[_0x6f15('0x48')](_0x1c2f6c[_0x6f15('0x40')]['offset']);}_0x2dbcd4[_0x6f15('0x49')]=qs[_0x6f15('0x4a')](_0x1c2f6c['query'][_0x6f15('0x4a')]);_0x2dbcd4[_0x6f15('0x4b')]=qs[_0x6f15('0x42')](_[_0x6f15('0x4c')](_0x1c2f6c[_0x6f15('0x40')],_0x216073[_0x6f15('0x42')]),_0x2623d2);if(_0x1c2f6c[_0x6f15('0x40')][_0x6f15('0x4d')]){_0x2dbcd4[_0x6f15('0x4b')]=_['merge'](_0x2dbcd4[_0x6f15('0x4b')],{'$or':_[_0x6f15('0x3d')](_0x2623d2,function(_0x18b82f){if(_0x18b82f['type']!==_0x6f15('0x4e')){var _0x3a3329={};_0x3a3329[_0x18b82f[_0x6f15('0x3b')]]={'$like':'%'+_0x1c2f6c[_0x6f15('0x40')][_0x6f15('0x4d')]+'%'};return _0x3a3329;}})});}_0x2dbcd4=_[_0x6f15('0x4f')]({},_0x2dbcd4,_0x1c2f6c[_0x6f15('0x50')]);var _0x81370d={'where':_0x2dbcd4['where']};return db[_0x6f15('0x3e')][_0x6f15('0x31')](_0x81370d)[_0x6f15('0x38')](function(_0x538dd3){_0x4ceedc[_0x6f15('0x31')]=_0x538dd3;if(_0x1c2f6c['query']['includeAll']){_0x2dbcd4[_0x6f15('0x51')]=[{'all':!![]}];}return db[_0x6f15('0x3e')][_0x6f15('0x52')](_0x2dbcd4);})[_0x6f15('0x38')](function(_0x33de90){_0x4ceedc[_0x6f15('0x53')]=_0x33de90;return _0x4ceedc;})['then'](respondWithFilteredResult(_0x1561d6,_0x2dbcd4))['catch'](handleError(_0x1561d6,null));};exports[_0x6f15('0x54')]=function(_0x56df91,_0x5abe43){var _0x3bfe5b={'raw':!![],'where':{'id':_0x56df91[_0x6f15('0x55')]['id']}},_0x253553={};_0x253553['model']=_[_0x6f15('0x41')](db[_0x6f15('0x3e')][_0x6f15('0x56')]);_0x253553['query']=_[_0x6f15('0x41')](_0x56df91['query']);_0x253553[_0x6f15('0x42')]=_['intersection'](_0x253553['model'],_0x253553['query']);_0x3bfe5b['attributes']=_[_0x6f15('0x43')](_0x253553['model'],qs[_0x6f15('0x44')](_0x56df91['query'][_0x6f15('0x44')]));_0x3bfe5b[_0x6f15('0x45')]=_0x3bfe5b[_0x6f15('0x45')]['length']?_0x3bfe5b[_0x6f15('0x45')]:_0x253553[_0x6f15('0x3f')];if(_0x56df91[_0x6f15('0x40')][_0x6f15('0x57')]){_0x3bfe5b['include']=[{'all':!![]}];}_0x3bfe5b=_[_0x6f15('0x4f')]({},_0x3bfe5b,_0x56df91['options']);return db[_0x6f15('0x3e')][_0x6f15('0x58')](_0x3bfe5b)[_0x6f15('0x38')](handleEntityNotFound(_0x5abe43,null))[_0x6f15('0x38')](respondWithResult(_0x5abe43,null))['catch'](handleError(_0x5abe43,null));};exports[_0x6f15('0x59')]=function(_0xb87ed0,_0x596f34){return db[_0x6f15('0x3e')][_0x6f15('0x59')](_0xb87ed0[_0x6f15('0x5a')],{})[_0x6f15('0x38')](respondWithResult(_0x596f34,0xc9))['catch'](handleError(_0x596f34,null));};exports[_0x6f15('0x37')]=function(_0x2e71f4,_0x47eb7f){if(_0x2e71f4[_0x6f15('0x5a')]['id']){delete _0x2e71f4[_0x6f15('0x5a')]['id'];}return db[_0x6f15('0x3e')][_0x6f15('0x58')]({'where':{'id':_0x2e71f4[_0x6f15('0x55')]['id']}})[_0x6f15('0x38')](handleEntityNotFound(_0x47eb7f,null))[_0x6f15('0x38')](saveUpdates(_0x2e71f4[_0x6f15('0x5a')],null))[_0x6f15('0x38')](respondWithResult(_0x47eb7f,null))[_0x6f15('0x2a')](handleError(_0x47eb7f,null));};exports[_0x6f15('0x39')]=function(_0x2dad3a,_0x2df51b){return db[_0x6f15('0x3e')][_0x6f15('0x58')]({'where':{'id':_0x2dad3a[_0x6f15('0x55')]['id']}})[_0x6f15('0x38')](handleEntityNotFound(_0x2df51b,null))['then'](removeEntity(_0x2df51b,null))[_0x6f15('0x2a')](handleError(_0x2df51b,null));};exports[_0x6f15('0x5b')]=function(_0x4fa295,_0x217371){return db['SmsMessage'][_0x6f15('0x5b')]()[_0x6f15('0x38')](respondWithResult(_0x217371,null))['catch'](handleError(_0x217371,null));};var interaction_log=require(_0x6f15('0x12'))(_0x6f15('0x5c'));exports[_0x6f15('0x5d')]=function(_0x14610b,_0x2a4219,_0x7c4ed9){var _0x523798={'agent':{},'channel':'sms'};if(_0x14610b[_0x6f15('0x5a')]['id']){delete _0x14610b[_0x6f15('0x5a')]['id'];}_0x14610b['body']['read']=!![];_0x14610b[_0x6f15('0x5a')][_0x6f15('0x5e')]=moment()[_0x6f15('0x5f')](_0x6f15('0x60'));_0x14610b[_0x6f15('0x5a')]['UserId']=_0x14610b[_0x6f15('0x5a')][_0x6f15('0x61')]||_0x14610b['user']['id'];_0x523798[_0x6f15('0x62')]['id']=_0x14610b[_0x6f15('0x5a')][_0x6f15('0x61')];return db[_0x6f15('0x3e')][_0x6f15('0x58')]({'where':{'id':_0x14610b[_0x6f15('0x55')]['id'],'UserId':null}})[_0x6f15('0x38')](handleEntityNotFound(_0x2a4219,null))[_0x6f15('0x38')](saveUpdates(_0x14610b[_0x6f15('0x5a')],null))[_0x6f15('0x38')](function(_0x4f08d1){if(_0x4f08d1){_0x523798['message']=_0x4f08d1[_0x6f15('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x6f15('0x58')]({'where':{'id':_0x4f08d1[_0x6f15('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2a4219,null))[_0x6f15('0x38')](function(_0x71c91){if(_0x71c91){return _0x71c91[_0x6f15('0x37')]({'UserId':_0x14610b[_0x6f15('0x5a')]['UserId'],'read1stAt':_[_0x6f15('0x65')](_0x71c91[_0x6f15('0x66')])?moment()[_0x6f15('0x5f')](_0x6f15('0x60')):undefined});}return null;})[_0x6f15('0x38')](function(_0x5f51b9){if(_0x5f51b9){_0x523798[_0x6f15('0x67')]=_0x5f51b9[_0x6f15('0x63')]({'plain':!![]});interaction_log[_0x6f15('0x68')](_0x6f15('0x69'),_0x14610b[_0x6f15('0x6a')]['id'],_0x14610b[_0x6f15('0x6a')][_0x6f15('0x3b')],_0x14610b[_0x6f15('0x6a')][_0x6f15('0x6b')],_0x523798[_0x6f15('0x67')]['id'],_0x14610b['body']?JSON['stringify'](_0x14610b[_0x6f15('0x5a')]):_0x6f15('0x6c'));return respondWithRpcPromise(_0x6f15('0x6d'),_0x6f15('0x6e'),_0x523798);}return null;})[_0x6f15('0x38')](function(_0x11d7c0){var _0x1942c2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x11d7c0[_0x6f15('0x28')][_0x6f15('0x6f')];return db[_0x6f15('0x70')][_0x6f15('0x40')](_0x1942c2,{'type':db[_0x6f15('0x71')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6f15('0x38')](function(_0x1c20a9){return _0x1c20a9;});})[_0x6f15('0x38')](function(_0x17b307){if(_0x17b307){_0x523798[_0x6f15('0x28')]['contact']=_0x17b307[0x0];if(!_0x14610b['body'][_0x6f15('0x61')])return;return db[_0x6f15('0x72')][_0x6f15('0x58')]({'where':{'id':_0x14610b[_0x6f15('0x5a')][_0x6f15('0x61')],'role':_0x6f15('0x62')},'attributes':['id',_0x6f15('0x3b'),_0x6f15('0x73'),_0x6f15('0x74'),_0x6f15('0x75')],'raw':!![]});}return null;})['then'](function(_0xd3baac){if(!_0xd3baac)return null;_0x523798[_0x6f15('0x28')][_0x6f15('0x62')]=_0xd3baac;return _0x523798;})[_0x6f15('0x38')](function(_0x37e62d){if(_0x37e62d){if(_0x14610b[_0x6f15('0x5a')][_0x6f15('0x76')]){_0x523798['message']['interface']=util['format'](_0x6f15('0x77'),_0x14610b[_0x6f15('0x6a')][_0x6f15('0x3b')]);_0x523798[_0x6f15('0x28')][_0x6f15('0x78')]=_0x523798['channel'];_0x523798[_0x6f15('0x28')][_0x6f15('0x79')]=_0x523798[_0x6f15('0x78')];_0x523798[_0x6f15('0x28')]['event']=_0x6f15('0x5d');return respondWithRpcPromise(_0x6f15('0x7a'),_0x6f15('0x7a'),{'event':_0x6f15('0x7b'),'message':_0x523798[_0x6f15('0x28')]},client9002)[_0x6f15('0x38')](function(){return _0x523798;});}return _0x523798;}return null;})[_0x6f15('0x38')](respondWithResult(_0x2a4219,null))['catch'](handleError(_0x2a4219,null));};var interaction_log=require(_0x6f15('0x12'))(_0x6f15('0x5c'));exports['reject']=function(_0x350162,_0x71854e,_0x3e1f68){var _0x59a7f6={'agent':{},'channel':_0x6f15('0x7c')};if(_0x350162[_0x6f15('0x5a')]['id']){delete _0x350162['body']['id'];}_0x350162[_0x6f15('0x5a')]['UserId']=_0x350162[_0x6f15('0x5a')][_0x6f15('0x61')]||_0x350162[_0x6f15('0x6a')]['id'];_0x59a7f6['agent']['id']=_0x350162[_0x6f15('0x5a')][_0x6f15('0x61')];return db['SmsMessage'][_0x6f15('0x58')]({'where':{'id':_0x350162[_0x6f15('0x55')]['id'],'UserId':null}})[_0x6f15('0x38')](handleEntityNotFound(_0x71854e,null))[_0x6f15('0x38')](function(_0x1bdb7c){if(_0x1bdb7c){_0x59a7f6[_0x6f15('0x28')]=_0x1bdb7c[_0x6f15('0x63')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x1bdb7c[_0x6f15('0x64')]}});}return null;})[_0x6f15('0x38')](handleEntityNotFound(_0x71854e,null))[_0x6f15('0x38')](function(_0x3a200f){if(_0x3a200f){_0x59a7f6[_0x6f15('0x67')]=_0x3a200f[_0x6f15('0x63')]({'plain':!![]});interaction_log[_0x6f15('0x68')](_0x6f15('0x7d'),_0x350162[_0x6f15('0x6a')]['id'],_0x350162[_0x6f15('0x6a')][_0x6f15('0x3b')],_0x350162[_0x6f15('0x6a')][_0x6f15('0x6b')],_0x59a7f6[_0x6f15('0x67')]['id'],_0x350162['body']?JSON[_0x6f15('0x7e')](_0x350162['body']):_0x6f15('0x6c'));return respondWithRpcPromise(_0x6f15('0x7f'),_0x6f15('0x80'),_0x59a7f6);}return null;})[_0x6f15('0x38')](function(_0x2dade8){var _0x2135f4=_0x6f15('0x81')+_0x2dade8['message'][_0x6f15('0x6f')];return db['sequelize'][_0x6f15('0x40')](_0x2135f4,{'type':db[_0x6f15('0x71')][_0x6f15('0x82')][_0x6f15('0x83')],'raw':!![]})['then'](function(_0x4cd6f6){return _0x4cd6f6;});})['then'](function(_0x33dc78){if(_0x33dc78){_0x59a7f6['message'][_0x6f15('0x84')]=_0x33dc78[0x0];if(!_0x350162[_0x6f15('0x5a')]['UserId'])return;return db[_0x6f15('0x72')][_0x6f15('0x58')]({'where':{'id':_0x350162[_0x6f15('0x5a')][_0x6f15('0x61')],'role':_0x6f15('0x62')},'attributes':['id',_0x6f15('0x3b'),_0x6f15('0x73'),'email',_0x6f15('0x75')],'raw':!![]});}return null;})[_0x6f15('0x38')](function(_0x158651){if(!_0x158651)return null;_0x59a7f6['message'][_0x6f15('0x62')]=_0x158651;return _0x59a7f6;})[_0x6f15('0x38')](function(_0x19618c){if(_0x19618c){_0x19618c[_0x6f15('0x28')][_0x6f15('0x85')]=util[_0x6f15('0x5f')](_0x6f15('0x77'),_0x350162[_0x6f15('0x6a')][_0x6f15('0x3b')]);_0x19618c[_0x6f15('0x28')]['channel']=_0x59a7f6[_0x6f15('0x78')];_0x19618c[_0x6f15('0x28')][_0x6f15('0x79')]=_0x59a7f6[_0x6f15('0x78')];_0x19618c['message'][_0x6f15('0x86')]=_0x6f15('0x35');respondWithRpcPromise(_0x6f15('0x7a'),_0x6f15('0x7a'),{'event':_0x6f15('0x87'),'message':_0x19618c['message']},client9002);return _0x59a7f6;}return null;})[_0x6f15('0x38')](respondWithResult(_0x71854e,null))[_0x6f15('0x2a')](handleError(_0x71854e,null));};exports[_0x6f15('0x2c')]=function(_0x1ba6a7,_0x5443a4,_0x49b852){if(_0x1ba6a7[_0x6f15('0x5a')]['id']){delete _0x1ba6a7[_0x6f15('0x5a')]['id'];}var _0x41ca9b;return db['SmsMessage'][_0x6f15('0x58')]({'where':{'id':_0x1ba6a7['params']['id']}})['then'](handleEntityNotFound(_0x5443a4,null))['then'](function(_0x236005){if(_0x236005){_0x41ca9b=_0x236005;return db[_0x6f15('0x88')]['find']({'where':{'id':_0x236005[_0x6f15('0x89')]}});}})[_0x6f15('0x38')](handleEntityNotFound(_0x5443a4,null))[_0x6f15('0x38')](function(_0x363bfb){if(_0x363bfb){logger[_0x6f15('0x24')](_0x6f15('0x25'),'status',_0x6f15('0x8a'),_0x363bfb[_0x6f15('0x8b')],util[_0x6f15('0x8c')](_0x1ba6a7[_0x6f15('0x5a')],{'showHidden':![],'depth':null}));switch(_0x363bfb[_0x6f15('0x8b')]){case _0x6f15('0x8d'):if(_0x1ba6a7[_0x6f15('0x5a')][_0x6f15('0x8e')]&&_0x1ba6a7[_0x6f15('0x5a')][_0x6f15('0x8e')]===_0x41ca9b[_0x6f15('0x8f')]){return _0x41ca9b[_0x6f15('0x37')]({'read':!![]});}else{logger[_0x6f15('0x26')](_0x6f15('0x90'),_0x6f15('0x2c'),_0x6f15('0x8d'),util['inspect'](_0x1ba6a7[_0x6f15('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6f15('0x91'):if(_0x1ba6a7['body']['MessageUUID']&&_0x1ba6a7[_0x6f15('0x5a')]['MessageUUID']===_0x41ca9b[_0x6f15('0x8f')]&&_[_0x6f15('0x92')]([_0x6f15('0x93'),_0x6f15('0x94')],_0x1ba6a7[_0x6f15('0x5a')]['Status'])>=0x0){return _0x41ca9b[_0x6f15('0x37')]({'read':!![]});}else{logger[_0x6f15('0x26')](_0x6f15('0x90'),'status',_0x6f15('0x95'),util[_0x6f15('0x8c')](_0x1ba6a7[_0x6f15('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6f15('0x96'):var _0x2bbefa=_0x1ba6a7[_0x6f15('0x5a')][_0x6f15('0x97')][0x0];if(_0x2bbefa[_0x6f15('0x2c')][_0x6f15('0x98')]===_0x6f15('0x99')){return _0x41ca9b['update']({'read':!![]});}else{logger[_0x6f15('0x26')](_0x6f15('0x90'),_0x6f15('0x2c'),_0x6f15('0x96'),util['inspect'](_0x1ba6a7[_0x6f15('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x41ca9b;}})['then'](respondWithResult(_0x5443a4,null))[_0x6f15('0x2a')](handleError(_0x5443a4,null));}; \ No newline at end of file +var _0xe458=['params','create','body','find','../../config/logger','sms-interactions','accept','sms','read','readAt','UserId','agent','SmsInteraction','SmsInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','motionChannel','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','Content-Range','apply','reject','save','update','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xe458,0x160));var _0x8e45=function(_0x416869,_0x1d9f5e){_0x416869=_0x416869-0x0;var _0x4e5808=_0xe458[_0x416869];return _0x4e5808;};'use strict';var emlformat=require(_0x8e45('0x0'));var rimraf=require(_0x8e45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e45('0x2'));var rp=require(_0x8e45('0x3'));var moment=require(_0x8e45('0x4'));var BPromise=require(_0x8e45('0x5'));var Mustache=require(_0x8e45('0x6'));var util=require(_0x8e45('0x7'));var path=require(_0x8e45('0x8'));var sox=require(_0x8e45('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e45('0xa'));var _=require(_0x8e45('0xb'));var squel=require(_0x8e45('0xc'));var crypto=require(_0x8e45('0xd'));var jsforce=require(_0x8e45('0xe'));var deskjs=require(_0x8e45('0xf'));var toCsv=require(_0x8e45('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8e45('0x11'));var as=require(_0x8e45('0x12'));var hardwareService=require(_0x8e45('0x13'));var logger=require('../../config/logger')(_0x8e45('0x14'));var utils=require(_0x8e45('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8e45('0x16'));var db=require(_0x8e45('0x17'))['db'];config['redis']=_[_0x8e45('0x18')](config[_0x8e45('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e45('0x1a'))(new Redis(config[_0x8e45('0x19')]));require(_0x8e45('0x1b'))['register'](socket);var jayson=require(_0x8e45('0x1c'));var client=jayson[_0x8e45('0x1d')][_0x8e45('0x1e')]({'port':0x232c});var client9002=jayson[_0x8e45('0x1d')][_0x8e45('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x368526,_0x46a39b,_0x2e1eeb,_0x1cc1d8){return new BPromise(function(_0x23071d,_0x3e8be2){var _0x1bbcec=_0x1cc1d8||client;return _0x1bbcec[_0x8e45('0x1f')](_0x368526,_0x2e1eeb)[_0x8e45('0x20')](function(_0x88e7e3){logger[_0x8e45('0x21')](_0x8e45('0x22'),_0x46a39b,'request\x20sent');logger[_0x8e45('0x23')](_0x8e45('0x24'),_0x46a39b,_0x8e45('0x25'),JSON[_0x8e45('0x26')](_0x88e7e3));if(_0x88e7e3[_0x8e45('0x27')]){if(_0x88e7e3['error'][_0x8e45('0x28')]===0x1f4){logger[_0x8e45('0x27')](_0x8e45('0x22'),_0x46a39b,_0x88e7e3[_0x8e45('0x27')]['message']);return _0x3e8be2(_0x88e7e3[_0x8e45('0x27')]['message']);}logger[_0x8e45('0x27')](_0x8e45('0x22'),_0x46a39b,_0x88e7e3[_0x8e45('0x27')][_0x8e45('0x29')]);return _0x23071d(_0x88e7e3[_0x8e45('0x27')][_0x8e45('0x29')]);}else{logger[_0x8e45('0x21')](_0x8e45('0x22'),_0x46a39b,_0x8e45('0x25'));_0x23071d(_0x88e7e3[_0x8e45('0x2a')][_0x8e45('0x29')]);}})[_0x8e45('0x2b')](function(_0x224695){logger['error'](_0x8e45('0x22'),_0x46a39b,_0x224695);_0x3e8be2(_0x224695);});});}function respondWithStatusCode(_0x1fbc5b,_0x46f919){_0x46f919=_0x46f919||0xcc;return function(_0x2afbb4){if(_0x2afbb4){return _0x1fbc5b[_0x8e45('0x2c')](_0x46f919);}return _0x1fbc5b[_0x8e45('0x2d')](_0x46f919)[_0x8e45('0x2e')]();};}function respondWithResult(_0x236834,_0x3be24d){_0x3be24d=_0x3be24d||0xc8;return function(_0x581892){if(_0x581892){return _0x236834[_0x8e45('0x2d')](_0x3be24d)['json'](_0x581892);}};}function respondWithFilteredResult(_0xb0295d,_0x30b004){return function(_0x4e9f5c){if(_0x4e9f5c){var _0x185021=typeof _0x30b004[_0x8e45('0x2f')]===_0x8e45('0x30')&&typeof _0x30b004[_0x8e45('0x31')]===_0x8e45('0x30');var _0x16986f=_0x4e9f5c['count'];var _0x330cba=_0x185021?0x0:_0x30b004[_0x8e45('0x2f')];var _0x572a98=_0x185021?_0x4e9f5c['count']:_0x30b004[_0x8e45('0x2f')]+_0x30b004['limit'];var _0x59de90;if(_0x572a98>=_0x16986f){_0x572a98=_0x16986f;_0x59de90=0xc8;}else{_0x59de90=0xce;}_0xb0295d['status'](_0x59de90);return _0xb0295d['set'](_0x8e45('0x32'),_0x330cba+'-'+_0x572a98+'/'+_0x16986f)['json'](_0x4e9f5c);}return null;};}function patchUpdates(_0x2d1a3d){return function(_0x35214c){try{jsonpatch[_0x8e45('0x33')](_0x35214c,_0x2d1a3d,!![]);}catch(_0x453f71){return BPromise[_0x8e45('0x34')](_0x453f71);}return _0x35214c[_0x8e45('0x35')]();};}function saveUpdates(_0x361bbb,_0x3c9125){return function(_0x38a531){if(_0x38a531){return _0x38a531[_0x8e45('0x36')](_0x361bbb)[_0x8e45('0x20')](function(_0x4790b2){return _0x4790b2;});}return null;};}function removeEntity(_0x172266,_0x3e9924){return function(_0x1d5aa0){if(_0x1d5aa0){return _0x1d5aa0['destroy']()[_0x8e45('0x20')](function(){_0x172266[_0x8e45('0x2d')](0xcc)[_0x8e45('0x2e')]();});}};}function handleEntityNotFound(_0xfdf28d,_0x1f5529){return function(_0x329eab){if(!_0x329eab){_0xfdf28d[_0x8e45('0x2c')](0x194);}return _0x329eab;};}function handleError(_0x30943a,_0x3f3be7){_0x3f3be7=_0x3f3be7||0x1f4;return function(_0x4c32e9){logger['error'](_0x4c32e9[_0x8e45('0x37')]);if(_0x4c32e9[_0x8e45('0x38')]){delete _0x4c32e9[_0x8e45('0x38')];}_0x30943a['status'](_0x3f3be7)['send'](_0x4c32e9);};}exports[_0x8e45('0x39')]=function(_0x26290b,_0x18c62f){var _0x2ea817={},_0x1b0940={},_0xb5fcbf={'count':0x0,'rows':[]};var _0x398cad=_[_0x8e45('0x3a')](db[_0x8e45('0x3b')][_0x8e45('0x3c')],function(_0x1c0503){return{'name':_0x1c0503[_0x8e45('0x3d')],'type':_0x1c0503[_0x8e45('0x3e')][_0x8e45('0x3f')]};});_0x1b0940[_0x8e45('0x40')]=_[_0x8e45('0x3a')](_0x398cad,_0x8e45('0x38'));_0x1b0940['query']=_[_0x8e45('0x41')](_0x26290b['query']);_0x1b0940[_0x8e45('0x42')]=_[_0x8e45('0x43')](_0x1b0940[_0x8e45('0x40')],_0x1b0940[_0x8e45('0x44')]);_0x2ea817[_0x8e45('0x45')]=_[_0x8e45('0x43')](_0x1b0940['model'],qs[_0x8e45('0x46')](_0x26290b[_0x8e45('0x44')]['fields']));_0x2ea817[_0x8e45('0x45')]=_0x2ea817[_0x8e45('0x45')][_0x8e45('0x47')]?_0x2ea817[_0x8e45('0x45')]:_0x1b0940[_0x8e45('0x40')];if(!_0x26290b[_0x8e45('0x44')]['hasOwnProperty'](_0x8e45('0x48'))){_0x2ea817[_0x8e45('0x31')]=qs[_0x8e45('0x31')](_0x26290b[_0x8e45('0x44')][_0x8e45('0x31')]);_0x2ea817[_0x8e45('0x2f')]=qs['offset'](_0x26290b[_0x8e45('0x44')][_0x8e45('0x2f')]);}_0x2ea817[_0x8e45('0x49')]=qs[_0x8e45('0x4a')](_0x26290b[_0x8e45('0x44')][_0x8e45('0x4a')]);_0x2ea817[_0x8e45('0x4b')]=qs[_0x8e45('0x42')](_[_0x8e45('0x4c')](_0x26290b[_0x8e45('0x44')],_0x1b0940[_0x8e45('0x42')]),_0x398cad);if(_0x26290b[_0x8e45('0x44')][_0x8e45('0x4d')]){_0x2ea817[_0x8e45('0x4b')]=_[_0x8e45('0x4e')](_0x2ea817[_0x8e45('0x4b')],{'$or':_[_0x8e45('0x3a')](_0x398cad,function(_0x248245){if(_0x248245[_0x8e45('0x3e')]!==_0x8e45('0x4f')){var _0x26a281={};_0x26a281[_0x248245['name']]={'$like':'%'+_0x26290b[_0x8e45('0x44')]['filter']+'%'};return _0x26a281;}})});}_0x2ea817=_[_0x8e45('0x4e')]({},_0x2ea817,_0x26290b['options']);var _0x2f07df={'where':_0x2ea817[_0x8e45('0x4b')]};return db[_0x8e45('0x3b')][_0x8e45('0x50')](_0x2f07df)[_0x8e45('0x20')](function(_0x2b99d9){_0xb5fcbf[_0x8e45('0x50')]=_0x2b99d9;if(_0x26290b[_0x8e45('0x44')][_0x8e45('0x51')]){_0x2ea817[_0x8e45('0x52')]=[{'all':!![]}];}return db[_0x8e45('0x3b')][_0x8e45('0x53')](_0x2ea817);})[_0x8e45('0x20')](function(_0x48e896){_0xb5fcbf[_0x8e45('0x54')]=_0x48e896;return _0xb5fcbf;})[_0x8e45('0x20')](respondWithFilteredResult(_0x18c62f,_0x2ea817))['catch'](handleError(_0x18c62f,null));};exports[_0x8e45('0x55')]=function(_0x514aed,_0x4bf793){var _0x25d1aa={'raw':!![],'where':{'id':_0x514aed[_0x8e45('0x56')]['id']}},_0x55f30b={};_0x55f30b['model']=_[_0x8e45('0x41')](db[_0x8e45('0x3b')][_0x8e45('0x3c')]);_0x55f30b[_0x8e45('0x44')]=_['keys'](_0x514aed['query']);_0x55f30b[_0x8e45('0x42')]=_[_0x8e45('0x43')](_0x55f30b['model'],_0x55f30b[_0x8e45('0x44')]);_0x25d1aa[_0x8e45('0x45')]=_[_0x8e45('0x43')](_0x55f30b['model'],qs[_0x8e45('0x46')](_0x514aed[_0x8e45('0x44')]['fields']));_0x25d1aa[_0x8e45('0x45')]=_0x25d1aa[_0x8e45('0x45')][_0x8e45('0x47')]?_0x25d1aa[_0x8e45('0x45')]:_0x55f30b['model'];if(_0x514aed[_0x8e45('0x44')][_0x8e45('0x51')]){_0x25d1aa[_0x8e45('0x52')]=[{'all':!![]}];}_0x25d1aa=_['merge']({},_0x25d1aa,_0x514aed['options']);return db[_0x8e45('0x3b')]['find'](_0x25d1aa)['then'](handleEntityNotFound(_0x4bf793,null))[_0x8e45('0x20')](respondWithResult(_0x4bf793,null))['catch'](handleError(_0x4bf793,null));};exports[_0x8e45('0x57')]=function(_0x8f876a,_0x1a2683){return db['SmsMessage'][_0x8e45('0x57')](_0x8f876a[_0x8e45('0x58')],{})[_0x8e45('0x20')](respondWithResult(_0x1a2683,0xc9))[_0x8e45('0x2b')](handleError(_0x1a2683,null));};exports['update']=function(_0x454344,_0x2e3068){if(_0x454344[_0x8e45('0x58')]['id']){delete _0x454344[_0x8e45('0x58')]['id'];}return db[_0x8e45('0x3b')][_0x8e45('0x59')]({'where':{'id':_0x454344[_0x8e45('0x56')]['id']}})['then'](handleEntityNotFound(_0x2e3068,null))[_0x8e45('0x20')](saveUpdates(_0x454344[_0x8e45('0x58')],null))['then'](respondWithResult(_0x2e3068,null))[_0x8e45('0x2b')](handleError(_0x2e3068,null));};exports['destroy']=function(_0x518b72,_0x589cbd){return db['SmsMessage'][_0x8e45('0x59')]({'where':{'id':_0x518b72[_0x8e45('0x56')]['id']}})[_0x8e45('0x20')](handleEntityNotFound(_0x589cbd,null))['then'](removeEntity(_0x589cbd,null))[_0x8e45('0x2b')](handleError(_0x589cbd,null));};exports['describe']=function(_0x57ed43,_0x1b9161){return db[_0x8e45('0x3b')]['describe']()[_0x8e45('0x20')](respondWithResult(_0x1b9161,null))[_0x8e45('0x2b')](handleError(_0x1b9161,null));};var interaction_log=require(_0x8e45('0x5a'))(_0x8e45('0x5b'));exports[_0x8e45('0x5c')]=function(_0x244315,_0x5ef3f9,_0x55d640){var _0x3a73d5={'agent':{},'channel':_0x8e45('0x5d')};if(_0x244315[_0x8e45('0x58')]['id']){delete _0x244315['body']['id'];}_0x244315[_0x8e45('0x58')][_0x8e45('0x5e')]=!![];_0x244315[_0x8e45('0x58')][_0x8e45('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x244315[_0x8e45('0x58')][_0x8e45('0x60')]=_0x244315[_0x8e45('0x58')][_0x8e45('0x60')]||_0x244315['user']['id'];_0x3a73d5[_0x8e45('0x61')]['id']=_0x244315[_0x8e45('0x58')][_0x8e45('0x60')];return db[_0x8e45('0x3b')][_0x8e45('0x59')]({'where':{'id':_0x244315[_0x8e45('0x56')]['id'],'UserId':null}})[_0x8e45('0x20')](handleEntityNotFound(_0x5ef3f9,null))['then'](saveUpdates(_0x244315[_0x8e45('0x58')],null))[_0x8e45('0x20')](function(_0x251ad2){if(_0x251ad2){_0x3a73d5[_0x8e45('0x29')]=_0x251ad2['get']({'plain':!![]});return db[_0x8e45('0x62')]['find']({'where':{'id':_0x251ad2[_0x8e45('0x63')]}});}return null;})[_0x8e45('0x20')](handleEntityNotFound(_0x5ef3f9,null))[_0x8e45('0x20')](function(_0x96f789){if(_0x96f789){return _0x96f789[_0x8e45('0x36')]({'UserId':_0x244315[_0x8e45('0x58')][_0x8e45('0x60')],'read1stAt':_[_0x8e45('0x64')](_0x96f789['read1stAt'])?moment()[_0x8e45('0x65')](_0x8e45('0x66')):undefined});}return null;})[_0x8e45('0x20')](function(_0x4f9587){if(_0x4f9587){_0x3a73d5[_0x8e45('0x67')]=_0x4f9587['get']({'plain':!![]});interaction_log[_0x8e45('0x21')](_0x8e45('0x68'),_0x244315['user']['id'],_0x244315['user'][_0x8e45('0x38')],_0x244315[_0x8e45('0x69')][_0x8e45('0x6a')],_0x3a73d5['interaction']['id'],_0x244315[_0x8e45('0x58')]?JSON[_0x8e45('0x26')](_0x244315[_0x8e45('0x58')]):_0x8e45('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3a73d5);}return null;})[_0x8e45('0x20')](function(_0x3a3ea1){var _0x5a7210='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a3ea1[_0x8e45('0x29')]['ContactId'];return db['sequelize'][_0x8e45('0x44')](_0x5a7210,{'type':db['Sequelize'][_0x8e45('0x6c')]['SELECT'],'raw':!![]})[_0x8e45('0x20')](function(_0x175c79){return _0x175c79;});})['then'](function(_0x4b2379){if(_0x4b2379){_0x3a73d5['message'][_0x8e45('0x6d')]=_0x4b2379[0x0];if(!_0x244315[_0x8e45('0x58')][_0x8e45('0x60')])return;return db[_0x8e45('0x6e')][_0x8e45('0x59')]({'where':{'id':_0x244315[_0x8e45('0x58')]['UserId'],'role':_0x8e45('0x61')},'attributes':['id',_0x8e45('0x38'),_0x8e45('0x6f'),_0x8e45('0x70'),_0x8e45('0x71')],'raw':!![]});}return null;})[_0x8e45('0x20')](function(_0xe986d0){if(!_0xe986d0)return null;_0x3a73d5[_0x8e45('0x29')][_0x8e45('0x61')]=_0xe986d0;return _0x3a73d5;})[_0x8e45('0x20')](function(_0x1e3488){if(_0x1e3488){if(_0x244315[_0x8e45('0x58')]['manual']){_0x3a73d5[_0x8e45('0x29')][_0x8e45('0x72')]=util[_0x8e45('0x65')](_0x8e45('0x73'),_0x244315[_0x8e45('0x69')][_0x8e45('0x38')]);_0x3a73d5['message']['channel']=_0x3a73d5[_0x8e45('0x74')];_0x3a73d5[_0x8e45('0x29')]['motionChannel']=_0x3a73d5['channel'];_0x3a73d5[_0x8e45('0x29')][_0x8e45('0x75')]=_0x8e45('0x5c');return respondWithRpcPromise('EventManager',_0x8e45('0x76'),{'event':_0x8e45('0x77'),'message':_0x3a73d5[_0x8e45('0x29')]},client9002)[_0x8e45('0x20')](function(){return _0x3a73d5;});}return _0x3a73d5;}return null;})[_0x8e45('0x20')](respondWithResult(_0x5ef3f9,null))['catch'](handleError(_0x5ef3f9,null));};var interaction_log=require('../../config/logger')(_0x8e45('0x5b'));exports[_0x8e45('0x34')]=function(_0xead9d,_0x6b5179,_0x4b1b30){var _0x5bc62d={'agent':{},'channel':_0x8e45('0x5d')};if(_0xead9d[_0x8e45('0x58')]['id']){delete _0xead9d[_0x8e45('0x58')]['id'];}_0xead9d[_0x8e45('0x58')][_0x8e45('0x60')]=_0xead9d['body'][_0x8e45('0x60')]||_0xead9d[_0x8e45('0x69')]['id'];_0x5bc62d[_0x8e45('0x61')]['id']=_0xead9d[_0x8e45('0x58')][_0x8e45('0x60')];return db[_0x8e45('0x3b')][_0x8e45('0x59')]({'where':{'id':_0xead9d['params']['id'],'UserId':null}})[_0x8e45('0x20')](handleEntityNotFound(_0x6b5179,null))[_0x8e45('0x20')](function(_0x223506){if(_0x223506){_0x5bc62d[_0x8e45('0x29')]=_0x223506['get']({'plain':!![]});return db[_0x8e45('0x62')][_0x8e45('0x59')]({'where':{'id':_0x223506['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x6b5179,null))[_0x8e45('0x20')](function(_0x435cde){if(_0x435cde){_0x5bc62d['interaction']=_0x435cde[_0x8e45('0x78')]({'plain':!![]});interaction_log[_0x8e45('0x21')](_0x8e45('0x79'),_0xead9d[_0x8e45('0x69')]['id'],_0xead9d[_0x8e45('0x69')]['name'],_0xead9d[_0x8e45('0x69')][_0x8e45('0x6a')],_0x5bc62d['interaction']['id'],_0xead9d['body']?JSON[_0x8e45('0x26')](_0xead9d['body']):_0x8e45('0x6b'));return respondWithRpcPromise(_0x8e45('0x7a'),'rejectMessage',_0x5bc62d);}return null;})[_0x8e45('0x20')](function(_0x219c8d){var _0x525238=_0x8e45('0x7b')+_0x219c8d[_0x8e45('0x29')][_0x8e45('0x7c')];return db[_0x8e45('0x7d')]['query'](_0x525238,{'type':db[_0x8e45('0x7e')][_0x8e45('0x6c')][_0x8e45('0x7f')],'raw':!![]})[_0x8e45('0x20')](function(_0x23c918){return _0x23c918;});})['then'](function(_0xc8aa73){if(_0xc8aa73){_0x5bc62d[_0x8e45('0x29')]['contact']=_0xc8aa73[0x0];if(!_0xead9d['body'][_0x8e45('0x60')])return;return db[_0x8e45('0x6e')][_0x8e45('0x59')]({'where':{'id':_0xead9d['body'][_0x8e45('0x60')],'role':'agent'},'attributes':['id',_0x8e45('0x38'),_0x8e45('0x6f'),_0x8e45('0x70'),_0x8e45('0x71')],'raw':!![]});}return null;})[_0x8e45('0x20')](function(_0x4fc409){if(!_0x4fc409)return null;_0x5bc62d['message'][_0x8e45('0x61')]=_0x4fc409;return _0x5bc62d;})[_0x8e45('0x20')](function(_0x836fd1){if(_0x836fd1){_0x836fd1[_0x8e45('0x29')][_0x8e45('0x72')]=util['format'](_0x8e45('0x73'),_0xead9d['user']['name']);_0x836fd1['message'][_0x8e45('0x74')]=_0x5bc62d['channel'];_0x836fd1[_0x8e45('0x29')][_0x8e45('0x80')]=_0x5bc62d['channel'];_0x836fd1[_0x8e45('0x29')][_0x8e45('0x75')]=_0x8e45('0x34');respondWithRpcPromise(_0x8e45('0x76'),_0x8e45('0x76'),{'event':_0x8e45('0x81'),'message':_0x836fd1[_0x8e45('0x29')]},client9002);return _0x5bc62d;}return null;})[_0x8e45('0x20')](respondWithResult(_0x6b5179,null))[_0x8e45('0x2b')](handleError(_0x6b5179,null));};exports['status']=function(_0x47702e,_0x4ac1ee,_0x1f0cfe){if(_0x47702e[_0x8e45('0x58')]['id']){delete _0x47702e['body']['id'];}var _0x3595e1;return db['SmsMessage'][_0x8e45('0x59')]({'where':{'id':_0x47702e[_0x8e45('0x56')]['id']}})[_0x8e45('0x20')](handleEntityNotFound(_0x4ac1ee,null))[_0x8e45('0x20')](function(_0x39d3ba){if(_0x39d3ba){_0x3595e1=_0x39d3ba;return db['SmsAccount'][_0x8e45('0x59')]({'where':{'id':_0x39d3ba[_0x8e45('0x82')]}});}})[_0x8e45('0x20')](handleEntityNotFound(_0x4ac1ee,null))[_0x8e45('0x20')](function(_0x4b2ce1){if(_0x4b2ce1){logger[_0x8e45('0x23')](_0x8e45('0x24'),_0x8e45('0x2d'),_0x8e45('0x83'),_0x4b2ce1['type'],util[_0x8e45('0x84')](_0x47702e[_0x8e45('0x58')],{'showHidden':![],'depth':null}));switch(_0x4b2ce1[_0x8e45('0x3e')]){case _0x8e45('0x85'):if(_0x47702e[_0x8e45('0x58')]['MessageSid']&&_0x47702e[_0x8e45('0x58')][_0x8e45('0x86')]===_0x3595e1[_0x8e45('0x87')]){return _0x3595e1[_0x8e45('0x36')]({'read':!![]});}else{logger[_0x8e45('0x27')](_0x8e45('0x88'),_0x8e45('0x2d'),_0x8e45('0x85'),util[_0x8e45('0x84')](_0x47702e['body'],{'showHidden':![],'depth':null}));}break;case _0x8e45('0x89'):if(_0x47702e[_0x8e45('0x58')][_0x8e45('0x8a')]&&_0x47702e[_0x8e45('0x58')][_0x8e45('0x8a')]===_0x3595e1[_0x8e45('0x87')]&&_[_0x8e45('0x8b')]([_0x8e45('0x8c'),_0x8e45('0x8d')],_0x47702e[_0x8e45('0x58')][_0x8e45('0x8e')])>=0x0){return _0x3595e1[_0x8e45('0x36')]({'read':!![]});}else{logger[_0x8e45('0x27')](_0x8e45('0x88'),_0x8e45('0x2d'),_0x8e45('0x8f'),util[_0x8e45('0x84')](_0x47702e['body'],{'showHidden':![],'depth':null}));}break;case _0x8e45('0x90'):var _0x6b5ada=_0x47702e[_0x8e45('0x58')]['results'][0x0];if(_0x6b5ada[_0x8e45('0x2d')][_0x8e45('0x91')]==='DELIVERED'){return _0x3595e1[_0x8e45('0x36')]({'read':!![]});}else{logger['error'](_0x8e45('0x88'),_0x8e45('0x2d'),_0x8e45('0x90'),util[_0x8e45('0x84')](_0x47702e[_0x8e45('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3595e1;}})['then'](respondWithResult(_0x4ac1ee,null))['catch'](handleError(_0x4ac1ee,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 9b8378d..c01be20 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 _0xf0a7=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf0a7,0xde));var _0x7f0a=function(_0xc83c25,_0x106681){_0xc83c25=_0xc83c25-0x0;var _0x5ed069=_0xf0a7[_0xc83c25];return _0x5ed069;};'use strict';var EventEmitter=require(_0x7f0a('0x0'));var SmsMessage=require(_0x7f0a('0x1'))['db'][_0x7f0a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7f0a('0x3')](0x0);var events={'afterCreate':_0x7f0a('0x4'),'afterUpdate':'update','afterDestroy':_0x7f0a('0x5')};function emitEvent(_0x2c1858){return function(_0x5a184c,_0x27c18c,_0x28a42a){SmsMessageEvents[_0x7f0a('0x6')](_0x2c1858+':'+_0x5a184c['id'],_0x5a184c);SmsMessageEvents[_0x7f0a('0x6')](_0x2c1858,_0x5a184c);_0x28a42a(null);};}for(var e in events){if(events[_0x7f0a('0x7')](e)){var event=events[e];SmsMessage[_0x7f0a('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xb88f=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xb88f,0x95));var _0xfb88=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0xb88f[_0x493a51];return _0xc85756;};'use strict';var EventEmitter=require(_0xfb88('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfb88('0x1')](0x0);var events={'afterCreate':_0xfb88('0x2'),'afterUpdate':'update','afterDestroy':_0xfb88('0x3')};function emitEvent(_0xbac74c){return function(_0x5798d2,_0x47b164,_0x18ee45){SmsMessageEvents[_0xfb88('0x4')](_0xbac74c+':'+_0x5798d2['id'],_0x5798d2);SmsMessageEvents[_0xfb88('0x4')](_0xbac74c,_0x5798d2);_0x18ee45(null);};}for(var e in events){if(events[_0xfb88('0x5')](e)){var event=events[e];SmsMessage[_0xfb88('0x6')](e,emitEvent(event));}}module[_0xfb88('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 a4b4a05..c1f1fba 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 _0x6721=['./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','remote','/api/sms/messages/','/status?token=','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','login?username=','GET','split','POST','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','base64','http_code','data','head','messages','message_id','clickSend','plivo','token','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','csc','crypto','apiKey','login','text','timestamp','length','createHash','md5','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','message','application/json','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2fd4e6,_0x160115){var _0x55ace5=function(_0x48cb6c){while(--_0x48cb6c){_0x2fd4e6['push'](_0x2fd4e6['shift']());}};_0x55ace5(++_0x160115);}(_0x6721,0xe1));var _0x1672=function(_0xc6601d,_0xf33e3e){_0xc6601d=_0xc6601d-0x0;var _0x14dba9=_0x6721[_0xc6601d];return _0x14dba9;};'use strict';var _=require(_0x1672('0x0'));var util=require(_0x1672('0x1'));var logger=require(_0x1672('0x2'))('api');var moment=require(_0x1672('0x3'));var BPromise=require(_0x1672('0x4'));var rp=require(_0x1672('0x5'));var fs=require('fs');var path=require(_0x1672('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1672('0x7'));module['exports']=function(_0x153ddd,_0x266f89){return _0x153ddd[_0x1672('0x8')]('SmsMessage',attributes,{'tableName':_0x1672('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1672('0xa')]},{'name':_0x1672('0xb'),'fields':[_0x1672('0xc')],'type':_0x1672('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4973d4,_0x502390,_0x3dc6d0){var _0x44926d=_0x153ddd['models'];var _0x482ba9=_0x4973d4['get']({'plain':!![]});if(_0x482ba9[_0x1672('0xe')]['toLowerCase']()==='in'||_0x482ba9[_0x1672('0xe')][_0x1672('0xf')]()===_0x1672('0x10')&&!_0x482ba9[_0x1672('0x11')]&&!_[_0x1672('0x12')](_0x482ba9[_0x1672('0x13')])&&!_[_0x1672('0x12')](_0x482ba9[_0x1672('0x14')])){_0x44926d[_0x1672('0x15')][_0x1672('0x16')]({'where':{'id':_0x482ba9[_0x1672('0x14')]}})[_0x1672('0x17')](function(_0x44b443){if(_0x44b443){_0x44b443['update']({'lastMsgAt':_0x482ba9[_0x1672('0x18')],'lastMsgDirection':_0x482ba9[_0x1672('0xe')][_0x1672('0xf')]()});}})['catch'](function(_0x1a2b22){console['error'](_0x1a2b22);});}if(_0x482ba9['direction']==='out'&&!_0x482ba9['secret']){var _0x11ae96;_0x44926d[_0x1672('0x19')][_0x1672('0x1a')]({'where':{'id':_0x482ba9[_0x1672('0x1b')]},'raw':!![]})[_0x1672('0x17')](function(_0x111626){_0x11ae96=_0x111626;if(_0x11ae96&&_0x11ae96[_0x1672('0x1c')]){switch(_0x11ae96[_0x1672('0x1c')]){case _0x1672('0x1d'):var _0x380477=require(_0x1672('0x1d'));if(_0x11ae96[_0x1672('0x1e')]&&_0x11ae96[_0x1672('0x1f')]&&_0x11ae96[_0x1672('0x20')]){var _0x182574=new _0x380477(_0x11ae96[_0x1672('0x1e')],_0x11ae96['authToken']);_0x182574['messages']['create']({'body':_0x482ba9[_0x1672('0xc')],'to':_0x482ba9[_0x1672('0x20')],'from':_0x11ae96[_0x1672('0x20')],'statusCallback':_0x11ae96[_0x1672('0x21')]+_0x1672('0x22')+_0x482ba9['id']+_0x1672('0x23')+_0x11ae96['token']})[_0x1672('0x17')](function(_0x1e8899){if(_0x1e8899[_0x1672('0x24')]){return _0x4973d4[_0x1672('0x25')]({'messageId':_0x1e8899[_0x1672('0x24')]});}})[_0x1672('0x26')](function(_0x4539c0){logger['error'](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x1d'),util[_0x1672('0x29')](_0x4539c0,{'showHidden':![],'depth':null}));});}else{logger[_0x1672('0x2a')](_0x1672('0x27'),'afterCreate',_0x1672('0x1d'),_0x1672('0x2b'));}break;case _0x1672('0x2c'):var _0x4d018c='https://api.skebby.it/API/v1.0/REST/';if(_0x11ae96[_0x1672('0x2d')]&&_0x11ae96[_0x1672('0x2e')]){var _0x564cc9={'recipient':[_0x482ba9[_0x1672('0x20')]],'message':_0x482ba9[_0x1672('0xc')],'message_type':_0x11ae96[_0x1672('0x2f')]};if(_0x11ae96[_0x1672('0x2f')]&&_0x11ae96['smsMethod']!=='SI'){_0x564cc9['sender']=_0x11ae96[_0x1672('0x20')];}var _0x225743={'url':_0x4d018c+_0x1672('0x30')+_0x11ae96[_0x1672('0x2d')]+'&password='+_0x11ae96[_0x1672('0x2e')],'method':_0x1672('0x31')};rp(_0x225743)[_0x1672('0x17')](function(_0x5547ef){var _0x1b434a=_0x5547ef[_0x1672('0x32')](';');var _0x1b6f28={'user_key':_0x1b434a[0x0],'session_key':_0x1b434a[0x1]};_0x225743={'url':_0x4d018c+'sms','method':_0x1672('0x33'),'headers':{'user_key':_0x1b6f28['user_key'],'Session_key':_0x1b6f28[_0x1672('0x34')]},'json':!![],'body':_0x564cc9};return rp(_0x225743);})[_0x1672('0x17')](function(_0x3c56e1){if(_0x3c56e1[_0x1672('0x35')]>=0x1){var _0x3f9a37={'messageId':_0x3c56e1['internal_order_id']};if(_0x11ae96['smsMethod']!=='GP'||!_0x11ae96[_0x1672('0x36')]){_0x3f9a37[_0x1672('0x37')]=!![];}return _0x4973d4[_0x1672('0x25')](_0x3f9a37);}else{return logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x2c'),util[_0x1672('0x29')](_0x3c56e1,{'showHidden':![],'depth':null}));}})[_0x1672('0x26')](function(_0x288ae3){return logger[_0x1672('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1672('0x28'),_0x1672('0x2c'),util[_0x1672('0x29')](_0x288ae3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x2c'),_0x1672('0x38'));}break;case'connectel':if(_0x11ae96[_0x1672('0x1f')]){var _0xd79ac2={'recipient':_0x482ba9[_0x1672('0x20')],'message':_0x482ba9[_0x1672('0xc')],'sender':_0x11ae96[_0x1672('0x39')]||_0x11ae96[_0x1672('0x20')],'authorization':_0x11ae96[_0x1672('0x1f')]};var _0x502390={'method':_0x1672('0x33'),'uri':_0x1672('0x3a'),'body':_0xd79ac2,'json':!![]};rp(_0x502390)[_0x1672('0x17')](function(_0x28e99a){var _0xd80773={'messageId':_0x28e99a[_0x1672('0x3b')]};if(!_0x11ae96['deliveryReport']){_0xd80773[_0x1672('0x37')]=!![];}return _0x4973d4[_0x1672('0x25')](_0xd80773);})[_0x1672('0x26')](function(_0x4096fe){logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x3c'),util[_0x1672('0x29')](_0x4096fe,{'showHidden':![],'depth':null}));});}else{logger[_0x1672('0x2a')](_0x1672('0x27'),'afterCreate','connectel',_0x1672('0x3d'));}break;case _0x1672('0x3e'):if(_0x11ae96[_0x1672('0x2d')]&&_0x11ae96[_0x1672('0x2e')]){var _0xd79ac2={'messages':[{'source':_0x1672('0x3f'),'to':_0x482ba9[_0x1672('0x20')],'body':_0x482ba9[_0x1672('0xc')],'from':_0x11ae96['senderString']||_0x11ae96[_0x1672('0x20')]}]};var _0x3e1f02=util['format'](_0x1672('0x40'),_0x11ae96[_0x1672('0x2d')],_0x11ae96[_0x1672('0x2e')]);var _0x502390={'method':_0x1672('0x33'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xd79ac2,'headers':{'Authorization':util[_0x1672('0x41')](_0x1672('0x42'),new Buffer(_0x3e1f02)[_0x1672('0x43')](_0x1672('0x44')))},'json':!![]};rp(_0x502390)['then'](function(_0x4d6b9f){if(_0x4d6b9f[_0x1672('0x45')]>=0xc8&&_0x4d6b9f['http_code']<=0xce){if(_0x4d6b9f[_0x1672('0x46')]&&_0x4d6b9f[_0x1672('0x46')]['queued_count']>0x0){var _0x16293b=_[_0x1672('0x47')](_0x4d6b9f[_0x1672('0x46')][_0x1672('0x48')]);var _0x54c3d2={'messageId':_0x16293b[_0x1672('0x49')]};if(!_0x11ae96[_0x1672('0x36')]){_0x54c3d2[_0x1672('0x37')]=!![];}return _0x4973d4[_0x1672('0x25')](_0x54c3d2);}else{logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x4a'),util[_0x1672('0x29')](_0x4d6b9f,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x1672('0x27'),'afterCreate',_0x1672('0x4a'),util[_0x1672('0x29')](_0x4d6b9f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x148ff6){logger['error'](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x4a'),util[_0x1672('0x29')](_0x148ff6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1672('0x27'),'afterCreate','clickSend',_0x1672('0x38'));}break;case _0x1672('0x4b'):if(_0x11ae96['authId']&&_0x11ae96['authToken']){var _0xd79ac2={'dst':_0x482ba9['phone'],'text':_0x482ba9[_0x1672('0xc')],'src':_0x11ae96[_0x1672('0x39')]||_0x11ae96[_0x1672('0x20')],'url':_0x11ae96[_0x1672('0x21')]+_0x1672('0x22')+_0x482ba9['id']+_0x1672('0x23')+_0x11ae96[_0x1672('0x4c')]};var _0x3e1f02=util[_0x1672('0x41')](_0x1672('0x40'),_0x11ae96[_0x1672('0x4d')],_0x11ae96[_0x1672('0x1f')]);var _0x502390={'method':_0x1672('0x33'),'uri':util[_0x1672('0x41')](_0x1672('0x4e'),_0x11ae96[_0x1672('0x4d')]),'body':_0xd79ac2,'headers':{'Authorization':util['format'](_0x1672('0x42'),new Buffer(_0x3e1f02)[_0x1672('0x43')]('base64'))},'json':!![]};rp(_0x502390)[_0x1672('0x17')](function(_0x21ebc3){var _0x5cf30a={'messageId':_0x21ebc3[_0x1672('0x4f')][0x0]};return _0x4973d4[_0x1672('0x25')](_0x5cf30a);})['catch'](function(_0x4694f2){logger[_0x1672('0x2a')](_0x1672('0x27'),'afterCreate',_0x1672('0x4b'),util[_0x1672('0x29')](_0x4694f2,{'showHidden':![],'depth':null}));});}else{logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x1672('0x50'):if(_0x11ae96['username']&&_0x11ae96[_0x1672('0x2e')]){if(_0x11ae96[_0x1672('0x51')]){var _0x13488c={'method':_0x1672('0x33'),'uri':_0x11ae96[_0x1672('0x51')]+_0x1672('0x52'),'body':{'username':_0x11ae96[_0x1672('0x2d')],'password':_0x11ae96[_0x1672('0x2e')]},'json':!![]};return rp(_0x13488c)[_0x1672('0x17')](function(_0x43b5f5){var _0x32eed1={'method':_0x1672('0x33'),'uri':_0x11ae96[_0x1672('0x51')]+_0x1672('0x53'),'body':{'messages':[{'from':_0x11ae96[_0x1672('0x20')],'destinations':[{'to':_0x482ba9[_0x1672('0x20')]}],'text':_0x482ba9[_0x1672('0xc')],'notifyUrl':_0x11ae96[_0x1672('0x21')]+'/api/sms/messages/'+_0x482ba9['id']+_0x1672('0x23')+_0x11ae96[_0x1672('0x4c')],'notifyContentType':'application/json','callbackData':_0x11ae96[_0x1672('0x20')]+';'+_0x482ba9[_0x1672('0xc')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x43b5f5[_0x1672('0x4c')]},'json':!![]};return rp(_0x32eed1)[_0x1672('0x17')](function(_0x128e04){if(_0x128e04[_0x1672('0x48')]){var _0x5dfdb0={'messageId':_0x128e04['messages'][0x0][_0x1672('0xa')]};if(!_0x11ae96[_0x1672('0x36')]){_0x5dfdb0[_0x1672('0x37')]=!![];}return _0x4973d4[_0x1672('0x25')](_0x5dfdb0);}else{return logger[_0x1672('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1672('0x28'),_0x1672('0x50'),util[_0x1672('0x29')](_0x128e04,{'showHidden':![],'depth':null}));}});})[_0x1672('0x26')](function(_0x19353d){return logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x50'),util[_0x1672('0x29')](_0x19353d,{'showHidden':![],'depth':null}));});}else{logger[_0x1672('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1672('0x50'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x1672('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1672('0x28'),_0x1672('0x50'),_0x1672('0x38'));}break;case _0x1672('0x54'):var _0x3d9068=require(_0x1672('0x55'));if(_0x11ae96[_0x1672('0x56')]){var _0x2f8685={};_0x2f8685[_0x1672('0x57')]=_0x11ae96[_0x1672('0x2d')];_0x2f8685['phone']=_0x482ba9[_0x1672('0x20')];_0x2f8685['sender']=_0x11ae96[_0x1672('0x20')];_0x2f8685[_0x1672('0x58')]=_0x482ba9[_0x1672('0xc')];_0x2f8685[_0x1672('0x59')]=+new Date();var _0x999332='';var _0x49cd25='';var _0x1476aa=Object['keys'](_0x2f8685);_0x1476aa['sort']();for(var _0x51332c=0x0;_0x51332c<_0x1476aa[_0x1672('0x5a')];_0x51332c++){if(_0x999332!=''){_0x999332+='&';}_0x999332+=_0x1476aa[_0x51332c]+'='+encodeURIComponent(_0x2f8685[_0x1476aa[_0x51332c]]);_0x49cd25+=_0x2f8685[_0x1476aa[_0x51332c]];}_0x49cd25+=_0x11ae96[_0x1672('0x56')];_0x49cd25=_0x3d9068[_0x1672('0x5b')](_0x1672('0x5c'))[_0x1672('0x25')](_0x49cd25)[_0x1672('0x5d')](_0x1672('0x5e'));if(_0x999332!==''){_0x999332+='&';}_0x999332+=_0x1672('0x5f')+_0x49cd25;var _0x225743={'method':_0x1672('0x31'),'uri':_0x11ae96[_0x1672('0x51')]+'/external/get/send.php?'+_0x999332,'json':!![]};return rp(_0x225743)[_0x1672('0x17')](function(_0x3af667){var _0x2b5ce5=Object[_0x1672('0x60')](_0x3af667);if(_0x3af667[_0x2b5ce5[0x0]][_0x1672('0x2a')]&&parseInt(_0x3af667[_0x2b5ce5[0x0]][_0x1672('0x2a')])===0x0){var _0x21c94c={'messageId':_0x3af667[_0x2b5ce5[0x0]][_0x1672('0x61')]};if(!_0x11ae96[_0x1672('0x36')]){_0x21c94c[_0x1672('0x37')]=!![];}return _0x4973d4[_0x1672('0x25')](_0x21c94c);}else{return logger[_0x1672('0x2a')](_0x1672('0x27'),'afterCreate','csc',util[_0x1672('0x29')](_0x3af667['error'],{'showHidden':![],'depth':null}));}})[_0x1672('0x26')](function(_0x4e3abb){return logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x54'),util[_0x1672('0x29')](_0x4e3abb,{'showHidden':![],'depth':null}));});}else{logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),'csc',_0x1672('0x62'));}break;case _0x1672('0x63'):if(_0x11ae96['apiKey']){var _0x4ea335={'method':_0x1672('0x33'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x11ae96['apiKey']},'body':{'content':_0x482ba9[_0x1672('0xc')],'to':[_0x482ba9[_0x1672('0x20')]],'from':_0x11ae96[_0x1672('0x20')],'binary':![],'clientMessageId':_0x1672('0x64'),'charset':'UTF-8'},'json':!![]};rp(_0x4ea335)[_0x1672('0x17')](function(_0x5f0860){if(!_0x5f0860['error']){var _0x53e275={'messageId':_0x5f0860[_0x1672('0x48')][0x0][_0x1672('0x65')]};if(!_0x11ae96[_0x1672('0x36')]){_0x53e275[_0x1672('0x37')]=!![];}return _0x4973d4['update'](_0x53e275);}else{return logger[_0x1672('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1672('0x28'),_0x1672('0x63'),util[_0x1672('0x29')](_0x5f0860[_0x1672('0x2a')],{'showHidden':![],'depth':null}));}})[_0x1672('0x26')](function(_0x3ad4e1){return logger['error'](_0x1672('0x27'),'afterCreate',_0x1672('0x63'),util['inspect'](_0x3ad4e1,{'showHidden':![],'depth':null}));});}else{logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x63'),_0x1672('0x62'));}break;case'bandwidth':if(_0x11ae96[_0x1672('0x2d')]&&_0x11ae96[_0x1672('0x2e')]){var _0x3e1f02=util['format'](_0x1672('0x40'),_0x11ae96[_0x1672('0x2d')],_0x11ae96['password']);var _0x502390={'method':_0x1672('0x33'),'uri':_0x1672('0x66')+_0x11ae96[_0x1672('0x67')]+_0x1672('0x68'),'body':{'to':[_0x482ba9[_0x1672('0x20')]],'text':_0x482ba9[_0x1672('0xc')],'from':_0x11ae96[_0x1672('0x20')],'applicationId':_0x11ae96[_0x1672('0x69')]},'headers':{'Authorization':util[_0x1672('0x41')](_0x1672('0x42'),new Buffer(_0x3e1f02)['toString'](_0x1672('0x44')))},'json':!![]};rp(_0x502390)[_0x1672('0x17')](function(_0x207857){if(_0x207857['id']){var _0x425605={'messageId':_0x207857['id']};return _0x4973d4['update'](_0x425605);}else{logger[_0x1672('0x2a')](_0x1672('0x27'),'afterCreate',_0x1672('0x6a'),util[_0x1672('0x29')](_0x207857,{'showHidden':![],'depth':null}));}})[_0x1672('0x26')](function(_0x1e6485){logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),'bandwidth',util[_0x1672('0x29')](_0x1e6485,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1672('0x6a'),_0x1672('0x38'));}break;case _0x1672('0x6b'):if(_0x11ae96[_0x1672('0x56')]){var _0x29d475={};var _0x225743={'method':_0x1672('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x1672('0x6c')+_0x11ae96[_0x1672('0x56')],'Content-Type':'application/json'},'body':{'from':_0x11ae96['phone'],'to':_0x482ba9[_0x1672('0x20')],'text':_0x482ba9[_0x1672('0xc')]},'json':!![]};return rp(_0x225743)[_0x1672('0x17')](function(_0x5b31b7){if(_0x5b31b7['code']==0xca){_0x29d475[_0x1672('0x6d')]=_0x5b31b7;var _0xda7c98={'method':_0x1672('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x1672('0x6c')+_0x11ae96[_0x1672('0x56')],'Content-Type':_0x1672('0x6e')},'body':{'refid':_0x29d475[_0x1672('0x6d')][_0x1672('0x6f')]},'json':!![]};return rp(_0xda7c98)['then'](function(_0x5ea326){_0x29d475[_0x1672('0x70')]=_0x5ea326;var _0x357526={'messageId':_0x29d475[_0x1672('0x6d')][_0x1672('0x6f')],'read':!![]};return _0x4973d4[_0x1672('0x25')](_0x357526);});}else{return logger['error'](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x6b'),util[_0x1672('0x29')](_0x5b31b7,{'showHidden':![],'depth':null}));}})[_0x1672('0x26')](function(_0x437997){return logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x6b'),util[_0x1672('0x29')](_0x437997,{'showHidden':![],'depth':null}));});}else{return logger[_0x1672('0x2a')](_0x1672('0x27'),_0x1672('0x28'),_0x1672('0x6b'),'Token\x20not\x20received');}break;}}})[_0x1672('0x71')](function(){_0x3dc6d0();});}else{_0x3dc6d0();}}},'charset':_0x1672('0x72'),'collate':_0x1672('0x73')});}; \ No newline at end of file +var _0x5922=['Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','sender','text','timestamp','sort','md5','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','toString','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','body','models','direction','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','catch','error','out','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','update','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','user_key','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','POST','read','connectel'];(function(_0x5e5ce9,_0x4ea7e8){var _0x5cb68a=function(_0x904da8){while(--_0x904da8){_0x5e5ce9['push'](_0x5e5ce9['shift']());}};_0x5cb68a(++_0x4ea7e8);}(_0x5922,0x199));var _0x2592=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x5922[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0x2592('0x0'));var util=require(_0x2592('0x1'));var logger=require(_0x2592('0x2'))(_0x2592('0x3'));var moment=require(_0x2592('0x4'));var BPromise=require(_0x2592('0x5'));var rp=require(_0x2592('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2592('0x7'));var config=require(_0x2592('0x8'));var attributes=require(_0x2592('0x9'));module[_0x2592('0xa')]=function(_0x58e6fd,_0x5870cd){return _0x58e6fd['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x2592('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x2592('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4eb91a,_0x2aa70d,_0x2e6452){var _0xa005cb=_0x58e6fd[_0x2592('0xd')];var _0x4fe354=_0x4eb91a['get']({'plain':!![]});if(_0x4fe354[_0x2592('0xe')]['toLowerCase']()==='in'||_0x4fe354[_0x2592('0xe')]['toLowerCase']()==='out'&&!_0x4fe354[_0x2592('0xf')]&&!_['isNil'](_0x4fe354[_0x2592('0x10')])&&!_['isNil'](_0x4fe354[_0x2592('0x11')])){_0xa005cb[_0x2592('0x12')][_0x2592('0x13')]({'where':{'id':_0x4fe354[_0x2592('0x11')]}})[_0x2592('0x14')](function(_0x1dd955){if(_0x1dd955){_0x1dd955['update']({'lastMsgAt':_0x4fe354['createdAt'],'lastMsgDirection':_0x4fe354[_0x2592('0xe')]['toLowerCase']()});}})[_0x2592('0x15')](function(_0x190f9e){console[_0x2592('0x16')](_0x190f9e);});}if(_0x4fe354[_0x2592('0xe')]===_0x2592('0x17')&&!_0x4fe354[_0x2592('0xf')]){var _0x37cf81;_0xa005cb[_0x2592('0x18')]['find']({'where':{'id':_0x4fe354[_0x2592('0x19')]},'raw':!![]})[_0x2592('0x14')](function(_0x3b8133){_0x37cf81=_0x3b8133;if(_0x37cf81&&_0x37cf81[_0x2592('0x1a')]){switch(_0x37cf81[_0x2592('0x1a')]){case _0x2592('0x1b'):var _0x11368b=require(_0x2592('0x1b'));if(_0x37cf81[_0x2592('0x1c')]&&_0x37cf81[_0x2592('0x1d')]&&_0x37cf81[_0x2592('0x1e')]){var _0xfa84aa=new _0x11368b(_0x37cf81[_0x2592('0x1c')],_0x37cf81['authToken']);_0xfa84aa[_0x2592('0x1f')][_0x2592('0x20')]({'body':_0x4fe354[_0x2592('0xc')],'to':_0x4fe354[_0x2592('0x1e')],'from':_0x37cf81['phone'],'statusCallback':_0x37cf81[_0x2592('0x21')]+_0x2592('0x22')+_0x4fe354['id']+'/status?token='+_0x37cf81[_0x2592('0x23')]})['then'](function(_0x9456b6){if(_0x9456b6[_0x2592('0x24')]){return _0x4eb91a[_0x2592('0x25')]({'messageId':_0x9456b6[_0x2592('0x24')]});}})[_0x2592('0x15')](function(_0x427fd7){logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),_0x2592('0x1b'),util['inspect'](_0x427fd7,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x1b'),_0x2592('0x28'));}break;case _0x2592('0x29'):var _0x437914=_0x2592('0x2a');if(_0x37cf81[_0x2592('0x2b')]&&_0x37cf81[_0x2592('0x2c')]){var _0x5956bd={'recipient':[_0x4fe354['phone']],'message':_0x4fe354[_0x2592('0xc')],'message_type':_0x37cf81[_0x2592('0x2d')]};if(_0x37cf81[_0x2592('0x2d')]&&_0x37cf81['smsMethod']!=='SI'){_0x5956bd['sender']=_0x37cf81[_0x2592('0x1e')];}var _0x56bd5b={'url':_0x437914+_0x2592('0x2e')+_0x37cf81[_0x2592('0x2b')]+_0x2592('0x2f')+_0x37cf81[_0x2592('0x2c')],'method':_0x2592('0x30')};rp(_0x56bd5b)[_0x2592('0x14')](function(_0x2c9be0){var _0x4926ee=_0x2c9be0[_0x2592('0x31')](';');var _0x4dda7b={'user_key':_0x4926ee[0x0],'session_key':_0x4926ee[0x1]};_0x56bd5b={'url':_0x437914+_0x2592('0x32'),'method':'POST','headers':{'user_key':_0x4dda7b[_0x2592('0x33')],'Session_key':_0x4dda7b['session_key']},'json':!![],'body':_0x5956bd};return rp(_0x56bd5b);})[_0x2592('0x14')](function(_0x518422){if(_0x518422['total_sent']>=0x1){var _0x5b7f60={'messageId':_0x518422[_0x2592('0x34')]};if(_0x37cf81['smsMethod']!=='GP'||!_0x37cf81[_0x2592('0x35')]){_0x5b7f60['read']=!![];}return _0x4eb91a[_0x2592('0x25')](_0x5b7f60);}else{return logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x29'),util['inspect'](_0x518422,{'showHidden':![],'depth':null}));}})['catch'](function(_0x586c1a){return logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),_0x2592('0x29'),util[_0x2592('0x36')](_0x586c1a,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x29'),_0x2592('0x37'));}break;case'connectel':if(_0x37cf81[_0x2592('0x1d')]){var _0x5f57fe={'recipient':_0x4fe354[_0x2592('0x1e')],'message':_0x4fe354[_0x2592('0xc')],'sender':_0x37cf81['senderString']||_0x37cf81[_0x2592('0x1e')],'authorization':_0x37cf81[_0x2592('0x1d')]};var _0x2aa70d={'method':_0x2592('0x38'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5f57fe,'json':!![]};rp(_0x2aa70d)[_0x2592('0x14')](function(_0x3bfb2d){var _0x5813c6={'messageId':_0x3bfb2d['requestid']};if(!_0x37cf81[_0x2592('0x35')]){_0x5813c6[_0x2592('0x39')]=!![];}return _0x4eb91a[_0x2592('0x25')](_0x5813c6);})[_0x2592('0x15')](function(_0x56b3a7){logger[_0x2592('0x16')](_0x2592('0x27'),'afterCreate',_0x2592('0x3a'),util[_0x2592('0x36')](_0x56b3a7,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x3a'),_0x2592('0x3b'));}break;case _0x2592('0x3c'):if(_0x37cf81[_0x2592('0x2b')]&&_0x37cf81['password']){var _0x5f57fe={'messages':[{'source':_0x2592('0x3d'),'to':_0x4fe354[_0x2592('0x1e')],'body':_0x4fe354[_0x2592('0xc')],'from':_0x37cf81[_0x2592('0x3e')]||_0x37cf81[_0x2592('0x1e')]}]};var _0x2def7c=util[_0x2592('0x3f')](_0x2592('0x40'),_0x37cf81[_0x2592('0x2b')],_0x37cf81[_0x2592('0x2c')]);var _0x2aa70d={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5f57fe,'headers':{'Authorization':util[_0x2592('0x3f')](_0x2592('0x41'),new Buffer(_0x2def7c)['toString'](_0x2592('0x42')))},'json':!![]};rp(_0x2aa70d)[_0x2592('0x14')](function(_0x27462d){if(_0x27462d[_0x2592('0x43')]>=0xc8&&_0x27462d[_0x2592('0x43')]<=0xce){if(_0x27462d['data']&&_0x27462d[_0x2592('0x44')][_0x2592('0x45')]>0x0){var _0x3af28a=_[_0x2592('0x46')](_0x27462d[_0x2592('0x44')]['messages']);var _0x3bb20d={'messageId':_0x3af28a[_0x2592('0x47')]};if(!_0x37cf81[_0x2592('0x35')]){_0x3bb20d[_0x2592('0x39')]=!![];}return _0x4eb91a[_0x2592('0x25')](_0x3bb20d);}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x48'),util[_0x2592('0x36')](_0x27462d,{'showHidden':![],'depth':null}));}}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),'clickSend',util['inspect'](_0x27462d,{'showHidden':![],'depth':null}));}})[_0x2592('0x15')](function(_0x339c05){logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),_0x2592('0x48'),util[_0x2592('0x36')](_0x339c05,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),'clickSend',_0x2592('0x37'));}break;case'plivo':if(_0x37cf81[_0x2592('0x49')]&&_0x37cf81['authToken']){var _0x5f57fe={'dst':_0x4fe354[_0x2592('0x1e')],'text':_0x4fe354[_0x2592('0xc')],'src':_0x37cf81[_0x2592('0x3e')]||_0x37cf81[_0x2592('0x1e')],'url':_0x37cf81['remote']+'/api/sms/messages/'+_0x4fe354['id']+_0x2592('0x4a')+_0x37cf81[_0x2592('0x23')]};var _0x2def7c=util['format'](_0x2592('0x40'),_0x37cf81[_0x2592('0x49')],_0x37cf81['authToken']);var _0x2aa70d={'method':_0x2592('0x38'),'uri':util['format'](_0x2592('0x4b'),_0x37cf81[_0x2592('0x49')]),'body':_0x5f57fe,'headers':{'Authorization':util[_0x2592('0x3f')]('Basic\x20%s',new Buffer(_0x2def7c)['toString'](_0x2592('0x42')))},'json':!![]};rp(_0x2aa70d)[_0x2592('0x14')](function(_0x399a0e){var _0xb15812={'messageId':_0x399a0e[_0x2592('0x4c')][0x0]};return _0x4eb91a[_0x2592('0x25')](_0xb15812);})['catch'](function(_0x235238){logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),'plivo',util[_0x2592('0x36')](_0x235238,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),'plivo',_0x2592('0x4d'));}break;case _0x2592('0x4e'):if(_0x37cf81['username']&&_0x37cf81[_0x2592('0x2c')]){if(_0x37cf81[_0x2592('0x4f')]){var _0x228f89={'method':_0x2592('0x38'),'uri':_0x37cf81[_0x2592('0x4f')]+'/auth/1/session','body':{'username':_0x37cf81[_0x2592('0x2b')],'password':_0x37cf81['password']},'json':!![]};return rp(_0x228f89)['then'](function(_0x128ae5){var _0x4c57d5={'method':'POST','uri':_0x37cf81[_0x2592('0x4f')]+_0x2592('0x50'),'body':{'messages':[{'from':_0x37cf81[_0x2592('0x1e')],'destinations':[{'to':_0x4fe354[_0x2592('0x1e')]}],'text':_0x4fe354[_0x2592('0xc')],'notifyUrl':_0x37cf81[_0x2592('0x21')]+_0x2592('0x22')+_0x4fe354['id']+_0x2592('0x4a')+_0x37cf81['token'],'notifyContentType':_0x2592('0x51'),'callbackData':_0x37cf81[_0x2592('0x1e')]+';'+_0x4fe354[_0x2592('0xc')]}]},'headers':{'Authorization':_0x2592('0x52')+_0x128ae5[_0x2592('0x23')]},'json':!![]};return rp(_0x4c57d5)['then'](function(_0x1e48ee){if(_0x1e48ee[_0x2592('0x1f')]){var _0x37f86e={'messageId':_0x1e48ee[_0x2592('0x1f')][0x0][_0x2592('0xb')]};if(!_0x37cf81['deliveryReport']){_0x37f86e[_0x2592('0x39')]=!![];}return _0x4eb91a['update'](_0x37f86e);}else{return logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x4e'),util[_0x2592('0x36')](_0x1e48ee,{'showHidden':![],'depth':null}));}});})[_0x2592('0x15')](function(_0x4a60c0){return logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x2592('0x36')](_0x4a60c0,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x4e'),_0x2592('0x53'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),_0x2592('0x4e'),_0x2592('0x37'));}break;case _0x2592('0x54'):var _0x1c912a=require(_0x2592('0x55'));if(_0x37cf81[_0x2592('0x56')]){var _0x26e5e2={};_0x26e5e2['login']=_0x37cf81['username'];_0x26e5e2[_0x2592('0x1e')]=_0x4fe354['phone'];_0x26e5e2[_0x2592('0x57')]=_0x37cf81['phone'];_0x26e5e2[_0x2592('0x58')]=_0x4fe354['body'];_0x26e5e2[_0x2592('0x59')]=+new Date();var _0x21cc76='';var _0xb5a9df='';var _0x4f3b27=Object['keys'](_0x26e5e2);_0x4f3b27[_0x2592('0x5a')]();for(var _0x17e149=0x0;_0x17e149<_0x4f3b27['length'];_0x17e149++){if(_0x21cc76!=''){_0x21cc76+='&';}_0x21cc76+=_0x4f3b27[_0x17e149]+'='+encodeURIComponent(_0x26e5e2[_0x4f3b27[_0x17e149]]);_0xb5a9df+=_0x26e5e2[_0x4f3b27[_0x17e149]];}_0xb5a9df+=_0x37cf81[_0x2592('0x56')];_0xb5a9df=_0x1c912a['createHash'](_0x2592('0x5b'))[_0x2592('0x25')](_0xb5a9df)['digest']('hex');if(_0x21cc76!==''){_0x21cc76+='&';}_0x21cc76+=_0x2592('0x5c')+_0xb5a9df;var _0x56bd5b={'method':_0x2592('0x30'),'uri':_0x37cf81[_0x2592('0x4f')]+_0x2592('0x5d')+_0x21cc76,'json':!![]};return rp(_0x56bd5b)[_0x2592('0x14')](function(_0x167639){var _0x86a748=Object[_0x2592('0x5e')](_0x167639);if(_0x167639[_0x86a748[0x0]][_0x2592('0x16')]&&parseInt(_0x167639[_0x86a748[0x0]][_0x2592('0x16')])===0x0){var _0x2c3169={'messageId':_0x167639[_0x86a748[0x0]][_0x2592('0x5f')]};if(!_0x37cf81[_0x2592('0x35')]){_0x2c3169[_0x2592('0x39')]=!![];}return _0x4eb91a[_0x2592('0x25')](_0x2c3169);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),'csc',util[_0x2592('0x36')](_0x167639[_0x2592('0x16')],{'showHidden':![],'depth':null}));}})[_0x2592('0x15')](function(_0x2b1720){return logger['error'](_0x2592('0x27'),'afterCreate','csc',util[_0x2592('0x36')](_0x2b1720,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x54'),_0x2592('0x60'));}break;case _0x2592('0x61'):if(_0x37cf81[_0x2592('0x56')]){var _0x4a31af={'method':_0x2592('0x38'),'uri':_0x2592('0x62'),'headers':{'Authorization':_0x37cf81['apiKey']},'body':{'content':_0x4fe354['body'],'to':[_0x4fe354[_0x2592('0x1e')]],'from':_0x37cf81[_0x2592('0x1e')],'binary':![],'clientMessageId':_0x2592('0x63'),'charset':_0x2592('0x64')},'json':!![]};rp(_0x4a31af)[_0x2592('0x14')](function(_0x1e5235){if(!_0x1e5235[_0x2592('0x16')]){var _0x145472={'messageId':_0x1e5235[_0x2592('0x1f')][0x0][_0x2592('0x65')]};if(!_0x37cf81[_0x2592('0x35')]){_0x145472[_0x2592('0x39')]=!![];}return _0x4eb91a[_0x2592('0x25')](_0x145472);}else{return logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),'clickatell',util[_0x2592('0x36')](_0x1e5235[_0x2592('0x16')],{'showHidden':![],'depth':null}));}})[_0x2592('0x15')](function(_0x478709){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),_0x2592('0x61'),util['inspect'](_0x478709,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2592('0x26'),_0x2592('0x61'),'Missing\x20parameters:\x20apiKey');}break;case _0x2592('0x66'):if(_0x37cf81[_0x2592('0x2b')]&&_0x37cf81[_0x2592('0x2c')]){var _0x2def7c=util[_0x2592('0x3f')](_0x2592('0x40'),_0x37cf81['username'],_0x37cf81['password']);var _0x2aa70d={'method':_0x2592('0x38'),'uri':_0x2592('0x67')+_0x37cf81[_0x2592('0x68')]+_0x2592('0x69'),'body':{'to':[_0x4fe354[_0x2592('0x1e')]],'text':_0x4fe354['body'],'from':_0x37cf81[_0x2592('0x1e')],'applicationId':_0x37cf81['applicationId']},'headers':{'Authorization':util[_0x2592('0x3f')](_0x2592('0x41'),new Buffer(_0x2def7c)[_0x2592('0x6a')](_0x2592('0x42')))},'json':!![]};rp(_0x2aa70d)[_0x2592('0x14')](function(_0x1b0676){if(_0x1b0676['id']){var _0x2805bb={'messageId':_0x1b0676['id']};return _0x4eb91a[_0x2592('0x25')](_0x2805bb);}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x66'),util[_0x2592('0x36')](_0x1b0676,{'showHidden':![],'depth':null}));}})[_0x2592('0x15')](function(_0x200613){logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),'bandwidth',util['inspect'](_0x200613,{'showHidden':![],'depth':null}));});}else{logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x66'),_0x2592('0x37'));}break;case _0x2592('0x6b'):if(_0x37cf81['apiKey']){var _0xda3e1={};var _0x56bd5b={'method':_0x2592('0x38'),'uri':_0x2592('0x6c'),'headers':{'Authorization':_0x2592('0x6d')+_0x37cf81[_0x2592('0x56')],'Content-Type':_0x2592('0x51')},'body':{'from':_0x37cf81[_0x2592('0x1e')],'to':_0x4fe354[_0x2592('0x1e')],'text':_0x4fe354[_0x2592('0xc')]},'json':!![]};return rp(_0x56bd5b)['then'](function(_0x43b460){if(_0x43b460['code']==0xca){_0xda3e1[_0x2592('0x6e')]=_0x43b460;var _0x3aff78={'method':_0x2592('0x38'),'uri':_0x2592('0x6f'),'headers':{'Authorization':_0x2592('0x6d')+_0x37cf81[_0x2592('0x56')],'Content-Type':_0x2592('0x51')},'body':{'refid':_0xda3e1[_0x2592('0x6e')][_0x2592('0x70')]},'json':!![]};return rp(_0x3aff78)['then'](function(_0x46122d){_0xda3e1[_0x2592('0x71')]=_0x46122d;var _0xd36ea7={'messageId':_0xda3e1[_0x2592('0x6e')]['refid'],'read':!![]};return _0x4eb91a[_0x2592('0x25')](_0xd36ea7);});}else{return logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x6b'),util[_0x2592('0x36')](_0x43b460,{'showHidden':![],'depth':null}));}})[_0x2592('0x15')](function(_0xf2dbf6){return logger['error'](_0x2592('0x27'),_0x2592('0x26'),_0x2592('0x6b'),util[_0x2592('0x36')](_0xf2dbf6,{'showHidden':![],'depth':null}));});}else{return logger[_0x2592('0x16')](_0x2592('0x27'),_0x2592('0x26'),'intelepeer',_0x2592('0x72'));}break;}}})['finally'](function(){_0x2e6452();});}else{_0x2e6452();}}},'charset':_0x2592('0x73'),'collate':_0x2592('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 443595d..e81ae32 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 _0x0821=['body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage','create'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0821,0xeb));var _0x1082=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0821[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x1082('0x0'));var util=require(_0x1082('0x1'));var moment=require(_0x1082('0x2'));var BPromise=require('bluebird');var rs=require(_0x1082('0x3'));var fs=require('fs');var Redis=require(_0x1082('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1082('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1082('0x6'));var client=jayson['client'][_0x1082('0x7')]({'port':0x232a});config[_0x1082('0x8')]=_[_0x1082('0x9')](config['redis'],{'host':_0x1082('0xa'),'port':0x18eb});var socket=require(_0x1082('0xb'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x1082('0xc')](socket);function respondWithRpcPromise(_0x178df1,_0x41bdb3,_0x3d3715){return new BPromise(function(_0x34686d,_0x159fc3){return client['request'](_0x178df1,_0x3d3715)[_0x1082('0xd')](function(_0xb049c1){logger[_0x1082('0xe')](_0x1082('0xf'),_0x41bdb3,_0x1082('0x10'));logger[_0x1082('0x11')](_0x1082('0x12'),_0x41bdb3,_0x1082('0x10'),JSON[_0x1082('0x13')](_0xb049c1));if(_0xb049c1[_0x1082('0x14')]){if(_0xb049c1[_0x1082('0x14')]['code']===0x1f4){logger[_0x1082('0x14')](_0x1082('0xf'),_0x41bdb3,_0xb049c1[_0x1082('0x14')][_0x1082('0x15')]);return _0x159fc3(_0xb049c1[_0x1082('0x14')][_0x1082('0x15')]);}logger[_0x1082('0x14')]('SmsMessage,\x20%s,\x20%s',_0x41bdb3,_0xb049c1['error'][_0x1082('0x15')]);return _0x34686d(_0xb049c1['error'][_0x1082('0x15')]);}else{logger[_0x1082('0xe')](_0x1082('0xf'),_0x41bdb3,'request\x20sent');_0x34686d(_0xb049c1[_0x1082('0x16')][_0x1082('0x15')]);}})[_0x1082('0x17')](function(_0x4ebb39){logger[_0x1082('0x14')](_0x1082('0xf'),_0x41bdb3,_0x4ebb39);_0x159fc3(_0x4ebb39);});});}exports[_0x1082('0x18')]=function(_0x5e7397){var _0x5b8137=this;return new Promise(function(_0x4f6c93,_0x4e8679){return db['SmsMessage'][_0x1082('0x19')](_0x5e7397[_0x1082('0x1a')],{'raw':_0x5e7397[_0x1082('0x1b')]?_0x5e7397[_0x1082('0x1b')][_0x1082('0x1c')]===undefined?!![]:![]:!![]})[_0x1082('0xd')](function(_0x21b95a){logger['info']('CreateSmsMessage',_0x5e7397);logger[_0x1082('0x11')](_0x1082('0x18'),_0x5e7397,JSON[_0x1082('0x13')](_0x21b95a));_0x4f6c93(_0x21b95a);})['catch'](function(_0x4f82ac){logger[_0x1082('0x14')](_0x1082('0x18'),_0x4f82ac[_0x1082('0x15')],_0x5e7397);_0x4e8679(_0x5b8137[_0x1082('0x14')](0x1f4,_0x4f82ac['message']));});});}; \ No newline at end of file +var _0xe314=['catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2e2b68,_0x5841ce){var _0x4a218d=function(_0x560fc8){while(--_0x560fc8){_0x2e2b68['push'](_0x2e2b68['shift']());}};_0x4a218d(++_0x5841ce);}(_0xe314,0xee));var _0x4e31=function(_0x658211,_0x281474){_0x658211=_0x658211-0x0;var _0x2d5486=_0xe314[_0x658211];return _0x2d5486;};'use strict';var _=require(_0x4e31('0x0'));var util=require(_0x4e31('0x1'));var moment=require(_0x4e31('0x2'));var BPromise=require(_0x4e31('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e31('0x5'))('rpc');var config=require(_0x4e31('0x6'));var jayson=require(_0x4e31('0x7'));var client=jayson[_0x4e31('0x8')][_0x4e31('0x9')]({'port':0x232a});config['redis']=_[_0x4e31('0xa')](config[_0x4e31('0xb')],{'host':_0x4e31('0xc'),'port':0x18eb});var socket=require(_0x4e31('0xd'))(new Redis(config[_0x4e31('0xb')]));require(_0x4e31('0xe'))['register'](socket);function respondWithRpcPromise(_0x4997ef,_0x141a18,_0x34c489){return new BPromise(function(_0x5c1165,_0x4437bb){return client['request'](_0x4997ef,_0x34c489)['then'](function(_0x1cbbf0){logger[_0x4e31('0xf')](_0x4e31('0x10'),_0x141a18,_0x4e31('0x11'));logger[_0x4e31('0x12')](_0x4e31('0x13'),_0x141a18,_0x4e31('0x11'),JSON[_0x4e31('0x14')](_0x1cbbf0));if(_0x1cbbf0[_0x4e31('0x15')]){if(_0x1cbbf0[_0x4e31('0x15')]['code']===0x1f4){logger['error'](_0x4e31('0x10'),_0x141a18,_0x1cbbf0['error']['message']);return _0x4437bb(_0x1cbbf0[_0x4e31('0x15')][_0x4e31('0x16')]);}logger[_0x4e31('0x15')](_0x4e31('0x10'),_0x141a18,_0x1cbbf0['error'][_0x4e31('0x16')]);return _0x5c1165(_0x1cbbf0[_0x4e31('0x15')][_0x4e31('0x16')]);}else{logger[_0x4e31('0xf')]('SmsMessage,\x20%s,\x20%s',_0x141a18,'request\x20sent');_0x5c1165(_0x1cbbf0['result'][_0x4e31('0x16')]);}})[_0x4e31('0x17')](function(_0x459b86){logger['error']('SmsMessage,\x20%s,\x20%s',_0x141a18,_0x459b86);_0x4437bb(_0x459b86);});});}exports['CreateSmsMessage']=function(_0x4e35ca){var _0x228112=this;return new Promise(function(_0x29a685,_0x123014){return db[_0x4e31('0x18')][_0x4e31('0x19')](_0x4e35ca['body'],{'raw':_0x4e35ca[_0x4e31('0x1a')]?_0x4e35ca[_0x4e31('0x1a')][_0x4e31('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3a5544){logger[_0x4e31('0xf')](_0x4e31('0x1c'),_0x4e35ca);logger[_0x4e31('0x12')](_0x4e31('0x1c'),_0x4e35ca,JSON[_0x4e31('0x14')](_0x3a5544));_0x29a685(_0x3a5544);})[_0x4e31('0x17')](function(_0x26232e){logger[_0x4e31('0x15')](_0x4e31('0x1c'),_0x26232e['message'],_0x4e35ca);_0x123014(_0x228112[_0x4e31('0x15')](0x1f4,_0x26232e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ab8ea28..4fac168 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 _0x5b2f=['update','emit','removeListener','register','length','smsMessage:','save','remove'];(function(_0x5c7d4b,_0x305110){var _0x422e90=function(_0x23153f){while(--_0x23153f){_0x5c7d4b['push'](_0x5c7d4b['shift']());}};_0x422e90(++_0x305110);}(_0x5b2f,0x13e));var _0xf5b2=function(_0x567e55,_0x4968d9){_0x567e55=_0x567e55-0x0;var _0x316288=_0x5b2f[_0x567e55];return _0x316288;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xf5b2('0x0'),_0xf5b2('0x1'),_0xf5b2('0x2')];function createListener(_0x336896,_0xae0671){return function(_0x47ad64){_0xae0671[_0xf5b2('0x3')](_0x336896,_0x47ad64);};}function removeListener(_0xa0fba0,_0xb99582){return function(){SmsMessageEvents[_0xf5b2('0x4')](_0xa0fba0,_0xb99582);};}exports[_0xf5b2('0x5')]=function(_0x277577){for(var _0x4e9112=0x0,_0x5f2d32=events[_0xf5b2('0x6')];_0x4e9112<_0x5f2d32;_0x4e9112++){var _0x40afc1=events[_0x4e9112];var _0x235c95=createListener(_0xf5b2('0x7')+_0x40afc1,_0x277577);SmsMessageEvents['on'](_0x40afc1,_0x235c95);}}; \ No newline at end of file +var _0x1795=['save','emit','removeListener','length','smsMessage:'];(function(_0x3439ea,_0x3c68ba){var _0x3900a3=function(_0x38f9a5){while(--_0x38f9a5){_0x3439ea['push'](_0x3439ea['shift']());}};_0x3900a3(++_0x3c68ba);}(_0x1795,0x181));var _0x5179=function(_0x594272,_0x1f3ed6){_0x594272=_0x594272-0x0;var _0x50c325=_0x1795[_0x594272];return _0x50c325;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x5179('0x0'),'remove','update'];function createListener(_0x23929b,_0x3c989b){return function(_0x24faa5){_0x3c989b[_0x5179('0x1')](_0x23929b,_0x24faa5);};}function removeListener(_0x487121,_0x291136){return function(){SmsMessageEvents[_0x5179('0x2')](_0x487121,_0x291136);};}exports['register']=function(_0x383470){for(var _0x120c34=0x0,_0x9edb44=events[_0x5179('0x3')];_0x120c34<_0x9edb44;_0x120c34++){var _0x44090c=events[_0x120c34];var _0xd846b2=createListener(_0x5179('0x4')+_0x44090c,_0x383470);SmsMessageEvents['on'](_0x44090c,_0xd846b2);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b3ec47a..b121a8a 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 _0x62dc=['fs-extra','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','getMembers','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router'];(function(_0x5de55a,_0x3a98df){var _0x59ba22=function(_0x1d7ab0){while(--_0x1d7ab0){_0x5de55a['push'](_0x5de55a['shift']());}};_0x59ba22(++_0x3a98df);}(_0x62dc,0x19a));var _0xc62d=function(_0x40efd4,_0x5bcb3d){_0x40efd4=_0x40efd4-0x0;var _0x1ccf1c=_0x62dc[_0x40efd4];return _0x1ccf1c;};'use strict';var multer=require(_0xc62d('0x0'));var util=require('util');var path=require(_0xc62d('0x1'));var timeout=require(_0xc62d('0x2'));var express=require('express');var router=express[_0xc62d('0x3')]();var fs_extra=require(_0xc62d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc62d('0x5'));var config=require('../../config/environment');var controller=require(_0xc62d('0x6'));router[_0xc62d('0x7')]('/',auth[_0xc62d('0x8')](),controller['index']);router['get'](_0xc62d('0x9'),auth[_0xc62d('0x8')](),controller[_0xc62d('0xa')]);router['get'](_0xc62d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc62d('0x7')]('/:id/members',auth[_0xc62d('0x8')](),controller[_0xc62d('0xc')]);router['get']('/:id/teams',auth[_0xc62d('0x8')](),controller[_0xc62d('0xd')]);router['get'](_0xc62d('0xe'),auth[_0xc62d('0x8')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc62d('0xf')](_0xc62d('0x10'),auth[_0xc62d('0x8')](),controller[_0xc62d('0x11')]);router[_0xc62d('0xf')](_0xc62d('0xe'),auth[_0xc62d('0x8')](),controller[_0xc62d('0x12')]);router['put'](_0xc62d('0xb'),auth[_0xc62d('0x8')](),controller['update']);router[_0xc62d('0x13')](_0xc62d('0xb'),auth[_0xc62d('0x8')](),controller['destroy']);router[_0xc62d('0x13')](_0xc62d('0x10'),auth[_0xc62d('0x8')](),controller[_0xc62d('0x14')]);router[_0xc62d('0x13')](_0xc62d('0xe'),auth[_0xc62d('0x8')](),controller[_0xc62d('0x15')]);module[_0xc62d('0x16')]=router; \ No newline at end of file +var _0xee9e=['describe','show','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','update','/:id','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe'];(function(_0x321cc3,_0xd7325c){var _0x5d4df2=function(_0x483745){while(--_0x483745){_0x321cc3['push'](_0x321cc3['shift']());}};_0x5d4df2(++_0xd7325c);}(_0xee9e,0x109));var _0xeee9=function(_0x4b1361,_0x2992f8){_0x4b1361=_0x4b1361-0x0;var _0x55fda6=_0xee9e[_0x4b1361];return _0x55fda6;};'use strict';var multer=require('multer');var util=require(_0xeee9('0x0'));var path=require('path');var timeout=require(_0xeee9('0x1'));var express=require('express');var router=express[_0xeee9('0x2')]();var fs_extra=require(_0xeee9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xeee9('0x4'));var config=require(_0xeee9('0x5'));var controller=require(_0xeee9('0x6'));router[_0xeee9('0x7')]('/',auth[_0xeee9('0x8')](),controller['index']);router[_0xeee9('0x7')](_0xeee9('0x9'),auth[_0xeee9('0x8')](),controller[_0xeee9('0xa')]);router[_0xeee9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xeee9('0xb')]);router['get']('/:id/members',auth[_0xeee9('0x8')](),controller[_0xeee9('0xc')]);router[_0xeee9('0x7')](_0xeee9('0xd'),auth['isAuthenticated'](),controller[_0xeee9('0xe')]);router[_0xeee9('0x7')](_0xeee9('0xf'),auth[_0xeee9('0x8')](),controller['getAgents']);router[_0xeee9('0x10')]('/',auth[_0xeee9('0x8')](),controller['create']);router[_0xeee9('0x10')](_0xeee9('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xeee9('0xf'),auth['isAuthenticated'](),controller[_0xeee9('0x11')]);router[_0xeee9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xeee9('0x13')]);router['delete'](_0xeee9('0x14'),auth['isAuthenticated'](),controller[_0xeee9('0x15')]);router['delete']('/:id/teams',auth[_0xeee9('0x8')](),controller[_0xeee9('0x16')]);router['delete'](_0xeee9('0xf'),auth['isAuthenticated'](),controller[_0xeee9('0x17')]);module[_0xeee9('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bd3b728..a791c83 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 _0xc936=['rrmemory','beepall','roundrobin','sequelize','STRING','name','ENUM'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xc936,0x192));var _0x6c93=function(_0x582405,_0x4025a9){_0x582405=_0x582405-0x0;var _0x2a7d52=_0xc936[_0x582405];return _0x2a7d52;};'use strict';var Sequelize=require(_0x6c93('0x0'));module['exports']={'name':{'type':Sequelize[_0x6c93('0x1')],'unique':_0x6c93('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c93('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6c93('0x3')](_0x6c93('0x4'),_0x6c93('0x5'),_0x6c93('0x6'))}}; \ No newline at end of file +var _0x88b4=['beepall','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5168ac,_0x36128f){var _0x8a82e=function(_0xd20ed2){while(--_0xd20ed2){_0x5168ac['push'](_0x5168ac['shift']());}};_0x8a82e(++_0x36128f);}(_0x88b4,0x119));var _0x488b=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x88b4[_0x34843e];return _0x598f7f;};'use strict';var Sequelize=require(_0x488b('0x0'));module[_0x488b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x488b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x488b('0x3')]},'timeout':{'type':Sequelize[_0x488b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x488b('0x5')](_0x488b('0x6'),_0x488b('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0d720d7..8a9dc78 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 _0x3b64=['interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','all','union','value','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','SmsQueues','UserProfileResource','end','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','keys','query','filters','model','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','describe','findOne','params','hasOwnProperty','SmsQueueId','User','findAndCountAll','smsPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','order','Agents','online','voicePause'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3b64,0x1bd));var _0x43b6=function(_0x361fb7,_0x2d5f2e){_0x361fb7=_0x361fb7-0x0;var _0xf17343=_0x3b64[_0x361fb7];return _0xf17343;};'use strict';var emlformat=require(_0x43b6('0x0'));var rimraf=require(_0x43b6('0x1'));var zipdir=require(_0x43b6('0x2'));var jsonpatch=require(_0x43b6('0x3'));var rp=require(_0x43b6('0x4'));var moment=require(_0x43b6('0x5'));var BPromise=require(_0x43b6('0x6'));var Mustache=require('mustache');var util=require(_0x43b6('0x7'));var path=require('path');var sox=require(_0x43b6('0x8'));var csv=require(_0x43b6('0x9'));var ejs=require(_0x43b6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43b6('0xb'));var squel=require('squel');var crypto=require(_0x43b6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x43b6('0xd'));var toCsv=require(_0x43b6('0x9'));var querystring=require(_0x43b6('0xe'));var Papa=require('papaparse');var Redis=require(_0x43b6('0xf'));var authService=require(_0x43b6('0x10'));var qs=require(_0x43b6('0x11'));var as=require(_0x43b6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43b6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x43b6('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x43b6('0x15')](config[_0x43b6('0x16')],{'host':_0x43b6('0x17'),'port':0x18eb});var socket=require(_0x43b6('0x18'))(new Redis(config['redis']));require(_0x43b6('0x19'))['register'](socket);function respondWithStatusCode(_0x2e33ec,_0x3fd2b7){_0x3fd2b7=_0x3fd2b7||0xcc;return function(_0x331284){if(_0x331284){return _0x2e33ec[_0x43b6('0x1a')](_0x3fd2b7);}return _0x2e33ec['status'](_0x3fd2b7)['end']();};}function respondWithResult(_0xe0b1f2,_0x148676){_0x148676=_0x148676||0xc8;return function(_0x1bfb90){if(_0x1bfb90){return _0xe0b1f2['status'](_0x148676)[_0x43b6('0x1b')](_0x1bfb90);}};}function respondWithFilteredResult(_0x4c562b,_0x53510b){return function(_0x35ccc7){if(_0x35ccc7){var _0x4ccae2=typeof _0x53510b[_0x43b6('0x1c')]===_0x43b6('0x1d')&&typeof _0x53510b[_0x43b6('0x1e')]===_0x43b6('0x1d');var _0x27902a=_0x35ccc7[_0x43b6('0x1f')];var _0x1e724a=_0x4ccae2?0x0:_0x53510b['offset'];var _0xe31496=_0x4ccae2?_0x35ccc7['count']:_0x53510b[_0x43b6('0x1c')]+_0x53510b['limit'];var _0x47cab8;if(_0xe31496>=_0x27902a){_0xe31496=_0x27902a;_0x47cab8=0xc8;}else{_0x47cab8=0xce;}_0x4c562b[_0x43b6('0x20')](_0x47cab8);return _0x4c562b['set'](_0x43b6('0x21'),_0x1e724a+'-'+_0xe31496+'/'+_0x27902a)[_0x43b6('0x1b')](_0x35ccc7);}return null;};}function patchUpdates(_0x5e27de){return function(_0x4ba28f){try{jsonpatch[_0x43b6('0x22')](_0x4ba28f,_0x5e27de,!![]);}catch(_0x1a11f6){return BPromise[_0x43b6('0x23')](_0x1a11f6);}return _0x4ba28f[_0x43b6('0x24')]();};}function saveUpdates(_0x3d0ec5,_0x390989){return function(_0xe02e38){if(_0xe02e38){return _0xe02e38[_0x43b6('0x25')](_0x3d0ec5)['then'](function(_0x1807ef){return _0x1807ef;});}return null;};}function removeEntity(_0x234e9a,_0x45881b){return function(_0xb65012){if(_0xb65012){return _0xb65012[_0x43b6('0x26')]()[_0x43b6('0x27')](function(){var _0x1dbf3e=_0xb65012['get']({'plain':!![]});var _0x5f2e33=_0x43b6('0x28');return db[_0x43b6('0x29')][_0x43b6('0x26')]({'where':{'type':_0x5f2e33,'resourceId':_0x1dbf3e['id']}})[_0x43b6('0x27')](function(){return _0xb65012;});})['then'](function(){_0x234e9a['status'](0xcc)[_0x43b6('0x2a')]();});}};}function handleEntityNotFound(_0x2f4878,_0x215a83){return function(_0x160b5c){if(!_0x160b5c){_0x2f4878[_0x43b6('0x1a')](0x194);}return _0x160b5c;};}function handleError(_0x2e7f01,_0x44427b){_0x44427b=_0x44427b||0x1f4;return function(_0x32bd57){logger[_0x43b6('0x2b')](_0x32bd57[_0x43b6('0x2c')]);if(_0x32bd57[_0x43b6('0x2d')]){delete _0x32bd57[_0x43b6('0x2d')];}_0x2e7f01[_0x43b6('0x20')](_0x44427b)[_0x43b6('0x2e')](_0x32bd57);};}exports[_0x43b6('0x2f')]=function(_0x469e2c,_0x270695){var _0x2547a6={},_0x54be1d={},_0x247572={'count':0x0,'rows':[]};var _0x162a86=_[_0x43b6('0x30')](db[_0x43b6('0x31')][_0x43b6('0x32')],function(_0x423650){return{'name':_0x423650['fieldName'],'type':_0x423650[_0x43b6('0x33')][_0x43b6('0x34')]};});_0x54be1d['model']=_['map'](_0x162a86,_0x43b6('0x2d'));_0x54be1d['query']=_[_0x43b6('0x35')](_0x469e2c[_0x43b6('0x36')]);_0x54be1d[_0x43b6('0x37')]=_['intersection'](_0x54be1d[_0x43b6('0x38')],_0x54be1d['query']);_0x2547a6['attributes']=_[_0x43b6('0x39')](_0x54be1d[_0x43b6('0x38')],qs[_0x43b6('0x3a')](_0x469e2c[_0x43b6('0x36')]['fields']));_0x2547a6[_0x43b6('0x3b')]=_0x2547a6[_0x43b6('0x3b')][_0x43b6('0x3c')]?_0x2547a6['attributes']:_0x54be1d[_0x43b6('0x38')];if(!_0x469e2c[_0x43b6('0x36')]['hasOwnProperty'](_0x43b6('0x3d'))){_0x2547a6['limit']=qs[_0x43b6('0x1e')](_0x469e2c['query'][_0x43b6('0x1e')]);_0x2547a6['offset']=qs[_0x43b6('0x1c')](_0x469e2c[_0x43b6('0x36')]['offset']);}_0x2547a6['order']=qs[_0x43b6('0x3e')](_0x469e2c[_0x43b6('0x36')][_0x43b6('0x3e')]);_0x2547a6['where']=qs[_0x43b6('0x37')](_[_0x43b6('0x3f')](_0x469e2c['query'],_0x54be1d['filters']),_0x162a86);if(_0x469e2c[_0x43b6('0x36')][_0x43b6('0x40')]){_0x2547a6[_0x43b6('0x41')]=_[_0x43b6('0x42')](_0x2547a6[_0x43b6('0x41')],{'$or':_[_0x43b6('0x30')](_0x162a86,function(_0x47f3f2){if(_0x47f3f2[_0x43b6('0x33')]!==_0x43b6('0x43')){var _0x171899={};_0x171899[_0x47f3f2[_0x43b6('0x2d')]]={'$like':'%'+_0x469e2c['query']['filter']+'%'};return _0x171899;}})});}_0x2547a6=_[_0x43b6('0x42')]({},_0x2547a6,_0x469e2c[_0x43b6('0x44')]);var _0x445660={'where':_0x2547a6[_0x43b6('0x41')]};return db[_0x43b6('0x31')][_0x43b6('0x1f')](_0x445660)[_0x43b6('0x27')](function(_0x3e06db){_0x247572['count']=_0x3e06db;if(_0x469e2c[_0x43b6('0x36')]['includeAll']){_0x2547a6['include']=[{'all':!![]}];}return db[_0x43b6('0x31')][_0x43b6('0x45')](_0x2547a6);})[_0x43b6('0x27')](function(_0x6043ee){_0x247572[_0x43b6('0x46')]=_0x6043ee;return _0x247572;})[_0x43b6('0x27')](respondWithFilteredResult(_0x270695,_0x2547a6))[_0x43b6('0x47')](handleError(_0x270695,null));};exports[_0x43b6('0x48')]=function(_0x48349e,_0x36f68b){var _0x14f34a={'raw':!![],'where':{'id':_0x48349e['params']['id']}},_0x2b9f2c={};_0x2b9f2c[_0x43b6('0x38')]=_[_0x43b6('0x35')](db['SmsQueue'][_0x43b6('0x32')]);_0x2b9f2c[_0x43b6('0x36')]=_[_0x43b6('0x35')](_0x48349e['query']);_0x2b9f2c[_0x43b6('0x37')]=_[_0x43b6('0x39')](_0x2b9f2c[_0x43b6('0x38')],_0x2b9f2c[_0x43b6('0x36')]);_0x14f34a[_0x43b6('0x3b')]=_[_0x43b6('0x39')](_0x2b9f2c['model'],qs[_0x43b6('0x3a')](_0x48349e['query'][_0x43b6('0x3a')]));_0x14f34a['attributes']=_0x14f34a[_0x43b6('0x3b')][_0x43b6('0x3c')]?_0x14f34a[_0x43b6('0x3b')]:_0x2b9f2c[_0x43b6('0x38')];if(_0x48349e[_0x43b6('0x36')][_0x43b6('0x49')]){_0x14f34a[_0x43b6('0x4a')]=[{'all':!![]}];}_0x14f34a=_[_0x43b6('0x42')]({},_0x14f34a,_0x48349e[_0x43b6('0x44')]);return db[_0x43b6('0x31')]['find'](_0x14f34a)[_0x43b6('0x27')](handleEntityNotFound(_0x36f68b,null))[_0x43b6('0x27')](respondWithResult(_0x36f68b,null))[_0x43b6('0x47')](handleError(_0x36f68b,null));};exports[_0x43b6('0x4b')]=function(_0x4bcef9,_0x17602f){return db['SmsQueue']['create'](_0x4bcef9[_0x43b6('0x4c')],{})[_0x43b6('0x27')](function(_0x5cf904){var _0x5ecd1d=_0x4bcef9[_0x43b6('0x4d')][_0x43b6('0x4e')]({'plain':!![]});if(!_0x5ecd1d)throw new Error(_0x43b6('0x4f'));if(_0x5ecd1d[_0x43b6('0x50')]===_0x43b6('0x4d')){var _0x320c23=_0x5cf904[_0x43b6('0x4e')]({'plain':!![]});var _0x263568=_0x43b6('0x28');return db[_0x43b6('0x51')]['find']({'where':{'name':_0x263568,'userProfileId':_0x5ecd1d[_0x43b6('0x52')]},'raw':!![]})['then'](function(_0x2f0264){if(_0x2f0264&&_0x2f0264[_0x43b6('0x53')]===0x0){return db[_0x43b6('0x29')]['create']({'name':_0x320c23[_0x43b6('0x2d')],'resourceId':_0x320c23['id'],'type':_0x2f0264[_0x43b6('0x2d')],'sectionId':_0x2f0264['id']},{})[_0x43b6('0x27')](function(){return _0x5cf904;});}else{return _0x5cf904;}})['catch'](function(_0x54c55f){logger[_0x43b6('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54c55f);throw _0x54c55f;});}return _0x5cf904;})[_0x43b6('0x27')](respondWithResult(_0x17602f,0xc9))['catch'](handleError(_0x17602f,null));};exports[_0x43b6('0x25')]=function(_0x41fcda,_0x432c6c){if(_0x41fcda['body']['id']){delete _0x41fcda[_0x43b6('0x4c')]['id'];}return db[_0x43b6('0x31')][_0x43b6('0x54')]({'where':{'id':_0x41fcda['params']['id']}})[_0x43b6('0x27')](handleEntityNotFound(_0x432c6c,null))[_0x43b6('0x27')](saveUpdates(_0x41fcda['body'],null))[_0x43b6('0x27')](respondWithResult(_0x432c6c,null))['catch'](handleError(_0x432c6c,null));};exports['destroy']=function(_0x2f4d52,_0x1247a0){return db[_0x43b6('0x31')]['find']({'where':{'id':_0x2f4d52['params']['id']}})[_0x43b6('0x27')](handleEntityNotFound(_0x1247a0,null))[_0x43b6('0x27')](removeEntity(_0x1247a0,null))['catch'](handleError(_0x1247a0,null));};exports[_0x43b6('0x55')]=function(_0x6ecdb2,_0x25c730){return db[_0x43b6('0x31')][_0x43b6('0x55')]()[_0x43b6('0x27')](respondWithResult(_0x25c730,null))[_0x43b6('0x47')](handleError(_0x25c730,null));};exports['getMembers']=function(_0x359e12,_0x1f71ea,_0x348514){var _0x878650={'raw':!![],'where':{}},_0x1adfa2={},_0x365652;return db['SmsQueue'][_0x43b6('0x56')]({'where':{'id':_0x359e12[_0x43b6('0x57')]['id']}})[_0x43b6('0x27')](handleEntityNotFound(_0x1f71ea,null))[_0x43b6('0x27')](function(_0xdd7965){if(_0xdd7965){_0x365652=_0xdd7965['get']({'plain':!![]});_0x1adfa2[_0x43b6('0x38')]=_[_0x43b6('0x35')](db['UserSmsQueue'][_0x43b6('0x32')]);_0x1adfa2[_0x43b6('0x36')]=_[_0x43b6('0x35')](_0x359e12[_0x43b6('0x36')]);_0x1adfa2[_0x43b6('0x37')]=_[_0x43b6('0x39')](_0x1adfa2[_0x43b6('0x38')],_0x1adfa2[_0x43b6('0x36')]);_0x878650['attributes']=_['intersection'](_0x1adfa2[_0x43b6('0x38')],qs[_0x43b6('0x3a')](_0x359e12['query'][_0x43b6('0x3a')]));_0x878650['attributes']=_0x878650[_0x43b6('0x3b')][_0x43b6('0x3c')]?_0x878650[_0x43b6('0x3b')]:_0x1adfa2[_0x43b6('0x38')];if(!_0x359e12[_0x43b6('0x36')][_0x43b6('0x58')](_0x43b6('0x3d'))){_0x878650[_0x43b6('0x1e')]=qs[_0x43b6('0x1e')](_0x359e12[_0x43b6('0x36')][_0x43b6('0x1e')]);_0x878650['offset']=qs[_0x43b6('0x1c')](_0x359e12[_0x43b6('0x36')][_0x43b6('0x1c')]);}_0x878650['order']=qs[_0x43b6('0x3e')](_0x359e12[_0x43b6('0x36')][_0x43b6('0x3e')]);_0x878650[_0x43b6('0x41')]=qs[_0x43b6('0x37')](_['pick'](_0x359e12[_0x43b6('0x36')],_0x1adfa2[_0x43b6('0x37')]));_0x878650['where'][_0x43b6('0x59')]=_0xdd7965['id'];if(_0x359e12['query'][_0x43b6('0x40')]){_0x878650[_0x43b6('0x41')]=_['merge'](_0x878650[_0x43b6('0x41')],{'$or':_[_0x43b6('0x30')](_0x878650[_0x43b6('0x3b')],function(_0x53c7e2){var _0x52379c={};_0x52379c[_0x53c7e2]={'$like':'%'+_0x359e12[_0x43b6('0x36')][_0x43b6('0x40')]+'%'};return _0x52379c;})});}_0x878650=_[_0x43b6('0x42')]({},_0x878650,_0x359e12[_0x43b6('0x44')]);return db['UserSmsQueue'][_0x43b6('0x45')](_0x878650);}})[_0x43b6('0x27')](function(_0x4ddeeb){if(_0x4ddeeb){return db[_0x43b6('0x5a')][_0x43b6('0x5b')]({'where':{'id':_[_0x43b6('0x30')](_0x4ddeeb,'UserId'),'role':'agent'},'attributes':['id',_0x43b6('0x2d'),_0x43b6('0x5c'),_0x43b6('0x5d'),'createdAt']});}})[_0x43b6('0x27')](function(_0x119ebc){if(_0x119ebc){return{'count':_0x119ebc[_0x43b6('0x1f')],'rows':_[_0x43b6('0x30')](_0x119ebc['rows'],function(_0x263948){return{'membername':_0x263948[_0x43b6('0x2d')],'UserId':_0x263948['id'],'queue_name':_0x365652['name'],'SmsQueueId':_0x365652['id'],'interface':util['format'](_0x43b6('0x5e'),_0x43b6('0x5f'),_0x263948[_0x43b6('0x2d')]),'penalty':0x0,'paused':_0x263948[_0x43b6('0x5c')],'createdAt':_0x263948[_0x43b6('0x60')],'updatedAt':_0x263948[_0x43b6('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f71ea,_0x878650))['catch'](handleError(_0x1f71ea,null));};exports[_0x43b6('0x61')]=function(_0x66d1f4,_0x7b0bb8,_0x261dc3){var _0x6596ba={};var _0x245bd1={};var _0x5470e3;var _0x4175b6;return db[_0x43b6('0x31')][_0x43b6('0x56')]({'where':{'id':_0x66d1f4[_0x43b6('0x57')]['id']}})[_0x43b6('0x27')](handleEntityNotFound(_0x7b0bb8,null))['then'](function(_0x26cbd1){if(_0x26cbd1){_0x5470e3=_0x26cbd1;_0x245bd1[_0x43b6('0x38')]=_['keys'](db[_0x43b6('0x62')][_0x43b6('0x32')]);_0x245bd1[_0x43b6('0x36')]=_['keys'](_0x66d1f4[_0x43b6('0x36')]);_0x245bd1[_0x43b6('0x37')]=_['intersection'](_0x245bd1[_0x43b6('0x38')],_0x245bd1[_0x43b6('0x36')]);_0x6596ba[_0x43b6('0x3b')]=_[_0x43b6('0x39')](_0x245bd1['model'],qs[_0x43b6('0x3a')](_0x66d1f4[_0x43b6('0x36')][_0x43b6('0x3a')]));_0x6596ba[_0x43b6('0x3b')]=_0x6596ba[_0x43b6('0x3b')][_0x43b6('0x3c')]?_0x6596ba[_0x43b6('0x3b')]:_0x245bd1[_0x43b6('0x38')];_0x6596ba[_0x43b6('0x63')]=qs['sort'](_0x66d1f4[_0x43b6('0x36')][_0x43b6('0x3e')]);_0x6596ba[_0x43b6('0x41')]=qs[_0x43b6('0x37')](_[_0x43b6('0x3f')](_0x66d1f4['query'],_0x245bd1['filters']));if(_0x66d1f4[_0x43b6('0x36')]['filter']){_0x6596ba[_0x43b6('0x41')]=_[_0x43b6('0x42')](_0x6596ba[_0x43b6('0x41')],{'$or':_['map'](_0x6596ba[_0x43b6('0x3b')],function(_0xa4ba39){var _0x3a2811={};_0x3a2811[_0xa4ba39]={'$like':'%'+_0x66d1f4['query'][_0x43b6('0x40')]+'%'};return _0x3a2811;})});}_0x6596ba=_['merge']({},_0x6596ba,_0x66d1f4[_0x43b6('0x44')]);return _0x5470e3[_0x43b6('0x61')](_0x6596ba);}})[_0x43b6('0x27')](function(_0x5476a3){if(_0x5476a3){_0x4175b6=_0x5476a3[_0x43b6('0x3c')];if(!_0x66d1f4[_0x43b6('0x36')][_0x43b6('0x58')](_0x43b6('0x3d'))){_0x6596ba[_0x43b6('0x1e')]=qs[_0x43b6('0x1e')](_0x66d1f4[_0x43b6('0x36')]['limit']);_0x6596ba[_0x43b6('0x1c')]=qs[_0x43b6('0x1c')](_0x66d1f4[_0x43b6('0x36')][_0x43b6('0x1c')]);}return _0x5470e3[_0x43b6('0x61')](_0x6596ba);}})[_0x43b6('0x27')](function(_0x27c7e3){if(_0x27c7e3){return _0x27c7e3?{'count':_0x4175b6,'rows':_0x27c7e3}:null;}})[_0x43b6('0x27')](respondWithResult(_0x7b0bb8,null))['catch'](handleError(_0x7b0bb8,null));};exports['addTeams']=function(_0x13aaf7,_0x181d50,_0x583f48){var _0x342167=_0x13aaf7[_0x43b6('0x4c')]['ids'];return db['Team']['findAll']({'where':{'id':_0x342167},'attributes':['id'],'include':[{'model':db[_0x43b6('0x5a')],'as':_0x43b6('0x64'),'attributes':['id',_0x43b6('0x2d'),_0x43b6('0x65'),_0x43b6('0x66'),_0x43b6('0x67')],'raw':!![]}]})[_0x43b6('0x27')](function(_0x12d488){if(_0x12d488){var _0x3749e2=_[_0x43b6('0x68')](_0x12d488,function(_0x7fb4){var _0x673b4f=_0x7fb4[_0x43b6('0x4e')]({'plain':!![]});return _0x673b4f[_0x43b6('0x64')];});return db[_0x43b6('0x31')][_0x43b6('0x54')]({'where':{'id':_0x13aaf7[_0x43b6('0x57')]['id']}})[_0x43b6('0x27')](function(_0x2ebbe8){return db[_0x43b6('0x69')][_0x43b6('0x6a')](function(_0x1ed912){return _0x2ebbe8[_0x43b6('0x6b')](_0x342167,{'transaction':_0x1ed912})[_0x43b6('0x27')](function(){return BPromise[_0x43b6('0x6c')](_0x3749e2,function(_0x22475e){return db['UserSmsQueue'][_0x43b6('0x6d')]({'where':{'UserId':_0x22475e['id'],'SmsQueueId':_0x13aaf7[_0x43b6('0x57')]['id']},'transaction':_0x1ed912});});})['then'](function(){_0x3749e2[_0x43b6('0x6e')](function(_0x577534){socket[_0x43b6('0x6f')](_0x43b6('0x70'),{'UserId':_0x577534['id'],'SmsQueueId':_0x2ebbe8['id']});});});});});}})['then'](respondWithStatusCode(_0x181d50,null))[_0x43b6('0x47')](handleError(_0x181d50,null));};exports[_0x43b6('0x71')]=function(_0x4f1d2c,_0x4d14f9,_0x142cc5){return db[_0x43b6('0x62')][_0x43b6('0x45')]({'where':{'id':_0x4f1d2c[_0x43b6('0x36')][_0x43b6('0x72')]},'attributes':['id'],'include':[{'model':db[_0x43b6('0x5a')],'as':_0x43b6('0x64'),'attributes':['id'],'raw':!![]}]})[_0x43b6('0x27')](handleEntityNotFound(_0x4d14f9,null))[_0x43b6('0x27')](function(_0x1dd9ef){var _0x15fc98=_[_0x43b6('0x30')](_0x1dd9ef,'id');var _0x5ce889=[];var _0xea7830=[];var _0x385243=squel[_0x43b6('0x73')]();_0x385243['field'](_0x43b6('0x74'))[_0x43b6('0x75')](_0x43b6('0x76'),'tq')[_0x43b6('0x77')](_0x43b6('0x78'),'ut',_0x43b6('0x79'))[_0x43b6('0x41')](_0x43b6('0x7a'),_0x4f1d2c[_0x43b6('0x57')]['id']);for(var _0x319f86=0x0;_0x319f86<_0x1dd9ef['length'];_0x319f86+=0x1){let _0xeff693=_0x1dd9ef[_0x319f86];for(var _0x5e835b=0x0;_0x5e835b<_0xeff693[_0x43b6('0x64')][_0x43b6('0x3c')];_0x5e835b+=0x1){let _0xbe607a=_0xeff693[_0x43b6('0x64')][_0x5e835b];var _0x3a539a=_0x385243['clone']();_0x3a539a['where'](_0x43b6('0x7b'),_0xbe607a['id']);_0xea7830[_0x43b6('0x7c')](db[_0x43b6('0x69')]['query'](_0x3a539a[_0x43b6('0x7d')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x2a138c){if(_0x2a138c[_0x43b6('0x3c')]===0x1){return _0xbe607a['id'];}else{var _0x40e780=_[_0x43b6('0x7e')](_[_0x43b6('0x30')](_0x2a138c,'TeamId'),function(_0x4eb394){return _['includes'](_0x15fc98,_0x4eb394);});if(_0x40e780){return _0xbe607a['id'];}}}));}}return BPromise[_0x43b6('0x7f')](_0xea7830)['then'](function(_0x37751d){_0x5ce889=_(_0x5ce889)[_0x43b6('0x80')](_0x37751d)['compact']()[_0x43b6('0x81')]();return db['SmsQueue'][_0x43b6('0x54')]({'where':{'id':_0x4f1d2c[_0x43b6('0x57')]['id']}})[_0x43b6('0x27')](function(_0x1ec00b){return db['sequelize'][_0x43b6('0x6a')](function(_0x43a63a){return _0x1ec00b[_0x43b6('0x71')](_0x4f1d2c[_0x43b6('0x36')][_0x43b6('0x72')],{'transaction':_0x43a63a})[_0x43b6('0x27')](function(){if(!_['isEmpty'](_0x5ce889)){return _0x1ec00b['removeAgents'](_0x5ce889,{'transaction':_0x43a63a});}})['then'](function(){_0x5ce889[_0x43b6('0x6e')](function(_0xa76800){socket[_0x43b6('0x6f')](_0x43b6('0x82'),{'UserId':_0xa76800,'SmsQueueId':_0x1ec00b['id']});});});});});});})['then'](respondWithStatusCode(_0x4d14f9,null))[_0x43b6('0x47')](handleError(_0x4d14f9,null));};exports[_0x43b6('0x83')]=function(_0x3f97ec,_0x1a8eef,_0x9ac724){return db['SmsQueue'][_0x43b6('0x54')]({'where':{'id':_0x3f97ec[_0x43b6('0x57')]['id']}})['then'](handleEntityNotFound(_0x1a8eef,null))[_0x43b6('0x27')](function(_0x3ef2fa){if(_0x3ef2fa){return _0x3ef2fa[_0x43b6('0x83')](_0x3f97ec[_0x43b6('0x4c')][_0x43b6('0x72')],_[_0x43b6('0x84')](_0x3f97ec[_0x43b6('0x4c')],[_0x43b6('0x72'),'id'])||{})[_0x43b6('0x85')](function(_0x3c0d98){for(var _0x1747a2=0x0;_0x1747a2<_0x3f97ec[_0x43b6('0x4c')]['ids'][_0x43b6('0x3c')];_0x1747a2+=0x1){socket[_0x43b6('0x6f')](_0x43b6('0x70'),{'UserId':Number(_0x3f97ec[_0x43b6('0x4c')][_0x43b6('0x72')][_0x1747a2]),'SmsQueueId':Number(_0x3f97ec['params']['id'])});}return _0x3c0d98;});}})[_0x43b6('0x27')](respondWithResult(_0x1a8eef,null))['catch'](handleError(_0x1a8eef,null));};exports[_0x43b6('0x86')]=function(_0x485fc9,_0x3658f1,_0x151fb1){return db[_0x43b6('0x31')][_0x43b6('0x54')]({'where':{'id':_0x485fc9[_0x43b6('0x57')]['id']}})[_0x43b6('0x27')](handleEntityNotFound(_0x3658f1,null))[_0x43b6('0x27')](function(_0x45a732){if(_0x45a732){return _0x45a732[_0x43b6('0x86')](_0x485fc9['query']['ids'])[_0x43b6('0x27')](function(){if(_[_0x43b6('0x87')](_0x485fc9[_0x43b6('0x36')][_0x43b6('0x72')])){for(var _0x5608bd=0x0;_0x5608bd<_0x485fc9[_0x43b6('0x36')][_0x43b6('0x72')]['length'];_0x5608bd+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x485fc9[_0x43b6('0x36')][_0x43b6('0x72')][_0x5608bd]),'SmsQueueId':Number(_0x485fc9[_0x43b6('0x57')]['id'])});}}else{socket[_0x43b6('0x6f')](_0x43b6('0x82'),{'UserId':Number(_0x485fc9[_0x43b6('0x36')]['ids']),'SmsQueueId':Number(_0x485fc9['params']['id'])});}});}})[_0x43b6('0x27')](respondWithStatusCode(_0x3658f1,null))[_0x43b6('0x47')](handleError(_0x3658f1,null));};exports[_0x43b6('0x88')]=function(_0x114d2a,_0x9744ed,_0x3c8f40){var _0x3ed177={};var _0x35d078={};var _0x2a79ae;var _0x25f925;return db[_0x43b6('0x31')]['findOne']({'where':{'id':_0x114d2a['params']['id']}})[_0x43b6('0x27')](handleEntityNotFound(_0x9744ed,null))[_0x43b6('0x27')](function(_0x5113da){if(_0x5113da){_0x2a79ae=_0x5113da;_0x35d078[_0x43b6('0x38')]=_[_0x43b6('0x35')](db[_0x43b6('0x5a')]['rawAttributes']);_0x35d078[_0x43b6('0x36')]=_[_0x43b6('0x35')](_0x114d2a[_0x43b6('0x36')]);_0x35d078[_0x43b6('0x37')]=_[_0x43b6('0x39')](_0x35d078[_0x43b6('0x38')],_0x35d078['query']);_0x3ed177[_0x43b6('0x3b')]=_['intersection'](_0x35d078['model'],qs[_0x43b6('0x3a')](_0x114d2a['query'][_0x43b6('0x3a')]));_0x3ed177['attributes']=_0x3ed177[_0x43b6('0x3b')]['length']?_0x3ed177[_0x43b6('0x3b')]:_0x35d078[_0x43b6('0x38')];_0x3ed177['order']=qs[_0x43b6('0x3e')](_0x114d2a[_0x43b6('0x36')][_0x43b6('0x3e')]);_0x3ed177[_0x43b6('0x41')]=qs[_0x43b6('0x37')](_['pick'](_0x114d2a[_0x43b6('0x36')],_0x35d078[_0x43b6('0x37')]));if(_0x114d2a[_0x43b6('0x36')][_0x43b6('0x40')]){_0x3ed177[_0x43b6('0x41')]=_[_0x43b6('0x42')](_0x3ed177[_0x43b6('0x41')],{'$or':_[_0x43b6('0x30')](_0x3ed177[_0x43b6('0x3b')],function(_0xf35ed6){var _0x4ed2e0={};_0x4ed2e0[_0xf35ed6]={'$like':'%'+_0x114d2a[_0x43b6('0x36')][_0x43b6('0x40')]+'%'};return _0x4ed2e0;})});}_0x3ed177=_[_0x43b6('0x42')]({},_0x3ed177,_0x114d2a[_0x43b6('0x44')]);return _0x2a79ae[_0x43b6('0x88')](_0x3ed177);}})[_0x43b6('0x27')](function(_0x19f0e5){if(_0x19f0e5){_0x25f925=_0x19f0e5[_0x43b6('0x3c')];if(!_0x114d2a['query']['hasOwnProperty']('nolimit')){_0x3ed177[_0x43b6('0x1e')]=qs[_0x43b6('0x1e')](_0x114d2a[_0x43b6('0x36')][_0x43b6('0x1e')]);_0x3ed177['offset']=qs[_0x43b6('0x1c')](_0x114d2a[_0x43b6('0x36')]['offset']);}return _0x2a79ae[_0x43b6('0x88')](_0x3ed177);}})[_0x43b6('0x27')](function(_0x2db2ee){if(_0x2db2ee){return _0x2db2ee?{'count':_0x25f925,'rows':_0x2db2ee}:null;}})[_0x43b6('0x27')](respondWithResult(_0x9744ed,null))[_0x43b6('0x47')](handleError(_0x9744ed,null));}; \ No newline at end of file +var _0xb722=['type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','merge','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','union','compact','forEach','emit','userSmsQueue:remove','addAgents','omit','removeAgents','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','undefined','offset','count','limit','status','Content-Range','json','reject','save','update','then','get','SmsQueues','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName'];(function(_0x3afb25,_0x5be96c){var _0x108fa4=function(_0x557cc7){while(--_0x557cc7){_0x3afb25['push'](_0x3afb25['shift']());}};_0x108fa4(++_0x5be96c);}(_0xb722,0x1e1));var _0x2b72=function(_0x423623,_0x3a45bb){_0x423623=_0x423623-0x0;var _0x5573ab=_0xb722[_0x423623];return _0x5573ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b72('0x0'));var zipdir=require(_0x2b72('0x1'));var jsonpatch=require(_0x2b72('0x2'));var rp=require(_0x2b72('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b72('0x4'));var util=require('util');var path=require(_0x2b72('0x5'));var sox=require('sox');var csv=require(_0x2b72('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b72('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b72('0x8'));var jsforce=require(_0x2b72('0x9'));var deskjs=require(_0x2b72('0xa'));var toCsv=require(_0x2b72('0x6'));var querystring=require(_0x2b72('0xb'));var Papa=require(_0x2b72('0xc'));var Redis=require(_0x2b72('0xd'));var authService=require(_0x2b72('0xe'));var qs=require(_0x2b72('0xf'));var as=require(_0x2b72('0x10'));var hardwareService=require(_0x2b72('0x11'));var logger=require(_0x2b72('0x12'))(_0x2b72('0x13'));var utils=require(_0x2b72('0x14'));var config=require(_0x2b72('0x15'));var licenseUtil=require(_0x2b72('0x16'));var db=require(_0x2b72('0x17'))['db'];config[_0x2b72('0x18')]=_[_0x2b72('0x19')](config[_0x2b72('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b72('0x1a'))(new Redis(config[_0x2b72('0x18')]));require(_0x2b72('0x1b'))['register'](socket);function respondWithStatusCode(_0x437fc2,_0xf71d47){_0xf71d47=_0xf71d47||0xcc;return function(_0x2ab321){if(_0x2ab321){return _0x437fc2[_0x2b72('0x1c')](_0xf71d47);}return _0x437fc2['status'](_0xf71d47)['end']();};}function respondWithResult(_0x57f96f,_0x468ed4){_0x468ed4=_0x468ed4||0xc8;return function(_0x4d1175){if(_0x4d1175){return _0x57f96f['status'](_0x468ed4)['json'](_0x4d1175);}};}function respondWithFilteredResult(_0x18f27c,_0x511544){return function(_0x5e9247){if(_0x5e9247){var _0x8244b=typeof _0x511544['offset']===_0x2b72('0x1d')&&typeof _0x511544['limit']===_0x2b72('0x1d');var _0x33fe9c=_0x5e9247['count'];var _0x1f07bd=_0x8244b?0x0:_0x511544[_0x2b72('0x1e')];var _0x2a8e82=_0x8244b?_0x5e9247[_0x2b72('0x1f')]:_0x511544[_0x2b72('0x1e')]+_0x511544[_0x2b72('0x20')];var _0x1c6a59;if(_0x2a8e82>=_0x33fe9c){_0x2a8e82=_0x33fe9c;_0x1c6a59=0xc8;}else{_0x1c6a59=0xce;}_0x18f27c[_0x2b72('0x21')](_0x1c6a59);return _0x18f27c['set'](_0x2b72('0x22'),_0x1f07bd+'-'+_0x2a8e82+'/'+_0x33fe9c)[_0x2b72('0x23')](_0x5e9247);}return null;};}function patchUpdates(_0x56e443){return function(_0x2da940){try{jsonpatch['apply'](_0x2da940,_0x56e443,!![]);}catch(_0x4a8856){return BPromise[_0x2b72('0x24')](_0x4a8856);}return _0x2da940[_0x2b72('0x25')]();};}function saveUpdates(_0x72e089,_0x5b1efb){return function(_0x204dad){if(_0x204dad){return _0x204dad[_0x2b72('0x26')](_0x72e089)[_0x2b72('0x27')](function(_0x4b3a65){return _0x4b3a65;});}return null;};}function removeEntity(_0x3496fc,_0x5d6bea){return function(_0x29ad84){if(_0x29ad84){return _0x29ad84['destroy']()[_0x2b72('0x27')](function(){var _0x3d603d=_0x29ad84[_0x2b72('0x28')]({'plain':!![]});var _0xa8d454=_0x2b72('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0xa8d454,'resourceId':_0x3d603d['id']}})[_0x2b72('0x27')](function(){return _0x29ad84;});})[_0x2b72('0x27')](function(){_0x3496fc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12a684,_0x18d640){return function(_0x2ea699){if(!_0x2ea699){_0x12a684['sendStatus'](0x194);}return _0x2ea699;};}function handleError(_0x48d3b0,_0x1a76a4){_0x1a76a4=_0x1a76a4||0x1f4;return function(_0x2ffce5){logger[_0x2b72('0x2a')](_0x2ffce5[_0x2b72('0x2b')]);if(_0x2ffce5[_0x2b72('0x2c')]){delete _0x2ffce5[_0x2b72('0x2c')];}_0x48d3b0['status'](_0x1a76a4)[_0x2b72('0x2d')](_0x2ffce5);};}exports[_0x2b72('0x2e')]=function(_0x3c336c,_0x259b73){var _0x326089={},_0x1fad14={},_0x2960fd={'count':0x0,'rows':[]};var _0x194a49=_[_0x2b72('0x2f')](db[_0x2b72('0x30')][_0x2b72('0x31')],function(_0x580b1a){return{'name':_0x580b1a[_0x2b72('0x32')],'type':_0x580b1a[_0x2b72('0x33')][_0x2b72('0x34')]};});_0x1fad14[_0x2b72('0x35')]=_['map'](_0x194a49,_0x2b72('0x2c'));_0x1fad14['query']=_[_0x2b72('0x36')](_0x3c336c['query']);_0x1fad14[_0x2b72('0x37')]=_[_0x2b72('0x38')](_0x1fad14[_0x2b72('0x35')],_0x1fad14[_0x2b72('0x39')]);_0x326089[_0x2b72('0x3a')]=_[_0x2b72('0x38')](_0x1fad14[_0x2b72('0x35')],qs[_0x2b72('0x3b')](_0x3c336c[_0x2b72('0x39')][_0x2b72('0x3b')]));_0x326089['attributes']=_0x326089[_0x2b72('0x3a')][_0x2b72('0x3c')]?_0x326089[_0x2b72('0x3a')]:_0x1fad14[_0x2b72('0x35')];if(!_0x3c336c[_0x2b72('0x39')][_0x2b72('0x3d')](_0x2b72('0x3e'))){_0x326089['limit']=qs['limit'](_0x3c336c['query'][_0x2b72('0x20')]);_0x326089[_0x2b72('0x1e')]=qs[_0x2b72('0x1e')](_0x3c336c[_0x2b72('0x39')]['offset']);}_0x326089[_0x2b72('0x3f')]=qs['sort'](_0x3c336c[_0x2b72('0x39')][_0x2b72('0x40')]);_0x326089[_0x2b72('0x41')]=qs[_0x2b72('0x37')](_[_0x2b72('0x42')](_0x3c336c[_0x2b72('0x39')],_0x1fad14[_0x2b72('0x37')]),_0x194a49);if(_0x3c336c[_0x2b72('0x39')][_0x2b72('0x43')]){_0x326089[_0x2b72('0x41')]=_['merge'](_0x326089[_0x2b72('0x41')],{'$or':_['map'](_0x194a49,function(_0x5c1ffe){if(_0x5c1ffe[_0x2b72('0x33')]!==_0x2b72('0x44')){var _0x41b7ce={};_0x41b7ce[_0x5c1ffe[_0x2b72('0x2c')]]={'$like':'%'+_0x3c336c[_0x2b72('0x39')][_0x2b72('0x43')]+'%'};return _0x41b7ce;}})});}_0x326089=_['merge']({},_0x326089,_0x3c336c[_0x2b72('0x45')]);var _0x2aa49a={'where':_0x326089[_0x2b72('0x41')]};return db['SmsQueue'][_0x2b72('0x1f')](_0x2aa49a)[_0x2b72('0x27')](function(_0x238418){_0x2960fd[_0x2b72('0x1f')]=_0x238418;if(_0x3c336c['query']['includeAll']){_0x326089[_0x2b72('0x46')]=[{'all':!![]}];}return db['SmsQueue'][_0x2b72('0x47')](_0x326089);})[_0x2b72('0x27')](function(_0x340c3c){_0x2960fd[_0x2b72('0x48')]=_0x340c3c;return _0x2960fd;})[_0x2b72('0x27')](respondWithFilteredResult(_0x259b73,_0x326089))[_0x2b72('0x49')](handleError(_0x259b73,null));};exports[_0x2b72('0x4a')]=function(_0x18311a,_0x5433b5){var _0x340a58={'raw':!![],'where':{'id':_0x18311a[_0x2b72('0x4b')]['id']}},_0x4fced8={};_0x4fced8[_0x2b72('0x35')]=_[_0x2b72('0x36')](db[_0x2b72('0x30')]['rawAttributes']);_0x4fced8['query']=_[_0x2b72('0x36')](_0x18311a[_0x2b72('0x39')]);_0x4fced8[_0x2b72('0x37')]=_[_0x2b72('0x38')](_0x4fced8['model'],_0x4fced8[_0x2b72('0x39')]);_0x340a58[_0x2b72('0x3a')]=_[_0x2b72('0x38')](_0x4fced8[_0x2b72('0x35')],qs['fields'](_0x18311a[_0x2b72('0x39')][_0x2b72('0x3b')]));_0x340a58[_0x2b72('0x3a')]=_0x340a58[_0x2b72('0x3a')][_0x2b72('0x3c')]?_0x340a58[_0x2b72('0x3a')]:_0x4fced8['model'];if(_0x18311a[_0x2b72('0x39')][_0x2b72('0x4c')]){_0x340a58[_0x2b72('0x46')]=[{'all':!![]}];}_0x340a58=_['merge']({},_0x340a58,_0x18311a[_0x2b72('0x45')]);return db[_0x2b72('0x30')][_0x2b72('0x4d')](_0x340a58)[_0x2b72('0x27')](handleEntityNotFound(_0x5433b5,null))[_0x2b72('0x27')](respondWithResult(_0x5433b5,null))[_0x2b72('0x49')](handleError(_0x5433b5,null));};exports[_0x2b72('0x4e')]=function(_0x5d7876,_0x12246c){return db['SmsQueue'][_0x2b72('0x4e')](_0x5d7876[_0x2b72('0x4f')],{})['then'](function(_0x351bf1){var _0x1c1408=_0x5d7876['user'][_0x2b72('0x28')]({'plain':!![]});if(!_0x1c1408)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c1408['role']===_0x2b72('0x50')){var _0x1af1ca=_0x351bf1[_0x2b72('0x28')]({'plain':!![]});var _0x561b05=_0x2b72('0x29');return db[_0x2b72('0x51')][_0x2b72('0x4d')]({'where':{'name':_0x561b05,'userProfileId':_0x1c1408[_0x2b72('0x52')]},'raw':!![]})[_0x2b72('0x27')](function(_0x92b4b){if(_0x92b4b&&_0x92b4b[_0x2b72('0x53')]===0x0){return db['UserProfileResource'][_0x2b72('0x4e')]({'name':_0x1af1ca[_0x2b72('0x2c')],'resourceId':_0x1af1ca['id'],'type':_0x92b4b[_0x2b72('0x2c')],'sectionId':_0x92b4b['id']},{})[_0x2b72('0x27')](function(){return _0x351bf1;});}else{return _0x351bf1;}})[_0x2b72('0x49')](function(_0x377f69){logger[_0x2b72('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x377f69);throw _0x377f69;});}return _0x351bf1;})['then'](respondWithResult(_0x12246c,0xc9))['catch'](handleError(_0x12246c,null));};exports[_0x2b72('0x26')]=function(_0x350b40,_0xbecd2f){if(_0x350b40[_0x2b72('0x4f')]['id']){delete _0x350b40[_0x2b72('0x4f')]['id'];}return db[_0x2b72('0x30')][_0x2b72('0x4d')]({'where':{'id':_0x350b40[_0x2b72('0x4b')]['id']}})[_0x2b72('0x27')](handleEntityNotFound(_0xbecd2f,null))[_0x2b72('0x27')](saveUpdates(_0x350b40[_0x2b72('0x4f')],null))[_0x2b72('0x27')](respondWithResult(_0xbecd2f,null))['catch'](handleError(_0xbecd2f,null));};exports['destroy']=function(_0x45064e,_0x4d4466){return db[_0x2b72('0x30')][_0x2b72('0x4d')]({'where':{'id':_0x45064e['params']['id']}})['then'](handleEntityNotFound(_0x4d4466,null))[_0x2b72('0x27')](removeEntity(_0x4d4466,null))[_0x2b72('0x49')](handleError(_0x4d4466,null));};exports[_0x2b72('0x54')]=function(_0x6e154,_0x24ae6c){return db[_0x2b72('0x30')][_0x2b72('0x54')]()[_0x2b72('0x27')](respondWithResult(_0x24ae6c,null))[_0x2b72('0x49')](handleError(_0x24ae6c,null));};exports[_0x2b72('0x55')]=function(_0x1fd440,_0x5489ba,_0x299840){var _0x35ffaa={'raw':!![],'where':{}},_0x3c5591={},_0x176b06;return db[_0x2b72('0x30')][_0x2b72('0x56')]({'where':{'id':_0x1fd440[_0x2b72('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5489ba,null))[_0x2b72('0x27')](function(_0x264c07){if(_0x264c07){_0x176b06=_0x264c07[_0x2b72('0x28')]({'plain':!![]});_0x3c5591[_0x2b72('0x35')]=_['keys'](db[_0x2b72('0x57')][_0x2b72('0x31')]);_0x3c5591[_0x2b72('0x39')]=_['keys'](_0x1fd440['query']);_0x3c5591['filters']=_['intersection'](_0x3c5591[_0x2b72('0x35')],_0x3c5591[_0x2b72('0x39')]);_0x35ffaa[_0x2b72('0x3a')]=_[_0x2b72('0x38')](_0x3c5591[_0x2b72('0x35')],qs['fields'](_0x1fd440[_0x2b72('0x39')][_0x2b72('0x3b')]));_0x35ffaa[_0x2b72('0x3a')]=_0x35ffaa[_0x2b72('0x3a')][_0x2b72('0x3c')]?_0x35ffaa[_0x2b72('0x3a')]:_0x3c5591[_0x2b72('0x35')];if(!_0x1fd440['query'][_0x2b72('0x3d')]('nolimit')){_0x35ffaa[_0x2b72('0x20')]=qs['limit'](_0x1fd440[_0x2b72('0x39')][_0x2b72('0x20')]);_0x35ffaa[_0x2b72('0x1e')]=qs[_0x2b72('0x1e')](_0x1fd440[_0x2b72('0x39')]['offset']);}_0x35ffaa['order']=qs[_0x2b72('0x40')](_0x1fd440[_0x2b72('0x39')][_0x2b72('0x40')]);_0x35ffaa[_0x2b72('0x41')]=qs[_0x2b72('0x37')](_[_0x2b72('0x42')](_0x1fd440['query'],_0x3c5591['filters']));_0x35ffaa['where'][_0x2b72('0x58')]=_0x264c07['id'];if(_0x1fd440[_0x2b72('0x39')][_0x2b72('0x43')]){_0x35ffaa[_0x2b72('0x41')]=_[_0x2b72('0x59')](_0x35ffaa[_0x2b72('0x41')],{'$or':_['map'](_0x35ffaa[_0x2b72('0x3a')],function(_0x32c797){var _0x45305c={};_0x45305c[_0x32c797]={'$like':'%'+_0x1fd440[_0x2b72('0x39')]['filter']+'%'};return _0x45305c;})});}_0x35ffaa=_[_0x2b72('0x59')]({},_0x35ffaa,_0x1fd440[_0x2b72('0x45')]);return db[_0x2b72('0x57')]['findAll'](_0x35ffaa);}})['then'](function(_0x4dab76){if(_0x4dab76){return db[_0x2b72('0x5a')][_0x2b72('0x5b')]({'where':{'id':_[_0x2b72('0x2f')](_0x4dab76,_0x2b72('0x5c')),'role':'agent'},'attributes':['id',_0x2b72('0x2c'),_0x2b72('0x5d'),_0x2b72('0x5e'),_0x2b72('0x5f')]});}})[_0x2b72('0x27')](function(_0x5c6a94){if(_0x5c6a94){return{'count':_0x5c6a94['count'],'rows':_[_0x2b72('0x2f')](_0x5c6a94['rows'],function(_0x44c6cd){return{'membername':_0x44c6cd[_0x2b72('0x2c')],'UserId':_0x44c6cd['id'],'queue_name':_0x176b06[_0x2b72('0x2c')],'SmsQueueId':_0x176b06['id'],'interface':util[_0x2b72('0x60')](_0x2b72('0x61'),_0x2b72('0x62'),_0x44c6cd[_0x2b72('0x2c')]),'penalty':0x0,'paused':_0x44c6cd['smsPause'],'createdAt':_0x44c6cd[_0x2b72('0x5f')],'updatedAt':_0x44c6cd[_0x2b72('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b72('0x27')](respondWithFilteredResult(_0x5489ba,_0x35ffaa))[_0x2b72('0x49')](handleError(_0x5489ba,null));};exports[_0x2b72('0x63')]=function(_0x1eb355,_0x2a3d1a,_0x1ba449){var _0x2850c0={};var _0x304bde={};var _0x1b2d4f;var _0x49d77d;return db[_0x2b72('0x30')][_0x2b72('0x56')]({'where':{'id':_0x1eb355['params']['id']}})[_0x2b72('0x27')](handleEntityNotFound(_0x2a3d1a,null))[_0x2b72('0x27')](function(_0x4b9c79){if(_0x4b9c79){_0x1b2d4f=_0x4b9c79;_0x304bde['model']=_[_0x2b72('0x36')](db[_0x2b72('0x64')][_0x2b72('0x31')]);_0x304bde[_0x2b72('0x39')]=_['keys'](_0x1eb355[_0x2b72('0x39')]);_0x304bde[_0x2b72('0x37')]=_[_0x2b72('0x38')](_0x304bde[_0x2b72('0x35')],_0x304bde[_0x2b72('0x39')]);_0x2850c0[_0x2b72('0x3a')]=_[_0x2b72('0x38')](_0x304bde[_0x2b72('0x35')],qs[_0x2b72('0x3b')](_0x1eb355['query'][_0x2b72('0x3b')]));_0x2850c0[_0x2b72('0x3a')]=_0x2850c0['attributes'][_0x2b72('0x3c')]?_0x2850c0[_0x2b72('0x3a')]:_0x304bde[_0x2b72('0x35')];_0x2850c0['order']=qs['sort'](_0x1eb355['query'][_0x2b72('0x40')]);_0x2850c0[_0x2b72('0x41')]=qs[_0x2b72('0x37')](_['pick'](_0x1eb355['query'],_0x304bde[_0x2b72('0x37')]));if(_0x1eb355[_0x2b72('0x39')][_0x2b72('0x43')]){_0x2850c0[_0x2b72('0x41')]=_[_0x2b72('0x59')](_0x2850c0[_0x2b72('0x41')],{'$or':_[_0x2b72('0x2f')](_0x2850c0['attributes'],function(_0x507f69){var _0x244ed8={};_0x244ed8[_0x507f69]={'$like':'%'+_0x1eb355[_0x2b72('0x39')][_0x2b72('0x43')]+'%'};return _0x244ed8;})});}_0x2850c0=_[_0x2b72('0x59')]({},_0x2850c0,_0x1eb355['options']);return _0x1b2d4f['getTeams'](_0x2850c0);}})[_0x2b72('0x27')](function(_0x26eb75){if(_0x26eb75){_0x49d77d=_0x26eb75[_0x2b72('0x3c')];if(!_0x1eb355[_0x2b72('0x39')]['hasOwnProperty'](_0x2b72('0x3e'))){_0x2850c0[_0x2b72('0x20')]=qs['limit'](_0x1eb355[_0x2b72('0x39')][_0x2b72('0x20')]);_0x2850c0[_0x2b72('0x1e')]=qs[_0x2b72('0x1e')](_0x1eb355['query'][_0x2b72('0x1e')]);}return _0x1b2d4f['getTeams'](_0x2850c0);}})[_0x2b72('0x27')](function(_0x1e14ba){if(_0x1e14ba){return _0x1e14ba?{'count':_0x49d77d,'rows':_0x1e14ba}:null;}})[_0x2b72('0x27')](respondWithResult(_0x2a3d1a,null))[_0x2b72('0x49')](handleError(_0x2a3d1a,null));};exports[_0x2b72('0x65')]=function(_0x536121,_0x3fd700,_0x4415ba){var _0xfbe230=_0x536121[_0x2b72('0x4f')]['ids'];return db[_0x2b72('0x64')]['findAll']({'where':{'id':_0xfbe230},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2b72('0x66'),'attributes':['id',_0x2b72('0x2c'),_0x2b72('0x67'),_0x2b72('0x68'),_0x2b72('0x69')],'raw':!![]}]})[_0x2b72('0x27')](function(_0xc9ed2c){if(_0xc9ed2c){var _0x147f78=_['flatMap'](_0xc9ed2c,function(_0xf3b1cc){var _0x1354fd=_0xf3b1cc[_0x2b72('0x28')]({'plain':!![]});return _0x1354fd[_0x2b72('0x66')];});return db[_0x2b72('0x30')][_0x2b72('0x4d')]({'where':{'id':_0x536121[_0x2b72('0x4b')]['id']}})[_0x2b72('0x27')](function(_0x1c875d){return db[_0x2b72('0x6a')][_0x2b72('0x6b')](function(_0x1e8168){return _0x1c875d[_0x2b72('0x65')](_0xfbe230,{'transaction':_0x1e8168})[_0x2b72('0x27')](function(){return BPromise[_0x2b72('0x6c')](_0x147f78,function(_0x8114e2){return db[_0x2b72('0x57')][_0x2b72('0x6d')]({'where':{'UserId':_0x8114e2['id'],'SmsQueueId':_0x536121[_0x2b72('0x4b')]['id']},'transaction':_0x1e8168});});})['then'](function(){_0x147f78['forEach'](function(_0x28e038){socket['emit'](_0x2b72('0x6e'),{'UserId':_0x28e038['id'],'SmsQueueId':_0x1c875d['id']});});});});});}})[_0x2b72('0x27')](respondWithStatusCode(_0x3fd700,null))[_0x2b72('0x49')](handleError(_0x3fd700,null));};exports[_0x2b72('0x6f')]=function(_0x386679,_0x32ad54,_0x48343a){return db[_0x2b72('0x64')][_0x2b72('0x47')]({'where':{'id':_0x386679[_0x2b72('0x39')][_0x2b72('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2b72('0x66'),'attributes':['id'],'raw':!![]}]})[_0x2b72('0x27')](handleEntityNotFound(_0x32ad54,null))[_0x2b72('0x27')](function(_0x182971){var _0x5e76c5=_[_0x2b72('0x2f')](_0x182971,'id');var _0x4268e1=[];var _0x2e99d1=[];var _0xbbc3d7=squel['select']();_0xbbc3d7[_0x2b72('0x71')](_0x2b72('0x72'))[_0x2b72('0x73')]('team_has_sms_queues','tq')[_0x2b72('0x74')]('user_has_teams','ut',_0x2b72('0x75'))[_0x2b72('0x41')]('SmsQueueId\x20=\x20?',_0x386679[_0x2b72('0x4b')]['id']);for(var _0x3be59e=0x0;_0x3be59e<_0x182971[_0x2b72('0x3c')];_0x3be59e+=0x1){let _0x46f118=_0x182971[_0x3be59e];for(var _0x41e5ef=0x0;_0x41e5ef<_0x46f118[_0x2b72('0x66')][_0x2b72('0x3c')];_0x41e5ef+=0x1){let _0x180c96=_0x46f118[_0x2b72('0x66')][_0x41e5ef];var _0x379035=_0xbbc3d7['clone']();_0x379035['where'](_0x2b72('0x76'),_0x180c96['id']);_0x2e99d1[_0x2b72('0x77')](db[_0x2b72('0x6a')][_0x2b72('0x39')](_0x379035[_0x2b72('0x78')](),{'type':db[_0x2b72('0x6a')][_0x2b72('0x79')]['SELECT']})[_0x2b72('0x27')](function(_0x424d94){if(_0x424d94[_0x2b72('0x3c')]===0x1){return _0x180c96['id'];}else{var _0x2b1f64=_['every'](_[_0x2b72('0x2f')](_0x424d94,_0x2b72('0x7a')),function(_0x847f0a){return _[_0x2b72('0x7b')](_0x5e76c5,_0x847f0a);});if(_0x2b1f64){return _0x180c96['id'];}}}));}}return BPromise['all'](_0x2e99d1)[_0x2b72('0x27')](function(_0x2d15b9){_0x4268e1=_(_0x4268e1)[_0x2b72('0x7c')](_0x2d15b9)[_0x2b72('0x7d')]()['value']();return db[_0x2b72('0x30')][_0x2b72('0x4d')]({'where':{'id':_0x386679[_0x2b72('0x4b')]['id']}})[_0x2b72('0x27')](function(_0x55d807){return db['sequelize']['transaction'](function(_0x41f95c){return _0x55d807[_0x2b72('0x6f')](_0x386679[_0x2b72('0x39')][_0x2b72('0x70')],{'transaction':_0x41f95c})[_0x2b72('0x27')](function(){if(!_['isEmpty'](_0x4268e1)){return _0x55d807['removeAgents'](_0x4268e1,{'transaction':_0x41f95c});}})[_0x2b72('0x27')](function(){_0x4268e1[_0x2b72('0x7e')](function(_0x3ee294){socket[_0x2b72('0x7f')](_0x2b72('0x80'),{'UserId':_0x3ee294,'SmsQueueId':_0x55d807['id']});});});});});});})[_0x2b72('0x27')](respondWithStatusCode(_0x32ad54,null))[_0x2b72('0x49')](handleError(_0x32ad54,null));};exports[_0x2b72('0x81')]=function(_0x1fc488,_0xc1e9b8,_0x16d26a){return db[_0x2b72('0x30')][_0x2b72('0x4d')]({'where':{'id':_0x1fc488['params']['id']}})['then'](handleEntityNotFound(_0xc1e9b8,null))[_0x2b72('0x27')](function(_0x58a004){if(_0x58a004){return _0x58a004[_0x2b72('0x81')](_0x1fc488[_0x2b72('0x4f')][_0x2b72('0x70')],_[_0x2b72('0x82')](_0x1fc488['body'],[_0x2b72('0x70'),'id'])||{})['spread'](function(_0x30777f){for(var _0x547435=0x0;_0x547435<_0x1fc488['body']['ids'][_0x2b72('0x3c')];_0x547435+=0x1){socket['emit'](_0x2b72('0x6e'),{'UserId':Number(_0x1fc488['body'][_0x2b72('0x70')][_0x547435]),'SmsQueueId':Number(_0x1fc488[_0x2b72('0x4b')]['id'])});}return _0x30777f;});}})[_0x2b72('0x27')](respondWithResult(_0xc1e9b8,null))['catch'](handleError(_0xc1e9b8,null));};exports[_0x2b72('0x83')]=function(_0x2ea55d,_0x280936,_0xf53f8){return db[_0x2b72('0x30')][_0x2b72('0x4d')]({'where':{'id':_0x2ea55d['params']['id']}})['then'](handleEntityNotFound(_0x280936,null))['then'](function(_0x16bbf3){if(_0x16bbf3){return _0x16bbf3[_0x2b72('0x83')](_0x2ea55d[_0x2b72('0x39')][_0x2b72('0x70')])[_0x2b72('0x27')](function(){if(_['isArray'](_0x2ea55d['query'][_0x2b72('0x70')])){for(var _0x4508db=0x0;_0x4508db<_0x2ea55d[_0x2b72('0x39')][_0x2b72('0x70')][_0x2b72('0x3c')];_0x4508db+=0x1){socket[_0x2b72('0x7f')]('userSmsQueue:remove',{'UserId':Number(_0x2ea55d[_0x2b72('0x39')][_0x2b72('0x70')][_0x4508db]),'SmsQueueId':Number(_0x2ea55d['params']['id'])});}}else{socket[_0x2b72('0x7f')](_0x2b72('0x80'),{'UserId':Number(_0x2ea55d[_0x2b72('0x39')][_0x2b72('0x70')]),'SmsQueueId':Number(_0x2ea55d[_0x2b72('0x4b')]['id'])});}});}})[_0x2b72('0x27')](respondWithStatusCode(_0x280936,null))['catch'](handleError(_0x280936,null));};exports[_0x2b72('0x84')]=function(_0x49834a,_0x293573,_0xf1fc7e){var _0x41502c={};var _0xfacdde={};var _0x18f198;var _0x132fdd;return db[_0x2b72('0x30')][_0x2b72('0x56')]({'where':{'id':_0x49834a['params']['id']}})[_0x2b72('0x27')](handleEntityNotFound(_0x293573,null))['then'](function(_0x5d2dab){if(_0x5d2dab){_0x18f198=_0x5d2dab;_0xfacdde[_0x2b72('0x35')]=_[_0x2b72('0x36')](db[_0x2b72('0x5a')]['rawAttributes']);_0xfacdde['query']=_[_0x2b72('0x36')](_0x49834a[_0x2b72('0x39')]);_0xfacdde[_0x2b72('0x37')]=_[_0x2b72('0x38')](_0xfacdde[_0x2b72('0x35')],_0xfacdde[_0x2b72('0x39')]);_0x41502c[_0x2b72('0x3a')]=_[_0x2b72('0x38')](_0xfacdde[_0x2b72('0x35')],qs['fields'](_0x49834a[_0x2b72('0x39')]['fields']));_0x41502c['attributes']=_0x41502c[_0x2b72('0x3a')][_0x2b72('0x3c')]?_0x41502c[_0x2b72('0x3a')]:_0xfacdde['model'];_0x41502c[_0x2b72('0x3f')]=qs[_0x2b72('0x40')](_0x49834a[_0x2b72('0x39')][_0x2b72('0x40')]);_0x41502c['where']=qs[_0x2b72('0x37')](_[_0x2b72('0x42')](_0x49834a['query'],_0xfacdde[_0x2b72('0x37')]));if(_0x49834a['query']['filter']){_0x41502c['where']=_[_0x2b72('0x59')](_0x41502c[_0x2b72('0x41')],{'$or':_[_0x2b72('0x2f')](_0x41502c[_0x2b72('0x3a')],function(_0x41e323){var _0x4151a9={};_0x4151a9[_0x41e323]={'$like':'%'+_0x49834a['query'][_0x2b72('0x43')]+'%'};return _0x4151a9;})});}_0x41502c=_['merge']({},_0x41502c,_0x49834a[_0x2b72('0x45')]);return _0x18f198[_0x2b72('0x84')](_0x41502c);}})[_0x2b72('0x27')](function(_0x109585){if(_0x109585){_0x132fdd=_0x109585[_0x2b72('0x3c')];if(!_0x49834a[_0x2b72('0x39')]['hasOwnProperty']('nolimit')){_0x41502c[_0x2b72('0x20')]=qs['limit'](_0x49834a[_0x2b72('0x39')][_0x2b72('0x20')]);_0x41502c['offset']=qs['offset'](_0x49834a[_0x2b72('0x39')][_0x2b72('0x1e')]);}return _0x18f198[_0x2b72('0x84')](_0x41502c);}})['then'](function(_0x2684cb){if(_0x2684cb){return _0x2684cb?{'count':_0x132fdd,'rows':_0x2684cb}:null;}})['then'](respondWithResult(_0x293573,null))[_0x2b72('0x49')](handleError(_0x293573,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 320f8cc..a680b26 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 _0x7b11=['update','remove','emit','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x3ab14c,_0x31d526){var _0x4946e6=function(_0x1c112e){while(--_0x1c112e){_0x3ab14c['push'](_0x3ab14c['shift']());}};_0x4946e6(++_0x31d526);}(_0x7b11,0x6c));var _0x17b1=function(_0x375f7b,_0x5be5d3){_0x375f7b=_0x375f7b-0x0;var _0x16e503=_0x7b11[_0x375f7b];return _0x16e503;};'use strict';var EventEmitter=require(_0x17b1('0x0'));var SmsQueue=require(_0x17b1('0x1'))['db'][_0x17b1('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x17b1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x17b1('0x4'),'afterDestroy':_0x17b1('0x5')};function emitEvent(_0xaba21){return function(_0x2b7f64,_0x3e0d2f,_0x1dfe32){SmsQueueEvents[_0x17b1('0x6')](_0xaba21+':'+_0x2b7f64['id'],_0x2b7f64);SmsQueueEvents['emit'](_0xaba21,_0x2b7f64);_0x1dfe32(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x46bc=['emit','exports','events','SmsQueue','setMaxListeners','update','remove'];(function(_0x38646c,_0xc6ec4b){var _0x356872=function(_0x86ab45){while(--_0x86ab45){_0x38646c['push'](_0x38646c['shift']());}};_0x356872(++_0xc6ec4b);}(_0x46bc,0xb1));var _0xc46b=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x46bc[_0x49a57c];return _0x4e0316;};'use strict';var EventEmitter=require(_0xc46b('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc46b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc46b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc46b('0x3'),'afterDestroy':_0xc46b('0x4')};function emitEvent(_0x264137){return function(_0x1af9c9,_0x544f94,_0x28b6c8){SmsQueueEvents[_0xc46b('0x5')](_0x264137+':'+_0x1af9c9['id'],_0x1af9c9);SmsQueueEvents[_0xc46b('0x5')](_0x264137,_0x1af9c9);_0x28b6c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xc46b('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index df50f5f..eb48107 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 _0xd25d=['sms_queues','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xd25d,0x199));var _0xdd25=function(_0x13892e,_0x81a8cf){_0x13892e=_0x13892e-0x0;var _0x636574=_0xd25d[_0x13892e];return _0x636574;};'use strict';var _=require(_0xdd25('0x0'));var util=require(_0xdd25('0x1'));var logger=require(_0xdd25('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd25('0x3'));var fs=require('fs');var path=require(_0xdd25('0x4'));var rimraf=require(_0xdd25('0x5'));var config=require(_0xdd25('0x6'));var attributes=require(_0xdd25('0x7'));module[_0xdd25('0x8')]=function(_0xc3d2f9,_0x4bc672){return _0xc3d2f9[_0xdd25('0x9')](_0xdd25('0xa'),attributes,{'tableName':_0xdd25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf09d=['path','rimraf','./smsQueue.attributes','exports','SmsQueue','util','../../config/logger','moment','request-promise'];(function(_0x28971f,_0x7cce04){var _0x2b34ea=function(_0x3a6bd4){while(--_0x3a6bd4){_0x28971f['push'](_0x28971f['shift']());}};_0x2b34ea(++_0x7cce04);}(_0xf09d,0xd4));var _0xdf09=function(_0x194aa1,_0x2079fe){_0x194aa1=_0x194aa1-0x0;var _0x1675c7=_0xf09d[_0x194aa1];return _0x1675c7;};'use strict';var _=require('lodash');var util=require(_0xdf09('0x0'));var logger=require(_0xdf09('0x1'))('api');var moment=require(_0xdf09('0x2'));var BPromise=require('bluebird');var rp=require(_0xdf09('0x3'));var fs=require('fs');var path=require(_0xdf09('0x4'));var rimraf=require(_0xdf09('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf09('0x6'));module[_0xdf09('0x7')]=function(_0x1745c9,_0x195f5f){return _0x1745c9['define'](_0xdf09('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index c9748b7..ad95419 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 _0xe47c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','include','map','model','attributes','then','find','ShowSmsQueue'];(function(_0xc17ecf,_0x1b550a){var _0xfcdbe=function(_0x12b993){while(--_0x12b993){_0xc17ecf['push'](_0xc17ecf['shift']());}};_0xfcdbe(++_0x1b550a);}(_0xe47c,0xa0));var _0xce47=function(_0x499c61,_0x3a0666){_0x499c61=_0x499c61-0x0;var _0x2eaaae=_0xe47c[_0x499c61];return _0x2eaaae;};'use strict';var _=require(_0xce47('0x0'));var util=require(_0xce47('0x1'));var moment=require(_0xce47('0x2'));var BPromise=require(_0xce47('0x3'));var rs=require(_0xce47('0x4'));var fs=require('fs');var Redis=require(_0xce47('0x5'));var db=require(_0xce47('0x6'))['db'];var utils=require(_0xce47('0x7'));var logger=require(_0xce47('0x8'))('rpc');var config=require(_0xce47('0x9'));var jayson=require(_0xce47('0xa'));var client=jayson['client'][_0xce47('0xb')]({'port':0x232a});config[_0xce47('0xc')]=_[_0xce47('0xd')](config[_0xce47('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xce47('0xe'))(new Redis(config[_0xce47('0xc')]));require(_0xce47('0xf'))[_0xce47('0x10')](socket);function respondWithRpcPromise(_0x44ec58,_0x23cb22,_0x5ba923){return new BPromise(function(_0x3cef12,_0x568cad){return client[_0xce47('0x11')](_0x44ec58,_0x5ba923)['then'](function(_0x2942b3){logger[_0xce47('0x12')]('SmsQueue,\x20%s,\x20%s',_0x23cb22,'request\x20sent');logger[_0xce47('0x13')](_0xce47('0x14'),_0x23cb22,'request\x20sent',JSON[_0xce47('0x15')](_0x2942b3));if(_0x2942b3[_0xce47('0x16')]){if(_0x2942b3['error'][_0xce47('0x17')]===0x1f4){logger[_0xce47('0x16')](_0xce47('0x18'),_0x23cb22,_0x2942b3[_0xce47('0x16')][_0xce47('0x19')]);return _0x568cad(_0x2942b3[_0xce47('0x16')]['message']);}logger[_0xce47('0x16')](_0xce47('0x18'),_0x23cb22,_0x2942b3['error'][_0xce47('0x19')]);return _0x3cef12(_0x2942b3['error'][_0xce47('0x19')]);}else{logger['info'](_0xce47('0x18'),_0x23cb22,'request\x20sent');_0x3cef12(_0x2942b3['result']['message']);}})[_0xce47('0x1a')](function(_0x15ce7e){logger[_0xce47('0x16')](_0xce47('0x18'),_0x23cb22,_0x15ce7e);_0x568cad(_0x15ce7e);});});}exports[_0xce47('0x1b')]=function(_0x405162){var _0x1a4973=this;return new Promise(function(_0x493860,_0x2f670d){return db[_0xce47('0x1c')][_0xce47('0x1d')]({'raw':_0x405162['options']?_0x405162[_0xce47('0x1e')][_0xce47('0x1f')]===undefined?!![]:![]:!![],'where':_0x405162[_0xce47('0x1e')]?_0x405162[_0xce47('0x1e')][_0xce47('0x20')]||null:null,'attributes':_0x405162['options']?_0x405162[_0xce47('0x1e')]['attributes']||null:null,'limit':_0x405162['options']?_0x405162[_0xce47('0x1e')]['limit']||null:null,'include':_0x405162[_0xce47('0x1e')]?_0x405162[_0xce47('0x1e')][_0xce47('0x21')]?_[_0xce47('0x22')](_0x405162['options'][_0xce47('0x21')],function(_0x1fba5b){return{'model':db[_0x1fba5b[_0xce47('0x23')]],'as':_0x1fba5b['as'],'attributes':_0x1fba5b[_0xce47('0x24')],'include':_0x1fba5b[_0xce47('0x21')]?_[_0xce47('0x22')](_0x1fba5b[_0xce47('0x21')],function(_0x58481c){return{'model':db[_0x58481c['model']],'as':_0x58481c['as'],'attributes':_0x58481c[_0xce47('0x24')],'include':_0x58481c['include']?_['map'](_0x58481c[_0xce47('0x21')],function(_0x3e9538){return{'model':db[_0x3e9538['model']],'as':_0x3e9538['as'],'attributes':_0x3e9538[_0xce47('0x24')]};}):[]};}):[]};}):[]:[]})[_0xce47('0x25')](function(_0x20ac17){logger[_0xce47('0x12')](_0xce47('0x1b'),_0x405162);logger['debug'](_0xce47('0x1b'),_0x405162,JSON['stringify'](_0x20ac17));_0x493860(_0x20ac17);})['catch'](function(_0x25ec74){logger['error'](_0xce47('0x1b'),_0x25ec74[_0xce47('0x19')],_0x405162);_0x2f670d(_0x1a4973[_0xce47('0x16')](0x1f4,_0x25ec74['message']));});});};exports['ShowSmsQueue']=function(_0x15d33d){var _0x57a03a=this;return new Promise(function(_0x1fce29,_0x44e75e){return db[_0xce47('0x1c')][_0xce47('0x26')]({'raw':_0x15d33d[_0xce47('0x1e')]?_0x15d33d['options']['raw']===undefined?!![]:![]:!![],'where':_0x15d33d[_0xce47('0x1e')]?_0x15d33d[_0xce47('0x1e')][_0xce47('0x20')]||null:null,'attributes':_0x15d33d[_0xce47('0x1e')]?_0x15d33d[_0xce47('0x1e')][_0xce47('0x24')]||null:null,'include':_0x15d33d[_0xce47('0x1e')]?_0x15d33d[_0xce47('0x1e')][_0xce47('0x21')]?_[_0xce47('0x22')](_0x15d33d[_0xce47('0x1e')][_0xce47('0x21')],function(_0x135296){return{'model':db[_0x135296[_0xce47('0x23')]],'as':_0x135296['as'],'attributes':_0x135296[_0xce47('0x24')],'include':_0x135296[_0xce47('0x21')]?_[_0xce47('0x22')](_0x135296[_0xce47('0x21')],function(_0x3a725d){return{'model':db[_0x3a725d['model']],'as':_0x3a725d['as'],'attributes':_0x3a725d[_0xce47('0x24')],'include':_0x3a725d['include']?_[_0xce47('0x22')](_0x3a725d[_0xce47('0x21')],function(_0x3a42ba){return{'model':db[_0x3a42ba[_0xce47('0x23')]],'as':_0x3a42ba['as'],'attributes':_0x3a42ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x78cf9e){logger[_0xce47('0x12')](_0xce47('0x27'),_0x15d33d);logger[_0xce47('0x13')](_0xce47('0x27'),_0x15d33d,JSON[_0xce47('0x15')](_0x78cf9e));_0x1fce29(_0x78cf9e);})[_0xce47('0x1a')](function(_0x14061c){logger[_0xce47('0x16')](_0xce47('0x27'),_0x14061c[_0xce47('0x19')],_0x15d33d);_0x44e75e(_0x57a03a[_0xce47('0x16')](0x1f4,_0x14061c[_0xce47('0x19')]));});});}; \ No newline at end of file +var _0x33b0=['then','GetSmsQueue','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','info','catch','SmsQueue','findAll','options','where','limit','include','map','model','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33b0,0x10f));var _0x033b=function(_0x3d8a9b,_0x557135){_0x3d8a9b=_0x3d8a9b-0x0;var _0xcb71be=_0x33b0[_0x3d8a9b];return _0xcb71be;};'use strict';var _=require(_0x033b('0x0'));var util=require(_0x033b('0x1'));var moment=require(_0x033b('0x2'));var BPromise=require(_0x033b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x033b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x033b('0x5'));var config=require(_0x033b('0x6'));var jayson=require(_0x033b('0x7'));var client=jayson['client'][_0x033b('0x8')]({'port':0x232a});config['redis']=_[_0x033b('0x9')](config[_0x033b('0xa')],{'host':_0x033b('0xb'),'port':0x18eb});var socket=require(_0x033b('0xc'))(new Redis(config['redis']));require(_0x033b('0xd'))[_0x033b('0xe')](socket);function respondWithRpcPromise(_0x120904,_0x4db3a0,_0x11e526){return new BPromise(function(_0x3a4724,_0x97017f){return client[_0x033b('0xf')](_0x120904,_0x11e526)['then'](function(_0x5cd34f){logger['info'](_0x033b('0x10'),_0x4db3a0,_0x033b('0x11'));logger[_0x033b('0x12')](_0x033b('0x13'),_0x4db3a0,_0x033b('0x11'),JSON['stringify'](_0x5cd34f));if(_0x5cd34f[_0x033b('0x14')]){if(_0x5cd34f[_0x033b('0x14')]['code']===0x1f4){logger[_0x033b('0x14')](_0x033b('0x10'),_0x4db3a0,_0x5cd34f[_0x033b('0x14')][_0x033b('0x15')]);return _0x97017f(_0x5cd34f[_0x033b('0x14')][_0x033b('0x15')]);}logger[_0x033b('0x14')](_0x033b('0x10'),_0x4db3a0,_0x5cd34f['error'][_0x033b('0x15')]);return _0x3a4724(_0x5cd34f[_0x033b('0x14')][_0x033b('0x15')]);}else{logger[_0x033b('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4db3a0,_0x033b('0x11'));_0x3a4724(_0x5cd34f['result']['message']);}})[_0x033b('0x17')](function(_0x2cfb14){logger[_0x033b('0x14')]('SmsQueue,\x20%s,\x20%s',_0x4db3a0,_0x2cfb14);_0x97017f(_0x2cfb14);});});}exports['GetSmsQueue']=function(_0x19bb4b){var _0xf4c29a=this;return new Promise(function(_0x2b7053,_0x24a2d2){return db[_0x033b('0x18')][_0x033b('0x19')]({'raw':_0x19bb4b['options']?_0x19bb4b[_0x033b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19bb4b[_0x033b('0x1a')]?_0x19bb4b[_0x033b('0x1a')][_0x033b('0x1b')]||null:null,'attributes':_0x19bb4b['options']?_0x19bb4b[_0x033b('0x1a')]['attributes']||null:null,'limit':_0x19bb4b[_0x033b('0x1a')]?_0x19bb4b['options'][_0x033b('0x1c')]||null:null,'include':_0x19bb4b[_0x033b('0x1a')]?_0x19bb4b[_0x033b('0x1a')][_0x033b('0x1d')]?_[_0x033b('0x1e')](_0x19bb4b[_0x033b('0x1a')][_0x033b('0x1d')],function(_0x2d82dd){return{'model':db[_0x2d82dd[_0x033b('0x1f')]],'as':_0x2d82dd['as'],'attributes':_0x2d82dd[_0x033b('0x20')],'include':_0x2d82dd[_0x033b('0x1d')]?_[_0x033b('0x1e')](_0x2d82dd[_0x033b('0x1d')],function(_0x422852){return{'model':db[_0x422852[_0x033b('0x1f')]],'as':_0x422852['as'],'attributes':_0x422852[_0x033b('0x20')],'include':_0x422852[_0x033b('0x1d')]?_['map'](_0x422852[_0x033b('0x1d')],function(_0x30e6f3){return{'model':db[_0x30e6f3['model']],'as':_0x30e6f3['as'],'attributes':_0x30e6f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x033b('0x21')](function(_0x40c7b0){logger[_0x033b('0x16')](_0x033b('0x22'),_0x19bb4b);logger[_0x033b('0x12')](_0x033b('0x22'),_0x19bb4b,JSON['stringify'](_0x40c7b0));_0x2b7053(_0x40c7b0);})['catch'](function(_0xc634cf){logger[_0x033b('0x14')](_0x033b('0x22'),_0xc634cf['message'],_0x19bb4b);_0x24a2d2(_0xf4c29a['error'](0x1f4,_0xc634cf[_0x033b('0x15')]));});});};exports[_0x033b('0x23')]=function(_0x25742b){var _0x361b5b=this;return new Promise(function(_0x537e11,_0x25a564){return db[_0x033b('0x18')][_0x033b('0x24')]({'raw':_0x25742b['options']?_0x25742b['options'][_0x033b('0x25')]===undefined?!![]:![]:!![],'where':_0x25742b[_0x033b('0x1a')]?_0x25742b['options'][_0x033b('0x1b')]||null:null,'attributes':_0x25742b[_0x033b('0x1a')]?_0x25742b[_0x033b('0x1a')][_0x033b('0x20')]||null:null,'include':_0x25742b[_0x033b('0x1a')]?_0x25742b[_0x033b('0x1a')][_0x033b('0x1d')]?_[_0x033b('0x1e')](_0x25742b[_0x033b('0x1a')]['include'],function(_0x37c72a){return{'model':db[_0x37c72a[_0x033b('0x1f')]],'as':_0x37c72a['as'],'attributes':_0x37c72a[_0x033b('0x20')],'include':_0x37c72a[_0x033b('0x1d')]?_['map'](_0x37c72a[_0x033b('0x1d')],function(_0x4371a7){return{'model':db[_0x4371a7['model']],'as':_0x4371a7['as'],'attributes':_0x4371a7[_0x033b('0x20')],'include':_0x4371a7[_0x033b('0x1d')]?_['map'](_0x4371a7[_0x033b('0x1d')],function(_0x5750a6){return{'model':db[_0x5750a6[_0x033b('0x1f')]],'as':_0x5750a6['as'],'attributes':_0x5750a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x288234){logger['info'](_0x033b('0x23'),_0x25742b);logger['debug'](_0x033b('0x23'),_0x25742b,JSON['stringify'](_0x288234));_0x537e11(_0x288234);})[_0x033b('0x17')](function(_0x5d818f){logger[_0x033b('0x14')](_0x033b('0x23'),_0x5d818f[_0x033b('0x15')],_0x25742b);_0x25a564(_0x361b5b[_0x033b('0x14')](0x1f4,_0x5d818f[_0x033b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a873e34..b2083cf 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 _0xe20e=['removeListener','register','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x3d321b,_0x5bbe3b){var _0x235c8f=function(_0x3abbdb){while(--_0x3abbdb){_0x3d321b['push'](_0x3d321b['shift']());}};_0x235c8f(++_0x5bbe3b);}(_0xe20e,0x93));var _0xee20=function(_0x55f122,_0x56edaf){_0x55f122=_0x55f122-0x0;var _0x1a28d6=_0xe20e[_0x55f122];return _0x1a28d6;};'use strict';var SmsQueueEvents=require(_0xee20('0x0'));var events=[_0xee20('0x1'),_0xee20('0x2'),_0xee20('0x3')];function createListener(_0x1c2bc8,_0x2022ca){return function(_0xddab3d){_0x2022ca[_0xee20('0x4')](_0x1c2bc8,_0xddab3d);};}function removeListener(_0x14373b,_0x2658dd){return function(){SmsQueueEvents[_0xee20('0x5')](_0x14373b,_0x2658dd);};}exports[_0xee20('0x6')]=function(_0x3f795b){for(var _0x4cfdf6=0x0,_0x276c3a=events['length'];_0x4cfdf6<_0x276c3a;_0x4cfdf6++){var _0x4f9063=events[_0x4cfdf6];var _0x2bc5e3=createListener(_0xee20('0x7')+_0x4f9063,_0x3f795b);SmsQueueEvents['on'](_0x4f9063,_0x2bc5e3);}}; \ No newline at end of file +var _0xfded=['update','removeListener','register','length','smsQueue:','save'];(function(_0x165052,_0x168357){var _0x5dc32e=function(_0x473581){while(--_0x473581){_0x165052['push'](_0x165052['shift']());}};_0x5dc32e(++_0x168357);}(_0xfded,0x185));var _0xdfde=function(_0x200ced,_0x503efa){_0x200ced=_0x200ced-0x0;var _0x28e175=_0xfded[_0x200ced];return _0x28e175;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xdfde('0x0'),'remove',_0xdfde('0x1')];function createListener(_0x189cdc,_0x316df5){return function(_0x2fc332){_0x316df5['emit'](_0x189cdc,_0x2fc332);};}function removeListener(_0x141d31,_0x141c75){return function(){SmsQueueEvents[_0xdfde('0x2')](_0x141d31,_0x141c75);};}exports[_0xdfde('0x3')]=function(_0x8c0c27){for(var _0x1ee122=0x0,_0x398e38=events[_0xdfde('0x4')];_0x1ee122<_0x398e38;_0x1ee122++){var _0x3c947f=events[_0x1ee122];var _0x2884cb=createListener(_0xdfde('0x5')+_0x3c947f,_0x8c0c27);SmsQueueEvents['on'](_0x3c947f,_0x2884cb);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index fe68d78..a865257 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 _0x4680=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util'];(function(_0x5b04a3,_0xfda4fd){var _0x1adf11=function(_0x9e242a){while(--_0x9e242a){_0x5b04a3['push'](_0x5b04a3['shift']());}};_0x1adf11(++_0xfda4fd);}(_0x4680,0x106));var _0x0468=function(_0x265980,_0x346f55){_0x265980=_0x265980-0x0;var _0x3130d3=_0x4680[_0x265980];return _0x3130d3;};'use strict';var multer=require(_0x0468('0x0'));var util=require(_0x0468('0x1'));var path=require(_0x0468('0x2'));var timeout=require(_0x0468('0x3'));var express=require('express');var router=express[_0x0468('0x4')]();var fs_extra=require(_0x0468('0x5'));var auth=require(_0x0468('0x6'));var interaction=require(_0x0468('0x7'));var config=require(_0x0468('0x8'));var controller=require(_0x0468('0x9'));router[_0x0468('0xa')]('/',auth[_0x0468('0xb')](),controller[_0x0468('0xc')]);router['get'](_0x0468('0xd'),auth[_0x0468('0xb')](),controller[_0x0468('0xe')]);router['get'](_0x0468('0xf'),auth[_0x0468('0xb')](),controller[_0x0468('0x10')]);router[_0x0468('0x11')]('/',auth[_0x0468('0xb')](),controller['create']);router[_0x0468('0x12')](_0x0468('0xf'),auth['isAuthenticated'](),controller[_0x0468('0x13')]);router['delete'](_0x0468('0xf'),auth['isAuthenticated'](),controller[_0x0468('0x14')]);module[_0x0468('0x15')]=router; \ No newline at end of file +var _0xf987=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x95c428,_0x54d3e8){var _0x5279fc=function(_0xadc676){while(--_0xadc676){_0x95c428['push'](_0x95c428['shift']());}};_0x5279fc(++_0x54d3e8);}(_0xf987,0x18a));var _0x7f98=function(_0x4a22f6,_0x42c362){_0x4a22f6=_0x4a22f6-0x0;var _0x12e0e9=_0xf987[_0x4a22f6];return _0x12e0e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f98('0x0'));var timeout=require(_0x7f98('0x1'));var express=require('express');var router=express[_0x7f98('0x2')]();var fs_extra=require(_0x7f98('0x3'));var auth=require(_0x7f98('0x4'));var interaction=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var controller=require(_0x7f98('0x7'));router[_0x7f98('0x8')]('/',auth[_0x7f98('0x9')](),controller[_0x7f98('0xa')]);router[_0x7f98('0x8')](_0x7f98('0xb'),auth[_0x7f98('0x9')](),controller['describe']);router[_0x7f98('0x8')](_0x7f98('0xc'),auth[_0x7f98('0x9')](),controller[_0x7f98('0xd')]);router[_0x7f98('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f98('0xf')]);router['put']('/:id',auth[_0x7f98('0x9')](),controller[_0x7f98('0x10')]);router[_0x7f98('0x11')](_0x7f98('0xc'),auth['isAuthenticated'](),controller[_0x7f98('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 28d4a68..18d9d5d 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 _0x035d=['STRING','DATE','moment','sequelize','exports'];(function(_0x1adc05,_0x19d9dc){var _0x5b0cf5=function(_0x3c17b0){while(--_0x3c17b0){_0x1adc05['push'](_0x1adc05['shift']());}};_0x5b0cf5(++_0x19d9dc);}(_0x035d,0x174));var _0xd035=function(_0xa030bb,_0x31bb30){_0xa030bb=_0xa030bb-0x0;var _0x31b1c8=_0x035d[_0xa030bb];return _0x31b1c8;};'use strict';var moment=require(_0xd035('0x0'));var Sequelize=require(_0xd035('0x1'));module[_0xd035('0x2')]={'uniqueid':{'type':Sequelize[_0xd035('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd035('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd035('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd035('0x3')]}}; \ No newline at end of file +var _0x7138=['sequelize','STRING','DATE','moment'];(function(_0x5bb5be,_0x5e237e){var _0x12ac84=function(_0x278991){while(--_0x278991){_0x5bb5be['push'](_0x5bb5be['shift']());}};_0x12ac84(++_0x5e237e);}(_0x7138,0x1df));var _0x8713=function(_0x4be730,_0x341fe4){_0x4be730=_0x4be730-0x0;var _0x54bbe5=_0x7138[_0x4be730];return _0x54bbe5;};'use strict';var moment=require(_0x8713('0x0'));var Sequelize=require(_0x8713('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8713('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8713('0x2')]},'joinAt':{'type':Sequelize[_0x8713('0x3')]},'leaveAt':{'type':Sequelize[_0x8713('0x3')]},'acceptAt':{'type':Sequelize[_0x8713('0x3')]},'exitAt':{'type':Sequelize[_0x8713('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 39a1d01..6faffb7 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 _0xcc76=['show','params','body','catch','find','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','rows'];(function(_0x4b4ce3,_0x13d9ba){var _0x4044a3=function(_0x46f00b){while(--_0x46f00b){_0x4b4ce3['push'](_0x4b4ce3['shift']());}};_0x4044a3(++_0x13d9ba);}(_0xcc76,0x11d));var _0x6cc7=function(_0x18f208,_0x1ce3a0){_0x18f208=_0x18f208-0x0;var _0x2bcc44=_0xcc76[_0x18f208];return _0x2bcc44;};'use strict';var emlformat=require(_0x6cc7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6cc7('0x1'));var rp=require('request-promise');var moment=require(_0x6cc7('0x2'));var BPromise=require(_0x6cc7('0x3'));var Mustache=require(_0x6cc7('0x4'));var util=require('util');var path=require(_0x6cc7('0x5'));var sox=require(_0x6cc7('0x6'));var csv=require(_0x6cc7('0x7'));var ejs=require(_0x6cc7('0x8'));var fs=require('fs');var fs_extra=require(_0x6cc7('0x9'));var _=require(_0x6cc7('0xa'));var squel=require(_0x6cc7('0xb'));var crypto=require(_0x6cc7('0xc'));var jsforce=require(_0x6cc7('0xd'));var deskjs=require(_0x6cc7('0xe'));var toCsv=require(_0x6cc7('0x7'));var querystring=require(_0x6cc7('0xf'));var Papa=require(_0x6cc7('0x10'));var Redis=require(_0x6cc7('0x11'));var authService=require(_0x6cc7('0x12'));var qs=require(_0x6cc7('0x13'));var as=require(_0x6cc7('0x14'));var hardwareService=require(_0x6cc7('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cc7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348775,_0x397f4b){_0x397f4b=_0x397f4b||0xcc;return function(_0x1fe6a9){if(_0x1fe6a9){return _0x348775[_0x6cc7('0x17')](_0x397f4b);}return _0x348775['status'](_0x397f4b)[_0x6cc7('0x18')]();};}function respondWithResult(_0x19e884,_0x3d4dd7){_0x3d4dd7=_0x3d4dd7||0xc8;return function(_0x28a264){if(_0x28a264){return _0x19e884['status'](_0x3d4dd7)['json'](_0x28a264);}};}function respondWithFilteredResult(_0x40a7a6,_0x416d79){return function(_0x37aa44){if(_0x37aa44){var _0x111b87=typeof _0x416d79[_0x6cc7('0x19')]===_0x6cc7('0x1a')&&typeof _0x416d79[_0x6cc7('0x1b')]==='undefined';var _0x279f55=_0x37aa44[_0x6cc7('0x1c')];var _0x4080d3=_0x111b87?0x0:_0x416d79[_0x6cc7('0x19')];var _0x4270d1=_0x111b87?_0x37aa44[_0x6cc7('0x1c')]:_0x416d79[_0x6cc7('0x19')]+_0x416d79[_0x6cc7('0x1b')];var _0x229c20;if(_0x4270d1>=_0x279f55){_0x4270d1=_0x279f55;_0x229c20=0xc8;}else{_0x229c20=0xce;}_0x40a7a6['status'](_0x229c20);return _0x40a7a6['set'](_0x6cc7('0x1d'),_0x4080d3+'-'+_0x4270d1+'/'+_0x279f55)[_0x6cc7('0x1e')](_0x37aa44);}return null;};}function patchUpdates(_0x1da84a){return function(_0x549a66){try{jsonpatch[_0x6cc7('0x1f')](_0x549a66,_0x1da84a,!![]);}catch(_0x3038b6){return BPromise[_0x6cc7('0x20')](_0x3038b6);}return _0x549a66[_0x6cc7('0x21')]();};}function saveUpdates(_0x5783b3,_0x4a864f){return function(_0x5e939c){if(_0x5e939c){return _0x5e939c[_0x6cc7('0x22')](_0x5783b3)['then'](function(_0x8aa318){return _0x8aa318;});}return null;};}function removeEntity(_0x187c9c,_0x20a893){return function(_0x41025a){if(_0x41025a){return _0x41025a[_0x6cc7('0x23')]()['then'](function(){_0x187c9c['status'](0xcc)[_0x6cc7('0x18')]();});}};}function handleEntityNotFound(_0xa60e04,_0x1b1491){return function(_0x21f324){if(!_0x21f324){_0xa60e04[_0x6cc7('0x17')](0x194);}return _0x21f324;};}function handleError(_0x575e8c,_0x14bd35){_0x14bd35=_0x14bd35||0x1f4;return function(_0xde1a4c){logger['error'](_0xde1a4c[_0x6cc7('0x24')]);if(_0xde1a4c[_0x6cc7('0x25')]){delete _0xde1a4c[_0x6cc7('0x25')];}_0x575e8c['status'](_0x14bd35)[_0x6cc7('0x26')](_0xde1a4c);};}exports[_0x6cc7('0x27')]=function(_0x4d24e3,_0x39c940){var _0xbe1c1f={},_0x1d2ed4={},_0x36f40e={'count':0x0,'rows':[]};var _0x42db59=_[_0x6cc7('0x28')](db[_0x6cc7('0x29')][_0x6cc7('0x2a')],function(_0x5659c9){return{'name':_0x5659c9[_0x6cc7('0x2b')],'type':_0x5659c9[_0x6cc7('0x2c')]['key']};});_0x1d2ed4[_0x6cc7('0x2d')]=_[_0x6cc7('0x28')](_0x42db59,_0x6cc7('0x25'));_0x1d2ed4[_0x6cc7('0x2e')]=_[_0x6cc7('0x2f')](_0x4d24e3['query']);_0x1d2ed4[_0x6cc7('0x30')]=_['intersection'](_0x1d2ed4[_0x6cc7('0x2d')],_0x1d2ed4[_0x6cc7('0x2e')]);_0xbe1c1f[_0x6cc7('0x31')]=_[_0x6cc7('0x32')](_0x1d2ed4['model'],qs['fields'](_0x4d24e3[_0x6cc7('0x2e')][_0x6cc7('0x33')]));_0xbe1c1f[_0x6cc7('0x31')]=_0xbe1c1f[_0x6cc7('0x31')][_0x6cc7('0x34')]?_0xbe1c1f[_0x6cc7('0x31')]:_0x1d2ed4[_0x6cc7('0x2d')];if(!_0x4d24e3[_0x6cc7('0x2e')][_0x6cc7('0x35')]('nolimit')){_0xbe1c1f[_0x6cc7('0x1b')]=qs['limit'](_0x4d24e3['query'][_0x6cc7('0x1b')]);_0xbe1c1f[_0x6cc7('0x19')]=qs['offset'](_0x4d24e3[_0x6cc7('0x2e')]['offset']);}_0xbe1c1f['order']=qs[_0x6cc7('0x36')](_0x4d24e3['query'][_0x6cc7('0x36')]);_0xbe1c1f[_0x6cc7('0x37')]=qs['filters'](_[_0x6cc7('0x38')](_0x4d24e3[_0x6cc7('0x2e')],_0x1d2ed4[_0x6cc7('0x30')]),_0x42db59);if(_0x4d24e3[_0x6cc7('0x2e')][_0x6cc7('0x39')]){_0xbe1c1f[_0x6cc7('0x37')]=_[_0x6cc7('0x3a')](_0xbe1c1f[_0x6cc7('0x37')],{'$or':_[_0x6cc7('0x28')](_0x42db59,function(_0x1684e8){if(_0x1684e8[_0x6cc7('0x2c')]!=='VIRTUAL'){var _0x19f0b7={};_0x19f0b7[_0x1684e8['name']]={'$like':'%'+_0x4d24e3[_0x6cc7('0x2e')][_0x6cc7('0x39')]+'%'};return _0x19f0b7;}})});}_0xbe1c1f=_[_0x6cc7('0x3a')]({},_0xbe1c1f,_0x4d24e3[_0x6cc7('0x3b')]);var _0x16e6e5={'where':_0xbe1c1f[_0x6cc7('0x37')]};return db[_0x6cc7('0x29')][_0x6cc7('0x1c')](_0x16e6e5)['then'](function(_0xb07675){_0x36f40e[_0x6cc7('0x1c')]=_0xb07675;if(_0x4d24e3['query'][_0x6cc7('0x3c')]){_0xbe1c1f[_0x6cc7('0x3d')]=[{'all':!![]}];}return db[_0x6cc7('0x29')][_0x6cc7('0x3e')](_0xbe1c1f);})[_0x6cc7('0x3f')](function(_0xba6bf4){_0x36f40e[_0x6cc7('0x40')]=_0xba6bf4;return _0x36f40e;})[_0x6cc7('0x3f')](respondWithFilteredResult(_0x39c940,_0xbe1c1f))['catch'](handleError(_0x39c940,null));};exports[_0x6cc7('0x41')]=function(_0x513186,_0x429a7e){var _0x5f3648={'raw':!![],'where':{'id':_0x513186[_0x6cc7('0x42')]['id']}},_0x3630d4={};_0x3630d4[_0x6cc7('0x2d')]=_[_0x6cc7('0x2f')](db[_0x6cc7('0x29')][_0x6cc7('0x2a')]);_0x3630d4[_0x6cc7('0x2e')]=_[_0x6cc7('0x2f')](_0x513186[_0x6cc7('0x2e')]);_0x3630d4[_0x6cc7('0x30')]=_[_0x6cc7('0x32')](_0x3630d4['model'],_0x3630d4[_0x6cc7('0x2e')]);_0x5f3648['attributes']=_[_0x6cc7('0x32')](_0x3630d4[_0x6cc7('0x2d')],qs[_0x6cc7('0x33')](_0x513186[_0x6cc7('0x2e')]['fields']));_0x5f3648[_0x6cc7('0x31')]=_0x5f3648[_0x6cc7('0x31')][_0x6cc7('0x34')]?_0x5f3648[_0x6cc7('0x31')]:_0x3630d4[_0x6cc7('0x2d')];if(_0x513186[_0x6cc7('0x2e')][_0x6cc7('0x3c')]){_0x5f3648[_0x6cc7('0x3d')]=[{'all':!![]}];}_0x5f3648=_[_0x6cc7('0x3a')]({},_0x5f3648,_0x513186[_0x6cc7('0x3b')]);return db['SmsQueueReport']['find'](_0x5f3648)[_0x6cc7('0x3f')](handleEntityNotFound(_0x429a7e,null))[_0x6cc7('0x3f')](respondWithResult(_0x429a7e,null))['catch'](handleError(_0x429a7e,null));};exports['create']=function(_0x31acaa,_0x3077c5){return db[_0x6cc7('0x29')]['create'](_0x31acaa[_0x6cc7('0x43')],{})[_0x6cc7('0x3f')](respondWithResult(_0x3077c5,0xc9))[_0x6cc7('0x44')](handleError(_0x3077c5,null));};exports[_0x6cc7('0x22')]=function(_0x5271c3,_0x1c4426){if(_0x5271c3[_0x6cc7('0x43')]['id']){delete _0x5271c3[_0x6cc7('0x43')]['id'];}return db[_0x6cc7('0x29')][_0x6cc7('0x45')]({'where':{'id':_0x5271c3[_0x6cc7('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c4426,null))[_0x6cc7('0x3f')](saveUpdates(_0x5271c3[_0x6cc7('0x43')],null))[_0x6cc7('0x3f')](respondWithResult(_0x1c4426,null))[_0x6cc7('0x44')](handleError(_0x1c4426,null));};exports[_0x6cc7('0x23')]=function(_0x485424,_0x84a8fd){return db[_0x6cc7('0x29')]['find']({'where':{'id':_0x485424[_0x6cc7('0x42')]['id']}})['then'](handleEntityNotFound(_0x84a8fd,null))['then'](removeEntity(_0x84a8fd,null))[_0x6cc7('0x44')](handleError(_0x84a8fd,null));};exports['describe']=function(_0x2b6e63,_0x280d09){return db[_0x6cc7('0x29')]['describe']()[_0x6cc7('0x3f')](respondWithResult(_0x280d09,null))[_0x6cc7('0x44')](handleError(_0x280d09,null));}; \ No newline at end of file +var _0x6e28=['lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','filter','options','includeAll','include','findAll','rows','show','params','merge','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs'];(function(_0x2e898a,_0x4ed4ab){var _0x38f49c=function(_0x3c7a1a){while(--_0x3c7a1a){_0x2e898a['push'](_0x2e898a['shift']());}};_0x38f49c(++_0x4ed4ab);}(_0x6e28,0xeb));var _0x86e2=function(_0x23c48a,_0x2bbdbb){_0x23c48a=_0x23c48a-0x0;var _0x90eb60=_0x6e28[_0x23c48a];return _0x90eb60;};'use strict';var emlformat=require(_0x86e2('0x0'));var rimraf=require(_0x86e2('0x1'));var zipdir=require(_0x86e2('0x2'));var jsonpatch=require(_0x86e2('0x3'));var rp=require(_0x86e2('0x4'));var moment=require(_0x86e2('0x5'));var BPromise=require(_0x86e2('0x6'));var Mustache=require('mustache');var util=require(_0x86e2('0x7'));var path=require(_0x86e2('0x8'));var sox=require(_0x86e2('0x9'));var csv=require('to-csv');var ejs=require(_0x86e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86e2('0xb'));var squel=require(_0x86e2('0xc'));var crypto=require(_0x86e2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x86e2('0xe'));var toCsv=require(_0x86e2('0xf'));var querystring=require('querystring');var Papa=require(_0x86e2('0x10'));var Redis=require(_0x86e2('0x11'));var authService=require(_0x86e2('0x12'));var qs=require(_0x86e2('0x13'));var as=require(_0x86e2('0x14'));var hardwareService=require(_0x86e2('0x15'));var logger=require(_0x86e2('0x16'))(_0x86e2('0x17'));var utils=require(_0x86e2('0x18'));var config=require(_0x86e2('0x19'));var licenseUtil=require(_0x86e2('0x1a'));var db=require(_0x86e2('0x1b'))['db'];function respondWithStatusCode(_0x5b37bf,_0x37cb21){_0x37cb21=_0x37cb21||0xcc;return function(_0x132dbd){if(_0x132dbd){return _0x5b37bf[_0x86e2('0x1c')](_0x37cb21);}return _0x5b37bf[_0x86e2('0x1d')](_0x37cb21)[_0x86e2('0x1e')]();};}function respondWithResult(_0x42732c,_0x534b18){_0x534b18=_0x534b18||0xc8;return function(_0x34064c){if(_0x34064c){return _0x42732c['status'](_0x534b18)[_0x86e2('0x1f')](_0x34064c);}};}function respondWithFilteredResult(_0x1a1c3a,_0x46918d){return function(_0x2df329){if(_0x2df329){var _0xe78ede=typeof _0x46918d[_0x86e2('0x20')]===_0x86e2('0x21')&&typeof _0x46918d[_0x86e2('0x22')]===_0x86e2('0x21');var _0x10926b=_0x2df329[_0x86e2('0x23')];var _0x1bb32c=_0xe78ede?0x0:_0x46918d[_0x86e2('0x20')];var _0x384461=_0xe78ede?_0x2df329[_0x86e2('0x23')]:_0x46918d[_0x86e2('0x20')]+_0x46918d[_0x86e2('0x22')];var _0x1b310e;if(_0x384461>=_0x10926b){_0x384461=_0x10926b;_0x1b310e=0xc8;}else{_0x1b310e=0xce;}_0x1a1c3a['status'](_0x1b310e);return _0x1a1c3a[_0x86e2('0x24')](_0x86e2('0x25'),_0x1bb32c+'-'+_0x384461+'/'+_0x10926b)[_0x86e2('0x1f')](_0x2df329);}return null;};}function patchUpdates(_0x496c7f){return function(_0x4efc28){try{jsonpatch[_0x86e2('0x26')](_0x4efc28,_0x496c7f,!![]);}catch(_0x134ba8){return BPromise[_0x86e2('0x27')](_0x134ba8);}return _0x4efc28[_0x86e2('0x28')]();};}function saveUpdates(_0x4e53a3,_0x20c336){return function(_0x5d0d2f){if(_0x5d0d2f){return _0x5d0d2f['update'](_0x4e53a3)[_0x86e2('0x29')](function(_0x411f63){return _0x411f63;});}return null;};}function removeEntity(_0x59af67,_0x4b65f4){return function(_0x3279a9){if(_0x3279a9){return _0x3279a9[_0x86e2('0x2a')]()['then'](function(){_0x59af67[_0x86e2('0x1d')](0xcc)[_0x86e2('0x1e')]();});}};}function handleEntityNotFound(_0x3fab4a,_0x1fa1dc){return function(_0x345c94){if(!_0x345c94){_0x3fab4a[_0x86e2('0x1c')](0x194);}return _0x345c94;};}function handleError(_0x5a1475,_0x20e6cf){_0x20e6cf=_0x20e6cf||0x1f4;return function(_0x2621c1){logger[_0x86e2('0x2b')](_0x2621c1[_0x86e2('0x2c')]);if(_0x2621c1[_0x86e2('0x2d')]){delete _0x2621c1[_0x86e2('0x2d')];}_0x5a1475[_0x86e2('0x1d')](_0x20e6cf)[_0x86e2('0x2e')](_0x2621c1);};}exports[_0x86e2('0x2f')]=function(_0xb1ccb9,_0x40db1c){var _0x322abc={},_0x553fbc={},_0x164ef6={'count':0x0,'rows':[]};var _0x1d1eea=_[_0x86e2('0x30')](db[_0x86e2('0x31')][_0x86e2('0x32')],function(_0x4489ef){return{'name':_0x4489ef[_0x86e2('0x33')],'type':_0x4489ef[_0x86e2('0x34')][_0x86e2('0x35')]};});_0x553fbc[_0x86e2('0x36')]=_[_0x86e2('0x30')](_0x1d1eea,_0x86e2('0x2d'));_0x553fbc[_0x86e2('0x37')]=_[_0x86e2('0x38')](_0xb1ccb9[_0x86e2('0x37')]);_0x553fbc[_0x86e2('0x39')]=_[_0x86e2('0x3a')](_0x553fbc[_0x86e2('0x36')],_0x553fbc[_0x86e2('0x37')]);_0x322abc[_0x86e2('0x3b')]=_['intersection'](_0x553fbc[_0x86e2('0x36')],qs[_0x86e2('0x3c')](_0xb1ccb9[_0x86e2('0x37')]['fields']));_0x322abc[_0x86e2('0x3b')]=_0x322abc[_0x86e2('0x3b')][_0x86e2('0x3d')]?_0x322abc[_0x86e2('0x3b')]:_0x553fbc[_0x86e2('0x36')];if(!_0xb1ccb9['query']['hasOwnProperty'](_0x86e2('0x3e'))){_0x322abc[_0x86e2('0x22')]=qs[_0x86e2('0x22')](_0xb1ccb9[_0x86e2('0x37')]['limit']);_0x322abc[_0x86e2('0x20')]=qs[_0x86e2('0x20')](_0xb1ccb9[_0x86e2('0x37')][_0x86e2('0x20')]);}_0x322abc[_0x86e2('0x3f')]=qs[_0x86e2('0x40')](_0xb1ccb9[_0x86e2('0x37')][_0x86e2('0x40')]);_0x322abc['where']=qs[_0x86e2('0x39')](_[_0x86e2('0x41')](_0xb1ccb9[_0x86e2('0x37')],_0x553fbc[_0x86e2('0x39')]),_0x1d1eea);if(_0xb1ccb9['query']['filter']){_0x322abc[_0x86e2('0x42')]=_['merge'](_0x322abc[_0x86e2('0x42')],{'$or':_[_0x86e2('0x30')](_0x1d1eea,function(_0x3153f6){if(_0x3153f6[_0x86e2('0x34')]!=='VIRTUAL'){var _0x5c79b3={};_0x5c79b3[_0x3153f6[_0x86e2('0x2d')]]={'$like':'%'+_0xb1ccb9[_0x86e2('0x37')][_0x86e2('0x43')]+'%'};return _0x5c79b3;}})});}_0x322abc=_['merge']({},_0x322abc,_0xb1ccb9[_0x86e2('0x44')]);var _0x5aefd1={'where':_0x322abc['where']};return db[_0x86e2('0x31')][_0x86e2('0x23')](_0x5aefd1)[_0x86e2('0x29')](function(_0x21f1fe){_0x164ef6['count']=_0x21f1fe;if(_0xb1ccb9[_0x86e2('0x37')][_0x86e2('0x45')]){_0x322abc[_0x86e2('0x46')]=[{'all':!![]}];}return db[_0x86e2('0x31')][_0x86e2('0x47')](_0x322abc);})[_0x86e2('0x29')](function(_0x568d92){_0x164ef6[_0x86e2('0x48')]=_0x568d92;return _0x164ef6;})[_0x86e2('0x29')](respondWithFilteredResult(_0x40db1c,_0x322abc))['catch'](handleError(_0x40db1c,null));};exports[_0x86e2('0x49')]=function(_0x1492ff,_0x28c69a){var _0x36ee05={'raw':!![],'where':{'id':_0x1492ff[_0x86e2('0x4a')]['id']}},_0x53c079={};_0x53c079[_0x86e2('0x36')]=_[_0x86e2('0x38')](db[_0x86e2('0x31')][_0x86e2('0x32')]);_0x53c079[_0x86e2('0x37')]=_[_0x86e2('0x38')](_0x1492ff['query']);_0x53c079[_0x86e2('0x39')]=_[_0x86e2('0x3a')](_0x53c079[_0x86e2('0x36')],_0x53c079[_0x86e2('0x37')]);_0x36ee05[_0x86e2('0x3b')]=_[_0x86e2('0x3a')](_0x53c079['model'],qs[_0x86e2('0x3c')](_0x1492ff[_0x86e2('0x37')][_0x86e2('0x3c')]));_0x36ee05[_0x86e2('0x3b')]=_0x36ee05[_0x86e2('0x3b')][_0x86e2('0x3d')]?_0x36ee05[_0x86e2('0x3b')]:_0x53c079[_0x86e2('0x36')];if(_0x1492ff[_0x86e2('0x37')][_0x86e2('0x45')]){_0x36ee05[_0x86e2('0x46')]=[{'all':!![]}];}_0x36ee05=_[_0x86e2('0x4b')]({},_0x36ee05,_0x1492ff[_0x86e2('0x44')]);return db['SmsQueueReport'][_0x86e2('0x4c')](_0x36ee05)['then'](handleEntityNotFound(_0x28c69a,null))[_0x86e2('0x29')](respondWithResult(_0x28c69a,null))['catch'](handleError(_0x28c69a,null));};exports[_0x86e2('0x4d')]=function(_0x5b4e52,_0x4768c2){return db[_0x86e2('0x31')][_0x86e2('0x4d')](_0x5b4e52['body'],{})['then'](respondWithResult(_0x4768c2,0xc9))[_0x86e2('0x4e')](handleError(_0x4768c2,null));};exports[_0x86e2('0x4f')]=function(_0x456912,_0x35dd20){if(_0x456912[_0x86e2('0x50')]['id']){delete _0x456912['body']['id'];}return db[_0x86e2('0x31')][_0x86e2('0x4c')]({'where':{'id':_0x456912[_0x86e2('0x4a')]['id']}})[_0x86e2('0x29')](handleEntityNotFound(_0x35dd20,null))[_0x86e2('0x29')](saveUpdates(_0x456912['body'],null))[_0x86e2('0x29')](respondWithResult(_0x35dd20,null))[_0x86e2('0x4e')](handleError(_0x35dd20,null));};exports[_0x86e2('0x2a')]=function(_0x3c2535,_0x584811){return db[_0x86e2('0x31')][_0x86e2('0x4c')]({'where':{'id':_0x3c2535['params']['id']}})[_0x86e2('0x29')](handleEntityNotFound(_0x584811,null))['then'](removeEntity(_0x584811,null))[_0x86e2('0x4e')](handleError(_0x584811,null));};exports[_0x86e2('0x51')]=function(_0x12e2b0,_0xf5f230){return db[_0x86e2('0x31')][_0x86e2('0x51')]()[_0x86e2('0x29')](respondWithResult(_0xf5f230,null))[_0x86e2('0x4e')](handleError(_0xf5f230,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1615dbe..98d1a5e 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x35b0a7,_0x4f78d8){var _0x3792b3=function(_0x17b82c){while(--_0x17b82c){_0x35b0a7['push'](_0x35b0a7['shift']());}};_0x3792b3(++_0x4f78d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xcb91[_0x425716];return _0x2d39af;};'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 +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0xbce09e,_0x50d89d){var _0x281286=function(_0x4ac7ef){while(--_0x4ac7ef){_0xbce09e['push'](_0xbce09e['shift']());}};_0x281286(++_0x50d89d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb7e7[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f066b84..f770b3e 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 _0xbf35=['ioredis','rpc','../../config/environment','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SmsQueueReport','create','body','options','info','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring'];(function(_0x58977c,_0x236363){var _0x117af6=function(_0x131a5f){while(--_0x131a5f){_0x58977c['push'](_0x58977c['shift']());}};_0x117af6(++_0x236363);}(_0xbf35,0x170));var _0x5bf3=function(_0x48321c,_0x34cfa){_0x48321c=_0x48321c-0x0;var _0x3d0bbe=_0xbf35[_0x48321c];return _0x3d0bbe;};'use strict';var _=require(_0x5bf3('0x0'));var util=require('util');var moment=require(_0x5bf3('0x1'));var BPromise=require(_0x5bf3('0x2'));var rs=require(_0x5bf3('0x3'));var fs=require('fs');var Redis=require(_0x5bf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5bf3('0x5'));var config=require(_0x5bf3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5bf3('0x7')][_0x5bf3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1143e1,_0x3d7c80,_0x196f86){return new BPromise(function(_0x56e987,_0x763918){return client[_0x5bf3('0x9')](_0x1143e1,_0x196f86)[_0x5bf3('0xa')](function(_0x4fc5e6){logger['info'](_0x5bf3('0xb'),_0x3d7c80,_0x5bf3('0xc'));logger[_0x5bf3('0xd')](_0x5bf3('0xe'),_0x3d7c80,_0x5bf3('0xc'),JSON[_0x5bf3('0xf')](_0x4fc5e6));if(_0x4fc5e6['error']){if(_0x4fc5e6[_0x5bf3('0x10')][_0x5bf3('0x11')]===0x1f4){logger[_0x5bf3('0x10')](_0x5bf3('0xb'),_0x3d7c80,_0x4fc5e6['error']['message']);return _0x763918(_0x4fc5e6[_0x5bf3('0x10')]['message']);}logger[_0x5bf3('0x10')](_0x5bf3('0xb'),_0x3d7c80,_0x4fc5e6['error'][_0x5bf3('0x12')]);return _0x56e987(_0x4fc5e6[_0x5bf3('0x10')][_0x5bf3('0x12')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x3d7c80,_0x5bf3('0xc'));_0x56e987(_0x4fc5e6['result'][_0x5bf3('0x12')]);}})[_0x5bf3('0x13')](function(_0x26ef15){logger[_0x5bf3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x3d7c80,_0x26ef15);_0x763918(_0x26ef15);});});}exports['CreateSmsQueueReport']=function(_0x16a24f){var _0x444aaa=this;return new Promise(function(_0x46a62a,_0x19d7eb){return db[_0x5bf3('0x14')][_0x5bf3('0x15')](_0x16a24f[_0x5bf3('0x16')],{'raw':_0x16a24f[_0x5bf3('0x17')]?_0x16a24f[_0x5bf3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x5bf3('0xa')](function(_0x2fbf80){logger[_0x5bf3('0x18')]('CreateSmsQueueReport',_0x16a24f);logger[_0x5bf3('0xd')]('CreateSmsQueueReport',_0x16a24f,JSON[_0x5bf3('0xf')](_0x2fbf80));_0x46a62a(_0x2fbf80);})['catch'](function(_0x56b5c2){logger[_0x5bf3('0x10')](_0x5bf3('0x19'),_0x56b5c2[_0x5bf3('0x12')],_0x16a24f);_0x19d7eb(_0x444aaa[_0x5bf3('0x10')](0x1f4,_0x56b5c2[_0x5bf3('0x12')]));});});};exports[_0x5bf3('0x1a')]=function(_0x5cc652){var _0x207f2a=this;return new Promise(function(_0x2e7171,_0x3eafa5){return db[_0x5bf3('0x14')][_0x5bf3('0x1b')](_0x5cc652[_0x5bf3('0x16')],{'raw':_0x5cc652[_0x5bf3('0x17')]?_0x5cc652[_0x5bf3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cc652[_0x5bf3('0x17')]?_0x5cc652[_0x5bf3('0x17')][_0x5bf3('0x1c')]||null:null,'attributes':_0x5cc652[_0x5bf3('0x17')]?_0x5cc652['options'][_0x5bf3('0x1d')]||null:null,'limit':_0x5cc652['options']?_0x5cc652[_0x5bf3('0x17')][_0x5bf3('0x1e')]||null:null})['then'](function(_0x289bdd){logger[_0x5bf3('0x18')](_0x5bf3('0x1a'),_0x5cc652);logger['debug'](_0x5bf3('0x1a'),_0x5cc652,JSON[_0x5bf3('0xf')](_0x289bdd));_0x2e7171(_0x289bdd);})[_0x5bf3('0x13')](function(_0x33fae0){logger['error'](_0x5bf3('0x1a'),_0x33fae0[_0x5bf3('0x12')],_0x5cc652);_0x3eafa5(_0x207f2a[_0x5bf3('0x10')](0x1f4,_0x33fae0['message']));});});}; \ No newline at end of file +var _0x8a8a=['catch','SmsQueueReport','create','body','options','info','CreateSmsQueueReport','debug','UpdateSmsQueueReport','update','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message'];(function(_0x381a3d,_0x3173f6){var _0x4efa07=function(_0x267700){while(--_0x267700){_0x381a3d['push'](_0x381a3d['shift']());}};_0x4efa07(++_0x3173f6);}(_0x8a8a,0x11d));var _0xa8a8=function(_0x426d2e,_0x118539){_0x426d2e=_0x426d2e-0x0;var _0x1921c2=_0x8a8a[_0x426d2e];return _0x1921c2;};'use strict';var _=require(_0xa8a8('0x0'));var util=require(_0xa8a8('0x1'));var moment=require(_0xa8a8('0x2'));var BPromise=require(_0xa8a8('0x3'));var rs=require(_0xa8a8('0x4'));var fs=require('fs');var Redis=require(_0xa8a8('0x5'));var db=require(_0xa8a8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8a8('0x7'))(_0xa8a8('0x8'));var config=require(_0xa8a8('0x9'));var jayson=require(_0xa8a8('0xa'));var client=jayson['client'][_0xa8a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xac543e,_0x16130e,_0x5be513){return new BPromise(function(_0x591584,_0x15cda8){return client[_0xa8a8('0xc')](_0xac543e,_0x5be513)[_0xa8a8('0xd')](function(_0x30a348){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x16130e,_0xa8a8('0xe'));logger['debug'](_0xa8a8('0xf'),_0x16130e,_0xa8a8('0xe'),JSON[_0xa8a8('0x10')](_0x30a348));if(_0x30a348[_0xa8a8('0x11')]){if(_0x30a348[_0xa8a8('0x11')][_0xa8a8('0x12')]===0x1f4){logger[_0xa8a8('0x11')](_0xa8a8('0x13'),_0x16130e,_0x30a348[_0xa8a8('0x11')][_0xa8a8('0x14')]);return _0x15cda8(_0x30a348['error'][_0xa8a8('0x14')]);}logger[_0xa8a8('0x11')](_0xa8a8('0x13'),_0x16130e,_0x30a348[_0xa8a8('0x11')][_0xa8a8('0x14')]);return _0x591584(_0x30a348[_0xa8a8('0x11')][_0xa8a8('0x14')]);}else{logger['info'](_0xa8a8('0x13'),_0x16130e,'request\x20sent');_0x591584(_0x30a348['result'][_0xa8a8('0x14')]);}})[_0xa8a8('0x15')](function(_0x899e2d){logger[_0xa8a8('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x16130e,_0x899e2d);_0x15cda8(_0x899e2d);});});}exports['CreateSmsQueueReport']=function(_0x54e0ef){var _0x4e342b=this;return new Promise(function(_0x9e433f,_0x273e39){return db[_0xa8a8('0x16')][_0xa8a8('0x17')](_0x54e0ef[_0xa8a8('0x18')],{'raw':_0x54e0ef['options']?_0x54e0ef[_0xa8a8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa8a8('0xd')](function(_0xd56786){logger[_0xa8a8('0x1a')](_0xa8a8('0x1b'),_0x54e0ef);logger[_0xa8a8('0x1c')](_0xa8a8('0x1b'),_0x54e0ef,JSON[_0xa8a8('0x10')](_0xd56786));_0x9e433f(_0xd56786);})['catch'](function(_0x44ffad){logger[_0xa8a8('0x11')]('CreateSmsQueueReport',_0x44ffad[_0xa8a8('0x14')],_0x54e0ef);_0x273e39(_0x4e342b[_0xa8a8('0x11')](0x1f4,_0x44ffad['message']));});});};exports[_0xa8a8('0x1d')]=function(_0x107a95){var _0x2a4775=this;return new Promise(function(_0x8ef431,_0x375fdb){return db[_0xa8a8('0x16')][_0xa8a8('0x1e')](_0x107a95[_0xa8a8('0x18')],{'raw':_0x107a95[_0xa8a8('0x19')]?_0x107a95[_0xa8a8('0x19')][_0xa8a8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x107a95['options']?_0x107a95[_0xa8a8('0x19')]['where']||null:null,'attributes':_0x107a95[_0xa8a8('0x19')]?_0x107a95[_0xa8a8('0x19')][_0xa8a8('0x20')]||null:null,'limit':_0x107a95['options']?_0x107a95[_0xa8a8('0x19')][_0xa8a8('0x21')]||null:null})[_0xa8a8('0xd')](function(_0x53f109){logger[_0xa8a8('0x1a')](_0xa8a8('0x1d'),_0x107a95);logger[_0xa8a8('0x1c')](_0xa8a8('0x1d'),_0x107a95,JSON[_0xa8a8('0x10')](_0x53f109));_0x8ef431(_0x53f109);})[_0xa8a8('0x15')](function(_0x28cdcd){logger[_0xa8a8('0x11')](_0xa8a8('0x1d'),_0x28cdcd[_0xa8a8('0x14')],_0x107a95);_0x375fdb(_0x2a4775['error'](0x1f4,_0x28cdcd[_0xa8a8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c8b1914..ac8e2d4 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 _0x885a=['describe','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe'];(function(_0x5a42d9,_0x2d397e){var _0x190cf2=function(_0x57430a){while(--_0x57430a){_0x5a42d9['push'](_0x5a42d9['shift']());}};_0x190cf2(++_0x2d397e);}(_0x885a,0x180));var _0xa885=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x885a[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0xf')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x12')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller['update']);router[_0xa885('0x13')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller[_0xa885('0x14')]);module[_0xa885('0x15')]=router; \ No newline at end of file +var _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x35ebbb,_0xe862ef){var _0x29d9b=function(_0x4fee98){while(--_0x4fee98){_0x35ebbb['push'](_0x35ebbb['shift']());}};_0x29d9b(++_0xe862ef);}(_0x98a8,0x12c));var _0x898a=function(_0x13593e,_0x22a24f){_0x13593e=_0x13593e-0x0;var _0x2923b8=_0x98a8[_0x13593e];return _0x2923b8;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/describe',auth[_0x898a('0xb')](),controller['describe']);router[_0x898a('0xa')](_0x898a('0xc'),auth[_0x898a('0xb')](),controller[_0x898a('0xd')]);router[_0x898a('0xe')]('/',auth[_0x898a('0xb')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x11')]);router['delete'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x12')]);module[_0x898a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 80034f9..62abecb 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5561f6,_0x2e0168){var _0x4c376d=function(_0x2916fa){while(--_0x2916fa){_0x5561f6['push'](_0x5561f6['shift']());}};_0x4c376d(++_0x2e0168);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0xf3cd[_0x461886];return _0x295e0a;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5caa78,_0x32f719){var _0x15f84d=function(_0x508c70){while(--_0x508c70){_0x5caa78['push'](_0x5caa78['shift']());}};_0x15f84d(++_0x32f719);}(_0x008c,0x188));var _0xc008=function(_0x3d95e9,_0x45bb17){_0x3d95e9=_0x3d95e9-0x0;var _0x472c9a=_0x008c[_0x3d95e9];return _0x472c9a;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 2bbfcd9..22d1d72 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 _0xc17a=['stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','error'];(function(_0x2a5b7c,_0x5332fc){var _0x14fbe2=function(_0x108813){while(--_0x108813){_0x2a5b7c['push'](_0x2a5b7c['shift']());}};_0x14fbe2(++_0x5332fc);}(_0xc17a,0x6f));var _0xac17=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xc17a[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0xac17('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xac17('0x1'));var BPromise=require(_0xac17('0x2'));var Mustache=require(_0xac17('0x3'));var util=require(_0xac17('0x4'));var path=require(_0xac17('0x5'));var sox=require('sox');var csv=require(_0xac17('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac17('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xac17('0x8'));var jsforce=require(_0xac17('0x9'));var deskjs=require(_0xac17('0xa'));var toCsv=require(_0xac17('0x6'));var querystring=require('querystring');var Papa=require(_0xac17('0xb'));var Redis=require(_0xac17('0xc'));var authService=require(_0xac17('0xd'));var qs=require(_0xac17('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac17('0xf'));var logger=require(_0xac17('0x10'))(_0xac17('0x11'));var utils=require('../../config/utils');var config=require(_0xac17('0x12'));var licenseUtil=require(_0xac17('0x13'));var db=require(_0xac17('0x14'))['db'];function respondWithStatusCode(_0x1900f1,_0x25270f){_0x25270f=_0x25270f||0xcc;return function(_0x2666f4){if(_0x2666f4){return _0x1900f1[_0xac17('0x15')](_0x25270f);}return _0x1900f1[_0xac17('0x16')](_0x25270f)[_0xac17('0x17')]();};}function respondWithResult(_0x4187f6,_0x4305d7){_0x4305d7=_0x4305d7||0xc8;return function(_0x3f3a47){if(_0x3f3a47){return _0x4187f6[_0xac17('0x16')](_0x4305d7)[_0xac17('0x18')](_0x3f3a47);}};}function respondWithFilteredResult(_0x55576e,_0x39301e){return function(_0x34ba6d){if(_0x34ba6d){var _0x2a792e=typeof _0x39301e[_0xac17('0x19')]==='undefined'&&typeof _0x39301e[_0xac17('0x1a')]===_0xac17('0x1b');var _0x2cc346=_0x34ba6d[_0xac17('0x1c')];var _0x54390e=_0x2a792e?0x0:_0x39301e['offset'];var _0x1037e=_0x2a792e?_0x34ba6d['count']:_0x39301e[_0xac17('0x19')]+_0x39301e['limit'];var _0x3f176e;if(_0x1037e>=_0x2cc346){_0x1037e=_0x2cc346;_0x3f176e=0xc8;}else{_0x3f176e=0xce;}_0x55576e['status'](_0x3f176e);return _0x55576e[_0xac17('0x1d')]('Content-Range',_0x54390e+'-'+_0x1037e+'/'+_0x2cc346)[_0xac17('0x18')](_0x34ba6d);}return null;};}function patchUpdates(_0x2d2533){return function(_0x53e12b){try{jsonpatch[_0xac17('0x1e')](_0x53e12b,_0x2d2533,!![]);}catch(_0x5c7cc2){return BPromise[_0xac17('0x1f')](_0x5c7cc2);}return _0x53e12b['save']();};}function saveUpdates(_0x323104,_0x1bf7ef){return function(_0x5162af){if(_0x5162af){return _0x5162af['update'](_0x323104)[_0xac17('0x20')](function(_0x9f98){return _0x9f98;});}return null;};}function removeEntity(_0x5d0ce9,_0x36b75a){return function(_0x5261b7){if(_0x5261b7){return _0x5261b7[_0xac17('0x21')]()[_0xac17('0x20')](function(){_0x5d0ce9['status'](0xcc)[_0xac17('0x17')]();});}};}function handleEntityNotFound(_0x448744,_0x10b468){return function(_0x52e2e9){if(!_0x52e2e9){_0x448744[_0xac17('0x15')](0x194);}return _0x52e2e9;};}function handleError(_0x5891ec,_0x31ce85){_0x31ce85=_0x31ce85||0x1f4;return function(_0x3d6d0d){logger[_0xac17('0x22')](_0x3d6d0d[_0xac17('0x23')]);if(_0x3d6d0d[_0xac17('0x24')]){delete _0x3d6d0d['name'];}_0x5891ec[_0xac17('0x16')](_0x31ce85)['send'](_0x3d6d0d);};}exports[_0xac17('0x25')]=function(_0x1bbbc4,_0x4eee0a){var _0x3b2821={},_0x5306a0={},_0x37a1e4={'count':0x0,'rows':[]};var _0x45a50a=_[_0xac17('0x26')](db[_0xac17('0x27')][_0xac17('0x28')],function(_0x3eeced){return{'name':_0x3eeced[_0xac17('0x29')],'type':_0x3eeced['type'][_0xac17('0x2a')]};});_0x5306a0[_0xac17('0x2b')]=_[_0xac17('0x26')](_0x45a50a,_0xac17('0x24'));_0x5306a0[_0xac17('0x2c')]=_[_0xac17('0x2d')](_0x1bbbc4[_0xac17('0x2c')]);_0x5306a0[_0xac17('0x2e')]=_[_0xac17('0x2f')](_0x5306a0['model'],_0x5306a0[_0xac17('0x2c')]);_0x3b2821[_0xac17('0x30')]=_[_0xac17('0x2f')](_0x5306a0[_0xac17('0x2b')],qs[_0xac17('0x31')](_0x1bbbc4['query']['fields']));_0x3b2821[_0xac17('0x30')]=_0x3b2821[_0xac17('0x30')][_0xac17('0x32')]?_0x3b2821[_0xac17('0x30')]:_0x5306a0[_0xac17('0x2b')];if(!_0x1bbbc4['query']['hasOwnProperty'](_0xac17('0x33'))){_0x3b2821[_0xac17('0x1a')]=qs['limit'](_0x1bbbc4[_0xac17('0x2c')][_0xac17('0x1a')]);_0x3b2821[_0xac17('0x19')]=qs[_0xac17('0x19')](_0x1bbbc4[_0xac17('0x2c')][_0xac17('0x19')]);}_0x3b2821[_0xac17('0x34')]=qs[_0xac17('0x35')](_0x1bbbc4[_0xac17('0x2c')][_0xac17('0x35')]);_0x3b2821[_0xac17('0x36')]=qs[_0xac17('0x2e')](_[_0xac17('0x37')](_0x1bbbc4[_0xac17('0x2c')],_0x5306a0[_0xac17('0x2e')]),_0x45a50a);if(_0x1bbbc4['query'][_0xac17('0x38')]){_0x3b2821[_0xac17('0x36')]=_['merge'](_0x3b2821[_0xac17('0x36')],{'$or':_[_0xac17('0x26')](_0x45a50a,function(_0xe35f13){if(_0xe35f13[_0xac17('0x39')]!==_0xac17('0x3a')){var _0x3d4f22={};_0x3d4f22[_0xe35f13[_0xac17('0x24')]]={'$like':'%'+_0x1bbbc4[_0xac17('0x2c')]['filter']+'%'};return _0x3d4f22;}})});}_0x3b2821=_[_0xac17('0x3b')]({},_0x3b2821,_0x1bbbc4[_0xac17('0x3c')]);var _0x363350={'where':_0x3b2821[_0xac17('0x36')]};return db[_0xac17('0x27')]['count'](_0x363350)['then'](function(_0x33055b){_0x37a1e4['count']=_0x33055b;if(_0x1bbbc4['query'][_0xac17('0x3d')]){_0x3b2821['include']=[{'all':!![]}];}return db[_0xac17('0x27')][_0xac17('0x3e')](_0x3b2821);})[_0xac17('0x20')](function(_0x50f3d5){_0x37a1e4[_0xac17('0x3f')]=_0x50f3d5;return _0x37a1e4;})[_0xac17('0x20')](respondWithFilteredResult(_0x4eee0a,_0x3b2821))[_0xac17('0x40')](handleError(_0x4eee0a,null));};exports[_0xac17('0x41')]=function(_0x1b73e7,_0x4f7190){var _0x19bd9e={'raw':!![],'where':{'id':_0x1b73e7[_0xac17('0x42')]['id']}},_0x59f6d1={};_0x59f6d1['model']=_[_0xac17('0x2d')](db[_0xac17('0x27')][_0xac17('0x28')]);_0x59f6d1['query']=_['keys'](_0x1b73e7['query']);_0x59f6d1[_0xac17('0x2e')]=_[_0xac17('0x2f')](_0x59f6d1[_0xac17('0x2b')],_0x59f6d1['query']);_0x19bd9e[_0xac17('0x30')]=_[_0xac17('0x2f')](_0x59f6d1['model'],qs[_0xac17('0x31')](_0x1b73e7[_0xac17('0x2c')][_0xac17('0x31')]));_0x19bd9e[_0xac17('0x30')]=_0x19bd9e[_0xac17('0x30')][_0xac17('0x32')]?_0x19bd9e[_0xac17('0x30')]:_0x59f6d1[_0xac17('0x2b')];if(_0x1b73e7[_0xac17('0x2c')][_0xac17('0x3d')]){_0x19bd9e[_0xac17('0x43')]=[{'all':!![]}];}_0x19bd9e=_[_0xac17('0x3b')]({},_0x19bd9e,_0x1b73e7[_0xac17('0x3c')]);return db[_0xac17('0x27')][_0xac17('0x44')](_0x19bd9e)[_0xac17('0x20')](handleEntityNotFound(_0x4f7190,null))[_0xac17('0x20')](respondWithResult(_0x4f7190,null))['catch'](handleError(_0x4f7190,null));};exports[_0xac17('0x45')]=function(_0x4837c6,_0x21268e){return db[_0xac17('0x27')][_0xac17('0x45')](_0x4837c6[_0xac17('0x46')],{})['then'](respondWithResult(_0x21268e,0xc9))['catch'](handleError(_0x21268e,null));};exports[_0xac17('0x47')]=function(_0x1fcdd4,_0xbb7917){if(_0x1fcdd4[_0xac17('0x46')]['id']){delete _0x1fcdd4[_0xac17('0x46')]['id'];}return db[_0xac17('0x27')][_0xac17('0x44')]({'where':{'id':_0x1fcdd4[_0xac17('0x42')]['id']}})[_0xac17('0x20')](handleEntityNotFound(_0xbb7917,null))[_0xac17('0x20')](saveUpdates(_0x1fcdd4['body'],null))[_0xac17('0x20')](respondWithResult(_0xbb7917,null))[_0xac17('0x40')](handleError(_0xbb7917,null));};exports[_0xac17('0x21')]=function(_0x1ca523,_0x11c87b){return db[_0xac17('0x27')]['find']({'where':{'id':_0x1ca523[_0xac17('0x42')]['id']}})[_0xac17('0x20')](handleEntityNotFound(_0x11c87b,null))[_0xac17('0x20')](removeEntity(_0x11c87b,null))[_0xac17('0x40')](handleError(_0x11c87b,null));};exports[_0xac17('0x48')]=function(_0x54e1ae,_0x4491ed){return db[_0xac17('0x27')]['describe']()[_0xac17('0x20')](respondWithResult(_0x4491ed,null))[_0xac17('0x40')](handleError(_0x4491ed,null));}; \ No newline at end of file +var _0x7936=['../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7936,0xc7));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6793('0x0'));var rimraf=require(_0x6793('0x1'));var zipdir=require(_0x6793('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6793('0x3'));var moment=require(_0x6793('0x4'));var BPromise=require(_0x6793('0x5'));var Mustache=require(_0x6793('0x6'));var util=require('util');var path=require(_0x6793('0x7'));var sox=require(_0x6793('0x8'));var csv=require(_0x6793('0x9'));var ejs=require(_0x6793('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6793('0xb'));var squel=require(_0x6793('0xc'));var crypto=require('crypto');var jsforce=require(_0x6793('0xd'));var deskjs=require(_0x6793('0xe'));var toCsv=require(_0x6793('0x9'));var querystring=require('querystring');var Papa=require(_0x6793('0xf'));var Redis=require(_0x6793('0x10'));var authService=require(_0x6793('0x11'));var qs=require(_0x6793('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6793('0x13'));var logger=require(_0x6793('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6793('0x15'));var db=require(_0x6793('0x16'))['db'];function respondWithStatusCode(_0x46c223,_0x431df0){_0x431df0=_0x431df0||0xcc;return function(_0x15611e){if(_0x15611e){return _0x46c223[_0x6793('0x17')](_0x431df0);}return _0x46c223['status'](_0x431df0)['end']();};}function respondWithResult(_0x3b701e,_0x65b90){_0x65b90=_0x65b90||0xc8;return function(_0x2fc72f){if(_0x2fc72f){return _0x3b701e[_0x6793('0x18')](_0x65b90)[_0x6793('0x19')](_0x2fc72f);}};}function respondWithFilteredResult(_0x3b4e53,_0x3af381){return function(_0x415bf4){if(_0x415bf4){var _0x4a8f3a=typeof _0x3af381[_0x6793('0x1a')]==='undefined'&&typeof _0x3af381[_0x6793('0x1b')]===_0x6793('0x1c');var _0x112dd2=_0x415bf4[_0x6793('0x1d')];var _0xcb118d=_0x4a8f3a?0x0:_0x3af381['offset'];var _0x357a72=_0x4a8f3a?_0x415bf4[_0x6793('0x1d')]:_0x3af381['offset']+_0x3af381['limit'];var _0x35a5e8;if(_0x357a72>=_0x112dd2){_0x357a72=_0x112dd2;_0x35a5e8=0xc8;}else{_0x35a5e8=0xce;}_0x3b4e53[_0x6793('0x18')](_0x35a5e8);return _0x3b4e53[_0x6793('0x1e')]('Content-Range',_0xcb118d+'-'+_0x357a72+'/'+_0x112dd2)[_0x6793('0x19')](_0x415bf4);}return null;};}function patchUpdates(_0xb851d7){return function(_0x4eac47){try{jsonpatch[_0x6793('0x1f')](_0x4eac47,_0xb851d7,!![]);}catch(_0x451191){return BPromise['reject'](_0x451191);}return _0x4eac47['save']();};}function saveUpdates(_0x29a2bf,_0x320004){return function(_0x366aad){if(_0x366aad){return _0x366aad[_0x6793('0x20')](_0x29a2bf)[_0x6793('0x21')](function(_0x5f4845){return _0x5f4845;});}return null;};}function removeEntity(_0x5a3b32,_0x1cb890){return function(_0x476c4d){if(_0x476c4d){return _0x476c4d[_0x6793('0x22')]()[_0x6793('0x21')](function(){_0x5a3b32[_0x6793('0x18')](0xcc)[_0x6793('0x23')]();});}};}function handleEntityNotFound(_0xc5a51,_0x300177){return function(_0x11fc89){if(!_0x11fc89){_0xc5a51[_0x6793('0x17')](0x194);}return _0x11fc89;};}function handleError(_0x49a6e9,_0x5e0661){_0x5e0661=_0x5e0661||0x1f4;return function(_0x5e0c33){logger[_0x6793('0x24')](_0x5e0c33[_0x6793('0x25')]);if(_0x5e0c33[_0x6793('0x26')]){delete _0x5e0c33[_0x6793('0x26')];}_0x49a6e9[_0x6793('0x18')](_0x5e0661)[_0x6793('0x27')](_0x5e0c33);};}exports[_0x6793('0x28')]=function(_0x500a0e,_0x47ed21){var _0x2df375={},_0x6fd8d9={},_0x3effff={'count':0x0,'rows':[]};var _0x4b3d67=_[_0x6793('0x29')](db[_0x6793('0x2a')]['rawAttributes'],function(_0x59c231){return{'name':_0x59c231['fieldName'],'type':_0x59c231[_0x6793('0x2b')][_0x6793('0x2c')]};});_0x6fd8d9[_0x6793('0x2d')]=_[_0x6793('0x29')](_0x4b3d67,_0x6793('0x26'));_0x6fd8d9[_0x6793('0x2e')]=_[_0x6793('0x2f')](_0x500a0e[_0x6793('0x2e')]);_0x6fd8d9[_0x6793('0x30')]=_['intersection'](_0x6fd8d9[_0x6793('0x2d')],_0x6fd8d9[_0x6793('0x2e')]);_0x2df375[_0x6793('0x31')]=_[_0x6793('0x32')](_0x6fd8d9['model'],qs[_0x6793('0x33')](_0x500a0e[_0x6793('0x2e')][_0x6793('0x33')]));_0x2df375[_0x6793('0x31')]=_0x2df375[_0x6793('0x31')][_0x6793('0x34')]?_0x2df375[_0x6793('0x31')]:_0x6fd8d9[_0x6793('0x2d')];if(!_0x500a0e[_0x6793('0x2e')][_0x6793('0x35')](_0x6793('0x36'))){_0x2df375[_0x6793('0x1b')]=qs['limit'](_0x500a0e[_0x6793('0x2e')][_0x6793('0x1b')]);_0x2df375['offset']=qs['offset'](_0x500a0e['query'][_0x6793('0x1a')]);}_0x2df375[_0x6793('0x37')]=qs[_0x6793('0x38')](_0x500a0e[_0x6793('0x2e')]['sort']);_0x2df375[_0x6793('0x39')]=qs['filters'](_[_0x6793('0x3a')](_0x500a0e['query'],_0x6fd8d9['filters']),_0x4b3d67);if(_0x500a0e['query']['filter']){_0x2df375[_0x6793('0x39')]=_[_0x6793('0x3b')](_0x2df375[_0x6793('0x39')],{'$or':_[_0x6793('0x29')](_0x4b3d67,function(_0x54f86b){if(_0x54f86b[_0x6793('0x2b')]!=='VIRTUAL'){var _0x1479cc={};_0x1479cc[_0x54f86b[_0x6793('0x26')]]={'$like':'%'+_0x500a0e[_0x6793('0x2e')][_0x6793('0x3c')]+'%'};return _0x1479cc;}})});}_0x2df375=_[_0x6793('0x3b')]({},_0x2df375,_0x500a0e[_0x6793('0x3d')]);var _0x279aae={'where':_0x2df375[_0x6793('0x39')]};return db[_0x6793('0x2a')][_0x6793('0x1d')](_0x279aae)[_0x6793('0x21')](function(_0x115a4e){_0x3effff['count']=_0x115a4e;if(_0x500a0e[_0x6793('0x2e')][_0x6793('0x3e')]){_0x2df375[_0x6793('0x3f')]=[{'all':!![]}];}return db[_0x6793('0x2a')][_0x6793('0x40')](_0x2df375);})['then'](function(_0x3beb3b){_0x3effff[_0x6793('0x41')]=_0x3beb3b;return _0x3effff;})[_0x6793('0x21')](respondWithFilteredResult(_0x47ed21,_0x2df375))['catch'](handleError(_0x47ed21,null));};exports['show']=function(_0x5a5f69,_0x39dab4){var _0x4507a6={'raw':!![],'where':{'id':_0x5a5f69[_0x6793('0x42')]['id']}},_0x9e063c={};_0x9e063c[_0x6793('0x2d')]=_[_0x6793('0x2f')](db[_0x6793('0x2a')][_0x6793('0x43')]);_0x9e063c[_0x6793('0x2e')]=_[_0x6793('0x2f')](_0x5a5f69['query']);_0x9e063c[_0x6793('0x30')]=_['intersection'](_0x9e063c[_0x6793('0x2d')],_0x9e063c[_0x6793('0x2e')]);_0x4507a6[_0x6793('0x31')]=_['intersection'](_0x9e063c['model'],qs[_0x6793('0x33')](_0x5a5f69[_0x6793('0x2e')]['fields']));_0x4507a6['attributes']=_0x4507a6[_0x6793('0x31')][_0x6793('0x34')]?_0x4507a6[_0x6793('0x31')]:_0x9e063c[_0x6793('0x2d')];if(_0x5a5f69[_0x6793('0x2e')][_0x6793('0x3e')]){_0x4507a6[_0x6793('0x3f')]=[{'all':!![]}];}_0x4507a6=_[_0x6793('0x3b')]({},_0x4507a6,_0x5a5f69[_0x6793('0x3d')]);return db['SmsTransferReport'][_0x6793('0x44')](_0x4507a6)[_0x6793('0x21')](handleEntityNotFound(_0x39dab4,null))['then'](respondWithResult(_0x39dab4,null))[_0x6793('0x45')](handleError(_0x39dab4,null));};exports[_0x6793('0x46')]=function(_0x472afe,_0x2e1b55){return db[_0x6793('0x2a')][_0x6793('0x46')](_0x472afe[_0x6793('0x47')],{})[_0x6793('0x21')](respondWithResult(_0x2e1b55,0xc9))['catch'](handleError(_0x2e1b55,null));};exports[_0x6793('0x20')]=function(_0x11aa44,_0xb5db05){if(_0x11aa44[_0x6793('0x47')]['id']){delete _0x11aa44[_0x6793('0x47')]['id'];}return db[_0x6793('0x2a')]['find']({'where':{'id':_0x11aa44[_0x6793('0x42')]['id']}})['then'](handleEntityNotFound(_0xb5db05,null))[_0x6793('0x21')](saveUpdates(_0x11aa44[_0x6793('0x47')],null))['then'](respondWithResult(_0xb5db05,null))[_0x6793('0x45')](handleError(_0xb5db05,null));};exports[_0x6793('0x22')]=function(_0x36cbdc,_0x4fe340){return db[_0x6793('0x2a')][_0x6793('0x44')]({'where':{'id':_0x36cbdc[_0x6793('0x42')]['id']}})[_0x6793('0x21')](handleEntityNotFound(_0x4fe340,null))[_0x6793('0x21')](removeEntity(_0x4fe340,null))['catch'](handleError(_0x4fe340,null));};exports[_0x6793('0x48')]=function(_0x5605d6,_0x4a44c4){return db[_0x6793('0x2a')]['describe']()[_0x6793('0x21')](respondWithResult(_0x4a44c4,null))['catch'](handleError(_0x4a44c4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c62b262..640c99c 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 _0x6aed=['define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6aed,0x10c));var _0xd6ae=function(_0x53b56c,_0xc77892){_0x53b56c=_0x53b56c-0x0;var _0x405939=_0x6aed[_0x53b56c];return _0x405939;};'use strict';var _=require('lodash');var util=require(_0xd6ae('0x0'));var logger=require(_0xd6ae('0x1'))(_0xd6ae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd6ae('0x3'));var fs=require('fs');var path=require(_0xd6ae('0x4'));var rimraf=require('rimraf');var config=require(_0xd6ae('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0xd6ae('0x6')]=function(_0x3c8458,_0x2e1552){return _0x3c8458[_0xd6ae('0x7')](_0xd6ae('0x8'),attributes,{'tableName':_0xd6ae('0x9'),'paranoid':![],'indexes':[{'name':_0xd6ae('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf534=['lodash','util','api','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xf534,0x9a));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4f53('0x0'));var util=require(_0x4f53('0x1'));var logger=require('../../config/logger')(_0x4f53('0x2'));var moment=require('moment');var BPromise=require(_0x4f53('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f53('0x4'));var rimraf=require(_0x4f53('0x5'));var config=require(_0x4f53('0x6'));var attributes=require(_0x4f53('0x7'));module[_0x4f53('0x8')]=function(_0x602391,_0x2fc5c0){return _0x602391['define'](_0x4f53('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x4f53('0xa'),'fields':[_0x4f53('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index c1099be..11b6ac8 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 _0xe41f=['info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsTransferReport,\x20%s,\x20%s','message'];(function(_0x5d1e01,_0x397099){var _0xb4ba86=function(_0x4df1d0){while(--_0x4df1d0){_0x5d1e01['push'](_0x5d1e01['shift']());}};_0xb4ba86(++_0x397099);}(_0xe41f,0x13e));var _0xfe41=function(_0x480fd7,_0x36fb72){_0x480fd7=_0x480fd7-0x0;var _0x4eec0e=_0xe41f[_0x480fd7];return _0x4eec0e;};'use strict';var _=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var moment=require(_0xfe41('0x2'));var BPromise=require(_0xfe41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe41('0x4'));var logger=require(_0xfe41('0x5'))(_0xfe41('0x6'));var config=require(_0xfe41('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfe41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x519fb6,_0xf28c37,_0x224ed7){return new BPromise(function(_0x4f92d3,_0x224a23){return client[_0xfe41('0x9')](_0x519fb6,_0x224ed7)[_0xfe41('0xa')](function(_0x4c39e9){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xf28c37,'request\x20sent');logger[_0xfe41('0xb')](_0xfe41('0xc'),_0xf28c37,_0xfe41('0xd'),JSON['stringify'](_0x4c39e9));if(_0x4c39e9[_0xfe41('0xe')]){if(_0x4c39e9[_0xfe41('0xe')][_0xfe41('0xf')]===0x1f4){logger['error'](_0xfe41('0x10'),_0xf28c37,_0x4c39e9[_0xfe41('0xe')]['message']);return _0x224a23(_0x4c39e9[_0xfe41('0xe')][_0xfe41('0x11')]);}logger[_0xfe41('0xe')](_0xfe41('0x10'),_0xf28c37,_0x4c39e9[_0xfe41('0xe')]['message']);return _0x4f92d3(_0x4c39e9[_0xfe41('0xe')][_0xfe41('0x11')]);}else{logger[_0xfe41('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0xf28c37,'request\x20sent');_0x4f92d3(_0x4c39e9[_0xfe41('0x13')][_0xfe41('0x11')]);}})[_0xfe41('0x14')](function(_0x199644){logger['error'](_0xfe41('0x10'),_0xf28c37,_0x199644);_0x224a23(_0x199644);});});} \ No newline at end of file +var _0x1af5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1af5,0x17d));var _0x51af=function(_0x510b34,_0x4cc893){_0x510b34=_0x510b34-0x0;var _0x2d736b=_0x1af5[_0x510b34];return _0x2d736b;};'use strict';var _=require(_0x51af('0x0'));var util=require('util');var moment=require(_0x51af('0x1'));var BPromise=require(_0x51af('0x2'));var rs=require(_0x51af('0x3'));var fs=require('fs');var Redis=require(_0x51af('0x4'));var db=require(_0x51af('0x5'))['db'];var utils=require(_0x51af('0x6'));var logger=require(_0x51af('0x7'))(_0x51af('0x8'));var config=require(_0x51af('0x9'));var jayson=require(_0x51af('0xa'));var client=jayson[_0x51af('0xb')][_0x51af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3545d2,_0x5a8801,_0x5284cd){return new BPromise(function(_0x227c84,_0x5ca300){return client[_0x51af('0xd')](_0x3545d2,_0x5284cd)[_0x51af('0xe')](function(_0x42015a){logger[_0x51af('0xf')](_0x51af('0x10'),_0x5a8801,_0x51af('0x11'));logger[_0x51af('0x12')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5a8801,_0x51af('0x11'),JSON[_0x51af('0x13')](_0x42015a));if(_0x42015a[_0x51af('0x14')]){if(_0x42015a[_0x51af('0x14')][_0x51af('0x15')]===0x1f4){logger['error'](_0x51af('0x10'),_0x5a8801,_0x42015a['error'][_0x51af('0x16')]);return _0x5ca300(_0x42015a['error'][_0x51af('0x16')]);}logger[_0x51af('0x14')](_0x51af('0x10'),_0x5a8801,_0x42015a['error'][_0x51af('0x16')]);return _0x227c84(_0x42015a[_0x51af('0x14')][_0x51af('0x16')]);}else{logger[_0x51af('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x5a8801,_0x51af('0x11'));_0x227c84(_0x42015a[_0x51af('0x17')][_0x51af('0x16')]);}})['catch'](function(_0x4970f5){logger[_0x51af('0x14')](_0x51af('0x10'),_0x5a8801,_0x4970f5);_0x5ca300(_0x4970f5);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 71445c9..3dd9a97 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 _0xeab6=['../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','download','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xeab6,0x155));var _0x6eab=function(_0x3920b4,_0x4cd07a){_0x3920b4=_0x3920b4-0x0;var _0x1ef94f=_0xeab6[_0x3920b4];return _0x1ef94f;};'use strict';var multer=require(_0x6eab('0x0'));var util=require(_0x6eab('0x1'));var path=require(_0x6eab('0x2'));var timeout=require(_0x6eab('0x3'));var express=require('express');var router=express[_0x6eab('0x4')]();var fs_extra=require(_0x6eab('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6eab('0x6'));var config=require(_0x6eab('0x7'));var controller=require(_0x6eab('0x8'));router[_0x6eab('0x9')]('/',auth[_0x6eab('0xa')](),controller[_0x6eab('0xb')]);router[_0x6eab('0x9')](_0x6eab('0xc'),auth[_0x6eab('0xa')](),controller['show']);router[_0x6eab('0x9')]('/:id/download',auth[_0x6eab('0xa')](),controller[_0x6eab('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x31ecd3,_0x4acf0b,_0x509404){_0x509404(null,path['join'](config[_0x6eab('0xe')],_0x6eab('0xf')));},'filename':function(_0x4dc053,_0x36fd6f,_0xf4a47e){_0x36fd6f[_0x6eab('0x10')]=_0x36fd6f[_0x6eab('0x10')][_0x6eab('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf4a47e(null,util['format'](_0x6eab('0x12'),path[_0x6eab('0x13')](_0x36fd6f[_0x6eab('0x10')],path[_0x6eab('0x14')](_0x36fd6f[_0x6eab('0x10')])),Date[_0x6eab('0x15')](),path['extname'](_0x36fd6f[_0x6eab('0x10')])));}})});router[_0x6eab('0x16')]('/',upload[_0x6eab('0x17')](_0x6eab('0x18')),controller[_0x6eab('0x19')]);router[_0x6eab('0x1a')](_0x6eab('0xc'),auth['isAuthenticated'](),controller[_0x6eab('0x1b')]);router[_0x6eab('0x1c')]('/:id',auth[_0x6eab('0xa')](),controller[_0x6eab('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdaa2=['isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','single','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get'];(function(_0x2f2654,_0x1572bd){var _0x332b2a=function(_0x78dfd6){while(--_0x78dfd6){_0x2f2654['push'](_0x2f2654['shift']());}};_0x332b2a(++_0x1572bd);}(_0xdaa2,0xbd));var _0x2daa=function(_0x58fa8d,_0x2ec34c){_0x58fa8d=_0x58fa8d-0x0;var _0xeb9c38=_0xdaa2[_0x58fa8d];return _0xeb9c38;};'use strict';var multer=require(_0x2daa('0x0'));var util=require(_0x2daa('0x1'));var path=require(_0x2daa('0x2'));var timeout=require(_0x2daa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2daa('0x4'));var config=require(_0x2daa('0x5'));var controller=require('./sound.controller');router[_0x2daa('0x6')]('/',auth[_0x2daa('0x7')](),controller[_0x2daa('0x8')]);router[_0x2daa('0x6')](_0x2daa('0x9'),auth[_0x2daa('0x7')](),controller[_0x2daa('0xa')]);router[_0x2daa('0x6')](_0x2daa('0xb'),auth[_0x2daa('0x7')](),controller['download']);var upload=multer({'storage':multer[_0x2daa('0xc')]({'destination':function(_0x221cfe,_0x1eeb5f,_0x53d9ba){_0x53d9ba(null,path[_0x2daa('0xd')](config['root'],_0x2daa('0xe')));},'filename':function(_0x173717,_0x110598,_0x4d1bac){_0x110598[_0x2daa('0xf')]=_0x110598[_0x2daa('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d1bac(null,util[_0x2daa('0x10')](_0x2daa('0x11'),path[_0x2daa('0x12')](_0x110598[_0x2daa('0xf')],path[_0x2daa('0x13')](_0x110598['originalname'])),Date[_0x2daa('0x14')](),path[_0x2daa('0x13')](_0x110598[_0x2daa('0xf')])));}})});router[_0x2daa('0x15')]('/',upload[_0x2daa('0x16')]('file'),controller[_0x2daa('0x17')]);router[_0x2daa('0x18')](_0x2daa('0x9'),auth[_0x2daa('0x7')](),controller[_0x2daa('0x19')]);router[_0x2daa('0x1a')](_0x2daa('0x9'),auth[_0x2daa('0x7')](),controller[_0x2daa('0x1a')]);module[_0x2daa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9ac24f2..98afe94 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 _0x4992=['INTEGER','BIGINT','sequelize','exports','STRING','FLOAT'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x4992,0x164));var _0x2499=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4992[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x2499('0x0'));module[_0x2499('0x1')]={'name':{'type':Sequelize[_0x2499('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x2499('0x2')]},'display_name':{'type':Sequelize[_0x2499('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2499('0x2')]},'original_duration':{'type':Sequelize[_0x2499('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x2499('0x4')]},'original_bitRate':{'type':Sequelize[_0x2499('0x5')]},'original_sampleRate':{'type':Sequelize[_0x2499('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x2499('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x2499('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x2499('0x4')]}}; \ No newline at end of file +var _0x8be7=['INTEGER','BIGINT','exports','name','STRING','FLOAT'];(function(_0x8e841b,_0x172b8e){var _0xb84f90=function(_0x2b753a){while(--_0x2b753a){_0x8e841b['push'](_0x8e841b['shift']());}};_0xb84f90(++_0x172b8e);}(_0x8be7,0x98));var _0x78be=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x8be7[_0x359377];return _0x8be18a;};'use strict';var Sequelize=require('sequelize');module[_0x78be('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x78be('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x78be('0x2')]},'display_name':{'type':Sequelize[_0x78be('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x78be('0x2')]},'original_format':{'type':Sequelize[_0x78be('0x2')]},'original_duration':{'type':Sequelize[_0x78be('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x78be('0x4')]},'original_bitRate':{'type':Sequelize[_0x78be('0x5')]},'original_sampleRate':{'type':Sequelize[_0x78be('0x4')]},'converted_format':{'type':Sequelize[_0x78be('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x78be('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x78be('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 071349d..0094353 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 _0x2f27=['bitRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','server/files/sounds/original','original_format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','Sounds','UserProfileResource','error','stack','name','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','download','params','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','basename','filename','root','info','chmodSync','0777','unlinkSync','send','duration','original_sampleCount','original_channelCount','channelCount','original_bitRate'];(function(_0x4453c3,_0x524c60){var _0x24378c=function(_0x2693f2){while(--_0x2693f2){_0x4453c3['push'](_0x4453c3['shift']());}};_0x24378c(++_0x524c60);}(_0x2f27,0x171));var _0x72f2=function(_0x13fe23,_0x4275d5){_0x13fe23=_0x13fe23-0x0;var _0x2e2a4f=_0x2f27[_0x13fe23];return _0x2e2a4f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x72f2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72f2('0x1'));var moment=require(_0x72f2('0x2'));var BPromise=require(_0x72f2('0x3'));var Mustache=require(_0x72f2('0x4'));var util=require(_0x72f2('0x5'));var path=require(_0x72f2('0x6'));var sox=require(_0x72f2('0x7'));var csv=require(_0x72f2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72f2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x72f2('0xa'));var deskjs=require(_0x72f2('0xb'));var toCsv=require(_0x72f2('0x8'));var querystring=require('querystring');var Papa=require(_0x72f2('0xc'));var Redis=require('ioredis');var authService=require(_0x72f2('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x72f2('0xe'))(_0x72f2('0xf'));var utils=require('../../config/utils');var config=require(_0x72f2('0x10'));var licenseUtil=require(_0x72f2('0x11'));var db=require(_0x72f2('0x12'))['db'];function respondWithStatusCode(_0x34fbf6,_0x2931ac){_0x2931ac=_0x2931ac||0xcc;return function(_0x16dc17){if(_0x16dc17){return _0x34fbf6[_0x72f2('0x13')](_0x2931ac);}return _0x34fbf6[_0x72f2('0x14')](_0x2931ac)[_0x72f2('0x15')]();};}function respondWithResult(_0x4f06a0,_0x19c882){_0x19c882=_0x19c882||0xc8;return function(_0x1f6bde){if(_0x1f6bde){return _0x4f06a0[_0x72f2('0x14')](_0x19c882)['json'](_0x1f6bde);}};}function respondWithFilteredResult(_0x37703c,_0xffb3ce){return function(_0x5bd4cb){if(_0x5bd4cb){var _0x47fb46=typeof _0xffb3ce['offset']==='undefined'&&typeof _0xffb3ce['limit']===_0x72f2('0x16');var _0x2b6a2e=_0x5bd4cb[_0x72f2('0x17')];var _0x37de8e=_0x47fb46?0x0:_0xffb3ce['offset'];var _0x41e437=_0x47fb46?_0x5bd4cb['count']:_0xffb3ce[_0x72f2('0x18')]+_0xffb3ce[_0x72f2('0x19')];var _0x2a12bb;if(_0x41e437>=_0x2b6a2e){_0x41e437=_0x2b6a2e;_0x2a12bb=0xc8;}else{_0x2a12bb=0xce;}_0x37703c['status'](_0x2a12bb);return _0x37703c['set'](_0x72f2('0x1a'),_0x37de8e+'-'+_0x41e437+'/'+_0x2b6a2e)['json'](_0x5bd4cb);}return null;};}function patchUpdates(_0x51a520){return function(_0x5a1066){try{jsonpatch[_0x72f2('0x1b')](_0x5a1066,_0x51a520,!![]);}catch(_0x10100a){return BPromise[_0x72f2('0x1c')](_0x10100a);}return _0x5a1066['save']();};}function saveUpdates(_0x58ff5b,_0x22f396){return function(_0x147a2d){if(_0x147a2d){return _0x147a2d[_0x72f2('0x1d')](_0x58ff5b)[_0x72f2('0x1e')](function(_0x839400){return _0x839400;});}return null;};}function removeEntity(_0x5e39d8,_0x3482fe){return function(_0x4e9b48){if(_0x4e9b48){return _0x4e9b48[_0x72f2('0x1f')]()[_0x72f2('0x1e')](function(){var _0x33dcf1=_0x4e9b48['get']({'plain':!![]});var _0x37d9f5=_0x72f2('0x20');return db[_0x72f2('0x21')][_0x72f2('0x1f')]({'where':{'type':_0x37d9f5,'resourceId':_0x33dcf1['id']}})[_0x72f2('0x1e')](function(){return _0x4e9b48;});})[_0x72f2('0x1e')](function(){_0x5e39d8[_0x72f2('0x14')](0xcc)[_0x72f2('0x15')]();});}};}function handleEntityNotFound(_0x35d3c5,_0x267a35){return function(_0x3bdeb2){if(!_0x3bdeb2){_0x35d3c5['sendStatus'](0x194);}return _0x3bdeb2;};}function handleError(_0x5825fd,_0x3394c9){_0x3394c9=_0x3394c9||0x1f4;return function(_0x5e43e4){logger[_0x72f2('0x22')](_0x5e43e4[_0x72f2('0x23')]);if(_0x5e43e4['name']){delete _0x5e43e4[_0x72f2('0x24')];}_0x5825fd[_0x72f2('0x14')](_0x3394c9)['send'](_0x5e43e4);};}exports['index']=function(_0x339dd2,_0x976af9){var _0x473a5e={},_0x2fc350={},_0x51f92c={'count':0x0,'rows':[]};var _0x395e51=_[_0x72f2('0x25')](db[_0x72f2('0x26')][_0x72f2('0x27')],function(_0x29c9e5){return{'name':_0x29c9e5[_0x72f2('0x28')],'type':_0x29c9e5[_0x72f2('0x29')][_0x72f2('0x2a')]};});_0x2fc350[_0x72f2('0x2b')]=_['map'](_0x395e51,_0x72f2('0x24'));_0x2fc350[_0x72f2('0x2c')]=_[_0x72f2('0x2d')](_0x339dd2['query']);_0x2fc350[_0x72f2('0x2e')]=_[_0x72f2('0x2f')](_0x2fc350[_0x72f2('0x2b')],_0x2fc350[_0x72f2('0x2c')]);_0x473a5e['attributes']=_[_0x72f2('0x2f')](_0x2fc350[_0x72f2('0x2b')],qs[_0x72f2('0x30')](_0x339dd2[_0x72f2('0x2c')][_0x72f2('0x30')]));_0x473a5e[_0x72f2('0x31')]=_0x473a5e[_0x72f2('0x31')]['length']?_0x473a5e[_0x72f2('0x31')]:_0x2fc350[_0x72f2('0x2b')];if(!_0x339dd2['query']['hasOwnProperty'](_0x72f2('0x32'))){_0x473a5e['limit']=qs[_0x72f2('0x19')](_0x339dd2[_0x72f2('0x2c')]['limit']);_0x473a5e['offset']=qs['offset'](_0x339dd2['query'][_0x72f2('0x18')]);}_0x473a5e[_0x72f2('0x33')]=qs[_0x72f2('0x34')](_0x339dd2[_0x72f2('0x2c')][_0x72f2('0x34')]);_0x473a5e[_0x72f2('0x35')]=qs[_0x72f2('0x2e')](_[_0x72f2('0x36')](_0x339dd2['query'],_0x2fc350[_0x72f2('0x2e')]),_0x395e51);if(_0x339dd2[_0x72f2('0x2c')][_0x72f2('0x37')]){_0x473a5e[_0x72f2('0x35')]=_[_0x72f2('0x38')](_0x473a5e[_0x72f2('0x35')],{'$or':_[_0x72f2('0x25')](_0x395e51,function(_0x723f6c){if(_0x723f6c[_0x72f2('0x29')]!==_0x72f2('0x39')){var _0x50ae02={};_0x50ae02[_0x723f6c[_0x72f2('0x24')]]={'$like':'%'+_0x339dd2[_0x72f2('0x2c')]['filter']+'%'};return _0x50ae02;}})});}_0x473a5e=_['merge']({},_0x473a5e,_0x339dd2[_0x72f2('0x3a')]);var _0x129a8a={'where':_0x473a5e[_0x72f2('0x35')]};return db['Sound'][_0x72f2('0x17')](_0x129a8a)[_0x72f2('0x1e')](function(_0x4e49db){_0x51f92c[_0x72f2('0x17')]=_0x4e49db;if(_0x339dd2[_0x72f2('0x2c')][_0x72f2('0x3b')]){_0x473a5e[_0x72f2('0x3c')]=[{'all':!![]}];}return db[_0x72f2('0x26')][_0x72f2('0x3d')](_0x473a5e);})[_0x72f2('0x1e')](function(_0x51b51c){_0x51f92c[_0x72f2('0x3e')]=_0x51b51c;return _0x51f92c;})[_0x72f2('0x1e')](respondWithFilteredResult(_0x976af9,_0x473a5e))[_0x72f2('0x3f')](handleError(_0x976af9,null));};exports[_0x72f2('0x40')]=function(_0x51aca2,_0x590054){var _0x3b9582={'raw':!![],'where':{'id':_0x51aca2['params']['id']}},_0x1bf176={};_0x1bf176[_0x72f2('0x2b')]=_[_0x72f2('0x2d')](db[_0x72f2('0x26')][_0x72f2('0x27')]);_0x1bf176['query']=_['keys'](_0x51aca2['query']);_0x1bf176['filters']=_[_0x72f2('0x2f')](_0x1bf176['model'],_0x1bf176['query']);_0x3b9582[_0x72f2('0x31')]=_['intersection'](_0x1bf176[_0x72f2('0x2b')],qs[_0x72f2('0x30')](_0x51aca2['query'][_0x72f2('0x30')]));_0x3b9582[_0x72f2('0x31')]=_0x3b9582[_0x72f2('0x31')][_0x72f2('0x41')]?_0x3b9582['attributes']:_0x1bf176[_0x72f2('0x2b')];if(_0x51aca2['query'][_0x72f2('0x3b')]){_0x3b9582['include']=[{'all':!![]}];}_0x3b9582=_[_0x72f2('0x38')]({},_0x3b9582,_0x51aca2[_0x72f2('0x3a')]);return db[_0x72f2('0x26')][_0x72f2('0x42')](_0x3b9582)[_0x72f2('0x1e')](handleEntityNotFound(_0x590054,null))[_0x72f2('0x1e')](respondWithResult(_0x590054,null))[_0x72f2('0x3f')](handleError(_0x590054,null));};exports[_0x72f2('0x43')]=function(_0x1f31b2,_0x4c5ce1,_0x4121a8){return db[_0x72f2('0x26')][_0x72f2('0x42')]({'where':{'id':_0x1f31b2[_0x72f2('0x44')]['id']},'attributes':[_0x72f2('0x24'),'save_name',_0x72f2('0x45')],'raw':!![]})[_0x72f2('0x1e')](handleEntityNotFound(_0x4c5ce1,null))[_0x72f2('0x1e')](function(_0x3428f4){if(_0x3428f4){if(!fs[_0x72f2('0x46')](path[_0x72f2('0x47')](config['root'],_0x72f2('0x48'),_0x3428f4[_0x72f2('0x49')]+'.'+_0x3428f4[_0x72f2('0x45')]))){throw new db[(_0x72f2('0x4a'))][(_0x72f2('0x4b'))](_0x72f2('0x4c'));}return _0x4c5ce1[_0x72f2('0x43')](path[_0x72f2('0x47')](config['root'],_0x72f2('0x48'),util[_0x72f2('0x4d')](_0x72f2('0x4e'),_0x3428f4[_0x72f2('0x49')],_0x3428f4[_0x72f2('0x45')])),util[_0x72f2('0x4d')](_0x72f2('0x4e'),_0x3428f4['name'],_0x3428f4[_0x72f2('0x45')]));}return null;})[_0x72f2('0x3f')](handleError(_0x4c5ce1,null));};exports[_0x72f2('0x4f')]=function(_0x4cf1c0,_0x5f3ae9,_0x45ca3a){var _0x57d150={'name':path['basename'](_0x4cf1c0[_0x72f2('0x50')][_0x72f2('0x51')],path['extname'](_0x4cf1c0[_0x72f2('0x50')][_0x72f2('0x51')])),'save_name':path[_0x72f2('0x52')](_0x4cf1c0[_0x72f2('0x50')][_0x72f2('0x53')],path['extname'](_0x4cf1c0['file'][_0x72f2('0x53')])),'original_format':path['extname'](_0x4cf1c0['file'][_0x72f2('0x51')])['substring'](0x1),'converted_format':'wav'};var _0x192cc7=path[_0x72f2('0x47')](config['root'],'server/files/sounds/original',_0x4cf1c0[_0x72f2('0x50')][_0x72f2('0x53')]);var _0x463f76=path[_0x72f2('0x47')](config[_0x72f2('0x54')],_0x72f2('0x48'),util['format'](_0x72f2('0x4e'),path[_0x72f2('0x52')](_0x4cf1c0[_0x72f2('0x50')]['filename'],path['extname'](_0x4cf1c0['file'][_0x72f2('0x53')])),_0x57d150['converted_format']));logger[_0x72f2('0x55')]('Sound\x20upload\x20filepath:\x20%s',_0x192cc7);logger[_0x72f2('0x55')]('Sound\x20upload\x20destination:\x20%s',_0x463f76);try{fs[_0x72f2('0x56')](_0x192cc7,parseInt(_0x72f2('0x57'),0x8));var _0x3fbcdb=sox['transcode'](_0x192cc7,_0x463f76,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3fbcdb['on'](_0x72f2('0x22'),function(_0x273642){fs[_0x72f2('0x58')](_0x192cc7);_0x5f3ae9[_0x72f2('0x14')](0x1f4)[_0x72f2('0x59')](_0x273642);});_0x3fbcdb['on']('src',function(_0x20e143){_0x57d150['original_duration']=isNaN(_0x20e143[_0x72f2('0x5a')])?null:_0x20e143[_0x72f2('0x5a')]*0x3e8;_0x57d150[_0x72f2('0x5b')]=isNaN(_0x20e143['sampleCount'])?null:_0x20e143['sampleCount'];_0x57d150[_0x72f2('0x5c')]=isNaN(_0x20e143[_0x72f2('0x5d')])?null:_0x20e143[_0x72f2('0x5d')];_0x57d150[_0x72f2('0x5e')]=isNaN(_0x20e143[_0x72f2('0x5f')])?null:_0x20e143[_0x72f2('0x5f')];_0x57d150['original_sampleRate']=isNaN(_0x20e143['sampleRate'])?null:_0x20e143[_0x72f2('0x60')];});_0x3fbcdb['on'](_0x72f2('0x61'),function(_0x5121bc){_0x57d150[_0x72f2('0x62')]=isNaN(_0x5121bc[_0x72f2('0x5a')])?null:_0x5121bc[_0x72f2('0x5a')]*0x3e8;_0x57d150[_0x72f2('0x63')]=isNaN(_0x5121bc[_0x72f2('0x64')])?null:_0x5121bc[_0x72f2('0x64')];_0x57d150[_0x72f2('0x65')]=isNaN(_0x5121bc[_0x72f2('0x5d')])?null:_0x5121bc['channelCount'];_0x57d150[_0x72f2('0x66')]=isNaN(_0x5121bc[_0x72f2('0x5f')])?null:_0x5121bc[_0x72f2('0x5f')];_0x57d150['converted_sampleRate']=isNaN(_0x5121bc[_0x72f2('0x60')])?null:_0x5121bc[_0x72f2('0x60')];});_0x3fbcdb['on'](_0x72f2('0x15'),function(){fs[_0x72f2('0x56')](_0x463f76,parseInt(_0x72f2('0x57'),0x8));return db[_0x72f2('0x26')][_0x72f2('0x4f')](_0x57d150)[_0x72f2('0x1e')](function(_0x21155d){var _0x1ee638={'role':_0x4cf1c0[_0x72f2('0x67')][_0x72f2('0x68')],'userProfileId':_0x4cf1c0[_0x72f2('0x67')]['userProfileId']};if(!_0x1ee638)throw new Error(_0x72f2('0x69'));if(_0x1ee638['role']===_0x72f2('0x6a')){var _0x58d0fe=_0x21155d[_0x72f2('0x6b')]({'plain':!![]});return db[_0x72f2('0x6c')]['find']({'where':{'name':_0x72f2('0x20'),'userProfileId':_0x1ee638[_0x72f2('0x6d')]},'raw':!![]})[_0x72f2('0x1e')](function(_0x811623){if(_0x811623&&_0x811623[_0x72f2('0x6e')]===0x0){return db[_0x72f2('0x21')][_0x72f2('0x4f')]({'name':_0x58d0fe[_0x72f2('0x24')],'resourceId':_0x58d0fe['id'],'type':_0x811623[_0x72f2('0x24')],'sectionId':_0x811623['id']},{})[_0x72f2('0x1e')](function(){return _0x21155d;});}else{return _0x21155d;}})['catch'](function(_0x39f978){logger[_0x72f2('0x22')](_0x72f2('0x6f'),_0x39f978);throw _0x39f978;});}return _0x21155d;})[_0x72f2('0x1e')](respondWithResult(_0x5f3ae9,null))[_0x72f2('0x3f')](handleError(_0x5f3ae9,null));});_0x3fbcdb[_0x72f2('0x70')]();}catch(_0x1bd8c1){_0x5f3ae9['status'](0x1f4)[_0x72f2('0x59')](_0x1bd8c1);}};exports[_0x72f2('0x1d')]=function(_0x58c304,_0x48ae07,_0x5b2c98){return db[_0x72f2('0x26')][_0x72f2('0x42')]({'where':{'id':_0x58c304[_0x72f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x48ae07,null))['then'](saveUpdates(_['pick'](_0x58c304[_0x72f2('0x67')],[_0x72f2('0x24'),_0x72f2('0x71')]),null))[_0x72f2('0x1e')](respondWithResult(_0x48ae07,null))[_0x72f2('0x3f')](handleError(_0x48ae07,null));};exports['delete']=function(_0x162904,_0x2c5690,_0xbed883){return db[_0x72f2('0x26')][_0x72f2('0x42')]({'where':{'id':_0x162904[_0x72f2('0x44')]['id']}})[_0x72f2('0x1e')](function(_0x23afd2){if(_0x23afd2){return _0x23afd2[_0x72f2('0x1f')]();}})[_0x72f2('0x1e')](function(_0x147c18){var _0x4bbe72=path[_0x72f2('0x47')](config[_0x72f2('0x54')],_0x72f2('0x72'),util[_0x72f2('0x4d')](_0x72f2('0x4e'),_0x147c18[_0x72f2('0x49')],_0x147c18[_0x72f2('0x73')]));var _0x2788f5=path['join'](config[_0x72f2('0x54')],_0x72f2('0x48'),util['format'](_0x72f2('0x4e'),_0x147c18['save_name'],_0x147c18['converted_format']));fs[_0x72f2('0x58')](_0x4bbe72);fs[_0x72f2('0x58')](_0x2788f5);return _0x147c18;})[_0x72f2('0x1e')](function(_0xba5aa4){if(_0xba5aa4){return _0x2c5690['status'](0xcc)[_0x72f2('0x15')]();}})[_0x72f2('0x1e')](handleEntityNotFound(_0x2c5690,null))['catch'](handleError(_0x2c5690,null));}; \ No newline at end of file +var _0x21de=['create','basename','file','originalname','filename','extname','substring','wav','root','server/files/sounds/original','server/files/sounds/converted','converted_format','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Sounds','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','filter','merge','where','VIRTUAL','Sound','include','findAll','rows','length','options','download','find','params','save_name','existsSync','join','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format'];(function(_0x54accf,_0x5d18b8){var _0x45cb08=function(_0x78d510){while(--_0x78d510){_0x54accf['push'](_0x54accf['shift']());}};_0x45cb08(++_0x5d18b8);}(_0x21de,0xb4));var _0xe21d=function(_0x1c2d67,_0x2b7172){_0x1c2d67=_0x1c2d67-0x0;var _0x4602a3=_0x21de[_0x1c2d67];return _0x4602a3;};'use strict';var emlformat=require(_0xe21d('0x0'));var rimraf=require(_0xe21d('0x1'));var zipdir=require(_0xe21d('0x2'));var jsonpatch=require(_0xe21d('0x3'));var rp=require(_0xe21d('0x4'));var moment=require(_0xe21d('0x5'));var BPromise=require(_0xe21d('0x6'));var Mustache=require(_0xe21d('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe21d('0x8'));var csv=require(_0xe21d('0x9'));var ejs=require(_0xe21d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe21d('0xb'));var squel=require(_0xe21d('0xc'));var crypto=require(_0xe21d('0xd'));var jsforce=require(_0xe21d('0xe'));var deskjs=require(_0xe21d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe21d('0x10'));var Papa=require(_0xe21d('0x11'));var Redis=require(_0xe21d('0x12'));var authService=require(_0xe21d('0x13'));var qs=require(_0xe21d('0x14'));var as=require(_0xe21d('0x15'));var hardwareService=require(_0xe21d('0x16'));var logger=require('../../config/logger')(_0xe21d('0x17'));var utils=require(_0xe21d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303c1d,_0x43b5ea){_0x43b5ea=_0x43b5ea||0xcc;return function(_0x3edd59){if(_0x3edd59){return _0x303c1d[_0xe21d('0x19')](_0x43b5ea);}return _0x303c1d[_0xe21d('0x1a')](_0x43b5ea)[_0xe21d('0x1b')]();};}function respondWithResult(_0x416cee,_0x1a1f00){_0x1a1f00=_0x1a1f00||0xc8;return function(_0x45f47a){if(_0x45f47a){return _0x416cee[_0xe21d('0x1a')](_0x1a1f00)['json'](_0x45f47a);}};}function respondWithFilteredResult(_0xe9c931,_0x3c9805){return function(_0x4f65be){if(_0x4f65be){var _0x443747=typeof _0x3c9805[_0xe21d('0x1c')]===_0xe21d('0x1d')&&typeof _0x3c9805['limit']===_0xe21d('0x1d');var _0x15978a=_0x4f65be[_0xe21d('0x1e')];var _0x4577e8=_0x443747?0x0:_0x3c9805[_0xe21d('0x1c')];var _0x283c05=_0x443747?_0x4f65be[_0xe21d('0x1e')]:_0x3c9805['offset']+_0x3c9805['limit'];var _0x4c0afb;if(_0x283c05>=_0x15978a){_0x283c05=_0x15978a;_0x4c0afb=0xc8;}else{_0x4c0afb=0xce;}_0xe9c931[_0xe21d('0x1a')](_0x4c0afb);return _0xe9c931[_0xe21d('0x1f')]('Content-Range',_0x4577e8+'-'+_0x283c05+'/'+_0x15978a)[_0xe21d('0x20')](_0x4f65be);}return null;};}function patchUpdates(_0x1df548){return function(_0x2705be){try{jsonpatch[_0xe21d('0x21')](_0x2705be,_0x1df548,!![]);}catch(_0x1812d1){return BPromise[_0xe21d('0x22')](_0x1812d1);}return _0x2705be[_0xe21d('0x23')]();};}function saveUpdates(_0x4cd750,_0xbb0136){return function(_0x2bb812){if(_0x2bb812){return _0x2bb812[_0xe21d('0x24')](_0x4cd750)[_0xe21d('0x25')](function(_0x30555b){return _0x30555b;});}return null;};}function removeEntity(_0x307a2a,_0x1d07b8){return function(_0x44ad17){if(_0x44ad17){return _0x44ad17[_0xe21d('0x26')]()[_0xe21d('0x25')](function(){var _0x59d22e=_0x44ad17['get']({'plain':!![]});var _0x3f8d5e='Sounds';return db[_0xe21d('0x27')][_0xe21d('0x26')]({'where':{'type':_0x3f8d5e,'resourceId':_0x59d22e['id']}})[_0xe21d('0x25')](function(){return _0x44ad17;});})[_0xe21d('0x25')](function(){_0x307a2a[_0xe21d('0x1a')](0xcc)[_0xe21d('0x1b')]();});}};}function handleEntityNotFound(_0x3af017,_0x46319b){return function(_0x44fd25){if(!_0x44fd25){_0x3af017['sendStatus'](0x194);}return _0x44fd25;};}function handleError(_0xe44b33,_0x1a1fe4){_0x1a1fe4=_0x1a1fe4||0x1f4;return function(_0x335584){logger['error'](_0x335584[_0xe21d('0x28')]);if(_0x335584['name']){delete _0x335584[_0xe21d('0x29')];}_0xe44b33['status'](_0x1a1fe4)['send'](_0x335584);};}exports[_0xe21d('0x2a')]=function(_0x2a7fcd,_0x4aa6e7){var _0x75e429={},_0x59ccdd={},_0x4443ff={'count':0x0,'rows':[]};var _0x1c6ecb=_[_0xe21d('0x2b')](db['Sound'][_0xe21d('0x2c')],function(_0x48a9ab){return{'name':_0x48a9ab[_0xe21d('0x2d')],'type':_0x48a9ab[_0xe21d('0x2e')][_0xe21d('0x2f')]};});_0x59ccdd[_0xe21d('0x30')]=_[_0xe21d('0x2b')](_0x1c6ecb,'name');_0x59ccdd[_0xe21d('0x31')]=_[_0xe21d('0x32')](_0x2a7fcd[_0xe21d('0x31')]);_0x59ccdd[_0xe21d('0x33')]=_[_0xe21d('0x34')](_0x59ccdd[_0xe21d('0x30')],_0x59ccdd[_0xe21d('0x31')]);_0x75e429['attributes']=_[_0xe21d('0x34')](_0x59ccdd[_0xe21d('0x30')],qs[_0xe21d('0x35')](_0x2a7fcd[_0xe21d('0x31')][_0xe21d('0x35')]));_0x75e429['attributes']=_0x75e429[_0xe21d('0x36')]['length']?_0x75e429[_0xe21d('0x36')]:_0x59ccdd[_0xe21d('0x30')];if(!_0x2a7fcd[_0xe21d('0x31')][_0xe21d('0x37')](_0xe21d('0x38'))){_0x75e429[_0xe21d('0x39')]=qs[_0xe21d('0x39')](_0x2a7fcd[_0xe21d('0x31')][_0xe21d('0x39')]);_0x75e429['offset']=qs['offset'](_0x2a7fcd['query'][_0xe21d('0x1c')]);}_0x75e429['order']=qs['sort'](_0x2a7fcd[_0xe21d('0x31')][_0xe21d('0x3a')]);_0x75e429['where']=qs[_0xe21d('0x33')](_['pick'](_0x2a7fcd[_0xe21d('0x31')],_0x59ccdd['filters']),_0x1c6ecb);if(_0x2a7fcd[_0xe21d('0x31')][_0xe21d('0x3b')]){_0x75e429['where']=_[_0xe21d('0x3c')](_0x75e429[_0xe21d('0x3d')],{'$or':_[_0xe21d('0x2b')](_0x1c6ecb,function(_0x36f3a9){if(_0x36f3a9[_0xe21d('0x2e')]!==_0xe21d('0x3e')){var _0x40c6cb={};_0x40c6cb[_0x36f3a9[_0xe21d('0x29')]]={'$like':'%'+_0x2a7fcd['query']['filter']+'%'};return _0x40c6cb;}})});}_0x75e429=_[_0xe21d('0x3c')]({},_0x75e429,_0x2a7fcd['options']);var _0x56235c={'where':_0x75e429['where']};return db[_0xe21d('0x3f')]['count'](_0x56235c)[_0xe21d('0x25')](function(_0x1415fb){_0x4443ff[_0xe21d('0x1e')]=_0x1415fb;if(_0x2a7fcd[_0xe21d('0x31')]['includeAll']){_0x75e429[_0xe21d('0x40')]=[{'all':!![]}];}return db[_0xe21d('0x3f')][_0xe21d('0x41')](_0x75e429);})['then'](function(_0x11da75){_0x4443ff[_0xe21d('0x42')]=_0x11da75;return _0x4443ff;})[_0xe21d('0x25')](respondWithFilteredResult(_0x4aa6e7,_0x75e429))['catch'](handleError(_0x4aa6e7,null));};exports['show']=function(_0x150b6c,_0x53c527){var _0x2e1d2f={'raw':!![],'where':{'id':_0x150b6c['params']['id']}},_0x4bb8d0={};_0x4bb8d0['model']=_[_0xe21d('0x32')](db['Sound'][_0xe21d('0x2c')]);_0x4bb8d0[_0xe21d('0x31')]=_[_0xe21d('0x32')](_0x150b6c[_0xe21d('0x31')]);_0x4bb8d0[_0xe21d('0x33')]=_[_0xe21d('0x34')](_0x4bb8d0['model'],_0x4bb8d0[_0xe21d('0x31')]);_0x2e1d2f[_0xe21d('0x36')]=_[_0xe21d('0x34')](_0x4bb8d0['model'],qs[_0xe21d('0x35')](_0x150b6c[_0xe21d('0x31')][_0xe21d('0x35')]));_0x2e1d2f[_0xe21d('0x36')]=_0x2e1d2f[_0xe21d('0x36')][_0xe21d('0x43')]?_0x2e1d2f['attributes']:_0x4bb8d0['model'];if(_0x150b6c[_0xe21d('0x31')]['includeAll']){_0x2e1d2f['include']=[{'all':!![]}];}_0x2e1d2f=_[_0xe21d('0x3c')]({},_0x2e1d2f,_0x150b6c[_0xe21d('0x44')]);return db[_0xe21d('0x3f')]['find'](_0x2e1d2f)['then'](handleEntityNotFound(_0x53c527,null))[_0xe21d('0x25')](respondWithResult(_0x53c527,null))['catch'](handleError(_0x53c527,null));};exports[_0xe21d('0x45')]=function(_0x45267e,_0x5f16e9,_0x4ecc3b){return db['Sound'][_0xe21d('0x46')]({'where':{'id':_0x45267e[_0xe21d('0x47')]['id']},'attributes':[_0xe21d('0x29'),_0xe21d('0x48'),'converted_format'],'raw':!![]})[_0xe21d('0x25')](handleEntityNotFound(_0x5f16e9,null))[_0xe21d('0x25')](function(_0x4be18d){if(_0x4be18d){if(!fs[_0xe21d('0x49')](path[_0xe21d('0x4a')](config['root'],'server/files/sounds/converted',_0x4be18d[_0xe21d('0x48')]+'.'+_0x4be18d['converted_format']))){throw new db[(_0xe21d('0x4b'))][(_0xe21d('0x4c'))](_0xe21d('0x4d'));}return _0x5f16e9[_0xe21d('0x45')](path[_0xe21d('0x4a')](config['root'],'server/files/sounds/converted',util['format'](_0xe21d('0x4e'),_0x4be18d['save_name'],_0x4be18d['converted_format'])),util[_0xe21d('0x4f')](_0xe21d('0x4e'),_0x4be18d[_0xe21d('0x29')],_0x4be18d['converted_format']));}return null;})['catch'](handleError(_0x5f16e9,null));};exports[_0xe21d('0x50')]=function(_0x449922,_0xa5e574,_0x59a37a){var _0x20bc93={'name':path[_0xe21d('0x51')](_0x449922[_0xe21d('0x52')][_0xe21d('0x53')],path['extname'](_0x449922[_0xe21d('0x52')][_0xe21d('0x53')])),'save_name':path[_0xe21d('0x51')](_0x449922['file'][_0xe21d('0x54')],path[_0xe21d('0x55')](_0x449922[_0xe21d('0x52')][_0xe21d('0x54')])),'original_format':path[_0xe21d('0x55')](_0x449922[_0xe21d('0x52')]['originalname'])[_0xe21d('0x56')](0x1),'converted_format':_0xe21d('0x57')};var _0x1839ad=path[_0xe21d('0x4a')](config[_0xe21d('0x58')],_0xe21d('0x59'),_0x449922[_0xe21d('0x52')][_0xe21d('0x54')]);var _0x382fd4=path[_0xe21d('0x4a')](config[_0xe21d('0x58')],_0xe21d('0x5a'),util[_0xe21d('0x4f')]('%s.%s',path[_0xe21d('0x51')](_0x449922[_0xe21d('0x52')][_0xe21d('0x54')],path[_0xe21d('0x55')](_0x449922[_0xe21d('0x52')]['filename'])),_0x20bc93[_0xe21d('0x5b')]));logger[_0xe21d('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x1839ad);logger[_0xe21d('0x5c')](_0xe21d('0x5d'),_0x382fd4);try{fs[_0xe21d('0x5e')](_0x1839ad,parseInt(_0xe21d('0x5f'),0x8));var _0x55787a=sox[_0xe21d('0x60')](_0x1839ad,_0x382fd4,{'sampleRate':0x1f40,'format':_0xe21d('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55787a['on'](_0xe21d('0x61'),function(_0x3a0a42){fs[_0xe21d('0x62')](_0x1839ad);_0xa5e574[_0xe21d('0x1a')](0x1f4)[_0xe21d('0x63')](_0x3a0a42);});_0x55787a['on']('src',function(_0x25c260){_0x20bc93[_0xe21d('0x64')]=isNaN(_0x25c260[_0xe21d('0x65')])?null:_0x25c260[_0xe21d('0x65')]*0x3e8;_0x20bc93[_0xe21d('0x66')]=isNaN(_0x25c260[_0xe21d('0x67')])?null:_0x25c260[_0xe21d('0x67')];_0x20bc93[_0xe21d('0x68')]=isNaN(_0x25c260[_0xe21d('0x69')])?null:_0x25c260[_0xe21d('0x69')];_0x20bc93[_0xe21d('0x6a')]=isNaN(_0x25c260[_0xe21d('0x6b')])?null:_0x25c260['bitRate'];_0x20bc93[_0xe21d('0x6c')]=isNaN(_0x25c260['sampleRate'])?null:_0x25c260['sampleRate'];});_0x55787a['on']('dest',function(_0xa74c8b){_0x20bc93[_0xe21d('0x6d')]=isNaN(_0xa74c8b[_0xe21d('0x65')])?null:_0xa74c8b['duration']*0x3e8;_0x20bc93[_0xe21d('0x6e')]=isNaN(_0xa74c8b[_0xe21d('0x67')])?null:_0xa74c8b['sampleCount'];_0x20bc93[_0xe21d('0x6f')]=isNaN(_0xa74c8b['channelCount'])?null:_0xa74c8b[_0xe21d('0x69')];_0x20bc93[_0xe21d('0x70')]=isNaN(_0xa74c8b['bitRate'])?null:_0xa74c8b[_0xe21d('0x6b')];_0x20bc93[_0xe21d('0x71')]=isNaN(_0xa74c8b[_0xe21d('0x72')])?null:_0xa74c8b[_0xe21d('0x72')];});_0x55787a['on'](_0xe21d('0x1b'),function(){fs[_0xe21d('0x5e')](_0x382fd4,parseInt(_0xe21d('0x5f'),0x8));return db[_0xe21d('0x3f')][_0xe21d('0x50')](_0x20bc93)[_0xe21d('0x25')](function(_0x3180c7){var _0x1f128d={'role':_0x449922['body'][_0xe21d('0x73')],'userProfileId':_0x449922[_0xe21d('0x74')]['userProfileId']};if(!_0x1f128d)throw new Error(_0xe21d('0x75'));if(_0x1f128d[_0xe21d('0x73')]===_0xe21d('0x76')){var _0x146588=_0x3180c7[_0xe21d('0x77')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe21d('0x78'),'userProfileId':_0x1f128d[_0xe21d('0x79')]},'raw':!![]})[_0xe21d('0x25')](function(_0x177309){if(_0x177309&&_0x177309[_0xe21d('0x7a')]===0x0){return db[_0xe21d('0x27')]['create']({'name':_0x146588['name'],'resourceId':_0x146588['id'],'type':_0x177309[_0xe21d('0x29')],'sectionId':_0x177309['id']},{})[_0xe21d('0x25')](function(){return _0x3180c7;});}else{return _0x3180c7;}})[_0xe21d('0x7b')](function(_0x8eadd3){logger[_0xe21d('0x61')](_0xe21d('0x7c'),_0x8eadd3);throw _0x8eadd3;});}return _0x3180c7;})[_0xe21d('0x25')](respondWithResult(_0xa5e574,null))[_0xe21d('0x7b')](handleError(_0xa5e574,null));});_0x55787a[_0xe21d('0x7d')]();}catch(_0xe2fec1){_0xa5e574[_0xe21d('0x1a')](0x1f4)[_0xe21d('0x63')](_0xe2fec1);}};exports[_0xe21d('0x24')]=function(_0x14ff6b,_0x45a01f,_0x3495ba){return db[_0xe21d('0x3f')][_0xe21d('0x46')]({'where':{'id':_0x14ff6b[_0xe21d('0x47')]['id']}})[_0xe21d('0x25')](handleEntityNotFound(_0x45a01f,null))[_0xe21d('0x25')](saveUpdates(_[_0xe21d('0x7e')](_0x14ff6b[_0xe21d('0x74')],[_0xe21d('0x29'),_0xe21d('0x7f')]),null))[_0xe21d('0x25')](respondWithResult(_0x45a01f,null))[_0xe21d('0x7b')](handleError(_0x45a01f,null));};exports[_0xe21d('0x80')]=function(_0x28d63a,_0x55b9e6,_0x33092a){return db[_0xe21d('0x3f')][_0xe21d('0x46')]({'where':{'id':_0x28d63a[_0xe21d('0x47')]['id']}})[_0xe21d('0x25')](function(_0x545c46){if(_0x545c46){return _0x545c46[_0xe21d('0x26')]();}})[_0xe21d('0x25')](function(_0x587539){var _0x18b92c=path[_0xe21d('0x4a')](config[_0xe21d('0x58')],_0xe21d('0x59'),util[_0xe21d('0x4f')]('%s.%s',_0x587539['save_name'],_0x587539[_0xe21d('0x81')]));var _0x32ff77=path['join'](config[_0xe21d('0x58')],_0xe21d('0x5a'),util['format'](_0xe21d('0x4e'),_0x587539[_0xe21d('0x48')],_0x587539[_0xe21d('0x5b')]));fs[_0xe21d('0x62')](_0x18b92c);fs[_0xe21d('0x62')](_0x32ff77);return _0x587539;})[_0xe21d('0x25')](function(_0x42dbca){if(_0x42dbca){return _0x55b9e6[_0xe21d('0x1a')](0xcc)[_0xe21d('0x1b')]();}})[_0xe21d('0x25')](handleEntityNotFound(_0x55b9e6,null))[_0xe21d('0x7b')](handleError(_0x55b9e6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4153aaf..aeabe2c 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 _0xf1b7=['tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Sound'];(function(_0x4aa217,_0x2dfc4c){var _0xf81261=function(_0x250c98){while(--_0x250c98){_0x4aa217['push'](_0x4aa217['shift']());}};_0xf81261(++_0x2dfc4c);}(_0xf1b7,0x146));var _0x7f1b=function(_0x3c8abd,_0x39d41a){_0x3c8abd=_0x3c8abd-0x0;var _0x47b4c6=_0xf1b7[_0x3c8abd];return _0x47b4c6;};'use strict';var _=require(_0x7f1b('0x0'));var util=require(_0x7f1b('0x1'));var logger=require(_0x7f1b('0x2'))(_0x7f1b('0x3'));var moment=require('moment');var BPromise=require(_0x7f1b('0x4'));var rp=require(_0x7f1b('0x5'));var fs=require('fs');var path=require(_0x7f1b('0x6'));var rimraf=require(_0x7f1b('0x7'));var config=require(_0x7f1b('0x8'));var attributes=require('./sound.attributes');module[_0x7f1b('0x9')]=function(_0x164b56,_0x282f46){return _0x164b56[_0x7f1b('0xa')](_0x7f1b('0xb'),attributes,{'tableName':_0x7f1b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8172=['./sound.attributes','exports','define','Sound','tools_sounds','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6411e5,_0x47ddb4){var _0x3343f1=function(_0x3a357f){while(--_0x3a357f){_0x6411e5['push'](_0x6411e5['shift']());}};_0x3343f1(++_0x47ddb4);}(_0x8172,0xd5));var _0x2817=function(_0x49eb8d,_0x2998e6){_0x49eb8d=_0x49eb8d-0x0;var _0x50deaa=_0x8172[_0x49eb8d];return _0x50deaa;};'use strict';var _=require('lodash');var util=require(_0x2817('0x0'));var logger=require('../../config/logger')(_0x2817('0x1'));var moment=require(_0x2817('0x2'));var BPromise=require(_0x2817('0x3'));var rp=require(_0x2817('0x4'));var fs=require('fs');var path=require(_0x2817('0x5'));var rimraf=require(_0x2817('0x6'));var config=require(_0x2817('0x7'));var attributes=require(_0x2817('0x8'));module[_0x2817('0x9')]=function(_0x3987ff,_0x51065d){return _0x3987ff[_0x2817('0xa')](_0x2817('0xb'),attributes,{'tableName':_0x2817('0xc'),'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 0824458..177b7ff 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 _0x6cf2=['error','code','message','info','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x6cf2,0x126));var _0x26cf=function(_0x4db2a0,_0x3e6be1){_0x4db2a0=_0x4db2a0-0x0;var _0x4aee38=_0x6cf2[_0x4db2a0];return _0x4aee38;};'use strict';var _=require(_0x26cf('0x0'));var util=require(_0x26cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x26cf('0x2'));var fs=require('fs');var Redis=require(_0x26cf('0x3'));var db=require(_0x26cf('0x4'))['db'];var utils=require(_0x26cf('0x5'));var logger=require('../../config/logger')(_0x26cf('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x26cf('0x7')][_0x26cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2426e4,_0x13f787,_0x469d00){return new BPromise(function(_0x3cd094,_0x786ed5){return client[_0x26cf('0x9')](_0x2426e4,_0x469d00)[_0x26cf('0xa')](function(_0x504442){logger['info'](_0x26cf('0xb'),_0x13f787,_0x26cf('0xc'));logger[_0x26cf('0xd')](_0x26cf('0xe'),_0x13f787,'request\x20sent',JSON[_0x26cf('0xf')](_0x504442));if(_0x504442['error']){if(_0x504442[_0x26cf('0x10')][_0x26cf('0x11')]===0x1f4){logger['error'](_0x26cf('0xb'),_0x13f787,_0x504442[_0x26cf('0x10')][_0x26cf('0x12')]);return _0x786ed5(_0x504442[_0x26cf('0x10')][_0x26cf('0x12')]);}logger['error'](_0x26cf('0xb'),_0x13f787,_0x504442['error']['message']);return _0x3cd094(_0x504442[_0x26cf('0x10')]['message']);}else{logger[_0x26cf('0x13')](_0x26cf('0xb'),_0x13f787,_0x26cf('0xc'));_0x3cd094(_0x504442[_0x26cf('0x14')][_0x26cf('0x12')]);}})[_0x26cf('0x15')](function(_0x27315f){logger[_0x26cf('0x10')](_0x26cf('0xb'),_0x13f787,_0x27315f);_0x786ed5(_0x27315f);});});}exports[_0x26cf('0x16')]=function(_0x2aa83f){var _0xf9a0c1=this;return new Promise(function(_0x109325,_0x1349cb){return db['Sound'][_0x26cf('0x17')]({'raw':_0x2aa83f[_0x26cf('0x18')]?_0x2aa83f[_0x26cf('0x18')][_0x26cf('0x19')]===undefined?!![]:![]:!![],'where':_0x2aa83f[_0x26cf('0x18')]?_0x2aa83f[_0x26cf('0x18')][_0x26cf('0x1a')]||null:null,'attributes':_0x2aa83f[_0x26cf('0x18')]?_0x2aa83f[_0x26cf('0x18')][_0x26cf('0x1b')]||null:null,'include':_0x2aa83f[_0x26cf('0x18')]?_0x2aa83f[_0x26cf('0x18')][_0x26cf('0x1c')]?_[_0x26cf('0x1d')](_0x2aa83f[_0x26cf('0x18')][_0x26cf('0x1c')],function(_0x231484){return{'model':db[_0x231484[_0x26cf('0x1e')]],'as':_0x231484['as'],'attributes':_0x231484[_0x26cf('0x1b')],'include':_0x231484[_0x26cf('0x1c')]?_[_0x26cf('0x1d')](_0x231484[_0x26cf('0x1c')],function(_0x310bbd){return{'model':db[_0x310bbd['model']],'as':_0x310bbd['as'],'attributes':_0x310bbd[_0x26cf('0x1b')],'include':_0x310bbd[_0x26cf('0x1c')]?_[_0x26cf('0x1d')](_0x310bbd[_0x26cf('0x1c')],function(_0x2b14b2){return{'model':db[_0x2b14b2[_0x26cf('0x1e')]],'as':_0x2b14b2['as'],'attributes':_0x2b14b2[_0x26cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x26cf('0xa')](function(_0x5705b3){logger['info'](_0x26cf('0x16'),_0x2aa83f);logger[_0x26cf('0xd')]('ShowSound',_0x2aa83f,JSON[_0x26cf('0xf')](_0x5705b3));_0x109325(_0x5705b3);})[_0x26cf('0x15')](function(_0x5a88aa){logger[_0x26cf('0x10')](_0x26cf('0x16'),_0x5a88aa['message'],_0x2aa83f);_0x1349cb(_0xf9a0c1[_0x26cf('0x10')](0x1f4,_0x5a88aa[_0x26cf('0x12')]));});});}; \ No newline at end of file +var _0xfb88=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Sound','options','where','attributes','include','map','model','ShowSound','lodash','util'];(function(_0x131719,_0xcda06b){var _0x1109ff=function(_0x5c6809){while(--_0x5c6809){_0x131719['push'](_0x131719['shift']());}};_0x1109ff(++_0xcda06b);}(_0xfb88,0x191));var _0x8fb8=function(_0x132d84,_0x3dcff9){_0x132d84=_0x132d84-0x0;var _0x3764d7=_0xfb88[_0x132d84];return _0x3764d7;};'use strict';var _=require(_0x8fb8('0x0'));var util=require(_0x8fb8('0x1'));var moment=require(_0x8fb8('0x2'));var BPromise=require(_0x8fb8('0x3'));var rs=require(_0x8fb8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fb8('0x5'))['db'];var utils=require(_0x8fb8('0x6'));var logger=require(_0x8fb8('0x7'))(_0x8fb8('0x8'));var config=require('../../config/environment');var jayson=require(_0x8fb8('0x9'));var client=jayson['client'][_0x8fb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a6286,_0x2a46b2,_0x148b43){return new BPromise(function(_0x3be9d7,_0x3b2060){return client[_0x8fb8('0xb')](_0x1a6286,_0x148b43)[_0x8fb8('0xc')](function(_0x22fa2d){logger[_0x8fb8('0xd')](_0x8fb8('0xe'),_0x2a46b2,_0x8fb8('0xf'));logger[_0x8fb8('0x10')](_0x8fb8('0x11'),_0x2a46b2,_0x8fb8('0xf'),JSON[_0x8fb8('0x12')](_0x22fa2d));if(_0x22fa2d['error']){if(_0x22fa2d[_0x8fb8('0x13')]['code']===0x1f4){logger[_0x8fb8('0x13')](_0x8fb8('0xe'),_0x2a46b2,_0x22fa2d[_0x8fb8('0x13')][_0x8fb8('0x14')]);return _0x3b2060(_0x22fa2d[_0x8fb8('0x13')][_0x8fb8('0x14')]);}logger['error'](_0x8fb8('0xe'),_0x2a46b2,_0x22fa2d[_0x8fb8('0x13')][_0x8fb8('0x14')]);return _0x3be9d7(_0x22fa2d[_0x8fb8('0x13')][_0x8fb8('0x14')]);}else{logger[_0x8fb8('0xd')](_0x8fb8('0xe'),_0x2a46b2,_0x8fb8('0xf'));_0x3be9d7(_0x22fa2d[_0x8fb8('0x15')]['message']);}})[_0x8fb8('0x16')](function(_0x55cabc){logger['error'](_0x8fb8('0xe'),_0x2a46b2,_0x55cabc);_0x3b2060(_0x55cabc);});});}exports['ShowSound']=function(_0x2040e4){var _0x3d51d9=this;return new Promise(function(_0x2004f5,_0x3f7134){return db[_0x8fb8('0x17')]['find']({'raw':_0x2040e4[_0x8fb8('0x18')]?_0x2040e4[_0x8fb8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2040e4[_0x8fb8('0x18')]?_0x2040e4[_0x8fb8('0x18')][_0x8fb8('0x19')]||null:null,'attributes':_0x2040e4[_0x8fb8('0x18')]?_0x2040e4[_0x8fb8('0x18')][_0x8fb8('0x1a')]||null:null,'include':_0x2040e4[_0x8fb8('0x18')]?_0x2040e4[_0x8fb8('0x18')][_0x8fb8('0x1b')]?_[_0x8fb8('0x1c')](_0x2040e4[_0x8fb8('0x18')][_0x8fb8('0x1b')],function(_0x43c18d){return{'model':db[_0x43c18d[_0x8fb8('0x1d')]],'as':_0x43c18d['as'],'attributes':_0x43c18d[_0x8fb8('0x1a')],'include':_0x43c18d[_0x8fb8('0x1b')]?_[_0x8fb8('0x1c')](_0x43c18d[_0x8fb8('0x1b')],function(_0x2f358c){return{'model':db[_0x2f358c['model']],'as':_0x2f358c['as'],'attributes':_0x2f358c[_0x8fb8('0x1a')],'include':_0x2f358c[_0x8fb8('0x1b')]?_['map'](_0x2f358c['include'],function(_0x4b4fb0){return{'model':db[_0x4b4fb0[_0x8fb8('0x1d')]],'as':_0x4b4fb0['as'],'attributes':_0x4b4fb0[_0x8fb8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8fb8('0xc')](function(_0x395499){logger[_0x8fb8('0xd')](_0x8fb8('0x1e'),_0x2040e4);logger['debug']('ShowSound',_0x2040e4,JSON[_0x8fb8('0x12')](_0x395499));_0x2004f5(_0x395499);})['catch'](function(_0x87c326){logger[_0x8fb8('0x13')]('ShowSound',_0x87c326[_0x8fb8('0x14')],_0x2040e4);_0x3f7134(_0x3d51d9['error'](0x1f4,_0x87c326[_0x8fb8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b0a02c6..0b1bd93 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x23267d,_0x1a097a){var _0x3115d5=function(_0x59f0ef){while(--_0x59f0ef){_0x23267d['push'](_0x23267d['shift']());}};_0x3115d5(++_0x1a097a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xb7e7[_0x1b7368];return _0x25d54c;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x389b60,_0x332dc6){var _0x11bcca=function(_0x270c83){while(--_0x270c83){_0x389b60['push'](_0x389b60['shift']());}};_0x11bcca(++_0x332dc6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d1e2d7b..52bf766 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 _0xc332=['ENUM','out','sequelize','exports','TEXT','medium'];(function(_0x3febe9,_0x23557a){var _0x4738c8=function(_0x30cf88){while(--_0x30cf88){_0x3febe9['push'](_0x3febe9['shift']());}};_0x4738c8(++_0x23557a);}(_0xc332,0x1ca));var _0x2c33=function(_0x48114c,_0x79f160){_0x48114c=_0x48114c-0x0;var _0x39c71b=_0xc332[_0x48114c];return _0x39c71b;};'use strict';var Sequelize=require(_0x2c33('0x0'));module[_0x2c33('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x2c33('0x2')](_0x2c33('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x2c33('0x4')]('in','out'),'defaultValue':_0x2c33('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2c33('0x2')]}}; \ No newline at end of file +var _0xb1f7=['medium','ENUM','TEXT','sequelize','exports','STRING'];(function(_0x133797,_0x3fb495){var _0x309d13=function(_0x4cb009){while(--_0x4cb009){_0x133797['push'](_0x133797['shift']());}};_0x309d13(++_0x3fb495);}(_0xb1f7,0x15f));var _0x7b1f=function(_0x1adaee,_0x5b65e1){_0x1adaee=_0x1adaee-0x0;var _0x1e8c47=_0xb1f7[_0x1adaee];return _0x1e8c47;};'use strict';var Sequelize=require(_0x7b1f('0x0'));module[_0x7b1f('0x1')]={'uniqueid':{'type':Sequelize[_0x7b1f('0x2')]},'body':{'type':Sequelize['TEXT'](_0x7b1f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7b1f('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7b1f('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index cafdcc9..3b1362d 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 _0x55af=['fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x55af,0x1ab));var _0xf55a=function(_0x2efe98,_0x1aa2ca){_0x2efe98=_0x2efe98-0x0;var _0x110970=_0x55af[_0x2efe98];return _0x110970;};'use strict';var emlformat=require(_0xf55a('0x0'));var rimraf=require(_0xf55a('0x1'));var zipdir=require(_0xf55a('0x2'));var jsonpatch=require(_0xf55a('0x3'));var rp=require(_0xf55a('0x4'));var moment=require(_0xf55a('0x5'));var BPromise=require(_0xf55a('0x6'));var Mustache=require(_0xf55a('0x7'));var util=require(_0xf55a('0x8'));var path=require(_0xf55a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf55a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf55a('0xb'));var squel=require(_0xf55a('0xc'));var crypto=require(_0xf55a('0xd'));var jsforce=require(_0xf55a('0xe'));var deskjs=require(_0xf55a('0xf'));var toCsv=require(_0xf55a('0x10'));var querystring=require(_0xf55a('0x11'));var Papa=require(_0xf55a('0x12'));var Redis=require(_0xf55a('0x13'));var authService=require(_0xf55a('0x14'));var qs=require(_0xf55a('0x15'));var as=require(_0xf55a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf55a('0x17'))('api');var utils=require(_0xf55a('0x18'));var config=require(_0xf55a('0x19'));var licenseUtil=require(_0xf55a('0x1a'));var db=require(_0xf55a('0x1b'))['db'];function respondWithStatusCode(_0x5a7f19,_0x3c9a59){_0x3c9a59=_0x3c9a59||0xcc;return function(_0x257fdd){if(_0x257fdd){return _0x5a7f19[_0xf55a('0x1c')](_0x3c9a59);}return _0x5a7f19[_0xf55a('0x1d')](_0x3c9a59)['end']();};}function respondWithResult(_0x26822d,_0x3bf3dd){_0x3bf3dd=_0x3bf3dd||0xc8;return function(_0xe174c6){if(_0xe174c6){return _0x26822d[_0xf55a('0x1d')](_0x3bf3dd)[_0xf55a('0x1e')](_0xe174c6);}};}function respondWithFilteredResult(_0x5264b9,_0x1ecf0b){return function(_0x290565){if(_0x290565){var _0x26b223=typeof _0x1ecf0b[_0xf55a('0x1f')]===_0xf55a('0x20')&&typeof _0x1ecf0b[_0xf55a('0x21')]===_0xf55a('0x20');var _0xb10d4c=_0x290565[_0xf55a('0x22')];var _0x1e6149=_0x26b223?0x0:_0x1ecf0b[_0xf55a('0x1f')];var _0x53fbf1=_0x26b223?_0x290565[_0xf55a('0x22')]:_0x1ecf0b['offset']+_0x1ecf0b[_0xf55a('0x21')];var _0xa6152;if(_0x53fbf1>=_0xb10d4c){_0x53fbf1=_0xb10d4c;_0xa6152=0xc8;}else{_0xa6152=0xce;}_0x5264b9[_0xf55a('0x1d')](_0xa6152);return _0x5264b9[_0xf55a('0x23')](_0xf55a('0x24'),_0x1e6149+'-'+_0x53fbf1+'/'+_0xb10d4c)['json'](_0x290565);}return null;};}function patchUpdates(_0x25a8d4){return function(_0x3bc0c6){try{jsonpatch[_0xf55a('0x25')](_0x3bc0c6,_0x25a8d4,!![]);}catch(_0x4f508f){return BPromise[_0xf55a('0x26')](_0x4f508f);}return _0x3bc0c6[_0xf55a('0x27')]();};}function saveUpdates(_0x976b44,_0x4df2ee){return function(_0x4b89bc){if(_0x4b89bc){return _0x4b89bc[_0xf55a('0x28')](_0x976b44)[_0xf55a('0x29')](function(_0x414c30){return _0x414c30;});}return null;};}function removeEntity(_0x14634a,_0x398ac8){return function(_0x4f75bc){if(_0x4f75bc){return _0x4f75bc['destroy']()['then'](function(){_0x14634a[_0xf55a('0x1d')](0xcc)[_0xf55a('0x2a')]();});}};}function handleEntityNotFound(_0x4f5921,_0x1ccd3e){return function(_0x21dda3){if(!_0x21dda3){_0x4f5921[_0xf55a('0x1c')](0x194);}return _0x21dda3;};}function handleError(_0x137019,_0xbd5e89){_0xbd5e89=_0xbd5e89||0x1f4;return function(_0xd1e343){logger['error'](_0xd1e343[_0xf55a('0x2b')]);if(_0xd1e343[_0xf55a('0x2c')]){delete _0xd1e343[_0xf55a('0x2c')];}_0x137019[_0xf55a('0x1d')](_0xbd5e89)[_0xf55a('0x2d')](_0xd1e343);};}exports[_0xf55a('0x2e')]=function(_0x4660db,_0x1c504a){var _0x54fc4f={},_0x2a632a={},_0x1e93ed={'count':0x0,'rows':[]};var _0x51d42e=_['map'](db[_0xf55a('0x2f')][_0xf55a('0x30')],function(_0x2c50db){return{'name':_0x2c50db[_0xf55a('0x31')],'type':_0x2c50db[_0xf55a('0x32')][_0xf55a('0x33')]};});_0x2a632a[_0xf55a('0x34')]=_[_0xf55a('0x35')](_0x51d42e,_0xf55a('0x2c'));_0x2a632a[_0xf55a('0x36')]=_[_0xf55a('0x37')](_0x4660db[_0xf55a('0x36')]);_0x2a632a[_0xf55a('0x38')]=_['intersection'](_0x2a632a[_0xf55a('0x34')],_0x2a632a[_0xf55a('0x36')]);_0x54fc4f[_0xf55a('0x39')]=_[_0xf55a('0x3a')](_0x2a632a[_0xf55a('0x34')],qs['fields'](_0x4660db[_0xf55a('0x36')][_0xf55a('0x3b')]));_0x54fc4f[_0xf55a('0x39')]=_0x54fc4f[_0xf55a('0x39')]['length']?_0x54fc4f[_0xf55a('0x39')]:_0x2a632a[_0xf55a('0x34')];if(!_0x4660db[_0xf55a('0x36')]['hasOwnProperty'](_0xf55a('0x3c'))){_0x54fc4f[_0xf55a('0x21')]=qs[_0xf55a('0x21')](_0x4660db[_0xf55a('0x36')][_0xf55a('0x21')]);_0x54fc4f[_0xf55a('0x1f')]=qs[_0xf55a('0x1f')](_0x4660db['query'][_0xf55a('0x1f')]);}_0x54fc4f[_0xf55a('0x3d')]=qs[_0xf55a('0x3e')](_0x4660db[_0xf55a('0x36')][_0xf55a('0x3e')]);_0x54fc4f[_0xf55a('0x3f')]=qs['filters'](_[_0xf55a('0x40')](_0x4660db[_0xf55a('0x36')],_0x2a632a['filters']),_0x51d42e);if(_0x4660db[_0xf55a('0x36')][_0xf55a('0x41')]){_0x54fc4f[_0xf55a('0x3f')]=_[_0xf55a('0x42')](_0x54fc4f[_0xf55a('0x3f')],{'$or':_[_0xf55a('0x35')](_0x51d42e,function(_0x4c65d6){if(_0x4c65d6[_0xf55a('0x32')]!==_0xf55a('0x43')){var _0x48e361={};_0x48e361[_0x4c65d6['name']]={'$like':'%'+_0x4660db[_0xf55a('0x36')][_0xf55a('0x41')]+'%'};return _0x48e361;}})});}_0x54fc4f=_[_0xf55a('0x42')]({},_0x54fc4f,_0x4660db[_0xf55a('0x44')]);var _0x1ee00b={'where':_0x54fc4f['where']};return db[_0xf55a('0x2f')][_0xf55a('0x22')](_0x1ee00b)['then'](function(_0xae046){_0x1e93ed[_0xf55a('0x22')]=_0xae046;if(_0x4660db[_0xf55a('0x36')]['includeAll']){_0x54fc4f[_0xf55a('0x45')]=[{'all':!![]}];}return db['SquareMessage'][_0xf55a('0x46')](_0x54fc4f);})[_0xf55a('0x29')](function(_0x16e6b8){_0x1e93ed[_0xf55a('0x47')]=_0x16e6b8;return _0x1e93ed;})[_0xf55a('0x29')](respondWithFilteredResult(_0x1c504a,_0x54fc4f))['catch'](handleError(_0x1c504a,null));};exports[_0xf55a('0x48')]=function(_0x52c354,_0x35759f){var _0x38dab7={'raw':!![],'where':{'id':_0x52c354[_0xf55a('0x49')]['id']}},_0x13dfe8={};_0x13dfe8[_0xf55a('0x34')]=_[_0xf55a('0x37')](db[_0xf55a('0x2f')]['rawAttributes']);_0x13dfe8[_0xf55a('0x36')]=_['keys'](_0x52c354[_0xf55a('0x36')]);_0x13dfe8[_0xf55a('0x38')]=_[_0xf55a('0x3a')](_0x13dfe8[_0xf55a('0x34')],_0x13dfe8[_0xf55a('0x36')]);_0x38dab7[_0xf55a('0x39')]=_[_0xf55a('0x3a')](_0x13dfe8['model'],qs[_0xf55a('0x3b')](_0x52c354['query'][_0xf55a('0x3b')]));_0x38dab7['attributes']=_0x38dab7['attributes'][_0xf55a('0x4a')]?_0x38dab7[_0xf55a('0x39')]:_0x13dfe8[_0xf55a('0x34')];if(_0x52c354[_0xf55a('0x36')][_0xf55a('0x4b')]){_0x38dab7[_0xf55a('0x45')]=[{'all':!![]}];}_0x38dab7=_[_0xf55a('0x42')]({},_0x38dab7,_0x52c354['options']);return db[_0xf55a('0x2f')][_0xf55a('0x4c')](_0x38dab7)[_0xf55a('0x29')](handleEntityNotFound(_0x35759f,null))[_0xf55a('0x29')](respondWithResult(_0x35759f,null))[_0xf55a('0x4d')](handleError(_0x35759f,null));};exports[_0xf55a('0x4e')]=function(_0x2f6fa3,_0x2b75e9){return db[_0xf55a('0x2f')]['create'](_0x2f6fa3[_0xf55a('0x4f')],{})[_0xf55a('0x29')](respondWithResult(_0x2b75e9,0xc9))['catch'](handleError(_0x2b75e9,null));};exports['update']=function(_0x4ccaf9,_0x17f2df){if(_0x4ccaf9[_0xf55a('0x4f')]['id']){delete _0x4ccaf9[_0xf55a('0x4f')]['id'];}return db[_0xf55a('0x2f')]['find']({'where':{'id':_0x4ccaf9[_0xf55a('0x49')]['id']}})[_0xf55a('0x29')](handleEntityNotFound(_0x17f2df,null))[_0xf55a('0x29')](saveUpdates(_0x4ccaf9['body'],null))[_0xf55a('0x29')](respondWithResult(_0x17f2df,null))[_0xf55a('0x4d')](handleError(_0x17f2df,null));};exports[_0xf55a('0x50')]=function(_0x259bb4,_0x3669b0){return db['SquareMessage'][_0xf55a('0x4c')]({'where':{'id':_0x259bb4[_0xf55a('0x49')]['id']}})[_0xf55a('0x29')](handleEntityNotFound(_0x3669b0,null))[_0xf55a('0x29')](removeEntity(_0x3669b0,null))[_0xf55a('0x4d')](handleError(_0x3669b0,null));}; \ No newline at end of file +var _0x8cda=['set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','include','find','create','body','catch','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','undefined','limit','count'];(function(_0x27cb3f,_0x115c87){var _0x2ff90c=function(_0x3e1fe0){while(--_0x3e1fe0){_0x27cb3f['push'](_0x27cb3f['shift']());}};_0x2ff90c(++_0x115c87);}(_0x8cda,0x1db));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa8cd('0x0'));var zipdir=require(_0xa8cd('0x1'));var jsonpatch=require(_0xa8cd('0x2'));var rp=require(_0xa8cd('0x3'));var moment=require(_0xa8cd('0x4'));var BPromise=require(_0xa8cd('0x5'));var Mustache=require('mustache');var util=require(_0xa8cd('0x6'));var path=require(_0xa8cd('0x7'));var sox=require(_0xa8cd('0x8'));var csv=require('to-csv');var ejs=require(_0xa8cd('0x9'));var fs=require('fs');var fs_extra=require(_0xa8cd('0xa'));var _=require(_0xa8cd('0xb'));var squel=require(_0xa8cd('0xc'));var crypto=require(_0xa8cd('0xd'));var jsforce=require(_0xa8cd('0xe'));var deskjs=require(_0xa8cd('0xf'));var toCsv=require(_0xa8cd('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa8cd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa8cd('0x12'));var hardwareService=require(_0xa8cd('0x13'));var logger=require('../../config/logger')(_0xa8cd('0x14'));var utils=require(_0xa8cd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa8cd('0x16'))['db'];function respondWithStatusCode(_0xa2b804,_0x19ba69){_0x19ba69=_0x19ba69||0xcc;return function(_0xefdff9){if(_0xefdff9){return _0xa2b804[_0xa8cd('0x17')](_0x19ba69);}return _0xa2b804['status'](_0x19ba69)[_0xa8cd('0x18')]();};}function respondWithResult(_0x51d29e,_0x16f366){_0x16f366=_0x16f366||0xc8;return function(_0x5ccd85){if(_0x5ccd85){return _0x51d29e[_0xa8cd('0x19')](_0x16f366)['json'](_0x5ccd85);}};}function respondWithFilteredResult(_0x1970c1,_0x4f244b){return function(_0x9fe9b0){if(_0x9fe9b0){var _0x5bfc4c=typeof _0x4f244b['offset']===_0xa8cd('0x1a')&&typeof _0x4f244b[_0xa8cd('0x1b')]===_0xa8cd('0x1a');var _0x177ca2=_0x9fe9b0['count'];var _0x128a90=_0x5bfc4c?0x0:_0x4f244b['offset'];var _0x1cacd5=_0x5bfc4c?_0x9fe9b0[_0xa8cd('0x1c')]:_0x4f244b['offset']+_0x4f244b[_0xa8cd('0x1b')];var _0x1260e5;if(_0x1cacd5>=_0x177ca2){_0x1cacd5=_0x177ca2;_0x1260e5=0xc8;}else{_0x1260e5=0xce;}_0x1970c1['status'](_0x1260e5);return _0x1970c1[_0xa8cd('0x1d')](_0xa8cd('0x1e'),_0x128a90+'-'+_0x1cacd5+'/'+_0x177ca2)[_0xa8cd('0x1f')](_0x9fe9b0);}return null;};}function patchUpdates(_0x289cb6){return function(_0x420505){try{jsonpatch['apply'](_0x420505,_0x289cb6,!![]);}catch(_0xdd4de1){return BPromise[_0xa8cd('0x20')](_0xdd4de1);}return _0x420505[_0xa8cd('0x21')]();};}function saveUpdates(_0x447d7f,_0x4f4093){return function(_0x1f15c0){if(_0x1f15c0){return _0x1f15c0['update'](_0x447d7f)['then'](function(_0x28574f){return _0x28574f;});}return null;};}function removeEntity(_0x70b17a,_0x4ec3cc){return function(_0x1c7b31){if(_0x1c7b31){return _0x1c7b31[_0xa8cd('0x22')]()[_0xa8cd('0x23')](function(){_0x70b17a[_0xa8cd('0x19')](0xcc)[_0xa8cd('0x18')]();});}};}function handleEntityNotFound(_0x2d1ef5,_0x1f369d){return function(_0x4a5221){if(!_0x4a5221){_0x2d1ef5[_0xa8cd('0x17')](0x194);}return _0x4a5221;};}function handleError(_0x42ae30,_0x3c4c22){_0x3c4c22=_0x3c4c22||0x1f4;return function(_0x393e5a){logger[_0xa8cd('0x24')](_0x393e5a[_0xa8cd('0x25')]);if(_0x393e5a['name']){delete _0x393e5a[_0xa8cd('0x26')];}_0x42ae30[_0xa8cd('0x19')](_0x3c4c22)[_0xa8cd('0x27')](_0x393e5a);};}exports[_0xa8cd('0x28')]=function(_0xe973cb,_0x2241f8){var _0x3285d8={},_0x3e1770={},_0x2a99e6={'count':0x0,'rows':[]};var _0x22cf82=_[_0xa8cd('0x29')](db[_0xa8cd('0x2a')][_0xa8cd('0x2b')],function(_0x44ea2f){return{'name':_0x44ea2f[_0xa8cd('0x2c')],'type':_0x44ea2f[_0xa8cd('0x2d')]['key']};});_0x3e1770['model']=_['map'](_0x22cf82,_0xa8cd('0x26'));_0x3e1770[_0xa8cd('0x2e')]=_[_0xa8cd('0x2f')](_0xe973cb[_0xa8cd('0x2e')]);_0x3e1770[_0xa8cd('0x30')]=_[_0xa8cd('0x31')](_0x3e1770['model'],_0x3e1770['query']);_0x3285d8['attributes']=_[_0xa8cd('0x31')](_0x3e1770[_0xa8cd('0x32')],qs[_0xa8cd('0x33')](_0xe973cb[_0xa8cd('0x2e')][_0xa8cd('0x33')]));_0x3285d8[_0xa8cd('0x34')]=_0x3285d8[_0xa8cd('0x34')]['length']?_0x3285d8[_0xa8cd('0x34')]:_0x3e1770[_0xa8cd('0x32')];if(!_0xe973cb['query'][_0xa8cd('0x35')](_0xa8cd('0x36'))){_0x3285d8[_0xa8cd('0x1b')]=qs[_0xa8cd('0x1b')](_0xe973cb['query'][_0xa8cd('0x1b')]);_0x3285d8[_0xa8cd('0x37')]=qs['offset'](_0xe973cb[_0xa8cd('0x2e')][_0xa8cd('0x37')]);}_0x3285d8[_0xa8cd('0x38')]=qs[_0xa8cd('0x39')](_0xe973cb['query']['sort']);_0x3285d8[_0xa8cd('0x3a')]=qs['filters'](_[_0xa8cd('0x3b')](_0xe973cb['query'],_0x3e1770[_0xa8cd('0x30')]),_0x22cf82);if(_0xe973cb[_0xa8cd('0x2e')]['filter']){_0x3285d8[_0xa8cd('0x3a')]=_[_0xa8cd('0x3c')](_0x3285d8[_0xa8cd('0x3a')],{'$or':_[_0xa8cd('0x29')](_0x22cf82,function(_0x451ba8){if(_0x451ba8[_0xa8cd('0x2d')]!==_0xa8cd('0x3d')){var _0x5100d5={};_0x5100d5[_0x451ba8[_0xa8cd('0x26')]]={'$like':'%'+_0xe973cb[_0xa8cd('0x2e')]['filter']+'%'};return _0x5100d5;}})});}_0x3285d8=_['merge']({},_0x3285d8,_0xe973cb[_0xa8cd('0x3e')]);var _0x3da42e={'where':_0x3285d8[_0xa8cd('0x3a')]};return db[_0xa8cd('0x2a')][_0xa8cd('0x1c')](_0x3da42e)[_0xa8cd('0x23')](function(_0x40cd4e){_0x2a99e6[_0xa8cd('0x1c')]=_0x40cd4e;if(_0xe973cb['query'][_0xa8cd('0x3f')]){_0x3285d8['include']=[{'all':!![]}];}return db[_0xa8cd('0x2a')]['findAll'](_0x3285d8);})[_0xa8cd('0x23')](function(_0x27a64c){_0x2a99e6[_0xa8cd('0x40')]=_0x27a64c;return _0x2a99e6;})[_0xa8cd('0x23')](respondWithFilteredResult(_0x2241f8,_0x3285d8))['catch'](handleError(_0x2241f8,null));};exports['show']=function(_0x5067d3,_0x5e8a6c){var _0x1b9f17={'raw':!![],'where':{'id':_0x5067d3['params']['id']}},_0x40c80d={};_0x40c80d[_0xa8cd('0x32')]=_[_0xa8cd('0x2f')](db[_0xa8cd('0x2a')][_0xa8cd('0x2b')]);_0x40c80d[_0xa8cd('0x2e')]=_[_0xa8cd('0x2f')](_0x5067d3['query']);_0x40c80d['filters']=_[_0xa8cd('0x31')](_0x40c80d[_0xa8cd('0x32')],_0x40c80d[_0xa8cd('0x2e')]);_0x1b9f17[_0xa8cd('0x34')]=_['intersection'](_0x40c80d[_0xa8cd('0x32')],qs[_0xa8cd('0x33')](_0x5067d3[_0xa8cd('0x2e')][_0xa8cd('0x33')]));_0x1b9f17['attributes']=_0x1b9f17['attributes']['length']?_0x1b9f17[_0xa8cd('0x34')]:_0x40c80d[_0xa8cd('0x32')];if(_0x5067d3['query'][_0xa8cd('0x3f')]){_0x1b9f17[_0xa8cd('0x41')]=[{'all':!![]}];}_0x1b9f17=_[_0xa8cd('0x3c')]({},_0x1b9f17,_0x5067d3[_0xa8cd('0x3e')]);return db[_0xa8cd('0x2a')][_0xa8cd('0x42')](_0x1b9f17)['then'](handleEntityNotFound(_0x5e8a6c,null))['then'](respondWithResult(_0x5e8a6c,null))['catch'](handleError(_0x5e8a6c,null));};exports[_0xa8cd('0x43')]=function(_0x2f3d01,_0x97f52a){return db[_0xa8cd('0x2a')][_0xa8cd('0x43')](_0x2f3d01[_0xa8cd('0x44')],{})[_0xa8cd('0x23')](respondWithResult(_0x97f52a,0xc9))[_0xa8cd('0x45')](handleError(_0x97f52a,null));};exports[_0xa8cd('0x46')]=function(_0x534f5a,_0x5429e8){if(_0x534f5a[_0xa8cd('0x44')]['id']){delete _0x534f5a['body']['id'];}return db[_0xa8cd('0x2a')][_0xa8cd('0x42')]({'where':{'id':_0x534f5a[_0xa8cd('0x47')]['id']}})[_0xa8cd('0x23')](handleEntityNotFound(_0x5429e8,null))[_0xa8cd('0x23')](saveUpdates(_0x534f5a['body'],null))[_0xa8cd('0x23')](respondWithResult(_0x5429e8,null))['catch'](handleError(_0x5429e8,null));};exports[_0xa8cd('0x22')]=function(_0x9dd1a3,_0x2114f2){return db[_0xa8cd('0x2a')][_0xa8cd('0x42')]({'where':{'id':_0x9dd1a3[_0xa8cd('0x47')]['id']}})[_0xa8cd('0x23')](handleEntityNotFound(_0x2114f2,null))[_0xa8cd('0x23')](removeEntity(_0x2114f2,null))[_0xa8cd('0x45')](handleError(_0x2114f2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 365774c..570d4e5 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 _0x6694=['request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4dce4f,_0x289ff5){var _0x4f4378=function(_0x577d3b){while(--_0x577d3b){_0x4dce4f['push'](_0x4dce4f['shift']());}};_0x4f4378(++_0x289ff5);}(_0x6694,0x10f));var _0x4669=function(_0x386547,_0xee0b62){_0x386547=_0x386547-0x0;var _0x41e370=_0x6694[_0x386547];return _0x41e370;};'use strict';var _=require(_0x4669('0x0'));var util=require('util');var logger=require(_0x4669('0x1'))(_0x4669('0x2'));var moment=require(_0x4669('0x3'));var BPromise=require(_0x4669('0x4'));var rp=require(_0x4669('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4669('0x6'));var config=require(_0x4669('0x7'));var attributes=require(_0x4669('0x8'));module[_0x4669('0x9')]=function(_0x413c5d,_0x562f2a){return _0x413c5d[_0x4669('0xa')](_0x4669('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00f5=['util','../../config/logger','api','moment','request-promise','path','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x00f5,0x197));var _0x500f=function(_0x1debc1,_0x46c43f){_0x1debc1=_0x1debc1-0x0;var _0x245e84=_0x00f5[_0x1debc1];return _0x245e84;};'use strict';var _=require(_0x500f('0x0'));var util=require(_0x500f('0x1'));var logger=require(_0x500f('0x2'))(_0x500f('0x3'));var moment=require(_0x500f('0x4'));var BPromise=require('bluebird');var rp=require(_0x500f('0x5'));var fs=require('fs');var path=require(_0x500f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x500f('0x7'));module[_0x500f('0x8')]=function(_0xa818fe,_0x7231b4){return _0xa818fe[_0x500f('0x9')](_0x500f('0xa'),attributes,{'tableName':_0x500f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 9699232..77604a0 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 _0x75c5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareMessage','create','body','options','info','CreateSquareMessage','lodash'];(function(_0x318d56,_0x2233bc){var _0x25356a=function(_0x30b93d){while(--_0x30b93d){_0x318d56['push'](_0x318d56['shift']());}};_0x25356a(++_0x2233bc);}(_0x75c5,0x1af));var _0x575c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x575c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x575c('0x1'));var fs=require('fs');var Redis=require(_0x575c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x575c('0x3'));var logger=require(_0x575c('0x4'))(_0x575c('0x5'));var config=require('../../config/environment');var jayson=require(_0x575c('0x6'));var client=jayson[_0x575c('0x7')][_0x575c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8d0970,_0x23b422,_0x368542){return new BPromise(function(_0x497144,_0x5a154d){return client[_0x575c('0x9')](_0x8d0970,_0x368542)[_0x575c('0xa')](function(_0x8a0e25){logger['info'](_0x575c('0xb'),_0x23b422,_0x575c('0xc'));logger[_0x575c('0xd')](_0x575c('0xe'),_0x23b422,_0x575c('0xc'),JSON[_0x575c('0xf')](_0x8a0e25));if(_0x8a0e25['error']){if(_0x8a0e25[_0x575c('0x10')][_0x575c('0x11')]===0x1f4){logger[_0x575c('0x10')](_0x575c('0xb'),_0x23b422,_0x8a0e25[_0x575c('0x10')][_0x575c('0x12')]);return _0x5a154d(_0x8a0e25[_0x575c('0x10')][_0x575c('0x12')]);}logger[_0x575c('0x10')](_0x575c('0xb'),_0x23b422,_0x8a0e25[_0x575c('0x10')]['message']);return _0x497144(_0x8a0e25[_0x575c('0x10')][_0x575c('0x12')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x23b422,_0x575c('0xc'));_0x497144(_0x8a0e25[_0x575c('0x13')][_0x575c('0x12')]);}})[_0x575c('0x14')](function(_0xd2c366){logger[_0x575c('0x10')](_0x575c('0xb'),_0x23b422,_0xd2c366);_0x5a154d(_0xd2c366);});});}exports['CreateSquareMessage']=function(_0x1452b5){var _0x567203=this;return new Promise(function(_0x1ffbdd,_0x4152b6){return db[_0x575c('0x15')][_0x575c('0x16')](_0x1452b5[_0x575c('0x17')],{'raw':_0x1452b5[_0x575c('0x18')]?_0x1452b5[_0x575c('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2ede33){logger[_0x575c('0x19')](_0x575c('0x1a'),_0x1452b5);logger['debug'](_0x575c('0x1a'),_0x1452b5,JSON[_0x575c('0xf')](_0x2ede33));_0x1ffbdd(_0x2ede33);})[_0x575c('0x14')](function(_0x2ef067){logger[_0x575c('0x10')](_0x575c('0x1a'),_0x2ef067[_0x575c('0x12')],_0x1452b5);_0x4152b6(_0x567203[_0x575c('0x10')](0x1f4,_0x2ef067[_0x575c('0x12')]));});});}; \ No newline at end of file +var _0x6374=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareMessage','raw','CreateSquareMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','request','then','info'];(function(_0x2046b0,_0x5f4381){var _0x6618fe=function(_0xc89fcd){while(--_0xc89fcd){_0x2046b0['push'](_0x2046b0['shift']());}};_0x6618fe(++_0x5f4381);}(_0x6374,0x80));var _0x4637=function(_0x593bcb,_0xfc5a5e){_0x593bcb=_0x593bcb-0x0;var _0x41380e=_0x6374[_0x593bcb];return _0x41380e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4637('0x0'));var BPromise=require(_0x4637('0x1'));var rs=require(_0x4637('0x2'));var fs=require('fs');var Redis=require(_0x4637('0x3'));var db=require(_0x4637('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4637('0x5'));var config=require('../../config/environment');var jayson=require(_0x4637('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2265f7,_0x13b87d,_0x182d3c){return new BPromise(function(_0xf03641,_0x17d437){return client[_0x4637('0x7')](_0x2265f7,_0x182d3c)[_0x4637('0x8')](function(_0x14c413){logger[_0x4637('0x9')](_0x4637('0xa'),_0x13b87d,_0x4637('0xb'));logger[_0x4637('0xc')](_0x4637('0xd'),_0x13b87d,'request\x20sent',JSON[_0x4637('0xe')](_0x14c413));if(_0x14c413[_0x4637('0xf')]){if(_0x14c413[_0x4637('0xf')][_0x4637('0x10')]===0x1f4){logger[_0x4637('0xf')](_0x4637('0xa'),_0x13b87d,_0x14c413[_0x4637('0xf')][_0x4637('0x11')]);return _0x17d437(_0x14c413[_0x4637('0xf')]['message']);}logger[_0x4637('0xf')](_0x4637('0xa'),_0x13b87d,_0x14c413[_0x4637('0xf')][_0x4637('0x11')]);return _0xf03641(_0x14c413[_0x4637('0xf')][_0x4637('0x11')]);}else{logger[_0x4637('0x9')]('SquareMessage,\x20%s,\x20%s',_0x13b87d,'request\x20sent');_0xf03641(_0x14c413[_0x4637('0x12')][_0x4637('0x11')]);}})[_0x4637('0x13')](function(_0x362aa9){logger[_0x4637('0xf')](_0x4637('0xa'),_0x13b87d,_0x362aa9);_0x17d437(_0x362aa9);});});}exports['CreateSquareMessage']=function(_0x1dce6d){var _0xdaa984=this;return new Promise(function(_0x40d19d,_0x10349e){return db[_0x4637('0x14')]['create'](_0x1dce6d['body'],{'raw':_0x1dce6d['options']?_0x1dce6d['options'][_0x4637('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x3d2d0f){logger[_0x4637('0x9')]('CreateSquareMessage',_0x1dce6d);logger['debug']('CreateSquareMessage',_0x1dce6d,JSON[_0x4637('0xe')](_0x3d2d0f));_0x40d19d(_0x3d2d0f);})[_0x4637('0x13')](function(_0xf27d5d){logger[_0x4637('0xf')](_0x4637('0x16'),_0xf27d5d[_0x4637('0x11')],_0x1dce6d);_0x10349e(_0xdaa984[_0x4637('0xf')](0x1f4,_0xf27d5d[_0x4637('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c3ed1dd..22272f8 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 _0xce06=['/:id','show','/:id/test','15s','create','exports','multer','util','path','express','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x3fb376,_0x22efe7){var _0x27d083=function(_0x18ae3b){while(--_0x18ae3b){_0x3fb376['push'](_0x3fb376['shift']());}};_0x27d083(++_0x22efe7);}(_0xce06,0x1a6));var _0x6ce0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xce06[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6ce0('0x0'));var util=require(_0x6ce0('0x1'));var path=require(_0x6ce0('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ce0('0x3'));var router=express['Router']();var fs_extra=require(_0x6ce0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ce0('0x5'));var controller=require(_0x6ce0('0x6'));router[_0x6ce0('0x7')]('/',auth[_0x6ce0('0x8')](),controller[_0x6ce0('0x9')]);router[_0x6ce0('0x7')](_0x6ce0('0xa'),auth['isAuthenticated'](),controller[_0x6ce0('0xb')]);router['get'](_0x6ce0('0xc'),auth[_0x6ce0('0x8')](),timeout(_0x6ce0('0xd')),controller['test']);router['post']('/',auth[_0x6ce0('0x8')](),controller[_0x6ce0('0xe')]);router['put'](_0x6ce0('0xa'),auth[_0x6ce0('0x8')](),controller['update']);router['delete'](_0x6ce0('0xa'),auth[_0x6ce0('0x8')](),controller['destroy']);module[_0x6ce0('0xf')]=router; \ No newline at end of file +var _0x93b9=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','create','put','update','destroy'];(function(_0x5c7990,_0x3b5f8f){var _0x1fef0d=function(_0x5daabc){while(--_0x5daabc){_0x5c7990['push'](_0x5c7990['shift']());}};_0x1fef0d(++_0x3b5f8f);}(_0x93b9,0x13c));var _0x993b=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x93b9[_0x5c6022];return _0x4ab5af;};'use strict';var multer=require(_0x993b('0x0'));var util=require(_0x993b('0x1'));var path=require(_0x993b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x993b('0x3')]();var fs_extra=require(_0x993b('0x4'));var auth=require(_0x993b('0x5'));var interaction=require(_0x993b('0x6'));var config=require(_0x993b('0x7'));var controller=require(_0x993b('0x8'));router[_0x993b('0x9')]('/',auth[_0x993b('0xa')](),controller[_0x993b('0xb')]);router[_0x993b('0x9')](_0x993b('0xc'),auth[_0x993b('0xa')](),controller[_0x993b('0xd')]);router[_0x993b('0x9')](_0x993b('0xe'),auth['isAuthenticated'](),timeout('15s'),controller[_0x993b('0xf')]);router['post']('/',auth[_0x993b('0xa')](),controller[_0x993b('0x10')]);router[_0x993b('0x11')](_0x993b('0xc'),auth[_0x993b('0xa')](),controller[_0x993b('0x12')]);router['delete'](_0x993b('0xc'),auth['isAuthenticated'](),controller[_0x993b('0x13')]);module[_0x993b('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 e7cf1ae..8ba133c 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 _0xca88=['STRING','name','sequelize','exports'];(function(_0x235563,_0x260ece){var _0x219be0=function(_0xef2469){while(--_0xef2469){_0x235563['push'](_0x235563['shift']());}};_0x219be0(++_0x260ece);}(_0xca88,0x196));var _0x8ca8=function(_0x4bdefe,_0x249d32){_0x4bdefe=_0x4bdefe-0x0;var _0x4be528=_0xca88[_0x4bdefe];return _0x4be528;};'use strict';var Sequelize=require(_0x8ca8('0x0'));module[_0x8ca8('0x1')]={'name':{'type':Sequelize[_0x8ca8('0x2')],'unique':_0x8ca8('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8ca8('0x2')]},'description':{'type':Sequelize[_0x8ca8('0x2')]}}; \ No newline at end of file +var _0x16fc=['STRING','name','sequelize','exports'];(function(_0x567e72,_0x27f61f){var _0x29bc0a=function(_0xaaeef8){while(--_0xaaeef8){_0x567e72['push'](_0x567e72['shift']());}};_0x29bc0a(++_0x27f61f);}(_0x16fc,0x136));var _0xc16f=function(_0x539014,_0x2bd4df){_0x539014=_0x539014-0x0;var _0x30aad6=_0x16fc[_0x539014];return _0x30aad6;};'use strict';var Sequelize=require(_0xc16f('0x0'));module[_0xc16f('0x1')]={'name':{'type':Sequelize[_0xc16f('0x2')],'unique':_0xc16f('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc16f('0x2')]},'description':{'type':Sequelize[_0xc16f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 7f279c5..5881df9 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 _0xcae5=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','update','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','filter','VIRTUAL','options','SquareOdbc','includeAll','findAll','rows','params','include','merge','find'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xcae5,0x104));var _0x5cae=function(_0x3fec80,_0x4dab98){_0x3fec80=_0x3fec80-0x0;var _0x2aba10=_0xcae5[_0x3fec80];return _0x2aba10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cae('0x0'));var zipdir=require(_0x5cae('0x1'));var jsonpatch=require(_0x5cae('0x2'));var rp=require(_0x5cae('0x3'));var moment=require('moment');var BPromise=require(_0x5cae('0x4'));var Mustache=require(_0x5cae('0x5'));var util=require(_0x5cae('0x6'));var path=require(_0x5cae('0x7'));var sox=require(_0x5cae('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cae('0x9'));var squel=require(_0x5cae('0xa'));var crypto=require('crypto');var jsforce=require(_0x5cae('0xb'));var deskjs=require(_0x5cae('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5cae('0xd'));var Papa=require(_0x5cae('0xe'));var Redis=require(_0x5cae('0xf'));var authService=require(_0x5cae('0x10'));var qs=require(_0x5cae('0x11'));var as=require(_0x5cae('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5cae('0x13'));var utils=require(_0x5cae('0x14'));var config=require(_0x5cae('0x15'));var licenseUtil=require(_0x5cae('0x16'));var db=require(_0x5cae('0x17'))['db'];function respondWithStatusCode(_0x4d1a66,_0x4cdc1c){_0x4cdc1c=_0x4cdc1c||0xcc;return function(_0xed3b4a){if(_0xed3b4a){return _0x4d1a66['sendStatus'](_0x4cdc1c);}return _0x4d1a66['status'](_0x4cdc1c)[_0x5cae('0x18')]();};}function respondWithResult(_0x467cbe,_0x58133d){_0x58133d=_0x58133d||0xc8;return function(_0x26f91a){if(_0x26f91a){return _0x467cbe[_0x5cae('0x19')](_0x58133d)[_0x5cae('0x1a')](_0x26f91a);}};}function respondWithFilteredResult(_0x541d80,_0x20beee){return function(_0x343ce9){if(_0x343ce9){var _0x269676=typeof _0x20beee[_0x5cae('0x1b')]===_0x5cae('0x1c')&&typeof _0x20beee[_0x5cae('0x1d')]===_0x5cae('0x1c');var _0x5d03cb=_0x343ce9['count'];var _0x5aa905=_0x269676?0x0:_0x20beee['offset'];var _0x186adc=_0x269676?_0x343ce9[_0x5cae('0x1e')]:_0x20beee[_0x5cae('0x1b')]+_0x20beee['limit'];var _0x515112;if(_0x186adc>=_0x5d03cb){_0x186adc=_0x5d03cb;_0x515112=0xc8;}else{_0x515112=0xce;}_0x541d80[_0x5cae('0x19')](_0x515112);return _0x541d80[_0x5cae('0x1f')](_0x5cae('0x20'),_0x5aa905+'-'+_0x186adc+'/'+_0x5d03cb)['json'](_0x343ce9);}return null;};}function patchUpdates(_0x2825af){return function(_0x268f42){try{jsonpatch[_0x5cae('0x21')](_0x268f42,_0x2825af,!![]);}catch(_0x2b9f02){return BPromise[_0x5cae('0x22')](_0x2b9f02);}return _0x268f42[_0x5cae('0x23')]();};}function saveUpdates(_0x2322fb,_0x460e26){return function(_0x520dcf){if(_0x520dcf){return _0x520dcf['update'](_0x2322fb)[_0x5cae('0x24')](function(_0x4a95da){return _0x4a95da;});}return null;};}function removeEntity(_0x4cb05f,_0x34a1b8){return function(_0x572fab){if(_0x572fab){return _0x572fab[_0x5cae('0x25')]()[_0x5cae('0x24')](function(){var _0x3d656d=_0x572fab[_0x5cae('0x26')]({'plain':!![]});var _0x5802a2=_0x5cae('0x27');return db[_0x5cae('0x28')][_0x5cae('0x25')]({'where':{'type':_0x5802a2,'resourceId':_0x3d656d['id']}})[_0x5cae('0x24')](function(){return _0x572fab;});})[_0x5cae('0x24')](function(){_0x4cb05f['status'](0xcc)[_0x5cae('0x18')]();});}};}function handleEntityNotFound(_0x2ecbcb,_0x32c78d){return function(_0x52f7da){if(!_0x52f7da){_0x2ecbcb['sendStatus'](0x194);}return _0x52f7da;};}function handleError(_0x459965,_0xd86994){_0xd86994=_0xd86994||0x1f4;return function(_0x578ca1){logger[_0x5cae('0x29')](_0x578ca1[_0x5cae('0x2a')]);if(_0x578ca1['name']){delete _0x578ca1[_0x5cae('0x2b')];}_0x459965[_0x5cae('0x19')](_0xd86994)['send'](_0x578ca1);};}exports['index']=function(_0x3d37a4,_0x1643f){var _0x588732={},_0x5517ac={},_0xab3591={'count':0x0,'rows':[]};var _0x2f8e4b=_['map'](db['SquareOdbc'][_0x5cae('0x2c')],function(_0x535db2){return{'name':_0x535db2['fieldName'],'type':_0x535db2[_0x5cae('0x2d')]['key']};});_0x5517ac[_0x5cae('0x2e')]=_[_0x5cae('0x2f')](_0x2f8e4b,_0x5cae('0x2b'));_0x5517ac[_0x5cae('0x30')]=_[_0x5cae('0x31')](_0x3d37a4[_0x5cae('0x30')]);_0x5517ac['filters']=_[_0x5cae('0x32')](_0x5517ac[_0x5cae('0x2e')],_0x5517ac[_0x5cae('0x30')]);_0x588732[_0x5cae('0x33')]=_['intersection'](_0x5517ac[_0x5cae('0x2e')],qs['fields'](_0x3d37a4[_0x5cae('0x30')][_0x5cae('0x34')]));_0x588732[_0x5cae('0x33')]=_0x588732[_0x5cae('0x33')]['length']?_0x588732[_0x5cae('0x33')]:_0x5517ac[_0x5cae('0x2e')];if(!_0x3d37a4[_0x5cae('0x30')]['hasOwnProperty'](_0x5cae('0x35'))){_0x588732['limit']=qs[_0x5cae('0x1d')](_0x3d37a4[_0x5cae('0x30')][_0x5cae('0x1d')]);_0x588732[_0x5cae('0x1b')]=qs[_0x5cae('0x1b')](_0x3d37a4[_0x5cae('0x30')][_0x5cae('0x1b')]);}_0x588732['order']=qs['sort'](_0x3d37a4['query'][_0x5cae('0x36')]);_0x588732[_0x5cae('0x37')]=qs[_0x5cae('0x38')](_['pick'](_0x3d37a4['query'],_0x5517ac[_0x5cae('0x38')]),_0x2f8e4b);if(_0x3d37a4['query'][_0x5cae('0x39')]){_0x588732[_0x5cae('0x37')]=_['merge'](_0x588732['where'],{'$or':_[_0x5cae('0x2f')](_0x2f8e4b,function(_0x281995){if(_0x281995[_0x5cae('0x2d')]!==_0x5cae('0x3a')){var _0x5a6ccd={};_0x5a6ccd[_0x281995['name']]={'$like':'%'+_0x3d37a4[_0x5cae('0x30')][_0x5cae('0x39')]+'%'};return _0x5a6ccd;}})});}_0x588732=_['merge']({},_0x588732,_0x3d37a4[_0x5cae('0x3b')]);var _0x359d9c={'where':_0x588732[_0x5cae('0x37')]};return db[_0x5cae('0x3c')][_0x5cae('0x1e')](_0x359d9c)[_0x5cae('0x24')](function(_0x4bb445){_0xab3591[_0x5cae('0x1e')]=_0x4bb445;if(_0x3d37a4[_0x5cae('0x30')][_0x5cae('0x3d')]){_0x588732['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x5cae('0x3e')](_0x588732);})['then'](function(_0x170d44){_0xab3591[_0x5cae('0x3f')]=_0x170d44;return _0xab3591;})[_0x5cae('0x24')](respondWithFilteredResult(_0x1643f,_0x588732))['catch'](handleError(_0x1643f,null));};exports['show']=function(_0x4dc6f3,_0x2dc1c7){var _0x43480e={'raw':!![],'where':{'id':_0x4dc6f3[_0x5cae('0x40')]['id']}},_0x3f11c9={};_0x3f11c9[_0x5cae('0x2e')]=_['keys'](db['SquareOdbc'][_0x5cae('0x2c')]);_0x3f11c9[_0x5cae('0x30')]=_[_0x5cae('0x31')](_0x4dc6f3[_0x5cae('0x30')]);_0x3f11c9['filters']=_[_0x5cae('0x32')](_0x3f11c9[_0x5cae('0x2e')],_0x3f11c9[_0x5cae('0x30')]);_0x43480e['attributes']=_[_0x5cae('0x32')](_0x3f11c9['model'],qs[_0x5cae('0x34')](_0x4dc6f3['query'][_0x5cae('0x34')]));_0x43480e[_0x5cae('0x33')]=_0x43480e['attributes']['length']?_0x43480e[_0x5cae('0x33')]:_0x3f11c9['model'];if(_0x4dc6f3[_0x5cae('0x30')]['includeAll']){_0x43480e[_0x5cae('0x41')]=[{'all':!![]}];}_0x43480e=_[_0x5cae('0x42')]({},_0x43480e,_0x4dc6f3[_0x5cae('0x3b')]);return db['SquareOdbc'][_0x5cae('0x43')](_0x43480e)[_0x5cae('0x24')](handleEntityNotFound(_0x2dc1c7,null))[_0x5cae('0x24')](respondWithResult(_0x2dc1c7,null))[_0x5cae('0x44')](handleError(_0x2dc1c7,null));};exports[_0x5cae('0x45')]=function(_0x48cc7d,_0x38d56e){return db['SquareOdbc'][_0x5cae('0x45')](_0x48cc7d[_0x5cae('0x46')],{})[_0x5cae('0x24')](function(_0x35bc54){var _0x266e70=_0x48cc7d['user'][_0x5cae('0x26')]({'plain':!![]});if(!_0x266e70)throw new Error(_0x5cae('0x47'));if(_0x266e70[_0x5cae('0x48')]===_0x5cae('0x49')){var _0x98f63a=_0x35bc54['get']({'plain':!![]});var _0x320ee9=_0x5cae('0x27');return db['UserProfileSection'][_0x5cae('0x43')]({'where':{'name':_0x320ee9,'userProfileId':_0x266e70[_0x5cae('0x4a')]},'raw':!![]})[_0x5cae('0x24')](function(_0x559cb7){if(_0x559cb7&&_0x559cb7[_0x5cae('0x4b')]===0x0){return db[_0x5cae('0x28')]['create']({'name':_0x98f63a['name'],'resourceId':_0x98f63a['id'],'type':_0x559cb7[_0x5cae('0x2b')],'sectionId':_0x559cb7['id']},{})['then'](function(){return _0x35bc54;});}else{return _0x35bc54;}})['catch'](function(_0x58f19e){logger[_0x5cae('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58f19e);throw _0x58f19e;});}return _0x35bc54;})[_0x5cae('0x24')](respondWithResult(_0x38d56e,0xc9))[_0x5cae('0x44')](handleError(_0x38d56e,null));};exports[_0x5cae('0x4c')]=function(_0x257797,_0x5c6948){if(_0x257797[_0x5cae('0x46')]['id']){delete _0x257797[_0x5cae('0x46')]['id'];}return db[_0x5cae('0x3c')][_0x5cae('0x43')]({'where':{'id':_0x257797[_0x5cae('0x40')]['id']}})[_0x5cae('0x24')](handleEntityNotFound(_0x5c6948,null))[_0x5cae('0x24')](saveUpdates(_0x257797[_0x5cae('0x46')],null))[_0x5cae('0x24')](respondWithResult(_0x5c6948,null))['catch'](handleError(_0x5c6948,null));};exports[_0x5cae('0x25')]=function(_0x5ce8dd,_0x355f39){return db[_0x5cae('0x3c')][_0x5cae('0x43')]({'where':{'id':_0x5ce8dd[_0x5cae('0x40')]['id']}})[_0x5cae('0x24')](handleEntityNotFound(_0x355f39,null))['then'](removeEntity(_0x355f39,null))[_0x5cae('0x44')](handleError(_0x355f39,null));};exports[_0x5cae('0x4d')]=function(_0x33a8c7,_0x5a71e2,_0x524673){var _0x5d05e2;return db[_0x5cae('0x3c')][_0x5cae('0x43')]({'where':{'id':_0x33a8c7[_0x5cae('0x40')]['id']},'attributes':['id',_0x5cae('0x4e')]})[_0x5cae('0x24')](handleEntityNotFound(_0x5a71e2,null))[_0x5cae('0x24')](function(_0x417684){if(_0x417684){var _0x105f80=require(_0x5cae('0x4f'))();_0x105f80[_0x5cae('0x50')](_0x417684['dsn']);_0x105f80[_0x5cae('0x51')]();return _0x417684;}})[_0x5cae('0x24')](respondWithResult(_0x5a71e2,null))[_0x5cae('0x44')](handleError(_0x5a71e2,null));}; \ No newline at end of file +var _0x006a=['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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','eml-format','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x16cdc3,_0x224d26){var _0x275ee5=function(_0x37e88f){while(--_0x37e88f){_0x16cdc3['push'](_0x16cdc3['shift']());}};_0x275ee5(++_0x224d26);}(_0x006a,0x153));var _0xa006=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x006a[_0x3f2d02];return _0x54092b;};'use strict';var emlformat=require(_0xa006('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa006('0x1'));var jsonpatch=require(_0xa006('0x2'));var rp=require(_0xa006('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa006('0x4'));var util=require('util');var path=require(_0xa006('0x5'));var sox=require(_0xa006('0x6'));var csv=require(_0xa006('0x7'));var ejs=require(_0xa006('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa006('0x9'));var squel=require(_0xa006('0xa'));var crypto=require(_0xa006('0xb'));var jsforce=require(_0xa006('0xc'));var deskjs=require(_0xa006('0xd'));var toCsv=require(_0xa006('0x7'));var querystring=require(_0xa006('0xe'));var Papa=require('papaparse');var Redis=require(_0xa006('0xf'));var authService=require(_0xa006('0x10'));var qs=require(_0xa006('0x11'));var as=require(_0xa006('0x12'));var hardwareService=require(_0xa006('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa006('0x14'));var config=require(_0xa006('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa006('0x16'))['db'];function respondWithStatusCode(_0x3e4934,_0x4adb11){_0x4adb11=_0x4adb11||0xcc;return function(_0x8f89c8){if(_0x8f89c8){return _0x3e4934[_0xa006('0x17')](_0x4adb11);}return _0x3e4934[_0xa006('0x18')](_0x4adb11)[_0xa006('0x19')]();};}function respondWithResult(_0x2b6ad4,_0x4bfe0a){_0x4bfe0a=_0x4bfe0a||0xc8;return function(_0x2e90ef){if(_0x2e90ef){return _0x2b6ad4[_0xa006('0x18')](_0x4bfe0a)[_0xa006('0x1a')](_0x2e90ef);}};}function respondWithFilteredResult(_0x52af19,_0x20c7dc){return function(_0x8ef945){if(_0x8ef945){var _0x565a86=typeof _0x20c7dc[_0xa006('0x1b')]===_0xa006('0x1c')&&typeof _0x20c7dc[_0xa006('0x1d')]===_0xa006('0x1c');var _0x339956=_0x8ef945[_0xa006('0x1e')];var _0x541516=_0x565a86?0x0:_0x20c7dc[_0xa006('0x1b')];var _0x39b16a=_0x565a86?_0x8ef945[_0xa006('0x1e')]:_0x20c7dc[_0xa006('0x1b')]+_0x20c7dc[_0xa006('0x1d')];var _0x3fd436;if(_0x39b16a>=_0x339956){_0x39b16a=_0x339956;_0x3fd436=0xc8;}else{_0x3fd436=0xce;}_0x52af19[_0xa006('0x18')](_0x3fd436);return _0x52af19['set'](_0xa006('0x1f'),_0x541516+'-'+_0x39b16a+'/'+_0x339956)[_0xa006('0x1a')](_0x8ef945);}return null;};}function patchUpdates(_0x475c2b){return function(_0x5bd3dc){try{jsonpatch['apply'](_0x5bd3dc,_0x475c2b,!![]);}catch(_0x3930af){return BPromise[_0xa006('0x20')](_0x3930af);}return _0x5bd3dc[_0xa006('0x21')]();};}function saveUpdates(_0x4b423d,_0xd9261e){return function(_0x949010){if(_0x949010){return _0x949010[_0xa006('0x22')](_0x4b423d)[_0xa006('0x23')](function(_0x3f0beb){return _0x3f0beb;});}return null;};}function removeEntity(_0x5e29e2,_0x301687){return function(_0x1c3d78){if(_0x1c3d78){return _0x1c3d78[_0xa006('0x24')]()['then'](function(){var _0x43aa89=_0x1c3d78[_0xa006('0x25')]({'plain':!![]});var _0x300dc5=_0xa006('0x26');return db[_0xa006('0x27')][_0xa006('0x24')]({'where':{'type':_0x300dc5,'resourceId':_0x43aa89['id']}})[_0xa006('0x23')](function(){return _0x1c3d78;});})[_0xa006('0x23')](function(){_0x5e29e2['status'](0xcc)[_0xa006('0x19')]();});}};}function handleEntityNotFound(_0x36d944,_0x530dbf){return function(_0x457eff){if(!_0x457eff){_0x36d944[_0xa006('0x17')](0x194);}return _0x457eff;};}function handleError(_0x1f1d7a,_0xfd2443){_0xfd2443=_0xfd2443||0x1f4;return function(_0x2fa4a2){logger['error'](_0x2fa4a2['stack']);if(_0x2fa4a2[_0xa006('0x28')]){delete _0x2fa4a2[_0xa006('0x28')];}_0x1f1d7a[_0xa006('0x18')](_0xfd2443)[_0xa006('0x29')](_0x2fa4a2);};}exports[_0xa006('0x2a')]=function(_0x7670d,_0x33ef97){var _0x4942ca={},_0x6319ee={},_0x943f0d={'count':0x0,'rows':[]};var _0x4865c1=_[_0xa006('0x2b')](db['SquareOdbc'][_0xa006('0x2c')],function(_0x13127f){return{'name':_0x13127f[_0xa006('0x2d')],'type':_0x13127f[_0xa006('0x2e')][_0xa006('0x2f')]};});_0x6319ee[_0xa006('0x30')]=_[_0xa006('0x2b')](_0x4865c1,_0xa006('0x28'));_0x6319ee[_0xa006('0x31')]=_[_0xa006('0x32')](_0x7670d['query']);_0x6319ee['filters']=_[_0xa006('0x33')](_0x6319ee['model'],_0x6319ee[_0xa006('0x31')]);_0x4942ca[_0xa006('0x34')]=_[_0xa006('0x33')](_0x6319ee['model'],qs[_0xa006('0x35')](_0x7670d[_0xa006('0x31')][_0xa006('0x35')]));_0x4942ca['attributes']=_0x4942ca[_0xa006('0x34')]['length']?_0x4942ca[_0xa006('0x34')]:_0x6319ee[_0xa006('0x30')];if(!_0x7670d[_0xa006('0x31')][_0xa006('0x36')](_0xa006('0x37'))){_0x4942ca['limit']=qs[_0xa006('0x1d')](_0x7670d['query'][_0xa006('0x1d')]);_0x4942ca[_0xa006('0x1b')]=qs[_0xa006('0x1b')](_0x7670d[_0xa006('0x31')][_0xa006('0x1b')]);}_0x4942ca[_0xa006('0x38')]=qs[_0xa006('0x39')](_0x7670d['query'][_0xa006('0x39')]);_0x4942ca[_0xa006('0x3a')]=qs[_0xa006('0x3b')](_[_0xa006('0x3c')](_0x7670d[_0xa006('0x31')],_0x6319ee['filters']),_0x4865c1);if(_0x7670d['query']['filter']){_0x4942ca['where']=_[_0xa006('0x3d')](_0x4942ca[_0xa006('0x3a')],{'$or':_[_0xa006('0x2b')](_0x4865c1,function(_0x3f3907){if(_0x3f3907[_0xa006('0x2e')]!==_0xa006('0x3e')){var _0x5e160f={};_0x5e160f[_0x3f3907[_0xa006('0x28')]]={'$like':'%'+_0x7670d[_0xa006('0x31')][_0xa006('0x3f')]+'%'};return _0x5e160f;}})});}_0x4942ca=_[_0xa006('0x3d')]({},_0x4942ca,_0x7670d[_0xa006('0x40')]);var _0x1c9b35={'where':_0x4942ca[_0xa006('0x3a')]};return db[_0xa006('0x41')]['count'](_0x1c9b35)[_0xa006('0x23')](function(_0x19d0f9){_0x943f0d[_0xa006('0x1e')]=_0x19d0f9;if(_0x7670d['query'][_0xa006('0x42')]){_0x4942ca[_0xa006('0x43')]=[{'all':!![]}];}return db[_0xa006('0x41')][_0xa006('0x44')](_0x4942ca);})[_0xa006('0x23')](function(_0x6fef05){_0x943f0d[_0xa006('0x45')]=_0x6fef05;return _0x943f0d;})[_0xa006('0x23')](respondWithFilteredResult(_0x33ef97,_0x4942ca))[_0xa006('0x46')](handleError(_0x33ef97,null));};exports[_0xa006('0x47')]=function(_0x203b4a,_0x1704d2){var _0x40fe60={'raw':!![],'where':{'id':_0x203b4a['params']['id']}},_0x5e5102={};_0x5e5102[_0xa006('0x30')]=_[_0xa006('0x32')](db[_0xa006('0x41')][_0xa006('0x2c')]);_0x5e5102[_0xa006('0x31')]=_[_0xa006('0x32')](_0x203b4a[_0xa006('0x31')]);_0x5e5102['filters']=_[_0xa006('0x33')](_0x5e5102[_0xa006('0x30')],_0x5e5102[_0xa006('0x31')]);_0x40fe60[_0xa006('0x34')]=_[_0xa006('0x33')](_0x5e5102[_0xa006('0x30')],qs[_0xa006('0x35')](_0x203b4a['query'][_0xa006('0x35')]));_0x40fe60[_0xa006('0x34')]=_0x40fe60[_0xa006('0x34')][_0xa006('0x48')]?_0x40fe60['attributes']:_0x5e5102[_0xa006('0x30')];if(_0x203b4a[_0xa006('0x31')][_0xa006('0x42')]){_0x40fe60[_0xa006('0x43')]=[{'all':!![]}];}_0x40fe60=_[_0xa006('0x3d')]({},_0x40fe60,_0x203b4a[_0xa006('0x40')]);return db[_0xa006('0x41')][_0xa006('0x49')](_0x40fe60)[_0xa006('0x23')](handleEntityNotFound(_0x1704d2,null))[_0xa006('0x23')](respondWithResult(_0x1704d2,null))[_0xa006('0x46')](handleError(_0x1704d2,null));};exports[_0xa006('0x4a')]=function(_0x3a1aad,_0x15dac2){return db['SquareOdbc'][_0xa006('0x4a')](_0x3a1aad[_0xa006('0x4b')],{})[_0xa006('0x23')](function(_0x22c9ba){var _0x3a4955=_0x3a1aad[_0xa006('0x4c')]['get']({'plain':!![]});if(!_0x3a4955)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a4955[_0xa006('0x4d')]===_0xa006('0x4c')){var _0x5c6541=_0x22c9ba[_0xa006('0x25')]({'plain':!![]});var _0x1cdacd=_0xa006('0x26');return db[_0xa006('0x4e')][_0xa006('0x49')]({'where':{'name':_0x1cdacd,'userProfileId':_0x3a4955[_0xa006('0x4f')]},'raw':!![]})[_0xa006('0x23')](function(_0x102cf3){if(_0x102cf3&&_0x102cf3[_0xa006('0x50')]===0x0){return db[_0xa006('0x27')]['create']({'name':_0x5c6541[_0xa006('0x28')],'resourceId':_0x5c6541['id'],'type':_0x102cf3[_0xa006('0x28')],'sectionId':_0x102cf3['id']},{})[_0xa006('0x23')](function(){return _0x22c9ba;});}else{return _0x22c9ba;}})['catch'](function(_0x31bd10){logger[_0xa006('0x51')](_0xa006('0x52'),_0x31bd10);throw _0x31bd10;});}return _0x22c9ba;})[_0xa006('0x23')](respondWithResult(_0x15dac2,0xc9))[_0xa006('0x46')](handleError(_0x15dac2,null));};exports[_0xa006('0x22')]=function(_0x374ba8,_0x5f2c17){if(_0x374ba8[_0xa006('0x4b')]['id']){delete _0x374ba8[_0xa006('0x4b')]['id'];}return db[_0xa006('0x41')][_0xa006('0x49')]({'where':{'id':_0x374ba8[_0xa006('0x53')]['id']}})[_0xa006('0x23')](handleEntityNotFound(_0x5f2c17,null))[_0xa006('0x23')](saveUpdates(_0x374ba8[_0xa006('0x4b')],null))[_0xa006('0x23')](respondWithResult(_0x5f2c17,null))['catch'](handleError(_0x5f2c17,null));};exports[_0xa006('0x24')]=function(_0x5e6376,_0x2a73de){return db[_0xa006('0x41')][_0xa006('0x49')]({'where':{'id':_0x5e6376[_0xa006('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a73de,null))[_0xa006('0x23')](removeEntity(_0x2a73de,null))['catch'](handleError(_0x2a73de,null));};exports['test']=function(_0x2e01ca,_0xfc157c,_0x48547e){var _0x167884;return db['SquareOdbc'][_0xa006('0x49')]({'where':{'id':_0x2e01ca[_0xa006('0x53')]['id']},'attributes':['id',_0xa006('0x54')]})[_0xa006('0x23')](handleEntityNotFound(_0xfc157c,null))[_0xa006('0x23')](function(_0x2cd48a){if(_0x2cd48a){var _0x4fc362=require(_0xa006('0x55'))();_0x4fc362['openSync'](_0x2cd48a[_0xa006('0x54')]);_0x4fc362['closeSync']();return _0x2cd48a;}})['then'](respondWithResult(_0xfc157c,null))['catch'](handleError(_0xfc157c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 74917c8..31163a0 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 _0x1ede=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc'];(function(_0x441218,_0x51843d){var _0x2d1c4b=function(_0x240ce0){while(--_0x240ce0){_0x441218['push'](_0x441218['shift']());}};_0x2d1c4b(++_0x51843d);}(_0x1ede,0x174));var _0xe1ed=function(_0x23c433,_0x1fcee3){_0x23c433=_0x23c433-0x0;var _0x45161a=_0x1ede[_0x23c433];return _0x45161a;};'use strict';var _=require(_0xe1ed('0x0'));var util=require(_0xe1ed('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe1ed('0x2'));var BPromise=require(_0xe1ed('0x3'));var rp=require(_0xe1ed('0x4'));var fs=require('fs');var path=require(_0xe1ed('0x5'));var rimraf=require(_0xe1ed('0x6'));var config=require(_0xe1ed('0x7'));var attributes=require(_0xe1ed('0x8'));module['exports']=function(_0xad905c,_0x12025a){return _0xad905c[_0xe1ed('0x9')](_0xe1ed('0xa'),attributes,{'tableName':_0xe1ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a79=['define','SquareOdbc','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x5a79,0xda));var _0x95a7=function(_0x5a4fe4,_0x13daca){_0x5a4fe4=_0x5a4fe4-0x0;var _0x42aa6e=_0x5a79[_0x5a4fe4];return _0x42aa6e;};'use strict';var _=require(_0x95a7('0x0'));var util=require(_0x95a7('0x1'));var logger=require(_0x95a7('0x2'))(_0x95a7('0x3'));var moment=require('moment');var BPromise=require(_0x95a7('0x4'));var rp=require(_0x95a7('0x5'));var fs=require('fs');var path=require(_0x95a7('0x6'));var rimraf=require(_0x95a7('0x7'));var config=require(_0x95a7('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x95a7('0x9')]=function(_0x4d3c38,_0x179182){return _0x4d3c38[_0x95a7('0xa')](_0x95a7('0xb'),attributes,{'tableName':'square_odbc','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 8dc15ec..11075e4 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 _0x837a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','ShowSquareOdbc','find','options','raw','where','include','map','model','attributes','then','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x837a,0x1ea));var _0xa837=function(_0x3ab67a,_0x4cdf41){_0x3ab67a=_0x3ab67a-0x0;var _0x48da17=_0x837a[_0x3ab67a];return _0x48da17;};'use strict';var _=require(_0xa837('0x0'));var util=require(_0xa837('0x1'));var moment=require(_0xa837('0x2'));var BPromise=require(_0xa837('0x3'));var rs=require(_0xa837('0x4'));var fs=require('fs');var Redis=require(_0xa837('0x5'));var db=require(_0xa837('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa837('0x7'))(_0xa837('0x8'));var config=require(_0xa837('0x9'));var jayson=require(_0xa837('0xa'));var client=jayson[_0xa837('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c780f,_0x212591,_0x2e6243){return new BPromise(function(_0x325f96,_0x22cfe9){return client['request'](_0x2c780f,_0x2e6243)['then'](function(_0xca8cf7){logger[_0xa837('0xc')](_0xa837('0xd'),_0x212591,_0xa837('0xe'));logger[_0xa837('0xf')](_0xa837('0x10'),_0x212591,_0xa837('0xe'),JSON['stringify'](_0xca8cf7));if(_0xca8cf7['error']){if(_0xca8cf7['error'][_0xa837('0x11')]===0x1f4){logger[_0xa837('0x12')](_0xa837('0xd'),_0x212591,_0xca8cf7['error'][_0xa837('0x13')]);return _0x22cfe9(_0xca8cf7['error']['message']);}logger[_0xa837('0x12')](_0xa837('0xd'),_0x212591,_0xca8cf7['error'][_0xa837('0x13')]);return _0x325f96(_0xca8cf7[_0xa837('0x12')][_0xa837('0x13')]);}else{logger[_0xa837('0xc')](_0xa837('0xd'),_0x212591,_0xa837('0xe'));_0x325f96(_0xca8cf7[_0xa837('0x14')][_0xa837('0x13')]);}})[_0xa837('0x15')](function(_0x15f536){logger[_0xa837('0x12')](_0xa837('0xd'),_0x212591,_0x15f536);_0x22cfe9(_0x15f536);});});}exports[_0xa837('0x16')]=function(_0x580c30){var _0x2e0f83=this;return new Promise(function(_0x5d4b65,_0x2a7fb6){return db['SquareOdbc'][_0xa837('0x17')]({'raw':_0x580c30[_0xa837('0x18')]?_0x580c30['options'][_0xa837('0x19')]===undefined?!![]:![]:!![],'where':_0x580c30[_0xa837('0x18')]?_0x580c30[_0xa837('0x18')][_0xa837('0x1a')]||null:null,'attributes':_0x580c30[_0xa837('0x18')]?_0x580c30[_0xa837('0x18')]['attributes']||null:null,'include':_0x580c30[_0xa837('0x18')]?_0x580c30['options'][_0xa837('0x1b')]?_[_0xa837('0x1c')](_0x580c30[_0xa837('0x18')][_0xa837('0x1b')],function(_0x18010e){return{'model':db[_0x18010e[_0xa837('0x1d')]],'as':_0x18010e['as'],'attributes':_0x18010e[_0xa837('0x1e')],'include':_0x18010e[_0xa837('0x1b')]?_['map'](_0x18010e['include'],function(_0x2ad02f){return{'model':db[_0x2ad02f['model']],'as':_0x2ad02f['as'],'attributes':_0x2ad02f[_0xa837('0x1e')],'include':_0x2ad02f['include']?_[_0xa837('0x1c')](_0x2ad02f[_0xa837('0x1b')],function(_0xe9b71c){return{'model':db[_0xe9b71c[_0xa837('0x1d')]],'as':_0xe9b71c['as'],'attributes':_0xe9b71c[_0xa837('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa837('0x1f')](function(_0xf7102){logger[_0xa837('0xc')]('ShowSquareOdbc',_0x580c30);logger[_0xa837('0xf')]('ShowSquareOdbc',_0x580c30,JSON[_0xa837('0x20')](_0xf7102));_0x5d4b65(_0xf7102);})[_0xa837('0x15')](function(_0x457c5b){logger[_0xa837('0x12')]('ShowSquareOdbc',_0x457c5b[_0xa837('0x13')],_0x580c30);_0x2a7fb6(_0x2e0f83[_0xa837('0x12')](0x1f4,_0x457c5b[_0xa837('0x13')]));});});}; \ No newline at end of file +var _0x0931=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareOdbc','find','options','raw','where','attributes','include','model','map','info','ShowSquareOdbc','stringify','util','bluebird','ioredis','../../config/logger','client','http','request','then','SquareOdbc,\x20%s,\x20%s'];(function(_0x56fced,_0x1b5ab6){var _0x4d1f0e=function(_0x44598e){while(--_0x44598e){_0x56fced['push'](_0x56fced['shift']());}};_0x4d1f0e(++_0x1b5ab6);}(_0x0931,0x18d));var _0x1093=function(_0x9f5464,_0x5ac707){_0x9f5464=_0x9f5464-0x0;var _0x3462d2=_0x0931[_0x9f5464];return _0x3462d2;};'use strict';var _=require('lodash');var util=require(_0x1093('0x0'));var moment=require('moment');var BPromise=require(_0x1093('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1093('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1093('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1093('0x4')][_0x1093('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4c73c4,_0x126575,_0x5642ca){return new BPromise(function(_0x523298,_0x43490d){return client[_0x1093('0x6')](_0x4c73c4,_0x5642ca)[_0x1093('0x7')](function(_0x7a091a){logger['info'](_0x1093('0x8'),_0x126575,_0x1093('0x9'));logger[_0x1093('0xa')](_0x1093('0xb'),_0x126575,_0x1093('0x9'),JSON['stringify'](_0x7a091a));if(_0x7a091a[_0x1093('0xc')]){if(_0x7a091a['error'][_0x1093('0xd')]===0x1f4){logger['error'](_0x1093('0x8'),_0x126575,_0x7a091a[_0x1093('0xc')][_0x1093('0xe')]);return _0x43490d(_0x7a091a['error'][_0x1093('0xe')]);}logger[_0x1093('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x126575,_0x7a091a[_0x1093('0xc')][_0x1093('0xe')]);return _0x523298(_0x7a091a[_0x1093('0xc')]['message']);}else{logger['info'](_0x1093('0x8'),_0x126575,_0x1093('0x9'));_0x523298(_0x7a091a[_0x1093('0xf')][_0x1093('0xe')]);}})[_0x1093('0x10')](function(_0x21ef10){logger[_0x1093('0xc')](_0x1093('0x8'),_0x126575,_0x21ef10);_0x43490d(_0x21ef10);});});}exports['ShowSquareOdbc']=function(_0x14e915){var _0x41289b=this;return new Promise(function(_0x44af7d,_0x1aae75){return db[_0x1093('0x11')][_0x1093('0x12')]({'raw':_0x14e915[_0x1093('0x13')]?_0x14e915[_0x1093('0x13')][_0x1093('0x14')]===undefined?!![]:![]:!![],'where':_0x14e915['options']?_0x14e915[_0x1093('0x13')][_0x1093('0x15')]||null:null,'attributes':_0x14e915[_0x1093('0x13')]?_0x14e915[_0x1093('0x13')][_0x1093('0x16')]||null:null,'include':_0x14e915['options']?_0x14e915[_0x1093('0x13')][_0x1093('0x17')]?_['map'](_0x14e915[_0x1093('0x13')]['include'],function(_0x4e8dac){return{'model':db[_0x4e8dac[_0x1093('0x18')]],'as':_0x4e8dac['as'],'attributes':_0x4e8dac[_0x1093('0x16')],'include':_0x4e8dac[_0x1093('0x17')]?_[_0x1093('0x19')](_0x4e8dac[_0x1093('0x17')],function(_0x496aed){return{'model':db[_0x496aed[_0x1093('0x18')]],'as':_0x496aed['as'],'attributes':_0x496aed[_0x1093('0x16')],'include':_0x496aed[_0x1093('0x17')]?_[_0x1093('0x19')](_0x496aed[_0x1093('0x17')],function(_0x1f3db4){return{'model':db[_0x1f3db4['model']],'as':_0x1f3db4['as'],'attributes':_0x1f3db4[_0x1093('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c0b18){logger[_0x1093('0x1a')](_0x1093('0x1b'),_0x14e915);logger[_0x1093('0xa')](_0x1093('0x1b'),_0x14e915,JSON[_0x1093('0x1c')](_0x5c0b18));_0x44af7d(_0x5c0b18);})[_0x1093('0x10')](function(_0x7b9db6){logger[_0x1093('0xc')](_0x1093('0x1b'),_0x7b9db6[_0x1093('0xe')],_0x14e915);_0x1aae75(_0x41289b[_0x1093('0xc')](0x1f4,_0x7b9db6[_0x1093('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index ad6fee2..83b0ec0 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 _0x57b1=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x368113,_0x244119){var _0x475e26=function(_0x301a02){while(--_0x301a02){_0x368113['push'](_0x368113['shift']());}};_0x475e26(++_0x244119);}(_0x57b1,0x17c));var _0x157b=function(_0x418031,_0x1f6d96){_0x418031=_0x418031-0x0;var _0x585a13=_0x57b1[_0x418031];return _0x585a13;};'use strict';var multer=require(_0x157b('0x0'));var util=require(_0x157b('0x1'));var path=require('path');var timeout=require(_0x157b('0x2'));var express=require(_0x157b('0x3'));var router=express[_0x157b('0x4')]();var fs_extra=require(_0x157b('0x5'));var auth=require(_0x157b('0x6'));var interaction=require(_0x157b('0x7'));var config=require(_0x157b('0x8'));var controller=require('./squareProject.controller');router[_0x157b('0x9')]('/',auth[_0x157b('0xa')](),controller[_0x157b('0xb')]);router[_0x157b('0x9')](_0x157b('0xc'),auth[_0x157b('0xa')](),controller[_0x157b('0xd')]);router['post']('/',auth[_0x157b('0xa')](),controller[_0x157b('0xe')]);router[_0x157b('0xf')](_0x157b('0xc'),auth[_0x157b('0xa')](),controller[_0x157b('0x10')]);router[_0x157b('0x11')](_0x157b('0xc'),auth[_0x157b('0xa')](),controller[_0x157b('0x12')]);module[_0x157b('0x13')]=router; \ No newline at end of file +var _0x54a4=['../../config/environment','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x383cf2,_0x14224a){var _0x2ca334=function(_0x3fe4dc){while(--_0x3fe4dc){_0x383cf2['push'](_0x383cf2['shift']());}};_0x2ca334(++_0x14224a);}(_0x54a4,0x13e));var _0x454a=function(_0x48e467,_0x20a673){_0x48e467=_0x48e467-0x0;var _0x56d674=_0x54a4[_0x48e467];return _0x56d674;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x454a('0x0'));var timeout=require(_0x454a('0x1'));var express=require(_0x454a('0x2'));var router=express['Router']();var fs_extra=require(_0x454a('0x3'));var auth=require(_0x454a('0x4'));var interaction=require(_0x454a('0x5'));var config=require(_0x454a('0x6'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x454a('0x7')](),controller[_0x454a('0x8')]);router['get'](_0x454a('0x9'),auth['isAuthenticated'](),controller[_0x454a('0xa')]);router[_0x454a('0xb')]('/',auth[_0x454a('0x7')](),controller[_0x454a('0xc')]);router[_0x454a('0xd')](_0x454a('0x9'),auth[_0x454a('0x7')](),controller[_0x454a('0xe')]);router[_0x454a('0xf')](_0x454a('0x9'),auth['isAuthenticated'](),controller[_0x454a('0x10')]);module[_0x454a('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 737588f..ed9568b 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 _0xea2d=['STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports'];(function(_0x55c1d7,_0x71967d){var _0x426982=function(_0x392f02){while(--_0x392f02){_0x55c1d7['push'](_0x55c1d7['shift']());}};_0x426982(++_0x71967d);}(_0xea2d,0xfb));var _0xdea2=function(_0x2a3eba,_0x4ecf6f){_0x2a3eba=_0x2a3eba-0x0;var _0x4f68a2=_0xea2d[_0x2a3eba];return _0x4f68a2;};'use strict';var Sequelize=require('sequelize');module[_0xdea2('0x0')]={'name':{'type':Sequelize[_0xdea2('0x1')],'unique':_0xdea2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xdea2('0x1')]},'notes':{'type':Sequelize[_0xdea2('0x3')]},'preproduction':{'type':Sequelize[_0xdea2('0x4')](_0xdea2('0x5')),'get':function(){if(this[_0xdea2('0x6')](_0xdea2('0x7'))){return this[_0xdea2('0x6')](_0xdea2('0x7'))[_0xdea2('0x8')](_0xdea2('0x9'));}}},'production':{'type':Sequelize[_0xdea2('0x4')](_0xdea2('0x5')),'get':function(){if(this['getDataValue'](_0xdea2('0xa'))){return this['getDataValue'](_0xdea2('0xa'))[_0xdea2('0x8')](_0xdea2('0x9'));}}},'savedAt':{'type':Sequelize[_0xdea2('0xb')]},'publishedAt':{'type':Sequelize[_0xdea2('0xb')]}}; \ No newline at end of file +var _0x1691=['exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE','sequelize'];(function(_0x40ebc3,_0x22d982){var _0x47e497=function(_0x186b0e){while(--_0x186b0e){_0x40ebc3['push'](_0x40ebc3['shift']());}};_0x47e497(++_0x22d982);}(_0x1691,0x1ed));var _0x1169=function(_0x502f75,_0x31136c){_0x502f75=_0x502f75-0x0;var _0x218a15=_0x1691[_0x502f75];return _0x218a15;};'use strict';var Sequelize=require(_0x1169('0x0'));module[_0x1169('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1169('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1169('0x3')]},'notes':{'type':Sequelize[_0x1169('0x4')]},'preproduction':{'type':Sequelize[_0x1169('0x5')](_0x1169('0x6')),'get':function(){if(this[_0x1169('0x7')](_0x1169('0x8'))){return this[_0x1169('0x7')]('preproduction')[_0x1169('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x1169('0x5')]('long'),'get':function(){if(this[_0x1169('0x7')](_0x1169('0xa'))){return this['getDataValue'](_0x1169('0xa'))[_0x1169('0x9')](_0x1169('0xb'));}}},'savedAt':{'type':Sequelize[_0x1169('0xc')]},'publishedAt':{'type':Sequelize[_0x1169('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index a8c477b..6485d92 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 _0x4c59=['error','stack','name','send','index','map','SquareProject','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','get','role','user','userProfileId','body','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','end'];(function(_0x4b2811,_0x3fc912){var _0x863d41=function(_0x107302){while(--_0x107302){_0x4b2811['push'](_0x4b2811['shift']());}};_0x863d41(++_0x3fc912);}(_0x4c59,0xb3));var _0x94c5=function(_0x44f9c0,_0x391085){_0x44f9c0=_0x44f9c0-0x0;var _0x241aa7=_0x4c59[_0x44f9c0];return _0x241aa7;};'use strict';var _=require(_0x94c5('0x0'));var Redis=require(_0x94c5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x94c5('0x2'))(_0x94c5('0x3'));var config=require(_0x94c5('0x4'));var db=require(_0x94c5('0x5'))['db'];config[_0x94c5('0x6')]=_[_0x94c5('0x7')](config[_0x94c5('0x6')],{'host':_0x94c5('0x8'),'port':0x18eb});var socket=require(_0x94c5('0x9'))(new Redis(config[_0x94c5('0x6')]));require(_0x94c5('0xa'))[_0x94c5('0xb')](socket);function respondWithResult(_0x442389,_0xf4e6b0){_0xf4e6b0=_0xf4e6b0||0xc8;return function(_0x4923dd){if(_0x4923dd){return _0x442389[_0x94c5('0xc')](_0xf4e6b0)[_0x94c5('0xd')](_0x4923dd);}};}function respondWithFilteredResult(_0x2cb79c,_0x356682){return function(_0x5287ae){if(_0x5287ae){var _0x3c17d9=typeof _0x356682[_0x94c5('0xe')]===_0x94c5('0xf')&&typeof _0x356682[_0x94c5('0x10')]===_0x94c5('0xf');var _0x36aaa7=_0x5287ae[_0x94c5('0x11')];var _0x5d7cff=_0x3c17d9?0x0:_0x356682[_0x94c5('0xe')];var _0x5d929f=_0x3c17d9?_0x5287ae[_0x94c5('0x11')]:_0x356682[_0x94c5('0xe')]+_0x356682[_0x94c5('0x10')];var _0x58cc1e;if(_0x5d929f>=_0x36aaa7){_0x5d929f=_0x36aaa7;_0x58cc1e=0xc8;}else{_0x58cc1e=0xce;}_0x2cb79c[_0x94c5('0xc')](_0x58cc1e);return _0x2cb79c[_0x94c5('0x12')](_0x94c5('0x13'),_0x5d7cff+'-'+_0x5d929f+'/'+_0x36aaa7)[_0x94c5('0xd')](_0x5287ae);}return null;};}function saveUpdates(_0x41a399){return function(_0x48b113){if(_0x48b113){return _0x48b113['update'](_0x41a399)['then'](function(_0x43d09a){return _0x43d09a;});}return null;};}function removeEntity(_0x31a769){return function(_0x380b5d){if(_0x380b5d){return _0x380b5d['destroy']()[_0x94c5('0x14')](function(){var _0x451a45=_0x380b5d['get']({'plain':!![]});var _0x43ed27=_0x94c5('0x15');return db[_0x94c5('0x16')][_0x94c5('0x17')]({'where':{'type':_0x43ed27,'resourceId':_0x451a45['id']}})['then'](function(){return _0x380b5d;});})[_0x94c5('0x14')](function(){var _0x1fd001=new Redis(config[_0x94c5('0x6')]);_0x1fd001[_0x94c5('0x18')](_0x94c5('0x19'),JSON[_0x94c5('0x1a')]({'id':_0x380b5d['id'],'deleted':!![]}));})[_0x94c5('0x14')](function(){_0x31a769[_0x94c5('0xc')](0xcc)[_0x94c5('0x1b')]();});}};}function handleEntityNotFound(_0x1541fd){return function(_0x5d3eb8){if(!_0x5d3eb8){_0x1541fd['sendStatus'](0x194);}return _0x5d3eb8;};}function handleError(_0x12d954,_0x3afafd){_0x3afafd=_0x3afafd||0x1f4;return function(_0x450cf7){logger[_0x94c5('0x1c')](_0x450cf7[_0x94c5('0x1d')]);if(_0x450cf7['name']){delete _0x450cf7[_0x94c5('0x1e')];}_0x12d954['status'](_0x3afafd)[_0x94c5('0x1f')](_0x450cf7);};}exports[_0x94c5('0x20')]=function(_0x33f05b,_0x3819d3){var _0x441535={},_0x7b9455={},_0x3eae67={'count':0x0,'rows':[]};var _0x18438e=_[_0x94c5('0x21')](db[_0x94c5('0x22')][_0x94c5('0x23')],function(_0x1c165d){return{'name':_0x1c165d['fieldName'],'type':_0x1c165d[_0x94c5('0x24')]['key']};});_0x7b9455[_0x94c5('0x25')]=_[_0x94c5('0x21')](_0x18438e,'name');_0x7b9455[_0x94c5('0x26')]=_[_0x94c5('0x27')](_0x33f05b['query']);_0x7b9455[_0x94c5('0x28')]=_[_0x94c5('0x29')](_0x7b9455[_0x94c5('0x25')],_0x7b9455['query']);_0x441535['attributes']=_['intersection'](_0x7b9455[_0x94c5('0x25')],qs['fields'](_0x33f05b[_0x94c5('0x26')][_0x94c5('0x2a')]));_0x441535[_0x94c5('0x2b')]=_0x441535[_0x94c5('0x2b')]['length']?_0x441535['attributes']:_0x7b9455[_0x94c5('0x25')];if(!_0x33f05b[_0x94c5('0x26')][_0x94c5('0x2c')](_0x94c5('0x2d'))){_0x441535[_0x94c5('0x10')]=qs['limit'](_0x33f05b[_0x94c5('0x26')][_0x94c5('0x10')]);_0x441535[_0x94c5('0xe')]=qs[_0x94c5('0xe')](_0x33f05b[_0x94c5('0x26')][_0x94c5('0xe')]);}_0x441535[_0x94c5('0x2e')]=qs['sort'](_0x33f05b[_0x94c5('0x26')][_0x94c5('0x2f')]);_0x441535[_0x94c5('0x30')]=qs[_0x94c5('0x28')](_[_0x94c5('0x31')](_0x33f05b[_0x94c5('0x26')],_0x7b9455[_0x94c5('0x28')]),_0x18438e);if(_0x33f05b['query']['filter']){_0x441535[_0x94c5('0x30')]=_[_0x94c5('0x32')](_0x441535['where'],{'$or':_['map'](_0x18438e,function(_0x1e874c){if(_0x1e874c[_0x94c5('0x24')]!=='VIRTUAL'){var _0x5abf26={};_0x5abf26[_0x1e874c[_0x94c5('0x1e')]]={'$like':'%'+_0x33f05b['query'][_0x94c5('0x33')]+'%'};return _0x5abf26;}})});}_0x441535=_[_0x94c5('0x32')]({},_0x441535,_0x33f05b[_0x94c5('0x34')]);var _0x2699cb={'where':_0x441535[_0x94c5('0x30')]};return db[_0x94c5('0x22')]['count'](_0x2699cb)['then'](function(_0xbaba51){_0x3eae67['count']=_0xbaba51;if(_0x33f05b['query']['includeAll']){_0x441535[_0x94c5('0x35')]=[{'all':!![]}];}return db['SquareProject'][_0x94c5('0x36')](_0x441535);})[_0x94c5('0x14')](function(_0x4fa0dc){_0x3eae67[_0x94c5('0x37')]=_0x4fa0dc;return _0x3eae67;})[_0x94c5('0x14')](respondWithFilteredResult(_0x3819d3,_0x441535))[_0x94c5('0x38')](handleError(_0x3819d3,null));};exports[_0x94c5('0x39')]=function(_0x538a9d,_0x3794a7){var _0x270a90={'raw':![],'where':{'id':_0x538a9d[_0x94c5('0x3a')]['id']}},_0x18d0b3={};_0x18d0b3['model']=_[_0x94c5('0x27')](db[_0x94c5('0x22')][_0x94c5('0x23')]);_0x18d0b3[_0x94c5('0x26')]=_[_0x94c5('0x27')](_0x538a9d['query']);_0x18d0b3[_0x94c5('0x28')]=_[_0x94c5('0x29')](_0x18d0b3[_0x94c5('0x25')],_0x18d0b3['query']);_0x270a90[_0x94c5('0x2b')]=_[_0x94c5('0x29')](_0x18d0b3[_0x94c5('0x25')],qs[_0x94c5('0x2a')](_0x538a9d[_0x94c5('0x26')][_0x94c5('0x2a')]));_0x270a90[_0x94c5('0x2b')]=_0x270a90[_0x94c5('0x2b')][_0x94c5('0x3b')]?_0x270a90[_0x94c5('0x2b')]:_0x18d0b3[_0x94c5('0x25')];if(_0x538a9d[_0x94c5('0x26')][_0x94c5('0x3c')]){_0x270a90[_0x94c5('0x35')]=[{'all':!![]}];}_0x270a90=_['merge']({},_0x270a90,_0x538a9d[_0x94c5('0x34')]);return db['SquareProject'][_0x94c5('0x3d')](_0x270a90)[_0x94c5('0x14')](handleEntityNotFound(_0x3794a7,null))['then'](respondWithResult(_0x3794a7,null))[_0x94c5('0x38')](handleError(_0x3794a7,null));};exports[_0x94c5('0x3e')]=function(_0x88aab0,_0x33e953){return db[_0x94c5('0x22')]['create'](_0x88aab0['body'],{})[_0x94c5('0x14')](function(_0x54794e){var _0x44ec95=_0x88aab0['user'][_0x94c5('0x3f')]({'plain':!![]});if(!_0x44ec95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44ec95[_0x94c5('0x40')]===_0x94c5('0x41')){var _0x62681e=_0x54794e[_0x94c5('0x3f')]({'plain':!![]});var _0x23d063=_0x94c5('0x15');return db['UserProfileSection'][_0x94c5('0x3d')]({'where':{'name':_0x23d063,'userProfileId':_0x44ec95[_0x94c5('0x42')]},'raw':!![]})[_0x94c5('0x14')](function(_0x353ad3){if(_0x353ad3&&_0x353ad3['autoAssociation']===0x0){return db[_0x94c5('0x16')][_0x94c5('0x3e')]({'name':_0x62681e[_0x94c5('0x1e')],'resourceId':_0x62681e['id'],'type':_0x353ad3['name'],'sectionId':_0x353ad3['id']},{})[_0x94c5('0x14')](function(){return _0x54794e;});}else{return _0x54794e;}})['catch'](function(_0x2b4632){logger[_0x94c5('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4632);throw _0x2b4632;});}return _0x54794e;})[_0x94c5('0x14')](respondWithResult(_0x33e953,0xc9))['catch'](handleError(_0x33e953,null));};exports['update']=function(_0x55c06b,_0x4d55e7){if(_0x55c06b[_0x94c5('0x43')]['id']){delete _0x55c06b[_0x94c5('0x43')]['id'];}return db[_0x94c5('0x22')]['find']({'where':{'id':_0x55c06b[_0x94c5('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4d55e7,null))[_0x94c5('0x14')](saveUpdates(_0x55c06b[_0x94c5('0x43')],null))[_0x94c5('0x14')](function(_0x13841a){if(!_0x13841a)return;var _0x10d5c7=_0x13841a['get']({'plain':!![]});return _0x10d5c7;})[_0x94c5('0x14')](function(_0x5e120d){var _0x3a0732=new Redis(config[_0x94c5('0x6')]);_0x3a0732[_0x94c5('0x18')]('agi',JSON[_0x94c5('0x1a')](_['pick'](_0x5e120d,['id',_0x94c5('0x1e'),_0x94c5('0x44')])));return _0x5e120d;})[_0x94c5('0x14')](respondWithResult(_0x4d55e7,null))[_0x94c5('0x38')](handleError(_0x4d55e7,null));};exports[_0x94c5('0x17')]=function(_0x33a0f9,_0x224902){return db[_0x94c5('0x22')][_0x94c5('0x3d')]({'where':{'id':_0x33a0f9[_0x94c5('0x3a')]['id']}})[_0x94c5('0x14')](handleEntityNotFound(_0x224902,null))['then'](removeEntity(_0x224902,null))[_0x94c5('0x38')](handleError(_0x224902,null));}; \ No newline at end of file +var _0x5dd7=['intersection','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','agi','production','lodash','ioredis','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','redis','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','get','SquareProjects','destroy','then','publish','stringify','sendStatus','name','send','index','map','SquareProject','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','rawAttributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5dd7,0x11e));var _0x75dd=function(_0x2819cc,_0x3e30c6){_0x2819cc=_0x2819cc-0x0;var _0x77124b=_0x5dd7[_0x2819cc];return _0x77124b;};'use strict';var _=require(_0x75dd('0x0'));var Redis=require(_0x75dd('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x75dd('0x2'))(_0x75dd('0x3'));var config=require(_0x75dd('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x75dd('0x5'),'port':0x18eb});var socket=require(_0x75dd('0x6'))(new Redis(config[_0x75dd('0x7')]));require(_0x75dd('0x8'))[_0x75dd('0x9')](socket);function respondWithResult(_0x267fd0,_0x56d5eb){_0x56d5eb=_0x56d5eb||0xc8;return function(_0x1519d8){if(_0x1519d8){return _0x267fd0[_0x75dd('0xa')](_0x56d5eb)[_0x75dd('0xb')](_0x1519d8);}};}function respondWithFilteredResult(_0x27f801,_0x238b90){return function(_0x37e902){if(_0x37e902){var _0x469280=typeof _0x238b90[_0x75dd('0xc')]===_0x75dd('0xd')&&typeof _0x238b90[_0x75dd('0xe')]===_0x75dd('0xd');var _0x4e190e=_0x37e902[_0x75dd('0xf')];var _0x1cb677=_0x469280?0x0:_0x238b90['offset'];var _0xa8da32=_0x469280?_0x37e902[_0x75dd('0xf')]:_0x238b90['offset']+_0x238b90[_0x75dd('0xe')];var _0x5452fa;if(_0xa8da32>=_0x4e190e){_0xa8da32=_0x4e190e;_0x5452fa=0xc8;}else{_0x5452fa=0xce;}_0x27f801[_0x75dd('0xa')](_0x5452fa);return _0x27f801[_0x75dd('0x10')](_0x75dd('0x11'),_0x1cb677+'-'+_0xa8da32+'/'+_0x4e190e)[_0x75dd('0xb')](_0x37e902);}return null;};}function saveUpdates(_0x334fd5){return function(_0x2b9a1b){if(_0x2b9a1b){return _0x2b9a1b[_0x75dd('0x12')](_0x334fd5)['then'](function(_0xe01766){return _0xe01766;});}return null;};}function removeEntity(_0xe05f0){return function(_0x18bf83){if(_0x18bf83){return _0x18bf83['destroy']()['then'](function(){var _0x48e9eb=_0x18bf83[_0x75dd('0x13')]({'plain':!![]});var _0xfbb959=_0x75dd('0x14');return db['UserProfileResource'][_0x75dd('0x15')]({'where':{'type':_0xfbb959,'resourceId':_0x48e9eb['id']}})[_0x75dd('0x16')](function(){return _0x18bf83;});})[_0x75dd('0x16')](function(){var _0x16dd4c=new Redis(config['redis']);_0x16dd4c[_0x75dd('0x17')]('agi',JSON[_0x75dd('0x18')]({'id':_0x18bf83['id'],'deleted':!![]}));})['then'](function(){_0xe05f0[_0x75dd('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f17a1){return function(_0x13b7ad){if(!_0x13b7ad){_0x2f17a1[_0x75dd('0x19')](0x194);}return _0x13b7ad;};}function handleError(_0x4cfcf0,_0x187c4f){_0x187c4f=_0x187c4f||0x1f4;return function(_0x3d5116){logger['error'](_0x3d5116['stack']);if(_0x3d5116[_0x75dd('0x1a')]){delete _0x3d5116['name'];}_0x4cfcf0[_0x75dd('0xa')](_0x187c4f)[_0x75dd('0x1b')](_0x3d5116);};}exports[_0x75dd('0x1c')]=function(_0x4b18d3,_0x52a6d4){var _0x40b650={},_0x30609a={},_0x4c65d8={'count':0x0,'rows':[]};var _0x2ce80a=_[_0x75dd('0x1d')](db[_0x75dd('0x1e')]['rawAttributes'],function(_0x273ea0){return{'name':_0x273ea0['fieldName'],'type':_0x273ea0['type'][_0x75dd('0x1f')]};});_0x30609a[_0x75dd('0x20')]=_[_0x75dd('0x1d')](_0x2ce80a,_0x75dd('0x1a'));_0x30609a[_0x75dd('0x21')]=_[_0x75dd('0x22')](_0x4b18d3[_0x75dd('0x21')]);_0x30609a[_0x75dd('0x23')]=_['intersection'](_0x30609a['model'],_0x30609a[_0x75dd('0x21')]);_0x40b650['attributes']=_['intersection'](_0x30609a[_0x75dd('0x20')],qs[_0x75dd('0x24')](_0x4b18d3[_0x75dd('0x21')][_0x75dd('0x24')]));_0x40b650['attributes']=_0x40b650[_0x75dd('0x25')][_0x75dd('0x26')]?_0x40b650[_0x75dd('0x25')]:_0x30609a[_0x75dd('0x20')];if(!_0x4b18d3['query']['hasOwnProperty'](_0x75dd('0x27'))){_0x40b650[_0x75dd('0xe')]=qs[_0x75dd('0xe')](_0x4b18d3[_0x75dd('0x21')]['limit']);_0x40b650[_0x75dd('0xc')]=qs['offset'](_0x4b18d3[_0x75dd('0x21')][_0x75dd('0xc')]);}_0x40b650[_0x75dd('0x28')]=qs[_0x75dd('0x29')](_0x4b18d3[_0x75dd('0x21')][_0x75dd('0x29')]);_0x40b650[_0x75dd('0x2a')]=qs[_0x75dd('0x23')](_[_0x75dd('0x2b')](_0x4b18d3[_0x75dd('0x21')],_0x30609a[_0x75dd('0x23')]),_0x2ce80a);if(_0x4b18d3[_0x75dd('0x21')][_0x75dd('0x2c')]){_0x40b650[_0x75dd('0x2a')]=_[_0x75dd('0x2d')](_0x40b650[_0x75dd('0x2a')],{'$or':_[_0x75dd('0x1d')](_0x2ce80a,function(_0x20e310){if(_0x20e310[_0x75dd('0x2e')]!=='VIRTUAL'){var _0xef4232={};_0xef4232[_0x20e310[_0x75dd('0x1a')]]={'$like':'%'+_0x4b18d3[_0x75dd('0x21')][_0x75dd('0x2c')]+'%'};return _0xef4232;}})});}_0x40b650=_['merge']({},_0x40b650,_0x4b18d3[_0x75dd('0x2f')]);var _0x33a4f6={'where':_0x40b650[_0x75dd('0x2a')]};return db[_0x75dd('0x1e')][_0x75dd('0xf')](_0x33a4f6)['then'](function(_0x3e48e6){_0x4c65d8[_0x75dd('0xf')]=_0x3e48e6;if(_0x4b18d3['query'][_0x75dd('0x30')]){_0x40b650['include']=[{'all':!![]}];}return db[_0x75dd('0x1e')][_0x75dd('0x31')](_0x40b650);})[_0x75dd('0x16')](function(_0x15261c){_0x4c65d8[_0x75dd('0x32')]=_0x15261c;return _0x4c65d8;})[_0x75dd('0x16')](respondWithFilteredResult(_0x52a6d4,_0x40b650))[_0x75dd('0x33')](handleError(_0x52a6d4,null));};exports[_0x75dd('0x34')]=function(_0xab3197,_0x4f2f4b){var _0x49dd2b={'raw':![],'where':{'id':_0xab3197['params']['id']}},_0x7962de={};_0x7962de[_0x75dd('0x20')]=_[_0x75dd('0x22')](db[_0x75dd('0x1e')][_0x75dd('0x35')]);_0x7962de[_0x75dd('0x21')]=_['keys'](_0xab3197[_0x75dd('0x21')]);_0x7962de['filters']=_[_0x75dd('0x36')](_0x7962de[_0x75dd('0x20')],_0x7962de[_0x75dd('0x21')]);_0x49dd2b[_0x75dd('0x25')]=_['intersection'](_0x7962de[_0x75dd('0x20')],qs[_0x75dd('0x24')](_0xab3197[_0x75dd('0x21')][_0x75dd('0x24')]));_0x49dd2b[_0x75dd('0x25')]=_0x49dd2b[_0x75dd('0x25')]['length']?_0x49dd2b[_0x75dd('0x25')]:_0x7962de['model'];if(_0xab3197['query'][_0x75dd('0x30')]){_0x49dd2b['include']=[{'all':!![]}];}_0x49dd2b=_['merge']({},_0x49dd2b,_0xab3197[_0x75dd('0x2f')]);return db[_0x75dd('0x1e')]['find'](_0x49dd2b)['then'](handleEntityNotFound(_0x4f2f4b,null))[_0x75dd('0x16')](respondWithResult(_0x4f2f4b,null))['catch'](handleError(_0x4f2f4b,null));};exports['create']=function(_0x5737d5,_0x4ea843){return db['SquareProject'][_0x75dd('0x37')](_0x5737d5[_0x75dd('0x38')],{})[_0x75dd('0x16')](function(_0x363cc8){var _0x29e20b=_0x5737d5[_0x75dd('0x39')][_0x75dd('0x13')]({'plain':!![]});if(!_0x29e20b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29e20b[_0x75dd('0x3a')]===_0x75dd('0x39')){var _0x4f8ce3=_0x363cc8[_0x75dd('0x13')]({'plain':!![]});var _0x5b2c93='SquareProjects';return db[_0x75dd('0x3b')]['find']({'where':{'name':_0x5b2c93,'userProfileId':_0x29e20b['userProfileId']},'raw':!![]})[_0x75dd('0x16')](function(_0x273a87){if(_0x273a87&&_0x273a87[_0x75dd('0x3c')]===0x0){return db[_0x75dd('0x3d')][_0x75dd('0x37')]({'name':_0x4f8ce3[_0x75dd('0x1a')],'resourceId':_0x4f8ce3['id'],'type':_0x273a87[_0x75dd('0x1a')],'sectionId':_0x273a87['id']},{})[_0x75dd('0x16')](function(){return _0x363cc8;});}else{return _0x363cc8;}})[_0x75dd('0x33')](function(_0x3289b0){logger[_0x75dd('0x3e')](_0x75dd('0x3f'),_0x3289b0);throw _0x3289b0;});}return _0x363cc8;})[_0x75dd('0x16')](respondWithResult(_0x4ea843,0xc9))[_0x75dd('0x33')](handleError(_0x4ea843,null));};exports[_0x75dd('0x12')]=function(_0x4aef58,_0x3fa275){if(_0x4aef58[_0x75dd('0x38')]['id']){delete _0x4aef58[_0x75dd('0x38')]['id'];}return db[_0x75dd('0x1e')][_0x75dd('0x40')]({'where':{'id':_0x4aef58[_0x75dd('0x41')]['id']}})[_0x75dd('0x16')](handleEntityNotFound(_0x3fa275,null))[_0x75dd('0x16')](saveUpdates(_0x4aef58[_0x75dd('0x38')],null))[_0x75dd('0x16')](function(_0x2ff74f){if(!_0x2ff74f)return;var _0xd753ae=_0x2ff74f[_0x75dd('0x13')]({'plain':!![]});return _0xd753ae;})[_0x75dd('0x16')](function(_0x1f75f4){var _0x23695d=new Redis(config['redis']);_0x23695d[_0x75dd('0x17')](_0x75dd('0x42'),JSON[_0x75dd('0x18')](_[_0x75dd('0x2b')](_0x1f75f4,['id',_0x75dd('0x1a'),_0x75dd('0x43')])));return _0x1f75f4;})['then'](respondWithResult(_0x3fa275,null))[_0x75dd('0x33')](handleError(_0x3fa275,null));};exports[_0x75dd('0x15')]=function(_0xa443cc,_0x6b8bb){return db[_0x75dd('0x1e')][_0x75dd('0x40')]({'where':{'id':_0xa443cc[_0x75dd('0x41')]['id']}})[_0x75dd('0x16')](handleEntityNotFound(_0x6b8bb,null))[_0x75dd('0x16')](removeEntity(_0x6b8bb,null))[_0x75dd('0x33')](handleError(_0x6b8bb,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0dbe4f9..8c98267 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 _0x9458=['SquareProject','save','hasOwnProperty','hook','events'];(function(_0x359877,_0x46bbd1){var _0x32e0a1=function(_0x5b5ce1){while(--_0x5b5ce1){_0x359877['push'](_0x359877['shift']());}};_0x32e0a1(++_0x46bbd1);}(_0x9458,0x121));var _0x8945=function(_0x4b0c46,_0x35b23d){_0x4b0c46=_0x4b0c46-0x0;var _0x48526a=_0x9458[_0x4b0c46];return _0x48526a;};'use strict';var EventEmitter=require(_0x8945('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x8945('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8945('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x586e4b){return function(_0x2072f1,_0x321872,_0x1ac97e){SquareProjectEvents['emit'](_0x586e4b+':'+_0x2072f1['id'],_0x2072f1);SquareProjectEvents['emit'](_0x586e4b,_0x2072f1);_0x1ac97e(null);};}for(var e in events){if(events[_0x8945('0x3')](e)){var event=events[e];SquareProject[_0x8945('0x4')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xebf9=['hook','../../mysqldb','SquareProject','save','emit','hasOwnProperty'];(function(_0xed65d3,_0x16f84e){var _0x576503=function(_0x4c1753){while(--_0x4c1753){_0xed65d3['push'](_0xed65d3['shift']());}};_0x576503(++_0x16f84e);}(_0xebf9,0x18d));var _0x9ebf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xebf9[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x9ebf('0x0'))['db'][_0x9ebf('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9ebf('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5cee73){return function(_0x3b5d7b,_0x354ba9,_0x1dda7b){SquareProjectEvents[_0x9ebf('0x3')](_0x5cee73+':'+_0x3b5d7b['id'],_0x3b5d7b);SquareProjectEvents[_0x9ebf('0x3')](_0x5cee73,_0x3b5d7b);_0x1dda7b(null);};}for(var e in events){if(events[_0x9ebf('0x4')](e)){var event=events[e];SquareProject[_0x9ebf('0x5')](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 011d563..ddcb212 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 _0xd7fc=['production','publishedAt','format','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','square_projects','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x53d08c,_0x4d78c9){var _0x51ae5f=function(_0x460ca6){while(--_0x460ca6){_0x53d08c['push'](_0x53d08c['shift']());}};_0x51ae5f(++_0x4d78c9);}(_0xd7fc,0x1ac));var _0xcd7f=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xd7fc[_0x238671];return _0x474844;};'use strict';var _=require(_0xcd7f('0x0'));var util=require(_0xcd7f('0x1'));var logger=require('../../config/logger')(_0xcd7f('0x2'));var moment=require(_0xcd7f('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd7f('0x4'));var fs=require('fs');var path=require(_0xcd7f('0x5'));var rimraf=require(_0xcd7f('0x6'));var config=require(_0xcd7f('0x7'));var attributes=require(_0xcd7f('0x8'));module['exports']=function(_0x4ec6e9,_0x4926e2){return _0x4ec6e9[_0xcd7f('0x9')]('SquareProject',attributes,{'tableName':_0xcd7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54c765,_0x5038c2,_0x1f8777){if(_0x54c765[_0xcd7f('0xb')]('preproduction')){_0x54c765[_0xcd7f('0xc')]=moment()['format'](_0xcd7f('0xd'));}if(_0x54c765[_0xcd7f('0xb')](_0xcd7f('0xe'))){_0x54c765[_0xcd7f('0xf')]=moment()[_0xcd7f('0x10')](_0xcd7f('0xd'));}_0x1f8777(null,_0x54c765);}}});}; \ No newline at end of file +var _0x2ab5=['rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5d4364,_0x4a6c71){var _0x460809=function(_0x420c17){while(--_0x420c17){_0x5d4364['push'](_0x5d4364['shift']());}};_0x460809(++_0x4a6c71);}(_0x2ab5,0x76));var _0x52ab=function(_0x204d23,_0x5e7b2e){_0x204d23=_0x204d23-0x0;var _0x54d455=_0x2ab5[_0x204d23];return _0x54d455;};'use strict';var _=require(_0x52ab('0x0'));var util=require(_0x52ab('0x1'));var logger=require(_0x52ab('0x2'))(_0x52ab('0x3'));var moment=require(_0x52ab('0x4'));var BPromise=require(_0x52ab('0x5'));var rp=require(_0x52ab('0x6'));var fs=require('fs');var path=require(_0x52ab('0x7'));var rimraf=require(_0x52ab('0x8'));var config=require(_0x52ab('0x9'));var attributes=require(_0x52ab('0xa'));module['exports']=function(_0x322be5,_0x23b181){return _0x322be5[_0x52ab('0xb')](_0x52ab('0xc'),attributes,{'tableName':_0x52ab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13d763,_0x4c2899,_0x55aef9){if(_0x13d763[_0x52ab('0xe')](_0x52ab('0xf'))){_0x13d763[_0x52ab('0x10')]=moment()[_0x52ab('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x13d763[_0x52ab('0xe')](_0x52ab('0x12'))){_0x13d763[_0x52ab('0x13')]=moment()[_0x52ab('0x11')](_0x52ab('0x14'));}_0x55aef9(null,_0x13d763);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2335c85..dfd1042 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 _0xd91d=['debug','stringify','catch','message','error','ShowSquareProject','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','./squareProject.socket','GetSquareProjects','SquareProject','findAll','raw','options','where','attributes','limit','include','model','map','then','info'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd91d,0x1ec));var _0xdd91=function(_0x53731a,_0x39d95d){_0x53731a=_0x53731a-0x0;var _0x4643b1=_0xd91d[_0x53731a];return _0x4643b1;};'use strict';var _=require('lodash');var Redis=require(_0xdd91('0x0'));var db=require(_0xdd91('0x1'))['db'];var logger=require(_0xdd91('0x2'))(_0xdd91('0x3'));var config=require(_0xdd91('0x4'));config[_0xdd91('0x5')]=_[_0xdd91('0x6')](config[_0xdd91('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdd91('0x7'))['register'](socket);exports[_0xdd91('0x8')]=function(_0x86539f){var _0x45556e=this;return new Promise(function(_0x58aaa5,_0x491fc9){return db[_0xdd91('0x9')][_0xdd91('0xa')]({'raw':_0x86539f['options']?_0x86539f['options'][_0xdd91('0xb')]===undefined?!![]:![]:!![],'where':_0x86539f[_0xdd91('0xc')]?_0x86539f['options'][_0xdd91('0xd')]||null:null,'attributes':_0x86539f[_0xdd91('0xc')]?_0x86539f[_0xdd91('0xc')][_0xdd91('0xe')]||null:null,'limit':_0x86539f[_0xdd91('0xc')]?_0x86539f['options'][_0xdd91('0xf')]||null:null,'include':_0x86539f['options']?_0x86539f[_0xdd91('0xc')][_0xdd91('0x10')]?_['map'](_0x86539f[_0xdd91('0xc')][_0xdd91('0x10')],function(_0xa5fe5f){return{'model':db[_0xa5fe5f[_0xdd91('0x11')]],'as':_0xa5fe5f['as'],'attributes':_0xa5fe5f[_0xdd91('0xe')],'include':_0xa5fe5f['include']?_['map'](_0xa5fe5f[_0xdd91('0x10')],function(_0x12f6a0){return{'model':db[_0x12f6a0['model']],'as':_0x12f6a0['as'],'attributes':_0x12f6a0[_0xdd91('0xe')],'include':_0x12f6a0['include']?_[_0xdd91('0x12')](_0x12f6a0[_0xdd91('0x10')],function(_0x5d3849){return{'model':db[_0x5d3849[_0xdd91('0x11')]],'as':_0x5d3849['as'],'attributes':_0x5d3849[_0xdd91('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdd91('0x13')](function(_0x4ba9d7){logger[_0xdd91('0x14')](_0xdd91('0x8'),_0x86539f);logger[_0xdd91('0x15')](_0xdd91('0x8'),_0x86539f,JSON[_0xdd91('0x16')](_0x4ba9d7));_0x58aaa5(_0x4ba9d7);})[_0xdd91('0x17')](function(_0x3c24d3){logger['error'](_0xdd91('0x8'),_0x3c24d3[_0xdd91('0x18')],_0x86539f);_0x491fc9(_0x45556e[_0xdd91('0x19')](0x1f4,_0x3c24d3[_0xdd91('0x18')]));});});};exports[_0xdd91('0x1a')]=function(_0x36e4d8){var _0x14cd1f=this;return new Promise(function(_0x439ca6,_0x3e27aa){return db[_0xdd91('0x9')]['find']({'raw':_0x36e4d8['options']?_0x36e4d8[_0xdd91('0xc')][_0xdd91('0xb')]===undefined?!![]:![]:!![],'where':_0x36e4d8['options']?_0x36e4d8[_0xdd91('0xc')]['where']||null:null,'attributes':_0x36e4d8['options']?_0x36e4d8[_0xdd91('0xc')][_0xdd91('0xe')]||null:null,'include':_0x36e4d8['options']?_0x36e4d8[_0xdd91('0xc')][_0xdd91('0x10')]?_[_0xdd91('0x12')](_0x36e4d8[_0xdd91('0xc')][_0xdd91('0x10')],function(_0x4c0ce8){return{'model':db[_0x4c0ce8[_0xdd91('0x11')]],'as':_0x4c0ce8['as'],'attributes':_0x4c0ce8[_0xdd91('0xe')],'include':_0x4c0ce8[_0xdd91('0x10')]?_[_0xdd91('0x12')](_0x4c0ce8[_0xdd91('0x10')],function(_0x3a4bbe){return{'model':db[_0x3a4bbe[_0xdd91('0x11')]],'as':_0x3a4bbe['as'],'attributes':_0x3a4bbe[_0xdd91('0xe')],'include':_0x3a4bbe[_0xdd91('0x10')]?_['map'](_0x3a4bbe[_0xdd91('0x10')],function(_0x29d54c){return{'model':db[_0x29d54c[_0xdd91('0x11')]],'as':_0x29d54c['as'],'attributes':_0x29d54c[_0xdd91('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdd91('0x13')](function(_0x51f7d9){logger[_0xdd91('0x14')](_0xdd91('0x1a'),_0x36e4d8);logger['debug'](_0xdd91('0x1a'),_0x36e4d8,JSON[_0xdd91('0x16')](_0x51f7d9));_0x439ca6(_0x51f7d9);})[_0xdd91('0x17')](function(_0x17665d){logger['error']('ShowSquareProject',_0x17665d['message'],_0x36e4d8);_0x3e27aa(_0x14cd1f[_0xdd91('0x19')](0x1f4,_0x17665d[_0xdd91('0x18')]));});});}; \ No newline at end of file +var _0xd292=['error','message','ShowSquareProject','find','raw','map','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','SquareProject','options','where','include','attributes','model','then','info','debug','GetSquareProjects','stringify','catch'];(function(_0x2c7290,_0x51c7a5){var _0x366b3c=function(_0x192eb3){while(--_0x192eb3){_0x2c7290['push'](_0x2c7290['shift']());}};_0x366b3c(++_0x51c7a5);}(_0xd292,0x1c6));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d29('0x0'));var Redis=require(_0x2d29('0x1'));var db=require(_0x2d29('0x2'))['db'];var logger=require(_0x2d29('0x3'))('rpc');var config=require(_0x2d29('0x4'));config[_0x2d29('0x5')]=_[_0x2d29('0x6')](config[_0x2d29('0x5')],{'host':_0x2d29('0x7'),'port':0x18eb});var socket=require(_0x2d29('0x8'))(new Redis(config[_0x2d29('0x5')]));require(_0x2d29('0x9'))['register'](socket);exports['GetSquareProjects']=function(_0x5d2723){var _0x5027f3=this;return new Promise(function(_0x1e59c3,_0x2c4527){return db[_0x2d29('0xa')]['findAll']({'raw':_0x5d2723['options']?_0x5d2723['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d2723[_0x2d29('0xb')]?_0x5d2723[_0x2d29('0xb')][_0x2d29('0xc')]||null:null,'attributes':_0x5d2723[_0x2d29('0xb')]?_0x5d2723[_0x2d29('0xb')]['attributes']||null:null,'limit':_0x5d2723[_0x2d29('0xb')]?_0x5d2723[_0x2d29('0xb')]['limit']||null:null,'include':_0x5d2723['options']?_0x5d2723[_0x2d29('0xb')][_0x2d29('0xd')]?_['map'](_0x5d2723[_0x2d29('0xb')][_0x2d29('0xd')],function(_0x20dcce){return{'model':db[_0x20dcce['model']],'as':_0x20dcce['as'],'attributes':_0x20dcce[_0x2d29('0xe')],'include':_0x20dcce['include']?_['map'](_0x20dcce[_0x2d29('0xd')],function(_0x5d84e4){return{'model':db[_0x5d84e4[_0x2d29('0xf')]],'as':_0x5d84e4['as'],'attributes':_0x5d84e4[_0x2d29('0xe')],'include':_0x5d84e4[_0x2d29('0xd')]?_['map'](_0x5d84e4['include'],function(_0x44ec4f){return{'model':db[_0x44ec4f[_0x2d29('0xf')]],'as':_0x44ec4f['as'],'attributes':_0x44ec4f[_0x2d29('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2d29('0x10')](function(_0x55b97c){logger[_0x2d29('0x11')]('GetSquareProjects',_0x5d2723);logger[_0x2d29('0x12')](_0x2d29('0x13'),_0x5d2723,JSON[_0x2d29('0x14')](_0x55b97c));_0x1e59c3(_0x55b97c);})[_0x2d29('0x15')](function(_0x5f20fe){logger[_0x2d29('0x16')](_0x2d29('0x13'),_0x5f20fe[_0x2d29('0x17')],_0x5d2723);_0x2c4527(_0x5027f3[_0x2d29('0x16')](0x1f4,_0x5f20fe[_0x2d29('0x17')]));});});};exports[_0x2d29('0x18')]=function(_0x153162){var _0x38210c=this;return new Promise(function(_0x1e7300,_0xdb35f0){return db['SquareProject'][_0x2d29('0x19')]({'raw':_0x153162[_0x2d29('0xb')]?_0x153162[_0x2d29('0xb')][_0x2d29('0x1a')]===undefined?!![]:![]:!![],'where':_0x153162[_0x2d29('0xb')]?_0x153162['options'][_0x2d29('0xc')]||null:null,'attributes':_0x153162[_0x2d29('0xb')]?_0x153162[_0x2d29('0xb')][_0x2d29('0xe')]||null:null,'include':_0x153162[_0x2d29('0xb')]?_0x153162[_0x2d29('0xb')]['include']?_[_0x2d29('0x1b')](_0x153162['options'][_0x2d29('0xd')],function(_0x542054){return{'model':db[_0x542054[_0x2d29('0xf')]],'as':_0x542054['as'],'attributes':_0x542054[_0x2d29('0xe')],'include':_0x542054[_0x2d29('0xd')]?_['map'](_0x542054[_0x2d29('0xd')],function(_0x2396a7){return{'model':db[_0x2396a7['model']],'as':_0x2396a7['as'],'attributes':_0x2396a7['attributes'],'include':_0x2396a7['include']?_['map'](_0x2396a7['include'],function(_0x179de0){return{'model':db[_0x179de0[_0x2d29('0xf')]],'as':_0x179de0['as'],'attributes':_0x179de0[_0x2d29('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2d29('0x10')](function(_0x4b0e26){logger[_0x2d29('0x11')](_0x2d29('0x18'),_0x153162);logger[_0x2d29('0x12')](_0x2d29('0x18'),_0x153162,JSON[_0x2d29('0x14')](_0x4b0e26));_0x1e7300(_0x4b0e26);})[_0x2d29('0x15')](function(_0x5a7ebd){logger[_0x2d29('0x16')](_0x2d29('0x18'),_0x5a7ebd[_0x2d29('0x17')],_0x153162);_0xdb35f0(_0x38210c[_0x2d29('0x16')](0x1f4,_0x5a7ebd[_0x2d29('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d3d43e1..1cd6ecd 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 _0x8d53=['update','removeListener','register','length','squareProject:','save','remove'];(function(_0x4cbbe2,_0x13e63a){var _0x3e8f81=function(_0x57edff){while(--_0x57edff){_0x4cbbe2['push'](_0x4cbbe2['shift']());}};_0x3e8f81(++_0x13e63a);}(_0x8d53,0x132));var _0x38d5=function(_0x2f5e72,_0x59dc57){_0x2f5e72=_0x2f5e72-0x0;var _0xdc10d3=_0x8d53[_0x2f5e72];return _0xdc10d3;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x38d5('0x0'),_0x38d5('0x1'),_0x38d5('0x2')];function createListener(_0x33743e,_0x2893ed){return function(_0x5026de){_0x2893ed['emit'](_0x33743e,_0x5026de);};}function removeListener(_0x3394d4,_0x5621bf){return function(){SquareProjectEvents[_0x38d5('0x3')](_0x3394d4,_0x5621bf);};}exports[_0x38d5('0x4')]=function(_0x36d73e){for(var _0x2443b8=0x0,_0x278d6e=events[_0x38d5('0x5')];_0x2443b8<_0x278d6e;_0x2443b8++){var _0x3f61ea=events[_0x2443b8];var _0x49a41b=createListener(_0x38d5('0x6')+_0x3f61ea,_0x36d73e);SquareProjectEvents['on'](_0x3f61ea,_0x49a41b);}}; \ No newline at end of file +var _0x032c=['removeListener','register','squareProject:','./squareProject.events','save','remove','emit'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x032c,0x65));var _0xc032=function(_0x45071a,_0x406695){_0x45071a=_0x45071a-0x0;var _0x4502ca=_0x032c[_0x45071a];return _0x4502ca;};'use strict';var SquareProjectEvents=require(_0xc032('0x0'));var events=[_0xc032('0x1'),_0xc032('0x2'),'update'];function createListener(_0x209a8a,_0x4f8e91){return function(_0x170b5b){_0x4f8e91[_0xc032('0x3')](_0x209a8a,_0x170b5b);};}function removeListener(_0xf9ef0,_0x326929){return function(){SquareProjectEvents[_0xc032('0x4')](_0xf9ef0,_0x326929);};}exports[_0xc032('0x5')]=function(_0xb0c2b){for(var _0x38fba2=0x0,_0x387705=events['length'];_0x38fba2<_0x387705;_0x38fba2++){var _0x3fceb2=events[_0x38fba2];var _0x30b6ac=createListener(_0xc032('0x6')+_0x3fceb2,_0xb0c2b);SquareProjectEvents['on'](_0x3fceb2,_0x30b6ac);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b43da03..ecd356a 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x37ec40,_0x2974d2){var _0x841c66=function(_0x477a7d){while(--_0x477a7d){_0x37ec40['push'](_0x37ec40['shift']());}};_0x841c66(++_0x2974d2);}(_0x1261,0x144));var _0x1126=function(_0x2f3b86,_0x1fffad){_0x2f3b86=_0x2f3b86-0x0;var _0x9741a0=_0x1261[_0x2f3b86];return _0x9741a0;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x11812e,_0x504c52){var _0x2bb485=function(_0x53a4a4){while(--_0x53a4a4){_0x11812e['push'](_0x11812e['shift']());}};_0x2bb485(++_0x504c52);}(_0x1cb9,0x14e));var _0x91cb=function(_0x114437,_0xb3434d){_0x114437=_0x114437-0x0;var _0x533320=_0x1cb9[_0x114437];return _0x533320;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9597f75..3a24b62 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 _0xae24=['VIRTUAL','savePath','sequelize','STRING'];(function(_0x21cb1a,_0x2738b3){var _0x2df4f8=function(_0x3bc1b8){while(--_0x3bc1b8){_0x21cb1a['push'](_0x21cb1a['shift']());}};_0x2df4f8(++_0x2738b3);}(_0xae24,0x182));var _0x4ae2=function(_0x1cebcb,_0x1b2166){_0x1cebcb=_0x1cebcb-0x0;var _0x1693ae=_0xae24[_0x1cebcb];return _0x1693ae;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ae2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ae2('0x1')]},'context':{'type':Sequelize[_0x4ae2('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ae2('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4ae2('0x1')]},'saveName':{'type':Sequelize[_0x4ae2('0x1')]},'filename':{'type':Sequelize[_0x4ae2('0x1')]},'savePath':{'type':Sequelize[_0x4ae2('0x1')]},'format':{'type':Sequelize[_0x4ae2('0x2')],'get':function(){var _0x307247='';var _0x4f2e84=this['getDataValue'](_0x4ae2('0x3'));if(_0x4f2e84){_0x307247=_0x4f2e84['substring'](_0x4f2e84['lastIndexOf']('.'));}return _0x307247;}}}; \ No newline at end of file +var _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x561188,_0x185ee2){var _0x45b513=function(_0x52c503){while(--_0x52c503){_0x561188['push'](_0x561188['shift']());}};_0x45b513(++_0x185ee2);}(_0x31f0,0xb7));var _0x031f=function(_0x9f56b5,_0x38b709){_0x9f56b5=_0x9f56b5-0x0;var _0x1148b5=_0x31f0[_0x9f56b5];return _0x1148b5;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5ac34ab..c2e9a71 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 _0xb401=['message','SquareRecording\x20not\x20found','send','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','SquareRecording','rawAttributes','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','catch','show','keys','includeAll','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','extname','unlink'];(function(_0x95a12,_0x38bed8){var _0x3805e9=function(_0x1c0874){while(--_0x1c0874){_0x95a12['push'](_0x95a12['shift']());}};_0x3805e9(++_0x38bed8);}(_0xb401,0x74));var _0x1b40=function(_0x424d82,_0x594352){_0x424d82=_0x424d82-0x0;var _0x3451d7=_0xb401[_0x424d82];return _0x3451d7;};'use strict';var emlformat=require(_0x1b40('0x0'));var rimraf=require(_0x1b40('0x1'));var zipdir=require(_0x1b40('0x2'));var jsonpatch=require(_0x1b40('0x3'));var rp=require(_0x1b40('0x4'));var moment=require(_0x1b40('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b40('0x6'));var path=require(_0x1b40('0x7'));var sox=require(_0x1b40('0x8'));var csv=require(_0x1b40('0x9'));var ejs=require(_0x1b40('0xa'));var fs=require('fs');var fs_extra=require(_0x1b40('0xb'));var _=require(_0x1b40('0xc'));var squel=require(_0x1b40('0xd'));var crypto=require('crypto');var jsforce=require(_0x1b40('0xe'));var deskjs=require(_0x1b40('0xf'));var toCsv=require(_0x1b40('0x9'));var querystring=require(_0x1b40('0x10'));var Papa=require(_0x1b40('0x11'));var Redis=require('ioredis');var authService=require(_0x1b40('0x12'));var qs=require(_0x1b40('0x13'));var as=require(_0x1b40('0x14'));var hardwareService=require(_0x1b40('0x15'));var logger=require(_0x1b40('0x16'))('api');var utils=require(_0x1b40('0x17'));var config=require(_0x1b40('0x18'));var licenseUtil=require(_0x1b40('0x19'));var db=require(_0x1b40('0x1a'))['db'];function respondWithStatusCode(_0x2f500e,_0x5e672f){_0x5e672f=_0x5e672f||0xcc;return function(_0x249806){if(_0x249806){return _0x2f500e[_0x1b40('0x1b')](_0x5e672f);}return _0x2f500e['status'](_0x5e672f)['end']();};}function respondWithResult(_0x1c2ef1,_0x279a50){_0x279a50=_0x279a50||0xc8;return function(_0x3b610e){if(_0x3b610e){return _0x1c2ef1[_0x1b40('0x1c')](_0x279a50)['json'](_0x3b610e);}};}function respondWithFilteredResult(_0x12a5f9,_0x464b7c){return function(_0x532d39){if(_0x532d39){var _0x412a4b=typeof _0x464b7c['offset']===_0x1b40('0x1d')&&typeof _0x464b7c[_0x1b40('0x1e')]===_0x1b40('0x1d');var _0x4544b6=_0x532d39[_0x1b40('0x1f')];var _0x345859=_0x412a4b?0x0:_0x464b7c[_0x1b40('0x20')];var _0x401cea=_0x412a4b?_0x532d39[_0x1b40('0x1f')]:_0x464b7c[_0x1b40('0x20')]+_0x464b7c[_0x1b40('0x1e')];var _0x114bfd;if(_0x401cea>=_0x4544b6){_0x401cea=_0x4544b6;_0x114bfd=0xc8;}else{_0x114bfd=0xce;}_0x12a5f9['status'](_0x114bfd);return _0x12a5f9[_0x1b40('0x21')](_0x1b40('0x22'),_0x345859+'-'+_0x401cea+'/'+_0x4544b6)[_0x1b40('0x23')](_0x532d39);}return null;};}function patchUpdates(_0x3f043b){return function(_0x28bc84){try{jsonpatch[_0x1b40('0x24')](_0x28bc84,_0x3f043b,!![]);}catch(_0x22d21e){return BPromise[_0x1b40('0x25')](_0x22d21e);}return _0x28bc84[_0x1b40('0x26')]();};}function saveUpdates(_0x291400,_0x208bc9){return function(_0x4a56cc){if(_0x4a56cc){return _0x4a56cc[_0x1b40('0x27')](_0x291400)[_0x1b40('0x28')](function(_0x57de85){return _0x57de85;});}return null;};}function removeEntity(_0x248359,_0xfd6168){return function(_0x59680d){if(_0x59680d){return _0x59680d['destroy']()[_0x1b40('0x28')](function(){_0x248359[_0x1b40('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4ccc,_0x2fe126){return function(_0x5ba156){if(!_0x5ba156){_0x3b4ccc[_0x1b40('0x1b')](0x194);}return _0x5ba156;};}function handleError(_0x7c5cab,_0x5374cc){_0x5374cc=_0x5374cc||0x1f4;return function(_0x24384f){logger[_0x1b40('0x29')](_0x24384f[_0x1b40('0x2a')]);if(_0x24384f[_0x1b40('0x2b')]){delete _0x24384f[_0x1b40('0x2b')];}_0x7c5cab[_0x1b40('0x1c')](_0x5374cc)['send'](_0x24384f);};}exports[_0x1b40('0x2c')]=function(_0x58cfad,_0x350b3c){var _0xd08dbd={},_0x33d84a={},_0xbe17d3={'count':0x0,'rows':[]};var _0x5820da=_[_0x1b40('0x2d')](db[_0x1b40('0x2e')][_0x1b40('0x2f')],function(_0x52a398){return{'name':_0x52a398['fieldName'],'type':_0x52a398['type'][_0x1b40('0x30')]};});_0x33d84a['model']=_['map'](_0x5820da,_0x1b40('0x2b'));_0x33d84a[_0x1b40('0x31')]=_['keys'](_0x58cfad['query']);_0x33d84a[_0x1b40('0x32')]=_[_0x1b40('0x33')](_0x33d84a['model'],_0x33d84a['query']);_0xd08dbd[_0x1b40('0x34')]=_['intersection'](_0x33d84a['model'],qs[_0x1b40('0x35')](_0x58cfad[_0x1b40('0x31')][_0x1b40('0x35')]));_0xd08dbd[_0x1b40('0x34')]=_0xd08dbd['attributes'][_0x1b40('0x36')]?_0xd08dbd[_0x1b40('0x34')]:_0x33d84a[_0x1b40('0x37')];if(!_0x58cfad[_0x1b40('0x31')][_0x1b40('0x38')](_0x1b40('0x39'))){_0xd08dbd[_0x1b40('0x1e')]=qs[_0x1b40('0x1e')](_0x58cfad['query'][_0x1b40('0x1e')]);_0xd08dbd[_0x1b40('0x20')]=qs['offset'](_0x58cfad[_0x1b40('0x31')][_0x1b40('0x20')]);}_0xd08dbd['order']=qs[_0x1b40('0x3a')](_0x58cfad[_0x1b40('0x31')]['sort']);_0xd08dbd['where']=qs[_0x1b40('0x32')](_[_0x1b40('0x3b')](_0x58cfad[_0x1b40('0x31')],_0x33d84a[_0x1b40('0x32')]),_0x5820da);if(_0x58cfad[_0x1b40('0x31')][_0x1b40('0x3c')]){_0xd08dbd[_0x1b40('0x3d')]=_['merge'](_0xd08dbd[_0x1b40('0x3d')],{'$or':_[_0x1b40('0x2d')](_0x5820da,function(_0x157d47){if(_0x157d47[_0x1b40('0x3e')]!==_0x1b40('0x3f')){var _0x4307d8={};_0x4307d8[_0x157d47[_0x1b40('0x2b')]]={'$like':'%'+_0x58cfad[_0x1b40('0x31')][_0x1b40('0x3c')]+'%'};return _0x4307d8;}})});}_0xd08dbd=_[_0x1b40('0x40')]({},_0xd08dbd,_0x58cfad[_0x1b40('0x41')]);var _0x57a3e6={'where':_0xd08dbd[_0x1b40('0x3d')]};return db[_0x1b40('0x2e')][_0x1b40('0x1f')](_0x57a3e6)[_0x1b40('0x28')](function(_0x1940ed){_0xbe17d3[_0x1b40('0x1f')]=_0x1940ed;if(_0x58cfad[_0x1b40('0x31')]['includeAll']){_0xd08dbd[_0x1b40('0x42')]=[{'all':!![]}];}return db[_0x1b40('0x2e')][_0x1b40('0x43')](_0xd08dbd);})[_0x1b40('0x28')](function(_0x5b995e){_0xbe17d3['rows']=_0x5b995e;return _0xbe17d3;})[_0x1b40('0x28')](respondWithFilteredResult(_0x350b3c,_0xd08dbd))[_0x1b40('0x44')](handleError(_0x350b3c,null));};exports[_0x1b40('0x45')]=function(_0x445573,_0x15ec02){var _0x28a507={'raw':!![],'where':{'id':_0x445573['params']['id']}},_0x4cf2ac={};_0x4cf2ac[_0x1b40('0x37')]=_[_0x1b40('0x46')](db['SquareRecording']['rawAttributes']);_0x4cf2ac[_0x1b40('0x31')]=_['keys'](_0x445573[_0x1b40('0x31')]);_0x4cf2ac['filters']=_[_0x1b40('0x33')](_0x4cf2ac[_0x1b40('0x37')],_0x4cf2ac[_0x1b40('0x31')]);_0x28a507[_0x1b40('0x34')]=_[_0x1b40('0x33')](_0x4cf2ac[_0x1b40('0x37')],qs['fields'](_0x445573[_0x1b40('0x31')][_0x1b40('0x35')]));_0x28a507[_0x1b40('0x34')]=_0x28a507['attributes'][_0x1b40('0x36')]?_0x28a507['attributes']:_0x4cf2ac[_0x1b40('0x37')];if(_0x445573[_0x1b40('0x31')][_0x1b40('0x47')]){_0x28a507[_0x1b40('0x42')]=[{'all':!![]}];}_0x28a507=_['merge']({},_0x28a507,_0x445573['options']);return db[_0x1b40('0x2e')][_0x1b40('0x48')](_0x28a507)['then'](handleEntityNotFound(_0x15ec02,null))[_0x1b40('0x28')](respondWithResult(_0x15ec02,null))[_0x1b40('0x44')](handleError(_0x15ec02,null));};exports[_0x1b40('0x49')]=function(_0xffb55f,_0x20bd21){return db[_0x1b40('0x2e')]['create'](_0xffb55f[_0x1b40('0x4a')],{})[_0x1b40('0x28')](respondWithResult(_0x20bd21,0xc9))[_0x1b40('0x44')](handleError(_0x20bd21,null));};exports[_0x1b40('0x27')]=function(_0x1a8211,_0x47e090){if(_0x1a8211[_0x1b40('0x4a')]['id']){delete _0x1a8211[_0x1b40('0x4a')]['id'];}return db[_0x1b40('0x2e')][_0x1b40('0x48')]({'where':{'id':_0x1a8211[_0x1b40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47e090,null))[_0x1b40('0x28')](saveUpdates(_0x1a8211[_0x1b40('0x4a')],null))[_0x1b40('0x28')](respondWithResult(_0x47e090,null))[_0x1b40('0x44')](handleError(_0x47e090,null));};exports[_0x1b40('0x4c')]=function(_0x5f380e,_0x49a214,_0x1664d0){var _0x5443c5=require(_0x1b40('0x4d'));var _0x4571c5=![];var _0x55661d={};if(_0x5f380e[_0x1b40('0x31')][_0x1b40('0x3e')]&&_0x5f380e['query'][_0x1b40('0x3e')]===_0x1b40('0x4e')){_0x55661d[_0x1b40('0x4e')]=_0x5f380e['params']['id'];}else{_0x55661d['id']=_0x5f380e[_0x1b40('0x4b')]['id'];}return db[_0x1b40('0x2e')][_0x1b40('0x48')]({'where':_0x55661d,'attributes':['id',_0x1b40('0x4f'),_0x1b40('0x50')],'raw':!![]})[_0x1b40('0x28')](handleEntityNotFound(_0x49a214,null))['then'](function(_0x1bd0d2){if(_0x1bd0d2){var _0x1f07a6=_0x1bd0d2[_0x1b40('0x4f')];var _0x13d7ea=util[_0x1b40('0x51')](_0x1b40('0x52'),_0x1f07a6);if(fs[_0x1b40('0x53')](_0x13d7ea)){_0x4571c5=!![];return _0x5443c5[_0x1b40('0x54')](_0x13d7ea,_0x1f07a6,config[_0x1b40('0x55')][_0x1b40('0x56')])[_0x1b40('0x28')](function(){return _0x1bd0d2;});}return _0x1bd0d2;}})[_0x1b40('0x28')](function(_0x1171a4){if(_0x1171a4){var _0x19764d=_0x1171a4[_0x1b40('0x4f')];if(!fs[_0x1b40('0x53')](_0x19764d)){throw new db['Sequelize'][(_0x1b40('0x57'))]('SquareRecording\x20not\x20found');}if(_0x1171a4[_0x1b40('0x50')]){return _0x49a214[_0x1b40('0x4c')](_0x19764d,_0x1171a4[_0x1b40('0x50')]+path[_0x1b40('0x58')](_0x19764d),function(){if(_0x4571c5){fs[_0x1b40('0x59')](_0x19764d);}});}else{return _0x49a214['download'](_0x19764d,function(_0x224087){if(_0x4571c5){fs[_0x1b40('0x59')](_0x19764d);}});}}})[_0x1b40('0x44')](function(_0x1b97e0){if(_0x1b97e0[_0x1b40('0x5a')]===_0x1b40('0x5b')){_0x49a214['status'](0x194)[_0x1b40('0x5c')]('Not\x20found');}else{return handleError(_0x49a214,null);}});};exports[_0x1b40('0x5d')]=function(_0x5bdc14,_0x1ccab9){return db['SquareRecording'][_0x1b40('0x48')]({'where':{'id':_0x5bdc14[_0x1b40('0x4b')]['id']}})[_0x1b40('0x28')](function(_0x208022){if(_[_0x1b40('0x5e')](_0x208022)){throw new ReferenceError(_0x1b40('0x5f'));}return _0x208022;})['then'](function(_0x32fc0e){var _0x900ba=_0x32fc0e['savePath'];logger[_0x1b40('0x60')](_0x1b40('0x61'),_0x900ba);if(!_[_0x1b40('0x5e')](_0x32fc0e[_0x1b40('0x4f')])&&fs['existsSync'](_0x900ba)){logger[_0x1b40('0x60')](_0x1b40('0x62')+_0x900ba+_0x1b40('0x63'));fs[_0x1b40('0x64')](_0x900ba);}_0x900ba=_0x900ba+_0x1b40('0x65');if(!_[_0x1b40('0x5e')](_0x32fc0e[_0x1b40('0x4f')])&&fs[_0x1b40('0x53')](_0x900ba)){logger['info'](_0x1b40('0x62')+_0x900ba+_0x1b40('0x63'));fs['unlinkSync'](_0x900ba);}return _0x32fc0e;})[_0x1b40('0x28')](function(_0x401a2a){if(!_0x401a2a)throw new InternalError();return _0x401a2a[_0x1b40('0x5d')]();})[_0x1b40('0x28')](function(){_0x1ccab9['status'](0xcc)[_0x1b40('0x66')]();})[_0x1b40('0x44')](handleError(_0x1ccab9,null));}; \ No newline at end of file +var _0x270a=['format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','SquareRecording','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x270a,0x7b));var _0xa270=function(_0x3a8c80,_0x11d45e){_0x3a8c80=_0x3a8c80-0x0;var _0x1c6fa9=_0x270a[_0x3a8c80];return _0x1c6fa9;};'use strict';var emlformat=require(_0xa270('0x0'));var rimraf=require(_0xa270('0x1'));var zipdir=require(_0xa270('0x2'));var jsonpatch=require(_0xa270('0x3'));var rp=require('request-promise');var moment=require(_0xa270('0x4'));var BPromise=require(_0xa270('0x5'));var Mustache=require('mustache');var util=require(_0xa270('0x6'));var path=require(_0xa270('0x7'));var sox=require(_0xa270('0x8'));var csv=require(_0xa270('0x9'));var ejs=require(_0xa270('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa270('0xb'));var squel=require(_0xa270('0xc'));var crypto=require(_0xa270('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa270('0xe'));var toCsv=require(_0xa270('0x9'));var querystring=require(_0xa270('0xf'));var Papa=require(_0xa270('0x10'));var Redis=require(_0xa270('0x11'));var authService=require(_0xa270('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa270('0x13'));var hardwareService=require(_0xa270('0x14'));var logger=require('../../config/logger')(_0xa270('0x15'));var utils=require('../../config/utils');var config=require(_0xa270('0x16'));var licenseUtil=require(_0xa270('0x17'));var db=require(_0xa270('0x18'))['db'];function respondWithStatusCode(_0x2e0a31,_0x2e6e76){_0x2e6e76=_0x2e6e76||0xcc;return function(_0x2e0be2){if(_0x2e0be2){return _0x2e0a31[_0xa270('0x19')](_0x2e6e76);}return _0x2e0a31[_0xa270('0x1a')](_0x2e6e76)['end']();};}function respondWithResult(_0x659cbc,_0x110e1f){_0x110e1f=_0x110e1f||0xc8;return function(_0x53724d){if(_0x53724d){return _0x659cbc[_0xa270('0x1a')](_0x110e1f)[_0xa270('0x1b')](_0x53724d);}};}function respondWithFilteredResult(_0x598213,_0x416975){return function(_0x346e69){if(_0x346e69){var _0x4ec681=typeof _0x416975[_0xa270('0x1c')]===_0xa270('0x1d')&&typeof _0x416975[_0xa270('0x1e')]===_0xa270('0x1d');var _0x2f99fd=_0x346e69[_0xa270('0x1f')];var _0x597610=_0x4ec681?0x0:_0x416975[_0xa270('0x1c')];var _0x3d2022=_0x4ec681?_0x346e69[_0xa270('0x1f')]:_0x416975[_0xa270('0x1c')]+_0x416975[_0xa270('0x1e')];var _0xcb1db1;if(_0x3d2022>=_0x2f99fd){_0x3d2022=_0x2f99fd;_0xcb1db1=0xc8;}else{_0xcb1db1=0xce;}_0x598213[_0xa270('0x1a')](_0xcb1db1);return _0x598213[_0xa270('0x20')](_0xa270('0x21'),_0x597610+'-'+_0x3d2022+'/'+_0x2f99fd)[_0xa270('0x1b')](_0x346e69);}return null;};}function patchUpdates(_0x5ce318){return function(_0x56ade9){try{jsonpatch[_0xa270('0x22')](_0x56ade9,_0x5ce318,!![]);}catch(_0x1c62c2){return BPromise[_0xa270('0x23')](_0x1c62c2);}return _0x56ade9[_0xa270('0x24')]();};}function saveUpdates(_0x82f18f,_0x202dc0){return function(_0x472dfd){if(_0x472dfd){return _0x472dfd[_0xa270('0x25')](_0x82f18f)[_0xa270('0x26')](function(_0x1ece26){return _0x1ece26;});}return null;};}function removeEntity(_0x3aa5d4,_0x35273a){return function(_0x594b04){if(_0x594b04){return _0x594b04['destroy']()['then'](function(){_0x3aa5d4[_0xa270('0x1a')](0xcc)[_0xa270('0x27')]();});}};}function handleEntityNotFound(_0x418f7b,_0x39ba60){return function(_0x1a87da){if(!_0x1a87da){_0x418f7b['sendStatus'](0x194);}return _0x1a87da;};}function handleError(_0x4c52ab,_0x52c09a){_0x52c09a=_0x52c09a||0x1f4;return function(_0x391da3){logger['error'](_0x391da3['stack']);if(_0x391da3[_0xa270('0x28')]){delete _0x391da3[_0xa270('0x28')];}_0x4c52ab[_0xa270('0x1a')](_0x52c09a)[_0xa270('0x29')](_0x391da3);};}exports[_0xa270('0x2a')]=function(_0x55b86e,_0x7098d5){var _0x836c8={},_0x184a71={},_0x29cf36={'count':0x0,'rows':[]};var _0x3eaeae=_['map'](db['SquareRecording'][_0xa270('0x2b')],function(_0x12a80a){return{'name':_0x12a80a[_0xa270('0x2c')],'type':_0x12a80a[_0xa270('0x2d')][_0xa270('0x2e')]};});_0x184a71[_0xa270('0x2f')]=_['map'](_0x3eaeae,_0xa270('0x28'));_0x184a71[_0xa270('0x30')]=_['keys'](_0x55b86e[_0xa270('0x30')]);_0x184a71[_0xa270('0x31')]=_[_0xa270('0x32')](_0x184a71['model'],_0x184a71[_0xa270('0x30')]);_0x836c8[_0xa270('0x33')]=_['intersection'](_0x184a71[_0xa270('0x2f')],qs['fields'](_0x55b86e[_0xa270('0x30')][_0xa270('0x34')]));_0x836c8['attributes']=_0x836c8[_0xa270('0x33')][_0xa270('0x35')]?_0x836c8[_0xa270('0x33')]:_0x184a71[_0xa270('0x2f')];if(!_0x55b86e[_0xa270('0x30')][_0xa270('0x36')](_0xa270('0x37'))){_0x836c8[_0xa270('0x1e')]=qs[_0xa270('0x1e')](_0x55b86e[_0xa270('0x30')][_0xa270('0x1e')]);_0x836c8[_0xa270('0x1c')]=qs[_0xa270('0x1c')](_0x55b86e['query'][_0xa270('0x1c')]);}_0x836c8[_0xa270('0x38')]=qs[_0xa270('0x39')](_0x55b86e[_0xa270('0x30')][_0xa270('0x39')]);_0x836c8[_0xa270('0x3a')]=qs[_0xa270('0x31')](_[_0xa270('0x3b')](_0x55b86e[_0xa270('0x30')],_0x184a71['filters']),_0x3eaeae);if(_0x55b86e[_0xa270('0x30')]['filter']){_0x836c8[_0xa270('0x3a')]=_[_0xa270('0x3c')](_0x836c8['where'],{'$or':_[_0xa270('0x3d')](_0x3eaeae,function(_0x46445a){if(_0x46445a[_0xa270('0x2d')]!==_0xa270('0x3e')){var _0x2e90d3={};_0x2e90d3[_0x46445a[_0xa270('0x28')]]={'$like':'%'+_0x55b86e[_0xa270('0x30')][_0xa270('0x3f')]+'%'};return _0x2e90d3;}})});}_0x836c8=_[_0xa270('0x3c')]({},_0x836c8,_0x55b86e['options']);var _0x5cd351={'where':_0x836c8[_0xa270('0x3a')]};return db[_0xa270('0x40')][_0xa270('0x1f')](_0x5cd351)[_0xa270('0x26')](function(_0x3e0387){_0x29cf36[_0xa270('0x1f')]=_0x3e0387;if(_0x55b86e[_0xa270('0x30')][_0xa270('0x41')]){_0x836c8[_0xa270('0x42')]=[{'all':!![]}];}return db[_0xa270('0x40')][_0xa270('0x43')](_0x836c8);})['then'](function(_0x289810){_0x29cf36[_0xa270('0x44')]=_0x289810;return _0x29cf36;})[_0xa270('0x26')](respondWithFilteredResult(_0x7098d5,_0x836c8))[_0xa270('0x45')](handleError(_0x7098d5,null));};exports[_0xa270('0x46')]=function(_0x2acc84,_0x72cd49){var _0xdd856d={'raw':!![],'where':{'id':_0x2acc84[_0xa270('0x47')]['id']}},_0x50c145={};_0x50c145['model']=_['keys'](db[_0xa270('0x40')][_0xa270('0x2b')]);_0x50c145['query']=_['keys'](_0x2acc84[_0xa270('0x30')]);_0x50c145[_0xa270('0x31')]=_['intersection'](_0x50c145[_0xa270('0x2f')],_0x50c145[_0xa270('0x30')]);_0xdd856d[_0xa270('0x33')]=_[_0xa270('0x32')](_0x50c145['model'],qs[_0xa270('0x34')](_0x2acc84[_0xa270('0x30')][_0xa270('0x34')]));_0xdd856d[_0xa270('0x33')]=_0xdd856d['attributes'][_0xa270('0x35')]?_0xdd856d[_0xa270('0x33')]:_0x50c145[_0xa270('0x2f')];if(_0x2acc84['query']['includeAll']){_0xdd856d[_0xa270('0x42')]=[{'all':!![]}];}_0xdd856d=_[_0xa270('0x3c')]({},_0xdd856d,_0x2acc84[_0xa270('0x48')]);return db['SquareRecording'][_0xa270('0x49')](_0xdd856d)[_0xa270('0x26')](handleEntityNotFound(_0x72cd49,null))[_0xa270('0x26')](respondWithResult(_0x72cd49,null))[_0xa270('0x45')](handleError(_0x72cd49,null));};exports[_0xa270('0x4a')]=function(_0x14c776,_0x2486a2){return db[_0xa270('0x40')][_0xa270('0x4a')](_0x14c776[_0xa270('0x4b')],{})[_0xa270('0x26')](respondWithResult(_0x2486a2,0xc9))[_0xa270('0x45')](handleError(_0x2486a2,null));};exports[_0xa270('0x25')]=function(_0x3546ef,_0x502857){if(_0x3546ef[_0xa270('0x4b')]['id']){delete _0x3546ef[_0xa270('0x4b')]['id'];}return db[_0xa270('0x40')]['find']({'where':{'id':_0x3546ef[_0xa270('0x47')]['id']}})[_0xa270('0x26')](handleEntityNotFound(_0x502857,null))[_0xa270('0x26')](saveUpdates(_0x3546ef[_0xa270('0x4b')],null))['then'](respondWithResult(_0x502857,null))[_0xa270('0x45')](handleError(_0x502857,null));};exports[_0xa270('0x4c')]=function(_0x52205f,_0x4fae47,_0x161cd2){var _0x3aa8a7=require(_0xa270('0x4d'));var _0x2a8ccb=![];var _0x5a324f={};if(_0x52205f[_0xa270('0x30')][_0xa270('0x2d')]&&_0x52205f[_0xa270('0x30')][_0xa270('0x2d')]===_0xa270('0x4e')){_0x5a324f[_0xa270('0x4e')]=_0x52205f[_0xa270('0x47')]['id'];}else{_0x5a324f['id']=_0x52205f['params']['id'];}return db['SquareRecording']['find']({'where':_0x5a324f,'attributes':['id',_0xa270('0x4f'),_0xa270('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x4fae47,null))[_0xa270('0x26')](function(_0xad5b15){if(_0xad5b15){var _0x2c2b6e=_0xad5b15[_0xa270('0x4f')];var _0x5df4d0=util[_0xa270('0x51')](_0xa270('0x52'),_0x2c2b6e);if(fs['existsSync'](_0x5df4d0)){_0x2a8ccb=!![];return _0x3aa8a7[_0xa270('0x53')](_0x5df4d0,_0x2c2b6e,config[_0xa270('0x54')][_0xa270('0x55')])['then'](function(){return _0xad5b15;});}return _0xad5b15;}})[_0xa270('0x26')](function(_0x2aea68){if(_0x2aea68){var _0x2f0ac2=_0x2aea68[_0xa270('0x4f')];if(!fs[_0xa270('0x56')](_0x2f0ac2)){throw new db[(_0xa270('0x57'))][(_0xa270('0x58'))](_0xa270('0x59'));}if(_0x2aea68['filename']){return _0x4fae47[_0xa270('0x4c')](_0x2f0ac2,_0x2aea68['filename']+path[_0xa270('0x5a')](_0x2f0ac2),function(){if(_0x2a8ccb){fs[_0xa270('0x5b')](_0x2f0ac2);}});}else{return _0x4fae47[_0xa270('0x4c')](_0x2f0ac2,function(_0x4c4fe3){if(_0x2a8ccb){fs[_0xa270('0x5b')](_0x2f0ac2);}});}}})[_0xa270('0x45')](function(_0x5b882e){if(_0x5b882e[_0xa270('0x5c')]===_0xa270('0x59')){_0x4fae47[_0xa270('0x1a')](0x194)['send'](_0xa270('0x5d'));}else{return handleError(_0x4fae47,null);}});};exports[_0xa270('0x5e')]=function(_0x51fc7c,_0x5b2b2a){return db[_0xa270('0x40')][_0xa270('0x49')]({'where':{'id':_0x51fc7c[_0xa270('0x47')]['id']}})[_0xa270('0x26')](function(_0x2a8dcf){if(_[_0xa270('0x5f')](_0x2a8dcf)){throw new ReferenceError(_0xa270('0x60'));}return _0x2a8dcf;})[_0xa270('0x26')](function(_0x32d2b4){var _0x3cc4de=_0x32d2b4['savePath'];logger['info'](_0xa270('0x61'),_0x3cc4de);if(!_[_0xa270('0x5f')](_0x32d2b4[_0xa270('0x4f')])&&fs[_0xa270('0x56')](_0x3cc4de)){logger[_0xa270('0x62')](_0xa270('0x63')+_0x3cc4de+_0xa270('0x64'));fs['unlinkSync'](_0x3cc4de);}_0x3cc4de=_0x3cc4de+_0xa270('0x65');if(!_[_0xa270('0x5f')](_0x32d2b4['savePath'])&&fs[_0xa270('0x56')](_0x3cc4de)){logger[_0xa270('0x62')](_0xa270('0x63')+_0x3cc4de+_0xa270('0x64'));fs['unlinkSync'](_0x3cc4de);}return _0x32d2b4;})[_0xa270('0x26')](function(_0x36003b){if(!_0x36003b)throw new InternalError();return _0x36003b[_0xa270('0x5e')]();})[_0xa270('0x26')](function(){_0x5b2b2a[_0xa270('0x1a')](0xcc)[_0xa270('0x27')]();})['catch'](handleError(_0x5b2b2a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 06079b7..6560488 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 _0x9d56=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x162ca3,_0x3dc50a){var _0x524759=function(_0x33d9ca){while(--_0x33d9ca){_0x162ca3['push'](_0x162ca3['shift']());}};_0x524759(++_0x3dc50a);}(_0x9d56,0x122));var _0x69d5=function(_0x41fd76,_0x287db4){_0x41fd76=_0x41fd76-0x0;var _0x2c05e9=_0x9d56[_0x41fd76];return _0x2c05e9;};'use strict';var _=require(_0x69d5('0x0'));var util=require(_0x69d5('0x1'));var logger=require(_0x69d5('0x2'))(_0x69d5('0x3'));var moment=require('moment');var BPromise=require(_0x69d5('0x4'));var rp=require(_0x69d5('0x5'));var fs=require('fs');var path=require(_0x69d5('0x6'));var rimraf=require(_0x69d5('0x7'));var config=require(_0x69d5('0x8'));var attributes=require('./squareRecording.attributes');module[_0x69d5('0x9')]=function(_0x22cd04,_0x1d3b8b){return _0x22cd04[_0x69d5('0xa')](_0x69d5('0xb'),attributes,{'tableName':_0x69d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x556a99,_0x3d0574){_0x556a99=_0x556a99-0x0;var _0x45a65a=_0xfdbd[_0x556a99];return _0x45a65a;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('SquareRecording',attributes,{'tableName':'square_recordings','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 adf64d8..dcc15dd 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 _0x5a02=['CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5a02,0x1b5));var _0x25a0=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x5a02[_0x296897];return _0x2b44ab;};'use strict';var _=require(_0x25a0('0x0'));var util=require(_0x25a0('0x1'));var moment=require(_0x25a0('0x2'));var BPromise=require(_0x25a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25a0('0x4'));var db=require(_0x25a0('0x5'))['db'];var utils=require(_0x25a0('0x6'));var logger=require(_0x25a0('0x7'))(_0x25a0('0x8'));var config=require(_0x25a0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x25a0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b554,_0x3b1c0e,_0x55ba5c){return new BPromise(function(_0x1e9761,_0x21a617){return client['request'](_0x33b554,_0x55ba5c)['then'](function(_0x2124c7){logger['info'](_0x25a0('0xb'),_0x3b1c0e,_0x25a0('0xc'));logger[_0x25a0('0xd')](_0x25a0('0xe'),_0x3b1c0e,_0x25a0('0xc'),JSON[_0x25a0('0xf')](_0x2124c7));if(_0x2124c7[_0x25a0('0x10')]){if(_0x2124c7[_0x25a0('0x10')][_0x25a0('0x11')]===0x1f4){logger[_0x25a0('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3b1c0e,_0x2124c7['error'][_0x25a0('0x12')]);return _0x21a617(_0x2124c7['error'][_0x25a0('0x12')]);}logger[_0x25a0('0x10')](_0x25a0('0xb'),_0x3b1c0e,_0x2124c7[_0x25a0('0x10')][_0x25a0('0x12')]);return _0x1e9761(_0x2124c7[_0x25a0('0x10')]['message']);}else{logger[_0x25a0('0x13')](_0x25a0('0xb'),_0x3b1c0e,_0x25a0('0xc'));_0x1e9761(_0x2124c7[_0x25a0('0x14')]['message']);}})[_0x25a0('0x15')](function(_0x5ecfa5){logger[_0x25a0('0x10')](_0x25a0('0xb'),_0x3b1c0e,_0x5ecfa5);_0x21a617(_0x5ecfa5);});});}exports[_0x25a0('0x16')]=function(_0x592b7e){var _0x31ebcd=this;return new Promise(function(_0x2c6a8e,_0x12571d){return db[_0x25a0('0x17')][_0x25a0('0x18')](_0x592b7e['body'],{'raw':_0x592b7e[_0x25a0('0x19')]?_0x592b7e[_0x25a0('0x19')][_0x25a0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1777d1){logger[_0x25a0('0x13')](_0x25a0('0x16'),_0x592b7e);logger[_0x25a0('0xd')](_0x25a0('0x16'),_0x592b7e,JSON[_0x25a0('0xf')](_0x1777d1));_0x2c6a8e(_0x1777d1);})[_0x25a0('0x15')](function(_0x2c5080){logger['error']('CreateSquareRecording',_0x2c5080['message'],_0x592b7e);_0x12571d(_0x31ebcd[_0x25a0('0x10')](0x1f4,_0x2c5080[_0x25a0('0x12')]));});});}; \ No newline at end of file +var _0xed75=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','create','body','options','raw','then','CreateSquareRecording','util','bluebird','randomstring'];(function(_0x1a0032,_0x42ebc4){var _0x4e0d3c=function(_0x433cab){while(--_0x433cab){_0x1a0032['push'](_0x1a0032['shift']());}};_0x4e0d3c(++_0x42ebc4);}(_0xed75,0x183));var _0x5ed7=function(_0x10743f,_0x5b85a6){_0x10743f=_0x10743f-0x0;var _0x680082=_0xed75[_0x10743f];return _0x680082;};'use strict';var _=require('lodash');var util=require(_0x5ed7('0x0'));var moment=require('moment');var BPromise=require(_0x5ed7('0x1'));var rs=require(_0x5ed7('0x2'));var fs=require('fs');var Redis=require(_0x5ed7('0x3'));var db=require(_0x5ed7('0x4'))['db'];var utils=require(_0x5ed7('0x5'));var logger=require(_0x5ed7('0x6'))(_0x5ed7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5ed7('0x8')][_0x5ed7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c73cf,_0x5ecaa7,_0x4827f0){return new BPromise(function(_0x318695,_0xfddff1){return client['request'](_0x5c73cf,_0x4827f0)['then'](function(_0x40cf67){logger['info'](_0x5ed7('0xa'),_0x5ecaa7,_0x5ed7('0xb'));logger[_0x5ed7('0xc')](_0x5ed7('0xd'),_0x5ecaa7,_0x5ed7('0xb'),JSON[_0x5ed7('0xe')](_0x40cf67));if(_0x40cf67[_0x5ed7('0xf')]){if(_0x40cf67[_0x5ed7('0xf')][_0x5ed7('0x10')]===0x1f4){logger[_0x5ed7('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5ecaa7,_0x40cf67[_0x5ed7('0xf')][_0x5ed7('0x11')]);return _0xfddff1(_0x40cf67[_0x5ed7('0xf')][_0x5ed7('0x11')]);}logger['error'](_0x5ed7('0xa'),_0x5ecaa7,_0x40cf67[_0x5ed7('0xf')][_0x5ed7('0x11')]);return _0x318695(_0x40cf67[_0x5ed7('0xf')]['message']);}else{logger[_0x5ed7('0x12')]('SquareRecording,\x20%s,\x20%s',_0x5ecaa7,_0x5ed7('0xb'));_0x318695(_0x40cf67['result']['message']);}})[_0x5ed7('0x13')](function(_0x2d08b7){logger[_0x5ed7('0xf')](_0x5ed7('0xa'),_0x5ecaa7,_0x2d08b7);_0xfddff1(_0x2d08b7);});});}exports['CreateSquareRecording']=function(_0x3f1e13){var _0x915e8e=this;return new Promise(function(_0x50c310,_0x4f2782){return db['SquareRecording'][_0x5ed7('0x14')](_0x3f1e13[_0x5ed7('0x15')],{'raw':_0x3f1e13[_0x5ed7('0x16')]?_0x3f1e13[_0x5ed7('0x16')][_0x5ed7('0x17')]===undefined?!![]:![]:!![]})[_0x5ed7('0x18')](function(_0x1b2e2d){logger[_0x5ed7('0x12')](_0x5ed7('0x19'),_0x3f1e13);logger[_0x5ed7('0xc')](_0x5ed7('0x19'),_0x3f1e13,JSON[_0x5ed7('0xe')](_0x1b2e2d));_0x50c310(_0x1b2e2d);})[_0x5ed7('0x13')](function(_0x145527){logger[_0x5ed7('0xf')]('CreateSquareRecording',_0x145527['message'],_0x3f1e13);_0x4f2782(_0x915e8e[_0x5ed7('0xf')](0x1f4,_0x145527[_0x5ed7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8e3f985..59ec75d 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x39d6a8,_0xc9c91a){var _0x93f3db=function(_0x953b09){while(--_0x953b09){_0x39d6a8['push'](_0x39d6a8['shift']());}};_0x93f3db(++_0xc9c91a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x4544c8,_0x5de2d7){var _0x5afe0e=function(_0x7fd16c){while(--_0x7fd16c){_0x4544c8['push'](_0x4544c8['shift']());}};_0x5afe0e(++_0x5de2d7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 98d77e6..7739b1a 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 _0xdeb3=['sequelize','STRING','DATE'];(function(_0x71ad08,_0x475f53){var _0x1f9718=function(_0x4cec75){while(--_0x4cec75){_0x71ad08['push'](_0x71ad08['shift']());}};_0x1f9718(++_0x475f53);}(_0xdeb3,0x15f));var _0x3deb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdeb3[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3deb('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3deb('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3deb('0x1')]},'language':{'type':Sequelize[_0x3deb('0x1')]},'type':{'type':Sequelize[_0x3deb('0x1')]},'uniqueid':{'type':Sequelize[_0x3deb('0x1')]},'version':{'type':Sequelize[_0x3deb('0x1')]},'callerid':{'type':Sequelize[_0x3deb('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x3deb('0x1')]},'callingani2':{'type':Sequelize[_0x3deb('0x1')]},'callington':{'type':Sequelize[_0x3deb('0x1')]},'callingtns':{'type':Sequelize[_0x3deb('0x1')]},'dnid':{'type':Sequelize[_0x3deb('0x1')]},'rdnis':{'type':Sequelize[_0x3deb('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3deb('0x1')]},'priority':{'type':Sequelize[_0x3deb('0x1')]},'enhanced':{'type':Sequelize[_0x3deb('0x1')]},'accountcode':{'type':Sequelize[_0x3deb('0x1')]},'threadid':{'type':Sequelize[_0x3deb('0x1')]},'project_name':{'type':Sequelize[_0x3deb('0x1')]},'joinAt':{'type':Sequelize[_0x3deb('0x2')]},'leaveAt':{'type':Sequelize[_0x3deb('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1072=['STRING','DATE','exports'];(function(_0xb5609f,_0x28fc3e){var _0x93a17c=function(_0x18d9e9){while(--_0x18d9e9){_0xb5609f['push'](_0xb5609f['shift']());}};_0x93a17c(++_0x28fc3e);}(_0x1072,0x182));var _0x2107=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1072[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x2107('0x0')]={'network':{'type':Sequelize[_0x2107('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2107('0x1')]},'type':{'type':Sequelize[_0x2107('0x1')]},'uniqueid':{'type':Sequelize[_0x2107('0x1')]},'version':{'type':Sequelize[_0x2107('0x1')]},'callerid':{'type':Sequelize[_0x2107('0x1')]},'calleridname':{'type':Sequelize[_0x2107('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2107('0x1')]},'dnid':{'type':Sequelize[_0x2107('0x1')]},'rdnis':{'type':Sequelize[_0x2107('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x2107('0x1')]},'priority':{'type':Sequelize[_0x2107('0x1')]},'enhanced':{'type':Sequelize[_0x2107('0x1')]},'accountcode':{'type':Sequelize[_0x2107('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x2107('0x1')]},'joinAt':{'type':Sequelize[_0x2107('0x2')]},'leaveAt':{'type':Sequelize[_0x2107('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2734b90..f704ff5 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 _0xd733=['apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','SquareReport','findAll','rows','catch','show','params','length','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range'];(function(_0x4801a0,_0x252c24){var _0x338e26=function(_0x1599c2){while(--_0x1599c2){_0x4801a0['push'](_0x4801a0['shift']());}};_0x338e26(++_0x252c24);}(_0xd733,0x15f));var _0x3d73=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xd733[_0x279d37];return _0x530173;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d73('0x0'));var zipdir=require(_0x3d73('0x1'));var jsonpatch=require(_0x3d73('0x2'));var rp=require(_0x3d73('0x3'));var moment=require(_0x3d73('0x4'));var BPromise=require(_0x3d73('0x5'));var Mustache=require(_0x3d73('0x6'));var util=require(_0x3d73('0x7'));var path=require(_0x3d73('0x8'));var sox=require(_0x3d73('0x9'));var csv=require(_0x3d73('0xa'));var ejs=require(_0x3d73('0xb'));var fs=require('fs');var fs_extra=require(_0x3d73('0xc'));var _=require('lodash');var squel=require(_0x3d73('0xd'));var crypto=require(_0x3d73('0xe'));var jsforce=require(_0x3d73('0xf'));var deskjs=require(_0x3d73('0x10'));var toCsv=require(_0x3d73('0xa'));var querystring=require(_0x3d73('0x11'));var Papa=require('papaparse');var Redis=require(_0x3d73('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3d73('0x13'));var as=require(_0x3d73('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d73('0x15'))('api');var utils=require(_0x3d73('0x16'));var config=require(_0x3d73('0x17'));var licenseUtil=require(_0x3d73('0x18'));var db=require(_0x3d73('0x19'))['db'];function respondWithStatusCode(_0x4a0221,_0x3894d5){_0x3894d5=_0x3894d5||0xcc;return function(_0x2c8980){if(_0x2c8980){return _0x4a0221[_0x3d73('0x1a')](_0x3894d5);}return _0x4a0221['status'](_0x3894d5)['end']();};}function respondWithResult(_0xa2715,_0x30d130){_0x30d130=_0x30d130||0xc8;return function(_0x183adc){if(_0x183adc){return _0xa2715['status'](_0x30d130)[_0x3d73('0x1b')](_0x183adc);}};}function respondWithFilteredResult(_0x3875b1,_0x741953){return function(_0x494136){if(_0x494136){var _0x337ce9=typeof _0x741953[_0x3d73('0x1c')]===_0x3d73('0x1d')&&typeof _0x741953[_0x3d73('0x1e')]===_0x3d73('0x1d');var _0x3cd76f=_0x494136[_0x3d73('0x1f')];var _0xcc8389=_0x337ce9?0x0:_0x741953[_0x3d73('0x1c')];var _0x14fb95=_0x337ce9?_0x494136[_0x3d73('0x1f')]:_0x741953[_0x3d73('0x1c')]+_0x741953[_0x3d73('0x1e')];var _0x4c4f1c;if(_0x14fb95>=_0x3cd76f){_0x14fb95=_0x3cd76f;_0x4c4f1c=0xc8;}else{_0x4c4f1c=0xce;}_0x3875b1[_0x3d73('0x20')](_0x4c4f1c);return _0x3875b1['set'](_0x3d73('0x21'),_0xcc8389+'-'+_0x14fb95+'/'+_0x3cd76f)['json'](_0x494136);}return null;};}function patchUpdates(_0x210c19){return function(_0x363374){try{jsonpatch[_0x3d73('0x22')](_0x363374,_0x210c19,!![]);}catch(_0xadb889){return BPromise[_0x3d73('0x23')](_0xadb889);}return _0x363374['save']();};}function saveUpdates(_0x352b25,_0xca6af4){return function(_0xbada72){if(_0xbada72){return _0xbada72[_0x3d73('0x24')](_0x352b25)[_0x3d73('0x25')](function(_0x42c116){return _0x42c116;});}return null;};}function removeEntity(_0x3a711e,_0x15b0ad){return function(_0x10b8eb){if(_0x10b8eb){return _0x10b8eb[_0x3d73('0x26')]()[_0x3d73('0x25')](function(){_0x3a711e[_0x3d73('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd12afd,_0x5cf923){return function(_0x2aad7f){if(!_0x2aad7f){_0xd12afd['sendStatus'](0x194);}return _0x2aad7f;};}function handleError(_0x44d78e,_0x459980){_0x459980=_0x459980||0x1f4;return function(_0x50245d){logger[_0x3d73('0x27')](_0x50245d[_0x3d73('0x28')]);if(_0x50245d[_0x3d73('0x29')]){delete _0x50245d[_0x3d73('0x29')];}_0x44d78e[_0x3d73('0x20')](_0x459980)[_0x3d73('0x2a')](_0x50245d);};}exports[_0x3d73('0x2b')]=function(_0x2bbb5a,_0x273788){var _0x1c84dd={},_0xa35350={},_0x158812={'count':0x0,'rows':[]};var _0x49f6d2=_[_0x3d73('0x2c')](db['SquareReport'][_0x3d73('0x2d')],function(_0x4141a4){return{'name':_0x4141a4[_0x3d73('0x2e')],'type':_0x4141a4[_0x3d73('0x2f')][_0x3d73('0x30')]};});_0xa35350['model']=_[_0x3d73('0x2c')](_0x49f6d2,_0x3d73('0x29'));_0xa35350[_0x3d73('0x31')]=_[_0x3d73('0x32')](_0x2bbb5a['query']);_0xa35350['filters']=_[_0x3d73('0x33')](_0xa35350[_0x3d73('0x34')],_0xa35350['query']);_0x1c84dd[_0x3d73('0x35')]=_[_0x3d73('0x33')](_0xa35350['model'],qs[_0x3d73('0x36')](_0x2bbb5a['query']['fields']));_0x1c84dd[_0x3d73('0x35')]=_0x1c84dd['attributes']['length']?_0x1c84dd['attributes']:_0xa35350['model'];if(!_0x2bbb5a[_0x3d73('0x31')]['hasOwnProperty'](_0x3d73('0x37'))){_0x1c84dd['limit']=qs['limit'](_0x2bbb5a[_0x3d73('0x31')][_0x3d73('0x1e')]);_0x1c84dd[_0x3d73('0x1c')]=qs[_0x3d73('0x1c')](_0x2bbb5a['query']['offset']);}_0x1c84dd[_0x3d73('0x38')]=qs[_0x3d73('0x39')](_0x2bbb5a['query']['sort']);_0x1c84dd[_0x3d73('0x3a')]=qs[_0x3d73('0x3b')](_['pick'](_0x2bbb5a[_0x3d73('0x31')],_0xa35350[_0x3d73('0x3b')]),_0x49f6d2);if(_0x2bbb5a[_0x3d73('0x31')][_0x3d73('0x3c')]){_0x1c84dd['where']=_['merge'](_0x1c84dd['where'],{'$or':_[_0x3d73('0x2c')](_0x49f6d2,function(_0x5203ba){if(_0x5203ba[_0x3d73('0x2f')]!==_0x3d73('0x3d')){var _0x53a7bc={};_0x53a7bc[_0x5203ba[_0x3d73('0x29')]]={'$like':'%'+_0x2bbb5a[_0x3d73('0x31')][_0x3d73('0x3c')]+'%'};return _0x53a7bc;}})});}_0x1c84dd=_[_0x3d73('0x3e')]({},_0x1c84dd,_0x2bbb5a[_0x3d73('0x3f')]);var _0x4c203e={'where':_0x1c84dd['where']};return db['SquareReport'][_0x3d73('0x1f')](_0x4c203e)['then'](function(_0x2e117f){_0x158812[_0x3d73('0x1f')]=_0x2e117f;if(_0x2bbb5a[_0x3d73('0x31')]['includeAll']){_0x1c84dd[_0x3d73('0x40')]=[{'all':!![]}];}return db[_0x3d73('0x41')][_0x3d73('0x42')](_0x1c84dd);})[_0x3d73('0x25')](function(_0x1e5bf4){_0x158812[_0x3d73('0x43')]=_0x1e5bf4;return _0x158812;})[_0x3d73('0x25')](respondWithFilteredResult(_0x273788,_0x1c84dd))[_0x3d73('0x44')](handleError(_0x273788,null));};exports[_0x3d73('0x45')]=function(_0x4221be,_0x5ef31a){var _0x3b9f75={'raw':!![],'where':{'id':_0x4221be[_0x3d73('0x46')]['id']}},_0x3accb2={};_0x3accb2['model']=_[_0x3d73('0x32')](db[_0x3d73('0x41')]['rawAttributes']);_0x3accb2[_0x3d73('0x31')]=_[_0x3d73('0x32')](_0x4221be[_0x3d73('0x31')]);_0x3accb2[_0x3d73('0x3b')]=_[_0x3d73('0x33')](_0x3accb2['model'],_0x3accb2[_0x3d73('0x31')]);_0x3b9f75[_0x3d73('0x35')]=_[_0x3d73('0x33')](_0x3accb2[_0x3d73('0x34')],qs[_0x3d73('0x36')](_0x4221be[_0x3d73('0x31')][_0x3d73('0x36')]));_0x3b9f75[_0x3d73('0x35')]=_0x3b9f75['attributes'][_0x3d73('0x47')]?_0x3b9f75['attributes']:_0x3accb2[_0x3d73('0x34')];if(_0x4221be[_0x3d73('0x31')][_0x3d73('0x48')]){_0x3b9f75[_0x3d73('0x40')]=[{'all':!![]}];}_0x3b9f75=_['merge']({},_0x3b9f75,_0x4221be[_0x3d73('0x3f')]);return db['SquareReport']['find'](_0x3b9f75)[_0x3d73('0x25')](handleEntityNotFound(_0x5ef31a,null))[_0x3d73('0x25')](respondWithResult(_0x5ef31a,null))[_0x3d73('0x44')](handleError(_0x5ef31a,null));};exports[_0x3d73('0x49')]=function(_0x5ef05c,_0x2dc329){return db[_0x3d73('0x41')][_0x3d73('0x49')](_0x5ef05c['body'],{})[_0x3d73('0x25')](respondWithResult(_0x2dc329,0xc9))[_0x3d73('0x44')](handleError(_0x2dc329,null));};exports[_0x3d73('0x24')]=function(_0x108b46,_0x788267){if(_0x108b46[_0x3d73('0x4a')]['id']){delete _0x108b46[_0x3d73('0x4a')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x108b46[_0x3d73('0x46')]['id']}})[_0x3d73('0x25')](handleEntityNotFound(_0x788267,null))['then'](saveUpdates(_0x108b46['body'],null))[_0x3d73('0x25')](respondWithResult(_0x788267,null))['catch'](handleError(_0x788267,null));};exports[_0x3d73('0x26')]=function(_0x37bb0d,_0x3f5458){return db[_0x3d73('0x41')][_0x3d73('0x4b')]({'where':{'id':_0x37bb0d[_0x3d73('0x46')]['id']}})[_0x3d73('0x25')](handleEntityNotFound(_0x3f5458,null))[_0x3d73('0x25')](removeEntity(_0x3f5458,null))['catch'](handleError(_0x3f5458,null));};exports['describe']=function(_0x4a9c2d,_0x50973c){return db[_0x3d73('0x41')][_0x3d73('0x4c')]()[_0x3d73('0x25')](respondWithResult(_0x50973c,null))[_0x3d73('0x44')](handleError(_0x50973c,null));}; \ No newline at end of file +var _0x2e18=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','show','params','keys','intersection','include','options','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce'];(function(_0x3007d8,_0x19454b){var _0x5ad0ff=function(_0x21c9fd){while(--_0x21c9fd){_0x3007d8['push'](_0x3007d8['shift']());}};_0x5ad0ff(++_0x19454b);}(_0x2e18,0x126));var _0x82e1=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x2e18[_0xfa634c];return _0x73e478;};'use strict';var emlformat=require(_0x82e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82e1('0x1'));var jsonpatch=require(_0x82e1('0x2'));var rp=require(_0x82e1('0x3'));var moment=require(_0x82e1('0x4'));var BPromise=require(_0x82e1('0x5'));var Mustache=require(_0x82e1('0x6'));var util=require(_0x82e1('0x7'));var path=require(_0x82e1('0x8'));var sox=require(_0x82e1('0x9'));var csv=require(_0x82e1('0xa'));var ejs=require(_0x82e1('0xb'));var fs=require('fs');var fs_extra=require(_0x82e1('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x82e1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x82e1('0xa'));var querystring=require(_0x82e1('0xe'));var Papa=require(_0x82e1('0xf'));var Redis=require(_0x82e1('0x10'));var authService=require(_0x82e1('0x11'));var qs=require(_0x82e1('0x12'));var as=require(_0x82e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82e1('0x14'))(_0x82e1('0x15'));var utils=require(_0x82e1('0x16'));var config=require(_0x82e1('0x17'));var licenseUtil=require(_0x82e1('0x18'));var db=require(_0x82e1('0x19'))['db'];function respondWithStatusCode(_0x2f4ce4,_0x1b9780){_0x1b9780=_0x1b9780||0xcc;return function(_0x17ee89){if(_0x17ee89){return _0x2f4ce4[_0x82e1('0x1a')](_0x1b9780);}return _0x2f4ce4[_0x82e1('0x1b')](_0x1b9780)[_0x82e1('0x1c')]();};}function respondWithResult(_0x1c66e8,_0xb3a4e6){_0xb3a4e6=_0xb3a4e6||0xc8;return function(_0x74ff3f){if(_0x74ff3f){return _0x1c66e8[_0x82e1('0x1b')](_0xb3a4e6)[_0x82e1('0x1d')](_0x74ff3f);}};}function respondWithFilteredResult(_0x799434,_0x569540){return function(_0x5ba512){if(_0x5ba512){var _0x3f3c54=typeof _0x569540[_0x82e1('0x1e')]==='undefined'&&typeof _0x569540['limit']===_0x82e1('0x1f');var _0xc9aeca=_0x5ba512[_0x82e1('0x20')];var _0x11af5c=_0x3f3c54?0x0:_0x569540[_0x82e1('0x1e')];var _0x5bd61b=_0x3f3c54?_0x5ba512[_0x82e1('0x20')]:_0x569540['offset']+_0x569540[_0x82e1('0x21')];var _0x432400;if(_0x5bd61b>=_0xc9aeca){_0x5bd61b=_0xc9aeca;_0x432400=0xc8;}else{_0x432400=0xce;}_0x799434['status'](_0x432400);return _0x799434['set'](_0x82e1('0x22'),_0x11af5c+'-'+_0x5bd61b+'/'+_0xc9aeca)['json'](_0x5ba512);}return null;};}function patchUpdates(_0x31e7b5){return function(_0x24e54e){try{jsonpatch['apply'](_0x24e54e,_0x31e7b5,!![]);}catch(_0x370fda){return BPromise[_0x82e1('0x23')](_0x370fda);}return _0x24e54e[_0x82e1('0x24')]();};}function saveUpdates(_0x3e66f7,_0x2dd317){return function(_0x416f89){if(_0x416f89){return _0x416f89[_0x82e1('0x25')](_0x3e66f7)[_0x82e1('0x26')](function(_0x2bb90a){return _0x2bb90a;});}return null;};}function removeEntity(_0x228659,_0x4f4418){return function(_0x4783b2){if(_0x4783b2){return _0x4783b2['destroy']()[_0x82e1('0x26')](function(){_0x228659[_0x82e1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10d266,_0x379aa1){return function(_0x2a9d32){if(!_0x2a9d32){_0x10d266['sendStatus'](0x194);}return _0x2a9d32;};}function handleError(_0x1a1d53,_0x38a3b8){_0x38a3b8=_0x38a3b8||0x1f4;return function(_0x5a4c1f){logger[_0x82e1('0x27')](_0x5a4c1f[_0x82e1('0x28')]);if(_0x5a4c1f[_0x82e1('0x29')]){delete _0x5a4c1f[_0x82e1('0x29')];}_0x1a1d53[_0x82e1('0x1b')](_0x38a3b8)[_0x82e1('0x2a')](_0x5a4c1f);};}exports[_0x82e1('0x2b')]=function(_0x4d9e3a,_0x30e574){var _0x174316={},_0x12186c={},_0x216b9d={'count':0x0,'rows':[]};var _0x1bedab=_[_0x82e1('0x2c')](db[_0x82e1('0x2d')][_0x82e1('0x2e')],function(_0x5516c8){return{'name':_0x5516c8[_0x82e1('0x2f')],'type':_0x5516c8['type'][_0x82e1('0x30')]};});_0x12186c['model']=_[_0x82e1('0x2c')](_0x1bedab,_0x82e1('0x29'));_0x12186c[_0x82e1('0x31')]=_['keys'](_0x4d9e3a[_0x82e1('0x31')]);_0x12186c[_0x82e1('0x32')]=_['intersection'](_0x12186c[_0x82e1('0x33')],_0x12186c[_0x82e1('0x31')]);_0x174316[_0x82e1('0x34')]=_['intersection'](_0x12186c['model'],qs[_0x82e1('0x35')](_0x4d9e3a[_0x82e1('0x31')][_0x82e1('0x35')]));_0x174316[_0x82e1('0x34')]=_0x174316[_0x82e1('0x34')][_0x82e1('0x36')]?_0x174316[_0x82e1('0x34')]:_0x12186c['model'];if(!_0x4d9e3a[_0x82e1('0x31')][_0x82e1('0x37')]('nolimit')){_0x174316[_0x82e1('0x21')]=qs[_0x82e1('0x21')](_0x4d9e3a[_0x82e1('0x31')]['limit']);_0x174316[_0x82e1('0x1e')]=qs[_0x82e1('0x1e')](_0x4d9e3a[_0x82e1('0x31')][_0x82e1('0x1e')]);}_0x174316['order']=qs[_0x82e1('0x38')](_0x4d9e3a[_0x82e1('0x31')][_0x82e1('0x38')]);_0x174316[_0x82e1('0x39')]=qs[_0x82e1('0x32')](_[_0x82e1('0x3a')](_0x4d9e3a[_0x82e1('0x31')],_0x12186c[_0x82e1('0x32')]),_0x1bedab);if(_0x4d9e3a[_0x82e1('0x31')][_0x82e1('0x3b')]){_0x174316[_0x82e1('0x39')]=_[_0x82e1('0x3c')](_0x174316['where'],{'$or':_[_0x82e1('0x2c')](_0x1bedab,function(_0x43aa23){if(_0x43aa23[_0x82e1('0x3d')]!==_0x82e1('0x3e')){var _0x2d9498={};_0x2d9498[_0x43aa23[_0x82e1('0x29')]]={'$like':'%'+_0x4d9e3a[_0x82e1('0x31')][_0x82e1('0x3b')]+'%'};return _0x2d9498;}})});}_0x174316=_['merge']({},_0x174316,_0x4d9e3a['options']);var _0x2a6804={'where':_0x174316[_0x82e1('0x39')]};return db[_0x82e1('0x2d')][_0x82e1('0x20')](_0x2a6804)['then'](function(_0x1d69a2){_0x216b9d['count']=_0x1d69a2;if(_0x4d9e3a[_0x82e1('0x31')][_0x82e1('0x3f')]){_0x174316['include']=[{'all':!![]}];}return db[_0x82e1('0x2d')]['findAll'](_0x174316);})[_0x82e1('0x26')](function(_0x148721){_0x216b9d[_0x82e1('0x40')]=_0x148721;return _0x216b9d;})['then'](respondWithFilteredResult(_0x30e574,_0x174316))['catch'](handleError(_0x30e574,null));};exports[_0x82e1('0x41')]=function(_0x3f1e91,_0x15590b){var _0xf3e13={'raw':!![],'where':{'id':_0x3f1e91[_0x82e1('0x42')]['id']}},_0xbb192f={};_0xbb192f[_0x82e1('0x33')]=_[_0x82e1('0x43')](db[_0x82e1('0x2d')]['rawAttributes']);_0xbb192f[_0x82e1('0x31')]=_[_0x82e1('0x43')](_0x3f1e91[_0x82e1('0x31')]);_0xbb192f[_0x82e1('0x32')]=_[_0x82e1('0x44')](_0xbb192f[_0x82e1('0x33')],_0xbb192f[_0x82e1('0x31')]);_0xf3e13[_0x82e1('0x34')]=_[_0x82e1('0x44')](_0xbb192f['model'],qs[_0x82e1('0x35')](_0x3f1e91[_0x82e1('0x31')][_0x82e1('0x35')]));_0xf3e13['attributes']=_0xf3e13[_0x82e1('0x34')][_0x82e1('0x36')]?_0xf3e13[_0x82e1('0x34')]:_0xbb192f[_0x82e1('0x33')];if(_0x3f1e91[_0x82e1('0x31')]['includeAll']){_0xf3e13[_0x82e1('0x45')]=[{'all':!![]}];}_0xf3e13=_[_0x82e1('0x3c')]({},_0xf3e13,_0x3f1e91[_0x82e1('0x46')]);return db[_0x82e1('0x2d')][_0x82e1('0x47')](_0xf3e13)['then'](handleEntityNotFound(_0x15590b,null))[_0x82e1('0x26')](respondWithResult(_0x15590b,null))[_0x82e1('0x48')](handleError(_0x15590b,null));};exports[_0x82e1('0x49')]=function(_0x22fe1c,_0xdbe13f){return db[_0x82e1('0x2d')]['create'](_0x22fe1c['body'],{})[_0x82e1('0x26')](respondWithResult(_0xdbe13f,0xc9))[_0x82e1('0x48')](handleError(_0xdbe13f,null));};exports[_0x82e1('0x25')]=function(_0xb9a611,_0x733ebd){if(_0xb9a611[_0x82e1('0x4a')]['id']){delete _0xb9a611[_0x82e1('0x4a')]['id'];}return db[_0x82e1('0x2d')][_0x82e1('0x47')]({'where':{'id':_0xb9a611[_0x82e1('0x42')]['id']}})[_0x82e1('0x26')](handleEntityNotFound(_0x733ebd,null))['then'](saveUpdates(_0xb9a611[_0x82e1('0x4a')],null))[_0x82e1('0x26')](respondWithResult(_0x733ebd,null))[_0x82e1('0x48')](handleError(_0x733ebd,null));};exports[_0x82e1('0x4b')]=function(_0x18c8cf,_0x5f3292){return db[_0x82e1('0x2d')][_0x82e1('0x47')]({'where':{'id':_0x18c8cf['params']['id']}})[_0x82e1('0x26')](handleEntityNotFound(_0x5f3292,null))[_0x82e1('0x26')](removeEntity(_0x5f3292,null))['catch'](handleError(_0x5f3292,null));};exports[_0x82e1('0x4c')]=function(_0x43815b,_0x3c4691){return db['SquareReport']['describe']()[_0x82e1('0x26')](respondWithResult(_0x3c4691,null))[_0x82e1('0x48')](handleError(_0x3c4691,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 28de61c..28a1c63 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 _0x1723=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x1723,0x84));var _0x3172=function(_0x5a4682,_0x221344){_0x5a4682=_0x5a4682-0x0;var _0x1d7bbc=_0x1723[_0x5a4682];return _0x1d7bbc;};'use strict';var _=require(_0x3172('0x0'));var util=require(_0x3172('0x1'));var logger=require('../../config/logger')(_0x3172('0x2'));var moment=require(_0x3172('0x3'));var BPromise=require(_0x3172('0x4'));var rp=require(_0x3172('0x5'));var fs=require('fs');var path=require(_0x3172('0x6'));var rimraf=require(_0x3172('0x7'));var config=require(_0x3172('0x8'));var attributes=require(_0x3172('0x9'));module[_0x3172('0xa')]=function(_0x29772b,_0x4ec5b2){return _0x29772b[_0x3172('0xb')](_0x3172('0xc'),attributes,{'tableName':_0x3172('0xd'),'paranoid':![],'indexes':[{'name':_0x3172('0xe'),'fields':[_0x3172('0xf'),_0x3172('0x10')]},{'name':_0x3172('0x11'),'fields':[_0x3172('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dad=['uid_pname','project_name','leaveAt','lodash','util','../../config/logger','moment','path','rimraf','./squareReport.attributes','exports','SquareReport','report_square'];(function(_0x17b47d,_0x3136fb){var _0x3c643e=function(_0x5e029a){while(--_0x5e029a){_0x17b47d['push'](_0x17b47d['shift']());}};_0x3c643e(++_0x3136fb);}(_0x2dad,0x148));var _0xd2da=function(_0x30af30,_0x1968e4){_0x30af30=_0x30af30-0x0;var _0x2e5b95=_0x2dad[_0x30af30];return _0x2e5b95;};'use strict';var _=require(_0xd2da('0x0'));var util=require(_0xd2da('0x1'));var logger=require(_0xd2da('0x2'))('api');var moment=require(_0xd2da('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2da('0x4'));var rimraf=require(_0xd2da('0x5'));var config=require('../../config/environment');var attributes=require(_0xd2da('0x6'));module[_0xd2da('0x7')]=function(_0x115bf4,_0x4daec9){return _0x115bf4['define'](_0xd2da('0x8'),attributes,{'tableName':_0xd2da('0x9'),'paranoid':![],'indexes':[{'name':_0xd2da('0xa'),'fields':['uniqueid',_0xd2da('0xb')]},{'name':_0xd2da('0xc'),'fields':[_0xd2da('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8a60391..0049c33 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 _0xf60b=['error','code','message','catch','CreateSquareReport','create','body','options','debug','UpdateSquareReport','update','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b17f0,_0x45fbe0){var _0x4264b9=function(_0x1705e9){while(--_0x1705e9){_0x2b17f0['push'](_0x2b17f0['shift']());}};_0x4264b9(++_0x45fbe0);}(_0xf60b,0x1bf));var _0xbf60=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0xf60b[_0x50e0b4];return _0x2fa8b0;};'use strict';var _=require(_0xbf60('0x0'));var util=require(_0xbf60('0x1'));var moment=require(_0xbf60('0x2'));var BPromise=require(_0xbf60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf60('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf60('0x5'));var logger=require(_0xbf60('0x6'))(_0xbf60('0x7'));var config=require(_0xbf60('0x8'));var jayson=require(_0xbf60('0x9'));var client=jayson['client'][_0xbf60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ca46d,_0x37a091,_0x29b604){return new BPromise(function(_0x3f1b32,_0x43fa7f){return client['request'](_0x1ca46d,_0x29b604)[_0xbf60('0xb')](function(_0x4fac75){logger[_0xbf60('0xc')](_0xbf60('0xd'),_0x37a091,_0xbf60('0xe'));logger['debug'](_0xbf60('0xf'),_0x37a091,_0xbf60('0xe'),JSON[_0xbf60('0x10')](_0x4fac75));if(_0x4fac75[_0xbf60('0x11')]){if(_0x4fac75[_0xbf60('0x11')][_0xbf60('0x12')]===0x1f4){logger[_0xbf60('0x11')](_0xbf60('0xd'),_0x37a091,_0x4fac75[_0xbf60('0x11')][_0xbf60('0x13')]);return _0x43fa7f(_0x4fac75[_0xbf60('0x11')][_0xbf60('0x13')]);}logger[_0xbf60('0x11')]('SquareReport,\x20%s,\x20%s',_0x37a091,_0x4fac75[_0xbf60('0x11')][_0xbf60('0x13')]);return _0x3f1b32(_0x4fac75[_0xbf60('0x11')]['message']);}else{logger['info'](_0xbf60('0xd'),_0x37a091,'request\x20sent');_0x3f1b32(_0x4fac75['result'][_0xbf60('0x13')]);}})[_0xbf60('0x14')](function(_0x186192){logger['error'](_0xbf60('0xd'),_0x37a091,_0x186192);_0x43fa7f(_0x186192);});});}exports[_0xbf60('0x15')]=function(_0x4bec20){var _0x370e0d=this;return new Promise(function(_0x2e89fa,_0x5bbc5d){return db['SquareReport'][_0xbf60('0x16')](_0x4bec20[_0xbf60('0x17')],{'raw':_0x4bec20[_0xbf60('0x18')]?_0x4bec20[_0xbf60('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbf60('0xb')](function(_0xedbc01){logger[_0xbf60('0xc')]('CreateSquareReport',_0x4bec20);logger[_0xbf60('0x19')]('CreateSquareReport',_0x4bec20,JSON[_0xbf60('0x10')](_0xedbc01));_0x2e89fa(_0xedbc01);})[_0xbf60('0x14')](function(_0x4255a5){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x4255a5['message'],_0x4bec20);_0x5bbc5d(_0x370e0d['error'](0x1f4,_0x4255a5[_0xbf60('0x13')]));});});};exports[_0xbf60('0x1a')]=function(_0x312ab2){var _0x536fe8=this;return new Promise(function(_0x636925,_0x2a4402){return db['SquareReport'][_0xbf60('0x1b')](_0x312ab2[_0xbf60('0x17')],{'raw':_0x312ab2[_0xbf60('0x18')]?_0x312ab2[_0xbf60('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x312ab2[_0xbf60('0x18')]?_0x312ab2[_0xbf60('0x18')]['where']||null:null,'attributes':_0x312ab2[_0xbf60('0x18')]?_0x312ab2[_0xbf60('0x18')][_0xbf60('0x1c')]||null:null,'limit':_0x312ab2[_0xbf60('0x18')]?_0x312ab2[_0xbf60('0x18')]['limit']||null:null})[_0xbf60('0xb')](function(_0x2037d7){logger[_0xbf60('0xc')](_0xbf60('0x1a'),_0x312ab2);logger[_0xbf60('0x19')](_0xbf60('0x1a'),_0x312ab2,JSON[_0xbf60('0x10')](_0x2037d7));_0x636925(_0x2037d7);})[_0xbf60('0x14')](function(_0x1b8e28){logger[_0xbf60('0x11')]('UpdateSquareReport',_0x1b8e28['message'],_0x312ab2);_0x2a4402(_0x536fe8[_0xbf60('0x11')](0x1f4,_0x1b8e28[_0xbf60('0x13')]));});});}; \ No newline at end of file +var _0xdfad=['debug','UpdateSquareReport','update','where','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','body','options','raw','info'];(function(_0x2955b6,_0x5d4a5e){var _0x5c7e88=function(_0x5f1580){while(--_0x5f1580){_0x2955b6['push'](_0x2955b6['shift']());}};_0x5c7e88(++_0x5d4a5e);}(_0xdfad,0x13c));var _0xddfa=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xdfad[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var util=require(_0xddfa('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddfa('0x1'));var fs=require('fs');var Redis=require(_0xddfa('0x2'));var db=require(_0xddfa('0x3'))['db'];var utils=require(_0xddfa('0x4'));var logger=require(_0xddfa('0x5'))(_0xddfa('0x6'));var config=require(_0xddfa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xddfa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2dbc,_0x3ebc78,_0x380d8f){return new BPromise(function(_0x347ba0,_0x554f21){return client[_0xddfa('0x9')](_0x1a2dbc,_0x380d8f)[_0xddfa('0xa')](function(_0x146d2e){logger['info'](_0xddfa('0xb'),_0x3ebc78,_0xddfa('0xc'));logger['debug'](_0xddfa('0xd'),_0x3ebc78,_0xddfa('0xc'),JSON[_0xddfa('0xe')](_0x146d2e));if(_0x146d2e[_0xddfa('0xf')]){if(_0x146d2e[_0xddfa('0xf')][_0xddfa('0x10')]===0x1f4){logger['error'](_0xddfa('0xb'),_0x3ebc78,_0x146d2e[_0xddfa('0xf')]['message']);return _0x554f21(_0x146d2e['error'][_0xddfa('0x11')]);}logger[_0xddfa('0xf')]('SquareReport,\x20%s,\x20%s',_0x3ebc78,_0x146d2e[_0xddfa('0xf')][_0xddfa('0x11')]);return _0x347ba0(_0x146d2e['error'][_0xddfa('0x11')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x3ebc78,'request\x20sent');_0x347ba0(_0x146d2e['result'][_0xddfa('0x11')]);}})[_0xddfa('0x12')](function(_0x1870e9){logger['error'](_0xddfa('0xb'),_0x3ebc78,_0x1870e9);_0x554f21(_0x1870e9);});});}exports[_0xddfa('0x13')]=function(_0x56837d){var _0x2ec661=this;return new Promise(function(_0x3984d8,_0x143383){return db[_0xddfa('0x14')]['create'](_0x56837d[_0xddfa('0x15')],{'raw':_0x56837d['options']?_0x56837d[_0xddfa('0x16')][_0xddfa('0x17')]===undefined?!![]:![]:!![]})[_0xddfa('0xa')](function(_0x4f0ac3){logger[_0xddfa('0x18')](_0xddfa('0x13'),_0x56837d);logger[_0xddfa('0x19')](_0xddfa('0x13'),_0x56837d,JSON[_0xddfa('0xe')](_0x4f0ac3));_0x3984d8(_0x4f0ac3);})[_0xddfa('0x12')](function(_0x41c1df){logger[_0xddfa('0xf')](_0xddfa('0x13'),_0x41c1df[_0xddfa('0x11')],_0x56837d);_0x143383(_0x2ec661[_0xddfa('0xf')](0x1f4,_0x41c1df[_0xddfa('0x11')]));});});};exports[_0xddfa('0x1a')]=function(_0x3da6b8){var _0x169dd1=this;return new Promise(function(_0xccb125,_0x621e66){return db[_0xddfa('0x14')][_0xddfa('0x1b')](_0x3da6b8['body'],{'raw':_0x3da6b8['options']?_0x3da6b8[_0xddfa('0x16')][_0xddfa('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3da6b8[_0xddfa('0x16')]?_0x3da6b8[_0xddfa('0x16')][_0xddfa('0x1c')]||null:null,'attributes':_0x3da6b8['options']?_0x3da6b8[_0xddfa('0x16')][_0xddfa('0x1d')]||null:null,'limit':_0x3da6b8[_0xddfa('0x16')]?_0x3da6b8['options'][_0xddfa('0x1e')]||null:null})[_0xddfa('0xa')](function(_0x3b1c99){logger[_0xddfa('0x18')](_0xddfa('0x1a'),_0x3da6b8);logger[_0xddfa('0x19')]('UpdateSquareReport',_0x3da6b8,JSON[_0xddfa('0xe')](_0x3b1c99));_0xccb125(_0x3b1c99);})[_0xddfa('0x12')](function(_0x539c0f){logger[_0xddfa('0xf')](_0xddfa('0x1a'),_0x539c0f[_0xddfa('0x11')],_0x3da6b8);_0x621e66(_0x169dd1['error'](0x1f4,_0x539c0f[_0xddfa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6d7aa1e..5f7a783 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 _0x3d27=['../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','describe','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3930db,_0x247c2c){var _0x44a348=function(_0x5b461c){while(--_0x5b461c){_0x3930db['push'](_0x3930db['shift']());}};_0x44a348(++_0x247c2c);}(_0x3d27,0xe9));var _0x73d2=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x3d27[_0x1ae491];return _0x4958a5;};'use strict';var multer=require(_0x73d2('0x0'));var util=require('util');var path=require(_0x73d2('0x1'));var timeout=require(_0x73d2('0x2'));var express=require(_0x73d2('0x3'));var router=express[_0x73d2('0x4')]();var fs_extra=require(_0x73d2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73d2('0x6'));var config=require(_0x73d2('0x7'));var controller=require(_0x73d2('0x8'));router['get']('/',auth[_0x73d2('0x9')](),controller[_0x73d2('0xa')]);router[_0x73d2('0xb')]('/describe',auth[_0x73d2('0x9')](),controller[_0x73d2('0xc')]);router[_0x73d2('0xb')](_0x73d2('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x73d2('0xe')]('/',auth['isAuthenticated'](),controller[_0x73d2('0xf')]);router['put']('/:id',auth[_0x73d2('0x9')](),controller[_0x73d2('0x10')]);router[_0x73d2('0x11')](_0x73d2('0xd'),auth[_0x73d2('0x9')](),controller[_0x73d2('0x12')]);module[_0x73d2('0x13')]=router; \ No newline at end of file +var _0xa41f=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','isAuthenticated','describe','/:id','show','post','create'];(function(_0x138e44,_0x401ed7){var _0x42f154=function(_0x56159b){while(--_0x56159b){_0x138e44['push'](_0x138e44['shift']());}};_0x42f154(++_0x401ed7);}(_0xa41f,0x1d3));var _0xfa41=function(_0x65cfb9,_0x3873a8){_0x65cfb9=_0x65cfb9-0x0;var _0x4bc146=_0xa41f[_0x65cfb9];return _0x4bc146;};'use strict';var multer=require(_0xfa41('0x0'));var util=require(_0xfa41('0x1'));var path=require('path');var timeout=require(_0xfa41('0x2'));var express=require(_0xfa41('0x3'));var router=express['Router']();var fs_extra=require(_0xfa41('0x4'));var auth=require(_0xfa41('0x5'));var interaction=require(_0xfa41('0x6'));var config=require(_0xfa41('0x7'));var controller=require(_0xfa41('0x8'));router[_0xfa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xfa41('0xa')]);router[_0xfa41('0x9')]('/describe',auth[_0xfa41('0xb')](),controller[_0xfa41('0xc')]);router[_0xfa41('0x9')](_0xfa41('0xd'),auth['isAuthenticated'](),controller[_0xfa41('0xe')]);router[_0xfa41('0xf')]('/',auth[_0xfa41('0xb')](),controller[_0xfa41('0x10')]);router[_0xfa41('0x11')](_0xfa41('0xd'),auth[_0xfa41('0xb')](),controller[_0xfa41('0x12')]);router[_0xfa41('0x13')](_0xfa41('0xd'),auth[_0xfa41('0xb')](),controller[_0xfa41('0x14')]);module[_0xfa41('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index de01a06..56bb836 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 _0xc404=['STRING','TEXT','sequelize','exports'];(function(_0xf785ae,_0x211032){var _0x2e9f79=function(_0x708ca1){while(--_0x708ca1){_0xf785ae['push'](_0xf785ae['shift']());}};_0x2e9f79(++_0x211032);}(_0xc404,0xe2));var _0x4c40=function(_0x4ce680,_0x347bec){_0x4ce680=_0x4ce680-0x0;var _0x13fa09=_0xc404[_0x4ce680];return _0x13fa09;};'use strict';var Sequelize=require(_0x4c40('0x0'));module[_0x4c40('0x1')]={'uniqueid':{'type':Sequelize[_0x4c40('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x4c40('0x2')]},'data':{'type':Sequelize[_0x4c40('0x3')]},'project_name':{'type':Sequelize[_0x4c40('0x2')]},'callerid':{'type':Sequelize[_0x4c40('0x2')]}}; \ No newline at end of file +var _0xb178=['exports','STRING','TEXT','sequelize'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xb178,0x9f));var _0x8b17=function(_0x1d453f,_0x5793a9){_0x1d453f=_0x1d453f-0x0;var _0x50996a=_0xb178[_0x1d453f];return _0x50996a;};'use strict';var Sequelize=require(_0x8b17('0x0'));module[_0x8b17('0x1')]={'uniqueid':{'type':Sequelize[_0x8b17('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x8b17('0x3')]},'project_name':{'type':Sequelize[_0x8b17('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a1a98a1..4a2d048 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 _0x8d5a=['show','length','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','SquareDetailsReport','include','findAll','catch'];(function(_0x29edcb,_0x4fe33c){var _0x2ae76a=function(_0x15b670){while(--_0x15b670){_0x29edcb['push'](_0x29edcb['shift']());}};_0x2ae76a(++_0x4fe33c);}(_0x8d5a,0x1d6));var _0xa8d5=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x8d5a[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa8d5('0x0'));var zipdir=require(_0xa8d5('0x1'));var jsonpatch=require(_0xa8d5('0x2'));var rp=require('request-promise');var moment=require(_0xa8d5('0x3'));var BPromise=require(_0xa8d5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa8d5('0x5'));var sox=require(_0xa8d5('0x6'));var csv=require(_0xa8d5('0x7'));var ejs=require(_0xa8d5('0x8'));var fs=require('fs');var fs_extra=require(_0xa8d5('0x9'));var _=require(_0xa8d5('0xa'));var squel=require(_0xa8d5('0xb'));var crypto=require('crypto');var jsforce=require(_0xa8d5('0xc'));var deskjs=require(_0xa8d5('0xd'));var toCsv=require(_0xa8d5('0x7'));var querystring=require('querystring');var Papa=require(_0xa8d5('0xe'));var Redis=require(_0xa8d5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa8d5('0x10'));var as=require(_0xa8d5('0x11'));var hardwareService=require(_0xa8d5('0x12'));var logger=require(_0xa8d5('0x13'))(_0xa8d5('0x14'));var utils=require('../../config/utils');var config=require(_0xa8d5('0x15'));var licenseUtil=require(_0xa8d5('0x16'));var db=require(_0xa8d5('0x17'))['db'];function respondWithStatusCode(_0x124d49,_0x10121e){_0x10121e=_0x10121e||0xcc;return function(_0x9e7e5e){if(_0x9e7e5e){return _0x124d49[_0xa8d5('0x18')](_0x10121e);}return _0x124d49[_0xa8d5('0x19')](_0x10121e)[_0xa8d5('0x1a')]();};}function respondWithResult(_0x1a3334,_0x1c3ca1){_0x1c3ca1=_0x1c3ca1||0xc8;return function(_0x3568bf){if(_0x3568bf){return _0x1a3334[_0xa8d5('0x19')](_0x1c3ca1)['json'](_0x3568bf);}};}function respondWithFilteredResult(_0x1cc922,_0xc6f131){return function(_0x53df82){if(_0x53df82){var _0x50abe9=typeof _0xc6f131[_0xa8d5('0x1b')]==='undefined'&&typeof _0xc6f131[_0xa8d5('0x1c')]===_0xa8d5('0x1d');var _0xd878b3=_0x53df82[_0xa8d5('0x1e')];var _0x1cac0a=_0x50abe9?0x0:_0xc6f131[_0xa8d5('0x1b')];var _0x31313e=_0x50abe9?_0x53df82[_0xa8d5('0x1e')]:_0xc6f131[_0xa8d5('0x1b')]+_0xc6f131[_0xa8d5('0x1c')];var _0x591481;if(_0x31313e>=_0xd878b3){_0x31313e=_0xd878b3;_0x591481=0xc8;}else{_0x591481=0xce;}_0x1cc922[_0xa8d5('0x19')](_0x591481);return _0x1cc922['set'](_0xa8d5('0x1f'),_0x1cac0a+'-'+_0x31313e+'/'+_0xd878b3)[_0xa8d5('0x20')](_0x53df82);}return null;};}function patchUpdates(_0x5d815c){return function(_0x420418){try{jsonpatch[_0xa8d5('0x21')](_0x420418,_0x5d815c,!![]);}catch(_0x51c280){return BPromise[_0xa8d5('0x22')](_0x51c280);}return _0x420418[_0xa8d5('0x23')]();};}function saveUpdates(_0x47c495,_0x561b62){return function(_0x1d3dfe){if(_0x1d3dfe){return _0x1d3dfe[_0xa8d5('0x24')](_0x47c495)[_0xa8d5('0x25')](function(_0x29a275){return _0x29a275;});}return null;};}function removeEntity(_0x5dc12f,_0x24e5ef){return function(_0x560e59){if(_0x560e59){return _0x560e59[_0xa8d5('0x26')]()['then'](function(){_0x5dc12f[_0xa8d5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3186f2,_0x34df3c){return function(_0x61804c){if(!_0x61804c){_0x3186f2[_0xa8d5('0x18')](0x194);}return _0x61804c;};}function handleError(_0x557281,_0x475cb7){_0x475cb7=_0x475cb7||0x1f4;return function(_0x5e4761){logger[_0xa8d5('0x27')](_0x5e4761[_0xa8d5('0x28')]);if(_0x5e4761[_0xa8d5('0x29')]){delete _0x5e4761[_0xa8d5('0x29')];}_0x557281['status'](_0x475cb7)[_0xa8d5('0x2a')](_0x5e4761);};}exports[_0xa8d5('0x2b')]=function(_0x358083,_0x8ad028){var _0x2847a8={},_0x373289={},_0x2e64ee={'count':0x0,'rows':[]};var _0x22ee4d=_[_0xa8d5('0x2c')](db['SquareDetailsReport'][_0xa8d5('0x2d')],function(_0x408cf){return{'name':_0x408cf[_0xa8d5('0x2e')],'type':_0x408cf[_0xa8d5('0x2f')][_0xa8d5('0x30')]};});_0x373289[_0xa8d5('0x31')]=_[_0xa8d5('0x2c')](_0x22ee4d,'name');_0x373289[_0xa8d5('0x32')]=_[_0xa8d5('0x33')](_0x358083[_0xa8d5('0x32')]);_0x373289['filters']=_[_0xa8d5('0x34')](_0x373289[_0xa8d5('0x31')],_0x373289[_0xa8d5('0x32')]);_0x2847a8[_0xa8d5('0x35')]=_[_0xa8d5('0x34')](_0x373289[_0xa8d5('0x31')],qs[_0xa8d5('0x36')](_0x358083[_0xa8d5('0x32')][_0xa8d5('0x36')]));_0x2847a8[_0xa8d5('0x35')]=_0x2847a8[_0xa8d5('0x35')]['length']?_0x2847a8[_0xa8d5('0x35')]:_0x373289[_0xa8d5('0x31')];if(!_0x358083[_0xa8d5('0x32')][_0xa8d5('0x37')](_0xa8d5('0x38'))){_0x2847a8['limit']=qs[_0xa8d5('0x1c')](_0x358083['query'][_0xa8d5('0x1c')]);_0x2847a8[_0xa8d5('0x1b')]=qs[_0xa8d5('0x1b')](_0x358083[_0xa8d5('0x32')][_0xa8d5('0x1b')]);}_0x2847a8['order']=qs[_0xa8d5('0x39')](_0x358083[_0xa8d5('0x32')][_0xa8d5('0x39')]);_0x2847a8['where']=qs[_0xa8d5('0x3a')](_[_0xa8d5('0x3b')](_0x358083[_0xa8d5('0x32')],_0x373289[_0xa8d5('0x3a')]),_0x22ee4d);if(_0x358083[_0xa8d5('0x32')][_0xa8d5('0x3c')]){_0x2847a8[_0xa8d5('0x3d')]=_[_0xa8d5('0x3e')](_0x2847a8[_0xa8d5('0x3d')],{'$or':_[_0xa8d5('0x2c')](_0x22ee4d,function(_0x2c6367){if(_0x2c6367[_0xa8d5('0x2f')]!==_0xa8d5('0x3f')){var _0x1e5a1a={};_0x1e5a1a[_0x2c6367[_0xa8d5('0x29')]]={'$like':'%'+_0x358083['query']['filter']+'%'};return _0x1e5a1a;}})});}_0x2847a8=_[_0xa8d5('0x3e')]({},_0x2847a8,_0x358083[_0xa8d5('0x40')]);var _0x534583={'where':_0x2847a8[_0xa8d5('0x3d')]};return db[_0xa8d5('0x41')][_0xa8d5('0x1e')](_0x534583)[_0xa8d5('0x25')](function(_0x1dca34){_0x2e64ee[_0xa8d5('0x1e')]=_0x1dca34;if(_0x358083['query']['includeAll']){_0x2847a8[_0xa8d5('0x42')]=[{'all':!![]}];}return db[_0xa8d5('0x41')][_0xa8d5('0x43')](_0x2847a8);})[_0xa8d5('0x25')](function(_0x1a1c47){_0x2e64ee['rows']=_0x1a1c47;return _0x2e64ee;})[_0xa8d5('0x25')](respondWithFilteredResult(_0x8ad028,_0x2847a8))[_0xa8d5('0x44')](handleError(_0x8ad028,null));};exports[_0xa8d5('0x45')]=function(_0x360af6,_0x11ce21){var _0x2c9922={'raw':!![],'where':{'id':_0x360af6['params']['id']}},_0x348b5a={};_0x348b5a['model']=_[_0xa8d5('0x33')](db['SquareDetailsReport'][_0xa8d5('0x2d')]);_0x348b5a[_0xa8d5('0x32')]=_[_0xa8d5('0x33')](_0x360af6[_0xa8d5('0x32')]);_0x348b5a[_0xa8d5('0x3a')]=_[_0xa8d5('0x34')](_0x348b5a[_0xa8d5('0x31')],_0x348b5a['query']);_0x2c9922[_0xa8d5('0x35')]=_[_0xa8d5('0x34')](_0x348b5a[_0xa8d5('0x31')],qs['fields'](_0x360af6[_0xa8d5('0x32')]['fields']));_0x2c9922['attributes']=_0x2c9922[_0xa8d5('0x35')][_0xa8d5('0x46')]?_0x2c9922[_0xa8d5('0x35')]:_0x348b5a[_0xa8d5('0x31')];if(_0x360af6['query'][_0xa8d5('0x47')]){_0x2c9922[_0xa8d5('0x42')]=[{'all':!![]}];}_0x2c9922=_[_0xa8d5('0x3e')]({},_0x2c9922,_0x360af6[_0xa8d5('0x40')]);return db[_0xa8d5('0x41')][_0xa8d5('0x48')](_0x2c9922)[_0xa8d5('0x25')](handleEntityNotFound(_0x11ce21,null))[_0xa8d5('0x25')](respondWithResult(_0x11ce21,null))[_0xa8d5('0x44')](handleError(_0x11ce21,null));};exports[_0xa8d5('0x49')]=function(_0x25952f,_0x1103d7){return db[_0xa8d5('0x41')][_0xa8d5('0x49')](_0x25952f[_0xa8d5('0x4a')],{})[_0xa8d5('0x25')](respondWithResult(_0x1103d7,0xc9))[_0xa8d5('0x44')](handleError(_0x1103d7,null));};exports[_0xa8d5('0x24')]=function(_0x480ec8,_0x200368){if(_0x480ec8[_0xa8d5('0x4a')]['id']){delete _0x480ec8[_0xa8d5('0x4a')]['id'];}return db[_0xa8d5('0x41')]['find']({'where':{'id':_0x480ec8['params']['id']}})['then'](handleEntityNotFound(_0x200368,null))[_0xa8d5('0x25')](saveUpdates(_0x480ec8[_0xa8d5('0x4a')],null))['then'](respondWithResult(_0x200368,null))[_0xa8d5('0x44')](handleError(_0x200368,null));};exports[_0xa8d5('0x26')]=function(_0x1ec2c0,_0x417a15){return db[_0xa8d5('0x41')][_0xa8d5('0x48')]({'where':{'id':_0x1ec2c0[_0xa8d5('0x4b')]['id']}})[_0xa8d5('0x25')](handleEntityNotFound(_0x417a15,null))[_0xa8d5('0x25')](removeEntity(_0x417a15,null))[_0xa8d5('0x44')](handleError(_0x417a15,null));};exports['describe']=function(_0x341e15,_0x2398ec){return db['SquareDetailsReport'][_0xa8d5('0x4c')]()[_0xa8d5('0x25')](respondWithResult(_0x2398ec,null))[_0xa8d5('0x44')](handleError(_0x2398ec,null));}; \ No newline at end of file +var _0x1a9c=['show','params','intersection','fields','length','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows','catch'];(function(_0x253c98,_0x42669b){var _0x3715e3=function(_0x423aa4){while(--_0x423aa4){_0x253c98['push'](_0x253c98['shift']());}};_0x3715e3(++_0x42669b);}(_0x1a9c,0x1ea));var _0xc1a9=function(_0x14ace9,_0x25e941){_0x14ace9=_0x14ace9-0x0;var _0x3a5913=_0x1a9c[_0x14ace9];return _0x3a5913;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1a9('0x0'));var zipdir=require(_0xc1a9('0x1'));var jsonpatch=require(_0xc1a9('0x2'));var rp=require(_0xc1a9('0x3'));var moment=require('moment');var BPromise=require(_0xc1a9('0x4'));var Mustache=require(_0xc1a9('0x5'));var util=require(_0xc1a9('0x6'));var path=require(_0xc1a9('0x7'));var sox=require(_0xc1a9('0x8'));var csv=require(_0xc1a9('0x9'));var ejs=require(_0xc1a9('0xa'));var fs=require('fs');var fs_extra=require(_0xc1a9('0xb'));var _=require('lodash');var squel=require(_0xc1a9('0xc'));var crypto=require(_0xc1a9('0xd'));var jsforce=require(_0xc1a9('0xe'));var deskjs=require(_0xc1a9('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1a9('0x10'));var Redis=require(_0xc1a9('0x11'));var authService=require(_0xc1a9('0x12'));var qs=require(_0xc1a9('0x13'));var as=require(_0xc1a9('0x14'));var hardwareService=require(_0xc1a9('0x15'));var logger=require(_0xc1a9('0x16'))('api');var utils=require(_0xc1a9('0x17'));var config=require(_0xc1a9('0x18'));var licenseUtil=require(_0xc1a9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x133154,_0x1fbdba){_0x1fbdba=_0x1fbdba||0xcc;return function(_0xeb9b38){if(_0xeb9b38){return _0x133154[_0xc1a9('0x1a')](_0x1fbdba);}return _0x133154[_0xc1a9('0x1b')](_0x1fbdba)[_0xc1a9('0x1c')]();};}function respondWithResult(_0xa0f4bc,_0xfdfc75){_0xfdfc75=_0xfdfc75||0xc8;return function(_0xbc03c0){if(_0xbc03c0){return _0xa0f4bc[_0xc1a9('0x1b')](_0xfdfc75)[_0xc1a9('0x1d')](_0xbc03c0);}};}function respondWithFilteredResult(_0x8ce0c4,_0x802482){return function(_0x59d558){if(_0x59d558){var _0x130a3=typeof _0x802482[_0xc1a9('0x1e')]===_0xc1a9('0x1f')&&typeof _0x802482[_0xc1a9('0x20')]===_0xc1a9('0x1f');var _0xb95501=_0x59d558[_0xc1a9('0x21')];var _0x4d8377=_0x130a3?0x0:_0x802482[_0xc1a9('0x1e')];var _0x2f1e06=_0x130a3?_0x59d558[_0xc1a9('0x21')]:_0x802482[_0xc1a9('0x1e')]+_0x802482['limit'];var _0x185a2c;if(_0x2f1e06>=_0xb95501){_0x2f1e06=_0xb95501;_0x185a2c=0xc8;}else{_0x185a2c=0xce;}_0x8ce0c4[_0xc1a9('0x1b')](_0x185a2c);return _0x8ce0c4[_0xc1a9('0x22')](_0xc1a9('0x23'),_0x4d8377+'-'+_0x2f1e06+'/'+_0xb95501)['json'](_0x59d558);}return null;};}function patchUpdates(_0x432cd2){return function(_0xd885c0){try{jsonpatch[_0xc1a9('0x24')](_0xd885c0,_0x432cd2,!![]);}catch(_0x2fb838){return BPromise[_0xc1a9('0x25')](_0x2fb838);}return _0xd885c0['save']();};}function saveUpdates(_0x5e6ccd,_0x2227e2){return function(_0x173e5c){if(_0x173e5c){return _0x173e5c[_0xc1a9('0x26')](_0x5e6ccd)[_0xc1a9('0x27')](function(_0x567a40){return _0x567a40;});}return null;};}function removeEntity(_0x5e0607,_0x42e012){return function(_0x1c8ebb){if(_0x1c8ebb){return _0x1c8ebb[_0xc1a9('0x28')]()[_0xc1a9('0x27')](function(){_0x5e0607['status'](0xcc)[_0xc1a9('0x1c')]();});}};}function handleEntityNotFound(_0xe45b88,_0x5f1853){return function(_0x492527){if(!_0x492527){_0xe45b88[_0xc1a9('0x1a')](0x194);}return _0x492527;};}function handleError(_0x36fc04,_0x2a17c2){_0x2a17c2=_0x2a17c2||0x1f4;return function(_0x4dce54){logger[_0xc1a9('0x29')](_0x4dce54[_0xc1a9('0x2a')]);if(_0x4dce54[_0xc1a9('0x2b')]){delete _0x4dce54[_0xc1a9('0x2b')];}_0x36fc04[_0xc1a9('0x1b')](_0x2a17c2)[_0xc1a9('0x2c')](_0x4dce54);};}exports[_0xc1a9('0x2d')]=function(_0x36f9b3,_0x5e335e){var _0xe0a5ff={},_0x3b4daf={},_0x2b794f={'count':0x0,'rows':[]};var _0x42d5ba=_['map'](db[_0xc1a9('0x2e')][_0xc1a9('0x2f')],function(_0x4b1988){return{'name':_0x4b1988[_0xc1a9('0x30')],'type':_0x4b1988['type'][_0xc1a9('0x31')]};});_0x3b4daf[_0xc1a9('0x32')]=_[_0xc1a9('0x33')](_0x42d5ba,_0xc1a9('0x2b'));_0x3b4daf[_0xc1a9('0x34')]=_[_0xc1a9('0x35')](_0x36f9b3[_0xc1a9('0x34')]);_0x3b4daf[_0xc1a9('0x36')]=_['intersection'](_0x3b4daf[_0xc1a9('0x32')],_0x3b4daf[_0xc1a9('0x34')]);_0xe0a5ff[_0xc1a9('0x37')]=_['intersection'](_0x3b4daf['model'],qs['fields'](_0x36f9b3[_0xc1a9('0x34')]['fields']));_0xe0a5ff[_0xc1a9('0x37')]=_0xe0a5ff['attributes']['length']?_0xe0a5ff['attributes']:_0x3b4daf['model'];if(!_0x36f9b3[_0xc1a9('0x34')][_0xc1a9('0x38')](_0xc1a9('0x39'))){_0xe0a5ff[_0xc1a9('0x20')]=qs[_0xc1a9('0x20')](_0x36f9b3[_0xc1a9('0x34')][_0xc1a9('0x20')]);_0xe0a5ff[_0xc1a9('0x1e')]=qs[_0xc1a9('0x1e')](_0x36f9b3[_0xc1a9('0x34')]['offset']);}_0xe0a5ff[_0xc1a9('0x3a')]=qs[_0xc1a9('0x3b')](_0x36f9b3[_0xc1a9('0x34')][_0xc1a9('0x3b')]);_0xe0a5ff[_0xc1a9('0x3c')]=qs[_0xc1a9('0x36')](_[_0xc1a9('0x3d')](_0x36f9b3[_0xc1a9('0x34')],_0x3b4daf[_0xc1a9('0x36')]),_0x42d5ba);if(_0x36f9b3['query'][_0xc1a9('0x3e')]){_0xe0a5ff['where']=_['merge'](_0xe0a5ff['where'],{'$or':_['map'](_0x42d5ba,function(_0x5cb496){if(_0x5cb496[_0xc1a9('0x3f')]!=='VIRTUAL'){var _0x4f776b={};_0x4f776b[_0x5cb496[_0xc1a9('0x2b')]]={'$like':'%'+_0x36f9b3[_0xc1a9('0x34')][_0xc1a9('0x3e')]+'%'};return _0x4f776b;}})});}_0xe0a5ff=_[_0xc1a9('0x40')]({},_0xe0a5ff,_0x36f9b3['options']);var _0x2417f6={'where':_0xe0a5ff[_0xc1a9('0x3c')]};return db[_0xc1a9('0x2e')][_0xc1a9('0x21')](_0x2417f6)[_0xc1a9('0x27')](function(_0x516806){_0x2b794f[_0xc1a9('0x21')]=_0x516806;if(_0x36f9b3['query'][_0xc1a9('0x41')]){_0xe0a5ff[_0xc1a9('0x42')]=[{'all':!![]}];}return db[_0xc1a9('0x2e')][_0xc1a9('0x43')](_0xe0a5ff);})[_0xc1a9('0x27')](function(_0x59e966){_0x2b794f[_0xc1a9('0x44')]=_0x59e966;return _0x2b794f;})[_0xc1a9('0x27')](respondWithFilteredResult(_0x5e335e,_0xe0a5ff))[_0xc1a9('0x45')](handleError(_0x5e335e,null));};exports[_0xc1a9('0x46')]=function(_0x1781a7,_0x56e000){var _0x5ad9bc={'raw':!![],'where':{'id':_0x1781a7[_0xc1a9('0x47')]['id']}},_0x523d31={};_0x523d31[_0xc1a9('0x32')]=_[_0xc1a9('0x35')](db[_0xc1a9('0x2e')]['rawAttributes']);_0x523d31[_0xc1a9('0x34')]=_[_0xc1a9('0x35')](_0x1781a7[_0xc1a9('0x34')]);_0x523d31[_0xc1a9('0x36')]=_[_0xc1a9('0x48')](_0x523d31[_0xc1a9('0x32')],_0x523d31[_0xc1a9('0x34')]);_0x5ad9bc[_0xc1a9('0x37')]=_[_0xc1a9('0x48')](_0x523d31[_0xc1a9('0x32')],qs[_0xc1a9('0x49')](_0x1781a7['query'][_0xc1a9('0x49')]));_0x5ad9bc[_0xc1a9('0x37')]=_0x5ad9bc[_0xc1a9('0x37')][_0xc1a9('0x4a')]?_0x5ad9bc['attributes']:_0x523d31[_0xc1a9('0x32')];if(_0x1781a7[_0xc1a9('0x34')][_0xc1a9('0x41')]){_0x5ad9bc[_0xc1a9('0x42')]=[{'all':!![]}];}_0x5ad9bc=_[_0xc1a9('0x40')]({},_0x5ad9bc,_0x1781a7[_0xc1a9('0x4b')]);return db['SquareDetailsReport'][_0xc1a9('0x4c')](_0x5ad9bc)[_0xc1a9('0x27')](handleEntityNotFound(_0x56e000,null))['then'](respondWithResult(_0x56e000,null))[_0xc1a9('0x45')](handleError(_0x56e000,null));};exports[_0xc1a9('0x4d')]=function(_0x1d24a6,_0x475be2){return db[_0xc1a9('0x2e')][_0xc1a9('0x4d')](_0x1d24a6[_0xc1a9('0x4e')],{})[_0xc1a9('0x27')](respondWithResult(_0x475be2,0xc9))['catch'](handleError(_0x475be2,null));};exports[_0xc1a9('0x26')]=function(_0x3d4e27,_0x1bb4ec){if(_0x3d4e27[_0xc1a9('0x4e')]['id']){delete _0x3d4e27[_0xc1a9('0x4e')]['id'];}return db[_0xc1a9('0x2e')][_0xc1a9('0x4c')]({'where':{'id':_0x3d4e27[_0xc1a9('0x47')]['id']}})[_0xc1a9('0x27')](handleEntityNotFound(_0x1bb4ec,null))[_0xc1a9('0x27')](saveUpdates(_0x3d4e27[_0xc1a9('0x4e')],null))[_0xc1a9('0x27')](respondWithResult(_0x1bb4ec,null))[_0xc1a9('0x45')](handleError(_0x1bb4ec,null));};exports[_0xc1a9('0x28')]=function(_0x3b647e,_0x5190f){return db[_0xc1a9('0x2e')]['find']({'where':{'id':_0x3b647e[_0xc1a9('0x47')]['id']}})[_0xc1a9('0x27')](handleEntityNotFound(_0x5190f,null))['then'](removeEntity(_0x5190f,null))[_0xc1a9('0x45')](handleError(_0x5190f,null));};exports[_0xc1a9('0x4f')]=function(_0x518631,_0x163066){return db['SquareDetailsReport'][_0xc1a9('0x4f')]()[_0xc1a9('0x27')](respondWithResult(_0x163066,null))['catch'](handleError(_0x163066,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index dd03505..c41da2b 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 _0xa968=['./squareReportDetail.attributes','exports','report_square_details','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ab1dc,_0x338f23){var _0x3a3b79=function(_0x2495c1){while(--_0x2495c1){_0x3ab1dc['push'](_0x3ab1dc['shift']());}};_0x3a3b79(++_0x338f23);}(_0xa968,0x159));var _0x8a96=function(_0x477f62,_0x207a4f){_0x477f62=_0x477f62-0x0;var _0x382f57=_0xa968[_0x477f62];return _0x382f57;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8a96('0x0'));var BPromise=require(_0x8a96('0x1'));var rp=require(_0x8a96('0x2'));var fs=require('fs');var path=require(_0x8a96('0x3'));var rimraf=require(_0x8a96('0x4'));var config=require(_0x8a96('0x5'));var attributes=require(_0x8a96('0x6'));module[_0x8a96('0x7')]=function(_0xe0d493,_0x589b49){return _0xe0d493['define']('SquareDetailsReport',attributes,{'tableName':_0x8a96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdebb=['define','SquareDetailsReport','report_square_details','moment','request-promise','path','../../config/environment','exports'];(function(_0x331307,_0x50488e){var _0x5a521e=function(_0x1d171c){while(--_0x1d171c){_0x331307['push'](_0x331307['shift']());}};_0x5a521e(++_0x50488e);}(_0xdebb,0x1a3));var _0xbdeb=function(_0x9d37d9,_0x4cdbf8){_0x9d37d9=_0x9d37d9-0x0;var _0x22db05=_0xdebb[_0x9d37d9];return _0x22db05;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbdeb('0x0'));var BPromise=require('bluebird');var rp=require(_0xbdeb('0x1'));var fs=require('fs');var path=require(_0xbdeb('0x2'));var rimraf=require('rimraf');var config=require(_0xbdeb('0x3'));var attributes=require('./squareReportDetail.attributes');module[_0xbdeb('0x4')]=function(_0x18f380,_0x13954d){return _0x18f380[_0xbdeb('0x5')](_0xbdeb('0x6'),attributes,{'tableName':_0xbdeb('0x7'),'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 7e9bf67..a9c6e46 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 _0x536f=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateSquareDetailsReport','SquareDetailsReport','create','options','debug','catch','lodash','ioredis','../../mysqldb'];(function(_0x2fed7c,_0x51424a){var _0xf30cd6=function(_0x5b897f){while(--_0x5b897f){_0x2fed7c['push'](_0x2fed7c['shift']());}};_0xf30cd6(++_0x51424a);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});}; \ No newline at end of file +var _0xda3f=['options','raw','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0xba616d,_0x725a87){var _0x1f5ef9=function(_0x37b3bf){while(--_0x37b3bf){_0xba616d['push'](_0xba616d['shift']());}};_0x1f5ef9(++_0x725a87);}(_0xda3f,0xec));var _0xfda3=function(_0x494a74,_0x32fe52){_0x494a74=_0x494a74-0x0;var _0x1ba2ec=_0xda3f[_0x494a74];return _0x1ba2ec;};'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')]('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('SquareDetailsReport,\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);});});}exports[_0xfda3('0x14')]=function(_0x4680bf){var _0xc62ae6=this;return new Promise(function(_0x54a7c6,_0x15ddb9){return db[_0xfda3('0x15')][_0xfda3('0x16')](_0x4680bf[_0xfda3('0x17')],{'raw':_0x4680bf['options']?_0x4680bf[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![]})[_0xfda3('0x8')](function(_0x51e731){logger['info'](_0xfda3('0x14'),_0x4680bf);logger[_0xfda3('0xc')](_0xfda3('0x14'),_0x4680bf,JSON['stringify'](_0x51e731));_0x54a7c6(_0x51e731);})[_0xfda3('0x13')](function(_0xef2535){logger[_0xfda3('0xf')](_0xfda3('0x14'),_0xef2535[_0xfda3('0x11')],_0x4680bf);_0x15ddb9(_0xc62ae6[_0xfda3('0xf')](0x1f4,_0xef2535[_0xfda3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 36949c2..0ea5907 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 _0x567f=['Router','get','/process/:pid/kill','isAuthenticated','killProcess','exports'];(function(_0x25a144,_0x251d80){var _0x40ebe2=function(_0x5d69e8){while(--_0x5d69e8){_0x25a144['push'](_0x25a144['shift']());}};_0x40ebe2(++_0x251d80);}(_0x567f,0x1c2));var _0xf567=function(_0x16d2c7,_0x5bf3c0){_0x16d2c7=_0x16d2c7-0x0;var _0x1c9a0a=_0x567f[_0x16d2c7];return _0x1c9a0a;};'use strict';var express=require('express');var router=express[_0xf567('0x0')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xf567('0x1')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf567('0x1')](_0xf567('0x2'),auth[_0xf567('0x3')](),controller[_0xf567('0x4')]);module[_0xf567('0x5')]=router; \ No newline at end of file +var _0xb31c=['./system.controller','get','isAuthenticated','killProcess','exports','Router','../../components/auth/service'];(function(_0x5ce044,_0x4f1b0a){var _0x1e98f8=function(_0x1ffa73){while(--_0x1ffa73){_0x5ce044['push'](_0x5ce044['shift']());}};_0x1e98f8(++_0x4f1b0a);}(_0xb31c,0x83));var _0xcb31=function(_0x51bb21,_0x24b883){_0x51bb21=_0x51bb21-0x0;var _0x32b102=_0xb31c[_0x51bb21];return _0x32b102;};'use strict';var express=require('express');var router=express[_0xcb31('0x0')]();var auth=require(_0xcb31('0x1'));var controller=require(_0xcb31('0x2'));router[_0xcb31('0x3')]('/',auth[_0xcb31('0x4')](),controller['index']);router[_0xcb31('0x3')]('/process/:pid/kill',auth[_0xcb31('0x4')](),controller[_0xcb31('0x5')]);module[_0xcb31('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5fc8058..111335e 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 _0x6141=['name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x80e4a1,_0x349085){var _0x5fcf64=function(_0x2fb1d3){while(--_0x2fb1d3){_0x80e4a1['push'](_0x80e4a1['shift']());}};_0x5fcf64(++_0x349085);}(_0x6141,0xfc));var _0x1614=function(_0x5520e0,_0x1551c7){_0x5520e0=_0x5520e0-0x0;var _0x3cff11=_0x6141[_0x5520e0];return _0x3cff11;};'use strict';var info=require(_0x1614('0x0'));var exec=require(_0x1614('0x1'))['exec'];var logger=require(_0x1614('0x2'))(_0x1614('0x3'));var util=require(_0x1614('0x4'));var BPromise=require(_0x1614('0x5'));var _=require('lodash');function handleError(_0x441949,_0x8fb1dd,_0x284c16){_0x8fb1dd=_0x8fb1dd||0x1f4;return function(_0x398c3c){logger[_0x1614('0x6')](_0x1614('0x7'),_0x284c16,_0x8fb1dd,util[_0x1614('0x8')](_0x398c3c,{'showHidden':![],'depth':null}));delete _0x398c3c[_0x1614('0x9')];_0x441949[_0x1614('0xa')](_0x8fb1dd)[_0x1614('0xb')](_0x398c3c);};}exports[_0x1614('0xc')]=function(_0x1f1df9,_0x3226d2){return info[_0x1614('0xd')]()[_0x1614('0xe')](function(_0x30a752){return _0x3226d2['status'](0xc8)[_0x1614('0xf')](_0x30a752);})[_0x1614('0x10')](function(_0x37fedd){return _0x3226d2['status'](0x1f4)[_0x1614('0xf')](_0x37fedd);});};exports[_0x1614('0x11')]=function(_0x5e615b,_0x186ef1){var _0x2810e7=[_0x1614('0x12')];return new BPromise(function(_0x1b9a1a,_0x5edeaa){return exec(util[_0x1614('0x13')](_0x1614('0x14'),_0x5e615b[_0x1614('0x15')][_0x1614('0x16')]),function(_0x507b6d,_0x37cf46,_0x46b150){if(_0x507b6d){return _0x5edeaa(_0x507b6d);}return _0x1b9a1a(_0x37cf46);});})['then'](function(_0x1a734a){var _0x542a91=![];var _0x157e2a=_0x1a734a[_0x1614('0x17')](/\n/);for(var _0x5226c3=0x0,_0xc3cb17=_0x2810e7[_0x1614('0x18')];_0x5226c3<_0xc3cb17,_0x542a91===![];_0x5226c3+=0x1){if(_0x1a734a[_0x1614('0x19')](_0x2810e7[_0x5226c3])>=0x0){_0x542a91=!![];}}if(!_0x542a91){throw new Error(util[_0x1614('0x13')](_0x1614('0x1a'),_0x5e615b[_0x1614('0x15')]['pid']));}process['kill'](_0x5e615b['params'][_0x1614('0x16')],_0x1614('0x1b'));return _0x186ef1[_0x1614('0xa')](0xc8)[_0x1614('0xf')]({'message':util[_0x1614('0x13')](_0x1614('0x1c'),_0x5e615b[_0x1614('0x15')][_0x1614('0x16')])});})[_0x1614('0x10')](handleError(_0x186ef1,null,_0x1614('0x11')));}; \ No newline at end of file +var _0x1f54=['format','params','pid','then','split','length','indexOf','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','killProcess'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x1f54,0x122));var _0x41f5=function(_0x36211c,_0x178508){_0x36211c=_0x36211c-0x0;var _0xd2487b=_0x1f54[_0x36211c];return _0xd2487b;};'use strict';var info=require(_0x41f5('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x41f5('0x1'))(_0x41f5('0x2'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0xaf5c70,_0x30385f,_0x46a440){_0x30385f=_0x30385f||0x1f4;return function(_0x1915e2){logger['error'](_0x41f5('0x3'),_0x46a440,_0x30385f,util['inspect'](_0x1915e2,{'showHidden':![],'depth':null}));delete _0x1915e2[_0x41f5('0x4')];_0xaf5c70[_0x41f5('0x5')](_0x30385f)[_0x41f5('0x6')](_0x1915e2);};}exports[_0x41f5('0x7')]=function(_0xcc62ab,_0x4dcd68){return info[_0x41f5('0x8')]()['then'](function(_0x248ae9){return _0x4dcd68[_0x41f5('0x5')](0xc8)['json'](_0x248ae9);})['catch'](function(_0x77854c){return _0x4dcd68[_0x41f5('0x5')](0x1f4)['json'](_0x77854c);});};exports[_0x41f5('0x9')]=function(_0x4e48de,_0x161cda){var _0x2b752a=['components/import/cm'];return new BPromise(function(_0x4b6022,_0x5ab289){return exec(util[_0x41f5('0xa')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4e48de[_0x41f5('0xb')][_0x41f5('0xc')]),function(_0x5afa2f,_0x425c6f,_0x69ef93){if(_0x5afa2f){return _0x5ab289(_0x5afa2f);}return _0x4b6022(_0x425c6f);});})[_0x41f5('0xd')](function(_0x3e21f){var _0x5e1dbd=![];var _0x164ab9=_0x3e21f[_0x41f5('0xe')](/\n/);for(var _0x440cf5=0x0,_0x4bf18d=_0x2b752a[_0x41f5('0xf')];_0x440cf5<_0x4bf18d,_0x5e1dbd===![];_0x440cf5+=0x1){if(_0x3e21f[_0x41f5('0x10')](_0x2b752a[_0x440cf5])>=0x0){_0x5e1dbd=!![];}}if(!_0x5e1dbd){throw new Error(util[_0x41f5('0xa')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4e48de[_0x41f5('0xb')][_0x41f5('0xc')]));}process['kill'](_0x4e48de[_0x41f5('0xb')][_0x41f5('0xc')],_0x41f5('0x11'));return _0x161cda[_0x41f5('0x5')](0xc8)[_0x41f5('0x12')]({'message':util[_0x41f5('0xa')](_0x41f5('0x13'),_0x4e48de['params']['pid'])});})['catch'](handleError(_0x161cda,null,_0x41f5('0x9')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 14780a9..08ea73e 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 _0xa400=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x5bb59b,_0x3bf408){var _0x1e13d2=function(_0x357dbd){while(--_0x357dbd){_0x5bb59b['push'](_0x5bb59b['shift']());}};_0x1e13d2(++_0x3bf408);}(_0xa400,0x1cf));var _0x0a40=function(_0x2b5d71,_0x200a18){_0x2b5d71=_0x2b5d71-0x0;var _0x530728=_0xa400[_0x2b5d71];return _0x530728;};'use strict';var multer=require(_0x0a40('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a40('0x1'));var router=express[_0x0a40('0x2')]();var fs_extra=require(_0x0a40('0x3'));var auth=require(_0x0a40('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x0a40('0x5')]('/',auth[_0x0a40('0x6')](),controller[_0x0a40('0x7')]);router[_0x0a40('0x5')](_0x0a40('0x8'),auth[_0x0a40('0x6')](),controller[_0x0a40('0x9')]);router[_0x0a40('0xa')]('/',auth[_0x0a40('0x6')](),controller[_0x0a40('0xb')]);router[_0x0a40('0xc')]('/:id',auth[_0x0a40('0x6')](),controller['update']);router[_0x0a40('0xd')](_0x0a40('0x8'),auth[_0x0a40('0x6')](),controller[_0x0a40('0xe')]);module[_0x0a40('0xf')]=router; \ No newline at end of file +var _0x3a29=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x3a29,0x199));var _0x93a2=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x3a29[_0x7e918f];return _0x5b35ab;};'use strict';var multer=require(_0x93a2('0x0'));var util=require(_0x93a2('0x1'));var path=require(_0x93a2('0x2'));var timeout=require(_0x93a2('0x3'));var express=require('express');var router=express[_0x93a2('0x4')]();var fs_extra=require(_0x93a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x93a2('0x6'));var config=require(_0x93a2('0x7'));var controller=require(_0x93a2('0x8'));router[_0x93a2('0x9')]('/',auth[_0x93a2('0xa')](),controller[_0x93a2('0xb')]);router[_0x93a2('0x9')](_0x93a2('0xc'),auth[_0x93a2('0xa')](),controller[_0x93a2('0xd')]);router[_0x93a2('0xe')]('/',auth[_0x93a2('0xa')](),controller[_0x93a2('0xf')]);router[_0x93a2('0x10')](_0x93a2('0xc'),auth[_0x93a2('0xa')](),controller['update']);router[_0x93a2('0x11')](_0x93a2('0xc'),auth['isAuthenticated'](),controller[_0x93a2('0x12')]);module[_0x93a2('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index e4c4a34..3834d60 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 _0xb7aa=['name','#0091EA','sequelize','exports','STRING'];(function(_0x806d4,_0x2e8a83){var _0x38079a=function(_0x4c9266){while(--_0x4c9266){_0x806d4['push'](_0x806d4['shift']());}};_0x38079a(++_0x2e8a83);}(_0xb7aa,0x11a));var _0xab7a=function(_0x97d60a,_0x2011d1){_0x97d60a=_0x97d60a-0x0;var _0x4d9d3f=_0xb7aa[_0x97d60a];return _0x4d9d3f;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'name':{'type':Sequelize[_0xab7a('0x2')],'unique':_0xab7a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xab7a('0x2')],'defaultValue':_0xab7a('0x4')},'description':{'type':Sequelize[_0xab7a('0x2')]}}; \ No newline at end of file +var _0x1cc3=['name','#0091EA','STRING','sequelize','exports'];(function(_0x522fb4,_0xc40eb0){var _0x48bb39=function(_0x4701d6){while(--_0x4701d6){_0x522fb4['push'](_0x522fb4['shift']());}};_0x48bb39(++_0xc40eb0);}(_0x1cc3,0x11b));var _0x31cc=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1cc3[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x31cc('0x0'));module[_0x31cc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x31cc('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x31cc('0x3')},'description':{'type':Sequelize[_0x31cc('0x4')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fce0bf6..e8338ae 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 _0x34e5=['offset','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','map','Tag','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','include','findAll','catch','show','keys','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count'];(function(_0x221272,_0x29146a){var _0xe0a9d7=function(_0x44ee43){while(--_0x44ee43){_0x221272['push'](_0x221272['shift']());}};_0xe0a9d7(++_0x29146a);}(_0x34e5,0x172));var _0x534e=function(_0x296507,_0x5c329f){_0x296507=_0x296507-0x0;var _0x383e41=_0x34e5[_0x296507];return _0x383e41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x534e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x534e('0x1'));var rp=require(_0x534e('0x2'));var moment=require(_0x534e('0x3'));var BPromise=require(_0x534e('0x4'));var Mustache=require(_0x534e('0x5'));var util=require('util');var path=require(_0x534e('0x6'));var sox=require(_0x534e('0x7'));var csv=require(_0x534e('0x8'));var ejs=require(_0x534e('0x9'));var fs=require('fs');var fs_extra=require(_0x534e('0xa'));var _=require(_0x534e('0xb'));var squel=require(_0x534e('0xc'));var crypto=require('crypto');var jsforce=require(_0x534e('0xd'));var deskjs=require(_0x534e('0xe'));var toCsv=require(_0x534e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x534e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x534e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x534e('0x11'));var logger=require(_0x534e('0x12'))(_0x534e('0x13'));var utils=require('../../config/utils');var config=require(_0x534e('0x14'));var licenseUtil=require(_0x534e('0x15'));var db=require(_0x534e('0x16'))['db'];function respondWithStatusCode(_0x28b8ff,_0x2c4539){_0x2c4539=_0x2c4539||0xcc;return function(_0x5ef1b1){if(_0x5ef1b1){return _0x28b8ff[_0x534e('0x17')](_0x2c4539);}return _0x28b8ff[_0x534e('0x18')](_0x2c4539)[_0x534e('0x19')]();};}function respondWithResult(_0x3ff42d,_0x359565){_0x359565=_0x359565||0xc8;return function(_0x478027){if(_0x478027){return _0x3ff42d[_0x534e('0x18')](_0x359565)[_0x534e('0x1a')](_0x478027);}};}function respondWithFilteredResult(_0x536c9e,_0x5282cb){return function(_0x4171d6){if(_0x4171d6){var _0x3940c3=typeof _0x5282cb['offset']==='undefined'&&typeof _0x5282cb[_0x534e('0x1b')]===_0x534e('0x1c');var _0x9297b6=_0x4171d6[_0x534e('0x1d')];var _0x22bc92=_0x3940c3?0x0:_0x5282cb[_0x534e('0x1e')];var _0x100751=_0x3940c3?_0x4171d6['count']:_0x5282cb[_0x534e('0x1e')]+_0x5282cb[_0x534e('0x1b')];var _0x466d74;if(_0x100751>=_0x9297b6){_0x100751=_0x9297b6;_0x466d74=0xc8;}else{_0x466d74=0xce;}_0x536c9e[_0x534e('0x18')](_0x466d74);return _0x536c9e[_0x534e('0x1f')]('Content-Range',_0x22bc92+'-'+_0x100751+'/'+_0x9297b6)[_0x534e('0x1a')](_0x4171d6);}return null;};}function patchUpdates(_0x1b87d1){return function(_0x5f9ae9){try{jsonpatch[_0x534e('0x20')](_0x5f9ae9,_0x1b87d1,!![]);}catch(_0x4724f9){return BPromise[_0x534e('0x21')](_0x4724f9);}return _0x5f9ae9[_0x534e('0x22')]();};}function saveUpdates(_0x85188b,_0x21f2e1){return function(_0x5e086a){if(_0x5e086a){return _0x5e086a[_0x534e('0x23')](_0x85188b)[_0x534e('0x24')](function(_0x39466c){return _0x39466c;});}return null;};}function removeEntity(_0x4a09ed,_0x324205){return function(_0x44bbc1){if(_0x44bbc1){return _0x44bbc1[_0x534e('0x25')]()[_0x534e('0x24')](function(){var _0x53a6ef=_0x44bbc1[_0x534e('0x26')]({'plain':!![]});var _0x588c08=_0x534e('0x27');return db[_0x534e('0x28')][_0x534e('0x25')]({'where':{'type':_0x588c08,'resourceId':_0x53a6ef['id']}})[_0x534e('0x24')](function(){return _0x44bbc1;});})[_0x534e('0x24')](function(){_0x4a09ed['status'](0xcc)[_0x534e('0x19')]();});}};}function handleEntityNotFound(_0x443f85,_0x4f3d30){return function(_0x4bd073){if(!_0x4bd073){_0x443f85[_0x534e('0x17')](0x194);}return _0x4bd073;};}function handleError(_0x534783,_0x42fe90){_0x42fe90=_0x42fe90||0x1f4;return function(_0x3c5c11){logger[_0x534e('0x29')](_0x3c5c11[_0x534e('0x2a')]);if(_0x3c5c11[_0x534e('0x2b')]){delete _0x3c5c11[_0x534e('0x2b')];}_0x534783[_0x534e('0x18')](_0x42fe90)['send'](_0x3c5c11);};}exports['index']=function(_0x32ae10,_0x15bdc1){var _0x466dfc={},_0x2f1c49={},_0x423502={'count':0x0,'rows':[]};var _0x1efb5b=_[_0x534e('0x2c')](db[_0x534e('0x2d')][_0x534e('0x2e')],function(_0x312744){return{'name':_0x312744[_0x534e('0x2f')],'type':_0x312744[_0x534e('0x30')]['key']};});_0x2f1c49[_0x534e('0x31')]=_[_0x534e('0x2c')](_0x1efb5b,'name');_0x2f1c49[_0x534e('0x32')]=_['keys'](_0x32ae10[_0x534e('0x32')]);_0x2f1c49[_0x534e('0x33')]=_[_0x534e('0x34')](_0x2f1c49[_0x534e('0x31')],_0x2f1c49['query']);_0x466dfc[_0x534e('0x35')]=_[_0x534e('0x34')](_0x2f1c49['model'],qs['fields'](_0x32ae10[_0x534e('0x32')][_0x534e('0x36')]));_0x466dfc[_0x534e('0x35')]=_0x466dfc[_0x534e('0x35')]['length']?_0x466dfc[_0x534e('0x35')]:_0x2f1c49['model'];if(!_0x32ae10[_0x534e('0x32')]['hasOwnProperty'](_0x534e('0x37'))){_0x466dfc[_0x534e('0x1b')]=qs['limit'](_0x32ae10[_0x534e('0x32')]['limit']);_0x466dfc['offset']=qs['offset'](_0x32ae10['query'][_0x534e('0x1e')]);}_0x466dfc['order']=qs['sort'](_0x32ae10[_0x534e('0x32')][_0x534e('0x38')]);_0x466dfc[_0x534e('0x39')]=qs['filters'](_[_0x534e('0x3a')](_0x32ae10[_0x534e('0x32')],_0x2f1c49['filters']),_0x1efb5b);if(_0x32ae10[_0x534e('0x32')]['filter']){_0x466dfc[_0x534e('0x39')]=_[_0x534e('0x3b')](_0x466dfc['where'],{'$or':_[_0x534e('0x2c')](_0x1efb5b,function(_0x5206c7){if(_0x5206c7[_0x534e('0x30')]!==_0x534e('0x3c')){var _0x1f483c={};_0x1f483c[_0x5206c7[_0x534e('0x2b')]]={'$like':'%'+_0x32ae10['query']['filter']+'%'};return _0x1f483c;}})});}_0x466dfc=_[_0x534e('0x3b')]({},_0x466dfc,_0x32ae10['options']);var _0x1670f8={'where':_0x466dfc[_0x534e('0x39')]};return db[_0x534e('0x2d')][_0x534e('0x1d')](_0x1670f8)['then'](function(_0x1dcfe5){_0x423502[_0x534e('0x1d')]=_0x1dcfe5;if(_0x32ae10[_0x534e('0x32')]['includeAll']){_0x466dfc[_0x534e('0x3d')]=[{'all':!![]}];}return db['Tag'][_0x534e('0x3e')](_0x466dfc);})[_0x534e('0x24')](function(_0x32f2aa){_0x423502['rows']=_0x32f2aa;return _0x423502;})[_0x534e('0x24')](respondWithFilteredResult(_0x15bdc1,_0x466dfc))[_0x534e('0x3f')](handleError(_0x15bdc1,null));};exports[_0x534e('0x40')]=function(_0x436b0f,_0x121752){var _0x383d9d={'raw':!![],'where':{'id':_0x436b0f['params']['id']}},_0x197ce2={};_0x197ce2[_0x534e('0x31')]=_['keys'](db['Tag'][_0x534e('0x2e')]);_0x197ce2[_0x534e('0x32')]=_[_0x534e('0x41')](_0x436b0f[_0x534e('0x32')]);_0x197ce2[_0x534e('0x33')]=_[_0x534e('0x34')](_0x197ce2['model'],_0x197ce2[_0x534e('0x32')]);_0x383d9d[_0x534e('0x35')]=_[_0x534e('0x34')](_0x197ce2['model'],qs[_0x534e('0x36')](_0x436b0f['query'][_0x534e('0x36')]));_0x383d9d[_0x534e('0x35')]=_0x383d9d[_0x534e('0x35')][_0x534e('0x42')]?_0x383d9d[_0x534e('0x35')]:_0x197ce2[_0x534e('0x31')];if(_0x436b0f['query'][_0x534e('0x43')]){_0x383d9d['include']=[{'all':!![]}];}_0x383d9d=_['merge']({},_0x383d9d,_0x436b0f[_0x534e('0x44')]);return db[_0x534e('0x2d')][_0x534e('0x45')](_0x383d9d)[_0x534e('0x24')](handleEntityNotFound(_0x121752,null))[_0x534e('0x24')](respondWithResult(_0x121752,null))[_0x534e('0x3f')](handleError(_0x121752,null));};exports[_0x534e('0x46')]=function(_0x376c83,_0x42c35d){return db['Tag'][_0x534e('0x46')](_0x376c83[_0x534e('0x47')],{})[_0x534e('0x24')](function(_0x317deb){var _0x49118f=_0x376c83[_0x534e('0x48')][_0x534e('0x26')]({'plain':!![]});if(!_0x49118f)throw new Error(_0x534e('0x49'));if(_0x49118f[_0x534e('0x4a')]===_0x534e('0x48')){var _0x176147=_0x317deb[_0x534e('0x26')]({'plain':!![]});var _0x3f5046=_0x534e('0x27');return db[_0x534e('0x4b')][_0x534e('0x45')]({'where':{'name':_0x3f5046,'userProfileId':_0x49118f[_0x534e('0x4c')]},'raw':!![]})['then'](function(_0x45f9e5){if(_0x45f9e5&&_0x45f9e5[_0x534e('0x4d')]===0x0){return db['UserProfileResource'][_0x534e('0x46')]({'name':_0x176147[_0x534e('0x2b')],'resourceId':_0x176147['id'],'type':_0x45f9e5[_0x534e('0x2b')],'sectionId':_0x45f9e5['id']},{})['then'](function(){return _0x317deb;});}else{return _0x317deb;}})['catch'](function(_0x2d66b6){logger[_0x534e('0x29')](_0x534e('0x4e'),_0x2d66b6);throw _0x2d66b6;});}return _0x317deb;})[_0x534e('0x24')](respondWithResult(_0x42c35d,0xc9))[_0x534e('0x3f')](handleError(_0x42c35d,null));};exports[_0x534e('0x23')]=function(_0x20bb8e,_0x45ad28){if(_0x20bb8e[_0x534e('0x47')]['id']){delete _0x20bb8e['body']['id'];}return db['Tag'][_0x534e('0x45')]({'where':{'id':_0x20bb8e['params']['id']}})[_0x534e('0x24')](handleEntityNotFound(_0x45ad28,null))[_0x534e('0x24')](saveUpdates(_0x20bb8e[_0x534e('0x47')],null))[_0x534e('0x24')](respondWithResult(_0x45ad28,null))[_0x534e('0x3f')](handleError(_0x45ad28,null));};exports['destroy']=function(_0x2c42f2,_0x2de255){return db['Tag']['find']({'where':{'id':_0x2c42f2[_0x534e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2de255,null))['then'](removeEntity(_0x2de255,null))[_0x534e('0x3f')](handleError(_0x2de255,null));}; \ No newline at end of file +var _0x5178=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2edca5,_0x17526a){var _0x24b988=function(_0x9e6e30){while(--_0x9e6e30){_0x2edca5['push'](_0x2edca5['shift']());}};_0x24b988(++_0x17526a);}(_0x5178,0x171));var _0x8517=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5178[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8517('0x0'));var zipdir=require(_0x8517('0x1'));var jsonpatch=require(_0x8517('0x2'));var rp=require(_0x8517('0x3'));var moment=require(_0x8517('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8517('0x5'));var path=require(_0x8517('0x6'));var sox=require('sox');var csv=require(_0x8517('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8517('0x8'));var _=require(_0x8517('0x9'));var squel=require(_0x8517('0xa'));var crypto=require(_0x8517('0xb'));var jsforce=require(_0x8517('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8517('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8517('0xd'));var authService=require(_0x8517('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8517('0xf'));var hardwareService=require(_0x8517('0x10'));var logger=require(_0x8517('0x11'))(_0x8517('0x12'));var utils=require(_0x8517('0x13'));var config=require(_0x8517('0x14'));var licenseUtil=require(_0x8517('0x15'));var db=require(_0x8517('0x16'))['db'];function respondWithStatusCode(_0x4b9768,_0x9c57de){_0x9c57de=_0x9c57de||0xcc;return function(_0x7f429a){if(_0x7f429a){return _0x4b9768[_0x8517('0x17')](_0x9c57de);}return _0x4b9768[_0x8517('0x18')](_0x9c57de)[_0x8517('0x19')]();};}function respondWithResult(_0x49eba7,_0x385219){_0x385219=_0x385219||0xc8;return function(_0x19dd9d){if(_0x19dd9d){return _0x49eba7[_0x8517('0x18')](_0x385219)[_0x8517('0x1a')](_0x19dd9d);}};}function respondWithFilteredResult(_0x411d29,_0x18a984){return function(_0x260a15){if(_0x260a15){var _0x30cea1=typeof _0x18a984[_0x8517('0x1b')]===_0x8517('0x1c')&&typeof _0x18a984[_0x8517('0x1d')]===_0x8517('0x1c');var _0x50e2de=_0x260a15[_0x8517('0x1e')];var _0x100b76=_0x30cea1?0x0:_0x18a984[_0x8517('0x1b')];var _0xf1b53b=_0x30cea1?_0x260a15[_0x8517('0x1e')]:_0x18a984[_0x8517('0x1b')]+_0x18a984[_0x8517('0x1d')];var _0x5b5408;if(_0xf1b53b>=_0x50e2de){_0xf1b53b=_0x50e2de;_0x5b5408=0xc8;}else{_0x5b5408=0xce;}_0x411d29[_0x8517('0x18')](_0x5b5408);return _0x411d29['set']('Content-Range',_0x100b76+'-'+_0xf1b53b+'/'+_0x50e2de)[_0x8517('0x1a')](_0x260a15);}return null;};}function patchUpdates(_0x157bea){return function(_0xf35d95){try{jsonpatch[_0x8517('0x1f')](_0xf35d95,_0x157bea,!![]);}catch(_0x238d75){return BPromise[_0x8517('0x20')](_0x238d75);}return _0xf35d95['save']();};}function saveUpdates(_0x4b145f,_0x2dd1df){return function(_0x37861d){if(_0x37861d){return _0x37861d[_0x8517('0x21')](_0x4b145f)[_0x8517('0x22')](function(_0x3a5f0b){return _0x3a5f0b;});}return null;};}function removeEntity(_0x2e6e47,_0x5f02ee){return function(_0x181500){if(_0x181500){return _0x181500[_0x8517('0x23')]()['then'](function(){var _0x7f4cf8=_0x181500[_0x8517('0x24')]({'plain':!![]});var _0x42c779='Tags';return db[_0x8517('0x25')]['destroy']({'where':{'type':_0x42c779,'resourceId':_0x7f4cf8['id']}})[_0x8517('0x22')](function(){return _0x181500;});})[_0x8517('0x22')](function(){_0x2e6e47[_0x8517('0x18')](0xcc)[_0x8517('0x19')]();});}};}function handleEntityNotFound(_0x238f2c,_0x300e3f){return function(_0x481ceb){if(!_0x481ceb){_0x238f2c[_0x8517('0x17')](0x194);}return _0x481ceb;};}function handleError(_0x51d516,_0x197aaf){_0x197aaf=_0x197aaf||0x1f4;return function(_0x70ee9d){logger[_0x8517('0x26')](_0x70ee9d[_0x8517('0x27')]);if(_0x70ee9d[_0x8517('0x28')]){delete _0x70ee9d[_0x8517('0x28')];}_0x51d516['status'](_0x197aaf)[_0x8517('0x29')](_0x70ee9d);};}exports['index']=function(_0x3b1928,_0x4b9983){var _0x1dd9fb={},_0x2d360c={},_0x3cf945={'count':0x0,'rows':[]};var _0x14eb04=_[_0x8517('0x2a')](db[_0x8517('0x2b')][_0x8517('0x2c')],function(_0x559707){return{'name':_0x559707[_0x8517('0x2d')],'type':_0x559707[_0x8517('0x2e')][_0x8517('0x2f')]};});_0x2d360c['model']=_['map'](_0x14eb04,'name');_0x2d360c[_0x8517('0x30')]=_[_0x8517('0x31')](_0x3b1928[_0x8517('0x30')]);_0x2d360c[_0x8517('0x32')]=_[_0x8517('0x33')](_0x2d360c[_0x8517('0x34')],_0x2d360c['query']);_0x1dd9fb[_0x8517('0x35')]=_[_0x8517('0x33')](_0x2d360c[_0x8517('0x34')],qs['fields'](_0x3b1928[_0x8517('0x30')]['fields']));_0x1dd9fb[_0x8517('0x35')]=_0x1dd9fb[_0x8517('0x35')]['length']?_0x1dd9fb['attributes']:_0x2d360c[_0x8517('0x34')];if(!_0x3b1928[_0x8517('0x30')][_0x8517('0x36')](_0x8517('0x37'))){_0x1dd9fb['limit']=qs['limit'](_0x3b1928[_0x8517('0x30')][_0x8517('0x1d')]);_0x1dd9fb[_0x8517('0x1b')]=qs['offset'](_0x3b1928[_0x8517('0x30')][_0x8517('0x1b')]);}_0x1dd9fb['order']=qs[_0x8517('0x38')](_0x3b1928[_0x8517('0x30')][_0x8517('0x38')]);_0x1dd9fb[_0x8517('0x39')]=qs['filters'](_[_0x8517('0x3a')](_0x3b1928[_0x8517('0x30')],_0x2d360c[_0x8517('0x32')]),_0x14eb04);if(_0x3b1928[_0x8517('0x30')][_0x8517('0x3b')]){_0x1dd9fb[_0x8517('0x39')]=_[_0x8517('0x3c')](_0x1dd9fb[_0x8517('0x39')],{'$or':_[_0x8517('0x2a')](_0x14eb04,function(_0x183310){if(_0x183310[_0x8517('0x2e')]!==_0x8517('0x3d')){var _0x232e49={};_0x232e49[_0x183310['name']]={'$like':'%'+_0x3b1928['query'][_0x8517('0x3b')]+'%'};return _0x232e49;}})});}_0x1dd9fb=_[_0x8517('0x3c')]({},_0x1dd9fb,_0x3b1928[_0x8517('0x3e')]);var _0x30942f={'where':_0x1dd9fb[_0x8517('0x39')]};return db['Tag'][_0x8517('0x1e')](_0x30942f)[_0x8517('0x22')](function(_0x531ca7){_0x3cf945[_0x8517('0x1e')]=_0x531ca7;if(_0x3b1928[_0x8517('0x30')][_0x8517('0x3f')]){_0x1dd9fb[_0x8517('0x40')]=[{'all':!![]}];}return db['Tag'][_0x8517('0x41')](_0x1dd9fb);})[_0x8517('0x22')](function(_0x5c342c){_0x3cf945[_0x8517('0x42')]=_0x5c342c;return _0x3cf945;})[_0x8517('0x22')](respondWithFilteredResult(_0x4b9983,_0x1dd9fb))[_0x8517('0x43')](handleError(_0x4b9983,null));};exports['show']=function(_0x368bb8,_0x31c0b9){var _0x35adf2={'raw':!![],'where':{'id':_0x368bb8[_0x8517('0x44')]['id']}},_0x404a40={};_0x404a40[_0x8517('0x34')]=_[_0x8517('0x31')](db['Tag'][_0x8517('0x2c')]);_0x404a40[_0x8517('0x30')]=_['keys'](_0x368bb8[_0x8517('0x30')]);_0x404a40[_0x8517('0x32')]=_[_0x8517('0x33')](_0x404a40[_0x8517('0x34')],_0x404a40[_0x8517('0x30')]);_0x35adf2[_0x8517('0x35')]=_['intersection'](_0x404a40[_0x8517('0x34')],qs[_0x8517('0x45')](_0x368bb8[_0x8517('0x30')]['fields']));_0x35adf2[_0x8517('0x35')]=_0x35adf2[_0x8517('0x35')]['length']?_0x35adf2[_0x8517('0x35')]:_0x404a40[_0x8517('0x34')];if(_0x368bb8['query']['includeAll']){_0x35adf2['include']=[{'all':!![]}];}_0x35adf2=_[_0x8517('0x3c')]({},_0x35adf2,_0x368bb8[_0x8517('0x3e')]);return db['Tag'][_0x8517('0x46')](_0x35adf2)['then'](handleEntityNotFound(_0x31c0b9,null))['then'](respondWithResult(_0x31c0b9,null))[_0x8517('0x43')](handleError(_0x31c0b9,null));};exports[_0x8517('0x47')]=function(_0x3c8ecb,_0x6c2607){return db['Tag'][_0x8517('0x47')](_0x3c8ecb[_0x8517('0x48')],{})[_0x8517('0x22')](function(_0x5a6812){var _0x15102f=_0x3c8ecb[_0x8517('0x49')][_0x8517('0x24')]({'plain':!![]});if(!_0x15102f)throw new Error(_0x8517('0x4a'));if(_0x15102f[_0x8517('0x4b')]===_0x8517('0x49')){var _0x3cccd9=_0x5a6812['get']({'plain':!![]});var _0x3a5adb='Tags';return db['UserProfileSection'][_0x8517('0x46')]({'where':{'name':_0x3a5adb,'userProfileId':_0x15102f[_0x8517('0x4c')]},'raw':!![]})[_0x8517('0x22')](function(_0x2d604f){if(_0x2d604f&&_0x2d604f['autoAssociation']===0x0){return db[_0x8517('0x25')][_0x8517('0x47')]({'name':_0x3cccd9['name'],'resourceId':_0x3cccd9['id'],'type':_0x2d604f['name'],'sectionId':_0x2d604f['id']},{})[_0x8517('0x22')](function(){return _0x5a6812;});}else{return _0x5a6812;}})[_0x8517('0x43')](function(_0x28c1fb){logger['error'](_0x8517('0x4d'),_0x28c1fb);throw _0x28c1fb;});}return _0x5a6812;})['then'](respondWithResult(_0x6c2607,0xc9))[_0x8517('0x43')](handleError(_0x6c2607,null));};exports[_0x8517('0x21')]=function(_0x1ba2f,_0x58c98b){if(_0x1ba2f[_0x8517('0x48')]['id']){delete _0x1ba2f[_0x8517('0x48')]['id'];}return db[_0x8517('0x2b')][_0x8517('0x46')]({'where':{'id':_0x1ba2f[_0x8517('0x44')]['id']}})['then'](handleEntityNotFound(_0x58c98b,null))['then'](saveUpdates(_0x1ba2f[_0x8517('0x48')],null))[_0x8517('0x22')](respondWithResult(_0x58c98b,null))[_0x8517('0x43')](handleError(_0x58c98b,null));};exports['destroy']=function(_0x4dcf7b,_0x1ce476){return db[_0x8517('0x2b')]['find']({'where':{'id':_0x4dcf7b['params']['id']}})[_0x8517('0x22')](handleEntityNotFound(_0x1ce476,null))[_0x8517('0x22')](removeEntity(_0x1ce476,null))[_0x8517('0x43')](handleError(_0x1ce476,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 77a753c..4862ebf 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 _0xac65=['moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x2d597a,_0x2323c8){var _0x133bd7=function(_0x4ac5e4){while(--_0x4ac5e4){_0x2d597a['push'](_0x2d597a['shift']());}};_0x133bd7(++_0x2323c8);}(_0xac65,0x11d));var _0x5ac6=function(_0x7ab0da,_0x5e7700){_0x7ab0da=_0x7ab0da-0x0;var _0x4d9d4c=_0xac65[_0x7ab0da];return _0x4d9d4c;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var logger=require(_0x5ac6('0x2'))('api');var moment=require(_0x5ac6('0x3'));var BPromise=require(_0x5ac6('0x4'));var rp=require(_0x5ac6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var attributes=require(_0x5ac6('0x8'));module['exports']=function(_0x2da747,_0x38711d){return _0x2da747[_0x5ac6('0x9')](_0x5ac6('0xa'),attributes,{'tableName':_0x5ac6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ff=['api','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7ff,0x169));var _0xfa7f=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xa7ff[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xfa7f('0x0'));var util=require('util');var logger=require(_0xfa7f('0x1'))(_0xfa7f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa7f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa7f('0x4'));var config=require(_0xfa7f('0x5'));var attributes=require(_0xfa7f('0x6'));module[_0xfa7f('0x7')]=function(_0x1a48bb,_0x2d71f5){return _0x1a48bb[_0xfa7f('0x8')](_0xfa7f('0x9'),attributes,{'tableName':_0xfa7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 46147d0..07ed530 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 _0xe107=['then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x12036c,_0x3c8fac){var _0x4ad2f6=function(_0x5d143b){while(--_0x5d143b){_0x12036c['push'](_0x12036c['shift']());}};_0x4ad2f6(++_0x3c8fac);}(_0xe107,0xb3));var _0x7e10=function(_0x3a15ec,_0x5d0dc9){_0x3a15ec=_0x3a15ec-0x0;var _0x38966e=_0xe107[_0x3a15ec];return _0x38966e;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var moment=require(_0x7e10('0x1'));var BPromise=require(_0x7e10('0x2'));var rs=require(_0x7e10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e10('0x5'));var config=require(_0x7e10('0x6'));var jayson=require(_0x7e10('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd3de,_0x7378b3,_0x156c56){return new BPromise(function(_0x3413f7,_0x493958){return client['request'](_0x1dd3de,_0x156c56)[_0x7e10('0x8')](function(_0x490a7a){logger['info'](_0x7e10('0x9'),_0x7378b3,_0x7e10('0xa'));logger[_0x7e10('0xb')](_0x7e10('0xc'),_0x7378b3,_0x7e10('0xa'),JSON['stringify'](_0x490a7a));if(_0x490a7a[_0x7e10('0xd')]){if(_0x490a7a['error'][_0x7e10('0xe')]===0x1f4){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a['error'][_0x7e10('0xf')]);return _0x493958(_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);}logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);return _0x3413f7(_0x490a7a[_0x7e10('0xd')]['message']);}else{logger[_0x7e10('0x10')](_0x7e10('0x9'),_0x7378b3,'request\x20sent');_0x3413f7(_0x490a7a['result'][_0x7e10('0xf')]);}})['catch'](function(_0xe1abd2){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0xe1abd2);_0x493958(_0xe1abd2);});});} \ No newline at end of file +var _0x4ea3=['Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x4ea3,0x70));var _0x34ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4ea3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('Tag,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 8f39dc2..d8087a4 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +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(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 5ba10f3..b8aa412 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 _0xbaf0=['name','exports','STRING'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x52a81b,_0x585470){var _0x4260bd=function(_0x1bfb5e){while(--_0x1bfb5e){_0x52a81b['push'](_0x52a81b['shift']());}};_0x4260bd(++_0x585470);}(_0xb10b,0x12a));var _0xbb10=function(_0x260f28,_0x4e9b30){_0x260f28=_0x260f28-0x0;var _0x3aefcc=_0xb10b[_0x260f28];return _0x3aefcc;};'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 2b6cd8a..554da5e 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 _0xaf18=['localhost','socket.io-emitter','./team.socket','status','end','json','undefined','limit','offset','count','apply','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','catch','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','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','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','addQueues','add','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','defaults','findOrCreate','emit','Queue:save','User','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','spread','removeAgents','Mail','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0x564bec,_0x4e98e2){var _0x8dc0f7=function(_0x44ef9a){while(--_0x44ef9a){_0x564bec['push'](_0x564bec['shift']());}};_0x8dc0f7(++_0x4e98e2);}(_0xaf18,0x1be));var _0x8af1=function(_0x5e657c,_0x111fe4){_0x5e657c=_0x5e657c-0x0;var _0x21ef75=_0xaf18[_0x5e657c];return _0x21ef75;};'use strict';var emlformat=require(_0x8af1('0x0'));var rimraf=require(_0x8af1('0x1'));var zipdir=require(_0x8af1('0x2'));var jsonpatch=require(_0x8af1('0x3'));var rp=require('request-promise');var moment=require(_0x8af1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8af1('0x5'));var util=require(_0x8af1('0x6'));var path=require(_0x8af1('0x7'));var sox=require(_0x8af1('0x8'));var csv=require(_0x8af1('0x9'));var ejs=require(_0x8af1('0xa'));var fs=require('fs');var fs_extra=require(_0x8af1('0xb'));var _=require(_0x8af1('0xc'));var squel=require(_0x8af1('0xd'));var crypto=require('crypto');var jsforce=require(_0x8af1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8af1('0xf'));var Papa=require(_0x8af1('0x10'));var Redis=require(_0x8af1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8af1('0x12'));var as=require(_0x8af1('0x13'));var hardwareService=require(_0x8af1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8af1('0x15'));var config=require(_0x8af1('0x16'));var licenseUtil=require(_0x8af1('0x17'));var db=require('../../mysqldb')['db'];config[_0x8af1('0x18')]=_['defaults'](config[_0x8af1('0x18')],{'host':_0x8af1('0x19'),'port':0x18eb});var socket=require(_0x8af1('0x1a'))(new Redis(config[_0x8af1('0x18')]));require(_0x8af1('0x1b'))['register'](socket);function respondWithStatusCode(_0x1e8ecf,_0xd3c834){_0xd3c834=_0xd3c834||0xcc;return function(_0x5eef03){if(_0x5eef03){return _0x1e8ecf['sendStatus'](_0xd3c834);}return _0x1e8ecf[_0x8af1('0x1c')](_0xd3c834)[_0x8af1('0x1d')]();};}function respondWithResult(_0x581f40,_0x191761){_0x191761=_0x191761||0xc8;return function(_0x221806){if(_0x221806){return _0x581f40[_0x8af1('0x1c')](_0x191761)[_0x8af1('0x1e')](_0x221806);}};}function respondWithFilteredResult(_0x29e18e,_0x5c566d){return function(_0x3dd1dc){if(_0x3dd1dc){var _0x41b107=typeof _0x5c566d['offset']===_0x8af1('0x1f')&&typeof _0x5c566d[_0x8af1('0x20')]===_0x8af1('0x1f');var _0x457034=_0x3dd1dc['count'];var _0xb7f5f2=_0x41b107?0x0:_0x5c566d[_0x8af1('0x21')];var _0x15cb28=_0x41b107?_0x3dd1dc[_0x8af1('0x22')]:_0x5c566d[_0x8af1('0x21')]+_0x5c566d[_0x8af1('0x20')];var _0x5ddd24;if(_0x15cb28>=_0x457034){_0x15cb28=_0x457034;_0x5ddd24=0xc8;}else{_0x5ddd24=0xce;}_0x29e18e[_0x8af1('0x1c')](_0x5ddd24);return _0x29e18e['set']('Content-Range',_0xb7f5f2+'-'+_0x15cb28+'/'+_0x457034)['json'](_0x3dd1dc);}return null;};}function patchUpdates(_0x32e58a){return function(_0x22b0dc){try{jsonpatch[_0x8af1('0x23')](_0x22b0dc,_0x32e58a,!![]);}catch(_0x2804bb){return BPromise['reject'](_0x2804bb);}return _0x22b0dc[_0x8af1('0x24')]();};}function saveUpdates(_0x13f978,_0x20a62b){return function(_0x19de59){if(_0x19de59){return _0x19de59[_0x8af1('0x25')](_0x13f978)[_0x8af1('0x26')](function(_0x437993){return _0x437993;});}return null;};}function handleEntityNotFound(_0x4847be,_0x3e883e){return function(_0x29b4c1){if(!_0x29b4c1){_0x4847be[_0x8af1('0x27')](0x194);}return _0x29b4c1;};}function handleError(_0x5432aa,_0xc3d02b){_0xc3d02b=_0xc3d02b||0x1f4;return function(_0x454fac){logger[_0x8af1('0x28')](_0x454fac[_0x8af1('0x29')]);if(_0x454fac[_0x8af1('0x2a')]){delete _0x454fac[_0x8af1('0x2a')];}_0x5432aa['status'](_0xc3d02b)[_0x8af1('0x2b')](_0x454fac);};}exports[_0x8af1('0x2c')]=function(_0x2bdbb9,_0x4a7b3d){var _0x504644={},_0x5aa685={},_0x241614={'count':0x0,'rows':[]};var _0x5386f6=_[_0x8af1('0x2d')](db['Team'][_0x8af1('0x2e')],function(_0x2a4e52){return{'name':_0x2a4e52[_0x8af1('0x2f')],'type':_0x2a4e52[_0x8af1('0x30')][_0x8af1('0x31')]};});_0x5aa685[_0x8af1('0x32')]=_[_0x8af1('0x2d')](_0x5386f6,_0x8af1('0x2a'));_0x5aa685[_0x8af1('0x33')]=_[_0x8af1('0x34')](_0x2bdbb9[_0x8af1('0x33')]);_0x5aa685[_0x8af1('0x35')]=_[_0x8af1('0x36')](_0x5aa685[_0x8af1('0x32')],_0x5aa685[_0x8af1('0x33')]);_0x504644['attributes']=_[_0x8af1('0x36')](_0x5aa685['model'],qs[_0x8af1('0x37')](_0x2bdbb9[_0x8af1('0x33')]['fields']));_0x504644[_0x8af1('0x38')]=_0x504644[_0x8af1('0x38')][_0x8af1('0x39')]?_0x504644[_0x8af1('0x38')]:_0x5aa685[_0x8af1('0x32')];if(!_0x2bdbb9['query']['hasOwnProperty'](_0x8af1('0x3a'))){_0x504644['limit']=qs[_0x8af1('0x20')](_0x2bdbb9[_0x8af1('0x33')][_0x8af1('0x20')]);_0x504644[_0x8af1('0x21')]=qs[_0x8af1('0x21')](_0x2bdbb9[_0x8af1('0x33')]['offset']);}_0x504644[_0x8af1('0x3b')]=qs[_0x8af1('0x3c')](_0x2bdbb9['query'][_0x8af1('0x3c')]);_0x504644[_0x8af1('0x3d')]=qs[_0x8af1('0x35')](_[_0x8af1('0x3e')](_0x2bdbb9[_0x8af1('0x33')],_0x5aa685['filters']),_0x5386f6);if(_0x2bdbb9['query'][_0x8af1('0x3f')]){_0x504644[_0x8af1('0x3d')]=_[_0x8af1('0x40')](_0x504644[_0x8af1('0x3d')],{'$or':_[_0x8af1('0x2d')](_0x5386f6,function(_0x57f72c){if(_0x57f72c['type']!==_0x8af1('0x41')){var _0x5317c9={};_0x5317c9[_0x57f72c[_0x8af1('0x2a')]]={'$like':'%'+_0x2bdbb9['query']['filter']+'%'};return _0x5317c9;}})});}_0x504644=_[_0x8af1('0x40')]({},_0x504644,_0x2bdbb9[_0x8af1('0x42')]);var _0x33d479={'where':_0x504644['where']};return db[_0x8af1('0x43')][_0x8af1('0x22')](_0x33d479)[_0x8af1('0x26')](function(_0x21c64b){_0x241614[_0x8af1('0x22')]=_0x21c64b;if(_0x2bdbb9[_0x8af1('0x33')][_0x8af1('0x44')]){_0x504644[_0x8af1('0x45')]=[{'all':!![]}];}return db[_0x8af1('0x43')][_0x8af1('0x46')](_0x504644);})[_0x8af1('0x26')](function(_0x4b6435){_0x241614[_0x8af1('0x47')]=_0x4b6435;return _0x241614;})[_0x8af1('0x26')](respondWithFilteredResult(_0x4a7b3d,_0x504644))['catch'](handleError(_0x4a7b3d,null));};exports[_0x8af1('0x48')]=function(_0x3ba3ce,_0x37f0c0){var _0x856039={'raw':![],'where':{'id':_0x3ba3ce[_0x8af1('0x49')]['id']}},_0x35646c={};_0x35646c['model']=_[_0x8af1('0x34')](db[_0x8af1('0x43')][_0x8af1('0x2e')]);_0x35646c[_0x8af1('0x33')]=_[_0x8af1('0x34')](_0x3ba3ce[_0x8af1('0x33')]);_0x35646c[_0x8af1('0x35')]=_['intersection'](_0x35646c[_0x8af1('0x32')],_0x35646c['query']);_0x856039['attributes']=_[_0x8af1('0x36')](_0x35646c[_0x8af1('0x32')],qs[_0x8af1('0x37')](_0x3ba3ce[_0x8af1('0x33')][_0x8af1('0x37')]));_0x856039['attributes']=_0x856039[_0x8af1('0x38')][_0x8af1('0x39')]?_0x856039[_0x8af1('0x38')]:_0x35646c[_0x8af1('0x32')];if(_0x3ba3ce['query'][_0x8af1('0x44')]){_0x856039['include']=[{'all':!![]}];}_0x856039=_['merge']({},_0x856039,_0x3ba3ce[_0x8af1('0x42')]);return db['Team'][_0x8af1('0x4a')](_0x856039)[_0x8af1('0x26')](handleEntityNotFound(_0x37f0c0,null))['then'](respondWithResult(_0x37f0c0,null))['catch'](handleError(_0x37f0c0,null));};exports['create']=function(_0x57d3a8,_0x53e4b4){return db[_0x8af1('0x43')][_0x8af1('0x4b')](_0x57d3a8[_0x8af1('0x4c')],{})[_0x8af1('0x26')](function(_0x15cc8f){var _0x5b0e45=_0x57d3a8[_0x8af1('0x4d')][_0x8af1('0x4e')]({'plain':!![]});if(!_0x5b0e45)throw new Error(_0x8af1('0x4f'));if(_0x5b0e45[_0x8af1('0x50')]===_0x8af1('0x4d')){var _0x314299=_0x15cc8f[_0x8af1('0x4e')]({'plain':!![]});var _0x49460b=_0x8af1('0x51');return db[_0x8af1('0x52')][_0x8af1('0x4a')]({'where':{'name':_0x49460b,'userProfileId':_0x5b0e45[_0x8af1('0x53')]},'raw':!![]})['then'](function(_0x19b0e1){if(_0x19b0e1&&_0x19b0e1[_0x8af1('0x54')]===0x0){return db['UserProfileResource'][_0x8af1('0x4b')]({'name':_0x314299[_0x8af1('0x2a')],'resourceId':_0x314299['id'],'type':_0x19b0e1[_0x8af1('0x2a')],'sectionId':_0x19b0e1['id']},{})[_0x8af1('0x26')](function(){return _0x15cc8f;});}else{return _0x15cc8f;}})[_0x8af1('0x55')](function(_0x392c71){logger[_0x8af1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x392c71);throw _0x392c71;});}return _0x15cc8f;})[_0x8af1('0x26')](respondWithResult(_0x53e4b4,0xc9))[_0x8af1('0x55')](handleError(_0x53e4b4,null));};exports['update']=function(_0x47b6ce,_0x5d90ed){if(_0x47b6ce[_0x8af1('0x4c')]['id']){delete _0x47b6ce[_0x8af1('0x4c')]['id'];}return db[_0x8af1('0x43')][_0x8af1('0x4a')]({'where':{'id':_0x47b6ce[_0x8af1('0x49')]['id']}})[_0x8af1('0x26')](handleEntityNotFound(_0x5d90ed,null))[_0x8af1('0x26')](saveUpdates(_0x47b6ce[_0x8af1('0x4c')],null))[_0x8af1('0x26')](respondWithResult(_0x5d90ed,null))[_0x8af1('0x55')](handleError(_0x5d90ed,null));};exports['destroy']=function(_0x460fec,_0x4c11bc){var _0x2e9b2b=_0x460fec[_0x8af1('0x49')]['id'];var _0x29ad4f=[];return db[_0x8af1('0x56')]['transaction'](function(_0x296df1){var _0x848d8=_0x8af1('0x57')+_0x2e9b2b;return db[_0x8af1('0x56')][_0x8af1('0x33')](_0x848d8,{'type':db[_0x8af1('0x58')]['QueryTypes'][_0x8af1('0x59')],'raw':!![],'transaction':_0x296df1})[_0x8af1('0x26')](function(_0x106945){_0x29ad4f=_[_0x8af1('0x2d')](_0x106945,function(_0xd675b6){return Number(_0xd675b6[_0x8af1('0x5a')]);});})[_0x8af1('0x26')](function(){var _0x36c36e=_0x8af1('0x5b')+_0x2e9b2b;return db[_0x8af1('0x56')][_0x8af1('0x33')](_0x36c36e,{'type':db[_0x8af1('0x58')][_0x8af1('0x5c')][_0x8af1('0x59')],'raw':!![],'transaction':_0x296df1});})[_0x8af1('0x26')](function(_0xe8cac4){var _0x423b47=_['map'](_0xe8cac4,function(_0x57790c){return Number(_0x57790c[_0x8af1('0x5d')]);});return db['UserVoiceQueue'][_0x8af1('0x5e')]({'where':{'UserId':{'$in':_0x29ad4f},'VoiceQueueId':{'$in':_0x423b47}},'transaction':_0x296df1});})[_0x8af1('0x26')](function(){var _0x28cc4a=_0x8af1('0x5f')+_0x2e9b2b;return db['sequelize'][_0x8af1('0x33')](_0x28cc4a,{'type':db[_0x8af1('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x296df1});})[_0x8af1('0x26')](function(_0x3dde6e){var _0x5bae97=_[_0x8af1('0x2d')](_0x3dde6e,function(_0x208173){return Number(_0x208173[_0x8af1('0x60')]);});return db[_0x8af1('0x61')][_0x8af1('0x5e')]({'where':{'UserId':{'$in':_0x29ad4f},'MailQueueId':{'$in':_0x5bae97}},'transaction':_0x296df1});})['then'](function(){var _0x1b8146=_0x8af1('0x62')+_0x2e9b2b;return db[_0x8af1('0x56')][_0x8af1('0x33')](_0x1b8146,{'type':db['Sequelize']['QueryTypes'][_0x8af1('0x59')],'raw':!![],'transaction':_0x296df1});})[_0x8af1('0x26')](function(_0x2fe00e){var _0x25dd59=_[_0x8af1('0x2d')](_0x2fe00e,function(_0x5c753f){return Number(_0x5c753f['SmsQueueId']);});return db[_0x8af1('0x63')][_0x8af1('0x5e')]({'where':{'UserId':{'$in':_0x29ad4f},'SmsQueueId':{'$in':_0x25dd59}},'transaction':_0x296df1});})[_0x8af1('0x26')](function(){var _0x4a659a=_0x8af1('0x64')+_0x2e9b2b;return db[_0x8af1('0x56')][_0x8af1('0x33')](_0x4a659a,{'type':db['Sequelize'][_0x8af1('0x5c')][_0x8af1('0x59')],'raw':!![],'transaction':_0x296df1});})[_0x8af1('0x26')](function(_0x95f8d2){var _0x4d8f05=_['map'](_0x95f8d2,function(_0x56d708){return Number(_0x56d708[_0x8af1('0x65')]);});return db['UserChatQueue'][_0x8af1('0x5e')]({'where':{'UserId':{'$in':_0x29ad4f},'ChatQueueId':{'$in':_0x4d8f05}},'transaction':_0x296df1});})[_0x8af1('0x26')](function(){var _0x497e6d='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2e9b2b;return db[_0x8af1('0x56')]['query'](_0x497e6d,{'type':db['Sequelize'][_0x8af1('0x5c')]['SELECT'],'raw':!![],'transaction':_0x296df1});})[_0x8af1('0x26')](function(_0x213451){var _0x252bf6=_[_0x8af1('0x2d')](_0x213451,function(_0x33b1dc){return Number(_0x33b1dc['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x29ad4f},'FaxQueueId':{'$in':_0x252bf6}},'transaction':_0x296df1});})[_0x8af1('0x26')](function(){var _0x573f18=_0x8af1('0x66')+_0x2e9b2b;return db[_0x8af1('0x56')][_0x8af1('0x33')](_0x573f18,{'type':db[_0x8af1('0x58')][_0x8af1('0x5c')][_0x8af1('0x59')],'raw':!![],'transaction':_0x296df1});})['then'](function(_0x29500d){var _0x44173f=_[_0x8af1('0x2d')](_0x29500d,function(_0x3edb97){return Number(_0x3edb97[_0x8af1('0x67')]);});return db[_0x8af1('0x68')][_0x8af1('0x5e')]({'where':{'UserId':{'$in':_0x29ad4f},'OpenchannelQueueId':{'$in':_0x44173f}},'transaction':_0x296df1});})[_0x8af1('0x26')](function(){var _0x4e28ce=_0x8af1('0x69')+_0x2e9b2b;return db[_0x8af1('0x56')][_0x8af1('0x33')](_0x4e28ce,{'type':db[_0x8af1('0x58')][_0x8af1('0x5c')][_0x8af1('0x59')],'raw':!![],'transaction':_0x296df1});})[_0x8af1('0x26')](function(_0x1f2126){var _0x32dae4=_[_0x8af1('0x2d')](_0x1f2126,function(_0x136c32){return Number(_0x136c32[_0x8af1('0x6a')]);});return db[_0x8af1('0x6b')][_0x8af1('0x5e')]({'where':{'UserId':{'$in':_0x29ad4f},'WhatsappQueueId':{'$in':_0x32dae4}},'transaction':_0x296df1});})['then'](function(){return db[_0x8af1('0x6c')]['find']({'where':{'TeamId':_0x2e9b2b}});})[_0x8af1('0x26')](function(_0xcccf61){if(_0xcccf61===null){return;}return db[_0x8af1('0x6d')][_0x8af1('0x5e')]({'where':{'UserId':{'$in':_0x29ad4f},'VoicePrefixId':_0xcccf61[_0x8af1('0x6e')]},'transaction':_0x296df1});})[_0x8af1('0x26')](function(){return db[_0x8af1('0x43')][_0x8af1('0x5e')]({'where':{'id':_0x2e9b2b},'cascade':!![],'transaction':_0x296df1});})[_0x8af1('0x26')](function(_0x4d2614){if(_0x4d2614===0x0){_0x4c11bc['sendStatus'](0x194);}else{return db[_0x8af1('0x6f')][_0x8af1('0x5e')]({'where':{'type':_0x8af1('0x51'),'resourceId':_0x2e9b2b},'cascade':!![],'transaction':_0x296df1})[_0x8af1('0x26')](function(){_0x4c11bc['status'](0xcc)['end']();});}})[_0x8af1('0x55')](function(_0x1fe53d){_0x4c11bc['status'](0x1f4)[_0x8af1('0x2b')](_0x1fe53d);});});};exports['getQueues']=function(_0x51115e,_0xe11db,_0x520f84){return db[_0x8af1('0x43')][_0x8af1('0x70')]({'where':{'id':_0x51115e[_0x8af1('0x49')]['id']}})['then'](handleEntityNotFound(_0xe11db,null))[_0x8af1('0x26')](function(_0x46f7ba){if(!_0x51115e[_0x8af1('0x33')][_0x8af1('0x71')]||!utils[_0x8af1('0x72')](_0x51115e[_0x8af1('0x33')][_0x8af1('0x71')])){throw new db[(_0x8af1('0x58'))][(_0x8af1('0x73'))]('Unknown\x20channel');}var _0x5a78ba={};var _0x5a6be7={};_0x5a6be7[_0x8af1('0x32')]=_[_0x8af1('0x34')](db[_[_0x8af1('0x74')](_0x51115e[_0x8af1('0x33')][_0x8af1('0x71')]['toLowerCase']())+'Queue'][_0x8af1('0x2e')]);_0x5a6be7[_0x8af1('0x33')]=_[_0x8af1('0x34')](_0x51115e['query']);_0x5a6be7[_0x8af1('0x35')]=_['intersection'](_0x5a6be7[_0x8af1('0x32')],_0x5a6be7['query']);_0x5a78ba[_0x8af1('0x38')]=_[_0x8af1('0x36')](_0x5a6be7['model'],qs['fields'](_0x51115e['query'][_0x8af1('0x37')]));_0x5a78ba[_0x8af1('0x38')]=_0x5a78ba[_0x8af1('0x38')][_0x8af1('0x39')]?_0x5a78ba['attributes']:_0x5a6be7[_0x8af1('0x32')];_0x5a78ba[_0x8af1('0x20')]=qs[_0x8af1('0x20')](_0x51115e[_0x8af1('0x33')][_0x8af1('0x20')]);_0x5a78ba[_0x8af1('0x21')]=qs[_0x8af1('0x21')](_0x51115e[_0x8af1('0x33')]['offset']);_0x5a78ba[_0x8af1('0x3b')]=qs[_0x8af1('0x3c')](_0x51115e['query'][_0x8af1('0x3c')]);_0x5a78ba['where']=qs[_0x8af1('0x35')](_[_0x8af1('0x3e')](_0x51115e[_0x8af1('0x33')],_0x5a6be7[_0x8af1('0x35')]));_0x5a78ba=_[_0x8af1('0x40')]({},_0x5a78ba,_0x51115e[_0x8af1('0x42')]);return _0x46f7ba[_0x8af1('0x4e')+_['capitalize'](_0x51115e[_0x8af1('0x33')][_0x8af1('0x71')][_0x8af1('0x75')]())+'Queues'](_0x5a78ba);})[_0x8af1('0x26')](respondWithResult(_0xe11db,null))[_0x8af1('0x55')](handleError(_0xe11db,null));};exports[_0x8af1('0x76')]=function(_0x3674d4,_0x2bb1a2,_0x4a0de6){return db[_0x8af1('0x43')][_0x8af1('0x70')]({'where':{'id':_0x3674d4[_0x8af1('0x49')]['id']}})[_0x8af1('0x26')](function(_0x41e60e){if(_0x41e60e){if(!_0x3674d4['body'][_0x8af1('0x71')]||!utils[_0x8af1('0x72')](_0x3674d4[_0x8af1('0x4c')]['channel'])){throw new db[(_0x8af1('0x58'))][(_0x8af1('0x73'))]('Unknown\x20channel');}return _0x41e60e[_0x8af1('0x77')+_['capitalize'](_0x3674d4[_0x8af1('0x4c')][_0x8af1('0x71')][_0x8af1('0x75')]())+_0x8af1('0x78')](_0x3674d4[_0x8af1('0x4c')][_0x8af1('0x79')]);}return null;})[_0x8af1('0x26')](handleEntityNotFound(_0x2bb1a2,null))[_0x8af1('0x26')](respondWithStatusCode(_0x2bb1a2,null))[_0x8af1('0x55')](handleError(_0x2bb1a2,null));};exports[_0x8af1('0x7a')]=function(_0x9e281f,_0x1dbde9,_0x34adb5){return db[_0x8af1('0x43')][_0x8af1('0x70')]({'where':{'id':_0x9e281f[_0x8af1('0x49')]['id']}})[_0x8af1('0x26')](function(_0x58e626){if(_0x58e626){if(!_0x9e281f['query'][_0x8af1('0x71')]||!utils['isValidChannel'](_0x9e281f['query']['channel'])){throw new db[(_0x8af1('0x58'))][(_0x8af1('0x73'))]('Unknown\x20channel');}return _0x58e626[_0x8af1('0x7b')+_['capitalize'](_0x9e281f[_0x8af1('0x33')][_0x8af1('0x71')]['toLowerCase']())+_0x8af1('0x78')](_0x9e281f[_0x8af1('0x33')][_0x8af1('0x79')]);}return null;})[_0x8af1('0x26')](handleEntityNotFound(_0x1dbde9,null))['then'](respondWithStatusCode(_0x1dbde9,null))['catch'](handleError(_0x1dbde9,null));};exports[_0x8af1('0x7c')]=function(_0x4446bd,_0x3dcf50){var _0x122fa2=_[_0x8af1('0x7d')](_0x4446bd[_0x8af1('0x4c')]['ids'])?_0x4446bd['body'][_0x8af1('0x79')]:[_0x4446bd[_0x8af1('0x4c')]['ids']];var _0x1244a4=_0x4446bd[_0x8af1('0x49')]['id'];return db[_0x8af1('0x43')][_0x8af1('0x4a')]({'where':{'id':_0x1244a4}})[_0x8af1('0x26')](handleEntityNotFound(_0x3dcf50,null))['then'](function(_0x33d00f){if(_0x33d00f){var _0x37fbc6=[_0x8af1('0x7e'),_0x8af1('0x7f'),'Mail',_0x8af1('0x80'),_0x8af1('0x81'),_0x8af1('0x82'),_0x8af1('0x83')];return db[_0x8af1('0x56')][_0x8af1('0x84')](function(_0x5f486b){var _0x10f7d8=_[_0x8af1('0x2d')](_0x37fbc6,function(_0x476708){var _0x166a60={'attributes':['id','name']};if(_0x476708===_0x8af1('0x7e')){_0x166a60[_0x8af1('0x85')]={'attributes':[_0x8af1('0x86')]};}return _0x33d00f[_0x8af1('0x4e')+_0x476708+'Queues'](_0x166a60)[_0x8af1('0x26')](function(_0x1f74a3){var _0xbfa299=_[_0x8af1('0x2d')](_0x1f74a3,function(_0x37879d){var _0x575d0f=_['map'](_0x122fa2,function(_0x4acaa7){var _0x3576af={'where':{'UserId':_0x4acaa7,[_0x476708+_0x8af1('0x87')]:_0x37879d['id']},'transaction':_0x5f486b};if(_0x476708===_0x8af1('0x7e')){_0x3576af[_0x8af1('0x88')]={'penalty':_0x37879d['TeamVoiceQueue'][_0x8af1('0x86')]};}return db['User'+_0x476708+'Queue'][_0x8af1('0x89')](_0x3576af)[_0x8af1('0x26')](function(){socket[_0x8af1('0x8a')](_0x8af1('0x4d')+_0x476708+_0x8af1('0x8b'),{'UserId':_0x4acaa7,[_0x476708+_0x8af1('0x87')]:_0x37879d['id']});if(_0x476708!=='Voice'){return;}return db[_0x8af1('0x8c')][_0x8af1('0x46')]({'where':{'id':_0x122fa2,'online':0x1},'attributes':['id','name',_0x8af1('0x8d'),_0x8af1('0x8e'),_0x8af1('0x8f')],'raw':!![]})[_0x8af1('0x26')](function(_0x2e38c7){var _0x2f0250=_[_0x8af1('0x2d')](_0x2e38c7,function(_0x33888a){return db['UserVoiceQueueRt'][_0x8af1('0x90')]({'membername':_0x33888a[_0x8af1('0x2a')],'UserId':_0x33888a['id'],'queue_name':_0x37879d[_0x8af1('0x2a')],'VoiceQueueId':_0x37879d['id'],'interface':_[_0x8af1('0x91')](_0x33888a['interface'])?util[_0x8af1('0x92')](_0x8af1('0x93'),_0x33888a[_0x8af1('0x2a')]):_0x33888a[_0x8af1('0x8f')],'paused':_0x33888a[_0x8af1('0x8e')]||![],'penalty':_0x37879d[_0x8af1('0x94')][_0x8af1('0x86')]},{'transaction':_0x5f486b});});return Promise[_0x8af1('0x95')](_0x2f0250);});});});return Promise[_0x8af1('0x95')](_0x575d0f);});return Promise[_0x8af1('0x95')](_0xbfa299);})[_0x8af1('0x26')](function(){return db[_0x8af1('0x6c')][_0x8af1('0x70')]({'where':{'teamId':_0x1244a4}})[_0x8af1('0x26')](function(_0x2b5cc7){if(_0x2b5cc7){var _0x37842b=_[_0x8af1('0x2d')](_0x122fa2,function(_0x20773b){db[_0x8af1('0x6d')]['upsert']({'UserId':_0x20773b,'VoicePrefixId':_0x2b5cc7[_0x8af1('0x6e')]});});return Promise['all'](_0x37842b);}});});});return Promise['all'](_0x10f7d8)[_0x8af1('0x26')](function(){return _0x33d00f[_0x8af1('0x7c')](_0x122fa2,{'transaction':_0x5f486b})[_0x8af1('0x96')](function(_0x14a07d){return _0x14a07d;});});});}})[_0x8af1('0x26')](respondWithResult(_0x3dcf50,null))[_0x8af1('0x55')](handleError(_0x3dcf50,null));};exports[_0x8af1('0x97')]=function(_0x3990dd,_0x3c8d74){var _0x3bebee=_[_0x8af1('0x7d')](_0x3990dd[_0x8af1('0x33')][_0x8af1('0x79')])?_0x3990dd[_0x8af1('0x33')]['ids']:[_0x3990dd['query'][_0x8af1('0x79')]];var _0x35f278=_0x3990dd[_0x8af1('0x49')]['id'];return db['Team'][_0x8af1('0x4a')]({'where':{'id':_0x35f278}})[_0x8af1('0x26')](handleEntityNotFound(_0x3c8d74,null))[_0x8af1('0x26')](function(_0x1fc935){if(_0x1fc935){var _0xf95799=[_0x8af1('0x7e'),'Chat',_0x8af1('0x98'),_0x8af1('0x80'),'Fax',_0x8af1('0x82'),'Whatsapp'];return db[_0x8af1('0x56')][_0x8af1('0x84')](function(_0x4d2d9f){var _0x54f218=_['map'](_0xf95799,function(_0x48b566){var _0x3e4409={'attributes':['id',_0x8af1('0x2a')]};return _0x1fc935['get'+_0x48b566+_0x8af1('0x78')](_0x3e4409)[_0x8af1('0x26')](function(_0x905a95){var _0x119a32=_[_0x8af1('0x2d')](_0x905a95,function(_0x447f18){return _0x447f18[_0x8af1('0x97')](_0x3bebee,{'transaction':_0x4d2d9f})['then'](function(){var _0x27825b=_['map'](_0x3bebee,function(_0x4b4c57){socket['emit']('user'+_0x48b566+_0x8af1('0x99'),{'UserId':Number(_0x4b4c57),[_0x48b566+'QueueId']:_0x447f18['id']});if(_0x48b566!==_0x8af1('0x7e')){return;}return db[_0x8af1('0x9a')][_0x8af1('0x5e')]({'where':{'VoiceQueueId':_0x447f18['id'],'UserId':_0x4b4c57},'transaction':_0x4d2d9f});});return Promise[_0x8af1('0x95')](_0x27825b);});});return Promise['all'](_0x119a32);});});return Promise[_0x8af1('0x95')](_0x54f218)['then'](function(){return _0x1fc935['removeAgents'](_0x3bebee,{'transaction':_0x4d2d9f});})[_0x8af1('0x26')](function(){return db[_0x8af1('0x6c')][_0x8af1('0x70')]({'where':{'teamId':_0x35f278}})[_0x8af1('0x26')](function(_0xc432fa){if(_0xc432fa){var _0x503a0c=_['map'](_0x3bebee,function(_0x41c38a){db[_0x8af1('0x6d')][_0x8af1('0x5e')]({'where':{'UserId':_0x41c38a,'VoicePrefixId':_0xc432fa[_0x8af1('0x6e')]}});});return Promise[_0x8af1('0x95')](_0x503a0c);}});});});}})[_0x8af1('0x26')](respondWithStatusCode(_0x3c8d74,null))[_0x8af1('0x55')](handleError(_0x3c8d74,null));};exports[_0x8af1('0x9b')]=function(_0x2a30b4,_0x31b057,_0x32da4a){var _0x553ebb={};var _0x53e2e6={};var _0x1b7d59;var _0x527ae5;return db[_0x8af1('0x43')][_0x8af1('0x70')]({'where':{'id':_0x2a30b4[_0x8af1('0x49')]['id']}})[_0x8af1('0x26')](handleEntityNotFound(_0x31b057,null))['then'](function(_0x48898e){if(_0x48898e){_0x1b7d59=_0x48898e;_0x53e2e6[_0x8af1('0x32')]=_[_0x8af1('0x34')](db['User'][_0x8af1('0x2e')]);_0x53e2e6[_0x8af1('0x33')]=_[_0x8af1('0x34')](_0x2a30b4['query']);_0x53e2e6[_0x8af1('0x35')]=_[_0x8af1('0x36')](_0x53e2e6['model'],_0x53e2e6['query']);_0x553ebb[_0x8af1('0x38')]=_['intersection'](_0x53e2e6['model'],qs[_0x8af1('0x37')](_0x2a30b4[_0x8af1('0x33')][_0x8af1('0x37')]));_0x553ebb['attributes']=_0x553ebb[_0x8af1('0x38')][_0x8af1('0x39')]?_0x553ebb[_0x8af1('0x38')]:_0x53e2e6[_0x8af1('0x32')];_0x553ebb[_0x8af1('0x3b')]=qs[_0x8af1('0x3c')](_0x2a30b4[_0x8af1('0x33')][_0x8af1('0x3c')]);_0x553ebb[_0x8af1('0x3d')]=qs[_0x8af1('0x35')](_[_0x8af1('0x3e')](_0x2a30b4['query'],_0x53e2e6[_0x8af1('0x35')]));if(_0x2a30b4[_0x8af1('0x33')][_0x8af1('0x3f')]){_0x553ebb[_0x8af1('0x3d')]=_[_0x8af1('0x40')](_0x553ebb[_0x8af1('0x3d')],{'$or':_['map'](_0x553ebb[_0x8af1('0x38')],function(_0x508bf6){var _0x5d5d25={};_0x5d5d25[_0x508bf6]={'$like':'%'+_0x2a30b4[_0x8af1('0x33')][_0x8af1('0x3f')]+'%'};return _0x5d5d25;})});}_0x553ebb=_[_0x8af1('0x40')]({},_0x553ebb,_0x2a30b4['options']);return _0x1b7d59[_0x8af1('0x9b')](_0x553ebb);}})[_0x8af1('0x26')](function(_0x26de6d){if(_0x26de6d){_0x527ae5=_0x26de6d[_0x8af1('0x39')];if(!_0x2a30b4['query'][_0x8af1('0x9c')](_0x8af1('0x3a'))){_0x553ebb[_0x8af1('0x20')]=qs[_0x8af1('0x20')](_0x2a30b4[_0x8af1('0x33')][_0x8af1('0x20')]);_0x553ebb['offset']=qs['offset'](_0x2a30b4[_0x8af1('0x33')][_0x8af1('0x21')]);}return _0x1b7d59[_0x8af1('0x9b')](_0x553ebb);}})[_0x8af1('0x26')](function(_0x9f5f1a){if(_0x9f5f1a){return _0x9f5f1a?{'count':_0x527ae5,'rows':_0x9f5f1a}:null;}})[_0x8af1('0x26')](respondWithResult(_0x31b057,null))['catch'](handleError(_0x31b057,null));}; \ No newline at end of file +var _0xa172=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Team','includeAll','include','findAll','catch','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','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','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','findOne','ids','remove','addAgents','isArray','Sms','Fax','Whatsapp','penalty','Voice','defaults','TeamVoiceQueue','findOrCreate','emit','QueueId','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','VoicePrefixId','spread','removeAgents','Chat','Mail','Openchannel','Queue:remove','TeamVoicePrefix','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0xa172,0x9a));var _0x2a17=function(_0x56f960,_0x2f2e8f){_0x56f960=_0x56f960-0x0;var _0x41d128=_0xa172[_0x56f960];return _0x41d128;};'use strict';var emlformat=require(_0x2a17('0x0'));var rimraf=require(_0x2a17('0x1'));var zipdir=require(_0x2a17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a17('0x3'));var moment=require(_0x2a17('0x4'));var BPromise=require(_0x2a17('0x5'));var Mustache=require(_0x2a17('0x6'));var util=require('util');var path=require(_0x2a17('0x7'));var sox=require(_0x2a17('0x8'));var csv=require(_0x2a17('0x9'));var ejs=require(_0x2a17('0xa'));var fs=require('fs');var fs_extra=require(_0x2a17('0xb'));var _=require(_0x2a17('0xc'));var squel=require(_0x2a17('0xd'));var crypto=require(_0x2a17('0xe'));var jsforce=require(_0x2a17('0xf'));var deskjs=require(_0x2a17('0x10'));var toCsv=require(_0x2a17('0x9'));var querystring=require(_0x2a17('0x11'));var Papa=require(_0x2a17('0x12'));var Redis=require(_0x2a17('0x13'));var authService=require(_0x2a17('0x14'));var qs=require(_0x2a17('0x15'));var as=require(_0x2a17('0x16'));var hardwareService=require(_0x2a17('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2a17('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2a17('0x19'));var db=require('../../mysqldb')['db'];config[_0x2a17('0x1a')]=_['defaults'](config[_0x2a17('0x1a')],{'host':_0x2a17('0x1b'),'port':0x18eb});var socket=require(_0x2a17('0x1c'))(new Redis(config[_0x2a17('0x1a')]));require(_0x2a17('0x1d'))[_0x2a17('0x1e')](socket);function respondWithStatusCode(_0x42c725,_0x25794f){_0x25794f=_0x25794f||0xcc;return function(_0x312083){if(_0x312083){return _0x42c725[_0x2a17('0x1f')](_0x25794f);}return _0x42c725[_0x2a17('0x20')](_0x25794f)[_0x2a17('0x21')]();};}function respondWithResult(_0x5395bc,_0x47e165){_0x47e165=_0x47e165||0xc8;return function(_0x5a9754){if(_0x5a9754){return _0x5395bc[_0x2a17('0x20')](_0x47e165)[_0x2a17('0x22')](_0x5a9754);}};}function respondWithFilteredResult(_0x4fc4ca,_0x345b14){return function(_0x30d5e2){if(_0x30d5e2){var _0x54f362=typeof _0x345b14[_0x2a17('0x23')]===_0x2a17('0x24')&&typeof _0x345b14[_0x2a17('0x25')]===_0x2a17('0x24');var _0xf4154c=_0x30d5e2[_0x2a17('0x26')];var _0x3b629e=_0x54f362?0x0:_0x345b14['offset'];var _0x41367c=_0x54f362?_0x30d5e2[_0x2a17('0x26')]:_0x345b14['offset']+_0x345b14[_0x2a17('0x25')];var _0x2b2e0f;if(_0x41367c>=_0xf4154c){_0x41367c=_0xf4154c;_0x2b2e0f=0xc8;}else{_0x2b2e0f=0xce;}_0x4fc4ca['status'](_0x2b2e0f);return _0x4fc4ca[_0x2a17('0x27')](_0x2a17('0x28'),_0x3b629e+'-'+_0x41367c+'/'+_0xf4154c)[_0x2a17('0x22')](_0x30d5e2);}return null;};}function patchUpdates(_0x5574f0){return function(_0x4774aa){try{jsonpatch[_0x2a17('0x29')](_0x4774aa,_0x5574f0,!![]);}catch(_0x2042d7){return BPromise[_0x2a17('0x2a')](_0x2042d7);}return _0x4774aa[_0x2a17('0x2b')]();};}function saveUpdates(_0x237678,_0x209ce4){return function(_0x52b2e9){if(_0x52b2e9){return _0x52b2e9[_0x2a17('0x2c')](_0x237678)[_0x2a17('0x2d')](function(_0x4bffb6){return _0x4bffb6;});}return null;};}function handleEntityNotFound(_0x3958ae,_0x200443){return function(_0x44c623){if(!_0x44c623){_0x3958ae[_0x2a17('0x1f')](0x194);}return _0x44c623;};}function handleError(_0x5983d1,_0x134f00){_0x134f00=_0x134f00||0x1f4;return function(_0x279432){logger['error'](_0x279432[_0x2a17('0x2e')]);if(_0x279432[_0x2a17('0x2f')]){delete _0x279432[_0x2a17('0x2f')];}_0x5983d1[_0x2a17('0x20')](_0x134f00)[_0x2a17('0x30')](_0x279432);};}exports[_0x2a17('0x31')]=function(_0x4ce3cd,_0xf1ccc){var _0x344491={},_0x3d5a3b={},_0x5c2734={'count':0x0,'rows':[]};var _0x3f2213=_['map'](db['Team'][_0x2a17('0x32')],function(_0x57975a){return{'name':_0x57975a[_0x2a17('0x33')],'type':_0x57975a['type'][_0x2a17('0x34')]};});_0x3d5a3b['model']=_[_0x2a17('0x35')](_0x3f2213,_0x2a17('0x2f'));_0x3d5a3b[_0x2a17('0x36')]=_[_0x2a17('0x37')](_0x4ce3cd[_0x2a17('0x36')]);_0x3d5a3b[_0x2a17('0x38')]=_[_0x2a17('0x39')](_0x3d5a3b[_0x2a17('0x3a')],_0x3d5a3b[_0x2a17('0x36')]);_0x344491['attributes']=_['intersection'](_0x3d5a3b[_0x2a17('0x3a')],qs['fields'](_0x4ce3cd[_0x2a17('0x36')][_0x2a17('0x3b')]));_0x344491[_0x2a17('0x3c')]=_0x344491['attributes'][_0x2a17('0x3d')]?_0x344491[_0x2a17('0x3c')]:_0x3d5a3b[_0x2a17('0x3a')];if(!_0x4ce3cd['query'][_0x2a17('0x3e')](_0x2a17('0x3f'))){_0x344491['limit']=qs['limit'](_0x4ce3cd[_0x2a17('0x36')][_0x2a17('0x25')]);_0x344491[_0x2a17('0x23')]=qs[_0x2a17('0x23')](_0x4ce3cd[_0x2a17('0x36')][_0x2a17('0x23')]);}_0x344491[_0x2a17('0x40')]=qs[_0x2a17('0x41')](_0x4ce3cd[_0x2a17('0x36')][_0x2a17('0x41')]);_0x344491[_0x2a17('0x42')]=qs[_0x2a17('0x38')](_[_0x2a17('0x43')](_0x4ce3cd[_0x2a17('0x36')],_0x3d5a3b['filters']),_0x3f2213);if(_0x4ce3cd[_0x2a17('0x36')][_0x2a17('0x44')]){_0x344491[_0x2a17('0x42')]=_['merge'](_0x344491[_0x2a17('0x42')],{'$or':_[_0x2a17('0x35')](_0x3f2213,function(_0x253ea5){if(_0x253ea5[_0x2a17('0x45')]!==_0x2a17('0x46')){var _0xfdcecb={};_0xfdcecb[_0x253ea5[_0x2a17('0x2f')]]={'$like':'%'+_0x4ce3cd[_0x2a17('0x36')][_0x2a17('0x44')]+'%'};return _0xfdcecb;}})});}_0x344491=_[_0x2a17('0x47')]({},_0x344491,_0x4ce3cd[_0x2a17('0x48')]);var _0x9668fc={'where':_0x344491[_0x2a17('0x42')]};return db[_0x2a17('0x49')][_0x2a17('0x26')](_0x9668fc)[_0x2a17('0x2d')](function(_0x282a23){_0x5c2734[_0x2a17('0x26')]=_0x282a23;if(_0x4ce3cd[_0x2a17('0x36')][_0x2a17('0x4a')]){_0x344491[_0x2a17('0x4b')]=[{'all':!![]}];}return db[_0x2a17('0x49')][_0x2a17('0x4c')](_0x344491);})['then'](function(_0x6dd4e6){_0x5c2734['rows']=_0x6dd4e6;return _0x5c2734;})[_0x2a17('0x2d')](respondWithFilteredResult(_0xf1ccc,_0x344491))[_0x2a17('0x4d')](handleError(_0xf1ccc,null));};exports['show']=function(_0x360c8c,_0x3b9f53){var _0x543b1c={'raw':![],'where':{'id':_0x360c8c[_0x2a17('0x4e')]['id']}},_0x17b18f={};_0x17b18f[_0x2a17('0x3a')]=_[_0x2a17('0x37')](db['Team'][_0x2a17('0x32')]);_0x17b18f[_0x2a17('0x36')]=_[_0x2a17('0x37')](_0x360c8c['query']);_0x17b18f[_0x2a17('0x38')]=_['intersection'](_0x17b18f['model'],_0x17b18f[_0x2a17('0x36')]);_0x543b1c[_0x2a17('0x3c')]=_[_0x2a17('0x39')](_0x17b18f[_0x2a17('0x3a')],qs['fields'](_0x360c8c[_0x2a17('0x36')][_0x2a17('0x3b')]));_0x543b1c[_0x2a17('0x3c')]=_0x543b1c[_0x2a17('0x3c')][_0x2a17('0x3d')]?_0x543b1c['attributes']:_0x17b18f[_0x2a17('0x3a')];if(_0x360c8c['query']['includeAll']){_0x543b1c['include']=[{'all':!![]}];}_0x543b1c=_['merge']({},_0x543b1c,_0x360c8c[_0x2a17('0x48')]);return db[_0x2a17('0x49')]['find'](_0x543b1c)[_0x2a17('0x2d')](handleEntityNotFound(_0x3b9f53,null))['then'](respondWithResult(_0x3b9f53,null))[_0x2a17('0x4d')](handleError(_0x3b9f53,null));};exports[_0x2a17('0x4f')]=function(_0x3ba919,_0x5c160c){return db['Team'][_0x2a17('0x4f')](_0x3ba919['body'],{})[_0x2a17('0x2d')](function(_0xcce1f7){var _0x4988f7=_0x3ba919[_0x2a17('0x50')][_0x2a17('0x51')]({'plain':!![]});if(!_0x4988f7)throw new Error(_0x2a17('0x52'));if(_0x4988f7[_0x2a17('0x53')]===_0x2a17('0x50')){var _0x595e5e=_0xcce1f7[_0x2a17('0x51')]({'plain':!![]});var _0x15ad3b=_0x2a17('0x54');return db[_0x2a17('0x55')][_0x2a17('0x56')]({'where':{'name':_0x15ad3b,'userProfileId':_0x4988f7[_0x2a17('0x57')]},'raw':!![]})['then'](function(_0x3223ae){if(_0x3223ae&&_0x3223ae[_0x2a17('0x58')]===0x0){return db[_0x2a17('0x59')][_0x2a17('0x4f')]({'name':_0x595e5e[_0x2a17('0x2f')],'resourceId':_0x595e5e['id'],'type':_0x3223ae[_0x2a17('0x2f')],'sectionId':_0x3223ae['id']},{})[_0x2a17('0x2d')](function(){return _0xcce1f7;});}else{return _0xcce1f7;}})['catch'](function(_0x182528){logger[_0x2a17('0x5a')](_0x2a17('0x5b'),_0x182528);throw _0x182528;});}return _0xcce1f7;})[_0x2a17('0x2d')](respondWithResult(_0x5c160c,0xc9))[_0x2a17('0x4d')](handleError(_0x5c160c,null));};exports['update']=function(_0xc43910,_0x48381d){if(_0xc43910['body']['id']){delete _0xc43910[_0x2a17('0x5c')]['id'];}return db[_0x2a17('0x49')]['find']({'where':{'id':_0xc43910[_0x2a17('0x4e')]['id']}})[_0x2a17('0x2d')](handleEntityNotFound(_0x48381d,null))[_0x2a17('0x2d')](saveUpdates(_0xc43910[_0x2a17('0x5c')],null))[_0x2a17('0x2d')](respondWithResult(_0x48381d,null))[_0x2a17('0x4d')](handleError(_0x48381d,null));};exports['destroy']=function(_0x23d5a4,_0x2e5283){var _0x93c445=_0x23d5a4[_0x2a17('0x4e')]['id'];var _0x383bb8=[];return db[_0x2a17('0x5d')][_0x2a17('0x5e')](function(_0x25204d){var _0x23ba78=_0x2a17('0x5f')+_0x93c445;return db['sequelize'][_0x2a17('0x36')](_0x23ba78,{'type':db[_0x2a17('0x60')][_0x2a17('0x61')][_0x2a17('0x62')],'raw':!![],'transaction':_0x25204d})[_0x2a17('0x2d')](function(_0xbe7905){_0x383bb8=_[_0x2a17('0x35')](_0xbe7905,function(_0x114ba0){return Number(_0x114ba0[_0x2a17('0x63')]);});})[_0x2a17('0x2d')](function(){var _0x5d6c4b=_0x2a17('0x64')+_0x93c445;return db[_0x2a17('0x5d')]['query'](_0x5d6c4b,{'type':db[_0x2a17('0x60')][_0x2a17('0x61')][_0x2a17('0x62')],'raw':!![],'transaction':_0x25204d});})['then'](function(_0xc86ce5){var _0x3d2eb3=_[_0x2a17('0x35')](_0xc86ce5,function(_0x421290){return Number(_0x421290['VoiceQueueId']);});return db[_0x2a17('0x65')][_0x2a17('0x66')]({'where':{'UserId':{'$in':_0x383bb8},'VoiceQueueId':{'$in':_0x3d2eb3}},'transaction':_0x25204d});})[_0x2a17('0x2d')](function(){var _0x48b837=_0x2a17('0x67')+_0x93c445;return db[_0x2a17('0x5d')][_0x2a17('0x36')](_0x48b837,{'type':db[_0x2a17('0x60')]['QueryTypes'][_0x2a17('0x62')],'raw':!![],'transaction':_0x25204d});})['then'](function(_0x57d05b){var _0x4724a4=_[_0x2a17('0x35')](_0x57d05b,function(_0x187500){return Number(_0x187500[_0x2a17('0x68')]);});return db[_0x2a17('0x69')][_0x2a17('0x66')]({'where':{'UserId':{'$in':_0x383bb8},'MailQueueId':{'$in':_0x4724a4}},'transaction':_0x25204d});})[_0x2a17('0x2d')](function(){var _0x3740ab=_0x2a17('0x6a')+_0x93c445;return db[_0x2a17('0x5d')][_0x2a17('0x36')](_0x3740ab,{'type':db[_0x2a17('0x60')][_0x2a17('0x61')]['SELECT'],'raw':!![],'transaction':_0x25204d});})[_0x2a17('0x2d')](function(_0x29d7a1){var _0x28cfb6=_[_0x2a17('0x35')](_0x29d7a1,function(_0x3f83b6){return Number(_0x3f83b6['SmsQueueId']);});return db['UserSmsQueue'][_0x2a17('0x66')]({'where':{'UserId':{'$in':_0x383bb8},'SmsQueueId':{'$in':_0x28cfb6}},'transaction':_0x25204d});})[_0x2a17('0x2d')](function(){var _0x5c4e01='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x93c445;return db[_0x2a17('0x5d')][_0x2a17('0x36')](_0x5c4e01,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x25204d});})['then'](function(_0x23c0f0){var _0x21f06e=_[_0x2a17('0x35')](_0x23c0f0,function(_0x5a73ee){return Number(_0x5a73ee[_0x2a17('0x6b')]);});return db[_0x2a17('0x6c')][_0x2a17('0x66')]({'where':{'UserId':{'$in':_0x383bb8},'ChatQueueId':{'$in':_0x21f06e}},'transaction':_0x25204d});})[_0x2a17('0x2d')](function(){var _0x2cfac2=_0x2a17('0x6d')+_0x93c445;return db['sequelize'][_0x2a17('0x36')](_0x2cfac2,{'type':db[_0x2a17('0x60')][_0x2a17('0x61')]['SELECT'],'raw':!![],'transaction':_0x25204d});})[_0x2a17('0x2d')](function(_0xcc8bf0){var _0x2c6447=_[_0x2a17('0x35')](_0xcc8bf0,function(_0x398d5){return Number(_0x398d5[_0x2a17('0x6e')]);});return db[_0x2a17('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x383bb8},'FaxQueueId':{'$in':_0x2c6447}},'transaction':_0x25204d});})['then'](function(){var _0x1d9e37=_0x2a17('0x70')+_0x93c445;return db[_0x2a17('0x5d')]['query'](_0x1d9e37,{'type':db[_0x2a17('0x60')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x25204d});})['then'](function(_0xe06f9b){var _0x31d7ec=_[_0x2a17('0x35')](_0xe06f9b,function(_0x57cefe){return Number(_0x57cefe[_0x2a17('0x71')]);});return db[_0x2a17('0x72')]['destroy']({'where':{'UserId':{'$in':_0x383bb8},'OpenchannelQueueId':{'$in':_0x31d7ec}},'transaction':_0x25204d});})[_0x2a17('0x2d')](function(){var _0x4398da=_0x2a17('0x73')+_0x93c445;return db[_0x2a17('0x5d')][_0x2a17('0x36')](_0x4398da,{'type':db[_0x2a17('0x60')]['QueryTypes'][_0x2a17('0x62')],'raw':!![],'transaction':_0x25204d});})['then'](function(_0x2937c9){var _0x392cbf=_[_0x2a17('0x35')](_0x2937c9,function(_0x27ad8f){return Number(_0x27ad8f[_0x2a17('0x74')]);});return db[_0x2a17('0x75')][_0x2a17('0x66')]({'where':{'UserId':{'$in':_0x383bb8},'WhatsappQueueId':{'$in':_0x392cbf}},'transaction':_0x25204d});})['then'](function(){return db['TeamVoicePrefix'][_0x2a17('0x56')]({'where':{'TeamId':_0x93c445}});})[_0x2a17('0x2d')](function(_0x338e87){if(_0x338e87===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x383bb8},'VoicePrefixId':_0x338e87['VoicePrefixId']},'transaction':_0x25204d});})[_0x2a17('0x2d')](function(){return db[_0x2a17('0x49')]['destroy']({'where':{'id':_0x93c445},'cascade':!![],'transaction':_0x25204d});})[_0x2a17('0x2d')](function(_0x1a188b){if(_0x1a188b===0x0){_0x2e5283[_0x2a17('0x1f')](0x194);}else{return db[_0x2a17('0x59')]['destroy']({'where':{'type':_0x2a17('0x54'),'resourceId':_0x93c445},'cascade':!![],'transaction':_0x25204d})[_0x2a17('0x2d')](function(){_0x2e5283['status'](0xcc)[_0x2a17('0x21')]();});}})[_0x2a17('0x4d')](function(_0x7001f3){_0x2e5283['status'](0x1f4)[_0x2a17('0x30')](_0x7001f3);});});};exports['getQueues']=function(_0x32153e,_0x44a7be,_0x2eb611){return db[_0x2a17('0x49')]['findOne']({'where':{'id':_0x32153e[_0x2a17('0x4e')]['id']}})['then'](handleEntityNotFound(_0x44a7be,null))[_0x2a17('0x2d')](function(_0x55d69c){if(!_0x32153e[_0x2a17('0x36')][_0x2a17('0x76')]||!utils[_0x2a17('0x77')](_0x32153e[_0x2a17('0x36')][_0x2a17('0x76')])){throw new db['Sequelize'][(_0x2a17('0x78'))](_0x2a17('0x79'));}var _0x5ad0a3={};var _0x54b0b5={};_0x54b0b5[_0x2a17('0x3a')]=_['keys'](db[_[_0x2a17('0x7a')](_0x32153e[_0x2a17('0x36')]['channel'][_0x2a17('0x7b')]())+_0x2a17('0x7c')][_0x2a17('0x32')]);_0x54b0b5[_0x2a17('0x36')]=_[_0x2a17('0x37')](_0x32153e[_0x2a17('0x36')]);_0x54b0b5[_0x2a17('0x38')]=_['intersection'](_0x54b0b5[_0x2a17('0x3a')],_0x54b0b5['query']);_0x5ad0a3[_0x2a17('0x3c')]=_['intersection'](_0x54b0b5[_0x2a17('0x3a')],qs[_0x2a17('0x3b')](_0x32153e[_0x2a17('0x36')][_0x2a17('0x3b')]));_0x5ad0a3[_0x2a17('0x3c')]=_0x5ad0a3[_0x2a17('0x3c')][_0x2a17('0x3d')]?_0x5ad0a3[_0x2a17('0x3c')]:_0x54b0b5[_0x2a17('0x3a')];_0x5ad0a3['limit']=qs[_0x2a17('0x25')](_0x32153e['query'][_0x2a17('0x25')]);_0x5ad0a3[_0x2a17('0x23')]=qs[_0x2a17('0x23')](_0x32153e['query'][_0x2a17('0x23')]);_0x5ad0a3[_0x2a17('0x40')]=qs[_0x2a17('0x41')](_0x32153e[_0x2a17('0x36')][_0x2a17('0x41')]);_0x5ad0a3[_0x2a17('0x42')]=qs['filters'](_['pick'](_0x32153e[_0x2a17('0x36')],_0x54b0b5[_0x2a17('0x38')]));_0x5ad0a3=_[_0x2a17('0x47')]({},_0x5ad0a3,_0x32153e[_0x2a17('0x48')]);return _0x55d69c[_0x2a17('0x51')+_['capitalize'](_0x32153e[_0x2a17('0x36')][_0x2a17('0x76')][_0x2a17('0x7b')]())+_0x2a17('0x7d')](_0x5ad0a3);})[_0x2a17('0x2d')](respondWithResult(_0x44a7be,null))[_0x2a17('0x4d')](handleError(_0x44a7be,null));};exports['addQueues']=function(_0x439d78,_0x3967fc,_0x58a2ff){return db['Team'][_0x2a17('0x7e')]({'where':{'id':_0x439d78[_0x2a17('0x4e')]['id']}})[_0x2a17('0x2d')](function(_0x23de08){if(_0x23de08){if(!_0x439d78[_0x2a17('0x5c')][_0x2a17('0x76')]||!utils[_0x2a17('0x77')](_0x439d78['body'][_0x2a17('0x76')])){throw new db['Sequelize'][(_0x2a17('0x78'))]('Unknown\x20channel');}return _0x23de08['add'+_[_0x2a17('0x7a')](_0x439d78[_0x2a17('0x5c')]['channel'][_0x2a17('0x7b')]())+_0x2a17('0x7d')](_0x439d78[_0x2a17('0x5c')][_0x2a17('0x7f')]);}return null;})[_0x2a17('0x2d')](handleEntityNotFound(_0x3967fc,null))[_0x2a17('0x2d')](respondWithStatusCode(_0x3967fc,null))['catch'](handleError(_0x3967fc,null));};exports['removeQueues']=function(_0x9f762b,_0x2af9a4,_0x2afb29){return db[_0x2a17('0x49')][_0x2a17('0x7e')]({'where':{'id':_0x9f762b[_0x2a17('0x4e')]['id']}})[_0x2a17('0x2d')](function(_0x4b442c){if(_0x4b442c){if(!_0x9f762b[_0x2a17('0x36')][_0x2a17('0x76')]||!utils[_0x2a17('0x77')](_0x9f762b[_0x2a17('0x36')][_0x2a17('0x76')])){throw new db[(_0x2a17('0x60'))][(_0x2a17('0x78'))](_0x2a17('0x79'));}return _0x4b442c[_0x2a17('0x80')+_[_0x2a17('0x7a')](_0x9f762b[_0x2a17('0x36')][_0x2a17('0x76')][_0x2a17('0x7b')]())+'Queues'](_0x9f762b['query'][_0x2a17('0x7f')]);}return null;})[_0x2a17('0x2d')](handleEntityNotFound(_0x2af9a4,null))[_0x2a17('0x2d')](respondWithStatusCode(_0x2af9a4,null))[_0x2a17('0x4d')](handleError(_0x2af9a4,null));};exports[_0x2a17('0x81')]=function(_0xd0bc8e,_0x2cb58d){var _0x486ac0=_[_0x2a17('0x82')](_0xd0bc8e['body'][_0x2a17('0x7f')])?_0xd0bc8e[_0x2a17('0x5c')][_0x2a17('0x7f')]:[_0xd0bc8e['body'][_0x2a17('0x7f')]];var _0x1b742f=_0xd0bc8e[_0x2a17('0x4e')]['id'];return db['Team'][_0x2a17('0x56')]({'where':{'id':_0x1b742f}})[_0x2a17('0x2d')](handleEntityNotFound(_0x2cb58d,null))[_0x2a17('0x2d')](function(_0x1bddcb){if(_0x1bddcb){var _0x3d9f15=['Voice','Chat','Mail',_0x2a17('0x83'),_0x2a17('0x84'),'Openchannel',_0x2a17('0x85')];return db[_0x2a17('0x5d')]['transaction'](function(_0x291649){var _0x2a5f90=_['map'](_0x3d9f15,function(_0x181b41){var _0x993433={'attributes':['id',_0x2a17('0x2f')]};if(_0x181b41==='Voice'){_0x993433['through']={'attributes':[_0x2a17('0x86')]};}return _0x1bddcb[_0x2a17('0x51')+_0x181b41+_0x2a17('0x7d')](_0x993433)[_0x2a17('0x2d')](function(_0x2982aa){var _0x1ae816=_['map'](_0x2982aa,function(_0x18e28e){var _0x4ef575=_[_0x2a17('0x35')](_0x486ac0,function(_0x1d437b){var _0x3a2172={'where':{'UserId':_0x1d437b,[_0x181b41+'QueueId']:_0x18e28e['id']},'transaction':_0x291649};if(_0x181b41===_0x2a17('0x87')){_0x3a2172[_0x2a17('0x88')]={'penalty':_0x18e28e[_0x2a17('0x89')][_0x2a17('0x86')]};}return db['User'+_0x181b41+'Queue'][_0x2a17('0x8a')](_0x3a2172)['then'](function(){socket[_0x2a17('0x8b')](_0x2a17('0x50')+_0x181b41+'Queue:save',{'UserId':_0x1d437b,[_0x181b41+_0x2a17('0x8c')]:_0x18e28e['id']});if(_0x181b41!==_0x2a17('0x87')){return;}return db[_0x2a17('0x8d')][_0x2a17('0x4c')]({'where':{'id':_0x486ac0,'online':0x1},'attributes':['id',_0x2a17('0x2f'),_0x2a17('0x8e'),_0x2a17('0x8f'),_0x2a17('0x90')],'raw':!![]})[_0x2a17('0x2d')](function(_0x309336){var _0x100aa2=_[_0x2a17('0x35')](_0x309336,function(_0x1d2b38){return db[_0x2a17('0x91')][_0x2a17('0x92')]({'membername':_0x1d2b38[_0x2a17('0x2f')],'UserId':_0x1d2b38['id'],'queue_name':_0x18e28e['name'],'VoiceQueueId':_0x18e28e['id'],'interface':_[_0x2a17('0x93')](_0x1d2b38[_0x2a17('0x90')])?util[_0x2a17('0x94')](_0x2a17('0x95'),_0x1d2b38['name']):_0x1d2b38[_0x2a17('0x90')],'paused':_0x1d2b38[_0x2a17('0x8f')]||![],'penalty':_0x18e28e[_0x2a17('0x89')]['penalty']},{'transaction':_0x291649});});return Promise[_0x2a17('0x96')](_0x100aa2);});});});return Promise[_0x2a17('0x96')](_0x4ef575);});return Promise[_0x2a17('0x96')](_0x1ae816);})[_0x2a17('0x2d')](function(){return db['TeamVoicePrefix'][_0x2a17('0x7e')]({'where':{'teamId':_0x1b742f}})[_0x2a17('0x2d')](function(_0x101260){if(_0x101260){var _0x239cd6=_[_0x2a17('0x35')](_0x486ac0,function(_0x1c65ba){db['UserVoicePrefix'][_0x2a17('0x92')]({'UserId':_0x1c65ba,'VoicePrefixId':_0x101260[_0x2a17('0x97')]});});return Promise['all'](_0x239cd6);}});});});return Promise['all'](_0x2a5f90)[_0x2a17('0x2d')](function(){return _0x1bddcb[_0x2a17('0x81')](_0x486ac0,{'transaction':_0x291649})[_0x2a17('0x98')](function(_0x10d910){return _0x10d910;});});});}})[_0x2a17('0x2d')](respondWithResult(_0x2cb58d,null))[_0x2a17('0x4d')](handleError(_0x2cb58d,null));};exports[_0x2a17('0x99')]=function(_0x5e8bc3,_0x544db9){var _0x5effd8=_[_0x2a17('0x82')](_0x5e8bc3['query'][_0x2a17('0x7f')])?_0x5e8bc3[_0x2a17('0x36')]['ids']:[_0x5e8bc3['query'][_0x2a17('0x7f')]];var _0xf8fc8c=_0x5e8bc3[_0x2a17('0x4e')]['id'];return db[_0x2a17('0x49')][_0x2a17('0x56')]({'where':{'id':_0xf8fc8c}})['then'](handleEntityNotFound(_0x544db9,null))[_0x2a17('0x2d')](function(_0x1cc357){if(_0x1cc357){var _0x42edbd=['Voice',_0x2a17('0x9a'),_0x2a17('0x9b'),_0x2a17('0x83'),'Fax',_0x2a17('0x9c'),_0x2a17('0x85')];return db[_0x2a17('0x5d')][_0x2a17('0x5e')](function(_0x3dfbc2){var _0xd22b7c=_['map'](_0x42edbd,function(_0x1aab2e){var _0x14511e={'attributes':['id',_0x2a17('0x2f')]};return _0x1cc357[_0x2a17('0x51')+_0x1aab2e+_0x2a17('0x7d')](_0x14511e)[_0x2a17('0x2d')](function(_0x47d2e6){var _0x50bb7a=_['map'](_0x47d2e6,function(_0x3d160c){return _0x3d160c['removeAgents'](_0x5effd8,{'transaction':_0x3dfbc2})[_0x2a17('0x2d')](function(){var _0x503532=_[_0x2a17('0x35')](_0x5effd8,function(_0x144627){socket[_0x2a17('0x8b')]('user'+_0x1aab2e+_0x2a17('0x9d'),{'UserId':Number(_0x144627),[_0x1aab2e+'QueueId']:_0x3d160c['id']});if(_0x1aab2e!==_0x2a17('0x87')){return;}return db[_0x2a17('0x91')][_0x2a17('0x66')]({'where':{'VoiceQueueId':_0x3d160c['id'],'UserId':_0x144627},'transaction':_0x3dfbc2});});return Promise[_0x2a17('0x96')](_0x503532);});});return Promise['all'](_0x50bb7a);});});return Promise[_0x2a17('0x96')](_0xd22b7c)['then'](function(){return _0x1cc357[_0x2a17('0x99')](_0x5effd8,{'transaction':_0x3dfbc2});})[_0x2a17('0x2d')](function(){return db[_0x2a17('0x9e')][_0x2a17('0x7e')]({'where':{'teamId':_0xf8fc8c}})[_0x2a17('0x2d')](function(_0xd99732){if(_0xd99732){var _0x4c23b7=_[_0x2a17('0x35')](_0x5effd8,function(_0x1d84bd){db[_0x2a17('0x9f')][_0x2a17('0x66')]({'where':{'UserId':_0x1d84bd,'VoicePrefixId':_0xd99732[_0x2a17('0x97')]}});});return Promise['all'](_0x4c23b7);}});});});}})['then'](respondWithStatusCode(_0x544db9,null))[_0x2a17('0x4d')](handleError(_0x544db9,null));};exports[_0x2a17('0xa0')]=function(_0x14470d,_0x52a20f,_0x3f3a3c){var _0x126832={};var _0x587088={};var _0x14814d;var _0x1f38c3;return db[_0x2a17('0x49')][_0x2a17('0x7e')]({'where':{'id':_0x14470d[_0x2a17('0x4e')]['id']}})[_0x2a17('0x2d')](handleEntityNotFound(_0x52a20f,null))[_0x2a17('0x2d')](function(_0x224709){if(_0x224709){_0x14814d=_0x224709;_0x587088[_0x2a17('0x3a')]=_[_0x2a17('0x37')](db[_0x2a17('0x8d')][_0x2a17('0x32')]);_0x587088['query']=_[_0x2a17('0x37')](_0x14470d[_0x2a17('0x36')]);_0x587088[_0x2a17('0x38')]=_[_0x2a17('0x39')](_0x587088['model'],_0x587088[_0x2a17('0x36')]);_0x126832[_0x2a17('0x3c')]=_[_0x2a17('0x39')](_0x587088[_0x2a17('0x3a')],qs['fields'](_0x14470d[_0x2a17('0x36')]['fields']));_0x126832[_0x2a17('0x3c')]=_0x126832[_0x2a17('0x3c')][_0x2a17('0x3d')]?_0x126832[_0x2a17('0x3c')]:_0x587088[_0x2a17('0x3a')];_0x126832[_0x2a17('0x40')]=qs[_0x2a17('0x41')](_0x14470d[_0x2a17('0x36')][_0x2a17('0x41')]);_0x126832[_0x2a17('0x42')]=qs[_0x2a17('0x38')](_['pick'](_0x14470d['query'],_0x587088[_0x2a17('0x38')]));if(_0x14470d[_0x2a17('0x36')][_0x2a17('0x44')]){_0x126832[_0x2a17('0x42')]=_['merge'](_0x126832[_0x2a17('0x42')],{'$or':_[_0x2a17('0x35')](_0x126832['attributes'],function(_0x2136b9){var _0x31cdd0={};_0x31cdd0[_0x2136b9]={'$like':'%'+_0x14470d['query'][_0x2a17('0x44')]+'%'};return _0x31cdd0;})});}_0x126832=_['merge']({},_0x126832,_0x14470d['options']);return _0x14814d[_0x2a17('0xa0')](_0x126832);}})[_0x2a17('0x2d')](function(_0x45bdd1){if(_0x45bdd1){_0x1f38c3=_0x45bdd1[_0x2a17('0x3d')];if(!_0x14470d[_0x2a17('0x36')]['hasOwnProperty'](_0x2a17('0x3f'))){_0x126832['limit']=qs[_0x2a17('0x25')](_0x14470d['query'][_0x2a17('0x25')]);_0x126832['offset']=qs[_0x2a17('0x23')](_0x14470d[_0x2a17('0x36')][_0x2a17('0x23')]);}return _0x14814d[_0x2a17('0xa0')](_0x126832);}})[_0x2a17('0x2d')](function(_0x560d97){if(_0x560d97){return _0x560d97?{'count':_0x1f38c3,'rows':_0x560d97}:null;}})[_0x2a17('0x2d')](respondWithResult(_0x52a20f,null))['catch'](handleError(_0x52a20f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index bfadf0e..d12da95 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 _0xd8aa=['update','emit','hook','exports','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x163cba,_0x3b18d7){var _0x44f96c=function(_0x492192){while(--_0x492192){_0x163cba['push'](_0x163cba['shift']());}};_0x44f96c(++_0x3b18d7);}(_0xd8aa,0x1bd));var _0xad8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8aa[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xad8a('0x0'));var Team=require(_0xad8a('0x1'))['db'][_0xad8a('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xad8a('0x3')](0x0);var events={'afterCreate':_0xad8a('0x4'),'afterUpdate':_0xad8a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x581e0a){return function(_0x36d05a,_0x1eee84,_0x2fbfa8){TeamEvents[_0xad8a('0x6')](_0x581e0a+':'+_0x36d05a['id'],_0x36d05a);TeamEvents[_0xad8a('0x6')](_0x581e0a,_0x36d05a);_0x2fbfa8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xad8a('0x7')](e,emitEvent(event));}}module[_0xad8a('0x8')]=TeamEvents; \ No newline at end of file +var _0x1ecf=['emit','exports','../../mysqldb','Team','setMaxListeners','save','update','remove'];(function(_0x23e859,_0x419ccc){var _0xe4964=function(_0x2e2501){while(--_0x2e2501){_0x23e859['push'](_0x23e859['shift']());}};_0xe4964(++_0x419ccc);}(_0x1ecf,0x1a2));var _0xf1ec=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0x1ecf[_0xe5b349];return _0x26b0ad;};'use strict';var EventEmitter=require('events');var Team=require(_0xf1ec('0x0'))['db'][_0xf1ec('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xf1ec('0x2')](0x0);var events={'afterCreate':_0xf1ec('0x3'),'afterUpdate':_0xf1ec('0x4'),'afterDestroy':_0xf1ec('0x5')};function emitEvent(_0x505284){return function(_0x5b888a,_0x2aa413,_0x5214a1){TeamEvents[_0xf1ec('0x6')](_0x505284+':'+_0x5b888a['id'],_0x5b888a);TeamEvents['emit'](_0x505284,_0x5b888a);_0x5214a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xf1ec('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8072be9..0fc882f 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 _0xf91f=['then','catch','lodash','./team.attributes','get','Queues','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve'];(function(_0x57b9eb,_0x286f7a){var _0x28928d=function(_0x48d170){while(--_0x48d170){_0x57b9eb['push'](_0x57b9eb['shift']());}};_0x28928d(++_0x286f7a);}(_0xf91f,0x156));var _0xff91=function(_0x1fdc88,_0x54cff7){_0x1fdc88=_0x1fdc88-0x0;var _0x263d5a=_0xf91f[_0x1fdc88];return _0x263d5a;};'use strict';var _=require(_0xff91('0x0'));var attributes=require(_0xff91('0x1'));function getQueuesByChannel(_0x3774f2,_0x303017){var _0x499849=_0xff91('0x2')+_0x303017+_0xff91('0x3');return _0x3774f2[_0x499849]()['then'](function(_0x5c5344){return _[_0xff91('0x4')](_0x5c5344,function(_0x239ecc){_0x239ecc[_0xff91('0x5')](_0xff91('0x6'),_0x303017);return _0x239ecc;});})['catch'](function(_0x5676e0){throw _0x5676e0;});}module[_0xff91('0x7')]=function(_0x1ad494){return _0x1ad494[_0xff91('0x8')](_0xff91('0x9'),attributes,{'tableName':_0xff91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5b82b2=this;var _0x31377e=[_0xff91('0xb'),_0xff91('0xc'),_0xff91('0xd'),_0xff91('0xe'),_0xff91('0xf'),_0xff91('0x10'),'Whatsapp'];return Promise[_0xff91('0x11')]()[_0xff91('0x12')](function(){var _0x4b1561=_[_0xff91('0x4')](_0x31377e,function(_0x1c2714){return getQueuesByChannel(_0x5b82b2,_0x1c2714);});return Promise['all'](_0x4b1561);})[_0xff91('0x13')](function(_0x2fd66d){throw _0x2fd66d;});}}});}; \ No newline at end of file +var _0x10ab=['map','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','all','lodash','./team.attributes','get'];(function(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_0x10ab,0xc3));var _0xb10a=function(_0x33670a,_0x55e188){_0x33670a=_0x33670a-0x0;var _0x36ad1d=_0x10ab[_0x33670a];return _0x36ad1d;};'use strict';var _=require(_0xb10a('0x0'));var attributes=require(_0xb10a('0x1'));function getQueuesByChannel(_0x4c2187,_0x508043){var _0x28f54c=_0xb10a('0x2')+_0x508043+'Queues';return _0x4c2187[_0x28f54c]()['then'](function(_0x34522d){return _[_0xb10a('0x3')](_0x34522d,function(_0x52eb84){_0x52eb84['setDataValue'](_0xb10a('0x4'),_0x508043);return _0x52eb84;});})[_0xb10a('0x5')](function(_0x45b039){throw _0x45b039;});}module[_0xb10a('0x6')]=function(_0x3ab52d){return _0x3ab52d[_0xb10a('0x7')](_0xb10a('0x8'),attributes,{'tableName':_0xb10a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xb81868=this;var _0x3bd941=[_0xb10a('0xa'),_0xb10a('0xb'),_0xb10a('0xc'),_0xb10a('0xd'),_0xb10a('0xe'),_0xb10a('0xf'),_0xb10a('0x10')];return Promise['resolve']()['then'](function(){var _0x4895b4=_[_0xb10a('0x3')](_0x3bd941,function(_0x173ace){return getQueuesByChannel(_0xb81868,_0x173ace);});return Promise[_0xb10a('0x11')](_0x4895b4);})[_0xb10a('0x5')](function(_0x2c8c78){throw _0x2c8c78;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 2ca10a0..cd2770b 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 _0x1801=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xfecbad,_0x5915f8){var _0x5e1806=function(_0x2a46ec){while(--_0x2a46ec){_0xfecbad['push'](_0xfecbad['shift']());}};_0x5e1806(++_0x5915f8);}(_0x1801,0x68));var _0x1180=function(_0x2e88e8,_0x255706){_0x2e88e8=_0x2e88e8-0x0;var _0x381659=_0x1801[_0x2e88e8];return _0x381659;};'use strict';var _=require(_0x1180('0x0'));var util=require(_0x1180('0x1'));var moment=require(_0x1180('0x2'));var BPromise=require(_0x1180('0x3'));var rs=require(_0x1180('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1180('0x5'))['db'];var utils=require(_0x1180('0x6'));var logger=require(_0x1180('0x7'))(_0x1180('0x8'));var config=require(_0x1180('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1180('0xa')]({'port':0x232a});config[_0x1180('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1180('0xc'))(new Redis(config[_0x1180('0xb')]));require(_0x1180('0xd'))[_0x1180('0xe')](socket);function respondWithRpcPromise(_0x444f81,_0x6714b6,_0x5be110){return new BPromise(function(_0x4e54ce,_0x4b37ab){return client[_0x1180('0xf')](_0x444f81,_0x5be110)['then'](function(_0x4188e4){logger[_0x1180('0x10')](_0x1180('0x11'),_0x6714b6,'request\x20sent');logger['debug'](_0x1180('0x12'),_0x6714b6,'request\x20sent',JSON[_0x1180('0x13')](_0x4188e4));if(_0x4188e4[_0x1180('0x14')]){if(_0x4188e4[_0x1180('0x14')][_0x1180('0x15')]===0x1f4){logger['error'](_0x1180('0x11'),_0x6714b6,_0x4188e4['error'][_0x1180('0x16')]);return _0x4b37ab(_0x4188e4[_0x1180('0x14')][_0x1180('0x16')]);}logger[_0x1180('0x14')](_0x1180('0x11'),_0x6714b6,_0x4188e4[_0x1180('0x14')]['message']);return _0x4e54ce(_0x4188e4[_0x1180('0x14')]['message']);}else{logger[_0x1180('0x10')](_0x1180('0x11'),_0x6714b6,'request\x20sent');_0x4e54ce(_0x4188e4[_0x1180('0x17')]['message']);}})[_0x1180('0x18')](function(_0x19691c){logger[_0x1180('0x14')](_0x1180('0x11'),_0x6714b6,_0x19691c);_0x4b37ab(_0x19691c);});});} \ No newline at end of file +var _0xbc60=['client','redis','defaults','localhost','./team.socket','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x45be82,_0x2157ee){var _0x579c93=function(_0x111406){while(--_0x111406){_0x45be82['push'](_0x45be82['shift']());}};_0x579c93(++_0x2157ee);}(_0xbc60,0x1d1));var _0x0bc6=function(_0x334308,_0x2a2471){_0x334308=_0x334308-0x0;var _0x2fa500=_0xbc60[_0x334308];return _0x2fa500;};'use strict';var _=require(_0x0bc6('0x0'));var util=require(_0x0bc6('0x1'));var moment=require(_0x0bc6('0x2'));var BPromise=require(_0x0bc6('0x3'));var rs=require(_0x0bc6('0x4'));var fs=require('fs');var Redis=require(_0x0bc6('0x5'));var db=require(_0x0bc6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0bc6('0x7'));var config=require(_0x0bc6('0x8'));var jayson=require(_0x0bc6('0x9'));var client=jayson[_0x0bc6('0xa')]['http']({'port':0x232a});config[_0x0bc6('0xb')]=_[_0x0bc6('0xc')](config[_0x0bc6('0xb')],{'host':_0x0bc6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bc6('0xb')]));require(_0x0bc6('0xe'))['register'](socket);function respondWithRpcPromise(_0x39c90b,_0x11b3d2,_0x42af70){return new BPromise(function(_0x2641fe,_0x54ce6c){return client[_0x0bc6('0xf')](_0x39c90b,_0x42af70)['then'](function(_0x19481a){logger['info'](_0x0bc6('0x10'),_0x11b3d2,_0x0bc6('0x11'));logger[_0x0bc6('0x12')](_0x0bc6('0x13'),_0x11b3d2,'request\x20sent',JSON[_0x0bc6('0x14')](_0x19481a));if(_0x19481a[_0x0bc6('0x15')]){if(_0x19481a[_0x0bc6('0x15')]['code']===0x1f4){logger[_0x0bc6('0x15')](_0x0bc6('0x10'),_0x11b3d2,_0x19481a[_0x0bc6('0x15')][_0x0bc6('0x16')]);return _0x54ce6c(_0x19481a[_0x0bc6('0x15')]['message']);}logger['error']('Team,\x20%s,\x20%s',_0x11b3d2,_0x19481a['error'][_0x0bc6('0x16')]);return _0x2641fe(_0x19481a[_0x0bc6('0x15')][_0x0bc6('0x16')]);}else{logger[_0x0bc6('0x17')](_0x0bc6('0x10'),_0x11b3d2,_0x0bc6('0x11'));_0x2641fe(_0x19481a[_0x0bc6('0x18')]['message']);}})['catch'](function(_0x5850fb){logger[_0x0bc6('0x15')](_0x0bc6('0x10'),_0x11b3d2,_0x5850fb);_0x54ce6c(_0x5850fb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 91dd8c6..7b39589 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 _0x9158=['length','team:','./team.events','save','remove','removeListener','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9158,0x16e));var _0x8915=function(_0x5c5016,_0x29c4ce){_0x5c5016=_0x5c5016-0x0;var _0xb04ba1=_0x9158[_0x5c5016];return _0xb04ba1;};'use strict';var TeamEvents=require(_0x8915('0x0'));var events=[_0x8915('0x1'),_0x8915('0x2'),'update'];function createListener(_0x2a58cc,_0x4e61b0){return function(_0x38d764){_0x4e61b0['emit'](_0x2a58cc,_0x38d764);};}function removeListener(_0x525bfe,_0x151f9c){return function(){TeamEvents[_0x8915('0x3')](_0x525bfe,_0x151f9c);};}exports[_0x8915('0x4')]=function(_0x2cad3f){for(var _0x455248=0x0,_0x20ff3d=events[_0x8915('0x5')];_0x455248<_0x20ff3d;_0x455248++){var _0x100d72=events[_0x455248];var _0x50d1f8=createListener(_0x8915('0x6')+_0x100d72,_0x2cad3f);TeamEvents['on'](_0x100d72,_0x50d1f8);}}; \ No newline at end of file +var _0x803f=['length','team:','./team.events','remove','update','emit','register'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x803f,0x64));var _0xf803=function(_0x1ca5c6,_0x4d4715){_0x1ca5c6=_0x1ca5c6-0x0;var _0x524f90=_0x803f[_0x1ca5c6];return _0x524f90;};'use strict';var TeamEvents=require(_0xf803('0x0'));var events=['save',_0xf803('0x1'),_0xf803('0x2')];function createListener(_0x4ce875,_0x1a8691){return function(_0x43fb3b){_0x1a8691[_0xf803('0x3')](_0x4ce875,_0x43fb3b);};}function removeListener(_0x6baafe,_0x5c2cd6){return function(){TeamEvents['removeListener'](_0x6baafe,_0x5c2cd6);};}exports[_0xf803('0x4')]=function(_0x2ba12f){for(var _0x1d3a79=0x0,_0x584b2d=events[_0xf803('0x5')];_0x1d3a79<_0x584b2d;_0x1d3a79++){var _0x47128f=events[_0x1d3a79];var _0x587319=createListener(_0xf803('0x6')+_0x47128f,_0x2ba12f);TeamEvents['on'](_0x47128f,_0x587319);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index b2a4851..271d466 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 _0xf4eb=['sequelize'];(function(_0x30d04e,_0x35ff7a){var _0x4544a2=function(_0x15d96f){while(--_0x15d96f){_0x30d04e['push'](_0x30d04e['shift']());}};_0x4544a2(++_0x35ff7a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4418c4,_0x4992c2){_0x4418c4=_0x4418c4-0x0;var _0x1cbe63=_0xf4eb[_0x4418c4];return _0x1cbe63;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0506=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0506,0x1d1));var _0x6050=function(_0x27608f,_0x24b07b){_0x27608f=_0x27608f-0x0;var _0xddd897=_0x0506[_0x27608f];return _0xddd897;};'use strict';var Sequelize=require(_0x6050('0x0'));module[_0x6050('0x1')]={'TeamId':{'type':Sequelize[_0x6050('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index b9021b2..01491e0 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 _0x3d7f=['../../config/logger','moment','bluebird','request-promise','path','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x2c0e1a,_0xa58a00){var _0x58494d=function(_0x29ada4){while(--_0x29ada4){_0x2c0e1a['push'](_0x2c0e1a['shift']());}};_0x58494d(++_0xa58a00);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x3d7f[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xf3d7('0x0'));var util=require('util');var logger=require(_0xf3d7('0x1'))('api');var moment=require(_0xf3d7('0x2'));var BPromise=require(_0xf3d7('0x3'));var rp=require(_0xf3d7('0x4'));var fs=require('fs');var path=require(_0xf3d7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf3d7('0x6'));module[_0xf3d7('0x7')]=function(_0x5b667c,_0x59deab){return _0x5b667c[_0xf3d7('0x8')](_0xf3d7('0x9'),attributes,{'tableName':_0xf3d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1752=['bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1752,0xa5));var _0x2175=function(_0xcfd7ee,_0x490e5b){_0xcfd7ee=_0xcfd7ee-0x0;var _0x11c865=_0x1752[_0xcfd7ee];return _0x11c865;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));var moment=require(_0x2175('0x3'));var BPromise=require(_0x2175('0x4'));var rp=require(_0x2175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var attributes=require(_0x2175('0x8'));module[_0x2175('0x9')]=function(_0x222868,_0x27ff0b){return _0x222868[_0x2175('0xa')](_0x2175('0xb'),attributes,{'tableName':_0x2175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 83d6637..31ef496 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x50221f,_0x16a9b1){var _0x59bc29=function(_0x452312){while(--_0x452312){_0x50221f['push'](_0x50221f['shift']());}};_0x59bc29(++_0x16a9b1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x174ab8,_0x47ea5f){var _0x2aab09=function(_0x1ab968){while(--_0x1ab968){_0x174ab8['push'](_0x174ab8['shift']());}};_0x2aab09(++_0x47ea5f);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9e5b4fd..5d97d02 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 _0x920e=['INTEGER','exports'];(function(_0x24f5c3,_0x20ab48){var _0x5eab72=function(_0x4e67a4){while(--_0x4e67a4){_0x24f5c3['push'](_0x24f5c3['shift']());}};_0x5eab72(++_0x20ab48);}(_0x920e,0xc7));var _0xe920=function(_0x40b2a8,_0x472a93){_0x40b2a8=_0x40b2a8-0x0;var _0xe80e3c=_0x920e[_0x40b2a8];return _0xe80e3c;};'use strict';var Sequelize=require('sequelize');module[_0xe920('0x0')]={'penalty':{'type':Sequelize[_0xe920('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x51ac=['sequelize','exports','INTEGER'];(function(_0x532b2a,_0x56ea4f){var _0x5a904f=function(_0x29ac94){while(--_0x29ac94){_0x532b2a['push'](_0x532b2a['shift']());}};_0x5a904f(++_0x56ea4f);}(_0x51ac,0x1c2));var _0xc51a=function(_0xa7e796,_0x1f1dba){_0xa7e796=_0xa7e796-0x0;var _0x440ec6=_0x51ac[_0xa7e796];return _0x440ec6;};'use strict';var Sequelize=require(_0xc51a('0x0'));module[_0xc51a('0x1')]={'penalty':{'type':Sequelize[_0xc51a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index b89d0a9..fd15dba 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 _0x0f3c=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','bluebird'];(function(_0x98e06e,_0x2bbf29){var _0xfc6cb8=function(_0x27b0ba){while(--_0x27b0ba){_0x98e06e['push'](_0x98e06e['shift']());}};_0xfc6cb8(++_0x2bbf29);}(_0x0f3c,0x189));var _0xc0f3=function(_0x150196,_0x57a80b){_0x150196=_0x150196-0x0;var _0x35d521=_0x0f3c[_0x150196];return _0x35d521;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc0f3('0x2'));var rp=require(_0xc0f3('0x3'));var fs=require('fs');var path=require(_0xc0f3('0x4'));var rimraf=require(_0xc0f3('0x5'));var config=require(_0xc0f3('0x6'));var attributes=require(_0xc0f3('0x7'));module[_0xc0f3('0x8')]=function(_0x256643,_0x4b76a0){return _0x256643[_0xc0f3('0x9')](_0xc0f3('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x175e=['moment','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x175e,0xe6));var _0xe175=function(_0x4fb185,_0x13c90f){_0x4fb185=_0x4fb185-0x0;var _0x236118=_0x175e[_0x4fb185];return _0x236118;};'use strict';var _=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var logger=require(_0xe175('0x2'))(_0xe175('0x3'));var moment=require(_0xe175('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe175('0x5'));var rimraf=require(_0xe175('0x6'));var config=require(_0xe175('0x7'));var attributes=require(_0xe175('0x8'));module[_0xe175('0x9')]=function(_0x278a8d,_0x7eba){return _0x278a8d[_0xe175('0xa')](_0xe175('0xb'),attributes,{'tableName':_0xe175('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 49e6fa9..75da187 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 _0x59c3=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2079b2,_0x47c843){var _0x3f1e20=function(_0x267d1e){while(--_0x267d1e){_0x2079b2['push'](_0x2079b2['shift']());}};_0x3f1e20(++_0x47c843);}(_0x59c3,0x133));var _0x359c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x59c3[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var moment=require(_0x359c('0x2'));var BPromise=require(_0x359c('0x3'));var rs=require(_0x359c('0x4'));var fs=require('fs');var Redis=require(_0x359c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x359c('0x6'));var logger=require(_0x359c('0x7'))(_0x359c('0x8'));var config=require(_0x359c('0x9'));var jayson=require(_0x359c('0xa'));var client=jayson[_0x359c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9c107b,_0x58b390,_0x3a7d8e){return new BPromise(function(_0x335963,_0x44ae3a){return client[_0x359c('0xc')](_0x9c107b,_0x3a7d8e)['then'](function(_0x1fb4c8){logger['info'](_0x359c('0xd'),_0x58b390,_0x359c('0xe'));logger[_0x359c('0xf')](_0x359c('0x10'),_0x58b390,_0x359c('0xe'),JSON[_0x359c('0x11')](_0x1fb4c8));if(_0x1fb4c8['error']){if(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x13')]===0x1f4){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x44ae3a(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);}logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x335963(_0x1fb4c8['error'][_0x359c('0x14')]);}else{logger[_0x359c('0x15')]('TeamVoiceQueue,\x20%s,\x20%s',_0x58b390,_0x359c('0xe'));_0x335963(_0x1fb4c8[_0x359c('0x16')][_0x359c('0x14')]);}})[_0x359c('0x17')](function(_0x421bab){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x421bab);_0x44ae3a(_0x421bab);});});} \ No newline at end of file +var _0xa9ed=['../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x25e54c,_0x78f724){var _0x39b894=function(_0x14f109){while(--_0x14f109){_0x25e54c['push'](_0x25e54c['shift']());}};_0x39b894(++_0x78f724);}(_0xa9ed,0x187));var _0xda9e=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xa9ed[_0x2becba];return _0x90b5dd;};'use strict';var _=require(_0xda9e('0x0'));var util=require(_0xda9e('0x1'));var moment=require(_0xda9e('0x2'));var BPromise=require(_0xda9e('0x3'));var rs=require(_0xda9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda9e('0x5'))['db'];var utils=require(_0xda9e('0x6'));var logger=require(_0xda9e('0x7'))(_0xda9e('0x8'));var config=require(_0xda9e('0x9'));var jayson=require(_0xda9e('0xa'));var client=jayson[_0xda9e('0xb')][_0xda9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dd15e,_0x28640d,_0x15b384){return new BPromise(function(_0x2a66c6,_0x47dab5){return client[_0xda9e('0xd')](_0x3dd15e,_0x15b384)[_0xda9e('0xe')](function(_0x320c89){logger[_0xda9e('0xf')](_0xda9e('0x10'),_0x28640d,_0xda9e('0x11'));logger[_0xda9e('0x12')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x28640d,_0xda9e('0x11'),JSON[_0xda9e('0x13')](_0x320c89));if(_0x320c89[_0xda9e('0x14')]){if(_0x320c89[_0xda9e('0x14')][_0xda9e('0x15')]===0x1f4){logger[_0xda9e('0x14')](_0xda9e('0x10'),_0x28640d,_0x320c89[_0xda9e('0x14')]['message']);return _0x47dab5(_0x320c89['error'][_0xda9e('0x16')]);}logger[_0xda9e('0x14')](_0xda9e('0x10'),_0x28640d,_0x320c89[_0xda9e('0x14')][_0xda9e('0x16')]);return _0x2a66c6(_0x320c89[_0xda9e('0x14')]['message']);}else{logger[_0xda9e('0xf')](_0xda9e('0x10'),_0x28640d,_0xda9e('0x11'));_0x2a66c6(_0x320c89[_0xda9e('0x17')][_0xda9e('0x16')]);}})[_0xda9e('0x18')](function(_0x46f5db){logger['error'](_0xda9e('0x10'),_0x28640d,_0x46f5db);_0x47dab5(_0x46f5db);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b596b04..dc733aa 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 _0xee2c=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xee2c,0x1c7));var _0xcee2=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xee2c[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0xcee2('0x0'));var util=require('util');var path=require(_0xcee2('0x1'));var timeout=require(_0xcee2('0x2'));var express=require(_0xcee2('0x3'));var router=express[_0xcee2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee2('0x5'));var config=require(_0xcee2('0x6'));var controller=require('./template.controller');router[_0xcee2('0x7')]('/',auth[_0xcee2('0x8')](),controller[_0xcee2('0x9')]);router[_0xcee2('0x7')](_0xcee2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcee2('0xb')]('/',auth[_0xcee2('0x8')](),controller[_0xcee2('0xc')]);router[_0xcee2('0xd')](_0xcee2('0xa'),auth[_0xcee2('0x8')](),controller[_0xcee2('0xe')]);router[_0xcee2('0xf')]('/:id',auth[_0xcee2('0x8')](),controller[_0xcee2('0x10')]);module[_0xcee2('0x11')]=router; \ No newline at end of file +var _0x58e6=['./template.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x58e6,0x1c2));var _0x658e=function(_0x1adfa9,_0xc2640b){_0x1adfa9=_0x1adfa9-0x0;var _0x252205=_0x58e6[_0x1adfa9];return _0x252205;};'use strict';var multer=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x658e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x658e('0x3'));var interaction=require(_0x658e('0x4'));var config=require(_0x658e('0x5'));var controller=require(_0x658e('0x6'));router[_0x658e('0x7')]('/',auth[_0x658e('0x8')](),controller[_0x658e('0x9')]);router['get']('/:id',auth[_0x658e('0x8')](),controller[_0x658e('0xa')]);router[_0x658e('0xb')]('/',auth['isAuthenticated'](),controller[_0x658e('0xc')]);router[_0x658e('0xd')](_0x658e('0xe'),auth[_0x658e('0x8')](),controller[_0x658e('0xf')]);router[_0x658e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x658e('0x11')]);module[_0x658e('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 157edb4..3fa4f66 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 _0x4ecb=['TEXT','sequelize','exports','STRING'];(function(_0x22b816,_0xe94d7){var _0x3afc87=function(_0x8b4a29){while(--_0x8b4a29){_0x22b816['push'](_0x22b816['shift']());}};_0x3afc87(++_0xe94d7);}(_0x4ecb,0xbd));var _0xb4ec=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x4ecb[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0xb4ec('0x0'));module[_0xb4ec('0x1')]={'name':{'type':Sequelize[_0xb4ec('0x2')]},'description':{'type':Sequelize[_0xb4ec('0x2')]},'html':{'type':Sequelize[_0xb4ec('0x3')]}}; \ No newline at end of file +var _0xd86a=['exports','STRING','TEXT','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd86a,0xe7));var _0xad86=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xd86a[_0x1acc2d];return _0xabfa6d;};'use strict';var Sequelize=require(_0xad86('0x0'));module[_0xad86('0x1')]={'name':{'type':Sequelize[_0xad86('0x2')]},'description':{'type':Sequelize[_0xad86('0x2')]},'html':{'type':Sequelize[_0xad86('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0d03e97..6f239d4 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 _0x986c=['ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Templates','error','stack','name','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x986c,0xee));var _0xc986=function(_0x5eabde,_0x559e0d){_0x5eabde=_0x5eabde-0x0;var _0x264263=_0x986c[_0x5eabde];return _0x264263;};'use strict';var emlformat=require(_0xc986('0x0'));var rimraf=require(_0xc986('0x1'));var zipdir=require(_0xc986('0x2'));var jsonpatch=require(_0xc986('0x3'));var rp=require(_0xc986('0x4'));var moment=require(_0xc986('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc986('0x6'));var util=require(_0xc986('0x7'));var path=require(_0xc986('0x8'));var sox=require(_0xc986('0x9'));var csv=require(_0xc986('0xa'));var ejs=require(_0xc986('0xb'));var fs=require('fs');var fs_extra=require(_0xc986('0xc'));var _=require('lodash');var squel=require(_0xc986('0xd'));var crypto=require(_0xc986('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc986('0xf'));var toCsv=require(_0xc986('0xa'));var querystring=require(_0xc986('0x10'));var Papa=require(_0xc986('0x11'));var Redis=require(_0xc986('0x12'));var authService=require(_0xc986('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc986('0x14'));var hardwareService=require(_0xc986('0x15'));var logger=require(_0xc986('0x16'))('api');var utils=require(_0xc986('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc986('0x18'));var db=require(_0xc986('0x19'))['db'];function respondWithStatusCode(_0x5c8766,_0x339481){_0x339481=_0x339481||0xcc;return function(_0x3c38d8){if(_0x3c38d8){return _0x5c8766[_0xc986('0x1a')](_0x339481);}return _0x5c8766[_0xc986('0x1b')](_0x339481)[_0xc986('0x1c')]();};}function respondWithResult(_0x2dbc54,_0x1e756c){_0x1e756c=_0x1e756c||0xc8;return function(_0x3ea948){if(_0x3ea948){return _0x2dbc54[_0xc986('0x1b')](_0x1e756c)[_0xc986('0x1d')](_0x3ea948);}};}function respondWithFilteredResult(_0x47678f,_0xc95781){return function(_0x4dbab4){if(_0x4dbab4){var _0x1e7f40=typeof _0xc95781[_0xc986('0x1e')]===_0xc986('0x1f')&&typeof _0xc95781[_0xc986('0x20')]===_0xc986('0x1f');var _0x2bf598=_0x4dbab4[_0xc986('0x21')];var _0x9dfe9f=_0x1e7f40?0x0:_0xc95781[_0xc986('0x1e')];var _0x4bedf6=_0x1e7f40?_0x4dbab4[_0xc986('0x21')]:_0xc95781[_0xc986('0x1e')]+_0xc95781[_0xc986('0x20')];var _0x10b78f;if(_0x4bedf6>=_0x2bf598){_0x4bedf6=_0x2bf598;_0x10b78f=0xc8;}else{_0x10b78f=0xce;}_0x47678f['status'](_0x10b78f);return _0x47678f['set'](_0xc986('0x22'),_0x9dfe9f+'-'+_0x4bedf6+'/'+_0x2bf598)[_0xc986('0x1d')](_0x4dbab4);}return null;};}function patchUpdates(_0x3cebf6){return function(_0x2189d1){try{jsonpatch[_0xc986('0x23')](_0x2189d1,_0x3cebf6,!![]);}catch(_0x23f8b8){return BPromise['reject'](_0x23f8b8);}return _0x2189d1[_0xc986('0x24')]();};}function saveUpdates(_0xb2bf53,_0x753ff0){return function(_0x309947){if(_0x309947){return _0x309947[_0xc986('0x25')](_0xb2bf53)[_0xc986('0x26')](function(_0x1355cc){return _0x1355cc;});}return null;};}function removeEntity(_0x1d2731,_0x277683){return function(_0x287ab3){if(_0x287ab3){return _0x287ab3[_0xc986('0x27')]()['then'](function(){var _0x235ab8=_0x287ab3[_0xc986('0x28')]({'plain':!![]});var _0x30f1df=_0xc986('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x30f1df,'resourceId':_0x235ab8['id']}})[_0xc986('0x26')](function(){return _0x287ab3;});})[_0xc986('0x26')](function(){_0x1d2731[_0xc986('0x1b')](0xcc)[_0xc986('0x1c')]();});}};}function handleEntityNotFound(_0xb8f2dd,_0x4fc04f){return function(_0x442b7f){if(!_0x442b7f){_0xb8f2dd[_0xc986('0x1a')](0x194);}return _0x442b7f;};}function handleError(_0x52962f,_0x5b7117){_0x5b7117=_0x5b7117||0x1f4;return function(_0x454c08){logger[_0xc986('0x2a')](_0x454c08[_0xc986('0x2b')]);if(_0x454c08[_0xc986('0x2c')]){delete _0x454c08[_0xc986('0x2c')];}_0x52962f['status'](_0x5b7117)['send'](_0x454c08);};}exports['index']=function(_0x6d110d,_0x3e0ffa){var _0x3bc22d={},_0x43ec5e={},_0x19d9d0={'count':0x0,'rows':[]};var _0x223cb6=_[_0xc986('0x2d')](db[_0xc986('0x2e')][_0xc986('0x2f')],function(_0x4bc7cb){return{'name':_0x4bc7cb[_0xc986('0x30')],'type':_0x4bc7cb[_0xc986('0x31')][_0xc986('0x32')]};});_0x43ec5e[_0xc986('0x33')]=_[_0xc986('0x2d')](_0x223cb6,_0xc986('0x2c'));_0x43ec5e[_0xc986('0x34')]=_[_0xc986('0x35')](_0x6d110d['query']);_0x43ec5e[_0xc986('0x36')]=_['intersection'](_0x43ec5e['model'],_0x43ec5e[_0xc986('0x34')]);_0x3bc22d[_0xc986('0x37')]=_[_0xc986('0x38')](_0x43ec5e['model'],qs[_0xc986('0x39')](_0x6d110d[_0xc986('0x34')][_0xc986('0x39')]));_0x3bc22d[_0xc986('0x37')]=_0x3bc22d[_0xc986('0x37')]['length']?_0x3bc22d[_0xc986('0x37')]:_0x43ec5e[_0xc986('0x33')];if(!_0x6d110d[_0xc986('0x34')][_0xc986('0x3a')](_0xc986('0x3b'))){_0x3bc22d[_0xc986('0x20')]=qs[_0xc986('0x20')](_0x6d110d[_0xc986('0x34')]['limit']);_0x3bc22d[_0xc986('0x1e')]=qs[_0xc986('0x1e')](_0x6d110d['query'][_0xc986('0x1e')]);}_0x3bc22d[_0xc986('0x3c')]=qs[_0xc986('0x3d')](_0x6d110d['query'][_0xc986('0x3d')]);_0x3bc22d[_0xc986('0x3e')]=qs['filters'](_[_0xc986('0x3f')](_0x6d110d['query'],_0x43ec5e[_0xc986('0x36')]),_0x223cb6);if(_0x6d110d['query'][_0xc986('0x40')]){_0x3bc22d['where']=_[_0xc986('0x41')](_0x3bc22d[_0xc986('0x3e')],{'$or':_['map'](_0x223cb6,function(_0x4804ea){if(_0x4804ea[_0xc986('0x31')]!==_0xc986('0x42')){var _0x553bb6={};_0x553bb6[_0x4804ea[_0xc986('0x2c')]]={'$like':'%'+_0x6d110d['query']['filter']+'%'};return _0x553bb6;}})});}_0x3bc22d=_[_0xc986('0x41')]({},_0x3bc22d,_0x6d110d[_0xc986('0x43')]);var _0x3a0745={'where':_0x3bc22d[_0xc986('0x3e')]};return db['Template'][_0xc986('0x21')](_0x3a0745)['then'](function(_0x40058e){_0x19d9d0[_0xc986('0x21')]=_0x40058e;if(_0x6d110d[_0xc986('0x34')]['includeAll']){_0x3bc22d[_0xc986('0x44')]=[{'all':!![]}];}return db[_0xc986('0x2e')][_0xc986('0x45')](_0x3bc22d);})[_0xc986('0x26')](function(_0x20d72a){_0x19d9d0[_0xc986('0x46')]=_0x20d72a;return _0x19d9d0;})[_0xc986('0x26')](respondWithFilteredResult(_0x3e0ffa,_0x3bc22d))['catch'](handleError(_0x3e0ffa,null));};exports['show']=function(_0xadd015,_0x233bfa){var _0x2d45b5={'raw':!![],'where':{'id':_0xadd015[_0xc986('0x47')]['id']}},_0x58d2e8={};_0x58d2e8['model']=_[_0xc986('0x35')](db[_0xc986('0x2e')][_0xc986('0x2f')]);_0x58d2e8[_0xc986('0x34')]=_[_0xc986('0x35')](_0xadd015[_0xc986('0x34')]);_0x58d2e8[_0xc986('0x36')]=_[_0xc986('0x38')](_0x58d2e8[_0xc986('0x33')],_0x58d2e8[_0xc986('0x34')]);_0x2d45b5[_0xc986('0x37')]=_['intersection'](_0x58d2e8[_0xc986('0x33')],qs[_0xc986('0x39')](_0xadd015[_0xc986('0x34')][_0xc986('0x39')]));_0x2d45b5[_0xc986('0x37')]=_0x2d45b5[_0xc986('0x37')][_0xc986('0x48')]?_0x2d45b5[_0xc986('0x37')]:_0x58d2e8[_0xc986('0x33')];if(_0xadd015[_0xc986('0x34')]['includeAll']){_0x2d45b5[_0xc986('0x44')]=[{'all':!![]}];}_0x2d45b5=_['merge']({},_0x2d45b5,_0xadd015['options']);return db[_0xc986('0x2e')][_0xc986('0x49')](_0x2d45b5)[_0xc986('0x26')](handleEntityNotFound(_0x233bfa,null))[_0xc986('0x26')](respondWithResult(_0x233bfa,null))[_0xc986('0x4a')](handleError(_0x233bfa,null));};exports[_0xc986('0x4b')]=function(_0x5a6e4c,_0x3894c5){return db[_0xc986('0x2e')]['create'](_0x5a6e4c[_0xc986('0x4c')],{})[_0xc986('0x26')](function(_0x2fe2dd){var _0x4472f2=_0x5a6e4c[_0xc986('0x4d')][_0xc986('0x28')]({'plain':!![]});if(!_0x4472f2)throw new Error(_0xc986('0x4e'));if(_0x4472f2[_0xc986('0x4f')]===_0xc986('0x4d')){var _0x4f1c1c=_0x2fe2dd[_0xc986('0x28')]({'plain':!![]});var _0x3d36a8=_0xc986('0x29');return db[_0xc986('0x50')][_0xc986('0x49')]({'where':{'name':_0x3d36a8,'userProfileId':_0x4472f2['userProfileId']},'raw':!![]})[_0xc986('0x26')](function(_0x5c2e4f){if(_0x5c2e4f&&_0x5c2e4f[_0xc986('0x51')]===0x0){return db['UserProfileResource'][_0xc986('0x4b')]({'name':_0x4f1c1c[_0xc986('0x2c')],'resourceId':_0x4f1c1c['id'],'type':_0x5c2e4f[_0xc986('0x2c')],'sectionId':_0x5c2e4f['id']},{})['then'](function(){return _0x2fe2dd;});}else{return _0x2fe2dd;}})[_0xc986('0x4a')](function(_0x332c59){logger[_0xc986('0x2a')](_0xc986('0x52'),_0x332c59);throw _0x332c59;});}return _0x2fe2dd;})[_0xc986('0x26')](respondWithResult(_0x3894c5,0xc9))['catch'](handleError(_0x3894c5,null));};exports[_0xc986('0x25')]=function(_0xa68cce,_0x138c06){if(_0xa68cce[_0xc986('0x4c')]['id']){delete _0xa68cce['body']['id'];}return db[_0xc986('0x2e')][_0xc986('0x49')]({'where':{'id':_0xa68cce['params']['id']}})['then'](handleEntityNotFound(_0x138c06,null))[_0xc986('0x26')](saveUpdates(_0xa68cce[_0xc986('0x4c')],null))[_0xc986('0x26')](respondWithResult(_0x138c06,null))[_0xc986('0x4a')](handleError(_0x138c06,null));};exports['destroy']=function(_0x18cc65,_0x3b620a){return db[_0xc986('0x2e')][_0xc986('0x49')]({'where':{'id':_0x18cc65[_0xc986('0x47')]['id']}})[_0xc986('0x26')](handleEntityNotFound(_0x3b620a,null))[_0xc986('0x26')](removeEntity(_0x3b620a,null))[_0xc986('0x4a')](handleError(_0x3b620a,null));}; \ No newline at end of file +var _0x0f3e=['include','Template','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','request-promise','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','Templates','stack','name','send','map','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','sort','where','pick','merge','options','includeAll'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0x0f3e,0x1e5));var _0xe0f3=function(_0x7767c3,_0x4825ac){_0x7767c3=_0x7767c3-0x0;var _0x1f22a1=_0x0f3e[_0x7767c3];return _0x1f22a1;};'use strict';var emlformat=require(_0xe0f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe0f3('0x1'));var moment=require('moment');var BPromise=require(_0xe0f3('0x2'));var Mustache=require(_0xe0f3('0x3'));var util=require('util');var path=require(_0xe0f3('0x4'));var sox=require(_0xe0f3('0x5'));var csv=require(_0xe0f3('0x6'));var ejs=require(_0xe0f3('0x7'));var fs=require('fs');var fs_extra=require(_0xe0f3('0x8'));var _=require(_0xe0f3('0x9'));var squel=require('squel');var crypto=require(_0xe0f3('0xa'));var jsforce=require(_0xe0f3('0xb'));var deskjs=require(_0xe0f3('0xc'));var toCsv=require(_0xe0f3('0x6'));var querystring=require(_0xe0f3('0xd'));var Papa=require(_0xe0f3('0xe'));var Redis=require(_0xe0f3('0xf'));var authService=require(_0xe0f3('0x10'));var qs=require(_0xe0f3('0x11'));var as=require(_0xe0f3('0x12'));var hardwareService=require(_0xe0f3('0x13'));var logger=require(_0xe0f3('0x14'))('api');var utils=require(_0xe0f3('0x15'));var config=require(_0xe0f3('0x16'));var licenseUtil=require(_0xe0f3('0x17'));var db=require(_0xe0f3('0x18'))['db'];function respondWithStatusCode(_0x462fda,_0x20c0b6){_0x20c0b6=_0x20c0b6||0xcc;return function(_0x47cdff){if(_0x47cdff){return _0x462fda[_0xe0f3('0x19')](_0x20c0b6);}return _0x462fda['status'](_0x20c0b6)[_0xe0f3('0x1a')]();};}function respondWithResult(_0x468eed,_0x3884a4){_0x3884a4=_0x3884a4||0xc8;return function(_0xd6a066){if(_0xd6a066){return _0x468eed[_0xe0f3('0x1b')](_0x3884a4)[_0xe0f3('0x1c')](_0xd6a066);}};}function respondWithFilteredResult(_0x543190,_0x18b441){return function(_0x2b931f){if(_0x2b931f){var _0x714f46=typeof _0x18b441[_0xe0f3('0x1d')]===_0xe0f3('0x1e')&&typeof _0x18b441[_0xe0f3('0x1f')]===_0xe0f3('0x1e');var _0x99062c=_0x2b931f[_0xe0f3('0x20')];var _0x28ed1e=_0x714f46?0x0:_0x18b441[_0xe0f3('0x1d')];var _0x379e63=_0x714f46?_0x2b931f[_0xe0f3('0x20')]:_0x18b441[_0xe0f3('0x1d')]+_0x18b441[_0xe0f3('0x1f')];var _0x55f7c8;if(_0x379e63>=_0x99062c){_0x379e63=_0x99062c;_0x55f7c8=0xc8;}else{_0x55f7c8=0xce;}_0x543190[_0xe0f3('0x1b')](_0x55f7c8);return _0x543190[_0xe0f3('0x21')]('Content-Range',_0x28ed1e+'-'+_0x379e63+'/'+_0x99062c)[_0xe0f3('0x1c')](_0x2b931f);}return null;};}function patchUpdates(_0x433f15){return function(_0x8c5da0){try{jsonpatch[_0xe0f3('0x22')](_0x8c5da0,_0x433f15,!![]);}catch(_0x22108b){return BPromise[_0xe0f3('0x23')](_0x22108b);}return _0x8c5da0['save']();};}function saveUpdates(_0x45abda,_0x2cb9b2){return function(_0x543a09){if(_0x543a09){return _0x543a09[_0xe0f3('0x24')](_0x45abda)[_0xe0f3('0x25')](function(_0x128ca4){return _0x128ca4;});}return null;};}function removeEntity(_0x21499b,_0x3f4579){return function(_0x39ef16){if(_0x39ef16){return _0x39ef16[_0xe0f3('0x26')]()[_0xe0f3('0x25')](function(){var _0x2d9b6c=_0x39ef16[_0xe0f3('0x27')]({'plain':!![]});var _0x48e66e=_0xe0f3('0x28');return db['UserProfileResource'][_0xe0f3('0x26')]({'where':{'type':_0x48e66e,'resourceId':_0x2d9b6c['id']}})[_0xe0f3('0x25')](function(){return _0x39ef16;});})[_0xe0f3('0x25')](function(){_0x21499b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4184,_0x1084be){return function(_0x5022e6){if(!_0x5022e6){_0x1f4184[_0xe0f3('0x19')](0x194);}return _0x5022e6;};}function handleError(_0x197718,_0x20e184){_0x20e184=_0x20e184||0x1f4;return function(_0x5e2a30){logger['error'](_0x5e2a30[_0xe0f3('0x29')]);if(_0x5e2a30[_0xe0f3('0x2a')]){delete _0x5e2a30[_0xe0f3('0x2a')];}_0x197718[_0xe0f3('0x1b')](_0x20e184)[_0xe0f3('0x2b')](_0x5e2a30);};}exports['index']=function(_0x26fd6a,_0x421cd5){var _0x2dbbea={},_0x3208a3={},_0x59ec95={'count':0x0,'rows':[]};var _0x2a9888=_[_0xe0f3('0x2c')](db['Template'][_0xe0f3('0x2d')],function(_0x51eb18){return{'name':_0x51eb18['fieldName'],'type':_0x51eb18[_0xe0f3('0x2e')]['key']};});_0x3208a3['model']=_[_0xe0f3('0x2c')](_0x2a9888,_0xe0f3('0x2a'));_0x3208a3[_0xe0f3('0x2f')]=_[_0xe0f3('0x30')](_0x26fd6a[_0xe0f3('0x2f')]);_0x3208a3[_0xe0f3('0x31')]=_[_0xe0f3('0x32')](_0x3208a3[_0xe0f3('0x33')],_0x3208a3['query']);_0x2dbbea['attributes']=_[_0xe0f3('0x32')](_0x3208a3['model'],qs[_0xe0f3('0x34')](_0x26fd6a[_0xe0f3('0x2f')][_0xe0f3('0x34')]));_0x2dbbea[_0xe0f3('0x35')]=_0x2dbbea[_0xe0f3('0x35')][_0xe0f3('0x36')]?_0x2dbbea[_0xe0f3('0x35')]:_0x3208a3[_0xe0f3('0x33')];if(!_0x26fd6a[_0xe0f3('0x2f')]['hasOwnProperty']('nolimit')){_0x2dbbea['limit']=qs['limit'](_0x26fd6a[_0xe0f3('0x2f')]['limit']);_0x2dbbea[_0xe0f3('0x1d')]=qs[_0xe0f3('0x1d')](_0x26fd6a['query'][_0xe0f3('0x1d')]);}_0x2dbbea['order']=qs[_0xe0f3('0x37')](_0x26fd6a[_0xe0f3('0x2f')][_0xe0f3('0x37')]);_0x2dbbea[_0xe0f3('0x38')]=qs[_0xe0f3('0x31')](_[_0xe0f3('0x39')](_0x26fd6a[_0xe0f3('0x2f')],_0x3208a3[_0xe0f3('0x31')]),_0x2a9888);if(_0x26fd6a['query']['filter']){_0x2dbbea['where']=_['merge'](_0x2dbbea[_0xe0f3('0x38')],{'$or':_['map'](_0x2a9888,function(_0x11c45d){if(_0x11c45d['type']!=='VIRTUAL'){var _0x4758f5={};_0x4758f5[_0x11c45d['name']]={'$like':'%'+_0x26fd6a[_0xe0f3('0x2f')]['filter']+'%'};return _0x4758f5;}})});}_0x2dbbea=_[_0xe0f3('0x3a')]({},_0x2dbbea,_0x26fd6a[_0xe0f3('0x3b')]);var _0x886f7f={'where':_0x2dbbea[_0xe0f3('0x38')]};return db['Template']['count'](_0x886f7f)[_0xe0f3('0x25')](function(_0x344e3d){_0x59ec95[_0xe0f3('0x20')]=_0x344e3d;if(_0x26fd6a['query'][_0xe0f3('0x3c')]){_0x2dbbea[_0xe0f3('0x3d')]=[{'all':!![]}];}return db[_0xe0f3('0x3e')][_0xe0f3('0x3f')](_0x2dbbea);})[_0xe0f3('0x25')](function(_0x4a34c1){_0x59ec95[_0xe0f3('0x40')]=_0x4a34c1;return _0x59ec95;})[_0xe0f3('0x25')](respondWithFilteredResult(_0x421cd5,_0x2dbbea))[_0xe0f3('0x41')](handleError(_0x421cd5,null));};exports[_0xe0f3('0x42')]=function(_0x5c6d27,_0xba68d2){var _0x2b746f={'raw':!![],'where':{'id':_0x5c6d27[_0xe0f3('0x43')]['id']}},_0x1911f5={};_0x1911f5['model']=_[_0xe0f3('0x30')](db[_0xe0f3('0x3e')]['rawAttributes']);_0x1911f5[_0xe0f3('0x2f')]=_[_0xe0f3('0x30')](_0x5c6d27['query']);_0x1911f5[_0xe0f3('0x31')]=_[_0xe0f3('0x32')](_0x1911f5[_0xe0f3('0x33')],_0x1911f5[_0xe0f3('0x2f')]);_0x2b746f['attributes']=_[_0xe0f3('0x32')](_0x1911f5[_0xe0f3('0x33')],qs['fields'](_0x5c6d27[_0xe0f3('0x2f')][_0xe0f3('0x34')]));_0x2b746f[_0xe0f3('0x35')]=_0x2b746f['attributes']['length']?_0x2b746f[_0xe0f3('0x35')]:_0x1911f5['model'];if(_0x5c6d27[_0xe0f3('0x2f')]['includeAll']){_0x2b746f[_0xe0f3('0x3d')]=[{'all':!![]}];}_0x2b746f=_[_0xe0f3('0x3a')]({},_0x2b746f,_0x5c6d27[_0xe0f3('0x3b')]);return db[_0xe0f3('0x3e')][_0xe0f3('0x44')](_0x2b746f)[_0xe0f3('0x25')](handleEntityNotFound(_0xba68d2,null))[_0xe0f3('0x25')](respondWithResult(_0xba68d2,null))[_0xe0f3('0x41')](handleError(_0xba68d2,null));};exports[_0xe0f3('0x45')]=function(_0x31ceaa,_0x165433){return db[_0xe0f3('0x3e')][_0xe0f3('0x45')](_0x31ceaa['body'],{})['then'](function(_0x186c1f){var _0x1035e5=_0x31ceaa['user']['get']({'plain':!![]});if(!_0x1035e5)throw new Error(_0xe0f3('0x46'));if(_0x1035e5[_0xe0f3('0x47')]===_0xe0f3('0x48')){var _0x42c3fd=_0x186c1f[_0xe0f3('0x27')]({'plain':!![]});var _0x25a75f=_0xe0f3('0x28');return db['UserProfileSection'][_0xe0f3('0x44')]({'where':{'name':_0x25a75f,'userProfileId':_0x1035e5[_0xe0f3('0x49')]},'raw':!![]})[_0xe0f3('0x25')](function(_0x30a43b){if(_0x30a43b&&_0x30a43b[_0xe0f3('0x4a')]===0x0){return db[_0xe0f3('0x4b')][_0xe0f3('0x45')]({'name':_0x42c3fd['name'],'resourceId':_0x42c3fd['id'],'type':_0x30a43b[_0xe0f3('0x2a')],'sectionId':_0x30a43b['id']},{})[_0xe0f3('0x25')](function(){return _0x186c1f;});}else{return _0x186c1f;}})[_0xe0f3('0x41')](function(_0x4a9da5){logger[_0xe0f3('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a9da5);throw _0x4a9da5;});}return _0x186c1f;})[_0xe0f3('0x25')](respondWithResult(_0x165433,0xc9))[_0xe0f3('0x41')](handleError(_0x165433,null));};exports['update']=function(_0x51bca3,_0x633527){if(_0x51bca3[_0xe0f3('0x4d')]['id']){delete _0x51bca3[_0xe0f3('0x4d')]['id'];}return db[_0xe0f3('0x3e')][_0xe0f3('0x44')]({'where':{'id':_0x51bca3['params']['id']}})['then'](handleEntityNotFound(_0x633527,null))[_0xe0f3('0x25')](saveUpdates(_0x51bca3[_0xe0f3('0x4d')],null))[_0xe0f3('0x25')](respondWithResult(_0x633527,null))[_0xe0f3('0x41')](handleError(_0x633527,null));};exports[_0xe0f3('0x26')]=function(_0x1a3dc9,_0x96cd54){return db[_0xe0f3('0x3e')][_0xe0f3('0x44')]({'where':{'id':_0x1a3dc9[_0xe0f3('0x43')]['id']}})[_0xe0f3('0x25')](handleEntityNotFound(_0x96cd54,null))[_0xe0f3('0x25')](removeEntity(_0x96cd54,null))['catch'](handleError(_0x96cd54,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6b67782..75dc734 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 _0xd844=['Template','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xd844,0x14b));var _0x4d84=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd844[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x4d84('0x0'));var util=require(_0x4d84('0x1'));var logger=require(_0x4d84('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4d84('0x3'));var rp=require(_0x4d84('0x4'));var fs=require('fs');var path=require(_0x4d84('0x5'));var rimraf=require(_0x4d84('0x6'));var config=require(_0x4d84('0x7'));var attributes=require(_0x4d84('0x8'));module['exports']=function(_0x3f6717,_0x1591f7){return _0x3f6717['define'](_0x4d84('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbad=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x3f3a2c,_0x333417){var _0x575ead=function(_0x33f5ed){while(--_0x33f5ed){_0x3f3a2c['push'](_0x3f3a2c['shift']());}};_0x575ead(++_0x333417);}(_0xcbad,0x66));var _0xdcba=function(_0x31aacb,_0x4fe84f){_0x31aacb=_0x31aacb-0x0;var _0x1ae63d=_0xcbad[_0x31aacb];return _0x1ae63d;};'use strict';var _=require(_0xdcba('0x0'));var util=require(_0xdcba('0x1'));var logger=require(_0xdcba('0x2'))(_0xdcba('0x3'));var moment=require(_0xdcba('0x4'));var BPromise=require(_0xdcba('0x5'));var rp=require(_0xdcba('0x6'));var fs=require('fs');var path=require(_0xdcba('0x7'));var rimraf=require(_0xdcba('0x8'));var config=require(_0xdcba('0x9'));var attributes=require(_0xdcba('0xa'));module[_0xdcba('0xb')]=function(_0x32ca11,_0x395610){return _0x32ca11[_0xdcba('0xc')](_0xdcba('0xd'),attributes,{'tableName':_0xdcba('0xe'),'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 1ef0598..6c0ce7e 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 _0xaaba=['GetTemplate','Template','options','where','attributes','limit','include','model','map','stringify','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x35568e,_0x28512c){var _0x389ad8=function(_0x105c35){while(--_0x105c35){_0x35568e['push'](_0x35568e['shift']());}};_0x389ad8(++_0x28512c);}(_0xaaba,0x10f));var _0xaaab=function(_0x1aa011,_0x16332d){_0x1aa011=_0x1aa011-0x0;var _0x4d66e4=_0xaaba[_0x1aa011];return _0x4d66e4;};'use strict';var _=require(_0xaaab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaaab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaab('0x2'));var db=require(_0xaaab('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaaab('0x4'));var config=require(_0xaaab('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xaaab('0x6')][_0xaaab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16cc7f,_0x44a497,_0x1f89b3){return new BPromise(function(_0x124dd3,_0x44a370){return client[_0xaaab('0x8')](_0x16cc7f,_0x1f89b3)[_0xaaab('0x9')](function(_0x35a108){logger[_0xaaab('0xa')](_0xaaab('0xb'),_0x44a497,_0xaaab('0xc'));logger['debug'](_0xaaab('0xd'),_0x44a497,_0xaaab('0xc'),JSON['stringify'](_0x35a108));if(_0x35a108['error']){if(_0x35a108[_0xaaab('0xe')][_0xaaab('0xf')]===0x1f4){logger[_0xaaab('0xe')](_0xaaab('0xb'),_0x44a497,_0x35a108[_0xaaab('0xe')]['message']);return _0x44a370(_0x35a108['error'][_0xaaab('0x10')]);}logger[_0xaaab('0xe')](_0xaaab('0xb'),_0x44a497,_0x35a108['error'][_0xaaab('0x10')]);return _0x124dd3(_0x35a108[_0xaaab('0xe')]['message']);}else{logger['info'](_0xaaab('0xb'),_0x44a497,_0xaaab('0xc'));_0x124dd3(_0x35a108[_0xaaab('0x11')][_0xaaab('0x10')]);}})[_0xaaab('0x12')](function(_0x554a44){logger[_0xaaab('0xe')](_0xaaab('0xb'),_0x44a497,_0x554a44);_0x44a370(_0x554a44);});});}exports[_0xaaab('0x13')]=function(_0x4f18ef){var _0x4aff64=this;return new Promise(function(_0x7ce94,_0x139edb){return db[_0xaaab('0x14')]['findAll']({'raw':_0x4f18ef[_0xaaab('0x15')]?_0x4f18ef[_0xaaab('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4f18ef['options']?_0x4f18ef['options'][_0xaaab('0x16')]||null:null,'attributes':_0x4f18ef[_0xaaab('0x15')]?_0x4f18ef['options'][_0xaaab('0x17')]||null:null,'limit':_0x4f18ef[_0xaaab('0x15')]?_0x4f18ef[_0xaaab('0x15')][_0xaaab('0x18')]||null:null,'include':_0x4f18ef[_0xaaab('0x15')]?_0x4f18ef[_0xaaab('0x15')]['include']?_['map'](_0x4f18ef[_0xaaab('0x15')][_0xaaab('0x19')],function(_0x23f9fa){return{'model':db[_0x23f9fa[_0xaaab('0x1a')]],'as':_0x23f9fa['as'],'attributes':_0x23f9fa['attributes'],'include':_0x23f9fa[_0xaaab('0x19')]?_[_0xaaab('0x1b')](_0x23f9fa[_0xaaab('0x19')],function(_0x3acde9){return{'model':db[_0x3acde9[_0xaaab('0x1a')]],'as':_0x3acde9['as'],'attributes':_0x3acde9[_0xaaab('0x17')],'include':_0x3acde9[_0xaaab('0x19')]?_[_0xaaab('0x1b')](_0x3acde9[_0xaaab('0x19')],function(_0x384030){return{'model':db[_0x384030[_0xaaab('0x1a')]],'as':_0x384030['as'],'attributes':_0x384030[_0xaaab('0x17')]};}):[]};}):[]};}):[]:[]})[_0xaaab('0x9')](function(_0x3afe7f){logger[_0xaaab('0xa')](_0xaaab('0x13'),_0x4f18ef);logger['debug'](_0xaaab('0x13'),_0x4f18ef,JSON[_0xaaab('0x1c')](_0x3afe7f));_0x7ce94(_0x3afe7f);})['catch'](function(_0x233413){logger[_0xaaab('0xe')](_0xaaab('0x13'),_0x233413['message'],_0x4f18ef);_0x139edb(_0x4aff64[_0xaaab('0xe')](0x1f4,_0x233413['message']));});});}; \ No newline at end of file +var _0xdc64=['rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','include','map','model','attributes','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xdc64,0x80));var _0x4dc6=function(_0x3e7b78,_0x1eb3ba){_0x3e7b78=_0x3e7b78-0x0;var _0xba75f3=_0xdc64[_0x3e7b78];return _0xba75f3;};'use strict';var _=require(_0x4dc6('0x0'));var util=require(_0x4dc6('0x1'));var moment=require(_0x4dc6('0x2'));var BPromise=require(_0x4dc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4dc6('0x4'));var db=require(_0x4dc6('0x5'))['db'];var utils=require(_0x4dc6('0x6'));var logger=require(_0x4dc6('0x7'))(_0x4dc6('0x8'));var config=require(_0x4dc6('0x9'));var jayson=require(_0x4dc6('0xa'));var client=jayson[_0x4dc6('0xb')][_0x4dc6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x469d65,_0x474f06,_0x9656e8){return new BPromise(function(_0x293005,_0x3edb63){return client[_0x4dc6('0xd')](_0x469d65,_0x9656e8)['then'](function(_0x3aac5d){logger[_0x4dc6('0xe')](_0x4dc6('0xf'),_0x474f06,'request\x20sent');logger[_0x4dc6('0x10')](_0x4dc6('0x11'),_0x474f06,'request\x20sent',JSON[_0x4dc6('0x12')](_0x3aac5d));if(_0x3aac5d[_0x4dc6('0x13')]){if(_0x3aac5d['error'][_0x4dc6('0x14')]===0x1f4){logger[_0x4dc6('0x13')]('Template,\x20%s,\x20%s',_0x474f06,_0x3aac5d[_0x4dc6('0x13')]['message']);return _0x3edb63(_0x3aac5d[_0x4dc6('0x13')][_0x4dc6('0x15')]);}logger[_0x4dc6('0x13')]('Template,\x20%s,\x20%s',_0x474f06,_0x3aac5d[_0x4dc6('0x13')][_0x4dc6('0x15')]);return _0x293005(_0x3aac5d[_0x4dc6('0x13')][_0x4dc6('0x15')]);}else{logger[_0x4dc6('0xe')]('Template,\x20%s,\x20%s',_0x474f06,'request\x20sent');_0x293005(_0x3aac5d[_0x4dc6('0x16')][_0x4dc6('0x15')]);}})[_0x4dc6('0x17')](function(_0x311395){logger[_0x4dc6('0x13')](_0x4dc6('0xf'),_0x474f06,_0x311395);_0x3edb63(_0x311395);});});}exports[_0x4dc6('0x18')]=function(_0x834070){var _0x29cd04=this;return new Promise(function(_0x45caff,_0x495fb6){return db[_0x4dc6('0x19')][_0x4dc6('0x1a')]({'raw':_0x834070['options']?_0x834070[_0x4dc6('0x1b')][_0x4dc6('0x1c')]===undefined?!![]:![]:!![],'where':_0x834070['options']?_0x834070['options']['where']||null:null,'attributes':_0x834070[_0x4dc6('0x1b')]?_0x834070[_0x4dc6('0x1b')]['attributes']||null:null,'limit':_0x834070['options']?_0x834070[_0x4dc6('0x1b')]['limit']||null:null,'include':_0x834070['options']?_0x834070[_0x4dc6('0x1b')][_0x4dc6('0x1d')]?_[_0x4dc6('0x1e')](_0x834070[_0x4dc6('0x1b')][_0x4dc6('0x1d')],function(_0x5d7301){return{'model':db[_0x5d7301[_0x4dc6('0x1f')]],'as':_0x5d7301['as'],'attributes':_0x5d7301[_0x4dc6('0x20')],'include':_0x5d7301[_0x4dc6('0x1d')]?_[_0x4dc6('0x1e')](_0x5d7301[_0x4dc6('0x1d')],function(_0x2dbb5f){return{'model':db[_0x2dbb5f[_0x4dc6('0x1f')]],'as':_0x2dbb5f['as'],'attributes':_0x2dbb5f[_0x4dc6('0x20')],'include':_0x2dbb5f['include']?_[_0x4dc6('0x1e')](_0x2dbb5f[_0x4dc6('0x1d')],function(_0x2c5154){return{'model':db[_0x2c5154[_0x4dc6('0x1f')]],'as':_0x2c5154['as'],'attributes':_0x2c5154['attributes']};}):[]};}):[]};}):[]:[]})[_0x4dc6('0x21')](function(_0x13fa14){logger[_0x4dc6('0xe')]('GetTemplate',_0x834070);logger[_0x4dc6('0x10')](_0x4dc6('0x18'),_0x834070,JSON['stringify'](_0x13fa14));_0x45caff(_0x13fa14);})[_0x4dc6('0x17')](function(_0x42371f){logger[_0x4dc6('0x13')](_0x4dc6('0x18'),_0x42371f[_0x4dc6('0x15')],_0x834070);_0x495fb6(_0x29cd04['error'](0x1f4,_0x42371f[_0x4dc6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4d8879e..3c02696 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 _0x110d=['index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0x110d,0x17d));var _0xd110=function(_0x1ea05a,_0x231ff3){_0x1ea05a=_0x1ea05a-0x0;var _0x58ee3a=_0x110d[_0x1ea05a];return _0x58ee3a;};'use strict';var multer=require(_0xd110('0x0'));var util=require(_0xd110('0x1'));var path=require(_0xd110('0x2'));var timeout=require(_0xd110('0x3'));var express=require(_0xd110('0x4'));var router=express['Router']();var fs_extra=require(_0xd110('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd110('0x6'));var config=require(_0xd110('0x7'));var controller=require(_0xd110('0x8'));router[_0xd110('0x9')]('/',auth[_0xd110('0xa')](),controller[_0xd110('0xb')]);router[_0xd110('0x9')](_0xd110('0xc'),auth['isAuthenticated'](),controller[_0xd110('0xd')]);router[_0xd110('0x9')](_0xd110('0xe'),auth[_0xd110('0xa')](),controller[_0xd110('0xf')]);router[_0xd110('0x9')](_0xd110('0x10'),auth[_0xd110('0xa')](),controller[_0xd110('0x11')]);router[_0xd110('0x9')](_0xd110('0x12'),auth['isAuthenticated'](),controller[_0xd110('0x13')]);router[_0xd110('0x14')]('/',auth[_0xd110('0xa')](),controller[_0xd110('0x15')]);router['post'](_0xd110('0xe'),auth[_0xd110('0xa')](),controller[_0xd110('0x16')]);router[_0xd110('0x14')](_0xd110('0x10'),auth['isAuthenticated'](),controller[_0xd110('0x17')]);router['post'](_0xd110('0x12'),auth[_0xd110('0xa')](),controller[_0xd110('0x18')]);router[_0xd110('0x19')](_0xd110('0xc'),auth[_0xd110('0xa')](),controller[_0xd110('0x1a')]);router[_0xd110('0x1b')](_0xd110('0xc'),auth[_0xd110('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe1d8=['index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated'];(function(_0x1eda88,_0x555454){var _0x2eb594=function(_0x250216){while(--_0x250216){_0x1eda88['push'](_0x1eda88['shift']());}};_0x2eb594(++_0x555454);}(_0xe1d8,0xce));var _0x8e1d=function(_0x15d715,_0x16c046){_0x15d715=_0x15d715-0x0;var _0x129065=_0xe1d8[_0x15d715];return _0x129065;};'use strict';var multer=require('multer');var util=require(_0x8e1d('0x0'));var path=require(_0x8e1d('0x1'));var timeout=require(_0x8e1d('0x2'));var express=require(_0x8e1d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e1d('0x4'));var interaction=require(_0x8e1d('0x5'));var config=require(_0x8e1d('0x6'));var controller=require(_0x8e1d('0x7'));router[_0x8e1d('0x8')]('/',auth[_0x8e1d('0x9')](),controller[_0x8e1d('0xa')]);router[_0x8e1d('0x8')](_0x8e1d('0xb'),auth['isAuthenticated'](),controller[_0x8e1d('0xc')]);router['get'](_0x8e1d('0xd'),auth['isAuthenticated'](),controller[_0x8e1d('0xe')]);router[_0x8e1d('0x8')](_0x8e1d('0xf'),auth[_0x8e1d('0x9')](),controller[_0x8e1d('0x10')]);router[_0x8e1d('0x8')](_0x8e1d('0x11'),auth[_0x8e1d('0x9')](),controller[_0x8e1d('0x12')]);router[_0x8e1d('0x13')]('/',auth[_0x8e1d('0x9')](),controller[_0x8e1d('0x14')]);router[_0x8e1d('0x13')](_0x8e1d('0xd'),auth[_0x8e1d('0x9')](),controller[_0x8e1d('0x15')]);router['post']('/:id/any_conditions',auth[_0x8e1d('0x9')](),controller[_0x8e1d('0x16')]);router[_0x8e1d('0x13')](_0x8e1d('0x11'),auth[_0x8e1d('0x9')](),controller['addAction']);router[_0x8e1d('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x8e1d('0x18')]);router[_0x8e1d('0x19')](_0x8e1d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8e1d('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 780d7d6..45f162f 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 _0x087b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1c2507,_0x12d4e3){var _0x2e7025=function(_0x3693c0){while(--_0x3693c0){_0x1c2507['push'](_0x1c2507['shift']());}};_0x2e7025(++_0x12d4e3);}(_0x087b,0x12e));var _0xb087=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x087b[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb087('0x2')]},'description':{'type':Sequelize[_0xb087('0x2')]},'status':{'type':Sequelize[_0xb087('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x272f=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5f2b6b,_0x15de7b){var _0x56b668=function(_0x84433d){while(--_0x84433d){_0x5f2b6b['push'](_0x5f2b6b['shift']());}};_0x56b668(++_0x15de7b);}(_0x272f,0x1bc));var _0xf272=function(_0x10aedc,_0x2d6197){_0x10aedc=_0x10aedc-0x0;var _0x1fafc0=_0x272f[_0x10aedc];return _0x1fafc0;};'use strict';var Sequelize=require(_0xf272('0x0'));module[_0xf272('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf272('0x2')]},'description':{'type':Sequelize[_0xf272('0x2')]},'status':{'type':Sequelize[_0xf272('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index a4deaea..b451e3a 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 _0x6660=['Content-Range','apply','reject','then','destroy','get','end','error','stack','name','send','index','map','Trigger','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','order','addAction','TriggerId','findOne','Action','getActions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x235b1e,_0x55754a){var _0x46553d=function(_0x5e317d){while(--_0x5e317d){_0x235b1e['push'](_0x235b1e['shift']());}};_0x46553d(++_0x55754a);}(_0x6660,0x1c7));var _0x0666=function(_0xa1e3c,_0x3ae072){_0xa1e3c=_0xa1e3c-0x0;var _0x36fc82=_0x6660[_0xa1e3c];return _0x36fc82;};'use strict';var emlformat=require(_0x0666('0x0'));var rimraf=require(_0x0666('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0666('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0666('0x3'));var Mustache=require(_0x0666('0x4'));var util=require(_0x0666('0x5'));var path=require(_0x0666('0x6'));var sox=require(_0x0666('0x7'));var csv=require('to-csv');var ejs=require(_0x0666('0x8'));var fs=require('fs');var fs_extra=require(_0x0666('0x9'));var _=require(_0x0666('0xa'));var squel=require(_0x0666('0xb'));var crypto=require(_0x0666('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0666('0xd'));var toCsv=require(_0x0666('0xe'));var querystring=require(_0x0666('0xf'));var Papa=require(_0x0666('0x10'));var Redis=require(_0x0666('0x11'));var authService=require(_0x0666('0x12'));var qs=require(_0x0666('0x13'));var as=require(_0x0666('0x14'));var hardwareService=require(_0x0666('0x15'));var logger=require(_0x0666('0x16'))(_0x0666('0x17'));var utils=require(_0x0666('0x18'));var config=require(_0x0666('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0666('0x1a'))['db'];function respondWithStatusCode(_0xb3f6f4,_0x44ffeb){_0x44ffeb=_0x44ffeb||0xcc;return function(_0x4831bd){if(_0x4831bd){return _0xb3f6f4[_0x0666('0x1b')](_0x44ffeb);}return _0xb3f6f4[_0x0666('0x1c')](_0x44ffeb)['end']();};}function respondWithResult(_0x5a3f40,_0x3b3ada){_0x3b3ada=_0x3b3ada||0xc8;return function(_0x29fcf1){if(_0x29fcf1){return _0x5a3f40['status'](_0x3b3ada)[_0x0666('0x1d')](_0x29fcf1);}};}function respondWithFilteredResult(_0x371a86,_0x5e3dff){return function(_0x3cf114){if(_0x3cf114){var _0x1ff4f8=typeof _0x5e3dff[_0x0666('0x1e')]===_0x0666('0x1f')&&typeof _0x5e3dff[_0x0666('0x20')]===_0x0666('0x1f');var _0x3a0379=_0x3cf114[_0x0666('0x21')];var _0x4c22f6=_0x1ff4f8?0x0:_0x5e3dff[_0x0666('0x1e')];var _0x20f74b=_0x1ff4f8?_0x3cf114[_0x0666('0x21')]:_0x5e3dff[_0x0666('0x1e')]+_0x5e3dff[_0x0666('0x20')];var _0x379de1;if(_0x20f74b>=_0x3a0379){_0x20f74b=_0x3a0379;_0x379de1=0xc8;}else{_0x379de1=0xce;}_0x371a86[_0x0666('0x1c')](_0x379de1);return _0x371a86[_0x0666('0x22')](_0x0666('0x23'),_0x4c22f6+'-'+_0x20f74b+'/'+_0x3a0379)[_0x0666('0x1d')](_0x3cf114);}return null;};}function patchUpdates(_0x3fe359){return function(_0x134742){try{jsonpatch[_0x0666('0x24')](_0x134742,_0x3fe359,!![]);}catch(_0x51f0c9){return BPromise[_0x0666('0x25')](_0x51f0c9);}return _0x134742['save']();};}function saveUpdates(_0x4f89d6,_0x473520){return function(_0x2fee23){if(_0x2fee23){return _0x2fee23['update'](_0x4f89d6)[_0x0666('0x26')](function(_0x438a56){return _0x438a56;});}return null;};}function removeEntity(_0x54217b,_0x1b527e){return function(_0x3a073f){if(_0x3a073f){return _0x3a073f[_0x0666('0x27')]()[_0x0666('0x26')](function(){var _0x3a3b66=_0x3a073f[_0x0666('0x28')]({'plain':!![]});var _0x4b2f98='Triggers';return db['UserProfileResource'][_0x0666('0x27')]({'where':{'type':_0x4b2f98,'resourceId':_0x3a3b66['id']}})[_0x0666('0x26')](function(){return _0x3a073f;});})[_0x0666('0x26')](function(){_0x54217b[_0x0666('0x1c')](0xcc)[_0x0666('0x29')]();});}};}function handleEntityNotFound(_0x3bbfe0,_0x5ee30d){return function(_0x39e35f){if(!_0x39e35f){_0x3bbfe0[_0x0666('0x1b')](0x194);}return _0x39e35f;};}function handleError(_0x5d68e5,_0x2e4e01){_0x2e4e01=_0x2e4e01||0x1f4;return function(_0x3d22bb){logger[_0x0666('0x2a')](_0x3d22bb[_0x0666('0x2b')]);if(_0x3d22bb[_0x0666('0x2c')]){delete _0x3d22bb['name'];}_0x5d68e5[_0x0666('0x1c')](_0x2e4e01)[_0x0666('0x2d')](_0x3d22bb);};}exports[_0x0666('0x2e')]=function(_0x248347,_0x10d68){var _0x3bb969={},_0x2f2e82={},_0x3a1943={'count':0x0,'rows':[]};var _0x345ce3=_[_0x0666('0x2f')](db[_0x0666('0x30')][_0x0666('0x31')],function(_0x1e3ddb){return{'name':_0x1e3ddb['fieldName'],'type':_0x1e3ddb['type']['key']};});_0x2f2e82[_0x0666('0x32')]=_[_0x0666('0x2f')](_0x345ce3,'name');_0x2f2e82['query']=_[_0x0666('0x33')](_0x248347[_0x0666('0x34')]);_0x2f2e82[_0x0666('0x35')]=_[_0x0666('0x36')](_0x2f2e82[_0x0666('0x32')],_0x2f2e82[_0x0666('0x34')]);_0x3bb969[_0x0666('0x37')]=_[_0x0666('0x36')](_0x2f2e82[_0x0666('0x32')],qs[_0x0666('0x38')](_0x248347[_0x0666('0x34')]['fields']));_0x3bb969[_0x0666('0x37')]=_0x3bb969[_0x0666('0x37')]['length']?_0x3bb969[_0x0666('0x37')]:_0x2f2e82[_0x0666('0x32')];if(!_0x248347[_0x0666('0x34')][_0x0666('0x39')](_0x0666('0x3a'))){_0x3bb969[_0x0666('0x20')]=qs[_0x0666('0x20')](_0x248347[_0x0666('0x34')][_0x0666('0x20')]);_0x3bb969[_0x0666('0x1e')]=qs[_0x0666('0x1e')](_0x248347[_0x0666('0x34')]['offset']);}_0x3bb969['order']=qs[_0x0666('0x3b')](_0x248347[_0x0666('0x34')]['sort']);_0x3bb969[_0x0666('0x3c')]=qs[_0x0666('0x35')](_[_0x0666('0x3d')](_0x248347[_0x0666('0x34')],_0x2f2e82[_0x0666('0x35')]),_0x345ce3);if(_0x248347[_0x0666('0x34')][_0x0666('0x3e')]){_0x3bb969[_0x0666('0x3c')]=_['merge'](_0x3bb969[_0x0666('0x3c')],{'$or':_[_0x0666('0x2f')](_0x345ce3,function(_0x491244){if(_0x491244[_0x0666('0x3f')]!==_0x0666('0x40')){var _0x3f19d1={};_0x3f19d1[_0x491244[_0x0666('0x2c')]]={'$like':'%'+_0x248347[_0x0666('0x34')][_0x0666('0x3e')]+'%'};return _0x3f19d1;}})});}_0x3bb969=_[_0x0666('0x41')]({},_0x3bb969,_0x248347[_0x0666('0x42')]);var _0x1179b4={'where':_0x3bb969[_0x0666('0x3c')]};return db['Trigger'][_0x0666('0x21')](_0x1179b4)[_0x0666('0x26')](function(_0x4c4102){_0x3a1943[_0x0666('0x21')]=_0x4c4102;if(_0x248347[_0x0666('0x34')][_0x0666('0x43')]){_0x3bb969[_0x0666('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x0666('0x45')](_0x3bb969);})[_0x0666('0x26')](function(_0x4b6f8c){_0x3a1943[_0x0666('0x46')]=_0x4b6f8c;return _0x3a1943;})['then'](respondWithFilteredResult(_0x10d68,_0x3bb969))[_0x0666('0x47')](handleError(_0x10d68,null));};exports[_0x0666('0x48')]=function(_0xc466fc,_0x15dc5a){var _0x54bfa4={'raw':![],'where':{'id':_0xc466fc[_0x0666('0x49')]['id']}},_0x43809b={};_0x43809b[_0x0666('0x32')]=_[_0x0666('0x33')](db[_0x0666('0x30')][_0x0666('0x31')]);_0x43809b['query']=_[_0x0666('0x33')](_0xc466fc['query']);_0x43809b[_0x0666('0x35')]=_[_0x0666('0x36')](_0x43809b['model'],_0x43809b['query']);_0x54bfa4[_0x0666('0x37')]=_[_0x0666('0x36')](_0x43809b['model'],qs['fields'](_0xc466fc[_0x0666('0x34')][_0x0666('0x38')]));_0x54bfa4[_0x0666('0x37')]=_0x54bfa4[_0x0666('0x37')][_0x0666('0x4a')]?_0x54bfa4['attributes']:_0x43809b[_0x0666('0x32')];if(_0xc466fc[_0x0666('0x34')][_0x0666('0x43')]){_0x54bfa4[_0x0666('0x44')]=[{'all':!![]}];}_0x54bfa4=_[_0x0666('0x41')]({},_0x54bfa4,_0xc466fc[_0x0666('0x42')]);return db[_0x0666('0x30')][_0x0666('0x4b')](_0x54bfa4)['then'](handleEntityNotFound(_0x15dc5a,null))['then'](respondWithResult(_0x15dc5a,null))[_0x0666('0x47')](handleError(_0x15dc5a,null));};exports[_0x0666('0x4c')]=function(_0x54f5cc,_0x11d8ec){return db['Trigger']['create'](_0x54f5cc[_0x0666('0x4d')],{})['then'](function(_0x21ff25){var _0x3ba806=_0x54f5cc[_0x0666('0x4e')]['get']({'plain':!![]});if(!_0x3ba806)throw new Error(_0x0666('0x4f'));if(_0x3ba806[_0x0666('0x50')]===_0x0666('0x4e')){var _0x18cfa4=_0x21ff25[_0x0666('0x28')]({'plain':!![]});var _0x14dc38='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0x14dc38,'userProfileId':_0x3ba806[_0x0666('0x51')]},'raw':!![]})[_0x0666('0x26')](function(_0x492282){if(_0x492282&&_0x492282[_0x0666('0x52')]===0x0){return db[_0x0666('0x53')]['create']({'name':_0x18cfa4[_0x0666('0x2c')],'resourceId':_0x18cfa4['id'],'type':_0x492282['name'],'sectionId':_0x492282['id']},{})[_0x0666('0x26')](function(){return _0x21ff25;});}else{return _0x21ff25;}})[_0x0666('0x47')](function(_0xc058ee){logger[_0x0666('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc058ee);throw _0xc058ee;});}return _0x21ff25;})[_0x0666('0x26')](respondWithResult(_0x11d8ec,0xc9))[_0x0666('0x47')](handleError(_0x11d8ec,null));};exports[_0x0666('0x54')]=function(_0x42301f,_0x484e6e){if(_0x42301f[_0x0666('0x4d')]['id']){delete _0x42301f[_0x0666('0x4d')]['id'];}return db[_0x0666('0x30')][_0x0666('0x4b')]({'where':{'id':_0x42301f[_0x0666('0x49')]['id']}})[_0x0666('0x26')](handleEntityNotFound(_0x484e6e,null))[_0x0666('0x26')](saveUpdates(_0x42301f['body'],null))[_0x0666('0x26')](respondWithResult(_0x484e6e,null))[_0x0666('0x47')](handleError(_0x484e6e,null));};exports[_0x0666('0x27')]=function(_0x34a8a1,_0x31c314){return db[_0x0666('0x30')][_0x0666('0x4b')]({'where':{'id':_0x34a8a1[_0x0666('0x49')]['id']}})['then'](handleEntityNotFound(_0x31c314,null))[_0x0666('0x26')](removeEntity(_0x31c314,null))[_0x0666('0x47')](handleError(_0x31c314,null));};exports[_0x0666('0x55')]=function(_0x2a18e4,_0x50184b,_0x199dd3){if(_0x2a18e4['body']['id']){delete _0x2a18e4[_0x0666('0x4d')]['id'];}return db[_0x0666('0x30')][_0x0666('0x4b')]({'where':{'id':_0x2a18e4[_0x0666('0x49')]['id']}})[_0x0666('0x26')](handleEntityNotFound(_0x50184b,null))[_0x0666('0x26')](function(_0x15d64c){if(_0x15d64c){_0x2a18e4[_0x0666('0x4d')][_0x0666('0x56')]=_0x15d64c['id'];return db[_0x0666('0x57')][_0x0666('0x4c')](_0x2a18e4[_0x0666('0x4d')]);}})[_0x0666('0x26')](respondWithResult(_0x50184b,null))['catch'](handleError(_0x50184b,null));};exports[_0x0666('0x58')]=function(_0x13d01a,_0x10e237,_0x54cf14){if(_0x13d01a['body']['id']){delete _0x13d01a['body']['id'];}return db[_0x0666('0x30')][_0x0666('0x4b')]({'where':{'id':_0x13d01a[_0x0666('0x49')]['id']}})['then'](handleEntityNotFound(_0x10e237,null))[_0x0666('0x26')](function(_0x18112d){if(_0x18112d){_0x13d01a[_0x0666('0x4d')][_0x0666('0x59')]=_0x18112d['id'];return db[_0x0666('0x57')][_0x0666('0x4c')](_0x13d01a[_0x0666('0x4d')]);}})[_0x0666('0x26')](respondWithResult(_0x10e237,null))[_0x0666('0x47')](handleError(_0x10e237,null));};exports[_0x0666('0x5a')]=function(_0x2a490b,_0x35b68b,_0x4dfc08){var _0x152d53={};var _0x5ac734={};var _0x47c0c3;var _0x3564f9;return db[_0x0666('0x30')]['findOne']({'where':{'id':_0x2a490b['params']['id']}})['then'](handleEntityNotFound(_0x35b68b,null))[_0x0666('0x26')](function(_0x13d7e7){if(_0x13d7e7){_0x47c0c3=_0x13d7e7;_0x5ac734[_0x0666('0x32')]=_['keys'](db[_0x0666('0x57')][_0x0666('0x31')]);_0x5ac734[_0x0666('0x34')]=_[_0x0666('0x33')](_0x2a490b[_0x0666('0x34')]);_0x5ac734[_0x0666('0x35')]=_[_0x0666('0x36')](_0x5ac734['model'],_0x5ac734[_0x0666('0x34')]);_0x152d53[_0x0666('0x37')]=_[_0x0666('0x36')](_0x5ac734[_0x0666('0x32')],qs[_0x0666('0x38')](_0x2a490b[_0x0666('0x34')][_0x0666('0x38')]));_0x152d53[_0x0666('0x37')]=_0x152d53[_0x0666('0x37')][_0x0666('0x4a')]?_0x152d53[_0x0666('0x37')]:_0x5ac734['model'];_0x152d53['order']=qs[_0x0666('0x3b')](_0x2a490b[_0x0666('0x34')][_0x0666('0x3b')]);_0x152d53['where']=qs[_0x0666('0x35')](_[_0x0666('0x3d')](_0x2a490b[_0x0666('0x34')],_0x5ac734[_0x0666('0x35')]));if(_0x2a490b[_0x0666('0x34')][_0x0666('0x3e')]){_0x152d53[_0x0666('0x3c')]=_[_0x0666('0x41')](_0x152d53[_0x0666('0x3c')],{'$or':_[_0x0666('0x2f')](_0x152d53[_0x0666('0x37')],function(_0x2e8125){var _0x2ab2ee={};_0x2ab2ee[_0x2e8125]={'$like':'%'+_0x2a490b[_0x0666('0x34')][_0x0666('0x3e')]+'%'};return _0x2ab2ee;})});}_0x152d53=_['merge']({},_0x152d53,_0x2a490b[_0x0666('0x42')]);return _0x47c0c3[_0x0666('0x5a')](_0x152d53);}})[_0x0666('0x26')](function(_0x43f441){if(_0x43f441){_0x3564f9=_0x43f441['length'];if(!_0x2a490b[_0x0666('0x34')][_0x0666('0x39')]('nolimit')){_0x152d53['limit']=qs[_0x0666('0x20')](_0x2a490b[_0x0666('0x34')][_0x0666('0x20')]);_0x152d53[_0x0666('0x1e')]=qs[_0x0666('0x1e')](_0x2a490b[_0x0666('0x34')][_0x0666('0x1e')]);}return _0x47c0c3['getAllConditions'](_0x152d53);}})[_0x0666('0x26')](function(_0x6f9b3b){if(_0x6f9b3b){return _0x6f9b3b?{'count':_0x3564f9,'rows':_0x6f9b3b}:null;}})[_0x0666('0x26')](respondWithResult(_0x35b68b,null))[_0x0666('0x47')](handleError(_0x35b68b,null));};exports[_0x0666('0x5b')]=function(_0x47b1e1,_0x32c582,_0x21c91a){var _0xd44117={};var _0x3d499a={};var _0x5c724d;var _0x35f98a;return db[_0x0666('0x30')]['findOne']({'where':{'id':_0x47b1e1[_0x0666('0x49')]['id']}})[_0x0666('0x26')](handleEntityNotFound(_0x32c582,null))[_0x0666('0x26')](function(_0x1663a9){if(_0x1663a9){_0x5c724d=_0x1663a9;_0x3d499a[_0x0666('0x32')]=_[_0x0666('0x33')](db[_0x0666('0x57')][_0x0666('0x31')]);_0x3d499a[_0x0666('0x34')]=_[_0x0666('0x33')](_0x47b1e1[_0x0666('0x34')]);_0x3d499a[_0x0666('0x35')]=_[_0x0666('0x36')](_0x3d499a[_0x0666('0x32')],_0x3d499a['query']);_0xd44117['attributes']=_[_0x0666('0x36')](_0x3d499a['model'],qs[_0x0666('0x38')](_0x47b1e1[_0x0666('0x34')]['fields']));_0xd44117[_0x0666('0x37')]=_0xd44117[_0x0666('0x37')]['length']?_0xd44117[_0x0666('0x37')]:_0x3d499a['model'];_0xd44117[_0x0666('0x5c')]=qs[_0x0666('0x3b')](_0x47b1e1['query'][_0x0666('0x3b')]);_0xd44117[_0x0666('0x3c')]=qs[_0x0666('0x35')](_[_0x0666('0x3d')](_0x47b1e1[_0x0666('0x34')],_0x3d499a[_0x0666('0x35')]));if(_0x47b1e1[_0x0666('0x34')][_0x0666('0x3e')]){_0xd44117[_0x0666('0x3c')]=_[_0x0666('0x41')](_0xd44117[_0x0666('0x3c')],{'$or':_[_0x0666('0x2f')](_0xd44117[_0x0666('0x37')],function(_0x34059a){var _0x298445={};_0x298445[_0x34059a]={'$like':'%'+_0x47b1e1[_0x0666('0x34')][_0x0666('0x3e')]+'%'};return _0x298445;})});}_0xd44117=_[_0x0666('0x41')]({},_0xd44117,_0x47b1e1[_0x0666('0x42')]);return _0x5c724d[_0x0666('0x5b')](_0xd44117);}})[_0x0666('0x26')](function(_0x37a94e){if(_0x37a94e){_0x35f98a=_0x37a94e['length'];if(!_0x47b1e1[_0x0666('0x34')][_0x0666('0x39')](_0x0666('0x3a'))){_0xd44117[_0x0666('0x20')]=qs['limit'](_0x47b1e1['query']['limit']);_0xd44117[_0x0666('0x1e')]=qs[_0x0666('0x1e')](_0x47b1e1[_0x0666('0x34')]['offset']);}return _0x5c724d[_0x0666('0x5b')](_0xd44117);}})[_0x0666('0x26')](function(_0x4bbac4){if(_0x4bbac4){return _0x4bbac4?{'count':_0x35f98a,'rows':_0x4bbac4}:null;}})['then'](respondWithResult(_0x32c582,null))[_0x0666('0x47')](handleError(_0x32c582,null));};exports[_0x0666('0x5d')]=function(_0x599114,_0x2f0636,_0x59114e){if(_0x599114[_0x0666('0x4d')]['id']){delete _0x599114['body']['id'];}return db[_0x0666('0x30')][_0x0666('0x4b')]({'where':{'id':_0x599114['params']['id']}})['then'](handleEntityNotFound(_0x2f0636,null))[_0x0666('0x26')](function(_0x1fd90b){if(_0x1fd90b){_0x599114[_0x0666('0x4d')][_0x0666('0x5e')]=_0x1fd90b['id'];return db['Action'][_0x0666('0x4c')](_0x599114[_0x0666('0x4d')]);}})[_0x0666('0x26')](respondWithResult(_0x2f0636,null))['catch'](handleError(_0x2f0636,null));};exports['getActions']=function(_0x52cbed,_0x540969,_0x293bb7){var _0x26be04={};var _0x20e576={};var _0x127b06;var _0x49e0cb;return db[_0x0666('0x30')][_0x0666('0x5f')]({'where':{'id':_0x52cbed[_0x0666('0x49')]['id']}})['then'](handleEntityNotFound(_0x540969,null))[_0x0666('0x26')](function(_0x49247e){if(_0x49247e){_0x127b06=_0x49247e;_0x20e576[_0x0666('0x32')]=_[_0x0666('0x33')](db[_0x0666('0x60')][_0x0666('0x31')]);_0x20e576[_0x0666('0x34')]=_['keys'](_0x52cbed[_0x0666('0x34')]);_0x20e576[_0x0666('0x35')]=_[_0x0666('0x36')](_0x20e576[_0x0666('0x32')],_0x20e576['query']);_0x26be04['attributes']=_[_0x0666('0x36')](_0x20e576[_0x0666('0x32')],qs['fields'](_0x52cbed[_0x0666('0x34')][_0x0666('0x38')]));_0x26be04[_0x0666('0x37')]=_0x26be04[_0x0666('0x37')][_0x0666('0x4a')]?_0x26be04['attributes']:_0x20e576['model'];_0x26be04['order']=qs[_0x0666('0x3b')](_0x52cbed[_0x0666('0x34')]['sort']);_0x26be04[_0x0666('0x3c')]=qs[_0x0666('0x35')](_[_0x0666('0x3d')](_0x52cbed[_0x0666('0x34')],_0x20e576[_0x0666('0x35')]));if(_0x52cbed[_0x0666('0x34')][_0x0666('0x3e')]){_0x26be04['where']=_[_0x0666('0x41')](_0x26be04[_0x0666('0x3c')],{'$or':_[_0x0666('0x2f')](_0x26be04[_0x0666('0x37')],function(_0xb3f879){var _0x27d74d={};_0x27d74d[_0xb3f879]={'$like':'%'+_0x52cbed['query'][_0x0666('0x3e')]+'%'};return _0x27d74d;})});}_0x26be04=_[_0x0666('0x41')]({},_0x26be04,_0x52cbed['options']);return _0x127b06[_0x0666('0x61')](_0x26be04);}})[_0x0666('0x26')](function(_0x46396e){if(_0x46396e){_0x49e0cb=_0x46396e['length'];if(!_0x52cbed['query'][_0x0666('0x39')]('nolimit')){_0x26be04['limit']=qs[_0x0666('0x20')](_0x52cbed[_0x0666('0x34')][_0x0666('0x20')]);_0x26be04[_0x0666('0x1e')]=qs[_0x0666('0x1e')](_0x52cbed[_0x0666('0x34')][_0x0666('0x1e')]);}return _0x127b06[_0x0666('0x61')](_0x26be04);}})[_0x0666('0x26')](function(_0x264b74){if(_0x264b74){return _0x264b74?{'count':_0x49e0cb,'rows':_0x264b74}:null;}})[_0x0666('0x26')](respondWithResult(_0x540969,null))[_0x0666('0x47')](handleError(_0x540969,null));}; \ No newline at end of file +var _0x9253=['attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','catch','show','length','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','addAction','Action','getActions','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','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','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x9253,0x8a));var _0x3925=function(_0x263999,_0x477176){_0x263999=_0x263999-0x0;var _0x336996=_0x9253[_0x263999];return _0x336996;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3925('0x0'));var jsonpatch=require(_0x3925('0x1'));var rp=require('request-promise');var moment=require(_0x3925('0x2'));var BPromise=require(_0x3925('0x3'));var Mustache=require('mustache');var util=require(_0x3925('0x4'));var path=require(_0x3925('0x5'));var sox=require(_0x3925('0x6'));var csv=require(_0x3925('0x7'));var ejs=require(_0x3925('0x8'));var fs=require('fs');var fs_extra=require(_0x3925('0x9'));var _=require(_0x3925('0xa'));var squel=require('squel');var crypto=require(_0x3925('0xb'));var jsforce=require(_0x3925('0xc'));var deskjs=require(_0x3925('0xd'));var toCsv=require(_0x3925('0x7'));var querystring=require(_0x3925('0xe'));var Papa=require(_0x3925('0xf'));var Redis=require('ioredis');var authService=require(_0x3925('0x10'));var qs=require(_0x3925('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3925('0x12'));var logger=require(_0x3925('0x13'))('api');var utils=require(_0x3925('0x14'));var config=require(_0x3925('0x15'));var licenseUtil=require(_0x3925('0x16'));var db=require(_0x3925('0x17'))['db'];function respondWithStatusCode(_0x596a90,_0x4a42b3){_0x4a42b3=_0x4a42b3||0xcc;return function(_0x336173){if(_0x336173){return _0x596a90[_0x3925('0x18')](_0x4a42b3);}return _0x596a90[_0x3925('0x19')](_0x4a42b3)[_0x3925('0x1a')]();};}function respondWithResult(_0xfbc519,_0x1ca9ca){_0x1ca9ca=_0x1ca9ca||0xc8;return function(_0xccf8b){if(_0xccf8b){return _0xfbc519[_0x3925('0x19')](_0x1ca9ca)[_0x3925('0x1b')](_0xccf8b);}};}function respondWithFilteredResult(_0x20bdc5,_0x2e2023){return function(_0x3d7642){if(_0x3d7642){var _0x5dfef7=typeof _0x2e2023[_0x3925('0x1c')]===_0x3925('0x1d')&&typeof _0x2e2023[_0x3925('0x1e')]===_0x3925('0x1d');var _0x135559=_0x3d7642[_0x3925('0x1f')];var _0x349de9=_0x5dfef7?0x0:_0x2e2023[_0x3925('0x1c')];var _0x1507a1=_0x5dfef7?_0x3d7642[_0x3925('0x1f')]:_0x2e2023[_0x3925('0x1c')]+_0x2e2023['limit'];var _0x182ce3;if(_0x1507a1>=_0x135559){_0x1507a1=_0x135559;_0x182ce3=0xc8;}else{_0x182ce3=0xce;}_0x20bdc5[_0x3925('0x19')](_0x182ce3);return _0x20bdc5[_0x3925('0x20')](_0x3925('0x21'),_0x349de9+'-'+_0x1507a1+'/'+_0x135559)[_0x3925('0x1b')](_0x3d7642);}return null;};}function patchUpdates(_0x1f6439){return function(_0xf53f40){try{jsonpatch[_0x3925('0x22')](_0xf53f40,_0x1f6439,!![]);}catch(_0x3e0a38){return BPromise[_0x3925('0x23')](_0x3e0a38);}return _0xf53f40['save']();};}function saveUpdates(_0xfdaf0c,_0x354789){return function(_0x1be045){if(_0x1be045){return _0x1be045['update'](_0xfdaf0c)[_0x3925('0x24')](function(_0x428197){return _0x428197;});}return null;};}function removeEntity(_0x11d110,_0x44a029){return function(_0x5a67d8){if(_0x5a67d8){return _0x5a67d8[_0x3925('0x25')]()[_0x3925('0x24')](function(){var _0x366487=_0x5a67d8[_0x3925('0x26')]({'plain':!![]});var _0x4e7273='Triggers';return db[_0x3925('0x27')]['destroy']({'where':{'type':_0x4e7273,'resourceId':_0x366487['id']}})[_0x3925('0x24')](function(){return _0x5a67d8;});})['then'](function(){_0x11d110[_0x3925('0x19')](0xcc)[_0x3925('0x1a')]();});}};}function handleEntityNotFound(_0x5dd5b8,_0x2d10a6){return function(_0x4281b1){if(!_0x4281b1){_0x5dd5b8[_0x3925('0x18')](0x194);}return _0x4281b1;};}function handleError(_0xbd4b1a,_0x1cd0b4){_0x1cd0b4=_0x1cd0b4||0x1f4;return function(_0x600a35){logger[_0x3925('0x28')](_0x600a35[_0x3925('0x29')]);if(_0x600a35[_0x3925('0x2a')]){delete _0x600a35[_0x3925('0x2a')];}_0xbd4b1a[_0x3925('0x19')](_0x1cd0b4)[_0x3925('0x2b')](_0x600a35);};}exports['index']=function(_0x23a8d0,_0x355bf3){var _0x631a97={},_0x47d7dc={},_0x3799a4={'count':0x0,'rows':[]};var _0x1c840e=_[_0x3925('0x2c')](db[_0x3925('0x2d')][_0x3925('0x2e')],function(_0x3e856a){return{'name':_0x3e856a[_0x3925('0x2f')],'type':_0x3e856a[_0x3925('0x30')][_0x3925('0x31')]};});_0x47d7dc['model']=_[_0x3925('0x2c')](_0x1c840e,_0x3925('0x2a'));_0x47d7dc[_0x3925('0x32')]=_[_0x3925('0x33')](_0x23a8d0[_0x3925('0x32')]);_0x47d7dc[_0x3925('0x34')]=_[_0x3925('0x35')](_0x47d7dc['model'],_0x47d7dc[_0x3925('0x32')]);_0x631a97[_0x3925('0x36')]=_[_0x3925('0x35')](_0x47d7dc[_0x3925('0x37')],qs[_0x3925('0x38')](_0x23a8d0[_0x3925('0x32')][_0x3925('0x38')]));_0x631a97['attributes']=_0x631a97[_0x3925('0x36')]['length']?_0x631a97['attributes']:_0x47d7dc[_0x3925('0x37')];if(!_0x23a8d0[_0x3925('0x32')][_0x3925('0x39')](_0x3925('0x3a'))){_0x631a97[_0x3925('0x1e')]=qs['limit'](_0x23a8d0['query']['limit']);_0x631a97[_0x3925('0x1c')]=qs[_0x3925('0x1c')](_0x23a8d0['query'][_0x3925('0x1c')]);}_0x631a97[_0x3925('0x3b')]=qs[_0x3925('0x3c')](_0x23a8d0['query']['sort']);_0x631a97[_0x3925('0x3d')]=qs[_0x3925('0x34')](_['pick'](_0x23a8d0[_0x3925('0x32')],_0x47d7dc[_0x3925('0x34')]),_0x1c840e);if(_0x23a8d0['query'][_0x3925('0x3e')]){_0x631a97[_0x3925('0x3d')]=_[_0x3925('0x3f')](_0x631a97[_0x3925('0x3d')],{'$or':_[_0x3925('0x2c')](_0x1c840e,function(_0x56506a){if(_0x56506a[_0x3925('0x30')]!==_0x3925('0x40')){var _0x3bc5d8={};_0x3bc5d8[_0x56506a['name']]={'$like':'%'+_0x23a8d0[_0x3925('0x32')][_0x3925('0x3e')]+'%'};return _0x3bc5d8;}})});}_0x631a97=_[_0x3925('0x3f')]({},_0x631a97,_0x23a8d0['options']);var _0x5d79fa={'where':_0x631a97[_0x3925('0x3d')]};return db[_0x3925('0x2d')][_0x3925('0x1f')](_0x5d79fa)[_0x3925('0x24')](function(_0x3cda13){_0x3799a4[_0x3925('0x1f')]=_0x3cda13;if(_0x23a8d0[_0x3925('0x32')]['includeAll']){_0x631a97[_0x3925('0x41')]=[{'all':!![]}];}return db[_0x3925('0x2d')][_0x3925('0x42')](_0x631a97);})[_0x3925('0x24')](function(_0x3867d7){_0x3799a4['rows']=_0x3867d7;return _0x3799a4;})[_0x3925('0x24')](respondWithFilteredResult(_0x355bf3,_0x631a97))[_0x3925('0x43')](handleError(_0x355bf3,null));};exports[_0x3925('0x44')]=function(_0x5dff7f,_0x9dc6ff){var _0x37d61a={'raw':![],'where':{'id':_0x5dff7f['params']['id']}},_0x1a51ba={};_0x1a51ba[_0x3925('0x37')]=_['keys'](db[_0x3925('0x2d')]['rawAttributes']);_0x1a51ba['query']=_[_0x3925('0x33')](_0x5dff7f['query']);_0x1a51ba[_0x3925('0x34')]=_['intersection'](_0x1a51ba[_0x3925('0x37')],_0x1a51ba[_0x3925('0x32')]);_0x37d61a['attributes']=_[_0x3925('0x35')](_0x1a51ba['model'],qs[_0x3925('0x38')](_0x5dff7f['query'][_0x3925('0x38')]));_0x37d61a[_0x3925('0x36')]=_0x37d61a['attributes'][_0x3925('0x45')]?_0x37d61a[_0x3925('0x36')]:_0x1a51ba[_0x3925('0x37')];if(_0x5dff7f[_0x3925('0x32')][_0x3925('0x46')]){_0x37d61a['include']=[{'all':!![]}];}_0x37d61a=_['merge']({},_0x37d61a,_0x5dff7f[_0x3925('0x47')]);return db['Trigger'][_0x3925('0x48')](_0x37d61a)[_0x3925('0x24')](handleEntityNotFound(_0x9dc6ff,null))[_0x3925('0x24')](respondWithResult(_0x9dc6ff,null))[_0x3925('0x43')](handleError(_0x9dc6ff,null));};exports['create']=function(_0x531ff8,_0x3f0a48){return db[_0x3925('0x2d')][_0x3925('0x49')](_0x531ff8[_0x3925('0x4a')],{})['then'](function(_0x5935a5){var _0x2b579f=_0x531ff8['user'][_0x3925('0x26')]({'plain':!![]});if(!_0x2b579f)throw new Error(_0x3925('0x4b'));if(_0x2b579f[_0x3925('0x4c')]===_0x3925('0x4d')){var _0x55be17=_0x5935a5['get']({'plain':!![]});var _0x5f0bce=_0x3925('0x4e');return db[_0x3925('0x4f')][_0x3925('0x48')]({'where':{'name':_0x5f0bce,'userProfileId':_0x2b579f[_0x3925('0x50')]},'raw':!![]})[_0x3925('0x24')](function(_0x489073){if(_0x489073&&_0x489073[_0x3925('0x51')]===0x0){return db[_0x3925('0x27')][_0x3925('0x49')]({'name':_0x55be17[_0x3925('0x2a')],'resourceId':_0x55be17['id'],'type':_0x489073['name'],'sectionId':_0x489073['id']},{})[_0x3925('0x24')](function(){return _0x5935a5;});}else{return _0x5935a5;}})[_0x3925('0x43')](function(_0x4535c0){logger['error'](_0x3925('0x52'),_0x4535c0);throw _0x4535c0;});}return _0x5935a5;})[_0x3925('0x24')](respondWithResult(_0x3f0a48,0xc9))[_0x3925('0x43')](handleError(_0x3f0a48,null));};exports['update']=function(_0x2f04a7,_0x231124){if(_0x2f04a7['body']['id']){delete _0x2f04a7[_0x3925('0x4a')]['id'];}return db['Trigger'][_0x3925('0x48')]({'where':{'id':_0x2f04a7[_0x3925('0x53')]['id']}})['then'](handleEntityNotFound(_0x231124,null))[_0x3925('0x24')](saveUpdates(_0x2f04a7[_0x3925('0x4a')],null))['then'](respondWithResult(_0x231124,null))[_0x3925('0x43')](handleError(_0x231124,null));};exports[_0x3925('0x25')]=function(_0x5b0956,_0x10dc6d){return db[_0x3925('0x2d')]['find']({'where':{'id':_0x5b0956[_0x3925('0x53')]['id']}})[_0x3925('0x24')](handleEntityNotFound(_0x10dc6d,null))['then'](removeEntity(_0x10dc6d,null))[_0x3925('0x43')](handleError(_0x10dc6d,null));};exports[_0x3925('0x54')]=function(_0x49c206,_0x5da4d1,_0x5343a3){if(_0x49c206[_0x3925('0x4a')]['id']){delete _0x49c206[_0x3925('0x4a')]['id'];}return db['Trigger'][_0x3925('0x48')]({'where':{'id':_0x49c206[_0x3925('0x53')]['id']}})[_0x3925('0x24')](handleEntityNotFound(_0x5da4d1,null))[_0x3925('0x24')](function(_0x2ab173){if(_0x2ab173){_0x49c206['body'][_0x3925('0x55')]=_0x2ab173['id'];return db[_0x3925('0x56')][_0x3925('0x49')](_0x49c206[_0x3925('0x4a')]);}})[_0x3925('0x24')](respondWithResult(_0x5da4d1,null))[_0x3925('0x43')](handleError(_0x5da4d1,null));};exports[_0x3925('0x57')]=function(_0x21f957,_0x204308,_0x47427f){if(_0x21f957['body']['id']){delete _0x21f957[_0x3925('0x4a')]['id'];}return db['Trigger'][_0x3925('0x48')]({'where':{'id':_0x21f957[_0x3925('0x53')]['id']}})[_0x3925('0x24')](handleEntityNotFound(_0x204308,null))['then'](function(_0xca550b){if(_0xca550b){_0x21f957['body'][_0x3925('0x58')]=_0xca550b['id'];return db['Condition'][_0x3925('0x49')](_0x21f957[_0x3925('0x4a')]);}})['then'](respondWithResult(_0x204308,null))[_0x3925('0x43')](handleError(_0x204308,null));};exports[_0x3925('0x59')]=function(_0x460f28,_0x4e5db0,_0x4293c3){var _0x2c0f8f={};var _0x64ed47={};var _0xf03ec2;var _0x4fc096;return db[_0x3925('0x2d')][_0x3925('0x5a')]({'where':{'id':_0x460f28[_0x3925('0x53')]['id']}})[_0x3925('0x24')](handleEntityNotFound(_0x4e5db0,null))[_0x3925('0x24')](function(_0x31273a){if(_0x31273a){_0xf03ec2=_0x31273a;_0x64ed47[_0x3925('0x37')]=_[_0x3925('0x33')](db[_0x3925('0x56')]['rawAttributes']);_0x64ed47[_0x3925('0x32')]=_['keys'](_0x460f28[_0x3925('0x32')]);_0x64ed47['filters']=_[_0x3925('0x35')](_0x64ed47[_0x3925('0x37')],_0x64ed47[_0x3925('0x32')]);_0x2c0f8f[_0x3925('0x36')]=_['intersection'](_0x64ed47['model'],qs['fields'](_0x460f28['query']['fields']));_0x2c0f8f[_0x3925('0x36')]=_0x2c0f8f['attributes'][_0x3925('0x45')]?_0x2c0f8f[_0x3925('0x36')]:_0x64ed47[_0x3925('0x37')];_0x2c0f8f[_0x3925('0x3b')]=qs[_0x3925('0x3c')](_0x460f28[_0x3925('0x32')][_0x3925('0x3c')]);_0x2c0f8f[_0x3925('0x3d')]=qs[_0x3925('0x34')](_[_0x3925('0x5b')](_0x460f28[_0x3925('0x32')],_0x64ed47['filters']));if(_0x460f28[_0x3925('0x32')][_0x3925('0x3e')]){_0x2c0f8f[_0x3925('0x3d')]=_[_0x3925('0x3f')](_0x2c0f8f['where'],{'$or':_['map'](_0x2c0f8f['attributes'],function(_0x520c65){var _0x338eaf={};_0x338eaf[_0x520c65]={'$like':'%'+_0x460f28[_0x3925('0x32')][_0x3925('0x3e')]+'%'};return _0x338eaf;})});}_0x2c0f8f=_[_0x3925('0x3f')]({},_0x2c0f8f,_0x460f28['options']);return _0xf03ec2[_0x3925('0x59')](_0x2c0f8f);}})[_0x3925('0x24')](function(_0x2da816){if(_0x2da816){_0x4fc096=_0x2da816['length'];if(!_0x460f28['query']['hasOwnProperty'](_0x3925('0x3a'))){_0x2c0f8f['limit']=qs[_0x3925('0x1e')](_0x460f28[_0x3925('0x32')][_0x3925('0x1e')]);_0x2c0f8f[_0x3925('0x1c')]=qs[_0x3925('0x1c')](_0x460f28[_0x3925('0x32')][_0x3925('0x1c')]);}return _0xf03ec2['getAllConditions'](_0x2c0f8f);}})[_0x3925('0x24')](function(_0x3069c0){if(_0x3069c0){return _0x3069c0?{'count':_0x4fc096,'rows':_0x3069c0}:null;}})[_0x3925('0x24')](respondWithResult(_0x4e5db0,null))[_0x3925('0x43')](handleError(_0x4e5db0,null));};exports[_0x3925('0x5c')]=function(_0x341b75,_0x110196,_0x5c1593){var _0x55ab1e={};var _0xe01674={};var _0x5ce3a5;var _0x31ba3a;return db['Trigger'][_0x3925('0x5a')]({'where':{'id':_0x341b75[_0x3925('0x53')]['id']}})['then'](handleEntityNotFound(_0x110196,null))[_0x3925('0x24')](function(_0x44c180){if(_0x44c180){_0x5ce3a5=_0x44c180;_0xe01674[_0x3925('0x37')]=_[_0x3925('0x33')](db[_0x3925('0x56')]['rawAttributes']);_0xe01674[_0x3925('0x32')]=_['keys'](_0x341b75[_0x3925('0x32')]);_0xe01674[_0x3925('0x34')]=_['intersection'](_0xe01674['model'],_0xe01674['query']);_0x55ab1e[_0x3925('0x36')]=_['intersection'](_0xe01674[_0x3925('0x37')],qs[_0x3925('0x38')](_0x341b75[_0x3925('0x32')][_0x3925('0x38')]));_0x55ab1e[_0x3925('0x36')]=_0x55ab1e[_0x3925('0x36')][_0x3925('0x45')]?_0x55ab1e[_0x3925('0x36')]:_0xe01674['model'];_0x55ab1e['order']=qs[_0x3925('0x3c')](_0x341b75[_0x3925('0x32')][_0x3925('0x3c')]);_0x55ab1e['where']=qs[_0x3925('0x34')](_[_0x3925('0x5b')](_0x341b75[_0x3925('0x32')],_0xe01674[_0x3925('0x34')]));if(_0x341b75[_0x3925('0x32')][_0x3925('0x3e')]){_0x55ab1e[_0x3925('0x3d')]=_[_0x3925('0x3f')](_0x55ab1e[_0x3925('0x3d')],{'$or':_[_0x3925('0x2c')](_0x55ab1e[_0x3925('0x36')],function(_0x9af9fa){var _0x3573ec={};_0x3573ec[_0x9af9fa]={'$like':'%'+_0x341b75[_0x3925('0x32')]['filter']+'%'};return _0x3573ec;})});}_0x55ab1e=_['merge']({},_0x55ab1e,_0x341b75[_0x3925('0x47')]);return _0x5ce3a5['getAnyConditions'](_0x55ab1e);}})[_0x3925('0x24')](function(_0x359fcd){if(_0x359fcd){_0x31ba3a=_0x359fcd[_0x3925('0x45')];if(!_0x341b75[_0x3925('0x32')][_0x3925('0x39')]('nolimit')){_0x55ab1e[_0x3925('0x1e')]=qs['limit'](_0x341b75[_0x3925('0x32')][_0x3925('0x1e')]);_0x55ab1e[_0x3925('0x1c')]=qs[_0x3925('0x1c')](_0x341b75[_0x3925('0x32')][_0x3925('0x1c')]);}return _0x5ce3a5[_0x3925('0x5c')](_0x55ab1e);}})[_0x3925('0x24')](function(_0x186e99){if(_0x186e99){return _0x186e99?{'count':_0x31ba3a,'rows':_0x186e99}:null;}})[_0x3925('0x24')](respondWithResult(_0x110196,null))[_0x3925('0x43')](handleError(_0x110196,null));};exports[_0x3925('0x5d')]=function(_0x37930c,_0xeab483,_0x319554){if(_0x37930c[_0x3925('0x4a')]['id']){delete _0x37930c['body']['id'];}return db[_0x3925('0x2d')]['find']({'where':{'id':_0x37930c['params']['id']}})[_0x3925('0x24')](handleEntityNotFound(_0xeab483,null))[_0x3925('0x24')](function(_0xf553f){if(_0xf553f){_0x37930c['body']['TriggerId']=_0xf553f['id'];return db[_0x3925('0x5e')][_0x3925('0x49')](_0x37930c[_0x3925('0x4a')]);}})['then'](respondWithResult(_0xeab483,null))[_0x3925('0x43')](handleError(_0xeab483,null));};exports['getActions']=function(_0x50cf4b,_0xbb698f,_0xeae693){var _0x126424={};var _0x5ac133={};var _0x3ad861;var _0x5f3234;return db[_0x3925('0x2d')][_0x3925('0x5a')]({'where':{'id':_0x50cf4b[_0x3925('0x53')]['id']}})[_0x3925('0x24')](handleEntityNotFound(_0xbb698f,null))[_0x3925('0x24')](function(_0x21d4db){if(_0x21d4db){_0x3ad861=_0x21d4db;_0x5ac133['model']=_['keys'](db[_0x3925('0x5e')][_0x3925('0x2e')]);_0x5ac133['query']=_['keys'](_0x50cf4b[_0x3925('0x32')]);_0x5ac133['filters']=_[_0x3925('0x35')](_0x5ac133[_0x3925('0x37')],_0x5ac133[_0x3925('0x32')]);_0x126424[_0x3925('0x36')]=_[_0x3925('0x35')](_0x5ac133[_0x3925('0x37')],qs[_0x3925('0x38')](_0x50cf4b['query']['fields']));_0x126424[_0x3925('0x36')]=_0x126424['attributes']['length']?_0x126424[_0x3925('0x36')]:_0x5ac133[_0x3925('0x37')];_0x126424[_0x3925('0x3b')]=qs[_0x3925('0x3c')](_0x50cf4b[_0x3925('0x32')][_0x3925('0x3c')]);_0x126424['where']=qs[_0x3925('0x34')](_[_0x3925('0x5b')](_0x50cf4b['query'],_0x5ac133[_0x3925('0x34')]));if(_0x50cf4b['query'][_0x3925('0x3e')]){_0x126424[_0x3925('0x3d')]=_[_0x3925('0x3f')](_0x126424[_0x3925('0x3d')],{'$or':_['map'](_0x126424[_0x3925('0x36')],function(_0x31314a){var _0x324359={};_0x324359[_0x31314a]={'$like':'%'+_0x50cf4b['query']['filter']+'%'};return _0x324359;})});}_0x126424=_[_0x3925('0x3f')]({},_0x126424,_0x50cf4b[_0x3925('0x47')]);return _0x3ad861['getActions'](_0x126424);}})[_0x3925('0x24')](function(_0x90adab){if(_0x90adab){_0x5f3234=_0x90adab[_0x3925('0x45')];if(!_0x50cf4b[_0x3925('0x32')][_0x3925('0x39')](_0x3925('0x3a'))){_0x126424[_0x3925('0x1e')]=qs[_0x3925('0x1e')](_0x50cf4b[_0x3925('0x32')][_0x3925('0x1e')]);_0x126424['offset']=qs[_0x3925('0x1c')](_0x50cf4b[_0x3925('0x32')][_0x3925('0x1c')]);}return _0x3ad861[_0x3925('0x5f')](_0x126424);}})[_0x3925('0x24')](function(_0x407088){if(_0x407088){return _0x407088?{'count':_0x5f3234,'rows':_0x407088}:null;}})[_0x3925('0x24')](respondWithResult(_0xbb698f,null))['catch'](handleError(_0xbb698f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6572053..5b83653 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 _0x9f75=['path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','../../config/logger','api','request-promise'];(function(_0x594b46,_0x1dc70c){var _0x9e4f72=function(_0x530f82){while(--_0x530f82){_0x594b46['push'](_0x594b46['shift']());}};_0x9e4f72(++_0x1dc70c);}(_0x9f75,0x15a));var _0x59f7=function(_0x5544b1,_0x522bbe){_0x5544b1=_0x5544b1-0x0;var _0x1060de=_0x9f75[_0x5544b1];return _0x1060de;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59f7('0x3'));var fs=require('fs');var path=require(_0x59f7('0x4'));var rimraf=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var attributes=require('./trigger.attributes');module[_0x59f7('0x7')]=function(_0x278f11,_0x5485fa){return _0x278f11['define'](_0x59f7('0x8'),attributes,{'tableName':_0x59f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ef3=['path','rimraf','./trigger.attributes','exports','define','Trigger','lodash','util','api','moment','bluebird'];(function(_0x8e3dc2,_0x24393a){var _0x3ae765=function(_0x4c1a7d){while(--_0x4c1a7d){_0x8e3dc2['push'](_0x8e3dc2['shift']());}};_0x3ae765(++_0x24393a);}(_0x1ef3,0x69));var _0x31ef=function(_0x446ba0,_0x184669){_0x446ba0=_0x446ba0-0x0;var _0xff06ed=_0x1ef3[_0x446ba0];return _0xff06ed;};'use strict';var _=require(_0x31ef('0x0'));var util=require(_0x31ef('0x1'));var logger=require('../../config/logger')(_0x31ef('0x2'));var moment=require(_0x31ef('0x3'));var BPromise=require(_0x31ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31ef('0x5'));var rimraf=require(_0x31ef('0x6'));var config=require('../../config/environment');var attributes=require(_0x31ef('0x7'));module[_0x31ef('0x8')]=function(_0x81db4,_0x454b60){return _0x81db4[_0x31ef('0x9')](_0x31ef('0xa'),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 2fa5bc5..9e7334c 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 _0xbfdb=['limit','include','map','model','then','GetTrigger','debug','catch','ShowTrigger','Trigger','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbfdb,0x181));var _0xbbfd=function(_0x25adcd,_0x5f299a){_0x25adcd=_0x25adcd-0x0;var _0x35439d=_0xbfdb[_0x25adcd];return _0x35439d;};'use strict';var _=require(_0xbbfd('0x0'));var util=require('util');var moment=require(_0xbbfd('0x1'));var BPromise=require(_0xbbfd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbfd('0x3'))['db'];var utils=require(_0xbbfd('0x4'));var logger=require(_0xbbfd('0x5'))(_0xbbfd('0x6'));var config=require(_0xbbfd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbbfd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28aaaa,_0x30330a,_0x20e44b){return new BPromise(function(_0x22251a,_0x38c51d){return client['request'](_0x28aaaa,_0x20e44b)['then'](function(_0x190409){logger[_0xbbfd('0x9')](_0xbbfd('0xa'),_0x30330a,_0xbbfd('0xb'));logger['debug'](_0xbbfd('0xc'),_0x30330a,_0xbbfd('0xb'),JSON[_0xbbfd('0xd')](_0x190409));if(_0x190409[_0xbbfd('0xe')]){if(_0x190409[_0xbbfd('0xe')][_0xbbfd('0xf')]===0x1f4){logger[_0xbbfd('0xe')]('Trigger,\x20%s,\x20%s',_0x30330a,_0x190409[_0xbbfd('0xe')][_0xbbfd('0x10')]);return _0x38c51d(_0x190409[_0xbbfd('0xe')][_0xbbfd('0x10')]);}logger[_0xbbfd('0xe')](_0xbbfd('0xa'),_0x30330a,_0x190409[_0xbbfd('0xe')][_0xbbfd('0x10')]);return _0x22251a(_0x190409[_0xbbfd('0xe')][_0xbbfd('0x10')]);}else{logger[_0xbbfd('0x9')](_0xbbfd('0xa'),_0x30330a,_0xbbfd('0xb'));_0x22251a(_0x190409[_0xbbfd('0x11')][_0xbbfd('0x10')]);}})['catch'](function(_0x4421e1){logger['error']('Trigger,\x20%s,\x20%s',_0x30330a,_0x4421e1);_0x38c51d(_0x4421e1);});});}exports['GetTrigger']=function(_0x1cf034){var _0x482857=this;return new Promise(function(_0x5a4f3e,_0x25de1b){return db['Trigger'][_0xbbfd('0x12')]({'raw':_0x1cf034['options']?_0x1cf034[_0xbbfd('0x13')][_0xbbfd('0x14')]===undefined?!![]:![]:!![],'where':_0x1cf034['options']?_0x1cf034[_0xbbfd('0x13')][_0xbbfd('0x15')]||null:null,'attributes':_0x1cf034[_0xbbfd('0x13')]?_0x1cf034[_0xbbfd('0x13')][_0xbbfd('0x16')]||null:null,'limit':_0x1cf034[_0xbbfd('0x13')]?_0x1cf034['options'][_0xbbfd('0x17')]||null:null,'include':_0x1cf034[_0xbbfd('0x13')]?_0x1cf034[_0xbbfd('0x13')][_0xbbfd('0x18')]?_[_0xbbfd('0x19')](_0x1cf034['options']['include'],function(_0x5a7606){return{'model':db[_0x5a7606[_0xbbfd('0x1a')]],'as':_0x5a7606['as'],'attributes':_0x5a7606[_0xbbfd('0x16')],'include':_0x5a7606[_0xbbfd('0x18')]?_[_0xbbfd('0x19')](_0x5a7606[_0xbbfd('0x18')],function(_0x32f180){return{'model':db[_0x32f180[_0xbbfd('0x1a')]],'as':_0x32f180['as'],'attributes':_0x32f180[_0xbbfd('0x16')],'include':_0x32f180[_0xbbfd('0x18')]?_[_0xbbfd('0x19')](_0x32f180[_0xbbfd('0x18')],function(_0x4485b6){return{'model':db[_0x4485b6[_0xbbfd('0x1a')]],'as':_0x4485b6['as'],'attributes':_0x4485b6[_0xbbfd('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbbfd('0x1b')](function(_0x65f541){logger[_0xbbfd('0x9')](_0xbbfd('0x1c'),_0x1cf034);logger[_0xbbfd('0x1d')]('GetTrigger',_0x1cf034,JSON[_0xbbfd('0xd')](_0x65f541));_0x5a4f3e(_0x65f541);})[_0xbbfd('0x1e')](function(_0x293584){logger[_0xbbfd('0xe')](_0xbbfd('0x1c'),_0x293584[_0xbbfd('0x10')],_0x1cf034);_0x25de1b(_0x482857[_0xbbfd('0xe')](0x1f4,_0x293584[_0xbbfd('0x10')]));});});};exports[_0xbbfd('0x1f')]=function(_0x5494e3){var _0x45530a=this;return new Promise(function(_0x52e007,_0x5d71c6){return db[_0xbbfd('0x20')][_0xbbfd('0x21')]({'raw':_0x5494e3[_0xbbfd('0x13')]?_0x5494e3[_0xbbfd('0x13')][_0xbbfd('0x14')]===undefined?!![]:![]:!![],'where':_0x5494e3[_0xbbfd('0x13')]?_0x5494e3[_0xbbfd('0x13')][_0xbbfd('0x15')]||null:null,'attributes':_0x5494e3['options']?_0x5494e3['options'][_0xbbfd('0x16')]||null:null,'include':_0x5494e3[_0xbbfd('0x13')]?_0x5494e3[_0xbbfd('0x13')]['include']?_[_0xbbfd('0x19')](_0x5494e3[_0xbbfd('0x13')]['include'],function(_0x20f1f2){return{'model':db[_0x20f1f2[_0xbbfd('0x1a')]],'as':_0x20f1f2['as'],'attributes':_0x20f1f2[_0xbbfd('0x16')],'include':_0x20f1f2[_0xbbfd('0x18')]?_[_0xbbfd('0x19')](_0x20f1f2[_0xbbfd('0x18')],function(_0x55ae22){return{'model':db[_0x55ae22[_0xbbfd('0x1a')]],'as':_0x55ae22['as'],'attributes':_0x55ae22[_0xbbfd('0x16')],'include':_0x55ae22[_0xbbfd('0x18')]?_['map'](_0x55ae22[_0xbbfd('0x18')],function(_0x140079){return{'model':db[_0x140079['model']],'as':_0x140079['as'],'attributes':_0x140079[_0xbbfd('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbbfd('0x1b')](function(_0x276d80){logger[_0xbbfd('0x9')](_0xbbfd('0x1f'),_0x5494e3);logger[_0xbbfd('0x1d')](_0xbbfd('0x1f'),_0x5494e3,JSON['stringify'](_0x276d80));_0x52e007(_0x276d80);})[_0xbbfd('0x1e')](function(_0x1cd422){logger[_0xbbfd('0xe')](_0xbbfd('0x1f'),_0x1cd422['message'],_0x5494e3);_0x5d71c6(_0x45530a[_0xbbfd('0xe')](0x1f4,_0x1cd422[_0xbbfd('0x10')]));});});}; \ No newline at end of file +var _0xc27a=['map','model','ShowTrigger','find','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trigger,\x20%s,\x20%s','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include'];(function(_0x51c8b5,_0x2c6e67){var _0x2ea7a2=function(_0x168323){while(--_0x168323){_0x51c8b5['push'](_0x51c8b5['shift']());}};_0x2ea7a2(++_0x2c6e67);}(_0xc27a,0x1b4));var _0xac27=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xc27a[_0x257b0e];return _0x27ac2a;};'use strict';var _=require(_0xac27('0x0'));var util=require(_0xac27('0x1'));var moment=require(_0xac27('0x2'));var BPromise=require(_0xac27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac27('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xac27('0x5'))('rpc');var config=require(_0xac27('0x6'));var jayson=require(_0xac27('0x7'));var client=jayson[_0xac27('0x8')][_0xac27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e7025,_0x16f6d5,_0x2d05f5){return new BPromise(function(_0xcfb960,_0x1069b3){return client[_0xac27('0xa')](_0x1e7025,_0x2d05f5)[_0xac27('0xb')](function(_0x3234f1){logger[_0xac27('0xc')]('Trigger,\x20%s,\x20%s',_0x16f6d5,_0xac27('0xd'));logger[_0xac27('0xe')](_0xac27('0xf'),_0x16f6d5,_0xac27('0xd'),JSON[_0xac27('0x10')](_0x3234f1));if(_0x3234f1[_0xac27('0x11')]){if(_0x3234f1[_0xac27('0x11')][_0xac27('0x12')]===0x1f4){logger[_0xac27('0x11')]('Trigger,\x20%s,\x20%s',_0x16f6d5,_0x3234f1[_0xac27('0x11')][_0xac27('0x13')]);return _0x1069b3(_0x3234f1[_0xac27('0x11')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x16f6d5,_0x3234f1['error'][_0xac27('0x13')]);return _0xcfb960(_0x3234f1[_0xac27('0x11')][_0xac27('0x13')]);}else{logger[_0xac27('0xc')](_0xac27('0x14'),_0x16f6d5,_0xac27('0xd'));_0xcfb960(_0x3234f1[_0xac27('0x15')][_0xac27('0x13')]);}})[_0xac27('0x16')](function(_0x3ab1df){logger['error']('Trigger,\x20%s,\x20%s',_0x16f6d5,_0x3ab1df);_0x1069b3(_0x3ab1df);});});}exports[_0xac27('0x17')]=function(_0x4aaf44){var _0x3ea632=this;return new Promise(function(_0x2f5f58,_0x5353ca){return db[_0xac27('0x18')][_0xac27('0x19')]({'raw':_0x4aaf44[_0xac27('0x1a')]?_0x4aaf44['options'][_0xac27('0x1b')]===undefined?!![]:![]:!![],'where':_0x4aaf44[_0xac27('0x1a')]?_0x4aaf44[_0xac27('0x1a')][_0xac27('0x1c')]||null:null,'attributes':_0x4aaf44[_0xac27('0x1a')]?_0x4aaf44['options'][_0xac27('0x1d')]||null:null,'limit':_0x4aaf44['options']?_0x4aaf44[_0xac27('0x1a')][_0xac27('0x1e')]||null:null,'include':_0x4aaf44[_0xac27('0x1a')]?_0x4aaf44[_0xac27('0x1a')][_0xac27('0x1f')]?_[_0xac27('0x20')](_0x4aaf44[_0xac27('0x1a')][_0xac27('0x1f')],function(_0x2cda8f){return{'model':db[_0x2cda8f[_0xac27('0x21')]],'as':_0x2cda8f['as'],'attributes':_0x2cda8f[_0xac27('0x1d')],'include':_0x2cda8f[_0xac27('0x1f')]?_[_0xac27('0x20')](_0x2cda8f[_0xac27('0x1f')],function(_0xaa4139){return{'model':db[_0xaa4139[_0xac27('0x21')]],'as':_0xaa4139['as'],'attributes':_0xaa4139['attributes'],'include':_0xaa4139[_0xac27('0x1f')]?_[_0xac27('0x20')](_0xaa4139[_0xac27('0x1f')],function(_0x2aac4a){return{'model':db[_0x2aac4a[_0xac27('0x21')]],'as':_0x2aac4a['as'],'attributes':_0x2aac4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xac27('0xb')](function(_0x22a558){logger[_0xac27('0xc')](_0xac27('0x17'),_0x4aaf44);logger[_0xac27('0xe')]('GetTrigger',_0x4aaf44,JSON[_0xac27('0x10')](_0x22a558));_0x2f5f58(_0x22a558);})['catch'](function(_0x43584d){logger[_0xac27('0x11')](_0xac27('0x17'),_0x43584d['message'],_0x4aaf44);_0x5353ca(_0x3ea632[_0xac27('0x11')](0x1f4,_0x43584d[_0xac27('0x13')]));});});};exports[_0xac27('0x22')]=function(_0x18067b){var _0x3549a4=this;return new Promise(function(_0x15babe,_0x5e4c03){return db[_0xac27('0x18')][_0xac27('0x23')]({'raw':_0x18067b[_0xac27('0x1a')]?_0x18067b['options']['raw']===undefined?!![]:![]:!![],'where':_0x18067b[_0xac27('0x1a')]?_0x18067b[_0xac27('0x1a')][_0xac27('0x1c')]||null:null,'attributes':_0x18067b[_0xac27('0x1a')]?_0x18067b[_0xac27('0x1a')][_0xac27('0x1d')]||null:null,'include':_0x18067b[_0xac27('0x1a')]?_0x18067b[_0xac27('0x1a')][_0xac27('0x1f')]?_[_0xac27('0x20')](_0x18067b[_0xac27('0x1a')][_0xac27('0x1f')],function(_0x1f2b9b){return{'model':db[_0x1f2b9b[_0xac27('0x21')]],'as':_0x1f2b9b['as'],'attributes':_0x1f2b9b['attributes'],'include':_0x1f2b9b[_0xac27('0x1f')]?_[_0xac27('0x20')](_0x1f2b9b[_0xac27('0x1f')],function(_0x31857b){return{'model':db[_0x31857b[_0xac27('0x21')]],'as':_0x31857b['as'],'attributes':_0x31857b['attributes'],'include':_0x31857b[_0xac27('0x1f')]?_[_0xac27('0x20')](_0x31857b[_0xac27('0x1f')],function(_0x169c51){return{'model':db[_0x169c51[_0xac27('0x21')]],'as':_0x169c51['as'],'attributes':_0x169c51[_0xac27('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10eee2){logger[_0xac27('0xc')](_0xac27('0x22'),_0x18067b);logger['debug'](_0xac27('0x22'),_0x18067b,JSON[_0xac27('0x10')](_0x10eee2));_0x15babe(_0x10eee2);})[_0xac27('0x16')](function(_0x3ddf68){logger['error'](_0xac27('0x22'),_0x3ddf68[_0xac27('0x13')],_0x18067b);_0x5e4c03(_0x3549a4['error'](0x1f4,_0x3ddf68['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index bcb6b16..8e61412 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 _0xdbcf=['fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdbcf,0x1c4));var _0xfdbc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdbcf[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xfdbc('0x0'));var util=require('util');var path=require(_0xfdbc('0x1'));var timeout=require(_0xfdbc('0x2'));var express=require(_0xfdbc('0x3'));var router=express['Router']();var fs_extra=require(_0xfdbc('0x4'));var auth=require(_0xfdbc('0x5'));var interaction=require(_0xfdbc('0x6'));var config=require('../../config/environment');var controller=require(_0xfdbc('0x7'));router[_0xfdbc('0x8')]('/',auth[_0xfdbc('0x9')](),controller[_0xfdbc('0xa')]);router['get'](_0xfdbc('0xb'),auth['isAuthenticated'](),controller[_0xfdbc('0xc')]);router[_0xfdbc('0xd')]('/:id/clone',auth[_0xfdbc('0x9')](),controller[_0xfdbc('0xe')]);router[_0xfdbc('0xd')]('/',auth[_0xfdbc('0x9')](),controller['create']);router[_0xfdbc('0xf')](_0xfdbc('0xb'),auth[_0xfdbc('0x9')](),controller[_0xfdbc('0x10')]);router[_0xfdbc('0x11')](_0xfdbc('0xb'),auth[_0xfdbc('0x9')](),controller['destroy']);module[_0xfdbc('0x12')]=router; \ No newline at end of file +var _0xc134=['isAuthenticated','index','/:id','show','post','/:id/clone','clone','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x472107,_0x4c6969){var _0x25e2cb=function(_0x3a6a10){while(--_0x3a6a10){_0x472107['push'](_0x472107['shift']());}};_0x25e2cb(++_0x4c6969);}(_0xc134,0x87));var _0x4c13=function(_0x41116c,_0x5a9005){_0x41116c=_0x41116c-0x0;var _0x4617f7=_0xc134[_0x41116c];return _0x4617f7;};'use strict';var multer=require(_0x4c13('0x0'));var util=require(_0x4c13('0x1'));var path=require(_0x4c13('0x2'));var timeout=require(_0x4c13('0x3'));var express=require(_0x4c13('0x4'));var router=express[_0x4c13('0x5')]();var fs_extra=require(_0x4c13('0x6'));var auth=require(_0x4c13('0x7'));var interaction=require(_0x4c13('0x8'));var config=require(_0x4c13('0x9'));var controller=require(_0x4c13('0xa'));router[_0x4c13('0xb')]('/',auth[_0x4c13('0xc')](),controller[_0x4c13('0xd')]);router[_0x4c13('0xb')](_0x4c13('0xe'),auth[_0x4c13('0xc')](),controller[_0x4c13('0xf')]);router[_0x4c13('0x10')](_0x4c13('0x11'),auth[_0x4c13('0xc')](),controller[_0x4c13('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4c13('0x13')](_0x4c13('0xe'),auth[_0x4c13('0xc')](),controller['update']);router[_0x4c13('0x14')](_0x4c13('0xe'),auth[_0x4c13('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2ca36e7..98e8498 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 _0x82cd=['PROHIB','udp','setDataValue','transport','getDataValue','info','inband','auto','rfc2833','yes','nonat','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x5e98c0,_0x265909){var _0x5934d9=function(_0x669686){while(--_0x669686){_0x5e98c0['push'](_0x5e98c0['shift']());}};_0x5934d9(++_0x265909);}(_0x82cd,0x1a1));var _0xd82c=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x82cd[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0xd82c('0x0'));module[_0xd82c('0x1')]={'name':{'type':Sequelize[_0xd82c('0x2')],'allowNull':![],'unique':_0xd82c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x5'),_0xd82c('0x6'),_0xd82c('0x7')),'allowNull':![],'defaultValue':_0xd82c('0x5')},'context':{'type':Sequelize[_0xd82c('0x2')],'allowNull':![],'defaultValue':_0xd82c('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0xd82c('0x9'),_0xd82c('0xa'),_0xd82c('0xb'),_0xd82c('0xc'),_0xd82c('0xd'),_0xd82c('0xe'),'PROHIB_FAILED_SCREEN',_0xd82c('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xd82c('0x2')]},'md5secret':{'type':Sequelize[_0xd82c('0x2')]},'remotesecret':{'type':Sequelize[_0xd82c('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xd82c('0x10'),'set':function(_0x3301cc){this[_0xd82c('0x11')](_0xd82c('0x12'),_0x3301cc?_0x3301cc['join'](','):null);},'get':function(){return this[_0xd82c('0x13')]('transport')?this[_0xd82c('0x13')](_0xd82c('0x12'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xd82c('0x14'),'shortinfo',_0xd82c('0x15'),_0xd82c('0x16')),'defaultValue':_0xd82c('0x17')},'directmedia':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no',_0xd82c('0x19'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd82c('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xd82c('0x2')]},'nat':{'type':Sequelize[_0xd82c('0x2')],'defaultValue':_0xd82c('0x1a'),'set':function(_0x55c5e3){this[_0xd82c('0x11')](_0xd82c('0x1b'),_0x55c5e3?_0x55c5e3[_0xd82c('0x1c')](','):null);},'get':function(){return this[_0xd82c('0x13')]('nat')?this['getDataValue']('nat')[_0xd82c('0x1d')](','):null;},'comment':_0xd82c('0x1e')},'callgroup':{'type':Sequelize[_0xd82c('0x2')]},'namedcallgroup':{'type':Sequelize[_0xd82c('0x2')]},'pickupgroup':{'type':Sequelize[_0xd82c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd82c('0x2')]},'language':{'type':Sequelize[_0xd82c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd82c('0x2')],'defaultValue':_0xd82c('0x1f')},'allow':{'type':Sequelize[_0xd82c('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x582777){this['setDataValue'](_0xd82c('0x20'),_0x582777?_0x582777[_0xd82c('0x1c')](';'):_0xd82c('0x21'));},'get':function(){return this[_0xd82c('0x13')](_0xd82c('0x20'))?this[_0xd82c('0x13')](_0xd82c('0x20'))[_0xd82c('0x1d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xd82c('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xd82c('0x2')],'defaultValue':_0xd82c('0x22'),'set':function(_0x9d853f){this[_0xd82c('0x11')]('insecure',_0x9d853f?_0x9d853f[_0xd82c('0x1c')](','):null);},'get':function(){return this[_0xd82c('0x13')](_0xd82c('0x23'))?this[_0xd82c('0x13')]('insecure')['split'](','):null;},'comment':_0xd82c('0x24')},'trustrpid':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd82c('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd82c('0x4')]('yes','no',_0xd82c('0x25'))},'promiscredir':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'accountcode':{'type':Sequelize[_0xd82c('0x26')](0xb)},'setvar':{'type':Sequelize[_0xd82c('0x2')]},'callerid':{'type':Sequelize[_0xd82c('0x2')],'defaultValue':_0xd82c('0x27')},'amaflags':{'type':Sequelize[_0xd82c('0x2')]},'callcounter':{'type':Sequelize[_0xd82c('0x4')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xd82c('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xd82c('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xd82c('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xd82c('0x2')]},'template':{'type':Sequelize[_0xd82c('0x2')]},'videosupport':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no',_0xd82c('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd82c('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'mailbox':{'type':Sequelize[_0xd82c('0x2')]},'session_timers':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x29'),'refuse',_0xd82c('0x2a'))},'session_expires':{'type':Sequelize[_0xd82c('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x2b'),_0xd82c('0x2c')),'defaultValue':_0xd82c('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xd82c('0x2')]},'fromuser':{'type':Sequelize[_0xd82c('0x2')]},'port':{'type':Sequelize[_0xd82c('0x26')](0x5)},'qualify':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no'),'defaultValue':_0xd82c('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xd82c('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xd82c('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd82c('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd82c('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xd82c('0x18'),'no',_0xd82c('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xd82c('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xd82c('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xd82c('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xd82c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xd82c('0x2')]},'use_q850_reason':{'type':Sequelize[_0xd82c('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xd82c('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'icesupport':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no',_0xd82c('0x2e'),_0xd82c('0x2f'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xd82c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xd82c('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xd82c('0x2')]},'dtlscapath':{'type':Sequelize[_0xd82c('0x2')]},'dtlssetup':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x30'),_0xd82c('0x31'),_0xd82c('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd82c('0x2')]},'usereqphone':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd82c('0x2')]},'recordofffeature':{'type':Sequelize[_0xd82c('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd82c('0x4')](_0xd82c('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xd82c('0x4')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd82c('0x2')]},'mohsuggest':{'type':Sequelize[_0xd82c('0x2')]},'parkinglot':{'type':Sequelize[_0xd82c('0x2')]},'description':{'type':Sequelize[_0xd82c('0x2')]},'host':{'type':Sequelize[_0xd82c('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xd82c('0x18'),'no',_0xd82c('0x19'),_0xd82c('0x33'),_0xd82c('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd82c('0x2')]},'active':{'type':Sequelize[_0xd82c('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x51ba=['user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','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','always','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','exports','STRING','ENUM','friend'];(function(_0x121c06,_0x27b75e){var _0x12ceba=function(_0x2be64a){while(--_0x2be64a){_0x121c06['push'](_0x121c06['shift']());}};_0x12ceba(++_0x27b75e);}(_0x51ba,0x66));var _0xa51b=function(_0x48b14d,_0x5b333e){_0x48b14d=_0x48b14d-0x0;var _0x34e1a0=_0x51ba[_0x48b14d];return _0x34e1a0;};'use strict';var Sequelize=require('sequelize');module[_0xa51b('0x0')]={'name':{'type':Sequelize[_0xa51b('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x3'),_0xa51b('0x4'),_0xa51b('0x5')),'allowNull':![],'defaultValue':_0xa51b('0x3')},'context':{'type':Sequelize[_0xa51b('0x1')],'allowNull':![],'defaultValue':_0xa51b('0x6')},'callingpres':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x7'),_0xa51b('0x8'),_0xa51b('0x9'),'ALLOWED',_0xa51b('0xa'),_0xa51b('0xb'),_0xa51b('0xc'),_0xa51b('0xd'))},'deny':{'type':Sequelize[_0xa51b('0x1')]},'permit':{'type':Sequelize[_0xa51b('0x1')]},'secret':{'type':Sequelize[_0xa51b('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xa51b('0x1')]},'transport':{'type':Sequelize[_0xa51b('0x1')],'defaultValue':_0xa51b('0xe'),'set':function(_0x15a97f){this[_0xa51b('0xf')](_0xa51b('0x10'),_0x15a97f?_0x15a97f[_0xa51b('0x11')](','):null);},'get':function(){return this[_0xa51b('0x12')](_0xa51b('0x10'))?this[_0xa51b('0x12')](_0xa51b('0x10'))[_0xa51b('0x13')](','):null;},'comment':_0xa51b('0x14')},'dtmfmode':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x15'),_0xa51b('0x16'),_0xa51b('0x17'),_0xa51b('0x18'),_0xa51b('0x19')),'defaultValue':_0xa51b('0x15')},'directmedia':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no',_0xa51b('0x1b'),'update',_0xa51b('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xa51b('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa51b('0x1')]},'directmediadeny':{'type':Sequelize[_0xa51b('0x1')]},'nat':{'type':Sequelize[_0xa51b('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x179085){this['setDataValue'](_0xa51b('0x1d'),_0x179085?_0x179085[_0xa51b('0x11')](','):null);},'get':function(){return this[_0xa51b('0x12')](_0xa51b('0x1d'))?this[_0xa51b('0x12')]('nat')[_0xa51b('0x13')](','):null;},'comment':_0xa51b('0x1e')},'callgroup':{'type':Sequelize[_0xa51b('0x1')]},'namedcallgroup':{'type':Sequelize[_0xa51b('0x1')]},'pickupgroup':{'type':Sequelize[_0xa51b('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa51b('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa51b('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa51b('0x1')],'defaultValue':_0xa51b('0x1f')},'allow':{'type':Sequelize[_0xa51b('0x1')],'allowNull':![],'defaultValue':_0xa51b('0x20'),'set':function(_0x1a7bb0){this[_0xa51b('0xf')]('allow',_0x1a7bb0?_0x1a7bb0[_0xa51b('0x11')](';'):_0xa51b('0x20'));},'get':function(){return this[_0xa51b('0x12')](_0xa51b('0x21'))?this[_0xa51b('0x12')](_0xa51b('0x21'))['split'](';'):null;},'comment':_0xa51b('0x22')},'autoframing':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'insecure':{'type':Sequelize[_0xa51b('0x1')],'defaultValue':_0xa51b('0x23'),'set':function(_0x23423f){this['setDataValue'](_0xa51b('0x24'),_0x23423f?_0x23423f[_0xa51b('0x11')](','):null);},'get':function(){return this[_0xa51b('0x12')](_0xa51b('0x24'))?this[_0xa51b('0x12')](_0xa51b('0x24'))[_0xa51b('0x13')](','):null;},'comment':_0xa51b('0x25')},'trustrpid':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no',_0xa51b('0x26'))},'promiscredir':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xa51b('0x27')](0xb)},'setvar':{'type':Sequelize[_0xa51b('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa51b('0x1')]},'callcounter':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no'),'defaultValue':_0xa51b('0x1a')},'busylevel':{'type':Sequelize[_0xa51b('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xa51b('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xa51b('0x1')]},'template':{'type':Sequelize[_0xa51b('0x1')]},'videosupport':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no',_0xa51b('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa51b('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa51b('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xa51b('0x2')]('accept',_0xa51b('0x29'),'originate')},'session_expires':{'type':Sequelize[_0xa51b('0x27')](0xb)},'session_minse':{'type':Sequelize[_0xa51b('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x2a'),'uas'),'defaultValue':_0xa51b('0x2b')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xa51b('0x1')]},'fromdomain':{'type':Sequelize[_0xa51b('0x1')]},'fromuser':{'type':Sequelize[_0xa51b('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no'),'defaultValue':_0xa51b('0x1a')},'keepalive':{'type':Sequelize[_0xa51b('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xa51b('0x1')]},'defaultuser':{'type':Sequelize[_0xa51b('0x1')]},'rtptimeout':{'type':Sequelize[_0xa51b('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no',_0xa51b('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa51b('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xa51b('0x27')](0xb)},'timerb':{'type':Sequelize[_0xa51b('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa51b('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xa51b('0x1')]},'contactdeny':{'type':Sequelize[_0xa51b('0x1')]},'contactacl':{'type':Sequelize[_0xa51b('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xa51b('0x1')]},'use_q850_reason':{'type':Sequelize[_0xa51b('0x1')]},'maxforwards':{'type':Sequelize[_0xa51b('0x27')](0xb)},'encryption':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no',_0xa51b('0x2d'),_0xa51b('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xa51b('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xa51b('0x1')]},'dtlscipher':{'type':Sequelize[_0xa51b('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xa51b('0x1')]},'dtlssetup':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x2f'),_0xa51b('0x30'),_0xa51b('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa51b('0x1')]},'usereqphone':{'type':Sequelize[_0xa51b('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa51b('0x1')]},'recordofffeature':{'type':Sequelize[_0xa51b('0x1')]},'call_limit':{'type':Sequelize[_0xa51b('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xa51b('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0xa51b('0x1')]},'mohinterpret':{'type':Sequelize[_0xa51b('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa51b('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa51b('0x1')],'defaultValue':_0xa51b('0x32')},'canreinvite':{'type':Sequelize[_0xa51b('0x2')](_0xa51b('0x1a'),'no',_0xa51b('0x1b'),_0xa51b('0x33'),_0xa51b('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa51b('0x1')]},'otherFields':{'type':Sequelize[_0xa51b('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa51b('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 24fa49c..451bfa2 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 _0xdace=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','get','Trunks','UserProfileResource','destroy','stack','name','send','index','Trunk','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','find','clone','options','omit','createdAt','updatedAt','body','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','findAll','Reload','update','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x47c0de,_0x5139d1){var _0x1de1b1=function(_0x3e673a){while(--_0x3e673a){_0x47c0de['push'](_0x47c0de['shift']());}};_0x1de1b1(++_0x5139d1);}(_0xdace,0xc5));var _0xedac=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0xdace[_0xfb0281];return _0x408dd3;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xedac('0x15'));var client=jayson[_0xedac('0x16')][_0xedac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x342186,_0x9a79a0,_0x473c3e,_0x28444a){return new BPromise(function(_0x11f0b0,_0x593030){var _0x110546=_0x28444a||client;return _0x110546[_0xedac('0x18')](_0x342186,_0x473c3e)[_0xedac('0x19')](function(_0x2676c3){logger[_0xedac('0x1a')]('Trunk,\x20%s,\x20%s',_0x9a79a0,_0xedac('0x1b'));logger['debug'](_0xedac('0x1c'),_0x9a79a0,_0xedac('0x1b'),JSON[_0xedac('0x1d')](_0x2676c3));if(_0x2676c3[_0xedac('0x1e')]){if(_0x2676c3['error']['code']===0x1f4){logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x593030(_0x2676c3['error']['message']);}logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x11f0b0(_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);}else{logger[_0xedac('0x1a')](_0xedac('0x1f'),_0x9a79a0,'request\x20sent');_0x11f0b0(_0x2676c3[_0xedac('0x21')]['message']);}})[_0xedac('0x22')](function(_0x14fc02){logger['error'](_0xedac('0x1f'),_0x9a79a0,_0x14fc02);_0x593030(_0x14fc02);});});}function respondWithStatusCode(_0x404b8d,_0x1c87bf){_0x1c87bf=_0x1c87bf||0xcc;return function(_0x1e5e47){if(_0x1e5e47){return _0x404b8d[_0xedac('0x23')](_0x1c87bf);}return _0x404b8d[_0xedac('0x24')](_0x1c87bf)['end']();};}function respondWithResult(_0x3114a1,_0x87d343){_0x87d343=_0x87d343||0xc8;return function(_0x37563f){if(_0x37563f){return _0x3114a1[_0xedac('0x24')](_0x87d343)[_0xedac('0x25')](_0x37563f);}};}function respondWithFilteredResult(_0x453a3c,_0x40ba53){return function(_0x26c6f7){if(_0x26c6f7){var _0x409825=typeof _0x40ba53[_0xedac('0x26')]==='undefined'&&typeof _0x40ba53[_0xedac('0x27')]===_0xedac('0x28');var _0x19aed3=_0x26c6f7['count'];var _0x313e06=_0x409825?0x0:_0x40ba53['offset'];var _0x524514=_0x409825?_0x26c6f7[_0xedac('0x29')]:_0x40ba53[_0xedac('0x26')]+_0x40ba53[_0xedac('0x27')];var _0x14522a;if(_0x524514>=_0x19aed3){_0x524514=_0x19aed3;_0x14522a=0xc8;}else{_0x14522a=0xce;}_0x453a3c['status'](_0x14522a);return _0x453a3c['set'](_0xedac('0x2a'),_0x313e06+'-'+_0x524514+'/'+_0x19aed3)[_0xedac('0x25')](_0x26c6f7);}return null;};}function patchUpdates(_0x24b182){return function(_0x2ee8d7){try{jsonpatch[_0xedac('0x2b')](_0x2ee8d7,_0x24b182,!![]);}catch(_0x17fcf3){return BPromise[_0xedac('0x2c')](_0x17fcf3);}return _0x2ee8d7['save']();};}function saveUpdates(_0x3bc910,_0x26418a){return function(_0x2cbe33){if(_0x2cbe33){return _0x2cbe33['update'](_0x3bc910)[_0xedac('0x19')](function(_0x1213dc){return _0x1213dc;});}return null;};}function removeEntity(_0x5665d8,_0x3583cd){return function(_0x2c622a){if(_0x2c622a){return _0x2c622a['destroy']()[_0xedac('0x19')](function(){var _0x1e82da=_0x2c622a[_0xedac('0x2d')]({'plain':!![]});var _0x195f78=_0xedac('0x2e');return db[_0xedac('0x2f')][_0xedac('0x30')]({'where':{'type':_0x195f78,'resourceId':_0x1e82da['id']}})[_0xedac('0x19')](function(){return _0x2c622a;});})[_0xedac('0x19')](function(){_0x5665d8[_0xedac('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ef574,_0xf5cd99){return function(_0x2a87ae){if(!_0x2a87ae){_0x9ef574[_0xedac('0x23')](0x194);}return _0x2a87ae;};}function handleError(_0x15815e,_0x1d2f45){_0x1d2f45=_0x1d2f45||0x1f4;return function(_0x107431){logger[_0xedac('0x1e')](_0x107431[_0xedac('0x31')]);if(_0x107431[_0xedac('0x32')]){delete _0x107431[_0xedac('0x32')];}_0x15815e[_0xedac('0x24')](_0x1d2f45)[_0xedac('0x33')](_0x107431);};}exports[_0xedac('0x34')]=function(_0xcf7c0c,_0x527878){var _0x1ddcc1={},_0x42c2c9={},_0x20d997={'count':0x0,'rows':[]};var _0x27481c=_['map'](db[_0xedac('0x35')][_0xedac('0x36')],function(_0x16b9d5){return{'name':_0x16b9d5['fieldName'],'type':_0x16b9d5[_0xedac('0x37')][_0xedac('0x38')]};});_0x42c2c9[_0xedac('0x39')]=_['map'](_0x27481c,_0xedac('0x32'));_0x42c2c9[_0xedac('0x3a')]=_['keys'](_0xcf7c0c[_0xedac('0x3a')]);_0x42c2c9[_0xedac('0x3b')]=_['intersection'](_0x42c2c9[_0xedac('0x39')],_0x42c2c9['query']);_0x1ddcc1[_0xedac('0x3c')]=_[_0xedac('0x3d')](_0x42c2c9[_0xedac('0x39')],qs[_0xedac('0x3e')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x3e')]));_0x1ddcc1['attributes']=_0x1ddcc1[_0xedac('0x3c')][_0xedac('0x3f')]?_0x1ddcc1[_0xedac('0x3c')]:_0x42c2c9[_0xedac('0x39')];if(!_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x40')](_0xedac('0x41'))){_0x1ddcc1[_0xedac('0x27')]=qs[_0xedac('0x27')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x27')]);_0x1ddcc1[_0xedac('0x26')]=qs[_0xedac('0x26')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x26')]);}_0x1ddcc1[_0xedac('0x42')]=qs['sort'](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x43')]);_0x1ddcc1[_0xedac('0x44')]=qs['filters'](_['pick'](_0xcf7c0c['query'],_0x42c2c9[_0xedac('0x3b')]),_0x27481c);if(_0xcf7c0c[_0xedac('0x3a')]['filter']){_0x1ddcc1[_0xedac('0x44')]=_['merge'](_0x1ddcc1[_0xedac('0x44')],{'$or':_['map'](_0x27481c,function(_0x13d51d){if(_0x13d51d[_0xedac('0x37')]!==_0xedac('0x45')){var _0x114b2e={};_0x114b2e[_0x13d51d[_0xedac('0x32')]]={'$like':'%'+_0xcf7c0c['query']['filter']+'%'};return _0x114b2e;}})});}_0x1ddcc1=_[_0xedac('0x46')]({},_0x1ddcc1,_0xcf7c0c['options']);var _0x39b159={'where':_0x1ddcc1[_0xedac('0x44')]};return db[_0xedac('0x35')]['count'](_0x39b159)[_0xedac('0x19')](function(_0x45189f){_0x20d997[_0xedac('0x29')]=_0x45189f;if(_0xcf7c0c['query'][_0xedac('0x47')]){_0x1ddcc1[_0xedac('0x48')]=[{'all':!![]}];}return db[_0xedac('0x35')]['findAll'](_0x1ddcc1);})['then'](function(_0x2cb3ca){_0x20d997[_0xedac('0x49')]=_0x2cb3ca;return _0x20d997;})['then'](respondWithFilteredResult(_0x527878,_0x1ddcc1))['catch'](handleError(_0x527878,null));};exports[_0xedac('0x4a')]=function(_0x38425e,_0x4e81bc){var _0x16a45a={'raw':![],'where':{'id':_0x38425e[_0xedac('0x4b')]['id']}},_0x4e0638={};_0x4e0638[_0xedac('0x39')]=_[_0xedac('0x4c')](db[_0xedac('0x35')][_0xedac('0x36')]);_0x4e0638[_0xedac('0x3a')]=_['keys'](_0x38425e[_0xedac('0x3a')]);_0x4e0638[_0xedac('0x3b')]=_['intersection'](_0x4e0638[_0xedac('0x39')],_0x4e0638[_0xedac('0x3a')]);_0x16a45a[_0xedac('0x3c')]=_['intersection'](_0x4e0638['model'],qs[_0xedac('0x3e')](_0x38425e[_0xedac('0x3a')]['fields']));_0x16a45a[_0xedac('0x3c')]=_0x16a45a[_0xedac('0x3c')][_0xedac('0x3f')]?_0x16a45a[_0xedac('0x3c')]:_0x4e0638[_0xedac('0x39')];if(_0x38425e[_0xedac('0x3a')][_0xedac('0x47')]){_0x16a45a[_0xedac('0x48')]=[{'all':!![]}];}_0x16a45a=_['merge']({},_0x16a45a,_0x38425e['options']);return db[_0xedac('0x35')][_0xedac('0x4d')](_0x16a45a)[_0xedac('0x19')](handleEntityNotFound(_0x4e81bc,null))['then'](respondWithResult(_0x4e81bc,null))[_0xedac('0x22')](handleError(_0x4e81bc,null));};exports[_0xedac('0x4e')]=function(_0x5cb635,_0x4f44e){var _0x276c23={'where':{'id':_0x5cb635['params']['id']}},_0x4bc336={};_0x4bc336['model']=_[_0xedac('0x4c')](db['Trunk'][_0xedac('0x36')]);_0x276c23['attributes']=_['intersection'](_0x4bc336[_0xedac('0x39')],qs[_0xedac('0x3e')](_0x5cb635[_0xedac('0x3a')][_0xedac('0x3e')]));_0x276c23[_0xedac('0x3c')]=_0x276c23['attributes'][_0xedac('0x3f')]?_0x276c23['attributes']:_0x4bc336[_0xedac('0x39')];if(_0x5cb635[_0xedac('0x3a')][_0xedac('0x47')]){_0x276c23[_0xedac('0x48')]=[{'all':!![]}];}_0x276c23=_[_0xedac('0x46')]({},_0x276c23,_0x5cb635[_0xedac('0x4f')]);return db[_0xedac('0x35')]['find'](_0x276c23)[_0xedac('0x19')](handleEntityNotFound(_0x4f44e,null))[_0xedac('0x19')](function(_0x1e1847){if(_0x1e1847){var _0xbc0ff5=_0x1e1847[_0xedac('0x2d')]({'plain':!![]});_0xbc0ff5=qs[_0xedac('0x50')](_0xbc0ff5,['id',_0xedac('0x51'),_0xedac('0x52')]);_0x5cb635[_0xedac('0x53')]=_[_0xedac('0x50')](_0x5cb635['body'],['id','createdAt',_0xedac('0x52')]);return db[_0xedac('0x35')][_0xedac('0x54')](_[_0xedac('0x46')](_0xbc0ff5,_0x5cb635[_0xedac('0x53')]),{'include':_0x5cb635['query'][_0xedac('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x8d20e7){var _0x15b168=_0x5cb635['user']['get']({'plain':!![]});if(!_0x15b168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b168[_0xedac('0x55')]===_0xedac('0x56')){var _0x2523bb=_0x8d20e7[_0xedac('0x2d')]({'plain':!![]});var _0x103632=_0xedac('0x2e');return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0x103632,'userProfileId':_0x15b168[_0xedac('0x58')]},'raw':!![]})[_0xedac('0x19')](function(_0x4fdff8){if(_0x4fdff8&&_0x4fdff8[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')]['create']({'name':_0x2523bb[_0xedac('0x32')],'resourceId':_0x2523bb['id'],'type':_0x4fdff8[_0xedac('0x32')],'sectionId':_0x4fdff8['id']},{})[_0xedac('0x19')](function(){return _0x8d20e7;});}else{return _0x8d20e7;}})[_0xedac('0x22')](function(_0x32d9d8){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x32d9d8);throw _0x32d9d8;});}return _0x8d20e7;});}})[_0xedac('0x19')](respondWithResult(_0x4f44e,0xc9))[_0xedac('0x22')](handleError(_0x4f44e,null));};exports[_0xedac('0x54')]=function(_0xd34f0c,_0x207b40,_0x77fc48){var _0x3a1d68;return db[_0xedac('0x35')][_0xedac('0x54')](_0xd34f0c[_0xedac('0x53')],{'raw':!![]})[_0xedac('0x19')](function(_0x493214){_0x3a1d68=_0x493214;return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x5458c3){var _0x2380ee=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x58ad68=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x300f52=ejs['render'](_0x2380ee,{'trunks':_0x5458c3||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x300f52);if(_0x3a1d68[_0xedac('0x62')]){var _0x218670=ejs[_0xedac('0x63')](_0x58ad68,{'trunks':_0x5458c3||[]});fs['writeFileSync'](_0xedac('0x64'),_0x218670);}})['then'](function(){return respondWithRpcPromise('Reload',_0xedac('0x54'),{'module':_0xedac('0x65')});})[_0xedac('0x19')](function(){var _0x104c27=_0xd34f0c[_0xedac('0x56')]['get']({'plain':!![]});if(!_0x104c27)throw new Error(_0xedac('0x66'));if(_0x104c27['role']===_0xedac('0x56')){var _0x358032=_0x3a1d68[_0xedac('0x2d')]({'plain':!![]});return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0xedac('0x2e'),'userProfileId':_0x104c27['userProfileId']},'raw':!![]})[_0xedac('0x19')](function(_0x1242a2){if(_0x1242a2&&_0x1242a2[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')][_0xedac('0x54')]({'name':_0x358032[_0xedac('0x32')],'resourceId':_0x358032['id'],'type':_0x1242a2[_0xedac('0x32')],'sectionId':_0x1242a2['id']},{})[_0xedac('0x19')](function(){return _0x3a1d68;});}else{return _0x3a1d68;}})[_0xedac('0x22')](function(_0x134a7a){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x134a7a);throw _0x134a7a;});}return _0x3a1d68;})['then'](respondWithResult(_0x207b40,0xc9))[_0xedac('0x22')](handleError(_0x207b40,null));};exports['update']=function(_0x5cba66,_0xdf86e8,_0x484b6b){var _0x197dad;return db[_0xedac('0x35')]['find']({'where':{'id':_0x5cba66[_0xedac('0x4b')]['id']}})['then'](handleEntityNotFound(_0xdf86e8,null))[_0xedac('0x19')](saveUpdates(_0x5cba66['body'],null))[_0xedac('0x19')](function(_0x5e512f){if(_0x5e512f){_0x197dad=_0x5e512f;return db[_0xedac('0x35')][_0xedac('0x67')]({'raw':!![]});}})['then'](function(_0x1dfc0b){if(_0x1dfc0b){var _0x4cec80=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x4be552=fs[_0xedac('0x5b')](path['join'](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x448066=ejs[_0xedac('0x63')](_0x4cec80,{'trunks':_0x1dfc0b||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x448066);var _0x1d8f28=ejs[_0xedac('0x63')](_0x4be552,{'trunks':_0x1dfc0b||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1d8f28);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x69'),{'module':_0xedac('0x65')});}return null;})[_0xedac('0x19')](function(_0x5ad133){if(_0x5ad133){return _0x197dad;}})['then'](respondWithResult(_0xdf86e8,null))[_0xedac('0x22')](handleError(_0xdf86e8,null));};exports[_0xedac('0x30')]=function(_0x4dd9bd,_0x3926ed,_0x472e8a){var _0x3b25ef;return db[_0xedac('0x35')][_0xedac('0x4d')]({'where':{'id':_0x4dd9bd[_0xedac('0x4b')]['id']}})[_0xedac('0x19')](handleEntityNotFound(_0x3926ed,null))[_0xedac('0x19')](removeEntity(_0x3926ed,null))[_0xedac('0x19')](function(){return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x22c47b){var _0x230d51=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config['root'],_0xedac('0x5e')),_0xedac('0x5f'));var _0x35a3c4=fs[_0xedac('0x5b')](path['join'](config['root'],_0xedac('0x60')),_0xedac('0x5f'));var _0x1f541a=ejs[_0xedac('0x63')](_0x230d51,{'trunks':_0x22c47b});var _0x20f7e6=ejs[_0xedac('0x63')](_0x35a3c4,{'trunks':_0x22c47b});fs[_0xedac('0x61')](_0xedac('0x6a'),_0x1f541a);fs[_0xedac('0x61')](_0xedac('0x64'),_0x20f7e6);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x30'),{'module':'chan_sip.so'});})[_0xedac('0x22')](handleError(_0x3926ed,null));}; \ No newline at end of file +var _0xdace=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','get','Trunks','UserProfileResource','destroy','stack','name','send','index','Trunk','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','find','clone','options','omit','createdAt','updatedAt','body','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','findAll','Reload','update','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x4957f2,_0x3e681e){var _0x547cfe=function(_0x431e3a){while(--_0x431e3a){_0x4957f2['push'](_0x4957f2['shift']());}};_0x547cfe(++_0x3e681e);}(_0xdace,0xc5));var _0xedac=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xdace[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xedac('0x15'));var client=jayson[_0xedac('0x16')][_0xedac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x342186,_0x9a79a0,_0x473c3e,_0x28444a){return new BPromise(function(_0x11f0b0,_0x593030){var _0x110546=_0x28444a||client;return _0x110546[_0xedac('0x18')](_0x342186,_0x473c3e)[_0xedac('0x19')](function(_0x2676c3){logger[_0xedac('0x1a')]('Trunk,\x20%s,\x20%s',_0x9a79a0,_0xedac('0x1b'));logger['debug'](_0xedac('0x1c'),_0x9a79a0,_0xedac('0x1b'),JSON[_0xedac('0x1d')](_0x2676c3));if(_0x2676c3[_0xedac('0x1e')]){if(_0x2676c3['error']['code']===0x1f4){logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x593030(_0x2676c3['error']['message']);}logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x11f0b0(_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);}else{logger[_0xedac('0x1a')](_0xedac('0x1f'),_0x9a79a0,'request\x20sent');_0x11f0b0(_0x2676c3[_0xedac('0x21')]['message']);}})[_0xedac('0x22')](function(_0x14fc02){logger['error'](_0xedac('0x1f'),_0x9a79a0,_0x14fc02);_0x593030(_0x14fc02);});});}function respondWithStatusCode(_0x404b8d,_0x1c87bf){_0x1c87bf=_0x1c87bf||0xcc;return function(_0x1e5e47){if(_0x1e5e47){return _0x404b8d[_0xedac('0x23')](_0x1c87bf);}return _0x404b8d[_0xedac('0x24')](_0x1c87bf)['end']();};}function respondWithResult(_0x3114a1,_0x87d343){_0x87d343=_0x87d343||0xc8;return function(_0x37563f){if(_0x37563f){return _0x3114a1[_0xedac('0x24')](_0x87d343)[_0xedac('0x25')](_0x37563f);}};}function respondWithFilteredResult(_0x453a3c,_0x40ba53){return function(_0x26c6f7){if(_0x26c6f7){var _0x409825=typeof _0x40ba53[_0xedac('0x26')]==='undefined'&&typeof _0x40ba53[_0xedac('0x27')]===_0xedac('0x28');var _0x19aed3=_0x26c6f7['count'];var _0x313e06=_0x409825?0x0:_0x40ba53['offset'];var _0x524514=_0x409825?_0x26c6f7[_0xedac('0x29')]:_0x40ba53[_0xedac('0x26')]+_0x40ba53[_0xedac('0x27')];var _0x14522a;if(_0x524514>=_0x19aed3){_0x524514=_0x19aed3;_0x14522a=0xc8;}else{_0x14522a=0xce;}_0x453a3c['status'](_0x14522a);return _0x453a3c['set'](_0xedac('0x2a'),_0x313e06+'-'+_0x524514+'/'+_0x19aed3)[_0xedac('0x25')](_0x26c6f7);}return null;};}function patchUpdates(_0x24b182){return function(_0x2ee8d7){try{jsonpatch[_0xedac('0x2b')](_0x2ee8d7,_0x24b182,!![]);}catch(_0x17fcf3){return BPromise[_0xedac('0x2c')](_0x17fcf3);}return _0x2ee8d7['save']();};}function saveUpdates(_0x3bc910,_0x26418a){return function(_0x2cbe33){if(_0x2cbe33){return _0x2cbe33['update'](_0x3bc910)[_0xedac('0x19')](function(_0x1213dc){return _0x1213dc;});}return null;};}function removeEntity(_0x5665d8,_0x3583cd){return function(_0x2c622a){if(_0x2c622a){return _0x2c622a['destroy']()[_0xedac('0x19')](function(){var _0x1e82da=_0x2c622a[_0xedac('0x2d')]({'plain':!![]});var _0x195f78=_0xedac('0x2e');return db[_0xedac('0x2f')][_0xedac('0x30')]({'where':{'type':_0x195f78,'resourceId':_0x1e82da['id']}})[_0xedac('0x19')](function(){return _0x2c622a;});})[_0xedac('0x19')](function(){_0x5665d8[_0xedac('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ef574,_0xf5cd99){return function(_0x2a87ae){if(!_0x2a87ae){_0x9ef574[_0xedac('0x23')](0x194);}return _0x2a87ae;};}function handleError(_0x15815e,_0x1d2f45){_0x1d2f45=_0x1d2f45||0x1f4;return function(_0x107431){logger[_0xedac('0x1e')](_0x107431[_0xedac('0x31')]);if(_0x107431[_0xedac('0x32')]){delete _0x107431[_0xedac('0x32')];}_0x15815e[_0xedac('0x24')](_0x1d2f45)[_0xedac('0x33')](_0x107431);};}exports[_0xedac('0x34')]=function(_0xcf7c0c,_0x527878){var _0x1ddcc1={},_0x42c2c9={},_0x20d997={'count':0x0,'rows':[]};var _0x27481c=_['map'](db[_0xedac('0x35')][_0xedac('0x36')],function(_0x16b9d5){return{'name':_0x16b9d5['fieldName'],'type':_0x16b9d5[_0xedac('0x37')][_0xedac('0x38')]};});_0x42c2c9[_0xedac('0x39')]=_['map'](_0x27481c,_0xedac('0x32'));_0x42c2c9[_0xedac('0x3a')]=_['keys'](_0xcf7c0c[_0xedac('0x3a')]);_0x42c2c9[_0xedac('0x3b')]=_['intersection'](_0x42c2c9[_0xedac('0x39')],_0x42c2c9['query']);_0x1ddcc1[_0xedac('0x3c')]=_[_0xedac('0x3d')](_0x42c2c9[_0xedac('0x39')],qs[_0xedac('0x3e')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x3e')]));_0x1ddcc1['attributes']=_0x1ddcc1[_0xedac('0x3c')][_0xedac('0x3f')]?_0x1ddcc1[_0xedac('0x3c')]:_0x42c2c9[_0xedac('0x39')];if(!_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x40')](_0xedac('0x41'))){_0x1ddcc1[_0xedac('0x27')]=qs[_0xedac('0x27')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x27')]);_0x1ddcc1[_0xedac('0x26')]=qs[_0xedac('0x26')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x26')]);}_0x1ddcc1[_0xedac('0x42')]=qs['sort'](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x43')]);_0x1ddcc1[_0xedac('0x44')]=qs['filters'](_['pick'](_0xcf7c0c['query'],_0x42c2c9[_0xedac('0x3b')]),_0x27481c);if(_0xcf7c0c[_0xedac('0x3a')]['filter']){_0x1ddcc1[_0xedac('0x44')]=_['merge'](_0x1ddcc1[_0xedac('0x44')],{'$or':_['map'](_0x27481c,function(_0x13d51d){if(_0x13d51d[_0xedac('0x37')]!==_0xedac('0x45')){var _0x114b2e={};_0x114b2e[_0x13d51d[_0xedac('0x32')]]={'$like':'%'+_0xcf7c0c['query']['filter']+'%'};return _0x114b2e;}})});}_0x1ddcc1=_[_0xedac('0x46')]({},_0x1ddcc1,_0xcf7c0c['options']);var _0x39b159={'where':_0x1ddcc1[_0xedac('0x44')]};return db[_0xedac('0x35')]['count'](_0x39b159)[_0xedac('0x19')](function(_0x45189f){_0x20d997[_0xedac('0x29')]=_0x45189f;if(_0xcf7c0c['query'][_0xedac('0x47')]){_0x1ddcc1[_0xedac('0x48')]=[{'all':!![]}];}return db[_0xedac('0x35')]['findAll'](_0x1ddcc1);})['then'](function(_0x2cb3ca){_0x20d997[_0xedac('0x49')]=_0x2cb3ca;return _0x20d997;})['then'](respondWithFilteredResult(_0x527878,_0x1ddcc1))['catch'](handleError(_0x527878,null));};exports[_0xedac('0x4a')]=function(_0x38425e,_0x4e81bc){var _0x16a45a={'raw':![],'where':{'id':_0x38425e[_0xedac('0x4b')]['id']}},_0x4e0638={};_0x4e0638[_0xedac('0x39')]=_[_0xedac('0x4c')](db[_0xedac('0x35')][_0xedac('0x36')]);_0x4e0638[_0xedac('0x3a')]=_['keys'](_0x38425e[_0xedac('0x3a')]);_0x4e0638[_0xedac('0x3b')]=_['intersection'](_0x4e0638[_0xedac('0x39')],_0x4e0638[_0xedac('0x3a')]);_0x16a45a[_0xedac('0x3c')]=_['intersection'](_0x4e0638['model'],qs[_0xedac('0x3e')](_0x38425e[_0xedac('0x3a')]['fields']));_0x16a45a[_0xedac('0x3c')]=_0x16a45a[_0xedac('0x3c')][_0xedac('0x3f')]?_0x16a45a[_0xedac('0x3c')]:_0x4e0638[_0xedac('0x39')];if(_0x38425e[_0xedac('0x3a')][_0xedac('0x47')]){_0x16a45a[_0xedac('0x48')]=[{'all':!![]}];}_0x16a45a=_['merge']({},_0x16a45a,_0x38425e['options']);return db[_0xedac('0x35')][_0xedac('0x4d')](_0x16a45a)[_0xedac('0x19')](handleEntityNotFound(_0x4e81bc,null))['then'](respondWithResult(_0x4e81bc,null))[_0xedac('0x22')](handleError(_0x4e81bc,null));};exports[_0xedac('0x4e')]=function(_0x5cb635,_0x4f44e){var _0x276c23={'where':{'id':_0x5cb635['params']['id']}},_0x4bc336={};_0x4bc336['model']=_[_0xedac('0x4c')](db['Trunk'][_0xedac('0x36')]);_0x276c23['attributes']=_['intersection'](_0x4bc336[_0xedac('0x39')],qs[_0xedac('0x3e')](_0x5cb635[_0xedac('0x3a')][_0xedac('0x3e')]));_0x276c23[_0xedac('0x3c')]=_0x276c23['attributes'][_0xedac('0x3f')]?_0x276c23['attributes']:_0x4bc336[_0xedac('0x39')];if(_0x5cb635[_0xedac('0x3a')][_0xedac('0x47')]){_0x276c23[_0xedac('0x48')]=[{'all':!![]}];}_0x276c23=_[_0xedac('0x46')]({},_0x276c23,_0x5cb635[_0xedac('0x4f')]);return db[_0xedac('0x35')]['find'](_0x276c23)[_0xedac('0x19')](handleEntityNotFound(_0x4f44e,null))[_0xedac('0x19')](function(_0x1e1847){if(_0x1e1847){var _0xbc0ff5=_0x1e1847[_0xedac('0x2d')]({'plain':!![]});_0xbc0ff5=qs[_0xedac('0x50')](_0xbc0ff5,['id',_0xedac('0x51'),_0xedac('0x52')]);_0x5cb635[_0xedac('0x53')]=_[_0xedac('0x50')](_0x5cb635['body'],['id','createdAt',_0xedac('0x52')]);return db[_0xedac('0x35')][_0xedac('0x54')](_[_0xedac('0x46')](_0xbc0ff5,_0x5cb635[_0xedac('0x53')]),{'include':_0x5cb635['query'][_0xedac('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x8d20e7){var _0x15b168=_0x5cb635['user']['get']({'plain':!![]});if(!_0x15b168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b168[_0xedac('0x55')]===_0xedac('0x56')){var _0x2523bb=_0x8d20e7[_0xedac('0x2d')]({'plain':!![]});var _0x103632=_0xedac('0x2e');return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0x103632,'userProfileId':_0x15b168[_0xedac('0x58')]},'raw':!![]})[_0xedac('0x19')](function(_0x4fdff8){if(_0x4fdff8&&_0x4fdff8[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')]['create']({'name':_0x2523bb[_0xedac('0x32')],'resourceId':_0x2523bb['id'],'type':_0x4fdff8[_0xedac('0x32')],'sectionId':_0x4fdff8['id']},{})[_0xedac('0x19')](function(){return _0x8d20e7;});}else{return _0x8d20e7;}})[_0xedac('0x22')](function(_0x32d9d8){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x32d9d8);throw _0x32d9d8;});}return _0x8d20e7;});}})[_0xedac('0x19')](respondWithResult(_0x4f44e,0xc9))[_0xedac('0x22')](handleError(_0x4f44e,null));};exports[_0xedac('0x54')]=function(_0xd34f0c,_0x207b40,_0x77fc48){var _0x3a1d68;return db[_0xedac('0x35')][_0xedac('0x54')](_0xd34f0c[_0xedac('0x53')],{'raw':!![]})[_0xedac('0x19')](function(_0x493214){_0x3a1d68=_0x493214;return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x5458c3){var _0x2380ee=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x58ad68=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x300f52=ejs['render'](_0x2380ee,{'trunks':_0x5458c3||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x300f52);if(_0x3a1d68[_0xedac('0x62')]){var _0x218670=ejs[_0xedac('0x63')](_0x58ad68,{'trunks':_0x5458c3||[]});fs['writeFileSync'](_0xedac('0x64'),_0x218670);}})['then'](function(){return respondWithRpcPromise('Reload',_0xedac('0x54'),{'module':_0xedac('0x65')});})[_0xedac('0x19')](function(){var _0x104c27=_0xd34f0c[_0xedac('0x56')]['get']({'plain':!![]});if(!_0x104c27)throw new Error(_0xedac('0x66'));if(_0x104c27['role']===_0xedac('0x56')){var _0x358032=_0x3a1d68[_0xedac('0x2d')]({'plain':!![]});return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0xedac('0x2e'),'userProfileId':_0x104c27['userProfileId']},'raw':!![]})[_0xedac('0x19')](function(_0x1242a2){if(_0x1242a2&&_0x1242a2[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')][_0xedac('0x54')]({'name':_0x358032[_0xedac('0x32')],'resourceId':_0x358032['id'],'type':_0x1242a2[_0xedac('0x32')],'sectionId':_0x1242a2['id']},{})[_0xedac('0x19')](function(){return _0x3a1d68;});}else{return _0x3a1d68;}})[_0xedac('0x22')](function(_0x134a7a){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x134a7a);throw _0x134a7a;});}return _0x3a1d68;})['then'](respondWithResult(_0x207b40,0xc9))[_0xedac('0x22')](handleError(_0x207b40,null));};exports['update']=function(_0x5cba66,_0xdf86e8,_0x484b6b){var _0x197dad;return db[_0xedac('0x35')]['find']({'where':{'id':_0x5cba66[_0xedac('0x4b')]['id']}})['then'](handleEntityNotFound(_0xdf86e8,null))[_0xedac('0x19')](saveUpdates(_0x5cba66['body'],null))[_0xedac('0x19')](function(_0x5e512f){if(_0x5e512f){_0x197dad=_0x5e512f;return db[_0xedac('0x35')][_0xedac('0x67')]({'raw':!![]});}})['then'](function(_0x1dfc0b){if(_0x1dfc0b){var _0x4cec80=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x4be552=fs[_0xedac('0x5b')](path['join'](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x448066=ejs[_0xedac('0x63')](_0x4cec80,{'trunks':_0x1dfc0b||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x448066);var _0x1d8f28=ejs[_0xedac('0x63')](_0x4be552,{'trunks':_0x1dfc0b||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1d8f28);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x69'),{'module':_0xedac('0x65')});}return null;})[_0xedac('0x19')](function(_0x5ad133){if(_0x5ad133){return _0x197dad;}})['then'](respondWithResult(_0xdf86e8,null))[_0xedac('0x22')](handleError(_0xdf86e8,null));};exports[_0xedac('0x30')]=function(_0x4dd9bd,_0x3926ed,_0x472e8a){var _0x3b25ef;return db[_0xedac('0x35')][_0xedac('0x4d')]({'where':{'id':_0x4dd9bd[_0xedac('0x4b')]['id']}})[_0xedac('0x19')](handleEntityNotFound(_0x3926ed,null))[_0xedac('0x19')](removeEntity(_0x3926ed,null))[_0xedac('0x19')](function(){return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x22c47b){var _0x230d51=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config['root'],_0xedac('0x5e')),_0xedac('0x5f'));var _0x35a3c4=fs[_0xedac('0x5b')](path['join'](config['root'],_0xedac('0x60')),_0xedac('0x5f'));var _0x1f541a=ejs[_0xedac('0x63')](_0x230d51,{'trunks':_0x22c47b});var _0x20f7e6=ejs[_0xedac('0x63')](_0x35a3c4,{'trunks':_0x22c47b});fs[_0xedac('0x61')](_0xedac('0x6a'),_0x1f541a);fs[_0xedac('0x61')](_0xedac('0x64'),_0x20f7e6);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x30'),{'module':'chan_sip.so'});})[_0xedac('0x22')](handleError(_0x3926ed,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 35229be..82562f2 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 _0xbbc9=['bluebird','request-promise','path','rimraf','./trunk.attributes','define','tools_trunks','lodash','util','../../config/logger','moment'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0xbbc9,0x1a9));var _0x9bbc=function(_0x209472,_0x3a08fc){_0x209472=_0x209472-0x0;var _0xfc0aec=_0xbbc9[_0x209472];return _0xfc0aec;};'use strict';var _=require(_0x9bbc('0x0'));var util=require(_0x9bbc('0x1'));var logger=require(_0x9bbc('0x2'))('api');var moment=require(_0x9bbc('0x3'));var BPromise=require(_0x9bbc('0x4'));var rp=require(_0x9bbc('0x5'));var fs=require('fs');var path=require(_0x9bbc('0x6'));var rimraf=require(_0x9bbc('0x7'));var config=require('../../config/environment');var attributes=require(_0x9bbc('0x8'));module['exports']=function(_0x2a697c,_0x372059){return _0x2a697c[_0x9bbc('0x9')]('Trunk',attributes,{'tableName':_0x9bbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80c1=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./trunk.attributes','exports','define','tools_trunks'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x80c1,0x155));var _0x180c=function(_0x1eed3b,_0x4564f5){_0x1eed3b=_0x1eed3b-0x0;var _0x5ce406=_0x80c1[_0x1eed3b];return _0x5ce406;};'use strict';var _=require('lodash');var util=require(_0x180c('0x0'));var logger=require(_0x180c('0x1'))(_0x180c('0x2'));var moment=require(_0x180c('0x3'));var BPromise=require(_0x180c('0x4'));var rp=require(_0x180c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x180c('0x6'));var attributes=require(_0x180c('0x7'));module[_0x180c('0x8')]=function(_0x3a0749,_0x318f4c){return _0x3a0749[_0x180c('0x9')]('Trunk',attributes,{'tableName':_0x180c('0xa'),'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 1cb84fd..40d7218 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 _0x8ee3=['Trunk','find','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','info','catch','GetTrunk','findAll','options','raw','where','attributes','limit','include','map','model','then','debug'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0x8ee3,0x1bd));var _0x38ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ee3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x38ee('0x0'));var util=require(_0x38ee('0x1'));var moment=require(_0x38ee('0x2'));var BPromise=require(_0x38ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38ee('0x4'));var db=require(_0x38ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38ee('0x6'))(_0x38ee('0x7'));var config=require('../../config/environment');var jayson=require(_0x38ee('0x8'));var client=jayson[_0x38ee('0x9')][_0x38ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47c983,_0x581c14,_0x3344b4){return new BPromise(function(_0x590c52,_0x4cc90e){return client[_0x38ee('0xb')](_0x47c983,_0x3344b4)['then'](function(_0x14afb9){logger['info']('Trunk,\x20%s,\x20%s',_0x581c14,_0x38ee('0xc'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x581c14,_0x38ee('0xc'),JSON[_0x38ee('0xd')](_0x14afb9));if(_0x14afb9[_0x38ee('0xe')]){if(_0x14afb9[_0x38ee('0xe')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x581c14,_0x14afb9[_0x38ee('0xe')][_0x38ee('0xf')]);return _0x4cc90e(_0x14afb9[_0x38ee('0xe')]['message']);}logger[_0x38ee('0xe')](_0x38ee('0x10'),_0x581c14,_0x14afb9[_0x38ee('0xe')][_0x38ee('0xf')]);return _0x590c52(_0x14afb9[_0x38ee('0xe')][_0x38ee('0xf')]);}else{logger[_0x38ee('0x11')](_0x38ee('0x10'),_0x581c14,_0x38ee('0xc'));_0x590c52(_0x14afb9['result'][_0x38ee('0xf')]);}})[_0x38ee('0x12')](function(_0x3ac776){logger[_0x38ee('0xe')](_0x38ee('0x10'),_0x581c14,_0x3ac776);_0x4cc90e(_0x3ac776);});});}exports[_0x38ee('0x13')]=function(_0x358fa3){var _0x4524c3=this;return new Promise(function(_0x18c82c,_0xae4fa9){return db['Trunk'][_0x38ee('0x14')]({'raw':_0x358fa3[_0x38ee('0x15')]?_0x358fa3[_0x38ee('0x15')][_0x38ee('0x16')]===undefined?!![]:![]:!![],'where':_0x358fa3[_0x38ee('0x15')]?_0x358fa3[_0x38ee('0x15')][_0x38ee('0x17')]||null:null,'attributes':_0x358fa3[_0x38ee('0x15')]?_0x358fa3['options'][_0x38ee('0x18')]||null:null,'limit':_0x358fa3[_0x38ee('0x15')]?_0x358fa3[_0x38ee('0x15')][_0x38ee('0x19')]||null:null,'include':_0x358fa3['options']?_0x358fa3[_0x38ee('0x15')][_0x38ee('0x1a')]?_[_0x38ee('0x1b')](_0x358fa3[_0x38ee('0x15')][_0x38ee('0x1a')],function(_0x4f06ab){return{'model':db[_0x4f06ab[_0x38ee('0x1c')]],'as':_0x4f06ab['as'],'attributes':_0x4f06ab[_0x38ee('0x18')],'include':_0x4f06ab[_0x38ee('0x1a')]?_[_0x38ee('0x1b')](_0x4f06ab[_0x38ee('0x1a')],function(_0x2b849a){return{'model':db[_0x2b849a[_0x38ee('0x1c')]],'as':_0x2b849a['as'],'attributes':_0x2b849a[_0x38ee('0x18')],'include':_0x2b849a['include']?_[_0x38ee('0x1b')](_0x2b849a['include'],function(_0x4039a5){return{'model':db[_0x4039a5['model']],'as':_0x4039a5['as'],'attributes':_0x4039a5[_0x38ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x38ee('0x1d')](function(_0x45526c){logger[_0x38ee('0x11')]('GetTrunk',_0x358fa3);logger[_0x38ee('0x1e')](_0x38ee('0x13'),_0x358fa3,JSON[_0x38ee('0xd')](_0x45526c));_0x18c82c(_0x45526c);})[_0x38ee('0x12')](function(_0x1f0b98){logger[_0x38ee('0xe')](_0x38ee('0x13'),_0x1f0b98['message'],_0x358fa3);_0xae4fa9(_0x4524c3[_0x38ee('0xe')](0x1f4,_0x1f0b98[_0x38ee('0xf')]));});});};exports['ShowTrunk']=function(_0x12e468){var _0x5bf275=this;return new Promise(function(_0x6b87c5,_0xb01958){return db[_0x38ee('0x1f')][_0x38ee('0x20')]({'raw':_0x12e468[_0x38ee('0x15')]?_0x12e468[_0x38ee('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x12e468[_0x38ee('0x15')]?_0x12e468[_0x38ee('0x15')][_0x38ee('0x17')]||null:null,'attributes':_0x12e468[_0x38ee('0x15')]?_0x12e468[_0x38ee('0x15')]['attributes']||null:null,'include':_0x12e468[_0x38ee('0x15')]?_0x12e468[_0x38ee('0x15')][_0x38ee('0x1a')]?_[_0x38ee('0x1b')](_0x12e468['options'][_0x38ee('0x1a')],function(_0x3978fd){return{'model':db[_0x3978fd[_0x38ee('0x1c')]],'as':_0x3978fd['as'],'attributes':_0x3978fd[_0x38ee('0x18')],'include':_0x3978fd[_0x38ee('0x1a')]?_[_0x38ee('0x1b')](_0x3978fd[_0x38ee('0x1a')],function(_0x55b90b){return{'model':db[_0x55b90b[_0x38ee('0x1c')]],'as':_0x55b90b['as'],'attributes':_0x55b90b['attributes'],'include':_0x55b90b['include']?_[_0x38ee('0x1b')](_0x55b90b['include'],function(_0xe08647){return{'model':db[_0xe08647[_0x38ee('0x1c')]],'as':_0xe08647['as'],'attributes':_0xe08647['attributes']};}):[]};}):[]};}):[]:[]})[_0x38ee('0x1d')](function(_0x357f67){logger[_0x38ee('0x11')](_0x38ee('0x21'),_0x12e468);logger[_0x38ee('0x1e')](_0x38ee('0x21'),_0x12e468,JSON[_0x38ee('0xd')](_0x357f67));_0x6b87c5(_0x357f67);})[_0x38ee('0x12')](function(_0x24ce03){logger[_0x38ee('0xe')](_0x38ee('0x21'),_0x24ce03[_0x38ee('0xf')],_0x12e468);_0xb01958(_0x5bf275[_0x38ee('0xe')](0x1f4,_0x24ce03[_0x38ee('0xf')]));});});}; \ No newline at end of file +var _0x78d3=['options','raw','where','attributes','limit','map','model','include','catch','ShowTrunk','find','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetTrunk','Trunk'];(function(_0x1d3169,_0x299dda){var _0x393113=function(_0x5b452d){while(--_0x5b452d){_0x1d3169['push'](_0x1d3169['shift']());}};_0x393113(++_0x299dda);}(_0x78d3,0xeb));var _0x378d=function(_0x345b06,_0x366872){_0x345b06=_0x345b06-0x0;var _0x582de5=_0x78d3[_0x345b06];return _0x582de5;};'use strict';var _=require('lodash');var util=require(_0x378d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x378d('0x1'));var db=require(_0x378d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x378d('0x3'))(_0x378d('0x4'));var config=require(_0x378d('0x5'));var jayson=require(_0x378d('0x6'));var client=jayson[_0x378d('0x7')][_0x378d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x941f45,_0x1d80fb,_0x4e3c79){return new BPromise(function(_0x356172,_0x4b9af4){return client[_0x378d('0x9')](_0x941f45,_0x4e3c79)[_0x378d('0xa')](function(_0x399b41){logger['info'](_0x378d('0xb'),_0x1d80fb,_0x378d('0xc'));logger[_0x378d('0xd')](_0x378d('0xe'),_0x1d80fb,_0x378d('0xc'),JSON[_0x378d('0xf')](_0x399b41));if(_0x399b41['error']){if(_0x399b41['error']['code']===0x1f4){logger[_0x378d('0x10')](_0x378d('0xb'),_0x1d80fb,_0x399b41[_0x378d('0x10')][_0x378d('0x11')]);return _0x4b9af4(_0x399b41[_0x378d('0x10')][_0x378d('0x11')]);}logger[_0x378d('0x10')](_0x378d('0xb'),_0x1d80fb,_0x399b41[_0x378d('0x10')][_0x378d('0x11')]);return _0x356172(_0x399b41[_0x378d('0x10')][_0x378d('0x11')]);}else{logger[_0x378d('0x12')](_0x378d('0xb'),_0x1d80fb,_0x378d('0xc'));_0x356172(_0x399b41['result'][_0x378d('0x11')]);}})['catch'](function(_0x51dc9a){logger[_0x378d('0x10')](_0x378d('0xb'),_0x1d80fb,_0x51dc9a);_0x4b9af4(_0x51dc9a);});});}exports[_0x378d('0x13')]=function(_0x2e997c){var _0x518eec=this;return new Promise(function(_0x11b9ea,_0x29b59c){return db[_0x378d('0x14')]['findAll']({'raw':_0x2e997c[_0x378d('0x15')]?_0x2e997c[_0x378d('0x15')][_0x378d('0x16')]===undefined?!![]:![]:!![],'where':_0x2e997c[_0x378d('0x15')]?_0x2e997c[_0x378d('0x15')][_0x378d('0x17')]||null:null,'attributes':_0x2e997c[_0x378d('0x15')]?_0x2e997c[_0x378d('0x15')][_0x378d('0x18')]||null:null,'limit':_0x2e997c[_0x378d('0x15')]?_0x2e997c[_0x378d('0x15')][_0x378d('0x19')]||null:null,'include':_0x2e997c[_0x378d('0x15')]?_0x2e997c['options']['include']?_[_0x378d('0x1a')](_0x2e997c[_0x378d('0x15')]['include'],function(_0x593fbc){return{'model':db[_0x593fbc[_0x378d('0x1b')]],'as':_0x593fbc['as'],'attributes':_0x593fbc[_0x378d('0x18')],'include':_0x593fbc['include']?_[_0x378d('0x1a')](_0x593fbc[_0x378d('0x1c')],function(_0xefc41b){return{'model':db[_0xefc41b[_0x378d('0x1b')]],'as':_0xefc41b['as'],'attributes':_0xefc41b[_0x378d('0x18')],'include':_0xefc41b[_0x378d('0x1c')]?_['map'](_0xefc41b[_0x378d('0x1c')],function(_0x30ad89){return{'model':db[_0x30ad89[_0x378d('0x1b')]],'as':_0x30ad89['as'],'attributes':_0x30ad89[_0x378d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x378d('0xa')](function(_0x256ebc){logger[_0x378d('0x12')](_0x378d('0x13'),_0x2e997c);logger[_0x378d('0xd')](_0x378d('0x13'),_0x2e997c,JSON[_0x378d('0xf')](_0x256ebc));_0x11b9ea(_0x256ebc);})[_0x378d('0x1d')](function(_0x4c0d14){logger['error'](_0x378d('0x13'),_0x4c0d14['message'],_0x2e997c);_0x29b59c(_0x518eec[_0x378d('0x10')](0x1f4,_0x4c0d14[_0x378d('0x11')]));});});};exports[_0x378d('0x1e')]=function(_0x379d88){var _0x44a46a=this;return new Promise(function(_0x52b56d,_0x2a5276){return db[_0x378d('0x14')][_0x378d('0x1f')]({'raw':_0x379d88[_0x378d('0x15')]?_0x379d88[_0x378d('0x15')][_0x378d('0x16')]===undefined?!![]:![]:!![],'where':_0x379d88[_0x378d('0x15')]?_0x379d88[_0x378d('0x15')][_0x378d('0x17')]||null:null,'attributes':_0x379d88[_0x378d('0x15')]?_0x379d88[_0x378d('0x15')]['attributes']||null:null,'include':_0x379d88[_0x378d('0x15')]?_0x379d88['options']['include']?_[_0x378d('0x1a')](_0x379d88['options']['include'],function(_0x41f3cd){return{'model':db[_0x41f3cd['model']],'as':_0x41f3cd['as'],'attributes':_0x41f3cd[_0x378d('0x18')],'include':_0x41f3cd[_0x378d('0x1c')]?_['map'](_0x41f3cd[_0x378d('0x1c')],function(_0x272966){return{'model':db[_0x272966[_0x378d('0x1b')]],'as':_0x272966['as'],'attributes':_0x272966[_0x378d('0x18')],'include':_0x272966[_0x378d('0x1c')]?_['map'](_0x272966[_0x378d('0x1c')],function(_0xe6ae6a){return{'model':db[_0xe6ae6a[_0x378d('0x1b')]],'as':_0xe6ae6a['as'],'attributes':_0xe6ae6a['attributes']};}):[]};}):[]};}):[]:[]})[_0x378d('0xa')](function(_0x29bbee){logger[_0x378d('0x12')]('ShowTrunk',_0x379d88);logger[_0x378d('0xd')](_0x378d('0x1e'),_0x379d88,JSON['stringify'](_0x29bbee));_0x52b56d(_0x29bbee);})[_0x378d('0x1d')](function(_0xe5c769){logger[_0x378d('0x10')](_0x378d('0x1e'),_0xe5c769['message'],_0x379d88);_0x2a5276(_0x44a46a[_0x378d('0x10')](0x1f4,_0xe5c769[_0x378d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 619fdb2..db323ed 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 _0xd5f9=['/:id','update','express','../../components/auth/service','./user-setting.controller','put'];(function(_0x17818e,_0x344784){var _0x449919=function(_0xec9f0c){while(--_0xec9f0c){_0x17818e['push'](_0x17818e['shift']());}};_0x449919(++_0x344784);}(_0xd5f9,0x170));var _0x9d5f=function(_0x39ce5a,_0x260622){_0x39ce5a=_0x39ce5a-0x0;var _0x46cd9a=_0xd5f9[_0x39ce5a];return _0x46cd9a;};'use strict';var express=require(_0x9d5f('0x0'));var router=express['Router']();var auth=require(_0x9d5f('0x1'));var controller=require(_0x9d5f('0x2'));router[_0x9d5f('0x3')](_0x9d5f('0x4'),auth['isAuthenticated'](),controller[_0x9d5f('0x5')]);module['exports']=router; \ No newline at end of file +var _0x0fb8=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0x33b988,_0x7e1c55){var _0x17049b=function(_0x34d972){while(--_0x34d972){_0x33b988['push'](_0x33b988['shift']());}};_0x17049b(++_0x7e1c55);}(_0x0fb8,0x1ca));var _0x80fb=function(_0x3b55de,_0x2e51c6){_0x3b55de=_0x3b55de-0x0;var _0xc52bd5=_0x0fb8[_0x3b55de];return _0xc52bd5;};'use strict';var express=require(_0x80fb('0x0'));var router=express[_0x80fb('0x1')]();var auth=require(_0x80fb('0x2'));var controller=require(_0x80fb('0x3'));router[_0x80fb('0x4')](_0x80fb('0x5'),auth[_0x80fb('0x6')](),controller[_0x80fb('0x7')]);module[_0x80fb('0x8')]=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 63f36f8..ef384bd 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 _0x6d5d=['info','debug','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','error'];(function(_0x1acf5e,_0x5d1c05){var _0x42e4a0=function(_0x1ee07a){while(--_0x1ee07a){_0x1acf5e['push'](_0x1acf5e['shift']());}};_0x42e4a0(++_0x5d1c05);}(_0x6d5d,0x179));var _0xd6d5=function(_0x832c1a,_0x1700c8){_0x832c1a=_0x832c1a-0x0;var _0x5a8c69=_0x6d5d[_0x832c1a];return _0x5a8c69;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xd6d5('0x0'),'warning',_0xd6d5('0x1'),_0xd6d5('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xd6d5('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd6d5('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd6d5('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd6d5('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd6d5('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd6d5('0x7')],'unique':_0xd6d5('0x8')}}; \ No newline at end of file +var _0x0f61=['error','warning','info','debug','ENUM','DATE','INTEGER'];(function(_0x47b990,_0x28e5df){var _0x4d0c64=function(_0x40df89){while(--_0x40df89){_0x47b990['push'](_0x47b990['shift']());}};_0x4d0c64(++_0x28e5df);}(_0x0f61,0xee));var _0x10f6=function(_0x47f04d,_0x54c332){_0x47f04d=_0x47f04d-0x0;var _0x206846=_0x0f61[_0x47f04d];return _0x206846;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x10f6('0x0'),_0x10f6('0x1'),_0x10f6('0x2'),_0x10f6('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x10f6('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x10f6('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x10f6('0x6')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index fa5787a..1a03908 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 _0x80fb=['json','update','then','sendStatus','error','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status'];(function(_0x192a81,_0x15eea0){var _0x1aa63f=function(_0x1dfd78){while(--_0x1dfd78){_0x192a81['push'](_0x192a81['shift']());}};_0x1aa63f(++_0x15eea0);}(_0x80fb,0x11e));var _0xb80f=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x80fb[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var Redis=require(_0xb80f('0x0'));var logger=require(_0xb80f('0x1'))('api');var config=require(_0xb80f('0x2'));var db=require(_0xb80f('0x3'))['db'];var socket=require(_0xb80f('0x4'))(new Redis(config[_0xb80f('0x5')]));require(_0xb80f('0x6'))[_0xb80f('0x7')](socket);config[_0xb80f('0x5')]=_[_0xb80f('0x8')](config['redis'],{'host':_0xb80f('0x9'),'port':0x18eb});function respondWithResult(_0x251de5,_0x44cc46){_0x44cc46=_0x44cc46||0xc8;return function(_0x2083ab){if(_0x2083ab){return _0x251de5[_0xb80f('0xa')](_0x44cc46)[_0xb80f('0xb')](_0x2083ab);}};}function saveUpdates(_0x46f83f){return function(_0x2665ec){if(_0x2665ec){return _0x2665ec[_0xb80f('0xc')](_0x46f83f)[_0xb80f('0xd')](function(_0x46f991){return _0x46f991;});}return null;};}function handleEntityNotFound(_0x38069f){return function(_0xceb549){if(!_0xceb549){_0x38069f[_0xb80f('0xe')](0x194);}return _0xceb549;};}function handleError(_0x196532,_0x38846c){_0x38846c=_0x38846c||0x1f4;return function(_0x529e2c){logger[_0xb80f('0xf')](_0x529e2c['stack']);if(_0x529e2c[_0xb80f('0x10')]){delete _0x529e2c[_0xb80f('0x10')];}_0x196532[_0xb80f('0xa')](_0x38846c)[_0xb80f('0x11')](_0x529e2c);};}exports[_0xb80f('0xc')]=function(_0x198577,_0x2e0809){if(_0x198577[_0xb80f('0x12')][_0xb80f('0x13')]!==_0xb80f('0x14'))throw new Error(_0xb80f('0x15'));if(isNaN(Number(_0x198577[_0xb80f('0x16')]['id'])))throw new Error(_0xb80f('0x17'));return db[_0xb80f('0x18')][_0xb80f('0x19')]({'where':{'id':_0x198577['params']['id']}})[_0xb80f('0xd')](handleEntityNotFound(_0x2e0809,null))[_0xb80f('0xd')](saveUpdates(_0x198577['body'],null))['then'](respondWithResult(_0x2e0809,null))[_0xb80f('0x1a')](handleError(_0x2e0809,null));}; \ No newline at end of file +var _0x5c37=['lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','then','sendStatus','error','stack','name','status','update','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch'];(function(_0x1bac91,_0x4e946c){var _0x4bc99b=function(_0x4d8c11){while(--_0x4d8c11){_0x1bac91['push'](_0x1bac91['shift']());}};_0x4bc99b(++_0x4e946c);}(_0x5c37,0x11e));var _0x75c3=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0x5c37[_0x49cb71];return _0x3a50fd;};'use strict';var _=require(_0x75c3('0x0'));var Redis=require(_0x75c3('0x1'));var logger=require(_0x75c3('0x2'))(_0x75c3('0x3'));var config=require(_0x75c3('0x4'));var db=require(_0x75c3('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x75c3('0x6')]));require(_0x75c3('0x7'))[_0x75c3('0x8')](socket);config['redis']=_[_0x75c3('0x9')](config[_0x75c3('0x6')],{'host':_0x75c3('0xa'),'port':0x18eb});function respondWithResult(_0x3c19fa,_0x47d78b){_0x47d78b=_0x47d78b||0xc8;return function(_0x1c9a68){if(_0x1c9a68){return _0x3c19fa['status'](_0x47d78b)['json'](_0x1c9a68);}};}function saveUpdates(_0x3743f4){return function(_0x2fd0d2){if(_0x2fd0d2){return _0x2fd0d2['update'](_0x3743f4)[_0x75c3('0xb')](function(_0xdd2a35){return _0xdd2a35;});}return null;};}function handleEntityNotFound(_0x129ac3){return function(_0x2150b0){if(!_0x2150b0){_0x129ac3[_0x75c3('0xc')](0x194);}return _0x2150b0;};}function handleError(_0x22178f,_0x536ff4){_0x536ff4=_0x536ff4||0x1f4;return function(_0x5615ac){logger[_0x75c3('0xd')](_0x5615ac[_0x75c3('0xe')]);if(_0x5615ac[_0x75c3('0xf')]){delete _0x5615ac[_0x75c3('0xf')];}_0x22178f[_0x75c3('0x10')](_0x536ff4)['send'](_0x5615ac);};}exports[_0x75c3('0x11')]=function(_0x233e25,_0x1b3c92){if(_0x233e25[_0x75c3('0x12')]['role']!==_0x75c3('0x13'))throw new Error(_0x75c3('0x14'));if(isNaN(Number(_0x233e25[_0x75c3('0x15')]['id'])))throw new Error(_0x75c3('0x16'));return db[_0x75c3('0x17')][_0x75c3('0x18')]({'where':{'id':_0x233e25[_0x75c3('0x15')]['id']}})[_0x75c3('0xb')](handleEntityNotFound(_0x1b3c92,null))[_0x75c3('0xb')](saveUpdates(_0x233e25['body'],null))[_0x75c3('0xb')](respondWithResult(_0x1b3c92,null))[_0x75c3('0x19')](handleError(_0x1b3c92,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 28e3d6b..f42eeda 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 _0x724f=['hook','exports','events','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x37dc85,_0x187965){var _0xf79aee=function(_0x2c55f3){while(--_0x2c55f3){_0x37dc85['push'](_0x37dc85['shift']());}};_0xf79aee(++_0x187965);}(_0x724f,0x113));var _0xf724=function(_0x2b96b4,_0x281d4c){_0x2b96b4=_0x2b96b4-0x0;var _0x5aeab6=_0x724f[_0x2b96b4];return _0x5aeab6;};'use strict';var EventEmitter=require(_0xf724('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf724('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf724('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5e790e){return function(_0x17aec2,_0x1590ce,_0x31647c){UserSettingEvents[_0xf724('0x3')](_0x5e790e+':'+_0x17aec2['id'],_0x17aec2);UserSettingEvents[_0xf724('0x3')](_0x5e790e,_0x17aec2);_0x31647c(null);};}for(var e in events){if(events[_0xf724('0x4')](e)){var event=events[e];UserSetting[_0xf724('0x5')](e,emitEvent(event));}}module[_0xf724('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xe397=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xe397,0x18d));var _0x7e39=function(_0x3bd160,_0x3e1a0a){_0x3bd160=_0x3bd160-0x0;var _0x5bb055=_0xe397[_0x3bd160];return _0x5bb055;};'use strict';var EventEmitter=require(_0x7e39('0x0'));var UserSetting=require(_0x7e39('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7e39('0x2')](0x0);var events={'afterCreate':_0x7e39('0x3'),'afterUpdate':_0x7e39('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5cb23e){return function(_0x423511,_0x2ad95c,_0x408da5){UserSettingEvents[_0x7e39('0x5')](_0x5cb23e+':'+_0x423511['id'],_0x423511);UserSettingEvents[_0x7e39('0x5')](_0x5cb23e,_0x423511);_0x408da5(null);};}for(var e in events){if(events[_0x7e39('0x6')](e)){var event=events[e];UserSetting[_0x7e39('0x7')](e,emitEvent(event));}}module[_0x7e39('0x8')]=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 d72d4aa..31f27a0 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 _0xefda=['./user-setting.attributes','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x2d4836,_0x4fff51){var _0x1aa443=function(_0x111690){while(--_0x111690){_0x2d4836['push'](_0x2d4836['shift']());}};_0x1aa443(++_0x4fff51);}(_0xefda,0x96));var _0xaefd=function(_0x393af4,_0x1d9367){_0x393af4=_0x393af4-0x0;var _0x4b3efb=_0xefda[_0x393af4];return _0x4b3efb;};'use strict';var attributes=require(_0xaefd('0x0'));module['exports']=function(_0x4d8f17){return _0x4d8f17[_0xaefd('0x1')](_0xaefd('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24c204){if(!_0x24c204[_0xaefd('0x3')])_0x24c204[_0xaefd('0x4')]=null;else if(_0x24c204[_0xaefd('0x4')]===null)_0x24c204[_0xaefd('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x97f5=['exports','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0xa6d4a5,_0x19825b){var _0x3f47aa=function(_0x10eb08){while(--_0x10eb08){_0xa6d4a5['push'](_0xa6d4a5['shift']());}};_0x3f47aa(++_0x19825b);}(_0x97f5,0x72));var _0x597f=function(_0x233691,_0x6e7c89){_0x233691=_0x233691-0x0;var _0x34ff7a=_0x97f5[_0x233691];return _0x34ff7a;};'use strict';var attributes=require(_0x597f('0x0'));module[_0x597f('0x1')]=function(_0x3e0826){return _0x3e0826['define']('UserSetting',attributes,{'tableName':_0x597f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4058fa){if(!_0x4058fa[_0x597f('0x3')])_0x4058fa[_0x597f('0x4')]=null;else if(_0x4058fa[_0x597f('0x4')]===null)_0x4058fa[_0x597f('0x4')]=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 e7f0482..12fd2c4 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 _0xdd7c=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','./user-setting.events'];(function(_0x55cbb6,_0x4387ec){var _0x28699c=function(_0x54c7ab){while(--_0x54c7ab){_0x55cbb6['push'](_0x55cbb6['shift']());}};_0x28699c(++_0x4387ec);}(_0xdd7c,0xc3));var _0xcdd7=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0xdd7c[_0x3d34da];return _0xcf6af8;};'use strict';var UserSettingEvents=require(_0xcdd7('0x0'));var events=['save','remove',_0xcdd7('0x1')];function createListener(_0x270ce3,_0x1e9e44){return function(_0x384980){_0x1e9e44[_0xcdd7('0x2')](_0x270ce3,_0x384980);if(_0x270ce3===_0xcdd7('0x3')){_0x1e9e44['emit'](_0xcdd7('0x4')+_0x384980[_0xcdd7('0x5')],_0x384980);}};}exports[_0xcdd7('0x6')]=function(_0x50bd84){for(var _0x451455=0x0,_0x206e8d=events['length'];_0x451455<_0x206e8d;_0x451455++){var _0xaf4b04=events[_0x451455];var _0x34aee4=createListener('user-setting:'+_0xaf4b04,_0x50bd84);UserSettingEvents['on'](_0xaf4b04,_0x34aee4);}}; \ No newline at end of file +var _0xdd76=['emit','user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','save','update'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xdd76,0x102));var _0x6dd7=function(_0x4423aa,_0x5c3b18){_0x4423aa=_0x4423aa-0x0;var _0x3647d5=_0xdd76[_0x4423aa];return _0x3647d5;};'use strict';var UserSettingEvents=require(_0x6dd7('0x0'));var events=[_0x6dd7('0x1'),'remove',_0x6dd7('0x2')];function createListener(_0x35586c,_0x2b5b8f){return function(_0x1c6387){_0x2b5b8f[_0x6dd7('0x3')](_0x35586c,_0x1c6387);if(_0x35586c===_0x6dd7('0x4')){_0x2b5b8f['emit'](_0x6dd7('0x5')+_0x1c6387[_0x6dd7('0x6')],_0x1c6387);}};}exports[_0x6dd7('0x7')]=function(_0x70de3a){for(var _0x83df88=0x0,_0x561e61=events['length'];_0x83df88<_0x561e61;_0x83df88++){var _0x41498f=events[_0x83df88];var _0x3c37f5=createListener(_0x6dd7('0x8')+_0x41498f,_0x70de3a);UserSettingEvents['on'](_0x41498f,_0x3c37f5);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index bb5738b..3f09b81 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 _0x0431=['/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','login','/:id/logout','/:id/unpause','unpause','/:id/teams','addTeams','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0431,0x11d));var _0x1043=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x0431[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x1043('0x0'));var util=require(_0x1043('0x1'));var path=require(_0x1043('0x2'));var timeout=require(_0x1043('0x3'));var express=require(_0x1043('0x4'));var router=express['Router']();var fs_extra=require(_0x1043('0x5'));var auth=require(_0x1043('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1043('0x7'));var controller=require(_0x1043('0x8'));router[_0x1043('0x9')]('/',auth[_0x1043('0xa')](),controller['index']);router[_0x1043('0x9')]('/describe',auth[_0x1043('0xa')](),controller['describe']);router[_0x1043('0x9')]('/whoami',auth[_0x1043('0xa')](),controller[_0x1043('0xb')]);router[_0x1043('0x9')](_0x1043('0xc'),auth[_0x1043('0xa')](),controller[_0x1043('0xd')]);router[_0x1043('0x9')](_0x1043('0xe'),auth['isAuthenticated'](),controller[_0x1043('0xf')]);router['get']('/:id/avatar',controller[_0x1043('0x10')]);router[_0x1043('0x9')](_0x1043('0x11'),auth[_0x1043('0xa')](),controller['getOpenTabs']);router[_0x1043('0x9')](_0x1043('0x12'),auth[_0x1043('0xa')](),controller['getContacts']);router['get'](_0x1043('0x13'),auth[_0x1043('0xa')](),controller[_0x1043('0x14')]);router[_0x1043('0x9')](_0x1043('0x15'),auth[_0x1043('0xa')](),controller[_0x1043('0x16')]);router[_0x1043('0x9')](_0x1043('0x17'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x1043('0x18'),auth[_0x1043('0xa')](),controller[_0x1043('0x19')]);router['get'](_0x1043('0x1a'),auth['isAuthenticated'](),controller[_0x1043('0x1b')]);router[_0x1043('0x9')](_0x1043('0x1c'),auth[_0x1043('0xa')](),controller[_0x1043('0x1d')]);router['get']('/:id/openchannel/interactions',auth[_0x1043('0xa')](),controller[_0x1043('0x1e')]);router[_0x1043('0x9')](_0x1043('0x1f'),auth['isAuthenticated'](),controller[_0x1043('0x20')]);router['get'](_0x1043('0x21'),auth['isAuthenticated'](),controller[_0x1043('0x22')]);router[_0x1043('0x9')](_0x1043('0x23'),auth[_0x1043('0xa')](),controller[_0x1043('0x24')]);router[_0x1043('0x9')]('/:id/whatsapp/interactions',auth[_0x1043('0xa')](),controller[_0x1043('0x25')]);router['get']('/:id/teams',auth[_0x1043('0xa')](),controller['getTeams']);router[_0x1043('0x9')](_0x1043('0x26'),auth['isAuthenticated'](),controller[_0x1043('0x27')]);router[_0x1043('0x9')](_0x1043('0x28'),auth[_0x1043('0xa')](),controller[_0x1043('0x29')]);router[_0x1043('0x9')](_0x1043('0x2a'),auth[_0x1043('0xa')](),controller[_0x1043('0x2b')]);router[_0x1043('0x9')](_0x1043('0x2c'),auth[_0x1043('0xa')](),controller[_0x1043('0x2d')]);router[_0x1043('0x9')](_0x1043('0x2e'),auth[_0x1043('0xa')](),controller['getMailAccounts']);router['get'](_0x1043('0x2f'),auth[_0x1043('0xa')](),controller[_0x1043('0x30')]);router[_0x1043('0x9')](_0x1043('0x31'),auth[_0x1043('0xa')](),controller[_0x1043('0x32')]);router[_0x1043('0x9')](_0x1043('0x33'),auth[_0x1043('0xa')](),controller[_0x1043('0x34')]);router[_0x1043('0x9')](_0x1043('0x35'),auth[_0x1043('0xa')](),controller[_0x1043('0x36')]);router[_0x1043('0x9')](_0x1043('0x37'),auth[_0x1043('0xa')](),controller[_0x1043('0x38')]);router[_0x1043('0x9')]('/:id/api_key',auth[_0x1043('0xa')](),controller[_0x1043('0x39')]);router[_0x1043('0x3a')](_0x1043('0x12'),auth[_0x1043('0xa')](),controller[_0x1043('0x3b')]);router[_0x1043('0x3a')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x1043('0x3c'),auth[_0x1043('0xa')](),controller[_0x1043('0x3d')]);router['post'](_0x1043('0x13'),auth[_0x1043('0xa')](),controller[_0x1043('0x3e')]);var upload=multer({'storage':multer[_0x1043('0x3f')]({'destination':function(_0x296fb7,_0x52ff4c,_0x45d9ef){_0x45d9ef(null,path[_0x1043('0x40')](config[_0x1043('0x41')],'server/files/images/'));},'filename':function(_0x177f19,_0x37c42a,_0x1c8b8a){_0x1c8b8a(null,util[_0x1043('0x42')](_0x1043('0x43'),Date[_0x1043('0x44')](),_0x37c42a[_0x1043('0x45')]));}})});router[_0x1043('0x3a')](_0x1043('0x46'),upload[_0x1043('0x47')](_0x1043('0x48')),controller[_0x1043('0x49')]);router[_0x1043('0x3a')]('/:id/login',auth[_0x1043('0xa')](),controller[_0x1043('0x4a')]);router[_0x1043('0x3a')](_0x1043('0x4b'),auth['isAuthenticated'](),controller['logout']);router[_0x1043('0x3a')]('/:id/pause',auth[_0x1043('0xa')](),controller['pause']);router[_0x1043('0x3a')](_0x1043('0x4c'),auth[_0x1043('0xa')](),controller[_0x1043('0x4d')]);router[_0x1043('0x3a')](_0x1043('0x4e'),auth['isAuthenticated'](),controller[_0x1043('0x4f')]);router['post']('/:id/chat_interactions',auth[_0x1043('0xa')](),controller['addChatInteractions']);router[_0x1043('0x3a')]('/:id/mail_interactions',auth[_0x1043('0xa')](),controller[_0x1043('0x50')]);router['post'](_0x1043('0x51'),auth[_0x1043('0xa')](),controller[_0x1043('0x52')]);router[_0x1043('0x3a')](_0x1043('0x53'),auth[_0x1043('0xa')](),controller[_0x1043('0x54')]);router[_0x1043('0x3a')](_0x1043('0x55'),auth['isAuthenticated'](),controller[_0x1043('0x56')]);router['post']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x1043('0x3a')](_0x1043('0x2c'),auth[_0x1043('0xa')](),controller['addFaxAccounts']);router[_0x1043('0x3a')](_0x1043('0x2e'),auth['isAuthenticated'](),controller[_0x1043('0x57')]);router[_0x1043('0x3a')](_0x1043('0x2f'),auth[_0x1043('0xa')](),controller[_0x1043('0x58')]);router[_0x1043('0x3a')](_0x1043('0x31'),auth[_0x1043('0xa')](),controller[_0x1043('0x59')]);router['post'](_0x1043('0x33'),auth[_0x1043('0xa')](),controller[_0x1043('0x5a')]);router[_0x1043('0x3a')](_0x1043('0x35'),auth['isAuthenticated'](),controller[_0x1043('0x5b')]);router[_0x1043('0x3a')](_0x1043('0x5c'),auth['isAuthenticated'](),controller[_0x1043('0x5d')]);router[_0x1043('0x5e')](_0x1043('0xe'),auth['isAuthenticated'](),controller[_0x1043('0x5f')]);router[_0x1043('0x5e')](_0x1043('0x60'),auth[_0x1043('0xa')](),controller[_0x1043('0x61')]);router[_0x1043('0x62')]('/:id/queues',auth[_0x1043('0xa')](),controller[_0x1043('0x63')]);router[_0x1043('0x62')](_0x1043('0x4e'),auth[_0x1043('0xa')](),controller[_0x1043('0x64')]);router[_0x1043('0x62')](_0x1043('0xe'),auth[_0x1043('0xa')](),controller[_0x1043('0x65')]);router[_0x1043('0x62')]('/:id/chat_interactions',auth[_0x1043('0xa')](),controller['removeChatInteractions']);router[_0x1043('0x62')](_0x1043('0x66'),auth[_0x1043('0xa')](),controller[_0x1043('0x67')]);router['delete']('/:id/fax_interactions',auth[_0x1043('0xa')](),controller[_0x1043('0x68')]);router[_0x1043('0x62')](_0x1043('0x53'),auth[_0x1043('0xa')](),controller[_0x1043('0x69')]);router['delete'](_0x1043('0x55'),auth[_0x1043('0xa')](),controller[_0x1043('0x6a')]);router[_0x1043('0x62')](_0x1043('0x6b'),auth[_0x1043('0xa')](),controller[_0x1043('0x6c')]);router[_0x1043('0x62')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x1043('0x6d')]);router[_0x1043('0x62')](_0x1043('0x2e'),auth[_0x1043('0xa')](),controller[_0x1043('0x6e')]);router[_0x1043('0x62')](_0x1043('0x2f'),auth[_0x1043('0xa')](),controller[_0x1043('0x6f')]);router['delete'](_0x1043('0x31'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x1043('0x62')](_0x1043('0x33'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x1043('0x62')]('/:id/whatsapp_accounts',auth[_0x1043('0xa')](),controller[_0x1043('0x70')]);router[_0x1043('0x62')](_0x1043('0x5c'),auth[_0x1043('0xa')](),controller[_0x1043('0x71')]);module[_0x1043('0x72')]=router; \ No newline at end of file +var _0xa56c=['getMailInteractions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','/:id/api_key','create','post','addQueues','diskStorage','server/files/images/','format','%s-%s','originalname','file','/:id/login','login','/:id/logout','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions'];(function(_0x219e10,_0x1202b3){var _0x162e2b=function(_0xc3f164){while(--_0xc3f164){_0x219e10['push'](_0x219e10['shift']());}};_0x162e2b(++_0x1202b3);}(_0xa56c,0x1f4));var _0xca56=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xa56c[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0xca56('0x0'));var util=require(_0xca56('0x1'));var path=require('path');var timeout=require(_0xca56('0x2'));var express=require(_0xca56('0x3'));var router=express[_0xca56('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xca56('0x5'));var interaction=require(_0xca56('0x6'));var config=require(_0xca56('0x7'));var controller=require(_0xca56('0x8'));router[_0xca56('0x9')]('/',auth[_0xca56('0xa')](),controller['index']);router[_0xca56('0x9')](_0xca56('0xb'),auth[_0xca56('0xa')](),controller[_0xca56('0xc')]);router[_0xca56('0x9')]('/whoami',auth['isAuthenticated'](),controller[_0xca56('0xd')]);router['get'](_0xca56('0xe'),auth[_0xca56('0xa')](),controller[_0xca56('0xf')]);router[_0xca56('0x9')](_0xca56('0x10'),auth[_0xca56('0xa')](),controller['show']);router[_0xca56('0x9')](_0xca56('0x11'),controller[_0xca56('0x12')]);router[_0xca56('0x9')]('/:id/open_tabs',auth[_0xca56('0xa')](),controller['getOpenTabs']);router[_0xca56('0x9')](_0xca56('0x13'),auth[_0xca56('0xa')](),controller['getContacts']);router[_0xca56('0x9')](_0xca56('0x14'),auth[_0xca56('0xa')](),controller['getQueues']);router['get'](_0xca56('0x15'),auth[_0xca56('0xa')](),controller[_0xca56('0x16')]);router[_0xca56('0x9')]('/:id/groups',auth[_0xca56('0xa')](),controller[_0xca56('0x17')]);router[_0xca56('0x9')](_0xca56('0x18'),auth[_0xca56('0xa')](),controller[_0xca56('0x19')]);router[_0xca56('0x9')]('/:id/screen_recordings',auth[_0xca56('0xa')](),controller[_0xca56('0x1a')]);router[_0xca56('0x9')](_0xca56('0x1b'),auth[_0xca56('0xa')](),controller['getChatInteractions']);router[_0xca56('0x9')](_0xca56('0x1c'),auth['isAuthenticated'](),controller[_0xca56('0x1d')]);router[_0xca56('0x9')]('/:id/mail/interactions',auth[_0xca56('0xa')](),controller[_0xca56('0x1e')]);router[_0xca56('0x9')](_0xca56('0x1f'),auth[_0xca56('0xa')](),controller['getSmsInteractions']);router['get']('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xca56('0x20')]);router[_0xca56('0x9')]('/:id/whatsapp/interactions',auth[_0xca56('0xa')](),controller[_0xca56('0x21')]);router[_0xca56('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xca56('0x22')]);router[_0xca56('0x9')]('/:id/lists',auth[_0xca56('0xa')](),controller[_0xca56('0x23')]);router[_0xca56('0x9')](_0xca56('0x24'),auth[_0xca56('0xa')](),controller[_0xca56('0x25')]);router[_0xca56('0x9')](_0xca56('0x26'),auth['isAuthenticated'](),controller[_0xca56('0x27')]);router[_0xca56('0x9')](_0xca56('0x28'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xca56('0x9')](_0xca56('0x29'),auth['isAuthenticated'](),controller[_0xca56('0x2a')]);router['get'](_0xca56('0x2b'),auth[_0xca56('0xa')](),controller[_0xca56('0x2c')]);router['get'](_0xca56('0x2d'),auth[_0xca56('0xa')](),controller[_0xca56('0x2e')]);router['get'](_0xca56('0x2f'),auth[_0xca56('0xa')](),controller[_0xca56('0x30')]);router[_0xca56('0x9')]('/:id/whatsapp_accounts',auth[_0xca56('0xa')](),controller[_0xca56('0x31')]);router[_0xca56('0x9')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xca56('0x32')]);router['get'](_0xca56('0x33'),auth[_0xca56('0xa')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0xca56('0xa')](),controller['addContacts']);router['post']('/',auth[_0xca56('0xa')](),controller[_0xca56('0x34')]);router[_0xca56('0x35')]('/create_many',auth[_0xca56('0xa')](),controller['bulkCreate']);router[_0xca56('0x35')](_0xca56('0x14'),auth[_0xca56('0xa')](),controller[_0xca56('0x36')]);var upload=multer({'storage':multer[_0xca56('0x37')]({'destination':function(_0x3f6bea,_0x3cc69f,_0x3e5ee1){_0x3e5ee1(null,path['join'](config['root'],_0xca56('0x38')));},'filename':function(_0x1064eb,_0x5b675b,_0x59343f){_0x59343f(null,util[_0xca56('0x39')](_0xca56('0x3a'),Date['now'](),_0x5b675b[_0xca56('0x3b')]));}})});router[_0xca56('0x35')](_0xca56('0x11'),upload['single'](_0xca56('0x3c')),controller['addAvatar']);router[_0xca56('0x35')](_0xca56('0x3d'),auth[_0xca56('0xa')](),controller[_0xca56('0x3e')]);router[_0xca56('0x35')](_0xca56('0x3f'),auth['isAuthenticated'](),controller['logout']);router[_0xca56('0x35')]('/:id/pause',auth[_0xca56('0xa')](),controller[_0xca56('0x40')]);router['post'](_0xca56('0x41'),auth[_0xca56('0xa')](),controller[_0xca56('0x42')]);router[_0xca56('0x35')](_0xca56('0x43'),auth['isAuthenticated'](),controller[_0xca56('0x44')]);router[_0xca56('0x35')](_0xca56('0x45'),auth['isAuthenticated'](),controller[_0xca56('0x46')]);router[_0xca56('0x35')](_0xca56('0x47'),auth[_0xca56('0xa')](),controller['addMailInteractions']);router[_0xca56('0x35')](_0xca56('0x48'),auth['isAuthenticated'](),controller[_0xca56('0x49')]);router[_0xca56('0x35')](_0xca56('0x4a'),auth['isAuthenticated'](),controller[_0xca56('0x4b')]);router[_0xca56('0x35')](_0xca56('0x4c'),auth[_0xca56('0xa')](),controller[_0xca56('0x4d')]);router[_0xca56('0x35')](_0xca56('0x4e'),auth[_0xca56('0xa')](),controller[_0xca56('0x4f')]);router[_0xca56('0x35')](_0xca56('0x28'),auth['isAuthenticated'](),controller[_0xca56('0x50')]);router[_0xca56('0x35')]('/:id/mail_accounts',auth[_0xca56('0xa')](),controller[_0xca56('0x51')]);router[_0xca56('0x35')]('/:id/openchannel_accounts',auth[_0xca56('0xa')](),controller[_0xca56('0x52')]);router['post']('/:id/sms_accounts',auth[_0xca56('0xa')](),controller[_0xca56('0x53')]);router[_0xca56('0x35')]('/:id/chat_websites',auth[_0xca56('0xa')](),controller[_0xca56('0x54')]);router[_0xca56('0x35')](_0xca56('0x55'),auth[_0xca56('0xa')](),controller[_0xca56('0x56')]);router['post'](_0xca56('0x33'),auth[_0xca56('0xa')](),controller[_0xca56('0x57')]);router[_0xca56('0x58')]('/:id',auth[_0xca56('0xa')](),controller['update']);router[_0xca56('0x58')](_0xca56('0x59'),auth[_0xca56('0xa')](),controller[_0xca56('0x5a')]);router[_0xca56('0x5b')]('/:id/queues',auth[_0xca56('0xa')](),controller[_0xca56('0x5c')]);router[_0xca56('0x5b')](_0xca56('0x43'),auth[_0xca56('0xa')](),controller[_0xca56('0x5d')]);router[_0xca56('0x5b')]('/:id',auth[_0xca56('0xa')](),controller['destroy']);router[_0xca56('0x5b')](_0xca56('0x45'),auth[_0xca56('0xa')](),controller[_0xca56('0x5e')]);router['delete'](_0xca56('0x47'),auth[_0xca56('0xa')](),controller[_0xca56('0x5f')]);router[_0xca56('0x5b')](_0xca56('0x48'),auth[_0xca56('0xa')](),controller[_0xca56('0x60')]);router['delete']('/:id/sms_interactions',auth[_0xca56('0xa')](),controller[_0xca56('0x61')]);router['delete'](_0xca56('0x4c'),auth[_0xca56('0xa')](),controller[_0xca56('0x62')]);router[_0xca56('0x5b')]('/:id/whatsapp_interactions',auth[_0xca56('0xa')](),controller['removeWhatsappInteractions']);router[_0xca56('0x5b')]('/:id/fax_accounts',auth[_0xca56('0xa')](),controller[_0xca56('0x63')]);router[_0xca56('0x5b')](_0xca56('0x29'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0xca56('0x5b')](_0xca56('0x2b'),auth[_0xca56('0xa')](),controller[_0xca56('0x64')]);router[_0xca56('0x5b')](_0xca56('0x2d'),auth['isAuthenticated'](),controller[_0xca56('0x65')]);router[_0xca56('0x5b')](_0xca56('0x2f'),auth[_0xca56('0xa')](),controller[_0xca56('0x66')]);router[_0xca56('0x5b')](_0xca56('0x55'),auth[_0xca56('0xa')](),controller[_0xca56('0x67')]);router[_0xca56('0x5b')](_0xca56('0x33'),auth['isAuthenticated'](),controller[_0xca56('0x68')]);module[_0xca56('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 822e9e7..d501911 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x43035e,_0x18502a){var _0x25eb91=function(_0x49d386){while(--_0x49d386){_0x43035e['push'](_0x43035e['shift']());}};_0x25eb91(++_0x18502a);}(_0x70e0,0x17b));var _0x070e=function(_0x328aa6,_0x464d08){_0x328aa6=_0x328aa6-0x0;var _0x3353cd=_0x70e0[_0x328aa6];return _0x3353cd;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a17dd42..36f2b7b 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 _0x2ec7=['removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$or','$gt','$gte','$ne','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','firstName','lastName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','teams','queues','flatten','col','toString','asc','desc','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','SELECT','ui.','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','path','lodash','squel','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','agent','emit','userNotification:recalc:','get','role','admin','Users','user','Agents','Telephones','value','includes','find','destroy','name','index','User','map','fieldName','type','key','password','salt','getOptions','query','includeAll','include','UserSetting','userSetting','attributes','findAll','rows','openTabs','push','chat','sms','dataValues','mail','openchannel','whatsapp','all','catch','show','params','model','differenceBy','keys','filters','intersection','true','merge','options','fax','body','describe','addContacts','ids','omit','internal','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','length','from','voicemail','mailbox','fullname','email','permissions','102','103','113','110','104','105','106','107','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','isEmpty','telephone','compact','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','isArray','Queue:remove','userpic','file','getAvatar','join','root','download','server/files/images/','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','fields','where','filter','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','rawAttributes','order','sort','pick','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','PAUSE','updateAttributes','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','resolve','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','removeAgent','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save'];(function(_0x194338,_0x3ba299){var _0x2216d3=function(_0x5342a0){while(--_0x5342a0){_0x194338['push'](_0x194338['shift']());}};_0x2216d3(++_0x3ba299);}(_0x2ec7,0x1f3));var _0x72ec=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2ec7[_0x8c43de];return _0xa6591b;};'use strict';var moment=require(_0x72ec('0x0'));var util=require('util');var path=require(_0x72ec('0x1'));var fs=require('fs');var _=require(_0x72ec('0x2'));var squel=require(_0x72ec('0x3'));var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require(_0x72ec('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x72ec('0x5'));var utils=require(_0x72ec('0x6'));var config=require(_0x72ec('0x7'));var licenseUtil=require(_0x72ec('0x8'));var APIBadRequestError=require(_0x72ec('0x9'))[_0x72ec('0xa')];var APINotFoundError=require(_0x72ec('0x9'))[_0x72ec('0xb')];var APIHandleError=require(_0x72ec('0x9'))[_0x72ec('0xc')];var db=require(_0x72ec('0xd'))['db'];var socket=require(_0x72ec('0xe'))(new Redis(config[_0x72ec('0xf')]));require(_0x72ec('0x10'))[_0x72ec('0x11')](socket);config[_0x72ec('0xf')]=_['defaults'](config[_0x72ec('0xf')],{'host':_0x72ec('0x12'),'port':0x18eb});var amiClient=jayson[_0x72ec('0x13')][_0x72ec('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x2077d3,_0x5b0dbb,_0x5f396e,_0x409159){return new Promise(function(_0x2aa09a,_0x252a9b){var _0xfccd18=_0x409159||amiClient;return _0xfccd18[_0x72ec('0x15')](_0x2077d3,_0x5f396e)[_0x72ec('0x16')](function(_0x169f2c){logger[_0x72ec('0x17')](_0x72ec('0x18'),_0x5b0dbb,_0x72ec('0x19'));logger[_0x72ec('0x1a')](_0x72ec('0x1b'),_0x5b0dbb,'request\x20sent',JSON[_0x72ec('0x1c')](_0x169f2c));if(_0x169f2c[_0x72ec('0x1d')]){if(_0x169f2c['error'][_0x72ec('0x1e')]===0x1f4){logger['error'](_0x72ec('0x18'),_0x5b0dbb,_0x169f2c[_0x72ec('0x1d')]['message']);return _0x252a9b(_0x169f2c[_0x72ec('0x1d')][_0x72ec('0x1f')]);}logger[_0x72ec('0x1d')](_0x72ec('0x18'),_0x5b0dbb,_0x169f2c[_0x72ec('0x1d')]['message']);return _0x2aa09a(_0x169f2c['error'][_0x72ec('0x1f')]);}else{logger['info']('User,\x20%s,\x20%s',_0x5b0dbb,_0x72ec('0x19'));_0x2aa09a(_0x169f2c[_0x72ec('0x20')]['message']);}})['catch'](function(_0x59b9b1){logger[_0x72ec('0x1d')]('User,\x20%s,\x20%s',_0x5b0dbb,_0x59b9b1);_0x252a9b(_0x59b9b1);});});}function respondWithStatusCode(_0x32f992,_0x14a9f6){_0x14a9f6=_0x14a9f6||0xcc;return function(_0x3d41e9){if(_0x3d41e9){return _0x32f992[_0x72ec('0x21')](_0x14a9f6);}return _0x32f992[_0x72ec('0x22')](_0x14a9f6)[_0x72ec('0x23')]();};}function respondWithResult(_0x5c2683,_0x11d625){_0x11d625=_0x11d625||0xc8;return function(_0xb0ae6e){if(_0xb0ae6e){return _0x5c2683[_0x72ec('0x22')](_0x11d625)[_0x72ec('0x24')](_0xb0ae6e);}};}function respondWithFilteredResult(_0x1e49a1,_0x196f3f){return function(_0x420c41){if(_0x420c41){var _0x4b9206=typeof _0x196f3f[_0x72ec('0x25')]==='undefined'&&typeof _0x196f3f[_0x72ec('0x26')]===_0x72ec('0x27');var _0xcc648=_0x420c41['count'];var _0x55ff6e=_0x4b9206?0x0:_0x196f3f[_0x72ec('0x25')];var _0x1d093b=_0x4b9206?_0x420c41[_0x72ec('0x28')]:_0x196f3f[_0x72ec('0x25')]+_0x196f3f[_0x72ec('0x26')];var _0x548cc3;if(_0x1d093b>=_0xcc648){_0x1d093b=_0xcc648;_0x548cc3=0xc8;}else{_0x548cc3=0xce;}_0x1e49a1[_0x72ec('0x22')](_0x548cc3);return _0x1e49a1[_0x72ec('0x29')](_0x72ec('0x2a'),_0x55ff6e+'-'+_0x1d093b+'/'+_0xcc648)['json'](_0x420c41);}return null;};}function saveUpdates(_0x221bc8){return function(_0x4e81ac){if(_0x4e81ac){return _0x4e81ac[_0x72ec('0x2b')](_0x221bc8)[_0x72ec('0x16')](function(_0x12bc08){if(_0x12bc08['role']===_0x72ec('0x2c')){socket[_0x72ec('0x2d')](_0x72ec('0x2e')+_0x12bc08['id'],_0x12bc08);}return _0x12bc08;});}return null;};}function removeEntity(_0x1a594a){return function(_0x48e7ef){if(_0x48e7ef){return _0x48e7ef['destroy']()[_0x72ec('0x16')](function(){var _0x27e34a=_0x48e7ef[_0x72ec('0x2f')]({'plain':!![]});if(_0x27e34a[_0x72ec('0x30')]===_0x72ec('0x31'))return;var _0x1d1f24=[{'name':_0x72ec('0x32'),'value':_0x72ec('0x33'),'ignore':!![]},{'name':_0x72ec('0x34'),'value':_0x72ec('0x2c'),'ignore':![]},{'name':_0x72ec('0x35'),'value':'telephone','ignore':![]}];var _0x51ea93=_(_0x1d1f24)['filter']('ignore')['map']('value')[_0x72ec('0x36')]();if(_[_0x72ec('0x37')](_0x51ea93,_0x27e34a[_0x72ec('0x30')])){return;}var _0x4a7fa4=_[_0x72ec('0x38')](_0x1d1f24,[_0x72ec('0x36'),_0x27e34a[_0x72ec('0x30')]])['name'];return db['UserProfileResource'][_0x72ec('0x39')]({'where':{'type':_0x4a7fa4,'resourceId':_0x27e34a['id']}})['then'](function(){return _0x48e7ef;});})[_0x72ec('0x16')](function(){_0x1a594a[_0x72ec('0x22')](0xcc)[_0x72ec('0x23')]();});}};}function handleEntityNotFound(_0x60cdeb){return function(_0x30eb59){if(!_0x30eb59){_0x60cdeb[_0x72ec('0x21')](0x194);}return _0x30eb59;};}function handleError(_0x1a7d3c,_0x1b5ba4){_0x1b5ba4=_0x1b5ba4||0x1f4;return function(_0x5e9ea1){logger[_0x72ec('0x1d')](_0x5e9ea1['stack']);if(_0x5e9ea1[_0x72ec('0x3a')]){delete _0x5e9ea1['name'];}_0x1a7d3c[_0x72ec('0x22')](_0x1b5ba4)['send'](_0x5e9ea1);};}exports[_0x72ec('0x3b')]=function(_0x45a790,_0x8ae126){var _0x4b0021={},_0x268263={'count':0x0,'rows':[]};var _0x16dea2=_(db[_0x72ec('0x3c')]['rawAttributes'])[_0x72ec('0x3d')](function(_0x17a570){return{'name':_0x17a570[_0x72ec('0x3e')],'type':_0x17a570[_0x72ec('0x3f')][_0x72ec('0x40')]};})['filter'](function(_0x147f12){return!_[_0x72ec('0x37')]([_0x72ec('0x41'),_0x72ec('0x42')],_0x147f12[_0x72ec('0x3a')]);})[_0x72ec('0x36')]();_0x4b0021=qs[_0x72ec('0x43')](_0x16dea2,_0x45a790);var _0x45226b={'where':_0x4b0021['where']};return db[_0x72ec('0x3c')][_0x72ec('0x28')](_0x45226b)[_0x72ec('0x16')](function(_0x3a9b82){_0x268263[_0x72ec('0x28')]=_0x3a9b82;if(_0x45a790[_0x72ec('0x44')][_0x72ec('0x45')]){_0x4b0021[_0x72ec('0x46')]=[{'all':!![]}];}if(_0x45a790[_0x72ec('0x44')]['userSetting']==='true'){_0x4b0021[_0x72ec('0x46')]=[{'model':db[_0x72ec('0x47')],'as':_0x72ec('0x48')}];}if(!_['includes'](_0x4b0021[_0x72ec('0x49')],'id')){_0x4b0021[_0x72ec('0x49')]['push']('id');}return db[_0x72ec('0x3c')][_0x72ec('0x4a')](_0x4b0021);})[_0x72ec('0x16')](function(_0x7146ce){_0x268263[_0x72ec('0x4b')]=_0x7146ce;if(_0x45a790['query'][_0x72ec('0x4c')]==='true'){var _0x1a7c5a=[];for(var _0x5a83a9=0x0;_0x5a83a9<_0x268263['rows']['length'];_0x5a83a9++){_0x1a7c5a[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x4e'),_0x268263[_0x72ec('0x4b')][_0x5a83a9]['dataValues']));_0x1a7c5a[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x4f'),_0x268263['rows'][_0x5a83a9][_0x72ec('0x50')]));_0x1a7c5a[_0x72ec('0x4d')](get_open_tabs('fax',_0x268263['rows'][_0x5a83a9][_0x72ec('0x50')]));_0x1a7c5a[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x51'),_0x268263[_0x72ec('0x4b')][_0x5a83a9][_0x72ec('0x50')]));_0x1a7c5a[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x52'),_0x268263[_0x72ec('0x4b')][_0x5a83a9][_0x72ec('0x50')]));_0x1a7c5a[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x53'),_0x268263[_0x72ec('0x4b')][_0x5a83a9][_0x72ec('0x50')]));}return Promise[_0x72ec('0x54')](_0x1a7c5a)[_0x72ec('0x16')](function(){return _0x268263;});}else{return _0x268263;}})[_0x72ec('0x16')](respondWithFilteredResult(_0x8ae126,_0x4b0021))[_0x72ec('0x55')](handleError(_0x8ae126,null));};exports[_0x72ec('0x56')]=function(_0x1df780,_0x58f846){var _0x3eb906={'raw':![],'where':{'id':_0x1df780[_0x72ec('0x57')]['id']}},_0x3c5046={};_0x3c5046[_0x72ec('0x58')]=_[_0x72ec('0x59')](_[_0x72ec('0x5a')](db[_0x72ec('0x3c')]['rawAttributes']),[_0x72ec('0x41'),_0x72ec('0x42')]);_0x3c5046[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x1df780['query']);_0x3c5046[_0x72ec('0x5b')]=_['intersection'](_0x3c5046[_0x72ec('0x58')],_0x3c5046['query']);_0x3eb906[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x3c5046[_0x72ec('0x58')],qs['fields'](_0x1df780[_0x72ec('0x44')]['fields']));_0x3eb906[_0x72ec('0x49')]=_0x3eb906[_0x72ec('0x49')]['length']?_0x3eb906['attributes']:_0x3c5046['model'];if(_0x1df780['query'][_0x72ec('0x45')]){_0x3eb906[_0x72ec('0x46')]=[{'all':!![]}];}if(_0x1df780[_0x72ec('0x44')][_0x72ec('0x48')]===_0x72ec('0x5d')){_0x3eb906['include']=[{'model':db[_0x72ec('0x47')],'as':_0x72ec('0x48')}];}_0x3eb906=_[_0x72ec('0x5e')]({},_0x3eb906,_0x1df780[_0x72ec('0x5f')]);if(!_[_0x72ec('0x37')](_0x3eb906[_0x72ec('0x49')],'id')){_0x3eb906[_0x72ec('0x49')][_0x72ec('0x4d')]('id');}return db[_0x72ec('0x3c')]['find'](_0x3eb906)['then'](handleEntityNotFound(_0x58f846,null))[_0x72ec('0x16')](function(_0x4733cf){var _0x2f1888=[];values=_0x4733cf;if(_0x1df780['query'][_0x72ec('0x4c')]===_0x72ec('0x5d')){_0x2f1888['push'](get_open_tabs(_0x72ec('0x4e'),_0x4733cf['dataValues']));_0x2f1888[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x4f'),_0x4733cf[_0x72ec('0x50')]));_0x2f1888[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x52'),_0x4733cf[_0x72ec('0x50')]));_0x2f1888['push'](get_open_tabs(_0x72ec('0x53'),_0x4733cf[_0x72ec('0x50')]));_0x2f1888[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x60'),_0x4733cf['dataValues']));_0x2f1888['push'](get_open_tabs('mail',_0x4733cf['dataValues']));return Promise[_0x72ec('0x54')](_0x2f1888);}else{return values;}})['then'](function(){return values;})[_0x72ec('0x16')](respondWithResult(_0x58f846,null))[_0x72ec('0x55')](handleError(_0x58f846,null));};exports['update']=function(_0x4ee127,_0xaa1bc0){if(_0x4ee127[_0x72ec('0x61')]['id']){delete _0x4ee127[_0x72ec('0x61')]['id'];}delete _0x4ee127[_0x72ec('0x61')][_0x72ec('0x30')];return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x4ee127[_0x72ec('0x57')]['id']}})['then'](handleEntityNotFound(_0xaa1bc0,null))[_0x72ec('0x16')](saveUpdates(_0x4ee127[_0x72ec('0x61')],null))[_0x72ec('0x16')](respondWithResult(_0xaa1bc0,null))[_0x72ec('0x55')](handleError(_0xaa1bc0,null));};exports[_0x72ec('0x62')]=function(_0x241356,_0xf1b65d){return db[_0x72ec('0x3c')]['describe']()['then'](respondWithResult(_0xf1b65d,null))[_0x72ec('0x55')](handleError(_0xf1b65d,null));};exports[_0x72ec('0x63')]=function(_0x188da8,_0x5db21c){return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x188da8[_0x72ec('0x57')]['id']}})['then'](handleEntityNotFound(_0x5db21c,null))['then'](function(_0x2b44db){if(_0x2b44db){return _0x2b44db[_0x72ec('0x63')](_0x188da8[_0x72ec('0x61')][_0x72ec('0x64')],_[_0x72ec('0x65')](_0x188da8['body'],[_0x72ec('0x64'),'id'])||{});}})['then'](respondWithResult(_0x5db21c,null))[_0x72ec('0x55')](handleError(_0x5db21c,null));};function validateUser(_0x371324){return new Promise(function(_0x2a5276,_0x53b7d7){if(_0x371324[_0x72ec('0x66')])return _0x2a5276(_0x371324);return db['Setting']['findById'](0x1)[_0x72ec('0x16')](function(_0x1295c1){if(_0x1295c1[_0x72ec('0x67')])authService[_0x72ec('0x68')](_0x371324[_0x72ec('0x41')]);db[_0x72ec('0x3c')][_0x72ec('0x69')](_0x72ec('0x66'))[_0x72ec('0x16')](function(_0x211847){if(_[_0x72ec('0x6a')](_0x211847)){_0x371324[_0x72ec('0x66')]=_0x1295c1[_0x72ec('0x6b')]||0x1;return;}if(_['isNil'](_0x1295c1[_0x72ec('0x6b')])||_0x1295c1[_0x72ec('0x6b')]===_0x211847){_0x371324[_0x72ec('0x66')]=_0x211847+0x1;return;}if(_0x1295c1[_0x72ec('0x6b')]>_0x211847){_0x371324[_0x72ec('0x66')]=_0x1295c1[_0x72ec('0x6b')];return;}return db['sequelize']['query'](_0x72ec('0x6c'),{'type':db[_0x72ec('0x6d')][_0x72ec('0x6e')]['SELECT']})[_0x72ec('0x16')](function(_0x398fdd){if(_0x398fdd&&_0x398fdd[_0x72ec('0x6f')]){for(var _0x7798c9=0x0,_0xea468a=_0x398fdd[_0x72ec('0x6f')];_0x7798c9<_0xea468a&&_[_0x72ec('0x6a')](_0x371324['internal']);_0x7798c9++){if(_0x1295c1[_0x72ec('0x6b')]<=_0x398fdd[_0x7798c9][_0x72ec('0x70')]){_0x371324[_0x72ec('0x66')]=_0x398fdd[_0x7798c9][_0x72ec('0x70')];}else if(_0x1295c1['min_internal']>_0x398fdd[_0x7798c9][_0x72ec('0x70')]&&_0x1295c1[_0x72ec('0x6b')]<=_0x398fdd[_0x7798c9]['to']){_0x371324[_0x72ec('0x66')]=_0x1295c1['min_internal'];}}}if(_['isNil'](_0x371324[_0x72ec('0x66')])){_0x371324[_0x72ec('0x66')]=_0x211847+0x1;}return _0x2a5276(_0x371324);});});})['catch'](function(_0x445e8e){_0x53b7d7(_0x445e8e);});});}function updateUser(_0x1de74f){return new Promise(function(_0x504a32,_0x5c14a7){try{if(_0x1de74f[_0x72ec('0x71')]){_0x1de74f[_0x72ec('0x72')]=_0x1de74f[_0x72ec('0x66')];_0x1de74f['VoiceMail']={'mailbox':_0x1de74f[_0x72ec('0x66')],'password':_0x1de74f[_0x72ec('0x41')],'fullname':_0x1de74f[_0x72ec('0x73')],'email':_0x1de74f[_0x72ec('0x74')]};}if(_0x1de74f['role']===_0x72ec('0x2c')){if(!_0x1de74f[_0x72ec('0x75')])_0x1de74f[_0x72ec('0x75')]=['101',_0x72ec('0x76'),_0x72ec('0x77'),_0x72ec('0x78'),_0x72ec('0x79'),_0x72ec('0x7a'),_0x72ec('0x7b'),_0x72ec('0x7c'),_0x72ec('0x7d'),'108','109',_0x72ec('0x7e'),_0x72ec('0x7f'),_0x72ec('0x80'),_0x72ec('0x81')];}_0x504a32(_0x1de74f);}catch(_0x1d8cdd){_0x5c14a7(_0x1d8cdd);}});}exports[_0x72ec('0x82')]=function(_0x3e0802,_0x1ea3c4){if(_0x3e0802[_0x72ec('0x33')][_0x72ec('0x30')]===_0x72ec('0x2c'))throw new Error(_0x72ec('0x83'));if(_0x3e0802[_0x72ec('0x61')][_0x72ec('0x30')]===_0x72ec('0x33')&&_0x3e0802[_0x72ec('0x33')][_0x72ec('0x30')]!==_0x72ec('0x31')){throw new Error(_0x72ec('0x84'));}if(_0x3e0802['body'][_0x72ec('0x30')]===_0x72ec('0x31')&&_0x3e0802[_0x72ec('0x33')][_0x72ec('0x30')]!==_0x72ec('0x31')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x3e0802[_0x72ec('0x61')]])[_0x72ec('0x16')](function(){return validateUser(_0x3e0802[_0x72ec('0x61')]);})[_0x72ec('0x16')](function(_0x1611f2){return updateUser(_0x1611f2)[_0x72ec('0x16')](function(_0x39ff36){if(_0x39ff36[_0x72ec('0x30')]===_0x72ec('0x31')){_0x39ff36[_0x72ec('0x85')]=_0x3e0802[_0x72ec('0x33')][_0x72ec('0x85')];delete _0x39ff36[_0x72ec('0x86')];}return _0x39ff36;});})[_0x72ec('0x16')](function(_0x35aea3){return db[_0x72ec('0x3c')][_0x72ec('0x82')](_0x35aea3,{'include':[{'model':db[_0x72ec('0x87')],'as':_0x72ec('0x87')}]});})['then'](function(_0x4167a9){if(_0x3e0802[_0x72ec('0x61')][_0x72ec('0x30')]==='user')return _0x4167a9;if(_0x3e0802[_0x72ec('0x33')][_0x72ec('0x30')]!==_0x72ec('0x33'))return _0x4167a9;return db[_0x72ec('0x88')]['find']({'where':{'name':_0x4167a9['role']===_0x72ec('0x2c')?'Agents':_0x72ec('0x35'),'userProfileId':_0x3e0802[_0x72ec('0x33')]['userProfileId']},'raw':!![]})['then'](function(_0x3040f1){if(!_0x3040f1||_0x3040f1[_0x72ec('0x89')]!=0x0)return _0x4167a9;return db[_0x72ec('0x8a')][_0x72ec('0x82')]({'name':_0x4167a9[_0x72ec('0x3a')],'resourceId':_0x4167a9['id'],'type':_0x3040f1['name'],'sectionId':_0x3040f1['id']},{})[_0x72ec('0x16')](function(){return _0x4167a9;});})[_0x72ec('0x55')](function(_0x4a2b03){logger[_0x72ec('0x1d')](_0x72ec('0x8b'),_0x4a2b03);throw _0x4a2b03;});})[_0x72ec('0x16')](respondWithResult(_0x1ea3c4,0xc9))[_0x72ec('0x55')](handleError(_0x1ea3c4,null));};exports[_0x72ec('0x8c')]=function(_0x3072a8,_0x180d34){var _0x534c4f=_0x3072a8[_0x72ec('0x61')];var _0x2c1467=[];if(_0x3072a8[_0x72ec('0x33')]['role']===_0x72ec('0x2c'))throw new Error(_0x72ec('0x83'));if(_[_0x72ec('0x8d')](_0x534c4f,[_0x72ec('0x30'),_0x72ec('0x33')])&&_0x3072a8[_0x72ec('0x33')][_0x72ec('0x30')]!==_0x72ec('0x31')){throw new Error(_0x72ec('0x84'));}if(_[_0x72ec('0x8d')](_0x534c4f,[_0x72ec('0x30'),'admin'])&&_0x3072a8[_0x72ec('0x33')]['role']!==_0x72ec('0x31')){throw new Error(_0x72ec('0x8e'));}return licenseUtil[_0x72ec('0x8f')](_0x534c4f)['then'](function(){return validateUser(_0x534c4f[0x0]);})['then'](function(){for(var _0x5d2bfd=0x1;_0x5d2bfd<_0x534c4f[_0x72ec('0x6f')];_0x5d2bfd++){var _0x52a1d6=_0x534c4f[_0x5d2bfd-0x1][_0x72ec('0x66')];if(!_0x534c4f[_0x5d2bfd][_0x72ec('0x66')])_0x534c4f[_0x5d2bfd][_0x72ec('0x66')]=_0x52a1d6+0x1;_0x2c1467[_0x72ec('0x4d')](validateUser(_0x534c4f[_0x5d2bfd]));}return Promise[_0x72ec('0x54')](_0x2c1467);})[_0x72ec('0x16')](function(){_0x2c1467=[];for(var _0x3f53ad=0x0;_0x3f53ad<_0x534c4f[_0x72ec('0x6f')];_0x3f53ad++){_0x2c1467[_0x72ec('0x4d')](updateUser(_0x534c4f[_0x3f53ad]));}return Promise['all'](_0x2c1467);})[_0x72ec('0x16')](function(){_0x2c1467=_0x534c4f['map'](function(_0x22a608){return db[_0x72ec('0x3c')]['create'](_0x22a608,{'include':[{'model':db[_0x72ec('0x87')],'as':'VoiceMail'}]})[_0x72ec('0x16')](function(_0x30c6d3){_0x22a608['id']=_0x30c6d3['id'];return _0x22a608;});});return Promise[_0x72ec('0x54')](_0x2c1467);})[_0x72ec('0x16')](function(_0xfd8815){if(_0x3072a8[_0x72ec('0x61')]['role']===_0x72ec('0x33'))return _0xfd8815;if(_0x3072a8[_0x72ec('0x33')]['role']!==_0x72ec('0x33'))return _0xfd8815;var _0xbaa85c=_[_0x72ec('0x8d')](_0xfd8815,function(_0x224db1){return _0x224db1[_0x72ec('0x30')]==='agent'||_0x224db1[_0x72ec('0x30')]==='telephone';});if(!_0xbaa85c)return _0xfd8815;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x72ec('0x34'),_0x72ec('0x35')]},'userProfileId':_0x3072a8['user'][_0x72ec('0x86')]},'raw':!![]})[_0x72ec('0x16')](function(_0x1def19){if(_[_0x72ec('0x90')](_0x1def19)||!_['some'](_0x1def19,['autoAssociation',0x0]))return _0xfd8815;_0x2c1467=[];var _0x111d8f=_(_0x1def19)[_0x72ec('0x3d')](function(_0x2a3d62){if(_0x2a3d62[_0x72ec('0x89')]===0x1)return;return _0x2a3d62['name']===_0x72ec('0x34')?'agent':_0x72ec('0x91');})[_0x72ec('0x92')]()[_0x72ec('0x36')]();for(var _0x4dcf76=0x0;_0x4dcf76<_0xfd8815['length'];_0x4dcf76++){if(!_[_0x72ec('0x37')](_0x111d8f,_0xfd8815[_0x4dcf76][_0x72ec('0x30')]))return;var _0xbeb0a9=_0xfd8815[_0x4dcf76][_0x72ec('0x30')]==='agent'?_0x72ec('0x34'):'Telephones';_0x2c1467[_0x72ec('0x4d')](db['UserProfileResource'][_0x72ec('0x82')]({'name':_0xfd8815[_0x4dcf76][_0x72ec('0x3a')],'resourceId':_0xfd8815[_0x4dcf76]['id'],'type':_0xbeb0a9,'sectionId':_[_0x72ec('0x38')](_0x1def19,[_0x72ec('0x3a'),_0xbeb0a9])['id']},{}));}return Promise[_0x72ec('0x54')](_0x2c1467);});})[_0x72ec('0x16')](respondWithResult(_0x180d34,0xc9))[_0x72ec('0x55')](handleError(_0x180d34,null));};exports[_0x72ec('0x93')]=function(_0x22b7ae,_0x544597){if(_0x22b7ae['body']['id']){delete _0x22b7ae[_0x72ec('0x61')]['id'];}return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x22b7ae[_0x72ec('0x57')]['id']}})['then'](function(_0x5678dc){if(!_0x5678dc)return null;if(_0x5678dc['id']===_0x22b7ae['user']['id']){if(!_0x22b7ae[_0x72ec('0x61')][_0x72ec('0x94')]||!_0x22b7ae[_0x72ec('0x61')]['newPassword']){throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))](_0x72ec('0x97'));}if(!_0x5678dc[_0x72ec('0x98')](_0x22b7ae['body'][_0x72ec('0x94')])){throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))]('Wrong\x20credentials');}if(_0x22b7ae['body'][_0x72ec('0x94')]===_0x22b7ae['body']['newPassword']){throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))](_0x72ec('0x99'));}}else if(_0x22b7ae[_0x72ec('0x33')][_0x72ec('0x30')]===_0x72ec('0x31')){if(!_0x22b7ae['body'][_0x72ec('0x9a')]){throw new db['Sequelize'][(_0x72ec('0x96'))](_0x72ec('0x9b'));}}else if(_0x22b7ae[_0x72ec('0x33')]['role']===_0x72ec('0x33')){if(!_0x22b7ae[_0x72ec('0x61')][_0x72ec('0x9a')]){throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5678dc[_0x72ec('0x30')]!==_0x72ec('0x2c')){throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))](_0x72ec('0x83'));}}else{throw new db[(_0x72ec('0x95'))]['ValidationError'](_0x72ec('0x83'));}return _0x5678dc;})[_0x72ec('0x16')](handleEntityNotFound(_0x544597,null))[_0x72ec('0x16')](function(_0x1a21f1){return db[_0x72ec('0x9c')][_0x72ec('0x9d')]({'attributes':['id',_0x72ec('0x67'),_0x72ec('0x9e'),_0x72ec('0x9f')]})[_0x72ec('0x16')](function(_0x190afa){if(_0x190afa['securePassword'])authService[_0x72ec('0x68')](_0x22b7ae[_0x72ec('0x61')]['newPassword']);if(!_0x190afa[_0x72ec('0x9e')]||!_0x1a21f1[_0x72ec('0xa0')])return _0x1a21f1;authService['validatePasswordHistory'](_0x22b7ae[_0x72ec('0x61')][_0x72ec('0x9a')],_0x1a21f1[_0x72ec('0xa0')],_0x190afa[_0x72ec('0x9f')]);return _0x1a21f1;})[_0x72ec('0x16')](saveUpdates({'password':_0x22b7ae['body'][_0x72ec('0x9a')],'passwordResetAt':_0x22b7ae['user']['id']==_0x22b7ae['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x22b7ae[_0x72ec('0x61')][_0x72ec('0x9a')],_0x1a21f1[_0x72ec('0xa0')])},null));})[_0x72ec('0x16')](respondWithResult(_0x544597,null))[_0x72ec('0x55')](handleError(_0x544597,null));};exports[_0x72ec('0xa1')]=function(_0x47beec,_0x54e8cd){var _0x19c7de=_0x47beec[_0x72ec('0x61')][_0x72ec('0xa2')];return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x47beec[_0x72ec('0x57')]['id']},'attributes':['id',_0x72ec('0x3a'),'role',_0x72ec('0xa3'),_0x72ec('0xa4'),'voicePause',_0x72ec('0xa5')]})[_0x72ec('0x16')](handleEntityNotFound(_0x54e8cd,null))['then'](function(_0xd67a83){if(_0xd67a83){if(!utils[_0x72ec('0xa6')](_0x19c7de)){throw new db['Sequelize'][(_0x72ec('0x96'))](_0x72ec('0xa7'));}return _0xd67a83[_0x72ec('0xa8')+_[_0x72ec('0xa9')](_0x19c7de[_0x72ec('0xaa')]())+_0x72ec('0xab')](_0x47beec[_0x72ec('0x61')][_0x72ec('0x64')],{'penalty':_0x47beec[_0x72ec('0x61')][_0x72ec('0xac')]||0x0})[_0x72ec('0xad')](function(_0x4bb366){for(var _0x1777bc=0x0;_0x1777bc<_0x47beec['body'][_0x72ec('0x64')][_0x72ec('0x6f')];_0x1777bc+=0x1){var _0x2af44c={'UserId':Number(_0x47beec[_0x72ec('0x57')]['id'])};_0x2af44c[_['capitalize'](_0x19c7de[_0x72ec('0xaa')]())+_0x72ec('0xae')]=Number(_0x47beec[_0x72ec('0x61')]['ids'][_0x1777bc]);socket[_0x72ec('0x2d')](_0x72ec('0x33')+_[_0x72ec('0xa9')](_0x19c7de['toLowerCase']())+_0x72ec('0xaf'),_0x2af44c);}return _0x4bb366;})[_0x72ec('0x16')](function(){if(_0x19c7de===_0x72ec('0xb0')){return db[_0x72ec('0xb1')][_0x72ec('0x4a')]({'where':{'id':_0x47beec['body'][_0x72ec('0x64')]||[]},'raw':!![],'attributes':['id',_0x72ec('0x3a')]});}})[_0x72ec('0x16')](function(_0x5a44a9){var _0x603a1=_0xd67a83[_0x72ec('0x2f')]({'plain':!![]});var _0x275b69=[];if(_0x19c7de===_0x72ec('0xb0')&&_0x603a1['role']===_0x72ec('0x2c')&&_0x603a1['online']){for(let _0x313df6=0x0;_0x313df6<_0x5a44a9[_0x72ec('0x6f')];_0x313df6+=0x1){_0x275b69[_0x72ec('0x4d')]({'membername':_0x603a1['name'],'UserId':_0x603a1['id'],'queue_name':_0x5a44a9[_0x313df6]['name'],'VoiceQueueId':_0x5a44a9[_0x313df6]['id'],'interface':_['isNil'](_0x603a1[_0x72ec('0xa5')])?util[_0x72ec('0xb2')](_0x72ec('0xb3'),_0x603a1['name']):_0x603a1[_0x72ec('0xa5')],'paused':_0x603a1['voicePause']||![],'penalty':_0x47beec[_0x72ec('0x61')]['penalty']||0x0});}return Promise[_0x72ec('0x54')](_0x275b69[_0x72ec('0x3d')](function(_0x12ace5){return db[_0x72ec('0xb4')]['upsert'](_0x12ace5);}));}return _0xd67a83;});}})[_0x72ec('0x16')](respondWithStatusCode(_0x54e8cd,null))[_0x72ec('0x55')](handleError(_0x54e8cd,null));};exports['removeQueues']=function(_0x15ba74,_0x3bf375){var _0x18cc7,_0x5812e7;return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x15ba74['params']['id']},'attributes':['id',_0x72ec('0x3a'),_0x72ec('0x30')]})[_0x72ec('0x16')](handleEntityNotFound(_0x3bf375,null))['then'](function(_0xad045e){if(_0xad045e){_0x18cc7=_0xad045e;if(!_0x15ba74[_0x72ec('0x44')][_0x72ec('0xa2')]||!utils[_0x72ec('0xa6')](_0x15ba74['query'][_0x72ec('0xa2')])){throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))](_0x72ec('0xa7'));}return _0xad045e['remove'+_[_0x72ec('0xa9')](_0x15ba74['query'][_0x72ec('0xa2')][_0x72ec('0xaa')]())+_0x72ec('0xab')](_0x15ba74['query'][_0x72ec('0x64')]);}})[_0x72ec('0x16')](function(_0x4963ac){if(_[_0x72ec('0xb5')](_0x15ba74[_0x72ec('0x44')][_0x72ec('0x64')])){for(var _0x16771b=0x0;_0x16771b<_0x15ba74[_0x72ec('0x44')][_0x72ec('0x64')][_0x72ec('0x6f')];_0x16771b+=0x1){_0x5812e7={'UserId':Number(_0x15ba74[_0x72ec('0x57')]['id'])};_0x5812e7[_[_0x72ec('0xa9')](_0x15ba74[_0x72ec('0x44')][_0x72ec('0xa2')][_0x72ec('0xaa')]())+_0x72ec('0xae')]=Number(_0x15ba74[_0x72ec('0x44')][_0x72ec('0x64')][_0x16771b]);socket[_0x72ec('0x2d')](_0x72ec('0x33')+_['capitalize'](_0x15ba74[_0x72ec('0x44')][_0x72ec('0xa2')][_0x72ec('0xaa')]())+'Queue:remove',_0x5812e7);}}else{_0x5812e7={'UserId':Number(_0x15ba74[_0x72ec('0x57')]['id'])};_0x5812e7[_[_0x72ec('0xa9')](_0x15ba74[_0x72ec('0x44')][_0x72ec('0xa2')][_0x72ec('0xaa')]())+'QueueId']=Number(_0x15ba74[_0x72ec('0x44')]['ids']);socket['emit'](_0x72ec('0x33')+_[_0x72ec('0xa9')](_0x15ba74[_0x72ec('0x44')][_0x72ec('0xa2')][_0x72ec('0xaa')]())+_0x72ec('0xb6'),_0x5812e7);}return _0x4963ac;})[_0x72ec('0x16')](function(){if(_0x15ba74[_0x72ec('0x44')][_0x72ec('0xa2')]===_0x72ec('0xb0')){return db[_0x72ec('0xb4')][_0x72ec('0x39')]({'where':{'UserId':_0x15ba74[_0x72ec('0x57')]['id'],'VoiceQueueId':_0x15ba74[_0x72ec('0x44')][_0x72ec('0x64')]},'individualHooks':!![]})[_0x72ec('0x16')](function(){return _0x18cc7;});}return _0x18cc7;})[_0x72ec('0x16')](respondWithStatusCode(_0x3bf375,null))['catch'](handleError(_0x3bf375,null));};exports['addAvatar']=function(_0x9256c2,_0x570b50){_0x9256c2[_0x72ec('0x61')][_0x72ec('0xb7')]=_0x9256c2[_0x72ec('0xb8')]['filename'];return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x9256c2['params']['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x570b50,null))[_0x72ec('0x16')](saveUpdates(_0x9256c2['body'],null))[_0x72ec('0x16')](respondWithResult(_0x570b50,null))[_0x72ec('0x55')](handleError(_0x570b50,null));};exports[_0x72ec('0xb9')]=function(_0x1a3b01,_0x751b5){var _0x5a7ac5=path[_0x72ec('0xba')](config[_0x72ec('0xbb')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x1a3b01['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x72ec('0x16')](handleEntityNotFound(_0x751b5,null))[_0x72ec('0x16')](function(_0x4f4eb8){if(_0x4f4eb8){if(_[_0x72ec('0x6a')](_0x4f4eb8[_0x72ec('0xb7')])){return _0x751b5[_0x72ec('0xbc')](_0x5a7ac5);}else{if(!fs['existsSync'](path['join'](config[_0x72ec('0xbb')],_0x72ec('0xbd'),_0x4f4eb8[_0x72ec('0xb7')]))){return _0x751b5[_0x72ec('0xbc')](_0x5a7ac5);}return _0x751b5[_0x72ec('0xbc')](path[_0x72ec('0xba')](config[_0x72ec('0xbb')],_0x72ec('0xbd'),_0x4f4eb8[_0x72ec('0xb7')]));}}})[_0x72ec('0x55')](handleError(_0x751b5,null));};exports['getOpenTabs']=function(_0x9948ca,_0x3a105f){return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x9948ca[_0x72ec('0x57')]['id']},'attributes':['id']})[_0x72ec('0x16')](handleEntityNotFound(_0x3a105f,null))[_0x72ec('0x16')](function(_0x1beb8f){var _0xed29b0=[];values=_0x1beb8f[_0x72ec('0x50')];_0xed29b0[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x4e'),_0x1beb8f[_0x72ec('0x50')]));_0xed29b0[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x4f'),_0x1beb8f[_0x72ec('0x50')]));_0xed29b0[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x52'),_0x1beb8f[_0x72ec('0x50')]));_0xed29b0[_0x72ec('0x4d')](get_open_tabs('whatsapp',_0x1beb8f['dataValues']));_0xed29b0[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x60'),_0x1beb8f[_0x72ec('0x50')]));_0xed29b0[_0x72ec('0x4d')](get_open_tabs(_0x72ec('0x51'),_0x1beb8f['dataValues']));return Promise[_0x72ec('0x54')](_0xed29b0);})[_0x72ec('0x16')](function(_0x290abd){if(_0x290abd){var _0x126993=_[_0x72ec('0x3d')](values[_0x72ec('0xbe')],function(_0x20a40b){return{'channel':'CHAT','id':_0x20a40b['id'],'createdAt':_0x20a40b[_0x72ec('0xbf')]};});var _0x4fefb3=_[_0x72ec('0x3d')](values[_0x72ec('0xc0')],function(_0x2918ad){return{'channel':_0x72ec('0xc1'),'id':_0x2918ad['id'],'createdAt':_0x2918ad[_0x72ec('0xbf')]};});var _0x3644f7=_['map'](values[_0x72ec('0xc2')],function(_0x5ddc5e){return{'channel':'OPENCHANNEL','id':_0x5ddc5e['id'],'createdAt':_0x5ddc5e['createdAt']};});var _0xec7193=_[_0x72ec('0x3d')](values[_0x72ec('0xc3')],function(_0x1e18d5){return{'channel':_0x72ec('0xc4'),'id':_0x1e18d5['id'],'createdAt':_0x1e18d5[_0x72ec('0xbf')]};});var _0x2baac9=_[_0x72ec('0x3d')](values['SmsOpenTabs'],function(_0x583019){return{'channel':'SMS','id':_0x583019['id'],'createdAt':_0x583019[_0x72ec('0xbf')]};});var _0x1db8b5=_[_0x72ec('0x3d')](values[_0x72ec('0xc5')],function(_0x17eb55){return{'channel':_0x72ec('0xc6'),'id':_0x17eb55['id'],'createdAt':_0x17eb55[_0x72ec('0xbf')]};});var _0x2b39c3=_[_0x72ec('0xc7')](_0x126993,_0x4fefb3,_0x3644f7,_0xec7193,_0x2baac9,_0x1db8b5);var _0xae8884={'count':_0x2b39c3[_0x72ec('0x6f')],'rows':_0x2b39c3};return _0xae8884;}else return null;})[_0x72ec('0x16')](respondWithResult(_0x3a105f,null))[_0x72ec('0x55')](handleError(_0x3a105f,null));};exports[_0x72ec('0xc8')]=function(_0x23e723,_0x26f8ee){var _0x1a364c={};var _0x467c9e={};var _0x5ce0ab;var _0x55789a;return db['User']['findOne']({'where':{'id':_0x23e723[_0x72ec('0x57')]['id']}})['then'](handleEntityNotFound(_0x26f8ee,null))['then'](function(_0x21a2f0){if(_0x21a2f0){_0x5ce0ab=_0x21a2f0;_0x467c9e[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_0x72ec('0xc9')]['rawAttributes']);_0x467c9e[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x23e723['query']);_0x467c9e[_0x72ec('0x5b')]=_['intersection'](_0x467c9e[_0x72ec('0x58')],_0x467c9e[_0x72ec('0x44')]);_0x1a364c['attributes']=_[_0x72ec('0x5c')](_0x467c9e[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x23e723['query']['fields']));_0x1a364c[_0x72ec('0x49')]=_0x1a364c[_0x72ec('0x49')][_0x72ec('0x6f')]?_0x1a364c[_0x72ec('0x49')]:_0x467c9e[_0x72ec('0x58')];_0x1a364c['order']=qs['sort'](_0x23e723[_0x72ec('0x44')]['sort']);_0x1a364c[_0x72ec('0xcb')]=qs['filters'](_['pick'](_0x23e723['query'],_0x467c9e[_0x72ec('0x5b')]));if(_0x23e723[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x1a364c[_0x72ec('0xcb')]=_['merge'](_0x1a364c[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x1a364c['attributes'],function(_0x3a804c){var _0x33c122={};_0x33c122[_0x3a804c]={'$like':'%'+_0x23e723[_0x72ec('0x44')]['filter']+'%'};return _0x33c122;})});}_0x1a364c=_[_0x72ec('0x5e')]({},_0x1a364c,_0x23e723['options']);return _0x5ce0ab['getContacts'](_0x1a364c);}})[_0x72ec('0x16')](function(_0x5a8ae2){if(_0x5a8ae2){_0x55789a=_0x5a8ae2['length'];if(_0x23e723['query'][_0x72ec('0xcd')]('includeAll')){_0x1a364c['include']=[{'model':db[_0x72ec('0xce')],'as':_0x72ec('0xcf'),'required':![]},{'model':db[_0x72ec('0xd0')],'as':_0x72ec('0xd1'),'attributes':['id',_0x72ec('0x3a'),_0x72ec('0xd2')],'where':_0x23e723[_0x72ec('0x44')]['tag']?{'id':_0x23e723[_0x72ec('0x44')][_0x72ec('0xd3')]}:undefined,'required':_0x23e723[_0x72ec('0x44')][_0x72ec('0xd3')]?!![]:![]}];}if(!_0x23e723['query']['hasOwnProperty'](_0x72ec('0xd4'))){_0x1a364c[_0x72ec('0x26')]=qs['limit'](_0x23e723[_0x72ec('0x44')][_0x72ec('0x26')]);_0x1a364c[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x23e723[_0x72ec('0x44')][_0x72ec('0x25')]);}return _0x5ce0ab[_0x72ec('0xc8')](_0x1a364c);}})['then'](function(_0x3040e2){if(_0x3040e2){return _0x3040e2?{'count':_0x55789a,'rows':_0x3040e2}:null;}})[_0x72ec('0x16')](respondWithResult(_0x26f8ee,null))[_0x72ec('0x55')](handleError(_0x26f8ee,null));};exports[_0x72ec('0xd5')]=function(_0x39da23,_0x35e26f){var _0x25bd46;var _0x3720a1={};var _0x536368;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x39da23[_0x72ec('0x57')]['id']},'attributes':['id',_0x72ec('0x3a'),'role']})[_0x72ec('0x16')](handleEntityNotFound(_0x35e26f,null))[_0x72ec('0x16')](function(_0x2f8777){if(!utils['isValidChannel'](_0x39da23[_0x72ec('0x44')][_0x72ec('0xa2')])){throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))]('Unknown\x20channel');}_0x25bd46=_0x2f8777;var _0x528aa2={};_0x528aa2[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_['capitalize'](_0x39da23[_0x72ec('0x44')][_0x72ec('0xa2')])+_0x72ec('0xd6')][_0x72ec('0xd7')]);_0x528aa2[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x39da23[_0x72ec('0x44')]);_0x528aa2[_0x72ec('0x5b')]=_['intersection'](_0x528aa2[_0x72ec('0x58')],_0x528aa2[_0x72ec('0x44')]);_0x3720a1[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x528aa2[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x39da23['query'][_0x72ec('0xca')]));_0x3720a1['attributes']=_0x3720a1[_0x72ec('0x49')][_0x72ec('0x6f')]?_0x3720a1[_0x72ec('0x49')]:_0x528aa2[_0x72ec('0x58')];_0x3720a1[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x39da23[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x3720a1[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x39da23[_0x72ec('0x44')],_0x528aa2[_0x72ec('0x5b')]));if(_0x39da23[_0x72ec('0x44')]['filter']){_0x3720a1['where']=_[_0x72ec('0x5e')](_0x3720a1[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x3720a1[_0x72ec('0x49')],function(_0x28989a){var _0x6a625d={};_0x6a625d[_0x28989a]={'$like':'%'+_0x39da23[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x6a625d;})});}_0x3720a1=_['merge']({},_0x3720a1,_0x39da23['options']);switch(_0x25bd46[_0x72ec('0x30')]){case _0x72ec('0x31'):return db[_[_0x72ec('0xa9')](_0x39da23[_0x72ec('0x44')][_0x72ec('0xa2')])+_0x72ec('0xd6')][_0x72ec('0x4a')](_0x3720a1);case _0x72ec('0x33'):case'agent':return _0x25bd46[_0x72ec('0x2f')+_[_0x72ec('0xa9')](_0x39da23[_0x72ec('0x44')][_0x72ec('0xa2')])+_0x72ec('0xab')](_0x3720a1);default:throw new db['Sequelize']['ValidationError']('Unknown\x20role');}})[_0x72ec('0x16')](function(_0x6ccb9a){_0x536368=_0x6ccb9a[_0x72ec('0x6f')];if(!_0x39da23[_0x72ec('0x44')][_0x72ec('0xcd')]('nolimit')){_0x3720a1[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x39da23['query'][_0x72ec('0x26')]);_0x3720a1[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x39da23[_0x72ec('0x44')][_0x72ec('0x25')]);}switch(_0x25bd46[_0x72ec('0x30')]){case _0x72ec('0x31'):return db[_[_0x72ec('0xa9')](_0x39da23[_0x72ec('0x44')][_0x72ec('0xa2')])+_0x72ec('0xd6')][_0x72ec('0x4a')](_0x3720a1);case _0x72ec('0x33'):case'agent':return _0x25bd46[_0x72ec('0x2f')+_[_0x72ec('0xa9')](_0x39da23['query'][_0x72ec('0xa2')])+'Queues'](_0x3720a1);}})['then'](function(_0x1727cd){return{'count':_0x536368,'rows':_0x1727cd};})[_0x72ec('0x16')](respondWithResult(_0x35e26f,null))['catch'](handleError(_0x35e26f,null));};exports['getVoiceQueuesRt']=function(_0x4310b1,_0x572fe7){var _0x25ba02={};var _0x14caef={};var _0x51f45a;var _0x3e0a71;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x4310b1['params']['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x572fe7,null))[_0x72ec('0x16')](function(_0x26b2af){if(_0x26b2af){_0x51f45a=_0x26b2af;_0x14caef[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db['UserVoiceQueueRt'][_0x72ec('0xd7')]);_0x14caef[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x4310b1[_0x72ec('0x44')]);_0x14caef['filters']=_['intersection'](_0x14caef[_0x72ec('0x58')],_0x14caef[_0x72ec('0x44')]);_0x25ba02[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x14caef[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x4310b1[_0x72ec('0x44')]['fields']));_0x25ba02[_0x72ec('0x49')]=_0x25ba02[_0x72ec('0x49')][_0x72ec('0x6f')]?_0x25ba02[_0x72ec('0x49')]:_0x14caef[_0x72ec('0x58')];_0x25ba02[_0x72ec('0xd8')]=qs['sort'](_0x4310b1[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x25ba02['where']=qs['filters'](_[_0x72ec('0xda')](_0x4310b1['query'],_0x14caef['filters']));if(_0x4310b1['query'][_0x72ec('0xcc')]){_0x25ba02[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x25ba02['where'],{'$or':_[_0x72ec('0x3d')](_0x25ba02[_0x72ec('0x49')],function(_0x5bee04){var _0x3fdb66={};_0x3fdb66[_0x5bee04]={'$like':'%'+_0x4310b1[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x3fdb66;})});}_0x25ba02=_[_0x72ec('0x5e')]({},_0x25ba02,_0x4310b1[_0x72ec('0x5f')]);return _0x51f45a[_0x72ec('0xdb')](_0x25ba02);}})['then'](function(_0x10fc12){if(_0x10fc12){_0x3e0a71=_0x10fc12[_0x72ec('0x6f')];if(!_0x4310b1[_0x72ec('0x44')][_0x72ec('0xcd')]('nolimit')){_0x25ba02[_0x72ec('0x26')]=qs['limit'](_0x4310b1[_0x72ec('0x44')]['limit']);_0x25ba02['offset']=qs[_0x72ec('0x25')](_0x4310b1['query'][_0x72ec('0x25')]);}return _0x51f45a[_0x72ec('0xdb')](_0x25ba02);}})[_0x72ec('0x16')](function(_0x5c8eac){if(_0x5c8eac){return _0x5c8eac?{'count':_0x3e0a71,'rows':_0x5c8eac}:null;}})[_0x72ec('0x16')](respondWithResult(_0x572fe7,null))[_0x72ec('0x55')](handleError(_0x572fe7,null));};exports[_0x72ec('0xdc')]=function(_0x3e6b12,_0x1aa159){var _0x26c8a5={};var _0x397209={};var _0x4ac6eb;var _0xebbc0b;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x3e6b12[_0x72ec('0x57')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x1aa159,null))[_0x72ec('0x16')](function(_0x3d5f5d){if(_0x3d5f5d){_0x4ac6eb=_0x3d5f5d;_0x397209[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_0x72ec('0xdd')][_0x72ec('0xd7')]);_0x397209[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x3e6b12[_0x72ec('0x44')]);_0x397209[_0x72ec('0x5b')]=_['intersection'](_0x397209[_0x72ec('0x58')],_0x397209[_0x72ec('0x44')]);_0x26c8a5[_0x72ec('0x49')]=_['intersection'](_0x397209[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x3e6b12[_0x72ec('0x44')][_0x72ec('0xca')]));_0x26c8a5['attributes']=_0x26c8a5[_0x72ec('0x49')][_0x72ec('0x6f')]?_0x26c8a5[_0x72ec('0x49')]:_0x397209['model'];_0x26c8a5[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x3e6b12[_0x72ec('0x44')]['sort']);_0x26c8a5[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x3e6b12[_0x72ec('0x44')],_0x397209['filters']));if(_0x3e6b12[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x26c8a5[_0x72ec('0xcb')]=_['merge'](_0x26c8a5[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x26c8a5[_0x72ec('0x49')],function(_0x161115){var _0xfc3846={};_0xfc3846[_0x161115]={'$like':'%'+_0x3e6b12[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0xfc3846;})});}_0x26c8a5=_[_0x72ec('0x5e')]({},_0x26c8a5,_0x3e6b12['options']);return _0x4ac6eb[_0x72ec('0xdc')](_0x26c8a5);}})['then'](function(_0x48f2ec){if(_0x48f2ec){_0xebbc0b=_0x48f2ec[_0x72ec('0x6f')];if(!_0x3e6b12[_0x72ec('0x44')]['hasOwnProperty'](_0x72ec('0xd4'))){_0x26c8a5[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x3e6b12[_0x72ec('0x44')][_0x72ec('0x26')]);_0x26c8a5[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x3e6b12['query']['offset']);}return _0x4ac6eb[_0x72ec('0xdc')](_0x26c8a5);}})[_0x72ec('0x16')](function(_0x2605ed){if(_0x2605ed){return _0x2605ed?{'count':_0xebbc0b,'rows':_0x2605ed}:null;}})[_0x72ec('0x16')](respondWithResult(_0x1aa159,null))['catch'](handleError(_0x1aa159,null));};exports[_0x72ec('0xde')]=function(_0x202c03,_0x2725a9){var _0x2a47dc={'raw':!![],'where':{}};var _0x16997d={};var _0x215751={'count':0x0,'rows':[]};return db[_0x72ec('0x3c')]['findOne']({'where':{'id':_0x202c03[_0x72ec('0x57')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x2725a9,null))[_0x72ec('0x16')](function(_0x522bb8){if(_0x522bb8){_0x16997d[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db['VoiceRecording']['rawAttributes']);_0x16997d['query']=_[_0x72ec('0x5a')](_0x202c03[_0x72ec('0x44')]);_0x16997d[_0x72ec('0x5b')]=_[_0x72ec('0x5c')](_0x16997d[_0x72ec('0x58')],_0x16997d[_0x72ec('0x44')]);_0x2a47dc[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x16997d[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x202c03[_0x72ec('0x44')]['fields']));_0x2a47dc[_0x72ec('0x49')]=_0x2a47dc['attributes']['length']?_0x2a47dc[_0x72ec('0x49')]:_0x16997d['model'];if(!_0x202c03[_0x72ec('0x44')][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x2a47dc[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x202c03[_0x72ec('0x44')][_0x72ec('0x26')]);_0x2a47dc['offset']=qs['offset'](_0x202c03[_0x72ec('0x44')][_0x72ec('0x25')]);}_0x2a47dc['order']=qs['sort'](_0x202c03[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x2a47dc[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x202c03[_0x72ec('0x44')],_0x16997d['filters']));_0x2a47dc[_0x72ec('0xcb')][_0x72ec('0xdf')]=_0x522bb8['id'];if(_0x202c03[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x2a47dc['where']=_[_0x72ec('0x5e')](_0x2a47dc[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x2a47dc[_0x72ec('0x49')],function(_0xe78155){var _0x183786={};_0x183786[_0xe78155]={'$like':'%'+_0x202c03[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x183786;})});}_0x2a47dc=_['merge']({},_0x2a47dc,_0x202c03[_0x72ec('0x5f')]);return db['VoiceRecording'][_0x72ec('0x28')]({'where':_0x2a47dc[_0x72ec('0xcb')]})[_0x72ec('0x16')](function(_0x5bf186){_0x215751['count']=_0x5bf186;if(_0x202c03[_0x72ec('0x44')][_0x72ec('0x45')]){_0x2a47dc[_0x72ec('0x46')]=[{'all':!![]}];}return db[_0x72ec('0xe0')][_0x72ec('0x4a')](_0x2a47dc);})['then'](function(_0x4ac2b7){_0x215751[_0x72ec('0x4b')]=_0x4ac2b7;return _0x215751;});}})['then'](respondWithFilteredResult(_0x2725a9,_0x2a47dc))['catch'](handleError(_0x2725a9,null));};exports[_0x72ec('0xe1')]=function(_0x3b6fab,_0x141ead){var _0x2ef6de={'raw':!![],'where':{}};var _0x24c155={};var _0x279bb6={'count':0x0,'rows':[]};return db[_0x72ec('0x3c')]['findOne']({'where':{'id':_0x3b6fab[_0x72ec('0x57')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x141ead,null))[_0x72ec('0x16')](function(_0x2d5d8c){if(_0x2d5d8c){_0x24c155['model']=_[_0x72ec('0x5a')](db[_0x72ec('0xe2')][_0x72ec('0xd7')]);_0x24c155[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x3b6fab[_0x72ec('0x44')]);_0x24c155[_0x72ec('0x5b')]=_['intersection'](_0x24c155[_0x72ec('0x58')],_0x24c155['query']);_0x2ef6de['attributes']=_['intersection'](_0x24c155[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x3b6fab[_0x72ec('0x44')][_0x72ec('0xca')]));_0x2ef6de[_0x72ec('0x49')]=_0x2ef6de[_0x72ec('0x49')][_0x72ec('0x6f')]?_0x2ef6de[_0x72ec('0x49')]:_0x24c155['model'];if(!_0x3b6fab['query'][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x2ef6de[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x3b6fab[_0x72ec('0x44')][_0x72ec('0x26')]);_0x2ef6de[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x3b6fab['query'][_0x72ec('0x25')]);}_0x2ef6de[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x3b6fab[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x2ef6de[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x3b6fab['query'],_0x24c155[_0x72ec('0x5b')]));_0x2ef6de[_0x72ec('0xcb')][_0x72ec('0xdf')]=_0x2d5d8c['id'];if(_0x3b6fab[_0x72ec('0x44')]['filter']){_0x2ef6de['where']=_[_0x72ec('0x5e')](_0x2ef6de[_0x72ec('0xcb')],{'$or':_['map'](_0x2ef6de[_0x72ec('0x49')],function(_0x2dd76e){var _0x48b901={};_0x48b901[_0x2dd76e]={'$like':'%'+_0x3b6fab['query'][_0x72ec('0xcc')]+'%'};return _0x48b901;})});}_0x2ef6de=_['merge']({},_0x2ef6de,_0x3b6fab[_0x72ec('0x5f')]);return db[_0x72ec('0xe2')][_0x72ec('0x28')]({'where':_0x2ef6de[_0x72ec('0xcb')]})[_0x72ec('0x16')](function(_0x1fa488){_0x279bb6[_0x72ec('0x28')]=_0x1fa488;if(_0x3b6fab['query'][_0x72ec('0x45')]){_0x2ef6de['include']=[{'all':!![]}];}return db[_0x72ec('0xe2')][_0x72ec('0x4a')](_0x2ef6de);})[_0x72ec('0x16')](function(_0x22f4a7){_0x279bb6[_0x72ec('0x4b')]=_0x22f4a7;return _0x279bb6;});}})[_0x72ec('0x16')](respondWithFilteredResult(_0x141ead,_0x2ef6de))[_0x72ec('0x55')](handleError(_0x141ead,null));};exports['getChatInteractions']=function(_0x463a63,_0x19423f){var _0x18713d={};var _0x524f09={};var _0x2f6fee;var _0x484e6a;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x463a63[_0x72ec('0x57')]['id']}})['then'](handleEntityNotFound(_0x19423f,null))[_0x72ec('0x16')](function(_0x422243){if(_0x422243){_0x2f6fee=_0x422243;_0x524f09['model']=_['keys'](db[_0x72ec('0xe3')][_0x72ec('0xd7')]);_0x524f09[_0x72ec('0x44')]=_['keys'](_0x463a63['query']);_0x524f09['filters']=_[_0x72ec('0x5c')](_0x524f09[_0x72ec('0x58')],_0x524f09[_0x72ec('0x44')]);_0x18713d[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x524f09['model'],qs[_0x72ec('0xca')](_0x463a63['query'][_0x72ec('0xca')]));_0x18713d[_0x72ec('0x49')]=_0x18713d['attributes'][_0x72ec('0x6f')]?_0x18713d[_0x72ec('0x49')]:_0x524f09[_0x72ec('0x58')];_0x18713d[_0x72ec('0xd8')]=qs['sort'](_0x463a63[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x18713d[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x463a63[_0x72ec('0x44')],_0x524f09[_0x72ec('0x5b')]));if(_0x463a63['query'][_0x72ec('0xcc')]){_0x18713d[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x18713d['where'],{'$or':_[_0x72ec('0x3d')](_0x18713d[_0x72ec('0x49')],function(_0x2967fa){var _0x5b4bd3={};_0x5b4bd3[_0x2967fa]={'$like':'%'+_0x463a63[_0x72ec('0x44')]['filter']+'%'};return _0x5b4bd3;})});}_0x18713d=_[_0x72ec('0x5e')]({},_0x18713d,_0x463a63[_0x72ec('0x5f')]);return _0x2f6fee[_0x72ec('0xe4')](_0x18713d);}})[_0x72ec('0x16')](function(_0x5bb698){if(_0x5bb698){_0x484e6a=_0x5bb698[_0x72ec('0x6f')];if(!_0x463a63['query'][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x18713d[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x463a63[_0x72ec('0x44')][_0x72ec('0x26')]);_0x18713d[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x463a63[_0x72ec('0x44')][_0x72ec('0x25')]);}return _0x2f6fee[_0x72ec('0xe4')](_0x18713d);}})[_0x72ec('0x16')](function(_0x2866b9){if(_0x2866b9){return _0x2866b9?{'count':_0x484e6a,'rows':_0x2866b9}:null;}})['then'](respondWithResult(_0x19423f,null))[_0x72ec('0x55')](handleError(_0x19423f,null));};exports['getOpenchannelInteractions']=function(_0x557b73,_0x882163){var _0x20e95d={};var _0x2835ca={};var _0x430f6d;var _0x1949b2;return db['User'][_0x72ec('0x9d')]({'where':{'id':_0x557b73[_0x72ec('0x57')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x882163,null))[_0x72ec('0x16')](function(_0x52054c){if(_0x52054c){_0x430f6d=_0x52054c;_0x2835ca[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_0x72ec('0xe5')][_0x72ec('0xd7')]);_0x2835ca[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x557b73[_0x72ec('0x44')]);_0x2835ca[_0x72ec('0x5b')]=_[_0x72ec('0x5c')](_0x2835ca['model'],_0x2835ca[_0x72ec('0x44')]);_0x20e95d['attributes']=_['intersection'](_0x2835ca[_0x72ec('0x58')],qs['fields'](_0x557b73['query'][_0x72ec('0xca')]));_0x20e95d['attributes']=_0x20e95d[_0x72ec('0x49')]['length']?_0x20e95d[_0x72ec('0x49')]:_0x2835ca[_0x72ec('0x58')];_0x20e95d[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x557b73[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x20e95d[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x557b73['query'],_0x2835ca[_0x72ec('0x5b')]));if(_0x557b73[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x20e95d['where']=_['merge'](_0x20e95d[_0x72ec('0xcb')],{'$or':_['map'](_0x20e95d['attributes'],function(_0x1271ca){var _0x265737={};_0x265737[_0x1271ca]={'$like':'%'+_0x557b73[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x265737;})});}_0x20e95d=_[_0x72ec('0x5e')]({},_0x20e95d,_0x557b73[_0x72ec('0x5f')]);return _0x430f6d[_0x72ec('0xe6')](_0x20e95d);}})[_0x72ec('0x16')](function(_0x1962c9){if(_0x1962c9){_0x1949b2=_0x1962c9[_0x72ec('0x6f')];if(!_0x557b73[_0x72ec('0x44')]['hasOwnProperty']('nolimit')){_0x20e95d[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x557b73[_0x72ec('0x44')]['limit']);_0x20e95d[_0x72ec('0x25')]=qs['offset'](_0x557b73[_0x72ec('0x44')]['offset']);}return _0x430f6d[_0x72ec('0xe6')](_0x20e95d);}})[_0x72ec('0x16')](function(_0x2183c3){if(_0x2183c3){return _0x2183c3?{'count':_0x1949b2,'rows':_0x2183c3}:null;}})[_0x72ec('0x16')](respondWithResult(_0x882163,null))[_0x72ec('0x55')](handleError(_0x882163,null));};exports['getMailInteractions']=function(_0x20f9ea,_0x5e2342){var _0x45b2c4={'raw':!![],'where':{}};var _0x2f7a84={};var _0x2b6bc9={'count':0x0,'rows':[]};return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x20f9ea[_0x72ec('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e2342,null))['then'](function(_0x57ad40){if(_0x57ad40){_0x2f7a84[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_0x72ec('0xe7')][_0x72ec('0xd7')]);_0x2f7a84[_0x72ec('0x44')]=_['keys'](_0x20f9ea[_0x72ec('0x44')]);_0x2f7a84[_0x72ec('0x5b')]=_[_0x72ec('0x5c')](_0x2f7a84[_0x72ec('0x58')],_0x2f7a84['query']);_0x45b2c4[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x2f7a84[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x20f9ea[_0x72ec('0x44')]['fields']));_0x45b2c4[_0x72ec('0x49')]=_0x45b2c4['attributes'][_0x72ec('0x6f')]?_0x45b2c4[_0x72ec('0x49')]:_0x2f7a84[_0x72ec('0x58')];if(!_0x20f9ea[_0x72ec('0x44')][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x45b2c4[_0x72ec('0x26')]=qs['limit'](_0x20f9ea[_0x72ec('0x44')][_0x72ec('0x26')]);_0x45b2c4[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x20f9ea[_0x72ec('0x44')][_0x72ec('0x25')]);}_0x45b2c4['order']=qs[_0x72ec('0xd9')](_0x20f9ea[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x45b2c4[_0x72ec('0xcb')]=qs['filters'](_[_0x72ec('0xda')](_0x20f9ea['query'],_0x2f7a84[_0x72ec('0x5b')]));_0x45b2c4[_0x72ec('0xcb')][_0x72ec('0xdf')]=_0x57ad40['id'];if(_0x20f9ea[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x45b2c4[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x45b2c4[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x45b2c4[_0x72ec('0x49')],function(_0x312a15){var _0x56e4bd={};_0x56e4bd[_0x312a15]={'$like':'%'+_0x20f9ea[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x56e4bd;})});}_0x45b2c4=_[_0x72ec('0x5e')]({},_0x45b2c4,_0x20f9ea[_0x72ec('0x5f')]);return db['MailInteraction'][_0x72ec('0x28')]({'where':_0x45b2c4[_0x72ec('0xcb')]})[_0x72ec('0x16')](function(_0x154753){_0x2b6bc9[_0x72ec('0x28')]=_0x154753;if(_0x20f9ea[_0x72ec('0x44')][_0x72ec('0x45')]){_0x45b2c4[_0x72ec('0x46')]=[{'all':!![]}];}return db['MailInteraction'][_0x72ec('0x4a')](_0x45b2c4);})[_0x72ec('0x16')](function(_0x2dbc3d){_0x2b6bc9[_0x72ec('0x4b')]=_0x2dbc3d;return _0x2b6bc9;});}})[_0x72ec('0x16')](respondWithFilteredResult(_0x5e2342,_0x45b2c4))['catch'](handleError(_0x5e2342,null));};exports['getSmsInteractions']=function(_0xc2d518,_0x1300cf){var _0x55bfd1={};var _0xcc889e={};var _0x3a133d;var _0x5ce212;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0xc2d518[_0x72ec('0x57')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x1300cf,null))[_0x72ec('0x16')](function(_0x4c7b7a){if(_0x4c7b7a){_0x3a133d=_0x4c7b7a;_0xcc889e[_0x72ec('0x58')]=_['keys'](db[_0x72ec('0xe8')]['rawAttributes']);_0xcc889e['query']=_[_0x72ec('0x5a')](_0xc2d518[_0x72ec('0x44')]);_0xcc889e[_0x72ec('0x5b')]=_['intersection'](_0xcc889e[_0x72ec('0x58')],_0xcc889e[_0x72ec('0x44')]);_0x55bfd1[_0x72ec('0x49')]=_['intersection'](_0xcc889e['model'],qs['fields'](_0xc2d518['query']['fields']));_0x55bfd1[_0x72ec('0x49')]=_0x55bfd1['attributes'][_0x72ec('0x6f')]?_0x55bfd1[_0x72ec('0x49')]:_0xcc889e[_0x72ec('0x58')];_0x55bfd1[_0x72ec('0xd8')]=qs['sort'](_0xc2d518[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x55bfd1[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0xc2d518['query'],_0xcc889e[_0x72ec('0x5b')]));if(_0xc2d518[_0x72ec('0x44')]['filter']){_0x55bfd1[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x55bfd1[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x55bfd1[_0x72ec('0x49')],function(_0x2a57ea){var _0x862011={};_0x862011[_0x2a57ea]={'$like':'%'+_0xc2d518[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x862011;})});}_0x55bfd1=_[_0x72ec('0x5e')]({},_0x55bfd1,_0xc2d518[_0x72ec('0x5f')]);return _0x3a133d[_0x72ec('0xe9')](_0x55bfd1);}})[_0x72ec('0x16')](function(_0xb08395){if(_0xb08395){_0x5ce212=_0xb08395[_0x72ec('0x6f')];if(!_0xc2d518[_0x72ec('0x44')][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x55bfd1['limit']=qs[_0x72ec('0x26')](_0xc2d518[_0x72ec('0x44')][_0x72ec('0x26')]);_0x55bfd1['offset']=qs['offset'](_0xc2d518[_0x72ec('0x44')][_0x72ec('0x25')]);}return _0x3a133d[_0x72ec('0xe9')](_0x55bfd1);}})[_0x72ec('0x16')](function(_0x593cc7){if(_0x593cc7){return _0x593cc7?{'count':_0x5ce212,'rows':_0x593cc7}:null;}})[_0x72ec('0x16')](respondWithResult(_0x1300cf,null))[_0x72ec('0x55')](handleError(_0x1300cf,null));};exports[_0x72ec('0xea')]=function(_0x33c8cc,_0x577629){var _0x436cbb={};var _0x2c4cac={};var _0x192b2b;var _0x51312b;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x33c8cc['params']['id']}})['then'](handleEntityNotFound(_0x577629,null))[_0x72ec('0x16')](function(_0x263665){if(_0x263665){_0x192b2b=_0x263665;_0x2c4cac[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_0x72ec('0xeb')][_0x72ec('0xd7')]);_0x2c4cac['query']=_[_0x72ec('0x5a')](_0x33c8cc[_0x72ec('0x44')]);_0x2c4cac['filters']=_[_0x72ec('0x5c')](_0x2c4cac[_0x72ec('0x58')],_0x2c4cac[_0x72ec('0x44')]);_0x436cbb[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x2c4cac[_0x72ec('0x58')],qs['fields'](_0x33c8cc[_0x72ec('0x44')][_0x72ec('0xca')]));_0x436cbb[_0x72ec('0x49')]=_0x436cbb['attributes'][_0x72ec('0x6f')]?_0x436cbb[_0x72ec('0x49')]:_0x2c4cac[_0x72ec('0x58')];_0x436cbb[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x33c8cc[_0x72ec('0x44')]['sort']);_0x436cbb[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x33c8cc[_0x72ec('0x44')],_0x2c4cac[_0x72ec('0x5b')]));if(_0x33c8cc[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x436cbb[_0x72ec('0xcb')]=_['merge'](_0x436cbb[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x436cbb['attributes'],function(_0x3dcb18){var _0x3ae3ea={};_0x3ae3ea[_0x3dcb18]={'$like':'%'+_0x33c8cc[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x3ae3ea;})});}_0x436cbb=_[_0x72ec('0x5e')]({},_0x436cbb,_0x33c8cc['options']);return _0x192b2b[_0x72ec('0xea')](_0x436cbb);}})[_0x72ec('0x16')](function(_0x13a6a3){if(_0x13a6a3){_0x51312b=_0x13a6a3[_0x72ec('0x6f')];if(!_0x33c8cc[_0x72ec('0x44')][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x436cbb[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x33c8cc[_0x72ec('0x44')][_0x72ec('0x26')]);_0x436cbb['offset']=qs[_0x72ec('0x25')](_0x33c8cc[_0x72ec('0x44')]['offset']);}return _0x192b2b[_0x72ec('0xea')](_0x436cbb);}})[_0x72ec('0x16')](function(_0x503803){if(_0x503803){return _0x503803?{'count':_0x51312b,'rows':_0x503803}:null;}})[_0x72ec('0x16')](respondWithResult(_0x577629,null))['catch'](handleError(_0x577629,null));};exports[_0x72ec('0xec')]=function(_0x53947c,_0x375fa7){var _0x5a7f54={};var _0x3e2085={};var _0x463f60;var _0x34164d;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x53947c[_0x72ec('0x57')]['id']}})['then'](handleEntityNotFound(_0x375fa7,null))[_0x72ec('0x16')](function(_0x34d40e){if(_0x34d40e){_0x463f60=_0x34d40e;_0x3e2085['model']=_[_0x72ec('0x5a')](db[_0x72ec('0xed')]['rawAttributes']);_0x3e2085[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x53947c[_0x72ec('0x44')]);_0x3e2085['filters']=_['intersection'](_0x3e2085[_0x72ec('0x58')],_0x3e2085[_0x72ec('0x44')]);_0x5a7f54['attributes']=_[_0x72ec('0x5c')](_0x3e2085[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x53947c['query'][_0x72ec('0xca')]));_0x5a7f54[_0x72ec('0x49')]=_0x5a7f54['attributes'][_0x72ec('0x6f')]?_0x5a7f54[_0x72ec('0x49')]:_0x3e2085[_0x72ec('0x58')];_0x5a7f54[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x53947c[_0x72ec('0x44')]['sort']);_0x5a7f54['where']=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x53947c[_0x72ec('0x44')],_0x3e2085[_0x72ec('0x5b')]));if(_0x53947c[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x5a7f54[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x5a7f54[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x5a7f54['attributes'],function(_0x36b3c8){var _0xc3b484={};_0xc3b484[_0x36b3c8]={'$like':'%'+_0x53947c['query'][_0x72ec('0xcc')]+'%'};return _0xc3b484;})});}_0x5a7f54=_[_0x72ec('0x5e')]({},_0x5a7f54,_0x53947c['options']);return _0x463f60['getWhatsappInteractions'](_0x5a7f54);}})[_0x72ec('0x16')](function(_0x4999e7){if(_0x4999e7){_0x34164d=_0x4999e7[_0x72ec('0x6f')];if(!_0x53947c['query'][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x5a7f54[_0x72ec('0x26')]=qs['limit'](_0x53947c[_0x72ec('0x44')][_0x72ec('0x26')]);_0x5a7f54[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x53947c[_0x72ec('0x44')]['offset']);}return _0x463f60[_0x72ec('0xec')](_0x5a7f54);}})[_0x72ec('0x16')](function(_0x1319d4){if(_0x1319d4){return _0x1319d4?{'count':_0x34164d,'rows':_0x1319d4}:null;}})[_0x72ec('0x16')](respondWithResult(_0x375fa7,null))[_0x72ec('0x55')](handleError(_0x375fa7,null));};exports[_0x72ec('0xee')]=function(_0x103780,_0x30ba80,_0x452edb){var _0x41f10c;var _0xbe1240;var _0x584955;var _0x2b8d39=!_[_0x72ec('0x6a')](_0x103780[_0x72ec('0x57')]['id'])?_0x103780[_0x72ec('0x57')]['id']:!_[_0x72ec('0x6a')](_0x103780[_0x72ec('0x33')]['id'])?_0x103780['user']['id']:null;return db['User']['find']({'where':{'id':_0x2b8d39,'role':{'$or':[_0x72ec('0x31'),_0x72ec('0x33'),_0x72ec('0x2c')]}},'attributes':['id',_0x72ec('0x3a'),_0x72ec('0xef'),_0x72ec('0xf0'),_0x72ec('0x30'),_0x72ec('0x66'),'loginInPause']})[_0x72ec('0x16')](function(_0x37096e){if(_0x37096e){if(_0x37096e[_0x72ec('0x30')]==='agent'){_0x41f10c=_0x37096e;if(_0x103780[_0x72ec('0x61')]['interface']){_0x584955=util['format'](_0x72ec('0xf1'),_0x41f10c[_0x103780[_0x72ec('0x61')][_0x72ec('0xa5')]]);}else if(_0x103780[_0x72ec('0x61')][_0x72ec('0xf2')]){_0x584955=util[_0x72ec('0xb2')](_0x72ec('0xb3'),_0x103780[_0x72ec('0x61')][_0x72ec('0xf2')]);}else{_0x584955=util['format']('SIP/%s',_0x41f10c[_0x72ec('0x3a')]);}socket['to'](util[_0x72ec('0xb2')](_0x72ec('0xf3'),_0x41f10c['name']))[_0x72ec('0x2d')](_0x72ec('0xf4'),{'user':{'id':_0x41f10c['id'],'name':_0x41f10c[_0x72ec('0x3a')]},'ip':_0x103780[_0x72ec('0xf5')]['x-forwarded-for']||_0x103780['connection']['remoteAddress']||_0x103780['socket'][_0x72ec('0xf6')]||_0x103780[_0x72ec('0xf7')]['socket'][_0x72ec('0xf6')]});return db[_0x72ec('0xb4')][_0x72ec('0x39')]({'where':{'membername':_0x41f10c['name']},'individualHooks':!![]});}}else{throw new db[(_0x72ec('0x95'))][(_0x72ec('0x96'))](_0x72ec('0xf8'));}})['then'](function(){if(_0x41f10c){return _0x41f10c[_0x72ec('0xf9')]({'raw':!![]});}})[_0x72ec('0x16')](function(_0x3522ef){if(_0x41f10c){if(_0x3522ef){_0xbe1240=_0x3522ef;if(_0xbe1240[_0x72ec('0x6f')]){var _0x294b28=_0xbe1240['map'](function(_0x2e9ea9){var _0x9a8e57={'membername':_0x41f10c[_0x72ec('0x3a')],'UserId':_0x41f10c['id'],'queue_name':_0x2e9ea9[_0x72ec('0x3a')],'VoiceQueueId':_0x2e9ea9['id'],'interface':_0x584955,'paused':_0x41f10c[_0x72ec('0xa4')]||![],'penalty':_0x2e9ea9[_0x72ec('0xfa')]||0x0};return db['UserVoiceQueueRt'][_0x72ec('0xfb')](_0x9a8e57);});return Promise[_0x72ec('0x54')](_0x294b28);}}}})[_0x72ec('0x16')](function(){if(_0x41f10c){return db[_0x72ec('0xfc')][_0x72ec('0x4a')]({'where':{'membername':_0x41f10c[_0x72ec('0x3a')],'exitAt':null}});}})[_0x72ec('0x16')](function(_0x47da70){if(_0x41f10c){var _0x3db1e2=[];_0x47da70['forEach'](function(_0x5af4e6){_0x3db1e2[_0x72ec('0x4d')](_0x5af4e6[_0x72ec('0x2b')]({'exitAt':moment()[_0x72ec('0xb2')](_0x72ec('0xfd'))}));});return Promise[_0x72ec('0x54')](_0x3db1e2);}})[_0x72ec('0x16')](function(){if(_0x41f10c){var _0x12ca2f=[];var _0x352dcc=[];var _0x4a7a10=utils[_0x72ec('0xfe')]();var _0xb03878={'membername':_0x41f10c[_0x72ec('0x3a')],'interface':_0x584955,'enterAt':moment()[_0x72ec('0xb2')](_0x72ec('0xfd')),'role':_0x41f10c['role'],'internal':_0x41f10c[_0x72ec('0x66')]};_0x4a7a10[_0x72ec('0xff')](function(_0x56bbcf){_0x12ca2f[_0x72ec('0x4d')](_[_0x72ec('0x5e')]({'channel':_0x56bbcf,'type':_0x72ec('0x100'),'data1':_0x103780[_0x72ec('0x61')][_0x72ec('0x101')],'data2':_0x584955},_0xb03878));if(_0x41f10c[_0x72ec('0xa4')]){_0x352dcc[_0x72ec('0x4d')](_['merge']({'channel':_0x56bbcf,'type':'PAUSE','data1':_0x72ec('0x102')},_0xb03878));}});return db[_0x72ec('0xfc')][_0x72ec('0x8c')](_0x12ca2f[_0x72ec('0xc7')](_0x352dcc),{'individualHooks':!![]});}})[_0x72ec('0x16')](function(){if(_0x41f10c){return _0x41f10c['update']({'online':!![],'lastLoginAt':moment()[_0x72ec('0xb2')](_0x72ec('0xfd')),'voicePause':_0x41f10c[_0x72ec('0xa4')]||![],'mailPause':_0x41f10c[_0x72ec('0xa4')]||![],'chatPause':_0x41f10c[_0x72ec('0xa4')]||![],'faxPause':_0x41f10c['loginInPause']||![],'smsPause':_0x41f10c[_0x72ec('0xa4')]||![],'openchannelPause':_0x41f10c[_0x72ec('0xa4')]||![],'whatsappPause':_0x41f10c[_0x72ec('0xa4')]||![],'pauseType':_0x41f10c[_0x72ec('0xa4')]?_0x72ec('0x102'):null,'interface':_0x584955,'lastPauseAt':moment()['format'](_0x72ec('0xfd'))});}})['then'](function(_0x1675d5){if(_0x103780[_0x72ec('0x103')]){return _0x452edb();}else{return Promise['resolve'](_0x1675d5)[_0x72ec('0x16')](respondWithResult(_0x30ba80,null));}})[_0x72ec('0x55')](handleError(_0x30ba80,null));};exports[_0x72ec('0x104')]=function(_0x254686,_0x2e0685){var _0x3450db;return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x254686[_0x72ec('0x57')]['id'],'role':_0x72ec('0x2c')},'attributes':['id','name','role']})[_0x72ec('0x16')](handleEntityNotFound(_0x2e0685,null))[_0x72ec('0x16')](function(_0x2cc75e){if(_0x2cc75e){_0x3450db=_0x2cc75e;return db[_0x72ec('0xb4')][_0x72ec('0x39')]({'where':{'membername':_0x3450db[_0x72ec('0x3a')]},'individualHooks':!![]});}})[_0x72ec('0x16')](function(){return db[_0x72ec('0xfc')][_0x72ec('0x4a')]({'where':{'membername':_0x3450db[_0x72ec('0x3a')],'exitAt':null}});})[_0x72ec('0x16')](function(_0x38ba83){var _0x30a5b0=[];_0x38ba83[_0x72ec('0xff')](function(_0x258fe8){_0x30a5b0[_0x72ec('0x4d')](_0x258fe8['update']({'exitAt':moment()[_0x72ec('0xb2')](_0x72ec('0xfd'))}));});return Promise[_0x72ec('0x54')](_0x30a5b0);})['then'](function(){return _0x3450db[_0x72ec('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x72ec('0x16')](respondWithResult(_0x2e0685,null))[_0x72ec('0x55')](handleError(_0x2e0685,null));};exports[_0x72ec('0x105')]=function(_0x161f6e,_0x17a2b9){var _0x11a44c;return db[_0x72ec('0xb4')][_0x72ec('0x2b')]({'paused':0x1},{'where':{'UserId':_0x161f6e[_0x72ec('0x57')]['id']},'individualHooks':!![]})[_0x72ec('0x16')](function(){return db[_0x72ec('0x3c')]['find']({'where':{'id':_0x161f6e[_0x72ec('0x57')]['id'],'role':'agent'},'attributes':['id',_0x72ec('0x3a'),_0x72ec('0x30'),_0x72ec('0x66'),_0x72ec('0xa5'),_0x72ec('0xa3')]});})['then'](handleEntityNotFound(_0x17a2b9,null))[_0x72ec('0x16')](function(_0x12dfd3){if(_0x12dfd3){_0x11a44c=_0x12dfd3;return respondWithRpcPromise(_0x72ec('0x106'),'pause',{'id':_0x11a44c['id'],'name':_0x11a44c[_0x72ec('0x3a')],'pause':!![]});}})['then'](function(){if(_0x11a44c){return db[_0x72ec('0xfc')][_0x72ec('0x4a')]({'where':{'membername':_0x11a44c[_0x72ec('0x3a')],'type':_0x72ec('0x107'),'exitAt':null}});}})['then'](function(_0x12250d){if(_0x12250d[_0x72ec('0x6f')]){var _0x1d33a3=moment()['format'](_0x72ec('0xfd'));for(var _0x295f9e=0x0,_0x44adf6=_0x12250d[_0x72ec('0x6f')];_0x295f9e<_0x44adf6;_0x295f9e++){_0x12250d[_0x295f9e][_0x72ec('0x108')]({'exitAt':_0x1d33a3});}}})[_0x72ec('0x16')](function(){var _0x8cfb42=[];var _0x470c23=utils[_0x72ec('0xfe')]();_0x470c23[_0x72ec('0xff')](function(_0x568fe7){_0x8cfb42[_0x72ec('0x4d')]({'channel':_0x568fe7,'membername':_0x11a44c[_0x72ec('0x3a')],'interface':_[_0x72ec('0x6a')](_0x11a44c[_0x72ec('0xa5')])?util[_0x72ec('0xb2')](_0x72ec('0xb3'),_0x11a44c[_0x72ec('0x3a')]):_0x11a44c[_0x72ec('0xa5')],'type':_0x72ec('0x107'),'enterAt':moment()[_0x72ec('0xb2')](_0x72ec('0xfd')),'data1':_0x161f6e[_0x72ec('0x61')][_0x72ec('0x3f')]||'DEFAULT\x20PAUSE','role':_0x11a44c[_0x72ec('0x30')],'internal':_0x11a44c[_0x72ec('0x66')]});});return db['MemberReport'][_0x72ec('0x8c')](_0x8cfb42,{'individualHooks':!![]});})[_0x72ec('0x16')](function(){return _0x11a44c[_0x72ec('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x161f6e[_0x72ec('0x61')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x72ec('0x16')](respondWithResult(_0x17a2b9,null))[_0x72ec('0x55')](handleError(_0x17a2b9,null));};exports['unpause']=function(_0x593d79,_0x4237f7){if(_0x593d79['body']['channel']&&!utils[_0x72ec('0xa6')](_0x593d79[_0x72ec('0x61')][_0x72ec('0xa2')])){throw new APIBadRequestError(util[_0x72ec('0xb2')](_0x72ec('0x109'),_0x593d79['body']['channel']));}return db[_0x72ec('0x3c')][_0x72ec('0x38')]({'where':{'id':_0x593d79[_0x72ec('0x57')]['id']},'attributes':['id',_0x72ec('0x3a'),_0x72ec('0x30'),'internal','interface','online',_0x72ec('0x10a'),_0x72ec('0x10b'),_0x72ec('0x10c'),_0x72ec('0x10d'),_0x72ec('0x10e'),'smsPause','whatsappPause',_0x72ec('0x10f'),_0x72ec('0x110')]})[_0x72ec('0x16')](function(_0xa8eb3d){if(!_0xa8eb3d){throw new APINotFoundError(util[_0x72ec('0xb2')](_0x72ec('0x111'),_0x593d79[_0x72ec('0x57')]['id']));}return _0xa8eb3d['unpause'](_0x593d79[_0x72ec('0x61')]['channel']);})[_0x72ec('0x16')](respondWithResult(_0x4237f7,null))[_0x72ec('0x55')](APIHandleError(_0x4237f7));};exports[_0x72ec('0x112')]=function(_0x2aa909,_0x4af462){var _0x133e1d={};var _0x1194df={};var _0x43447e;var _0x4b7f64;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x2aa909[_0x72ec('0x57')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x4af462,null))['then'](function(_0x120581){if(_0x120581){_0x43447e=_0x120581;_0x1194df[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_0x72ec('0x113')][_0x72ec('0xd7')]);_0x1194df[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x2aa909['query']);_0x1194df[_0x72ec('0x5b')]=_[_0x72ec('0x5c')](_0x1194df[_0x72ec('0x58')],_0x1194df['query']);_0x133e1d[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x1194df['model'],qs[_0x72ec('0xca')](_0x2aa909[_0x72ec('0x44')]['fields']));_0x133e1d[_0x72ec('0x49')]=_0x133e1d['attributes'][_0x72ec('0x6f')]?_0x133e1d[_0x72ec('0x49')]:_0x1194df[_0x72ec('0x58')];_0x133e1d[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x2aa909[_0x72ec('0x44')]['sort']);_0x133e1d['where']=qs['filters'](_['pick'](_0x2aa909[_0x72ec('0x44')],_0x1194df[_0x72ec('0x5b')]));if(_0x2aa909['query']['filter']){_0x133e1d[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x133e1d[_0x72ec('0xcb')],{'$or':_['map'](_0x133e1d[_0x72ec('0x49')],function(_0x204016){var _0x3ab847={};_0x3ab847[_0x204016]={'$like':'%'+_0x2aa909[_0x72ec('0x44')]['filter']+'%'};return _0x3ab847;})});}_0x133e1d=_['merge']({},_0x133e1d,_0x2aa909['options']);return _0x43447e[_0x72ec('0x112')](_0x133e1d);}})['then'](function(_0x43eb82){if(_0x43eb82){_0x4b7f64=_0x43eb82[_0x72ec('0x6f')];if(!_0x2aa909[_0x72ec('0x44')][_0x72ec('0xcd')](_0x72ec('0xd4'))){_0x133e1d[_0x72ec('0x26')]=qs['limit'](_0x2aa909['query'][_0x72ec('0x26')]);_0x133e1d[_0x72ec('0x25')]=qs[_0x72ec('0x25')](_0x2aa909['query'][_0x72ec('0x25')]);}return _0x43447e['getTeams'](_0x133e1d);}})[_0x72ec('0x16')](function(_0x419568){if(_0x419568){return _0x419568?{'count':_0x4b7f64,'rows':_0x419568}:null;}})[_0x72ec('0x16')](respondWithResult(_0x4af462,null))[_0x72ec('0x55')](handleError(_0x4af462,null));};exports[_0x72ec('0x114')]=function(_0x353603,_0x2cede6){var _0x39b692=_0x353603['params']['id'];var _0x19a1a5=_0x353603[_0x72ec('0x61')]?_0x353603[_0x72ec('0x61')][_0x72ec('0x64')]:null;var _0x343528=[];return Promise[_0x72ec('0x115')]()[_0x72ec('0x16')](function(){if(!_0x19a1a5)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x72ec('0x16')](function(){return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x39b692}});})[_0x72ec('0x16')](function(_0x1bba75){if(!_0x1bba75)throw new APINotFoundError(util[_0x72ec('0xb2')](_0x72ec('0x111'),_0x353603[_0x72ec('0x57')]['id']));return db[_0x72ec('0x6d')][_0x72ec('0x116')](function(_0x4b3f81){return _0x1bba75[_0x72ec('0x114')](_0x19a1a5,{'transaction':_0x4b3f81})[_0x72ec('0x16')](function(){return db[_0x72ec('0x113')][_0x72ec('0x4a')]({'where':{'id':{'$in':_0x19a1a5}}});})[_0x72ec('0x16')](function(_0x2d6d3c){var _0x4afbd1=_['map'](_0x2d6d3c,function(_0x4910ed){return _0x4910ed[_0x72ec('0x117')]();});return Promise[_0x72ec('0x54')](_0x4afbd1);})[_0x72ec('0x16')](function(_0x50b65e){_0x343528=_[_0x72ec('0x118')](_0x50b65e);var _0x2ee1fe=_[_0x72ec('0x3d')](_0x343528,function(_0x37a230){return _0x37a230[_0x72ec('0x119')](_0x1bba75['id'],{'transaction':_0x4b3f81});});return Promise[_0x72ec('0x54')](_0x2ee1fe);})[_0x72ec('0x16')](function(){if(!_0x1bba75[_0x72ec('0xa3')])return;var _0x2e6767=_[_0x72ec('0xcc')](_0x343528,function(_0x33759d){return _0x33759d[_0x72ec('0x11a')](_0x72ec('0xa2'))===_0x72ec('0x11b');});var _0x2e1207=_[_0x72ec('0x3d')](_0x2e6767,function(_0x1050f2){return db[_0x72ec('0xb4')][_0x72ec('0xfb')]({'membername':_0x1bba75[_0x72ec('0x3a')],'UserId':_0x1bba75['id'],'queue_name':_0x1050f2[_0x72ec('0x3a')],'VoiceQueueId':_0x1050f2['id'],'interface':_[_0x72ec('0x6a')](_0x1bba75['interface'])?util[_0x72ec('0xb2')](_0x72ec('0xb3'),_0x1bba75['name']):_0x1bba75[_0x72ec('0xa5')],'paused':_0x1bba75['voicePause']||![],'penalty':_0x1bba75['penalty']},{'transaction':_0x4b3f81});});return Promise['all'](_0x2e1207);})[_0x72ec('0x16')](function(){return db[_0x72ec('0x11c')][_0x72ec('0x4a')]({'where':{'teamId':{'$in':_0x19a1a5}}});})[_0x72ec('0x16')](function(_0x52207d){var _0x10ea04=_[_0x72ec('0x3d')](_0x52207d,function(_0x2eb244){return db[_0x72ec('0x11d')][_0x72ec('0x82')]({'UserId':_0x1bba75['id'],'VoicePrefixId':_0x2eb244[_0x72ec('0x11e')]},{'transaction':_0x4b3f81});});return Promise[_0x72ec('0x54')](_0x10ea04);});});})[_0x72ec('0x16')](function(){for(var _0x3a1e5e=0x0;_0x3a1e5e<_0x343528[_0x72ec('0x6f')];_0x3a1e5e++){var _0x5bdfcf=_0x343528[_0x3a1e5e][_0x72ec('0x11a')](_0x72ec('0xa2'));var _0x51c3e8=_0x5bdfcf+_0x72ec('0xae');socket[_0x72ec('0x2d')](_0x72ec('0x33')+_0x5bdfcf+_0x72ec('0xaf'),{'UserId':_0x39b692,['queueField']:_0x343528[_0x3a1e5e]['id']});}})['then'](respondWithStatusCode(_0x2cede6,null))[_0x72ec('0x55')](APIHandleError(_0x2cede6));};exports[_0x72ec('0x11f')]=function(_0x2b0fea,_0xa836a6){var _0xbc2177=_0x2b0fea['params']['id'];var _0xb73b9a=null;if(_0x2b0fea[_0x72ec('0x44')][_0x72ec('0x64')]){_0xb73b9a=_[_0x72ec('0xb5')](_0x2b0fea['query']['ids'])?_0x2b0fea['query']['ids']:[_0x2b0fea['query'][_0x72ec('0x64')]];}var _0x4a1420=[];return Promise[_0x72ec('0x115')]()['then'](function(){if(!_0xb73b9a)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db['User'][_0x72ec('0x9d')]({'where':{'id':_0xbc2177}});})[_0x72ec('0x16')](function(_0x2df8bc){if(!_0x2df8bc)throw new APINotFoundError(util[_0x72ec('0xb2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2b0fea[_0x72ec('0x57')]['id']));return db['sequelize'][_0x72ec('0x116')](function(_0x12c08c){return _0x2df8bc[_0x72ec('0x11f')](_0xb73b9a,{'transaction':_0x12c08c})[_0x72ec('0x16')](function(){return db[_0x72ec('0x113')][_0x72ec('0x4a')]({'where':{'id':{'$in':_0xb73b9a}}});})[_0x72ec('0x16')](function(_0x55cce7){var _0x4ecbe3=_[_0x72ec('0x3d')](_0x55cce7,function(_0x4d0a5b){return _0x4d0a5b[_0x72ec('0x117')]();});return Promise[_0x72ec('0x54')](_0x4ecbe3);})['then'](function(_0x276fc7){_0x4a1420=_[_0x72ec('0x118')](_0x276fc7);var _0x3c23f0=_[_0x72ec('0x3d')](_0x4a1420,function(_0x38b227){return _0x38b227[_0x72ec('0x120')](_0x2df8bc['id'],{'transaction':_0x12c08c});});return Promise['all'](_0x3c23f0);})[_0x72ec('0x16')](function(){if(!_0x2df8bc[_0x72ec('0xa3')])return;var _0x13798b=_['filter'](_0x4a1420,function(_0x2d67df){return _0x2d67df[_0x72ec('0x11a')](_0x72ec('0xa2'))==='Voice';});var _0x54cd46=_[_0x72ec('0x3d')](_0x13798b,function(_0xd02027){return db[_0x72ec('0xb4')][_0x72ec('0x39')]({'where':{'VoiceQueueId':_0xd02027['id'],'UserId':_0x2df8bc['id']},'transaction':_0x12c08c});});return Promise[_0x72ec('0x54')](_0x54cd46);})[_0x72ec('0x16')](function(){return db['TeamVoicePrefix'][_0x72ec('0x4a')]({'where':{'teamId':{'$in':_0xb73b9a}}});})[_0x72ec('0x16')](function(_0x512dfc){var _0x1c6078=_['map'](_0x512dfc,function(_0x558f4a){return db[_0x72ec('0x11d')][_0x72ec('0x39')]({'where':{'UserId':_0x2df8bc['id'],'VoicePrefixId':_0x558f4a[_0x72ec('0x11e')]}},{'transaction':_0x12c08c});});return Promise[_0x72ec('0x54')](_0x1c6078);});});})[_0x72ec('0x16')](function(){for(var _0x30d2de=0x0;_0x30d2de<_0x4a1420['length'];_0x30d2de++){var _0x45ce2e=_0x4a1420[_0x30d2de][_0x72ec('0x11a')](_0x72ec('0xa2'));var _0x21b6d5=_0x45ce2e+_0x72ec('0xae');socket[_0x72ec('0x2d')](_0x72ec('0x33')+_0x45ce2e+'Queue:remove',{'UserId':_0xbc2177,['queueField']:_0x4a1420[_0x30d2de]['id']});}})[_0x72ec('0x16')](respondWithStatusCode(_0xa836a6,null))['catch'](APIHandleError(_0xa836a6));};exports['getLists']=function(_0x4c2099,_0x34d833){var _0x39046d={};var _0x3769c3={};var _0x58e5c5;var _0x4d3e3d;return db[_0x72ec('0x3c')][_0x72ec('0x9d')]({'where':{'id':_0x4c2099[_0x72ec('0x57')]['id']}})['then'](handleEntityNotFound(_0x34d833,null))[_0x72ec('0x16')](function(_0x447438){if(_0x447438){_0x58e5c5=_0x447438;_0x3769c3[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db['CmList']['rawAttributes']);_0x3769c3[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x4c2099[_0x72ec('0x44')]);_0x3769c3[_0x72ec('0x5b')]=_[_0x72ec('0x5c')](_0x3769c3['model'],_0x3769c3['query']);_0x39046d[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x3769c3[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x4c2099[_0x72ec('0x44')][_0x72ec('0xca')]));_0x39046d[_0x72ec('0x49')]=_0x39046d[_0x72ec('0x49')][_0x72ec('0x6f')]?_0x39046d['attributes']:_0x3769c3[_0x72ec('0x58')];_0x39046d[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x4c2099[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x39046d[_0x72ec('0xcb')]=qs[_0x72ec('0x5b')](_[_0x72ec('0xda')](_0x4c2099[_0x72ec('0x44')],_0x3769c3['filters']));if(_0x4c2099['query'][_0x72ec('0xcc')]){_0x39046d[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x39046d[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x39046d[_0x72ec('0x49')],function(_0x477ed6){var _0x2becc0={};_0x2becc0[_0x477ed6]={'$like':'%'+_0x4c2099[_0x72ec('0x44')][_0x72ec('0xcc')]+'%'};return _0x2becc0;})});}_0x39046d=_['merge']({},_0x39046d,_0x4c2099[_0x72ec('0x5f')]);return _0x58e5c5[_0x72ec('0x121')](_0x39046d);}})[_0x72ec('0x16')](function(_0x4f8728){if(_0x4f8728){_0x4d3e3d=_0x4f8728[_0x72ec('0x6f')];if(!_0x4c2099['query'][_0x72ec('0xcd')]('nolimit')){_0x39046d[_0x72ec('0x26')]=qs[_0x72ec('0x26')](_0x4c2099[_0x72ec('0x44')][_0x72ec('0x26')]);_0x39046d['offset']=qs[_0x72ec('0x25')](_0x4c2099[_0x72ec('0x44')][_0x72ec('0x25')]);}return _0x58e5c5[_0x72ec('0x121')](_0x39046d);}})[_0x72ec('0x16')](function(_0x2827fa){if(_0x2827fa){return _0x2827fa?{'count':_0x4d3e3d,'rows':_0x2827fa}:null;}})['then'](respondWithResult(_0x34d833,null))['catch'](handleError(_0x34d833,null));};exports[_0x72ec('0x122')]=function(_0x481149,_0x2c4921){var _0x492fcd={};var _0x2d22c8={};var _0x4e7372;return db[_0x72ec('0x3c')]['findOne']({'where':{'id':_0x481149['params']['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x2c4921,null))[_0x72ec('0x16')](function(_0x11c851){if(_0x11c851){_0x4e7372=_0x11c851;_0x2d22c8[_0x72ec('0x58')]=_[_0x72ec('0x5a')](db[_0x72ec('0x3c')]['rawAttributes']);_0x2d22c8[_0x72ec('0x44')]=_[_0x72ec('0x5a')](_0x481149[_0x72ec('0x44')]);_0x2d22c8[_0x72ec('0x5b')]=_['intersection'](_0x2d22c8[_0x72ec('0x58')],_0x2d22c8[_0x72ec('0x44')]);_0x492fcd[_0x72ec('0x49')]=_[_0x72ec('0x5c')](_0x2d22c8[_0x72ec('0x58')],qs[_0x72ec('0xca')](_0x481149['query'][_0x72ec('0xca')]));_0x492fcd[_0x72ec('0x49')]=_0x492fcd[_0x72ec('0x49')][_0x72ec('0x6f')]?_0x492fcd[_0x72ec('0x49')]:_0x2d22c8['model'];_0x492fcd[_0x72ec('0xd8')]=qs[_0x72ec('0xd9')](_0x481149[_0x72ec('0x44')][_0x72ec('0xd9')]);_0x492fcd[_0x72ec('0xcb')]=qs['filters'](_[_0x72ec('0xda')](_0x481149['query'],_0x2d22c8[_0x72ec('0x5b')]));if(_0x481149[_0x72ec('0x44')][_0x72ec('0xcc')]){_0x492fcd[_0x72ec('0xcb')]=_[_0x72ec('0x5e')](_0x492fcd[_0x72ec('0xcb')],{'$or':_[_0x72ec('0x3d')](_0x492fcd[_0x72ec('0x49')],function(_0x285f12){var _0x177df1={};_0x177df1[_0x285f12]={'$like':'%'+_0x481149['query'][_0x72ec('0xcc')]+'%'};return _0x177df1;})});}_0x492fcd[_0x72ec('0x58')]=db[_0x72ec('0x3c')];_0x492fcd['as']='Agents';_0x492fcd=_[_0x72ec('0x5e')]({},_0x492fcd,_0x481149[_0x72ec('0x5f')]);return _0x4e7372[_0x72ec('0xf9')]({'include':[_0x492fcd]});}})[_0x72ec('0x16')](function(_0x4c68e1){if(_0x4c68e1){var _0x543c52={},_0x1e105f=[];for(var _0x1c526e=0x0;_0x1c526e<_0x4c68e1['length'];_0x1c526e+=0x1){for(var _0x2b0643=0x0,_0x5bf273;_0x2b0643<_0x4c68e1[_0x1c526e][_0x72ec('0x34')][_0x72ec('0x6f')];_0x2b0643+=0x1){_0x5bf273=_0x4c68e1[_0x1c526e]['Agents'][_0x2b0643][_0x72ec('0x2f')]({'plain':!![]});_0x543c52[_0x5bf273['id']]=_0x5bf273;}}_0x543c52=_['values'](_0x543c52);for(var _0x2e2758=qs[_0x72ec('0x25')](_0x481149[_0x72ec('0x44')][_0x72ec('0x25')]);_0x2e2758<_0x543c52['length']&&_0x1e105f['length']=_0x55ca4b){_0x448035=_0x55ca4b;_0x48b24a=0xc8;}else{_0x48b24a=0xce;}_0xd026a3[_0x0474('0x21')](_0x48b24a);return _0xd026a3[_0x0474('0x26')](_0x0474('0x27'),_0x2bfe0a+'-'+_0x448035+'/'+_0x55ca4b)[_0x0474('0x28')](_0x49722d);}return null;};}function saveUpdates(_0x1dfdd7){return function(_0x4039de){if(_0x4039de){return _0x4039de['update'](_0x1dfdd7)[_0x0474('0x16')](function(_0x2183d8){if(_0x2183d8[_0x0474('0x29')]===_0x0474('0x2a')){socket[_0x0474('0x2b')]('userNotification:recalc:'+_0x2183d8['id'],_0x2183d8);}return _0x2183d8;});}return null;};}function removeEntity(_0x3cefdc){return function(_0x5711dc){if(_0x5711dc){return _0x5711dc[_0x0474('0x2c')]()['then'](function(){var _0x310b1c=_0x5711dc[_0x0474('0x2d')]({'plain':!![]});if(_0x310b1c['role']===_0x0474('0x2e'))return;var _0x3ad6b6=[{'name':'Users','value':_0x0474('0x2f'),'ignore':!![]},{'name':_0x0474('0x30'),'value':_0x0474('0x2a'),'ignore':![]},{'name':_0x0474('0x31'),'value':_0x0474('0x32'),'ignore':![]}];var _0x389ea3=_(_0x3ad6b6)[_0x0474('0x33')](_0x0474('0x34'))[_0x0474('0x35')]('value')[_0x0474('0x36')]();if(_[_0x0474('0x37')](_0x389ea3,_0x310b1c['role'])){return;}var _0x34a97a=_[_0x0474('0x38')](_0x3ad6b6,[_0x0474('0x36'),_0x310b1c[_0x0474('0x29')]])[_0x0474('0x39')];return db[_0x0474('0x3a')]['destroy']({'where':{'type':_0x34a97a,'resourceId':_0x310b1c['id']}})[_0x0474('0x16')](function(){return _0x5711dc;});})[_0x0474('0x16')](function(){_0x3cefdc['status'](0xcc)[_0x0474('0x3b')]();});}};}function handleEntityNotFound(_0x575518){return function(_0x4fb9fd){if(!_0x4fb9fd){_0x575518[_0x0474('0x20')](0x194);}return _0x4fb9fd;};}function handleError(_0x265f8a,_0x203443){_0x203443=_0x203443||0x1f4;return function(_0x280d78){logger['error'](_0x280d78[_0x0474('0x3c')]);if(_0x280d78[_0x0474('0x39')]){delete _0x280d78[_0x0474('0x39')];}_0x265f8a[_0x0474('0x21')](_0x203443)[_0x0474('0x3d')](_0x280d78);};}exports[_0x0474('0x3e')]=function(_0x4fb799,_0x234165){var _0x2c275c={},_0x4a0d98={'count':0x0,'rows':[]};var _0x206361=_(db[_0x0474('0x3f')]['rawAttributes'])[_0x0474('0x35')](function(_0x59b5ee){return{'name':_0x59b5ee[_0x0474('0x40')],'type':_0x59b5ee[_0x0474('0x41')][_0x0474('0x42')]};})[_0x0474('0x33')](function(_0x59fa4a){return!_['includes']([_0x0474('0x43'),_0x0474('0x44')],_0x59fa4a[_0x0474('0x39')]);})[_0x0474('0x36')]();_0x2c275c=qs[_0x0474('0x45')](_0x206361,_0x4fb799);var _0x570e02={'where':_0x2c275c[_0x0474('0x46')]};return db['User'][_0x0474('0x25')](_0x570e02)['then'](function(_0x3ebf33){_0x4a0d98[_0x0474('0x25')]=_0x3ebf33;if(_0x4fb799['query'][_0x0474('0x47')]){_0x2c275c[_0x0474('0x48')]=[{'all':!![]}];}if(_0x4fb799[_0x0474('0x49')][_0x0474('0x4a')]===_0x0474('0x4b')){_0x2c275c[_0x0474('0x48')]=[{'model':db[_0x0474('0x4c')],'as':_0x0474('0x4a')}];}if(!_['includes'](_0x2c275c['attributes'],'id')){_0x2c275c['attributes'][_0x0474('0x4d')]('id');}return db['User']['findAll'](_0x2c275c);})[_0x0474('0x16')](function(_0x24c283){_0x4a0d98[_0x0474('0x4e')]=_0x24c283;if(_0x4fb799[_0x0474('0x49')][_0x0474('0x4f')]===_0x0474('0x4b')){var _0x5ebeeb=[];for(var _0x45637c=0x0;_0x45637c<_0x4a0d98[_0x0474('0x4e')][_0x0474('0x50')];_0x45637c++){_0x5ebeeb['push'](get_open_tabs(_0x0474('0x51'),_0x4a0d98['rows'][_0x45637c][_0x0474('0x52')]));_0x5ebeeb[_0x0474('0x4d')](get_open_tabs(_0x0474('0x53'),_0x4a0d98['rows'][_0x45637c][_0x0474('0x52')]));_0x5ebeeb['push'](get_open_tabs(_0x0474('0x54'),_0x4a0d98[_0x0474('0x4e')][_0x45637c][_0x0474('0x52')]));_0x5ebeeb[_0x0474('0x4d')](get_open_tabs(_0x0474('0x55'),_0x4a0d98[_0x0474('0x4e')][_0x45637c][_0x0474('0x52')]));_0x5ebeeb['push'](get_open_tabs(_0x0474('0x56'),_0x4a0d98['rows'][_0x45637c][_0x0474('0x52')]));_0x5ebeeb[_0x0474('0x4d')](get_open_tabs(_0x0474('0x57'),_0x4a0d98[_0x0474('0x4e')][_0x45637c][_0x0474('0x52')]));}return Promise[_0x0474('0x58')](_0x5ebeeb)[_0x0474('0x16')](function(){return _0x4a0d98;});}else{return _0x4a0d98;}})[_0x0474('0x16')](respondWithFilteredResult(_0x234165,_0x2c275c))[_0x0474('0x1f')](handleError(_0x234165,null));};exports[_0x0474('0x59')]=function(_0x560801,_0x21245f){var _0x3be801={'raw':![],'where':{'id':_0x560801['params']['id']}},_0x4ed792={};_0x4ed792[_0x0474('0x5a')]=_[_0x0474('0x5b')](_[_0x0474('0x5c')](db['User'][_0x0474('0x5d')]),[_0x0474('0x43'),'salt']);_0x4ed792['query']=_[_0x0474('0x5c')](_0x560801['query']);_0x4ed792[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0x4ed792[_0x0474('0x5a')],_0x4ed792[_0x0474('0x49')]);_0x3be801[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x4ed792['model'],qs[_0x0474('0x61')](_0x560801[_0x0474('0x49')][_0x0474('0x61')]));_0x3be801[_0x0474('0x60')]=_0x3be801[_0x0474('0x60')][_0x0474('0x50')]?_0x3be801[_0x0474('0x60')]:_0x4ed792['model'];if(_0x560801['query']['includeAll']){_0x3be801[_0x0474('0x48')]=[{'all':!![]}];}if(_0x560801['query'][_0x0474('0x4a')]===_0x0474('0x4b')){_0x3be801[_0x0474('0x48')]=[{'model':db[_0x0474('0x4c')],'as':_0x0474('0x4a')}];}_0x3be801=_[_0x0474('0x62')]({},_0x3be801,_0x560801[_0x0474('0x63')]);if(!_[_0x0474('0x37')](_0x3be801[_0x0474('0x60')],'id')){_0x3be801[_0x0474('0x60')]['push']('id');}return db[_0x0474('0x3f')]['find'](_0x3be801)[_0x0474('0x16')](handleEntityNotFound(_0x21245f,null))['then'](function(_0x5a3c5e){var _0x257611=[];values=_0x5a3c5e;if(_0x560801['query']['openTabs']===_0x0474('0x4b')){_0x257611[_0x0474('0x4d')](get_open_tabs(_0x0474('0x51'),_0x5a3c5e[_0x0474('0x52')]));_0x257611[_0x0474('0x4d')](get_open_tabs('sms',_0x5a3c5e[_0x0474('0x52')]));_0x257611[_0x0474('0x4d')](get_open_tabs(_0x0474('0x56'),_0x5a3c5e[_0x0474('0x52')]));_0x257611[_0x0474('0x4d')](get_open_tabs(_0x0474('0x57'),_0x5a3c5e['dataValues']));_0x257611[_0x0474('0x4d')](get_open_tabs(_0x0474('0x54'),_0x5a3c5e[_0x0474('0x52')]));_0x257611['push'](get_open_tabs('mail',_0x5a3c5e[_0x0474('0x52')]));return Promise[_0x0474('0x58')](_0x257611);}else{return values;}})['then'](function(){return values;})[_0x0474('0x16')](respondWithResult(_0x21245f,null))['catch'](handleError(_0x21245f,null));};exports[_0x0474('0x64')]=function(_0x5c4e3b,_0x14cc80){if(_0x5c4e3b[_0x0474('0x65')]['id']){delete _0x5c4e3b[_0x0474('0x65')]['id'];}delete _0x5c4e3b[_0x0474('0x65')]['role'];return db['User'][_0x0474('0x38')]({'where':{'id':_0x5c4e3b[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x14cc80,null))[_0x0474('0x16')](saveUpdates(_0x5c4e3b[_0x0474('0x65')],null))['then'](respondWithResult(_0x14cc80,null))[_0x0474('0x1f')](handleError(_0x14cc80,null));};exports[_0x0474('0x67')]=function(_0x26eeec,_0x69207f){return db['User'][_0x0474('0x67')]()[_0x0474('0x16')](respondWithResult(_0x69207f,null))[_0x0474('0x1f')](handleError(_0x69207f,null));};exports[_0x0474('0x68')]=function(_0x238118,_0x5b256b){return db[_0x0474('0x3f')][_0x0474('0x38')]({'where':{'id':_0x238118[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x5b256b,null))[_0x0474('0x16')](function(_0x207331){if(_0x207331){return _0x207331['addContacts'](_0x238118[_0x0474('0x65')][_0x0474('0x69')],_[_0x0474('0x6a')](_0x238118[_0x0474('0x65')],[_0x0474('0x69'),'id'])||{});}})[_0x0474('0x16')](respondWithResult(_0x5b256b,null))[_0x0474('0x1f')](handleError(_0x5b256b,null));};function validateUser(_0xe3f502){return new Promise(function(_0x155eba,_0x54d726){if(_0xe3f502[_0x0474('0x6b')])return _0x155eba(_0xe3f502);return db[_0x0474('0x6c')][_0x0474('0x6d')](0x1)[_0x0474('0x16')](function(_0x7d2677){if(_0x7d2677[_0x0474('0x6e')])authService[_0x0474('0x6f')](_0xe3f502[_0x0474('0x43')]);db[_0x0474('0x3f')][_0x0474('0x70')](_0x0474('0x6b'))['then'](function(_0x488860){if(_[_0x0474('0x71')](_0x488860)){_0xe3f502[_0x0474('0x6b')]=_0x7d2677[_0x0474('0x72')]||0x1;return;}if(_[_0x0474('0x71')](_0x7d2677['min_internal'])||_0x7d2677[_0x0474('0x72')]===_0x488860){_0xe3f502[_0x0474('0x6b')]=_0x488860+0x1;return;}if(_0x7d2677[_0x0474('0x72')]>_0x488860){_0xe3f502[_0x0474('0x6b')]=_0x7d2677[_0x0474('0x72')];return;}return db[_0x0474('0x73')][_0x0474('0x49')](_0x0474('0x74'),{'type':db[_0x0474('0x73')][_0x0474('0x75')][_0x0474('0x76')]})[_0x0474('0x16')](function(_0x5e9c40){if(_0x5e9c40&&_0x5e9c40[_0x0474('0x50')]){for(var _0x3acdb3=0x0,_0x3420e4=_0x5e9c40[_0x0474('0x50')];_0x3acdb3<_0x3420e4&&_[_0x0474('0x71')](_0xe3f502[_0x0474('0x6b')]);_0x3acdb3++){if(_0x7d2677[_0x0474('0x72')]<=_0x5e9c40[_0x3acdb3]['from']){_0xe3f502[_0x0474('0x6b')]=_0x5e9c40[_0x3acdb3]['from'];}else if(_0x7d2677['min_internal']>_0x5e9c40[_0x3acdb3][_0x0474('0x77')]&&_0x7d2677['min_internal']<=_0x5e9c40[_0x3acdb3]['to']){_0xe3f502['internal']=_0x7d2677[_0x0474('0x72')];}}}if(_[_0x0474('0x71')](_0xe3f502['internal'])){_0xe3f502['internal']=_0x488860+0x1;}return _0x155eba(_0xe3f502);});});})[_0x0474('0x1f')](function(_0xaedce2){_0x54d726(_0xaedce2);});});}function updateUser(_0x2ddddd){return new Promise(function(_0x494f04,_0xab5314){try{if(_0x2ddddd[_0x0474('0x78')]){_0x2ddddd['mailbox']=_0x2ddddd[_0x0474('0x6b')];_0x2ddddd[_0x0474('0x79')]={'mailbox':_0x2ddddd[_0x0474('0x6b')],'password':_0x2ddddd['password'],'fullname':_0x2ddddd[_0x0474('0x7a')],'email':_0x2ddddd[_0x0474('0x7b')]};}if(_0x2ddddd[_0x0474('0x29')]==='agent'){if(!_0x2ddddd['permissions'])_0x2ddddd[_0x0474('0x7c')]=['101',_0x0474('0x7d'),_0x0474('0x7e'),_0x0474('0x7f'),_0x0474('0x80'),'104',_0x0474('0x81'),_0x0474('0x82'),'107',_0x0474('0x83'),_0x0474('0x84'),'100',_0x0474('0x85'),_0x0474('0x86'),_0x0474('0x87')];}_0x494f04(_0x2ddddd);}catch(_0x4bb556){_0xab5314(_0x4bb556);}});}exports[_0x0474('0x88')]=function(_0x5492f0,_0x5c49f1){if(_0x5492f0[_0x0474('0x2f')]['role']===_0x0474('0x2a'))throw new Error('Unauthorized');if(_0x5492f0[_0x0474('0x65')]['role']==='user'&&_0x5492f0[_0x0474('0x2f')]['role']!==_0x0474('0x2e')){throw new Error(_0x0474('0x89'));}if(_0x5492f0['body']['role']===_0x0474('0x2e')&&_0x5492f0[_0x0474('0x2f')][_0x0474('0x29')]!==_0x0474('0x2e')){throw new Error(_0x0474('0x8a'));}return licenseUtil[_0x0474('0x8b')]([_0x5492f0[_0x0474('0x65')]])['then'](function(){return validateUser(_0x5492f0['body']);})[_0x0474('0x16')](function(_0x4d8ed4){return updateUser(_0x4d8ed4)[_0x0474('0x16')](function(_0x56afe8){if(_0x56afe8[_0x0474('0x29')]===_0x0474('0x2e')){_0x56afe8[_0x0474('0x8c')]=_0x5492f0['user']['settingsEnabled'];delete _0x56afe8[_0x0474('0x8d')];}return _0x56afe8;});})[_0x0474('0x16')](function(_0x28e101){return db[_0x0474('0x3f')][_0x0474('0x88')](_0x28e101,{'include':[{'model':db[_0x0474('0x79')],'as':_0x0474('0x79')}]});})[_0x0474('0x16')](function(_0x2c3ed3){if(_0x5492f0[_0x0474('0x65')][_0x0474('0x29')]===_0x0474('0x2f'))return _0x2c3ed3;if(_0x5492f0[_0x0474('0x2f')]['role']!==_0x0474('0x2f'))return _0x2c3ed3;return db['UserProfileSection'][_0x0474('0x38')]({'where':{'name':_0x2c3ed3['role']===_0x0474('0x2a')?'Agents':_0x0474('0x31'),'userProfileId':_0x5492f0[_0x0474('0x2f')][_0x0474('0x8d')]},'raw':!![]})[_0x0474('0x16')](function(_0x4ec709){if(!_0x4ec709||_0x4ec709[_0x0474('0x8e')]!=0x0)return _0x2c3ed3;return db[_0x0474('0x3a')][_0x0474('0x88')]({'name':_0x2c3ed3[_0x0474('0x39')],'resourceId':_0x2c3ed3['id'],'type':_0x4ec709[_0x0474('0x39')],'sectionId':_0x4ec709['id']},{})['then'](function(){return _0x2c3ed3;});})[_0x0474('0x1f')](function(_0x3e2aef){logger[_0x0474('0x1b')](_0x0474('0x8f'),_0x3e2aef);throw _0x3e2aef;});})[_0x0474('0x16')](respondWithResult(_0x5c49f1,0xc9))[_0x0474('0x1f')](handleError(_0x5c49f1,null));};exports[_0x0474('0x90')]=function(_0x4cfe44,_0x3174db){var _0x5688d5=_0x4cfe44['body'];var _0x1114da=[];if(_0x4cfe44['user']['role']===_0x0474('0x2a'))throw new Error(_0x0474('0x91'));if(_[_0x0474('0x92')](_0x5688d5,['role','user'])&&_0x4cfe44[_0x0474('0x2f')][_0x0474('0x29')]!==_0x0474('0x2e')){throw new Error(_0x0474('0x89'));}if(_[_0x0474('0x92')](_0x5688d5,[_0x0474('0x29'),_0x0474('0x2e')])&&_0x4cfe44[_0x0474('0x2f')]['role']!==_0x0474('0x2e')){throw new Error(_0x0474('0x93'));}return licenseUtil['checkUserLimits'](_0x5688d5)[_0x0474('0x16')](function(){return validateUser(_0x5688d5[0x0]);})['then'](function(){for(var _0x324247=0x1;_0x324247<_0x5688d5[_0x0474('0x50')];_0x324247++){var _0x4c6c5e=_0x5688d5[_0x324247-0x1][_0x0474('0x6b')];if(!_0x5688d5[_0x324247][_0x0474('0x6b')])_0x5688d5[_0x324247][_0x0474('0x6b')]=_0x4c6c5e+0x1;_0x1114da[_0x0474('0x4d')](validateUser(_0x5688d5[_0x324247]));}return Promise[_0x0474('0x58')](_0x1114da);})[_0x0474('0x16')](function(){_0x1114da=[];for(var _0x49a049=0x0;_0x49a049<_0x5688d5[_0x0474('0x50')];_0x49a049++){_0x1114da['push'](updateUser(_0x5688d5[_0x49a049]));}return Promise[_0x0474('0x58')](_0x1114da);})[_0x0474('0x16')](function(){_0x1114da=_0x5688d5[_0x0474('0x35')](function(_0x33adac){return db[_0x0474('0x3f')][_0x0474('0x88')](_0x33adac,{'include':[{'model':db['VoiceMail'],'as':_0x0474('0x79')}]})[_0x0474('0x16')](function(_0x1dd22f){_0x33adac['id']=_0x1dd22f['id'];return _0x33adac;});});return Promise[_0x0474('0x58')](_0x1114da);})['then'](function(_0x4f7654){if(_0x4cfe44['body']['role']==='user')return _0x4f7654;if(_0x4cfe44[_0x0474('0x2f')][_0x0474('0x29')]!=='user')return _0x4f7654;var _0x5927cc=_['some'](_0x4f7654,function(_0x1e075f){return _0x1e075f[_0x0474('0x29')]==='agent'||_0x1e075f['role']===_0x0474('0x32');});if(!_0x5927cc)return _0x4f7654;return db[_0x0474('0x94')][_0x0474('0x95')]({'where':{'name':{'$or':[_0x0474('0x30'),_0x0474('0x31')]},'userProfileId':_0x4cfe44[_0x0474('0x2f')]['userProfileId']},'raw':!![]})[_0x0474('0x16')](function(_0x3bbbbc){if(_[_0x0474('0x96')](_0x3bbbbc)||!_[_0x0474('0x92')](_0x3bbbbc,[_0x0474('0x8e'),0x0]))return _0x4f7654;_0x1114da=[];var _0x10535e=_(_0x3bbbbc)[_0x0474('0x35')](function(_0x2745af){if(_0x2745af[_0x0474('0x8e')]===0x1)return;return _0x2745af[_0x0474('0x39')]===_0x0474('0x30')?'agent':_0x0474('0x32');})[_0x0474('0x97')]()['value']();for(var _0x1cf0d0=0x0;_0x1cf0d0<_0x4f7654['length'];_0x1cf0d0++){if(!_['includes'](_0x10535e,_0x4f7654[_0x1cf0d0][_0x0474('0x29')]))return;var _0x5ae811=_0x4f7654[_0x1cf0d0][_0x0474('0x29')]===_0x0474('0x2a')?_0x0474('0x30'):'Telephones';_0x1114da['push'](db[_0x0474('0x3a')][_0x0474('0x88')]({'name':_0x4f7654[_0x1cf0d0][_0x0474('0x39')],'resourceId':_0x4f7654[_0x1cf0d0]['id'],'type':_0x5ae811,'sectionId':_['find'](_0x3bbbbc,['name',_0x5ae811])['id']},{}));}return Promise[_0x0474('0x58')](_0x1114da);});})[_0x0474('0x16')](respondWithResult(_0x3174db,0xc9))[_0x0474('0x1f')](handleError(_0x3174db,null));};exports['changePassword']=function(_0x56d311,_0x31e8a5){if(_0x56d311[_0x0474('0x65')]['id']){delete _0x56d311[_0x0474('0x65')]['id'];}return db[_0x0474('0x3f')]['find']({'where':{'id':_0x56d311[_0x0474('0x66')]['id']}})['then'](function(_0xa25d95){if(!_0xa25d95)return null;if(_0xa25d95['id']===_0x56d311[_0x0474('0x2f')]['id']){if(!_0x56d311[_0x0474('0x65')][_0x0474('0x98')]||!_0x56d311[_0x0474('0x65')][_0x0474('0x99')]){throw new db['Sequelize'][(_0x0474('0x9a'))](_0x0474('0x9b'));}if(!_0xa25d95[_0x0474('0x9c')](_0x56d311[_0x0474('0x65')][_0x0474('0x98')])){throw new db['Sequelize'][(_0x0474('0x9a'))](_0x0474('0x9d'));}if(_0x56d311[_0x0474('0x65')][_0x0474('0x98')]===_0x56d311[_0x0474('0x65')][_0x0474('0x99')]){throw new db['Sequelize'][(_0x0474('0x9a'))](_0x0474('0x9e'));}}else if(_0x56d311[_0x0474('0x2f')]['role']===_0x0474('0x2e')){if(!_0x56d311['body'][_0x0474('0x99')]){throw new db[(_0x0474('0x9f'))][(_0x0474('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x56d311[_0x0474('0x2f')][_0x0474('0x29')]===_0x0474('0x2f')){if(!_0x56d311[_0x0474('0x65')][_0x0474('0x99')]){throw new db['Sequelize']['ValidationError'](_0x0474('0xa0'));}if(_0xa25d95['role']!==_0x0474('0x2a')){throw new db[(_0x0474('0x9f'))]['ValidationError'](_0x0474('0x91'));}}else{throw new db[(_0x0474('0x9f'))]['ValidationError'](_0x0474('0x91'));}return _0xa25d95;})[_0x0474('0x16')](handleEntityNotFound(_0x31e8a5,null))[_0x0474('0x16')](function(_0x25a9bd){return db[_0x0474('0x6c')][_0x0474('0xa1')]({'attributes':['id',_0x0474('0x6e'),_0x0474('0xa2'),_0x0474('0xa3')]})[_0x0474('0x16')](function(_0x474ea0){if(_0x474ea0['securePassword'])authService[_0x0474('0x6f')](_0x56d311[_0x0474('0x65')][_0x0474('0x99')]);if(!_0x474ea0[_0x0474('0xa2')]||!_0x25a9bd[_0x0474('0xa4')])return _0x25a9bd;authService[_0x0474('0xa5')](_0x56d311['body']['newPassword'],_0x25a9bd[_0x0474('0xa4')],_0x474ea0['passwordHistoryLimit']);return _0x25a9bd;})[_0x0474('0x16')](saveUpdates({'password':_0x56d311[_0x0474('0x65')][_0x0474('0x99')],'passwordResetAt':_0x56d311[_0x0474('0x2f')]['id']==_0x56d311['params']['id']?moment():null,'previousPasswords':authService[_0x0474('0xa6')](_0x56d311[_0x0474('0x65')]['newPassword'],_0x25a9bd['previousPasswords'])},null));})[_0x0474('0x16')](respondWithResult(_0x31e8a5,null))[_0x0474('0x1f')](handleError(_0x31e8a5,null));};exports[_0x0474('0xa7')]=function(_0x46304b,_0x3ae721){var _0x14bbc9=_0x46304b['body']['channel'];return db['User'][_0x0474('0x38')]({'where':{'id':_0x46304b[_0x0474('0x66')]['id']},'attributes':['id',_0x0474('0x39'),_0x0474('0x29'),_0x0474('0xa8'),_0x0474('0xa9'),'voicePause',_0x0474('0xaa')]})[_0x0474('0x16')](handleEntityNotFound(_0x3ae721,null))[_0x0474('0x16')](function(_0x118975){if(_0x118975){if(!utils['isValidChannel'](_0x14bbc9)){throw new db[(_0x0474('0x9f'))][(_0x0474('0x9a'))]('Unknown\x20channel');}return _0x118975['add'+_[_0x0474('0xab')](_0x14bbc9[_0x0474('0xac')]())+_0x0474('0xad')](_0x46304b[_0x0474('0x65')]['ids'],{'penalty':_0x46304b['body']['penalty']||0x0})[_0x0474('0xae')](function(_0x46dbfb){for(var _0x22af0d=0x0;_0x22af0d<_0x46304b[_0x0474('0x65')][_0x0474('0x69')][_0x0474('0x50')];_0x22af0d+=0x1){var _0xa06a76={'UserId':Number(_0x46304b[_0x0474('0x66')]['id'])};_0xa06a76[_[_0x0474('0xab')](_0x14bbc9[_0x0474('0xac')]())+_0x0474('0xaf')]=Number(_0x46304b[_0x0474('0x65')][_0x0474('0x69')][_0x22af0d]);socket[_0x0474('0x2b')](_0x0474('0x2f')+_[_0x0474('0xab')](_0x14bbc9['toLowerCase']())+_0x0474('0xb0'),_0xa06a76);}return _0x46dbfb;})[_0x0474('0x16')](function(){if(_0x14bbc9==='voice'){return db[_0x0474('0xb1')][_0x0474('0x95')]({'where':{'id':_0x46304b[_0x0474('0x65')][_0x0474('0x69')]||[]},'raw':!![],'attributes':['id',_0x0474('0x39')]});}})['then'](function(_0x402e5b){var _0x26c2bb=_0x118975[_0x0474('0x2d')]({'plain':!![]});var _0x50ff50=[];if(_0x14bbc9==='voice'&&_0x26c2bb[_0x0474('0x29')]===_0x0474('0x2a')&&_0x26c2bb['online']){for(let _0x1b7209=0x0;_0x1b7209<_0x402e5b[_0x0474('0x50')];_0x1b7209+=0x1){_0x50ff50[_0x0474('0x4d')]({'membername':_0x26c2bb[_0x0474('0x39')],'UserId':_0x26c2bb['id'],'queue_name':_0x402e5b[_0x1b7209]['name'],'VoiceQueueId':_0x402e5b[_0x1b7209]['id'],'interface':_[_0x0474('0x71')](_0x26c2bb[_0x0474('0xaa')])?util['format'](_0x0474('0xb2'),_0x26c2bb['name']):_0x26c2bb[_0x0474('0xaa')],'paused':_0x26c2bb['voicePause']||![],'penalty':_0x46304b[_0x0474('0x65')][_0x0474('0xb3')]||0x0});}return Promise[_0x0474('0x58')](_0x50ff50[_0x0474('0x35')](function(_0x839815){return db['UserVoiceQueueRt'][_0x0474('0xb4')](_0x839815);}));}return _0x118975;});}})[_0x0474('0x16')](respondWithStatusCode(_0x3ae721,null))[_0x0474('0x1f')](handleError(_0x3ae721,null));};exports[_0x0474('0xb5')]=function(_0x24dd74,_0x30fdd1){var _0x27c4c1,_0x3b8a9d;return db[_0x0474('0x3f')][_0x0474('0x38')]({'where':{'id':_0x24dd74['params']['id']},'attributes':['id',_0x0474('0x39'),_0x0474('0x29')]})[_0x0474('0x16')](handleEntityNotFound(_0x30fdd1,null))[_0x0474('0x16')](function(_0x30f6b4){if(_0x30f6b4){_0x27c4c1=_0x30f6b4;if(!_0x24dd74[_0x0474('0x49')][_0x0474('0xb6')]||!utils[_0x0474('0xb7')](_0x24dd74[_0x0474('0x49')]['channel'])){throw new db[(_0x0474('0x9f'))][(_0x0474('0x9a'))](_0x0474('0xb8'));}return _0x30f6b4[_0x0474('0xb9')+_[_0x0474('0xab')](_0x24dd74['query'][_0x0474('0xb6')][_0x0474('0xac')]())+'Queues'](_0x24dd74[_0x0474('0x49')][_0x0474('0x69')]);}})[_0x0474('0x16')](function(_0x5e4296){if(_[_0x0474('0xba')](_0x24dd74[_0x0474('0x49')][_0x0474('0x69')])){for(var _0x517521=0x0;_0x517521<_0x24dd74[_0x0474('0x49')]['ids'][_0x0474('0x50')];_0x517521+=0x1){_0x3b8a9d={'UserId':Number(_0x24dd74[_0x0474('0x66')]['id'])};_0x3b8a9d[_[_0x0474('0xab')](_0x24dd74[_0x0474('0x49')][_0x0474('0xb6')]['toLowerCase']())+_0x0474('0xaf')]=Number(_0x24dd74[_0x0474('0x49')][_0x0474('0x69')][_0x517521]);socket['emit'](_0x0474('0x2f')+_[_0x0474('0xab')](_0x24dd74[_0x0474('0x49')][_0x0474('0xb6')]['toLowerCase']())+'Queue:remove',_0x3b8a9d);}}else{_0x3b8a9d={'UserId':Number(_0x24dd74['params']['id'])};_0x3b8a9d[_[_0x0474('0xab')](_0x24dd74['query'][_0x0474('0xb6')]['toLowerCase']())+'QueueId']=Number(_0x24dd74[_0x0474('0x49')][_0x0474('0x69')]);socket[_0x0474('0x2b')](_0x0474('0x2f')+_['capitalize'](_0x24dd74[_0x0474('0x49')][_0x0474('0xb6')][_0x0474('0xac')]())+_0x0474('0xbb'),_0x3b8a9d);}return _0x5e4296;})[_0x0474('0x16')](function(){if(_0x24dd74[_0x0474('0x49')]['channel']===_0x0474('0xbc')){return db['UserVoiceQueueRt'][_0x0474('0x2c')]({'where':{'UserId':_0x24dd74['params']['id'],'VoiceQueueId':_0x24dd74[_0x0474('0x49')]['ids']},'individualHooks':!![]})[_0x0474('0x16')](function(){return _0x27c4c1;});}return _0x27c4c1;})[_0x0474('0x16')](respondWithStatusCode(_0x30fdd1,null))[_0x0474('0x1f')](handleError(_0x30fdd1,null));};exports[_0x0474('0xbd')]=function(_0x6adc02,_0x2e84a1){_0x6adc02['body'][_0x0474('0xbe')]=_0x6adc02[_0x0474('0xbf')]['filename'];return db[_0x0474('0x3f')][_0x0474('0x38')]({'where':{'id':_0x6adc02[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x2e84a1,null))[_0x0474('0x16')](saveUpdates(_0x6adc02[_0x0474('0x65')],null))[_0x0474('0x16')](respondWithResult(_0x2e84a1,null))['catch'](handleError(_0x2e84a1,null));};exports[_0x0474('0xc0')]=function(_0x6c2755,_0x1499fe){var _0x55dcdd=path['join'](config[_0x0474('0xc1')],_0x0474('0xc2'));return db[_0x0474('0x3f')][_0x0474('0x38')]({'where':{'id':_0x6c2755[_0x0474('0x66')]['id']},'attributes':['id',_0x0474('0xbe')],'raw':!![]})['then'](handleEntityNotFound(_0x1499fe,null))[_0x0474('0x16')](function(_0x2826d6){if(_0x2826d6){if(_['isNil'](_0x2826d6[_0x0474('0xbe')])){return _0x1499fe['download'](_0x55dcdd);}else{if(!fs[_0x0474('0xc3')](path[_0x0474('0xc4')](config['root'],_0x0474('0xc5'),_0x2826d6[_0x0474('0xbe')]))){return _0x1499fe[_0x0474('0xc6')](_0x55dcdd);}return _0x1499fe[_0x0474('0xc6')](path[_0x0474('0xc4')](config[_0x0474('0xc1')],_0x0474('0xc5'),_0x2826d6[_0x0474('0xbe')]));}}})[_0x0474('0x1f')](handleError(_0x1499fe,null));};exports[_0x0474('0xc7')]=function(_0x1a097a,_0x589719){return db[_0x0474('0x3f')][_0x0474('0x38')]({'where':{'id':_0x1a097a[_0x0474('0x66')]['id']},'attributes':['id']})[_0x0474('0x16')](handleEntityNotFound(_0x589719,null))[_0x0474('0x16')](function(_0x1247cb){var _0x5d1381=[];values=_0x1247cb[_0x0474('0x52')];_0x5d1381[_0x0474('0x4d')](get_open_tabs('chat',_0x1247cb['dataValues']));_0x5d1381[_0x0474('0x4d')](get_open_tabs(_0x0474('0x53'),_0x1247cb['dataValues']));_0x5d1381['push'](get_open_tabs(_0x0474('0x56'),_0x1247cb[_0x0474('0x52')]));_0x5d1381[_0x0474('0x4d')](get_open_tabs(_0x0474('0x57'),_0x1247cb[_0x0474('0x52')]));_0x5d1381[_0x0474('0x4d')](get_open_tabs('fax',_0x1247cb['dataValues']));_0x5d1381['push'](get_open_tabs(_0x0474('0x55'),_0x1247cb['dataValues']));return Promise[_0x0474('0x58')](_0x5d1381);})[_0x0474('0x16')](function(_0x98b604){if(_0x98b604){var _0x312aaf=_[_0x0474('0x35')](values[_0x0474('0xc8')],function(_0x1572da){return{'channel':_0x0474('0xc9'),'id':_0x1572da['id'],'createdAt':_0x1572da[_0x0474('0xca')]};});var _0x303749=_['map'](values[_0x0474('0xcb')],function(_0x2b4916){return{'channel':_0x0474('0xcc'),'id':_0x2b4916['id'],'createdAt':_0x2b4916['createdAt']};});var _0x43637f=_[_0x0474('0x35')](values[_0x0474('0xcd')],function(_0x438ed2){return{'channel':_0x0474('0xce'),'id':_0x438ed2['id'],'createdAt':_0x438ed2[_0x0474('0xca')]};});var _0x3983c7=_['map'](values[_0x0474('0xcf')],function(_0x3aa7f1){return{'channel':_0x0474('0xd0'),'id':_0x3aa7f1['id'],'createdAt':_0x3aa7f1[_0x0474('0xca')]};});var _0x13d9da=_['map'](values[_0x0474('0xd1')],function(_0x963709){return{'channel':_0x0474('0xd2'),'id':_0x963709['id'],'createdAt':_0x963709[_0x0474('0xca')]};});var _0x2b0690=_['map'](values[_0x0474('0xd3')],function(_0x48ac7b){return{'channel':_0x0474('0xd4'),'id':_0x48ac7b['id'],'createdAt':_0x48ac7b[_0x0474('0xca')]};});var _0x4a7719=_['concat'](_0x312aaf,_0x303749,_0x43637f,_0x3983c7,_0x13d9da,_0x2b0690);var _0x476230={'count':_0x4a7719[_0x0474('0x50')],'rows':_0x4a7719};return _0x476230;}else return null;})['then'](respondWithResult(_0x589719,null))[_0x0474('0x1f')](handleError(_0x589719,null));};exports['getContacts']=function(_0x5a7125,_0x470d87){var _0x110cfa={};var _0x4e3c1a={};var _0x280029;var _0x3256e0;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x5a7125[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x470d87,null))[_0x0474('0x16')](function(_0x5026ae){if(_0x5026ae){_0x280029=_0x5026ae;_0x4e3c1a[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0xd5')]['rawAttributes']);_0x4e3c1a['query']=_['keys'](_0x5a7125[_0x0474('0x49')]);_0x4e3c1a['filters']=_[_0x0474('0x5f')](_0x4e3c1a[_0x0474('0x5a')],_0x4e3c1a[_0x0474('0x49')]);_0x110cfa['attributes']=_[_0x0474('0x5f')](_0x4e3c1a[_0x0474('0x5a')],qs['fields'](_0x5a7125['query'][_0x0474('0x61')]));_0x110cfa['attributes']=_0x110cfa[_0x0474('0x60')][_0x0474('0x50')]?_0x110cfa['attributes']:_0x4e3c1a['model'];_0x110cfa[_0x0474('0xd6')]=qs['sort'](_0x5a7125[_0x0474('0x49')][_0x0474('0xd7')]);_0x110cfa[_0x0474('0x46')]=qs['filters'](_[_0x0474('0xd8')](_0x5a7125[_0x0474('0x49')],_0x4e3c1a[_0x0474('0x5e')]));if(_0x5a7125[_0x0474('0x49')]['filter']){_0x110cfa[_0x0474('0x46')]=_[_0x0474('0x62')](_0x110cfa[_0x0474('0x46')],{'$or':_['map'](_0x110cfa[_0x0474('0x60')],function(_0x335660){var _0x2ba17a={};_0x2ba17a[_0x335660]={'$like':'%'+_0x5a7125[_0x0474('0x49')]['filter']+'%'};return _0x2ba17a;})});}_0x110cfa=_[_0x0474('0x62')]({},_0x110cfa,_0x5a7125[_0x0474('0x63')]);return _0x280029[_0x0474('0xd9')](_0x110cfa);}})[_0x0474('0x16')](function(_0x569e5e){if(_0x569e5e){_0x3256e0=_0x569e5e[_0x0474('0x50')];if(_0x5a7125['query'][_0x0474('0xda')]('includeAll')){_0x110cfa[_0x0474('0x48')]=[{'model':db[_0x0474('0xdb')],'as':_0x0474('0xdc'),'required':![]},{'model':db[_0x0474('0xdd')],'as':'Tags','attributes':['id','name',_0x0474('0xde')],'where':_0x5a7125['query'][_0x0474('0xdf')]?{'id':_0x5a7125[_0x0474('0x49')][_0x0474('0xdf')]}:undefined,'required':_0x5a7125[_0x0474('0x49')][_0x0474('0xdf')]?!![]:![]}];}if(!_0x5a7125[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0x110cfa['limit']=qs['limit'](_0x5a7125['query'][_0x0474('0x23')]);_0x110cfa[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x5a7125[_0x0474('0x49')][_0x0474('0x22')]);}return _0x280029['getContacts'](_0x110cfa);}})['then'](function(_0x4378ab){if(_0x4378ab){return _0x4378ab?{'count':_0x3256e0,'rows':_0x4378ab}:null;}})[_0x0474('0x16')](respondWithResult(_0x470d87,null))[_0x0474('0x1f')](handleError(_0x470d87,null));};exports[_0x0474('0xe1')]=function(_0xe8c675,_0x38250e){var _0x53b67a;var _0x303606={};var _0x156921;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0xe8c675[_0x0474('0x66')]['id']},'attributes':['id',_0x0474('0x39'),_0x0474('0x29')]})[_0x0474('0x16')](handleEntityNotFound(_0x38250e,null))[_0x0474('0x16')](function(_0x1fe0d4){if(!utils[_0x0474('0xb7')](_0xe8c675[_0x0474('0x49')][_0x0474('0xb6')])){throw new db[(_0x0474('0x9f'))][(_0x0474('0x9a'))]('Unknown\x20channel');}_0x53b67a=_0x1fe0d4;var _0x27d87e={};_0x27d87e[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_[_0x0474('0xab')](_0xe8c675[_0x0474('0x49')][_0x0474('0xb6')])+'Queue'][_0x0474('0x5d')]);_0x27d87e[_0x0474('0x49')]=_[_0x0474('0x5c')](_0xe8c675['query']);_0x27d87e[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0x27d87e['model'],_0x27d87e[_0x0474('0x49')]);_0x303606[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x27d87e[_0x0474('0x5a')],qs[_0x0474('0x61')](_0xe8c675['query'][_0x0474('0x61')]));_0x303606[_0x0474('0x60')]=_0x303606[_0x0474('0x60')][_0x0474('0x50')]?_0x303606[_0x0474('0x60')]:_0x27d87e[_0x0474('0x5a')];_0x303606[_0x0474('0xd6')]=qs['sort'](_0xe8c675[_0x0474('0x49')][_0x0474('0xd7')]);_0x303606['where']=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0xe8c675[_0x0474('0x49')],_0x27d87e[_0x0474('0x5e')]));if(_0xe8c675['query']['filter']){_0x303606['where']=_[_0x0474('0x62')](_0x303606['where'],{'$or':_[_0x0474('0x35')](_0x303606['attributes'],function(_0x4fc82d){var _0x5ed36d={};_0x5ed36d[_0x4fc82d]={'$like':'%'+_0xe8c675[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x5ed36d;})});}_0x303606=_[_0x0474('0x62')]({},_0x303606,_0xe8c675[_0x0474('0x63')]);switch(_0x53b67a[_0x0474('0x29')]){case _0x0474('0x2e'):return db[_[_0x0474('0xab')](_0xe8c675['query'][_0x0474('0xb6')])+_0x0474('0xe2')][_0x0474('0x95')](_0x303606);case _0x0474('0x2f'):case _0x0474('0x2a'):return _0x53b67a[_0x0474('0x2d')+_[_0x0474('0xab')](_0xe8c675[_0x0474('0x49')][_0x0474('0xb6')])+_0x0474('0xad')](_0x303606);default:throw new db['Sequelize'][(_0x0474('0x9a'))](_0x0474('0xe3'));}})[_0x0474('0x16')](function(_0xe64f5){_0x156921=_0xe64f5[_0x0474('0x50')];if(!_0xe8c675['query'][_0x0474('0xda')](_0x0474('0xe0'))){_0x303606[_0x0474('0x23')]=qs[_0x0474('0x23')](_0xe8c675[_0x0474('0x49')]['limit']);_0x303606[_0x0474('0x22')]=qs[_0x0474('0x22')](_0xe8c675[_0x0474('0x49')][_0x0474('0x22')]);}switch(_0x53b67a[_0x0474('0x29')]){case _0x0474('0x2e'):return db[_['capitalize'](_0xe8c675[_0x0474('0x49')][_0x0474('0xb6')])+_0x0474('0xe2')][_0x0474('0x95')](_0x303606);case _0x0474('0x2f'):case _0x0474('0x2a'):return _0x53b67a[_0x0474('0x2d')+_[_0x0474('0xab')](_0xe8c675[_0x0474('0x49')][_0x0474('0xb6')])+'Queues'](_0x303606);}})[_0x0474('0x16')](function(_0x6552d){return{'count':_0x156921,'rows':_0x6552d};})[_0x0474('0x16')](respondWithResult(_0x38250e,null))[_0x0474('0x1f')](handleError(_0x38250e,null));};exports['getVoiceQueuesRt']=function(_0x3d2d0d,_0x8b22e7){var _0x3a7006={};var _0x4b60e5={};var _0x409543;var _0x1dc394;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x3d2d0d[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x8b22e7,null))[_0x0474('0x16')](function(_0x391dc2){if(_0x391dc2){_0x409543=_0x391dc2;_0x4b60e5[_0x0474('0x5a')]=_[_0x0474('0x5c')](db['UserVoiceQueueRt'][_0x0474('0x5d')]);_0x4b60e5[_0x0474('0x49')]=_[_0x0474('0x5c')](_0x3d2d0d['query']);_0x4b60e5['filters']=_[_0x0474('0x5f')](_0x4b60e5['model'],_0x4b60e5['query']);_0x3a7006[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x4b60e5[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x3d2d0d[_0x0474('0x49')]['fields']));_0x3a7006['attributes']=_0x3a7006[_0x0474('0x60')][_0x0474('0x50')]?_0x3a7006[_0x0474('0x60')]:_0x4b60e5['model'];_0x3a7006[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x3d2d0d['query'][_0x0474('0xd7')]);_0x3a7006[_0x0474('0x46')]=qs['filters'](_[_0x0474('0xd8')](_0x3d2d0d[_0x0474('0x49')],_0x4b60e5['filters']));if(_0x3d2d0d[_0x0474('0x49')][_0x0474('0x33')]){_0x3a7006['where']=_[_0x0474('0x62')](_0x3a7006['where'],{'$or':_[_0x0474('0x35')](_0x3a7006[_0x0474('0x60')],function(_0x4f9880){var _0x11ae4a={};_0x11ae4a[_0x4f9880]={'$like':'%'+_0x3d2d0d[_0x0474('0x49')]['filter']+'%'};return _0x11ae4a;})});}_0x3a7006=_[_0x0474('0x62')]({},_0x3a7006,_0x3d2d0d['options']);return _0x409543[_0x0474('0xe4')](_0x3a7006);}})[_0x0474('0x16')](function(_0x239355){if(_0x239355){_0x1dc394=_0x239355[_0x0474('0x50')];if(!_0x3d2d0d[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0x3a7006[_0x0474('0x23')]=qs['limit'](_0x3d2d0d[_0x0474('0x49')][_0x0474('0x23')]);_0x3a7006['offset']=qs['offset'](_0x3d2d0d[_0x0474('0x49')][_0x0474('0x22')]);}return _0x409543[_0x0474('0xe4')](_0x3a7006);}})[_0x0474('0x16')](function(_0x2ec153){if(_0x2ec153){return _0x2ec153?{'count':_0x1dc394,'rows':_0x2ec153}:null;}})['then'](respondWithResult(_0x8b22e7,null))['catch'](handleError(_0x8b22e7,null));};exports['getGroups']=function(_0x5f9ef2,_0x6f3b8){var _0x51c6f0={};var _0x17968b={};var _0x274862;var _0x10796e;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x5f9ef2[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x6f3b8,null))[_0x0474('0x16')](function(_0x28a978){if(_0x28a978){_0x274862=_0x28a978;_0x17968b[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0xe5')][_0x0474('0x5d')]);_0x17968b[_0x0474('0x49')]=_[_0x0474('0x5c')](_0x5f9ef2[_0x0474('0x49')]);_0x17968b[_0x0474('0x5e')]=_['intersection'](_0x17968b['model'],_0x17968b[_0x0474('0x49')]);_0x51c6f0[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x17968b[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x5f9ef2[_0x0474('0x49')]['fields']));_0x51c6f0[_0x0474('0x60')]=_0x51c6f0[_0x0474('0x60')][_0x0474('0x50')]?_0x51c6f0[_0x0474('0x60')]:_0x17968b[_0x0474('0x5a')];_0x51c6f0[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x5f9ef2[_0x0474('0x49')]['sort']);_0x51c6f0[_0x0474('0x46')]=qs[_0x0474('0x5e')](_['pick'](_0x5f9ef2[_0x0474('0x49')],_0x17968b['filters']));if(_0x5f9ef2[_0x0474('0x49')]['filter']){_0x51c6f0[_0x0474('0x46')]=_['merge'](_0x51c6f0[_0x0474('0x46')],{'$or':_[_0x0474('0x35')](_0x51c6f0[_0x0474('0x60')],function(_0x5359b8){var _0x3cd7c8={};_0x3cd7c8[_0x5359b8]={'$like':'%'+_0x5f9ef2[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x3cd7c8;})});}_0x51c6f0=_[_0x0474('0x62')]({},_0x51c6f0,_0x5f9ef2[_0x0474('0x63')]);return _0x274862[_0x0474('0xe6')](_0x51c6f0);}})[_0x0474('0x16')](function(_0x63385a){if(_0x63385a){_0x10796e=_0x63385a[_0x0474('0x50')];if(!_0x5f9ef2[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0x51c6f0[_0x0474('0x23')]=qs[_0x0474('0x23')](_0x5f9ef2[_0x0474('0x49')]['limit']);_0x51c6f0[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x5f9ef2[_0x0474('0x49')][_0x0474('0x22')]);}return _0x274862[_0x0474('0xe6')](_0x51c6f0);}})['then'](function(_0x482b41){if(_0x482b41){return _0x482b41?{'count':_0x10796e,'rows':_0x482b41}:null;}})[_0x0474('0x16')](respondWithResult(_0x6f3b8,null))['catch'](handleError(_0x6f3b8,null));};exports[_0x0474('0xe7')]=function(_0x569af7,_0x51cc19){var _0x8c3f5c={'raw':!![],'where':{}};var _0x4db326={};var _0x5d5150={'count':0x0,'rows':[]};return db['User'][_0x0474('0xa1')]({'where':{'id':_0x569af7['params']['id']}})['then'](handleEntityNotFound(_0x51cc19,null))[_0x0474('0x16')](function(_0x3db120){if(_0x3db120){_0x4db326['model']=_[_0x0474('0x5c')](db[_0x0474('0xe8')][_0x0474('0x5d')]);_0x4db326[_0x0474('0x49')]=_[_0x0474('0x5c')](_0x569af7[_0x0474('0x49')]);_0x4db326[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0x4db326[_0x0474('0x5a')],_0x4db326[_0x0474('0x49')]);_0x8c3f5c[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x4db326[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x569af7[_0x0474('0x49')][_0x0474('0x61')]));_0x8c3f5c[_0x0474('0x60')]=_0x8c3f5c[_0x0474('0x60')][_0x0474('0x50')]?_0x8c3f5c['attributes']:_0x4db326[_0x0474('0x5a')];if(!_0x569af7['query'][_0x0474('0xda')](_0x0474('0xe0'))){_0x8c3f5c[_0x0474('0x23')]=qs[_0x0474('0x23')](_0x569af7[_0x0474('0x49')][_0x0474('0x23')]);_0x8c3f5c[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x569af7[_0x0474('0x49')][_0x0474('0x22')]);}_0x8c3f5c['order']=qs[_0x0474('0xd7')](_0x569af7['query'][_0x0474('0xd7')]);_0x8c3f5c[_0x0474('0x46')]=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0x569af7[_0x0474('0x49')],_0x4db326[_0x0474('0x5e')]));_0x8c3f5c[_0x0474('0x46')][_0x0474('0xe9')]=_0x3db120['id'];if(_0x569af7[_0x0474('0x49')][_0x0474('0x33')]){_0x8c3f5c[_0x0474('0x46')]=_[_0x0474('0x62')](_0x8c3f5c[_0x0474('0x46')],{'$or':_['map'](_0x8c3f5c[_0x0474('0x60')],function(_0x26279a){var _0x25247f={};_0x25247f[_0x26279a]={'$like':'%'+_0x569af7[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x25247f;})});}_0x8c3f5c=_[_0x0474('0x62')]({},_0x8c3f5c,_0x569af7[_0x0474('0x63')]);return db['VoiceRecording']['count']({'where':_0x8c3f5c['where']})[_0x0474('0x16')](function(_0x1c7534){_0x5d5150[_0x0474('0x25')]=_0x1c7534;if(_0x569af7[_0x0474('0x49')]['includeAll']){_0x8c3f5c['include']=[{'all':!![]}];}return db[_0x0474('0xe8')][_0x0474('0x95')](_0x8c3f5c);})[_0x0474('0x16')](function(_0x12a81d){_0x5d5150[_0x0474('0x4e')]=_0x12a81d;return _0x5d5150;});}})[_0x0474('0x16')](respondWithFilteredResult(_0x51cc19,_0x8c3f5c))[_0x0474('0x1f')](handleError(_0x51cc19,null));};exports[_0x0474('0xea')]=function(_0x865002,_0x3b485c){var _0x35e2e7={'raw':!![],'where':{}};var _0x4c49e0={};var _0x2d6bd7={'count':0x0,'rows':[]};return db['User'][_0x0474('0xa1')]({'where':{'id':_0x865002[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x3b485c,null))[_0x0474('0x16')](function(_0x5c90de){if(_0x5c90de){_0x4c49e0[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0xeb')][_0x0474('0x5d')]);_0x4c49e0[_0x0474('0x49')]=_['keys'](_0x865002[_0x0474('0x49')]);_0x4c49e0[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0x4c49e0[_0x0474('0x5a')],_0x4c49e0[_0x0474('0x49')]);_0x35e2e7[_0x0474('0x60')]=_['intersection'](_0x4c49e0[_0x0474('0x5a')],qs['fields'](_0x865002['query'][_0x0474('0x61')]));_0x35e2e7[_0x0474('0x60')]=_0x35e2e7[_0x0474('0x60')][_0x0474('0x50')]?_0x35e2e7[_0x0474('0x60')]:_0x4c49e0[_0x0474('0x5a')];if(!_0x865002[_0x0474('0x49')][_0x0474('0xda')]('nolimit')){_0x35e2e7['limit']=qs['limit'](_0x865002['query'][_0x0474('0x23')]);_0x35e2e7[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x865002[_0x0474('0x49')][_0x0474('0x22')]);}_0x35e2e7[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x865002[_0x0474('0x49')][_0x0474('0xd7')]);_0x35e2e7[_0x0474('0x46')]=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0x865002['query'],_0x4c49e0[_0x0474('0x5e')]));_0x35e2e7['where'][_0x0474('0xe9')]=_0x5c90de['id'];if(_0x865002['query'][_0x0474('0x33')]){_0x35e2e7[_0x0474('0x46')]=_[_0x0474('0x62')](_0x35e2e7[_0x0474('0x46')],{'$or':_[_0x0474('0x35')](_0x35e2e7['attributes'],function(_0x53e255){var _0x5c698c={};_0x5c698c[_0x53e255]={'$like':'%'+_0x865002[_0x0474('0x49')]['filter']+'%'};return _0x5c698c;})});}_0x35e2e7=_[_0x0474('0x62')]({},_0x35e2e7,_0x865002[_0x0474('0x63')]);return db[_0x0474('0xeb')][_0x0474('0x25')]({'where':_0x35e2e7[_0x0474('0x46')]})[_0x0474('0x16')](function(_0x2d3884){_0x2d6bd7[_0x0474('0x25')]=_0x2d3884;if(_0x865002[_0x0474('0x49')][_0x0474('0x47')]){_0x35e2e7[_0x0474('0x48')]=[{'all':!![]}];}return db[_0x0474('0xeb')]['findAll'](_0x35e2e7);})[_0x0474('0x16')](function(_0x1c1443){_0x2d6bd7[_0x0474('0x4e')]=_0x1c1443;return _0x2d6bd7;});}})[_0x0474('0x16')](respondWithFilteredResult(_0x3b485c,_0x35e2e7))[_0x0474('0x1f')](handleError(_0x3b485c,null));};exports[_0x0474('0xec')]=function(_0x11772c,_0x5ebb28){var _0xc88e07={};var _0x285920={};var _0x2606d9;var _0x99f4bf;return db['User'][_0x0474('0xa1')]({'where':{'id':_0x11772c['params']['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x5ebb28,null))[_0x0474('0x16')](function(_0x57e50b){if(_0x57e50b){_0x2606d9=_0x57e50b;_0x285920['model']=_[_0x0474('0x5c')](db[_0x0474('0xed')][_0x0474('0x5d')]);_0x285920[_0x0474('0x49')]=_[_0x0474('0x5c')](_0x11772c[_0x0474('0x49')]);_0x285920[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0x285920[_0x0474('0x5a')],_0x285920[_0x0474('0x49')]);_0xc88e07[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x285920[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x11772c[_0x0474('0x49')][_0x0474('0x61')]));_0xc88e07[_0x0474('0x60')]=_0xc88e07[_0x0474('0x60')]['length']?_0xc88e07[_0x0474('0x60')]:_0x285920[_0x0474('0x5a')];_0xc88e07[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x11772c[_0x0474('0x49')][_0x0474('0xd7')]);_0xc88e07[_0x0474('0x46')]=qs[_0x0474('0x5e')](_['pick'](_0x11772c['query'],_0x285920['filters']));if(_0x11772c[_0x0474('0x49')][_0x0474('0x33')]){_0xc88e07[_0x0474('0x46')]=_[_0x0474('0x62')](_0xc88e07['where'],{'$or':_['map'](_0xc88e07[_0x0474('0x60')],function(_0x2270d6){var _0x41e970={};_0x41e970[_0x2270d6]={'$like':'%'+_0x11772c['query'][_0x0474('0x33')]+'%'};return _0x41e970;})});}_0xc88e07=_[_0x0474('0x62')]({},_0xc88e07,_0x11772c['options']);return _0x2606d9[_0x0474('0xec')](_0xc88e07);}})[_0x0474('0x16')](function(_0x337de0){if(_0x337de0){_0x99f4bf=_0x337de0[_0x0474('0x50')];if(!_0x11772c[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0xc88e07[_0x0474('0x23')]=qs[_0x0474('0x23')](_0x11772c[_0x0474('0x49')][_0x0474('0x23')]);_0xc88e07[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x11772c[_0x0474('0x49')][_0x0474('0x22')]);}return _0x2606d9['getChatInteractions'](_0xc88e07);}})[_0x0474('0x16')](function(_0xf50ecb){if(_0xf50ecb){return _0xf50ecb?{'count':_0x99f4bf,'rows':_0xf50ecb}:null;}})[_0x0474('0x16')](respondWithResult(_0x5ebb28,null))['catch'](handleError(_0x5ebb28,null));};exports['getOpenchannelInteractions']=function(_0x3eb306,_0x42a3b2){var _0x429e6e={};var _0x197b42={};var _0x42daf2;var _0x6cb722;return db['User'][_0x0474('0xa1')]({'where':{'id':_0x3eb306['params']['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x42a3b2,null))['then'](function(_0x4b0734){if(_0x4b0734){_0x42daf2=_0x4b0734;_0x197b42['model']=_[_0x0474('0x5c')](db['OpenchannelInteraction'][_0x0474('0x5d')]);_0x197b42['query']=_[_0x0474('0x5c')](_0x3eb306['query']);_0x197b42['filters']=_[_0x0474('0x5f')](_0x197b42[_0x0474('0x5a')],_0x197b42['query']);_0x429e6e[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x197b42[_0x0474('0x5a')],qs['fields'](_0x3eb306[_0x0474('0x49')][_0x0474('0x61')]));_0x429e6e[_0x0474('0x60')]=_0x429e6e[_0x0474('0x60')][_0x0474('0x50')]?_0x429e6e[_0x0474('0x60')]:_0x197b42[_0x0474('0x5a')];_0x429e6e[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x3eb306[_0x0474('0x49')][_0x0474('0xd7')]);_0x429e6e[_0x0474('0x46')]=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0x3eb306[_0x0474('0x49')],_0x197b42['filters']));if(_0x3eb306[_0x0474('0x49')][_0x0474('0x33')]){_0x429e6e[_0x0474('0x46')]=_['merge'](_0x429e6e[_0x0474('0x46')],{'$or':_[_0x0474('0x35')](_0x429e6e[_0x0474('0x60')],function(_0x912b9f){var _0x45b5e6={};_0x45b5e6[_0x912b9f]={'$like':'%'+_0x3eb306[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x45b5e6;})});}_0x429e6e=_['merge']({},_0x429e6e,_0x3eb306[_0x0474('0x63')]);return _0x42daf2[_0x0474('0xee')](_0x429e6e);}})[_0x0474('0x16')](function(_0x1717c1){if(_0x1717c1){_0x6cb722=_0x1717c1[_0x0474('0x50')];if(!_0x3eb306[_0x0474('0x49')][_0x0474('0xda')]('nolimit')){_0x429e6e[_0x0474('0x23')]=qs[_0x0474('0x23')](_0x3eb306[_0x0474('0x49')][_0x0474('0x23')]);_0x429e6e[_0x0474('0x22')]=qs['offset'](_0x3eb306['query']['offset']);}return _0x42daf2[_0x0474('0xee')](_0x429e6e);}})['then'](function(_0x1dd960){if(_0x1dd960){return _0x1dd960?{'count':_0x6cb722,'rows':_0x1dd960}:null;}})['then'](respondWithResult(_0x42a3b2,null))[_0x0474('0x1f')](handleError(_0x42a3b2,null));};exports[_0x0474('0xef')]=function(_0x14727e,_0x51ede9){var _0x4f01c0={'raw':!![],'where':{}};var _0x440968={};var _0x29853e={'count':0x0,'rows':[]};return db[_0x0474('0x3f')]['findOne']({'where':{'id':_0x14727e[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x51ede9,null))[_0x0474('0x16')](function(_0x201c4f){if(_0x201c4f){_0x440968[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0xf0')][_0x0474('0x5d')]);_0x440968[_0x0474('0x49')]=_[_0x0474('0x5c')](_0x14727e[_0x0474('0x49')]);_0x440968['filters']=_[_0x0474('0x5f')](_0x440968[_0x0474('0x5a')],_0x440968['query']);_0x4f01c0['attributes']=_['intersection'](_0x440968[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x14727e['query'][_0x0474('0x61')]));_0x4f01c0['attributes']=_0x4f01c0[_0x0474('0x60')]['length']?_0x4f01c0[_0x0474('0x60')]:_0x440968['model'];if(!_0x14727e[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0x4f01c0['limit']=qs[_0x0474('0x23')](_0x14727e[_0x0474('0x49')][_0x0474('0x23')]);_0x4f01c0[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x14727e[_0x0474('0x49')][_0x0474('0x22')]);}_0x4f01c0[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x14727e[_0x0474('0x49')][_0x0474('0xd7')]);_0x4f01c0['where']=qs['filters'](_[_0x0474('0xd8')](_0x14727e[_0x0474('0x49')],_0x440968[_0x0474('0x5e')]));_0x4f01c0[_0x0474('0x46')][_0x0474('0xe9')]=_0x201c4f['id'];if(_0x14727e[_0x0474('0x49')][_0x0474('0x33')]){_0x4f01c0[_0x0474('0x46')]=_[_0x0474('0x62')](_0x4f01c0['where'],{'$or':_[_0x0474('0x35')](_0x4f01c0[_0x0474('0x60')],function(_0x3da5b1){var _0x332609={};_0x332609[_0x3da5b1]={'$like':'%'+_0x14727e[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x332609;})});}_0x4f01c0=_[_0x0474('0x62')]({},_0x4f01c0,_0x14727e[_0x0474('0x63')]);return db['MailInteraction'][_0x0474('0x25')]({'where':_0x4f01c0[_0x0474('0x46')]})[_0x0474('0x16')](function(_0x1db6fc){_0x29853e[_0x0474('0x25')]=_0x1db6fc;if(_0x14727e[_0x0474('0x49')]['includeAll']){_0x4f01c0[_0x0474('0x48')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x4f01c0);})[_0x0474('0x16')](function(_0x55fb11){_0x29853e[_0x0474('0x4e')]=_0x55fb11;return _0x29853e;});}})[_0x0474('0x16')](respondWithFilteredResult(_0x51ede9,_0x4f01c0))[_0x0474('0x1f')](handleError(_0x51ede9,null));};exports[_0x0474('0xf1')]=function(_0xf5c4b5,_0x4e1b8c){var _0x2eb7f0={};var _0x4ffbee={};var _0x409f2e;var _0x43db69;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0xf5c4b5[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x4e1b8c,null))[_0x0474('0x16')](function(_0x520190){if(_0x520190){_0x409f2e=_0x520190;_0x4ffbee[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0xf2')][_0x0474('0x5d')]);_0x4ffbee[_0x0474('0x49')]=_[_0x0474('0x5c')](_0xf5c4b5['query']);_0x4ffbee['filters']=_[_0x0474('0x5f')](_0x4ffbee[_0x0474('0x5a')],_0x4ffbee[_0x0474('0x49')]);_0x2eb7f0['attributes']=_[_0x0474('0x5f')](_0x4ffbee[_0x0474('0x5a')],qs[_0x0474('0x61')](_0xf5c4b5['query']['fields']));_0x2eb7f0['attributes']=_0x2eb7f0[_0x0474('0x60')][_0x0474('0x50')]?_0x2eb7f0[_0x0474('0x60')]:_0x4ffbee['model'];_0x2eb7f0[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0xf5c4b5[_0x0474('0x49')]['sort']);_0x2eb7f0['where']=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0xf5c4b5[_0x0474('0x49')],_0x4ffbee[_0x0474('0x5e')]));if(_0xf5c4b5['query'][_0x0474('0x33')]){_0x2eb7f0[_0x0474('0x46')]=_['merge'](_0x2eb7f0['where'],{'$or':_['map'](_0x2eb7f0[_0x0474('0x60')],function(_0x594725){var _0x3187d5={};_0x3187d5[_0x594725]={'$like':'%'+_0xf5c4b5['query']['filter']+'%'};return _0x3187d5;})});}_0x2eb7f0=_[_0x0474('0x62')]({},_0x2eb7f0,_0xf5c4b5[_0x0474('0x63')]);return _0x409f2e[_0x0474('0xf1')](_0x2eb7f0);}})[_0x0474('0x16')](function(_0x2565cd){if(_0x2565cd){_0x43db69=_0x2565cd[_0x0474('0x50')];if(!_0xf5c4b5['query']['hasOwnProperty']('nolimit')){_0x2eb7f0[_0x0474('0x23')]=qs[_0x0474('0x23')](_0xf5c4b5[_0x0474('0x49')][_0x0474('0x23')]);_0x2eb7f0[_0x0474('0x22')]=qs[_0x0474('0x22')](_0xf5c4b5['query'][_0x0474('0x22')]);}return _0x409f2e[_0x0474('0xf1')](_0x2eb7f0);}})[_0x0474('0x16')](function(_0x25ae4d){if(_0x25ae4d){return _0x25ae4d?{'count':_0x43db69,'rows':_0x25ae4d}:null;}})['then'](respondWithResult(_0x4e1b8c,null))[_0x0474('0x1f')](handleError(_0x4e1b8c,null));};exports[_0x0474('0xf3')]=function(_0x5b2580,_0x530e12){var _0x8cb806={};var _0x1172d0={};var _0x56663d;var _0xa3c714;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x5b2580['params']['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x530e12,null))[_0x0474('0x16')](function(_0x1d9ed5){if(_0x1d9ed5){_0x56663d=_0x1d9ed5;_0x1172d0['model']=_[_0x0474('0x5c')](db[_0x0474('0xf4')][_0x0474('0x5d')]);_0x1172d0['query']=_[_0x0474('0x5c')](_0x5b2580[_0x0474('0x49')]);_0x1172d0[_0x0474('0x5e')]=_['intersection'](_0x1172d0[_0x0474('0x5a')],_0x1172d0[_0x0474('0x49')]);_0x8cb806[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x1172d0[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x5b2580[_0x0474('0x49')][_0x0474('0x61')]));_0x8cb806[_0x0474('0x60')]=_0x8cb806['attributes'][_0x0474('0x50')]?_0x8cb806[_0x0474('0x60')]:_0x1172d0[_0x0474('0x5a')];_0x8cb806[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x5b2580[_0x0474('0x49')]['sort']);_0x8cb806[_0x0474('0x46')]=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0x5b2580[_0x0474('0x49')],_0x1172d0['filters']));if(_0x5b2580[_0x0474('0x49')][_0x0474('0x33')]){_0x8cb806[_0x0474('0x46')]=_[_0x0474('0x62')](_0x8cb806[_0x0474('0x46')],{'$or':_[_0x0474('0x35')](_0x8cb806[_0x0474('0x60')],function(_0x777aaa){var _0x25de70={};_0x25de70[_0x777aaa]={'$like':'%'+_0x5b2580[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x25de70;})});}_0x8cb806=_[_0x0474('0x62')]({},_0x8cb806,_0x5b2580[_0x0474('0x63')]);return _0x56663d['getFaxInteractions'](_0x8cb806);}})[_0x0474('0x16')](function(_0x509915){if(_0x509915){_0xa3c714=_0x509915[_0x0474('0x50')];if(!_0x5b2580['query']['hasOwnProperty'](_0x0474('0xe0'))){_0x8cb806['limit']=qs[_0x0474('0x23')](_0x5b2580[_0x0474('0x49')][_0x0474('0x23')]);_0x8cb806[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x5b2580[_0x0474('0x49')][_0x0474('0x22')]);}return _0x56663d[_0x0474('0xf3')](_0x8cb806);}})[_0x0474('0x16')](function(_0x15d475){if(_0x15d475){return _0x15d475?{'count':_0xa3c714,'rows':_0x15d475}:null;}})[_0x0474('0x16')](respondWithResult(_0x530e12,null))['catch'](handleError(_0x530e12,null));};exports['getWhatsappInteractions']=function(_0x1d5767,_0x1f59d5){var _0x4646bd={};var _0x3b33fd={};var _0x2ecb0a;var _0x4e5382;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x1d5767['params']['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x1f59d5,null))[_0x0474('0x16')](function(_0x2fed1a){if(_0x2fed1a){_0x2ecb0a=_0x2fed1a;_0x3b33fd[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0xf5')][_0x0474('0x5d')]);_0x3b33fd['query']=_[_0x0474('0x5c')](_0x1d5767['query']);_0x3b33fd[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0x3b33fd['model'],_0x3b33fd[_0x0474('0x49')]);_0x4646bd[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x3b33fd[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x1d5767[_0x0474('0x49')]['fields']));_0x4646bd[_0x0474('0x60')]=_0x4646bd[_0x0474('0x60')]['length']?_0x4646bd[_0x0474('0x60')]:_0x3b33fd[_0x0474('0x5a')];_0x4646bd['order']=qs[_0x0474('0xd7')](_0x1d5767['query'][_0x0474('0xd7')]);_0x4646bd[_0x0474('0x46')]=qs['filters'](_['pick'](_0x1d5767['query'],_0x3b33fd[_0x0474('0x5e')]));if(_0x1d5767[_0x0474('0x49')][_0x0474('0x33')]){_0x4646bd['where']=_[_0x0474('0x62')](_0x4646bd[_0x0474('0x46')],{'$or':_[_0x0474('0x35')](_0x4646bd[_0x0474('0x60')],function(_0x4bfe2b){var _0x2434ae={};_0x2434ae[_0x4bfe2b]={'$like':'%'+_0x1d5767[_0x0474('0x49')]['filter']+'%'};return _0x2434ae;})});}_0x4646bd=_[_0x0474('0x62')]({},_0x4646bd,_0x1d5767[_0x0474('0x63')]);return _0x2ecb0a[_0x0474('0xf6')](_0x4646bd);}})[_0x0474('0x16')](function(_0x5b18d1){if(_0x5b18d1){_0x4e5382=_0x5b18d1[_0x0474('0x50')];if(!_0x1d5767[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0x4646bd['limit']=qs['limit'](_0x1d5767[_0x0474('0x49')][_0x0474('0x23')]);_0x4646bd[_0x0474('0x22')]=qs['offset'](_0x1d5767[_0x0474('0x49')][_0x0474('0x22')]);}return _0x2ecb0a[_0x0474('0xf6')](_0x4646bd);}})[_0x0474('0x16')](function(_0x132c64){if(_0x132c64){return _0x132c64?{'count':_0x4e5382,'rows':_0x132c64}:null;}})[_0x0474('0x16')](respondWithResult(_0x1f59d5,null))[_0x0474('0x1f')](handleError(_0x1f59d5,null));};exports[_0x0474('0xf7')]=function(_0x5b1a67,_0x285c55,_0xa859b4){var _0x3f94e0;var _0xb2c93d;var _0x2d6812;var _0xd9b19a=!_['isNil'](_0x5b1a67['params']['id'])?_0x5b1a67['params']['id']:!_[_0x0474('0x71')](_0x5b1a67[_0x0474('0x2f')]['id'])?_0x5b1a67['user']['id']:null;return db[_0x0474('0x3f')][_0x0474('0x38')]({'where':{'id':_0xd9b19a,'role':{'$or':[_0x0474('0x2e'),_0x0474('0x2f'),'agent']}},'attributes':['id',_0x0474('0x39'),_0x0474('0xf8'),'mobile','role',_0x0474('0x6b'),_0x0474('0xa9')]})[_0x0474('0x16')](function(_0x1c196b){if(_0x1c196b){if(_0x1c196b[_0x0474('0x29')]===_0x0474('0x2a')){_0x3f94e0=_0x1c196b;if(_0x5b1a67[_0x0474('0x65')][_0x0474('0xaa')]){_0x2d6812=util[_0x0474('0xf9')]('LOCAL/%s@from-sip/n',_0x3f94e0[_0x5b1a67[_0x0474('0x65')]['interface']]);}else if(_0x5b1a67[_0x0474('0x65')][_0x0474('0xfa')]){_0x2d6812=util['format'](_0x0474('0xb2'),_0x5b1a67[_0x0474('0x65')][_0x0474('0xfa')]);}else{_0x2d6812=util[_0x0474('0xf9')](_0x0474('0xb2'),_0x3f94e0[_0x0474('0x39')]);}socket['to'](util[_0x0474('0xf9')](_0x0474('0xfb'),_0x3f94e0[_0x0474('0x39')]))[_0x0474('0x2b')]('user:forcelogout',{'user':{'id':_0x3f94e0['id'],'name':_0x3f94e0[_0x0474('0x39')]},'ip':_0x5b1a67[_0x0474('0xfc')][_0x0474('0xfd')]||_0x5b1a67[_0x0474('0xfe')][_0x0474('0xff')]||_0x5b1a67[_0x0474('0x100')][_0x0474('0xff')]||_0x5b1a67[_0x0474('0xfe')][_0x0474('0x100')][_0x0474('0xff')]});return db[_0x0474('0x101')][_0x0474('0x2c')]({'where':{'membername':_0x3f94e0['name']},'individualHooks':!![]});}}else{throw new db[(_0x0474('0x9f'))]['ValidationError'](_0x0474('0x102'));}})[_0x0474('0x16')](function(){if(_0x3f94e0){return _0x3f94e0[_0x0474('0x103')]({'raw':!![]});}})[_0x0474('0x16')](function(_0x48db4e){if(_0x3f94e0){if(_0x48db4e){_0xb2c93d=_0x48db4e;if(_0xb2c93d[_0x0474('0x50')]){var _0x28e636=_0xb2c93d[_0x0474('0x35')](function(_0x553cac){var _0x54a936={'membername':_0x3f94e0[_0x0474('0x39')],'UserId':_0x3f94e0['id'],'queue_name':_0x553cac[_0x0474('0x39')],'VoiceQueueId':_0x553cac['id'],'interface':_0x2d6812,'paused':_0x3f94e0[_0x0474('0xa9')]||![],'penalty':_0x553cac['UserVoiceQueue.penalty']||0x0};return db[_0x0474('0x101')][_0x0474('0xb4')](_0x54a936);});return Promise[_0x0474('0x58')](_0x28e636);}}}})[_0x0474('0x16')](function(){if(_0x3f94e0){return db[_0x0474('0x104')][_0x0474('0x95')]({'where':{'membername':_0x3f94e0[_0x0474('0x39')],'exitAt':null}});}})[_0x0474('0x16')](function(_0x16a26e){if(_0x3f94e0){var _0x28e5c6=[];_0x16a26e[_0x0474('0x105')](function(_0x3347ee){_0x28e5c6[_0x0474('0x4d')](_0x3347ee[_0x0474('0x64')]({'exitAt':moment()['format'](_0x0474('0x106'))}));});return Promise[_0x0474('0x58')](_0x28e5c6);}})['then'](function(){if(_0x3f94e0){var _0x6dcc14=[];var _0x463566=[];var _0x427f9d=utils[_0x0474('0x107')]();var _0x1a5559={'membername':_0x3f94e0[_0x0474('0x39')],'interface':_0x2d6812,'enterAt':moment()[_0x0474('0xf9')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3f94e0[_0x0474('0x29')],'internal':_0x3f94e0[_0x0474('0x6b')]};_0x427f9d[_0x0474('0x105')](function(_0x1bfad0){_0x6dcc14[_0x0474('0x4d')](_['merge']({'channel':_0x1bfad0,'type':_0x0474('0x108'),'data1':_0x5b1a67[_0x0474('0x65')][_0x0474('0x109')],'data2':_0x2d6812},_0x1a5559));if(_0x3f94e0[_0x0474('0xa9')]){_0x463566['push'](_[_0x0474('0x62')]({'channel':_0x1bfad0,'type':'PAUSE','data1':'LOGININPAUSE'},_0x1a5559));}});return db[_0x0474('0x104')]['bulkCreate'](_0x6dcc14[_0x0474('0x10a')](_0x463566),{'individualHooks':!![]});}})[_0x0474('0x16')](function(){if(_0x3f94e0){return _0x3f94e0[_0x0474('0x64')]({'online':!![],'lastLoginAt':moment()[_0x0474('0xf9')](_0x0474('0x106')),'voicePause':_0x3f94e0[_0x0474('0xa9')]||![],'mailPause':_0x3f94e0[_0x0474('0xa9')]||![],'chatPause':_0x3f94e0[_0x0474('0xa9')]||![],'faxPause':_0x3f94e0[_0x0474('0xa9')]||![],'smsPause':_0x3f94e0[_0x0474('0xa9')]||![],'openchannelPause':_0x3f94e0[_0x0474('0xa9')]||![],'whatsappPause':_0x3f94e0[_0x0474('0xa9')]||![],'pauseType':_0x3f94e0[_0x0474('0xa9')]?'LOGININPAUSE':null,'interface':_0x2d6812,'lastPauseAt':moment()[_0x0474('0xf9')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0474('0x16')](function(_0x3d70e8){if(_0x5b1a67[_0x0474('0x10b')]){return _0xa859b4();}else{return Promise['resolve'](_0x3d70e8)['then'](respondWithResult(_0x285c55,null));}})[_0x0474('0x1f')](handleError(_0x285c55,null));};exports[_0x0474('0x10c')]=function(_0x3e2038,_0x575579){var _0x5253fa;return db['User'][_0x0474('0x38')]({'where':{'id':_0x3e2038[_0x0474('0x66')]['id'],'role':_0x0474('0x2a')},'attributes':['id',_0x0474('0x39'),_0x0474('0x29')]})[_0x0474('0x16')](handleEntityNotFound(_0x575579,null))[_0x0474('0x16')](function(_0x356379){if(_0x356379){_0x5253fa=_0x356379;return db[_0x0474('0x101')]['destroy']({'where':{'membername':_0x5253fa[_0x0474('0x39')]},'individualHooks':!![]});}})[_0x0474('0x16')](function(){return db[_0x0474('0x104')][_0x0474('0x95')]({'where':{'membername':_0x5253fa[_0x0474('0x39')],'exitAt':null}});})[_0x0474('0x16')](function(_0x28f457){var _0x5ada3d=[];_0x28f457[_0x0474('0x105')](function(_0x4e68ed){_0x5ada3d[_0x0474('0x4d')](_0x4e68ed[_0x0474('0x64')]({'exitAt':moment()[_0x0474('0xf9')](_0x0474('0x106'))}));});return Promise[_0x0474('0x58')](_0x5ada3d);})['then'](function(){return _0x5253fa[_0x0474('0x64')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0474('0x16')](respondWithResult(_0x575579,null))['catch'](handleError(_0x575579,null));};exports['pause']=function(_0xc595f6,_0x497de7){var _0x5ed695;return db['UserVoiceQueueRt'][_0x0474('0x64')]({'paused':0x1},{'where':{'UserId':_0xc595f6[_0x0474('0x66')]['id']},'individualHooks':!![]})[_0x0474('0x16')](function(){return db[_0x0474('0x3f')]['find']({'where':{'id':_0xc595f6[_0x0474('0x66')]['id'],'role':_0x0474('0x2a')},'attributes':['id','name','role','internal','interface',_0x0474('0xa8')]});})[_0x0474('0x16')](handleEntityNotFound(_0x497de7,null))[_0x0474('0x16')](function(_0x3aa7f4){if(_0x3aa7f4){_0x5ed695=_0x3aa7f4;return respondWithRpcPromise(_0x0474('0x10d'),_0x0474('0x10e'),{'id':_0x5ed695['id'],'name':_0x5ed695[_0x0474('0x39')],'pause':!![]});}})['then'](function(){if(_0x5ed695){return db[_0x0474('0x104')][_0x0474('0x95')]({'where':{'membername':_0x5ed695[_0x0474('0x39')],'type':_0x0474('0x10f'),'exitAt':null}});}})['then'](function(_0x2e62be){if(_0x2e62be[_0x0474('0x50')]){var _0x3df6e6=moment()[_0x0474('0xf9')](_0x0474('0x106'));for(var _0x2da6a5=0x0,_0x39dff7=_0x2e62be[_0x0474('0x50')];_0x2da6a5<_0x39dff7;_0x2da6a5++){_0x2e62be[_0x2da6a5][_0x0474('0x110')]({'exitAt':_0x3df6e6});}}})[_0x0474('0x16')](function(){var _0xea953d=[];var _0x19adff=utils[_0x0474('0x107')]();_0x19adff['forEach'](function(_0x16497a){_0xea953d[_0x0474('0x4d')]({'channel':_0x16497a,'membername':_0x5ed695[_0x0474('0x39')],'interface':_[_0x0474('0x71')](_0x5ed695[_0x0474('0xaa')])?util[_0x0474('0xf9')](_0x0474('0xb2'),_0x5ed695['name']):_0x5ed695[_0x0474('0xaa')],'type':_0x0474('0x10f'),'enterAt':moment()[_0x0474('0xf9')](_0x0474('0x106')),'data1':_0xc595f6[_0x0474('0x65')][_0x0474('0x41')]||_0x0474('0x111'),'role':_0x5ed695[_0x0474('0x29')],'internal':_0x5ed695[_0x0474('0x6b')]});});return db[_0x0474('0x104')]['bulkCreate'](_0xea953d,{'individualHooks':!![]});})[_0x0474('0x16')](function(){return _0x5ed695[_0x0474('0x64')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xc595f6[_0x0474('0x65')]['type']||_0x0474('0x111'),'lastPauseAt':moment()[_0x0474('0xf9')](_0x0474('0x106'))});})[_0x0474('0x16')](respondWithResult(_0x497de7,null))[_0x0474('0x1f')](handleError(_0x497de7,null));};exports['unpause']=function(_0x2e06dc,_0x466daf){if(_0x2e06dc[_0x0474('0x65')][_0x0474('0xb6')]&&!utils[_0x0474('0xb7')](_0x2e06dc['body'][_0x0474('0xb6')])){throw new APIBadRequestError(util[_0x0474('0xf9')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2e06dc['body']['channel']));}return db[_0x0474('0x3f')][_0x0474('0x38')]({'where':{'id':_0x2e06dc['params']['id']},'attributes':['id',_0x0474('0x39'),'role',_0x0474('0x6b'),_0x0474('0xaa'),'online',_0x0474('0x112'),_0x0474('0x113'),_0x0474('0x114'),_0x0474('0x115'),_0x0474('0x116'),_0x0474('0x117'),'whatsappPause',_0x0474('0x118'),_0x0474('0x119')]})[_0x0474('0x16')](function(_0x369bed){if(!_0x369bed){throw new APINotFoundError(util[_0x0474('0xf9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2e06dc[_0x0474('0x66')]['id']));}return _0x369bed[_0x0474('0x11a')](_0x2e06dc[_0x0474('0x65')][_0x0474('0xb6')]);})['then'](respondWithResult(_0x466daf,null))[_0x0474('0x1f')](APIHandleError(_0x466daf));};exports['getTeams']=function(_0x40c3eb,_0x28efb4){var _0x4df28b={};var _0xdf4f3e={};var _0xc63d76;var _0x1915ff;return db[_0x0474('0x3f')]['findOne']({'where':{'id':_0x40c3eb[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x28efb4,null))[_0x0474('0x16')](function(_0x56f35a){if(_0x56f35a){_0xc63d76=_0x56f35a;_0xdf4f3e[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0x11b')][_0x0474('0x5d')]);_0xdf4f3e[_0x0474('0x49')]=_[_0x0474('0x5c')](_0x40c3eb[_0x0474('0x49')]);_0xdf4f3e[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0xdf4f3e[_0x0474('0x5a')],_0xdf4f3e[_0x0474('0x49')]);_0x4df28b[_0x0474('0x60')]=_['intersection'](_0xdf4f3e[_0x0474('0x5a')],qs[_0x0474('0x61')](_0x40c3eb[_0x0474('0x49')][_0x0474('0x61')]));_0x4df28b[_0x0474('0x60')]=_0x4df28b[_0x0474('0x60')][_0x0474('0x50')]?_0x4df28b[_0x0474('0x60')]:_0xdf4f3e[_0x0474('0x5a')];_0x4df28b[_0x0474('0xd6')]=qs[_0x0474('0xd7')](_0x40c3eb[_0x0474('0x49')][_0x0474('0xd7')]);_0x4df28b['where']=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0x40c3eb[_0x0474('0x49')],_0xdf4f3e[_0x0474('0x5e')]));if(_0x40c3eb[_0x0474('0x49')][_0x0474('0x33')]){_0x4df28b['where']=_[_0x0474('0x62')](_0x4df28b[_0x0474('0x46')],{'$or':_[_0x0474('0x35')](_0x4df28b['attributes'],function(_0x1a412d){var _0x2440a9={};_0x2440a9[_0x1a412d]={'$like':'%'+_0x40c3eb[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x2440a9;})});}_0x4df28b=_[_0x0474('0x62')]({},_0x4df28b,_0x40c3eb[_0x0474('0x63')]);return _0xc63d76[_0x0474('0x11c')](_0x4df28b);}})[_0x0474('0x16')](function(_0x5aedd0){if(_0x5aedd0){_0x1915ff=_0x5aedd0[_0x0474('0x50')];if(!_0x40c3eb[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0x4df28b[_0x0474('0x23')]=qs[_0x0474('0x23')](_0x40c3eb[_0x0474('0x49')][_0x0474('0x23')]);_0x4df28b[_0x0474('0x22')]=qs['offset'](_0x40c3eb[_0x0474('0x49')]['offset']);}return _0xc63d76[_0x0474('0x11c')](_0x4df28b);}})['then'](function(_0x2e55a0){if(_0x2e55a0){return _0x2e55a0?{'count':_0x1915ff,'rows':_0x2e55a0}:null;}})['then'](respondWithResult(_0x28efb4,null))[_0x0474('0x1f')](handleError(_0x28efb4,null));};exports[_0x0474('0x11d')]=function(_0x20f9b0,_0xcf4603){var _0x5595cf=_0x20f9b0[_0x0474('0x66')]['id'];var _0x4361d3=_0x20f9b0[_0x0474('0x65')]?_0x20f9b0['body'][_0x0474('0x69')]:null;var _0x5cdfbd=[];return Promise[_0x0474('0x11e')]()[_0x0474('0x16')](function(){if(!_0x4361d3)throw new APIBadRequestError(_0x0474('0x11f'));})[_0x0474('0x16')](function(){return db['User']['findOne']({'where':{'id':_0x5595cf}});})[_0x0474('0x16')](function(_0x198c1e){if(!_0x198c1e)throw new APINotFoundError(util[_0x0474('0xf9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x20f9b0[_0x0474('0x66')]['id']));return db[_0x0474('0x73')]['transaction'](function(_0x554c98){return _0x198c1e[_0x0474('0x11d')](_0x4361d3,{'transaction':_0x554c98})['then'](function(){return db[_0x0474('0x11b')][_0x0474('0x95')]({'where':{'id':{'$in':_0x4361d3}}});})[_0x0474('0x16')](function(_0x5eee4f){var _0x5ac39f=_[_0x0474('0x35')](_0x5eee4f,function(_0x1f3588){return _0x1f3588['getAssociatedQueues']();});return Promise[_0x0474('0x58')](_0x5ac39f);})[_0x0474('0x16')](function(_0x5a4508){_0x5cdfbd=_[_0x0474('0x120')](_0x5a4508);var _0x157d43=_[_0x0474('0x35')](_0x5cdfbd,function(_0x15eced){return _0x15eced[_0x0474('0x121')](_0x198c1e['id'],{'transaction':_0x554c98});});return Promise[_0x0474('0x58')](_0x157d43);})[_0x0474('0x16')](function(){if(!_0x198c1e[_0x0474('0xa8')])return;var _0x317264=_[_0x0474('0x33')](_0x5cdfbd,function(_0x5d6167){return _0x5d6167[_0x0474('0x122')]('channel')===_0x0474('0x123');});var _0x2361be=_[_0x0474('0x35')](_0x317264,function(_0x14d4e7){return db[_0x0474('0x101')][_0x0474('0xb4')]({'membername':_0x198c1e[_0x0474('0x39')],'UserId':_0x198c1e['id'],'queue_name':_0x14d4e7[_0x0474('0x39')],'VoiceQueueId':_0x14d4e7['id'],'interface':_[_0x0474('0x71')](_0x198c1e[_0x0474('0xaa')])?util[_0x0474('0xf9')](_0x0474('0xb2'),_0x198c1e[_0x0474('0x39')]):_0x198c1e[_0x0474('0xaa')],'paused':_0x198c1e[_0x0474('0x112')]||![],'penalty':_0x198c1e[_0x0474('0xb3')]},{'transaction':_0x554c98});});return Promise[_0x0474('0x58')](_0x2361be);})['then'](function(){return db['TeamVoicePrefix'][_0x0474('0x95')]({'where':{'teamId':{'$in':_0x4361d3}}});})['then'](function(_0xd9b11c){var _0x4307d3=_[_0x0474('0x35')](_0xd9b11c,function(_0xb457b3){return db[_0x0474('0x124')]['create']({'UserId':_0x198c1e['id'],'VoicePrefixId':_0xb457b3[_0x0474('0x125')]},{'transaction':_0x554c98});});return Promise['all'](_0x4307d3);});});})[_0x0474('0x16')](function(){for(var _0x408a15=0x0;_0x408a15<_0x5cdfbd[_0x0474('0x50')];_0x408a15++){var _0x5a8e85=_0x5cdfbd[_0x408a15]['getDataValue'](_0x0474('0xb6'));var _0x569098=_0x5a8e85+_0x0474('0xaf');socket['emit'](_0x0474('0x2f')+_0x5a8e85+_0x0474('0xb0'),{'UserId':_0x5595cf,['queueField']:_0x5cdfbd[_0x408a15]['id']});}})[_0x0474('0x16')](respondWithStatusCode(_0xcf4603,null))[_0x0474('0x1f')](APIHandleError(_0xcf4603));};exports[_0x0474('0x126')]=function(_0x25e280,_0x5973f4){var _0x42c25f=_0x25e280[_0x0474('0x66')]['id'];var _0x591bf1=null;if(_0x25e280['query'][_0x0474('0x69')]){_0x591bf1=_[_0x0474('0xba')](_0x25e280[_0x0474('0x49')][_0x0474('0x69')])?_0x25e280[_0x0474('0x49')][_0x0474('0x69')]:[_0x25e280[_0x0474('0x49')]['ids']];}var _0x44752d=[];return Promise[_0x0474('0x11e')]()[_0x0474('0x16')](function(){if(!_0x591bf1)throw new APIBadRequestError(_0x0474('0x127'));})[_0x0474('0x16')](function(){return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x42c25f}});})['then'](function(_0x58e44b){if(!_0x58e44b)throw new APINotFoundError(util[_0x0474('0xf9')](_0x0474('0x128'),_0x25e280[_0x0474('0x66')]['id']));return db[_0x0474('0x73')][_0x0474('0x129')](function(_0xd86f45){return _0x58e44b[_0x0474('0x126')](_0x591bf1,{'transaction':_0xd86f45})[_0x0474('0x16')](function(){return db[_0x0474('0x11b')][_0x0474('0x95')]({'where':{'id':{'$in':_0x591bf1}}});})[_0x0474('0x16')](function(_0x3fa7a5){var _0x114b33=_[_0x0474('0x35')](_0x3fa7a5,function(_0x30f3dc){return _0x30f3dc['getAssociatedQueues']();});return Promise['all'](_0x114b33);})[_0x0474('0x16')](function(_0x56d96d){_0x44752d=_[_0x0474('0x120')](_0x56d96d);var _0x358c61=_[_0x0474('0x35')](_0x44752d,function(_0x25c400){return _0x25c400[_0x0474('0x12a')](_0x58e44b['id'],{'transaction':_0xd86f45});});return Promise[_0x0474('0x58')](_0x358c61);})[_0x0474('0x16')](function(){if(!_0x58e44b[_0x0474('0xa8')])return;var _0x1c5eac=_[_0x0474('0x33')](_0x44752d,function(_0x3576f3){return _0x3576f3['getDataValue'](_0x0474('0xb6'))===_0x0474('0x123');});var _0x4f7750=_[_0x0474('0x35')](_0x1c5eac,function(_0x2d2966){return db['UserVoiceQueueRt'][_0x0474('0x2c')]({'where':{'VoiceQueueId':_0x2d2966['id'],'UserId':_0x58e44b['id']},'transaction':_0xd86f45});});return Promise[_0x0474('0x58')](_0x4f7750);})['then'](function(){return db[_0x0474('0x12b')][_0x0474('0x95')]({'where':{'teamId':{'$in':_0x591bf1}}});})[_0x0474('0x16')](function(_0x48cd7f){var _0x20a433=_[_0x0474('0x35')](_0x48cd7f,function(_0x2090db){return db[_0x0474('0x124')][_0x0474('0x2c')]({'where':{'UserId':_0x58e44b['id'],'VoicePrefixId':_0x2090db[_0x0474('0x125')]}},{'transaction':_0xd86f45});});return Promise[_0x0474('0x58')](_0x20a433);});});})['then'](function(){for(var _0x4027d3=0x0;_0x4027d3<_0x44752d[_0x0474('0x50')];_0x4027d3++){var _0x1d6f74=_0x44752d[_0x4027d3]['getDataValue']('channel');var _0x3ffc60=_0x1d6f74+'QueueId';socket[_0x0474('0x2b')](_0x0474('0x2f')+_0x1d6f74+_0x0474('0xbb'),{'UserId':_0x42c25f,['queueField']:_0x44752d[_0x4027d3]['id']});}})['then'](respondWithStatusCode(_0x5973f4,null))[_0x0474('0x1f')](APIHandleError(_0x5973f4));};exports[_0x0474('0x12c')]=function(_0x41d6f8,_0x3d7c4e){var _0x3c9687={};var _0x4ae024={};var _0x31ed38;var _0x15784e;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x41d6f8['params']['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x3d7c4e,null))[_0x0474('0x16')](function(_0x1240af){if(_0x1240af){_0x31ed38=_0x1240af;_0x4ae024[_0x0474('0x5a')]=_[_0x0474('0x5c')](db[_0x0474('0xdb')]['rawAttributes']);_0x4ae024['query']=_[_0x0474('0x5c')](_0x41d6f8[_0x0474('0x49')]);_0x4ae024[_0x0474('0x5e')]=_['intersection'](_0x4ae024[_0x0474('0x5a')],_0x4ae024[_0x0474('0x49')]);_0x3c9687[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x4ae024['model'],qs[_0x0474('0x61')](_0x41d6f8[_0x0474('0x49')]['fields']));_0x3c9687[_0x0474('0x60')]=_0x3c9687[_0x0474('0x60')][_0x0474('0x50')]?_0x3c9687['attributes']:_0x4ae024['model'];_0x3c9687[_0x0474('0xd6')]=qs['sort'](_0x41d6f8[_0x0474('0x49')][_0x0474('0xd7')]);_0x3c9687[_0x0474('0x46')]=qs['filters'](_[_0x0474('0xd8')](_0x41d6f8[_0x0474('0x49')],_0x4ae024[_0x0474('0x5e')]));if(_0x41d6f8['query']['filter']){_0x3c9687[_0x0474('0x46')]=_[_0x0474('0x62')](_0x3c9687[_0x0474('0x46')],{'$or':_['map'](_0x3c9687[_0x0474('0x60')],function(_0x262757){var _0x4d1cd8={};_0x4d1cd8[_0x262757]={'$like':'%'+_0x41d6f8[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x4d1cd8;})});}_0x3c9687=_['merge']({},_0x3c9687,_0x41d6f8[_0x0474('0x63')]);return _0x31ed38[_0x0474('0x12c')](_0x3c9687);}})[_0x0474('0x16')](function(_0x26de11){if(_0x26de11){_0x15784e=_0x26de11[_0x0474('0x50')];if(!_0x41d6f8[_0x0474('0x49')][_0x0474('0xda')](_0x0474('0xe0'))){_0x3c9687[_0x0474('0x23')]=qs['limit'](_0x41d6f8[_0x0474('0x49')][_0x0474('0x23')]);_0x3c9687[_0x0474('0x22')]=qs[_0x0474('0x22')](_0x41d6f8['query']['offset']);}return _0x31ed38[_0x0474('0x12c')](_0x3c9687);}})[_0x0474('0x16')](function(_0x29b5db){if(_0x29b5db){return _0x29b5db?{'count':_0x15784e,'rows':_0x29b5db}:null;}})[_0x0474('0x16')](respondWithResult(_0x3d7c4e,null))['catch'](handleError(_0x3d7c4e,null));};exports[_0x0474('0x12d')]=function(_0x42e103,_0x157ea2){var _0x4b09cc={};var _0x4b5b1b={};var _0x1586a5;return db[_0x0474('0x3f')][_0x0474('0xa1')]({'where':{'id':_0x42e103[_0x0474('0x66')]['id']}})[_0x0474('0x16')](handleEntityNotFound(_0x157ea2,null))[_0x0474('0x16')](function(_0xbc0646){if(_0xbc0646){_0x1586a5=_0xbc0646;_0x4b5b1b[_0x0474('0x5a')]=_[_0x0474('0x5c')](db['User'][_0x0474('0x5d')]);_0x4b5b1b['query']=_[_0x0474('0x5c')](_0x42e103[_0x0474('0x49')]);_0x4b5b1b[_0x0474('0x5e')]=_[_0x0474('0x5f')](_0x4b5b1b['model'],_0x4b5b1b['query']);_0x4b09cc[_0x0474('0x60')]=_[_0x0474('0x5f')](_0x4b5b1b['model'],qs[_0x0474('0x61')](_0x42e103[_0x0474('0x49')][_0x0474('0x61')]));_0x4b09cc[_0x0474('0x60')]=_0x4b09cc['attributes'][_0x0474('0x50')]?_0x4b09cc['attributes']:_0x4b5b1b[_0x0474('0x5a')];_0x4b09cc['order']=qs[_0x0474('0xd7')](_0x42e103[_0x0474('0x49')][_0x0474('0xd7')]);_0x4b09cc['where']=qs[_0x0474('0x5e')](_[_0x0474('0xd8')](_0x42e103['query'],_0x4b5b1b[_0x0474('0x5e')]));if(_0x42e103[_0x0474('0x49')][_0x0474('0x33')]){_0x4b09cc[_0x0474('0x46')]=_['merge'](_0x4b09cc[_0x0474('0x46')],{'$or':_[_0x0474('0x35')](_0x4b09cc[_0x0474('0x60')],function(_0x548bc2){var _0x467286={};_0x467286[_0x548bc2]={'$like':'%'+_0x42e103[_0x0474('0x49')][_0x0474('0x33')]+'%'};return _0x467286;})});}_0x4b09cc[_0x0474('0x5a')]=db['User'];_0x4b09cc['as']=_0x0474('0x30');_0x4b09cc=_[_0x0474('0x62')]({},_0x4b09cc,_0x42e103[_0x0474('0x63')]);return _0x1586a5[_0x0474('0x103')]({'include':[_0x4b09cc]});}})['then'](function(_0x3bb59c){if(_0x3bb59c){var _0x3bd145={},_0x882f10=[];for(var _0x2d71e2=0x0;_0x2d71e2<_0x3bb59c[_0x0474('0x50')];_0x2d71e2+=0x1){for(var _0x2d4f21=0x0,_0x5a0cba;_0x2d4f21<_0x3bb59c[_0x2d71e2][_0x0474('0x30')][_0x0474('0x50')];_0x2d4f21+=0x1){_0x5a0cba=_0x3bb59c[_0x2d71e2]['Agents'][_0x2d4f21][_0x0474('0x2d')]({'plain':!![]});_0x3bd145[_0x5a0cba['id']]=_0x5a0cba;}}_0x3bd145=_[_0x0474('0x12e')](_0x3bd145);for(var _0x88d752=qs[_0x0474('0x22')](_0x42e103[_0x0474('0x49')][_0x0474('0x22')]);_0x88d752<_0x3bd145[_0x0474('0x50')]&&_0x882f10[_0x0474('0x50')]=_0x2a255b[_0x9297('0x4e')]){throw new Error(_0x9297('0x4f'));}})[_0x9297('0x18')](function(){if(_0x5e210c){return db[_0x9297('0x50')]['destroy']({'where':{'membername':_0x5e210c['name']},'individualHooks':!![]});}})['then'](function(){if(_0x5e210c){return _0x5e210c['getVoiceQueues']({'raw':!![]});}})[_0x9297('0x18')](function(_0x1b773e){if(_0x5e210c){if(_0x1b773e){var _0x1ab414=[];_0x388fca=_0x1b773e;if(_0x388fca[_0x9297('0x26')]){for(var _0x4d4a3a=0x0;_0x4d4a3a<_0x388fca[_0x9297('0x26')];_0x4d4a3a++){_0x1ab414[_0x9297('0x2b')](db[_0x9297('0x50')][_0x9297('0x51')]({'membername':_0x5e210c['name'],'UserId':_0x5e210c['id'],'queue_name':_0x388fca[_0x4d4a3a][_0x9297('0x2c')],'VoiceQueueId':_0x388fca[_0x4d4a3a]['id'],'interface':_0x25f089,'paused':_0x5e210c['loginInPause']||![],'penalty':_0x388fca[_0x4d4a3a][_0x9297('0x52')]||0x0}));}return BPromise[_0x9297('0x46')](_0x1ab414);}}}})[_0x9297('0x18')](function(){if(_0x5e210c){return db[_0x9297('0x25')]['findAll']({'where':{'membername':_0x5e210c['name'],'exitAt':null}});}})[_0x9297('0x18')](function(_0x29fa11){if(_0x5e210c){if(_0x29fa11&&_0x29fa11[_0x9297('0x26')]){var _0x48dd38=[];_0x29fa11[_0x9297('0x53')](function(_0x536503){_0x48dd38[_0x9297('0x2b')](_0x536503[_0x9297('0x45')]({'exitAt':moment()['format'](_0x9297('0x28'))}));});return BPromise['all'](_0x48dd38);}}})[_0x9297('0x18')](function(){if(_0x5e210c){var _0x4e7c35=[];var _0x2b265b=[];var _0x53beb7=utils[_0x9297('0x2a')]();var _0x561d9a={'membername':_0x5e210c['name'],'interface':_0x25f089,'enterAt':moment()[_0x9297('0x27')](_0x9297('0x28')),'role':_0x5e210c[_0x9297('0x22')],'internal':_0x5e210c[_0x9297('0x23')]};_0x53beb7[_0x9297('0x53')](function(_0x59fbea){_0x4e7c35[_0x9297('0x2b')](_[_0x9297('0x54')]({'channel':_0x59fbea,'type':'LOGIN','data1':'callysquare','data2':_0x25f089},_0x561d9a));if(_0x5e210c[_0x9297('0x4a')]){_0x2b265b[_0x9297('0x2b')](_['merge']({'channel':_0x59fbea,'type':_0x9297('0x55'),'data1':_0x9297('0x56')},_0x561d9a));}});return db[_0x9297('0x25')]['bulkCreate'](_0x4e7c35[_0x9297('0x57')](_0x2b265b),{'individualHooks':!![]});}})['then'](function(){if(_0x5e210c){return _0x5e210c[_0x9297('0x45')]({'online':!![],'lastLoginAt':moment()[_0x9297('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5e210c[_0x9297('0x4a')]||![],'mailPause':_0x5e210c[_0x9297('0x4a')]||![],'chatPause':_0x5e210c['loginInPause']||![],'faxPause':_0x5e210c['loginInPause']||![],'smsPause':_0x5e210c[_0x9297('0x4a')]||![],'openchannelPause':_0x5e210c[_0x9297('0x4a')]||![],'pauseType':_0x5e210c[_0x9297('0x4a')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x9297('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x25f089});}})['then'](function(_0x230946){_0x6755c0(_0x230946);})['catch'](function(_0x5358c0){_0x1b6924(_0x146e51['error'](0x1f4,_0x5358c0[_0x9297('0x1a')]));});});}; \ No newline at end of file +var _0xb020=['ShowUser','find','where','catch','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','type','body','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','voicePause','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','LogoutUser','destroy','all','LoginUser','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','User','findAll','options','raw','attributes','include','map','model','then','debug','error','message'];(function(_0x1b84d3,_0x52bc67){var _0x401338=function(_0x415ccf){while(--_0x415ccf){_0x1b84d3['push'](_0x1b84d3['shift']());}};_0x401338(++_0x52bc67);}(_0xb020,0x8e));var _0x0b02=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xb020[_0x51b0dc];return _0x13fa89;};'use strict';var _=require(_0x0b02('0x0'));var util=require(_0x0b02('0x1'));var moment=require('moment');var BPromise=require(_0x0b02('0x2'));var Redis=require('ioredis');var db=require(_0x0b02('0x3'))['db'];var utils=require(_0x0b02('0x4'));var logger=require(_0x0b02('0x5'))(_0x0b02('0x6'));var config=require(_0x0b02('0x7'));config[_0x0b02('0x8')]=_[_0x0b02('0x9')](config[_0x0b02('0x8')],{'host':_0x0b02('0xa'),'port':0x18eb});var socket=require(_0x0b02('0xb'))(new Redis(config[_0x0b02('0x8')]));require('./user.socket')[_0x0b02('0xc')](socket);exports[_0x0b02('0xd')]=function(_0x1d40ae){var _0x441e73=this;return new Promise(function(_0x43289c,_0x59b6e8){return db[_0x0b02('0xe')][_0x0b02('0xf')]({'raw':_0x1d40ae['options']?_0x1d40ae[_0x0b02('0x10')][_0x0b02('0x11')]===undefined?!![]:![]:!![],'where':_0x1d40ae[_0x0b02('0x10')]?_0x1d40ae[_0x0b02('0x10')]['where']||null:null,'attributes':_0x1d40ae[_0x0b02('0x10')]?_0x1d40ae[_0x0b02('0x10')][_0x0b02('0x12')]||null:null,'limit':_0x1d40ae['options']?_0x1d40ae['options']['limit']||null:null,'include':_0x1d40ae[_0x0b02('0x10')]?_0x1d40ae[_0x0b02('0x10')][_0x0b02('0x13')]?_[_0x0b02('0x14')](_0x1d40ae[_0x0b02('0x10')]['include'],function(_0x54e978){return{'model':db[_0x54e978[_0x0b02('0x15')]],'as':_0x54e978['as'],'attributes':_0x54e978[_0x0b02('0x12')],'include':_0x54e978[_0x0b02('0x13')]?_['map'](_0x54e978[_0x0b02('0x13')],function(_0x541d15){return{'model':db[_0x541d15['model']],'as':_0x541d15['as'],'attributes':_0x541d15[_0x0b02('0x12')],'include':_0x541d15[_0x0b02('0x13')]?_['map'](_0x541d15[_0x0b02('0x13')],function(_0x4e5cdf){return{'model':db[_0x4e5cdf[_0x0b02('0x15')]],'as':_0x4e5cdf['as'],'attributes':_0x4e5cdf[_0x0b02('0x12')]};}):[]};}):[]};}):[]:[]})[_0x0b02('0x16')](function(_0x4d39e3){logger['info'](_0x0b02('0xd'),_0x1d40ae);logger[_0x0b02('0x17')](_0x0b02('0xd'),_0x1d40ae,JSON['stringify'](_0x4d39e3));_0x43289c(_0x4d39e3);})['catch'](function(_0x2c1c68){logger['error']('GetUser',_0x2c1c68['message'],_0x1d40ae);_0x59b6e8(_0x441e73[_0x0b02('0x18')](0x1f4,_0x2c1c68[_0x0b02('0x19')]));});});};exports[_0x0b02('0x1a')]=function(_0x5ee19c){var _0x41c519=this;return new Promise(function(_0x13ee6a,_0x13958d){return db['User'][_0x0b02('0x1b')]({'raw':_0x5ee19c[_0x0b02('0x10')]?_0x5ee19c[_0x0b02('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x5ee19c[_0x0b02('0x10')]?_0x5ee19c[_0x0b02('0x10')][_0x0b02('0x1c')]||null:null,'attributes':_0x5ee19c['options']?_0x5ee19c['options']['attributes']||null:null,'include':_0x5ee19c[_0x0b02('0x10')]?_0x5ee19c[_0x0b02('0x10')][_0x0b02('0x13')]?_[_0x0b02('0x14')](_0x5ee19c[_0x0b02('0x10')]['include'],function(_0xfe3ea1){return{'model':db[_0xfe3ea1[_0x0b02('0x15')]],'as':_0xfe3ea1['as'],'attributes':_0xfe3ea1[_0x0b02('0x12')],'include':_0xfe3ea1[_0x0b02('0x13')]?_[_0x0b02('0x14')](_0xfe3ea1[_0x0b02('0x13')],function(_0x3c1022){return{'model':db[_0x3c1022[_0x0b02('0x15')]],'as':_0x3c1022['as'],'attributes':_0x3c1022['attributes'],'include':_0x3c1022[_0x0b02('0x13')]?_[_0x0b02('0x14')](_0x3c1022['include'],function(_0x427fbf){return{'model':db[_0x427fbf[_0x0b02('0x15')]],'as':_0x427fbf['as'],'attributes':_0x427fbf[_0x0b02('0x12')]};}):[]};}):[]};}):[]:[]})[_0x0b02('0x16')](function(_0x2510f1){logger['info']('ShowUser',_0x5ee19c);logger['debug'](_0x0b02('0x1a'),_0x5ee19c,JSON['stringify'](_0x2510f1));_0x13ee6a(_0x2510f1);})[_0x0b02('0x1d')](function(_0x54d76e){logger[_0x0b02('0x18')](_0x0b02('0x1a'),_0x54d76e[_0x0b02('0x19')],_0x5ee19c);_0x13958d(_0x41c519[_0x0b02('0x18')](0x1f4,_0x54d76e[_0x0b02('0x19')]));});});};exports[_0x0b02('0x1e')]=function(_0x527a25){var _0xaf75d3=this;return new Promise(function(_0x12d96b,_0x41eb2a){var _0x51422f;return db[_0x0b02('0xe')][_0x0b02('0x1b')]({'where':_0x527a25['options'][_0x0b02('0x1c')]||{},'attributes':['id',_0x0b02('0x1f'),_0x0b02('0x20'),_0x0b02('0x21'),_0x0b02('0x22')]})[_0x0b02('0x16')](function(_0x367204){if(_0x367204){_0x51422f=_0x367204;return db[_0x0b02('0x23')][_0x0b02('0x24')]({'paused':0x1},{'where':{'UserId':_0x51422f['id']},'individualHooks':!![]});}})['then'](function(){if(_0x51422f){return db[_0x0b02('0x25')][_0x0b02('0xf')]({'where':{'membername':_0x51422f[_0x0b02('0x1f')],'type':_0x0b02('0x26'),'exitAt':null}});}})[_0x0b02('0x16')](function(_0x415da2){if(_0x51422f){if(_0x415da2&&_0x415da2[_0x0b02('0x27')]){var _0xfc0b9e=moment()[_0x0b02('0x28')](_0x0b02('0x29'));for(var _0x1eb0ca=0x0,_0x42283b=_0x415da2['length'];_0x1eb0ca<_0x42283b;_0x1eb0ca++){_0x415da2[_0x1eb0ca][_0x0b02('0x2a')]({'exitAt':_0xfc0b9e});}}}})[_0x0b02('0x16')](function(){if(_0x51422f){var _0x465f46=[];var _0x3b9f98=utils[_0x0b02('0x2b')]();_0x3b9f98[_0x0b02('0x2c')](function(_0x5d7853){_0x465f46[_0x0b02('0x2d')]({'channel':_0x5d7853,'membername':_0x51422f[_0x0b02('0x1f')],'interface':_[_0x0b02('0x2e')](_0x51422f['interface'])?util['format'](_0x0b02('0x2f'),_0x51422f[_0x0b02('0x1f')]):_0x51422f[_0x0b02('0x22')],'type':'PAUSE','enterAt':moment()[_0x0b02('0x28')](_0x0b02('0x29')),'data1':_0x527a25['body'][_0x0b02('0x30')]||'DEFAULT\x20PAUSE','role':_0x51422f['role'],'internal':_0x51422f['internal'],'uniqueid':_0x527a25[_0x0b02('0x31')][_0x0b02('0x32')]||null});});return db[_0x0b02('0x25')][_0x0b02('0x33')](_0x465f46,{'individualHooks':!![]});}})[_0x0b02('0x16')](function(){if(_0x51422f){return _0x51422f[_0x0b02('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x527a25['body'][_0x0b02('0x30')]||_0x0b02('0x34'),'lastPauseAt':moment()[_0x0b02('0x28')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x3d208b){_0x12d96b(_0x3d208b);})[_0x0b02('0x1d')](function(_0x4996e0){_0x41eb2a(_0xaf75d3[_0x0b02('0x18')](0x1f4,_0x4996e0[_0x0b02('0x19')]));});});};exports[_0x0b02('0x35')]=function(_0x335101){var _0x3b4b5f=this;return new Promise(function(_0xc15efd,_0xb31743){if(_0x335101[_0x0b02('0x31')][_0x0b02('0x36')]&&!utils[_0x0b02('0x37')](_0x335101['body']['channel'])){throw new Error(util[_0x0b02('0x28')](_0x0b02('0x38'),_0x335101['body'][_0x0b02('0x36')]));}return db[_0x0b02('0xe')][_0x0b02('0x39')]({'where':_0x335101[_0x0b02('0x10')][_0x0b02('0x1c')]||{},'attributes':['id','name',_0x0b02('0x20'),_0x0b02('0x21'),'interface','online',_0x0b02('0x3a'),_0x0b02('0x3b'),'chatPause',_0x0b02('0x3c'),_0x0b02('0x3d'),_0x0b02('0x3e'),'whatsappPause',_0x0b02('0x3f'),_0x0b02('0x40')]})[_0x0b02('0x16')](function(_0x12e86c){if(!_0x12e86c){throw new Error(util[_0x0b02('0x28')](_0x0b02('0x41'),_0x335101[_0x0b02('0x42')]['id']));}return _0x12e86c[_0x0b02('0x43')](_0x335101['body']['channel'],'system');})[_0x0b02('0x16')](function(_0x288308){_0xc15efd(_0x288308);})[_0x0b02('0x1d')](function(_0x55f74e){_0xb31743(_0x3b4b5f[_0x0b02('0x18')](0x1f4,_0x55f74e[_0x0b02('0x19')]));});});};exports[_0x0b02('0x44')]=function(_0x26c6a7){var _0x490c8e=this;return new Promise(function(_0x2c4faa,_0x4c70a8){var _0x27c535;return db[_0x0b02('0xe')]['findOne']({'where':_0x26c6a7[_0x0b02('0x10')][_0x0b02('0x1c')]||{},'attributes':['id',_0x0b02('0x1f')]})['then'](function(_0x57a739){if(_0x57a739){_0x27c535=_0x57a739;return db[_0x0b02('0x23')][_0x0b02('0x45')]({'where':{'membername':_0x27c535[_0x0b02('0x1f')]},'individualHooks':!![]});}})[_0x0b02('0x16')](function(){if(_0x27c535){return db[_0x0b02('0x25')][_0x0b02('0xf')]({'where':{'membername':_0x27c535['name'],'exitAt':null}});}})[_0x0b02('0x16')](function(_0x474cbb){if(_0x27c535){if(_0x474cbb&&_0x474cbb[_0x0b02('0x27')]){var _0xe2cc7e=[];_0x474cbb[_0x0b02('0x2c')](function(_0x5f366f){_0xe2cc7e[_0x0b02('0x2d')](_0x5f366f[_0x0b02('0x24')]({'exitAt':moment()[_0x0b02('0x28')](_0x0b02('0x29'))}));});return BPromise[_0x0b02('0x46')](_0xe2cc7e);}}})['then'](function(){if(_0x27c535){return _0x27c535[_0x0b02('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x37017d){_0x2c4faa(_0x37017d);})[_0x0b02('0x1d')](function(_0x54fb5a){_0x4c70a8(_0x490c8e[_0x0b02('0x18')](0x1f4,_0x54fb5a[_0x0b02('0x19')]));});});};exports[_0x0b02('0x47')]=function(_0x2350d4){var _0x572353=this;return new Promise(function(_0x1a8ff8,_0x4b5ef3){var _0x11432a;var _0x449a9e;var _0x49b9da;var _0x4c07a9;return db[_0x0b02('0xe')][_0x0b02('0x39')]({'where':_0x2350d4[_0x0b02('0x10')][_0x0b02('0x1c')]||{},'attributes':['id',_0x0b02('0x1f'),_0x0b02('0x20'),'mobile','phone','internal',_0x0b02('0x48'),_0x0b02('0x22')]})[_0x0b02('0x16')](function(_0x5572c0){if(_0x5572c0){_0x11432a=_0x5572c0;_0x4c07a9=_0x2350d4[_0x0b02('0x31')]['interface']?_0x2350d4[_0x0b02('0x31')][_0x0b02('0x22')]:util[_0x0b02('0x28')](_0x0b02('0x2f'),_0x11432a[_0x0b02('0x1f')]);return db['User']['count']({'where':{'role':_0x0b02('0x49'),'online':!![],'id':{'$ne':_0x11432a['id']}}});}})[_0x0b02('0x16')](function(_0x1aecee){if(_0x1aecee){_0x49b9da=_0x1aecee;return require(_0x0b02('0x4a'))[_0x0b02('0x4b')]();}})['then'](function(_0x1dac21){if(_0x1dac21&&_0x1dac21[_0x0b02('0x4c')]&&_0x49b9da>=_0x1dac21[_0x0b02('0x4c')]){throw new Error(_0x0b02('0x4d'));}})['then'](function(){if(_0x11432a){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x11432a[_0x0b02('0x1f')]},'individualHooks':!![]});}})[_0x0b02('0x16')](function(){if(_0x11432a){return _0x11432a[_0x0b02('0x4e')]({'raw':!![]});}})['then'](function(_0x231237){if(_0x11432a){if(_0x231237){var _0x4cac37=[];_0x449a9e=_0x231237;if(_0x449a9e[_0x0b02('0x27')]){for(var _0x536428=0x0;_0x536428<_0x449a9e[_0x0b02('0x27')];_0x536428++){_0x4cac37[_0x0b02('0x2d')](db[_0x0b02('0x23')]['upsert']({'membername':_0x11432a[_0x0b02('0x1f')],'UserId':_0x11432a['id'],'queue_name':_0x449a9e[_0x536428]['name'],'VoiceQueueId':_0x449a9e[_0x536428]['id'],'interface':_0x4c07a9,'paused':_0x11432a[_0x0b02('0x48')]||![],'penalty':_0x449a9e[_0x536428]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x0b02('0x46')](_0x4cac37);}}}})['then'](function(){if(_0x11432a){return db[_0x0b02('0x25')][_0x0b02('0xf')]({'where':{'membername':_0x11432a[_0x0b02('0x1f')],'exitAt':null}});}})[_0x0b02('0x16')](function(_0xf16d03){if(_0x11432a){if(_0xf16d03&&_0xf16d03[_0x0b02('0x27')]){var _0x4d9c2f=[];_0xf16d03[_0x0b02('0x2c')](function(_0x12c9c3){_0x4d9c2f[_0x0b02('0x2d')](_0x12c9c3['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0b02('0x46')](_0x4d9c2f);}}})['then'](function(){if(_0x11432a){var _0x298932=[];var _0x2670ed=[];var _0x39063b=utils['getChannels']();var _0x1176e4={'membername':_0x11432a[_0x0b02('0x1f')],'interface':_0x4c07a9,'enterAt':moment()[_0x0b02('0x28')](_0x0b02('0x29')),'role':_0x11432a['role'],'internal':_0x11432a[_0x0b02('0x21')]};_0x39063b[_0x0b02('0x2c')](function(_0x5f502a){_0x298932[_0x0b02('0x2d')](_[_0x0b02('0x4f')]({'channel':_0x5f502a,'type':_0x0b02('0x50'),'data1':_0x0b02('0x51'),'data2':_0x4c07a9},_0x1176e4));if(_0x11432a[_0x0b02('0x48')]){_0x2670ed['push'](_[_0x0b02('0x4f')]({'channel':_0x5f502a,'type':_0x0b02('0x26'),'data1':_0x0b02('0x52')},_0x1176e4));}});return db[_0x0b02('0x25')][_0x0b02('0x33')](_0x298932[_0x0b02('0x53')](_0x2670ed),{'individualHooks':!![]});}})[_0x0b02('0x16')](function(){if(_0x11432a){return _0x11432a[_0x0b02('0x24')]({'online':!![],'lastLoginAt':moment()[_0x0b02('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x11432a['loginInPause']||![],'mailPause':_0x11432a[_0x0b02('0x48')]||![],'chatPause':_0x11432a['loginInPause']||![],'faxPause':_0x11432a[_0x0b02('0x48')]||![],'smsPause':_0x11432a['loginInPause']||![],'openchannelPause':_0x11432a[_0x0b02('0x48')]||![],'pauseType':_0x11432a[_0x0b02('0x48')]?_0x0b02('0x52'):null,'lastPauseAt':moment()[_0x0b02('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4c07a9});}})[_0x0b02('0x16')](function(_0x5323ee){_0x1a8ff8(_0x5323ee);})['catch'](function(_0x15a4ad){_0x4b5ef3(_0x572353[_0x0b02('0x18')](0x1f4,_0x15a4ad[_0x0b02('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e1e89ad..0e6548e 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 _0x41f1=['./user.events','save','remove','update','emit','length','user:'];(function(_0x581f70,_0x9c4c25){var _0x1d68e5=function(_0x141e0a){while(--_0x141e0a){_0x581f70['push'](_0x581f70['shift']());}};_0x1d68e5(++_0x9c4c25);}(_0x41f1,0x10a));var _0x141f=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x41f1[_0x435044];return _0x33d4c6;};'use strict';var UserEvents=require(_0x141f('0x0'));var events=[_0x141f('0x1'),_0x141f('0x2'),_0x141f('0x3')];function createListener(_0x156e77,_0x402945){return function(_0x6e164a){_0x402945[_0x141f('0x4')](_0x156e77,_0x6e164a);};}function removeListener(_0x1b9605,_0x39a3fc){return function(){UserEvents['removeListener'](_0x1b9605,_0x39a3fc);};}exports['register']=function(_0x5b2531){for(var _0x29953f=0x0,_0x383a34=events[_0x141f('0x5')];_0x29953f<_0x383a34;_0x29953f++){var _0x5c5284=events[_0x29953f];var _0x1fcfee=createListener(_0x141f('0x6')+_0x5c5284,_0x5b2531);UserEvents['on'](_0x5c5284,_0x1fcfee);}}; \ No newline at end of file +var _0x78c2=['save','remove','update','emit','./user.events'];(function(_0xb85b60,_0xbc0e9){var _0xd4bd2=function(_0xe2c7e5){while(--_0xe2c7e5){_0xb85b60['push'](_0xb85b60['shift']());}};_0xd4bd2(++_0xbc0e9);}(_0x78c2,0xb3));var _0x278c=function(_0x4b711c,_0x35cf03){_0x4b711c=_0x4b711c-0x0;var _0x470c10=_0x78c2[_0x4b711c];return _0x470c10;};'use strict';var UserEvents=require(_0x278c('0x0'));var events=[_0x278c('0x1'),_0x278c('0x2'),_0x278c('0x3')];function createListener(_0x4724a7,_0x5bad63){return function(_0x269659){_0x5bad63[_0x278c('0x4')](_0x4724a7,_0x269659);};}function removeListener(_0x2f9885,_0x55c89f){return function(){UserEvents['removeListener'](_0x2f9885,_0x55c89f);};}exports['register']=function(_0x2ef3cb){for(var _0x488f27=0x0,_0x2f1a67=events['length'];_0x488f27<_0x2f1a67;_0x488f27++){var _0xcd5355=events[_0x488f27];var _0x3a1049=createListener('user:'+_0xcd5355,_0x2ef3cb);UserEvents['on'](_0xcd5355,_0x3a1049);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9636fbc..725fc31 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x9be60f,_0x59eeab){var _0x1e2d86=function(_0x15167f){while(--_0x15167f){_0x9be60f['push'](_0x9be60f['shift']());}};_0x1e2d86(++_0x59eeab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x373c02,_0x12ea0f){var _0x431153=function(_0x56fa75){while(--_0x56fa75){_0x373c02['push'](_0x373c02['shift']());}};_0x431153(++_0x12ea0f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6ded7d0..e0bba7c 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 _0xc37b=['exports','INTEGER','sequelize'];(function(_0x1b43e2,_0x172682){var _0x1939bb=function(_0x1631ec){while(--_0x1631ec){_0x1b43e2['push'](_0x1b43e2['shift']());}};_0x1939bb(++_0x172682);}(_0xc37b,0x15b));var _0xbc37=function(_0x18b729,_0x3f159e){_0x18b729=_0x18b729-0x0;var _0x596825=_0xc37b[_0x18b729];return _0x596825;};'use strict';var Sequelize=require(_0xbc37('0x0'));module[_0xbc37('0x1')]={'penalty':{'type':Sequelize[_0xbc37('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d7f=['exports','sequelize'];(function(_0x33b81a,_0x2e1605){var _0x176e35=function(_0x51d81d){while(--_0x51d81d){_0x33b81a['push'](_0x33b81a['shift']());}};_0x176e35(++_0x2e1605);}(_0x7d7f,0xa3));var _0xf7d7=function(_0x27a7f6,_0x1009be){_0x27a7f6=_0x27a7f6-0x0;var _0x26fcd4=_0x7d7f[_0x27a7f6];return _0x26fcd4;};'use strict';var Sequelize=require(_0xf7d7('0x0'));module[_0xf7d7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index dc7755b..3dae511 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 _0x1f15=['path','rimraf','exports','define','lodash','moment','bluebird','request-promise'];(function(_0x567336,_0x4e8b2e){var _0x23533c=function(_0x5750ae){while(--_0x5750ae){_0x567336['push'](_0x567336['shift']());}};_0x23533c(++_0x4e8b2e);}(_0x1f15,0x11c));var _0x51f1=function(_0x1e43e9,_0x33cd0b){_0x1e43e9=_0x1e43e9-0x0;var _0x2e26d0=_0x1f15[_0x1e43e9];return _0x2e26d0;};'use strict';var _=require(_0x51f1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x51f1('0x1'));var BPromise=require(_0x51f1('0x2'));var rp=require(_0x51f1('0x3'));var fs=require('fs');var path=require(_0x51f1('0x4'));var rimraf=require(_0x51f1('0x5'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x51f1('0x6')]=function(_0x26825b,_0x5cf500){return _0x26825b[_0x51f1('0x7')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd0e=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','moment'];(function(_0x23807f,_0x3c5892){var _0x5351a7=function(_0x38a5e5){while(--_0x38a5e5){_0x23807f['push'](_0x23807f['shift']());}};_0x5351a7(++_0x3c5892);}(_0xcd0e,0x11b));var _0xecd0=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xcd0e[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0xecd0('0x0'));var util=require('util');var logger=require(_0xecd0('0x1'))('api');var moment=require(_0xecd0('0x2'));var BPromise=require(_0xecd0('0x3'));var rp=require(_0xecd0('0x4'));var fs=require('fs');var path=require(_0xecd0('0x5'));var rimraf=require(_0xecd0('0x6'));var config=require(_0xecd0('0x7'));var attributes=require(_0xecd0('0x8'));module[_0xecd0('0x9')]=function(_0x910078,_0xbfba21){return _0x910078[_0xecd0('0xa')](_0xecd0('0xb'),attributes,{'tableName':_0xecd0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 106476a..8c48f1c 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 _0x4188=['error','code','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b68d9,_0x2eb2cb){var _0x40525f=function(_0xcfcdfc){while(--_0xcfcdfc){_0x4b68d9['push'](_0x4b68d9['shift']());}};_0x40525f(++_0x2eb2cb);}(_0x4188,0x156));var _0x8418=function(_0x4eee66,_0x583eb1){_0x4eee66=_0x4eee66-0x0;var _0x2426ae=_0x4188[_0x4eee66];return _0x2426ae;};'use strict';var _=require(_0x8418('0x0'));var util=require(_0x8418('0x1'));var moment=require('moment');var BPromise=require(_0x8418('0x2'));var rs=require(_0x8418('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8418('0x4'))['db'];var utils=require(_0x8418('0x5'));var logger=require(_0x8418('0x6'))(_0x8418('0x7'));var config=require(_0x8418('0x8'));var jayson=require(_0x8418('0x9'));var client=jayson['client'][_0x8418('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf37cf0,_0x53d784,_0xbd60d4){return new BPromise(function(_0x13dcb5,_0x52f110){return client[_0x8418('0xb')](_0xf37cf0,_0xbd60d4)['then'](function(_0x5298d7){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x53d784,_0x8418('0xc'));logger['debug'](_0x8418('0xd'),_0x53d784,'request\x20sent',JSON[_0x8418('0xe')](_0x5298d7));if(_0x5298d7[_0x8418('0xf')]){if(_0x5298d7[_0x8418('0xf')][_0x8418('0x10')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x53d784,_0x5298d7[_0x8418('0xf')]['message']);return _0x52f110(_0x5298d7['error'][_0x8418('0x11')]);}logger[_0x8418('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x53d784,_0x5298d7[_0x8418('0xf')][_0x8418('0x11')]);return _0x13dcb5(_0x5298d7[_0x8418('0xf')][_0x8418('0x11')]);}else{logger['info'](_0x8418('0x12'),_0x53d784,_0x8418('0xc'));_0x13dcb5(_0x5298d7[_0x8418('0x13')][_0x8418('0x11')]);}})[_0x8418('0x14')](function(_0x37e5fb){logger['error'](_0x8418('0x12'),_0x53d784,_0x37e5fb);_0x52f110(_0x37e5fb);});});} \ No newline at end of file +var _0x9bb1=['../../config/logger','rpc','../../config/environment','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x13bad5,_0x4bc34b){var _0x22b62a=function(_0x2aa998){while(--_0x2aa998){_0x13bad5['push'](_0x13bad5['shift']());}};_0x22b62a(++_0x4bc34b);}(_0x9bb1,0x1f0));var _0x19bb=function(_0x3a47ed,_0x54f842){_0x3a47ed=_0x3a47ed-0x0;var _0xa108ae=_0x9bb1[_0x3a47ed];return _0xa108ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x19bb('0x0'));var BPromise=require(_0x19bb('0x1'));var rs=require(_0x19bb('0x2'));var fs=require('fs');var Redis=require(_0x19bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x19bb('0x4'))(_0x19bb('0x5'));var config=require(_0x19bb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x19bb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x582f9a,_0x108d58,_0x52cd67){return new BPromise(function(_0x224ee3,_0x5c61a2){return client[_0x19bb('0x8')](_0x582f9a,_0x52cd67)[_0x19bb('0x9')](function(_0x288fb0){logger[_0x19bb('0xa')](_0x19bb('0xb'),_0x108d58,_0x19bb('0xc'));logger[_0x19bb('0xd')](_0x19bb('0xe'),_0x108d58,_0x19bb('0xc'),JSON[_0x19bb('0xf')](_0x288fb0));if(_0x288fb0[_0x19bb('0x10')]){if(_0x288fb0[_0x19bb('0x10')][_0x19bb('0x11')]===0x1f4){logger[_0x19bb('0x10')](_0x19bb('0xb'),_0x108d58,_0x288fb0['error'][_0x19bb('0x12')]);return _0x5c61a2(_0x288fb0['error'][_0x19bb('0x12')]);}logger['error'](_0x19bb('0xb'),_0x108d58,_0x288fb0[_0x19bb('0x10')]['message']);return _0x224ee3(_0x288fb0[_0x19bb('0x10')][_0x19bb('0x12')]);}else{logger[_0x19bb('0xa')](_0x19bb('0xb'),_0x108d58,_0x19bb('0xc'));_0x224ee3(_0x288fb0[_0x19bb('0x13')]['message']);}})['catch'](function(_0x5710d0){logger[_0x19bb('0x10')](_0x19bb('0xb'),_0x108d58,_0x5710d0);_0x5c61a2(_0x5710d0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 515f0b5..6d5b932 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x311195,_0x5b9ca1){var _0x20b48b=function(_0x6cab60){while(--_0x6cab60){_0x311195['push'](_0x311195['shift']());}};_0x20b48b(++_0x5b9ca1);}(_0x70e0,0x17b));var _0x070e=function(_0x5c7c8d,_0x337dc5){_0x5c7c8d=_0x5c7c8d-0x0;var _0x43315e=_0x70e0[_0x5c7c8d];return _0x43315e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x25d288,_0x489f8c){var _0x5b9a74=function(_0x44636d){while(--_0x44636d){_0x25d288['push'](_0x25d288['shift']());}};_0x5b9a74(++_0x489f8c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index f7bd4c0..8cd2e4f 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 _0x1026=['INTEGER','STRING','exports'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x1026,0x191));var _0x6102=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x1026[_0x22b39b];return _0x280e1d;};'use strict';var Sequelize=require('sequelize');module[_0x6102('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6102('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6102('0x2')]}}; \ No newline at end of file +var _0x2631=['sequelize','exports','INTEGER'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x2631,0xf3));var _0x1263=function(_0x31074d,_0x146a23){_0x31074d=_0x31074d-0x0;var _0xa3a898=_0x2631[_0x31074d];return _0xa3a898;};'use strict';var Sequelize=require(_0x1263('0x0'));module[_0x1263('0x1')]={'penalty':{'type':Sequelize[_0x1263('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 2c329bc..9699c28 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 _0x9f7e=['./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x38a211,_0x1c21ff){var _0x78f594=function(_0x2cd0f3){while(--_0x2cd0f3){_0x38a211['push'](_0x38a211['shift']());}};_0x78f594(++_0x1c21ff);}(_0x9f7e,0x86));var _0xe9f7=function(_0x5aed9f,_0x45ca0e){_0x5aed9f=_0x5aed9f-0x0;var _0x3a20b4=_0x9f7e[_0x5aed9f];return _0x3a20b4;};'use strict';var _=require(_0xe9f7('0x0'));var util=require(_0xe9f7('0x1'));var logger=require(_0xe9f7('0x2'))(_0xe9f7('0x3'));var moment=require('moment');var BPromise=require(_0xe9f7('0x4'));var rp=require(_0xe9f7('0x5'));var fs=require('fs');var path=require(_0xe9f7('0x6'));var rimraf=require(_0xe9f7('0x7'));var config=require(_0xe9f7('0x8'));var attributes=require(_0xe9f7('0x9'));module[_0xe9f7('0xa')]=function(_0x408f0d,_0xbb870){return _0x408f0d['define'](_0xe9f7('0xb'),attributes,{'tableName':_0xe9f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7ff=['rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','api','bluebird','request-promise','path'];(function(_0x57cc16,_0x444378){var _0x5421e5=function(_0xbcb1d3){while(--_0xbcb1d3){_0x57cc16['push'](_0x57cc16['shift']());}};_0x5421e5(++_0x444378);}(_0xc7ff,0x1d4));var _0xfc7f=function(_0xbccf,_0x5f3f74){_0xbccf=_0xbccf-0x0;var _0x24c504=_0xc7ff[_0xbccf];return _0x24c504;};'use strict';var _=require(_0xfc7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfc7f('0x1'));var moment=require('moment');var BPromise=require(_0xfc7f('0x2'));var rp=require(_0xfc7f('0x3'));var fs=require('fs');var path=require(_0xfc7f('0x4'));var rimraf=require(_0xfc7f('0x5'));var config=require(_0xfc7f('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xfc7f('0x7')]=function(_0x40f198,_0xd0f54a){return _0x40f198[_0xfc7f('0x8')](_0xfc7f('0x9'),attributes,{'tableName':_0xfc7f('0xa'),'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 f476f5f..8d30d5e 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 _0xb9ea=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0xb9ea,0x17a));var _0xab9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab9e('0x0'));var util=require(_0xab9e('0x1'));var moment=require(_0xab9e('0x2'));var BPromise=require(_0xab9e('0x3'));var rs=require(_0xab9e('0x4'));var fs=require('fs');var Redis=require(_0xab9e('0x5'));var db=require(_0xab9e('0x6'))['db'];var utils=require(_0xab9e('0x7'));var logger=require(_0xab9e('0x8'))(_0xab9e('0x9'));var config=require(_0xab9e('0xa'));var jayson=require(_0xab9e('0xb'));var client=jayson[_0xab9e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46f79d,_0x482bcc,_0x2ffbb9){return new BPromise(function(_0x2ef05c,_0x2ebf73){return client[_0xab9e('0xd')](_0x46f79d,_0x2ffbb9)[_0xab9e('0xe')](function(_0x5bf231){logger[_0xab9e('0xf')](_0xab9e('0x10'),_0x482bcc,_0xab9e('0x11'));logger[_0xab9e('0x12')](_0xab9e('0x13'),_0x482bcc,_0xab9e('0x11'),JSON['stringify'](_0x5bf231));if(_0x5bf231[_0xab9e('0x14')]){if(_0x5bf231[_0xab9e('0x14')][_0xab9e('0x15')]===0x1f4){logger[_0xab9e('0x14')](_0xab9e('0x10'),_0x482bcc,_0x5bf231[_0xab9e('0x14')][_0xab9e('0x16')]);return _0x2ebf73(_0x5bf231[_0xab9e('0x14')][_0xab9e('0x16')]);}logger['error'](_0xab9e('0x10'),_0x482bcc,_0x5bf231['error']['message']);return _0x2ef05c(_0x5bf231[_0xab9e('0x14')][_0xab9e('0x16')]);}else{logger[_0xab9e('0xf')](_0xab9e('0x10'),_0x482bcc,_0xab9e('0x11'));_0x2ef05c(_0x5bf231[_0xab9e('0x17')]['message']);}})['catch'](function(_0x232ea2){logger[_0xab9e('0x14')](_0xab9e('0x10'),_0x482bcc,_0x232ea2);_0x2ebf73(_0x232ea2);});});} \ No newline at end of file +var _0xe4c5=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring'];(function(_0x50ffbb,_0x21a925){var _0x576a1c=function(_0x8e27e6){while(--_0x8e27e6){_0x50ffbb['push'](_0x50ffbb['shift']());}};_0x576a1c(++_0x21a925);}(_0xe4c5,0x1b5));var _0x5e4c=function(_0x1b7859,_0x1ffe94){_0x1b7859=_0x1b7859-0x0;var _0x184aaf=_0xe4c5[_0x1b7859];return _0x184aaf;};'use strict';var _=require(_0x5e4c('0x0'));var util=require(_0x5e4c('0x1'));var moment=require(_0x5e4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e4c('0x3'));var fs=require('fs');var Redis=require(_0x5e4c('0x4'));var db=require(_0x5e4c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e4c('0x6'))(_0x5e4c('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e4c('0x8'));var client=jayson['client'][_0x5e4c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf708f5,_0x170bab,_0x240026){return new BPromise(function(_0x494bcf,_0x1fb0e7){return client[_0x5e4c('0xa')](_0xf708f5,_0x240026)[_0x5e4c('0xb')](function(_0x13ed6b){logger[_0x5e4c('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x170bab,_0x5e4c('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x170bab,'request\x20sent',JSON[_0x5e4c('0xe')](_0x13ed6b));if(_0x13ed6b[_0x5e4c('0xf')]){if(_0x13ed6b[_0x5e4c('0xf')][_0x5e4c('0x10')]===0x1f4){logger[_0x5e4c('0xf')](_0x5e4c('0x11'),_0x170bab,_0x13ed6b[_0x5e4c('0xf')][_0x5e4c('0x12')]);return _0x1fb0e7(_0x13ed6b[_0x5e4c('0xf')][_0x5e4c('0x12')]);}logger[_0x5e4c('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x170bab,_0x13ed6b[_0x5e4c('0xf')][_0x5e4c('0x12')]);return _0x494bcf(_0x13ed6b[_0x5e4c('0xf')][_0x5e4c('0x12')]);}else{logger[_0x5e4c('0xc')](_0x5e4c('0x11'),_0x170bab,_0x5e4c('0xd'));_0x494bcf(_0x13ed6b[_0x5e4c('0x13')][_0x5e4c('0x12')]);}})[_0x5e4c('0x14')](function(_0x3808d6){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x170bab,_0x3808d6);_0x1fb0e7(_0x3808d6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 564e2b9..5c242df 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb7325b,_0x1554ef){var _0x18c424=function(_0x49254a){while(--_0x49254a){_0xb7325b['push'](_0xb7325b['shift']());}};_0x18c424(++_0x1554ef);}(_0xe706,0xa3));var _0x6e70=function(_0x53ed0b,_0x25e205){_0x53ed0b=_0x53ed0b-0x0;var _0x453628=_0xe706[_0x53ed0b];return _0x453628;};'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(_0x1401bc,_0x35d4b8){var _0x40c977=function(_0x33c19a){while(--_0x33c19a){_0x1401bc['push'](_0x1401bc['shift']());}};_0x40c977(++_0x35d4b8);}(_0x70e0,0x17b));var _0x070e=function(_0x2bba0d,_0x5974f3){_0x2bba0d=_0x2bba0d-0x0;var _0xee5438=_0x70e0[_0x2bba0d];return _0xee5438;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6a9f593..f3b9d2b 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 _0x633e=['sequelize','exports','INTEGER'];(function(_0x3bf580,_0x2b9779){var _0x9b6cc1=function(_0x5854a3){while(--_0x5854a3){_0x3bf580['push'](_0x3bf580['shift']());}};_0x9b6cc1(++_0x2b9779);}(_0x633e,0x150));var _0xe633=function(_0x552af3,_0x53c3ac){_0x552af3=_0x552af3-0x0;var _0x5cbb6b=_0x633e[_0x552af3];return _0x5cbb6b;};'use strict';var Sequelize=require(_0xe633('0x0'));module[_0xe633('0x1')]={'penalty':{'type':Sequelize[_0xe633('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x718e=['exports','INTEGER','sequelize'];(function(_0xc32a79,_0x50edea){var _0x237a1b=function(_0x4702a7){while(--_0x4702a7){_0xc32a79['push'](_0xc32a79['shift']());}};_0x237a1b(++_0x50edea);}(_0x718e,0x131));var _0xe718=function(_0x345ed1,_0x37c0b){_0x345ed1=_0x345ed1-0x0;var _0x5d5f7a=_0x718e[_0x345ed1];return _0x5d5f7a;};'use strict';var Sequelize=require(_0xe718('0x0'));module[_0xe718('0x1')]={'penalty':{'type':Sequelize[_0xe718('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 8eda467..932f3d0 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 _0x723d=['exports','define','UserMailQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x43b0cc,_0x290906){var _0x244ae5=function(_0x4d5946){while(--_0x4d5946){_0x43b0cc['push'](_0x43b0cc['shift']());}};_0x244ae5(++_0x290906);}(_0x723d,0x189));var _0xd723=function(_0x1dbaee,_0x433c30){_0x1dbaee=_0x1dbaee-0x0;var _0x55b745=_0x723d[_0x1dbaee];return _0x55b745;};'use strict';var _=require(_0xd723('0x0'));var util=require(_0xd723('0x1'));var logger=require('../../config/logger')(_0xd723('0x2'));var moment=require(_0xd723('0x3'));var BPromise=require(_0xd723('0x4'));var rp=require(_0xd723('0x5'));var fs=require('fs');var path=require(_0xd723('0x6'));var rimraf=require(_0xd723('0x7'));var config=require(_0xd723('0x8'));var attributes=require(_0xd723('0x9'));module[_0xd723('0xa')]=function(_0x5e416a,_0x5c53fd){return _0x5e416a[_0xd723('0xb')](_0xd723('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9855=['path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x391aca,_0x2bc004){var _0x345869=function(_0x52d83b){while(--_0x52d83b){_0x391aca['push'](_0x391aca['shift']());}};_0x345869(++_0x2bc004);}(_0x9855,0xe5));var _0x5985=function(_0x5604cd,_0x406ac4){_0x5604cd=_0x5604cd-0x0;var _0x1df7ff=_0x9855[_0x5604cd];return _0x1df7ff;};'use strict';var _=require(_0x5985('0x0'));var util=require('util');var logger=require(_0x5985('0x1'))(_0x5985('0x2'));var moment=require(_0x5985('0x3'));var BPromise=require(_0x5985('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5985('0x5'));var rimraf=require(_0x5985('0x6'));var config=require(_0x5985('0x7'));var attributes=require(_0x5985('0x8'));module[_0x5985('0x9')]=function(_0x161d9b,_0x20d76b){return _0x161d9b[_0x5985('0xa')](_0x5985('0xb'),attributes,{'tableName':_0x5985('0xc'),'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 5dab845..8ab21e1 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x1f1c9d,_0xb88e2f){var _0x131e0f=function(_0xc129ba){while(--_0xc129ba){_0x1f1c9d['push'](_0x1f1c9d['shift']());}};_0x131e0f(++_0xb88e2f);}(_0xe14b,0x93));var _0xbe14=function(_0x34abdd,_0x4f9ed3){_0x34abdd=_0x34abdd-0x0;var _0x514273=_0xe14b[_0x34abdd];return _0x514273;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x184cc6,_0x4961ee){var _0x3f7435=function(_0x448fed){while(--_0x448fed){_0x184cc6['push'](_0x184cc6['shift']());}};_0x3f7435(++_0x4961ee);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xd07e81,_0x1ccacd){_0xd07e81=_0xd07e81-0x0;var _0x379364=_0xf3cd[_0xd07e81];return _0x379364;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9c223bd..8932ec0 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 _0x03ec=['sendUserNotification','exports','util','path','connect-timeout','express','Router','fs-extra','./userNotification.controller','post','isAuthenticated'];(function(_0x2765e1,_0xb416f7){var _0x3f6fb1=function(_0x36f7ab){while(--_0x36f7ab){_0x2765e1['push'](_0x2765e1['shift']());}};_0x3f6fb1(++_0xb416f7);}(_0x03ec,0x157));var _0xc03e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc03e('0x0'));var path=require(_0xc03e('0x1'));var timeout=require(_0xc03e('0x2'));var express=require(_0xc03e('0x3'));var router=express[_0xc03e('0x4')]();var fs_extra=require(_0xc03e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc03e('0x6'));router[_0xc03e('0x7')]('/',auth[_0xc03e('0x8')](),controller[_0xc03e('0x9')]);module[_0xc03e('0xa')]=router; \ No newline at end of file +var _0xa95b=['sendUserNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated'];(function(_0x35b10b,_0x45b5d6){var _0x56d04c=function(_0x363127){while(--_0x363127){_0x35b10b['push'](_0x35b10b['shift']());}};_0x56d04c(++_0x45b5d6);}(_0xa95b,0x1af));var _0xba95=function(_0x4648f8,_0x2b428b){_0x4648f8=_0x4648f8-0x0;var _0x38fd3e=_0xa95b[_0x4648f8];return _0x38fd3e;};'use strict';var multer=require(_0xba95('0x0'));var util=require('util');var path=require(_0xba95('0x1'));var timeout=require(_0xba95('0x2'));var express=require(_0xba95('0x3'));var router=express[_0xba95('0x4')]();var fs_extra=require(_0xba95('0x5'));var auth=require(_0xba95('0x6'));var interaction=require(_0xba95('0x7'));var config=require(_0xba95('0x8'));var controller=require(_0xba95('0x9'));router['post']('/',auth[_0xba95('0xa')](),controller[_0xba95('0xb')]);module[_0xba95('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3282af8..85ee857 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 _0xad80=['STRING','sequelize','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad80,0xb8));var _0x0ad8=function(_0x831f0,_0x8c01cd){_0x831f0=_0x831f0-0x0;var _0x14b1bb=_0xad80[_0x831f0];return _0x14b1bb;};'use strict';var Sequelize=require(_0x0ad8('0x0'));module['exports']={'body':{'type':Sequelize[_0x0ad8('0x1')]},'senderName':{'type':Sequelize[_0x0ad8('0x2')]},'recipientsId':{'type':Sequelize[_0x0ad8('0x1')]},'recipientsDescription':{'type':Sequelize[_0x0ad8('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xf7e5=['exports','STRING','TEXT','BOOLEAN'];(function(_0x41666d,_0x9ce09c){var _0x29af75=function(_0x248473){while(--_0x248473){_0x41666d['push'](_0x41666d['shift']());}};_0x29af75(++_0x9ce09c);}(_0xf7e5,0x1e8));var _0x5f7e=function(_0x3f618d,_0x19fe9b){_0x3f618d=_0x3f618d-0x0;var _0x4619d9=_0xf7e5[_0x3f618d];return _0x4619d9;};'use strict';var Sequelize=require('sequelize');module[_0x5f7e('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5f7e('0x1')]},'recipientsId':{'type':Sequelize[_0x5f7e('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5f7e('0x1')]},'beep':{'type':Sequelize[_0x5f7e('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ed418ea..dd36534 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 _0x410e=['map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','includes','queue','replace','Queue','push','flatten','getAgents'];(function(_0x1f7534,_0x349dda){var _0x7bee5a=function(_0x16bdd4){while(--_0x16bdd4){_0x1f7534['push'](_0x1f7534['shift']());}};_0x7bee5a(++_0x349dda);}(_0x410e,0x69));var _0xe410=function(_0x519afc,_0x34a25d){_0x519afc=_0x519afc-0x0;var _0x476fea=_0x410e[_0x519afc];return _0x476fea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe410('0x0'));var zipdir=require(_0xe410('0x1'));var jsonpatch=require(_0xe410('0x2'));var rp=require(_0xe410('0x3'));var moment=require(_0xe410('0x4'));var BPromise=require(_0xe410('0x5'));var Mustache=require(_0xe410('0x6'));var util=require(_0xe410('0x7'));var path=require(_0xe410('0x8'));var sox=require(_0xe410('0x9'));var csv=require('to-csv');var ejs=require(_0xe410('0xa'));var fs=require('fs');var fs_extra=require(_0xe410('0xb'));var _=require(_0xe410('0xc'));var squel=require(_0xe410('0xd'));var crypto=require('crypto');var jsforce=require(_0xe410('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe410('0xf'));var Papa=require('papaparse');var Redis=require(_0xe410('0x10'));var authService=require(_0xe410('0x11'));var qs=require(_0xe410('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe410('0x13'))(_0xe410('0x14'));var utils=require(_0xe410('0x15'));var config=require(_0xe410('0x16'));var licenseUtil=require(_0xe410('0x17'));var db=require(_0xe410('0x18'))['db'];config[_0xe410('0x19')]=_[_0xe410('0x1a')](config[_0xe410('0x19')],{'host':_0xe410('0x1b'),'port':0x18eb});var socket=require(_0xe410('0x1c'))(new Redis(config[_0xe410('0x19')]));require(_0xe410('0x1d'))['register'](socket);function respondWithStatusCode(_0x4b7c1e,_0x374d6d){_0x374d6d=_0x374d6d||0xcc;return function(_0x59fc0e){if(_0x59fc0e){return _0x4b7c1e[_0xe410('0x1e')](_0x374d6d);}return _0x4b7c1e[_0xe410('0x1f')](_0x374d6d)[_0xe410('0x20')]();};}function respondWithResult(_0x3c7836,_0x325e91){_0x325e91=_0x325e91||0xc8;return function(_0x3c7e91){if(_0x3c7e91){return _0x3c7836[_0xe410('0x1f')](_0x325e91)['json'](_0x3c7e91);}};}function respondWithFilteredResult(_0x57f52b,_0x4e5b9b){return function(_0x1db2df){if(_0x1db2df){var _0x279a5b=typeof _0x4e5b9b[_0xe410('0x21')]==='undefined'&&typeof _0x4e5b9b[_0xe410('0x22')]===_0xe410('0x23');var _0x4e7fd9=_0x1db2df[_0xe410('0x24')];var _0x4be7c5=_0x279a5b?0x0:_0x4e5b9b[_0xe410('0x21')];var _0x118c77=_0x279a5b?_0x1db2df[_0xe410('0x24')]:_0x4e5b9b[_0xe410('0x21')]+_0x4e5b9b[_0xe410('0x22')];var _0x8eb95e;if(_0x118c77>=_0x4e7fd9){_0x118c77=_0x4e7fd9;_0x8eb95e=0xc8;}else{_0x8eb95e=0xce;}_0x57f52b[_0xe410('0x1f')](_0x8eb95e);return _0x57f52b[_0xe410('0x25')](_0xe410('0x26'),_0x4be7c5+'-'+_0x118c77+'/'+_0x4e7fd9)[_0xe410('0x27')](_0x1db2df);}return null;};}function patchUpdates(_0x19352c){return function(_0x17c6cf){try{jsonpatch[_0xe410('0x28')](_0x17c6cf,_0x19352c,!![]);}catch(_0x54980a){return BPromise[_0xe410('0x29')](_0x54980a);}return _0x17c6cf[_0xe410('0x2a')]();};}function saveUpdates(_0x368e75,_0x3bc0e5){return function(_0x46282a){if(_0x46282a){return _0x46282a[_0xe410('0x2b')](_0x368e75)[_0xe410('0x2c')](function(_0x467f31){return _0x467f31;});}return null;};}function removeEntity(_0x2c725a,_0x1cc850){return function(_0x596a81){if(_0x596a81){return _0x596a81['destroy']()['then'](function(){_0x2c725a['status'](0xcc)[_0xe410('0x20')]();});}};}function handleEntityNotFound(_0x3cf4a8,_0x5cdd5d){return function(_0xfc70e4){if(!_0xfc70e4){_0x3cf4a8['sendStatus'](0x194);}return _0xfc70e4;};}function handleError(_0xbe0194,_0x323e70){_0x323e70=_0x323e70||0x1f4;return function(_0x4cc7c8){logger[_0xe410('0x2d')](_0x4cc7c8[_0xe410('0x2e')]);if(_0x4cc7c8[_0xe410('0x2f')]){delete _0x4cc7c8[_0xe410('0x2f')];}_0xbe0194['status'](_0x323e70)[_0xe410('0x30')](_0x4cc7c8);};}exports[_0xe410('0x31')]=function(_0x1ae061,_0x3f3498,_0x5316a9){if(!_0x1ae061[_0xe410('0x32')][_0xe410('0x33')](_0xe410('0x34'))&&!_0x1ae061[_0xe410('0x32')][_0xe410('0x33')](_0xe410('0x35'))){throw new db['Sequelize'][(_0xe410('0x36'))](_0xe410('0x37'));}else{if(_0x1ae061[_0xe410('0x32')]['hasOwnProperty']('TemplateId')&&!_0x1ae061[_0xe410('0x32')][_0xe410('0x33')](_0xe410('0x38'))){throw new db[(_0xe410('0x39'))][(_0xe410('0x36'))](_0xe410('0x3a'));}if(!_0x1ae061[_0xe410('0x32')][_0xe410('0x33')](_0xe410('0x3b'))){throw new db[(_0xe410('0x39'))][(_0xe410('0x36'))](_0xe410('0x3c'));}else{try{var _0x3c9004=JSON['parse'](_0x1ae061[_0xe410('0x32')][_0xe410('0x3b')]);}catch(_0x53f67d){logger[_0xe410('0x2d')](_0x53f67d);throw new db[(_0xe410('0x39'))][(_0xe410('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x387e6a=[_0xe410('0x3d'),_0xe410('0x3e'),_0xe410('0x3f'),_0xe410('0x40'),_0xe410('0x41'),_0xe410('0x42'),_0xe410('0x43'),_0xe410('0x44'),_0xe410('0x45')];if(_[_0xe410('0x46')](_0x3c9004,function(_0x3fd351){return!_['includes'](_0x387e6a,_0x3fd351['model'][_0xe410('0x47')]());})){throw new db[(_0xe410('0x39'))][(_0xe410('0x36'))](_0xe410('0x48'));}}}var _0x226ccd={};_0x226ccd[_0xe410('0x49')]=_0x1ae061[_0xe410('0x32')]['hasOwnProperty'](_0xe410('0x49'))?_0x1ae061['body'][_0xe410('0x49')]:_0x1ae061[_0xe410('0x45')][_0xe410('0x4a')];_0x226ccd[_0xe410('0x4b')]=_['isEmpty'](_0x1ae061[_0xe410('0x32')][_0xe410('0x4b')])?null:_0x1ae061[_0xe410('0x32')][_0xe410('0x4b')];_0x226ccd[_0xe410('0x4c')]=_0x1ae061[_0xe410('0x32')][_0xe410('0x4c')]||![];_0x226ccd[_0xe410('0x4d')]=_0x1ae061['user']['id'];return getContent(_0x1ae061[_0xe410('0x32')])[_0xe410('0x2c')](function(_0x38964a){_0x226ccd['body']=_0x38964a;return getRecipients(_0x3c9004);})['then'](function(_0x6d08f1){_0x226ccd[_0xe410('0x4e')]=_[_0xe410('0x4f')](_0x6d08f1)['join'](',');return db[_0xe410('0x50')][_0xe410('0x51')](function(_0x53bf9c){return db[_0xe410('0x52')][_0xe410('0x53')](_0x226ccd,{'raw':!![],'transaction':_0x53bf9c})[_0xe410('0x2c')](function(_0x9646e9){var _0x42ed45={'sender':_0x226ccd[_0xe410('0x49')],'description':_0x226ccd[_0xe410('0x4b')],'content':_0x226ccd[_0xe410('0x32')],'beep':_0x226ccd[_0xe410('0x4c')]};_0x6d08f1[_0xe410('0x54')](function(_0x4c8b59){_0x42ed45['recipient']=_0x4c8b59;socket[_0xe410('0x55')](_0xe410('0x56'),_0x42ed45);});return _0x9646e9;});});})[_0xe410('0x2c')](respondWithResult(_0x3f3498,0xc9))[_0xe410('0x57')](handleError(_0x3f3498,null));};function getContent(_0x4a52ac){return new BPromise(function(_0x1cee3c,_0x3f1a08){if(_0x4a52ac[_0xe410('0x34')]){_0x1cee3c(_0x4a52ac['text']);return;}return db['Template'][_0xe410('0x58')]({'attributes':[_0xe410('0x59')],'where':{'id':_0x4a52ac[_0xe410('0x35')]},'raw':!![]})['then'](function(_0x54f665){if(!_0x54f665)throw new db[(_0xe410('0x39'))][(_0xe410('0x36'))](_0xe410('0x5a'));var _0x5351ec=Mustache[_0xe410('0x5b')](_0x54f665['html'],_0x4a52ac[_0xe410('0x38')]);_0x1cee3c(_0x5351ec);})['catch'](function(_0x59abd9){_0x3f1a08(_0x59abd9);});});}function getRecipients(_0x4cfa47){return new BPromise(function(_0x58617a,_0x3d01ea){var _0x5dcaab=[];var _0x57f74b=[];_0x4cfa47[_0xe410('0x54')](function(_0x2f0cd1){var _0x114dcb=_[_0xe410('0x5c')](_0x2f0cd1['model'][_0xe410('0x47')]());if(_0x114dcb===_0xe410('0x5d')){_0x5dcaab=_[_0xe410('0x5e')](_0x5dcaab,_0x2f0cd1[_0xe410('0x5f')]);}else{if(_[_0xe410('0x60')](_0x114dcb,_0xe410('0x61')))_0x114dcb=_0x114dcb[_0xe410('0x62')]('queue',_0xe410('0x63'));_0x2f0cd1[_0xe410('0x5f')]['forEach'](function(_0x5f2853){_0x57f74b[_0xe410('0x64')](getAgents(_0x114dcb,_0x5f2853));});}});return BPromise['all'](_0x57f74b)[_0xe410('0x2c')](function(_0x5dbdfc){_0x5dcaab=_[_0xe410('0x5e')](_0x5dcaab,_[_0xe410('0x65')](_0x5dbdfc));_0x58617a(_0x5dcaab);})['catch'](function(_0x38de13){_0x3d01ea(_0x38de13);});});}function getAgents(_0x23ccac,_0x222065){return new BPromise(function(_0x8f109,_0x54bda3){return db[_0x23ccac][_0xe410('0x58')]({'where':{'id':_0x222065}})[_0xe410('0x2c')](function(_0x41c834){return _0x41c834[_0xe410('0x66')]({'attributes':['id'],'raw':!![]})[_0xe410('0x2c')](function(_0x2732b9){var _0x120a21=_[_0xe410('0x67')](_0x2732b9,'id');_0x8f109(_0x120a21);});})[_0xe410('0x57')](function(_0x4216bf){_0x54bda3(_0x4216bf);});});} \ No newline at end of file +var _0xb5b6=['sequelize','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids','queue','replace','Queue','push','all','map','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','sendStatus','stack','name','sendUserNotification','body','text','TemplateId','Sequelize','ValidationError','hasOwnProperty','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','chatqueue','faxqueue','openchannelqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId'];(function(_0x3078c4,_0x69188e){var _0x127e34=function(_0xde7668){while(--_0xde7668){_0x3078c4['push'](_0x3078c4['shift']());}};_0x127e34(++_0x69188e);}(_0xb5b6,0x130));var _0x6b5b=function(_0x5e864f,_0x1c539e){_0x5e864f=_0x5e864f-0x0;var _0xc7ef37=_0xb5b6[_0x5e864f];return _0xc7ef37;};'use strict';var emlformat=require(_0x6b5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b5b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b5b('0x2'));var BPromise=require(_0x6b5b('0x3'));var Mustache=require(_0x6b5b('0x4'));var util=require('util');var path=require(_0x6b5b('0x5'));var sox=require(_0x6b5b('0x6'));var csv=require(_0x6b5b('0x7'));var ejs=require(_0x6b5b('0x8'));var fs=require('fs');var fs_extra=require(_0x6b5b('0x9'));var _=require('lodash');var squel=require(_0x6b5b('0xa'));var crypto=require(_0x6b5b('0xb'));var jsforce=require(_0x6b5b('0xc'));var deskjs=require(_0x6b5b('0xd'));var toCsv=require(_0x6b5b('0x7'));var querystring=require(_0x6b5b('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b5b('0xf'));var authService=require(_0x6b5b('0x10'));var qs=require(_0x6b5b('0x11'));var as=require(_0x6b5b('0x12'));var hardwareService=require(_0x6b5b('0x13'));var logger=require(_0x6b5b('0x14'))(_0x6b5b('0x15'));var utils=require('../../config/utils');var config=require(_0x6b5b('0x16'));var licenseUtil=require(_0x6b5b('0x17'));var db=require(_0x6b5b('0x18'))['db'];config[_0x6b5b('0x19')]=_[_0x6b5b('0x1a')](config[_0x6b5b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b5b('0x1b'))(new Redis(config[_0x6b5b('0x19')]));require('./userNotification.socket')[_0x6b5b('0x1c')](socket);function respondWithStatusCode(_0x29f6cb,_0x2c9845){_0x2c9845=_0x2c9845||0xcc;return function(_0x22d04a){if(_0x22d04a){return _0x29f6cb['sendStatus'](_0x2c9845);}return _0x29f6cb[_0x6b5b('0x1d')](_0x2c9845)['end']();};}function respondWithResult(_0x32b0dc,_0x45a708){_0x45a708=_0x45a708||0xc8;return function(_0x17cbda){if(_0x17cbda){return _0x32b0dc['status'](_0x45a708)[_0x6b5b('0x1e')](_0x17cbda);}};}function respondWithFilteredResult(_0x2bb14d,_0x1e4039){return function(_0x36ba7f){if(_0x36ba7f){var _0x287d13=typeof _0x1e4039['offset']===_0x6b5b('0x1f')&&typeof _0x1e4039[_0x6b5b('0x20')]===_0x6b5b('0x1f');var _0x3beb5e=_0x36ba7f[_0x6b5b('0x21')];var _0x58cec8=_0x287d13?0x0:_0x1e4039['offset'];var _0x5accd4=_0x287d13?_0x36ba7f[_0x6b5b('0x21')]:_0x1e4039[_0x6b5b('0x22')]+_0x1e4039[_0x6b5b('0x20')];var _0x19cbf5;if(_0x5accd4>=_0x3beb5e){_0x5accd4=_0x3beb5e;_0x19cbf5=0xc8;}else{_0x19cbf5=0xce;}_0x2bb14d[_0x6b5b('0x1d')](_0x19cbf5);return _0x2bb14d[_0x6b5b('0x23')](_0x6b5b('0x24'),_0x58cec8+'-'+_0x5accd4+'/'+_0x3beb5e)['json'](_0x36ba7f);}return null;};}function patchUpdates(_0x546993){return function(_0x2f6234){try{jsonpatch[_0x6b5b('0x25')](_0x2f6234,_0x546993,!![]);}catch(_0x489328){return BPromise[_0x6b5b('0x26')](_0x489328);}return _0x2f6234[_0x6b5b('0x27')]();};}function saveUpdates(_0x49f976,_0x82b9ad){return function(_0x40fb5f){if(_0x40fb5f){return _0x40fb5f['update'](_0x49f976)[_0x6b5b('0x28')](function(_0x332bdf){return _0x332bdf;});}return null;};}function removeEntity(_0x387d05,_0x4ac996){return function(_0xaee54a){if(_0xaee54a){return _0xaee54a['destroy']()[_0x6b5b('0x28')](function(){_0x387d05[_0x6b5b('0x1d')](0xcc)[_0x6b5b('0x29')]();});}};}function handleEntityNotFound(_0x524382,_0x389c43){return function(_0x309e16){if(!_0x309e16){_0x524382[_0x6b5b('0x2a')](0x194);}return _0x309e16;};}function handleError(_0x40fd42,_0x87423e){_0x87423e=_0x87423e||0x1f4;return function(_0xa5c291){logger['error'](_0xa5c291[_0x6b5b('0x2b')]);if(_0xa5c291[_0x6b5b('0x2c')]){delete _0xa5c291[_0x6b5b('0x2c')];}_0x40fd42[_0x6b5b('0x1d')](_0x87423e)['send'](_0xa5c291);};}exports[_0x6b5b('0x2d')]=function(_0x2253b4,_0x247a98,_0x3d035e){if(!_0x2253b4[_0x6b5b('0x2e')]['hasOwnProperty'](_0x6b5b('0x2f'))&&!_0x2253b4['body']['hasOwnProperty'](_0x6b5b('0x30'))){throw new db[(_0x6b5b('0x31'))][(_0x6b5b('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2253b4['body'][_0x6b5b('0x33')](_0x6b5b('0x30'))&&!_0x2253b4['body'][_0x6b5b('0x33')]('view')){throw new db[(_0x6b5b('0x31'))][(_0x6b5b('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2253b4['body']['hasOwnProperty'](_0x6b5b('0x34'))){throw new db[(_0x6b5b('0x31'))][(_0x6b5b('0x32'))](_0x6b5b('0x35'));}else{try{var _0x4f3573=JSON[_0x6b5b('0x36')](_0x2253b4[_0x6b5b('0x2e')][_0x6b5b('0x34')]);}catch(_0x34c70f){logger[_0x6b5b('0x37')](_0x34c70f);throw new db[(_0x6b5b('0x31'))][(_0x6b5b('0x32'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2494d2=[_0x6b5b('0x38'),_0x6b5b('0x39'),'mailqueue',_0x6b5b('0x3a'),'smsqueue','voicequeue','whatsappqueue',_0x6b5b('0x3b'),_0x6b5b('0x3c')];if(_['some'](_0x4f3573,function(_0x313053){return!_[_0x6b5b('0x3d')](_0x2494d2,_0x313053[_0x6b5b('0x3e')][_0x6b5b('0x3f')]());})){throw new db['Sequelize']['ValidationError'](_0x6b5b('0x40'));}}}var _0x27a2c6={};_0x27a2c6[_0x6b5b('0x41')]=_0x2253b4[_0x6b5b('0x2e')][_0x6b5b('0x33')]('senderName')?_0x2253b4[_0x6b5b('0x2e')]['senderName']:_0x2253b4[_0x6b5b('0x3c')][_0x6b5b('0x42')];_0x27a2c6[_0x6b5b('0x43')]=_[_0x6b5b('0x44')](_0x2253b4[_0x6b5b('0x2e')]['recipientsDescription'])?null:_0x2253b4[_0x6b5b('0x2e')][_0x6b5b('0x43')];_0x27a2c6['beep']=_0x2253b4[_0x6b5b('0x2e')][_0x6b5b('0x45')]||![];_0x27a2c6[_0x6b5b('0x46')]=_0x2253b4[_0x6b5b('0x3c')]['id'];return getContent(_0x2253b4[_0x6b5b('0x2e')])[_0x6b5b('0x28')](function(_0x5f4473){_0x27a2c6[_0x6b5b('0x2e')]=_0x5f4473;return getRecipients(_0x4f3573);})[_0x6b5b('0x28')](function(_0x327c0c){_0x27a2c6[_0x6b5b('0x47')]=_['sortBy'](_0x327c0c)['join'](',');return db[_0x6b5b('0x48')]['transaction'](function(_0x1b628b){return db['UserNotification']['create'](_0x27a2c6,{'raw':!![],'transaction':_0x1b628b})[_0x6b5b('0x28')](function(_0x4b2de2){var _0x1407dc={'sender':_0x27a2c6[_0x6b5b('0x41')],'description':_0x27a2c6[_0x6b5b('0x43')],'content':_0x27a2c6[_0x6b5b('0x2e')],'beep':_0x27a2c6[_0x6b5b('0x45')]};_0x327c0c[_0x6b5b('0x49')](function(_0x49d9f9){_0x1407dc[_0x6b5b('0x4a')]=_0x49d9f9;socket[_0x6b5b('0x4b')](_0x6b5b('0x4c'),_0x1407dc);});return _0x4b2de2;});});})[_0x6b5b('0x28')](respondWithResult(_0x247a98,0xc9))[_0x6b5b('0x4d')](handleError(_0x247a98,null));};function getContent(_0x3629ae){return new BPromise(function(_0x2869cb,_0x7ee79a){if(_0x3629ae[_0x6b5b('0x2f')]){_0x2869cb(_0x3629ae[_0x6b5b('0x2f')]);return;}return db[_0x6b5b('0x4e')][_0x6b5b('0x4f')]({'attributes':[_0x6b5b('0x50')],'where':{'id':_0x3629ae[_0x6b5b('0x30')]},'raw':!![]})[_0x6b5b('0x28')](function(_0x8521ba){if(!_0x8521ba)throw new db[(_0x6b5b('0x31'))][(_0x6b5b('0x32'))](_0x6b5b('0x51'));var _0x13cd35=Mustache[_0x6b5b('0x52')](_0x8521ba[_0x6b5b('0x50')],_0x3629ae[_0x6b5b('0x53')]);_0x2869cb(_0x13cd35);})[_0x6b5b('0x4d')](function(_0x3582cc){_0x7ee79a(_0x3582cc);});});}function getRecipients(_0x3b8f18){return new BPromise(function(_0x32279a,_0x245714){var _0x2549de=[];var _0x3aab94=[];_0x3b8f18['forEach'](function(_0x43f627){var _0x3fdd99=_[_0x6b5b('0x54')](_0x43f627[_0x6b5b('0x3e')][_0x6b5b('0x3f')]());if(_0x3fdd99===_0x6b5b('0x55')){_0x2549de=_[_0x6b5b('0x56')](_0x2549de,_0x43f627[_0x6b5b('0x57')]);}else{if(_[_0x6b5b('0x3d')](_0x3fdd99,_0x6b5b('0x58')))_0x3fdd99=_0x3fdd99[_0x6b5b('0x59')](_0x6b5b('0x58'),_0x6b5b('0x5a'));_0x43f627[_0x6b5b('0x57')]['forEach'](function(_0x306f4e){_0x3aab94[_0x6b5b('0x5b')](getAgents(_0x3fdd99,_0x306f4e));});}});return BPromise[_0x6b5b('0x5c')](_0x3aab94)[_0x6b5b('0x28')](function(_0x4371cd){_0x2549de=_[_0x6b5b('0x56')](_0x2549de,_['flatten'](_0x4371cd));_0x32279a(_0x2549de);})['catch'](function(_0x86aff2){_0x245714(_0x86aff2);});});}function getAgents(_0x210d31,_0x2dba96){return new BPromise(function(_0x575bb3,_0x1e1885){return db[_0x210d31][_0x6b5b('0x4f')]({'where':{'id':_0x2dba96}})[_0x6b5b('0x28')](function(_0x1fbfe7){return _0x1fbfe7['getAgents']({'attributes':['id'],'raw':!![]})[_0x6b5b('0x28')](function(_0x1312f1){var _0xb2c50b=_[_0x6b5b('0x5d')](_0x1312f1,'id');_0x575bb3(_0xb2c50b);});})[_0x6b5b('0x4d')](function(_0x4f8e99){_0x1e1885(_0x4f8e99);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index be56fec..010f167 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 _0x7b61=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7b61,0x149));var _0x17b6=function(_0x441737,_0x5863bc){_0x441737=_0x441737-0x0;var _0x5534fc=_0x7b61[_0x441737];return _0x5534fc;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x17b6('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x17b6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x17b6('0x2'),'afterDestroy':_0x17b6('0x3')};function emitEvent(_0x1368b9){return function(_0x160e76,_0x467f82,_0x3074ca){UserNotificationEvents[_0x17b6('0x4')](_0x1368b9+':'+_0x160e76['id'],_0x160e76);UserNotificationEvents[_0x17b6('0x4')](_0x1368b9,_0x160e76);_0x3074ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x17b6('0x5')](e,emitEvent(event));}}module[_0x17b6('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xbfcc=['hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbfcc,0x71));var _0xcbfc=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xbfcc[_0x4d8dc3];return _0x9b03d9;};'use strict';var EventEmitter=require(_0xcbfc('0x0'));var UserNotification=require(_0xcbfc('0x1'))['db'][_0xcbfc('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcbfc('0x3'),'afterUpdate':_0xcbfc('0x4'),'afterDestroy':_0xcbfc('0x5')};function emitEvent(_0x74fe8a){return function(_0x2ab777,_0x1875ed,_0x21f5da){UserNotificationEvents[_0xcbfc('0x6')](_0x74fe8a+':'+_0x2ab777['id'],_0x2ab777);UserNotificationEvents[_0xcbfc('0x6')](_0x74fe8a,_0x2ab777);_0x21f5da(null);};}for(var e in events){if(events[_0xcbfc('0x7')](e)){var event=events[e];UserNotification[_0xcbfc('0x8')](e,emitEvent(event));}}module[_0xcbfc('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 41d9c34..62cbb30 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 _0x354c=['UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','define'];(function(_0x10dcbe,_0x30d60d){var _0x294e6b=function(_0x5ff33b){while(--_0x5ff33b){_0x10dcbe['push'](_0x10dcbe['shift']());}};_0x294e6b(++_0x30d60d);}(_0x354c,0x1e4));var _0xc354=function(_0x36c4bd,_0x4a51df){_0x36c4bd=_0x36c4bd-0x0;var _0x481e5a=_0x354c[_0x36c4bd];return _0x481e5a;};'use strict';var _=require(_0xc354('0x0'));var util=require(_0xc354('0x1'));var logger=require(_0xc354('0x2'))(_0xc354('0x3'));var moment=require('moment');var BPromise=require(_0xc354('0x4'));var rp=require(_0xc354('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc354('0x6'));var config=require(_0xc354('0x7'));var attributes=require(_0xc354('0x8'));module['exports']=function(_0x548ee0,_0x11c24b){return _0x548ee0[_0xc354('0x9')](_0xc354('0xa'),attributes,{'tableName':_0xc354('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc354('0xc')});}; \ No newline at end of file +var _0x65ef=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x65ef,0x7d));var _0xf65e=function(_0x3553e8,_0x25f8a7){_0x3553e8=_0x3553e8-0x0;var _0x51b047=_0x65ef[_0x3553e8];return _0x51b047;};'use strict';var _=require(_0xf65e('0x0'));var util=require(_0xf65e('0x1'));var logger=require(_0xf65e('0x2'))(_0xf65e('0x3'));var moment=require(_0xf65e('0x4'));var BPromise=require(_0xf65e('0x5'));var rp=require(_0xf65e('0x6'));var fs=require('fs');var path=require(_0xf65e('0x7'));var rimraf=require(_0xf65e('0x8'));var config=require('../../config/environment');var attributes=require(_0xf65e('0x9'));module[_0xf65e('0xa')]=function(_0x11fcca,_0x406987){return _0x11fcca[_0xf65e('0xb')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf65e('0xc'),'collate':_0xf65e('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 886faff..5a055f9 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 _0x213c=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x213c,0x160));var _0xc213=function(_0x1769e6,_0x44b01d){_0x1769e6=_0x1769e6-0x0;var _0x184227=_0x213c[_0x1769e6];return _0x184227;};'use strict';var _=require(_0xc213('0x0'));var util=require(_0xc213('0x1'));var moment=require(_0xc213('0x2'));var BPromise=require(_0xc213('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc213('0x4'));var db=require(_0xc213('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc213('0x6'))(_0xc213('0x7'));var config=require(_0xc213('0x8'));var jayson=require(_0xc213('0x9'));var client=jayson[_0xc213('0xa')][_0xc213('0xb')]({'port':0x232a});config[_0xc213('0xc')]=_[_0xc213('0xd')](config['redis'],{'host':_0xc213('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc213('0xc')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0xbe28f8,_0x1e8765,_0x2248a5){return new BPromise(function(_0x1f7cac,_0x55985d){return client[_0xc213('0xf')](_0xbe28f8,_0x2248a5)['then'](function(_0x3a5682){logger[_0xc213('0x10')](_0xc213('0x11'),_0x1e8765,_0xc213('0x12'));logger[_0xc213('0x13')](_0xc213('0x14'),_0x1e8765,_0xc213('0x12'),JSON['stringify'](_0x3a5682));if(_0x3a5682['error']){if(_0x3a5682[_0xc213('0x15')][_0xc213('0x16')]===0x1f4){logger[_0xc213('0x15')](_0xc213('0x11'),_0x1e8765,_0x3a5682[_0xc213('0x15')][_0xc213('0x17')]);return _0x55985d(_0x3a5682[_0xc213('0x15')][_0xc213('0x17')]);}logger['error'](_0xc213('0x11'),_0x1e8765,_0x3a5682[_0xc213('0x15')][_0xc213('0x17')]);return _0x1f7cac(_0x3a5682[_0xc213('0x15')]['message']);}else{logger[_0xc213('0x10')](_0xc213('0x11'),_0x1e8765,_0xc213('0x12'));_0x1f7cac(_0x3a5682['result'][_0xc213('0x17')]);}})['catch'](function(_0x5b9765){logger['error']('UserNotification,\x20%s,\x20%s',_0x1e8765,_0x5b9765);_0x55985d(_0x5b9765);});});} \ No newline at end of file +var _0x334a=['stringify','error','UserNotification,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','then','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x3a4d9c,_0x1e0bd5){var _0x5eae64=function(_0x4f83da){while(--_0x4f83da){_0x3a4d9c['push'](_0x3a4d9c['shift']());}};_0x5eae64(++_0x1e0bd5);}(_0x334a,0x123));var _0xa334=function(_0x5a7226,_0x138e12){_0x5a7226=_0x5a7226-0x0;var _0x4fef07=_0x334a[_0x5a7226];return _0x4fef07;};'use strict';var _=require(_0xa334('0x0'));var util=require(_0xa334('0x1'));var moment=require(_0xa334('0x2'));var BPromise=require(_0xa334('0x3'));var rs=require(_0xa334('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa334('0x5'))['db'];var utils=require(_0xa334('0x6'));var logger=require(_0xa334('0x7'))(_0xa334('0x8'));var config=require(_0xa334('0x9'));var jayson=require(_0xa334('0xa'));var client=jayson[_0xa334('0xb')][_0xa334('0xc')]({'port':0x232a});config[_0xa334('0xd')]=_[_0xa334('0xe')](config[_0xa334('0xd')],{'host':_0xa334('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa334('0xd')]));require(_0xa334('0x10'))['register'](socket);function respondWithRpcPromise(_0x28774a,_0x3b690e,_0x20501d){return new BPromise(function(_0x4c2822,_0x38501f){return client['request'](_0x28774a,_0x20501d)[_0xa334('0x11')](function(_0x103fbe){logger[_0xa334('0x12')]('UserNotification,\x20%s,\x20%s',_0x3b690e,_0xa334('0x13'));logger['debug'](_0xa334('0x14'),_0x3b690e,_0xa334('0x13'),JSON[_0xa334('0x15')](_0x103fbe));if(_0x103fbe['error']){if(_0x103fbe[_0xa334('0x16')]['code']===0x1f4){logger[_0xa334('0x16')](_0xa334('0x17'),_0x3b690e,_0x103fbe[_0xa334('0x16')][_0xa334('0x18')]);return _0x38501f(_0x103fbe['error'][_0xa334('0x18')]);}logger[_0xa334('0x16')](_0xa334('0x17'),_0x3b690e,_0x103fbe['error'][_0xa334('0x18')]);return _0x4c2822(_0x103fbe[_0xa334('0x16')][_0xa334('0x18')]);}else{logger[_0xa334('0x12')](_0xa334('0x17'),_0x3b690e,_0xa334('0x13'));_0x4c2822(_0x103fbe[_0xa334('0x19')][_0xa334('0x18')]);}})['catch'](function(_0x2423a5){logger[_0xa334('0x16')](_0xa334('0x17'),_0x3b690e,_0x2423a5);_0x38501f(_0x2423a5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 33bfab4..e856d50 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 _0x7f7f=['./userNotification.events','save','remove','update','emit','removeListener','register','userNotification:'];(function(_0x172cce,_0x43b05f){var _0x186347=function(_0x482743){while(--_0x482743){_0x172cce['push'](_0x172cce['shift']());}};_0x186347(++_0x43b05f);}(_0x7f7f,0x78));var _0xf7f7=function(_0x46bcec,_0x27b673){_0x46bcec=_0x46bcec-0x0;var _0x45ffd4=_0x7f7f[_0x46bcec];return _0x45ffd4;};'use strict';var UserNotificationEvents=require(_0xf7f7('0x0'));var events=[_0xf7f7('0x1'),_0xf7f7('0x2'),_0xf7f7('0x3')];function createListener(_0x55ecb4,_0x492a3e){return function(_0x59d0d7){_0x492a3e[_0xf7f7('0x4')](_0x55ecb4,_0x59d0d7);};}function removeListener(_0x1f33a4,_0x1ab701){return function(){UserNotificationEvents[_0xf7f7('0x5')](_0x1f33a4,_0x1ab701);};}exports[_0xf7f7('0x6')]=function(_0x4b2506){for(var _0x243940=0x0,_0x5c4a7e=events['length'];_0x243940<_0x5c4a7e;_0x243940++){var _0x1ffa1e=events[_0x243940];var _0x33f07b=createListener(_0xf7f7('0x7')+_0x1ffa1e,_0x4b2506);UserNotificationEvents['on'](_0x1ffa1e,_0x33f07b);}}; \ No newline at end of file +var _0xefe0=['removeListener','register','userNotification:','./userNotification.events','save','remove','update','emit'];(function(_0x23337a,_0x996d8e){var _0x2710e1=function(_0x305ed5){while(--_0x305ed5){_0x23337a['push'](_0x23337a['shift']());}};_0x2710e1(++_0x996d8e);}(_0xefe0,0xa3));var _0x0efe=function(_0xfb86f6,_0x127103){_0xfb86f6=_0xfb86f6-0x0;var _0x534a4b=_0xefe0[_0xfb86f6];return _0x534a4b;};'use strict';var UserNotificationEvents=require(_0x0efe('0x0'));var events=[_0x0efe('0x1'),_0x0efe('0x2'),_0x0efe('0x3')];function createListener(_0x3d520a,_0x223c90){return function(_0x20b151){_0x223c90[_0x0efe('0x4')](_0x3d520a,_0x20b151);};}function removeListener(_0x5334e7,_0x36869f){return function(){UserNotificationEvents[_0x0efe('0x5')](_0x5334e7,_0x36869f);};}exports[_0x0efe('0x6')]=function(_0x2aeb0f){for(var _0xa4df89=0x0,_0x1b21d6=events['length'];_0xa4df89<_0x1b21d6;_0xa4df89++){var _0x394718=events[_0xa4df89];var _0x566cd3=createListener(_0x0efe('0x7')+_0x394718,_0x2aeb0f);UserNotificationEvents['on'](_0x394718,_0x566cd3);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 38d3144..8a0a09a 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1da5a9,_0x59eb2f){var _0x3ab488=function(_0x2bddb2){while(--_0x2bddb2){_0x1da5a9['push'](_0x1da5a9['shift']());}};_0x3ab488(++_0x59eb2f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xcb91[_0x1399d6];return _0x4a9db4;};'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(_0x42c7b5,_0x3f2ccf){var _0x3919b2=function(_0x2e04c9){while(--_0x2e04c9){_0x42c7b5['push'](_0x42c7b5['shift']());}};_0x3919b2(++_0x3f2ccf);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index f0be2cd..71137e5 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 _0x1ab4=['sequelize','INTEGER'];(function(_0x15529b,_0x233df7){var _0x2948ea=function(_0x9840dc){while(--_0x9840dc){_0x15529b['push'](_0x15529b['shift']());}};_0x2948ea(++_0x233df7);}(_0x1ab4,0x1ae));var _0x41ab=function(_0x2622f2,_0xeb6538){_0x2622f2=_0x2622f2-0x0;var _0x500f5b=_0x1ab4[_0x2622f2];return _0x500f5b;};'use strict';var Sequelize=require(_0x41ab('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x41ab('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x68c2=['exports','INTEGER'];(function(_0x2f6de1,_0x402f58){var _0x4f2cd1=function(_0x3eb678){while(--_0x3eb678){_0x2f6de1['push'](_0x2f6de1['shift']());}};_0x4f2cd1(++_0x402f58);}(_0x68c2,0x1e8));var _0x268c=function(_0x19c483,_0x3b63fc){_0x19c483=_0x19c483-0x0;var _0x47ae32=_0x68c2[_0x19c483];return _0x47ae32;};'use strict';var Sequelize=require('sequelize');module[_0x268c('0x0')]={'penalty':{'type':Sequelize[_0x268c('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 f21c045..982fe3d 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 _0x65d4=['request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3ed25d,_0x6c37b2){var _0x5e0998=function(_0x3e53a4){while(--_0x3e53a4){_0x3ed25d['push'](_0x3ed25d['shift']());}};_0x5e0998(++_0x6c37b2);}(_0x65d4,0xf6));var _0x465d=function(_0x3d3bad,_0x1a7565){_0x3d3bad=_0x3d3bad-0x0;var _0x386fca=_0x65d4[_0x3d3bad];return _0x386fca;};'use strict';var _=require(_0x465d('0x0'));var util=require(_0x465d('0x1'));var logger=require(_0x465d('0x2'))(_0x465d('0x3'));var moment=require(_0x465d('0x4'));var BPromise=require(_0x465d('0x5'));var rp=require(_0x465d('0x6'));var fs=require('fs');var path=require(_0x465d('0x7'));var rimraf=require(_0x465d('0x8'));var config=require('../../config/environment');var attributes=require(_0x465d('0x9'));module[_0x465d('0xa')]=function(_0x5ed2cd,_0xa7a1bd){return _0x5ed2cd[_0x465d('0xb')](_0x465d('0xc'),attributes,{'tableName':_0x465d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bcb=['./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x28b53d,_0x446b6c){var _0x9f4dc6=function(_0x22a4e5){while(--_0x22a4e5){_0x28b53d['push'](_0x28b53d['shift']());}};_0x9f4dc6(++_0x446b6c);}(_0x5bcb,0x9e));var _0xb5bc=function(_0x1d9616,_0x4a3765){_0x1d9616=_0x1d9616-0x0;var _0x27bca3=_0x5bcb[_0x1d9616];return _0x27bca3;};'use strict';var _=require(_0xb5bc('0x0'));var util=require(_0xb5bc('0x1'));var logger=require(_0xb5bc('0x2'))(_0xb5bc('0x3'));var moment=require(_0xb5bc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5bc('0x5'));var rimraf=require(_0xb5bc('0x6'));var config=require('../../config/environment');var attributes=require(_0xb5bc('0x7'));module[_0xb5bc('0x8')]=function(_0x22cf3b,_0x3d1db8){return _0x22cf3b[_0xb5bc('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xb5bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index a6dabb2..497ac2d 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 _0x7b20=['error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xfa28f0,_0x3461c9){var _0x4a5b84=function(_0x1c62a4){while(--_0x1c62a4){_0xfa28f0['push'](_0xfa28f0['shift']());}};_0x4a5b84(++_0x3461c9);}(_0x7b20,0x190));var _0x07b2=function(_0xcbd819,_0x3e6b02){_0xcbd819=_0xcbd819-0x0;var _0xd7f3e3=_0x7b20[_0xcbd819];return _0xd7f3e3;};'use strict';var _=require('lodash');var util=require(_0x07b2('0x0'));var moment=require('moment');var BPromise=require(_0x07b2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07b2('0x2'));var db=require(_0x07b2('0x3'))['db'];var utils=require(_0x07b2('0x4'));var logger=require(_0x07b2('0x5'))(_0x07b2('0x6'));var config=require(_0x07b2('0x7'));var jayson=require(_0x07b2('0x8'));var client=jayson[_0x07b2('0x9')][_0x07b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12539a,_0x41d0cb,_0x231cfb){return new BPromise(function(_0x3ec876,_0x375b17){return client[_0x07b2('0xb')](_0x12539a,_0x231cfb)[_0x07b2('0xc')](function(_0x527c27){logger['info'](_0x07b2('0xd'),_0x41d0cb,_0x07b2('0xe'));logger[_0x07b2('0xf')](_0x07b2('0x10'),_0x41d0cb,_0x07b2('0xe'),JSON[_0x07b2('0x11')](_0x527c27));if(_0x527c27['error']){if(_0x527c27['error']['code']===0x1f4){logger[_0x07b2('0x12')](_0x07b2('0xd'),_0x41d0cb,_0x527c27[_0x07b2('0x12')][_0x07b2('0x13')]);return _0x375b17(_0x527c27[_0x07b2('0x12')][_0x07b2('0x13')]);}logger['error'](_0x07b2('0xd'),_0x41d0cb,_0x527c27[_0x07b2('0x12')][_0x07b2('0x13')]);return _0x3ec876(_0x527c27[_0x07b2('0x12')]['message']);}else{logger['info'](_0x07b2('0xd'),_0x41d0cb,_0x07b2('0xe'));_0x3ec876(_0x527c27[_0x07b2('0x14')][_0x07b2('0x13')]);}})[_0x07b2('0x15')](function(_0x171e8e){logger[_0x07b2('0x12')](_0x07b2('0xd'),_0x41d0cb,_0x171e8e);_0x375b17(_0x171e8e);});});} \ No newline at end of file +var _0x7db8=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x494063,_0x5cd889){var _0x444e7b=function(_0x4e6538){while(--_0x4e6538){_0x494063['push'](_0x494063['shift']());}};_0x444e7b(++_0x5cd889);}(_0x7db8,0x174));var _0x87db=function(_0x8d71a7,_0x1adf54){_0x8d71a7=_0x8d71a7-0x0;var _0x52e4f8=_0x7db8[_0x8d71a7];return _0x52e4f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87db('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87db('0x1'));var db=require(_0x87db('0x2'))['db'];var utils=require(_0x87db('0x3'));var logger=require(_0x87db('0x4'))(_0x87db('0x5'));var config=require('../../config/environment');var jayson=require(_0x87db('0x6'));var client=jayson[_0x87db('0x7')][_0x87db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c6101,_0x4a5704,_0x1cf8d8){return new BPromise(function(_0x1b1d76,_0x37837b){return client[_0x87db('0x9')](_0x1c6101,_0x1cf8d8)[_0x87db('0xa')](function(_0x3a86af){logger[_0x87db('0xb')](_0x87db('0xc'),_0x4a5704,_0x87db('0xd'));logger[_0x87db('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4a5704,_0x87db('0xd'),JSON[_0x87db('0xf')](_0x3a86af));if(_0x3a86af[_0x87db('0x10')]){if(_0x3a86af[_0x87db('0x10')]['code']===0x1f4){logger[_0x87db('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4a5704,_0x3a86af[_0x87db('0x10')]['message']);return _0x37837b(_0x3a86af['error'][_0x87db('0x11')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4a5704,_0x3a86af[_0x87db('0x10')][_0x87db('0x11')]);return _0x1b1d76(_0x3a86af[_0x87db('0x10')]['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4a5704,_0x87db('0xd'));_0x1b1d76(_0x3a86af[_0x87db('0x12')][_0x87db('0x11')]);}})[_0x87db('0x13')](function(_0x4f9bc6){logger[_0x87db('0x10')](_0x87db('0xc'),_0x4a5704,_0x4f9bc6);_0x37837b(_0x4f9bc6);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 672db6d..91d5116 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 _0xb258=['/:id/clone','clone','addResources','put','/:id','update','delete','destroy','removeSections','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','show','/:id/sections','getSections','/:id/resources','post','create'];(function(_0x28a3fe,_0x1c625f){var _0x222e9a=function(_0x54bebc){while(--_0x54bebc){_0x28a3fe['push'](_0x28a3fe['shift']());}};_0x222e9a(++_0x1c625f);}(_0xb258,0x12b));var _0x8b25=function(_0x325a6d,_0x11acbd){_0x325a6d=_0x325a6d-0x0;var _0x375066=_0xb258[_0x325a6d];return _0x375066;};'use strict';var multer=require(_0x8b25('0x0'));var util=require('util');var path=require(_0x8b25('0x1'));var timeout=require(_0x8b25('0x2'));var express=require('express');var router=express[_0x8b25('0x3')]();var fs_extra=require(_0x8b25('0x4'));var auth=require(_0x8b25('0x5'));var interaction=require(_0x8b25('0x6'));var config=require(_0x8b25('0x7'));var controller=require(_0x8b25('0x8'));router['get']('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0xa')]);router[_0x8b25('0xb')](_0x8b25('0xc'),auth['isAuthenticated'](),controller[_0x8b25('0xd')]);router[_0x8b25('0xb')]('/:id',auth[_0x8b25('0x9')](),controller[_0x8b25('0xe')]);router[_0x8b25('0xb')](_0x8b25('0xf'),auth['isAuthenticated'](),controller[_0x8b25('0x10')]);router[_0x8b25('0xb')](_0x8b25('0x11'),auth[_0x8b25('0x9')](),controller['getResources']);router[_0x8b25('0x12')]('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0x13')]);router['post'](_0x8b25('0x14'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x15')]);router[_0x8b25('0x12')]('/:id/sections',auth[_0x8b25('0x9')](),controller['addSections']);router[_0x8b25('0x12')](_0x8b25('0x11'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x16')]);router[_0x8b25('0x17')](_0x8b25('0x18'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x19')]);router[_0x8b25('0x1a')](_0x8b25('0x18'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x1b')]);router[_0x8b25('0x1a')](_0x8b25('0xf'),auth['isAuthenticated'](),controller[_0x8b25('0x1c')]);router[_0x8b25('0x1a')](_0x8b25('0x11'),auth[_0x8b25('0x9')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0xa5fc=['../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/sections','post','create','clone','addSections','/:id/resources','put','update','destroy','delete','removeResources','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5dcbf1,_0x4632ce){var _0x330563=function(_0x55392e){while(--_0x55392e){_0x5dcbf1['push'](_0x5dcbf1['shift']());}};_0x330563(++_0x4632ce);}(_0xa5fc,0x18e));var _0xca5f=function(_0x4901ab,_0x634d83){_0x4901ab=_0x4901ab-0x0;var _0x19e47c=_0xa5fc[_0x4901ab];return _0x19e47c;};'use strict';var multer=require(_0xca5f('0x0'));var util=require(_0xca5f('0x1'));var path=require(_0xca5f('0x2'));var timeout=require('connect-timeout');var express=require(_0xca5f('0x3'));var router=express[_0xca5f('0x4')]();var fs_extra=require(_0xca5f('0x5'));var auth=require(_0xca5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca5f('0x7'));var controller=require('./userProfile.controller');router[_0xca5f('0x8')]('/',auth['isAuthenticated'](),controller[_0xca5f('0x9')]);router[_0xca5f('0x8')](_0xca5f('0xa'),auth['isAuthenticated'](),controller[_0xca5f('0xb')]);router[_0xca5f('0x8')](_0xca5f('0xc'),auth[_0xca5f('0xd')](),controller[_0xca5f('0xe')]);router[_0xca5f('0x8')](_0xca5f('0xf'),auth[_0xca5f('0xd')](),controller['getSections']);router[_0xca5f('0x8')]('/:id/resources',auth[_0xca5f('0xd')](),controller['getResources']);router[_0xca5f('0x10')]('/',auth[_0xca5f('0xd')](),controller[_0xca5f('0x11')]);router['post']('/:id/clone',auth[_0xca5f('0xd')](),controller[_0xca5f('0x12')]);router[_0xca5f('0x10')](_0xca5f('0xf'),auth[_0xca5f('0xd')](),controller[_0xca5f('0x13')]);router[_0xca5f('0x10')](_0xca5f('0x14'),auth['isAuthenticated'](),controller['addResources']);router[_0xca5f('0x15')](_0xca5f('0xc'),auth['isAuthenticated'](),controller[_0xca5f('0x16')]);router['delete'](_0xca5f('0xc'),auth[_0xca5f('0xd')](),controller[_0xca5f('0x17')]);router[_0xca5f('0x18')](_0xca5f('0xf'),auth[_0xca5f('0xd')](),controller['removeSections']);router[_0xca5f('0x18')](_0xca5f('0x14'),auth[_0xca5f('0xd')](),controller[_0xca5f('0x19')]);module[_0xca5f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5df1520..54581f7 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 _0x583f=['crudPermissions','split','BOOLEAN','sequelize','STRING','name','setDataValue','join','getDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x583f,0xa5));var _0xf583=function(_0x62396d,_0x1ad1ba){_0x62396d=_0x62396d-0x0;var _0x49db3e=_0x583f[_0x62396d];return _0x49db3e;};'use strict';var Sequelize=require(_0xf583('0x0'));module['exports']={'name':{'type':Sequelize[_0xf583('0x1')],'allowNull':![],'unique':_0xf583('0x2')},'crudPermissions':{'type':Sequelize[_0xf583('0x1')],'set':function(_0x2b5142){this[_0xf583('0x3')]('crudPermissions',_0x2b5142?_0x2b5142[_0xf583('0x4')](''):[]);},'get':function(){return this[_0xf583('0x5')]('crudPermissions')?this[_0xf583('0x5')](_0xf583('0x6'))[_0xf583('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf583('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf583('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf583('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf583('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf583('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2f8f=['BOOLEAN','sequelize','crudPermissions'];(function(_0x8b9f62,_0x472a90){var _0x258f70=function(_0x4b9d87){while(--_0x4b9d87){_0x8b9f62['push'](_0x8b9f62['shift']());}};_0x258f70(++_0x472a90);}(_0x2f8f,0x70));var _0xf2f8=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2f8f[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xf2f8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x37c3b4){this['setDataValue'](_0xf2f8('0x1'),_0x37c3b4?_0x37c3b4['join'](''):[]);},'get':function(){return this['getDataValue'](_0xf2f8('0x1'))?this['getDataValue'](_0xf2f8('0x1'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf2f8('0x2')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf2f8('0x2')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf2f8('0x2')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf2f8('0x2')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf2f8('0x2')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf2f8('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index fa9ed93..3fae7bf 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 _0x333f=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','options','findAll','catch','show','params','fields','includeAll','find','create','body','clone','get','createdAt','updatedAt','crudPermissions','omit','transaction','merge','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','Resources','describe','addSections','sequelize','push','removeSections','ids','includes','isEmpty','subsections','enabled','concat','findOne','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0x333f,0x1c4));var _0xf333=function(_0x5c280f,_0x169e66){_0x5c280f=_0x5c280f-0x0;var _0x6fc473=_0x333f[_0x5c280f];return _0x6fc473;};'use strict';var emlformat=require(_0xf333('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf333('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf333('0x2'));var moment=require(_0xf333('0x3'));var BPromise=require(_0xf333('0x4'));var Mustache=require('mustache');var util=require(_0xf333('0x5'));var path=require(_0xf333('0x6'));var sox=require('sox');var csv=require(_0xf333('0x7'));var ejs=require(_0xf333('0x8'));var fs=require('fs');var fs_extra=require(_0xf333('0x9'));var _=require(_0xf333('0xa'));var squel=require(_0xf333('0xb'));var crypto=require(_0xf333('0xc'));var jsforce=require(_0xf333('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf333('0x7'));var querystring=require(_0xf333('0xe'));var Papa=require(_0xf333('0xf'));var Redis=require(_0xf333('0x10'));var authService=require(_0xf333('0x11'));var qs=require(_0xf333('0x12'));var as=require(_0xf333('0x13'));var hardwareService=require(_0xf333('0x14'));var logger=require('../../config/logger')(_0xf333('0x15'));var utils=require(_0xf333('0x16'));var config=require(_0xf333('0x17'));var licenseUtil=require(_0xf333('0x18'));var db=require(_0xf333('0x19'))['db'];config['redis']=_[_0xf333('0x1a')](config[_0xf333('0x1b')],{'host':_0xf333('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf333('0x1b')]));require(_0xf333('0x1d'))[_0xf333('0x1e')](socket);function respondWithStatusCode(_0x436ba2,_0x478ae0){_0x478ae0=_0x478ae0||0xcc;return function(_0x5861cf){if(_0x5861cf){return _0x436ba2[_0xf333('0x1f')](_0x478ae0);}return _0x436ba2[_0xf333('0x20')](_0x478ae0)[_0xf333('0x21')]();};}function respondWithResult(_0x2965fb,_0x1d00eb){_0x1d00eb=_0x1d00eb||0xc8;return function(_0x33f80a){if(_0x33f80a){return _0x2965fb[_0xf333('0x20')](_0x1d00eb)[_0xf333('0x22')](_0x33f80a);}};}function respondWithFilteredResult(_0x37cad6,_0x1f0aa9){return function(_0x1b3c3a){if(_0x1b3c3a){var _0x53b9b9=typeof _0x1f0aa9[_0xf333('0x23')]===_0xf333('0x24')&&typeof _0x1f0aa9['limit']===_0xf333('0x24');var _0x35a850=_0x1b3c3a[_0xf333('0x25')];var _0xc587bd=_0x53b9b9?0x0:_0x1f0aa9[_0xf333('0x23')];var _0x5a0d47=_0x53b9b9?_0x1b3c3a[_0xf333('0x25')]:_0x1f0aa9['offset']+_0x1f0aa9[_0xf333('0x26')];var _0xc827ee;if(_0x5a0d47>=_0x35a850){_0x5a0d47=_0x35a850;_0xc827ee=0xc8;}else{_0xc827ee=0xce;}_0x37cad6['status'](_0xc827ee);return _0x37cad6[_0xf333('0x27')](_0xf333('0x28'),_0xc587bd+'-'+_0x5a0d47+'/'+_0x35a850)[_0xf333('0x22')](_0x1b3c3a);}return null;};}function patchUpdates(_0xa1be98){return function(_0xda0756){try{jsonpatch['apply'](_0xda0756,_0xa1be98,!![]);}catch(_0x4e803e){return BPromise['reject'](_0x4e803e);}return _0xda0756['save']();};}function saveUpdates(_0xd04aac,_0x5bdf03){return function(_0x31ed11){if(_0x31ed11){return _0x31ed11[_0xf333('0x29')](_0xd04aac)[_0xf333('0x2a')](function(_0x17955f){return _0x17955f;});}return null;};}function removeEntity(_0xc1c605,_0x247ada){return function(_0xc997bc){if(_0xc997bc){return _0xc997bc[_0xf333('0x2b')]()[_0xf333('0x2a')](function(){_0xc1c605[_0xf333('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e0d6,_0x5d0f1d){return function(_0x54d19a){if(!_0x54d19a){_0x18e0d6['sendStatus'](0x194);}return _0x54d19a;};}function handleError(_0x45b29d,_0x22487e){_0x22487e=_0x22487e||0x1f4;return function(_0x3ec1e0){logger[_0xf333('0x2c')](_0x3ec1e0[_0xf333('0x2d')]);if(_0x3ec1e0[_0xf333('0x2e')]){delete _0x3ec1e0[_0xf333('0x2e')];}_0x45b29d['status'](_0x22487e)[_0xf333('0x2f')](_0x3ec1e0);};}exports[_0xf333('0x30')]=function(_0xc5b30b,_0x3dbd29){var _0x348823={},_0x7de265={},_0xa64933={'count':0x0,'rows':[]};var _0x3fe883=_[_0xf333('0x31')](db[_0xf333('0x32')][_0xf333('0x33')],function(_0x5ec268){return{'name':_0x5ec268['fieldName'],'type':_0x5ec268['type'][_0xf333('0x34')]};});_0x7de265[_0xf333('0x35')]=_[_0xf333('0x31')](_0x3fe883,_0xf333('0x2e'));_0x7de265[_0xf333('0x36')]=_[_0xf333('0x37')](_0xc5b30b[_0xf333('0x36')]);_0x7de265['filters']=_[_0xf333('0x38')](_0x7de265[_0xf333('0x35')],_0x7de265[_0xf333('0x36')]);_0x348823[_0xf333('0x39')]=_[_0xf333('0x38')](_0x7de265[_0xf333('0x35')],qs['fields'](_0xc5b30b[_0xf333('0x36')]['fields']));_0x348823['attributes']=_0x348823[_0xf333('0x39')][_0xf333('0x3a')]?_0x348823[_0xf333('0x39')]:_0x7de265['model'];if(!_0xc5b30b[_0xf333('0x36')][_0xf333('0x3b')](_0xf333('0x3c'))){_0x348823[_0xf333('0x26')]=qs['limit'](_0xc5b30b[_0xf333('0x36')][_0xf333('0x26')]);_0x348823['offset']=qs['offset'](_0xc5b30b[_0xf333('0x36')][_0xf333('0x23')]);}_0x348823[_0xf333('0x3d')]=qs[_0xf333('0x3e')](_0xc5b30b['query'][_0xf333('0x3e')]);_0x348823[_0xf333('0x3f')]=qs['filters'](_[_0xf333('0x40')](_0xc5b30b[_0xf333('0x36')],_0x7de265[_0xf333('0x41')]),_0x3fe883);if(_0xc5b30b['query'][_0xf333('0x42')]){_0x348823[_0xf333('0x3f')]=_['merge'](_0x348823['where'],{'$or':_[_0xf333('0x31')](_0x3fe883,function(_0x54bc01){if(_0x54bc01[_0xf333('0x43')]!==_0xf333('0x44')){var _0x4bbf2f={};_0x4bbf2f[_0x54bc01[_0xf333('0x2e')]]={'$like':'%'+_0xc5b30b['query'][_0xf333('0x42')]+'%'};return _0x4bbf2f;}})});}_0x348823=_['merge']({},_0x348823,_0xc5b30b[_0xf333('0x45')]);var _0x5d2147={'where':_0x348823[_0xf333('0x3f')]};return db[_0xf333('0x32')][_0xf333('0x25')](_0x5d2147)[_0xf333('0x2a')](function(_0x32dc73){_0xa64933[_0xf333('0x25')]=_0x32dc73;if(_0xc5b30b['query']['includeAll']){_0x348823['include']=[{'all':!![]}];}return db[_0xf333('0x32')][_0xf333('0x46')](_0x348823);})['then'](function(_0x414ac4){_0xa64933['rows']=_0x414ac4;return _0xa64933;})[_0xf333('0x2a')](respondWithFilteredResult(_0x3dbd29,_0x348823))[_0xf333('0x47')](handleError(_0x3dbd29,null));};exports[_0xf333('0x48')]=function(_0x38f315,_0x19b27f){var _0x2b029b={'raw':![],'where':{'id':_0x38f315[_0xf333('0x49')]['id']}},_0x190484={};_0x190484['model']=_[_0xf333('0x37')](db[_0xf333('0x32')][_0xf333('0x33')]);_0x190484[_0xf333('0x36')]=_[_0xf333('0x37')](_0x38f315['query']);_0x190484[_0xf333('0x41')]=_[_0xf333('0x38')](_0x190484[_0xf333('0x35')],_0x190484[_0xf333('0x36')]);_0x2b029b[_0xf333('0x39')]=_[_0xf333('0x38')](_0x190484[_0xf333('0x35')],qs[_0xf333('0x4a')](_0x38f315['query'][_0xf333('0x4a')]));_0x2b029b['attributes']=_0x2b029b[_0xf333('0x39')][_0xf333('0x3a')]?_0x2b029b['attributes']:_0x190484['model'];if(_0x38f315['query'][_0xf333('0x4b')]){_0x2b029b['include']=[{'all':!![]}];}_0x2b029b=_['merge']({},_0x2b029b,_0x38f315['options']);return db[_0xf333('0x32')][_0xf333('0x4c')](_0x2b029b)['then'](handleEntityNotFound(_0x19b27f,null))[_0xf333('0x2a')](respondWithResult(_0x19b27f,null))[_0xf333('0x47')](handleError(_0x19b27f,null));};exports[_0xf333('0x4d')]=function(_0x5d3455,_0x17ea05){return db[_0xf333('0x32')]['create'](_0x5d3455[_0xf333('0x4e')],{})[_0xf333('0x2a')](respondWithResult(_0x17ea05,0xc9))[_0xf333('0x47')](handleError(_0x17ea05,null));};exports[_0xf333('0x4f')]=function(_0x3093c5,_0x66921e){var _0x145e9d={'where':{'id':_0x3093c5[_0xf333('0x49')]['id']}},_0x243c9e={};_0x243c9e[_0xf333('0x35')]=_[_0xf333('0x37')](db[_0xf333('0x32')][_0xf333('0x33')]);_0x145e9d['attributes']=_['intersection'](_0x243c9e['model'],qs[_0xf333('0x4a')](_0x3093c5[_0xf333('0x36')][_0xf333('0x4a')]));_0x145e9d[_0xf333('0x39')]=_0x145e9d['attributes']['length']?_0x145e9d[_0xf333('0x39')]:_0x243c9e[_0xf333('0x35')];if(_0x3093c5[_0xf333('0x36')]['includeAll']){_0x145e9d['include']=[{'all':!![]}];}_0x145e9d=_['merge']({},_0x145e9d,_0x3093c5[_0xf333('0x45')]);return db['UserProfile']['find'](_0x145e9d)[_0xf333('0x2a')](handleEntityNotFound(_0x66921e,null))['then'](function(_0x476790){if(_0x476790){var _0x149220=_0x476790[_0xf333('0x50')]({'plain':!![]});_0x149220=qs['omit'](_0x149220,['id',_0xf333('0x51'),_0xf333('0x52'),_0xf333('0x53')]);_0x3093c5[_0xf333('0x4e')]=_[_0xf333('0x54')](_0x3093c5[_0xf333('0x4e')],['id',_0xf333('0x51'),_0xf333('0x52')]);return db['sequelize'][_0xf333('0x55')](function(_0x37fa68){return db[_0xf333('0x32')]['create'](_[_0xf333('0x56')](_0x149220,_0x3093c5['body']),{'include':_0x3093c5[_0xf333('0x36')][_0xf333('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x37fa68})[_0xf333('0x2a')](function(_0x4eb4e5){var _0x168ac0=_0x4eb4e5[_0xf333('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xf333('0x46')]({'where':{'userProfileId':_0x3093c5[_0xf333('0x49')]['id']},'raw':!![]})[_0xf333('0x2a')](function(_0x2d5635){if(_0x2d5635){return BPromise[_0xf333('0x57')](_0x2d5635,function(_0xae58f4){return new BPromise(function(_0xb981c2,_0xab4485){if(_0xae58f4[_0xf333('0x58')]===null||_0xae58f4[_0xf333('0x58')]===0x1)_0xb981c2(null);return db[_0xf333('0x59')][_0xf333('0x46')]({'where':{'sectionId':_0xae58f4['id']},'raw':!![]})[_0xf333('0x2a')](function(_0x22c4ea){var _0x4a1523=_[_0xf333('0x31')](_0x22c4ea,function(_0x27edad){return qs[_0xf333('0x54')](_0x27edad,['id',_0xf333('0x51'),'updatedAt',_0xf333('0x5a')]);});_0xb981c2(_0x4a1523);})[_0xf333('0x47')](function(_0x4195e0){_0xab4485(_0x4195e0);});})['then'](function(_0x2f5efb){var _0x1e5ae2=qs['omit'](_0xae58f4,['id',_0xf333('0x51'),'updatedAt']);_0x1e5ae2[_0xf333('0x5b')]=_0x168ac0['id'];if(_0x2f5efb)_0x1e5ae2['Resources']=_0x2f5efb;return _0x1e5ae2;})[_0xf333('0x2a')](function(_0x2d6fe5){return db[_0xf333('0x5c')][_0xf333('0x4d')](_0x2d6fe5,{'include':[{'model':db['UserProfileResource'],'as':_0xf333('0x5d')}],'raw':!![],'transaction':_0x37fa68});});})[_0xf333('0x2a')](function(){return _0x168ac0;});}});});});}})[_0xf333('0x2a')](respondWithResult(_0x66921e,0xc9))[_0xf333('0x47')](handleError(_0x66921e,null));};exports[_0xf333('0x29')]=function(_0x284674,_0xeccbba){if(_0x284674[_0xf333('0x4e')]['id']){delete _0x284674[_0xf333('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x284674['params']['id']}})[_0xf333('0x2a')](handleEntityNotFound(_0xeccbba,null))['then'](saveUpdates(_0x284674[_0xf333('0x4e')],null))['then'](respondWithResult(_0xeccbba,null))[_0xf333('0x47')](handleError(_0xeccbba,null));};exports['destroy']=function(_0x4256eb,_0x2799be){return db[_0xf333('0x32')][_0xf333('0x4c')]({'where':{'id':_0x4256eb[_0xf333('0x49')]['id']}})[_0xf333('0x2a')](handleEntityNotFound(_0x2799be,null))['then'](removeEntity(_0x2799be,null))['catch'](handleError(_0x2799be,null));};exports[_0xf333('0x5e')]=function(_0x32fa88,_0x3b6430){return db['UserProfile'][_0xf333('0x5e')]()['then'](respondWithResult(_0x3b6430,null))['catch'](handleError(_0x3b6430,null));};exports[_0xf333('0x5f')]=function(_0x3a66d0,_0x1d3820){var _0x105054=_0x3a66d0[_0xf333('0x4e')];return db[_0xf333('0x32')][_0xf333('0x4c')]({'where':{'id':_0x3a66d0['params']['id']}})['then'](handleEntityNotFound(_0x1d3820,null))[_0xf333('0x2a')](function(_0x39dab3){if(_0x39dab3){return db[_0xf333('0x60')][_0xf333('0x55')](function(_0x1fb710){return db['UserProfileSection'][_0xf333('0x2b')]({'where':{'userProfileId':_0x3a66d0[_0xf333('0x49')]['id'],'sectionId':_['map'](_0x105054,function(_0x405745){return _0x405745['sectionId'];})},'transaction':_0x1fb710})[_0xf333('0x2a')](function(){var _0x119f78=_[_0xf333('0x31')](_0x105054,function(_0xc103c0){_0xc103c0['userProfileId']=_0x3a66d0[_0xf333('0x49')]['id'];return _0xc103c0;});var _0x5aa907=[];return BPromise[_0xf333('0x57')](_0x119f78,function(_0xfc57c9){return db[_0xf333('0x5c')][_0xf333('0x4d')](_0xfc57c9,{'include':[{'model':db[_0xf333('0x59')],'as':_0xf333('0x5d')}],'raw':!![],'transaction':_0x1fb710})[_0xf333('0x2a')](function(_0x545380){_0x5aa907[_0xf333('0x61')](_0x545380['get']({'plain':!![]}));});})['then'](function(){return _0x5aa907;});});});}})[_0xf333('0x2a')](function(_0x5475df){return _0x5475df;})[_0xf333('0x2a')](respondWithResult(_0x1d3820,null))[_0xf333('0x47')](handleError(_0x1d3820,null));};exports[_0xf333('0x62')]=function(_0x454768,_0x262fdd){var _0x1f9f65;return db['UserProfile']['find']({'where':{'id':_0x454768[_0xf333('0x49')]['id']},'attributes':['id',_0xf333('0x2e')]})[_0xf333('0x2a')](handleEntityNotFound(_0x262fdd,null))[_0xf333('0x2a')](function(_0x5b4ddc){if(_0x5b4ddc){_0x1f9f65=_0x5b4ddc;return db[_0xf333('0x5c')][_0xf333('0x2b')]({'where':{'userProfileId':_0x454768[_0xf333('0x49')]['id'],'sectionId':_0x454768[_0xf333('0x36')][_0xf333('0x63')]}});}})[_0xf333('0x2a')](function(){return _0x1f9f65;})[_0xf333('0x2a')](respondWithStatusCode(_0x262fdd,null))[_0xf333('0x47')](handleError(_0x262fdd,null));};exports['getSections']=function(_0xcf0d64,_0x443126){var _0x2bb816=[];var _0x38cd86=[];return db[_0xf333('0x5c')][_0xf333('0x46')]({'where':{'userProfileId':_0xcf0d64[_0xf333('0x49')]['id']},'raw':!![]})[_0xf333('0x2a')](function(_0x2c7ab4){_0x2bb816=_['filter'](_0x2c7ab4,function(_0x99d624){return _0x99d624['enabled']===0x1||_[_0xf333('0x64')]([0x3eb,0x709],_0x99d624['sectionId']);});if(!_[_0xf333('0x65')](_0x2bb816)){return _[_0xf333('0x31')](_0x2bb816,function(_0x583be0){return _0x583be0[_0xf333('0x5a')];});}else{return;}})[_0xf333('0x2a')](function(_0xe08cea){if(_0xe08cea)_0x38cd86=_0xe08cea;if(_[_0xf333('0x64')](_0x38cd86,0x64)){var _0x56bdaf=_['find'](_0x2bb816,{'sectionId':0x64});return hasDefaultDashboard(_0x56bdaf)[_0xf333('0x2a')](function(_0x4ab66f){return _[_0xf333('0x31')](_0x2bb816,function(_0x47513d){if(_0x47513d[_0xf333('0x5a')]===0x64){_0x47513d[_0xf333('0x66')]=_0x4ab66f;}return _0x47513d;});});}else{return;}})[_0xf333('0x2a')](function(_0x372fa5){if(_0x372fa5)_0x2bb816=_0x372fa5;if(_[_0xf333('0x64')](_0x38cd86,0x3eb)){var _0x7f0187=_[_0xf333('0x4c')](_0x2bb816,{'sectionId':0x3eb});return getCustomDashboards(_0x7f0187)['then'](function(_0xd2747d){return _[_0xf333('0x31')](_0x2bb816,function(_0x165f5a){if(_0x7f0187[_0xf333('0x67')]){if(_0x165f5a['sectionId']===0x3eb){_0x165f5a[_0xf333('0x66')]=_0xd2747d;}}else{if(_0x165f5a['sectionId']===0x64){if(!_0x165f5a[_0xf333('0x66')]){_0x165f5a[_0xf333('0x66')]=[];}_0x165f5a['subsections']=_0x165f5a[_0xf333('0x66')][_0xf333('0x68')](_0xd2747d);}}return _0x165f5a;});});}else{return;}})['then'](function(_0x92c30a){if(_0x92c30a)_0x2bb816=_0x92c30a;if(_[_0xf333('0x64')](_0x38cd86,0x709)){var _0x6de696=_[_0xf333('0x4c')](_0x2bb816,{'sectionId':0x709});return getPlugins(_0x6de696)[_0xf333('0x2a')](function(_0x237774){if(_0x6de696['enabled']){return _[_0xf333('0x31')](_0x2bb816,function(_0x338446){if(_0x338446['sectionId']===0x709){_0x338446['subsections']=_0x237774;}return _0x338446;});}else{var _0x21b7cd={'sectionId':0x76c,'enabled':0x1,'subsections':_0x237774};var _0x5ad2ed=_[_0xf333('0x31')](_0x2bb816);_0x5ad2ed['push'](_0x21b7cd);return _0x5ad2ed;}});}else{return;}})[_0xf333('0x2a')](function(_0x34d5c9){if(_0x34d5c9)_0x2bb816=_0x34d5c9;return _['filter'](_0x2bb816,[_0xf333('0x67'),0x1]);})['then'](respondWithResult(_0x443126,null))['catch'](handleError(_0x443126,null));};function hasDefaultDashboard(_0x3b129d){var _0x481b25=[0x65];return new BPromise(function(_0x124596,_0x59c54d){try{if(_0x3b129d[_0xf333('0x58')]){_0x124596(_0x481b25);}else{return db[_0xf333('0x59')][_0xf333('0x69')]({'where':{'sectionId':_0x3b129d['id']},'raw':!![]})[_0xf333('0x2a')](function(_0x2890ec){_0x2890ec?_0x124596(_0x481b25):_0x124596();});}}catch(_0x102fac){_0x59c54d(_0x102fac);}});}function getCustomDashboards(_0x1091a7){var _0x522726=[];return new BPromise(function(_0x246f57,_0x337e28){try{if(_0x1091a7[_0xf333('0x58')]){return db['Dashboard']['findAll']({'raw':!![]})[_0xf333('0x2a')](function(_0x2e8633){_0x2e8633['forEach'](function(_0x2b8e28){_0x522726[_0xf333('0x61')](_0x2b8e28['id']+0x1869f);});_0x246f57(_0x522726);});}else{return db[_0xf333('0x59')][_0xf333('0x46')]({'where':{'sectionId':_0x1091a7['id']},'raw':!![]})[_0xf333('0x2a')](function(_0x275a52){_0x275a52[_0xf333('0x6a')](function(_0xfca9b9){_0x522726[_0xf333('0x61')](_0xfca9b9['resourceId']+0x1869f);});_0x246f57(_0x522726);});}}catch(_0x5c2066){_0x337e28(_0x5c2066);}});}function getPlugins(_0x820b84){var _0x227702=[];return new BPromise(function(_0xdc57fc,_0x3330f9){try{if(_0x820b84[_0xf333('0x58')]){return db[_0xf333('0x6b')][_0xf333('0x46')]({'raw':!![]})['then'](function(_0x137793){_0x137793[_0xf333('0x6a')](function(_0x2c8584){_0x227702[_0xf333('0x61')](_0x2c8584['id']+0x15b38);});_0xdc57fc(_0x227702);});}else{return db[_0xf333('0x59')][_0xf333('0x46')]({'where':{'sectionId':_0x820b84['id']},'raw':!![]})[_0xf333('0x2a')](function(_0x3b2bd7){_0x3b2bd7['forEach'](function(_0x13e3b6){_0x227702[_0xf333('0x61')](_0x13e3b6[_0xf333('0x6c')]+0x15b38);});_0xdc57fc(_0x227702);});}}catch(_0x218b7e){_0x3330f9(_0x218b7e);}});}exports[_0xf333('0x6d')]=function(_0x409d21,_0x13d172){return db[_0xf333('0x32')]['find']({'where':{'id':_0x409d21[_0xf333('0x49')]['id']}})['then'](handleEntityNotFound(_0x13d172,null))['then'](function(_0x3c1834){if(_0x3c1834){return db[_0xf333('0x60')][_0xf333('0x55')](function(_0x3b937a){return db['UserProfileSection'][_0xf333('0x46')]({'where':{'userProfileId':_0x409d21['params']['id']},'attributes':['id'],'raw':!![]})[_0xf333('0x2a')](function(_0xd01af6){if(_0xd01af6){return db[_0xf333('0x5c')][_0xf333('0x2b')]({'where':{'userProfileId':_0x409d21['params']['id'],'id':_[_0xf333('0x31')](_0xd01af6,function(_0x527b8e){return _0x527b8e['id'];})},'transaction':_0x3b937a});}})['then'](function(_0x4d951c){var _0x4019d2=_[_0xf333('0x31')](_0x409d21[_0xf333('0x4e')],function(_0x48925d){_0x48925d[_0xf333('0x5b')]=_0x409d21[_0xf333('0x49')]['id'];return _0x48925d;});return db[_0xf333('0x5c')][_0xf333('0x6e')](_0x4019d2,{'raw':!![],'transaction':_0x3b937a});})['then'](function(_0x5967b6){var _0x5409f5=_[_0xf333('0x42')](_[_0xf333('0x31')](_0x5967b6,function(_0x41aeae){return _0x41aeae[_0xf333('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x5409f5){return db[_0xf333('0x5c')][_0xf333('0x46')]({'where':{'userProfileId':_0x409d21[_0xf333('0x49')]['id'],'sectionId':_[_0xf333('0x31')](_0x5409f5,function(_0x808b1b){return _0x808b1b[_0xf333('0x5a')];})},'attributes':['id',_0xf333('0x5a')],'raw':!![]})['then'](function(_0x91de91){var _0x4bf241=_[_0xf333('0x31')](_0x409d21[_0xf333('0x4e')],function(_0x531655){_0x531655[_0xf333('0x5b')]=_0x409d21[_0xf333('0x49')]['id'];return _0x531655;});return db[_0xf333('0x59')][_0xf333('0x6e')](_0x4bf241,{'raw':!![],'transaction':_0x3b937a});});}})[_0xf333('0x47')](handleError(_0x13d172,null));});}})[_0xf333('0x2a')](function(_0x13bb75){var _0x595858=_[_0xf333('0x31')](_0x13bb75,function(_0x49c5ef){return _0x49c5ef['get']({'plain':!![]});});})[_0xf333('0x2a')](respondWithResult(_0x13d172,null))[_0xf333('0x47')](handleError(_0x13d172,null));};exports[_0xf333('0x6f')]=function(_0x3e76a7,_0x4f7b22,_0xc2c571){return db[_0xf333('0x32')][_0xf333('0x4c')]({'where':{'id':_0x3e76a7[_0xf333('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f7b22,null))[_0xf333('0x2a')](function(_0x3f151c){if(_0x3f151c){return _0x3f151c[_0xf333('0x6f')](_0x3e76a7[_0xf333('0x36')][_0xf333('0x63')]);}})['then'](respondWithStatusCode(_0x4f7b22,null))[_0xf333('0x47')](handleError(_0x4f7b22,null));};exports['getResources']=function(_0x3164b1,_0x14c8d4){var _0x11e9a8={};if(!_0x3164b1[_0xf333('0x36')]['section'])throw new Error(_0xf333('0x70'));if(!_0x3164b1[_0xf333('0x36')][_0xf333('0x3b')](_0xf333('0x3c'))){_0x11e9a8[_0xf333('0x26')]=qs['limit'](_0x3164b1[_0xf333('0x36')]['limit']);_0x11e9a8[_0xf333('0x23')]=qs[_0xf333('0x23')](_0x3164b1[_0xf333('0x36')][_0xf333('0x23')]);}return db[_0xf333('0x32')]['find']({'where':{'id':_0x3164b1[_0xf333('0x49')]['id']}})[_0xf333('0x2a')](function(_0x34edd0){if(!_0x34edd0)throw new Error(_0xf333('0x71')+_0x3164b1[_0xf333('0x49')]['id']);return db[_0xf333('0x32')][_0xf333('0x72')](_0x3164b1);})[_0xf333('0x2a')](respondWithFilteredResult(_0x14c8d4,_0x11e9a8))[_0xf333('0x47')](handleError(_0x14c8d4,null));}; \ No newline at end of file +var _0x1d72=['error','stack','name','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','keys','UserProfile','options','find','create','clone','length','createdAt','updatedAt','crudPermissions','body','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','addSections','push','removeSections','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','bulkCreate','get','removeResources','ids','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','then','destroy'];(function(_0x1d2864,_0x5d90b0){var _0x110055=function(_0x6e081b){while(--_0x6e081b){_0x1d2864['push'](_0x1d2864['shift']());}};_0x110055(++_0x5d90b0);}(_0x1d72,0x11e));var _0x21d7=function(_0x5d8097,_0x3f2cc4){_0x5d8097=_0x5d8097-0x0;var _0x46c98d=_0x1d72[_0x5d8097];return _0x46c98d;};'use strict';var emlformat=require(_0x21d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21d7('0x1'));var jsonpatch=require(_0x21d7('0x2'));var rp=require(_0x21d7('0x3'));var moment=require(_0x21d7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x21d7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x21d7('0x6'));var csv=require(_0x21d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21d7('0x8'));var _=require(_0x21d7('0x9'));var squel=require(_0x21d7('0xa'));var crypto=require(_0x21d7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21d7('0xc'));var toCsv=require(_0x21d7('0x7'));var querystring=require(_0x21d7('0xd'));var Papa=require(_0x21d7('0xe'));var Redis=require('ioredis');var authService=require(_0x21d7('0xf'));var qs=require(_0x21d7('0x10'));var as=require(_0x21d7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21d7('0x12'))(_0x21d7('0x13'));var utils=require(_0x21d7('0x14'));var config=require(_0x21d7('0x15'));var licenseUtil=require(_0x21d7('0x16'));var db=require(_0x21d7('0x17'))['db'];config['redis']=_['defaults'](config[_0x21d7('0x18')],{'host':_0x21d7('0x19'),'port':0x18eb});var socket=require(_0x21d7('0x1a'))(new Redis(config[_0x21d7('0x18')]));require(_0x21d7('0x1b'))[_0x21d7('0x1c')](socket);function respondWithStatusCode(_0xe3e44d,_0x56e708){_0x56e708=_0x56e708||0xcc;return function(_0x1f6976){if(_0x1f6976){return _0xe3e44d[_0x21d7('0x1d')](_0x56e708);}return _0xe3e44d[_0x21d7('0x1e')](_0x56e708)[_0x21d7('0x1f')]();};}function respondWithResult(_0x36034f,_0x51803d){_0x51803d=_0x51803d||0xc8;return function(_0x2e2e2b){if(_0x2e2e2b){return _0x36034f[_0x21d7('0x1e')](_0x51803d)['json'](_0x2e2e2b);}};}function respondWithFilteredResult(_0x12207f,_0x603f62){return function(_0xc96868){if(_0xc96868){var _0x583d42=typeof _0x603f62[_0x21d7('0x20')]===_0x21d7('0x21')&&typeof _0x603f62[_0x21d7('0x22')]==='undefined';var _0x486f07=_0xc96868[_0x21d7('0x23')];var _0x52a48b=_0x583d42?0x0:_0x603f62['offset'];var _0xbab185=_0x583d42?_0xc96868[_0x21d7('0x23')]:_0x603f62[_0x21d7('0x20')]+_0x603f62[_0x21d7('0x22')];var _0xe2f608;if(_0xbab185>=_0x486f07){_0xbab185=_0x486f07;_0xe2f608=0xc8;}else{_0xe2f608=0xce;}_0x12207f[_0x21d7('0x1e')](_0xe2f608);return _0x12207f[_0x21d7('0x24')]('Content-Range',_0x52a48b+'-'+_0xbab185+'/'+_0x486f07)[_0x21d7('0x25')](_0xc96868);}return null;};}function patchUpdates(_0x27a5f2){return function(_0x11e862){try{jsonpatch['apply'](_0x11e862,_0x27a5f2,!![]);}catch(_0x4f4819){return BPromise['reject'](_0x4f4819);}return _0x11e862[_0x21d7('0x26')]();};}function saveUpdates(_0x4e3623,_0x47030e){return function(_0x222dc0){if(_0x222dc0){return _0x222dc0['update'](_0x4e3623)[_0x21d7('0x27')](function(_0x960533){return _0x960533;});}return null;};}function removeEntity(_0x2eb540,_0x30c55d){return function(_0xff331b){if(_0xff331b){return _0xff331b[_0x21d7('0x28')]()[_0x21d7('0x27')](function(){_0x2eb540[_0x21d7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b651c,_0x583ec3){return function(_0x2dad47){if(!_0x2dad47){_0x1b651c[_0x21d7('0x1d')](0x194);}return _0x2dad47;};}function handleError(_0x30eb2a,_0x13656e){_0x13656e=_0x13656e||0x1f4;return function(_0x59d201){logger[_0x21d7('0x29')](_0x59d201[_0x21d7('0x2a')]);if(_0x59d201['name']){delete _0x59d201[_0x21d7('0x2b')];}_0x30eb2a[_0x21d7('0x1e')](_0x13656e)['send'](_0x59d201);};}exports[_0x21d7('0x2c')]=function(_0x3ade6d,_0x48292a){var _0x3817f1={},_0x5d97ed={},_0x11f248={'count':0x0,'rows':[]};var _0x1c43b6=_[_0x21d7('0x2d')](db['UserProfile'][_0x21d7('0x2e')],function(_0x1fd5a6){return{'name':_0x1fd5a6[_0x21d7('0x2f')],'type':_0x1fd5a6[_0x21d7('0x30')]['key']};});_0x5d97ed[_0x21d7('0x31')]=_[_0x21d7('0x2d')](_0x1c43b6,_0x21d7('0x2b'));_0x5d97ed['query']=_['keys'](_0x3ade6d[_0x21d7('0x32')]);_0x5d97ed['filters']=_[_0x21d7('0x33')](_0x5d97ed['model'],_0x5d97ed[_0x21d7('0x32')]);_0x3817f1[_0x21d7('0x34')]=_[_0x21d7('0x33')](_0x5d97ed['model'],qs[_0x21d7('0x35')](_0x3ade6d[_0x21d7('0x32')]['fields']));_0x3817f1[_0x21d7('0x34')]=_0x3817f1['attributes']['length']?_0x3817f1[_0x21d7('0x34')]:_0x5d97ed[_0x21d7('0x31')];if(!_0x3ade6d[_0x21d7('0x32')][_0x21d7('0x36')]('nolimit')){_0x3817f1[_0x21d7('0x22')]=qs[_0x21d7('0x22')](_0x3ade6d[_0x21d7('0x32')][_0x21d7('0x22')]);_0x3817f1[_0x21d7('0x20')]=qs['offset'](_0x3ade6d[_0x21d7('0x32')][_0x21d7('0x20')]);}_0x3817f1[_0x21d7('0x37')]=qs[_0x21d7('0x38')](_0x3ade6d[_0x21d7('0x32')]['sort']);_0x3817f1[_0x21d7('0x39')]=qs[_0x21d7('0x3a')](_['pick'](_0x3ade6d[_0x21d7('0x32')],_0x5d97ed[_0x21d7('0x3a')]),_0x1c43b6);if(_0x3ade6d[_0x21d7('0x32')]['filter']){_0x3817f1[_0x21d7('0x39')]=_[_0x21d7('0x3b')](_0x3817f1[_0x21d7('0x39')],{'$or':_[_0x21d7('0x2d')](_0x1c43b6,function(_0x4e0366){if(_0x4e0366[_0x21d7('0x30')]!==_0x21d7('0x3c')){var _0xafe20c={};_0xafe20c[_0x4e0366[_0x21d7('0x2b')]]={'$like':'%'+_0x3ade6d[_0x21d7('0x32')][_0x21d7('0x3d')]+'%'};return _0xafe20c;}})});}_0x3817f1=_[_0x21d7('0x3b')]({},_0x3817f1,_0x3ade6d['options']);var _0x45a8c1={'where':_0x3817f1['where']};return db['UserProfile'][_0x21d7('0x23')](_0x45a8c1)['then'](function(_0x298fda){_0x11f248[_0x21d7('0x23')]=_0x298fda;if(_0x3ade6d[_0x21d7('0x32')][_0x21d7('0x3e')]){_0x3817f1[_0x21d7('0x3f')]=[{'all':!![]}];}return db['UserProfile'][_0x21d7('0x40')](_0x3817f1);})[_0x21d7('0x27')](function(_0x186413){_0x11f248[_0x21d7('0x41')]=_0x186413;return _0x11f248;})[_0x21d7('0x27')](respondWithFilteredResult(_0x48292a,_0x3817f1))[_0x21d7('0x42')](handleError(_0x48292a,null));};exports['show']=function(_0x2154ff,_0x4357a9){var _0x589d7f={'raw':![],'where':{'id':_0x2154ff[_0x21d7('0x43')]['id']}},_0x4084bb={};_0x4084bb[_0x21d7('0x31')]=_[_0x21d7('0x44')](db[_0x21d7('0x45')][_0x21d7('0x2e')]);_0x4084bb['query']=_['keys'](_0x2154ff[_0x21d7('0x32')]);_0x4084bb[_0x21d7('0x3a')]=_['intersection'](_0x4084bb[_0x21d7('0x31')],_0x4084bb[_0x21d7('0x32')]);_0x589d7f[_0x21d7('0x34')]=_[_0x21d7('0x33')](_0x4084bb['model'],qs[_0x21d7('0x35')](_0x2154ff[_0x21d7('0x32')]['fields']));_0x589d7f[_0x21d7('0x34')]=_0x589d7f[_0x21d7('0x34')]['length']?_0x589d7f['attributes']:_0x4084bb['model'];if(_0x2154ff[_0x21d7('0x32')]['includeAll']){_0x589d7f[_0x21d7('0x3f')]=[{'all':!![]}];}_0x589d7f=_[_0x21d7('0x3b')]({},_0x589d7f,_0x2154ff[_0x21d7('0x46')]);return db[_0x21d7('0x45')][_0x21d7('0x47')](_0x589d7f)['then'](handleEntityNotFound(_0x4357a9,null))[_0x21d7('0x27')](respondWithResult(_0x4357a9,null))[_0x21d7('0x42')](handleError(_0x4357a9,null));};exports[_0x21d7('0x48')]=function(_0x165f22,_0x30affe){return db[_0x21d7('0x45')][_0x21d7('0x48')](_0x165f22['body'],{})['then'](respondWithResult(_0x30affe,0xc9))['catch'](handleError(_0x30affe,null));};exports[_0x21d7('0x49')]=function(_0x49d362,_0xab387c){var _0x52d576={'where':{'id':_0x49d362[_0x21d7('0x43')]['id']}},_0x50bb84={};_0x50bb84['model']=_['keys'](db[_0x21d7('0x45')][_0x21d7('0x2e')]);_0x52d576['attributes']=_[_0x21d7('0x33')](_0x50bb84[_0x21d7('0x31')],qs[_0x21d7('0x35')](_0x49d362[_0x21d7('0x32')]['fields']));_0x52d576[_0x21d7('0x34')]=_0x52d576['attributes'][_0x21d7('0x4a')]?_0x52d576[_0x21d7('0x34')]:_0x50bb84['model'];if(_0x49d362[_0x21d7('0x32')][_0x21d7('0x3e')]){_0x52d576[_0x21d7('0x3f')]=[{'all':!![]}];}_0x52d576=_[_0x21d7('0x3b')]({},_0x52d576,_0x49d362['options']);return db[_0x21d7('0x45')]['find'](_0x52d576)[_0x21d7('0x27')](handleEntityNotFound(_0xab387c,null))[_0x21d7('0x27')](function(_0xdd02fa){if(_0xdd02fa){var _0x3b46e3=_0xdd02fa['get']({'plain':!![]});_0x3b46e3=qs['omit'](_0x3b46e3,['id',_0x21d7('0x4b'),_0x21d7('0x4c'),_0x21d7('0x4d')]);_0x49d362[_0x21d7('0x4e')]=_[_0x21d7('0x4f')](_0x49d362[_0x21d7('0x4e')],['id','createdAt','updatedAt']);return db[_0x21d7('0x50')][_0x21d7('0x51')](function(_0x55724b){return db[_0x21d7('0x45')][_0x21d7('0x48')](_['merge'](_0x3b46e3,_0x49d362[_0x21d7('0x4e')]),{'include':_0x49d362['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x55724b})[_0x21d7('0x27')](function(_0x2f7c49){var _0x1bff18=_0x2f7c49['get']({'plain':!![]});return db[_0x21d7('0x52')][_0x21d7('0x40')]({'where':{'userProfileId':_0x49d362[_0x21d7('0x43')]['id']},'raw':!![]})['then'](function(_0x53bebf){if(_0x53bebf){return BPromise[_0x21d7('0x53')](_0x53bebf,function(_0xdea5d5){return new BPromise(function(_0x23b1e3,_0x502868){if(_0xdea5d5[_0x21d7('0x54')]===null||_0xdea5d5[_0x21d7('0x54')]===0x1)_0x23b1e3(null);return db[_0x21d7('0x55')][_0x21d7('0x40')]({'where':{'sectionId':_0xdea5d5['id']},'raw':!![]})['then'](function(_0xd7fb92){var _0x302d7e=_[_0x21d7('0x2d')](_0xd7fb92,function(_0x44861d){return qs[_0x21d7('0x4f')](_0x44861d,['id',_0x21d7('0x4b'),_0x21d7('0x4c'),_0x21d7('0x56')]);});_0x23b1e3(_0x302d7e);})[_0x21d7('0x42')](function(_0x18caec){_0x502868(_0x18caec);});})['then'](function(_0x101aed){var _0x268107=qs[_0x21d7('0x4f')](_0xdea5d5,['id',_0x21d7('0x4b'),_0x21d7('0x4c')]);_0x268107[_0x21d7('0x57')]=_0x1bff18['id'];if(_0x101aed)_0x268107[_0x21d7('0x58')]=_0x101aed;return _0x268107;})[_0x21d7('0x27')](function(_0x3e005d){return db[_0x21d7('0x52')]['create'](_0x3e005d,{'include':[{'model':db[_0x21d7('0x55')],'as':_0x21d7('0x58')}],'raw':!![],'transaction':_0x55724b});});})[_0x21d7('0x27')](function(){return _0x1bff18;});}});});});}})[_0x21d7('0x27')](respondWithResult(_0xab387c,0xc9))[_0x21d7('0x42')](handleError(_0xab387c,null));};exports[_0x21d7('0x59')]=function(_0x507192,_0x391e7e){if(_0x507192[_0x21d7('0x4e')]['id']){delete _0x507192[_0x21d7('0x4e')]['id'];}return db[_0x21d7('0x45')]['find']({'where':{'id':_0x507192['params']['id']}})[_0x21d7('0x27')](handleEntityNotFound(_0x391e7e,null))['then'](saveUpdates(_0x507192[_0x21d7('0x4e')],null))[_0x21d7('0x27')](respondWithResult(_0x391e7e,null))[_0x21d7('0x42')](handleError(_0x391e7e,null));};exports[_0x21d7('0x28')]=function(_0x1aa5e9,_0x131be0){return db['UserProfile'][_0x21d7('0x47')]({'where':{'id':_0x1aa5e9[_0x21d7('0x43')]['id']}})[_0x21d7('0x27')](handleEntityNotFound(_0x131be0,null))[_0x21d7('0x27')](removeEntity(_0x131be0,null))[_0x21d7('0x42')](handleError(_0x131be0,null));};exports['describe']=function(_0x5e9ae9,_0x6ac745){return db['UserProfile']['describe']()['then'](respondWithResult(_0x6ac745,null))['catch'](handleError(_0x6ac745,null));};exports[_0x21d7('0x5a')]=function(_0x2b967e,_0x311647){var _0x273260=_0x2b967e[_0x21d7('0x4e')];return db[_0x21d7('0x45')]['find']({'where':{'id':_0x2b967e[_0x21d7('0x43')]['id']}})['then'](handleEntityNotFound(_0x311647,null))['then'](function(_0x5acff8){if(_0x5acff8){return db['sequelize'][_0x21d7('0x51')](function(_0x2005c9){return db[_0x21d7('0x52')]['destroy']({'where':{'userProfileId':_0x2b967e['params']['id'],'sectionId':_['map'](_0x273260,function(_0x222c76){return _0x222c76[_0x21d7('0x56')];})},'transaction':_0x2005c9})['then'](function(){var _0x21fc91=_[_0x21d7('0x2d')](_0x273260,function(_0x4aa047){_0x4aa047['userProfileId']=_0x2b967e['params']['id'];return _0x4aa047;});var _0x61bf9e=[];return BPromise[_0x21d7('0x53')](_0x21fc91,function(_0x3589be){return db['UserProfileSection'][_0x21d7('0x48')](_0x3589be,{'include':[{'model':db[_0x21d7('0x55')],'as':_0x21d7('0x58')}],'raw':!![],'transaction':_0x2005c9})[_0x21d7('0x27')](function(_0x530fde){_0x61bf9e[_0x21d7('0x5b')](_0x530fde['get']({'plain':!![]}));});})[_0x21d7('0x27')](function(){return _0x61bf9e;});});});}})[_0x21d7('0x27')](function(_0x36661b){return _0x36661b;})[_0x21d7('0x27')](respondWithResult(_0x311647,null))['catch'](handleError(_0x311647,null));};exports[_0x21d7('0x5c')]=function(_0x3563e2,_0xe4a911){var _0x3cbb89;return db[_0x21d7('0x45')][_0x21d7('0x47')]({'where':{'id':_0x3563e2[_0x21d7('0x43')]['id']},'attributes':['id',_0x21d7('0x2b')]})[_0x21d7('0x27')](handleEntityNotFound(_0xe4a911,null))[_0x21d7('0x27')](function(_0x5ba16e){if(_0x5ba16e){_0x3cbb89=_0x5ba16e;return db[_0x21d7('0x52')]['destroy']({'where':{'userProfileId':_0x3563e2[_0x21d7('0x43')]['id'],'sectionId':_0x3563e2[_0x21d7('0x32')]['ids']}});}})[_0x21d7('0x27')](function(){return _0x3cbb89;})[_0x21d7('0x27')](respondWithStatusCode(_0xe4a911,null))[_0x21d7('0x42')](handleError(_0xe4a911,null));};exports[_0x21d7('0x5d')]=function(_0x24efb4,_0x3fddd1){var _0x2a4447=[];var _0x1e560a=[];return db['UserProfileSection'][_0x21d7('0x40')]({'where':{'userProfileId':_0x24efb4[_0x21d7('0x43')]['id']},'raw':!![]})[_0x21d7('0x27')](function(_0x5da463){_0x2a4447=_[_0x21d7('0x3d')](_0x5da463,function(_0x74a875){return _0x74a875[_0x21d7('0x5e')]===0x1||_[_0x21d7('0x5f')]([0x3eb,0x709],_0x74a875[_0x21d7('0x56')]);});if(!_['isEmpty'](_0x2a4447)){return _[_0x21d7('0x2d')](_0x2a4447,function(_0x145e5a){return _0x145e5a['sectionId'];});}else{return;}})[_0x21d7('0x27')](function(_0x40f427){if(_0x40f427)_0x1e560a=_0x40f427;if(_[_0x21d7('0x5f')](_0x1e560a,0x64)){var _0x31f1de=_[_0x21d7('0x47')](_0x2a4447,{'sectionId':0x64});return hasDefaultDashboard(_0x31f1de)[_0x21d7('0x27')](function(_0x5de256){return _[_0x21d7('0x2d')](_0x2a4447,function(_0x26fc2d){if(_0x26fc2d[_0x21d7('0x56')]===0x64){_0x26fc2d[_0x21d7('0x60')]=_0x5de256;}return _0x26fc2d;});});}else{return;}})['then'](function(_0x5704b4){if(_0x5704b4)_0x2a4447=_0x5704b4;if(_[_0x21d7('0x5f')](_0x1e560a,0x3eb)){var _0x9a0236=_[_0x21d7('0x47')](_0x2a4447,{'sectionId':0x3eb});return getCustomDashboards(_0x9a0236)[_0x21d7('0x27')](function(_0x534bca){return _[_0x21d7('0x2d')](_0x2a4447,function(_0x58e948){if(_0x9a0236['enabled']){if(_0x58e948[_0x21d7('0x56')]===0x3eb){_0x58e948[_0x21d7('0x60')]=_0x534bca;}}else{if(_0x58e948[_0x21d7('0x56')]===0x64){if(!_0x58e948[_0x21d7('0x60')]){_0x58e948[_0x21d7('0x60')]=[];}_0x58e948['subsections']=_0x58e948[_0x21d7('0x60')][_0x21d7('0x61')](_0x534bca);}}return _0x58e948;});});}else{return;}})[_0x21d7('0x27')](function(_0x1103e8){if(_0x1103e8)_0x2a4447=_0x1103e8;if(_[_0x21d7('0x5f')](_0x1e560a,0x709)){var _0x20a1de=_[_0x21d7('0x47')](_0x2a4447,{'sectionId':0x709});return getPlugins(_0x20a1de)[_0x21d7('0x27')](function(_0x4a515f){if(_0x20a1de[_0x21d7('0x5e')]){return _['map'](_0x2a4447,function(_0x37d4af){if(_0x37d4af[_0x21d7('0x56')]===0x709){_0x37d4af['subsections']=_0x4a515f;}return _0x37d4af;});}else{var _0x4897d9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4a515f};var _0x2079b4=_['map'](_0x2a4447);_0x2079b4['push'](_0x4897d9);return _0x2079b4;}});}else{return;}})[_0x21d7('0x27')](function(_0x47dcbb){if(_0x47dcbb)_0x2a4447=_0x47dcbb;return _[_0x21d7('0x3d')](_0x2a4447,[_0x21d7('0x5e'),0x1]);})[_0x21d7('0x27')](respondWithResult(_0x3fddd1,null))[_0x21d7('0x42')](handleError(_0x3fddd1,null));};function hasDefaultDashboard(_0x1ecc02){var _0x2a6305=[0x65];return new BPromise(function(_0x137dc1,_0x1b2657){try{if(_0x1ecc02[_0x21d7('0x54')]){_0x137dc1(_0x2a6305);}else{return db[_0x21d7('0x55')][_0x21d7('0x62')]({'where':{'sectionId':_0x1ecc02['id']},'raw':!![]})[_0x21d7('0x27')](function(_0x166d56){_0x166d56?_0x137dc1(_0x2a6305):_0x137dc1();});}}catch(_0x4ce6bf){_0x1b2657(_0x4ce6bf);}});}function getCustomDashboards(_0x86f96b){var _0x112167=[];return new BPromise(function(_0x276c34,_0x166d68){try{if(_0x86f96b[_0x21d7('0x54')]){return db[_0x21d7('0x63')][_0x21d7('0x40')]({'raw':!![]})[_0x21d7('0x27')](function(_0x398218){_0x398218[_0x21d7('0x64')](function(_0x4bec75){_0x112167['push'](_0x4bec75['id']+0x1869f);});_0x276c34(_0x112167);});}else{return db[_0x21d7('0x55')][_0x21d7('0x40')]({'where':{'sectionId':_0x86f96b['id']},'raw':!![]})[_0x21d7('0x27')](function(_0x5821b9){_0x5821b9['forEach'](function(_0x58e563){_0x112167[_0x21d7('0x5b')](_0x58e563['resourceId']+0x1869f);});_0x276c34(_0x112167);});}}catch(_0x359676){_0x166d68(_0x359676);}});}function getPlugins(_0x455774){var _0x2e0331=[];return new BPromise(function(_0x3da2bd,_0x2d9c12){try{if(_0x455774['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})[_0x21d7('0x27')](function(_0x417ef6){_0x417ef6[_0x21d7('0x64')](function(_0xd4e6a1){_0x2e0331[_0x21d7('0x5b')](_0xd4e6a1['id']+0x15b38);});_0x3da2bd(_0x2e0331);});}else{return db[_0x21d7('0x55')][_0x21d7('0x40')]({'where':{'sectionId':_0x455774['id']},'raw':!![]})[_0x21d7('0x27')](function(_0x39d890){_0x39d890['forEach'](function(_0x22694e){_0x2e0331[_0x21d7('0x5b')](_0x22694e['resourceId']+0x15b38);});_0x3da2bd(_0x2e0331);});}}catch(_0x1b6084){_0x2d9c12(_0x1b6084);}});}exports['addResources']=function(_0x372cf3,_0x51ebfc){return db[_0x21d7('0x45')]['find']({'where':{'id':_0x372cf3[_0x21d7('0x43')]['id']}})[_0x21d7('0x27')](handleEntityNotFound(_0x51ebfc,null))[_0x21d7('0x27')](function(_0x4d934f){if(_0x4d934f){return db['sequelize'][_0x21d7('0x51')](function(_0x916ced){return db[_0x21d7('0x52')]['findAll']({'where':{'userProfileId':_0x372cf3[_0x21d7('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x31bb32){if(_0x31bb32){return db[_0x21d7('0x52')][_0x21d7('0x28')]({'where':{'userProfileId':_0x372cf3[_0x21d7('0x43')]['id'],'id':_[_0x21d7('0x2d')](_0x31bb32,function(_0x30018a){return _0x30018a['id'];})},'transaction':_0x916ced});}})[_0x21d7('0x27')](function(_0x1b441c){var _0x250a6d=_[_0x21d7('0x2d')](_0x372cf3['body'],function(_0x1d4c89){_0x1d4c89[_0x21d7('0x57')]=_0x372cf3[_0x21d7('0x43')]['id'];return _0x1d4c89;});return db[_0x21d7('0x52')][_0x21d7('0x65')](_0x250a6d,{'raw':!![],'transaction':_0x916ced});})[_0x21d7('0x27')](function(_0xa58a04){var _0x2a638a=_[_0x21d7('0x3d')](_[_0x21d7('0x2d')](_0xa58a04,function(_0x24d37a){return _0x24d37a['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2a638a){return db[_0x21d7('0x52')][_0x21d7('0x40')]({'where':{'userProfileId':_0x372cf3[_0x21d7('0x43')]['id'],'sectionId':_[_0x21d7('0x2d')](_0x2a638a,function(_0x39ddc6){return _0x39ddc6[_0x21d7('0x56')];})},'attributes':['id',_0x21d7('0x56')],'raw':!![]})[_0x21d7('0x27')](function(_0x12759a){var _0x283930=_[_0x21d7('0x2d')](_0x372cf3['body'],function(_0xa489c6){_0xa489c6[_0x21d7('0x57')]=_0x372cf3[_0x21d7('0x43')]['id'];return _0xa489c6;});return db[_0x21d7('0x55')][_0x21d7('0x65')](_0x283930,{'raw':!![],'transaction':_0x916ced});});}})['catch'](handleError(_0x51ebfc,null));});}})['then'](function(_0x3989af){var _0x53799a=_['map'](_0x3989af,function(_0x31538c){return _0x31538c[_0x21d7('0x66')]({'plain':!![]});});})[_0x21d7('0x27')](respondWithResult(_0x51ebfc,null))['catch'](handleError(_0x51ebfc,null));};exports[_0x21d7('0x67')]=function(_0x33325e,_0x21f2fe,_0x55016d){return db[_0x21d7('0x45')][_0x21d7('0x47')]({'where':{'id':_0x33325e[_0x21d7('0x43')]['id']}})[_0x21d7('0x27')](handleEntityNotFound(_0x21f2fe,null))[_0x21d7('0x27')](function(_0x324b6e){if(_0x324b6e){return _0x324b6e[_0x21d7('0x67')](_0x33325e[_0x21d7('0x32')][_0x21d7('0x68')]);}})[_0x21d7('0x27')](respondWithStatusCode(_0x21f2fe,null))[_0x21d7('0x42')](handleError(_0x21f2fe,null));};exports[_0x21d7('0x69')]=function(_0x5cc700,_0x3a6f28){var _0x44632b={};if(!_0x5cc700['query']['section'])throw new Error(_0x21d7('0x6a'));if(!_0x5cc700[_0x21d7('0x32')][_0x21d7('0x36')](_0x21d7('0x6b'))){_0x44632b[_0x21d7('0x22')]=qs[_0x21d7('0x22')](_0x5cc700[_0x21d7('0x32')]['limit']);_0x44632b[_0x21d7('0x20')]=qs['offset'](_0x5cc700[_0x21d7('0x32')][_0x21d7('0x20')]);}return db[_0x21d7('0x45')][_0x21d7('0x47')]({'where':{'id':_0x5cc700[_0x21d7('0x43')]['id']}})[_0x21d7('0x27')](function(_0x1e2918){if(!_0x1e2918)throw new Error(_0x21d7('0x6c')+_0x5cc700[_0x21d7('0x43')]['id']);return db['UserProfile'][_0x21d7('0x69')](_0x5cc700);})[_0x21d7('0x27')](respondWithFilteredResult(_0x3a6f28,_0x44632b))[_0x21d7('0x42')](handleError(_0x3a6f28,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 661d22c..669ff49 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 _0x5f6f=['../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','events'];(function(_0x3090af,_0x409690){var _0x482913=function(_0x20aba8){while(--_0x20aba8){_0x3090af['push'](_0x3090af['shift']());}};_0x482913(++_0x409690);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x4cda06,_0x3cb29c){_0x4cda06=_0x4cda06-0x0;var _0x48f3fa=_0x5f6f[_0x4cda06];return _0x48f3fa;};'use strict';var EventEmitter=require(_0xf5f6('0x0'));var UserProfile=require(_0xf5f6('0x1'))['db'][_0xf5f6('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf5f6('0x3')](0x0);var events={'afterCreate':_0xf5f6('0x4'),'afterUpdate':'update','afterDestroy':_0xf5f6('0x5')};function emitEvent(_0x438699){return function(_0x2f2e00,_0x58028b,_0x3dd995){UserProfileEvents[_0xf5f6('0x6')](_0x438699+':'+_0x2f2e00['id'],_0x2f2e00);UserProfileEvents[_0xf5f6('0x6')](_0x438699,_0x2f2e00);_0x3dd995(null);};}for(var e in events){if(events[_0xf5f6('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xd1f8=['UserProfile','setMaxListeners','update','emit','hook','exports','events','../../mysqldb'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xd1f8[_0x142020];return _0x40da8f;};'use strict';var EventEmitter=require(_0x8d1f('0x0'));var UserProfile=require(_0x8d1f('0x1'))['db'][_0x8d1f('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8d1f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d1f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1a317b){return function(_0x4f68b2,_0x2cee33,_0x4793b6){UserProfileEvents[_0x8d1f('0x5')](_0x1a317b+':'+_0x4f68b2['id'],_0x4f68b2);UserProfileEvents[_0x8d1f('0x5')](_0x1a317b,_0x4f68b2);_0x4793b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x8d1f('0x6')](e,emitEvent(event));}}module[_0x8d1f('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 79234dc..9bb4dfb 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 _0xff09=['ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','all','ignore','union','length','push','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields','nolimit','limit','offset','sort','where','pick','merge','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','custom','reportId','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','findAll','then','map','catch','value','model','associatedResources','name','resolve','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','parentSections','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','agent','Telephones','membername','telephone','VoiceQueue','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','WhatsappAccount','teams','Team','QueueCampaigns','users','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','slice','Sequelize','select'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xff09,0x1ab));var _0x9ff0=function(_0x95b70a,_0x141e6a){_0x95b70a=_0x95b70a-0x0;var _0x288254=_0xff09[_0x95b70a];return _0x288254;};'use strict';var _=require('lodash');var attributes=require(_0x9ff0('0x0'));var qs=require(_0x9ff0('0x1'));var squel=require('squel');module[_0x9ff0('0x2')]=function(_0x42fdfd){var _0x230acd=_0x42fdfd[_0x9ff0('0x3')];function _0x6d68c5(_0x58b72e,_0x41ee5f){return new Promise(function(_0x17d74b,_0x2b094d){if(!_0x41ee5f)return _0x17d74b(null);var _0x1a1ed1=_0x41ee5f[_0x9ff0('0x4')]?{[_0x41ee5f['filter'][_0x9ff0('0x5')]]:_0x41ee5f[_0x9ff0('0x4')]['value']}:undefined;return _0x230acd[_0x58b72e][_0x9ff0('0x6')]({'where':_0x1a1ed1,'raw':!![]})[_0x9ff0('0x7')](function(_0x338697){_0x41ee5f['associatedResources']=_[_0x9ff0('0x8')](_0x338697,'id');_0x17d74b(_0x41ee5f);})[_0x9ff0('0x9')](function(_0x327fcc){_0x2b094d(_0x327fcc);});});}function _0x40335f(_0x5a83ee,_0xfb55c){return new Promise(function(_0x423d18,_0x52c1ad){var _0x47b480=_0x5a83ee[_0x9ff0('0x4')]?{[_0x5a83ee['filter'][_0x9ff0('0x5')]]:_0x5a83ee[_0x9ff0('0x4')][_0x9ff0('0xa')]}:undefined;return _0x230acd[_0x5a83ee[_0x9ff0('0xb')]]['findAll']({'where':_0x47b480,'raw':!![]})[_0x9ff0('0x7')](function(_0x32743f){_0xfb55c[_0x9ff0('0xc')]=_[_0x9ff0('0x8')](_0x32743f,function(_0xf0046f){return _0xf0046f[_0x9ff0('0xd')];});_0x423d18(_0xfb55c);})[_0x9ff0('0x9')](function(_0x447eb1){_0x52c1ad(_0x447eb1);});});}function _0x253904(_0x594db5,_0x1a5cf2,_0x5677d8){if(!_0x1a5cf2)return Promise[_0x9ff0('0xe')](null);return new Promise(function(_0x4c25cd,_0x247537){return _0x230acd['UserProfileResource'][_0x9ff0('0x6')]({'where':{'sectionId':_0x1a5cf2['id']},'raw':!![]})[_0x9ff0('0x7')](function(_0x41d48a){if(_0x594db5[_0x9ff0('0x5')]&&_0x594db5[_0x9ff0('0x5')]!=='id'){_0x1a5cf2['associatedResources']=_[_0x9ff0('0x8')](_0x41d48a,function(_0x15f513){return _0x15f513[_0x594db5[_0x9ff0('0x5')]];});}else{if(_0x5677d8==='AnalyticExtractedReport'){_0x1a5cf2[_0x9ff0('0xc')]=_[_0x9ff0('0x8')](_0x41d48a,function(_0x37e128){return{'id':_0x37e128['resourceId'],'type':_0x37e128[_0x9ff0('0xf')]};});}else{_0x1a5cf2[_0x9ff0('0xc')]=_['map'](_0x41d48a,function(_0x588d66){return _0x588d66[_0x9ff0('0x10')];});}}_0x4c25cd(_0x1a5cf2);})[_0x9ff0('0x9')](function(_0x3f125c){_0x247537(_0x3f125c);});});}function _0x1c5e76(_0x10241c,_0x3bcb9a){var _0x42bb25={'parentSections':[]};switch(_0x10241c[_0x9ff0('0x11')]()){case _0x9ff0('0x12'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x14');break;case'odbc':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x15');break;case _0x9ff0('0x16'):_0x42bb25[_0x9ff0('0x13')]='SquareRecording';_0x42bb25[_0x9ff0('0x17')]=[{'name':'SquareProjects','field':_0x9ff0('0xd'),'foreignKey':'projectName'}];break;case _0x9ff0('0x18'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x19');break;case _0x9ff0('0x1a'):_0x42bb25['childModel']=_0x9ff0('0x1b');_0x42bb25[_0x9ff0('0x17')]=[{'name':_0x9ff0('0x1c'),'field':'id','foreignKey':_0x9ff0('0x1d')}];break;case'lists':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x1e');break;case _0x9ff0('0x1f'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x20');break;case _0x9ff0('0x21'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x22');break;case'chatqueues':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x23');break;case'chatwebsites':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x24');break;case'faxqueues':_0x42bb25['childModel']=_0x9ff0('0x25');break;case'faxaccounts':_0x42bb25['childModel']=_0x9ff0('0x26');break;case _0x9ff0('0x27'):case _0x9ff0('0x28'):case _0x9ff0('0x29'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x2a');break;case _0x9ff0('0x2b'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x2c');break;case _0x9ff0('0x2d'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x2e');break;case _0x9ff0('0x2f'):_0x42bb25[_0x9ff0('0x13')]='VoiceRecording';_0x42bb25['parentSections']=[{'name':_0x9ff0('0x30'),'field':_0x9ff0('0xd'),'foreignKey':'membername','model':_0x9ff0('0x31'),'filter':{'field':'role','value':[_0x9ff0('0x32')]}},{'name':_0x9ff0('0x33'),'field':_0x9ff0('0xd'),'foreignKey':_0x9ff0('0x34'),'model':'User','filter':{'field':'role','value':[_0x9ff0('0x35')]}},{'name':'VoiceQueues','field':_0x9ff0('0xd'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x9ff0('0xf'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x9ff0('0xd'),'foreignKey':'queue','model':_0x9ff0('0x36'),'filter':{'field':_0x9ff0('0xf'),'value':['outbound']}}];break;case _0x9ff0('0x37'):_0x42bb25['childModel']=_0x9ff0('0x38');break;case'chanspies':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x39');break;case'voiceprefixes':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x3a');break;case _0x9ff0('0x3b'):_0x42bb25[_0x9ff0('0x13')]='Campaign';break;case _0x9ff0('0x3c'):_0x42bb25['childModel']=_0x9ff0('0x3d');break;case _0x9ff0('0x3e'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x3f');break;case _0x9ff0('0x40'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x41');break;case'openchannelqueues':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x42');break;case _0x9ff0('0x43'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x44');break;case _0x9ff0('0x45'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x46');break;case'smsaccounts':_0x42bb25['childModel']=_0x9ff0('0x47');break;case'whatsappqueues':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x48');break;case'whatsappaccounts':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x49');break;case _0x9ff0('0x4a'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x4b');break;case'voicequeues':case'queuecampaigns':_0x42bb25['childModel']=_0x9ff0('0x36');if(_0x3bcb9a){_0x42bb25[_0x9ff0('0x17')]=[{'name':'VoiceQueues'},{'name':_0x9ff0('0x4c')}];}break;case _0x9ff0('0x4d'):case'agents':case'telephones':_0x42bb25[_0x9ff0('0x13')]='User';if(_0x3bcb9a){_0x42bb25[_0x9ff0('0x17')]=[{'name':_0x9ff0('0x4e'),'filter':{'field':'role','value':[_0x9ff0('0x4f'),_0x9ff0('0x50')]},'ignore':!![]},{'name':'Agents'},{'name':_0x9ff0('0x33')}];}break;case _0x9ff0('0x51'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x52');break;case _0x9ff0('0x53'):_0x42bb25['childModel']='SalesforceAccount';break;case _0x9ff0('0x54'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x55');break;case'sugarcrmaccounts':_0x42bb25['childModel']='SugarcrmAccount';break;case _0x9ff0('0x56'):_0x42bb25[_0x9ff0('0x13')]='DeskAccount';break;case _0x9ff0('0x57'):_0x42bb25['childModel']=_0x9ff0('0x58');break;case _0x9ff0('0x59'):_0x42bb25[_0x9ff0('0x13')]='User';break;case _0x9ff0('0x5a'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x5b');break;case'dispositions':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x5c');break;case'customdashboards':_0x42bb25[_0x9ff0('0x13')]='Dashboard';break;case'intervals':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x5d');break;case _0x9ff0('0x5e'):_0x42bb25['childModel']=_0x9ff0('0x5f');break;case _0x9ff0('0x60'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x61');break;case _0x9ff0('0x62'):_0x42bb25['childModel']='Sound';break;case _0x9ff0('0x63'):_0x42bb25['childModel']=_0x9ff0('0x64');break;case'templates':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x65');break;case _0x9ff0('0x66'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x67');break;case'trunks':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x68');break;case _0x9ff0('0x69'):_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x6a');break;case'plugins':_0x42bb25[_0x9ff0('0x13')]=_0x9ff0('0x6b');break;case _0x9ff0('0x6c'):_0x42bb25['childModel']='AnalyticExtractedReport';_0x42bb25[_0x9ff0('0x17')]=[{'name':_0x9ff0('0x6d'),'field':'id','foreignKey':'reportId'}];break;case _0x9ff0('0x6e'):_0x42bb25[_0x9ff0('0x13')]='AnalyticMetric';break;}return _0x42bb25;}function _0x524cfb(_0xb817b8,_0x3e9725){var _0x3a4147=_0xb817b8[_0x9ff0('0x6f')](0x0)[_0x9ff0('0x70')]()+_0xb817b8[_0x9ff0('0x71')](0x1);var _0x9c4d9c={'type':_0x230acd[_0x9ff0('0x72')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x4508aa,_0x303be2){var _0x4aac90=squel[_0x9ff0('0x73')]()[_0x9ff0('0x5')]('ui.'+_0x3a4147+'InteractionId','id')['field'](_0x9ff0('0x74'))['from'](_0x9ff0('0x75')+_0xb817b8+_0x9ff0('0x76'),'ui')['where'](_0x9ff0('0x77'),_0x3e9725['id']);return _0x230acd[_0x9ff0('0x78')][_0x9ff0('0x79')](_0x4aac90[_0x9ff0('0x7a')](),_0x9c4d9c)['then'](function(_0x2e8da9){_0x3e9725[_0x3a4147+'OpenTabs']=_0x2e8da9;_0x4508aa(_0x2e8da9);})[_0x9ff0('0x9')](function(_0x1c3d9a){_0x303be2(_0x1c3d9a);});});}return _0x42fdfd[_0x9ff0('0x7b')](_0x9ff0('0x7c'),attributes,{'tableName':_0x9ff0('0x7d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x233658){var _0x51feab={'raw':_0x233658[_0x9ff0('0x79')][_0x9ff0('0x7e')],'where':{}};var _0x23a4cb={};var _0x196a71={'count':0x0,'rows':[]};var _0x5e0804=_0x233658['query'][_0x9ff0('0x7f')];var _0x40d9e1=_0x233658[_0x9ff0('0x79')][_0x9ff0('0x80')]||![];var _0x2d258b=_0x1c5e76(_0x5e0804,_0x40d9e1);if(!_0x2d258b['childModel'])throw new Error(_0x9ff0('0x81')+_0x5e0804+'\x27');var _0x557d2c=[{'name':_0x5e0804}];if(!_[_0x9ff0('0x82')](_0x2d258b['parentSections']))_0x557d2c=_0x2d258b[_0x9ff0('0x17')];var _0x52f60a=[];for(var _0x3c3f63=0x0;_0x3c3f63<_0x557d2c['length'];_0x3c3f63++){_0x52f60a['push'](_0x230acd[_0x9ff0('0x83')][_0x9ff0('0x84')]({'where':{'userProfileId':_0x233658['params']['id'],'name':_0x557d2c[_0x3c3f63]['name']},'raw':!![]}));}return Promise[_0x9ff0('0x85')](_0x52f60a)[_0x9ff0('0x7')](function(_0x56e2b3){var _0x32d6bd=_[_0x9ff0('0x4')](_0x56e2b3,function(_0xc3d139){return _0xc3d139?_0xc3d139:undefined;});var _0x522fc8=_[_0x9ff0('0x4')](_0x557d2c,[_0x9ff0('0x86'),!![]]);var _0x345f12=_[_0x9ff0('0x82')](_0x32d6bd)&&_['isEmpty'](_0x522fc8)?null:_[_0x9ff0('0x87')](_0x522fc8,_0x32d6bd);if(!_0x345f12)return null;var _0x528c3d=[];for(var _0x5e62f2=0x0;_0x5e62f2<_0x345f12[_0x9ff0('0x88')];_0x5e62f2++){var _0x37677d=_[_0x9ff0('0x84')](_0x557d2c,function(_0x4858b4){return _0x345f12[_0x5e62f2]?_0x4858b4[_0x9ff0('0xd')]===_0x345f12[_0x5e62f2]['name']:null;});if(_0x37677d){if(_0x345f12[_0x5e62f2][_0x9ff0('0x86')]){_0x528c3d[_0x9ff0('0x89')](_0x6d68c5(_0x2d258b['childModel'],_0x345f12[_0x5e62f2]));}else{if(!_0x345f12[_0x5e62f2][_0x9ff0('0x8a')]){_0x528c3d[_0x9ff0('0x89')](_0x253904(_0x37677d,_0x345f12[_0x5e62f2],_0x2d258b[_0x9ff0('0x13')]));}else{if(_0x37677d['model']){_0x528c3d[_0x9ff0('0x89')](_0x40335f(_0x37677d,_0x345f12[_0x5e62f2]));}}}}}return Promise[_0x9ff0('0x85')](_0x528c3d);})[_0x9ff0('0x7')](function(_0x33d734){var _0x4f8d90=_0x33d734;var _0x5e1205=null;if(_0x4f8d90){_0x5e1205=_0x4f8d90[_0x9ff0('0x88')]===0x1?_0x4f8d90[0x0]:null;}if(!_0x5e1205&&!_0x4f8d90)return _0x196a71;var _0x3ce369=_0x230acd[_0x2d258b[_0x9ff0('0x13')]][_0x9ff0('0x8b')];_0x23a4cb['model']=_[_0x9ff0('0x8c')](_0x3ce369);_0x23a4cb[_0x9ff0('0x79')]=_[_0x9ff0('0x8c')](_0x233658['query']);_0x23a4cb[_0x9ff0('0x8d')]=_['intersection'](_0x23a4cb[_0x9ff0('0xb')],_0x23a4cb[_0x9ff0('0x79')]);_0x51feab[_0x9ff0('0x8e')]=_[_0x9ff0('0x8f')](_0x23a4cb[_0x9ff0('0xb')],qs[_0x9ff0('0x90')](_0x233658[_0x9ff0('0x79')][_0x9ff0('0x90')]));_0x51feab[_0x9ff0('0x8e')]=_0x51feab[_0x9ff0('0x8e')][_0x9ff0('0x88')]?_0x51feab[_0x9ff0('0x8e')]:_0x23a4cb[_0x9ff0('0xb')];if(!_0x233658['query']['hasOwnProperty'](_0x9ff0('0x91'))){_0x51feab[_0x9ff0('0x92')]=qs['limit'](_0x233658[_0x9ff0('0x79')][_0x9ff0('0x92')]);_0x51feab[_0x9ff0('0x93')]=qs[_0x9ff0('0x93')](_0x233658['query'][_0x9ff0('0x93')]);}_0x51feab['order']=qs[_0x9ff0('0x94')](_0x233658[_0x9ff0('0x79')][_0x9ff0('0x94')]);_0x51feab[_0x9ff0('0x95')]=qs[_0x9ff0('0x8d')](_[_0x9ff0('0x96')](_0x233658['query'],_0x23a4cb[_0x9ff0('0x8d')]));if(_0x233658['query']['filter']){_0x51feab[_0x9ff0('0x95')]=_[_0x9ff0('0x97')](_0x51feab[_0x9ff0('0x95')],{'$or':_[_0x9ff0('0x8')](_0x3ce369,function(_0x31851b){if(_0x31851b[_0x9ff0('0xf')]['key']!==_0x9ff0('0x98')){var _0x51f820={};_0x51f820[_0x31851b[_0x9ff0('0x5')]]={'$like':'%'+_0x233658[_0x9ff0('0x79')]['filter']+'%'};return _0x51f820;}})});}var _0x44419a=[];var _0x4cc7f5=null;var _0x1dcd55={};if(_0x5e1205){_0x4cc7f5=_['find'](_0x557d2c,[_0x9ff0('0xd'),_0x5e1205[_0x9ff0('0xd')]]);if(_0x4cc7f5['field']){_0x1dcd55={};if(_0x2d258b[_0x9ff0('0x13')]===_0x9ff0('0x99')){_0x1dcd55[_0x4cc7f5[_0x9ff0('0x9a')]]=_[_0x9ff0('0x8')](_0x5e1205[_0x9ff0('0xc')],'id');}else{_0x1dcd55[_0x4cc7f5['foreignKey']]=_0x5e1205[_0x9ff0('0xc')];}_0x44419a[_0x9ff0('0x89')](_0x1dcd55);}else{_0x51feab[_0x9ff0('0x95')]['id']=_0x5e1205[_0x9ff0('0xc')];}}else{for(var _0x404b38=0x0;_0x404b38<_0x4f8d90[_0x9ff0('0x88')];_0x404b38++){_0x4cc7f5=_[_0x9ff0('0x84')](_0x557d2c,[_0x9ff0('0xd'),_0x4f8d90[_0x404b38][_0x9ff0('0xd')]]);if(_0x4cc7f5[_0x9ff0('0x5')]){_0x1dcd55={};_0x1dcd55[_0x4cc7f5[_0x9ff0('0x9a')]]=_0x4f8d90[_0x404b38][_0x9ff0('0xc')];_0x44419a[_0x9ff0('0x89')](_0x1dcd55);}else{if(!_0x51feab['where']['id'])_0x51feab['where']['id']=[];_0x4f8d90[_0x404b38][_0x9ff0('0xc')][_0x9ff0('0x9b')](function(_0x36c36d){_0x51feab[_0x9ff0('0x95')]['id'][_0x9ff0('0x89')](_0x36c36d);});}}}if(!_[_0x9ff0('0x82')](_0x44419a)){_0x51feab[_0x9ff0('0x95')]=_['merge'](_0x51feab['where'],{'$and':{'$or':_0x44419a}});}_0x51feab=_[_0x9ff0('0x97')]({},_0x51feab,_0x233658[_0x9ff0('0x9c')]);if(_0x5e1205&&!_0x5e1205[_0x9ff0('0x8a')]&&_0x2d258b['childModel']===_0x9ff0('0x99')){if(_0x233658[_0x9ff0('0x79')][_0x9ff0('0x9d')]){_0x51feab[_0x9ff0('0x9e')]=[{'all':!![]}];}return _0x230acd[_0x2d258b[_0x9ff0('0x13')]][_0x9ff0('0x6')](_0x51feab)[_0x9ff0('0x7')](function(_0x40945b){var _0x26e153=[];_0x40945b[_0x9ff0('0x9b')](function(_0x40b74c){var _0x20ee02;switch(_0x40b74c[_0x9ff0('0x9f')]){case'default':_0x20ee02=_['find'](_0x5e1205[_0x9ff0('0xc')],function(_0x14d142){return _0x14d142['id']===_0x40b74c['reportId']&&_0x14d142[_0x9ff0('0xf')]===_0x9ff0('0xa0');});break;case _0x9ff0('0xa1'):_0x20ee02=_[_0x9ff0('0x84')](_0x5e1205['associatedResources'],function(_0x4e060c){return _0x4e060c['id']===_0x40b74c[_0x9ff0('0xa2')]&&_0x4e060c[_0x9ff0('0xf')]===_0x9ff0('0xa3');});break;}if(_0x20ee02)_0x26e153[_0x9ff0('0x89')](_0x40b74c);});_0x196a71[_0x9ff0('0xa4')]=_0x26e153[_0x9ff0('0x88')];_0x196a71[_0x9ff0('0xa5')]=_0x26e153;return _0x196a71;});}else{if(!_[_0x9ff0('0x82')](_0x233658[_0x9ff0('0x79')][_0x9ff0('0xa6')])){_0x51feab[_0x9ff0('0x95')]['id']=_0x51feab[_0x9ff0('0x95')]['id']?_[_0x9ff0('0x8f')](_0x51feab[_0x9ff0('0x95')]['id'],_0x233658['query'][_0x9ff0('0xa6')]):_0x233658[_0x9ff0('0x79')]['ids'];if(_0x233658[_0x9ff0('0x79')][_0x9ff0('0xa7')]){_0x51feab['order']=_0x233658['query'][_0x9ff0('0xa7')];}}if(_0x233658[_0x9ff0('0x79')][_0x9ff0('0xa8')]){_0x51feab['where']=_[_0x9ff0('0x97')](_0x51feab['where'],{'$and':_0x233658[_0x9ff0('0x79')]['extraQueryConditions']});}return _0x230acd[_0x2d258b[_0x9ff0('0x13')]]['count']({'where':_0x51feab[_0x9ff0('0x95')]})['then'](function(_0x52fc03){_0x196a71[_0x9ff0('0xa4')]=_0x52fc03;if(_0x233658[_0x9ff0('0x79')][_0x9ff0('0x9d')]){if(_0x2d258b['childModel']===_0x9ff0('0x1b')){_0x51feab[_0x9ff0('0x9e')]=[{'model':_0x230acd[_0x9ff0('0x64')],'as':_0x9ff0('0xa9'),'attributes':['id','name',_0x9ff0('0xaa')],'required':_0x233658[_0x9ff0('0x79')][_0x9ff0('0xab')]?!![]:![]},{'model':_0x230acd[_0x9ff0('0x64')],'as':_0x9ff0('0xac'),'attributes':['id','name',_0x9ff0('0xaa')],'through':_0x233658[_0x9ff0('0x79')]['tag']?{'attributes':[],'where':{'TagId':_0x233658['query'][_0x9ff0('0xab')]||undefined}}:{},'required':_0x233658[_0x9ff0('0x79')]['tag']?!![]:![]}];}else{_0x51feab[_0x9ff0('0x9e')]=[{'all':!![]}];}}return _0x230acd[_0x2d258b[_0x9ff0('0x13')]][_0x9ff0('0x6')](_0x51feab);})[_0x9ff0('0x7')](function(_0xdd2c5f){_0x196a71[_0x9ff0('0xa5')]=_0xdd2c5f;if(_0x5e0804===_0x9ff0('0x30')&&_0x233658[_0x9ff0('0x79')][_0x9ff0('0xad')]===_0x9ff0('0xae')){var _0x48f57a=[];for(var _0x18c2fe=0x0;_0x18c2fe<_0x196a71[_0x9ff0('0xa5')][_0x9ff0('0x88')];_0x18c2fe++){_0x48f57a[_0x9ff0('0x89')](_0x524cfb('chat',_0x196a71[_0x9ff0('0xa5')][_0x18c2fe][_0x9ff0('0xaf')]));_0x48f57a['push'](_0x524cfb(_0x9ff0('0xb0'),_0x196a71[_0x9ff0('0xa5')][_0x18c2fe][_0x9ff0('0xaf')]));_0x48f57a['push'](_0x524cfb(_0x9ff0('0xb1'),_0x196a71[_0x9ff0('0xa5')][_0x18c2fe][_0x9ff0('0xaf')]));_0x48f57a['push'](_0x524cfb(_0x9ff0('0xb2'),_0x196a71[_0x9ff0('0xa5')][_0x18c2fe][_0x9ff0('0xaf')]));_0x48f57a['push'](_0x524cfb(_0x9ff0('0xb3'),_0x196a71[_0x9ff0('0xa5')][_0x18c2fe][_0x9ff0('0xaf')]));_0x48f57a['push'](_0x524cfb(_0x9ff0('0xb4'),_0x196a71['rows'][_0x18c2fe][_0x9ff0('0xaf')]));}return Promise[_0x9ff0('0x85')](_0x48f57a)[_0x9ff0('0x7')](function(){return _0x196a71;});}return _0x196a71;});}});}}});}; \ No newline at end of file +var _0x6ae2=['agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','scheduler','sounds','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','select','ui.','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','model','rawAttributes','keys','intersection','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','merge','VIRTUAL','foreignKey','forEach','include','reportType','DefaultReports','count','rows','ids','includeAll','Tags','color','tag','ThroughTags','Agents','openTabs','true','chat','dataValues','sms','mail','whatsapp','lodash','../../components/parsers/qs','squel','exports','models','filter','value','findAll','map','catch','field','associatedResources','name','resolve','UserProfileResource','then','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','voicequeues','queuecampaigns','users'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ae2,0x12a));var _0x26ae=function(_0x185ee3,_0x1e8fb8){_0x185ee3=_0x185ee3-0x0;var _0x14eaa7=_0x6ae2[_0x185ee3];return _0x14eaa7;};'use strict';var _=require(_0x26ae('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x26ae('0x1'));var squel=require(_0x26ae('0x2'));module[_0x26ae('0x3')]=function(_0x52fee0){var _0x6be649=_0x52fee0[_0x26ae('0x4')];function _0x1d9f2d(_0x56036b,_0x363985){return new Promise(function(_0x45e7de,_0x3a5ad8){if(!_0x363985)return _0x45e7de(null);var _0x572ff4=_0x363985[_0x26ae('0x5')]?{[_0x363985['filter']['field']]:_0x363985[_0x26ae('0x5')][_0x26ae('0x6')]}:undefined;return _0x6be649[_0x56036b][_0x26ae('0x7')]({'where':_0x572ff4,'raw':!![]})['then'](function(_0x1e7ac2){_0x363985['associatedResources']=_[_0x26ae('0x8')](_0x1e7ac2,'id');_0x45e7de(_0x363985);})[_0x26ae('0x9')](function(_0x25eb2f){_0x3a5ad8(_0x25eb2f);});});}function _0x577827(_0x3c1810,_0x2f00a2){return new Promise(function(_0x2b1d68,_0x5c1be6){var _0x5c164e=_0x3c1810[_0x26ae('0x5')]?{[_0x3c1810[_0x26ae('0x5')][_0x26ae('0xa')]]:_0x3c1810[_0x26ae('0x5')][_0x26ae('0x6')]}:undefined;return _0x6be649[_0x3c1810['model']][_0x26ae('0x7')]({'where':_0x5c164e,'raw':!![]})['then'](function(_0x13ee6e){_0x2f00a2[_0x26ae('0xb')]=_[_0x26ae('0x8')](_0x13ee6e,function(_0x3b1628){return _0x3b1628[_0x26ae('0xc')];});_0x2b1d68(_0x2f00a2);})[_0x26ae('0x9')](function(_0x44a7b1){_0x5c1be6(_0x44a7b1);});});}function _0x52e59d(_0x5e55c4,_0x3df191,_0x3e69f0){if(!_0x3df191)return Promise[_0x26ae('0xd')](null);return new Promise(function(_0x2f49f8,_0x3b92d8){return _0x6be649[_0x26ae('0xe')]['findAll']({'where':{'sectionId':_0x3df191['id']},'raw':!![]})[_0x26ae('0xf')](function(_0x41bbe9){if(_0x5e55c4[_0x26ae('0xa')]&&_0x5e55c4['field']!=='id'){_0x3df191['associatedResources']=_['map'](_0x41bbe9,function(_0x1d20ac){return _0x1d20ac[_0x5e55c4[_0x26ae('0xa')]];});}else{if(_0x3e69f0===_0x26ae('0x10')){_0x3df191[_0x26ae('0xb')]=_[_0x26ae('0x8')](_0x41bbe9,function(_0x2f5f19){return{'id':_0x2f5f19[_0x26ae('0x11')],'type':_0x2f5f19[_0x26ae('0x12')]};});}else{_0x3df191[_0x26ae('0xb')]=_[_0x26ae('0x8')](_0x41bbe9,function(_0x31667d){return _0x31667d[_0x26ae('0x11')];});}}_0x2f49f8(_0x3df191);})[_0x26ae('0x9')](function(_0x9f0bb2){_0x3b92d8(_0x9f0bb2);});});}function _0x482b92(_0x16ae2b,_0x342524){var _0x595bd8={'parentSections':[]};switch(_0x16ae2b[_0x26ae('0x13')]()){case _0x26ae('0x14'):_0x595bd8['childModel']=_0x26ae('0x15');break;case _0x26ae('0x16'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x18');break;case _0x26ae('0x19'):_0x595bd8[_0x26ae('0x17')]='SquareRecording';_0x595bd8[_0x26ae('0x1a')]=[{'name':_0x26ae('0x1b'),'field':_0x26ae('0xc'),'foreignKey':_0x26ae('0x1c')}];break;case _0x26ae('0x1d'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x1e');break;case'contacts':_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x1f');_0x595bd8[_0x26ae('0x1a')]=[{'name':_0x26ae('0x20'),'field':'id','foreignKey':_0x26ae('0x21')}];break;case _0x26ae('0x22'):_0x595bd8['childModel']=_0x26ae('0x23');break;case _0x26ae('0x24'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x25');break;case'globalcustomfields':_0x595bd8['childModel']=_0x26ae('0x26');break;case _0x26ae('0x27'):_0x595bd8['childModel']=_0x26ae('0x28');break;case _0x26ae('0x29'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x2a');break;case _0x26ae('0x2b'):_0x595bd8['childModel']=_0x26ae('0x2c');break;case _0x26ae('0x2d'):_0x595bd8['childModel']='FaxAccount';break;case _0x26ae('0x2e'):case _0x26ae('0x2f'):case _0x26ae('0x30'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x31');break;case _0x26ae('0x32'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x33');break;case'voicemails':_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x34');break;case _0x26ae('0x35'):_0x595bd8['childModel']=_0x26ae('0x36');_0x595bd8[_0x26ae('0x1a')]=[{'name':'Agents','field':_0x26ae('0xc'),'foreignKey':_0x26ae('0x37'),'model':_0x26ae('0x38'),'filter':{'field':_0x26ae('0x39'),'value':[_0x26ae('0x3a')]}},{'name':_0x26ae('0x3b'),'field':_0x26ae('0xc'),'foreignKey':'membername','model':_0x26ae('0x38'),'filter':{'field':_0x26ae('0x39'),'value':[_0x26ae('0x3c')]}},{'name':'VoiceQueues','field':_0x26ae('0xc'),'foreignKey':_0x26ae('0x3d'),'model':_0x26ae('0x3e'),'filter':{'field':_0x26ae('0x12'),'value':[_0x26ae('0x3f')]}},{'name':_0x26ae('0x40'),'field':_0x26ae('0xc'),'foreignKey':_0x26ae('0x3d'),'model':_0x26ae('0x3e'),'filter':{'field':_0x26ae('0x12'),'value':['outbound']}}];break;case _0x26ae('0x41'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x42');break;case _0x26ae('0x43'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x44');break;case _0x26ae('0x45'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x46');break;case _0x26ae('0x47'):_0x595bd8['childModel']=_0x26ae('0x48');break;case _0x26ae('0x49'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x4a');break;case'mailaccounts':_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x4b');break;case _0x26ae('0x4c'):_0x595bd8['childModel']=_0x26ae('0x4d');break;case'openchannelqueues':_0x595bd8['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x595bd8['childModel']=_0x26ae('0x4e');break;case _0x26ae('0x4f'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x50');break;case _0x26ae('0x51'):_0x595bd8['childModel']=_0x26ae('0x52');break;case _0x26ae('0x53'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x54');break;case'whatsappaccounts':_0x595bd8['childModel']=_0x26ae('0x55');break;case _0x26ae('0x56'):_0x595bd8[_0x26ae('0x17')]='Team';break;case _0x26ae('0x57'):case _0x26ae('0x58'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x3e');if(_0x342524){_0x595bd8[_0x26ae('0x1a')]=[{'name':'VoiceQueues'},{'name':_0x26ae('0x40')}];}break;case _0x26ae('0x59'):case _0x26ae('0x5a'):case _0x26ae('0x5b'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x38');if(_0x342524){_0x595bd8[_0x26ae('0x1a')]=[{'name':_0x26ae('0x5c'),'filter':{'field':'role','value':[_0x26ae('0x5d'),_0x26ae('0x5e')]},'ignore':!![]},{'name':'Agents'},{'name':_0x26ae('0x3b')}];}break;case _0x26ae('0x5f'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x60');break;case _0x26ae('0x61'):_0x595bd8['childModel']='SalesforceAccount';break;case _0x26ae('0x62'):_0x595bd8[_0x26ae('0x17')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x63');break;case _0x26ae('0x64'):_0x595bd8['childModel']='DeskAccount';break;case'zohoaccounts':_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x65');break;case _0x26ae('0x66'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x38');break;case _0x26ae('0x67'):_0x595bd8['childModel']=_0x26ae('0x68');break;case _0x26ae('0x69'):_0x595bd8['childModel']=_0x26ae('0x6a');break;case _0x26ae('0x6b'):_0x595bd8['childModel']=_0x26ae('0x6c');break;case _0x26ae('0x6d'):_0x595bd8[_0x26ae('0x17')]='Interval';break;case _0x26ae('0x6e'):_0x595bd8[_0x26ae('0x17')]='Pause';break;case _0x26ae('0x6f'):_0x595bd8[_0x26ae('0x17')]='Schedule';break;case _0x26ae('0x70'):_0x595bd8['childModel']=_0x26ae('0x71');break;case _0x26ae('0x72'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x73');break;case _0x26ae('0x74'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x75');break;case'triggers':_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x76');break;case _0x26ae('0x77'):_0x595bd8['childModel']=_0x26ae('0x78');break;case _0x26ae('0x79'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x7a');break;case _0x26ae('0x7b'):_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x7c');break;case'extractedreports':_0x595bd8[_0x26ae('0x17')]='AnalyticExtractedReport';_0x595bd8[_0x26ae('0x1a')]=[{'name':_0x26ae('0x7d'),'field':'id','foreignKey':_0x26ae('0x7e')}];break;case'metrics':_0x595bd8[_0x26ae('0x17')]=_0x26ae('0x7f');break;}return _0x595bd8;}function _0x75d660(_0x192a6a,_0x1a7eaa){var _0x3e42b7=_0x192a6a[_0x26ae('0x80')](0x0)['toUpperCase']()+_0x192a6a[_0x26ae('0x81')](0x1);var _0x3d47b1={'type':_0x6be649[_0x26ae('0x82')][_0x26ae('0x83')]['SELECT'],'raw':!![]};return new Promise(function(_0x3c7d5a,_0x259b2c){var _0x3ebee4=squel[_0x26ae('0x84')]()[_0x26ae('0xa')](_0x26ae('0x85')+_0x3e42b7+'InteractionId','id')['field'](_0x26ae('0x86'))[_0x26ae('0x87')](_0x26ae('0x88')+_0x192a6a+_0x26ae('0x89'),'ui')['where'](_0x26ae('0x8a'),_0x1a7eaa['id']);return _0x6be649[_0x26ae('0x8b')][_0x26ae('0x8c')](_0x3ebee4[_0x26ae('0x8d')](),_0x3d47b1)[_0x26ae('0xf')](function(_0x575b73){_0x1a7eaa[_0x3e42b7+_0x26ae('0x8e')]=_0x575b73;_0x3c7d5a(_0x575b73);})[_0x26ae('0x9')](function(_0x4b667d){_0x259b2c(_0x4b667d);});});}return _0x52fee0[_0x26ae('0x8f')](_0x26ae('0x90'),attributes,{'tableName':_0x26ae('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x205c37){var _0x57aeb9={'raw':_0x205c37[_0x26ae('0x8c')][_0x26ae('0x92')],'where':{}};var _0x29270e={};var _0x53531d={'count':0x0,'rows':[]};var _0x1b00c7=_0x205c37['query'][_0x26ae('0x93')];var _0x5d7930=_0x205c37[_0x26ae('0x8c')]['mergeResources']||![];var _0x98b095=_0x482b92(_0x1b00c7,_0x5d7930);if(!_0x98b095[_0x26ae('0x17')])throw new Error('Invalid\x20section\x20\x27'+_0x1b00c7+'\x27');var _0x1842c3=[{'name':_0x1b00c7}];if(!_[_0x26ae('0x94')](_0x98b095[_0x26ae('0x1a')]))_0x1842c3=_0x98b095[_0x26ae('0x1a')];var _0x57ce6e=[];for(var _0x516094=0x0;_0x516094<_0x1842c3[_0x26ae('0x95')];_0x516094++){_0x57ce6e[_0x26ae('0x96')](_0x6be649[_0x26ae('0x97')][_0x26ae('0x98')]({'where':{'userProfileId':_0x205c37[_0x26ae('0x99')]['id'],'name':_0x1842c3[_0x516094]['name']},'raw':!![]}));}return Promise[_0x26ae('0x9a')](_0x57ce6e)[_0x26ae('0xf')](function(_0x593620){var _0x4e772a=_[_0x26ae('0x5')](_0x593620,function(_0x5c98b6){return _0x5c98b6?_0x5c98b6:undefined;});var _0x1ae434=_[_0x26ae('0x5')](_0x1842c3,[_0x26ae('0x9b'),!![]]);var _0x8e0d0a=_[_0x26ae('0x94')](_0x4e772a)&&_['isEmpty'](_0x1ae434)?null:_[_0x26ae('0x9c')](_0x1ae434,_0x4e772a);if(!_0x8e0d0a)return null;var _0x182afb=[];for(var _0x41e4ad=0x0;_0x41e4ad<_0x8e0d0a[_0x26ae('0x95')];_0x41e4ad++){var _0x110427=_['find'](_0x1842c3,function(_0x2de4f5){return _0x8e0d0a[_0x41e4ad]?_0x2de4f5[_0x26ae('0xc')]===_0x8e0d0a[_0x41e4ad]['name']:null;});if(_0x110427){if(_0x8e0d0a[_0x41e4ad][_0x26ae('0x9b')]){_0x182afb[_0x26ae('0x96')](_0x1d9f2d(_0x98b095[_0x26ae('0x17')],_0x8e0d0a[_0x41e4ad]));}else{if(!_0x8e0d0a[_0x41e4ad][_0x26ae('0x9d')]){_0x182afb[_0x26ae('0x96')](_0x52e59d(_0x110427,_0x8e0d0a[_0x41e4ad],_0x98b095[_0x26ae('0x17')]));}else{if(_0x110427[_0x26ae('0x9e')]){_0x182afb[_0x26ae('0x96')](_0x577827(_0x110427,_0x8e0d0a[_0x41e4ad]));}}}}}return Promise[_0x26ae('0x9a')](_0x182afb);})[_0x26ae('0xf')](function(_0x25f181){var _0x4a197f=_0x25f181;var _0x308328=null;if(_0x4a197f){_0x308328=_0x4a197f[_0x26ae('0x95')]===0x1?_0x4a197f[0x0]:null;}if(!_0x308328&&!_0x4a197f)return _0x53531d;var _0x27f4be=_0x6be649[_0x98b095[_0x26ae('0x17')]][_0x26ae('0x9f')];_0x29270e[_0x26ae('0x9e')]=_[_0x26ae('0xa0')](_0x27f4be);_0x29270e[_0x26ae('0x8c')]=_[_0x26ae('0xa0')](_0x205c37[_0x26ae('0x8c')]);_0x29270e['filters']=_[_0x26ae('0xa1')](_0x29270e[_0x26ae('0x9e')],_0x29270e[_0x26ae('0x8c')]);_0x57aeb9[_0x26ae('0xa2')]=_[_0x26ae('0xa1')](_0x29270e[_0x26ae('0x9e')],qs['fields'](_0x205c37['query']['fields']));_0x57aeb9[_0x26ae('0xa2')]=_0x57aeb9[_0x26ae('0xa2')][_0x26ae('0x95')]?_0x57aeb9[_0x26ae('0xa2')]:_0x29270e[_0x26ae('0x9e')];if(!_0x205c37[_0x26ae('0x8c')][_0x26ae('0xa3')](_0x26ae('0xa4'))){_0x57aeb9['limit']=qs['limit'](_0x205c37[_0x26ae('0x8c')][_0x26ae('0xa5')]);_0x57aeb9[_0x26ae('0xa6')]=qs[_0x26ae('0xa6')](_0x205c37[_0x26ae('0x8c')][_0x26ae('0xa6')]);}_0x57aeb9[_0x26ae('0xa7')]=qs[_0x26ae('0xa8')](_0x205c37[_0x26ae('0x8c')][_0x26ae('0xa8')]);_0x57aeb9[_0x26ae('0xa9')]=qs['filters'](_['pick'](_0x205c37[_0x26ae('0x8c')],_0x29270e[_0x26ae('0xaa')]));if(_0x205c37[_0x26ae('0x8c')]['filter']){_0x57aeb9[_0x26ae('0xa9')]=_[_0x26ae('0xab')](_0x57aeb9[_0x26ae('0xa9')],{'$or':_['map'](_0x27f4be,function(_0x12116a){if(_0x12116a[_0x26ae('0x12')]['key']!==_0x26ae('0xac')){var _0xc40b6d={};_0xc40b6d[_0x12116a[_0x26ae('0xa')]]={'$like':'%'+_0x205c37['query'][_0x26ae('0x5')]+'%'};return _0xc40b6d;}})});}var _0x4c770=[];var _0x2eaa28=null;var _0x452f7={};if(_0x308328){_0x2eaa28=_[_0x26ae('0x98')](_0x1842c3,[_0x26ae('0xc'),_0x308328['name']]);if(_0x2eaa28[_0x26ae('0xa')]){_0x452f7={};if(_0x98b095[_0x26ae('0x17')]===_0x26ae('0x10')){_0x452f7[_0x2eaa28[_0x26ae('0xad')]]=_[_0x26ae('0x8')](_0x308328[_0x26ae('0xb')],'id');}else{_0x452f7[_0x2eaa28[_0x26ae('0xad')]]=_0x308328[_0x26ae('0xb')];}_0x4c770['push'](_0x452f7);}else{_0x57aeb9[_0x26ae('0xa9')]['id']=_0x308328[_0x26ae('0xb')];}}else{for(var _0x2fbe09=0x0;_0x2fbe09<_0x4a197f[_0x26ae('0x95')];_0x2fbe09++){_0x2eaa28=_['find'](_0x1842c3,[_0x26ae('0xc'),_0x4a197f[_0x2fbe09]['name']]);if(_0x2eaa28[_0x26ae('0xa')]){_0x452f7={};_0x452f7[_0x2eaa28[_0x26ae('0xad')]]=_0x4a197f[_0x2fbe09]['associatedResources'];_0x4c770[_0x26ae('0x96')](_0x452f7);}else{if(!_0x57aeb9[_0x26ae('0xa9')]['id'])_0x57aeb9[_0x26ae('0xa9')]['id']=[];_0x4a197f[_0x2fbe09][_0x26ae('0xb')][_0x26ae('0xae')](function(_0x743afd){_0x57aeb9['where']['id']['push'](_0x743afd);});}}}if(!_[_0x26ae('0x94')](_0x4c770)){_0x57aeb9[_0x26ae('0xa9')]=_[_0x26ae('0xab')](_0x57aeb9[_0x26ae('0xa9')],{'$and':{'$or':_0x4c770}});}_0x57aeb9=_['merge']({},_0x57aeb9,_0x205c37['options']);if(_0x308328&&!_0x308328['autoAssociation']&&_0x98b095[_0x26ae('0x17')]==='AnalyticExtractedReport'){if(_0x205c37['query']['includeAll']){_0x57aeb9[_0x26ae('0xaf')]=[{'all':!![]}];}return _0x6be649[_0x98b095[_0x26ae('0x17')]]['findAll'](_0x57aeb9)[_0x26ae('0xf')](function(_0xb51f3b){var _0x1cc888=[];_0xb51f3b[_0x26ae('0xae')](function(_0x55da42){var _0x4ff08c;switch(_0x55da42[_0x26ae('0xb0')]){case'default':_0x4ff08c=_[_0x26ae('0x98')](_0x308328[_0x26ae('0xb')],function(_0x47d633){return _0x47d633['id']===_0x55da42['reportId']&&_0x47d633[_0x26ae('0x12')]===_0x26ae('0xb1');});break;case'custom':_0x4ff08c=_['find'](_0x308328[_0x26ae('0xb')],function(_0x4697eb){return _0x4697eb['id']===_0x55da42[_0x26ae('0x7e')]&&_0x4697eb[_0x26ae('0x12')]==='CustomReports';});break;}if(_0x4ff08c)_0x1cc888[_0x26ae('0x96')](_0x55da42);});_0x53531d[_0x26ae('0xb2')]=_0x1cc888[_0x26ae('0x95')];_0x53531d[_0x26ae('0xb3')]=_0x1cc888;return _0x53531d;});}else{if(!_[_0x26ae('0x94')](_0x205c37['query']['ids'])){_0x57aeb9[_0x26ae('0xa9')]['id']=_0x57aeb9['where']['id']?_[_0x26ae('0xa1')](_0x57aeb9[_0x26ae('0xa9')]['id'],_0x205c37[_0x26ae('0x8c')][_0x26ae('0xb4')]):_0x205c37[_0x26ae('0x8c')][_0x26ae('0xb4')];if(_0x205c37[_0x26ae('0x8c')]['customSorting']){_0x57aeb9[_0x26ae('0xa7')]=_0x205c37['query']['customSorting'];}}if(_0x205c37[_0x26ae('0x8c')]['extraQueryConditions']){_0x57aeb9[_0x26ae('0xa9')]=_['merge'](_0x57aeb9[_0x26ae('0xa9')],{'$and':_0x205c37[_0x26ae('0x8c')]['extraQueryConditions']});}return _0x6be649[_0x98b095[_0x26ae('0x17')]][_0x26ae('0xb2')]({'where':_0x57aeb9[_0x26ae('0xa9')]})[_0x26ae('0xf')](function(_0x24672c){_0x53531d['count']=_0x24672c;if(_0x205c37[_0x26ae('0x8c')][_0x26ae('0xb5')]){if(_0x98b095[_0x26ae('0x17')]===_0x26ae('0x1f')){_0x57aeb9[_0x26ae('0xaf')]=[{'model':_0x6be649[_0x26ae('0x73')],'as':_0x26ae('0xb6'),'attributes':['id',_0x26ae('0xc'),_0x26ae('0xb7')],'required':_0x205c37[_0x26ae('0x8c')][_0x26ae('0xb8')]?!![]:![]},{'model':_0x6be649[_0x26ae('0x73')],'as':_0x26ae('0xb9'),'attributes':['id',_0x26ae('0xc'),_0x26ae('0xb7')],'through':_0x205c37[_0x26ae('0x8c')][_0x26ae('0xb8')]?{'attributes':[],'where':{'TagId':_0x205c37[_0x26ae('0x8c')][_0x26ae('0xb8')]||undefined}}:{},'required':_0x205c37[_0x26ae('0x8c')][_0x26ae('0xb8')]?!![]:![]}];}else{_0x57aeb9[_0x26ae('0xaf')]=[{'all':!![]}];}}return _0x6be649[_0x98b095[_0x26ae('0x17')]][_0x26ae('0x7')](_0x57aeb9);})[_0x26ae('0xf')](function(_0x3389ae){_0x53531d[_0x26ae('0xb3')]=_0x3389ae;if(_0x1b00c7===_0x26ae('0xba')&&_0x205c37[_0x26ae('0x8c')][_0x26ae('0xbb')]===_0x26ae('0xbc')){var _0x33ff5e=[];for(var _0x8241ca=0x0;_0x8241ca<_0x53531d[_0x26ae('0xb3')]['length'];_0x8241ca++){_0x33ff5e['push'](_0x75d660(_0x26ae('0xbd'),_0x53531d['rows'][_0x8241ca][_0x26ae('0xbe')]));_0x33ff5e[_0x26ae('0x96')](_0x75d660(_0x26ae('0xbf'),_0x53531d[_0x26ae('0xb3')][_0x8241ca][_0x26ae('0xbe')]));_0x33ff5e[_0x26ae('0x96')](_0x75d660('fax',_0x53531d[_0x26ae('0xb3')][_0x8241ca][_0x26ae('0xbe')]));_0x33ff5e[_0x26ae('0x96')](_0x75d660(_0x26ae('0xc0'),_0x53531d[_0x26ae('0xb3')][_0x8241ca][_0x26ae('0xbe')]));_0x33ff5e[_0x26ae('0x96')](_0x75d660('openchannel',_0x53531d[_0x26ae('0xb3')][_0x8241ca][_0x26ae('0xbe')]));_0x33ff5e[_0x26ae('0x96')](_0x75d660(_0x26ae('0xc1'),_0x53531d['rows'][_0x8241ca]['dataValues']));}return Promise[_0x26ae('0x9a')](_0x33ff5e)[_0x26ae('0xf')](function(){return _0x53531d;});}return _0x53531d;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 166d78b..33529a1 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 _0xf722=['../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x483658,_0x48b9ac){var _0x395d3f=function(_0x443cd2){while(--_0x443cd2){_0x483658['push'](_0x483658['shift']());}};_0x395d3f(++_0x48b9ac);}(_0xf722,0x18f));var _0x2f72=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf722[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var moment=require(_0x2f72('0x2'));var BPromise=require(_0x2f72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f72('0x4'));var db=require(_0x2f72('0x5'))['db'];var utils=require(_0x2f72('0x6'));var logger=require(_0x2f72('0x7'))('rpc');var config=require(_0x2f72('0x8'));var jayson=require(_0x2f72('0x9'));var client=jayson[_0x2f72('0xa')]['http']({'port':0x232a});config['redis']=_[_0x2f72('0xb')](config[_0x2f72('0xc')],{'host':_0x2f72('0xd'),'port':0x18eb});var socket=require(_0x2f72('0xe'))(new Redis(config[_0x2f72('0xc')]));require(_0x2f72('0xf'))[_0x2f72('0x10')](socket);function respondWithRpcPromise(_0x4305e3,_0x227a77,_0x1c0927){return new BPromise(function(_0x119484,_0x1f4fad){return client[_0x2f72('0x11')](_0x4305e3,_0x1c0927)[_0x2f72('0x12')](function(_0x4f1cb8){logger[_0x2f72('0x13')](_0x2f72('0x14'),_0x227a77,_0x2f72('0x15'));logger[_0x2f72('0x16')](_0x2f72('0x17'),_0x227a77,_0x2f72('0x15'),JSON[_0x2f72('0x18')](_0x4f1cb8));if(_0x4f1cb8['error']){if(_0x4f1cb8['error'][_0x2f72('0x19')]===0x1f4){logger[_0x2f72('0x1a')]('UserProfile,\x20%s,\x20%s',_0x227a77,_0x4f1cb8[_0x2f72('0x1a')][_0x2f72('0x1b')]);return _0x1f4fad(_0x4f1cb8[_0x2f72('0x1a')]['message']);}logger[_0x2f72('0x1a')](_0x2f72('0x14'),_0x227a77,_0x4f1cb8[_0x2f72('0x1a')][_0x2f72('0x1b')]);return _0x119484(_0x4f1cb8[_0x2f72('0x1a')][_0x2f72('0x1b')]);}else{logger[_0x2f72('0x13')](_0x2f72('0x14'),_0x227a77,'request\x20sent');_0x119484(_0x4f1cb8['result'][_0x2f72('0x1b')]);}})[_0x2f72('0x1c')](function(_0x330593){logger[_0x2f72('0x1a')]('UserProfile,\x20%s,\x20%s',_0x227a77,_0x330593);_0x1f4fad(_0x330593);});});} \ No newline at end of file +var _0x471a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','defaults','redis','localhost','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x2e9a38,_0x46ed9e){var _0x4fe581=function(_0x31e4a0){while(--_0x31e4a0){_0x2e9a38['push'](_0x2e9a38['shift']());}};_0x4fe581(++_0x46ed9e);}(_0x471a,0x18d));var _0xa471=function(_0x2b18d8,_0x21778e){_0x2b18d8=_0x2b18d8-0x0;var _0x2bcce2=_0x471a[_0x2b18d8];return _0x2bcce2;};'use strict';var _=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var moment=require(_0xa471('0x2'));var BPromise=require('bluebird');var rs=require(_0xa471('0x3'));var fs=require('fs');var Redis=require(_0xa471('0x4'));var db=require(_0xa471('0x5'))['db'];var utils=require(_0xa471('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa471('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa471('0x8')](config[_0xa471('0x9')],{'host':_0xa471('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa471('0x9')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x13f06e,_0x1b111b,_0x407404){return new BPromise(function(_0x3641a9,_0x55c23a){return client[_0xa471('0xb')](_0x13f06e,_0x407404)[_0xa471('0xc')](function(_0xc9e14f){logger[_0xa471('0xd')](_0xa471('0xe'),_0x1b111b,_0xa471('0xf'));logger['debug'](_0xa471('0x10'),_0x1b111b,'request\x20sent',JSON[_0xa471('0x11')](_0xc9e14f));if(_0xc9e14f['error']){if(_0xc9e14f[_0xa471('0x12')][_0xa471('0x13')]===0x1f4){logger[_0xa471('0x12')](_0xa471('0xe'),_0x1b111b,_0xc9e14f[_0xa471('0x12')][_0xa471('0x14')]);return _0x55c23a(_0xc9e14f['error'][_0xa471('0x14')]);}logger[_0xa471('0x12')](_0xa471('0xe'),_0x1b111b,_0xc9e14f[_0xa471('0x12')][_0xa471('0x14')]);return _0x3641a9(_0xc9e14f['error'][_0xa471('0x14')]);}else{logger[_0xa471('0xd')](_0xa471('0xe'),_0x1b111b,'request\x20sent');_0x3641a9(_0xc9e14f['result'][_0xa471('0x14')]);}})['catch'](function(_0x3ef862){logger['error']('UserProfile,\x20%s,\x20%s',_0x1b111b,_0x3ef862);_0x55c23a(_0x3ef862);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cbd618d..062a2ea 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 _0x6277=['emit','removeListener','save','remove','update'];(function(_0xb0c418,_0x131915){var _0x2e12c4=function(_0x56e378){while(--_0x56e378){_0xb0c418['push'](_0xb0c418['shift']());}};_0x2e12c4(++_0x131915);}(_0x6277,0x12e));var _0x7627=function(_0x588448,_0x2b80a0){_0x588448=_0x588448-0x0;var _0x2ab728=_0x6277[_0x588448];return _0x2ab728;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x7627('0x0'),_0x7627('0x1'),_0x7627('0x2')];function createListener(_0x487e7a,_0x5d1990){return function(_0x2917ac){_0x5d1990[_0x7627('0x3')](_0x487e7a,_0x2917ac);};}function removeListener(_0x2b2fa6,_0x58767d){return function(){UserProfileEvents[_0x7627('0x4')](_0x2b2fa6,_0x58767d);};}exports['register']=function(_0x138688){for(var _0x18d662=0x0,_0x1d721a=events['length'];_0x18d662<_0x1d721a;_0x18d662++){var _0x3bf18d=events[_0x18d662];var _0x1bfde6=createListener('userProfile:'+_0x3bf18d,_0x138688);UserProfileEvents['on'](_0x3bf18d,_0x1bfde6);}}; \ No newline at end of file +var _0xe7a4=['userProfile:','./userProfile.events','save','removeListener','register','length'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe7a4,0x85));var _0x4e7a=function(_0x4b869b,_0xeb2895){_0x4b869b=_0x4b869b-0x0;var _0x4f5ffa=_0xe7a4[_0x4b869b];return _0x4f5ffa;};'use strict';var UserProfileEvents=require(_0x4e7a('0x0'));var events=[_0x4e7a('0x1'),'remove','update'];function createListener(_0x28b990,_0x1bd545){return function(_0x2c00e7){_0x1bd545['emit'](_0x28b990,_0x2c00e7);};}function removeListener(_0x18f0b8,_0xc2e73b){return function(){UserProfileEvents[_0x4e7a('0x2')](_0x18f0b8,_0xc2e73b);};}exports[_0x4e7a('0x3')]=function(_0x1fc318){for(var _0x5368b3=0x0,_0x9d5232=events[_0x4e7a('0x4')];_0x5368b3<_0x9d5232;_0x5368b3++){var _0x1aec76=events[_0x5368b3];var _0x283bc1=createListener(_0x4e7a('0x5')+_0x1aec76,_0x1fc318);UserProfileEvents['on'](_0x1aec76,_0x283bc1);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b7de8ba..71380f2 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 _0xe9e7=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x1c4831,_0x3ff74a){var _0x1e6a6d=function(_0x434896){while(--_0x434896){_0x1c4831['push'](_0x1c4831['shift']());}};_0x1e6a6d(++_0x3ff74a);}(_0xe9e7,0x8d));var _0x7e9e=function(_0x3e3679,_0x3f365d){_0x3e3679=_0x3e3679-0x0;var _0x3205d1=_0xe9e7[_0x3e3679];return _0x3205d1;};'use strict';var multer=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var path=require('path');var timeout=require(_0x7e9e('0x2'));var express=require(_0x7e9e('0x3'));var router=express[_0x7e9e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7e9e('0x5'));var interaction=require(_0x7e9e('0x6'));var config=require('../../config/environment');var controller=require(_0x7e9e('0x7'));router[_0x7e9e('0x8')]('/',auth[_0x7e9e('0x9')](),controller[_0x7e9e('0xa')]);router[_0x7e9e('0x8')](_0x7e9e('0xb'),auth[_0x7e9e('0x9')](),controller[_0x7e9e('0xc')]);router[_0x7e9e('0x8')](_0x7e9e('0xd'),auth[_0x7e9e('0x9')](),controller['show']);router[_0x7e9e('0xe')]('/',auth[_0x7e9e('0x9')](),controller[_0x7e9e('0xf')]);router[_0x7e9e('0x10')](_0x7e9e('0xd'),auth[_0x7e9e('0x9')](),controller[_0x7e9e('0x11')]);router[_0x7e9e('0x12')]('/:id',auth[_0x7e9e('0x9')](),controller[_0x7e9e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2d88=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x2dba14,_0x18bc5d){var _0x4ae4c4=function(_0x4dda2a){while(--_0x4dda2a){_0x2dba14['push'](_0x2dba14['shift']());}};_0x4ae4c4(++_0x18bc5d);}(_0x2d88,0xbd));var _0x82d8=function(_0x586df4,_0x52e881){_0x586df4=_0x586df4-0x0;var _0x554a30=_0x2d88[_0x586df4];return _0x554a30;};'use strict';var multer=require(_0x82d8('0x0'));var util=require(_0x82d8('0x1'));var path=require(_0x82d8('0x2'));var timeout=require(_0x82d8('0x3'));var express=require(_0x82d8('0x4'));var router=express[_0x82d8('0x5')]();var fs_extra=require(_0x82d8('0x6'));var auth=require(_0x82d8('0x7'));var interaction=require(_0x82d8('0x8'));var config=require(_0x82d8('0x9'));var controller=require('./userProfileResource.controller');router[_0x82d8('0xa')]('/',auth[_0x82d8('0xb')](),controller[_0x82d8('0xc')]);router[_0x82d8('0xa')]('/describe',auth[_0x82d8('0xb')](),controller[_0x82d8('0xd')]);router['get'](_0x82d8('0xe'),auth[_0x82d8('0xb')](),controller[_0x82d8('0xf')]);router[_0x82d8('0x10')]('/',auth[_0x82d8('0xb')](),controller[_0x82d8('0x11')]);router[_0x82d8('0x12')](_0x82d8('0xe'),auth[_0x82d8('0xb')](),controller[_0x82d8('0x13')]);router[_0x82d8('0x14')]('/:id',auth[_0x82d8('0xb')](),controller['destroy']);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 4734c76..067d7ff 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 _0xbdc5=['STRING','INTEGER','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbdc5,0x142));var _0x5bdc=function(_0x17650e,_0x3e83b2){_0x17650e=_0x17650e-0x0;var _0x42c290=_0xbdc5[_0x17650e];return _0x42c290;};'use strict';var Sequelize=require(_0x5bdc('0x0'));module[_0x5bdc('0x1')]={'name':{'type':Sequelize[_0x5bdc('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5bdc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5bdc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x92f0=['exports','STRING','sequelize'];(function(_0x26eaf6,_0x22a932){var _0x45baa8=function(_0x2e0229){while(--_0x2e0229){_0x26eaf6['push'](_0x26eaf6['shift']());}};_0x45baa8(++_0x22a932);}(_0x92f0,0x1a3));var _0x092f=function(_0x2c753c,_0x3378e7){_0x2c753c=_0x2c753c-0x0;var _0x23ba20=_0x92f0[_0x2c753c];return _0x23ba20;};'use strict';var Sequelize=require(_0x092f('0x0'));module[_0x092f('0x1')]={'name':{'type':Sequelize[_0x092f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x092f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index ac8966a..0a83b39 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 _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end','error','name','send','index','map','UserProfileResource','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x46fc39,_0x417b1a){var _0x41ee76=function(_0x28c4db){while(--_0x28c4db){_0x46fc39['push'](_0x46fc39['shift']());}};_0x41ee76(++_0x417b1a);}(_0xb016,0x159));var _0x6b01=function(_0x59ddf0,_0xe3b5aa){_0x59ddf0=_0x59ddf0-0x0;var _0x17df7c=_0xb016[_0x59ddf0];return _0x17df7c;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['UserProfileResource'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,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','UserProfileResource','includeAll','rows','catch','show'];(function(_0x1a33b0,_0x5602ab){var _0x90bdfd=function(_0x23fc13){while(--_0x23fc13){_0x1a33b0['push'](_0x1a33b0['shift']());}};_0x90bdfd(++_0x5602ab);}(_0x0295,0x1f0));var _0x5029=function(_0x4f15d2,_0x4d719a){_0x4f15d2=_0x4f15d2-0x0;var _0x55be7a=_0x0295[_0x4f15d2];return _0x55be7a;};'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['UserProfileResource'][_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['UserProfileResource'][_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));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 570ab0b..6067b86 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 _0xb033=['rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0xb033,0x1b8));var _0x3b03=function(_0x2b86fc,_0x1b1c07){_0x2b86fc=_0x2b86fc-0x0;var _0x1ee369=_0xb033[_0x2b86fc];return _0x1ee369;};'use strict';var _=require(_0x3b03('0x0'));var util=require(_0x3b03('0x1'));var logger=require(_0x3b03('0x2'))(_0x3b03('0x3'));var moment=require(_0x3b03('0x4'));var BPromise=require(_0x3b03('0x5'));var rp=require(_0x3b03('0x6'));var fs=require('fs');var path=require(_0x3b03('0x7'));var rimraf=require(_0x3b03('0x8'));var config=require(_0x3b03('0x9'));var attributes=require(_0x3b03('0xa'));module[_0x3b03('0xb')]=function(_0x5c590a,_0x916555){return _0x5c590a['define'](_0x3b03('0xc'),attributes,{'tableName':_0x3b03('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x3b03('0xe'),_0x3b03('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8323=['sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','resourceId'];(function(_0x3ece75,_0x7561af){var _0x4c8af8=function(_0x21e0d7){while(--_0x21e0d7){_0x3ece75['push'](_0x3ece75['shift']());}};_0x4c8af8(++_0x7561af);}(_0x8323,0x181));var _0x3832=function(_0x4b2778,_0x2517d1){_0x4b2778=_0x4b2778-0x0;var _0x386d08=_0x8323[_0x4b2778];return _0x386d08;};'use strict';var _=require(_0x3832('0x0'));var util=require(_0x3832('0x1'));var logger=require(_0x3832('0x2'))(_0x3832('0x3'));var moment=require(_0x3832('0x4'));var BPromise=require(_0x3832('0x5'));var rp=require(_0x3832('0x6'));var fs=require('fs');var path=require(_0x3832('0x7'));var rimraf=require(_0x3832('0x8'));var config=require(_0x3832('0x9'));var attributes=require(_0x3832('0xa'));module[_0x3832('0xb')]=function(_0x575232,_0x46c294){return _0x575232['define'](_0x3832('0xc'),attributes,{'tableName':_0x3832('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x3832('0xe'),_0x3832('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4f96bc5..57f9650 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 _0x1eea=['UserProfileResource,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x1eea,0x1ef));var _0xa1ee=function(_0x2793d0,_0x5e118f){_0x2793d0=_0x2793d0-0x0;var _0x28a507=_0x1eea[_0x2793d0];return _0x28a507;};'use strict';var _=require(_0xa1ee('0x0'));var util=require('util');var moment=require(_0xa1ee('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1ee('0x2'))['db'];var utils=require(_0xa1ee('0x3'));var logger=require(_0xa1ee('0x4'))('rpc');var config=require(_0xa1ee('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa1ee('0x6')][_0xa1ee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ec3ed,_0x43a748,_0x4b3525){return new BPromise(function(_0x4386fe,_0x1b507c){return client[_0xa1ee('0x8')](_0x5ec3ed,_0x4b3525)['then'](function(_0x3e6320){logger['info'](_0xa1ee('0x9'),_0x43a748,'request\x20sent');logger[_0xa1ee('0xa')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x43a748,'request\x20sent',JSON[_0xa1ee('0xb')](_0x3e6320));if(_0x3e6320[_0xa1ee('0xc')]){if(_0x3e6320[_0xa1ee('0xc')][_0xa1ee('0xd')]===0x1f4){logger[_0xa1ee('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x43a748,_0x3e6320['error'][_0xa1ee('0xe')]);return _0x1b507c(_0x3e6320[_0xa1ee('0xc')][_0xa1ee('0xe')]);}logger[_0xa1ee('0xc')](_0xa1ee('0x9'),_0x43a748,_0x3e6320[_0xa1ee('0xc')][_0xa1ee('0xe')]);return _0x4386fe(_0x3e6320['error'][_0xa1ee('0xe')]);}else{logger[_0xa1ee('0xf')](_0xa1ee('0x9'),_0x43a748,_0xa1ee('0x10'));_0x4386fe(_0x3e6320[_0xa1ee('0x11')][_0xa1ee('0xe')]);}})['catch'](function(_0x1ca6a5){logger[_0xa1ee('0xc')](_0xa1ee('0x9'),_0x43a748,_0x1ca6a5);_0x1b507c(_0x1ca6a5);});});} \ No newline at end of file +var _0xecc6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserProfileResource,\x20%s,\x20%s','result'];(function(_0x2fd02e,_0x8ebcc5){var _0x4d7f54=function(_0x1437c0){while(--_0x1437c0){_0x2fd02e['push'](_0x2fd02e['shift']());}};_0x4d7f54(++_0x8ebcc5);}(_0xecc6,0x199));var _0x6ecc=function(_0x4ed2da,_0x14f80c){_0x4ed2da=_0x4ed2da-0x0;var _0x16596c=_0xecc6[_0x4ed2da];return _0x16596c;};'use strict';var _=require(_0x6ecc('0x0'));var util=require(_0x6ecc('0x1'));var moment=require(_0x6ecc('0x2'));var BPromise=require(_0x6ecc('0x3'));var rs=require(_0x6ecc('0x4'));var fs=require('fs');var Redis=require(_0x6ecc('0x5'));var db=require(_0x6ecc('0x6'))['db'];var utils=require(_0x6ecc('0x7'));var logger=require(_0x6ecc('0x8'))(_0x6ecc('0x9'));var config=require('../../config/environment');var jayson=require(_0x6ecc('0xa'));var client=jayson[_0x6ecc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a34b9,_0x39ef9e,_0x5d19b8){return new BPromise(function(_0x1954c7,_0x4eeeb7){return client[_0x6ecc('0xc')](_0x5a34b9,_0x5d19b8)[_0x6ecc('0xd')](function(_0x20ab99){logger[_0x6ecc('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x39ef9e,'request\x20sent');logger[_0x6ecc('0xf')](_0x6ecc('0x10'),_0x39ef9e,_0x6ecc('0x11'),JSON[_0x6ecc('0x12')](_0x20ab99));if(_0x20ab99[_0x6ecc('0x13')]){if(_0x20ab99['error']['code']===0x1f4){logger[_0x6ecc('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x39ef9e,_0x20ab99[_0x6ecc('0x13')]['message']);return _0x4eeeb7(_0x20ab99[_0x6ecc('0x13')][_0x6ecc('0x14')]);}logger['error'](_0x6ecc('0x15'),_0x39ef9e,_0x20ab99[_0x6ecc('0x13')]['message']);return _0x1954c7(_0x20ab99[_0x6ecc('0x13')][_0x6ecc('0x14')]);}else{logger['info'](_0x6ecc('0x15'),_0x39ef9e,'request\x20sent');_0x1954c7(_0x20ab99[_0x6ecc('0x16')][_0x6ecc('0x14')]);}})[_0x6ecc('0x17')](function(_0xa5b48f){logger[_0x6ecc('0x13')](_0x6ecc('0x15'),_0x39ef9e,_0xa5b48f);_0x4eeeb7(_0xa5b48f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c2e8a46..942c496 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 _0xe30b=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xe30b,0x105));var _0xbe30=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xe30b[_0x72a33d];return _0x2621d5;};'use strict';var multer=require(_0xbe30('0x0'));var util=require('util');var path=require(_0xbe30('0x1'));var timeout=require(_0xbe30('0x2'));var express=require(_0xbe30('0x3'));var router=express[_0xbe30('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe30('0x5'));var controller=require(_0xbe30('0x6'));router[_0xbe30('0x7')]('/',auth[_0xbe30('0x8')](),controller[_0xbe30('0x9')]);router[_0xbe30('0x7')](_0xbe30('0xa'),auth[_0xbe30('0x8')](),controller[_0xbe30('0xb')]);router[_0xbe30('0x7')](_0xbe30('0xc'),auth[_0xbe30('0x8')](),controller[_0xbe30('0xd')]);router[_0xbe30('0xe')]('/',auth[_0xbe30('0x8')](),controller[_0xbe30('0xf')]);router[_0xbe30('0x10')]('/:id',auth[_0xbe30('0x8')](),controller[_0xbe30('0x11')]);router[_0xbe30('0x12')](_0xbe30('0xc'),auth['isAuthenticated'](),controller[_0xbe30('0x13')]);module[_0xbe30('0x14')]=router; \ No newline at end of file +var _0x8827=['fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x216b17,_0x30c7f8){var _0x472b25=function(_0x368761){while(--_0x368761){_0x216b17['push'](_0x216b17['shift']());}};_0x472b25(++_0x30c7f8);}(_0x8827,0x19f));var _0x7882=function(_0x583760,_0x4c20f5){_0x583760=_0x583760-0x0;var _0xcaff3=_0x8827[_0x583760];return _0xcaff3;};'use strict';var multer=require(_0x7882('0x0'));var util=require(_0x7882('0x1'));var path=require('path');var timeout=require(_0x7882('0x2'));var express=require(_0x7882('0x3'));var router=express[_0x7882('0x4')]();var fs_extra=require(_0x7882('0x5'));var auth=require(_0x7882('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7882('0x7'));var controller=require(_0x7882('0x8'));router[_0x7882('0x9')]('/',auth[_0x7882('0xa')](),controller[_0x7882('0xb')]);router[_0x7882('0x9')](_0x7882('0xc'),auth['isAuthenticated'](),controller[_0x7882('0xd')]);router[_0x7882('0x9')](_0x7882('0xe'),auth[_0x7882('0xa')](),controller['show']);router['post']('/',auth[_0x7882('0xa')](),controller[_0x7882('0xf')]);router['put'](_0x7882('0xe'),auth['isAuthenticated'](),controller[_0x7882('0x10')]);router[_0x7882('0x11')](_0x7882('0xe'),auth[_0x7882('0xa')](),controller[_0x7882('0x12')]);module[_0x7882('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 199ec7a..3b3ca84 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 _0x4483=['BOOLEAN','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x4059a9,_0x4a82e1){var _0x179815=function(_0x67ddde){while(--_0x67ddde){_0x4059a9['push'](_0x4059a9['shift']());}};_0x179815(++_0x4a82e1);}(_0x4483,0x1a3));var _0x3448=function(_0x1020c2,_0x210eec){_0x1020c2=_0x1020c2-0x0;var _0x46e411=_0x4483[_0x1020c2];return _0x46e411;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'name':{'type':Sequelize[_0x3448('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3448('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3448('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3448('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3448('0x2')],'set':function(_0xef1a93){this['setDataValue'](_0x3448('0x5'),_0xef1a93?_0xef1a93[_0x3448('0x6')](''):[]);},'get':function(){return this[_0x3448('0x7')](_0x3448('0x5'))?this[_0x3448('0x7')](_0x3448('0x5'))[_0x3448('0x8')](''):[];}}}; \ No newline at end of file +var _0x8f4c=['setDataValue','join','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x292cc5,_0xda75ca){var _0x3f8ac9=function(_0x42bb2a){while(--_0x42bb2a){_0x292cc5['push'](_0x292cc5['shift']());}};_0x3f8ac9(++_0xda75ca);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3ebbcd,_0x1afc61){_0x3ebbcd=_0x3ebbcd-0x0;var _0x210c43=_0x8f4c[_0x3ebbcd];return _0x210c43;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc8f4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc8f4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc8f4('0x2')],'set':function(_0x47350d){this[_0xc8f4('0x5')]('crudPermissions',_0x47350d?_0x47350d[_0xc8f4('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xc8f4('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 4b75aaa..8e6874f 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 _0xfb13=['../../config/license/util','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5067f8,_0x499165){var _0x15473b=function(_0x51d149){while(--_0x51d149){_0x5067f8['push'](_0x5067f8['shift']());}};_0x15473b(++_0x499165);}(_0xfb13,0x7d));var _0x3fb1=function(_0x4c147c,_0x132c49){_0x4c147c=_0x4c147c-0x0;var _0x5e8bc0=_0xfb13[_0x4c147c];return _0x5e8bc0;};'use strict';var emlformat=require(_0x3fb1('0x0'));var rimraf=require(_0x3fb1('0x1'));var zipdir=require(_0x3fb1('0x2'));var jsonpatch=require(_0x3fb1('0x3'));var rp=require('request-promise');var moment=require(_0x3fb1('0x4'));var BPromise=require(_0x3fb1('0x5'));var Mustache=require(_0x3fb1('0x6'));var util=require(_0x3fb1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3fb1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fb1('0x9'));var squel=require(_0x3fb1('0xa'));var crypto=require(_0x3fb1('0xb'));var jsforce=require(_0x3fb1('0xc'));var deskjs=require(_0x3fb1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3fb1('0xe'));var Papa=require(_0x3fb1('0xf'));var Redis=require(_0x3fb1('0x10'));var authService=require(_0x3fb1('0x11'));var qs=require(_0x3fb1('0x12'));var as=require(_0x3fb1('0x13'));var hardwareService=require(_0x3fb1('0x14'));var logger=require(_0x3fb1('0x15'))(_0x3fb1('0x16'));var utils=require(_0x3fb1('0x17'));var config=require(_0x3fb1('0x18'));var licenseUtil=require(_0x3fb1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x512ae1,_0x1fb4a0){_0x1fb4a0=_0x1fb4a0||0xcc;return function(_0x3280e9){if(_0x3280e9){return _0x512ae1['sendStatus'](_0x1fb4a0);}return _0x512ae1['status'](_0x1fb4a0)[_0x3fb1('0x1a')]();};}function respondWithResult(_0x4c17fc,_0x4141df){_0x4141df=_0x4141df||0xc8;return function(_0x4c8e80){if(_0x4c8e80){return _0x4c17fc[_0x3fb1('0x1b')](_0x4141df)['json'](_0x4c8e80);}};}function respondWithFilteredResult(_0x1d6133,_0x4a2d9e){return function(_0x50f326){if(_0x50f326){var _0x14e876=typeof _0x4a2d9e['offset']===_0x3fb1('0x1c')&&typeof _0x4a2d9e['limit']==='undefined';var _0x1fa92e=_0x50f326[_0x3fb1('0x1d')];var _0x507c2f=_0x14e876?0x0:_0x4a2d9e[_0x3fb1('0x1e')];var _0x3569c5=_0x14e876?_0x50f326['count']:_0x4a2d9e[_0x3fb1('0x1e')]+_0x4a2d9e[_0x3fb1('0x1f')];var _0x4749d1;if(_0x3569c5>=_0x1fa92e){_0x3569c5=_0x1fa92e;_0x4749d1=0xc8;}else{_0x4749d1=0xce;}_0x1d6133[_0x3fb1('0x1b')](_0x4749d1);return _0x1d6133[_0x3fb1('0x20')](_0x3fb1('0x21'),_0x507c2f+'-'+_0x3569c5+'/'+_0x1fa92e)[_0x3fb1('0x22')](_0x50f326);}return null;};}function patchUpdates(_0x173a66){return function(_0xf213e2){try{jsonpatch[_0x3fb1('0x23')](_0xf213e2,_0x173a66,!![]);}catch(_0x4905e9){return BPromise[_0x3fb1('0x24')](_0x4905e9);}return _0xf213e2[_0x3fb1('0x25')]();};}function saveUpdates(_0x3ec7fc,_0xc13b0e){return function(_0x5d186f){if(_0x5d186f){return _0x5d186f[_0x3fb1('0x26')](_0x3ec7fc)[_0x3fb1('0x27')](function(_0x520f7d){return _0x520f7d;});}return null;};}function removeEntity(_0x1d12d4,_0x95a583){return function(_0x1fe9a8){if(_0x1fe9a8){return _0x1fe9a8[_0x3fb1('0x28')]()['then'](function(){_0x1d12d4[_0x3fb1('0x1b')](0xcc)[_0x3fb1('0x1a')]();});}};}function handleEntityNotFound(_0x155526,_0x570872){return function(_0x402157){if(!_0x402157){_0x155526[_0x3fb1('0x29')](0x194);}return _0x402157;};}function handleError(_0x46a58e,_0x5a2ae4){_0x5a2ae4=_0x5a2ae4||0x1f4;return function(_0x2d389d){logger['error'](_0x2d389d[_0x3fb1('0x2a')]);if(_0x2d389d[_0x3fb1('0x2b')]){delete _0x2d389d[_0x3fb1('0x2b')];}_0x46a58e[_0x3fb1('0x1b')](_0x5a2ae4)['send'](_0x2d389d);};}exports[_0x3fb1('0x2c')]=function(_0x371c76,_0x4f15f7){var _0x5c0b19={},_0x22814a={},_0x83e624={'count':0x0,'rows':[]};var _0x30dbc8=_[_0x3fb1('0x2d')](db[_0x3fb1('0x2e')][_0x3fb1('0x2f')],function(_0x53fef6){return{'name':_0x53fef6[_0x3fb1('0x30')],'type':_0x53fef6[_0x3fb1('0x31')]['key']};});_0x22814a[_0x3fb1('0x32')]=_[_0x3fb1('0x2d')](_0x30dbc8,'name');_0x22814a[_0x3fb1('0x33')]=_[_0x3fb1('0x34')](_0x371c76[_0x3fb1('0x33')]);_0x22814a[_0x3fb1('0x35')]=_['intersection'](_0x22814a['model'],_0x22814a[_0x3fb1('0x33')]);_0x5c0b19[_0x3fb1('0x36')]=_['intersection'](_0x22814a[_0x3fb1('0x32')],qs[_0x3fb1('0x37')](_0x371c76[_0x3fb1('0x33')][_0x3fb1('0x37')]));_0x5c0b19[_0x3fb1('0x36')]=_0x5c0b19[_0x3fb1('0x36')][_0x3fb1('0x38')]?_0x5c0b19[_0x3fb1('0x36')]:_0x22814a[_0x3fb1('0x32')];if(!_0x371c76[_0x3fb1('0x33')][_0x3fb1('0x39')]('nolimit')){_0x5c0b19[_0x3fb1('0x1f')]=qs[_0x3fb1('0x1f')](_0x371c76[_0x3fb1('0x33')]['limit']);_0x5c0b19[_0x3fb1('0x1e')]=qs[_0x3fb1('0x1e')](_0x371c76[_0x3fb1('0x33')][_0x3fb1('0x1e')]);}_0x5c0b19['order']=qs[_0x3fb1('0x3a')](_0x371c76['query'][_0x3fb1('0x3a')]);_0x5c0b19['where']=qs[_0x3fb1('0x35')](_[_0x3fb1('0x3b')](_0x371c76[_0x3fb1('0x33')],_0x22814a[_0x3fb1('0x35')]),_0x30dbc8);if(_0x371c76[_0x3fb1('0x33')][_0x3fb1('0x3c')]){_0x5c0b19[_0x3fb1('0x3d')]=_['merge'](_0x5c0b19[_0x3fb1('0x3d')],{'$or':_[_0x3fb1('0x2d')](_0x30dbc8,function(_0x2c945c){if(_0x2c945c[_0x3fb1('0x31')]!=='VIRTUAL'){var _0x187ecb={};_0x187ecb[_0x2c945c[_0x3fb1('0x2b')]]={'$like':'%'+_0x371c76['query'][_0x3fb1('0x3c')]+'%'};return _0x187ecb;}})});}_0x5c0b19=_[_0x3fb1('0x3e')]({},_0x5c0b19,_0x371c76[_0x3fb1('0x3f')]);var _0x3fff4b={'where':_0x5c0b19[_0x3fb1('0x3d')]};return db[_0x3fb1('0x2e')][_0x3fb1('0x1d')](_0x3fff4b)[_0x3fb1('0x27')](function(_0x4da5e4){_0x83e624[_0x3fb1('0x1d')]=_0x4da5e4;if(_0x371c76['query'][_0x3fb1('0x40')]){_0x5c0b19[_0x3fb1('0x41')]=[{'all':!![]}];}return db[_0x3fb1('0x2e')][_0x3fb1('0x42')](_0x5c0b19);})['then'](function(_0x3b4fb0){_0x83e624['rows']=_0x3b4fb0;return _0x83e624;})['then'](respondWithFilteredResult(_0x4f15f7,_0x5c0b19))[_0x3fb1('0x43')](handleError(_0x4f15f7,null));};exports[_0x3fb1('0x44')]=function(_0x55f185,_0x54b00d){var _0x24644f={'raw':![],'where':{'id':_0x55f185[_0x3fb1('0x45')]['id']}},_0x1159a0={};_0x1159a0[_0x3fb1('0x32')]=_[_0x3fb1('0x34')](db[_0x3fb1('0x2e')][_0x3fb1('0x2f')]);_0x1159a0[_0x3fb1('0x33')]=_[_0x3fb1('0x34')](_0x55f185[_0x3fb1('0x33')]);_0x1159a0[_0x3fb1('0x35')]=_[_0x3fb1('0x46')](_0x1159a0[_0x3fb1('0x32')],_0x1159a0[_0x3fb1('0x33')]);_0x24644f[_0x3fb1('0x36')]=_['intersection'](_0x1159a0['model'],qs[_0x3fb1('0x37')](_0x55f185[_0x3fb1('0x33')][_0x3fb1('0x37')]));_0x24644f[_0x3fb1('0x36')]=_0x24644f[_0x3fb1('0x36')][_0x3fb1('0x38')]?_0x24644f[_0x3fb1('0x36')]:_0x1159a0[_0x3fb1('0x32')];if(_0x55f185['query'][_0x3fb1('0x40')]){_0x24644f[_0x3fb1('0x41')]=[{'all':!![]}];}_0x24644f=_['merge']({},_0x24644f,_0x55f185[_0x3fb1('0x3f')]);return db[_0x3fb1('0x2e')][_0x3fb1('0x47')](_0x24644f)['then'](handleEntityNotFound(_0x54b00d,null))[_0x3fb1('0x27')](respondWithResult(_0x54b00d,null))['catch'](handleError(_0x54b00d,null));};exports[_0x3fb1('0x48')]=function(_0x2b7257,_0x4d5f20){return db[_0x3fb1('0x2e')]['create'](_0x2b7257[_0x3fb1('0x49')],{})['then'](respondWithResult(_0x4d5f20,0xc9))[_0x3fb1('0x43')](handleError(_0x4d5f20,null));};exports[_0x3fb1('0x26')]=function(_0x4af687,_0x3ab083){if(_0x4af687[_0x3fb1('0x49')]['id']){delete _0x4af687[_0x3fb1('0x49')]['id'];}return db[_0x3fb1('0x2e')][_0x3fb1('0x47')]({'where':{'id':_0x4af687[_0x3fb1('0x45')]['id']}})[_0x3fb1('0x27')](handleEntityNotFound(_0x3ab083,null))[_0x3fb1('0x27')](saveUpdates(_0x4af687[_0x3fb1('0x49')],null))[_0x3fb1('0x27')](respondWithResult(_0x3ab083,null))['catch'](handleError(_0x3ab083,null));};exports[_0x3fb1('0x28')]=function(_0x588a9f,_0xaaf4d8){return db[_0x3fb1('0x2e')][_0x3fb1('0x47')]({'where':{'id':_0x588a9f[_0x3fb1('0x45')]['id']}})['then'](handleEntityNotFound(_0xaaf4d8,null))[_0x3fb1('0x27')](removeEntity(_0xaaf4d8,null))['catch'](handleError(_0xaaf4d8,null));};exports[_0x3fb1('0x4a')]=function(_0x169372,_0x52034b){return db[_0x3fb1('0x2e')][_0x3fb1('0x4a')]()[_0x3fb1('0x27')](respondWithResult(_0x52034b,null))['catch'](handleError(_0x52034b,null));}; \ No newline at end of file +var _0x20de=['show','params','model','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','UserProfileSection','includeAll','include','findAll','rows','catch'];(function(_0x36cf3c,_0x317ae3){var _0x2a2c00=function(_0x4e554f){while(--_0x4e554f){_0x36cf3c['push'](_0x36cf3c['shift']());}};_0x2a2c00(++_0x317ae3);}(_0x20de,0x11f));var _0xe20d=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x20de[_0x31ced5];return _0x10d9e5;};'use strict';var emlformat=require(_0xe20d('0x0'));var rimraf=require(_0xe20d('0x1'));var zipdir=require(_0xe20d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe20d('0x3'));var moment=require(_0xe20d('0x4'));var BPromise=require(_0xe20d('0x5'));var Mustache=require(_0xe20d('0x6'));var util=require(_0xe20d('0x7'));var path=require(_0xe20d('0x8'));var sox=require(_0xe20d('0x9'));var csv=require(_0xe20d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe20d('0xb'));var jsforce=require(_0xe20d('0xc'));var deskjs=require(_0xe20d('0xd'));var toCsv=require(_0xe20d('0xa'));var querystring=require('querystring');var Papa=require(_0xe20d('0xe'));var Redis=require(_0xe20d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe20d('0x10'));var hardwareService=require(_0xe20d('0x11'));var logger=require(_0xe20d('0x12'))('api');var utils=require(_0xe20d('0x13'));var config=require(_0xe20d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe20d('0x15'))['db'];function respondWithStatusCode(_0x302e8f,_0x2ce382){_0x2ce382=_0x2ce382||0xcc;return function(_0x996bb4){if(_0x996bb4){return _0x302e8f[_0xe20d('0x16')](_0x2ce382);}return _0x302e8f['status'](_0x2ce382)[_0xe20d('0x17')]();};}function respondWithResult(_0x3998f2,_0x49c6ea){_0x49c6ea=_0x49c6ea||0xc8;return function(_0x1011da){if(_0x1011da){return _0x3998f2[_0xe20d('0x18')](_0x49c6ea)['json'](_0x1011da);}};}function respondWithFilteredResult(_0x1cdd08,_0x3ae14a){return function(_0x264de9){if(_0x264de9){var _0x209e61=typeof _0x3ae14a[_0xe20d('0x19')]===_0xe20d('0x1a')&&typeof _0x3ae14a[_0xe20d('0x1b')]===_0xe20d('0x1a');var _0x1e639b=_0x264de9[_0xe20d('0x1c')];var _0x2e2ee9=_0x209e61?0x0:_0x3ae14a['offset'];var _0x5e2ba1=_0x209e61?_0x264de9['count']:_0x3ae14a[_0xe20d('0x19')]+_0x3ae14a['limit'];var _0x4a58d6;if(_0x5e2ba1>=_0x1e639b){_0x5e2ba1=_0x1e639b;_0x4a58d6=0xc8;}else{_0x4a58d6=0xce;}_0x1cdd08[_0xe20d('0x18')](_0x4a58d6);return _0x1cdd08[_0xe20d('0x1d')](_0xe20d('0x1e'),_0x2e2ee9+'-'+_0x5e2ba1+'/'+_0x1e639b)['json'](_0x264de9);}return null;};}function patchUpdates(_0x32ba32){return function(_0x2b201d){try{jsonpatch[_0xe20d('0x1f')](_0x2b201d,_0x32ba32,!![]);}catch(_0x4727a){return BPromise[_0xe20d('0x20')](_0x4727a);}return _0x2b201d['save']();};}function saveUpdates(_0x1d40a4,_0x47ea24){return function(_0x3060bf){if(_0x3060bf){return _0x3060bf[_0xe20d('0x21')](_0x1d40a4)[_0xe20d('0x22')](function(_0x47c7e6){return _0x47c7e6;});}return null;};}function removeEntity(_0x21d296,_0x500ba6){return function(_0x35a68a){if(_0x35a68a){return _0x35a68a[_0xe20d('0x23')]()['then'](function(){_0x21d296[_0xe20d('0x18')](0xcc)[_0xe20d('0x17')]();});}};}function handleEntityNotFound(_0x31d280,_0x414445){return function(_0x41187a){if(!_0x41187a){_0x31d280[_0xe20d('0x16')](0x194);}return _0x41187a;};}function handleError(_0x232761,_0x147056){_0x147056=_0x147056||0x1f4;return function(_0x147e88){logger['error'](_0x147e88['stack']);if(_0x147e88[_0xe20d('0x24')]){delete _0x147e88['name'];}_0x232761[_0xe20d('0x18')](_0x147056)[_0xe20d('0x25')](_0x147e88);};}exports['index']=function(_0x4f6e65,_0x5cc4ac){var _0x5035ba={},_0x593af2={},_0xfe0e7a={'count':0x0,'rows':[]};var _0x354e66=_[_0xe20d('0x26')](db['UserProfileSection'][_0xe20d('0x27')],function(_0x342fe3){return{'name':_0x342fe3[_0xe20d('0x28')],'type':_0x342fe3[_0xe20d('0x29')][_0xe20d('0x2a')]};});_0x593af2['model']=_[_0xe20d('0x26')](_0x354e66,'name');_0x593af2[_0xe20d('0x2b')]=_[_0xe20d('0x2c')](_0x4f6e65[_0xe20d('0x2b')]);_0x593af2['filters']=_[_0xe20d('0x2d')](_0x593af2['model'],_0x593af2[_0xe20d('0x2b')]);_0x5035ba[_0xe20d('0x2e')]=_[_0xe20d('0x2d')](_0x593af2['model'],qs['fields'](_0x4f6e65['query'][_0xe20d('0x2f')]));_0x5035ba['attributes']=_0x5035ba[_0xe20d('0x2e')][_0xe20d('0x30')]?_0x5035ba[_0xe20d('0x2e')]:_0x593af2['model'];if(!_0x4f6e65['query']['hasOwnProperty'](_0xe20d('0x31'))){_0x5035ba[_0xe20d('0x1b')]=qs['limit'](_0x4f6e65[_0xe20d('0x2b')][_0xe20d('0x1b')]);_0x5035ba[_0xe20d('0x19')]=qs[_0xe20d('0x19')](_0x4f6e65[_0xe20d('0x2b')]['offset']);}_0x5035ba['order']=qs[_0xe20d('0x32')](_0x4f6e65['query'][_0xe20d('0x32')]);_0x5035ba['where']=qs[_0xe20d('0x33')](_[_0xe20d('0x34')](_0x4f6e65['query'],_0x593af2[_0xe20d('0x33')]),_0x354e66);if(_0x4f6e65[_0xe20d('0x2b')]['filter']){_0x5035ba[_0xe20d('0x35')]=_[_0xe20d('0x36')](_0x5035ba['where'],{'$or':_[_0xe20d('0x26')](_0x354e66,function(_0x10804d){if(_0x10804d[_0xe20d('0x29')]!==_0xe20d('0x37')){var _0x3ec822={};_0x3ec822[_0x10804d[_0xe20d('0x24')]]={'$like':'%'+_0x4f6e65[_0xe20d('0x2b')][_0xe20d('0x38')]+'%'};return _0x3ec822;}})});}_0x5035ba=_[_0xe20d('0x36')]({},_0x5035ba,_0x4f6e65['options']);var _0x27a9d2={'where':_0x5035ba[_0xe20d('0x35')]};return db[_0xe20d('0x39')][_0xe20d('0x1c')](_0x27a9d2)[_0xe20d('0x22')](function(_0x1a4fbc){_0xfe0e7a[_0xe20d('0x1c')]=_0x1a4fbc;if(_0x4f6e65['query'][_0xe20d('0x3a')]){_0x5035ba[_0xe20d('0x3b')]=[{'all':!![]}];}return db['UserProfileSection'][_0xe20d('0x3c')](_0x5035ba);})['then'](function(_0xbcfdc5){_0xfe0e7a[_0xe20d('0x3d')]=_0xbcfdc5;return _0xfe0e7a;})[_0xe20d('0x22')](respondWithFilteredResult(_0x5cc4ac,_0x5035ba))[_0xe20d('0x3e')](handleError(_0x5cc4ac,null));};exports[_0xe20d('0x3f')]=function(_0x4c390a,_0x5e55c5){var _0x4d5f96={'raw':![],'where':{'id':_0x4c390a[_0xe20d('0x40')]['id']}},_0x317a44={};_0x317a44['model']=_[_0xe20d('0x2c')](db[_0xe20d('0x39')]['rawAttributes']);_0x317a44[_0xe20d('0x2b')]=_[_0xe20d('0x2c')](_0x4c390a[_0xe20d('0x2b')]);_0x317a44['filters']=_[_0xe20d('0x2d')](_0x317a44[_0xe20d('0x41')],_0x317a44[_0xe20d('0x2b')]);_0x4d5f96[_0xe20d('0x2e')]=_[_0xe20d('0x2d')](_0x317a44[_0xe20d('0x41')],qs['fields'](_0x4c390a[_0xe20d('0x2b')][_0xe20d('0x2f')]));_0x4d5f96[_0xe20d('0x2e')]=_0x4d5f96[_0xe20d('0x2e')][_0xe20d('0x30')]?_0x4d5f96[_0xe20d('0x2e')]:_0x317a44[_0xe20d('0x41')];if(_0x4c390a['query']['includeAll']){_0x4d5f96[_0xe20d('0x3b')]=[{'all':!![]}];}_0x4d5f96=_[_0xe20d('0x36')]({},_0x4d5f96,_0x4c390a[_0xe20d('0x42')]);return db['UserProfileSection'][_0xe20d('0x43')](_0x4d5f96)['then'](handleEntityNotFound(_0x5e55c5,null))[_0xe20d('0x22')](respondWithResult(_0x5e55c5,null))[_0xe20d('0x3e')](handleError(_0x5e55c5,null));};exports[_0xe20d('0x44')]=function(_0x23460a,_0x3fee87){return db['UserProfileSection'][_0xe20d('0x44')](_0x23460a[_0xe20d('0x45')],{})[_0xe20d('0x22')](respondWithResult(_0x3fee87,0xc9))[_0xe20d('0x3e')](handleError(_0x3fee87,null));};exports[_0xe20d('0x21')]=function(_0x53f950,_0x3945cf){if(_0x53f950[_0xe20d('0x45')]['id']){delete _0x53f950[_0xe20d('0x45')]['id'];}return db[_0xe20d('0x39')][_0xe20d('0x43')]({'where':{'id':_0x53f950[_0xe20d('0x40')]['id']}})[_0xe20d('0x22')](handleEntityNotFound(_0x3945cf,null))[_0xe20d('0x22')](saveUpdates(_0x53f950['body'],null))[_0xe20d('0x22')](respondWithResult(_0x3945cf,null))['catch'](handleError(_0x3945cf,null));};exports[_0xe20d('0x23')]=function(_0x522bf1,_0x3dfdfb){return db[_0xe20d('0x39')][_0xe20d('0x43')]({'where':{'id':_0x522bf1[_0xe20d('0x40')]['id']}})['then'](handleEntityNotFound(_0x3dfdfb,null))[_0xe20d('0x22')](removeEntity(_0x3dfdfb,null))['catch'](handleError(_0x3dfdfb,null));};exports['describe']=function(_0x396517,_0x454588){return db[_0xe20d('0x39')]['describe']()[_0xe20d('0x22')](respondWithResult(_0x454588,null))[_0xe20d('0x3e')](handleError(_0x454588,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ba19bbf..a014f70 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 _0x5860=['./userProfileSection.attributes','define','UserProfileSection','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x359c43,_0x3107ca){var _0x48e7d6=function(_0x32bd16){while(--_0x32bd16){_0x359c43['push'](_0x359c43['shift']());}};_0x48e7d6(++_0x3107ca);}(_0x5860,0x113));var _0x0586=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5860[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x0586('0x0'));var util=require(_0x0586('0x1'));var logger=require(_0x0586('0x2'))(_0x0586('0x3'));var moment=require(_0x0586('0x4'));var BPromise=require(_0x0586('0x5'));var rp=require(_0x0586('0x6'));var fs=require('fs');var path=require(_0x0586('0x7'));var rimraf=require(_0x0586('0x8'));var config=require(_0x0586('0x9'));var attributes=require(_0x0586('0xa'));module['exports']=function(_0x2f9e3b,_0x1325ad){return _0x2f9e3b[_0x0586('0xb')](_0x0586('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x0586('0xd'),'fields':['sectionId',_0x0586('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x551b=['./userProfileSection.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x551b,0x66));var _0xb551=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x551b[_0x264d4d];return _0xc917e2;};'use strict';var _=require('lodash');var util=require(_0xb551('0x0'));var logger=require(_0xb551('0x1'))(_0xb551('0x2'));var moment=require(_0xb551('0x3'));var BPromise=require(_0xb551('0x4'));var rp=require(_0xb551('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb551('0x6'));var config=require(_0xb551('0x7'));var attributes=require(_0xb551('0x8'));module[_0xb551('0x9')]=function(_0x5267c9,_0x49ea19){return _0x5267c9[_0xb551('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f9872b3..0611325 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 _0xeb0f=['jayson/promise','client','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x27123d,_0x2b134d){var _0x33bf21=function(_0x217be1){while(--_0x217be1){_0x27123d['push'](_0x27123d['shift']());}};_0x33bf21(++_0x2b134d);}(_0xeb0f,0x10a));var _0xfeb0=function(_0x1859ce,_0x23d440){_0x1859ce=_0x1859ce-0x0;var _0x264847=_0xeb0f[_0x1859ce];return _0x264847;};'use strict';var _=require('lodash');var util=require(_0xfeb0('0x0'));var moment=require('moment');var BPromise=require(_0xfeb0('0x1'));var rs=require(_0xfeb0('0x2'));var fs=require('fs');var Redis=require(_0xfeb0('0x3'));var db=require(_0xfeb0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfeb0('0x5'))(_0xfeb0('0x6'));var config=require('../../config/environment');var jayson=require(_0xfeb0('0x7'));var client=jayson[_0xfeb0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x558a31,_0x25dd9b,_0x10babe){return new BPromise(function(_0x51ba3e,_0x5db3bc){return client[_0xfeb0('0x9')](_0x558a31,_0x10babe)['then'](function(_0x4094f7){logger[_0xfeb0('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x25dd9b,_0xfeb0('0xb'));logger[_0xfeb0('0xc')](_0xfeb0('0xd'),_0x25dd9b,_0xfeb0('0xb'),JSON[_0xfeb0('0xe')](_0x4094f7));if(_0x4094f7[_0xfeb0('0xf')]){if(_0x4094f7[_0xfeb0('0xf')][_0xfeb0('0x10')]===0x1f4){logger['error'](_0xfeb0('0x11'),_0x25dd9b,_0x4094f7['error'][_0xfeb0('0x12')]);return _0x5db3bc(_0x4094f7[_0xfeb0('0xf')]['message']);}logger[_0xfeb0('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x25dd9b,_0x4094f7[_0xfeb0('0xf')][_0xfeb0('0x12')]);return _0x51ba3e(_0x4094f7['error']['message']);}else{logger[_0xfeb0('0xa')](_0xfeb0('0x11'),_0x25dd9b,'request\x20sent');_0x51ba3e(_0x4094f7[_0xfeb0('0x13')][_0xfeb0('0x12')]);}})[_0xfeb0('0x14')](function(_0x78692e){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x25dd9b,_0x78692e);_0x5db3bc(_0x78692e);});});} \ No newline at end of file +var _0xc932=['result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5c12ba,_0x229eee){var _0x4ed0fa=function(_0x410943){while(--_0x410943){_0x5c12ba['push'](_0x5c12ba['shift']());}};_0x4ed0fa(++_0x229eee);}(_0xc932,0x9b));var _0x2c93=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0xc932[_0x3c414c];return _0x4f3062;};'use strict';var _=require(_0x2c93('0x0'));var util=require(_0x2c93('0x1'));var moment=require(_0x2c93('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c93('0x3'));var fs=require('fs');var Redis=require(_0x2c93('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c93('0x5'))(_0x2c93('0x6'));var config=require(_0x2c93('0x7'));var jayson=require(_0x2c93('0x8'));var client=jayson[_0x2c93('0x9')][_0x2c93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e0bd4,_0x8da6b3,_0x408580){return new BPromise(function(_0x4e7f29,_0x5e184f){return client[_0x2c93('0xb')](_0x4e0bd4,_0x408580)[_0x2c93('0xc')](function(_0x44d6c2){logger['info'](_0x2c93('0xd'),_0x8da6b3,_0x2c93('0xe'));logger[_0x2c93('0xf')](_0x2c93('0x10'),_0x8da6b3,_0x2c93('0xe'),JSON[_0x2c93('0x11')](_0x44d6c2));if(_0x44d6c2['error']){if(_0x44d6c2[_0x2c93('0x12')][_0x2c93('0x13')]===0x1f4){logger['error'](_0x2c93('0xd'),_0x8da6b3,_0x44d6c2[_0x2c93('0x12')][_0x2c93('0x14')]);return _0x5e184f(_0x44d6c2[_0x2c93('0x12')][_0x2c93('0x14')]);}logger['error'](_0x2c93('0xd'),_0x8da6b3,_0x44d6c2[_0x2c93('0x12')][_0x2c93('0x14')]);return _0x4e7f29(_0x44d6c2[_0x2c93('0x12')][_0x2c93('0x14')]);}else{logger['info'](_0x2c93('0xd'),_0x8da6b3,_0x2c93('0xe'));_0x4e7f29(_0x44d6c2[_0x2c93('0x15')]['message']);}})['catch'](function(_0x19b779){logger['error'](_0x2c93('0xd'),_0x8da6b3,_0x19b779);_0x5e184f(_0x19b779);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 661f85d..bfe7723 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x43b76e,_0x32b4f2){var _0x19102f=function(_0xa3e238){while(--_0xa3e238){_0x43b76e['push'](_0x43b76e['shift']());}};_0x19102f(++_0x32b4f2);}(_0xe706,0xa3));var _0x6e70=function(_0x47c28c,_0x52f17e){_0x47c28c=_0x47c28c-0x0;var _0x13c2ec=_0xe706[_0x47c28c];return _0x13c2ec;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5aba26,_0x973101){var _0x5164a9=function(_0x5a7026){while(--_0x5a7026){_0x5aba26['push'](_0x5aba26['shift']());}};_0x5164a9(++_0x973101);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xcb91[_0x5e4563];return _0x8d1bf5;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 40fe6aa..e494008 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 _0x0040=['exports'];(function(_0x4f272d,_0x1c6f99){var _0x146e5e=function(_0x889520){while(--_0x889520){_0x4f272d['push'](_0x4f272d['shift']());}};_0x146e5e(++_0x1c6f99);}(_0x0040,0x157));var _0x0004=function(_0x1bb161,_0x25b93c){_0x1bb161=_0x1bb161-0x0;var _0x2d4246=_0x0040[_0x1bb161];return _0x2d4246;};'use strict';var Sequelize=require('sequelize');module[_0x0004('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x285b=['exports','sequelize'];(function(_0x4d50f3,_0x298bfa){var _0x2832f8=function(_0x2ec165){while(--_0x2ec165){_0x4d50f3['push'](_0x4d50f3['shift']());}};_0x2832f8(++_0x298bfa);}(_0x285b,0x16f));var _0xb285=function(_0x4b47eb,_0x3c9321){_0x4b47eb=_0x4b47eb-0x0;var _0x3bb8d9=_0x285b[_0x4b47eb];return _0x3bb8d9;};'use strict';var Sequelize=require(_0xb285('0x0'));module[_0xb285('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 e799629..99e96e3 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 _0x187d=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes'];(function(_0x55dce8,_0x13ae7f){var _0x53254d=function(_0x49e79c){while(--_0x49e79c){_0x55dce8['push'](_0x55dce8['shift']());}};_0x53254d(++_0x13ae7f);}(_0x187d,0x93));var _0xd187=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x187d[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['api','moment','bluebird','path','../../config/environment','exports','define','user_has_sms_queues','lodash','util'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa46e,0x8a));var _0xea46=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0xa46e[_0x1cb0b4];return _0x525b60;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('UserSmsQueue',attributes,{'tableName':_0xea46('0x9'),'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 8900f9f..aba7a13 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 _0xc878=['info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xe9f087,_0x4f6918){var _0x4dd490=function(_0xd88a80){while(--_0xd88a80){_0xe9f087['push'](_0xe9f087['shift']());}};_0x4dd490(++_0x4f6918);}(_0xc878,0x198));var _0x8c87=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0xc878[_0x330414];return _0x99dbff;};'use strict';var _=require(_0x8c87('0x0'));var util=require(_0x8c87('0x1'));var moment=require(_0x8c87('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c87('0x3'));var logger=require(_0x8c87('0x4'))(_0x8c87('0x5'));var config=require(_0x8c87('0x6'));var jayson=require(_0x8c87('0x7'));var client=jayson[_0x8c87('0x8')][_0x8c87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cd231,_0x5c6c1b,_0x5c11a1){return new BPromise(function(_0x11c1a6,_0x47aefa){return client[_0x8c87('0xa')](_0x4cd231,_0x5c11a1)[_0x8c87('0xb')](function(_0x34e1c5){logger[_0x8c87('0xc')](_0x8c87('0xd'),_0x5c6c1b,'request\x20sent');logger[_0x8c87('0xe')](_0x8c87('0xf'),_0x5c6c1b,'request\x20sent',JSON['stringify'](_0x34e1c5));if(_0x34e1c5[_0x8c87('0x10')]){if(_0x34e1c5['error'][_0x8c87('0x11')]===0x1f4){logger[_0x8c87('0x10')](_0x8c87('0xd'),_0x5c6c1b,_0x34e1c5[_0x8c87('0x10')][_0x8c87('0x12')]);return _0x47aefa(_0x34e1c5[_0x8c87('0x10')][_0x8c87('0x12')]);}logger['error'](_0x8c87('0xd'),_0x5c6c1b,_0x34e1c5[_0x8c87('0x10')]['message']);return _0x11c1a6(_0x34e1c5['error'][_0x8c87('0x12')]);}else{logger[_0x8c87('0xc')](_0x8c87('0xd'),_0x5c6c1b,_0x8c87('0x13'));_0x11c1a6(_0x34e1c5[_0x8c87('0x14')][_0x8c87('0x12')]);}})['catch'](function(_0x3fbe2b){logger[_0x8c87('0x10')](_0x8c87('0xd'),_0x5c6c1b,_0x3fbe2b);_0x47aefa(_0x3fbe2b);});});} \ No newline at end of file +var _0x8e5e=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x8e5e,0x1e9));var _0xe8e5=function(_0x2a286e,_0x4f97b2){_0x2a286e=_0x2a286e-0x0;var _0x453278=_0x8e5e[_0x2a286e];return _0x453278;};'use strict';var _=require(_0xe8e5('0x0'));var util=require(_0xe8e5('0x1'));var moment=require(_0xe8e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8e5('0x3'));var fs=require('fs');var Redis=require(_0xe8e5('0x4'));var db=require(_0xe8e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8e5('0x6'))(_0xe8e5('0x7'));var config=require('../../config/environment');var jayson=require(_0xe8e5('0x8'));var client=jayson[_0xe8e5('0x9')][_0xe8e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92830e,_0x32ac03,_0x5962cc){return new BPromise(function(_0x37bfd1,_0x3bf325){return client['request'](_0x92830e,_0x5962cc)[_0xe8e5('0xb')](function(_0x4ed4fc){logger[_0xe8e5('0xc')](_0xe8e5('0xd'),_0x32ac03,_0xe8e5('0xe'));logger['debug'](_0xe8e5('0xf'),_0x32ac03,_0xe8e5('0xe'),JSON[_0xe8e5('0x10')](_0x4ed4fc));if(_0x4ed4fc[_0xe8e5('0x11')]){if(_0x4ed4fc[_0xe8e5('0x11')][_0xe8e5('0x12')]===0x1f4){logger[_0xe8e5('0x11')](_0xe8e5('0xd'),_0x32ac03,_0x4ed4fc[_0xe8e5('0x11')][_0xe8e5('0x13')]);return _0x3bf325(_0x4ed4fc[_0xe8e5('0x11')][_0xe8e5('0x13')]);}logger[_0xe8e5('0x11')](_0xe8e5('0xd'),_0x32ac03,_0x4ed4fc['error']['message']);return _0x37bfd1(_0x4ed4fc[_0xe8e5('0x11')][_0xe8e5('0x13')]);}else{logger[_0xe8e5('0xc')](_0xe8e5('0xd'),_0x32ac03,'request\x20sent');_0x37bfd1(_0x4ed4fc['result'][_0xe8e5('0x13')]);}})[_0xe8e5('0x14')](function(_0x60c149){logger[_0xe8e5('0x11')](_0xe8e5('0xd'),_0x32ac03,_0x60c149);_0x3bf325(_0x60c149);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5832212..80c5a54 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 _0xde7a=['INTEGER','exports'];(function(_0xe60a63,_0x5730a3){var _0x281f72=function(_0x49e301){while(--_0x49e301){_0xe60a63['push'](_0xe60a63['shift']());}};_0x281f72(++_0x5730a3);}(_0xde7a,0x117));var _0xade7=function(_0x519151,_0x4f2b94){_0x519151=_0x519151-0x0;var _0x438307=_0xde7a[_0x519151];return _0x438307;};'use strict';var Sequelize=require('sequelize');module[_0xade7('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xade7('0x1')]}}; \ No newline at end of file +var _0x6e9b=['exports','INTEGER','sequelize'];(function(_0x39bb49,_0x546aa0){var _0x478952=function(_0x3a4bd1){while(--_0x3a4bd1){_0x39bb49['push'](_0x39bb49['shift']());}};_0x478952(++_0x546aa0);}(_0x6e9b,0x68));var _0xb6e9=function(_0x4b3500,_0x5b64ba){_0x4b3500=_0x4b3500-0x0;var _0x299194=_0x6e9b[_0x4b3500];return _0x299194;};'use strict';var Sequelize=require(_0xb6e9('0x0'));module[_0xb6e9('0x1')]={'UserId':{'type':Sequelize[_0xb6e9('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb6e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 8d2c682..6d3a0c2 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(_0xca5230,_0x3d8e34){var _0x48c1b5=function(_0x4105af){while(--_0x4105af){_0xca5230['push'](_0xca5230['shift']());}};_0x48c1b5(++_0x3d8e34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x43eeb5,_0x4fabff){var _0x2a7e88=function(_0x100732){while(--_0x100732){_0x43eeb5['push'](_0x43eeb5['shift']());}};_0x2a7e88(++_0x4fabff);}(_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':'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 d6a25d0..fb371b4 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x223ff6,_0x4cd5e4){var _0x38d41d=function(_0x2f0387){while(--_0x2f0387){_0x223ff6['push'](_0x223ff6['shift']());}};_0x38d41d(++_0x4cd5e4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x9773cc,_0x3fc4ab){var _0x517869=function(_0x282bea){while(--_0x282bea){_0x9773cc['push'](_0x9773cc['shift']());}};_0x517869(++_0x3fc4ab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f18228f..833b7d6 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 _0xc47b=['INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc47b,0x160));var _0xbc47=function(_0x5c9c4b,_0x238757){_0x5c9c4b=_0x5c9c4b-0x0;var _0x3da2e9=_0xc47b[_0x5c9c4b];return _0x3da2e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xbc47('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x04f5=['exports','INTEGER','sequelize'];(function(_0x5e6cea,_0x24b02a){var _0x55a315=function(_0x395b80){while(--_0x395b80){_0x5e6cea['push'](_0x5e6cea['shift']());}};_0x55a315(++_0x24b02a);}(_0x04f5,0x1a9));var _0x504f=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x04f5[_0x2c0be1];return _0x3d4bd2;};'use strict';var Sequelize=require(_0x504f('0x0'));module[_0x504f('0x1')]={'penalty':{'type':Sequelize[_0x504f('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 daaa463..69f0477 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 _0x05c0=['define','UserVoiceQueue','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x572104,_0x2cde47){var _0x42739c=function(_0x162478){while(--_0x162478){_0x572104['push'](_0x572104['shift']());}};_0x42739c(++_0x2cde47);}(_0x05c0,0x14c));var _0x005c=function(_0x131aa0,_0x1f0ca6){_0x131aa0=_0x131aa0-0x0;var _0x1ef5c3=_0x05c0[_0x131aa0];return _0x1ef5c3;};'use strict';var _=require(_0x005c('0x0'));var util=require(_0x005c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x005c('0x2'));var BPromise=require(_0x005c('0x3'));var rp=require(_0x005c('0x4'));var fs=require('fs');var path=require(_0x005c('0x5'));var rimraf=require('rimraf');var config=require(_0x005c('0x6'));var attributes=require(_0x005c('0x7'));module[_0x005c('0x8')]=function(_0x9f98af,_0xd0fb79){return _0x9f98af[_0x005c('0x9')](_0x005c('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x337c=['rimraf','../../config/environment','exports','define','user_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x117713,_0x1b3f0c){var _0x310d68=function(_0x5c266a){while(--_0x5c266a){_0x117713['push'](_0x117713['shift']());}};_0x310d68(++_0x1b3f0c);}(_0x337c,0x170));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc337('0x0'));var logger=require(_0xc337('0x1'))(_0xc337('0x2'));var moment=require(_0xc337('0x3'));var BPromise=require(_0xc337('0x4'));var rp=require(_0xc337('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc337('0x6'));var config=require(_0xc337('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xc337('0x8')]=function(_0x55fe0c,_0x4ec3d4){return _0x55fe0c[_0xc337('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xc337('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5bdc651..c42fa82 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 _0x504d=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x13f608,_0xdb0ec7){var _0x3edfd1=function(_0x5bafd3){while(--_0x5bafd3){_0x13f608['push'](_0x13f608['shift']());}};_0x3edfd1(++_0xdb0ec7);}(_0x504d,0xdd));var _0xd504=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x504d[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xd504('0x0'));var util=require(_0xd504('0x1'));var moment=require(_0xd504('0x2'));var BPromise=require(_0xd504('0x3'));var rs=require(_0xd504('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd504('0x5'))['db'];var utils=require(_0xd504('0x6'));var logger=require(_0xd504('0x7'))(_0xd504('0x8'));var config=require('../../config/environment');var jayson=require(_0xd504('0x9'));var client=jayson[_0xd504('0xa')][_0xd504('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x130a42,_0x4d1aef,_0x6ac146){return new BPromise(function(_0x156373,_0x2f0283){return client[_0xd504('0xc')](_0x130a42,_0x6ac146)[_0xd504('0xd')](function(_0x570fdd){logger[_0xd504('0xe')](_0xd504('0xf'),_0x4d1aef,_0xd504('0x10'));logger[_0xd504('0x11')](_0xd504('0x12'),_0x4d1aef,_0xd504('0x10'),JSON[_0xd504('0x13')](_0x570fdd));if(_0x570fdd[_0xd504('0x14')]){if(_0x570fdd[_0xd504('0x14')][_0xd504('0x15')]===0x1f4){logger[_0xd504('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x4d1aef,_0x570fdd[_0xd504('0x14')][_0xd504('0x16')]);return _0x2f0283(_0x570fdd['error'][_0xd504('0x16')]);}logger['error'](_0xd504('0xf'),_0x4d1aef,_0x570fdd['error'][_0xd504('0x16')]);return _0x156373(_0x570fdd[_0xd504('0x14')][_0xd504('0x16')]);}else{logger[_0xd504('0xe')](_0xd504('0xf'),_0x4d1aef,_0xd504('0x10'));_0x156373(_0x570fdd[_0xd504('0x17')]['message']);}})[_0xd504('0x18')](function(_0x2a1c50){logger[_0xd504('0x14')](_0xd504('0xf'),_0x4d1aef,_0x2a1c50);_0x2f0283(_0x2a1c50);});});} \ No newline at end of file +var _0x95cf=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xf9ef2c,_0x317183){var _0x5ba04e=function(_0x3f2b81){while(--_0x3f2b81){_0xf9ef2c['push'](_0xf9ef2c['shift']());}};_0x5ba04e(++_0x317183);}(_0x95cf,0x75));var _0xf95c=function(_0xd27d83,_0x259b5e){_0xd27d83=_0xd27d83-0x0;var _0x5ca12a=_0x95cf[_0xd27d83];return _0x5ca12a;};'use strict';var _=require(_0xf95c('0x0'));var util=require('util');var moment=require(_0xf95c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf95c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf95c('0x3'))['db'];var utils=require(_0xf95c('0x4'));var logger=require(_0xf95c('0x5'))(_0xf95c('0x6'));var config=require(_0xf95c('0x7'));var jayson=require(_0xf95c('0x8'));var client=jayson[_0xf95c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x265e9e,_0x1b5f04,_0x4b7071){return new BPromise(function(_0x4e35a7,_0x47001e){return client[_0xf95c('0xa')](_0x265e9e,_0x4b7071)[_0xf95c('0xb')](function(_0x201d74){logger[_0xf95c('0xc')](_0xf95c('0xd'),_0x1b5f04,_0xf95c('0xe'));logger[_0xf95c('0xf')](_0xf95c('0x10'),_0x1b5f04,_0xf95c('0xe'),JSON['stringify'](_0x201d74));if(_0x201d74[_0xf95c('0x11')]){if(_0x201d74['error'][_0xf95c('0x12')]===0x1f4){logger[_0xf95c('0x11')](_0xf95c('0xd'),_0x1b5f04,_0x201d74[_0xf95c('0x11')][_0xf95c('0x13')]);return _0x47001e(_0x201d74[_0xf95c('0x11')]['message']);}logger['error'](_0xf95c('0xd'),_0x1b5f04,_0x201d74[_0xf95c('0x11')]['message']);return _0x4e35a7(_0x201d74[_0xf95c('0x11')][_0xf95c('0x13')]);}else{logger[_0xf95c('0xc')](_0xf95c('0xd'),_0x1b5f04,_0xf95c('0xe'));_0x4e35a7(_0x201d74[_0xf95c('0x14')][_0xf95c('0x13')]);}})[_0xf95c('0x15')](function(_0x5725da){logger[_0xf95c('0x11')](_0xf95c('0xd'),_0x1b5f04,_0x5725da);_0x47001e(_0x5725da);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f35be37..9a91e77 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(_0x49837e,_0x208c5f){var _0x2eeadd=function(_0x29dac2){while(--_0x29dac2){_0x49837e['push'](_0x49837e['shift']());}};_0x2eeadd(++_0x208c5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4014e5,_0x125e6a){var _0x4ee8b7=function(_0x2475da){while(--_0x2475da){_0x4014e5['push'](_0x4014e5['shift']());}};_0x4ee8b7(++_0x125e6a);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 73c2787..c940073 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 _0xbc89=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbc89,0x1a7));var _0x9bc8=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0xbc89[_0x2468b5];return _0x1056e4;};'use strict';var Sequelize=require(_0x9bc8('0x0'));module[_0x9bc8('0x1')]={'uniqueid':{'type':Sequelize[_0x9bc8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9bc8('0x3')},'membername':{'type':Sequelize[_0x9bc8('0x4')],'allowNull':![],'comment':_0x9bc8('0x3')},'UserId':{'type':Sequelize[_0x9bc8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9bc8('0x5'),'comment':_0x9bc8('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9bc8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x9bc8('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x9bc8('0x3')},'penalty':{'type':Sequelize[_0x9bc8('0x2')](0xb),'defaultValue':0x0,'comment':_0x9bc8('0x3')},'paused':{'type':Sequelize[_0x9bc8('0x2')](0xb),'defaultValue':0x0,'comment':_0x9bc8('0x3')}}; \ No newline at end of file +var _0xdeeb=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xdeeb,0x1b3));var _0xbdee=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xdeeb[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0xbdee('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbdee('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xbdee('0x2')},'membername':{'type':Sequelize[_0xbdee('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xbdee('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbdee('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xbdee('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbdee('0x4'),'comment':_0xbdee('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xbdee('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xbdee('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 17c11b1..b768e73 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 _0x7cd4=['hasOwnProperty','hook','events','../../mysqldb','remove','emit'];(function(_0x2b5f70,_0x20b05c){var _0x27d650=function(_0x37c72d){while(--_0x37c72d){_0x2b5f70['push'](_0x2b5f70['shift']());}};_0x27d650(++_0x20b05c);}(_0x7cd4,0x1ee));var _0x47cd=function(_0x3cf130,_0x480a82){_0x3cf130=_0x3cf130-0x0;var _0x1210fe=_0x7cd4[_0x3cf130];return _0x1210fe;};'use strict';var EventEmitter=require(_0x47cd('0x0'));var UserVoiceQueueRt=require(_0x47cd('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x47cd('0x2')};function emitEvent(_0xe73e41){return function(_0x439fcf,_0x195c32,_0x3a69b4){UserVoiceQueueRtEvents[_0x47cd('0x3')](_0xe73e41+':'+_0x439fcf['id'],_0x439fcf);UserVoiceQueueRtEvents[_0x47cd('0x3')](_0xe73e41,_0x439fcf);_0x3a69b4(null);};}for(var e in events){if(events[_0x47cd('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x47cd('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x03b9=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3d2414,_0x2e5a1b){var _0x2f4e4c=function(_0x574c82){while(--_0x574c82){_0x3d2414['push'](_0x3d2414['shift']());}};_0x2f4e4c(++_0x2e5a1b);}(_0x03b9,0x16e));var _0x903b=function(_0x20194a,_0x32264c){_0x20194a=_0x20194a-0x0;var _0x5d8c1e=_0x03b9[_0x20194a];return _0x5d8c1e;};'use strict';var EventEmitter=require(_0x903b('0x0'));var UserVoiceQueueRt=require(_0x903b('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x903b('0x2')](0x0);var events={'afterCreate':_0x903b('0x3'),'afterUpdate':_0x903b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36f629){return function(_0x314f75,_0xe4c430,_0x226dfa){UserVoiceQueueRtEvents[_0x903b('0x5')](_0x36f629+':'+_0x314f75['id'],_0x314f75);UserVoiceQueueRtEvents[_0x903b('0x5')](_0x36f629,_0x314f75);_0x226dfa(null);};}for(var e in events){if(events[_0x903b('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a0f561a..dff4612 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 _0x858f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','lodash'];(function(_0xc4376d,_0x2e6841){var _0x291524=function(_0x235c70){while(--_0x235c70){_0xc4376d['push'](_0xc4376d['shift']());}};_0x291524(++_0x2e6841);}(_0x858f,0x18f));var _0xf858=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0x858f[_0x45c262];return _0x4f2ba6;};'use strict';var _=require(_0xf858('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf858('0x1'));var BPromise=require(_0xf858('0x2'));var rp=require(_0xf858('0x3'));var fs=require('fs');var path=require(_0xf858('0x4'));var rimraf=require(_0xf858('0x5'));var config=require(_0xf858('0x6'));var attributes=require(_0xf858('0x7'));module['exports']=function(_0x2957c8,_0x3f6034){return _0x2957c8[_0xf858('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xf858('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a50=['../../config/environment','./userVoiceQueueRt.attributes','exports','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x18a667,_0x58dfd3){var _0xa38d3a=function(_0x13f5d1){while(--_0x13f5d1){_0x18a667['push'](_0x18a667['shift']());}};_0xa38d3a(++_0x58dfd3);}(_0x1a50,0x1cf));var _0x01a5=function(_0x447b23,_0x49c577){_0x447b23=_0x447b23-0x0;var _0x2f37c7=_0x1a50[_0x447b23];return _0x2f37c7;};'use strict';var _=require(_0x01a5('0x0'));var util=require(_0x01a5('0x1'));var logger=require(_0x01a5('0x2'))('api');var moment=require(_0x01a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x01a5('0x4'));var fs=require('fs');var path=require(_0x01a5('0x5'));var rimraf=require(_0x01a5('0x6'));var config=require(_0x01a5('0x7'));var attributes=require(_0x01a5('0x8'));module[_0x01a5('0x9')]=function(_0x1c0729,_0x421f52){return _0x1c0729['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 6b9abaa..04b8a83 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 _0xfba2=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util'];(function(_0x3fc7b9,_0x2c5377){var _0x240c15=function(_0x4494ca){while(--_0x4494ca){_0x3fc7b9['push'](_0x3fc7b9['shift']());}};_0x240c15(++_0x2c5377);}(_0xfba2,0x1de));var _0x2fba=function(_0x1a6042,_0x2d546a){_0x1a6042=_0x1a6042-0x0;var _0x5e71d1=_0xfba2[_0x1a6042];return _0x5e71d1;};'use strict';var _=require(_0x2fba('0x0'));var util=require(_0x2fba('0x1'));var moment=require(_0x2fba('0x2'));var BPromise=require(_0x2fba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fba('0x4'));var db=require(_0x2fba('0x5'))['db'];var utils=require(_0x2fba('0x6'));var logger=require(_0x2fba('0x7'))(_0x2fba('0x8'));var config=require('../../config/environment');var jayson=require(_0x2fba('0x9'));var client=jayson[_0x2fba('0xa')][_0x2fba('0xb')]({'port':0x232a});config[_0x2fba('0xc')]=_[_0x2fba('0xd')](config[_0x2fba('0xc')],{'host':_0x2fba('0xe'),'port':0x18eb});var socket=require(_0x2fba('0xf'))(new Redis(config['redis']));require(_0x2fba('0x10'))[_0x2fba('0x11')](socket);function respondWithRpcPromise(_0x369e74,_0x295260,_0x2f1c73){return new BPromise(function(_0x3af9ca,_0x2a6788){return client[_0x2fba('0x12')](_0x369e74,_0x2f1c73)[_0x2fba('0x13')](function(_0x398e82){logger[_0x2fba('0x14')](_0x2fba('0x15'),_0x295260,_0x2fba('0x16'));logger[_0x2fba('0x17')](_0x2fba('0x18'),_0x295260,'request\x20sent',JSON['stringify'](_0x398e82));if(_0x398e82[_0x2fba('0x19')]){if(_0x398e82['error'][_0x2fba('0x1a')]===0x1f4){logger['error'](_0x2fba('0x15'),_0x295260,_0x398e82[_0x2fba('0x19')][_0x2fba('0x1b')]);return _0x2a6788(_0x398e82[_0x2fba('0x19')][_0x2fba('0x1b')]);}logger[_0x2fba('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x295260,_0x398e82[_0x2fba('0x19')][_0x2fba('0x1b')]);return _0x3af9ca(_0x398e82[_0x2fba('0x19')][_0x2fba('0x1b')]);}else{logger[_0x2fba('0x14')](_0x2fba('0x15'),_0x295260,_0x2fba('0x16'));_0x3af9ca(_0x398e82[_0x2fba('0x1c')][_0x2fba('0x1b')]);}})[_0x2fba('0x1d')](function(_0x373f93){logger[_0x2fba('0x19')](_0x2fba('0x15'),_0x295260,_0x373f93);_0x2a6788(_0x373f93);});});}exports[_0x2fba('0x1e')]=function(_0x5a9151){var _0x18ba18=this;return new Promise(function(_0x511bd1,_0x532e14){return db[_0x2fba('0x1f')][_0x2fba('0x20')]({'raw':_0x5a9151[_0x2fba('0x21')]?_0x5a9151[_0x2fba('0x21')][_0x2fba('0x22')]===undefined?!![]:![]:!![],'where':_0x5a9151[_0x2fba('0x21')]?_0x5a9151[_0x2fba('0x21')]['where']||null:null,'attributes':[[db[_0x2fba('0x23')]['fn'](_0x2fba('0x24'),db[_0x2fba('0x23')]['fn']('IF',db['sequelize']['literal'](_0x2fba('0x25')))),_0x2fba('0x26')]]})[_0x2fba('0x13')](function(_0x3d0582){logger[_0x2fba('0x14')]('GetVoiceQueueRtPauses',_0x5a9151);logger[_0x2fba('0x17')](_0x2fba('0x1e'),_0x5a9151,JSON[_0x2fba('0x27')](_0x3d0582));_0x511bd1(_0x3d0582);})[_0x2fba('0x1d')](function(_0x3b4644){logger['error'](_0x2fba('0x1e'),_0x3b4644['message'],_0x5a9151);_0x532e14(_0x18ba18['error'](0x1f4,_0x3b4644[_0x2fba('0x1b')]));});});}; \ No newline at end of file +var _0x7044=['request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x7044,0x105));var _0x4704=function(_0x54907f,_0x131444){_0x54907f=_0x54907f-0x0;var _0x473df9=_0x7044[_0x54907f];return _0x473df9;};'use strict';var _=require('lodash');var util=require(_0x4704('0x0'));var moment=require(_0x4704('0x1'));var BPromise=require(_0x4704('0x2'));var rs=require(_0x4704('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4704('0x4'))['db'];var utils=require(_0x4704('0x5'));var logger=require(_0x4704('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4704('0x7'));var client=jayson[_0x4704('0x8')][_0x4704('0x9')]({'port':0x232a});config[_0x4704('0xa')]=_[_0x4704('0xb')](config['redis'],{'host':_0x4704('0xc'),'port':0x18eb});var socket=require(_0x4704('0xd'))(new Redis(config[_0x4704('0xa')]));require(_0x4704('0xe'))[_0x4704('0xf')](socket);function respondWithRpcPromise(_0x2e4ae1,_0x4ddf20,_0x416dde){return new BPromise(function(_0x40febf,_0x221f3f){return client[_0x4704('0x10')](_0x2e4ae1,_0x416dde)[_0x4704('0x11')](function(_0x2c7c00){logger['info'](_0x4704('0x12'),_0x4ddf20,_0x4704('0x13'));logger['debug'](_0x4704('0x14'),_0x4ddf20,_0x4704('0x13'),JSON[_0x4704('0x15')](_0x2c7c00));if(_0x2c7c00[_0x4704('0x16')]){if(_0x2c7c00['error'][_0x4704('0x17')]===0x1f4){logger[_0x4704('0x16')](_0x4704('0x12'),_0x4ddf20,_0x2c7c00[_0x4704('0x16')][_0x4704('0x18')]);return _0x221f3f(_0x2c7c00[_0x4704('0x16')][_0x4704('0x18')]);}logger[_0x4704('0x16')](_0x4704('0x12'),_0x4ddf20,_0x2c7c00['error'][_0x4704('0x18')]);return _0x40febf(_0x2c7c00['error']['message']);}else{logger[_0x4704('0x19')](_0x4704('0x12'),_0x4ddf20,_0x4704('0x13'));_0x40febf(_0x2c7c00[_0x4704('0x1a')][_0x4704('0x18')]);}})[_0x4704('0x1b')](function(_0x522f33){logger[_0x4704('0x16')](_0x4704('0x12'),_0x4ddf20,_0x522f33);_0x221f3f(_0x522f33);});});}exports[_0x4704('0x1c')]=function(_0x40befc){var _0x555f99=this;return new Promise(function(_0x3077c2,_0x4b569d){return db[_0x4704('0x1d')][_0x4704('0x1e')]({'raw':_0x40befc[_0x4704('0x1f')]?_0x40befc[_0x4704('0x1f')][_0x4704('0x20')]===undefined?!![]:![]:!![],'where':_0x40befc[_0x4704('0x1f')]?_0x40befc['options'][_0x4704('0x21')]||null:null,'attributes':[[db[_0x4704('0x22')]['fn'](_0x4704('0x23'),db[_0x4704('0x22')]['fn']('IF',db[_0x4704('0x22')][_0x4704('0x24')](_0x4704('0x25')))),_0x4704('0x26')]]})['then'](function(_0x4e363b){logger[_0x4704('0x19')](_0x4704('0x1c'),_0x40befc);logger[_0x4704('0x27')](_0x4704('0x1c'),_0x40befc,JSON[_0x4704('0x15')](_0x4e363b));_0x3077c2(_0x4e363b);})[_0x4704('0x1b')](function(_0x45e785){logger[_0x4704('0x16')](_0x4704('0x1c'),_0x45e785[_0x4704('0x18')],_0x40befc);_0x4b569d(_0x555f99[_0x4704('0x16')](0x1f4,_0x45e785['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8c7cff9..4e9f085 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 _0x323f=['removeListener','register','length','userVoiceQueueRt:','save','update','emit'];(function(_0x5aac9b,_0xd78874){var _0x2d59ee=function(_0x48243e){while(--_0x48243e){_0x5aac9b['push'](_0x5aac9b['shift']());}};_0x2d59ee(++_0xd78874);}(_0x323f,0x1ee));var _0xf323=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x323f[_0x5b561d];return _0x431060;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf323('0x0'),'remove',_0xf323('0x1')];function createListener(_0x1a3006,_0x41c114){return function(_0xc09d02){_0x41c114[_0xf323('0x2')](_0x1a3006,_0xc09d02);};}function removeListener(_0x2c9d35,_0xb4caa8){return function(){UserVoiceQueueRtEvents[_0xf323('0x3')](_0x2c9d35,_0xb4caa8);};}exports[_0xf323('0x4')]=function(_0x371707){for(var _0x5d7d60=0x0,_0xb9a667=events[_0xf323('0x5')];_0x5d7d60<_0xb9a667;_0x5d7d60++){var _0x1af70d=events[_0x5d7d60];var _0x2c8271=createListener(_0xf323('0x6')+_0x1af70d,_0x371707);UserVoiceQueueRtEvents['on'](_0x1af70d,_0x2c8271);}}; \ No newline at end of file +var _0xe944=['register','length','./userVoiceQueueRt.events','update','removeListener'];(function(_0x1a59d3,_0x2ab166){var _0x383a84=function(_0x357e3b){while(--_0x357e3b){_0x1a59d3['push'](_0x1a59d3['shift']());}};_0x383a84(++_0x2ab166);}(_0xe944,0x174));var _0x4e94=function(_0xffa3f5,_0xa5e777){_0xffa3f5=_0xffa3f5-0x0;var _0x324415=_0xe944[_0xffa3f5];return _0x324415;};'use strict';var UserVoiceQueueRtEvents=require(_0x4e94('0x0'));var events=['save','remove',_0x4e94('0x1')];function createListener(_0x58186a,_0x5ae206){return function(_0x21ef9a){_0x5ae206['emit'](_0x58186a,_0x21ef9a);};}function removeListener(_0x4edb6f,_0x10029f){return function(){UserVoiceQueueRtEvents[_0x4e94('0x2')](_0x4edb6f,_0x10029f);};}exports[_0x4e94('0x3')]=function(_0xbb43ae){for(var _0x4d00e5=0x0,_0x44a2cd=events[_0x4e94('0x4')];_0x4d00e5<_0x44a2cd;_0x4d00e5++){var _0x175b42=events[_0x4d00e5];var _0x32bb46=createListener('userVoiceQueueRt:'+_0x175b42,_0xbb43ae);UserVoiceQueueRtEvents['on'](_0x175b42,_0x32bb46);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 187eb20..de4491c 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3fe35c,_0x38acef){var _0x126b6b=function(_0x17c038){while(--_0x17c038){_0x3fe35c['push'](_0x3fe35c['shift']());}};_0x126b6b(++_0x38acef);}(_0x70e0,0x17b));var _0x070e=function(_0x1b3e75,_0x25b5b8){_0x1b3e75=_0x1b3e75-0x0;var _0x3bb874=_0x70e0[_0x1b3e75];return _0x3bb874;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1df45d,_0x1a446d){var _0x512f7c=function(_0xbf46f3){while(--_0xbf46f3){_0x1df45d['push'](_0x1df45d['shift']());}};_0x512f7c(++_0x1a446d);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 8e856a3..f4b7815 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 _0x8055=['exports'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x8055,0x1c2));var _0x5805=function(_0x5702aa,_0x7e1b32){_0x5702aa=_0x5702aa-0x0;var _0x365b59=_0x8055[_0x5702aa];return _0x365b59;};'use strict';var Sequelize=require('sequelize');module[_0x5805('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf41=['exports','INTEGER','sequelize'];(function(_0x80cba2,_0x42987e){var _0xbc157a=function(_0x4d3f32){while(--_0x4d3f32){_0x80cba2['push'](_0x80cba2['shift']());}};_0xbc157a(++_0x42987e);}(_0xaf41,0x13d));var _0x1af4=function(_0x218f99,_0x47133f){_0x218f99=_0x218f99-0x0;var _0x5babe4=_0xaf41[_0x218f99];return _0x5babe4;};'use strict';var Sequelize=require(_0x1af4('0x0'));module[_0x1af4('0x1')]={'penalty':{'type':Sequelize[_0x1af4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index ce9aba9..001bb33 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 _0xdb84=['user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue'];(function(_0x11628b,_0x5013af){var _0xa251cb=function(_0x23b67a){while(--_0x23b67a){_0x11628b['push'](_0x11628b['shift']());}};_0xa251cb(++_0x5013af);}(_0xdb84,0x1a1));var _0x4db8=function(_0x85cf21,_0x4a8ed5){_0x85cf21=_0x85cf21-0x0;var _0x171554=_0xdb84[_0x85cf21];return _0x171554;};'use strict';var _=require(_0x4db8('0x0'));var util=require(_0x4db8('0x1'));var logger=require(_0x4db8('0x2'))('api');var moment=require(_0x4db8('0x3'));var BPromise=require(_0x4db8('0x4'));var rp=require(_0x4db8('0x5'));var fs=require('fs');var path=require(_0x4db8('0x6'));var rimraf=require(_0x4db8('0x7'));var config=require(_0x4db8('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0x4db8('0x9')]=function(_0x542a91,_0x541a84){return _0x542a91[_0x4db8('0xa')](_0x4db8('0xb'),attributes,{'tableName':_0x4db8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65d1=['api','moment','bluebird','path','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0x65d1,0x14d));var _0x165d=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x65d1[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0x165d('0x0'));var util=require(_0x165d('0x1'));var logger=require(_0x165d('0x2'))(_0x165d('0x3'));var moment=require(_0x165d('0x4'));var BPromise=require(_0x165d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x165d('0x6'));var rimraf=require('rimraf');var config=require(_0x165d('0x7'));var attributes=require(_0x165d('0x8'));module[_0x165d('0x9')]=function(_0x5a29b4,_0x3dc3d0){return _0x5a29b4['define'](_0x165d('0xa'),attributes,{'tableName':_0x165d('0xb'),'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 a2b1070..18a61b4 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 _0x3e21=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x3e21,0x1c4));var _0x13e2=function(_0x293640,_0x4b4bc5){_0x293640=_0x293640-0x0;var _0x70a420=_0x3e21[_0x293640];return _0x70a420;};'use strict';var _=require(_0x13e2('0x0'));var util=require(_0x13e2('0x1'));var moment=require('moment');var BPromise=require(_0x13e2('0x2'));var rs=require(_0x13e2('0x3'));var fs=require('fs');var Redis=require(_0x13e2('0x4'));var db=require(_0x13e2('0x5'))['db'];var utils=require(_0x13e2('0x6'));var logger=require(_0x13e2('0x7'))(_0x13e2('0x8'));var config=require(_0x13e2('0x9'));var jayson=require(_0x13e2('0xa'));var client=jayson[_0x13e2('0xb')][_0x13e2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21b95b,_0x3bcf6f,_0x3c9374){return new BPromise(function(_0x32998d,_0x81c312){return client['request'](_0x21b95b,_0x3c9374)[_0x13e2('0xd')](function(_0x277c9f){logger['info'](_0x13e2('0xe'),_0x3bcf6f,_0x13e2('0xf'));logger[_0x13e2('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3bcf6f,'request\x20sent',JSON[_0x13e2('0x11')](_0x277c9f));if(_0x277c9f['error']){if(_0x277c9f[_0x13e2('0x12')][_0x13e2('0x13')]===0x1f4){logger[_0x13e2('0x12')](_0x13e2('0xe'),_0x3bcf6f,_0x277c9f[_0x13e2('0x12')][_0x13e2('0x14')]);return _0x81c312(_0x277c9f['error'][_0x13e2('0x14')]);}logger[_0x13e2('0x12')](_0x13e2('0xe'),_0x3bcf6f,_0x277c9f[_0x13e2('0x12')]['message']);return _0x32998d(_0x277c9f['error'][_0x13e2('0x14')]);}else{logger[_0x13e2('0x15')](_0x13e2('0xe'),_0x3bcf6f,'request\x20sent');_0x32998d(_0x277c9f[_0x13e2('0x16')][_0x13e2('0x14')]);}})[_0x13e2('0x17')](function(_0x568ce0){logger[_0x13e2('0x12')](_0x13e2('0xe'),_0x3bcf6f,_0x568ce0);_0x81c312(_0x568ce0);});});} \ No newline at end of file +var _0xab4b=['then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2a8e2d,_0x41091c){var _0x361225=function(_0x3b58db){while(--_0x3b58db){_0x2a8e2d['push'](_0x2a8e2d['shift']());}};_0x361225(++_0x41091c);}(_0xab4b,0x9c));var _0xbab4=function(_0x4d6453,_0x4dfc5a){_0x4d6453=_0x4d6453-0x0;var _0x14d362=_0xab4b[_0x4d6453];return _0x14d362;};'use strict';var _=require(_0xbab4('0x0'));var util=require(_0xbab4('0x1'));var moment=require(_0xbab4('0x2'));var BPromise=require(_0xbab4('0x3'));var rs=require(_0xbab4('0x4'));var fs=require('fs');var Redis=require(_0xbab4('0x5'));var db=require(_0xbab4('0x6'))['db'];var utils=require(_0xbab4('0x7'));var logger=require(_0xbab4('0x8'))(_0xbab4('0x9'));var config=require('../../config/environment');var jayson=require(_0xbab4('0xa'));var client=jayson[_0xbab4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430123,_0x5b8c9f,_0x1595ed){return new BPromise(function(_0x16a02c,_0x3c9131){return client['request'](_0x430123,_0x1595ed)[_0xbab4('0xc')](function(_0x46d177){logger[_0xbab4('0xd')](_0xbab4('0xe'),_0x5b8c9f,'request\x20sent');logger[_0xbab4('0xf')](_0xbab4('0x10'),_0x5b8c9f,_0xbab4('0x11'),JSON[_0xbab4('0x12')](_0x46d177));if(_0x46d177[_0xbab4('0x13')]){if(_0x46d177['error'][_0xbab4('0x14')]===0x1f4){logger[_0xbab4('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b8c9f,_0x46d177[_0xbab4('0x13')][_0xbab4('0x15')]);return _0x3c9131(_0x46d177[_0xbab4('0x13')][_0xbab4('0x15')]);}logger[_0xbab4('0x13')](_0xbab4('0xe'),_0x5b8c9f,_0x46d177[_0xbab4('0x13')][_0xbab4('0x15')]);return _0x16a02c(_0x46d177[_0xbab4('0x13')]['message']);}else{logger[_0xbab4('0xd')](_0xbab4('0xe'),_0x5b8c9f,'request\x20sent');_0x16a02c(_0x46d177[_0xbab4('0x16')][_0xbab4('0x15')]);}})[_0xbab4('0x17')](function(_0x33f11b){logger[_0xbab4('0x13')](_0xbab4('0xe'),_0x5b8c9f,_0x33f11b);_0x3c9131(_0x33f11b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2159be8..a539969 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 _0x8a1b=['get','index','/:id','isAuthenticated','show','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x2dd187,_0x59c621){var _0x5d5d04=function(_0x3f93ee){while(--_0x3f93ee){_0x2dd187['push'](_0x2dd187['shift']());}};_0x5d5d04(++_0x59c621);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x51b559,_0x41d807){_0x51b559=_0x51b559-0x0;var _0x577621=_0x8a1b[_0x51b559];return _0x577621;};'use strict';var multer=require(_0xb8a1('0x0'));var util=require(_0xb8a1('0x1'));var path=require('path');var timeout=require(_0xb8a1('0x2'));var express=require(_0xb8a1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8a1('0x4'));var interaction=require(_0xb8a1('0x5'));var config=require(_0xb8a1('0x6'));var controller=require(_0xb8a1('0x7'));router[_0xb8a1('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8a1('0x9')]);router[_0xb8a1('0x8')](_0xb8a1('0xa'),auth[_0xb8a1('0xb')](),controller[_0xb8a1('0xc')]);router['post']('/',auth[_0xb8a1('0xb')](),controller['create']);router['put'](_0xb8a1('0xa'),auth[_0xb8a1('0xb')](),controller['update']);router[_0xb8a1('0xd')]('/:id',auth[_0xb8a1('0xb')](),controller[_0xb8a1('0xe')]);module[_0xb8a1('0xf')]=router; \ No newline at end of file +var _0xe0c3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','index','get','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x53b9c5,_0x31d626){var _0x1e3b14=function(_0x45ae2f){while(--_0x45ae2f){_0x53b9c5['push'](_0x53b9c5['shift']());}};_0x1e3b14(++_0x31d626);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3e0c('0x0'));var util=require('util');var path=require(_0x3e0c('0x1'));var timeout=require(_0x3e0c('0x2'));var express=require(_0x3e0c('0x3'));var router=express[_0x3e0c('0x4')]();var fs_extra=require(_0x3e0c('0x5'));var auth=require(_0x3e0c('0x6'));var interaction=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var controller=require(_0x3e0c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3e0c('0xa')]);router[_0x3e0c('0xb')](_0x3e0c('0xc'),auth[_0x3e0c('0xd')](),controller[_0x3e0c('0xe')]);router[_0x3e0c('0xf')]('/',auth[_0x3e0c('0xd')](),controller[_0x3e0c('0x10')]);router[_0x3e0c('0x11')](_0x3e0c('0xc'),auth[_0x3e0c('0xd')](),controller['update']);router['delete'](_0x3e0c('0xc'),auth[_0x3e0c('0xd')](),controller[_0x3e0c('0x12')]);module[_0x3e0c('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8d0f826..c69b1f0 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 _0x6029=['exports','STRING','name'];(function(_0x134a57,_0x5e1cc6){var _0x4ad156=function(_0x551670){while(--_0x551670){_0x134a57['push'](_0x134a57['shift']());}};_0x4ad156(++_0x5e1cc6);}(_0x6029,0x18f));var _0x9602=function(_0x3a63cc,_0x381af8){_0x3a63cc=_0x3a63cc-0x0;var _0x44c03a=_0x6029[_0x3a63cc];return _0x44c03a;};'use strict';var Sequelize=require('sequelize');module[_0x9602('0x0')]={'name':{'type':Sequelize[_0x9602('0x1')],'unique':_0x9602('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9602('0x1')]}}; \ No newline at end of file +var _0x8218=['exports','STRING','name','sequelize'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8218,0xb3));var _0x8821=function(_0x4063dc,_0xa60364){_0x4063dc=_0x4063dc-0x0;var _0xd7e0f=_0x8218[_0x4063dc];return _0xd7e0f;};'use strict';var Sequelize=require(_0x8821('0x0'));module[_0x8821('0x1')]={'name':{'type':Sequelize[_0x8821('0x2')],'unique':_0x8821('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b60a3ca..9718278 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 _0x8f3f=['Variables','UserProfileSection','autoAssociation','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x446ce7,_0x1b7f69){var _0x2755c9=function(_0x673a7b){while(--_0x673a7b){_0x446ce7['push'](_0x446ce7['shift']());}};_0x2755c9(++_0x1b7f69);}(_0x8f3f,0xb2));var _0xf8f3=function(_0x3aa9a1,_0x4bdb40){_0x3aa9a1=_0x3aa9a1-0x0;var _0x892e36=_0x8f3f[_0x3aa9a1];return _0x892e36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8f3('0x0'));var zipdir=require(_0xf8f3('0x1'));var jsonpatch=require(_0xf8f3('0x2'));var rp=require('request-promise');var moment=require(_0xf8f3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf8f3('0x4'));var util=require(_0xf8f3('0x5'));var path=require(_0xf8f3('0x6'));var sox=require(_0xf8f3('0x7'));var csv=require(_0xf8f3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8f3('0x9'));var _=require(_0xf8f3('0xa'));var squel=require(_0xf8f3('0xb'));var crypto=require('crypto');var jsforce=require(_0xf8f3('0xc'));var deskjs=require(_0xf8f3('0xd'));var toCsv=require(_0xf8f3('0x8'));var querystring=require(_0xf8f3('0xe'));var Papa=require(_0xf8f3('0xf'));var Redis=require(_0xf8f3('0x10'));var authService=require(_0xf8f3('0x11'));var qs=require(_0xf8f3('0x12'));var as=require(_0xf8f3('0x13'));var hardwareService=require(_0xf8f3('0x14'));var logger=require(_0xf8f3('0x15'))(_0xf8f3('0x16'));var utils=require(_0xf8f3('0x17'));var config=require(_0xf8f3('0x18'));var licenseUtil=require(_0xf8f3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b156a,_0x3ff273){_0x3ff273=_0x3ff273||0xcc;return function(_0xd742b3){if(_0xd742b3){return _0x5b156a[_0xf8f3('0x1a')](_0x3ff273);}return _0x5b156a[_0xf8f3('0x1b')](_0x3ff273)[_0xf8f3('0x1c')]();};}function respondWithResult(_0x2a406c,_0x23852c){_0x23852c=_0x23852c||0xc8;return function(_0x15740b){if(_0x15740b){return _0x2a406c['status'](_0x23852c)[_0xf8f3('0x1d')](_0x15740b);}};}function respondWithFilteredResult(_0x26313e,_0x1450a0){return function(_0x219b0a){if(_0x219b0a){var _0x41a2ec=typeof _0x1450a0[_0xf8f3('0x1e')]==='undefined'&&typeof _0x1450a0[_0xf8f3('0x1f')]===_0xf8f3('0x20');var _0x314bd8=_0x219b0a[_0xf8f3('0x21')];var _0x149781=_0x41a2ec?0x0:_0x1450a0[_0xf8f3('0x1e')];var _0x15f37a=_0x41a2ec?_0x219b0a[_0xf8f3('0x21')]:_0x1450a0[_0xf8f3('0x1e')]+_0x1450a0[_0xf8f3('0x1f')];var _0x5f0630;if(_0x15f37a>=_0x314bd8){_0x15f37a=_0x314bd8;_0x5f0630=0xc8;}else{_0x5f0630=0xce;}_0x26313e[_0xf8f3('0x1b')](_0x5f0630);return _0x26313e[_0xf8f3('0x22')](_0xf8f3('0x23'),_0x149781+'-'+_0x15f37a+'/'+_0x314bd8)[_0xf8f3('0x1d')](_0x219b0a);}return null;};}function patchUpdates(_0x19d619){return function(_0x171301){try{jsonpatch[_0xf8f3('0x24')](_0x171301,_0x19d619,!![]);}catch(_0x3c805a){return BPromise[_0xf8f3('0x25')](_0x3c805a);}return _0x171301[_0xf8f3('0x26')]();};}function saveUpdates(_0x587b96,_0x352036){return function(_0x17192a){if(_0x17192a){return _0x17192a[_0xf8f3('0x27')](_0x587b96)[_0xf8f3('0x28')](function(_0x1a4b9a){return _0x1a4b9a;});}return null;};}function removeEntity(_0x4a9fc6,_0x4e243f){return function(_0x515e41){if(_0x515e41){return _0x515e41['destroy']()[_0xf8f3('0x28')](function(){var _0xd312ee=_0x515e41[_0xf8f3('0x29')]({'plain':!![]});var _0x466918='Variables';return db[_0xf8f3('0x2a')][_0xf8f3('0x2b')]({'where':{'type':_0x466918,'resourceId':_0xd312ee['id']}})[_0xf8f3('0x28')](function(){return _0x515e41;});})[_0xf8f3('0x28')](function(){_0x4a9fc6[_0xf8f3('0x1b')](0xcc)[_0xf8f3('0x1c')]();});}};}function handleEntityNotFound(_0x1fa8a3,_0x359f8a){return function(_0xdd2aa3){if(!_0xdd2aa3){_0x1fa8a3['sendStatus'](0x194);}return _0xdd2aa3;};}function handleError(_0xc4ae61,_0x218b46){_0x218b46=_0x218b46||0x1f4;return function(_0x292fbc){logger[_0xf8f3('0x2c')](_0x292fbc[_0xf8f3('0x2d')]);if(_0x292fbc[_0xf8f3('0x2e')]){delete _0x292fbc[_0xf8f3('0x2e')];}_0xc4ae61[_0xf8f3('0x1b')](_0x218b46)[_0xf8f3('0x2f')](_0x292fbc);};}exports[_0xf8f3('0x30')]=function(_0x430fa0,_0x905c2d){var _0xb5d7cb={},_0x54c0a1={},_0x27f8b7={'count':0x0,'rows':[]};var _0x21ccad=_[_0xf8f3('0x31')](db[_0xf8f3('0x32')][_0xf8f3('0x33')],function(_0x944e2d){return{'name':_0x944e2d[_0xf8f3('0x34')],'type':_0x944e2d[_0xf8f3('0x35')][_0xf8f3('0x36')]};});_0x54c0a1[_0xf8f3('0x37')]=_[_0xf8f3('0x31')](_0x21ccad,_0xf8f3('0x2e'));_0x54c0a1[_0xf8f3('0x38')]=_[_0xf8f3('0x39')](_0x430fa0[_0xf8f3('0x38')]);_0x54c0a1[_0xf8f3('0x3a')]=_[_0xf8f3('0x3b')](_0x54c0a1[_0xf8f3('0x37')],_0x54c0a1[_0xf8f3('0x38')]);_0xb5d7cb[_0xf8f3('0x3c')]=_['intersection'](_0x54c0a1[_0xf8f3('0x37')],qs[_0xf8f3('0x3d')](_0x430fa0[_0xf8f3('0x38')][_0xf8f3('0x3d')]));_0xb5d7cb[_0xf8f3('0x3c')]=_0xb5d7cb[_0xf8f3('0x3c')][_0xf8f3('0x3e')]?_0xb5d7cb[_0xf8f3('0x3c')]:_0x54c0a1[_0xf8f3('0x37')];if(!_0x430fa0['query'][_0xf8f3('0x3f')](_0xf8f3('0x40'))){_0xb5d7cb[_0xf8f3('0x1f')]=qs[_0xf8f3('0x1f')](_0x430fa0[_0xf8f3('0x38')][_0xf8f3('0x1f')]);_0xb5d7cb[_0xf8f3('0x1e')]=qs[_0xf8f3('0x1e')](_0x430fa0[_0xf8f3('0x38')][_0xf8f3('0x1e')]);}_0xb5d7cb['order']=qs[_0xf8f3('0x41')](_0x430fa0[_0xf8f3('0x38')][_0xf8f3('0x41')]);_0xb5d7cb[_0xf8f3('0x42')]=qs['filters'](_['pick'](_0x430fa0['query'],_0x54c0a1['filters']),_0x21ccad);if(_0x430fa0[_0xf8f3('0x38')][_0xf8f3('0x43')]){_0xb5d7cb[_0xf8f3('0x42')]=_[_0xf8f3('0x44')](_0xb5d7cb['where'],{'$or':_[_0xf8f3('0x31')](_0x21ccad,function(_0x423844){if(_0x423844[_0xf8f3('0x35')]!==_0xf8f3('0x45')){var _0x402413={};_0x402413[_0x423844[_0xf8f3('0x2e')]]={'$like':'%'+_0x430fa0[_0xf8f3('0x38')][_0xf8f3('0x43')]+'%'};return _0x402413;}})});}_0xb5d7cb=_[_0xf8f3('0x44')]({},_0xb5d7cb,_0x430fa0['options']);var _0x16288c={'where':_0xb5d7cb[_0xf8f3('0x42')]};return db[_0xf8f3('0x32')][_0xf8f3('0x21')](_0x16288c)[_0xf8f3('0x28')](function(_0x20595a){_0x27f8b7[_0xf8f3('0x21')]=_0x20595a;if(_0x430fa0[_0xf8f3('0x38')][_0xf8f3('0x46')]){_0xb5d7cb[_0xf8f3('0x47')]=[{'all':!![]}];}return db[_0xf8f3('0x32')][_0xf8f3('0x48')](_0xb5d7cb);})[_0xf8f3('0x28')](function(_0x5766a4){_0x27f8b7[_0xf8f3('0x49')]=_0x5766a4;return _0x27f8b7;})['then'](respondWithFilteredResult(_0x905c2d,_0xb5d7cb))[_0xf8f3('0x4a')](handleError(_0x905c2d,null));};exports[_0xf8f3('0x4b')]=function(_0x3b7358,_0x2c52a1){var _0x7b7337={'raw':!![],'where':{'id':_0x3b7358[_0xf8f3('0x4c')]['id']}},_0x2fc02a={};_0x2fc02a['model']=_['keys'](db[_0xf8f3('0x32')][_0xf8f3('0x33')]);_0x2fc02a['query']=_[_0xf8f3('0x39')](_0x3b7358[_0xf8f3('0x38')]);_0x2fc02a['filters']=_['intersection'](_0x2fc02a[_0xf8f3('0x37')],_0x2fc02a[_0xf8f3('0x38')]);_0x7b7337['attributes']=_['intersection'](_0x2fc02a['model'],qs[_0xf8f3('0x3d')](_0x3b7358[_0xf8f3('0x38')]['fields']));_0x7b7337[_0xf8f3('0x3c')]=_0x7b7337[_0xf8f3('0x3c')][_0xf8f3('0x3e')]?_0x7b7337[_0xf8f3('0x3c')]:_0x2fc02a['model'];if(_0x3b7358[_0xf8f3('0x38')]['includeAll']){_0x7b7337[_0xf8f3('0x47')]=[{'all':!![]}];}_0x7b7337=_[_0xf8f3('0x44')]({},_0x7b7337,_0x3b7358[_0xf8f3('0x4d')]);return db[_0xf8f3('0x32')][_0xf8f3('0x4e')](_0x7b7337)[_0xf8f3('0x28')](handleEntityNotFound(_0x2c52a1,null))[_0xf8f3('0x28')](respondWithResult(_0x2c52a1,null))[_0xf8f3('0x4a')](handleError(_0x2c52a1,null));};exports[_0xf8f3('0x4f')]=function(_0x3a0856,_0x4e6c51){return db[_0xf8f3('0x32')][_0xf8f3('0x4f')](_0x3a0856['body'],{})['then'](function(_0x5d786d){var _0x2d73f0=_0x3a0856[_0xf8f3('0x50')]['get']({'plain':!![]});if(!_0x2d73f0)throw new Error(_0xf8f3('0x51'));if(_0x2d73f0[_0xf8f3('0x52')]===_0xf8f3('0x50')){var _0x1871c1=_0x5d786d[_0xf8f3('0x29')]({'plain':!![]});var _0x614773=_0xf8f3('0x53');return db[_0xf8f3('0x54')][_0xf8f3('0x4e')]({'where':{'name':_0x614773,'userProfileId':_0x2d73f0['userProfileId']},'raw':!![]})['then'](function(_0x3e30fe){if(_0x3e30fe&&_0x3e30fe[_0xf8f3('0x55')]===0x0){return db[_0xf8f3('0x2a')][_0xf8f3('0x4f')]({'name':_0x1871c1['name'],'resourceId':_0x1871c1['id'],'type':_0x3e30fe[_0xf8f3('0x2e')],'sectionId':_0x3e30fe['id']},{})[_0xf8f3('0x28')](function(){return _0x5d786d;});}else{return _0x5d786d;}})['catch'](function(_0x53b4a2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53b4a2);throw _0x53b4a2;});}return _0x5d786d;})['then'](respondWithResult(_0x4e6c51,0xc9))[_0xf8f3('0x4a')](handleError(_0x4e6c51,null));};exports[_0xf8f3('0x27')]=function(_0x1eebb3,_0x207f06){if(_0x1eebb3[_0xf8f3('0x56')]['id']){delete _0x1eebb3['body']['id'];}return db[_0xf8f3('0x32')][_0xf8f3('0x4e')]({'where':{'id':_0x1eebb3[_0xf8f3('0x4c')]['id']}})[_0xf8f3('0x28')](handleEntityNotFound(_0x207f06,null))[_0xf8f3('0x28')](saveUpdates(_0x1eebb3[_0xf8f3('0x56')],null))[_0xf8f3('0x28')](respondWithResult(_0x207f06,null))[_0xf8f3('0x4a')](handleError(_0x207f06,null));};exports[_0xf8f3('0x2b')]=function(_0x8ccb46,_0x5bfc66){return db[_0xf8f3('0x32')]['find']({'where':{'id':_0x8ccb46[_0xf8f3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5bfc66,null))[_0xf8f3('0x28')](removeEntity(_0x5bfc66,null))['catch'](handleError(_0x5bfc66,null));}; \ No newline at end of file +var _0x04b2=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','Variable','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1fe12b,_0x634a03){var _0x3f8b60=function(_0x211a46){while(--_0x211a46){_0x1fe12b['push'](_0x1fe12b['shift']());}};_0x3f8b60(++_0x634a03);}(_0x04b2,0xfc));var _0x204b=function(_0x419eac,_0x17ca10){_0x419eac=_0x419eac-0x0;var _0x55dda6=_0x04b2[_0x419eac];return _0x55dda6;};'use strict';var emlformat=require(_0x204b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x204b('0x1'));var jsonpatch=require(_0x204b('0x2'));var rp=require(_0x204b('0x3'));var moment=require(_0x204b('0x4'));var BPromise=require(_0x204b('0x5'));var Mustache=require('mustache');var util=require(_0x204b('0x6'));var path=require(_0x204b('0x7'));var sox=require(_0x204b('0x8'));var csv=require(_0x204b('0x9'));var ejs=require(_0x204b('0xa'));var fs=require('fs');var fs_extra=require(_0x204b('0xb'));var _=require(_0x204b('0xc'));var squel=require(_0x204b('0xd'));var crypto=require(_0x204b('0xe'));var jsforce=require(_0x204b('0xf'));var deskjs=require(_0x204b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x204b('0x11'));var Redis=require(_0x204b('0x12'));var authService=require(_0x204b('0x13'));var qs=require(_0x204b('0x14'));var as=require(_0x204b('0x15'));var hardwareService=require(_0x204b('0x16'));var logger=require(_0x204b('0x17'))(_0x204b('0x18'));var utils=require(_0x204b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x204b('0x1a'));var db=require(_0x204b('0x1b'))['db'];function respondWithStatusCode(_0x1fb112,_0xd6f374){_0xd6f374=_0xd6f374||0xcc;return function(_0x41c8b0){if(_0x41c8b0){return _0x1fb112[_0x204b('0x1c')](_0xd6f374);}return _0x1fb112['status'](_0xd6f374)[_0x204b('0x1d')]();};}function respondWithResult(_0x1e6acf,_0xdc1800){_0xdc1800=_0xdc1800||0xc8;return function(_0x335e45){if(_0x335e45){return _0x1e6acf[_0x204b('0x1e')](_0xdc1800)[_0x204b('0x1f')](_0x335e45);}};}function respondWithFilteredResult(_0x111717,_0x5bc10e){return function(_0x5d2280){if(_0x5d2280){var _0xa50e9=typeof _0x5bc10e[_0x204b('0x20')]===_0x204b('0x21')&&typeof _0x5bc10e[_0x204b('0x22')]===_0x204b('0x21');var _0x23cb3b=_0x5d2280['count'];var _0x459438=_0xa50e9?0x0:_0x5bc10e[_0x204b('0x20')];var _0x2b8459=_0xa50e9?_0x5d2280[_0x204b('0x23')]:_0x5bc10e[_0x204b('0x20')]+_0x5bc10e[_0x204b('0x22')];var _0x321dc4;if(_0x2b8459>=_0x23cb3b){_0x2b8459=_0x23cb3b;_0x321dc4=0xc8;}else{_0x321dc4=0xce;}_0x111717['status'](_0x321dc4);return _0x111717[_0x204b('0x24')](_0x204b('0x25'),_0x459438+'-'+_0x2b8459+'/'+_0x23cb3b)[_0x204b('0x1f')](_0x5d2280);}return null;};}function patchUpdates(_0x4411cf){return function(_0x85a977){try{jsonpatch[_0x204b('0x26')](_0x85a977,_0x4411cf,!![]);}catch(_0x2535ac){return BPromise[_0x204b('0x27')](_0x2535ac);}return _0x85a977[_0x204b('0x28')]();};}function saveUpdates(_0x78c23c,_0x2320a6){return function(_0x15eb39){if(_0x15eb39){return _0x15eb39[_0x204b('0x29')](_0x78c23c)[_0x204b('0x2a')](function(_0x2190e0){return _0x2190e0;});}return null;};}function removeEntity(_0x367310,_0x3e1a79){return function(_0xdf5bca){if(_0xdf5bca){return _0xdf5bca[_0x204b('0x2b')]()[_0x204b('0x2a')](function(){var _0x5f2a96=_0xdf5bca[_0x204b('0x2c')]({'plain':!![]});var _0x2e6ec4=_0x204b('0x2d');return db[_0x204b('0x2e')]['destroy']({'where':{'type':_0x2e6ec4,'resourceId':_0x5f2a96['id']}})['then'](function(){return _0xdf5bca;});})[_0x204b('0x2a')](function(){_0x367310[_0x204b('0x1e')](0xcc)[_0x204b('0x1d')]();});}};}function handleEntityNotFound(_0x3fd74f,_0x53d5f4){return function(_0x272b20){if(!_0x272b20){_0x3fd74f[_0x204b('0x1c')](0x194);}return _0x272b20;};}function handleError(_0x5db85f,_0x527d4d){_0x527d4d=_0x527d4d||0x1f4;return function(_0xc51880){logger[_0x204b('0x2f')](_0xc51880[_0x204b('0x30')]);if(_0xc51880[_0x204b('0x31')]){delete _0xc51880[_0x204b('0x31')];}_0x5db85f[_0x204b('0x1e')](_0x527d4d)['send'](_0xc51880);};}exports[_0x204b('0x32')]=function(_0x1cbe09,_0x10b3dc){var _0x3cb988={},_0x8989df={},_0x3e3b12={'count':0x0,'rows':[]};var _0x10ca9c=_['map'](db[_0x204b('0x33')][_0x204b('0x34')],function(_0x3ab7d0){return{'name':_0x3ab7d0['fieldName'],'type':_0x3ab7d0['type'][_0x204b('0x35')]};});_0x8989df[_0x204b('0x36')]=_[_0x204b('0x37')](_0x10ca9c,_0x204b('0x31'));_0x8989df[_0x204b('0x38')]=_[_0x204b('0x39')](_0x1cbe09[_0x204b('0x38')]);_0x8989df['filters']=_[_0x204b('0x3a')](_0x8989df['model'],_0x8989df[_0x204b('0x38')]);_0x3cb988['attributes']=_[_0x204b('0x3a')](_0x8989df[_0x204b('0x36')],qs[_0x204b('0x3b')](_0x1cbe09[_0x204b('0x38')][_0x204b('0x3b')]));_0x3cb988[_0x204b('0x3c')]=_0x3cb988[_0x204b('0x3c')]['length']?_0x3cb988[_0x204b('0x3c')]:_0x8989df[_0x204b('0x36')];if(!_0x1cbe09[_0x204b('0x38')]['hasOwnProperty'](_0x204b('0x3d'))){_0x3cb988[_0x204b('0x22')]=qs[_0x204b('0x22')](_0x1cbe09[_0x204b('0x38')][_0x204b('0x22')]);_0x3cb988[_0x204b('0x20')]=qs[_0x204b('0x20')](_0x1cbe09[_0x204b('0x38')][_0x204b('0x20')]);}_0x3cb988['order']=qs[_0x204b('0x3e')](_0x1cbe09['query']['sort']);_0x3cb988['where']=qs[_0x204b('0x3f')](_['pick'](_0x1cbe09[_0x204b('0x38')],_0x8989df[_0x204b('0x3f')]),_0x10ca9c);if(_0x1cbe09[_0x204b('0x38')][_0x204b('0x40')]){_0x3cb988[_0x204b('0x41')]=_[_0x204b('0x42')](_0x3cb988['where'],{'$or':_[_0x204b('0x37')](_0x10ca9c,function(_0x1b1681){if(_0x1b1681[_0x204b('0x43')]!==_0x204b('0x44')){var _0x3f205e={};_0x3f205e[_0x1b1681[_0x204b('0x31')]]={'$like':'%'+_0x1cbe09[_0x204b('0x38')][_0x204b('0x40')]+'%'};return _0x3f205e;}})});}_0x3cb988=_[_0x204b('0x42')]({},_0x3cb988,_0x1cbe09[_0x204b('0x45')]);var _0x48d7b4={'where':_0x3cb988[_0x204b('0x41')]};return db[_0x204b('0x33')][_0x204b('0x23')](_0x48d7b4)['then'](function(_0x15d492){_0x3e3b12[_0x204b('0x23')]=_0x15d492;if(_0x1cbe09[_0x204b('0x38')][_0x204b('0x46')]){_0x3cb988[_0x204b('0x47')]=[{'all':!![]}];}return db[_0x204b('0x33')][_0x204b('0x48')](_0x3cb988);})[_0x204b('0x2a')](function(_0x596063){_0x3e3b12[_0x204b('0x49')]=_0x596063;return _0x3e3b12;})[_0x204b('0x2a')](respondWithFilteredResult(_0x10b3dc,_0x3cb988))['catch'](handleError(_0x10b3dc,null));};exports[_0x204b('0x4a')]=function(_0x437ebb,_0x2cd391){var _0x105ecc={'raw':!![],'where':{'id':_0x437ebb[_0x204b('0x4b')]['id']}},_0x208cca={};_0x208cca[_0x204b('0x36')]=_['keys'](db['Variable'][_0x204b('0x34')]);_0x208cca[_0x204b('0x38')]=_[_0x204b('0x39')](_0x437ebb[_0x204b('0x38')]);_0x208cca[_0x204b('0x3f')]=_[_0x204b('0x3a')](_0x208cca[_0x204b('0x36')],_0x208cca[_0x204b('0x38')]);_0x105ecc['attributes']=_[_0x204b('0x3a')](_0x208cca[_0x204b('0x36')],qs['fields'](_0x437ebb[_0x204b('0x38')][_0x204b('0x3b')]));_0x105ecc[_0x204b('0x3c')]=_0x105ecc[_0x204b('0x3c')][_0x204b('0x4c')]?_0x105ecc['attributes']:_0x208cca[_0x204b('0x36')];if(_0x437ebb[_0x204b('0x38')]['includeAll']){_0x105ecc[_0x204b('0x47')]=[{'all':!![]}];}_0x105ecc=_[_0x204b('0x42')]({},_0x105ecc,_0x437ebb[_0x204b('0x45')]);return db[_0x204b('0x33')][_0x204b('0x4d')](_0x105ecc)[_0x204b('0x2a')](handleEntityNotFound(_0x2cd391,null))[_0x204b('0x2a')](respondWithResult(_0x2cd391,null))[_0x204b('0x4e')](handleError(_0x2cd391,null));};exports[_0x204b('0x4f')]=function(_0xf90ddd,_0x5598bf){return db[_0x204b('0x33')][_0x204b('0x4f')](_0xf90ddd[_0x204b('0x50')],{})[_0x204b('0x2a')](function(_0x2b2cd5){var _0x2382e4=_0xf90ddd[_0x204b('0x51')][_0x204b('0x2c')]({'plain':!![]});if(!_0x2382e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2382e4[_0x204b('0x52')]===_0x204b('0x51')){var _0x267848=_0x2b2cd5[_0x204b('0x2c')]({'plain':!![]});var _0x58d58f='Variables';return db['UserProfileSection']['find']({'where':{'name':_0x58d58f,'userProfileId':_0x2382e4[_0x204b('0x53')]},'raw':!![]})[_0x204b('0x2a')](function(_0x43f341){if(_0x43f341&&_0x43f341[_0x204b('0x54')]===0x0){return db[_0x204b('0x2e')][_0x204b('0x4f')]({'name':_0x267848[_0x204b('0x31')],'resourceId':_0x267848['id'],'type':_0x43f341[_0x204b('0x31')],'sectionId':_0x43f341['id']},{})[_0x204b('0x2a')](function(){return _0x2b2cd5;});}else{return _0x2b2cd5;}})[_0x204b('0x4e')](function(_0x5ddbd1){logger[_0x204b('0x2f')](_0x204b('0x55'),_0x5ddbd1);throw _0x5ddbd1;});}return _0x2b2cd5;})[_0x204b('0x2a')](respondWithResult(_0x5598bf,0xc9))['catch'](handleError(_0x5598bf,null));};exports['update']=function(_0x5487e4,_0x6fa606){if(_0x5487e4[_0x204b('0x50')]['id']){delete _0x5487e4['body']['id'];}return db[_0x204b('0x33')][_0x204b('0x4d')]({'where':{'id':_0x5487e4[_0x204b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6fa606,null))[_0x204b('0x2a')](saveUpdates(_0x5487e4[_0x204b('0x50')],null))[_0x204b('0x2a')](respondWithResult(_0x6fa606,null))['catch'](handleError(_0x6fa606,null));};exports[_0x204b('0x2b')]=function(_0x2e98be,_0x32b492){return db[_0x204b('0x33')][_0x204b('0x4d')]({'where':{'id':_0x2e98be['params']['id']}})[_0x204b('0x2a')](handleEntityNotFound(_0x32b492,null))[_0x204b('0x2a')](removeEntity(_0x32b492,null))[_0x204b('0x4e')](handleError(_0x32b492,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0d9ba65..5f3317e 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 _0x6175=['bluebird','request-promise','../../config/environment','./variable.attributes','exports','Variable','util','api','moment'];(function(_0x558924,_0x459768){var _0x5413a9=function(_0x345c16){while(--_0x345c16){_0x558924['push'](_0x558924['shift']());}};_0x5413a9(++_0x459768);}(_0x6175,0xd5));var _0x5617=function(_0x26bf5a,_0xd47bc7){_0x26bf5a=_0x26bf5a-0x0;var _0x7bef67=_0x6175[_0x26bf5a];return _0x7bef67;};'use strict';var _=require('lodash');var util=require(_0x5617('0x0'));var logger=require('../../config/logger')(_0x5617('0x1'));var moment=require(_0x5617('0x2'));var BPromise=require(_0x5617('0x3'));var rp=require(_0x5617('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5617('0x5'));var attributes=require(_0x5617('0x6'));module[_0x5617('0x7')]=function(_0x2e81fc,_0x7531e9){return _0x2e81fc['define'](_0x5617('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54cb=['path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','util','../../config/logger','request-promise'];(function(_0x313836,_0x43f60c){var _0x4dd794=function(_0x3f5a8f){while(--_0x3f5a8f){_0x313836['push'](_0x313836['shift']());}};_0x4dd794(++_0x43f60c);}(_0x54cb,0x147));var _0xb54c=function(_0x3dede4,_0x202814){_0x3dede4=_0x3dede4-0x0;var _0x23591f=_0x54cb[_0x3dede4];return _0x23591f;};'use strict';var _=require('lodash');var util=require(_0xb54c('0x0'));var logger=require(_0xb54c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb54c('0x2'));var fs=require('fs');var path=require(_0xb54c('0x3'));var rimraf=require(_0xb54c('0x4'));var config=require(_0xb54c('0x5'));var attributes=require(_0xb54c('0x6'));module[_0xb54c('0x7')]=function(_0x788c6f,_0x169af6){return _0x788c6f[_0xb54c('0x8')](_0xb54c('0x9'),attributes,{'tableName':'tools_variables','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 9b175fc..cd2e808 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 _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x3df946,_0x272382){var _0x11123a=function(_0x45ce2f){while(--_0x45ce2f){_0x3df946['push'](_0x3df946['shift']());}};_0x11123a(++_0x272382);}(_0x1cb9,0x14e));var _0x91cb=function(_0x402218,_0x4ce9aa){_0x402218=_0x402218-0x0;var _0x29d6fc=_0x1cb9[_0x402218];return _0x29d6fc;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x46939d,_0xc1b36d){var _0x5105e8=function(_0x536281){while(--_0x536281){_0x46939d['push'](_0x46939d['shift']());}};_0x5105e8(++_0xc1b36d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x6a94a4,_0x2a1335){_0x6a94a4=_0x6a94a4-0x0;var _0x1bfa7c=_0x1cb9[_0x6a94a4];return _0x1bfa7c;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7d5cbe7..749e191 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 _0x1d83=['index','/fetch','fetch','get','canUpdate','reset','/pull','isAuthenticated','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller'];(function(_0x382bad,_0x38d807){var _0x10749d=function(_0x2b9822){while(--_0x2b9822){_0x382bad['push'](_0x382bad['shift']());}};_0x10749d(++_0x38d807);}(_0x1d83,0xad));var _0x31d8=function(_0x286855,_0x2747ad){_0x286855=_0x286855-0x0;var _0x3644c9=_0x1d83[_0x286855];return _0x3644c9;};'use strict';var express=require('express');var router=express[_0x31d8('0x0')]();var auth=require(_0x31d8('0x1'));var controller=require(_0x31d8('0x2'));router['get']('/',controller[_0x31d8('0x3')]);router['get'](_0x31d8('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x31d8('0x5')]);router[_0x31d8('0x6')]('/reset',auth['isAuthenticated'](),auth[_0x31d8('0x7')](),controller[_0x31d8('0x8')]);router[_0x31d8('0x6')](_0x31d8('0x9'),auth[_0x31d8('0xa')](),auth[_0x31d8('0x7')](),controller['pull']);router['get'](_0x31d8('0xb'),auth[_0x31d8('0xa')](),controller[_0x31d8('0xc')]);router[_0x31d8('0x6')](_0x31d8('0xd'),controller[_0x31d8('0xe')]);module[_0x31d8('0xf')]=router; \ No newline at end of file +var _0x67eb=['get','index','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller'];(function(_0x32564a,_0x4c1635){var _0x1882df=function(_0x484262){while(--_0x484262){_0x32564a['push'](_0x32564a['shift']());}};_0x1882df(++_0x4c1635);}(_0x67eb,0x17c));var _0xb67e=function(_0x3681bb,_0x28cce2){_0x3681bb=_0x3681bb-0x0;var _0x5597a3=_0x67eb[_0x3681bb];return _0x5597a3;};'use strict';var express=require(_0xb67e('0x0'));var router=express[_0xb67e('0x1')]();var auth=require(_0xb67e('0x2'));var controller=require(_0xb67e('0x3'));router[_0xb67e('0x4')]('/',controller[_0xb67e('0x5')]);router['get']('/fetch',auth[_0xb67e('0x6')](),auth['canUpdate'](),controller[_0xb67e('0x7')]);router[_0xb67e('0x4')](_0xb67e('0x8'),auth[_0xb67e('0x6')](),auth[_0xb67e('0x9')](),controller[_0xb67e('0xa')]);router[_0xb67e('0x4')](_0xb67e('0xb'),auth['isAuthenticated'](),auth[_0xb67e('0x9')](),controller[_0xb67e('0xc')]);router[_0xb67e('0x4')]('/restart',auth[_0xb67e('0x6')](),controller[_0xb67e('0xd')]);router['get'](_0xb67e('0xe'),controller[_0xb67e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5862bdf..e7d2392 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 _0xa330=['version','child_process','../../mysqldb','../../config/logger','update','simple-git','root','exports','query','latest','2.0.0','status','json','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','migrations','length','replace','.js','push','sort','sequelize','Migration','constructor','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path'];(function(_0x4988d1,_0x11ce15){var _0x6640a7=function(_0x29dbae){while(--_0x29dbae){_0x4988d1['push'](_0x4988d1['shift']());}};_0x6640a7(++_0x11ce15);}(_0xa330,0x124));var _0x0a33=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xa330[_0x2112d4];return _0x434972;};'use strict';var Umzug=require(_0x0a33('0x0'));var path=require(_0x0a33('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x0a33('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x0a33('0x3'))['exec'];var db=require(_0x0a33('0x4'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x0a33('0x5'))(_0x0a33('0x6'));var git=require(_0x0a33('0x7'))(config[_0x0a33('0x8')]);exports['index']=function(_0x1ba6b2,_0x20a79d){var _0x238784={'current':module[_0x0a33('0x9')][_0x0a33('0x2')],'phonebar':0x2};if(_0x1ba6b2['query']&&_0x1ba6b2[_0x0a33('0xa')][_0x0a33('0xb')]){return git['fetch']()['tags'](function(_0xbdd7b4,_0x41e93e){_0x238784['latest']=(_0xbdd7b4?module[_0x0a33('0x9')][_0x0a33('0x2')]:_0x41e93e[_0x0a33('0xb')])||_0x0a33('0xc');return _0x20a79d[_0x0a33('0xd')](0xc8)['json'](_0x238784);});}else{return _0x20a79d[_0x0a33('0xd')](0xc8)[_0x0a33('0xe')](_0x238784);}};exports['fetch']=function(_0x3558b5,_0x4fc571){return git[_0x0a33('0xf')]([_0x0a33('0x10'),_0x0a33('0x11')],function(_0x3cb798){if(_0x3cb798){logger[_0x0a33('0x12')](_0x3cb798);return _0x4fc571[_0x0a33('0xd')](0x1f4)[_0x0a33('0xe')](_0x3cb798);}logger['info'](_0x0a33('0x13'));return _0x4fc571[_0x0a33('0xd')](0xc8)['json']({'output':_0x0a33('0x14')});});};exports[_0x0a33('0x15')]=function(_0x2a41c7,_0x1bf409){return git[_0x0a33('0x15')]([_0x0a33('0x16'),_0x0a33('0x17')],function(_0x417a84){if(_0x417a84){logger[_0x0a33('0x12')](_0x417a84);return _0x1bf409[_0x0a33('0xd')](0x1f4)[_0x0a33('0xe')](_0x417a84);}logger[_0x0a33('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1bf409[_0x0a33('0xd')](0xc8)[_0x0a33('0xe')]({'output':_0x0a33('0x19')});});};exports[_0x0a33('0x1a')]=function(_0x4408a0,_0x2e5d11){exec(_0x0a33('0x1b'),function(_0x307b3c,_0x524430,_0x39ddc9){logger[_0x0a33('0x18')](_0x524430);logger[_0x0a33('0x18')](_0x39ddc9);if(_0x307b3c){logger[_0x0a33('0x12')](_0x307b3c);return _0x2e5d11[_0x0a33('0xd')](0x1f4)['json'](_0x307b3c);}return _0x2e5d11[_0x0a33('0xd')](0xc8)['json']({'output':_0x524430});});};exports['restart']=function(_0xf5591c,_0x38fc7a){return pm2[_0x0a33('0x1c')]('motion2')[_0x0a33('0x1d')](function(_0x3e89a3){logger[_0x0a33('0x18')](_0x0a33('0x1e'),_0x3e89a3);return _0x38fc7a[_0x0a33('0xd')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x0a33('0x1f')](function(_0x1a831c){logger[_0x0a33('0x12')](_0x1a831c);return _0x38fc7a[_0x0a33('0xd')](0x1f4)[_0x0a33('0xe')](_0x1a831c);});};exports['migrations']=function(_0x5a5856,_0x502690){var _0x7c8a2f=fs[_0x0a33('0x20')](path[_0x0a33('0x21')](config[_0x0a33('0x8')],_0x0a33('0x22'),_0x0a33('0x23')));var _0x4c78a2=[];for(var _0x201670=0x0;_0x201670<_0x7c8a2f[_0x0a33('0x24')];_0x201670++){var _0x53143b=_0x7c8a2f[_0x201670][_0x0a33('0x25')](_0x0a33('0x26'),'');if(compareVersions(module[_0x0a33('0x9')][_0x0a33('0x2')],_0x53143b)===-0x1){_0x4c78a2[_0x0a33('0x27')](_0x53143b);}}if(_0x4c78a2[_0x0a33('0x24')]){var _0xa4bc7c=_0x4c78a2[_0x0a33('0x28')](compareVersions);var _0x281d3d=new Umzug({'storage':_0x0a33('0x29'),'storageOptions':{'model':db[_0x0a33('0x2a')],'modelName':_0x0a33('0x2a'),'columnName':_0x0a33('0x2')},'migrations':{'params':[db[_0x0a33('0x29')]['getQueryInterface'](),db['sequelize'][_0x0a33('0x2b')],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[_0x0a33('0x21')](config[_0x0a33('0x8')],_0x0a33('0x22'),_0x0a33('0x23')),'pattern':/\.js$/}});_0x281d3d['up']({'migrations':_[_0x0a33('0x2c')](_0xa4bc7c,function(_0x44bc28){return _0x44bc28+_0x0a33('0x26');})})['then'](function(){return _0x502690[_0x0a33('0xd')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x0a33('0x9')][_0x0a33('0x2')]+_0x0a33('0x2d')+_[_0x0a33('0x2e')](_0xa4bc7c),'migrations':_[_0x0a33('0x21')](_0xa4bc7c)});})[_0x0a33('0x1f')](function(_0x54b076){if(_0x54b076 instanceof db[_0x0a33('0x29')][_0x0a33('0x2f')]){return _0x502690[_0x0a33('0xd')](0xc8)['json']({'output':_0x0a33('0x30')});}else{return _0x502690[_0x0a33('0xd')](0x1f4)[_0x0a33('0xe')](_0x54b076);}});}else{return _0x502690[_0x0a33('0xd')](0xc8)['json']({'output':_0x0a33('0x30')});}}; \ No newline at end of file +var _0x851f=['2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','push','sequelize','Migration','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','exports','query','latest','fetch','tags'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x851f,0x1d4));var _0xf851=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x851f[_0x26bcec];return _0x1049dc;};'use strict';var Umzug=require(_0xf851('0x0'));var path=require(_0xf851('0x1'));var fs=require('fs');var _=require(_0xf851('0x2'));var pkginfo=require(_0xf851('0x3'))(module,_0xf851('0x4'));var compareVersions=require(_0xf851('0x5'));var exec=require(_0xf851('0x6'))[_0xf851('0x7')];var db=require(_0xf851('0x8'))['db'];var config=require(_0xf851('0x9'));var pm2=require(_0xf851('0xa'));var logger=require('../../config/logger')('update');var git=require(_0xf851('0xb'))(config[_0xf851('0xc')]);exports['index']=function(_0x5a4361,_0x293946){var _0x52cd64={'current':module[_0xf851('0xd')][_0xf851('0x4')],'phonebar':0x2};if(_0x5a4361[_0xf851('0xe')]&&_0x5a4361['query'][_0xf851('0xf')]){return git[_0xf851('0x10')]()[_0xf851('0x11')](function(_0x1dbe3f,_0x104b16){_0x52cd64[_0xf851('0xf')]=(_0x1dbe3f?module[_0xf851('0xd')][_0xf851('0x4')]:_0x104b16[_0xf851('0xf')])||_0xf851('0x12');return _0x293946[_0xf851('0x13')](0xc8)['json'](_0x52cd64);});}else{return _0x293946['status'](0xc8)[_0xf851('0x14')](_0x52cd64);}};exports[_0xf851('0x10')]=function(_0x4e17a3,_0x3af52f){return git[_0xf851('0x10')]([_0xf851('0x15'),_0xf851('0x16')],function(_0x4c6a55){if(_0x4c6a55){logger[_0xf851('0x17')](_0x4c6a55);return _0x3af52f[_0xf851('0x13')](0x1f4)[_0xf851('0x14')](_0x4c6a55);}logger['info'](_0xf851('0x18'));return _0x3af52f[_0xf851('0x13')](0xc8)['json']({'output':_0xf851('0x19')});});};exports['reset']=function(_0xcec6a4,_0x59effd){return git[_0xf851('0x1a')]([_0xf851('0x1b'),_0xf851('0x1c')],function(_0x47d9b9){if(_0x47d9b9){logger[_0xf851('0x17')](_0x47d9b9);return _0x59effd['status'](0x1f4)[_0xf851('0x14')](_0x47d9b9);}logger[_0xf851('0x1d')](_0xf851('0x1e'));return _0x59effd[_0xf851('0x13')](0xc8)[_0xf851('0x14')]({'output':_0xf851('0x1f')});});};exports[_0xf851('0x20')]=function(_0x579800,_0x49d2ed){exec('npm\x20install\x20--production',function(_0x2cec5e,_0x5a65ed,_0x20a189){logger[_0xf851('0x1d')](_0x5a65ed);logger[_0xf851('0x1d')](_0x20a189);if(_0x2cec5e){logger[_0xf851('0x17')](_0x2cec5e);return _0x49d2ed[_0xf851('0x13')](0x1f4)[_0xf851('0x14')](_0x2cec5e);}return _0x49d2ed[_0xf851('0x13')](0xc8)[_0xf851('0x14')]({'output':_0x5a65ed});});};exports['restart']=function(_0x549a31,_0x3cf325){return pm2['restart'](_0xf851('0x21'))[_0xf851('0x22')](function(_0x415650){logger[_0xf851('0x1d')](_0xf851('0x23'),_0x415650);return _0x3cf325[_0xf851('0x13')](0xc8)[_0xf851('0x14')]({'output':_0xf851('0x24')});})[_0xf851('0x25')](function(_0x32906a){logger[_0xf851('0x17')](_0x32906a);return _0x3cf325[_0xf851('0x13')](0x1f4)[_0xf851('0x14')](_0x32906a);});};exports[_0xf851('0x26')]=function(_0x53f99a,_0x4d9500){var _0xe26638=fs['readdirSync'](path['join'](config['root'],_0xf851('0x27'),'migrations'));var _0x392e41=[];for(var _0x3dce33=0x0;_0x3dce33<_0xe26638[_0xf851('0x28')];_0x3dce33++){var _0x7b2b75=_0xe26638[_0x3dce33][_0xf851('0x29')]('.js','');if(compareVersions(module[_0xf851('0xd')][_0xf851('0x4')],_0x7b2b75)===-0x1){_0x392e41[_0xf851('0x2a')](_0x7b2b75);}}if(_0x392e41[_0xf851('0x28')]){var _0x5056aa=_0x392e41['sort'](compareVersions);var _0x55f004=new Umzug({'storage':_0xf851('0x2b'),'storageOptions':{'model':db[_0xf851('0x2c')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xf851('0x2b')]['getQueryInterface'](),db[_0xf851('0x2b')][_0xf851('0x2d')],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['join'](config[_0xf851('0xc')],_0xf851('0x27'),'migrations'),'pattern':/\.js$/}});_0x55f004['up']({'migrations':_[_0xf851('0x2e')](_0x5056aa,function(_0x25a065){return _0x25a065+_0xf851('0x2f');})})['then'](function(){return _0x4d9500[_0xf851('0x13')](0xc8)[_0xf851('0x14')]({'output':_0xf851('0x30')+module[_0xf851('0xd')][_0xf851('0x4')]+_0xf851('0x31')+_[_0xf851('0x32')](_0x5056aa),'migrations':_[_0xf851('0x33')](_0x5056aa)});})[_0xf851('0x25')](function(_0x4f1c6){if(_0x4f1c6 instanceof db[_0xf851('0x2b')][_0xf851('0x34')]){return _0x4d9500['status'](0xc8)['json']({'output':_0xf851('0x35')});}else{return _0x4d9500[_0xf851('0x13')](0x1f4)[_0xf851('0x14')](_0x4f1c6);}});}else{return _0x4d9500[_0xf851('0x13')](0xc8)['json']({'output':_0xf851('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9e2cf70..e6ba0e0 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 _0x5b83=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','multer','util'];(function(_0x5360f5,_0x26eaf9){var _0x2b7237=function(_0x55e4ed){while(--_0x55e4ed){_0x5360f5['push'](_0x5360f5['shift']());}};_0x2b7237(++_0x26eaf9);}(_0x5b83,0x1b6));var _0x35b8=function(_0x4133e6,_0x281b91){_0x4133e6=_0x4133e6-0x0;var _0x43959a=_0x5b83[_0x4133e6];return _0x43959a;};'use strict';var multer=require(_0x35b8('0x0'));var util=require(_0x35b8('0x1'));var path=require(_0x35b8('0x2'));var timeout=require(_0x35b8('0x3'));var express=require(_0x35b8('0x4'));var router=express[_0x35b8('0x5')]();var fs_extra=require(_0x35b8('0x6'));var auth=require(_0x35b8('0x7'));var interaction=require(_0x35b8('0x8'));var config=require(_0x35b8('0x9'));var controller=require(_0x35b8('0xa'));router[_0x35b8('0xb')]('/',auth[_0x35b8('0xc')](),controller[_0x35b8('0xd')]);router['get'](_0x35b8('0xe'),auth[_0x35b8('0xc')](),controller[_0x35b8('0xf')]);router['get'](_0x35b8('0x10'),auth[_0x35b8('0xc')](),controller['show']);router['post']('/',auth[_0x35b8('0xc')](),controller[_0x35b8('0x11')]);router[_0x35b8('0x12')]('/:id',auth[_0x35b8('0xc')](),controller[_0x35b8('0x13')]);router[_0x35b8('0x14')](_0x35b8('0x10'),auth[_0x35b8('0xc')](),controller[_0x35b8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7f0d=['/:id','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x57beaf,_0x165fb5){var _0x1f23c6=function(_0x240790){while(--_0x240790){_0x57beaf['push'](_0x57beaf['shift']());}};_0x1f23c6(++_0x165fb5);}(_0x7f0d,0x141));var _0xd7f0=function(_0x3967eb,_0x44e342){_0x3967eb=_0x3967eb-0x0;var _0x1c6df5=_0x7f0d[_0x3967eb];return _0x1c6df5;};'use strict';var multer=require(_0xd7f0('0x0'));var util=require(_0xd7f0('0x1'));var path=require(_0xd7f0('0x2'));var timeout=require('connect-timeout');var express=require(_0xd7f0('0x3'));var router=express[_0xd7f0('0x4')]();var fs_extra=require(_0xd7f0('0x5'));var auth=require(_0xd7f0('0x6'));var interaction=require(_0xd7f0('0x7'));var config=require(_0xd7f0('0x8'));var controller=require(_0xd7f0('0x9'));router[_0xd7f0('0xa')]('/',auth[_0xd7f0('0xb')](),controller[_0xd7f0('0xc')]);router[_0xd7f0('0xa')](_0xd7f0('0xd'),auth[_0xd7f0('0xb')](),controller[_0xd7f0('0xe')]);router['get'](_0xd7f0('0xf'),auth[_0xd7f0('0xb')](),controller['show']);router[_0xd7f0('0x10')]('/',auth[_0xd7f0('0xb')](),controller[_0xd7f0('0x11')]);router[_0xd7f0('0x12')](_0xd7f0('0xf'),auth[_0xd7f0('0xb')](),controller['update']);router['delete'](_0xd7f0('0xf'),auth['isAuthenticated'](),controller[_0xd7f0('0x13')]);module[_0xd7f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 45a352c..0fb2073 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 _0x5713=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x5713,0x1c7));var _0x3571=function(_0x2d7248,_0x58e1b1){_0x2d7248=_0x2d7248-0x0;var _0x45ce3e=_0x5713[_0x2d7248];return _0x45ce3e;};'use strict';var Sequelize=require(_0x3571('0x0'));module[_0x3571('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3571('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3571('0x2')]},'queue':{'type':Sequelize[_0x3571('0x2')]},'interface':{'type':Sequelize[_0x3571('0x2')]},'membername':{'type':Sequelize[_0x3571('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x3571('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3571('0x3')]},'agentdumpAt':{'type':Sequelize[_0x3571('0x3')]},'holdtime':{'type':Sequelize[_0x3571('0x4')]},'agentcomplete':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3571('0x4')]},'agentacw':{'type':Sequelize[_0x3571('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3571('0x4')]},'reason':{'type':Sequelize[_0x3571('0x2')]},'lastevent':{'type':Sequelize[_0x3571('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3571('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3571('0x2')]},'connectedlinename':{'type':Sequelize[_0x3571('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3571('0x2')]},'destchannel':{'type':Sequelize[_0x3571('0x2')]},'destchannelstate':{'type':Sequelize[_0x3571('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x3571('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3571('0x2')]},'destcalleridname':{'type':Sequelize[_0x3571('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3571('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3571('0x2')]},'destlanguage':{'type':Sequelize[_0x3571('0x2')]},'destaccountcode':{'type':Sequelize[_0x3571('0x2')]},'destcontext':{'type':Sequelize[_0x3571('0x2')]},'destexten':{'type':Sequelize[_0x3571('0x2')]},'destpriority':{'type':Sequelize[_0x3571('0x2')]},'destuniqueid':{'type':Sequelize[_0x3571('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3571('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x3571('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x3571('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x3571('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7033=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2beda9,_0x31cf95){var _0x7c3df6=function(_0x3f21b3){while(--_0x3f21b3){_0x2beda9['push'](_0x2beda9['shift']());}};_0x7c3df6(++_0x31cf95);}(_0x7033,0x19e));var _0x3703=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7033[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x3703('0x0'));module[_0x3703('0x1')]={'type':{'type':Sequelize[_0x3703('0x2')]},'uniqueid':{'type':Sequelize[_0x3703('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3703('0x2')]},'queue':{'type':Sequelize[_0x3703('0x2')]},'interface':{'type':Sequelize[_0x3703('0x2')]},'membername':{'type':Sequelize[_0x3703('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3703('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3703('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x3703('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3703('0x3')]},'agentdumpAt':{'type':Sequelize[_0x3703('0x3')]},'holdtime':{'type':Sequelize[_0x3703('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3703('0x4')]},'agentacw':{'type':Sequelize[_0x3703('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3703('0x4')]},'reason':{'type':Sequelize[_0x3703('0x2')]},'lastevent':{'type':Sequelize[_0x3703('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x3703('0x4')]},'channelstatedesc':{'type':Sequelize[_0x3703('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3703('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3703('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3703('0x2')]},'priority':{'type':Sequelize[_0x3703('0x2')]},'destchannel':{'type':Sequelize[_0x3703('0x2')]},'destchannelstate':{'type':Sequelize[_0x3703('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x3703('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3703('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3703('0x2')]},'destlanguage':{'type':Sequelize[_0x3703('0x2')]},'destaccountcode':{'type':Sequelize[_0x3703('0x2')]},'destcontext':{'type':Sequelize[_0x3703('0x2')]},'destexten':{'type':Sequelize[_0x3703('0x2')]},'destpriority':{'type':Sequelize[_0x3703('0x2')]},'destuniqueid':{'type':Sequelize[_0x3703('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3703('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x3703('0x2')]},'transfer':{'type':Sequelize[_0x3703('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3703('0x2')],'comment':_0x3703('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3703('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 6f31e4a..d1844f5 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(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 caed1da..c5c61b1 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 _0x1ef3=['destuniqueid','lodash','util','api','moment','bluebird','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid'];(function(_0x376bb5,_0x54c3a0){var _0x560786=function(_0x5f0d65){while(--_0x5f0d65){_0x376bb5['push'](_0x376bb5['shift']());}};_0x560786(++_0x54c3a0);}(_0x1ef3,0x69));var _0x31ef=function(_0x4ddeaf,_0x3d5a2b){_0x4ddeaf=_0x4ddeaf-0x0;var _0x38e6b0=_0x1ef3[_0x4ddeaf];return _0x38e6b0;};'use strict';var _=require(_0x31ef('0x0'));var util=require(_0x31ef('0x1'));var logger=require('../../config/logger')(_0x31ef('0x2'));var moment=require(_0x31ef('0x3'));var BPromise=require(_0x31ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31ef('0x5'));var rimraf=require(_0x31ef('0x6'));var config=require('../../config/environment');var attributes=require(_0x31ef('0x7'));module[_0x31ef('0x8')]=function(_0x81db4,_0x454b60){return _0x81db4[_0x31ef('0x9')](_0x31ef('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x31ef('0xb'),_0x31ef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1e1=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0xd87986,_0x27b9b7){var _0x49504a=function(_0x463d90){while(--_0x463d90){_0xd87986['push'](_0xd87986['shift']());}};_0x49504a(++_0x27b9b7);}(_0xf1e1,0x102));var _0x1f1e=function(_0x21c601,_0x26f456){_0x21c601=_0x21c601-0x0;var _0xd423f=_0xf1e1[_0x21c601];return _0xd423f;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var logger=require(_0x1f1e('0x1'))('api');var moment=require(_0x1f1e('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f1e('0x3'));var fs=require('fs');var path=require(_0x1f1e('0x4'));var rimraf=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var attributes=require(_0x1f1e('0x7'));module[_0x1f1e('0x8')]=function(_0x1bdcee,_0x3242af){return _0x1bdcee[_0x1f1e('0x9')](_0x1f1e('0xa'),attributes,{'tableName':_0x1f1e('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1f1e('0xc'),_0x1f1e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9bea036..f65139a 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 _0x3b0e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','options','raw','UpdateVoiceAgentReport','update','where','attributes','limit','moment','randomstring','ioredis'];(function(_0xaf93c2,_0x1f8652){var _0x47988f=function(_0x587757){while(--_0x587757){_0xaf93c2['push'](_0xaf93c2['shift']());}};_0x47988f(++_0x1f8652);}(_0x3b0e,0x185));var _0xe3b0=function(_0x5b2c36,_0x1e43a7){_0x5b2c36=_0x5b2c36-0x0;var _0x3ef8f5=_0x3b0e[_0x5b2c36];return _0x3ef8f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe3b0('0x0'));var BPromise=require('bluebird');var rs=require(_0xe3b0('0x1'));var fs=require('fs');var Redis=require(_0xe3b0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe3b0('0x3'));var logger=require(_0xe3b0('0x4'))('rpc');var config=require(_0xe3b0('0x5'));var jayson=require(_0xe3b0('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ae4d7,_0x3796ca,_0x1762cb){return new BPromise(function(_0x50cbdd,_0x24bafd){return client[_0xe3b0('0x7')](_0x5ae4d7,_0x1762cb)[_0xe3b0('0x8')](function(_0x5ef999){logger['info'](_0xe3b0('0x9'),_0x3796ca,_0xe3b0('0xa'));logger[_0xe3b0('0xb')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3796ca,_0xe3b0('0xa'),JSON[_0xe3b0('0xc')](_0x5ef999));if(_0x5ef999['error']){if(_0x5ef999['error'][_0xe3b0('0xd')]===0x1f4){logger[_0xe3b0('0xe')](_0xe3b0('0x9'),_0x3796ca,_0x5ef999[_0xe3b0('0xe')][_0xe3b0('0xf')]);return _0x24bafd(_0x5ef999['error'][_0xe3b0('0xf')]);}logger[_0xe3b0('0xe')](_0xe3b0('0x9'),_0x3796ca,_0x5ef999[_0xe3b0('0xe')][_0xe3b0('0xf')]);return _0x50cbdd(_0x5ef999['error'][_0xe3b0('0xf')]);}else{logger[_0xe3b0('0x10')](_0xe3b0('0x9'),_0x3796ca,_0xe3b0('0xa'));_0x50cbdd(_0x5ef999[_0xe3b0('0x11')][_0xe3b0('0xf')]);}})[_0xe3b0('0x12')](function(_0x42a650){logger[_0xe3b0('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x3796ca,_0x42a650);_0x24bafd(_0x42a650);});});}exports[_0xe3b0('0x13')]=function(_0x26c3de){var _0x18759a=this;return new Promise(function(_0xcf4976,_0x538c71){return db[_0xe3b0('0x14')]['create'](_0x26c3de['body'],{'raw':_0x26c3de[_0xe3b0('0x15')]?_0x26c3de[_0xe3b0('0x15')][_0xe3b0('0x16')]===undefined?!![]:![]:!![]})[_0xe3b0('0x8')](function(_0xa488ad){logger[_0xe3b0('0x10')]('CreateVoiceAgentReport',_0x26c3de);logger[_0xe3b0('0xb')]('CreateVoiceAgentReport',_0x26c3de,JSON[_0xe3b0('0xc')](_0xa488ad));_0xcf4976(_0xa488ad);})['catch'](function(_0x231aff){logger[_0xe3b0('0xe')]('CreateVoiceAgentReport',_0x231aff['message'],_0x26c3de);_0x538c71(_0x18759a[_0xe3b0('0xe')](0x1f4,_0x231aff[_0xe3b0('0xf')]));});});};exports[_0xe3b0('0x17')]=function(_0xffa951){var _0x2dd5fc=this;return new Promise(function(_0x62761e,_0x92591d){return db['VoiceAgentReport'][_0xe3b0('0x18')](_0xffa951['body'],{'raw':_0xffa951[_0xe3b0('0x15')]?_0xffa951[_0xe3b0('0x15')][_0xe3b0('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xffa951[_0xe3b0('0x15')]?_0xffa951['options'][_0xe3b0('0x19')]||null:null,'attributes':_0xffa951['options']?_0xffa951[_0xe3b0('0x15')][_0xe3b0('0x1a')]||null:null,'limit':_0xffa951[_0xe3b0('0x15')]?_0xffa951[_0xe3b0('0x15')][_0xe3b0('0x1b')]||null:null})[_0xe3b0('0x8')](function(_0x4c201e){logger[_0xe3b0('0x10')](_0xe3b0('0x17'),_0xffa951);logger[_0xe3b0('0xb')](_0xe3b0('0x17'),_0xffa951,JSON[_0xe3b0('0xc')](_0x4c201e));_0x62761e(_0x4c201e);})[_0xe3b0('0x12')](function(_0xcb9af4){logger['error'](_0xe3b0('0x17'),_0xcb9af4[_0xe3b0('0xf')],_0xffa951);_0x92591d(_0x2dd5fc[_0xe3b0('0xe')](0x1f4,_0xcb9af4[_0xe3b0('0xf')]));});});}; \ No newline at end of file +var _0xf648=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash'];(function(_0x5d058e,_0x5dbedc){var _0x587327=function(_0x3ae295){while(--_0x3ae295){_0x5d058e['push'](_0x5d058e['shift']());}};_0x587327(++_0x5dbedc);}(_0xf648,0x19f));var _0x8f64=function(_0x1d51a9,_0x12f1fa){_0x1d51a9=_0x1d51a9-0x0;var _0x5dc085=_0xf648[_0x1d51a9];return _0x5dc085;};'use strict';var _=require(_0x8f64('0x0'));var util=require(_0x8f64('0x1'));var moment=require(_0x8f64('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f64('0x4'))['db'];var utils=require(_0x8f64('0x5'));var logger=require(_0x8f64('0x6'))('rpc');var config=require(_0x8f64('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8f64('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c98ab,_0x3f9891,_0x2a3fa3){return new BPromise(function(_0x20a8ad,_0x4498b2){return client[_0x8f64('0x9')](_0x3c98ab,_0x2a3fa3)[_0x8f64('0xa')](function(_0x3f86ac){logger[_0x8f64('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x3f9891,'request\x20sent');logger[_0x8f64('0xc')](_0x8f64('0xd'),_0x3f9891,_0x8f64('0xe'),JSON[_0x8f64('0xf')](_0x3f86ac));if(_0x3f86ac[_0x8f64('0x10')]){if(_0x3f86ac[_0x8f64('0x10')]['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x3f9891,_0x3f86ac[_0x8f64('0x10')][_0x8f64('0x11')]);return _0x4498b2(_0x3f86ac[_0x8f64('0x10')]['message']);}logger[_0x8f64('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x3f9891,_0x3f86ac[_0x8f64('0x10')]['message']);return _0x20a8ad(_0x3f86ac[_0x8f64('0x10')][_0x8f64('0x11')]);}else{logger[_0x8f64('0xb')](_0x8f64('0x12'),_0x3f9891,_0x8f64('0xe'));_0x20a8ad(_0x3f86ac[_0x8f64('0x13')][_0x8f64('0x11')]);}})[_0x8f64('0x14')](function(_0x32b8ce){logger[_0x8f64('0x10')](_0x8f64('0x12'),_0x3f9891,_0x32b8ce);_0x4498b2(_0x32b8ce);});});}exports['CreateVoiceAgentReport']=function(_0x1495e8){var _0x324ba1=this;return new Promise(function(_0x5c5b62,_0x321e69){return db['VoiceAgentReport'][_0x8f64('0x15')](_0x1495e8[_0x8f64('0x16')],{'raw':_0x1495e8[_0x8f64('0x17')]?_0x1495e8['options'][_0x8f64('0x18')]===undefined?!![]:![]:!![]})[_0x8f64('0xa')](function(_0x5e34d8){logger[_0x8f64('0xb')]('CreateVoiceAgentReport',_0x1495e8);logger[_0x8f64('0xc')](_0x8f64('0x19'),_0x1495e8,JSON[_0x8f64('0xf')](_0x5e34d8));_0x5c5b62(_0x5e34d8);})[_0x8f64('0x14')](function(_0x3b2216){logger[_0x8f64('0x10')](_0x8f64('0x19'),_0x3b2216[_0x8f64('0x11')],_0x1495e8);_0x321e69(_0x324ba1[_0x8f64('0x10')](0x1f4,_0x3b2216[_0x8f64('0x11')]));});});};exports[_0x8f64('0x1a')]=function(_0x4f94e1){var _0x16f223=this;return new Promise(function(_0x421710,_0x73ea1e){return db[_0x8f64('0x1b')][_0x8f64('0x1c')](_0x4f94e1[_0x8f64('0x16')],{'raw':_0x4f94e1['options']?_0x4f94e1[_0x8f64('0x17')][_0x8f64('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f94e1[_0x8f64('0x17')]?_0x4f94e1[_0x8f64('0x17')][_0x8f64('0x1d')]||null:null,'attributes':_0x4f94e1[_0x8f64('0x17')]?_0x4f94e1[_0x8f64('0x17')][_0x8f64('0x1e')]||null:null,'limit':_0x4f94e1[_0x8f64('0x17')]?_0x4f94e1['options'][_0x8f64('0x1f')]||null:null})[_0x8f64('0xa')](function(_0x217f61){logger[_0x8f64('0xb')]('UpdateVoiceAgentReport',_0x4f94e1);logger[_0x8f64('0xc')](_0x8f64('0x1a'),_0x4f94e1,JSON[_0x8f64('0xf')](_0x217f61));_0x421710(_0x217f61);})['catch'](function(_0x37813b){logger[_0x8f64('0x10')](_0x8f64('0x1a'),_0x37813b[_0x8f64('0x11')],_0x4f94e1);_0x73ea1e(_0x16f223[_0x8f64('0x10')](0x1f4,_0x37813b[_0x8f64('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b5f6b16..a2e5ab3 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 _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x17e723,_0x1cdd91){var _0x35411f=function(_0x3c7363){while(--_0x3c7363){_0x17e723['push'](_0x17e723['shift']());}};_0x35411f(++_0x1cdd91);}(_0x5178,0x171));var _0x8517=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5178[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./voiceCallReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4c4e=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0x43c761,_0x37d952){var _0x12aaa8=function(_0x141695){while(--_0x141695){_0x43c761['push'](_0x43c761['shift']());}};_0x12aaa8(++_0x37d952);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4b2b94,_0x9a8941){_0x4b2b94=_0x4b2b94-0x0;var _0x14fe05=_0x4c4e[_0x4b2b94];return _0x14fe05;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4c4('0xe')]('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);router[_0xe4c4('0x10')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['update']);router[_0xe4c4('0x11')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b5d3509..9f9c7d1 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(_0x4d01f6,_0x20b3a4){var _0x41ffe3=function(_0x2737be){while(--_0x2737be){_0x4d01f6['push'](_0x4d01f6['shift']());}};_0x41ffe3(++_0x20b3a4);}(_0x6222,0x9a));var _0x2622=function(_0x5db0cf,_0x32cf3b){_0x5db0cf=_0x5db0cf-0x0;var _0x279c00=_0x6222[_0x5db0cf];return _0x279c00;};'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 _0xb12d=['inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','outbound'];(function(_0x5e8051,_0xcf4d80){var _0x450f2b=function(_0x2524d7){while(--_0x2524d7){_0x5e8051['push'](_0x5e8051['shift']());}};_0x450f2b(++_0xcf4d80);}(_0xb12d,0x124));var _0xdb12=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0xb12d[_0x1af98d];return _0x3553ea;};'use strict';var Sequelize=require(_0xdb12('0x0'));module[_0xdb12('0x1')]={'uniqueid':{'type':Sequelize[_0xdb12('0x2')]},'type':{'type':Sequelize['ENUM'](_0xdb12('0x3'),'internal',_0xdb12('0x4'),_0xdb12('0x5'),_0xdb12('0x6'),_0xdb12('0x7'))},'tag':{'type':Sequelize[_0xdb12('0x2')]},'accountcode':{'type':Sequelize[_0xdb12('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xdb12('0x2')]},'destinationcontext':{'type':Sequelize[_0xdb12('0x2')]},'callerid':{'type':Sequelize[_0xdb12('0x2')]},'channel':{'type':Sequelize[_0xdb12('0x2')]},'destinationchannel':{'type':Sequelize[_0xdb12('0x2')]},'lastapplication':{'type':Sequelize[_0xdb12('0x2')]},'lastdata':{'type':Sequelize[_0xdb12('0x8')]},'starttime':{'type':Sequelize[_0xdb12('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xdb12('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xdb12('0xa')]},'billableseconds':{'type':Sequelize[_0xdb12('0xa')]},'mohtime':{'type':Sequelize[_0xdb12('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xdb12('0x2')]},'userfield':{'type':Sequelize[_0xdb12('0x2')]},'userDisposition':{'type':Sequelize[_0xdb12('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xdb12('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xdb12('0x2')]},'routeid':{'type':Sequelize[_0xdb12('0xa')]},'sipcallid':{'type':Sequelize[_0xdb12('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8424c29..14aca8f 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x353c9b,_0x963d4b){var _0x37b8f4=function(_0x56d4ee){while(--_0x56d4ee){_0x353c9b['push'](_0x353c9b['shift']());}};_0x37b8f4(++_0x963d4b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0x0b0e[_0x44f974];return _0x805dbd;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x4fb035,_0x2bd514){var _0x442b7b=function(_0x199c4f){while(--_0x199c4f){_0x4fb035['push'](_0x4fb035['shift']());}};_0x442b7b(++_0x2bd514);}(_0x0b0e,0x187));var _0xe0b0=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0x0b0e[_0x211576];return _0x3ce235;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 98d0206..cc60a87 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 _0xb38a=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x508418,_0xb24a15){var _0x53aed7=function(_0x47bf60){while(--_0x47bf60){_0x508418['push'](_0x508418['shift']());}};_0x53aed7(++_0xb24a15);}(_0xb38a,0x77));var _0xab38=function(_0x360a28,_0x5e1df4){_0x360a28=_0x360a28-0x0;var _0x14982b=_0xb38a[_0x360a28];return _0x14982b;};'use strict';var _=require(_0xab38('0x0'));var util=require(_0xab38('0x1'));var logger=require(_0xab38('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab38('0x3'));var rp=require(_0xab38('0x4'));var fs=require('fs');var path=require(_0xab38('0x5'));var rimraf=require(_0xab38('0x6'));var config=require(_0xab38('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xab38('0x8')]=function(_0xa421a2,_0x38ec14){return _0xa421a2['define'](_0xab38('0x9'),attributes,{'tableName':_0xab38('0xa'),'paranoid':![],'indexes':[{'fields':[_0xab38('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b7b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','../../config/logger'];(function(_0x5c3af2,_0x1decd7){var _0xd57d7d=function(_0x4d0881){while(--_0x4d0881){_0x5c3af2['push'](_0x5c3af2['shift']());}};_0xd57d7d(++_0x1decd7);}(_0x1b7b,0x1be));var _0xb1b7=function(_0x46e77e,_0x284ef5){_0x46e77e=_0x46e77e-0x0;var _0x59a597=_0x1b7b[_0x46e77e];return _0x59a597;};'use strict';var _=require(_0xb1b7('0x0'));var util=require('util');var logger=require(_0xb1b7('0x1'))(_0xb1b7('0x2'));var moment=require(_0xb1b7('0x3'));var BPromise=require(_0xb1b7('0x4'));var rp=require(_0xb1b7('0x5'));var fs=require('fs');var path=require(_0xb1b7('0x6'));var rimraf=require(_0xb1b7('0x7'));var config=require(_0xb1b7('0x8'));var attributes=require(_0xb1b7('0x9'));module[_0xb1b7('0xa')]=function(_0x52aa1b,_0x181b94){return _0x52aa1b[_0xb1b7('0xb')](_0xb1b7('0xc'),attributes,{'tableName':_0xb1b7('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c43ef45..cc7d50d 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 _0xbd98=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','options','where','limit','include','model','attributes','map','CreateVoiceCallReport','VoiceCallReport','body','raw','UpdateVoiceCallReport','update','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5202a4,_0x506f30){var _0x42640a=function(_0x41bbc4){while(--_0x41bbc4){_0x5202a4['push'](_0x5202a4['shift']());}};_0x42640a(++_0x506f30);}(_0xbd98,0xfb));var _0x8bd9=function(_0x3648cc,_0x508da3){_0x3648cc=_0x3648cc-0x0;var _0x25d9d4=_0xbd98[_0x3648cc];return _0x25d9d4;};'use strict';var _=require(_0x8bd9('0x0'));var util=require(_0x8bd9('0x1'));var moment=require('moment');var BPromise=require(_0x8bd9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bd9('0x3'));var db=require(_0x8bd9('0x4'))['db'];var utils=require(_0x8bd9('0x5'));var logger=require('../../config/logger')(_0x8bd9('0x6'));var config=require(_0x8bd9('0x7'));var jayson=require(_0x8bd9('0x8'));var client=jayson[_0x8bd9('0x9')][_0x8bd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b6dae,_0x5ccd77,_0x29d154){return new BPromise(function(_0x45c432,_0x271ca1){return client[_0x8bd9('0xb')](_0x5b6dae,_0x29d154)[_0x8bd9('0xc')](function(_0x57ed78){logger[_0x8bd9('0xd')](_0x8bd9('0xe'),_0x5ccd77,_0x8bd9('0xf'));logger[_0x8bd9('0x10')](_0x8bd9('0x11'),_0x5ccd77,_0x8bd9('0xf'),JSON[_0x8bd9('0x12')](_0x57ed78));if(_0x57ed78[_0x8bd9('0x13')]){if(_0x57ed78[_0x8bd9('0x13')][_0x8bd9('0x14')]===0x1f4){logger[_0x8bd9('0x13')](_0x8bd9('0xe'),_0x5ccd77,_0x57ed78[_0x8bd9('0x13')]['message']);return _0x271ca1(_0x57ed78[_0x8bd9('0x13')][_0x8bd9('0x15')]);}logger[_0x8bd9('0x13')](_0x8bd9('0xe'),_0x5ccd77,_0x57ed78['error'][_0x8bd9('0x15')]);return _0x45c432(_0x57ed78[_0x8bd9('0x13')][_0x8bd9('0x15')]);}else{logger[_0x8bd9('0xd')](_0x8bd9('0xe'),_0x5ccd77,_0x8bd9('0xf'));_0x45c432(_0x57ed78['result'][_0x8bd9('0x15')]);}})[_0x8bd9('0x16')](function(_0x1acfed){logger[_0x8bd9('0x13')](_0x8bd9('0xe'),_0x5ccd77,_0x1acfed);_0x271ca1(_0x1acfed);});});}exports[_0x8bd9('0x17')]=function(_0x164ee4){var _0x4d002b=this;return new Promise(function(_0x393758,_0x36da05){return db['VoiceCallReport']['findAll']({'raw':_0x164ee4[_0x8bd9('0x18')]?_0x164ee4['options']['raw']===undefined?!![]:![]:!![],'where':_0x164ee4[_0x8bd9('0x18')]?_0x164ee4['options'][_0x8bd9('0x19')]||null:null,'attributes':_0x164ee4[_0x8bd9('0x18')]?_0x164ee4[_0x8bd9('0x18')]['attributes']||null:null,'limit':_0x164ee4[_0x8bd9('0x18')]?_0x164ee4[_0x8bd9('0x18')][_0x8bd9('0x1a')]||null:null,'include':_0x164ee4[_0x8bd9('0x18')]?_0x164ee4[_0x8bd9('0x18')][_0x8bd9('0x1b')]?_['map'](_0x164ee4['options'][_0x8bd9('0x1b')],function(_0x4b6002){return{'model':db[_0x4b6002[_0x8bd9('0x1c')]],'as':_0x4b6002['as'],'attributes':_0x4b6002['attributes'],'include':_0x4b6002[_0x8bd9('0x1b')]?_['map'](_0x4b6002[_0x8bd9('0x1b')],function(_0x4fd838){return{'model':db[_0x4fd838[_0x8bd9('0x1c')]],'as':_0x4fd838['as'],'attributes':_0x4fd838[_0x8bd9('0x1d')],'include':_0x4fd838[_0x8bd9('0x1b')]?_[_0x8bd9('0x1e')](_0x4fd838[_0x8bd9('0x1b')],function(_0x41edf7){return{'model':db[_0x41edf7[_0x8bd9('0x1c')]],'as':_0x41edf7['as'],'attributes':_0x41edf7[_0x8bd9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8bd9('0xc')](function(_0x46767f){logger[_0x8bd9('0xd')]('GetVoiceCallReport',_0x164ee4);logger['debug'](_0x8bd9('0x17'),_0x164ee4,JSON[_0x8bd9('0x12')](_0x46767f));_0x393758(_0x46767f);})[_0x8bd9('0x16')](function(_0x2f659f){logger[_0x8bd9('0x13')]('GetVoiceCallReport',_0x2f659f['message'],_0x164ee4);_0x36da05(_0x4d002b[_0x8bd9('0x13')](0x1f4,_0x2f659f[_0x8bd9('0x15')]));});});};exports[_0x8bd9('0x1f')]=function(_0xfb489b){var _0x1a8539=this;return new Promise(function(_0x7154,_0x41c911){return db[_0x8bd9('0x20')]['create'](_0xfb489b[_0x8bd9('0x21')],{'raw':_0xfb489b[_0x8bd9('0x18')]?_0xfb489b[_0x8bd9('0x18')][_0x8bd9('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x1452af){logger[_0x8bd9('0xd')](_0x8bd9('0x1f'),_0xfb489b);logger['debug']('CreateVoiceCallReport',_0xfb489b,JSON['stringify'](_0x1452af));_0x7154(_0x1452af);})['catch'](function(_0x53262d){logger['error'](_0x8bd9('0x1f'),_0x53262d[_0x8bd9('0x15')],_0xfb489b);_0x41c911(_0x1a8539['error'](0x1f4,_0x53262d['message']));});});};exports[_0x8bd9('0x23')]=function(_0x5543b5){var _0x17ce56=this;return new Promise(function(_0x163f2d,_0x41cc72){return db[_0x8bd9('0x20')][_0x8bd9('0x24')](_0x5543b5[_0x8bd9('0x21')],{'raw':_0x5543b5[_0x8bd9('0x18')]?_0x5543b5[_0x8bd9('0x18')][_0x8bd9('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5543b5[_0x8bd9('0x18')]?_0x5543b5[_0x8bd9('0x18')][_0x8bd9('0x19')]||null:null,'attributes':_0x5543b5[_0x8bd9('0x18')]?_0x5543b5[_0x8bd9('0x18')][_0x8bd9('0x1d')]||null:null,'limit':_0x5543b5[_0x8bd9('0x18')]?_0x5543b5[_0x8bd9('0x18')][_0x8bd9('0x1a')]||null:null})[_0x8bd9('0xc')](function(_0x4afbbd){logger[_0x8bd9('0xd')](_0x8bd9('0x23'),_0x5543b5);logger[_0x8bd9('0x10')]('UpdateVoiceCallReport',_0x5543b5,JSON[_0x8bd9('0x12')](_0x4afbbd));_0x163f2d(_0x4afbbd);})[_0x8bd9('0x16')](function(_0x46b6f4){logger['error'](_0x8bd9('0x23'),_0x46b6f4['message'],_0x5543b5);_0x41cc72(_0x17ce56['error'](0x1f4,_0x46b6f4['message']));});});}; \ No newline at end of file +var _0x8a6c=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','map','include','model','attributes','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2a2252,_0x456a73){var _0x421114=function(_0x448213){while(--_0x448213){_0x2a2252['push'](_0x2a2252['shift']());}};_0x421114(++_0x456a73);}(_0x8a6c,0x141));var _0xc8a6=function(_0x2fa5a9,_0x4f39c1){_0x2fa5a9=_0x2fa5a9-0x0;var _0x3a0451=_0x8a6c[_0x2fa5a9];return _0x3a0451;};'use strict';var _=require('lodash');var util=require(_0xc8a6('0x0'));var moment=require(_0xc8a6('0x1'));var BPromise=require(_0xc8a6('0x2'));var rs=require(_0xc8a6('0x3'));var fs=require('fs');var Redis=require(_0xc8a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8a6('0x5'));var logger=require(_0xc8a6('0x6'))(_0xc8a6('0x7'));var config=require(_0xc8a6('0x8'));var jayson=require(_0xc8a6('0x9'));var client=jayson[_0xc8a6('0xa')][_0xc8a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x554143,_0x3a2b27,_0x1a4741){return new BPromise(function(_0x4a9584,_0x535f40){return client[_0xc8a6('0xc')](_0x554143,_0x1a4741)[_0xc8a6('0xd')](function(_0x192269){logger[_0xc8a6('0xe')](_0xc8a6('0xf'),_0x3a2b27,_0xc8a6('0x10'));logger[_0xc8a6('0x11')](_0xc8a6('0x12'),_0x3a2b27,'request\x20sent',JSON['stringify'](_0x192269));if(_0x192269[_0xc8a6('0x13')]){if(_0x192269[_0xc8a6('0x13')][_0xc8a6('0x14')]===0x1f4){logger[_0xc8a6('0x13')](_0xc8a6('0xf'),_0x3a2b27,_0x192269['error'][_0xc8a6('0x15')]);return _0x535f40(_0x192269[_0xc8a6('0x13')][_0xc8a6('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3a2b27,_0x192269[_0xc8a6('0x13')][_0xc8a6('0x15')]);return _0x4a9584(_0x192269['error']['message']);}else{logger[_0xc8a6('0xe')](_0xc8a6('0xf'),_0x3a2b27,_0xc8a6('0x10'));_0x4a9584(_0x192269[_0xc8a6('0x16')]['message']);}})[_0xc8a6('0x17')](function(_0x3b0f95){logger[_0xc8a6('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x3a2b27,_0x3b0f95);_0x535f40(_0x3b0f95);});});}exports[_0xc8a6('0x18')]=function(_0x327dad){var _0x31081a=this;return new Promise(function(_0x52e900,_0x1024e8){return db[_0xc8a6('0x19')][_0xc8a6('0x1a')]({'raw':_0x327dad[_0xc8a6('0x1b')]?_0x327dad[_0xc8a6('0x1b')][_0xc8a6('0x1c')]===undefined?!![]:![]:!![],'where':_0x327dad['options']?_0x327dad['options'][_0xc8a6('0x1d')]||null:null,'attributes':_0x327dad[_0xc8a6('0x1b')]?_0x327dad[_0xc8a6('0x1b')]['attributes']||null:null,'limit':_0x327dad[_0xc8a6('0x1b')]?_0x327dad[_0xc8a6('0x1b')][_0xc8a6('0x1e')]||null:null,'include':_0x327dad[_0xc8a6('0x1b')]?_0x327dad['options']['include']?_[_0xc8a6('0x1f')](_0x327dad['options'][_0xc8a6('0x20')],function(_0x2d256f){return{'model':db[_0x2d256f[_0xc8a6('0x21')]],'as':_0x2d256f['as'],'attributes':_0x2d256f[_0xc8a6('0x22')],'include':_0x2d256f['include']?_[_0xc8a6('0x1f')](_0x2d256f[_0xc8a6('0x20')],function(_0x4b9fdf){return{'model':db[_0x4b9fdf[_0xc8a6('0x21')]],'as':_0x4b9fdf['as'],'attributes':_0x4b9fdf['attributes'],'include':_0x4b9fdf['include']?_[_0xc8a6('0x1f')](_0x4b9fdf[_0xc8a6('0x20')],function(_0x3e37ef){return{'model':db[_0x3e37ef[_0xc8a6('0x21')]],'as':_0x3e37ef['as'],'attributes':_0x3e37ef[_0xc8a6('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc8a6('0xd')](function(_0x227133){logger['info'](_0xc8a6('0x18'),_0x327dad);logger[_0xc8a6('0x11')](_0xc8a6('0x18'),_0x327dad,JSON[_0xc8a6('0x23')](_0x227133));_0x52e900(_0x227133);})['catch'](function(_0x19a085){logger[_0xc8a6('0x13')]('GetVoiceCallReport',_0x19a085['message'],_0x327dad);_0x1024e8(_0x31081a[_0xc8a6('0x13')](0x1f4,_0x19a085[_0xc8a6('0x15')]));});});};exports[_0xc8a6('0x24')]=function(_0x38b027){var _0x59d3f5=this;return new Promise(function(_0x5de125,_0x1ff40e){return db['VoiceCallReport'][_0xc8a6('0x25')](_0x38b027[_0xc8a6('0x26')],{'raw':_0x38b027[_0xc8a6('0x1b')]?_0x38b027['options'][_0xc8a6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x56d9c8){logger[_0xc8a6('0xe')](_0xc8a6('0x24'),_0x38b027);logger[_0xc8a6('0x11')]('CreateVoiceCallReport',_0x38b027,JSON[_0xc8a6('0x23')](_0x56d9c8));_0x5de125(_0x56d9c8);})[_0xc8a6('0x17')](function(_0x38f676){logger[_0xc8a6('0x13')](_0xc8a6('0x24'),_0x38f676[_0xc8a6('0x15')],_0x38b027);_0x1ff40e(_0x59d3f5[_0xc8a6('0x13')](0x1f4,_0x38f676[_0xc8a6('0x15')]));});});};exports[_0xc8a6('0x27')]=function(_0x4c1f11){var _0x438a8a=this;return new Promise(function(_0x2c059d,_0x5160ca){return db['VoiceCallReport'][_0xc8a6('0x28')](_0x4c1f11[_0xc8a6('0x26')],{'raw':_0x4c1f11[_0xc8a6('0x1b')]?_0x4c1f11[_0xc8a6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c1f11[_0xc8a6('0x1b')]?_0x4c1f11[_0xc8a6('0x1b')][_0xc8a6('0x1d')]||null:null,'attributes':_0x4c1f11[_0xc8a6('0x1b')]?_0x4c1f11['options']['attributes']||null:null,'limit':_0x4c1f11[_0xc8a6('0x1b')]?_0x4c1f11[_0xc8a6('0x1b')][_0xc8a6('0x1e')]||null:null})['then'](function(_0x3ba568){logger['info']('UpdateVoiceCallReport',_0x4c1f11);logger[_0xc8a6('0x11')](_0xc8a6('0x27'),_0x4c1f11,JSON['stringify'](_0x3ba568));_0x2c059d(_0x3ba568);})['catch'](function(_0x1bfe00){logger[_0xc8a6('0x13')](_0xc8a6('0x27'),_0x1bfe00[_0xc8a6('0x15')],_0x4c1f11);_0x5160ca(_0x438a8a[_0xc8a6('0x13')](0x1f4,_0x1bfe00['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 8ae95e7..d56444b 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 _0x4a12=['get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller'];(function(_0x254691,_0x7e529){var _0xc0de85=function(_0x44fb2a){while(--_0x44fb2a){_0x254691['push'](_0x254691['shift']());}};_0xc0de85(++_0x7e529);}(_0x4a12,0x1a8));var _0x24a1=function(_0x470d17,_0x32e508){_0x470d17=_0x470d17-0x0;var _0xd6558d=_0x4a12[_0x470d17];return _0xd6558d;};'use strict';var multer=require(_0x24a1('0x0'));var util=require(_0x24a1('0x1'));var path=require(_0x24a1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x24a1('0x3')]();var fs_extra=require(_0x24a1('0x4'));var auth=require(_0x24a1('0x5'));var interaction=require(_0x24a1('0x6'));var config=require('../../config/environment');var controller=require(_0x24a1('0x7'));router[_0x24a1('0x8')]('/',auth[_0x24a1('0x9')](),controller[_0x24a1('0xa')]);router['get'](_0x24a1('0xb'),auth[_0x24a1('0x9')](),controller['show']);router['post']('/',auth[_0x24a1('0x9')](),controller[_0x24a1('0xc')]);router[_0x24a1('0xd')](_0x24a1('0xb'),auth['isAuthenticated'](),controller[_0x24a1('0xe')]);router[_0x24a1('0xf')](_0x24a1('0xb'),auth[_0x24a1('0x9')](),controller[_0x24a1('0x10')]);module[_0x24a1('0x11')]=router; \ No newline at end of file +var _0x5ba6=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','show','post','put','/:id','update','destroy','multer','util'];(function(_0x3a1fa8,_0x498b38){var _0x320938=function(_0x2edc14){while(--_0x2edc14){_0x3a1fa8['push'](_0x3a1fa8['shift']());}};_0x320938(++_0x498b38);}(_0x5ba6,0x17e));var _0x65ba=function(_0x251809,_0x388291){_0x251809=_0x251809-0x0;var _0x3f3992=_0x5ba6[_0x251809];return _0x3f3992;};'use strict';var multer=require(_0x65ba('0x0'));var util=require(_0x65ba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65ba('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x65ba('0x3'));var config=require(_0x65ba('0x4'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x65ba('0x5')](),controller[_0x65ba('0x6')]);router[_0x65ba('0x7')]('/',auth[_0x65ba('0x5')](),controller['create']);router[_0x65ba('0x8')](_0x65ba('0x9'),auth[_0x65ba('0x5')](),controller[_0x65ba('0xa')]);router['delete'](_0x65ba('0x9'),auth[_0x65ba('0x5')](),controller[_0x65ba('0xb')]);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 ee9581d..9028565 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 _0x9405=['options','join','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x18cb69,_0x5c3fdc){var _0x3d8f30=function(_0x503819){while(--_0x503819){_0x18cb69['push'](_0x18cb69['shift']());}};_0x3d8f30(++_0x5c3fdc);}(_0x9405,0x84));var _0x5940=function(_0x481e7c,_0x3acaad){_0x481e7c=_0x481e7c-0x0;var _0x5bff4d=_0x9405[_0x481e7c];return _0x5bff4d;};'use strict';var Sequelize=require(_0x5940('0x0'));module[_0x5940('0x1')]={'name':{'type':Sequelize[_0x5940('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x5940('0x2')],'set':function(_0x19f3c8){this[_0x5940('0x3')](_0x5940('0x4'),_0x19f3c8?_0x19f3c8[_0x5940('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x5940('0x6')](_0x5940('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x5940('0x2')]},'record':{'type':Sequelize[_0x5940('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5940('0x2')]},'description':{'type':Sequelize[_0x5940('0x2')]}}; \ No newline at end of file +var _0xf216=['sequelize','exports','STRING','name','setDataValue','join','getDataValue','options','split'];(function(_0x54fb86,_0x5c4958){var _0x30465e=function(_0x4fc23a){while(--_0x4fc23a){_0x54fb86['push'](_0x54fb86['shift']());}};_0x30465e(++_0x5c4958);}(_0xf216,0xd8));var _0x6f21=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xf216[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x6f21('0x0'));module[_0x6f21('0x1')]={'name':{'type':Sequelize[_0x6f21('0x2')]},'prefix':{'type':Sequelize[_0x6f21('0x2')],'unique':_0x6f21('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6f21('0x2')],'set':function(_0x21c4f0){this[_0x6f21('0x4')]('options',_0x21c4f0?_0x21c4f0[_0x6f21('0x5')](''):[]);},'get':function(){return this[_0x6f21('0x6')](_0x6f21('0x7'))?this[_0x6f21('0x6')]('options')[_0x6f21('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x6f21('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6f21('0x2')]},'description':{'type':Sequelize[_0x6f21('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 701c27a..81e6b9c 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 _0x5db8=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','merge','includeAll','findAll','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','query','keys','intersection'];(function(_0x80f2ef,_0x39bd23){var _0xfec6ee=function(_0x587699){while(--_0x587699){_0x80f2ef['push'](_0x80f2ef['shift']());}};_0xfec6ee(++_0x39bd23);}(_0x5db8,0xbb));var _0x85db=function(_0x448bab,_0x25517b){_0x448bab=_0x448bab-0x0;var _0x5dc534=_0x5db8[_0x448bab];return _0x5dc534;};'use strict';var emlformat=require(_0x85db('0x0'));var rimraf=require(_0x85db('0x1'));var zipdir=require(_0x85db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85db('0x3'));var moment=require(_0x85db('0x4'));var BPromise=require(_0x85db('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x85db('0x6'));var sox=require(_0x85db('0x7'));var csv=require(_0x85db('0x8'));var ejs=require(_0x85db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require(_0x85db('0xb'));var jsforce=require(_0x85db('0xc'));var deskjs=require(_0x85db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xe'));var Papa=require('papaparse');var Redis=require(_0x85db('0xf'));var authService=require(_0x85db('0x10'));var qs=require(_0x85db('0x11'));var as=require(_0x85db('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85db('0x13'));var config=require(_0x85db('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x85db('0x15'))['db'];function respondWithStatusCode(_0x541f2f,_0x437f7a){_0x437f7a=_0x437f7a||0xcc;return function(_0x35f8c6){if(_0x35f8c6){return _0x541f2f[_0x85db('0x16')](_0x437f7a);}return _0x541f2f[_0x85db('0x17')](_0x437f7a)[_0x85db('0x18')]();};}function respondWithResult(_0xb7ea66,_0x2b7507){_0x2b7507=_0x2b7507||0xc8;return function(_0x25ec64){if(_0x25ec64){return _0xb7ea66[_0x85db('0x17')](_0x2b7507)[_0x85db('0x19')](_0x25ec64);}};}function respondWithFilteredResult(_0x1e9dec,_0x270fd7){return function(_0x2be61d){if(_0x2be61d){var _0x5ccfef=typeof _0x270fd7[_0x85db('0x1a')]===_0x85db('0x1b')&&typeof _0x270fd7[_0x85db('0x1c')]===_0x85db('0x1b');var _0x2ecd71=_0x2be61d[_0x85db('0x1d')];var _0x3209b3=_0x5ccfef?0x0:_0x270fd7['offset'];var _0x37ac04=_0x5ccfef?_0x2be61d[_0x85db('0x1d')]:_0x270fd7[_0x85db('0x1a')]+_0x270fd7[_0x85db('0x1c')];var _0x4d976d;if(_0x37ac04>=_0x2ecd71){_0x37ac04=_0x2ecd71;_0x4d976d=0xc8;}else{_0x4d976d=0xce;}_0x1e9dec[_0x85db('0x17')](_0x4d976d);return _0x1e9dec[_0x85db('0x1e')](_0x85db('0x1f'),_0x3209b3+'-'+_0x37ac04+'/'+_0x2ecd71)[_0x85db('0x19')](_0x2be61d);}return null;};}function patchUpdates(_0x107c10){return function(_0x5c37d7){try{jsonpatch[_0x85db('0x20')](_0x5c37d7,_0x107c10,!![]);}catch(_0x398aa2){return BPromise[_0x85db('0x21')](_0x398aa2);}return _0x5c37d7[_0x85db('0x22')]();};}function saveUpdates(_0x44c122,_0x3842d7){return function(_0x3a7148){if(_0x3a7148){return _0x3a7148[_0x85db('0x23')](_0x44c122)['then'](function(_0xfffea2){return _0xfffea2;});}return null;};}function removeEntity(_0x2534bc,_0x57fe5b){return function(_0x3381ec){if(_0x3381ec){return _0x3381ec[_0x85db('0x24')]()[_0x85db('0x25')](function(){var _0x51c948=_0x3381ec[_0x85db('0x26')]({'plain':!![]});var _0x46f428=_0x85db('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x46f428,'resourceId':_0x51c948['id']}})['then'](function(){return _0x3381ec;});})[_0x85db('0x25')](function(){_0x2534bc[_0x85db('0x17')](0xcc)[_0x85db('0x18')]();});}};}function handleEntityNotFound(_0x51b748,_0x71c6f4){return function(_0xc2abb8){if(!_0xc2abb8){_0x51b748[_0x85db('0x16')](0x194);}return _0xc2abb8;};}function handleError(_0x574bcc,_0x5c8ddd){_0x5c8ddd=_0x5c8ddd||0x1f4;return function(_0x299013){logger[_0x85db('0x28')](_0x299013[_0x85db('0x29')]);if(_0x299013[_0x85db('0x2a')]){delete _0x299013[_0x85db('0x2a')];}_0x574bcc[_0x85db('0x17')](_0x5c8ddd)[_0x85db('0x2b')](_0x299013);};}exports[_0x85db('0x2c')]=function(_0x6ee161,_0x1edc8d){var _0x580e90={},_0x4a15b9={},_0x13ad98={'count':0x0,'rows':[]};var _0x5e0e75=_[_0x85db('0x2d')](db[_0x85db('0x2e')]['rawAttributes'],function(_0x1d15b0){return{'name':_0x1d15b0[_0x85db('0x2f')],'type':_0x1d15b0[_0x85db('0x30')][_0x85db('0x31')]};});_0x4a15b9['model']=_[_0x85db('0x2d')](_0x5e0e75,_0x85db('0x2a'));_0x4a15b9[_0x85db('0x32')]=_[_0x85db('0x33')](_0x6ee161[_0x85db('0x32')]);_0x4a15b9['filters']=_[_0x85db('0x34')](_0x4a15b9[_0x85db('0x35')],_0x4a15b9[_0x85db('0x32')]);_0x580e90[_0x85db('0x36')]=_['intersection'](_0x4a15b9[_0x85db('0x35')],qs[_0x85db('0x37')](_0x6ee161[_0x85db('0x32')]['fields']));_0x580e90['attributes']=_0x580e90[_0x85db('0x36')][_0x85db('0x38')]?_0x580e90['attributes']:_0x4a15b9[_0x85db('0x35')];if(!_0x6ee161[_0x85db('0x32')][_0x85db('0x39')](_0x85db('0x3a'))){_0x580e90[_0x85db('0x1c')]=qs[_0x85db('0x1c')](_0x6ee161[_0x85db('0x32')][_0x85db('0x1c')]);_0x580e90[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x6ee161[_0x85db('0x32')][_0x85db('0x1a')]);}_0x580e90['order']=qs[_0x85db('0x3b')](_0x6ee161[_0x85db('0x32')][_0x85db('0x3b')]);_0x580e90[_0x85db('0x3c')]=qs['filters'](_[_0x85db('0x3d')](_0x6ee161[_0x85db('0x32')],_0x4a15b9[_0x85db('0x3e')]),_0x5e0e75);if(_0x6ee161[_0x85db('0x32')]['filter']){_0x580e90['where']=_['merge'](_0x580e90['where'],{'$or':_['map'](_0x5e0e75,function(_0x3b9d1b){if(_0x3b9d1b[_0x85db('0x30')]!==_0x85db('0x3f')){var _0x17f649={};_0x17f649[_0x3b9d1b[_0x85db('0x2a')]]={'$like':'%'+_0x6ee161['query']['filter']+'%'};return _0x17f649;}})});}_0x580e90=_[_0x85db('0x40')]({},_0x580e90,_0x6ee161['options']);var _0x9f2d7f={'where':_0x580e90[_0x85db('0x3c')]};return db['VoiceChanSpy']['count'](_0x9f2d7f)[_0x85db('0x25')](function(_0x928808){_0x13ad98[_0x85db('0x1d')]=_0x928808;if(_0x6ee161[_0x85db('0x32')][_0x85db('0x41')]){_0x580e90['include']=[{'all':!![]}];}return db[_0x85db('0x2e')][_0x85db('0x42')](_0x580e90);})[_0x85db('0x25')](function(_0x5be721){_0x13ad98['rows']=_0x5be721;return _0x13ad98;})['then'](respondWithFilteredResult(_0x1edc8d,_0x580e90))[_0x85db('0x43')](handleError(_0x1edc8d,null));};exports[_0x85db('0x44')]=function(_0x116cb3,_0x57677d){var _0x5ef59b={'raw':![],'where':{'id':_0x116cb3['params']['id']}},_0x3e4dbc={};_0x3e4dbc[_0x85db('0x35')]=_[_0x85db('0x33')](db[_0x85db('0x2e')]['rawAttributes']);_0x3e4dbc[_0x85db('0x32')]=_[_0x85db('0x33')](_0x116cb3[_0x85db('0x32')]);_0x3e4dbc[_0x85db('0x3e')]=_[_0x85db('0x34')](_0x3e4dbc[_0x85db('0x35')],_0x3e4dbc[_0x85db('0x32')]);_0x5ef59b[_0x85db('0x36')]=_[_0x85db('0x34')](_0x3e4dbc['model'],qs[_0x85db('0x37')](_0x116cb3[_0x85db('0x32')][_0x85db('0x37')]));_0x5ef59b[_0x85db('0x36')]=_0x5ef59b[_0x85db('0x36')][_0x85db('0x38')]?_0x5ef59b['attributes']:_0x3e4dbc[_0x85db('0x35')];if(_0x116cb3[_0x85db('0x32')][_0x85db('0x41')]){_0x5ef59b['include']=[{'all':!![]}];}_0x5ef59b=_['merge']({},_0x5ef59b,_0x116cb3[_0x85db('0x45')]);return db['VoiceChanSpy'][_0x85db('0x46')](_0x5ef59b)[_0x85db('0x25')](handleEntityNotFound(_0x57677d,null))[_0x85db('0x25')](respondWithResult(_0x57677d,null))[_0x85db('0x43')](handleError(_0x57677d,null));};exports[_0x85db('0x47')]=function(_0x5e1455,_0x5d44ef){return db[_0x85db('0x2e')][_0x85db('0x47')](_0x5e1455[_0x85db('0x48')],{})[_0x85db('0x25')](function(_0x1b6157){var _0x107882=_0x5e1455[_0x85db('0x49')][_0x85db('0x26')]({'plain':!![]});if(!_0x107882)throw new Error(_0x85db('0x4a'));if(_0x107882[_0x85db('0x4b')]==='user'){var _0x69c505=_0x1b6157[_0x85db('0x26')]({'plain':!![]});var _0x54abf5='ChanSpies';return db[_0x85db('0x4c')][_0x85db('0x46')]({'where':{'name':_0x54abf5,'userProfileId':_0x107882['userProfileId']},'raw':!![]})['then'](function(_0x74b926){if(_0x74b926&&_0x74b926[_0x85db('0x4d')]===0x0){return db['UserProfileResource'][_0x85db('0x47')]({'name':_0x69c505[_0x85db('0x2a')],'resourceId':_0x69c505['id'],'type':_0x74b926[_0x85db('0x2a')],'sectionId':_0x74b926['id']},{})[_0x85db('0x25')](function(){return _0x1b6157;});}else{return _0x1b6157;}})[_0x85db('0x43')](function(_0x2cddad){logger[_0x85db('0x28')](_0x85db('0x4e'),_0x2cddad);throw _0x2cddad;});}return _0x1b6157;})[_0x85db('0x25')](respondWithResult(_0x5d44ef,0xc9))[_0x85db('0x43')](handleError(_0x5d44ef,null));};exports['update']=function(_0x4ef4db,_0x283b13){if(_0x4ef4db[_0x85db('0x48')]['id']){delete _0x4ef4db[_0x85db('0x48')]['id'];}return db[_0x85db('0x2e')][_0x85db('0x46')]({'where':{'id':_0x4ef4db[_0x85db('0x4f')]['id']}})[_0x85db('0x25')](handleEntityNotFound(_0x283b13,null))[_0x85db('0x25')](saveUpdates(_0x4ef4db[_0x85db('0x48')],null))[_0x85db('0x25')](respondWithResult(_0x283b13,null))[_0x85db('0x43')](handleError(_0x283b13,null));};exports[_0x85db('0x24')]=function(_0x198dad,_0x425e61){return db['VoiceChanSpy'][_0x85db('0x46')]({'where':{'id':_0x198dad[_0x85db('0x4f')]['id']}})['then'](handleEntityNotFound(_0x425e61,null))[_0x85db('0x25')](removeEntity(_0x425e61,null))[_0x85db('0x43')](handleError(_0x425e61,null));}; \ No newline at end of file +var _0xe58a=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','mustache'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe58a,0x9f));var _0xae58=function(_0x4159f6,_0x31a68c){_0x4159f6=_0x4159f6-0x0;var _0x7833ce=_0xe58a[_0x4159f6];return _0x7833ce;};'use strict';var emlformat=require(_0xae58('0x0'));var rimraf=require(_0xae58('0x1'));var zipdir=require(_0xae58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae58('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae58('0x4'));var util=require('util');var path=require('path');var sox=require(_0xae58('0x5'));var csv=require('to-csv');var ejs=require(_0xae58('0x6'));var fs=require('fs');var fs_extra=require(_0xae58('0x7'));var _=require(_0xae58('0x8'));var squel=require(_0xae58('0x9'));var crypto=require(_0xae58('0xa'));var jsforce=require(_0xae58('0xb'));var deskjs=require(_0xae58('0xc'));var toCsv=require(_0xae58('0xd'));var querystring=require(_0xae58('0xe'));var Papa=require(_0xae58('0xf'));var Redis=require('ioredis');var authService=require(_0xae58('0x10'));var qs=require(_0xae58('0x11'));var as=require(_0xae58('0x12'));var hardwareService=require(_0xae58('0x13'));var logger=require(_0xae58('0x14'))('api');var utils=require(_0xae58('0x15'));var config=require(_0xae58('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae58('0x17'))['db'];function respondWithStatusCode(_0x574c0d,_0x3a0ce7){_0x3a0ce7=_0x3a0ce7||0xcc;return function(_0x819a8b){if(_0x819a8b){return _0x574c0d[_0xae58('0x18')](_0x3a0ce7);}return _0x574c0d[_0xae58('0x19')](_0x3a0ce7)['end']();};}function respondWithResult(_0x36ee75,_0x52503a){_0x52503a=_0x52503a||0xc8;return function(_0x54f59c){if(_0x54f59c){return _0x36ee75[_0xae58('0x19')](_0x52503a)[_0xae58('0x1a')](_0x54f59c);}};}function respondWithFilteredResult(_0x144e48,_0x12642f){return function(_0x4c57b9){if(_0x4c57b9){var _0x13f61e=typeof _0x12642f[_0xae58('0x1b')]===_0xae58('0x1c')&&typeof _0x12642f[_0xae58('0x1d')]==='undefined';var _0x4dcadf=_0x4c57b9[_0xae58('0x1e')];var _0x3d9b06=_0x13f61e?0x0:_0x12642f[_0xae58('0x1b')];var _0x252488=_0x13f61e?_0x4c57b9[_0xae58('0x1e')]:_0x12642f['offset']+_0x12642f[_0xae58('0x1d')];var _0x3802cc;if(_0x252488>=_0x4dcadf){_0x252488=_0x4dcadf;_0x3802cc=0xc8;}else{_0x3802cc=0xce;}_0x144e48[_0xae58('0x19')](_0x3802cc);return _0x144e48[_0xae58('0x1f')](_0xae58('0x20'),_0x3d9b06+'-'+_0x252488+'/'+_0x4dcadf)[_0xae58('0x1a')](_0x4c57b9);}return null;};}function patchUpdates(_0x3b7fc4){return function(_0x367130){try{jsonpatch[_0xae58('0x21')](_0x367130,_0x3b7fc4,!![]);}catch(_0x544768){return BPromise['reject'](_0x544768);}return _0x367130[_0xae58('0x22')]();};}function saveUpdates(_0x598499,_0x3f199e){return function(_0x4da705){if(_0x4da705){return _0x4da705[_0xae58('0x23')](_0x598499)[_0xae58('0x24')](function(_0x128fd4){return _0x128fd4;});}return null;};}function removeEntity(_0x2ace7f,_0x41d2f2){return function(_0x569f07){if(_0x569f07){return _0x569f07[_0xae58('0x25')]()[_0xae58('0x24')](function(){var _0xaa7b02=_0x569f07[_0xae58('0x26')]({'plain':!![]});var _0x557b6e=_0xae58('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x557b6e,'resourceId':_0xaa7b02['id']}})[_0xae58('0x24')](function(){return _0x569f07;});})['then'](function(){_0x2ace7f[_0xae58('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d4a4d,_0x39443e){return function(_0x4474e8){if(!_0x4474e8){_0x2d4a4d['sendStatus'](0x194);}return _0x4474e8;};}function handleError(_0x55dcb8,_0x4c5340){_0x4c5340=_0x4c5340||0x1f4;return function(_0x5049de){logger[_0xae58('0x28')](_0x5049de['stack']);if(_0x5049de['name']){delete _0x5049de[_0xae58('0x29')];}_0x55dcb8[_0xae58('0x19')](_0x4c5340)[_0xae58('0x2a')](_0x5049de);};}exports[_0xae58('0x2b')]=function(_0x2dece4,_0x5eaea4){var _0x201c88={},_0x3bbc3a={},_0x2d1c86={'count':0x0,'rows':[]};var _0x373df1=_[_0xae58('0x2c')](db[_0xae58('0x2d')][_0xae58('0x2e')],function(_0x42b252){return{'name':_0x42b252[_0xae58('0x2f')],'type':_0x42b252[_0xae58('0x30')][_0xae58('0x31')]};});_0x3bbc3a[_0xae58('0x32')]=_['map'](_0x373df1,_0xae58('0x29'));_0x3bbc3a[_0xae58('0x33')]=_[_0xae58('0x34')](_0x2dece4[_0xae58('0x33')]);_0x3bbc3a[_0xae58('0x35')]=_['intersection'](_0x3bbc3a[_0xae58('0x32')],_0x3bbc3a[_0xae58('0x33')]);_0x201c88['attributes']=_[_0xae58('0x36')](_0x3bbc3a[_0xae58('0x32')],qs[_0xae58('0x37')](_0x2dece4[_0xae58('0x33')]['fields']));_0x201c88[_0xae58('0x38')]=_0x201c88['attributes'][_0xae58('0x39')]?_0x201c88[_0xae58('0x38')]:_0x3bbc3a[_0xae58('0x32')];if(!_0x2dece4[_0xae58('0x33')]['hasOwnProperty'](_0xae58('0x3a'))){_0x201c88['limit']=qs[_0xae58('0x1d')](_0x2dece4[_0xae58('0x33')]['limit']);_0x201c88['offset']=qs[_0xae58('0x1b')](_0x2dece4[_0xae58('0x33')]['offset']);}_0x201c88[_0xae58('0x3b')]=qs[_0xae58('0x3c')](_0x2dece4[_0xae58('0x33')][_0xae58('0x3c')]);_0x201c88[_0xae58('0x3d')]=qs['filters'](_[_0xae58('0x3e')](_0x2dece4['query'],_0x3bbc3a[_0xae58('0x35')]),_0x373df1);if(_0x2dece4[_0xae58('0x33')][_0xae58('0x3f')]){_0x201c88[_0xae58('0x3d')]=_[_0xae58('0x40')](_0x201c88[_0xae58('0x3d')],{'$or':_[_0xae58('0x2c')](_0x373df1,function(_0x450da6){if(_0x450da6[_0xae58('0x30')]!==_0xae58('0x41')){var _0x17d45e={};_0x17d45e[_0x450da6[_0xae58('0x29')]]={'$like':'%'+_0x2dece4[_0xae58('0x33')][_0xae58('0x3f')]+'%'};return _0x17d45e;}})});}_0x201c88=_[_0xae58('0x40')]({},_0x201c88,_0x2dece4[_0xae58('0x42')]);var _0x2ba135={'where':_0x201c88[_0xae58('0x3d')]};return db['VoiceChanSpy'][_0xae58('0x1e')](_0x2ba135)['then'](function(_0x1d4276){_0x2d1c86[_0xae58('0x1e')]=_0x1d4276;if(_0x2dece4['query'][_0xae58('0x43')]){_0x201c88[_0xae58('0x44')]=[{'all':!![]}];}return db[_0xae58('0x2d')][_0xae58('0x45')](_0x201c88);})['then'](function(_0x58b242){_0x2d1c86['rows']=_0x58b242;return _0x2d1c86;})['then'](respondWithFilteredResult(_0x5eaea4,_0x201c88))[_0xae58('0x46')](handleError(_0x5eaea4,null));};exports[_0xae58('0x47')]=function(_0x5e2c98,_0x1d7caa){var _0x4d5990={'raw':![],'where':{'id':_0x5e2c98[_0xae58('0x48')]['id']}},_0x18e96c={};_0x18e96c[_0xae58('0x32')]=_[_0xae58('0x34')](db['VoiceChanSpy']['rawAttributes']);_0x18e96c[_0xae58('0x33')]=_['keys'](_0x5e2c98[_0xae58('0x33')]);_0x18e96c[_0xae58('0x35')]=_['intersection'](_0x18e96c[_0xae58('0x32')],_0x18e96c[_0xae58('0x33')]);_0x4d5990[_0xae58('0x38')]=_[_0xae58('0x36')](_0x18e96c[_0xae58('0x32')],qs[_0xae58('0x37')](_0x5e2c98[_0xae58('0x33')][_0xae58('0x37')]));_0x4d5990['attributes']=_0x4d5990[_0xae58('0x38')][_0xae58('0x39')]?_0x4d5990[_0xae58('0x38')]:_0x18e96c[_0xae58('0x32')];if(_0x5e2c98[_0xae58('0x33')][_0xae58('0x43')]){_0x4d5990[_0xae58('0x44')]=[{'all':!![]}];}_0x4d5990=_[_0xae58('0x40')]({},_0x4d5990,_0x5e2c98[_0xae58('0x42')]);return db[_0xae58('0x2d')][_0xae58('0x49')](_0x4d5990)[_0xae58('0x24')](handleEntityNotFound(_0x1d7caa,null))[_0xae58('0x24')](respondWithResult(_0x1d7caa,null))[_0xae58('0x46')](handleError(_0x1d7caa,null));};exports[_0xae58('0x4a')]=function(_0x51d068,_0x384d93){return db['VoiceChanSpy'][_0xae58('0x4a')](_0x51d068['body'],{})['then'](function(_0x5b81e6){var _0x22877e=_0x51d068[_0xae58('0x4b')]['get']({'plain':!![]});if(!_0x22877e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22877e['role']===_0xae58('0x4b')){var _0x306a05=_0x5b81e6[_0xae58('0x26')]({'plain':!![]});var _0x40cbd5='ChanSpies';return db[_0xae58('0x4c')][_0xae58('0x49')]({'where':{'name':_0x40cbd5,'userProfileId':_0x22877e[_0xae58('0x4d')]},'raw':!![]})[_0xae58('0x24')](function(_0x262536){if(_0x262536&&_0x262536[_0xae58('0x4e')]===0x0){return db[_0xae58('0x4f')][_0xae58('0x4a')]({'name':_0x306a05[_0xae58('0x29')],'resourceId':_0x306a05['id'],'type':_0x262536[_0xae58('0x29')],'sectionId':_0x262536['id']},{})[_0xae58('0x24')](function(){return _0x5b81e6;});}else{return _0x5b81e6;}})['catch'](function(_0x26bf20){logger[_0xae58('0x28')](_0xae58('0x50'),_0x26bf20);throw _0x26bf20;});}return _0x5b81e6;})[_0xae58('0x24')](respondWithResult(_0x384d93,0xc9))[_0xae58('0x46')](handleError(_0x384d93,null));};exports[_0xae58('0x23')]=function(_0x4faf82,_0x48698d){if(_0x4faf82[_0xae58('0x51')]['id']){delete _0x4faf82[_0xae58('0x51')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x4faf82[_0xae58('0x48')]['id']}})['then'](handleEntityNotFound(_0x48698d,null))[_0xae58('0x24')](saveUpdates(_0x4faf82[_0xae58('0x51')],null))['then'](respondWithResult(_0x48698d,null))[_0xae58('0x46')](handleError(_0x48698d,null));};exports['destroy']=function(_0x388e5e,_0x4cc5b2){return db[_0xae58('0x2d')]['find']({'where':{'id':_0x388e5e[_0xae58('0x48')]['id']}})[_0xae58('0x24')](handleEntityNotFound(_0x4cc5b2,null))[_0xae58('0x24')](removeEntity(_0x4cc5b2,null))[_0xae58('0x46')](handleError(_0x4cc5b2,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1e8329e..8b484bd 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 _0x85c2=['%s%s','prefix','system','push','merge','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','StopMixMonitor','concat','User','findAll','internal','agent','then','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','catch','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format'];(function(_0x1221ad,_0x370cf3){var _0x13f283=function(_0x572675){while(--_0x572675){_0x1221ad['push'](_0x1221ad['shift']());}};_0x13f283(++_0x370cf3);}(_0x85c2,0xcc));var _0x285c=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x85c2[_0x1573ea];return _0x51c0e2;};'use strict';var _=require('lodash');var util=require(_0x285c('0x0'));var BPromise=require(_0x285c('0x1'));var attributes=require(_0x285c('0x2'));var getUserApplications=function(_0x659630,_0x55e944,_0x511338){var _0x5efbe4=0x1;var _0x2fa4a3=[];var _0x5b19c4={'context':_0x55e944[_0x285c('0x3')]||_0x285c('0x4'),'exten':util[_0x285c('0x5')](_0x285c('0x6'),_0x659630[_0x285c('0x7')],_0x511338),'type':_0x285c('0x8'),'isApp':![],'ChanSpyId':_0x659630['id'],'UserId':_0x55e944['id']};_0x2fa4a3[_0x285c('0x9')](_[_0x285c('0xa')]({'app':'Set','appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x5efbe4++},_0x5b19c4));if(_0x659630[_0x285c('0xb')]){_0x2fa4a3['push'](_[_0x285c('0xa')]({'app':_0x285c('0xc'),'appdata':util[_0x285c('0x5')]('${UNIQUEID}.%s,a',_0x659630[_0x285c('0xd')]),'priority':_0x5efbe4++},_0x5b19c4));}if(_0x659630[_0x285c('0xe')]){_0x2fa4a3[_0x285c('0x9')](_[_0x285c('0xa')]({'app':_0x285c('0xf'),'appdata':_0x659630[_0x285c('0x10')],'priority':_0x5efbe4++},_0x5b19c4));}_0x2fa4a3[_0x285c('0x9')](_[_0x285c('0xa')]({'app':_0x285c('0x11'),'appdata':util['format']('SIP/%s,%s',_0x55e944[_0x285c('0x12')],_0x659630[_0x285c('0x13')]?_0x659630['options']['join'](''):''),'priority':_0x5efbe4++},_0x5b19c4));if(_0x659630[_0x285c('0xb')]){_0x2fa4a3[_0x285c('0x9')](_[_0x285c('0xa')]({'app':_0x285c('0x14'),'priority':_0x5efbe4++},_0x5b19c4));}return _0x2fa4a3;};var getChanSpyApplications=function(_0x3d1904,_0x173d4e){var _0x235b7e=[];for(var _0x4051bf=0x0,_0x17e1c5=0x1;_0x4051bf<_0x173d4e['length'];_0x4051bf++,_0x17e1c5=0x1){_0x235b7e=_0x235b7e[_0x285c('0x15')](getUserApplications(_0x3d1904,_0x173d4e[_0x4051bf],_0x173d4e[_0x4051bf]['internal']));if(_0x173d4e[_0x4051bf]['internal']!=_0x173d4e[_0x4051bf]['name']){_0x235b7e=_0x235b7e['concat'](getUserApplications(_0x3d1904,_0x173d4e[_0x4051bf],_0x173d4e[_0x4051bf][_0x285c('0x12')]));}}return _0x235b7e;};var getChanSpyPromise=function(_0x43e30a,_0xe0f2f6){return new BPromise(function(_0x2b714a,_0x39c508){return _0x43e30a[_0x285c('0x16')][_0x285c('0x17')]({'attributes':['id','name',_0x285c('0x18')],'where':{'role':_0x285c('0x19'),'chanspy':!![]},'raw':!![]})[_0x285c('0x1a')](function(_0xd2985b){if(_0xd2985b){return _0x2b714a(getChanSpyApplications(_0xe0f2f6,_0xd2985b));}return _0x2b714a([]);})['catch'](function(_0x537bb1){_0x39c508(_0x537bb1);});});};module['exports']=function(_0x3d2c6e,_0x4b0961){var _0x44f29b=_0x3d2c6e[_0x285c('0x1b')];return _0x3d2c6e['define'](_0x285c('0x1c'),attributes,{'tableName':_0x285c('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31086c,_0xc979b9,_0x480063){return getChanSpyPromise(_0x44f29b,_0x31086c)['then'](function(_0x2469ab){if(_0x2469ab&&_0x2469ab[_0x285c('0x1e')]){return _0x44f29b[_0x285c('0x1f')][_0x285c('0x20')](_0x2469ab);}})[_0x285c('0x1a')](function(){_0x480063();})['catch'](function(_0x38aed5){_0x480063(_0x38aed5);});},'afterUpdate':function(_0x14dd21,_0x16d2f7,_0x258b38){return _0x44f29b[_0x285c('0x1f')][_0x285c('0x21')]({'where':{'ChanSpyId':_0x14dd21['id']}})[_0x285c('0x1a')](function(){return getChanSpyPromise(_0x44f29b,_0x14dd21);})['then'](function(_0x509311){if(_0x509311&&_0x509311[_0x285c('0x1e')]){return _0x44f29b[_0x285c('0x1f')][_0x285c('0x20')](_0x509311);}})['then'](function(){_0x258b38();})[_0x285c('0x22')](function(_0x8f5a26){_0x258b38(_0x8f5a26);});},'afterDestroy':function(_0x524345,_0x1e006b,_0x305550){return _0x44f29b[_0x285c('0x1f')][_0x285c('0x21')]({'where':{'ChanSpyId':_0x524345['id']}})[_0x285c('0x1a')](function(){_0x305550();})[_0x285c('0x22')](function(_0x5a7d13){_0x305550(_0x5a7d13);});}}});}; \ No newline at end of file +var _0xdd42=['define','voice_chanspy','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','Set','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal','User','then','catch','exports','models'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xdd42,0x100));var _0x2dd4=function(_0x1e81af,_0x287f4b){_0x1e81af=_0x1e81af-0x0;var _0x34204b=_0xdd42[_0x1e81af];return _0x34204b;};'use strict';var _=require(_0x2dd4('0x0'));var util=require(_0x2dd4('0x1'));var BPromise=require(_0x2dd4('0x2'));var attributes=require(_0x2dd4('0x3'));var getUserApplications=function(_0x3cd12e,_0x4e4990,_0x1de3ec){var _0x1845ac=0x1;var _0xd6497e=[];var _0x2d4ab9={'context':_0x4e4990[_0x2dd4('0x4')]||'from-sip','exten':util[_0x2dd4('0x5')](_0x2dd4('0x6'),_0x3cd12e[_0x2dd4('0x7')],_0x1de3ec),'type':_0x2dd4('0x8'),'isApp':![],'ChanSpyId':_0x3cd12e['id'],'UserId':_0x4e4990['id']};_0xd6497e[_0x2dd4('0x9')](_[_0x2dd4('0xa')]({'app':_0x2dd4('0xb'),'appdata':util[_0x2dd4('0x5')]('CDR(type)=%s','chanspy'),'priority':_0x1845ac++},_0x2d4ab9));if(_0x3cd12e[_0x2dd4('0xc')]){_0xd6497e[_0x2dd4('0x9')](_[_0x2dd4('0xa')]({'app':_0x2dd4('0xd'),'appdata':util[_0x2dd4('0x5')](_0x2dd4('0xe'),_0x3cd12e[_0x2dd4('0xf')]),'priority':_0x1845ac++},_0x2d4ab9));}if(_0x3cd12e[_0x2dd4('0x10')]){_0xd6497e[_0x2dd4('0x9')](_['merge']({'app':_0x2dd4('0x11'),'appdata':_0x3cd12e[_0x2dd4('0x12')],'priority':_0x1845ac++},_0x2d4ab9));}_0xd6497e[_0x2dd4('0x9')](_[_0x2dd4('0xa')]({'app':_0x2dd4('0x13'),'appdata':util['format']('SIP/%s,%s',_0x4e4990[_0x2dd4('0x14')],_0x3cd12e[_0x2dd4('0x15')]?_0x3cd12e[_0x2dd4('0x15')][_0x2dd4('0x16')](''):''),'priority':_0x1845ac++},_0x2d4ab9));if(_0x3cd12e[_0x2dd4('0xc')]){_0xd6497e[_0x2dd4('0x9')](_[_0x2dd4('0xa')]({'app':_0x2dd4('0x17'),'priority':_0x1845ac++},_0x2d4ab9));}return _0xd6497e;};var getChanSpyApplications=function(_0x2d18b8,_0x507679){var _0x281bd8=[];for(var _0x414c5a=0x0,_0x4eb2b2=0x1;_0x414c5a<_0x507679[_0x2dd4('0x18')];_0x414c5a++,_0x4eb2b2=0x1){_0x281bd8=_0x281bd8[_0x2dd4('0x19')](getUserApplications(_0x2d18b8,_0x507679[_0x414c5a],_0x507679[_0x414c5a][_0x2dd4('0x1a')]));if(_0x507679[_0x414c5a]['internal']!=_0x507679[_0x414c5a][_0x2dd4('0x14')]){_0x281bd8=_0x281bd8[_0x2dd4('0x19')](getUserApplications(_0x2d18b8,_0x507679[_0x414c5a],_0x507679[_0x414c5a][_0x2dd4('0x14')]));}}return _0x281bd8;};var getChanSpyPromise=function(_0x534405,_0x5a8bd5){return new BPromise(function(_0x3cb3a9,_0x4840f7){return _0x534405[_0x2dd4('0x1b')]['findAll']({'attributes':['id',_0x2dd4('0x14'),_0x2dd4('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x2dd4('0x1c')](function(_0xd0eb7c){if(_0xd0eb7c){return _0x3cb3a9(getChanSpyApplications(_0x5a8bd5,_0xd0eb7c));}return _0x3cb3a9([]);})[_0x2dd4('0x1d')](function(_0x5f54d2){_0x4840f7(_0x5f54d2);});});};module[_0x2dd4('0x1e')]=function(_0xfc2506,_0xde45ae){var _0xd82fc9=_0xfc2506[_0x2dd4('0x1f')];return _0xfc2506[_0x2dd4('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x2dd4('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4724f3,_0x161b11,_0x2d1991){return getChanSpyPromise(_0xd82fc9,_0x4724f3)[_0x2dd4('0x1c')](function(_0x576c3c){if(_0x576c3c&&_0x576c3c['length']){return _0xd82fc9[_0x2dd4('0x22')]['bulkCreate'](_0x576c3c);}})[_0x2dd4('0x1c')](function(){_0x2d1991();})[_0x2dd4('0x1d')](function(_0x27619e){_0x2d1991(_0x27619e);});},'afterUpdate':function(_0x558221,_0x21ef61,_0x2740df){return _0xd82fc9[_0x2dd4('0x22')]['destroy']({'where':{'ChanSpyId':_0x558221['id']}})[_0x2dd4('0x1c')](function(){return getChanSpyPromise(_0xd82fc9,_0x558221);})[_0x2dd4('0x1c')](function(_0x38cec6){if(_0x38cec6&&_0x38cec6[_0x2dd4('0x18')]){return _0xd82fc9[_0x2dd4('0x22')]['bulkCreate'](_0x38cec6);}})[_0x2dd4('0x1c')](function(){_0x2740df();})[_0x2dd4('0x1d')](function(_0x27474e){_0x2740df(_0x27474e);});},'afterDestroy':function(_0x4f3114,_0x3bb562,_0x1c2f80){return _0xd82fc9['VoiceExtension'][_0x2dd4('0x23')]({'where':{'ChanSpyId':_0x4f3114['id']}})[_0x2dd4('0x1c')](function(){_0x1c2f80();})[_0x2dd4('0x1d')](function(_0x13645b){_0x1c2f80(_0x13645b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f065eec..efc6b94 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 _0x2750=['jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ab5d1,_0x10ffa3){var _0x425efc=function(_0x5db746){while(--_0x5db746){_0x3ab5d1['push'](_0x3ab5d1['shift']());}};_0x425efc(++_0x10ffa3);}(_0x2750,0x13b));var _0x0275=function(_0x1b09d4,_0x24202a){_0x1b09d4=_0x1b09d4-0x0;var _0x5ba95a=_0x2750[_0x1b09d4];return _0x5ba95a;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3585fb,_0x5df075){var _0x48fb79=function(_0x595516){while(--_0x595516){_0x3585fb['push'](_0x3585fb['shift']());}};_0x48fb79(++_0x5df075);}(_0xaa88,0x137));var _0x8aa8=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0xaa88[_0x4d67b8];return _0x55af3b;};'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')]('VoiceChanSpy,\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')]('VoiceChanSpy,\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')]('VoiceChanSpy,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4f922b8..d680e51 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 _0xf5f7=['get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x1d88ac,_0x10028b){var _0x1401c3=function(_0x6b0de8){while(--_0x6b0de8){_0x1d88ac['push'](_0x1d88ac['shift']());}};_0x1401c3(++_0x10028b);}(_0xf5f7,0x191));var _0x7f5f=function(_0x291767,_0x1a9b66){_0x291767=_0x291767-0x0;var _0x284b92=_0xf5f7[_0x291767];return _0x284b92;};'use strict';var multer=require(_0x7f5f('0x0'));var util=require(_0x7f5f('0x1'));var path=require(_0x7f5f('0x2'));var timeout=require(_0x7f5f('0x3'));var express=require(_0x7f5f('0x4'));var router=express['Router']();var fs_extra=require(_0x7f5f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f5f('0x6'));var controller=require('./voiceContext.controller');router[_0x7f5f('0x7')]('/',auth[_0x7f5f('0x8')](),controller[_0x7f5f('0x9')]);router[_0x7f5f('0x7')](_0x7f5f('0xa'),auth[_0x7f5f('0x8')](),controller['show']);router[_0x7f5f('0xb')]('/',auth[_0x7f5f('0x8')](),controller[_0x7f5f('0xc')]);router['put']('/:id',auth[_0x7f5f('0x8')](),controller[_0x7f5f('0xd')]);router[_0x7f5f('0xe')]('/:id',auth[_0x7f5f('0x8')](),controller[_0x7f5f('0xf')]);module[_0x7f5f('0x10')]=router; \ No newline at end of file +var _0x8f99=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x4c5b06,_0x5657d4){var _0x2d17c8=function(_0x480c30){while(--_0x480c30){_0x4c5b06['push'](_0x4c5b06['shift']());}};_0x2d17c8(++_0x5657d4);}(_0x8f99,0x145));var _0x98f9=function(_0x588070,_0x2c192f){_0x588070=_0x588070-0x0;var _0xfc2bc9=_0x8f99[_0x588070];return _0xfc2bc9;};'use strict';var multer=require(_0x98f9('0x0'));var util=require(_0x98f9('0x1'));var path=require(_0x98f9('0x2'));var timeout=require(_0x98f9('0x3'));var express=require(_0x98f9('0x4'));var router=express[_0x98f9('0x5')]();var fs_extra=require(_0x98f9('0x6'));var auth=require(_0x98f9('0x7'));var interaction=require(_0x98f9('0x8'));var config=require('../../config/environment');var controller=require(_0x98f9('0x9'));router[_0x98f9('0xa')]('/',auth[_0x98f9('0xb')](),controller['index']);router[_0x98f9('0xa')](_0x98f9('0xc'),auth['isAuthenticated'](),controller[_0x98f9('0xd')]);router[_0x98f9('0xe')]('/',auth['isAuthenticated'](),controller[_0x98f9('0xf')]);router[_0x98f9('0x10')](_0x98f9('0xc'),auth[_0x98f9('0xb')](),controller['update']);router[_0x98f9('0x11')](_0x98f9('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6dbc2e7..d07b6c0 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 _0x8406=['name','BOOLEAN','STRING'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x8406,0x1d9));var _0x6840=function(_0x4c289f,_0x44f125){_0x4c289f=_0x4c289f-0x0;var _0x1594c7=_0x8406[_0x4c289f];return _0x1594c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6840('0x0')],'unique':_0x6840('0x1')},'description':{'type':Sequelize[_0x6840('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6840('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x330e=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x19b9d1,_0x4f603f){var _0x1ca4f7=function(_0x2d1ea7){while(--_0x2d1ea7){_0x19b9d1['push'](_0x19b9d1['shift']());}};_0x1ca4f7(++_0x4f603f);}(_0x330e,0x126));var _0xe330=function(_0x1c6e81,_0x146964){_0x1c6e81=_0x1c6e81-0x0;var _0x98e79=_0x330e[_0x1c6e81];return _0x98e79;};'use strict';var Sequelize=require(_0xe330('0x0'));module[_0xe330('0x1')]={'name':{'type':Sequelize[_0xe330('0x2')],'unique':_0xe330('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe330('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 9aad85c..f4a6b0e 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 _0x7fda=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','rows','catch','params','options','find','readFileSync','join','root','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','message','VoiceContext,\x20%s,\x20%s','result','status','end','json','undefined','limit','count','offset','reject','update','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','rawAttributes','type','map','query','keys','filters','model','intersection','fields','attributes','length'];(function(_0x35fca9,_0x31b4d6){var _0x2356cc=function(_0x340203){while(--_0x340203){_0x35fca9['push'](_0x35fca9['shift']());}};_0x2356cc(++_0x31b4d6);}(_0x7fda,0x88));var _0xa7fd=function(_0x2fa98e,_0x3ef6f6){_0x2fa98e=_0x2fa98e-0x0;var _0x113ff9=_0x7fda[_0x2fa98e];return _0x113ff9;};'use strict';var emlformat=require(_0xa7fd('0x0'));var rimraf=require(_0xa7fd('0x1'));var zipdir=require(_0xa7fd('0x2'));var jsonpatch=require(_0xa7fd('0x3'));var rp=require(_0xa7fd('0x4'));var moment=require(_0xa7fd('0x5'));var BPromise=require(_0xa7fd('0x6'));var Mustache=require(_0xa7fd('0x7'));var util=require(_0xa7fd('0x8'));var path=require(_0xa7fd('0x9'));var sox=require(_0xa7fd('0xa'));var csv=require('to-csv');var ejs=require(_0xa7fd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7fd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa7fd('0xd'));var deskjs=require(_0xa7fd('0xe'));var toCsv=require(_0xa7fd('0xf'));var querystring=require(_0xa7fd('0x10'));var Papa=require(_0xa7fd('0x11'));var Redis=require('ioredis');var authService=require(_0xa7fd('0x12'));var qs=require(_0xa7fd('0x13'));var as=require(_0xa7fd('0x14'));var hardwareService=require(_0xa7fd('0x15'));var logger=require(_0xa7fd('0x16'))(_0xa7fd('0x17'));var utils=require('../../config/utils');var config=require(_0xa7fd('0x18'));var licenseUtil=require(_0xa7fd('0x19'));var db=require(_0xa7fd('0x1a'))['db'];var jayson=require(_0xa7fd('0x1b'));var client=jayson[_0xa7fd('0x1c')][_0xa7fd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3f9373,_0x57f03f,_0x12b0eb,_0x1696fd){return new BPromise(function(_0x1a7458,_0x402c40){var _0x56997c=_0x1696fd||client;return _0x56997c['request'](_0x3f9373,_0x12b0eb)[_0xa7fd('0x1e')](function(_0x5ad128){logger[_0xa7fd('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x57f03f,_0xa7fd('0x20'));logger[_0xa7fd('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x57f03f,_0xa7fd('0x20'),JSON['stringify'](_0x5ad128));if(_0x5ad128[_0xa7fd('0x22')]){if(_0x5ad128[_0xa7fd('0x22')][_0xa7fd('0x23')]===0x1f4){logger[_0xa7fd('0x22')]('VoiceContext,\x20%s,\x20%s',_0x57f03f,_0x5ad128[_0xa7fd('0x22')][_0xa7fd('0x24')]);return _0x402c40(_0x5ad128[_0xa7fd('0x22')][_0xa7fd('0x24')]);}logger[_0xa7fd('0x22')](_0xa7fd('0x25'),_0x57f03f,_0x5ad128[_0xa7fd('0x22')][_0xa7fd('0x24')]);return _0x1a7458(_0x5ad128[_0xa7fd('0x22')][_0xa7fd('0x24')]);}else{logger[_0xa7fd('0x1f')](_0xa7fd('0x25'),_0x57f03f,'request\x20sent');_0x1a7458(_0x5ad128[_0xa7fd('0x26')][_0xa7fd('0x24')]);}})['catch'](function(_0xe5888d){logger[_0xa7fd('0x22')]('VoiceContext,\x20%s,\x20%s',_0x57f03f,_0xe5888d);_0x402c40(_0xe5888d);});});}function respondWithStatusCode(_0x1a3602,_0x1b78b9){_0x1b78b9=_0x1b78b9||0xcc;return function(_0x2f20ba){if(_0x2f20ba){return _0x1a3602['sendStatus'](_0x1b78b9);}return _0x1a3602[_0xa7fd('0x27')](_0x1b78b9)[_0xa7fd('0x28')]();};}function respondWithResult(_0x4611e9,_0x19a52e){_0x19a52e=_0x19a52e||0xc8;return function(_0x3140a5){if(_0x3140a5){return _0x4611e9[_0xa7fd('0x27')](_0x19a52e)[_0xa7fd('0x29')](_0x3140a5);}};}function respondWithFilteredResult(_0x4b2b25,_0x5331fb){return function(_0x59f2ad){if(_0x59f2ad){var _0x2a73f0=typeof _0x5331fb['offset']===_0xa7fd('0x2a')&&typeof _0x5331fb[_0xa7fd('0x2b')]===_0xa7fd('0x2a');var _0x4c6a2e=_0x59f2ad[_0xa7fd('0x2c')];var _0x1222e0=_0x2a73f0?0x0:_0x5331fb[_0xa7fd('0x2d')];var _0xdc461c=_0x2a73f0?_0x59f2ad[_0xa7fd('0x2c')]:_0x5331fb[_0xa7fd('0x2d')]+_0x5331fb[_0xa7fd('0x2b')];var _0x3471d8;if(_0xdc461c>=_0x4c6a2e){_0xdc461c=_0x4c6a2e;_0x3471d8=0xc8;}else{_0x3471d8=0xce;}_0x4b2b25[_0xa7fd('0x27')](_0x3471d8);return _0x4b2b25['set']('Content-Range',_0x1222e0+'-'+_0xdc461c+'/'+_0x4c6a2e)[_0xa7fd('0x29')](_0x59f2ad);}return null;};}function patchUpdates(_0x5e669d){return function(_0x17cb79){try{jsonpatch['apply'](_0x17cb79,_0x5e669d,!![]);}catch(_0x288be6){return BPromise[_0xa7fd('0x2e')](_0x288be6);}return _0x17cb79['save']();};}function saveUpdates(_0x928fff,_0x51431b){return function(_0x199d19){if(_0x199d19){return _0x199d19[_0xa7fd('0x2f')](_0x928fff)[_0xa7fd('0x1e')](function(_0x13976d){return _0x13976d;});}return null;};}function removeEntity(_0x413080,_0x3bdb67){return function(_0x3d48a2){if(_0x3d48a2){return _0x3d48a2[_0xa7fd('0x30')]()[_0xa7fd('0x1e')](function(){var _0x4e309b=_0x3d48a2[_0xa7fd('0x31')]({'plain':!![]});var _0x5b2778=_0xa7fd('0x32');return db[_0xa7fd('0x33')]['destroy']({'where':{'type':_0x5b2778,'resourceId':_0x4e309b['id']}})['then'](function(){return _0x3d48a2;});})[_0xa7fd('0x1e')](function(){_0x413080[_0xa7fd('0x27')](0xcc)[_0xa7fd('0x28')]();});}};}function handleEntityNotFound(_0x1f5ce8,_0x3c26b8){return function(_0x120a1d){if(!_0x120a1d){_0x1f5ce8[_0xa7fd('0x34')](0x194);}return _0x120a1d;};}function handleError(_0x3e9df8,_0x52cde7){_0x52cde7=_0x52cde7||0x1f4;return function(_0x2da49c){logger['error'](_0x2da49c[_0xa7fd('0x35')]);if(_0x2da49c['name']){delete _0x2da49c[_0xa7fd('0x36')];}_0x3e9df8[_0xa7fd('0x27')](_0x52cde7)[_0xa7fd('0x37')](_0x2da49c);};}exports[_0xa7fd('0x38')]=function(_0x3279ed,_0x5e5833){var _0x4db16e={},_0x7921a8={},_0x38ac1c={'count':0x0,'rows':[]};var _0x16024b=_['map'](db['VoiceContext'][_0xa7fd('0x39')],function(_0x3aedb1){return{'name':_0x3aedb1['fieldName'],'type':_0x3aedb1[_0xa7fd('0x3a')]['key']};});_0x7921a8['model']=_[_0xa7fd('0x3b')](_0x16024b,_0xa7fd('0x36'));_0x7921a8[_0xa7fd('0x3c')]=_[_0xa7fd('0x3d')](_0x3279ed[_0xa7fd('0x3c')]);_0x7921a8[_0xa7fd('0x3e')]=_['intersection'](_0x7921a8[_0xa7fd('0x3f')],_0x7921a8[_0xa7fd('0x3c')]);_0x4db16e['attributes']=_[_0xa7fd('0x40')](_0x7921a8[_0xa7fd('0x3f')],qs[_0xa7fd('0x41')](_0x3279ed[_0xa7fd('0x3c')]['fields']));_0x4db16e[_0xa7fd('0x42')]=_0x4db16e['attributes'][_0xa7fd('0x43')]?_0x4db16e[_0xa7fd('0x42')]:_0x7921a8[_0xa7fd('0x3f')];if(!_0x3279ed[_0xa7fd('0x3c')][_0xa7fd('0x44')](_0xa7fd('0x45'))){_0x4db16e[_0xa7fd('0x2b')]=qs[_0xa7fd('0x2b')](_0x3279ed[_0xa7fd('0x3c')][_0xa7fd('0x2b')]);_0x4db16e['offset']=qs['offset'](_0x3279ed['query'][_0xa7fd('0x2d')]);}_0x4db16e[_0xa7fd('0x46')]=qs[_0xa7fd('0x47')](_0x3279ed[_0xa7fd('0x3c')][_0xa7fd('0x47')]);_0x4db16e[_0xa7fd('0x48')]=qs[_0xa7fd('0x3e')](_[_0xa7fd('0x49')](_0x3279ed[_0xa7fd('0x3c')],_0x7921a8[_0xa7fd('0x3e')]),_0x16024b);if(_0x3279ed[_0xa7fd('0x3c')][_0xa7fd('0x4a')]){_0x4db16e['where']=_[_0xa7fd('0x4b')](_0x4db16e[_0xa7fd('0x48')],{'$or':_['map'](_0x16024b,function(_0x376f4e){if(_0x376f4e[_0xa7fd('0x3a')]!==_0xa7fd('0x4c')){var _0x542df8={};_0x542df8[_0x376f4e[_0xa7fd('0x36')]]={'$like':'%'+_0x3279ed[_0xa7fd('0x3c')][_0xa7fd('0x4a')]+'%'};return _0x542df8;}})});}_0x4db16e=_['merge']({},_0x4db16e,_0x3279ed['options']);var _0x52d25a={'where':_0x4db16e[_0xa7fd('0x48')]};return db[_0xa7fd('0x4d')][_0xa7fd('0x2c')](_0x52d25a)[_0xa7fd('0x1e')](function(_0x4c67f3){_0x38ac1c['count']=_0x4c67f3;if(_0x3279ed[_0xa7fd('0x3c')][_0xa7fd('0x4e')]){_0x4db16e[_0xa7fd('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0xa7fd('0x50')](_0x4db16e);})[_0xa7fd('0x1e')](function(_0x4981f3){_0x38ac1c[_0xa7fd('0x51')]=_0x4981f3;return _0x38ac1c;})['then'](respondWithFilteredResult(_0x5e5833,_0x4db16e))[_0xa7fd('0x52')](handleError(_0x5e5833,null));};exports['show']=function(_0x5ad288,_0x26fdec){var _0x193ca7={'raw':![],'where':{'id':_0x5ad288[_0xa7fd('0x53')]['id']}},_0x2ae93a={};_0x2ae93a[_0xa7fd('0x3f')]=_[_0xa7fd('0x3d')](db[_0xa7fd('0x4d')]['rawAttributes']);_0x2ae93a[_0xa7fd('0x3c')]=_[_0xa7fd('0x3d')](_0x5ad288['query']);_0x2ae93a[_0xa7fd('0x3e')]=_[_0xa7fd('0x40')](_0x2ae93a[_0xa7fd('0x3f')],_0x2ae93a['query']);_0x193ca7[_0xa7fd('0x42')]=_[_0xa7fd('0x40')](_0x2ae93a['model'],qs[_0xa7fd('0x41')](_0x5ad288['query'][_0xa7fd('0x41')]));_0x193ca7['attributes']=_0x193ca7[_0xa7fd('0x42')][_0xa7fd('0x43')]?_0x193ca7['attributes']:_0x2ae93a[_0xa7fd('0x3f')];if(_0x5ad288[_0xa7fd('0x3c')][_0xa7fd('0x4e')]){_0x193ca7[_0xa7fd('0x4f')]=[{'all':!![]}];}_0x193ca7=_[_0xa7fd('0x4b')]({},_0x193ca7,_0x5ad288[_0xa7fd('0x54')]);return db[_0xa7fd('0x4d')][_0xa7fd('0x55')](_0x193ca7)['then'](handleEntityNotFound(_0x26fdec,null))[_0xa7fd('0x1e')](respondWithResult(_0x26fdec,null))['catch'](handleError(_0x26fdec,null));};exports['create']=function(_0x552dbe,_0x395553,_0x190869){var _0x351ae0;return db[_0xa7fd('0x4d')]['create'](_0x552dbe['body'],{'raw':!![]})['then'](function(_0x234357){_0x351ae0=_0x234357;return db[_0xa7fd('0x4d')]['findAll']({'raw':!![]});})[_0xa7fd('0x1e')](function(_0x173cc3){var _0x3242b1=fs[_0xa7fd('0x56')](path[_0xa7fd('0x57')](config[_0xa7fd('0x58')],'server/files/templates/context.ejs'),_0xa7fd('0x59'));var _0x4af92b=ejs[_0xa7fd('0x5a')](_0x3242b1,{'contexts':_0x173cc3||[]});fs[_0xa7fd('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4af92b);})[_0xa7fd('0x1e')](function(){return respondWithRpcPromise(_0xa7fd('0x5c'),'create',{'module':_0xa7fd('0x5d')});})[_0xa7fd('0x1e')](function(){var _0x2e8257=_0x552dbe[_0xa7fd('0x5e')][_0xa7fd('0x31')]({'plain':!![]});if(!_0x2e8257)throw new Error(_0xa7fd('0x5f'));if(_0x2e8257['role']==='user'){var _0x59c6ba=_0x351ae0[_0xa7fd('0x31')]({'plain':!![]});return db[_0xa7fd('0x60')][_0xa7fd('0x55')]({'where':{'name':_0xa7fd('0x32'),'userProfileId':_0x2e8257[_0xa7fd('0x61')]},'raw':!![]})['then'](function(_0x2f5c25){if(_0x2f5c25&&_0x2f5c25[_0xa7fd('0x62')]===0x0){return db['UserProfileResource'][_0xa7fd('0x63')]({'name':_0x59c6ba['name'],'resourceId':_0x59c6ba['id'],'type':_0x2f5c25[_0xa7fd('0x36')],'sectionId':_0x2f5c25['id']},{})[_0xa7fd('0x1e')](function(){return _0x351ae0;});}else{return _0x351ae0;}})[_0xa7fd('0x52')](function(_0x1abb1b){logger[_0xa7fd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1abb1b);throw _0x1abb1b;});}return _0x351ae0;})[_0xa7fd('0x1e')](respondWithResult(_0x395553,0xc9))[_0xa7fd('0x52')](handleError(_0x395553,null));};exports[_0xa7fd('0x2f')]=function(_0x5a11ad,_0x819b76,_0x3550c1){var _0x11c5d4;return db[_0xa7fd('0x4d')][_0xa7fd('0x55')]({'where':{'id':_0x5a11ad[_0xa7fd('0x53')]['id']}})[_0xa7fd('0x1e')](handleEntityNotFound(_0x819b76,null))['then'](saveUpdates(_0x5a11ad['body'],null))[_0xa7fd('0x1e')](function(_0x32027b){if(_0x32027b){_0x11c5d4=_0x32027b;return db[_0xa7fd('0x4d')][_0xa7fd('0x50')]({'raw':!![]});}})[_0xa7fd('0x1e')](function(_0x2163e1){var _0x1d9728=fs[_0xa7fd('0x56')](path[_0xa7fd('0x57')](config[_0xa7fd('0x58')],_0xa7fd('0x64')),_0xa7fd('0x59'));var _0x4fbc8d=ejs[_0xa7fd('0x5a')](_0x1d9728,{'contexts':_0x2163e1||[]});fs[_0xa7fd('0x5b')](_0xa7fd('0x65'),_0x4fbc8d);})[_0xa7fd('0x1e')](function(){return respondWithRpcPromise(_0xa7fd('0x5c'),'update',{'module':_0xa7fd('0x5d')});})[_0xa7fd('0x1e')](function(){return _0x11c5d4;})[_0xa7fd('0x1e')](respondWithResult(_0x819b76,null))[_0xa7fd('0x52')](handleError(_0x819b76,null));};exports[_0xa7fd('0x30')]=function(_0x79f07a,_0x1ae822,_0x55a8c9){var _0x2c757c;return db[_0xa7fd('0x4d')]['find']({'where':{'id':_0x79f07a['params']['id']}})[_0xa7fd('0x1e')](handleEntityNotFound(_0x1ae822,null))[_0xa7fd('0x1e')](removeEntity(_0x1ae822,null))[_0xa7fd('0x1e')](function(){return db[_0xa7fd('0x4d')][_0xa7fd('0x50')]({'raw':!![]});})[_0xa7fd('0x1e')](function(_0x29b859){var _0x59bd4c=fs[_0xa7fd('0x56')](path[_0xa7fd('0x57')](config[_0xa7fd('0x58')],_0xa7fd('0x64')),_0xa7fd('0x59'));var _0x33f1e9=ejs[_0xa7fd('0x5a')](_0x59bd4c,{'contexts':_0x29b859});fs[_0xa7fd('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x33f1e9);return respondWithRpcPromise(_0xa7fd('0x5c'),_0xa7fd('0x30'),{'module':_0xa7fd('0x5d')});})[_0xa7fd('0x52')](handleError(_0x1ae822,null));}; \ No newline at end of file +var _0x4cb5=['key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','readFileSync','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','server/files/templates/context.ejs','utf8','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','limit','undefined','count','set','Content-Range','apply','reject','save','get','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x4cb5,0x9b));var _0x54cb=function(_0xddb966,_0x465e33){_0xddb966=_0xddb966-0x0;var _0x5e66e0=_0x4cb5[_0xddb966];return _0x5e66e0;};'use strict';var emlformat=require(_0x54cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x54cb('0x1'));var jsonpatch=require(_0x54cb('0x2'));var rp=require('request-promise');var moment=require(_0x54cb('0x3'));var BPromise=require(_0x54cb('0x4'));var Mustache=require(_0x54cb('0x5'));var util=require(_0x54cb('0x6'));var path=require(_0x54cb('0x7'));var sox=require(_0x54cb('0x8'));var csv=require(_0x54cb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54cb('0xa'));var squel=require(_0x54cb('0xb'));var crypto=require('crypto');var jsforce=require(_0x54cb('0xc'));var deskjs=require(_0x54cb('0xd'));var toCsv=require(_0x54cb('0x9'));var querystring=require(_0x54cb('0xe'));var Papa=require(_0x54cb('0xf'));var Redis=require('ioredis');var authService=require(_0x54cb('0x10'));var qs=require(_0x54cb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54cb('0x12'));var logger=require('../../config/logger')(_0x54cb('0x13'));var utils=require(_0x54cb('0x14'));var config=require(_0x54cb('0x15'));var licenseUtil=require(_0x54cb('0x16'));var db=require(_0x54cb('0x17'))['db'];var jayson=require(_0x54cb('0x18'));var client=jayson[_0x54cb('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5939c2,_0x1fb006,_0x2346ec,_0x1104f8){return new BPromise(function(_0x553aba,_0x87e8b3){var _0x4c7b27=_0x1104f8||client;return _0x4c7b27[_0x54cb('0x1a')](_0x5939c2,_0x2346ec)[_0x54cb('0x1b')](function(_0x31ce9a){logger[_0x54cb('0x1c')](_0x54cb('0x1d'),_0x1fb006,'request\x20sent');logger[_0x54cb('0x1e')](_0x54cb('0x1f'),_0x1fb006,_0x54cb('0x20'),JSON[_0x54cb('0x21')](_0x31ce9a));if(_0x31ce9a[_0x54cb('0x22')]){if(_0x31ce9a['error'][_0x54cb('0x23')]===0x1f4){logger[_0x54cb('0x22')]('VoiceContext,\x20%s,\x20%s',_0x1fb006,_0x31ce9a['error'][_0x54cb('0x24')]);return _0x87e8b3(_0x31ce9a[_0x54cb('0x22')][_0x54cb('0x24')]);}logger[_0x54cb('0x22')](_0x54cb('0x1d'),_0x1fb006,_0x31ce9a[_0x54cb('0x22')][_0x54cb('0x24')]);return _0x553aba(_0x31ce9a[_0x54cb('0x22')][_0x54cb('0x24')]);}else{logger['info'](_0x54cb('0x1d'),_0x1fb006,_0x54cb('0x20'));_0x553aba(_0x31ce9a[_0x54cb('0x25')][_0x54cb('0x24')]);}})[_0x54cb('0x26')](function(_0xba02c8){logger[_0x54cb('0x22')](_0x54cb('0x1d'),_0x1fb006,_0xba02c8);_0x87e8b3(_0xba02c8);});});}function respondWithStatusCode(_0x45d9b5,_0x53f0ce){_0x53f0ce=_0x53f0ce||0xcc;return function(_0x411fe7){if(_0x411fe7){return _0x45d9b5[_0x54cb('0x27')](_0x53f0ce);}return _0x45d9b5['status'](_0x53f0ce)[_0x54cb('0x28')]();};}function respondWithResult(_0xaa3c6a,_0x45cb72){_0x45cb72=_0x45cb72||0xc8;return function(_0x2bb9d7){if(_0x2bb9d7){return _0xaa3c6a[_0x54cb('0x29')](_0x45cb72)[_0x54cb('0x2a')](_0x2bb9d7);}};}function respondWithFilteredResult(_0x443273,_0x5d656d){return function(_0x40fa7a){if(_0x40fa7a){var _0x428498=typeof _0x5d656d['offset']==='undefined'&&typeof _0x5d656d[_0x54cb('0x2b')]===_0x54cb('0x2c');var _0x342fa3=_0x40fa7a[_0x54cb('0x2d')];var _0x4cf8fa=_0x428498?0x0:_0x5d656d['offset'];var _0x40949d=_0x428498?_0x40fa7a[_0x54cb('0x2d')]:_0x5d656d['offset']+_0x5d656d[_0x54cb('0x2b')];var _0x246461;if(_0x40949d>=_0x342fa3){_0x40949d=_0x342fa3;_0x246461=0xc8;}else{_0x246461=0xce;}_0x443273[_0x54cb('0x29')](_0x246461);return _0x443273[_0x54cb('0x2e')](_0x54cb('0x2f'),_0x4cf8fa+'-'+_0x40949d+'/'+_0x342fa3)[_0x54cb('0x2a')](_0x40fa7a);}return null;};}function patchUpdates(_0x126b98){return function(_0x327858){try{jsonpatch[_0x54cb('0x30')](_0x327858,_0x126b98,!![]);}catch(_0xf00477){return BPromise[_0x54cb('0x31')](_0xf00477);}return _0x327858[_0x54cb('0x32')]();};}function saveUpdates(_0x5ec8e1,_0x4348dd){return function(_0x4d2461){if(_0x4d2461){return _0x4d2461['update'](_0x5ec8e1)['then'](function(_0x4d8fc1){return _0x4d8fc1;});}return null;};}function removeEntity(_0x5967a1,_0x4013cd){return function(_0x12d27d){if(_0x12d27d){return _0x12d27d['destroy']()[_0x54cb('0x1b')](function(){var _0x3f9ced=_0x12d27d[_0x54cb('0x33')]({'plain':!![]});var _0xca282e=_0x54cb('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0xca282e,'resourceId':_0x3f9ced['id']}})[_0x54cb('0x1b')](function(){return _0x12d27d;});})[_0x54cb('0x1b')](function(){_0x5967a1[_0x54cb('0x29')](0xcc)[_0x54cb('0x28')]();});}};}function handleEntityNotFound(_0x7efd22,_0x3f5a46){return function(_0x51f494){if(!_0x51f494){_0x7efd22[_0x54cb('0x27')](0x194);}return _0x51f494;};}function handleError(_0x47c540,_0x38ffa5){_0x38ffa5=_0x38ffa5||0x1f4;return function(_0x148b2d){logger['error'](_0x148b2d[_0x54cb('0x35')]);if(_0x148b2d[_0x54cb('0x36')]){delete _0x148b2d[_0x54cb('0x36')];}_0x47c540[_0x54cb('0x29')](_0x38ffa5)[_0x54cb('0x37')](_0x148b2d);};}exports[_0x54cb('0x38')]=function(_0xe964c6,_0x5bee15){var _0x12ffba={},_0x35ffd9={},_0x40bb2c={'count':0x0,'rows':[]};var _0x408a56=_[_0x54cb('0x39')](db[_0x54cb('0x3a')][_0x54cb('0x3b')],function(_0x24431f){return{'name':_0x24431f[_0x54cb('0x3c')],'type':_0x24431f['type'][_0x54cb('0x3d')]};});_0x35ffd9['model']=_['map'](_0x408a56,_0x54cb('0x36'));_0x35ffd9[_0x54cb('0x3e')]=_[_0x54cb('0x3f')](_0xe964c6[_0x54cb('0x3e')]);_0x35ffd9[_0x54cb('0x40')]=_['intersection'](_0x35ffd9[_0x54cb('0x41')],_0x35ffd9[_0x54cb('0x3e')]);_0x12ffba['attributes']=_[_0x54cb('0x42')](_0x35ffd9[_0x54cb('0x41')],qs[_0x54cb('0x43')](_0xe964c6['query']['fields']));_0x12ffba[_0x54cb('0x44')]=_0x12ffba[_0x54cb('0x44')][_0x54cb('0x45')]?_0x12ffba[_0x54cb('0x44')]:_0x35ffd9['model'];if(!_0xe964c6[_0x54cb('0x3e')][_0x54cb('0x46')](_0x54cb('0x47'))){_0x12ffba[_0x54cb('0x2b')]=qs[_0x54cb('0x2b')](_0xe964c6['query'][_0x54cb('0x2b')]);_0x12ffba[_0x54cb('0x48')]=qs[_0x54cb('0x48')](_0xe964c6[_0x54cb('0x3e')][_0x54cb('0x48')]);}_0x12ffba[_0x54cb('0x49')]=qs[_0x54cb('0x4a')](_0xe964c6[_0x54cb('0x3e')][_0x54cb('0x4a')]);_0x12ffba[_0x54cb('0x4b')]=qs[_0x54cb('0x40')](_[_0x54cb('0x4c')](_0xe964c6[_0x54cb('0x3e')],_0x35ffd9[_0x54cb('0x40')]),_0x408a56);if(_0xe964c6[_0x54cb('0x3e')][_0x54cb('0x4d')]){_0x12ffba[_0x54cb('0x4b')]=_[_0x54cb('0x4e')](_0x12ffba[_0x54cb('0x4b')],{'$or':_[_0x54cb('0x39')](_0x408a56,function(_0x7c7290){if(_0x7c7290[_0x54cb('0x4f')]!==_0x54cb('0x50')){var _0x488b2c={};_0x488b2c[_0x7c7290[_0x54cb('0x36')]]={'$like':'%'+_0xe964c6[_0x54cb('0x3e')][_0x54cb('0x4d')]+'%'};return _0x488b2c;}})});}_0x12ffba=_[_0x54cb('0x4e')]({},_0x12ffba,_0xe964c6[_0x54cb('0x51')]);var _0x485077={'where':_0x12ffba['where']};return db[_0x54cb('0x3a')][_0x54cb('0x2d')](_0x485077)[_0x54cb('0x1b')](function(_0x29a653){_0x40bb2c[_0x54cb('0x2d')]=_0x29a653;if(_0xe964c6[_0x54cb('0x3e')]['includeAll']){_0x12ffba[_0x54cb('0x52')]=[{'all':!![]}];}return db['VoiceContext'][_0x54cb('0x53')](_0x12ffba);})[_0x54cb('0x1b')](function(_0xa9a2d){_0x40bb2c[_0x54cb('0x54')]=_0xa9a2d;return _0x40bb2c;})[_0x54cb('0x1b')](respondWithFilteredResult(_0x5bee15,_0x12ffba))[_0x54cb('0x26')](handleError(_0x5bee15,null));};exports['show']=function(_0x2f538d,_0xa8b894){var _0x5777ec={'raw':![],'where':{'id':_0x2f538d[_0x54cb('0x55')]['id']}},_0x5f5a27={};_0x5f5a27[_0x54cb('0x41')]=_[_0x54cb('0x3f')](db[_0x54cb('0x3a')][_0x54cb('0x3b')]);_0x5f5a27[_0x54cb('0x3e')]=_[_0x54cb('0x3f')](_0x2f538d[_0x54cb('0x3e')]);_0x5f5a27['filters']=_[_0x54cb('0x42')](_0x5f5a27[_0x54cb('0x41')],_0x5f5a27[_0x54cb('0x3e')]);_0x5777ec[_0x54cb('0x44')]=_['intersection'](_0x5f5a27['model'],qs[_0x54cb('0x43')](_0x2f538d[_0x54cb('0x3e')][_0x54cb('0x43')]));_0x5777ec[_0x54cb('0x44')]=_0x5777ec[_0x54cb('0x44')][_0x54cb('0x45')]?_0x5777ec[_0x54cb('0x44')]:_0x5f5a27[_0x54cb('0x41')];if(_0x2f538d[_0x54cb('0x3e')][_0x54cb('0x56')]){_0x5777ec[_0x54cb('0x52')]=[{'all':!![]}];}_0x5777ec=_['merge']({},_0x5777ec,_0x2f538d[_0x54cb('0x51')]);return db[_0x54cb('0x3a')][_0x54cb('0x57')](_0x5777ec)[_0x54cb('0x1b')](handleEntityNotFound(_0xa8b894,null))[_0x54cb('0x1b')](respondWithResult(_0xa8b894,null))[_0x54cb('0x26')](handleError(_0xa8b894,null));};exports[_0x54cb('0x58')]=function(_0x566c5a,_0x4738c4,_0x1b17bc){var _0x462984;return db[_0x54cb('0x3a')][_0x54cb('0x58')](_0x566c5a[_0x54cb('0x59')],{'raw':!![]})[_0x54cb('0x1b')](function(_0x327d08){_0x462984=_0x327d08;return db[_0x54cb('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x43433c){var _0x335791=fs[_0x54cb('0x5a')](path['join'](config[_0x54cb('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x305e5d=ejs[_0x54cb('0x5c')](_0x335791,{'contexts':_0x43433c||[]});fs[_0x54cb('0x5d')](_0x54cb('0x5e'),_0x305e5d);})['then'](function(){return respondWithRpcPromise(_0x54cb('0x5f'),_0x54cb('0x58'),{'module':_0x54cb('0x60')});})[_0x54cb('0x1b')](function(){var _0x1cbc89=_0x566c5a[_0x54cb('0x61')]['get']({'plain':!![]});if(!_0x1cbc89)throw new Error(_0x54cb('0x62'));if(_0x1cbc89['role']==='user'){var _0x5c339b=_0x462984[_0x54cb('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x54cb('0x57')]({'where':{'name':_0x54cb('0x34'),'userProfileId':_0x1cbc89[_0x54cb('0x63')]},'raw':!![]})[_0x54cb('0x1b')](function(_0x3e7332){if(_0x3e7332&&_0x3e7332[_0x54cb('0x64')]===0x0){return db[_0x54cb('0x65')]['create']({'name':_0x5c339b[_0x54cb('0x36')],'resourceId':_0x5c339b['id'],'type':_0x3e7332['name'],'sectionId':_0x3e7332['id']},{})['then'](function(){return _0x462984;});}else{return _0x462984;}})['catch'](function(_0x49ca87){logger[_0x54cb('0x22')](_0x54cb('0x66'),_0x49ca87);throw _0x49ca87;});}return _0x462984;})[_0x54cb('0x1b')](respondWithResult(_0x4738c4,0xc9))[_0x54cb('0x26')](handleError(_0x4738c4,null));};exports[_0x54cb('0x67')]=function(_0x42a239,_0x4df6df,_0x32c4c1){var _0x229e55;return db['VoiceContext'][_0x54cb('0x57')]({'where':{'id':_0x42a239[_0x54cb('0x55')]['id']}})[_0x54cb('0x1b')](handleEntityNotFound(_0x4df6df,null))[_0x54cb('0x1b')](saveUpdates(_0x42a239[_0x54cb('0x59')],null))[_0x54cb('0x1b')](function(_0x3c2f71){if(_0x3c2f71){_0x229e55=_0x3c2f71;return db[_0x54cb('0x3a')][_0x54cb('0x53')]({'raw':!![]});}})[_0x54cb('0x1b')](function(_0x4d4a6e){var _0x38d5d1=fs[_0x54cb('0x5a')](path[_0x54cb('0x68')](config['root'],_0x54cb('0x69')),_0x54cb('0x6a'));var _0x3c2494=ejs[_0x54cb('0x5c')](_0x38d5d1,{'contexts':_0x4d4a6e||[]});fs[_0x54cb('0x5d')](_0x54cb('0x5e'),_0x3c2494);})[_0x54cb('0x1b')](function(){return respondWithRpcPromise(_0x54cb('0x5f'),_0x54cb('0x67'),{'module':_0x54cb('0x60')});})[_0x54cb('0x1b')](function(){return _0x229e55;})[_0x54cb('0x1b')](respondWithResult(_0x4df6df,null))[_0x54cb('0x26')](handleError(_0x4df6df,null));};exports[_0x54cb('0x6b')]=function(_0x53640e,_0x509520,_0x618f5a){var _0x15a2a5;return db[_0x54cb('0x3a')]['find']({'where':{'id':_0x53640e[_0x54cb('0x55')]['id']}})[_0x54cb('0x1b')](handleEntityNotFound(_0x509520,null))[_0x54cb('0x1b')](removeEntity(_0x509520,null))['then'](function(){return db[_0x54cb('0x3a')][_0x54cb('0x53')]({'raw':!![]});})['then'](function(_0x214d24){var _0x1e936b=fs[_0x54cb('0x5a')](path['join'](config[_0x54cb('0x5b')],_0x54cb('0x69')),_0x54cb('0x6a'));var _0x5cb7c1=ejs[_0x54cb('0x5c')](_0x1e936b,{'contexts':_0x214d24});fs[_0x54cb('0x5d')](_0x54cb('0x5e'),_0x5cb7c1);return respondWithRpcPromise(_0x54cb('0x5f'),_0x54cb('0x6b'),{'module':_0x54cb('0x60')});})[_0x54cb('0x26')](handleError(_0x509520,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f0317fd..5092a7a 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 _0x026b=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','voice_contexts','lodash','util','../../config/logger','api'];(function(_0x3c2eaf,_0x2abd79){var _0x25bb84=function(_0x32b123){while(--_0x32b123){_0x3c2eaf['push'](_0x3c2eaf['shift']());}};_0x25bb84(++_0x2abd79);}(_0x026b,0x17d));var _0xb026=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x026b[_0x114b7c];return _0x47185f;};'use strict';var _=require(_0xb026('0x0'));var util=require(_0xb026('0x1'));var logger=require(_0xb026('0x2'))(_0xb026('0x3'));var moment=require(_0xb026('0x4'));var BPromise=require(_0xb026('0x5'));var rp=require(_0xb026('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb026('0x7'));var config=require(_0xb026('0x8'));var attributes=require(_0xb026('0x9'));module['exports']=function(_0x477c6a,_0x464243){return _0x477c6a['define']('VoiceContext',attributes,{'tableName':_0xb026('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8187=['exports','define','voice_contexts','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x14e3f9,_0x1b27f8){var _0x287c94=function(_0x54ad34){while(--_0x54ad34){_0x14e3f9['push'](_0x14e3f9['shift']());}};_0x287c94(++_0x1b27f8);}(_0x8187,0xfd));var _0x7818=function(_0x1cc7af,_0x3deac5){_0x1cc7af=_0x1cc7af-0x0;var _0x28b156=_0x8187[_0x1cc7af];return _0x28b156;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7818('0x0'))('api');var moment=require(_0x7818('0x1'));var BPromise=require('bluebird');var rp=require(_0x7818('0x2'));var fs=require('fs');var path=require(_0x7818('0x3'));var rimraf=require(_0x7818('0x4'));var config=require(_0x7818('0x5'));var attributes=require(_0x7818('0x6'));module[_0x7818('0x7')]=function(_0x2fc601,_0x3e2b40){return _0x2fc601[_0x7818('0x8')]('VoiceContext',attributes,{'tableName':_0x7818('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index fb0d9aa..7d5dbac 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 _0xea5b=['VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0xea5b,0x152));var _0xbea5=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xea5b[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var moment=require(_0xbea5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbea5('0x3'));var db=require(_0xbea5('0x4'))['db'];var utils=require(_0xbea5('0x5'));var logger=require(_0xbea5('0x6'))('rpc');var config=require(_0xbea5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbea5('0x8')][_0xbea5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed9654,_0x3cb5c2,_0x19e362){return new BPromise(function(_0x126aae,_0x36692a){return client[_0xbea5('0xa')](_0xed9654,_0x19e362)[_0xbea5('0xb')](function(_0x1020e9){logger[_0xbea5('0xc')](_0xbea5('0xd'),_0x3cb5c2,'request\x20sent');logger['debug'](_0xbea5('0xe'),_0x3cb5c2,_0xbea5('0xf'),JSON[_0xbea5('0x10')](_0x1020e9));if(_0x1020e9['error']){if(_0x1020e9[_0xbea5('0x11')][_0xbea5('0x12')]===0x1f4){logger['error'](_0xbea5('0xd'),_0x3cb5c2,_0x1020e9[_0xbea5('0x11')][_0xbea5('0x13')]);return _0x36692a(_0x1020e9[_0xbea5('0x11')]['message']);}logger['error'](_0xbea5('0xd'),_0x3cb5c2,_0x1020e9['error']['message']);return _0x126aae(_0x1020e9[_0xbea5('0x11')][_0xbea5('0x13')]);}else{logger['info'](_0xbea5('0xd'),_0x3cb5c2,_0xbea5('0xf'));_0x126aae(_0x1020e9[_0xbea5('0x14')][_0xbea5('0x13')]);}})[_0xbea5('0x15')](function(_0xac581b){logger['error'](_0xbea5('0xd'),_0x3cb5c2,_0xac581b);_0x36692a(_0xac581b);});});} \ No newline at end of file +var _0xd237=['client','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1fdcb1,_0x50e850){var _0x2c81e5=function(_0x4d6b7c){while(--_0x4d6b7c){_0x1fdcb1['push'](_0x1fdcb1['shift']());}};_0x2c81e5(++_0x50e850);}(_0xd237,0x14f));var _0x7d23=function(_0x965eaf,_0x4918c1){_0x965eaf=_0x965eaf-0x0;var _0x942772=_0xd237[_0x965eaf];return _0x942772;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1bc1b1e..156f77a 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 _0x587e=['../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x495b64,_0xb64d7e){var _0x449b78=function(_0x88d9d1){while(--_0x88d9d1){_0x495b64['push'](_0x495b64['shift']());}};_0x449b78(++_0xb64d7e);}(_0x587e,0xa3));var _0xe587=function(_0x23737e,_0x597360){_0x23737e=_0x23737e-0x0;var _0x4a741a=_0x587e[_0x23737e];return _0x4a741a;};'use strict';var multer=require(_0xe587('0x0'));var util=require(_0xe587('0x1'));var path=require(_0xe587('0x2'));var timeout=require(_0xe587('0x3'));var express=require(_0xe587('0x4'));var router=express[_0xe587('0x5')]();var fs_extra=require(_0xe587('0x6'));var auth=require(_0xe587('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe587('0x8'));var controller=require(_0xe587('0x9'));router[_0xe587('0xa')]('/',auth[_0xe587('0xb')](),controller['index']);router[_0xe587('0xa')](_0xe587('0xc'),auth[_0xe587('0xb')](),controller['describe']);router['get']('/:id',auth[_0xe587('0xb')](),controller['show']);router[_0xe587('0xd')]('/',auth[_0xe587('0xb')](),controller[_0xe587('0xe')]);router[_0xe587('0xf')](_0xe587('0x10'),auth[_0xe587('0xb')](),controller['update']);router['delete'](_0xe587('0x10'),auth[_0xe587('0xb')](),controller[_0xe587('0x11')]);module[_0xe587('0x12')]=router; \ No newline at end of file +var _0x60ab=['describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x1f0e40,_0x365b55){var _0x3e8ae2=function(_0x136d8c){while(--_0x136d8c){_0x1f0e40['push'](_0x1f0e40['shift']());}};_0x3e8ae2(++_0x365b55);}(_0x60ab,0x72));var _0xb60a=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0x60ab[_0x43dc7e];return _0x21e12d;};'use strict';var multer=require('multer');var util=require(_0xb60a('0x0'));var path=require(_0xb60a('0x1'));var timeout=require(_0xb60a('0x2'));var express=require('express');var router=express[_0xb60a('0x3')]();var fs_extra=require(_0xb60a('0x4'));var auth=require(_0xb60a('0x5'));var interaction=require(_0xb60a('0x6'));var config=require(_0xb60a('0x7'));var controller=require(_0xb60a('0x8'));router[_0xb60a('0x9')]('/',auth[_0xb60a('0xa')](),controller[_0xb60a('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb60a('0xc')]);router[_0xb60a('0x9')](_0xb60a('0xd'),auth[_0xb60a('0xa')](),controller[_0xb60a('0xe')]);router[_0xb60a('0xf')]('/',auth[_0xb60a('0xa')](),controller[_0xb60a('0x10')]);router[_0xb60a('0x11')](_0xb60a('0xd'),auth[_0xb60a('0xa')](),controller['update']);router[_0xb60a('0x12')](_0xb60a('0xd'),auth[_0xb60a('0xa')](),controller[_0xb60a('0x13')]);module[_0xb60a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6879c6d..4df245e 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x4b0679,_0x21b70f){var _0x74a31c=function(_0x340b0c){while(--_0x340b0c){_0x4b0679['push'](_0x4b0679['shift']());}};_0x74a31c(++_0x21b70f);}(_0xbec5,0xe5));var _0x5bec=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0xbec5[_0x40f9a0];return _0x3e3144;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x41ab1a,_0x18da35){var _0x5ae8ac=function(_0x5b5bff){while(--_0x5b5bff){_0x41ab1a['push'](_0x41ab1a['shift']());}};_0x5ae8ac(++_0x18da35);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3cd1bc,_0x1b06e3){_0x3cd1bc=_0x3cd1bc-0x0;var _0x106c0f=_0x6f0d[_0x3cd1bc];return _0x106c0f;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b213f06..f0c8264 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 _0x9dc0=['keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','filter','VoiceDialReport','include','rows','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','model','query'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x9dc0,0xf7));var _0x09dc=function(_0x16bd44,_0x3c91ba){_0x16bd44=_0x16bd44-0x0;var _0x368a61=_0x9dc0[_0x16bd44];return _0x368a61;};'use strict';var emlformat=require(_0x09dc('0x0'));var rimraf=require(_0x09dc('0x1'));var zipdir=require(_0x09dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09dc('0x3'));var moment=require(_0x09dc('0x4'));var BPromise=require(_0x09dc('0x5'));var Mustache=require(_0x09dc('0x6'));var util=require('util');var path=require(_0x09dc('0x7'));var sox=require(_0x09dc('0x8'));var csv=require(_0x09dc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09dc('0xa'));var _=require(_0x09dc('0xb'));var squel=require(_0x09dc('0xc'));var crypto=require(_0x09dc('0xd'));var jsforce=require(_0x09dc('0xe'));var deskjs=require(_0x09dc('0xf'));var toCsv=require(_0x09dc('0x9'));var querystring=require(_0x09dc('0x10'));var Papa=require(_0x09dc('0x11'));var Redis=require(_0x09dc('0x12'));var authService=require(_0x09dc('0x13'));var qs=require(_0x09dc('0x14'));var as=require(_0x09dc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x09dc('0x16'));var utils=require(_0x09dc('0x17'));var config=require(_0x09dc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x09dc('0x19'))['db'];function respondWithStatusCode(_0x1867d2,_0x5b87ae){_0x5b87ae=_0x5b87ae||0xcc;return function(_0x4bdf55){if(_0x4bdf55){return _0x1867d2[_0x09dc('0x1a')](_0x5b87ae);}return _0x1867d2[_0x09dc('0x1b')](_0x5b87ae)[_0x09dc('0x1c')]();};}function respondWithResult(_0x4c6249,_0x104651){_0x104651=_0x104651||0xc8;return function(_0x3f80b6){if(_0x3f80b6){return _0x4c6249['status'](_0x104651)[_0x09dc('0x1d')](_0x3f80b6);}};}function respondWithFilteredResult(_0x4fee39,_0x4998ab){return function(_0xcfa8df){if(_0xcfa8df){var _0x186eda=typeof _0x4998ab['offset']==='undefined'&&typeof _0x4998ab['limit']==='undefined';var _0xbda549=_0xcfa8df[_0x09dc('0x1e')];var _0xea4020=_0x186eda?0x0:_0x4998ab[_0x09dc('0x1f')];var _0x321c63=_0x186eda?_0xcfa8df['count']:_0x4998ab[_0x09dc('0x1f')]+_0x4998ab[_0x09dc('0x20')];var _0x4b2289;if(_0x321c63>=_0xbda549){_0x321c63=_0xbda549;_0x4b2289=0xc8;}else{_0x4b2289=0xce;}_0x4fee39[_0x09dc('0x1b')](_0x4b2289);return _0x4fee39[_0x09dc('0x21')](_0x09dc('0x22'),_0xea4020+'-'+_0x321c63+'/'+_0xbda549)[_0x09dc('0x1d')](_0xcfa8df);}return null;};}function patchUpdates(_0x1133cd){return function(_0x48bb5f){try{jsonpatch[_0x09dc('0x23')](_0x48bb5f,_0x1133cd,!![]);}catch(_0x1cd892){return BPromise[_0x09dc('0x24')](_0x1cd892);}return _0x48bb5f[_0x09dc('0x25')]();};}function saveUpdates(_0x1a8776,_0x5da0e7){return function(_0x2dadaa){if(_0x2dadaa){return _0x2dadaa[_0x09dc('0x26')](_0x1a8776)[_0x09dc('0x27')](function(_0x57cbf5){return _0x57cbf5;});}return null;};}function removeEntity(_0x540177,_0x27e1fb){return function(_0x19b5ce){if(_0x19b5ce){return _0x19b5ce[_0x09dc('0x28')]()[_0x09dc('0x27')](function(){_0x540177[_0x09dc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x159374,_0x2b70f6){return function(_0x4de3bc){if(!_0x4de3bc){_0x159374['sendStatus'](0x194);}return _0x4de3bc;};}function handleError(_0xaa115e,_0x65ef4a){_0x65ef4a=_0x65ef4a||0x1f4;return function(_0x596684){logger['error'](_0x596684[_0x09dc('0x29')]);if(_0x596684[_0x09dc('0x2a')]){delete _0x596684['name'];}_0xaa115e[_0x09dc('0x1b')](_0x65ef4a)[_0x09dc('0x2b')](_0x596684);};}exports[_0x09dc('0x2c')]=function(_0x4ef923,_0x2bbae6){var _0x20c7fa={},_0x4b4ebb={},_0x59cf7c={'count':0x0,'rows':[]};var _0x3068e2=_['map'](db['VoiceDialReport'][_0x09dc('0x2d')],function(_0x5a3475){return{'name':_0x5a3475[_0x09dc('0x2e')],'type':_0x5a3475['type']['key']};});_0x4b4ebb[_0x09dc('0x2f')]=_['map'](_0x3068e2,_0x09dc('0x2a'));_0x4b4ebb[_0x09dc('0x30')]=_[_0x09dc('0x31')](_0x4ef923[_0x09dc('0x30')]);_0x4b4ebb['filters']=_[_0x09dc('0x32')](_0x4b4ebb[_0x09dc('0x2f')],_0x4b4ebb[_0x09dc('0x30')]);_0x20c7fa['attributes']=_[_0x09dc('0x32')](_0x4b4ebb[_0x09dc('0x2f')],qs[_0x09dc('0x33')](_0x4ef923[_0x09dc('0x30')][_0x09dc('0x33')]));_0x20c7fa[_0x09dc('0x34')]=_0x20c7fa['attributes'][_0x09dc('0x35')]?_0x20c7fa[_0x09dc('0x34')]:_0x4b4ebb['model'];if(!_0x4ef923[_0x09dc('0x30')][_0x09dc('0x36')]('nolimit')){_0x20c7fa[_0x09dc('0x20')]=qs[_0x09dc('0x20')](_0x4ef923[_0x09dc('0x30')][_0x09dc('0x20')]);_0x20c7fa[_0x09dc('0x1f')]=qs[_0x09dc('0x1f')](_0x4ef923[_0x09dc('0x30')][_0x09dc('0x1f')]);}_0x20c7fa[_0x09dc('0x37')]=qs[_0x09dc('0x38')](_0x4ef923[_0x09dc('0x30')][_0x09dc('0x38')]);_0x20c7fa[_0x09dc('0x39')]=qs[_0x09dc('0x3a')](_[_0x09dc('0x3b')](_0x4ef923[_0x09dc('0x30')],_0x4b4ebb['filters']),_0x3068e2);if(_0x4ef923['query']['filter']){_0x20c7fa['where']=_[_0x09dc('0x3c')](_0x20c7fa['where'],{'$or':_[_0x09dc('0x3d')](_0x3068e2,function(_0x5d550b){if(_0x5d550b['type']!=='VIRTUAL'){var _0x19b802={};_0x19b802[_0x5d550b[_0x09dc('0x2a')]]={'$like':'%'+_0x4ef923[_0x09dc('0x30')][_0x09dc('0x3e')]+'%'};return _0x19b802;}})});}_0x20c7fa=_['merge']({},_0x20c7fa,_0x4ef923['options']);var _0x3b2b03={'where':_0x20c7fa[_0x09dc('0x39')]};return db[_0x09dc('0x3f')][_0x09dc('0x1e')](_0x3b2b03)[_0x09dc('0x27')](function(_0x3f9fc3){_0x59cf7c[_0x09dc('0x1e')]=_0x3f9fc3;if(_0x4ef923[_0x09dc('0x30')]['includeAll']){_0x20c7fa[_0x09dc('0x40')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x20c7fa);})[_0x09dc('0x27')](function(_0x19ece1){_0x59cf7c[_0x09dc('0x41')]=_0x19ece1;return _0x59cf7c;})[_0x09dc('0x27')](respondWithFilteredResult(_0x2bbae6,_0x20c7fa))[_0x09dc('0x42')](handleError(_0x2bbae6,null));};exports[_0x09dc('0x43')]=function(_0x5dba83,_0x4e1c23){var _0x2c00cc={'raw':!![],'where':{'id':_0x5dba83[_0x09dc('0x44')]['id']}},_0x2d4727={};_0x2d4727[_0x09dc('0x2f')]=_[_0x09dc('0x31')](db[_0x09dc('0x3f')][_0x09dc('0x2d')]);_0x2d4727['query']=_[_0x09dc('0x31')](_0x5dba83['query']);_0x2d4727[_0x09dc('0x3a')]=_[_0x09dc('0x32')](_0x2d4727[_0x09dc('0x2f')],_0x2d4727[_0x09dc('0x30')]);_0x2c00cc[_0x09dc('0x34')]=_[_0x09dc('0x32')](_0x2d4727[_0x09dc('0x2f')],qs['fields'](_0x5dba83[_0x09dc('0x30')][_0x09dc('0x33')]));_0x2c00cc[_0x09dc('0x34')]=_0x2c00cc['attributes']['length']?_0x2c00cc['attributes']:_0x2d4727[_0x09dc('0x2f')];if(_0x5dba83['query'][_0x09dc('0x45')]){_0x2c00cc[_0x09dc('0x40')]=[{'all':!![]}];}_0x2c00cc=_[_0x09dc('0x3c')]({},_0x2c00cc,_0x5dba83[_0x09dc('0x46')]);return db[_0x09dc('0x3f')][_0x09dc('0x47')](_0x2c00cc)[_0x09dc('0x27')](handleEntityNotFound(_0x4e1c23,null))[_0x09dc('0x27')](respondWithResult(_0x4e1c23,null))[_0x09dc('0x42')](handleError(_0x4e1c23,null));};exports['create']=function(_0x5980fb,_0x537114){return db[_0x09dc('0x3f')][_0x09dc('0x48')](_0x5980fb[_0x09dc('0x49')],{})[_0x09dc('0x27')](respondWithResult(_0x537114,0xc9))[_0x09dc('0x42')](handleError(_0x537114,null));};exports[_0x09dc('0x26')]=function(_0x28b7e6,_0x29e9a9){if(_0x28b7e6[_0x09dc('0x49')]['id']){delete _0x28b7e6['body']['id'];}return db[_0x09dc('0x3f')]['find']({'where':{'id':_0x28b7e6['params']['id']}})[_0x09dc('0x27')](handleEntityNotFound(_0x29e9a9,null))[_0x09dc('0x27')](saveUpdates(_0x28b7e6['body'],null))[_0x09dc('0x27')](respondWithResult(_0x29e9a9,null))[_0x09dc('0x42')](handleError(_0x29e9a9,null));};exports[_0x09dc('0x28')]=function(_0x38a018,_0x587bf5){return db['VoiceDialReport'][_0x09dc('0x47')]({'where':{'id':_0x38a018[_0x09dc('0x44')]['id']}})[_0x09dc('0x27')](handleEntityNotFound(_0x587bf5,null))[_0x09dc('0x27')](removeEntity(_0x587bf5,null))[_0x09dc('0x42')](handleError(_0x587bf5,null));};exports['describe']=function(_0x1df714,_0x195dbe){return db['VoiceDialReport']['describe']()[_0x09dc('0x27')](respondWithResult(_0x195dbe,null))[_0x09dc('0x42')](handleError(_0x195dbe,null));}; \ No newline at end of file +var _0xe3b4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','map','VoiceDialReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5ab478,_0x398bf8){var _0x3377ab=function(_0x3604c1){while(--_0x3604c1){_0x5ab478['push'](_0x5ab478['shift']());}};_0x3377ab(++_0x398bf8);}(_0xe3b4,0x1a6));var _0x4e3b=function(_0x175ff0,_0x1037a7){_0x175ff0=_0x175ff0-0x0;var _0x5e5e59=_0xe3b4[_0x175ff0];return _0x5e5e59;};'use strict';var emlformat=require(_0x4e3b('0x0'));var rimraf=require(_0x4e3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e3b('0x2'));var rp=require(_0x4e3b('0x3'));var moment=require(_0x4e3b('0x4'));var BPromise=require(_0x4e3b('0x5'));var Mustache=require(_0x4e3b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4e3b('0x7'));var csv=require(_0x4e3b('0x8'));var ejs=require(_0x4e3b('0x9'));var fs=require('fs');var fs_extra=require(_0x4e3b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e3b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4e3b('0x8'));var querystring=require(_0x4e3b('0xc'));var Papa=require(_0x4e3b('0xd'));var Redis=require(_0x4e3b('0xe'));var authService=require(_0x4e3b('0xf'));var qs=require(_0x4e3b('0x10'));var as=require(_0x4e3b('0x11'));var hardwareService=require(_0x4e3b('0x12'));var logger=require(_0x4e3b('0x13'))(_0x4e3b('0x14'));var utils=require('../../config/utils');var config=require(_0x4e3b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e3b('0x16'))['db'];function respondWithStatusCode(_0x20a606,_0x2c30a7){_0x2c30a7=_0x2c30a7||0xcc;return function(_0x2da403){if(_0x2da403){return _0x20a606[_0x4e3b('0x17')](_0x2c30a7);}return _0x20a606[_0x4e3b('0x18')](_0x2c30a7)['end']();};}function respondWithResult(_0x48d16f,_0x5d1eea){_0x5d1eea=_0x5d1eea||0xc8;return function(_0x6b5259){if(_0x6b5259){return _0x48d16f['status'](_0x5d1eea)[_0x4e3b('0x19')](_0x6b5259);}};}function respondWithFilteredResult(_0x4748bb,_0x5c8c5b){return function(_0x403280){if(_0x403280){var _0xd8b645=typeof _0x5c8c5b[_0x4e3b('0x1a')]===_0x4e3b('0x1b')&&typeof _0x5c8c5b[_0x4e3b('0x1c')]===_0x4e3b('0x1b');var _0x37f059=_0x403280[_0x4e3b('0x1d')];var _0x16e7f3=_0xd8b645?0x0:_0x5c8c5b[_0x4e3b('0x1a')];var _0x125a6c=_0xd8b645?_0x403280[_0x4e3b('0x1d')]:_0x5c8c5b[_0x4e3b('0x1a')]+_0x5c8c5b['limit'];var _0x424285;if(_0x125a6c>=_0x37f059){_0x125a6c=_0x37f059;_0x424285=0xc8;}else{_0x424285=0xce;}_0x4748bb[_0x4e3b('0x18')](_0x424285);return _0x4748bb[_0x4e3b('0x1e')](_0x4e3b('0x1f'),_0x16e7f3+'-'+_0x125a6c+'/'+_0x37f059)['json'](_0x403280);}return null;};}function patchUpdates(_0x2ebe23){return function(_0x2c255a){try{jsonpatch['apply'](_0x2c255a,_0x2ebe23,!![]);}catch(_0x49f08d){return BPromise['reject'](_0x49f08d);}return _0x2c255a['save']();};}function saveUpdates(_0x4d0dd9,_0x35eb43){return function(_0x1ff328){if(_0x1ff328){return _0x1ff328['update'](_0x4d0dd9)[_0x4e3b('0x20')](function(_0x263fca){return _0x263fca;});}return null;};}function removeEntity(_0x118f03,_0x3f2998){return function(_0x30f21e){if(_0x30f21e){return _0x30f21e['destroy']()['then'](function(){_0x118f03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1865e5,_0xfe0379){return function(_0x468c80){if(!_0x468c80){_0x1865e5[_0x4e3b('0x17')](0x194);}return _0x468c80;};}function handleError(_0x4fd084,_0x5ea289){_0x5ea289=_0x5ea289||0x1f4;return function(_0x3800f0){logger[_0x4e3b('0x21')](_0x3800f0[_0x4e3b('0x22')]);if(_0x3800f0[_0x4e3b('0x23')]){delete _0x3800f0[_0x4e3b('0x23')];}_0x4fd084[_0x4e3b('0x18')](_0x5ea289)[_0x4e3b('0x24')](_0x3800f0);};}exports['index']=function(_0x484489,_0x15c470){var _0x4959bb={},_0x36b7c3={},_0x480bec={'count':0x0,'rows':[]};var _0x52e2fa=_[_0x4e3b('0x25')](db[_0x4e3b('0x26')]['rawAttributes'],function(_0xfd7d1a){return{'name':_0xfd7d1a[_0x4e3b('0x27')],'type':_0xfd7d1a[_0x4e3b('0x28')][_0x4e3b('0x29')]};});_0x36b7c3[_0x4e3b('0x2a')]=_[_0x4e3b('0x25')](_0x52e2fa,_0x4e3b('0x23'));_0x36b7c3[_0x4e3b('0x2b')]=_['keys'](_0x484489['query']);_0x36b7c3['filters']=_[_0x4e3b('0x2c')](_0x36b7c3['model'],_0x36b7c3['query']);_0x4959bb[_0x4e3b('0x2d')]=_[_0x4e3b('0x2c')](_0x36b7c3[_0x4e3b('0x2a')],qs[_0x4e3b('0x2e')](_0x484489[_0x4e3b('0x2b')]['fields']));_0x4959bb['attributes']=_0x4959bb[_0x4e3b('0x2d')][_0x4e3b('0x2f')]?_0x4959bb['attributes']:_0x36b7c3[_0x4e3b('0x2a')];if(!_0x484489['query'][_0x4e3b('0x30')](_0x4e3b('0x31'))){_0x4959bb['limit']=qs[_0x4e3b('0x1c')](_0x484489['query'][_0x4e3b('0x1c')]);_0x4959bb[_0x4e3b('0x1a')]=qs[_0x4e3b('0x1a')](_0x484489[_0x4e3b('0x2b')][_0x4e3b('0x1a')]);}_0x4959bb[_0x4e3b('0x32')]=qs['sort'](_0x484489[_0x4e3b('0x2b')][_0x4e3b('0x33')]);_0x4959bb[_0x4e3b('0x34')]=qs[_0x4e3b('0x35')](_[_0x4e3b('0x36')](_0x484489[_0x4e3b('0x2b')],_0x36b7c3[_0x4e3b('0x35')]),_0x52e2fa);if(_0x484489[_0x4e3b('0x2b')][_0x4e3b('0x37')]){_0x4959bb['where']=_[_0x4e3b('0x38')](_0x4959bb[_0x4e3b('0x34')],{'$or':_[_0x4e3b('0x25')](_0x52e2fa,function(_0x8619ef){if(_0x8619ef[_0x4e3b('0x28')]!==_0x4e3b('0x39')){var _0x4b83a5={};_0x4b83a5[_0x8619ef[_0x4e3b('0x23')]]={'$like':'%'+_0x484489[_0x4e3b('0x2b')][_0x4e3b('0x37')]+'%'};return _0x4b83a5;}})});}_0x4959bb=_[_0x4e3b('0x38')]({},_0x4959bb,_0x484489[_0x4e3b('0x3a')]);var _0x37207e={'where':_0x4959bb[_0x4e3b('0x34')]};return db[_0x4e3b('0x26')][_0x4e3b('0x1d')](_0x37207e)[_0x4e3b('0x20')](function(_0x138c56){_0x480bec['count']=_0x138c56;if(_0x484489[_0x4e3b('0x2b')][_0x4e3b('0x3b')]){_0x4959bb[_0x4e3b('0x3c')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x4e3b('0x3d')](_0x4959bb);})[_0x4e3b('0x20')](function(_0x55b1e8){_0x480bec[_0x4e3b('0x3e')]=_0x55b1e8;return _0x480bec;})[_0x4e3b('0x20')](respondWithFilteredResult(_0x15c470,_0x4959bb))[_0x4e3b('0x3f')](handleError(_0x15c470,null));};exports[_0x4e3b('0x40')]=function(_0x732e38,_0x1a79e2){var _0x2b2aff={'raw':!![],'where':{'id':_0x732e38[_0x4e3b('0x41')]['id']}},_0x1d7c27={};_0x1d7c27[_0x4e3b('0x2a')]=_[_0x4e3b('0x42')](db[_0x4e3b('0x26')][_0x4e3b('0x43')]);_0x1d7c27[_0x4e3b('0x2b')]=_['keys'](_0x732e38['query']);_0x1d7c27[_0x4e3b('0x35')]=_[_0x4e3b('0x2c')](_0x1d7c27[_0x4e3b('0x2a')],_0x1d7c27['query']);_0x2b2aff[_0x4e3b('0x2d')]=_['intersection'](_0x1d7c27[_0x4e3b('0x2a')],qs['fields'](_0x732e38[_0x4e3b('0x2b')][_0x4e3b('0x2e')]));_0x2b2aff[_0x4e3b('0x2d')]=_0x2b2aff[_0x4e3b('0x2d')]['length']?_0x2b2aff[_0x4e3b('0x2d')]:_0x1d7c27['model'];if(_0x732e38[_0x4e3b('0x2b')][_0x4e3b('0x3b')]){_0x2b2aff[_0x4e3b('0x3c')]=[{'all':!![]}];}_0x2b2aff=_[_0x4e3b('0x38')]({},_0x2b2aff,_0x732e38[_0x4e3b('0x3a')]);return db[_0x4e3b('0x26')][_0x4e3b('0x44')](_0x2b2aff)[_0x4e3b('0x20')](handleEntityNotFound(_0x1a79e2,null))['then'](respondWithResult(_0x1a79e2,null))[_0x4e3b('0x3f')](handleError(_0x1a79e2,null));};exports[_0x4e3b('0x45')]=function(_0x1d5411,_0x4512ea){return db[_0x4e3b('0x26')][_0x4e3b('0x45')](_0x1d5411[_0x4e3b('0x46')],{})[_0x4e3b('0x20')](respondWithResult(_0x4512ea,0xc9))[_0x4e3b('0x3f')](handleError(_0x4512ea,null));};exports[_0x4e3b('0x47')]=function(_0x26e594,_0x50c5aa){if(_0x26e594[_0x4e3b('0x46')]['id']){delete _0x26e594['body']['id'];}return db[_0x4e3b('0x26')]['find']({'where':{'id':_0x26e594['params']['id']}})[_0x4e3b('0x20')](handleEntityNotFound(_0x50c5aa,null))['then'](saveUpdates(_0x26e594[_0x4e3b('0x46')],null))[_0x4e3b('0x20')](respondWithResult(_0x50c5aa,null))[_0x4e3b('0x3f')](handleError(_0x50c5aa,null));};exports['destroy']=function(_0x1d04b4,_0x1c5ff7){return db[_0x4e3b('0x26')][_0x4e3b('0x44')]({'where':{'id':_0x1d04b4[_0x4e3b('0x41')]['id']}})[_0x4e3b('0x20')](handleEntityNotFound(_0x1c5ff7,null))[_0x4e3b('0x20')](removeEntity(_0x1c5ff7,null))[_0x4e3b('0x3f')](handleError(_0x1c5ff7,null));};exports[_0x4e3b('0x48')]=function(_0x4290b1,_0x42c9a0){return db['VoiceDialReport'][_0x4e3b('0x48')]()[_0x4e3b('0x20')](respondWithResult(_0x42c9a0,null))[_0x4e3b('0x3f')](handleError(_0x42c9a0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0c8c612..4f2e355 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 _0xaeff=['../../config/environment','exports','VoiceDialReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xaeff,0xea));var _0xfaef=function(_0x3684c9,_0x4aed43){_0x3684c9=_0x3684c9-0x0;var _0x1e71f7=_0xaeff[_0x3684c9];return _0x1e71f7;};'use strict';var _=require(_0xfaef('0x0'));var util=require(_0xfaef('0x1'));var logger=require(_0xfaef('0x2'))(_0xfaef('0x3'));var moment=require(_0xfaef('0x4'));var BPromise=require(_0xfaef('0x5'));var rp=require(_0xfaef('0x6'));var fs=require('fs');var path=require(_0xfaef('0x7'));var rimraf=require('rimraf');var config=require(_0xfaef('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0xfaef('0x9')]=function(_0x2675fb,_0x583c4f){return _0x2675fb['define'](_0xfaef('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x070c=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x392a8d,_0x218ead){var _0x529487=function(_0x56efb7){while(--_0x56efb7){_0x392a8d['push'](_0x392a8d['shift']());}};_0x529487(++_0x218ead);}(_0x070c,0xfb));var _0xc070=function(_0x599771,_0x5a0f8f){_0x599771=_0x599771-0x0;var _0x36c52a=_0x070c[_0x599771];return _0x36c52a;};'use strict';var _=require(_0xc070('0x0'));var util=require(_0xc070('0x1'));var logger=require(_0xc070('0x2'))(_0xc070('0x3'));var moment=require(_0xc070('0x4'));var BPromise=require(_0xc070('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc070('0x6'));var rimraf=require('rimraf');var config=require(_0xc070('0x7'));var attributes=require(_0xc070('0x8'));module[_0xc070('0x9')]=function(_0x429369,_0x9c4f6f){return _0x429369[_0xc070('0xa')](_0xc070('0xb'),attributes,{'tableName':_0xc070('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc070('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 1d7cf13..16e8f55 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 _0xd89a=['code','message','result','VoiceDialReport','body','options','then','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0xd89a,0x151));var _0xad89=function(_0x192b1e,_0x578930){_0x192b1e=_0x192b1e-0x0;var _0x5db684=_0xd89a[_0x192b1e];return _0x5db684;};'use strict';var _=require('lodash');var util=require(_0xad89('0x0'));var moment=require(_0xad89('0x1'));var BPromise=require(_0xad89('0x2'));var rs=require(_0xad89('0x3'));var fs=require('fs');var Redis=require(_0xad89('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xad89('0x5'));var logger=require(_0xad89('0x6'))(_0xad89('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x560f2f,_0x1842d3,_0x1e2f3c){return new BPromise(function(_0x9ed3ea,_0x107ff5){return client['request'](_0x560f2f,_0x1e2f3c)['then'](function(_0x2532f6){logger[_0xad89('0x8')](_0xad89('0x9'),_0x1842d3,_0xad89('0xa'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1842d3,_0xad89('0xa'),JSON[_0xad89('0xb')](_0x2532f6));if(_0x2532f6['error']){if(_0x2532f6[_0xad89('0xc')][_0xad89('0xd')]===0x1f4){logger[_0xad89('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x1842d3,_0x2532f6['error'][_0xad89('0xe')]);return _0x107ff5(_0x2532f6[_0xad89('0xc')]['message']);}logger['error'](_0xad89('0x9'),_0x1842d3,_0x2532f6['error'][_0xad89('0xe')]);return _0x9ed3ea(_0x2532f6[_0xad89('0xc')][_0xad89('0xe')]);}else{logger[_0xad89('0x8')](_0xad89('0x9'),_0x1842d3,'request\x20sent');_0x9ed3ea(_0x2532f6[_0xad89('0xf')][_0xad89('0xe')]);}})['catch'](function(_0xf2ef8e){logger[_0xad89('0xc')](_0xad89('0x9'),_0x1842d3,_0xf2ef8e);_0x107ff5(_0xf2ef8e);});});}exports['CreateVoiceDialReport']=function(_0x53be39){var _0xeb055f=this;return new Promise(function(_0x2f1fc4,_0x13f8e3){return db[_0xad89('0x10')]['create'](_0x53be39[_0xad89('0x11')],{'raw':_0x53be39[_0xad89('0x12')]?_0x53be39[_0xad89('0x12')]['raw']===undefined?!![]:![]:!![]})[_0xad89('0x13')](function(_0x3ad5da){logger['info'](_0xad89('0x14'),_0x53be39);logger[_0xad89('0x15')]('CreateVoiceDialReport',_0x53be39,JSON[_0xad89('0xb')](_0x3ad5da));_0x2f1fc4(_0x3ad5da);})['catch'](function(_0x3ec5b8){logger['error']('CreateVoiceDialReport',_0x3ec5b8[_0xad89('0xe')],_0x53be39);_0x13f8e3(_0xeb055f['error'](0x1f4,_0x3ec5b8[_0xad89('0xe')]));});});};exports[_0xad89('0x16')]=function(_0x1e458d){var _0x4f964d=this;return new Promise(function(_0x436a0f,_0x399d58){return db['VoiceDialReport'][_0xad89('0x17')](_0x1e458d[_0xad89('0x11')],{'raw':_0x1e458d[_0xad89('0x12')]?_0x1e458d[_0xad89('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e458d[_0xad89('0x12')]?_0x1e458d['options']['where']||null:null,'attributes':_0x1e458d['options']?_0x1e458d[_0xad89('0x12')][_0xad89('0x18')]||null:null,'limit':_0x1e458d['options']?_0x1e458d[_0xad89('0x12')]['limit']||null:null})['then'](function(_0x5c0da0){logger[_0xad89('0x8')](_0xad89('0x16'),_0x1e458d);logger[_0xad89('0x15')](_0xad89('0x16'),_0x1e458d,JSON[_0xad89('0xb')](_0x5c0da0));_0x436a0f(_0x5c0da0);})['catch'](function(_0x3f2e1b){logger['error'](_0xad89('0x16'),_0x3f2e1b[_0xad89('0xe')],_0x1e458d);_0x399d58(_0x4f964d[_0xad89('0xc')](0x1f4,_0x3f2e1b[_0xad89('0xe')]));});});}; \ No newline at end of file +var _0xa522=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','body','options','raw','CreateVoiceDialReport','debug','UpdateVoiceDialReport','VoiceDialReport','update','where','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info'];(function(_0x5eed2b,_0x1634fd){var _0x28e48d=function(_0x4102e4){while(--_0x4102e4){_0x5eed2b['push'](_0x5eed2b['shift']());}};_0x28e48d(++_0x1634fd);}(_0xa522,0x162));var _0x2a52=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xa522[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0x2a52('0x0'));var util=require('util');var moment=require(_0x2a52('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2a52('0x3'));var logger=require(_0x2a52('0x4'))(_0x2a52('0x5'));var config=require('../../config/environment');var jayson=require(_0x2a52('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9eb7,_0x4e74f4,_0x50e90c){return new BPromise(function(_0x5e97bc,_0x529b15){return client[_0x2a52('0x7')](_0x9eb7,_0x50e90c)[_0x2a52('0x8')](function(_0xdcc10b){logger[_0x2a52('0x9')](_0x2a52('0xa'),_0x4e74f4,'request\x20sent');logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4e74f4,_0x2a52('0xb'),JSON[_0x2a52('0xc')](_0xdcc10b));if(_0xdcc10b[_0x2a52('0xd')]){if(_0xdcc10b['error']['code']===0x1f4){logger[_0x2a52('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x4e74f4,_0xdcc10b[_0x2a52('0xd')][_0x2a52('0xe')]);return _0x529b15(_0xdcc10b[_0x2a52('0xd')][_0x2a52('0xe')]);}logger[_0x2a52('0xd')](_0x2a52('0xa'),_0x4e74f4,_0xdcc10b['error'][_0x2a52('0xe')]);return _0x5e97bc(_0xdcc10b['error']['message']);}else{logger[_0x2a52('0x9')](_0x2a52('0xa'),_0x4e74f4,_0x2a52('0xb'));_0x5e97bc(_0xdcc10b[_0x2a52('0xf')][_0x2a52('0xe')]);}})[_0x2a52('0x10')](function(_0x105e85){logger[_0x2a52('0xd')](_0x2a52('0xa'),_0x4e74f4,_0x105e85);_0x529b15(_0x105e85);});});}exports['CreateVoiceDialReport']=function(_0x3c30b7){var _0x4aef18=this;return new Promise(function(_0x1cf7ad,_0xe90dfb){return db['VoiceDialReport']['create'](_0x3c30b7[_0x2a52('0x11')],{'raw':_0x3c30b7[_0x2a52('0x12')]?_0x3c30b7['options'][_0x2a52('0x13')]===undefined?!![]:![]:!![]})[_0x2a52('0x8')](function(_0x5310a4){logger[_0x2a52('0x9')](_0x2a52('0x14'),_0x3c30b7);logger[_0x2a52('0x15')](_0x2a52('0x14'),_0x3c30b7,JSON['stringify'](_0x5310a4));_0x1cf7ad(_0x5310a4);})[_0x2a52('0x10')](function(_0x33eacc){logger[_0x2a52('0xd')](_0x2a52('0x14'),_0x33eacc['message'],_0x3c30b7);_0xe90dfb(_0x4aef18[_0x2a52('0xd')](0x1f4,_0x33eacc['message']));});});};exports[_0x2a52('0x16')]=function(_0x448a9f){var _0x5927a1=this;return new Promise(function(_0x3761ca,_0x25d795){return db[_0x2a52('0x17')][_0x2a52('0x18')](_0x448a9f['body'],{'raw':_0x448a9f[_0x2a52('0x12')]?_0x448a9f[_0x2a52('0x12')][_0x2a52('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x448a9f[_0x2a52('0x12')]?_0x448a9f[_0x2a52('0x12')][_0x2a52('0x19')]||null:null,'attributes':_0x448a9f[_0x2a52('0x12')]?_0x448a9f[_0x2a52('0x12')]['attributes']||null:null,'limit':_0x448a9f['options']?_0x448a9f[_0x2a52('0x12')]['limit']||null:null})[_0x2a52('0x8')](function(_0x125b76){logger['info'](_0x2a52('0x16'),_0x448a9f);logger['debug'](_0x2a52('0x16'),_0x448a9f,JSON[_0x2a52('0xc')](_0x125b76));_0x3761ca(_0x125b76);})[_0x2a52('0x10')](function(_0x3017ce){logger['error'](_0x2a52('0x16'),_0x3017ce['message'],_0x448a9f);_0x25d795(_0x5927a1[_0x2a52('0xd')](0x1f4,_0x3017ce[_0x2a52('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 4889d45..3c461ae 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 _0x8731=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8731,0x9e));var _0x1873=function(_0x34dbe0,_0x27f086){_0x34dbe0=_0x34dbe0-0x0;var _0x403264=_0x8731[_0x34dbe0];return _0x403264;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1873('0x0'));var timeout=require(_0x1873('0x1'));var express=require(_0x1873('0x2'));var router=express[_0x1873('0x3')]();var fs_extra=require(_0x1873('0x4'));var auth=require(_0x1873('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1873('0x6'));var controller=require('./voiceExtension.controller');router[_0x1873('0x7')]('/',auth[_0x1873('0x8')](),controller['index']);router[_0x1873('0x7')](_0x1873('0x9'),auth[_0x1873('0x8')](),controller[_0x1873('0xa')]);router['post']('/',auth[_0x1873('0x8')](),controller['create']);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router['put'](_0x1873('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1873('0x9'),auth[_0x1873('0x8')](),controller[_0x1873('0xb')]);module[_0x1873('0xc')]=router; \ No newline at end of file +var _0x0951=['fs-extra','../../components/interaction/service','../../config/environment','index','/:id','post','isAuthenticated','create','/:id/applications','addApplications','put','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x15c8ce,_0x106817){var _0x5b4082=function(_0x3065b4){while(--_0x3065b4){_0x15c8ce['push'](_0x15c8ce['shift']());}};_0x5b4082(++_0x106817);}(_0x0951,0x1ab));var _0x1095=function(_0x5c2c3f,_0x159ca6){_0x5c2c3f=_0x5c2c3f-0x0;var _0x4c612d=_0x0951[_0x5c2c3f];return _0x4c612d;};'use strict';var multer=require(_0x1095('0x0'));var util=require(_0x1095('0x1'));var path=require('path');var timeout=require(_0x1095('0x2'));var express=require(_0x1095('0x3'));var router=express[_0x1095('0x4')]();var fs_extra=require(_0x1095('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1095('0x6'));var config=require(_0x1095('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1095('0x8')]);router['get'](_0x1095('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1095('0xa')]('/',auth[_0x1095('0xb')](),controller[_0x1095('0xc')]);router['post'](_0x1095('0xd'),auth[_0x1095('0xb')](),controller[_0x1095('0xe')]);router[_0x1095('0xf')](_0x1095('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1095('0x10')]('/:id',auth[_0x1095('0xb')](),controller[_0x1095('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2da57dd..973bcb2 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 _0xbfef=['exten','sequelize','STRING','NoOp','ENUM','inbound','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav'];(function(_0x2f267a,_0x36e821){var _0x28bd67=function(_0x447529){while(--_0x447529){_0x2f267a['push'](_0x2f267a['shift']());}};_0x28bd67(++_0x36e821);}(_0xbfef,0x1c1));var _0xfbfe=function(_0x5d53ec,_0x41dfa0){_0x5d53ec=_0x5d53ec-0x0;var _0x2e4f0d=_0xbfef[_0x5d53ec];return _0x2e4f0d;};'use strict';var Sequelize=require(_0xfbfe('0x0'));module['exports']={'context':{'type':Sequelize[_0xfbfe('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xfbfe('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xfbfe('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xfbfe('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xfbfe('0x1')],'allowNull':![],'defaultValue':_0xfbfe('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xfbfe('0x3')](_0xfbfe('0x4'),'outbound','internal',_0xfbfe('0x5'),_0xfbfe('0x6'),_0xfbfe('0x7'),_0xfbfe('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xfbfe('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfbfe('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xfbfe('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xfbfe('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xfbfe('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xfbfe('0xc')},'answer':{'type':Sequelize[_0xfbfe('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1eab10){return this['getDataValue'](_0xfbfe('0xd'));}},'alias':{'type':Sequelize[_0xfbfe('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8260=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','compositeIndex','NoOp','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8260,0x1d4));var _0x0826=function(_0x179604,_0x48c283){_0x179604=_0x179604-0x0;var _0x29b655=_0x8260[_0x179604];return _0x29b655;};'use strict';var Sequelize=require(_0x0826('0x0'));module['exports']={'context':{'type':Sequelize[_0x0826('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x0826('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x0826('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0826('0x1')],'allowNull':![],'defaultValue':_0x0826('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x0826('0x4'),_0x0826('0x5'),_0x0826('0x6'),_0x0826('0x7'),_0x0826('0x8'),_0x0826('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0826('0x1')]},'interval':{'type':Sequelize[_0x0826('0x1')],'allowNull':![],'defaultValue':_0x0826('0xa')},'IntervalId':{'type':Sequelize[_0x0826('0xb')]},'isApp':{'type':Sequelize[_0x0826('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0826('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0826('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0826('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0826('0xb')]},'recordingFormat':{'type':Sequelize[_0x0826('0x1')],'defaultValue':_0x0826('0xd')},'answer':{'type':Sequelize[_0x0826('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0826('0xe')],'get':function(_0x24b6ca){return this[_0x0826('0xf')]('exten');}},'alias':{'type':Sequelize[_0x0826('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index d338641..2e224e1 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 _0x737c=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','finally','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','include','findAll','catch','show','params','includeAll','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','sequelize','transaction'];(function(_0x24be82,_0x4449c1){var _0x1c36e1=function(_0x524b2c){while(--_0x524b2c){_0x24be82['push'](_0x24be82['shift']());}};_0x1c36e1(++_0x4449c1);}(_0x737c,0xbe));var _0xc737=function(_0x6b475b,_0x3b9f10){_0x6b475b=_0x6b475b-0x0;var _0x472550=_0x737c[_0x6b475b];return _0x472550;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xc737('0x0'))(_0xc737('0x1'));var config=require('../../config/environment');var db=require(_0xc737('0x2'))['db'];config[_0xc737('0x3')]=_[_0xc737('0x4')](config[_0xc737('0x3')],{'host':_0xc737('0x5'),'port':0x18eb});var socket=require(_0xc737('0x6'))(new Redis(config[_0xc737('0x3')]));require(_0xc737('0x7'))[_0xc737('0x8')](socket);function respondWithStatusCode(_0x25fada,_0x4e94a5){_0x4e94a5=_0x4e94a5||0xcc;return function(_0x21d9af){if(_0x21d9af){return _0x25fada[_0xc737('0x9')](_0x4e94a5);}return _0x25fada[_0xc737('0xa')](_0x4e94a5)[_0xc737('0xb')]();};}function respondWithResult(_0x5bb488,_0x5d7e2a){_0x5d7e2a=_0x5d7e2a||0xc8;return function(_0x35abd9){if(_0x35abd9){return _0x5bb488['status'](_0x5d7e2a)[_0xc737('0xc')](_0x35abd9);}};}function respondWithFilteredResult(_0x49989a,_0xe0c27a){return function(_0x3b13b0){if(_0x3b13b0){var _0x2119f9=typeof _0xe0c27a[_0xc737('0xd')]===_0xc737('0xe')&&typeof _0xe0c27a[_0xc737('0xf')]==='undefined';var _0x3d9f5a=_0x3b13b0[_0xc737('0x10')];var _0x597d45=_0x2119f9?0x0:_0xe0c27a[_0xc737('0xd')];var _0x44bed9=_0x2119f9?_0x3b13b0[_0xc737('0x10')]:_0xe0c27a['offset']+_0xe0c27a[_0xc737('0xf')];var _0x444278;if(_0x44bed9>=_0x3d9f5a){_0x44bed9=_0x3d9f5a;_0x444278=0xc8;}else{_0x444278=0xce;}_0x49989a['status'](_0x444278);return _0x49989a['set'](_0xc737('0x11'),_0x597d45+'-'+_0x44bed9+'/'+_0x3d9f5a)[_0xc737('0xc')](_0x3b13b0);}return null;};}function removeEntity(_0x67ee02){return function(_0x17f9e2){if(_0x17f9e2){return _0x17f9e2[_0xc737('0x12')]()[_0xc737('0x13')](function(){var _0x40c491=_0x17f9e2[_0xc737('0x14')]({'plain':!![]});var _0x499a37=[{'name':_0xc737('0x15'),'value':_0xc737('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0xc737('0x17'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x27b541=_(_0x499a37)[_0xc737('0x18')](_0xc737('0x19'))[_0xc737('0x1a')](_0xc737('0x1b'))[_0xc737('0x1b')]();if(_[_0xc737('0x1c')](_0x27b541,_0x40c491[_0xc737('0x1d')])){return;}var _0x4d2ecc=_[_0xc737('0x1e')](_0x499a37,['value',_0x40c491[_0xc737('0x1d')]])['name'];return db[_0xc737('0x1f')][_0xc737('0x12')]({'where':{'type':_0x4d2ecc,'resourceId':_0x40c491['id']}})[_0xc737('0x13')](function(){return _0x17f9e2;});})[_0xc737('0x13')](function(){_0x67ee02[_0xc737('0xa')](0xcc)[_0xc737('0xb')]();});}};}function handleEntityNotFound(_0x565cc1){return function(_0x2fd942){if(!_0x2fd942){_0x565cc1['sendStatus'](0x194);}return _0x2fd942;};}function handleError(_0x49036f,_0x43be9a){_0x43be9a=_0x43be9a||0x1f4;return function(_0x4bd710){logger[_0xc737('0x20')](_0x4bd710[_0xc737('0x21')]);if(_0x4bd710['name']){delete _0x4bd710[_0xc737('0x22')];}_0x49036f[_0xc737('0xa')](_0x43be9a)[_0xc737('0x23')](_0x4bd710);};}exports[_0xc737('0x24')]=function(_0x489b66,_0x3c51a5){var _0x10d45a={},_0x162f7a={},_0x359dcc={'count':0x0,'rows':[]};var _0x40a671=_['map'](db[_0xc737('0x25')][_0xc737('0x26')],function(_0x514693){return{'name':_0x514693[_0xc737('0x27')],'type':_0x514693['type'][_0xc737('0x28')]};});_0x162f7a[_0xc737('0x29')]=_[_0xc737('0x1a')](_0x40a671,_0xc737('0x22'));_0x162f7a[_0xc737('0x2a')]=_[_0xc737('0x2b')](_0x489b66['query']);_0x162f7a[_0xc737('0x2c')]=_[_0xc737('0x2d')](_0x162f7a['model'],_0x162f7a[_0xc737('0x2a')]);_0x10d45a[_0xc737('0x2e')]=_[_0xc737('0x2d')](_0x162f7a[_0xc737('0x29')],qs[_0xc737('0x2f')](_0x489b66['query'][_0xc737('0x2f')]));_0x10d45a[_0xc737('0x2e')]=_0x10d45a[_0xc737('0x2e')][_0xc737('0x30')]?_0x10d45a[_0xc737('0x2e')]:_0x162f7a[_0xc737('0x29')];if(!_0x489b66[_0xc737('0x2a')]['hasOwnProperty'](_0xc737('0x31'))){_0x10d45a['limit']=qs['limit'](_0x489b66[_0xc737('0x2a')][_0xc737('0xf')]);_0x10d45a['offset']=qs[_0xc737('0xd')](_0x489b66[_0xc737('0x2a')][_0xc737('0xd')]);}_0x10d45a[_0xc737('0x32')]=qs[_0xc737('0x33')](_0x489b66['query']['sort']);_0x10d45a[_0xc737('0x34')]=qs['filters'](_[_0xc737('0x35')](_0x489b66[_0xc737('0x2a')],_0x162f7a['filters']),_0x40a671);if(_0x489b66[_0xc737('0x2a')][_0xc737('0x18')]){_0x10d45a[_0xc737('0x34')]=_[_0xc737('0x36')](_0x10d45a[_0xc737('0x34')],{'$or':_[_0xc737('0x1a')](_0x40a671,function(_0x36b80f){if(_0x36b80f[_0xc737('0x1d')]!=='VIRTUAL'){var _0x4293f0={};_0x4293f0[_0x36b80f['name']]={'$like':'%'+_0x489b66['query'][_0xc737('0x18')]+'%'};return _0x4293f0;}})});}_0x10d45a=_[_0xc737('0x36')]({},_0x10d45a,_0x489b66['options']);var _0xfb4591={'where':_0x10d45a[_0xc737('0x34')]};return db[_0xc737('0x25')][_0xc737('0x10')](_0xfb4591)[_0xc737('0x13')](function(_0x33084f){_0x359dcc[_0xc737('0x10')]=_0x33084f;if(_0x489b66['query']['includeAll']){_0x10d45a[_0xc737('0x37')]=[{'all':!![]}];}return db[_0xc737('0x25')][_0xc737('0x38')](_0x10d45a);})[_0xc737('0x13')](function(_0xbe057e){_0x359dcc['rows']=_0xbe057e;return _0x359dcc;})[_0xc737('0x13')](respondWithFilteredResult(_0x3c51a5,_0x10d45a))[_0xc737('0x39')](handleError(_0x3c51a5,null));};exports[_0xc737('0x3a')]=function(_0x214d6f,_0xb6a189){var _0x3b0342={'raw':![],'where':{'id':_0x214d6f[_0xc737('0x3b')]['id']}},_0x20b815={};_0x20b815[_0xc737('0x29')]=_[_0xc737('0x2b')](db[_0xc737('0x25')][_0xc737('0x26')]);_0x20b815[_0xc737('0x2a')]=_[_0xc737('0x2b')](_0x214d6f['query']);_0x20b815['filters']=_['intersection'](_0x20b815['model'],_0x20b815['query']);_0x3b0342[_0xc737('0x2e')]=_['intersection'](_0x20b815[_0xc737('0x29')],qs[_0xc737('0x2f')](_0x214d6f[_0xc737('0x2a')][_0xc737('0x2f')]));_0x3b0342[_0xc737('0x2e')]=_0x3b0342[_0xc737('0x2e')][_0xc737('0x30')]?_0x3b0342['attributes']:_0x20b815[_0xc737('0x29')];if(_0x214d6f[_0xc737('0x2a')][_0xc737('0x3c')]){_0x3b0342['include']=[{'all':!![]}];}_0x3b0342=_['merge']({},_0x3b0342,_0x214d6f['options']);return db[_0xc737('0x25')][_0xc737('0x1e')](_0x3b0342)[_0xc737('0x13')](handleEntityNotFound(_0xb6a189,null))[_0xc737('0x13')](respondWithResult(_0xb6a189,null))['catch'](handleError(_0xb6a189,null));};exports['destroy']=function(_0x1ecf37,_0x56dea7){return db['VoiceExtension'][_0xc737('0x1e')]({'where':{'id':_0x1ecf37[_0xc737('0x3b')]['id']}})[_0xc737('0x13')](handleEntityNotFound(_0x56dea7,null))[_0xc737('0x13')](removeEntity(_0x56dea7,null))[_0xc737('0x39')](handleError(_0x56dea7,null));};exports[_0xc737('0x3d')]=function(_0x3abe3c,_0x2a69a4){if(_0x3abe3c['body'][_0xc737('0x1d')]==='outbound'&&!_[_0xc737('0x3e')](_0x3abe3c[_0xc737('0x3f')][_0xc737('0x40')],'_')){_0x3abe3c['body']['exten']='_'[_0xc737('0x41')](_0x3abe3c['body'][_0xc737('0x40')]);}return db[_0xc737('0x25')][_0xc737('0x3d')](_0x3abe3c['body'],{'raw':![]})[_0xc737('0x13')](function(_0x709c79){var _0x32cb89=_0x3abe3c[_0xc737('0x42')]['get']({'plain':!![]});if(!_0x32cb89)throw new Error(_0xc737('0x43'));if(_0x32cb89[_0xc737('0x44')]===_0xc737('0x42')){var _0x4baaa7=_0x709c79[_0xc737('0x14')]({'plain':!![]});var _0x19def2=[{'name':_0xc737('0x15'),'value':_0xc737('0x16')},{'name':_0xc737('0x45'),'value':_0xc737('0x17')},{'name':_0xc737('0x46'),'value':_0xc737('0x47')}];var _0x426c24=_[_0xc737('0x1e')](_0x19def2,['value',_0x4baaa7[_0xc737('0x1d')]])['name'];return db[_0xc737('0x48')]['find']({'where':{'name':_0x426c24,'userProfileId':_0x32cb89[_0xc737('0x49')]},'raw':!![]})['then'](function(_0x4f955a){if(_0x4f955a&&_0x4f955a[_0xc737('0x4a')]===0x0){return db['UserProfileResource'][_0xc737('0x3d')]({'name':_0x4baaa7[_0xc737('0x22')],'resourceId':_0x4baaa7['id'],'type':_0x4f955a[_0xc737('0x22')],'sectionId':_0x4f955a['id']},{})[_0xc737('0x13')](function(){return _0x709c79;});}else{return _0x709c79;}})[_0xc737('0x39')](function(_0x1a670e){logger['error'](_0xc737('0x4b'),_0x1a670e);throw _0x1a670e;});}return _0x709c79;})[_0xc737('0x13')](respondWithResult(_0x2a69a4,0xc9))[_0xc737('0x39')](handleError(_0x2a69a4,null));};exports[_0xc737('0x4c')]=function(_0x1591c6,_0x5ec105){if(_0x1591c6['body']['id']){delete _0x1591c6[_0xc737('0x3f')]['id'];}return db[_0xc737('0x25')][_0xc737('0x1e')]({'where':{'id':_0x1591c6[_0xc737('0x3b')]['id']}})[_0xc737('0x13')](handleEntityNotFound(_0x5ec105,null))[_0xc737('0x13')](function(_0x5339e8){if(_0x5339e8){return db[_0xc737('0x25')][_0xc737('0x4c')](_['pick'](_0x1591c6[_0xc737('0x3f')],['exten',_0xc737('0x4d'),_0xc737('0x4e'),_0xc737('0x4f'),'cutdigits',_0xc737('0x50'),'alias']),{'where':{'context':_0x5339e8[_0xc737('0x4d')],'exten':_0x5339e8['exten']},'individualHooks':!![]})['then'](function(_0x3de5ee){return _0x3de5ee;});}return null;})[_0xc737('0x13')](respondWithStatusCode(_0x5ec105,null))['catch'](handleError(_0x5ec105,null));};exports['addApplications']=function(_0x5d53b0,_0x29e025){var _0x597241=_0x5d53b0[_0xc737('0x3b')]['id'];var _0x48e98d=_0x5d53b0['body'];var _0x4196d3=0xc8;var _0x5c7f4a=null;return db[_0xc737('0x51')][_0xc737('0x52')]({'isolationLevel':db['sequelize'][_0xc737('0x53')][_0xc737('0x54')][_0xc737('0x55')]},function(_0x1f84be){return db[_0xc737('0x25')]['findOne']({'where':{'id':_0x597241},'transaction':_0x1f84be})['then'](function(_0x3e219c){if(_0x3e219c){return db[_0xc737('0x25')][_0xc737('0x12')]({'where':{'VoiceExtensionId':_0x597241},'transaction':_0x1f84be})[_0xc737('0x13')](function(){var _0x6604d4=_[_0xc737('0x1a')](_0x48e98d,function(_0x5760a9){_0x5760a9[_0xc737('0x56')]=_0x597241;_0x5760a9[_0xc737('0x57')]=!![];return _0x5760a9;});return _0x3e219c[_0xc737('0x58')](_0x6604d4);})[_0xc737('0x13')](function(_0x3aa2ca){return db[_0xc737('0x25')]['bulkCreate'](_0x3aa2ca,{'transaction':_0x1f84be});});}else{_0x4196d3=0x194;_0x5c7f4a=[];}});})['then'](function(){if(_0x4196d3!==0x194){return db['VoiceExtension'][_0xc737('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x597241},'order':'cast(priority\x20as\x20unsigned)'})[_0xc737('0x13')](function(_0x14a699){_0x5c7f4a=_0x14a699;});}})['catch'](function(_0x2ddf5f){_0x4196d3=0x1f4;logger[_0xc737('0x20')](_0x2ddf5f[_0xc737('0x21')]);if(_0x2ddf5f[_0xc737('0x22')]){delete _0x2ddf5f['name'];}_0x5c7f4a=_0x2ddf5f;})[_0xc737('0x5a')](function(){if(_0x5c7f4a===null){_0x29e025[_0xc737('0x9')](_0x4196d3);}else{if(_0x4196d3===0x1f4){_0x29e025['status'](_0x4196d3)[_0xc737('0x23')](_0x5c7f4a);}else{_0x29e025[_0xc737('0xa')](_0x4196d3)['json'](_0x5c7f4a);}}});}; \ No newline at end of file +var _0x80f1=['mandatoryDisposition','transaction','sequelize','Transaction','ISOLATION_LEVELS','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','includes','type','find','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','value','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits'];(function(_0x168478,_0x323a27){var _0x29c2f8=function(_0x4f7a8a){while(--_0x4f7a8a){_0x168478['push'](_0x168478['shift']());}};_0x29c2f8(++_0x323a27);}(_0x80f1,0x11f));var _0x180f=function(_0x1e09ef,_0x17e23f){_0x1e09ef=_0x1e09ef-0x0;var _0x2d1254=_0x80f1[_0x1e09ef];return _0x2d1254;};'use strict';var _=require('lodash');var Redis=require(_0x180f('0x0'));var qs=require(_0x180f('0x1'));var logger=require('../../config/logger')(_0x180f('0x2'));var config=require(_0x180f('0x3'));var db=require(_0x180f('0x4'))['db'];config[_0x180f('0x5')]=_['defaults'](config['redis'],{'host':_0x180f('0x6'),'port':0x18eb});var socket=require(_0x180f('0x7'))(new Redis(config[_0x180f('0x5')]));require(_0x180f('0x8'))[_0x180f('0x9')](socket);function respondWithStatusCode(_0x29b634,_0x3fc78b){_0x3fc78b=_0x3fc78b||0xcc;return function(_0x3e03f7){if(_0x3e03f7){return _0x29b634['sendStatus'](_0x3fc78b);}return _0x29b634['status'](_0x3fc78b)['end']();};}function respondWithResult(_0x89166b,_0x55856d){_0x55856d=_0x55856d||0xc8;return function(_0x70eac6){if(_0x70eac6){return _0x89166b[_0x180f('0xa')](_0x55856d)[_0x180f('0xb')](_0x70eac6);}};}function respondWithFilteredResult(_0x7f1ed6,_0x37a08a){return function(_0x14a2ee){if(_0x14a2ee){var _0x9e082=typeof _0x37a08a[_0x180f('0xc')]===_0x180f('0xd')&&typeof _0x37a08a[_0x180f('0xe')]===_0x180f('0xd');var _0x56ccc2=_0x14a2ee[_0x180f('0xf')];var _0x24d439=_0x9e082?0x0:_0x37a08a['offset'];var _0x5bbba3=_0x9e082?_0x14a2ee[_0x180f('0xf')]:_0x37a08a['offset']+_0x37a08a[_0x180f('0xe')];var _0x54caf9;if(_0x5bbba3>=_0x56ccc2){_0x5bbba3=_0x56ccc2;_0x54caf9=0xc8;}else{_0x54caf9=0xce;}_0x7f1ed6[_0x180f('0xa')](_0x54caf9);return _0x7f1ed6[_0x180f('0x10')](_0x180f('0x11'),_0x24d439+'-'+_0x5bbba3+'/'+_0x56ccc2)[_0x180f('0xb')](_0x14a2ee);}return null;};}function removeEntity(_0x4d2ed8){return function(_0x27a031){if(_0x27a031){return _0x27a031['destroy']()[_0x180f('0x12')](function(){var _0x1dc9f8=_0x27a031[_0x180f('0x13')]({'plain':!![]});var _0x5f1249=[{'name':'InboundRoutes','value':_0x180f('0x14'),'ignore':![]},{'name':_0x180f('0x15'),'value':_0x180f('0x16'),'ignore':![]},{'name':_0x180f('0x17'),'value':_0x180f('0x18'),'ignore':![]}];var _0x4fe8cf=_(_0x5f1249)[_0x180f('0x19')](_0x180f('0x1a'))[_0x180f('0x1b')]('value')['value']();if(_[_0x180f('0x1c')](_0x4fe8cf,_0x1dc9f8[_0x180f('0x1d')])){return;}var _0x3e8d71=_[_0x180f('0x1e')](_0x5f1249,['value',_0x1dc9f8[_0x180f('0x1d')]])['name'];return db[_0x180f('0x1f')][_0x180f('0x20')]({'where':{'type':_0x3e8d71,'resourceId':_0x1dc9f8['id']}})[_0x180f('0x12')](function(){return _0x27a031;});})[_0x180f('0x12')](function(){_0x4d2ed8[_0x180f('0xa')](0xcc)[_0x180f('0x21')]();});}};}function handleEntityNotFound(_0x278d05){return function(_0xc50a9c){if(!_0xc50a9c){_0x278d05[_0x180f('0x22')](0x194);}return _0xc50a9c;};}function handleError(_0x2482fd,_0x62bb6d){_0x62bb6d=_0x62bb6d||0x1f4;return function(_0x139544){logger['error'](_0x139544[_0x180f('0x23')]);if(_0x139544[_0x180f('0x24')]){delete _0x139544[_0x180f('0x24')];}_0x2482fd[_0x180f('0xa')](_0x62bb6d)[_0x180f('0x25')](_0x139544);};}exports[_0x180f('0x26')]=function(_0xc7ba9e,_0x13d3cd){var _0x322b0b={},_0x220ec6={},_0x55d677={'count':0x0,'rows':[]};var _0x4abac7=_[_0x180f('0x1b')](db['VoiceExtension'][_0x180f('0x27')],function(_0x5b72be){return{'name':_0x5b72be['fieldName'],'type':_0x5b72be[_0x180f('0x1d')][_0x180f('0x28')]};});_0x220ec6[_0x180f('0x29')]=_[_0x180f('0x1b')](_0x4abac7,'name');_0x220ec6[_0x180f('0x2a')]=_[_0x180f('0x2b')](_0xc7ba9e[_0x180f('0x2a')]);_0x220ec6[_0x180f('0x2c')]=_['intersection'](_0x220ec6['model'],_0x220ec6['query']);_0x322b0b[_0x180f('0x2d')]=_[_0x180f('0x2e')](_0x220ec6[_0x180f('0x29')],qs['fields'](_0xc7ba9e[_0x180f('0x2a')][_0x180f('0x2f')]));_0x322b0b[_0x180f('0x2d')]=_0x322b0b[_0x180f('0x2d')]['length']?_0x322b0b['attributes']:_0x220ec6[_0x180f('0x29')];if(!_0xc7ba9e['query'][_0x180f('0x30')](_0x180f('0x31'))){_0x322b0b[_0x180f('0xe')]=qs[_0x180f('0xe')](_0xc7ba9e[_0x180f('0x2a')]['limit']);_0x322b0b[_0x180f('0xc')]=qs[_0x180f('0xc')](_0xc7ba9e[_0x180f('0x2a')][_0x180f('0xc')]);}_0x322b0b['order']=qs[_0x180f('0x32')](_0xc7ba9e[_0x180f('0x2a')]['sort']);_0x322b0b[_0x180f('0x33')]=qs['filters'](_[_0x180f('0x34')](_0xc7ba9e[_0x180f('0x2a')],_0x220ec6[_0x180f('0x2c')]),_0x4abac7);if(_0xc7ba9e[_0x180f('0x2a')]['filter']){_0x322b0b['where']=_[_0x180f('0x35')](_0x322b0b[_0x180f('0x33')],{'$or':_[_0x180f('0x1b')](_0x4abac7,function(_0x54ec61){if(_0x54ec61['type']!==_0x180f('0x36')){var _0x3a8820={};_0x3a8820[_0x54ec61[_0x180f('0x24')]]={'$like':'%'+_0xc7ba9e[_0x180f('0x2a')][_0x180f('0x19')]+'%'};return _0x3a8820;}})});}_0x322b0b=_['merge']({},_0x322b0b,_0xc7ba9e['options']);var _0x2cfa4a={'where':_0x322b0b['where']};return db[_0x180f('0x37')][_0x180f('0xf')](_0x2cfa4a)[_0x180f('0x12')](function(_0x3e4ee0){_0x55d677[_0x180f('0xf')]=_0x3e4ee0;if(_0xc7ba9e[_0x180f('0x2a')][_0x180f('0x38')]){_0x322b0b[_0x180f('0x39')]=[{'all':!![]}];}return db[_0x180f('0x37')][_0x180f('0x3a')](_0x322b0b);})['then'](function(_0x892284){_0x55d677[_0x180f('0x3b')]=_0x892284;return _0x55d677;})['then'](respondWithFilteredResult(_0x13d3cd,_0x322b0b))[_0x180f('0x3c')](handleError(_0x13d3cd,null));};exports[_0x180f('0x3d')]=function(_0x1c5413,_0x3dcfd5){var _0x1b3124={'raw':![],'where':{'id':_0x1c5413[_0x180f('0x3e')]['id']}},_0x4eeb3f={};_0x4eeb3f['model']=_[_0x180f('0x2b')](db[_0x180f('0x37')][_0x180f('0x27')]);_0x4eeb3f[_0x180f('0x2a')]=_[_0x180f('0x2b')](_0x1c5413[_0x180f('0x2a')]);_0x4eeb3f[_0x180f('0x2c')]=_[_0x180f('0x2e')](_0x4eeb3f[_0x180f('0x29')],_0x4eeb3f[_0x180f('0x2a')]);_0x1b3124['attributes']=_[_0x180f('0x2e')](_0x4eeb3f[_0x180f('0x29')],qs['fields'](_0x1c5413['query'][_0x180f('0x2f')]));_0x1b3124['attributes']=_0x1b3124[_0x180f('0x2d')][_0x180f('0x3f')]?_0x1b3124['attributes']:_0x4eeb3f['model'];if(_0x1c5413[_0x180f('0x2a')]['includeAll']){_0x1b3124['include']=[{'all':!![]}];}_0x1b3124=_[_0x180f('0x35')]({},_0x1b3124,_0x1c5413[_0x180f('0x40')]);return db[_0x180f('0x37')][_0x180f('0x1e')](_0x1b3124)[_0x180f('0x12')](handleEntityNotFound(_0x3dcfd5,null))['then'](respondWithResult(_0x3dcfd5,null))[_0x180f('0x3c')](handleError(_0x3dcfd5,null));};exports[_0x180f('0x20')]=function(_0x480b6b,_0x52f4a2){return db[_0x180f('0x37')][_0x180f('0x1e')]({'where':{'id':_0x480b6b[_0x180f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x52f4a2,null))[_0x180f('0x12')](removeEntity(_0x52f4a2,null))[_0x180f('0x3c')](handleError(_0x52f4a2,null));};exports[_0x180f('0x41')]=function(_0x11dee5,_0x4d85f4){if(_0x11dee5[_0x180f('0x42')][_0x180f('0x1d')]===_0x180f('0x16')&&!_[_0x180f('0x43')](_0x11dee5[_0x180f('0x42')][_0x180f('0x44')],'_')){_0x11dee5['body'][_0x180f('0x44')]='_'['concat'](_0x11dee5[_0x180f('0x42')][_0x180f('0x44')]);}return db[_0x180f('0x37')]['create'](_0x11dee5[_0x180f('0x42')],{'raw':![]})[_0x180f('0x12')](function(_0x46d8ec){var _0x336804=_0x11dee5[_0x180f('0x45')][_0x180f('0x13')]({'plain':!![]});if(!_0x336804)throw new Error(_0x180f('0x46'));if(_0x336804[_0x180f('0x47')]==='user'){var _0x5b98a2=_0x46d8ec['get']({'plain':!![]});var _0x144c6b=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x180f('0x15'),'value':_0x180f('0x16')},{'name':_0x180f('0x17'),'value':_0x180f('0x18')}];var _0x113b17=_['find'](_0x144c6b,[_0x180f('0x48'),_0x5b98a2[_0x180f('0x1d')]])[_0x180f('0x24')];return db['UserProfileSection'][_0x180f('0x1e')]({'where':{'name':_0x113b17,'userProfileId':_0x336804[_0x180f('0x49')]},'raw':!![]})[_0x180f('0x12')](function(_0x3147fb){if(_0x3147fb&&_0x3147fb['autoAssociation']===0x0){return db[_0x180f('0x1f')][_0x180f('0x41')]({'name':_0x5b98a2['name'],'resourceId':_0x5b98a2['id'],'type':_0x3147fb['name'],'sectionId':_0x3147fb['id']},{})[_0x180f('0x12')](function(){return _0x46d8ec;});}else{return _0x46d8ec;}})[_0x180f('0x3c')](function(_0x56c955){logger[_0x180f('0x4a')](_0x180f('0x4b'),_0x56c955);throw _0x56c955;});}return _0x46d8ec;})['then'](respondWithResult(_0x4d85f4,0xc9))[_0x180f('0x3c')](handleError(_0x4d85f4,null));};exports[_0x180f('0x4c')]=function(_0x2a23da,_0x5794f0){if(_0x2a23da[_0x180f('0x42')]['id']){delete _0x2a23da[_0x180f('0x42')]['id'];}return db[_0x180f('0x37')][_0x180f('0x1e')]({'where':{'id':_0x2a23da[_0x180f('0x3e')]['id']}})[_0x180f('0x12')](handleEntityNotFound(_0x5794f0,null))['then'](function(_0x363fb5){if(_0x363fb5){return db[_0x180f('0x37')][_0x180f('0x4c')](_['pick'](_0x2a23da[_0x180f('0x42')],[_0x180f('0x44'),_0x180f('0x4d'),_0x180f('0x4e'),_0x180f('0x4f'),_0x180f('0x50'),_0x180f('0x51'),'alias']),{'where':{'context':_0x363fb5[_0x180f('0x4d')],'exten':_0x363fb5['exten']},'individualHooks':!![]})[_0x180f('0x12')](function(_0x4e6921){return _0x4e6921;});}return null;})['then'](respondWithStatusCode(_0x5794f0,null))[_0x180f('0x3c')](handleError(_0x5794f0,null));};exports['addApplications']=function(_0x5ed7d1,_0x56acf3){var _0x18ee9e=_0x5ed7d1[_0x180f('0x3e')]['id'];var _0x205c5c=_0x5ed7d1[_0x180f('0x42')];var _0x1c56c8=0xc8;var _0x19ee33=null;return db['sequelize'][_0x180f('0x52')]({'isolationLevel':db[_0x180f('0x53')][_0x180f('0x54')][_0x180f('0x55')]['READ_COMMITTED']},function(_0x5cf8c0){return db[_0x180f('0x37')]['findOne']({'where':{'id':_0x18ee9e},'transaction':_0x5cf8c0})[_0x180f('0x12')](function(_0x2f8ffd){if(_0x2f8ffd){return db['VoiceExtension'][_0x180f('0x20')]({'where':{'VoiceExtensionId':_0x18ee9e},'transaction':_0x5cf8c0})[_0x180f('0x12')](function(){var _0x18ae99=_[_0x180f('0x1b')](_0x205c5c,function(_0x3f6df7){_0x3f6df7[_0x180f('0x56')]=_0x18ee9e;_0x3f6df7['isApp']=!![];return _0x3f6df7;});return _0x2f8ffd[_0x180f('0x57')](_0x18ae99);})[_0x180f('0x12')](function(_0x3f7256){return db[_0x180f('0x37')][_0x180f('0x58')](_0x3f7256,{'transaction':_0x5cf8c0});});}else{_0x1c56c8=0x194;_0x19ee33=[];}});})[_0x180f('0x12')](function(){if(_0x1c56c8!==0x194){return db['VoiceExtension'][_0x180f('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x18ee9e},'order':_0x180f('0x5a')})[_0x180f('0x12')](function(_0x95ea03){_0x19ee33=_0x95ea03;});}})['catch'](function(_0x559d25){_0x1c56c8=0x1f4;logger[_0x180f('0x4a')](_0x559d25[_0x180f('0x23')]);if(_0x559d25[_0x180f('0x24')]){delete _0x559d25[_0x180f('0x24')];}_0x19ee33=_0x559d25;})[_0x180f('0x5b')](function(){if(_0x19ee33===null){_0x56acf3[_0x180f('0x22')](_0x1c56c8);}else{if(_0x1c56c8===0x1f4){_0x56acf3[_0x180f('0xa')](_0x1c56c8)[_0x180f('0x25')](_0x19ee33);}else{_0x56acf3[_0x180f('0xa')](_0x1c56c8)['json'](_0x19ee33);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4e58f4c..68eb191 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 _0xf632=['save','update','remove','emit','hasOwnProperty','events','VoiceExtension','setMaxListeners'];(function(_0x12a890,_0x4f3cb5){var _0x1a79ef=function(_0x5723f4){while(--_0x5723f4){_0x12a890['push'](_0x12a890['shift']());}};_0x1a79ef(++_0x4f3cb5);}(_0xf632,0x13d));var _0x2f63=function(_0x56809b,_0x461e51){_0x56809b=_0x56809b-0x0;var _0x5716f4=_0xf632[_0x56809b];return _0x5716f4;};'use strict';var EventEmitter=require(_0x2f63('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x2f63('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2f63('0x2')](0x0);var events={'afterCreate':_0x2f63('0x3'),'afterUpdate':_0x2f63('0x4'),'afterDestroy':_0x2f63('0x5')};function emitEvent(_0x41e99f){return function(_0x2d71a7,_0x5dc909,_0x4630f1){VoiceExtensionEvents[_0x2f63('0x6')](_0x41e99f+':'+_0x2d71a7['id'],_0x2d71a7);VoiceExtensionEvents[_0x2f63('0x6')](_0x41e99f,_0x2d71a7);_0x4630f1(null);};}for(var e in events){if(events[_0x2f63('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xea53=['hook','exports','events','save','remove','emit','hasOwnProperty'];(function(_0x22f40b,_0x247b5f){var _0x11408a=function(_0x2b91e5){while(--_0x2b91e5){_0x22f40b['push'](_0x22f40b['shift']());}};_0x11408a(++_0x247b5f);}(_0xea53,0xfe));var _0x3ea5=function(_0x567770,_0x3acca9){_0x567770=_0x567770-0x0;var _0x2c2ab0=_0xea53[_0x567770];return _0x2c2ab0;};'use strict';var EventEmitter=require(_0x3ea5('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ea5('0x1'),'afterUpdate':'update','afterDestroy':_0x3ea5('0x2')};function emitEvent(_0x239a0c){return function(_0x545f5b,_0x20741f,_0x7ecae6){VoiceExtensionEvents[_0x3ea5('0x3')](_0x239a0c+':'+_0x545f5b['id'],_0x545f5b);VoiceExtensionEvents['emit'](_0x239a0c,_0x545f5b);_0x7ecae6(null);};}for(var e in events){if(events[_0x3ea5('0x4')](e)){var event=events[e];VoiceExtension[_0x3ea5('0x5')](e,emitEvent(event));}}module[_0x3ea5('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index bd7cc40..b60b96d 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 _0x7ae8=['then','Hangup','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','answer','playback','includes','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','get'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7ae8,0x142));var _0x87ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ae8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var attributes=require(_0x87ae('0x0'));module['exports']=function(_0x419d3d){var _0x1a9ebe=_0x419d3d[_0x87ae('0x1')];function _0x51ba4f(_0x2bb442){var _0x184910=0x2;var _0x179b27=[{'type':_0x2bb442[_0x87ae('0x2')],'app':_0x87ae('0x3'),'appdata':_0x87ae('0x4')+_0x2bb442[_0x87ae('0x2')],'context':_0x2bb442[_0x87ae('0x5')],'exten':_0x2bb442[_0x87ae('0x6')],'priority':_0x184910++,'VoiceExtensionId':_0x2bb442['id']},{'type':_0x2bb442['type'],'app':_0x2bb442[_0x87ae('0x7')]?'Set':_0x87ae('0x8'),'appdata':_0x2bb442[_0x87ae('0x7')]?_0x87ae('0x9')+_0x2bb442[_0x87ae('0x7')]:_0x87ae('0xa'),'context':_0x2bb442['context'],'exten':_0x2bb442[_0x87ae('0x6')],'priority':_0x184910++,'VoiceExtensionId':_0x2bb442['id']}];if(_0x2bb442['type']===_0x87ae('0xb')){_0x179b27[_0x87ae('0xc')]({'type':'inbound','app':_0x87ae('0x3'),'appdata':'CDR(routeid)='+_0x2bb442['id'],'context':_0x2bb442[_0x87ae('0x5')],'exten':_0x2bb442[_0x87ae('0x6')],'priority':_0x184910++,'VoiceExtensionId':_0x2bb442['id']});}_0x179b27[_0x87ae('0xc')]({'type':_0x2bb442[_0x87ae('0x2')],'app':_0x87ae('0x3'),'appdata':_0x87ae('0xd'),'context':_0x2bb442['context'],'exten':_0x2bb442['exten'],'priority':_0x184910++,'VoiceExtensionId':_0x2bb442['id']},{'type':_0x2bb442[_0x87ae('0x2')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2bb442['context'],'exten':_0x2bb442[_0x87ae('0x6')],'priority':_0x184910++,'VoiceExtensionId':_0x2bb442['id']},{'type':_0x2bb442[_0x87ae('0x2')],'app':_0x87ae('0x3'),'appdata':_0x87ae('0xe'),'context':_0x2bb442['context'],'exten':_0x2bb442[_0x87ae('0x6')],'priority':_0x184910++,'VoiceExtensionId':_0x2bb442['id']});return _0x179b27;}function _0x3e7143(_0x563d19){var _0x4a425a=0x2;var _0x16cb5e=[{'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':_0x87ae('0x10'),'context':_0x563d19['context'],'exten':_0x563d19['exten'],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x563d19[_0x87ae('0x7')]?'Set':'NoOp','appdata':_0x563d19[_0x87ae('0x7')]?_0x87ae('0x9')+_0x563d19['alias']:_0x87ae('0xa'),'context':_0x563d19[_0x87ae('0x5')],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':_0x87ae('0x11')+(_0x563d19[_0x87ae('0x12')]?_0x87ae('0x13')+_0x563d19[_0x87ae('0x12')]+'}':_0x87ae('0x14')),'context':_0x563d19[_0x87ae('0x5')],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':_0x87ae('0x15')+_0x563d19['id'],'context':_0x563d19[_0x87ae('0x5')],'exten':_0x563d19['exten'],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x87ae('0x16'),'appdata':_0x87ae('0x17')+(_0x4a425a+0x2)+_0x87ae('0x18')+(_0x4a425a+0x1)+')','context':_0x563d19[_0x87ae('0x5')],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':_0x563d19['cutdigits']?_0x87ae('0x19')+_0x563d19[_0x87ae('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x563d19['context'],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':_0x87ae('0xd'),'context':_0x563d19[_0x87ae('0x5')],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x563d19[_0x87ae('0x5')],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':_0x87ae('0xe'),'context':_0x563d19['context'],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':'Set','appdata':_0x87ae('0x1a')+_0x563d19['id'],'context':_0x563d19[_0x87ae('0x5')],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']}];if(_0x563d19[_0x87ae('0x1b')](_0x87ae('0x1c'))&&_0x563d19[_0x87ae('0x1c')]!=='none'){_0x16cb5e[_0x87ae('0xc')]({'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':_0x87ae('0x1d'),'context':_0x563d19['context'],'exten':_0x563d19[_0x87ae('0x6')],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']},{'type':_0x87ae('0xf'),'app':_0x87ae('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x563d19[_0x87ae('0x1c')]||_0x87ae('0x1e'),'context':_0x563d19['context'],'exten':_0x563d19['exten'],'priority':_0x4a425a++,'VoiceExtensionId':_0x563d19['id']});}return _0x16cb5e;}function _0x58bac8(_0x31bcda,_0x18cdd1){var _0x420365=[{'name':_0x87ae('0x1f'),'param':0x0},{'name':_0x87ae('0x20'),'param':0x1},{'name':_0x87ae('0x21'),'param':0x2},{'name':_0x87ae('0x22'),'param':0x3}];var _0x45f18c={};var _0xccab80=_0x18cdd1[_0x87ae('0x23')](',');var _0x174a0b=[];for(var _0x4acf5a=0x0;_0x4acf5a<_0x420365[_0x87ae('0x24')];_0x4acf5a++){switch(_0x420365[_0x4acf5a][_0x87ae('0x25')]){case _0x87ae('0x1f'):_0x45f18c[_0x87ae('0x1f')]=_0xccab80[_0x420365[_0x4acf5a][_0x87ae('0x26')]]['split']('/')[0x1];_0x45f18c[_0x87ae('0x27')]=_0xccab80[_0x420365[_0x4acf5a][_0x87ae('0x26')]][_0x87ae('0x23')]('/')[0x2];_0x45f18c['prefix']=_0x45f18c[_0x87ae('0x27')]?_0x45f18c[_0x87ae('0x27')][_0x87ae('0x23')]('$')[0x0]:undefined;_0x45f18c['phone']=_0x31bcda['cutdigits']?(_0x45f18c[_0x87ae('0x28')]||'')+_0x87ae('0x13')+_0x31bcda['cutdigits']+'}':(_0x45f18c[_0x87ae('0x28')]||'')+'${EXTEN}';_0x174a0b[_0x420365[_0x4acf5a][_0x87ae('0x26')]]=[_0x87ae('0x29'),_0x45f18c[_0x87ae('0x1f')],_0x45f18c[_0x87ae('0x27')]][_0x87ae('0x2a')]('/');break;case _0x87ae('0x21'):_0x45f18c[_0x87ae('0x21')]=_0xccab80[_0x420365[_0x4acf5a][_0x87ae('0x26')]];if(_0x31bcda[_0x87ae('0x1c')]!==_0x87ae('0x2b')){if(_0x45f18c[_0x87ae('0x21')][_0x87ae('0x2c')](_0x87ae('0x2d'))<0x0){_0x45f18c[_0x87ae('0x21')]+=_0x87ae('0x2d');}}else{_0x45f18c[_0x87ae('0x21')]=_0x45f18c[_0x87ae('0x21')][_0x87ae('0x2e')](_0x87ae('0x2d'),'');}_0x174a0b[_0x420365[_0x4acf5a]['param']]=_0x45f18c[_0x87ae('0x21')];break;default:_0x174a0b[_0x420365[_0x4acf5a][_0x87ae('0x26')]]=_0xccab80[_0x420365[_0x4acf5a][_0x87ae('0x26')]];}}return _0x174a0b['join'](',');}function _0x32cbd4(_0x1f9371,_0x5775d1,_0x4b8323){return new Promise(function(_0x5b4ed0,_0x5578cd){var _0x27aeff=[];if(_[_0x87ae('0x2f')](_0x5775d1))return _0x5b4ed0(_0x27aeff);_0x1a9ebe[_0x87ae('0x30')][_0x87ae('0x31')]({'attributes':['id','interval',_0x87ae('0x32')],'raw':!![]})['then'](function(_0x35fb9e){for(var _0x25d991=0x0,_0x1a7b4e=0x0;_0x25d991<_0x5775d1[_0x87ae('0x24')];_0x25d991++,_0x1a7b4e=0x0){var _0x4ac82d=_0x5775d1[_0x25d991];var _0x44d870=[];var _0x12aa98=[];delete _0x4ac82d['id'];if(_0x4ac82d[_0x87ae('0x33')]!==_0x87ae('0x34')){_0x4ac82d[_0x87ae('0x35')]=[_0x4ac82d['interval']];}else{_0x4ac82d['intervals']=_0x4ac82d['IntervalId']?_['map'](_[_0x87ae('0x36')](_0x35fb9e,{'IntervalId':_0x4ac82d[_0x87ae('0x32')]}),'interval'):[];}_0x4ac82d[_0x87ae('0x5')]=_0x1f9371[_0x87ae('0x5')];_0x4ac82d['exten']=_0x1f9371['exten'];if(_0x4ac82d[_0x87ae('0x2')])_0x4ac82d[_0x87ae('0x2')]=_0x4ac82d[_0x87ae('0x2')][_0x87ae('0x37')]();if(_0x1f9371[_0x87ae('0x2')]===_0x87ae('0xf')){if(_0x4ac82d['hasOwnProperty']('tag')&&_0x4ac82d[_0x87ae('0x38')]&&_0x4ac82d['tag']!=='--'){_0x44d870[_0x87ae('0xc')]({'type':_0x4ac82d[_0x87ae('0x2')]['toLowerCase'](),'app':_0x87ae('0x3'),'appdata':_0x87ae('0x39')+_0x4ac82d[_0x87ae('0x38')],'context':_0x1f9371[_0x87ae('0x5')],'exten':_0x1f9371[_0x87ae('0x6')],'priority':_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')]+_0x4b8323+_0x1a7b4e++,'VoiceExtensionId':_0x1f9371['id']});}_0x44d870[_0x87ae('0xc')]({'type':_0x4ac82d[_0x87ae('0x2')][_0x87ae('0x37')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4ac82d[_0x87ae('0x3a')]?_0x87ae('0x3b')+_0x4ac82d[_0x87ae('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x1f9371[_0x87ae('0x5')],'exten':_0x1f9371[_0x87ae('0x6')],'priority':_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')]+_0x4b8323+_0x1a7b4e++,'VoiceExtensionId':_0x1f9371['id']});}else{if(_0x4ac82d[_0x87ae('0x1b')](_0x87ae('0x3c'))){if(['queue',_0x87ae('0x3d')][_0x87ae('0x3e')](_0x4ac82d['app'][_0x87ae('0x37')]())&&_0x4ac82d[_0x87ae('0x3f')]!=='custom'){if(_0x4ac82d['answer']){_0x44d870[_0x87ae('0xc')]({'type':_0x4ac82d[_0x87ae('0x2')]['toLowerCase'](),'app':_0x87ae('0x16'),'appdata':_0x87ae('0x40'),'context':_0x1f9371[_0x87ae('0x5')],'exten':_0x1f9371['exten'],'priority':_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')]+_0x4b8323+_0x1a7b4e++,'VoiceExtensionId':_0x1f9371['id']});_0x44d870['push']({'type':_0x4ac82d[_0x87ae('0x2')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1f9371[_0x87ae('0x5')],'exten':_0x1f9371[_0x87ae('0x6')],'priority':_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')]+_0x4b8323+_0x1a7b4e++,'VoiceExtensionId':_0x1f9371['id']});}else{_0x44d870[_0x87ae('0xc')]({'type':_0x4ac82d[_0x87ae('0x2')][_0x87ae('0x37')](),'app':_0x87ae('0x16'),'appdata':_0x87ae('0x41'),'context':_0x1f9371[_0x87ae('0x5')],'exten':_0x1f9371['exten'],'priority':_0x4ac82d['intervals']['length']+_0x4b8323+_0x1a7b4e++,'VoiceExtensionId':_0x1f9371['id']});_0x44d870[_0x87ae('0xc')]({'type':_0x4ac82d[_0x87ae('0x2')][_0x87ae('0x37')](),'app':_0x87ae('0x3'),'appdata':_0x87ae('0x42'),'context':_0x1f9371[_0x87ae('0x5')],'exten':_0x1f9371[_0x87ae('0x6')],'priority':_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')]+_0x4b8323+_0x1a7b4e++,'VoiceExtensionId':_0x1f9371['id']});}}}}for(var _0x2784e0=0x0;_0x2784e0<_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')];_0x2784e0++){var _0x1a9d01=_0x4b8323+_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')];var _0x32e845=_0x2784e0===_0x4ac82d[_0x87ae('0x35')][_0x87ae('0x24')]-0x1?_0x4b8323+_0x44d870[_0x87ae('0x24')]+_0x12aa98[_0x87ae('0x24')]+0x2:_0x4b8323+_0x2784e0+0x1;_0x44d870[_0x87ae('0x43')](_0x2784e0,0x0,{'type':_0x1f9371[_0x87ae('0x2')],'app':_0x87ae('0x44'),'appdata':_0x4ac82d[_0x87ae('0x35')][_0x2784e0]+'?'+_0x1f9371[_0x87ae('0x5')]+',${EXTEN},'+_0x1a9d01+':'+_0x1f9371['context']+_0x87ae('0x45')+_0x32e845,'exten':_0x1f9371[_0x87ae('0x6')],'context':_0x1f9371[_0x87ae('0x5')],'priority':_0x4b8323+_0x2784e0,'VoiceExtensionId':_0x1f9371['id']});}if(_0x4ac82d[_0x87ae('0x3f')]===_0x87ae('0x46'))_0x4ac82d[_0x87ae('0x47')]=_0x58bac8(_0x1f9371,_0x4ac82d[_0x87ae('0x47')]);_0x4ac82d[_0x87ae('0x48')]=_0x44d870[_0x87ae('0x24')]?_[_0x87ae('0x49')](_0x44d870)['priority']+0x1:_0x4b8323;_0x27aeff=_[_0x87ae('0x4a')](_0x27aeff,_0x44d870,[_0x4ac82d],_0x12aa98);_0x4b8323=_[_0x87ae('0x49')](_0x27aeff)['priority']+0x1;}return _0x5b4ed0(_0x27aeff);})[_0x87ae('0x4b')](function(_0x3fc311){_0x5578cd(_0x3fc311);});});}return _0x419d3d[_0x87ae('0x4c')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x59fde7){var _0x991909=this[_0x87ae('0x4d')]({'plain':!![]});var _0x49a806=_0x991909[_0x87ae('0x2')]===_0x87ae('0xf')?_0x3e7143(_0x991909):_0x51ba4f(_0x991909);return _0x32cbd4(_0x991909,_0x59fde7,_['last'](_0x49a806)[_0x87ae('0x48')]+0x1)[_0x87ae('0x4e')](function(_0x4752a2){var _0x4e41b7=_[_0x87ae('0x4a')](_0x49a806,_0x4752a2);_0x4e41b7['push']({'type':_0x991909[_0x87ae('0x2')],'app':_0x87ae('0x4f'),'exten':_0x991909[_0x87ae('0x6')],'context':_0x991909[_0x87ae('0x5')],'priority':_['last'](_0x4e41b7)[_0x87ae('0x48')]+0x1,'VoiceExtensionId':_0x991909['id']});return _0x4e41b7;});}}});}; \ No newline at end of file +var _0x5aaa=['IntervalId','then','*,*,*,*','intervals','map','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','priority','last','catch','define','VoiceExtension','concat','lodash','type','Set','context','exten','NoOp','alias','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','timeout','options','split','length','param','phone','prefix','trunk','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5aaa,0xff));var _0xa5aa=function(_0x461d21,_0x2465ba){_0x461d21=_0x461d21-0x0;var _0x1b0935=_0x5aaa[_0x461d21];return _0x1b0935;};'use strict';var _=require(_0xa5aa('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4d2ac2){var _0x59ccda=_0x4d2ac2['models'];function _0x128d2a(_0x21f5d9){var _0x473061=0x2;var _0x54ca19=[{'type':_0x21f5d9[_0xa5aa('0x1')],'app':_0xa5aa('0x2'),'appdata':'CDR(type)='+_0x21f5d9[_0xa5aa('0x1')],'context':_0x21f5d9[_0xa5aa('0x3')],'exten':_0x21f5d9[_0xa5aa('0x4')],'priority':_0x473061++,'VoiceExtensionId':_0x21f5d9['id']},{'type':_0x21f5d9[_0xa5aa('0x1')],'app':_0x21f5d9['alias']?'Set':_0xa5aa('0x5'),'appdata':_0x21f5d9[_0xa5aa('0x6')]?_0xa5aa('0x7')+_0x21f5d9['alias']:'No\x20alias\x20set','context':_0x21f5d9['context'],'exten':_0x21f5d9[_0xa5aa('0x4')],'priority':_0x473061++,'VoiceExtensionId':_0x21f5d9['id']}];if(_0x21f5d9['type']===_0xa5aa('0x8')){_0x54ca19[_0xa5aa('0x9')]({'type':_0xa5aa('0x8'),'app':_0xa5aa('0x2'),'appdata':_0xa5aa('0xa')+_0x21f5d9['id'],'context':_0x21f5d9['context'],'exten':_0x21f5d9[_0xa5aa('0x4')],'priority':_0x473061++,'VoiceExtensionId':_0x21f5d9['id']});}_0x54ca19[_0xa5aa('0x9')]({'type':_0x21f5d9[_0xa5aa('0x1')],'app':_0xa5aa('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x21f5d9[_0xa5aa('0x3')],'exten':_0x21f5d9[_0xa5aa('0x4')],'priority':_0x473061++,'VoiceExtensionId':_0x21f5d9['id']},{'type':_0x21f5d9[_0xa5aa('0x1')],'app':'Set','appdata':_0xa5aa('0xb'),'context':_0x21f5d9[_0xa5aa('0x3')],'exten':_0x21f5d9[_0xa5aa('0x4')],'priority':_0x473061++,'VoiceExtensionId':_0x21f5d9['id']},{'type':_0x21f5d9[_0xa5aa('0x1')],'app':_0xa5aa('0x2'),'appdata':_0xa5aa('0xc'),'context':_0x21f5d9[_0xa5aa('0x3')],'exten':_0x21f5d9['exten'],'priority':_0x473061++,'VoiceExtensionId':_0x21f5d9['id']});return _0x54ca19;}function _0x219532(_0x5b1559){var _0x5bb59d=0x2;var _0x248ee8=[{'type':_0xa5aa('0xd'),'app':_0xa5aa('0x2'),'appdata':_0xa5aa('0xe'),'context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559[_0xa5aa('0x4')],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':_0xa5aa('0xd'),'app':_0x5b1559[_0xa5aa('0x6')]?'Set':_0xa5aa('0x5'),'appdata':_0x5b1559[_0xa5aa('0x6')]?'CDR(routeAlias)='+_0x5b1559[_0xa5aa('0x6')]:_0xa5aa('0xf'),'context':_0x5b1559['context'],'exten':_0x5b1559[_0xa5aa('0x4')],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':_0xa5aa('0xd'),'app':_0xa5aa('0x2'),'appdata':_0xa5aa('0x10')+(_0x5b1559[_0xa5aa('0x11')]?_0xa5aa('0x12')+_0x5b1559[_0xa5aa('0x11')]+'}':_0xa5aa('0x13')),'context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559[_0xa5aa('0x4')],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':'outbound','app':_0xa5aa('0x2'),'appdata':_0xa5aa('0xa')+_0x5b1559['id'],'context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559[_0xa5aa('0x4')],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':_0xa5aa('0xd'),'app':_0xa5aa('0x14'),'appdata':_0xa5aa('0x15')+(_0x5bb59d+0x2)+_0xa5aa('0x16')+(_0x5bb59d+0x1)+')','context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559[_0xa5aa('0x4')],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':_0xa5aa('0xd'),'app':_0xa5aa('0x2'),'appdata':_0x5b1559[_0xa5aa('0x11')]?_0xa5aa('0x17')+_0x5b1559[_0xa5aa('0x11')]+'}':_0xa5aa('0x18'),'context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559['exten'],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559['exten'],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':'outbound','app':'Set','appdata':_0xa5aa('0xb'),'context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559[_0xa5aa('0x4')],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':_0xa5aa('0xd'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559['exten'],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':_0xa5aa('0xd'),'app':_0xa5aa('0x2'),'appdata':'outboundrouteid='+_0x5b1559['id'],'context':_0x5b1559['context'],'exten':_0x5b1559[_0xa5aa('0x4')],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']}];if(_0x5b1559['hasOwnProperty'](_0xa5aa('0x19'))&&_0x5b1559[_0xa5aa('0x19')]!==_0xa5aa('0x1a')){_0x248ee8[_0xa5aa('0x9')]({'type':_0xa5aa('0xd'),'app':_0xa5aa('0x2'),'appdata':_0xa5aa('0x1b'),'context':_0x5b1559['context'],'exten':_0x5b1559['exten'],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']},{'type':_0xa5aa('0xd'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5b1559[_0xa5aa('0x19')]||_0xa5aa('0x1c'),'context':_0x5b1559[_0xa5aa('0x3')],'exten':_0x5b1559['exten'],'priority':_0x5bb59d++,'VoiceExtensionId':_0x5b1559['id']});}return _0x248ee8;}function _0x2840d2(_0x53b8dd,_0x22d110){var _0x37944c=[{'name':'trunk','param':0x0},{'name':_0xa5aa('0x1d'),'param':0x1},{'name':_0xa5aa('0x1e'),'param':0x2},{'name':'url','param':0x3}];var _0x2592af={};var _0x435a93=_0x22d110[_0xa5aa('0x1f')](',');var _0x1cc374=[];for(var _0x4d09ab=0x0;_0x4d09ab<_0x37944c[_0xa5aa('0x20')];_0x4d09ab++){switch(_0x37944c[_0x4d09ab]['name']){case'trunk':_0x2592af['trunk']=_0x435a93[_0x37944c[_0x4d09ab][_0xa5aa('0x21')]][_0xa5aa('0x1f')]('/')[0x1];_0x2592af[_0xa5aa('0x22')]=_0x435a93[_0x37944c[_0x4d09ab][_0xa5aa('0x21')]][_0xa5aa('0x1f')]('/')[0x2];_0x2592af[_0xa5aa('0x23')]=_0x2592af[_0xa5aa('0x22')]?_0x2592af[_0xa5aa('0x22')][_0xa5aa('0x1f')]('$')[0x0]:undefined;_0x2592af['phone']=_0x53b8dd['cutdigits']?(_0x2592af[_0xa5aa('0x23')]||'')+_0xa5aa('0x12')+_0x53b8dd[_0xa5aa('0x11')]+'}':(_0x2592af[_0xa5aa('0x23')]||'')+_0xa5aa('0x13');_0x1cc374[_0x37944c[_0x4d09ab][_0xa5aa('0x21')]]=['SIP',_0x2592af[_0xa5aa('0x24')],_0x2592af[_0xa5aa('0x22')]][_0xa5aa('0x25')]('/');break;case'options':_0x2592af[_0xa5aa('0x1e')]=_0x435a93[_0x37944c[_0x4d09ab]['param']];if(_0x53b8dd[_0xa5aa('0x19')]!=='none'){if(_0x2592af[_0xa5aa('0x1e')][_0xa5aa('0x26')](_0xa5aa('0x27'))<0x0){_0x2592af[_0xa5aa('0x1e')]+=_0xa5aa('0x27');}}else{_0x2592af[_0xa5aa('0x1e')]=_0x2592af[_0xa5aa('0x1e')][_0xa5aa('0x28')](_0xa5aa('0x27'),'');}_0x1cc374[_0x37944c[_0x4d09ab][_0xa5aa('0x21')]]=_0x2592af['options'];break;default:_0x1cc374[_0x37944c[_0x4d09ab][_0xa5aa('0x21')]]=_0x435a93[_0x37944c[_0x4d09ab]['param']];}}return _0x1cc374[_0xa5aa('0x25')](',');}function _0x225dab(_0x271db8,_0x129efc,_0x1f6421){return new Promise(function(_0x23b86f,_0x14ac91){var _0x3dfa0c=[];if(_[_0xa5aa('0x29')](_0x129efc))return _0x23b86f(_0x3dfa0c);_0x59ccda[_0xa5aa('0x2a')][_0xa5aa('0x2b')]({'attributes':['id',_0xa5aa('0x2c'),_0xa5aa('0x2d')],'raw':!![]})[_0xa5aa('0x2e')](function(_0x127824){for(var _0x15bf7e=0x0,_0x5a28fb=0x0;_0x15bf7e<_0x129efc[_0xa5aa('0x20')];_0x15bf7e++,_0x5a28fb=0x0){var _0x59e629=_0x129efc[_0x15bf7e];var _0x52c68d=[];var _0x2bb967=[];delete _0x59e629['id'];if(_0x59e629[_0xa5aa('0x2c')]!==_0xa5aa('0x2f')){_0x59e629[_0xa5aa('0x30')]=[_0x59e629[_0xa5aa('0x2c')]];}else{_0x59e629[_0xa5aa('0x30')]=_0x59e629['IntervalId']?_[_0xa5aa('0x31')](_['filter'](_0x127824,{'IntervalId':_0x59e629[_0xa5aa('0x2d')]}),_0xa5aa('0x2c')):[];}_0x59e629[_0xa5aa('0x3')]=_0x271db8['context'];_0x59e629[_0xa5aa('0x4')]=_0x271db8[_0xa5aa('0x4')];if(_0x59e629[_0xa5aa('0x1')])_0x59e629[_0xa5aa('0x1')]=_0x59e629[_0xa5aa('0x1')][_0xa5aa('0x32')]();if(_0x271db8[_0xa5aa('0x1')]===_0xa5aa('0xd')){if(_0x59e629[_0xa5aa('0x33')](_0xa5aa('0x34'))&&_0x59e629[_0xa5aa('0x34')]&&_0x59e629[_0xa5aa('0x34')]!=='--'){_0x52c68d[_0xa5aa('0x9')]({'type':_0x59e629[_0xa5aa('0x1')][_0xa5aa('0x32')](),'app':'Set','appdata':'CDR(tag)='+_0x59e629[_0xa5aa('0x34')],'context':_0x271db8[_0xa5aa('0x3')],'exten':_0x271db8[_0xa5aa('0x4')],'priority':_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')]+_0x1f6421+_0x5a28fb++,'VoiceExtensionId':_0x271db8['id']});}_0x52c68d[_0xa5aa('0x9')]({'type':_0x59e629[_0xa5aa('0x1')][_0xa5aa('0x32')](),'app':_0xa5aa('0x14'),'appdata':_0xa5aa('0x35')+(_0x59e629[_0xa5aa('0x36')]?'Set(CALLERID(all)='+_0x59e629[_0xa5aa('0x36')]+')':_0xa5aa('0x37')),'context':_0x271db8['context'],'exten':_0x271db8['exten'],'priority':_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')]+_0x1f6421+_0x5a28fb++,'VoiceExtensionId':_0x271db8['id']});}else{if(_0x59e629[_0xa5aa('0x33')]('answer')){if([_0xa5aa('0x38'),_0xa5aa('0x39')][_0xa5aa('0x3a')](_0x59e629[_0xa5aa('0x3b')][_0xa5aa('0x32')]())&&_0x59e629[_0xa5aa('0x3c')]!==_0xa5aa('0x3d')){if(_0x59e629[_0xa5aa('0x3e')]){_0x52c68d[_0xa5aa('0x9')]({'type':_0x59e629['type'][_0xa5aa('0x32')](),'app':_0xa5aa('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x271db8[_0xa5aa('0x3')],'exten':_0x271db8[_0xa5aa('0x4')],'priority':_0x59e629['intervals']['length']+_0x1f6421+_0x5a28fb++,'VoiceExtensionId':_0x271db8['id']});_0x52c68d[_0xa5aa('0x9')]({'type':_0x59e629['type'][_0xa5aa('0x32')](),'app':_0xa5aa('0x2'),'appdata':_0xa5aa('0x3f'),'context':_0x271db8['context'],'exten':_0x271db8[_0xa5aa('0x4')],'priority':_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')]+_0x1f6421+_0x5a28fb++,'VoiceExtensionId':_0x271db8['id']});}else{_0x52c68d[_0xa5aa('0x9')]({'type':_0x59e629[_0xa5aa('0x1')][_0xa5aa('0x32')](),'app':_0xa5aa('0x14'),'appdata':_0xa5aa('0x40'),'context':_0x271db8[_0xa5aa('0x3')],'exten':_0x271db8[_0xa5aa('0x4')],'priority':_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')]+_0x1f6421+_0x5a28fb++,'VoiceExtensionId':_0x271db8['id']});_0x52c68d[_0xa5aa('0x9')]({'type':_0x59e629[_0xa5aa('0x1')][_0xa5aa('0x32')](),'app':'Set','appdata':_0xa5aa('0x41'),'context':_0x271db8[_0xa5aa('0x3')],'exten':_0x271db8[_0xa5aa('0x4')],'priority':_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')]+_0x1f6421+_0x5a28fb++,'VoiceExtensionId':_0x271db8['id']});}}}}for(var _0x46a968=0x0;_0x46a968<_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')];_0x46a968++){var _0x304f84=_0x1f6421+_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')];var _0x21f2e5=_0x46a968===_0x59e629[_0xa5aa('0x30')][_0xa5aa('0x20')]-0x1?_0x1f6421+_0x52c68d[_0xa5aa('0x20')]+_0x2bb967[_0xa5aa('0x20')]+0x2:_0x1f6421+_0x46a968+0x1;_0x52c68d['splice'](_0x46a968,0x0,{'type':_0x271db8[_0xa5aa('0x1')],'app':_0xa5aa('0x42'),'appdata':_0x59e629['intervals'][_0x46a968]+'?'+_0x271db8['context']+_0xa5aa('0x43')+_0x304f84+':'+_0x271db8[_0xa5aa('0x3')]+',${EXTEN},'+_0x21f2e5,'exten':_0x271db8['exten'],'context':_0x271db8['context'],'priority':_0x1f6421+_0x46a968,'VoiceExtensionId':_0x271db8['id']});}if(_0x59e629[_0xa5aa('0x3c')]==='outboundDial')_0x59e629[_0xa5aa('0x44')]=_0x2840d2(_0x271db8,_0x59e629[_0xa5aa('0x44')]);_0x59e629[_0xa5aa('0x45')]=_0x52c68d[_0xa5aa('0x20')]?_[_0xa5aa('0x46')](_0x52c68d)[_0xa5aa('0x45')]+0x1:_0x1f6421;_0x3dfa0c=_['concat'](_0x3dfa0c,_0x52c68d,[_0x59e629],_0x2bb967);_0x1f6421=_['last'](_0x3dfa0c)[_0xa5aa('0x45')]+0x1;}return _0x23b86f(_0x3dfa0c);})[_0xa5aa('0x47')](function(_0x3f2119){_0x14ac91(_0x3f2119);});});}return _0x4d2ac2[_0xa5aa('0x48')](_0xa5aa('0x49'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x223bd8){var _0x6ca185=this['get']({'plain':!![]});var _0x593f5e=_0x6ca185[_0xa5aa('0x1')]===_0xa5aa('0xd')?_0x219532(_0x6ca185):_0x128d2a(_0x6ca185);return _0x225dab(_0x6ca185,_0x223bd8,_['last'](_0x593f5e)[_0xa5aa('0x45')]+0x1)['then'](function(_0x473b7c){var _0x30151d=_[_0xa5aa('0x4a')](_0x593f5e,_0x473b7c);_0x30151d['push']({'type':_0x6ca185[_0xa5aa('0x1')],'app':'Hangup','exten':_0x6ca185[_0xa5aa('0x4')],'context':_0x6ca185[_0xa5aa('0x3')],'priority':_[_0xa5aa('0x46')](_0x30151d)[_0xa5aa('0x45')]+0x1,'VoiceExtensionId':_0x6ca185['id']});return _0x30151d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index b834eef..77f6282 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 _0xe5e3=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','attributes','include','map','model','then','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent'];(function(_0x82e85c,_0x4eb917){var _0x123531=function(_0x1864b9){while(--_0x1864b9){_0x82e85c['push'](_0x82e85c['shift']());}};_0x123531(++_0x4eb917);}(_0xe5e3,0x17a));var _0x3e5e=function(_0x340c85,_0x4e73e7){_0x340c85=_0x340c85-0x0;var _0x5528ac=_0xe5e3[_0x340c85];return _0x5528ac;};'use strict';var _=require('lodash');var util=require(_0x3e5e('0x0'));var moment=require(_0x3e5e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e5e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e5e('0x3'));var logger=require(_0x3e5e('0x4'))('rpc');var config=require(_0x3e5e('0x5'));var jayson=require(_0x3e5e('0x6'));var client=jayson['client'][_0x3e5e('0x7')]({'port':0x232a});config['redis']=_[_0x3e5e('0x8')](config['redis'],{'host':_0x3e5e('0x9'),'port':0x18eb});var socket=require(_0x3e5e('0xa'))(new Redis(config[_0x3e5e('0xb')]));require(_0x3e5e('0xc'))[_0x3e5e('0xd')](socket);function respondWithRpcPromise(_0x2921fc,_0x16f64b,_0x270567){return new BPromise(function(_0x19b93c,_0x135011){return client[_0x3e5e('0xe')](_0x2921fc,_0x270567)['then'](function(_0x83263a){logger[_0x3e5e('0xf')](_0x3e5e('0x10'),_0x16f64b,_0x3e5e('0x11'));logger[_0x3e5e('0x12')](_0x3e5e('0x13'),_0x16f64b,_0x3e5e('0x11'),JSON[_0x3e5e('0x14')](_0x83263a));if(_0x83263a[_0x3e5e('0x15')]){if(_0x83263a[_0x3e5e('0x15')][_0x3e5e('0x16')]===0x1f4){logger[_0x3e5e('0x15')](_0x3e5e('0x10'),_0x16f64b,_0x83263a[_0x3e5e('0x15')]['message']);return _0x135011(_0x83263a[_0x3e5e('0x15')][_0x3e5e('0x17')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x16f64b,_0x83263a[_0x3e5e('0x15')][_0x3e5e('0x17')]);return _0x19b93c(_0x83263a[_0x3e5e('0x15')][_0x3e5e('0x17')]);}else{logger[_0x3e5e('0xf')](_0x3e5e('0x10'),_0x16f64b,_0x3e5e('0x11'));_0x19b93c(_0x83263a['result'][_0x3e5e('0x17')]);}})[_0x3e5e('0x18')](function(_0x295e8c){logger[_0x3e5e('0x15')](_0x3e5e('0x10'),_0x16f64b,_0x295e8c);_0x135011(_0x295e8c);});});}exports[_0x3e5e('0x19')]=function(_0x3d2d90){var _0x59b25a=this;return new Promise(function(_0x5be0ef,_0x4ea253){return db[_0x3e5e('0x1a')][_0x3e5e('0x1b')]({'raw':_0x3d2d90['options']?_0x3d2d90['options'][_0x3e5e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d2d90[_0x3e5e('0x1d')]?_0x3d2d90[_0x3e5e('0x1d')][_0x3e5e('0x1e')]||null:null,'attributes':_0x3d2d90[_0x3e5e('0x1d')]?_0x3d2d90[_0x3e5e('0x1d')][_0x3e5e('0x1f')]||null:null,'limit':_0x3d2d90[_0x3e5e('0x1d')]?_0x3d2d90[_0x3e5e('0x1d')]['limit']||null:null,'include':_0x3d2d90[_0x3e5e('0x1d')]?_0x3d2d90[_0x3e5e('0x1d')][_0x3e5e('0x20')]?_[_0x3e5e('0x21')](_0x3d2d90['options'][_0x3e5e('0x20')],function(_0x441871){return{'model':db[_0x441871[_0x3e5e('0x22')]],'as':_0x441871['as'],'attributes':_0x441871[_0x3e5e('0x1f')],'include':_0x441871[_0x3e5e('0x20')]?_[_0x3e5e('0x21')](_0x441871[_0x3e5e('0x20')],function(_0x2d4c60){return{'model':db[_0x2d4c60['model']],'as':_0x2d4c60['as'],'attributes':_0x2d4c60['attributes'],'include':_0x2d4c60[_0x3e5e('0x20')]?_[_0x3e5e('0x21')](_0x2d4c60[_0x3e5e('0x20')],function(_0x48cf5f){return{'model':db[_0x48cf5f[_0x3e5e('0x22')]],'as':_0x48cf5f['as'],'attributes':_0x48cf5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e5e('0x23')](function(_0x215dae){logger[_0x3e5e('0xf')](_0x3e5e('0x19'),_0x3d2d90);logger[_0x3e5e('0x12')](_0x3e5e('0x19'),_0x3d2d90,JSON[_0x3e5e('0x14')](_0x215dae));_0x5be0ef(_0x215dae);})[_0x3e5e('0x18')](function(_0x7a1216){logger[_0x3e5e('0x15')](_0x3e5e('0x19'),_0x7a1216[_0x3e5e('0x17')],_0x3d2d90);_0x4ea253(_0x59b25a['error'](0x1f4,_0x7a1216[_0x3e5e('0x17')]));});});}; \ No newline at end of file +var _0xaa48=['options','raw','where','limit','include','map','model','attributes','GetVoiceExtension','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa48,0x15a));var _0x8aa4=function(_0x595b35,_0x584a4e){_0x595b35=_0x595b35-0x0;var _0x15ccdc=_0xaa48[_0x595b35];return _0x15ccdc;};'use strict';var _=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var moment=require(_0x8aa4('0x2'));var BPromise=require(_0x8aa4('0x3'));var rs=require(_0x8aa4('0x4'));var fs=require('fs');var Redis=require(_0x8aa4('0x5'));var db=require(_0x8aa4('0x6'))['db'];var utils=require(_0x8aa4('0x7'));var logger=require(_0x8aa4('0x8'))(_0x8aa4('0x9'));var config=require(_0x8aa4('0xa'));var jayson=require(_0x8aa4('0xb'));var client=jayson[_0x8aa4('0xc')][_0x8aa4('0xd')]({'port':0x232a});config[_0x8aa4('0xe')]=_[_0x8aa4('0xf')](config[_0x8aa4('0xe')],{'host':_0x8aa4('0x10'),'port':0x18eb});var socket=require(_0x8aa4('0x11'))(new Redis(config['redis']));require(_0x8aa4('0x12'))[_0x8aa4('0x13')](socket);function respondWithRpcPromise(_0x55c899,_0x177fe5,_0xab07f2){return new BPromise(function(_0x557ffa,_0xc21580){return client[_0x8aa4('0x14')](_0x55c899,_0xab07f2)[_0x8aa4('0x15')](function(_0x38ecc6){logger[_0x8aa4('0x16')](_0x8aa4('0x17'),_0x177fe5,_0x8aa4('0x18'));logger[_0x8aa4('0x19')](_0x8aa4('0x1a'),_0x177fe5,_0x8aa4('0x18'),JSON['stringify'](_0x38ecc6));if(_0x38ecc6['error']){if(_0x38ecc6[_0x8aa4('0x1b')][_0x8aa4('0x1c')]===0x1f4){logger[_0x8aa4('0x1b')](_0x8aa4('0x17'),_0x177fe5,_0x38ecc6[_0x8aa4('0x1b')][_0x8aa4('0x1d')]);return _0xc21580(_0x38ecc6[_0x8aa4('0x1b')][_0x8aa4('0x1d')]);}logger[_0x8aa4('0x1b')](_0x8aa4('0x17'),_0x177fe5,_0x38ecc6['error']['message']);return _0x557ffa(_0x38ecc6['error'][_0x8aa4('0x1d')]);}else{logger[_0x8aa4('0x16')](_0x8aa4('0x17'),_0x177fe5,_0x8aa4('0x18'));_0x557ffa(_0x38ecc6['result'][_0x8aa4('0x1d')]);}})[_0x8aa4('0x1e')](function(_0x59d3a2){logger[_0x8aa4('0x1b')]('VoiceExtension,\x20%s,\x20%s',_0x177fe5,_0x59d3a2);_0xc21580(_0x59d3a2);});});}exports['GetVoiceExtension']=function(_0x174158){var _0x5971e7=this;return new Promise(function(_0x324d59,_0x2df294){return db['VoiceExtension'][_0x8aa4('0x1f')]({'raw':_0x174158[_0x8aa4('0x20')]?_0x174158['options'][_0x8aa4('0x21')]===undefined?!![]:![]:!![],'where':_0x174158[_0x8aa4('0x20')]?_0x174158[_0x8aa4('0x20')][_0x8aa4('0x22')]||null:null,'attributes':_0x174158[_0x8aa4('0x20')]?_0x174158['options']['attributes']||null:null,'limit':_0x174158['options']?_0x174158['options'][_0x8aa4('0x23')]||null:null,'include':_0x174158['options']?_0x174158[_0x8aa4('0x20')][_0x8aa4('0x24')]?_[_0x8aa4('0x25')](_0x174158[_0x8aa4('0x20')]['include'],function(_0x513cb9){return{'model':db[_0x513cb9[_0x8aa4('0x26')]],'as':_0x513cb9['as'],'attributes':_0x513cb9['attributes'],'include':_0x513cb9[_0x8aa4('0x24')]?_[_0x8aa4('0x25')](_0x513cb9['include'],function(_0x14b38d){return{'model':db[_0x14b38d['model']],'as':_0x14b38d['as'],'attributes':_0x14b38d[_0x8aa4('0x27')],'include':_0x14b38d['include']?_[_0x8aa4('0x25')](_0x14b38d[_0x8aa4('0x24')],function(_0x41b1e0){return{'model':db[_0x41b1e0[_0x8aa4('0x26')]],'as':_0x41b1e0['as'],'attributes':_0x41b1e0[_0x8aa4('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d4894){logger['info'](_0x8aa4('0x28'),_0x174158);logger[_0x8aa4('0x19')]('GetVoiceExtension',_0x174158,JSON[_0x8aa4('0x29')](_0x5d4894));_0x324d59(_0x5d4894);})[_0x8aa4('0x1e')](function(_0x3e4595){logger[_0x8aa4('0x1b')](_0x8aa4('0x28'),_0x3e4595[_0x8aa4('0x1d')],_0x174158);_0x2df294(_0x5971e7['error'](0x1f4,_0x3e4595[_0x8aa4('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 63595a9..50b5927 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x3a0a61,_0x5d1ae9){var _0x351767=function(_0x592b5d){while(--_0x592b5d){_0x3a0a61['push'](_0x3a0a61['shift']());}};_0x351767(++_0x5d1ae9);}(_0xe14b,0x93));var _0xbe14=function(_0x19642e,_0x4a1209){_0x19642e=_0x19642e-0x0;var _0x288bcd=_0xe14b[_0x19642e];return _0x288bcd;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x56f9a2,_0x10adec){var _0x1b0a2d=function(_0x38140d){while(--_0x38140d){_0x56f9a2['push'](_0x56f9a2['shift']());}};_0x1b0a2d(++_0x10adec);}(_0x326f,0xd1));var _0xf326=function(_0x2f1e8d,_0x32c778){_0x2f1e8d=_0x2f1e8d-0x0;var _0x2930c8=_0x326f[_0x2f1e8d];return _0x2930c8;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 902f979..a917785 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb145=['show','/:id/messages','getMessages','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x43d35c,_0x32dc87){var _0x3565d2=function(_0x50ef11){while(--_0x50ef11){_0x43d35c['push'](_0x43d35c['shift']());}};_0x3565d2(++_0x32dc87);}(_0xb145,0xa3));var _0x5b14=function(_0x149eba,_0x19d4c5){_0x149eba=_0x149eba-0x0;var _0x9ee0ad=_0xb145[_0x149eba];return _0x9ee0ad;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/',auth['isAuthenticated'](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x13')]);router['delete'](_0x5b14('0xc'),auth['isAuthenticated'](),controller[_0x5b14('0x14')]);module[_0x5b14('0x15')]=router; \ No newline at end of file +var _0xf2e3=['/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get'];(function(_0x37f5af,_0x51c4a7){var _0x1bef46=function(_0xee6c62){while(--_0xee6c62){_0x37f5af['push'](_0x37f5af['shift']());}};_0x1bef46(++_0x51c4a7);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xf2e3[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')]('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0x15')](_0x3f2e('0xd'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a324d18..8a839af 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 _0xf169=['setDataValue','email','trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox'];(function(_0x38a995,_0x129e64){var _0x3e402b=function(_0x36514a){while(--_0x36514a){_0x38a995['push'](_0x38a995['shift']());}};_0x3e402b(++_0x129e64);}(_0xf169,0x1ca));var _0x9f16=function(_0x3d61a3,_0x2caa80){_0x3d61a3=_0x3d61a3-0x0;var _0x388299=_0xf169[_0x3d61a3];return _0x388299;};'use strict';var Sequelize=require(_0x9f16('0x0'));module[_0x9f16('0x1')]={'customer_id':{'type':Sequelize[_0x9f16('0x2')]},'context':{'type':Sequelize[_0x9f16('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x9f16('0x3')},'password':{'type':Sequelize[_0x9f16('0x2')]},'fullname':{'type':Sequelize[_0x9f16('0x2')]},'email':{'type':Sequelize[_0x9f16('0x2')],'validate':{'isEmail':!![]},'set':function(_0xf04ad3){this[_0x9f16('0x4')](_0x9f16('0x5'),typeof _0xf04ad3==='string'&&_0xf04ad3[_0x9f16('0x6')]()?_0xf04ad3['trim']():null);}},'pager':{'type':Sequelize[_0x9f16('0x2')]},'tz':{'type':Sequelize[_0x9f16('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x9f16('0x7')](_0x9f16('0x8'),'no'),'defaultValue':_0x9f16('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9f16('0x7')](_0x9f16('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x9f16('0x2')]},'callback':{'type':Sequelize[_0x9f16('0x2')]},'review':{'type':Sequelize[_0x9f16('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x9f16('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9f16('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9f16('0x7')](_0x9f16('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x9f16('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9f16('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x9f16('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9f16('0x7')](_0x9f16('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x9f16('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x9f16('0x9')},'emailsubject':{'type':Sequelize[_0x9f16('0x2')]},'emailbody':{'type':Sequelize[_0x9f16('0x2')]},'maxsecs':{'type':Sequelize[_0x9f16('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9f16('0xb')],'get':function(){return this[_0x9f16('0xc')]('fullname')+'\x20-\x20'+this[_0x9f16('0xc')](_0x9f16('0xd'));}}}; \ No newline at end of file +var _0xbc50=['getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x3ab691,_0x18f2c8){var _0x27b2d5=function(_0x2039f4){while(--_0x2039f4){_0x3ab691['push'](_0x3ab691['shift']());}};_0x27b2d5(++_0x18f2c8);}(_0xbc50,0xa5));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0bc5('0x0'));module[_0x0bc5('0x1')]={'customer_id':{'type':Sequelize[_0x0bc5('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x0bc5('0x3'),'unique':_0x0bc5('0x4')},'mailbox':{'type':Sequelize[_0x0bc5('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0bc5('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0bc5('0x2')]},'email':{'type':Sequelize[_0x0bc5('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1c86fb){this[_0x0bc5('0x5')](_0x0bc5('0x6'),typeof _0x1c86fb===_0x0bc5('0x7')&&_0x1c86fb[_0x0bc5('0x8')]()?_0x1c86fb['trim']():null);}},'pager':{'type':Sequelize[_0x0bc5('0x2')]},'tz':{'type':Sequelize[_0x0bc5('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x0bc5('0x9')](_0x0bc5('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x0bc5('0x9')](_0x0bc5('0xa'),'no'),'defaultValue':_0x0bc5('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0bc5('0x2')]},'callback':{'type':Sequelize[_0x0bc5('0x2')]},'review':{'type':Sequelize[_0x0bc5('0x9')](_0x0bc5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0bc5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0bc5('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0bc5('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x0bc5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0bc5('0x9')](_0x0bc5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x0bc5('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0bc5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0bc5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0bc5('0x9')](_0x0bc5('0xa'),'no'),'defaultValue':_0x0bc5('0xa'),'allowNull':![]},'stamp':{'type':_0x0bc5('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x0bc5('0x2')]},'maxsecs':{'type':Sequelize[_0x0bc5('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0bc5('0xe')],'get':function(){return this[_0x0bc5('0xf')](_0x0bc5('0x10'))+'\x20-\x20'+this[_0x0bc5('0xf')](_0x0bc5('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b6f2827..0080777 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 _0xe511=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','body','destroy','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','get','Voicemails','error','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters'];(function(_0x59a3e3,_0x2c514c){var _0x154d1f=function(_0x2c41be){while(--_0x2c41be){_0x59a3e3['push'](_0x59a3e3['shift']());}};_0x154d1f(++_0x2c514c);}(_0xe511,0x16f));var _0x1e51=function(_0x1a5680,_0xd1e4f){_0x1a5680=_0x1a5680-0x0;var _0x13d9ea=_0xe511[_0x1a5680];return _0x13d9ea;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':!![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='Voicemails';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x22')]=function(_0x213edb,_0x177b63){if(_0x213edb[_0x1e51('0x4d')]['id']){delete _0x213edb['body']['id'];}return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x213edb['params']['id']}})['then'](handleEntityNotFound(_0x177b63,null))[_0x1e51('0x23')](saveUpdates(_0x213edb[_0x1e51('0x4d')],null))[_0x1e51('0x23')](respondWithResult(_0x177b63,null))['catch'](handleError(_0x177b63,null));};exports[_0x1e51('0x4e')]=function(_0x133576,_0x36c981){return db['VoiceMail'][_0x1e51('0x46')]({'where':{'id':_0x133576[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x36c981,null))['then'](removeEntity(_0x36c981,null))[_0x1e51('0x4c')](handleError(_0x36c981,null));};exports[_0x1e51('0x4f')]=function(_0x175aa0,_0x30ee67,_0x666ae9){return db[_0x1e51('0x2a')][_0x1e51('0x50')]({'where':{'id':_0x175aa0[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x30ee67,null))[_0x1e51('0x23')](function(_0x2e78e7){var _0x48848f;var _0x5a9d2a={},_0x577b19={};_0x577b19[_0x1e51('0x35')]=_[_0x1e51('0x30')](db[_0x1e51('0x51')][_0x1e51('0x2b')]);_0x577b19[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x175aa0[_0x1e51('0x2f')]);_0x577b19[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0x577b19['model'],_0x577b19['query']);_0x5a9d2a['attributes']=_[_0x1e51('0x31')](_0x577b19[_0x1e51('0x35')],qs['fields'](_0x175aa0['query'][_0x1e51('0x33')]));_0x5a9d2a[_0x1e51('0x32')]=_0x5a9d2a['attributes'][_0x1e51('0x34')]?_0x5a9d2a[_0x1e51('0x32')]:_0x577b19[_0x1e51('0x35')];if(!_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x52'))){_0x5a9d2a[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x5a9d2a['offset']=qs[_0x1e51('0x1c')](_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x5a9d2a[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x175aa0[_0x1e51('0x2f')]['sort']);_0x5a9d2a['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x175aa0[_0x1e51('0x2f')],_0x577b19[_0x1e51('0x39')]));if(_0x175aa0['query']['filter']){_0x5a9d2a['where']=_[_0x1e51('0x3d')](_0x5a9d2a[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x5a9d2a[_0x1e51('0x32')],function(_0x184665){var _0x5c68b1={};_0x5c68b1[_0x184665]={'$like':'%'+_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5c68b1;})});}_0x5a9d2a[_0x1e51('0x3c')]=_['merge'](_0x5a9d2a[_0x1e51('0x3c')],{'mailboxuser':_0x2e78e7[_0x1e51('0x53')]});_0x5a9d2a=_[_0x1e51('0x3d')]({},_0x5a9d2a,_0x175aa0['options']);return db[_0x1e51('0x51')][_0x1e51('0x54')](_0x5a9d2a)['then'](respondWithFilteredResult(_0x30ee67,_0x5a9d2a));})['catch'](handleError(_0x30ee67,null));}; \ No newline at end of file +var _0x7334=['map','VoiceMail','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','getMessages','VoiceMailMessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','name','send','index'];(function(_0x2dccd8,_0x1b2821){var _0xcd6114=function(_0x3ae464){while(--_0x3ae464){_0x2dccd8['push'](_0x2dccd8['shift']());}};_0xcd6114(++_0x1b2821);}(_0x7334,0x184));var _0x4733=function(_0xc742ef,_0x17f21e){_0xc742ef=_0xc742ef-0x0;var _0x3aee8d=_0x7334[_0xc742ef];return _0x3aee8d;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];function respondWithStatusCode(_0x461f74,_0x100ecd){_0x100ecd=_0x100ecd||0xcc;return function(_0x1c146c){if(_0x1c146c){return _0x461f74[_0x4733('0x1a')](_0x100ecd);}return _0x461f74['status'](_0x100ecd)[_0x4733('0x1b')]();};}function respondWithResult(_0x543caf,_0x4327f3){_0x4327f3=_0x4327f3||0xc8;return function(_0x1a22e4){if(_0x1a22e4){return _0x543caf[_0x4733('0x1c')](_0x4327f3)[_0x4733('0x1d')](_0x1a22e4);}};}function respondWithFilteredResult(_0x3813df,_0x167016){return function(_0x12f111){if(_0x12f111){var _0x9fff=typeof _0x167016[_0x4733('0x1e')]==='undefined'&&typeof _0x167016[_0x4733('0x1f')]===_0x4733('0x20');var _0x47b129=_0x12f111[_0x4733('0x21')];var _0x1d2fb6=_0x9fff?0x0:_0x167016[_0x4733('0x1e')];var _0x384e0c=_0x9fff?_0x12f111['count']:_0x167016['offset']+_0x167016[_0x4733('0x1f')];var _0x3b730a;if(_0x384e0c>=_0x47b129){_0x384e0c=_0x47b129;_0x3b730a=0xc8;}else{_0x3b730a=0xce;}_0x3813df['status'](_0x3b730a);return _0x3813df[_0x4733('0x22')](_0x4733('0x23'),_0x1d2fb6+'-'+_0x384e0c+'/'+_0x47b129)[_0x4733('0x1d')](_0x12f111);}return null;};}function patchUpdates(_0x7a4e0){return function(_0x493cd3){try{jsonpatch[_0x4733('0x24')](_0x493cd3,_0x7a4e0,!![]);}catch(_0xb45e1){return BPromise['reject'](_0xb45e1);}return _0x493cd3[_0x4733('0x25')]();};}function saveUpdates(_0x18da47,_0x478e34){return function(_0x15a291){if(_0x15a291){return _0x15a291[_0x4733('0x26')](_0x18da47)[_0x4733('0x27')](function(_0x1a0643){return _0x1a0643;});}return null;};}function removeEntity(_0x3a2542,_0x24db74){return function(_0x180049){if(_0x180049){return _0x180049[_0x4733('0x28')]()['then'](function(){var _0x3e6976=_0x180049[_0x4733('0x29')]({'plain':!![]});var _0x7884e5=_0x4733('0x2a');return db[_0x4733('0x2b')][_0x4733('0x28')]({'where':{'type':_0x7884e5,'resourceId':_0x3e6976['id']}})[_0x4733('0x27')](function(){return _0x180049;});})[_0x4733('0x27')](function(){_0x3a2542[_0x4733('0x1c')](0xcc)[_0x4733('0x1b')]();});}};}function handleEntityNotFound(_0x521855,_0x3aeb57){return function(_0x4c91bc){if(!_0x4c91bc){_0x521855['sendStatus'](0x194);}return _0x4c91bc;};}function handleError(_0x24e975,_0x49c516){_0x49c516=_0x49c516||0x1f4;return function(_0xcde4f4){logger['error'](_0xcde4f4['stack']);if(_0xcde4f4['name']){delete _0xcde4f4[_0x4733('0x2c')];}_0x24e975[_0x4733('0x1c')](_0x49c516)[_0x4733('0x2d')](_0xcde4f4);};}exports[_0x4733('0x2e')]=function(_0x4fee4a,_0x538a7c){var _0x50f67e={},_0x2b2757={},_0x56872b={'count':0x0,'rows':[]};var _0x5a4814=_[_0x4733('0x2f')](db[_0x4733('0x30')][_0x4733('0x31')],function(_0x59172a){return{'name':_0x59172a['fieldName'],'type':_0x59172a[_0x4733('0x32')][_0x4733('0x33')]};});_0x2b2757[_0x4733('0x34')]=_[_0x4733('0x2f')](_0x5a4814,_0x4733('0x2c'));_0x2b2757['query']=_[_0x4733('0x35')](_0x4fee4a[_0x4733('0x36')]);_0x2b2757[_0x4733('0x37')]=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],_0x2b2757['query']);_0x50f67e['attributes']=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],qs[_0x4733('0x39')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x39')]));_0x50f67e['attributes']=_0x50f67e[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50f67e[_0x4733('0x3a')]:_0x2b2757['model'];if(!_0x4fee4a[_0x4733('0x36')][_0x4733('0x3c')](_0x4733('0x3d'))){_0x50f67e[_0x4733('0x1f')]=qs[_0x4733('0x1f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x1f')]);_0x50f67e[_0x4733('0x1e')]=qs['offset'](_0x4fee4a[_0x4733('0x36')]['offset']);}_0x50f67e[_0x4733('0x3e')]=qs[_0x4733('0x3f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x3f')]);_0x50f67e[_0x4733('0x40')]=qs[_0x4733('0x37')](_[_0x4733('0x41')](_0x4fee4a[_0x4733('0x36')],_0x2b2757['filters']),_0x5a4814);if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x42')]){_0x50f67e['where']=_[_0x4733('0x43')](_0x50f67e[_0x4733('0x40')],{'$or':_['map'](_0x5a4814,function(_0x34aefe){if(_0x34aefe['type']!==_0x4733('0x44')){var _0x4c3073={};_0x4c3073[_0x34aefe[_0x4733('0x2c')]]={'$like':'%'+_0x4fee4a[_0x4733('0x36')]['filter']+'%'};return _0x4c3073;}})});}_0x50f67e=_['merge']({},_0x50f67e,_0x4fee4a[_0x4733('0x45')]);var _0x1d7112={'where':_0x50f67e['where']};return db[_0x4733('0x30')][_0x4733('0x21')](_0x1d7112)[_0x4733('0x27')](function(_0x28ed14){_0x56872b[_0x4733('0x21')]=_0x28ed14;if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x46')]){_0x50f67e[_0x4733('0x47')]=[{'all':!![]}];}return db[_0x4733('0x30')][_0x4733('0x48')](_0x50f67e);})[_0x4733('0x27')](function(_0x1d32df){_0x56872b[_0x4733('0x49')]=_0x1d32df;return _0x56872b;})[_0x4733('0x27')](respondWithFilteredResult(_0x538a7c,_0x50f67e))[_0x4733('0x4a')](handleError(_0x538a7c,null));};exports[_0x4733('0x4b')]=function(_0x297bb1,_0x397088){var _0x50b9cb={'raw':!![],'where':{'id':_0x297bb1[_0x4733('0x4c')]['id']}},_0x1a0c5c={};_0x1a0c5c[_0x4733('0x34')]=_[_0x4733('0x35')](db[_0x4733('0x30')][_0x4733('0x31')]);_0x1a0c5c[_0x4733('0x36')]=_[_0x4733('0x35')](_0x297bb1[_0x4733('0x36')]);_0x1a0c5c[_0x4733('0x37')]=_[_0x4733('0x38')](_0x1a0c5c[_0x4733('0x34')],_0x1a0c5c[_0x4733('0x36')]);_0x50b9cb[_0x4733('0x3a')]=_['intersection'](_0x1a0c5c['model'],qs[_0x4733('0x39')](_0x297bb1[_0x4733('0x36')][_0x4733('0x39')]));_0x50b9cb[_0x4733('0x3a')]=_0x50b9cb[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50b9cb[_0x4733('0x3a')]:_0x1a0c5c[_0x4733('0x34')];if(_0x297bb1[_0x4733('0x36')][_0x4733('0x46')]){_0x50b9cb['include']=[{'all':!![]}];}_0x50b9cb=_['merge']({},_0x50b9cb,_0x297bb1['options']);return db['VoiceMail'][_0x4733('0x4d')](_0x50b9cb)[_0x4733('0x27')](handleEntityNotFound(_0x397088,null))[_0x4733('0x27')](respondWithResult(_0x397088,null))[_0x4733('0x4a')](handleError(_0x397088,null));};exports[_0x4733('0x4e')]=function(_0x45b9cf,_0x1c6abf){return db[_0x4733('0x30')][_0x4733('0x4e')](_0x45b9cf[_0x4733('0x4f')],{})['then'](function(_0x53d70b){var _0x29c93d=_0x45b9cf['user'][_0x4733('0x29')]({'plain':!![]});if(!_0x29c93d)throw new Error(_0x4733('0x50'));if(_0x29c93d[_0x4733('0x51')]==='user'){var _0x3f2a78=_0x53d70b[_0x4733('0x29')]({'plain':!![]});var _0x31ae69=_0x4733('0x2a');return db[_0x4733('0x52')][_0x4733('0x4d')]({'where':{'name':_0x31ae69,'userProfileId':_0x29c93d[_0x4733('0x53')]},'raw':!![]})[_0x4733('0x27')](function(_0x28d428){if(_0x28d428&&_0x28d428['autoAssociation']===0x0){return db[_0x4733('0x2b')][_0x4733('0x4e')]({'name':_0x3f2a78[_0x4733('0x2c')],'resourceId':_0x3f2a78['id'],'type':_0x28d428['name'],'sectionId':_0x28d428['id']},{})[_0x4733('0x27')](function(){return _0x53d70b;});}else{return _0x53d70b;}})[_0x4733('0x4a')](function(_0xafb3f8){logger[_0x4733('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xafb3f8);throw _0xafb3f8;});}return _0x53d70b;})[_0x4733('0x27')](respondWithResult(_0x1c6abf,0xc9))['catch'](handleError(_0x1c6abf,null));};exports[_0x4733('0x26')]=function(_0x3b8165,_0x42405e){if(_0x3b8165[_0x4733('0x4f')]['id']){delete _0x3b8165[_0x4733('0x4f')]['id'];}return db['VoiceMail'][_0x4733('0x4d')]({'where':{'id':_0x3b8165[_0x4733('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42405e,null))['then'](saveUpdates(_0x3b8165[_0x4733('0x4f')],null))[_0x4733('0x27')](respondWithResult(_0x42405e,null))[_0x4733('0x4a')](handleError(_0x42405e,null));};exports[_0x4733('0x28')]=function(_0x422010,_0x972fde){return db[_0x4733('0x30')][_0x4733('0x4d')]({'where':{'id':_0x422010['params']['id']}})['then'](handleEntityNotFound(_0x972fde,null))[_0x4733('0x27')](removeEntity(_0x972fde,null))['catch'](handleError(_0x972fde,null));};exports[_0x4733('0x55')]=function(_0x2c532a,_0x51a8db,_0x57034a){return db['VoiceMail']['findOne']({'where':{'id':_0x2c532a[_0x4733('0x4c')]['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x51a8db,null))[_0x4733('0x27')](function(_0x5e451a){var _0x12242a;var _0x3d1157={},_0x15a32e={};_0x15a32e[_0x4733('0x34')]=_[_0x4733('0x35')](db[_0x4733('0x56')][_0x4733('0x31')]);_0x15a32e['query']=_[_0x4733('0x35')](_0x2c532a[_0x4733('0x36')]);_0x15a32e['filters']=_['intersection'](_0x15a32e[_0x4733('0x34')],_0x15a32e[_0x4733('0x36')]);_0x3d1157[_0x4733('0x3a')]=_[_0x4733('0x38')](_0x15a32e[_0x4733('0x34')],qs[_0x4733('0x39')](_0x2c532a[_0x4733('0x36')][_0x4733('0x39')]));_0x3d1157[_0x4733('0x3a')]=_0x3d1157['attributes'][_0x4733('0x3b')]?_0x3d1157[_0x4733('0x3a')]:_0x15a32e[_0x4733('0x34')];if(!_0x2c532a['query'][_0x4733('0x3c')]('nolimit')){_0x3d1157[_0x4733('0x1f')]=qs[_0x4733('0x1f')](_0x2c532a[_0x4733('0x36')][_0x4733('0x1f')]);_0x3d1157[_0x4733('0x1e')]=qs[_0x4733('0x1e')](_0x2c532a['query'][_0x4733('0x1e')]);}_0x3d1157['order']=qs[_0x4733('0x3f')](_0x2c532a[_0x4733('0x36')]['sort']);_0x3d1157[_0x4733('0x40')]=qs['filters'](_['pick'](_0x2c532a[_0x4733('0x36')],_0x15a32e[_0x4733('0x37')]));if(_0x2c532a[_0x4733('0x36')][_0x4733('0x42')]){_0x3d1157[_0x4733('0x40')]=_[_0x4733('0x43')](_0x3d1157[_0x4733('0x40')],{'$or':_[_0x4733('0x2f')](_0x3d1157[_0x4733('0x3a')],function(_0x5eab76){var _0x53d128={};_0x53d128[_0x5eab76]={'$like':'%'+_0x2c532a['query'][_0x4733('0x42')]+'%'};return _0x53d128;})});}_0x3d1157[_0x4733('0x40')]=_[_0x4733('0x43')](_0x3d1157[_0x4733('0x40')],{'mailboxuser':_0x5e451a['mailbox']});_0x3d1157=_[_0x4733('0x43')]({},_0x3d1157,_0x2c532a[_0x4733('0x45')]);return db[_0x4733('0x56')]['findAndCountAll'](_0x3d1157)[_0x4733('0x27')](respondWithFilteredResult(_0x51a8db,_0x3d1157));})['catch'](handleError(_0x51a8db,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0ca636d..349c54b 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 _0xa1dd=['../../config/environment','./voiceMail.attributes','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x3727d3,_0x57f15c){var _0x266f80=function(_0x2de82c){while(--_0x2de82c){_0x3727d3['push'](_0x3727d3['shift']());}};_0x266f80(++_0x57f15c);}(_0xa1dd,0x1c2));var _0xda1d=function(_0x2d4a23,_0x17971f){_0x2d4a23=_0x2d4a23-0x0;var _0x321293=_0xa1dd[_0x2d4a23];return _0x321293;};'use strict';var _=require(_0xda1d('0x0'));var util=require(_0xda1d('0x1'));var logger=require(_0xda1d('0x2'))('api');var moment=require(_0xda1d('0x3'));var BPromise=require('bluebird');var rp=require(_0xda1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda1d('0x5'));var config=require(_0xda1d('0x6'));var attributes=require(_0xda1d('0x7'));module['exports']=function(_0x4fdaad,_0xb3a772){return _0x4fdaad['define'](_0xda1d('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xda1d('0x9'),'fields':[_0xda1d('0xa'),_0xda1d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d09=['mailbox','context','lodash','util','api','bluebird','request-promise','path','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0d09,0x152));var _0x90d0=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x0d09[_0x3f8a03];return _0x147fb2;};'use strict';var _=require(_0x90d0('0x0'));var util=require(_0x90d0('0x1'));var logger=require('../../config/logger')(_0x90d0('0x2'));var moment=require('moment');var BPromise=require(_0x90d0('0x3'));var rp=require(_0x90d0('0x4'));var fs=require('fs');var path=require(_0x90d0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x90d0('0x6'));module[_0x90d0('0x7')]=function(_0x5dde10,_0x10b1a3){return _0x5dde10[_0x90d0('0x8')](_0x90d0('0x9'),attributes,{'tableName':_0x90d0('0xa'),'paranoid':![],'indexes':[{'name':_0x90d0('0xb'),'fields':[_0x90d0('0xc'),_0x90d0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8e750a9..cb7219a 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 _0x3837=['request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0xbb0245,_0x53bfd5){var _0x436286=function(_0x330712){while(--_0x330712){_0xbb0245['push'](_0xbb0245['shift']());}};_0x436286(++_0x53bfd5);}(_0x3837,0x75));var _0x7383=function(_0x5ef65a,_0x1ac77a){_0x5ef65a=_0x5ef65a-0x0;var _0x4d139f=_0x3837[_0x5ef65a];return _0x4d139f;};'use strict';var _=require(_0x7383('0x0'));var util=require(_0x7383('0x1'));var moment=require(_0x7383('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7383('0x3'));var db=require(_0x7383('0x4'))['db'];var utils=require(_0x7383('0x5'));var logger=require(_0x7383('0x6'))(_0x7383('0x7'));var config=require(_0x7383('0x8'));var jayson=require(_0x7383('0x9'));var client=jayson[_0x7383('0xa')][_0x7383('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4962e2,_0x282c1d,_0x227688){return new BPromise(function(_0xba00e0,_0xa8f5d7){return client['request'](_0x4962e2,_0x227688)[_0x7383('0xc')](function(_0x50fb8e){logger[_0x7383('0xd')](_0x7383('0xe'),_0x282c1d,_0x7383('0xf'));logger['debug'](_0x7383('0x10'),_0x282c1d,'request\x20sent',JSON[_0x7383('0x11')](_0x50fb8e));if(_0x50fb8e[_0x7383('0x12')]){if(_0x50fb8e[_0x7383('0x12')]['code']===0x1f4){logger[_0x7383('0x12')]('VoiceMail,\x20%s,\x20%s',_0x282c1d,_0x50fb8e[_0x7383('0x12')]['message']);return _0xa8f5d7(_0x50fb8e[_0x7383('0x12')][_0x7383('0x13')]);}logger[_0x7383('0x12')]('VoiceMail,\x20%s,\x20%s',_0x282c1d,_0x50fb8e[_0x7383('0x12')][_0x7383('0x13')]);return _0xba00e0(_0x50fb8e[_0x7383('0x12')][_0x7383('0x13')]);}else{logger['info'](_0x7383('0xe'),_0x282c1d,_0x7383('0xf'));_0xba00e0(_0x50fb8e[_0x7383('0x14')][_0x7383('0x13')]);}})[_0x7383('0x15')](function(_0x26aa3f){logger['error']('VoiceMail,\x20%s,\x20%s',_0x282c1d,_0x26aa3f);_0xa8f5d7(_0x26aa3f);});});} \ No newline at end of file +var _0x11df=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2aa31b,_0x2ec314){var _0x460803=function(_0x2b501d){while(--_0x2b501d){_0x2aa31b['push'](_0x2aa31b['shift']());}};_0x460803(++_0x2ec314);}(_0x11df,0x1ee));var _0xf11d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x11df[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xf11d('0x0'));var util=require(_0xf11d('0x1'));var moment=require(_0xf11d('0x2'));var BPromise=require(_0xf11d('0x3'));var rs=require(_0xf11d('0x4'));var fs=require('fs');var Redis=require(_0xf11d('0x5'));var db=require(_0xf11d('0x6'))['db'];var utils=require(_0xf11d('0x7'));var logger=require(_0xf11d('0x8'))(_0xf11d('0x9'));var config=require(_0xf11d('0xa'));var jayson=require(_0xf11d('0xb'));var client=jayson[_0xf11d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x457bcd,_0xbb7cd9,_0x81a29d){return new BPromise(function(_0x122d41,_0x470279){return client[_0xf11d('0xd')](_0x457bcd,_0x81a29d)[_0xf11d('0xe')](function(_0x359cc3){logger[_0xf11d('0xf')](_0xf11d('0x10'),_0xbb7cd9,_0xf11d('0x11'));logger[_0xf11d('0x12')](_0xf11d('0x13'),_0xbb7cd9,_0xf11d('0x11'),JSON[_0xf11d('0x14')](_0x359cc3));if(_0x359cc3[_0xf11d('0x15')]){if(_0x359cc3[_0xf11d('0x15')][_0xf11d('0x16')]===0x1f4){logger[_0xf11d('0x15')](_0xf11d('0x10'),_0xbb7cd9,_0x359cc3[_0xf11d('0x15')][_0xf11d('0x17')]);return _0x470279(_0x359cc3[_0xf11d('0x15')][_0xf11d('0x17')]);}logger[_0xf11d('0x15')]('VoiceMail,\x20%s,\x20%s',_0xbb7cd9,_0x359cc3[_0xf11d('0x15')][_0xf11d('0x17')]);return _0x122d41(_0x359cc3[_0xf11d('0x15')][_0xf11d('0x17')]);}else{logger[_0xf11d('0xf')](_0xf11d('0x10'),_0xbb7cd9,_0xf11d('0x11'));_0x122d41(_0x359cc3['result'][_0xf11d('0x17')]);}})[_0xf11d('0x18')](function(_0x53c7ea){logger[_0xf11d('0x15')](_0xf11d('0x10'),_0xbb7cd9,_0x53c7ea);_0x470279(_0x53c7ea);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1536c53..3575c05 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 _0x13ec=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2aa8ff,_0x43e0e1){var _0x52ee3e=function(_0x5aeac5){while(--_0x5aeac5){_0x2aa8ff['push'](_0x2aa8ff['shift']());}};_0x52ee3e(++_0x43e0e1);}(_0x13ec,0x1f1));var _0xc13e=function(_0x50068c,_0x5312e1){_0x50068c=_0x50068c-0x0;var _0x29c80b=_0x13ec[_0x50068c];return _0x29c80b;};'use strict';var multer=require(_0xc13e('0x0'));var util=require(_0xc13e('0x1'));var path=require(_0xc13e('0x2'));var timeout=require(_0xc13e('0x3'));var express=require(_0xc13e('0x4'));var router=express[_0xc13e('0x5')]();var fs_extra=require(_0xc13e('0x6'));var auth=require(_0xc13e('0x7'));var interaction=require(_0xc13e('0x8'));var config=require(_0xc13e('0x9'));var controller=require(_0xc13e('0xa'));router[_0xc13e('0xb')]('/',auth[_0xc13e('0xc')](),controller[_0xc13e('0xd')]);router[_0xc13e('0xb')](_0xc13e('0xe'),auth[_0xc13e('0xc')](),controller[_0xc13e('0xf')]);router[_0xc13e('0xb')](_0xc13e('0x10'),auth[_0xc13e('0xc')](),controller[_0xc13e('0x11')]);router[_0xc13e('0x12')]('/',auth['isAuthenticated'](),controller[_0xc13e('0x13')]);router['put'](_0xc13e('0xe'),auth[_0xc13e('0xc')](),controller['update']);router[_0xc13e('0x14')](_0xc13e('0xe'),auth['isAuthenticated'](),controller[_0xc13e('0x15')]);module[_0xc13e('0x16')]=router; \ No newline at end of file +var _0xad61=['get','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index'];(function(_0x83bf04,_0x2662dd){var _0x4abe66=function(_0x1eb555){while(--_0x1eb555){_0x83bf04['push'](_0x83bf04['shift']());}};_0x4abe66(++_0x2662dd);}(_0xad61,0x1aa));var _0x1ad6=function(_0x318d35,_0x39247e){_0x318d35=_0x318d35-0x0;var _0x5c7f75=_0xad61[_0x318d35];return _0x5c7f75;};'use strict';var multer=require(_0x1ad6('0x0'));var util=require('util');var path=require(_0x1ad6('0x1'));var timeout=require(_0x1ad6('0x2'));var express=require(_0x1ad6('0x3'));var router=express[_0x1ad6('0x4')]();var fs_extra=require(_0x1ad6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1ad6('0x6'));var config=require(_0x1ad6('0x7'));var controller=require(_0x1ad6('0x8'));router['get']('/',auth[_0x1ad6('0x9')](),controller[_0x1ad6('0xa')]);router[_0x1ad6('0xb')](_0x1ad6('0xc'),auth[_0x1ad6('0x9')](),controller[_0x1ad6('0xd')]);router[_0x1ad6('0xb')](_0x1ad6('0xe'),auth[_0x1ad6('0x9')](),controller[_0x1ad6('0xf')]);router[_0x1ad6('0x10')]('/',auth[_0x1ad6('0x9')](),controller[_0x1ad6('0x11')]);router[_0x1ad6('0x12')](_0x1ad6('0xc'),auth['isAuthenticated'](),controller[_0x1ad6('0x13')]);router[_0x1ad6('0x14')](_0x1ad6('0xc'),auth[_0x1ad6('0x9')](),controller[_0x1ad6('0x15')]);module[_0x1ad6('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index be7f512..1b8462b 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 _0xa929=['INTEGER','STRING','long','TIMESTAMP','exports','VIRTUAL','getDataValue'];(function(_0x48f548,_0x54c87d){var _0x5c14f7=function(_0x126bd6){while(--_0x126bd6){_0x48f548['push'](_0x48f548['shift']());}};_0x5c14f7(++_0x54c87d);}(_0xa929,0x1cb));var _0x9a92=function(_0x193005,_0x467e4b){_0x193005=_0x193005-0x0;var _0x47ee4a=_0xa929[_0x193005];return _0x47ee4a;};'use strict';var Sequelize=require('sequelize');module[_0x9a92('0x0')]={'name':{'type':Sequelize[_0x9a92('0x1')],'get':function(_0x41d599){return this[_0x9a92('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x9a92('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x9a92('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9a92('0x4')],'defaultValue':''},'stamp':{'type':_0x9a92('0x6'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x065c=['VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x2be4b6,_0x196345){var _0x417b58=function(_0x4bf9d3){while(--_0x4bf9d3){_0x2be4b6['push'](_0x2be4b6['shift']());}};_0x417b58(++_0x196345);}(_0x065c,0x1c0));var _0xc065=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x065c[_0x57db49];return _0xd0636f;};'use strict';var Sequelize=require(_0xc065('0x0'));module[_0xc065('0x1')]={'name':{'type':Sequelize[_0xc065('0x2')],'get':function(_0x3604bc){return this[_0xc065('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xc065('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xc065('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc065('0x5')],'defaultValue':''},'stamp':{'type':_0xc065('0x7'),'defaultValue':Sequelize[_0xc065('0x8')](_0xc065('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b99b6d3..025a087 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 _0x0c34=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','index','map','VoiceMailMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','catch','create','body','destroy','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring'];(function(_0x3288f8,_0x38b946){var _0x2eb7a0=function(_0x2acfab){while(--_0x2acfab){_0x3288f8['push'](_0x3288f8['shift']());}};_0x2eb7a0(++_0x38b946);}(_0x0c34,0x94));var _0x40c3=function(_0x5babb0,_0x117edf){_0x5babb0=_0x5babb0-0x0;var _0x41b2d5=_0x0c34[_0x5babb0];return _0x41b2d5;};'use strict';var emlformat=require(_0x40c3('0x0'));var rimraf=require(_0x40c3('0x1'));var zipdir=require(_0x40c3('0x2'));var jsonpatch=require(_0x40c3('0x3'));var rp=require(_0x40c3('0x4'));var moment=require(_0x40c3('0x5'));var BPromise=require(_0x40c3('0x6'));var Mustache=require(_0x40c3('0x7'));var util=require(_0x40c3('0x8'));var path=require(_0x40c3('0x9'));var sox=require(_0x40c3('0xa'));var csv=require(_0x40c3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x40c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x40c3('0xe'));var toCsv=require(_0x40c3('0xb'));var querystring=require(_0x40c3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x40c3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x40c3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40c3('0x12'))('api');var utils=require(_0x40c3('0x13'));var config=require(_0x40c3('0x14'));var licenseUtil=require(_0x40c3('0x15'));var db=require(_0x40c3('0x16'))['db'];function respondWithStatusCode(_0x5302e6,_0x371617){_0x371617=_0x371617||0xcc;return function(_0x1dc6ee){if(_0x1dc6ee){return _0x5302e6[_0x40c3('0x17')](_0x371617);}return _0x5302e6[_0x40c3('0x18')](_0x371617)[_0x40c3('0x19')]();};}function respondWithResult(_0x1834f6,_0x3c5e0a){_0x3c5e0a=_0x3c5e0a||0xc8;return function(_0x45723a){if(_0x45723a){return _0x1834f6[_0x40c3('0x18')](_0x3c5e0a)[_0x40c3('0x1a')](_0x45723a);}};}function respondWithFilteredResult(_0x2f4e70,_0x260b03){return function(_0x47890e){if(_0x47890e){var _0x23f135=typeof _0x260b03[_0x40c3('0x1b')]===_0x40c3('0x1c')&&typeof _0x260b03[_0x40c3('0x1d')]===_0x40c3('0x1c');var _0x3b1903=_0x47890e[_0x40c3('0x1e')];var _0x5501cf=_0x23f135?0x0:_0x260b03[_0x40c3('0x1b')];var _0x43f840=_0x23f135?_0x47890e[_0x40c3('0x1e')]:_0x260b03[_0x40c3('0x1b')]+_0x260b03[_0x40c3('0x1d')];var _0x5b28fa;if(_0x43f840>=_0x3b1903){_0x43f840=_0x3b1903;_0x5b28fa=0xc8;}else{_0x5b28fa=0xce;}_0x2f4e70['status'](_0x5b28fa);return _0x2f4e70[_0x40c3('0x1f')]('Content-Range',_0x5501cf+'-'+_0x43f840+'/'+_0x3b1903)[_0x40c3('0x1a')](_0x47890e);}return null;};}function patchUpdates(_0x2c9aef){return function(_0xc2ce13){try{jsonpatch[_0x40c3('0x20')](_0xc2ce13,_0x2c9aef,!![]);}catch(_0x454f8f){return BPromise[_0x40c3('0x21')](_0x454f8f);}return _0xc2ce13[_0x40c3('0x22')]();};}function saveUpdates(_0x5587c3,_0x2d8d00){return function(_0x3f7c1e){if(_0x3f7c1e){return _0x3f7c1e[_0x40c3('0x23')](_0x5587c3)[_0x40c3('0x24')](function(_0x4526eb){return _0x4526eb;});}return null;};}function removeEntity(_0x46b7c9,_0x4cff63){return function(_0x5d155e){if(_0x5d155e){return _0x5d155e['destroy']()[_0x40c3('0x24')](function(){_0x46b7c9['status'](0xcc)[_0x40c3('0x19')]();});}};}function handleEntityNotFound(_0x1429c3,_0x2fc25f){return function(_0x4b6a6a){if(!_0x4b6a6a){_0x1429c3[_0x40c3('0x17')](0x194);}return _0x4b6a6a;};}function handleError(_0x39baf5,_0x358e57){_0x358e57=_0x358e57||0x1f4;return function(_0x20a1b2){logger[_0x40c3('0x25')](_0x20a1b2[_0x40c3('0x26')]);if(_0x20a1b2[_0x40c3('0x27')]){delete _0x20a1b2[_0x40c3('0x27')];}_0x39baf5['status'](_0x358e57)['send'](_0x20a1b2);};}exports[_0x40c3('0x28')]=function(_0xd6c9bd,_0x2263d8){var _0x1268ff={},_0x56ef28={},_0x550850={'count':0x0,'rows':[]};var _0x540e54=_[_0x40c3('0x29')](db[_0x40c3('0x2a')]['rawAttributes'],function(_0x41c7d9){return{'name':_0x41c7d9[_0x40c3('0x2b')],'type':_0x41c7d9[_0x40c3('0x2c')][_0x40c3('0x2d')]};});_0x56ef28['model']=_['differenceBy'](_[_0x40c3('0x29')](_0x540e54,'name'),[_0x40c3('0x27')]);_0x56ef28[_0x40c3('0x2e')]=_[_0x40c3('0x2f')](_0xd6c9bd[_0x40c3('0x2e')]);_0x56ef28[_0x40c3('0x30')]=_[_0x40c3('0x31')](_0x56ef28[_0x40c3('0x32')],_0x56ef28[_0x40c3('0x2e')]);_0x1268ff[_0x40c3('0x33')]=_['intersection'](_0x56ef28[_0x40c3('0x32')],qs[_0x40c3('0x34')](_0xd6c9bd[_0x40c3('0x2e')]['fields']));_0x1268ff[_0x40c3('0x33')]=_0x1268ff[_0x40c3('0x33')][_0x40c3('0x35')]?_0x1268ff[_0x40c3('0x33')]:_0x56ef28[_0x40c3('0x32')];if(!_0xd6c9bd[_0x40c3('0x2e')]['hasOwnProperty'](_0x40c3('0x36'))){_0x1268ff[_0x40c3('0x1d')]=qs[_0x40c3('0x1d')](_0xd6c9bd['query']['limit']);_0x1268ff['offset']=qs[_0x40c3('0x1b')](_0xd6c9bd[_0x40c3('0x2e')]['offset']);}_0x1268ff[_0x40c3('0x37')]=qs[_0x40c3('0x38')](_0xd6c9bd[_0x40c3('0x2e')][_0x40c3('0x38')]);_0x1268ff[_0x40c3('0x39')]=qs[_0x40c3('0x30')](_[_0x40c3('0x3a')](_0xd6c9bd[_0x40c3('0x2e')],_0x56ef28[_0x40c3('0x30')]),_0x540e54);if(_0xd6c9bd[_0x40c3('0x2e')][_0x40c3('0x3b')]){_0x1268ff['where']=_[_0x40c3('0x3c')](_0x1268ff[_0x40c3('0x39')],{'$or':_[_0x40c3('0x29')](_0x540e54,function(_0x6bf4ce){if(_0x6bf4ce[_0x40c3('0x2c')]!==_0x40c3('0x3d')){var _0x2855ba={};_0x2855ba[_0x6bf4ce[_0x40c3('0x27')]]={'$like':'%'+_0xd6c9bd[_0x40c3('0x2e')][_0x40c3('0x3b')]+'%'};return _0x2855ba;}})});}_0x1268ff=_[_0x40c3('0x3c')]({},_0x1268ff,_0xd6c9bd['options']);var _0x1dac2e={'where':_0x1268ff[_0x40c3('0x39')]};return db[_0x40c3('0x2a')][_0x40c3('0x1e')](_0x1dac2e)[_0x40c3('0x24')](function(_0x50ef69){_0x550850[_0x40c3('0x1e')]=_0x50ef69;if(_0xd6c9bd[_0x40c3('0x2e')][_0x40c3('0x3e')]){_0x1268ff[_0x40c3('0x3f')]=[{'all':!![]}];}return db[_0x40c3('0x2a')]['findAll'](_0x1268ff);})[_0x40c3('0x24')](function(_0x5cdf16){_0x550850[_0x40c3('0x40')]=_0x5cdf16;return _0x550850;})[_0x40c3('0x24')](respondWithFilteredResult(_0x2263d8,_0x1268ff))['catch'](handleError(_0x2263d8,null));};exports[_0x40c3('0x41')]=function(_0x1ecc9c,_0x5f45a3){var _0x5cca65={'raw':!![],'where':{'id':_0x1ecc9c[_0x40c3('0x42')]['id']}},_0x1811da={};_0x1811da[_0x40c3('0x32')]=_[_0x40c3('0x2f')](db['VoiceMailMessage']['rawAttributes']);_0x1811da[_0x40c3('0x2e')]=_[_0x40c3('0x2f')](_0x1ecc9c[_0x40c3('0x2e')]);_0x1811da[_0x40c3('0x30')]=_[_0x40c3('0x31')](_0x1811da[_0x40c3('0x32')],_0x1811da[_0x40c3('0x2e')]);_0x5cca65[_0x40c3('0x33')]=_[_0x40c3('0x31')](_0x1811da['model'],qs[_0x40c3('0x34')](_0x1ecc9c['query'][_0x40c3('0x34')]));_0x5cca65[_0x40c3('0x33')]=_0x5cca65[_0x40c3('0x33')][_0x40c3('0x35')]?_0x5cca65[_0x40c3('0x33')]:_0x1811da[_0x40c3('0x32')];if(_0x1ecc9c[_0x40c3('0x2e')][_0x40c3('0x3e')]){_0x5cca65[_0x40c3('0x3f')]=[{'all':!![]}];}_0x5cca65=_['merge']({},_0x5cca65,_0x1ecc9c[_0x40c3('0x43')]);return db[_0x40c3('0x2a')][_0x40c3('0x44')](_0x5cca65)[_0x40c3('0x24')](handleEntityNotFound(_0x5f45a3,null))[_0x40c3('0x24')](respondWithResult(_0x5f45a3,null))[_0x40c3('0x45')](handleError(_0x5f45a3,null));};exports['create']=function(_0x5a8d14,_0x5ef67b){return db['VoiceMailMessage'][_0x40c3('0x46')](_0x5a8d14[_0x40c3('0x47')],{})[_0x40c3('0x24')](respondWithResult(_0x5ef67b,0xc9))[_0x40c3('0x45')](handleError(_0x5ef67b,null));};exports['update']=function(_0xf44cd7,_0x3f77c3){if(_0xf44cd7[_0x40c3('0x47')]['id']){delete _0xf44cd7[_0x40c3('0x47')]['id'];}return db[_0x40c3('0x2a')]['find']({'where':{'id':_0xf44cd7[_0x40c3('0x42')]['id']}})[_0x40c3('0x24')](handleEntityNotFound(_0x3f77c3,null))['then'](saveUpdates(_0xf44cd7['body'],null))['then'](respondWithResult(_0x3f77c3,null))[_0x40c3('0x45')](handleError(_0x3f77c3,null));};exports[_0x40c3('0x48')]=function(_0x527a8a,_0xc7b5cb){return db[_0x40c3('0x2a')][_0x40c3('0x44')]({'where':{'id':_0x527a8a[_0x40c3('0x42')]['id']}})[_0x40c3('0x24')](handleEntityNotFound(_0xc7b5cb,null))[_0x40c3('0x24')](removeEntity(_0xc7b5cb,null))[_0x40c3('0x45')](handleError(_0xc7b5cb,null));};exports[_0x40c3('0x49')]=function(_0x2f5997,_0x38c724,_0x2e6891){return db[_0x40c3('0x2a')][_0x40c3('0x44')]({'where':{'id':_0x2f5997[_0x40c3('0x42')]['id']},'attributes':['id','recording',_0x40c3('0x4a')]})[_0x40c3('0x24')](handleEntityNotFound(_0x38c724,null))[_0x40c3('0x24')](function(_0x51e908){if(_0x51e908){if(!_0x51e908[_0x40c3('0x4b')]){throw new db[(_0x40c3('0x4c'))][(_0x40c3('0x4d'))](_0x40c3('0x4e'));}var _0xf8201d={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x51e908[_0x40c3('0x4a')]){_0xf8201d[_0x40c3('0x4f')]=_0x40c3('0x50')+_0x51e908[_0x40c3('0x4a')]+_0x40c3('0x51');}_0x38c724[_0x40c3('0x1f')](_0xf8201d);return _0x38c724['send'](new Buffer(_0x51e908[_0x40c3('0x4b')]));}})[_0x40c3('0x45')](handleError(_0x38c724,null));}; \ No newline at end of file +var _0xbc5b=['catch','show','params','rawAttributes','includeAll','include','find','create','update','body','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','name','send','index','VoiceMailMessage','fieldName','type','key','differenceBy','map','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll'];(function(_0x416513,_0x42fb80){var _0x11f5a4=function(_0x19c979){while(--_0x19c979){_0x416513['push'](_0x416513['shift']());}};_0x11f5a4(++_0x42fb80);}(_0xbc5b,0x64));var _0xbbc5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbc5b[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbbc5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbbc5('0x1'));var moment=require(_0xbbc5('0x2'));var BPromise=require(_0xbbc5('0x3'));var Mustache=require('mustache');var util=require(_0xbbc5('0x4'));var path=require(_0xbbc5('0x5'));var sox=require(_0xbbc5('0x6'));var csv=require(_0xbbc5('0x7'));var ejs=require(_0xbbc5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbc5('0x9'));var squel=require('squel');var crypto=require(_0xbbc5('0xa'));var jsforce=require(_0xbbc5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbbc5('0x7'));var querystring=require(_0xbbc5('0xc'));var Papa=require(_0xbbc5('0xd'));var Redis=require('ioredis');var authService=require(_0xbbc5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbbc5('0xf'));var hardwareService=require(_0xbbc5('0x10'));var logger=require(_0xbbc5('0x11'))(_0xbbc5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbbc5('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18c0e7,_0x47e173){_0x47e173=_0x47e173||0xcc;return function(_0x478f9e){if(_0x478f9e){return _0x18c0e7[_0xbbc5('0x14')](_0x47e173);}return _0x18c0e7[_0xbbc5('0x15')](_0x47e173)[_0xbbc5('0x16')]();};}function respondWithResult(_0x57d69f,_0x422014){_0x422014=_0x422014||0xc8;return function(_0x2fd250){if(_0x2fd250){return _0x57d69f[_0xbbc5('0x15')](_0x422014)[_0xbbc5('0x17')](_0x2fd250);}};}function respondWithFilteredResult(_0x1bc797,_0x356bde){return function(_0x362cc3){if(_0x362cc3){var _0x137722=typeof _0x356bde['offset']===_0xbbc5('0x18')&&typeof _0x356bde[_0xbbc5('0x19')]==='undefined';var _0x17ee6e=_0x362cc3[_0xbbc5('0x1a')];var _0x1c9da8=_0x137722?0x0:_0x356bde[_0xbbc5('0x1b')];var _0x11fe2d=_0x137722?_0x362cc3[_0xbbc5('0x1a')]:_0x356bde[_0xbbc5('0x1b')]+_0x356bde[_0xbbc5('0x19')];var _0x52224a;if(_0x11fe2d>=_0x17ee6e){_0x11fe2d=_0x17ee6e;_0x52224a=0xc8;}else{_0x52224a=0xce;}_0x1bc797[_0xbbc5('0x15')](_0x52224a);return _0x1bc797[_0xbbc5('0x1c')](_0xbbc5('0x1d'),_0x1c9da8+'-'+_0x11fe2d+'/'+_0x17ee6e)['json'](_0x362cc3);}return null;};}function patchUpdates(_0xe1b38c){return function(_0x2a46ab){try{jsonpatch[_0xbbc5('0x1e')](_0x2a46ab,_0xe1b38c,!![]);}catch(_0x182537){return BPromise[_0xbbc5('0x1f')](_0x182537);}return _0x2a46ab[_0xbbc5('0x20')]();};}function saveUpdates(_0x4ff605,_0x3adb52){return function(_0x298367){if(_0x298367){return _0x298367['update'](_0x4ff605)[_0xbbc5('0x21')](function(_0x196865){return _0x196865;});}return null;};}function removeEntity(_0x48fcb6,_0x1390aa){return function(_0x56a93e){if(_0x56a93e){return _0x56a93e[_0xbbc5('0x22')]()[_0xbbc5('0x21')](function(){_0x48fcb6[_0xbbc5('0x15')](0xcc)[_0xbbc5('0x16')]();});}};}function handleEntityNotFound(_0x29f745,_0x32d0da){return function(_0x351aa9){if(!_0x351aa9){_0x29f745[_0xbbc5('0x14')](0x194);}return _0x351aa9;};}function handleError(_0x4b12e5,_0x181c8a){_0x181c8a=_0x181c8a||0x1f4;return function(_0x519c25){logger['error'](_0x519c25['stack']);if(_0x519c25[_0xbbc5('0x23')]){delete _0x519c25['name'];}_0x4b12e5['status'](_0x181c8a)[_0xbbc5('0x24')](_0x519c25);};}exports[_0xbbc5('0x25')]=function(_0x28e443,_0x5e9ed7){var _0x8a6822={},_0x5b4a75={},_0x57534b={'count':0x0,'rows':[]};var _0x1cbeb6=_['map'](db[_0xbbc5('0x26')]['rawAttributes'],function(_0x502dda){return{'name':_0x502dda[_0xbbc5('0x27')],'type':_0x502dda[_0xbbc5('0x28')][_0xbbc5('0x29')]};});_0x5b4a75['model']=_[_0xbbc5('0x2a')](_[_0xbbc5('0x2b')](_0x1cbeb6,_0xbbc5('0x23')),[_0xbbc5('0x23')]);_0x5b4a75[_0xbbc5('0x2c')]=_[_0xbbc5('0x2d')](_0x28e443[_0xbbc5('0x2c')]);_0x5b4a75[_0xbbc5('0x2e')]=_['intersection'](_0x5b4a75[_0xbbc5('0x2f')],_0x5b4a75[_0xbbc5('0x2c')]);_0x8a6822[_0xbbc5('0x30')]=_[_0xbbc5('0x31')](_0x5b4a75['model'],qs[_0xbbc5('0x32')](_0x28e443[_0xbbc5('0x2c')][_0xbbc5('0x32')]));_0x8a6822[_0xbbc5('0x30')]=_0x8a6822[_0xbbc5('0x30')][_0xbbc5('0x33')]?_0x8a6822[_0xbbc5('0x30')]:_0x5b4a75[_0xbbc5('0x2f')];if(!_0x28e443['query']['hasOwnProperty'](_0xbbc5('0x34'))){_0x8a6822[_0xbbc5('0x19')]=qs[_0xbbc5('0x19')](_0x28e443[_0xbbc5('0x2c')][_0xbbc5('0x19')]);_0x8a6822['offset']=qs['offset'](_0x28e443[_0xbbc5('0x2c')][_0xbbc5('0x1b')]);}_0x8a6822[_0xbbc5('0x35')]=qs[_0xbbc5('0x36')](_0x28e443[_0xbbc5('0x2c')][_0xbbc5('0x36')]);_0x8a6822[_0xbbc5('0x37')]=qs[_0xbbc5('0x2e')](_[_0xbbc5('0x38')](_0x28e443[_0xbbc5('0x2c')],_0x5b4a75['filters']),_0x1cbeb6);if(_0x28e443['query'][_0xbbc5('0x39')]){_0x8a6822[_0xbbc5('0x37')]=_[_0xbbc5('0x3a')](_0x8a6822[_0xbbc5('0x37')],{'$or':_[_0xbbc5('0x2b')](_0x1cbeb6,function(_0x108bd1){if(_0x108bd1[_0xbbc5('0x28')]!==_0xbbc5('0x3b')){var _0x1a91ea={};_0x1a91ea[_0x108bd1[_0xbbc5('0x23')]]={'$like':'%'+_0x28e443['query'][_0xbbc5('0x39')]+'%'};return _0x1a91ea;}})});}_0x8a6822=_['merge']({},_0x8a6822,_0x28e443[_0xbbc5('0x3c')]);var _0x7bcfbb={'where':_0x8a6822[_0xbbc5('0x37')]};return db[_0xbbc5('0x26')]['count'](_0x7bcfbb)['then'](function(_0x3df2c4){_0x57534b['count']=_0x3df2c4;if(_0x28e443[_0xbbc5('0x2c')]['includeAll']){_0x8a6822['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xbbc5('0x3d')](_0x8a6822);})[_0xbbc5('0x21')](function(_0x5c486b){_0x57534b['rows']=_0x5c486b;return _0x57534b;})[_0xbbc5('0x21')](respondWithFilteredResult(_0x5e9ed7,_0x8a6822))[_0xbbc5('0x3e')](handleError(_0x5e9ed7,null));};exports[_0xbbc5('0x3f')]=function(_0x40994a,_0x314148){var _0x4d4e44={'raw':!![],'where':{'id':_0x40994a[_0xbbc5('0x40')]['id']}},_0x40d98b={};_0x40d98b[_0xbbc5('0x2f')]=_['keys'](db[_0xbbc5('0x26')][_0xbbc5('0x41')]);_0x40d98b[_0xbbc5('0x2c')]=_[_0xbbc5('0x2d')](_0x40994a['query']);_0x40d98b[_0xbbc5('0x2e')]=_['intersection'](_0x40d98b[_0xbbc5('0x2f')],_0x40d98b['query']);_0x4d4e44[_0xbbc5('0x30')]=_[_0xbbc5('0x31')](_0x40d98b['model'],qs[_0xbbc5('0x32')](_0x40994a[_0xbbc5('0x2c')]['fields']));_0x4d4e44['attributes']=_0x4d4e44[_0xbbc5('0x30')][_0xbbc5('0x33')]?_0x4d4e44[_0xbbc5('0x30')]:_0x40d98b['model'];if(_0x40994a[_0xbbc5('0x2c')][_0xbbc5('0x42')]){_0x4d4e44[_0xbbc5('0x43')]=[{'all':!![]}];}_0x4d4e44=_['merge']({},_0x4d4e44,_0x40994a[_0xbbc5('0x3c')]);return db['VoiceMailMessage'][_0xbbc5('0x44')](_0x4d4e44)[_0xbbc5('0x21')](handleEntityNotFound(_0x314148,null))[_0xbbc5('0x21')](respondWithResult(_0x314148,null))[_0xbbc5('0x3e')](handleError(_0x314148,null));};exports[_0xbbc5('0x45')]=function(_0x2c620c,_0x316d06){return db[_0xbbc5('0x26')][_0xbbc5('0x45')](_0x2c620c['body'],{})[_0xbbc5('0x21')](respondWithResult(_0x316d06,0xc9))[_0xbbc5('0x3e')](handleError(_0x316d06,null));};exports[_0xbbc5('0x46')]=function(_0x3742ae,_0x137b99){if(_0x3742ae['body']['id']){delete _0x3742ae['body']['id'];}return db['VoiceMailMessage'][_0xbbc5('0x44')]({'where':{'id':_0x3742ae[_0xbbc5('0x40')]['id']}})[_0xbbc5('0x21')](handleEntityNotFound(_0x137b99,null))[_0xbbc5('0x21')](saveUpdates(_0x3742ae[_0xbbc5('0x47')],null))['then'](respondWithResult(_0x137b99,null))['catch'](handleError(_0x137b99,null));};exports[_0xbbc5('0x22')]=function(_0x3cf57c,_0x2f4fa9){return db[_0xbbc5('0x26')]['find']({'where':{'id':_0x3cf57c['params']['id']}})[_0xbbc5('0x21')](handleEntityNotFound(_0x2f4fa9,null))[_0xbbc5('0x21')](removeEntity(_0x2f4fa9,null))[_0xbbc5('0x3e')](handleError(_0x2f4fa9,null));};exports['download']=function(_0x55380,_0x619529,_0x25a566){return db['VoiceMailMessage'][_0xbbc5('0x44')]({'where':{'id':_0x55380[_0xbbc5('0x40')]['id']},'attributes':['id',_0xbbc5('0x48'),_0xbbc5('0x49')]})[_0xbbc5('0x21')](handleEntityNotFound(_0x619529,null))[_0xbbc5('0x21')](function(_0x2106bd){if(_0x2106bd){if(!_0x2106bd['recording']){throw new db[(_0xbbc5('0x4a'))][(_0xbbc5('0x4b'))](_0xbbc5('0x4c'));}var _0x144692={'Content-Type':_0xbbc5('0x4d'),'Content-Disposition':_0xbbc5('0x4e')};if(_0x2106bd[_0xbbc5('0x49')]){_0x144692[_0xbbc5('0x4f')]='attachment;\x20filename=\x22'+_0x2106bd[_0xbbc5('0x49')]+_0xbbc5('0x50');}_0x619529['set'](_0x144692);return _0x619529[_0xbbc5('0x24')](new Buffer(_0x2106bd['recording']));}})['catch'](handleError(_0x619529,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e6ec038..a48323e 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 _0xe90a=['api','bluebird','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','util','../../config/logger'];(function(_0x310536,_0x164ff5){var _0x35351c=function(_0x1d0222){while(--_0x1d0222){_0x310536['push'](_0x310536['shift']());}};_0x35351c(++_0x164ff5);}(_0xe90a,0x1a5));var _0xae90=function(_0x40dcbd,_0x1a9fe5){_0x40dcbd=_0x40dcbd-0x0;var _0x1ec7d5=_0xe90a[_0x40dcbd];return _0x1ec7d5;};'use strict';var _=require('lodash');var util=require(_0xae90('0x0'));var logger=require(_0xae90('0x1'))(_0xae90('0x2'));var moment=require('moment');var BPromise=require(_0xae90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae90('0x4'));var attributes=require(_0xae90('0x5'));module['exports']=function(_0x136e57,_0x5478a7){return _0x136e57[_0xae90('0x6')](_0xae90('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xae90('0x8'),'fields':[_0xae90('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9877=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0x9877,0xa1));var _0x7987=function(_0x573812,_0x461e72){_0x573812=_0x573812-0x0;var _0x1c7fb9=_0x9877[_0x573812];return _0x1c7fb9;};'use strict';var _=require(_0x7987('0x0'));var util=require(_0x7987('0x1'));var logger=require(_0x7987('0x2'))('api');var moment=require(_0x7987('0x3'));var BPromise=require(_0x7987('0x4'));var rp=require(_0x7987('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7987('0x6'));var config=require(_0x7987('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x7987('0x8')]=function(_0x24ce9b,_0x35d859){return _0x24ce9b[_0x7987('0x9')](_0x7987('0xa'),attributes,{'tableName':_0x7987('0xb'),'paranoid':![],'indexes':[{'name':_0x7987('0xc'),'fields':[_0x7987('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 765f723..269fee2 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 _0x222d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x23b55d,_0xe187a8){var _0x30b307=function(_0x57d167){while(--_0x57d167){_0x23b55d['push'](_0x23b55d['shift']());}};_0x30b307(++_0xe187a8);}(_0x222d,0x165));var _0xd222=function(_0x3cf215,_0x5e1b3f){_0x3cf215=_0x3cf215-0x0;var _0x39cdb5=_0x222d[_0x3cf215];return _0x39cdb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd222('0x0'));var BPromise=require(_0xd222('0x1'));var rs=require(_0xd222('0x2'));var fs=require('fs');var Redis=require(_0xd222('0x3'));var db=require(_0xd222('0x4'))['db'];var utils=require(_0xd222('0x5'));var logger=require(_0xd222('0x6'))('rpc');var config=require(_0xd222('0x7'));var jayson=require(_0xd222('0x8'));var client=jayson['client'][_0xd222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36962c,_0x500b9b,_0x1cdf9c){return new BPromise(function(_0x4b2bd5,_0x5e979f){return client[_0xd222('0xa')](_0x36962c,_0x1cdf9c)[_0xd222('0xb')](function(_0x47aa67){logger[_0xd222('0xc')](_0xd222('0xd'),_0x500b9b,_0xd222('0xe'));logger[_0xd222('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x500b9b,_0xd222('0xe'),JSON['stringify'](_0x47aa67));if(_0x47aa67[_0xd222('0x10')]){if(_0x47aa67[_0xd222('0x10')][_0xd222('0x11')]===0x1f4){logger['error'](_0xd222('0xd'),_0x500b9b,_0x47aa67[_0xd222('0x10')][_0xd222('0x12')]);return _0x5e979f(_0x47aa67['error'][_0xd222('0x12')]);}logger[_0xd222('0x10')](_0xd222('0xd'),_0x500b9b,_0x47aa67[_0xd222('0x10')]['message']);return _0x4b2bd5(_0x47aa67[_0xd222('0x10')][_0xd222('0x12')]);}else{logger[_0xd222('0xc')](_0xd222('0xd'),_0x500b9b,_0xd222('0xe'));_0x4b2bd5(_0x47aa67[_0xd222('0x13')][_0xd222('0x12')]);}})[_0xd222('0x14')](function(_0x33b711){logger['error'](_0xd222('0xd'),_0x500b9b,_0x33b711);_0x5e979f(_0x33b711);});});} \ No newline at end of file +var _0xac02=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xac02,0x111));var _0x2ac0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xac02[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ac0('0x0'));var BPromise=require('bluebird');var rs=require(_0x2ac0('0x1'));var fs=require('fs');var Redis=require(_0x2ac0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ac0('0x3'));var logger=require(_0x2ac0('0x4'))(_0x2ac0('0x5'));var config=require(_0x2ac0('0x6'));var jayson=require(_0x2ac0('0x7'));var client=jayson[_0x2ac0('0x8')][_0x2ac0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x78c48c,_0x44e8da,_0x352b7f){return new BPromise(function(_0x483939,_0x33646b){return client[_0x2ac0('0xa')](_0x78c48c,_0x352b7f)[_0x2ac0('0xb')](function(_0x35c0d7){logger[_0x2ac0('0xc')](_0x2ac0('0xd'),_0x44e8da,_0x2ac0('0xe'));logger[_0x2ac0('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x44e8da,_0x2ac0('0xe'),JSON[_0x2ac0('0x10')](_0x35c0d7));if(_0x35c0d7['error']){if(_0x35c0d7[_0x2ac0('0x11')][_0x2ac0('0x12')]===0x1f4){logger[_0x2ac0('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x44e8da,_0x35c0d7[_0x2ac0('0x11')][_0x2ac0('0x13')]);return _0x33646b(_0x35c0d7[_0x2ac0('0x11')][_0x2ac0('0x13')]);}logger[_0x2ac0('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x44e8da,_0x35c0d7['error'][_0x2ac0('0x13')]);return _0x483939(_0x35c0d7['error'][_0x2ac0('0x13')]);}else{logger['info'](_0x2ac0('0xd'),_0x44e8da,'request\x20sent');_0x483939(_0x35c0d7['result']['message']);}})[_0x2ac0('0x14')](function(_0x3f8535){logger[_0x2ac0('0x11')](_0x2ac0('0xd'),_0x44e8da,_0x3f8535);_0x33646b(_0x3f8535);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 091ad13..fb27924 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 _0xa0d5=['get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','addSound','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x816552,_0x2672d2){var _0xa21977=function(_0x47fb45){while(--_0x47fb45){_0x816552['push'](_0x816552['shift']());}};_0xa21977(++_0x2672d2);}(_0xa0d5,0xff));var _0x5a0d=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0xa0d5[_0x2a8c21];return _0x5f3061;};'use strict';var multer=require(_0x5a0d('0x0'));var util=require(_0x5a0d('0x1'));var path=require(_0x5a0d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a0d('0x3'));var router=express[_0x5a0d('0x4')]();var fs_extra=require(_0x5a0d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a0d('0x6'));var config=require(_0x5a0d('0x7'));var controller=require(_0x5a0d('0x8'));router[_0x5a0d('0x9')]('/',auth['isAuthenticated'](),controller[_0x5a0d('0xa')]);router['get'](_0x5a0d('0xb'),auth[_0x5a0d('0xc')](),controller[_0x5a0d('0xd')]);router[_0x5a0d('0x9')](_0x5a0d('0xe'),auth['isAuthenticated'](),controller[_0x5a0d('0xf')]);router[_0x5a0d('0x10')]('/',auth[_0x5a0d('0xc')](),controller['create']);router[_0x5a0d('0x10')](_0x5a0d('0xe'),auth[_0x5a0d('0xc')](),controller[_0x5a0d('0x11')]);router[_0x5a0d('0x12')](_0x5a0d('0xb'),auth[_0x5a0d('0xc')](),controller[_0x5a0d('0x13')]);router[_0x5a0d('0x14')](_0x5a0d('0xb'),auth[_0x5a0d('0xc')](),controller['destroy']);router['delete']('/:id/sounds/:id2',auth[_0x5a0d('0xc')](),controller['removeSound']);module[_0x5a0d('0x15')]=router; \ No newline at end of file +var _0x4d8e=['addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/sounds','post'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x4d8e,0x10c));var _0xe4d8=function(_0x15ede7,_0x3b6c6f){_0x15ede7=_0x15ede7-0x0;var _0x3f46bd=_0x4d8e[_0x15ede7];return _0x3f46bd;};'use strict';var multer=require(_0xe4d8('0x0'));var util=require('util');var path=require(_0xe4d8('0x1'));var timeout=require(_0xe4d8('0x2'));var express=require('express');var router=express[_0xe4d8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe4d8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xe4d8('0x5')]('/',auth[_0xe4d8('0x6')](),controller[_0xe4d8('0x7')]);router[_0xe4d8('0x5')](_0xe4d8('0x8'),auth['isAuthenticated'](),controller[_0xe4d8('0x9')]);router['get'](_0xe4d8('0xa'),auth[_0xe4d8('0x6')](),controller['getSounds']);router[_0xe4d8('0xb')]('/',auth[_0xe4d8('0x6')](),controller['create']);router[_0xe4d8('0xb')]('/:id/sounds',auth[_0xe4d8('0x6')](),controller[_0xe4d8('0xc')]);router[_0xe4d8('0xd')](_0xe4d8('0x8'),auth[_0xe4d8('0x6')](),controller[_0xe4d8('0xe')]);router[_0xe4d8('0xf')](_0xe4d8('0x8'),auth['isAuthenticated'](),controller[_0xe4d8('0x10')]);router['delete'](_0xe4d8('0x11'),auth[_0xe4d8('0x6')](),controller[_0xe4d8('0x12')]);module[_0xe4d8('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5b03b08..3f3afdf 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 _0x795a=['BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb','quietmp3nb','mp3','TIMESTAMP'];(function(_0x2b1b6d,_0x517c89){var _0x422682=function(_0x215ce4){while(--_0x215ce4){_0x2b1b6d['push'](_0x2b1b6d['shift']());}};_0x422682(++_0x517c89);}(_0x795a,0xd2));var _0xa795=function(_0x3674dd,_0x4a636b){_0x3674dd=_0x3674dd-0x0;var _0x3b2bbc=_0x795a[_0x3674dd];return _0x3b2bbc;};'use strict';var Sequelize=require(_0xa795('0x0'));module[_0xa795('0x1')]={'name':{'type':Sequelize[_0xa795('0x2')],'allowNull':![],'unique':_0xa795('0x3')},'mode':{'type':Sequelize['ENUM'](_0xa795('0x4'),_0xa795('0x5'),_0xa795('0x6'),_0xa795('0x7'),'quietmp3',_0xa795('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xa795('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa795('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa795('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa795('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xa795('0x2')],'allowNull':!![]},'stamp':{'type':_0xa795('0x9')},'defaultEntry':{'type':Sequelize[_0xa795('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd6e4=['files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','ENUM','custom'];(function(_0x264799,_0x140dd9){var _0x10a45d=function(_0x1c7cfa){while(--_0x1c7cfa){_0x264799['push'](_0x264799['shift']());}};_0x10a45d(++_0x140dd9);}(_0xd6e4,0x1be));var _0x4d6e=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd6e4[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0x4d6e('0x0'));module[_0x4d6e('0x1')]={'name':{'type':Sequelize[_0x4d6e('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x4d6e('0x3')](_0x4d6e('0x4'),_0x4d6e('0x5'),_0x4d6e('0x6'),'quietmp3nb',_0x4d6e('0x7'),_0x4d6e('0x8')),'allowNull':!![],'defaultValue':_0x4d6e('0x5')},'directory':{'type':Sequelize[_0x4d6e('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x4d6e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4d6e('0x2')],'allowNull':!![],'defaultValue':_0x4d6e('0x9')},'format':{'type':Sequelize[_0x4d6e('0x2')],'allowNull':!![]},'stamp':{'type':_0x4d6e('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 502844a..686502b 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 _0x3d59=['pick','merge','options','includeAll','include','show','params','find','update','body','create','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','Sound','getSounds','filter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','get','MusicOnHolds','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x3d59,0xa3));var _0x93d5=function(_0x54955d,_0x1efffb){_0x54955d=_0x54955d-0x0;var _0x329d36=_0x3d59[_0x54955d];return _0x329d36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93d5('0x0'));var zipdir=require(_0x93d5('0x1'));var jsonpatch=require(_0x93d5('0x2'));var rp=require(_0x93d5('0x3'));var moment=require(_0x93d5('0x4'));var BPromise=require(_0x93d5('0x5'));var Mustache=require(_0x93d5('0x6'));var util=require(_0x93d5('0x7'));var path=require(_0x93d5('0x8'));var sox=require(_0x93d5('0x9'));var csv=require(_0x93d5('0xa'));var ejs=require(_0x93d5('0xb'));var fs=require('fs');var fs_extra=require(_0x93d5('0xc'));var _=require(_0x93d5('0xd'));var squel=require(_0x93d5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x93d5('0xf'));var Papa=require(_0x93d5('0x10'));var Redis=require(_0x93d5('0x11'));var authService=require(_0x93d5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x93d5('0x13'));var hardwareService=require(_0x93d5('0x14'));var logger=require(_0x93d5('0x15'))(_0x93d5('0x16'));var utils=require(_0x93d5('0x17'));var config=require(_0x93d5('0x18'));var licenseUtil=require(_0x93d5('0x19'));var db=require(_0x93d5('0x1a'))['db'];function respondWithStatusCode(_0x2f38ff,_0x57dd14){_0x57dd14=_0x57dd14||0xcc;return function(_0x3889c5){if(_0x3889c5){return _0x2f38ff['sendStatus'](_0x57dd14);}return _0x2f38ff['status'](_0x57dd14)[_0x93d5('0x1b')]();};}function respondWithResult(_0x1a50f0,_0x477ba9){_0x477ba9=_0x477ba9||0xc8;return function(_0x19c739){if(_0x19c739){return _0x1a50f0[_0x93d5('0x1c')](_0x477ba9)['json'](_0x19c739);}};}function respondWithFilteredResult(_0x4dbd38,_0x5a5f2a){return function(_0x57e499){if(_0x57e499){var _0x61f664=typeof _0x5a5f2a[_0x93d5('0x1d')]===_0x93d5('0x1e')&&typeof _0x5a5f2a[_0x93d5('0x1f')]===_0x93d5('0x1e');var _0xea69d4=_0x57e499[_0x93d5('0x20')];var _0x51e564=_0x61f664?0x0:_0x5a5f2a[_0x93d5('0x1d')];var _0x45a78e=_0x61f664?_0x57e499[_0x93d5('0x20')]:_0x5a5f2a['offset']+_0x5a5f2a['limit'];var _0x260dde;if(_0x45a78e>=_0xea69d4){_0x45a78e=_0xea69d4;_0x260dde=0xc8;}else{_0x260dde=0xce;}_0x4dbd38[_0x93d5('0x1c')](_0x260dde);return _0x4dbd38['set'](_0x93d5('0x21'),_0x51e564+'-'+_0x45a78e+'/'+_0xea69d4)[_0x93d5('0x22')](_0x57e499);}return null;};}function patchUpdates(_0x3a619e){return function(_0x33b02a){try{jsonpatch[_0x93d5('0x23')](_0x33b02a,_0x3a619e,!![]);}catch(_0x592aec){return BPromise[_0x93d5('0x24')](_0x592aec);}return _0x33b02a[_0x93d5('0x25')]();};}function saveUpdates(_0x115f3d,_0xf1eb4d){return function(_0x1949a4){if(_0x1949a4){return _0x1949a4['update'](_0x115f3d)[_0x93d5('0x26')](function(_0x284a9b){return _0x284a9b;});}return null;};}function removeEntity(_0x958549,_0x6d1877){return function(_0x4527aa){if(_0x4527aa){return _0x4527aa[_0x93d5('0x27')]()[_0x93d5('0x26')](function(){var _0x26063c=_0x4527aa[_0x93d5('0x28')]({'plain':!![]});var _0x5e6db5=_0x93d5('0x29');return db['UserProfileResource'][_0x93d5('0x27')]({'where':{'type':_0x5e6db5,'resourceId':_0x26063c['id']}})['then'](function(){return _0x4527aa;});})['then'](function(){_0x958549['status'](0xcc)[_0x93d5('0x1b')]();});}};}function handleEntityNotFound(_0xf71c2f,_0x17baf9){return function(_0x10c522){if(!_0x10c522){_0xf71c2f[_0x93d5('0x2a')](0x194);}return _0x10c522;};}function handleError(_0x4566b3,_0x5dec41){_0x5dec41=_0x5dec41||0x1f4;return function(_0x24754e){logger[_0x93d5('0x2b')](_0x24754e[_0x93d5('0x2c')]);if(_0x24754e[_0x93d5('0x2d')]){delete _0x24754e[_0x93d5('0x2d')];}_0x4566b3['status'](_0x5dec41)[_0x93d5('0x2e')](_0x24754e);};}exports[_0x93d5('0x2f')]=function(_0x1a7b24,_0x317bc4){var _0x3e2e9f={},_0x9252dc={},_0x5b5d40={'count':0x0,'rows':[]};var _0xfa101c=_[_0x93d5('0x30')](db[_0x93d5('0x31')][_0x93d5('0x32')],function(_0x4d46ad){return{'name':_0x4d46ad[_0x93d5('0x33')],'type':_0x4d46ad[_0x93d5('0x34')][_0x93d5('0x35')]};});_0x9252dc['model']=_[_0x93d5('0x30')](_0xfa101c,'name');_0x9252dc[_0x93d5('0x36')]=_[_0x93d5('0x37')](_0x1a7b24[_0x93d5('0x36')]);_0x9252dc[_0x93d5('0x38')]=_[_0x93d5('0x39')](_0x9252dc[_0x93d5('0x3a')],_0x9252dc['query']);_0x3e2e9f['attributes']=_['intersection'](_0x9252dc['model'],qs[_0x93d5('0x3b')](_0x1a7b24[_0x93d5('0x36')][_0x93d5('0x3b')]));_0x3e2e9f['attributes']=_0x3e2e9f[_0x93d5('0x3c')][_0x93d5('0x3d')]?_0x3e2e9f['attributes']:_0x9252dc[_0x93d5('0x3a')];if(!_0x1a7b24[_0x93d5('0x36')][_0x93d5('0x3e')](_0x93d5('0x3f'))){_0x3e2e9f[_0x93d5('0x1f')]=qs[_0x93d5('0x1f')](_0x1a7b24['query']['limit']);_0x3e2e9f['offset']=qs[_0x93d5('0x1d')](_0x1a7b24['query'][_0x93d5('0x1d')]);}_0x3e2e9f[_0x93d5('0x40')]=qs[_0x93d5('0x41')](_0x1a7b24['query'][_0x93d5('0x41')]);delete _0x1a7b24[_0x93d5('0x36')][_0x93d5('0x41')];_0x3e2e9f[_0x93d5('0x42')]=qs[_0x93d5('0x38')](_[_0x93d5('0x43')](_0x1a7b24[_0x93d5('0x36')],_0x9252dc['filters']),_0xfa101c);if(_0x1a7b24[_0x93d5('0x36')]['filter']){_0x3e2e9f[_0x93d5('0x42')]=_[_0x93d5('0x44')](_0x3e2e9f[_0x93d5('0x42')],{'$or':_[_0x93d5('0x30')](_0xfa101c,function(_0xd9c7f2){if(_0xd9c7f2[_0x93d5('0x34')]!=='VIRTUAL'){var _0x12879a={};_0x12879a[_0xd9c7f2[_0x93d5('0x2d')]]={'$like':'%'+_0x1a7b24[_0x93d5('0x36')]['filter']+'%'};return _0x12879a;}})});}_0x3e2e9f=_[_0x93d5('0x44')]({},_0x3e2e9f,_0x1a7b24[_0x93d5('0x45')]);var _0x4a0994={'where':_0x3e2e9f[_0x93d5('0x42')]};return db[_0x93d5('0x31')][_0x93d5('0x20')](_0x4a0994)[_0x93d5('0x26')](function(_0x36c4e2){_0x5b5d40['count']=_0x36c4e2;if(_0x1a7b24['query'][_0x93d5('0x46')]){_0x3e2e9f[_0x93d5('0x47')]=[{'all':!![]}];}return db[_0x93d5('0x31')]['findAll'](_0x3e2e9f);})[_0x93d5('0x26')](function(_0x21540b){_0x5b5d40['rows']=_0x21540b;return _0x5b5d40;})[_0x93d5('0x26')](respondWithFilteredResult(_0x317bc4,_0x3e2e9f))['catch'](handleError(_0x317bc4,null));};exports[_0x93d5('0x48')]=function(_0xad06ad,_0x4e49e0){var _0x1cb1f0={'raw':![],'where':{'id':_0xad06ad[_0x93d5('0x49')]['id']}},_0xab25b3={};_0xab25b3[_0x93d5('0x3a')]=_['keys'](db[_0x93d5('0x31')][_0x93d5('0x32')]);_0xab25b3[_0x93d5('0x36')]=_[_0x93d5('0x37')](_0xad06ad[_0x93d5('0x36')]);_0xab25b3['filters']=_[_0x93d5('0x39')](_0xab25b3[_0x93d5('0x3a')],_0xab25b3[_0x93d5('0x36')]);_0x1cb1f0['attributes']=_[_0x93d5('0x39')](_0xab25b3['model'],qs[_0x93d5('0x3b')](_0xad06ad['query'][_0x93d5('0x3b')]));_0x1cb1f0[_0x93d5('0x3c')]=_0x1cb1f0[_0x93d5('0x3c')]['length']?_0x1cb1f0[_0x93d5('0x3c')]:_0xab25b3[_0x93d5('0x3a')];if(_0xad06ad['query']['includeAll']){_0x1cb1f0[_0x93d5('0x47')]=[{'all':!![]}];}_0x1cb1f0=_[_0x93d5('0x44')]({},_0x1cb1f0,_0xad06ad[_0x93d5('0x45')]);return db[_0x93d5('0x31')][_0x93d5('0x4a')](_0x1cb1f0)[_0x93d5('0x26')](handleEntityNotFound(_0x4e49e0,null))['then'](respondWithResult(_0x4e49e0,null))['catch'](handleError(_0x4e49e0,null));};exports[_0x93d5('0x4b')]=function(_0x15862a,_0x5ef1c5){if(_0x15862a[_0x93d5('0x4c')]['id']){delete _0x15862a[_0x93d5('0x4c')]['id'];}return db[_0x93d5('0x31')][_0x93d5('0x4a')]({'where':{'id':_0x15862a[_0x93d5('0x49')]['id']}})[_0x93d5('0x26')](handleEntityNotFound(_0x5ef1c5,null))[_0x93d5('0x26')](saveUpdates(_0x15862a[_0x93d5('0x4c')],null))[_0x93d5('0x26')](respondWithResult(_0x5ef1c5,null))['catch'](handleError(_0x5ef1c5,null));};exports[_0x93d5('0x4d')]=function(_0x15cbb9,_0xad178a,_0x3f1043){return db['sequelize'][_0x93d5('0x4e')](function(_0x9b0af3){if(_0x15cbb9[_0x93d5('0x4c')]['mode']===_0x93d5('0x4f')){_0x15cbb9['body'][_0x93d5('0x50')]=path[_0x93d5('0x51')](config[_0x93d5('0x52')],_0x93d5('0x53'),_0x15cbb9['body'][_0x93d5('0x2d')]);}return db[_0x93d5('0x31')][_0x93d5('0x4d')](_0x15cbb9[_0x93d5('0x4c')],{'transaction':_0x9b0af3})['then'](function(_0x376684){if(_0x15cbb9[_0x93d5('0x4c')][_0x93d5('0x54')]===_0x93d5('0x4f')){fs[_0x93d5('0x55')](_0x376684[_0x93d5('0x50')],parseInt(_0x93d5('0x56'),0x8));}var _0x1757d1=_0x15cbb9['user'][_0x93d5('0x28')]({'plain':!![]});if(!_0x1757d1)throw new Error(_0x93d5('0x57'));if(_0x1757d1['role']==='user'){var _0x599386=_0x376684[_0x93d5('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x93d5('0x4a')]({'where':{'name':_0x93d5('0x29'),'userProfileId':_0x1757d1[_0x93d5('0x58')]},'raw':!![]})[_0x93d5('0x26')](function(_0x16620c){if(_0x16620c&&_0x16620c[_0x93d5('0x59')]===0x0){return db['UserProfileResource'][_0x93d5('0x4d')]({'name':_0x599386['name'],'resourceId':_0x599386['id'],'type':_0x16620c[_0x93d5('0x2d')],'sectionId':_0x16620c['id']},{})[_0x93d5('0x26')](function(){return _0x376684;});}else{return _0x376684;}})[_0x93d5('0x5a')](function(_0xa7deb9){logger[_0x93d5('0x2b')](_0x93d5('0x5b'),_0xa7deb9);});}return _0x376684;});})[_0x93d5('0x26')](respondWithResult(_0xad178a,0xc9))[_0x93d5('0x5a')](handleError(_0xad178a,null));};exports[_0x93d5('0x27')]=function(_0x292466,_0x2d4e64,_0x4d6e03){var _0x4ec760;return db['VoiceMusicOnHold'][_0x93d5('0x4a')]({'where':{'id':_0x292466[_0x93d5('0x49')]['id']}})[_0x93d5('0x26')](function(_0x508d45){if(_0x508d45){return db[_0x93d5('0x5c')][_0x93d5('0x4e')](function(_0x52a29e){return _0x508d45[_0x93d5('0x27')]({'transaction':_0x52a29e,'raw':!![]})[_0x93d5('0x26')](function(_0x4040be){if(_0x4040be['directory']){fs[_0x93d5('0x5d')](_0x4040be[_0x93d5('0x50')])['forEach'](function(_0x432b94){fs[_0x93d5('0x5e')](path[_0x93d5('0x51')](_0x4040be[_0x93d5('0x50')],_0x432b94));});fs[_0x93d5('0x5f')](_0x4040be[_0x93d5('0x50')]);}return _0x4040be;});})[_0x93d5('0x5a')](function(_0x4b7f17){throw new db[(_0x93d5('0x60'))][(_0x93d5('0x61'))](_0x4b7f17['message']);});}})[_0x93d5('0x26')](handleEntityNotFound(_0x2d4e64,null))['then'](removeEntity(_0x2d4e64,null))['catch'](handleError(_0x2d4e64,null));};exports[_0x93d5('0x62')]=function(_0x22e831,_0x5ba039,_0x4497de){return db[_0x93d5('0x5c')][_0x93d5('0x4e')](function(_0x55c515){var _0x2e9005;return db[_0x93d5('0x31')]['find']({'where':{'id':_0x22e831[_0x93d5('0x49')]['id']}})[_0x93d5('0x26')](function(_0x2cc64f){if(_0x2cc64f){_0x2e9005=_0x2cc64f;return _0x2cc64f[_0x93d5('0x62')](_0x22e831[_0x93d5('0x4c')]['id'],{'transaction':_0x55c515});}})[_0x93d5('0x26')](function(_0x1b1b17){if(_0x1b1b17){return db['Sound'][_0x93d5('0x63')]({'where':{'id':_0x22e831[_0x93d5('0x4c')]['id']},'attributes':['id','name',_0x93d5('0x64'),_0x93d5('0x65'),_0x93d5('0x66')],'raw':!![]});}})[_0x93d5('0x26')](function(_0x285c40){if(_0x285c40){var _0x473b5b=path[_0x93d5('0x51')](config['root'],_0x93d5('0x67'),util[_0x93d5('0x68')](_0x93d5('0x69'),path[_0x93d5('0x6a')](_0x285c40['save_name'],path[_0x93d5('0x6b')](_0x285c40[_0x93d5('0x64')])),_0x285c40[_0x93d5('0x65')]));var _0x392d47=path[_0x93d5('0x51')](config[_0x93d5('0x52')],_0x93d5('0x53'),_0x2e9005[_0x93d5('0x2d')],util[_0x93d5('0x68')](_0x93d5('0x69'),_0x285c40[_0x93d5('0x2d')],_0x285c40['converted_format']));fs[_0x93d5('0x6c')](_0x473b5b,_0x392d47);return _0x285c40;}})[_0x93d5('0x5a')](function(_0x4c7ff2){throw new db[(_0x93d5('0x60'))][(_0x93d5('0x61'))](_0x4c7ff2[_0x93d5('0x6d')]);});})['then'](handleEntityNotFound(_0x5ba039,null))[_0x93d5('0x26')](respondWithResult(_0x5ba039,0xc9))['catch'](handleError(_0x5ba039,null));};exports['removeSound']=function(_0x33435b,_0x2b02cf,_0xff96a4){return db[_0x93d5('0x5c')][_0x93d5('0x4e')](function(_0x2e6010){var _0x51427f;return db['VoiceMusicOnHold'][_0x93d5('0x63')]({'where':{'id':_0x33435b[_0x93d5('0x49')]['id']}})[_0x93d5('0x26')](handleEntityNotFound(_0x2b02cf,null))[_0x93d5('0x26')](function(_0x151af4){if(_0x151af4){_0x51427f=_0x151af4;return _0x151af4[_0x93d5('0x6e')](_0x33435b[_0x93d5('0x49')][_0x93d5('0x6f')]);}})['then'](function(_0x34690c){if(_0x34690c){return db[_0x93d5('0x70')][_0x93d5('0x63')]({'where':{'id':_0x33435b['params'][_0x93d5('0x6f')]},'attributes':['id',_0x93d5('0x2d'),_0x93d5('0x64'),_0x93d5('0x65'),'createdAt'],'raw':!![]});}})[_0x93d5('0x26')](function(_0x55af5c){if(_0x55af5c){fs[_0x93d5('0x5e')](path[_0x93d5('0x51')](_0x51427f[_0x93d5('0x50')],util['format'](_0x93d5('0x69'),_0x55af5c[_0x93d5('0x2d')],_0x55af5c['converted_format'])));return _0x55af5c;}})['catch'](function(_0x45caff){throw new db['Sequelize'][(_0x93d5('0x61'))](_0x45caff[_0x93d5('0x6d')]);});})['then'](handleEntityNotFound(_0x2b02cf,null))[_0x93d5('0x26')](respondWithStatusCode(_0x2b02cf,0xcc))['catch'](handleError(_0x2b02cf,null));};exports[_0x93d5('0x71')]=function(_0x51f7d9,_0x5573d1,_0x140d23){var _0x58da24={};var _0x115064={};var _0x530323;var _0x5286b3;return db[_0x93d5('0x31')][_0x93d5('0x63')]({'where':{'id':_0x51f7d9[_0x93d5('0x49')]['id']}})[_0x93d5('0x26')](handleEntityNotFound(_0x5573d1,null))['then'](function(_0xf53cbc){if(_0xf53cbc){_0x530323=_0xf53cbc;_0x115064[_0x93d5('0x3a')]=_[_0x93d5('0x37')](db[_0x93d5('0x70')][_0x93d5('0x32')]);_0x115064[_0x93d5('0x36')]=_[_0x93d5('0x37')](_0x51f7d9['query']);_0x115064[_0x93d5('0x38')]=_[_0x93d5('0x39')](_0x115064[_0x93d5('0x3a')],_0x115064['query']);_0x58da24[_0x93d5('0x3c')]=_[_0x93d5('0x39')](_0x115064[_0x93d5('0x3a')],qs[_0x93d5('0x3b')](_0x51f7d9[_0x93d5('0x36')][_0x93d5('0x3b')]));_0x58da24[_0x93d5('0x3c')]=_0x58da24[_0x93d5('0x3c')]['length']?_0x58da24['attributes']:_0x115064['model'];_0x58da24['order']=qs[_0x93d5('0x41')](_0x51f7d9[_0x93d5('0x36')][_0x93d5('0x41')]);_0x58da24[_0x93d5('0x42')]=qs[_0x93d5('0x38')](_[_0x93d5('0x43')](_0x51f7d9[_0x93d5('0x36')],_0x115064[_0x93d5('0x38')]));if(_0x51f7d9[_0x93d5('0x36')][_0x93d5('0x72')]){_0x58da24[_0x93d5('0x42')]=_[_0x93d5('0x44')](_0x58da24['where'],{'$or':_[_0x93d5('0x30')](_0x58da24[_0x93d5('0x3c')],function(_0x245022){var _0x21a3ef={};_0x21a3ef[_0x245022]={'$like':'%'+_0x51f7d9[_0x93d5('0x36')]['filter']+'%'};return _0x21a3ef;})});}_0x58da24=_['merge']({},_0x58da24,_0x51f7d9[_0x93d5('0x45')]);return _0x530323['getSounds'](_0x58da24);}})[_0x93d5('0x26')](function(_0x25aaf4){if(_0x25aaf4){_0x5286b3=_0x25aaf4[_0x93d5('0x3d')];if(!_0x51f7d9[_0x93d5('0x36')][_0x93d5('0x3e')](_0x93d5('0x3f'))){_0x58da24['limit']=qs['limit'](_0x51f7d9['query'][_0x93d5('0x1f')]);_0x58da24[_0x93d5('0x1d')]=qs[_0x93d5('0x1d')](_0x51f7d9[_0x93d5('0x36')][_0x93d5('0x1d')]);}return _0x530323['getSounds'](_0x58da24);}})[_0x93d5('0x26')](function(_0x9ad034){if(_0x9ad034){return _0x9ad034?{'count':_0x5286b3,'rows':_0x9ad034}:null;}})[_0x93d5('0x26')](respondWithResult(_0x5573d1,null))[_0x93d5('0x5a')](handleError(_0x5573d1,null));}; \ No newline at end of file +var _0xdf81=['mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','Sequelize','removeSound','id2','unlinkSync','attributes','getSounds','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','options','find','catch','body','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files'];(function(_0x4130d1,_0x314d60){var _0x314572=function(_0x180294){while(--_0x180294){_0x4130d1['push'](_0x4130d1['shift']());}};_0x314572(++_0x314d60);}(_0xdf81,0x17e));var _0x1df8=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xdf81[_0x19b3f9];return _0x18c3f6;};'use strict';var emlformat=require(_0x1df8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1df8('0x1'));var jsonpatch=require(_0x1df8('0x2'));var rp=require('request-promise');var moment=require(_0x1df8('0x3'));var BPromise=require(_0x1df8('0x4'));var Mustache=require('mustache');var util=require(_0x1df8('0x5'));var path=require('path');var sox=require(_0x1df8('0x6'));var csv=require(_0x1df8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1df8('0x8'));var _=require(_0x1df8('0x9'));var squel=require('squel');var crypto=require(_0x1df8('0xa'));var jsforce=require(_0x1df8('0xb'));var deskjs=require(_0x1df8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1df8('0xd'));var Papa=require(_0x1df8('0xe'));var Redis=require(_0x1df8('0xf'));var authService=require(_0x1df8('0x10'));var qs=require(_0x1df8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1df8('0x12'));var logger=require(_0x1df8('0x13'))(_0x1df8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1df8('0x15'));var db=require(_0x1df8('0x16'))['db'];function respondWithStatusCode(_0x534012,_0x5d42d1){_0x5d42d1=_0x5d42d1||0xcc;return function(_0x2f5f5d){if(_0x2f5f5d){return _0x534012[_0x1df8('0x17')](_0x5d42d1);}return _0x534012[_0x1df8('0x18')](_0x5d42d1)[_0x1df8('0x19')]();};}function respondWithResult(_0x2997ba,_0x333e5c){_0x333e5c=_0x333e5c||0xc8;return function(_0x1369dd){if(_0x1369dd){return _0x2997ba[_0x1df8('0x18')](_0x333e5c)['json'](_0x1369dd);}};}function respondWithFilteredResult(_0x323f49,_0x26a253){return function(_0x3f83d3){if(_0x3f83d3){var _0x2a1ecd=typeof _0x26a253['offset']===_0x1df8('0x1a')&&typeof _0x26a253['limit']===_0x1df8('0x1a');var _0x12f730=_0x3f83d3[_0x1df8('0x1b')];var _0x476adb=_0x2a1ecd?0x0:_0x26a253[_0x1df8('0x1c')];var _0x28d613=_0x2a1ecd?_0x3f83d3[_0x1df8('0x1b')]:_0x26a253['offset']+_0x26a253['limit'];var _0x39fcbb;if(_0x28d613>=_0x12f730){_0x28d613=_0x12f730;_0x39fcbb=0xc8;}else{_0x39fcbb=0xce;}_0x323f49[_0x1df8('0x18')](_0x39fcbb);return _0x323f49[_0x1df8('0x1d')](_0x1df8('0x1e'),_0x476adb+'-'+_0x28d613+'/'+_0x12f730)[_0x1df8('0x1f')](_0x3f83d3);}return null;};}function patchUpdates(_0x154a2d){return function(_0x1965ce){try{jsonpatch[_0x1df8('0x20')](_0x1965ce,_0x154a2d,!![]);}catch(_0x310fe5){return BPromise[_0x1df8('0x21')](_0x310fe5);}return _0x1965ce[_0x1df8('0x22')]();};}function saveUpdates(_0xae3ecc,_0xb4dafb){return function(_0x23f65b){if(_0x23f65b){return _0x23f65b[_0x1df8('0x23')](_0xae3ecc)[_0x1df8('0x24')](function(_0x49a0a2){return _0x49a0a2;});}return null;};}function removeEntity(_0x50f220,_0x345f4d){return function(_0x5948b2){if(_0x5948b2){return _0x5948b2[_0x1df8('0x25')]()[_0x1df8('0x24')](function(){var _0x339007=_0x5948b2[_0x1df8('0x26')]({'plain':!![]});var _0x426061=_0x1df8('0x27');return db[_0x1df8('0x28')][_0x1df8('0x25')]({'where':{'type':_0x426061,'resourceId':_0x339007['id']}})[_0x1df8('0x24')](function(){return _0x5948b2;});})[_0x1df8('0x24')](function(){_0x50f220[_0x1df8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8056,_0x529b27){return function(_0x39a75e){if(!_0x39a75e){_0x5c8056[_0x1df8('0x17')](0x194);}return _0x39a75e;};}function handleError(_0x1f0a34,_0x1ea8c9){_0x1ea8c9=_0x1ea8c9||0x1f4;return function(_0x25d887){logger['error'](_0x25d887[_0x1df8('0x29')]);if(_0x25d887[_0x1df8('0x2a')]){delete _0x25d887[_0x1df8('0x2a')];}_0x1f0a34[_0x1df8('0x18')](_0x1ea8c9)[_0x1df8('0x2b')](_0x25d887);};}exports[_0x1df8('0x2c')]=function(_0x3757c3,_0x3c90f2){var _0x4a3331={},_0x218ddb={},_0x9d785a={'count':0x0,'rows':[]};var _0x3ef20a=_[_0x1df8('0x2d')](db[_0x1df8('0x2e')][_0x1df8('0x2f')],function(_0x22fbbf){return{'name':_0x22fbbf[_0x1df8('0x30')],'type':_0x22fbbf[_0x1df8('0x31')][_0x1df8('0x32')]};});_0x218ddb[_0x1df8('0x33')]=_[_0x1df8('0x2d')](_0x3ef20a,_0x1df8('0x2a'));_0x218ddb[_0x1df8('0x34')]=_[_0x1df8('0x35')](_0x3757c3[_0x1df8('0x34')]);_0x218ddb[_0x1df8('0x36')]=_[_0x1df8('0x37')](_0x218ddb[_0x1df8('0x33')],_0x218ddb[_0x1df8('0x34')]);_0x4a3331['attributes']=_['intersection'](_0x218ddb[_0x1df8('0x33')],qs[_0x1df8('0x38')](_0x3757c3['query'][_0x1df8('0x38')]));_0x4a3331['attributes']=_0x4a3331['attributes'][_0x1df8('0x39')]?_0x4a3331['attributes']:_0x218ddb['model'];if(!_0x3757c3[_0x1df8('0x34')][_0x1df8('0x3a')](_0x1df8('0x3b'))){_0x4a3331[_0x1df8('0x3c')]=qs[_0x1df8('0x3c')](_0x3757c3[_0x1df8('0x34')][_0x1df8('0x3c')]);_0x4a3331[_0x1df8('0x1c')]=qs[_0x1df8('0x1c')](_0x3757c3['query'][_0x1df8('0x1c')]);}_0x4a3331[_0x1df8('0x3d')]=qs[_0x1df8('0x3e')](_0x3757c3[_0x1df8('0x34')]['sort']);delete _0x3757c3[_0x1df8('0x34')][_0x1df8('0x3e')];_0x4a3331[_0x1df8('0x3f')]=qs[_0x1df8('0x36')](_[_0x1df8('0x40')](_0x3757c3['query'],_0x218ddb['filters']),_0x3ef20a);if(_0x3757c3[_0x1df8('0x34')]['filter']){_0x4a3331[_0x1df8('0x3f')]=_[_0x1df8('0x41')](_0x4a3331[_0x1df8('0x3f')],{'$or':_[_0x1df8('0x2d')](_0x3ef20a,function(_0x211ccb){if(_0x211ccb['type']!==_0x1df8('0x42')){var _0x56eb21={};_0x56eb21[_0x211ccb[_0x1df8('0x2a')]]={'$like':'%'+_0x3757c3[_0x1df8('0x34')][_0x1df8('0x43')]+'%'};return _0x56eb21;}})});}_0x4a3331=_[_0x1df8('0x41')]({},_0x4a3331,_0x3757c3['options']);var _0x1e29c9={'where':_0x4a3331['where']};return db[_0x1df8('0x2e')][_0x1df8('0x1b')](_0x1e29c9)['then'](function(_0x3609b2){_0x9d785a[_0x1df8('0x1b')]=_0x3609b2;if(_0x3757c3[_0x1df8('0x34')][_0x1df8('0x44')]){_0x4a3331[_0x1df8('0x45')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x4a3331);})[_0x1df8('0x24')](function(_0x5b16b4){_0x9d785a[_0x1df8('0x46')]=_0x5b16b4;return _0x9d785a;})['then'](respondWithFilteredResult(_0x3c90f2,_0x4a3331))['catch'](handleError(_0x3c90f2,null));};exports[_0x1df8('0x47')]=function(_0x1236dc,_0xff7e21){var _0x4f5dae={'raw':![],'where':{'id':_0x1236dc[_0x1df8('0x48')]['id']}},_0x2b035b={};_0x2b035b[_0x1df8('0x33')]=_['keys'](db['VoiceMusicOnHold'][_0x1df8('0x2f')]);_0x2b035b[_0x1df8('0x34')]=_['keys'](_0x1236dc[_0x1df8('0x34')]);_0x2b035b[_0x1df8('0x36')]=_[_0x1df8('0x37')](_0x2b035b[_0x1df8('0x33')],_0x2b035b['query']);_0x4f5dae['attributes']=_[_0x1df8('0x37')](_0x2b035b[_0x1df8('0x33')],qs[_0x1df8('0x38')](_0x1236dc[_0x1df8('0x34')][_0x1df8('0x38')]));_0x4f5dae['attributes']=_0x4f5dae['attributes'][_0x1df8('0x39')]?_0x4f5dae['attributes']:_0x2b035b[_0x1df8('0x33')];if(_0x1236dc[_0x1df8('0x34')][_0x1df8('0x44')]){_0x4f5dae[_0x1df8('0x45')]=[{'all':!![]}];}_0x4f5dae=_[_0x1df8('0x41')]({},_0x4f5dae,_0x1236dc[_0x1df8('0x49')]);return db[_0x1df8('0x2e')][_0x1df8('0x4a')](_0x4f5dae)[_0x1df8('0x24')](handleEntityNotFound(_0xff7e21,null))['then'](respondWithResult(_0xff7e21,null))[_0x1df8('0x4b')](handleError(_0xff7e21,null));};exports[_0x1df8('0x23')]=function(_0x4f5b69,_0x221014){if(_0x4f5b69[_0x1df8('0x4c')]['id']){delete _0x4f5b69[_0x1df8('0x4c')]['id'];}return db[_0x1df8('0x2e')][_0x1df8('0x4a')]({'where':{'id':_0x4f5b69['params']['id']}})[_0x1df8('0x24')](handleEntityNotFound(_0x221014,null))['then'](saveUpdates(_0x4f5b69[_0x1df8('0x4c')],null))[_0x1df8('0x24')](respondWithResult(_0x221014,null))['catch'](handleError(_0x221014,null));};exports[_0x1df8('0x4d')]=function(_0x4b482d,_0xe03ad6,_0x397840){return db[_0x1df8('0x4e')][_0x1df8('0x4f')](function(_0x58f732){if(_0x4b482d[_0x1df8('0x4c')][_0x1df8('0x50')]==='files'){_0x4b482d[_0x1df8('0x4c')][_0x1df8('0x51')]=path[_0x1df8('0x52')](config[_0x1df8('0x53')],_0x1df8('0x54'),_0x4b482d[_0x1df8('0x4c')][_0x1df8('0x2a')]);}return db[_0x1df8('0x2e')][_0x1df8('0x4d')](_0x4b482d[_0x1df8('0x4c')],{'transaction':_0x58f732})[_0x1df8('0x24')](function(_0x5842f5){if(_0x4b482d[_0x1df8('0x4c')][_0x1df8('0x50')]===_0x1df8('0x55')){fs[_0x1df8('0x56')](_0x5842f5[_0x1df8('0x51')],parseInt(_0x1df8('0x57'),0x8));}var _0x536cb6=_0x4b482d[_0x1df8('0x58')][_0x1df8('0x26')]({'plain':!![]});if(!_0x536cb6)throw new Error(_0x1df8('0x59'));if(_0x536cb6[_0x1df8('0x5a')]==='user'){var _0x29eff5=_0x5842f5['get']({'plain':!![]});return db[_0x1df8('0x5b')][_0x1df8('0x4a')]({'where':{'name':_0x1df8('0x27'),'userProfileId':_0x536cb6['userProfileId']},'raw':!![]})[_0x1df8('0x24')](function(_0x277c3f){if(_0x277c3f&&_0x277c3f[_0x1df8('0x5c')]===0x0){return db[_0x1df8('0x28')][_0x1df8('0x4d')]({'name':_0x29eff5['name'],'resourceId':_0x29eff5['id'],'type':_0x277c3f[_0x1df8('0x2a')],'sectionId':_0x277c3f['id']},{})['then'](function(){return _0x5842f5;});}else{return _0x5842f5;}})[_0x1df8('0x4b')](function(_0x1a1ddd){logger[_0x1df8('0x5d')](_0x1df8('0x5e'),_0x1a1ddd);});}return _0x5842f5;});})[_0x1df8('0x24')](respondWithResult(_0xe03ad6,0xc9))[_0x1df8('0x4b')](handleError(_0xe03ad6,null));};exports[_0x1df8('0x25')]=function(_0x13b872,_0x2f920e,_0x1d5616){var _0x9f90b3;return db['VoiceMusicOnHold'][_0x1df8('0x4a')]({'where':{'id':_0x13b872[_0x1df8('0x48')]['id']}})['then'](function(_0x258c01){if(_0x258c01){return db['sequelize'][_0x1df8('0x4f')](function(_0x29721d){return _0x258c01[_0x1df8('0x25')]({'transaction':_0x29721d,'raw':!![]})[_0x1df8('0x24')](function(_0x27a2b9){if(_0x27a2b9[_0x1df8('0x51')]){fs[_0x1df8('0x5f')](_0x27a2b9[_0x1df8('0x51')])[_0x1df8('0x60')](function(_0x82cb29){fs['unlinkSync'](path['join'](_0x27a2b9['directory'],_0x82cb29));});fs[_0x1df8('0x61')](_0x27a2b9[_0x1df8('0x51')]);}return _0x27a2b9;});})['catch'](function(_0x2ed4af){throw new db['Sequelize'][(_0x1df8('0x62'))](_0x2ed4af[_0x1df8('0x63')]);});}})['then'](handleEntityNotFound(_0x2f920e,null))[_0x1df8('0x24')](removeEntity(_0x2f920e,null))[_0x1df8('0x4b')](handleError(_0x2f920e,null));};exports[_0x1df8('0x64')]=function(_0x46eb2,_0x186ee0,_0x58ab53){return db[_0x1df8('0x4e')][_0x1df8('0x4f')](function(_0x17fbfd){var _0x56437c;return db[_0x1df8('0x2e')][_0x1df8('0x4a')]({'where':{'id':_0x46eb2[_0x1df8('0x48')]['id']}})[_0x1df8('0x24')](function(_0x118431){if(_0x118431){_0x56437c=_0x118431;return _0x118431['addSound'](_0x46eb2[_0x1df8('0x4c')]['id'],{'transaction':_0x17fbfd});}})[_0x1df8('0x24')](function(_0x21f274){if(_0x21f274){return db[_0x1df8('0x65')][_0x1df8('0x66')]({'where':{'id':_0x46eb2[_0x1df8('0x4c')]['id']},'attributes':['id','name',_0x1df8('0x67'),_0x1df8('0x68'),_0x1df8('0x69')],'raw':!![]});}})[_0x1df8('0x24')](function(_0x28904b){if(_0x28904b){var _0x1156c9=path['join'](config[_0x1df8('0x53')],_0x1df8('0x6a'),util[_0x1df8('0x6b')](_0x1df8('0x6c'),path[_0x1df8('0x6d')](_0x28904b[_0x1df8('0x67')],path['extname'](_0x28904b[_0x1df8('0x67')])),_0x28904b[_0x1df8('0x68')]));var _0x3b1837=path[_0x1df8('0x52')](config['root'],_0x1df8('0x54'),_0x56437c[_0x1df8('0x2a')],util['format']('%s.%s',_0x28904b[_0x1df8('0x2a')],_0x28904b[_0x1df8('0x68')]));fs[_0x1df8('0x6e')](_0x1156c9,_0x3b1837);return _0x28904b;}})[_0x1df8('0x4b')](function(_0x3a5bb3){throw new db[(_0x1df8('0x6f'))][(_0x1df8('0x62'))](_0x3a5bb3[_0x1df8('0x63')]);});})[_0x1df8('0x24')](handleEntityNotFound(_0x186ee0,null))[_0x1df8('0x24')](respondWithResult(_0x186ee0,0xc9))[_0x1df8('0x4b')](handleError(_0x186ee0,null));};exports[_0x1df8('0x70')]=function(_0xb7da9d,_0x395505,_0x2bc601){return db[_0x1df8('0x4e')]['transaction'](function(_0x41d07a){var _0x2dd37a;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0xb7da9d[_0x1df8('0x48')]['id']}})['then'](handleEntityNotFound(_0x395505,null))['then'](function(_0x3e9d5b){if(_0x3e9d5b){_0x2dd37a=_0x3e9d5b;return _0x3e9d5b[_0x1df8('0x70')](_0xb7da9d[_0x1df8('0x48')][_0x1df8('0x71')]);}})[_0x1df8('0x24')](function(_0x2b741){if(_0x2b741){return db[_0x1df8('0x65')][_0x1df8('0x66')]({'where':{'id':_0xb7da9d[_0x1df8('0x48')][_0x1df8('0x71')]},'attributes':['id',_0x1df8('0x2a'),_0x1df8('0x67'),_0x1df8('0x68'),'createdAt'],'raw':!![]});}})['then'](function(_0x2d78dc){if(_0x2d78dc){fs[_0x1df8('0x72')](path[_0x1df8('0x52')](_0x2dd37a[_0x1df8('0x51')],util[_0x1df8('0x6b')](_0x1df8('0x6c'),_0x2d78dc[_0x1df8('0x2a')],_0x2d78dc[_0x1df8('0x68')])));return _0x2d78dc;}})[_0x1df8('0x4b')](function(_0x3b2a1a){throw new db[(_0x1df8('0x6f'))][(_0x1df8('0x62'))](_0x3b2a1a[_0x1df8('0x63')]);});})[_0x1df8('0x24')](handleEntityNotFound(_0x395505,null))[_0x1df8('0x24')](respondWithStatusCode(_0x395505,0xcc))[_0x1df8('0x4b')](handleError(_0x395505,null));};exports['getSounds']=function(_0x76151d,_0xea3475,_0x1cf0a9){var _0xdafd51={};var _0x518080={};var _0x52e559;var _0x3d2198;return db[_0x1df8('0x2e')][_0x1df8('0x66')]({'where':{'id':_0x76151d[_0x1df8('0x48')]['id']}})[_0x1df8('0x24')](handleEntityNotFound(_0xea3475,null))[_0x1df8('0x24')](function(_0x266ffd){if(_0x266ffd){_0x52e559=_0x266ffd;_0x518080[_0x1df8('0x33')]=_[_0x1df8('0x35')](db[_0x1df8('0x65')][_0x1df8('0x2f')]);_0x518080[_0x1df8('0x34')]=_['keys'](_0x76151d[_0x1df8('0x34')]);_0x518080[_0x1df8('0x36')]=_[_0x1df8('0x37')](_0x518080[_0x1df8('0x33')],_0x518080[_0x1df8('0x34')]);_0xdafd51[_0x1df8('0x73')]=_[_0x1df8('0x37')](_0x518080[_0x1df8('0x33')],qs[_0x1df8('0x38')](_0x76151d[_0x1df8('0x34')][_0x1df8('0x38')]));_0xdafd51['attributes']=_0xdafd51[_0x1df8('0x73')][_0x1df8('0x39')]?_0xdafd51[_0x1df8('0x73')]:_0x518080[_0x1df8('0x33')];_0xdafd51[_0x1df8('0x3d')]=qs[_0x1df8('0x3e')](_0x76151d[_0x1df8('0x34')][_0x1df8('0x3e')]);_0xdafd51[_0x1df8('0x3f')]=qs[_0x1df8('0x36')](_['pick'](_0x76151d[_0x1df8('0x34')],_0x518080[_0x1df8('0x36')]));if(_0x76151d[_0x1df8('0x34')][_0x1df8('0x43')]){_0xdafd51[_0x1df8('0x3f')]=_[_0x1df8('0x41')](_0xdafd51[_0x1df8('0x3f')],{'$or':_['map'](_0xdafd51[_0x1df8('0x73')],function(_0xb77d96){var _0x3bf58a={};_0x3bf58a[_0xb77d96]={'$like':'%'+_0x76151d['query'][_0x1df8('0x43')]+'%'};return _0x3bf58a;})});}_0xdafd51=_[_0x1df8('0x41')]({},_0xdafd51,_0x76151d[_0x1df8('0x49')]);return _0x52e559[_0x1df8('0x74')](_0xdafd51);}})[_0x1df8('0x24')](function(_0x3d1a60){if(_0x3d1a60){_0x3d2198=_0x3d1a60[_0x1df8('0x39')];if(!_0x76151d['query']['hasOwnProperty'](_0x1df8('0x3b'))){_0xdafd51[_0x1df8('0x3c')]=qs['limit'](_0x76151d[_0x1df8('0x34')][_0x1df8('0x3c')]);_0xdafd51[_0x1df8('0x1c')]=qs['offset'](_0x76151d[_0x1df8('0x34')]['offset']);}return _0x52e559['getSounds'](_0xdafd51);}})[_0x1df8('0x24')](function(_0x119b26){if(_0x119b26){return _0x119b26?{'count':_0x3d2198,'rows':_0x119b26}:null;}})[_0x1df8('0x24')](respondWithResult(_0xea3475,null))[_0x1df8('0x4b')](handleError(_0xea3475,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f499906..1356781 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 _0x9a74=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','voice_musiconhold'];(function(_0x2980e8,_0x5348dc){var _0x42a953=function(_0x54256a){while(--_0x54256a){_0x2980e8['push'](_0x2980e8['shift']());}};_0x42a953(++_0x5348dc);}(_0x9a74,0x168));var _0x49a7=function(_0x8d8b6b,_0x543208){_0x8d8b6b=_0x8d8b6b-0x0;var _0x2f8d29=_0x9a74[_0x8d8b6b];return _0x2f8d29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49a7('0x0'))('api');var moment=require(_0x49a7('0x1'));var BPromise=require(_0x49a7('0x2'));var rp=require(_0x49a7('0x3'));var fs=require('fs');var path=require(_0x49a7('0x4'));var rimraf=require(_0x49a7('0x5'));var config=require(_0x49a7('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x49a7('0x7')]=function(_0x29dc34,_0x1e85d1){return _0x29dc34['define']('VoiceMusicOnHold',attributes,{'tableName':_0x49a7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb32=['exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x3219a0,_0x329795){var _0x4f70bf=function(_0x350f37){while(--_0x350f37){_0x3219a0['push'](_0x3219a0['shift']());}};_0x4f70bf(++_0x329795);}(_0xcb32,0x88));var _0x2cb3=function(_0x12805a,_0x45555d){_0x12805a=_0x12805a-0x0;var _0x481ba2=_0xcb32[_0x12805a];return _0x481ba2;};'use strict';var _=require('lodash');var util=require(_0x2cb3('0x0'));var logger=require(_0x2cb3('0x1'))(_0x2cb3('0x2'));var moment=require(_0x2cb3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cb3('0x4'));var rimraf=require(_0x2cb3('0x5'));var config=require(_0x2cb3('0x6'));var attributes=require(_0x2cb3('0x7'));module[_0x2cb3('0x8')]=function(_0x319990,_0x562aac){return _0x319990[_0x2cb3('0x9')](_0x2cb3('0xa'),attributes,{'tableName':_0x2cb3('0xb'),'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 9a512e9..32924c2 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x49c302,_0x8dee87){var _0x563f09=function(_0x3f34a7){while(--_0x3f34a7){_0x49c302['push'](_0x49c302['shift']());}};_0x563f09(++_0x8dee87);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x14d2b7,_0x33e508){var _0x5643aa=function(_0x119a19){while(--_0x119a19){_0x14d2b7['push'](_0x14d2b7['shift']());}};_0x5643aa(++_0x33e508);}(_0xedd9,0xfc));var _0x9edd=function(_0x3ece35,_0x1fb93c){_0x3ece35=_0x3ece35-0x0;var _0x35ce47=_0xedd9[_0x3ece35];return _0x35ce47;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 374ca11..dd06184 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 _0x1928=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x17663f,_0x3a5f1b){var _0x29cbdb=function(_0x1cb3af){while(--_0x1cb3af){_0x17663f['push'](_0x17663f['shift']());}};_0x29cbdb(++_0x3a5f1b);}(_0x1928,0x138));var _0x8192=function(_0x2b4b1f,_0xa4b6aa){_0x2b4b1f=_0x2b4b1f-0x0;var _0x1505b3=_0x1928[_0x2b4b1f];return _0x1505b3;};'use strict';var multer=require(_0x8192('0x0'));var util=require(_0x8192('0x1'));var path=require(_0x8192('0x2'));var timeout=require('connect-timeout');var express=require(_0x8192('0x3'));var router=express[_0x8192('0x4')]();var fs_extra=require(_0x8192('0x5'));var auth=require(_0x8192('0x6'));var interaction=require(_0x8192('0x7'));var config=require(_0x8192('0x8'));var controller=require(_0x8192('0x9'));router[_0x8192('0xa')]('/',auth[_0x8192('0xb')](),controller[_0x8192('0xc')]);router[_0x8192('0xa')](_0x8192('0xd'),auth[_0x8192('0xb')](),controller[_0x8192('0xe')]);router['get'](_0x8192('0xf'),auth['isAuthenticated'](),controller[_0x8192('0x10')]);router[_0x8192('0xa')](_0x8192('0x11'),auth[_0x8192('0xb')](),controller['getAgents']);router[_0x8192('0xa')](_0x8192('0x12'),auth[_0x8192('0xb')](),controller[_0x8192('0x13')]);router[_0x8192('0x14')]('/',auth['isAuthenticated'](),controller[_0x8192('0x15')]);router[_0x8192('0x14')](_0x8192('0x11'),auth[_0x8192('0xb')](),controller[_0x8192('0x16')]);router[_0x8192('0x14')](_0x8192('0x12'),auth[_0x8192('0xb')](),controller[_0x8192('0x17')]);router[_0x8192('0x18')](_0x8192('0xf'),auth['isAuthenticated'](),controller[_0x8192('0x19')]);router[_0x8192('0x1a')](_0x8192('0xf'),auth[_0x8192('0xb')](),controller['destroy']);router[_0x8192('0x1a')](_0x8192('0x11'),auth[_0x8192('0xb')](),controller['removeAgents']);router[_0x8192('0x1a')]('/:id/teams',auth[_0x8192('0xb')](),controller[_0x8192('0x1b')]);module[_0x8192('0x1c')]=router; \ No newline at end of file +var _0x15cb=['removeAgents','removeTeams','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy'];(function(_0x4eb0b1,_0x1621ac){var _0x1b58bd=function(_0x30c4e5){while(--_0x30c4e5){_0x4eb0b1['push'](_0x4eb0b1['shift']());}};_0x1b58bd(++_0x1621ac);}(_0x15cb,0x16f));var _0xb15c=function(_0x56703c,_0x137116){_0x56703c=_0x56703c-0x0;var _0x2f8aed=_0x15cb[_0x56703c];return _0x2f8aed;};'use strict';var multer=require('multer');var util=require(_0xb15c('0x0'));var path=require('path');var timeout=require(_0xb15c('0x1'));var express=require('express');var router=express[_0xb15c('0x2')]();var fs_extra=require(_0xb15c('0x3'));var auth=require(_0xb15c('0x4'));var interaction=require(_0xb15c('0x5'));var config=require('../../config/environment');var controller=require(_0xb15c('0x6'));router[_0xb15c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb15c('0x7')](_0xb15c('0x8'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xa')]);router[_0xb15c('0x7')](_0xb15c('0xb'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xc')]);router['get'](_0xb15c('0xd'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xb15c('0xe'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xf')]);router[_0xb15c('0x10')]('/',auth[_0xb15c('0x9')](),controller[_0xb15c('0x11')]);router['post']('/:id/users',auth[_0xb15c('0x9')](),controller['addAgents']);router[_0xb15c('0x10')](_0xb15c('0xe'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x12')]);router[_0xb15c('0x13')](_0xb15c('0xb'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x14')]);router[_0xb15c('0x15')](_0xb15c('0xb'),auth['isAuthenticated'](),controller[_0xb15c('0x16')]);router[_0xb15c('0x15')]('/:id/users',auth[_0xb15c('0x9')](),controller[_0xb15c('0x17')]);router[_0xb15c('0x15')](_0xb15c('0xe'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x18')]);module[_0xb15c('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f2782f6..48185f8 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 _0x17cf=['INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x17cf,0x16f));var _0xf17c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x17cf[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xf17c('0x0'));module['exports']={'name':{'type':Sequelize[_0xf17c('0x1')],'allowNull':![],'unique':_0xf17c('0x2')},'prefix':{'type':Sequelize[_0xf17c('0x3')],'get':function(_0x22eb7b){return _0xf17c('0x4')+this['getDataValue'](_0xf17c('0x2'))+'-';}},'description':{'type':Sequelize[_0xf17c('0x1')]},'callerIdAll':{'type':Sequelize[_0xf17c('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xf17c('0x5')]}}; \ No newline at end of file +var _0x587b=['getDataValue','STRING','sequelize','exports','VIRTUAL','system-'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x587b,0xbc));var _0xb587=function(_0x19da21,_0x579b69){_0x19da21=_0x19da21-0x0;var _0x4a5c38=_0x587b[_0x19da21];return _0x4a5c38;};'use strict';var Sequelize=require(_0xb587('0x0'));module[_0xb587('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xb587('0x2')],'get':function(_0x550f1c){return _0xb587('0x3')+this[_0xb587('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xb587('0x5')]},'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 8884fa6..5f204bd 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(_0x16ebf9,_0x2d49f2){_0x16ebf9=_0x16ebf9-0x0;var _0x4eaedb=_0x32b6[_0x16ebf9];return _0x4eaedb;};'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 _0x087b=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','where','include','catch','options','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Set','CDR(prefix)=','callerIdAll','push','No\x20callerid\x20available','context','charAt','body','system-','findById','addAgents','params','omit','ids','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','getTeams','Team','addTeams','findAll','interface','flatMap','Agents','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','union','compact','value','removeTeams','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus'];(function(_0x3976ff,_0x4bae90){var _0x5a1f28=function(_0x306810){while(--_0x306810){_0x3976ff['push'](_0x3976ff['shift']());}};_0x5a1f28(++_0x4bae90);}(_0x087b,0x11a));var _0xb087=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x087b[_0x1203f];return _0x365f0a;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];config[_0xb087('0x1b')]=_[_0xb087('0x1c')](config['redis'],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1b')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);function respondWithStatusCode(_0x12d0db,_0x5e9757){_0x5e9757=_0x5e9757||0xcc;return function(_0x5147e3){if(_0x5147e3){return _0x12d0db[_0xb087('0x21')](_0x5e9757);}return _0x12d0db[_0xb087('0x22')](_0x5e9757)['end']();};}function respondWithResult(_0x43e576,_0x412b48){_0x412b48=_0x412b48||0xc8;return function(_0x597478){if(_0x597478){return _0x43e576[_0xb087('0x22')](_0x412b48)[_0xb087('0x23')](_0x597478);}};}function respondWithFilteredResult(_0x2e9e74,_0x5bb80b){return function(_0x330005){if(_0x330005){var _0x3c680f=typeof _0x5bb80b[_0xb087('0x24')]===_0xb087('0x25')&&typeof _0x5bb80b['limit']===_0xb087('0x25');var _0x28428e=_0x330005[_0xb087('0x26')];var _0x23c1b6=_0x3c680f?0x0:_0x5bb80b['offset'];var _0x5aeab1=_0x3c680f?_0x330005['count']:_0x5bb80b['offset']+_0x5bb80b[_0xb087('0x27')];var _0x17be8e;if(_0x5aeab1>=_0x28428e){_0x5aeab1=_0x28428e;_0x17be8e=0xc8;}else{_0x17be8e=0xce;}_0x2e9e74[_0xb087('0x22')](_0x17be8e);return _0x2e9e74[_0xb087('0x28')](_0xb087('0x29'),_0x23c1b6+'-'+_0x5aeab1+'/'+_0x28428e)[_0xb087('0x23')](_0x330005);}return null;};}function patchUpdates(_0x31ae01){return function(_0x5587f7){try{jsonpatch[_0xb087('0x2a')](_0x5587f7,_0x31ae01,!![]);}catch(_0x466397){return BPromise[_0xb087('0x2b')](_0x466397);}return _0x5587f7[_0xb087('0x2c')]();};}function saveUpdates(_0x3ad74e,_0x4d9028){return function(_0x183eab){if(_0x183eab){return _0x183eab[_0xb087('0x2d')](_0x3ad74e)['then'](function(_0x5a2dc6){return _0x5a2dc6;});}return null;};}function removeEntity(_0x50745a,_0x598b99){return function(_0x5a4ee0){if(_0x5a4ee0){return _0x5a4ee0[_0xb087('0x2e')]()[_0xb087('0x2f')](function(){var _0x1d124f=_0x5a4ee0[_0xb087('0x30')]({'plain':!![]});var _0xd9ec66=_0xb087('0x31');return db[_0xb087('0x32')][_0xb087('0x2e')]({'where':{'type':_0xd9ec66,'resourceId':_0x1d124f['id']}})[_0xb087('0x2f')](function(){return _0x5a4ee0;});})[_0xb087('0x2f')](function(){_0x50745a[_0xb087('0x22')](0xcc)[_0xb087('0x33')]();});}};}function handleEntityNotFound(_0xb0baf6,_0x263259){return function(_0x593b78){if(!_0x593b78){_0xb0baf6[_0xb087('0x21')](0x194);}return _0x593b78;};}function handleError(_0x1335d9,_0x20183f){_0x20183f=_0x20183f||0x1f4;return function(_0x15c9ac){logger[_0xb087('0x34')](_0x15c9ac[_0xb087('0x35')]);if(_0x15c9ac[_0xb087('0x36')]){delete _0x15c9ac[_0xb087('0x36')];}_0x1335d9['status'](_0x20183f)['send'](_0x15c9ac);};}exports[_0xb087('0x37')]=function(_0xedd164,_0x4cb5a8){var _0x60bfe2={},_0x7d3776={},_0x2a48d3={'count':0x0,'rows':[]};var _0x32b20d=_[_0xb087('0x38')](db[_0xb087('0x39')][_0xb087('0x3a')],function(_0x3b7ace){return{'name':_0x3b7ace[_0xb087('0x3b')],'type':_0x3b7ace[_0xb087('0x3c')][_0xb087('0x3d')]};});_0x7d3776[_0xb087('0x3e')]=_['map'](_0x32b20d,_0xb087('0x36'));_0x7d3776['query']=_[_0xb087('0x3f')](_0xedd164[_0xb087('0x40')]);_0x7d3776[_0xb087('0x41')]=_[_0xb087('0x42')](_0x7d3776[_0xb087('0x3e')],_0x7d3776[_0xb087('0x40')]);_0x60bfe2[_0xb087('0x43')]=_[_0xb087('0x42')](_0x7d3776[_0xb087('0x3e')],qs['fields'](_0xedd164['query'][_0xb087('0x44')]));_0x60bfe2[_0xb087('0x43')]=_0x60bfe2[_0xb087('0x43')][_0xb087('0x45')]?_0x60bfe2[_0xb087('0x43')]:_0x7d3776['model'];if(!_0xedd164[_0xb087('0x40')][_0xb087('0x46')]('nolimit')){_0x60bfe2['limit']=qs[_0xb087('0x27')](_0xedd164[_0xb087('0x40')][_0xb087('0x27')]);_0x60bfe2['offset']=qs[_0xb087('0x24')](_0xedd164[_0xb087('0x40')][_0xb087('0x24')]);}_0x60bfe2[_0xb087('0x47')]=qs[_0xb087('0x48')](_0xedd164['query'][_0xb087('0x48')]);_0x60bfe2['where']=qs[_0xb087('0x41')](_['pick'](_0xedd164[_0xb087('0x40')],_0x7d3776[_0xb087('0x41')]),_0x32b20d);if(_0xedd164['query'][_0xb087('0x49')]){_0x60bfe2['where']=_[_0xb087('0x4a')](_0x60bfe2['where'],{'$or':_[_0xb087('0x38')](_0x32b20d,function(_0x326934){if(_0x326934[_0xb087('0x3c')]!==_0xb087('0x4b')){var _0x1785e0={};_0x1785e0[_0x326934[_0xb087('0x36')]]={'$like':'%'+_0xedd164[_0xb087('0x40')]['filter']+'%'};return _0x1785e0;}})});}_0x60bfe2=_[_0xb087('0x4a')]({},_0x60bfe2,_0xedd164['options']);var _0x2a2b9c={'where':_0x60bfe2[_0xb087('0x4c')]};return db['VoicePrefix'][_0xb087('0x26')](_0x2a2b9c)[_0xb087('0x2f')](function(_0x7650c5){_0x2a48d3['count']=_0x7650c5;if(_0xedd164[_0xb087('0x40')]['includeAll']){_0x60bfe2[_0xb087('0x4d')]=[{'all':!![]}];}return db[_0xb087('0x39')]['findAll'](_0x60bfe2);})[_0xb087('0x2f')](function(_0x302ce7){_0x2a48d3['rows']=_0x302ce7;return _0x2a48d3;})[_0xb087('0x2f')](respondWithFilteredResult(_0x4cb5a8,_0x60bfe2))[_0xb087('0x4e')](handleError(_0x4cb5a8,null));};exports['show']=function(_0x93ada7,_0x46c713){var _0x1d7f80={'raw':![],'where':{'id':_0x93ada7['params']['id']}},_0x174c10={};_0x174c10['model']=_[_0xb087('0x3f')](db[_0xb087('0x39')][_0xb087('0x3a')]);_0x174c10[_0xb087('0x40')]=_[_0xb087('0x3f')](_0x93ada7[_0xb087('0x40')]);_0x174c10['filters']=_['intersection'](_0x174c10[_0xb087('0x3e')],_0x174c10['query']);_0x1d7f80[_0xb087('0x43')]=_[_0xb087('0x42')](_0x174c10[_0xb087('0x3e')],qs[_0xb087('0x44')](_0x93ada7['query'][_0xb087('0x44')]));_0x1d7f80['attributes']=_0x1d7f80[_0xb087('0x43')][_0xb087('0x45')]?_0x1d7f80[_0xb087('0x43')]:_0x174c10[_0xb087('0x3e')];if(_0x93ada7[_0xb087('0x40')]['includeAll']){_0x1d7f80[_0xb087('0x4d')]=[{'all':!![]}];}_0x1d7f80=_[_0xb087('0x4a')]({},_0x1d7f80,_0x93ada7[_0xb087('0x4f')]);return db['VoicePrefix'][_0xb087('0x50')](_0x1d7f80)['then'](handleEntityNotFound(_0x46c713,null))['then'](respondWithResult(_0x46c713,null))[_0xb087('0x4e')](handleError(_0x46c713,null));};exports[_0xb087('0x2e')]=function(_0x5eacf3,_0x4362d4){return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x5eacf3['params']['id']}})['then'](handleEntityNotFound(_0x4362d4,null))[_0xb087('0x2f')](removeEntity(_0x4362d4,null))['catch'](handleError(_0x4362d4,null));};exports['describe']=function(_0x1e52e4,_0x3bafca){return db[_0xb087('0x39')][_0xb087('0x51')]()[_0xb087('0x2f')](respondWithResult(_0x3bafca,null))[_0xb087('0x4e')](handleError(_0x3bafca,null));};exports[_0xb087('0x52')]=function(_0xfb8827,_0x1fe178){var _0x18d93b;return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x55e653){return db[_0xb087('0x39')][_0xb087('0x52')](_0xfb8827['body'],{'transaction':_0x55e653})[_0xb087('0x2f')](function(_0x458301){_0x18d93b=_0x458301[_0xb087('0x30')]({'plain':!![]});return db[_0xb087('0x55')][_0xb087('0x50')]({'where':{'id':_0x18d93b[_0xb087('0x56')]},'raw':!![]})[_0xb087('0x2f')](function(_0x298169){return createVoicePrefixExtensions(_0x18d93b,_0x298169,_0x55e653);});});})[_0xb087('0x2f')](function(){var _0x357616=_0xfb8827[_0xb087('0x57')]['get']({'plain':!![]});if(!_0x357616)throw new Error(_0xb087('0x58'));if(_0x357616['role']===_0xb087('0x57')){var _0x575cc4=_0x18d93b;return db[_0xb087('0x59')][_0xb087('0x50')]({'where':{'name':_0xb087('0x31'),'userProfileId':_0x357616[_0xb087('0x5a')]},'raw':!![]})[_0xb087('0x2f')](function(_0x465ef6){if(_0x465ef6&&_0x465ef6[_0xb087('0x5b')]===0x0){return db[_0xb087('0x32')][_0xb087('0x52')]({'name':_0x575cc4[_0xb087('0x36')],'resourceId':_0x575cc4['id'],'type':_0x465ef6[_0xb087('0x36')],'sectionId':_0x465ef6['id']},{})[_0xb087('0x2f')](function(){return _0x18d93b;});}else{return _0x18d93b;}})[_0xb087('0x4e')](function(_0x22be05){logger[_0xb087('0x34')](_0xb087('0x5c'),_0x22be05);throw _0x22be05;});}return _0x18d93b;})[_0xb087('0x2f')](respondWithResult(_0x1fe178,null))[_0xb087('0x4e')](handleError(_0x1fe178,null));};function Extension(_0x40ff74,_0xe3cb2,_0x4053c8,_0x459c5b){this['context']=_0xb087('0x5d');this[_0xb087('0x5e')]=_0x40ff74;this[_0xb087('0x5f')]=_0x4053c8;this['type']=_0xb087('0x60');this[_0xb087('0x61')]='Voice\x20Prefix\x20Extension';this[_0xb087('0x62')]=_0xe3cb2;this[_0xb087('0x63')]=_0x459c5b;}function createVoicePrefixExtensions(_0x2e3a14,_0x596264,_0x133c58){return new BPromise(function(_0x257894,_0x3d7f74){var _0x43ef22=new Extension(formatPrefixName(_0x2e3a14[_0xb087('0x64')]),0x1,_0xb087('0x65'),_0xb087('0x66'));_0x43ef22[_0xb087('0x67')]=_0x2e3a14['id'];return db['VoiceExtension'][_0xb087('0x52')](_0x43ef22,{'transaction':_0x133c58})[_0xb087('0x2f')](function(_0x44548f){var _0x47b2c7=_0x44548f[_0xb087('0x30')]({'plain':!![]});var _0x4a26d0=_['map'](addVoicePrefixExtensions(_0x2e3a14,_0x596264),function(_0x3516d4){_0x3516d4[_0xb087('0x56')]=_0x47b2c7['id'];_0x3516d4['VoicePrefixId']=_0x2e3a14['id'];return _0x3516d4;});return db[_0xb087('0x55')]['bulkCreate'](_0x4a26d0,{'transaction':_0x133c58})[_0xb087('0x2f')](function(_0x1a8237){if(!_0x1a8237){return _0x3d7f74('Extensions\x20creation\x20failed');}else{return _0x257894(_0x1a8237);}})['catch'](function(_0x22219d){return _0x3d7f74(_0x22219d);});});;});};function addVoicePrefixExtensions(_0x5c43c8,_0x5ede2e){var _0x3c97ab=[];var _0x52d72a=formatPrefixName(_0x5c43c8[_0xb087('0x64')]);_0x3c97ab['push'](new Extension(_0x52d72a,0x2,_0xb087('0x68'),_0xb087('0x69')+_0x5c43c8[_0xb087('0x36')]));if(_0x5c43c8[_0xb087('0x6a')]){_0x3c97ab[_0xb087('0x6b')](new Extension(_0x52d72a,0x3,_0xb087('0x68'),'PREFIX-CALLERIDALL='+_0x5c43c8[_0xb087('0x6a')]));}else{_0x3c97ab['push'](new Extension(_0x52d72a,0x3,_0xb087('0x65'),_0xb087('0x6c')));}_0x3c97ab[_0xb087('0x6b')](new Extension(_0x52d72a,0x4,'goto',_0x5ede2e[_0xb087('0x6d')]+','+'${EXTEN:'+(0x8+_0x5c43c8[_0xb087('0x36')][_0xb087('0x45')])+'}'+','+0x1));return _0x3c97ab;}function formatPrefixName(_0x66f15b){var _0x2ee63f='_';for(var _0x16cb87=0x0;_0x16cb87<_0x66f15b[_0xb087('0x45')];_0x16cb87++){if(_0x66f15b['charAt'](_0x16cb87)=='-'){_0x2ee63f+=_0x66f15b[_0xb087('0x6e')](_0x16cb87);}else{_0x2ee63f+='['+_0x66f15b[_0xb087('0x6e')](_0x16cb87)+']';}}_0x2ee63f+='.';return _0x2ee63f;}exports['update']=function(_0x25a45f,_0x58de88,_0x19238d){var _0x38f5d2=_0x25a45f[_0xb087('0x6f')];_0x38f5d2[_0xb087('0x64')]=_0xb087('0x70')+_0x38f5d2[_0xb087('0x36')]+'-';return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x509ee7){return db['VoicePrefix']['update'](_0x38f5d2,{'where':{'id':_0x38f5d2['id']},'transaction':_0x509ee7})[_0xb087('0x2f')](function(){return db['VoiceExtension'][_0xb087('0x2e')]({'where':{'VoicePrefixId':_0x38f5d2['id']},'transaction':_0x509ee7})['then'](function(){return db[_0xb087('0x55')][_0xb087('0x50')]({'where':{'id':_0x38f5d2[_0xb087('0x56')]},'raw':!![]})[_0xb087('0x2f')](function(_0x49d0d3){return createVoicePrefixExtensions(_0x38f5d2,_0x49d0d3,_0x509ee7);});});});})[_0xb087('0x2f')](function(){return db['VoicePrefix'][_0xb087('0x71')](_0x38f5d2['id']);})[_0xb087('0x2f')](respondWithResult(_0x58de88,null))[_0xb087('0x4e')](handleError(_0x58de88,null));};exports[_0xb087('0x72')]=function(_0x5b5ad3,_0x49d26a,_0x38f296){return db['VoicePrefix'][_0xb087('0x50')]({'where':{'id':_0x5b5ad3[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x49d26a,null))[_0xb087('0x2f')](function(_0x4a9193){if(_0x4a9193){return _0x4a9193['addAgents'](_0x5b5ad3[_0xb087('0x6f')]['ids'],_[_0xb087('0x74')](_0x5b5ad3[_0xb087('0x6f')],[_0xb087('0x75'),'id'])||{})[_0xb087('0x76')](function(_0x142b0f){for(var _0x581ad4=0x0;_0x581ad4<_0x5b5ad3[_0xb087('0x6f')][_0xb087('0x75')]['length'];_0x581ad4+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x5b5ad3[_0xb087('0x6f')][_0xb087('0x75')][_0x581ad4]),'VoicePrefixId':Number(_0x5b5ad3[_0xb087('0x73')]['id'])});}return _0x142b0f;});}})[_0xb087('0x2f')](respondWithResult(_0x49d26a,null))[_0xb087('0x4e')](handleError(_0x49d26a,null));};exports[_0xb087('0x77')]=function(_0x47ea48,_0xd1f58a,_0x25e097){return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x47ea48[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0xd1f58a,null))[_0xb087('0x2f')](function(_0x50454b){if(_0x50454b){return _0x50454b[_0xb087('0x77')](_0x47ea48[_0xb087('0x40')][_0xb087('0x75')])['then'](function(){if(_[_0xb087('0x78')](_0x47ea48['query'][_0xb087('0x75')])){for(var _0x5fb869=0x0;_0x5fb869<_0x47ea48[_0xb087('0x40')][_0xb087('0x75')][_0xb087('0x45')];_0x5fb869+=0x1){socket[_0xb087('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x47ea48['query'][_0xb087('0x75')][_0x5fb869]),'VoicePrefixId':Number(_0x47ea48[_0xb087('0x73')]['id'])});}}else{socket['emit'](_0xb087('0x7a'),{'UserId':Number(_0x47ea48[_0xb087('0x40')][_0xb087('0x75')]),'VoicePrefixId':Number(_0x47ea48[_0xb087('0x73')]['id'])});}});}})[_0xb087('0x2f')](respondWithStatusCode(_0xd1f58a,null))[_0xb087('0x4e')](handleError(_0xd1f58a,null));};exports['getAgents']=function(_0x15ff29,_0x141859,_0x2c92f6){var _0x3114ce={};var _0x416e05={};var _0x3d6d1a;var _0xf286de;return db[_0xb087('0x39')][_0xb087('0x7b')]({'where':{'id':_0x15ff29['params']['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x141859,null))['then'](function(_0x2a32d0){if(_0x2a32d0){_0x3d6d1a=_0x2a32d0;_0x416e05[_0xb087('0x3e')]=_['keys'](db[_0xb087('0x7c')][_0xb087('0x3a')]);_0x416e05[_0xb087('0x40')]=_[_0xb087('0x3f')](_0x15ff29[_0xb087('0x40')]);_0x416e05[_0xb087('0x41')]=_['intersection'](_0x416e05[_0xb087('0x3e')],_0x416e05[_0xb087('0x40')]);_0x3114ce[_0xb087('0x43')]=_[_0xb087('0x42')](_0x416e05[_0xb087('0x3e')],qs['fields'](_0x15ff29[_0xb087('0x40')][_0xb087('0x44')]));_0x3114ce[_0xb087('0x43')]=_0x3114ce[_0xb087('0x43')][_0xb087('0x45')]?_0x3114ce[_0xb087('0x43')]:_0x416e05[_0xb087('0x3e')];_0x3114ce[_0xb087('0x47')]=qs[_0xb087('0x48')](_0x15ff29[_0xb087('0x40')][_0xb087('0x48')]);_0x3114ce['where']=qs['filters'](_[_0xb087('0x7d')](_0x15ff29[_0xb087('0x40')],_0x416e05[_0xb087('0x41')]));if(_0x15ff29[_0xb087('0x40')][_0xb087('0x49')]){_0x3114ce['where']=_[_0xb087('0x4a')](_0x3114ce[_0xb087('0x4c')],{'$or':_[_0xb087('0x38')](_0x3114ce[_0xb087('0x43')],function(_0x3e58be){var _0xbe2a4c={};_0xbe2a4c[_0x3e58be]={'$like':'%'+_0x15ff29['query'][_0xb087('0x49')]+'%'};return _0xbe2a4c;})});}_0x3114ce=_['merge']({},_0x3114ce,_0x15ff29['options']);return _0x3d6d1a[_0xb087('0x7e')](_0x3114ce);}})[_0xb087('0x2f')](function(_0x3a446d){if(_0x3a446d){_0xf286de=_0x3a446d[_0xb087('0x45')];if(!_0x15ff29['query'][_0xb087('0x46')](_0xb087('0x7f'))){_0x3114ce['limit']=qs[_0xb087('0x27')](_0x15ff29['query']['limit']);_0x3114ce[_0xb087('0x24')]=qs[_0xb087('0x24')](_0x15ff29[_0xb087('0x40')][_0xb087('0x24')]);}return _0x3d6d1a[_0xb087('0x7e')](_0x3114ce);}})['then'](function(_0x3cf818){if(_0x3cf818){return _0x3cf818?{'count':_0xf286de,'rows':_0x3cf818}:null;}})[_0xb087('0x2f')](respondWithResult(_0x141859,null))[_0xb087('0x4e')](handleError(_0x141859,null));};exports[_0xb087('0x80')]=function(_0x48e2c6,_0x489b1f,_0x544a68){var _0x5ebb4f={};var _0x17f0af={};var _0x3296c9;var _0x10e4b6;return db[_0xb087('0x39')][_0xb087('0x7b')]({'where':{'id':_0x48e2c6[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x489b1f,null))['then'](function(_0x5d45e7){if(_0x5d45e7){_0x3296c9=_0x5d45e7;_0x17f0af[_0xb087('0x3e')]=_[_0xb087('0x3f')](db[_0xb087('0x81')][_0xb087('0x3a')]);_0x17f0af['query']=_[_0xb087('0x3f')](_0x48e2c6['query']);_0x17f0af[_0xb087('0x41')]=_['intersection'](_0x17f0af[_0xb087('0x3e')],_0x17f0af[_0xb087('0x40')]);_0x5ebb4f[_0xb087('0x43')]=_[_0xb087('0x42')](_0x17f0af['model'],qs[_0xb087('0x44')](_0x48e2c6['query']['fields']));_0x5ebb4f['attributes']=_0x5ebb4f[_0xb087('0x43')]['length']?_0x5ebb4f[_0xb087('0x43')]:_0x17f0af[_0xb087('0x3e')];_0x5ebb4f[_0xb087('0x47')]=qs[_0xb087('0x48')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x48')]);_0x5ebb4f[_0xb087('0x4c')]=qs[_0xb087('0x41')](_[_0xb087('0x7d')](_0x48e2c6[_0xb087('0x40')],_0x17f0af[_0xb087('0x41')]));if(_0x48e2c6[_0xb087('0x40')][_0xb087('0x49')]){_0x5ebb4f[_0xb087('0x4c')]=_[_0xb087('0x4a')](_0x5ebb4f[_0xb087('0x4c')],{'$or':_[_0xb087('0x38')](_0x5ebb4f[_0xb087('0x43')],function(_0x4e42eb){var _0x15e2f9={};_0x15e2f9[_0x4e42eb]={'$like':'%'+_0x48e2c6['query'][_0xb087('0x49')]+'%'};return _0x15e2f9;})});}_0x5ebb4f=_[_0xb087('0x4a')]({},_0x5ebb4f,_0x48e2c6[_0xb087('0x4f')]);return _0x3296c9[_0xb087('0x80')](_0x5ebb4f);}})[_0xb087('0x2f')](function(_0x2e4d22){if(_0x2e4d22){_0x10e4b6=_0x2e4d22[_0xb087('0x45')];if(!_0x48e2c6['query']['hasOwnProperty']('nolimit')){_0x5ebb4f[_0xb087('0x27')]=qs[_0xb087('0x27')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x27')]);_0x5ebb4f[_0xb087('0x24')]=qs[_0xb087('0x24')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x24')]);}return _0x3296c9[_0xb087('0x80')](_0x5ebb4f);}})['then'](function(_0x2de517){if(_0x2de517){return _0x2de517?{'count':_0x10e4b6,'rows':_0x2de517}:null;}})['then'](respondWithResult(_0x489b1f,null))[_0xb087('0x4e')](handleError(_0x489b1f,null));};exports[_0xb087('0x82')]=function(_0x597d80,_0x4c3aef,_0x2f2597){var _0x2ae274=_0x597d80[_0xb087('0x6f')][_0xb087('0x75')];var _0x5069f2;return db[_0xb087('0x81')][_0xb087('0x83')]({'where':{'id':_0x2ae274},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb087('0x36'),'online','voicePause',_0xb087('0x84')],'raw':!![]}]})['then'](function(_0x4059ac){if(_0x4059ac){_0x5069f2=_0x4059ac;var _0x12976c=_[_0xb087('0x85')](_0x4059ac,function(_0x1e48cc){var _0x2de831=_0x1e48cc[_0xb087('0x30')]({'plain':!![]});return _0x2de831[_0xb087('0x86')];});return db[_0xb087('0x39')]['find']({'where':{'id':_0x597d80[_0xb087('0x73')]['id']}})['then'](function(_0x5acf13){return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x1fdb0f){return _0x5acf13['addTeams'](_0x2ae274,{'transaction':_0x1fdb0f})[_0xb087('0x2f')](function(){return BPromise[_0xb087('0x87')](_0x5069f2,function(_0x313d4b){return db[_0xb087('0x88')]['upsert']({'TeamId':_0x313d4b['id'],'VoicePrefixId':_0x597d80[_0xb087('0x73')]['id']},{'transaction':_0x1fdb0f});});})[_0xb087('0x2f')](function(){return BPromise[_0xb087('0x87')](_0x12976c,function(_0x46f5e6){return db[_0xb087('0x89')][_0xb087('0x8a')]({'where':{'UserId':_0x46f5e6['id'],'VoicePrefixId':_0x597d80[_0xb087('0x73')]['id']},'transaction':_0x1fdb0f});});})['then'](function(){_0x12976c[_0xb087('0x8b')](function(_0xfc3490){socket[_0xb087('0x79')](_0xb087('0x8c'),{'UserId':_0xfc3490['id'],'VoicePrefixId':_0x5acf13['id']});});});});});}})[_0xb087('0x2f')](respondWithStatusCode(_0x4c3aef,null))[_0xb087('0x4e')](handleError(_0x4c3aef,null));};exports['removeTeams']=function(_0x44c8cb,_0x15bbda,_0x149020){return db['Team']['findAll']({'where':{'id':_0x44c8cb[_0xb087('0x40')][_0xb087('0x75')]},'attributes':['id'],'include':[{'model':db[_0xb087('0x7c')],'as':_0xb087('0x86'),'attributes':['id'],'raw':!![]}]})[_0xb087('0x2f')](handleEntityNotFound(_0x15bbda,null))[_0xb087('0x2f')](function(_0x42528a){var _0x2795e9=_[_0xb087('0x38')](_0x42528a,'id');var _0xa58050=[];var _0x5ef263=[];var _0x1a7486=squel[_0xb087('0x8d')]();_0x1a7486[_0xb087('0x8e')](_0xb087('0x8f'))[_0xb087('0x90')]('team_has_voice_prefixes','tq')[_0xb087('0x91')](_0xb087('0x92'),'ut',_0xb087('0x93'))[_0xb087('0x4c')]('VoicePrefixId\x20=\x20?',_0x44c8cb[_0xb087('0x73')]['id']);for(var _0x547968=0x0;_0x547968<_0x42528a[_0xb087('0x45')];_0x547968+=0x1){let _0x532682=_0x42528a[_0x547968];for(var _0x5f4312=0x0;_0x5f4312<_0x532682[_0xb087('0x86')][_0xb087('0x45')];_0x5f4312+=0x1){let _0x1cb959=_0x532682['Agents'][_0x5f4312];var _0x595faa=_0x1a7486[_0xb087('0x94')]();_0x595faa[_0xb087('0x4c')](_0xb087('0x95'),_0x1cb959['id']);_0x5ef263[_0xb087('0x6b')](db[_0xb087('0x53')]['query'](_0x595faa[_0xb087('0x96')](),{'type':db[_0xb087('0x53')][_0xb087('0x97')][_0xb087('0x98')]})[_0xb087('0x2f')](function(_0x14737){if(_0x14737['length']===0x1){return _0x1cb959['id'];}else{var _0x5777d0=_[_0xb087('0x99')](_[_0xb087('0x38')](_0x14737,'TeamId'),function(_0x1f28dd){return _['includes'](_0x2795e9,_0x1f28dd);});if(_0x5777d0){return _0x1cb959['id'];}}}));}}return BPromise['all'](_0x5ef263)[_0xb087('0x2f')](function(_0x3193c8){_0xa58050=_(_0xa58050)[_0xb087('0x9a')](_0x3193c8)[_0xb087('0x9b')]()[_0xb087('0x9c')]();return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x44c8cb[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](function(_0xff9c0c){return db['sequelize']['transaction'](function(_0x5e704a){return _0xff9c0c[_0xb087('0x9d')](_0x44c8cb['query'][_0xb087('0x75')],{'transaction':_0x5e704a})['then'](function(){if(!_['isEmpty'](_0xa58050)){return _0xff9c0c[_0xb087('0x77')](_0xa58050,{'transaction':_0x5e704a});}})[_0xb087('0x2f')](function(){_0xa58050[_0xb087('0x8b')](function(_0x170d9e){socket[_0xb087('0x79')](_0xb087('0x7a'),{'UserId':_0x170d9e,'VoicePrefixId':_0xff9c0c['id']});});});});});});})[_0xb087('0x2f')](respondWithStatusCode(_0x15bbda,null))[_0xb087('0x4e')](handleError(_0x15bbda,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9c33d34..5ff0d4a 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 _0x643d=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','save'];(function(_0x4496cb,_0x4a881b){var _0xbdec58=function(_0xf3a558){while(--_0xf3a558){_0x4496cb['push'](_0x4496cb['shift']());}};_0xbdec58(++_0x4a881b);}(_0x643d,0x125));var _0xd643=function(_0x4cda7d,_0x45cb65){_0x4cda7d=_0x4cda7d-0x0;var _0x4e0bb7=_0x643d[_0x4cda7d];return _0x4e0bb7;};'use strict';var EventEmitter=require(_0xd643('0x0'));var VoicePrefix=require(_0xd643('0x1'))['db'][_0xd643('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd643('0x3'),'afterUpdate':_0xd643('0x4'),'afterDestroy':_0xd643('0x5')};function emitEvent(_0x4f7d3a){return function(_0x231ab2,_0x532c7b,_0x542a4c){VoicePrefixEvents[_0xd643('0x6')](_0x4f7d3a+':'+_0x231ab2['id'],_0x231ab2);VoicePrefixEvents[_0xd643('0x6')](_0x4f7d3a,_0x231ab2);_0x542a4c(null);};}for(var e in events){if(events[_0xd643('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xd643('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x7167=['update','emit','hook','events','../../mysqldb','save'];(function(_0x36d343,_0x1dc768){var _0x473820=function(_0x1b43df){while(--_0x1b43df){_0x36d343['push'](_0x36d343['shift']());}};_0x473820(++_0x1dc768);}(_0x7167,0x177));var _0x7716=function(_0x54b458,_0x4da21b){_0x54b458=_0x54b458-0x0;var _0x18d704=_0x7167[_0x54b458];return _0x18d704;};'use strict';var EventEmitter=require(_0x7716('0x0'));var VoicePrefix=require(_0x7716('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7716('0x2'),'afterUpdate':_0x7716('0x3'),'afterDestroy':'remove'};function emitEvent(_0x41b437){return function(_0x16c190,_0x43c27c,_0x3d7b4e){VoicePrefixEvents['emit'](_0x41b437+':'+_0x16c190['id'],_0x16c190);VoicePrefixEvents[_0x7716('0x4')](_0x41b437,_0x16c190);_0x3d7b4e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7716('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 8e8b1c2..e0f7135 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 _0x0885=['request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','moment','bluebird'];(function(_0x51c1a3,_0x1d4a0f){var _0xfbef99=function(_0x1c2f60){while(--_0x1c2f60){_0x51c1a3['push'](_0x51c1a3['shift']());}};_0xfbef99(++_0x1d4a0f);}(_0x0885,0xa3));var _0x5088=function(_0xb48d9e,_0x962045){_0xb48d9e=_0xb48d9e-0x0;var _0x1835f9=_0x0885[_0xb48d9e];return _0x1835f9;};'use strict';var _=require(_0x5088('0x0'));var util=require(_0x5088('0x1'));var logger=require('../../config/logger')(_0x5088('0x2'));var moment=require(_0x5088('0x3'));var BPromise=require(_0x5088('0x4'));var rp=require(_0x5088('0x5'));var fs=require('fs');var path=require(_0x5088('0x6'));var rimraf=require(_0x5088('0x7'));var config=require(_0x5088('0x8'));var attributes=require(_0x5088('0x9'));module[_0x5088('0xa')]=function(_0x4a22ac,_0x1a8660){return _0x4a22ac[_0x5088('0xb')](_0x5088('0xc'),attributes,{'tableName':_0x5088('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb05a=['moment','bluebird','request-promise','../../config/environment','VoicePrefix','voice_prefixes','../../config/logger','api'];(function(_0x590e84,_0x2378a5){var _0x152a67=function(_0x1285a9){while(--_0x1285a9){_0x590e84['push'](_0x590e84['shift']());}};_0x152a67(++_0x2378a5);}(_0xb05a,0x96));var _0xab05=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xb05a[_0x3cea78];return _0x33b66b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab05('0x0'))(_0xab05('0x1'));var moment=require(_0xab05('0x2'));var BPromise=require(_0xab05('0x3'));var rp=require(_0xab05('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab05('0x5'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x25c741,_0x4d0d7e){return _0x25c741['define'](_0xab05('0x6'),attributes,{'tableName':_0xab05('0x7'),'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 0172225..1d5fdd6 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 _0x543b=['stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0xa675d6,_0x23a45e){var _0x4d2423=function(_0xa98d28){while(--_0xa98d28){_0xa675d6['push'](_0xa675d6['shift']());}};_0x4d2423(++_0x23a45e);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x6'))(_0xb543('0x7'));var config=require(_0xb543('0x8'));var jayson=require(_0xb543('0x9'));var client=jayson[_0xb543('0xa')][_0xb543('0xb')]({'port':0x232a});config[_0xb543('0xc')]=_[_0xb543('0xd')](config[_0xb543('0xc')],{'host':_0xb543('0xe'),'port':0x18eb});var socket=require(_0xb543('0xf'))(new Redis(config[_0xb543('0xc')]));require('./voicePrefix.socket')[_0xb543('0x10')](socket);function respondWithRpcPromise(_0x48c727,_0x1f4cf0,_0x3a45e3){return new BPromise(function(_0x1e6d97,_0x1243fa){return client[_0xb543('0x11')](_0x48c727,_0x3a45e3)[_0xb543('0x12')](function(_0x5f4cef){logger[_0xb543('0x13')](_0xb543('0x14'),_0x1f4cf0,_0xb543('0x15'));logger['debug'](_0xb543('0x16'),_0x1f4cf0,_0xb543('0x15'),JSON[_0xb543('0x17')](_0x5f4cef));if(_0x5f4cef['error']){if(_0x5f4cef['error'][_0xb543('0x18')]===0x1f4){logger[_0xb543('0x19')](_0xb543('0x14'),_0x1f4cf0,_0x5f4cef[_0xb543('0x19')]['message']);return _0x1243fa(_0x5f4cef[_0xb543('0x19')][_0xb543('0x1a')]);}logger[_0xb543('0x19')](_0xb543('0x14'),_0x1f4cf0,_0x5f4cef['error'][_0xb543('0x1a')]);return _0x1e6d97(_0x5f4cef['error'][_0xb543('0x1a')]);}else{logger[_0xb543('0x13')](_0xb543('0x14'),_0x1f4cf0,_0xb543('0x15'));_0x1e6d97(_0x5f4cef['result'][_0xb543('0x1a')]);}})[_0xb543('0x1b')](function(_0x45cd55){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1f4cf0,_0x45cd55);_0x1243fa(_0x45cd55);});});} \ No newline at end of file +var _0x7278=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5d995d,_0x4e835b){var _0x4c97c0=function(_0x5c6378){while(--_0x5c6378){_0x5d995d['push'](_0x5d995d['shift']());}};_0x4c97c0(++_0x4e835b);}(_0x7278,0x161));var _0x8727=function(_0x10bb2f,_0x5e135a){_0x10bb2f=_0x10bb2f-0x0;var _0x1d39fa=_0x7278[_0x10bb2f];return _0x1d39fa;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var moment=require(_0x8727('0x2'));var BPromise=require(_0x8727('0x3'));var rs=require(_0x8727('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8727('0x5'))['db'];var utils=require(_0x8727('0x6'));var logger=require(_0x8727('0x7'))(_0x8727('0x8'));var config=require(_0x8727('0x9'));var jayson=require(_0x8727('0xa'));var client=jayson[_0x8727('0xb')]['http']({'port':0x232a});config[_0x8727('0xc')]=_[_0x8727('0xd')](config[_0x8727('0xc')],{'host':_0x8727('0xe'),'port':0x18eb});var socket=require(_0x8727('0xf'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0xb575a3,_0x336193,_0x3a6c9b){return new BPromise(function(_0x280fb3,_0x3ff244){return client[_0x8727('0x10')](_0xb575a3,_0x3a6c9b)[_0x8727('0x11')](function(_0xefa0bf){logger['info'](_0x8727('0x12'),_0x336193,_0x8727('0x13'));logger[_0x8727('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x336193,_0x8727('0x13'),JSON[_0x8727('0x15')](_0xefa0bf));if(_0xefa0bf['error']){if(_0xefa0bf[_0x8727('0x16')][_0x8727('0x17')]===0x1f4){logger[_0x8727('0x16')](_0x8727('0x12'),_0x336193,_0xefa0bf[_0x8727('0x16')][_0x8727('0x18')]);return _0x3ff244(_0xefa0bf[_0x8727('0x16')][_0x8727('0x18')]);}logger[_0x8727('0x16')](_0x8727('0x12'),_0x336193,_0xefa0bf['error'][_0x8727('0x18')]);return _0x280fb3(_0xefa0bf[_0x8727('0x16')][_0x8727('0x18')]);}else{logger[_0x8727('0x19')](_0x8727('0x12'),_0x336193,_0x8727('0x13'));_0x280fb3(_0xefa0bf['result']['message']);}})[_0x8727('0x1a')](function(_0x4a0a7d){logger[_0x8727('0x16')](_0x8727('0x12'),_0x336193,_0x4a0a7d);_0x3ff244(_0x4a0a7d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8976531..57746b2 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 _0x7217=['voicePrefix:','remove','emit','removeListener','register','length'];(function(_0x1687ad,_0x580fc2){var _0x144f71=function(_0x29a229){while(--_0x29a229){_0x1687ad['push'](_0x1687ad['shift']());}};_0x144f71(++_0x580fc2);}(_0x7217,0xa9));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x7721('0x0'),'update'];function createListener(_0x105754,_0xec5d3f){return function(_0x308464){_0xec5d3f[_0x7721('0x1')](_0x105754,_0x308464);};}function removeListener(_0x363be8,_0x41f292){return function(){VoicePrefixEvents[_0x7721('0x2')](_0x363be8,_0x41f292);};}exports[_0x7721('0x3')]=function(_0xb646e7){for(var _0x4d935b=0x0,_0x560535=events[_0x7721('0x4')];_0x4d935b<_0x560535;_0x4d935b++){var _0x2ddbba=events[_0x4d935b];var _0x7add4f=createListener(_0x7721('0x5')+_0x2ddbba,_0xb646e7);VoicePrefixEvents['on'](_0x2ddbba,_0x7add4f);}}; \ No newline at end of file +var _0x8482=['update','emit','removeListener','length','voicePrefix:','save','remove'];(function(_0x2f352a,_0x424b68){var _0x538a03=function(_0x361b73){while(--_0x361b73){_0x2f352a['push'](_0x2f352a['shift']());}};_0x538a03(++_0x424b68);}(_0x8482,0x14e));var _0x2848=function(_0x2d4df1,_0x44c755){_0x2d4df1=_0x2d4df1-0x0;var _0x16d1b6=_0x8482[_0x2d4df1];return _0x16d1b6;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x2848('0x0'),_0x2848('0x1'),_0x2848('0x2')];function createListener(_0xecfb19,_0x3ac5ad){return function(_0x212891){_0x3ac5ad[_0x2848('0x3')](_0xecfb19,_0x212891);};}function removeListener(_0x4309c1,_0x467ee5){return function(){VoicePrefixEvents[_0x2848('0x4')](_0x4309c1,_0x467ee5);};}exports['register']=function(_0x1eb602){for(var _0x44e406=0x0,_0x503238=events[_0x2848('0x5')];_0x44e406<_0x503238;_0x44e406++){var _0x48c0f3=events[_0x44e406];var _0x53c865=createListener(_0x2848('0x6')+_0x48c0f3,_0x1eb602);VoicePrefixEvents['on'](_0x48c0f3,_0x53c865);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7848674..3af11d2 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(_0x204047,_0x2df7af){var _0x5956d2=function(_0x2d32a8){while(--_0x2d32a8){_0x204047['push'](_0x204047['shift']());}};_0x5956d2(++_0x2df7af);}(_0xb10b,0x12a));var _0xbb10=function(_0x369633,_0x263fb9){_0x369633=_0x369633-0x0;var _0x1eda8c=_0xb10b[_0x369633];return _0x1eda8c;};'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(_0x52f3fa,_0x432d38){var _0x240e29=function(_0xb421b0){while(--_0xb421b0){_0x52f3fa['push'](_0x52f3fa['shift']());}};_0x240e29(++_0x432d38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 644ce24..daaf8f1 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 _0x76b8=['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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','STRING','default','ringall','fewestcalls','random','linear','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','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)'];(function(_0xf7fb0c,_0x2f198b){var _0x31545c=function(_0x6ca2aa){while(--_0x6ca2aa){_0xf7fb0c['push'](_0xf7fb0c['shift']());}};_0x31545c(++_0x2f198b);}(_0x76b8,0x127));var _0x876b=function(_0x272b37,_0x5a1fa5){_0x272b37=_0x272b37-0x0;var _0x2e2c71=_0x76b8[_0x272b37];return _0x2e2c71;};'use strict';var Sequelize=require(_0x876b('0x0'));module[_0x876b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x876b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x876b('0x3')]('inbound','outbound'),'allowNull':![],'defaultValue':_0x876b('0x4')},'musiconhold':{'type':Sequelize[_0x876b('0x5')],'defaultValue':_0x876b('0x6')},'announce':{'type':Sequelize[_0x876b('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0x876b('0x3')]('rr',_0x876b('0x7'),'leastrecent',_0x876b('0x8'),_0x876b('0x9'),'rrmemory',_0x876b('0xa'),'wrandom',_0x876b('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0xd65866){this[_0x876b('0xc')](_0x876b('0xd'),_0xd65866?_0xd65866:'rrmemory');},'get':function(){var _0x242171=this[_0x876b('0xe')](_0x876b('0xf'));var _0x31f73c=this[_0x876b('0xe')](_0x876b('0x10'));var _0x4e52f0=this[_0x876b('0xe')](_0x876b('0xd'));if(_0x242171===_0x876b('0x4')){return _0x4e52f0;}if(_0x31f73c===_0x876b('0x11')&&_0x4e52f0==='rrmemory'||_0x31f73c===_0x876b('0x11')&&_0x4e52f0===_0x876b('0x12')){return _0x4e52f0;}if(_0x31f73c===_0x876b('0x13')||_0x31f73c==='predictive'||_0x31f73c===_0x876b('0x14')){return _0x4e52f0;}return null;}},'servicelevel':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x876b('0x15')](0xb)},'timeout':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x876b('0x5')]},'weight':{'type':Sequelize[_0x876b('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x876b('0x3')]('yes','no'),'defaultValue':_0x876b('0x16')},'autopause':{'type':Sequelize['ENUM'](_0x876b('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x876b('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x876b('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x876b('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x876b('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x876b('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x876b('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x876b('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x876b('0x16'),'no'),'defaultValue':_0x876b('0x16')},'announce_holdtime':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x876b('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x876b('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x876b('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x876b('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x876b('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x876b('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x876b('0x5')]},'queue_less_than':{'type':Sequelize[_0x876b('0x5')]},'periodic_announce':{'type':Sequelize[_0x876b('0x17')],'set':function(_0x38f9c5){this['setDataValue'](_0x876b('0x18'),_0x38f9c5?_0x38f9c5[_0x876b('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0x876b('0x18'))?this[_0x876b('0xe')](_0x876b('0x18'))[_0x876b('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x876b('0x5')],'defaultValue':_0x876b('0x16'),'set':function(_0x5bea8d){this['setDataValue'](_0x876b('0x1b'),_0x5bea8d?_0x5bea8d['join'](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x876b('0xe')]('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x876b('0x5')],'defaultValue':'no','set':function(_0x4f00d1){this['setDataValue'](_0x876b('0x1c'),_0x4f00d1?_0x4f00d1['join'](','):undefined);},'get':function(){return this[_0x876b('0xe')]('leavewhenempty')?this[_0x876b('0xe')](_0x876b('0x1c'))[_0x876b('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x876b('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x876b('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x876b('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x876b('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x876b('0x5')]},'acw':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':0x0,'set':function(_0x2712c2){this[_0x876b('0xc')](_0x876b('0x1e'),_0x2712c2);if(_0x2712c2){if(this[_0x876b('0xe')](_0x876b('0x1f'))<0x2){this[_0x876b('0xc')](_0x876b('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':0x0,'comment':_0x876b('0x20')},'dialMethod':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x21'),_0x876b('0x13'),_0x876b('0x14'),_0x876b('0x22'),_0x876b('0x11')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x876b('0x15')](0x4)[_0x876b('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x876b('0x24')},'dialLimitQueue':{'type':Sequelize[_0x876b('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x876b('0x25')](0x2)[_0x876b('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x876b('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x27'),'dropRate'),'defaultValue':'dropRate','comment':_0x876b('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x876b('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x876b('0x29')},'dialQueueOptions':{'type':Sequelize[_0x876b('0x5')],'defaultValue':_0x876b('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x876b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x876b('0x2b')},'dialQueueProject':{'type':Sequelize[_0x876b('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x876b('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x876b('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x876b('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0x876b('0x15')](0x5)[_0x876b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x876b('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x876b('0x15')](0x5)[_0x876b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x876b('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x876b('0x5')],'defaultValue':_0x876b('0x30')},'dialPrefix':{'type':Sequelize[_0x876b('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x876b('0x3')](_0x876b('0x31'),_0x876b('0x32'),_0x876b('0x33')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':0x0,'comment':_0x876b('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0x876b('0x15')](0x9)[_0x876b('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x876b('0x15')](0x9)[_0x876b('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x876b('0x15')](0x9)[_0x876b('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x876b('0x15')](0x9)[_0x876b('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x876b('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x876b('0x35')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x876b('0x15')](0x9)[_0x876b('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x876b('0x15')](0x9)[_0x876b('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x876b('0x36')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x876b('0x15')](0x5)[_0x876b('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x876b('0x37')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x876b('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x876b('0x38')},'dialRecallMeTimeout':{'type':Sequelize[_0x876b('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x876b('0x39')},'dialRecallInQueue':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':0x0,'comment':_0x876b('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x876b('0x3')]('DESC',_0x876b('0x3b')),'defaultValue':_0x876b('0x3c')},'dialQueueProject2':{'type':Sequelize[_0x876b('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x876b('0x3d')},'dialCutDigit':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x876b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x876b('0x3e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x876b('0x15')](0x5)[_0x876b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x876b('0x3f')},'dialDropMaxRetry':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x876b('0x15')](0x5)[_0x876b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x876b('0x40')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x876b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x876b('0x15')](0x5)[_0x876b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x876b('0x41')},'dialMachineMaxRetry':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x876b('0x42')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x876b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x876b('0x43')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x876b('0x44')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x876b('0x15')](0x5)[_0x876b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x876b('0x15')],'allowNull':!![],'comment':_0x876b('0x45')},'mandatoryDisposition':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':![],'comment':_0x876b('0x46'),'set':function(_0xf8ec32){if(!_0xf8ec32)this[_0x876b('0xc')](_0x876b('0x47'),null);this[_0x876b('0xc')]('mandatoryDisposition',_0xf8ec32);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x876b('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x876b('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x876b('0x15')](0x3)[_0x876b('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x876b('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xa021=['07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','rrmemory','roundrobin','power','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\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)'];(function(_0x774d15,_0x18c499){var _0x11c812=function(_0x237752){while(--_0x237752){_0x774d15['push'](_0x774d15['shift']());}};_0x11c812(++_0x18c499);}(_0xa021,0xc4));var _0x1a02=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0xa021[_0x267d8d];return _0x11a98f;};'use strict';var Sequelize=require(_0x1a02('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a02('0x1')],'allowNull':![],'unique':_0x1a02('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x1a02('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x1a02('0x5')},'announce':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1a02('0x3')]('rr','ringall',_0x1a02('0x6'),_0x1a02('0x7'),'random','rrmemory',_0x1a02('0x8'),_0x1a02('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x37e99a){this[_0x1a02('0xa')](_0x1a02('0xb'),_0x37e99a?_0x37e99a:'rrmemory');},'get':function(){var _0x21b19a=this[_0x1a02('0xc')](_0x1a02('0xd'));var _0x35044e=this['getDataValue'](_0x1a02('0xe'));var _0x17b16c=this[_0x1a02('0xc')](_0x1a02('0xb'));if(_0x21b19a==='inbound'){return _0x17b16c;}if(_0x35044e===_0x1a02('0xf')&&_0x17b16c===_0x1a02('0x10')||_0x35044e===_0x1a02('0xf')&&_0x17b16c===_0x1a02('0x11')){return _0x17b16c;}if(_0x35044e==='progressive'||_0x35044e==='predictive'||_0x35044e===_0x1a02('0x12')){return _0x17b16c;}return null;}},'servicelevel':{'type':Sequelize[_0x1a02('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1a02('0x13')](0xb)},'timeout':{'type':Sequelize[_0x1a02('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1a02('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1a02('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1a02('0x3')]('yes','no'),'defaultValue':_0x1a02('0x14')},'autopause':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1a02('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1a02('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1a02('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1a02('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1a02('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1a02('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no',_0x1a02('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x14'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1a02('0x1')]},'queue_youarenext':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1a02('0x1')]},'queue_quantity1':{'type':Sequelize[_0x1a02('0x1')]},'queue_quantity2':{'type':Sequelize[_0x1a02('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x1a02('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x1a02('0x16')],'set':function(_0xc39fb5){this[_0x1a02('0xa')](_0x1a02('0x17'),_0xc39fb5?_0xc39fb5[_0x1a02('0x18')](','):[]);},'get':function(){return this[_0x1a02('0xc')]('periodic_announce')?this[_0x1a02('0xc')]('periodic_announce')[_0x1a02('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':_0x1a02('0x14'),'set':function(_0x53398a){this[_0x1a02('0xa')](_0x1a02('0x1a'),_0x53398a?_0x53398a['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x1a02('0x1a'))?this['getDataValue'](_0x1a02('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':'no','set':function(_0x258bb9){this[_0x1a02('0xa')](_0x1a02('0x1b'),_0x258bb9?_0x258bb9[_0x1a02('0x18')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue'](_0x1a02('0x1b'))[_0x1a02('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x1a02('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1a02('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1a02('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1a02('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1a02('0x1')]},'description':{'type':Sequelize[_0x1a02('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x1a2845){this[_0x1a02('0xa')](_0x1a02('0x1c'),_0x1a2845);if(_0x1a2845){if(this[_0x1a02('0xc')](_0x1a02('0x1d'))<0x2){this[_0x1a02('0xa')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1a02('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1a02('0x1e')],'defaultValue':0x0,'comment':_0x1a02('0x1f')},'dialMethod':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x20'),_0x1a02('0x21'),_0x1a02('0x12'),_0x1a02('0x22'),_0x1a02('0xf')),'defaultValue':'progressive','comment':_0x1a02('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1a02('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1a02('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1a02('0x26')},'dialPowerLevel':{'type':Sequelize[_0x1a02('0x27')](0x2)[_0x1a02('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1a02('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x29'),'dropRate'),'defaultValue':'dropRate','comment':_0x1a02('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1a02('0x27')](0x2)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1a02('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1a02('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a02('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x1a02('0x2e'),'comment':_0x1a02('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a02('0x30')},'dialQueueProject':{'type':Sequelize[_0x1a02('0x1')],'comment':_0x1a02('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a02('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1a02('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a02('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1a02('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a02('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'comment':_0x1a02('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a02('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a02('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1a02('0x37')},'dialTimezone':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1a02('0x38')},'dialPrefix':{'type':Sequelize[_0x1a02('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1a02('0x39'),_0x1a02('0x3a'),_0x1a02('0x3b')),'defaultValue':_0x1a02('0x39')},'dialAMDActive':{'type':Sequelize[_0x1a02('0x1e')],'defaultValue':0x0,'comment':_0x1a02('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x1a02('0x13')](0x9)[_0x1a02('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1a02('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x1a02('0x13')](0x9)[_0x1a02('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1a02('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1a02('0x13')](0x9)[_0x1a02('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1a02('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1a02('0x13')](0x9)[_0x1a02('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a02('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x1a02('0x13')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1a02('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1a02('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1a02('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1a02('0x43')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1a02('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1a02('0x44')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1a02('0x13')](0x9)[_0x1a02('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a02('0x45')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x1a02('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1a02('0x46')},'dialRecallInQueue':{'type':Sequelize[_0x1a02('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1a02('0x3')](_0x1a02('0x47'),_0x1a02('0x48')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x1a02('0x1')],'comment':_0x1a02('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1a02('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a02('0x49')},'dialCutDigit':{'type':Sequelize[_0x1a02('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a02('0x4a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1a02('0x13')](0x5)[_0x1a02('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a02('0x4b')},'dialDropMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a02('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0x1a02('0x13')](0x5)[_0x1a02('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a02('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a02('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a02('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a02('0x4f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1a02('0x13')](0x5)[_0x1a02('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1a02('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1a02('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a02('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1a02('0x51'),'set':function(_0x19aeae){if(!_0x19aeae)this[_0x1a02('0xa')](_0x1a02('0x52'),null);this['setDataValue'](_0x1a02('0x53'),_0x19aeae);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1a02('0x13')](0x3)[_0x1a02('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1a02('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1a02('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1a02('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9b022e4..2f2ec9c 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 _0x2dc3=['getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents','voicePause','flatMap','forEach','penalty','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','transaction','removeTeams','ids','isEmpty','addAgents','spread','userVoiceQueue:save','online','removeAgents','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_contacts','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','h.scheduledat=?','removeLists','getBlackLists','addBlackLists','into','cm_hopper_black','ListId','NOW()','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','type','UserProfileResource','then','end','error','stack','name','send','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','options','VoiceQueue','includeAll','findAll','rows','catch','show','params','keys','length','include','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','body','updatedAt','userProfileId','destroy'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2dc3,0x127));var _0x32dc=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2dc3[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32dc('0x0'));var zipdir=require(_0x32dc('0x1'));var jsonpatch=require(_0x32dc('0x2'));var rp=require(_0x32dc('0x3'));var moment=require(_0x32dc('0x4'));var BPromise=require(_0x32dc('0x5'));var Mustache=require(_0x32dc('0x6'));var util=require(_0x32dc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x32dc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32dc('0x9'));var _=require('lodash');var squel=require(_0x32dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32dc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x32dc('0xc'));var Papa=require(_0x32dc('0xd'));var Redis=require(_0x32dc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32dc('0xf'));var hardwareService=require(_0x32dc('0x10'));var logger=require(_0x32dc('0x11'))(_0x32dc('0x12'));var utils=require(_0x32dc('0x13'));var config=require(_0x32dc('0x14'));var licenseUtil=require(_0x32dc('0x15'));var db=require('../../mysqldb')['db'];config[_0x32dc('0x16')]=_['defaults'](config[_0x32dc('0x16')],{'host':_0x32dc('0x17'),'port':0x18eb});var socket=require(_0x32dc('0x18'))(new Redis(config['redis']));require(_0x32dc('0x19'))[_0x32dc('0x1a')](socket);function respondWithStatusCode(_0x5e373a,_0x1fb775){_0x1fb775=_0x1fb775||0xcc;return function(_0x4bf4ca){if(_0x4bf4ca){return _0x5e373a[_0x32dc('0x1b')](_0x1fb775);}return _0x5e373a['status'](_0x1fb775)['end']();};}function respondWithResult(_0x497b11,_0x2e1a9d){_0x2e1a9d=_0x2e1a9d||0xc8;return function(_0x328940){if(_0x328940){return _0x497b11[_0x32dc('0x1c')](_0x2e1a9d)['json'](_0x328940);}};}function respondWithFilteredResult(_0x284dfe,_0x32d0d1){return function(_0x38064a){if(_0x38064a){var _0x47ccb4=typeof _0x32d0d1[_0x32dc('0x1d')]===_0x32dc('0x1e')&&typeof _0x32d0d1[_0x32dc('0x1f')]===_0x32dc('0x1e');var _0x5bbd7c=_0x38064a[_0x32dc('0x20')];var _0x46249a=_0x47ccb4?0x0:_0x32d0d1[_0x32dc('0x1d')];var _0xc07d3b=_0x47ccb4?_0x38064a[_0x32dc('0x20')]:_0x32d0d1[_0x32dc('0x1d')]+_0x32d0d1[_0x32dc('0x1f')];var _0x33eae0;if(_0xc07d3b>=_0x5bbd7c){_0xc07d3b=_0x5bbd7c;_0x33eae0=0xc8;}else{_0x33eae0=0xce;}_0x284dfe['status'](_0x33eae0);return _0x284dfe[_0x32dc('0x21')](_0x32dc('0x22'),_0x46249a+'-'+_0xc07d3b+'/'+_0x5bbd7c)[_0x32dc('0x23')](_0x38064a);}return null;};}function patchUpdates(_0x2a4bf9){return function(_0x5ed495){try{jsonpatch[_0x32dc('0x24')](_0x5ed495,_0x2a4bf9,!![]);}catch(_0x3582af){return BPromise[_0x32dc('0x25')](_0x3582af);}return _0x5ed495[_0x32dc('0x26')]();};}function saveUpdates(_0x57e1e3,_0x36a190){return function(_0x18fc9c){if(_0x18fc9c){return _0x18fc9c[_0x32dc('0x27')](_0x57e1e3)['then'](function(_0x51af54){return _0x51af54;});}return null;};}function removeEntity(_0x3718e1,_0x4a0e6e){return function(_0x2e04ea){if(_0x2e04ea){return _0x2e04ea['destroy']()['then'](function(){var _0x50ccf4=_0x2e04ea[_0x32dc('0x28')]({'plain':!![]});var _0x4a1e63=[{'name':_0x32dc('0x29'),'value':_0x32dc('0x2a'),'ignore':![]},{'name':'QueueCampaigns','value':_0x32dc('0x2b'),'ignore':![]}];var _0x386b01=_(_0x4a1e63)[_0x32dc('0x2c')](_0x32dc('0x2d'))[_0x32dc('0x2e')](_0x32dc('0x2f'))[_0x32dc('0x2f')]();if(_['includes'](_0x386b01,_0x50ccf4[_0x32dc('0x30')])){return;}var _0x38c113=_['find'](_0x4a1e63,['value',_0x50ccf4[_0x32dc('0x30')]])['name'];return db[_0x32dc('0x31')]['destroy']({'where':{'type':_0x38c113,'resourceId':_0x50ccf4['id']}})[_0x32dc('0x32')](function(){return _0x2e04ea;});})[_0x32dc('0x32')](function(){_0x3718e1['status'](0xcc)[_0x32dc('0x33')]();});}};}function handleEntityNotFound(_0x194fcb,_0x1ec064){return function(_0x4b9c0e){if(!_0x4b9c0e){_0x194fcb[_0x32dc('0x1b')](0x194);}return _0x4b9c0e;};}function handleError(_0x2f1528,_0x3c9afb){_0x3c9afb=_0x3c9afb||0x1f4;return function(_0x2d7761){logger[_0x32dc('0x34')](_0x2d7761[_0x32dc('0x35')]);if(_0x2d7761[_0x32dc('0x36')]){delete _0x2d7761[_0x32dc('0x36')];}_0x2f1528[_0x32dc('0x1c')](_0x3c9afb)[_0x32dc('0x37')](_0x2d7761);};}exports['index']=function(_0x33a602,_0x27df8c){var _0x1fb80f={},_0x267fc1={},_0x29266f={'count':0x0,'rows':[]};var _0x56a34c=_[_0x32dc('0x2e')](db['VoiceQueue'][_0x32dc('0x38')],function(_0x57537b){return{'name':_0x57537b[_0x32dc('0x39')],'type':_0x57537b['type']['key']};});_0x267fc1[_0x32dc('0x3a')]=_[_0x32dc('0x2e')](_0x56a34c,_0x32dc('0x36'));_0x267fc1[_0x32dc('0x3b')]=_['keys'](_0x33a602[_0x32dc('0x3b')]);_0x267fc1[_0x32dc('0x3c')]=_[_0x32dc('0x3d')](_0x267fc1[_0x32dc('0x3a')],_0x267fc1['query']);_0x1fb80f[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x267fc1[_0x32dc('0x3a')],qs[_0x32dc('0x3f')](_0x33a602[_0x32dc('0x3b')]['fields']));_0x1fb80f['attributes']=_0x1fb80f['attributes']['length']?_0x1fb80f['attributes']:_0x267fc1[_0x32dc('0x3a')];if(!_0x33a602[_0x32dc('0x3b')]['hasOwnProperty'](_0x32dc('0x40'))){_0x1fb80f[_0x32dc('0x1f')]=qs['limit'](_0x33a602[_0x32dc('0x3b')][_0x32dc('0x1f')]);_0x1fb80f[_0x32dc('0x1d')]=qs['offset'](_0x33a602['query'][_0x32dc('0x1d')]);}_0x1fb80f[_0x32dc('0x41')]=qs[_0x32dc('0x42')](_0x33a602[_0x32dc('0x3b')][_0x32dc('0x42')]);_0x1fb80f[_0x32dc('0x43')]=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x33a602[_0x32dc('0x3b')],_0x267fc1[_0x32dc('0x3c')]),_0x56a34c);if(_0x33a602[_0x32dc('0x3b')][_0x32dc('0x2c')]){_0x1fb80f[_0x32dc('0x43')]=_['merge'](_0x1fb80f['where'],{'$or':_[_0x32dc('0x2e')](_0x56a34c,function(_0x2bf523){if(_0x2bf523[_0x32dc('0x30')]!==_0x32dc('0x45')){var _0x589d3f={};_0x589d3f[_0x2bf523[_0x32dc('0x36')]]={'$like':'%'+_0x33a602[_0x32dc('0x3b')][_0x32dc('0x2c')]+'%'};return _0x589d3f;}})});}_0x1fb80f=_['merge']({},_0x1fb80f,_0x33a602[_0x32dc('0x46')]);var _0x4b0509={'where':_0x1fb80f[_0x32dc('0x43')]};return db[_0x32dc('0x47')][_0x32dc('0x20')](_0x4b0509)[_0x32dc('0x32')](function(_0x56f3d4){_0x29266f[_0x32dc('0x20')]=_0x56f3d4;if(_0x33a602['query'][_0x32dc('0x48')]){_0x1fb80f['include']=[{'all':!![]}];}return db[_0x32dc('0x47')][_0x32dc('0x49')](_0x1fb80f);})[_0x32dc('0x32')](function(_0x1d2490){_0x29266f[_0x32dc('0x4a')]=_0x1d2490;return _0x29266f;})[_0x32dc('0x32')](respondWithFilteredResult(_0x27df8c,_0x1fb80f))[_0x32dc('0x4b')](handleError(_0x27df8c,null));};exports[_0x32dc('0x4c')]=function(_0x85550,_0x1178f8){var _0x241d53={'raw':![],'where':{'id':_0x85550[_0x32dc('0x4d')]['id']}},_0x5a5bdc={};_0x5a5bdc[_0x32dc('0x3a')]=_[_0x32dc('0x4e')](db[_0x32dc('0x47')]['rawAttributes']);_0x5a5bdc[_0x32dc('0x3b')]=_['keys'](_0x85550[_0x32dc('0x3b')]);_0x5a5bdc['filters']=_['intersection'](_0x5a5bdc[_0x32dc('0x3a')],_0x5a5bdc[_0x32dc('0x3b')]);_0x241d53[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x5a5bdc['model'],qs[_0x32dc('0x3f')](_0x85550[_0x32dc('0x3b')][_0x32dc('0x3f')]));_0x241d53['attributes']=_0x241d53['attributes'][_0x32dc('0x4f')]?_0x241d53['attributes']:_0x5a5bdc[_0x32dc('0x3a')];if(_0x85550['query']['includeAll']){_0x241d53[_0x32dc('0x50')]=[{'all':!![]}];}_0x241d53=_[_0x32dc('0x51')]({},_0x241d53,_0x85550[_0x32dc('0x46')]);return db[_0x32dc('0x47')]['find'](_0x241d53)[_0x32dc('0x32')](handleEntityNotFound(_0x1178f8,null))['then'](respondWithResult(_0x1178f8,null))[_0x32dc('0x4b')](handleError(_0x1178f8,null));};exports[_0x32dc('0x52')]=function(_0x433997,_0x3130d9){return db[_0x32dc('0x47')]['create'](_0x433997['body'],{})[_0x32dc('0x32')](function(_0x4e81b2){var _0x3dd105=_0x433997[_0x32dc('0x53')][_0x32dc('0x28')]({'plain':!![]});if(!_0x3dd105)throw new Error(_0x32dc('0x54'));if(_0x3dd105[_0x32dc('0x55')]===_0x32dc('0x53')){var _0x256fae=_0x4e81b2[_0x32dc('0x28')]({'plain':!![]});var _0x1dc573=[{'name':_0x32dc('0x29'),'value':_0x32dc('0x2a')},{'name':_0x32dc('0x56'),'value':_0x32dc('0x2b')}];var _0x931a1a=_['find'](_0x1dc573,[_0x32dc('0x2f'),_0x256fae['type']])[_0x32dc('0x36')];return db[_0x32dc('0x57')][_0x32dc('0x58')]({'where':{'name':_0x931a1a,'userProfileId':_0x3dd105['userProfileId']},'raw':!![]})[_0x32dc('0x32')](function(_0x238d74){if(_0x238d74&&_0x238d74[_0x32dc('0x59')]===0x0){return db[_0x32dc('0x31')][_0x32dc('0x52')]({'name':_0x256fae[_0x32dc('0x36')],'resourceId':_0x256fae['id'],'type':_0x238d74['name'],'sectionId':_0x238d74['id']},{})['then'](function(){return _0x4e81b2;});}else{return _0x4e81b2;}})[_0x32dc('0x4b')](function(_0x32c973){logger['error'](_0x32dc('0x5a'),_0x32c973);throw _0x32c973;});}return _0x4e81b2;})['then'](respondWithResult(_0x3130d9,0xc9))[_0x32dc('0x4b')](handleError(_0x3130d9,null));};exports['clone']=function(_0x394a47,_0x162eb1){var _0xdf9dc9={'where':{'id':_0x394a47[_0x32dc('0x4d')]['id']}},_0x328531={};_0x328531[_0x32dc('0x3a')]=_['keys'](db[_0x32dc('0x47')]['rawAttributes']);_0xdf9dc9[_0x32dc('0x3e')]=_['intersection'](_0x328531[_0x32dc('0x3a')],qs[_0x32dc('0x3f')](_0x394a47[_0x32dc('0x3b')][_0x32dc('0x3f')]));_0xdf9dc9[_0x32dc('0x3e')]=_0xdf9dc9[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0xdf9dc9[_0x32dc('0x3e')]:_0x328531[_0x32dc('0x3a')];if(_0x394a47['query'][_0x32dc('0x48')]){_0xdf9dc9['include']=[{'all':!![]}];}_0xdf9dc9=_['merge']({},_0xdf9dc9,_0x394a47[_0x32dc('0x46')]);return db[_0x32dc('0x47')][_0x32dc('0x58')](_0xdf9dc9)['then'](handleEntityNotFound(_0x162eb1,null))[_0x32dc('0x32')](function(_0x432525){if(_0x432525){var _0x25f22d=_0x432525[_0x32dc('0x28')]({'plain':!![]});_0x25f22d=qs[_0x32dc('0x5b')](_0x25f22d,['id',_0x32dc('0x5c'),'updatedAt']);_0x394a47[_0x32dc('0x5d')]=_[_0x32dc('0x5b')](_0x394a47[_0x32dc('0x5d')],['id','createdAt',_0x32dc('0x5e')]);return db[_0x32dc('0x47')]['create'](_[_0x32dc('0x51')](_0x25f22d,_0x394a47[_0x32dc('0x5d')]),{'include':_0x394a47[_0x32dc('0x3b')][_0x32dc('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x2f4bfa){var _0x2a542d=_0x394a47[_0x32dc('0x53')][_0x32dc('0x28')]({'plain':!![]});if(!_0x2a542d)throw new Error(_0x32dc('0x54'));if(_0x2a542d[_0x32dc('0x55')]===_0x32dc('0x53')){var _0x3f03ec=_0x2f4bfa[_0x32dc('0x28')]({'plain':!![]});var _0x5acb13=[{'name':_0x32dc('0x29'),'value':_0x32dc('0x2a')},{'name':_0x32dc('0x56'),'value':_0x32dc('0x2b')}];var _0x538680=_[_0x32dc('0x58')](_0x5acb13,[_0x32dc('0x2f'),_0x3f03ec[_0x32dc('0x30')]])[_0x32dc('0x36')];return db[_0x32dc('0x57')][_0x32dc('0x58')]({'where':{'name':_0x538680,'userProfileId':_0x2a542d[_0x32dc('0x5f')]},'raw':!![]})[_0x32dc('0x32')](function(_0x215b58){if(_0x215b58&&_0x215b58[_0x32dc('0x59')]===0x0){return db[_0x32dc('0x31')][_0x32dc('0x52')]({'name':_0x3f03ec[_0x32dc('0x36')],'resourceId':_0x3f03ec['id'],'type':_0x215b58[_0x32dc('0x36')],'sectionId':_0x215b58['id']},{})[_0x32dc('0x32')](function(){return _0x2f4bfa;});}else{return _0x2f4bfa;}})[_0x32dc('0x4b')](function(_0x2d22f0){logger[_0x32dc('0x34')](_0x32dc('0x5a'),_0x2d22f0);throw _0x2d22f0;});}return _0x2f4bfa;});}})['then'](respondWithResult(_0x162eb1,0xc9))[_0x32dc('0x4b')](handleError(_0x162eb1,null));};exports[_0x32dc('0x27')]=function(_0x46b242,_0x1d91ee){if(_0x46b242['body']['id']){delete _0x46b242[_0x32dc('0x5d')]['id'];}return db[_0x32dc('0x47')][_0x32dc('0x58')]({'where':{'id':_0x46b242[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x1d91ee,null))[_0x32dc('0x32')](saveUpdates(_0x46b242[_0x32dc('0x5d')],null))[_0x32dc('0x32')](respondWithResult(_0x1d91ee,null))[_0x32dc('0x4b')](handleError(_0x1d91ee,null));};exports[_0x32dc('0x60')]=function(_0x3d6afa,_0x3b260d){return db['VoiceQueue'][_0x32dc('0x58')]({'where':{'id':_0x3d6afa[_0x32dc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b260d,null))[_0x32dc('0x32')](removeEntity(_0x3b260d,null))[_0x32dc('0x4b')](handleError(_0x3b260d,null));};exports[_0x32dc('0x61')]=function(_0x6fa799,_0x464cbd,_0x100c0e){var _0x41d8be={'raw':![],'where':{}};var _0x5d289b={};var _0x4114b6={'count':0x0,'rows':[]};return db[_0x32dc('0x47')][_0x32dc('0x62')]({'where':{'id':_0x6fa799[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x464cbd,null))[_0x32dc('0x32')](function(_0x4f534b){if(_0x4f534b){_0x5d289b[_0x32dc('0x3a')]=_['keys'](db[_0x32dc('0x63')][_0x32dc('0x38')]);_0x5d289b['query']=_[_0x32dc('0x4e')](_0x6fa799[_0x32dc('0x3b')]);_0x5d289b[_0x32dc('0x3c')]=_['intersection'](_0x5d289b[_0x32dc('0x3a')],_0x5d289b[_0x32dc('0x3b')]);_0x41d8be[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x5d289b[_0x32dc('0x3a')],qs[_0x32dc('0x3f')](_0x6fa799[_0x32dc('0x3b')]['fields']));_0x41d8be[_0x32dc('0x3e')]=_0x41d8be['attributes'][_0x32dc('0x4f')]?_0x41d8be[_0x32dc('0x3e')]:_0x5d289b['model'];if(!_0x6fa799[_0x32dc('0x3b')][_0x32dc('0x64')](_0x32dc('0x40'))){_0x41d8be[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x6fa799[_0x32dc('0x3b')][_0x32dc('0x1f')]);_0x41d8be['offset']=qs[_0x32dc('0x1d')](_0x6fa799['query'][_0x32dc('0x1d')]);}_0x41d8be[_0x32dc('0x41')]=qs[_0x32dc('0x42')](_0x6fa799[_0x32dc('0x3b')][_0x32dc('0x42')]);_0x41d8be[_0x32dc('0x43')]=qs['filters'](_[_0x32dc('0x44')](_0x6fa799[_0x32dc('0x3b')],_0x5d289b[_0x32dc('0x3c')]));_0x41d8be[_0x32dc('0x43')][_0x32dc('0x65')]=_0x4f534b['id'];if(_0x6fa799[_0x32dc('0x3b')][_0x32dc('0x2c')]){_0x41d8be[_0x32dc('0x43')]=_[_0x32dc('0x51')](_0x41d8be[_0x32dc('0x43')],{'$or':_['map'](_0x41d8be['attributes'],function(_0x5e72d9){var _0x26a498={};_0x26a498[_0x5e72d9]={'$like':'%'+_0x6fa799[_0x32dc('0x3b')][_0x32dc('0x2c')]+'%'};return _0x26a498;})});}_0x41d8be=_[_0x32dc('0x51')]({},_0x41d8be,_0x6fa799[_0x32dc('0x46')]);return db[_0x32dc('0x63')][_0x32dc('0x20')]({'where':_0x41d8be[_0x32dc('0x43')]})[_0x32dc('0x32')](function(_0x5746d3){_0x4114b6[_0x32dc('0x20')]=_0x5746d3;if(_0x6fa799[_0x32dc('0x3b')][_0x32dc('0x48')]){_0x41d8be[_0x32dc('0x50')]=[{'all':!![]}];}return db['CmHopper'][_0x32dc('0x49')](_0x41d8be);})[_0x32dc('0x32')](function(_0x136a9e){_0x4114b6[_0x32dc('0x4a')]=_0x136a9e;return _0x4114b6;});}})['then'](respondWithFilteredResult(_0x464cbd,_0x41d8be))[_0x32dc('0x4b')](handleError(_0x464cbd,null));};exports[_0x32dc('0x66')]=function(_0x4f2623,_0x5c02a1,_0x3d9186){var _0x4932c4={'raw':!![],'where':{}};var _0x5da476={};var _0x3351c1={'count':0x0,'rows':[]};return db[_0x32dc('0x47')][_0x32dc('0x62')]({'where':{'id':_0x4f2623[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x5c02a1,null))[_0x32dc('0x32')](function(_0x16acd3){if(_0x16acd3){_0x5da476['model']=_[_0x32dc('0x4e')](db[_0x32dc('0x67')][_0x32dc('0x38')]);_0x5da476[_0x32dc('0x3b')]=_[_0x32dc('0x4e')](_0x4f2623[_0x32dc('0x3b')]);_0x5da476[_0x32dc('0x3c')]=_['intersection'](_0x5da476['model'],_0x5da476['query']);_0x4932c4[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x5da476[_0x32dc('0x3a')],qs[_0x32dc('0x3f')](_0x4f2623[_0x32dc('0x3b')][_0x32dc('0x3f')]));_0x4932c4[_0x32dc('0x3e')]=_0x4932c4[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0x4932c4[_0x32dc('0x3e')]:_0x5da476[_0x32dc('0x3a')];if(!_0x4f2623['query'][_0x32dc('0x64')]('nolimit')){_0x4932c4[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x4f2623['query'][_0x32dc('0x1f')]);_0x4932c4[_0x32dc('0x1d')]=qs[_0x32dc('0x1d')](_0x4f2623[_0x32dc('0x3b')][_0x32dc('0x1d')]);}_0x4932c4['order']=qs[_0x32dc('0x42')](_0x4f2623['query'][_0x32dc('0x42')]);_0x4932c4['where']=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x4f2623['query'],_0x5da476[_0x32dc('0x3c')]));_0x4932c4['where'][_0x32dc('0x65')]=_0x16acd3['id'];if(_0x4f2623[_0x32dc('0x3b')]['filter']){_0x4932c4[_0x32dc('0x43')]=_[_0x32dc('0x51')](_0x4932c4[_0x32dc('0x43')],{'$or':_[_0x32dc('0x2e')](_0x4932c4[_0x32dc('0x3e')],function(_0x3393e3){var _0x4691a7={};_0x4691a7[_0x3393e3]={'$like':'%'+_0x4f2623[_0x32dc('0x3b')]['filter']+'%'};return _0x4691a7;})});}_0x4932c4=_[_0x32dc('0x51')]({},_0x4932c4,_0x4f2623[_0x32dc('0x46')]);return db[_0x32dc('0x67')]['count']({'where':_0x4932c4['where']})[_0x32dc('0x32')](function(_0x5e412f){_0x3351c1['count']=_0x5e412f;if(_0x4f2623[_0x32dc('0x3b')]['includeAll']){_0x4932c4['include']=[{'all':!![]}];}return db[_0x32dc('0x67')]['findAll'](_0x4932c4);})[_0x32dc('0x32')](function(_0x511207){_0x3351c1[_0x32dc('0x4a')]=_0x511207;return _0x3351c1;});}})['then'](respondWithFilteredResult(_0x5c02a1,_0x4932c4))[_0x32dc('0x4b')](handleError(_0x5c02a1,null));};exports['getHopperFinals']=function(_0x2ce162,_0x11a869,_0x3f49d1){var _0x33bd80={'raw':!![],'where':{}};var _0x4fbd27={};var _0x7dbb06={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x32dc('0x62')]({'where':{'id':_0x2ce162['params']['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x11a869,null))['then'](function(_0xbdcb62){if(_0xbdcb62){_0x4fbd27['model']=_[_0x32dc('0x4e')](db[_0x32dc('0x68')][_0x32dc('0x38')]);_0x4fbd27['query']=_['keys'](_0x2ce162['query']);_0x4fbd27[_0x32dc('0x3c')]=_[_0x32dc('0x3d')](_0x4fbd27[_0x32dc('0x3a')],_0x4fbd27[_0x32dc('0x3b')]);_0x33bd80['attributes']=_[_0x32dc('0x3d')](_0x4fbd27[_0x32dc('0x3a')],qs['fields'](_0x2ce162['query'][_0x32dc('0x3f')]));_0x33bd80[_0x32dc('0x3e')]=_0x33bd80[_0x32dc('0x3e')]['length']?_0x33bd80[_0x32dc('0x3e')]:_0x4fbd27[_0x32dc('0x3a')];if(!_0x2ce162[_0x32dc('0x3b')][_0x32dc('0x64')](_0x32dc('0x40'))){_0x33bd80[_0x32dc('0x1f')]=qs['limit'](_0x2ce162['query']['limit']);_0x33bd80[_0x32dc('0x1d')]=qs['offset'](_0x2ce162[_0x32dc('0x3b')][_0x32dc('0x1d')]);}_0x33bd80[_0x32dc('0x41')]=qs[_0x32dc('0x42')](_0x2ce162[_0x32dc('0x3b')][_0x32dc('0x42')]);_0x33bd80[_0x32dc('0x43')]=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x2ce162[_0x32dc('0x3b')],_0x4fbd27[_0x32dc('0x3c')]));_0x33bd80[_0x32dc('0x43')][_0x32dc('0x65')]=_0xbdcb62['id'];if(_0x2ce162['query'][_0x32dc('0x2c')]){_0x33bd80['where']=_[_0x32dc('0x51')](_0x33bd80[_0x32dc('0x43')],{'$or':_[_0x32dc('0x2e')](_0x33bd80[_0x32dc('0x3e')],function(_0x4734c8){var _0x2e8702={};_0x2e8702[_0x4734c8]={'$like':'%'+_0x2ce162['query']['filter']+'%'};return _0x2e8702;})});}_0x33bd80=_[_0x32dc('0x51')]({},_0x33bd80,_0x2ce162[_0x32dc('0x46')]);return db[_0x32dc('0x68')][_0x32dc('0x20')]({'where':_0x33bd80[_0x32dc('0x43')]})[_0x32dc('0x32')](function(_0x42d331){_0x7dbb06['count']=_0x42d331;if(_0x2ce162[_0x32dc('0x3b')][_0x32dc('0x48')]){_0x33bd80['include']=[{'all':!![]}];}return db[_0x32dc('0x68')][_0x32dc('0x49')](_0x33bd80);})[_0x32dc('0x32')](function(_0x56bf20){_0x7dbb06[_0x32dc('0x4a')]=_0x56bf20;return _0x7dbb06;});}})[_0x32dc('0x32')](respondWithFilteredResult(_0x11a869,_0x33bd80))[_0x32dc('0x4b')](handleError(_0x11a869,null));};exports[_0x32dc('0x69')]=function(_0x5a97f6,_0x561b7d,_0x5d73db){var _0x5db027={'raw':!![],'where':{}};var _0x19433f={};var _0xee585={'count':0x0,'rows':[]};return db[_0x32dc('0x47')][_0x32dc('0x62')]({'where':{'id':_0x5a97f6[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x561b7d,null))[_0x32dc('0x32')](function(_0x3b026e){if(_0x3b026e){_0x19433f[_0x32dc('0x3a')]=_['keys'](db[_0x32dc('0x6a')]['rawAttributes']);_0x19433f[_0x32dc('0x3b')]=_[_0x32dc('0x4e')](_0x5a97f6[_0x32dc('0x3b')]);_0x19433f['filters']=_[_0x32dc('0x3d')](_0x19433f[_0x32dc('0x3a')],_0x19433f[_0x32dc('0x3b')]);_0x5db027[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x19433f['model'],qs[_0x32dc('0x3f')](_0x5a97f6[_0x32dc('0x3b')][_0x32dc('0x3f')]));_0x5db027['attributes']=_0x5db027[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0x5db027[_0x32dc('0x3e')]:_0x19433f[_0x32dc('0x3a')];if(!_0x5a97f6['query']['hasOwnProperty'](_0x32dc('0x40'))){_0x5db027[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x5a97f6[_0x32dc('0x3b')][_0x32dc('0x1f')]);_0x5db027[_0x32dc('0x1d')]=qs[_0x32dc('0x1d')](_0x5a97f6['query'][_0x32dc('0x1d')]);}_0x5db027[_0x32dc('0x41')]=qs[_0x32dc('0x42')](_0x5a97f6['query']['sort']);_0x5db027['where']=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x5a97f6[_0x32dc('0x3b')],_0x19433f[_0x32dc('0x3c')]));_0x5db027[_0x32dc('0x43')][_0x32dc('0x65')]=_0x3b026e['id'];if(_0x5a97f6['query'][_0x32dc('0x2c')]){_0x5db027['where']=_[_0x32dc('0x51')](_0x5db027['where'],{'$or':_[_0x32dc('0x2e')](_0x5db027[_0x32dc('0x3e')],function(_0x66587f){var _0x250240={};_0x250240[_0x66587f]={'$like':'%'+_0x5a97f6[_0x32dc('0x3b')]['filter']+'%'};return _0x250240;})});}_0x5db027=_[_0x32dc('0x51')]({},_0x5db027,_0x5a97f6[_0x32dc('0x46')]);return db[_0x32dc('0x6a')][_0x32dc('0x20')]({'where':_0x5db027[_0x32dc('0x43')]})[_0x32dc('0x32')](function(_0x4da069){_0xee585[_0x32dc('0x20')]=_0x4da069;if(_0x5a97f6[_0x32dc('0x3b')][_0x32dc('0x48')]){_0x5db027[_0x32dc('0x50')]=[{'all':!![]}];}return db[_0x32dc('0x6a')][_0x32dc('0x49')](_0x5db027);})['then'](function(_0x47f402){_0xee585[_0x32dc('0x4a')]=_0x47f402;return _0xee585;});}})[_0x32dc('0x32')](respondWithFilteredResult(_0x561b7d,_0x5db027))[_0x32dc('0x4b')](handleError(_0x561b7d,null));};exports['getTeams']=function(_0x1fe4e4,_0x1000b5,_0x39f3f8){var _0x123fd3={};var _0x44a6ce={};var _0x181fe8;var _0x148102;return db[_0x32dc('0x47')][_0x32dc('0x62')]({'where':{'id':_0x1fe4e4[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x1000b5,null))[_0x32dc('0x32')](function(_0x22dcf2){if(_0x22dcf2){_0x181fe8=_0x22dcf2;_0x44a6ce[_0x32dc('0x3a')]=_['keys'](db[_0x32dc('0x6b')][_0x32dc('0x38')]);_0x44a6ce['query']=_[_0x32dc('0x4e')](_0x1fe4e4[_0x32dc('0x3b')]);_0x44a6ce[_0x32dc('0x3c')]=_[_0x32dc('0x3d')](_0x44a6ce[_0x32dc('0x3a')],_0x44a6ce[_0x32dc('0x3b')]);_0x123fd3[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x44a6ce[_0x32dc('0x3a')],qs[_0x32dc('0x3f')](_0x1fe4e4['query'][_0x32dc('0x3f')]));_0x123fd3[_0x32dc('0x3e')]=_0x123fd3[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0x123fd3['attributes']:_0x44a6ce[_0x32dc('0x3a')];_0x123fd3[_0x32dc('0x41')]=qs[_0x32dc('0x42')](_0x1fe4e4[_0x32dc('0x3b')][_0x32dc('0x42')]);_0x123fd3['where']=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x1fe4e4['query'],_0x44a6ce['filters']));if(_0x1fe4e4[_0x32dc('0x3b')]['filter']){_0x123fd3[_0x32dc('0x43')]=_[_0x32dc('0x51')](_0x123fd3[_0x32dc('0x43')],{'$or':_[_0x32dc('0x2e')](_0x123fd3[_0x32dc('0x3e')],function(_0x565bb3){var _0x3c8d7e={};_0x3c8d7e[_0x565bb3]={'$like':'%'+_0x1fe4e4[_0x32dc('0x3b')][_0x32dc('0x2c')]+'%'};return _0x3c8d7e;})});}_0x123fd3=_[_0x32dc('0x51')]({},_0x123fd3,_0x1fe4e4[_0x32dc('0x46')]);return _0x181fe8[_0x32dc('0x6c')](_0x123fd3);}})['then'](function(_0x1b4eda){if(_0x1b4eda){_0x148102=_0x1b4eda[_0x32dc('0x4f')];if(!_0x1fe4e4['query'][_0x32dc('0x64')]('nolimit')){_0x123fd3[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x1fe4e4['query'][_0x32dc('0x1f')]);_0x123fd3['offset']=qs[_0x32dc('0x1d')](_0x1fe4e4[_0x32dc('0x3b')][_0x32dc('0x1d')]);}return _0x181fe8[_0x32dc('0x6c')](_0x123fd3);}})[_0x32dc('0x32')](function(_0x4a09cd){if(_0x4a09cd){return _0x4a09cd?{'count':_0x148102,'rows':_0x4a09cd}:null;}})[_0x32dc('0x32')](respondWithResult(_0x1000b5,null))[_0x32dc('0x4b')](handleError(_0x1000b5,null));};exports[_0x32dc('0x6d')]=function(_0x49fd40,_0x332d11,_0x4fdc09){var _0x4ba3e4=_0x49fd40[_0x32dc('0x5d')][_0x32dc('0x6e')];var _0x2498c2=_[_0x32dc('0x2e')](_0x4ba3e4,'id');return db[_0x32dc('0x6b')][_0x32dc('0x49')]({'where':{'id':_0x2498c2},'attributes':['id'],'include':[{'model':db[_0x32dc('0x6f')],'as':_0x32dc('0x70'),'attributes':['id',_0x32dc('0x36'),'online',_0x32dc('0x71'),'interface'],'raw':!![]}]})[_0x32dc('0x32')](function(_0x2e8c3d){if(_0x2e8c3d){var _0x2e6bd9=_[_0x32dc('0x72')](_0x2e8c3d,function(_0x5aa8f4){var _0x17c724=_0x5aa8f4['get']({'plain':!![]});_0x17c724[_0x32dc('0x70')][_0x32dc('0x73')](function(_0x52dff8){_0x52dff8[_0x32dc('0x74')]=_[_0x32dc('0x58')](_0x4ba3e4,{'id':_0x17c724['id']})[_0x32dc('0x74')];});return _0x17c724[_0x32dc('0x70')];});return db['VoiceQueue']['find']({'where':{'id':_0x49fd40[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](function(_0x493c27){return db['sequelize']['transaction'](function(_0x221183){return _0x493c27['addTeams'](_0x2498c2,{'transaction':_0x221183})[_0x32dc('0x32')](function(){return BPromise[_0x32dc('0x75')](_0x4ba3e4,function(_0x577fde){return db['TeamVoiceQueue'][_0x32dc('0x76')]({'TeamId':_0x577fde['id'],'VoiceQueueId':_0x49fd40['params']['id'],'penalty':_0x577fde[_0x32dc('0x74')]},{'transaction':_0x221183});});})[_0x32dc('0x32')](function(){return BPromise[_0x32dc('0x75')](_0x2e6bd9,function(_0x17121b){return db[_0x32dc('0x77')][_0x32dc('0x78')]({'where':{'UserId':_0x17121b['id'],'VoiceQueueId':_0x49fd40['params']['id']},'defaults':{'penalty':_0x17121b[_0x32dc('0x74')]},'transaction':_0x221183});});})['then'](function(){return BPromise['each'](_['filter'](_0x2e6bd9,{'online':!![]}),function(_0x5553c3){return db[_0x32dc('0x79')][_0x32dc('0x76')]({'membername':_0x5553c3[_0x32dc('0x36')],'UserId':_0x5553c3['id'],'queue_name':_0x493c27[_0x32dc('0x36')],'VoiceQueueId':_0x493c27['id'],'interface':_[_0x32dc('0x7a')](_0x5553c3[_0x32dc('0x7b')])?util[_0x32dc('0x7c')](_0x32dc('0x7d'),_0x5553c3[_0x32dc('0x36')]):_0x5553c3[_0x32dc('0x7b')],'paused':_0x5553c3[_0x32dc('0x71')]||![],'penalty':_0x5553c3[_0x32dc('0x74')]},{'transaction':_0x221183});});})['then'](function(){_0x2e6bd9[_0x32dc('0x73')](function(_0x2d0148){socket[_0x32dc('0x7e')]('userVoiceQueue:save',{'UserId':_0x2d0148['id'],'VoiceQueueId':_0x493c27['id']});});});});});}})[_0x32dc('0x32')](respondWithStatusCode(_0x332d11,null))['catch'](handleError(_0x332d11,null));};exports['removeTeams']=function(_0x88fa9,_0x11607b,_0x380c49){return db['Team'][_0x32dc('0x49')]({'where':{'id':_0x88fa9[_0x32dc('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x32dc('0x32')](handleEntityNotFound(_0x11607b,null))['then'](function(_0x10e347){var _0x492eab=_[_0x32dc('0x2e')](_0x10e347,'id');var _0x4fb236=[];var _0x5d5f13=[];var _0xe18073=squel['select']();_0xe18073['field'](_0x32dc('0x7f'))[_0x32dc('0x80')](_0x32dc('0x81'),'tq')[_0x32dc('0x82')](_0x32dc('0x83'),'ut',_0x32dc('0x84'))[_0x32dc('0x43')](_0x32dc('0x85'),_0x88fa9[_0x32dc('0x4d')]['id']);for(var _0x5c866a=0x0;_0x5c866a<_0x10e347['length'];_0x5c866a+=0x1){let _0x1b05a2=_0x10e347[_0x5c866a];for(var _0x39f29a=0x0;_0x39f29a<_0x1b05a2[_0x32dc('0x70')][_0x32dc('0x4f')];_0x39f29a+=0x1){let _0x589a91=_0x1b05a2[_0x32dc('0x70')][_0x39f29a];var _0xe49ed1=_0xe18073[_0x32dc('0x86')]();_0xe49ed1[_0x32dc('0x43')](_0x32dc('0x87'),_0x589a91['id']);_0x5d5f13[_0x32dc('0x88')](db['sequelize'][_0x32dc('0x3b')](_0xe49ed1[_0x32dc('0x89')](),{'type':db[_0x32dc('0x8a')][_0x32dc('0x8b')][_0x32dc('0x8c')]})[_0x32dc('0x32')](function(_0x29e1a4){if(_0x29e1a4[_0x32dc('0x4f')]===0x1){return _0x589a91['id'];}else{var _0x3d4642=_[_0x32dc('0x8d')](_['map'](_0x29e1a4,_0x32dc('0x8e')),function(_0x757eee){return _[_0x32dc('0x8f')](_0x492eab,_0x757eee);});if(_0x3d4642){return _0x589a91['id'];}}}));}}return BPromise[_0x32dc('0x90')](_0x5d5f13)['then'](function(_0x1a1fa1){_0x4fb236=_(_0x4fb236)['union'](_0x1a1fa1)[_0x32dc('0x91')]()[_0x32dc('0x2f')]();return db[_0x32dc('0x47')][_0x32dc('0x58')]({'where':{'id':_0x88fa9[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](function(_0x5945e1){return db[_0x32dc('0x8a')][_0x32dc('0x92')](function(_0x173199){return _0x5945e1[_0x32dc('0x93')](_0x88fa9[_0x32dc('0x3b')][_0x32dc('0x94')],{'transaction':_0x173199})[_0x32dc('0x32')](function(){if(!_[_0x32dc('0x95')](_0x4fb236)){return _0x5945e1['removeAgents'](_0x4fb236,{'transaction':_0x173199})['then'](function(){return db[_0x32dc('0x79')][_0x32dc('0x60')]({'where':{'VoiceQueueId':_0x88fa9['params']['id'],'UserId':_0x4fb236},'transaction':_0x173199});});}})['then'](function(){_0x4fb236['forEach'](function(_0x5daf25){socket[_0x32dc('0x7e')]('userVoiceQueue:remove',{'UserId':_0x5daf25,'VoiceQueueId':_0x5945e1['id']});});});});});});})[_0x32dc('0x32')](respondWithStatusCode(_0x11607b,null))[_0x32dc('0x4b')](handleError(_0x11607b,null));};exports[_0x32dc('0x96')]=function(_0x2df58e,_0x37e06c,_0xa31beb){var _0x6cdace,_0x4856c2;return db[_0x32dc('0x47')][_0x32dc('0x58')]({'where':{'id':_0x2df58e['params']['id']}})['then'](handleEntityNotFound(_0x37e06c,null))[_0x32dc('0x32')](function(_0x4afbd5){if(_0x4afbd5){_0x4856c2=_0x4afbd5;return _0x4afbd5[_0x32dc('0x96')](_0x2df58e[_0x32dc('0x5d')][_0x32dc('0x94')],_[_0x32dc('0x5b')](_0x2df58e['body'],[_0x32dc('0x94'),'id'])||{})[_0x32dc('0x97')](function(_0x307271){for(var _0x44e9b9=0x0;_0x44e9b9<_0x2df58e['body']['ids'][_0x32dc('0x4f')];_0x44e9b9+=0x1){socket[_0x32dc('0x7e')](_0x32dc('0x98'),{'UserId':Number(_0x2df58e[_0x32dc('0x5d')][_0x32dc('0x94')][_0x44e9b9]),'VoiceQueueId':Number(_0x2df58e[_0x32dc('0x4d')]['id'])});}return _0x307271;});}})['then'](function(_0x5289b9){_0x6cdace=_0x5289b9||[];if(_0x4856c2){return db[_0x32dc('0x6f')][_0x32dc('0x49')]({'where':{'id':_0x2df58e[_0x32dc('0x5d')][_0x32dc('0x94')]},'attributes':['id',_0x32dc('0x36'),_0x32dc('0x99'),_0x32dc('0x71'),_0x32dc('0x7b')],'raw':!![]});}})[_0x32dc('0x32')](function(_0x26f2b3){if(!_[_0x32dc('0x95')](_0x26f2b3)){var _0xb744c=[];for(var _0x1333b6=0x0;_0x1333b6<_0x26f2b3[_0x32dc('0x4f')];_0x1333b6++){if(_0x26f2b3[_0x1333b6][_0x32dc('0x99')]){_0xb744c[_0x32dc('0x88')](db[_0x32dc('0x79')]['upsert']({'membername':_0x26f2b3[_0x1333b6][_0x32dc('0x36')],'UserId':_0x26f2b3[_0x1333b6]['id'],'queue_name':_0x4856c2['name'],'VoiceQueueId':_0x4856c2['id'],'interface':_['isNil'](_0x26f2b3[_0x1333b6][_0x32dc('0x7b')])?util[_0x32dc('0x7c')](_0x32dc('0x7d'),_0x26f2b3[_0x1333b6][_0x32dc('0x36')]):_0x26f2b3[_0x1333b6][_0x32dc('0x7b')],'paused':_0x26f2b3[_0x1333b6]['voicePause']||![],'penalty':_0x2df58e[_0x32dc('0x5d')][_0x32dc('0x74')]||0x0}));}}return BPromise[_0x32dc('0x90')](_0xb744c);}})[_0x32dc('0x32')](function(){return _0x6cdace;})[_0x32dc('0x32')](respondWithResult(_0x37e06c,null))[_0x32dc('0x4b')](handleError(_0x37e06c,null));};exports[_0x32dc('0x9a')]=function(_0x26d113,_0x30ad89,_0x4f3b91){return db['VoiceQueue'][_0x32dc('0x58')]({'where':{'id':_0x26d113[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x30ad89,null))['then'](function(_0x147781){if(_0x147781){return _0x147781['removeAgents'](_0x26d113['query']['ids'])[_0x32dc('0x32')](function(){if(_['isArray'](_0x26d113[_0x32dc('0x3b')][_0x32dc('0x94')])){for(var _0x22fce5=0x0;_0x22fce5<_0x26d113[_0x32dc('0x3b')][_0x32dc('0x94')][_0x32dc('0x4f')];_0x22fce5+=0x1){socket[_0x32dc('0x7e')](_0x32dc('0x9b'),{'UserId':Number(_0x26d113[_0x32dc('0x3b')][_0x32dc('0x94')][_0x22fce5]),'VoiceQueueId':Number(_0x26d113[_0x32dc('0x4d')]['id'])});}}else{socket[_0x32dc('0x7e')](_0x32dc('0x9b'),{'UserId':Number(_0x26d113[_0x32dc('0x3b')][_0x32dc('0x94')]),'VoiceQueueId':Number(_0x26d113[_0x32dc('0x4d')]['id'])});}});}})[_0x32dc('0x32')](function(_0x43aae8){return db[_0x32dc('0x79')][_0x32dc('0x60')]({'where':{'VoiceQueueId':_0x26d113[_0x32dc('0x4d')]['id'],'UserId':_0x26d113[_0x32dc('0x3b')][_0x32dc('0x94')]}})[_0x32dc('0x32')](function(){return _0x43aae8;});})[_0x32dc('0x32')](respondWithStatusCode(_0x30ad89,null))[_0x32dc('0x4b')](handleError(_0x30ad89,null));};exports[_0x32dc('0x9c')]=function(_0x37bd60,_0x5722dc,_0x3307ee){var _0x5b43fb={};var _0x18d30e={};var _0x323c0c;var _0x5df11e;return db[_0x32dc('0x47')]['findOne']({'where':{'id':_0x37bd60[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x5722dc,null))[_0x32dc('0x32')](function(_0x3f8eeb){if(_0x3f8eeb){_0x323c0c=_0x3f8eeb;_0x18d30e[_0x32dc('0x3a')]=_[_0x32dc('0x4e')](db['User'][_0x32dc('0x38')]);_0x18d30e[_0x32dc('0x3b')]=_[_0x32dc('0x4e')](_0x37bd60[_0x32dc('0x3b')]);_0x18d30e[_0x32dc('0x3c')]=_[_0x32dc('0x3d')](_0x18d30e[_0x32dc('0x3a')],_0x18d30e[_0x32dc('0x3b')]);_0x5b43fb[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x18d30e['model'],qs['fields'](_0x37bd60['query'][_0x32dc('0x3f')]));_0x5b43fb[_0x32dc('0x3e')]=_0x5b43fb[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0x5b43fb[_0x32dc('0x3e')]:_0x18d30e[_0x32dc('0x3a')];_0x5b43fb[_0x32dc('0x41')]=qs[_0x32dc('0x42')](_0x37bd60[_0x32dc('0x3b')][_0x32dc('0x42')]);_0x5b43fb['where']=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x37bd60[_0x32dc('0x3b')],_0x18d30e[_0x32dc('0x3c')]));if(_0x37bd60[_0x32dc('0x3b')][_0x32dc('0x2c')]){_0x5b43fb[_0x32dc('0x43')]=_[_0x32dc('0x51')](_0x5b43fb[_0x32dc('0x43')],{'$or':_['map'](_0x5b43fb[_0x32dc('0x3e')],function(_0x24185f){var _0x346181={};_0x346181[_0x24185f]={'$like':'%'+_0x37bd60[_0x32dc('0x3b')][_0x32dc('0x2c')]+'%'};return _0x346181;})});}_0x5b43fb=_['merge']({},_0x5b43fb,_0x37bd60[_0x32dc('0x46')]);return _0x323c0c[_0x32dc('0x9c')](_0x5b43fb);}})['then'](function(_0x4d03ca){if(_0x4d03ca){_0x5df11e=_0x4d03ca[_0x32dc('0x4f')];if(!_0x37bd60['query'][_0x32dc('0x64')](_0x32dc('0x40'))){_0x5b43fb[_0x32dc('0x1f')]=qs['limit'](_0x37bd60[_0x32dc('0x3b')][_0x32dc('0x1f')]);_0x5b43fb[_0x32dc('0x1d')]=qs[_0x32dc('0x1d')](_0x37bd60[_0x32dc('0x3b')][_0x32dc('0x1d')]);}return _0x323c0c[_0x32dc('0x9c')](_0x5b43fb);}})['then'](function(_0x32499e){if(_0x32499e){return _0x32499e?{'count':_0x5df11e,'rows':_0x32499e}:null;}})[_0x32dc('0x32')](respondWithResult(_0x5722dc,null))['catch'](handleError(_0x5722dc,null));};exports[_0x32dc('0x9d')]=function(_0x24e09b,_0x3ec16d,_0x3fae0e){var _0x3ca9c7={};var _0x381368={};var _0x5eecb5;var _0x50e100;return db[_0x32dc('0x47')][_0x32dc('0x62')]({'where':{'id':_0x24e09b[_0x32dc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ec16d,null))[_0x32dc('0x32')](function(_0x3e9077){if(_0x3e9077){_0x5eecb5=_0x3e9077;_0x381368['model']=_[_0x32dc('0x4e')](db['UserVoiceQueueRt'][_0x32dc('0x38')]);_0x381368[_0x32dc('0x3b')]=_[_0x32dc('0x4e')](_0x24e09b['query']);_0x381368[_0x32dc('0x3c')]=_[_0x32dc('0x3d')](_0x381368[_0x32dc('0x3a')],_0x381368[_0x32dc('0x3b')]);_0x3ca9c7[_0x32dc('0x3e')]=_[_0x32dc('0x3d')](_0x381368['model'],qs[_0x32dc('0x3f')](_0x24e09b[_0x32dc('0x3b')]['fields']));_0x3ca9c7[_0x32dc('0x3e')]=_0x3ca9c7[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0x3ca9c7['attributes']:_0x381368['model'];_0x3ca9c7['order']=qs[_0x32dc('0x42')](_0x24e09b[_0x32dc('0x3b')][_0x32dc('0x42')]);_0x3ca9c7[_0x32dc('0x43')]=qs['filters'](_[_0x32dc('0x44')](_0x24e09b[_0x32dc('0x3b')],_0x381368[_0x32dc('0x3c')]));if(_0x24e09b[_0x32dc('0x3b')]['filter']){_0x3ca9c7[_0x32dc('0x43')]=_[_0x32dc('0x51')](_0x3ca9c7['where'],{'$or':_[_0x32dc('0x2e')](_0x3ca9c7[_0x32dc('0x3e')],function(_0x434866){var _0x4bf4ae={};_0x4bf4ae[_0x434866]={'$like':'%'+_0x24e09b[_0x32dc('0x3b')][_0x32dc('0x2c')]+'%'};return _0x4bf4ae;})});}_0x3ca9c7=_[_0x32dc('0x51')]({},_0x3ca9c7,_0x24e09b['options']);return _0x5eecb5['getMembers'](_0x3ca9c7);}})['then'](function(_0x32aa6a){if(_0x32aa6a){_0x50e100=_0x32aa6a[_0x32dc('0x4f')];if(!_0x24e09b[_0x32dc('0x3b')][_0x32dc('0x64')](_0x32dc('0x40'))){_0x3ca9c7[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x24e09b[_0x32dc('0x3b')]['limit']);_0x3ca9c7['offset']=qs[_0x32dc('0x1d')](_0x24e09b[_0x32dc('0x3b')][_0x32dc('0x1d')]);}return _0x5eecb5[_0x32dc('0x9d')](_0x3ca9c7);}})['then'](function(_0x148fd4){return _0x148fd4?{'count':_0x50e100,'rows':_0x148fd4}:null;})[_0x32dc('0x32')](respondWithResult(_0x3ec16d,null))['catch'](handleError(_0x3ec16d,null));};exports['getLists']=function(_0x16fa9e,_0x581421,_0xcab151){var _0x13b7f0={};var _0x485c71={};var _0x258306;var _0x18f4b7;return db['VoiceQueue'][_0x32dc('0x62')]({'where':{'id':_0x16fa9e[_0x32dc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x581421,null))['then'](function(_0x298ff9){if(_0x298ff9){_0x258306=_0x298ff9;_0x485c71[_0x32dc('0x3a')]=_[_0x32dc('0x4e')](db[_0x32dc('0x9e')][_0x32dc('0x38')]);_0x485c71[_0x32dc('0x3b')]=_[_0x32dc('0x4e')](_0x16fa9e[_0x32dc('0x3b')]);_0x485c71[_0x32dc('0x3c')]=_[_0x32dc('0x3d')](_0x485c71[_0x32dc('0x3a')],_0x485c71[_0x32dc('0x3b')]);_0x13b7f0['attributes']=_['intersection'](_0x485c71[_0x32dc('0x3a')],qs['fields'](_0x16fa9e[_0x32dc('0x3b')][_0x32dc('0x3f')]));_0x13b7f0['attributes']=_0x13b7f0[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0x13b7f0[_0x32dc('0x3e')]:_0x485c71['model'];_0x13b7f0[_0x32dc('0x41')]=qs['sort'](_0x16fa9e[_0x32dc('0x3b')][_0x32dc('0x42')]);_0x13b7f0['where']=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x16fa9e[_0x32dc('0x3b')],_0x485c71[_0x32dc('0x3c')]));if(_0x16fa9e[_0x32dc('0x3b')][_0x32dc('0x2c')]){_0x13b7f0[_0x32dc('0x43')]=_[_0x32dc('0x51')](_0x13b7f0[_0x32dc('0x43')],{'$or':_[_0x32dc('0x2e')](_0x13b7f0[_0x32dc('0x3e')],function(_0x29a24c){var _0x49c26b={};_0x49c26b[_0x29a24c]={'$like':'%'+_0x16fa9e['query']['filter']+'%'};return _0x49c26b;})});}_0x13b7f0=_[_0x32dc('0x51')]({},_0x13b7f0,_0x16fa9e[_0x32dc('0x46')]);return _0x258306[_0x32dc('0x9f')](_0x13b7f0);}})[_0x32dc('0x32')](function(_0x4e25c0){if(_0x4e25c0){_0x18f4b7=_0x4e25c0[_0x32dc('0x4f')];if(!_0x16fa9e[_0x32dc('0x3b')][_0x32dc('0x64')](_0x32dc('0x40'))){_0x13b7f0[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x16fa9e[_0x32dc('0x3b')][_0x32dc('0x1f')]);_0x13b7f0[_0x32dc('0x1d')]=qs['offset'](_0x16fa9e['query']['offset']);}return _0x258306[_0x32dc('0x9f')](_0x13b7f0);}})[_0x32dc('0x32')](function(_0x2e67be){if(_0x2e67be){return _0x2e67be?{'count':_0x18f4b7,'rows':_0x2e67be}:null;}})[_0x32dc('0x32')](respondWithResult(_0x581421,null))[_0x32dc('0x4b')](handleError(_0x581421,null));};exports[_0x32dc('0xa0')]=function(_0x26d556,_0x895fd9,_0x57a02c){var _0x1ac5f4=moment()[_0x32dc('0x7c')](_0x32dc('0xa1'));var _0x1904ca,_0xed2925;return db['VoiceQueue']['find']({'where':{'id':_0x26d556[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x895fd9,null))['then'](function(_0x1d3fff){if(_0x1d3fff){_0xed2925=_0x1d3fff;return _0x1d3fff[_0x32dc('0xa0')](_0x26d556['body'][_0x32dc('0x94')],_[_0x32dc('0x5b')](_0x26d556[_0x32dc('0x5d')],['ids','id'])||{});}return null;})[_0x32dc('0x97')](function(_0x10bbb5){var _0x1ea17d;_0x1904ca=_0x10bbb5||[];var _0x56d6db=[];if(_0x10bbb5){for(var _0x10b946=0x0;_0x10b946<_0x10bbb5[_0x32dc('0x4f')];_0x10b946+=0x1){var _0x218c8b=_0x10bbb5[_0x10b946][_0x32dc('0x28')]({'plain':!![]});_0xed2925[_0x32dc('0xa2')]=_0x26d556['body'][_0x32dc('0xa2')]?_0x26d556[_0x32dc('0x5d')][_0x32dc('0xa2')]:_0xed2925[_0x32dc('0xa2')];switch(_0xed2925[_0x32dc('0xa2')]){case'always':_0x1ea17d=squel['insert']()['into'](_0x32dc('0xa3'))[_0x32dc('0xa4')]([_0x32dc('0xa5'),_0x32dc('0xa6'),_0x32dc('0xa7'),'ListId',_0x32dc('0x65'),_0x32dc('0x5c'),_0x32dc('0x5e')],squel[_0x32dc('0xa8')]()[_0x32dc('0xa9')](_0x32dc('0xa5'),_0x32dc('0xa5'))[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0xa6'))['field']('id',_0x32dc('0xa7'))['field'](_0x218c8b[_0x32dc('0xaa')][_0x32dc('0x89')](),'ListId')[_0x32dc('0xa9')](_0x26d556[_0x32dc('0x4d')]['id']['toString'](),_0x32dc('0x65'))[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5c'))[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5e'))[_0x32dc('0x80')]('cm_contacts')[_0x32dc('0x43')](_0x32dc('0xab'))['where'](_0x32dc('0xac'),_0x218c8b[_0x32dc('0xaa')][_0x32dc('0x89')]())[_0x32dc('0x43')](_0x32dc('0xad'))['where'](_0x32dc('0xae'),squel[_0x32dc('0xa8')]()[_0x32dc('0xa9')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x32dc('0xaf'))['where'](_0x32dc('0x85'),_0x26d556[_0x32dc('0x4d')]['id'][_0x32dc('0x89')]()))[_0x32dc('0x43')](_0x32dc('0xae'),squel['select']()[_0x32dc('0xa9')](_0x32dc('0xb0'))[_0x32dc('0x80')](_0x32dc('0xa3'))[_0x32dc('0x43')](_0x32dc('0x85'),_0x26d556[_0x32dc('0x4d')]['id'][_0x32dc('0x89')]())))[_0x32dc('0x89')]();break;case _0x32dc('0xb1'):_0x1ea17d=squel[_0x32dc('0xb2')]()['into'](_0x32dc('0xa3'))[_0x32dc('0xa4')]([_0x32dc('0xa5'),_0x32dc('0xa6'),_0x32dc('0xa7'),'ListId',_0x32dc('0x65'),'createdAt',_0x32dc('0x5e')],squel['select']()[_0x32dc('0xa9')](_0x32dc('0xa5'),_0x32dc('0xa5'))['field']('\x27'+_0x1ac5f4+'\x27',_0x32dc('0xa6'))['field']('id',_0x32dc('0xa7'))[_0x32dc('0xa9')](_0x218c8b['CmListId'][_0x32dc('0x89')](),'ListId')[_0x32dc('0xa9')](_0x26d556['params']['id'][_0x32dc('0x89')](),'VoiceQueueId')[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5c'))[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5e'))[_0x32dc('0x80')]('cm_contacts')['where'](_0x32dc('0xab'))[_0x32dc('0x43')]('ListId\x20=\x20?',_0x218c8b[_0x32dc('0xaa')]['toString']())['where'](_0x32dc('0xad'))[_0x32dc('0x43')](_0x32dc('0xae'),squel['select']()[_0x32dc('0xa9')](_0x32dc('0xb0'))[_0x32dc('0x80')]('cm_hopper')[_0x32dc('0x43')](_0x32dc('0x85'),_0x26d556[_0x32dc('0x4d')]['id'][_0x32dc('0x89')]())))[_0x32dc('0x89')]();break;default:_0x1ea17d=squel[_0x32dc('0xb2')]()['into'](_0x32dc('0xa3'))[_0x32dc('0xa4')]([_0x32dc('0xa5'),'scheduledAt',_0x32dc('0xa7'),'ListId',_0x32dc('0x65'),_0x32dc('0x5c'),_0x32dc('0x5e')],squel[_0x32dc('0xa8')]()[_0x32dc('0xa9')]('phone',_0x32dc('0xa5'))[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0xa6'))[_0x32dc('0xa9')]('id',_0x32dc('0xa7'))['field'](_0x218c8b[_0x32dc('0xaa')]['toString'](),'ListId')[_0x32dc('0xa9')](_0x26d556[_0x32dc('0x4d')]['id']['toString'](),'VoiceQueueId')[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5c'))['field']('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5e'))['from'](_0x32dc('0xb3'))['where']('deletedAt\x20IS\x20NULL')[_0x32dc('0x43')]('ListId\x20=\x20?',_0x218c8b[_0x32dc('0xaa')][_0x32dc('0x89')]())[_0x32dc('0x43')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x56d6db['push'](db[_0x32dc('0x8a')][_0x32dc('0x3b')](_0x1ea17d));}return BPromise[_0x32dc('0x90')](_0x56d6db);}})[_0x32dc('0x32')](function(){var _0x2eab91=[];var _0x4de82e=squel[_0x32dc('0xb2')]()['into'](_0x32dc('0xb4'))[_0x32dc('0xa4')]([_0x32dc('0xb5'),_0x32dc('0xa5'),_0x32dc('0xb6'),_0x32dc('0x5c'),_0x32dc('0x5e')],squel[_0x32dc('0xa8')]()[_0x32dc('0xa9')](_0x32dc('0xb7'))[_0x32dc('0xa9')](_0x32dc('0xb8'))[_0x32dc('0xa9')](_0x32dc('0xb9'))[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5c'))[_0x32dc('0xa9')]('\x27'+_0x1ac5f4+'\x27',_0x32dc('0x5e'))[_0x32dc('0x80')]('cm_contact_has_items','ci')[_0x32dc('0x82')](_0x32dc('0xa3'),'h',_0x32dc('0xba'))[_0x32dc('0x43')](_0x32dc('0xbb'),_0x1ac5f4)[_0x32dc('0x43')]('ci.ItemClass=?','PHONE'))[_0x32dc('0x89')]();_0x2eab91[_0x32dc('0x88')](db[_0x32dc('0x8a')][_0x32dc('0x3b')](_0x4de82e));return BPromise[_0x32dc('0x90')](_0x2eab91);})[_0x32dc('0x32')](function(){return _0x1904ca;})[_0x32dc('0x32')](respondWithResult(_0x895fd9,null))['catch'](handleError(_0x895fd9,null));};exports['removeLists']=function(_0x3c6f5e,_0x42e59e,_0x2d11c4){return db[_0x32dc('0x47')][_0x32dc('0x58')]({'where':{'id':_0x3c6f5e['params']['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x42e59e,null))['then'](function(_0x261e87){if(_0x261e87){return _0x261e87[_0x32dc('0xbc')](_0x3c6f5e['query'][_0x32dc('0x94')]);}})['then'](function(_0x511e64){if(_0x511e64){return db[_0x32dc('0x63')][_0x32dc('0x60')]({'where':{'ListId':_0x3c6f5e[_0x32dc('0x3b')]['ids'],'VoiceQueueId':_0x3c6f5e[_0x32dc('0x4d')]['id']}})['then'](function(){return _0x511e64;});}})[_0x32dc('0x32')](respondWithStatusCode(_0x42e59e,null))[_0x32dc('0x4b')](handleError(_0x42e59e,null));};exports[_0x32dc('0xbd')]=function(_0x41b43c,_0x5b8454,_0x2fb52d){var _0x220aad={};var _0x3b0174={};var _0x3a039a;var _0x54de4a;return db[_0x32dc('0x47')][_0x32dc('0x62')]({'where':{'id':_0x41b43c[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x5b8454,null))[_0x32dc('0x32')](function(_0x4c0dfa){if(_0x4c0dfa){_0x3a039a=_0x4c0dfa;_0x3b0174[_0x32dc('0x3a')]=_[_0x32dc('0x4e')](db['CmList']['rawAttributes']);_0x3b0174['query']=_[_0x32dc('0x4e')](_0x41b43c['query']);_0x3b0174[_0x32dc('0x3c')]=_[_0x32dc('0x3d')](_0x3b0174[_0x32dc('0x3a')],_0x3b0174[_0x32dc('0x3b')]);_0x220aad[_0x32dc('0x3e')]=_['intersection'](_0x3b0174['model'],qs[_0x32dc('0x3f')](_0x41b43c[_0x32dc('0x3b')][_0x32dc('0x3f')]));_0x220aad[_0x32dc('0x3e')]=_0x220aad[_0x32dc('0x3e')][_0x32dc('0x4f')]?_0x220aad[_0x32dc('0x3e')]:_0x3b0174[_0x32dc('0x3a')];_0x220aad[_0x32dc('0x41')]=qs[_0x32dc('0x42')](_0x41b43c[_0x32dc('0x3b')]['sort']);_0x220aad[_0x32dc('0x43')]=qs[_0x32dc('0x3c')](_[_0x32dc('0x44')](_0x41b43c[_0x32dc('0x3b')],_0x3b0174['filters']));if(_0x41b43c[_0x32dc('0x3b')][_0x32dc('0x2c')]){_0x220aad[_0x32dc('0x43')]=_[_0x32dc('0x51')](_0x220aad[_0x32dc('0x43')],{'$or':_[_0x32dc('0x2e')](_0x220aad[_0x32dc('0x3e')],function(_0x4c38f6){var _0x3bb29b={};_0x3bb29b[_0x4c38f6]={'$like':'%'+_0x41b43c[_0x32dc('0x3b')]['filter']+'%'};return _0x3bb29b;})});}_0x220aad=_[_0x32dc('0x51')]({},_0x220aad,_0x41b43c[_0x32dc('0x46')]);return _0x3a039a[_0x32dc('0xbd')](_0x220aad);}})[_0x32dc('0x32')](function(_0x59bc4a){if(_0x59bc4a){_0x54de4a=_0x59bc4a['length'];if(!_0x41b43c[_0x32dc('0x3b')][_0x32dc('0x64')](_0x32dc('0x40'))){_0x220aad['limit']=qs[_0x32dc('0x1f')](_0x41b43c[_0x32dc('0x3b')]['limit']);_0x220aad[_0x32dc('0x1d')]=qs[_0x32dc('0x1d')](_0x41b43c[_0x32dc('0x3b')][_0x32dc('0x1d')]);}return _0x3a039a[_0x32dc('0xbd')](_0x220aad);}})['then'](function(_0x48cb52){if(_0x48cb52){return _0x48cb52?{'count':_0x54de4a,'rows':_0x48cb52}:null;}})[_0x32dc('0x32')](respondWithResult(_0x5b8454,null))[_0x32dc('0x4b')](handleError(_0x5b8454,null));};exports[_0x32dc('0xbe')]=function(_0x48708f,_0x49ce8a,_0x16652a){var _0x5af027,_0x122f1b;return db[_0x32dc('0x47')]['find']({'where':{'id':_0x48708f['params']['id']}})[_0x32dc('0x32')](handleEntityNotFound(_0x49ce8a,null))['then'](function(_0x275e3f){if(_0x275e3f){_0x122f1b=_0x275e3f;return _0x275e3f[_0x32dc('0xbe')](_0x48708f[_0x32dc('0x5d')][_0x32dc('0x94')],_[_0x32dc('0x5b')](_0x48708f['body'],[_0x32dc('0x94'),'id'])||{});}return null;})['spread'](function(_0x2abe97){var _0x239cbe;_0x5af027=_0x2abe97||[];var _0x1d85fd=[];if(_0x2abe97){for(var _0x53c26d=0x0;_0x53c26d<_0x2abe97[_0x32dc('0x4f')];_0x53c26d+=0x1){var _0x53a269=_0x2abe97[_0x53c26d][_0x32dc('0x28')]({'plain':!![]});_0x239cbe=squel[_0x32dc('0xb2')]()[_0x32dc('0xbf')](_0x32dc('0xc0'))['fromQuery']([_0x32dc('0xa5'),_0x32dc('0xa7'),_0x32dc('0xc1'),'VoiceQueueId',_0x32dc('0x5c'),'updatedAt'],squel['select']()[_0x32dc('0xa9')](_0x32dc('0xa5'),_0x32dc('0xa5'))[_0x32dc('0xa9')]('id',_0x32dc('0xa7'))[_0x32dc('0xa9')](_0x53a269['CmListId']['toString'](),_0x32dc('0xc1'))[_0x32dc('0xa9')](_0x48708f['params']['id'][_0x32dc('0x89')](),_0x32dc('0x65'))[_0x32dc('0xa9')](_0x32dc('0xc2'),_0x32dc('0x5c'))[_0x32dc('0xa9')](_0x32dc('0xc2'),_0x32dc('0x5e'))[_0x32dc('0x80')]('cm_contacts')['where'](_0x32dc('0xab'))[_0x32dc('0x43')](_0x32dc('0xac'),_0x53a269[_0x32dc('0xaa')][_0x32dc('0x89')]())[_0x32dc('0x43')](_0x32dc('0xad')))['toString']();_0x1d85fd[_0x32dc('0x88')](db[_0x32dc('0x8a')][_0x32dc('0x3b')](_0x239cbe));}return BPromise[_0x32dc('0x90')](_0x1d85fd);}})[_0x32dc('0x32')](function(){return _0x5af027;})[_0x32dc('0x32')](respondWithResult(_0x49ce8a,null))[_0x32dc('0x4b')](handleError(_0x49ce8a,null));};exports[_0x32dc('0xc3')]=function(_0x491307,_0x1965dc,_0x15ae5b){return db[_0x32dc('0x47')]['find']({'where':{'id':_0x491307[_0x32dc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1965dc,null))[_0x32dc('0x32')](function(_0x3f8173){if(_0x3f8173){return _0x3f8173[_0x32dc('0xc3')](_0x491307['query'][_0x32dc('0x94')]);}})[_0x32dc('0x32')](function(_0x14f6aa){if(_0x14f6aa){return db[_0x32dc('0x6a')][_0x32dc('0x60')]({'where':{'ListId':_0x491307[_0x32dc('0x3b')][_0x32dc('0x94')],'VoiceQueueId':_0x491307[_0x32dc('0x4d')]['id']}})[_0x32dc('0x32')](function(){return _0x14f6aa;});}})[_0x32dc('0x32')](respondWithStatusCode(_0x1965dc,null))[_0x32dc('0x4b')](handleError(_0x1965dc,null));}; \ No newline at end of file +var _0x980e=['spread','push','isNil','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','all','OrderBy','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','status','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','get','inbound','outbound','filter','ignore','map','value','includes','find','type','name','end','sendStatus','index','VoiceQueue','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','getHoppers','findOne','CmHopper','order','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','TeamVoiceQueue','UserVoiceQueue','UserVoiceQueueRt','upsert','format','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe980('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe980('0x1'));var rp=require('request-promise');var moment=require(_0xe980('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe980('0x3'));var util=require(_0xe980('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xe980('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe980('0x6'));var squel=require(_0xe980('0x7'));var crypto=require(_0xe980('0x8'));var jsforce=require(_0xe980('0x9'));var deskjs=require(_0xe980('0xa'));var toCsv=require(_0xe980('0x5'));var querystring=require('querystring');var Papa=require(_0xe980('0xb'));var Redis=require(_0xe980('0xc'));var authService=require(_0xe980('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe980('0xe'));var hardwareService=require(_0xe980('0xf'));var logger=require(_0xe980('0x10'))(_0xe980('0x11'));var utils=require(_0xe980('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe980('0x13')]=_[_0xe980('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe980('0x15'))(new Redis(config[_0xe980('0x13')]));require(_0xe980('0x16'))[_0xe980('0x17')](socket);function respondWithStatusCode(_0x21c5ff,_0x14979f){_0x14979f=_0x14979f||0xcc;return function(_0x451136){if(_0x451136){return _0x21c5ff['sendStatus'](_0x14979f);}return _0x21c5ff['status'](_0x14979f)['end']();};}function respondWithResult(_0x594116,_0xd9fff2){_0xd9fff2=_0xd9fff2||0xc8;return function(_0x1e6760){if(_0x1e6760){return _0x594116[_0xe980('0x18')](_0xd9fff2)[_0xe980('0x19')](_0x1e6760);}};}function respondWithFilteredResult(_0x551a2c,_0x2b7d64){return function(_0x1c6354){if(_0x1c6354){var _0x1ddb12=typeof _0x2b7d64['offset']==='undefined'&&typeof _0x2b7d64[_0xe980('0x1a')]===_0xe980('0x1b');var _0x13e839=_0x1c6354[_0xe980('0x1c')];var _0x2e930f=_0x1ddb12?0x0:_0x2b7d64[_0xe980('0x1d')];var _0xfce124=_0x1ddb12?_0x1c6354[_0xe980('0x1c')]:_0x2b7d64['offset']+_0x2b7d64['limit'];var _0x12ddc4;if(_0xfce124>=_0x13e839){_0xfce124=_0x13e839;_0x12ddc4=0xc8;}else{_0x12ddc4=0xce;}_0x551a2c[_0xe980('0x18')](_0x12ddc4);return _0x551a2c[_0xe980('0x1e')]('Content-Range',_0x2e930f+'-'+_0xfce124+'/'+_0x13e839)[_0xe980('0x19')](_0x1c6354);}return null;};}function patchUpdates(_0x31916b){return function(_0x5f1ce5){try{jsonpatch[_0xe980('0x1f')](_0x5f1ce5,_0x31916b,!![]);}catch(_0x261931){return BPromise[_0xe980('0x20')](_0x261931);}return _0x5f1ce5['save']();};}function saveUpdates(_0xb9e91d,_0x4e9a85){return function(_0x2a87e3){if(_0x2a87e3){return _0x2a87e3[_0xe980('0x21')](_0xb9e91d)[_0xe980('0x22')](function(_0x40a34e){return _0x40a34e;});}return null;};}function removeEntity(_0x533ed6,_0x11e5dd){return function(_0x392bd1){if(_0x392bd1){return _0x392bd1[_0xe980('0x23')]()['then'](function(){var _0x54e755=_0x392bd1[_0xe980('0x24')]({'plain':!![]});var _0x138a75=[{'name':'VoiceQueues','value':_0xe980('0x25'),'ignore':![]},{'name':'QueueCampaigns','value':_0xe980('0x26'),'ignore':![]}];var _0x2b618a=_(_0x138a75)[_0xe980('0x27')](_0xe980('0x28'))[_0xe980('0x29')](_0xe980('0x2a'))['value']();if(_[_0xe980('0x2b')](_0x2b618a,_0x54e755['type'])){return;}var _0x3499db=_[_0xe980('0x2c')](_0x138a75,[_0xe980('0x2a'),_0x54e755[_0xe980('0x2d')]])[_0xe980('0x2e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x3499db,'resourceId':_0x54e755['id']}})[_0xe980('0x22')](function(){return _0x392bd1;});})[_0xe980('0x22')](function(){_0x533ed6[_0xe980('0x18')](0xcc)[_0xe980('0x2f')]();});}};}function handleEntityNotFound(_0x40e8db,_0x71c327){return function(_0x3d2fb1){if(!_0x3d2fb1){_0x40e8db[_0xe980('0x30')](0x194);}return _0x3d2fb1;};}function handleError(_0x15a5d1,_0x3bf667){_0x3bf667=_0x3bf667||0x1f4;return function(_0x371136){logger['error'](_0x371136['stack']);if(_0x371136[_0xe980('0x2e')]){delete _0x371136[_0xe980('0x2e')];}_0x15a5d1[_0xe980('0x18')](_0x3bf667)['send'](_0x371136);};}exports[_0xe980('0x31')]=function(_0x4b9586,_0x2b481c){var _0x3d5393={},_0x163db9={},_0x44686a={'count':0x0,'rows':[]};var _0x1811b3=_[_0xe980('0x29')](db[_0xe980('0x32')][_0xe980('0x33')],function(_0x47a000){return{'name':_0x47a000['fieldName'],'type':_0x47a000[_0xe980('0x2d')][_0xe980('0x34')]};});_0x163db9['model']=_[_0xe980('0x29')](_0x1811b3,'name');_0x163db9[_0xe980('0x35')]=_[_0xe980('0x36')](_0x4b9586[_0xe980('0x35')]);_0x163db9[_0xe980('0x37')]=_[_0xe980('0x38')](_0x163db9[_0xe980('0x39')],_0x163db9['query']);_0x3d5393[_0xe980('0x3a')]=_[_0xe980('0x38')](_0x163db9[_0xe980('0x39')],qs[_0xe980('0x3b')](_0x4b9586[_0xe980('0x35')]['fields']));_0x3d5393[_0xe980('0x3a')]=_0x3d5393[_0xe980('0x3a')][_0xe980('0x3c')]?_0x3d5393['attributes']:_0x163db9[_0xe980('0x39')];if(!_0x4b9586['query'][_0xe980('0x3d')](_0xe980('0x3e'))){_0x3d5393['limit']=qs['limit'](_0x4b9586[_0xe980('0x35')][_0xe980('0x1a')]);_0x3d5393[_0xe980('0x1d')]=qs[_0xe980('0x1d')](_0x4b9586[_0xe980('0x35')][_0xe980('0x1d')]);}_0x3d5393['order']=qs[_0xe980('0x3f')](_0x4b9586[_0xe980('0x35')][_0xe980('0x3f')]);_0x3d5393['where']=qs[_0xe980('0x37')](_[_0xe980('0x40')](_0x4b9586[_0xe980('0x35')],_0x163db9['filters']),_0x1811b3);if(_0x4b9586[_0xe980('0x35')][_0xe980('0x27')]){_0x3d5393['where']=_[_0xe980('0x41')](_0x3d5393[_0xe980('0x42')],{'$or':_[_0xe980('0x29')](_0x1811b3,function(_0x105b6e){if(_0x105b6e[_0xe980('0x2d')]!==_0xe980('0x43')){var _0x556937={};_0x556937[_0x105b6e[_0xe980('0x2e')]]={'$like':'%'+_0x4b9586[_0xe980('0x35')][_0xe980('0x27')]+'%'};return _0x556937;}})});}_0x3d5393=_[_0xe980('0x41')]({},_0x3d5393,_0x4b9586['options']);var _0x40495f={'where':_0x3d5393[_0xe980('0x42')]};return db[_0xe980('0x32')][_0xe980('0x1c')](_0x40495f)[_0xe980('0x22')](function(_0x336056){_0x44686a['count']=_0x336056;if(_0x4b9586[_0xe980('0x35')][_0xe980('0x44')]){_0x3d5393[_0xe980('0x45')]=[{'all':!![]}];}return db[_0xe980('0x32')][_0xe980('0x46')](_0x3d5393);})[_0xe980('0x22')](function(_0x45a918){_0x44686a[_0xe980('0x47')]=_0x45a918;return _0x44686a;})[_0xe980('0x22')](respondWithFilteredResult(_0x2b481c,_0x3d5393))[_0xe980('0x48')](handleError(_0x2b481c,null));};exports[_0xe980('0x49')]=function(_0x39dd69,_0x2cf4e8){var _0x1fda18={'raw':![],'where':{'id':_0x39dd69['params']['id']}},_0x4bde61={};_0x4bde61[_0xe980('0x39')]=_[_0xe980('0x36')](db[_0xe980('0x32')]['rawAttributes']);_0x4bde61[_0xe980('0x35')]=_[_0xe980('0x36')](_0x39dd69[_0xe980('0x35')]);_0x4bde61[_0xe980('0x37')]=_[_0xe980('0x38')](_0x4bde61['model'],_0x4bde61[_0xe980('0x35')]);_0x1fda18[_0xe980('0x3a')]=_[_0xe980('0x38')](_0x4bde61['model'],qs['fields'](_0x39dd69[_0xe980('0x35')][_0xe980('0x3b')]));_0x1fda18['attributes']=_0x1fda18[_0xe980('0x3a')]['length']?_0x1fda18[_0xe980('0x3a')]:_0x4bde61['model'];if(_0x39dd69['query'][_0xe980('0x44')]){_0x1fda18[_0xe980('0x45')]=[{'all':!![]}];}_0x1fda18=_[_0xe980('0x41')]({},_0x1fda18,_0x39dd69[_0xe980('0x4a')]);return db[_0xe980('0x32')][_0xe980('0x2c')](_0x1fda18)['then'](handleEntityNotFound(_0x2cf4e8,null))[_0xe980('0x22')](respondWithResult(_0x2cf4e8,null))[_0xe980('0x48')](handleError(_0x2cf4e8,null));};exports[_0xe980('0x4b')]=function(_0x692b57,_0xbb363c){return db['VoiceQueue'][_0xe980('0x4b')](_0x692b57[_0xe980('0x4c')],{})[_0xe980('0x22')](function(_0xadc9cc){var _0x142f4c=_0x692b57[_0xe980('0x4d')][_0xe980('0x24')]({'plain':!![]});if(!_0x142f4c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x142f4c[_0xe980('0x4e')]===_0xe980('0x4d')){var _0x2bf81c=_0xadc9cc[_0xe980('0x24')]({'plain':!![]});var _0x314165=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xe980('0x4f'),'value':_0xe980('0x26')}];var _0x3c1b5b=_[_0xe980('0x2c')](_0x314165,[_0xe980('0x2a'),_0x2bf81c[_0xe980('0x2d')]])['name'];return db[_0xe980('0x50')][_0xe980('0x2c')]({'where':{'name':_0x3c1b5b,'userProfileId':_0x142f4c[_0xe980('0x51')]},'raw':!![]})[_0xe980('0x22')](function(_0x3b5185){if(_0x3b5185&&_0x3b5185[_0xe980('0x52')]===0x0){return db[_0xe980('0x53')]['create']({'name':_0x2bf81c[_0xe980('0x2e')],'resourceId':_0x2bf81c['id'],'type':_0x3b5185[_0xe980('0x2e')],'sectionId':_0x3b5185['id']},{})[_0xe980('0x22')](function(){return _0xadc9cc;});}else{return _0xadc9cc;}})[_0xe980('0x48')](function(_0x4a8808){logger[_0xe980('0x54')](_0xe980('0x55'),_0x4a8808);throw _0x4a8808;});}return _0xadc9cc;})[_0xe980('0x22')](respondWithResult(_0xbb363c,0xc9))['catch'](handleError(_0xbb363c,null));};exports[_0xe980('0x56')]=function(_0x26ab27,_0xfd75c3){var _0x285902={'where':{'id':_0x26ab27[_0xe980('0x57')]['id']}},_0x255689={};_0x255689[_0xe980('0x39')]=_[_0xe980('0x36')](db[_0xe980('0x32')][_0xe980('0x33')]);_0x285902[_0xe980('0x3a')]=_[_0xe980('0x38')](_0x255689[_0xe980('0x39')],qs[_0xe980('0x3b')](_0x26ab27[_0xe980('0x35')][_0xe980('0x3b')]));_0x285902[_0xe980('0x3a')]=_0x285902['attributes'][_0xe980('0x3c')]?_0x285902[_0xe980('0x3a')]:_0x255689[_0xe980('0x39')];if(_0x26ab27['query'][_0xe980('0x44')]){_0x285902[_0xe980('0x45')]=[{'all':!![]}];}_0x285902=_[_0xe980('0x41')]({},_0x285902,_0x26ab27['options']);return db[_0xe980('0x32')][_0xe980('0x2c')](_0x285902)[_0xe980('0x22')](handleEntityNotFound(_0xfd75c3,null))[_0xe980('0x22')](function(_0x5c0885){if(_0x5c0885){var _0x15dc78=_0x5c0885[_0xe980('0x24')]({'plain':!![]});_0x15dc78=qs[_0xe980('0x58')](_0x15dc78,['id','createdAt',_0xe980('0x59')]);_0x26ab27[_0xe980('0x4c')]=_[_0xe980('0x58')](_0x26ab27[_0xe980('0x4c')],['id',_0xe980('0x5a'),_0xe980('0x59')]);return db['VoiceQueue'][_0xe980('0x4b')](_[_0xe980('0x41')](_0x15dc78,_0x26ab27[_0xe980('0x4c')]),{'include':_0x26ab27[_0xe980('0x35')][_0xe980('0x44')]?[{'all':!![]}]:undefined})[_0xe980('0x22')](function(_0x2b4f6c){var _0x160772=_0x26ab27[_0xe980('0x4d')]['get']({'plain':!![]});if(!_0x160772)throw new Error(_0xe980('0x5b'));if(_0x160772[_0xe980('0x4e')]==='user'){var _0x85d6fb=_0x2b4f6c[_0xe980('0x24')]({'plain':!![]});var _0x102149=[{'name':_0xe980('0x5c'),'value':_0xe980('0x25')},{'name':'QueueCampaigns','value':_0xe980('0x26')}];var _0x24a4ca=_[_0xe980('0x2c')](_0x102149,[_0xe980('0x2a'),_0x85d6fb[_0xe980('0x2d')]])[_0xe980('0x2e')];return db[_0xe980('0x50')][_0xe980('0x2c')]({'where':{'name':_0x24a4ca,'userProfileId':_0x160772[_0xe980('0x51')]},'raw':!![]})[_0xe980('0x22')](function(_0x4c83ff){if(_0x4c83ff&&_0x4c83ff[_0xe980('0x52')]===0x0){return db[_0xe980('0x53')][_0xe980('0x4b')]({'name':_0x85d6fb['name'],'resourceId':_0x85d6fb['id'],'type':_0x4c83ff['name'],'sectionId':_0x4c83ff['id']},{})['then'](function(){return _0x2b4f6c;});}else{return _0x2b4f6c;}})[_0xe980('0x48')](function(_0x4e4159){logger[_0xe980('0x54')](_0xe980('0x55'),_0x4e4159);throw _0x4e4159;});}return _0x2b4f6c;});}})[_0xe980('0x22')](respondWithResult(_0xfd75c3,0xc9))[_0xe980('0x48')](handleError(_0xfd75c3,null));};exports[_0xe980('0x21')]=function(_0x40a73b,_0x35bb50){if(_0x40a73b['body']['id']){delete _0x40a73b[_0xe980('0x4c')]['id'];}return db[_0xe980('0x32')][_0xe980('0x2c')]({'where':{'id':_0x40a73b[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x35bb50,null))[_0xe980('0x22')](saveUpdates(_0x40a73b[_0xe980('0x4c')],null))[_0xe980('0x22')](respondWithResult(_0x35bb50,null))[_0xe980('0x48')](handleError(_0x35bb50,null));};exports[_0xe980('0x23')]=function(_0x52c61f,_0x6ec3ca){return db[_0xe980('0x32')][_0xe980('0x2c')]({'where':{'id':_0x52c61f[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x6ec3ca,null))['then'](removeEntity(_0x6ec3ca,null))[_0xe980('0x48')](handleError(_0x6ec3ca,null));};exports[_0xe980('0x5d')]=function(_0x5e3ed1,_0x17d76a,_0x316083){var _0x409994={'raw':![],'where':{}};var _0x1e34c6={};var _0x29b659={'count':0x0,'rows':[]};return db[_0xe980('0x32')][_0xe980('0x5e')]({'where':{'id':_0x5e3ed1['params']['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x17d76a,null))[_0xe980('0x22')](function(_0x4b3625){if(_0x4b3625){_0x1e34c6['model']=_[_0xe980('0x36')](db[_0xe980('0x5f')][_0xe980('0x33')]);_0x1e34c6['query']=_[_0xe980('0x36')](_0x5e3ed1[_0xe980('0x35')]);_0x1e34c6['filters']=_[_0xe980('0x38')](_0x1e34c6['model'],_0x1e34c6[_0xe980('0x35')]);_0x409994['attributes']=_[_0xe980('0x38')](_0x1e34c6[_0xe980('0x39')],qs['fields'](_0x5e3ed1['query'][_0xe980('0x3b')]));_0x409994[_0xe980('0x3a')]=_0x409994[_0xe980('0x3a')][_0xe980('0x3c')]?_0x409994[_0xe980('0x3a')]:_0x1e34c6[_0xe980('0x39')];if(!_0x5e3ed1[_0xe980('0x35')][_0xe980('0x3d')](_0xe980('0x3e'))){_0x409994[_0xe980('0x1a')]=qs[_0xe980('0x1a')](_0x5e3ed1[_0xe980('0x35')][_0xe980('0x1a')]);_0x409994[_0xe980('0x1d')]=qs['offset'](_0x5e3ed1[_0xe980('0x35')]['offset']);}_0x409994[_0xe980('0x60')]=qs['sort'](_0x5e3ed1[_0xe980('0x35')][_0xe980('0x3f')]);_0x409994['where']=qs['filters'](_[_0xe980('0x40')](_0x5e3ed1['query'],_0x1e34c6['filters']));_0x409994[_0xe980('0x42')][_0xe980('0x61')]=_0x4b3625['id'];if(_0x5e3ed1[_0xe980('0x35')]['filter']){_0x409994[_0xe980('0x42')]=_[_0xe980('0x41')](_0x409994[_0xe980('0x42')],{'$or':_[_0xe980('0x29')](_0x409994[_0xe980('0x3a')],function(_0x116772){var _0x36454f={};_0x36454f[_0x116772]={'$like':'%'+_0x5e3ed1['query'][_0xe980('0x27')]+'%'};return _0x36454f;})});}_0x409994=_[_0xe980('0x41')]({},_0x409994,_0x5e3ed1['options']);return db[_0xe980('0x5f')][_0xe980('0x1c')]({'where':_0x409994[_0xe980('0x42')]})['then'](function(_0x39c57b){_0x29b659['count']=_0x39c57b;if(_0x5e3ed1[_0xe980('0x35')][_0xe980('0x44')]){_0x409994[_0xe980('0x45')]=[{'all':!![]}];}return db[_0xe980('0x5f')][_0xe980('0x46')](_0x409994);})[_0xe980('0x22')](function(_0x268536){_0x29b659[_0xe980('0x47')]=_0x268536;return _0x29b659;});}})['then'](respondWithFilteredResult(_0x17d76a,_0x409994))[_0xe980('0x48')](handleError(_0x17d76a,null));};exports[_0xe980('0x62')]=function(_0x3fc225,_0x5924ec,_0x11fe11){var _0x54e8ea={'raw':!![],'where':{}};var _0x64fc2c={};var _0x4f3321={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3fc225[_0xe980('0x57')]['id']}})['then'](handleEntityNotFound(_0x5924ec,null))[_0xe980('0x22')](function(_0x581f59){if(_0x581f59){_0x64fc2c[_0xe980('0x39')]=_['keys'](db[_0xe980('0x63')][_0xe980('0x33')]);_0x64fc2c[_0xe980('0x35')]=_[_0xe980('0x36')](_0x3fc225[_0xe980('0x35')]);_0x64fc2c[_0xe980('0x37')]=_[_0xe980('0x38')](_0x64fc2c['model'],_0x64fc2c[_0xe980('0x35')]);_0x54e8ea[_0xe980('0x3a')]=_[_0xe980('0x38')](_0x64fc2c[_0xe980('0x39')],qs[_0xe980('0x3b')](_0x3fc225[_0xe980('0x35')][_0xe980('0x3b')]));_0x54e8ea[_0xe980('0x3a')]=_0x54e8ea['attributes']['length']?_0x54e8ea[_0xe980('0x3a')]:_0x64fc2c[_0xe980('0x39')];if(!_0x3fc225['query'][_0xe980('0x3d')](_0xe980('0x3e'))){_0x54e8ea[_0xe980('0x1a')]=qs[_0xe980('0x1a')](_0x3fc225['query'][_0xe980('0x1a')]);_0x54e8ea[_0xe980('0x1d')]=qs['offset'](_0x3fc225['query']['offset']);}_0x54e8ea['order']=qs['sort'](_0x3fc225['query']['sort']);_0x54e8ea[_0xe980('0x42')]=qs[_0xe980('0x37')](_[_0xe980('0x40')](_0x3fc225[_0xe980('0x35')],_0x64fc2c[_0xe980('0x37')]));_0x54e8ea[_0xe980('0x42')][_0xe980('0x61')]=_0x581f59['id'];if(_0x3fc225['query'][_0xe980('0x27')]){_0x54e8ea[_0xe980('0x42')]=_[_0xe980('0x41')](_0x54e8ea[_0xe980('0x42')],{'$or':_['map'](_0x54e8ea[_0xe980('0x3a')],function(_0x3fea74){var _0x2cd77b={};_0x2cd77b[_0x3fea74]={'$like':'%'+_0x3fc225[_0xe980('0x35')][_0xe980('0x27')]+'%'};return _0x2cd77b;})});}_0x54e8ea=_[_0xe980('0x41')]({},_0x54e8ea,_0x3fc225[_0xe980('0x4a')]);return db['CmHopperHistory'][_0xe980('0x1c')]({'where':_0x54e8ea['where']})[_0xe980('0x22')](function(_0x1b4e4f){_0x4f3321[_0xe980('0x1c')]=_0x1b4e4f;if(_0x3fc225['query'][_0xe980('0x44')]){_0x54e8ea[_0xe980('0x45')]=[{'all':!![]}];}return db[_0xe980('0x63')]['findAll'](_0x54e8ea);})['then'](function(_0x49083c){_0x4f3321[_0xe980('0x47')]=_0x49083c;return _0x4f3321;});}})[_0xe980('0x22')](respondWithFilteredResult(_0x5924ec,_0x54e8ea))['catch'](handleError(_0x5924ec,null));};exports[_0xe980('0x64')]=function(_0x4861df,_0x30bea1,_0x450652){var _0x55b2a6={'raw':!![],'where':{}};var _0x38bd68={};var _0x2c3e9c={'count':0x0,'rows':[]};return db[_0xe980('0x32')][_0xe980('0x5e')]({'where':{'id':_0x4861df[_0xe980('0x57')]['id']}})['then'](handleEntityNotFound(_0x30bea1,null))[_0xe980('0x22')](function(_0x39985a){if(_0x39985a){_0x38bd68[_0xe980('0x39')]=_[_0xe980('0x36')](db['CmHopperFinal'][_0xe980('0x33')]);_0x38bd68[_0xe980('0x35')]=_[_0xe980('0x36')](_0x4861df[_0xe980('0x35')]);_0x38bd68[_0xe980('0x37')]=_[_0xe980('0x38')](_0x38bd68['model'],_0x38bd68[_0xe980('0x35')]);_0x55b2a6['attributes']=_['intersection'](_0x38bd68[_0xe980('0x39')],qs['fields'](_0x4861df['query'][_0xe980('0x3b')]));_0x55b2a6[_0xe980('0x3a')]=_0x55b2a6[_0xe980('0x3a')][_0xe980('0x3c')]?_0x55b2a6[_0xe980('0x3a')]:_0x38bd68['model'];if(!_0x4861df[_0xe980('0x35')][_0xe980('0x3d')](_0xe980('0x3e'))){_0x55b2a6[_0xe980('0x1a')]=qs[_0xe980('0x1a')](_0x4861df['query'][_0xe980('0x1a')]);_0x55b2a6[_0xe980('0x1d')]=qs[_0xe980('0x1d')](_0x4861df[_0xe980('0x35')][_0xe980('0x1d')]);}_0x55b2a6['order']=qs['sort'](_0x4861df[_0xe980('0x35')][_0xe980('0x3f')]);_0x55b2a6[_0xe980('0x42')]=qs[_0xe980('0x37')](_[_0xe980('0x40')](_0x4861df[_0xe980('0x35')],_0x38bd68[_0xe980('0x37')]));_0x55b2a6['where'][_0xe980('0x61')]=_0x39985a['id'];if(_0x4861df[_0xe980('0x35')][_0xe980('0x27')]){_0x55b2a6[_0xe980('0x42')]=_[_0xe980('0x41')](_0x55b2a6['where'],{'$or':_[_0xe980('0x29')](_0x55b2a6[_0xe980('0x3a')],function(_0x4bf8c0){var _0x5e9f7f={};_0x5e9f7f[_0x4bf8c0]={'$like':'%'+_0x4861df[_0xe980('0x35')][_0xe980('0x27')]+'%'};return _0x5e9f7f;})});}_0x55b2a6=_[_0xe980('0x41')]({},_0x55b2a6,_0x4861df[_0xe980('0x4a')]);return db[_0xe980('0x65')][_0xe980('0x1c')]({'where':_0x55b2a6['where']})[_0xe980('0x22')](function(_0x2848eb){_0x2c3e9c[_0xe980('0x1c')]=_0x2848eb;if(_0x4861df[_0xe980('0x35')][_0xe980('0x44')]){_0x55b2a6[_0xe980('0x45')]=[{'all':!![]}];}return db[_0xe980('0x65')][_0xe980('0x46')](_0x55b2a6);})[_0xe980('0x22')](function(_0x53f7af){_0x2c3e9c[_0xe980('0x47')]=_0x53f7af;return _0x2c3e9c;});}})[_0xe980('0x22')](respondWithFilteredResult(_0x30bea1,_0x55b2a6))[_0xe980('0x48')](handleError(_0x30bea1,null));};exports[_0xe980('0x66')]=function(_0x30c561,_0x110af7,_0x169da2){var _0x346163={'raw':!![],'where':{}};var _0xa1f1dc={};var _0x1b9ebf={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe980('0x5e')]({'where':{'id':_0x30c561['params']['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x110af7,null))[_0xe980('0x22')](function(_0x370ec0){if(_0x370ec0){_0xa1f1dc[_0xe980('0x39')]=_['keys'](db[_0xe980('0x67')]['rawAttributes']);_0xa1f1dc[_0xe980('0x35')]=_[_0xe980('0x36')](_0x30c561['query']);_0xa1f1dc[_0xe980('0x37')]=_[_0xe980('0x38')](_0xa1f1dc[_0xe980('0x39')],_0xa1f1dc[_0xe980('0x35')]);_0x346163['attributes']=_[_0xe980('0x38')](_0xa1f1dc[_0xe980('0x39')],qs[_0xe980('0x3b')](_0x30c561[_0xe980('0x35')][_0xe980('0x3b')]));_0x346163[_0xe980('0x3a')]=_0x346163['attributes'][_0xe980('0x3c')]?_0x346163[_0xe980('0x3a')]:_0xa1f1dc[_0xe980('0x39')];if(!_0x30c561[_0xe980('0x35')][_0xe980('0x3d')](_0xe980('0x3e'))){_0x346163[_0xe980('0x1a')]=qs['limit'](_0x30c561[_0xe980('0x35')][_0xe980('0x1a')]);_0x346163['offset']=qs['offset'](_0x30c561[_0xe980('0x35')][_0xe980('0x1d')]);}_0x346163['order']=qs['sort'](_0x30c561[_0xe980('0x35')][_0xe980('0x3f')]);_0x346163['where']=qs['filters'](_[_0xe980('0x40')](_0x30c561['query'],_0xa1f1dc[_0xe980('0x37')]));_0x346163[_0xe980('0x42')][_0xe980('0x61')]=_0x370ec0['id'];if(_0x30c561['query'][_0xe980('0x27')]){_0x346163[_0xe980('0x42')]=_[_0xe980('0x41')](_0x346163[_0xe980('0x42')],{'$or':_[_0xe980('0x29')](_0x346163[_0xe980('0x3a')],function(_0x4f4065){var _0x320426={};_0x320426[_0x4f4065]={'$like':'%'+_0x30c561[_0xe980('0x35')][_0xe980('0x27')]+'%'};return _0x320426;})});}_0x346163=_[_0xe980('0x41')]({},_0x346163,_0x30c561[_0xe980('0x4a')]);return db[_0xe980('0x67')][_0xe980('0x1c')]({'where':_0x346163[_0xe980('0x42')]})['then'](function(_0x3add5c){_0x1b9ebf[_0xe980('0x1c')]=_0x3add5c;if(_0x30c561[_0xe980('0x35')][_0xe980('0x44')]){_0x346163[_0xe980('0x45')]=[{'all':!![]}];}return db[_0xe980('0x67')][_0xe980('0x46')](_0x346163);})[_0xe980('0x22')](function(_0x17f37b){_0x1b9ebf[_0xe980('0x47')]=_0x17f37b;return _0x1b9ebf;});}})[_0xe980('0x22')](respondWithFilteredResult(_0x110af7,_0x346163))['catch'](handleError(_0x110af7,null));};exports[_0xe980('0x68')]=function(_0x2b16dc,_0x34c213,_0x5969b9){var _0xf945c7={};var _0x147927={};var _0x39f396;var _0x210aa8;return db[_0xe980('0x32')][_0xe980('0x5e')]({'where':{'id':_0x2b16dc[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x34c213,null))[_0xe980('0x22')](function(_0x4081ac){if(_0x4081ac){_0x39f396=_0x4081ac;_0x147927[_0xe980('0x39')]=_[_0xe980('0x36')](db[_0xe980('0x69')][_0xe980('0x33')]);_0x147927['query']=_[_0xe980('0x36')](_0x2b16dc[_0xe980('0x35')]);_0x147927[_0xe980('0x37')]=_[_0xe980('0x38')](_0x147927['model'],_0x147927[_0xe980('0x35')]);_0xf945c7['attributes']=_[_0xe980('0x38')](_0x147927[_0xe980('0x39')],qs['fields'](_0x2b16dc[_0xe980('0x35')][_0xe980('0x3b')]));_0xf945c7[_0xe980('0x3a')]=_0xf945c7['attributes']['length']?_0xf945c7[_0xe980('0x3a')]:_0x147927['model'];_0xf945c7[_0xe980('0x60')]=qs[_0xe980('0x3f')](_0x2b16dc[_0xe980('0x35')]['sort']);_0xf945c7[_0xe980('0x42')]=qs['filters'](_[_0xe980('0x40')](_0x2b16dc[_0xe980('0x35')],_0x147927[_0xe980('0x37')]));if(_0x2b16dc['query']['filter']){_0xf945c7[_0xe980('0x42')]=_['merge'](_0xf945c7[_0xe980('0x42')],{'$or':_[_0xe980('0x29')](_0xf945c7[_0xe980('0x3a')],function(_0xd15df8){var _0x3f3ea2={};_0x3f3ea2[_0xd15df8]={'$like':'%'+_0x2b16dc[_0xe980('0x35')]['filter']+'%'};return _0x3f3ea2;})});}_0xf945c7=_['merge']({},_0xf945c7,_0x2b16dc['options']);return _0x39f396[_0xe980('0x68')](_0xf945c7);}})['then'](function(_0x5e3437){if(_0x5e3437){_0x210aa8=_0x5e3437[_0xe980('0x3c')];if(!_0x2b16dc[_0xe980('0x35')]['hasOwnProperty']('nolimit')){_0xf945c7['limit']=qs[_0xe980('0x1a')](_0x2b16dc['query']['limit']);_0xf945c7[_0xe980('0x1d')]=qs['offset'](_0x2b16dc[_0xe980('0x35')][_0xe980('0x1d')]);}return _0x39f396[_0xe980('0x68')](_0xf945c7);}})['then'](function(_0x4d4c5a){if(_0x4d4c5a){return _0x4d4c5a?{'count':_0x210aa8,'rows':_0x4d4c5a}:null;}})['then'](respondWithResult(_0x34c213,null))[_0xe980('0x48')](handleError(_0x34c213,null));};exports[_0xe980('0x6a')]=function(_0x304606,_0x200eb1,_0x36ae8c){var _0x126152=_0x304606[_0xe980('0x4c')]['teams'];var _0x4cc03d=_['map'](_0x126152,'id');return db[_0xe980('0x69')][_0xe980('0x46')]({'where':{'id':_0x4cc03d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe980('0x6b'),'attributes':['id',_0xe980('0x2e'),_0xe980('0x6c'),_0xe980('0x6d'),_0xe980('0x6e')],'raw':!![]}]})[_0xe980('0x22')](function(_0x282b15){if(_0x282b15){var _0x2bdb8a=_[_0xe980('0x6f')](_0x282b15,function(_0x5db6ad){var _0x124a12=_0x5db6ad[_0xe980('0x24')]({'plain':!![]});_0x124a12[_0xe980('0x6b')][_0xe980('0x70')](function(_0x2577a3){_0x2577a3[_0xe980('0x71')]=_['find'](_0x126152,{'id':_0x124a12['id']})[_0xe980('0x71')];});return _0x124a12[_0xe980('0x6b')];});return db[_0xe980('0x32')][_0xe980('0x2c')]({'where':{'id':_0x304606['params']['id']}})[_0xe980('0x22')](function(_0x3fdca2){return db[_0xe980('0x72')]['transaction'](function(_0x343e36){return _0x3fdca2[_0xe980('0x6a')](_0x4cc03d,{'transaction':_0x343e36})[_0xe980('0x22')](function(){return BPromise[_0xe980('0x73')](_0x126152,function(_0xbb0b87){return db[_0xe980('0x74')]['upsert']({'TeamId':_0xbb0b87['id'],'VoiceQueueId':_0x304606[_0xe980('0x57')]['id'],'penalty':_0xbb0b87['penalty']},{'transaction':_0x343e36});});})[_0xe980('0x22')](function(){return BPromise[_0xe980('0x73')](_0x2bdb8a,function(_0x563c30){return db[_0xe980('0x75')]['findOrCreate']({'where':{'UserId':_0x563c30['id'],'VoiceQueueId':_0x304606[_0xe980('0x57')]['id']},'defaults':{'penalty':_0x563c30[_0xe980('0x71')]},'transaction':_0x343e36});});})['then'](function(){return BPromise[_0xe980('0x73')](_[_0xe980('0x27')](_0x2bdb8a,{'online':!![]}),function(_0x536a59){return db[_0xe980('0x76')][_0xe980('0x77')]({'membername':_0x536a59[_0xe980('0x2e')],'UserId':_0x536a59['id'],'queue_name':_0x3fdca2[_0xe980('0x2e')],'VoiceQueueId':_0x3fdca2['id'],'interface':_['isNil'](_0x536a59[_0xe980('0x6e')])?util[_0xe980('0x78')]('SIP/%s',_0x536a59[_0xe980('0x2e')]):_0x536a59[_0xe980('0x6e')],'paused':_0x536a59[_0xe980('0x6d')]||![],'penalty':_0x536a59[_0xe980('0x71')]},{'transaction':_0x343e36});});})[_0xe980('0x22')](function(){_0x2bdb8a[_0xe980('0x70')](function(_0x485b84){socket[_0xe980('0x79')](_0xe980('0x7a'),{'UserId':_0x485b84['id'],'VoiceQueueId':_0x3fdca2['id']});});});});});}})[_0xe980('0x22')](respondWithStatusCode(_0x200eb1,null))[_0xe980('0x48')](handleError(_0x200eb1,null));};exports[_0xe980('0x7b')]=function(_0x37a96c,_0x2e1a6b,_0x5692a4){return db['Team']['findAll']({'where':{'id':_0x37a96c[_0xe980('0x35')][_0xe980('0x7c')]},'attributes':['id'],'include':[{'model':db[_0xe980('0x7d')],'as':_0xe980('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xe980('0x22')](handleEntityNotFound(_0x2e1a6b,null))[_0xe980('0x22')](function(_0x392f5f){var _0x5f2802=_[_0xe980('0x29')](_0x392f5f,'id');var _0x15d147=[];var _0x2322f6=[];var _0x4120de=squel[_0xe980('0x7e')]();_0x4120de[_0xe980('0x7f')](_0xe980('0x80'))[_0xe980('0x81')](_0xe980('0x82'),'tq')[_0xe980('0x83')]('user_has_teams','ut',_0xe980('0x84'))['where']('VoiceQueueId\x20=\x20?',_0x37a96c[_0xe980('0x57')]['id']);for(var _0x2cb227=0x0;_0x2cb227<_0x392f5f[_0xe980('0x3c')];_0x2cb227+=0x1){let _0x38c0e5=_0x392f5f[_0x2cb227];for(var _0x3911ff=0x0;_0x3911ff<_0x38c0e5[_0xe980('0x6b')][_0xe980('0x3c')];_0x3911ff+=0x1){let _0x4dcf8e=_0x38c0e5[_0xe980('0x6b')][_0x3911ff];var _0x47afde=_0x4120de[_0xe980('0x56')]();_0x47afde[_0xe980('0x42')](_0xe980('0x85'),_0x4dcf8e['id']);_0x2322f6['push'](db['sequelize'][_0xe980('0x35')](_0x47afde[_0xe980('0x86')](),{'type':db['sequelize'][_0xe980('0x87')][_0xe980('0x88')]})['then'](function(_0x374c44){if(_0x374c44[_0xe980('0x3c')]===0x1){return _0x4dcf8e['id'];}else{var _0x53ea79=_['every'](_[_0xe980('0x29')](_0x374c44,_0xe980('0x89')),function(_0x242735){return _[_0xe980('0x2b')](_0x5f2802,_0x242735);});if(_0x53ea79){return _0x4dcf8e['id'];}}}));}}return BPromise['all'](_0x2322f6)['then'](function(_0x12d554){_0x15d147=_(_0x15d147)[_0xe980('0x8a')](_0x12d554)[_0xe980('0x8b')]()[_0xe980('0x2a')]();return db[_0xe980('0x32')][_0xe980('0x2c')]({'where':{'id':_0x37a96c[_0xe980('0x57')]['id']}})['then'](function(_0x5c60b9){return db[_0xe980('0x72')][_0xe980('0x8c')](function(_0x5e1856){return _0x5c60b9[_0xe980('0x7b')](_0x37a96c[_0xe980('0x35')][_0xe980('0x7c')],{'transaction':_0x5e1856})[_0xe980('0x22')](function(){if(!_[_0xe980('0x8d')](_0x15d147)){return _0x5c60b9[_0xe980('0x8e')](_0x15d147,{'transaction':_0x5e1856})['then'](function(){return db[_0xe980('0x76')]['destroy']({'where':{'VoiceQueueId':_0x37a96c[_0xe980('0x57')]['id'],'UserId':_0x15d147},'transaction':_0x5e1856});});}})['then'](function(){_0x15d147[_0xe980('0x70')](function(_0x38c42d){socket['emit'](_0xe980('0x8f'),{'UserId':_0x38c42d,'VoiceQueueId':_0x5c60b9['id']});});});});});});})['then'](respondWithStatusCode(_0x2e1a6b,null))[_0xe980('0x48')](handleError(_0x2e1a6b,null));};exports[_0xe980('0x90')]=function(_0x4b0cc3,_0x38414a,_0x2be9a0){var _0x7abd39,_0x5c8484;return db['VoiceQueue'][_0xe980('0x2c')]({'where':{'id':_0x4b0cc3[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x38414a,null))[_0xe980('0x22')](function(_0x46c4bf){if(_0x46c4bf){_0x5c8484=_0x46c4bf;return _0x46c4bf['addAgents'](_0x4b0cc3['body'][_0xe980('0x7c')],_[_0xe980('0x58')](_0x4b0cc3[_0xe980('0x4c')],[_0xe980('0x7c'),'id'])||{})[_0xe980('0x91')](function(_0x382dcb){for(var _0x4b9689=0x0;_0x4b9689<_0x4b0cc3['body']['ids'][_0xe980('0x3c')];_0x4b9689+=0x1){socket[_0xe980('0x79')](_0xe980('0x7a'),{'UserId':Number(_0x4b0cc3[_0xe980('0x4c')][_0xe980('0x7c')][_0x4b9689]),'VoiceQueueId':Number(_0x4b0cc3[_0xe980('0x57')]['id'])});}return _0x382dcb;});}})[_0xe980('0x22')](function(_0x3cd786){_0x7abd39=_0x3cd786||[];if(_0x5c8484){return db[_0xe980('0x7d')][_0xe980('0x46')]({'where':{'id':_0x4b0cc3[_0xe980('0x4c')][_0xe980('0x7c')]},'attributes':['id',_0xe980('0x2e'),_0xe980('0x6c'),_0xe980('0x6d'),'interface'],'raw':!![]});}})[_0xe980('0x22')](function(_0x546e59){if(!_[_0xe980('0x8d')](_0x546e59)){var _0x52ce8f=[];for(var _0x157d5a=0x0;_0x157d5a<_0x546e59[_0xe980('0x3c')];_0x157d5a++){if(_0x546e59[_0x157d5a]['online']){_0x52ce8f[_0xe980('0x92')](db['UserVoiceQueueRt'][_0xe980('0x77')]({'membername':_0x546e59[_0x157d5a][_0xe980('0x2e')],'UserId':_0x546e59[_0x157d5a]['id'],'queue_name':_0x5c8484[_0xe980('0x2e')],'VoiceQueueId':_0x5c8484['id'],'interface':_[_0xe980('0x93')](_0x546e59[_0x157d5a][_0xe980('0x6e')])?util['format']('SIP/%s',_0x546e59[_0x157d5a]['name']):_0x546e59[_0x157d5a][_0xe980('0x6e')],'paused':_0x546e59[_0x157d5a][_0xe980('0x6d')]||![],'penalty':_0x4b0cc3[_0xe980('0x4c')]['penalty']||0x0}));}}return BPromise['all'](_0x52ce8f);}})['then'](function(){return _0x7abd39;})[_0xe980('0x22')](respondWithResult(_0x38414a,null))[_0xe980('0x48')](handleError(_0x38414a,null));};exports[_0xe980('0x8e')]=function(_0x9a2ff3,_0x20d782,_0x226f13){return db[_0xe980('0x32')]['find']({'where':{'id':_0x9a2ff3[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x20d782,null))[_0xe980('0x22')](function(_0x6b23f){if(_0x6b23f){return _0x6b23f[_0xe980('0x8e')](_0x9a2ff3[_0xe980('0x35')][_0xe980('0x7c')])['then'](function(){if(_[_0xe980('0x94')](_0x9a2ff3[_0xe980('0x35')][_0xe980('0x7c')])){for(var _0x3db91d=0x0;_0x3db91d<_0x9a2ff3[_0xe980('0x35')][_0xe980('0x7c')][_0xe980('0x3c')];_0x3db91d+=0x1){socket[_0xe980('0x79')](_0xe980('0x8f'),{'UserId':Number(_0x9a2ff3[_0xe980('0x35')]['ids'][_0x3db91d]),'VoiceQueueId':Number(_0x9a2ff3[_0xe980('0x57')]['id'])});}}else{socket[_0xe980('0x79')](_0xe980('0x8f'),{'UserId':Number(_0x9a2ff3['query'][_0xe980('0x7c')]),'VoiceQueueId':Number(_0x9a2ff3[_0xe980('0x57')]['id'])});}});}})[_0xe980('0x22')](function(_0x205b0e){return db[_0xe980('0x76')][_0xe980('0x23')]({'where':{'VoiceQueueId':_0x9a2ff3[_0xe980('0x57')]['id'],'UserId':_0x9a2ff3[_0xe980('0x35')][_0xe980('0x7c')]}})[_0xe980('0x22')](function(){return _0x205b0e;});})[_0xe980('0x22')](respondWithStatusCode(_0x20d782,null))['catch'](handleError(_0x20d782,null));};exports[_0xe980('0x95')]=function(_0x559cdc,_0x517631,_0x578acb){var _0x1a3b21={};var _0x2e906a={};var _0x1d7c52;var _0x18244d;return db['VoiceQueue']['findOne']({'where':{'id':_0x559cdc[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x517631,null))['then'](function(_0x4b4af2){if(_0x4b4af2){_0x1d7c52=_0x4b4af2;_0x2e906a['model']=_['keys'](db[_0xe980('0x7d')][_0xe980('0x33')]);_0x2e906a[_0xe980('0x35')]=_['keys'](_0x559cdc[_0xe980('0x35')]);_0x2e906a['filters']=_[_0xe980('0x38')](_0x2e906a[_0xe980('0x39')],_0x2e906a[_0xe980('0x35')]);_0x1a3b21['attributes']=_[_0xe980('0x38')](_0x2e906a['model'],qs[_0xe980('0x3b')](_0x559cdc[_0xe980('0x35')][_0xe980('0x3b')]));_0x1a3b21[_0xe980('0x3a')]=_0x1a3b21['attributes'][_0xe980('0x3c')]?_0x1a3b21[_0xe980('0x3a')]:_0x2e906a[_0xe980('0x39')];_0x1a3b21[_0xe980('0x60')]=qs['sort'](_0x559cdc[_0xe980('0x35')][_0xe980('0x3f')]);_0x1a3b21[_0xe980('0x42')]=qs[_0xe980('0x37')](_[_0xe980('0x40')](_0x559cdc[_0xe980('0x35')],_0x2e906a[_0xe980('0x37')]));if(_0x559cdc[_0xe980('0x35')][_0xe980('0x27')]){_0x1a3b21[_0xe980('0x42')]=_['merge'](_0x1a3b21[_0xe980('0x42')],{'$or':_['map'](_0x1a3b21['attributes'],function(_0x3bbe3d){var _0x2a192e={};_0x2a192e[_0x3bbe3d]={'$like':'%'+_0x559cdc[_0xe980('0x35')][_0xe980('0x27')]+'%'};return _0x2a192e;})});}_0x1a3b21=_['merge']({},_0x1a3b21,_0x559cdc[_0xe980('0x4a')]);return _0x1d7c52['getAgents'](_0x1a3b21);}})['then'](function(_0x14d5b5){if(_0x14d5b5){_0x18244d=_0x14d5b5['length'];if(!_0x559cdc[_0xe980('0x35')][_0xe980('0x3d')](_0xe980('0x3e'))){_0x1a3b21['limit']=qs[_0xe980('0x1a')](_0x559cdc['query'][_0xe980('0x1a')]);_0x1a3b21['offset']=qs[_0xe980('0x1d')](_0x559cdc['query'][_0xe980('0x1d')]);}return _0x1d7c52['getAgents'](_0x1a3b21);}})[_0xe980('0x22')](function(_0x36ac10){if(_0x36ac10){return _0x36ac10?{'count':_0x18244d,'rows':_0x36ac10}:null;}})[_0xe980('0x22')](respondWithResult(_0x517631,null))[_0xe980('0x48')](handleError(_0x517631,null));};exports[_0xe980('0x96')]=function(_0x5daa62,_0x1ce9d9,_0x3e8efc){var _0x483d17={};var _0x52bfa6={};var _0x2c0002;var _0x54f1c5;return db[_0xe980('0x32')][_0xe980('0x5e')]({'where':{'id':_0x5daa62[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x1ce9d9,null))[_0xe980('0x22')](function(_0xb49b6b){if(_0xb49b6b){_0x2c0002=_0xb49b6b;_0x52bfa6[_0xe980('0x39')]=_['keys'](db[_0xe980('0x76')][_0xe980('0x33')]);_0x52bfa6['query']=_['keys'](_0x5daa62[_0xe980('0x35')]);_0x52bfa6['filters']=_[_0xe980('0x38')](_0x52bfa6[_0xe980('0x39')],_0x52bfa6[_0xe980('0x35')]);_0x483d17[_0xe980('0x3a')]=_['intersection'](_0x52bfa6[_0xe980('0x39')],qs[_0xe980('0x3b')](_0x5daa62[_0xe980('0x35')][_0xe980('0x3b')]));_0x483d17[_0xe980('0x3a')]=_0x483d17['attributes']['length']?_0x483d17[_0xe980('0x3a')]:_0x52bfa6['model'];_0x483d17['order']=qs[_0xe980('0x3f')](_0x5daa62['query'][_0xe980('0x3f')]);_0x483d17[_0xe980('0x42')]=qs[_0xe980('0x37')](_[_0xe980('0x40')](_0x5daa62[_0xe980('0x35')],_0x52bfa6['filters']));if(_0x5daa62[_0xe980('0x35')][_0xe980('0x27')]){_0x483d17[_0xe980('0x42')]=_[_0xe980('0x41')](_0x483d17[_0xe980('0x42')],{'$or':_[_0xe980('0x29')](_0x483d17[_0xe980('0x3a')],function(_0x8ab43e){var _0x318673={};_0x318673[_0x8ab43e]={'$like':'%'+_0x5daa62['query'][_0xe980('0x27')]+'%'};return _0x318673;})});}_0x483d17=_[_0xe980('0x41')]({},_0x483d17,_0x5daa62['options']);return _0x2c0002[_0xe980('0x96')](_0x483d17);}})[_0xe980('0x22')](function(_0x2ae9d0){if(_0x2ae9d0){_0x54f1c5=_0x2ae9d0['length'];if(!_0x5daa62[_0xe980('0x35')][_0xe980('0x3d')](_0xe980('0x3e'))){_0x483d17[_0xe980('0x1a')]=qs[_0xe980('0x1a')](_0x5daa62['query'][_0xe980('0x1a')]);_0x483d17[_0xe980('0x1d')]=qs['offset'](_0x5daa62[_0xe980('0x35')]['offset']);}return _0x2c0002[_0xe980('0x96')](_0x483d17);}})[_0xe980('0x22')](function(_0x267dec){return _0x267dec?{'count':_0x54f1c5,'rows':_0x267dec}:null;})[_0xe980('0x22')](respondWithResult(_0x1ce9d9,null))['catch'](handleError(_0x1ce9d9,null));};exports['getLists']=function(_0x20c4ee,_0x5e0b70,_0x25a217){var _0x485a37={};var _0x25c687={};var _0x397fbd;var _0x4dd76a;return db[_0xe980('0x32')]['findOne']({'where':{'id':_0x20c4ee[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x5e0b70,null))[_0xe980('0x22')](function(_0x2f017b){if(_0x2f017b){_0x397fbd=_0x2f017b;_0x25c687['model']=_[_0xe980('0x36')](db['CmList']['rawAttributes']);_0x25c687[_0xe980('0x35')]=_[_0xe980('0x36')](_0x20c4ee['query']);_0x25c687['filters']=_[_0xe980('0x38')](_0x25c687[_0xe980('0x39')],_0x25c687[_0xe980('0x35')]);_0x485a37[_0xe980('0x3a')]=_[_0xe980('0x38')](_0x25c687[_0xe980('0x39')],qs['fields'](_0x20c4ee['query'][_0xe980('0x3b')]));_0x485a37[_0xe980('0x3a')]=_0x485a37[_0xe980('0x3a')][_0xe980('0x3c')]?_0x485a37[_0xe980('0x3a')]:_0x25c687[_0xe980('0x39')];_0x485a37[_0xe980('0x60')]=qs[_0xe980('0x3f')](_0x20c4ee[_0xe980('0x35')][_0xe980('0x3f')]);_0x485a37['where']=qs['filters'](_[_0xe980('0x40')](_0x20c4ee[_0xe980('0x35')],_0x25c687[_0xe980('0x37')]));if(_0x20c4ee['query'][_0xe980('0x27')]){_0x485a37['where']=_[_0xe980('0x41')](_0x485a37[_0xe980('0x42')],{'$or':_['map'](_0x485a37['attributes'],function(_0x218c4c){var _0x43061b={};_0x43061b[_0x218c4c]={'$like':'%'+_0x20c4ee['query'][_0xe980('0x27')]+'%'};return _0x43061b;})});}_0x485a37=_['merge']({},_0x485a37,_0x20c4ee['options']);return _0x397fbd[_0xe980('0x97')](_0x485a37);}})[_0xe980('0x22')](function(_0x2e1968){if(_0x2e1968){_0x4dd76a=_0x2e1968['length'];if(!_0x20c4ee[_0xe980('0x35')][_0xe980('0x3d')](_0xe980('0x3e'))){_0x485a37[_0xe980('0x1a')]=qs[_0xe980('0x1a')](_0x20c4ee['query'][_0xe980('0x1a')]);_0x485a37[_0xe980('0x1d')]=qs[_0xe980('0x1d')](_0x20c4ee['query'][_0xe980('0x1d')]);}return _0x397fbd[_0xe980('0x97')](_0x485a37);}})['then'](function(_0x2cf352){if(_0x2cf352){return _0x2cf352?{'count':_0x4dd76a,'rows':_0x2cf352}:null;}})[_0xe980('0x22')](respondWithResult(_0x5e0b70,null))[_0xe980('0x48')](handleError(_0x5e0b70,null));};exports[_0xe980('0x98')]=function(_0x139c37,_0x161b4c,_0x39428d){var _0x431240=moment()[_0xe980('0x78')](_0xe980('0x99'));var _0x20d598,_0x242778;return db[_0xe980('0x32')][_0xe980('0x2c')]({'where':{'id':_0x139c37['params']['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x161b4c,null))[_0xe980('0x22')](function(_0x415dff){if(_0x415dff){_0x242778=_0x415dff;return _0x415dff[_0xe980('0x98')](_0x139c37[_0xe980('0x4c')][_0xe980('0x7c')],_[_0xe980('0x58')](_0x139c37['body'],[_0xe980('0x7c'),'id'])||{});}return null;})['spread'](function(_0x55e970){var _0x2730f4;_0x20d598=_0x55e970||[];var _0x38841d=[];if(_0x55e970){for(var _0x423a8d=0x0;_0x423a8d<_0x55e970['length'];_0x423a8d+=0x1){var _0x2382ca=_0x55e970[_0x423a8d][_0xe980('0x24')]({'plain':!![]});_0x242778[_0xe980('0x9a')]=_0x139c37[_0xe980('0x4c')][_0xe980('0x9a')]?_0x139c37['body'][_0xe980('0x9a')]:_0x242778['dialCheckDuplicateType'];switch(_0x242778[_0xe980('0x9a')]){case _0xe980('0x9b'):_0x2730f4=squel[_0xe980('0x9c')]()[_0xe980('0x9d')](_0xe980('0x9e'))[_0xe980('0x9f')]([_0xe980('0xa0'),_0xe980('0xa1'),_0xe980('0xa2'),_0xe980('0xa3'),'VoiceQueueId',_0xe980('0x5a'),'updatedAt'],squel[_0xe980('0x7e')]()['field'](_0xe980('0xa0'),'phone')['field']('\x27'+_0x431240+'\x27',_0xe980('0xa1'))[_0xe980('0x7f')]('id',_0xe980('0xa2'))[_0xe980('0x7f')](_0x2382ca[_0xe980('0xa4')][_0xe980('0x86')](),_0xe980('0xa3'))[_0xe980('0x7f')](_0x139c37['params']['id'][_0xe980('0x86')](),'VoiceQueueId')[_0xe980('0x7f')]('\x27'+_0x431240+'\x27',_0xe980('0x5a'))['field']('\x27'+_0x431240+'\x27',_0xe980('0x59'))[_0xe980('0x81')](_0xe980('0xa5'))[_0xe980('0x42')]('deletedAt\x20IS\x20NULL')[_0xe980('0x42')](_0xe980('0xa6'),_0x2382ca[_0xe980('0xa4')][_0xe980('0x86')]())[_0xe980('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xe980('0x42')](_0xe980('0xa7'),squel['select']()[_0xe980('0x7f')](_0xe980('0xa8'))[_0xe980('0x81')](_0xe980('0xa9'))['where'](_0xe980('0xaa'),_0x139c37[_0xe980('0x57')]['id'][_0xe980('0x86')]()))['where'](_0xe980('0xa7'),squel[_0xe980('0x7e')]()[_0xe980('0x7f')](_0xe980('0xab'))[_0xe980('0x81')](_0xe980('0x9e'))['where'](_0xe980('0xaa'),_0x139c37[_0xe980('0x57')]['id'][_0xe980('0x86')]())))[_0xe980('0x86')]();break;case _0xe980('0xac'):_0x2730f4=squel[_0xe980('0x9c')]()['into'](_0xe980('0x9e'))[_0xe980('0x9f')](['phone','scheduledAt','ContactId',_0xe980('0xa3'),_0xe980('0x61'),_0xe980('0x5a'),_0xe980('0x59')],squel[_0xe980('0x7e')]()[_0xe980('0x7f')](_0xe980('0xa0'),'phone')['field']('\x27'+_0x431240+'\x27','scheduledAt')[_0xe980('0x7f')]('id','ContactId')[_0xe980('0x7f')](_0x2382ca[_0xe980('0xa4')]['toString'](),_0xe980('0xa3'))[_0xe980('0x7f')](_0x139c37[_0xe980('0x57')]['id']['toString'](),_0xe980('0x61'))['field']('\x27'+_0x431240+'\x27','createdAt')['field']('\x27'+_0x431240+'\x27','updatedAt')['from'](_0xe980('0xa5'))[_0xe980('0x42')](_0xe980('0xad'))[_0xe980('0x42')](_0xe980('0xa6'),_0x2382ca['CmListId'][_0xe980('0x86')]())[_0xe980('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xe980('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe980('0x7e')]()[_0xe980('0x7f')](_0xe980('0xab'))[_0xe980('0x81')]('cm_hopper')[_0xe980('0x42')](_0xe980('0xaa'),_0x139c37[_0xe980('0x57')]['id']['toString']())))[_0xe980('0x86')]();break;default:_0x2730f4=squel['insert']()[_0xe980('0x9d')]('cm_hopper')[_0xe980('0x9f')]([_0xe980('0xa0'),_0xe980('0xa1'),_0xe980('0xa2'),'ListId',_0xe980('0x61'),_0xe980('0x5a'),_0xe980('0x59')],squel[_0xe980('0x7e')]()[_0xe980('0x7f')](_0xe980('0xa0'),'phone')[_0xe980('0x7f')]('\x27'+_0x431240+'\x27',_0xe980('0xa1'))[_0xe980('0x7f')]('id',_0xe980('0xa2'))[_0xe980('0x7f')](_0x2382ca[_0xe980('0xa4')][_0xe980('0x86')](),'ListId')[_0xe980('0x7f')](_0x139c37['params']['id'][_0xe980('0x86')](),_0xe980('0x61'))[_0xe980('0x7f')]('\x27'+_0x431240+'\x27',_0xe980('0x5a'))[_0xe980('0x7f')]('\x27'+_0x431240+'\x27',_0xe980('0x59'))[_0xe980('0x81')]('cm_contacts')[_0xe980('0x42')](_0xe980('0xad'))['where'](_0xe980('0xa6'),_0x2382ca['CmListId']['toString']())[_0xe980('0x42')](_0xe980('0xae')))[_0xe980('0x86')]();}_0x38841d[_0xe980('0x92')](db[_0xe980('0x72')][_0xe980('0x35')](_0x2730f4));}return BPromise[_0xe980('0xaf')](_0x38841d);}})[_0xe980('0x22')](function(){var _0x1fba05=[];var _0x1430c1=squel[_0xe980('0x9c')]()[_0xe980('0x9d')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0xe980('0xa0'),_0xe980('0xb0'),_0xe980('0x5a'),_0xe980('0x59')],squel[_0xe980('0x7e')]()[_0xe980('0x7f')](_0xe980('0xb1'))[_0xe980('0x7f')](_0xe980('0xb2'))['field'](_0xe980('0xb3'))[_0xe980('0x7f')]('\x27'+_0x431240+'\x27',_0xe980('0x5a'))[_0xe980('0x7f')]('\x27'+_0x431240+'\x27',_0xe980('0x59'))[_0xe980('0x81')]('cm_contact_has_items','ci')['join'](_0xe980('0x9e'),'h',_0xe980('0xb4'))['where']('h.scheduledat=?',_0x431240)[_0xe980('0x42')](_0xe980('0xb5'),_0xe980('0xb6')))[_0xe980('0x86')]();_0x1fba05['push'](db[_0xe980('0x72')]['query'](_0x1430c1));return BPromise[_0xe980('0xaf')](_0x1fba05);})[_0xe980('0x22')](function(){return _0x20d598;})[_0xe980('0x22')](respondWithResult(_0x161b4c,null))[_0xe980('0x48')](handleError(_0x161b4c,null));};exports[_0xe980('0xb7')]=function(_0x1237db,_0x4498e2,_0x451731){return db['VoiceQueue'][_0xe980('0x2c')]({'where':{'id':_0x1237db[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x4498e2,null))['then'](function(_0x151fcf){if(_0x151fcf){return _0x151fcf[_0xe980('0xb7')](_0x1237db[_0xe980('0x35')][_0xe980('0x7c')]);}})[_0xe980('0x22')](function(_0x5024e8){if(_0x5024e8){return db[_0xe980('0x5f')][_0xe980('0x23')]({'where':{'ListId':_0x1237db[_0xe980('0x35')][_0xe980('0x7c')],'VoiceQueueId':_0x1237db[_0xe980('0x57')]['id']}})[_0xe980('0x22')](function(){return _0x5024e8;});}})['then'](respondWithStatusCode(_0x4498e2,null))[_0xe980('0x48')](handleError(_0x4498e2,null));};exports['getBlackLists']=function(_0x1b84b5,_0x141eaf,_0x807c50){var _0x5e5cd8={};var _0x347c13={};var _0x1e9e71;var _0x14dcf2;return db[_0xe980('0x32')][_0xe980('0x5e')]({'where':{'id':_0x1b84b5[_0xe980('0x57')]['id']}})['then'](handleEntityNotFound(_0x141eaf,null))[_0xe980('0x22')](function(_0x339bda){if(_0x339bda){_0x1e9e71=_0x339bda;_0x347c13[_0xe980('0x39')]=_[_0xe980('0x36')](db[_0xe980('0xb8')][_0xe980('0x33')]);_0x347c13[_0xe980('0x35')]=_['keys'](_0x1b84b5[_0xe980('0x35')]);_0x347c13[_0xe980('0x37')]=_[_0xe980('0x38')](_0x347c13['model'],_0x347c13['query']);_0x5e5cd8[_0xe980('0x3a')]=_[_0xe980('0x38')](_0x347c13[_0xe980('0x39')],qs['fields'](_0x1b84b5[_0xe980('0x35')]['fields']));_0x5e5cd8['attributes']=_0x5e5cd8[_0xe980('0x3a')][_0xe980('0x3c')]?_0x5e5cd8['attributes']:_0x347c13[_0xe980('0x39')];_0x5e5cd8[_0xe980('0x60')]=qs['sort'](_0x1b84b5[_0xe980('0x35')][_0xe980('0x3f')]);_0x5e5cd8['where']=qs[_0xe980('0x37')](_['pick'](_0x1b84b5[_0xe980('0x35')],_0x347c13[_0xe980('0x37')]));if(_0x1b84b5[_0xe980('0x35')][_0xe980('0x27')]){_0x5e5cd8['where']=_['merge'](_0x5e5cd8[_0xe980('0x42')],{'$or':_[_0xe980('0x29')](_0x5e5cd8[_0xe980('0x3a')],function(_0xbf26e6){var _0xf84edf={};_0xf84edf[_0xbf26e6]={'$like':'%'+_0x1b84b5[_0xe980('0x35')][_0xe980('0x27')]+'%'};return _0xf84edf;})});}_0x5e5cd8=_[_0xe980('0x41')]({},_0x5e5cd8,_0x1b84b5[_0xe980('0x4a')]);return _0x1e9e71[_0xe980('0xb9')](_0x5e5cd8);}})[_0xe980('0x22')](function(_0x2dff88){if(_0x2dff88){_0x14dcf2=_0x2dff88[_0xe980('0x3c')];if(!_0x1b84b5[_0xe980('0x35')][_0xe980('0x3d')](_0xe980('0x3e'))){_0x5e5cd8[_0xe980('0x1a')]=qs['limit'](_0x1b84b5['query'][_0xe980('0x1a')]);_0x5e5cd8[_0xe980('0x1d')]=qs[_0xe980('0x1d')](_0x1b84b5[_0xe980('0x35')][_0xe980('0x1d')]);}return _0x1e9e71[_0xe980('0xb9')](_0x5e5cd8);}})[_0xe980('0x22')](function(_0x2828d3){if(_0x2828d3){return _0x2828d3?{'count':_0x14dcf2,'rows':_0x2828d3}:null;}})[_0xe980('0x22')](respondWithResult(_0x141eaf,null))[_0xe980('0x48')](handleError(_0x141eaf,null));};exports[_0xe980('0xba')]=function(_0x202efa,_0x597123,_0x4a1b05){var _0x35c287,_0x3fff1f;return db[_0xe980('0x32')][_0xe980('0x2c')]({'where':{'id':_0x202efa['params']['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x597123,null))[_0xe980('0x22')](function(_0x5c9223){if(_0x5c9223){_0x3fff1f=_0x5c9223;return _0x5c9223[_0xe980('0xba')](_0x202efa[_0xe980('0x4c')][_0xe980('0x7c')],_[_0xe980('0x58')](_0x202efa[_0xe980('0x4c')],[_0xe980('0x7c'),'id'])||{});}return null;})['spread'](function(_0x55887d){var _0x3cf3ae;_0x35c287=_0x55887d||[];var _0x27040f=[];if(_0x55887d){for(var _0x1b1cb5=0x0;_0x1b1cb5<_0x55887d[_0xe980('0x3c')];_0x1b1cb5+=0x1){var _0x464e6f=_0x55887d[_0x1b1cb5]['get']({'plain':!![]});_0x3cf3ae=squel[_0xe980('0x9c')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0xe980('0xa2'),_0xe980('0xa3'),_0xe980('0x61'),_0xe980('0x5a'),_0xe980('0x59')],squel[_0xe980('0x7e')]()['field'](_0xe980('0xa0'),'phone')[_0xe980('0x7f')]('id',_0xe980('0xa2'))[_0xe980('0x7f')](_0x464e6f[_0xe980('0xa4')][_0xe980('0x86')](),_0xe980('0xa3'))['field'](_0x202efa[_0xe980('0x57')]['id'][_0xe980('0x86')](),_0xe980('0x61'))[_0xe980('0x7f')](_0xe980('0xbb'),'createdAt')[_0xe980('0x7f')]('NOW()','updatedAt')[_0xe980('0x81')](_0xe980('0xa5'))[_0xe980('0x42')]('deletedAt\x20IS\x20NULL')[_0xe980('0x42')](_0xe980('0xa6'),_0x464e6f[_0xe980('0xa4')][_0xe980('0x86')]())[_0xe980('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xe980('0x86')]();_0x27040f['push'](db[_0xe980('0x72')][_0xe980('0x35')](_0x3cf3ae));}return BPromise['all'](_0x27040f);}})['then'](function(){return _0x35c287;})[_0xe980('0x22')](respondWithResult(_0x597123,null))[_0xe980('0x48')](handleError(_0x597123,null));};exports['removeBlackLists']=function(_0xaab164,_0x13d0cf,_0x3e8104){return db[_0xe980('0x32')][_0xe980('0x2c')]({'where':{'id':_0xaab164[_0xe980('0x57')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0x13d0cf,null))[_0xe980('0x22')](function(_0x367691){if(_0x367691){return _0x367691[_0xe980('0xbc')](_0xaab164[_0xe980('0x35')][_0xe980('0x7c')]);}})[_0xe980('0x22')](function(_0x2e4bdb){if(_0x2e4bdb){return db[_0xe980('0x67')][_0xe980('0x23')]({'where':{'ListId':_0xaab164[_0xe980('0x35')][_0xe980('0x7c')],'VoiceQueueId':_0xaab164[_0xe980('0x57')]['id']}})[_0xe980('0x22')](function(){return _0x2e4bdb;});}})[_0xe980('0x22')](respondWithStatusCode(_0x13d0cf,null))[_0xe980('0x48')](handleError(_0x13d0cf,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e6afb40..41635ef 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 _0x5304=['events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x368d26,_0x91c8f1){var _0x117dfe=function(_0x42aa53){while(--_0x42aa53){_0x368d26['push'](_0x368d26['shift']());}};_0x117dfe(++_0x91c8f1);}(_0x5304,0xaa));var _0x4530=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x5304[_0x4d7f3f];return _0x5d67cc;};'use strict';var EventEmitter=require(_0x4530('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x4530('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4530('0x2')](0x0);var events={'afterCreate':_0x4530('0x3'),'afterUpdate':_0x4530('0x4'),'afterDestroy':_0x4530('0x5')};function emitEvent(_0x3d65d2){return function(_0x260586,_0x181361,_0x1f7899){VoiceQueueEvents[_0x4530('0x6')](_0x3d65d2+':'+_0x260586['id'],_0x260586);VoiceQueueEvents[_0x4530('0x6')](_0x3d65d2,_0x260586);_0x1f7899(null);};}for(var e in events){if(events[_0x4530('0x7')](e)){var event=events[e];VoiceQueue[_0x4530('0x8')](e,emitEvent(event));}}module[_0x4530('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xbfdd=['exports','events','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x35f0d0,_0x49bbac){var _0xe71fb7=function(_0x294994){while(--_0x294994){_0x35f0d0['push'](_0x35f0d0['shift']());}};_0xe71fb7(++_0x49bbac);}(_0xbfdd,0xa2));var _0xdbfd=function(_0x7b8a87,_0x2f2523){_0x7b8a87=_0x7b8a87-0x0;var _0x2131a1=_0xbfdd[_0x7b8a87];return _0x2131a1;};'use strict';var EventEmitter=require(_0xdbfd('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdbfd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdbfd('0x2'),'afterDestroy':_0xdbfd('0x3')};function emitEvent(_0x17a23f){return function(_0x1e10c2,_0x424585,_0x1f91dc){VoiceQueueEvents[_0xdbfd('0x4')](_0x17a23f+':'+_0x1e10c2['id'],_0x1e10c2);VoiceQueueEvents[_0xdbfd('0x4')](_0x17a23f,_0x1e10c2);_0x1f91dc(null);};}for(var e in events){if(events[_0xdbfd('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xdbfd('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 59eb43f..ea6141e 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x21b95c,_0x35c39e){var _0x1ede2f=function(_0x40be0a){while(--_0x40be0a){_0x21b95c['push'](_0x21b95c['shift']());}};_0x1ede2f(++_0x35c39e);}(_0x008c,0x188));var _0xc008=function(_0x382868,_0xb5acfd){_0x382868=_0x382868-0x0;var _0x43e191=_0x008c[_0x382868];return _0x43e191;};'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')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'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(_0x24783a,_0x75041){var _0x227a77=function(_0x2b736d){while(--_0x2b736d){_0x24783a['push'](_0x24783a['shift']());}};_0x227a77(++_0x75041);}(_0x3e74,0x175));var _0x43e7=function(_0x81bc55,_0x6e09f4){_0x81bc55=_0x81bc55-0x0;var _0x18fac2=_0x3e74[_0x81bc55];return _0x18fac2;};'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 20a65b7..703cc2c 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 _0x9693=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','GetVoiceQueue','findAll','options','where','limit','include','model','attributes','catch','ShowVoiceQueue','VoiceQueue','raw','map','lodash'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x9693,0x9f));var _0x3969=function(_0x436a6b,_0x337530){_0x436a6b=_0x436a6b-0x0;var _0x26024d=_0x9693[_0x436a6b];return _0x26024d;};'use strict';var _=require(_0x3969('0x0'));var util=require('util');var moment=require(_0x3969('0x1'));var BPromise=require(_0x3969('0x2'));var rs=require(_0x3969('0x3'));var fs=require('fs');var Redis=require(_0x3969('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3969('0x5'));var logger=require(_0x3969('0x6'))('rpc');var config=require(_0x3969('0x7'));var jayson=require(_0x3969('0x8'));var client=jayson[_0x3969('0x9')][_0x3969('0xa')]({'port':0x232a});config[_0x3969('0xb')]=_[_0x3969('0xc')](config[_0x3969('0xb')],{'host':_0x3969('0xd'),'port':0x18eb});var socket=require(_0x3969('0xe'))(new Redis(config[_0x3969('0xb')]));require(_0x3969('0xf'))[_0x3969('0x10')](socket);function respondWithRpcPromise(_0x567641,_0x300a60,_0x3fba01){return new BPromise(function(_0x400c4f,_0x1e2a79){return client[_0x3969('0x11')](_0x567641,_0x3fba01)[_0x3969('0x12')](function(_0x91eca0){logger[_0x3969('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x300a60,_0x3969('0x14'));logger[_0x3969('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x300a60,_0x3969('0x14'),JSON[_0x3969('0x16')](_0x91eca0));if(_0x91eca0[_0x3969('0x17')]){if(_0x91eca0[_0x3969('0x17')][_0x3969('0x18')]===0x1f4){logger['error'](_0x3969('0x19'),_0x300a60,_0x91eca0[_0x3969('0x17')]['message']);return _0x1e2a79(_0x91eca0[_0x3969('0x17')][_0x3969('0x1a')]);}logger[_0x3969('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x300a60,_0x91eca0[_0x3969('0x17')][_0x3969('0x1a')]);return _0x400c4f(_0x91eca0['error'][_0x3969('0x1a')]);}else{logger[_0x3969('0x13')](_0x3969('0x19'),_0x300a60,_0x3969('0x14'));_0x400c4f(_0x91eca0['result'][_0x3969('0x1a')]);}})['catch'](function(_0x252898){logger[_0x3969('0x17')](_0x3969('0x19'),_0x300a60,_0x252898);_0x1e2a79(_0x252898);});});}exports[_0x3969('0x1b')]=function(_0x4f7cd9){var _0x39f091=this;return new Promise(function(_0x255c68,_0x2c87a1){return db['VoiceQueue'][_0x3969('0x1c')]({'raw':_0x4f7cd9[_0x3969('0x1d')]?_0x4f7cd9[_0x3969('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4f7cd9['options']?_0x4f7cd9[_0x3969('0x1d')][_0x3969('0x1e')]||null:null,'attributes':_0x4f7cd9[_0x3969('0x1d')]?_0x4f7cd9[_0x3969('0x1d')]['attributes']||null:null,'limit':_0x4f7cd9[_0x3969('0x1d')]?_0x4f7cd9[_0x3969('0x1d')][_0x3969('0x1f')]||null:null,'include':_0x4f7cd9['options']?_0x4f7cd9[_0x3969('0x1d')][_0x3969('0x20')]?_['map'](_0x4f7cd9['options'][_0x3969('0x20')],function(_0x54a733){return{'model':db[_0x54a733[_0x3969('0x21')]],'as':_0x54a733['as'],'attributes':_0x54a733[_0x3969('0x22')],'include':_0x54a733['include']?_['map'](_0x54a733[_0x3969('0x20')],function(_0xa1b854){return{'model':db[_0xa1b854[_0x3969('0x21')]],'as':_0xa1b854['as'],'attributes':_0xa1b854[_0x3969('0x22')],'include':_0xa1b854[_0x3969('0x20')]?_['map'](_0xa1b854[_0x3969('0x20')],function(_0x247b6c){return{'model':db[_0x247b6c[_0x3969('0x21')]],'as':_0x247b6c['as'],'attributes':_0x247b6c[_0x3969('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3969('0x12')](function(_0x2969f1){logger[_0x3969('0x13')](_0x3969('0x1b'),_0x4f7cd9);logger[_0x3969('0x15')](_0x3969('0x1b'),_0x4f7cd9,JSON[_0x3969('0x16')](_0x2969f1));_0x255c68(_0x2969f1);})[_0x3969('0x23')](function(_0x176ad2){logger[_0x3969('0x17')](_0x3969('0x1b'),_0x176ad2['message'],_0x4f7cd9);_0x2c87a1(_0x39f091[_0x3969('0x17')](0x1f4,_0x176ad2[_0x3969('0x1a')]));});});};exports[_0x3969('0x24')]=function(_0xf307){var _0x2b45a7=this;return new Promise(function(_0x4b1f93,_0x647a96){return db[_0x3969('0x25')]['find']({'raw':_0xf307[_0x3969('0x1d')]?_0xf307['options'][_0x3969('0x26')]===undefined?!![]:![]:!![],'where':_0xf307[_0x3969('0x1d')]?_0xf307[_0x3969('0x1d')]['where']||null:null,'attributes':_0xf307[_0x3969('0x1d')]?_0xf307['options']['attributes']||null:null,'include':_0xf307['options']?_0xf307['options'][_0x3969('0x20')]?_['map'](_0xf307['options']['include'],function(_0x6c067c){return{'model':db[_0x6c067c[_0x3969('0x21')]],'as':_0x6c067c['as'],'attributes':_0x6c067c[_0x3969('0x22')],'include':_0x6c067c['include']?_[_0x3969('0x27')](_0x6c067c['include'],function(_0x3c8c94){return{'model':db[_0x3c8c94['model']],'as':_0x3c8c94['as'],'attributes':_0x3c8c94['attributes'],'include':_0x3c8c94[_0x3969('0x20')]?_['map'](_0x3c8c94[_0x3969('0x20')],function(_0x438d21){return{'model':db[_0x438d21[_0x3969('0x21')]],'as':_0x438d21['as'],'attributes':_0x438d21[_0x3969('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3969('0x12')](function(_0x3bdb99){logger[_0x3969('0x13')](_0x3969('0x24'),_0xf307);logger['debug'](_0x3969('0x24'),_0xf307,JSON['stringify'](_0x3bdb99));_0x4b1f93(_0x3bdb99);})[_0x3969('0x23')](function(_0x1e3c43){logger['error']('ShowVoiceQueue',_0x1e3c43[_0x3969('0x1a')],_0xf307);_0x647a96(_0x2b45a7['error'](0x1f4,_0x1e3c43[_0x3969('0x1a')]));});});}; \ No newline at end of file +var _0xfc06=['catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit','include','model','map','stringify','find','where','ShowVoiceQueue','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueue,\x20%s,\x20%s','info','result'];(function(_0xb919bf,_0x38aec8){var _0xe58236=function(_0x2fa5d8){while(--_0x2fa5d8){_0xb919bf['push'](_0xb919bf['shift']());}};_0xe58236(++_0x38aec8);}(_0xfc06,0xd1));var _0x6fc0=function(_0x4631be,_0x30f31c){_0x4631be=_0x4631be-0x0;var _0x2b03df=_0xfc06[_0x4631be];return _0x2b03df;};'use strict';var _=require(_0x6fc0('0x0'));var util=require(_0x6fc0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6fc0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fc0('0x3'))['db'];var utils=require(_0x6fc0('0x4'));var logger=require(_0x6fc0('0x5'))('rpc');var config=require(_0x6fc0('0x6'));var jayson=require(_0x6fc0('0x7'));var client=jayson[_0x6fc0('0x8')][_0x6fc0('0x9')]({'port':0x232a});config[_0x6fc0('0xa')]=_['defaults'](config[_0x6fc0('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fc0('0xb'))(new Redis(config[_0x6fc0('0xa')]));require(_0x6fc0('0xc'))[_0x6fc0('0xd')](socket);function respondWithRpcPromise(_0x3398c0,_0x4f09b2,_0x54e450){return new BPromise(function(_0x24270a,_0x4a1fd0){return client[_0x6fc0('0xe')](_0x3398c0,_0x54e450)[_0x6fc0('0xf')](function(_0x5765f9){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4f09b2,_0x6fc0('0x10'));logger[_0x6fc0('0x11')](_0x6fc0('0x12'),_0x4f09b2,_0x6fc0('0x10'),JSON['stringify'](_0x5765f9));if(_0x5765f9[_0x6fc0('0x13')]){if(_0x5765f9['error'][_0x6fc0('0x14')]===0x1f4){logger[_0x6fc0('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x4f09b2,_0x5765f9['error'][_0x6fc0('0x15')]);return _0x4a1fd0(_0x5765f9[_0x6fc0('0x13')][_0x6fc0('0x15')]);}logger[_0x6fc0('0x13')](_0x6fc0('0x16'),_0x4f09b2,_0x5765f9[_0x6fc0('0x13')][_0x6fc0('0x15')]);return _0x24270a(_0x5765f9[_0x6fc0('0x13')]['message']);}else{logger[_0x6fc0('0x17')](_0x6fc0('0x16'),_0x4f09b2,'request\x20sent');_0x24270a(_0x5765f9[_0x6fc0('0x18')][_0x6fc0('0x15')]);}})[_0x6fc0('0x19')](function(_0x87f2cb){logger['error'](_0x6fc0('0x16'),_0x4f09b2,_0x87f2cb);_0x4a1fd0(_0x87f2cb);});});}exports[_0x6fc0('0x1a')]=function(_0x4a4ce8){var _0xc6b793=this;return new Promise(function(_0x57fe02,_0x6e9fad){return db[_0x6fc0('0x1b')]['findAll']({'raw':_0x4a4ce8[_0x6fc0('0x1c')]?_0x4a4ce8[_0x6fc0('0x1c')][_0x6fc0('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a4ce8['options']?_0x4a4ce8['options']['where']||null:null,'attributes':_0x4a4ce8[_0x6fc0('0x1c')]?_0x4a4ce8[_0x6fc0('0x1c')][_0x6fc0('0x1e')]||null:null,'limit':_0x4a4ce8[_0x6fc0('0x1c')]?_0x4a4ce8[_0x6fc0('0x1c')][_0x6fc0('0x1f')]||null:null,'include':_0x4a4ce8[_0x6fc0('0x1c')]?_0x4a4ce8[_0x6fc0('0x1c')][_0x6fc0('0x20')]?_['map'](_0x4a4ce8[_0x6fc0('0x1c')][_0x6fc0('0x20')],function(_0x59da44){return{'model':db[_0x59da44[_0x6fc0('0x21')]],'as':_0x59da44['as'],'attributes':_0x59da44['attributes'],'include':_0x59da44[_0x6fc0('0x20')]?_[_0x6fc0('0x22')](_0x59da44['include'],function(_0x451bcc){return{'model':db[_0x451bcc[_0x6fc0('0x21')]],'as':_0x451bcc['as'],'attributes':_0x451bcc['attributes'],'include':_0x451bcc[_0x6fc0('0x20')]?_[_0x6fc0('0x22')](_0x451bcc[_0x6fc0('0x20')],function(_0x2387a8){return{'model':db[_0x2387a8[_0x6fc0('0x21')]],'as':_0x2387a8['as'],'attributes':_0x2387a8[_0x6fc0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6fc0('0xf')](function(_0x24f077){logger[_0x6fc0('0x17')](_0x6fc0('0x1a'),_0x4a4ce8);logger[_0x6fc0('0x11')]('GetVoiceQueue',_0x4a4ce8,JSON[_0x6fc0('0x23')](_0x24f077));_0x57fe02(_0x24f077);})['catch'](function(_0x13810a){logger['error'](_0x6fc0('0x1a'),_0x13810a[_0x6fc0('0x15')],_0x4a4ce8);_0x6e9fad(_0xc6b793[_0x6fc0('0x13')](0x1f4,_0x13810a[_0x6fc0('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x2b34b7){var _0x4e8443=this;return new Promise(function(_0x9be220,_0x4e2055){return db['VoiceQueue'][_0x6fc0('0x24')]({'raw':_0x2b34b7[_0x6fc0('0x1c')]?_0x2b34b7[_0x6fc0('0x1c')][_0x6fc0('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b34b7['options']?_0x2b34b7[_0x6fc0('0x1c')][_0x6fc0('0x25')]||null:null,'attributes':_0x2b34b7[_0x6fc0('0x1c')]?_0x2b34b7[_0x6fc0('0x1c')][_0x6fc0('0x1e')]||null:null,'include':_0x2b34b7['options']?_0x2b34b7[_0x6fc0('0x1c')][_0x6fc0('0x20')]?_[_0x6fc0('0x22')](_0x2b34b7[_0x6fc0('0x1c')][_0x6fc0('0x20')],function(_0x43a85f){return{'model':db[_0x43a85f['model']],'as':_0x43a85f['as'],'attributes':_0x43a85f[_0x6fc0('0x1e')],'include':_0x43a85f[_0x6fc0('0x20')]?_[_0x6fc0('0x22')](_0x43a85f[_0x6fc0('0x20')],function(_0x3800d8){return{'model':db[_0x3800d8[_0x6fc0('0x21')]],'as':_0x3800d8['as'],'attributes':_0x3800d8[_0x6fc0('0x1e')],'include':_0x3800d8[_0x6fc0('0x20')]?_['map'](_0x3800d8[_0x6fc0('0x20')],function(_0x3257c8){return{'model':db[_0x3257c8['model']],'as':_0x3257c8['as'],'attributes':_0x3257c8[_0x6fc0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6fc0('0xf')](function(_0x29237c){logger['info'](_0x6fc0('0x26'),_0x2b34b7);logger[_0x6fc0('0x11')](_0x6fc0('0x26'),_0x2b34b7,JSON[_0x6fc0('0x23')](_0x29237c));_0x9be220(_0x29237c);})[_0x6fc0('0x19')](function(_0x3a801b){logger[_0x6fc0('0x13')](_0x6fc0('0x26'),_0x3a801b[_0x6fc0('0x15')],_0x2b34b7);_0x4e2055(_0x4e8443[_0x6fc0('0x13')](0x1f4,_0x3a801b[_0x6fc0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2f8d201..2d147bb 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 _0xc28f=['save','remove','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x487bce,_0x10c257){var _0x78c3e7=function(_0x1ec3f7){while(--_0x1ec3f7){_0x487bce['push'](_0x487bce['shift']());}};_0x78c3e7(++_0x10c257);}(_0xc28f,0xcf));var _0xfc28=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc28f[_0x46aff0];return _0x9d78cf;};'use strict';var VoiceQueueEvents=require(_0xfc28('0x0'));var events=[_0xfc28('0x1'),_0xfc28('0x2'),'update'];function createListener(_0x261039,_0x27274b){return function(_0x355daf){_0x27274b[_0xfc28('0x3')](_0x261039,_0x355daf);};}function removeListener(_0x538f49,_0x5aa0ff){return function(){VoiceQueueEvents[_0xfc28('0x4')](_0x538f49,_0x5aa0ff);};}exports[_0xfc28('0x5')]=function(_0x39ea75){for(var _0x3d5fe0=0x0,_0x40adec=events[_0xfc28('0x6')];_0x3d5fe0<_0x40adec;_0x3d5fe0++){var _0x1cdee6=events[_0x3d5fe0];var _0x43bf52=createListener(_0xfc28('0x7')+_0x1cdee6,_0x39ea75);VoiceQueueEvents['on'](_0x1cdee6,_0x43bf52);}}; \ No newline at end of file +var _0xef65=['voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x56bcd6,_0x147e9b){var _0x35f9d8=function(_0x69b2ad){while(--_0x69b2ad){_0x56bcd6['push'](_0x56bcd6['shift']());}};_0x35f9d8(++_0x147e9b);}(_0xef65,0xd1));var _0x5ef6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef65[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require(_0x5ef6('0x0'));var events=[_0x5ef6('0x1'),_0x5ef6('0x2'),_0x5ef6('0x3')];function createListener(_0x1e436c,_0x34fb7f){return function(_0x227358){_0x34fb7f[_0x5ef6('0x4')](_0x1e436c,_0x227358);};}function removeListener(_0x5f91bc,_0x5132c7){return function(){VoiceQueueEvents[_0x5ef6('0x5')](_0x5f91bc,_0x5132c7);};}exports['register']=function(_0x1996dc){for(var _0x14b323=0x0,_0x284e12=events[_0x5ef6('0x6')];_0x14b323<_0x284e12;_0x14b323++){var _0x28b463=events[_0x14b323];var _0x546087=createListener(_0x5ef6('0x7')+_0x28b463,_0x1996dc);VoiceQueueEvents['on'](_0x28b463,_0x546087);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 169b9c3..17ecb6f 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 _0xd0b0=['create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','getVoiceQueuesReport','/:id','show','post'];(function(_0x342ab1,_0x362a1c){var _0xdbf08=function(_0x1a256a){while(--_0x1a256a){_0x342ab1['push'](_0x342ab1['shift']());}};_0xdbf08(++_0x362a1c);}(_0xd0b0,0x143));var _0x0d0b=function(_0x2d7277,_0x38084a){_0x2d7277=_0x2d7277-0x0;var _0x2a3404=_0xd0b0[_0x2d7277];return _0x2a3404;};'use strict';var multer=require(_0x0d0b('0x0'));var util=require(_0x0d0b('0x1'));var path=require(_0x0d0b('0x2'));var timeout=require(_0x0d0b('0x3'));var express=require(_0x0d0b('0x4'));var router=express[_0x0d0b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0d0b('0x6'));var interaction=require(_0x0d0b('0x7'));var config=require('../../config/environment');var controller=require(_0x0d0b('0x8'));router[_0x0d0b('0x9')]('/',auth[_0x0d0b('0xa')](),controller['index']);router[_0x0d0b('0x9')](_0x0d0b('0xb'),auth[_0x0d0b('0xa')](),controller[_0x0d0b('0xc')]);router[_0x0d0b('0x9')]('/index',auth['isAuthenticated'](),controller[_0x0d0b('0xd')]);router[_0x0d0b('0x9')](_0x0d0b('0xe'),auth['isAuthenticated'](),controller[_0x0d0b('0xf')]);router[_0x0d0b('0x10')]('/',auth[_0x0d0b('0xa')](),controller[_0x0d0b('0x11')]);router['put'](_0x0d0b('0xe'),auth[_0x0d0b('0xa')](),controller[_0x0d0b('0x12')]);router['delete'](_0x0d0b('0xe'),auth[_0x0d0b('0xa')](),controller['destroy']);module[_0x0d0b('0x13')]=router; \ No newline at end of file +var _0x1e1c=['./voiceQueueReport.controller','isAuthenticated','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x764d6e,_0x38c7a7){var _0x369e17=function(_0x534d69){while(--_0x534d69){_0x764d6e['push'](_0x764d6e['shift']());}};_0x369e17(++_0x38c7a7);}(_0x1e1c,0x8d));var _0xc1e1=function(_0x343709,_0x42965b){_0x343709=_0x343709-0x0;var _0x378b4a=_0x1e1c[_0x343709];return _0x378b4a;};'use strict';var multer=require(_0xc1e1('0x0'));var util=require(_0xc1e1('0x1'));var path=require(_0xc1e1('0x2'));var timeout=require(_0xc1e1('0x3'));var express=require(_0xc1e1('0x4'));var router=express['Router']();var fs_extra=require(_0xc1e1('0x5'));var auth=require(_0xc1e1('0x6'));var interaction=require(_0xc1e1('0x7'));var config=require(_0xc1e1('0x8'));var controller=require(_0xc1e1('0x9'));router['get']('/',auth[_0xc1e1('0xa')](),controller['index']);router[_0xc1e1('0xb')](_0xc1e1('0xc'),auth[_0xc1e1('0xa')](),controller[_0xc1e1('0xd')]);router[_0xc1e1('0xb')](_0xc1e1('0xe'),auth[_0xc1e1('0xa')](),controller[_0xc1e1('0xf')]);router['get'](_0xc1e1('0x10'),auth[_0xc1e1('0xa')](),controller[_0xc1e1('0x11')]);router[_0xc1e1('0x12')]('/',auth[_0xc1e1('0xa')](),controller[_0xc1e1('0x13')]);router[_0xc1e1('0x14')](_0xc1e1('0x10'),auth['isAuthenticated'](),controller[_0xc1e1('0x15')]);router[_0xc1e1('0x16')](_0xc1e1('0x10'),auth[_0xc1e1('0xa')](),controller[_0xc1e1('0x17')]);module[_0xc1e1('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1aed821..9107f15 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 _0xc3cd=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt'];(function(_0x298f5c,_0x57766e){var _0xd5e797=function(_0x4d3fc9){while(--_0x4d3fc9){_0x298f5c['push'](_0x298f5c['shift']());}};_0xd5e797(++_0x57766e);}(_0xc3cd,0xf3));var _0xdc3c=function(_0x5f0bba,_0x475baa){_0x5f0bba=_0x5f0bba-0x0;var _0xc0a09b=_0xc3cd[_0x5f0bba];return _0xc0a09b;};'use strict';var Sequelize=require(_0xdc3c('0x0'));var moment=require(_0xdc3c('0x1'));module[_0xdc3c('0x2')]={'type':{'type':Sequelize[_0xdc3c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdc3c('0x3')]},'calleridname':{'type':Sequelize[_0xdc3c('0x3')]},'queue':{'type':Sequelize[_0xdc3c('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xdc3c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xdc3c('0x4')],'set':function(_0x195f4b){var _0x51bf84=moment(_0x195f4b);var _0x357374=moment(this[_0xdc3c('0x5')](_0xdc3c('0x6')))[_0xdc3c('0x7')](_0xdc3c('0x8'));var _0x218071=_0x51bf84['diff'](_0x357374,_0xdc3c('0x9'));this[_0xdc3c('0xa')](_0xdc3c('0xb'),_0x195f4b);this['setDataValue'](_0xdc3c('0xc'),_0x218071||null);}},'position':{'type':Sequelize[_0xdc3c('0xd')]},'count':{'type':Sequelize[_0xdc3c('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xdc3c('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xdc3c('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xdc3c('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xdc3c('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xdc3c('0x3')],'comment':_0xdc3c('0xf')},'originalposition':{'type':Sequelize[_0xdc3c('0xd')]},'channel':{'type':Sequelize[_0xdc3c('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xdc3c('0x3')]},'accountcode':{'type':Sequelize[_0xdc3c('0x3')]},'context':{'type':Sequelize[_0xdc3c('0x3')]},'exten':{'type':Sequelize[_0xdc3c('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xdc3c('0xd')]},'mohtime':{'type':Sequelize[_0xdc3c('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xdc3c('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xdc3c('0x3')],'comment':_0xdc3c('0x10')},'transferexten':{'type':Sequelize[_0xdc3c('0x3')]},'transferuniqueid':{'type':Sequelize[_0xdc3c('0x3')]},'disposition':{'type':Sequelize[_0xdc3c('0x3')]},'secondDisposition':{'type':Sequelize[_0xdc3c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xdc3c('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xdc3c('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xdc3c('0x3')]}}; \ No newline at end of file +var _0xc4be=['moment','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x46abcd,_0x941a15){var _0x2cd077=function(_0x303dc4){while(--_0x303dc4){_0x46abcd['push'](_0x46abcd['shift']());}};_0x2cd077(++_0x941a15);}(_0xc4be,0x1d3));var _0xec4b=function(_0x4c96af,_0x1ed64a){_0x4c96af=_0x4c96af-0x0;var _0x5d9395=_0xc4be[_0x4c96af];return _0x5d9395;};'use strict';var Sequelize=require(_0xec4b('0x0'));var moment=require(_0xec4b('0x1'));module['exports']={'type':{'type':Sequelize[_0xec4b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xec4b('0x2')]},'calleridname':{'type':Sequelize[_0xec4b('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xec4b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xec4b('0x3')],'set':function(_0x4abbd3){var _0x5e5401=moment(_0x4abbd3);var _0x213b5e=moment(this['getDataValue'](_0xec4b('0x4')))['format'](_0xec4b('0x5'));var _0x218c87=_0x5e5401[_0xec4b('0x6')](_0x213b5e,'seconds');this[_0xec4b('0x7')]('queuecallerleaveAt',_0x4abbd3);this[_0xec4b('0x7')](_0xec4b('0x8'),_0x218c87||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xec4b('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xec4b('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xec4b('0x3')]},'queuecallerexit':{'type':Sequelize[_0xec4b('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xec4b('0xb')},'originalposition':{'type':Sequelize[_0xec4b('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xec4b('0x2')]},'connectedlinename':{'type':Sequelize[_0xec4b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xec4b('0x2')]},'exten':{'type':Sequelize[_0xec4b('0x2')]},'priority':{'type':Sequelize[_0xec4b('0x2')]},'holdtime':{'type':Sequelize[_0xec4b('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xec4b('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xec4b('0x2')]},'transfer':{'type':Sequelize[_0xec4b('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xec4b('0xc')},'transferexten':{'type':Sequelize[_0xec4b('0x2')]},'transferuniqueid':{'type':Sequelize[_0xec4b('0x2')]},'disposition':{'type':Sequelize[_0xec4b('0x2')]},'secondDisposition':{'type':Sequelize[_0xec4b('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xec4b('0x9')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b2f0b32..81484de 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 _0x551c=['pick','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe'];(function(_0x5a9f73,_0x19a26a){var _0x4e50b3=function(_0xa11396){while(--_0xa11396){_0x5a9f73['push'](_0x5a9f73['shift']());}};_0x4e50b3(++_0x19a26a);}(_0x551c,0xa0));var _0xc551=function(_0x4015a9,_0x504b25){_0x4015a9=_0x4015a9-0x0;var _0x3958ba=_0x551c[_0x4015a9];return _0x3958ba;};'use strict';var emlformat=require(_0xc551('0x0'));var rimraf=require(_0xc551('0x1'));var zipdir=require(_0xc551('0x2'));var jsonpatch=require(_0xc551('0x3'));var rp=require(_0xc551('0x4'));var moment=require(_0xc551('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc551('0x6'));var util=require(_0xc551('0x7'));var path=require('path');var sox=require(_0xc551('0x8'));var csv=require(_0xc551('0x9'));var ejs=require(_0xc551('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc551('0xb'));var crypto=require(_0xc551('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc551('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc551('0xe'));var Papa=require(_0xc551('0xf'));var Redis=require(_0xc551('0x10'));var authService=require(_0xc551('0x11'));var qs=require(_0xc551('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc551('0x13'));var logger=require('../../config/logger')(_0xc551('0x14'));var utils=require('../../config/utils');var config=require(_0xc551('0x15'));var licenseUtil=require(_0xc551('0x16'));var db=require(_0xc551('0x17'))['db'];config[_0xc551('0x18')]=_[_0xc551('0x19')](config[_0xc551('0x18')],{'host':_0xc551('0x1a'),'port':0x18eb});var socket=require(_0xc551('0x1b'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xc551('0x1c')](socket);function respondWithStatusCode(_0x4eff02,_0x15e23e){_0x15e23e=_0x15e23e||0xcc;return function(_0x3b7b26){if(_0x3b7b26){return _0x4eff02[_0xc551('0x1d')](_0x15e23e);}return _0x4eff02['status'](_0x15e23e)['end']();};}function respondWithResult(_0x2b43db,_0x48f20a){_0x48f20a=_0x48f20a||0xc8;return function(_0xe3fca6){if(_0xe3fca6){return _0x2b43db[_0xc551('0x1e')](_0x48f20a)['json'](_0xe3fca6);}};}function respondWithFilteredResult(_0x2500ad,_0x15212f){return function(_0x1d0d67){if(_0x1d0d67){var _0x3f3320=typeof _0x15212f[_0xc551('0x1f')]===_0xc551('0x20')&&typeof _0x15212f[_0xc551('0x21')]===_0xc551('0x20');var _0x420a6c=_0x1d0d67[_0xc551('0x22')];var _0x1ec068=_0x3f3320?0x0:_0x15212f['offset'];var _0x3f45bf=_0x3f3320?_0x1d0d67[_0xc551('0x22')]:_0x15212f[_0xc551('0x1f')]+_0x15212f[_0xc551('0x21')];var _0x14b5de;if(_0x3f45bf>=_0x420a6c){_0x3f45bf=_0x420a6c;_0x14b5de=0xc8;}else{_0x14b5de=0xce;}_0x2500ad[_0xc551('0x1e')](_0x14b5de);return _0x2500ad[_0xc551('0x23')](_0xc551('0x24'),_0x1ec068+'-'+_0x3f45bf+'/'+_0x420a6c)['json'](_0x1d0d67);}return null;};}function patchUpdates(_0x5dc4d4){return function(_0x26ed3f){try{jsonpatch[_0xc551('0x25')](_0x26ed3f,_0x5dc4d4,!![]);}catch(_0x34913f){return BPromise[_0xc551('0x26')](_0x34913f);}return _0x26ed3f['save']();};}function saveUpdates(_0x20d0be,_0x593169){return function(_0x33bb03){if(_0x33bb03){return _0x33bb03[_0xc551('0x27')](_0x20d0be)['then'](function(_0x41f0fc){return _0x41f0fc;});}return null;};}function removeEntity(_0x52ef6a,_0x494546){return function(_0x4cb6a7){if(_0x4cb6a7){return _0x4cb6a7[_0xc551('0x28')]()[_0xc551('0x29')](function(){_0x52ef6a[_0xc551('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c07a7,_0x1e1cbf){return function(_0xb42064){if(!_0xb42064){_0x3c07a7['sendStatus'](0x194);}return _0xb42064;};}function handleError(_0x16ff99,_0x5b674f){_0x5b674f=_0x5b674f||0x1f4;return function(_0x144395){logger['error'](_0x144395['stack']);if(_0x144395[_0xc551('0x2a')]){delete _0x144395[_0xc551('0x2a')];}_0x16ff99[_0xc551('0x1e')](_0x5b674f)[_0xc551('0x2b')](_0x144395);};}exports['index']=function(_0x4bb730,_0x38af27){var _0x26c179={},_0x133983={},_0x136f67={'count':0x0,'rows':[]};var _0x5a9979=_[_0xc551('0x2c')](db[_0xc551('0x2d')][_0xc551('0x2e')],function(_0x336b36){return{'name':_0x336b36[_0xc551('0x2f')],'type':_0x336b36[_0xc551('0x30')][_0xc551('0x31')]};});_0x133983['model']=_[_0xc551('0x2c')](_0x5a9979,_0xc551('0x2a'));_0x133983['query']=_[_0xc551('0x32')](_0x4bb730[_0xc551('0x33')]);_0x133983[_0xc551('0x34')]=_[_0xc551('0x35')](_0x133983[_0xc551('0x36')],_0x133983[_0xc551('0x33')]);_0x26c179['attributes']=_['intersection'](_0x133983[_0xc551('0x36')],qs[_0xc551('0x37')](_0x4bb730['query'][_0xc551('0x37')]));_0x26c179[_0xc551('0x38')]=_0x26c179[_0xc551('0x38')]['length']?_0x26c179[_0xc551('0x38')]:_0x133983[_0xc551('0x36')];if(!_0x4bb730[_0xc551('0x33')][_0xc551('0x39')]('nolimit')){_0x26c179[_0xc551('0x21')]=qs['limit'](_0x4bb730['query'][_0xc551('0x21')]);_0x26c179[_0xc551('0x1f')]=qs[_0xc551('0x1f')](_0x4bb730[_0xc551('0x33')][_0xc551('0x1f')]);}_0x26c179[_0xc551('0x3a')]=qs[_0xc551('0x3b')](_0x4bb730[_0xc551('0x33')][_0xc551('0x3b')]);_0x26c179['where']=qs[_0xc551('0x34')](_['pick'](_0x4bb730[_0xc551('0x33')],_0x133983[_0xc551('0x34')]),_0x5a9979);if(_0x4bb730[_0xc551('0x33')]['filter']){_0x26c179[_0xc551('0x3c')]=_[_0xc551('0x3d')](_0x26c179[_0xc551('0x3c')],{'$or':_[_0xc551('0x2c')](_0x5a9979,function(_0x5b852e){if(_0x5b852e['type']!==_0xc551('0x3e')){var _0x50a914={};_0x50a914[_0x5b852e['name']]={'$like':'%'+_0x4bb730[_0xc551('0x33')][_0xc551('0x3f')]+'%'};return _0x50a914;}})});}_0x26c179=_[_0xc551('0x3d')]({},_0x26c179,_0x4bb730[_0xc551('0x40')]);var _0x463ba8={'where':_0x26c179['where']};return db[_0xc551('0x2d')][_0xc551('0x22')](_0x463ba8)[_0xc551('0x29')](function(_0xdaeadf){_0x136f67[_0xc551('0x22')]=_0xdaeadf;if(_0x4bb730[_0xc551('0x33')][_0xc551('0x41')]){_0x26c179[_0xc551('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xc551('0x43')](_0x26c179);})['then'](function(_0x210099){_0x136f67[_0xc551('0x44')]=_0x210099;return _0x136f67;})['then'](respondWithFilteredResult(_0x38af27,_0x26c179))[_0xc551('0x45')](handleError(_0x38af27,null));};exports[_0xc551('0x46')]=function(_0x104a9e,_0x52f8ad){var _0x762335={'raw':![],'where':{'id':_0x104a9e[_0xc551('0x47')]['id']}},_0x5ddae0={};_0x5ddae0[_0xc551('0x36')]=_[_0xc551('0x32')](db[_0xc551('0x2d')][_0xc551('0x2e')]);_0x5ddae0[_0xc551('0x33')]=_[_0xc551('0x32')](_0x104a9e['query']);_0x5ddae0[_0xc551('0x34')]=_['intersection'](_0x5ddae0['model'],_0x5ddae0[_0xc551('0x33')]);_0x762335[_0xc551('0x38')]=_[_0xc551('0x35')](_0x5ddae0[_0xc551('0x36')],qs[_0xc551('0x37')](_0x104a9e[_0xc551('0x33')][_0xc551('0x37')]));_0x762335[_0xc551('0x38')]=_0x762335[_0xc551('0x38')][_0xc551('0x48')]?_0x762335['attributes']:_0x5ddae0[_0xc551('0x36')];if(_0x104a9e[_0xc551('0x33')][_0xc551('0x41')]){_0x762335[_0xc551('0x42')]=[{'all':!![]}];}_0x762335=_[_0xc551('0x3d')]({},_0x762335,_0x104a9e[_0xc551('0x40')]);return db[_0xc551('0x2d')]['find'](_0x762335)[_0xc551('0x29')](handleEntityNotFound(_0x52f8ad,null))[_0xc551('0x29')](respondWithResult(_0x52f8ad,null))[_0xc551('0x45')](handleError(_0x52f8ad,null));};exports['create']=function(_0x257763,_0x52aea8){return db[_0xc551('0x2d')][_0xc551('0x49')](_0x257763[_0xc551('0x4a')],{})[_0xc551('0x29')](respondWithResult(_0x52aea8,0xc9))[_0xc551('0x45')](handleError(_0x52aea8,null));};exports[_0xc551('0x27')]=function(_0x389205,_0x5cd239){if(_0x389205[_0xc551('0x4a')]['id']){delete _0x389205[_0xc551('0x4a')]['id'];}return db[_0xc551('0x2d')][_0xc551('0x4b')]({'where':{'id':_0x389205[_0xc551('0x47')]['id']}})[_0xc551('0x29')](handleEntityNotFound(_0x5cd239,null))[_0xc551('0x29')](saveUpdates(_0x389205[_0xc551('0x4a')],null))['then'](respondWithResult(_0x5cd239,null))[_0xc551('0x45')](handleError(_0x5cd239,null));};exports[_0xc551('0x28')]=function(_0x308bb7,_0x51fa71){return db[_0xc551('0x2d')][_0xc551('0x4b')]({'where':{'id':_0x308bb7[_0xc551('0x47')]['id']}})[_0xc551('0x29')](handleEntityNotFound(_0x51fa71,null))[_0xc551('0x29')](removeEntity(_0x51fa71,null))[_0xc551('0x45')](handleError(_0x51fa71,null));};exports[_0xc551('0x4c')]=function(_0x2ba88f,_0x563386){return db[_0xc551('0x2d')][_0xc551('0x4c')]()[_0xc551('0x29')](respondWithResult(_0x563386,null))[_0xc551('0x45')](handleError(_0x563386,null));};exports['getVoiceQueuesReport']=function(_0x3d7c7c,_0x542992){var _0x22ff21={},_0x476809={},_0x1c4b8e={'count':0x0,'rows':[]};_0x476809[_0xc551('0x36')]=_[_0xc551('0x32')](db['VoiceQueueReport']['rawAttributes']);_0x476809[_0xc551('0x33')]=_[_0xc551('0x32')](_0x3d7c7c[_0xc551('0x33')]);_0x476809[_0xc551('0x34')]=_['intersection'](_0x476809[_0xc551('0x36')],_0x476809[_0xc551('0x33')]);_0x22ff21[_0xc551('0x38')]=_[_0xc551('0x35')](_0x476809['model'],qs[_0xc551('0x37')](_0x3d7c7c[_0xc551('0x33')][_0xc551('0x37')]));_0x22ff21['attributes']=_0x22ff21[_0xc551('0x38')][_0xc551('0x48')]?_0x22ff21[_0xc551('0x38')]:_0x476809[_0xc551('0x36')];if(!_0x3d7c7c[_0xc551('0x33')][_0xc551('0x39')]('nolimit')){_0x22ff21['limit']=qs[_0xc551('0x21')](_0x3d7c7c[_0xc551('0x33')][_0xc551('0x21')]);_0x22ff21[_0xc551('0x1f')]=qs[_0xc551('0x1f')](_0x3d7c7c[_0xc551('0x33')]['offset']);}_0x22ff21[_0xc551('0x3a')]=qs['sort'](_0x3d7c7c[_0xc551('0x33')][_0xc551('0x3b')]);_0x22ff21[_0xc551('0x3c')]=qs[_0xc551('0x34')](_[_0xc551('0x4d')](_0x3d7c7c[_0xc551('0x33')],_0x476809[_0xc551('0x34')]));if(_0x3d7c7c[_0xc551('0x33')][_0xc551('0x3f')]){_0x22ff21['where']=_['merge'](_0x22ff21[_0xc551('0x3c')],{'$or':_['map'](_0x22ff21[_0xc551('0x38')],function(_0xed9767){var _0x50a70d={};_0x50a70d[_0xed9767]={'$like':'%'+_0x3d7c7c['query']['filter']+'%'};return _0x50a70d;})});}_0x22ff21=_[_0xc551('0x3d')]({},_0x22ff21,_0x3d7c7c[_0xc551('0x40')]);var _0x37353a={'where':_0x22ff21[_0xc551('0x3c')]};return db[_0xc551('0x2d')][_0xc551('0x22')](_0x37353a)[_0xc551('0x29')](function(_0x237758){_0x1c4b8e[_0xc551('0x22')]=_0x237758;if(_0x3d7c7c[_0xc551('0x33')]['includeAll']){_0x22ff21[_0xc551('0x42')]=[{'all':!![]}];}return db[_0xc551('0x2d')][_0xc551('0x43')](_0x22ff21);})[_0xc551('0x29')](function(_0x1d44a3){_0x1c4b8e[_0xc551('0x44')]=_0x1d44a3;return _0x1c4b8e;})[_0xc551('0x29')](respondWithFilteredResult(_0x542992,_0x22ff21,'getVoiceQueuesReport'))['catch'](handleError(_0x542992,null,_0xc551('0x4e')));}; \ No newline at end of file +var _0x1300=['options','includeAll','include','findAll','show','params','merge','catch','create','body','find','describe','getVoiceQueuesReport','order','pick','rows','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL'];(function(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0x1300,0x1e4));var _0x0130=function(_0x33707d,_0x446ff5){_0x33707d=_0x33707d-0x0;var _0x4e6bfe=_0x1300[_0x33707d];return _0x4e6bfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0130('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0130('0x1'));var rp=require('request-promise');var moment=require(_0x0130('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0130('0x3'));var util=require(_0x0130('0x4'));var path=require(_0x0130('0x5'));var sox=require(_0x0130('0x6'));var csv=require('to-csv');var ejs=require(_0x0130('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0130('0x8'));var squel=require(_0x0130('0x9'));var crypto=require(_0x0130('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0130('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0130('0xc'));var qs=require(_0x0130('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0130('0xe'));var logger=require(_0x0130('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x0130('0x10'));var licenseUtil=require(_0x0130('0x11'));var db=require('../../mysqldb')['db'];config[_0x0130('0x12')]=_[_0x0130('0x13')](config[_0x0130('0x12')],{'host':_0x0130('0x14'),'port':0x18eb});var socket=require(_0x0130('0x15'))(new Redis(config[_0x0130('0x12')]));require(_0x0130('0x16'))['register'](socket);function respondWithStatusCode(_0x14e5c6,_0x5dc30b){_0x5dc30b=_0x5dc30b||0xcc;return function(_0x15fc11){if(_0x15fc11){return _0x14e5c6[_0x0130('0x17')](_0x5dc30b);}return _0x14e5c6[_0x0130('0x18')](_0x5dc30b)[_0x0130('0x19')]();};}function respondWithResult(_0x168d13,_0x2235db){_0x2235db=_0x2235db||0xc8;return function(_0x225b0e){if(_0x225b0e){return _0x168d13['status'](_0x2235db)[_0x0130('0x1a')](_0x225b0e);}};}function respondWithFilteredResult(_0x5a83f8,_0x152138){return function(_0x43e509){if(_0x43e509){var _0x42feb9=typeof _0x152138[_0x0130('0x1b')]===_0x0130('0x1c')&&typeof _0x152138[_0x0130('0x1d')]==='undefined';var _0x444441=_0x43e509[_0x0130('0x1e')];var _0xb08253=_0x42feb9?0x0:_0x152138[_0x0130('0x1b')];var _0x43aab5=_0x42feb9?_0x43e509[_0x0130('0x1e')]:_0x152138[_0x0130('0x1b')]+_0x152138['limit'];var _0x216159;if(_0x43aab5>=_0x444441){_0x43aab5=_0x444441;_0x216159=0xc8;}else{_0x216159=0xce;}_0x5a83f8[_0x0130('0x18')](_0x216159);return _0x5a83f8[_0x0130('0x1f')](_0x0130('0x20'),_0xb08253+'-'+_0x43aab5+'/'+_0x444441)[_0x0130('0x1a')](_0x43e509);}return null;};}function patchUpdates(_0x2f6328){return function(_0x2f4231){try{jsonpatch['apply'](_0x2f4231,_0x2f6328,!![]);}catch(_0x4a8464){return BPromise[_0x0130('0x21')](_0x4a8464);}return _0x2f4231[_0x0130('0x22')]();};}function saveUpdates(_0x58661f,_0x4f6db7){return function(_0x1c8705){if(_0x1c8705){return _0x1c8705[_0x0130('0x23')](_0x58661f)['then'](function(_0x4452ff){return _0x4452ff;});}return null;};}function removeEntity(_0x36449c,_0x39ddef){return function(_0x5cab64){if(_0x5cab64){return _0x5cab64[_0x0130('0x24')]()[_0x0130('0x25')](function(){_0x36449c['status'](0xcc)[_0x0130('0x19')]();});}};}function handleEntityNotFound(_0x1d9b60,_0x5ed7c2){return function(_0x264561){if(!_0x264561){_0x1d9b60[_0x0130('0x17')](0x194);}return _0x264561;};}function handleError(_0x46fe4c,_0x3fb6f3){_0x3fb6f3=_0x3fb6f3||0x1f4;return function(_0x1f74f0){logger[_0x0130('0x26')](_0x1f74f0[_0x0130('0x27')]);if(_0x1f74f0[_0x0130('0x28')]){delete _0x1f74f0[_0x0130('0x28')];}_0x46fe4c['status'](_0x3fb6f3)[_0x0130('0x29')](_0x1f74f0);};}exports[_0x0130('0x2a')]=function(_0x4939b0,_0x3ab197){var _0x43aee1={},_0x5f545b={},_0x4e9876={'count':0x0,'rows':[]};var _0xcbe269=_[_0x0130('0x2b')](db[_0x0130('0x2c')][_0x0130('0x2d')],function(_0x32d6eb){return{'name':_0x32d6eb[_0x0130('0x2e')],'type':_0x32d6eb[_0x0130('0x2f')][_0x0130('0x30')]};});_0x5f545b[_0x0130('0x31')]=_[_0x0130('0x2b')](_0xcbe269,_0x0130('0x28'));_0x5f545b[_0x0130('0x32')]=_[_0x0130('0x33')](_0x4939b0['query']);_0x5f545b[_0x0130('0x34')]=_[_0x0130('0x35')](_0x5f545b['model'],_0x5f545b[_0x0130('0x32')]);_0x43aee1[_0x0130('0x36')]=_[_0x0130('0x35')](_0x5f545b[_0x0130('0x31')],qs[_0x0130('0x37')](_0x4939b0['query'][_0x0130('0x37')]));_0x43aee1[_0x0130('0x36')]=_0x43aee1['attributes'][_0x0130('0x38')]?_0x43aee1['attributes']:_0x5f545b[_0x0130('0x31')];if(!_0x4939b0['query'][_0x0130('0x39')]('nolimit')){_0x43aee1[_0x0130('0x1d')]=qs[_0x0130('0x1d')](_0x4939b0['query']['limit']);_0x43aee1[_0x0130('0x1b')]=qs[_0x0130('0x1b')](_0x4939b0[_0x0130('0x32')]['offset']);}_0x43aee1['order']=qs[_0x0130('0x3a')](_0x4939b0[_0x0130('0x32')][_0x0130('0x3a')]);_0x43aee1[_0x0130('0x3b')]=qs[_0x0130('0x34')](_['pick'](_0x4939b0['query'],_0x5f545b[_0x0130('0x34')]),_0xcbe269);if(_0x4939b0[_0x0130('0x32')][_0x0130('0x3c')]){_0x43aee1[_0x0130('0x3b')]=_['merge'](_0x43aee1[_0x0130('0x3b')],{'$or':_['map'](_0xcbe269,function(_0x393a98){if(_0x393a98[_0x0130('0x2f')]!==_0x0130('0x3d')){var _0x5be52c={};_0x5be52c[_0x393a98[_0x0130('0x28')]]={'$like':'%'+_0x4939b0[_0x0130('0x32')][_0x0130('0x3c')]+'%'};return _0x5be52c;}})});}_0x43aee1=_['merge']({},_0x43aee1,_0x4939b0[_0x0130('0x3e')]);var _0x506a05={'where':_0x43aee1[_0x0130('0x3b')]};return db[_0x0130('0x2c')][_0x0130('0x1e')](_0x506a05)[_0x0130('0x25')](function(_0x201a76){_0x4e9876[_0x0130('0x1e')]=_0x201a76;if(_0x4939b0[_0x0130('0x32')][_0x0130('0x3f')]){_0x43aee1[_0x0130('0x40')]=[{'all':!![]}];}return db[_0x0130('0x2c')][_0x0130('0x41')](_0x43aee1);})[_0x0130('0x25')](function(_0x5d7ade){_0x4e9876['rows']=_0x5d7ade;return _0x4e9876;})[_0x0130('0x25')](respondWithFilteredResult(_0x3ab197,_0x43aee1))['catch'](handleError(_0x3ab197,null));};exports[_0x0130('0x42')]=function(_0x216aa4,_0x4f6141){var _0x34aa7c={'raw':![],'where':{'id':_0x216aa4[_0x0130('0x43')]['id']}},_0xe1347d={};_0xe1347d[_0x0130('0x31')]=_[_0x0130('0x33')](db[_0x0130('0x2c')][_0x0130('0x2d')]);_0xe1347d['query']=_['keys'](_0x216aa4['query']);_0xe1347d[_0x0130('0x34')]=_['intersection'](_0xe1347d[_0x0130('0x31')],_0xe1347d[_0x0130('0x32')]);_0x34aa7c['attributes']=_[_0x0130('0x35')](_0xe1347d['model'],qs[_0x0130('0x37')](_0x216aa4[_0x0130('0x32')][_0x0130('0x37')]));_0x34aa7c[_0x0130('0x36')]=_0x34aa7c[_0x0130('0x36')]['length']?_0x34aa7c[_0x0130('0x36')]:_0xe1347d[_0x0130('0x31')];if(_0x216aa4[_0x0130('0x32')][_0x0130('0x3f')]){_0x34aa7c[_0x0130('0x40')]=[{'all':!![]}];}_0x34aa7c=_[_0x0130('0x44')]({},_0x34aa7c,_0x216aa4[_0x0130('0x3e')]);return db[_0x0130('0x2c')]['find'](_0x34aa7c)['then'](handleEntityNotFound(_0x4f6141,null))['then'](respondWithResult(_0x4f6141,null))[_0x0130('0x45')](handleError(_0x4f6141,null));};exports[_0x0130('0x46')]=function(_0x20199d,_0x3ae473){return db[_0x0130('0x2c')]['create'](_0x20199d[_0x0130('0x47')],{})[_0x0130('0x25')](respondWithResult(_0x3ae473,0xc9))[_0x0130('0x45')](handleError(_0x3ae473,null));};exports['update']=function(_0x43e61c,_0x5c8a9c){if(_0x43e61c[_0x0130('0x47')]['id']){delete _0x43e61c[_0x0130('0x47')]['id'];}return db[_0x0130('0x2c')][_0x0130('0x48')]({'where':{'id':_0x43e61c[_0x0130('0x43')]['id']}})[_0x0130('0x25')](handleEntityNotFound(_0x5c8a9c,null))['then'](saveUpdates(_0x43e61c['body'],null))['then'](respondWithResult(_0x5c8a9c,null))[_0x0130('0x45')](handleError(_0x5c8a9c,null));};exports[_0x0130('0x24')]=function(_0x2ce486,_0xd1bab7){return db[_0x0130('0x2c')][_0x0130('0x48')]({'where':{'id':_0x2ce486['params']['id']}})[_0x0130('0x25')](handleEntityNotFound(_0xd1bab7,null))['then'](removeEntity(_0xd1bab7,null))[_0x0130('0x45')](handleError(_0xd1bab7,null));};exports[_0x0130('0x49')]=function(_0x4222d5,_0x3d6c3a){return db[_0x0130('0x2c')][_0x0130('0x49')]()[_0x0130('0x25')](respondWithResult(_0x3d6c3a,null))[_0x0130('0x45')](handleError(_0x3d6c3a,null));};exports[_0x0130('0x4a')]=function(_0x11de8b,_0xf1eaf3){var _0x534d0e={},_0x3952a5={},_0x32f5bd={'count':0x0,'rows':[]};_0x3952a5[_0x0130('0x31')]=_[_0x0130('0x33')](db[_0x0130('0x2c')]['rawAttributes']);_0x3952a5[_0x0130('0x32')]=_[_0x0130('0x33')](_0x11de8b[_0x0130('0x32')]);_0x3952a5[_0x0130('0x34')]=_[_0x0130('0x35')](_0x3952a5[_0x0130('0x31')],_0x3952a5[_0x0130('0x32')]);_0x534d0e[_0x0130('0x36')]=_[_0x0130('0x35')](_0x3952a5[_0x0130('0x31')],qs['fields'](_0x11de8b['query']['fields']));_0x534d0e[_0x0130('0x36')]=_0x534d0e[_0x0130('0x36')]['length']?_0x534d0e['attributes']:_0x3952a5[_0x0130('0x31')];if(!_0x11de8b[_0x0130('0x32')][_0x0130('0x39')]('nolimit')){_0x534d0e[_0x0130('0x1d')]=qs[_0x0130('0x1d')](_0x11de8b['query'][_0x0130('0x1d')]);_0x534d0e[_0x0130('0x1b')]=qs[_0x0130('0x1b')](_0x11de8b['query'][_0x0130('0x1b')]);}_0x534d0e[_0x0130('0x4b')]=qs[_0x0130('0x3a')](_0x11de8b['query']['sort']);_0x534d0e[_0x0130('0x3b')]=qs[_0x0130('0x34')](_[_0x0130('0x4c')](_0x11de8b[_0x0130('0x32')],_0x3952a5[_0x0130('0x34')]));if(_0x11de8b['query'][_0x0130('0x3c')]){_0x534d0e['where']=_[_0x0130('0x44')](_0x534d0e[_0x0130('0x3b')],{'$or':_[_0x0130('0x2b')](_0x534d0e[_0x0130('0x36')],function(_0xa1c4cd){var _0x3337b5={};_0x3337b5[_0xa1c4cd]={'$like':'%'+_0x11de8b[_0x0130('0x32')]['filter']+'%'};return _0x3337b5;})});}_0x534d0e=_['merge']({},_0x534d0e,_0x11de8b[_0x0130('0x3e')]);var _0x3d3997={'where':_0x534d0e[_0x0130('0x3b')]};return db[_0x0130('0x2c')]['count'](_0x3d3997)[_0x0130('0x25')](function(_0x532c13){_0x32f5bd[_0x0130('0x1e')]=_0x532c13;if(_0x11de8b[_0x0130('0x32')]['includeAll']){_0x534d0e[_0x0130('0x40')]=[{'all':!![]}];}return db[_0x0130('0x2c')][_0x0130('0x41')](_0x534d0e);})[_0x0130('0x25')](function(_0x1b7444){_0x32f5bd[_0x0130('0x4d')]=_0x1b7444;return _0x32f5bd;})['then'](respondWithFilteredResult(_0xf1eaf3,_0x534d0e,'getVoiceQueuesReport'))[_0x0130('0x45')](handleError(_0xf1eaf3,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 015aa4a..809bdbd 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 _0x9c55=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1c92ff,_0x3dfb69){var _0x2930ee=function(_0x33ea67){while(--_0x33ea67){_0x1c92ff['push'](_0x1c92ff['shift']());}};_0x2930ee(++_0x3dfb69);}(_0x9c55,0x6e));var _0x59c5=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x9c55[_0xc14df7];return _0x34a445;};'use strict';var EventEmitter=require(_0x59c5('0x0'));var VoiceQueueReport=require(_0x59c5('0x1'))['db'][_0x59c5('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x59c5('0x3')](0x0);var events={'afterCreate':_0x59c5('0x4'),'afterUpdate':_0x59c5('0x5'),'afterDestroy':_0x59c5('0x6')};function emitEvent(_0x3bc44b){return function(_0x2f778b,_0x3d1855,_0x47aaaf){VoiceQueueReportEvents[_0x59c5('0x7')](_0x3bc44b+':'+_0x2f778b['id'],_0x2f778b);VoiceQueueReportEvents[_0x59c5('0x7')](_0x3bc44b,_0x2f778b);_0x47aaaf(null);};}for(var e in events){if(events[_0x59c5('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x59c5('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xafc8=['remove','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','save'];(function(_0x6d4567,_0x4f937d){var _0x1fa2ee=function(_0x417741){while(--_0x417741){_0x6d4567['push'](_0x6d4567['shift']());}};_0x1fa2ee(++_0x4f937d);}(_0xafc8,0xd6));var _0x8afc=function(_0x21318f,_0x59cdb4){_0x21318f=_0x21318f-0x0;var _0x225e9c=_0xafc8[_0x21318f];return _0x225e9c;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x8afc('0x0'))['db'][_0x8afc('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8afc('0x2'),'afterUpdate':'update','afterDestroy':_0x8afc('0x3')};function emitEvent(_0x45f36){return function(_0x4600a1,_0x50a1a1,_0x25b0c8){VoiceQueueReportEvents['emit'](_0x45f36+':'+_0x4600a1['id'],_0x4600a1);VoiceQueueReportEvents['emit'](_0x45f36,_0x4600a1);_0x25b0c8(null);};}for(var e in events){if(events[_0x8afc('0x4')](e)){var event=events[e];VoiceQueueReport[_0x8afc('0x5')](e,emitEvent(event));}}module[_0x8afc('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 7c237f5..f774502 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 _0x8166=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util'];(function(_0x211a02,_0x3b5362){var _0x13d91c=function(_0x559b49){while(--_0x559b49){_0x211a02['push'](_0x211a02['shift']());}};_0x13d91c(++_0x3b5362);}(_0x8166,0xae));var _0x6816=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x8166[_0x30abff];return _0x4c571e;};'use strict';var _=require(_0x6816('0x0'));var util=require(_0x6816('0x1'));var logger=require(_0x6816('0x2'))(_0x6816('0x3'));var moment=require(_0x6816('0x4'));var BPromise=require(_0x6816('0x5'));var rp=require(_0x6816('0x6'));var fs=require('fs');var path=require(_0x6816('0x7'));var rimraf=require('rimraf');var config=require(_0x6816('0x8'));var attributes=require(_0x6816('0x9'));module[_0x6816('0xa')]=function(_0x422b27,_0x3fc1de){return _0x422b27[_0x6816('0xb')](_0x6816('0xc'),attributes,{'tableName':_0x6816('0xd'),'paranoid':![],'indexes':[{'fields':[_0x6816('0xe')]},{'fields':[_0x6816('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd646=['calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd646,0x1c3));var _0x6d64=function(_0x5793be,_0x12fafd){_0x5793be=_0x5793be-0x0;var _0x3b5b5f=_0xd646[_0x5793be];return _0x3b5b5f;};'use strict';var _=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var logger=require(_0x6d64('0x2'))(_0x6d64('0x3'));var moment=require('moment');var BPromise=require(_0x6d64('0x4'));var rp=require(_0x6d64('0x5'));var fs=require('fs');var path=require(_0x6d64('0x6'));var rimraf=require(_0x6d64('0x7'));var config=require(_0x6d64('0x8'));var attributes=require(_0x6d64('0x9'));module[_0x6d64('0xa')]=function(_0x5f3466,_0x34849f){return _0x5f3466[_0x6d64('0xb')](_0x6d64('0xc'),attributes,{'tableName':_0x6d64('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x6d64('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 367ec35..7b83e81 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 _0xeb1b=['stringify','error','code','message','request\x20sent','result','catch','GetVoiceQueueReport','options','where','attributes','include','model','map','then','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','limit','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x38051b,_0x46cf1e){var _0x349422=function(_0x49b26e){while(--_0x49b26e){_0x38051b['push'](_0x38051b['shift']());}};_0x349422(++_0x46cf1e);}(_0xeb1b,0x16e));var _0xbeb1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeb1b[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xbeb1('0x0'));var util=require(_0xbeb1('0x1'));var moment=require(_0xbeb1('0x2'));var BPromise=require('bluebird');var rs=require(_0xbeb1('0x3'));var fs=require('fs');var Redis=require(_0xbeb1('0x4'));var db=require(_0xbeb1('0x5'))['db'];var utils=require(_0xbeb1('0x6'));var logger=require(_0xbeb1('0x7'))('rpc');var config=require(_0xbeb1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbeb1('0x9')][_0xbeb1('0xa')]({'port':0x232a});config[_0xbeb1('0xb')]=_[_0xbeb1('0xc')](config[_0xbeb1('0xb')],{'host':_0xbeb1('0xd'),'port':0x18eb});var socket=require(_0xbeb1('0xe'))(new Redis(config[_0xbeb1('0xb')]));require(_0xbeb1('0xf'))[_0xbeb1('0x10')](socket);function respondWithRpcPromise(_0x15345a,_0x4234d3,_0xeeaacf){return new BPromise(function(_0x5eed1a,_0x4ba3a9){return client['request'](_0x15345a,_0xeeaacf)['then'](function(_0x36ce7d){logger[_0xbeb1('0x11')](_0xbeb1('0x12'),_0x4234d3,'request\x20sent');logger[_0xbeb1('0x13')](_0xbeb1('0x14'),_0x4234d3,'request\x20sent',JSON[_0xbeb1('0x15')](_0x36ce7d));if(_0x36ce7d[_0xbeb1('0x16')]){if(_0x36ce7d['error'][_0xbeb1('0x17')]===0x1f4){logger[_0xbeb1('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x4234d3,_0x36ce7d[_0xbeb1('0x16')][_0xbeb1('0x18')]);return _0x4ba3a9(_0x36ce7d[_0xbeb1('0x16')][_0xbeb1('0x18')]);}logger['error'](_0xbeb1('0x12'),_0x4234d3,_0x36ce7d[_0xbeb1('0x16')][_0xbeb1('0x18')]);return _0x5eed1a(_0x36ce7d[_0xbeb1('0x16')]['message']);}else{logger[_0xbeb1('0x11')](_0xbeb1('0x12'),_0x4234d3,_0xbeb1('0x19'));_0x5eed1a(_0x36ce7d[_0xbeb1('0x1a')][_0xbeb1('0x18')]);}})[_0xbeb1('0x1b')](function(_0x1c6ce9){logger[_0xbeb1('0x16')](_0xbeb1('0x12'),_0x4234d3,_0x1c6ce9);_0x4ba3a9(_0x1c6ce9);});});}exports[_0xbeb1('0x1c')]=function(_0x49ad80){var _0x341875=this;return new Promise(function(_0x14502d,_0x4abc93){return db['VoiceQueueReport']['findAll']({'raw':_0x49ad80[_0xbeb1('0x1d')]?_0x49ad80[_0xbeb1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x49ad80[_0xbeb1('0x1d')]?_0x49ad80[_0xbeb1('0x1d')][_0xbeb1('0x1e')]||null:null,'attributes':_0x49ad80[_0xbeb1('0x1d')]?_0x49ad80[_0xbeb1('0x1d')][_0xbeb1('0x1f')]||null:null,'limit':_0x49ad80[_0xbeb1('0x1d')]?_0x49ad80['options']['limit']||null:null,'include':_0x49ad80['options']?_0x49ad80['options'][_0xbeb1('0x20')]?_['map'](_0x49ad80[_0xbeb1('0x1d')]['include'],function(_0x4278e6){return{'model':db[_0x4278e6[_0xbeb1('0x21')]],'as':_0x4278e6['as'],'attributes':_0x4278e6['attributes'],'include':_0x4278e6[_0xbeb1('0x20')]?_[_0xbeb1('0x22')](_0x4278e6[_0xbeb1('0x20')],function(_0x3ea981){return{'model':db[_0x3ea981[_0xbeb1('0x21')]],'as':_0x3ea981['as'],'attributes':_0x3ea981[_0xbeb1('0x1f')],'include':_0x3ea981[_0xbeb1('0x20')]?_[_0xbeb1('0x22')](_0x3ea981['include'],function(_0x2165eb){return{'model':db[_0x2165eb[_0xbeb1('0x21')]],'as':_0x2165eb['as'],'attributes':_0x2165eb['attributes']};}):[]};}):[]};}):[]:[]})[_0xbeb1('0x23')](function(_0x5abc36){logger['info'](_0xbeb1('0x1c'),_0x49ad80);logger[_0xbeb1('0x13')](_0xbeb1('0x1c'),_0x49ad80,JSON['stringify'](_0x5abc36));_0x14502d(_0x5abc36);})[_0xbeb1('0x1b')](function(_0x38d5db){logger[_0xbeb1('0x16')](_0xbeb1('0x1c'),_0x38d5db['message'],_0x49ad80);_0x4abc93(_0x341875['error'](0x1f4,_0x38d5db[_0xbeb1('0x18')]));});});};exports[_0xbeb1('0x24')]=function(_0x18d809){var _0x232601=this;return new Promise(function(_0x4eccfc,_0x211162){return db[_0xbeb1('0x25')][_0xbeb1('0x26')](_0x18d809[_0xbeb1('0x27')],{'raw':_0x18d809[_0xbeb1('0x1d')]?_0x18d809['options']['raw']===undefined?!![]:![]:!![]})[_0xbeb1('0x23')](function(_0x5f54a3){logger[_0xbeb1('0x11')]('CreateVoiceQueueReport',_0x18d809);logger['debug']('CreateVoiceQueueReport',_0x18d809,JSON[_0xbeb1('0x15')](_0x5f54a3));_0x4eccfc(_0x5f54a3);})[_0xbeb1('0x1b')](function(_0x1b4e0f){logger['error'](_0xbeb1('0x24'),_0x1b4e0f[_0xbeb1('0x18')],_0x18d809);_0x211162(_0x232601['error'](0x1f4,_0x1b4e0f[_0xbeb1('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3fd120){var _0x123d6c=this;return new Promise(function(_0x38191e,_0x42a9e6){return db['VoiceQueueReport']['update'](_0x3fd120[_0xbeb1('0x27')],{'raw':_0x3fd120[_0xbeb1('0x1d')]?_0x3fd120['options'][_0xbeb1('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd120[_0xbeb1('0x1d')]?_0x3fd120[_0xbeb1('0x1d')][_0xbeb1('0x1e')]||null:null,'attributes':_0x3fd120[_0xbeb1('0x1d')]?_0x3fd120[_0xbeb1('0x1d')][_0xbeb1('0x1f')]||null:null,'limit':_0x3fd120['options']?_0x3fd120['options'][_0xbeb1('0x29')]||null:null})[_0xbeb1('0x23')](function(_0xa3efb2){logger['info'](_0xbeb1('0x2a'),_0x3fd120);logger['debug'](_0xbeb1('0x2a'),_0x3fd120,JSON[_0xbeb1('0x15')](_0xa3efb2));_0x38191e(_0xa3efb2);})[_0xbeb1('0x1b')](function(_0x3c3da8){logger[_0xbeb1('0x16')](_0xbeb1('0x2a'),_0x3c3da8['message'],_0x3fd120);_0x42a9e6(_0x123d6c[_0xbeb1('0x16')](0x1f4,_0x3c3da8[_0xbeb1('0x18')]));});});}; \ No newline at end of file +var _0x407d=['raw','UpdateVoiceQueueReport','update','lodash','util','moment','randomstring','ioredis','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','attributes','limit','include','map','model','GetVoiceQueueReport','debug','CreateVoiceQueueReport','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x407d,0x19d));var _0xd407=function(_0x3c343f,_0x517f84){_0x3c343f=_0x3c343f-0x0;var _0xb74dd9=_0x407d[_0x3c343f];return _0xb74dd9;};'use strict';var _=require(_0xd407('0x0'));var util=require(_0xd407('0x1'));var moment=require(_0xd407('0x2'));var BPromise=require('bluebird');var rs=require(_0xd407('0x3'));var fs=require('fs');var Redis=require(_0xd407('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd407('0x5'));var config=require('../../config/environment');var jayson=require(_0xd407('0x6'));var client=jayson[_0xd407('0x7')][_0xd407('0x8')]({'port':0x232a});config['redis']=_[_0xd407('0x9')](config[_0xd407('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd407('0xb'))(new Redis(config[_0xd407('0xa')]));require(_0xd407('0xc'))[_0xd407('0xd')](socket);function respondWithRpcPromise(_0x4e0159,_0x2e94ce,_0x1675e9){return new BPromise(function(_0x2d836d,_0x49e7fd){return client['request'](_0x4e0159,_0x1675e9)[_0xd407('0xe')](function(_0x35a308){logger[_0xd407('0xf')](_0xd407('0x10'),_0x2e94ce,'request\x20sent');logger['debug'](_0xd407('0x11'),_0x2e94ce,_0xd407('0x12'),JSON[_0xd407('0x13')](_0x35a308));if(_0x35a308[_0xd407('0x14')]){if(_0x35a308[_0xd407('0x14')][_0xd407('0x15')]===0x1f4){logger[_0xd407('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2e94ce,_0x35a308[_0xd407('0x14')][_0xd407('0x16')]);return _0x49e7fd(_0x35a308[_0xd407('0x14')]['message']);}logger[_0xd407('0x14')](_0xd407('0x10'),_0x2e94ce,_0x35a308[_0xd407('0x14')]['message']);return _0x2d836d(_0x35a308[_0xd407('0x14')]['message']);}else{logger[_0xd407('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x2e94ce,_0xd407('0x12'));_0x2d836d(_0x35a308[_0xd407('0x17')]['message']);}})[_0xd407('0x18')](function(_0x5a9c5e){logger[_0xd407('0x14')](_0xd407('0x10'),_0x2e94ce,_0x5a9c5e);_0x49e7fd(_0x5a9c5e);});});}exports['GetVoiceQueueReport']=function(_0x3cff51){var _0x49516d=this;return new Promise(function(_0x3201ee,_0x524017){return db[_0xd407('0x19')][_0xd407('0x1a')]({'raw':_0x3cff51[_0xd407('0x1b')]?_0x3cff51[_0xd407('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3cff51[_0xd407('0x1b')]?_0x3cff51[_0xd407('0x1b')]['where']||null:null,'attributes':_0x3cff51[_0xd407('0x1b')]?_0x3cff51[_0xd407('0x1b')][_0xd407('0x1c')]||null:null,'limit':_0x3cff51[_0xd407('0x1b')]?_0x3cff51[_0xd407('0x1b')][_0xd407('0x1d')]||null:null,'include':_0x3cff51[_0xd407('0x1b')]?_0x3cff51[_0xd407('0x1b')][_0xd407('0x1e')]?_['map'](_0x3cff51['options'][_0xd407('0x1e')],function(_0x5c30ce){return{'model':db[_0x5c30ce['model']],'as':_0x5c30ce['as'],'attributes':_0x5c30ce[_0xd407('0x1c')],'include':_0x5c30ce[_0xd407('0x1e')]?_[_0xd407('0x1f')](_0x5c30ce['include'],function(_0x54ff45){return{'model':db[_0x54ff45[_0xd407('0x20')]],'as':_0x54ff45['as'],'attributes':_0x54ff45[_0xd407('0x1c')],'include':_0x54ff45['include']?_[_0xd407('0x1f')](_0x54ff45[_0xd407('0x1e')],function(_0x227e6e){return{'model':db[_0x227e6e['model']],'as':_0x227e6e['as'],'attributes':_0x227e6e[_0xd407('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd407('0xe')](function(_0x182e94){logger['info'](_0xd407('0x21'),_0x3cff51);logger[_0xd407('0x22')](_0xd407('0x21'),_0x3cff51,JSON['stringify'](_0x182e94));_0x3201ee(_0x182e94);})['catch'](function(_0x21ae15){logger['error'](_0xd407('0x21'),_0x21ae15['message'],_0x3cff51);_0x524017(_0x49516d[_0xd407('0x14')](0x1f4,_0x21ae15[_0xd407('0x16')]));});});};exports[_0xd407('0x23')]=function(_0x1a34ad){var _0x57fec1=this;return new Promise(function(_0x201bf4,_0x234c72){return db['VoiceQueueReport'][_0xd407('0x24')](_0x1a34ad[_0xd407('0x25')],{'raw':_0x1a34ad[_0xd407('0x1b')]?_0x1a34ad['options'][_0xd407('0x26')]===undefined?!![]:![]:!![]})[_0xd407('0xe')](function(_0x34519b){logger[_0xd407('0xf')]('CreateVoiceQueueReport',_0x1a34ad);logger[_0xd407('0x22')](_0xd407('0x23'),_0x1a34ad,JSON[_0xd407('0x13')](_0x34519b));_0x201bf4(_0x34519b);})[_0xd407('0x18')](function(_0x1c3281){logger[_0xd407('0x14')](_0xd407('0x23'),_0x1c3281[_0xd407('0x16')],_0x1a34ad);_0x234c72(_0x57fec1[_0xd407('0x14')](0x1f4,_0x1c3281[_0xd407('0x16')]));});});};exports[_0xd407('0x27')]=function(_0x32f903){var _0xab627b=this;return new Promise(function(_0xf81d6d,_0x17b60){return db[_0xd407('0x19')][_0xd407('0x28')](_0x32f903[_0xd407('0x25')],{'raw':_0x32f903[_0xd407('0x1b')]?_0x32f903[_0xd407('0x1b')][_0xd407('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f903['options']?_0x32f903[_0xd407('0x1b')]['where']||null:null,'attributes':_0x32f903[_0xd407('0x1b')]?_0x32f903[_0xd407('0x1b')]['attributes']||null:null,'limit':_0x32f903[_0xd407('0x1b')]?_0x32f903[_0xd407('0x1b')][_0xd407('0x1d')]||null:null})[_0xd407('0xe')](function(_0x1737ea){logger[_0xd407('0xf')](_0xd407('0x27'),_0x32f903);logger['debug'](_0xd407('0x27'),_0x32f903,JSON[_0xd407('0x13')](_0x1737ea));_0xf81d6d(_0x1737ea);})[_0xd407('0x18')](function(_0x6f9112){logger[_0xd407('0x14')](_0xd407('0x27'),_0x6f9112[_0xd407('0x16')],_0x32f903);_0x17b60(_0xab627b[_0xd407('0x14')](0x1f4,_0x6f9112['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index eb7ad4c..2c053d4 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 _0x4756=['remove','update','./voiceQueueReport.events','save'];(function(_0x464ce6,_0x5992fc){var _0x25c275=function(_0x3aab48){while(--_0x3aab48){_0x464ce6['push'](_0x464ce6['shift']());}};_0x25c275(++_0x5992fc);}(_0x4756,0xa6));var _0x6475=function(_0x144586,_0x9e41db){_0x144586=_0x144586-0x0;var _0x55ba45=_0x4756[_0x144586];return _0x55ba45;};'use strict';var VoiceQueueReportEvents=require(_0x6475('0x0'));var events=[_0x6475('0x1'),_0x6475('0x2'),_0x6475('0x3')];function createListener(_0x51329a,_0x594844){return function(_0x33b695){_0x594844['emit'](_0x51329a,_0x33b695);};}function removeListener(_0x52c553,_0x574c43){return function(){VoiceQueueReportEvents['removeListener'](_0x52c553,_0x574c43);};}exports['register']=function(_0x8d7939){for(var _0x1265a9=0x0,_0x39056b=events['length'];_0x1265a9<_0x39056b;_0x1265a9++){var _0x187a38=events[_0x1265a9];var _0x1b71c6=createListener('voiceQueueReport:'+_0x187a38,_0x8d7939);VoiceQueueReportEvents['on'](_0x187a38,_0x1b71c6);}}; \ No newline at end of file +var _0xcb26=['voiceQueueReport:','./voiceQueueReport.events','save','remove','emit','removeListener','register'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0xcb26,0xf6));var _0x6cb2=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xcb26[_0x19b3f9];return _0x18c3f6;};'use strict';var VoiceQueueReportEvents=require(_0x6cb2('0x0'));var events=[_0x6cb2('0x1'),_0x6cb2('0x2'),'update'];function createListener(_0x4c8f3f,_0x22d166){return function(_0x4ab881){_0x22d166[_0x6cb2('0x3')](_0x4c8f3f,_0x4ab881);};}function removeListener(_0x1d4b25,_0x530bda){return function(){VoiceQueueReportEvents[_0x6cb2('0x4')](_0x1d4b25,_0x530bda);};}exports[_0x6cb2('0x5')]=function(_0x5a8a7d){for(var _0x4d486b=0x0,_0x446656=events['length'];_0x4d486b<_0x446656;_0x4d486b++){var _0x42c7d6=events[_0x4d486b];var _0x456916=createListener(_0x6cb2('0x6')+_0x42c7d6,_0x5a8a7d);VoiceQueueReportEvents['on'](_0x42c7d6,_0x456916);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2792711..d657148 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 _0xf2ac=['exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x24a3fc,_0x3f9208){var _0x421af4=function(_0x200461){while(--_0x200461){_0x24a3fc['push'](_0x24a3fc['shift']());}};_0x421af4(++_0x3f9208);}(_0xf2ac,0x91));var _0xcf2a=function(_0x5b6951,_0x71d056){_0x5b6951=_0x5b6951-0x0;var _0x4178a9=_0xf2ac[_0x5b6951];return _0x4178a9;};'use strict';var multer=require(_0xcf2a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcf2a('0x1'));var express=require('express');var router=express[_0xcf2a('0x2')]();var fs_extra=require(_0xcf2a('0x3'));var auth=require(_0xcf2a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf2a('0x5'));var controller=require(_0xcf2a('0x6'));router[_0xcf2a('0x7')]('/',auth[_0xcf2a('0x8')](),controller['index']);router[_0xcf2a('0x7')](_0xcf2a('0x9'),auth[_0xcf2a('0x8')](),controller[_0xcf2a('0xa')]);router['post']('/',auth[_0xcf2a('0x8')](),controller[_0xcf2a('0xb')]);router[_0xcf2a('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xcf2a('0xd')]);router[_0xcf2a('0xe')](_0xcf2a('0x9'),auth[_0xcf2a('0x8')](),controller['destroy']);module[_0xcf2a('0xf')]=router; \ No newline at end of file +var _0xd561=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0xd561,0x1c9));var _0x1d56=function(_0x551904,_0x18af84){_0x551904=_0x551904-0x0;var _0xc4fa7f=_0xd561[_0x551904];return _0xc4fa7f;};'use strict';var multer=require(_0x1d56('0x0'));var util=require(_0x1d56('0x1'));var path=require(_0x1d56('0x2'));var timeout=require(_0x1d56('0x3'));var express=require(_0x1d56('0x4'));var router=express[_0x1d56('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1d56('0x6'));var interaction=require(_0x1d56('0x7'));var config=require(_0x1d56('0x8'));var controller=require(_0x1d56('0x9'));router[_0x1d56('0xa')]('/',auth['isAuthenticated'](),controller[_0x1d56('0xb')]);router[_0x1d56('0xa')](_0x1d56('0xc'),auth[_0x1d56('0xd')](),controller[_0x1d56('0xe')]);router[_0x1d56('0xf')]('/',auth[_0x1d56('0xd')](),controller[_0x1d56('0x10')]);router[_0x1d56('0x11')](_0x1d56('0xc'),auth[_0x1d56('0xd')](),controller['update']);router['delete'](_0x1d56('0xc'),auth['isAuthenticated'](),controller[_0x1d56('0x12')]);module[_0x1d56('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f173205..c2d9e18 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 _0xe11e=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING'];(function(_0x5f0488,_0x54f2e8){var _0xeb600f=function(_0x39b319){while(--_0x39b319){_0x5f0488['push'](_0x5f0488['shift']());}};_0xeb600f(++_0x54f2e8);}(_0xe11e,0x1ef));var _0xee11=function(_0x2d7a3b,_0x5a6618){_0x2d7a3b=_0x2d7a3b-0x0;var _0x5d621c=_0xe11e[_0x2d7a3b];return _0x5d621c;};'use strict';var Sequelize=require(_0xee11('0x0'));var moment=require('moment');module[_0xee11('0x1')]={'time':{'type':Sequelize[_0xee11('0x2')]},'callid':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xee11('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xee11('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xee11('0x4')](_0xee11('0x5'))}}; \ No newline at end of file +var _0xcb9d=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x1c13bd,_0x2cd179){var _0x4472a8=function(_0xfeaa11){while(--_0xfeaa11){_0x1c13bd['push'](_0x1c13bd['shift']());}};_0x4472a8(++_0x2cd179);}(_0xcb9d,0x1b7));var _0xdcb9=function(_0xac279c,_0x293b5c){_0xac279c=_0xac279c-0x0;var _0x2217a7=_0xcb9d[_0xac279c];return _0x2217a7;};'use strict';var Sequelize=require(_0xdcb9('0x0'));var moment=require(_0xdcb9('0x1'));module[_0xdcb9('0x2')]={'time':{'type':Sequelize[_0xdcb9('0x3')]},'callid':{'type':Sequelize[_0xdcb9('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xdcb9('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xdcb9('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xdcb9('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xdcb9('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xdcb9('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xdcb9('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xdcb9('0x5')](_0xdcb9('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 667ed1e..dbe08c3 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 _0x226a=['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','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','update','then','destroy','stack','name','index','map','VoiceQueuesLog','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x226a,0x111));var _0xa226=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0x226a[_0x59b2a1];return _0x4908d1;};'use strict';var emlformat=require(_0xa226('0x0'));var rimraf=require(_0xa226('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa226('0x2'));var moment=require(_0xa226('0x3'));var BPromise=require(_0xa226('0x4'));var Mustache=require(_0xa226('0x5'));var util=require(_0xa226('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa226('0x7'));var ejs=require(_0xa226('0x8'));var fs=require('fs');var fs_extra=require(_0xa226('0x9'));var _=require(_0xa226('0xa'));var squel=require(_0xa226('0xb'));var crypto=require(_0xa226('0xc'));var jsforce=require(_0xa226('0xd'));var deskjs=require(_0xa226('0xe'));var toCsv=require(_0xa226('0x7'));var querystring=require(_0xa226('0xf'));var Papa=require(_0xa226('0x10'));var Redis=require(_0xa226('0x11'));var authService=require(_0xa226('0x12'));var qs=require(_0xa226('0x13'));var as=require(_0xa226('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa226('0x15'));var utils=require(_0xa226('0x16'));var config=require(_0xa226('0x17'));var licenseUtil=require(_0xa226('0x18'));var db=require(_0xa226('0x19'))['db'];function respondWithStatusCode(_0x2f7507,_0x2bfbed){_0x2bfbed=_0x2bfbed||0xcc;return function(_0x236b7e){if(_0x236b7e){return _0x2f7507[_0xa226('0x1a')](_0x2bfbed);}return _0x2f7507['status'](_0x2bfbed)[_0xa226('0x1b')]();};}function respondWithResult(_0x33bcc1,_0x33ffd4){_0x33ffd4=_0x33ffd4||0xc8;return function(_0x53797e){if(_0x53797e){return _0x33bcc1['status'](_0x33ffd4)[_0xa226('0x1c')](_0x53797e);}};}function respondWithFilteredResult(_0xdda788,_0x149e68){return function(_0x3e9ef8){if(_0x3e9ef8){var _0x2e6297=typeof _0x149e68[_0xa226('0x1d')]===_0xa226('0x1e')&&typeof _0x149e68[_0xa226('0x1f')]===_0xa226('0x1e');var _0x296858=_0x3e9ef8[_0xa226('0x20')];var _0x387039=_0x2e6297?0x0:_0x149e68[_0xa226('0x1d')];var _0x30f5a0=_0x2e6297?_0x3e9ef8[_0xa226('0x20')]:_0x149e68[_0xa226('0x1d')]+_0x149e68['limit'];var _0x1b5752;if(_0x30f5a0>=_0x296858){_0x30f5a0=_0x296858;_0x1b5752=0xc8;}else{_0x1b5752=0xce;}_0xdda788[_0xa226('0x21')](_0x1b5752);return _0xdda788[_0xa226('0x22')]('Content-Range',_0x387039+'-'+_0x30f5a0+'/'+_0x296858)[_0xa226('0x1c')](_0x3e9ef8);}return null;};}function patchUpdates(_0x173640){return function(_0x48f887){try{jsonpatch[_0xa226('0x23')](_0x48f887,_0x173640,!![]);}catch(_0x3431c4){return BPromise['reject'](_0x3431c4);}return _0x48f887['save']();};}function saveUpdates(_0x126e20,_0x729c4a){return function(_0x2fcc40){if(_0x2fcc40){return _0x2fcc40[_0xa226('0x24')](_0x126e20)[_0xa226('0x25')](function(_0x51f73d){return _0x51f73d;});}return null;};}function removeEntity(_0x16f361,_0x2e35fb){return function(_0x1538d2){if(_0x1538d2){return _0x1538d2[_0xa226('0x26')]()[_0xa226('0x25')](function(){_0x16f361['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2823b9,_0x325323){return function(_0x202a35){if(!_0x202a35){_0x2823b9[_0xa226('0x1a')](0x194);}return _0x202a35;};}function handleError(_0x1741b6,_0x11de22){_0x11de22=_0x11de22||0x1f4;return function(_0x3426f8){logger['error'](_0x3426f8[_0xa226('0x27')]);if(_0x3426f8[_0xa226('0x28')]){delete _0x3426f8[_0xa226('0x28')];}_0x1741b6[_0xa226('0x21')](_0x11de22)['send'](_0x3426f8);};}exports[_0xa226('0x29')]=function(_0x337d4d,_0x4b4635){var _0x572549={},_0x194ba3={},_0x4daf93={'count':0x0,'rows':[]};var _0x3fb16d=_[_0xa226('0x2a')](db[_0xa226('0x2b')][_0xa226('0x2c')],function(_0x2a1449){return{'name':_0x2a1449['fieldName'],'type':_0x2a1449[_0xa226('0x2d')][_0xa226('0x2e')]};});_0x194ba3['model']=_[_0xa226('0x2a')](_0x3fb16d,'name');_0x194ba3[_0xa226('0x2f')]=_[_0xa226('0x30')](_0x337d4d[_0xa226('0x2f')]);_0x194ba3['filters']=_[_0xa226('0x31')](_0x194ba3[_0xa226('0x32')],_0x194ba3[_0xa226('0x2f')]);_0x572549[_0xa226('0x33')]=_['intersection'](_0x194ba3[_0xa226('0x32')],qs[_0xa226('0x34')](_0x337d4d['query']['fields']));_0x572549[_0xa226('0x33')]=_0x572549['attributes'][_0xa226('0x35')]?_0x572549[_0xa226('0x33')]:_0x194ba3[_0xa226('0x32')];if(!_0x337d4d[_0xa226('0x2f')][_0xa226('0x36')]('nolimit')){_0x572549[_0xa226('0x1f')]=qs['limit'](_0x337d4d['query'][_0xa226('0x1f')]);_0x572549[_0xa226('0x1d')]=qs[_0xa226('0x1d')](_0x337d4d[_0xa226('0x2f')][_0xa226('0x1d')]);}_0x572549[_0xa226('0x37')]=qs['sort'](_0x337d4d['query']['sort']);_0x572549[_0xa226('0x38')]=qs[_0xa226('0x39')](_['pick'](_0x337d4d[_0xa226('0x2f')],_0x194ba3[_0xa226('0x39')]),_0x3fb16d);if(_0x337d4d['query'][_0xa226('0x3a')]){_0x572549[_0xa226('0x38')]=_[_0xa226('0x3b')](_0x572549['where'],{'$or':_[_0xa226('0x2a')](_0x3fb16d,function(_0x33db69){if(_0x33db69[_0xa226('0x2d')]!==_0xa226('0x3c')){var _0x5e1547={};_0x5e1547[_0x33db69[_0xa226('0x28')]]={'$like':'%'+_0x337d4d['query'][_0xa226('0x3a')]+'%'};return _0x5e1547;}})});}_0x572549=_[_0xa226('0x3b')]({},_0x572549,_0x337d4d['options']);var _0x4289cb={'where':_0x572549[_0xa226('0x38')]};return db[_0xa226('0x2b')][_0xa226('0x20')](_0x4289cb)[_0xa226('0x25')](function(_0x19a6e9){_0x4daf93[_0xa226('0x20')]=_0x19a6e9;if(_0x337d4d[_0xa226('0x2f')][_0xa226('0x3d')]){_0x572549['include']=[{'all':!![]}];}return db[_0xa226('0x2b')][_0xa226('0x3e')](_0x572549);})['then'](function(_0x3991e7){_0x4daf93[_0xa226('0x3f')]=_0x3991e7;return _0x4daf93;})[_0xa226('0x25')](respondWithFilteredResult(_0x4b4635,_0x572549))[_0xa226('0x40')](handleError(_0x4b4635,null));};exports[_0xa226('0x41')]=function(_0x4922f0,_0xdfc639){var _0xd22f6f={'raw':!![],'where':{'id':_0x4922f0[_0xa226('0x42')]['id']}},_0x468f7d={};_0x468f7d[_0xa226('0x32')]=_['keys'](db[_0xa226('0x2b')][_0xa226('0x2c')]);_0x468f7d['query']=_[_0xa226('0x30')](_0x4922f0[_0xa226('0x2f')]);_0x468f7d['filters']=_[_0xa226('0x31')](_0x468f7d['model'],_0x468f7d['query']);_0xd22f6f[_0xa226('0x33')]=_[_0xa226('0x31')](_0x468f7d['model'],qs[_0xa226('0x34')](_0x4922f0['query']['fields']));_0xd22f6f[_0xa226('0x33')]=_0xd22f6f[_0xa226('0x33')][_0xa226('0x35')]?_0xd22f6f[_0xa226('0x33')]:_0x468f7d[_0xa226('0x32')];if(_0x4922f0[_0xa226('0x2f')][_0xa226('0x3d')]){_0xd22f6f['include']=[{'all':!![]}];}_0xd22f6f=_[_0xa226('0x3b')]({},_0xd22f6f,_0x4922f0['options']);return db[_0xa226('0x2b')]['find'](_0xd22f6f)['then'](handleEntityNotFound(_0xdfc639,null))[_0xa226('0x25')](respondWithResult(_0xdfc639,null))[_0xa226('0x40')](handleError(_0xdfc639,null));};exports[_0xa226('0x43')]=function(_0x307bbe,_0x17a429){return db[_0xa226('0x2b')][_0xa226('0x43')](_0x307bbe[_0xa226('0x44')],{})[_0xa226('0x25')](respondWithResult(_0x17a429,0xc9))[_0xa226('0x40')](handleError(_0x17a429,null));};exports[_0xa226('0x24')]=function(_0x6c78cd,_0x42fd83){if(_0x6c78cd['body']['id']){delete _0x6c78cd[_0xa226('0x44')]['id'];}return db[_0xa226('0x2b')][_0xa226('0x45')]({'where':{'id':_0x6c78cd[_0xa226('0x42')]['id']}})[_0xa226('0x25')](handleEntityNotFound(_0x42fd83,null))[_0xa226('0x25')](saveUpdates(_0x6c78cd[_0xa226('0x44')],null))[_0xa226('0x25')](respondWithResult(_0x42fd83,null))[_0xa226('0x40')](handleError(_0x42fd83,null));};exports[_0xa226('0x26')]=function(_0x23bc92,_0x2afe00){return db[_0xa226('0x2b')][_0xa226('0x45')]({'where':{'id':_0x23bc92['params']['id']}})[_0xa226('0x25')](handleEntityNotFound(_0x2afe00,null))['then'](removeEntity(_0x2afe00,null))[_0xa226('0x40')](handleError(_0x2afe00,null));}; \ No newline at end of file +var _0x7ad8=['lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs'];(function(_0x45af68,_0x4593e0){var _0xa67018=function(_0x20ad9e){while(--_0x20ad9e){_0x45af68['push'](_0x45af68['shift']());}};_0xa67018(++_0x4593e0);}(_0x7ad8,0x17e));var _0x87ad=function(_0x256684,_0x529c1e){_0x256684=_0x256684-0x0;var _0x37a0c9=_0x7ad8[_0x256684];return _0x37a0c9;};'use strict';var emlformat=require(_0x87ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87ad('0x1'));var jsonpatch=require(_0x87ad('0x2'));var rp=require(_0x87ad('0x3'));var moment=require(_0x87ad('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87ad('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x87ad('0x6'));var ejs=require(_0x87ad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87ad('0x8'));var squel=require('squel');var crypto=require(_0x87ad('0x9'));var jsforce=require(_0x87ad('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x87ad('0x6'));var querystring=require('querystring');var Papa=require(_0x87ad('0xb'));var Redis=require(_0x87ad('0xc'));var authService=require(_0x87ad('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x87ad('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87ad('0xf'))(_0x87ad('0x10'));var utils=require('../../config/utils');var config=require(_0x87ad('0x11'));var licenseUtil=require(_0x87ad('0x12'));var db=require(_0x87ad('0x13'))['db'];function respondWithStatusCode(_0x4aa1d7,_0x28c902){_0x28c902=_0x28c902||0xcc;return function(_0xa75495){if(_0xa75495){return _0x4aa1d7[_0x87ad('0x14')](_0x28c902);}return _0x4aa1d7[_0x87ad('0x15')](_0x28c902)[_0x87ad('0x16')]();};}function respondWithResult(_0x375f3d,_0x28972f){_0x28972f=_0x28972f||0xc8;return function(_0xc7709f){if(_0xc7709f){return _0x375f3d['status'](_0x28972f)['json'](_0xc7709f);}};}function respondWithFilteredResult(_0x3bf973,_0x28088f){return function(_0x3b803d){if(_0x3b803d){var _0x247b9b=typeof _0x28088f[_0x87ad('0x17')]===_0x87ad('0x18')&&typeof _0x28088f['limit']===_0x87ad('0x18');var _0x1b4189=_0x3b803d[_0x87ad('0x19')];var _0x4cae2c=_0x247b9b?0x0:_0x28088f[_0x87ad('0x17')];var _0x244e6e=_0x247b9b?_0x3b803d[_0x87ad('0x19')]:_0x28088f['offset']+_0x28088f[_0x87ad('0x1a')];var _0x10d2b0;if(_0x244e6e>=_0x1b4189){_0x244e6e=_0x1b4189;_0x10d2b0=0xc8;}else{_0x10d2b0=0xce;}_0x3bf973[_0x87ad('0x15')](_0x10d2b0);return _0x3bf973[_0x87ad('0x1b')](_0x87ad('0x1c'),_0x4cae2c+'-'+_0x244e6e+'/'+_0x1b4189)['json'](_0x3b803d);}return null;};}function patchUpdates(_0x1dbdbb){return function(_0xb41f34){try{jsonpatch[_0x87ad('0x1d')](_0xb41f34,_0x1dbdbb,!![]);}catch(_0x1af581){return BPromise['reject'](_0x1af581);}return _0xb41f34['save']();};}function saveUpdates(_0x54de0d,_0x1e9f0a){return function(_0x4ce59f){if(_0x4ce59f){return _0x4ce59f[_0x87ad('0x1e')](_0x54de0d)['then'](function(_0x5224bb){return _0x5224bb;});}return null;};}function removeEntity(_0x34a847,_0x4e1a7b){return function(_0x40abd0){if(_0x40abd0){return _0x40abd0[_0x87ad('0x1f')]()[_0x87ad('0x20')](function(){_0x34a847[_0x87ad('0x15')](0xcc)[_0x87ad('0x16')]();});}};}function handleEntityNotFound(_0x45a949,_0x486387){return function(_0xd925fe){if(!_0xd925fe){_0x45a949['sendStatus'](0x194);}return _0xd925fe;};}function handleError(_0x3c7dda,_0x86f026){_0x86f026=_0x86f026||0x1f4;return function(_0xf64573){logger['error'](_0xf64573[_0x87ad('0x21')]);if(_0xf64573[_0x87ad('0x22')]){delete _0xf64573[_0x87ad('0x22')];}_0x3c7dda[_0x87ad('0x15')](_0x86f026)[_0x87ad('0x23')](_0xf64573);};}exports[_0x87ad('0x24')]=function(_0x281311,_0x1c6411){var _0x40c5b7={},_0x36d686={},_0x238790={'count':0x0,'rows':[]};var _0x2c6c65=_[_0x87ad('0x25')](db[_0x87ad('0x26')]['rawAttributes'],function(_0x14e1a5){return{'name':_0x14e1a5[_0x87ad('0x27')],'type':_0x14e1a5[_0x87ad('0x28')]['key']};});_0x36d686['model']=_[_0x87ad('0x25')](_0x2c6c65,'name');_0x36d686['query']=_[_0x87ad('0x29')](_0x281311['query']);_0x36d686[_0x87ad('0x2a')]=_[_0x87ad('0x2b')](_0x36d686[_0x87ad('0x2c')],_0x36d686[_0x87ad('0x2d')]);_0x40c5b7[_0x87ad('0x2e')]=_['intersection'](_0x36d686[_0x87ad('0x2c')],qs[_0x87ad('0x2f')](_0x281311[_0x87ad('0x2d')][_0x87ad('0x2f')]));_0x40c5b7[_0x87ad('0x2e')]=_0x40c5b7[_0x87ad('0x2e')]['length']?_0x40c5b7[_0x87ad('0x2e')]:_0x36d686[_0x87ad('0x2c')];if(!_0x281311[_0x87ad('0x2d')][_0x87ad('0x30')](_0x87ad('0x31'))){_0x40c5b7[_0x87ad('0x1a')]=qs['limit'](_0x281311['query'][_0x87ad('0x1a')]);_0x40c5b7[_0x87ad('0x17')]=qs[_0x87ad('0x17')](_0x281311[_0x87ad('0x2d')][_0x87ad('0x17')]);}_0x40c5b7['order']=qs[_0x87ad('0x32')](_0x281311[_0x87ad('0x2d')][_0x87ad('0x32')]);_0x40c5b7[_0x87ad('0x33')]=qs['filters'](_[_0x87ad('0x34')](_0x281311['query'],_0x36d686[_0x87ad('0x2a')]),_0x2c6c65);if(_0x281311[_0x87ad('0x2d')][_0x87ad('0x35')]){_0x40c5b7[_0x87ad('0x33')]=_[_0x87ad('0x36')](_0x40c5b7['where'],{'$or':_[_0x87ad('0x25')](_0x2c6c65,function(_0x47f2c6){if(_0x47f2c6[_0x87ad('0x28')]!==_0x87ad('0x37')){var _0x47db3f={};_0x47db3f[_0x47f2c6[_0x87ad('0x22')]]={'$like':'%'+_0x281311['query']['filter']+'%'};return _0x47db3f;}})});}_0x40c5b7=_['merge']({},_0x40c5b7,_0x281311['options']);var _0x541a58={'where':_0x40c5b7[_0x87ad('0x33')]};return db[_0x87ad('0x26')][_0x87ad('0x19')](_0x541a58)[_0x87ad('0x20')](function(_0x2d6742){_0x238790[_0x87ad('0x19')]=_0x2d6742;if(_0x281311[_0x87ad('0x2d')]['includeAll']){_0x40c5b7[_0x87ad('0x38')]=[{'all':!![]}];}return db[_0x87ad('0x26')]['findAll'](_0x40c5b7);})[_0x87ad('0x20')](function(_0x4c5e75){_0x238790[_0x87ad('0x39')]=_0x4c5e75;return _0x238790;})[_0x87ad('0x20')](respondWithFilteredResult(_0x1c6411,_0x40c5b7))[_0x87ad('0x3a')](handleError(_0x1c6411,null));};exports[_0x87ad('0x3b')]=function(_0x35cfac,_0x583b11){var _0x9ac543={'raw':!![],'where':{'id':_0x35cfac[_0x87ad('0x3c')]['id']}},_0x37917f={};_0x37917f[_0x87ad('0x2c')]=_[_0x87ad('0x29')](db[_0x87ad('0x26')]['rawAttributes']);_0x37917f['query']=_['keys'](_0x35cfac['query']);_0x37917f[_0x87ad('0x2a')]=_['intersection'](_0x37917f[_0x87ad('0x2c')],_0x37917f['query']);_0x9ac543[_0x87ad('0x2e')]=_[_0x87ad('0x2b')](_0x37917f['model'],qs['fields'](_0x35cfac[_0x87ad('0x2d')][_0x87ad('0x2f')]));_0x9ac543[_0x87ad('0x2e')]=_0x9ac543[_0x87ad('0x2e')][_0x87ad('0x3d')]?_0x9ac543[_0x87ad('0x2e')]:_0x37917f[_0x87ad('0x2c')];if(_0x35cfac[_0x87ad('0x2d')]['includeAll']){_0x9ac543[_0x87ad('0x38')]=[{'all':!![]}];}_0x9ac543=_[_0x87ad('0x36')]({},_0x9ac543,_0x35cfac['options']);return db[_0x87ad('0x26')][_0x87ad('0x3e')](_0x9ac543)['then'](handleEntityNotFound(_0x583b11,null))['then'](respondWithResult(_0x583b11,null))[_0x87ad('0x3a')](handleError(_0x583b11,null));};exports[_0x87ad('0x3f')]=function(_0x1a8fa6,_0xe734fb){return db[_0x87ad('0x26')][_0x87ad('0x3f')](_0x1a8fa6[_0x87ad('0x40')],{})[_0x87ad('0x20')](respondWithResult(_0xe734fb,0xc9))[_0x87ad('0x3a')](handleError(_0xe734fb,null));};exports[_0x87ad('0x1e')]=function(_0x3e500f,_0x1d44b4){if(_0x3e500f[_0x87ad('0x40')]['id']){delete _0x3e500f[_0x87ad('0x40')]['id'];}return db[_0x87ad('0x26')][_0x87ad('0x3e')]({'where':{'id':_0x3e500f['params']['id']}})[_0x87ad('0x20')](handleEntityNotFound(_0x1d44b4,null))[_0x87ad('0x20')](saveUpdates(_0x3e500f[_0x87ad('0x40')],null))['then'](respondWithResult(_0x1d44b4,null))[_0x87ad('0x3a')](handleError(_0x1d44b4,null));};exports[_0x87ad('0x1f')]=function(_0x3cab11,_0x51aec5){return db[_0x87ad('0x26')]['find']({'where':{'id':_0x3cab11[_0x87ad('0x3c')]['id']}})['then'](handleEntityNotFound(_0x51aec5,null))[_0x87ad('0x20')](removeEntity(_0x51aec5,null))[_0x87ad('0x3a')](handleError(_0x51aec5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b5c02dc..c3c8ce4 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 _0xbaef=['request-promise','path','rimraf','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird'];(function(_0x5ce9e4,_0x10e5e4){var _0x2fe885=function(_0x2481bb){while(--_0x2481bb){_0x5ce9e4['push'](_0x5ce9e4['shift']());}};_0x2fe885(++_0x10e5e4);}(_0xbaef,0x1db));var _0xfbae=function(_0x2dfa6b,_0x103232){_0x2dfa6b=_0x2dfa6b-0x0;var _0x4ea4b1=_0xbaef[_0x2dfa6b];return _0x4ea4b1;};'use strict';var _=require(_0xfbae('0x0'));var util=require(_0xfbae('0x1'));var logger=require(_0xfbae('0x2'))(_0xfbae('0x3'));var moment=require('moment');var BPromise=require(_0xfbae('0x4'));var rp=require(_0xfbae('0x5'));var fs=require('fs');var path=require(_0xfbae('0x6'));var rimraf=require(_0xfbae('0x7'));var config=require('../../config/environment');var attributes=require(_0xfbae('0x8'));module['exports']=function(_0x55dd62,_0x478c32){return _0x55dd62[_0xfbae('0x9')](_0xfbae('0xa'),attributes,{'tableName':_0xfbae('0xb'),'paranoid':![],'indexes':[{'name':_0xfbae('0xc'),'fields':[_0xfbae('0xd'),_0xfbae('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5a1f=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x5a1f,0x19c));var _0xf5a1=function(_0x547722,_0xe22218){_0x547722=_0x547722-0x0;var _0x32819e=_0x5a1f[_0x547722];return _0x32819e;};'use strict';var _=require(_0xf5a1('0x0'));var util=require(_0xf5a1('0x1'));var logger=require(_0xf5a1('0x2'))(_0xf5a1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf5a1('0x4'));var fs=require('fs');var path=require(_0xf5a1('0x5'));var rimraf=require(_0xf5a1('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0xf5a1('0x7')]=function(_0x23af9e,_0x2f9f73){return _0x23af9e[_0xf5a1('0x8')](_0xf5a1('0x9'),attributes,{'tableName':_0xf5a1('0xa'),'paranoid':![],'indexes':[{'name':_0xf5a1('0xb'),'fields':[_0xf5a1('0xc'),_0xf5a1('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 718be00..a5947b7 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 _0x3402=['jayson/promise','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3402,0x1f0));var _0x2340=function(_0xa3556,_0x3593fe){_0xa3556=_0xa3556-0x0;var _0x39a9ed=_0x3402[_0xa3556];return _0x39a9ed;};'use strict';var _=require(_0x2340('0x0'));var util=require('util');var moment=require(_0x2340('0x1'));var BPromise=require(_0x2340('0x2'));var rs=require(_0x2340('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2340('0x4'));var logger=require(_0x2340('0x5'))(_0x2340('0x6'));var config=require(_0x2340('0x7'));var jayson=require(_0x2340('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc37850,_0x1deef4,_0x16174f){return new BPromise(function(_0x225250,_0x152e52){return client['request'](_0xc37850,_0x16174f)[_0x2340('0x9')](function(_0x1da381){logger[_0x2340('0xa')](_0x2340('0xb'),_0x1deef4,_0x2340('0xc'));logger['debug'](_0x2340('0xd'),_0x1deef4,_0x2340('0xc'),JSON['stringify'](_0x1da381));if(_0x1da381['error']){if(_0x1da381[_0x2340('0xe')]['code']===0x1f4){logger[_0x2340('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1deef4,_0x1da381[_0x2340('0xe')][_0x2340('0xf')]);return _0x152e52(_0x1da381[_0x2340('0xe')][_0x2340('0xf')]);}logger[_0x2340('0xe')](_0x2340('0xb'),_0x1deef4,_0x1da381[_0x2340('0xe')]['message']);return _0x225250(_0x1da381[_0x2340('0xe')][_0x2340('0xf')]);}else{logger[_0x2340('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1deef4,_0x2340('0xc'));_0x225250(_0x1da381[_0x2340('0x10')][_0x2340('0xf')]);}})[_0x2340('0x11')](function(_0x4dcab6){logger[_0x2340('0xe')](_0x2340('0xb'),_0x1deef4,_0x4dcab6);_0x152e52(_0x4dcab6);});});} \ No newline at end of file +var _0x167e=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x9d93d1,_0x21e0c6){var _0x67fa0=function(_0x4e098d){while(--_0x4e098d){_0x9d93d1['push'](_0x9d93d1['shift']());}};_0x67fa0(++_0x21e0c6);}(_0x167e,0xa3));var _0xe167=function(_0x311301,_0x3f28fb){_0x311301=_0x311301-0x0;var _0x2bb258=_0x167e[_0x311301];return _0x2bb258;};'use strict';var _=require(_0xe167('0x0'));var util=require(_0xe167('0x1'));var moment=require(_0xe167('0x2'));var BPromise=require(_0xe167('0x3'));var rs=require(_0xe167('0x4'));var fs=require('fs');var Redis=require(_0xe167('0x5'));var db=require(_0xe167('0x6'))['db'];var utils=require(_0xe167('0x7'));var logger=require('../../config/logger')(_0xe167('0x8'));var config=require('../../config/environment');var jayson=require(_0xe167('0x9'));var client=jayson[_0xe167('0xa')][_0xe167('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bad0c,_0x1426ae,_0x56cf9b){return new BPromise(function(_0x3a00d5,_0x5c6694){return client[_0xe167('0xc')](_0x3bad0c,_0x56cf9b)[_0xe167('0xd')](function(_0x26a191){logger[_0xe167('0xe')](_0xe167('0xf'),_0x1426ae,_0xe167('0x10'));logger[_0xe167('0x11')](_0xe167('0x12'),_0x1426ae,'request\x20sent',JSON[_0xe167('0x13')](_0x26a191));if(_0x26a191[_0xe167('0x14')]){if(_0x26a191['error'][_0xe167('0x15')]===0x1f4){logger[_0xe167('0x14')](_0xe167('0xf'),_0x1426ae,_0x26a191[_0xe167('0x14')][_0xe167('0x16')]);return _0x5c6694(_0x26a191[_0xe167('0x14')][_0xe167('0x16')]);}logger[_0xe167('0x14')](_0xe167('0xf'),_0x1426ae,_0x26a191['error'][_0xe167('0x16')]);return _0x3a00d5(_0x26a191[_0xe167('0x14')][_0xe167('0x16')]);}else{logger[_0xe167('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1426ae,_0xe167('0x10'));_0x3a00d5(_0x26a191[_0xe167('0x17')][_0xe167('0x16')]);}})[_0xe167('0x18')](function(_0x1244d4){logger['error'](_0xe167('0xf'),_0x1426ae,_0x1244d4);_0x5c6694(_0x1244d4);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6a4345e..ad1bf3d 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 _0x4513=['downloadTranscribe','post','create','/:id/transcribe','runTranscribe','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceRecording.controller','isAuthenticated','describe','get','/:id/download','download','downloads'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4513,0x152));var _0x3451=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4513[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x3451('0x0'));var util=require(_0x3451('0x1'));var path=require(_0x3451('0x2'));var timeout=require(_0x3451('0x3'));var express=require(_0x3451('0x4'));var router=express['Router']();var fs_extra=require(_0x3451('0x5'));var auth=require(_0x3451('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3451('0x7'));router['get']('/',auth[_0x3451('0x8')](),controller['index']);router['get']('/describe',auth[_0x3451('0x8')](),controller[_0x3451('0x9')]);router[_0x3451('0xa')]('/:id',auth[_0x3451('0x8')](),controller['show']);router[_0x3451('0xa')](_0x3451('0xb'),auth[_0x3451('0x8')](),controller[_0x3451('0xc')]);router[_0x3451('0xa')]('/:id/downloads',controller[_0x3451('0xd')]);router[_0x3451('0xa')]('/:id/transcribe',auth[_0x3451('0x8')](),controller[_0x3451('0xe')]);router[_0x3451('0xf')]('/',auth[_0x3451('0x8')](),controller[_0x3451('0x10')]);router[_0x3451('0xf')](_0x3451('0x11'),auth[_0x3451('0x8')](),controller[_0x3451('0x12')]);router['put']('/:id',auth[_0x3451('0x8')](),controller['update']);router[_0x3451('0x13')](_0x3451('0x14'),auth[_0x3451('0x8')](),controller['destroy']);module[_0x3451('0x15')]=router; \ No newline at end of file +var _0xafbe=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','exports'];(function(_0x4d04d6,_0x38ae19){var _0x2e937a=function(_0x4961c8){while(--_0x4961c8){_0x4d04d6['push'](_0x4d04d6['shift']());}};_0x2e937a(++_0x38ae19);}(_0xafbe,0x138));var _0xeafb=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xafbe[_0x313df3];return _0x241d59;};'use strict';var multer=require(_0xeafb('0x0'));var util=require(_0xeafb('0x1'));var path=require(_0xeafb('0x2'));var timeout=require(_0xeafb('0x3'));var express=require(_0xeafb('0x4'));var router=express['Router']();var fs_extra=require(_0xeafb('0x5'));var auth=require(_0xeafb('0x6'));var interaction=require(_0xeafb('0x7'));var config=require('../../config/environment');var controller=require(_0xeafb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xeafb('0x9')]);router[_0xeafb('0xa')](_0xeafb('0xb'),auth['isAuthenticated'](),controller[_0xeafb('0xc')]);router[_0xeafb('0xa')](_0xeafb('0xd'),auth[_0xeafb('0xe')](),controller[_0xeafb('0xf')]);router[_0xeafb('0xa')](_0xeafb('0x10'),auth[_0xeafb('0xe')](),controller[_0xeafb('0x11')]);router[_0xeafb('0xa')](_0xeafb('0x12'),controller['downloads']);router[_0xeafb('0xa')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xeafb('0x13')]);router[_0xeafb('0x14')]('/',auth['isAuthenticated'](),controller[_0xeafb('0x15')]);router[_0xeafb('0x14')](_0xeafb('0x16'),auth[_0xeafb('0xe')](),controller[_0xeafb('0x17')]);router[_0xeafb('0x18')](_0xeafb('0xd'),auth[_0xeafb('0xe')](),controller['update']);router['delete'](_0xeafb('0xd'),auth[_0xeafb('0xe')](),controller['destroy']);module[_0xeafb('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index cd25eda..5eae678 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(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 5e0027a..80dc133 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 _0xe001=['rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','download','uniqueid','value','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','token','push','$and','%s.cypher','isNil','cancellazione\x20fisica\x20documento\x20%s','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data2','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','end','sendStatus','name','send','index','map','VoiceRecording'];(function(_0x1de2a9,_0x23b34e){var _0x262bc9=function(_0x387d3f){while(--_0x387d3f){_0x1de2a9['push'](_0x1de2a9['shift']());}};_0x262bc9(++_0x23b34e);}(_0xe001,0xff));var _0x1e00=function(_0x4db8d9,_0x100e73){_0x4db8d9=_0x4db8d9-0x0;var _0x1e1a49=_0xe001[_0x4db8d9];return _0x1e1a49;};'use strict';var emlformat=require(_0x1e00('0x0'));var rimraf=require(_0x1e00('0x1'));var zipdir=require(_0x1e00('0x2'));var jsonpatch=require(_0x1e00('0x3'));var rp=require(_0x1e00('0x4'));var moment=require(_0x1e00('0x5'));var BPromise=require(_0x1e00('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1e00('0x7'));var csv=require(_0x1e00('0x8'));var ejs=require(_0x1e00('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e00('0xa'));var squel=require(_0x1e00('0xb'));var crypto=require(_0x1e00('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1e00('0xd'));var toCsv=require(_0x1e00('0x8'));var querystring=require(_0x1e00('0xe'));var Papa=require(_0x1e00('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x1e00('0x10'));var Redis=require(_0x1e00('0x11'));var authService=require(_0x1e00('0x12'));var qs=require(_0x1e00('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e00('0x14'));var logger=require('../../config/logger')(_0x1e00('0x15'));var utils=require(_0x1e00('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1e00('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ffed,_0x4a805c){_0x4a805c=_0x4a805c||0xcc;return function(_0x264082){if(_0x264082){return _0x35ffed['sendStatus'](_0x4a805c);}return _0x35ffed[_0x1e00('0x18')](_0x4a805c)['end']();};}function respondWithResult(_0x332b1b,_0x491da2){_0x491da2=_0x491da2||0xc8;return function(_0x59bb80){if(_0x59bb80){return _0x332b1b['status'](_0x491da2)[_0x1e00('0x19')](_0x59bb80);}};}function respondWithFilteredResult(_0x2fd46b,_0x22c20a){return function(_0x233aa9){if(_0x233aa9){var _0x428bb2=typeof _0x22c20a[_0x1e00('0x1a')]===_0x1e00('0x1b')&&typeof _0x22c20a['limit']===_0x1e00('0x1b');var _0x153e73=_0x233aa9[_0x1e00('0x1c')];var _0xb39771=_0x428bb2?0x0:_0x22c20a[_0x1e00('0x1a')];var _0x1a7fbd=_0x428bb2?_0x233aa9[_0x1e00('0x1c')]:_0x22c20a['offset']+_0x22c20a[_0x1e00('0x1d')];var _0xe9d92d;if(_0x1a7fbd>=_0x153e73){_0x1a7fbd=_0x153e73;_0xe9d92d=0xc8;}else{_0xe9d92d=0xce;}_0x2fd46b[_0x1e00('0x18')](_0xe9d92d);return _0x2fd46b['set'](_0x1e00('0x1e'),_0xb39771+'-'+_0x1a7fbd+'/'+_0x153e73)['json'](_0x233aa9);}return null;};}function patchUpdates(_0x564fdc){return function(_0x1d4f3a){try{jsonpatch['apply'](_0x1d4f3a,_0x564fdc,!![]);}catch(_0x44c352){return BPromise[_0x1e00('0x1f')](_0x44c352);}return _0x1d4f3a[_0x1e00('0x20')]();};}function saveUpdates(_0x19e020,_0x5b27b9){return function(_0x5233ac){if(_0x5233ac){return _0x5233ac[_0x1e00('0x21')](_0x19e020)[_0x1e00('0x22')](function(_0x1cf13c){return _0x1cf13c;});}return null;};}function removeEntity(_0x4d5418,_0x18a277){return function(_0x560801){if(_0x560801){return _0x560801[_0x1e00('0x23')]()[_0x1e00('0x22')](function(){_0x4d5418['status'](0xcc)[_0x1e00('0x24')]();});}};}function handleEntityNotFound(_0x5b2c44,_0x5ad345){return function(_0x19547b){if(!_0x19547b){_0x5b2c44[_0x1e00('0x25')](0x194);}return _0x19547b;};}function handleError(_0xcd7eff,_0x17dcd3){_0x17dcd3=_0x17dcd3||0x1f4;return function(_0x4807e2){logger['error'](_0x4807e2['stack']);if(_0x4807e2[_0x1e00('0x26')]){delete _0x4807e2['name'];}_0xcd7eff['status'](_0x17dcd3)[_0x1e00('0x27')](_0x4807e2);};}exports[_0x1e00('0x28')]=function(_0x4bc782,_0x48c4b8){var _0x490153={},_0x5b50a1={},_0x166c97={'count':0x0,'rows':[]};var _0x12430f=_[_0x1e00('0x29')](db[_0x1e00('0x2a')][_0x1e00('0x2b')],function(_0x2aa09d){return{'name':_0x2aa09d[_0x1e00('0x2c')],'type':_0x2aa09d[_0x1e00('0x2d')][_0x1e00('0x2e')]};});_0x5b50a1['model']=_[_0x1e00('0x2f')](_[_0x1e00('0x29')](_0x12430f,_0x1e00('0x26')),['format']);_0x5b50a1['query']=_[_0x1e00('0x30')](_0x4bc782[_0x1e00('0x31')]);_0x5b50a1[_0x1e00('0x32')]=_[_0x1e00('0x33')](_0x5b50a1['model'],_0x5b50a1[_0x1e00('0x31')]);_0x490153['attributes']=_[_0x1e00('0x33')](_0x5b50a1[_0x1e00('0x34')],qs[_0x1e00('0x35')](_0x4bc782[_0x1e00('0x31')][_0x1e00('0x35')]));_0x490153[_0x1e00('0x36')]=_0x490153['attributes'][_0x1e00('0x37')]?_0x490153[_0x1e00('0x36')]:_0x5b50a1[_0x1e00('0x34')];if(!_0x4bc782['query'][_0x1e00('0x38')](_0x1e00('0x39'))){_0x490153[_0x1e00('0x1d')]=qs[_0x1e00('0x1d')](_0x4bc782[_0x1e00('0x31')][_0x1e00('0x1d')]);_0x490153[_0x1e00('0x1a')]=qs[_0x1e00('0x1a')](_0x4bc782[_0x1e00('0x31')]['offset']);}_0x490153[_0x1e00('0x3a')]=qs[_0x1e00('0x3b')](_0x4bc782[_0x1e00('0x31')][_0x1e00('0x3b')]);_0x490153['where']=qs[_0x1e00('0x32')](_[_0x1e00('0x3c')](_0x4bc782[_0x1e00('0x31')],_0x5b50a1[_0x1e00('0x32')]),_0x12430f);if(_0x4bc782[_0x1e00('0x31')]['filter']){_0x490153[_0x1e00('0x3d')]=_['merge'](_0x490153['where'],{'$or':_[_0x1e00('0x29')](_0x12430f,function(_0x8b3435){if(_0x8b3435['type']!==_0x1e00('0x3e')){var _0x211a1e={};_0x211a1e[_0x8b3435[_0x1e00('0x26')]]={'$like':'%'+_0x4bc782[_0x1e00('0x31')]['filter']+'%'};return _0x211a1e;}})});}_0x490153=_[_0x1e00('0x3f')]({},_0x490153,_0x4bc782[_0x1e00('0x40')]);var _0x1ed6d7={'where':_0x490153[_0x1e00('0x3d')]};return db[_0x1e00('0x2a')][_0x1e00('0x1c')](_0x1ed6d7)[_0x1e00('0x22')](function(_0x53d6e0){_0x166c97[_0x1e00('0x1c')]=_0x53d6e0;if(_0x4bc782[_0x1e00('0x31')][_0x1e00('0x41')]){_0x490153[_0x1e00('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1e00('0x43')](_0x490153);})[_0x1e00('0x22')](function(_0x106061){_0x166c97[_0x1e00('0x44')]=_0x106061;return _0x166c97;})[_0x1e00('0x22')](respondWithFilteredResult(_0x48c4b8,_0x490153))[_0x1e00('0x45')](handleError(_0x48c4b8,null));};exports['show']=function(_0x3003da,_0x1b3450){var _0x1bfb61={'raw':![],'where':{'id':_0x3003da[_0x1e00('0x46')]['id']}},_0x4e834a={};_0x4e834a[_0x1e00('0x34')]=_[_0x1e00('0x30')](db['VoiceRecording'][_0x1e00('0x2b')]);_0x4e834a[_0x1e00('0x31')]=_[_0x1e00('0x30')](_0x3003da[_0x1e00('0x31')]);_0x4e834a['filters']=_['intersection'](_0x4e834a[_0x1e00('0x34')],_0x4e834a[_0x1e00('0x31')]);_0x1bfb61['attributes']=_[_0x1e00('0x33')](_0x4e834a[_0x1e00('0x34')],qs[_0x1e00('0x35')](_0x3003da[_0x1e00('0x31')][_0x1e00('0x35')]));_0x1bfb61['attributes']=_0x1bfb61[_0x1e00('0x36')][_0x1e00('0x37')]?_0x1bfb61[_0x1e00('0x36')]:_0x4e834a[_0x1e00('0x34')];if(_0x3003da[_0x1e00('0x31')][_0x1e00('0x41')]){_0x1bfb61['include']=[{'all':!![]}];}_0x1bfb61=_['merge']({},_0x1bfb61,_0x3003da[_0x1e00('0x40')]);return db['VoiceRecording'][_0x1e00('0x47')](_0x1bfb61)[_0x1e00('0x22')](handleEntityNotFound(_0x1b3450,null))[_0x1e00('0x22')](respondWithResult(_0x1b3450,null))[_0x1e00('0x45')](handleError(_0x1b3450,null));};exports[_0x1e00('0x48')]=function(_0x5a3d4e,_0x500c4c){return db[_0x1e00('0x2a')][_0x1e00('0x48')](_0x5a3d4e['body'],{})[_0x1e00('0x22')](respondWithResult(_0x500c4c,0xc9))[_0x1e00('0x45')](handleError(_0x500c4c,null));};exports[_0x1e00('0x21')]=function(_0x4db42f,_0x5dc3af){if(_0x4db42f[_0x1e00('0x49')]['id']){delete _0x4db42f[_0x1e00('0x49')]['id'];}return db['VoiceRecording'][_0x1e00('0x47')]({'where':{'id':_0x4db42f[_0x1e00('0x46')]['id']}})['then'](handleEntityNotFound(_0x5dc3af,null))[_0x1e00('0x22')](saveUpdates(_0x4db42f['body'],null))[_0x1e00('0x22')](respondWithResult(_0x5dc3af,null))[_0x1e00('0x45')](handleError(_0x5dc3af,null));};exports[_0x1e00('0x4a')]=function(_0xe775e2,_0x21846a){return db[_0x1e00('0x2a')][_0x1e00('0x4a')]()[_0x1e00('0x22')](respondWithResult(_0x21846a,null))['catch'](handleError(_0x21846a,null));};exports[_0x1e00('0x4b')]=function(_0x4d62dd,_0x3e9787,_0x1920aa){var _0x5d7853=require('../../components/encryptor');var _0x13d498=![];var _0x5bcb8a={};if(_0x4d62dd[_0x1e00('0x31')][_0x1e00('0x2d')]&&_0x4d62dd[_0x1e00('0x31')][_0x1e00('0x2d')]==='uniqueid'){_0x5bcb8a[_0x1e00('0x4c')]=_0x4d62dd[_0x1e00('0x46')]['id'];}else{_0x5bcb8a['id']=_0x4d62dd[_0x1e00('0x46')]['id'];}return db['VoiceRecording']['find']({'where':_0x5bcb8a,'attributes':['id',_0x1e00('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x3e9787,null))['then'](function(_0x397e39){if(_0x397e39){var _0x632a1a=_0x397e39['value'];var _0x1d6b24=util[_0x1e00('0x4e')]('%s.cypher',_0x632a1a);if(fs['existsSync'](_0x1d6b24)){_0x13d498=!![];return _0x5d7853[_0x1e00('0x4f')](_0x1d6b24,_0x632a1a,config[_0x1e00('0x50')][_0x1e00('0x51')])[_0x1e00('0x22')](function(){return _0x397e39;});}return _0x397e39;}})[_0x1e00('0x22')](function(_0x197a76){if(_0x197a76){var _0x33c271=_0x197a76[_0x1e00('0x4d')];if(!fs[_0x1e00('0x52')](_0x33c271)){throw new db[(_0x1e00('0x53'))][(_0x1e00('0x54'))](_0x1e00('0x55'));}if(_0x197a76['filename']){return _0x3e9787[_0x1e00('0x4b')](_0x33c271,_0x197a76[_0x1e00('0x56')]+path[_0x1e00('0x57')](_0x33c271),function(){if(_0x13d498){fs[_0x1e00('0x58')](_0x33c271);}});}else{return _0x3e9787[_0x1e00('0x4b')](_0x33c271,function(_0x105ee3){if(_0x13d498){fs[_0x1e00('0x58')](_0x33c271);}});}}})[_0x1e00('0x45')](function(_0x211a50){if(_0x211a50[_0x1e00('0x59')]===_0x1e00('0x55')){_0x3e9787[_0x1e00('0x18')](0x194)[_0x1e00('0x27')](_0x1e00('0x5a'));}else{return handleError(_0x3e9787,null);}});};exports[_0x1e00('0x5b')]=function(_0x3bfcc6,_0x298600,_0x18198b){var _0x551410=require(_0x1e00('0x5c'));var _0x3a315e=![];var _0x1c4b4e={'$and':[db[_0x1e00('0x5d')][_0x1e00('0x3d')](db['sequelize']['fn']('MD5',db[_0x1e00('0x5d')]['col'](_0x1e00('0x4c'))),_0x3bfcc6['query'][_0x1e00('0x5e')])]};if(_0x3bfcc6[_0x1e00('0x31')][_0x1e00('0x2d')]&&_0x3bfcc6[_0x1e00('0x31')][_0x1e00('0x2d')]===_0x1e00('0x4c')){_0x1c4b4e['$and'][_0x1e00('0x5f')]({'uniqueid':_0x3bfcc6['params']['id']});}else{_0x1c4b4e[_0x1e00('0x60')][_0x1e00('0x5f')]({'id':_0x3bfcc6[_0x1e00('0x46')]['id']});}return db[_0x1e00('0x2a')][_0x1e00('0x47')]({'where':_0x1c4b4e,'attributes':['id','value'],'raw':!![]})[_0x1e00('0x22')](handleEntityNotFound(_0x298600,null))[_0x1e00('0x22')](function(_0x5aebce){if(_0x5aebce){var _0x1d977a=util[_0x1e00('0x4e')](_0x1e00('0x61'),_0x5aebce['value']);if(fs[_0x1e00('0x52')](_0x1d977a)){_0x3a315e=!![];return _0x551410[_0x1e00('0x4f')](_0x1d977a,_0x5aebce[_0x1e00('0x4d')],config[_0x1e00('0x50')][_0x1e00('0x51')])[_0x1e00('0x22')](function(){return _0x5aebce;});}return _0x5aebce;}})['then'](function(_0x377b99){if(_0x377b99){if(!fs[_0x1e00('0x52')](_0x377b99[_0x1e00('0x4d')])){throw new db['Sequelize'][(_0x1e00('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x377b99[_0x1e00('0x56')]){return _0x298600[_0x1e00('0x4b')](_0x377b99[_0x1e00('0x4d')],_0x377b99[_0x1e00('0x56')]+path['extname'](_0x377b99[_0x1e00('0x4d')]),function(){if(_0x3a315e){fs[_0x1e00('0x58')](_0x377b99['value']);}});}else{return _0x298600[_0x1e00('0x4b')](_0x377b99[_0x1e00('0x4d')],function(_0x1185f7){if(_0x3a315e){fs[_0x1e00('0x58')](_0x377b99[_0x1e00('0x4d')]);}});}}})[_0x1e00('0x45')](handleError(_0x298600,null));};exports[_0x1e00('0x23')]=function(_0x17b72f,_0x2c02ba){return db[_0x1e00('0x2a')][_0x1e00('0x47')]({'where':{'id':_0x17b72f[_0x1e00('0x46')]['id']}})[_0x1e00('0x22')](function(_0x2693f7){if(_[_0x1e00('0x62')](_0x2693f7)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2693f7;})[_0x1e00('0x22')](function(_0x24e3a3){var _0x55cbbb=_0x24e3a3['value'];logger['info'](_0x1e00('0x63'),_0x55cbbb);if(!_[_0x1e00('0x62')](_0x24e3a3[_0x1e00('0x4d')])&&fs[_0x1e00('0x52')](_0x55cbbb)){logger[_0x1e00('0x64')]('File:\x20\x22'+_0x55cbbb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1e00('0x65')](_0x55cbbb);}_0x55cbbb=_0x55cbbb+_0x1e00('0x66');if(!_[_0x1e00('0x62')](_0x24e3a3[_0x1e00('0x4d')])&&fs[_0x1e00('0x52')](_0x55cbbb)){logger[_0x1e00('0x64')](_0x1e00('0x67')+_0x55cbbb+_0x1e00('0x68'));fs['unlinkSync'](_0x55cbbb);}return _0x24e3a3;})[_0x1e00('0x22')](function(_0x23324c){if(!_0x23324c)throw new InternalError();return _0x23324c['destroy']();})[_0x1e00('0x22')](function(){_0x2c02ba[_0x1e00('0x18')](0xcc)[_0x1e00('0x24')]();})[_0x1e00('0x45')](handleError(_0x2c02ba,null));};function getBucketslist(_0x15de1a,_0x3f19d3,_0x3eadae){return new Promise(function(_0xf8253,_0x469675){var _0x5d746c=new AWS['S3']({'accessKeyId':_0x3f19d3,'secretAccessKey':_0x15de1a,'region':_0x3eadae});_0x5d746c['listBuckets']({},function(_0x27fc15,_0x4944ae){if(_0x27fc15){return _0x469675(_0x27fc15);}else{return _0xf8253(_0x4944ae);}});});}function createBucket(_0x53c498,_0x2465f5,_0x3a8f57,_0x2d3d17){return new Promise(function(_0x4f29fd,_0x14799d){var _0x331169=new AWS['S3']({'accessKeyId':_0x2465f5,'secretAccessKey':_0x53c498,'region':_0x3a8f57});_0x331169[_0x1e00('0x69')]({'Bucket':_0x2d3d17},function(_0x4dd18f,_0x3e231d){if(_0x4dd18f){return _0x14799d(_0x4dd18f);}else{return _0x4f29fd(_0x3e231d);}});});}function uploadFile(_0x442e50,_0x20a58a,_0x210433,_0x1f6fa5,_0x3c2311,_0x3ad0d){return new Promise(function(_0x43a55b,_0x145979){var _0x247df9=new AWS['S3']({'accessKeyId':_0x20a58a,'secretAccessKey':_0x442e50,'region':_0x210433});_0x247df9[_0x1e00('0x6a')]({'Bucket':_0x1f6fa5,'Key':_0x3c2311,'Body':_0x3ad0d},function(_0x4c5a1c,_0x56cef8){if(_0x4c5a1c){return _0x145979(_0x4c5a1c);}else{return _0x43a55b(_0x56cef8);}});});}function startTranscribe(_0x2149e9,_0x186763,_0x2ccfd7,_0x14dc76,_0x3bd923,_0x2cdc3b){return new Promise(function(_0x3dfc0d,_0xe01e9a){var _0x54fe34=new AWS[(_0x1e00('0x6b'))]({'accessKeyId':_0x186763,'secretAccessKey':_0x2149e9,'region':_0x2ccfd7});_0x54fe34['startTranscriptionJob']({'TranscriptionJobName':_0x14dc76,'LanguageCode':_0x3bd923,'Media':{'MediaFileUri':_0x2cdc3b}},function(_0x5df853,_0x4689df){if(_0x5df853){return _0xe01e9a(_0x5df853);}else{return _0x3dfc0d(_0x4689df);}});});}function transcribe(_0x22dc9b,_0x1a82b8,_0x4ae554,_0x506fba,_0x52a58a,_0x59c269,_0x7429d9){return new Promise(function(_0x256fe6,_0xbc58d0){var _0x232863={};logger[_0x1e00('0x64')](util[_0x1e00('0x4e')](_0x1e00('0x6c'),_0x22dc9b,_0x52a58a));return uploadFile(_0x1a82b8,_0x4ae554,_0x506fba,_0x52a58a,path[_0x1e00('0x6d')](_0x59c269),fs[_0x1e00('0x6e')](_0x59c269))[_0x1e00('0x22')](function(_0x502fe8){logger[_0x1e00('0x64')](util[_0x1e00('0x4e')](_0x1e00('0x6f'),_0x22dc9b,_0x52a58a,_0x502fe8[_0x1e00('0x70')]));_0x232863[_0x1e00('0x71')]=_0x502fe8[_0x1e00('0x72')];_0x232863[_0x1e00('0x73')]=_0x502fe8[_0x1e00('0x70')];logger[_0x1e00('0x64')](util[_0x1e00('0x4e')](_0x1e00('0x74'),_0x22dc9b));return startTranscribe(_0x1a82b8,_0x4ae554,_0x506fba,uuidv4(),_0x7429d9,_0x502fe8[_0x1e00('0x70')]);})[_0x1e00('0x22')](function(_0x3c21d0){logger[_0x1e00('0x64')](util[_0x1e00('0x4e')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x22dc9b,_0x3c21d0[_0x1e00('0x75')]['TranscriptionJobName']));_0x232863['transcribeName']=_0x3c21d0[_0x1e00('0x75')][_0x1e00('0x76')];_0x232863[_0x1e00('0x77')]=_0x3c21d0[_0x1e00('0x75')][_0x1e00('0x78')];return _0x256fe6(_0x232863);})[_0x1e00('0x45')](function(_0x4a08bf){return _0xbc58d0(_0x4a08bf);});});}exports[_0x1e00('0x79')]=function(_0x6ff769,_0x10934f,_0x235734){var _0x342065;var _0x547fd3;var _0x17e93a;var _0x1930c7=require(_0x1e00('0x5c'));return db[_0x1e00('0x2a')][_0x1e00('0x7a')]({'where':{'id':_0x6ff769[_0x1e00('0x46')]['id']}})[_0x1e00('0x22')](function(_0x56a85b){if(_0x56a85b){var _0x5349e6=util[_0x1e00('0x4e')](_0x1e00('0x61'),_0x56a85b[_0x1e00('0x4d')]);if(fs[_0x1e00('0x52')](_0x5349e6)){cypher=!![];return _0x1930c7['decryptFile'](_0x5349e6,_0x56a85b[_0x1e00('0x4d')],config[_0x1e00('0x50')][_0x1e00('0x51')])['then'](function(){return _0x56a85b;});}return _0x56a85b;}})['then'](function(_0x1460e3){if(!_0x1460e3){throw new db[(_0x1e00('0x53'))][(_0x1e00('0x54'))]('Voice\x20Recording\x20not\x20found');}_0x547fd3=_0x1460e3;return db['Setting'][_0x1e00('0x7a')]({'where':{'id':0x1}});})[_0x1e00('0x22')](handleEntityNotFound(_0x10934f,null))['then'](function(_0x2949cc){if(_0x2949cc){_0x342065=_0x2949cc;if(!_0x342065[_0x1e00('0x7b')]||!_0x342065[_0x1e00('0x7c')]||!_0x342065[_0x1e00('0x7d')]||!_0x342065[_0x1e00('0x7e')]||!_0x342065[_0x1e00('0x71')]){throw new db['Sequelize'][(_0x1e00('0x54'))](_0x1e00('0x7f'));}if(_0x6ff769[_0x1e00('0x49')]['runSentiment']&&(!_0x342065[_0x1e00('0x80')]||!_0x342065[_0x1e00('0x81')]||!_0x342065[_0x1e00('0x82')]||!_0x342065[_0x1e00('0x7e')]||!_0x342065['bucket'])){throw new db[(_0x1e00('0x53'))][(_0x1e00('0x54'))](_0x1e00('0x83'));}return db[_0x1e00('0x84')]['findOne']({'where':{'id':_0x342065[_0x1e00('0x7c')]}});}})[_0x1e00('0x22')](function(_0x3b0b6d){if(!_0x3b0b6d){throw new db['Sequelize'][(_0x1e00('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3b0b6d[_0x1e00('0x85')]||!_0x3b0b6d['data2']){throw new db[(_0x1e00('0x53'))][(_0x1e00('0x54'))](_0x1e00('0x86'));}_0x17e93a=_0x3b0b6d;return getBucketslist(_0x17e93a[_0x1e00('0x85')],_0x17e93a['data2'],_0x342065[_0x1e00('0x7d')]);})['then'](function(_0x17f896){if(_0x17f896&&_0x17f896[_0x1e00('0x87')]){var _0x44afe3=_[_0x1e00('0x47')](_0x17f896[_0x1e00('0x87')],function(_0xc1413f){return _0xc1413f[_0x1e00('0x88')]===_0x342065[_0x1e00('0x71')];});if(!_0x44afe3){logger[_0x1e00('0x64')](util[_0x1e00('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x6ff769['params']['id'],_0x342065['bucket']));return createBucket(_0x17e93a['data1'],_0x17e93a['data2'],_0x342065[_0x1e00('0x7d')],_0x342065['bucket']);}logger[_0x1e00('0x64')](util[_0x1e00('0x4e')](_0x1e00('0x89'),_0x6ff769[_0x1e00('0x46')]['id'],_0x342065[_0x1e00('0x71')]));return;}})[_0x1e00('0x22')](function(_0x113e2c){if(_0x547fd3[_0x1e00('0x77')]===_0x1e00('0x8a')){return transcribe(_0x6ff769['params']['id'],_0x17e93a[_0x1e00('0x85')],_0x17e93a[_0x1e00('0x8b')],_0x342065[_0x1e00('0x7d')],_0x342065[_0x1e00('0x71')],_0x547fd3['value'],_0x342065['language']);}else{logger[_0x1e00('0x64')](util[_0x1e00('0x4e')](_0x1e00('0x8c'),_0x6ff769['params']['id']));return{'transcribeStatus':_0x1e00('0x8d')};}})['then'](function(_0x3f21d0){if(_0x3f21d0){_0x3f21d0['tempSentiment']=_0x6ff769[_0x1e00('0x49')][_0x1e00('0x8e')];return _0x547fd3[_0x1e00('0x8f')](_0x3f21d0);}})[_0x1e00('0x22')](respondWithResult(_0x10934f,null))['catch'](handleError(_0x10934f,null));};function writeFile(_0x4e8a09,_0x3fc228){return new Promise(function(_0x5f0cbc,_0x59b75e){fs[_0x1e00('0x90')](_0x3fc228,_0x4e8a09,function(_0x2922d8,_0x555176){if(_0x2922d8){return _0x59b75e(_0x2922d8);}else{return _0x5f0cbc(_0x555176);}});});}exports[_0x1e00('0x91')]=function(_0x4ce1e3,_0x133e7c,_0xd4604a){return db[_0x1e00('0x2a')]['findOne']({'where':{'id':_0x4ce1e3[_0x1e00('0x46')]['id']}})['then'](handleEntityNotFound(_0x133e7c))[_0x1e00('0x22')](function(_0x5eef12){if(_0x5eef12&&_0x5eef12[_0x1e00('0x92')]){var _0x55aa54=_0x5eef12[_0x1e00('0x92')];var _0x3bd8ee=config[_0x1e00('0x93')]+_0x1e00('0x94')+_0x5eef12['id']+'.txt';if(fs[_0x1e00('0x52')](_0x3bd8ee)){return _0x3bd8ee;}return writeFile(_0x55aa54,_0x3bd8ee)['then'](function(){return _0x3bd8ee;});}else{throw new db[(_0x1e00('0x53'))]['ValidationError']('Transcript\x20not\x20available');}})['then'](function(_0x193f3e){return _0x133e7c[_0x1e00('0x4b')](_0x193f3e);})[_0x1e00('0x45')](handleError(_0x133e7c));}; \ No newline at end of file +var _0xa996=['includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','download','../../components/encryptor','%s.cypher','existsSync','decryptFile','recording','value','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','col','uniqueid','token','$and','push','secrets','Sequelize','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options'];(function(_0x46cd89,_0x4a23e4){var _0xb080e8=function(_0x32fc3e){while(--_0x32fc3e){_0x46cd89['push'](_0x46cd89['shift']());}};_0xb080e8(++_0x4a23e4);}(_0xa996,0xf0));var _0x6a99=function(_0x5ba6cf,_0x376c8b){_0x5ba6cf=_0x5ba6cf-0x0;var _0x56f9b0=_0xa996[_0x5ba6cf];return _0x56f9b0;};'use strict';var emlformat=require(_0x6a99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a99('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a99('0x2'));var moment=require('moment');var BPromise=require(_0x6a99('0x3'));var Mustache=require('mustache');var util=require(_0x6a99('0x4'));var path=require(_0x6a99('0x5'));var sox=require(_0x6a99('0x6'));var csv=require(_0x6a99('0x7'));var ejs=require(_0x6a99('0x8'));var fs=require('fs');var fs_extra=require(_0x6a99('0x9'));var _=require(_0x6a99('0xa'));var squel=require('squel');var crypto=require(_0x6a99('0xb'));var jsforce=require(_0x6a99('0xc'));var deskjs=require(_0x6a99('0xd'));var toCsv=require(_0x6a99('0x7'));var querystring=require(_0x6a99('0xe'));var Papa=require('papaparse');var AWS=require(_0x6a99('0xf'));var uuidv4=require(_0x6a99('0x10'));var Redis=require(_0x6a99('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6a99('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a99('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6a99('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6a99('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d423d,_0x48e705){_0x48e705=_0x48e705||0xcc;return function(_0x454169){if(_0x454169){return _0x2d423d[_0x6a99('0x16')](_0x48e705);}return _0x2d423d[_0x6a99('0x17')](_0x48e705)[_0x6a99('0x18')]();};}function respondWithResult(_0x58bf34,_0x17665f){_0x17665f=_0x17665f||0xc8;return function(_0x56ae7d){if(_0x56ae7d){return _0x58bf34['status'](_0x17665f)[_0x6a99('0x19')](_0x56ae7d);}};}function respondWithFilteredResult(_0x5eefe0,_0x4381a7){return function(_0x5ad000){if(_0x5ad000){var _0x48829f=typeof _0x4381a7[_0x6a99('0x1a')]===_0x6a99('0x1b')&&typeof _0x4381a7[_0x6a99('0x1c')]===_0x6a99('0x1b');var _0x17dc45=_0x5ad000['count'];var _0x198e1a=_0x48829f?0x0:_0x4381a7['offset'];var _0x4cf073=_0x48829f?_0x5ad000[_0x6a99('0x1d')]:_0x4381a7[_0x6a99('0x1a')]+_0x4381a7[_0x6a99('0x1c')];var _0x3c45fb;if(_0x4cf073>=_0x17dc45){_0x4cf073=_0x17dc45;_0x3c45fb=0xc8;}else{_0x3c45fb=0xce;}_0x5eefe0[_0x6a99('0x17')](_0x3c45fb);return _0x5eefe0['set'](_0x6a99('0x1e'),_0x198e1a+'-'+_0x4cf073+'/'+_0x17dc45)['json'](_0x5ad000);}return null;};}function patchUpdates(_0x2dda94){return function(_0x338d79){try{jsonpatch['apply'](_0x338d79,_0x2dda94,!![]);}catch(_0x1702c4){return BPromise[_0x6a99('0x1f')](_0x1702c4);}return _0x338d79[_0x6a99('0x20')]();};}function saveUpdates(_0x213950,_0x42afec){return function(_0x3856df){if(_0x3856df){return _0x3856df[_0x6a99('0x21')](_0x213950)[_0x6a99('0x22')](function(_0x39d66f){return _0x39d66f;});}return null;};}function removeEntity(_0x54f4d2,_0x2a1676){return function(_0x470bdf){if(_0x470bdf){return _0x470bdf['destroy']()['then'](function(){_0x54f4d2['status'](0xcc)[_0x6a99('0x18')]();});}};}function handleEntityNotFound(_0x44740d,_0x5db7c9){return function(_0x20c6b2){if(!_0x20c6b2){_0x44740d[_0x6a99('0x16')](0x194);}return _0x20c6b2;};}function handleError(_0x45d959,_0x2e8903){_0x2e8903=_0x2e8903||0x1f4;return function(_0x5b7311){logger['error'](_0x5b7311[_0x6a99('0x23')]);if(_0x5b7311[_0x6a99('0x24')]){delete _0x5b7311[_0x6a99('0x24')];}_0x45d959[_0x6a99('0x17')](_0x2e8903)[_0x6a99('0x25')](_0x5b7311);};}exports[_0x6a99('0x26')]=function(_0xc7713f,_0x5340f3){var _0x5c2be6={},_0x4f2ddc={},_0x39cd98={'count':0x0,'rows':[]};var _0x4414d4=_[_0x6a99('0x27')](db[_0x6a99('0x28')]['rawAttributes'],function(_0x49205a){return{'name':_0x49205a[_0x6a99('0x29')],'type':_0x49205a[_0x6a99('0x2a')][_0x6a99('0x2b')]};});_0x4f2ddc[_0x6a99('0x2c')]=_[_0x6a99('0x2d')](_[_0x6a99('0x27')](_0x4414d4,'name'),[_0x6a99('0x2e')]);_0x4f2ddc['query']=_[_0x6a99('0x2f')](_0xc7713f['query']);_0x4f2ddc[_0x6a99('0x30')]=_[_0x6a99('0x31')](_0x4f2ddc[_0x6a99('0x2c')],_0x4f2ddc[_0x6a99('0x32')]);_0x5c2be6['attributes']=_[_0x6a99('0x31')](_0x4f2ddc[_0x6a99('0x2c')],qs[_0x6a99('0x33')](_0xc7713f[_0x6a99('0x32')][_0x6a99('0x33')]));_0x5c2be6['attributes']=_0x5c2be6[_0x6a99('0x34')]['length']?_0x5c2be6[_0x6a99('0x34')]:_0x4f2ddc['model'];if(!_0xc7713f[_0x6a99('0x32')][_0x6a99('0x35')](_0x6a99('0x36'))){_0x5c2be6[_0x6a99('0x1c')]=qs[_0x6a99('0x1c')](_0xc7713f[_0x6a99('0x32')][_0x6a99('0x1c')]);_0x5c2be6[_0x6a99('0x1a')]=qs[_0x6a99('0x1a')](_0xc7713f[_0x6a99('0x32')]['offset']);}_0x5c2be6[_0x6a99('0x37')]=qs['sort'](_0xc7713f[_0x6a99('0x32')][_0x6a99('0x38')]);_0x5c2be6[_0x6a99('0x39')]=qs[_0x6a99('0x30')](_['pick'](_0xc7713f[_0x6a99('0x32')],_0x4f2ddc[_0x6a99('0x30')]),_0x4414d4);if(_0xc7713f['query']['filter']){_0x5c2be6[_0x6a99('0x39')]=_['merge'](_0x5c2be6[_0x6a99('0x39')],{'$or':_[_0x6a99('0x27')](_0x4414d4,function(_0x2ccceb){if(_0x2ccceb['type']!==_0x6a99('0x3a')){var _0x5eab70={};_0x5eab70[_0x2ccceb['name']]={'$like':'%'+_0xc7713f[_0x6a99('0x32')][_0x6a99('0x3b')]+'%'};return _0x5eab70;}})});}_0x5c2be6=_[_0x6a99('0x3c')]({},_0x5c2be6,_0xc7713f[_0x6a99('0x3d')]);var _0x18f35d={'where':_0x5c2be6[_0x6a99('0x39')]};return db[_0x6a99('0x28')][_0x6a99('0x1d')](_0x18f35d)[_0x6a99('0x22')](function(_0x554319){_0x39cd98[_0x6a99('0x1d')]=_0x554319;if(_0xc7713f[_0x6a99('0x32')][_0x6a99('0x3e')]){_0x5c2be6[_0x6a99('0x3f')]=[{'all':!![]}];}return db[_0x6a99('0x28')][_0x6a99('0x40')](_0x5c2be6);})[_0x6a99('0x22')](function(_0x592109){_0x39cd98['rows']=_0x592109;return _0x39cd98;})[_0x6a99('0x22')](respondWithFilteredResult(_0x5340f3,_0x5c2be6))[_0x6a99('0x41')](handleError(_0x5340f3,null));};exports[_0x6a99('0x42')]=function(_0x5a0ea9,_0xb7101d){var _0x2aee37={'raw':![],'where':{'id':_0x5a0ea9[_0x6a99('0x43')]['id']}},_0x5a4d8c={};_0x5a4d8c['model']=_['keys'](db['VoiceRecording'][_0x6a99('0x44')]);_0x5a4d8c[_0x6a99('0x32')]=_[_0x6a99('0x2f')](_0x5a0ea9['query']);_0x5a4d8c[_0x6a99('0x30')]=_['intersection'](_0x5a4d8c[_0x6a99('0x2c')],_0x5a4d8c['query']);_0x2aee37[_0x6a99('0x34')]=_[_0x6a99('0x31')](_0x5a4d8c[_0x6a99('0x2c')],qs[_0x6a99('0x33')](_0x5a0ea9[_0x6a99('0x32')][_0x6a99('0x33')]));_0x2aee37[_0x6a99('0x34')]=_0x2aee37[_0x6a99('0x34')]['length']?_0x2aee37[_0x6a99('0x34')]:_0x5a4d8c[_0x6a99('0x2c')];if(_0x5a0ea9[_0x6a99('0x32')][_0x6a99('0x3e')]){_0x2aee37[_0x6a99('0x3f')]=[{'all':!![]}];}_0x2aee37=_[_0x6a99('0x3c')]({},_0x2aee37,_0x5a0ea9['options']);return db[_0x6a99('0x28')][_0x6a99('0x45')](_0x2aee37)[_0x6a99('0x22')](handleEntityNotFound(_0xb7101d,null))[_0x6a99('0x22')](respondWithResult(_0xb7101d,null))[_0x6a99('0x41')](handleError(_0xb7101d,null));};exports[_0x6a99('0x46')]=function(_0x4a2822,_0x271d6e){return db[_0x6a99('0x28')]['create'](_0x4a2822['body'],{})['then'](respondWithResult(_0x271d6e,0xc9))[_0x6a99('0x41')](handleError(_0x271d6e,null));};exports[_0x6a99('0x21')]=function(_0x1be758,_0x27b1be){if(_0x1be758[_0x6a99('0x47')]['id']){delete _0x1be758[_0x6a99('0x47')]['id'];}return db['VoiceRecording'][_0x6a99('0x45')]({'where':{'id':_0x1be758[_0x6a99('0x43')]['id']}})[_0x6a99('0x22')](handleEntityNotFound(_0x27b1be,null))[_0x6a99('0x22')](saveUpdates(_0x1be758['body'],null))[_0x6a99('0x22')](respondWithResult(_0x27b1be,null))[_0x6a99('0x41')](handleError(_0x27b1be,null));};exports['describe']=function(_0xdbc66e,_0x3881a7){return db['VoiceRecording'][_0x6a99('0x48')]()[_0x6a99('0x22')](respondWithResult(_0x3881a7,null))[_0x6a99('0x41')](handleError(_0x3881a7,null));};exports[_0x6a99('0x49')]=function(_0x3fb261,_0x52310e,_0x1860fd){var _0x3cb70a=require(_0x6a99('0x4a'));var _0x5880f3=![];var _0x46af0a={};if(_0x3fb261[_0x6a99('0x32')]['type']&&_0x3fb261[_0x6a99('0x32')][_0x6a99('0x2a')]==='uniqueid'){_0x46af0a['uniqueid']=_0x3fb261[_0x6a99('0x43')]['id'];}else{_0x46af0a['id']=_0x3fb261['params']['id'];}return db[_0x6a99('0x28')][_0x6a99('0x45')]({'where':_0x46af0a,'attributes':['id','value'],'raw':!![]})[_0x6a99('0x22')](handleEntityNotFound(_0x52310e,null))['then'](function(_0x261da6){if(_0x261da6){var _0x548fdc=_0x261da6['value'];var _0x12c4a3=util[_0x6a99('0x2e')](_0x6a99('0x4b'),_0x548fdc);if(fs[_0x6a99('0x4c')](_0x12c4a3)){_0x5880f3=!![];return _0x3cb70a[_0x6a99('0x4d')](_0x12c4a3,_0x548fdc,config['secrets'][_0x6a99('0x4e')])[_0x6a99('0x22')](function(){return _0x261da6;});}return _0x261da6;}})['then'](function(_0xd7e0f5){if(_0xd7e0f5){var _0x4f4e26=_0xd7e0f5[_0x6a99('0x4f')];if(!fs[_0x6a99('0x4c')](_0x4f4e26)){throw new db['Sequelize'][(_0x6a99('0x50'))]('VoiceRecording\x20not\x20found');}if(_0xd7e0f5[_0x6a99('0x51')]){return _0x52310e[_0x6a99('0x49')](_0x4f4e26,_0xd7e0f5[_0x6a99('0x51')]+path[_0x6a99('0x52')](_0x4f4e26),function(){if(_0x5880f3){fs[_0x6a99('0x53')](_0x4f4e26);}});}else{return _0x52310e[_0x6a99('0x49')](_0x4f4e26,function(_0x49205d){if(_0x5880f3){fs['unlink'](_0x4f4e26);}});}}})['catch'](function(_0x2cca6a){if(_0x2cca6a[_0x6a99('0x54')]===_0x6a99('0x55')){_0x52310e[_0x6a99('0x17')](0x194)['send'](_0x6a99('0x56'));}else{return handleError(_0x52310e,null);}});};exports[_0x6a99('0x57')]=function(_0x4dca00,_0x19c453,_0x1e52d5){var _0x5b77d7=require(_0x6a99('0x4a'));var _0x312f37=![];var _0x188e90={'$and':[db[_0x6a99('0x58')][_0x6a99('0x39')](db[_0x6a99('0x58')]['fn']('MD5',db[_0x6a99('0x58')][_0x6a99('0x59')](_0x6a99('0x5a'))),_0x4dca00[_0x6a99('0x32')][_0x6a99('0x5b')])]};if(_0x4dca00[_0x6a99('0x32')][_0x6a99('0x2a')]&&_0x4dca00[_0x6a99('0x32')][_0x6a99('0x2a')]===_0x6a99('0x5a')){_0x188e90[_0x6a99('0x5c')]['push']({'uniqueid':_0x4dca00[_0x6a99('0x43')]['id']});}else{_0x188e90[_0x6a99('0x5c')][_0x6a99('0x5d')]({'id':_0x4dca00['params']['id']});}return db[_0x6a99('0x28')][_0x6a99('0x45')]({'where':_0x188e90,'attributes':['id','value'],'raw':!![]})[_0x6a99('0x22')](handleEntityNotFound(_0x19c453,null))[_0x6a99('0x22')](function(_0x4564ed){if(_0x4564ed){var _0x26378b=util['format'](_0x6a99('0x4b'),_0x4564ed[_0x6a99('0x4f')]);if(fs['existsSync'](_0x26378b)){_0x312f37=!![];return _0x5b77d7[_0x6a99('0x4d')](_0x26378b,_0x4564ed[_0x6a99('0x4f')],config[_0x6a99('0x5e')][_0x6a99('0x4e')])[_0x6a99('0x22')](function(){return _0x4564ed;});}return _0x4564ed;}})[_0x6a99('0x22')](function(_0x50c388){if(_0x50c388){if(!fs[_0x6a99('0x4c')](_0x50c388[_0x6a99('0x4f')])){throw new db[(_0x6a99('0x5f'))]['ValidationError'](_0x6a99('0x55'));}if(_0x50c388[_0x6a99('0x51')]){return _0x19c453[_0x6a99('0x49')](_0x50c388[_0x6a99('0x4f')],_0x50c388[_0x6a99('0x51')]+path[_0x6a99('0x52')](_0x50c388[_0x6a99('0x4f')]),function(){if(_0x312f37){fs['unlink'](_0x50c388[_0x6a99('0x4f')]);}});}else{return _0x19c453[_0x6a99('0x49')](_0x50c388[_0x6a99('0x4f')],function(_0x2151e4){if(_0x312f37){fs[_0x6a99('0x53')](_0x50c388[_0x6a99('0x4f')]);}});}}})[_0x6a99('0x41')](handleError(_0x19c453,null));};exports[_0x6a99('0x60')]=function(_0x840001,_0x51d134){return db[_0x6a99('0x28')][_0x6a99('0x45')]({'where':{'id':_0x840001[_0x6a99('0x43')]['id']}})[_0x6a99('0x22')](function(_0x4c5688){if(_[_0x6a99('0x61')](_0x4c5688)){throw new ReferenceError(_0x6a99('0x62'));}return _0x4c5688;})[_0x6a99('0x22')](function(_0x3afa53){var _0x5775d2=_0x3afa53[_0x6a99('0x4f')];logger[_0x6a99('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x5775d2);if(!_[_0x6a99('0x61')](_0x3afa53[_0x6a99('0x4f')])&&fs[_0x6a99('0x4c')](_0x5775d2)){logger[_0x6a99('0x63')](_0x6a99('0x64')+_0x5775d2+_0x6a99('0x65'));fs[_0x6a99('0x66')](_0x5775d2);}_0x5775d2=_0x5775d2+_0x6a99('0x67');if(!_[_0x6a99('0x61')](_0x3afa53[_0x6a99('0x4f')])&&fs[_0x6a99('0x4c')](_0x5775d2)){logger[_0x6a99('0x63')](_0x6a99('0x64')+_0x5775d2+_0x6a99('0x65'));fs[_0x6a99('0x66')](_0x5775d2);}return _0x3afa53;})['then'](function(_0x1400e7){if(!_0x1400e7)throw new InternalError();return _0x1400e7[_0x6a99('0x60')]();})[_0x6a99('0x22')](function(){_0x51d134[_0x6a99('0x17')](0xcc)[_0x6a99('0x18')]();})[_0x6a99('0x41')](handleError(_0x51d134,null));};function getBucketslist(_0x4a7434,_0x8b3d4c,_0x345f29){return new Promise(function(_0x2d24ca,_0xd6205f){var _0x5187b7=new AWS['S3']({'accessKeyId':_0x8b3d4c,'secretAccessKey':_0x4a7434,'region':_0x345f29});_0x5187b7['listBuckets']({},function(_0x520d5c,_0x39423b){if(_0x520d5c){return _0xd6205f(_0x520d5c);}else{return _0x2d24ca(_0x39423b);}});});}function createBucket(_0x1eafb2,_0x19f2cc,_0xc06b9a,_0x1ba43c){return new Promise(function(_0x57e6b2,_0x3df69a){var _0x17745f=new AWS['S3']({'accessKeyId':_0x19f2cc,'secretAccessKey':_0x1eafb2,'region':_0xc06b9a});_0x17745f[_0x6a99('0x68')]({'Bucket':_0x1ba43c},function(_0x2436d1,_0x4b0b4f){if(_0x2436d1){return _0x3df69a(_0x2436d1);}else{return _0x57e6b2(_0x4b0b4f);}});});}function uploadFile(_0x1a89e6,_0x4df63a,_0x53bc63,_0x5f68a5,_0x54fc1d,_0x54ee49){return new Promise(function(_0x415372,_0x3d1cb4){var _0x5c9be1=new AWS['S3']({'accessKeyId':_0x4df63a,'secretAccessKey':_0x1a89e6,'region':_0x53bc63});_0x5c9be1[_0x6a99('0x69')]({'Bucket':_0x5f68a5,'Key':_0x54fc1d,'Body':_0x54ee49},function(_0x3d289a,_0x321bfd){if(_0x3d289a){return _0x3d1cb4(_0x3d289a);}else{return _0x415372(_0x321bfd);}});});}function startTranscribe(_0x432255,_0x5494df,_0x56ee82,_0x1774b5,_0x4317df,_0x57d06d){return new Promise(function(_0x4a0812,_0x4e4ce7){var _0x2ac2de=new AWS[(_0x6a99('0x6a'))]({'accessKeyId':_0x5494df,'secretAccessKey':_0x432255,'region':_0x56ee82});_0x2ac2de[_0x6a99('0x6b')]({'TranscriptionJobName':_0x1774b5,'LanguageCode':_0x4317df,'Media':{'MediaFileUri':_0x57d06d}},function(_0x49dc5c,_0x363abc){if(_0x49dc5c){return _0x4e4ce7(_0x49dc5c);}else{return _0x4a0812(_0x363abc);}});});}function transcribe(_0x7ca17e,_0x25f036,_0x4ca135,_0x26e2a0,_0xf13b9a,_0x12ccc2,_0x5242cd){return new Promise(function(_0x38ebd8,_0x230229){var _0x409385={};logger[_0x6a99('0x63')](util[_0x6a99('0x2e')](_0x6a99('0x6c'),_0x7ca17e,_0xf13b9a));return uploadFile(_0x25f036,_0x4ca135,_0x26e2a0,_0xf13b9a,path[_0x6a99('0x6d')](_0x12ccc2),fs[_0x6a99('0x6e')](_0x12ccc2))[_0x6a99('0x22')](function(_0x5d7289){logger[_0x6a99('0x63')](util['format'](_0x6a99('0x6f'),_0x7ca17e,_0xf13b9a,_0x5d7289[_0x6a99('0x70')]));_0x409385[_0x6a99('0x71')]=_0x5d7289[_0x6a99('0x72')];_0x409385[_0x6a99('0x73')]=_0x5d7289[_0x6a99('0x70')];logger['info'](util[_0x6a99('0x2e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x7ca17e));return startTranscribe(_0x25f036,_0x4ca135,_0x26e2a0,uuidv4(),_0x5242cd,_0x5d7289['Location']);})[_0x6a99('0x22')](function(_0x92d2f0){logger['info'](util[_0x6a99('0x2e')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x7ca17e,_0x92d2f0[_0x6a99('0x74')][_0x6a99('0x75')]));_0x409385[_0x6a99('0x76')]=_0x92d2f0[_0x6a99('0x74')][_0x6a99('0x75')];_0x409385[_0x6a99('0x77')]=_0x92d2f0[_0x6a99('0x74')][_0x6a99('0x78')];return _0x38ebd8(_0x409385);})[_0x6a99('0x41')](function(_0x4a0877){return _0x230229(_0x4a0877);});});}exports[_0x6a99('0x79')]=function(_0x139b3e,_0x4d2e3f,_0x598950){var _0x40861a;var _0x13b2f2;var _0x3e3965;var _0x37155b=require(_0x6a99('0x4a'));return db[_0x6a99('0x28')][_0x6a99('0x7a')]({'where':{'id':_0x139b3e['params']['id']}})['then'](function(_0x273352){if(_0x273352){var _0xf6bbdc=util['format'](_0x6a99('0x4b'),_0x273352[_0x6a99('0x4f')]);if(fs[_0x6a99('0x4c')](_0xf6bbdc)){cypher=!![];return _0x37155b[_0x6a99('0x4d')](_0xf6bbdc,_0x273352['value'],config[_0x6a99('0x5e')][_0x6a99('0x4e')])[_0x6a99('0x22')](function(){return _0x273352;});}return _0x273352;}})['then'](function(_0x42d04e){if(!_0x42d04e){throw new db[(_0x6a99('0x5f'))][(_0x6a99('0x50'))](_0x6a99('0x7b'));}_0x13b2f2=_0x42d04e;return db['Setting'][_0x6a99('0x7a')]({'where':{'id':0x1}});})[_0x6a99('0x22')](handleEntityNotFound(_0x4d2e3f,null))[_0x6a99('0x22')](function(_0x583590){if(_0x583590){_0x40861a=_0x583590;if(!_0x40861a['transcribe']||!_0x40861a[_0x6a99('0x7c')]||!_0x40861a[_0x6a99('0x7d')]||!_0x40861a['language']||!_0x40861a[_0x6a99('0x71')]){throw new db['Sequelize'][(_0x6a99('0x50'))](_0x6a99('0x7e'));}if(_0x139b3e[_0x6a99('0x47')][_0x6a99('0x7f')]&&(!_0x40861a[_0x6a99('0x80')]||!_0x40861a[_0x6a99('0x81')]||!_0x40861a[_0x6a99('0x82')]||!_0x40861a['language']||!_0x40861a[_0x6a99('0x71')])){throw new db[(_0x6a99('0x5f'))]['ValidationError'](_0x6a99('0x83'));}return db[_0x6a99('0x84')][_0x6a99('0x7a')]({'where':{'id':_0x40861a[_0x6a99('0x7c')]}});}})[_0x6a99('0x22')](function(_0x2a816b){if(!_0x2a816b){throw new db[(_0x6a99('0x5f'))][(_0x6a99('0x50'))](_0x6a99('0x85'));}if(!_0x2a816b[_0x6a99('0x86')]||!_0x2a816b['data2']){throw new db['Sequelize'][(_0x6a99('0x50'))](_0x6a99('0x87'));}_0x3e3965=_0x2a816b;return getBucketslist(_0x3e3965[_0x6a99('0x86')],_0x3e3965[_0x6a99('0x88')],_0x40861a[_0x6a99('0x7d')]);})[_0x6a99('0x22')](function(_0x2fde2b){if(_0x2fde2b&&_0x2fde2b[_0x6a99('0x89')]){var _0x1eae3c=_[_0x6a99('0x45')](_0x2fde2b[_0x6a99('0x89')],function(_0x1397d8){return _0x1397d8[_0x6a99('0x8a')]===_0x40861a[_0x6a99('0x71')];});if(!_0x1eae3c){logger[_0x6a99('0x63')](util[_0x6a99('0x2e')](_0x6a99('0x8b'),_0x139b3e[_0x6a99('0x43')]['id'],_0x40861a['bucket']));return createBucket(_0x3e3965[_0x6a99('0x86')],_0x3e3965[_0x6a99('0x88')],_0x40861a['transcribeRegion'],_0x40861a[_0x6a99('0x71')]);}logger[_0x6a99('0x63')](util[_0x6a99('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x139b3e[_0x6a99('0x43')]['id'],_0x40861a[_0x6a99('0x71')]));return;}})[_0x6a99('0x22')](function(_0x54209a){if(_0x13b2f2['transcribeStatus']===_0x6a99('0x8c')){return transcribe(_0x139b3e[_0x6a99('0x43')]['id'],_0x3e3965[_0x6a99('0x86')],_0x3e3965['data2'],_0x40861a[_0x6a99('0x7d')],_0x40861a[_0x6a99('0x71')],_0x13b2f2[_0x6a99('0x4f')],_0x40861a['language']);}else{logger[_0x6a99('0x63')](util[_0x6a99('0x2e')](_0x6a99('0x8d'),_0x139b3e['params']['id']));return{'transcribeStatus':_0x6a99('0x8e')};}})[_0x6a99('0x22')](function(_0x4d0ffc){if(_0x4d0ffc){_0x4d0ffc['tempSentiment']=_0x139b3e['body'][_0x6a99('0x7f')];return _0x13b2f2[_0x6a99('0x8f')](_0x4d0ffc);}})['then'](respondWithResult(_0x4d2e3f,null))['catch'](handleError(_0x4d2e3f,null));};function writeFile(_0x40177d,_0x290782){return new Promise(function(_0xd201f,_0x25f4d4){fs[_0x6a99('0x90')](_0x290782,_0x40177d,function(_0x2af0c7,_0xe5c4f8){if(_0x2af0c7){return _0x25f4d4(_0x2af0c7);}else{return _0xd201f(_0xe5c4f8);}});});}exports[_0x6a99('0x91')]=function(_0x495642,_0x581493,_0x2f875d){return db['VoiceRecording']['findOne']({'where':{'id':_0x495642[_0x6a99('0x43')]['id']}})[_0x6a99('0x22')](handleEntityNotFound(_0x581493))['then'](function(_0x508e70){if(_0x508e70&&_0x508e70[_0x6a99('0x92')]){var _0x5acb56=_0x508e70[_0x6a99('0x92')];var _0x30455d=config[_0x6a99('0x93')]+_0x6a99('0x94')+_0x508e70['id']+_0x6a99('0x95');if(fs['existsSync'](_0x30455d)){return _0x30455d;}return writeFile(_0x5acb56,_0x30455d)[_0x6a99('0x22')](function(){return _0x30455d;});}else{throw new db[(_0x6a99('0x5f'))][(_0x6a99('0x50'))](_0x6a99('0x96'));}})['then'](function(_0x51cc3c){return _0x581493[_0x6a99('0x49')](_0x51cc3c);})[_0x6a99('0x41')](handleError(_0x581493));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6a81110..e07c9f3 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 _0xbbb8=['exports','define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x5e9b93,_0x498c04){var _0x878e5c=function(_0x11cda6){while(--_0x11cda6){_0x5e9b93['push'](_0x5e9b93['shift']());}};_0x878e5c(++_0x498c04);}(_0xbbb8,0x7d));var _0x8bbb=function(_0xfeac50,_0x2412da){_0xfeac50=_0xfeac50-0x0;var _0x149591=_0xbbb8[_0xfeac50];return _0x149591;};'use strict';var attributes=require(_0x8bbb('0x0'));module[_0x8bbb('0x1')]=function(_0x51ba1c,_0x1ff8cd){return _0x51ba1c[_0x8bbb('0x2')]('VoiceRecording',attributes,{'tableName':_0x8bbb('0x3'),'paranoid':![],'indexes':[{'name':_0x8bbb('0x4'),'fields':[_0x8bbb('0x4')]},{'name':_0x8bbb('0x5'),'fields':[_0x8bbb('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f94=['transcribeStatus','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid'];(function(_0x132963,_0x178d55){var _0x2bc7a6=function(_0x49df5c){while(--_0x49df5c){_0x132963['push'](_0x132963['shift']());}};_0x2bc7a6(++_0x178d55);}(_0x9f94,0x1e7));var _0x49f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f94[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x49f9('0x0'));module[_0x49f9('0x1')]=function(_0x2ca96a,_0x58b8d0){return _0x2ca96a['define'](_0x49f9('0x2'),attributes,{'tableName':_0x49f9('0x3'),'paranoid':![],'indexes':[{'name':_0x49f9('0x4'),'fields':[_0x49f9('0x4')]},{'name':_0x49f9('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 65be803..9287b4f 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 _0x32b6=['jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x32b6,0x1d1));var _0x632b=function(_0x3fa405,_0x39b1fd){_0x3fa405=_0x3fa405-0x0;var _0x1c06ff=_0x32b6[_0x3fa405];return _0x1c06ff;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['where']||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['attributes']||null:null,'limit':_0x3bb27f[_0x632b('0x19')]?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1b')]||null:null})['then'](function(_0x10fc32){logger[_0x632b('0x14')]('UpdateVoiceRecording',_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON[_0x632b('0xf')](_0x10fc32));_0x51c894(_0x10fc32);})[_0x632b('0x1c')](function(_0x45d017){logger[_0x632b('0x10')]('UpdateVoiceRecording',_0x45d017['message'],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x45d017['message']));});});};exports[_0x632b('0x1d')]=function(_0x954fa0){var _0x5d6855=this;return new Promise(function(_0x273e89,_0x3f4eab){var _0x29d9aa=require(_0x632b('0x1e'));var _0x4728a8;return db[_0x632b('0x1f')][_0x632b('0x20')]({'attributes':['id',_0x632b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x632b('0xc')](function(_0x4f8410){_0x4728a8=_0x4f8410;return db[_0x632b('0x16')][_0x632b('0x22')](_0x954fa0[_0x632b('0x18')]);})[_0x632b('0xc')](function(_0x17a5ba){if(_0x4728a8[_0x632b('0x21')]&&fs[_0x632b('0x23')](_0x17a5ba[_0x632b('0x24')])){var _0x1ace1b=util[_0x632b('0x25')](_0x632b('0x26'),_0x17a5ba[_0x632b('0x24')]);return _0x29d9aa[_0x632b('0x27')](_0x17a5ba[_0x632b('0x24')],_0x1ace1b,config[_0x632b('0x28')][_0x632b('0x29')])[_0x632b('0xc')](function(){fs[_0x632b('0x2a')](_0x17a5ba[_0x632b('0x24')]);logger[_0x632b('0x14')]('CreateVoiceRecording\x20file\x20encrypted');return _0x17a5ba;});}return _0x17a5ba;})[_0x632b('0xc')](function(_0x4401dc){logger[_0x632b('0x14')](_0x632b('0x1d'),_0x954fa0);logger['debug'](_0x632b('0x1d'),_0x954fa0,JSON['stringify'](_0x4401dc));_0x273e89(_0x4401dc);})[_0x632b('0x1c')](function(_0x15b22d){logger['error'](_0x632b('0x1d'),_0x15b22d[_0x632b('0x13')],_0x954fa0);_0x3f4eab(_0x5d6855[_0x632b('0x10')](0x1f4,_0x15b22d[_0x632b('0x13')]));});});}; \ No newline at end of file +var _0xd824=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','then','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x25d7c4,_0x2721ef){var _0xca9877=function(_0x24a5dd){while(--_0x24a5dd){_0x25d7c4['push'](_0x25d7c4['shift']());}};_0xca9877(++_0x2721ef);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x18')]||null:null,'attributes':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['limit']||null:null})[_0x4d82('0x19')](function(_0x41f194){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1a')](_0x4d82('0x12'),_0x258c59,JSON[_0x4d82('0xe')](_0x41f194));_0x2f2127(_0x41f194);})[_0x4d82('0x11')](function(_0x12feab){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x12feab[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x12feab[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1b')]=function(_0x4af6da){var _0x5e0b03=this;return new Promise(function(_0x3dcb0f,_0x2548de){var _0x2a0572=require(_0x4d82('0x1c'));var _0x5cbd7e;return db[_0x4d82('0x1d')][_0x4d82('0x1e')]({'attributes':['id',_0x4d82('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x4d82('0x19')](function(_0x5ce98b){_0x5cbd7e=_0x5ce98b;return db[_0x4d82('0x13')]['create'](_0x4af6da['body']);})['then'](function(_0x52533b){if(_0x5cbd7e[_0x4d82('0x1f')]&&fs[_0x4d82('0x20')](_0x52533b[_0x4d82('0x21')])){var _0x52e320=util[_0x4d82('0x22')](_0x4d82('0x23'),_0x52533b['value']);return _0x2a0572['encryptFile'](_0x52533b[_0x4d82('0x21')],_0x52e320,config[_0x4d82('0x24')][_0x4d82('0x25')])[_0x4d82('0x19')](function(){fs['unlink'](_0x52533b[_0x4d82('0x21')]);logger['info'](_0x4d82('0x26'));return _0x52533b;});}return _0x52533b;})[_0x4d82('0x19')](function(_0x4a2a45){logger['info'](_0x4d82('0x1b'),_0x4af6da);logger[_0x4d82('0x1a')](_0x4d82('0x1b'),_0x4af6da,JSON[_0x4d82('0xe')](_0x4a2a45));_0x3dcb0f(_0x4a2a45);})[_0x4d82('0x11')](function(_0x420b28){logger[_0x4d82('0xf')](_0x4d82('0x1b'),_0x420b28[_0x4d82('0x10')],_0x4af6da);_0x2548de(_0x5e0b03[_0x4d82('0xf')](0x1f4,_0x420b28['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8cf8b40..5639448 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 _0x84a2=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','post','create'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x84a2,0x16c));var _0x284a=function(_0x5ea60d,_0xf1b6f3){_0x5ea60d=_0x5ea60d-0x0;var _0x1d14eb=_0x84a2[_0x5ea60d];return _0x1d14eb;};'use strict';var multer=require(_0x284a('0x0'));var util=require(_0x284a('0x1'));var path=require(_0x284a('0x2'));var timeout=require(_0x284a('0x3'));var express=require('express');var router=express[_0x284a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x284a('0x5'));var interaction=require(_0x284a('0x6'));var config=require(_0x284a('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x284a('0x8')]('/',auth[_0x284a('0x9')](),controller['index']);router[_0x284a('0x8')]('/describe',auth[_0x284a('0x9')](),controller[_0x284a('0xa')]);router['get'](_0x284a('0xb'),auth[_0x284a('0x9')](),controller['show']);router[_0x284a('0xc')]('/',auth[_0x284a('0x9')](),controller[_0x284a('0xd')]);router[_0x284a('0xe')](_0x284a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x284a('0xf')]('/:id',auth[_0x284a('0x9')](),controller[_0x284a('0x10')]);module[_0x284a('0x11')]=router; \ No newline at end of file +var _0x3de9=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x3de9,0x15d));var _0x93de=function(_0x317e94,_0x1c5f3f){_0x317e94=_0x317e94-0x0;var _0x1b6f5f=_0x3de9[_0x317e94];return _0x1b6f5f;};'use strict';var multer=require(_0x93de('0x0'));var util=require(_0x93de('0x1'));var path=require('path');var timeout=require(_0x93de('0x2'));var express=require('express');var router=express[_0x93de('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x93de('0x4'));var interaction=require(_0x93de('0x5'));var config=require(_0x93de('0x6'));var controller=require(_0x93de('0x7'));router[_0x93de('0x8')]('/',auth[_0x93de('0x9')](),controller[_0x93de('0xa')]);router[_0x93de('0x8')](_0x93de('0xb'),auth[_0x93de('0x9')](),controller[_0x93de('0xc')]);router['get'](_0x93de('0xd'),auth['isAuthenticated'](),controller[_0x93de('0xe')]);router[_0x93de('0xf')]('/',auth[_0x93de('0x9')](),controller[_0x93de('0x10')]);router[_0x93de('0x11')](_0x93de('0xd'),auth[_0x93de('0x9')](),controller[_0x93de('0x12')]);router[_0x93de('0x13')](_0x93de('0xd'),auth[_0x93de('0x9')](),controller[_0x93de('0x14')]);module[_0x93de('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 3662990..dcfe2e8 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 _0xfdb1=['attended','STRING','sequelize','moment','exports','ENUM','blind'];(function(_0x3bd84b,_0x165ede){var _0x44465e=function(_0x9fabbe){while(--_0x9fabbe){_0x3bd84b['push'](_0x3bd84b['shift']());}};_0x44465e(++_0x165ede);}(_0xfdb1,0x1bb));var _0x1fdb=function(_0x4d36cf,_0x3825ac){_0x4d36cf=_0x4d36cf-0x0;var _0x44c2b0=_0xfdb1[_0x4d36cf];return _0x44c2b0;};'use strict';var Sequelize=require(_0x1fdb('0x0'));var moment=require(_0x1fdb('0x1'));module[_0x1fdb('0x2')]={'type':{'type':Sequelize[_0x1fdb('0x3')](_0x1fdb('0x4'),_0x1fdb('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x1fdb('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x1fdb('0x6')]},'transferercalleridname':{'type':Sequelize[_0x1fdb('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x1fdb('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x1fdb('0x6')]},'transferercontext':{'type':Sequelize[_0x1fdb('0x6')]},'transfererexten':{'type':Sequelize[_0x1fdb('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1fdb('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x1fdb('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1fdb('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x1fdb('0x6')]},'transfereecontext':{'type':Sequelize[_0x1fdb('0x6')]},'transfereeexten':{'type':Sequelize[_0x1fdb('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x1fdb('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x1fdb('0x6')]},'extension':{'type':Sequelize[_0x1fdb('0x6')]}}; \ No newline at end of file +var _0xaea2=['ENUM','blind','STRING','Yes','sequelize','moment','exports'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0xaea2,0x1a8));var _0x2aea=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xaea2[_0x79ebc5];return _0x3813b6;};'use strict';var Sequelize=require(_0x2aea('0x0'));var moment=require(_0x2aea('0x1'));module[_0x2aea('0x2')]={'type':{'type':Sequelize[_0x2aea('0x3')](_0x2aea('0x4'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x2aea('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x2aea('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x2aea('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x2aea('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x2aea('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x2aea('0x5')]},'transfereechannel':{'type':Sequelize[_0x2aea('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x2aea('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x2aea('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2aea('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x2aea('0x5')]},'transfereecontext':{'type':Sequelize[_0x2aea('0x5')]},'transfereeexten':{'type':Sequelize[_0x2aea('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x2aea('0x5')]},'isexternal':{'type':Sequelize[_0x2aea('0x3')](_0x2aea('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x2aea('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index fd1619e..a9f67e1 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 _0xc56f=['../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','VoiceTransferReport','findAll','rows','show','params','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xc323b5,_0x54d7cf){var _0x499a00=function(_0x5326a7){while(--_0x5326a7){_0xc323b5['push'](_0xc323b5['shift']());}};_0x499a00(++_0x54d7cf);}(_0xc56f,0x1af));var _0xfc56=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc56f[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0xfc56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc56('0x1'));var jsonpatch=require(_0xfc56('0x2'));var rp=require(_0xfc56('0x3'));var moment=require(_0xfc56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc56('0x5'));var util=require('util');var path=require(_0xfc56('0x6'));var sox=require(_0xfc56('0x7'));var csv=require(_0xfc56('0x8'));var ejs=require(_0xfc56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc56('0xa'));var crypto=require(_0xfc56('0xb'));var jsforce=require(_0xfc56('0xc'));var deskjs=require(_0xfc56('0xd'));var toCsv=require(_0xfc56('0x8'));var querystring=require(_0xfc56('0xe'));var Papa=require(_0xfc56('0xf'));var Redis=require(_0xfc56('0x10'));var authService=require(_0xfc56('0x11'));var qs=require(_0xfc56('0x12'));var as=require(_0xfc56('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfc56('0x14'));var config=require(_0xfc56('0x15'));var licenseUtil=require(_0xfc56('0x16'));var db=require(_0xfc56('0x17'))['db'];function respondWithStatusCode(_0x4f1cef,_0x504a45){_0x504a45=_0x504a45||0xcc;return function(_0x2c84d8){if(_0x2c84d8){return _0x4f1cef['sendStatus'](_0x504a45);}return _0x4f1cef[_0xfc56('0x18')](_0x504a45)[_0xfc56('0x19')]();};}function respondWithResult(_0x16b623,_0x512f37){_0x512f37=_0x512f37||0xc8;return function(_0x788e0c){if(_0x788e0c){return _0x16b623[_0xfc56('0x18')](_0x512f37)[_0xfc56('0x1a')](_0x788e0c);}};}function respondWithFilteredResult(_0x295f5a,_0xa329ab){return function(_0x1c8231){if(_0x1c8231){var _0x1456c4=typeof _0xa329ab['offset']===_0xfc56('0x1b')&&typeof _0xa329ab[_0xfc56('0x1c')]===_0xfc56('0x1b');var _0x310fba=_0x1c8231[_0xfc56('0x1d')];var _0x4a1cda=_0x1456c4?0x0:_0xa329ab[_0xfc56('0x1e')];var _0x2e1cb7=_0x1456c4?_0x1c8231['count']:_0xa329ab[_0xfc56('0x1e')]+_0xa329ab[_0xfc56('0x1c')];var _0x1b86ec;if(_0x2e1cb7>=_0x310fba){_0x2e1cb7=_0x310fba;_0x1b86ec=0xc8;}else{_0x1b86ec=0xce;}_0x295f5a['status'](_0x1b86ec);return _0x295f5a[_0xfc56('0x1f')](_0xfc56('0x20'),_0x4a1cda+'-'+_0x2e1cb7+'/'+_0x310fba)['json'](_0x1c8231);}return null;};}function patchUpdates(_0x34f086){return function(_0x556ce9){try{jsonpatch[_0xfc56('0x21')](_0x556ce9,_0x34f086,!![]);}catch(_0x3b6cbc){return BPromise['reject'](_0x3b6cbc);}return _0x556ce9[_0xfc56('0x22')]();};}function saveUpdates(_0x37aac4,_0x257ad6){return function(_0x31307c){if(_0x31307c){return _0x31307c[_0xfc56('0x23')](_0x37aac4)[_0xfc56('0x24')](function(_0xe87e9){return _0xe87e9;});}return null;};}function removeEntity(_0x1f8a49,_0x20c207){return function(_0x102d80){if(_0x102d80){return _0x102d80[_0xfc56('0x25')]()[_0xfc56('0x24')](function(){_0x1f8a49[_0xfc56('0x18')](0xcc)[_0xfc56('0x19')]();});}};}function handleEntityNotFound(_0x4a134a,_0x25df4d){return function(_0x13a7c5){if(!_0x13a7c5){_0x4a134a['sendStatus'](0x194);}return _0x13a7c5;};}function handleError(_0xb92642,_0x40a177){_0x40a177=_0x40a177||0x1f4;return function(_0xc151bf){logger[_0xfc56('0x26')](_0xc151bf['stack']);if(_0xc151bf['name']){delete _0xc151bf[_0xfc56('0x27')];}_0xb92642[_0xfc56('0x18')](_0x40a177)['send'](_0xc151bf);};}exports[_0xfc56('0x28')]=function(_0x3b3f01,_0x1af822){var _0x25d2b9={},_0x39edbf={},_0x5dae1a={'count':0x0,'rows':[]};var _0x5b378c=_[_0xfc56('0x29')](db['VoiceTransferReport'][_0xfc56('0x2a')],function(_0x5381b7){return{'name':_0x5381b7[_0xfc56('0x2b')],'type':_0x5381b7['type'][_0xfc56('0x2c')]};});_0x39edbf['model']=_['map'](_0x5b378c,_0xfc56('0x27'));_0x39edbf[_0xfc56('0x2d')]=_[_0xfc56('0x2e')](_0x3b3f01[_0xfc56('0x2d')]);_0x39edbf[_0xfc56('0x2f')]=_[_0xfc56('0x30')](_0x39edbf[_0xfc56('0x31')],_0x39edbf['query']);_0x25d2b9['attributes']=_[_0xfc56('0x30')](_0x39edbf[_0xfc56('0x31')],qs[_0xfc56('0x32')](_0x3b3f01[_0xfc56('0x2d')][_0xfc56('0x32')]));_0x25d2b9[_0xfc56('0x33')]=_0x25d2b9[_0xfc56('0x33')][_0xfc56('0x34')]?_0x25d2b9[_0xfc56('0x33')]:_0x39edbf[_0xfc56('0x31')];if(!_0x3b3f01[_0xfc56('0x2d')][_0xfc56('0x35')](_0xfc56('0x36'))){_0x25d2b9['limit']=qs[_0xfc56('0x1c')](_0x3b3f01[_0xfc56('0x2d')][_0xfc56('0x1c')]);_0x25d2b9[_0xfc56('0x1e')]=qs[_0xfc56('0x1e')](_0x3b3f01[_0xfc56('0x2d')][_0xfc56('0x1e')]);}_0x25d2b9[_0xfc56('0x37')]=qs['sort'](_0x3b3f01['query'][_0xfc56('0x38')]);_0x25d2b9[_0xfc56('0x39')]=qs[_0xfc56('0x2f')](_['pick'](_0x3b3f01[_0xfc56('0x2d')],_0x39edbf['filters']),_0x5b378c);if(_0x3b3f01[_0xfc56('0x2d')][_0xfc56('0x3a')]){_0x25d2b9[_0xfc56('0x39')]=_[_0xfc56('0x3b')](_0x25d2b9[_0xfc56('0x39')],{'$or':_[_0xfc56('0x29')](_0x5b378c,function(_0x49ea89){if(_0x49ea89[_0xfc56('0x3c')]!==_0xfc56('0x3d')){var _0x364d52={};_0x364d52[_0x49ea89['name']]={'$like':'%'+_0x3b3f01[_0xfc56('0x2d')]['filter']+'%'};return _0x364d52;}})});}_0x25d2b9=_['merge']({},_0x25d2b9,_0x3b3f01[_0xfc56('0x3e')]);var _0x212e45={'where':_0x25d2b9[_0xfc56('0x39')]};return db['VoiceTransferReport'][_0xfc56('0x1d')](_0x212e45)[_0xfc56('0x24')](function(_0x2c4794){_0x5dae1a['count']=_0x2c4794;if(_0x3b3f01['query'][_0xfc56('0x3f')]){_0x25d2b9[_0xfc56('0x40')]=[{'all':!![]}];}return db[_0xfc56('0x41')][_0xfc56('0x42')](_0x25d2b9);})['then'](function(_0x35b8c7){_0x5dae1a[_0xfc56('0x43')]=_0x35b8c7;return _0x5dae1a;})[_0xfc56('0x24')](respondWithFilteredResult(_0x1af822,_0x25d2b9))['catch'](handleError(_0x1af822,null));};exports[_0xfc56('0x44')]=function(_0xaddd8d,_0x4e2772){var _0x9feac8={'raw':!![],'where':{'id':_0xaddd8d[_0xfc56('0x45')]['id']}},_0x2f1a6f={};_0x2f1a6f['model']=_[_0xfc56('0x2e')](db[_0xfc56('0x41')][_0xfc56('0x2a')]);_0x2f1a6f['query']=_[_0xfc56('0x2e')](_0xaddd8d[_0xfc56('0x2d')]);_0x2f1a6f[_0xfc56('0x2f')]=_['intersection'](_0x2f1a6f[_0xfc56('0x31')],_0x2f1a6f[_0xfc56('0x2d')]);_0x9feac8[_0xfc56('0x33')]=_['intersection'](_0x2f1a6f[_0xfc56('0x31')],qs[_0xfc56('0x32')](_0xaddd8d['query'][_0xfc56('0x32')]));_0x9feac8['attributes']=_0x9feac8[_0xfc56('0x33')][_0xfc56('0x34')]?_0x9feac8[_0xfc56('0x33')]:_0x2f1a6f[_0xfc56('0x31')];if(_0xaddd8d[_0xfc56('0x2d')][_0xfc56('0x3f')]){_0x9feac8[_0xfc56('0x40')]=[{'all':!![]}];}_0x9feac8=_[_0xfc56('0x3b')]({},_0x9feac8,_0xaddd8d[_0xfc56('0x3e')]);return db[_0xfc56('0x41')][_0xfc56('0x46')](_0x9feac8)['then'](handleEntityNotFound(_0x4e2772,null))[_0xfc56('0x24')](respondWithResult(_0x4e2772,null))['catch'](handleError(_0x4e2772,null));};exports['create']=function(_0x583b38,_0x39d4c9){return db[_0xfc56('0x41')][_0xfc56('0x47')](_0x583b38[_0xfc56('0x48')],{})[_0xfc56('0x24')](respondWithResult(_0x39d4c9,0xc9))['catch'](handleError(_0x39d4c9,null));};exports[_0xfc56('0x23')]=function(_0x4e9ddb,_0x1b3eda){if(_0x4e9ddb['body']['id']){delete _0x4e9ddb['body']['id'];}return db[_0xfc56('0x41')][_0xfc56('0x46')]({'where':{'id':_0x4e9ddb[_0xfc56('0x45')]['id']}})[_0xfc56('0x24')](handleEntityNotFound(_0x1b3eda,null))[_0xfc56('0x24')](saveUpdates(_0x4e9ddb[_0xfc56('0x48')],null))[_0xfc56('0x24')](respondWithResult(_0x1b3eda,null))[_0xfc56('0x49')](handleError(_0x1b3eda,null));};exports['destroy']=function(_0x57e58f,_0x51b8e3){return db[_0xfc56('0x41')][_0xfc56('0x46')]({'where':{'id':_0x57e58f[_0xfc56('0x45')]['id']}})[_0xfc56('0x24')](handleEntityNotFound(_0x51b8e3,null))[_0xfc56('0x24')](removeEntity(_0x51b8e3,null))[_0xfc56('0x49')](handleError(_0x51b8e3,null));};exports['describe']=function(_0x13bc0a,_0x2e2f4d){return db[_0xfc56('0x41')][_0xfc56('0x4a')]()[_0xfc56('0x24')](respondWithResult(_0x2e2f4d,null))[_0xfc56('0x49')](handleError(_0x2e2f4d,null));}; \ No newline at end of file +var _0x9e13=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','zip-dir','request-promise'];(function(_0x3b95b2,_0x4de676){var _0x58090f=function(_0x6abb3a){while(--_0x6abb3a){_0x3b95b2['push'](_0x3b95b2['shift']());}};_0x58090f(++_0x4de676);}(_0x9e13,0x141));var _0x39e1=function(_0x47cef2,_0x239383){_0x47cef2=_0x47cef2-0x0;var _0x32be9a=_0x9e13[_0x47cef2];return _0x32be9a;};'use strict';var emlformat=require(_0x39e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x39e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39e1('0x2'));var moment=require(_0x39e1('0x3'));var BPromise=require(_0x39e1('0x4'));var Mustache=require(_0x39e1('0x5'));var util=require(_0x39e1('0x6'));var path=require(_0x39e1('0x7'));var sox=require(_0x39e1('0x8'));var csv=require(_0x39e1('0x9'));var ejs=require(_0x39e1('0xa'));var fs=require('fs');var fs_extra=require(_0x39e1('0xb'));var _=require(_0x39e1('0xc'));var squel=require(_0x39e1('0xd'));var crypto=require(_0x39e1('0xe'));var jsforce=require(_0x39e1('0xf'));var deskjs=require(_0x39e1('0x10'));var toCsv=require(_0x39e1('0x9'));var querystring=require('querystring');var Papa=require(_0x39e1('0x11'));var Redis=require(_0x39e1('0x12'));var authService=require(_0x39e1('0x13'));var qs=require(_0x39e1('0x14'));var as=require(_0x39e1('0x15'));var hardwareService=require(_0x39e1('0x16'));var logger=require(_0x39e1('0x17'))(_0x39e1('0x18'));var utils=require('../../config/utils');var config=require(_0x39e1('0x19'));var licenseUtil=require(_0x39e1('0x1a'));var db=require(_0x39e1('0x1b'))['db'];function respondWithStatusCode(_0x347b7f,_0x12a76a){_0x12a76a=_0x12a76a||0xcc;return function(_0x4f9329){if(_0x4f9329){return _0x347b7f[_0x39e1('0x1c')](_0x12a76a);}return _0x347b7f[_0x39e1('0x1d')](_0x12a76a)[_0x39e1('0x1e')]();};}function respondWithResult(_0x4153b7,_0x3e248c){_0x3e248c=_0x3e248c||0xc8;return function(_0x139944){if(_0x139944){return _0x4153b7[_0x39e1('0x1d')](_0x3e248c)['json'](_0x139944);}};}function respondWithFilteredResult(_0x5abb6d,_0x4d0308){return function(_0x24d751){if(_0x24d751){var _0x41cb2d=typeof _0x4d0308['offset']===_0x39e1('0x1f')&&typeof _0x4d0308[_0x39e1('0x20')]===_0x39e1('0x1f');var _0x1eea6f=_0x24d751[_0x39e1('0x21')];var _0x101218=_0x41cb2d?0x0:_0x4d0308[_0x39e1('0x22')];var _0x559ece=_0x41cb2d?_0x24d751[_0x39e1('0x21')]:_0x4d0308[_0x39e1('0x22')]+_0x4d0308['limit'];var _0x352747;if(_0x559ece>=_0x1eea6f){_0x559ece=_0x1eea6f;_0x352747=0xc8;}else{_0x352747=0xce;}_0x5abb6d[_0x39e1('0x1d')](_0x352747);return _0x5abb6d[_0x39e1('0x23')](_0x39e1('0x24'),_0x101218+'-'+_0x559ece+'/'+_0x1eea6f)[_0x39e1('0x25')](_0x24d751);}return null;};}function patchUpdates(_0x350361){return function(_0x238fcf){try{jsonpatch[_0x39e1('0x26')](_0x238fcf,_0x350361,!![]);}catch(_0x17eb8e){return BPromise[_0x39e1('0x27')](_0x17eb8e);}return _0x238fcf['save']();};}function saveUpdates(_0x152656,_0x2ffa7f){return function(_0x342ba3){if(_0x342ba3){return _0x342ba3[_0x39e1('0x28')](_0x152656)['then'](function(_0x4b77f9){return _0x4b77f9;});}return null;};}function removeEntity(_0x45c4ff,_0x698840){return function(_0x56cb6e){if(_0x56cb6e){return _0x56cb6e[_0x39e1('0x29')]()[_0x39e1('0x2a')](function(){_0x45c4ff[_0x39e1('0x1d')](0xcc)[_0x39e1('0x1e')]();});}};}function handleEntityNotFound(_0xcb2d24,_0x4260a0){return function(_0x1c8fb5){if(!_0x1c8fb5){_0xcb2d24[_0x39e1('0x1c')](0x194);}return _0x1c8fb5;};}function handleError(_0x2e5396,_0x47788f){_0x47788f=_0x47788f||0x1f4;return function(_0xf62583){logger[_0x39e1('0x2b')](_0xf62583[_0x39e1('0x2c')]);if(_0xf62583[_0x39e1('0x2d')]){delete _0xf62583[_0x39e1('0x2d')];}_0x2e5396['status'](_0x47788f)[_0x39e1('0x2e')](_0xf62583);};}exports[_0x39e1('0x2f')]=function(_0x51a264,_0x20cf28){var _0x55bda5={},_0x2c5274={},_0x3addfc={'count':0x0,'rows':[]};var _0x426531=_[_0x39e1('0x30')](db[_0x39e1('0x31')][_0x39e1('0x32')],function(_0x2a055c){return{'name':_0x2a055c[_0x39e1('0x33')],'type':_0x2a055c['type'][_0x39e1('0x34')]};});_0x2c5274[_0x39e1('0x35')]=_[_0x39e1('0x30')](_0x426531,_0x39e1('0x2d'));_0x2c5274['query']=_[_0x39e1('0x36')](_0x51a264[_0x39e1('0x37')]);_0x2c5274[_0x39e1('0x38')]=_['intersection'](_0x2c5274[_0x39e1('0x35')],_0x2c5274[_0x39e1('0x37')]);_0x55bda5['attributes']=_[_0x39e1('0x39')](_0x2c5274[_0x39e1('0x35')],qs[_0x39e1('0x3a')](_0x51a264['query']['fields']));_0x55bda5['attributes']=_0x55bda5['attributes'][_0x39e1('0x3b')]?_0x55bda5[_0x39e1('0x3c')]:_0x2c5274[_0x39e1('0x35')];if(!_0x51a264[_0x39e1('0x37')][_0x39e1('0x3d')](_0x39e1('0x3e'))){_0x55bda5['limit']=qs[_0x39e1('0x20')](_0x51a264[_0x39e1('0x37')][_0x39e1('0x20')]);_0x55bda5[_0x39e1('0x22')]=qs[_0x39e1('0x22')](_0x51a264[_0x39e1('0x37')][_0x39e1('0x22')]);}_0x55bda5[_0x39e1('0x3f')]=qs[_0x39e1('0x40')](_0x51a264[_0x39e1('0x37')][_0x39e1('0x40')]);_0x55bda5[_0x39e1('0x41')]=qs[_0x39e1('0x38')](_[_0x39e1('0x42')](_0x51a264['query'],_0x2c5274[_0x39e1('0x38')]),_0x426531);if(_0x51a264[_0x39e1('0x37')][_0x39e1('0x43')]){_0x55bda5[_0x39e1('0x41')]=_[_0x39e1('0x44')](_0x55bda5[_0x39e1('0x41')],{'$or':_[_0x39e1('0x30')](_0x426531,function(_0xb52a43){if(_0xb52a43[_0x39e1('0x45')]!=='VIRTUAL'){var _0xd140f1={};_0xd140f1[_0xb52a43[_0x39e1('0x2d')]]={'$like':'%'+_0x51a264[_0x39e1('0x37')]['filter']+'%'};return _0xd140f1;}})});}_0x55bda5=_[_0x39e1('0x44')]({},_0x55bda5,_0x51a264[_0x39e1('0x46')]);var _0x90b122={'where':_0x55bda5[_0x39e1('0x41')]};return db[_0x39e1('0x31')][_0x39e1('0x21')](_0x90b122)['then'](function(_0x38be9d){_0x3addfc[_0x39e1('0x21')]=_0x38be9d;if(_0x51a264[_0x39e1('0x37')][_0x39e1('0x47')]){_0x55bda5[_0x39e1('0x48')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x39e1('0x49')](_0x55bda5);})['then'](function(_0x4f2eb3){_0x3addfc['rows']=_0x4f2eb3;return _0x3addfc;})['then'](respondWithFilteredResult(_0x20cf28,_0x55bda5))[_0x39e1('0x4a')](handleError(_0x20cf28,null));};exports[_0x39e1('0x4b')]=function(_0x7428b1,_0x2c7f04){var _0x4b14b5={'raw':!![],'where':{'id':_0x7428b1['params']['id']}},_0x585a49={};_0x585a49[_0x39e1('0x35')]=_['keys'](db[_0x39e1('0x31')][_0x39e1('0x32')]);_0x585a49[_0x39e1('0x37')]=_[_0x39e1('0x36')](_0x7428b1['query']);_0x585a49[_0x39e1('0x38')]=_[_0x39e1('0x39')](_0x585a49['model'],_0x585a49['query']);_0x4b14b5[_0x39e1('0x3c')]=_[_0x39e1('0x39')](_0x585a49['model'],qs[_0x39e1('0x3a')](_0x7428b1[_0x39e1('0x37')][_0x39e1('0x3a')]));_0x4b14b5[_0x39e1('0x3c')]=_0x4b14b5['attributes'][_0x39e1('0x3b')]?_0x4b14b5['attributes']:_0x585a49[_0x39e1('0x35')];if(_0x7428b1[_0x39e1('0x37')]['includeAll']){_0x4b14b5['include']=[{'all':!![]}];}_0x4b14b5=_[_0x39e1('0x44')]({},_0x4b14b5,_0x7428b1['options']);return db[_0x39e1('0x31')][_0x39e1('0x4c')](_0x4b14b5)[_0x39e1('0x2a')](handleEntityNotFound(_0x2c7f04,null))[_0x39e1('0x2a')](respondWithResult(_0x2c7f04,null))['catch'](handleError(_0x2c7f04,null));};exports[_0x39e1('0x4d')]=function(_0x24ce5b,_0x5ec0fd){return db['VoiceTransferReport'][_0x39e1('0x4d')](_0x24ce5b[_0x39e1('0x4e')],{})['then'](respondWithResult(_0x5ec0fd,0xc9))[_0x39e1('0x4a')](handleError(_0x5ec0fd,null));};exports['update']=function(_0x41bbf4,_0x475f35){if(_0x41bbf4[_0x39e1('0x4e')]['id']){delete _0x41bbf4[_0x39e1('0x4e')]['id'];}return db[_0x39e1('0x31')][_0x39e1('0x4c')]({'where':{'id':_0x41bbf4['params']['id']}})[_0x39e1('0x2a')](handleEntityNotFound(_0x475f35,null))[_0x39e1('0x2a')](saveUpdates(_0x41bbf4[_0x39e1('0x4e')],null))[_0x39e1('0x2a')](respondWithResult(_0x475f35,null))[_0x39e1('0x4a')](handleError(_0x475f35,null));};exports['destroy']=function(_0x122af8,_0x162d72){return db[_0x39e1('0x31')][_0x39e1('0x4c')]({'where':{'id':_0x122af8[_0x39e1('0x4f')]['id']}})[_0x39e1('0x2a')](handleEntityNotFound(_0x162d72,null))[_0x39e1('0x2a')](removeEntity(_0x162d72,null))[_0x39e1('0x4a')](handleError(_0x162d72,null));};exports[_0x39e1('0x50')]=function(_0x2623d5,_0x2fe3d3){return db[_0x39e1('0x31')][_0x39e1('0x50')]()[_0x39e1('0x2a')](respondWithResult(_0x2fe3d3,null))['catch'](handleError(_0x2fe3d3,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 96bcc07..a691765 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 _0x5094=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x59e1c3,_0x1e1423){var _0x28561e=function(_0x8dd74a){while(--_0x8dd74a){_0x59e1c3['push'](_0x59e1c3['shift']());}};_0x28561e(++_0x1e1423);}(_0x5094,0x198));var _0x4509=function(_0x573eae,_0x5f103f){_0x573eae=_0x573eae-0x0;var _0x2be09c=_0x5094[_0x573eae];return _0x2be09c;};'use strict';var _=require(_0x4509('0x0'));var util=require(_0x4509('0x1'));var logger=require(_0x4509('0x2'))('api');var moment=require(_0x4509('0x3'));var BPromise=require(_0x4509('0x4'));var rp=require(_0x4509('0x5'));var fs=require('fs');var path=require(_0x4509('0x6'));var rimraf=require(_0x4509('0x7'));var config=require(_0x4509('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0x4509('0x9')]=function(_0x3ba783,_0x56e864){return _0x3ba783[_0x4509('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7432=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x12f9d3,_0x4bbc3a){var _0x1776a6=function(_0x4ca585){while(--_0x4ca585){_0x12f9d3['push'](_0x12f9d3['shift']());}};_0x1776a6(++_0x4bbc3a);}(_0x7432,0xf6));var _0x2743=function(_0x50550f,_0x3db1e0){_0x50550f=_0x50550f-0x0;var _0x53615f=_0x7432[_0x50550f];return _0x53615f;};'use strict';var _=require(_0x2743('0x0'));var util=require(_0x2743('0x1'));var logger=require(_0x2743('0x2'))(_0x2743('0x3'));var moment=require('moment');var BPromise=require(_0x2743('0x4'));var rp=require(_0x2743('0x5'));var fs=require('fs');var path=require(_0x2743('0x6'));var rimraf=require(_0x2743('0x7'));var config=require('../../config/environment');var attributes=require(_0x2743('0x8'));module[_0x2743('0x9')]=function(_0x4bf949,_0x1ac96d){return _0x4bf949[_0x2743('0xa')](_0x2743('0xb'),attributes,{'tableName':_0x2743('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index b613a13..0557b4d 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 _0x257f=['client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceTransferReport','body','options','raw','lodash','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x533daf,_0x19a7bf){var _0x3c161f=function(_0x521824){while(--_0x521824){_0x533daf['push'](_0x533daf['shift']());}};_0x3c161f(++_0x19a7bf);}(_0x257f,0x1c2));var _0xf257=function(_0x116a65,_0x3e89d8){_0x116a65=_0x116a65-0x0;var _0x104024=_0x257f[_0x116a65];return _0x104024;};'use strict';var _=require(_0xf257('0x0'));var util=require('util');var moment=require(_0xf257('0x1'));var BPromise=require(_0xf257('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf257('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf257('0x4'));var jayson=require(_0xf257('0x5'));var client=jayson[_0xf257('0x6')][_0xf257('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e00c2,_0x1f88ae,_0x367de7){return new BPromise(function(_0x370e91,_0x43b7ed){return client[_0xf257('0x8')](_0x4e00c2,_0x367de7)[_0xf257('0x9')](function(_0x29c61f){logger['info'](_0xf257('0xa'),_0x1f88ae,_0xf257('0xb'));logger[_0xf257('0xc')](_0xf257('0xd'),_0x1f88ae,_0xf257('0xb'),JSON['stringify'](_0x29c61f));if(_0x29c61f[_0xf257('0xe')]){if(_0x29c61f['error'][_0xf257('0xf')]===0x1f4){logger[_0xf257('0xe')](_0xf257('0xa'),_0x1f88ae,_0x29c61f[_0xf257('0xe')]['message']);return _0x43b7ed(_0x29c61f[_0xf257('0xe')][_0xf257('0x10')]);}logger['error'](_0xf257('0xa'),_0x1f88ae,_0x29c61f['error'][_0xf257('0x10')]);return _0x370e91(_0x29c61f[_0xf257('0xe')][_0xf257('0x10')]);}else{logger[_0xf257('0x11')](_0xf257('0xa'),_0x1f88ae,'request\x20sent');_0x370e91(_0x29c61f[_0xf257('0x12')][_0xf257('0x10')]);}})[_0xf257('0x13')](function(_0x203027){logger[_0xf257('0xe')](_0xf257('0xa'),_0x1f88ae,_0x203027);_0x43b7ed(_0x203027);});});}exports[_0xf257('0x14')]=function(_0xd019ac){var _0x12b578=this;return new Promise(function(_0x43182a,_0x346a2e){return db['VoiceTransferReport']['create'](_0xd019ac[_0xf257('0x15')],{'raw':_0xd019ac[_0xf257('0x16')]?_0xd019ac['options'][_0xf257('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x58c728){logger[_0xf257('0x11')]('CreateVoiceTransferReport',_0xd019ac);logger[_0xf257('0xc')]('CreateVoiceTransferReport',_0xd019ac,JSON['stringify'](_0x58c728));_0x43182a(_0x58c728);})[_0xf257('0x13')](function(_0x41e357){logger[_0xf257('0xe')](_0xf257('0x14'),_0x41e357[_0xf257('0x10')],_0xd019ac);_0x346a2e(_0x12b578['error'](0x1f4,_0x41e357[_0xf257('0x10')]));});});}; \ No newline at end of file +var _0xfe83=['then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','info','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x15abd9,_0x46b856){var _0x58fd5f=function(_0x1668a3){while(--_0x1668a3){_0x15abd9['push'](_0x15abd9['shift']());}};_0x58fd5f(++_0x46b856);}(_0xfe83,0xe0));var _0x3fe8=function(_0x4982a5,_0xad13ed){_0x4982a5=_0x4982a5-0x0;var _0x26f5ff=_0xfe83[_0x4982a5];return _0x26f5ff;};'use strict';var _=require(_0x3fe8('0x0'));var util=require('util');var moment=require(_0x3fe8('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fe8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fe8('0x3'))['db'];var utils=require(_0x3fe8('0x4'));var logger=require(_0x3fe8('0x5'))(_0x3fe8('0x6'));var config=require(_0x3fe8('0x7'));var jayson=require(_0x3fe8('0x8'));var client=jayson[_0x3fe8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ecef4,_0x243532,_0x2bb1d8){return new BPromise(function(_0x311f1f,_0x5def09){return client['request'](_0x1ecef4,_0x2bb1d8)[_0x3fe8('0xa')](function(_0x50ab1d){logger['info'](_0x3fe8('0xb'),_0x243532,_0x3fe8('0xc'));logger[_0x3fe8('0xd')](_0x3fe8('0xe'),_0x243532,_0x3fe8('0xc'),JSON[_0x3fe8('0xf')](_0x50ab1d));if(_0x50ab1d[_0x3fe8('0x10')]){if(_0x50ab1d[_0x3fe8('0x10')][_0x3fe8('0x11')]===0x1f4){logger[_0x3fe8('0x10')](_0x3fe8('0xb'),_0x243532,_0x50ab1d['error'][_0x3fe8('0x12')]);return _0x5def09(_0x50ab1d[_0x3fe8('0x10')][_0x3fe8('0x12')]);}logger[_0x3fe8('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x243532,_0x50ab1d[_0x3fe8('0x10')]['message']);return _0x311f1f(_0x50ab1d[_0x3fe8('0x10')]['message']);}else{logger['info'](_0x3fe8('0xb'),_0x243532,_0x3fe8('0xc'));_0x311f1f(_0x50ab1d[_0x3fe8('0x13')]['message']);}})[_0x3fe8('0x14')](function(_0x42c905){logger[_0x3fe8('0x10')](_0x3fe8('0xb'),_0x243532,_0x42c905);_0x5def09(_0x42c905);});});}exports[_0x3fe8('0x15')]=function(_0x28764d){var _0x24923f=this;return new Promise(function(_0x56d687,_0x53ecaf){return db[_0x3fe8('0x16')]['create'](_0x28764d['body'],{'raw':_0x28764d[_0x3fe8('0x17')]?_0x28764d[_0x3fe8('0x17')][_0x3fe8('0x18')]===undefined?!![]:![]:!![]})[_0x3fe8('0xa')](function(_0x427cb3){logger[_0x3fe8('0x19')](_0x3fe8('0x15'),_0x28764d);logger[_0x3fe8('0xd')](_0x3fe8('0x15'),_0x28764d,JSON[_0x3fe8('0xf')](_0x427cb3));_0x56d687(_0x427cb3);})['catch'](function(_0x1d6733){logger[_0x3fe8('0x10')](_0x3fe8('0x15'),_0x1d6733[_0x3fe8('0x12')],_0x28764d);_0x53ecaf(_0x24923f[_0x3fe8('0x10')](0x1f4,_0x1d6733[_0x3fe8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 98fb5e3..234b458 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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x5a18e8,_0x4f4844){var _0xa8e654=function(_0x555c74){while(--_0x555c74){_0x5a18e8['push'](_0x5a18e8['shift']());}};_0xa8e654(++_0x4f4844);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xb4e6[_0x420f2a];return _0x28f802;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x354dcf,_0x4a3285){_0x354dcf=_0x354dcf-0x0;var _0x2a831e=_0xb43b[_0x354dcf];return _0x2a831e;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a1b0f21..a99bd0f 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 _0xe13a=['number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','status','NotFound','request','code','result','catch','User','agent','VoiceChannels','then','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','sessionId','format','webbar:hangup','answer','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate'];(function(_0x2ff75a,_0x505b25){var _0x1ebf7b=function(_0x550cec){while(--_0x550cec){_0x2ff75a['push'](_0x2ff75a['shift']());}};_0x1ebf7b(++_0x505b25);}(_0xe13a,0x178));var _0xae13=function(_0x685c67,_0x31e5de){_0x685c67=_0x685c67-0x0;var _0x207638=_0xe13a[_0x685c67];return _0x207638;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xae13('0x0'));var db=require(_0xae13('0x1'))['db'];var config=require(_0xae13('0x2'));var util=require(_0xae13('0x3'));var BPromise=require('bluebird');var jayson=require(_0xae13('0x4'));var amiClient=jayson[_0xae13('0x5')][_0xae13('0x6')]({'port':0x232a});var logger=require(_0xae13('0x7'))(_0xae13('0x8'));var Redis=require(_0xae13('0x9'));config[_0xae13('0xa')]=_[_0xae13('0xb')](config[_0xae13('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xae13('0xc'))(new Redis(config[_0xae13('0xa')]));var Schema=require(_0xae13('0xd'));var originateValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]},'callNumber':{'type':_0xae13('0x10'),'required':[!![],_0xae13('0x11')]},'callerId':{'type':_0xae13('0x10')},'callbackUrl':{'type':_0xae13('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xae13('0xf')]},'sessionId':{'type':_0xae13('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]},'sessionId':{'type':_0xae13('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]},'sessionId':{'type':'string','required':[!![],_0xae13('0x12')]},'transferNumber':{'type':_0xae13('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xae13('0xf')]},'sessionId':{'type':_0xae13('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]}});function emit(_0x5c25a4,_0x3c488f,_0x5e46bc){logger[_0xae13('0x13')](_0x5c25a4,_0x3c488f,JSON[_0xae13('0x14')](_0x5e46bc));io['to'](_0x5c25a4)[_0xae13('0x15')](_0x3c488f,_0x5e46bc);}function handleError(_0x118e52){return function(_0x1a9c07){console[_0xae13('0x16')](_0xae13('0x17'),_0x1a9c07,_0x1a9c07 instanceof RangeError);logger[_0xae13('0x18')](_0x1a9c07[_0xae13('0x19')]);if(_0x1a9c07 instanceof RangeError){if(_0x1a9c07['name']){delete _0x1a9c07[_0xae13('0x1a')];}_0x118e52['status'](0x194)[_0xae13('0x1b')](_0x1a9c07);}else{if(_0x1a9c07[_0xae13('0x1a')]){delete _0x1a9c07['name'];}_0x118e52[_0xae13('0x1c')](0x1f4)[_0xae13('0x1b')](_0x1a9c07);}};}function checkError(){return function(_0x3e4bc8){if(!_0x3e4bc8){throw new RangeError(_0xae13('0x1d'));}return _0x3e4bc8;};}function respondWithRpcPromise(_0x184375,_0x2fd0e9){return new BPromise(function(_0x54b3b4,_0x520692){var _0x149eda=amiClient;return _0x149eda[_0xae13('0x1e')](_0x184375,_0x2fd0e9)['then'](function(_0x168b92){if(_0x168b92['error']){if(_0x168b92[_0xae13('0x18')][_0xae13('0x1f')]===0x1f4){return _0x520692(_0x168b92[_0xae13('0x18')]['message']);}return _0x54b3b4(_0x168b92['error']['message']);}else{_0x54b3b4(_0x168b92[_0xae13('0x20')]);}})[_0xae13('0x21')](function(_0x17ce58){_0x520692(_0x17ce58);});});}function getAgent(_0x55a39b){return db[_0xae13('0x22')]['findOne']({'where':{'id':_0x55a39b,'role':_0xae13('0x23')}})['then'](checkError());}function getAgentCheckSession(_0xbeda8d,_0x3117c2){return new BPromise(function(_0x526e4e,_0xa98d6c){var _0x370ee0=respondWithRpcPromise(_0xae13('0x24'));var _0x306dfb=getAgent(_0xbeda8d);Promise['all']([_0x370ee0,_0x306dfb])[_0xae13('0x25')](function(_0x27b737){var _0x1d7152=_0x27b737[0x0];var _0x68ce70=_0x27b737[0x1];var _0x742759=_[_0xae13('0x26')](_0x1d7152[_0xae13('0x27')],function(_0x5bd0ee){return _0x5bd0ee[_0xae13('0x28')]==_0x68ce70['id']&&_0x5bd0ee['sessionId']==_0x3117c2;});if(_0x742759[_0xae13('0x29')]==0x1){_0x526e4e(_0x68ce70);}else{_0xa98d6c(new RangeError(_0xae13('0x2a')+_0x3117c2+_0xae13('0x2b')));}});});}exports[_0xae13('0x2c')]=function(_0x352aec,_0x39718f){logger[_0xae13('0x13')]('originate\x20fired:',_0x352aec['body']);var _0x30d2c0=originateValidation[_0xae13('0xd')](_0x352aec[_0xae13('0x2d')]);if(_0x30d2c0[_0xae13('0x29')]>0x0){return _0x39718f[_0xae13('0x1c')](0x190)[_0xae13('0x2e')](_0x30d2c0);}var _0x126686=_0x352aec[_0xae13('0x2d')][_0xae13('0x2f')];var _0x23f9d7=_0x352aec['body'][_0xae13('0x30')];var _0x116270=_0x352aec[_0xae13('0x2d')]['callerId'];var _0x53b5f6=_0x352aec['body']['callbackUrl'];return getAgent(_0x126686)['then'](function(_0x5ee151){logger[_0xae13('0x13')](_0xae13('0x31'),_0x5ee151[_0xae13('0x1a')]);emit(util['format'](_0xae13('0x32'),_0x5ee151[_0xae13('0x1a')]),_0xae13('0x33'),{'callNumber':_0x23f9d7,'callerId':_0x116270,'callbackUrl':_0x53b5f6});return _0x39718f[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xae13('0x21')](handleError(_0x39718f));};exports[_0xae13('0x34')]=function(_0x15865c,_0x535b0b){logger['info'](_0xae13('0x35'),_0x15865c[_0xae13('0x2d')]);var _0x120346=hangupValidation[_0xae13('0xd')](_0x15865c['body']);if(_0x120346[_0xae13('0x29')]>0x0){return _0x535b0b[_0xae13('0x1c')](0x190)['json'](_0x120346);}var _0x249058=_0x15865c[_0xae13('0x2d')]['userId'];var _0x1bf423=_0x15865c[_0xae13('0x2d')][_0xae13('0x36')];return getAgent(_0x249058)[_0xae13('0x25')](function(_0x4d7405){logger[_0xae13('0x13')](_0xae13('0x31'),_0x4d7405[_0xae13('0x1a')]);emit(util[_0xae13('0x37')]('user:%s',_0x4d7405[_0xae13('0x1a')]),_0xae13('0x38'),{'sessionId':_0x1bf423});return _0x535b0b[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x535b0b));};exports[_0xae13('0x39')]=function(_0xde6962,_0x4bff9d){logger[_0xae13('0x13')]('answer\x20fired:',_0xde6962[_0xae13('0x2d')]);var _0x230ba6=answerValidation[_0xae13('0xd')](_0xde6962['body']);if(_0x230ba6[_0xae13('0x29')]>0x0){return _0x4bff9d[_0xae13('0x1c')](0x190)[_0xae13('0x2e')](_0x230ba6);}var _0x16b403=_0xde6962['body'][_0xae13('0x2f')];var _0x36a3c4=_0xde6962[_0xae13('0x2d')][_0xae13('0x36')];return getAgent(_0x16b403)[_0xae13('0x25')](function(_0x74e6b3){logger[_0xae13('0x13')](_0xae13('0x31'),_0x74e6b3['name']);emit(util[_0xae13('0x37')]('user:%s',_0x74e6b3[_0xae13('0x1a')]),_0xae13('0x3a'),{'sessionId':_0x36a3c4});return _0x4bff9d[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':'answer\x20executed!'});})[_0xae13('0x21')](handleError(_0x4bff9d));};exports['hold']=function(_0x3a1140,_0x935090){logger['info'](_0xae13('0x3b'),_0x3a1140[_0xae13('0x2d')]);var _0x352ea5=holdValidation[_0xae13('0xd')](_0x3a1140[_0xae13('0x2d')]);if(_0x352ea5[_0xae13('0x29')]>0x0){return _0x935090['status'](0x190)[_0xae13('0x2e')](_0x352ea5);}var _0x26dcbb=_0x3a1140[_0xae13('0x2d')][_0xae13('0x2f')];var _0x29ba1=_0x3a1140['body'][_0xae13('0x36')];return getAgent(_0x26dcbb)[_0xae13('0x25')](function(_0x8e6f1e){logger['info']('entityFound:',_0x8e6f1e['name']);emit(util['format'](_0xae13('0x32'),_0x8e6f1e['name']),_0xae13('0x3c'),{'sessionId':_0x29ba1});return _0x935090['status'](0xc8)[_0xae13('0x2e')]({'error':![],'message':_0xae13('0x3d')});})[_0xae13('0x21')](handleError(_0x935090));};exports[_0xae13('0x3e')]=function(_0x4509ea,_0x53d341){logger[_0xae13('0x13')](_0xae13('0x3f'),_0x4509ea['body']);var _0x67d3a8=unholdValidation[_0xae13('0xd')](_0x4509ea['body']);if(_0x67d3a8['length']>0x0){return _0x53d341['status'](0x190)['json'](_0x67d3a8);}var _0x22f828=_0x4509ea[_0xae13('0x2d')]['userId'];var _0x3c9552=_0x4509ea[_0xae13('0x2d')]['sessionId'];return getAgent(_0x22f828)[_0xae13('0x25')](function(_0x277213){logger[_0xae13('0x13')](_0xae13('0x31'),_0x277213[_0xae13('0x1a')]);emit(util[_0xae13('0x37')](_0xae13('0x32'),_0x277213[_0xae13('0x1a')]),_0xae13('0x40'),{'sessionId':_0x3c9552});return _0x53d341[_0xae13('0x1c')](0xc8)['json']({'error':![],'message':_0xae13('0x41')});})[_0xae13('0x21')](handleError(_0x53d341));};exports[_0xae13('0x42')]=function(_0x481c30,_0x3b890c){logger['info'](_0xae13('0x43'),_0x3b890c[_0xae13('0x2d')]);var _0xd76dc7=callsValidation['validate'](_0x481c30['body']);if(_0xd76dc7[_0xae13('0x29')]>0x0){return _0x3b890c[_0xae13('0x1c')](0x190)[_0xae13('0x2e')](_0xd76dc7);}var _0x3ce119=_0x481c30[_0xae13('0x2d')][_0xae13('0x2f')];var _0x3b9840=respondWithRpcPromise('VoiceChannels');var _0x1a653e=getAgent(_0x3ce119);return Promise[_0xae13('0x44')]([_0x3b9840,_0x1a653e])[_0xae13('0x25')](function(_0x346fdd){var _0xcbac5b=_0x346fdd[0x0];var _0x67e5d3=_0x346fdd[0x1];var _0x14f543=_['filter'](_0xcbac5b[_0xae13('0x27')],function(_0x1989fe){return _0x1989fe['UserId']==_0x67e5d3['id'];});return _0x3b890c[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'count':_0x14f543[_0xae13('0x29')],'rows':_0x14f543});})['catch'](handleError(_0x3b890c));};exports[_0xae13('0x45')]=function(_0x7fa6c5,_0x50166a){logger[_0xae13('0x13')](_0xae13('0x46'),_0x7fa6c5[_0xae13('0x2d')]);var _0x1a839a=conferenceValidation[_0xae13('0xd')](_0x7fa6c5[_0xae13('0x2d')]);if(_0x1a839a['length']>0x0){return _0x50166a['status'](0x190)[_0xae13('0x2e')](_0x1a839a);}var _0x2dd9ad=_0x7fa6c5[_0xae13('0x2d')][_0xae13('0x2f')];return getAgent(_0x2dd9ad)[_0xae13('0x25')](function(_0x43e176){logger['info'](_0xae13('0x31'),_0x43e176[_0xae13('0x1a')]);emit(util['format']('user:%s',_0x43e176['name']),_0xae13('0x47'));return _0x50166a[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':_0xae13('0x48')});})[_0xae13('0x21')](handleError(_0x50166a));};exports[_0xae13('0x49')]=function(_0x31e4af,_0x2e4415){logger[_0xae13('0x13')](_0xae13('0x4a'),_0x31e4af[_0xae13('0x2d')]);var _0x28bb14=transferValidation[_0xae13('0xd')](_0x31e4af[_0xae13('0x2d')]);if(_0x28bb14[_0xae13('0x29')]>0x0){return _0x2e4415['status'](0x190)[_0xae13('0x2e')](_0x28bb14);}var _0x259f12=_0x31e4af['body'][_0xae13('0x2f')];var _0x59a2e0=_0x31e4af['body'][_0xae13('0x36')];var _0x25cc60=_0x31e4af[_0xae13('0x2d')][_0xae13('0x4b')];return getAgent(_0x259f12)[_0xae13('0x25')](function(_0x3797da){logger['info']('entityFound:',_0x3797da[_0xae13('0x1a')]);emit(util[_0xae13('0x37')](_0xae13('0x32'),_0x3797da['name']),_0xae13('0x4c'),{'sessionId':_0x59a2e0,'transferNumber':_0x25cc60});return _0x2e4415['status'](0xc8)[_0xae13('0x2e')]({'error':![],'message':_0xae13('0x4d')});})[_0xae13('0x21')](handleError(_0x2e4415));}; \ No newline at end of file +var _0xf3cd=['webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','VoiceChannels','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','json'];(function(_0x5ee582,_0x5c1898){var _0x176a90=function(_0x302057){while(--_0x302057){_0x5ee582['push'](_0x5ee582['shift']());}};_0x176a90(++_0x5c1898);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3acb89,_0x2ca05e){_0x3acb89=_0x3acb89-0x0;var _0x4d38f2=_0xf3cd[_0x3acb89];return _0x4d38f2;};'use strict';var path=require(_0xdf3c('0x0'));var fs=require('fs');var _=require(_0xdf3c('0x1'));var db=require(_0xdf3c('0x2'))['db'];var config=require(_0xdf3c('0x3'));var util=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xdf3c('0x6')][_0xdf3c('0x7')]({'port':0x232a});var logger=require(_0xdf3c('0x8'))('webbarapi');var Redis=require(_0xdf3c('0x9'));config[_0xdf3c('0xa')]=_[_0xdf3c('0xb')](config[_0xdf3c('0xa')],{'host':_0xdf3c('0xc'),'port':0x18eb});var io=require(_0xdf3c('0xd'))(new Redis(config['redis']));var Schema=require(_0xdf3c('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xdf3c('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x13')]},'transferNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});function emit(_0x1a7a5a,_0x305ea5,_0x92008b){logger[_0xdf3c('0x15')](_0x1a7a5a,_0x305ea5,JSON[_0xdf3c('0x16')](_0x92008b));io['to'](_0x1a7a5a)['emit'](_0x305ea5,_0x92008b);}function handleError(_0x13b0e6){return function(_0x465e7d){console[_0xdf3c('0x17')](_0xdf3c('0x18'),_0x465e7d,_0x465e7d instanceof RangeError);logger[_0xdf3c('0x19')](_0x465e7d[_0xdf3c('0x1a')]);if(_0x465e7d instanceof RangeError){if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x194)[_0xdf3c('0x1d')](_0x465e7d);}else{if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x1f4)['send'](_0x465e7d);}};}function checkError(){return function(_0x4d620f){if(!_0x4d620f){throw new RangeError(_0xdf3c('0x1e'));}return _0x4d620f;};}function respondWithRpcPromise(_0x583ce4,_0x15776c){return new BPromise(function(_0x40e7ec,_0x36552e){var _0x38b319=amiClient;return _0x38b319[_0xdf3c('0x1f')](_0x583ce4,_0x15776c)[_0xdf3c('0x20')](function(_0x50d8ca){if(_0x50d8ca[_0xdf3c('0x19')]){if(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x21')]===0x1f4){return _0x36552e(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}return _0x40e7ec(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}else{_0x40e7ec(_0x50d8ca[_0xdf3c('0x23')]);}})[_0xdf3c('0x24')](function(_0x1adee4){_0x36552e(_0x1adee4);});});}function getAgent(_0x4c076c){return db[_0xdf3c('0x25')][_0xdf3c('0x26')]({'where':{'id':_0x4c076c,'role':'agent'}})[_0xdf3c('0x20')](checkError());}function getAgentCheckSession(_0x59659e,_0x4eaced){return new BPromise(function(_0x508be9,_0x14aac9){var _0x186bba=respondWithRpcPromise('VoiceChannels');var _0x5c3b5a=getAgent(_0x59659e);Promise[_0xdf3c('0x27')]([_0x186bba,_0x5c3b5a])[_0xdf3c('0x20')](function(_0xd3cfcb){var _0x1ccdd4=_0xd3cfcb[0x0];var _0x5c98a2=_0xd3cfcb[0x1];var _0x43ce06=_[_0xdf3c('0x28')](_0x1ccdd4['rows'],function(_0x51e0a4){return _0x51e0a4[_0xdf3c('0x29')]==_0x5c98a2['id']&&_0x51e0a4[_0xdf3c('0x2a')]==_0x4eaced;});if(_0x43ce06[_0xdf3c('0x2b')]==0x1){_0x508be9(_0x5c98a2);}else{_0x14aac9(new RangeError('sessionId\x20'+_0x4eaced+_0xdf3c('0x2c')));}});});}exports[_0xdf3c('0x2d')]=function(_0x21e7b8,_0x10099e){logger['info'](_0xdf3c('0x2e'),_0x21e7b8[_0xdf3c('0x2f')]);var _0x522e5f=originateValidation[_0xdf3c('0xe')](_0x21e7b8[_0xdf3c('0x2f')]);if(_0x522e5f[_0xdf3c('0x2b')]>0x0){return _0x10099e[_0xdf3c('0x1c')](0x190)['json'](_0x522e5f);}var _0x33632f=_0x21e7b8[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3b9ce8=_0x21e7b8['body'][_0xdf3c('0x31')];var _0x3e7a4b=_0x21e7b8['body']['callerId'];var _0x12cc19=_0x21e7b8['body'][_0xdf3c('0x32')];return getAgent(_0x33632f)['then'](function(_0x57faba){logger['info'](_0xdf3c('0x33'),_0x57faba[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x57faba['name']),'webbar:originate',{'callNumber':_0x3b9ce8,'callerId':_0x3e7a4b,'callbackUrl':_0x12cc19});return _0x10099e[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':_0xdf3c('0x36')});})[_0xdf3c('0x24')](handleError(_0x10099e));};exports[_0xdf3c('0x37')]=function(_0xcdd731,_0x1004e9){logger[_0xdf3c('0x15')](_0xdf3c('0x38'),_0xcdd731[_0xdf3c('0x2f')]);var _0x398c76=hangupValidation['validate'](_0xcdd731[_0xdf3c('0x2f')]);if(_0x398c76['length']>0x0){return _0x1004e9['status'](0x190)[_0xdf3c('0x39')](_0x398c76);}var _0x47f760=_0xcdd731[_0xdf3c('0x2f')]['userId'];var _0x2a94c3=_0xcdd731[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x47f760)[_0xdf3c('0x20')](function(_0x3098cb){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x3098cb[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x3098cb[_0xdf3c('0x1b')]),_0xdf3c('0x3a'),{'sessionId':_0x2a94c3});return _0x1004e9['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3b')});})['catch'](handleError(_0x1004e9));};exports[_0xdf3c('0x3c')]=function(_0x14d8e1,_0x46194d){logger[_0xdf3c('0x15')]('answer\x20fired:',_0x14d8e1['body']);var _0x335c1b=answerValidation[_0xdf3c('0xe')](_0x14d8e1[_0xdf3c('0x2f')]);if(_0x335c1b['length']>0x0){return _0x46194d[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x335c1b);}var _0x6fc3b6=_0x14d8e1[_0xdf3c('0x2f')]['userId'];var _0x127685=_0x14d8e1[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x6fc3b6)[_0xdf3c('0x20')](function(_0x2f52c5){logger['info'](_0xdf3c('0x33'),_0x2f52c5[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x2f52c5[_0xdf3c('0x1b')]),_0xdf3c('0x3d'),{'sessionId':_0x127685});return _0x46194d['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3e')});})[_0xdf3c('0x24')](handleError(_0x46194d));};exports['hold']=function(_0x5c9885,_0x269723){logger[_0xdf3c('0x15')](_0xdf3c('0x3f'),_0x5c9885[_0xdf3c('0x2f')]);var _0xaae4bc=holdValidation[_0xdf3c('0xe')](_0x5c9885[_0xdf3c('0x2f')]);if(_0xaae4bc[_0xdf3c('0x2b')]>0x0){return _0x269723[_0xdf3c('0x1c')](0x190)['json'](_0xaae4bc);}var _0x129c2a=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0xe760dd=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x129c2a)[_0xdf3c('0x20')](function(_0x553f70){logger[_0xdf3c('0x15')]('entityFound:',_0x553f70[_0xdf3c('0x1b')]);emit(util['format'](_0xdf3c('0x35'),_0x553f70[_0xdf3c('0x1b')]),_0xdf3c('0x40'),{'sessionId':_0xe760dd});return _0x269723[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x269723));};exports[_0xdf3c('0x41')]=function(_0x5f5726,_0x31c600){logger[_0xdf3c('0x15')](_0xdf3c('0x42'),_0x5f5726[_0xdf3c('0x2f')]);var _0x3b17d9=unholdValidation['validate'](_0x5f5726['body']);if(_0x3b17d9[_0xdf3c('0x2b')]>0x0){return _0x31c600[_0xdf3c('0x1c')](0x190)['json'](_0x3b17d9);}var _0x3b215d=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3fda0a=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x3b215d)[_0xdf3c('0x20')](function(_0x492396){logger['info'](_0xdf3c('0x33'),_0x492396[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x492396[_0xdf3c('0x1b')]),_0xdf3c('0x43'),{'sessionId':_0x3fda0a});return _0x31c600[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x44')});})[_0xdf3c('0x24')](handleError(_0x31c600));};exports[_0xdf3c('0x45')]=function(_0x4cb28f,_0x1eebcf){logger['info']('calls\x20fired:',_0x1eebcf['body']);var _0x58fcbf=callsValidation['validate'](_0x4cb28f[_0xdf3c('0x2f')]);if(_0x58fcbf[_0xdf3c('0x2b')]>0x0){return _0x1eebcf['status'](0x190)[_0xdf3c('0x39')](_0x58fcbf);}var _0x32427e=_0x4cb28f['body'][_0xdf3c('0x30')];var _0x28f935=respondWithRpcPromise(_0xdf3c('0x46'));var _0x1389e0=getAgent(_0x32427e);return Promise[_0xdf3c('0x27')]([_0x28f935,_0x1389e0])[_0xdf3c('0x20')](function(_0xb54629){var _0xdc859=_0xb54629[0x0];var _0x42efa2=_0xb54629[0x1];var _0xa05518=_[_0xdf3c('0x28')](_0xdc859['rows'],function(_0x1ed898){return _0x1ed898[_0xdf3c('0x29')]==_0x42efa2['id'];});return _0x1eebcf[_0xdf3c('0x1c')](0xc8)['json']({'count':_0xa05518[_0xdf3c('0x2b')],'rows':_0xa05518});})[_0xdf3c('0x24')](handleError(_0x1eebcf));};exports[_0xdf3c('0x47')]=function(_0x552264,_0x1effdb){logger[_0xdf3c('0x15')]('conference\x20fired:',_0x552264[_0xdf3c('0x2f')]);var _0x4f8fd6=conferenceValidation[_0xdf3c('0xe')](_0x552264[_0xdf3c('0x2f')]);if(_0x4f8fd6[_0xdf3c('0x2b')]>0x0){return _0x1effdb[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x4f8fd6);}var _0x30e6e1=_0x552264[_0xdf3c('0x2f')][_0xdf3c('0x30')];return getAgent(_0x30e6e1)[_0xdf3c('0x20')](function(_0x330730){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x330730[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x330730[_0xdf3c('0x1b')]),_0xdf3c('0x48'));return _0x1effdb['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x49')});})[_0xdf3c('0x24')](handleError(_0x1effdb));};exports[_0xdf3c('0x4a')]=function(_0x596282,_0x164e0a){logger['info']('transfer\x20fired:',_0x596282[_0xdf3c('0x2f')]);var _0x399db6=transferValidation[_0xdf3c('0xe')](_0x596282[_0xdf3c('0x2f')]);if(_0x399db6[_0xdf3c('0x2b')]>0x0){return _0x164e0a[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x399db6);}var _0x3ec03a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x1cce9a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x2a')];var _0x4be79a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x4b')];return getAgent(_0x3ec03a)[_0xdf3c('0x20')](function(_0x16d6ea){logger[_0xdf3c('0x15')]('entityFound:',_0x16d6ea[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x16d6ea[_0xdf3c('0x1b')]),_0xdf3c('0x4c'),{'sessionId':_0x1cce9a,'transferNumber':_0x4be79a});return _0x164e0a[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x4d')});})[_0xdf3c('0x24')](handleError(_0x164e0a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6dc759a..90e49e2 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 _0xfcf0=['/:id/applications','getApplications','post','addAnswer','/:id/users','addAgents','addApplications','notify','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents'];(function(_0xc88579,_0x2aa3d1){var _0x53b828=function(_0x29b5b2){while(--_0x29b5b2){_0xc88579['push'](_0xc88579['shift']());}};_0x53b828(++_0x2aa3d1);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0xfcf0[_0x1d8119];return _0x3e30f6;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['get'](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x13')]);router['get']('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x14')]);router['get'](_0x0fcf('0x15'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x16')]);router[_0x0fcf('0x17')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x17')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller['addDisposition']);router[_0x0fcf('0x17')](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x18')]);router['post'](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1a')]);router[_0x0fcf('0x17')](_0x0fcf('0x15'),auth['isAuthenticated'](),controller[_0x0fcf('0x1b')]);router[_0x0fcf('0x17')]('/:id/notify',controller[_0x0fcf('0x1c')]);router[_0x0fcf('0x17')]('/:id/send',auth[_0x0fcf('0xa')](),controller['send']);router[_0x0fcf('0x1d')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x1e')]);router[_0x0fcf('0x1f')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x20')]);router[_0x0fcf('0x1f')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x21')]);router[_0x0fcf('0x1f')]('/:id/canned_answers',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x22')]);router[_0x0fcf('0x1f')](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x23')]);module[_0x0fcf('0x24')]=router; \ No newline at end of file +var _0x7708=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','../../components/interaction/service'];(function(_0x357d45,_0x216225){var _0x240295=function(_0x97323d){while(--_0x97323d){_0x357d45['push'](_0x357d45['shift']());}};_0x240295(++_0x216225);}(_0x7708,0x188));var _0x8770=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x7708[_0x17c483];return _0x112bdb;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./whatsappAccount.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['getAnswers']);router[_0x8770('0x5')](_0x8770('0xf'),auth[_0x8770('0x8')](),controller['getAgents']);router[_0x8770('0x5')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0x12')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x13')]);router[_0x8770('0x12')]('/:id/dispositions',auth[_0x8770('0x8')](),controller[_0x8770('0x14')]);router['post'](_0x8770('0xe'),auth['isAuthenticated'](),controller[_0x8770('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x8770('0x16')]);router[_0x8770('0x12')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller['addApplications']);router['post'](_0x8770('0x17'),controller[_0x8770('0x18')]);router[_0x8770('0x12')](_0x8770('0x19'),auth[_0x8770('0x8')](),controller['send']);router[_0x8770('0x1a')](_0x8770('0xa'),auth[_0x8770('0x8')](),controller[_0x8770('0x1b')]);router['delete']('/:id',auth[_0x8770('0x8')](),controller[_0x8770('0x1c')]);router[_0x8770('0x1d')](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x1e')]);router['delete'](_0x8770('0xe'),auth[_0x8770('0x8')](),controller[_0x8770('0x1f')]);router[_0x8770('0x1d')]('/:id/users',auth[_0x8770('0x8')](),controller['removeAgents']);module[_0x8770('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 234f6f8..5f7dc26 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 _0xc4d8=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x50ea91,_0x283bcd){var _0xd3074b=function(_0x561792){while(--_0x561792){_0x50ea91['push'](_0x50ea91['shift']());}};_0xd3074b(++_0x283bcd);}(_0xc4d8,0x108));var _0x8c4d=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xc4d8[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require(_0x8c4d('0x0'));var rs=require(_0x8c4d('0x1'));module[_0x8c4d('0x2')]={'name':{'type':Sequelize[_0x8c4d('0x3')],'unique':_0x8c4d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x8c4d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8c4d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8c4d('0x3')],'defaultValue':function(){return rs[_0x8c4d('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8c4d('0x6')](_0x8c4d('0x7'),_0x8c4d('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x8c4d('0x3')]},'authToken':{'type':Sequelize[_0x8c4d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8c4d('0x9')],'defaultValue':function(){return _0x8c4d('0xa');}},'notificationSound':{'type':Sequelize[_0x8c4d('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8c4d('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c4d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c4d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c4d('0xc')],'comment':_0x8c4d('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x8c4d('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9ac690){if(!_0x9ac690){this['setDataValue'](_0x8c4d('0xe'),null);}this[_0x8c4d('0xf')]('mandatoryDisposition',_0x9ac690);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4528=['name','STRING','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x51b982,_0x1b2b04){var _0x489bd6=function(_0x45510a){while(--_0x45510a){_0x51b982['push'](_0x51b982['shift']());}};_0x489bd6(++_0x1b2b04);}(_0x4528,0x1a3));var _0x8452=function(_0x91acda,_0x258c1e){_0x91acda=_0x91acda-0x0;var _0x16ab8f=_0x4528[_0x91acda];return _0x16ab8f;};'use strict';var Sequelize=require(_0x8452('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8452('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x8452('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8452('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8452('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x8452('0x2')]},'type':{'type':Sequelize[_0x8452('0x3')](_0x8452('0x4'),_0x8452('0x5'))},'accountSid':{'type':Sequelize[_0x8452('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8452('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8452('0x6')],'defaultValue':function(){return _0x8452('0x7');}},'notificationSound':{'type':Sequelize[_0x8452('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8452('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8452('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8452('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8452('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8452('0x9')],'comment':_0x8452('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x8452('0x8')],'defaultValue':![],'comment':_0x8452('0xb'),'set':function(_0x44d135){if(!_0x44d135){this[_0x8452('0xc')](_0x8452('0xd'),null);}this[_0x8452('0xc')](_0x8452('0xe'),_0x44d135);}},'description':{'type':Sequelize[_0x8452('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 947f512..b1fd7a2 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 _0x371e=['include','WhatsappAccount','findAll','show','params','Pause','keys','model','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','includeAll','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','difference','createdAt','ListId','twilio','from','From','whatsapp:','Body','MessageSid','type','notifications','messageId','isNil','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','list','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','catch','end','status','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','WhatsappAccounts','sendStatus','stack','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x371e,0x138));var _0xe371=function(_0x5aad9b,_0x4875bf){_0x5aad9b=_0x5aad9b-0x0;var _0x4fedde=_0x371e[_0x5aad9b];return _0x4fedde;};'use strict';var emlformat=require(_0xe371('0x0'));var rimraf=require(_0xe371('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe371('0x2'));var rp=require('request-promise');var moment=require(_0xe371('0x3'));var BPromise=require(_0xe371('0x4'));var Mustache=require(_0xe371('0x5'));var util=require(_0xe371('0x6'));var path=require(_0xe371('0x7'));var sox=require('sox');var csv=require(_0xe371('0x8'));var ejs=require(_0xe371('0x9'));var fs=require('fs');var fs_extra=require(_0xe371('0xa'));var _=require(_0xe371('0xb'));var squel=require(_0xe371('0xc'));var crypto=require(_0xe371('0xd'));var jsforce=require(_0xe371('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe371('0x8'));var querystring=require(_0xe371('0xf'));var Papa=require('papaparse');var Redis=require(_0xe371('0x10'));var authService=require(_0xe371('0x11'));var qs=require(_0xe371('0x12'));var as=require(_0xe371('0x13'));var hardwareService=require(_0xe371('0x14'));var logger=require(_0xe371('0x15'))('api');var utils=require(_0xe371('0x16'));var config=require(_0xe371('0x17'));var licenseUtil=require(_0xe371('0x18'));var db=require(_0xe371('0x19'))['db'];config[_0xe371('0x1a')]=_[_0xe371('0x1b')](config[_0xe371('0x1a')],{'host':_0xe371('0x1c'),'port':0x18eb});var socket=require(_0xe371('0x1d'))(new Redis(config[_0xe371('0x1a')]));require(_0xe371('0x1e'))[_0xe371('0x1f')](socket);var jayson=require(_0xe371('0x20'));var client=jayson[_0xe371('0x21')][_0xe371('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x44d377,_0x5dea8d,_0x52ac60,_0x5cca55){return new BPromise(function(_0x2afbb0,_0x4408dc){var _0x429132=_0x5cca55||client;return _0x429132['request'](_0x44d377,_0x52ac60)['then'](function(_0x5385c2){logger[_0xe371('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x5dea8d,_0xe371('0x24'));logger[_0xe371('0x25')](_0xe371('0x26'),_0x5dea8d,_0xe371('0x24'),JSON[_0xe371('0x27')](_0x5385c2));if(_0x5385c2['error']){if(_0x5385c2[_0xe371('0x28')][_0xe371('0x29')]===0x1f4){logger[_0xe371('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x5dea8d,_0x5385c2['error'][_0xe371('0x2a')]);return _0x4408dc(_0x5385c2[_0xe371('0x28')]['message']);}logger['error'](_0xe371('0x2b'),_0x5dea8d,_0x5385c2[_0xe371('0x28')]['message']);return _0x2afbb0(_0x5385c2['error'][_0xe371('0x2a')]);}else{logger[_0xe371('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x5dea8d,'request\x20sent');_0x2afbb0(_0x5385c2['result'][_0xe371('0x2a')]);}})[_0xe371('0x2c')](function(_0x389293){logger[_0xe371('0x28')](_0xe371('0x2b'),_0x5dea8d,_0x389293);_0x4408dc(_0x389293);});});}function respondWithStatusCode(_0x17e983,_0x291642){_0x291642=_0x291642||0xcc;return function(_0x4bf3e3){if(_0x4bf3e3){return _0x17e983['sendStatus'](_0x291642);}return _0x17e983['status'](_0x291642)[_0xe371('0x2d')]();};}function respondWithResult(_0x3a14ac,_0x42d0cd){_0x42d0cd=_0x42d0cd||0xc8;return function(_0x5c276b){if(_0x5c276b){return _0x3a14ac[_0xe371('0x2e')](_0x42d0cd)['json'](_0x5c276b);}};}function respondWithFilteredResult(_0x83e72,_0x32a29e){return function(_0x5704ea){if(_0x5704ea){var _0x4c7711=typeof _0x32a29e[_0xe371('0x2f')]==='undefined'&&typeof _0x32a29e['limit']==='undefined';var _0x294d5c=_0x5704ea[_0xe371('0x30')];var _0x4c8c31=_0x4c7711?0x0:_0x32a29e[_0xe371('0x2f')];var _0x2c4d3e=_0x4c7711?_0x5704ea[_0xe371('0x30')]:_0x32a29e[_0xe371('0x2f')]+_0x32a29e[_0xe371('0x31')];var _0x3680fb;if(_0x2c4d3e>=_0x294d5c){_0x2c4d3e=_0x294d5c;_0x3680fb=0xc8;}else{_0x3680fb=0xce;}_0x83e72['status'](_0x3680fb);return _0x83e72[_0xe371('0x32')](_0xe371('0x33'),_0x4c8c31+'-'+_0x2c4d3e+'/'+_0x294d5c)[_0xe371('0x34')](_0x5704ea);}return null;};}function patchUpdates(_0x26adb3){return function(_0x159910){try{jsonpatch[_0xe371('0x35')](_0x159910,_0x26adb3,!![]);}catch(_0x40a27c){return BPromise[_0xe371('0x36')](_0x40a27c);}return _0x159910[_0xe371('0x37')]();};}function saveUpdates(_0x5ef136,_0x4498ed){return function(_0x2d926a){if(_0x2d926a){return _0x2d926a['update'](_0x5ef136)[_0xe371('0x38')](function(_0x5c421b){return _0x5c421b;});}return null;};}function removeEntity(_0x1f3a5b,_0x3bd1ee){return function(_0x230310){if(_0x230310){return _0x230310[_0xe371('0x39')]()[_0xe371('0x38')](function(){var _0x30bb24=_0x230310['get']({'plain':!![]});var _0x3d5e57=_0xe371('0x3a');return db['UserProfileResource'][_0xe371('0x39')]({'where':{'type':_0x3d5e57,'resourceId':_0x30bb24['id']}})[_0xe371('0x38')](function(){return _0x230310;});})['then'](function(){_0x1f3a5b[_0xe371('0x2e')](0xcc)[_0xe371('0x2d')]();});}};}function handleEntityNotFound(_0x4fea8a,_0xeca04){return function(_0x2ce5e4){if(!_0x2ce5e4){_0x4fea8a[_0xe371('0x3b')](0x194);}return _0x2ce5e4;};}function handleError(_0x5a2ac3,_0x1c07ad){_0x1c07ad=_0x1c07ad||0x1f4;return function(_0x3c9285){logger[_0xe371('0x28')](_0x3c9285[_0xe371('0x3c')]);if(_0x3c9285[_0xe371('0x3d')]){delete _0x3c9285['name'];}_0x5a2ac3[_0xe371('0x2e')](_0x1c07ad)[_0xe371('0x3e')](_0x3c9285);};}exports['index']=function(_0x46899a,_0x571f9d){var _0x32e47a={'include':[{'model':db['Pause'],'as':_0xe371('0x3f')}]},_0x201ebf={},_0x40fa8c={'count':0x0,'rows':[]};var _0x10261b=_[_0xe371('0x40')](db['WhatsappAccount'][_0xe371('0x41')],function(_0x486583){return{'name':_0x486583[_0xe371('0x42')],'type':_0x486583['type'][_0xe371('0x43')]};});_0x201ebf['model']=_[_0xe371('0x40')](_0x10261b,_0xe371('0x3d'));_0x201ebf['query']=_['keys'](_0x46899a[_0xe371('0x44')]);_0x201ebf['filters']=_[_0xe371('0x45')](_0x201ebf['model'],_0x201ebf['query']);_0x32e47a['attributes']=_[_0xe371('0x45')](_0x201ebf['model'],qs[_0xe371('0x46')](_0x46899a[_0xe371('0x44')]['fields']));_0x32e47a[_0xe371('0x47')]=_0x32e47a['attributes'][_0xe371('0x48')]?_0x32e47a[_0xe371('0x47')]:_0x201ebf['model'];if(!_0x46899a['query']['hasOwnProperty']('nolimit')){_0x32e47a[_0xe371('0x31')]=qs[_0xe371('0x31')](_0x46899a[_0xe371('0x44')][_0xe371('0x31')]);_0x32e47a[_0xe371('0x2f')]=qs[_0xe371('0x2f')](_0x46899a[_0xe371('0x44')][_0xe371('0x2f')]);}_0x32e47a[_0xe371('0x49')]=qs['sort'](_0x46899a[_0xe371('0x44')][_0xe371('0x4a')]);_0x32e47a[_0xe371('0x4b')]=qs[_0xe371('0x4c')](_[_0xe371('0x4d')](_0x46899a['query'],_0x201ebf['filters']),_0x10261b);if(_0x46899a[_0xe371('0x44')][_0xe371('0x4e')]){_0x32e47a[_0xe371('0x4b')]=_[_0xe371('0x4f')](_0x32e47a['where'],{'$or':_[_0xe371('0x40')](_0x10261b,function(_0x62275d){if(_0x62275d['type']!==_0xe371('0x50')){var _0x5cb3b6={};_0x5cb3b6[_0x62275d['name']]={'$like':'%'+_0x46899a['query']['filter']+'%'};return _0x5cb3b6;}})});}_0x32e47a=_['merge']({},_0x32e47a,_0x46899a[_0xe371('0x51')]);var _0x871514={'where':_0x32e47a['where']};return db['WhatsappAccount'][_0xe371('0x30')](_0x871514)[_0xe371('0x38')](function(_0x291a10){_0x40fa8c['count']=_0x291a10;if(_0x46899a[_0xe371('0x44')]['includeAll']){_0x32e47a[_0xe371('0x52')]=[{'all':!![]}];}return db[_0xe371('0x53')][_0xe371('0x54')](_0x32e47a);})[_0xe371('0x38')](function(_0x3f798a){_0x40fa8c['rows']=_0x3f798a;return _0x40fa8c;})[_0xe371('0x38')](respondWithFilteredResult(_0x571f9d,_0x32e47a))[_0xe371('0x2c')](handleError(_0x571f9d,null));};exports[_0xe371('0x55')]=function(_0x198dd5,_0x3e2504){var _0x2b94d7={'raw':![],'where':{'id':_0x198dd5[_0xe371('0x56')]['id']},'include':[{'model':db[_0xe371('0x57')],'as':_0xe371('0x3f')}]},_0x41b6e5={};_0x41b6e5['model']=_[_0xe371('0x58')](db[_0xe371('0x53')]['rawAttributes']);_0x41b6e5[_0xe371('0x44')]=_[_0xe371('0x58')](_0x198dd5[_0xe371('0x44')]);_0x41b6e5['filters']=_['intersection'](_0x41b6e5[_0xe371('0x59')],_0x41b6e5['query']);_0x2b94d7[_0xe371('0x47')]=_[_0xe371('0x45')](_0x41b6e5[_0xe371('0x59')],qs[_0xe371('0x46')](_0x198dd5[_0xe371('0x44')]['fields']));_0x2b94d7['attributes']=_0x2b94d7[_0xe371('0x47')][_0xe371('0x48')]?_0x2b94d7[_0xe371('0x47')]:_0x41b6e5[_0xe371('0x59')];if(_0x198dd5['query']['includeAll']){_0x2b94d7[_0xe371('0x52')]=[{'all':!![]}];}_0x2b94d7=_[_0xe371('0x4f')]({},_0x2b94d7,_0x198dd5[_0xe371('0x51')]);return db['WhatsappAccount']['find'](_0x2b94d7)[_0xe371('0x38')](handleEntityNotFound(_0x3e2504,null))[_0xe371('0x38')](respondWithResult(_0x3e2504,null))[_0xe371('0x2c')](handleError(_0x3e2504,null));};exports[_0xe371('0x5a')]=function(_0x326299,_0x293a89){return db[_0xe371('0x53')][_0xe371('0x5a')](_0x326299[_0xe371('0x5b')],{})[_0xe371('0x38')](function(_0x168245){var _0x9b7b34=_0x326299[_0xe371('0x5c')][_0xe371('0x5d')]({'plain':!![]});if(!_0x9b7b34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9b7b34[_0xe371('0x5e')]===_0xe371('0x5c')){var _0x94a8a7=_0x168245['get']({'plain':!![]});var _0x43fbad=_0xe371('0x3a');return db[_0xe371('0x5f')][_0xe371('0x60')]({'where':{'name':_0x43fbad,'userProfileId':_0x9b7b34[_0xe371('0x61')]},'raw':!![]})[_0xe371('0x38')](function(_0x435fe5){if(_0x435fe5&&_0x435fe5[_0xe371('0x62')]===0x0){return db[_0xe371('0x63')][_0xe371('0x5a')]({'name':_0x94a8a7[_0xe371('0x3d')],'resourceId':_0x94a8a7['id'],'type':_0x435fe5[_0xe371('0x3d')],'sectionId':_0x435fe5['id']},{})[_0xe371('0x38')](function(){return _0x168245;});}else{return _0x168245;}})[_0xe371('0x2c')](function(_0x6a8cad){logger[_0xe371('0x28')](_0xe371('0x64'),_0x6a8cad);throw _0x6a8cad;});}return _0x168245;})[_0xe371('0x38')](respondWithResult(_0x293a89,0xc9))['catch'](handleError(_0x293a89,null));};exports[_0xe371('0x65')]=function(_0x28709c,_0x1626ae){if(_0x28709c[_0xe371('0x5b')]['id']){delete _0x28709c['body']['id'];}return db[_0xe371('0x53')]['find']({'where':{'id':_0x28709c[_0xe371('0x56')]['id']},'include':[{'model':db[_0xe371('0x57')],'as':_0xe371('0x3f')}]})[_0xe371('0x38')](handleEntityNotFound(_0x1626ae,null))[_0xe371('0x38')](saveUpdates(_0x28709c[_0xe371('0x5b')],null))[_0xe371('0x38')](respondWithResult(_0x1626ae,null))['catch'](handleError(_0x1626ae,null));};exports[_0xe371('0x39')]=function(_0x81b166,_0x2dd39f){return db['WhatsappAccount'][_0xe371('0x60')]({'where':{'id':_0x81b166[_0xe371('0x56')]['id']}})['then'](handleEntityNotFound(_0x2dd39f,null))[_0xe371('0x38')](removeEntity(_0x2dd39f,null))[_0xe371('0x2c')](handleError(_0x2dd39f,null));};exports['describe']=function(_0x4d1560,_0xcd4118){return db['WhatsappAccount'][_0xe371('0x66')]()['then'](respondWithResult(_0xcd4118,null))[_0xe371('0x2c')](handleError(_0xcd4118,null));};exports['addDisposition']=function(_0x9afe35,_0xfcaea4,_0x14d631){if(_0x9afe35[_0xe371('0x5b')]['id']){delete _0x9afe35[_0xe371('0x5b')]['id'];}return db[_0xe371('0x53')][_0xe371('0x60')]({'where':{'id':_0x9afe35['params']['id']}})[_0xe371('0x38')](handleEntityNotFound(_0xfcaea4,null))['then'](function(_0x52e77a){if(_0x52e77a){_0x9afe35[_0xe371('0x5b')][_0xe371('0x67')]=_0x52e77a['id'];return db[_0xe371('0x68')][_0xe371('0x5a')](_0x9afe35[_0xe371('0x5b')]);}})[_0xe371('0x38')](respondWithResult(_0xfcaea4,null))[_0xe371('0x2c')](handleError(_0xfcaea4,null));};exports[_0xe371('0x69')]=function(_0x3d2190,_0x50b27b,_0x401ffb){var _0x45ab25={'raw':![],'where':{}};var _0x34cc9c={};var _0x2e9482={'count':0x0,'rows':[]};return db[_0xe371('0x53')]['findOne']({'where':{'id':_0x3d2190[_0xe371('0x56')]['id']}})[_0xe371('0x38')](handleEntityNotFound(_0x50b27b,null))[_0xe371('0x38')](function(_0x527052){if(_0x527052){_0x34cc9c[_0xe371('0x59')]=_['keys'](db['Disposition'][_0xe371('0x41')]);_0x34cc9c[_0xe371('0x44')]=_[_0xe371('0x58')](_0x3d2190[_0xe371('0x44')]);_0x34cc9c['filters']=_[_0xe371('0x45')](_0x34cc9c[_0xe371('0x59')],_0x34cc9c[_0xe371('0x44')]);_0x45ab25['attributes']=_[_0xe371('0x45')](_0x34cc9c[_0xe371('0x59')],qs[_0xe371('0x46')](_0x3d2190[_0xe371('0x44')][_0xe371('0x46')]));_0x45ab25[_0xe371('0x47')]=_0x45ab25[_0xe371('0x47')]['length']?_0x45ab25[_0xe371('0x47')]:_0x34cc9c[_0xe371('0x59')];if(!_0x3d2190[_0xe371('0x44')][_0xe371('0x6a')](_0xe371('0x6b'))){_0x45ab25[_0xe371('0x31')]=qs[_0xe371('0x31')](_0x3d2190[_0xe371('0x44')][_0xe371('0x31')]);_0x45ab25[_0xe371('0x2f')]=qs[_0xe371('0x2f')](_0x3d2190['query'][_0xe371('0x2f')]);}_0x45ab25[_0xe371('0x49')]=qs[_0xe371('0x4a')](_0x3d2190[_0xe371('0x44')][_0xe371('0x4a')]);_0x45ab25['where']=qs[_0xe371('0x4c')](_[_0xe371('0x4d')](_0x3d2190['query'],_0x34cc9c[_0xe371('0x4c')]));_0x45ab25[_0xe371('0x4b')][_0xe371('0x67')]=_0x527052['id'];if(_0x3d2190[_0xe371('0x44')][_0xe371('0x4e')]){_0x45ab25[_0xe371('0x4b')]=_[_0xe371('0x4f')](_0x45ab25[_0xe371('0x4b')],{'$or':_['map'](_0x45ab25[_0xe371('0x47')],function(_0x27c06f){var _0x141294={};_0x141294[_0x27c06f]={'$like':'%'+_0x3d2190[_0xe371('0x44')][_0xe371('0x4e')]+'%'};return _0x141294;})});}_0x45ab25=_[_0xe371('0x4f')]({},_0x45ab25,_0x3d2190[_0xe371('0x51')]);return db[_0xe371('0x68')][_0xe371('0x30')]({'where':_0x45ab25[_0xe371('0x4b')]})[_0xe371('0x38')](function(_0x1e94d2){_0x2e9482[_0xe371('0x30')]=_0x1e94d2;if(_0x3d2190[_0xe371('0x44')][_0xe371('0x6c')]){_0x45ab25['include']=[{'all':!![]}];}return db[_0xe371('0x68')][_0xe371('0x54')](_0x45ab25);})[_0xe371('0x38')](function(_0x434d40){_0x2e9482[_0xe371('0x6d')]=_0x434d40;return _0x2e9482;});}})['then'](respondWithFilteredResult(_0x50b27b,_0x45ab25))[_0xe371('0x2c')](handleError(_0x50b27b,null));};exports['removeDispositions']=function(_0x29bbf1,_0x32ba7f,_0xd0743d){return db[_0xe371('0x53')][_0xe371('0x60')]({'where':{'id':_0x29bbf1[_0xe371('0x56')]['id']}})['then'](handleEntityNotFound(_0x32ba7f,null))[_0xe371('0x38')](function(_0x38562f){if(_0x38562f){return _0x38562f[_0xe371('0x6e')](_0x29bbf1[_0xe371('0x44')]['ids']);}})[_0xe371('0x38')](respondWithStatusCode(_0x32ba7f,null))['catch'](handleError(_0x32ba7f,null));};exports[_0xe371('0x6f')]=function(_0x54a8de,_0x5c52db,_0x3f5ad0){if(_0x54a8de[_0xe371('0x5b')]['id']){delete _0x54a8de[_0xe371('0x5b')]['id'];}return db['WhatsappAccount'][_0xe371('0x60')]({'where':{'id':_0x54a8de[_0xe371('0x56')]['id']}})[_0xe371('0x38')](handleEntityNotFound(_0x5c52db,null))[_0xe371('0x38')](function(_0x565511){if(_0x565511){_0x54a8de[_0xe371('0x5b')][_0xe371('0x67')]=_0x565511['id'];return db[_0xe371('0x70')][_0xe371('0x5a')](_0x54a8de[_0xe371('0x5b')]);}})[_0xe371('0x38')](respondWithResult(_0x5c52db,null))['catch'](handleError(_0x5c52db,null));};exports[_0xe371('0x71')]=function(_0x3597ad,_0x36f662,_0x3c04eb){var _0x1a8801={'raw':![],'where':{}};var _0x166b15={};var _0x4a0c51={'count':0x0,'rows':[]};return db[_0xe371('0x53')][_0xe371('0x72')]({'where':{'id':_0x3597ad[_0xe371('0x56')]['id']}})['then'](handleEntityNotFound(_0x36f662,null))[_0xe371('0x38')](function(_0x242b4e){if(_0x242b4e){_0x166b15[_0xe371('0x59')]=_[_0xe371('0x58')](db[_0xe371('0x70')][_0xe371('0x41')]);_0x166b15['query']=_[_0xe371('0x58')](_0x3597ad['query']);_0x166b15[_0xe371('0x4c')]=_['intersection'](_0x166b15[_0xe371('0x59')],_0x166b15[_0xe371('0x44')]);_0x1a8801['attributes']=_[_0xe371('0x45')](_0x166b15[_0xe371('0x59')],qs[_0xe371('0x46')](_0x3597ad['query'][_0xe371('0x46')]));_0x1a8801[_0xe371('0x47')]=_0x1a8801[_0xe371('0x47')][_0xe371('0x48')]?_0x1a8801['attributes']:_0x166b15[_0xe371('0x59')];if(!_0x3597ad[_0xe371('0x44')][_0xe371('0x6a')](_0xe371('0x6b'))){_0x1a8801['limit']=qs[_0xe371('0x31')](_0x3597ad[_0xe371('0x44')]['limit']);_0x1a8801[_0xe371('0x2f')]=qs[_0xe371('0x2f')](_0x3597ad[_0xe371('0x44')][_0xe371('0x2f')]);}_0x1a8801[_0xe371('0x49')]=qs['sort'](_0x3597ad[_0xe371('0x44')][_0xe371('0x4a')]);_0x1a8801[_0xe371('0x4b')]=qs[_0xe371('0x4c')](_[_0xe371('0x4d')](_0x3597ad['query'],_0x166b15[_0xe371('0x4c')]));_0x1a8801[_0xe371('0x4b')]['WhatsappAccountId']=_0x242b4e['id'];if(_0x3597ad['query'][_0xe371('0x4e')]){_0x1a8801[_0xe371('0x4b')]=_[_0xe371('0x4f')](_0x1a8801['where'],{'$or':_[_0xe371('0x40')](_0x1a8801[_0xe371('0x47')],function(_0x3c8d06){var _0x426dd3={};_0x426dd3[_0x3c8d06]={'$like':'%'+_0x3597ad[_0xe371('0x44')][_0xe371('0x4e')]+'%'};return _0x426dd3;})});}_0x1a8801=_[_0xe371('0x4f')]({},_0x1a8801,_0x3597ad[_0xe371('0x51')]);return db[_0xe371('0x70')][_0xe371('0x30')]({'where':_0x1a8801[_0xe371('0x4b')]})[_0xe371('0x38')](function(_0x2e9ca5){_0x4a0c51[_0xe371('0x30')]=_0x2e9ca5;if(_0x3597ad['query'][_0xe371('0x6c')]){_0x1a8801[_0xe371('0x52')]=[{'all':!![]}];}return db[_0xe371('0x70')]['findAll'](_0x1a8801);})[_0xe371('0x38')](function(_0x4c3407){_0x4a0c51[_0xe371('0x6d')]=_0x4c3407;return _0x4a0c51;});}})['then'](respondWithFilteredResult(_0x36f662,_0x1a8801))[_0xe371('0x2c')](handleError(_0x36f662,null));};exports[_0xe371('0x73')]=function(_0x3b3fcc,_0x4117f6,_0x11624e){return db['WhatsappAccount']['find']({'where':{'id':_0x3b3fcc[_0xe371('0x56')]['id']}})[_0xe371('0x38')](handleEntityNotFound(_0x4117f6,null))[_0xe371('0x38')](function(_0x239364){if(_0x239364){return _0x239364[_0xe371('0x73')](_0x3b3fcc[_0xe371('0x44')][_0xe371('0x74')]);}})[_0xe371('0x38')](respondWithStatusCode(_0x4117f6,null))[_0xe371('0x2c')](handleError(_0x4117f6,null));};exports[_0xe371('0x75')]=function(_0x81903f,_0x2b75d4,_0x5cb61f){return db['WhatsappAccount'][_0xe371('0x60')]({'where':{'id':_0x81903f[_0xe371('0x56')]['id']}})[_0xe371('0x38')](handleEntityNotFound(_0x2b75d4,null))[_0xe371('0x38')](function(_0x3846fe){if(_0x3846fe){return _0x3846fe[_0xe371('0x75')](_0x81903f[_0xe371('0x5b')][_0xe371('0x74')],_[_0xe371('0x76')](_0x81903f[_0xe371('0x5b')],[_0xe371('0x74'),'id'])||{})[_0xe371('0x77')](function(_0x517dd7){for(var _0x3c6e51=0x0;_0x3c6e51<_0x81903f[_0xe371('0x5b')][_0xe371('0x74')]['length'];_0x3c6e51+=0x1){socket[_0xe371('0x78')](_0xe371('0x79'),{'UserId':Number(_0x81903f[_0xe371('0x5b')][_0xe371('0x74')][_0x3c6e51]),'WhatsappAccountId':Number(_0x81903f[_0xe371('0x56')]['id'])});}return _0x517dd7;});}})[_0xe371('0x38')](respondWithResult(_0x2b75d4,null))[_0xe371('0x2c')](handleError(_0x2b75d4,null));};exports['removeAgents']=function(_0x3f66a8,_0x2ab08f,_0x49820f){return db['WhatsappAccount']['find']({'where':{'id':_0x3f66a8[_0xe371('0x56')]['id']}})[_0xe371('0x38')](handleEntityNotFound(_0x2ab08f,null))[_0xe371('0x38')](function(_0x266519){if(_0x266519){return _0x266519[_0xe371('0x7a')](_0x3f66a8[_0xe371('0x44')][_0xe371('0x74')])[_0xe371('0x38')](function(){if(_[_0xe371('0x7b')](_0x3f66a8['query'][_0xe371('0x74')])){for(var _0x53a9ca=0x0;_0x53a9ca<_0x3f66a8['query']['ids']['length'];_0x53a9ca+=0x1){socket['emit'](_0xe371('0x7c'),{'UserId':Number(_0x3f66a8[_0xe371('0x44')][_0xe371('0x74')][_0x53a9ca]),'WhatsappAccountId':Number(_0x3f66a8[_0xe371('0x56')]['id'])});}}else{socket['emit'](_0xe371('0x7c'),{'UserId':Number(_0x3f66a8[_0xe371('0x44')]['ids']),'WhatsappAccountId':Number(_0x3f66a8[_0xe371('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x2ab08f,null))[_0xe371('0x2c')](handleError(_0x2ab08f,null));};exports[_0xe371('0x7d')]=function(_0x1f8093,_0x255631,_0x4bdfd0){var _0x2e7de1={};var _0x5b1af6={};var _0x1d89f7;var _0x5c6bc6;return db[_0xe371('0x53')][_0xe371('0x72')]({'where':{'id':_0x1f8093['params']['id']}})[_0xe371('0x38')](handleEntityNotFound(_0x255631,null))[_0xe371('0x38')](function(_0xdce770){if(_0xdce770){_0x1d89f7=_0xdce770;_0x5b1af6[_0xe371('0x59')]=_[_0xe371('0x58')](db['User']['rawAttributes']);_0x5b1af6['query']=_[_0xe371('0x58')](_0x1f8093[_0xe371('0x44')]);_0x5b1af6['filters']=_['intersection'](_0x5b1af6[_0xe371('0x59')],_0x5b1af6[_0xe371('0x44')]);_0x2e7de1[_0xe371('0x47')]=_[_0xe371('0x45')](_0x5b1af6[_0xe371('0x59')],qs[_0xe371('0x46')](_0x1f8093[_0xe371('0x44')][_0xe371('0x46')]));_0x2e7de1[_0xe371('0x47')]=_0x2e7de1[_0xe371('0x47')]['length']?_0x2e7de1[_0xe371('0x47')]:_0x5b1af6[_0xe371('0x59')];_0x2e7de1[_0xe371('0x49')]=qs[_0xe371('0x4a')](_0x1f8093[_0xe371('0x44')]['sort']);_0x2e7de1[_0xe371('0x4b')]=qs[_0xe371('0x4c')](_[_0xe371('0x4d')](_0x1f8093[_0xe371('0x44')],_0x5b1af6[_0xe371('0x4c')]));if(_0x1f8093[_0xe371('0x44')][_0xe371('0x4e')]){_0x2e7de1['where']=_[_0xe371('0x4f')](_0x2e7de1[_0xe371('0x4b')],{'$or':_[_0xe371('0x40')](_0x2e7de1[_0xe371('0x47')],function(_0x404a3a){var _0x5d046d={};_0x5d046d[_0x404a3a]={'$like':'%'+_0x1f8093['query'][_0xe371('0x4e')]+'%'};return _0x5d046d;})});}_0x2e7de1=_[_0xe371('0x4f')]({},_0x2e7de1,_0x1f8093[_0xe371('0x51')]);return _0x1d89f7[_0xe371('0x7d')](_0x2e7de1);}})[_0xe371('0x38')](function(_0x2e7127){if(_0x2e7127){_0x5c6bc6=_0x2e7127[_0xe371('0x48')];if(!_0x1f8093['query'][_0xe371('0x6a')]('nolimit')){_0x2e7de1['limit']=qs['limit'](_0x1f8093[_0xe371('0x44')][_0xe371('0x31')]);_0x2e7de1[_0xe371('0x2f')]=qs[_0xe371('0x2f')](_0x1f8093[_0xe371('0x44')][_0xe371('0x2f')]);}return _0x1d89f7[_0xe371('0x7d')](_0x2e7de1);}})[_0xe371('0x38')](function(_0x1ac293){if(_0x1ac293){return _0x1ac293?{'count':_0x5c6bc6,'rows':_0x1ac293}:null;}})[_0xe371('0x38')](respondWithResult(_0x255631,null))[_0xe371('0x2c')](handleError(_0x255631,null));};exports[_0xe371('0x7e')]=function(_0x242e74,_0x23ecda){var _0x52a627=_0x242e74[_0xe371('0x56')]['id'];var _0x54071b=_0x242e74['body'];var _0x2ed040=0xc8;var _0x2d1f97=null;return db[_0xe371('0x7f')][_0xe371('0x80')]({'isolationLevel':db[_0xe371('0x7f')][_0xe371('0x81')][_0xe371('0x82')][_0xe371('0x83')]},function(_0x490cbb){return db[_0xe371('0x53')][_0xe371('0x72')]({'where':{'id':_0x52a627},'transaction':_0x490cbb})[_0xe371('0x38')](function(_0x44bb36){if(_0x44bb36){return db[_0xe371('0x84')]['destroy']({'where':{'WhatsappAccountId':_0x52a627},'transaction':_0x490cbb})[_0xe371('0x38')](function(){var _0x1976a7=_[_0xe371('0x40')](_0x54071b,function(_0x4499d1){_0x4499d1['WhatsappAccountId']=_0x52a627;return _0x4499d1;});return db['WhatsappApplication']['bulkCreate'](_0x1976a7,{'transaction':_0x490cbb});});}else{_0x2ed040=0x194;_0x2d1f97=[];}});})[_0xe371('0x38')](function(){if(_0x2ed040!==0x194){return db[_0xe371('0x84')][_0xe371('0x85')]({'where':{'WhatsappAccountId':_0x52a627},'order':_0xe371('0x86')})[_0xe371('0x38')](function(_0x26544b){_0x2d1f97=_0x26544b;});}})['catch'](function(_0x5aa1f3){_0x2ed040=0x1f4;logger[_0xe371('0x28')](_0x5aa1f3[_0xe371('0x3c')]);if(_0x5aa1f3[_0xe371('0x3d')]){delete _0x5aa1f3['name'];}_0x2d1f97=_0x5aa1f3;})[_0xe371('0x87')](function(){if(_0x2d1f97===null){_0x23ecda[_0xe371('0x3b')](_0x2ed040);}else{if(_0x2ed040===0x1f4){_0x23ecda[_0xe371('0x2e')](_0x2ed040)[_0xe371('0x3e')](_0x2d1f97);}else{_0x23ecda[_0xe371('0x2e')](_0x2ed040)[_0xe371('0x34')](_0x2d1f97);}}});};exports[_0xe371('0x88')]=function(_0x4b2ffa,_0x46e5f4,_0x553354){var _0x501cf0={};var _0x5e508b={};var _0x298cf4;var _0x12d22e;return db['WhatsappAccount'][_0xe371('0x72')]({'where':{'id':_0x4b2ffa[_0xe371('0x56')]['id']}})[_0xe371('0x38')](handleEntityNotFound(_0x46e5f4,null))[_0xe371('0x38')](function(_0x59eac4){if(_0x59eac4){_0x298cf4=_0x59eac4;_0x5e508b[_0xe371('0x59')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x5e508b['query']=_[_0xe371('0x58')](_0x4b2ffa['query']);_0x5e508b[_0xe371('0x4c')]=_[_0xe371('0x45')](_0x5e508b[_0xe371('0x59')],_0x5e508b[_0xe371('0x44')]);_0x501cf0[_0xe371('0x47')]=_[_0xe371('0x45')](_0x5e508b['model'],qs[_0xe371('0x46')](_0x4b2ffa[_0xe371('0x44')][_0xe371('0x46')]));_0x501cf0[_0xe371('0x47')]=_0x501cf0['attributes'][_0xe371('0x48')]?_0x501cf0[_0xe371('0x47')]:_0x5e508b[_0xe371('0x59')];_0x501cf0['order']=qs[_0xe371('0x4a')](_0x4b2ffa[_0xe371('0x44')]['sort']);_0x501cf0[_0xe371('0x4b')]=qs[_0xe371('0x4c')](_[_0xe371('0x4d')](_0x4b2ffa[_0xe371('0x44')],_0x5e508b['filters']));if(_0x4b2ffa[_0xe371('0x44')][_0xe371('0x4e')]){_0x501cf0['where']=_['merge'](_0x501cf0[_0xe371('0x4b')],{'$or':_[_0xe371('0x40')](_0x501cf0[_0xe371('0x47')],function(_0x5ce679){var _0x27e0eb={};_0x27e0eb[_0x5ce679]={'$like':'%'+_0x4b2ffa[_0xe371('0x44')][_0xe371('0x4e')]+'%'};return _0x27e0eb;})});}_0x501cf0=_[_0xe371('0x4f')]({},_0x501cf0,_0x4b2ffa['options']);return _0x298cf4[_0xe371('0x88')](_0x501cf0);}})[_0xe371('0x38')](function(_0x9b40d){if(_0x9b40d){_0x12d22e=_0x9b40d[_0xe371('0x48')];if(!_0x4b2ffa[_0xe371('0x44')]['hasOwnProperty'](_0xe371('0x6b'))){_0x501cf0['limit']=qs[_0xe371('0x31')](_0x4b2ffa[_0xe371('0x44')]['limit']);_0x501cf0[_0xe371('0x2f')]=qs[_0xe371('0x2f')](_0x4b2ffa['query'][_0xe371('0x2f')]);}return _0x298cf4[_0xe371('0x88')](_0x501cf0);}})[_0xe371('0x38')](function(_0x4e4653){if(_0x4e4653){return _0x4e4653?{'count':_0x12d22e,'rows':_0x4e4653}:null;}})[_0xe371('0x38')](respondWithResult(_0x46e5f4,null))[_0xe371('0x2c')](handleError(_0x46e5f4,null));};exports[_0xe371('0x89')]=function(_0x507ef9,_0x5abe29,_0x159c66){var _0x12e27a={'channel':_0xe371('0x8a')};var _0x51cbc5=[];var _0x5da882=[];var _0x27f004={};return db[_0xe371('0x53')][_0xe371('0x60')]({'where':{'id':_0x507ef9[_0xe371('0x56')]['id']},'include':[{'model':db[_0xe371('0x84')],'as':_0xe371('0x8b')}]})[_0xe371('0x38')](handleEntityNotFound(_0x5abe29,null))['then'](function(_0x33200f){_0x12e27a[_0xe371('0x8c')]=_0x33200f;if(_0x12e27a[_0xe371('0x8c')]&&_0x12e27a['account']['type']===_0xe371('0x8d')&&_0x507ef9[_0xe371('0x5b')][_0xe371('0x8e')]){if(_0x507ef9['body']['statuses'][_0xe371('0x48')]===0x0)return;if(_0x507ef9[_0xe371('0x5b')][_0xe371('0x8e')][0x0][_0xe371('0x8f')]!==_0xe371('0x90'))return;return db[_0xe371('0x91')][_0xe371('0x65')]({'read':!![],'readAt':_0x507ef9[_0xe371('0x5b')][_0xe371('0x8e')][0x0][_0xe371('0x92')]},{'where':{'messageId':_0x507ef9[_0xe371('0x5b')][_0xe371('0x8e')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x1a0cf1){return _0x5abe29['status'](0xc8)['json'](_0x1a0cf1);});}_0x12e27a[_0xe371('0x93')]=_[_0xe371('0x94')](_0x33200f[_0xe371('0x8b')],[_0xe371('0x86')],[_0xe371('0x95')]);if(_0x12e27a[_0xe371('0x8c')]['Applications']){delete _0x12e27a['account'][_0xe371('0x8b')];}return db[_0xe371('0x96')][_0xe371('0x66')]()[_0xe371('0x38')](function(_0x2e69eb){if(!_0x2e69eb){throw new db[(_0xe371('0x97'))]['ValidationError']('no\x20available\x20attributes');}_0x51cbc5=_[_0xe371('0x98')](_['keys'](_0x2e69eb),[_0xe371('0x99'),'updatedAt']);_0x5da882=_[_0xe371('0x98')](_[_0xe371('0x58')](_0x2e69eb),[_0xe371('0x99'),'updatedAt','CompanyId',_0xe371('0x9a')]);_0x12e27a['body']={'mapKey':'mobile'};if(_0x12e27a['account']&&_0x12e27a['account']['type']===_0xe371('0x9b')){_0x12e27a[_0xe371('0x5b')][_0xe371('0x9c')]=_0x507ef9['body'][_0xe371('0x9d')]['replace'](_0xe371('0x9e'),'');_0x12e27a[_0xe371('0x5b')][_0xe371('0x5b')]=_0x507ef9[_0xe371('0x5b')][_0xe371('0x9f')];_0x12e27a[_0xe371('0x5b')]['messageId']=_0x507ef9[_0xe371('0x5b')][_0xe371('0xa0')];}if(_0x12e27a[_0xe371('0x8c')]&&_0x12e27a['account'][_0xe371('0xa1')]===_0xe371('0x8d')){_0x12e27a[_0xe371('0x5b')][_0xe371('0x9c')]=_0x507ef9['body'][_0xe371('0xa2')][0x0][_0xe371('0x9c')];_0x12e27a[_0xe371('0x5b')][_0xe371('0x5b')]=_0x507ef9[_0xe371('0x5b')][_0xe371('0xa2')][0x0]['message']['body'];_0x12e27a['body'][_0xe371('0xa3')]=_0x507ef9[_0xe371('0x5b')][_0xe371('0xa2')][0x0]['message_id'];}if(_0x12e27a[_0xe371('0x5b')]['id']){delete _0x12e27a['body']['id'];}if(_[_0xe371('0xa4')](_0x12e27a[_0xe371('0x5b')][_0xe371('0x9c')])){throw new db[(_0xe371('0x97'))][(_0xe371('0xa5'))]('from\x20is\x20mandatory');}if(_[_0xe371('0xa4')](_0x12e27a[_0xe371('0x5b')][_0xe371('0x5b')])||_0x12e27a[_0xe371('0x5b')][_0xe371('0x5b')]===''){throw new db[(_0xe371('0x97'))][(_0xe371('0xa5'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe371('0xa4')](_0x12e27a['body']['mapKey'])){throw new db[(_0xe371('0x97'))][(_0xe371('0xa5'))](_0xe371('0xa6')+_0x5da882);}if(!_[_0xe371('0xa7')](_0x5da882,_0x12e27a[_0xe371('0x5b')][_0xe371('0xa8')])){throw new db[(_0xe371('0x97'))][(_0xe371('0xa5'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5da882);}_0x27f004[_0x12e27a[_0xe371('0x5b')][_0xe371('0xa8')]]=_0x12e27a[_0xe371('0x5b')][_0xe371('0x9c')];return db[_0xe371('0xa9')][_0xe371('0x60')]({'where':{'id':_0x12e27a[_0xe371('0x8c')][_0xe371('0x9a')]},'include':[{'model':db[_0xe371('0x96')],'as':_0xe371('0xaa'),'where':_0x27f004,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xe371('0x38')](handleEntityNotFound(_0x5abe29,null))['then'](function(_0x3eb135){if(_0x3eb135){_0x12e27a[_0xe371('0xab')]=_['omit'](_0x3eb135,[_0xe371('0xaa')]);if(_0x3eb135[_0xe371('0xaa')][_0xe371('0x48')]){return _0x3eb135[_0xe371('0xaa')][0x0];}var _0x55e7cf=_[_0xe371('0x1b')](_0x12e27a[_0xe371('0x5b')],{'firstName':_0x12e27a[_0xe371('0x5b')]['from'],'ListId':_0x3eb135['id']});_0x55e7cf[_0x12e27a[_0xe371('0x5b')][_0xe371('0xa8')]]=_0x12e27a['body'][_0xe371('0x9c')];return db[_0xe371('0x96')]['create'](_0x55e7cf,{'fields':_0x51cbc5,'raw':!![]});}})[_0xe371('0x38')](handleEntityNotFound(_0x5abe29,null))[_0xe371('0x38')](function(_0x1f3e6d){if(_0x1f3e6d){_0x12e27a['contact']=_0x1f3e6d;var _0x552a4e={'ContactId':_0x1f3e6d['id'],'phone':_0x12e27a[_0xe371('0x5b')][_0xe371('0x9c')],'WhatsappAccountId':_0x507ef9[_0xe371('0x56')]['id']};var _0x39aee0={'ContactId':_0x1f3e6d['id'],'WhatsappAccountId':_0x507ef9[_0xe371('0x56')]['id'],'closed':![]};return db[_0xe371('0xac')][_0xe371('0x60')]({'where':_0x39aee0})[_0xe371('0x38')](function(_0x3bd163){if(_0x3bd163){return[_0x3bd163,![]];}return db[_0xe371('0xac')][_0xe371('0x5a')](_0x552a4e)[_0xe371('0x38')](function(_0x89a510){return[_0x89a510,!![]];});});}})[_0xe371('0x77')](function(_0x1e7364,_0x587933){_0x12e27a[_0xe371('0xad')]=_0x1e7364['get']({'plain':!![]});_0x12e27a['interaction'][_0xe371('0xae')]=![];if(_0x587933){if(_0x12e27a[_0xe371('0x8c')][_0xe371('0xaf')]){_0x12e27a['applications'][_0xe371('0xb0')]({'id':0x0,'priority':_0x12e27a[_0xe371('0x93')][_0xe371('0x48')]+0x1,'app':_0xe371('0xb1'),'appdata':'unmanaged','interval':_0xe371('0xb2')});}_0x12e27a[_0xe371('0xad')][_0xe371('0xae')]=!![];}return db['WhatsappMessage'][_0xe371('0x5a')]({'phone':_0x12e27a[_0xe371('0x5b')][_0xe371('0x9c')],'messageId':_0x12e27a['body'][_0xe371('0xa3')],'body':_0x12e27a[_0xe371('0x5b')][_0xe371('0x5b')],'WhatsappAccountId':_0x507ef9['params']['id'],'WhatsappInteractionId':_0x1e7364['id'],'direction':'in','ContactId':_0x1e7364['ContactId'],'AttachmentId':_0x12e27a[_0xe371('0x5b')][_0xe371('0xb3')]});})[_0xe371('0x38')](function(_0x3b9fc4){_0x12e27a['message']=_0x3b9fc4;if(_0x12e27a[_0xe371('0xad')][_0xe371('0xb4')]){return db[_0xe371('0xb5')][_0xe371('0x60')]({'attributes':['id','name'],'where':{'id':_0x12e27a[_0xe371('0xad')]['UserId']}})[_0xe371('0x38')](function(_0x115d33){if(_0x115d33){_0x12e27a[_0xe371('0x93')][_0xe371('0xb6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x115d33['name']+','+(_0x12e27a[_0xe371('0x8c')][_0xe371('0xb7')]||0xa),'interval':_0xe371('0xb2')});}return respondWithRpcPromise(_0xe371('0xb8'),_0xe371('0xb9'),_0x12e27a);});}return respondWithRpcPromise(_0xe371('0xb8'),_0xe371('0xb9'),_0x12e27a);})[_0xe371('0x38')](function(_0x19e896){if(_0x19e896){var _0x53f00c=0xc8;var _0x10bd19='receiveMessage';logger[_0xe371('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x10bd19,_0x53f00c,_0xe371('0xba'));logger['debug'](_0xe371('0xbb'),_0x10bd19,_0x53f00c,_0xe371('0xba'),JSON['stringify'](_0x19e896));if(_0x12e27a['account']['type']===_0xe371('0x9b')){return _0x5abe29['status'](_0x53f00c)[_0xe371('0x32')](_0xe371('0xbc'),_0xe371('0xbd'))[_0xe371('0x3e')](_0xe371('0xbe'));}else{return _0x5abe29[_0xe371('0x2e')](_0x53f00c)[_0xe371('0x34')](_0x19e896);}}});})[_0xe371('0x2c')](handleError(_0x5abe29,null));};exports[_0xe371('0x3e')]=function(_0xefd085,_0x2c98d1,_0x282fa1){var _0x2674a1,_0x584906,_0x1dad82;if(_[_0xe371('0xa4')](_0xefd085[_0xe371('0x5b')]['body'])||_0xefd085['body'][_0xe371('0x5b')]===''){throw new db[(_0xe371('0x97'))]['ValidationError'](_0xe371('0xbf'));}if(_[_0xe371('0xa4')](_0xefd085[_0xe371('0x5b')]['to'])){throw new db[(_0xe371('0x97'))][(_0xe371('0xa5'))](_0xe371('0xc0'));}_0x2674a1=_0xefd085[_0xe371('0x5b')]['to'];return db['WhatsappAccount'][_0xe371('0x60')]({'where':{'id':_0xefd085[_0xe371('0x56')]['id']},'include':[{'model':db[_0xe371('0xa9')],'as':_0xe371('0xc1'),'include':[{'model':db['CmContact'],'as':_0xe371('0xaa'),'where':{'mobile':_0x2674a1},'limit':0x1,'order':[['updatedAt',_0xe371('0xc2')]]}]}]})[_0xe371('0x38')](handleEntityNotFound(_0x2c98d1,null))[_0xe371('0x38')](function(_0x6c44c1){if(_0x6c44c1&&_0x6c44c1[_0xe371('0xc1')]){_0x584906=_0x6c44c1[_0xe371('0x5d')]({'plain':!![]});if(_0x584906[_0xe371('0xc1')]&&_0x584906['List']['Contacts'][_0xe371('0x48')]){return _0x584906['List'][_0xe371('0xaa')][0x0];}return db['CmContact'][_0xe371('0x5a')](_[_0xe371('0x1b')](_0xefd085['body'],{'firstName':_0x2674a1,'mobile':_0x2674a1,'phone':_0x2674a1,'ListId':_0x584906[_0xe371('0x9a')]}));}})['then'](handleEntityNotFound(_0x2c98d1,null))[_0xe371('0x38')](function(_0x2a3e26){if(_0x2a3e26){_0x1dad82=_0x2a3e26;return db[_0xe371('0xac')][_0xe371('0x60')]({'where':{'ContactId':_0x1dad82['id'],'closed':![],'WhatsappAccountId':_0x584906['id']}})[_0xe371('0x38')](function(_0x4e81e9){if(_0x4e81e9){return[_0x4e81e9,![]];}return db[_0xe371('0xac')][_0xe371('0x5a')]({'UserId':_0xefd085[_0xe371('0x5c')]['id'],'ContactId':_0x1dad82['id'],'WhatsappAccountId':_0x584906['id'],'phone':_0x2674a1,'firstMsgDirection':'out','Messages':[_['merge'](_0xefd085['body'],{'read':![],'body':_0xefd085['body'][_0xe371('0x5b')],'phone':_0x2674a1,'WhatsappAccountId':_0x584906['id'],'UserId':_0xefd085[_0xe371('0x5c')]['id'],'ContactId':_0x1dad82['id']})]},{'include':[{'model':db[_0xe371('0x91')],'as':_0xe371('0xc3')}]})['then'](function(_0x8df677){return[_0x8df677,!![]];});});}})[_0xe371('0x77')](function(_0x35dc88,_0xbb6dc8){if(_0xbb6dc8){return _0x35dc88;}return db[_0xe371('0x91')][_0xe371('0x5a')](_['merge'](_0xefd085[_0xe371('0x5b')],{'read':![],'body':_0xefd085['body'][_0xe371('0x5b')],'phone':_0x2674a1,'WhatsappAccountId':_0x584906['id'],'WhatsappInteractionId':_0x35dc88['id'],'UserId':_0xefd085['user']['id'],'ContactId':_0x1dad82['id']}))[_0xe371('0x38')](function(_0x356bec){_0x35dc88[_0xe371('0xc4')][_0xe371('0xc3')]=[];_0x35dc88['dataValues'][_0xe371('0xc3')][_0xe371('0xb0')](_0x356bec['dataValues']);return _0x35dc88;});})[_0xe371('0x38')](respondWithResult(_0x2c98d1,null))[_0xe371('0x2c')](handleError(_0x2c98d1,null));}; \ No newline at end of file +var _0xcf33=['getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','Applications','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','Contacts','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','to\x20is\x20mandatory','List','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','status','end','json','offset','undefined','count','set','Content-Range','apply','update','get','WhatsappAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer'];(function(_0x37c04a,_0x3bee5b){var _0x149e7f=function(_0x199835){while(--_0x199835){_0x37c04a['push'](_0x37c04a['shift']());}};_0x149e7f(++_0x3bee5b);}(_0xcf33,0x115));var _0x3cf3=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xcf33[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0x3cf3('0x0'));var rimraf=require(_0x3cf3('0x1'));var zipdir=require(_0x3cf3('0x2'));var jsonpatch=require(_0x3cf3('0x3'));var rp=require(_0x3cf3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3cf3('0x5'));var path=require(_0x3cf3('0x6'));var sox=require(_0x3cf3('0x7'));var csv=require(_0x3cf3('0x8'));var ejs=require(_0x3cf3('0x9'));var fs=require('fs');var fs_extra=require(_0x3cf3('0xa'));var _=require('lodash');var squel=require(_0x3cf3('0xb'));var crypto=require(_0x3cf3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3cf3('0xd'));var toCsv=require(_0x3cf3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3cf3('0xe'));var authService=require(_0x3cf3('0xf'));var qs=require(_0x3cf3('0x10'));var as=require(_0x3cf3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cf3('0x12'))(_0x3cf3('0x13'));var utils=require(_0x3cf3('0x14'));var config=require(_0x3cf3('0x15'));var licenseUtil=require(_0x3cf3('0x16'));var db=require(_0x3cf3('0x17'))['db'];config[_0x3cf3('0x18')]=_[_0x3cf3('0x19')](config[_0x3cf3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3cf3('0x1a'))(new Redis(config['redis']));require(_0x3cf3('0x1b'))['register'](socket);var jayson=require(_0x3cf3('0x1c'));var client=jayson['client'][_0x3cf3('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3fe925,_0x30467b,_0x12d1cd,_0x578fb6){return new BPromise(function(_0x49af2f,_0x5c2ed7){var _0x263cd0=_0x578fb6||client;return _0x263cd0[_0x3cf3('0x1e')](_0x3fe925,_0x12d1cd)[_0x3cf3('0x1f')](function(_0x18e781){logger[_0x3cf3('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x30467b,'request\x20sent');logger[_0x3cf3('0x21')](_0x3cf3('0x22'),_0x30467b,_0x3cf3('0x23'),JSON[_0x3cf3('0x24')](_0x18e781));if(_0x18e781[_0x3cf3('0x25')]){if(_0x18e781[_0x3cf3('0x25')]['code']===0x1f4){logger[_0x3cf3('0x25')](_0x3cf3('0x26'),_0x30467b,_0x18e781[_0x3cf3('0x25')]['message']);return _0x5c2ed7(_0x18e781['error']['message']);}logger[_0x3cf3('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x30467b,_0x18e781[_0x3cf3('0x25')][_0x3cf3('0x27')]);return _0x49af2f(_0x18e781[_0x3cf3('0x25')][_0x3cf3('0x27')]);}else{logger['info'](_0x3cf3('0x26'),_0x30467b,_0x3cf3('0x23'));_0x49af2f(_0x18e781['result']['message']);}})['catch'](function(_0x14afd0){logger[_0x3cf3('0x25')](_0x3cf3('0x26'),_0x30467b,_0x14afd0);_0x5c2ed7(_0x14afd0);});});}function respondWithStatusCode(_0x2ee5e6,_0x144e6a){_0x144e6a=_0x144e6a||0xcc;return function(_0x579b71){if(_0x579b71){return _0x2ee5e6['sendStatus'](_0x144e6a);}return _0x2ee5e6[_0x3cf3('0x28')](_0x144e6a)[_0x3cf3('0x29')]();};}function respondWithResult(_0x1e0013,_0x37d10d){_0x37d10d=_0x37d10d||0xc8;return function(_0x3852fd){if(_0x3852fd){return _0x1e0013['status'](_0x37d10d)[_0x3cf3('0x2a')](_0x3852fd);}};}function respondWithFilteredResult(_0x1b4463,_0x5ffe77){return function(_0x505f22){if(_0x505f22){var _0x3e0fa6=typeof _0x5ffe77[_0x3cf3('0x2b')]===_0x3cf3('0x2c')&&typeof _0x5ffe77['limit']===_0x3cf3('0x2c');var _0x5c87a8=_0x505f22[_0x3cf3('0x2d')];var _0x4894a3=_0x3e0fa6?0x0:_0x5ffe77[_0x3cf3('0x2b')];var _0x37fa04=_0x3e0fa6?_0x505f22['count']:_0x5ffe77[_0x3cf3('0x2b')]+_0x5ffe77['limit'];var _0x2f3eb2;if(_0x37fa04>=_0x5c87a8){_0x37fa04=_0x5c87a8;_0x2f3eb2=0xc8;}else{_0x2f3eb2=0xce;}_0x1b4463[_0x3cf3('0x28')](_0x2f3eb2);return _0x1b4463[_0x3cf3('0x2e')](_0x3cf3('0x2f'),_0x4894a3+'-'+_0x37fa04+'/'+_0x5c87a8)['json'](_0x505f22);}return null;};}function patchUpdates(_0x129138){return function(_0x3fc733){try{jsonpatch[_0x3cf3('0x30')](_0x3fc733,_0x129138,!![]);}catch(_0x3424c0){return BPromise['reject'](_0x3424c0);}return _0x3fc733['save']();};}function saveUpdates(_0x280903,_0xbe256c){return function(_0x494990){if(_0x494990){return _0x494990[_0x3cf3('0x31')](_0x280903)[_0x3cf3('0x1f')](function(_0x3bde7a){return _0x3bde7a;});}return null;};}function removeEntity(_0x44d8d4,_0x482594){return function(_0x4bd23b){if(_0x4bd23b){return _0x4bd23b['destroy']()['then'](function(){var _0x34ab54=_0x4bd23b[_0x3cf3('0x32')]({'plain':!![]});var _0x282077=_0x3cf3('0x33');return db[_0x3cf3('0x34')][_0x3cf3('0x35')]({'where':{'type':_0x282077,'resourceId':_0x34ab54['id']}})[_0x3cf3('0x1f')](function(){return _0x4bd23b;});})[_0x3cf3('0x1f')](function(){_0x44d8d4[_0x3cf3('0x28')](0xcc)[_0x3cf3('0x29')]();});}};}function handleEntityNotFound(_0x2e8a45,_0x4e70a3){return function(_0x4e9f54){if(!_0x4e9f54){_0x2e8a45[_0x3cf3('0x36')](0x194);}return _0x4e9f54;};}function handleError(_0x3024b9,_0x39614a){_0x39614a=_0x39614a||0x1f4;return function(_0x31e829){logger[_0x3cf3('0x25')](_0x31e829[_0x3cf3('0x37')]);if(_0x31e829[_0x3cf3('0x38')]){delete _0x31e829[_0x3cf3('0x38')];}_0x3024b9[_0x3cf3('0x28')](_0x39614a)[_0x3cf3('0x39')](_0x31e829);};}exports[_0x3cf3('0x3a')]=function(_0x6c6fe4,_0xb115ce){var _0x359a23={'include':[{'model':db[_0x3cf3('0x3b')],'as':'mandatoryDispositionPause'}]},_0x6d43b0={},_0x206da0={'count':0x0,'rows':[]};var _0x28ccc1=_[_0x3cf3('0x3c')](db[_0x3cf3('0x3d')][_0x3cf3('0x3e')],function(_0x4de326){return{'name':_0x4de326[_0x3cf3('0x3f')],'type':_0x4de326[_0x3cf3('0x40')][_0x3cf3('0x41')]};});_0x6d43b0[_0x3cf3('0x42')]=_[_0x3cf3('0x3c')](_0x28ccc1,'name');_0x6d43b0[_0x3cf3('0x43')]=_['keys'](_0x6c6fe4[_0x3cf3('0x43')]);_0x6d43b0['filters']=_[_0x3cf3('0x44')](_0x6d43b0[_0x3cf3('0x42')],_0x6d43b0[_0x3cf3('0x43')]);_0x359a23[_0x3cf3('0x45')]=_[_0x3cf3('0x44')](_0x6d43b0[_0x3cf3('0x42')],qs['fields'](_0x6c6fe4[_0x3cf3('0x43')][_0x3cf3('0x46')]));_0x359a23[_0x3cf3('0x45')]=_0x359a23['attributes'][_0x3cf3('0x47')]?_0x359a23[_0x3cf3('0x45')]:_0x6d43b0['model'];if(!_0x6c6fe4[_0x3cf3('0x43')][_0x3cf3('0x48')](_0x3cf3('0x49'))){_0x359a23[_0x3cf3('0x4a')]=qs['limit'](_0x6c6fe4[_0x3cf3('0x43')][_0x3cf3('0x4a')]);_0x359a23[_0x3cf3('0x2b')]=qs['offset'](_0x6c6fe4[_0x3cf3('0x43')][_0x3cf3('0x2b')]);}_0x359a23[_0x3cf3('0x4b')]=qs[_0x3cf3('0x4c')](_0x6c6fe4[_0x3cf3('0x43')][_0x3cf3('0x4c')]);_0x359a23[_0x3cf3('0x4d')]=qs[_0x3cf3('0x4e')](_[_0x3cf3('0x4f')](_0x6c6fe4[_0x3cf3('0x43')],_0x6d43b0[_0x3cf3('0x4e')]),_0x28ccc1);if(_0x6c6fe4[_0x3cf3('0x43')]['filter']){_0x359a23[_0x3cf3('0x4d')]=_[_0x3cf3('0x50')](_0x359a23[_0x3cf3('0x4d')],{'$or':_[_0x3cf3('0x3c')](_0x28ccc1,function(_0x5b9596){if(_0x5b9596['type']!==_0x3cf3('0x51')){var _0xab3db={};_0xab3db[_0x5b9596[_0x3cf3('0x38')]]={'$like':'%'+_0x6c6fe4[_0x3cf3('0x43')][_0x3cf3('0x52')]+'%'};return _0xab3db;}})});}_0x359a23=_[_0x3cf3('0x50')]({},_0x359a23,_0x6c6fe4[_0x3cf3('0x53')]);var _0x3dc342={'where':_0x359a23[_0x3cf3('0x4d')]};return db[_0x3cf3('0x3d')][_0x3cf3('0x2d')](_0x3dc342)[_0x3cf3('0x1f')](function(_0x7c7102){_0x206da0[_0x3cf3('0x2d')]=_0x7c7102;if(_0x6c6fe4[_0x3cf3('0x43')][_0x3cf3('0x54')]){_0x359a23[_0x3cf3('0x55')]=[{'all':!![]}];}return db[_0x3cf3('0x3d')][_0x3cf3('0x56')](_0x359a23);})[_0x3cf3('0x1f')](function(_0x49e119){_0x206da0[_0x3cf3('0x57')]=_0x49e119;return _0x206da0;})[_0x3cf3('0x1f')](respondWithFilteredResult(_0xb115ce,_0x359a23))[_0x3cf3('0x58')](handleError(_0xb115ce,null));};exports[_0x3cf3('0x59')]=function(_0x2349d3,_0x545368){var _0x21e4ee={'raw':![],'where':{'id':_0x2349d3[_0x3cf3('0x5a')]['id']},'include':[{'model':db[_0x3cf3('0x3b')],'as':_0x3cf3('0x5b')}]},_0x37152e={};_0x37152e[_0x3cf3('0x42')]=_[_0x3cf3('0x5c')](db['WhatsappAccount']['rawAttributes']);_0x37152e['query']=_['keys'](_0x2349d3[_0x3cf3('0x43')]);_0x37152e[_0x3cf3('0x4e')]=_[_0x3cf3('0x44')](_0x37152e[_0x3cf3('0x42')],_0x37152e[_0x3cf3('0x43')]);_0x21e4ee[_0x3cf3('0x45')]=_[_0x3cf3('0x44')](_0x37152e[_0x3cf3('0x42')],qs['fields'](_0x2349d3[_0x3cf3('0x43')]['fields']));_0x21e4ee['attributes']=_0x21e4ee[_0x3cf3('0x45')][_0x3cf3('0x47')]?_0x21e4ee[_0x3cf3('0x45')]:_0x37152e[_0x3cf3('0x42')];if(_0x2349d3['query']['includeAll']){_0x21e4ee[_0x3cf3('0x55')]=[{'all':!![]}];}_0x21e4ee=_[_0x3cf3('0x50')]({},_0x21e4ee,_0x2349d3[_0x3cf3('0x53')]);return db[_0x3cf3('0x3d')][_0x3cf3('0x5d')](_0x21e4ee)[_0x3cf3('0x1f')](handleEntityNotFound(_0x545368,null))[_0x3cf3('0x1f')](respondWithResult(_0x545368,null))[_0x3cf3('0x58')](handleError(_0x545368,null));};exports[_0x3cf3('0x5e')]=function(_0x388cc3,_0x12fbf8){return db[_0x3cf3('0x3d')][_0x3cf3('0x5e')](_0x388cc3[_0x3cf3('0x5f')],{})[_0x3cf3('0x1f')](function(_0x5e9252){var _0x19818c=_0x388cc3['user'][_0x3cf3('0x32')]({'plain':!![]});if(!_0x19818c)throw new Error(_0x3cf3('0x60'));if(_0x19818c[_0x3cf3('0x61')]===_0x3cf3('0x62')){var _0x40ab76=_0x5e9252['get']({'plain':!![]});var _0x272c4c=_0x3cf3('0x33');return db[_0x3cf3('0x63')][_0x3cf3('0x5d')]({'where':{'name':_0x272c4c,'userProfileId':_0x19818c[_0x3cf3('0x64')]},'raw':!![]})[_0x3cf3('0x1f')](function(_0x920cb6){if(_0x920cb6&&_0x920cb6[_0x3cf3('0x65')]===0x0){return db[_0x3cf3('0x34')]['create']({'name':_0x40ab76[_0x3cf3('0x38')],'resourceId':_0x40ab76['id'],'type':_0x920cb6[_0x3cf3('0x38')],'sectionId':_0x920cb6['id']},{})[_0x3cf3('0x1f')](function(){return _0x5e9252;});}else{return _0x5e9252;}})[_0x3cf3('0x58')](function(_0x1281a5){logger[_0x3cf3('0x25')](_0x3cf3('0x66'),_0x1281a5);throw _0x1281a5;});}return _0x5e9252;})['then'](respondWithResult(_0x12fbf8,0xc9))[_0x3cf3('0x58')](handleError(_0x12fbf8,null));};exports[_0x3cf3('0x31')]=function(_0x3d88c7,_0x413e3d){if(_0x3d88c7[_0x3cf3('0x5f')]['id']){delete _0x3d88c7[_0x3cf3('0x5f')]['id'];}return db[_0x3cf3('0x3d')][_0x3cf3('0x5d')]({'where':{'id':_0x3d88c7[_0x3cf3('0x5a')]['id']},'include':[{'model':db[_0x3cf3('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x3cf3('0x1f')](handleEntityNotFound(_0x413e3d,null))[_0x3cf3('0x1f')](saveUpdates(_0x3d88c7[_0x3cf3('0x5f')],null))[_0x3cf3('0x1f')](respondWithResult(_0x413e3d,null))[_0x3cf3('0x58')](handleError(_0x413e3d,null));};exports[_0x3cf3('0x35')]=function(_0x4b7139,_0x1c8ecb){return db[_0x3cf3('0x3d')][_0x3cf3('0x5d')]({'where':{'id':_0x4b7139[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x1c8ecb,null))[_0x3cf3('0x1f')](removeEntity(_0x1c8ecb,null))['catch'](handleError(_0x1c8ecb,null));};exports[_0x3cf3('0x67')]=function(_0x4bd182,_0x5def66){return db['WhatsappAccount']['describe']()[_0x3cf3('0x1f')](respondWithResult(_0x5def66,null))['catch'](handleError(_0x5def66,null));};exports['addDisposition']=function(_0x47ea5b,_0x46ef8f,_0x4eabe7){if(_0x47ea5b[_0x3cf3('0x5f')]['id']){delete _0x47ea5b[_0x3cf3('0x5f')]['id'];}return db[_0x3cf3('0x3d')]['find']({'where':{'id':_0x47ea5b['params']['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x46ef8f,null))[_0x3cf3('0x1f')](function(_0x2fa8c3){if(_0x2fa8c3){_0x47ea5b['body'][_0x3cf3('0x68')]=_0x2fa8c3['id'];return db[_0x3cf3('0x69')]['create'](_0x47ea5b[_0x3cf3('0x5f')]);}})[_0x3cf3('0x1f')](respondWithResult(_0x46ef8f,null))[_0x3cf3('0x58')](handleError(_0x46ef8f,null));};exports[_0x3cf3('0x6a')]=function(_0x1ceea7,_0x356a40,_0xf23585){var _0x48afeb={'raw':![],'where':{}};var _0x217745={};var _0xbf30ae={'count':0x0,'rows':[]};return db[_0x3cf3('0x3d')][_0x3cf3('0x6b')]({'where':{'id':_0x1ceea7[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x356a40,null))[_0x3cf3('0x1f')](function(_0x4b3515){if(_0x4b3515){_0x217745['model']=_['keys'](db[_0x3cf3('0x69')][_0x3cf3('0x3e')]);_0x217745[_0x3cf3('0x43')]=_[_0x3cf3('0x5c')](_0x1ceea7[_0x3cf3('0x43')]);_0x217745[_0x3cf3('0x4e')]=_['intersection'](_0x217745[_0x3cf3('0x42')],_0x217745[_0x3cf3('0x43')]);_0x48afeb[_0x3cf3('0x45')]=_[_0x3cf3('0x44')](_0x217745['model'],qs['fields'](_0x1ceea7['query'][_0x3cf3('0x46')]));_0x48afeb['attributes']=_0x48afeb[_0x3cf3('0x45')][_0x3cf3('0x47')]?_0x48afeb['attributes']:_0x217745['model'];if(!_0x1ceea7[_0x3cf3('0x43')]['hasOwnProperty'](_0x3cf3('0x49'))){_0x48afeb[_0x3cf3('0x4a')]=qs['limit'](_0x1ceea7[_0x3cf3('0x43')]['limit']);_0x48afeb['offset']=qs[_0x3cf3('0x2b')](_0x1ceea7[_0x3cf3('0x43')]['offset']);}_0x48afeb[_0x3cf3('0x4b')]=qs[_0x3cf3('0x4c')](_0x1ceea7[_0x3cf3('0x43')][_0x3cf3('0x4c')]);_0x48afeb[_0x3cf3('0x4d')]=qs[_0x3cf3('0x4e')](_[_0x3cf3('0x4f')](_0x1ceea7[_0x3cf3('0x43')],_0x217745[_0x3cf3('0x4e')]));_0x48afeb[_0x3cf3('0x4d')]['WhatsappAccountId']=_0x4b3515['id'];if(_0x1ceea7['query'][_0x3cf3('0x52')]){_0x48afeb[_0x3cf3('0x4d')]=_[_0x3cf3('0x50')](_0x48afeb[_0x3cf3('0x4d')],{'$or':_[_0x3cf3('0x3c')](_0x48afeb[_0x3cf3('0x45')],function(_0xa96cb3){var _0x40d2fc={};_0x40d2fc[_0xa96cb3]={'$like':'%'+_0x1ceea7[_0x3cf3('0x43')][_0x3cf3('0x52')]+'%'};return _0x40d2fc;})});}_0x48afeb=_[_0x3cf3('0x50')]({},_0x48afeb,_0x1ceea7['options']);return db[_0x3cf3('0x69')][_0x3cf3('0x2d')]({'where':_0x48afeb[_0x3cf3('0x4d')]})[_0x3cf3('0x1f')](function(_0x205749){_0xbf30ae['count']=_0x205749;if(_0x1ceea7[_0x3cf3('0x43')][_0x3cf3('0x54')]){_0x48afeb[_0x3cf3('0x55')]=[{'all':!![]}];}return db[_0x3cf3('0x69')][_0x3cf3('0x56')](_0x48afeb);})[_0x3cf3('0x1f')](function(_0x30a695){_0xbf30ae[_0x3cf3('0x57')]=_0x30a695;return _0xbf30ae;});}})[_0x3cf3('0x1f')](respondWithFilteredResult(_0x356a40,_0x48afeb))[_0x3cf3('0x58')](handleError(_0x356a40,null));};exports[_0x3cf3('0x6c')]=function(_0x4e7500,_0x17c817,_0x3fabe2){return db['WhatsappAccount'][_0x3cf3('0x5d')]({'where':{'id':_0x4e7500[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x17c817,null))[_0x3cf3('0x1f')](function(_0x58f39c){if(_0x58f39c){return _0x58f39c['removeDispositions'](_0x4e7500[_0x3cf3('0x43')][_0x3cf3('0x6d')]);}})[_0x3cf3('0x1f')](respondWithStatusCode(_0x17c817,null))[_0x3cf3('0x58')](handleError(_0x17c817,null));};exports['addAnswer']=function(_0x5eba9b,_0x37d2b2,_0x5888b7){if(_0x5eba9b[_0x3cf3('0x5f')]['id']){delete _0x5eba9b['body']['id'];}return db[_0x3cf3('0x3d')][_0x3cf3('0x5d')]({'where':{'id':_0x5eba9b[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x37d2b2,null))[_0x3cf3('0x1f')](function(_0x53405e){if(_0x53405e){_0x5eba9b['body'][_0x3cf3('0x68')]=_0x53405e['id'];return db[_0x3cf3('0x6e')][_0x3cf3('0x5e')](_0x5eba9b[_0x3cf3('0x5f')]);}})[_0x3cf3('0x1f')](respondWithResult(_0x37d2b2,null))['catch'](handleError(_0x37d2b2,null));};exports[_0x3cf3('0x6f')]=function(_0x2642a5,_0x1a3d44,_0x126914){var _0x42b6da={'raw':![],'where':{}};var _0x1e4bd2={};var _0x3a7f3f={'count':0x0,'rows':[]};return db[_0x3cf3('0x3d')][_0x3cf3('0x6b')]({'where':{'id':_0x2642a5[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x1a3d44,null))['then'](function(_0x1f12fd){if(_0x1f12fd){_0x1e4bd2[_0x3cf3('0x42')]=_['keys'](db[_0x3cf3('0x6e')][_0x3cf3('0x3e')]);_0x1e4bd2['query']=_[_0x3cf3('0x5c')](_0x2642a5[_0x3cf3('0x43')]);_0x1e4bd2[_0x3cf3('0x4e')]=_['intersection'](_0x1e4bd2['model'],_0x1e4bd2[_0x3cf3('0x43')]);_0x42b6da[_0x3cf3('0x45')]=_[_0x3cf3('0x44')](_0x1e4bd2[_0x3cf3('0x42')],qs[_0x3cf3('0x46')](_0x2642a5[_0x3cf3('0x43')][_0x3cf3('0x46')]));_0x42b6da[_0x3cf3('0x45')]=_0x42b6da['attributes'][_0x3cf3('0x47')]?_0x42b6da[_0x3cf3('0x45')]:_0x1e4bd2['model'];if(!_0x2642a5[_0x3cf3('0x43')][_0x3cf3('0x48')](_0x3cf3('0x49'))){_0x42b6da[_0x3cf3('0x4a')]=qs[_0x3cf3('0x4a')](_0x2642a5[_0x3cf3('0x43')]['limit']);_0x42b6da['offset']=qs[_0x3cf3('0x2b')](_0x2642a5[_0x3cf3('0x43')][_0x3cf3('0x2b')]);}_0x42b6da[_0x3cf3('0x4b')]=qs[_0x3cf3('0x4c')](_0x2642a5[_0x3cf3('0x43')]['sort']);_0x42b6da[_0x3cf3('0x4d')]=qs['filters'](_['pick'](_0x2642a5[_0x3cf3('0x43')],_0x1e4bd2[_0x3cf3('0x4e')]));_0x42b6da[_0x3cf3('0x4d')][_0x3cf3('0x68')]=_0x1f12fd['id'];if(_0x2642a5[_0x3cf3('0x43')][_0x3cf3('0x52')]){_0x42b6da[_0x3cf3('0x4d')]=_[_0x3cf3('0x50')](_0x42b6da[_0x3cf3('0x4d')],{'$or':_[_0x3cf3('0x3c')](_0x42b6da[_0x3cf3('0x45')],function(_0x1cdea4){var _0x3c6da1={};_0x3c6da1[_0x1cdea4]={'$like':'%'+_0x2642a5[_0x3cf3('0x43')][_0x3cf3('0x52')]+'%'};return _0x3c6da1;})});}_0x42b6da=_['merge']({},_0x42b6da,_0x2642a5['options']);return db[_0x3cf3('0x6e')][_0x3cf3('0x2d')]({'where':_0x42b6da[_0x3cf3('0x4d')]})[_0x3cf3('0x1f')](function(_0x4f1d5f){_0x3a7f3f[_0x3cf3('0x2d')]=_0x4f1d5f;if(_0x2642a5[_0x3cf3('0x43')][_0x3cf3('0x54')]){_0x42b6da[_0x3cf3('0x55')]=[{'all':!![]}];}return db[_0x3cf3('0x6e')][_0x3cf3('0x56')](_0x42b6da);})['then'](function(_0x270bef){_0x3a7f3f['rows']=_0x270bef;return _0x3a7f3f;});}})[_0x3cf3('0x1f')](respondWithFilteredResult(_0x1a3d44,_0x42b6da))[_0x3cf3('0x58')](handleError(_0x1a3d44,null));};exports['removeAnswers']=function(_0x2e7b97,_0x37f5b6,_0x434637){return db[_0x3cf3('0x3d')]['find']({'where':{'id':_0x2e7b97['params']['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x37f5b6,null))[_0x3cf3('0x1f')](function(_0x522c8a){if(_0x522c8a){return _0x522c8a[_0x3cf3('0x70')](_0x2e7b97[_0x3cf3('0x43')][_0x3cf3('0x6d')]);}})['then'](respondWithStatusCode(_0x37f5b6,null))[_0x3cf3('0x58')](handleError(_0x37f5b6,null));};exports[_0x3cf3('0x71')]=function(_0x3eda47,_0x5bba9d,_0x113a31){return db[_0x3cf3('0x3d')][_0x3cf3('0x5d')]({'where':{'id':_0x3eda47[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x5bba9d,null))['then'](function(_0x24e0a3){if(_0x24e0a3){return _0x24e0a3[_0x3cf3('0x71')](_0x3eda47[_0x3cf3('0x5f')][_0x3cf3('0x6d')],_[_0x3cf3('0x72')](_0x3eda47[_0x3cf3('0x5f')],[_0x3cf3('0x6d'),'id'])||{})[_0x3cf3('0x73')](function(_0x47eebf){for(var _0x346e02=0x0;_0x346e02<_0x3eda47[_0x3cf3('0x5f')]['ids']['length'];_0x346e02+=0x1){socket['emit'](_0x3cf3('0x74'),{'UserId':Number(_0x3eda47[_0x3cf3('0x5f')][_0x3cf3('0x6d')][_0x346e02]),'WhatsappAccountId':Number(_0x3eda47[_0x3cf3('0x5a')]['id'])});}return _0x47eebf;});}})['then'](respondWithResult(_0x5bba9d,null))['catch'](handleError(_0x5bba9d,null));};exports[_0x3cf3('0x75')]=function(_0x51b498,_0x5d9bfb,_0x28f6cb){return db[_0x3cf3('0x3d')]['find']({'where':{'id':_0x51b498[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x5d9bfb,null))[_0x3cf3('0x1f')](function(_0xe5c010){if(_0xe5c010){return _0xe5c010[_0x3cf3('0x75')](_0x51b498[_0x3cf3('0x43')]['ids'])['then'](function(){if(_[_0x3cf3('0x76')](_0x51b498[_0x3cf3('0x43')][_0x3cf3('0x6d')])){for(var _0x1344c6=0x0;_0x1344c6<_0x51b498['query']['ids'][_0x3cf3('0x47')];_0x1344c6+=0x1){socket[_0x3cf3('0x77')](_0x3cf3('0x78'),{'UserId':Number(_0x51b498[_0x3cf3('0x43')]['ids'][_0x1344c6]),'WhatsappAccountId':Number(_0x51b498[_0x3cf3('0x5a')]['id'])});}}else{socket[_0x3cf3('0x77')](_0x3cf3('0x78'),{'UserId':Number(_0x51b498[_0x3cf3('0x43')][_0x3cf3('0x6d')]),'WhatsappAccountId':Number(_0x51b498[_0x3cf3('0x5a')]['id'])});}});}})[_0x3cf3('0x1f')](respondWithStatusCode(_0x5d9bfb,null))[_0x3cf3('0x58')](handleError(_0x5d9bfb,null));};exports['getAgents']=function(_0x3444da,_0x319713,_0x1278d1){var _0x3945f3={};var _0x5c265f={};var _0x16349d;var _0x395a59;return db[_0x3cf3('0x3d')][_0x3cf3('0x6b')]({'where':{'id':_0x3444da[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x319713,null))[_0x3cf3('0x1f')](function(_0x5e3535){if(_0x5e3535){_0x16349d=_0x5e3535;_0x5c265f['model']=_[_0x3cf3('0x5c')](db[_0x3cf3('0x79')][_0x3cf3('0x3e')]);_0x5c265f[_0x3cf3('0x43')]=_[_0x3cf3('0x5c')](_0x3444da['query']);_0x5c265f['filters']=_[_0x3cf3('0x44')](_0x5c265f[_0x3cf3('0x42')],_0x5c265f[_0x3cf3('0x43')]);_0x3945f3[_0x3cf3('0x45')]=_[_0x3cf3('0x44')](_0x5c265f[_0x3cf3('0x42')],qs[_0x3cf3('0x46')](_0x3444da[_0x3cf3('0x43')][_0x3cf3('0x46')]));_0x3945f3['attributes']=_0x3945f3[_0x3cf3('0x45')][_0x3cf3('0x47')]?_0x3945f3['attributes']:_0x5c265f[_0x3cf3('0x42')];_0x3945f3[_0x3cf3('0x4b')]=qs[_0x3cf3('0x4c')](_0x3444da[_0x3cf3('0x43')][_0x3cf3('0x4c')]);_0x3945f3[_0x3cf3('0x4d')]=qs[_0x3cf3('0x4e')](_[_0x3cf3('0x4f')](_0x3444da[_0x3cf3('0x43')],_0x5c265f[_0x3cf3('0x4e')]));if(_0x3444da[_0x3cf3('0x43')][_0x3cf3('0x52')]){_0x3945f3[_0x3cf3('0x4d')]=_[_0x3cf3('0x50')](_0x3945f3[_0x3cf3('0x4d')],{'$or':_[_0x3cf3('0x3c')](_0x3945f3[_0x3cf3('0x45')],function(_0x458a75){var _0x43c6f6={};_0x43c6f6[_0x458a75]={'$like':'%'+_0x3444da[_0x3cf3('0x43')]['filter']+'%'};return _0x43c6f6;})});}_0x3945f3=_[_0x3cf3('0x50')]({},_0x3945f3,_0x3444da[_0x3cf3('0x53')]);return _0x16349d[_0x3cf3('0x7a')](_0x3945f3);}})['then'](function(_0x31735a){if(_0x31735a){_0x395a59=_0x31735a[_0x3cf3('0x47')];if(!_0x3444da[_0x3cf3('0x43')][_0x3cf3('0x48')](_0x3cf3('0x49'))){_0x3945f3[_0x3cf3('0x4a')]=qs[_0x3cf3('0x4a')](_0x3444da[_0x3cf3('0x43')][_0x3cf3('0x4a')]);_0x3945f3['offset']=qs[_0x3cf3('0x2b')](_0x3444da[_0x3cf3('0x43')]['offset']);}return _0x16349d[_0x3cf3('0x7a')](_0x3945f3);}})['then'](function(_0x595bb8){if(_0x595bb8){return _0x595bb8?{'count':_0x395a59,'rows':_0x595bb8}:null;}})[_0x3cf3('0x1f')](respondWithResult(_0x319713,null))[_0x3cf3('0x58')](handleError(_0x319713,null));};exports['addApplications']=function(_0xe9f846,_0x3b24d6){var _0x5ce635=_0xe9f846[_0x3cf3('0x5a')]['id'];var _0x146194=_0xe9f846['body'];var _0x3d8dc3=0xc8;var _0xc7e2b4=null;return db['sequelize'][_0x3cf3('0x7b')]({'isolationLevel':db[_0x3cf3('0x7c')][_0x3cf3('0x7d')][_0x3cf3('0x7e')][_0x3cf3('0x7f')]},function(_0x5a766f){return db[_0x3cf3('0x3d')][_0x3cf3('0x6b')]({'where':{'id':_0x5ce635},'transaction':_0x5a766f})[_0x3cf3('0x1f')](function(_0x1a8b49){if(_0x1a8b49){return db[_0x3cf3('0x80')]['destroy']({'where':{'WhatsappAccountId':_0x5ce635},'transaction':_0x5a766f})[_0x3cf3('0x1f')](function(){var _0x55c42c=_[_0x3cf3('0x3c')](_0x146194,function(_0x17eaa0){_0x17eaa0[_0x3cf3('0x68')]=_0x5ce635;return _0x17eaa0;});return db[_0x3cf3('0x80')]['bulkCreate'](_0x55c42c,{'transaction':_0x5a766f});});}else{_0x3d8dc3=0x194;_0xc7e2b4=[];}});})['then'](function(){if(_0x3d8dc3!==0x194){return db[_0x3cf3('0x80')][_0x3cf3('0x81')]({'where':{'WhatsappAccountId':_0x5ce635},'order':_0x3cf3('0x82')})[_0x3cf3('0x1f')](function(_0x390cd7){_0xc7e2b4=_0x390cd7;});}})[_0x3cf3('0x58')](function(_0x1099d1){_0x3d8dc3=0x1f4;logger[_0x3cf3('0x25')](_0x1099d1[_0x3cf3('0x37')]);if(_0x1099d1[_0x3cf3('0x38')]){delete _0x1099d1['name'];}_0xc7e2b4=_0x1099d1;})[_0x3cf3('0x83')](function(){if(_0xc7e2b4===null){_0x3b24d6[_0x3cf3('0x36')](_0x3d8dc3);}else{if(_0x3d8dc3===0x1f4){_0x3b24d6['status'](_0x3d8dc3)['send'](_0xc7e2b4);}else{_0x3b24d6[_0x3cf3('0x28')](_0x3d8dc3)[_0x3cf3('0x2a')](_0xc7e2b4);}}});};exports[_0x3cf3('0x84')]=function(_0x1842f8,_0x280478,_0x1fb379){var _0x5a78e0={};var _0xf086b={};var _0x199176;var _0x55fa25;return db[_0x3cf3('0x3d')][_0x3cf3('0x6b')]({'where':{'id':_0x1842f8[_0x3cf3('0x5a')]['id']}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x280478,null))['then'](function(_0x3bf20f){if(_0x3bf20f){_0x199176=_0x3bf20f;_0xf086b[_0x3cf3('0x42')]=_[_0x3cf3('0x5c')](db[_0x3cf3('0x80')][_0x3cf3('0x3e')]);_0xf086b[_0x3cf3('0x43')]=_[_0x3cf3('0x5c')](_0x1842f8[_0x3cf3('0x43')]);_0xf086b[_0x3cf3('0x4e')]=_['intersection'](_0xf086b['model'],_0xf086b[_0x3cf3('0x43')]);_0x5a78e0[_0x3cf3('0x45')]=_[_0x3cf3('0x44')](_0xf086b[_0x3cf3('0x42')],qs[_0x3cf3('0x46')](_0x1842f8['query']['fields']));_0x5a78e0[_0x3cf3('0x45')]=_0x5a78e0['attributes'][_0x3cf3('0x47')]?_0x5a78e0[_0x3cf3('0x45')]:_0xf086b['model'];_0x5a78e0[_0x3cf3('0x4b')]=qs[_0x3cf3('0x4c')](_0x1842f8['query'][_0x3cf3('0x4c')]);_0x5a78e0[_0x3cf3('0x4d')]=qs[_0x3cf3('0x4e')](_[_0x3cf3('0x4f')](_0x1842f8['query'],_0xf086b[_0x3cf3('0x4e')]));if(_0x1842f8['query']['filter']){_0x5a78e0[_0x3cf3('0x4d')]=_[_0x3cf3('0x50')](_0x5a78e0[_0x3cf3('0x4d')],{'$or':_[_0x3cf3('0x3c')](_0x5a78e0['attributes'],function(_0x5f21f2){var _0x50d89c={};_0x50d89c[_0x5f21f2]={'$like':'%'+_0x1842f8['query'][_0x3cf3('0x52')]+'%'};return _0x50d89c;})});}_0x5a78e0=_[_0x3cf3('0x50')]({},_0x5a78e0,_0x1842f8[_0x3cf3('0x53')]);return _0x199176['getApplications'](_0x5a78e0);}})[_0x3cf3('0x1f')](function(_0x5be1e8){if(_0x5be1e8){_0x55fa25=_0x5be1e8[_0x3cf3('0x47')];if(!_0x1842f8[_0x3cf3('0x43')][_0x3cf3('0x48')](_0x3cf3('0x49'))){_0x5a78e0[_0x3cf3('0x4a')]=qs[_0x3cf3('0x4a')](_0x1842f8[_0x3cf3('0x43')][_0x3cf3('0x4a')]);_0x5a78e0[_0x3cf3('0x2b')]=qs[_0x3cf3('0x2b')](_0x1842f8[_0x3cf3('0x43')][_0x3cf3('0x2b')]);}return _0x199176[_0x3cf3('0x84')](_0x5a78e0);}})[_0x3cf3('0x1f')](function(_0x38b6a3){if(_0x38b6a3){return _0x38b6a3?{'count':_0x55fa25,'rows':_0x38b6a3}:null;}})[_0x3cf3('0x1f')](respondWithResult(_0x280478,null))[_0x3cf3('0x58')](handleError(_0x280478,null));};exports[_0x3cf3('0x85')]=function(_0x1c793a,_0x31fa51,_0x2c7564){var _0x177ca0={'channel':_0x3cf3('0x86')};var _0x41582d=[];var _0x34a5cf=[];var _0x1e0414={};return db[_0x3cf3('0x3d')][_0x3cf3('0x5d')]({'where':{'id':_0x1c793a['params']['id']},'include':[{'model':db[_0x3cf3('0x80')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x31fa51,null))['then'](function(_0x4a8ac9){_0x177ca0[_0x3cf3('0x87')]=_0x4a8ac9;if(_0x177ca0[_0x3cf3('0x87')]&&_0x177ca0['account'][_0x3cf3('0x40')]===_0x3cf3('0x88')&&_0x1c793a['body']['statuses']){if(_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0x89')][_0x3cf3('0x47')]===0x0)return;if(_0x1c793a[_0x3cf3('0x5f')]['statuses'][0x0][_0x3cf3('0x8a')]!==_0x3cf3('0x8b'))return;return db[_0x3cf3('0x8c')]['update']({'read':!![],'readAt':_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0x89')][0x0][_0x3cf3('0x8d')]},{'where':{'messageId':_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0x89')][0x0][_0x3cf3('0x8e')]},'individualHooks':!![]})['then'](function(_0x45ffea){return _0x31fa51['status'](0xc8)['json'](_0x45ffea);});}_0x177ca0[_0x3cf3('0x8f')]=_[_0x3cf3('0x90')](_0x4a8ac9['Applications'],['priority'],[_0x3cf3('0x91')]);if(_0x177ca0[_0x3cf3('0x87')][_0x3cf3('0x92')]){delete _0x177ca0[_0x3cf3('0x87')][_0x3cf3('0x92')];}return db[_0x3cf3('0x93')][_0x3cf3('0x67')]()[_0x3cf3('0x1f')](function(_0x208e75){if(!_0x208e75){throw new db[(_0x3cf3('0x94'))][(_0x3cf3('0x95'))]('no\x20available\x20attributes');}_0x41582d=_[_0x3cf3('0x96')](_['keys'](_0x208e75),[_0x3cf3('0x97'),_0x3cf3('0x98')]);_0x34a5cf=_[_0x3cf3('0x96')](_['keys'](_0x208e75),[_0x3cf3('0x97'),_0x3cf3('0x98'),_0x3cf3('0x99'),'ListId']);_0x177ca0[_0x3cf3('0x5f')]={'mapKey':'mobile'};if(_0x177ca0[_0x3cf3('0x87')]&&_0x177ca0[_0x3cf3('0x87')][_0x3cf3('0x40')]===_0x3cf3('0x9a')){_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9b')]=_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0x9c')]['replace'](_0x3cf3('0x9d'),'');_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x5f')]=_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0x9e')];_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9f')]=_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0xa0')];}if(_0x177ca0['account']&&_0x177ca0[_0x3cf3('0x87')][_0x3cf3('0x40')]===_0x3cf3('0x88')){_0x177ca0[_0x3cf3('0x5f')]['from']=_0x1c793a['body'][_0x3cf3('0xa1')][0x0]['from'];_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x5f')]=_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0xa1')][0x0][_0x3cf3('0x27')][_0x3cf3('0x5f')];_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9f')]=_0x1c793a[_0x3cf3('0x5f')][_0x3cf3('0xa1')][0x0][_0x3cf3('0x8e')];}if(_0x177ca0[_0x3cf3('0x5f')]['id']){delete _0x177ca0['body']['id'];}if(_['isNil'](_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9b')])){throw new db['Sequelize'][(_0x3cf3('0x95'))](_0x3cf3('0xa2'));}if(_[_0x3cf3('0xa3')](_0x177ca0['body'][_0x3cf3('0x5f')])||_0x177ca0[_0x3cf3('0x5f')]['body']===''){throw new db[(_0x3cf3('0x94'))]['ValidationError'](_0x3cf3('0xa4'));}if(_[_0x3cf3('0xa3')](_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0xa5')])){throw new db[(_0x3cf3('0x94'))]['ValidationError'](_0x3cf3('0xa6')+_0x34a5cf);}if(!_[_0x3cf3('0xa7')](_0x34a5cf,_0x177ca0['body'][_0x3cf3('0xa5')])){throw new db[(_0x3cf3('0x94'))][(_0x3cf3('0x95'))](_0x3cf3('0xa8')+_0x34a5cf);}_0x1e0414[_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0xa5')]]=_0x177ca0['body'][_0x3cf3('0x9b')];return db[_0x3cf3('0xa9')]['find']({'where':{'id':_0x177ca0[_0x3cf3('0x87')][_0x3cf3('0xaa')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1e0414,'limit':0x1,'order':[[_0x3cf3('0x98'),_0x3cf3('0xab')]]}]});})['then'](handleEntityNotFound(_0x31fa51,null))[_0x3cf3('0x1f')](function(_0x40b3ee){if(_0x40b3ee){_0x177ca0['list']=_[_0x3cf3('0x72')](_0x40b3ee,[_0x3cf3('0xac')]);if(_0x40b3ee[_0x3cf3('0xac')]['length']){return _0x40b3ee[_0x3cf3('0xac')][0x0];}var _0x2fe64d=_[_0x3cf3('0x19')](_0x177ca0[_0x3cf3('0x5f')],{'firstName':_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9b')],'ListId':_0x40b3ee['id']});_0x2fe64d[_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0xa5')]]=_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9b')];return db['CmContact'][_0x3cf3('0x5e')](_0x2fe64d,{'fields':_0x41582d,'raw':!![]});}})[_0x3cf3('0x1f')](handleEntityNotFound(_0x31fa51,null))['then'](function(_0x41af6d){if(_0x41af6d){_0x177ca0[_0x3cf3('0xad')]=_0x41af6d;var _0x12da5a={'ContactId':_0x41af6d['id'],'phone':_0x177ca0[_0x3cf3('0x5f')]['from'],'WhatsappAccountId':_0x1c793a[_0x3cf3('0x5a')]['id']};var _0x2a08c7={'ContactId':_0x41af6d['id'],'WhatsappAccountId':_0x1c793a[_0x3cf3('0x5a')]['id'],'closed':![]};return db[_0x3cf3('0xae')][_0x3cf3('0x5d')]({'where':_0x2a08c7})['then'](function(_0x1509be){if(_0x1509be){return[_0x1509be,![]];}return db['WhatsappInteraction'][_0x3cf3('0x5e')](_0x12da5a)['then'](function(_0x44420d){return[_0x44420d,!![]];});});}})['spread'](function(_0x412ca4,_0x4179fd){_0x177ca0[_0x3cf3('0xaf')]=_0x412ca4['get']({'plain':!![]});_0x177ca0['interaction'][_0x3cf3('0xb0')]=![];if(_0x4179fd){if(_0x177ca0[_0x3cf3('0x87')]['autoclose']){_0x177ca0['applications'][_0x3cf3('0xb1')]({'id':0x0,'priority':_0x177ca0[_0x3cf3('0x8f')][_0x3cf3('0x47')]+0x1,'app':_0x3cf3('0xb2'),'appdata':_0x3cf3('0xb3'),'interval':_0x3cf3('0xb4')});}_0x177ca0[_0x3cf3('0xaf')]['created']=!![];}return db[_0x3cf3('0x8c')][_0x3cf3('0x5e')]({'phone':_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9b')],'messageId':_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x9f')],'body':_0x177ca0[_0x3cf3('0x5f')][_0x3cf3('0x5f')],'WhatsappAccountId':_0x1c793a[_0x3cf3('0x5a')]['id'],'WhatsappInteractionId':_0x412ca4['id'],'direction':'in','ContactId':_0x412ca4['ContactId'],'AttachmentId':_0x177ca0[_0x3cf3('0x5f')]['AttachmentId']});})[_0x3cf3('0x1f')](function(_0x439a3e){_0x177ca0[_0x3cf3('0x27')]=_0x439a3e;if(_0x177ca0[_0x3cf3('0xaf')][_0x3cf3('0xb5')]){return db[_0x3cf3('0x79')]['find']({'attributes':['id','name'],'where':{'id':_0x177ca0[_0x3cf3('0xaf')][_0x3cf3('0xb5')]}})['then'](function(_0x14603d){if(_0x14603d){_0x177ca0['applications'][_0x3cf3('0xb6')]({'id':0x0,'priority':0x0,'app':_0x3cf3('0xb7'),'appdata':_0x14603d[_0x3cf3('0x38')]+','+(_0x177ca0[_0x3cf3('0x87')][_0x3cf3('0xb8')]||0xa),'interval':_0x3cf3('0xb4')});}return respondWithRpcPromise(_0x3cf3('0xb9'),'startRouting',_0x177ca0);});}return respondWithRpcPromise(_0x3cf3('0xb9'),'startRouting',_0x177ca0);})['then'](function(_0x2b45c9){if(_0x2b45c9){var _0x128759=0xc8;var _0x562007=_0x3cf3('0xba');logger[_0x3cf3('0x20')](_0x3cf3('0x22'),_0x562007,_0x128759,_0x3cf3('0xbb'));logger[_0x3cf3('0x21')](_0x3cf3('0xbc'),_0x562007,_0x128759,_0x3cf3('0xbb'),JSON[_0x3cf3('0x24')](_0x2b45c9));if(_0x177ca0[_0x3cf3('0x87')][_0x3cf3('0x40')]===_0x3cf3('0x9a')){return _0x31fa51[_0x3cf3('0x28')](_0x128759)[_0x3cf3('0x2e')]('Content-Type',_0x3cf3('0xbd'))['send']('\x0a');}else{return _0x31fa51[_0x3cf3('0x28')](_0x128759)[_0x3cf3('0x2a')](_0x2b45c9);}}});})[_0x3cf3('0x58')](handleError(_0x31fa51,null));};exports['send']=function(_0x1f0727,_0x2c9afc,_0xcd36f0){var _0xc349bf,_0x5a4034,_0x2c6194;if(_['isNil'](_0x1f0727['body'][_0x3cf3('0x5f')])||_0x1f0727['body'][_0x3cf3('0x5f')]===''){throw new db[(_0x3cf3('0x94'))][(_0x3cf3('0x95'))](_0x3cf3('0xa4'));}if(_[_0x3cf3('0xa3')](_0x1f0727[_0x3cf3('0x5f')]['to'])){throw new db[(_0x3cf3('0x94'))][(_0x3cf3('0x95'))](_0x3cf3('0xbe'));}_0xc349bf=_0x1f0727[_0x3cf3('0x5f')]['to'];return db[_0x3cf3('0x3d')][_0x3cf3('0x5d')]({'where':{'id':_0x1f0727[_0x3cf3('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x3cf3('0xbf'),'include':[{'model':db[_0x3cf3('0x93')],'as':_0x3cf3('0xac'),'where':{'mobile':_0xc349bf},'limit':0x1,'order':[[_0x3cf3('0x98'),_0x3cf3('0xab')]]}]}]})['then'](handleEntityNotFound(_0x2c9afc,null))[_0x3cf3('0x1f')](function(_0x497cd8){if(_0x497cd8&&_0x497cd8[_0x3cf3('0xbf')]){_0x5a4034=_0x497cd8[_0x3cf3('0x32')]({'plain':!![]});if(_0x5a4034[_0x3cf3('0xbf')]&&_0x5a4034[_0x3cf3('0xbf')]['Contacts'][_0x3cf3('0x47')]){return _0x5a4034[_0x3cf3('0xbf')][_0x3cf3('0xac')][0x0];}return db[_0x3cf3('0x93')][_0x3cf3('0x5e')](_[_0x3cf3('0x19')](_0x1f0727[_0x3cf3('0x5f')],{'firstName':_0xc349bf,'mobile':_0xc349bf,'phone':_0xc349bf,'ListId':_0x5a4034[_0x3cf3('0xaa')]}));}})['then'](handleEntityNotFound(_0x2c9afc,null))[_0x3cf3('0x1f')](function(_0x5d88b3){if(_0x5d88b3){_0x2c6194=_0x5d88b3;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x2c6194['id'],'closed':![],'WhatsappAccountId':_0x5a4034['id']}})['then'](function(_0x543ee4){if(_0x543ee4){return[_0x543ee4,![]];}return db[_0x3cf3('0xae')]['create']({'UserId':_0x1f0727['user']['id'],'ContactId':_0x2c6194['id'],'WhatsappAccountId':_0x5a4034['id'],'phone':_0xc349bf,'firstMsgDirection':'out','Messages':[_[_0x3cf3('0x50')](_0x1f0727['body'],{'read':![],'body':_0x1f0727[_0x3cf3('0x5f')]['body'],'phone':_0xc349bf,'WhatsappAccountId':_0x5a4034['id'],'UserId':_0x1f0727[_0x3cf3('0x62')]['id'],'ContactId':_0x2c6194['id']})]},{'include':[{'model':db[_0x3cf3('0x8c')],'as':'Messages'}]})[_0x3cf3('0x1f')](function(_0x596d02){return[_0x596d02,!![]];});});}})[_0x3cf3('0x73')](function(_0x4a483a,_0x5f4391){if(_0x5f4391){return _0x4a483a;}return db[_0x3cf3('0x8c')][_0x3cf3('0x5e')](_['merge'](_0x1f0727[_0x3cf3('0x5f')],{'read':![],'body':_0x1f0727[_0x3cf3('0x5f')][_0x3cf3('0x5f')],'phone':_0xc349bf,'WhatsappAccountId':_0x5a4034['id'],'WhatsappInteractionId':_0x4a483a['id'],'UserId':_0x1f0727['user']['id'],'ContactId':_0x2c6194['id']}))[_0x3cf3('0x1f')](function(_0x1dceff){_0x4a483a[_0x3cf3('0xc0')][_0x3cf3('0xc1')]=[];_0x4a483a[_0x3cf3('0xc0')][_0x3cf3('0xc1')][_0x3cf3('0xb1')](_0x1dceff[_0x3cf3('0xc0')]);return _0x4a483a;});})['then'](respondWithResult(_0x2c9afc,null))[_0x3cf3('0x58')](handleError(_0x2c9afc,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 6915c80..362972b 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 _0x157b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1a51c1,_0x28e8b6){var _0x404df2=function(_0xfa3d45){while(--_0xfa3d45){_0x1a51c1['push'](_0x1a51c1['shift']());}};_0x404df2(++_0x28e8b6);}(_0x157b,0x13e));var _0xb157=function(_0x1fe937,_0x5a5a63){_0x1fe937=_0x1fe937-0x0;var _0x2a6f0d=_0x157b[_0x1fe937];return _0x2a6f0d;};'use strict';var EventEmitter=require(_0xb157('0x0'));var WhatsappAccount=require(_0xb157('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb157('0x2')](0x0);var events={'afterCreate':_0xb157('0x3'),'afterUpdate':_0xb157('0x4'),'afterDestroy':_0xb157('0x5')};function emitEvent(_0x177dfe){return function(_0x245d69,_0x45810d,_0x45cb00){WhatsappAccountEvents[_0xb157('0x6')](_0x177dfe+':'+_0x245d69['id'],_0x245d69);WhatsappAccountEvents[_0xb157('0x6')](_0x177dfe,_0x245d69);_0x45cb00(null);};}for(var e in events){if(events[_0xb157('0x7')](e)){var event=events[e];WhatsappAccount[_0xb157('0x8')](e,emitEvent(event));}}module[_0xb157('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xcfcb=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcfcb,0xa1));var _0xbcfc=function(_0x33b9ac,_0x1cd671){_0x33b9ac=_0x33b9ac-0x0;var _0x4da2a0=_0xcfcb[_0x33b9ac];return _0x4da2a0;};'use strict';var EventEmitter=require(_0xbcfc('0x0'));var WhatsappAccount=require(_0xbcfc('0x1'))['db'][_0xbcfc('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xbcfc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbcfc('0x4'),'afterDestroy':_0xbcfc('0x5')};function emitEvent(_0x4d0538){return function(_0x2606d4,_0x4a46a2,_0x57bc9b){WhatsappAccountEvents[_0xbcfc('0x6')](_0x4d0538+':'+_0x2606d4['id'],_0x2606d4);WhatsappAccountEvents[_0xbcfc('0x6')](_0x4d0538,_0x2606d4);_0x57bc9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xbcfc('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b2d7196..8b6dd1c 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 _0xd06a=['path','rimraf','../../config/environment','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','request-promise'];(function(_0x39d711,_0xe11eb7){var _0xee1d0c=function(_0x457e08){while(--_0x457e08){_0x39d711['push'](_0x39d711['shift']());}};_0xee1d0c(++_0xe11eb7);}(_0xd06a,0x119));var _0xad06=function(_0x13a81d,_0x390e7e){_0x13a81d=_0x13a81d-0x0;var _0x107940=_0xd06a[_0x13a81d];return _0x107940;};'use strict';var _=require('lodash');var util=require(_0xad06('0x0'));var logger=require(_0xad06('0x1'))(_0xad06('0x2'));var moment=require(_0xad06('0x3'));var BPromise=require('bluebird');var rp=require(_0xad06('0x4'));var fs=require('fs');var path=require(_0xad06('0x5'));var rimraf=require(_0xad06('0x6'));var config=require(_0xad06('0x7'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0xc0e6d8,_0x25896a){return _0xc0e6d8[_0xad06('0x8')](_0xad06('0x9'),attributes,{'tableName':_0xad06('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdd3=['define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x3facd8,_0x177ed1){var _0xc13275=function(_0x561777){while(--_0x561777){_0x3facd8['push'](_0x3facd8['shift']());}};_0xc13275(++_0x177ed1);}(_0xfdd3,0xdf));var _0x3fdd=function(_0xc5a771,_0x3b9d0d){_0xc5a771=_0xc5a771-0x0;var _0xb7715d=_0xfdd3[_0xc5a771];return _0xb7715d;};'use strict';var _=require('lodash');var util=require(_0x3fdd('0x0'));var logger=require(_0x3fdd('0x1'))(_0x3fdd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3fdd('0x3'));var fs=require('fs');var path=require(_0x3fdd('0x4'));var rimraf=require('rimraf');var config=require(_0x3fdd('0x5'));var attributes=require(_0x3fdd('0x6'));module['exports']=function(_0x183633,_0x3d1615){return _0x183633[_0x3fdd('0x7')](_0x3fdd('0x8'),attributes,{'tableName':_0x3fdd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index ec32939..4adb7e1 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 _0x856e=['info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount,\x20%s,\x20%s','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./whatsappAccount.socket','register','request','then'];(function(_0x34769f,_0x27ff0b){var _0x5137bb=function(_0x143435){while(--_0x143435){_0x34769f['push'](_0x34769f['shift']());}};_0x5137bb(++_0x27ff0b);}(_0x856e,0xa0));var _0xe856=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x856e[_0x4fb1b8];return _0x146c71;};'use strict';var _=require(_0xe856('0x0'));var util=require(_0xe856('0x1'));var moment=require('moment');var BPromise=require(_0xe856('0x2'));var rs=require(_0xe856('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe856('0x4'));var logger=require(_0xe856('0x5'))('rpc');var config=require(_0xe856('0x6'));var jayson=require(_0xe856('0x7'));var client=jayson['client'][_0xe856('0x8')]({'port':0x232a});config[_0xe856('0x9')]=_['defaults'](config[_0xe856('0x9')],{'host':_0xe856('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe856('0x9')]));require(_0xe856('0xb'))[_0xe856('0xc')](socket);function respondWithRpcPromise(_0x5b986b,_0x394e17,_0x375691){return new BPromise(function(_0x20db4c,_0x556a50){return client[_0xe856('0xd')](_0x5b986b,_0x375691)[_0xe856('0xe')](function(_0x3a357b){logger[_0xe856('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x394e17,_0xe856('0x10'));logger['debug'](_0xe856('0x11'),_0x394e17,_0xe856('0x10'),JSON[_0xe856('0x12')](_0x3a357b));if(_0x3a357b[_0xe856('0x13')]){if(_0x3a357b['error'][_0xe856('0x14')]===0x1f4){logger[_0xe856('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x394e17,_0x3a357b[_0xe856('0x13')][_0xe856('0x15')]);return _0x556a50(_0x3a357b['error'][_0xe856('0x15')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x394e17,_0x3a357b[_0xe856('0x13')][_0xe856('0x15')]);return _0x20db4c(_0x3a357b['error'][_0xe856('0x15')]);}else{logger[_0xe856('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x394e17,_0xe856('0x10'));_0x20db4c(_0x3a357b[_0xe856('0x16')][_0xe856('0x15')]);}})[_0xe856('0x17')](function(_0x2b39e5){logger['error'](_0xe856('0x18'),_0x394e17,_0x2b39e5);_0x556a50(_0x2b39e5);});});}exports[_0xe856('0x19')]=function(_0x179f09){var _0xd7176a=this;return new Promise(function(_0x234f7b,_0x46c664){return db[_0xe856('0x1a')][_0xe856('0x1b')]({'raw':_0x179f09['options']?_0x179f09[_0xe856('0x1c')][_0xe856('0x1d')]===undefined?!![]:![]:!![],'where':_0x179f09['options']?_0x179f09[_0xe856('0x1c')]['where']||null:null,'attributes':_0x179f09[_0xe856('0x1c')]?_0x179f09[_0xe856('0x1c')][_0xe856('0x1e')]||null:null,'include':_0x179f09[_0xe856('0x1c')]?_0x179f09['options'][_0xe856('0x1f')]?_[_0xe856('0x20')](_0x179f09['options']['include'],function(_0x16ef9d){return{'model':db[_0x16ef9d[_0xe856('0x21')]],'as':_0x16ef9d['as'],'attributes':_0x16ef9d['attributes'],'include':_0x16ef9d[_0xe856('0x1f')]?_[_0xe856('0x20')](_0x16ef9d[_0xe856('0x1f')],function(_0x26b052){return{'model':db[_0x26b052[_0xe856('0x21')]],'as':_0x26b052['as'],'attributes':_0x26b052[_0xe856('0x1e')],'include':_0x26b052[_0xe856('0x1f')]?_['map'](_0x26b052[_0xe856('0x1f')],function(_0x1b1ed6){return{'model':db[_0x1b1ed6[_0xe856('0x21')]],'as':_0x1b1ed6['as'],'attributes':_0x1b1ed6[_0xe856('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe856('0xe')](function(_0x5b74cd){logger['info'](_0xe856('0x19'),_0x179f09);logger[_0xe856('0x22')](_0xe856('0x19'),_0x179f09,JSON[_0xe856('0x12')](_0x5b74cd));_0x234f7b(_0x5b74cd);})[_0xe856('0x17')](function(_0x35fc80){logger['error']('ShowWhatsappAccount',_0x35fc80[_0xe856('0x15')],_0x179f09);_0x46c664(_0xd7176a[_0xe856('0x13')](0x1f4,_0x35fc80[_0xe856('0x15')]));});});}; \ No newline at end of file +var _0x7caa=['socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost'];(function(_0x10f7af,_0x3a2693){var _0x820eaf=function(_0x5dec81){while(--_0x5dec81){_0x10f7af['push'](_0x10f7af['shift']());}};_0x820eaf(++_0x3a2693);}(_0x7caa,0xdc));var _0xa7ca=function(_0x34f0b5,_0x1eb078){_0x34f0b5=_0x34f0b5-0x0;var _0x14f7f0=_0x7caa[_0x34f0b5];return _0x14f7f0;};'use strict';var _=require(_0xa7ca('0x0'));var util=require(_0xa7ca('0x1'));var moment=require('moment');var BPromise=require(_0xa7ca('0x2'));var rs=require(_0xa7ca('0x3'));var fs=require('fs');var Redis=require(_0xa7ca('0x4'));var db=require(_0xa7ca('0x5'))['db'];var utils=require(_0xa7ca('0x6'));var logger=require(_0xa7ca('0x7'))(_0xa7ca('0x8'));var config=require(_0xa7ca('0x9'));var jayson=require(_0xa7ca('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa7ca('0xb')](config[_0xa7ca('0xc')],{'host':_0xa7ca('0xd'),'port':0x18eb});var socket=require(_0xa7ca('0xe'))(new Redis(config[_0xa7ca('0xc')]));require(_0xa7ca('0xf'))[_0xa7ca('0x10')](socket);function respondWithRpcPromise(_0x28d670,_0x5709c7,_0x480f9a){return new BPromise(function(_0x23493f,_0x31bb49){return client[_0xa7ca('0x11')](_0x28d670,_0x480f9a)[_0xa7ca('0x12')](function(_0xcd428){logger['info'](_0xa7ca('0x13'),_0x5709c7,'request\x20sent');logger[_0xa7ca('0x14')](_0xa7ca('0x15'),_0x5709c7,'request\x20sent',JSON[_0xa7ca('0x16')](_0xcd428));if(_0xcd428[_0xa7ca('0x17')]){if(_0xcd428['error'][_0xa7ca('0x18')]===0x1f4){logger[_0xa7ca('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x5709c7,_0xcd428[_0xa7ca('0x17')][_0xa7ca('0x19')]);return _0x31bb49(_0xcd428[_0xa7ca('0x17')][_0xa7ca('0x19')]);}logger[_0xa7ca('0x17')](_0xa7ca('0x13'),_0x5709c7,_0xcd428[_0xa7ca('0x17')][_0xa7ca('0x19')]);return _0x23493f(_0xcd428[_0xa7ca('0x17')][_0xa7ca('0x19')]);}else{logger[_0xa7ca('0x1a')](_0xa7ca('0x13'),_0x5709c7,_0xa7ca('0x1b'));_0x23493f(_0xcd428[_0xa7ca('0x1c')][_0xa7ca('0x19')]);}})[_0xa7ca('0x1d')](function(_0xaf4965){logger['error'](_0xa7ca('0x13'),_0x5709c7,_0xaf4965);_0x31bb49(_0xaf4965);});});}exports[_0xa7ca('0x1e')]=function(_0x2535d1){var _0xa17d1e=this;return new Promise(function(_0x5d71c0,_0x5dec17){return db[_0xa7ca('0x1f')]['find']({'raw':_0x2535d1[_0xa7ca('0x20')]?_0x2535d1['options'][_0xa7ca('0x21')]===undefined?!![]:![]:!![],'where':_0x2535d1[_0xa7ca('0x20')]?_0x2535d1['options'][_0xa7ca('0x22')]||null:null,'attributes':_0x2535d1[_0xa7ca('0x20')]?_0x2535d1[_0xa7ca('0x20')][_0xa7ca('0x23')]||null:null,'include':_0x2535d1['options']?_0x2535d1[_0xa7ca('0x20')]['include']?_['map'](_0x2535d1[_0xa7ca('0x20')][_0xa7ca('0x24')],function(_0x18e803){return{'model':db[_0x18e803[_0xa7ca('0x25')]],'as':_0x18e803['as'],'attributes':_0x18e803['attributes'],'include':_0x18e803['include']?_[_0xa7ca('0x26')](_0x18e803['include'],function(_0x5ef79a){return{'model':db[_0x5ef79a[_0xa7ca('0x25')]],'as':_0x5ef79a['as'],'attributes':_0x5ef79a[_0xa7ca('0x23')],'include':_0x5ef79a[_0xa7ca('0x24')]?_['map'](_0x5ef79a[_0xa7ca('0x24')],function(_0x209ab0){return{'model':db[_0x209ab0[_0xa7ca('0x25')]],'as':_0x209ab0['as'],'attributes':_0x209ab0[_0xa7ca('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa7ca('0x12')](function(_0x2eecfc){logger[_0xa7ca('0x1a')](_0xa7ca('0x1e'),_0x2535d1);logger[_0xa7ca('0x14')](_0xa7ca('0x1e'),_0x2535d1,JSON[_0xa7ca('0x16')](_0x2eecfc));_0x5d71c0(_0x2eecfc);})['catch'](function(_0x5e3800){logger[_0xa7ca('0x17')]('ShowWhatsappAccount',_0x5e3800['message'],_0x2535d1);_0x5dec17(_0xa17d1e[_0xa7ca('0x17')](0x1f4,_0x5e3800[_0xa7ca('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a0d14c3..6ff9eab 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 _0xef1b=['register','length','whatsappAccount:','save','update','emit'];(function(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0xef1b,0x1d1));var _0xbef1=function(_0x3e15a8,_0x3f30eb){_0x3e15a8=_0x3e15a8-0x0;var _0x2e4e86=_0xef1b[_0x3e15a8];return _0x2e4e86;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xbef1('0x0'),'remove',_0xbef1('0x1')];function createListener(_0x17f1ec,_0x1ebbe1){return function(_0x1abc5b){_0x1ebbe1[_0xbef1('0x2')](_0x17f1ec,_0x1abc5b);};}function removeListener(_0x2c536c,_0x529939){return function(){WhatsappAccountEvents['removeListener'](_0x2c536c,_0x529939);};}exports[_0xbef1('0x3')]=function(_0x4d8b2e){for(var _0x526426=0x0,_0x145ef2=events[_0xbef1('0x4')];_0x526426<_0x145ef2;_0x526426++){var _0xee44da=events[_0x526426];var _0x2178af=createListener(_0xbef1('0x5')+_0xee44da,_0x4d8b2e);WhatsappAccountEvents['on'](_0xee44da,_0x2178af);}}; \ No newline at end of file +var _0xb769=['length','save','update','emit','removeListener','register'];(function(_0x372ac9,_0x4666a6){var _0x3c2005=function(_0x5ac4cf){while(--_0x5ac4cf){_0x372ac9['push'](_0x372ac9['shift']());}};_0x3c2005(++_0x4666a6);}(_0xb769,0x199));var _0x9b76=function(_0x5d4fc8,_0x32738c){_0x5d4fc8=_0x5d4fc8-0x0;var _0x1e4524=_0xb769[_0x5d4fc8];return _0x1e4524;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x9b76('0x0'),'remove',_0x9b76('0x1')];function createListener(_0x583508,_0x21edbe){return function(_0x460f5a){_0x21edbe[_0x9b76('0x2')](_0x583508,_0x460f5a);};}function removeListener(_0x245194,_0x1262a5){return function(){WhatsappAccountEvents[_0x9b76('0x3')](_0x245194,_0x1262a5);};}exports[_0x9b76('0x4')]=function(_0x1c6465){for(var _0x5c0f52=0x0,_0x4fd127=events[_0x9b76('0x5')];_0x5c0f52<_0x4fd127;_0x5c0f52++){var _0x39ee5d=events[_0x5c0f52];var _0xeffd47=createListener('whatsappAccount:'+_0x39ee5d,_0x1c6465);WhatsappAccountEvents['on'](_0x39ee5d,_0xeffd47);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1570037..8c5b6bf 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 _0x83cc=['fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','connect-timeout','Router'];(function(_0x1563da,_0x362606){var _0x55bc38=function(_0x2d13b5){while(--_0x2d13b5){_0x1563da['push'](_0x1563da['shift']());}};_0x55bc38(++_0x362606);}(_0x83cc,0xfd));var _0xc83c=function(_0x61c887,_0x5522c2){_0x61c887=_0x61c887-0x0;var _0x200c44=_0x83cc[_0x61c887];return _0x200c44;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc83c('0x0'));var express=require('express');var router=express[_0xc83c('0x1')]();var fs_extra=require(_0xc83c('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc83c('0x3'));var controller=require('./whatsappApplication.controller');router[_0xc83c('0x4')]('/',auth[_0xc83c('0x5')](),controller['index']);router[_0xc83c('0x4')](_0xc83c('0x6'),auth[_0xc83c('0x5')](),controller[_0xc83c('0x7')]);router[_0xc83c('0x8')]('/',auth[_0xc83c('0x5')](),controller[_0xc83c('0x9')]);router[_0xc83c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc83c('0xb')]);router[_0xc83c('0xc')](_0xc83c('0x6'),auth['isAuthenticated'](),controller[_0xc83c('0xd')]);module[_0xc83c('0xe')]=router; \ No newline at end of file +var _0xd17a=['show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x326369,_0x84622b){var _0x2489ce=function(_0x453862){while(--_0x453862){_0x326369['push'](_0x326369['shift']());}};_0x2489ce(++_0x84622b);}(_0xd17a,0x72));var _0xad17=function(_0x5927ba,_0x34792d){_0x5927ba=_0x5927ba-0x0;var _0x1975d6=_0xd17a[_0x5927ba];return _0x1975d6;};'use strict';var multer=require(_0xad17('0x0'));var util=require(_0xad17('0x1'));var path=require(_0xad17('0x2'));var timeout=require(_0xad17('0x3'));var express=require(_0xad17('0x4'));var router=express[_0xad17('0x5')]();var fs_extra=require(_0xad17('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xad17('0x7'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0xad17('0x8')](),controller[_0xad17('0x9')]);router[_0xad17('0xa')](_0xad17('0xb'),auth[_0xad17('0x8')](),controller[_0xad17('0xc')]);router[_0xad17('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xad17('0xb'),auth['isAuthenticated'](),controller[_0xad17('0xe')]);router[_0xad17('0xf')](_0xad17('0xb'),auth[_0xad17('0x8')](),controller[_0xad17('0x10')]);module[_0xad17('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ede8bcc..910172a 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 _0xaf2b=['exports','STRING','noop','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf2b,0x1ad));var _0xbaf2=function(_0xeb67cb,_0x3facda){_0xeb67cb=_0xeb67cb-0x0;var _0xc8fe96=_0xaf2b[_0xeb67cb];return _0xc8fe96;};'use strict';var Sequelize=require(_0xbaf2('0x0'));module[_0xbaf2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbaf2('0x2')],'allowNull':![],'defaultValue':_0xbaf2('0x3')},'appdata':{'type':Sequelize[_0xbaf2('0x4')]()},'description':{'type':Sequelize[_0xbaf2('0x2')]},'interval':{'type':Sequelize[_0xbaf2('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8bc9=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0x8bc9,0x1bb));var _0x98bc=function(_0x256c42,_0x361784){_0x256c42=_0x256c42-0x0;var _0x2d3583=_0x8bc9[_0x256c42];return _0x2d3583;};'use strict';var Sequelize=require(_0x98bc('0x0'));module[_0x98bc('0x1')]={'priority':{'type':Sequelize[_0x98bc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x98bc('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x98bc('0x4')]()},'description':{'type':Sequelize[_0x98bc('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x98bc('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 2b98eec..a541ce0 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 _0xfaf2=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','update','then','destroy','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','filters','attributes','intersection'];(function(_0x54a1a0,_0x4583bf){var _0x574505=function(_0x126f04){while(--_0x126f04){_0x54a1a0['push'](_0x54a1a0['shift']());}};_0x574505(++_0x4583bf);}(_0xfaf2,0x169));var _0x2faf=function(_0x11234d,_0x278596){_0x11234d=_0x11234d-0x0;var _0x472add=_0xfaf2[_0x11234d];return _0x472add;};'use strict';var emlformat=require(_0x2faf('0x0'));var rimraf=require(_0x2faf('0x1'));var zipdir=require(_0x2faf('0x2'));var jsonpatch=require(_0x2faf('0x3'));var rp=require(_0x2faf('0x4'));var moment=require('moment');var BPromise=require(_0x2faf('0x5'));var Mustache=require(_0x2faf('0x6'));var util=require(_0x2faf('0x7'));var path=require(_0x2faf('0x8'));var sox=require(_0x2faf('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2faf('0xa'));var squel=require(_0x2faf('0xb'));var crypto=require(_0x2faf('0xc'));var jsforce=require(_0x2faf('0xd'));var deskjs=require(_0x2faf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2faf('0xf'));var Redis=require(_0x2faf('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2faf('0x11'));var hardwareService=require(_0x2faf('0x12'));var logger=require(_0x2faf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2faf('0x14'));var licenseUtil=require(_0x2faf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x335730,_0x509157){_0x509157=_0x509157||0xcc;return function(_0x1945fe){if(_0x1945fe){return _0x335730[_0x2faf('0x16')](_0x509157);}return _0x335730[_0x2faf('0x17')](_0x509157)[_0x2faf('0x18')]();};}function respondWithResult(_0x1be421,_0x27d2c1){_0x27d2c1=_0x27d2c1||0xc8;return function(_0x4c44bb){if(_0x4c44bb){return _0x1be421[_0x2faf('0x17')](_0x27d2c1)[_0x2faf('0x19')](_0x4c44bb);}};}function respondWithFilteredResult(_0x5167af,_0x1fd4d3){return function(_0x3be136){if(_0x3be136){var _0x45cd2c=typeof _0x1fd4d3[_0x2faf('0x1a')]==='undefined'&&typeof _0x1fd4d3[_0x2faf('0x1b')]===_0x2faf('0x1c');var _0x30213e=_0x3be136[_0x2faf('0x1d')];var _0x5a0728=_0x45cd2c?0x0:_0x1fd4d3[_0x2faf('0x1a')];var _0xfc6439=_0x45cd2c?_0x3be136[_0x2faf('0x1d')]:_0x1fd4d3[_0x2faf('0x1a')]+_0x1fd4d3[_0x2faf('0x1b')];var _0x40d8bf;if(_0xfc6439>=_0x30213e){_0xfc6439=_0x30213e;_0x40d8bf=0xc8;}else{_0x40d8bf=0xce;}_0x5167af[_0x2faf('0x17')](_0x40d8bf);return _0x5167af['set']('Content-Range',_0x5a0728+'-'+_0xfc6439+'/'+_0x30213e)['json'](_0x3be136);}return null;};}function patchUpdates(_0x219f13){return function(_0x1a6f89){try{jsonpatch['apply'](_0x1a6f89,_0x219f13,!![]);}catch(_0x4295b9){return BPromise['reject'](_0x4295b9);}return _0x1a6f89['save']();};}function saveUpdates(_0x328814,_0x2cb862){return function(_0x5d8cb7){if(_0x5d8cb7){return _0x5d8cb7[_0x2faf('0x1e')](_0x328814)[_0x2faf('0x1f')](function(_0x3545cf){return _0x3545cf;});}return null;};}function removeEntity(_0x3f598c,_0xfe4559){return function(_0x2d7e18){if(_0x2d7e18){return _0x2d7e18[_0x2faf('0x20')]()[_0x2faf('0x1f')](function(){_0x3f598c[_0x2faf('0x17')](0xcc)[_0x2faf('0x18')]();});}};}function handleEntityNotFound(_0x770d45,_0x2114f7){return function(_0x5f1359){if(!_0x5f1359){_0x770d45[_0x2faf('0x16')](0x194);}return _0x5f1359;};}function handleError(_0x13b655,_0xa092f6){_0xa092f6=_0xa092f6||0x1f4;return function(_0x53f72c){logger[_0x2faf('0x21')](_0x53f72c[_0x2faf('0x22')]);if(_0x53f72c[_0x2faf('0x23')]){delete _0x53f72c[_0x2faf('0x23')];}_0x13b655[_0x2faf('0x17')](_0xa092f6)[_0x2faf('0x24')](_0x53f72c);};}exports['index']=function(_0x3df9b1,_0x583d48){var _0x14acde={},_0x1133a0={},_0x147730={'count':0x0,'rows':[]};var _0x37398e=_[_0x2faf('0x25')](db[_0x2faf('0x26')][_0x2faf('0x27')],function(_0x266dce){return{'name':_0x266dce[_0x2faf('0x28')],'type':_0x266dce['type'][_0x2faf('0x29')]};});_0x1133a0[_0x2faf('0x2a')]=_[_0x2faf('0x25')](_0x37398e,_0x2faf('0x23'));_0x1133a0[_0x2faf('0x2b')]=_['keys'](_0x3df9b1[_0x2faf('0x2b')]);_0x1133a0[_0x2faf('0x2c')]=_['intersection'](_0x1133a0[_0x2faf('0x2a')],_0x1133a0[_0x2faf('0x2b')]);_0x14acde[_0x2faf('0x2d')]=_[_0x2faf('0x2e')](_0x1133a0['model'],qs[_0x2faf('0x2f')](_0x3df9b1['query']['fields']));_0x14acde[_0x2faf('0x2d')]=_0x14acde[_0x2faf('0x2d')][_0x2faf('0x30')]?_0x14acde[_0x2faf('0x2d')]:_0x1133a0['model'];if(!_0x3df9b1['query'][_0x2faf('0x31')](_0x2faf('0x32'))){_0x14acde[_0x2faf('0x1b')]=qs[_0x2faf('0x1b')](_0x3df9b1[_0x2faf('0x2b')][_0x2faf('0x1b')]);_0x14acde['offset']=qs[_0x2faf('0x1a')](_0x3df9b1[_0x2faf('0x2b')][_0x2faf('0x1a')]);}_0x14acde[_0x2faf('0x33')]=qs[_0x2faf('0x34')](_0x3df9b1[_0x2faf('0x2b')][_0x2faf('0x34')]);_0x14acde[_0x2faf('0x35')]=qs[_0x2faf('0x2c')](_[_0x2faf('0x36')](_0x3df9b1[_0x2faf('0x2b')],_0x1133a0[_0x2faf('0x2c')]),_0x37398e);if(_0x3df9b1[_0x2faf('0x2b')]['filter']){_0x14acde['where']=_[_0x2faf('0x37')](_0x14acde[_0x2faf('0x35')],{'$or':_['map'](_0x37398e,function(_0x532017){if(_0x532017[_0x2faf('0x38')]!==_0x2faf('0x39')){var _0x2d0bfb={};_0x2d0bfb[_0x532017[_0x2faf('0x23')]]={'$like':'%'+_0x3df9b1[_0x2faf('0x2b')][_0x2faf('0x3a')]+'%'};return _0x2d0bfb;}})});}_0x14acde=_[_0x2faf('0x37')]({},_0x14acde,_0x3df9b1['options']);var _0x51fd42={'where':_0x14acde[_0x2faf('0x35')]};return db['WhatsappApplication']['count'](_0x51fd42)['then'](function(_0x5198bf){_0x147730[_0x2faf('0x1d')]=_0x5198bf;if(_0x3df9b1[_0x2faf('0x2b')][_0x2faf('0x3b')]){_0x14acde['include']=[{'all':!![]}];}return db[_0x2faf('0x26')]['findAll'](_0x14acde);})['then'](function(_0x22662a){_0x147730[_0x2faf('0x3c')]=_0x22662a;return _0x147730;})[_0x2faf('0x1f')](respondWithFilteredResult(_0x583d48,_0x14acde))[_0x2faf('0x3d')](handleError(_0x583d48,null));};exports[_0x2faf('0x3e')]=function(_0x5a731b,_0x386887){var _0x450509={'raw':!![],'where':{'id':_0x5a731b[_0x2faf('0x3f')]['id']}},_0x294e5c={};_0x294e5c[_0x2faf('0x2a')]=_[_0x2faf('0x40')](db[_0x2faf('0x26')][_0x2faf('0x27')]);_0x294e5c[_0x2faf('0x2b')]=_[_0x2faf('0x40')](_0x5a731b[_0x2faf('0x2b')]);_0x294e5c[_0x2faf('0x2c')]=_['intersection'](_0x294e5c[_0x2faf('0x2a')],_0x294e5c[_0x2faf('0x2b')]);_0x450509[_0x2faf('0x2d')]=_[_0x2faf('0x2e')](_0x294e5c[_0x2faf('0x2a')],qs[_0x2faf('0x2f')](_0x5a731b[_0x2faf('0x2b')]['fields']));_0x450509[_0x2faf('0x2d')]=_0x450509[_0x2faf('0x2d')][_0x2faf('0x30')]?_0x450509[_0x2faf('0x2d')]:_0x294e5c[_0x2faf('0x2a')];if(_0x5a731b[_0x2faf('0x2b')][_0x2faf('0x3b')]){_0x450509['include']=[{'all':!![]}];}_0x450509=_[_0x2faf('0x37')]({},_0x450509,_0x5a731b['options']);return db[_0x2faf('0x26')][_0x2faf('0x41')](_0x450509)[_0x2faf('0x1f')](handleEntityNotFound(_0x386887,null))[_0x2faf('0x1f')](respondWithResult(_0x386887,null))[_0x2faf('0x3d')](handleError(_0x386887,null));};exports[_0x2faf('0x42')]=function(_0x489b88,_0x2d2171){return db[_0x2faf('0x26')][_0x2faf('0x42')](_0x489b88[_0x2faf('0x43')],{})[_0x2faf('0x1f')](respondWithResult(_0x2d2171,0xc9))[_0x2faf('0x3d')](handleError(_0x2d2171,null));};exports[_0x2faf('0x1e')]=function(_0x3d0f6e,_0x274a4e){if(_0x3d0f6e[_0x2faf('0x43')]['id']){delete _0x3d0f6e['body']['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x3d0f6e[_0x2faf('0x3f')]['id']}})[_0x2faf('0x1f')](handleEntityNotFound(_0x274a4e,null))['then'](saveUpdates(_0x3d0f6e[_0x2faf('0x43')],null))['then'](respondWithResult(_0x274a4e,null))[_0x2faf('0x3d')](handleError(_0x274a4e,null));};exports['destroy']=function(_0x2b730e,_0x46c132){return db[_0x2faf('0x26')]['find']({'where':{'id':_0x2b730e['params']['id']}})[_0x2faf('0x1f')](handleEntityNotFound(_0x46c132,null))[_0x2faf('0x1f')](removeEntity(_0x46c132,null))['catch'](handleError(_0x46c132,null));}; \ No newline at end of file +var _0x5ae9=['create','body','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','then','destroy','end','error','stack','name','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','keys','find'];(function(_0x15131a,_0x204bcd){var _0x8f309b=function(_0x1bacce){while(--_0x1bacce){_0x15131a['push'](_0x15131a['shift']());}};_0x8f309b(++_0x204bcd);}(_0x5ae9,0x19b));var _0x95ae=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x5ae9[_0x5b26cb];return _0x563d12;};'use strict';var emlformat=require(_0x95ae('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x95ae('0x1'));var rp=require(_0x95ae('0x2'));var moment=require('moment');var BPromise=require(_0x95ae('0x3'));var Mustache=require(_0x95ae('0x4'));var util=require('util');var path=require(_0x95ae('0x5'));var sox=require('sox');var csv=require(_0x95ae('0x6'));var ejs=require(_0x95ae('0x7'));var fs=require('fs');var fs_extra=require(_0x95ae('0x8'));var _=require(_0x95ae('0x9'));var squel=require(_0x95ae('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x95ae('0xb'));var toCsv=require(_0x95ae('0x6'));var querystring=require(_0x95ae('0xc'));var Papa=require(_0x95ae('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x95ae('0xe'));var as=require(_0x95ae('0xf'));var hardwareService=require(_0x95ae('0x10'));var logger=require(_0x95ae('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x95ae('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x95ae('0x13'))['db'];function respondWithStatusCode(_0x2a9b87,_0x530bb8){_0x530bb8=_0x530bb8||0xcc;return function(_0xc1af8f){if(_0xc1af8f){return _0x2a9b87[_0x95ae('0x14')](_0x530bb8);}return _0x2a9b87[_0x95ae('0x15')](_0x530bb8)['end']();};}function respondWithResult(_0x4685a4,_0x3af218){_0x3af218=_0x3af218||0xc8;return function(_0x308b7a){if(_0x308b7a){return _0x4685a4['status'](_0x3af218)[_0x95ae('0x16')](_0x308b7a);}};}function respondWithFilteredResult(_0x5ebbb7,_0x210e00){return function(_0x57bd67){if(_0x57bd67){var _0x2594fe=typeof _0x210e00[_0x95ae('0x17')]===_0x95ae('0x18')&&typeof _0x210e00[_0x95ae('0x19')]===_0x95ae('0x18');var _0x38b457=_0x57bd67[_0x95ae('0x1a')];var _0x24d5d2=_0x2594fe?0x0:_0x210e00[_0x95ae('0x17')];var _0x47ed05=_0x2594fe?_0x57bd67[_0x95ae('0x1a')]:_0x210e00[_0x95ae('0x17')]+_0x210e00['limit'];var _0x14a11d;if(_0x47ed05>=_0x38b457){_0x47ed05=_0x38b457;_0x14a11d=0xc8;}else{_0x14a11d=0xce;}_0x5ebbb7[_0x95ae('0x15')](_0x14a11d);return _0x5ebbb7['set']('Content-Range',_0x24d5d2+'-'+_0x47ed05+'/'+_0x38b457)[_0x95ae('0x16')](_0x57bd67);}return null;};}function patchUpdates(_0x16aa0c){return function(_0x1359a8){try{jsonpatch[_0x95ae('0x1b')](_0x1359a8,_0x16aa0c,!![]);}catch(_0x8ed1b1){return BPromise['reject'](_0x8ed1b1);}return _0x1359a8[_0x95ae('0x1c')]();};}function saveUpdates(_0x457324,_0x1ecde4){return function(_0x2ad155){if(_0x2ad155){return _0x2ad155['update'](_0x457324)[_0x95ae('0x1d')](function(_0x5b0453){return _0x5b0453;});}return null;};}function removeEntity(_0x7fd81f,_0x59f88a){return function(_0x2b46c5){if(_0x2b46c5){return _0x2b46c5[_0x95ae('0x1e')]()[_0x95ae('0x1d')](function(){_0x7fd81f['status'](0xcc)[_0x95ae('0x1f')]();});}};}function handleEntityNotFound(_0x25d81c,_0x1b3dc5){return function(_0x1437e1){if(!_0x1437e1){_0x25d81c[_0x95ae('0x14')](0x194);}return _0x1437e1;};}function handleError(_0x4d24a6,_0x455eda){_0x455eda=_0x455eda||0x1f4;return function(_0x4e2436){logger[_0x95ae('0x20')](_0x4e2436[_0x95ae('0x21')]);if(_0x4e2436[_0x95ae('0x22')]){delete _0x4e2436['name'];}_0x4d24a6[_0x95ae('0x15')](_0x455eda)['send'](_0x4e2436);};}exports[_0x95ae('0x23')]=function(_0x5f4d16,_0x611fca){var _0x424e0f={},_0x4fa625={},_0x3df451={'count':0x0,'rows':[]};var _0x2751c9=_[_0x95ae('0x24')](db['WhatsappApplication'][_0x95ae('0x25')],function(_0x4c111d){return{'name':_0x4c111d['fieldName'],'type':_0x4c111d['type'][_0x95ae('0x26')]};});_0x4fa625[_0x95ae('0x27')]=_[_0x95ae('0x24')](_0x2751c9,'name');_0x4fa625[_0x95ae('0x28')]=_['keys'](_0x5f4d16[_0x95ae('0x28')]);_0x4fa625[_0x95ae('0x29')]=_['intersection'](_0x4fa625[_0x95ae('0x27')],_0x4fa625['query']);_0x424e0f[_0x95ae('0x2a')]=_[_0x95ae('0x2b')](_0x4fa625['model'],qs[_0x95ae('0x2c')](_0x5f4d16[_0x95ae('0x28')][_0x95ae('0x2c')]));_0x424e0f[_0x95ae('0x2a')]=_0x424e0f[_0x95ae('0x2a')][_0x95ae('0x2d')]?_0x424e0f[_0x95ae('0x2a')]:_0x4fa625['model'];if(!_0x5f4d16['query'][_0x95ae('0x2e')](_0x95ae('0x2f'))){_0x424e0f[_0x95ae('0x19')]=qs[_0x95ae('0x19')](_0x5f4d16[_0x95ae('0x28')]['limit']);_0x424e0f[_0x95ae('0x17')]=qs[_0x95ae('0x17')](_0x5f4d16[_0x95ae('0x28')][_0x95ae('0x17')]);}_0x424e0f[_0x95ae('0x30')]=qs[_0x95ae('0x31')](_0x5f4d16['query'][_0x95ae('0x31')]);_0x424e0f[_0x95ae('0x32')]=qs[_0x95ae('0x29')](_[_0x95ae('0x33')](_0x5f4d16['query'],_0x4fa625[_0x95ae('0x29')]),_0x2751c9);if(_0x5f4d16['query'][_0x95ae('0x34')]){_0x424e0f[_0x95ae('0x32')]=_[_0x95ae('0x35')](_0x424e0f[_0x95ae('0x32')],{'$or':_[_0x95ae('0x24')](_0x2751c9,function(_0x2222a2){if(_0x2222a2['type']!==_0x95ae('0x36')){var _0xf65b36={};_0xf65b36[_0x2222a2['name']]={'$like':'%'+_0x5f4d16['query'][_0x95ae('0x34')]+'%'};return _0xf65b36;}})});}_0x424e0f=_[_0x95ae('0x35')]({},_0x424e0f,_0x5f4d16[_0x95ae('0x37')]);var _0x53ca83={'where':_0x424e0f[_0x95ae('0x32')]};return db[_0x95ae('0x38')][_0x95ae('0x1a')](_0x53ca83)[_0x95ae('0x1d')](function(_0x1a3b58){_0x3df451[_0x95ae('0x1a')]=_0x1a3b58;if(_0x5f4d16['query'][_0x95ae('0x39')]){_0x424e0f[_0x95ae('0x3a')]=[{'all':!![]}];}return db[_0x95ae('0x38')][_0x95ae('0x3b')](_0x424e0f);})[_0x95ae('0x1d')](function(_0xf41d5b){_0x3df451[_0x95ae('0x3c')]=_0xf41d5b;return _0x3df451;})['then'](respondWithFilteredResult(_0x611fca,_0x424e0f))[_0x95ae('0x3d')](handleError(_0x611fca,null));};exports[_0x95ae('0x3e')]=function(_0x288d33,_0x36b11b){var _0x1ea78e={'raw':!![],'where':{'id':_0x288d33['params']['id']}},_0x4ec147={};_0x4ec147[_0x95ae('0x27')]=_[_0x95ae('0x3f')](db[_0x95ae('0x38')][_0x95ae('0x25')]);_0x4ec147['query']=_['keys'](_0x288d33['query']);_0x4ec147[_0x95ae('0x29')]=_['intersection'](_0x4ec147['model'],_0x4ec147[_0x95ae('0x28')]);_0x1ea78e[_0x95ae('0x2a')]=_['intersection'](_0x4ec147[_0x95ae('0x27')],qs[_0x95ae('0x2c')](_0x288d33[_0x95ae('0x28')][_0x95ae('0x2c')]));_0x1ea78e['attributes']=_0x1ea78e[_0x95ae('0x2a')][_0x95ae('0x2d')]?_0x1ea78e[_0x95ae('0x2a')]:_0x4ec147['model'];if(_0x288d33[_0x95ae('0x28')][_0x95ae('0x39')]){_0x1ea78e[_0x95ae('0x3a')]=[{'all':!![]}];}_0x1ea78e=_[_0x95ae('0x35')]({},_0x1ea78e,_0x288d33[_0x95ae('0x37')]);return db[_0x95ae('0x38')][_0x95ae('0x40')](_0x1ea78e)[_0x95ae('0x1d')](handleEntityNotFound(_0x36b11b,null))[_0x95ae('0x1d')](respondWithResult(_0x36b11b,null))['catch'](handleError(_0x36b11b,null));};exports[_0x95ae('0x41')]=function(_0x55e6e3,_0x41cec7){return db[_0x95ae('0x38')][_0x95ae('0x41')](_0x55e6e3['body'],{})[_0x95ae('0x1d')](respondWithResult(_0x41cec7,0xc9))[_0x95ae('0x3d')](handleError(_0x41cec7,null));};exports['update']=function(_0x13e4eb,_0x468620){if(_0x13e4eb['body']['id']){delete _0x13e4eb[_0x95ae('0x42')]['id'];}return db[_0x95ae('0x38')]['find']({'where':{'id':_0x13e4eb[_0x95ae('0x43')]['id']}})['then'](handleEntityNotFound(_0x468620,null))[_0x95ae('0x1d')](saveUpdates(_0x13e4eb[_0x95ae('0x42')],null))[_0x95ae('0x1d')](respondWithResult(_0x468620,null))['catch'](handleError(_0x468620,null));};exports[_0x95ae('0x1e')]=function(_0x43e3c0,_0x5322b1){return db[_0x95ae('0x38')][_0x95ae('0x40')]({'where':{'id':_0x43e3c0['params']['id']}})['then'](handleEntityNotFound(_0x5322b1,null))[_0x95ae('0x1d')](removeEntity(_0x5322b1,null))[_0x95ae('0x3d')](handleError(_0x5322b1,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d286022..b3c6317 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 _0x089f=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','utf8mb4','util'];(function(_0x134058,_0x423995){var _0x14a1a9=function(_0x47a2c9){while(--_0x47a2c9){_0x134058['push'](_0x134058['shift']());}};_0x14a1a9(++_0x423995);}(_0x089f,0x1c7));var _0xf089=function(_0xc42695,_0x2b0f48){_0xc42695=_0xc42695-0x0;var _0x27a40c=_0x089f[_0xc42695];return _0x27a40c;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var logger=require(_0xf089('0x1'))(_0xf089('0x2'));var moment=require(_0xf089('0x3'));var BPromise=require(_0xf089('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf089('0x5'));var rimraf=require(_0xf089('0x6'));var config=require(_0xf089('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xf089('0x8')]=function(_0x126d3d,_0x21bce2){return _0x126d3d['define'](_0xf089('0x9'),attributes,{'tableName':_0xf089('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf089('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf3cc=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x208c54,_0x120a70){var _0x4b0116=function(_0x32be34){while(--_0x32be34){_0x208c54['push'](_0x208c54['shift']());}};_0x4b0116(++_0x120a70);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x16cf9e,_0x3d3cfd){_0x16cf9e=_0x16cf9e-0x0;var _0x56aefd=_0xf3cc[_0x16cf9e];return _0x56aefd;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fs=require('fs');var path=require(_0xcf3c('0x6'));var rimraf=require('rimraf');var config=require(_0xcf3c('0x7'));var attributes=require(_0xcf3c('0x8'));module['exports']=function(_0x41f804,_0x2b5cae){return _0x41f804[_0xcf3c('0x9')](_0xcf3c('0xa'),attributes,{'tableName':_0xcf3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcf3c('0xc'),'collate':_0xcf3c('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 0552e8a..2f3e28f 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 _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(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xdace,0xc5));var _0xedac=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xdace[_0x2bc3f4];return _0x14ac53;};'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 +var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xe1388e,_0xb9ecd1){var _0x44ecfa=function(_0x5c07b4){while(--_0x5c07b4){_0xe1388e['push'](_0xe1388e['shift']());}};_0x44ecfa(++_0xb9ecd1);}(_0x84ab,0x12f));var _0xb84a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x84ab[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index db6c70a..091f33f 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 _0x4975=['removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x4975,0x86));var _0x5497=function(_0x4a02de,_0xd22409){_0x4a02de=_0x4a02de-0x0;var _0x31a400=_0x4975[_0x4a02de];return _0x31a400;};'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('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x5497('0x14')]);router[_0x5497('0x15')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x15')](_0x5497('0x17'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),'whatsappinteraction:addtags'),controller[_0x5497('0x1a')]);router['put'](_0x5497('0xf'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1b')),controller[_0x5497('0x1c')]);router[_0x5497('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1e')),controller['destroy']);router[_0x5497('0x1d')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);module[_0x5497('0x20')]=router; \ No newline at end of file +var _0x4975=['removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x4975,0x86));var _0x5497=function(_0x3796b2,_0x1b89df){_0x3796b2=_0x3796b2-0x0;var _0x4cc0d0=_0x4975[_0x3796b2];return _0x4cc0d0;};'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('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x5497('0x14')]);router[_0x5497('0x15')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x15')](_0x5497('0x17'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),'whatsappinteraction:addtags'),controller[_0x5497('0x1a')]);router['put'](_0x5497('0xf'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1b')),controller[_0x5497('0x1c')]);router[_0x5497('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1e')),controller['destroy']);router[_0x5497('0x1d')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);module[_0x5497('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 5ce6b4e..0cb2f44 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 _0x90b5=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x31306b,_0x2958aa){var _0x3f23f7=function(_0x31e575){while(--_0x31e575){_0x31306b['push'](_0x31306b['shift']());}};_0x3f23f7(++_0x2958aa);}(_0x90b5,0x139));var _0x590b=function(_0xa53890,_0x545e2e){_0xa53890=_0xa53890-0x0;var _0x19a5dd=_0x90b5[_0xa53890];return _0x19a5dd;};'use strict';var Sequelize=require(_0x590b('0x0'));var moment=require('moment');module[_0x590b('0x1')]={'closed':{'type':Sequelize[_0x590b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x590b('0x3')]},'disposition':{'type':Sequelize[_0x590b('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x590b('0x4')]},'phone':{'type':Sequelize[_0x590b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x590b('0x5')]('in',_0x590b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x590b('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x590b('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x590b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9330=['sequelize','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x31e846,_0xe7bc33){var _0x25c7a4=function(_0x3328be){while(--_0x3328be){_0x31e846['push'](_0x31e846['shift']());}};_0x25c7a4(++_0xe7bc33);}(_0x9330,0x14a));var _0x0933=function(_0x4afcfd,_0x274d0e){_0x4afcfd=_0x4afcfd-0x0;var _0x5c29d3=_0x9330[_0x4afcfd];return _0x5c29d3;};'use strict';var Sequelize=require(_0x0933('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x0933('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0933('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0933('0x2')]},'note':{'type':Sequelize[_0x0933('0x2')]},'phone':{'type':Sequelize[_0x0933('0x2')]},'read1stAt':{'type':Sequelize[_0x0933('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0933('0x4')]('in',_0x0933('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0933('0x4')]('in',_0x0933('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0933('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 8b51b5b..24bd45d 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 _0xdde1=['unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','user','show','params','model','keys','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','body','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','fields','hasOwnProperty','nolimit','sort','WhatsappInteractionId','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','download','files','join','server','attachments','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','push','WhatsappAccount','Owner','get','Whatsapp','toString','disposition','basename','existsSync','createReadStream','System','firstName','out','read','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdde1,0xf5));var _0x1dde=function(_0x58c654,_0x56f774){_0x58c654=_0x58c654-0x0;var _0x1b1164=_0xdde1[_0x58c654];return _0x1b1164;};'use strict';var rimraf=require(_0x1dde('0x0'));var zipdir=require(_0x1dde('0x1'));var moment=require('moment');var BPromise=require(_0x1dde('0x2'));var util=require(_0x1dde('0x3'));var path=require(_0x1dde('0x4'));var ejs=require(_0x1dde('0x5'));var fs=require('fs');var _=require(_0x1dde('0x6'));var Redis=require(_0x1dde('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x1dde('0x8'));var pdf=require(_0x1dde('0x9'));var logger=require(_0x1dde('0xa'))(_0x1dde('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1dde('0xc')]=_[_0x1dde('0xd')](config[_0x1dde('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1dde('0xe'))[_0x1dde('0xf')](socket);function respondWithStatusCode(_0x2846bf,_0x2f9c3d){_0x2f9c3d=_0x2f9c3d||0xcc;return function(_0xc3766e){if(_0xc3766e){return _0x2846bf[_0x1dde('0x10')](_0x2f9c3d);}return _0x2846bf[_0x1dde('0x11')](_0x2f9c3d)[_0x1dde('0x12')]();};}function respondWithResult(_0x181e79,_0x3e4d35){_0x3e4d35=_0x3e4d35||0xc8;return function(_0x5bec5b){if(_0x5bec5b){return _0x181e79[_0x1dde('0x11')](_0x3e4d35)['json'](_0x5bec5b);}};}function respondWithFilteredResult(_0x1392ba,_0x40ceff){return function(_0x1eda19){if(_0x1eda19){var _0x16ed20=typeof _0x40ceff[_0x1dde('0x13')]===_0x1dde('0x14')&&typeof _0x40ceff[_0x1dde('0x15')]===_0x1dde('0x14');var _0x37a959=_0x1eda19[_0x1dde('0x16')];var _0x5edff0=_0x16ed20?0x0:_0x40ceff[_0x1dde('0x13')];var _0x5146e9=_0x16ed20?_0x1eda19[_0x1dde('0x16')]:_0x40ceff[_0x1dde('0x13')]+_0x40ceff[_0x1dde('0x15')];var _0x2bb9d9;if(_0x5146e9>=_0x37a959){_0x5146e9=_0x37a959;_0x2bb9d9=0xc8;}else{_0x2bb9d9=0xce;}_0x1392ba[_0x1dde('0x11')](_0x2bb9d9);return _0x1392ba[_0x1dde('0x17')](_0x1dde('0x18'),_0x5edff0+'-'+_0x5146e9+'/'+_0x37a959)[_0x1dde('0x19')](_0x1eda19);}return null;};}function saveUpdates(_0x8cbbde){return function(_0x168be5){if(_0x168be5){return _0x168be5[_0x1dde('0x1a')](_0x8cbbde)[_0x1dde('0x1b')](function(_0x5dcf30){return _0x5dcf30;});}return null;};}function removeEntity(_0x169d40){return function(_0xbeea23){if(_0xbeea23){return _0xbeea23['destroy']()[_0x1dde('0x1b')](function(){_0x169d40[_0x1dde('0x11')](0xcc)[_0x1dde('0x12')]();});}};}function handleEntityNotFound(_0x24c15b){return function(_0x70c740){if(!_0x70c740){_0x24c15b[_0x1dde('0x10')](0x194);}return _0x70c740;};}function handleError(_0x4b7024,_0xeb5c15){_0xeb5c15=_0xeb5c15||0x1f4;return function(_0x2cf64f){logger[_0x1dde('0x1c')](_0x2cf64f[_0x1dde('0x1d')]);if(_0x2cf64f['name']){delete _0x2cf64f[_0x1dde('0x1e')];}_0x4b7024['status'](_0xeb5c15)[_0x1dde('0x1f')](_0x2cf64f);};}exports[_0x1dde('0x20')]=function(_0x16eef4,_0x3376bf){var _0x239319={};var _0x5ac6d8=_[_0x1dde('0x21')](db[_0x1dde('0x22')][_0x1dde('0x23')],function(_0x49d092){return{'name':_0x49d092['fieldName'],'type':_0x49d092[_0x1dde('0x24')][_0x1dde('0x25')]};});_0x239319=qs[_0x1dde('0x26')](_0x5ac6d8,_0x16eef4);return interaction[_0x1dde('0x27')](_0x1dde('0x28'),_0x16eef4[_0x1dde('0x29')],_0x16eef4[_0x1dde('0x2a')],_0x239319,_0x5ac6d8)['then'](respondWithFilteredResult(_0x3376bf,_0x239319))['catch'](handleError(_0x3376bf,null));};exports[_0x1dde('0x2b')]=function(_0x217a90,_0x5c79e9){var _0x2c05ce={'raw':![],'where':{'id':_0x217a90[_0x1dde('0x2c')]['id']}},_0x334270={};_0x334270[_0x1dde('0x2d')]=_[_0x1dde('0x2e')](db['WhatsappInteraction']['rawAttributes']);_0x334270[_0x1dde('0x29')]=_['keys'](_0x217a90[_0x1dde('0x29')]);_0x334270[_0x1dde('0x2f')]=_[_0x1dde('0x30')](_0x334270[_0x1dde('0x2d')],_0x334270[_0x1dde('0x29')]);_0x2c05ce[_0x1dde('0x31')]=_[_0x1dde('0x30')](_0x334270['model'],qs['fields'](_0x217a90[_0x1dde('0x29')]['fields']));_0x2c05ce[_0x1dde('0x31')]=_0x2c05ce[_0x1dde('0x31')][_0x1dde('0x32')]?_0x2c05ce[_0x1dde('0x31')]:_0x334270[_0x1dde('0x2d')];if(_0x217a90[_0x1dde('0x29')][_0x1dde('0x33')]){_0x2c05ce[_0x1dde('0x34')]=[{'all':!![]}];}_0x2c05ce=_[_0x1dde('0x35')]({},_0x2c05ce,_0x217a90[_0x1dde('0x36')]);return db[_0x1dde('0x22')][_0x1dde('0x37')](_0x2c05ce)['then'](handleEntityNotFound(_0x5c79e9,null))['then'](respondWithResult(_0x5c79e9,null))[_0x1dde('0x38')](handleError(_0x5c79e9,null));};exports['create']=function(_0x3efb65,_0x3f8060){return db['WhatsappInteraction']['create'](_0x3efb65[_0x1dde('0x39')],{})[_0x1dde('0x1b')](respondWithResult(_0x3f8060,0xc9))['catch'](handleError(_0x3f8060,null));};exports['update']=function(_0x411a71,_0x619a2a){if(_0x411a71[_0x1dde('0x39')]['id']){delete _0x411a71[_0x1dde('0x39')]['id'];}return db[_0x1dde('0x22')][_0x1dde('0x37')]({'where':{'id':_0x411a71[_0x1dde('0x2c')]['id']}})['then'](handleEntityNotFound(_0x619a2a,null))[_0x1dde('0x1b')](saveUpdates(_0x411a71['body'],null))[_0x1dde('0x1b')](respondWithResult(_0x619a2a,null))[_0x1dde('0x38')](handleError(_0x619a2a,null));};exports['destroy']=function(_0x1c91d1,_0x3b761b){return db[_0x1dde('0x22')]['find']({'where':{'id':_0x1c91d1[_0x1dde('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3b761b,null))[_0x1dde('0x1b')](removeEntity(_0x3b761b,null))['catch'](handleError(_0x3b761b,null));};exports[_0x1dde('0x3a')]=function(_0x5b48e7,_0x5ad200){return db['WhatsappInteraction'][_0x1dde('0x3a')]()[_0x1dde('0x1b')](respondWithResult(_0x5ad200,null))[_0x1dde('0x38')](handleError(_0x5ad200,null));};exports[_0x1dde('0x3b')]=function(_0x179780,_0x335e9a){return db[_0x1dde('0x3c')][_0x1dde('0x37')]({'where':{'id':_0x179780[_0x1dde('0x2c')]['id']}})[_0x1dde('0x1b')](handleEntityNotFound(_0x335e9a,null))['then'](function(_0x2d0d68){if(_0x2d0d68){return _0x2d0d68[_0x1dde('0x3b')](_0x179780[_0x1dde('0x39')][_0x1dde('0x3d')],_['omit'](_0x179780[_0x1dde('0x39')],['ids','id'])||{});}})[_0x1dde('0x1b')](respondWithResult(_0x335e9a,null))['catch'](handleError(_0x335e9a,null));};exports[_0x1dde('0x3e')]=function(_0x1ed048,_0x53918c){var _0x2c1509={'raw':![],'where':{}};var _0x3b4206={};var _0x100261={'count':0x0,'rows':[]};return db[_0x1dde('0x22')][_0x1dde('0x3f')]({'where':{'id':_0x1ed048['params']['id']}})[_0x1dde('0x1b')](handleEntityNotFound(_0x53918c,null))[_0x1dde('0x1b')](function(_0x57fb53){if(_0x57fb53){_0x3b4206[_0x1dde('0x2d')]=_[_0x1dde('0x2e')](db[_0x1dde('0x3c')][_0x1dde('0x23')]);_0x3b4206[_0x1dde('0x29')]=_[_0x1dde('0x2e')](_0x1ed048[_0x1dde('0x29')]);_0x3b4206['filters']=_[_0x1dde('0x30')](_0x3b4206[_0x1dde('0x2d')],_0x3b4206[_0x1dde('0x29')]);_0x2c1509[_0x1dde('0x31')]=_['intersection'](_0x3b4206[_0x1dde('0x2d')],qs[_0x1dde('0x40')](_0x1ed048[_0x1dde('0x29')][_0x1dde('0x40')]));_0x2c1509[_0x1dde('0x31')]=_0x2c1509[_0x1dde('0x31')]['length']?_0x2c1509[_0x1dde('0x31')]:_0x3b4206[_0x1dde('0x2d')];if(!_0x1ed048[_0x1dde('0x29')][_0x1dde('0x41')](_0x1dde('0x42'))){_0x2c1509[_0x1dde('0x15')]=qs['limit'](_0x1ed048[_0x1dde('0x29')][_0x1dde('0x15')]);_0x2c1509[_0x1dde('0x13')]=qs['offset'](_0x1ed048[_0x1dde('0x29')][_0x1dde('0x13')]);}_0x2c1509['order']=qs[_0x1dde('0x43')](_0x1ed048[_0x1dde('0x29')][_0x1dde('0x43')]);_0x2c1509['where']=qs[_0x1dde('0x2f')](_['pick'](_0x1ed048[_0x1dde('0x29')],_0x3b4206['filters']));_0x2c1509['where'][_0x1dde('0x44')]=_0x57fb53['id'];if(_0x1ed048[_0x1dde('0x29')]['filter']){_0x2c1509[_0x1dde('0x45')]=_[_0x1dde('0x35')](_0x2c1509[_0x1dde('0x45')],{'$or':_[_0x1dde('0x21')](_0x2c1509[_0x1dde('0x31')],function(_0x3f1e73){var _0x59c690={};_0x59c690[_0x3f1e73]={'$like':'%'+_0x1ed048[_0x1dde('0x29')][_0x1dde('0x46')]+'%'};return _0x59c690;})});}if(_0x1ed048['query'][_0x1dde('0x47')]){var _0x4682e3=_0x1ed048[_0x1dde('0x29')][_0x1dde('0x47')][_0x1dde('0x48')](',');var _0x18a7f1={};_0x18a7f1[_0x4682e3[0x0]]={'$gte':moment(_0x4682e3[0x1])[_0x1dde('0x49')](_0x1dde('0x4a'))};_0x2c1509['where']=_[_0x1dde('0x35')](_0x2c1509['where'],_0x18a7f1);}_0x2c1509=_[_0x1dde('0x35')]({},_0x2c1509,_0x1ed048[_0x1dde('0x36')]);return db['WhatsappMessage'][_0x1dde('0x16')]({'where':_0x2c1509['where']})[_0x1dde('0x1b')](function(_0x259649){_0x100261['count']=_0x259649;if(_0x1ed048['query'][_0x1dde('0x33')]){_0x2c1509[_0x1dde('0x34')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x1dde('0x27')](_0x2c1509);})[_0x1dde('0x1b')](function(_0x295ec0){_0x100261[_0x1dde('0x4b')]=_0x295ec0;return _0x100261;});}})[_0x1dde('0x1b')](respondWithFilteredResult(_0x53918c,_0x2c1509))[_0x1dde('0x38')](handleError(_0x53918c,null));};exports[_0x1dde('0x4c')]=function(_0x30afc3,_0x107d5c){return db[_0x1dde('0x22')][_0x1dde('0x37')]({'where':{'id':_0x30afc3[_0x1dde('0x2c')]['id']}})[_0x1dde('0x1b')](handleEntityNotFound(_0x107d5c,null))[_0x1dde('0x1b')](function(_0xf31458){if(_0xf31458){return _0xf31458[_0x1dde('0x4d')](_0x30afc3['body'][_0x1dde('0x3d')],_['omit'](_0x30afc3['body'],['ids','id'])||{})['spread'](function(){return db[_0x1dde('0x4e')][_0x1dde('0x27')]({'attributes':['id',_0x1dde('0x1e'),'color'],'where':{'id':_0x30afc3[_0x1dde('0x39')][_0x1dde('0x3d')]}});})[_0x1dde('0x1b')](function(_0x2e8af7){socket[_0x1dde('0x4f')](_0x1dde('0x50'),{'id':Number(_0x30afc3[_0x1dde('0x2c')]['id']),'tags':_0x2e8af7||[]});return{'id':Number(_0x30afc3['params']['id']),'tags':_0x2e8af7||[]};});}})[_0x1dde('0x1b')](respondWithResult(_0x107d5c,null))[_0x1dde('0x38')](handleError(_0x107d5c,null));};exports[_0x1dde('0x51')]=function(_0x4e7841,_0x2d4262){return db[_0x1dde('0x22')][_0x1dde('0x37')]({'where':{'id':_0x4e7841[_0x1dde('0x2c')]['id']}})[_0x1dde('0x1b')](handleEntityNotFound(_0x2d4262,null))[_0x1dde('0x1b')](function(_0x24aedd){if(_0x24aedd){return _0x24aedd[_0x1dde('0x51')](_0x4e7841[_0x1dde('0x29')]['ids']);}})['then'](respondWithStatusCode(_0x2d4262,null))[_0x1dde('0x38')](handleError(_0x2d4262,null));};exports[_0x1dde('0x52')]=function(_0x2a70f9,_0x5a7f2a){var _0x35aa10=moment()['unix']()['toString']();var _0x297c64=path['join'](config['root'],'server',_0x1dde('0x53'),'tmp');var _0x27b19d=path[_0x1dde('0x54')](config['root'],_0x1dde('0x55'),_0x1dde('0x53'),_0x1dde('0x56'));var _0xf108bc=path[_0x1dde('0x54')](_0x297c64,_0x35aa10);var _0xe9397a=util['format']('transcript-%d-%s.zip',_0x2a70f9['params']['id'],_0x35aa10);var _0x565753=path[_0x1dde('0x54')](_0x297c64,_0xe9397a);var _0x2f4d27=[];_0x2f4d27['push']({'model':db[_0x1dde('0x57')],'as':_0x1dde('0x57'),'attributes':['id',_0x1dde('0x58')],'raw':!![]});_0x2f4d27['push']({'model':db[_0x1dde('0x59')],'as':_0x1dde('0x5a'),'attributes':['id','firstName',_0x1dde('0x5b')],'raw':!![]});if(_0x2a70f9[_0x1dde('0x29')]['attachments']){_0x2f4d27['push']({'model':db['Attachment'],'as':_0x1dde('0x5c'),'raw':!![]});}var _0x5c1751=[{'model':db[_0x1dde('0x3c')],'as':_0x1dde('0x5d'),'attributes':['id','body',_0x1dde('0x5e'),_0x1dde('0x5f'),_0x1dde('0x60'),'read'],'include':_0x2f4d27}];_0x5c1751[_0x1dde('0x61')]({'model':db[_0x1dde('0x62')],'as':'Account','attributes':['id','name']});_0x5c1751[_0x1dde('0x61')]({'model':db[_0x1dde('0x57')],'as':_0x1dde('0x63'),'attributes':['id','fullname']});return db[_0x1dde('0x22')][_0x1dde('0x37')]({'where':{'id':_0x2a70f9[_0x1dde('0x2c')]['id']},'include':_0x5c1751})[_0x1dde('0x1b')](handleEntityNotFound(_0x5a7f2a,null))[_0x1dde('0x1b')](function(_0x1372b6){if(_0x1372b6){var _0x4edfd1=_0x1372b6[_0x1dde('0x64')]({'plain':!![]});fs['mkdirSync'](_0xf108bc);var _0x871249={'channel':_0x1dde('0x65'),'account':_0x4edfd1['Account'][_0x1dde('0x1e')],'agent':_0x4edfd1[_0x1dde('0x63')]?_0x4edfd1[_0x1dde('0x63')]['fullname']:'N.A.','createdAt':moment(_0x4edfd1[_0x1dde('0x5e')])[_0x1dde('0x49')](_0x1dde('0x4a'))[_0x1dde('0x66')](),'closedAt':_0x4edfd1['closed']?moment(_0x4edfd1['closedAt'])[_0x1dde('0x49')](_0x1dde('0x4a'))[_0x1dde('0x66')]():'','disposition':_0x4edfd1[_0x1dde('0x67')],'messages':_(_0x4edfd1['Messages'])[_0x1dde('0x46')]({'secret':![]})[_0x1dde('0x21')](function(_0x52aa6b){if(_0x52aa6b[_0x1dde('0x5c')]){var _0x188959=path['join'](_0x27b19d,_0x52aa6b[_0x1dde('0x5c')][_0x1dde('0x68')]);if(fs[_0x1dde('0x69')](_0x188959)){fs[_0x1dde('0x6a')](_0x188959)['pipe'](fs['createWriteStream'](path[_0x1dde('0x54')](_0xf108bc,_0x52aa6b['Attachment']['basename'])));}}return{'date':moment(_0x52aa6b[_0x1dde('0x5e')])[_0x1dde('0x49')](_0x1dde('0x4a'))[_0x1dde('0x66')](),'sender':_0x52aa6b[_0x1dde('0x5f')]==='out'?_0x52aa6b[_0x1dde('0x57')]?_0x52aa6b[_0x1dde('0x57')][_0x1dde('0x58')]:_0x1dde('0x6b'):_0x52aa6b[_0x1dde('0x5a')][_0x1dde('0x6c')]+(_0x52aa6b[_0x1dde('0x5a')][_0x1dde('0x5b')]?'\x20'+_0x52aa6b['Contact'][_0x1dde('0x5b')]:''),'body':_0x52aa6b['Attachment']?_0x52aa6b[_0x1dde('0x5c')]['basename']:_0x52aa6b[_0x1dde('0x39')],'direction':_0x52aa6b['direction']===_0x1dde('0x6d')?'A':'C','secret':_0x52aa6b[_0x1dde('0x60')],'read':_0x52aa6b[_0x1dde('0x6e')],'attachment':_0x52aa6b[_0x1dde('0x5c')]};})[_0x1dde('0x6f')]()};return ejs[_0x1dde('0x70')](path[_0x1dde('0x54')](config[_0x1dde('0x71')],'server',_0x1dde('0x72'),_0x1dde('0x73')),{'interaction':_0x871249})[_0x1dde('0x1b')](function(_0x4e611f){var _0x170162=path[_0x1dde('0x54')](_0xf108bc,_0x1dde('0x74')+_0x4edfd1['id']+'-'+_0x35aa10+_0x1dde('0x75'));var _0x4d01e3={'path':_0x170162,'channel':'Whatsapp','interactionId':_0x4edfd1['id']};return pdf[_0x1dde('0x76')](_0x4e611f,_0x4d01e3);})[_0x1dde('0x1b')](function(){return new BPromise(function(_0x3da8c4,_0x4fc82e){zipdir(_0xf108bc,{'saveTo':_0x565753},function(_0x1269f2,_0x10fe54){if(_0x1269f2)return _0x4fc82e(_0x1269f2);return _0x3da8c4(_0x10fe54);});})[_0x1dde('0x1b')](function(){return new BPromise(function(_0x732542,_0x1ae45c){rimraf(_0xf108bc,function(_0x133906){if(_0x133906)_0x1ae45c(_0x133906);return _0x732542();});});})[_0x1dde('0x1b')](function(){return _0x5a7f2a[_0x1dde('0x52')](_0x565753,_0xe9397a,function(_0x3aa97a){if(_0x3aa97a){console[_0x1dde('0x77')](_0x1dde('0x78'),_0x3aa97a);}else{fs[_0x1dde('0x79')](_0x565753);}});});});}else{return _0x5a7f2a[_0x1dde('0x10')](0xc8);}})[_0x1dde('0x38')](handleError(_0x5a7f2a,null));}; \ No newline at end of file +var _0x788c=['err','unlinkSync','zip-dir','bluebird','path','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','then','destroy','end','error','stack','name','send','map','WhatsappInteraction','rawAttributes','key','getOptions','findAll','whatsapp','user','show','params','model','keys','query','filters','intersection','attributes','fields','length','include','find','catch','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','WhatsappInteractionId','filter','where','$gte','split','format','merge','options','includeAll','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','direction','read','WhatsappAccount','Account','Whatsapp','N.A.','createdAt','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','Messages','existsSync','createReadStream','basename','out','firstName','secret','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log'];(function(_0x50c93e,_0xa55fe0){var _0x3ea92a=function(_0x492cb1){while(--_0x492cb1){_0x50c93e['push'](_0x50c93e['shift']());}};_0x3ea92a(++_0xa55fe0);}(_0x788c,0xf6));var _0xc788=function(_0x2c6f5e,_0x2d9542){_0x2c6f5e=_0x2c6f5e-0x0;var _0x15ab78=_0x788c[_0x2c6f5e];return _0x15ab78;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc788('0x0'));var moment=require('moment');var BPromise=require(_0xc788('0x1'));var util=require('util');var path=require(_0xc788('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xc788('0x3'));var interaction=require(_0xc788('0x4'));var qs=require(_0xc788('0x5'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xc788('0x6'));var config=require(_0xc788('0x7'));var db=require(_0xc788('0x8'))['db'];config[_0xc788('0x9')]=_[_0xc788('0xa')](config[_0xc788('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc788('0xb'))(new Redis(config['redis']));require(_0xc788('0xc'))[_0xc788('0xd')](socket);function respondWithStatusCode(_0x165fdd,_0x2e2899){_0x2e2899=_0x2e2899||0xcc;return function(_0x42d325){if(_0x42d325){return _0x165fdd[_0xc788('0xe')](_0x2e2899);}return _0x165fdd[_0xc788('0xf')](_0x2e2899)['end']();};}function respondWithResult(_0x450912,_0x30926d){_0x30926d=_0x30926d||0xc8;return function(_0x11e68c){if(_0x11e68c){return _0x450912[_0xc788('0xf')](_0x30926d)['json'](_0x11e68c);}};}function respondWithFilteredResult(_0x5e7562,_0x389200){return function(_0x1e5d7a){if(_0x1e5d7a){var _0x4ff0f1=typeof _0x389200[_0xc788('0x10')]===_0xc788('0x11')&&typeof _0x389200[_0xc788('0x12')]===_0xc788('0x11');var _0x1cbbf9=_0x1e5d7a['count'];var _0x44fa91=_0x4ff0f1?0x0:_0x389200[_0xc788('0x10')];var _0xc365b2=_0x4ff0f1?_0x1e5d7a[_0xc788('0x13')]:_0x389200[_0xc788('0x10')]+_0x389200[_0xc788('0x12')];var _0x267c96;if(_0xc365b2>=_0x1cbbf9){_0xc365b2=_0x1cbbf9;_0x267c96=0xc8;}else{_0x267c96=0xce;}_0x5e7562[_0xc788('0xf')](_0x267c96);return _0x5e7562[_0xc788('0x14')](_0xc788('0x15'),_0x44fa91+'-'+_0xc365b2+'/'+_0x1cbbf9)['json'](_0x1e5d7a);}return null;};}function saveUpdates(_0x2a30cc){return function(_0x3cec82){if(_0x3cec82){return _0x3cec82['update'](_0x2a30cc)[_0xc788('0x16')](function(_0x27ef44){return _0x27ef44;});}return null;};}function removeEntity(_0x45f0bb){return function(_0x1a09aa){if(_0x1a09aa){return _0x1a09aa[_0xc788('0x17')]()[_0xc788('0x16')](function(){_0x45f0bb['status'](0xcc)[_0xc788('0x18')]();});}};}function handleEntityNotFound(_0x4a1348){return function(_0x297702){if(!_0x297702){_0x4a1348[_0xc788('0xe')](0x194);}return _0x297702;};}function handleError(_0x577bd7,_0x557fb2){_0x557fb2=_0x557fb2||0x1f4;return function(_0x578d85){logger[_0xc788('0x19')](_0x578d85[_0xc788('0x1a')]);if(_0x578d85[_0xc788('0x1b')]){delete _0x578d85['name'];}_0x577bd7[_0xc788('0xf')](_0x557fb2)[_0xc788('0x1c')](_0x578d85);};}exports['index']=function(_0x2abd98,_0xb3533f){var _0x3f470b={};var _0x3fb7bb=_[_0xc788('0x1d')](db[_0xc788('0x1e')][_0xc788('0x1f')],function(_0xa3076d){return{'name':_0xa3076d['fieldName'],'type':_0xa3076d['type'][_0xc788('0x20')]};});_0x3f470b=qs[_0xc788('0x21')](_0x3fb7bb,_0x2abd98);return interaction[_0xc788('0x22')](_0xc788('0x23'),_0x2abd98['query'],_0x2abd98[_0xc788('0x24')],_0x3f470b,_0x3fb7bb)[_0xc788('0x16')](respondWithFilteredResult(_0xb3533f,_0x3f470b))['catch'](handleError(_0xb3533f,null));};exports[_0xc788('0x25')]=function(_0x2f697c,_0x11f77b){var _0x15fdd6={'raw':![],'where':{'id':_0x2f697c[_0xc788('0x26')]['id']}},_0x142c40={};_0x142c40[_0xc788('0x27')]=_[_0xc788('0x28')](db[_0xc788('0x1e')][_0xc788('0x1f')]);_0x142c40[_0xc788('0x29')]=_[_0xc788('0x28')](_0x2f697c[_0xc788('0x29')]);_0x142c40[_0xc788('0x2a')]=_[_0xc788('0x2b')](_0x142c40[_0xc788('0x27')],_0x142c40[_0xc788('0x29')]);_0x15fdd6[_0xc788('0x2c')]=_['intersection'](_0x142c40[_0xc788('0x27')],qs[_0xc788('0x2d')](_0x2f697c[_0xc788('0x29')][_0xc788('0x2d')]));_0x15fdd6[_0xc788('0x2c')]=_0x15fdd6[_0xc788('0x2c')][_0xc788('0x2e')]?_0x15fdd6[_0xc788('0x2c')]:_0x142c40[_0xc788('0x27')];if(_0x2f697c['query']['includeAll']){_0x15fdd6[_0xc788('0x2f')]=[{'all':!![]}];}_0x15fdd6=_['merge']({},_0x15fdd6,_0x2f697c['options']);return db['WhatsappInteraction'][_0xc788('0x30')](_0x15fdd6)[_0xc788('0x16')](handleEntityNotFound(_0x11f77b,null))['then'](respondWithResult(_0x11f77b,null))[_0xc788('0x31')](handleError(_0x11f77b,null));};exports[_0xc788('0x32')]=function(_0x33f9a4,_0x55b4bd){return db[_0xc788('0x1e')][_0xc788('0x32')](_0x33f9a4[_0xc788('0x33')],{})[_0xc788('0x16')](respondWithResult(_0x55b4bd,0xc9))[_0xc788('0x31')](handleError(_0x55b4bd,null));};exports[_0xc788('0x34')]=function(_0x476156,_0x2335f0){if(_0x476156['body']['id']){delete _0x476156[_0xc788('0x33')]['id'];}return db['WhatsappInteraction'][_0xc788('0x30')]({'where':{'id':_0x476156[_0xc788('0x26')]['id']}})['then'](handleEntityNotFound(_0x2335f0,null))[_0xc788('0x16')](saveUpdates(_0x476156[_0xc788('0x33')],null))[_0xc788('0x16')](respondWithResult(_0x2335f0,null))[_0xc788('0x31')](handleError(_0x2335f0,null));};exports[_0xc788('0x17')]=function(_0xaed551,_0x50a5a1){return db['WhatsappInteraction']['find']({'where':{'id':_0xaed551[_0xc788('0x26')]['id']}})['then'](handleEntityNotFound(_0x50a5a1,null))[_0xc788('0x16')](removeEntity(_0x50a5a1,null))[_0xc788('0x31')](handleError(_0x50a5a1,null));};exports[_0xc788('0x35')]=function(_0x1049a7,_0x2b56ef){return db[_0xc788('0x1e')][_0xc788('0x35')]()['then'](respondWithResult(_0x2b56ef,null))[_0xc788('0x31')](handleError(_0x2b56ef,null));};exports[_0xc788('0x36')]=function(_0x23a2b0,_0x2f0152){return db[_0xc788('0x37')][_0xc788('0x30')]({'where':{'id':_0x23a2b0[_0xc788('0x26')]['id']}})[_0xc788('0x16')](handleEntityNotFound(_0x2f0152,null))[_0xc788('0x16')](function(_0x3f82eb){if(_0x3f82eb){return _0x3f82eb[_0xc788('0x36')](_0x23a2b0[_0xc788('0x33')][_0xc788('0x38')],_[_0xc788('0x39')](_0x23a2b0[_0xc788('0x33')],['ids','id'])||{});}})[_0xc788('0x16')](respondWithResult(_0x2f0152,null))[_0xc788('0x31')](handleError(_0x2f0152,null));};exports[_0xc788('0x3a')]=function(_0x44ad52,_0x154891){var _0x3e30bb={'raw':![],'where':{}};var _0x222057={};var _0x419268={'count':0x0,'rows':[]};return db[_0xc788('0x1e')][_0xc788('0x3b')]({'where':{'id':_0x44ad52['params']['id']}})[_0xc788('0x16')](handleEntityNotFound(_0x154891,null))[_0xc788('0x16')](function(_0x378e14){if(_0x378e14){_0x222057[_0xc788('0x27')]=_[_0xc788('0x28')](db[_0xc788('0x37')][_0xc788('0x1f')]);_0x222057[_0xc788('0x29')]=_[_0xc788('0x28')](_0x44ad52[_0xc788('0x29')]);_0x222057[_0xc788('0x2a')]=_[_0xc788('0x2b')](_0x222057['model'],_0x222057[_0xc788('0x29')]);_0x3e30bb['attributes']=_['intersection'](_0x222057[_0xc788('0x27')],qs[_0xc788('0x2d')](_0x44ad52[_0xc788('0x29')][_0xc788('0x2d')]));_0x3e30bb[_0xc788('0x2c')]=_0x3e30bb[_0xc788('0x2c')][_0xc788('0x2e')]?_0x3e30bb[_0xc788('0x2c')]:_0x222057[_0xc788('0x27')];if(!_0x44ad52[_0xc788('0x29')][_0xc788('0x3c')](_0xc788('0x3d'))){_0x3e30bb[_0xc788('0x12')]=qs['limit'](_0x44ad52['query'][_0xc788('0x12')]);_0x3e30bb[_0xc788('0x10')]=qs[_0xc788('0x10')](_0x44ad52[_0xc788('0x29')]['offset']);}_0x3e30bb[_0xc788('0x3e')]=qs[_0xc788('0x3f')](_0x44ad52[_0xc788('0x29')][_0xc788('0x3f')]);_0x3e30bb['where']=qs[_0xc788('0x2a')](_[_0xc788('0x40')](_0x44ad52[_0xc788('0x29')],_0x222057[_0xc788('0x2a')]));_0x3e30bb['where'][_0xc788('0x41')]=_0x378e14['id'];if(_0x44ad52[_0xc788('0x29')][_0xc788('0x42')]){_0x3e30bb[_0xc788('0x43')]=_['merge'](_0x3e30bb['where'],{'$or':_[_0xc788('0x1d')](_0x3e30bb['attributes'],function(_0x1026d8){var _0x42db64={};_0x42db64[_0x1026d8]={'$like':'%'+_0x44ad52['query']['filter']+'%'};return _0x42db64;})});}if(_0x44ad52[_0xc788('0x29')][_0xc788('0x44')]){var _0x13c2bb=_0x44ad52['query'][_0xc788('0x44')][_0xc788('0x45')](',');var _0x27cd79={};_0x27cd79[_0x13c2bb[0x0]]={'$gte':moment(_0x13c2bb[0x1])[_0xc788('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3e30bb[_0xc788('0x43')]=_[_0xc788('0x47')](_0x3e30bb['where'],_0x27cd79);}_0x3e30bb=_[_0xc788('0x47')]({},_0x3e30bb,_0x44ad52[_0xc788('0x48')]);return db[_0xc788('0x37')][_0xc788('0x13')]({'where':_0x3e30bb[_0xc788('0x43')]})[_0xc788('0x16')](function(_0x42e604){_0x419268['count']=_0x42e604;if(_0x44ad52[_0xc788('0x29')][_0xc788('0x49')]){_0x3e30bb['include']=[{'all':!![]}];}return db[_0xc788('0x37')][_0xc788('0x22')](_0x3e30bb);})[_0xc788('0x16')](function(_0x358b13){_0x419268[_0xc788('0x4a')]=_0x358b13;return _0x419268;});}})[_0xc788('0x16')](respondWithFilteredResult(_0x154891,_0x3e30bb))[_0xc788('0x31')](handleError(_0x154891,null));};exports[_0xc788('0x4b')]=function(_0x46bf0d,_0x569d80){return db[_0xc788('0x1e')][_0xc788('0x30')]({'where':{'id':_0x46bf0d[_0xc788('0x26')]['id']}})[_0xc788('0x16')](handleEntityNotFound(_0x569d80,null))[_0xc788('0x16')](function(_0x3243e4){if(_0x3243e4){return _0x3243e4[_0xc788('0x4c')](_0x46bf0d[_0xc788('0x33')][_0xc788('0x38')],_['omit'](_0x46bf0d[_0xc788('0x33')],[_0xc788('0x38'),'id'])||{})[_0xc788('0x4d')](function(){return db[_0xc788('0x4e')][_0xc788('0x22')]({'attributes':['id','name','color'],'where':{'id':_0x46bf0d['body']['ids']}});})[_0xc788('0x16')](function(_0x42cef6){socket[_0xc788('0x4f')](_0xc788('0x50'),{'id':Number(_0x46bf0d[_0xc788('0x26')]['id']),'tags':_0x42cef6||[]});return{'id':Number(_0x46bf0d['params']['id']),'tags':_0x42cef6||[]};});}})['then'](respondWithResult(_0x569d80,null))[_0xc788('0x31')](handleError(_0x569d80,null));};exports[_0xc788('0x51')]=function(_0x538574,_0x37f3ad){return db[_0xc788('0x1e')]['find']({'where':{'id':_0x538574['params']['id']}})[_0xc788('0x16')](handleEntityNotFound(_0x37f3ad,null))['then'](function(_0x319d74){if(_0x319d74){return _0x319d74[_0xc788('0x51')](_0x538574[_0xc788('0x29')][_0xc788('0x38')]);}})[_0xc788('0x16')](respondWithStatusCode(_0x37f3ad,null))[_0xc788('0x31')](handleError(_0x37f3ad,null));};exports['download']=function(_0x3bb89d,_0x11fde3){var _0x156e00=moment()['unix']()[_0xc788('0x52')]();var _0x23ae46=path['join'](config[_0xc788('0x53')],_0xc788('0x54'),_0xc788('0x55'),_0xc788('0x56'));var _0x36c9f8=path[_0xc788('0x57')](config[_0xc788('0x53')],_0xc788('0x54'),_0xc788('0x55'),_0xc788('0x58'));var _0x5d0f11=path[_0xc788('0x57')](_0x23ae46,_0x156e00);var _0x2a1017=util[_0xc788('0x46')](_0xc788('0x59'),_0x3bb89d[_0xc788('0x26')]['id'],_0x156e00);var _0x260bb3=path[_0xc788('0x57')](_0x23ae46,_0x2a1017);var _0x44c13f=[];_0x44c13f[_0xc788('0x5a')]({'model':db[_0xc788('0x5b')],'as':_0xc788('0x5b'),'attributes':['id',_0xc788('0x5c')],'raw':!![]});_0x44c13f['push']({'model':db[_0xc788('0x5d')],'as':_0xc788('0x5e'),'attributes':['id','firstName',_0xc788('0x5f')],'raw':!![]});if(_0x3bb89d[_0xc788('0x29')][_0xc788('0x58')]){_0x44c13f[_0xc788('0x5a')]({'model':db[_0xc788('0x60')],'as':_0xc788('0x60'),'raw':!![]});}var _0x522ff3=[{'model':db[_0xc788('0x37')],'as':'Messages','attributes':['id','body','createdAt',_0xc788('0x61'),'secret',_0xc788('0x62')],'include':_0x44c13f}];_0x522ff3[_0xc788('0x5a')]({'model':db[_0xc788('0x63')],'as':_0xc788('0x64'),'attributes':['id','name']});_0x522ff3['push']({'model':db[_0xc788('0x5b')],'as':'Owner','attributes':['id',_0xc788('0x5c')]});return db[_0xc788('0x1e')][_0xc788('0x30')]({'where':{'id':_0x3bb89d['params']['id']},'include':_0x522ff3})['then'](handleEntityNotFound(_0x11fde3,null))[_0xc788('0x16')](function(_0x204398){if(_0x204398){var _0x5c8c98=_0x204398['get']({'plain':!![]});fs['mkdirSync'](_0x5d0f11);var _0x27f563={'channel':_0xc788('0x65'),'account':_0x5c8c98[_0xc788('0x64')][_0xc788('0x1b')],'agent':_0x5c8c98['Owner']?_0x5c8c98['Owner']['fullname']:_0xc788('0x66'),'createdAt':moment(_0x5c8c98[_0xc788('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc788('0x52')](),'closedAt':_0x5c8c98['closed']?moment(_0x5c8c98[_0xc788('0x68')])[_0xc788('0x46')](_0xc788('0x69'))[_0xc788('0x52')]():'','disposition':_0x5c8c98[_0xc788('0x6a')],'messages':_(_0x5c8c98[_0xc788('0x6b')])[_0xc788('0x42')]({'secret':![]})[_0xc788('0x1d')](function(_0x3dd64d){if(_0x3dd64d['Attachment']){var _0x43baab=path[_0xc788('0x57')](_0x36c9f8,_0x3dd64d[_0xc788('0x60')]['basename']);if(fs[_0xc788('0x6c')](_0x43baab)){fs[_0xc788('0x6d')](_0x43baab)['pipe'](fs['createWriteStream'](path[_0xc788('0x57')](_0x5d0f11,_0x3dd64d[_0xc788('0x60')][_0xc788('0x6e')])));}}return{'date':moment(_0x3dd64d['createdAt'])['format'](_0xc788('0x69'))['toString'](),'sender':_0x3dd64d['direction']===_0xc788('0x6f')?_0x3dd64d[_0xc788('0x5b')]?_0x3dd64d['User'][_0xc788('0x5c')]:'System':_0x3dd64d['Contact'][_0xc788('0x70')]+(_0x3dd64d[_0xc788('0x5e')]['lastName']?'\x20'+_0x3dd64d[_0xc788('0x5e')][_0xc788('0x5f')]:''),'body':_0x3dd64d[_0xc788('0x60')]?_0x3dd64d[_0xc788('0x60')][_0xc788('0x6e')]:_0x3dd64d[_0xc788('0x33')],'direction':_0x3dd64d[_0xc788('0x61')]===_0xc788('0x6f')?'A':'C','secret':_0x3dd64d[_0xc788('0x71')],'read':_0x3dd64d[_0xc788('0x62')],'attachment':_0x3dd64d['Attachment']};})[_0xc788('0x72')]()};return ejs[_0xc788('0x73')](path[_0xc788('0x57')](config['root'],_0xc788('0x54'),'views',_0xc788('0x74')),{'interaction':_0x27f563})['then'](function(_0x59eabb){var _0x2d51f7=path[_0xc788('0x57')](_0x5d0f11,_0xc788('0x75')+_0x5c8c98['id']+'-'+_0x156e00+'.pdf');var _0x2b2e13={'path':_0x2d51f7,'channel':_0xc788('0x65'),'interactionId':_0x5c8c98['id']};return pdf[_0xc788('0x76')](_0x59eabb,_0x2b2e13);})[_0xc788('0x16')](function(){return new BPromise(function(_0x584c1f,_0xfa90d1){zipdir(_0x5d0f11,{'saveTo':_0x260bb3},function(_0x16b95a,_0x10123d){if(_0x16b95a)return _0xfa90d1(_0x16b95a);return _0x584c1f(_0x10123d);});})[_0xc788('0x16')](function(){return new BPromise(function(_0x3b06dd,_0x1d8328){rimraf(_0x5d0f11,function(_0x1978d8){if(_0x1978d8)_0x1d8328(_0x1978d8);return _0x3b06dd();});});})[_0xc788('0x16')](function(){return _0x11fde3['download'](_0x260bb3,_0x2a1017,function(_0x4754b0){if(_0x4754b0){console[_0xc788('0x77')](_0xc788('0x78'),_0x4754b0);}else{fs[_0xc788('0x79')](_0x260bb3);}});});});}else{return _0x11fde3['sendStatus'](0xc8);}})[_0xc788('0x31')](handleError(_0x11fde3,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f8dc1e5..2a04109 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 _0xeebe=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x1af827,_0x1d66f1){var _0x274152=function(_0x53d528){while(--_0x53d528){_0x1af827['push'](_0x1af827['shift']());}};_0x274152(++_0x1d66f1);}(_0xeebe,0xff));var _0xeeeb=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xeebe[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0xeeeb('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xeeeb('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xeeeb('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xeeeb('0x3')](0x0);var events={'afterCreate':_0xeeeb('0x4'),'afterUpdate':_0xeeeb('0x5'),'afterDestroy':_0xeeeb('0x6')};function emitEvent(_0x33801b){return function(_0x24b63e,_0x1d5c27,_0x2b23eb){_0x24b63e[_0xeeeb('0x7')]({'attributes':['id'],'raw':!![]})[_0xeeeb('0x8')](function(_0x3083ab){_0x24b63e[_0xeeeb('0x9')](_0xeeeb('0xa'),_0x3083ab[_0xeeeb('0xb')](function(_0x263799){return{'id':_0x263799['id']};}));return WhatsappMessage[_0xeeeb('0xc')]({'where':{'WhatsappInteractionId':_0x24b63e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeeeb('0x8')](function(_0x4a1161){_0x24b63e['setDataValue'](_0xeeeb('0xd'),_0x4a1161[_0xeeeb('0xe')]);WhatsappInteractionEvents[_0xeeeb('0xf')](_0x33801b+':'+_0x24b63e['id'],_0x24b63e);WhatsappInteractionEvents['emit'](_0x33801b,_0x24b63e);_0x2b23eb(null);})[_0xeeeb('0x10')](_0x2b23eb(null));};}for(var e in events){if(events[_0xeeeb('0x11')](e)){var event=events[e];WhatsappInteraction[_0xeeeb('0x12')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xec56=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x3a2830,_0x238aad){var _0x49a8e2=function(_0xa8bd43){while(--_0xa8bd43){_0x3a2830['push'](_0x3a2830['shift']());}};_0x49a8e2(++_0x238aad);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1eefb4,_0x30a18a){_0x1eefb4=_0x1eefb4-0x0;var _0x2efb2e=_0xec56[_0x1eefb4];return _0x2efb2e;};'use strict';var EventEmitter=require(_0x6ec5('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x6ec5('0x1'))['db'][_0x6ec5('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6ec5('0x3')](0x0);var events={'afterCreate':_0x6ec5('0x4'),'afterUpdate':_0x6ec5('0x5'),'afterDestroy':_0x6ec5('0x6')};function emitEvent(_0x469679){return function(_0x173aeb,_0x3f876c,_0x28b12b){_0x173aeb[_0x6ec5('0x7')]({'attributes':['id'],'raw':!![]})[_0x6ec5('0x8')](function(_0x35be4e){_0x173aeb[_0x6ec5('0x9')](_0x6ec5('0xa'),_0x35be4e[_0x6ec5('0xb')](function(_0x17bcf0){return{'id':_0x17bcf0['id']};}));return WhatsappMessage[_0x6ec5('0xc')]({'where':{'WhatsappInteractionId':_0x173aeb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6ec5('0x8')](function(_0x4a23b6){_0x173aeb[_0x6ec5('0x9')](_0x6ec5('0xd'),_0x4a23b6[_0x6ec5('0xe')]);WhatsappInteractionEvents[_0x6ec5('0xf')](_0x469679+':'+_0x173aeb['id'],_0x173aeb);WhatsappInteractionEvents[_0x6ec5('0xf')](_0x469679,_0x173aeb);_0x28b12b(null);})[_0x6ec5('0x10')](_0x28b12b(null));};}for(var e in events){if(events[_0x6ec5('0x11')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x6ec5('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index aa2376c..24cef52 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 _0xd99d=['rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise'];(function(_0xb02fe6,_0x1e83a7){var _0x25a9f5=function(_0x361db6){while(--_0x361db6){_0xb02fe6['push'](_0xb02fe6['shift']());}};_0x25a9f5(++_0x1e83a7);}(_0xd99d,0x1a8));var _0xdd99=function(_0x1c0906,_0x571971){_0x1c0906=_0x1c0906-0x0;var _0x451838=_0xd99d[_0x1c0906];return _0x451838;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdd99('0x1'));var moment=require(_0xdd99('0x2'));var BPromise=require(_0xdd99('0x3'));var rp=require(_0xdd99('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd99('0x5'));var config=require(_0xdd99('0x6'));var attributes=require(_0xdd99('0x7'));module['exports']=function(_0x180f0d,_0x345a5c){return _0x180f0d[_0xdd99('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xdd99('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc29a7b,_0x546ced,_0x28602a){if(_0xc29a7b[_0xdd99('0xa')]('closed')){_0xc29a7b[_0xdd99('0xb')]=moment()['format'](_0xdd99('0xc'));}_0x28602a(null,_0xc29a7b);}}});}; \ No newline at end of file +var _0x1a9e=['../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x1a9e,0x188));var _0xe1a9=function(_0x1ee603,_0x49b26d){_0x1ee603=_0x1ee603-0x0;var _0xa2a490=_0x1a9e[_0x1ee603];return _0xa2a490;};'use strict';var _=require(_0xe1a9('0x0'));var util=require(_0xe1a9('0x1'));var logger=require('../../config/logger')(_0xe1a9('0x2'));var moment=require(_0xe1a9('0x3'));var BPromise=require(_0xe1a9('0x4'));var rp=require(_0xe1a9('0x5'));var fs=require('fs');var path=require(_0xe1a9('0x6'));var rimraf=require(_0xe1a9('0x7'));var config=require(_0xe1a9('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xe1a9('0x9')]=function(_0x36c260,_0x4ffddb){return _0x36c260['define'](_0xe1a9('0xa'),attributes,{'tableName':_0xe1a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d57fe,_0x407c53,_0x87103f){if(_0x4d57fe[_0xe1a9('0xc')](_0xe1a9('0xd'))){_0x4d57fe[_0xe1a9('0xe')]=moment()['format'](_0xe1a9('0xf'));}_0x87103f(null,_0x4d57fe);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5386e4f..381e18a 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 _0x0be4=['where','attributes','limit','info','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options'];(function(_0xd15c7a,_0x309d8a){var _0x31a4da=function(_0x3c1e6d){while(--_0x3c1e6d){_0xd15c7a['push'](_0xd15c7a['shift']());}};_0x31a4da(++_0x309d8a);}(_0x0be4,0x199));var _0x40be=function(_0x3cdccc,_0x40c84d){_0x3cdccc=_0x3cdccc-0x0;var _0x23216a=_0x0be4[_0x3cdccc];return _0x23216a;};'use strict';var _=require(_0x40be('0x0'));var util=require('util');var moment=require(_0x40be('0x1'));var BPromise=require(_0x40be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40be('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x40be('0x4'));var logger=require(_0x40be('0x5'))(_0x40be('0x6'));var config=require(_0x40be('0x7'));var jayson=require(_0x40be('0x8'));var client=jayson[_0x40be('0x9')]['http']({'port':0x232a});config[_0x40be('0xa')]=_[_0x40be('0xb')](config[_0x40be('0xa')],{'host':_0x40be('0xc'),'port':0x18eb});var socket=require(_0x40be('0xd'))(new Redis(config[_0x40be('0xa')]));require(_0x40be('0xe'))[_0x40be('0xf')](socket);function respondWithRpcPromise(_0x4c9530,_0x4442f5,_0x4d7b20){return new BPromise(function(_0x28fc60,_0x1bfbc5){return client[_0x40be('0x10')](_0x4c9530,_0x4d7b20)[_0x40be('0x11')](function(_0x4152c1){logger['info'](_0x40be('0x12'),_0x4442f5,_0x40be('0x13'));logger[_0x40be('0x14')](_0x40be('0x15'),_0x4442f5,_0x40be('0x13'),JSON[_0x40be('0x16')](_0x4152c1));if(_0x4152c1['error']){if(_0x4152c1['error']['code']===0x1f4){logger['error'](_0x40be('0x12'),_0x4442f5,_0x4152c1[_0x40be('0x17')][_0x40be('0x18')]);return _0x1bfbc5(_0x4152c1['error'][_0x40be('0x18')]);}logger[_0x40be('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x4442f5,_0x4152c1[_0x40be('0x17')][_0x40be('0x18')]);return _0x28fc60(_0x4152c1[_0x40be('0x17')]['message']);}else{logger['info'](_0x40be('0x12'),_0x4442f5,_0x40be('0x13'));_0x28fc60(_0x4152c1[_0x40be('0x19')]['message']);}})['catch'](function(_0x268d1c){logger['error'](_0x40be('0x12'),_0x4442f5,_0x268d1c);_0x1bfbc5(_0x268d1c);});});}exports[_0x40be('0x1a')]=function(_0x3f692c){var _0x1ad26e=this;return new Promise(function(_0x407056,_0x2ba3d0){return db[_0x40be('0x1b')][_0x40be('0x1c')](_0x3f692c[_0x40be('0x1d')],{'raw':_0x3f692c['options']?_0x3f692c[_0x40be('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f692c[_0x40be('0x1e')]?_0x3f692c[_0x40be('0x1e')][_0x40be('0x1f')]||null:null,'attributes':_0x3f692c[_0x40be('0x1e')]?_0x3f692c[_0x40be('0x1e')][_0x40be('0x20')]||null:null,'limit':_0x3f692c[_0x40be('0x1e')]?_0x3f692c[_0x40be('0x1e')][_0x40be('0x21')]||null:null})['then'](function(_0x58a0c0){logger[_0x40be('0x22')]('UpdateWhatsappInteraction',_0x3f692c);logger[_0x40be('0x14')]('UpdateWhatsappInteraction',_0x3f692c,JSON[_0x40be('0x16')](_0x58a0c0));_0x407056(_0x58a0c0);})['catch'](function(_0x1e1008){logger[_0x40be('0x17')](_0x40be('0x1a'),_0x1e1008['message'],_0x3f692c);_0x2ba3d0(_0x1ad26e[_0x40be('0x17')](0x1f4,_0x1e1008[_0x40be('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x35c2a8){return new Promise(function(_0x23c8ef,_0x2c6cf6){return db[_0x40be('0x1b')][_0x40be('0x23')]({'where':_0x35c2a8[_0x40be('0x1e')]?_0x35c2a8[_0x40be('0x1e')][_0x40be('0x1f')]||null:null})['then'](function(_0x536a04){if(_0x536a04){return _0x536a04[_0x40be('0x24')](_0x35c2a8['body'][_0x40be('0x25')],_['omit'](_0x35c2a8[_0x40be('0x1d')],['ids','id'])||{});}})[_0x40be('0x26')](function(_0x21fc1d){logger[_0x40be('0x22')](_0x40be('0x27'),_0x35c2a8);logger[_0x40be('0x14')]('AddTags',_0x35c2a8,JSON[_0x40be('0x16')](_0x21fc1d));_0x23c8ef(_0x21fc1d);})['catch'](function(_0x3526e2){logger[_0x40be('0x17')](_0x40be('0x27'),_0x3526e2[_0x40be('0x18')],_0x35c2a8);_0x2c6cf6(_this[_0x40be('0x17')](0x1f4,_0x3526e2[_0x40be('0x18')]));});});}; \ No newline at end of file +var _0x6103=['register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','./whatsappInteraction.socket'];(function(_0x43be58,_0x3ba81d){var _0x2ea629=function(_0x5014b8){while(--_0x5014b8){_0x43be58['push'](_0x43be58['shift']());}};_0x2ea629(++_0x3ba81d);}(_0x6103,0x182));var _0x3610=function(_0x59778f,_0xfdb465){_0x59778f=_0x59778f-0x0;var _0x4226e5=_0x6103[_0x59778f];return _0x4226e5;};'use strict';var _=require('lodash');var util=require(_0x3610('0x0'));var moment=require(_0x3610('0x1'));var BPromise=require(_0x3610('0x2'));var rs=require(_0x3610('0x3'));var fs=require('fs');var Redis=require(_0x3610('0x4'));var db=require(_0x3610('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3610('0x6'))(_0x3610('0x7'));var config=require(_0x3610('0x8'));var jayson=require(_0x3610('0x9'));var client=jayson['client'][_0x3610('0xa')]({'port':0x232a});config['redis']=_[_0x3610('0xb')](config[_0x3610('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3610('0xc')]));require(_0x3610('0xd'))[_0x3610('0xe')](socket);function respondWithRpcPromise(_0x28b351,_0x11736f,_0x316c93){return new BPromise(function(_0x596f85,_0xe91257){return client[_0x3610('0xf')](_0x28b351,_0x316c93)[_0x3610('0x10')](function(_0x3a0db5){logger[_0x3610('0x11')](_0x3610('0x12'),_0x11736f,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x11736f,_0x3610('0x13'),JSON[_0x3610('0x14')](_0x3a0db5));if(_0x3a0db5[_0x3610('0x15')]){if(_0x3a0db5['error']['code']===0x1f4){logger[_0x3610('0x15')](_0x3610('0x12'),_0x11736f,_0x3a0db5[_0x3610('0x15')][_0x3610('0x16')]);return _0xe91257(_0x3a0db5['error']['message']);}logger[_0x3610('0x15')](_0x3610('0x12'),_0x11736f,_0x3a0db5[_0x3610('0x15')][_0x3610('0x16')]);return _0x596f85(_0x3a0db5[_0x3610('0x15')][_0x3610('0x16')]);}else{logger[_0x3610('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x11736f,_0x3610('0x13'));_0x596f85(_0x3a0db5['result'][_0x3610('0x16')]);}})[_0x3610('0x17')](function(_0x1145f7){logger[_0x3610('0x15')](_0x3610('0x12'),_0x11736f,_0x1145f7);_0xe91257(_0x1145f7);});});}exports[_0x3610('0x18')]=function(_0x15e2d8){var _0x8ab489=this;return new Promise(function(_0x1be2cb,_0x203830){return db['WhatsappInteraction'][_0x3610('0x19')](_0x15e2d8[_0x3610('0x1a')],{'raw':_0x15e2d8[_0x3610('0x1b')]?_0x15e2d8['options'][_0x3610('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15e2d8['options']?_0x15e2d8['options'][_0x3610('0x1d')]||null:null,'attributes':_0x15e2d8[_0x3610('0x1b')]?_0x15e2d8[_0x3610('0x1b')]['attributes']||null:null,'limit':_0x15e2d8['options']?_0x15e2d8['options'][_0x3610('0x1e')]||null:null})[_0x3610('0x10')](function(_0x444fc5){logger[_0x3610('0x11')]('UpdateWhatsappInteraction',_0x15e2d8);logger['debug']('UpdateWhatsappInteraction',_0x15e2d8,JSON['stringify'](_0x444fc5));_0x1be2cb(_0x444fc5);})[_0x3610('0x17')](function(_0x388517){logger[_0x3610('0x15')]('UpdateWhatsappInteraction',_0x388517[_0x3610('0x16')],_0x15e2d8);_0x203830(_0x8ab489[_0x3610('0x15')](0x1f4,_0x388517[_0x3610('0x16')]));});});};exports[_0x3610('0x1f')]=function(_0x77e0c5){return new Promise(function(_0x4c562f,_0x532b99){return db[_0x3610('0x20')][_0x3610('0x21')]({'where':_0x77e0c5[_0x3610('0x1b')]?_0x77e0c5[_0x3610('0x1b')][_0x3610('0x1d')]||null:null})[_0x3610('0x10')](function(_0x3a95ed){if(_0x3a95ed){return _0x3a95ed[_0x3610('0x22')](_0x77e0c5['body'][_0x3610('0x23')],_[_0x3610('0x24')](_0x77e0c5[_0x3610('0x1a')],[_0x3610('0x23'),'id'])||{});}})[_0x3610('0x25')](function(_0x75353a){logger[_0x3610('0x11')](_0x3610('0x26'),_0x77e0c5);logger[_0x3610('0x27')](_0x3610('0x26'),_0x77e0c5,JSON[_0x3610('0x14')](_0x75353a));_0x4c562f(_0x75353a);})[_0x3610('0x17')](function(_0x32d707){logger[_0x3610('0x15')]('AddTags',_0x32d707[_0x3610('0x16')],_0x77e0c5);_0x532b99(_this['error'](0x1f4,_0x32d707['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 88b579f..5dfb3cf 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 _0x7bd7=['save','remove','emit','removeListener','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x5a8269,_0xfb2f54){var _0x539ed7=function(_0x31ce98){while(--_0x31ce98){_0x5a8269['push'](_0x5a8269['shift']());}};_0x539ed7(++_0xfb2f54);}(_0x7bd7,0x155));var _0x77bd=function(_0x1cdcb4,_0x4991fd){_0x1cdcb4=_0x1cdcb4-0x0;var _0x5c855c=_0x7bd7[_0x1cdcb4];return _0x5c855c;};'use strict';var WhatsappInteractionEvents=require(_0x77bd('0x0'));var events=[_0x77bd('0x1'),_0x77bd('0x2'),'update'];function createListener(_0x126a19,_0x4d6997){return function(_0x39bd36){_0x4d6997[_0x77bd('0x3')](_0x126a19,_0x39bd36);};}function removeListener(_0x3b681d,_0x3c47b4){return function(){WhatsappInteractionEvents[_0x77bd('0x4')](_0x3b681d,_0x3c47b4);};}exports['register']=function(_0x403e28){for(var _0x2bc058=0x0,_0x1414c6=events['length'];_0x2bc058<_0x1414c6;_0x2bc058++){var _0x5ef7fd=events[_0x2bc058];var _0x2031d7=createListener(_0x77bd('0x5')+_0x5ef7fd,_0x403e28);WhatsappInteractionEvents['on'](_0x5ef7fd,_0x2031d7);}}; \ No newline at end of file +var _0xeef6=['remove','update','emit','register','length','whatsappInteraction:','save'];(function(_0x24ffd3,_0x43bf4b){var _0x5725f4=function(_0x400062){while(--_0x400062){_0x24ffd3['push'](_0x24ffd3['shift']());}};_0x5725f4(++_0x43bf4b);}(_0xeef6,0xbc));var _0x6eef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeef6[_0x1cc8fe];return _0x230054;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x6eef('0x0'),_0x6eef('0x1'),_0x6eef('0x2')];function createListener(_0x1bfc4c,_0x4ba693){return function(_0x3145b0){_0x4ba693[_0x6eef('0x3')](_0x1bfc4c,_0x3145b0);};}function removeListener(_0x3903eb,_0x29c0f2){return function(){WhatsappInteractionEvents['removeListener'](_0x3903eb,_0x29c0f2);};}exports[_0x6eef('0x4')]=function(_0x3fdf8b){for(var _0x54a15e=0x0,_0x5dc173=events[_0x6eef('0x5')];_0x54a15e<_0x5dc173;_0x54a15e++){var _0x3c1711=events[_0x54a15e];var _0x136d39=createListener(_0x6eef('0x6')+_0x3c1711,_0x3fdf8b);WhatsappInteractionEvents['on'](_0x3c1711,_0x136d39);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5b1d715..beccc7d 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 _0xc94b=['/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','whatsapp','create','/:id/status','put','update'];(function(_0x3d0393,_0x145fd4){var _0x1a7d0c=function(_0xb6850d){while(--_0xb6850d){_0x3d0393['push'](_0x3d0393['shift']());}};_0x1a7d0c(++_0x145fd4);}(_0xc94b,0x1da));var _0xbc94=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc94b[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xbc94('0x0'));var util=require(_0xbc94('0x1'));var path=require(_0xbc94('0x2'));var timeout=require(_0xbc94('0x3'));var express=require(_0xbc94('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbc94('0x5'));var config=require(_0xbc94('0x6'));var controller=require(_0xbc94('0x7'));router['get']('/',auth[_0xbc94('0x8')](),controller[_0xbc94('0x9')]);router[_0xbc94('0xa')](_0xbc94('0xb'),auth[_0xbc94('0x8')](),controller[_0xbc94('0xc')]);router[_0xbc94('0xa')](_0xbc94('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbc94('0xe')]('/',auth[_0xbc94('0x8')](),interaction['tracked'](_0xbc94('0xf'),'whatsappmessage:create'),controller[_0xbc94('0x10')]);router[_0xbc94('0xe')](_0xbc94('0x11'),controller['status']);router[_0xbc94('0x12')](_0xbc94('0xd'),auth[_0xbc94('0x8')](),controller[_0xbc94('0x13')]);router[_0xbc94('0x12')](_0xbc94('0x14'),auth[_0xbc94('0x8')](),controller[_0xbc94('0x15')]);router[_0xbc94('0x12')](_0xbc94('0x16'),auth[_0xbc94('0x8')](),controller[_0xbc94('0x17')]);router[_0xbc94('0x18')](_0xbc94('0xd'),auth[_0xbc94('0x8')](),controller[_0xbc94('0x19')]);module['exports']=router; \ No newline at end of file +var _0x424b=['get','/describe','isAuthenticated','show','post','tracked','whatsapp','whatsappmessage:create','status','put','/:id','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller'];(function(_0x308522,_0x2bd7d1){var _0x262253=function(_0x487544){while(--_0x487544){_0x308522['push'](_0x308522['shift']());}};_0x262253(++_0x2bd7d1);}(_0x424b,0x16e));var _0xb424=function(_0x59db6d,_0x17d6d3){_0x59db6d=_0x59db6d-0x0;var _0x487659=_0x424b[_0x59db6d];return _0x487659;};'use strict';var multer=require(_0xb424('0x0'));var util=require(_0xb424('0x1'));var path=require(_0xb424('0x2'));var timeout=require(_0xb424('0x3'));var express=require(_0xb424('0x4'));var router=express[_0xb424('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb424('0x6'));var interaction=require(_0xb424('0x7'));var config=require('../../config/environment');var controller=require(_0xb424('0x8'));router[_0xb424('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb424('0x9')](_0xb424('0xa'),auth[_0xb424('0xb')](),controller['describe']);router['get']('/:id',auth[_0xb424('0xb')](),controller[_0xb424('0xc')]);router[_0xb424('0xd')]('/',auth['isAuthenticated'](),interaction[_0xb424('0xe')](_0xb424('0xf'),_0xb424('0x10')),controller['create']);router[_0xb424('0xd')]('/:id/status',controller[_0xb424('0x11')]);router[_0xb424('0x12')](_0xb424('0x13'),auth[_0xb424('0xb')](),controller['update']);router['put'](_0xb424('0x14'),auth[_0xb424('0xb')](),controller[_0xb424('0x15')]);router[_0xb424('0x12')](_0xb424('0x16'),auth[_0xb424('0xb')](),controller['reject']);router['delete'](_0xb424('0x13'),auth[_0xb424('0xb')](),controller[_0xb424('0x17')]);module[_0xb424('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index a12c6ac..3ad8a89 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 _0x67de=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3d287a,_0x1bf308){var _0x7db55=function(_0x3f4c74){while(--_0x3f4c74){_0x3d287a['push'](_0x3d287a['shift']());}};_0x7db55(++_0x1bf308);}(_0x67de,0x1ba));var _0xe67d=function(_0x28d7ed,_0x26714c){_0x28d7ed=_0x28d7ed-0x0;var _0x5076ea=_0x67de[_0x28d7ed];return _0x5076ea;};'use strict';var Sequelize=require(_0xe67d('0x0'));module[_0xe67d('0x1')]={'body':{'type':Sequelize[_0xe67d('0x2')](_0xe67d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe67d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe67d('0x5')]('in',_0xe67d('0x6')),'defaultValue':_0xe67d('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe67d('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe67d('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe67d('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe67d('0x7')]},'providerResponse':{'type':Sequelize[_0xe67d('0x2')]}}; \ No newline at end of file +var _0x2408=['TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x8d3d6e,_0x4a1617){var _0x2a9dad=function(_0xa6b6ca){while(--_0xa6b6ca){_0x8d3d6e['push'](_0x8d3d6e['shift']());}};_0x2a9dad(++_0x4a1617);}(_0x2408,0x97));var _0x8240=function(_0x1f8960,_0x23f300){_0x1f8960=_0x1f8960-0x0;var _0x5c3322=_0x2408[_0x1f8960];return _0x5c3322;};'use strict';var Sequelize=require(_0x8240('0x0'));module['exports']={'body':{'type':Sequelize[_0x8240('0x1')](_0x8240('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8240('0x3')]('in',_0x8240('0x4')),'defaultValue':_0x8240('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8240('0x5')](0xbe)},'phone':{'type':Sequelize[_0x8240('0x5')]},'readAt':{'type':Sequelize[_0x8240('0x6')]},'secret':{'type':Sequelize[_0x8240('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8240('0x5')]},'providerResponse':{'type':Sequelize[_0x8240('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ab47be3..016a17e 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 _0x578f=['inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','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','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','QueryTypes','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from'];(function(_0x27062d,_0x24b179){var _0x4f1478=function(_0x3b4489){while(--_0x3b4489){_0x27062d['push'](_0x27062d['shift']());}};_0x4f1478(++_0x24b179);}(_0x578f,0x12c));var _0xf578=function(_0x194772,_0x43a800){_0x194772=_0x194772-0x0;var _0x2d0daa=_0x578f[_0x194772];return _0x2d0daa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf578('0x0'));var jsonpatch=require(_0xf578('0x1'));var rp=require('request-promise');var moment=require(_0xf578('0x2'));var BPromise=require(_0xf578('0x3'));var Mustache=require(_0xf578('0x4'));var util=require(_0xf578('0x5'));var path=require(_0xf578('0x6'));var sox=require(_0xf578('0x7'));var csv=require(_0xf578('0x8'));var ejs=require(_0xf578('0x9'));var fs=require('fs');var fs_extra=require(_0xf578('0xa'));var _=require(_0xf578('0xb'));var squel=require(_0xf578('0xc'));var crypto=require(_0xf578('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf578('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf578('0xf'));var Papa=require('papaparse');var Redis=require(_0xf578('0x10'));var authService=require(_0xf578('0x11'));var qs=require(_0xf578('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf578('0x13'));var logger=require('../../config/logger')(_0xf578('0x14'));var utils=require(_0xf578('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf578('0x16'));var db=require(_0xf578('0x17'))['db'];config['redis']=_[_0xf578('0x18')](config[_0xf578('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf578('0x1a'))(new Redis(config[_0xf578('0x19')]));require(_0xf578('0x1b'))[_0xf578('0x1c')](socket);var jayson=require(_0xf578('0x1d'));var client=jayson[_0xf578('0x1e')][_0xf578('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9659,_0x466948,_0xc6ccd2,_0x2e6df1){return new BPromise(function(_0x21eac8,_0x488050){var _0x37a9d0=_0x2e6df1||client;return _0x37a9d0[_0xf578('0x20')](_0x3b9659,_0xc6ccd2)[_0xf578('0x21')](function(_0x189541){logger['info'](_0xf578('0x22'),_0x466948,'request\x20sent');logger[_0xf578('0x23')](_0xf578('0x24'),_0x466948,'request\x20sent',JSON[_0xf578('0x25')](_0x189541));if(_0x189541[_0xf578('0x26')]){if(_0x189541[_0xf578('0x26')][_0xf578('0x27')]===0x1f4){logger[_0xf578('0x26')](_0xf578('0x22'),_0x466948,_0x189541[_0xf578('0x26')][_0xf578('0x28')]);return _0x488050(_0x189541[_0xf578('0x26')][_0xf578('0x28')]);}logger[_0xf578('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x466948,_0x189541[_0xf578('0x26')][_0xf578('0x28')]);return _0x21eac8(_0x189541[_0xf578('0x26')][_0xf578('0x28')]);}else{logger[_0xf578('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x466948,_0xf578('0x2a'));_0x21eac8(_0x189541[_0xf578('0x2b')]['message']);}})['catch'](function(_0x1e0f57){logger[_0xf578('0x26')](_0xf578('0x22'),_0x466948,_0x1e0f57);_0x488050(_0x1e0f57);});});}function respondWithStatusCode(_0x2a6d65,_0x3103aa){_0x3103aa=_0x3103aa||0xcc;return function(_0x24abb0){if(_0x24abb0){return _0x2a6d65[_0xf578('0x2c')](_0x3103aa);}return _0x2a6d65['status'](_0x3103aa)[_0xf578('0x2d')]();};}function respondWithResult(_0x5f13a8,_0xee5ee6){_0xee5ee6=_0xee5ee6||0xc8;return function(_0xbed8f9){if(_0xbed8f9){return _0x5f13a8[_0xf578('0x2e')](_0xee5ee6)[_0xf578('0x2f')](_0xbed8f9);}};}function respondWithFilteredResult(_0x37a12a,_0x410247){return function(_0x4b9f63){if(_0x4b9f63){var _0x2dacf7=typeof _0x410247[_0xf578('0x30')]==='undefined'&&typeof _0x410247['limit']===_0xf578('0x31');var _0x3e16ef=_0x4b9f63[_0xf578('0x32')];var _0xe5ff9d=_0x2dacf7?0x0:_0x410247[_0xf578('0x30')];var _0x25d1d6=_0x2dacf7?_0x4b9f63[_0xf578('0x32')]:_0x410247[_0xf578('0x30')]+_0x410247[_0xf578('0x33')];var _0x5cebfa;if(_0x25d1d6>=_0x3e16ef){_0x25d1d6=_0x3e16ef;_0x5cebfa=0xc8;}else{_0x5cebfa=0xce;}_0x37a12a['status'](_0x5cebfa);return _0x37a12a[_0xf578('0x34')](_0xf578('0x35'),_0xe5ff9d+'-'+_0x25d1d6+'/'+_0x3e16ef)['json'](_0x4b9f63);}return null;};}function patchUpdates(_0x544937){return function(_0xc466f0){try{jsonpatch[_0xf578('0x36')](_0xc466f0,_0x544937,!![]);}catch(_0x4bcb89){return BPromise[_0xf578('0x37')](_0x4bcb89);}return _0xc466f0[_0xf578('0x38')]();};}function saveUpdates(_0x3eccd2,_0x595a93){return function(_0x3fd0b4){if(_0x3fd0b4){return _0x3fd0b4[_0xf578('0x39')](_0x3eccd2)['then'](function(_0x5b0477){return _0x5b0477;});}return null;};}function removeEntity(_0x7cefe2,_0x2cffae){return function(_0x2258cd){if(_0x2258cd){return _0x2258cd[_0xf578('0x3a')]()[_0xf578('0x21')](function(){_0x7cefe2['status'](0xcc)[_0xf578('0x2d')]();});}};}function handleEntityNotFound(_0x225f84,_0x8facad){return function(_0x29fe79){if(!_0x29fe79){_0x225f84[_0xf578('0x2c')](0x194);}return _0x29fe79;};}function handleError(_0x101f86,_0x3df202){_0x3df202=_0x3df202||0x1f4;return function(_0x5c5b05){logger[_0xf578('0x26')](_0x5c5b05[_0xf578('0x3b')]);if(_0x5c5b05[_0xf578('0x3c')]){delete _0x5c5b05['name'];}_0x101f86[_0xf578('0x2e')](_0x3df202)[_0xf578('0x3d')](_0x5c5b05);};}exports[_0xf578('0x3e')]=function(_0x362374,_0x46a54d){var _0x2c7356={},_0x3b774c={},_0x4e11b6={'count':0x0,'rows':[]};var _0x1f769a=_[_0xf578('0x3f')](db[_0xf578('0x40')][_0xf578('0x41')],function(_0x8d5b83){return{'name':_0x8d5b83['fieldName'],'type':_0x8d5b83[_0xf578('0x42')]['key']};});_0x3b774c[_0xf578('0x43')]=_[_0xf578('0x3f')](_0x1f769a,_0xf578('0x3c'));_0x3b774c[_0xf578('0x44')]=_[_0xf578('0x45')](_0x362374[_0xf578('0x44')]);_0x3b774c[_0xf578('0x46')]=_[_0xf578('0x47')](_0x3b774c[_0xf578('0x43')],_0x3b774c['query']);_0x2c7356[_0xf578('0x48')]=_['intersection'](_0x3b774c[_0xf578('0x43')],qs[_0xf578('0x49')](_0x362374['query'][_0xf578('0x49')]));_0x2c7356[_0xf578('0x48')]=_0x2c7356[_0xf578('0x48')][_0xf578('0x4a')]?_0x2c7356[_0xf578('0x48')]:_0x3b774c[_0xf578('0x43')];if(!_0x362374[_0xf578('0x44')][_0xf578('0x4b')](_0xf578('0x4c'))){_0x2c7356[_0xf578('0x33')]=qs['limit'](_0x362374[_0xf578('0x44')]['limit']);_0x2c7356[_0xf578('0x30')]=qs['offset'](_0x362374[_0xf578('0x44')]['offset']);}_0x2c7356[_0xf578('0x4d')]=qs['sort'](_0x362374[_0xf578('0x44')][_0xf578('0x4e')]);_0x2c7356[_0xf578('0x4f')]=qs[_0xf578('0x46')](_[_0xf578('0x50')](_0x362374['query'],_0x3b774c['filters']),_0x1f769a);if(_0x362374[_0xf578('0x44')][_0xf578('0x51')]){_0x2c7356[_0xf578('0x4f')]=_[_0xf578('0x52')](_0x2c7356['where'],{'$or':_[_0xf578('0x3f')](_0x1f769a,function(_0x4e2e3b){if(_0x4e2e3b[_0xf578('0x42')]!==_0xf578('0x53')){var _0x38d508={};_0x38d508[_0x4e2e3b['name']]={'$like':'%'+_0x362374[_0xf578('0x44')][_0xf578('0x51')]+'%'};return _0x38d508;}})});}_0x2c7356=_[_0xf578('0x52')]({},_0x2c7356,_0x362374[_0xf578('0x54')]);var _0x1d7b05={'where':_0x2c7356[_0xf578('0x4f')]};return db[_0xf578('0x40')][_0xf578('0x32')](_0x1d7b05)['then'](function(_0x35f152){_0x4e11b6[_0xf578('0x32')]=_0x35f152;if(_0x362374[_0xf578('0x44')][_0xf578('0x55')]){_0x2c7356[_0xf578('0x56')]=[{'all':!![]}];}return db[_0xf578('0x40')][_0xf578('0x57')](_0x2c7356);})[_0xf578('0x21')](function(_0x45dfe9){_0x4e11b6[_0xf578('0x58')]=_0x45dfe9;return _0x4e11b6;})[_0xf578('0x21')](respondWithFilteredResult(_0x46a54d,_0x2c7356))[_0xf578('0x59')](handleError(_0x46a54d,null));};exports[_0xf578('0x5a')]=function(_0x39472f,_0xab697a){var _0x3ecc5e={'raw':!![],'where':{'id':_0x39472f[_0xf578('0x5b')]['id']}},_0xb9b2a6={};_0xb9b2a6[_0xf578('0x43')]=_[_0xf578('0x45')](db['WhatsappMessage'][_0xf578('0x41')]);_0xb9b2a6[_0xf578('0x44')]=_[_0xf578('0x45')](_0x39472f['query']);_0xb9b2a6[_0xf578('0x46')]=_[_0xf578('0x47')](_0xb9b2a6[_0xf578('0x43')],_0xb9b2a6[_0xf578('0x44')]);_0x3ecc5e[_0xf578('0x48')]=_[_0xf578('0x47')](_0xb9b2a6[_0xf578('0x43')],qs[_0xf578('0x49')](_0x39472f['query'][_0xf578('0x49')]));_0x3ecc5e[_0xf578('0x48')]=_0x3ecc5e['attributes'][_0xf578('0x4a')]?_0x3ecc5e['attributes']:_0xb9b2a6[_0xf578('0x43')];if(_0x39472f[_0xf578('0x44')][_0xf578('0x55')]){_0x3ecc5e[_0xf578('0x56')]=[{'all':!![]}];}_0x3ecc5e=_[_0xf578('0x52')]({},_0x3ecc5e,_0x39472f[_0xf578('0x54')]);return db['WhatsappMessage'][_0xf578('0x5c')](_0x3ecc5e)[_0xf578('0x21')](handleEntityNotFound(_0xab697a,null))[_0xf578('0x21')](respondWithResult(_0xab697a,null))[_0xf578('0x59')](handleError(_0xab697a,null));};exports['create']=function(_0x27bd5e,_0x1461f0){return db['WhatsappMessage'][_0xf578('0x5d')](_0x27bd5e[_0xf578('0x5e')],{})[_0xf578('0x21')](respondWithResult(_0x1461f0,0xc9))[_0xf578('0x59')](handleError(_0x1461f0,null));};exports[_0xf578('0x39')]=function(_0xa628ba,_0x499192){if(_0xa628ba['body']['id']){delete _0xa628ba[_0xf578('0x5e')]['id'];}return db[_0xf578('0x40')][_0xf578('0x5c')]({'where':{'id':_0xa628ba['params']['id']}})['then'](handleEntityNotFound(_0x499192,null))[_0xf578('0x21')](saveUpdates(_0xa628ba[_0xf578('0x5e')],null))[_0xf578('0x21')](respondWithResult(_0x499192,null))[_0xf578('0x59')](handleError(_0x499192,null));};exports[_0xf578('0x3a')]=function(_0x7af990,_0x4827cc){return db[_0xf578('0x40')][_0xf578('0x5c')]({'where':{'id':_0x7af990['params']['id']}})[_0xf578('0x21')](handleEntityNotFound(_0x4827cc,null))[_0xf578('0x21')](removeEntity(_0x4827cc,null))[_0xf578('0x59')](handleError(_0x4827cc,null));};exports[_0xf578('0x5f')]=function(_0xa6dc3c,_0x6c8fa6){return db[_0xf578('0x40')][_0xf578('0x5f')]()[_0xf578('0x21')](respondWithResult(_0x6c8fa6,null))[_0xf578('0x59')](handleError(_0x6c8fa6,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xf578('0x60')]=function(_0x214493,_0x375140,_0x249255){var _0x35b8f8={'agent':{},'channel':'whatsapp'};if(_0x214493[_0xf578('0x5e')]['id']){delete _0x214493['body']['id'];}_0x214493[_0xf578('0x5e')][_0xf578('0x61')]=!![];_0x214493[_0xf578('0x5e')]['readAt']=moment()[_0xf578('0x62')](_0xf578('0x63'));_0x214493[_0xf578('0x5e')]['UserId']=_0x214493[_0xf578('0x5e')][_0xf578('0x64')]||_0x214493['user']['id'];_0x35b8f8[_0xf578('0x65')]['id']=_0x214493[_0xf578('0x5e')][_0xf578('0x64')];return db[_0xf578('0x40')]['find']({'where':{'id':_0x214493['params']['id'],'UserId':null}})[_0xf578('0x21')](handleEntityNotFound(_0x375140,null))[_0xf578('0x21')](saveUpdates(_0x214493[_0xf578('0x5e')],null))[_0xf578('0x21')](function(_0x46a99b){if(_0x46a99b){_0x35b8f8[_0xf578('0x28')]=_0x46a99b[_0xf578('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0xf578('0x5c')]({'where':{'id':_0x46a99b[_0xf578('0x67')]}});}return null;})[_0xf578('0x21')](handleEntityNotFound(_0x375140,null))[_0xf578('0x21')](function(_0x54e27a){if(_0x54e27a){return _0x54e27a[_0xf578('0x39')]({'UserId':_0x214493[_0xf578('0x5e')][_0xf578('0x64')],'read1stAt':_[_0xf578('0x68')](_0x54e27a[_0xf578('0x69')])?moment()['format'](_0xf578('0x63')):undefined});}return null;})[_0xf578('0x21')](function(_0xd8fad4){if(_0xd8fad4){_0x35b8f8['interaction']=_0xd8fad4['get']({'plain':!![]});interaction_log[_0xf578('0x29')](_0xf578('0x6a'),_0x214493[_0xf578('0x6b')]['id'],_0x214493[_0xf578('0x6b')][_0xf578('0x3c')],_0x214493[_0xf578('0x6b')][_0xf578('0x6c')],_0x35b8f8[_0xf578('0x6d')]['id'],_0x214493[_0xf578('0x5e')]?JSON[_0xf578('0x25')](_0x214493[_0xf578('0x5e')]):_0xf578('0x6e'));return respondWithRpcPromise(_0xf578('0x6f'),_0xf578('0x70'),_0x35b8f8);}return null;})['then'](function(_0x27c46){var _0x3d72a2=_0xf578('0x71')+_0x27c46[_0xf578('0x28')][_0xf578('0x72')];return db[_0xf578('0x73')]['query'](_0x3d72a2,{'type':db['Sequelize']['QueryTypes'][_0xf578('0x74')],'raw':!![]})[_0xf578('0x21')](function(_0x325352){return _0x325352;});})[_0xf578('0x21')](function(_0x187c51){if(_0x187c51){_0x35b8f8[_0xf578('0x28')][_0xf578('0x75')]=_0x187c51[0x0];if(!_0x214493[_0xf578('0x5e')][_0xf578('0x64')])return;return db[_0xf578('0x76')][_0xf578('0x5c')]({'where':{'id':_0x214493[_0xf578('0x5e')]['UserId'],'role':'agent'},'attributes':['id','name',_0xf578('0x77'),_0xf578('0x78'),_0xf578('0x79')],'raw':!![]});}return null;})[_0xf578('0x21')](function(_0x4285c8){if(!_0x4285c8)return null;_0x35b8f8[_0xf578('0x28')][_0xf578('0x65')]=_0x4285c8;return _0x35b8f8;})[_0xf578('0x21')](function(_0x561b76){if(_0x561b76){if(_0x214493[_0xf578('0x5e')][_0xf578('0x7a')]){_0x35b8f8[_0xf578('0x28')][_0xf578('0x7b')]=util['format'](_0xf578('0x7c'),_0x214493['user'][_0xf578('0x3c')]);_0x35b8f8[_0xf578('0x28')][_0xf578('0x7d')]=_0x35b8f8[_0xf578('0x7d')];_0x35b8f8[_0xf578('0x28')]['motionChannel']=_0x35b8f8['channel'];_0x35b8f8[_0xf578('0x28')][_0xf578('0x7e')]=_0xf578('0x60');return respondWithRpcPromise(_0xf578('0x7f'),_0xf578('0x7f'),{'event':_0xf578('0x80'),'message':_0x35b8f8[_0xf578('0x28')]},client9002)[_0xf578('0x21')](function(){return _0x35b8f8;});}return _0x35b8f8;}return null;})[_0xf578('0x21')](respondWithResult(_0x375140,null))['catch'](handleError(_0x375140,null));};var interaction_log=require(_0xf578('0x81'))(_0xf578('0x82'));exports[_0xf578('0x37')]=function(_0x285426,_0x476d85,_0x15e791){var _0x4cfa57={'agent':{},'channel':'whatsapp'};if(_0x285426[_0xf578('0x5e')]['id']){delete _0x285426[_0xf578('0x5e')]['id'];}_0x285426[_0xf578('0x5e')]['UserId']=_0x285426[_0xf578('0x5e')]['UserId']||_0x285426[_0xf578('0x6b')]['id'];_0x4cfa57[_0xf578('0x65')]['id']=_0x285426[_0xf578('0x5e')][_0xf578('0x64')];return db[_0xf578('0x40')]['find']({'where':{'id':_0x285426[_0xf578('0x5b')]['id'],'UserId':null}})[_0xf578('0x21')](handleEntityNotFound(_0x476d85,null))[_0xf578('0x21')](function(_0x5b4aad){if(_0x5b4aad){_0x4cfa57['message']=_0x5b4aad[_0xf578('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0xf578('0x5c')]({'where':{'id':_0x5b4aad[_0xf578('0x67')]}});}return null;})[_0xf578('0x21')](handleEntityNotFound(_0x476d85,null))[_0xf578('0x21')](function(_0x52e17f){if(_0x52e17f){_0x4cfa57[_0xf578('0x6d')]=_0x52e17f['get']({'plain':!![]});interaction_log[_0xf578('0x29')](_0xf578('0x83'),_0x285426[_0xf578('0x6b')]['id'],_0x285426['user'][_0xf578('0x3c')],_0x285426['user'][_0xf578('0x6c')],_0x4cfa57[_0xf578('0x6d')]['id'],_0x285426['body']?JSON[_0xf578('0x25')](_0x285426[_0xf578('0x5e')]):'null');return respondWithRpcPromise(_0xf578('0x84'),_0xf578('0x85'),_0x4cfa57);}return null;})[_0xf578('0x21')](function(_0x4d585b){var _0x6fc5c7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d585b[_0xf578('0x28')][_0xf578('0x72')];return db[_0xf578('0x73')][_0xf578('0x44')](_0x6fc5c7,{'type':db[_0xf578('0x86')][_0xf578('0x87')][_0xf578('0x74')],'raw':!![]})[_0xf578('0x21')](function(_0x256e9d){return _0x256e9d;});})['then'](function(_0xe793b8){if(_0xe793b8){_0x4cfa57[_0xf578('0x28')][_0xf578('0x75')]=_0xe793b8[0x0];if(!_0x285426[_0xf578('0x5e')]['UserId'])return;return db['User'][_0xf578('0x5c')]({'where':{'id':_0x285426[_0xf578('0x5e')][_0xf578('0x64')],'role':'agent'},'attributes':['id',_0xf578('0x3c'),_0xf578('0x77'),'email','internal'],'raw':!![]});}return null;})[_0xf578('0x21')](function(_0xadf44){if(!_0xadf44)return null;_0x4cfa57[_0xf578('0x28')]['agent']=_0xadf44;return _0x4cfa57;})[_0xf578('0x21')](function(_0x3f2d42){if(_0x3f2d42){_0x3f2d42['message'][_0xf578('0x7b')]=util[_0xf578('0x62')](_0xf578('0x7c'),_0x285426[_0xf578('0x6b')][_0xf578('0x3c')]);_0x3f2d42['message'][_0xf578('0x7d')]=_0x4cfa57[_0xf578('0x7d')];_0x3f2d42['message'][_0xf578('0x88')]=_0x4cfa57['channel'];_0x3f2d42[_0xf578('0x28')][_0xf578('0x7e')]=_0xf578('0x37');respondWithRpcPromise(_0xf578('0x7f'),_0xf578('0x7f'),{'event':_0xf578('0x89'),'message':_0x3f2d42[_0xf578('0x28')]},client9002);return _0x4cfa57;}return null;})[_0xf578('0x21')](respondWithResult(_0x476d85,null))['catch'](handleError(_0x476d85,null));};exports['status']=function(_0x59bb45,_0x447169,_0x8087af){if(_0x59bb45[_0xf578('0x5e')]['id']){delete _0x59bb45['body']['id'];}var _0x2ec91b;return db['WhatsappMessage']['find']({'where':{'id':_0x59bb45['params']['id']}})[_0xf578('0x21')](handleEntityNotFound(_0x447169,null))[_0xf578('0x21')](function(_0x52d6f8){if(_0x52d6f8){_0x2ec91b=_0x52d6f8;return db[_0xf578('0x8a')][_0xf578('0x5c')]({'where':{'id':_0x52d6f8[_0xf578('0x8b')]}});}})[_0xf578('0x21')](handleEntityNotFound(_0x447169,null))[_0xf578('0x21')](function(_0x5dd7de){if(_0x5dd7de){logger[_0xf578('0x23')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xf578('0x2e'),_0xf578('0x8c'),_0x5dd7de[_0xf578('0x42')],util[_0xf578('0x8d')](_0x59bb45['body'],{'showHidden':![],'depth':null}));switch(_0x5dd7de['type']){case _0xf578('0x8e'):if(_0x59bb45[_0xf578('0x5e')][_0xf578('0x8f')]&&_0x59bb45[_0xf578('0x5e')]['MessageSid']===_0x2ec91b[_0xf578('0x90')]&&_0x59bb45['body']['MessageStatus']&&_0x59bb45[_0xf578('0x5e')][_0xf578('0x91')]===_0xf578('0x61')){return _0x2ec91b[_0xf578('0x39')]({'read':!![]});}else{logger[_0xf578('0x26')](_0xf578('0x92'),_0xf578('0x2e'),_0xf578('0x8e'),util[_0xf578('0x8d')](_0x59bb45[_0xf578('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2ec91b;}})[_0xf578('0x21')](respondWithResult(_0x447169,null))[_0xf578('0x59')](handleError(_0x447169,null));}; \ No newline at end of file +var _0x1783=['catch','sendStatus','status','undefined','offset','limit','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','count','includeAll','include','show','params','keys','intersection','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','read1stAt','format','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','QueryTypes','User','email','motionChannel','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x4fd75e,_0x219e4a){var _0x5b6338=function(_0xf2969c){while(--_0xf2969c){_0x4fd75e['push'](_0x4fd75e['shift']());}};_0x5b6338(++_0x219e4a);}(_0x1783,0x16a));var _0x3178=function(_0x2f6260,_0x166e04){_0x2f6260=_0x2f6260-0x0;var _0x5a18b8=_0x1783[_0x2f6260];return _0x5a18b8;};'use strict';var emlformat=require(_0x3178('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3178('0x1'));var jsonpatch=require(_0x3178('0x2'));var rp=require(_0x3178('0x3'));var moment=require(_0x3178('0x4'));var BPromise=require(_0x3178('0x5'));var Mustache=require('mustache');var util=require(_0x3178('0x6'));var path=require(_0x3178('0x7'));var sox=require(_0x3178('0x8'));var csv=require(_0x3178('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3178('0xa'));var _=require(_0x3178('0xb'));var squel=require(_0x3178('0xc'));var crypto=require(_0x3178('0xd'));var jsforce=require(_0x3178('0xe'));var deskjs=require(_0x3178('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3178('0x10'));var Papa=require(_0x3178('0x11'));var Redis=require('ioredis');var authService=require(_0x3178('0x12'));var qs=require(_0x3178('0x13'));var as=require(_0x3178('0x14'));var hardwareService=require(_0x3178('0x15'));var logger=require(_0x3178('0x16'))(_0x3178('0x17'));var utils=require(_0x3178('0x18'));var config=require(_0x3178('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3178('0x1a'))['db'];config[_0x3178('0x1b')]=_['defaults'](config[_0x3178('0x1b')],{'host':_0x3178('0x1c'),'port':0x18eb});var socket=require(_0x3178('0x1d'))(new Redis(config[_0x3178('0x1b')]));require(_0x3178('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3178('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x3178('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x329f6e,_0x4a3e11,_0x3a4d84,_0x48cd99){return new BPromise(function(_0x4238f0,_0x477928){var _0x560642=_0x48cd99||client;return _0x560642[_0x3178('0x20')](_0x329f6e,_0x3a4d84)[_0x3178('0x21')](function(_0x1e2c8a){logger['info'](_0x3178('0x22'),_0x4a3e11,_0x3178('0x23'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4a3e11,'request\x20sent',JSON['stringify'](_0x1e2c8a));if(_0x1e2c8a[_0x3178('0x24')]){if(_0x1e2c8a[_0x3178('0x24')][_0x3178('0x25')]===0x1f4){logger[_0x3178('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x4a3e11,_0x1e2c8a[_0x3178('0x24')]['message']);return _0x477928(_0x1e2c8a[_0x3178('0x24')][_0x3178('0x26')]);}logger[_0x3178('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x4a3e11,_0x1e2c8a['error'][_0x3178('0x26')]);return _0x4238f0(_0x1e2c8a[_0x3178('0x24')][_0x3178('0x26')]);}else{logger['info'](_0x3178('0x22'),_0x4a3e11,_0x3178('0x23'));_0x4238f0(_0x1e2c8a[_0x3178('0x27')][_0x3178('0x26')]);}})[_0x3178('0x28')](function(_0x30f7e6){logger[_0x3178('0x24')](_0x3178('0x22'),_0x4a3e11,_0x30f7e6);_0x477928(_0x30f7e6);});});}function respondWithStatusCode(_0x14b1cb,_0xc30828){_0xc30828=_0xc30828||0xcc;return function(_0x345cd7){if(_0x345cd7){return _0x14b1cb[_0x3178('0x29')](_0xc30828);}return _0x14b1cb[_0x3178('0x2a')](_0xc30828)['end']();};}function respondWithResult(_0x1d92e2,_0x4f90a0){_0x4f90a0=_0x4f90a0||0xc8;return function(_0x23b8a1){if(_0x23b8a1){return _0x1d92e2['status'](_0x4f90a0)['json'](_0x23b8a1);}};}function respondWithFilteredResult(_0x1056d4,_0x4706fe){return function(_0x4b1890){if(_0x4b1890){var _0x3d959e=typeof _0x4706fe['offset']==='undefined'&&typeof _0x4706fe['limit']===_0x3178('0x2b');var _0x47e85c=_0x4b1890['count'];var _0x25180f=_0x3d959e?0x0:_0x4706fe[_0x3178('0x2c')];var _0x1ce860=_0x3d959e?_0x4b1890['count']:_0x4706fe[_0x3178('0x2c')]+_0x4706fe[_0x3178('0x2d')];var _0x3fb501;if(_0x1ce860>=_0x47e85c){_0x1ce860=_0x47e85c;_0x3fb501=0xc8;}else{_0x3fb501=0xce;}_0x1056d4[_0x3178('0x2a')](_0x3fb501);return _0x1056d4[_0x3178('0x2e')](_0x3178('0x2f'),_0x25180f+'-'+_0x1ce860+'/'+_0x47e85c)[_0x3178('0x30')](_0x4b1890);}return null;};}function patchUpdates(_0x19a7c0){return function(_0xe7ce33){try{jsonpatch['apply'](_0xe7ce33,_0x19a7c0,!![]);}catch(_0x51af17){return BPromise['reject'](_0x51af17);}return _0xe7ce33['save']();};}function saveUpdates(_0x5cfabf,_0x18d870){return function(_0x2cc366){if(_0x2cc366){return _0x2cc366[_0x3178('0x31')](_0x5cfabf)[_0x3178('0x21')](function(_0x423261){return _0x423261;});}return null;};}function removeEntity(_0x436845,_0xfca770){return function(_0x4a2e6f){if(_0x4a2e6f){return _0x4a2e6f[_0x3178('0x32')]()[_0x3178('0x21')](function(){_0x436845['status'](0xcc)[_0x3178('0x33')]();});}};}function handleEntityNotFound(_0x2119e6,_0x24a26b){return function(_0x42d67d){if(!_0x42d67d){_0x2119e6[_0x3178('0x29')](0x194);}return _0x42d67d;};}function handleError(_0x585b3c,_0x59d63c){_0x59d63c=_0x59d63c||0x1f4;return function(_0x4fb49e){logger['error'](_0x4fb49e[_0x3178('0x34')]);if(_0x4fb49e[_0x3178('0x35')]){delete _0x4fb49e['name'];}_0x585b3c['status'](_0x59d63c)[_0x3178('0x36')](_0x4fb49e);};}exports[_0x3178('0x37')]=function(_0x40867d,_0x3c5e50){var _0x4378a5={},_0x385d94={},_0x42d138={'count':0x0,'rows':[]};var _0x26ced7=_[_0x3178('0x38')](db[_0x3178('0x39')][_0x3178('0x3a')],function(_0x40dc68){return{'name':_0x40dc68[_0x3178('0x3b')],'type':_0x40dc68[_0x3178('0x3c')][_0x3178('0x3d')]};});_0x385d94[_0x3178('0x3e')]=_['map'](_0x26ced7,_0x3178('0x35'));_0x385d94[_0x3178('0x3f')]=_['keys'](_0x40867d[_0x3178('0x3f')]);_0x385d94[_0x3178('0x40')]=_['intersection'](_0x385d94[_0x3178('0x3e')],_0x385d94['query']);_0x4378a5[_0x3178('0x41')]=_['intersection'](_0x385d94[_0x3178('0x3e')],qs[_0x3178('0x42')](_0x40867d['query']['fields']));_0x4378a5['attributes']=_0x4378a5[_0x3178('0x41')][_0x3178('0x43')]?_0x4378a5['attributes']:_0x385d94[_0x3178('0x3e')];if(!_0x40867d[_0x3178('0x3f')][_0x3178('0x44')](_0x3178('0x45'))){_0x4378a5[_0x3178('0x2d')]=qs['limit'](_0x40867d[_0x3178('0x3f')][_0x3178('0x2d')]);_0x4378a5[_0x3178('0x2c')]=qs[_0x3178('0x2c')](_0x40867d['query'][_0x3178('0x2c')]);}_0x4378a5['order']=qs['sort'](_0x40867d[_0x3178('0x3f')][_0x3178('0x46')]);_0x4378a5['where']=qs[_0x3178('0x40')](_[_0x3178('0x47')](_0x40867d[_0x3178('0x3f')],_0x385d94[_0x3178('0x40')]),_0x26ced7);if(_0x40867d[_0x3178('0x3f')][_0x3178('0x48')]){_0x4378a5[_0x3178('0x49')]=_[_0x3178('0x4a')](_0x4378a5['where'],{'$or':_[_0x3178('0x38')](_0x26ced7,function(_0x21d999){if(_0x21d999[_0x3178('0x3c')]!=='VIRTUAL'){var _0x21f4b3={};_0x21f4b3[_0x21d999[_0x3178('0x35')]]={'$like':'%'+_0x40867d[_0x3178('0x3f')][_0x3178('0x48')]+'%'};return _0x21f4b3;}})});}_0x4378a5=_['merge']({},_0x4378a5,_0x40867d[_0x3178('0x4b')]);var _0x97cef={'where':_0x4378a5['where']};return db['WhatsappMessage']['count'](_0x97cef)[_0x3178('0x21')](function(_0x2eb155){_0x42d138[_0x3178('0x4c')]=_0x2eb155;if(_0x40867d[_0x3178('0x3f')][_0x3178('0x4d')]){_0x4378a5[_0x3178('0x4e')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x4378a5);})['then'](function(_0x2b5c49){_0x42d138['rows']=_0x2b5c49;return _0x42d138;})[_0x3178('0x21')](respondWithFilteredResult(_0x3c5e50,_0x4378a5))['catch'](handleError(_0x3c5e50,null));};exports[_0x3178('0x4f')]=function(_0x4c0158,_0x47d9dd){var _0x41238a={'raw':!![],'where':{'id':_0x4c0158[_0x3178('0x50')]['id']}},_0x1f055a={};_0x1f055a[_0x3178('0x3e')]=_['keys'](db[_0x3178('0x39')][_0x3178('0x3a')]);_0x1f055a[_0x3178('0x3f')]=_[_0x3178('0x51')](_0x4c0158[_0x3178('0x3f')]);_0x1f055a[_0x3178('0x40')]=_[_0x3178('0x52')](_0x1f055a[_0x3178('0x3e')],_0x1f055a['query']);_0x41238a[_0x3178('0x41')]=_['intersection'](_0x1f055a[_0x3178('0x3e')],qs[_0x3178('0x42')](_0x4c0158[_0x3178('0x3f')][_0x3178('0x42')]));_0x41238a[_0x3178('0x41')]=_0x41238a[_0x3178('0x41')][_0x3178('0x43')]?_0x41238a[_0x3178('0x41')]:_0x1f055a[_0x3178('0x3e')];if(_0x4c0158[_0x3178('0x3f')]['includeAll']){_0x41238a[_0x3178('0x4e')]=[{'all':!![]}];}_0x41238a=_[_0x3178('0x4a')]({},_0x41238a,_0x4c0158['options']);return db[_0x3178('0x39')][_0x3178('0x53')](_0x41238a)[_0x3178('0x21')](handleEntityNotFound(_0x47d9dd,null))[_0x3178('0x21')](respondWithResult(_0x47d9dd,null))[_0x3178('0x28')](handleError(_0x47d9dd,null));};exports[_0x3178('0x54')]=function(_0x54d9c8,_0x1e6935){return db['WhatsappMessage'][_0x3178('0x54')](_0x54d9c8[_0x3178('0x55')],{})[_0x3178('0x21')](respondWithResult(_0x1e6935,0xc9))[_0x3178('0x28')](handleError(_0x1e6935,null));};exports[_0x3178('0x31')]=function(_0x3d6df5,_0x4e2760){if(_0x3d6df5['body']['id']){delete _0x3d6df5[_0x3178('0x55')]['id'];}return db[_0x3178('0x39')][_0x3178('0x53')]({'where':{'id':_0x3d6df5[_0x3178('0x50')]['id']}})[_0x3178('0x21')](handleEntityNotFound(_0x4e2760,null))['then'](saveUpdates(_0x3d6df5[_0x3178('0x55')],null))[_0x3178('0x21')](respondWithResult(_0x4e2760,null))[_0x3178('0x28')](handleError(_0x4e2760,null));};exports[_0x3178('0x32')]=function(_0x436013,_0x48e77e){return db[_0x3178('0x39')][_0x3178('0x53')]({'where':{'id':_0x436013[_0x3178('0x50')]['id']}})['then'](handleEntityNotFound(_0x48e77e,null))[_0x3178('0x21')](removeEntity(_0x48e77e,null))['catch'](handleError(_0x48e77e,null));};exports[_0x3178('0x56')]=function(_0x5a8e9a,_0xffe4e6){return db[_0x3178('0x39')]['describe']()[_0x3178('0x21')](respondWithResult(_0xffe4e6,null))[_0x3178('0x28')](handleError(_0xffe4e6,null));};var interaction_log=require(_0x3178('0x16'))(_0x3178('0x57'));exports[_0x3178('0x58')]=function(_0x5753a0,_0x239cbd,_0x3a6234){var _0x59a300={'agent':{},'channel':_0x3178('0x59')};if(_0x5753a0[_0x3178('0x55')]['id']){delete _0x5753a0[_0x3178('0x55')]['id'];}_0x5753a0[_0x3178('0x55')]['read']=!![];_0x5753a0[_0x3178('0x55')][_0x3178('0x5a')]=moment()['format'](_0x3178('0x5b'));_0x5753a0[_0x3178('0x55')][_0x3178('0x5c')]=_0x5753a0[_0x3178('0x55')]['UserId']||_0x5753a0[_0x3178('0x5d')]['id'];_0x59a300[_0x3178('0x5e')]['id']=_0x5753a0['body']['UserId'];return db[_0x3178('0x39')][_0x3178('0x53')]({'where':{'id':_0x5753a0[_0x3178('0x50')]['id'],'UserId':null}})[_0x3178('0x21')](handleEntityNotFound(_0x239cbd,null))['then'](saveUpdates(_0x5753a0[_0x3178('0x55')],null))[_0x3178('0x21')](function(_0x341bb9){if(_0x341bb9){_0x59a300[_0x3178('0x26')]=_0x341bb9[_0x3178('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0x3178('0x53')]({'where':{'id':_0x341bb9[_0x3178('0x60')]}});}return null;})[_0x3178('0x21')](handleEntityNotFound(_0x239cbd,null))[_0x3178('0x21')](function(_0x9e17bd){if(_0x9e17bd){return _0x9e17bd[_0x3178('0x31')]({'UserId':_0x5753a0[_0x3178('0x55')][_0x3178('0x5c')],'read1stAt':_['isNil'](_0x9e17bd[_0x3178('0x61')])?moment()[_0x3178('0x62')](_0x3178('0x5b')):undefined});}return null;})['then'](function(_0x348bca){if(_0x348bca){_0x59a300[_0x3178('0x63')]=_0x348bca['get']({'plain':!![]});interaction_log[_0x3178('0x64')](_0x3178('0x65'),_0x5753a0[_0x3178('0x5d')]['id'],_0x5753a0['user']['name'],_0x5753a0['user'][_0x3178('0x66')],_0x59a300[_0x3178('0x63')]['id'],_0x5753a0[_0x3178('0x55')]?JSON['stringify'](_0x5753a0[_0x3178('0x55')]):'null');return respondWithRpcPromise(_0x3178('0x67'),'acceptMessage',_0x59a300);}return null;})[_0x3178('0x21')](function(_0x3828c2){var _0x3c7161=_0x3178('0x68')+_0x3828c2[_0x3178('0x26')]['ContactId'];return db[_0x3178('0x69')][_0x3178('0x3f')](_0x3c7161,{'type':db[_0x3178('0x6a')]['QueryTypes'][_0x3178('0x6b')],'raw':!![]})[_0x3178('0x21')](function(_0x151eaa){return _0x151eaa;});})[_0x3178('0x21')](function(_0x385700){if(_0x385700){_0x59a300['message'][_0x3178('0x6c')]=_0x385700[0x0];if(!_0x5753a0['body'][_0x3178('0x5c')])return;return db['User']['find']({'where':{'id':_0x5753a0[_0x3178('0x55')]['UserId'],'role':_0x3178('0x5e')},'attributes':['id',_0x3178('0x35'),_0x3178('0x6d'),'email','internal'],'raw':!![]});}return null;})[_0x3178('0x21')](function(_0x273508){if(!_0x273508)return null;_0x59a300[_0x3178('0x26')][_0x3178('0x5e')]=_0x273508;return _0x59a300;})[_0x3178('0x21')](function(_0x3a1c08){if(_0x3a1c08){if(_0x5753a0[_0x3178('0x55')]['manual']){_0x59a300[_0x3178('0x26')][_0x3178('0x6e')]=util['format'](_0x3178('0x6f'),_0x5753a0[_0x3178('0x5d')]['name']);_0x59a300['message'][_0x3178('0x70')]=_0x59a300[_0x3178('0x70')];_0x59a300['message']['motionChannel']=_0x59a300[_0x3178('0x70')];_0x59a300[_0x3178('0x26')][_0x3178('0x71')]=_0x3178('0x58');return respondWithRpcPromise(_0x3178('0x72'),_0x3178('0x72'),{'event':_0x3178('0x73'),'message':_0x59a300[_0x3178('0x26')]},client9002)[_0x3178('0x21')](function(){return _0x59a300;});}return _0x59a300;}return null;})[_0x3178('0x21')](respondWithResult(_0x239cbd,null))[_0x3178('0x28')](handleError(_0x239cbd,null));};var interaction_log=require('../../config/logger')(_0x3178('0x57'));exports[_0x3178('0x74')]=function(_0x4134ff,_0x3ba13e,_0x15d174){var _0x37519b={'agent':{},'channel':_0x3178('0x59')};if(_0x4134ff[_0x3178('0x55')]['id']){delete _0x4134ff['body']['id'];}_0x4134ff[_0x3178('0x55')][_0x3178('0x5c')]=_0x4134ff[_0x3178('0x55')][_0x3178('0x5c')]||_0x4134ff[_0x3178('0x5d')]['id'];_0x37519b[_0x3178('0x5e')]['id']=_0x4134ff[_0x3178('0x55')][_0x3178('0x5c')];return db[_0x3178('0x39')][_0x3178('0x53')]({'where':{'id':_0x4134ff[_0x3178('0x50')]['id'],'UserId':null}})[_0x3178('0x21')](handleEntityNotFound(_0x3ba13e,null))[_0x3178('0x21')](function(_0x501e35){if(_0x501e35){_0x37519b['message']=_0x501e35[_0x3178('0x5f')]({'plain':!![]});return db[_0x3178('0x75')][_0x3178('0x53')]({'where':{'id':_0x501e35[_0x3178('0x60')]}});}return null;})[_0x3178('0x21')](handleEntityNotFound(_0x3ba13e,null))[_0x3178('0x21')](function(_0x5de5b1){if(_0x5de5b1){_0x37519b[_0x3178('0x63')]=_0x5de5b1[_0x3178('0x5f')]({'plain':!![]});interaction_log[_0x3178('0x64')](_0x3178('0x76'),_0x4134ff[_0x3178('0x5d')]['id'],_0x4134ff['user'][_0x3178('0x35')],_0x4134ff[_0x3178('0x5d')][_0x3178('0x66')],_0x37519b[_0x3178('0x63')]['id'],_0x4134ff[_0x3178('0x55')]?JSON['stringify'](_0x4134ff[_0x3178('0x55')]):_0x3178('0x77'));return respondWithRpcPromise(_0x3178('0x78'),_0x3178('0x79'),_0x37519b);}return null;})[_0x3178('0x21')](function(_0x57b5a0){var _0x56ca2d=_0x3178('0x68')+_0x57b5a0['message'][_0x3178('0x7a')];return db[_0x3178('0x69')][_0x3178('0x3f')](_0x56ca2d,{'type':db['Sequelize'][_0x3178('0x7b')]['SELECT'],'raw':!![]})[_0x3178('0x21')](function(_0x513bfa){return _0x513bfa;});})[_0x3178('0x21')](function(_0x4d0a6b){if(_0x4d0a6b){_0x37519b['message'][_0x3178('0x6c')]=_0x4d0a6b[0x0];if(!_0x4134ff['body'][_0x3178('0x5c')])return;return db[_0x3178('0x7c')][_0x3178('0x53')]({'where':{'id':_0x4134ff['body']['UserId'],'role':_0x3178('0x5e')},'attributes':['id',_0x3178('0x35'),_0x3178('0x6d'),_0x3178('0x7d'),'internal'],'raw':!![]});}return null;})[_0x3178('0x21')](function(_0x565b70){if(!_0x565b70)return null;_0x37519b['message'][_0x3178('0x5e')]=_0x565b70;return _0x37519b;})[_0x3178('0x21')](function(_0x2fbbfb){if(_0x2fbbfb){_0x2fbbfb['message']['interface']=util[_0x3178('0x62')]('SIP/%s',_0x4134ff[_0x3178('0x5d')][_0x3178('0x35')]);_0x2fbbfb[_0x3178('0x26')][_0x3178('0x70')]=_0x37519b[_0x3178('0x70')];_0x2fbbfb[_0x3178('0x26')][_0x3178('0x7e')]=_0x37519b[_0x3178('0x70')];_0x2fbbfb[_0x3178('0x26')][_0x3178('0x71')]='reject';respondWithRpcPromise('EventManager',_0x3178('0x72'),{'event':'rejectmessage','message':_0x2fbbfb[_0x3178('0x26')]},client9002);return _0x37519b;}return null;})[_0x3178('0x21')](respondWithResult(_0x3ba13e,null))[_0x3178('0x28')](handleError(_0x3ba13e,null));};exports[_0x3178('0x2a')]=function(_0x225ad3,_0x18b729,_0x48ee7b){if(_0x225ad3['body']['id']){delete _0x225ad3[_0x3178('0x55')]['id'];}var _0x16b38f;return db['WhatsappMessage'][_0x3178('0x53')]({'where':{'id':_0x225ad3[_0x3178('0x50')]['id']}})[_0x3178('0x21')](handleEntityNotFound(_0x18b729,null))[_0x3178('0x21')](function(_0x67a4ff){if(_0x67a4ff){_0x16b38f=_0x67a4ff;return db['WhatsappAccount'][_0x3178('0x53')]({'where':{'id':_0x67a4ff['WhatsappAccountId']}});}})[_0x3178('0x21')](handleEntityNotFound(_0x18b729,null))[_0x3178('0x21')](function(_0x2e8b8d){if(_0x2e8b8d){logger['debug'](_0x3178('0x7f'),'status',_0x3178('0x80'),_0x2e8b8d['type'],util[_0x3178('0x81')](_0x225ad3['body'],{'showHidden':![],'depth':null}));switch(_0x2e8b8d[_0x3178('0x3c')]){case _0x3178('0x82'):if(_0x225ad3[_0x3178('0x55')]['MessageSid']&&_0x225ad3[_0x3178('0x55')]['MessageSid']===_0x16b38f[_0x3178('0x83')]&&_0x225ad3['body'][_0x3178('0x84')]&&_0x225ad3[_0x3178('0x55')]['MessageStatus']==='read'){return _0x16b38f[_0x3178('0x31')]({'read':!![]});}else{logger[_0x3178('0x24')](_0x3178('0x85'),_0x3178('0x2a'),_0x3178('0x82'),util[_0x3178('0x81')](_0x225ad3['body'],{'showHidden':![],'depth':null}));}break;}return _0x16b38f;}})[_0x3178('0x21')](respondWithResult(_0x18b729,null))[_0x3178('0x28')](handleError(_0x18b729,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b988cdb..377d589 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 _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x0bb5,0x148));var _0x50bb=function(_0x126973,_0x3f2073){_0x126973=_0x126973-0x0;var _0x44e9f0=_0x0bb5[_0x126973];return _0x44e9f0;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var WhatsappMessage=require(_0x50bb('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){WhatsappMessageEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);WhatsappMessageEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8f59=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage'];(function(_0x26ba02,_0x544f59){var _0x322011=function(_0x3d2db2){while(--_0x3d2db2){_0x26ba02['push'](_0x26ba02['shift']());}};_0x322011(++_0x544f59);}(_0x8f59,0x11d));var _0x98f5=function(_0x465e1c,_0xdff365){_0x465e1c=_0x465e1c-0x0;var _0xb35dda=_0x8f59[_0x465e1c];return _0xb35dda;};'use strict';var EventEmitter=require(_0x98f5('0x0'));var WhatsappMessage=require(_0x98f5('0x1'))['db'][_0x98f5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x98f5('0x3')](0x0);var events={'afterCreate':_0x98f5('0x4'),'afterUpdate':_0x98f5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x912492){return function(_0x320235,_0x107e7e,_0x2f8c31){WhatsappMessageEvents['emit'](_0x912492+':'+_0x320235['id'],_0x320235);WhatsappMessageEvents[_0x98f5('0x6')](_0x912492,_0x320235);_0x2f8c31(null);};}for(var e in events){if(events[_0x98f5('0x7')](e)){var event=events[e];WhatsappMessage[_0x98f5('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index b3f0ddb..8dbf657 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 _0x8d6f=['toLowerCase','out','secret','isNil','findOne','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','then','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','accountSid','/whatsapp/v1/','/messages/','text','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction'];(function(_0x2dd553,_0x53459f){var _0x3bdf16=function(_0x239e68){while(--_0x239e68){_0x2dd553['push'](_0x2dd553['shift']());}};_0x3bdf16(++_0x53459f);}(_0x8d6f,0x1bb));var _0xf8d6=function(_0x14e4cd,_0x433349){_0x14e4cd=_0x14e4cd-0x0;var _0x29fdf8=_0x8d6f[_0x14e4cd];return _0x29fdf8;};'use strict';var _=require(_0xf8d6('0x0'));var util=require(_0xf8d6('0x1'));var logger=require(_0xf8d6('0x2'))(_0xf8d6('0x3'));var moment=require(_0xf8d6('0x4'));var BPromise=require(_0xf8d6('0x5'));var rp=require(_0xf8d6('0x6'));var fetch=require(_0xf8d6('0x7'));var fs=require('fs');var path=require(_0xf8d6('0x8'));var rimraf=require(_0xf8d6('0x9'));var config=require(_0xf8d6('0xa'));var attributes=require(_0xf8d6('0xb'));module['exports']=function(_0x4b55fa,_0xa87519){return _0x4b55fa['define'](_0xf8d6('0xc'),attributes,{'tableName':_0xf8d6('0xd'),'paranoid':![],'indexes':[{'name':_0xf8d6('0xe'),'fields':['messageId']},{'name':_0xf8d6('0xf'),'fields':[_0xf8d6('0x10')],'type':_0xf8d6('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10efc3,_0xdcdd90,_0x1f07fc){var _0x56ba54=_0x4b55fa[_0xf8d6('0x12')];var _0x58531c=_0x10efc3[_0xf8d6('0x13')]({'plain':!![]});if(_0x58531c['direction']['toLowerCase']()==='in'||_0x58531c[_0xf8d6('0x14')][_0xf8d6('0x15')]()===_0xf8d6('0x16')&&!_0x58531c[_0xf8d6('0x17')]&&!_[_0xf8d6('0x18')](_0x58531c['UserId'])){_0x56ba54['WhatsappInteraction'][_0xf8d6('0x19')]({'where':{'id':_0x58531c['WhatsappInteractionId']}})['then'](function(_0xe08be5){if(_0xe08be5){_0xe08be5['update']({'lastMsgAt':_0x58531c[_0xf8d6('0x1a')],'lastMsgDirection':_0x58531c[_0xf8d6('0x14')][_0xf8d6('0x15')]()});}})['catch'](function(_0x4d5fab){console[_0xf8d6('0x1b')](_0x4d5fab);});}if(_0x58531c[_0xf8d6('0x14')]==='out'&&!_0x58531c[_0xf8d6('0x17')]){var _0xfdd8db;_0x56ba54[_0xf8d6('0x1c')][_0xf8d6('0x1d')]({'where':{'id':_0x58531c[_0xf8d6('0x1e')]},'raw':!![]})['then'](function(_0x2bcc24){_0xfdd8db=_0x2bcc24;if(_0xfdd8db&&_0xfdd8db[_0xf8d6('0x1f')]){switch(_0xfdd8db['type']){case _0xf8d6('0x20'):var _0x49d28e=require(_0xf8d6('0x20'));if(_0xfdd8db['accountSid']&&_0xfdd8db[_0xf8d6('0x21')]&&_0xfdd8db[_0xf8d6('0x22')]){var _0x30f5a3=new _0x49d28e(_0xfdd8db['accountSid'],_0xfdd8db[_0xf8d6('0x21')]);_0x30f5a3[_0xf8d6('0x23')][_0xf8d6('0x24')]({'body':_0x58531c[_0xf8d6('0x10')],'to':_0xf8d6('0x25')+_0x58531c['phone'],'from':_0xf8d6('0x25')+_0xfdd8db[_0xf8d6('0x22')],'statusCallback':_0xfdd8db[_0xf8d6('0x26')]+_0xf8d6('0x27')+_0x58531c['id']+'/status?token='+_0xfdd8db[_0xf8d6('0x28')]})[_0xf8d6('0x29')](function(_0x16d8b1){if(_0x16d8b1[_0xf8d6('0x2a')]){return _0x10efc3[_0xf8d6('0x2b')]({'messageId':_0x16d8b1[_0xf8d6('0x2a')]});}})['catch'](function(_0x5e2a8b){logger[_0xf8d6('0x1b')](_0xf8d6('0x2c'),_0xf8d6('0x2d'),_0xf8d6('0x20'),util['inspect'](_0x5e2a8b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf8d6('0x2c'),_0xf8d6('0x2d'),_0xf8d6('0x20'),_0xf8d6('0x2e'));}break;case'sinch':var _0x5c549d=_0xfdd8db[_0xf8d6('0x2f')];var _0x11ebd7=_0xfdd8db[_0xf8d6('0x21')];var _0x5b2d28=_0xfdd8db['baseUrl']+_0xf8d6('0x30')+_0x5c549d+_0xf8d6('0x31');var _0x6c9d80={'to':[_0x58531c[_0xf8d6('0x22')]],'message':{'type':_0xf8d6('0x32'),'text':_0x58531c['body']}};var _0x110346={'method':'POST','uri':_0x5b2d28,'headers':{'Authorization':_0xf8d6('0x33')+_0x11ebd7,'Content-Type':'application/json'},'body':_0x6c9d80,'json':!![]};rp(_0x110346)[_0xf8d6('0x29')](function(_0x2bc4b2){if(_0x2bc4b2[_0xf8d6('0x34')][0x0][_0xf8d6('0x35')]){return _0x10efc3[_0xf8d6('0x2b')]({'messageId':_0x2bc4b2[_0xf8d6('0x34')][0x0][_0xf8d6('0x35')]});}})['catch'](function(_0x3d7f18){logger[_0xf8d6('0x36')](_0xf8d6('0x37'),_0x3d7f18);});break;}}})['finally'](function(){_0x1f07fc();});}else{_0x1f07fc();}}},'charset':_0xf8d6('0x38'),'collate':_0xf8d6('0x39')});}; \ No newline at end of file +var _0x31ec=['out','isNil','UserId','WhatsappInteraction','findOne','then','update','error','secret','find','type','twilio','authToken','accountSid','messages','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/messages/','text','POST','Bearer\x20','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','models','direction','toLowerCase'];(function(_0x104b93,_0x9f9952){var _0x401f6e=function(_0x4325b9){while(--_0x4325b9){_0x104b93['push'](_0x104b93['shift']());}};_0x401f6e(++_0x9f9952);}(_0x31ec,0x13a));var _0xc31e=function(_0xb4e052,_0x1d3cb6){_0xb4e052=_0xb4e052-0x0;var _0x5197e7=_0x31ec[_0xb4e052];return _0x5197e7;};'use strict';var _=require(_0xc31e('0x0'));var util=require(_0xc31e('0x1'));var logger=require(_0xc31e('0x2'))(_0xc31e('0x3'));var moment=require(_0xc31e('0x4'));var BPromise=require(_0xc31e('0x5'));var rp=require('request-promise');var fetch=require(_0xc31e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc31e('0x7'));var attributes=require(_0xc31e('0x8'));module['exports']=function(_0x4b85b6,_0x3eead9){return _0x4b85b6[_0xc31e('0x9')](_0xc31e('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc31e('0xb')]},{'name':_0xc31e('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49133b,_0x2d4e2c,_0x283998){var _0x4bc615=_0x4b85b6[_0xc31e('0xd')];var _0x33fea7=_0x49133b['get']({'plain':!![]});if(_0x33fea7[_0xc31e('0xe')][_0xc31e('0xf')]()==='in'||_0x33fea7[_0xc31e('0xe')][_0xc31e('0xf')]()===_0xc31e('0x10')&&!_0x33fea7['secret']&&!_[_0xc31e('0x11')](_0x33fea7[_0xc31e('0x12')])){_0x4bc615[_0xc31e('0x13')][_0xc31e('0x14')]({'where':{'id':_0x33fea7['WhatsappInteractionId']}})[_0xc31e('0x15')](function(_0x98d8b5){if(_0x98d8b5){_0x98d8b5[_0xc31e('0x16')]({'lastMsgAt':_0x33fea7['createdAt'],'lastMsgDirection':_0x33fea7[_0xc31e('0xe')][_0xc31e('0xf')]()});}})['catch'](function(_0xe99916){console[_0xc31e('0x17')](_0xe99916);});}if(_0x33fea7['direction']===_0xc31e('0x10')&&!_0x33fea7[_0xc31e('0x18')]){var _0x2653c7;_0x4bc615['WhatsappAccount'][_0xc31e('0x19')]({'where':{'id':_0x33fea7['WhatsappAccountId']},'raw':!![]})['then'](function(_0x50986){_0x2653c7=_0x50986;if(_0x2653c7&&_0x2653c7[_0xc31e('0x1a')]){switch(_0x2653c7[_0xc31e('0x1a')]){case _0xc31e('0x1b'):var _0x4ee5f6=require(_0xc31e('0x1b'));if(_0x2653c7['accountSid']&&_0x2653c7[_0xc31e('0x1c')]&&_0x2653c7['phone']){var _0xa17d25=new _0x4ee5f6(_0x2653c7[_0xc31e('0x1d')],_0x2653c7[_0xc31e('0x1c')]);_0xa17d25[_0xc31e('0x1e')]['create']({'body':_0x33fea7[_0xc31e('0x1f')],'to':_0xc31e('0x20')+_0x33fea7['phone'],'from':'whatsapp:'+_0x2653c7[_0xc31e('0x21')],'statusCallback':_0x2653c7[_0xc31e('0x22')]+_0xc31e('0x23')+_0x33fea7['id']+_0xc31e('0x24')+_0x2653c7[_0xc31e('0x25')]})['then'](function(_0x2cfbe5){if(_0x2cfbe5[_0xc31e('0x26')]){return _0x49133b[_0xc31e('0x16')]({'messageId':_0x2cfbe5[_0xc31e('0x26')]});}})[_0xc31e('0x27')](function(_0x5eab7a){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc31e('0x28'),'twilio',util[_0xc31e('0x29')](_0x5eab7a,{'showHidden':![],'depth':null}));});}else{logger[_0xc31e('0x17')](_0xc31e('0x2a'),_0xc31e('0x28'),_0xc31e('0x1b'),_0xc31e('0x2b'));}break;case _0xc31e('0x2c'):var _0x12562d=_0x2653c7[_0xc31e('0x1d')];var _0x42711b=_0x2653c7[_0xc31e('0x1c')];var _0x50b23f=_0x2653c7['baseUrl']+'/whatsapp/v1/'+_0x12562d+_0xc31e('0x2d');var _0x25172c={'to':[_0x33fea7[_0xc31e('0x21')]],'message':{'type':_0xc31e('0x2e'),'text':_0x33fea7[_0xc31e('0x1f')]}};var _0xddb703={'method':_0xc31e('0x2f'),'uri':_0x50b23f,'headers':{'Authorization':_0xc31e('0x30')+_0x42711b,'Content-Type':'application/json'},'body':_0x25172c,'json':!![]};rp(_0xddb703)[_0xc31e('0x15')](function(_0x1d16ff){if(_0x1d16ff['statuses'][0x0][_0xc31e('0x31')]){return _0x49133b[_0xc31e('0x16')]({'messageId':_0x1d16ff[_0xc31e('0x32')][0x0][_0xc31e('0x31')]});}})[_0xc31e('0x27')](function(_0x5576bf){logger[_0xc31e('0x33')]('WhatsappMessage,\x20%s',_0x5576bf);});break;}}})[_0xc31e('0x34')](function(){_0x283998();});}else{_0x283998();}}},'charset':_0xc31e('0x35'),'collate':_0xc31e('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 381419e..bc3822c 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 _0xb54f=['info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb54f,0xd5));var _0xfb54=function(_0x1a5247,_0x358526){_0x1a5247=_0x1a5247-0x0;var _0x5476d4=_0xb54f[_0x1a5247];return _0x5476d4;};'use strict';var _=require(_0xfb54('0x0'));var util=require(_0xfb54('0x1'));var moment=require(_0xfb54('0x2'));var BPromise=require(_0xfb54('0x3'));var rs=require(_0xfb54('0x4'));var fs=require('fs');var Redis=require(_0xfb54('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb54('0x6'));var logger=require('../../config/logger')(_0xfb54('0x7'));var config=require(_0xfb54('0x8'));var jayson=require(_0xfb54('0x9'));var client=jayson[_0xfb54('0xa')][_0xfb54('0xb')]({'port':0x232a});config[_0xfb54('0xc')]=_[_0xfb54('0xd')](config[_0xfb54('0xc')],{'host':_0xfb54('0xe'),'port':0x18eb});var socket=require(_0xfb54('0xf'))(new Redis(config[_0xfb54('0xc')]));require(_0xfb54('0x10'))['register'](socket);function respondWithRpcPromise(_0x1cbf38,_0x3f72e3,_0x25f01d){return new BPromise(function(_0x520a0c,_0x429d7c){return client[_0xfb54('0x11')](_0x1cbf38,_0x25f01d)['then'](function(_0x1dd7f6){logger[_0xfb54('0x12')](_0xfb54('0x13'),_0x3f72e3,'request\x20sent');logger[_0xfb54('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3f72e3,_0xfb54('0x15'),JSON[_0xfb54('0x16')](_0x1dd7f6));if(_0x1dd7f6[_0xfb54('0x17')]){if(_0x1dd7f6[_0xfb54('0x17')][_0xfb54('0x18')]===0x1f4){logger[_0xfb54('0x17')](_0xfb54('0x13'),_0x3f72e3,_0x1dd7f6['error'][_0xfb54('0x19')]);return _0x429d7c(_0x1dd7f6[_0xfb54('0x17')]['message']);}logger[_0xfb54('0x17')](_0xfb54('0x13'),_0x3f72e3,_0x1dd7f6[_0xfb54('0x17')][_0xfb54('0x19')]);return _0x520a0c(_0x1dd7f6[_0xfb54('0x17')]['message']);}else{logger['info'](_0xfb54('0x13'),_0x3f72e3,_0xfb54('0x15'));_0x520a0c(_0x1dd7f6['result'][_0xfb54('0x19')]);}})[_0xfb54('0x1a')](function(_0x2607da){logger[_0xfb54('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x3f72e3,_0x2607da);_0x429d7c(_0x2607da);});});}exports['CreateWhatsappMessage']=function(_0x580501){var _0x461d62=this;return new Promise(function(_0x33801b,_0x51f42d){return db[_0xfb54('0x1b')][_0xfb54('0x1c')](_0x580501[_0xfb54('0x1d')],{'raw':_0x580501['options']?_0x580501[_0xfb54('0x1e')][_0xfb54('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1ca4df){logger[_0xfb54('0x12')](_0xfb54('0x20'),_0x580501);logger[_0xfb54('0x14')](_0xfb54('0x20'),_0x580501,JSON[_0xfb54('0x16')](_0x1ca4df));_0x33801b(_0x1ca4df);})[_0xfb54('0x1a')](function(_0x5e9590){logger[_0xfb54('0x17')](_0xfb54('0x20'),_0x5e9590[_0xfb54('0x19')],_0x580501);_0x51f42d(_0x461d62[_0xfb54('0x17')](0x1f4,_0x5e9590[_0xfb54('0x19')]));});});}; \ No newline at end of file +var _0x3c26=['message','request\x20sent','result','catch','body','options','raw','CreateWhatsappMessage','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x835333,_0x38c27f){var _0x43aba6=function(_0x3220f8){while(--_0x3220f8){_0x835333['push'](_0x835333['shift']());}};_0x43aba6(++_0x38c27f);}(_0x3c26,0x17c));var _0x63c2=function(_0x3bb6bd,_0x43bb21){_0x3bb6bd=_0x3bb6bd-0x0;var _0x53926f=_0x3c26[_0x3bb6bd];return _0x53926f;};'use strict';var _=require('lodash');var util=require(_0x63c2('0x0'));var moment=require(_0x63c2('0x1'));var BPromise=require(_0x63c2('0x2'));var rs=require(_0x63c2('0x3'));var fs=require('fs');var Redis=require(_0x63c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x63c2('0x5'));var config=require('../../config/environment');var jayson=require(_0x63c2('0x6'));var client=jayson[_0x63c2('0x7')][_0x63c2('0x8')]({'port':0x232a});config[_0x63c2('0x9')]=_[_0x63c2('0xa')](config[_0x63c2('0x9')],{'host':_0x63c2('0xb'),'port':0x18eb});var socket=require(_0x63c2('0xc'))(new Redis(config[_0x63c2('0x9')]));require(_0x63c2('0xd'))[_0x63c2('0xe')](socket);function respondWithRpcPromise(_0x37fa75,_0x4ca657,_0x444f2e){return new BPromise(function(_0x5bebc7,_0x395215){return client[_0x63c2('0xf')](_0x37fa75,_0x444f2e)[_0x63c2('0x10')](function(_0x2070af){logger[_0x63c2('0x11')](_0x63c2('0x12'),_0x4ca657,'request\x20sent');logger['debug'](_0x63c2('0x13'),_0x4ca657,'request\x20sent',JSON[_0x63c2('0x14')](_0x2070af));if(_0x2070af['error']){if(_0x2070af[_0x63c2('0x15')][_0x63c2('0x16')]===0x1f4){logger[_0x63c2('0x15')](_0x63c2('0x12'),_0x4ca657,_0x2070af[_0x63c2('0x15')]['message']);return _0x395215(_0x2070af[_0x63c2('0x15')][_0x63c2('0x17')]);}logger[_0x63c2('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x4ca657,_0x2070af['error'][_0x63c2('0x17')]);return _0x5bebc7(_0x2070af['error'][_0x63c2('0x17')]);}else{logger[_0x63c2('0x11')](_0x63c2('0x12'),_0x4ca657,_0x63c2('0x18'));_0x5bebc7(_0x2070af[_0x63c2('0x19')][_0x63c2('0x17')]);}})[_0x63c2('0x1a')](function(_0xc44d8a){logger['error'](_0x63c2('0x12'),_0x4ca657,_0xc44d8a);_0x395215(_0xc44d8a);});});}exports['CreateWhatsappMessage']=function(_0x19f490){var _0xdd45e9=this;return new Promise(function(_0x180cf8,_0x308013){return db['WhatsappMessage']['create'](_0x19f490[_0x63c2('0x1b')],{'raw':_0x19f490[_0x63c2('0x1c')]?_0x19f490[_0x63c2('0x1c')][_0x63c2('0x1d')]===undefined?!![]:![]:!![]})[_0x63c2('0x10')](function(_0x78e49c){logger[_0x63c2('0x11')]('CreateWhatsappMessage',_0x19f490);logger['debug'](_0x63c2('0x1e'),_0x19f490,JSON[_0x63c2('0x14')](_0x78e49c));_0x180cf8(_0x78e49c);})[_0x63c2('0x1a')](function(_0xc0e63d){logger[_0x63c2('0x15')](_0x63c2('0x1e'),_0xc0e63d[_0x63c2('0x17')],_0x19f490);_0x308013(_0xdd45e9[_0x63c2('0x15')](0x1f4,_0xc0e63d[_0x63c2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e1399fe..e294ea9 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 _0x7169=['./whatsappMessage.events','save','remove','update','emit','removeListener','register','length','whatsappMessage:'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x7169,0x17a));var _0x9716=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x7169[_0x494d1f];return _0x457b6e;};'use strict';var WhatsappMessageEvents=require(_0x9716('0x0'));var events=[_0x9716('0x1'),_0x9716('0x2'),_0x9716('0x3')];function createListener(_0x1d766a,_0x1d8c20){return function(_0x10fd0d){_0x1d8c20[_0x9716('0x4')](_0x1d766a,_0x10fd0d);};}function removeListener(_0xf44671,_0x12244d){return function(){WhatsappMessageEvents[_0x9716('0x5')](_0xf44671,_0x12244d);};}exports[_0x9716('0x6')]=function(_0x47340a){for(var _0x221bd5=0x0,_0x330ecb=events[_0x9716('0x7')];_0x221bd5<_0x330ecb;_0x221bd5++){var _0x352bd3=events[_0x221bd5];var _0x3a277a=createListener(_0x9716('0x8')+_0x352bd3,_0x47340a);WhatsappMessageEvents['on'](_0x352bd3,_0x3a277a);}}; \ No newline at end of file +var _0xc506=['save','remove','update','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x2aaf18,_0x4bb0cc){var _0x4bad1d=function(_0x7ec70c){while(--_0x7ec70c){_0x2aaf18['push'](_0x2aaf18['shift']());}};_0x4bad1d(++_0x4bb0cc);}(_0xc506,0x1bf));var _0x6c50=function(_0x30977b,_0x22be64){_0x30977b=_0x30977b-0x0;var _0x339a92=_0xc506[_0x30977b];return _0x339a92;};'use strict';var WhatsappMessageEvents=require(_0x6c50('0x0'));var events=[_0x6c50('0x1'),_0x6c50('0x2'),_0x6c50('0x3')];function createListener(_0x1fde1c,_0x549fc8){return function(_0x1e9e91){_0x549fc8[_0x6c50('0x4')](_0x1fde1c,_0x1e9e91);};}function removeListener(_0x5a60e3,_0x503b64){return function(){WhatsappMessageEvents[_0x6c50('0x5')](_0x5a60e3,_0x503b64);};}exports['register']=function(_0x2c9202){for(var _0x49f975=0x0,_0x2e269c=events[_0x6c50('0x6')];_0x49f975<_0x2e269c;_0x49f975++){var _0x38c0ef=events[_0x49f975];var _0x418029=createListener(_0x6c50('0x7')+_0x38c0ef,_0x2c9202);WhatsappMessageEvents['on'](_0x38c0ef,_0x418029);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index cf6f9c4..ab9ad76 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 _0xbdaf=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','connect-timeout','express'];(function(_0x4ab6a1,_0x4d64d5){var _0x2a24cc=function(_0x2625a0){while(--_0x2625a0){_0x4ab6a1['push'](_0x4ab6a1['shift']());}};_0x2a24cc(++_0x4d64d5);}(_0xbdaf,0x1ae));var _0xfbda=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xbdaf[_0x381589];return _0x2a075d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfbda('0x0'));var express=require(_0xfbda('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfbda('0x2'));var interaction=require(_0xfbda('0x3'));var config=require(_0xfbda('0x4'));var controller=require(_0xfbda('0x5'));router[_0xfbda('0x6')]('/',auth[_0xfbda('0x7')](),controller['index']);router['get'](_0xfbda('0x8'),auth[_0xfbda('0x7')](),controller[_0xfbda('0x9')]);router[_0xfbda('0x6')](_0xfbda('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfbda('0x6')]('/:id/members',auth[_0xfbda('0x7')](),controller[_0xfbda('0xb')]);router['get'](_0xfbda('0xc'),auth['isAuthenticated'](),controller[_0xfbda('0xd')]);router[_0xfbda('0x6')](_0xfbda('0xe'),auth[_0xfbda('0x7')](),controller[_0xfbda('0xf')]);router['post']('/',auth[_0xfbda('0x7')](),controller[_0xfbda('0x10')]);router[_0xfbda('0x11')](_0xfbda('0xc'),auth[_0xfbda('0x7')](),controller[_0xfbda('0x12')]);router[_0xfbda('0x11')](_0xfbda('0xe'),auth[_0xfbda('0x7')](),controller[_0xfbda('0x13')]);router[_0xfbda('0x14')](_0xfbda('0xa'),auth['isAuthenticated'](),controller[_0xfbda('0x15')]);router['delete']('/:id',auth[_0xfbda('0x7')](),controller[_0xfbda('0x16')]);router[_0xfbda('0x17')](_0xfbda('0xc'),auth[_0xfbda('0x7')](),controller[_0xfbda('0x18')]);router[_0xfbda('0x17')]('/:id/users',auth[_0xfbda('0x7')](),controller[_0xfbda('0x19')]);module[_0xfbda('0x1a')]=router; \ No newline at end of file +var _0x0913=['/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers'];(function(_0x582919,_0x2cd133){var _0x134da9=function(_0x991693){while(--_0x991693){_0x582919['push'](_0x582919['shift']());}};_0x134da9(++_0x2cd133);}(_0x0913,0x1a5));var _0x3091=function(_0x3b6f04,_0x78aed){_0x3b6f04=_0x3b6f04-0x0;var _0xf15ab2=_0x0913[_0x3b6f04];return _0xf15ab2;};'use strict';var multer=require(_0x3091('0x0'));var util=require(_0x3091('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3091('0x2'));var auth=require(_0x3091('0x3'));var interaction=require(_0x3091('0x4'));var config=require(_0x3091('0x5'));var controller=require('./whatsappQueue.controller');router[_0x3091('0x6')]('/',auth[_0x3091('0x7')](),controller[_0x3091('0x8')]);router[_0x3091('0x6')](_0x3091('0x9'),auth['isAuthenticated'](),controller[_0x3091('0xa')]);router[_0x3091('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x3091('0xb')]);router['get'](_0x3091('0xc'),auth[_0x3091('0x7')](),controller[_0x3091('0xd')]);router[_0x3091('0x6')](_0x3091('0xe'),auth[_0x3091('0x7')](),controller[_0x3091('0xf')]);router['get']('/:id/users',auth[_0x3091('0x7')](),controller[_0x3091('0x10')]);router['post']('/',auth[_0x3091('0x7')](),controller[_0x3091('0x11')]);router[_0x3091('0x12')](_0x3091('0xe'),auth[_0x3091('0x7')](),controller[_0x3091('0x13')]);router[_0x3091('0x12')](_0x3091('0x14'),auth[_0x3091('0x7')](),controller['addAgents']);router[_0x3091('0x15')](_0x3091('0x16'),auth[_0x3091('0x7')](),controller[_0x3091('0x17')]);router[_0x3091('0x18')]('/:id',auth[_0x3091('0x7')](),controller[_0x3091('0x19')]);router[_0x3091('0x18')](_0x3091('0xe'),auth[_0x3091('0x7')](),controller[_0x3091('0x1a')]);router[_0x3091('0x18')](_0x3091('0x14'),auth[_0x3091('0x7')](),controller[_0x3091('0x1b')]);module[_0x3091('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index e5c9f60..58eee87 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 _0xaa88=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x16d162,_0x48e5ad){var _0x3182fd=function(_0x4d7d37){while(--_0x4d7d37){_0x16d162['push'](_0x16d162['shift']());}};_0x3182fd(++_0x48e5ad);}(_0xaa88,0x137));var _0x8aa8=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xaa88[_0xb8cfbe];return _0x227d51;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')],'unique':_0x8aa8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8aa8('0x4')](_0x8aa8('0x5'),_0x8aa8('0x6'),_0x8aa8('0x7'))},'description':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file +var _0x1339=['rrmemory','beepall','roundrobin','STRING','name','INTEGER','ENUM'];(function(_0x4e62c9,_0x57ff00){var _0x2c32a5=function(_0x4932dd){while(--_0x4932dd){_0x4e62c9['push'](_0x4e62c9['shift']());}};_0x2c32a5(++_0x57ff00);}(_0x1339,0x1ed));var _0x9133=function(_0xbd757f,_0x22989d){_0xbd757f=_0xbd757f-0x0;var _0x375b02=_0x1339[_0xbd757f];return _0x375b02;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9133('0x0')],'unique':_0x9133('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9133('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9133('0x3')](_0x9133('0x4'),_0x9133('0x5'),_0x9133('0x6'))},'description':{'type':Sequelize[_0x9133('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8ccd0bf..782a204 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 _0xc90c=['value','isEmpty','removeAgents','addAgents','omit','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','nolimit','User','findAndCountAll','UserId','agent','updatedAt','createdAt','SIP','whatsappPause','getTeams','findOne','addTeams','ids','Team','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','every','TeamId','all','union','compact'];(function(_0x3064e7,_0x34edba){var _0x26038e=function(_0x35336c){while(--_0x35336c){_0x3064e7['push'](_0x3064e7['shift']());}};_0x26038e(++_0x34edba);}(_0xc90c,0x91));var _0xcc90=function(_0x1bb39e,_0x15650a){_0x1bb39e=_0x1bb39e-0x0;var _0x5486e2=_0xc90c[_0x1bb39e];return _0x5486e2;};'use strict';var emlformat=require(_0xcc90('0x0'));var rimraf=require(_0xcc90('0x1'));var zipdir=require(_0xcc90('0x2'));var jsonpatch=require(_0xcc90('0x3'));var rp=require(_0xcc90('0x4'));var moment=require(_0xcc90('0x5'));var BPromise=require(_0xcc90('0x6'));var Mustache=require(_0xcc90('0x7'));var util=require(_0xcc90('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcc90('0x9'));var fs=require('fs');var fs_extra=require(_0xcc90('0xa'));var _=require(_0xcc90('0xb'));var squel=require(_0xcc90('0xc'));var crypto=require(_0xcc90('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcc90('0xe'));var querystring=require('querystring');var Papa=require(_0xcc90('0xf'));var Redis=require(_0xcc90('0x10'));var authService=require(_0xcc90('0x11'));var qs=require(_0xcc90('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc90('0x13'));var logger=require(_0xcc90('0x14'))(_0xcc90('0x15'));var utils=require(_0xcc90('0x16'));var config=require(_0xcc90('0x17'));var licenseUtil=require(_0xcc90('0x18'));var db=require(_0xcc90('0x19'))['db'];config['redis']=_[_0xcc90('0x1a')](config[_0xcc90('0x1b')],{'host':_0xcc90('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc90('0x1b')]));require(_0xcc90('0x1d'))[_0xcc90('0x1e')](socket);function respondWithStatusCode(_0x286cbe,_0x4112ed){_0x4112ed=_0x4112ed||0xcc;return function(_0x395e4e){if(_0x395e4e){return _0x286cbe[_0xcc90('0x1f')](_0x4112ed);}return _0x286cbe[_0xcc90('0x20')](_0x4112ed)[_0xcc90('0x21')]();};}function respondWithResult(_0x56933d,_0xc7e0d9){_0xc7e0d9=_0xc7e0d9||0xc8;return function(_0x141e2e){if(_0x141e2e){return _0x56933d[_0xcc90('0x20')](_0xc7e0d9)[_0xcc90('0x22')](_0x141e2e);}};}function respondWithFilteredResult(_0xba9942,_0x1a24f6){return function(_0x406483){if(_0x406483){var _0x1e35f4=typeof _0x1a24f6[_0xcc90('0x23')]===_0xcc90('0x24')&&typeof _0x1a24f6[_0xcc90('0x25')]===_0xcc90('0x24');var _0x49f206=_0x406483[_0xcc90('0x26')];var _0x461344=_0x1e35f4?0x0:_0x1a24f6['offset'];var _0x428c7c=_0x1e35f4?_0x406483[_0xcc90('0x26')]:_0x1a24f6[_0xcc90('0x23')]+_0x1a24f6[_0xcc90('0x25')];var _0x14827e;if(_0x428c7c>=_0x49f206){_0x428c7c=_0x49f206;_0x14827e=0xc8;}else{_0x14827e=0xce;}_0xba9942[_0xcc90('0x20')](_0x14827e);return _0xba9942['set'](_0xcc90('0x27'),_0x461344+'-'+_0x428c7c+'/'+_0x49f206)[_0xcc90('0x22')](_0x406483);}return null;};}function patchUpdates(_0x171591){return function(_0x94cb3a){try{jsonpatch[_0xcc90('0x28')](_0x94cb3a,_0x171591,!![]);}catch(_0xc41b01){return BPromise[_0xcc90('0x29')](_0xc41b01);}return _0x94cb3a['save']();};}function saveUpdates(_0x37a37d,_0x4058b8){return function(_0x489dc7){if(_0x489dc7){return _0x489dc7[_0xcc90('0x2a')](_0x37a37d)[_0xcc90('0x2b')](function(_0x221009){return _0x221009;});}return null;};}function removeEntity(_0x2d4a33,_0x35e892){return function(_0x4f1d19){if(_0x4f1d19){return _0x4f1d19[_0xcc90('0x2c')]()['then'](function(){var _0x2381d5=_0x4f1d19[_0xcc90('0x2d')]({'plain':!![]});var _0x3e639d='WhatsappQueues';return db[_0xcc90('0x2e')]['destroy']({'where':{'type':_0x3e639d,'resourceId':_0x2381d5['id']}})['then'](function(){return _0x4f1d19;});})[_0xcc90('0x2b')](function(){_0x2d4a33[_0xcc90('0x20')](0xcc)[_0xcc90('0x21')]();});}};}function handleEntityNotFound(_0x4a1990,_0x2079ef){return function(_0x51936f){if(!_0x51936f){_0x4a1990[_0xcc90('0x1f')](0x194);}return _0x51936f;};}function handleError(_0x7de885,_0x2f2685){_0x2f2685=_0x2f2685||0x1f4;return function(_0x3b7b0b){logger[_0xcc90('0x2f')](_0x3b7b0b['stack']);if(_0x3b7b0b[_0xcc90('0x30')]){delete _0x3b7b0b[_0xcc90('0x30')];}_0x7de885[_0xcc90('0x20')](_0x2f2685)[_0xcc90('0x31')](_0x3b7b0b);};}exports[_0xcc90('0x32')]=function(_0xa5857a,_0x31d3d0){var _0x3326b1={},_0xb4c0e7={},_0x26533b={'count':0x0,'rows':[]};var _0x40a097=_[_0xcc90('0x33')](db[_0xcc90('0x34')][_0xcc90('0x35')],function(_0x3776e3){return{'name':_0x3776e3[_0xcc90('0x36')],'type':_0x3776e3[_0xcc90('0x37')]['key']};});_0xb4c0e7['model']=_['map'](_0x40a097,_0xcc90('0x30'));_0xb4c0e7['query']=_[_0xcc90('0x38')](_0xa5857a[_0xcc90('0x39')]);_0xb4c0e7[_0xcc90('0x3a')]=_['intersection'](_0xb4c0e7[_0xcc90('0x3b')],_0xb4c0e7[_0xcc90('0x39')]);_0x3326b1['attributes']=_[_0xcc90('0x3c')](_0xb4c0e7[_0xcc90('0x3b')],qs['fields'](_0xa5857a['query'][_0xcc90('0x3d')]));_0x3326b1['attributes']=_0x3326b1[_0xcc90('0x3e')][_0xcc90('0x3f')]?_0x3326b1[_0xcc90('0x3e')]:_0xb4c0e7[_0xcc90('0x3b')];if(!_0xa5857a[_0xcc90('0x39')][_0xcc90('0x40')]('nolimit')){_0x3326b1[_0xcc90('0x25')]=qs['limit'](_0xa5857a[_0xcc90('0x39')][_0xcc90('0x25')]);_0x3326b1[_0xcc90('0x23')]=qs[_0xcc90('0x23')](_0xa5857a['query'][_0xcc90('0x23')]);}_0x3326b1[_0xcc90('0x41')]=qs[_0xcc90('0x42')](_0xa5857a['query']['sort']);_0x3326b1[_0xcc90('0x43')]=qs[_0xcc90('0x3a')](_[_0xcc90('0x44')](_0xa5857a[_0xcc90('0x39')],_0xb4c0e7[_0xcc90('0x3a')]),_0x40a097);if(_0xa5857a['query'][_0xcc90('0x45')]){_0x3326b1[_0xcc90('0x43')]=_[_0xcc90('0x46')](_0x3326b1[_0xcc90('0x43')],{'$or':_[_0xcc90('0x33')](_0x40a097,function(_0x28f996){if(_0x28f996[_0xcc90('0x37')]!==_0xcc90('0x47')){var _0x3b9c08={};_0x3b9c08[_0x28f996[_0xcc90('0x30')]]={'$like':'%'+_0xa5857a[_0xcc90('0x39')]['filter']+'%'};return _0x3b9c08;}})});}_0x3326b1=_[_0xcc90('0x46')]({},_0x3326b1,_0xa5857a[_0xcc90('0x48')]);var _0x267e6d={'where':_0x3326b1[_0xcc90('0x43')]};return db['WhatsappQueue'][_0xcc90('0x26')](_0x267e6d)[_0xcc90('0x2b')](function(_0x8ff44e){_0x26533b[_0xcc90('0x26')]=_0x8ff44e;if(_0xa5857a['query']['includeAll']){_0x3326b1[_0xcc90('0x49')]=[{'all':!![]}];}return db[_0xcc90('0x34')][_0xcc90('0x4a')](_0x3326b1);})[_0xcc90('0x2b')](function(_0xb8e851){_0x26533b[_0xcc90('0x4b')]=_0xb8e851;return _0x26533b;})[_0xcc90('0x2b')](respondWithFilteredResult(_0x31d3d0,_0x3326b1))['catch'](handleError(_0x31d3d0,null));};exports[_0xcc90('0x4c')]=function(_0x573e32,_0x5e5ccf){var _0x4ec619={'raw':!![],'where':{'id':_0x573e32[_0xcc90('0x4d')]['id']}},_0xd72971={};_0xd72971[_0xcc90('0x3b')]=_[_0xcc90('0x38')](db[_0xcc90('0x34')]['rawAttributes']);_0xd72971[_0xcc90('0x39')]=_['keys'](_0x573e32[_0xcc90('0x39')]);_0xd72971[_0xcc90('0x3a')]=_[_0xcc90('0x3c')](_0xd72971[_0xcc90('0x3b')],_0xd72971[_0xcc90('0x39')]);_0x4ec619[_0xcc90('0x3e')]=_['intersection'](_0xd72971[_0xcc90('0x3b')],qs['fields'](_0x573e32[_0xcc90('0x39')][_0xcc90('0x3d')]));_0x4ec619[_0xcc90('0x3e')]=_0x4ec619[_0xcc90('0x3e')]['length']?_0x4ec619[_0xcc90('0x3e')]:_0xd72971[_0xcc90('0x3b')];if(_0x573e32[_0xcc90('0x39')]['includeAll']){_0x4ec619[_0xcc90('0x49')]=[{'all':!![]}];}_0x4ec619=_['merge']({},_0x4ec619,_0x573e32[_0xcc90('0x48')]);return db[_0xcc90('0x34')][_0xcc90('0x4e')](_0x4ec619)['then'](handleEntityNotFound(_0x5e5ccf,null))[_0xcc90('0x2b')](respondWithResult(_0x5e5ccf,null))[_0xcc90('0x4f')](handleError(_0x5e5ccf,null));};exports[_0xcc90('0x50')]=function(_0x3a9e66,_0x456a76){return db[_0xcc90('0x34')][_0xcc90('0x50')](_0x3a9e66[_0xcc90('0x51')],{})[_0xcc90('0x2b')](function(_0x2827d3){var _0x47e723=_0x3a9e66[_0xcc90('0x52')][_0xcc90('0x2d')]({'plain':!![]});if(!_0x47e723)throw new Error(_0xcc90('0x53'));if(_0x47e723[_0xcc90('0x54')]==='user'){var _0x9ecdd9=_0x2827d3['get']({'plain':!![]});var _0x5e6bf5='WhatsappQueues';return db[_0xcc90('0x55')]['find']({'where':{'name':_0x5e6bf5,'userProfileId':_0x47e723[_0xcc90('0x56')]},'raw':!![]})['then'](function(_0x457c1b){if(_0x457c1b&&_0x457c1b['autoAssociation']===0x0){return db[_0xcc90('0x2e')][_0xcc90('0x50')]({'name':_0x9ecdd9[_0xcc90('0x30')],'resourceId':_0x9ecdd9['id'],'type':_0x457c1b['name'],'sectionId':_0x457c1b['id']},{})[_0xcc90('0x2b')](function(){return _0x2827d3;});}else{return _0x2827d3;}})[_0xcc90('0x4f')](function(_0x5b936b){logger[_0xcc90('0x2f')](_0xcc90('0x57'),_0x5b936b);throw _0x5b936b;});}return _0x2827d3;})[_0xcc90('0x2b')](respondWithResult(_0x456a76,0xc9))['catch'](handleError(_0x456a76,null));};exports[_0xcc90('0x2a')]=function(_0x46a3dd,_0x1c28a8){if(_0x46a3dd[_0xcc90('0x51')]['id']){delete _0x46a3dd[_0xcc90('0x51')]['id'];}return db['WhatsappQueue'][_0xcc90('0x4e')]({'where':{'id':_0x46a3dd[_0xcc90('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c28a8,null))[_0xcc90('0x2b')](saveUpdates(_0x46a3dd['body'],null))[_0xcc90('0x2b')](respondWithResult(_0x1c28a8,null))['catch'](handleError(_0x1c28a8,null));};exports[_0xcc90('0x2c')]=function(_0x16fbfd,_0x1a1830){return db[_0xcc90('0x34')][_0xcc90('0x4e')]({'where':{'id':_0x16fbfd[_0xcc90('0x4d')]['id']}})[_0xcc90('0x2b')](handleEntityNotFound(_0x1a1830,null))[_0xcc90('0x2b')](removeEntity(_0x1a1830,null))[_0xcc90('0x4f')](handleError(_0x1a1830,null));};exports[_0xcc90('0x58')]=function(_0x3673cd,_0x225d3b){return db[_0xcc90('0x34')][_0xcc90('0x58')]()[_0xcc90('0x2b')](respondWithResult(_0x225d3b,null))[_0xcc90('0x4f')](handleError(_0x225d3b,null));};exports[_0xcc90('0x59')]=function(_0x5f4d7a,_0x2fc445,_0x1652b4){var _0x3dd87d={'raw':!![],'where':{}},_0x5f3742={},_0x466cd5;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5f4d7a['params']['id']}})[_0xcc90('0x2b')](handleEntityNotFound(_0x2fc445,null))[_0xcc90('0x2b')](function(_0x51f585){if(_0x51f585){_0x466cd5=_0x51f585['get']({'plain':!![]});_0x5f3742[_0xcc90('0x3b')]=_['keys'](db[_0xcc90('0x5a')][_0xcc90('0x35')]);_0x5f3742[_0xcc90('0x39')]=_[_0xcc90('0x38')](_0x5f4d7a[_0xcc90('0x39')]);_0x5f3742[_0xcc90('0x3a')]=_[_0xcc90('0x3c')](_0x5f3742[_0xcc90('0x3b')],_0x5f3742[_0xcc90('0x39')]);_0x3dd87d[_0xcc90('0x3e')]=_[_0xcc90('0x3c')](_0x5f3742[_0xcc90('0x3b')],qs[_0xcc90('0x3d')](_0x5f4d7a[_0xcc90('0x39')][_0xcc90('0x3d')]));_0x3dd87d[_0xcc90('0x3e')]=_0x3dd87d[_0xcc90('0x3e')][_0xcc90('0x3f')]?_0x3dd87d[_0xcc90('0x3e')]:_0x5f3742[_0xcc90('0x3b')];if(!_0x5f4d7a['query'][_0xcc90('0x40')](_0xcc90('0x5b'))){_0x3dd87d[_0xcc90('0x25')]=qs[_0xcc90('0x25')](_0x5f4d7a[_0xcc90('0x39')]['limit']);_0x3dd87d[_0xcc90('0x23')]=qs['offset'](_0x5f4d7a[_0xcc90('0x39')][_0xcc90('0x23')]);}_0x3dd87d[_0xcc90('0x41')]=qs['sort'](_0x5f4d7a[_0xcc90('0x39')][_0xcc90('0x42')]);_0x3dd87d[_0xcc90('0x43')]=qs['filters'](_[_0xcc90('0x44')](_0x5f4d7a[_0xcc90('0x39')],_0x5f3742[_0xcc90('0x3a')]));_0x3dd87d[_0xcc90('0x43')]['WhatsappQueueId']=_0x51f585['id'];if(_0x5f4d7a[_0xcc90('0x39')][_0xcc90('0x45')]){_0x3dd87d[_0xcc90('0x43')]=_[_0xcc90('0x46')](_0x3dd87d[_0xcc90('0x43')],{'$or':_['map'](_0x3dd87d[_0xcc90('0x3e')],function(_0x159f5a){var _0x5b1fd9={};_0x5b1fd9[_0x159f5a]={'$like':'%'+_0x5f4d7a['query'][_0xcc90('0x45')]+'%'};return _0x5b1fd9;})});}_0x3dd87d=_[_0xcc90('0x46')]({},_0x3dd87d,_0x5f4d7a[_0xcc90('0x48')]);return db[_0xcc90('0x5a')][_0xcc90('0x4a')](_0x3dd87d);}})[_0xcc90('0x2b')](function(_0x1c7ced){if(_0x1c7ced){return db[_0xcc90('0x5c')][_0xcc90('0x5d')]({'where':{'id':_[_0xcc90('0x33')](_0x1c7ced,_0xcc90('0x5e')),'role':_0xcc90('0x5f')},'attributes':['id',_0xcc90('0x30'),'whatsappPause',_0xcc90('0x60'),_0xcc90('0x61')]});}})[_0xcc90('0x2b')](function(_0x1f96bd){if(_0x1f96bd){return{'count':_0x1f96bd[_0xcc90('0x26')],'rows':_['map'](_0x1f96bd[_0xcc90('0x4b')],function(_0x5f0175){return{'membername':_0x5f0175[_0xcc90('0x30')],'UserId':_0x5f0175['id'],'queue_name':_0x466cd5[_0xcc90('0x30')],'WhatsappQueueId':_0x466cd5['id'],'interface':util['format']('%s/%s',_0xcc90('0x62'),_0x5f0175[_0xcc90('0x30')]),'penalty':0x0,'paused':_0x5f0175[_0xcc90('0x63')],'createdAt':_0x5f0175['createdAt'],'updatedAt':_0x5f0175[_0xcc90('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2fc445,_0x3dd87d))['catch'](handleError(_0x2fc445,null));};exports[_0xcc90('0x64')]=function(_0x5bd3d5,_0x165485,_0xc8096b){var _0x275b9c={};var _0x1b3caf={};var _0x7c5b8a;var _0x14e739;return db[_0xcc90('0x34')][_0xcc90('0x65')]({'where':{'id':_0x5bd3d5['params']['id']}})[_0xcc90('0x2b')](handleEntityNotFound(_0x165485,null))[_0xcc90('0x2b')](function(_0x2860b0){if(_0x2860b0){_0x7c5b8a=_0x2860b0;_0x1b3caf[_0xcc90('0x3b')]=_[_0xcc90('0x38')](db['Team'][_0xcc90('0x35')]);_0x1b3caf[_0xcc90('0x39')]=_[_0xcc90('0x38')](_0x5bd3d5[_0xcc90('0x39')]);_0x1b3caf[_0xcc90('0x3a')]=_[_0xcc90('0x3c')](_0x1b3caf[_0xcc90('0x3b')],_0x1b3caf[_0xcc90('0x39')]);_0x275b9c['attributes']=_[_0xcc90('0x3c')](_0x1b3caf['model'],qs['fields'](_0x5bd3d5['query'][_0xcc90('0x3d')]));_0x275b9c[_0xcc90('0x3e')]=_0x275b9c[_0xcc90('0x3e')][_0xcc90('0x3f')]?_0x275b9c[_0xcc90('0x3e')]:_0x1b3caf[_0xcc90('0x3b')];_0x275b9c['order']=qs[_0xcc90('0x42')](_0x5bd3d5[_0xcc90('0x39')][_0xcc90('0x42')]);_0x275b9c[_0xcc90('0x43')]=qs[_0xcc90('0x3a')](_[_0xcc90('0x44')](_0x5bd3d5[_0xcc90('0x39')],_0x1b3caf['filters']));if(_0x5bd3d5[_0xcc90('0x39')][_0xcc90('0x45')]){_0x275b9c[_0xcc90('0x43')]=_[_0xcc90('0x46')](_0x275b9c[_0xcc90('0x43')],{'$or':_['map'](_0x275b9c['attributes'],function(_0x106948){var _0x493391={};_0x493391[_0x106948]={'$like':'%'+_0x5bd3d5['query'][_0xcc90('0x45')]+'%'};return _0x493391;})});}_0x275b9c=_[_0xcc90('0x46')]({},_0x275b9c,_0x5bd3d5['options']);return _0x7c5b8a[_0xcc90('0x64')](_0x275b9c);}})['then'](function(_0x39e486){if(_0x39e486){_0x14e739=_0x39e486[_0xcc90('0x3f')];if(!_0x5bd3d5[_0xcc90('0x39')][_0xcc90('0x40')](_0xcc90('0x5b'))){_0x275b9c[_0xcc90('0x25')]=qs['limit'](_0x5bd3d5['query'][_0xcc90('0x25')]);_0x275b9c[_0xcc90('0x23')]=qs['offset'](_0x5bd3d5[_0xcc90('0x39')][_0xcc90('0x23')]);}return _0x7c5b8a[_0xcc90('0x64')](_0x275b9c);}})[_0xcc90('0x2b')](function(_0x1c4a49){if(_0x1c4a49){return _0x1c4a49?{'count':_0x14e739,'rows':_0x1c4a49}:null;}})[_0xcc90('0x2b')](respondWithResult(_0x165485,null))['catch'](handleError(_0x165485,null));};exports[_0xcc90('0x66')]=function(_0x49cd05,_0x430bb6,_0x38c539){var _0x5ca926=_0x49cd05['body'][_0xcc90('0x67')];return db[_0xcc90('0x68')]['findAll']({'where':{'id':_0x5ca926},'attributes':['id'],'include':[{'model':db[_0xcc90('0x5c')],'as':'Agents','attributes':['id','name',_0xcc90('0x69'),_0xcc90('0x6a'),_0xcc90('0x6b')],'raw':!![]}]})[_0xcc90('0x2b')](function(_0x2032fe){if(_0x2032fe){var _0x5edd29=_['flatMap'](_0x2032fe,function(_0x504876){var _0x1479a9=_0x504876[_0xcc90('0x2d')]({'plain':!![]});return _0x1479a9[_0xcc90('0x6c')];});return db[_0xcc90('0x34')][_0xcc90('0x4e')]({'where':{'id':_0x49cd05[_0xcc90('0x4d')]['id']}})[_0xcc90('0x2b')](function(_0xb89c2f){return db[_0xcc90('0x6d')][_0xcc90('0x6e')](function(_0x47151c){return _0xb89c2f[_0xcc90('0x66')](_0x5ca926,{'transaction':_0x47151c})[_0xcc90('0x2b')](function(){return BPromise[_0xcc90('0x6f')](_0x5edd29,function(_0x3aa1a9){return db['UserWhatsappQueue'][_0xcc90('0x70')]({'where':{'UserId':_0x3aa1a9['id'],'WhatsappQueueId':_0x49cd05['params']['id']},'transaction':_0x47151c});});})[_0xcc90('0x2b')](function(){_0x5edd29['forEach'](function(_0x2b1d1b){socket[_0xcc90('0x71')](_0xcc90('0x72'),{'UserId':_0x2b1d1b['id'],'WhatsappQueueId':_0xb89c2f['id']});});});});});}})[_0xcc90('0x2b')](respondWithStatusCode(_0x430bb6,null))[_0xcc90('0x4f')](handleError(_0x430bb6,null));};exports[_0xcc90('0x73')]=function(_0xd0ab9d,_0x2285fb,_0x12e332){return db['Team'][_0xcc90('0x4a')]({'where':{'id':_0xd0ab9d[_0xcc90('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcc90('0x2b')](handleEntityNotFound(_0x2285fb,null))[_0xcc90('0x2b')](function(_0x221f6){var _0x5df994=_[_0xcc90('0x33')](_0x221f6,'id');var _0x45d605=[];var _0x572c55=[];var _0x10fde3=squel['select']();_0x10fde3[_0xcc90('0x74')](_0xcc90('0x75'))[_0xcc90('0x76')](_0xcc90('0x77'),'tq')[_0xcc90('0x78')](_0xcc90('0x79'),'ut',_0xcc90('0x7a'))[_0xcc90('0x43')]('WhatsappQueueId\x20=\x20?',_0xd0ab9d[_0xcc90('0x4d')]['id']);for(var _0x5835dd=0x0;_0x5835dd<_0x221f6['length'];_0x5835dd+=0x1){let _0x2cc85b=_0x221f6[_0x5835dd];for(var _0x2b4b49=0x0;_0x2b4b49<_0x2cc85b[_0xcc90('0x6c')]['length'];_0x2b4b49+=0x1){let _0x25d54c=_0x2cc85b[_0xcc90('0x6c')][_0x2b4b49];var _0x3c79c7=_0x10fde3[_0xcc90('0x7b')]();_0x3c79c7[_0xcc90('0x43')]('ut.UserId\x20=\x20?',_0x25d54c['id']);_0x572c55[_0xcc90('0x7c')](db['sequelize'][_0xcc90('0x39')](_0x3c79c7[_0xcc90('0x7d')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xcc90('0x2b')](function(_0x9f4b77){if(_0x9f4b77[_0xcc90('0x3f')]===0x1){return _0x25d54c['id'];}else{var _0x4eb32b=_[_0xcc90('0x7e')](_[_0xcc90('0x33')](_0x9f4b77,_0xcc90('0x7f')),function(_0x1389ff){return _['includes'](_0x5df994,_0x1389ff);});if(_0x4eb32b){return _0x25d54c['id'];}}}));}}return BPromise[_0xcc90('0x80')](_0x572c55)[_0xcc90('0x2b')](function(_0x58cf3e){_0x45d605=_(_0x45d605)[_0xcc90('0x81')](_0x58cf3e)[_0xcc90('0x82')]()[_0xcc90('0x83')]();return db['WhatsappQueue'][_0xcc90('0x4e')]({'where':{'id':_0xd0ab9d[_0xcc90('0x4d')]['id']}})[_0xcc90('0x2b')](function(_0x514e1f){return db[_0xcc90('0x6d')]['transaction'](function(_0x28bbdd){return _0x514e1f[_0xcc90('0x73')](_0xd0ab9d[_0xcc90('0x39')][_0xcc90('0x67')],{'transaction':_0x28bbdd})['then'](function(){if(!_[_0xcc90('0x84')](_0x45d605)){return _0x514e1f[_0xcc90('0x85')](_0x45d605,{'transaction':_0x28bbdd});}})['then'](function(){_0x45d605['forEach'](function(_0x517c1d){socket[_0xcc90('0x71')]('userWhatsappQueue:remove',{'UserId':_0x517c1d,'WhatsappQueueId':_0x514e1f['id']});});});});});});})['then'](respondWithStatusCode(_0x2285fb,null))['catch'](handleError(_0x2285fb,null));};exports['addAgents']=function(_0x48df79,_0x2787db,_0x24e46f){return db[_0xcc90('0x34')][_0xcc90('0x4e')]({'where':{'id':_0x48df79['params']['id']}})[_0xcc90('0x2b')](handleEntityNotFound(_0x2787db,null))[_0xcc90('0x2b')](function(_0xf23ee){if(_0xf23ee){return _0xf23ee[_0xcc90('0x86')](_0x48df79['body']['ids'],_[_0xcc90('0x87')](_0x48df79[_0xcc90('0x51')],['ids','id'])||{})['spread'](function(_0x4d7c09){for(var _0x37edf7=0x0;_0x37edf7<_0x48df79[_0xcc90('0x51')]['ids']['length'];_0x37edf7+=0x1){socket[_0xcc90('0x71')](_0xcc90('0x72'),{'UserId':Number(_0x48df79[_0xcc90('0x51')][_0xcc90('0x67')][_0x37edf7]),'WhatsappQueueId':Number(_0x48df79[_0xcc90('0x4d')]['id'])});}return _0x4d7c09;});}})['then'](respondWithResult(_0x2787db,null))[_0xcc90('0x4f')](handleError(_0x2787db,null));};exports['removeAgents']=function(_0x4626d4,_0x5f2c79,_0x3423e2){return db[_0xcc90('0x34')][_0xcc90('0x4e')]({'where':{'id':_0x4626d4[_0xcc90('0x4d')]['id']}})[_0xcc90('0x2b')](handleEntityNotFound(_0x5f2c79,null))['then'](function(_0x908469){if(_0x908469){return _0x908469[_0xcc90('0x85')](_0x4626d4[_0xcc90('0x39')]['ids'])[_0xcc90('0x2b')](function(){if(_['isArray'](_0x4626d4[_0xcc90('0x39')]['ids'])){for(var _0x5baad2=0x0;_0x5baad2<_0x4626d4[_0xcc90('0x39')][_0xcc90('0x67')][_0xcc90('0x3f')];_0x5baad2+=0x1){socket[_0xcc90('0x71')](_0xcc90('0x88'),{'UserId':Number(_0x4626d4[_0xcc90('0x39')][_0xcc90('0x67')][_0x5baad2]),'WhatsappQueueId':Number(_0x4626d4[_0xcc90('0x4d')]['id'])});}}else{socket[_0xcc90('0x71')](_0xcc90('0x88'),{'UserId':Number(_0x4626d4[_0xcc90('0x39')][_0xcc90('0x67')]),'WhatsappQueueId':Number(_0x4626d4[_0xcc90('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5f2c79,null))[_0xcc90('0x4f')](handleError(_0x5f2c79,null));};exports[_0xcc90('0x89')]=function(_0x430a4f,_0xe634ea,_0x449ebc){var _0x1d94a5={};var _0xc8e830={};var _0x20606e;var _0x1c9bf5;return db[_0xcc90('0x34')]['findOne']({'where':{'id':_0x430a4f['params']['id']}})['then'](handleEntityNotFound(_0xe634ea,null))[_0xcc90('0x2b')](function(_0x1a2411){if(_0x1a2411){_0x20606e=_0x1a2411;_0xc8e830[_0xcc90('0x3b')]=_[_0xcc90('0x38')](db['User'][_0xcc90('0x35')]);_0xc8e830[_0xcc90('0x39')]=_[_0xcc90('0x38')](_0x430a4f[_0xcc90('0x39')]);_0xc8e830[_0xcc90('0x3a')]=_['intersection'](_0xc8e830['model'],_0xc8e830[_0xcc90('0x39')]);_0x1d94a5[_0xcc90('0x3e')]=_[_0xcc90('0x3c')](_0xc8e830[_0xcc90('0x3b')],qs[_0xcc90('0x3d')](_0x430a4f['query'][_0xcc90('0x3d')]));_0x1d94a5[_0xcc90('0x3e')]=_0x1d94a5[_0xcc90('0x3e')]['length']?_0x1d94a5[_0xcc90('0x3e')]:_0xc8e830[_0xcc90('0x3b')];_0x1d94a5[_0xcc90('0x41')]=qs['sort'](_0x430a4f['query']['sort']);_0x1d94a5[_0xcc90('0x43')]=qs[_0xcc90('0x3a')](_[_0xcc90('0x44')](_0x430a4f['query'],_0xc8e830[_0xcc90('0x3a')]));if(_0x430a4f[_0xcc90('0x39')][_0xcc90('0x45')]){_0x1d94a5[_0xcc90('0x43')]=_['merge'](_0x1d94a5['where'],{'$or':_[_0xcc90('0x33')](_0x1d94a5[_0xcc90('0x3e')],function(_0x957d3d){var _0x1a3689={};_0x1a3689[_0x957d3d]={'$like':'%'+_0x430a4f[_0xcc90('0x39')]['filter']+'%'};return _0x1a3689;})});}_0x1d94a5=_['merge']({},_0x1d94a5,_0x430a4f['options']);return _0x20606e[_0xcc90('0x89')](_0x1d94a5);}})[_0xcc90('0x2b')](function(_0x385ea0){if(_0x385ea0){_0x1c9bf5=_0x385ea0[_0xcc90('0x3f')];if(!_0x430a4f[_0xcc90('0x39')][_0xcc90('0x40')](_0xcc90('0x5b'))){_0x1d94a5['limit']=qs[_0xcc90('0x25')](_0x430a4f[_0xcc90('0x39')][_0xcc90('0x25')]);_0x1d94a5[_0xcc90('0x23')]=qs['offset'](_0x430a4f[_0xcc90('0x39')]['offset']);}return _0x20606e[_0xcc90('0x89')](_0x1d94a5);}})[_0xcc90('0x2b')](function(_0x23afc){if(_0x23afc){return _0x23afc?{'count':_0x1c9bf5,'rows':_0x23afc}:null;}})[_0xcc90('0x2b')](respondWithResult(_0xe634ea,null))[_0xcc90('0x4f')](handleError(_0xe634ea,null));}; \ No newline at end of file +var _0x572f=['sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','map','WhatsappQueue','rawAttributes','type','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','userProfileId','autoAssociation','describe','getMembers','UserWhatsappQueue','order','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','user_has_teams','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','isEmpty','emit','omit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x2a60b7,_0x1ed3eb){var _0x445ed4=function(_0x1d8a81){while(--_0x1d8a81){_0x2a60b7['push'](_0x2a60b7['shift']());}};_0x445ed4(++_0x1ed3eb);}(_0x572f,0x18d));var _0xf572=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x572f[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xf572('0x0'));var rimraf=require(_0xf572('0x1'));var zipdir=require(_0xf572('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf572('0x3'));var BPromise=require(_0xf572('0x4'));var Mustache=require(_0xf572('0x5'));var util=require(_0xf572('0x6'));var path=require(_0xf572('0x7'));var sox=require(_0xf572('0x8'));var csv=require('to-csv');var ejs=require(_0xf572('0x9'));var fs=require('fs');var fs_extra=require(_0xf572('0xa'));var _=require(_0xf572('0xb'));var squel=require('squel');var crypto=require(_0xf572('0xc'));var jsforce=require(_0xf572('0xd'));var deskjs=require(_0xf572('0xe'));var toCsv=require(_0xf572('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf572('0x10'));var authService=require(_0xf572('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf572('0x12'));var hardwareService=require(_0xf572('0x13'));var logger=require(_0xf572('0x14'))(_0xf572('0x15'));var utils=require(_0xf572('0x16'));var config=require(_0xf572('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf572('0x18'))['db'];config[_0xf572('0x19')]=_['defaults'](config[_0xf572('0x19')],{'host':_0xf572('0x1a'),'port':0x18eb});var socket=require(_0xf572('0x1b'))(new Redis(config[_0xf572('0x19')]));require(_0xf572('0x1c'))[_0xf572('0x1d')](socket);function respondWithStatusCode(_0x185928,_0x43bec4){_0x43bec4=_0x43bec4||0xcc;return function(_0x2ea954){if(_0x2ea954){return _0x185928[_0xf572('0x1e')](_0x43bec4);}return _0x185928[_0xf572('0x1f')](_0x43bec4)[_0xf572('0x20')]();};}function respondWithResult(_0x4dc750,_0x1bae3b){_0x1bae3b=_0x1bae3b||0xc8;return function(_0xcca41f){if(_0xcca41f){return _0x4dc750['status'](_0x1bae3b)[_0xf572('0x21')](_0xcca41f);}};}function respondWithFilteredResult(_0x48611b,_0x12ecac){return function(_0x23ab59){if(_0x23ab59){var _0x174b1=typeof _0x12ecac[_0xf572('0x22')]===_0xf572('0x23')&&typeof _0x12ecac[_0xf572('0x24')]===_0xf572('0x23');var _0x28f478=_0x23ab59['count'];var _0x2d14b4=_0x174b1?0x0:_0x12ecac['offset'];var _0x15c68=_0x174b1?_0x23ab59[_0xf572('0x25')]:_0x12ecac[_0xf572('0x22')]+_0x12ecac['limit'];var _0x101a50;if(_0x15c68>=_0x28f478){_0x15c68=_0x28f478;_0x101a50=0xc8;}else{_0x101a50=0xce;}_0x48611b['status'](_0x101a50);return _0x48611b[_0xf572('0x26')](_0xf572('0x27'),_0x2d14b4+'-'+_0x15c68+'/'+_0x28f478)[_0xf572('0x21')](_0x23ab59);}return null;};}function patchUpdates(_0x4051b4){return function(_0x15b75d){try{jsonpatch[_0xf572('0x28')](_0x15b75d,_0x4051b4,!![]);}catch(_0x2fa319){return BPromise[_0xf572('0x29')](_0x2fa319);}return _0x15b75d['save']();};}function saveUpdates(_0x40d8a2,_0x1b1bc4){return function(_0x333611){if(_0x333611){return _0x333611[_0xf572('0x2a')](_0x40d8a2)[_0xf572('0x2b')](function(_0xbfec8d){return _0xbfec8d;});}return null;};}function removeEntity(_0x1d2d06,_0x647f3f){return function(_0x433bca){if(_0x433bca){return _0x433bca['destroy']()[_0xf572('0x2b')](function(){var _0x296816=_0x433bca[_0xf572('0x2c')]({'plain':!![]});var _0x2cf571=_0xf572('0x2d');return db[_0xf572('0x2e')][_0xf572('0x2f')]({'where':{'type':_0x2cf571,'resourceId':_0x296816['id']}})[_0xf572('0x2b')](function(){return _0x433bca;});})['then'](function(){_0x1d2d06['status'](0xcc)[_0xf572('0x20')]();});}};}function handleEntityNotFound(_0x33ac96,_0x562be0){return function(_0x5b8059){if(!_0x5b8059){_0x33ac96['sendStatus'](0x194);}return _0x5b8059;};}function handleError(_0x445eb4,_0x56b99a){_0x56b99a=_0x56b99a||0x1f4;return function(_0x412d64){logger[_0xf572('0x30')](_0x412d64[_0xf572('0x31')]);if(_0x412d64[_0xf572('0x32')]){delete _0x412d64[_0xf572('0x32')];}_0x445eb4[_0xf572('0x1f')](_0x56b99a)[_0xf572('0x33')](_0x412d64);};}exports['index']=function(_0x523808,_0x3541d2){var _0x24db07={},_0xb4f491={},_0x476dfc={'count':0x0,'rows':[]};var _0x4f445a=_[_0xf572('0x34')](db[_0xf572('0x35')][_0xf572('0x36')],function(_0x339854){return{'name':_0x339854['fieldName'],'type':_0x339854[_0xf572('0x37')]['key']};});_0xb4f491['model']=_['map'](_0x4f445a,_0xf572('0x32'));_0xb4f491['query']=_[_0xf572('0x38')](_0x523808[_0xf572('0x39')]);_0xb4f491['filters']=_['intersection'](_0xb4f491['model'],_0xb4f491[_0xf572('0x39')]);_0x24db07[_0xf572('0x3a')]=_[_0xf572('0x3b')](_0xb4f491[_0xf572('0x3c')],qs[_0xf572('0x3d')](_0x523808[_0xf572('0x39')]['fields']));_0x24db07[_0xf572('0x3a')]=_0x24db07[_0xf572('0x3a')][_0xf572('0x3e')]?_0x24db07[_0xf572('0x3a')]:_0xb4f491[_0xf572('0x3c')];if(!_0x523808[_0xf572('0x39')][_0xf572('0x3f')](_0xf572('0x40'))){_0x24db07[_0xf572('0x24')]=qs[_0xf572('0x24')](_0x523808[_0xf572('0x39')][_0xf572('0x24')]);_0x24db07[_0xf572('0x22')]=qs[_0xf572('0x22')](_0x523808[_0xf572('0x39')][_0xf572('0x22')]);}_0x24db07['order']=qs[_0xf572('0x41')](_0x523808[_0xf572('0x39')]['sort']);_0x24db07[_0xf572('0x42')]=qs[_0xf572('0x43')](_[_0xf572('0x44')](_0x523808['query'],_0xb4f491[_0xf572('0x43')]),_0x4f445a);if(_0x523808[_0xf572('0x39')][_0xf572('0x45')]){_0x24db07[_0xf572('0x42')]=_['merge'](_0x24db07[_0xf572('0x42')],{'$or':_['map'](_0x4f445a,function(_0x44cc47){if(_0x44cc47[_0xf572('0x37')]!==_0xf572('0x46')){var _0x1d39b1={};_0x1d39b1[_0x44cc47[_0xf572('0x32')]]={'$like':'%'+_0x523808[_0xf572('0x39')][_0xf572('0x45')]+'%'};return _0x1d39b1;}})});}_0x24db07=_[_0xf572('0x47')]({},_0x24db07,_0x523808[_0xf572('0x48')]);var _0x1afb13={'where':_0x24db07[_0xf572('0x42')]};return db[_0xf572('0x35')]['count'](_0x1afb13)[_0xf572('0x2b')](function(_0x5413d6){_0x476dfc[_0xf572('0x25')]=_0x5413d6;if(_0x523808[_0xf572('0x39')]['includeAll']){_0x24db07[_0xf572('0x49')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xf572('0x4a')](_0x24db07);})[_0xf572('0x2b')](function(_0x1ea606){_0x476dfc[_0xf572('0x4b')]=_0x1ea606;return _0x476dfc;})[_0xf572('0x2b')](respondWithFilteredResult(_0x3541d2,_0x24db07))[_0xf572('0x4c')](handleError(_0x3541d2,null));};exports[_0xf572('0x4d')]=function(_0x44c9e8,_0x56dc15){var _0x4442c2={'raw':!![],'where':{'id':_0x44c9e8[_0xf572('0x4e')]['id']}},_0x582cbb={};_0x582cbb['model']=_['keys'](db['WhatsappQueue'][_0xf572('0x36')]);_0x582cbb[_0xf572('0x39')]=_[_0xf572('0x38')](_0x44c9e8['query']);_0x582cbb[_0xf572('0x43')]=_[_0xf572('0x3b')](_0x582cbb['model'],_0x582cbb[_0xf572('0x39')]);_0x4442c2[_0xf572('0x3a')]=_['intersection'](_0x582cbb[_0xf572('0x3c')],qs[_0xf572('0x3d')](_0x44c9e8[_0xf572('0x39')]['fields']));_0x4442c2['attributes']=_0x4442c2[_0xf572('0x3a')][_0xf572('0x3e')]?_0x4442c2[_0xf572('0x3a')]:_0x582cbb[_0xf572('0x3c')];if(_0x44c9e8[_0xf572('0x39')][_0xf572('0x4f')]){_0x4442c2['include']=[{'all':!![]}];}_0x4442c2=_[_0xf572('0x47')]({},_0x4442c2,_0x44c9e8[_0xf572('0x48')]);return db[_0xf572('0x35')][_0xf572('0x50')](_0x4442c2)[_0xf572('0x2b')](handleEntityNotFound(_0x56dc15,null))['then'](respondWithResult(_0x56dc15,null))[_0xf572('0x4c')](handleError(_0x56dc15,null));};exports[_0xf572('0x51')]=function(_0x481c77,_0x2cdd08){return db[_0xf572('0x35')]['create'](_0x481c77[_0xf572('0x52')],{})[_0xf572('0x2b')](function(_0x5b62e1){var _0x36fff2=_0x481c77[_0xf572('0x53')][_0xf572('0x2c')]({'plain':!![]});if(!_0x36fff2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36fff2[_0xf572('0x54')]===_0xf572('0x53')){var _0x5db0ac=_0x5b62e1[_0xf572('0x2c')]({'plain':!![]});var _0x30fc17=_0xf572('0x2d');return db['UserProfileSection'][_0xf572('0x50')]({'where':{'name':_0x30fc17,'userProfileId':_0x36fff2[_0xf572('0x55')]},'raw':!![]})[_0xf572('0x2b')](function(_0xf0e1b7){if(_0xf0e1b7&&_0xf0e1b7[_0xf572('0x56')]===0x0){return db[_0xf572('0x2e')][_0xf572('0x51')]({'name':_0x5db0ac[_0xf572('0x32')],'resourceId':_0x5db0ac['id'],'type':_0xf0e1b7[_0xf572('0x32')],'sectionId':_0xf0e1b7['id']},{})[_0xf572('0x2b')](function(){return _0x5b62e1;});}else{return _0x5b62e1;}})[_0xf572('0x4c')](function(_0x1bf018){logger[_0xf572('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bf018);throw _0x1bf018;});}return _0x5b62e1;})[_0xf572('0x2b')](respondWithResult(_0x2cdd08,0xc9))[_0xf572('0x4c')](handleError(_0x2cdd08,null));};exports[_0xf572('0x2a')]=function(_0x10eed2,_0x5acb53){if(_0x10eed2[_0xf572('0x52')]['id']){delete _0x10eed2[_0xf572('0x52')]['id'];}return db[_0xf572('0x35')][_0xf572('0x50')]({'where':{'id':_0x10eed2[_0xf572('0x4e')]['id']}})[_0xf572('0x2b')](handleEntityNotFound(_0x5acb53,null))[_0xf572('0x2b')](saveUpdates(_0x10eed2[_0xf572('0x52')],null))[_0xf572('0x2b')](respondWithResult(_0x5acb53,null))['catch'](handleError(_0x5acb53,null));};exports[_0xf572('0x2f')]=function(_0x1667b8,_0x1436e2){return db[_0xf572('0x35')]['find']({'where':{'id':_0x1667b8[_0xf572('0x4e')]['id']}})[_0xf572('0x2b')](handleEntityNotFound(_0x1436e2,null))[_0xf572('0x2b')](removeEntity(_0x1436e2,null))['catch'](handleError(_0x1436e2,null));};exports['describe']=function(_0x44e458,_0x281f69){return db[_0xf572('0x35')][_0xf572('0x57')]()[_0xf572('0x2b')](respondWithResult(_0x281f69,null))[_0xf572('0x4c')](handleError(_0x281f69,null));};exports[_0xf572('0x58')]=function(_0x2927af,_0x1c9269,_0xe19a79){var _0x209a3e={'raw':!![],'where':{}},_0x33e8cc={},_0x4418a1;return db[_0xf572('0x35')]['findOne']({'where':{'id':_0x2927af[_0xf572('0x4e')]['id']}})[_0xf572('0x2b')](handleEntityNotFound(_0x1c9269,null))[_0xf572('0x2b')](function(_0x2c90d5){if(_0x2c90d5){_0x4418a1=_0x2c90d5[_0xf572('0x2c')]({'plain':!![]});_0x33e8cc[_0xf572('0x3c')]=_[_0xf572('0x38')](db[_0xf572('0x59')][_0xf572('0x36')]);_0x33e8cc[_0xf572('0x39')]=_[_0xf572('0x38')](_0x2927af[_0xf572('0x39')]);_0x33e8cc[_0xf572('0x43')]=_[_0xf572('0x3b')](_0x33e8cc['model'],_0x33e8cc[_0xf572('0x39')]);_0x209a3e[_0xf572('0x3a')]=_[_0xf572('0x3b')](_0x33e8cc[_0xf572('0x3c')],qs['fields'](_0x2927af[_0xf572('0x39')][_0xf572('0x3d')]));_0x209a3e['attributes']=_0x209a3e['attributes'][_0xf572('0x3e')]?_0x209a3e[_0xf572('0x3a')]:_0x33e8cc[_0xf572('0x3c')];if(!_0x2927af[_0xf572('0x39')]['hasOwnProperty'](_0xf572('0x40'))){_0x209a3e[_0xf572('0x24')]=qs[_0xf572('0x24')](_0x2927af[_0xf572('0x39')][_0xf572('0x24')]);_0x209a3e[_0xf572('0x22')]=qs[_0xf572('0x22')](_0x2927af['query'][_0xf572('0x22')]);}_0x209a3e[_0xf572('0x5a')]=qs[_0xf572('0x41')](_0x2927af[_0xf572('0x39')][_0xf572('0x41')]);_0x209a3e[_0xf572('0x42')]=qs['filters'](_[_0xf572('0x44')](_0x2927af[_0xf572('0x39')],_0x33e8cc[_0xf572('0x43')]));_0x209a3e[_0xf572('0x42')][_0xf572('0x5b')]=_0x2c90d5['id'];if(_0x2927af[_0xf572('0x39')][_0xf572('0x45')]){_0x209a3e[_0xf572('0x42')]=_['merge'](_0x209a3e[_0xf572('0x42')],{'$or':_[_0xf572('0x34')](_0x209a3e['attributes'],function(_0x3fe9ee){var _0x546d75={};_0x546d75[_0x3fe9ee]={'$like':'%'+_0x2927af[_0xf572('0x39')]['filter']+'%'};return _0x546d75;})});}_0x209a3e=_[_0xf572('0x47')]({},_0x209a3e,_0x2927af[_0xf572('0x48')]);return db[_0xf572('0x59')][_0xf572('0x4a')](_0x209a3e);}})[_0xf572('0x2b')](function(_0x2336c5){if(_0x2336c5){return db[_0xf572('0x5c')][_0xf572('0x5d')]({'where':{'id':_[_0xf572('0x34')](_0x2336c5,_0xf572('0x5e')),'role':'agent'},'attributes':['id',_0xf572('0x32'),_0xf572('0x5f'),'updatedAt',_0xf572('0x60')]});}})[_0xf572('0x2b')](function(_0x44fd39){if(_0x44fd39){return{'count':_0x44fd39[_0xf572('0x25')],'rows':_['map'](_0x44fd39[_0xf572('0x4b')],function(_0x13decd){return{'membername':_0x13decd['name'],'UserId':_0x13decd['id'],'queue_name':_0x4418a1['name'],'WhatsappQueueId':_0x4418a1['id'],'interface':util[_0xf572('0x61')](_0xf572('0x62'),_0xf572('0x63'),_0x13decd[_0xf572('0x32')]),'penalty':0x0,'paused':_0x13decd['whatsappPause'],'createdAt':_0x13decd['createdAt'],'updatedAt':_0x13decd[_0xf572('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf572('0x2b')](respondWithFilteredResult(_0x1c9269,_0x209a3e))[_0xf572('0x4c')](handleError(_0x1c9269,null));};exports[_0xf572('0x65')]=function(_0x2869e4,_0x5379d1,_0x4c6414){var _0x1547f5={};var _0x1eb795={};var _0x58e4b8;var _0x49990a;return db['WhatsappQueue'][_0xf572('0x66')]({'where':{'id':_0x2869e4[_0xf572('0x4e')]['id']}})[_0xf572('0x2b')](handleEntityNotFound(_0x5379d1,null))[_0xf572('0x2b')](function(_0x4378ca){if(_0x4378ca){_0x58e4b8=_0x4378ca;_0x1eb795[_0xf572('0x3c')]=_['keys'](db[_0xf572('0x67')][_0xf572('0x36')]);_0x1eb795[_0xf572('0x39')]=_[_0xf572('0x38')](_0x2869e4[_0xf572('0x39')]);_0x1eb795[_0xf572('0x43')]=_[_0xf572('0x3b')](_0x1eb795['model'],_0x1eb795[_0xf572('0x39')]);_0x1547f5[_0xf572('0x3a')]=_[_0xf572('0x3b')](_0x1eb795[_0xf572('0x3c')],qs[_0xf572('0x3d')](_0x2869e4[_0xf572('0x39')][_0xf572('0x3d')]));_0x1547f5[_0xf572('0x3a')]=_0x1547f5['attributes'][_0xf572('0x3e')]?_0x1547f5[_0xf572('0x3a')]:_0x1eb795[_0xf572('0x3c')];_0x1547f5[_0xf572('0x5a')]=qs['sort'](_0x2869e4['query']['sort']);_0x1547f5['where']=qs[_0xf572('0x43')](_[_0xf572('0x44')](_0x2869e4[_0xf572('0x39')],_0x1eb795['filters']));if(_0x2869e4[_0xf572('0x39')]['filter']){_0x1547f5[_0xf572('0x42')]=_[_0xf572('0x47')](_0x1547f5[_0xf572('0x42')],{'$or':_[_0xf572('0x34')](_0x1547f5[_0xf572('0x3a')],function(_0x22cc30){var _0xeff7ca={};_0xeff7ca[_0x22cc30]={'$like':'%'+_0x2869e4[_0xf572('0x39')][_0xf572('0x45')]+'%'};return _0xeff7ca;})});}_0x1547f5=_[_0xf572('0x47')]({},_0x1547f5,_0x2869e4[_0xf572('0x48')]);return _0x58e4b8['getTeams'](_0x1547f5);}})[_0xf572('0x2b')](function(_0x252e4f){if(_0x252e4f){_0x49990a=_0x252e4f['length'];if(!_0x2869e4[_0xf572('0x39')]['hasOwnProperty']('nolimit')){_0x1547f5[_0xf572('0x24')]=qs[_0xf572('0x24')](_0x2869e4[_0xf572('0x39')][_0xf572('0x24')]);_0x1547f5[_0xf572('0x22')]=qs[_0xf572('0x22')](_0x2869e4[_0xf572('0x39')]['offset']);}return _0x58e4b8['getTeams'](_0x1547f5);}})[_0xf572('0x2b')](function(_0x55fa89){if(_0x55fa89){return _0x55fa89?{'count':_0x49990a,'rows':_0x55fa89}:null;}})[_0xf572('0x2b')](respondWithResult(_0x5379d1,null))[_0xf572('0x4c')](handleError(_0x5379d1,null));};exports[_0xf572('0x68')]=function(_0x2b538f,_0x3af20b,_0xe390a2){var _0x2046bd=_0x2b538f['body'][_0xf572('0x69')];return db[_0xf572('0x67')]['findAll']({'where':{'id':_0x2046bd},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf572('0x6a'),'attributes':['id','name',_0xf572('0x6b'),_0xf572('0x6c'),_0xf572('0x6d')],'raw':!![]}]})[_0xf572('0x2b')](function(_0x783a9f){if(_0x783a9f){var _0x365aef=_[_0xf572('0x6e')](_0x783a9f,function(_0x1248a9){var _0x7a5b8b=_0x1248a9['get']({'plain':!![]});return _0x7a5b8b[_0xf572('0x6a')];});return db[_0xf572('0x35')][_0xf572('0x50')]({'where':{'id':_0x2b538f['params']['id']}})['then'](function(_0xf1ebae){return db['sequelize'][_0xf572('0x6f')](function(_0x3edfa0){return _0xf1ebae[_0xf572('0x68')](_0x2046bd,{'transaction':_0x3edfa0})[_0xf572('0x2b')](function(){return BPromise['each'](_0x365aef,function(_0xd513a2){return db['UserWhatsappQueue'][_0xf572('0x70')]({'where':{'UserId':_0xd513a2['id'],'WhatsappQueueId':_0x2b538f[_0xf572('0x4e')]['id']},'transaction':_0x3edfa0});});})[_0xf572('0x2b')](function(){_0x365aef[_0xf572('0x71')](function(_0x1c2d5b){socket['emit'](_0xf572('0x72'),{'UserId':_0x1c2d5b['id'],'WhatsappQueueId':_0xf1ebae['id']});});});});});}})['then'](respondWithStatusCode(_0x3af20b,null))[_0xf572('0x4c')](handleError(_0x3af20b,null));};exports[_0xf572('0x73')]=function(_0x5b34ca,_0x1095b2,_0x21082f){return db['Team'][_0xf572('0x4a')]({'where':{'id':_0x5b34ca[_0xf572('0x39')][_0xf572('0x69')]},'attributes':['id'],'include':[{'model':db[_0xf572('0x5c')],'as':_0xf572('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf572('0x2b')](handleEntityNotFound(_0x1095b2,null))[_0xf572('0x2b')](function(_0x38055f){var _0x14e8da=_[_0xf572('0x34')](_0x38055f,'id');var _0x5dd8af=[];var _0x32f621=[];var _0x56c445=squel[_0xf572('0x74')]();_0x56c445['field'](_0xf572('0x75'))[_0xf572('0x76')]('team_has_whatsapp_queues','tq')['join'](_0xf572('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf572('0x42')]('WhatsappQueueId\x20=\x20?',_0x5b34ca[_0xf572('0x4e')]['id']);for(var _0x2a33c0=0x0;_0x2a33c0<_0x38055f['length'];_0x2a33c0+=0x1){let _0x1f934c=_0x38055f[_0x2a33c0];for(var _0x17c6df=0x0;_0x17c6df<_0x1f934c[_0xf572('0x6a')][_0xf572('0x3e')];_0x17c6df+=0x1){let _0x2a509b=_0x1f934c['Agents'][_0x17c6df];var _0x33bf08=_0x56c445['clone']();_0x33bf08[_0xf572('0x42')](_0xf572('0x78'),_0x2a509b['id']);_0x32f621[_0xf572('0x79')](db[_0xf572('0x7a')]['query'](_0x33bf08[_0xf572('0x7b')](),{'type':db[_0xf572('0x7a')][_0xf572('0x7c')][_0xf572('0x7d')]})[_0xf572('0x2b')](function(_0xaec6e2){if(_0xaec6e2[_0xf572('0x3e')]===0x1){return _0x2a509b['id'];}else{var _0x5e03a3=_[_0xf572('0x7e')](_[_0xf572('0x34')](_0xaec6e2,_0xf572('0x7f')),function(_0x2440ea){return _['includes'](_0x14e8da,_0x2440ea);});if(_0x5e03a3){return _0x2a509b['id'];}}}));}}return BPromise['all'](_0x32f621)[_0xf572('0x2b')](function(_0x1bbfbe){_0x5dd8af=_(_0x5dd8af)['union'](_0x1bbfbe)['compact']()['value']();return db[_0xf572('0x35')][_0xf572('0x50')]({'where':{'id':_0x5b34ca['params']['id']}})['then'](function(_0x760ca1){return db[_0xf572('0x7a')][_0xf572('0x6f')](function(_0x58f763){return _0x760ca1['removeTeams'](_0x5b34ca[_0xf572('0x39')]['ids'],{'transaction':_0x58f763})['then'](function(){if(!_[_0xf572('0x80')](_0x5dd8af)){return _0x760ca1['removeAgents'](_0x5dd8af,{'transaction':_0x58f763});}})[_0xf572('0x2b')](function(){_0x5dd8af[_0xf572('0x71')](function(_0x3e2b06){socket[_0xf572('0x81')]('userWhatsappQueue:remove',{'UserId':_0x3e2b06,'WhatsappQueueId':_0x760ca1['id']});});});});});});})[_0xf572('0x2b')](respondWithStatusCode(_0x1095b2,null))[_0xf572('0x4c')](handleError(_0x1095b2,null));};exports['addAgents']=function(_0x13469f,_0x4ef629,_0x4e2077){return db[_0xf572('0x35')][_0xf572('0x50')]({'where':{'id':_0x13469f['params']['id']}})['then'](handleEntityNotFound(_0x4ef629,null))[_0xf572('0x2b')](function(_0x3714e4){if(_0x3714e4){return _0x3714e4['addAgents'](_0x13469f[_0xf572('0x52')][_0xf572('0x69')],_[_0xf572('0x82')](_0x13469f[_0xf572('0x52')],[_0xf572('0x69'),'id'])||{})['spread'](function(_0x261038){for(var _0xfc6229=0x0;_0xfc6229<_0x13469f[_0xf572('0x52')][_0xf572('0x69')]['length'];_0xfc6229+=0x1){socket['emit'](_0xf572('0x72'),{'UserId':Number(_0x13469f[_0xf572('0x52')][_0xf572('0x69')][_0xfc6229]),'WhatsappQueueId':Number(_0x13469f[_0xf572('0x4e')]['id'])});}return _0x261038;});}})[_0xf572('0x2b')](respondWithResult(_0x4ef629,null))[_0xf572('0x4c')](handleError(_0x4ef629,null));};exports[_0xf572('0x83')]=function(_0x3ac838,_0x2ca168,_0x3617a7){return db['WhatsappQueue'][_0xf572('0x50')]({'where':{'id':_0x3ac838['params']['id']}})[_0xf572('0x2b')](handleEntityNotFound(_0x2ca168,null))[_0xf572('0x2b')](function(_0x11cfd1){if(_0x11cfd1){return _0x11cfd1['removeAgents'](_0x3ac838[_0xf572('0x39')][_0xf572('0x69')])[_0xf572('0x2b')](function(){if(_[_0xf572('0x84')](_0x3ac838[_0xf572('0x39')][_0xf572('0x69')])){for(var _0x577662=0x0;_0x577662<_0x3ac838[_0xf572('0x39')]['ids'][_0xf572('0x3e')];_0x577662+=0x1){socket[_0xf572('0x81')]('userWhatsappQueue:remove',{'UserId':Number(_0x3ac838[_0xf572('0x39')]['ids'][_0x577662]),'WhatsappQueueId':Number(_0x3ac838[_0xf572('0x4e')]['id'])});}}else{socket['emit'](_0xf572('0x85'),{'UserId':Number(_0x3ac838[_0xf572('0x39')]['ids']),'WhatsappQueueId':Number(_0x3ac838['params']['id'])});}});}})[_0xf572('0x2b')](respondWithStatusCode(_0x2ca168,null))[_0xf572('0x4c')](handleError(_0x2ca168,null));};exports[_0xf572('0x86')]=function(_0x2b542d,_0x3d1d86,_0x5cb215){var _0x1c521b={};var _0x46c181={};var _0x33e0bc;var _0x526c2e;return db[_0xf572('0x35')][_0xf572('0x66')]({'where':{'id':_0x2b542d['params']['id']}})[_0xf572('0x2b')](handleEntityNotFound(_0x3d1d86,null))['then'](function(_0x167dc2){if(_0x167dc2){_0x33e0bc=_0x167dc2;_0x46c181[_0xf572('0x3c')]=_[_0xf572('0x38')](db[_0xf572('0x5c')][_0xf572('0x36')]);_0x46c181[_0xf572('0x39')]=_['keys'](_0x2b542d[_0xf572('0x39')]);_0x46c181[_0xf572('0x43')]=_[_0xf572('0x3b')](_0x46c181[_0xf572('0x3c')],_0x46c181['query']);_0x1c521b[_0xf572('0x3a')]=_[_0xf572('0x3b')](_0x46c181[_0xf572('0x3c')],qs[_0xf572('0x3d')](_0x2b542d[_0xf572('0x39')][_0xf572('0x3d')]));_0x1c521b[_0xf572('0x3a')]=_0x1c521b[_0xf572('0x3a')][_0xf572('0x3e')]?_0x1c521b[_0xf572('0x3a')]:_0x46c181[_0xf572('0x3c')];_0x1c521b['order']=qs['sort'](_0x2b542d[_0xf572('0x39')][_0xf572('0x41')]);_0x1c521b[_0xf572('0x42')]=qs[_0xf572('0x43')](_[_0xf572('0x44')](_0x2b542d['query'],_0x46c181[_0xf572('0x43')]));if(_0x2b542d[_0xf572('0x39')]['filter']){_0x1c521b[_0xf572('0x42')]=_[_0xf572('0x47')](_0x1c521b[_0xf572('0x42')],{'$or':_['map'](_0x1c521b[_0xf572('0x3a')],function(_0x47b0fe){var _0x47a56f={};_0x47a56f[_0x47b0fe]={'$like':'%'+_0x2b542d[_0xf572('0x39')][_0xf572('0x45')]+'%'};return _0x47a56f;})});}_0x1c521b=_[_0xf572('0x47')]({},_0x1c521b,_0x2b542d[_0xf572('0x48')]);return _0x33e0bc['getAgents'](_0x1c521b);}})[_0xf572('0x2b')](function(_0x4211d9){if(_0x4211d9){_0x526c2e=_0x4211d9[_0xf572('0x3e')];if(!_0x2b542d[_0xf572('0x39')][_0xf572('0x3f')]('nolimit')){_0x1c521b[_0xf572('0x24')]=qs[_0xf572('0x24')](_0x2b542d[_0xf572('0x39')][_0xf572('0x24')]);_0x1c521b[_0xf572('0x22')]=qs['offset'](_0x2b542d[_0xf572('0x39')]['offset']);}return _0x33e0bc['getAgents'](_0x1c521b);}})[_0xf572('0x2b')](function(_0x31fb90){if(_0x31fb90){return _0x31fb90?{'count':_0x526c2e,'rows':_0x31fb90}:null;}})[_0xf572('0x2b')](respondWithResult(_0x3d1d86,null))['catch'](handleError(_0x3d1d86,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index bc25ba7..b1e185c 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 _0x740d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x3fb678,_0x2c6c5d){var _0x3fe076=function(_0x1e64ed){while(--_0x1e64ed){_0x3fb678['push'](_0x3fb678['shift']());}};_0x3fe076(++_0x2c6c5d);}(_0x740d,0x7b));var _0xd740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740d[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xd740('0x0'));var WhatsappQueue=require(_0xd740('0x1'))['db'][_0xd740('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd740('0x3'),'afterDestroy':_0xd740('0x4')};function emitEvent(_0x5e7e06){return function(_0x42f978,_0x5ae532,_0xc9befe){WhatsappQueueEvents[_0xd740('0x5')](_0x5e7e06+':'+_0x42f978['id'],_0x42f978);WhatsappQueueEvents[_0xd740('0x5')](_0x5e7e06,_0x42f978);_0xc9befe(null);};}for(var e in events){if(events[_0xd740('0x6')](e)){var event=events[e];WhatsappQueue[_0xd740('0x7')](e,emitEvent(event));}}module[_0xd740('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb64c=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x11b4e3,_0x483b51){var _0x1212b8=function(_0x2070cf){while(--_0x2070cf){_0x11b4e3['push'](_0x11b4e3['shift']());}};_0x1212b8(++_0x483b51);}(_0xb64c,0xc0));var _0xcb64=function(_0x534d01,_0xbb976b){_0x534d01=_0x534d01-0x0;var _0x1f311a=_0xb64c[_0x534d01];return _0x1f311a;};'use strict';var EventEmitter=require(_0xcb64('0x0'));var WhatsappQueue=require(_0xcb64('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb64('0x2'),'afterUpdate':_0xcb64('0x3'),'afterDestroy':_0xcb64('0x4')};function emitEvent(_0x4c0b36){return function(_0x279119,_0x8b2075,_0x39782d){WhatsappQueueEvents[_0xcb64('0x5')](_0x4c0b36+':'+_0x279119['id'],_0x279119);WhatsappQueueEvents[_0xcb64('0x5')](_0x4c0b36,_0x279119);_0x39782d(null);};}for(var e in events){if(events[_0xcb64('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xcb64('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 7b261cb..2b7644d 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 _0xb595=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api'];(function(_0x5a43bb,_0x574eb4){var _0x5ae732=function(_0x26a332){while(--_0x26a332){_0x5a43bb['push'](_0x5a43bb['shift']());}};_0x5ae732(++_0x574eb4);}(_0xb595,0xbd));var _0x5b59=function(_0x3cffc4,_0x3a8f12){_0x3cffc4=_0x3cffc4-0x0;var _0x3c6c8=_0xb595[_0x3cffc4];return _0x3c6c8;};'use strict';var _=require(_0x5b59('0x0'));var util=require('util');var logger=require(_0x5b59('0x1'))(_0x5b59('0x2'));var moment=require(_0x5b59('0x3'));var BPromise=require(_0x5b59('0x4'));var rp=require(_0x5b59('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b59('0x6'));var config=require(_0x5b59('0x7'));var attributes=require(_0x5b59('0x8'));module[_0x5b59('0x9')]=function(_0x2f8b57,_0x4d325b){return _0x2f8b57['define'](_0x5b59('0xa'),attributes,{'tableName':_0x5b59('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['moment','request-promise','path','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api'];(function(_0x51f5f7,_0x4e1492){var _0x6afaa=function(_0x298234){while(--_0x298234){_0x51f5f7['push'](_0x51f5f7['shift']());}};_0x6afaa(++_0x4e1492);}(_0xb44a,0x1b5));var _0xab44=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0xb44a[_0x4ef826];return _0x154b8;};'use strict';var _=require('lodash');var util=require(_0xab44('0x0'));var logger=require(_0xab44('0x1'))(_0xab44('0x2'));var moment=require(_0xab44('0x3'));var BPromise=require('bluebird');var rp=require(_0xab44('0x4'));var fs=require('fs');var path=require(_0xab44('0x5'));var rimraf=require('rimraf');var config=require(_0xab44('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xab44('0x7')]=function(_0x3ce708,_0x25b242){return _0x3ce708[_0xab44('0x8')](_0xab44('0x9'),attributes,{'tableName':_0xab44('0xa'),'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 871712c..5285f93 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 _0xa5f4=['where','attributes','include','map','model','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw'];(function(_0x2e3fed,_0x11dca8){var _0x3bd9de=function(_0x1f997a){while(--_0x1f997a){_0x2e3fed['push'](_0x2e3fed['shift']());}};_0x3bd9de(++_0x11dca8);}(_0xa5f4,0x11f));var _0x4a5f=function(_0x147a53,_0x220744){_0x147a53=_0x147a53-0x0;var _0x217a0f=_0xa5f4[_0x147a53];return _0x217a0f;};'use strict';var _=require(_0x4a5f('0x0'));var util=require(_0x4a5f('0x1'));var moment=require(_0x4a5f('0x2'));var BPromise=require(_0x4a5f('0x3'));var rs=require(_0x4a5f('0x4'));var fs=require('fs');var Redis=require(_0x4a5f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a5f('0x6'));var logger=require(_0x4a5f('0x7'))('rpc');var config=require(_0x4a5f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a5f('0x9')][_0x4a5f('0xa')]({'port':0x232a});config[_0x4a5f('0xb')]=_[_0x4a5f('0xc')](config[_0x4a5f('0xb')],{'host':_0x4a5f('0xd'),'port':0x18eb});var socket=require(_0x4a5f('0xe'))(new Redis(config[_0x4a5f('0xb')]));require(_0x4a5f('0xf'))[_0x4a5f('0x10')](socket);function respondWithRpcPromise(_0x3ce6ee,_0x21a4c4,_0xaa703e){return new BPromise(function(_0x5c9acc,_0x65e02b){return client['request'](_0x3ce6ee,_0xaa703e)[_0x4a5f('0x11')](function(_0x5e4cdc){logger[_0x4a5f('0x12')](_0x4a5f('0x13'),_0x21a4c4,_0x4a5f('0x14'));logger[_0x4a5f('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x21a4c4,_0x4a5f('0x14'),JSON[_0x4a5f('0x16')](_0x5e4cdc));if(_0x5e4cdc[_0x4a5f('0x17')]){if(_0x5e4cdc['error'][_0x4a5f('0x18')]===0x1f4){logger[_0x4a5f('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x21a4c4,_0x5e4cdc[_0x4a5f('0x17')][_0x4a5f('0x19')]);return _0x65e02b(_0x5e4cdc['error']['message']);}logger[_0x4a5f('0x17')](_0x4a5f('0x13'),_0x21a4c4,_0x5e4cdc[_0x4a5f('0x17')]['message']);return _0x5c9acc(_0x5e4cdc['error'][_0x4a5f('0x19')]);}else{logger['info'](_0x4a5f('0x13'),_0x21a4c4,'request\x20sent');_0x5c9acc(_0x5e4cdc[_0x4a5f('0x1a')][_0x4a5f('0x19')]);}})[_0x4a5f('0x1b')](function(_0x3c3fbd){logger[_0x4a5f('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x21a4c4,_0x3c3fbd);_0x65e02b(_0x3c3fbd);});});}exports[_0x4a5f('0x1c')]=function(_0x346eb0){var _0x4666cb=this;return new Promise(function(_0x8449b8,_0xdb9d49){return db[_0x4a5f('0x1d')][_0x4a5f('0x1e')]({'raw':_0x346eb0[_0x4a5f('0x1f')]?_0x346eb0[_0x4a5f('0x1f')][_0x4a5f('0x20')]===undefined?!![]:![]:!![],'where':_0x346eb0[_0x4a5f('0x1f')]?_0x346eb0[_0x4a5f('0x1f')][_0x4a5f('0x21')]||null:null,'attributes':_0x346eb0['options']?_0x346eb0[_0x4a5f('0x1f')][_0x4a5f('0x22')]||null:null,'limit':_0x346eb0[_0x4a5f('0x1f')]?_0x346eb0['options']['limit']||null:null,'include':_0x346eb0[_0x4a5f('0x1f')]?_0x346eb0[_0x4a5f('0x1f')][_0x4a5f('0x23')]?_[_0x4a5f('0x24')](_0x346eb0['options'][_0x4a5f('0x23')],function(_0x26ea03){return{'model':db[_0x26ea03[_0x4a5f('0x25')]],'as':_0x26ea03['as'],'attributes':_0x26ea03['attributes'],'include':_0x26ea03[_0x4a5f('0x23')]?_[_0x4a5f('0x24')](_0x26ea03['include'],function(_0x36452b){return{'model':db[_0x36452b[_0x4a5f('0x25')]],'as':_0x36452b['as'],'attributes':_0x36452b[_0x4a5f('0x22')],'include':_0x36452b['include']?_[_0x4a5f('0x24')](_0x36452b[_0x4a5f('0x23')],function(_0x40ceff){return{'model':db[_0x40ceff['model']],'as':_0x40ceff['as'],'attributes':_0x40ceff['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a5f('0x11')](function(_0x1939f4){logger[_0x4a5f('0x12')](_0x4a5f('0x1c'),_0x346eb0);logger[_0x4a5f('0x15')](_0x4a5f('0x1c'),_0x346eb0,JSON[_0x4a5f('0x16')](_0x1939f4));_0x8449b8(_0x1939f4);})[_0x4a5f('0x1b')](function(_0x27a413){logger[_0x4a5f('0x17')](_0x4a5f('0x1c'),_0x27a413[_0x4a5f('0x19')],_0x346eb0);_0xdb9d49(_0x4666cb[_0x4a5f('0x17')](0x1f4,_0x27a413[_0x4a5f('0x19')]));});});};exports[_0x4a5f('0x26')]=function(_0x5556e9){var _0x16786b=this;return new Promise(function(_0x45f211,_0x46d2dc){return db['WhatsappQueue'][_0x4a5f('0x27')]({'raw':_0x5556e9[_0x4a5f('0x1f')]?_0x5556e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x5556e9[_0x4a5f('0x1f')]?_0x5556e9['options'][_0x4a5f('0x21')]||null:null,'attributes':_0x5556e9[_0x4a5f('0x1f')]?_0x5556e9[_0x4a5f('0x1f')]['attributes']||null:null,'include':_0x5556e9[_0x4a5f('0x1f')]?_0x5556e9[_0x4a5f('0x1f')]['include']?_['map'](_0x5556e9['options'][_0x4a5f('0x23')],function(_0x495b21){return{'model':db[_0x495b21[_0x4a5f('0x25')]],'as':_0x495b21['as'],'attributes':_0x495b21[_0x4a5f('0x22')],'include':_0x495b21[_0x4a5f('0x23')]?_[_0x4a5f('0x24')](_0x495b21[_0x4a5f('0x23')],function(_0xee6fd9){return{'model':db[_0xee6fd9[_0x4a5f('0x25')]],'as':_0xee6fd9['as'],'attributes':_0xee6fd9['attributes'],'include':_0xee6fd9[_0x4a5f('0x23')]?_[_0x4a5f('0x24')](_0xee6fd9[_0x4a5f('0x23')],function(_0x12b117){return{'model':db[_0x12b117['model']],'as':_0x12b117['as'],'attributes':_0x12b117['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ba7f1){logger[_0x4a5f('0x12')](_0x4a5f('0x26'),_0x5556e9);logger[_0x4a5f('0x15')](_0x4a5f('0x26'),_0x5556e9,JSON[_0x4a5f('0x16')](_0x2ba7f1));_0x45f211(_0x2ba7f1);})[_0x4a5f('0x1b')](function(_0x55ed85){logger[_0x4a5f('0x17')](_0x4a5f('0x26'),_0x55ed85[_0x4a5f('0x19')],_0x5556e9);_0x46d2dc(_0x16786b[_0x4a5f('0x17')](0x1f4,_0x55ed85[_0x4a5f('0x19')]));});});}; \ No newline at end of file +var _0xdcb7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowWhatsappQueue','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2f63a0,_0x51855d){var _0x536ae8=function(_0x4b9de2){while(--_0x4b9de2){_0x2f63a0['push'](_0x2f63a0['shift']());}};_0x536ae8(++_0x51855d);}(_0xdcb7,0x1a9));var _0x7dcb=function(_0x34ec09,_0x234bd6){_0x34ec09=_0x34ec09-0x0;var _0x5c9340=_0xdcb7[_0x34ec09];return _0x5c9340;};'use strict';var _=require(_0x7dcb('0x0'));var util=require(_0x7dcb('0x1'));var moment=require('moment');var BPromise=require(_0x7dcb('0x2'));var rs=require(_0x7dcb('0x3'));var fs=require('fs');var Redis=require(_0x7dcb('0x4'));var db=require(_0x7dcb('0x5'))['db'];var utils=require(_0x7dcb('0x6'));var logger=require(_0x7dcb('0x7'))(_0x7dcb('0x8'));var config=require(_0x7dcb('0x9'));var jayson=require(_0x7dcb('0xa'));var client=jayson[_0x7dcb('0xb')][_0x7dcb('0xc')]({'port':0x232a});config['redis']=_[_0x7dcb('0xd')](config[_0x7dcb('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x7dcb('0xf'))(new Redis(config[_0x7dcb('0xe')]));require(_0x7dcb('0x10'))[_0x7dcb('0x11')](socket);function respondWithRpcPromise(_0x1951ca,_0x2857b4,_0x14de8a){return new BPromise(function(_0x2d0034,_0x166cd3){return client[_0x7dcb('0x12')](_0x1951ca,_0x14de8a)['then'](function(_0x33f0ed){logger[_0x7dcb('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x2857b4,_0x7dcb('0x14'));logger[_0x7dcb('0x15')](_0x7dcb('0x16'),_0x2857b4,'request\x20sent',JSON[_0x7dcb('0x17')](_0x33f0ed));if(_0x33f0ed[_0x7dcb('0x18')]){if(_0x33f0ed[_0x7dcb('0x18')]['code']===0x1f4){logger['error'](_0x7dcb('0x19'),_0x2857b4,_0x33f0ed[_0x7dcb('0x18')][_0x7dcb('0x1a')]);return _0x166cd3(_0x33f0ed[_0x7dcb('0x18')][_0x7dcb('0x1a')]);}logger[_0x7dcb('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x2857b4,_0x33f0ed[_0x7dcb('0x18')]['message']);return _0x2d0034(_0x33f0ed[_0x7dcb('0x18')][_0x7dcb('0x1a')]);}else{logger[_0x7dcb('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x2857b4,_0x7dcb('0x14'));_0x2d0034(_0x33f0ed[_0x7dcb('0x1b')][_0x7dcb('0x1a')]);}})[_0x7dcb('0x1c')](function(_0x1faaea){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2857b4,_0x1faaea);_0x166cd3(_0x1faaea);});});}exports[_0x7dcb('0x1d')]=function(_0x116a0c){var _0x306740=this;return new Promise(function(_0x1356a6,_0x533553){return db[_0x7dcb('0x1e')][_0x7dcb('0x1f')]({'raw':_0x116a0c[_0x7dcb('0x20')]?_0x116a0c[_0x7dcb('0x20')][_0x7dcb('0x21')]===undefined?!![]:![]:!![],'where':_0x116a0c['options']?_0x116a0c[_0x7dcb('0x20')][_0x7dcb('0x22')]||null:null,'attributes':_0x116a0c[_0x7dcb('0x20')]?_0x116a0c['options'][_0x7dcb('0x23')]||null:null,'limit':_0x116a0c[_0x7dcb('0x20')]?_0x116a0c[_0x7dcb('0x20')][_0x7dcb('0x24')]||null:null,'include':_0x116a0c[_0x7dcb('0x20')]?_0x116a0c[_0x7dcb('0x20')][_0x7dcb('0x25')]?_[_0x7dcb('0x26')](_0x116a0c[_0x7dcb('0x20')]['include'],function(_0xe6940){return{'model':db[_0xe6940['model']],'as':_0xe6940['as'],'attributes':_0xe6940[_0x7dcb('0x23')],'include':_0xe6940[_0x7dcb('0x25')]?_[_0x7dcb('0x26')](_0xe6940[_0x7dcb('0x25')],function(_0x4df81){return{'model':db[_0x4df81[_0x7dcb('0x27')]],'as':_0x4df81['as'],'attributes':_0x4df81[_0x7dcb('0x23')],'include':_0x4df81[_0x7dcb('0x25')]?_[_0x7dcb('0x26')](_0x4df81['include'],function(_0x2266b5){return{'model':db[_0x2266b5[_0x7dcb('0x27')]],'as':_0x2266b5['as'],'attributes':_0x2266b5[_0x7dcb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7dcb('0x28')](function(_0x138f65){logger[_0x7dcb('0x13')](_0x7dcb('0x1d'),_0x116a0c);logger[_0x7dcb('0x15')](_0x7dcb('0x1d'),_0x116a0c,JSON[_0x7dcb('0x17')](_0x138f65));_0x1356a6(_0x138f65);})[_0x7dcb('0x1c')](function(_0x25e651){logger[_0x7dcb('0x18')]('GetWhatsappQueue',_0x25e651[_0x7dcb('0x1a')],_0x116a0c);_0x533553(_0x306740[_0x7dcb('0x18')](0x1f4,_0x25e651['message']));});});};exports['ShowWhatsappQueue']=function(_0x14b8aa){var _0x5e93d6=this;return new Promise(function(_0xfcda18,_0x45b6e5){return db['WhatsappQueue'][_0x7dcb('0x29')]({'raw':_0x14b8aa[_0x7dcb('0x20')]?_0x14b8aa[_0x7dcb('0x20')][_0x7dcb('0x21')]===undefined?!![]:![]:!![],'where':_0x14b8aa['options']?_0x14b8aa[_0x7dcb('0x20')][_0x7dcb('0x22')]||null:null,'attributes':_0x14b8aa['options']?_0x14b8aa[_0x7dcb('0x20')]['attributes']||null:null,'include':_0x14b8aa['options']?_0x14b8aa[_0x7dcb('0x20')][_0x7dcb('0x25')]?_['map'](_0x14b8aa[_0x7dcb('0x20')][_0x7dcb('0x25')],function(_0x467e3e){return{'model':db[_0x467e3e[_0x7dcb('0x27')]],'as':_0x467e3e['as'],'attributes':_0x467e3e[_0x7dcb('0x23')],'include':_0x467e3e[_0x7dcb('0x25')]?_[_0x7dcb('0x26')](_0x467e3e['include'],function(_0x44509a){return{'model':db[_0x44509a[_0x7dcb('0x27')]],'as':_0x44509a['as'],'attributes':_0x44509a[_0x7dcb('0x23')],'include':_0x44509a['include']?_[_0x7dcb('0x26')](_0x44509a[_0x7dcb('0x25')],function(_0x19b04c){return{'model':db[_0x19b04c[_0x7dcb('0x27')]],'as':_0x19b04c['as'],'attributes':_0x19b04c[_0x7dcb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7dcb('0x28')](function(_0x45a488){logger['info'](_0x7dcb('0x2a'),_0x14b8aa);logger['debug'](_0x7dcb('0x2a'),_0x14b8aa,JSON[_0x7dcb('0x17')](_0x45a488));_0xfcda18(_0x45a488);})[_0x7dcb('0x1c')](function(_0x315f0e){logger[_0x7dcb('0x18')](_0x7dcb('0x2a'),_0x315f0e[_0x7dcb('0x1a')],_0x14b8aa);_0x45b6e5(_0x5e93d6['error'](0x1f4,_0x315f0e[_0x7dcb('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9aa360d..37a7259 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 _0x8bcd=['./whatsappQueue.events','remove','emit','register','length'];(function(_0x244da6,_0x1c66f7){var _0x3d2d3b=function(_0x405268){while(--_0x405268){_0x244da6['push'](_0x244da6['shift']());}};_0x3d2d3b(++_0x1c66f7);}(_0x8bcd,0x69));var _0xd8bc=function(_0x53865e,_0x266da8){_0x53865e=_0x53865e-0x0;var _0x6f49a6=_0x8bcd[_0x53865e];return _0x6f49a6;};'use strict';var WhatsappQueueEvents=require(_0xd8bc('0x0'));var events=['save',_0xd8bc('0x1'),'update'];function createListener(_0x2d8746,_0xf4e902){return function(_0x46f62c){_0xf4e902[_0xd8bc('0x2')](_0x2d8746,_0x46f62c);};}function removeListener(_0x11e232,_0x384d47){return function(){WhatsappQueueEvents['removeListener'](_0x11e232,_0x384d47);};}exports[_0xd8bc('0x3')]=function(_0x52a4fb){for(var _0x41b99c=0x0,_0x43f34e=events[_0xd8bc('0x4')];_0x41b99c<_0x43f34e;_0x41b99c++){var _0x41071c=events[_0x41b99c];var _0x5cd09=createListener('whatsappQueue:'+_0x41071c,_0x52a4fb);WhatsappQueueEvents['on'](_0x41071c,_0x5cd09);}}; \ No newline at end of file +var _0x60d1=['removeListener','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x534ae9,_0x5735c1){var _0x2dc1e7=function(_0x58048a){while(--_0x58048a){_0x534ae9['push'](_0x534ae9['shift']());}};_0x2dc1e7(++_0x5735c1);}(_0x60d1,0xd3));var _0x160d=function(_0x192993,_0x1df6e3){_0x192993=_0x192993-0x0;var _0x16bee0=_0x60d1[_0x192993];return _0x16bee0;};'use strict';var WhatsappQueueEvents=require(_0x160d('0x0'));var events=[_0x160d('0x1'),_0x160d('0x2'),_0x160d('0x3')];function createListener(_0xc0abf8,_0x16abf7){return function(_0x17d15a){_0x16abf7[_0x160d('0x4')](_0xc0abf8,_0x17d15a);};}function removeListener(_0x4f788b,_0x3ac59f){return function(){WhatsappQueueEvents[_0x160d('0x5')](_0x4f788b,_0x3ac59f);};}exports['register']=function(_0x4c8fa7){for(var _0x10d145=0x0,_0x23149a=events[_0x160d('0x6')];_0x10d145<_0x23149a;_0x10d145++){var _0x28553a=events[_0x10d145];var _0x38e7f4=createListener(_0x160d('0x7')+_0x28553a,_0x4c8fa7);WhatsappQueueEvents['on'](_0x28553a,_0x38e7f4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index de333c3..202962b 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 _0x18c2=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x571812,_0x188091){var _0x5b0c5f=function(_0x246b6d){while(--_0x246b6d){_0x571812['push'](_0x571812['shift']());}};_0x5b0c5f(++_0x188091);}(_0x18c2,0xcf));var _0x218c=function(_0x2e0593,_0x387cd0){_0x2e0593=_0x2e0593-0x0;var _0x4556be=_0x18c2[_0x2e0593];return _0x4556be;};'use strict';var multer=require(_0x218c('0x0'));var util=require(_0x218c('0x1'));var path=require(_0x218c('0x2'));var timeout=require(_0x218c('0x3'));var express=require(_0x218c('0x4'));var router=express['Router']();var fs_extra=require(_0x218c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x218c('0x6'));var config=require(_0x218c('0x7'));var controller=require(_0x218c('0x8'));router[_0x218c('0x9')]('/',auth['isAuthenticated'](),controller[_0x218c('0xa')]);router[_0x218c('0x9')](_0x218c('0xb'),auth[_0x218c('0xc')](),controller['describe']);router[_0x218c('0x9')](_0x218c('0xd'),auth[_0x218c('0xc')](),controller[_0x218c('0xe')]);router[_0x218c('0xf')]('/',auth[_0x218c('0xc')](),controller['create']);router[_0x218c('0x10')](_0x218c('0xd'),auth['isAuthenticated'](),controller[_0x218c('0x11')]);router[_0x218c('0x12')](_0x218c('0xd'),auth[_0x218c('0xc')](),controller[_0x218c('0x13')]);module[_0x218c('0x14')]=router; \ No newline at end of file +var _0xa736=['../../components/interaction/service','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x208b95,_0x1c22cd){var _0x5ab425=function(_0xbf0dcd){while(--_0xbf0dcd){_0x208b95['push'](_0x208b95['shift']());}};_0x5ab425(++_0x1c22cd);}(_0xa736,0x102));var _0x6a73=function(_0x1a4d65,_0x117206){_0x1a4d65=_0x1a4d65-0x0;var _0x47c5c2=_0xa736[_0x1a4d65];return _0x47c5c2;};'use strict';var multer=require('multer');var util=require(_0x6a73('0x0'));var path=require(_0x6a73('0x1'));var timeout=require(_0x6a73('0x2'));var express=require(_0x6a73('0x3'));var router=express[_0x6a73('0x4')]();var fs_extra=require(_0x6a73('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6a73('0x6'));var config=require('../../config/environment');var controller=require(_0x6a73('0x7'));router[_0x6a73('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a73('0x9')]);router[_0x6a73('0x8')](_0x6a73('0xa'),auth[_0x6a73('0xb')](),controller[_0x6a73('0xc')]);router[_0x6a73('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6a73('0xd')]);router[_0x6a73('0xe')]('/',auth['isAuthenticated'](),controller[_0x6a73('0xf')]);router[_0x6a73('0x10')](_0x6a73('0x11'),auth['isAuthenticated'](),controller[_0x6a73('0x12')]);router[_0x6a73('0x13')]('/:id',auth[_0x6a73('0xb')](),controller[_0x6a73('0x14')]);module[_0x6a73('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d614aeb..84dbb87 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x52a122,_0x4eae6a){var _0x24b933=function(_0x24dd94){while(--_0x24dd94){_0x52a122['push'](_0x52a122['shift']());}};_0x24b933(++_0x4eae6a);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x11241f,_0x5ea065){var _0x2d363d=function(_0x3fde6c){while(--_0x3fde6c){_0x11241f['push'](_0x11241f['shift']());}};_0x2d363d(++_0x5ea065);}(_0x7a54,0x106));var _0x47a5=function(_0x2d2374,_0x594a5c){_0x2d2374=_0x2d2374-0x0;var _0xae2a21=_0x7a54[_0x2d2374];return _0xae2a21;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 1070852..b20da6a 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 _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','WhatsappQueueReport','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0xb193e7,_0x3b32b5){var _0x577c8e=function(_0x364bed){while(--_0x364bed){_0xb193e7['push'](_0xb193e7['shift']());}};_0x577c8e(++_0x3b32b5);}(_0xf45e,0x115));var _0xef45=function(_0x340523,_0x3ae647){_0x340523=_0x340523-0x0;var _0x463e81=_0xf45e[_0x340523];return _0x463e81;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['WhatsappQueueReport'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['WhatsappQueueReport'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));};exports['describe']=function(_0x22b75e,_0x24aceb){return db[_0xef45('0x3f')]['describe']()[_0xef45('0x29')](respondWithResult(_0x24aceb,null))[_0xef45('0x4d')](handleError(_0x24aceb,null));}; \ No newline at end of file +var _0xd87e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs'];(function(_0x457b43,_0x301e1e){var _0x461931=function(_0x3ab050){while(--_0x3ab050){_0x457b43['push'](_0x457b43['shift']());}};_0x461931(++_0x301e1e);}(_0xd87e,0x1bf));var _0xed87=function(_0x610144,_0x1be4c5){_0x610144=_0x610144-0x0;var _0x43b6e4=_0xd87e[_0x610144];return _0x43b6e4;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){_0x3d1641['status'](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x3c22b7,_0x41e0d4){return function(_0x320bcc){if(!_0x320bcc){_0x3c22b7[_0xed87('0x18')](0x194);}return _0x320bcc;};}function handleError(_0x289e38,_0x25a6f7){_0x25a6f7=_0x25a6f7||0x1f4;return function(_0x4735b3){logger[_0xed87('0x25')](_0x4735b3[_0xed87('0x26')]);if(_0x4735b3[_0xed87('0x27')]){delete _0x4735b3[_0xed87('0x27')];}_0x289e38[_0xed87('0x19')](_0x25a6f7)[_0xed87('0x28')](_0x4735b3);};}exports['index']=function(_0xb32b1c,_0x1c4a65){var _0x4eaa44={},_0x3dff74={},_0x33c367={'count':0x0,'rows':[]};var _0x21c93b=_['map'](db['WhatsappQueueReport'][_0xed87('0x29')],function(_0x428b75){return{'name':_0x428b75[_0xed87('0x2a')],'type':_0x428b75['type'][_0xed87('0x2b')]};});_0x3dff74[_0xed87('0x2c')]=_[_0xed87('0x2d')](_0x21c93b,_0xed87('0x27'));_0x3dff74[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0xb32b1c[_0xed87('0x2e')]);_0x3dff74[_0xed87('0x30')]=_[_0xed87('0x31')](_0x3dff74['model'],_0x3dff74[_0xed87('0x2e')]);_0x4eaa44[_0xed87('0x32')]=_['intersection'](_0x3dff74[_0xed87('0x2c')],qs['fields'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x4eaa44[_0xed87('0x32')]=_0x4eaa44[_0xed87('0x32')][_0xed87('0x34')]?_0x4eaa44[_0xed87('0x32')]:_0x3dff74[_0xed87('0x2c')];if(!_0xb32b1c[_0xed87('0x2e')][_0xed87('0x35')](_0xed87('0x36'))){_0x4eaa44[_0xed87('0x1e')]=qs['limit'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x1e')]);_0x4eaa44['offset']=qs[_0xed87('0x1c')](_0xb32b1c['query'][_0xed87('0x1c')]);}_0x4eaa44[_0xed87('0x37')]=qs['sort'](_0xb32b1c[_0xed87('0x2e')][_0xed87('0x38')]);_0x4eaa44[_0xed87('0x39')]=qs[_0xed87('0x30')](_[_0xed87('0x3a')](_0xb32b1c['query'],_0x3dff74[_0xed87('0x30')]),_0x21c93b);if(_0xb32b1c['query'][_0xed87('0x3b')]){_0x4eaa44['where']=_[_0xed87('0x3c')](_0x4eaa44[_0xed87('0x39')],{'$or':_[_0xed87('0x2d')](_0x21c93b,function(_0x217435){if(_0x217435[_0xed87('0x3d')]!==_0xed87('0x3e')){var _0x9e3356={};_0x9e3356[_0x217435[_0xed87('0x27')]]={'$like':'%'+_0xb32b1c[_0xed87('0x2e')]['filter']+'%'};return _0x9e3356;}})});}_0x4eaa44=_['merge']({},_0x4eaa44,_0xb32b1c[_0xed87('0x3f')]);var _0x206544={'where':_0x4eaa44[_0xed87('0x39')]};return db[_0xed87('0x40')][_0xed87('0x1f')](_0x206544)[_0xed87('0x23')](function(_0x5d1bd0){_0x33c367[_0xed87('0x1f')]=_0x5d1bd0;if(_0xb32b1c[_0xed87('0x2e')][_0xed87('0x41')]){_0x4eaa44['include']=[{'all':!![]}];}return db[_0xed87('0x40')][_0xed87('0x42')](_0x4eaa44);})[_0xed87('0x23')](function(_0x1b0092){_0x33c367[_0xed87('0x43')]=_0x1b0092;return _0x33c367;})[_0xed87('0x23')](respondWithFilteredResult(_0x1c4a65,_0x4eaa44))[_0xed87('0x44')](handleError(_0x1c4a65,null));};exports[_0xed87('0x45')]=function(_0x35bd1c,_0x406b73){var _0x5c6925={'raw':!![],'where':{'id':_0x35bd1c[_0xed87('0x46')]['id']}},_0x7e6cbb={};_0x7e6cbb[_0xed87('0x2c')]=_['keys'](db['WhatsappQueueReport'][_0xed87('0x29')]);_0x7e6cbb[_0xed87('0x2e')]=_[_0xed87('0x2f')](_0x35bd1c[_0xed87('0x2e')]);_0x7e6cbb['filters']=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],_0x7e6cbb['query']);_0x5c6925[_0xed87('0x32')]=_[_0xed87('0x31')](_0x7e6cbb[_0xed87('0x2c')],qs[_0xed87('0x33')](_0x35bd1c[_0xed87('0x2e')][_0xed87('0x33')]));_0x5c6925[_0xed87('0x32')]=_0x5c6925[_0xed87('0x32')][_0xed87('0x34')]?_0x5c6925[_0xed87('0x32')]:_0x7e6cbb[_0xed87('0x2c')];if(_0x35bd1c['query'][_0xed87('0x41')]){_0x5c6925[_0xed87('0x47')]=[{'all':!![]}];}_0x5c6925=_[_0xed87('0x3c')]({},_0x5c6925,_0x35bd1c[_0xed87('0x3f')]);return db[_0xed87('0x40')][_0xed87('0x48')](_0x5c6925)[_0xed87('0x23')](handleEntityNotFound(_0x406b73,null))[_0xed87('0x23')](respondWithResult(_0x406b73,null))[_0xed87('0x44')](handleError(_0x406b73,null));};exports[_0xed87('0x49')]=function(_0x8aa499,_0x26c8f4){return db[_0xed87('0x40')][_0xed87('0x49')](_0x8aa499[_0xed87('0x4a')],{})[_0xed87('0x23')](respondWithResult(_0x26c8f4,0xc9))[_0xed87('0x44')](handleError(_0x26c8f4,null));};exports['update']=function(_0x2c7bef,_0x1a68a7){if(_0x2c7bef[_0xed87('0x4a')]['id']){delete _0x2c7bef['body']['id'];}return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x2c7bef['params']['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x1a68a7,null))[_0xed87('0x23')](saveUpdates(_0x2c7bef[_0xed87('0x4a')],null))[_0xed87('0x23')](respondWithResult(_0x1a68a7,null))['catch'](handleError(_0x1a68a7,null));};exports[_0xed87('0x24')]=function(_0x436e15,_0x3ca34c){return db[_0xed87('0x40')][_0xed87('0x48')]({'where':{'id':_0x436e15[_0xed87('0x46')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3ca34c,null))[_0xed87('0x23')](removeEntity(_0x3ca34c,null))[_0xed87('0x44')](handleError(_0x3ca34c,null));};exports[_0xed87('0x4b')]=function(_0x25a514,_0x18846f){return db[_0xed87('0x40')]['describe']()[_0xed87('0x23')](respondWithResult(_0x18846f,null))['catch'](handleError(_0x18846f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0a4b740..71d1d7c 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 _0xa814=['WhatsappQueueReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x639501,_0x13c193){var _0x5219b1=function(_0x356ab1){while(--_0x356ab1){_0x639501['push'](_0x639501['shift']());}};_0x5219b1(++_0x13c193);}(_0xa814,0x7a));var _0x4a81=function(_0x21b375,_0x51f590){_0x21b375=_0x21b375-0x0;var _0x156221=_0xa814[_0x21b375];return _0x156221;};'use strict';var _=require('lodash');var util=require(_0x4a81('0x0'));var logger=require(_0x4a81('0x1'))(_0x4a81('0x2'));var moment=require('moment');var BPromise=require(_0x4a81('0x3'));var rp=require(_0x4a81('0x4'));var fs=require('fs');var path=require(_0x4a81('0x5'));var rimraf=require(_0x4a81('0x6'));var config=require(_0x4a81('0x7'));var attributes=require(_0x4a81('0x8'));module[_0x4a81('0x9')]=function(_0x222efb,_0x51f32c){return _0x222efb['define'](_0x4a81('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4a81('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa075=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x495cf0,_0x4ba2d4){var _0x429d1c=function(_0xcec392){while(--_0xcec392){_0x495cf0['push'](_0x495cf0['shift']());}};_0x429d1c(++_0x4ba2d4);}(_0xa075,0x17d));var _0x5a07=function(_0x4937ae,_0x8b9da3){_0x4937ae=_0x4937ae-0x0;var _0x57489e=_0xa075[_0x4937ae];return _0x57489e;};'use strict';var _=require(_0x5a07('0x0'));var util=require(_0x5a07('0x1'));var logger=require(_0x5a07('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a07('0x3'));var fs=require('fs');var path=require(_0x5a07('0x4'));var rimraf=require(_0x5a07('0x5'));var config=require(_0x5a07('0x6'));var attributes=require(_0x5a07('0x7'));module[_0x5a07('0x8')]=function(_0xd2eee8,_0xca8cd9){return _0xd2eee8[_0x5a07('0x9')](_0x5a07('0xa'),attributes,{'tableName':_0x5a07('0xb'),'paranoid':![],'indexes':[{'name':_0x5a07('0xc'),'fields':[_0x5a07('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 b8d1a07..e784180 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 _0x8bb3=['where','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8bb3,0x1c4));var _0x38bb=function(_0x405050,_0x33fd5f){_0x405050=_0x405050-0x0;var _0x3f1f5=_0x8bb3[_0x405050];return _0x3f1f5;};'use strict';var _=require(_0x38bb('0x0'));var util=require('util');var moment=require(_0x38bb('0x1'));var BPromise=require(_0x38bb('0x2'));var rs=require(_0x38bb('0x3'));var fs=require('fs');var Redis=require(_0x38bb('0x4'));var db=require(_0x38bb('0x5'))['db'];var utils=require(_0x38bb('0x6'));var logger=require('../../config/logger')(_0x38bb('0x7'));var config=require(_0x38bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38bb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x322833,_0xa7350f,_0x5af552){return new BPromise(function(_0x3540d6,_0x2f1902){return client['request'](_0x322833,_0x5af552)[_0x38bb('0xa')](function(_0x522692){logger['info'](_0x38bb('0xb'),_0xa7350f,'request\x20sent');logger[_0x38bb('0xc')](_0x38bb('0xd'),_0xa7350f,_0x38bb('0xe'),JSON[_0x38bb('0xf')](_0x522692));if(_0x522692[_0x38bb('0x10')]){if(_0x522692['error']['code']===0x1f4){logger[_0x38bb('0x10')](_0x38bb('0xb'),_0xa7350f,_0x522692[_0x38bb('0x10')]['message']);return _0x2f1902(_0x522692[_0x38bb('0x10')][_0x38bb('0x11')]);}logger[_0x38bb('0x10')](_0x38bb('0xb'),_0xa7350f,_0x522692[_0x38bb('0x10')][_0x38bb('0x11')]);return _0x3540d6(_0x522692['error'][_0x38bb('0x11')]);}else{logger[_0x38bb('0x12')](_0x38bb('0xb'),_0xa7350f,_0x38bb('0xe'));_0x3540d6(_0x522692[_0x38bb('0x13')]['message']);}})[_0x38bb('0x14')](function(_0x35d759){logger['error'](_0x38bb('0xb'),_0xa7350f,_0x35d759);_0x2f1902(_0x35d759);});});}exports['CreateWhatsappQueueReport']=function(_0x2ffd5c){var _0x8bc953=this;return new Promise(function(_0x42efb1,_0x655feb){return db[_0x38bb('0x15')][_0x38bb('0x16')](_0x2ffd5c[_0x38bb('0x17')],{'raw':_0x2ffd5c[_0x38bb('0x18')]?_0x2ffd5c[_0x38bb('0x18')][_0x38bb('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1d7e53){logger[_0x38bb('0x12')](_0x38bb('0x1a'),_0x2ffd5c);logger[_0x38bb('0xc')](_0x38bb('0x1a'),_0x2ffd5c,JSON[_0x38bb('0xf')](_0x1d7e53));_0x42efb1(_0x1d7e53);})[_0x38bb('0x14')](function(_0x14825f){logger['error'](_0x38bb('0x1a'),_0x14825f['message'],_0x2ffd5c);_0x655feb(_0x8bc953[_0x38bb('0x10')](0x1f4,_0x14825f['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x1595b5){var _0x3ca38b=this;return new Promise(function(_0x9d23d5,_0x124ef8){return db[_0x38bb('0x15')][_0x38bb('0x1b')](_0x1595b5[_0x38bb('0x17')],{'raw':_0x1595b5[_0x38bb('0x18')]?_0x1595b5[_0x38bb('0x18')][_0x38bb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1595b5[_0x38bb('0x18')]?_0x1595b5['options'][_0x38bb('0x1c')]||null:null,'attributes':_0x1595b5[_0x38bb('0x18')]?_0x1595b5['options'][_0x38bb('0x1d')]||null:null,'limit':_0x1595b5[_0x38bb('0x18')]?_0x1595b5[_0x38bb('0x18')][_0x38bb('0x1e')]||null:null})[_0x38bb('0xa')](function(_0x27ab34){logger[_0x38bb('0x12')](_0x38bb('0x1f'),_0x1595b5);logger[_0x38bb('0xc')](_0x38bb('0x1f'),_0x1595b5,JSON[_0x38bb('0xf')](_0x27ab34));_0x9d23d5(_0x27ab34);})[_0x38bb('0x14')](function(_0x35532a){logger[_0x38bb('0x10')]('UpdateWhatsappQueueReport',_0x35532a[_0x38bb('0x11')],_0x1595b5);_0x124ef8(_0x3ca38b[_0x38bb('0x10')](0x1f4,_0x35532a[_0x38bb('0x11')]));});});}; \ No newline at end of file +var _0x461b=['message','result','CreateWhatsappQueueReport','create','body','options','raw','then','stringify','catch','update','where','attributes','limit','info','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x35ace7,_0x2ae60c){var _0x16f594=function(_0xa3819e){while(--_0xa3819e){_0x35ace7['push'](_0x35ace7['shift']());}};_0x16f594(++_0x2ae60c);}(_0x461b,0xbf));var _0xb461=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x461b[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xb461('0x0'));var util=require(_0xb461('0x1'));var moment=require(_0xb461('0x2'));var BPromise=require(_0xb461('0x3'));var rs=require(_0xb461('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb461('0x5'))['db'];var utils=require(_0xb461('0x6'));var logger=require(_0xb461('0x7'))(_0xb461('0x8'));var config=require(_0xb461('0x9'));var jayson=require(_0xb461('0xa'));var client=jayson[_0xb461('0xb')][_0xb461('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11bdba,_0x3ba98c,_0x291481){return new BPromise(function(_0x4eba3e,_0xba86ae){return client[_0xb461('0xd')](_0x11bdba,_0x291481)['then'](function(_0x43ff6c){logger['info'](_0xb461('0xe'),_0x3ba98c,_0xb461('0xf'));logger[_0xb461('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3ba98c,_0xb461('0xf'),JSON['stringify'](_0x43ff6c));if(_0x43ff6c[_0xb461('0x11')]){if(_0x43ff6c[_0xb461('0x11')][_0xb461('0x12')]===0x1f4){logger[_0xb461('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3ba98c,_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);return _0xba86ae(_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3ba98c,_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);return _0x4eba3e(_0x43ff6c[_0xb461('0x11')][_0xb461('0x13')]);}else{logger['info'](_0xb461('0xe'),_0x3ba98c,'request\x20sent');_0x4eba3e(_0x43ff6c[_0xb461('0x14')][_0xb461('0x13')]);}})['catch'](function(_0x33852a){logger[_0xb461('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3ba98c,_0x33852a);_0xba86ae(_0x33852a);});});}exports[_0xb461('0x15')]=function(_0x3de515){var _0x3ec677=this;return new Promise(function(_0x3a9a51,_0x52e2ab){return db['WhatsappQueueReport'][_0xb461('0x16')](_0x3de515[_0xb461('0x17')],{'raw':_0x3de515['options']?_0x3de515[_0xb461('0x18')][_0xb461('0x19')]===undefined?!![]:![]:!![]})[_0xb461('0x1a')](function(_0x2eb55b){logger['info'](_0xb461('0x15'),_0x3de515);logger['debug'](_0xb461('0x15'),_0x3de515,JSON[_0xb461('0x1b')](_0x2eb55b));_0x3a9a51(_0x2eb55b);})[_0xb461('0x1c')](function(_0xb188e3){logger[_0xb461('0x11')](_0xb461('0x15'),_0xb188e3[_0xb461('0x13')],_0x3de515);_0x52e2ab(_0x3ec677['error'](0x1f4,_0xb188e3['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0xc0033b){var _0x24f5c3=this;return new Promise(function(_0x4d670a,_0x226ffd){return db['WhatsappQueueReport'][_0xb461('0x1d')](_0xc0033b[_0xb461('0x17')],{'raw':_0xc0033b[_0xb461('0x18')]?_0xc0033b[_0xb461('0x18')][_0xb461('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0033b[_0xb461('0x18')]?_0xc0033b[_0xb461('0x18')][_0xb461('0x1e')]||null:null,'attributes':_0xc0033b[_0xb461('0x18')]?_0xc0033b[_0xb461('0x18')][_0xb461('0x1f')]||null:null,'limit':_0xc0033b['options']?_0xc0033b[_0xb461('0x18')][_0xb461('0x20')]||null:null})[_0xb461('0x1a')](function(_0x8b8488){logger[_0xb461('0x21')](_0xb461('0x22'),_0xc0033b);logger[_0xb461('0x10')](_0xb461('0x22'),_0xc0033b,JSON[_0xb461('0x1b')](_0x8b8488));_0x4d670a(_0x8b8488);})[_0xb461('0x1c')](function(_0x535e9d){logger[_0xb461('0x11')]('UpdateWhatsappQueueReport',_0x535e9d[_0xb461('0x13')],_0xc0033b);_0x226ffd(_0x24f5c3[_0xb461('0x11')](0x1f4,_0x535e9d[_0xb461('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e733fdc..c5cb804 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 _0x849d=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x849d,0xfa));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd849('0x0'));var util=require(_0xd849('0x1'));var path=require('path');var timeout=require(_0xd849('0x2'));var express=require(_0xd849('0x3'));var router=express[_0xd849('0x4')]();var fs_extra=require(_0xd849('0x5'));var auth=require(_0xd849('0x6'));var interaction=require(_0xd849('0x7'));var config=require(_0xd849('0x8'));var controller=require(_0xd849('0x9'));router[_0xd849('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xd849('0xb')](),controller[_0xd849('0xc')]);router['get'](_0xd849('0xd'),auth[_0xd849('0xb')](),controller[_0xd849('0xe')]);router[_0xd849('0xf')]('/',auth[_0xd849('0xb')](),controller[_0xd849('0x10')]);router[_0xd849('0x11')](_0xd849('0xd'),auth[_0xd849('0xb')](),controller[_0xd849('0x12')]);router[_0xd849('0x13')](_0xd849('0xd'),auth[_0xd849('0xb')](),controller[_0xd849('0x14')]);module[_0xd849('0x15')]=router; \ No newline at end of file +var _0x2729=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2729,0x172));var _0x9272=function(_0x49fd24,_0x56f01f){_0x49fd24=_0x49fd24-0x0;var _0x4aa204=_0x2729[_0x49fd24];return _0x4aa204;};'use strict';var multer=require(_0x9272('0x0'));var util=require(_0x9272('0x1'));var path=require(_0x9272('0x2'));var timeout=require(_0x9272('0x3'));var express=require(_0x9272('0x4'));var router=express[_0x9272('0x5')]();var fs_extra=require(_0x9272('0x6'));var auth=require(_0x9272('0x7'));var interaction=require(_0x9272('0x8'));var config=require('../../config/environment');var controller=require(_0x9272('0x9'));router[_0x9272('0xa')]('/',auth[_0x9272('0xb')](),controller[_0x9272('0xc')]);router['get'](_0x9272('0xd'),auth[_0x9272('0xb')](),controller[_0x9272('0xe')]);router[_0x9272('0xa')](_0x9272('0xf'),auth[_0x9272('0xb')](),controller[_0x9272('0x10')]);router['post']('/',auth[_0x9272('0xb')](),controller[_0x9272('0x11')]);router[_0x9272('0x12')](_0x9272('0xf'),auth['isAuthenticated'](),controller[_0x9272('0x13')]);router[_0x9272('0x14')](_0x9272('0xf'),auth[_0x9272('0xb')](),controller[_0x9272('0x15')]);module[_0x9272('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e3fca81..f3e1e86 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 _0xd1f1=['exports','STRING','ENUM','account','queue','DATE','sequelize'];(function(_0x4d6601,_0x4b0b22){var _0x2d0e52=function(_0x51f928){while(--_0x51f928){_0x4d6601['push'](_0x4d6601['shift']());}};_0x2d0e52(++_0x4b0b22);}(_0xd1f1,0x84));var _0x1d1f=function(_0x414166,_0x5e87f3){_0x414166=_0x414166-0x0;var _0x373505=_0xd1f1[_0x414166];return _0x373505;};'use strict';var Sequelize=require(_0x1d1f('0x0'));module[_0x1d1f('0x1')]={'uniqueid':{'type':Sequelize[_0x1d1f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1d1f('0x3')](_0x1d1f('0x4'),'agent',_0x1d1f('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x1d1f('0x6')]}}; \ No newline at end of file +var _0xde6f=['queue','DATE','STRING','ENUM','account'];(function(_0x5768ea,_0x40b18f){var _0x127b61=function(_0x22032c){while(--_0x22032c){_0x5768ea['push'](_0x5768ea['shift']());}};_0x127b61(++_0x40b18f);}(_0xde6f,0x84));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfde6('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x2'),'agent',_0xfde6('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfde6('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 92dc2e1..77432b8 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 _0xb78e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','error','stack','name','send','index','map','WhatsappTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x143619,_0x47282b){var _0x1a9414=function(_0x2efa25){while(--_0x2efa25){_0x143619['push'](_0x143619['shift']());}};_0x1a9414(++_0x47282b);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3cc48c,_0x1f5e4c){_0x3cc48c=_0x3cc48c-0x0;var _0x3fc96a=_0xb78e[_0x3cc48c];return _0x3fc96a;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){_0x3c8e66[_0xeb78('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a00b,_0x5fc575){return function(_0x315f98){if(!_0x315f98){_0x9a00b[_0xeb78('0x1d')](0x194);}return _0x315f98;};}function handleError(_0x4bcdcf,_0x108052){_0x108052=_0x108052||0x1f4;return function(_0x515158){logger[_0xeb78('0x28')](_0x515158[_0xeb78('0x29')]);if(_0x515158[_0xeb78('0x2a')]){delete _0x515158['name'];}_0x4bcdcf[_0xeb78('0x1e')](_0x108052)[_0xeb78('0x2b')](_0x515158);};}exports[_0xeb78('0x2c')]=function(_0x381b2f,_0x3d4a97){var _0x3516b8={},_0x1131a9={},_0x22c25f={'count':0x0,'rows':[]};var _0x29d6cf=_[_0xeb78('0x2d')](db[_0xeb78('0x2e')]['rawAttributes'],function(_0x555d89){return{'name':_0x555d89['fieldName'],'type':_0x555d89[_0xeb78('0x2f')][_0xeb78('0x30')]};});_0x1131a9[_0xeb78('0x31')]=_['map'](_0x29d6cf,_0xeb78('0x2a'));_0x1131a9[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x381b2f[_0xeb78('0x32')]);_0x1131a9[_0xeb78('0x34')]=_[_0xeb78('0x35')](_0x1131a9[_0xeb78('0x31')],_0x1131a9[_0xeb78('0x32')]);_0x3516b8[_0xeb78('0x36')]=_['intersection'](_0x1131a9[_0xeb78('0x31')],qs['fields'](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x37')]));_0x3516b8[_0xeb78('0x36')]=_0x3516b8[_0xeb78('0x36')][_0xeb78('0x38')]?_0x3516b8[_0xeb78('0x36')]:_0x1131a9['model'];if(!_0x381b2f['query'][_0xeb78('0x39')](_0xeb78('0x3a'))){_0x3516b8[_0xeb78('0x3b')]=qs[_0xeb78('0x3b')](_0x381b2f[_0xeb78('0x32')]['limit']);_0x3516b8[_0xeb78('0x20')]=qs[_0xeb78('0x20')](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x20')]);}_0x3516b8[_0xeb78('0x3c')]=qs[_0xeb78('0x3d')](_0x381b2f['query']['sort']);_0x3516b8['where']=qs['filters'](_[_0xeb78('0x3e')](_0x381b2f[_0xeb78('0x32')],_0x1131a9[_0xeb78('0x34')]),_0x29d6cf);if(_0x381b2f['query'][_0xeb78('0x3f')]){_0x3516b8[_0xeb78('0x40')]=_['merge'](_0x3516b8['where'],{'$or':_['map'](_0x29d6cf,function(_0xbea3b8){if(_0xbea3b8[_0xeb78('0x2f')]!==_0xeb78('0x41')){var _0x4ea5e2={};_0x4ea5e2[_0xbea3b8[_0xeb78('0x2a')]]={'$like':'%'+_0x381b2f[_0xeb78('0x32')][_0xeb78('0x3f')]+'%'};return _0x4ea5e2;}})});}_0x3516b8=_['merge']({},_0x3516b8,_0x381b2f[_0xeb78('0x42')]);var _0x119848={'where':_0x3516b8[_0xeb78('0x40')]};return db[_0xeb78('0x2e')]['count'](_0x119848)['then'](function(_0x45eaa1){_0x22c25f[_0xeb78('0x22')]=_0x45eaa1;if(_0x381b2f[_0xeb78('0x32')][_0xeb78('0x43')]){_0x3516b8[_0xeb78('0x44')]=[{'all':!![]}];}return db[_0xeb78('0x2e')][_0xeb78('0x45')](_0x3516b8);})[_0xeb78('0x46')](function(_0x47567d){_0x22c25f['rows']=_0x47567d;return _0x22c25f;})[_0xeb78('0x46')](respondWithFilteredResult(_0x3d4a97,_0x3516b8))[_0xeb78('0x47')](handleError(_0x3d4a97,null));};exports[_0xeb78('0x48')]=function(_0x4dfb67,_0x382d6d){var _0x47d80b={'raw':!![],'where':{'id':_0x4dfb67[_0xeb78('0x49')]['id']}},_0x21f81b={};_0x21f81b[_0xeb78('0x31')]=_['keys'](db[_0xeb78('0x2e')][_0xeb78('0x4a')]);_0x21f81b[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x4dfb67[_0xeb78('0x32')]);_0x21f81b['filters']=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],_0x21f81b['query']);_0x47d80b[_0xeb78('0x36')]=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],qs['fields'](_0x4dfb67[_0xeb78('0x32')][_0xeb78('0x37')]));_0x47d80b[_0xeb78('0x36')]=_0x47d80b[_0xeb78('0x36')][_0xeb78('0x38')]?_0x47d80b[_0xeb78('0x36')]:_0x21f81b['model'];if(_0x4dfb67['query'][_0xeb78('0x43')]){_0x47d80b[_0xeb78('0x44')]=[{'all':!![]}];}_0x47d80b=_['merge']({},_0x47d80b,_0x4dfb67[_0xeb78('0x42')]);return db[_0xeb78('0x2e')][_0xeb78('0x4b')](_0x47d80b)[_0xeb78('0x46')](handleEntityNotFound(_0x382d6d,null))[_0xeb78('0x46')](respondWithResult(_0x382d6d,null))[_0xeb78('0x47')](handleError(_0x382d6d,null));};exports[_0xeb78('0x4c')]=function(_0x8b7c79,_0x9d5b17){return db[_0xeb78('0x2e')][_0xeb78('0x4c')](_0x8b7c79[_0xeb78('0x4d')],{})[_0xeb78('0x46')](respondWithResult(_0x9d5b17,0xc9))[_0xeb78('0x47')](handleError(_0x9d5b17,null));};exports[_0xeb78('0x4e')]=function(_0x58e361,_0x2c4616){if(_0x58e361[_0xeb78('0x4d')]['id']){delete _0x58e361[_0xeb78('0x4d')]['id'];}return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x58e361[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x2c4616,null))[_0xeb78('0x46')](saveUpdates(_0x58e361[_0xeb78('0x4d')],null))[_0xeb78('0x46')](respondWithResult(_0x2c4616,null))['catch'](handleError(_0x2c4616,null));};exports['destroy']=function(_0x553f6d,_0x438c20){return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x553f6d[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x438c20,null))[_0xeb78('0x46')](removeEntity(_0x438c20,null))['catch'](handleError(_0x438c20,null));};exports['describe']=function(_0x39a4d1,_0x48e2){return db[_0xeb78('0x2e')]['describe']()[_0xeb78('0x46')](respondWithResult(_0x48e2,null))[_0xeb78('0x47')](handleError(_0x48e2,null));}; \ No newline at end of file +var _0x4325=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','WhatsappTransferReport','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4325,0x1da));var _0x5432=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4325[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){_0x4af9f6[_0x5432('0x18')](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x637582,_0x4b6ea5){return function(_0xd9928a){if(!_0xd9928a){_0x637582[_0x5432('0x17')](0x194);}return _0xd9928a;};}function handleError(_0xe7eda2,_0x520da1){_0x520da1=_0x520da1||0x1f4;return function(_0x4ab09d){logger[_0x5432('0x26')](_0x4ab09d[_0x5432('0x27')]);if(_0x4ab09d['name']){delete _0x4ab09d[_0x5432('0x28')];}_0xe7eda2[_0x5432('0x18')](_0x520da1)[_0x5432('0x29')](_0x4ab09d);};}exports['index']=function(_0x29dc15,_0x5be867){var _0x4821be={},_0x6fc7f5={},_0x4a52ba={'count':0x0,'rows':[]};var _0x428141=_['map'](db['WhatsappTransferReport'][_0x5432('0x2a')],function(_0x21735e){return{'name':_0x21735e[_0x5432('0x2b')],'type':_0x21735e['type'][_0x5432('0x2c')]};});_0x6fc7f5[_0x5432('0x2d')]=_[_0x5432('0x2e')](_0x428141,_0x5432('0x28'));_0x6fc7f5[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x29dc15[_0x5432('0x2f')]);_0x6fc7f5[_0x5432('0x31')]=_[_0x5432('0x32')](_0x6fc7f5['model'],_0x6fc7f5['query']);_0x4821be[_0x5432('0x33')]=_[_0x5432('0x32')](_0x6fc7f5[_0x5432('0x2d')],qs[_0x5432('0x34')](_0x29dc15[_0x5432('0x2f')]['fields']));_0x4821be[_0x5432('0x33')]=_0x4821be['attributes'][_0x5432('0x35')]?_0x4821be[_0x5432('0x33')]:_0x6fc7f5[_0x5432('0x2d')];if(!_0x29dc15[_0x5432('0x2f')][_0x5432('0x36')](_0x5432('0x37'))){_0x4821be['limit']=qs[_0x5432('0x1e')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1e')]);_0x4821be[_0x5432('0x1d')]=qs['offset'](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1d')]);}_0x4821be[_0x5432('0x38')]=qs[_0x5432('0x39')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x39')]);_0x4821be[_0x5432('0x3a')]=qs[_0x5432('0x31')](_[_0x5432('0x3b')](_0x29dc15[_0x5432('0x2f')],_0x6fc7f5[_0x5432('0x31')]),_0x428141);if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x3c')]){_0x4821be[_0x5432('0x3a')]=_['merge'](_0x4821be[_0x5432('0x3a')],{'$or':_['map'](_0x428141,function(_0x6f5006){if(_0x6f5006[_0x5432('0x3d')]!==_0x5432('0x3e')){var _0x1a5561={};_0x1a5561[_0x6f5006['name']]={'$like':'%'+_0x29dc15['query']['filter']+'%'};return _0x1a5561;}})});}_0x4821be=_[_0x5432('0x3f')]({},_0x4821be,_0x29dc15[_0x5432('0x40')]);var _0x139d0a={'where':_0x4821be[_0x5432('0x3a')]};return db['WhatsappTransferReport'][_0x5432('0x1c')](_0x139d0a)[_0x5432('0x24')](function(_0x3cd343){_0x4a52ba['count']=_0x3cd343;if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x41')]){_0x4821be['include']=[{'all':!![]}];}return db[_0x5432('0x42')][_0x5432('0x43')](_0x4821be);})['then'](function(_0x23f8f4){_0x4a52ba['rows']=_0x23f8f4;return _0x4a52ba;})[_0x5432('0x24')](respondWithFilteredResult(_0x5be867,_0x4821be))[_0x5432('0x44')](handleError(_0x5be867,null));};exports[_0x5432('0x45')]=function(_0x11c7f2,_0x5cf59a){var _0x9cfb8b={'raw':!![],'where':{'id':_0x11c7f2[_0x5432('0x46')]['id']}},_0x4b93b4={};_0x4b93b4[_0x5432('0x2d')]=_[_0x5432('0x30')](db[_0x5432('0x42')][_0x5432('0x2a')]);_0x4b93b4[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x11c7f2['query']);_0x4b93b4[_0x5432('0x31')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],_0x4b93b4[_0x5432('0x2f')]);_0x9cfb8b[_0x5432('0x33')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],qs['fields'](_0x11c7f2[_0x5432('0x2f')][_0x5432('0x34')]));_0x9cfb8b[_0x5432('0x33')]=_0x9cfb8b[_0x5432('0x33')][_0x5432('0x35')]?_0x9cfb8b['attributes']:_0x4b93b4[_0x5432('0x2d')];if(_0x11c7f2['query'][_0x5432('0x41')]){_0x9cfb8b[_0x5432('0x47')]=[{'all':!![]}];}_0x9cfb8b=_['merge']({},_0x9cfb8b,_0x11c7f2[_0x5432('0x40')]);return db['WhatsappTransferReport'][_0x5432('0x48')](_0x9cfb8b)[_0x5432('0x24')](handleEntityNotFound(_0x5cf59a,null))['then'](respondWithResult(_0x5cf59a,null))['catch'](handleError(_0x5cf59a,null));};exports[_0x5432('0x49')]=function(_0xa971bd,_0x3718be){return db[_0x5432('0x42')][_0x5432('0x49')](_0xa971bd[_0x5432('0x4a')],{})[_0x5432('0x24')](respondWithResult(_0x3718be,0xc9))['catch'](handleError(_0x3718be,null));};exports[_0x5432('0x23')]=function(_0x14763c,_0x429da8){if(_0x14763c['body']['id']){delete _0x14763c['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x14763c[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x429da8,null))[_0x5432('0x24')](saveUpdates(_0x14763c[_0x5432('0x4a')],null))[_0x5432('0x24')](respondWithResult(_0x429da8,null))['catch'](handleError(_0x429da8,null));};exports[_0x5432('0x25')]=function(_0xce691b,_0x7937f9){return db['WhatsappTransferReport'][_0x5432('0x48')]({'where':{'id':_0xce691b[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x7937f9,null))[_0x5432('0x24')](removeEntity(_0x7937f9,null))[_0x5432('0x44')](handleError(_0x7937f9,null));};exports['describe']=function(_0xbcf523,_0x5bbedb){return db[_0x5432('0x42')]['describe']()[_0x5432('0x24')](respondWithResult(_0x5bbedb,null))[_0x5432('0x44')](handleError(_0x5bbedb,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 01e54ea..dd398a7 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 _0x44e4=['rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','api','moment'];(function(_0xbd3556,_0xe38bfa){var _0x4a2e2d=function(_0x26c0c2){while(--_0x26c0c2){_0xbd3556['push'](_0xbd3556['shift']());}};_0x4a2e2d(++_0xe38bfa);}(_0x44e4,0xd8));var _0x444e=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x44e4[_0x390a19];return _0x5d8230;};'use strict';var _=require(_0x444e('0x0'));var util=require(_0x444e('0x1'));var logger=require('../../config/logger')(_0x444e('0x2'));var moment=require(_0x444e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x444e('0x4'));var config=require('../../config/environment');var attributes=require(_0x444e('0x5'));module[_0x444e('0x6')]=function(_0x39c348,_0x1e77bf){return _0x39c348[_0x444e('0x7')](_0x444e('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x444e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x20ff=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d0f95,_0xd2b900){var _0x3cbe75=function(_0x11cb62){while(--_0x11cb62){_0x2d0f95['push'](_0x2d0f95['shift']());}};_0x3cbe75(++_0xd2b900);}(_0x20ff,0xf6));var _0xf20f=function(_0x55c4df,_0x2f6b74){_0x55c4df=_0x55c4df-0x0;var _0x899353=_0x20ff[_0x55c4df];return _0x899353;};'use strict';var _=require(_0xf20f('0x0'));var util=require(_0xf20f('0x1'));var logger=require(_0xf20f('0x2'))(_0xf20f('0x3'));var moment=require(_0xf20f('0x4'));var BPromise=require(_0xf20f('0x5'));var rp=require(_0xf20f('0x6'));var fs=require('fs');var path=require(_0xf20f('0x7'));var rimraf=require(_0xf20f('0x8'));var config=require(_0xf20f('0x9'));var attributes=require(_0xf20f('0xa'));module[_0xf20f('0xb')]=function(_0x2e8d58,_0x2f7e3a){return _0x2e8d58[_0xf20f('0xc')](_0xf20f('0xd'),attributes,{'tableName':_0xf20f('0xe'),'paranoid':![],'indexes':[{'name':_0xf20f('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index bb7fff0..3c19da2 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 _0xc985=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc985,0x1ce));var _0x5c98=function(_0x1a6596,_0x32d716){_0x1a6596=_0x1a6596-0x0;var _0x3c2fd6=_0xc985[_0x1a6596];return _0x3c2fd6;};'use strict';var _=require(_0x5c98('0x0'));var util=require('util');var moment=require(_0x5c98('0x1'));var BPromise=require(_0x5c98('0x2'));var rs=require(_0x5c98('0x3'));var fs=require('fs');var Redis=require(_0x5c98('0x4'));var db=require(_0x5c98('0x5'))['db'];var utils=require(_0x5c98('0x6'));var logger=require(_0x5c98('0x7'))(_0x5c98('0x8'));var config=require(_0x5c98('0x9'));var jayson=require(_0x5c98('0xa'));var client=jayson[_0x5c98('0xb')][_0x5c98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39fb0a,_0x4986bc,_0x5a8f32){return new BPromise(function(_0x273a0f,_0x32fe72){return client[_0x5c98('0xd')](_0x39fb0a,_0x5a8f32)[_0x5c98('0xe')](function(_0xfa4713){logger[_0x5c98('0xf')](_0x5c98('0x10'),_0x4986bc,_0x5c98('0x11'));logger[_0x5c98('0x12')](_0x5c98('0x13'),_0x4986bc,_0x5c98('0x11'),JSON[_0x5c98('0x14')](_0xfa4713));if(_0xfa4713[_0x5c98('0x15')]){if(_0xfa4713[_0x5c98('0x15')][_0x5c98('0x16')]===0x1f4){logger[_0x5c98('0x15')](_0x5c98('0x10'),_0x4986bc,_0xfa4713['error']['message']);return _0x32fe72(_0xfa4713[_0x5c98('0x15')]['message']);}logger['error'](_0x5c98('0x10'),_0x4986bc,_0xfa4713[_0x5c98('0x15')][_0x5c98('0x17')]);return _0x273a0f(_0xfa4713['error'][_0x5c98('0x17')]);}else{logger[_0x5c98('0xf')](_0x5c98('0x10'),_0x4986bc,_0x5c98('0x11'));_0x273a0f(_0xfa4713[_0x5c98('0x18')][_0x5c98('0x17')]);}})[_0x5c98('0x19')](function(_0x33aa95){logger[_0x5c98('0x15')](_0x5c98('0x10'),_0x4986bc,_0x33aa95);_0x32fe72(_0x33aa95);});});} \ No newline at end of file +var _0xf750=['jayson/promise','client','request','then','info','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x179805,_0x17d188){var _0x5654fa=function(_0x2083bb){while(--_0x2083bb){_0x179805['push'](_0x179805['shift']());}};_0x5654fa(++_0x17d188);}(_0xf750,0xef));var _0x0f75=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0xf750[_0x1fd4d7];return _0x7efe8a;};'use strict';var _=require(_0x0f75('0x0'));var util=require('util');var moment=require(_0x0f75('0x1'));var BPromise=require(_0x0f75('0x2'));var rs=require(_0x0f75('0x3'));var fs=require('fs');var Redis=require(_0x0f75('0x4'));var db=require(_0x0f75('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f75('0x6'))(_0x0f75('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f75('0x8'));var client=jayson[_0x0f75('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x499486,_0x31b411,_0x180e85){return new BPromise(function(_0x26a25a,_0x3a9c2f){return client[_0x0f75('0xa')](_0x499486,_0x180e85)[_0x0f75('0xb')](function(_0x255c30){logger[_0x0f75('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x31b411,_0x0f75('0xd'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x31b411,_0x0f75('0xd'),JSON['stringify'](_0x255c30));if(_0x255c30[_0x0f75('0xe')]){if(_0x255c30[_0x0f75('0xe')][_0x0f75('0xf')]===0x1f4){logger[_0x0f75('0xe')](_0x0f75('0x10'),_0x31b411,_0x255c30[_0x0f75('0xe')][_0x0f75('0x11')]);return _0x3a9c2f(_0x255c30[_0x0f75('0xe')][_0x0f75('0x11')]);}logger[_0x0f75('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x31b411,_0x255c30[_0x0f75('0xe')]['message']);return _0x26a25a(_0x255c30[_0x0f75('0xe')]['message']);}else{logger[_0x0f75('0xc')](_0x0f75('0x10'),_0x31b411,_0x0f75('0xd'));_0x26a25a(_0x255c30[_0x0f75('0x12')][_0x0f75('0x11')]);}})['catch'](function(_0x139f2c){logger[_0x0f75('0xe')](_0x0f75('0x10'),_0x31b411,_0x139f2c);_0x3a9c2f(_0x139f2c);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8acce14..d65aef4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa423=['filter','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','start','info','number','exitCode','length','pm2_env','name','Online\x20apps:'];(function(_0x42be3e,_0x4dcae9){var _0xe04278=function(_0xa247ea){while(--_0xa247ea){_0x42be3e['push'](_0x42be3e['shift']());}};_0xe04278(++_0x4dcae9);}(_0xa423,0x16c));var _0x3a42=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0xa423[_0x15a8fa];return _0x1355c2;};'use strict';var _=require(_0x3a42('0x0'));var db=require(_0x3a42('0x1'))['db'];var seedDb=require(_0x3a42('0x2'));var checkLicense=require(_0x3a42('0x3'));var rpc=require(_0x3a42('0x4'));var config=require('./config/environment');var logger=require(_0x3a42('0x5'))(_0x3a42('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x3a42('0x7'));var schedule=require(_0x3a42('0x8'));var chat=require(_0x3a42('0x9'));var whatsapp=require(_0x3a42('0xa'));var transcribe=require(_0x3a42('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x3a42('0xc')][_0x3a42('0xd')]()[_0x3a42('0xe')](function(){if(config[_0x3a42('0xf')]){return seedDb[_0x3a42('0x10')]();}})[_0x3a42('0xe')](function(){return checkLicense[_0x3a42('0x10')]();})[_0x3a42('0xe')](function(){return rpc[_0x3a42('0x11')]();})[_0x3a42('0xe')](function(_0x397559){logger['info'](_0x397559);return chat[_0x3a42('0x12')]();})[_0x3a42('0xe')](function(){return whatsapp[_0x3a42('0x12')]();})[_0x3a42('0xe')](function(){return schedule['start']();})['then'](function(){return transcribe[_0x3a42('0x12')]();})['then'](function(){return provider[_0x3a42('0x12')]();})[_0x3a42('0xe')](function(_0x198bf1){logger[_0x3a42('0x13')](_0x198bf1);return pm2[_0x3a42('0x12')](pm2Config);})[_0x3a42('0xe')](function(_0x5f5244){var _0xd32889=_0x5f5244['filter'](function(_0x469c73){return typeof _0x469c73['exitCode']===_0x3a42('0x14')&&_0x469c73[_0x3a42('0x15')]>=0x0;});if(_0xd32889[_0x3a42('0x16')]>0x0){throw new Error(_0xd32889['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0xd32889,function(_0x26c844){return'\x22'+_0x26c844[_0x3a42('0x17')][_0x3a42('0x18')]+'\x22';}));}logger[_0x3a42('0x13')](_0x3a42('0x19'),_['map'](_[_0x3a42('0x1a')](_0x5f5244,{'status':_0x3a42('0x1b')}),_0x3a42('0x18'))[_0x3a42('0x1c')]());logger[_0x3a42('0x13')](_0x3a42('0x1d'),_['map'](_[_0x3a42('0x1a')](_0x5f5244,function(_0x3f4afb){return _0x3f4afb[_0x3a42('0x1e')]!==_0x3a42('0x1b');}),_0x3a42('0x18'))['join']()||_0x3a42('0x1f'));console[_0x3a42('0x20')](_0x3a42('0x21'));})[_0x3a42('0x22')](function(_0x44c6e7){console['log'](_0x3a42('0x23'),_0x44c6e7);logger[_0x3a42('0x24')](_0x3a42('0x25'),_0x44c6e7);process[_0x3a42('0x26')](0x1);});}main(); \ No newline at end of file +var _0xe9e7=['./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','seedDB','default','then','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','join','status','online','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2'];(function(_0x433dfc,_0x1a5ac7){var _0x514417=function(_0x2ca36e){while(--_0x2ca36e){_0x433dfc['push'](_0x433dfc['shift']());}};_0x514417(++_0x1a5ac7);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x37f6bc,_0x2b04fe){_0x37f6bc=_0x37f6bc-0x0;var _0xc77992=_0xe9e7[_0x37f6bc];return _0xc77992;};'use strict';var _=require(_0x7e9e('0x0'));var db=require(_0x7e9e('0x1'))['db'];var seedDb=require(_0x7e9e('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x7e9e('0x3'));var config=require(_0x7e9e('0x4'));var logger=require(_0x7e9e('0x5'))(_0x7e9e('0x6'));var pm2=require(_0x7e9e('0x7'));var pm2Config=require(_0x7e9e('0x8'));var schedule=require(_0x7e9e('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x7e9e('0xa'));var transcribe=require(_0x7e9e('0xb'));var provider=require(_0x7e9e('0xc'));function main(){return db['sequelize'][_0x7e9e('0xd')]()['then'](function(){if(config[_0x7e9e('0xe')]){return seedDb[_0x7e9e('0xf')]();}})[_0x7e9e('0x10')](function(){return checkLicense[_0x7e9e('0xf')]();})[_0x7e9e('0x10')](function(){return rpc[_0x7e9e('0x11')]();})[_0x7e9e('0x10')](function(_0x399920){logger[_0x7e9e('0x12')](_0x399920);return chat[_0x7e9e('0x13')]();})[_0x7e9e('0x10')](function(){return whatsapp[_0x7e9e('0x13')]();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0x7e9e('0x13')]();})[_0x7e9e('0x10')](function(){return provider[_0x7e9e('0x13')]();})[_0x7e9e('0x10')](function(_0x4c13a8){logger['info'](_0x4c13a8);return pm2[_0x7e9e('0x13')](pm2Config);})[_0x7e9e('0x10')](function(_0x1b59d1){var _0x299be7=_0x1b59d1[_0x7e9e('0x14')](function(_0x89bb24){return typeof _0x89bb24[_0x7e9e('0x15')]==='number'&&_0x89bb24[_0x7e9e('0x15')]>=0x0;});if(_0x299be7['length']>0x0){throw new Error(_0x299be7[_0x7e9e('0x16')]+_0x7e9e('0x17')+_[_0x7e9e('0x18')](_0x299be7,function(_0x1d973c){return'\x22'+_0x1d973c[_0x7e9e('0x19')][_0x7e9e('0x1a')]+'\x22';}));}logger[_0x7e9e('0x12')]('Online\x20apps:',_[_0x7e9e('0x18')](_[_0x7e9e('0x14')](_0x1b59d1,{'status':'online'}),'name')[_0x7e9e('0x1b')]());logger['info']('Offline\x20apps:',_[_0x7e9e('0x18')](_[_0x7e9e('0x14')](_0x1b59d1,function(_0x35914e){return _0x35914e[_0x7e9e('0x1c')]!==_0x7e9e('0x1d');}),_0x7e9e('0x1a'))[_0x7e9e('0x1b')]()||_0x7e9e('0x1e'));console[_0x7e9e('0x1f')]('App\x20Ready!');})[_0x7e9e('0x20')](function(_0x35c57c){console[_0x7e9e('0x1f')](_0x7e9e('0x21'),_0x35c57c);logger['error'](_0x7e9e('0x22'),_0x35c57c);process[_0x7e9e('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index f675547..1c235d4 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['util','moment','session','role','fullname','name','internal','userpic','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','then','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','join','promisify','secret','secrets','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird'];(function(_0xdfe66,_0x3f525e){var _0x47701a=function(_0x6dbabf){while(--_0x6dbabf){_0xdfe66['push'](_0xdfe66['shift']());}};_0x47701a(++_0x3f525e);}(_0x3e74,0x175));var _0x43e7=function(_0xa97e05,_0x3f612e){_0xa97e05=_0xa97e05-0x0;var _0x60f682=_0x3e74[_0xa97e05];return _0x60f682;};'use strict';var db=require(_0x43e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x43e7('0x1'));var licenseUtil=require(_0x43e7('0x2'));var encryptor=require(_0x43e7('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x43e7('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x43e7('0x5'));var crypto=require(_0x43e7('0x6'));var BPromise=require(_0x43e7('0x7'));var util=require(_0x43e7('0x8'));var moment=require(_0x43e7('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x43e7('0xa')]});var userAttributes=['id',_0x43e7('0xb'),_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xe'),'email',_0x43e7('0xf'),'permissions','md5secret',_0x43e7('0x10'),_0x43e7('0x11'),'mailPause',_0x43e7('0x12'),'smsPause',_0x43e7('0x13'),_0x43e7('0x14'),'showWebBar',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),'passwordResetAt','alias',_0x43e7('0x19'),_0x43e7('0x1a'),_0x43e7('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x43e7('0x1c'),_0x43e7('0x1d'),_0x43e7('0x1e'),_0x43e7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0x43e7('0x20'),_0x43e7('0x21'),_0x43e7('0x22'),'settingsEnabled','wssPort',_0x43e7('0x23'),_0x43e7('0x24'),_0x43e7('0x25'),_0x43e7('0x26'),_0x43e7('0x27'),_0x43e7('0x28'),_0x43e7('0x29'),_0x43e7('0x2a'),_0x43e7('0x2b'),_0x43e7('0x2c'),_0x43e7('0x2d'),_0x43e7('0x2e'),'openchannelAutoanswerDelay',_0x43e7('0x2f'),_0x43e7('0x30'),'whatsappAutoanswer',_0x43e7('0x31')];exports[_0x43e7('0x32')]=function(){return this[_0x43e7('0x33')](!![])[_0x43e7('0x34')](function(_0x4077fb,_0x2f4cb4,_0x54a9e7){if(_0x4077fb[_0x43e7('0x35')]){_0x54a9e7();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x4077fb[_0x43e7('0x36')]['id']},'attributes':['id',_0x43e7('0x37'),'disposition'],'raw':!![]})[_0x43e7('0x38')](function(_0x4ca5cf){if(_0x4ca5cf&&_0x4ca5cf[_0x43e7('0x37')]){return _0x2f4cb4['status'](_0x4ca5cf[_0x43e7('0x39')]===_0x43e7('0x3a')?0x195:0x193)[_0x43e7('0x3b')]({'message':_0x4ca5cf[_0x43e7('0x39')]==='unmanaged'?'Unmanaged.':_0x43e7('0x3c')});}else{_0x54a9e7();}})['catch'](function(_0x2dd5f){_0x54a9e7(_0x2dd5f);});}});};exports[_0x43e7('0x33')]=function isAuthenticated(_0x3565cf){return compose()[_0x43e7('0x34')](function(_0x5087d7,_0x33a1a5,_0x4690a6){var _0x45b675;if(_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')]){if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')],_0x43e7('0x40'))){var _0x35dbcd=basicAuth(_0x5087d7);db[_0x43e7('0x41')][_0x43e7('0x42')]({'where':{'name':_0x35dbcd[_0x43e7('0xd')]}})[_0x43e7('0x38')](function(_0x4bdb17){if(!_0x4bdb17||!_0x4bdb17[_0x43e7('0x43')](_0x35dbcd[_0x43e7('0x44')])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x46')});}_0x5087d7['user']={'id':_0x4bdb17['id']};_0x4690a6();})[_0x43e7('0x47')](function(_0x49b83d){_0x4690a6(_0x49b83d);});}else if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')]['authorization'],'Bearer')){validateJwt(_0x5087d7,_0x33a1a5,_0x4690a6);}else{if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5['status'](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x48')});}}}else if(_0x5087d7[_0x43e7('0x49')][_0x43e7('0x4a')]){try{var _0x108313={'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5087d7['query']['apikey'],_0x108313)['then'](function(_0x4e8e86){return db['User']['find']({'where':{'id':_0x4e8e86[_0x43e7('0x4c')]}})['then'](function(_0x2b4bfd){_0x45b675=_0x2b4bfd;return db[_0x43e7('0x4d')][_0x43e7('0x4e')]({'where':{'id':0x1},'attributes':[_0x43e7('0x4f'),_0x43e7('0x50')],'raw':!![]});})[_0x43e7('0x38')](function(_0x101d45){if(!_0x45b675||!_['isEqual'](_0x45b675['apiKeyNonce'],_0x4e8e86['nonce'])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x51')});}if(_0x45b675[_0x43e7('0x52')]){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}if(_0x45b675[_0x43e7('0x54')]){if(_0x101d45['blockDuration']>0x0){if(moment(_0x45b675[_0x43e7('0x55')])[_0x43e7('0x56')](_0x101d45['blockDuration'],_0x43e7('0x57'))>moment()){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}else{return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}_0x5087d7[_0x43e7('0x35')]={'id':_0x45b675['id']};_0x4690a6();});})['catch'](function(){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});});}catch(_0x44b6ae){_0x4690a6(_0x44b6ae);}}else if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x43e7('0x34')](function(_0x4227c4,_0x575439,_0x3628e0){if(_0x4227c4['user']){db[_0x43e7('0x41')]['find']({'where':{'id':_0x4227c4[_0x43e7('0x35')]['id']},'attributes':userAttributes})[_0x43e7('0x38')](function(_0x3a5807){if(!_0x3a5807){return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4227c4[_0x43e7('0x35')]=_0x3a5807;_0x3628e0();})[_0x43e7('0x47')](function(_0xe979b5){_0x3628e0(_0xe979b5);});}else if(_0x3565cf){_0x3628e0();}else{return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x43e7('0x34')](function(_0x57f5d0,_0x2ab022,_0x4b3a59){return licenseUtil['getLicense']()[_0x43e7('0x38')](function(_0x5ee1c5){if(_0x5ee1c5[_0x43e7('0x58')]){_0x4b3a59();}else{return _0x2ab022[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x59')});}})['catch'](function(_0x91f1e4){_0x4b3a59(_0x91f1e4);});});};exports[_0x43e7('0x5a')]=function isWebrtcLicence(){return compose()[_0x43e7('0x34')](function(_0x1fd277,_0x296dc8,_0x1efe59){return licenseUtil['getLicense']()['then'](function(_0x3bc9de){if(_0x3bc9de[_0x43e7('0x5b')]){_0x1efe59();}else{return _0x296dc8[_0x43e7('0x45')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x292ded){_0x1efe59(_0x292ded);});});};exports[_0x43e7('0x5c')]=function(_0x52b098,_0x351ca2,_0x47686e){_0x52b098[_0x43e7('0x5c')]=!![];return _0x47686e();};exports['signToken']=function signToken(_0x593155){return signJwt(_0x593155);};exports['setTokenCookie']=function(_0x4de644,_0x214e7e){if(!_0x4de644[_0x43e7('0x35')]){return _0x214e7e['status'](0x194)[_0x43e7('0x3b')]({'message':_0x43e7('0x5d')});}var _0x426bcb={'payload':{'id':_0x4de644[_0x43e7('0x35')]['id'],'role':_0x4de644['user'][_0x43e7('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x426bcb)['then'](function(_0x4bebd4){_0x214e7e[_0x43e7('0x5e')](_0x43e7('0x5f'),_0x4bebd4);_0x214e7e[_0x43e7('0x60')](_0x43e7('0x61'));})[_0x43e7('0x47')](function(_0x2351cf){return _0x214e7e[_0x43e7('0x45')](0x1f4)[_0x43e7('0x62')](_0x2351cf);});};exports[_0x43e7('0x63')]=function(_0x2b5515){if(_['isNil'](_0x2b5515[_0x43e7('0x64')])||_[_0x43e7('0x65')](_0x2b5515['apiKeyIat'])){return null;}else{return createJwt(_0x2b5515);}};exports[_0x43e7('0x66')]=function(_0x4e6f6d){_0x4e6f6d[_0x43e7('0x64')]=generateNonce();_0x4e6f6d[_0x43e7('0x67')]=generateIssuedAt();return createJwt(_0x4e6f6d);};exports[_0x43e7('0x68')]=function(_0x1f561f,_0xfe13fa){var _0x5e5556=_0x1f561f['query'][_0x43e7('0x4a')];if(_0x5e5556){var _0x2ab7ee={'nonce':_0xfe13fa[_0x43e7('0x64')],'iat':_0xfe13fa[_0x43e7('0x67')],'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf[_0x43e7('0x4b')]()};return verifyJwt(_0x5e5556,_0x2ab7ee)[_0x43e7('0x38')](function(){return generateApiKey(_0xfe13fa);});}else{throw{'message':_0x43e7('0x69')};}};exports[_0x43e7('0x6a')]=function(_0x24e758){var _0x312306=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x312306['test'](_0x24e758))throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x43e7('0x6d')]=function(_0x220bf2,_0x2d0052,_0x558d54){var _0x5d63c6=encryptor[_0x43e7('0x6e')](_0x2d0052)[_0x43e7('0x6f')](',');for(var _0x4ebdde=0x0;_0x4ebdde<_0x558d54;_0x4ebdde++){if(!_0x5d63c6[_0x4ebdde])break;if(_0x220bf2[_0x43e7('0x70')]()===_0x5d63c6[_0x4ebdde]['toLowerCase']()){var _0x49a6ce=util[_0x43e7('0x71')](_0x43e7('0x72'),_0x558d54);if(_0x558d54===0x1){_0x49a6ce=_0x43e7('0x73');}throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))](_0x49a6ce);}}return;};exports['updatePasswordsHistory']=function(_0xc3976,_0xdb9fbe){var _0x4d89bd=_0xdb9fbe?encryptor[_0x43e7('0x6e')](_0xdb9fbe)[_0x43e7('0x6f')](','):[];if(_0x4d89bd[_0x43e7('0x74')]===0x5){_0x4d89bd['splice'](-0x1,0x1);}_0x4d89bd['unshift'](_0xc3976);return encryptor['encryptString'](_0x4d89bd[_0x43e7('0x75')](','));};function signJwt(_0x4058ce){var _0x323cf7=BPromise[_0x43e7('0x76')](jwt['sign'],{'context':jwt});var _0x5a50fc=_0x4058ce[_0x43e7('0x77')]||config[_0x43e7('0x78')][_0x43e7('0xa')];return new BPromise(function(_0x5dd349,_0x5ea0db){_0x323cf7(_0x4058ce[_0x43e7('0x79')],_0x5a50fc,_0x4058ce[_0x43e7('0x7a')])[_0x43e7('0x38')](function(_0x2a194d){_0x5dd349(_0x2a194d);})[_0x43e7('0x47')](function(_0xd41e79){_0x5ea0db(_0xd41e79);});});}function verifyJwt(_0x4665db,_0x46748f,_0x406155){var _0x381208=BPromise[_0x43e7('0x76')](jwt['verify'],{'context':jwt});var _0x5f3824=_0x406155||config[_0x43e7('0x78')]['session'];return new BPromise(function(_0x501616,_0x50edb2){_0x381208(_0x4665db,_0x5f3824,_0x46748f)[_0x43e7('0x38')](function(_0xe666b0){_0x501616(_0xe666b0);})['catch'](function(_0xfe5a8d){_0x50edb2(_0xfe5a8d);});});}function generateNonce(){return crypto[_0x43e7('0x7b')](0x10)[_0x43e7('0x7c')]('hex');}function generateIssuedAt(){return Math[_0x43e7('0x7d')](Date[_0x43e7('0x7e')]()/0x3e8)[_0x43e7('0x7c')]();}function createJwt(_0xc9723){var _0x2f43d7={'payload':{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723[_0x43e7('0x64')]},'options':{'algorithm':'HS512','subject':_0xc9723['id'][_0x43e7('0x7c')](),'issuer':hardwareConf[_0x43e7('0x4b')](),'audience':hardwareConf[_0x43e7('0x4b')]()}};return signJwt(_0x2f43d7)['then'](function(_0x56b06d){return{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723['apiKeyNonce'],'token':_0x56b06d};});} \ No newline at end of file +var _0x9c44=['showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','find','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','sign','options','promisify','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','moment','secrets','session','role','name','internal','email','userpic','voicePause','chatPause','faxPause','smsPause'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x49c4('0x0'));var licenseUtil=require(_0x49c4('0x1'));var encryptor=require(_0x49c4('0x2'));var _=require(_0x49c4('0x3'));var jwt=require(_0x49c4('0x4'));var expressJwt=require(_0x49c4('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x49c4('0x6'));var BPromise=require('bluebird');var util=require(_0x49c4('0x7'));var moment=require(_0x49c4('0x8'));var validateJwt=expressJwt({'secret':config[_0x49c4('0x9')][_0x49c4('0xa')]});var userAttributes=['id',_0x49c4('0xb'),'fullname',_0x49c4('0xc'),_0x49c4('0xd'),_0x49c4('0xe'),_0x49c4('0xf'),'permissions','md5secret',_0x49c4('0x10'),_0x49c4('0x11'),'mailPause',_0x49c4('0x12'),_0x49c4('0x13'),'openchannelPause','pauseType',_0x49c4('0x14'),_0x49c4('0x15'),'lastPauseAt',_0x49c4('0x16'),_0x49c4('0x17'),'passwordResetAt',_0x49c4('0x18'),_0x49c4('0x19'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),'phoneBarPrefixRequired',_0x49c4('0x20'),_0x49c4('0x21'),_0x49c4('0x22'),_0x49c4('0x23'),_0x49c4('0x24'),'privacyEnabled',_0x49c4('0x25'),_0x49c4('0x26'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x49c4('0x27'),_0x49c4('0x28'),_0x49c4('0x29'),'chatAutoanswer',_0x49c4('0x2a'),'emailAutoanswer',_0x49c4('0x2b'),_0x49c4('0x2c'),_0x49c4('0x2d'),_0x49c4('0x2e'),_0x49c4('0x2f'),_0x49c4('0x30'),_0x49c4('0x31'),_0x49c4('0x32'),_0x49c4('0x33')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x1c99b1,_0x4f0b62,_0x592bb8){if(_0x1c99b1[_0x49c4('0x34')]){_0x592bb8();}else{return db[_0x49c4('0x35')][_0x49c4('0x36')]({'where':{'id':_0x1c99b1[_0x49c4('0x37')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x49c4('0x38')](function(_0x9cb797){if(_0x9cb797&&_0x9cb797['closed']){return _0x4f0b62[_0x49c4('0x39')](_0x9cb797[_0x49c4('0x3a')]===_0x49c4('0x3b')?0x195:0x193)[_0x49c4('0x3c')]({'message':_0x9cb797['disposition']==='unmanaged'?_0x49c4('0x3d'):'Forbidden.'});}else{_0x592bb8();}})[_0x49c4('0x3e')](function(_0x3852b2){_0x592bb8(_0x3852b2);});}});};exports[_0x49c4('0x3f')]=function isAuthenticated(_0x372a47){return compose()['use'](function(_0x889909,_0x2b2793,_0x46e04d){var _0x4f28a2;if(_0x889909[_0x49c4('0x40')][_0x49c4('0x41')]){if(_[_0x49c4('0x42')](_0x889909[_0x49c4('0x40')][_0x49c4('0x41')],_0x49c4('0x43'))){var _0x46f7ea=basicAuth(_0x889909);db['User']['find']({'where':{'name':_0x46f7ea['name']}})[_0x49c4('0x38')](function(_0x7ee704){if(!_0x7ee704||!_0x7ee704[_0x49c4('0x44')](_0x46f7ea[_0x49c4('0x45')])){return _0x2b2793[_0x49c4('0x39')](0x191)['json']({'message':_0x49c4('0x46')});}_0x889909[_0x49c4('0x34')]={'id':_0x7ee704['id']};_0x46e04d();})[_0x49c4('0x3e')](function(_0x24bba9){_0x46e04d(_0x24bba9);});}else if(_['startsWith'](_0x889909['headers'][_0x49c4('0x41')],_0x49c4('0x47'))){validateJwt(_0x889909,_0x2b2793,_0x46e04d);}else{if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}}}else if(_0x889909['query'][_0x49c4('0x49')]){try{var _0x84c621={'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x889909['query'][_0x49c4('0x49')],_0x84c621)[_0x49c4('0x38')](function(_0x3bec0a){return db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x3bec0a[_0x49c4('0x4d')]}})[_0x49c4('0x38')](function(_0x27ef5f){_0x4f28a2=_0x27ef5f;return db[_0x49c4('0x4e')]['findOne']({'where':{'id':0x1},'attributes':[_0x49c4('0x4f'),'blockDuration'],'raw':!![]});})[_0x49c4('0x38')](function(_0x349791){if(!_0x4f28a2||!_[_0x49c4('0x50')](_0x4f28a2[_0x49c4('0x51')],_0x3bec0a['nonce'])){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x52')});}if(_0x4f28a2['disabled']){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}if(_0x4f28a2[_0x49c4('0x54')]){if(_0x349791[_0x49c4('0x55')]>0x0){if(moment(_0x4f28a2[_0x49c4('0x56')])[_0x49c4('0x57')](_0x349791[_0x49c4('0x55')],_0x49c4('0x58'))>moment()){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}}_0x889909[_0x49c4('0x34')]={'id':_0x4f28a2['id']};_0x46e04d();});})[_0x49c4('0x3e')](function(){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});});}catch(_0x248c0a){_0x46e04d(_0x248c0a);}}else if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}})[_0x49c4('0x59')](function(_0x4e38bc,_0x212366,_0x49829e){if(_0x4e38bc[_0x49c4('0x34')]){db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x4e38bc[_0x49c4('0x34')]['id']},'attributes':userAttributes})[_0x49c4('0x38')](function(_0x281b83){if(!_0x281b83){return _0x212366['status'](0x194)['json']({'message':_0x49c4('0x5a')});}_0x4e38bc[_0x49c4('0x34')]=_0x281b83;_0x49829e();})[_0x49c4('0x3e')](function(_0x117151){_0x49829e(_0x117151);});}else if(_0x372a47){_0x49829e();}else{return _0x212366['status'](0x194)[_0x49c4('0x3c')]({'message':_0x49c4('0x5b')});}});};exports[_0x49c4('0x5c')]=function canUpdate(){return compose()[_0x49c4('0x59')](function(_0x81a674,_0x3bde49,_0x1a9593){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5640d3){if(_0x5640d3[_0x49c4('0x5e')]){_0x1a9593();}else{return _0x3bde49['status'](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x5f')});}})[_0x49c4('0x3e')](function(_0x258abe){_0x1a9593(_0x258abe);});});};exports[_0x49c4('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x592e8e,_0x15b674,_0x384862){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5d4790){if(_0x5d4790[_0x49c4('0x61')]){_0x384862();}else{return _0x15b674['status'](0x193)[_0x49c4('0x3c')]({'message':'Forbidden'});}})[_0x49c4('0x3e')](function(_0x906d3){_0x384862(_0x906d3);});});};exports[_0x49c4('0x62')]=function(_0x27adfe,_0x2d8087,_0x30bea5){_0x27adfe[_0x49c4('0x62')]=!![];return _0x30bea5();};exports['signToken']=function signToken(_0x3b731f){return signJwt(_0x3b731f);};exports[_0x49c4('0x63')]=function(_0x4a5c34,_0x1e1ac4){if(!_0x4a5c34[_0x49c4('0x34')]){return _0x1e1ac4[_0x49c4('0x39')](0x194)[_0x49c4('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d8bf0={'payload':{'id':_0x4a5c34[_0x49c4('0x34')]['id'],'role':_0x4a5c34['user'][_0x49c4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d8bf0)[_0x49c4('0x38')](function(_0x3811b2){_0x1e1ac4[_0x49c4('0x64')](_0x49c4('0x65'),_0x3811b2);_0x1e1ac4[_0x49c4('0x66')](_0x49c4('0x67'));})['catch'](function(_0x1f26c2){return _0x1e1ac4[_0x49c4('0x39')](0x1f4)[_0x49c4('0x68')](_0x1f26c2);});};exports[_0x49c4('0x69')]=function(_0x17ef75){if(_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x51')])||_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x6b')])){return null;}else{return createJwt(_0x17ef75);}};exports[_0x49c4('0x6c')]=function(_0x5b822f){_0x5b822f['apiKeyNonce']=generateNonce();_0x5b822f[_0x49c4('0x6b')]=generateIssuedAt();return createJwt(_0x5b822f);};exports[_0x49c4('0x6d')]=function(_0x527e74,_0x59a8bc){var _0x77163d=_0x527e74['query']['apikey'];if(_0x77163d){var _0x3208c2={'nonce':_0x59a8bc[_0x49c4('0x51')],'iat':_0x59a8bc[_0x49c4('0x6b')],'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf[_0x49c4('0x4a')]()};return verifyJwt(_0x77163d,_0x3208c2)[_0x49c4('0x38')](function(){return generateApiKey(_0x59a8bc);});}else{throw{'message':_0x49c4('0x6e')};}};exports['validatePasswordPattern']=function(_0x859dde){var _0xcc6a2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xcc6a2b[_0x49c4('0x6f')](_0x859dde))throw new db[(_0x49c4('0x70'))][(_0x49c4('0x71'))](_0x49c4('0x72'));return;};exports['validatePasswordHistory']=function(_0x5c7ddd,_0x1ef0c1,_0x155c43){var _0x2a6308=encryptor[_0x49c4('0x73')](_0x1ef0c1)[_0x49c4('0x74')](',');for(var _0x6b2592=0x0;_0x6b2592<_0x155c43;_0x6b2592++){if(!_0x2a6308[_0x6b2592])break;if(_0x5c7ddd[_0x49c4('0x75')]()===_0x2a6308[_0x6b2592]['toLowerCase']()){var _0x45d715=util[_0x49c4('0x76')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x155c43);if(_0x155c43===0x1){_0x45d715=_0x49c4('0x77');}throw new db['Sequelize'][(_0x49c4('0x71'))](_0x45d715);}}return;};exports[_0x49c4('0x78')]=function(_0x9eaa84,_0x2fe89a){var _0x845f7e=_0x2fe89a?encryptor[_0x49c4('0x73')](_0x2fe89a)[_0x49c4('0x74')](','):[];if(_0x845f7e[_0x49c4('0x79')]===0x5){_0x845f7e['splice'](-0x1,0x1);}_0x845f7e[_0x49c4('0x7a')](_0x9eaa84);return encryptor[_0x49c4('0x7b')](_0x845f7e['join'](','));};function signJwt(_0x10dec7){var _0x299e74=BPromise['promisify'](jwt[_0x49c4('0x7c')],{'context':jwt});var _0x42e0e6=_0x10dec7['secret']||config['secrets']['session'];return new BPromise(function(_0x513879,_0xc43386){_0x299e74(_0x10dec7['payload'],_0x42e0e6,_0x10dec7[_0x49c4('0x7d')])[_0x49c4('0x38')](function(_0x515240){_0x513879(_0x515240);})[_0x49c4('0x3e')](function(_0xdb2b33){_0xc43386(_0xdb2b33);});});}function verifyJwt(_0x5ac9f0,_0x34272f,_0x3dcf4c){var _0x167e84=BPromise[_0x49c4('0x7e')](jwt['verify'],{'context':jwt});var _0x431921=_0x3dcf4c||config[_0x49c4('0x9')][_0x49c4('0xa')];return new BPromise(function(_0x20e97d,_0x5d3375){_0x167e84(_0x5ac9f0,_0x431921,_0x34272f)[_0x49c4('0x38')](function(_0x4a93bc){_0x20e97d(_0x4a93bc);})['catch'](function(_0x58259d){_0x5d3375(_0x58259d);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x49c4('0x7f')](_0x49c4('0x80'));}function generateIssuedAt(){return Math[_0x49c4('0x81')](Date[_0x49c4('0x82')]()/0x3e8)['toString']();}function createJwt(_0x4daa6d){var _0x340523={'payload':{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d[_0x49c4('0x51')]},'options':{'algorithm':_0x49c4('0x83'),'subject':_0x4daa6d['id'][_0x49c4('0x7f')](),'issuer':hardwareConf[_0x49c4('0x4a')](),'audience':hardwareConf[_0x49c4('0x4a')]()}};return signJwt(_0x340523)[_0x49c4('0x38')](function(_0x4d49e0){return{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d['apiKeyNonce'],'token':_0x4d49e0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index bfe4d81..8e7090e 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 _0xbaf0=['skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','clause','tags','user'];(function(_0x10302d,_0x3521e3){var _0x295324=function(_0x503b41){while(--_0x503b41){_0x10302d['push'](_0x10302d['shift']());}};_0x295324(++_0x3521e3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0baf('0x0'));var db=require(_0x0baf('0x1'))['db'];exports[_0x0baf('0x2')]=function(_0x263f79,_0x1688bc,_0x4d2e72,_0x5a3e42){var _0x232cc7={'count':0x0,'rows':[]};var _0x1c383e=sqlUtils[_0x0baf('0x3')](_0x1688bc,_0x263f79);if(_0x1c383e){return Promise[_0x0baf('0x4')](_0x232cc7);}var _0xe4c3c4=sqlUtils[_0x0baf('0x5')]();var _0x1a10b1={};var _0x2dcaac=![];var _0x1d0a0d=![];return Promise['resolve']()[_0x0baf('0x6')](function(){if(_0x263f79['search']){return sqlUtils[_0x0baf('0x7')](_0x263f79[_0x0baf('0x8')],_0x5a3e42);}else{return sqlUtils[_0x0baf('0x9')](_0x263f79,_0x5a3e42);}})[_0x0baf('0x6')](function(_0x7f54d4){_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xb')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xc')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xd')]);_0xe4c3c4['where'](_0x7f54d4['user'][_0x0baf('0xe')]);_0x1a10b1=_0x7f54d4[_0x0baf('0xf')];_0x1d0a0d=_0x7f54d4[_0x0baf('0x10')][_0x0baf('0x11')];return sqlUtils['checkListsRestrictions'](_0x1688bc,_0x263f79,_0x1d0a0d);})[_0x0baf('0x6')](function(_0x49e44b){_0xe4c3c4[_0x0baf('0xa')](_0x49e44b);var _0x1f50c3=_0x263f79[_0x0baf('0x8')]?_0x1a10b1[_0x0baf('0x12')]:_0x263f79[_0x0baf('0x13')];_0x2dcaac=_0x1f50c3?!![]:![];return sqlUtils[_0x0baf('0x14')](_0xe4c3c4,_0x1f50c3);})['then'](function(_0x4cd79d){_0x232cc7[_0x0baf('0x15')]=_0x4cd79d;if(_0x232cc7[_0x0baf('0x15')]===0x0){return;}return sqlUtils[_0x0baf('0x16')](_0xe4c3c4,_0x263f79[_0x0baf('0xc')],_0x4d2e72,_0x2dcaac,_0x1a10b1[_0x0baf('0xe')],_0x1d0a0d);})[_0x0baf('0x6')](function(_0x53c338){if(!_0x53c338){return[];}return sqlUtils[_0x0baf('0x17')](_0x53c338,_0x263f79,_0x4d2e72);})[_0x0baf('0x6')](function(_0x1ef0e5){_0x232cc7[_0x0baf('0x18')]=_0x1ef0e5;return _0x232cc7;})[_0x0baf('0x19')](function(_0x42b7f2){throw _0x42b7f2;});};exports['describe']=function(){var _0x5cff5d={};var _0x1410ec=[];return db[_0x0baf('0x1a')][_0x0baf('0x1b')]()[_0x0baf('0x6')](function(_0x1fa92b){_0x5cff5d=_0x1fa92b;var _0x3e3e20=Object[_0x0baf('0x1c')](_0x5cff5d)[_0x0baf('0xd')](function(_0x2c42e2){return _[_0x0baf('0x1d')](_0x2c42e2,'cf_')?_0x2c42e2:undefined;});var _0x334bd6=_0x3e3e20['map'](function(_0xf6c158){return db['CmCustomField']['findOne']({'where':{'id':_0xf6c158[_0x0baf('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x334bd6);})['then'](function(_0x47c4b){for(var _0x27b59c=0x0;_0x27b59c<_0x47c4b[_0x0baf('0x1f')];_0x27b59c++){if(_0x47c4b[_0x27b59c]){var _0x19d9fd=_0x0baf('0x20')+_0x47c4b[_0x27b59c]['id'];_0x5cff5d[_0x19d9fd]['fieldType']=_0x47c4b[_0x27b59c][_0x0baf('0x21')];}}_0x1410ec=_[_0x0baf('0x22')](Object[_0x0baf('0x1c')](_0x5cff5d),function(_0x366e71){return{'name':_0x366e71,'type':_0x5cff5d[_0x366e71][_0x0baf('0x21')]};});return _0x1410ec;})[_0x0baf('0x19')](function(_0x453525){throw _0x453525;});}; \ No newline at end of file +var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x1b7339,_0x4e9173){var _0x3e982c=function(_0x287fae){while(--_0x287fae){_0x1b7339['push'](_0x1b7339['shift']());}};_0x3e982c(++_0x4e9173);}(_0x2032,0xd9));var _0x2203=function(_0x233459,_0x33a1b3){_0x233459=_0x233459-0x0;var _0x3ce32f=_0x2032[_0x233459];return _0x3ce32f;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 844708e..a13c228 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 _0x70a3=['map','tags','and','ids','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','clause','filter','resolve','agent','getLists','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','t.id\x20IN\x20?','Sequelize','toString','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','subqry','firstName','lastName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','default','text','start','Tag','value'];(function(_0x3ebf12,_0x8757b7){var _0x1dc6c7=function(_0x132bf2){while(--_0x132bf2){_0x3ebf12['push'](_0x3ebf12['shift']());}};_0x1dc6c7(++_0x8757b7);}(_0x70a3,0x9e));var _0x370a=function(_0x4400e7,_0x52375e){_0x4400e7=_0x4400e7-0x0;var _0x599859=_0x70a3[_0x4400e7];return _0x599859;};'use strict';var _=require(_0x370a('0x0'));var squel=require(_0x370a('0x1'));var as=require(_0x370a('0x2'));var qs=require('../parsers/qs');var utils=require(_0x370a('0x3'));var db=require(_0x370a('0x4'))['db'];function skipContactsQuery(_0x285e3c,_0xf8fd38){var _0x49ec74=![];if(_0x285e3c[_0x370a('0x5')]==='agent'&&!_0xf8fd38[_0x370a('0x6')]&&!_0xf8fd38[_0x370a('0x7')]&&_0xf8fd38[_0x370a('0x8')]!==_0x370a('0x9')){_0x49ec74=!![];}return _0x49ec74;}function getContactsSubquery(){return squel[_0x370a('0xa')]()[_0x370a('0xb')](_0x370a('0xc'),'c')[_0x370a('0xd')](_0x370a('0xe'));}function applyJoinClauses(_0x34e775,_0x480105){var _0x43ca1b=_0x480105?'c':'subqry';_0x34e775[_0x370a('0xf')]('cm_user_has_contacts','uc',_0x370a('0x10')+_0x43ca1b+_0x370a('0x11'))[_0x370a('0xf')](_0x370a('0x12'),'ct',_0x370a('0x13')+_0x43ca1b+'.id')['left_join'](_0x370a('0x14'),'t','t.id\x20=\x20ct.TagId');return _0x34e775;}function addFieldsToQuery(_0x1df580,_0x2b3c3a,_0x5dfe29,_0x1f7483,_0x1d17ad){var _0x413b27=_0x1d17ad?'c':_0x370a('0x15');if(!_0x2b3c3a){_0x2b3c3a=['id',_0x370a('0x16'),_0x370a('0x17'),_0x370a('0x18'),_0x370a('0x19'),_0x370a('0x1a'),_0x370a('0x1b'),_0x370a('0x7'),'CompanyId',_0x370a('0x1c'),_0x370a('0x1d'),_0x370a('0x1e'),_0x370a('0x1f')];}else if(!_0x2b3c3a[_0x370a('0x20')]('id')){_0x2b3c3a[_0x370a('0x21')]('id');}var _0x347356=_0x5dfe29&&_0x1d17ad||!_0x5dfe29&&!_0x1d17ad;if(_0x1f7483){_0x347356=_0x1f7483&&_0x1d17ad||!_0x1f7483&&!_0x1d17ad;}_0x2b3c3a[_0x370a('0x22')](function(_0x5f0bc8){if(_0x5f0bc8===_0x370a('0x1f')){if(_0x347356){_0x1df580['field'](_0x370a('0x23'),_0x5f0bc8);}else if(_0x5dfe29||_0x1f7483){_0x1df580[_0x370a('0x24')](_0x413b27+'.'+_0x5f0bc8);}}else{_0x1df580[_0x370a('0x24')](_0x413b27+'.'+_0x5f0bc8);}});return _0x1df580;}function getSqlClauses(){var _0x505063={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x370a('0x25')](),'tags':{'clause':squel[_0x370a('0x25')](),'ids':null},'user':{'clause':squel[_0x370a('0x25')](),'skip':![]}};return _0x505063;}function parseTagParameter(_0x452b17){var _0x5c903d=squel[_0x370a('0x25')]();if(_0x452b17){var _0x4c1eef=utils[_0x370a('0x26')](_0x452b17);_0x4c1eef['forEach'](function(_0x2b59af){_0x5c903d['or'](_0x370a('0x27'),'%,'+_0x2b59af+',%');});}return _0x5c903d;}function parseSearchFilter(_0x173b05){var _0x46d0d8=squel[_0x370a('0x25')]();if(_0x173b05){var _0x1e8dfb=_0x173b05[_0x370a('0x28')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1e8dfb[_0x370a('0x29')]('\x20')[_0x370a('0x2a')]>0x1){_0x46d0d8['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x370a('0x2b')](_0x1e8dfb),null);}else{if(qs['isNumeric'](_0x1e8dfb)){_0x46d0d8['or']('c.id\x20LIKE\x20?',_0x1e8dfb+'%');_0x46d0d8['or'](_0x370a('0x2c'),_0x1e8dfb+'%');_0x46d0d8['or'](_0x370a('0x2d'),_0x1e8dfb+'%');_0x46d0d8['or'](_0x370a('0x2e'),_0x1e8dfb+'%');}else if(qs[_0x370a('0x2f')](_0x1e8dfb)){_0x46d0d8['or']('c.email\x20LIKE\x20?',_0x1e8dfb+'%');}else{_0x46d0d8['or'](_0x370a('0x30'),'%'+_0x1e8dfb+'%');_0x46d0d8['or'](_0x370a('0x31'),'%'+_0x1e8dfb+'%');_0x46d0d8['or'](_0x370a('0x32'),'%'+_0x1e8dfb+'%');}}}return _0x46d0d8;}function parseAdvancedSearchFilter(_0x1b6333,_0x1c792c){var _0x11c920=getSqlClauses();var _0x4a29d1=as[_0x370a('0x33')](_0x1b6333);var _0x540b6a=_0x4a29d1[_0x370a('0x34')];for(var _0xd03b31=0x0;_0xd03b31<_0x4a29d1[_0x370a('0x35')][_0x370a('0x2a')];_0xd03b31++){var _0x3fee05=_0x4a29d1[_0x370a('0x35')][_0xd03b31];var _0x11c5f0='c';var _0x157e38=_[_0x370a('0x36')](_0x1c792c,[_0x370a('0x37'),_0x3fee05['field']]);if(_0x157e38){if(_0x3fee05[_0x370a('0x24')]===_0x370a('0x38')||_0x157e38[_0x370a('0x39')]===_0x370a('0x3a')){_0x3fee05[_0x370a('0x3b')]='DATE';}var _0x42b618=as[_0x370a('0x3c')](_0x11c5f0,_0x157e38['type'],_0x3fee05);_0x11c920[_0x370a('0x3d')][_0x540b6a](_0x42b618[_0x370a('0x3e')],_0x42b618['value'][_0x370a('0x3f')],_0x42b618['value']['end']);}else{if(_0x3fee05[_0x370a('0x24')]===_0x370a('0x40')){var _0x129c3d=_0x3fee05[_0x370a('0x41')][_0x370a('0x29')](',')[_0x370a('0x42')](function(_0x56fb0a){return Number(_0x56fb0a);});var _0x11448a=parseTagParameter(_0x129c3d);_0x11c920[_0x370a('0x43')]['clause'][_0x370a('0x44')](_0x11448a);_0x11c920['tags'][_0x370a('0x45')]=_0x129c3d;}else if(_0x3fee05[_0x370a('0x24')]==='User'){_0x11c920[_0x370a('0x46')]['clause'][_0x370a('0x44')](_0x370a('0x47'),_0x3fee05[_0x370a('0x41')]);_0x11c920['user'][_0x370a('0x48')]=!![];}}}return _0x11c920;}function parseModelFields(_0x12f1d4,_0x542910){var _0x33d594=squel[_0x370a('0x25')]();var _0x52d67c=_(_0x12f1d4)[_0x370a('0x49')]()[_0x370a('0x42')](function(_0x454eda){return _[_0x370a('0x4a')](_0x542910,[_0x370a('0x37'),_0x454eda])?_0x454eda:undefined;})[_0x370a('0x4b')]()[_0x370a('0x41')]();if(_0x12f1d4['Contact']){_0x52d67c['push'](_0x370a('0x4c'));}if(_0x52d67c[_0x370a('0x2a')]>0x0){_0x52d67c[_0x370a('0x22')](function(_0x5d0576){if(_0x5d0576==='ListId'){_0x33d594['and'](_0x370a('0x4d'),[]['concat'](_0x12f1d4[_0x5d0576]));}else if(_0x5d0576===_0x370a('0x4c')){var _0x16768a='%'+_0x12f1d4[_0x5d0576]+'%';_0x33d594[_0x370a('0x44')](_0x370a('0x4e'),_0x16768a);}else{_0x33d594['and']('c.'+_0x5d0576+_0x370a('0x4f'),_0x12f1d4[_0x5d0576]);}});}return _0x33d594;}function parseQueryParameters(_0x5cf0b9,_0xf088ac){var _0x560ba3=getSqlClauses();return Promise['resolve']()[_0x370a('0x50')](function(){return parseModelFields(_0x5cf0b9,_0xf088ac);})['then'](function(_0x5bfe5d){_0x560ba3[_0x370a('0x51')][_0x370a('0x44')](_0x5bfe5d);return parseTagParameter(_0x5cf0b9[_0x370a('0x52')]);})['then'](function(_0xd22551){_0x560ba3[_0x370a('0x43')][_0x370a('0x53')][_0x370a('0x44')](_0xd22551);return parseSearchFilter(_0x5cf0b9[_0x370a('0x54')]);})['then'](function(_0x1e615f){_0x560ba3[_0x370a('0x54')]=_0x1e615f;return _0x560ba3;});}function checkListsRestrictions(_0x432968,_0x2002eb,_0x2cb1e1){var _0x3c7c04=squel[_0x370a('0x25')]();return Promise[_0x370a('0x55')]()[_0x370a('0x50')](function(){if(_0x2002eb[_0x370a('0x6')]&&_0x432968[_0x370a('0x5')]===_0x370a('0x56')&&!_0x2cb1e1){return _0x432968[_0x370a('0x57')]({'attributes':['id'],'raw':!![]});}})[_0x370a('0x50')](function(_0x1b101c){if(_0x1b101c){if(_0x1b101c[_0x370a('0x2a')]===0x0){_0x3c7c04[_0x370a('0x44')]('c.ListId\x20IS\x20NULL');}else{_0x3c7c04[_0x370a('0x44')]('c.ListId\x20IN\x20?',_[_0x370a('0x42')](_0x1b101c,'id'));}}})[_0x370a('0x50')](function(){return _0x3c7c04;});}function buildContactsQuery(_0xcd7576,_0x121710,_0x40476e,_0x426ec6,_0x22525c,_0x2a994b){if(_0x121710){_0x121710=_0x40476e[_0x370a('0x58')];}_0xcd7576=addFieldsToQuery(_0xcd7576,_0x121710,_0x426ec6,_0x2a994b,!![]);var _0x199b60=squel[_0x370a('0xa')]();_0x199b60=addFieldsToQuery(_0x199b60,_0x121710,_0x426ec6,_0x2a994b,![]);if(_0x426ec6||_0x2a994b){_0xcd7576=applyJoinClauses(_0xcd7576,!![]);_0xcd7576[_0x370a('0x59')](_0x370a('0x5a'));if(_0x40476e[_0x370a('0x5b')]){_0x199b60[_0x370a('0x5b')](_0x40476e[_0x370a('0x5b')]);}if(_0x40476e[_0x370a('0x5c')]){_0x199b60[_0x370a('0x5c')](_0x40476e[_0x370a('0x5c')]);}}else{_0x199b60=applyJoinClauses(_0x199b60,![]);_0x199b60[_0x370a('0x59')](_0x370a('0x5d'));if(_0x40476e['limit']){_0xcd7576['limit'](_0x40476e[_0x370a('0x5b')]);}if(_0x40476e['offset']){_0xcd7576['offset'](_0x40476e[_0x370a('0x5c')]);}}_0x199b60[_0x370a('0x5e')](_0x22525c);if(_0x40476e[_0x370a('0x5f')]){_0x40476e[_0x370a('0x5f')][_0x370a('0x22')](function(_0x141ea3){_0xcd7576[_0x370a('0x5f')]('c.'+_0x141ea3[0x0],_0x141ea3[0x1]===_0x370a('0x60')?![]:!![]);_0x199b60[_0x370a('0x5f')]('subqry.'+_0x141ea3[0x0],_0x141ea3[0x1]===_0x370a('0x60')?![]:!![]);});}_0x199b60[_0x370a('0xb')](_0xcd7576,'subqry');return _0x199b60;}function getFilteredContacts(_0x4ad81d){var _0x44352b=[];return db['Tag'][_0x370a('0x61')]({'attributes':['id',_0x370a('0x37'),_0x370a('0x62')],'raw':!![]})[_0x370a('0x50')](function(_0xe0da64){_0x44352b=_[_0x370a('0x63')](_0xe0da64,'id');var _0x327901={'type':db['Sequelize'][_0x370a('0x64')][_0x370a('0x65')],'model':db[_0x370a('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x370a('0x67')][_0x370a('0x68')](_0x4ad81d['toString'](),_0x327901);})[_0x370a('0x50')](function(_0x2745ec){_0x2745ec['forEach'](function(_0x23402e){if(_0x23402e['TagIds']){_0x23402e['Tags']=[];_0x23402e[_0x370a('0x1f')][_0x370a('0x29')](',')[_0x370a('0x22')](function(_0x51d42b){_0x23402e[_0x370a('0x69')][_0x370a('0x21')](_0x44352b[_0x51d42b]);});}delete _0x23402e[_0x370a('0x1f')];});return _0x2745ec;});}function countFilteredContacts(_0x1f38d3,_0x19c06a){var _0x28577e=_0x1f38d3[_0x370a('0x6a')]();_0x28577e[_0x370a('0x24')](_0x370a('0x6b'));_0x28577e=applyJoinClauses(_0x28577e,!![]);_0x1f38d3[_0x370a('0x59')](_0x370a('0x5a'));var _0x1bfa73=utils['getSelectedTags'](_0x19c06a);if(!_['isEmpty'](_0x1bfa73)){_0x28577e['where'](_0x370a('0x6c'),_0x1bfa73);}var _0x4b1c65={'type':db[_0x370a('0x6d')][_0x370a('0x64')][_0x370a('0x65')],'raw':!![]};return db[_0x370a('0x67')][_0x370a('0x68')](_0x28577e[_0x370a('0x6e')](),_0x4b1c65)['then'](function(_0x255a35){return _0x255a35[0x0][_0x370a('0x6b')];});}module[_0x370a('0x6f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x54e4=['from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','left_join','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','map','tags','ids','User','user','clause','and','skip','some','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','tag','filter','resolve','getLists','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','order','subqry.','DESC','color','keyBy','Sequelize','CmContact','query','Tags','isEmpty','QueryTypes','SELECT','sequelize','toString','COUNT(*)','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select'];(function(_0x8e9e59,_0x78de56){var _0xd4867d=function(_0x32c7af){while(--_0x32c7af){_0x8e9e59['push'](_0x8e9e59['shift']());}};_0xd4867d(++_0x78de56);}(_0x54e4,0xc8));var _0x454e=function(_0x385632,_0x27d2f3){_0x385632=_0x385632-0x0;var _0x13b934=_0x54e4[_0x385632];return _0x13b934;};'use strict';var _=require(_0x454e('0x0'));var squel=require(_0x454e('0x1'));var as=require(_0x454e('0x2'));var qs=require(_0x454e('0x3'));var utils=require(_0x454e('0x4'));var db=require(_0x454e('0x5'))['db'];function skipContactsQuery(_0x2267c3,_0x34c6ae){var _0x3de6d5=![];if(_0x2267c3[_0x454e('0x6')]===_0x454e('0x7')&&!_0x34c6ae[_0x454e('0x8')]&&!_0x34c6ae[_0x454e('0x9')]&&_0x34c6ae[_0x454e('0xa')]!=='true'){_0x3de6d5=!![];}return _0x3de6d5;}function getContactsSubquery(){return squel[_0x454e('0xb')]()[_0x454e('0xc')](_0x454e('0xd'),'c')[_0x454e('0xe')](_0x454e('0xf'));}function applyJoinClauses(_0x57ab18,_0x2e138c){var _0x187d19=_0x2e138c?'c':_0x454e('0x10');_0x57ab18['left_join']('cm_user_has_contacts','uc',_0x454e('0x11')+_0x187d19+_0x454e('0x12'))['left_join'](_0x454e('0x13'),'ct',_0x454e('0x14')+_0x187d19+_0x454e('0x12'))[_0x454e('0x15')](_0x454e('0x16'),'t',_0x454e('0x17'));return _0x57ab18;}function addFieldsToQuery(_0x3a2708,_0xb1ec81,_0x36ff50,_0x438d30,_0x501022){var _0x153e63=_0x501022?'c':_0x454e('0x10');if(!_0xb1ec81){_0xb1ec81=['id',_0x454e('0x18'),_0x454e('0x19'),'phone',_0x454e('0x1a'),'fax','email',_0x454e('0x9'),_0x454e('0x1b'),_0x454e('0x1c'),_0x454e('0x1d'),_0x454e('0x1e'),_0x454e('0x1f')];}else if(!_0xb1ec81[_0x454e('0x20')]('id')){_0xb1ec81[_0x454e('0x21')]('id');}var _0x495bc8=_0x36ff50&&_0x501022||!_0x36ff50&&!_0x501022;if(_0x438d30){_0x495bc8=_0x438d30&&_0x501022||!_0x438d30&&!_0x501022;}_0xb1ec81[_0x454e('0x22')](function(_0x399f78){if(_0x399f78==='TagIds'){if(_0x495bc8){_0x3a2708[_0x454e('0x23')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x399f78);}else if(_0x36ff50||_0x438d30){_0x3a2708[_0x454e('0x23')](_0x153e63+'.'+_0x399f78);}}else{_0x3a2708[_0x454e('0x23')](_0x153e63+'.'+_0x399f78);}});return _0x3a2708;}function getSqlClauses(){var _0x37e8c0={'default':squel[_0x454e('0x24')](),'fields':squel[_0x454e('0x24')](),'filter':squel[_0x454e('0x24')](),'tags':{'clause':squel[_0x454e('0x24')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x37e8c0;}function parseTagParameter(_0x44b5bb){var _0x3d8ac4=squel[_0x454e('0x24')]();if(_0x44b5bb){var _0x4f704a=utils[_0x454e('0x25')](_0x44b5bb);_0x4f704a[_0x454e('0x22')](function(_0x5c0242){_0x3d8ac4['or'](_0x454e('0x26'),'%,'+_0x5c0242+',%');});}return _0x3d8ac4;}function parseSearchFilter(_0x5883e4){var _0x491f2b=squel[_0x454e('0x24')]();if(_0x5883e4){var _0x3d84f=_0x5883e4['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x3d84f[_0x454e('0x27')]('\x20')[_0x454e('0x28')]>0x1){_0x491f2b['or'](_0x454e('0x29'),qs['getFullTextValue'](_0x3d84f),null);}else{if(qs[_0x454e('0x2a')](_0x3d84f)){_0x491f2b['or'](_0x454e('0x2b'),_0x3d84f+'%');_0x491f2b['or'](_0x454e('0x2c'),_0x3d84f+'%');_0x491f2b['or'](_0x454e('0x2d'),_0x3d84f+'%');_0x491f2b['or'](_0x454e('0x2e'),_0x3d84f+'%');}else if(qs['isEmail'](_0x3d84f)){_0x491f2b['or']('c.email\x20LIKE\x20?',_0x3d84f+'%');}else{_0x491f2b['or'](_0x454e('0x2f'),'%'+_0x3d84f+'%');_0x491f2b['or']('c.lastName\x20LIKE\x20?','%'+_0x3d84f+'%');_0x491f2b['or'](_0x454e('0x30'),'%'+_0x3d84f+'%');}}}return _0x491f2b;}function parseAdvancedSearchFilter(_0x31de8f,_0x1e5302){var _0x441598=getSqlClauses();var _0x121759=as[_0x454e('0x31')](_0x31de8f);var _0x5e0197=_0x121759[_0x454e('0x32')];for(var _0x59052d=0x0;_0x59052d<_0x121759[_0x454e('0x33')][_0x454e('0x28')];_0x59052d++){var _0x518c29=_0x121759[_0x454e('0x33')][_0x59052d];var _0x8407a0='c';var _0xb25d6=_['find'](_0x1e5302,[_0x454e('0x34'),_0x518c29[_0x454e('0x23')]]);if(_0xb25d6){if(_0x518c29[_0x454e('0x23')]===_0x454e('0x35')||_0xb25d6[_0x454e('0x36')]===_0x454e('0x37')){_0x518c29[_0x454e('0x38')]=_0x454e('0x39');}var _0x480691=as[_0x454e('0x3a')](_0x8407a0,_0xb25d6[_0x454e('0x3b')],_0x518c29);_0x441598[_0x454e('0x3c')][_0x5e0197](_0x480691[_0x454e('0x3d')],_0x480691[_0x454e('0x3e')][_0x454e('0x3f')],_0x480691['value'][_0x454e('0x40')]);}else{if(_0x518c29[_0x454e('0x23')]===_0x454e('0x41')){var _0x59080b=_0x518c29[_0x454e('0x3e')]['split'](',')[_0x454e('0x42')](function(_0x554ad1){return Number(_0x554ad1);});var _0x5a4bce=parseTagParameter(_0x59080b);_0x441598[_0x454e('0x43')]['clause']['and'](_0x5a4bce);_0x441598['tags'][_0x454e('0x44')]=_0x59080b;}else if(_0x518c29[_0x454e('0x23')]===_0x454e('0x45')){_0x441598[_0x454e('0x46')][_0x454e('0x47')][_0x454e('0x48')]('uc.UserId\x20=\x20?',_0x518c29[_0x454e('0x3e')]);_0x441598[_0x454e('0x46')][_0x454e('0x49')]=!![];}}}return _0x441598;}function parseModelFields(_0x3fe447,_0x1273bb){var _0x18101b=squel[_0x454e('0x24')]();var _0x578a49=_(_0x3fe447)['keys']()[_0x454e('0x42')](function(_0x51ee36){return _[_0x454e('0x4a')](_0x1273bb,['name',_0x51ee36])?_0x51ee36:undefined;})['compact']()['value']();if(_0x3fe447[_0x454e('0x4b')]){_0x578a49[_0x454e('0x21')](_0x454e('0x4b'));}if(_0x578a49[_0x454e('0x28')]>0x0){_0x578a49['forEach'](function(_0x4c2fd5){if(_0x4c2fd5===_0x454e('0x9')){_0x18101b[_0x454e('0x48')]('c.ListId\x20IN\x20?',[][_0x454e('0x4c')](_0x3fe447[_0x4c2fd5]));}else if(_0x4c2fd5===_0x454e('0x4b')){var _0x2bccda='%'+_0x3fe447[_0x4c2fd5]+'%';_0x18101b['and'](_0x454e('0x4d'),_0x2bccda);}else{_0x18101b['and']('c.'+_0x4c2fd5+_0x454e('0x4e'),_0x3fe447[_0x4c2fd5]);}});}return _0x18101b;}function parseQueryParameters(_0x3ee95b,_0xf73855){var _0x310897=getSqlClauses();return Promise['resolve']()[_0x454e('0x4f')](function(){return parseModelFields(_0x3ee95b,_0xf73855);})['then'](function(_0x3b4ca0){_0x310897['fields'][_0x454e('0x48')](_0x3b4ca0);return parseTagParameter(_0x3ee95b[_0x454e('0x50')]);})['then'](function(_0x712cf2){_0x310897[_0x454e('0x43')][_0x454e('0x47')]['and'](_0x712cf2);return parseSearchFilter(_0x3ee95b[_0x454e('0x51')]);})[_0x454e('0x4f')](function(_0x3867fa){_0x310897[_0x454e('0x51')]=_0x3867fa;return _0x310897;});}function checkListsRestrictions(_0x5067b0,_0x35c7c0,_0x5d1773){var _0x3cd71f=squel[_0x454e('0x24')]();return Promise[_0x454e('0x52')]()[_0x454e('0x4f')](function(){if(_0x35c7c0[_0x454e('0x8')]&&_0x5067b0[_0x454e('0x6')]==='agent'&&!_0x5d1773){return _0x5067b0[_0x454e('0x53')]({'attributes':['id'],'raw':!![]});}})[_0x454e('0x4f')](function(_0x1a0e75){if(_0x1a0e75){if(_0x1a0e75[_0x454e('0x28')]===0x0){_0x3cd71f[_0x454e('0x48')]('c.ListId\x20IS\x20NULL');}else{_0x3cd71f[_0x454e('0x48')](_0x454e('0x54'),_[_0x454e('0x42')](_0x1a0e75,'id'));}}})['then'](function(){return _0x3cd71f;});}function buildContactsQuery(_0x31aed4,_0x57278c,_0x3db9d4,_0x3958c1,_0x3b8cba,_0x2b1960){if(_0x57278c){_0x57278c=_0x3db9d4[_0x454e('0x55')];}_0x31aed4=addFieldsToQuery(_0x31aed4,_0x57278c,_0x3958c1,_0x2b1960,!![]);var _0x13d09b=squel[_0x454e('0xb')]();_0x13d09b=addFieldsToQuery(_0x13d09b,_0x57278c,_0x3958c1,_0x2b1960,![]);if(_0x3958c1||_0x2b1960){_0x31aed4=applyJoinClauses(_0x31aed4,!![]);_0x31aed4[_0x454e('0x56')](_0x454e('0x57'));if(_0x3db9d4[_0x454e('0x58')]){_0x13d09b['limit'](_0x3db9d4['limit']);}if(_0x3db9d4[_0x454e('0x59')]){_0x13d09b[_0x454e('0x59')](_0x3db9d4[_0x454e('0x59')]);}}else{_0x13d09b=applyJoinClauses(_0x13d09b,![]);_0x13d09b[_0x454e('0x56')](_0x454e('0x5a'));if(_0x3db9d4[_0x454e('0x58')]){_0x31aed4[_0x454e('0x58')](_0x3db9d4[_0x454e('0x58')]);}if(_0x3db9d4[_0x454e('0x59')]){_0x31aed4[_0x454e('0x59')](_0x3db9d4[_0x454e('0x59')]);}}_0x13d09b['having'](_0x3b8cba);if(_0x3db9d4[_0x454e('0x5b')]){_0x3db9d4[_0x454e('0x5b')]['forEach'](function(_0x45cb93){_0x31aed4[_0x454e('0x5b')]('c.'+_0x45cb93[0x0],_0x45cb93[0x1]==='DESC'?![]:!![]);_0x13d09b['order'](_0x454e('0x5c')+_0x45cb93[0x0],_0x45cb93[0x1]===_0x454e('0x5d')?![]:!![]);});}_0x13d09b[_0x454e('0xc')](_0x31aed4,'subqry');return _0x13d09b;}function getFilteredContacts(_0x29e0fb){var _0x5012db=[];return db[_0x454e('0x41')]['findAll']({'attributes':['id','name',_0x454e('0x5e')],'raw':!![]})[_0x454e('0x4f')](function(_0x473f69){_0x5012db=_[_0x454e('0x5f')](_0x473f69,'id');var _0x4f232c={'type':db[_0x454e('0x60')]['QueryTypes']['SELECT'],'model':db[_0x454e('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x454e('0x62')](_0x29e0fb['toString'](),_0x4f232c);})['then'](function(_0x1d26f4){_0x1d26f4[_0x454e('0x22')](function(_0x1f4a98){if(_0x1f4a98[_0x454e('0x1f')]){_0x1f4a98['Tags']=[];_0x1f4a98[_0x454e('0x1f')]['split'](',')['forEach'](function(_0xd863d8){_0x1f4a98[_0x454e('0x63')]['push'](_0x5012db[_0xd863d8]);});}delete _0x1f4a98[_0x454e('0x1f')];});return _0x1d26f4;});}function countFilteredContacts(_0x1db3b0,_0x49b983){var _0x203345=_0x1db3b0['clone']();_0x203345[_0x454e('0x23')]('COUNT(*)');_0x203345=applyJoinClauses(_0x203345,!![]);_0x1db3b0[_0x454e('0x56')](_0x454e('0x57'));var _0x56006f=utils[_0x454e('0x25')](_0x49b983);if(!_[_0x454e('0x64')](_0x56006f)){_0x203345[_0x454e('0xe')]('t.id\x20IN\x20?',_0x56006f);}var _0x265d55={'type':db['Sequelize'][_0x454e('0x65')][_0x454e('0x66')],'raw':!![]};return db[_0x454e('0x67')][_0x454e('0x62')](_0x203345[_0x454e('0x68')](),_0x265d55)[_0x454e('0x4f')](function(_0x1b4887){return _0x1b4887[0x0][_0x454e('0x69')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 1dc0c8a..5fa21dc 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 _0xb486=['data','binary','end','write','close','decryptFile','createDecipher','final','unlink','encryptString','createCipher','update','utf8','decryptString','secret','base64','lodash','../../config/environment','../../config/logger','secrets','session','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x470b56,_0x1d73cd){var _0x4bba3f=function(_0x2a9eb3){while(--_0x2a9eb3){_0x470b56['push'](_0x470b56['shift']());}};_0x4bba3f(++_0x1d73cd);}(_0xb486,0x139));var _0x6b48=function(_0x3720a5,_0x254ba8){_0x3720a5=_0x3720a5-0x0;var _0x34d8f1=_0xb486[_0x3720a5];return _0x34d8f1;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x6b48('0x0'));var config=require(_0x6b48('0x1'));var logger=require(_0x6b48('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6b48('0x3')][_0x6b48('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x6b48('0x5')]&&config[_0x6b48('0x5')][_0x6b48('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x6b48('0x6')]=config[_0x6b48('0x5')][_0x6b48('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6b48('0x7')](',\x20');logger[_0x6b48('0x8')](config['encrypt'][_0x6b48('0x6')],_0x6b48('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x3c11da){return AES_SUPPORTED_RX[_0x6b48('0xa')](_0x3c11da);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x6b48('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x848e5d){return getSupportedCiphers()[_0x6b48('0xc')](_0x848e5d)>-0x1;}function combineOptions(_0xb3ea68){var _0x2928f0={};for(var _0x5393f3 in fileOptions){if(fileOptions[_0x6b48('0xd')](_0x5393f3)){_0x2928f0[_0x5393f3]=fileOptions[_0x5393f3];}}if(_0xb3ea68){for(var _0x514a94 in _0xb3ea68){if(_0xb3ea68[_0x6b48('0xd')](_0x514a94)){_0x2928f0[_0x514a94]=_0xb3ea68[_0x514a94];}}}return _0x2928f0;}exports[_0x6b48('0xe')]=function(_0xe4e9df,_0x3112dc,_0x4dbdb5,_0x46dcf8){return new BPromise(function(_0x18abe2,_0x485fd5){_0x46dcf8=combineOptions(_0x46dcf8);var _0x148569=new Buffer(_0x4dbdb5);var _0x266282=fs[_0x6b48('0xf')](_0xe4e9df);var _0x39df1f=fs[_0x6b48('0x10')](_0x3112dc);var _0x21df7f=crypto['createCipher'](_0x46dcf8[_0x6b48('0x6')],_0x148569);_0x266282['on'](_0x6b48('0x11'),function(_0x18a8c1){var _0x327355=new Buffer(_0x21df7f['update'](_0x18a8c1),_0x6b48('0x12'));_0x39df1f['write'](_0x327355);});_0x266282['on'](_0x6b48('0x13'),function(){try{var _0x537d24=new Buffer(_0x21df7f['final']('binary'),_0x6b48('0x12'));_0x39df1f[_0x6b48('0x14')](_0x537d24);_0x39df1f[_0x6b48('0x13')]();_0x39df1f['on'](_0x6b48('0x15'),function(){return _0x18abe2(_0x3112dc);});}catch(_0x366c2c){fs['unlink'](_0x3112dc);return _0x485fd5(_0x366c2c);}});});};exports[_0x6b48('0x16')]=function(_0x3dac32,_0x113101,_0x26b5ff,_0x65616f){return new BPromise(function(_0x25237c,_0x3d7835){_0x65616f=combineOptions(_0x65616f);var _0x553c07=new Buffer(_0x26b5ff);var _0x50f6e3=fs[_0x6b48('0xf')](_0x3dac32);var _0x44bff6=fs[_0x6b48('0x10')](_0x113101);var _0x47776f=crypto[_0x6b48('0x17')](_0x65616f[_0x6b48('0x6')],_0x553c07);_0x50f6e3['on'](_0x6b48('0x11'),function(_0x5a28a9){var _0x1126b6=new Buffer(_0x47776f['update'](_0x5a28a9),_0x6b48('0x12'));_0x44bff6[_0x6b48('0x14')](_0x1126b6);});_0x50f6e3['on']('end',function(){try{var _0x124ea5=new Buffer(_0x47776f[_0x6b48('0x18')](_0x6b48('0x12')),_0x6b48('0x12'));_0x44bff6[_0x6b48('0x14')](_0x124ea5);_0x44bff6[_0x6b48('0x13')]();_0x44bff6['on'](_0x6b48('0x15'),function(){return _0x25237c(_0x113101);});}catch(_0xcb77cf){fs[_0x6b48('0x19')](_0x113101);return _0x3d7835(_0xcb77cf);}});});};exports[_0x6b48('0x1a')]=function(_0x4852d1,_0x323ebe,_0x3a2006){var _0x50872e=_0x3a2006||stringOptions[_0x6b48('0x6')];var _0x3630ca=_0x323ebe||stringOptions['secret'];var _0x529ab0=crypto[_0x6b48('0x1b')](_0x50872e,_0x3630ca);var _0x16d98d=_0x529ab0[_0x6b48('0x1c')](_0x4852d1,_0x6b48('0x1d'),'base64');_0x16d98d+=_0x529ab0[_0x6b48('0x18')]('base64');return _0x16d98d;};exports[_0x6b48('0x1e')]=function(_0x5695ec,_0x289ede,_0x4544bc){var _0x3d5f12=_0x4544bc||stringOptions[_0x6b48('0x6')];var _0x52c4f8=_0x289ede||stringOptions[_0x6b48('0x1f')];var _0x5e4c79=crypto['createDecipher'](_0x3d5f12,_0x52c4f8);var _0x346c4d=_0x5e4c79[_0x6b48('0x1c')](_0x5695ec,_0x6b48('0x20'),_0x6b48('0x1d'));_0x346c4d+=_0x5e4c79['final'](_0x6b48('0x1d'));return _0x346c4d;}; \ No newline at end of file +var _0x55ec=['getCiphers','filter','hasOwnProperty','createReadStream','data','update','binary','end','final','write','close','decryptFile','createWriteStream','createDecipher','unlink','encryptString','secret','createCipher','utf8','base64','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','aes192','encrypt','algorithm','join','error'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x55ec,0x188));var _0xc55e=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x55ec[_0x576e2b];return _0x46461a;};'use strict';var crypto=require(_0xc55e('0x0'));var fs=require('fs');var BPromise=require(_0xc55e('0x1'));var _=require(_0xc55e('0x2'));var config=require(_0xc55e('0x3'));var logger=require(_0xc55e('0x4'))(_0xc55e('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xc55e('0x6')};if(config[_0xc55e('0x7')]&&config[_0xc55e('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xc55e('0x7')][_0xc55e('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xc55e('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc55e('0x9')](',\x20');logger[_0xc55e('0xa')](config['encrypt'][_0xc55e('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0xcb05ff){return AES_SUPPORTED_RX['test'](_0xcb05ff);}function getSupportedCiphers(){return crypto[_0xc55e('0xb')]()[_0xc55e('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x52b134){return getSupportedCiphers()['indexOf'](_0x52b134)>-0x1;}function combineOptions(_0x5f3048){var _0x517f1a={};for(var _0x468778 in fileOptions){if(fileOptions[_0xc55e('0xd')](_0x468778)){_0x517f1a[_0x468778]=fileOptions[_0x468778];}}if(_0x5f3048){for(var _0x142071 in _0x5f3048){if(_0x5f3048[_0xc55e('0xd')](_0x142071)){_0x517f1a[_0x142071]=_0x5f3048[_0x142071];}}}return _0x517f1a;}exports['encryptFile']=function(_0x1bc6fa,_0x14b3f8,_0x3fb959,_0x50c399){return new BPromise(function(_0x1a62e8,_0x10df3c){_0x50c399=combineOptions(_0x50c399);var _0x48064f=new Buffer(_0x3fb959);var _0x24353b=fs[_0xc55e('0xe')](_0x1bc6fa);var _0x12e948=fs['createWriteStream'](_0x14b3f8);var _0xfc7d42=crypto['createCipher'](_0x50c399[_0xc55e('0x8')],_0x48064f);_0x24353b['on'](_0xc55e('0xf'),function(_0x3d44b4){var _0x9e11e5=new Buffer(_0xfc7d42[_0xc55e('0x10')](_0x3d44b4),_0xc55e('0x11'));_0x12e948['write'](_0x9e11e5);});_0x24353b['on'](_0xc55e('0x12'),function(){try{var _0x147c1d=new Buffer(_0xfc7d42[_0xc55e('0x13')](_0xc55e('0x11')),_0xc55e('0x11'));_0x12e948[_0xc55e('0x14')](_0x147c1d);_0x12e948[_0xc55e('0x12')]();_0x12e948['on'](_0xc55e('0x15'),function(){return _0x1a62e8(_0x14b3f8);});}catch(_0x4a3889){fs['unlink'](_0x14b3f8);return _0x10df3c(_0x4a3889);}});});};exports[_0xc55e('0x16')]=function(_0x218642,_0x1b1092,_0x472255,_0x5bf97f){return new BPromise(function(_0x3dd6ed,_0x3ba8a5){_0x5bf97f=combineOptions(_0x5bf97f);var _0x1def55=new Buffer(_0x472255);var _0x1c8f49=fs[_0xc55e('0xe')](_0x218642);var _0x251845=fs[_0xc55e('0x17')](_0x1b1092);var _0x5a5371=crypto[_0xc55e('0x18')](_0x5bf97f[_0xc55e('0x8')],_0x1def55);_0x1c8f49['on'](_0xc55e('0xf'),function(_0xaadaf0){var _0x366e40=new Buffer(_0x5a5371[_0xc55e('0x10')](_0xaadaf0),_0xc55e('0x11'));_0x251845[_0xc55e('0x14')](_0x366e40);});_0x1c8f49['on']('end',function(){try{var _0x5287ae=new Buffer(_0x5a5371[_0xc55e('0x13')]('binary'),_0xc55e('0x11'));_0x251845[_0xc55e('0x14')](_0x5287ae);_0x251845[_0xc55e('0x12')]();_0x251845['on'](_0xc55e('0x15'),function(){return _0x3dd6ed(_0x1b1092);});}catch(_0x1627c7){fs[_0xc55e('0x19')](_0x1b1092);return _0x3ba8a5(_0x1627c7);}});});};exports[_0xc55e('0x1a')]=function(_0x5533dd,_0x1c3b2d,_0x3ba04f){var _0x318707=_0x3ba04f||stringOptions['algorithm'];var _0x653a78=_0x1c3b2d||stringOptions[_0xc55e('0x1b')];var _0x2f15e0=crypto[_0xc55e('0x1c')](_0x318707,_0x653a78);var _0x10de00=_0x2f15e0[_0xc55e('0x10')](_0x5533dd,_0xc55e('0x1d'),_0xc55e('0x1e'));_0x10de00+=_0x2f15e0[_0xc55e('0x13')]('base64');return _0x10de00;};exports['decryptString']=function(_0x298f38,_0x147a29,_0xf227d9){var _0x21e6e1=_0xf227d9||stringOptions[_0xc55e('0x8')];var _0x182664=_0x147a29||stringOptions['secret'];var _0x2fed31=crypto[_0xc55e('0x18')](_0x21e6e1,_0x182664);var _0x51c283=_0x2fed31['update'](_0x298f38,_0xc55e('0x1e'),_0xc55e('0x1d'));_0x51c283+=_0x2fed31[_0xc55e('0x13')]('utf8');return _0x51c283;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 915c242..f75c9ec 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 _0x9836=['%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','path','lodash','to-csv','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting','find','split','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','QueryTypes','dirname','.csv','existsSync','join','mkdirSync','each','length','%s%d.%s','csv'];(function(_0x49930e,_0x1a088e){var _0x2bcc2f=function(_0x15b7e5){while(--_0x15b7e5){_0x49930e['push'](_0x49930e['shift']());}};_0x2bcc2f(++_0x1a088e);}(_0x9836,0x152));var _0x6983=function(_0x42e8a6,_0xc5c6f3){_0x42e8a6=_0x42e8a6-0x0;var _0xd1b0c5=_0x9836[_0x42e8a6];return _0xd1b0c5;};'use strict';var util=require(_0x6983('0x0'));var path=require(_0x6983('0x1'));var _=require(_0x6983('0x2'));var csv=require(_0x6983('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6983('0x4'));var rimraf=require('rimraf');var db=require(_0x6983('0x5'))['db'];var dbH=require(_0x6983('0x5'))['dbH'];var logger=require(_0x6983('0x6'))(_0x6983('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6983('0x8')][0x2]);var QUERY=process[_0x6983('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e79ba,_0x5cf218){var _0x313fb6={'status':_0x3e79ba};var _0x3c5f52={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5cf218){_0x313fb6[_0x6983('0x9')]=_0x5cf218;}return db[_0x6983('0xa')]['update'](_0x313fb6,_0x3c5f52);}function main(){var _0x4338eb=0x1388;var _0x47e2c0;logger[_0x6983('0xb')](util[_0x6983('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6983('0xd')));return db[_0x6983('0xe')][_0x6983('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6983('0x10'),'splitSizeCsv']})[_0x6983('0x11')](function(_0x233a43){if(_0x233a43){_0x47e2c0=_0x233a43;_0x4338eb=_0x47e2c0['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x6983('0x12')]['query'](util['format'](_0x6983('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x6983('0x14')]});})[_0x6983('0x11')](function(_0x3e79c5){if(!_0x3e79c5[0x0]['num']){return analyticExtractedReport('Empty');}var _0x1ef8cf=[];var _0x2e047d=0x0;if(_0x47e2c0[_0x6983('0x10')]){if(_0x3e79c5&&_0x3e79c5['length']){var _0xb76b9e=_[_0x6983('0x15')](_0x3e79c5[0x0][_0x6983('0x16')]/_0x4338eb);var _0x5e66e9=Number[_0x6983('0x17')](_0x3e79c5[0x0][_0x6983('0x16')]/_0x4338eb)?_0x3e79c5[0x0][_0x6983('0x16')]%_0x4338eb:0x0;_0xb76b9e[_0x6983('0x18')](function(_0x13558a){if(_0x13558a>0x0){_0x2e047d+=_0x4338eb;}_0x1ef8cf[_0x6983('0x19')](dbH['sequelize']['query'](util['format'](_0x6983('0x1a'),QUERY,_0x4338eb,_0x2e047d),{'type':dbH[_0x6983('0x12')]['QueryTypes'][_0x6983('0x14')]}));});if(_0x5e66e9>0x0){_0x2e047d+=_0x4338eb;_0x1ef8cf[_0x6983('0x19')](dbH[_0x6983('0x12')][_0x6983('0x1b')](util[_0x6983('0xc')](_0x6983('0x1a'),QUERY,_0x5e66e9,_0x2e047d),{'type':dbH[_0x6983('0x12')][_0x6983('0x1c')][_0x6983('0x14')]}));}}}else{_0x1ef8cf[_0x6983('0x19')](dbH[_0x6983('0x12')][_0x6983('0x1b')](QUERY,{'type':dbH[_0x6983('0x12')][_0x6983('0x1c')][_0x6983('0x14')]}));}var _0x3b5349=path[_0x6983('0x1d')](PATH);var _0x36f473=path['basename'](PATH,_0x6983('0x1e'));var _0x3c72fc=_0x47e2c0[_0x6983('0x10')]&&_0x1ef8cf['length']>0x1;var _0x5f579a=[];if(!fs[_0x6983('0x1f')](path[_0x6983('0x20')](_0x3b5349,_0x36f473))&&_0x3c72fc){fs[_0x6983('0x21')](path['join'](_0x3b5349,_0x36f473));}return BPromise[_0x6983('0x22')](_0x1ef8cf,function(_0x433ed6){_0x5f579a[_0x6983('0x19')](_0x433ed6);})[_0x6983('0x11')](function(){for(var _0xa40ff5=0x0;_0xa40ff5<_0x5f579a[_0x6983('0x23')];_0xa40ff5+=0x1){var _0x15bfc3;var _0xedce4f=_0x5f579a[_0xa40ff5];if(_0x3c72fc){_0x15bfc3=path[_0x6983('0x20')](_0x3b5349,_0x36f473,util[_0x6983('0xc')](_0x6983('0x24'),_0x36f473,_0xa40ff5,_0x6983('0x25')));}else{_0x15bfc3=path[_0x6983('0x20')](_0x3b5349,util[_0x6983('0xc')](_0x6983('0x26'),_0x36f473,_0x6983('0x25')));}fs[_0x6983('0x27')](_0x15bfc3,csv(_0xedce4f));}})[_0x6983('0x11')](function(){if(_0x3c72fc){return new Promise(function(_0x1ffe6c){zipdir(path[_0x6983('0x20')](_0x3b5349,_0x36f473),{'saveTo':path['join'](_0x3b5349,util[_0x6983('0xc')](_0x6983('0x26'),_0x36f473,_0x6983('0x28')))},function(_0x1934d3,_0x21bffb){rimraf(path[_0x6983('0x20')](_0x3b5349,_0x36f473),function(){});_0x1ffe6c(_0x6983('0x29'));});});}})[_0x6983('0x11')](function(){logger[_0x6983('0xb')](util[_0x6983('0xc')](_0x6983('0x2a'),EXTRACTED_REPORT_ID,_0x6983('0xd')));return analyticExtractedReport(_0x6983('0x2b'),_0x3c72fc?util['format'](_0x6983('0x26'),_0x36f473,_0x3c72fc?_0x6983('0x28'):_0x6983('0x25')):null);});})['catch'](function(_0x12cc9c){logger[_0x6983('0xb')](util[_0x6983('0xc')](_0x6983('0x2c'),EXTRACTED_REPORT_ID,_0x6983('0xd')),util['inspect'](_0x12cc9c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6983('0x2d'));})[_0x6983('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb6c4=['analytics','argv','savename','AnalyticExtractedReport','update','format','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','CSV','catch','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x2bca3f,_0x464f94){var _0x3a07e9=function(_0x46087b){while(--_0x46087b){_0x2bca3f['push'](_0x2bca3f['shift']());}};_0x3a07e9(++_0x464f94);}(_0xb6c4,0x177));var _0x4b6c=function(_0x317d65,_0x26305a){_0x317d65=_0x317d65-0x0;var _0x469ada=_0xb6c4[_0x317d65];return _0x469ada;};'use strict';var util=require(_0x4b6c('0x0'));var path=require('path');var _=require(_0x4b6c('0x1'));var csv=require(_0x4b6c('0x2'));var fs=require('fs');var BPromise=require(_0x4b6c('0x3'));var zipdir=require(_0x4b6c('0x4'));var rimraf=require(_0x4b6c('0x5'));var db=require(_0x4b6c('0x6'))['db'];var dbH=require(_0x4b6c('0x6'))[_0x4b6c('0x7')];var logger=require(_0x4b6c('0x8'))(_0x4b6c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x4b6c('0xa')][0x2]);var QUERY=process[_0x4b6c('0xa')][0x3];var PATH=process[_0x4b6c('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x162e03,_0x4b8866){var _0x3eb06f={'status':_0x162e03};var _0x134fd5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b8866){_0x3eb06f[_0x4b6c('0xb')]=_0x4b8866;}return db[_0x4b6c('0xc')][_0x4b6c('0xd')](_0x3eb06f,_0x134fd5);}function main(){var _0xe25eec=0x1388;var _0x30678f;logger['info'](util[_0x4b6c('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x4b6c('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4b6c('0x10'),_0x4b6c('0x11')]})[_0x4b6c('0x12')](function(_0x480013){if(_0x480013){_0x30678f=_0x480013;_0xe25eec=_0x30678f['splitSizeCsv']||0x1388;}})[_0x4b6c('0x12')](function(){return dbH['sequelize'][_0x4b6c('0x13')](util[_0x4b6c('0xe')](_0x4b6c('0x14'),QUERY),{'type':dbH['sequelize'][_0x4b6c('0x15')][_0x4b6c('0x16')]});})[_0x4b6c('0x12')](function(_0x1ad563){if(!_0x1ad563[0x0]['num']){return analyticExtractedReport(_0x4b6c('0x17'));}var _0x563852=[];var _0x519ba7=0x0;if(_0x30678f['split']){if(_0x1ad563&&_0x1ad563[_0x4b6c('0x18')]){var _0x28c7ea=_[_0x4b6c('0x19')](_0x1ad563[0x0]['num']/_0xe25eec);var _0x44052f=Number['isInteger'](_0x1ad563[0x0][_0x4b6c('0x1a')]/_0xe25eec)?_0x1ad563[0x0]['num']%_0xe25eec:0x0;_0x28c7ea['forEach'](function(_0x35815d){if(_0x35815d>0x0){_0x519ba7+=_0xe25eec;}_0x563852[_0x4b6c('0x1b')](dbH[_0x4b6c('0x1c')][_0x4b6c('0x13')](util[_0x4b6c('0xe')](_0x4b6c('0x1d'),QUERY,_0xe25eec,_0x519ba7),{'type':dbH[_0x4b6c('0x1c')][_0x4b6c('0x15')][_0x4b6c('0x16')]}));});if(_0x44052f>0x0){_0x519ba7+=_0xe25eec;_0x563852[_0x4b6c('0x1b')](dbH[_0x4b6c('0x1c')][_0x4b6c('0x13')](util[_0x4b6c('0xe')](_0x4b6c('0x1d'),QUERY,_0x44052f,_0x519ba7),{'type':dbH[_0x4b6c('0x1c')][_0x4b6c('0x15')][_0x4b6c('0x16')]}));}}}else{_0x563852['push'](dbH[_0x4b6c('0x1c')]['query'](QUERY,{'type':dbH[_0x4b6c('0x1c')][_0x4b6c('0x15')][_0x4b6c('0x16')]}));}var _0x573681=path[_0x4b6c('0x1e')](PATH);var _0x4d03d3=path['basename'](PATH,_0x4b6c('0x1f'));var _0x412189=_0x30678f[_0x4b6c('0x10')]&&_0x563852['length']>0x1;var _0xf1116f=[];if(!fs[_0x4b6c('0x20')](path[_0x4b6c('0x21')](_0x573681,_0x4d03d3))&&_0x412189){fs[_0x4b6c('0x22')](path[_0x4b6c('0x21')](_0x573681,_0x4d03d3));}return BPromise[_0x4b6c('0x23')](_0x563852,function(_0x5cc580){_0xf1116f[_0x4b6c('0x1b')](_0x5cc580);})[_0x4b6c('0x12')](function(){for(var _0xd6713e=0x0;_0xd6713e<_0xf1116f[_0x4b6c('0x18')];_0xd6713e+=0x1){var _0x3b468c;var _0x35d568=_0xf1116f[_0xd6713e];if(_0x412189){_0x3b468c=path[_0x4b6c('0x21')](_0x573681,_0x4d03d3,util['format'](_0x4b6c('0x24'),_0x4d03d3,_0xd6713e,_0x4b6c('0x25')));}else{_0x3b468c=path[_0x4b6c('0x21')](_0x573681,util[_0x4b6c('0xe')](_0x4b6c('0x26'),_0x4d03d3,_0x4b6c('0x25')));}fs[_0x4b6c('0x27')](_0x3b468c,csv(_0x35d568));}})[_0x4b6c('0x12')](function(){if(_0x412189){return new Promise(function(_0x45864f){zipdir(path[_0x4b6c('0x21')](_0x573681,_0x4d03d3),{'saveTo':path[_0x4b6c('0x21')](_0x573681,util[_0x4b6c('0xe')](_0x4b6c('0x26'),_0x4d03d3,_0x4b6c('0x28')))},function(_0x4faabd,_0x882dda){rimraf(path[_0x4b6c('0x21')](_0x573681,_0x4d03d3),function(){});_0x45864f(_0x4b6c('0x29'));});});}})['then'](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x4b6c('0x2a')));return analyticExtractedReport('Completed',_0x412189?util[_0x4b6c('0xe')](_0x4b6c('0x26'),_0x4d03d3,_0x412189?'zip':_0x4b6c('0x25')):null);});})[_0x4b6c('0x2b')](function(_0x286b61){logger['info'](util[_0x4b6c('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4b6c('0x2a')),util[_0x4b6c('0x2c')](_0x286b61,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4b6c('0x2d'));})[_0x4b6c('0x2e')](function(){process[_0x4b6c('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e3cd860..08886c8 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 _0xab95=['jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','tableHeader','toString','value','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','find','split','then','splitSizePdf','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','center','pipe','createWriteStream','finish','error','end','createPdfKitDocument','lodash','util','path','moment','zip-dir','rimraf'];(function(_0x2e062f,_0x4d276d){var _0x257b74=function(_0x4986ed){while(--_0x4986ed){_0x2e062f['push'](_0x2e062f['shift']());}};_0x257b74(++_0x4d276d);}(_0xab95,0x152));var _0x5ab9=function(_0x419384,_0x807cff){_0x419384=_0x419384-0x0;var _0x4aa551=_0xab95[_0x419384];return _0x4aa551;};'use strict';var _=require(_0x5ab9('0x0'));var fs=require('fs');var util=require(_0x5ab9('0x1'));var path=require(_0x5ab9('0x2'));var moment=require(_0x5ab9('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x5ab9('0x4'));var rimraf=require(_0x5ab9('0x5'));var JSDOM=require(_0x5ab9('0x6'))[_0x5ab9('0x7')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x5ab9('0x8'))['db'];var dbH=require('../../mysqldb')[_0x5ab9('0x9')];var logger=require(_0x5ab9('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5ab9('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x5ab9('0xb')][0x5];var FORMAT=_0x5ab9('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xed547a,_0x1fb1c8){var _0xe5198f={'status':_0xed547a};var _0x33384d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1fb1c8){_0xe5198f['savename']=_0x1fb1c8;}return db[_0x5ab9('0xd')]['update'](_0xe5198f,_0x33384d);}function getHeaders(_0x335378){return _[_0x5ab9('0xe')](_0x335378,function(_0x3b9c83){return{'text':_0x3b9c83,'style':_0x5ab9('0xf')};});}function getRows(_0x43af7e,_0x5b49cc){return _['map'](_0x5b49cc,function(_0x5c3941){return _(_0x5c3941)['pick'](_0x43af7e)[_0x5ab9('0xe')](function(_0x39bb3f){return _0x39bb3f?_[_0x5ab9('0x10')](_0x39bb3f):'';})[_0x5ab9('0x11')]();});}function createTable(_0x105e66,_0xb5110f){var _0x17ce20={'widths':_['fill'](Array(_0x105e66[_0x5ab9('0x12')]),0x91),'heights':function(_0x1fa67e){return _0x1fa67e===0x0?_0x5ab9('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x523ef5=getHeaders(_0x105e66);_0x17ce20[_0x5ab9('0x14')][_0x5ab9('0x15')](_0x523ef5);var _0x32fd6a=getRows(_0x105e66,_0xb5110f);_0x17ce20[_0x5ab9('0x14')]=_0x17ce20[_0x5ab9('0x14')][_0x5ab9('0x16')](_0x32fd6a);return _0x17ce20;}function createTables(_0x46e464){var _0x49a8c1=[];var _0x5b4ab4=_[_0x5ab9('0x17')](Object[_0x5ab9('0x18')](_0x46e464[0x0]),0x5);_0x5b4ab4[_0x5ab9('0x19')](function(_0x1aff6a){_0x49a8c1[_0x5ab9('0x15')](createTable(_0x1aff6a,_0x46e464));});return _0x49a8c1;}function getPDFDocDefinition(_0x32b759){var _0xb6d67d=util[_0x5ab9('0x1a')](_0x5ab9('0x1b'),NAME,EXTRACTED_REPORT[_0x5ab9('0x1c')],moment(EXTRACTED_REPORT[_0x5ab9('0x1d')])[_0x5ab9('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x5ab9('0x1e')])[_0x5ab9('0x1a')](FORMAT));var _0x532b7d=[];for(var _0x4a8dd5=0x0;_0x4a8dd5<_0x32b759['length'];_0x4a8dd5++){var _0x77edb4=[];if(_0x4a8dd5===0x0){_0x77edb4[_0x5ab9('0x15')]({'text':_0xb6d67d,'style':_0x5ab9('0x1f')});}var _0x48d66c={'table':_0x32b759[_0x4a8dd5]};if(_0x4a8dd5>0x0){_0x48d66c[_0x5ab9('0x20')]=_0x5ab9('0x21');_0x48d66c[_0x5ab9('0x22')]=[0x0,0x46,0x0,0x0];}_0x77edb4[_0x5ab9('0x15')](_0x48d66c);_0x532b7d['push'](_0x77edb4);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x532b7d,'footer':function(_0xc85acf,_0x5d40bc){return{'text':_0xc85acf[_0x5ab9('0x10')]()+_0x5ab9('0x23')+_0x5d40bc,'style':_0x5ab9('0x24')};},'defaultStyle':{'font':_0x5ab9('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5ab9('0x26')},'footer':{'alignment':_0x5ab9('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x33f5d4){var _0x3c3cf8=0x1388;var _0x49c996;if(!_0x33f5d4[0x0][_0x5ab9('0x28')]){return analyticExtractedReport(_0x5ab9('0x29'));}return db['Setting'][_0x5ab9('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5ab9('0x2b'),'splitSizePdf']})[_0x5ab9('0x2c')](function(_0x3ebfb6){if(_0x3ebfb6){_0x49c996=_0x3ebfb6;_0x3c3cf8=_0x49c996[_0x5ab9('0x2d')]||0x3e8;}})[_0x5ab9('0x2c')](function(){var _0x2103fd=[];var _0x2d39bd=0x0;if(_0x49c996['split']){if(_0x33f5d4&&_0x33f5d4['length']){var _0x353833=_[_0x5ab9('0x2e')](_0x33f5d4[0x0][_0x5ab9('0x28')]/_0x3c3cf8);var _0x5d3ab8=Number['isInteger'](_0x33f5d4[0x0][_0x5ab9('0x28')]/_0x3c3cf8)?_0x33f5d4[0x0][_0x5ab9('0x28')]%_0x3c3cf8:0x0;_0x353833['forEach'](function(_0x32a7b5){if(_0x32a7b5>0x0){_0x2d39bd+=_0x3c3cf8;}_0x2103fd[_0x5ab9('0x15')](dbH[_0x5ab9('0x2f')][_0x5ab9('0x30')](util[_0x5ab9('0x1a')](_0x5ab9('0x31'),QUERY,_0x3c3cf8,_0x2d39bd),{'type':dbH['sequelize'][_0x5ab9('0x32')]['SELECT']}));});if(_0x5d3ab8>0x0){_0x2d39bd+=_0x3c3cf8;_0x2103fd[_0x5ab9('0x15')](dbH[_0x5ab9('0x2f')][_0x5ab9('0x30')](util[_0x5ab9('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5d3ab8,_0x2d39bd),{'type':dbH[_0x5ab9('0x2f')][_0x5ab9('0x32')]['SELECT']}));}}}else{_0x2103fd[_0x5ab9('0x15')](dbH[_0x5ab9('0x2f')][_0x5ab9('0x30')](QUERY,{'type':dbH[_0x5ab9('0x2f')][_0x5ab9('0x32')][_0x5ab9('0x33')]}));}var _0x2def33=path[_0x5ab9('0x34')](PATH);var _0x37cc39=path[_0x5ab9('0x35')](PATH,_0x5ab9('0x36'));var _0x561071=_0x49c996[_0x5ab9('0x2b')]&&_0x2103fd[_0x5ab9('0x12')]>0x1;var _0x147802=[];if(!fs['existsSync'](path[_0x5ab9('0x37')](_0x2def33,_0x37cc39))&&_0x561071){fs[_0x5ab9('0x38')](path[_0x5ab9('0x37')](_0x2def33,_0x37cc39));}return BPromise[_0x5ab9('0x39')](_0x2103fd,function(_0x42c547){_0x147802[_0x5ab9('0x15')](_0x42c547);})['then'](function(){var _0x28a2ca=[];for(var _0x35543f=0x0;_0x35543f<_0x147802[_0x5ab9('0x12')];_0x35543f+=0x1){var _0x40b6b9=_0x147802[_0x35543f];var _0x22aceb=createTables(_[_0x5ab9('0x3a')](_0x40b6b9));var _0x492574;var _0x4f2153=getPDFDocDefinition(_0x22aceb);var _0x5dd0e5=getPDFPrinter();var _0x13f07d=_0x5dd0e5['createPdfKitDocument'](_0x4f2153);if(_0x561071){_0x492574=path[_0x5ab9('0x37')](_0x2def33,_0x37cc39,util[_0x5ab9('0x1a')](_0x5ab9('0x3b'),_0x37cc39,_0x35543f,_0x5ab9('0x3c')));}else{_0x492574=path['join'](_0x2def33,util[_0x5ab9('0x1a')](_0x5ab9('0x3d'),_0x37cc39,_0x5ab9('0x3c')));}_0x28a2ca['push'](writePDFDocument(_0x13f07d,_0x492574));}return Promise[_0x5ab9('0x3e')](_0x28a2ca);})[_0x5ab9('0x2c')](function(){if(_0x561071){return new Promise(function(_0x4d92fe){zipdir(path[_0x5ab9('0x37')](_0x2def33,_0x37cc39),{'saveTo':path[_0x5ab9('0x37')](_0x2def33,util['format'](_0x5ab9('0x3d'),_0x37cc39,_0x5ab9('0x3f')))},function(){rimraf(path[_0x5ab9('0x37')](_0x2def33,_0x37cc39),function(){});_0x4d92fe(_0x5ab9('0x40'));});});}})[_0x5ab9('0x2c')](function(){if(!_0x561071)return;rimraf(path[_0x5ab9('0x37')](_0x2def33,_0x37cc39),function(){});})[_0x5ab9('0x2c')](function(){logger[_0x5ab9('0x41')](util[_0x5ab9('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x5ab9('0x42'),_0x561071?util[_0x5ab9('0x1a')](_0x5ab9('0x3d'),_0x37cc39,_0x561071?_0x5ab9('0x3f'):_0x5ab9('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x5ab9('0x41')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x5ab9('0xd')][_0x5ab9('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5ab9('0x2c')](function(_0x2800fd){EXTRACTED_REPORT=_0x2800fd;return dbH[_0x5ab9('0x2f')][_0x5ab9('0x30')](util[_0x5ab9('0x1a')](_0x5ab9('0x44'),QUERY),{'type':dbH[_0x5ab9('0x2f')][_0x5ab9('0x32')][_0x5ab9('0x33')]});})[_0x5ab9('0x2c')](extractReport)[_0x5ab9('0x45')](function(_0xe6e72e){logger[_0x5ab9('0x41')](util['format'](_0x5ab9('0x46'),EXTRACTED_REPORT_ID,_0x5ab9('0x47')),util[_0x5ab9('0x48')](_0xe6e72e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5ab9('0x49'));})[_0x5ab9('0x4a')](function(){process[_0x5ab9('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x144978=new PdfPrinter({'Arial':{'normal':__dirname+_0x5ab9('0x4c'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x5ab9('0x4d')}});return _0x144978;}function getPDFDocDefinitionFromHTML(_0xfb6930,_0x34e360){var _0x5a88e8=util['format'](_0x5ab9('0x4e'),_0x34e360['channel'],_0x34e360['interactionId']);var _0x2a07f1=moment()[_0x5ab9('0x1a')]('YYYY-MM-DD')[_0x5ab9('0x10')]();var _0xcf97c7=htmlToPdfmake(_0xfb6930,{'window':window,'tableAutoSize':!![]});return{'content':[_0xcf97c7],'defaultStyle':{'font':_0x5ab9('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5ab9('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5ab9('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x5ab9('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x395f44,_0xb1c9a5){return[{'text':util[_0x5ab9('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5a88e8,_0x395f44,_0xb1c9a5,_0x2a07f1),'style':_0x5ab9('0x24')}];}};}function writePDFDocument(_0x1afe28,_0x42d575){return new Promise(function(_0xa7f81,_0x1d5869){var _0x257b17=_0x1afe28[_0x5ab9('0x50')](fs[_0x5ab9('0x51')](_0x42d575));_0x257b17['on'](_0x5ab9('0x52'),function(){_0xa7f81(_0x5ab9('0x52'));});_0x257b17['on'](_0x5ab9('0x53'),function(_0x4bab5d){_0x1d5869(_0x4bab5d);});_0x1afe28[_0x5ab9('0x54')]();});}exports['createPdfFromHTML']=function(_0x2e560a,_0x1345b7){var _0x1b0c11=getPDFPrinter();var _0x262665=getPDFDocDefinitionFromHTML(_0x2e560a,_0x1345b7);var _0x463fcc=_0x1b0c11[_0x5ab9('0x55')](_0x262665);return writePDFDocument(_0x463fcc,_0x1345b7[_0x5ab9('0x2')])['catch'](function(_0x3e2e89){throw _0x3e2e89;});}; \ No newline at end of file +var _0x802c=['../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','toString','fill','length','auto','push','body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','before','landscape','footer','Arial','black','Empty','Setting','splitSizePdf','then','range','num','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','split','mkdirSync','join','each','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfKitDocument','path','lodash','util','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','window','../../mysqldb','dbH'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0x802c,0xa1));var _0xc802=function(_0x51f593,_0x38d2ec){_0x51f593=_0x51f593-0x0;var _0x4ccfbf=_0x802c[_0x51f593];return _0x4ccfbf;};'use strict';var _=require(_0xc802('0x0'));var fs=require('fs');var util=require(_0xc802('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0xc802('0x2'));var PdfPrinter=require(_0xc802('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xc802('0x4'));var JSDOM=require(_0xc802('0x5'))['JSDOM'];var window=new JSDOM('')[_0xc802('0x6')];var BPromise=require('bluebird');var db=require(_0xc802('0x7'))['db'];var dbH=require(_0xc802('0x7'))[_0xc802('0x8')];var logger=require(_0xc802('0x9'))(_0xc802('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xc802('0xb')][0x2]);var QUERY=process[_0xc802('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xc802('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x38725d,_0xc122cd){var _0x3eae19={'status':_0x38725d};var _0x3425e1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xc122cd){_0x3eae19[_0xc802('0xd')]=_0xc122cd;}return db[_0xc802('0xe')]['update'](_0x3eae19,_0x3425e1);}function getHeaders(_0x5d3df9){return _[_0xc802('0xf')](_0x5d3df9,function(_0x257253){return{'text':_0x257253,'style':_0xc802('0x10')};});}function getRows(_0x70fe26,_0x402593){return _[_0xc802('0xf')](_0x402593,function(_0x145322){return _(_0x145322)['pick'](_0x70fe26)[_0xc802('0xf')](function(_0x447109){return _0x447109?_[_0xc802('0x11')](_0x447109):'';})['value']();});}function createTable(_0x283783,_0x39fc1d){var _0x2d7577={'widths':_[_0xc802('0x12')](Array(_0x283783[_0xc802('0x13')]),0x91),'heights':function(_0x209a2e){return _0x209a2e===0x0?_0xc802('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x262eb0=getHeaders(_0x283783);_0x2d7577['body'][_0xc802('0x15')](_0x262eb0);var _0x76fd59=getRows(_0x283783,_0x39fc1d);_0x2d7577[_0xc802('0x16')]=_0x2d7577[_0xc802('0x16')][_0xc802('0x17')](_0x76fd59);return _0x2d7577;}function createTables(_0x55579f){var _0x4c537a=[];var _0x5ec4bc=_[_0xc802('0x18')](Object[_0xc802('0x19')](_0x55579f[0x0]),0x5);_0x5ec4bc[_0xc802('0x1a')](function(_0x5f154f){_0x4c537a['push'](createTable(_0x5f154f,_0x55579f));});return _0x4c537a;}function getPDFDocDefinition(_0x4272f3){var _0x15afbb=util['format'](_0xc802('0x1b'),NAME,EXTRACTED_REPORT[_0xc802('0x1c')],moment(EXTRACTED_REPORT[_0xc802('0x1d')])[_0xc802('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xc802('0x1e')](FORMAT));var _0x18f068=[];for(var _0x186f3b=0x0;_0x186f3b<_0x4272f3[_0xc802('0x13')];_0x186f3b++){var _0x56cbc4=[];if(_0x186f3b===0x0){_0x56cbc4[_0xc802('0x15')]({'text':_0x15afbb,'style':_0xc802('0x1f')});}var _0x1395f0={'table':_0x4272f3[_0x186f3b]};if(_0x186f3b>0x0){_0x1395f0['pageBreak']=_0xc802('0x20');_0x1395f0['margin']=[0x0,0x46,0x0,0x0];}_0x56cbc4[_0xc802('0x15')](_0x1395f0);_0x18f068[_0xc802('0x15')](_0x56cbc4);}return{'pageSize':'A4','pageOrientation':_0xc802('0x21'),'content':_0x18f068,'footer':function(_0x1f754f,_0x26fb68){return{'text':_0x1f754f[_0xc802('0x11')]()+'\x20/\x20'+_0x26fb68,'style':_0xc802('0x22')};},'defaultStyle':{'font':_0xc802('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc802('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3b37d9){var _0x578833=0x1388;var _0x5354be;if(!_0x3b37d9[0x0]['num']){return analyticExtractedReport(_0xc802('0x25'));}return db[_0xc802('0x26')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc802('0x27')]})['then'](function(_0x2b4d8f){if(_0x2b4d8f){_0x5354be=_0x2b4d8f;_0x578833=_0x5354be[_0xc802('0x27')]||0x3e8;}})[_0xc802('0x28')](function(){var _0x3264c1=[];var _0x113ede=0x0;if(_0x5354be['split']){if(_0x3b37d9&&_0x3b37d9['length']){var _0xa0f948=_[_0xc802('0x29')](_0x3b37d9[0x0][_0xc802('0x2a')]/_0x578833);var _0x3e2ee0=Number['isInteger'](_0x3b37d9[0x0][_0xc802('0x2a')]/_0x578833)?_0x3b37d9[0x0][_0xc802('0x2a')]%_0x578833:0x0;_0xa0f948['forEach'](function(_0x469696){if(_0x469696>0x0){_0x113ede+=_0x578833;}_0x3264c1[_0xc802('0x15')](dbH[_0xc802('0x2b')][_0xc802('0x2c')](util[_0xc802('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x578833,_0x113ede),{'type':dbH['sequelize'][_0xc802('0x2d')][_0xc802('0x2e')]}));});if(_0x3e2ee0>0x0){_0x113ede+=_0x578833;_0x3264c1[_0xc802('0x15')](dbH['sequelize']['query'](util[_0xc802('0x1e')](_0xc802('0x2f'),QUERY,_0x3e2ee0,_0x113ede),{'type':dbH[_0xc802('0x2b')]['QueryTypes'][_0xc802('0x2e')]}));}}}else{_0x3264c1[_0xc802('0x15')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0xc802('0x2d')][_0xc802('0x2e')]}));}var _0x34cc19=path[_0xc802('0x30')](PATH);var _0x44402f=path[_0xc802('0x31')](PATH,_0xc802('0x32'));var _0x3d339b=_0x5354be[_0xc802('0x33')]&&_0x3264c1[_0xc802('0x13')]>0x1;var _0x44637e=[];if(!fs['existsSync'](path['join'](_0x34cc19,_0x44402f))&&_0x3d339b){fs[_0xc802('0x34')](path[_0xc802('0x35')](_0x34cc19,_0x44402f));}return BPromise[_0xc802('0x36')](_0x3264c1,function(_0x4e3681){_0x44637e[_0xc802('0x15')](_0x4e3681);})['then'](function(){var _0x4360c8=[];for(var _0x4bdabb=0x0;_0x4bdabb<_0x44637e[_0xc802('0x13')];_0x4bdabb+=0x1){var _0xdf8835=_0x44637e[_0x4bdabb];var _0x332927=createTables(_['flatten'](_0xdf8835));var _0x55344e;var _0x52017f=getPDFDocDefinition(_0x332927);var _0x5cd32b=getPDFPrinter();var _0x3076dd=_0x5cd32b['createPdfKitDocument'](_0x52017f);if(_0x3d339b){_0x55344e=path['join'](_0x34cc19,_0x44402f,util[_0xc802('0x1e')](_0xc802('0x37'),_0x44402f,_0x4bdabb,'pdf'));}else{_0x55344e=path[_0xc802('0x35')](_0x34cc19,util['format'](_0xc802('0x38'),_0x44402f,_0xc802('0x39')));}_0x4360c8[_0xc802('0x15')](writePDFDocument(_0x3076dd,_0x55344e));}return Promise[_0xc802('0x3a')](_0x4360c8);})[_0xc802('0x28')](function(){if(_0x3d339b){return new Promise(function(_0x1863b2){zipdir(path['join'](_0x34cc19,_0x44402f),{'saveTo':path[_0xc802('0x35')](_0x34cc19,util[_0xc802('0x1e')](_0xc802('0x38'),_0x44402f,_0xc802('0x3b')))},function(){rimraf(path[_0xc802('0x35')](_0x34cc19,_0x44402f),function(){});_0x1863b2(_0xc802('0x3c'));});});}})[_0xc802('0x28')](function(){if(!_0x3d339b)return;rimraf(path[_0xc802('0x35')](_0x34cc19,_0x44402f),function(){});})['then'](function(){logger['info'](util[_0xc802('0x1e')](_0xc802('0x3d'),EXTRACTED_REPORT_ID,_0xc802('0x3e')));return analyticExtractedReport('Completed',_0x3d339b?util[_0xc802('0x1e')]('%s.%s',_0x44402f,_0x3d339b?_0xc802('0x3b'):_0xc802('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc802('0x3f')](util[_0xc802('0x1e')](_0xc802('0x40'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xc802('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc802('0x28')](function(_0xdb67f9){EXTRACTED_REPORT=_0xdb67f9;return dbH[_0xc802('0x2b')]['query'](util[_0xc802('0x1e')](_0xc802('0x41'),QUERY),{'type':dbH['sequelize'][_0xc802('0x2d')][_0xc802('0x2e')]});})['then'](extractReport)[_0xc802('0x42')](function(_0x218175){logger[_0xc802('0x3f')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc802('0x3e')),util[_0xc802('0x43')](_0x218175,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc802('0x44'));})[_0xc802('0x45')](function(){process[_0xc802('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x990d1e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xc802('0x47'),'italics':__dirname+_0xc802('0x48'),'bolditalics':__dirname+_0xc802('0x49')}});return _0x990d1e;}function getPDFDocDefinitionFromHTML(_0x15207d,_0x5a77cb){var _0x2ff1e0=util['format'](_0xc802('0x4a'),_0x5a77cb[_0xc802('0x4b')],_0x5a77cb[_0xc802('0x4c')]);var _0x5b3752=moment()[_0xc802('0x1e')]('YYYY-MM-DD')[_0xc802('0x11')]();var _0x32c764=htmlToPdfmake(_0x15207d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x32c764],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc802('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc802('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xc802('0x1f')}];},'footer':function(_0x94976c,_0x455045){return[{'text':util[_0xc802('0x1e')](_0xc802('0x4e'),_0x2ff1e0,_0x94976c,_0x455045,_0x5b3752),'style':_0xc802('0x22')}];}};}function writePDFDocument(_0x5e31f9,_0x549780){return new Promise(function(_0x147b6f,_0x4816d2){var _0x4a8a5f=_0x5e31f9['pipe'](fs[_0xc802('0x4f')](_0x549780));_0x4a8a5f['on'](_0xc802('0x50'),function(){_0x147b6f(_0xc802('0x50'));});_0x4a8a5f['on'](_0xc802('0x51'),function(_0x4497ae){_0x4816d2(_0x4497ae);});_0x5e31f9[_0xc802('0x52')]();});}exports['createPdfFromHTML']=function(_0x56ba2e,_0x1f49d9){var _0x1bc741=getPDFPrinter();var _0x5f0cf0=getPDFDocDefinitionFromHTML(_0x56ba2e,_0x1f49d9);var _0x187ef6=_0x1bc741[_0xc802('0x53')](_0x5f0cf0);return writePDFDocument(_0x187ef6,_0x1f49d9[_0xc802('0x54')])['catch'](function(_0x14af77){throw _0x14af77;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fc583dc..d42369a 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 _0x2741=['isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range'];(function(_0x45682b,_0x22ef44){var _0x28c3cd=function(_0x59047b){while(--_0x59047b){_0x45682b['push'](_0x45682b['shift']());}};_0x28c3cd(++_0x22ef44);}(_0x2741,0xae));var _0x1274=function(_0x2c902d,_0x2ed263){_0x2c902d=_0x2c902d-0x0;var _0x12a21b=_0x2741[_0x2c902d];return _0x12a21b;};'use strict';var util=require(_0x1274('0x0'));var path=require(_0x1274('0x1'));var _=require(_0x1274('0x2'));var fs=require('fs');var json2xls=require(_0x1274('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x1274('0x4'));var rimraf=require('rimraf');var db=require(_0x1274('0x5'))['db'];var dbH=require(_0x1274('0x5'))[_0x1274('0x6')];var logger=require(_0x1274('0x7'))(_0x1274('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6ec97f,_0x2be5ad){var _0x624b9b={'status':_0x6ec97f};var _0x3404b2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2be5ad){_0x624b9b[_0x1274('0x9')]=_0x2be5ad;}return db[_0x1274('0xa')][_0x1274('0xb')](_0x624b9b,_0x3404b2);}function main(){var _0x5bf3fb=0x1388;var _0x478b2a;logger[_0x1274('0xc')](util['format'](_0x1274('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1274('0xe'),_0x1274('0xf')]})[_0x1274('0x10')](function(_0xd3747d){if(_0xd3747d){_0x478b2a=_0xd3747d;_0x5bf3fb=_0x478b2a['splitSizeXlsx']||0x1388;}})[_0x1274('0x10')](function(){return dbH[_0x1274('0x11')][_0x1274('0x12')](util[_0x1274('0x13')](_0x1274('0x14'),QUERY),{'type':dbH[_0x1274('0x11')][_0x1274('0x15')][_0x1274('0x16')]});})[_0x1274('0x10')](function(_0x42c645){if(!_0x42c645[0x0][_0x1274('0x17')]){return analyticExtractedReport(_0x1274('0x18'));}var _0x2fad7e=[];var _0x1d8ea9=0x0;if(_0x478b2a[_0x1274('0xe')]){if(_0x42c645&&_0x42c645['length']){var _0x2d0379=_[_0x1274('0x19')](_0x42c645[0x0][_0x1274('0x17')]/_0x5bf3fb);var _0x8f0fd9=Number[_0x1274('0x1a')](_0x42c645[0x0]['num']/_0x5bf3fb)?_0x42c645[0x0][_0x1274('0x17')]%_0x5bf3fb:0x0;_0x2d0379['forEach'](function(_0x31004a){if(_0x31004a>0x0){_0x1d8ea9+=_0x5bf3fb;}_0x2fad7e[_0x1274('0x1b')](dbH[_0x1274('0x11')]['query'](util[_0x1274('0x13')](_0x1274('0x1c'),QUERY,_0x5bf3fb,_0x1d8ea9),{'type':dbH[_0x1274('0x11')]['QueryTypes'][_0x1274('0x16')]}));});if(_0x8f0fd9>0x0){_0x1d8ea9+=_0x5bf3fb;_0x2fad7e[_0x1274('0x1b')](dbH[_0x1274('0x11')]['query'](util[_0x1274('0x13')](_0x1274('0x1c'),QUERY,_0x8f0fd9,_0x1d8ea9),{'type':dbH['sequelize'][_0x1274('0x15')][_0x1274('0x16')]}));}}}else{_0x2fad7e[_0x1274('0x1b')](dbH[_0x1274('0x11')]['query'](QUERY,{'type':dbH[_0x1274('0x11')][_0x1274('0x15')]['SELECT']}));}var _0x73657b=path[_0x1274('0x1d')](PATH);var _0x5c8c59=path[_0x1274('0x1e')](PATH,_0x1274('0x1f'));var _0x4e4f3e=_0x478b2a['split']&&_0x2fad7e[_0x1274('0x20')]>0x1;var _0x12b65a=[];if(!fs['existsSync'](path[_0x1274('0x21')](_0x73657b,_0x5c8c59))&&_0x4e4f3e){fs[_0x1274('0x22')](path[_0x1274('0x21')](_0x73657b,_0x5c8c59));}return BPromise[_0x1274('0x23')](_0x2fad7e,function(_0x256c1e){_0x12b65a[_0x1274('0x1b')](_0x256c1e);})[_0x1274('0x10')](function(){for(var _0xf3ece=0x0;_0xf3ece<_0x12b65a['length'];_0xf3ece+=0x1){var _0x56cdd5;var _0x9b8701=_0x12b65a[_0xf3ece];if(_0x4e4f3e){_0x56cdd5=path[_0x1274('0x21')](_0x73657b,_0x5c8c59,util[_0x1274('0x13')](_0x1274('0x24'),_0x5c8c59,_0xf3ece,_0x1274('0x25')));}else{_0x56cdd5=path['join'](_0x73657b,util['format'](_0x1274('0x26'),_0x5c8c59,_0x1274('0x25')));}fs['writeFileSync'](_0x56cdd5,json2xls(_0x9b8701),_0x1274('0x27'));}})[_0x1274('0x10')](function(){if(_0x4e4f3e){return new Promise(function(_0x4ab482){zipdir(path[_0x1274('0x21')](_0x73657b,_0x5c8c59),{'saveTo':path[_0x1274('0x21')](_0x73657b,util['format'](_0x1274('0x26'),_0x5c8c59,_0x1274('0x28')))},function(_0x38d442,_0x3e21f9){rimraf(path['join'](_0x73657b,_0x5c8c59),function(){});_0x4ab482('zip\x20finished');});});}})[_0x1274('0x10')](function(){logger[_0x1274('0xc')](util[_0x1274('0x13')](_0x1274('0x29'),EXTRACTED_REPORT_ID,_0x1274('0x2a')));return analyticExtractedReport(_0x1274('0x2b'),_0x4e4f3e?util[_0x1274('0x13')]('%s.%s',_0x5c8c59,_0x4e4f3e?_0x1274('0x28'):_0x1274('0x25')):null);});})[_0x1274('0x2c')](function(_0x544dce){logger[_0x1274('0xc')](util[_0x1274('0x13')](_0x1274('0x2d'),EXTRACTED_REPORT_ID,_0x1274('0x2a')),util[_0x1274('0x2e')](_0x544dce,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1274('0x2f'));})[_0x1274('0x30')](function(){process[_0x1274('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3b93=['argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics'];(function(_0x498f05,_0x3c4cbe){var _0x3f358c=function(_0x355b1b){while(--_0x355b1b){_0x498f05['push'](_0x498f05['shift']());}};_0x3f358c(++_0x3c4cbe);}(_0x3b93,0x92));var _0x33b9=function(_0x5f58ec,_0x574042){_0x5f58ec=_0x5f58ec-0x0;var _0x10044c=_0x3b93[_0x5f58ec];return _0x10044c;};'use strict';var util=require('util');var path=require(_0x33b9('0x0'));var _=require(_0x33b9('0x1'));var fs=require('fs');var json2xls=require(_0x33b9('0x2'));var BPromise=require(_0x33b9('0x3'));var zipdir=require(_0x33b9('0x4'));var rimraf=require(_0x33b9('0x5'));var db=require(_0x33b9('0x6'))['db'];var dbH=require(_0x33b9('0x6'))[_0x33b9('0x7')];var logger=require(_0x33b9('0x8'))(_0x33b9('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x33b9('0xa')][0x3];var PATH=process[_0x33b9('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd71b1f,_0x4331f7){var _0x58dd62={'status':_0xd71b1f};var _0x1212d6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4331f7){_0x58dd62[_0x33b9('0xb')]=_0x4331f7;}return db['AnalyticExtractedReport'][_0x33b9('0xc')](_0x58dd62,_0x1212d6);}function main(){var _0x4b77e9=0x1388;var _0x2ce86d;logger[_0x33b9('0xd')](util[_0x33b9('0xe')](_0x33b9('0xf'),EXTRACTED_REPORT_ID,_0x33b9('0x10')));return db[_0x33b9('0x11')][_0x33b9('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x33b9('0x13'),'splitSizeXlsx']})[_0x33b9('0x14')](function(_0xc2182){if(_0xc2182){_0x2ce86d=_0xc2182;_0x4b77e9=_0x2ce86d[_0x33b9('0x15')]||0x1388;}})[_0x33b9('0x14')](function(){return dbH['sequelize'][_0x33b9('0x16')](util['format'](_0x33b9('0x17'),QUERY),{'type':dbH['sequelize'][_0x33b9('0x18')][_0x33b9('0x19')]});})[_0x33b9('0x14')](function(_0x255217){if(!_0x255217[0x0][_0x33b9('0x1a')]){return analyticExtractedReport('Empty');}var _0x5082b6=[];var _0x602b9f=0x0;if(_0x2ce86d[_0x33b9('0x13')]){if(_0x255217&&_0x255217[_0x33b9('0x1b')]){var _0xc211b7=_[_0x33b9('0x1c')](_0x255217[0x0][_0x33b9('0x1a')]/_0x4b77e9);var _0x1d0979=Number[_0x33b9('0x1d')](_0x255217[0x0][_0x33b9('0x1a')]/_0x4b77e9)?_0x255217[0x0]['num']%_0x4b77e9:0x0;_0xc211b7['forEach'](function(_0x555082){if(_0x555082>0x0){_0x602b9f+=_0x4b77e9;}_0x5082b6['push'](dbH[_0x33b9('0x1e')][_0x33b9('0x16')](util[_0x33b9('0xe')](_0x33b9('0x1f'),QUERY,_0x4b77e9,_0x602b9f),{'type':dbH[_0x33b9('0x1e')][_0x33b9('0x18')]['SELECT']}));});if(_0x1d0979>0x0){_0x602b9f+=_0x4b77e9;_0x5082b6[_0x33b9('0x20')](dbH['sequelize'][_0x33b9('0x16')](util[_0x33b9('0xe')](_0x33b9('0x1f'),QUERY,_0x1d0979,_0x602b9f),{'type':dbH[_0x33b9('0x1e')]['QueryTypes'][_0x33b9('0x19')]}));}}}else{_0x5082b6[_0x33b9('0x20')](dbH[_0x33b9('0x1e')][_0x33b9('0x16')](QUERY,{'type':dbH[_0x33b9('0x1e')][_0x33b9('0x18')][_0x33b9('0x19')]}));}var _0x51f2eb=path[_0x33b9('0x21')](PATH);var _0x15a976=path['basename'](PATH,_0x33b9('0x22'));var _0x21b9d5=_0x2ce86d['split']&&_0x5082b6['length']>0x1;var _0x299e07=[];if(!fs[_0x33b9('0x23')](path[_0x33b9('0x24')](_0x51f2eb,_0x15a976))&&_0x21b9d5){fs[_0x33b9('0x25')](path[_0x33b9('0x24')](_0x51f2eb,_0x15a976));}return BPromise[_0x33b9('0x26')](_0x5082b6,function(_0x56634d){_0x299e07[_0x33b9('0x20')](_0x56634d);})['then'](function(){for(var _0x40dac2=0x0;_0x40dac2<_0x299e07[_0x33b9('0x1b')];_0x40dac2+=0x1){var _0x329621;var _0x3a9888=_0x299e07[_0x40dac2];if(_0x21b9d5){_0x329621=path[_0x33b9('0x24')](_0x51f2eb,_0x15a976,util[_0x33b9('0xe')](_0x33b9('0x27'),_0x15a976,_0x40dac2,_0x33b9('0x28')));}else{_0x329621=path[_0x33b9('0x24')](_0x51f2eb,util['format'](_0x33b9('0x29'),_0x15a976,_0x33b9('0x28')));}fs[_0x33b9('0x2a')](_0x329621,json2xls(_0x3a9888),'binary');}})[_0x33b9('0x14')](function(){if(_0x21b9d5){return new Promise(function(_0x3b3a63){zipdir(path[_0x33b9('0x24')](_0x51f2eb,_0x15a976),{'saveTo':path['join'](_0x51f2eb,util['format']('%s.%s',_0x15a976,_0x33b9('0x2b')))},function(_0x562980,_0x3c0f80){rimraf(path[_0x33b9('0x24')](_0x51f2eb,_0x15a976),function(){});_0x3b3a63(_0x33b9('0x2c'));});});}})[_0x33b9('0x14')](function(){logger[_0x33b9('0xd')](util[_0x33b9('0xe')](_0x33b9('0x2d'),EXTRACTED_REPORT_ID,_0x33b9('0x10')));return analyticExtractedReport(_0x33b9('0x2e'),_0x21b9d5?util[_0x33b9('0xe')]('%s.%s',_0x15a976,_0x21b9d5?_0x33b9('0x2b'):'xlsx'):null);});})[_0x33b9('0x2f')](function(_0x2df128){logger['info'](util[_0x33b9('0xe')](_0x33b9('0x30'),EXTRACTED_REPORT_ID,_0x33b9('0x10')),util[_0x33b9('0x31')](_0x2df128,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x33b9('0x32'));})['finally'](function(){process[_0x33b9('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 830818e..a90b74b 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 _0x962a=['length','toLowerCase','updatedAt','interval','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','sortBy','catch','error','rewrite','util','models','Interval','findAll','then','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','type','format','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab'];(function(_0x5ce5be,_0x3d73c5){var _0x11d581=function(_0x30bf29){while(--_0x30bf29){_0x5ce5be['push'](_0x5ce5be['shift']());}};_0x11d581(++_0x3d73c5);}(_0x962a,0x1b9));var _0xa962=function(_0x19820c,_0x2800d8){_0x19820c=_0x19820c-0x0;var _0x3361e7=_0x962a[_0x19820c];return _0x3361e7;};'use strict';var _=require('lodash');var util=require(_0xa962('0x0'));function rewrite(_0x93f08f,_0x4a766f){var _0x4f686a=this;return _0x93f08f[_0xa962('0x1')][_0xa962('0x2')][_0xa962('0x3')]({'raw':!![]})[_0xa962('0x4')](function(_0x58ef76){_0x4f686a['intervals']=_0x58ef76;return _0x93f08f[_0xa962('0x1')]['VoiceExtension'][_0xa962('0x3')]({'where':{'IntervalId':_0x4a766f[_0xa962('0x5')]},'raw':!![]});})[_0xa962('0x4')](function(_0x19eaec){return _0x93f08f[_0xa962('0x1')][_0xa962('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xa962('0x7')](_[_0xa962('0x8')](_0x19eaec,'exten'))}},'order':[{'raw':_0xa962('0x9')}],'raw':!![]});})['then'](function(_0x293f2a){var _0x73b971=_[_0xa962('0xa')](_0x293f2a,{'priority':'1'});var _0x2f79b5=_['filter'](_0x293f2a,{'isApp':0x1});var _0x3621e=_[_0xa962('0xb')](_0x2f79b5,_0xa962('0xc'));var _0x182d8d=[_0xa962('0xd'),_0xa962('0xe')];var _0x2b616b=[];var _0x34cb2e=[];for(var _0x33015b in _0x3621e){if(_0x3621e[_0xa962('0xf')](_0x33015b)){_0x4f686a[_0xa962('0x10')]=0x2;_0x4f686a['extensions']=[];_0x4f686a[_0xa962('0x11')]=_[_0xa962('0x12')](_0x73b971,{'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')]});_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':'Set','appdata':util[_0xa962('0x16')]('CDR(type)=%s',_0x3621e[_0x33015b][0x0]['type']),'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});if(_0x3621e[_0x33015b][0x0][_0xa962('0x15')]===_0xa962('0x19')){_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':_0xa962('0x1a'),'appdata':_0xa962('0x1b')+_0x3621e[_0x33015b][0x0][_0xa962('0x18')],'context':_0x3621e[_0x33015b][0x0]['context'],'exten':_0x3621e[_0x33015b][0x0]['exten'],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0]['VoiceExtensionId']});}else if(_0x3621e[_0x33015b][0x0][_0xa962('0x15')]===_0xa962('0x1c')){if(_0x4f686a[_0xa962('0x11')]){_0x4f686a['extensions'][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':_0xa962('0x1a'),'appdata':'CDR(destination)='+(_0x4f686a[_0xa962('0x11')][_0xa962('0x1d')]?'${EXTEN:'+_0x4f686a[_0xa962('0x11')][_0xa962('0x1d')]+'}':_0xa962('0x1e')),'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});}_0x4f686a[_0xa962('0x13')]['push']({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':_0xa962('0x1a'),'appdata':_0xa962('0x1b')+_0x3621e[_0x33015b][0x0]['VoiceExtensionId'],'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});var _0x5962f7=_0x4f686a[_0xa962('0x10')]++;_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0]['type'],'app':_0xa962('0x1f'),'appdata':_0xa962('0x20')+(_0x5962f7+0x2)+'):Goto('+(_0x5962f7+0x1)+')','context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x5962f7,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});if(_0x4f686a[_0xa962('0x11')]){_0x4f686a['extensions']['push']({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':'Set','appdata':_0x4f686a[_0xa962('0x11')][_0xa962('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x4f686a[_0xa962('0x11')][_0xa962('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0]['VoiceExtensionId']});}_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0]['type'],'app':_0xa962('0x1a'),'appdata':_0xa962('0x21')+_0x3621e[_0x33015b][0x0][_0xa962('0x18')],'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0]['exten'],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0]['VoiceExtensionId']});if(_0x4f686a[_0xa962('0x11')]&&_0x4f686a['extension']['hasOwnProperty'](_0xa962('0x22'))&&_0x4f686a[_0xa962('0x11')][_0xa962('0x22')]!==_0xa962('0x23')){_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':_0xa962('0x1a'),'appdata':_0xa962('0x24'),'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a['priority']++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});_0x4f686a[_0xa962('0x13')]['push']({'type':_0x3621e[_0x33015b][0x0]['type'],'app':_0xa962('0x1a'),'appdata':_0xa962('0x25')+_0x4f686a[_0xa962('0x11')][_0xa962('0x22')]||_0xa962('0x26'),'context':_0x3621e[_0x33015b][0x0]['context'],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a['priority']++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});}}_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':_0xa962('0x1a'),'appdata':_0xa962('0x27'),'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0]['exten'],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0]['VoiceExtensionId']});_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':_0xa962('0x1a'),'appdata':_0xa962('0x28'),'context':_0x3621e[_0x33015b][0x0]['context'],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0]['VoiceExtensionId']});_0x4f686a['extensions'][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0]['type'],'app':_0xa962('0x1a'),'appdata':_0xa962('0x29'),'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'priority':_0x4f686a[_0xa962('0x10')]++,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});for(var _0x3f70f2=0x0,_0x2f304f=0x0;_0x3f70f2<_0x3621e[_0x33015b][_0xa962('0x2a')];_0x3f70f2+=0x1,_0x2f304f=0x0){var _0x4e8c9e=_0x3621e[_0x33015b][_0x3f70f2];if(_0x4e8c9e[_0xa962('0x15')]){_0x4e8c9e['type']=_0x4e8c9e[_0xa962('0x15')][_0xa962('0x2b')]();}var _0x4cceb9=[];var _0x1651ca=[];delete _0x4e8c9e['id'];delete _0x4e8c9e['createdAt'];delete _0x4e8c9e[_0xa962('0x2c')];var _0x259146=_0x4e8c9e[_0xa962('0x2d')]!=='*,*,*,*'?[_0x4e8c9e[_0xa962('0x2d')]]:_0x4e8c9e[_0xa962('0x5')]?_['map'](_[_0xa962('0xa')](_0x4f686a[_0xa962('0x2e')],{'IntervalId':_0x4e8c9e[_0xa962('0x5')]}),'interval'):[];if(_0x4e8c9e[_0xa962('0xf')](_0xa962('0x2f'))){if(_0x4e8c9e[_0xa962('0x2f')]&&_0x4e8c9e['tag']!=='--'){_0x4cceb9[_0xa962('0x14')]({'type':_0x4e8c9e['type'],'app':_0xa962('0x1a'),'appdata':_0xa962('0x30')+_0x4e8c9e[_0xa962('0x2f')],'context':_0x4e8c9e[_0xa962('0x17')],'exten':_0x4e8c9e[_0xa962('0xc')],'priority':_0x259146['length']+_0x4f686a[_0xa962('0x10')]+_0x2f304f++,'VoiceExtensionId':_0x4e8c9e['VoiceExtensionId']});}}if(_0x4e8c9e[_0xa962('0x15')]===_0xa962('0x1c')&&_0x4e8c9e[_0xa962('0xf')](_0xa962('0x31'))){if(_0x4e8c9e['callerID']){_0x4cceb9[_0xa962('0x14')]({'type':_0x4e8c9e[_0xa962('0x15')],'app':'ExecIf','appdata':_0xa962('0x32')+_0x4e8c9e[_0xa962('0x31')]+')','context':_0x4e8c9e[_0xa962('0x17')],'exten':_0x4e8c9e[_0xa962('0xc')],'priority':_0x259146[_0xa962('0x2a')]+_0x4f686a[_0xa962('0x10')]+_0x2f304f++,'VoiceExtensionId':_0x4e8c9e['VoiceExtensionId']});}else{_0x4cceb9[_0xa962('0x14')]({'type':_0x4e8c9e[_0xa962('0x15')],'app':_0xa962('0x1f'),'appdata':_0xa962('0x33'),'context':_0x4e8c9e['context'],'exten':_0x4e8c9e[_0xa962('0xc')],'priority':_0x259146['length']+_0x4f686a[_0xa962('0x10')]+_0x2f304f++,'VoiceExtensionId':_0x4e8c9e[_0xa962('0x18')]});}}if(_0x4e8c9e[_0xa962('0xf')](_0xa962('0x34'))){if(_0x182d8d['indexOf'](_0x4e8c9e['app'][_0xa962('0x2b')]())>=0x0&&_0x4e8c9e[_0xa962('0x35')]!==_0xa962('0x36')){if(_0x4e8c9e['answer']){_0x4cceb9[_0xa962('0x14')]({'type':_0x4e8c9e['type'],'app':_0xa962('0x1f'),'appdata':_0xa962('0x37'),'context':_0x4e8c9e[_0xa962('0x17')],'exten':_0x4e8c9e[_0xa962('0xc')],'priority':_0x259146[_0xa962('0x2a')]+_0x4f686a['priority']+_0x2f304f++,'VoiceExtensionId':_0x4e8c9e[_0xa962('0x18')]});_0x4cceb9['push']({'type':_0x4e8c9e[_0xa962('0x15')],'app':'Set','appdata':_0xa962('0x38'),'context':_0x4e8c9e['context'],'exten':_0x4e8c9e[_0xa962('0xc')],'priority':_0x259146[_0xa962('0x2a')]+_0x4f686a[_0xa962('0x10')]+_0x2f304f++,'VoiceExtensionId':_0x4e8c9e[_0xa962('0x18')]});}else{_0x4cceb9[_0xa962('0x14')]({'type':_0x4e8c9e[_0xa962('0x15')],'app':'ExecIf','appdata':_0xa962('0x39'),'context':_0x4e8c9e['context'],'exten':_0x4e8c9e[_0xa962('0xc')],'priority':_0x259146[_0xa962('0x2a')]+_0x4f686a['priority']+_0x2f304f++,'VoiceExtensionId':_0x4e8c9e[_0xa962('0x18')]});_0x4cceb9[_0xa962('0x14')]({'type':_0x4e8c9e[_0xa962('0x15')],'app':_0xa962('0x1a'),'appdata':_0xa962('0x3a'),'context':_0x4e8c9e[_0xa962('0x17')],'exten':_0x4e8c9e[_0xa962('0xc')],'priority':_0x259146[_0xa962('0x2a')]+_0x4f686a['priority']+_0x2f304f++,'VoiceExtensionId':_0x4e8c9e[_0xa962('0x18')]});}}}for(var _0xd4f8f3=0x0;_0xd4f8f3<_0x259146[_0xa962('0x2a')];_0xd4f8f3+=0x1){var _0x2abcd8=_0x4f686a[_0xa962('0x10')]+_0x259146[_0xa962('0x2a')];var _0x2bc597=_0xd4f8f3===_0x259146[_0xa962('0x2a')]-0x1?_0x4f686a['priority']+_0x4cceb9[_0xa962('0x2a')]+_0x1651ca[_0xa962('0x2a')]+0x2:_0x4f686a[_0xa962('0x10')]+_0xd4f8f3+0x1;_0x4cceb9[_0xa962('0x3b')](_0xd4f8f3,0x0,{'type':_0x4e8c9e[_0xa962('0x15')],'app':_0xa962('0x3c'),'appdata':_0x259146[_0xd4f8f3]+'?'+_0x4e8c9e[_0xa962('0x17')]+_0xa962('0x3d')+_0x2abcd8+':'+_0x4e8c9e[_0xa962('0x17')]+_0xa962('0x3d')+_0x2bc597,'exten':_0x4e8c9e[_0xa962('0xc')],'context':_0x4e8c9e[_0xa962('0x17')],'priority':_0x4f686a[_0xa962('0x10')]+_0xd4f8f3,'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});}_0x4e8c9e[_0xa962('0x10')]=_0x4cceb9[_0xa962('0x2a')]?_[_0xa962('0x3e')](_0x4cceb9)['priority']+0x1:_0x4f686a[_0xa962('0x10')];_0x4f686a[_0xa962('0x10')]=(_0x1651ca[_0xa962('0x2a')]?_[_0xa962('0x3e')](_0x1651ca)['priority']:_0x4e8c9e[_0xa962('0x10')])+0x1;_0x4f686a['extensions']=_[_0xa962('0x3f')](_0x4f686a[_0xa962('0x13')],_0x4cceb9,[_0x4e8c9e],_0x1651ca);}_0x4f686a[_0xa962('0x13')][_0xa962('0x14')]({'type':_0x3621e[_0x33015b][0x0][_0xa962('0x15')],'app':'Hangup','exten':_0x3621e[_0x33015b][0x0][_0xa962('0xc')],'context':_0x3621e[_0x33015b][0x0][_0xa962('0x17')],'priority':_0x4f686a['priority'],'VoiceExtensionId':_0x3621e[_0x33015b][0x0][_0xa962('0x18')]});_0x2b616b[_0xa962('0x14')](_0x3621e[_0x33015b][0x0]['VoiceExtensionId']);_0x34cb2e=_['concat'](_0x34cb2e,_0x4f686a[_0xa962('0x13')]);}}return _0x93f08f[_0xa962('0x40')](function(_0x3ac819){return _0x93f08f[_0xa962('0x1')][_0xa962('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x2b616b}},'transaction':_0x3ac819})[_0xa962('0x4')](function(_0x501e3c){return _0x93f08f[_0xa962('0x1')][_0xa962('0x6')]['bulkCreate'](_[_0xa962('0x41')](_0x34cb2e,_0xa962('0x10')),{'transaction':_0x3ac819});});});})[_0xa962('0x42')](function(_0x1e5cf0){console[_0xa962('0x43')](_0x1e5cf0);});}exports[_0xa962('0x44')]=rewrite; \ No newline at end of file +var _0x57b7=['indexOf','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','exten','filter','groupBy','playback','hasOwnProperty','priority','extension','find','Set','format','type','context','VoiceExtensionId','push','CDR(routeid)=','extensions','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','outbound','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer'];(function(_0xd27ded,_0x1164e2){var _0x5ef850=function(_0x582e7d){while(--_0x582e7d){_0xd27ded['push'](_0xd27ded['shift']());}};_0x5ef850(++_0x1164e2);}(_0x57b7,0x196));var _0x757b=function(_0x28b528,_0xa62109){_0x28b528=_0x28b528-0x0;var _0x5cde4f=_0x57b7[_0x28b528];return _0x5cde4f;};'use strict';var _=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));function rewrite(_0x3df85f,_0x511a96){var _0x4704c2=this;return _0x3df85f[_0x757b('0x2')][_0x757b('0x3')][_0x757b('0x4')]({'raw':!![]})['then'](function(_0x2411cf){_0x4704c2[_0x757b('0x5')]=_0x2411cf;return _0x3df85f[_0x757b('0x2')][_0x757b('0x6')][_0x757b('0x4')]({'where':{'IntervalId':_0x511a96[_0x757b('0x7')]},'raw':!![]});})[_0x757b('0x8')](function(_0x3dfeff){return _0x3df85f[_0x757b('0x2')][_0x757b('0x6')][_0x757b('0x4')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x3dfeff,_0x757b('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x757b('0x8')](function(_0x6d2f1){var _0x198ae5=_[_0x757b('0xa')](_0x6d2f1,{'priority':'1'});var _0x527b6d=_[_0x757b('0xa')](_0x6d2f1,{'isApp':0x1});var _0x4f5250=_[_0x757b('0xb')](_0x527b6d,'exten');var _0x243890=['queue',_0x757b('0xc')];var _0x33daea=[];var _0x2ad0c9=[];for(var _0x2251a8 in _0x4f5250){if(_0x4f5250[_0x757b('0xd')](_0x2251a8)){_0x4704c2[_0x757b('0xe')]=0x2;_0x4704c2['extensions']=[];_0x4704c2[_0x757b('0xf')]=_[_0x757b('0x10')](_0x198ae5,{'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')]});_0x4704c2['extensions']['push']({'type':_0x4f5250[_0x2251a8][0x0]['type'],'app':_0x757b('0x11'),'appdata':util[_0x757b('0x12')]('CDR(type)=%s',_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')]),'context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0]['exten'],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});if(_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')]==='inbound'){_0x4704c2['extensions'][_0x757b('0x16')]({'type':_0x4f5250[_0x2251a8][0x0]['type'],'app':_0x757b('0x11'),'appdata':_0x757b('0x17')+_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')],'context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});}else if(_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')]==='outbound'){if(_0x4704c2['extension']){_0x4704c2[_0x757b('0x18')][_0x757b('0x16')]({'type':_0x4f5250[_0x2251a8][0x0]['type'],'app':_0x757b('0x11'),'appdata':_0x757b('0x19')+(_0x4704c2['extension'][_0x757b('0x1a')]?_0x757b('0x1b')+_0x4704c2[_0x757b('0xf')][_0x757b('0x1a')]+'}':'${EXTEN}'),'context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x4704c2['priority']++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0]['VoiceExtensionId']});}_0x4704c2[_0x757b('0x18')][_0x757b('0x16')]({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':'Set','appdata':_0x757b('0x17')+_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')],'context':_0x4f5250[_0x2251a8][0x0]['context'],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0]['VoiceExtensionId']});var _0x3a0e4d=_0x4704c2[_0x757b('0xe')]++;_0x4704c2['extensions'][_0x757b('0x16')]({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':_0x757b('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3a0e4d+0x2)+'):Goto('+(_0x3a0e4d+0x1)+')','context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x3a0e4d,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});if(_0x4704c2[_0x757b('0xf')]){_0x4704c2['extensions'][_0x757b('0x16')]({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':_0x4704c2[_0x757b('0xf')][_0x757b('0x1a')]?_0x757b('0x1d')+_0x4704c2[_0x757b('0xf')][_0x757b('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});}_0x4704c2[_0x757b('0x18')]['push']({'type':_0x4f5250[_0x2251a8][0x0]['type'],'app':'Set','appdata':_0x757b('0x1e')+_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')],'context':_0x4f5250[_0x2251a8][0x0]['context'],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x4704c2['priority']++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});if(_0x4704c2[_0x757b('0xf')]&&_0x4704c2[_0x757b('0xf')]['hasOwnProperty'](_0x757b('0x1f'))&&_0x4704c2[_0x757b('0xf')]['recordingFormat']!==_0x757b('0x20')){_0x4704c2[_0x757b('0x18')]['push']({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});_0x4704c2[_0x757b('0x18')]['push']({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':_0x757b('0x21')+_0x4704c2[_0x757b('0xf')]['recordingFormat']||_0x757b('0x22'),'context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0]['exten'],'priority':_0x4704c2['priority']++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});}}_0x4704c2['extensions']['push']({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':_0x757b('0x23'),'context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0]['exten'],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0]['VoiceExtensionId']});_0x4704c2[_0x757b('0x18')][_0x757b('0x16')]({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':_0x757b('0x24'),'context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0][_0x757b('0x9')],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0]['VoiceExtensionId']});_0x4704c2[_0x757b('0x18')]['push']({'type':_0x4f5250[_0x2251a8][0x0][_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4f5250[_0x2251a8][0x0][_0x757b('0x14')],'exten':_0x4f5250[_0x2251a8][0x0]['exten'],'priority':_0x4704c2[_0x757b('0xe')]++,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});for(var _0x3bed07=0x0,_0x4393e8=0x0;_0x3bed07<_0x4f5250[_0x2251a8][_0x757b('0x25')];_0x3bed07+=0x1,_0x4393e8=0x0){var _0x1e53d5=_0x4f5250[_0x2251a8][_0x3bed07];if(_0x1e53d5[_0x757b('0x13')]){_0x1e53d5[_0x757b('0x13')]=_0x1e53d5[_0x757b('0x13')][_0x757b('0x26')]();}var _0xd9a74f=[];var _0x6fbd4=[];delete _0x1e53d5['id'];delete _0x1e53d5[_0x757b('0x27')];delete _0x1e53d5[_0x757b('0x28')];var _0x4e7b1f=_0x1e53d5[_0x757b('0x29')]!==_0x757b('0x2a')?[_0x1e53d5[_0x757b('0x29')]]:_0x1e53d5[_0x757b('0x7')]?_[_0x757b('0x2b')](_['filter'](_0x4704c2[_0x757b('0x5')],{'IntervalId':_0x1e53d5['IntervalId']}),_0x757b('0x29')):[];if(_0x1e53d5[_0x757b('0xd')]('tag')){if(_0x1e53d5[_0x757b('0x2c')]&&_0x1e53d5[_0x757b('0x2c')]!=='--'){_0xd9a74f[_0x757b('0x16')]({'type':_0x1e53d5[_0x757b('0x13')],'app':'Set','appdata':_0x757b('0x2d')+_0x1e53d5[_0x757b('0x2c')],'context':_0x1e53d5[_0x757b('0x14')],'exten':_0x1e53d5[_0x757b('0x9')],'priority':_0x4e7b1f[_0x757b('0x25')]+_0x4704c2[_0x757b('0xe')]+_0x4393e8++,'VoiceExtensionId':_0x1e53d5[_0x757b('0x15')]});}}if(_0x1e53d5[_0x757b('0x13')]===_0x757b('0x2e')&&_0x1e53d5[_0x757b('0xd')]('callerID')){if(_0x1e53d5['callerID']){_0xd9a74f[_0x757b('0x16')]({'type':_0x1e53d5[_0x757b('0x13')],'app':_0x757b('0x1c'),'appdata':_0x757b('0x2f')+_0x1e53d5['callerID']+')','context':_0x1e53d5[_0x757b('0x14')],'exten':_0x1e53d5[_0x757b('0x9')],'priority':_0x4e7b1f[_0x757b('0x25')]+_0x4704c2[_0x757b('0xe')]+_0x4393e8++,'VoiceExtensionId':_0x1e53d5[_0x757b('0x15')]});}else{_0xd9a74f[_0x757b('0x16')]({'type':_0x1e53d5[_0x757b('0x13')],'app':_0x757b('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x1e53d5['context'],'exten':_0x1e53d5[_0x757b('0x9')],'priority':_0x4e7b1f[_0x757b('0x25')]+_0x4704c2[_0x757b('0xe')]+_0x4393e8++,'VoiceExtensionId':_0x1e53d5[_0x757b('0x15')]});}}if(_0x1e53d5[_0x757b('0xd')](_0x757b('0x30'))){if(_0x243890[_0x757b('0x31')](_0x1e53d5['app'][_0x757b('0x26')]())>=0x0&&_0x1e53d5[_0x757b('0x32')]!==_0x757b('0x33')){if(_0x1e53d5[_0x757b('0x30')]){_0xd9a74f[_0x757b('0x16')]({'type':_0x1e53d5[_0x757b('0x13')],'app':_0x757b('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1e53d5['context'],'exten':_0x1e53d5[_0x757b('0x9')],'priority':_0x4e7b1f[_0x757b('0x25')]+_0x4704c2[_0x757b('0xe')]+_0x4393e8++,'VoiceExtensionId':_0x1e53d5[_0x757b('0x15')]});_0xd9a74f[_0x757b('0x16')]({'type':_0x1e53d5[_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':_0x757b('0x34'),'context':_0x1e53d5[_0x757b('0x14')],'exten':_0x1e53d5[_0x757b('0x9')],'priority':_0x4e7b1f[_0x757b('0x25')]+_0x4704c2[_0x757b('0xe')]+_0x4393e8++,'VoiceExtensionId':_0x1e53d5[_0x757b('0x15')]});}else{_0xd9a74f[_0x757b('0x16')]({'type':_0x1e53d5[_0x757b('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1e53d5['context'],'exten':_0x1e53d5[_0x757b('0x9')],'priority':_0x4e7b1f[_0x757b('0x25')]+_0x4704c2[_0x757b('0xe')]+_0x4393e8++,'VoiceExtensionId':_0x1e53d5[_0x757b('0x15')]});_0xd9a74f[_0x757b('0x16')]({'type':_0x1e53d5[_0x757b('0x13')],'app':_0x757b('0x11'),'appdata':_0x757b('0x35'),'context':_0x1e53d5[_0x757b('0x14')],'exten':_0x1e53d5[_0x757b('0x9')],'priority':_0x4e7b1f['length']+_0x4704c2[_0x757b('0xe')]+_0x4393e8++,'VoiceExtensionId':_0x1e53d5['VoiceExtensionId']});}}}for(var _0x5e673d=0x0;_0x5e673d<_0x4e7b1f['length'];_0x5e673d+=0x1){var _0x5206c6=_0x4704c2[_0x757b('0xe')]+_0x4e7b1f[_0x757b('0x25')];var _0x120565=_0x5e673d===_0x4e7b1f['length']-0x1?_0x4704c2['priority']+_0xd9a74f['length']+_0x6fbd4[_0x757b('0x25')]+0x2:_0x4704c2['priority']+_0x5e673d+0x1;_0xd9a74f[_0x757b('0x36')](_0x5e673d,0x0,{'type':_0x1e53d5[_0x757b('0x13')],'app':'GotoIfTime','appdata':_0x4e7b1f[_0x5e673d]+'?'+_0x1e53d5[_0x757b('0x14')]+_0x757b('0x37')+_0x5206c6+':'+_0x1e53d5[_0x757b('0x14')]+_0x757b('0x37')+_0x120565,'exten':_0x1e53d5[_0x757b('0x9')],'context':_0x1e53d5[_0x757b('0x14')],'priority':_0x4704c2[_0x757b('0xe')]+_0x5e673d,'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});}_0x1e53d5['priority']=_0xd9a74f['length']?_[_0x757b('0x38')](_0xd9a74f)['priority']+0x1:_0x4704c2['priority'];_0x4704c2[_0x757b('0xe')]=(_0x6fbd4[_0x757b('0x25')]?_['last'](_0x6fbd4)[_0x757b('0xe')]:_0x1e53d5[_0x757b('0xe')])+0x1;_0x4704c2[_0x757b('0x18')]=_[_0x757b('0x39')](_0x4704c2['extensions'],_0xd9a74f,[_0x1e53d5],_0x6fbd4);}_0x4704c2[_0x757b('0x18')][_0x757b('0x16')]({'type':_0x4f5250[_0x2251a8][0x0]['type'],'app':_0x757b('0x3a'),'exten':_0x4f5250[_0x2251a8][0x0]['exten'],'context':_0x4f5250[_0x2251a8][0x0]['context'],'priority':_0x4704c2[_0x757b('0xe')],'VoiceExtensionId':_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]});_0x33daea[_0x757b('0x16')](_0x4f5250[_0x2251a8][0x0][_0x757b('0x15')]);_0x2ad0c9=_[_0x757b('0x39')](_0x2ad0c9,_0x4704c2['extensions']);}}return _0x3df85f[_0x757b('0x3b')](function(_0x52719c){return _0x3df85f[_0x757b('0x2')][_0x757b('0x6')][_0x757b('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x33daea}},'transaction':_0x52719c})[_0x757b('0x8')](function(_0x5407b2){return _0x3df85f['models'][_0x757b('0x6')][_0x757b('0x3d')](_[_0x757b('0x3e')](_0x2ad0c9,'priority'),{'transaction':_0x52719c});});});})['catch'](function(_0x1768bf){console[_0x757b('0x3f')](_0x1768bf);});}exports[_0x757b('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2a27534..f8b0e3e 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 _0x4987=['bluebird','util','lodash','squel','ioredis','../../../config/environment','api','redis','defaults','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','stringify','cmContact','inspect','insert','into','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','fromQuery','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','findAll','outbound','BlackLists','Campaign','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','createReadStream','parse','duplicate','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4987,0x6e));var _0x7498=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x4987[_0x513aa5];return _0x1a1a7c;};'use strict';var BPromise=require(_0x7498('0x0'));var util=require(_0x7498('0x1'));var _=require(_0x7498('0x2'));var fs=require('fs');var squel=require(_0x7498('0x3'));var Papa=require('papaparse');var Redis=require(_0x7498('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x7498('0x5'));var logger=require('../../../config/logger')(_0x7498('0x6'));config[_0x7498('0x7')]=_[_0x7498('0x8')](config[_0x7498('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x7498('0x9'))(new Redis(config[_0x7498('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x7498('0xa')](socket);try{if(!process[_0x7498('0xb')][0x2]||process[_0x7498('0xb')][0x2]===_0x7498('0xc')||process[_0x7498('0xb')][0x2]===_0x7498('0xd')){throw new Error(_0x7498('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7498('0xb')][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]===_0x7498('0xd')||!process[_0x7498('0xb')][0x4]||process[_0x7498('0xb')][0x4]===_0x7498('0xc')||process['argv'][0x4]===_0x7498('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x7498('0xf')](process['argv'][0x3][_0x7498('0x10')](','),process[_0x7498('0xb')][0x4][_0x7498('0x10')](','));if(!process['argv'][0x5]||process[_0x7498('0xb')][0x5]===_0x7498('0xc')||process[_0x7498('0xb')][0x5]===_0x7498('0xd')){throw new Error(_0x7498('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7498('0xb')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x7498('0xb')][0x6]!==_0x7498('0xd')?process[_0x7498('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x7498('0xb')][0x7]!=='undefined'&&process[_0x7498('0xb')][0x7]!==_0x7498('0xd')?process[_0x7498('0xb')][0x7]:null;if(!process[_0x7498('0xb')][0x8]||process[_0x7498('0xb')][0x8]===_0x7498('0xc')||process['argv'][0x8]===_0x7498('0xd')){throw new Error(_0x7498('0x12'));}var SOCKET_TIMESTAMP=process[_0x7498('0xb')][0x8];}catch(_0x1469c9){logger[_0x7498('0x13')](_0x1469c9);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(_0x3112ab,_0x27fbec,_0x34fd3f,_0x44be11){var _0x552562={'message':_0x27fbec};_0x552562[_0x3112ab]=!![];if(_0x34fd3f){_0x552562[_0x7498('0x14')]=_0x34fd3f;}if(_0x44be11){_0x552562[_0x7498('0x15')]=_0x44be11;}return _0x552562;}function isEmail(_0x43af3c){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))*$/[_0x7498('0x16')](_0x43af3c);}function checkRow(_0x4fc532,_0x64e6b2,_0x56b910){return new BPromise(function(_0x31b2e0,_0x3c657b){if(_[_0x7498('0x17')](_0x4fc532)){return _0x3c657b(handleCheckRowError(_0x7498('0x13'),_0x7498('0x18'),null,_0x56b910));}if(_0x4fc532['errors']&&_0x4fc532['errors'][_0x7498('0x19')]){var _0x42e2e5=_[_0x7498('0x1a')](_0x4fc532[_0x7498('0x1b')],'message')[_0x7498('0x1c')](';');return _0x3c657b(handleCheckRowError(_0x7498('0x13'),_0x42e2e5,null,_0x56b910));}var _0x3ba7b0={};for(var _0x15d02e in FIELDS){if(FIELDS[_0x7498('0x1d')](_0x15d02e)&&FIELDS[_0x15d02e]){_0x3ba7b0[_0x15d02e]=_0x4fc532[_0x7498('0x1e')][0x0][FIELDS[_0x15d02e]]||_0x4fc532[_0x7498('0x1e')][0x0]['\ufeff'+FIELDS[_0x15d02e]];}}if(!_0x3ba7b0['firstName']){return _0x3c657b(handleCheckRowError(_0x7498('0x13'),_0x7498('0x1f'),null,_0x56b910));}if(!_0x3ba7b0[_0x7498('0x20')]){return _0x3c657b(handleCheckRowError('error',_0x7498('0x21'),null,_0x56b910));}if(_0x3ba7b0[_0x7498('0x22')]){var _0xb161f1=moment(_0x3ba7b0['birthDate'],'YYYY-MM-DD');if(!_0xb161f1['isValid']()){return _0x3c657b(handleCheckRowError(_0x7498('0x13'),_0x7498('0x23'),null,_0x56b910));}}if(_0x3ba7b0[_0x7498('0x24')]){if(!isEmail(_0x3ba7b0[_0x7498('0x24')])){return _0x3c657b(handleCheckRowError(_0x7498('0x13'),_0x7498('0x25'),null,_0x56b910));}}_0x3ba7b0[_0x7498('0x26')]=LISTID;_0x3ba7b0['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x64e6b2){var _0x54f573={};for(var _0x306f57=0x0,_0x3c4dec=DUPLICATES[_0x7498('0x19')];_0x306f57<_0x3c4dec;_0x306f57+=0x1){_0x54f573[DUPLICATES[_0x306f57]]=_0x3ba7b0[DUPLICATES[_0x306f57]];}var _0x5e4861=_[_0x7498('0x27')](_0x64e6b2,_0x54f573);if(_0x5e4861){return _0x3c657b(handleCheckRowError('duplicate',_0x7498('0x28'),_0x5e4861,_0x56b910));}}return db[_0x7498('0x29')][_0x7498('0x2a')](_0x3ba7b0,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3ba7b0)})[_0x7498('0x2b')](function(_0x49f36b){if(DUPLICATES&&DUPLICATES[_0x7498('0x19')]&&_0x64e6b2){_0x64e6b2[_0x7498('0x2c')](_[_0x7498('0x2d')](_0x3ba7b0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x49f36b['id'];return _0x31b2e0();})[_0x7498('0x2e')](function(_0x3b31a6){return _0x3c657b(handleCheckRowError(_0x7498('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3b31a6['message']||JSON[_0x7498('0x2f')](_0x3b31a6)),null,_0x56b910));});});}function checkHopper(){function _0x133bb6(){return function(_0x1ace83){logger[_0x7498('0x13')](_0x7498('0x30'),'checkHopper',util[_0x7498('0x31')](_0x1ace83,{'showHidden':![],'depth':null}));};}var _0x469b5f=function(_0x67d71d,_0x2179ef){var _0x29b8b0=squel[_0x7498('0x32')]()[_0x7498('0x33')]('cm_hopper')['fromQuery']([_0x7498('0x20'),_0x7498('0x34'),_0x7498('0x35'),_0x7498('0x26'),_0x2179ef,'createdAt',_0x7498('0x36')],squel[_0x7498('0x37')]()[_0x7498('0x38')](_0x7498('0x20'),_0x7498('0x20'))[_0x7498('0x38')](_0x7498('0x39'),'scheduledAt')[_0x7498('0x38')]('id',_0x7498('0x35'))[_0x7498('0x38')](LISTID[_0x7498('0x3a')](),_0x7498('0x26'))['field'](_0x67d71d['id'][_0x7498('0x3a')](),_0x2179ef)[_0x7498('0x38')]('NOW()','createdAt')[_0x7498('0x38')](_0x7498('0x39'),_0x7498('0x36'))['from'](_0x7498('0x3b'))[_0x7498('0x3c')](_0x7498('0x3d'))[_0x7498('0x3c')]('ListId\x20=\x20?',LISTID['toString']())[_0x7498('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x7498('0x3c')](_0x7498('0x3e'),squel[_0x7498('0x37')]()['field'](_0x7498('0x20'))[_0x7498('0x3f')]('cm_hopper')['where'](_0x2179ef+'\x20=\x20?',_0x67d71d['id']['toString']())))[_0x7498('0x3a')]();return _0x29b8b0;};var _0xf215ee=function(_0x222536,_0x1d42a7){var _0x2e3837=squel[_0x7498('0x32')]()[_0x7498('0x33')](_0x7498('0x40'))['fromQuery']([_0x7498('0x20'),_0x7498('0x34'),'ContactId','ListId',_0x1d42a7,_0x7498('0x41'),_0x7498('0x36')],squel[_0x7498('0x37')]()[_0x7498('0x38')]('phone',_0x7498('0x20'))['field']('NOW()',_0x7498('0x34'))[_0x7498('0x38')]('id','ContactId')[_0x7498('0x38')](LISTID[_0x7498('0x3a')](),_0x7498('0x26'))['field'](_0x222536['id'][_0x7498('0x3a')](),_0x1d42a7)[_0x7498('0x38')](_0x7498('0x39'),_0x7498('0x41'))[_0x7498('0x38')](_0x7498('0x39'),_0x7498('0x36'))['from'](_0x7498('0x3b'))['where'](_0x7498('0x3d'))[_0x7498('0x3c')](_0x7498('0x42'),LISTID[_0x7498('0x3a')]())[_0x7498('0x3c')](_0x7498('0x43'),squel[_0x7498('0x44')](hopperContacts))[_0x7498('0x3c')](_0x7498('0x45'))['where'](_0x7498('0x3e'),squel[_0x7498('0x37')]()[_0x7498('0x38')](_0x7498('0x46'))[_0x7498('0x3f')](_0x7498('0x47'))['where'](_0x1d42a7+'\x20=\x20?',_0x222536['id'][_0x7498('0x3a')]()))[_0x7498('0x3c')](_0x7498('0x3e'),squel[_0x7498('0x37')]()[_0x7498('0x38')](_0x7498('0x20'))[_0x7498('0x3f')](_0x7498('0x40'))['where'](_0x1d42a7+_0x7498('0x48'),_0x222536['id'][_0x7498('0x3a')]())))[_0x7498('0x3a')]();return _0x2e3837;};function _0xcf50b5(_0x2f0b8d,_0x37554d){var _0x37d5eb=squel[_0x7498('0x32')]()[_0x7498('0x33')](_0x7498('0x40'))[_0x7498('0x49')]([_0x7498('0x20'),_0x7498('0x34'),_0x7498('0x35'),'ListId',_0x37554d,_0x7498('0x41'),'updatedAt'],squel[_0x7498('0x37')]()[_0x7498('0x38')](_0x7498('0x20'),_0x7498('0x20'))[_0x7498('0x38')](_0x7498('0x39'),_0x7498('0x34'))[_0x7498('0x38')]('id',_0x7498('0x35'))['field'](LISTID[_0x7498('0x3a')](),_0x7498('0x26'))[_0x7498('0x38')](_0x2f0b8d['id'][_0x7498('0x3a')](),_0x37554d)[_0x7498('0x38')](_0x7498('0x39'),'createdAt')[_0x7498('0x38')](_0x7498('0x39'),_0x7498('0x36'))[_0x7498('0x3f')](_0x7498('0x3b'))[_0x7498('0x3c')](_0x7498('0x3d'))[_0x7498('0x3c')](_0x7498('0x42'),LISTID[_0x7498('0x3a')]())[_0x7498('0x3c')]('id\x20IN\x20?',squel[_0x7498('0x44')](hopperContacts))[_0x7498('0x3c')](_0x7498('0x45')))['toString']();return _0x37d5eb;}function _0x3d4bf0(_0x5cecf5,_0x584ad2){var _0x33e662=squel[_0x7498('0x32')]()[_0x7498('0x33')](_0x7498('0x4a'))[_0x7498('0x49')]([_0x7498('0x20'),_0x7498('0x35'),_0x7498('0x26'),_0x584ad2,_0x7498('0x41'),_0x7498('0x36')],squel[_0x7498('0x37')]()[_0x7498('0x38')]('phone',_0x7498('0x20'))[_0x7498('0x38')]('id',_0x7498('0x35'))[_0x7498('0x38')](LISTID[_0x7498('0x3a')](),'ListId')[_0x7498('0x38')](_0x5cecf5['id']['toString'](),_0x584ad2)[_0x7498('0x38')](_0x7498('0x39'),_0x7498('0x41'))[_0x7498('0x38')]('NOW()',_0x7498('0x36'))['from']('cm_contacts')['where'](_0x7498('0x3d'))[_0x7498('0x3c')](_0x7498('0x42'),LISTID[_0x7498('0x3a')]())['where'](_0x7498('0x43'),squel[_0x7498('0x44')](hopperContacts))[_0x7498('0x3c')](_0x7498('0x45')))[_0x7498('0x3a')]();return _0x33e662;}return db[_0x7498('0x4b')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x7498('0x4c')],'include':[{'model':db[_0x7498('0x4d')],'as':_0x7498('0x4e'),'where':{'id':LISTID}}]})[_0x7498('0x2b')](function(_0x581b40){var _0x28e691=[];if(_0x581b40){var _0x3faf1e;for(var _0x2b64a7=0x0,_0x2b232c;_0x2b64a7<_0x581b40[_0x7498('0x19')];_0x2b64a7+=0x1){_0x2b232c=_0x581b40[_0x2b64a7]['get']({'plain':!![]});switch(_0x2b232c[_0x7498('0x4c')]){case _0x7498('0x4f'):_0x28e691['push'](db[_0x7498('0x50')]['query'](_0xf215ee(_0x2b232c,_0x7498('0x51')))[_0x7498('0x2b')](function(){})[_0x7498('0x2e')](_0x133bb6()));break;case _0x7498('0x52'):_0x28e691[_0x7498('0x2c')](db[_0x7498('0x50')][_0x7498('0x53')](_0x469b5f(_0x2b232c,_0x7498('0x51')))[_0x7498('0x2b')](function(){})[_0x7498('0x2e')](_0x133bb6()));break;default:_0x28e691[_0x7498('0x2c')](db[_0x7498('0x50')][_0x7498('0x53')](_0xcf50b5(_0x2b232c,'VoiceQueueId'))[_0x7498('0x2b')](function(){})[_0x7498('0x2e')](_0x133bb6()));}}}return _0x28e691;})[_0x7498('0x54')]()[_0x7498('0x2b')](function(){return db['VoiceQueue'][_0x7498('0x55')]({'where':{'type':_0x7498('0x56')},'attributes':['id'],'include':[{'model':db[_0x7498('0x4d')],'as':_0x7498('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x1b9bfa){var _0x2b7847=[];if(_0x1b9bfa){var _0x352004;for(var _0x4dc75e=0x0,_0x1bddac;_0x4dc75e<_0x1b9bfa['length'];_0x4dc75e+=0x1){_0x1bddac=_0x1b9bfa[_0x4dc75e]['get']({'plain':!![]});_0x2b7847[_0x7498('0x2c')](db[_0x7498('0x50')]['query'](_0x3d4bf0(_0x1bddac,_0x7498('0x51')))['then'](function(){})[_0x7498('0x2e')](_0x133bb6()));}}return _0x2b7847;})[_0x7498('0x54')]();})[_0x7498('0x2b')](function(){return db[_0x7498('0x58')][_0x7498('0x55')]({'attributes':['id',_0x7498('0x4c')],'include':[{'model':db[_0x7498('0x4d')],'as':_0x7498('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x4814cc){var _0x347807=[];if(_0x4814cc){for(var _0x2a9639=0x0,_0x437951;_0x2a9639<_0x4814cc[_0x7498('0x19')];_0x2a9639+=0x1){_0x437951=_0x4814cc[_0x2a9639][_0x7498('0x59')]({'plain':!![]});switch(_0x437951[_0x7498('0x4c')]){case'always':_0x347807[_0x7498('0x2c')](db[_0x7498('0x50')][_0x7498('0x53')](_0xf215ee(_0x437951,_0x7498('0x5a')))[_0x7498('0x2b')](function(){})[_0x7498('0x2e')](_0x133bb6()));break;case _0x7498('0x52'):_0x347807['push'](db['sequelize'][_0x7498('0x53')](_0x469b5f(_0x437951,'CampaignId'))[_0x7498('0x2b')](function(){})[_0x7498('0x2e')](_0x133bb6()));break;default:_0x347807[_0x7498('0x2c')](db[_0x7498('0x50')]['query'](_0xcf50b5(_0x437951,_0x7498('0x5a')))['then'](function(){})['catch'](_0x133bb6()));}}}return _0x347807;})[_0x7498('0x54')]();})[_0x7498('0x2b')](function(){return db['Campaign'][_0x7498('0x55')]({'attributes':['id'],'include':[{'model':db[_0x7498('0x4d')],'as':_0x7498('0x57'),'where':{'id':LISTID}}]})[_0x7498('0x2b')](function(_0x26d06d){var _0x2bf499=[];if(_0x26d06d){for(var _0x33445b=0x0,_0x3e8185;_0x33445b<_0x26d06d[_0x7498('0x19')];_0x33445b+=0x1){_0x3e8185=_0x26d06d[_0x33445b][_0x7498('0x59')]({'plain':!![]});_0x2bf499[_0x7498('0x2c')](db[_0x7498('0x50')][_0x7498('0x53')](_0x3d4bf0(_0x3e8185,_0x7498('0x5a')))[_0x7498('0x2b')](function(){})[_0x7498('0x2e')](_0x133bb6()));}}return _0x2bf499;})[_0x7498('0x54')]();})[_0x7498('0x2e')](function(_0x42ecf0){logger[_0x7498('0x13')](_0x7498('0x5b'),_0x7498('0x5c'),_0x42ecf0[_0x7498('0x5d')]);});}var processPromises=function(_0x5d55ba){return BPromise[_0x7498('0x54')](promises)[_0x7498('0x2b')](function(_0x42e846){})[_0x7498('0x2e')](function(_0x5c456d){logger[_0x7498('0x13')](_0x7498('0x5e'),JSON[_0x7498('0x2f')](_0x5c456d));})[_0x7498('0x5f')](function(){socket[_0x7498('0x60')](_0x7498('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d55ba){return _0x5d55ba[_0x7498('0x62')]();}});};var endCsv=function(){return BPromise[_0x7498('0x63')]()[_0x7498('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x7498('0x2b')](function(){socket['emit'](_0x7498('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7498('0x64')](FILEPATH);}catch(_0x46b5d8){logger[_0x7498('0x13')](_0x7498('0x65'),JSON[_0x7498('0x2f')](_0x46b5d8));}finally{process[_0x7498('0x66')](0x0);}});};process['on']('SIGINT',function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7498('0x63')]()[_0x7498('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7498('0x10')](',');return db[_0x7498('0x29')][_0x7498('0x55')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7498('0x2b')](function(_0x5e5729){var _0x4fb4d3=fs[_0x7498('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7498('0x68')](_0x4fb4d3,{'header':!![],'skipEmptyLines':!![],'step':function(_0x443749,_0x20e2cb){total+=0x1;var _0x13b881=total;promises[_0x7498('0x2c')](checkRow(_0x443749,_0x5e5729,_0x13b881)['then'](function(){success+=0x1;})['catch'](function(_0x46dcf8){if(_0x46dcf8['error']){errors+=0x1;delete _0x46dcf8['error'];}else if(_0x46dcf8[_0x7498('0x69')]){duplicates+=0x1;delete _0x46dcf8[_0x7498('0x69')];}rows[_0x7498('0x2c')](_0x46dcf8);}));if(total%0xc8===0x0){_0x20e2cb['pause']();return processPromises(_0x20e2cb);}},'complete':function(){return processPromises()[_0x7498('0x2b')](function(){logger['info'](_0x7498('0x6a'));endCsv();});},'error':function(_0x4de203,_0x473ea3){logger[_0x7498('0x6b')](_0x7498('0x6c'),JSON[_0x7498('0x2f')](_0x4de203));endCsv();}});})['catch'](function(_0x300a4e){logger[_0x7498('0x13')](_0x7498('0x6d'),JSON[_0x7498('0x2f')](_0x300a4e));});}main(); \ No newline at end of file +var _0x18a3=['field','toString','NOW()','createdAt','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','push','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Lists','CampaignId','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','contact:csv_','exit','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','CSV\x20parsed\x20correctly!','info','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','socket.io-emitter','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','scheduledAt','ContactId','select'];(function(_0x46f2f9,_0x52eec8){var _0x545327=function(_0x3e4dd9){while(--_0x3e4dd9){_0x46f2f9['push'](_0x46f2f9['shift']());}};_0x545327(++_0x52eec8);}(_0x18a3,0x105));var _0x318a=function(_0x463f64,_0x41bb3c){_0x463f64=_0x463f64-0x0;var _0x2d1319=_0x18a3[_0x463f64];return _0x2d1319;};'use strict';var BPromise=require('bluebird');var util=require(_0x318a('0x0'));var _=require(_0x318a('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x318a('0x2'));var Redis=require(_0x318a('0x3'));var db=require(_0x318a('0x4'))['db'];var config=require(_0x318a('0x5'));var logger=require('../../../config/logger')('api');config[_0x318a('0x6')]=_[_0x318a('0x7')](config[_0x318a('0x6')],{'host':_0x318a('0x8'),'port':0x18eb});var socket=require(_0x318a('0x9'))(new Redis(config[_0x318a('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x318a('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x318a('0xb')][0x2]==='undefined'||process[_0x318a('0xb')][0x2]===_0x318a('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x318a('0xb')][0x2];if(!process['argv'][0x3]||process[_0x318a('0xb')][0x3]===_0x318a('0xd')||process[_0x318a('0xb')][0x3]==='null'||!process[_0x318a('0xb')][0x4]||process[_0x318a('0xb')][0x4]===_0x318a('0xd')||process[_0x318a('0xb')][0x4]==='null'){throw new Error(_0x318a('0xe'));}var FIELDS=_[_0x318a('0xf')](process['argv'][0x3]['split'](','),process[_0x318a('0xb')][0x4][_0x318a('0x10')](','));if(!process['argv'][0x5]||process[_0x318a('0xb')][0x5]==='undefined'||process['argv'][0x5]===_0x318a('0xc')){throw new Error(_0x318a('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x318a('0xb')][0x6]&&process[_0x318a('0xb')][0x6]!==_0x318a('0xd')&&process['argv'][0x6]!==_0x318a('0xc')?process[_0x318a('0xb')][0x6]:null;var DUPLICATES=process[_0x318a('0xb')][0x7]&&process[_0x318a('0xb')][0x7]!==_0x318a('0xd')&&process[_0x318a('0xb')][0x7]!==_0x318a('0xc')?process[_0x318a('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0x318a('0xb')][0x8]===_0x318a('0xd')||process['argv'][0x8]===_0x318a('0xc')){throw new Error(_0x318a('0x12'));}var SOCKET_TIMESTAMP=process[_0x318a('0xb')][0x8];}catch(_0xfe3f22){logger[_0x318a('0x13')](_0xfe3f22);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(_0x22b9c8,_0x3f4074,_0x74ee0f,_0xf29f9f){var _0x5a74cf={'message':_0x3f4074};_0x5a74cf[_0x22b9c8]=!![];if(_0x74ee0f){_0x5a74cf[_0x318a('0x14')]=_0x74ee0f;}if(_0xf29f9f){_0x5a74cf[_0x318a('0x15')]=_0xf29f9f;}return _0x5a74cf;}function isEmail(_0x2cdece){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'](_0x2cdece);}function checkRow(_0x27f46f,_0x36b8db,_0x11e832){return new BPromise(function(_0x1464ca,_0x3bbd97){if(_['isNil'](_0x27f46f)){return _0x3bbd97(handleCheckRowError(_0x318a('0x13'),_0x318a('0x16'),null,_0x11e832));}if(_0x27f46f[_0x318a('0x17')]&&_0x27f46f['errors'][_0x318a('0x18')]){var _0x3a000b=_['map'](_0x27f46f[_0x318a('0x17')],_0x318a('0x19'))[_0x318a('0x1a')](';');return _0x3bbd97(handleCheckRowError(_0x318a('0x13'),_0x3a000b,null,_0x11e832));}var _0x4de0e3={};for(var _0x58d998 in FIELDS){if(FIELDS[_0x318a('0x1b')](_0x58d998)&&FIELDS[_0x58d998]){_0x4de0e3[_0x58d998]=_0x27f46f[_0x318a('0x1c')][0x0][FIELDS[_0x58d998]]||_0x27f46f[_0x318a('0x1c')][0x0]['\ufeff'+FIELDS[_0x58d998]];}}if(!_0x4de0e3[_0x318a('0x1d')]){return _0x3bbd97(handleCheckRowError('error',_0x318a('0x1e'),null,_0x11e832));}if(!_0x4de0e3[_0x318a('0x1f')]){return _0x3bbd97(handleCheckRowError(_0x318a('0x13'),_0x318a('0x20'),null,_0x11e832));}if(_0x4de0e3['birthDate']){var _0x55e1dc=moment(_0x4de0e3[_0x318a('0x21')],_0x318a('0x22'));if(!_0x55e1dc[_0x318a('0x23')]()){return _0x3bbd97(handleCheckRowError(_0x318a('0x13'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x11e832));}}if(_0x4de0e3[_0x318a('0x24')]){if(!isEmail(_0x4de0e3[_0x318a('0x24')])){return _0x3bbd97(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x11e832));}}_0x4de0e3[_0x318a('0x25')]=LISTID;_0x4de0e3[_0x318a('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x318a('0x18')]&&_0x36b8db){var _0x4c697e={};for(var _0x2a942b=0x0,_0x26736e=DUPLICATES[_0x318a('0x18')];_0x2a942b<_0x26736e;_0x2a942b+=0x1){_0x4c697e[DUPLICATES[_0x2a942b]]=_0x4de0e3[DUPLICATES[_0x2a942b]];}var _0xfd4278=_[_0x318a('0x27')](_0x36b8db,_0x4c697e);if(_0xfd4278){return _0x3bbd97(handleCheckRowError(_0x318a('0x28'),'Duplicate\x20Contact',_0xfd4278,_0x11e832));}}return db[_0x318a('0x29')][_0x318a('0x2a')](_0x4de0e3,{'raw':!![],'hooks':![],'fields':_[_0x318a('0x2b')](_0x4de0e3)})[_0x318a('0x2c')](function(_0x28f207){if(DUPLICATES&&DUPLICATES['length']&&_0x36b8db){_0x36b8db['push'](_[_0x318a('0x2d')](_0x4de0e3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x28f207['id'];return _0x1464ca();})[_0x318a('0x2e')](function(_0xd92048){return _0x3bbd97(handleCheckRowError(_0x318a('0x13'),_0x318a('0x2f')+(_0xd92048[_0x318a('0x19')]||JSON[_0x318a('0x30')](_0xd92048)),null,_0x11e832));});});}function checkHopper(){function _0x3dbbec(){return function(_0x2b8a94){logger[_0x318a('0x13')](_0x318a('0x31'),'checkHopper',util[_0x318a('0x32')](_0x2b8a94,{'showHidden':![],'depth':null}));};}var _0x177384=function(_0x3bff0f,_0x17a052){var _0x176a97=squel[_0x318a('0x33')]()[_0x318a('0x34')](_0x318a('0x35'))['fromQuery']([_0x318a('0x1f'),_0x318a('0x36'),_0x318a('0x37'),_0x318a('0x25'),_0x17a052,'createdAt','updatedAt'],squel[_0x318a('0x38')]()[_0x318a('0x39')](_0x318a('0x1f'),'phone')[_0x318a('0x39')]('NOW()',_0x318a('0x36'))['field']('id',_0x318a('0x37'))[_0x318a('0x39')](LISTID[_0x318a('0x3a')](),_0x318a('0x25'))[_0x318a('0x39')](_0x3bff0f['id'][_0x318a('0x3a')](),_0x17a052)[_0x318a('0x39')](_0x318a('0x3b'),_0x318a('0x3c'))[_0x318a('0x39')]('NOW()',_0x318a('0x3d'))[_0x318a('0x3e')](_0x318a('0x3f'))['where'](_0x318a('0x40'))[_0x318a('0x41')](_0x318a('0x42'),LISTID[_0x318a('0x3a')]())[_0x318a('0x41')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x318a('0x43'),squel['select']()['field']('phone')['from']('cm_hopper')[_0x318a('0x41')](_0x17a052+_0x318a('0x44'),_0x3bff0f['id'][_0x318a('0x3a')]())))[_0x318a('0x3a')]();return _0x176a97;};var _0x575b07=function(_0x123be4,_0xb7bb0e){var _0x4189fc=squel[_0x318a('0x33')]()[_0x318a('0x34')](_0x318a('0x35'))[_0x318a('0x45')]([_0x318a('0x1f'),_0x318a('0x36'),_0x318a('0x37'),_0x318a('0x25'),_0xb7bb0e,_0x318a('0x3c'),_0x318a('0x3d')],squel[_0x318a('0x38')]()[_0x318a('0x39')](_0x318a('0x1f'),_0x318a('0x1f'))[_0x318a('0x39')](_0x318a('0x3b'),_0x318a('0x36'))['field']('id',_0x318a('0x37'))[_0x318a('0x39')](LISTID[_0x318a('0x3a')](),_0x318a('0x25'))['field'](_0x123be4['id']['toString'](),_0xb7bb0e)[_0x318a('0x39')](_0x318a('0x3b'),_0x318a('0x3c'))[_0x318a('0x39')](_0x318a('0x3b'),_0x318a('0x3d'))[_0x318a('0x3e')](_0x318a('0x3f'))['where'](_0x318a('0x40'))['where'](_0x318a('0x42'),LISTID['toString']())[_0x318a('0x41')](_0x318a('0x46'),squel[_0x318a('0x47')](hopperContacts))[_0x318a('0x41')](_0x318a('0x48'))[_0x318a('0x41')](_0x318a('0x43'),squel[_0x318a('0x38')]()['field'](_0x318a('0x49'))[_0x318a('0x3e')]('cm_hopper_final')[_0x318a('0x41')](_0xb7bb0e+_0x318a('0x44'),_0x123be4['id'][_0x318a('0x3a')]()))[_0x318a('0x41')](_0x318a('0x43'),squel[_0x318a('0x38')]()['field'](_0x318a('0x1f'))[_0x318a('0x3e')](_0x318a('0x35'))[_0x318a('0x41')](_0xb7bb0e+'\x20=\x20?',_0x123be4['id'][_0x318a('0x3a')]())))[_0x318a('0x3a')]();return _0x4189fc;};function _0x5dbccc(_0x307f3,_0x3b8ec5){var _0x2110fc=squel[_0x318a('0x33')]()[_0x318a('0x34')]('cm_hopper')[_0x318a('0x45')]([_0x318a('0x1f'),'scheduledAt','ContactId',_0x318a('0x25'),_0x3b8ec5,_0x318a('0x3c'),'updatedAt'],squel[_0x318a('0x38')]()[_0x318a('0x39')](_0x318a('0x1f'),_0x318a('0x1f'))[_0x318a('0x39')](_0x318a('0x3b'),'scheduledAt')['field']('id',_0x318a('0x37'))[_0x318a('0x39')](LISTID[_0x318a('0x3a')](),_0x318a('0x25'))[_0x318a('0x39')](_0x307f3['id'][_0x318a('0x3a')](),_0x3b8ec5)[_0x318a('0x39')]('NOW()',_0x318a('0x3c'))[_0x318a('0x39')](_0x318a('0x3b'),'updatedAt')[_0x318a('0x3e')]('cm_contacts')[_0x318a('0x41')](_0x318a('0x40'))[_0x318a('0x41')](_0x318a('0x42'),LISTID['toString']())[_0x318a('0x41')](_0x318a('0x46'),squel['str'](hopperContacts))['where'](_0x318a('0x48')))[_0x318a('0x3a')]();return _0x2110fc;}function _0x5f1a09(_0x2d1aff,_0x1cf732){var _0x5ebb16=squel['insert']()[_0x318a('0x34')]('cm_hopper_black')[_0x318a('0x45')]([_0x318a('0x1f'),_0x318a('0x37'),'ListId',_0x1cf732,_0x318a('0x3c'),_0x318a('0x3d')],squel[_0x318a('0x38')]()[_0x318a('0x39')](_0x318a('0x1f'),_0x318a('0x1f'))[_0x318a('0x39')]('id',_0x318a('0x37'))[_0x318a('0x39')](LISTID[_0x318a('0x3a')](),_0x318a('0x25'))[_0x318a('0x39')](_0x2d1aff['id'][_0x318a('0x3a')](),_0x1cf732)['field']('NOW()',_0x318a('0x3c'))[_0x318a('0x39')](_0x318a('0x3b'),_0x318a('0x3d'))['from'](_0x318a('0x3f'))[_0x318a('0x41')](_0x318a('0x40'))['where'](_0x318a('0x42'),LISTID[_0x318a('0x3a')]())[_0x318a('0x41')](_0x318a('0x46'),squel[_0x318a('0x47')](hopperContacts))['where'](_0x318a('0x48')))[_0x318a('0x3a')]();return _0x5ebb16;}return db[_0x318a('0x4a')][_0x318a('0x4b')]({'where':{'type':_0x318a('0x4c')},'attributes':['id',_0x318a('0x4d')],'include':[{'model':db[_0x318a('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x318a('0x2c')](function(_0x3ff8d5){var _0x5138f8=[];if(_0x3ff8d5){var _0x4bdf2e;for(var _0x472c5f=0x0,_0x4d8c59;_0x472c5f<_0x3ff8d5[_0x318a('0x18')];_0x472c5f+=0x1){_0x4d8c59=_0x3ff8d5[_0x472c5f][_0x318a('0x4f')]({'plain':!![]});switch(_0x4d8c59[_0x318a('0x4d')]){case _0x318a('0x50'):_0x5138f8[_0x318a('0x51')](db['sequelize'][_0x318a('0x52')](_0x575b07(_0x4d8c59,_0x318a('0x53')))['then'](function(){})[_0x318a('0x2e')](_0x3dbbec()));break;case _0x318a('0x54'):_0x5138f8['push'](db['sequelize'][_0x318a('0x52')](_0x177384(_0x4d8c59,_0x318a('0x53')))[_0x318a('0x2c')](function(){})[_0x318a('0x2e')](_0x3dbbec()));break;default:_0x5138f8[_0x318a('0x51')](db[_0x318a('0x55')][_0x318a('0x52')](_0x5dbccc(_0x4d8c59,'VoiceQueueId'))[_0x318a('0x2c')](function(){})[_0x318a('0x2e')](_0x3dbbec()));}}}return _0x5138f8;})[_0x318a('0x56')]()['then'](function(){return db[_0x318a('0x4a')][_0x318a('0x4b')]({'where':{'type':_0x318a('0x4c')},'attributes':['id'],'include':[{'model':db[_0x318a('0x4e')],'as':_0x318a('0x57'),'where':{'id':LISTID}}]})[_0x318a('0x2c')](function(_0x37268a){var _0x4663b3=[];if(_0x37268a){var _0x1a5f85;for(var _0x547764=0x0,_0x1bff5a;_0x547764<_0x37268a[_0x318a('0x18')];_0x547764+=0x1){_0x1bff5a=_0x37268a[_0x547764][_0x318a('0x4f')]({'plain':!![]});_0x4663b3[_0x318a('0x51')](db[_0x318a('0x55')][_0x318a('0x52')](_0x5f1a09(_0x1bff5a,_0x318a('0x53')))[_0x318a('0x2c')](function(){})[_0x318a('0x2e')](_0x3dbbec()));}}return _0x4663b3;})['all']();})[_0x318a('0x2c')](function(){return db['Campaign'][_0x318a('0x4b')]({'attributes':['id',_0x318a('0x4d')],'include':[{'model':db[_0x318a('0x4e')],'as':_0x318a('0x58'),'where':{'id':LISTID}}]})[_0x318a('0x2c')](function(_0xb0a89f){var _0x3663d2=[];if(_0xb0a89f){for(var _0x895dd4=0x0,_0xe980f7;_0x895dd4<_0xb0a89f[_0x318a('0x18')];_0x895dd4+=0x1){_0xe980f7=_0xb0a89f[_0x895dd4][_0x318a('0x4f')]({'plain':!![]});switch(_0xe980f7['dialCheckDuplicateType']){case _0x318a('0x50'):_0x3663d2[_0x318a('0x51')](db['sequelize'][_0x318a('0x52')](_0x575b07(_0xe980f7,_0x318a('0x59')))[_0x318a('0x2c')](function(){})[_0x318a('0x2e')](_0x3dbbec()));break;case'onlyIfOpen':_0x3663d2[_0x318a('0x51')](db[_0x318a('0x55')][_0x318a('0x52')](_0x177384(_0xe980f7,_0x318a('0x59')))[_0x318a('0x2c')](function(){})[_0x318a('0x2e')](_0x3dbbec()));break;default:_0x3663d2[_0x318a('0x51')](db['sequelize']['query'](_0x5dbccc(_0xe980f7,_0x318a('0x59')))[_0x318a('0x2c')](function(){})[_0x318a('0x2e')](_0x3dbbec()));}}}return _0x3663d2;})[_0x318a('0x56')]();})[_0x318a('0x2c')](function(){return db[_0x318a('0x5a')][_0x318a('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x318a('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x318a('0x2c')](function(_0x3c3305){var _0x5cd0eb=[];if(_0x3c3305){for(var _0x291e1d=0x0,_0x52b003;_0x291e1d<_0x3c3305['length'];_0x291e1d+=0x1){_0x52b003=_0x3c3305[_0x291e1d][_0x318a('0x4f')]({'plain':!![]});_0x5cd0eb[_0x318a('0x51')](db[_0x318a('0x55')]['query'](_0x5f1a09(_0x52b003,_0x318a('0x59')))[_0x318a('0x2c')](function(){})[_0x318a('0x2e')](_0x3dbbec()));}}return _0x5cd0eb;})[_0x318a('0x56')]();})['catch'](function(_0x3f70f9){logger[_0x318a('0x13')]('cmContact,\x20%s,\x20%s',_0x318a('0x5b'),_0x3f70f9[_0x318a('0x19')]);});}var processPromises=function(_0x4c9a47){return BPromise[_0x318a('0x56')](promises)[_0x318a('0x2c')](function(_0x3b48a1){})[_0x318a('0x2e')](function(_0x5bbcc6){logger[_0x318a('0x13')](_0x318a('0x5c'),JSON[_0x318a('0x30')](_0x5bbcc6));})[_0x318a('0x5d')](function(){socket[_0x318a('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4c9a47){return _0x4c9a47[_0x318a('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x318a('0x2c')](function(){socket['emit'](_0x318a('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x10b308){logger[_0x318a('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x318a('0x30')](_0x10b308));}finally{process[_0x318a('0x61')](0x0);}});};process['on'](_0x318a('0x62'),function(){logger['info'](_0x318a('0x63'));endCsv();});function main(){return BPromise[_0x318a('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x318a('0x10')](',');return db[_0x318a('0x29')][_0x318a('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x318a('0x2c')](function(_0x48308e){var _0x2637e2=fs[_0x318a('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x318a('0x66')](_0x2637e2,{'header':!![],'skipEmptyLines':!![],'step':function(_0x53c8f4,_0x135510){total+=0x1;var _0x30624d=total;promises['push'](checkRow(_0x53c8f4,_0x48308e,_0x30624d)[_0x318a('0x2c')](function(){success+=0x1;})[_0x318a('0x2e')](function(_0x48c97f){if(_0x48c97f[_0x318a('0x13')]){errors+=0x1;delete _0x48c97f[_0x318a('0x13')];}else if(_0x48c97f[_0x318a('0x28')]){duplicates+=0x1;delete _0x48c97f['duplicate'];}rows[_0x318a('0x51')](_0x48c97f);}));if(total%0xc8===0x0){_0x135510['pause']();return processPromises(_0x135510);}},'complete':function(){return processPromises()[_0x318a('0x2c')](function(){logger['info'](_0x318a('0x67'));endCsv();});},'error':function(_0x5d3e51,_0x4afd11){logger[_0x318a('0x68')]('CSV\x20parse\x20error',JSON['stringify'](_0x5d3e51));endCsv();}});})['catch'](function(_0x5dc62e){logger[_0x318a('0x13')](_0x318a('0x69'),JSON[_0x318a('0x30')](_0x5dc62e));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2ca749c..f54f291 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 _0x8671=['into','fromQuery','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','cm_hopper_black','ContactId','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','priority','.CmListId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','MIN(id)','group','info','error','errors','message','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','set','offset','main','stringify','send','binding','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','trim','itemTypeId','SystemRow','emit','contact:import:','Abort\x20parser','abort','step','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','findAll','then','push','all','AdditionalPhones','length','split','isNil','filter','findOne','CmContactHasItem','update','updated','create','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert'];(function(_0x912f30,_0x505baf){var _0x174c23=function(_0x2f3053){while(--_0x2f3053){_0x912f30['push'](_0x912f30['shift']());}};_0x174c23(++_0x505baf);}(_0x8671,0x1ed));var _0x1867=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x8671[_0x2b5eae];return _0x5f3ac9;};'use strict';var fs=require('fs');var path=require(_0x1867('0x0'));var _=require('lodash');var Papa=require(_0x1867('0x1'));var util=require(_0x1867('0x2'));var BPromise=require(_0x1867('0x3'));var moment=require('moment');var squel=require(_0x1867('0x4'));var Redis=require(_0x1867('0x5'));var db=require(_0x1867('0x6'))['db'];var config=require(_0x1867('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x1867('0x8'))('import');config[_0x1867('0x9')]=_[_0x1867('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1867('0xb'))(new Redis(config[_0x1867('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x1867('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()[_0x1867('0xc')](_0x1867('0xd'));function isEmail(_0x15d371){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))*$/[_0x1867('0xe')](_0x15d371);}function selectNotIn(_0x496de5,_0x325389,_0x207bbb,_0xb58f66,_0x3183c8){return squel['select']()[_0x1867('0xf')](_0x1867('0x10'))[_0x1867('0x11')](_0xb58f66)[_0x1867('0x12')](_0x325389,null,_0x325389+_0x1867('0x13')+_0xb58f66+'.'+_0x207bbb)[_0x1867('0x14')](_0xb58f66+'.'+_0x207bbb+_0x1867('0x15')+_0x496de5+'.'+_0x207bbb)[_0x1867('0x14')](_0x325389+'.dialCheckDuplicateType\x20IN\x20('+_0x3183c8[_0x1867('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bc136,_0x34c58c){promisesAdditionalPhones=[];return db['CmContact'][_0x1867('0x16')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x1867('0x17')](function(_0x316948){if(_0x316948!==null){var _0xf7eacd=[];for(var _0x24b8c5=0x0;_0x24b8c5<_0x316948['length'];_0x24b8c5++){var _0x56efb1=_0x316948[_0x24b8c5];_0xf7eacd[_0x1867('0x18')](insertAdditionalPhones(_0x56efb1));}}Promise[_0x1867('0x19')](_0xf7eacd)[_0x1867('0x17')](function(){_0x5bc136({'val':0x1});});});});}function insertAdditionalPhones(_0x1e0ed5){return new Promise(function(_0x3f0cd0,_0x3df70b){var _0x28d580=_0x1e0ed5[_0x1867('0x1a')];var _0x4dbce9=_0x28d580['split'](';');var _0x4cfc93=[];orderBy=0x0;for(var _0x426c08=0x0;_0x426c08<_0x4dbce9[_0x1867('0x1b')];_0x426c08++){_0x4cfc93[_0x1867('0x18')](splitAdditionalPhone(_0x1e0ed5['id'],_0x4dbce9[_0x426c08]));}Promise[_0x1867('0x19')](_0x4cfc93)[_0x1867('0x17')](function(){_0x3f0cd0({'val':_0x4dbce9['length']});});});}function splitAdditionalPhone(_0x11bdda,_0xa1570){return new Promise(function(_0x2544d1,_0x5a0f5d){var _0x4fa1e9=_0xa1570[_0x1867('0x1c')](':');var _0x460ab5=_0x4fa1e9[0x0];var _0xe6f554=_0x4fa1e9[0x1];if(!_[_0x1867('0x1d')](_0xe6f554)){var _0x18138f=_0xe6f554[_0x1867('0x1c')]('|');var _0x29ed13=[];for(var _0x4b0a95=0x0;_0x4b0a95<_0x18138f[_0x1867('0x1b')];_0x4b0a95++){if(_0x18138f[_0x4b0a95]!==''){var _0x3450ea=_[_0x1867('0x1e')](promisesAdditionalPhones,{'contactId':_0x11bdda,'phone':_0x18138f[_0x4b0a95]});if(_0x3450ea[_0x1867('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x11bdda,'contactTypeId':_0x460ab5,'phone':_0x18138f[_0x4b0a95],'orderBy':orderBy});}}}_0x2544d1({'ok':0x1});}else _0x2544d1({'res':0x0});});}function createAdditionalPhone(_0x1f6d8d,_0x43f702,_0x367cb7,_0x26743c){var _0x113293='';var _0x403273='';var _0x345dc6=_0x367cb7[_0x1867('0x1c')]('§');_0x113293=_0x345dc6[0x0];if(_0x345dc6['length']==0x2)_0x403273=_0x345dc6[0x1];return new Promise(function(_0x496963,_0x255789){return db['CmContactHasItem'][_0x1867('0x1f')]({'where':{'CmContactId':_0x1f6d8d,'item':_0x113293}})[_0x1867('0x17')](function(_0x20c188){if(_0x20c188){return db[_0x1867('0x20')][_0x1867('0x21')]({'ItemTypeId':_0x43f702,'description':_0x403273,'OrderBy':_0x26743c},{'where':{'CmContactId':_0x1f6d8d,'item':_0x113293}})[_0x1867('0x17')](function(_0x18b1bf){_0x496963({'res':_0x1867('0x22')});});}else{return db[_0x1867('0x20')][_0x1867('0x23')]({'CmContactId':_0x1f6d8d,'item':_0x113293,'description':_0x403273,'ItemTypeId':_0x43f702,'OrderBy':_0x26743c,'ItemClass':'PHONE'})[_0x1867('0x17')](function(_0x37c995){_0x496963({'res':_0x1867('0x24')});});}});});}function insertCmHopper(_0x340312,_0x1f6bf3,_0x2636e4,_0xaaf378,_0x5af0ed){var _0x342f8e=[_0x1867('0x25'),'cm_contacts.scheduledat','cm_contacts.id',_0x1867('0x26'),_0x1f6bf3+'.'+_0xaaf378,_0x1867('0x27'),_0x1867('0x28'),_0x1867('0x29'),_0x1867('0x2a'),'\x22'+_0x5af0ed+'\x22'];return squel[_0x1867('0x2b')]()[_0x1867('0x2c')]('cm_hopper')[_0x1867('0x2d')]([_0x1867('0x10'),_0x1867('0x2e'),'ContactId',_0x1867('0x2f'),_0xaaf378,_0x1867('0x30'),_0x1867('0x31'),'priority',_0x1867('0x32'),_0x1867('0x33')],squel[_0x1867('0x34')]()[_0x1867('0x35')](_0x342f8e)[_0x1867('0x11')](_0x1f6bf3)[_0x1867('0x12')](_0x1867('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x1f6bf3+'.CmListId')[_0x1867('0x12')](_0x2636e4,null,_0x2636e4+_0x1867('0x13')+_0x1f6bf3+'.'+_0xaaf378)[_0x1867('0x14')](_0x1f6bf3+_0x1867('0x37'),_0x340312)['where'](_0x1867('0x38'),NOW)[_0x1867('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1f6bf3,_0x2636e4,_0xaaf378,_0x1867('0x39'),[_0x1867('0x3a'),_0x1867('0x3b')]))[_0x1867('0x14')](_0x1867('0x3c'),selectNotIn(_0x1f6bf3,_0x2636e4,_0xaaf378,'cm_hopper',[_0x1867('0x3a')])))[_0x1867('0x3d')]();}function insertCmHopperBlack(_0x2835a7,_0x52e44c,_0x2d859e,_0x307b85){var _0x66535c=[_0x1867('0x25'),_0x1867('0x3e'),_0x1867('0x26'),_0x52e44c+'.'+_0x307b85,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x1867('0x2b')]()[_0x1867('0x2c')](_0x1867('0x3f'))[_0x1867('0x2d')]([_0x1867('0x10'),_0x1867('0x40'),_0x1867('0x2f'),_0x307b85,'createdAt',_0x1867('0x31')],squel[_0x1867('0x34')]()[_0x1867('0x35')](_0x66535c)[_0x1867('0x11')](_0x52e44c)[_0x1867('0x12')](_0x1867('0x36'),null,_0x1867('0x41')+_0x52e44c+'.CmListId')['join'](_0x2d859e,null,_0x2d859e+'.id\x20=\x20'+_0x52e44c+'.'+_0x307b85)[_0x1867('0x14')](_0x52e44c+_0x1867('0x37'),_0x2835a7)[_0x1867('0x14')](_0x1867('0x38'),NOW)[_0x1867('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x1867('0xf')](_0x1867('0x10'))[_0x1867('0x11')]('cm_hopper_black')[_0x1867('0x14')](_0x1867('0x42'),_0x2835a7)[_0x1867('0x14')](_0x307b85+_0x1867('0x15')+_0x52e44c+'.'+_0x307b85)))[_0x1867('0x3d')]();}function insertTzCmHopper(_0x1c7844,_0x4996ec,_0x1d6c87,_0x3054ef,_0x27909f,_0x10cbd4){var _0xa74e65=[_0x1867('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x10cbd4+'.offset-cm_contacts.utcOffset\x20minute)',_0x1867('0x3e'),'cm_contacts.ListId',_0x4996ec+'.'+_0x3054ef,'cm_contacts.createdAt',_0x1867('0x28'),_0x1867('0x29'),_0x1867('0x2a'),'\x22'+_0x27909f+'\x22'];var _0x1e1370=squel[_0x1867('0x2b')]()[_0x1867('0x2c')](_0x1867('0x39'))[_0x1867('0x2d')]([_0x1867('0x10'),'scheduledat','ContactId',_0x1867('0x2f'),_0x3054ef,_0x1867('0x30'),_0x1867('0x31'),_0x1867('0x43'),_0x1867('0x32'),_0x1867('0x33')],squel[_0x1867('0x34')]()['fields'](_0xa74e65)[_0x1867('0x11')](_0x4996ec)[_0x1867('0x12')](_0x1867('0x36'),null,_0x1867('0x41')+_0x4996ec+_0x1867('0x44'))[_0x1867('0x12')](_0x1d6c87,null,_0x1d6c87+_0x1867('0x13')+_0x4996ec+'.'+_0x3054ef)[_0x1867('0x12')](_0x10cbd4,null,_0x10cbd4+_0x1867('0x13')+_0x4996ec+'.'+_0x3054ef)['where'](_0x4996ec+_0x1867('0x37'),_0x1c7844)[_0x1867('0x14')](_0x1867('0x38'),NOW)[_0x1867('0x14')](_0x1867('0x3c'),selectNotIn(_0x4996ec,_0x1d6c87,_0x3054ef,_0x1867('0x39'),['\x22always\x22',_0x1867('0x3b')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4996ec,_0x1d6c87,_0x3054ef,_0x1867('0x39'),[_0x1867('0x3a')])))[_0x1867('0x3d')]();return _0x1e1370;}function insertTzCmHopperBlack(_0x5ba74f,_0x296450,_0x2da944,_0x3ed45f){var _0x545260=[_0x1867('0x25'),_0x1867('0x3e'),_0x1867('0x26'),_0x296450+'.'+_0x3ed45f,_0x1867('0x27'),_0x1867('0x28')];return squel['insert']()[_0x1867('0x2c')](_0x1867('0x3f'))[_0x1867('0x2d')]([_0x1867('0x10'),_0x1867('0x40'),_0x1867('0x2f'),_0x3ed45f,_0x1867('0x30'),_0x1867('0x31')],squel[_0x1867('0x34')]()[_0x1867('0x35')](_0x545260)['from'](_0x296450)[_0x1867('0x12')]('cm_contacts',null,_0x1867('0x41')+_0x296450+_0x1867('0x44'))[_0x1867('0x12')](_0x2da944,null,_0x2da944+'.id\x20=\x20'+_0x296450+'.'+_0x3ed45f)[_0x1867('0x14')](_0x296450+_0x1867('0x37'),_0x5ba74f)[_0x1867('0x14')](_0x1867('0x38'),NOW)[_0x1867('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x1867('0x34')]()[_0x1867('0xf')](_0x1867('0x10'))[_0x1867('0x11')](_0x1867('0x3f'))['where']('ListId\x20=\x20?',_0x5ba74f)[_0x1867('0x14')](_0x3ed45f+_0x1867('0x15')+_0x296450+'.'+_0x3ed45f)))[_0x1867('0x3d')]();}function insertCmHopperAdditionalPhones(_0x155602){var _0x3a00ea=[_0x1867('0x45'),_0x1867('0x46'),_0x1867('0x47'),_0x1867('0x48'),_0x1867('0x49')];return squel['insert']()['into'](_0x1867('0x4a'))[_0x1867('0x2d')](['CmHopperId',_0x1867('0x10'),_0x1867('0x4b'),'createdAt',_0x1867('0x31')],squel[_0x1867('0x34')]()[_0x1867('0x35')](_0x3a00ea)[_0x1867('0x11')](_0x1867('0x39'))['join'](_0x1867('0x36'),null,_0x1867('0x4c'))[_0x1867('0x12')](_0x1867('0x4d'),null,_0x1867('0x4e'))[_0x1867('0x14')](_0x1867('0x4f'),_0x155602)[_0x1867('0x14')](_0x1867('0x38'),NOW))[_0x1867('0x3d')]();}function insertCmContact(_0x12e8d9,_0x475da8,_0x124406,_0x3dcabd){var _0x1f7f45=_[_0x1867('0x50')](_[_0x1867('0x51')](_0x3dcabd),[_0x1867('0x2f'),'CompanyId',_0x1867('0x30'),_0x1867('0x31')]);return squel['insert']()[_0x1867('0x2c')](_0x1867('0x36'))[_0x1867('0x2d')](_0x1f7f45,squel['select']()[_0x1867('0x35')](_0x1f7f45)[_0x1867('0x11')](_0x475da8)[_0x1867('0x14')]('('+_0x124406[_0x1867('0x12')](',')+_0x1867('0x52'),squel[_0x1867('0x34')]()[_0x1867('0x35')](_0x124406)[_0x1867('0x11')](_0x1867('0x36'))[_0x1867('0x14')]('ListId\x20=\x20?',_0x12e8d9)[_0x1867('0x14')]('deletedAt\x20IS\x20NULL'))[_0x1867('0x14')]('id\x20IN\x20?',squel[_0x1867('0x34')]()[_0x1867('0xf')](_0x1867('0x53'),'min_id')[_0x1867('0x11')](_0x475da8)[_0x1867('0x54')](_0x124406[_0x1867('0x12')](','))))[_0x1867('0x3d')]();}function handleStop(){logger[_0x1867('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3bd16e){logger[_0x1867('0x56')](_0x3bd16e['message']);process['exit'](0x1);}function handleError(_0x6e2bac,_0x229c96){stats[_0x1867('0x57')]['push']({'name':_0x229c96['code'],'message':_0x229c96[_0x1867('0x58')],'row':_0x6e2bac});}function handleQuery(_0x2807f1){logger['info'](_0x2807f1);return db[_0x1867('0x59')][_0x1867('0x5a')](_0x2807f1)[_0x1867('0x5b')](function(_0x45cb91){results[_0x1867('0x18')](_0x45cb91);})[_0x1867('0x5c')](function(_0x3938c3){logger[_0x1867('0x56')](_0x3938c3[_0x1867('0x58')]);});}function updateTzCampaigns(_0x457477){return new Promise(function(_0x534d78,_0x2e44a8){var _0x3c181a=squel[_0x1867('0x34')]()[_0x1867('0x35')]([_0x1867('0x5d'),_0x1867('0x5e')])[_0x1867('0x11')](_0x1867('0x5f'))['join']('campaigns_has_cm_lists',null,_0x1867('0x60'))[_0x1867('0x14')](_0x1867('0x61')+_0x457477);db[_0x1867('0x59')]['query'](_0x3c181a['toString']())[_0x1867('0x5b')](function(_0x27e965){var _0x5ab9a2=[];for(var _0x259744=0x0;_0x259744<_0x27e965[_0x1867('0x1b')];_0x259744++){_0x5ab9a2[_0x1867('0x18')](getTimezoneData(_0x27e965[_0x259744],tmp_campaigns));}BPromise[_0x1867('0x19')](_0x5ab9a2)[_0x1867('0x17')](function(){_0x534d78({'val':0x1});});})['catch'](function(_0x43f8a4){logger[_0x1867('0x56')](_0x43f8a4[_0x1867('0x58')]);_0x534d78({'val':0x0});});});}function updateTzVoiceQueues(_0x2b1a2d){return new Promise(function(_0x193724,_0x5dfe3e){var _0x3fff27=squel[_0x1867('0x34')]()[_0x1867('0x35')]([_0x1867('0x62'),_0x1867('0x63')])[_0x1867('0x11')](_0x1867('0x64'))[_0x1867('0x12')](_0x1867('0x65'),null,_0x1867('0x66'))['where']('voice_queues_has_cm_lists.CmListId='+_0x2b1a2d);db[_0x1867('0x59')][_0x1867('0x5a')](_0x3fff27[_0x1867('0x3d')]())[_0x1867('0x5b')](function(_0x53e912){var _0xf2ba3a=[];for(var _0x3c6877=0x0;_0x3c6877<_0x53e912['length'];_0x3c6877++){_0xf2ba3a[_0x1867('0x18')](getTimezoneData(_0x53e912[_0x3c6877],tmp_voice_queues));}BPromise[_0x1867('0x19')](_0xf2ba3a)[_0x1867('0x17')](function(){_0x193724({'val':0x1});});})[_0x1867('0x5c')](function(_0x48ec8e){logger[_0x1867('0x56')](_0x48ec8e[_0x1867('0x58')]);_0x193724({'val':0x0});});});}function getTimezoneData(_0x555d2b,_0x4c63af){return new Promise(function(_0xc7a99f,_0x1a60f1){var _0x1388a0=shared[_0x1867('0x67')];var _0x25a2dd=_0x1388a0[_0x555d2b[_0x1867('0x68')]];if(_['isNil'](_0x25a2dd)){_0xc7a99f({'ret':0x1});}else{var _0x57092a=_0x25a2dd['utcOffset'];var _0x4ff760=squel['insert']()['into'](_0x4c63af)[_0x1867('0x69')]('id',_0x555d2b['id'])[_0x1867('0x69')](_0x1867('0x6a'),_0x57092a)['set'](_0x1867('0x68'),_0x555d2b[_0x1867('0x68')])[_0x1867('0x3d')]();return db[_0x1867('0x59')]['query'](_0x4ff760)[_0x1867('0x5b')](function(_0x32397d){_0xc7a99f({'ret':0x1});})[_0x1867('0x5c')](function(_0x23b3c7){logger['error'](_0x23b3c7[_0x1867('0x58')]);_0x1a60f1({'ret':0x1});});}});}function handleTZQuery(_0x2860e9){logger[_0x1867('0x55')](_0x2860e9);return db['sequelize'][_0x1867('0x5a')](_0x2860e9)[_0x1867('0x5b')](function(_0x4e98d3){})[_0x1867('0x5c')](function(_0x43bfce){logger[_0x1867('0x56')](_0x43bfce[_0x1867('0x58')]);});}function main(_0x1f2a12,_0x16da5f,_0x3bf50f,_0x23d9ff){logger[_0x1867('0x55')](_0x1867('0x6b'),_0x1f2a12,JSON[_0x1867('0x6c')](_0x16da5f));process[_0x1867('0x6d')]('start');var _0x1c2634=_0x16da5f[_0x1867('0x6e')];var _0x11761c=_['clone'](_0x1c2634);var _0x2d01f7=_0x16da5f['socket_timestamp'];var _0x154b20=path[_0x1867('0x12')](config[_0x1867('0x6f')],_0x1867('0x70'),_0x2d01f7+_0x1867('0x71'));hasTZ=_[_0x1867('0x51')](_0x1c2634)[_0x1867('0x72')](_0x1867('0x68'));var _0x49d09a=_['keys'](_0x1c2634)[_0x1867('0x12')]();logger[_0x1867('0x55')](_0x1867('0x73'),_0x49d09a);db[_0x1867('0x74')][_0x1867('0x16')]({'raw':!![],'attributes':['id',_0x1867('0x75')]})[_0x1867('0x17')](function(_0x6a750){for(var _0x29684e=0x0;_0x29684e<_0x6a750[_0x1867('0x1b')];_0x29684e++){if(_0x6a750[_0x29684e][_0x1867('0x75')]in _0x1c2634){contactItemTypes['push'](_0x6a750[_0x29684e]);delete _0x11761c[_0x6a750[_0x29684e][_0x1867('0x75')]];hasAdditionalPhones=!![];}for(var _0x4a0b65 in _0x1c2634){if(_0x6a750[_0x29684e][_0x1867('0x75')]+_0x1867('0x76')===_0x4a0b65){phoneDescriptions[_0x1867('0x18')]({'itemTypeId':_0x6a750[_0x29684e]['id'],'description':_0x4a0b65});delete _0x11761c[_0x4a0b65];}}}if(hasAdditionalPhones)_0x11761c[_0x1867('0x1a')]='';var _0x2f9ab3=_['keys'](_0x11761c)[_0x1867('0x12')]();logger[_0x1867('0x55')](_0x1867('0x73'),_0x2f9ab3);fs[_0x1867('0x77')](_0x154b20,_0x2f9ab3+'\x0a');Papa[_0x1867('0x78')](fs[_0x1867('0x79')](_0x1f2a12),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2fde18,_0x575810){try{for(var _0x2d9727=0x0,_0x21e210=[];_0x2d9727<_0x2fde18[_0x1867('0x7a')][_0x1867('0x1b')];_0x2d9727++){stats[_0x1867('0x7b')]+=0x1;if(_0x2fde18[_0x1867('0x57')][_0x2d9727]){handleError(_0x2fde18[_0x1867('0x7a')][_0x2d9727],_0x2fde18[_0x1867('0x57')][_0x2d9727]);}else{var _0x2e2669=[];var _0x15d274=[];var _0x24c377={};for(var _0xca8705 in _0x1c2634){let _0x4fa750=contactItemTypes[_0x1867('0x7c')](_0x12d0bb=>_0x12d0bb[_0x1867('0x75')]===_0xca8705);let _0x366ba6=contactItemTypes[_0x1867('0x7c')](_0x5cc659=>_0x5cc659['name']+_0x1867('0x76')===_0xca8705);if(_[_0x1867('0x1d')](_0x4fa750)&&_['isNil'](_0x366ba6)){if(_0x1c2634['hasOwnProperty'](_0xca8705)){if(_0x2fde18[_0x1867('0x7a')][_0x2d9727][_0x1c2634[_0xca8705]]){var _0x186492=_['trim'](_0x2fde18['data'][_0x2d9727][_0x1c2634[_0xca8705]][_0x1867('0x7d')](/"/g,'\x27'));switch(_0xca8705){case _0x1867('0x2e'):var _0x463273=moment(_0x186492,_0x1867('0xd'),!![]);if(_0x463273[_0x1867('0x7e')]()){_0x21e210['push']('\x22'+_0x186492+'\x22');}else{_0x2e2669[_0x1867('0x18')](_0x1867('0x7f'));}break;case _0x1867('0x43'):var _0x158a1f=parseInt(_0x186492);_0x186492=_[_0x1867('0x80')](_0x158a1f)||_0x158a1f<0x0||_0x158a1f>0x4?_0x23d9ff?0x3:0x2:_0x158a1f;_0x21e210[_0x1867('0x18')]('\x22'+_0x186492+'\x22');break;case _0x1867('0x32'):var _0x1e7c93=parseInt(_0x186492);if(_[_0x1867('0x81')](_0x1e7c93)&&_['includes'](_0x3bf50f,_0x1e7c93)){_0x21e210[_0x1867('0x18')]('\x22'+_0x1e7c93+'\x22');}else{_0x2e2669['push'](_0x1867('0x82'));}break;case'email':if(isEmail(_0x186492)){_0x21e210[_0x1867('0x18')]('\x22'+_0x186492+'\x22');}else{_0x2e2669[_0x1867('0x18')](_0x1867('0x83'));}break;case _0x1867('0x84'):var _0x5e9439=moment(_0x186492,_0x1867('0x85'),!![]);if(_0x5e9439[_0x1867('0x7e')]()){_0x21e210[_0x1867('0x18')]('\x22'+_0x186492+'\x22');}else{_0x2e2669[_0x1867('0x18')](_0x1867('0x86'));}break;case _0x1867('0x68'):var _0x490567=shared[_0x1867('0x67')];var _0x984d41=_0x490567[_0x186492];if(!_[_0x1867('0x1d')](_0x984d41)){var _0x1fe618=_0x984d41[_0x1867('0x87')];_0x21e210[_0x1867('0x18')]('\x22'+_0x186492+'\x22');_0x21e210[_0x1867('0x18')]('\x22'+_0x1fe618+'\x22');}break;default:_0x21e210[_0x1867('0x18')]('\x22'+_0x186492+'\x22');}}else{switch(_0xca8705){case _0x1867('0x88'):case _0x1867('0x10'):_0x2e2669[_0x1867('0x18')](_0xca8705+_0x1867('0x89'));break;default:_0x21e210[_0x1867('0x18')]('\x22\x22');}}}}else{var _0x15865c='';if(!_[_0x1867('0x1d')](_0x4fa750)){if(!_0x24c377['hasOwnProperty'](_0x4fa750['id'])){if(!_[_0x1867('0x1d')](_0x2fde18['data'][_0x2d9727][_0x1c2634[_0xca8705]])){var _0x186492=_[_0x1867('0x8a')](_0x2fde18[_0x1867('0x7a')][_0x2d9727][_0x1c2634[_0xca8705]][_0x1867('0x7d')](/"/g,'\x27'));var _0x36690c=phoneDescriptions['find'](_0x4ef2a3=>_0x4ef2a3[_0x1867('0x8b')]===_0x4fa750['id']);if(!_[_0x1867('0x1d')](_0x36690c)){var _0x3dbc7e=_['trim'](_0x2fde18[_0x1867('0x7a')][_0x2d9727][_0x1c2634[_0x36690c['description']]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x3dbc7e))_0x186492=_0x186492+'§'+_0x3dbc7e;}if(_0x15865c=='')_0x15865c=_0x186492;else _0x15865c+='|'+_0x186492;}_0x15d274[_0x1867('0x18')](_0x4fa750['id']+':'+_0x15865c);_0x24c377[_0x4fa750['id']]=0x1;}}}}if(hasAdditionalPhones){_0x21e210['push']('\x22'+_0x15d274[_0x1867('0x12')](';')+'\x22');}if(_0x2e2669['length']){handleError(_0x2fde18['data'][_0x2d9727],{'code':_0x1867('0x8c'),'message':_0x2e2669[_0x1867('0x12')]()});}else{fs['appendFileSync'](_0x154b20,_0x21e210[_0x1867('0x12')]()+'\x0a');}_0x21e210=[];}if(!(stats[_0x1867('0x7b')]%0xc8)){socket[_0x1867('0x8d')](_0x1867('0x8e')+_0x2d01f7,stats);stats[_0x1867('0x57')]=[];}}if(stopped){logger[_0x1867('0x55')](_0x1867('0x8f'));_0x575810[_0x1867('0x90')]();}}catch(_0x1c0b59){handleError(_0x2fde18[_0x1867('0x7a')][_0x2d9727],{'code':'SystemError','message':_0x1c0b59[_0x1867('0x58')]});logger[_0x1867('0x56')](_0x1867('0x91'),_0x1c0b59[_0x1867('0x58')]);}},'complete':function(){try{var _0x2352f4=[];var _0x451d36=[];var _0x39a19c=_0x1867('0x36');if(_0x16da5f['duplicates']&&_0x16da5f['duplicates'][_0x1867('0x1b')]){_0x39a19c=_0x1867('0x92')+_0x2d01f7;_0x2352f4['push'](_0x1867('0x93')+_0x39a19c+_0x1867('0x94'));}tmp_campaigns=_0x1867('0x95')+_0x2d01f7;tmp_voice_queues=_0x1867('0x96')+_0x2d01f7;_0x451d36['push'](_0x1867('0x93')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x451d36[_0x1867('0x18')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x1867('0x97')](_0x451d36,handleTZQuery)['then'](function(_0x26cf18){updateTzCampaigns(_0x16da5f[_0x1867('0x2f')])[_0x1867('0x17')](function(_0xea66b9){updateTzVoiceQueues(_0x16da5f['ListId'])['then'](function(_0x5a1199){if(hasTZ)_0x2f9ab3=_0x2f9ab3[_0x1867('0x7d')](_0x1867('0x68'),_0x1867('0x98'));var _0x36077e=util[_0x1867('0xc')](_0x1867('0x99'),_0x154b20,_0x39a19c,_0x2f9ab3,_0x16da5f[_0x1867('0x2f')],_0x16da5f['CompanyId']||null,NOW,NOW);if(_[_0x1867('0x1d')](_0x1c2634['scheduledat'])){_0x36077e+=_0x1867('0x9a');}_0x2352f4[_0x1867('0x18')](_0x36077e);if(_0x16da5f[_0x1867('0x9b')]&&_0x16da5f['duplicates'][_0x1867('0x1b')]){_0x2352f4[_0x1867('0x18')](insertCmContact(_0x16da5f[_0x1867('0x2f')],_0x39a19c,_0x16da5f[_0x1867('0x9b')],_0x1c2634));_0x2352f4['push'](_0x1867('0x9c')+_0x39a19c+';');}BPromise[_0x1867('0x97')](_0x2352f4,handleQuery)[_0x1867('0x17')](function(_0x2219a2){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x2352f4=[];for(var _0x4a7e2b=0x0;_0x4a7e2b\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','test','select','from','join','.id\x20=\x20','where','\x20=\x20','findAll','push','all','then','length','isNil','split','filter','findOne','CmContactHasItem','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','createdAt','updatedAt','UserId','recallme','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','ListId','fields','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ContactId','priority','cm_contacts.ListId\x20=\x20','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_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','toString','info','Received\x20SIGINT','message','exit','errors','sequelize','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','query','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','.csv','includes','ContactItemType','name','AdditionalPhones'];(function(_0x196c7b,_0x34acdb){var _0x2889d2=function(_0x23c424){while(--_0x23c424){_0x196c7b['push'](_0x196c7b['shift']());}};_0x2889d2(++_0x34acdb);}(_0x9f53,0xfb));var _0x39f5=function(_0x12fe87,_0x272c7c){_0x12fe87=_0x12fe87-0x0;var _0x6148c3=_0x9f53[_0x12fe87];return _0x6148c3;};'use strict';var fs=require('fs');var path=require(_0x39f5('0x0'));var _=require(_0x39f5('0x1'));var Papa=require(_0x39f5('0x2'));var util=require('util');var BPromise=require(_0x39f5('0x3'));var moment=require(_0x39f5('0x4'));var squel=require('squel');var Redis=require(_0x39f5('0x5'));var db=require(_0x39f5('0x6'))['db'];var config=require(_0x39f5('0x7'));var shared=require(_0x39f5('0x8'));var logger=require(_0x39f5('0x9'))(_0x39f5('0xa'));config[_0x39f5('0xb')]=_[_0x39f5('0xc')](config[_0x39f5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x39f5('0xd'))(new Redis(config[_0x39f5('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('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()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x21e6f8){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))*$/[_0x39f5('0xe')](_0x21e6f8);}function selectNotIn(_0x56ffc6,_0x2f5487,_0xbaddc7,_0x4d0067,_0x5cce59){return squel[_0x39f5('0xf')]()['field']('phone')[_0x39f5('0x10')](_0x4d0067)[_0x39f5('0x11')](_0x2f5487,null,_0x2f5487+_0x39f5('0x12')+_0x4d0067+'.'+_0xbaddc7)[_0x39f5('0x13')](_0x4d0067+'.'+_0xbaddc7+_0x39f5('0x14')+_0x56ffc6+'.'+_0xbaddc7)[_0x39f5('0x13')](_0x2f5487+'.dialCheckDuplicateType\x20IN\x20('+_0x5cce59['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x35e8a4,_0x59a777){promisesAdditionalPhones=[];return db['CmContact'][_0x39f5('0x15')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x55d708){if(_0x55d708!==null){var _0x3d90b7=[];for(var _0x568ef0=0x0;_0x568ef0<_0x55d708['length'];_0x568ef0++){var _0x25986e=_0x55d708[_0x568ef0];_0x3d90b7[_0x39f5('0x16')](insertAdditionalPhones(_0x25986e));}}Promise[_0x39f5('0x17')](_0x3d90b7)[_0x39f5('0x18')](function(){_0x35e8a4({'val':0x1});});});});}function insertAdditionalPhones(_0x271a5c){return new Promise(function(_0x3fb103,_0x1ad71b){var _0x4f2763=_0x271a5c['AdditionalPhones'];var _0x29c93a=_0x4f2763['split'](';');var _0x2d94fd=[];orderBy=0x0;for(var _0x11619a=0x0;_0x11619a<_0x29c93a[_0x39f5('0x19')];_0x11619a++){_0x2d94fd['push'](splitAdditionalPhone(_0x271a5c['id'],_0x29c93a[_0x11619a]));}Promise[_0x39f5('0x17')](_0x2d94fd)[_0x39f5('0x18')](function(){_0x3fb103({'val':_0x29c93a[_0x39f5('0x19')]});});});}function splitAdditionalPhone(_0x5c0345,_0x47d0ae){return new Promise(function(_0x387f8c,_0x36849b){var _0x51d83a=_0x47d0ae['split'](':');var _0x35032c=_0x51d83a[0x0];var _0x36a9ca=_0x51d83a[0x1];if(!_[_0x39f5('0x1a')](_0x36a9ca)){var _0x2e20ac=_0x36a9ca[_0x39f5('0x1b')]('|');var _0x1e556c=[];for(var _0x2fd98e=0x0;_0x2fd98e<_0x2e20ac[_0x39f5('0x19')];_0x2fd98e++){if(_0x2e20ac[_0x2fd98e]!==''){var _0x22e6dd=_[_0x39f5('0x1c')](promisesAdditionalPhones,{'contactId':_0x5c0345,'phone':_0x2e20ac[_0x2fd98e]});if(_0x22e6dd[_0x39f5('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5c0345,'contactTypeId':_0x35032c,'phone':_0x2e20ac[_0x2fd98e],'orderBy':orderBy});}}}_0x387f8c({'ok':0x1});}else _0x387f8c({'res':0x0});});}function createAdditionalPhone(_0x290697,_0x52acfa,_0x5e3a2f,_0x46b90a){var _0x2d0aa8='';var _0x48b128='';var _0x59c393=_0x5e3a2f[_0x39f5('0x1b')]('§');_0x2d0aa8=_0x59c393[0x0];if(_0x59c393['length']==0x2)_0x48b128=_0x59c393[0x1];return new Promise(function(_0x39f678,_0x8f35f5){return db['CmContactHasItem'][_0x39f5('0x1d')]({'where':{'CmContactId':_0x290697,'item':_0x2d0aa8}})[_0x39f5('0x18')](function(_0x5438fa){if(_0x5438fa){return db[_0x39f5('0x1e')]['update']({'ItemTypeId':_0x52acfa,'description':_0x48b128,'OrderBy':_0x46b90a},{'where':{'CmContactId':_0x290697,'item':_0x2d0aa8}})[_0x39f5('0x18')](function(_0x3b118b){_0x39f678({'res':'updated'});});}else{return db[_0x39f5('0x1e')][_0x39f5('0x1f')]({'CmContactId':_0x290697,'item':_0x2d0aa8,'description':_0x48b128,'ItemTypeId':_0x52acfa,'OrderBy':_0x46b90a,'ItemClass':'PHONE'})['then'](function(_0x23ed24){_0x39f678({'res':_0x39f5('0x20')});});}});});}function insertCmHopper(_0x4eec15,_0x2134a9,_0x348d55,_0x194125,_0x2fc2f8){var _0x241da5=[_0x39f5('0x21'),_0x39f5('0x22'),'cm_contacts.id',_0x39f5('0x23'),_0x2134a9+'.'+_0x194125,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x39f5('0x24'),_0x39f5('0x25'),'\x22'+_0x2fc2f8+'\x22'];return squel[_0x39f5('0x26')]()[_0x39f5('0x27')](_0x39f5('0x28'))[_0x39f5('0x29')]([_0x39f5('0x2a'),_0x39f5('0x2b'),'ContactId','ListId',_0x194125,_0x39f5('0x2c'),_0x39f5('0x2d'),'priority',_0x39f5('0x2e'),_0x39f5('0x2f')],squel['select']()['fields'](_0x241da5)[_0x39f5('0x10')](_0x2134a9)[_0x39f5('0x11')](_0x39f5('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x2134a9+_0x39f5('0x31'))['join'](_0x348d55,null,_0x348d55+_0x39f5('0x12')+_0x2134a9+'.'+_0x194125)[_0x39f5('0x13')](_0x2134a9+_0x39f5('0x32'),_0x4eec15)[_0x39f5('0x13')](_0x39f5('0x33'),NOW)[_0x39f5('0x13')](_0x39f5('0x34'),selectNotIn(_0x2134a9,_0x348d55,_0x194125,_0x39f5('0x28'),[_0x39f5('0x35'),_0x39f5('0x36')]))[_0x39f5('0x13')](_0x39f5('0x34'),selectNotIn(_0x2134a9,_0x348d55,_0x194125,'cm_hopper',[_0x39f5('0x35')])))['toString']();}function insertCmHopperBlack(_0x4e2e09,_0x18f7bf,_0x4f8cd3,_0x35516e){var _0x989b3f=['cm_contacts.phone',_0x39f5('0x37'),'cm_contacts.ListId',_0x18f7bf+'.'+_0x35516e,_0x39f5('0x38'),_0x39f5('0x39')];return squel[_0x39f5('0x26')]()[_0x39f5('0x27')](_0x39f5('0x3a'))['fromQuery'](['phone','ContactId',_0x39f5('0x3b'),_0x35516e,_0x39f5('0x2c'),'updatedAt'],squel[_0x39f5('0xf')]()[_0x39f5('0x3c')](_0x989b3f)['from'](_0x18f7bf)[_0x39f5('0x11')](_0x39f5('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x18f7bf+_0x39f5('0x31'))[_0x39f5('0x11')](_0x4f8cd3,null,_0x4f8cd3+'.id\x20=\x20'+_0x18f7bf+'.'+_0x35516e)[_0x39f5('0x13')](_0x18f7bf+_0x39f5('0x32'),_0x4e2e09)['where'](_0x39f5('0x33'),NOW)['where'](_0x39f5('0x34'),squel['select']()[_0x39f5('0x3d')](_0x39f5('0x2a'))['from'](_0x39f5('0x3a'))[_0x39f5('0x13')](_0x39f5('0x3e'),_0x4e2e09)['where'](_0x35516e+_0x39f5('0x14')+_0x18f7bf+'.'+_0x35516e)))['toString']();}function insertTzCmHopper(_0x3aa993,_0x146438,_0x54d98f,_0x16ceda,_0x3b09a3,_0x3f2dea){var _0x229858=[_0x39f5('0x21'),_0x39f5('0x3f')+_0x3f2dea+_0x39f5('0x40'),_0x39f5('0x37'),_0x39f5('0x23'),_0x146438+'.'+_0x16ceda,_0x39f5('0x38'),_0x39f5('0x39'),_0x39f5('0x24'),'cm_contacts.UserId','\x22'+_0x3b09a3+'\x22'];var _0x27d8be=squel['insert']()[_0x39f5('0x27')](_0x39f5('0x28'))[_0x39f5('0x29')]([_0x39f5('0x2a'),_0x39f5('0x2b'),_0x39f5('0x41'),_0x39f5('0x3b'),_0x16ceda,_0x39f5('0x2c'),_0x39f5('0x2d'),_0x39f5('0x42'),_0x39f5('0x2e'),_0x39f5('0x2f')],squel['select']()[_0x39f5('0x3c')](_0x229858)[_0x39f5('0x10')](_0x146438)[_0x39f5('0x11')](_0x39f5('0x30'),null,_0x39f5('0x43')+_0x146438+_0x39f5('0x31'))[_0x39f5('0x11')](_0x54d98f,null,_0x54d98f+_0x39f5('0x12')+_0x146438+'.'+_0x16ceda)[_0x39f5('0x11')](_0x3f2dea,null,_0x3f2dea+_0x39f5('0x12')+_0x146438+'.'+_0x16ceda)[_0x39f5('0x13')](_0x146438+_0x39f5('0x32'),_0x3aa993)[_0x39f5('0x13')](_0x39f5('0x33'),NOW)[_0x39f5('0x13')](_0x39f5('0x34'),selectNotIn(_0x146438,_0x54d98f,_0x16ceda,_0x39f5('0x28'),[_0x39f5('0x35'),_0x39f5('0x36')]))[_0x39f5('0x13')](_0x39f5('0x34'),selectNotIn(_0x146438,_0x54d98f,_0x16ceda,'cm_hopper',[_0x39f5('0x35')])))['toString']();return _0x27d8be;}function insertTzCmHopperBlack(_0x2f1e92,_0x4c87f4,_0x1bc3cc,_0xb9020c){var _0x557554=['cm_contacts.phone',_0x39f5('0x37'),_0x39f5('0x23'),_0x4c87f4+'.'+_0xb9020c,_0x39f5('0x38'),'cm_contacts.updatedAt'];return squel[_0x39f5('0x26')]()[_0x39f5('0x27')](_0x39f5('0x3a'))[_0x39f5('0x29')](['phone',_0x39f5('0x41'),'ListId',_0xb9020c,'createdAt','updatedAt'],squel[_0x39f5('0xf')]()['fields'](_0x557554)['from'](_0x4c87f4)[_0x39f5('0x11')](_0x39f5('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x4c87f4+'.CmListId')['join'](_0x1bc3cc,null,_0x1bc3cc+_0x39f5('0x12')+_0x4c87f4+'.'+_0xb9020c)[_0x39f5('0x13')](_0x4c87f4+_0x39f5('0x32'),_0x2f1e92)[_0x39f5('0x13')](_0x39f5('0x33'),NOW)['where'](_0x39f5('0x34'),squel['select']()['field'](_0x39f5('0x2a'))[_0x39f5('0x10')](_0x39f5('0x3a'))['where'](_0x39f5('0x3e'),_0x2f1e92)[_0x39f5('0x13')](_0xb9020c+_0x39f5('0x14')+_0x4c87f4+'.'+_0xb9020c)))['toString']();}function insertCmHopperAdditionalPhones(_0x4492a0){var _0x369188=[_0x39f5('0x44'),_0x39f5('0x45'),_0x39f5('0x46'),_0x39f5('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x39f5('0x26')]()['into'](_0x39f5('0x48'))[_0x39f5('0x29')]([_0x39f5('0x49'),_0x39f5('0x2a'),'OrderBy',_0x39f5('0x2c'),'updatedAt'],squel[_0x39f5('0xf')]()[_0x39f5('0x3c')](_0x369188)[_0x39f5('0x10')]('cm_hopper')[_0x39f5('0x11')]('cm_contacts',null,_0x39f5('0x4a'))[_0x39f5('0x11')](_0x39f5('0x4b'),null,_0x39f5('0x4c'))[_0x39f5('0x13')](_0x39f5('0x4d'),_0x4492a0)['where'](_0x39f5('0x33'),NOW))['toString']();}function insertCmContact(_0x42aa69,_0x2022ae,_0x24f918,_0x903cd7){var _0x221f3e=_[_0x39f5('0x4e')](_[_0x39f5('0x4f')](_0x903cd7),['ListId',_0x39f5('0x50'),_0x39f5('0x2c'),_0x39f5('0x2d')]);return squel[_0x39f5('0x26')]()['into'](_0x39f5('0x30'))[_0x39f5('0x29')](_0x221f3e,squel[_0x39f5('0xf')]()[_0x39f5('0x3c')](_0x221f3e)['from'](_0x2022ae)[_0x39f5('0x13')]('('+_0x24f918[_0x39f5('0x11')](',')+_0x39f5('0x51'),squel[_0x39f5('0xf')]()['fields'](_0x24f918)['from'](_0x39f5('0x30'))['where'](_0x39f5('0x3e'),_0x42aa69)['where']('deletedAt\x20IS\x20NULL'))['where'](_0x39f5('0x52'),squel['select']()[_0x39f5('0x3d')](_0x39f5('0x53'),_0x39f5('0x54'))[_0x39f5('0x10')](_0x2022ae)[_0x39f5('0x55')](_0x24f918[_0x39f5('0x11')](','))))[_0x39f5('0x56')]();}function handleStop(){logger[_0x39f5('0x57')](_0x39f5('0x58'));stopped=!![];}function handleUncaughtException(_0x289be1){logger['error'](_0x289be1[_0x39f5('0x59')]);process[_0x39f5('0x5a')](0x1);}function handleError(_0x449851,_0x39fb1b){stats[_0x39f5('0x5b')]['push']({'name':_0x39fb1b['code'],'message':_0x39fb1b[_0x39f5('0x59')],'row':_0x449851});}function handleQuery(_0x15666c){logger[_0x39f5('0x57')](_0x15666c);return db[_0x39f5('0x5c')]['query'](_0x15666c)[_0x39f5('0x5d')](function(_0x2f7b64){results['push'](_0x2f7b64);})[_0x39f5('0x5e')](function(_0x3c90e5){logger[_0x39f5('0x5f')](_0x3c90e5[_0x39f5('0x59')]);});}function updateTzCampaigns(_0x31f5d7){return new Promise(function(_0x409a60,_0xdf1729){var _0x19520f=squel[_0x39f5('0xf')]()[_0x39f5('0x3c')]([_0x39f5('0x60'),_0x39f5('0x61')])['from'](_0x39f5('0x62'))[_0x39f5('0x11')](_0x39f5('0x63'),null,_0x39f5('0x64'))[_0x39f5('0x13')](_0x39f5('0x65')+_0x31f5d7);db[_0x39f5('0x5c')]['query'](_0x19520f[_0x39f5('0x56')]())[_0x39f5('0x5d')](function(_0x1dea65){var _0x4a0d73=[];for(var _0x4ca176=0x0;_0x4ca176<_0x1dea65['length'];_0x4ca176++){_0x4a0d73[_0x39f5('0x16')](getTimezoneData(_0x1dea65[_0x4ca176],tmp_campaigns));}BPromise[_0x39f5('0x17')](_0x4a0d73)[_0x39f5('0x18')](function(){_0x409a60({'val':0x1});});})['catch'](function(_0x58ff68){logger['error'](_0x58ff68['message']);_0x409a60({'val':0x0});});});}function updateTzVoiceQueues(_0x4a193f){return new Promise(function(_0x9ff715,_0x25d2da){var _0x944cdd=squel[_0x39f5('0xf')]()[_0x39f5('0x3c')](['voice_queues.id',_0x39f5('0x66')])[_0x39f5('0x10')](_0x39f5('0x67'))['join'](_0x39f5('0x68'),null,_0x39f5('0x69'))['where'](_0x39f5('0x6a')+_0x4a193f);db[_0x39f5('0x5c')][_0x39f5('0x6b')](_0x944cdd['toString']())['spread'](function(_0x12b8ba){var _0x459d12=[];for(var _0x1abaec=0x0;_0x1abaec<_0x12b8ba[_0x39f5('0x19')];_0x1abaec++){_0x459d12[_0x39f5('0x16')](getTimezoneData(_0x12b8ba[_0x1abaec],tmp_voice_queues));}BPromise[_0x39f5('0x17')](_0x459d12)['then'](function(){_0x9ff715({'val':0x1});});})[_0x39f5('0x5e')](function(_0x30738c){logger[_0x39f5('0x5f')](_0x30738c[_0x39f5('0x59')]);_0x9ff715({'val':0x0});});});}function getTimezoneData(_0x8ab432,_0x5b466d){return new Promise(function(_0x4ec570,_0xc4456c){var _0x1998ee=shared['timezones'];var _0x169da6=_0x1998ee[_0x8ab432[_0x39f5('0x6c')]];if(_['isNil'](_0x169da6)){_0x4ec570({'ret':0x1});}else{var _0x584b0f=_0x169da6[_0x39f5('0x6d')];var _0x44858a=squel[_0x39f5('0x26')]()[_0x39f5('0x27')](_0x5b466d)[_0x39f5('0x6e')]('id',_0x8ab432['id'])[_0x39f5('0x6e')](_0x39f5('0x6f'),_0x584b0f)['set'](_0x39f5('0x6c'),_0x8ab432[_0x39f5('0x6c')])[_0x39f5('0x56')]();return db[_0x39f5('0x5c')][_0x39f5('0x6b')](_0x44858a)[_0x39f5('0x5d')](function(_0x284d3c){_0x4ec570({'ret':0x1});})[_0x39f5('0x5e')](function(_0x1315af){logger['error'](_0x1315af[_0x39f5('0x59')]);_0xc4456c({'ret':0x1});});}});}function handleTZQuery(_0x436f07){logger[_0x39f5('0x57')](_0x436f07);return db['sequelize'][_0x39f5('0x6b')](_0x436f07)[_0x39f5('0x5d')](function(_0x3051a9){})[_0x39f5('0x5e')](function(_0x270dc8){logger['error'](_0x270dc8['message']);});}function main(_0x19868b,_0x2ec442,_0x1ba6b9,_0x80de28){logger[_0x39f5('0x57')](_0x39f5('0x70'),_0x19868b,JSON[_0x39f5('0x71')](_0x2ec442));process[_0x39f5('0x72')](_0x39f5('0x73'));var _0x1e63ba=_0x2ec442[_0x39f5('0x74')];var _0x376bc5=_[_0x39f5('0x75')](_0x1e63ba);var _0xf61a71=_0x2ec442['socket_timestamp'];var _0x146276=path[_0x39f5('0x11')](config['root'],'server/files/tmp',_0xf61a71+_0x39f5('0x76'));hasTZ=_[_0x39f5('0x4f')](_0x1e63ba)[_0x39f5('0x77')](_0x39f5('0x6c'));var _0x3d53de=_[_0x39f5('0x4f')](_0x1e63ba)[_0x39f5('0x11')]();logger[_0x39f5('0x57')]('header',_0x3d53de);db[_0x39f5('0x78')]['findAll']({'raw':!![],'attributes':['id',_0x39f5('0x79')]})['then'](function(_0x165ece){for(var _0x437aa5=0x0;_0x437aa5<_0x165ece[_0x39f5('0x19')];_0x437aa5++){if(_0x165ece[_0x437aa5][_0x39f5('0x79')]in _0x1e63ba){contactItemTypes[_0x39f5('0x16')](_0x165ece[_0x437aa5]);delete _0x376bc5[_0x165ece[_0x437aa5][_0x39f5('0x79')]];hasAdditionalPhones=!![];}for(var _0x4b8892 in _0x1e63ba){if(_0x165ece[_0x437aa5][_0x39f5('0x79')]+'_description'===_0x4b8892){phoneDescriptions[_0x39f5('0x16')]({'itemTypeId':_0x165ece[_0x437aa5]['id'],'description':_0x4b8892});delete _0x376bc5[_0x4b8892];}}}if(hasAdditionalPhones)_0x376bc5[_0x39f5('0x7a')]='';var _0x5b65ee=_[_0x39f5('0x4f')](_0x376bc5)['join']();logger[_0x39f5('0x57')](_0x39f5('0x7b'),_0x5b65ee);fs[_0x39f5('0x7c')](_0x146276,_0x5b65ee+'\x0a');Papa['parse'](fs[_0x39f5('0x7d')](_0x19868b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bdfdd,_0x5c2c99){try{for(var _0xa8a9c0=0x0,_0x20b80f=[];_0xa8a9c0<_0x1bdfdd[_0x39f5('0x7e')][_0x39f5('0x19')];_0xa8a9c0++){stats[_0x39f5('0x7f')]+=0x1;if(_0x1bdfdd[_0x39f5('0x5b')][_0xa8a9c0]){handleError(_0x1bdfdd[_0x39f5('0x7e')][_0xa8a9c0],_0x1bdfdd[_0x39f5('0x5b')][_0xa8a9c0]);}else{var _0x1c60fb=[];var _0x4a5b4d=[];var _0x1ef792={};for(var _0x2f8911 in _0x1e63ba){let _0x1ee58d=contactItemTypes[_0x39f5('0x80')](_0xfe8cfa=>_0xfe8cfa[_0x39f5('0x79')]===_0x2f8911);let _0x428837=contactItemTypes[_0x39f5('0x80')](_0x14d468=>_0x14d468['name']+_0x39f5('0x81')===_0x2f8911);if(_[_0x39f5('0x1a')](_0x1ee58d)&&_[_0x39f5('0x1a')](_0x428837)){if(_0x1e63ba[_0x39f5('0x82')](_0x2f8911)){if(_0x1bdfdd[_0x39f5('0x7e')][_0xa8a9c0][_0x1e63ba[_0x2f8911]]){var _0x8fc9e9=_[_0x39f5('0x83')](_0x1bdfdd[_0x39f5('0x7e')][_0xa8a9c0][_0x1e63ba[_0x2f8911]][_0x39f5('0x84')](/"/g,'\x27'));switch(_0x2f8911){case _0x39f5('0x2b'):var _0x1bddeb=moment(_0x8fc9e9,_0x39f5('0x85'),!![]);if(_0x1bddeb['isValid']()){_0x20b80f[_0x39f5('0x16')]('\x22'+_0x8fc9e9+'\x22');}else{_0x1c60fb['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x22a391=parseInt(_0x8fc9e9);_0x8fc9e9=_[_0x39f5('0x86')](_0x22a391)||_0x22a391<0x0||_0x22a391>0x4?_0x80de28?0x3:0x2:_0x22a391;_0x20b80f[_0x39f5('0x16')]('\x22'+_0x8fc9e9+'\x22');break;case _0x39f5('0x2e'):var _0x512fab=parseInt(_0x8fc9e9);if(_[_0x39f5('0x87')](_0x512fab)&&_[_0x39f5('0x77')](_0x1ba6b9,_0x512fab)){_0x20b80f['push']('\x22'+_0x512fab+'\x22');}else{_0x1c60fb[_0x39f5('0x16')](_0x39f5('0x88'));}break;case'email':if(isEmail(_0x8fc9e9)){_0x20b80f[_0x39f5('0x16')]('\x22'+_0x8fc9e9+'\x22');}else{_0x1c60fb[_0x39f5('0x16')](_0x39f5('0x89'));}break;case _0x39f5('0x8a'):var _0xbb381a=moment(_0x8fc9e9,_0x39f5('0x8b'),!![]);if(_0xbb381a[_0x39f5('0x8c')]()){_0x20b80f[_0x39f5('0x16')]('\x22'+_0x8fc9e9+'\x22');}else{_0x1c60fb['push'](_0x39f5('0x8d'));}break;case'dialTimezone':var _0x290f6a=shared[_0x39f5('0x8e')];var _0x12d30d=_0x290f6a[_0x8fc9e9];if(!_['isNil'](_0x12d30d)){var _0x2e837a=_0x12d30d['utcOffset'];_0x20b80f['push']('\x22'+_0x8fc9e9+'\x22');_0x20b80f['push']('\x22'+_0x2e837a+'\x22');}break;default:_0x20b80f['push']('\x22'+_0x8fc9e9+'\x22');}}else{switch(_0x2f8911){case _0x39f5('0x8f'):case _0x39f5('0x2a'):_0x1c60fb[_0x39f5('0x16')](_0x2f8911+'\x20not\x20specified');break;default:_0x20b80f[_0x39f5('0x16')]('\x22\x22');}}}}else{var _0x5529a4='';if(!_['isNil'](_0x1ee58d)){if(!_0x1ef792[_0x39f5('0x82')](_0x1ee58d['id'])){if(!_[_0x39f5('0x1a')](_0x1bdfdd[_0x39f5('0x7e')][_0xa8a9c0][_0x1e63ba[_0x2f8911]])){var _0x8fc9e9=_[_0x39f5('0x83')](_0x1bdfdd['data'][_0xa8a9c0][_0x1e63ba[_0x2f8911]][_0x39f5('0x84')](/"/g,'\x27'));var _0x550c48=phoneDescriptions[_0x39f5('0x80')](_0x48df8a=>_0x48df8a['itemTypeId']===_0x1ee58d['id']);if(!_['isNil'](_0x550c48)){var _0x4ee207=_[_0x39f5('0x83')](_0x1bdfdd[_0x39f5('0x7e')][_0xa8a9c0][_0x1e63ba[_0x550c48[_0x39f5('0x90')]]][_0x39f5('0x84')](/"/g,'\x27'));if(!_[_0x39f5('0x1a')](_0x4ee207))_0x8fc9e9=_0x8fc9e9+'§'+_0x4ee207;}if(_0x5529a4=='')_0x5529a4=_0x8fc9e9;else _0x5529a4+='|'+_0x8fc9e9;}_0x4a5b4d[_0x39f5('0x16')](_0x1ee58d['id']+':'+_0x5529a4);_0x1ef792[_0x1ee58d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x20b80f[_0x39f5('0x16')]('\x22'+_0x4a5b4d[_0x39f5('0x11')](';')+'\x22');}if(_0x1c60fb[_0x39f5('0x19')]){handleError(_0x1bdfdd[_0x39f5('0x7e')][_0xa8a9c0],{'code':_0x39f5('0x91'),'message':_0x1c60fb[_0x39f5('0x11')]()});}else{fs[_0x39f5('0x92')](_0x146276,_0x20b80f[_0x39f5('0x11')]()+'\x0a');}_0x20b80f=[];}if(!(stats[_0x39f5('0x7f')]%0xc8)){socket[_0x39f5('0x93')]('contact:import:'+_0xf61a71,stats);stats[_0x39f5('0x5b')]=[];}}if(stopped){logger[_0x39f5('0x57')](_0x39f5('0x94'));_0x5c2c99[_0x39f5('0x95')]();}}catch(_0xab9a85){handleError(_0x1bdfdd[_0x39f5('0x7e')][_0xa8a9c0],{'code':_0x39f5('0x96'),'message':_0xab9a85['message']});logger[_0x39f5('0x5f')](_0x39f5('0x97'),_0xab9a85[_0x39f5('0x59')]);}},'complete':function(){try{var _0x5adce6=[];var _0x1aad65=[];var _0x576224=_0x39f5('0x30');if(_0x2ec442[_0x39f5('0x98')]&&_0x2ec442[_0x39f5('0x98')]['length']){_0x576224=_0x39f5('0x99')+_0xf61a71;_0x5adce6[_0x39f5('0x16')]('CREATE\x20TABLE\x20'+_0x576224+_0x39f5('0x9a'));}tmp_campaigns='campaigns_'+_0xf61a71;tmp_voice_queues=_0x39f5('0x9b')+_0xf61a71;_0x1aad65[_0x39f5('0x16')](_0x39f5('0x9c')+tmp_campaigns+_0x39f5('0x9d'));_0x1aad65[_0x39f5('0x16')](_0x39f5('0x9c')+tmp_voice_queues+_0x39f5('0x9d'));BPromise[_0x39f5('0x9e')](_0x1aad65,handleTZQuery)[_0x39f5('0x18')](function(_0x461af9){updateTzCampaigns(_0x2ec442[_0x39f5('0x3b')])[_0x39f5('0x18')](function(_0x30aaf8){updateTzVoiceQueues(_0x2ec442[_0x39f5('0x3b')])[_0x39f5('0x18')](function(_0x45c634){if(hasTZ)_0x5b65ee=_0x5b65ee[_0x39f5('0x84')]('dialTimezone',_0x39f5('0x9f'));var _0x52eac3=util[_0x39f5('0xa0')](_0x39f5('0xa1'),_0x146276,_0x576224,_0x5b65ee,_0x2ec442[_0x39f5('0x3b')],_0x2ec442[_0x39f5('0x50')]||null,NOW,NOW);if(_[_0x39f5('0x1a')](_0x1e63ba[_0x39f5('0x2b')])){_0x52eac3+=_0x39f5('0xa2');}_0x5adce6[_0x39f5('0x16')](_0x52eac3);if(_0x2ec442[_0x39f5('0x98')]&&_0x2ec442[_0x39f5('0x98')]['length']){_0x5adce6[_0x39f5('0x16')](insertCmContact(_0x2ec442[_0x39f5('0x3b')],_0x576224,_0x2ec442[_0x39f5('0x98')],_0x1e63ba));_0x5adce6['push'](_0x39f5('0xa3')+_0x576224+';');}BPromise[_0x39f5('0x9e')](_0x5adce6,handleQuery)['then'](function(_0x219867){BPromise[_0x39f5('0x17')]([handleAdditionalPhones()])['then'](function(){_0x5adce6=[];for(var _0x5eb489=0x0;_0x5eb489\x20\x20','server/files/tmp','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','select\x20*\x20from\x20','spread','isNil','push','then','message','AdditionalPhones','split','length','all','filter','findOne','CmContactHasItem'];(function(_0xcf611d,_0x451c75){var _0xe1a7d2=function(_0x5b77e1){while(--_0x5b77e1){_0xcf611d['push'](_0xcf611d['shift']());}};_0xe1a7d2(++_0x451c75);}(_0x1485,0x77));var _0x5148=function(_0xee70cb,_0x3606ba){_0xee70cb=_0xee70cb-0x0;var _0x29254a=_0x1485[_0xee70cb];return _0x29254a;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x5148('0x0'));var Papa=require(_0x5148('0x1'));var util=require(_0x5148('0x2'));var BPromise=require('bluebird');var moment=require(_0x5148('0x3'));var squel=require('squel');var Redis=require(_0x5148('0x4'));var db=require(_0x5148('0x5'))['db'];var config=require(_0x5148('0x6'));var logger=require(_0x5148('0x7'))('import');config['redis']=_[_0x5148('0x8')](config[_0x5148('0x9')],{'host':_0x5148('0xa'),'port':0x18eb});var socket=require(_0x5148('0xb'))(new Redis(config[_0x5148('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x5148('0xc'));var tempTableName=_0x5148('0xd')+moment()[_0x5148('0xe')](_0x5148('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x594b56){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))*$/[_0x5148('0x10')](_0x594b56);}function selectNotIn(_0x28007c,_0x43d15f,_0x222c2c,_0x48928a,_0x25616d){return squel[_0x5148('0x11')]()[_0x5148('0x12')](_0x5148('0x13'))[_0x5148('0x14')](_0x48928a)[_0x5148('0x15')](_0x43d15f,null,_0x43d15f+_0x5148('0x16')+_0x48928a+'.'+_0x222c2c)[_0x5148('0x17')](_0x48928a+'.'+_0x222c2c+'\x20=\x20'+_0x28007c+'.'+_0x222c2c)['where'](_0x43d15f+_0x5148('0x18')+_0x25616d[_0x5148('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x330e7d,_0x428ec7){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0x5148('0x19')+tempTableName)[_0x5148('0x1a')](function(_0xb4fd64){if(_0xb4fd64!==null){var _0x1b378=[];for(var _0x3c6d51=0x0;_0x3c6d51<_0xb4fd64['length'];_0x3c6d51++){var _0x19dc96=_0xb4fd64[_0x3c6d51];if(!_[_0x5148('0x1b')](_0x19dc96[_0x5148('0x13')])){if(!_['isNil'](_0x19dc96['AdditionalPhones']))_0x1b378[_0x5148('0x1c')](insertAdditionalPhones(_0x19dc96));promisesContact['push']({'contact':_0x19dc96});}}}Promise['all'](_0x1b378)[_0x5148('0x1d')](function(){_0x330e7d({'val':0x1});});})['catch'](function(_0x11ad19){logger['error'](_0x11ad19[_0x5148('0x1e')]);});});}function insertAdditionalPhones(_0x16aafd){return new Promise(function(_0x5209ca,_0x34c28c){var _0x1ffdc6=_0x16aafd[_0x5148('0x1f')];if(_[_0x5148('0x1b')](_0x1ffdc6))_0x34c28c({'val':0x0});else{var _0x40f4c=_0x1ffdc6[_0x5148('0x20')](';');var _0x337ca4=[];orderBy=0x0;for(var _0x3a7efa=0x0;_0x3a7efa<_0x40f4c[_0x5148('0x21')];_0x3a7efa++){_0x337ca4['push'](splitAdditionalPhone(_0x16aafd['id'],_0x40f4c[_0x3a7efa]));}Promise[_0x5148('0x22')](_0x337ca4)[_0x5148('0x1d')](function(){_0x5209ca({'val':_0x40f4c[_0x5148('0x21')]});});}});}function splitAdditionalPhone(_0x2b12f0,_0xc4300d){return new Promise(function(_0x38f5f5,_0x3b617f){var _0x406952=_0xc4300d[_0x5148('0x20')](':');var _0xd17f31=_0x406952[0x0];var _0x1b52c6=_0x406952[0x1];if(_0x1b52c6!==''){var _0x2c97b8=_0x1b52c6[_0x5148('0x20')]('|');var _0x45ef9f=[];for(var _0xd2eb8e=0x0;_0xd2eb8e<_0x2c97b8[_0x5148('0x21')];_0xd2eb8e++){if(_0x2c97b8[_0xd2eb8e]!==''){var _0x18867c=_[_0x5148('0x23')](promisesAdditionalPhones,{'contactId':_0x2b12f0,'phone':_0x2c97b8[_0xd2eb8e]});if(_0x18867c[_0x5148('0x21')]==0x0){orderBy++;promisesAdditionalPhones[_0x5148('0x1c')]({'contactId':_0x2b12f0,'contactTypeId':_0xd17f31,'phone':_0x2c97b8[_0xd2eb8e],'orderBy':orderBy});}}}_0x38f5f5({'ok':0x1});}else _0x38f5f5({'res':0x0});});}function createAdditionalPhone(_0x12aa16,_0x25ef5e,_0x2007d0,_0x55b4f2){var _0x1e9123='';var _0x2a37aa='';var _0x49daab=_0x2007d0[_0x5148('0x20')]('§');_0x1e9123=_0x49daab[0x0];if(_0x49daab[_0x5148('0x21')]==0x2)_0x2a37aa=_0x49daab[0x1];return new Promise(function(_0x14805a,_0x1b01bd){return db['CmContactHasItem'][_0x5148('0x24')]({'where':{'CmContactId':_0x12aa16,'item':_0x1e9123}})[_0x5148('0x1d')](function(_0x55ad9f){if(_0x55ad9f){return db[_0x5148('0x25')][_0x5148('0x26')]({'ItemTypeId':_0x25ef5e,'description':_0x2a37aa,'OrderBy':_0x55b4f2},{'where':{'CmContactId':_0x12aa16,'item':_0x1e9123}})[_0x5148('0x1d')](function(_0x52013c){_0x14805a({'res':_0x5148('0x27')});});}else{return db[_0x5148('0x25')][_0x5148('0x28')]({'CmContactId':_0x12aa16,'item':_0x1e9123,'ItemTypeId':_0x25ef5e,'description':_0x2a37aa,'OrderBy':_0x55b4f2,'ItemClass':'PHONE'})[_0x5148('0x1d')](function(_0x433d40){_0x14805a({'res':_0x5148('0x29')});});}});});}function updateContact(_0x260a9c){return new Promise(function(_0x42b5f3,_0x390057){var _0x1e74fe=_0x260a9c['id'];delete _0x260a9c['id'];return db[_0x5148('0x2a')][_0x5148('0x26')](_0x260a9c,{'where':{'id':_0x1e74fe}})[_0x5148('0x1d')](function(_0xc56eb0){updatedRows+=0x1;return db[_0x5148('0x2b')][_0x5148('0x26')]({'phone':_0x260a9c[_0x5148('0x13')]},{'where':{'ContactId':_0x1e74fe}})['then'](function(_0x451a8c){_0x42b5f3({'ret':'OK'});});});});}function insertCmHopper(_0x3d79b6,_0x4ebae4,_0x5b4662,_0x8af3e1,_0x220748){var _0x3c6460=['cm_contacts.phone','cm_contacts.scheduledat',_0x5148('0x2c'),'cm_contacts.ListId',_0x4ebae4+'.'+_0x8af3e1,'cm_contacts.createdAt',_0x5148('0x2d'),_0x5148('0x2e'),_0x5148('0x2f'),'\x22'+_0x220748+'\x22'];return squel[_0x5148('0x30')]()[_0x5148('0x31')](_0x5148('0x32'))[_0x5148('0x33')]([_0x5148('0x13'),_0x5148('0x34'),_0x5148('0x35'),_0x5148('0x36'),_0x8af3e1,_0x5148('0x37'),_0x5148('0x38'),_0x5148('0x39'),_0x5148('0x3a'),_0x5148('0x3b')],squel[_0x5148('0x11')]()[_0x5148('0x3c')](_0x3c6460)['from'](_0x4ebae4)[_0x5148('0x15')]('cm_contacts',null,_0x5148('0x3d')+_0x4ebae4+_0x5148('0x3e'))['join'](_0x5b4662,null,_0x5b4662+'.id\x20=\x20'+_0x4ebae4+'.'+_0x8af3e1)[_0x5148('0x17')](_0x4ebae4+_0x5148('0x3f'),_0x3d79b6)[_0x5148('0x17')](_0x5148('0x40'),NOW)['where'](_0x5148('0x41'),selectNotIn(_0x4ebae4,_0x5b4662,_0x8af3e1,'cm_hopper',[_0x5148('0x42'),_0x5148('0x43')]))[_0x5148('0x17')](_0x5148('0x41'),selectNotIn(_0x4ebae4,_0x5b4662,_0x8af3e1,_0x5148('0x32'),['\x22always\x22'])))[_0x5148('0x44')]();}function insertCmHopperBlack(_0x4a0a5c,_0x39567e,_0x24c4e6,_0x3413cb){var _0x538bda=[_0x5148('0x45'),'cm_contacts.id',_0x5148('0x46'),_0x39567e+'.'+_0x3413cb,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()['into']('cm_hopper_black')[_0x5148('0x33')]([_0x5148('0x13'),_0x5148('0x35'),'ListId',_0x3413cb,_0x5148('0x37'),_0x5148('0x38')],squel[_0x5148('0x11')]()[_0x5148('0x3c')](_0x538bda)[_0x5148('0x14')](_0x39567e)[_0x5148('0x15')](_0x5148('0x47'),null,_0x5148('0x3d')+_0x39567e+_0x5148('0x3e'))[_0x5148('0x15')](_0x24c4e6,null,_0x24c4e6+'.id\x20=\x20'+_0x39567e+'.'+_0x3413cb)[_0x5148('0x17')](_0x39567e+_0x5148('0x3f'),_0x4a0a5c)[_0x5148('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x5148('0x41'),squel['select']()[_0x5148('0x12')](_0x5148('0x13'))['from'](_0x5148('0x48'))[_0x5148('0x17')](_0x5148('0x49'),_0x4a0a5c)[_0x5148('0x17')](_0x3413cb+'\x20=\x20?',_0x39567e+'.'+_0x3413cb)))['toString']();}function insertCmHopperAdditionalPhones(_0x52c719){var _0x254a50=[_0x5148('0x4a'),_0x5148('0x4b'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x5148('0x30')]()[_0x5148('0x31')](_0x5148('0x4c'))['fromQuery']([_0x5148('0x4d'),_0x5148('0x13'),_0x5148('0x4e'),_0x5148('0x37'),'updatedAt'],squel[_0x5148('0x11')]()['fields'](_0x254a50)[_0x5148('0x14')](_0x5148('0x32'))[_0x5148('0x15')](_0x5148('0x47'),null,_0x5148('0x4f'))['join'](_0x5148('0x50'),null,_0x5148('0x51'))[_0x5148('0x17')](_0x5148('0x52'),_0x52c719)[_0x5148('0x17')](_0x5148('0x40'),NOW))[_0x5148('0x44')]();}function insertCmContact(_0x32ee83,_0x19d288,_0x39e321,_0x1e703e){var _0x4b9194=_['concat'](_[_0x5148('0x53')](_0x1e703e),[_0x5148('0x36'),_0x5148('0x54'),_0x5148('0x37'),_0x5148('0x38')]);return squel[_0x5148('0x30')]()['into'](_0x5148('0x47'))[_0x5148('0x33')](_0x4b9194,squel[_0x5148('0x11')]()[_0x5148('0x3c')](_0x4b9194)['from'](_0x19d288)[_0x5148('0x17')]('('+_0x39e321[_0x5148('0x15')](',')+_0x5148('0x55'),squel[_0x5148('0x11')]()[_0x5148('0x3c')](_0x39e321)[_0x5148('0x14')](_0x5148('0x47'))['where'](_0x5148('0x49'),_0x32ee83))['where']('id\x20IN\x20?',squel[_0x5148('0x11')]()[_0x5148('0x12')](_0x5148('0x56'),_0x5148('0x57'))[_0x5148('0x14')](_0x19d288)[_0x5148('0x58')](_0x39e321[_0x5148('0x15')](','))))[_0x5148('0x44')]();}function handleStop(){logger[_0x5148('0x59')](_0x5148('0x5a'));stopped=!![];}function handleUncaughtException(_0x2f858c){logger[_0x5148('0x5b')](_0x2f858c[_0x5148('0x1e')]);process[_0x5148('0x5c')](0x1);}function handleError(_0x664ab0,_0x30c232){stats[_0x5148('0x5d')][_0x5148('0x1c')]({'name':_0x30c232[_0x5148('0x5e')],'message':_0x30c232[_0x5148('0x1e')],'row':_0x664ab0});}function handleQuery(_0x1c7d91){logger[_0x5148('0x59')](_0x1c7d91);return db[_0x5148('0x5f')]['query'](_0x1c7d91)[_0x5148('0x1a')](function(_0x2e01e2){results[_0x5148('0x1c')](_0x2e01e2);})[_0x5148('0x60')](function(_0x5de4db){logger['error'](_0x5de4db[_0x5148('0x1e')]);});}function main(_0x373483,_0x21992e,_0x2e3b97,_0x14f6f5){logger[_0x5148('0x59')](_0x5148('0x61'),_0x373483,JSON[_0x5148('0x62')](_0x21992e));process[_0x5148('0x63')](_0x5148('0x64'));var _0x484f5e=_0x21992e[_0x5148('0x65')];var _0x237d5d=_['clone'](_0x484f5e);var _0x10ec6f=_0x21992e[_0x5148('0x66')];var _0xdd8eef=path['join'](config['root'],'server/files/tmp',_0x10ec6f+_0x5148('0x67'));logger[_0x5148('0x59')](_0x5148('0x68'),_0x21992e);db[_0x5148('0x69')][_0x5148('0x6a')]({'raw':!![],'attributes':['id',_0x5148('0x6b')]})['then'](function(_0x200d5d){for(var _0x861cbb=0x0;_0x861cbb<_0x200d5d[_0x5148('0x21')];_0x861cbb++){if(_0x200d5d[_0x861cbb][_0x5148('0x6b')]in _0x484f5e){contactItemTypes['push'](_0x200d5d[_0x861cbb]);delete _0x237d5d[_0x200d5d[_0x861cbb][_0x5148('0x6b')]];hasAdditionalPhones=!![];}for(var _0x45570b in _0x484f5e){if(_0x200d5d[_0x861cbb][_0x5148('0x6b')]+'_description'===_0x45570b){phoneDescriptions[_0x5148('0x1c')]({'itemTypeId':_0x200d5d[_0x861cbb]['id'],'description':_0x45570b});delete _0x237d5d[_0x45570b];}}}if(hasAdditionalPhones)_0x237d5d['AdditionalPhones']='';var _0x2a9b18=_[_0x5148('0x53')](_0x237d5d)[_0x5148('0x15')]();logger[_0x5148('0x59')](_0x5148('0x6c'),_0x2a9b18);fs['writeFileSync'](_0xdd8eef,_0x2a9b18+'\x0a');Papa[_0x5148('0x6d')](fs['createReadStream'](_0x373483),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5edb4f,_0x316336){try{for(var _0x1ca7a1=0x0,_0x459bbd=[];_0x1ca7a1<_0x5edb4f['data']['length'];_0x1ca7a1++){stats['rows']+=0x1;if(_0x5edb4f['errors'][_0x1ca7a1]){handleError(_0x5edb4f[_0x5148('0x6e')][_0x1ca7a1],_0x5edb4f['errors'][_0x1ca7a1]);}else{var _0x599e53=[];var _0xb130e7=[];var _0x578576={};for(var _0xe81f8c in _0x484f5e){let _0x2eab58=contactItemTypes[_0x5148('0x6f')](_0x242056=>_0x242056[_0x5148('0x6b')]===_0xe81f8c);let _0x5d314e=contactItemTypes['find'](_0x526867=>_0x526867[_0x5148('0x6b')]+_0x5148('0x70')===_0xe81f8c);if(_['isNil'](_0x2eab58)&&_['isNil'](_0x5d314e)){if(_0x484f5e[_0x5148('0x71')](_0xe81f8c)){if(_0x5edb4f[_0x5148('0x6e')][_0x1ca7a1][_0x484f5e[_0xe81f8c]]){var _0x775a7e=_[_0x5148('0x72')](_0x5edb4f[_0x5148('0x6e')][_0x1ca7a1][_0x484f5e[_0xe81f8c]]['replace'](/"/g,'\x27'));switch(_0xe81f8c){case _0x5148('0x34'):var _0x4cc4de=moment(_0x775a7e,_0x5148('0xc'),!![]);if(_0x4cc4de[_0x5148('0x73')]()){_0x459bbd[_0x5148('0x1c')]('\x22'+_0x775a7e+'\x22');}else{_0x599e53[_0x5148('0x1c')](_0x5148('0x74'));}break;case _0x5148('0x39'):var _0x3b31b6=parseInt(_0x775a7e);_0x775a7e=_[_0x5148('0x75')](_0x3b31b6)||_0x3b31b6<0x0||_0x3b31b6>0x4?_0x14f6f5?0x3:0x2:_0x3b31b6;_0x459bbd[_0x5148('0x1c')]('\x22'+_0x775a7e+'\x22');break;case _0x5148('0x3a'):var _0x4ae66f=parseInt(_0x775a7e);if(_['isNumber'](_0x4ae66f)&&_[_0x5148('0x76')](_0x2e3b97,_0x4ae66f)){_0x459bbd[_0x5148('0x1c')]('\x22'+_0x4ae66f+'\x22');}else{_0x599e53['push']('agent\x20not\x20exists');}break;case _0x5148('0x77'):if(isEmail(_0x775a7e)){_0x459bbd['push']('\x22'+_0x775a7e+'\x22');}else{_0x599e53[_0x5148('0x1c')](_0x5148('0x78'));}break;case _0x5148('0x79'):var _0x155d61=moment(_0x775a7e,_0x5148('0x7a'),!![]);if(_0x155d61[_0x5148('0x73')]()){_0x459bbd[_0x5148('0x1c')]('\x22'+_0x775a7e+'\x22');}else{_0x599e53['push'](_0x5148('0x7b'));}break;default:_0x459bbd['push']('\x22'+_0x775a7e+'\x22');}}else{switch(_0xe81f8c){case'firstName':case _0x5148('0x13'):_0x599e53[_0x5148('0x1c')](_0xe81f8c+_0x5148('0x7c'));break;default:_0x459bbd[_0x5148('0x1c')]('\x22\x22');}}}}else{var _0x1132b6='';if(!_[_0x5148('0x1b')](_0x2eab58)){if(!_0x578576[_0x5148('0x71')](_0x2eab58['id'])){for(var _0x2ff9a1=0x0;_0x2ff9a1<_0x484f5e[_0xe81f8c]['length'];_0x2ff9a1++){var _0x775a7e=_[_0x5148('0x72')](_0x5edb4f[_0x5148('0x6e')][_0x1ca7a1][_0x484f5e[_0xe81f8c][_0x2ff9a1]][_0x5148('0x7d')](/"/g,'\x27'));var _0x3224bd=phoneDescriptions[_0x5148('0x6f')](_0x394d36=>_0x394d36[_0x5148('0x7e')]===_0x2eab58['id']);if(!_['isNil'](_0x3224bd)){var _0x22fec1=_[_0x5148('0x72')](_0x5edb4f[_0x5148('0x6e')][_0x1ca7a1][_0x484f5e[_0x3224bd[_0x5148('0x7f')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x22fec1))_0x775a7e=_0x775a7e+'§'+_0x22fec1;}if(_0x1132b6=='')_0x1132b6=_0x775a7e;else _0x1132b6+='|'+_0x775a7e;}_0xb130e7['push'](_0x2eab58['id']+':'+_0x1132b6);_0x578576[_0x2eab58['id']]=0x1;}}}}if(hasAdditionalPhones){_0x459bbd[_0x5148('0x1c')]('\x22'+_0xb130e7['join'](';')+'\x22');}if(_0x599e53[_0x5148('0x21')]){handleError(_0x5edb4f[_0x5148('0x6e')][_0x1ca7a1],{'code':_0x5148('0x80'),'message':_0x599e53['join']()});}else{fs[_0x5148('0x81')](_0xdd8eef,_0x459bbd[_0x5148('0x15')]()+'\x0a');}_0x459bbd=[];}if(!(stats[_0x5148('0x82')]%0xc8)){socket[_0x5148('0x83')](_0x5148('0x84')+_0x10ec6f,stats);stats[_0x5148('0x5d')]=[];}}if(stopped){logger[_0x5148('0x59')](_0x5148('0x85'));_0x316336[_0x5148('0x86')]();}}catch(_0x24f43d){handleError(_0x5edb4f['data'][_0x1ca7a1],{'code':'SystemError','message':_0x24f43d[_0x5148('0x1e')]});logger[_0x5148('0x5b')](_0x5148('0x87'),_0x24f43d[_0x5148('0x1e')]);}},'complete':function(){try{var _0x2af101=[];var _0x44545f=tempTableName;_0x2af101[_0x5148('0x1c')]('CREATE\x20TABLE\x20'+_0x44545f+_0x5148('0x88'));logger[_0x5148('0x59')](_0x5148('0x89'),contactItemTypes[_0x5148('0x21')]);var _0x413b45=util[_0x5148('0xe')](_0x5148('0x8a'),_0xdd8eef,_0x44545f,_0x2a9b18,_0x21992e[_0x5148('0x36')],_0x21992e['CompanyId']||null,NOW,NOW);if(_[_0x5148('0x1b')](_0x484f5e[_0x5148('0x34')])){_0x413b45+=_0x5148('0x8b');}_0x2af101[_0x5148('0x1c')](_0x413b45);BPromise[_0x5148('0x8c')](_0x2af101,handleQuery)['then'](function(_0x4888c2){BPromise[_0x5148('0x22')]([handleAdditionalPhones()])[_0x5148('0x1d')](function(){_0x2af101=[];for(var _0x2d6a10=0x0;_0x2d6a10\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','spread','isNil','AdditionalPhones','push','all','then','error','split','length','filter','CmContactHasItem','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','fromQuery','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','code','catch','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','find','replace','scheduledat'];(function(_0x3ece0b,_0x3d3258){var _0x4b791e=function(_0x57f3da){while(--_0x57f3da){_0x3ece0b['push'](_0x3ece0b['shift']());}};_0x4b791e(++_0x3d3258);}(_0x26f9,0x16f));var _0x926f=function(_0x37222f,_0x25a5ab){_0x37222f=_0x37222f-0x0;var _0x5c5a6d=_0x26f9[_0x37222f];return _0x5c5a6d;};'use strict';var fs=require('fs');var path=require(_0x926f('0x0'));var _=require(_0x926f('0x1'));var Papa=require('papaparse');var util=require(_0x926f('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x926f('0x3'));var Redis=require(_0x926f('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x926f('0x5'));var logger=require(_0x926f('0x6'))(_0x926f('0x7'));config[_0x926f('0x8')]=_[_0x926f('0x9')](config[_0x926f('0x8')],{'host':_0x926f('0xa'),'port':0x18eb});var socket=require(_0x926f('0xb'))(new Redis(config[_0x926f('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x926f('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x926f('0xd')+moment()['format'](_0x926f('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x43cd93){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'](_0x43cd93);}function selectNotIn(_0x3d3802,_0x2ae81c,_0x40a960,_0x244d4b,_0x13ef84){return squel['select']()[_0x926f('0xf')](_0x926f('0x10'))[_0x926f('0x11')](_0x244d4b)[_0x926f('0x12')](_0x2ae81c,null,_0x2ae81c+_0x926f('0x13')+_0x244d4b+'.'+_0x40a960)[_0x926f('0x14')](_0x244d4b+'.'+_0x40a960+_0x926f('0x15')+_0x3d3802+'.'+_0x40a960)['where'](_0x2ae81c+'.dialCheckDuplicateType\x20IN\x20('+_0x13ef84['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x11197b,_0x3f88ea){promisesAdditionalPhones=[];promisesContact=[];return db[_0x926f('0x16')][_0x926f('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0x926f('0x18')](function(_0x385fad){if(_0x385fad!==null){var _0x5812cb=[];for(var _0x20307b=0x0;_0x20307b<_0x385fad['length'];_0x20307b++){var _0x32522d=_0x385fad[_0x20307b];if(!_['isNil'](_0x32522d['phone'])){if(!_[_0x926f('0x19')](_0x32522d[_0x926f('0x1a')]))_0x5812cb['push'](insertAdditionalPhones(_0x32522d));promisesContact[_0x926f('0x1b')]({'contact':_0x32522d});}}}Promise[_0x926f('0x1c')](_0x5812cb)[_0x926f('0x1d')](function(){_0x11197b({'val':0x1});});})['catch'](function(_0x19a134){logger[_0x926f('0x1e')](_0x19a134['message']);});});}function insertAdditionalPhones(_0x2faf7d){return new Promise(function(_0x4241ac,_0x56fef1){var _0x1cf218=_0x2faf7d[_0x926f('0x1a')];if(_[_0x926f('0x19')](_0x1cf218))_0x56fef1({'val':0x0});else{var _0x43a1f1=_0x1cf218[_0x926f('0x1f')](';');var _0x3b7179=[];orderBy=0x0;for(var _0x412260=0x0;_0x412260<_0x43a1f1[_0x926f('0x20')];_0x412260++){_0x3b7179[_0x926f('0x1b')](splitAdditionalPhone(_0x2faf7d['id'],_0x43a1f1[_0x412260]));}Promise[_0x926f('0x1c')](_0x3b7179)[_0x926f('0x1d')](function(){_0x4241ac({'val':_0x43a1f1['length']});});}});}function splitAdditionalPhone(_0x2d76eb,_0x151f71){return new Promise(function(_0x53f10c,_0x640fe0){var _0x84bccd=_0x151f71[_0x926f('0x1f')](':');var _0x26391d=_0x84bccd[0x0];var _0x799889=_0x84bccd[0x1];if(_0x799889!==''){var _0x3887fc=_0x799889['split']('|');var _0x110e59=[];for(var _0x5065dd=0x0;_0x5065dd<_0x3887fc[_0x926f('0x20')];_0x5065dd++){if(_0x3887fc[_0x5065dd]!==''){var _0x37230f=_[_0x926f('0x21')](promisesAdditionalPhones,{'contactId':_0x2d76eb,'phone':_0x3887fc[_0x5065dd]});if(_0x37230f[_0x926f('0x20')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2d76eb,'contactTypeId':_0x26391d,'phone':_0x3887fc[_0x5065dd],'orderBy':orderBy});}}}_0x53f10c({'ok':0x1});}else _0x53f10c({'res':0x0});});}function createAdditionalPhone(_0x367749,_0x5a4d40,_0xc88ea4,_0x2556ce){var _0x518a47='';var _0x5f35fe='';var _0x19bd54=_0xc88ea4[_0x926f('0x1f')]('§');_0x518a47=_0x19bd54[0x0];if(_0x19bd54['length']==0x2)_0x5f35fe=_0x19bd54[0x1];return new Promise(function(_0x33c1fb,_0xb6b509){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x367749,'item':_0x518a47}})[_0x926f('0x1d')](function(_0x1d61d6){if(_0x1d61d6){return db[_0x926f('0x22')]['update']({'ItemTypeId':_0x5a4d40,'description':_0x5f35fe,'OrderBy':_0x2556ce},{'where':{'CmContactId':_0x367749,'item':_0x518a47}})[_0x926f('0x1d')](function(_0x12de3e){_0x33c1fb({'res':_0x926f('0x23')});});}else{return db['CmContactHasItem'][_0x926f('0x24')]({'CmContactId':_0x367749,'item':_0x518a47,'ItemTypeId':_0x5a4d40,'description':_0x5f35fe,'OrderBy':_0x2556ce,'ItemClass':_0x926f('0x25')})[_0x926f('0x1d')](function(_0xc79c61){_0x33c1fb({'res':_0x926f('0x26')});});}});});}function updateContact(_0x426a40){return new Promise(function(_0x589409,_0x333a99){var _0xf17230=_0x426a40['id'];delete _0x426a40['id'];return db[_0x926f('0x27')][_0x926f('0x28')](_0x426a40,{'where':{'id':_0xf17230}})['then'](function(_0x21096a){updatedRows+=0x1;return db[_0x926f('0x29')][_0x926f('0x28')]({'phone':_0x426a40[_0x926f('0x10')]},{'where':{'ContactId':_0xf17230}})[_0x926f('0x1d')](function(_0x26b64c){_0x589409({'ret':'OK'});});});});}function insertCmHopper(_0x1d7e5c,_0xaad45d,_0x2184c1,_0x41bfac,_0xd4d998){var _0x482322=[_0x926f('0x2a'),_0x926f('0x2b'),'cm_contacts.id',_0x926f('0x2c'),_0xaad45d+'.'+_0x41bfac,_0x926f('0x2d'),_0x926f('0x2e'),_0x926f('0x2f'),_0x926f('0x30'),'\x22'+_0xd4d998+'\x22'];return squel[_0x926f('0x31')]()[_0x926f('0x32')](_0x926f('0x33'))['fromQuery']([_0x926f('0x10'),'scheduledat',_0x926f('0x34'),_0x926f('0x35'),_0x41bfac,_0x926f('0x36'),_0x926f('0x37'),_0x926f('0x38'),_0x926f('0x39'),_0x926f('0x3a')],squel[_0x926f('0x3b')]()[_0x926f('0x3c')](_0x482322)[_0x926f('0x11')](_0xaad45d)[_0x926f('0x12')](_0x926f('0x3d'),null,_0x926f('0x3e')+_0xaad45d+_0x926f('0x3f'))[_0x926f('0x12')](_0x2184c1,null,_0x2184c1+'.id\x20=\x20'+_0xaad45d+'.'+_0x41bfac)[_0x926f('0x14')](_0xaad45d+_0x926f('0x40'),_0x1d7e5c)[_0x926f('0x14')](_0x926f('0x41'),NOW)[_0x926f('0x14')](_0x926f('0x42'),selectNotIn(_0xaad45d,_0x2184c1,_0x41bfac,_0x926f('0x33'),[_0x926f('0x43'),'\x22onlyIfOpen\x22']))[_0x926f('0x14')](_0x926f('0x42'),selectNotIn(_0xaad45d,_0x2184c1,_0x41bfac,_0x926f('0x33'),[_0x926f('0x43')])))[_0x926f('0x44')]();}function insertCmHopperBlack(_0x52a994,_0x40b708,_0x150220,_0x2ee82e){var _0x39cb80=[_0x926f('0x2a'),'cm_contacts.id',_0x926f('0x2c'),_0x40b708+'.'+_0x2ee82e,_0x926f('0x2d'),_0x926f('0x2e')];return squel[_0x926f('0x31')]()[_0x926f('0x32')]('cm_hopper_black')[_0x926f('0x45')](['phone',_0x926f('0x34'),_0x926f('0x35'),_0x2ee82e,_0x926f('0x36'),_0x926f('0x37')],squel[_0x926f('0x3b')]()[_0x926f('0x3c')](_0x39cb80)[_0x926f('0x11')](_0x40b708)['join'](_0x926f('0x3d'),null,_0x926f('0x3e')+_0x40b708+_0x926f('0x3f'))[_0x926f('0x12')](_0x150220,null,_0x150220+_0x926f('0x13')+_0x40b708+'.'+_0x2ee82e)[_0x926f('0x14')](_0x40b708+_0x926f('0x40'),_0x52a994)[_0x926f('0x14')](_0x926f('0x41'),NOW)[_0x926f('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x926f('0x3b')]()['field'](_0x926f('0x10'))[_0x926f('0x11')](_0x926f('0x46'))[_0x926f('0x14')](_0x926f('0x47'),_0x52a994)['where'](_0x2ee82e+_0x926f('0x48'),_0x40b708+'.'+_0x2ee82e)))[_0x926f('0x44')]();}function insertCmHopperAdditionalPhones(_0xf1dbe8){var _0x42f351=[_0x926f('0x49'),'cm_contact_has_items.item',_0x926f('0x4a'),_0x926f('0x4b'),_0x926f('0x4c')];return squel[_0x926f('0x31')]()[_0x926f('0x32')](_0x926f('0x4d'))['fromQuery']([_0x926f('0x4e'),'phone','OrderBy',_0x926f('0x36'),_0x926f('0x37')],squel[_0x926f('0x3b')]()[_0x926f('0x3c')](_0x42f351)[_0x926f('0x11')]('cm_hopper')[_0x926f('0x12')](_0x926f('0x3d'),null,_0x926f('0x4f'))['join'](_0x926f('0x50'),null,_0x926f('0x51'))[_0x926f('0x14')](_0x926f('0x52'),_0xf1dbe8)['where'](_0x926f('0x41'),NOW))['toString']();}function insertCmContact(_0x1203e2,_0x5ab042,_0xae6569,_0x3728ea){var _0x535d01=_[_0x926f('0x53')](_[_0x926f('0x54')](_0x3728ea),[_0x926f('0x35'),_0x926f('0x55'),_0x926f('0x36'),'updatedAt']);return squel[_0x926f('0x31')]()[_0x926f('0x32')](_0x926f('0x3d'))[_0x926f('0x45')](_0x535d01,squel[_0x926f('0x3b')]()[_0x926f('0x3c')](_0x535d01)[_0x926f('0x11')](_0x5ab042)[_0x926f('0x14')]('('+_0xae6569[_0x926f('0x12')](',')+_0x926f('0x56'),squel[_0x926f('0x3b')]()[_0x926f('0x3c')](_0xae6569)[_0x926f('0x11')](_0x926f('0x3d'))[_0x926f('0x14')](_0x926f('0x47'),_0x1203e2))[_0x926f('0x14')](_0x926f('0x57'),squel[_0x926f('0x3b')]()[_0x926f('0xf')](_0x926f('0x58'),_0x926f('0x59'))['from'](_0x5ab042)[_0x926f('0x5a')](_0xae6569['join'](','))))[_0x926f('0x44')]();}function handleStop(){logger[_0x926f('0x5b')](_0x926f('0x5c'));stopped=!![];}function handleUncaughtException(_0x390031){logger[_0x926f('0x1e')](_0x390031[_0x926f('0x5d')]);process[_0x926f('0x5e')](0x1);}function handleError(_0x43eec5,_0xb23d72){stats[_0x926f('0x5f')][_0x926f('0x1b')]({'name':_0xb23d72[_0x926f('0x60')],'message':_0xb23d72[_0x926f('0x5d')],'row':_0x43eec5});}function handleQuery(_0x339d27){logger[_0x926f('0x5b')](_0x339d27);return db[_0x926f('0x16')][_0x926f('0x17')](_0x339d27)[_0x926f('0x18')](function(_0x20c918){results[_0x926f('0x1b')](_0x20c918);})[_0x926f('0x61')](function(_0x15f7da){logger[_0x926f('0x1e')](_0x15f7da[_0x926f('0x5d')]);});}function main(_0x442240,_0x51d89a,_0x5b0ddd,_0x5e753b){logger[_0x926f('0x5b')](_0x926f('0x62'),_0x442240,JSON[_0x926f('0x63')](_0x51d89a));process[_0x926f('0x64')](_0x926f('0x65'));var _0x409643=_0x51d89a['binding'];var _0x1c2771=_[_0x926f('0x66')](_0x409643);var _0x2791d4=_0x51d89a[_0x926f('0x67')];var _0x2397b4=path[_0x926f('0x12')](config[_0x926f('0x68')],_0x926f('0x69'),_0x2791d4+'.csv');logger[_0x926f('0x5b')](_0x926f('0x6a'),_0x51d89a);db[_0x926f('0x6b')][_0x926f('0x6c')]({'raw':!![],'attributes':['id',_0x926f('0x6d')]})['then'](function(_0xc74cdd){for(var _0x423696=0x0;_0x423696<_0xc74cdd[_0x926f('0x20')];_0x423696++){if(_0xc74cdd[_0x423696]['name']in _0x409643){contactItemTypes[_0x926f('0x1b')](_0xc74cdd[_0x423696]);delete _0x1c2771[_0xc74cdd[_0x423696][_0x926f('0x6d')]];hasAdditionalPhones=!![];}for(var _0x321dca in _0x409643){if(_0xc74cdd[_0x423696][_0x926f('0x6d')]+_0x926f('0x6e')===_0x321dca){phoneDescriptions[_0x926f('0x1b')]({'itemTypeId':_0xc74cdd[_0x423696]['id'],'description':_0x321dca});delete _0x1c2771[_0x321dca];}}}if(hasAdditionalPhones)_0x1c2771['AdditionalPhones']='';var _0x32ce78=_[_0x926f('0x54')](_0x1c2771)[_0x926f('0x12')]();logger[_0x926f('0x5b')](_0x926f('0x6f'),_0x32ce78);fs[_0x926f('0x70')](_0x2397b4,_0x32ce78+'\x0a');Papa[_0x926f('0x71')](fs[_0x926f('0x72')](_0x442240),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3bf842,_0x453ca9){try{for(var _0x316af9=0x0,_0x31f09f=[];_0x316af9<_0x3bf842[_0x926f('0x73')][_0x926f('0x20')];_0x316af9++){stats['rows']+=0x1;if(_0x3bf842[_0x926f('0x5f')][_0x316af9]){handleError(_0x3bf842[_0x926f('0x73')][_0x316af9],_0x3bf842[_0x926f('0x5f')][_0x316af9]);}else{var _0x4c9907=[];var _0x34bb24=[];var _0x3fa7b3={};for(var _0x5d64f1 in _0x409643){let _0x179d42=contactItemTypes['find'](_0x39be52=>_0x39be52[_0x926f('0x6d')]===_0x5d64f1);let _0x166678=contactItemTypes[_0x926f('0x74')](_0x4d6ea5=>_0x4d6ea5['name']+_0x926f('0x6e')===_0x5d64f1);if(_[_0x926f('0x19')](_0x179d42)&&_[_0x926f('0x19')](_0x166678)){if(_0x409643['hasOwnProperty'](_0x5d64f1)){if(_0x3bf842[_0x926f('0x73')][_0x316af9][_0x409643[_0x5d64f1]]){var _0x41e404=_['trim'](_0x3bf842['data'][_0x316af9][_0x409643[_0x5d64f1]][_0x926f('0x75')](/"/g,'\x27'));switch(_0x5d64f1){case _0x926f('0x76'):var _0x3d75a4=moment(_0x41e404,_0x926f('0x77'),!![]);if(_0x3d75a4[_0x926f('0x78')]()){_0x31f09f[_0x926f('0x1b')]('\x22'+_0x41e404+'\x22');}else{_0x4c9907[_0x926f('0x1b')](_0x926f('0x79'));}break;case _0x926f('0x38'):var _0x7d9025=parseInt(_0x41e404);_0x41e404=_[_0x926f('0x7a')](_0x7d9025)||_0x7d9025<0x0||_0x7d9025>0x4?_0x5e753b?0x3:0x2:_0x7d9025;_0x31f09f[_0x926f('0x1b')]('\x22'+_0x41e404+'\x22');break;case'UserId':var _0x1588b2=parseInt(_0x41e404);if(_[_0x926f('0x7b')](_0x1588b2)&&_['includes'](_0x5b0ddd,_0x1588b2)){_0x31f09f[_0x926f('0x1b')]('\x22'+_0x1588b2+'\x22');}else{_0x4c9907['push']('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x41e404)){_0x31f09f[_0x926f('0x1b')]('\x22'+_0x41e404+'\x22');}else{_0x4c9907[_0x926f('0x1b')](_0x926f('0x7c'));}break;case'dateOfBirth':var _0x4c7319=moment(_0x41e404,_0x926f('0x7d'),!![]);if(_0x4c7319[_0x926f('0x78')]()){_0x31f09f[_0x926f('0x1b')]('\x22'+_0x41e404+'\x22');}else{_0x4c9907[_0x926f('0x1b')](_0x926f('0x7e'));}break;default:_0x31f09f[_0x926f('0x1b')]('\x22'+_0x41e404+'\x22');}}else{switch(_0x5d64f1){case _0x926f('0x7f'):case'phone':_0x4c9907['push'](_0x5d64f1+'\x20not\x20specified');break;default:_0x31f09f[_0x926f('0x1b')]('\x22\x22');}}}}else{var _0xff8f64='';if(!_[_0x926f('0x19')](_0x179d42)){if(!_0x3fa7b3['hasOwnProperty'](_0x179d42['id'])){for(var _0x3fc2f2=0x0;_0x3fc2f2<_0x409643[_0x5d64f1]['length'];_0x3fc2f2++){var _0x41e404=_[_0x926f('0x80')](_0x3bf842['data'][_0x316af9][_0x409643[_0x5d64f1][_0x3fc2f2]]['replace'](/"/g,'\x27'));var _0x20ee77=phoneDescriptions['find'](_0x1f48d5=>_0x1f48d5[_0x926f('0x81')]===_0x179d42['id']);if(!_[_0x926f('0x19')](_0x20ee77)){var _0x401bb3=_[_0x926f('0x80')](_0x3bf842[_0x926f('0x73')][_0x316af9][_0x409643[_0x20ee77[_0x926f('0x82')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x401bb3))_0x41e404=_0x41e404+'§'+_0x401bb3;}if(_0xff8f64=='')_0xff8f64=_0x41e404;else _0xff8f64+='|'+_0x41e404;}_0x34bb24[_0x926f('0x1b')](_0x179d42['id']+':'+_0xff8f64);_0x3fa7b3[_0x179d42['id']]=0x1;}}}}if(hasAdditionalPhones){_0x31f09f[_0x926f('0x1b')]('\x22'+_0x34bb24[_0x926f('0x12')](';')+'\x22');}if(_0x4c9907[_0x926f('0x20')]){handleError(_0x3bf842['data'][_0x316af9],{'code':_0x926f('0x83'),'message':_0x4c9907['join']()});}else{fs[_0x926f('0x84')](_0x2397b4,_0x31f09f['join']()+'\x0a');}_0x31f09f=[];}if(!(stats[_0x926f('0x85')]%0xc8)){socket[_0x926f('0x86')](_0x926f('0x87')+_0x2791d4,stats);stats[_0x926f('0x5f')]=[];}}if(stopped){logger[_0x926f('0x5b')]('Abort\x20parser');_0x453ca9[_0x926f('0x88')]();}}catch(_0x3ed0ea){handleError(_0x3bf842[_0x926f('0x73')][_0x316af9],{'code':_0x926f('0x89'),'message':_0x3ed0ea['message']});logger['error'](_0x926f('0x8a'),_0x3ed0ea[_0x926f('0x5d')]);}},'complete':function(){try{var _0x2c5b8e=[];var _0x3d05c8=tempTableName;_0x2c5b8e[_0x926f('0x1b')](_0x926f('0x8b')+_0x3d05c8+'\x20LIKE\x20cm_contacts;');logger[_0x926f('0x5b')]('CIS\x20len',contactItemTypes['length']);var _0x5750ba=util[_0x926f('0xc')](_0x926f('0x8c'),_0x2397b4,_0x3d05c8,_0x32ce78,_0x51d89a[_0x926f('0x35')],_0x51d89a[_0x926f('0x55')]||null,NOW,NOW);if(_['isNil'](_0x409643[_0x926f('0x76')])){_0x5750ba+=_0x926f('0x8d');}_0x2c5b8e[_0x926f('0x1b')](_0x5750ba);BPromise[_0x926f('0x8e')](_0x2c5b8e,handleQuery)[_0x926f('0x1d')](function(_0x5bc24d){BPromise[_0x926f('0x1c')]([handleAdditionalPhones()])[_0x926f('0x1d')](function(){_0x2c5b8e=[];for(var _0xba8ac1=0x0;_0xba8ac1\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.updatedAt','i.closed','i.attach','i.lastMsgDirection','i.subject','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','COUNT(*)','getSelectedTags','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','search','select','field','name','color','tools_tags','user_has_','_interactions','u.fullname','ui.','from','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','sms','whatsapp','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)','sqlOperator','conditions','buildExpression','type','text','value','unreadMessages','read','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','end','Tag','tags','ids'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2504,0xee));var _0x4250=function(_0x45a367,_0x57620a){_0x45a367=_0x45a367-0x0;var _0x5851bc=_0x2504[_0x45a367];return _0x5851bc;};'use strict';var _=require(_0x4250('0x0'));var squel=require(_0x4250('0x1'));var as=require(_0x4250('0x2'));var qs=require(_0x4250('0x3'));var updateInteraction=require(_0x4250('0x4'))[_0x4250('0x5')];var utils=require(_0x4250('0x6'));var db=require(_0x4250('0x7'))['db'];function skipInteractionsQuery(_0x17d2d8,_0xc31f3a,_0xe5986d){var _0x33d70b=![];var _0x493da9=utils[_0x4250('0x8')](_0x17d2d8);if(_0xc31f3a['role']==='agent'&&!_0xe5986d[_0x4250('0x9')]&&!_0xe5986d[_0x493da9]){_0x33d70b=!![];}return _0x33d70b;}function getTagsQuery(){return squel[_0x4250('0xa')]()[_0x4250('0xb')]('id')[_0x4250('0xb')](_0x4250('0xc'))['field'](_0x4250('0xd'))['from'](_0x4250('0xe'));}function getUsersQuery(_0x2ff5ca,_0x55a792){var _0x21ae70=utils['getInteractionFK'](_0x2ff5ca);var _0x535015=_0x4250('0xf')+_0x2ff5ca+_0x4250('0x10');var _0x208e8c=squel[_0x4250('0xa')]()[_0x4250('0xb')]('u.id')[_0x4250('0xb')](_0x4250('0x11'))[_0x4250('0xb')](_0x4250('0x12')+_0x21ae70)[_0x4250('0x13')](_0x535015,'ui')[_0x4250('0x14')]('users','u',_0x4250('0x15'));if(_0x55a792[_0x4250('0x16')]>0x0){_0x208e8c[_0x4250('0x17')](_0x4250('0x12')+_0x21ae70+_0x4250('0x18'),_[_0x4250('0x19')](_0x55a792,'id'));}return _0x208e8c;}function getInteractionsQuery(_0x3d9a6d){var _0x4e70fc=utils[_0x4250('0x1a')](_0x3d9a6d);var _0x35d232=utils[_0x4250('0x8')](_0x3d9a6d);var _0x17a8a9=utils[_0x4250('0x1b')](_0x3d9a6d);return squel[_0x4250('0xa')]()[_0x4250('0x13')](_0x4e70fc['interactions'],'i')[_0x4250('0x14')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4250('0x14')](_0x4250('0x1c'),'o',_0x4250('0x1d'))[_0x4250('0x14')](_0x4e70fc[_0x4250('0x1e')],'a',_0x4250('0x1f')+_0x35d232)[_0x4250('0x14')](_0x4e70fc[_0x4250('0x20')],'me',_0x4250('0x21')+_0x17a8a9+_0x4250('0x22'))[_0x4250('0x14')](_0x4e70fc[_0x4250('0x23')],'it','it.'+_0x17a8a9+_0x4250('0x22'))[_0x4250('0x14')](_0x4250('0xe'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x5d1a74={'body':squel[_0x4250('0x24')](),'contact':squel[_0x4250('0x24')](),'default':squel[_0x4250('0x24')](),'fields':squel[_0x4250('0x24')](),'filter':squel[_0x4250('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x4250('0x24')](),'ids':null},'user':squel[_0x4250('0x24')]()};return _0x5d1a74;}function parseTagParameter(_0x3f40dd){var _0x559d06=squel['expr']();if(_0x3f40dd){var _0x2dcd72=utils['getSelectedTags'](_0x3f40dd);_0x2dcd72[_0x4250('0x25')](function(_0x1c4fa5){_0x559d06['or'](_0x4250('0x26'),'%,'+_0x1c4fa5+',%');});}return _0x559d06;}function parseReadParameter(_0x2cdfdf){var _0xb82299='';if(_0x2cdfdf){_0xb82299='unreadMessages\x20{OPERATOR}\x200';if(_0x2cdfdf==='1'){_0xb82299=_0xb82299[_0x4250('0x27')](_0x4250('0x28'),'=');}else{_0xb82299=_0xb82299['replace'](_0x4250('0x28'),'>');}}return _0xb82299;}function parseSearchFilter(_0x5654f5,_0x231cf0){var _0x4d26f0=squel['expr']();if(_0x231cf0){var _0xea7ccc=_0x231cf0['replace']('\x5c','\x5c\x5c')[_0x4250('0x27')](/'/g,'\x27\x27');if(qs[_0x4250('0x29')](_0xea7ccc)){_0x4d26f0['or']('i.id\x20LIKE\x20?',_0xea7ccc+'%');if([_0x4250('0x2a'),_0x4250('0x2b')]['includes'](_0x5654f5)){_0x4d26f0['or'](_0x4250('0x2c'),_0xea7ccc+'%');}else if(_0x5654f5===_0x4250('0x2d')){_0x4d26f0['or']('i.fax\x20LIKE\x20?',_0xea7ccc+'%');}else if(_0x5654f5===_0x4250('0x2e')){_0x4d26f0['or'](_0x4250('0x2f'),_0xea7ccc+'%');}}else if(_0x5654f5===_0x4250('0x30')&&qs[_0x4250('0x31')](_0xea7ccc)){_0x4d26f0['or'](_0x4250('0x32'),_0xea7ccc+'%');}else{if(_0x5654f5===_0x4250('0x30')){_0x4d26f0['or'](_0x4250('0x33'),qs[_0x4250('0x34')](_0xea7ccc))['or'](_0x4250('0x35'),qs[_0x4250('0x34')](_0xea7ccc));}else{if(_0x5654f5!==_0x4250('0x2d')){_0x4d26f0['or'](_0x4250('0x36'),qs[_0x4250('0x34')](_0xea7ccc));}_0x4d26f0['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xea7ccc+'%');}}}return _0x4d26f0;}function parseAdvancedSearchFilter(_0x1de7cd,_0x4fe97a){var _0x2a60dc=getSqlClauses();var _0x3e0950=as['parseSearch'](_0x1de7cd);var _0xf14c4e=_0x3e0950[_0x4250('0x37')];for(var _0x3e85ba=0x0;_0x3e85ba<_0x3e0950[_0x4250('0x38')]['length'];_0x3e85ba++){var _0x4c08c7=_0x3e0950['conditions'][_0x3e85ba];var _0x3bbee2='i';var _0x410ff9=_['find'](_0x4fe97a,[_0x4250('0xc'),_0x4c08c7[_0x4250('0xb')]]);if(_0x410ff9){var _0x3f2ef7=as[_0x4250('0x39')](_0x3bbee2,_0x410ff9[_0x4250('0x3a')],_0x4c08c7);_0x2a60dc['default'][_0xf14c4e](_0x3f2ef7[_0x4250('0x3b')],_0x3f2ef7['value']['start'],_0x3f2ef7[_0x4250('0x3c')]['end']);}else{switch(_0x4c08c7[_0x4250('0xb')]){case _0x4250('0x3d'):var _0x3e6121=parseReadParameter(_0x4c08c7['value']);_0x2a60dc[_0x4250('0x3e')][_0x4250('0x3f')](_0x3e6121);break;case _0x4250('0x40'):if(_0x4c08c7[_0x4250('0x41')]===_0x4250('0x42')){if(_0x4c08c7['value'][_0x4250('0x43')]('\x20')[_0x4250('0x16')]>0x1){_0x2a60dc[_0x4250('0x44')][_0xf14c4e](_0x4250('0x45'),qs[_0x4250('0x34')](_0x4c08c7[_0x4250('0x3c')]),null);}else{var _0x5ef192='%'+_0x4c08c7[_0x4250('0x3c')]+'%';_0x2a60dc['contact'][_0xf14c4e](_0x4250('0x46'),_0x5ef192,_0x5ef192,_0x5ef192);}}else{_0x410ff9=_[_0x4250('0x47')](_0x4fe97a,[_0x4250('0xc'),_0x4250('0x48')]);_0x4c08c7[_0x4250('0xb')]=_0x4250('0x48');_0x3f2ef7=as['buildExpression'](_0x3bbee2,_0x410ff9['type'],_0x4c08c7);_0x2a60dc['contact'][_0xf14c4e](_0x3f2ef7[_0x4250('0x3b')],_0x3f2ef7[_0x4250('0x3c')][_0x4250('0x49')],_0x3f2ef7['value'][_0x4250('0x4a')]);}break;case _0x4250('0x4b'):var _0x32522a=_0x4c08c7['value'][_0x4250('0x43')](',')[_0x4250('0x19')](function(_0x366cb7){return Number(_0x366cb7);});var _0x3707ed=parseTagParameter(_0x32522a);_0x2a60dc['tags']['clause'][_0x4250('0x3f')](_0x3707ed);_0x2a60dc[_0x4250('0x4c')][_0x4250('0x4d')]=_0x32522a;break;case _0x4250('0x4e'):if(_0x4c08c7[_0x4250('0x41')]==='$substring'){_0x2a60dc[_0x4250('0x4f')][_0xf14c4e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4c08c7[_0x4250('0x3c')]+'%',null);}else{_0x410ff9=_[_0x4250('0x47')](_0x4fe97a,[_0x4250('0xc'),'UserId']);_0x4c08c7[_0x4250('0xb')]=_0x4250('0x50');_0x3f2ef7=as[_0x4250('0x39')](_0x3bbee2,_0x410ff9['type'],_0x4c08c7);_0x2a60dc['user'][_0xf14c4e](_0x3f2ef7['text'],_0x3f2ef7[_0x4250('0x3c')][_0x4250('0x49')],_0x3f2ef7[_0x4250('0x3c')][_0x4250('0x4a')]);}break;case _0x4250('0x51'):case _0x4250('0x52'):_0x3f2ef7=as['buildExpression']('me',null,_0x4c08c7);_0x2a60dc[_0x4250('0x51')][_0xf14c4e](_0x3f2ef7[_0x4250('0x3b')],_0x3f2ef7[_0x4250('0x3c')]['start'],_0x3f2ef7[_0x4250('0x3c')]['end']);break;}}}return _0x2a60dc;}function parseModelFields(_0x5895ea,_0x2e0d9d,_0x3192ee){var _0xe02e0f=utils[_0x4250('0x8')](_0x5895ea);var _0x5d71db=squel[_0x4250('0x24')]();var _0x59d51a=_(_0x2e0d9d)[_0x4250('0x53')]()['map'](function(_0x364385){return _[_0x4250('0x54')](_0x3192ee,[_0x4250('0xc'),_0x364385])?_0x364385:undefined;})['compact']()[_0x4250('0x3c')]();if(_0x59d51a[_0x4250('0x16')]>0x0){_0x59d51a['forEach'](function(_0x481e95){if(_0x481e95===_0xe02e0f){_0x5d71db['and']('i.'+_0xe02e0f+_0x4250('0x18'),[]['concat'](_0x2e0d9d[_0x481e95]));}else if(_0x481e95==='createdAt'){var _0x2832d1=JSON[_0x4250('0x55')](_0x2e0d9d[_0x481e95])[_0x4250('0x56')];var _0x3870bb=JSON[_0x4250('0x55')](_0x2e0d9d[_0x481e95])['$lte'];_0x5d71db[_0x4250('0x3f')](_0x4250('0x57'),_0x2832d1,_0x3870bb);}else{if(_0x2e0d9d[_0x481e95]===_0x4250('0x58')){_0x5d71db[_0x4250('0x3f')]('i.'+_0x481e95+'\x20IS\x20NULL');}else{_0x5d71db[_0x4250('0x3f')]('i.'+_0x481e95+_0x4250('0x59'),_0x2e0d9d[_0x481e95]);}}});}return _0x5d71db;}function parseQueryParameters(_0x59efc0,_0xc7ba0,_0x2a9214){var _0x506d4d=getSqlClauses();return Promise[_0x4250('0x5a')]()[_0x4250('0x5b')](function(){return parseModelFields(_0x59efc0,_0xc7ba0,_0x2a9214);})[_0x4250('0x5b')](function(_0x197371){_0x506d4d[_0x4250('0x5c')][_0x4250('0x3f')](_0x197371);return parseReadParameter(_0xc7ba0[_0x4250('0x3e')]);})['then'](function(_0x2ea3d0){_0x506d4d[_0x4250('0x3e')][_0x4250('0x3f')](_0x2ea3d0);return parseTagParameter(_0xc7ba0['tag']);})['then'](function(_0x27fe0f){_0x506d4d[_0x4250('0x4c')]['clause'][_0x4250('0x3f')](_0x27fe0f);return parseSearchFilter(_0x59efc0,_0xc7ba0[_0x4250('0x5d')]);})[_0x4250('0x5b')](function(_0x595719){_0x506d4d[_0x4250('0x5d')]=_0x595719;return _0x506d4d;});}function checkAccountsRestrictions(_0x23513f,_0x4efe0a,_0x455466){var _0x243f5c=utils[_0x4250('0x8')](_0x23513f);var _0x4b6de1='get'+_['capitalize'](_0x23513f)+(_0x23513f==='chat'?_0x4250('0x5e'):'Accounts');var _0x3e65ac=squel[_0x4250('0x24')]();return Promise[_0x4250('0x5a')]()['then'](function(){if(_0x455466[_0x4250('0x9')]&&_0x4efe0a[_0x4250('0x5f')]===_0x4250('0x60')){return _0x4efe0a[_0x4b6de1]({'attributes':['id'],'raw':!![]});}})[_0x4250('0x5b')](function(_0x4cca65){if(_0x4cca65){if(_0x4cca65[_0x4250('0x16')]===0x0){_0x3e65ac[_0x4250('0x3f')]('i.'+_0x243f5c+_0x4250('0x61'));}else{_0x3e65ac[_0x4250('0x3f')]('i.'+_0x243f5c+'\x20IN\x20?',_[_0x4250('0x19')](_0x4cca65,'id'));}}else if(!_0x455466[_0x243f5c]){_0x3e65ac['and']('i.'+_0x243f5c+_0x4250('0x62'));}})[_0x4250('0x5b')](function(){return _0x3e65ac;});}function getClosedOrderClause(_0x421211,_0x56c670){var _0x1bcef1='';var _0x18171a=[_0x4250('0x63'),_0x4250('0x64'),_0x4250('0x65')];if(_0x421211===_0x4250('0x30')){_0x18171a[_0x4250('0x66')](_0x4250('0x67'));}if(_0x56c670[_0x4250('0x68')]==='0'&&_0x421211===_0x4250('0x30')){_0x1bcef1=_0x4250('0x67');}else{if(_0x56c670[_0x4250('0x68')]==='1'){_0x18171a['shift']();}_0x1bcef1=_0x4250('0x69')+_0x18171a[_0x4250('0x6a')](',\x20')+')';}return _0x1bcef1;}function getFilteredInteractions(_0x1aa651,_0x4634a1,_0x7f4232,_0x57baf7){var _0x298c5c=utils['getInteractionFK'](_0x1aa651);var _0x11fa9e=_[_0x4250('0x6b')](_0x1aa651)+_0x4250('0x6c');var _0x21b527=[];var _0x40f1f6=getTagsQuery();var _0x4c1691={'type':db[_0x4250('0x6d')][_0x4250('0x6e')][_0x4250('0x6f')],'raw':!![]};var _0x4309c5=[];var _0x392912=[];return db[_0x4250('0x70')]['query'](_0x40f1f6[_0x4250('0x71')](),_0x4c1691)[_0x4250('0x5b')](function(_0xa1563e){_0x21b527=_[_0x4250('0x72')](_0xa1563e,'id');_0x4c1691=_['merge'](_0x4c1691,{'model':db[_0x11fa9e],'mapToModel':!![],'nest':!![]});if(_0x7f4232[_0x4250('0x5c')]){_0x57baf7[_0x4250('0x73')][_0x4250('0x25')](function(_0x513fea){_0x4634a1[_0x4250('0xb')]('i.'+_0x513fea);});}else{_0x4634a1[_0x4250('0xb')](_0x4250('0x74'),_0x4250('0x3d'));_0x4634a1[_0x4250('0xb')](_0x4250('0x75'),'Account.key');_0x4634a1[_0x4250('0xb')](_0x4250('0x76'),_0x4250('0x77'));if(_0x1aa651==='mail'){_0x4634a1['field']('a.email','Account.email');_0x4634a1['field'](_0x4250('0x78'),_0x4250('0x79'));_0x4634a1[_0x4250('0xb')](_0x4250('0x7a'));_0x4634a1['field']('i.createdAt');_0x4634a1[_0x4250('0xb')](_0x4250('0x7b'));_0x4634a1[_0x4250('0xb')](_0x4250('0x7c'));_0x4634a1['field']('i.closedAt');_0x4634a1[_0x4250('0xb')](_0x4250('0x7d'));_0x4634a1[_0x4250('0xb')]('i.lastMsgAt');_0x4634a1[_0x4250('0xb')](_0x4250('0x7e'));_0x4634a1[_0x4250('0xb')](_0x4250('0x7f'));_0x4634a1[_0x4250('0xb')](_0x4250('0x65'));_0x4634a1['field'](_0x4250('0x64'));_0x4634a1[_0x4250('0xb')]('i.thirdDisposition');_0x4634a1[_0x4250('0xb')](_0x4250('0x67'));_0x4634a1[_0x4250('0xb')]('i.to');_0x4634a1[_0x4250('0xb')]('i.ContactId');_0x4634a1[_0x4250('0xb')](_0x4250('0x80'));_0x4634a1[_0x4250('0xb')](_0x4250('0x81'));}else if(_0x1aa651==='openchannel'){_0x4634a1['field'](_0x4250('0x82'),_0x4250('0x79'));}else{_0x4634a1[_0x4250('0xb')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x1aa651!==_0x4250('0x30')){_0x4634a1['field']('i.*');}_0x4634a1[_0x4250('0xb')](_0x4250('0x83'),_0x4250('0x84'));_0x4634a1['field'](_0x4250('0x85'),_0x4250('0x86'));_0x4634a1[_0x4250('0xb')](_0x4250('0x87'),_0x4250('0x88'));_0x4634a1[_0x4250('0xb')]('c.phone',_0x4250('0x89'));_0x4634a1[_0x4250('0xb')](_0x4250('0x8a'),_0x4250('0x8b'));_0x4634a1[_0x4250('0xb')]('c.fax',_0x4250('0x8c'));_0x4634a1[_0x4250('0xb')](_0x4250('0x8d'),_0x4250('0x8e'));_0x4634a1[_0x4250('0xb')](_0x4250('0x8f'),_0x4250('0x90'));_0x4634a1['field'](_0x4250('0x91'),_0x4250('0x92'));}if(_0x57baf7[_0x4250('0x93')]){_0x4634a1[_0x4250('0x93')](_0x57baf7['limit']);}if(_0x57baf7[_0x4250('0x94')]){_0x4634a1['offset'](_0x57baf7[_0x4250('0x94')]);}return db[_0x4250('0x70')][_0x4250('0x95')](_0x4634a1[_0x4250('0x71')](),_0x4c1691);})['then'](function(_0x2b36ee){_0x4309c5=_0x2b36ee;var _0x2d29d0=getUsersQuery(_0x1aa651,_0x4309c5);return db[_0x4250('0x70')]['query'](_0x2d29d0[_0x4250('0x71')](),_0x4c1691);})[_0x4250('0x5b')](function(_0x16037f){_0x392912=_[_0x4250('0x96')](_0x16037f,_0x298c5c);if(_0x1aa651===_0x4250('0x30')){return db['Setting'][_0x4250('0x97')]({'attributes':[_0x4250('0x98')],'raw':!![]});}})[_0x4250('0x5b')](function(_0x57286c){var _0x3327c2=_0x57286c?_0x57286c[_0x4250('0x98')]:undefined;var _0x958fc=_0x4309c5[_0x4250('0x19')](function(_0x3b309c){return updateInteraction(_0x3b309c,_0x21b527,_0x392912,_0x3327c2);});return Promise[_0x4250('0x99')](_0x958fc);});}function countFilteredInteractions(_0x15b36a,_0x4e0c85){var _0x4ff04c=_0x15b36a['clone']();_0x4ff04c[_0x4250('0xb')](_0x4250('0x9a'));_0x4ff04c[_0x4250('0xb')](_0x4250('0x74'),'unreadMessages');var _0x3b8549=utils[_0x4250('0x9b')](_0x4e0c85);if(!_['isEmpty'](_0x3b8549)){_0x4ff04c[_0x4250('0x17')](_0x4250('0x9c'),_0x3b8549);}var _0x28d9f4={'type':db[_0x4250('0x6d')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x4250('0x70')][_0x4250('0x95')](_0x4ff04c[_0x4250('0x71')](),_0x28d9f4);}module[_0x4250('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x222f=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','chat','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.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.id','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','i.UserId','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','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','left_join','users','length','where','ui.','\x20IN\x20?','map','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','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','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','buildExpression','type','text','start','value','end','unreadMessages','read','and','Contact','$substring','contact','ContactId','Tag','split','tags','clause','ids','User','operator','user','UserId','body','plainBody','keys','compact','forEach','concat','createdAt','parse','$lte'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x222f,0x1a4));var _0xf222=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0x222f[_0x1e03a6];return _0x295b64;};'use strict';var _=require(_0xf222('0x0'));var squel=require(_0xf222('0x1'));var as=require(_0xf222('0x2'));var qs=require(_0xf222('0x3'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0xf222('0x4'));var db=require(_0xf222('0x5'))['db'];function skipInteractionsQuery(_0x307791,_0x7b187d,_0x59a619){var _0x3a2751=![];var _0x54a758=utils[_0xf222('0x6')](_0x307791);if(_0x7b187d[_0xf222('0x7')]==='agent'&&!_0x59a619[_0xf222('0x8')]&&!_0x59a619[_0x54a758]){_0x3a2751=!![];}return _0x3a2751;}function getTagsQuery(){return squel[_0xf222('0x9')]()['field']('id')[_0xf222('0xa')](_0xf222('0xb'))[_0xf222('0xa')](_0xf222('0xc'))[_0xf222('0xd')](_0xf222('0xe'));}function getUsersQuery(_0x47d55a,_0x2e29ad){var _0x405080=utils[_0xf222('0xf')](_0x47d55a);var _0x182bc3='user_has_'+_0x47d55a+_0xf222('0x10');var _0x2850c7=squel[_0xf222('0x9')]()[_0xf222('0xa')](_0xf222('0x11'))[_0xf222('0xa')](_0xf222('0x12'))[_0xf222('0xa')]('ui.'+_0x405080)['from'](_0x182bc3,'ui')[_0xf222('0x13')](_0xf222('0x14'),'u','u.id\x20=\x20ui.UserId');if(_0x2e29ad[_0xf222('0x15')]>0x0){_0x2850c7[_0xf222('0x16')](_0xf222('0x17')+_0x405080+_0xf222('0x18'),_[_0xf222('0x19')](_0x2e29ad,'id'));}return _0x2850c7;}function getInteractionsQuery(_0x25e1c2){var _0x30b646=utils['getInteractionsTables'](_0x25e1c2);var _0x1efa9f=utils[_0xf222('0x6')](_0x25e1c2);var _0x8783ab=utils[_0xf222('0xf')](_0x25e1c2);return squel[_0xf222('0x9')]()[_0xf222('0xd')](_0x30b646[_0xf222('0x1a')],'i')['left_join'](_0xf222('0x1b'),'c',_0xf222('0x1c'))[_0xf222('0x13')](_0xf222('0x14'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x30b646[_0xf222('0x1d')],'a',_0xf222('0x1e')+_0x1efa9f)[_0xf222('0x13')](_0x30b646[_0xf222('0x1f')],'me',_0xf222('0x20')+_0x8783ab+_0xf222('0x21'))['left_join'](_0x30b646[_0xf222('0x22')],'it',_0xf222('0x23')+_0x8783ab+_0xf222('0x21'))[_0xf222('0x13')](_0xf222('0xe'),'t',_0xf222('0x24'));}function getSqlClauses(){var _0x4616de={'body':squel[_0xf222('0x25')](),'contact':squel['expr'](),'default':squel[_0xf222('0x25')](),'fields':squel[_0xf222('0x25')](),'filter':squel[_0xf222('0x25')](),'read':squel[_0xf222('0x25')](),'tags':{'clause':squel[_0xf222('0x25')](),'ids':null},'user':squel[_0xf222('0x25')]()};return _0x4616de;}function parseTagParameter(_0x42616e){var _0x263dc2=squel[_0xf222('0x25')]();if(_0x42616e){var _0x2ec2e9=utils[_0xf222('0x26')](_0x42616e);_0x2ec2e9['forEach'](function(_0x14b2b1){_0x263dc2['or'](_0xf222('0x27'),'%,'+_0x14b2b1+',%');});}return _0x263dc2;}function parseReadParameter(_0x3d5508){var _0x2f04bf='';if(_0x3d5508){_0x2f04bf=_0xf222('0x28');if(_0x3d5508==='1'){_0x2f04bf=_0x2f04bf[_0xf222('0x29')](_0xf222('0x2a'),'=');}else{_0x2f04bf=_0x2f04bf[_0xf222('0x29')](_0xf222('0x2a'),'>');}}return _0x2f04bf;}function parseSearchFilter(_0x59721a,_0x3bdf98){var _0x132b18=squel[_0xf222('0x25')]();if(_0x3bdf98){var _0x53a382=_0x3bdf98[_0xf222('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf222('0x2b')](_0x53a382)){_0x132b18['or'](_0xf222('0x2c'),_0x53a382+'%');if([_0xf222('0x2d'),_0xf222('0x2e')][_0xf222('0x2f')](_0x59721a)){_0x132b18['or'](_0xf222('0x30'),_0x53a382+'%');}else if(_0x59721a===_0xf222('0x31')){_0x132b18['or']('i.fax\x20LIKE\x20?',_0x53a382+'%');}else if(_0x59721a==='openchannel'){_0x132b18['or'](_0xf222('0x32'),_0x53a382+'%');}}else if(_0x59721a===_0xf222('0x33')&&qs[_0xf222('0x34')](_0x53a382)){_0x132b18['or'](_0xf222('0x35'),_0x53a382+'%');}else{if(_0x59721a===_0xf222('0x33')){_0x132b18['or'](_0xf222('0x36'),qs['getFullTextValue'](_0x53a382))['or'](_0xf222('0x37'),qs[_0xf222('0x38')](_0x53a382));}else{if(_0x59721a!==_0xf222('0x31')){_0x132b18['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf222('0x38')](_0x53a382));}_0x132b18['or'](_0xf222('0x39'),_0x53a382+'%');}}}return _0x132b18;}function parseAdvancedSearchFilter(_0x104522,_0x5e40a0){var _0x226d84=getSqlClauses();var _0x21e20a=as[_0xf222('0x3a')](_0x104522);var _0x516010=_0x21e20a[_0xf222('0x3b')];for(var _0x23ed1d=0x0;_0x23ed1d<_0x21e20a[_0xf222('0x3c')][_0xf222('0x15')];_0x23ed1d++){var _0x2e9b27=_0x21e20a['conditions'][_0x23ed1d];var _0x46d65e='i';var _0x542123=_[_0xf222('0x3d')](_0x5e40a0,[_0xf222('0xb'),_0x2e9b27[_0xf222('0xa')]]);if(_0x542123){var _0x5eb639=as[_0xf222('0x3e')](_0x46d65e,_0x542123[_0xf222('0x3f')],_0x2e9b27);_0x226d84['default'][_0x516010](_0x5eb639[_0xf222('0x40')],_0x5eb639['value'][_0xf222('0x41')],_0x5eb639[_0xf222('0x42')][_0xf222('0x43')]);}else{switch(_0x2e9b27['field']){case _0xf222('0x44'):var _0x2c7ee0=parseReadParameter(_0x2e9b27[_0xf222('0x42')]);_0x226d84[_0xf222('0x45')][_0xf222('0x46')](_0x2c7ee0);break;case _0xf222('0x47'):if(_0x2e9b27['operator']===_0xf222('0x48')){if(_0x2e9b27[_0xf222('0x42')]['split']('\x20')['length']>0x1){_0x226d84[_0xf222('0x49')][_0x516010]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf222('0x38')](_0x2e9b27[_0xf222('0x42')]),null);}else{var _0x1d8ab1='%'+_0x2e9b27[_0xf222('0x42')]+'%';_0x226d84['contact'][_0x516010]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1d8ab1,_0x1d8ab1,_0x1d8ab1);}}else{_0x542123=_[_0xf222('0x3d')](_0x5e40a0,['name','ContactId']);_0x2e9b27[_0xf222('0xa')]=_0xf222('0x4a');_0x5eb639=as[_0xf222('0x3e')](_0x46d65e,_0x542123[_0xf222('0x3f')],_0x2e9b27);_0x226d84[_0xf222('0x49')][_0x516010](_0x5eb639[_0xf222('0x40')],_0x5eb639['value'][_0xf222('0x41')],_0x5eb639[_0xf222('0x42')]['end']);}break;case _0xf222('0x4b'):var _0x3405bf=_0x2e9b27['value'][_0xf222('0x4c')](',')['map'](function(_0x149589){return Number(_0x149589);});var _0x4169a0=parseTagParameter(_0x3405bf);_0x226d84[_0xf222('0x4d')][_0xf222('0x4e')][_0xf222('0x46')](_0x4169a0);_0x226d84[_0xf222('0x4d')][_0xf222('0x4f')]=_0x3405bf;break;case _0xf222('0x50'):if(_0x2e9b27[_0xf222('0x51')]===_0xf222('0x48')){_0x226d84[_0xf222('0x52')][_0x516010]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2e9b27['value']+'%',null);}else{_0x542123=_['find'](_0x5e40a0,[_0xf222('0xb'),_0xf222('0x53')]);_0x2e9b27[_0xf222('0xa')]=_0xf222('0x53');_0x5eb639=as['buildExpression'](_0x46d65e,_0x542123[_0xf222('0x3f')],_0x2e9b27);_0x226d84[_0xf222('0x52')][_0x516010](_0x5eb639[_0xf222('0x40')],_0x5eb639[_0xf222('0x42')]['start'],_0x5eb639[_0xf222('0x42')][_0xf222('0x43')]);}break;case _0xf222('0x54'):case _0xf222('0x55'):_0x5eb639=as[_0xf222('0x3e')]('me',null,_0x2e9b27);_0x226d84[_0xf222('0x54')][_0x516010](_0x5eb639[_0xf222('0x40')],_0x5eb639[_0xf222('0x42')][_0xf222('0x41')],_0x5eb639[_0xf222('0x42')]['end']);break;}}}return _0x226d84;}function parseModelFields(_0x5d0d70,_0x193762,_0x47942b){var _0x415af2=utils['getAccountFK'](_0x5d0d70);var _0x191ef0=squel['expr']();var _0x2d8a04=_(_0x193762)[_0xf222('0x56')]()[_0xf222('0x19')](function(_0x22533c){return _['some'](_0x47942b,[_0xf222('0xb'),_0x22533c])?_0x22533c:undefined;})[_0xf222('0x57')]()[_0xf222('0x42')]();if(_0x2d8a04[_0xf222('0x15')]>0x0){_0x2d8a04[_0xf222('0x58')](function(_0x427691){if(_0x427691===_0x415af2){_0x191ef0[_0xf222('0x46')]('i.'+_0x415af2+_0xf222('0x18'),[][_0xf222('0x59')](_0x193762[_0x427691]));}else if(_0x427691===_0xf222('0x5a')){var _0x40c3b2=JSON[_0xf222('0x5b')](_0x193762[_0x427691])['$gte'];var _0x5b6127=JSON[_0xf222('0x5b')](_0x193762[_0x427691])[_0xf222('0x5c')];_0x191ef0[_0xf222('0x46')](_0xf222('0x5d'),_0x40c3b2,_0x5b6127);}else{if(_0x193762[_0x427691]===_0xf222('0x5e')){_0x191ef0[_0xf222('0x46')]('i.'+_0x427691+_0xf222('0x5f'));}else{_0x191ef0[_0xf222('0x46')]('i.'+_0x427691+_0xf222('0x60'),_0x193762[_0x427691]);}}});}return _0x191ef0;}function parseQueryParameters(_0x1e680a,_0x19d859,_0x4e9588){var _0x4dcdec=getSqlClauses();return Promise[_0xf222('0x61')]()[_0xf222('0x62')](function(){return parseModelFields(_0x1e680a,_0x19d859,_0x4e9588);})[_0xf222('0x62')](function(_0xbc503b){_0x4dcdec[_0xf222('0x63')][_0xf222('0x46')](_0xbc503b);return parseReadParameter(_0x19d859[_0xf222('0x45')]);})[_0xf222('0x62')](function(_0xa5b0c){_0x4dcdec[_0xf222('0x45')][_0xf222('0x46')](_0xa5b0c);return parseTagParameter(_0x19d859[_0xf222('0x64')]);})[_0xf222('0x62')](function(_0x46d421){_0x4dcdec['tags'][_0xf222('0x4e')]['and'](_0x46d421);return parseSearchFilter(_0x1e680a,_0x19d859[_0xf222('0x65')]);})[_0xf222('0x62')](function(_0x2c9222){_0x4dcdec[_0xf222('0x65')]=_0x2c9222;return _0x4dcdec;});}function checkAccountsRestrictions(_0x5dc3fa,_0x51443f,_0x42732e){var _0x2fc98a=utils[_0xf222('0x6')](_0x5dc3fa);var _0xd092fc=_0xf222('0x66')+_['capitalize'](_0x5dc3fa)+(_0x5dc3fa===_0xf222('0x67')?'Websites':_0xf222('0x68'));var _0x3f9b99=squel['expr']();return Promise[_0xf222('0x61')]()['then'](function(){if(_0x42732e[_0xf222('0x8')]&&_0x51443f[_0xf222('0x7')]===_0xf222('0x69')){return _0x51443f[_0xd092fc]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x78b0b0){if(_0x78b0b0){if(_0x78b0b0[_0xf222('0x15')]===0x0){_0x3f9b99[_0xf222('0x46')]('i.'+_0x2fc98a+_0xf222('0x5f'));}else{_0x3f9b99[_0xf222('0x46')]('i.'+_0x2fc98a+_0xf222('0x18'),_[_0xf222('0x19')](_0x78b0b0,'id'));}}else if(!_0x42732e[_0x2fc98a]){_0x3f9b99['and']('i.'+_0x2fc98a+_0xf222('0x6a'));}})[_0xf222('0x62')](function(){return _0x3f9b99;});}function getClosedOrderClause(_0x4c7efc,_0x4ee4bb){var _0x5befb8='';var _0x249e22=[_0xf222('0x6b'),_0xf222('0x6c'),_0xf222('0x6d')];if(_0x4c7efc==='mail'){_0x249e22[_0xf222('0x6e')]('i.substatus');}if(_0x4ee4bb[_0xf222('0x6f')]==='0'&&_0x4c7efc===_0xf222('0x33')){_0x5befb8=_0xf222('0x70');}else{if(_0x4ee4bb[_0xf222('0x6f')]==='1'){_0x249e22[_0xf222('0x71')]();}_0x5befb8=_0xf222('0x72')+_0x249e22[_0xf222('0x73')](',\x20')+')';}return _0x5befb8;}function getFilteredInteractions(_0x2a278e,_0x3d45c0,_0x4e8209,_0x4e7d09){var _0x215896=utils['getInteractionFK'](_0x2a278e);var _0x105768=_[_0xf222('0x74')](_0x2a278e)+_0xf222('0x75');var _0x5e14f1=[];var _0x31ef1a=getTagsQuery();var _0x54d24e={'type':db[_0xf222('0x76')][_0xf222('0x77')][_0xf222('0x78')],'raw':!![]};var _0x476655=[];var _0x4cd922=[];return db[_0xf222('0x79')][_0xf222('0x7a')](_0x31ef1a[_0xf222('0x7b')](),_0x54d24e)[_0xf222('0x62')](function(_0x384beb){_0x5e14f1=_[_0xf222('0x7c')](_0x384beb,'id');_0x54d24e=_[_0xf222('0x7d')](_0x54d24e,{'model':db[_0x105768],'mapToModel':!![],'nest':!![]});if(_0x4e8209[_0xf222('0x63')]){_0x4e7d09[_0xf222('0x7e')][_0xf222('0x58')](function(_0x4c5e4a){_0x3d45c0[_0xf222('0xa')]('i.'+_0x4c5e4a);});}else{_0x3d45c0[_0xf222('0xa')](_0xf222('0x7f'),_0xf222('0x44'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x80'),'Account.key');_0x3d45c0[_0xf222('0xa')]('a.mandatoryDisposition',_0xf222('0x81'));if(_0x2a278e===_0xf222('0x33')){_0x3d45c0[_0xf222('0xa')](_0xf222('0x82'),_0xf222('0x83'));_0x3d45c0['field'](_0xf222('0x84'),_0xf222('0x85'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x86'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x87'));_0x3d45c0[_0xf222('0xa')]('i.updatedAt');_0x3d45c0[_0xf222('0xa')](_0xf222('0x88'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x89'));_0x3d45c0[_0xf222('0xa')]('i.attach');_0x3d45c0[_0xf222('0xa')](_0xf222('0x8a'));_0x3d45c0['field'](_0xf222('0x8b'));_0x3d45c0[_0xf222('0xa')]('i.subject');_0x3d45c0[_0xf222('0xa')](_0xf222('0x6d'));_0x3d45c0['field'](_0xf222('0x6c'));_0x3d45c0['field'](_0xf222('0x6b'));_0x3d45c0['field'](_0xf222('0x70'));_0x3d45c0['field']('i.to');_0x3d45c0[_0xf222('0xa')](_0xf222('0x8c'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x8d'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x8e'));}else if(_0x2a278e===_0xf222('0x8f')){_0x3d45c0[_0xf222('0xa')](_0xf222('0x90'),_0xf222('0x85'));}else{_0x3d45c0[_0xf222('0xa')](_0xf222('0x91'),_0xf222('0x85'));}if(_0x2a278e!=='mail'){_0x3d45c0['field']('i.*');}_0x3d45c0[_0xf222('0xa')](_0xf222('0x92'),'Contact.firstName');_0x3d45c0[_0xf222('0xa')](_0xf222('0x93'),_0xf222('0x94'));_0x3d45c0[_0xf222('0xa')]('c.email',_0xf222('0x95'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x96'),_0xf222('0x97'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x98'),_0xf222('0x99'));_0x3d45c0[_0xf222('0xa')]('c.fax',_0xf222('0x9a'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x9b'),_0xf222('0x9c'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x9d'),_0xf222('0x9e'));_0x3d45c0[_0xf222('0xa')](_0xf222('0x9f'),_0xf222('0xa0'));}if(_0x4e7d09[_0xf222('0xa1')]){_0x3d45c0[_0xf222('0xa1')](_0x4e7d09[_0xf222('0xa1')]);}if(_0x4e7d09[_0xf222('0xa2')]){_0x3d45c0[_0xf222('0xa2')](_0x4e7d09[_0xf222('0xa2')]);}return db[_0xf222('0x79')][_0xf222('0x7a')](_0x3d45c0[_0xf222('0x7b')](),_0x54d24e);})[_0xf222('0x62')](function(_0x3ff83f){_0x476655=_0x3ff83f;var _0x5708cb=getUsersQuery(_0x2a278e,_0x476655);return db[_0xf222('0x79')]['query'](_0x5708cb['toString'](),_0x54d24e);})[_0xf222('0x62')](function(_0x429de1){_0x4cd922=_['groupBy'](_0x429de1,_0x215896);if(_0x2a278e===_0xf222('0x33')){return db['Setting'][_0xf222('0xa3')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xf222('0x62')](function(_0x6fbe81){var _0x422aee=_0x6fbe81?_0x6fbe81[_0xf222('0xa4')]:undefined;var _0x158be7=_0x476655[_0xf222('0x19')](function(_0x529a3e){return updateInteraction(_0x529a3e,_0x5e14f1,_0x4cd922,_0x422aee);});return Promise[_0xf222('0xa5')](_0x158be7);});}function countFilteredInteractions(_0x3eb500,_0x5021d9){var _0x303013=_0x3eb500[_0xf222('0xa6')]();_0x303013['field'](_0xf222('0xa7'));_0x303013[_0xf222('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf222('0x44'));var _0x146fa4=utils[_0xf222('0x26')](_0x5021d9);if(!_[_0xf222('0xa8')](_0x146fa4)){_0x303013[_0xf222('0x16')](_0xf222('0xa9'),_0x146fa4);}var _0x19eff2={'type':db['Sequelize'][_0xf222('0x77')][_0xf222('0x78')],'raw':!![]};return db['sequelize'][_0xf222('0x7a')](_0x303013[_0xf222('0x7b')](),_0x19eff2);}module[_0xf222('0xaa')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 61132bf..7245e0b 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 _0x20a5=['out','plainBody','-id','then','lastMsgText','updateInteraction','Users','TagIds','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','disposition','UserId','total','MailMessage'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x20a5,0x18f));var _0x520a=function(_0x27a417,_0x5041ab){_0x27a417=_0x27a417-0x0;var _0x4462db=_0x20a5[_0x27a417];return _0x4462db;};'use strict';var _=require(_0x520a('0x0'));var db=require(_0x520a('0x1'))['db'];function getInteractionUsers(_0x498ad3,_0x242336){return new Promise(function(_0x4b2d8b,_0x1d8e8c){try{var _0x3edb07=[];if(_0x242336[_0x498ad3]){_0x3edb07=_0x242336[_0x498ad3][_0x520a('0x2')](function(_0x49c1dd){return{'id':_0x49c1dd['id'],'fullname':_0x49c1dd['fullname']};});}return _0x4b2d8b(_0x3edb07);}catch(_0x56daa7){_0x1d8e8c(_0x56daa7);}});}function getInteractionTags(_0x573982,_0x325dae){var _0x223f16=[];if(_0x573982){_0x573982[_0x520a('0x3')](',')[_0x520a('0x4')](function(_0x7eade8){_0x223f16[_0x520a('0x5')](_0x325dae[_0x7eade8]);});}return _0x223f16;}function updateWaitingCounter(_0x4296ac){if(_0x4296ac[_0x520a('0x6')]){_0x4296ac[_0x520a('0x6')]-=0x1;}}function updateInteractionCounters(_0x4c785b){_0x4c785b[_0x520a('0x6')]=0x0;_0x4c785b[_0x520a('0x7')]=0x0;_0x4c785b[_0x520a('0x8')]=0x0;_0x4c785b[_0x520a('0x9')]=0x0;_0x4c785b[_0x520a('0xa')]=0x0;_0x4c785b['total']=0x0;if(_0x4c785b['closed']){if(_0x4c785b[_0x520a('0xb')]===_0x520a('0xa')){_0x4c785b['abandoned']+=0x1;updateWaitingCounter(_0x4c785b);}if(_0x4c785b[_0x520a('0xc')]){_0x4c785b[_0x520a('0x8')]+=0x1;if(_0x4c785b[_0x520a('0x7')]){_0x4c785b[_0x520a('0x7')]-=0x1;}}else{if(_0x4c785b[_0x520a('0xb')]){_0x4c785b['unmanaged']+=0x1;updateWaitingCounter(_0x4c785b);}}}else{if(!_0x4c785b[_0x520a('0xc')]){_0x4c785b['waiting']+=0x1;}if(_0x4c785b[_0x520a('0xc')]){_0x4c785b[_0x520a('0x7')]+=0x1;updateWaitingCounter(_0x4c785b);}}_0x4c785b[_0x520a('0xd')]+=0x1;return _0x4c785b;}function getLastMessageText(_0x16eeb5){return db[_0x520a('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x16eeb5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x520a('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x520a('0x10')],'order':_0x520a('0x11'),'raw':!![]})[_0x520a('0x12')](function(_0x527ba1){if(_0x527ba1&&_0x527ba1['plainBody']){_0x16eeb5[_0x520a('0x13')]=_['trimStart'](_0x527ba1[_0x520a('0x10')]);}return _0x16eeb5;})['catch'](function(_0x4f0f95){throw _0x4f0f95;});}exports[_0x520a('0x14')]=function(_0x3039d1,_0x149e6f,_0x2e100,_0x228dd7){return new Promise(function(_0x45dc63,_0x2851b4){return getInteractionUsers(_0x3039d1['id'],_0x2e100)[_0x520a('0x12')](function(_0x525ed4){_0x3039d1[_0x520a('0x15')]=_0x525ed4;return getInteractionTags(_0x3039d1[_0x520a('0x16')],_0x149e6f);})['then'](function(_0x1490bf){_0x3039d1['Tags']=_0x1490bf;delete _0x3039d1[_0x520a('0x16')];return updateInteractionCounters(_0x3039d1);})[_0x520a('0x12')](function(_0x48b2e6){if(_0x228dd7){return getLastMessageText(_0x48b2e6);}else{return _0x48b2e6;}})[_0x520a('0x12')](function(_0x195e04){_0x45dc63(_0x195e04);})['catch'](function(_0x5afdd3){_0x2851b4(_0x5afdd3);});});}; \ No newline at end of file +var _0xd888=['disposition','UserId','MailMessage','findOne','out','-id','then','plainBody','catch','Users','TagIds','Tags','lodash','map','waiting','talking','answered','unmanaged','abandoned','total'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd888,0x160));var _0x8d88=function(_0x596f3f,_0x53c5bf){_0x596f3f=_0x596f3f-0x0;var _0x2c1225=_0xd888[_0x596f3f];return _0x2c1225;};'use strict';var _=require(_0x8d88('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x1f6ce0,_0x18c4f8){return new Promise(function(_0x57b8d3,_0x22f518){try{var _0x22359a=[];if(_0x18c4f8[_0x1f6ce0]){_0x22359a=_0x18c4f8[_0x1f6ce0][_0x8d88('0x1')](function(_0x328961){return{'id':_0x328961['id'],'fullname':_0x328961['fullname']};});}return _0x57b8d3(_0x22359a);}catch(_0x5996e1){_0x22f518(_0x5996e1);}});}function getInteractionTags(_0x30b439,_0x884037){var _0x56ccb4=[];if(_0x30b439){_0x30b439['split'](',')['forEach'](function(_0x54e410){_0x56ccb4['push'](_0x884037[_0x54e410]);});}return _0x56ccb4;}function updateWaitingCounter(_0x484642){if(_0x484642[_0x8d88('0x2')]){_0x484642[_0x8d88('0x2')]-=0x1;}}function updateInteractionCounters(_0x2b3d05){_0x2b3d05[_0x8d88('0x2')]=0x0;_0x2b3d05[_0x8d88('0x3')]=0x0;_0x2b3d05[_0x8d88('0x4')]=0x0;_0x2b3d05[_0x8d88('0x5')]=0x0;_0x2b3d05[_0x8d88('0x6')]=0x0;_0x2b3d05[_0x8d88('0x7')]=0x0;if(_0x2b3d05['closed']){if(_0x2b3d05[_0x8d88('0x8')]===_0x8d88('0x6')){_0x2b3d05[_0x8d88('0x6')]+=0x1;updateWaitingCounter(_0x2b3d05);}if(_0x2b3d05[_0x8d88('0x9')]){_0x2b3d05[_0x8d88('0x4')]+=0x1;if(_0x2b3d05[_0x8d88('0x3')]){_0x2b3d05[_0x8d88('0x3')]-=0x1;}}else{if(_0x2b3d05[_0x8d88('0x8')]){_0x2b3d05[_0x8d88('0x5')]+=0x1;updateWaitingCounter(_0x2b3d05);}}}else{if(!_0x2b3d05[_0x8d88('0x9')]){_0x2b3d05['waiting']+=0x1;}if(_0x2b3d05[_0x8d88('0x9')]){_0x2b3d05[_0x8d88('0x3')]+=0x1;updateWaitingCounter(_0x2b3d05);}}_0x2b3d05[_0x8d88('0x7')]+=0x1;return _0x2b3d05;}function getLastMessageText(_0x22af57){return db[_0x8d88('0xa')][_0x8d88('0xb')]({'where':{'$and':[{'MailInteractionId':_0x22af57['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8d88('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x8d88('0xd'),'raw':!![]})[_0x8d88('0xe')](function(_0x5da18c){if(_0x5da18c&&_0x5da18c[_0x8d88('0xf')]){_0x22af57['lastMsgText']=_['trimStart'](_0x5da18c[_0x8d88('0xf')]);}return _0x22af57;})[_0x8d88('0x10')](function(_0x5c480c){throw _0x5c480c;});}exports['updateInteraction']=function(_0x1bc2b3,_0x35a877,_0x225439,_0xccc2de){return new Promise(function(_0x5e8ca3,_0x11705d){return getInteractionUsers(_0x1bc2b3['id'],_0x225439)[_0x8d88('0xe')](function(_0x10722c){_0x1bc2b3[_0x8d88('0x11')]=_0x10722c;return getInteractionTags(_0x1bc2b3[_0x8d88('0x12')],_0x35a877);})[_0x8d88('0xe')](function(_0x474fa0){_0x1bc2b3[_0x8d88('0x13')]=_0x474fa0;delete _0x1bc2b3[_0x8d88('0x12')];return updateInteractionCounters(_0x1bc2b3);})[_0x8d88('0xe')](function(_0xfb11d3){if(_0xccc2de){return getLastMessageText(_0xfb11d3);}else{return _0xfb11d3;}})[_0x8d88('0xe')](function(_0x823172){_0x5e8ca3(_0x823172);})[_0x8d88('0x10')](function(_0x40a6fb){_0x11705d(_0x40a6fb);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 89b1147..2ce9314 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 _0x63d7=['exports','lodash','../../mysqldb','../../config/logger','sms-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','update','info','catch','error'];(function(_0x905059,_0x72fadc){var _0x1141e3=function(_0x584ef3){while(--_0x584ef3){_0x905059['push'](_0x905059['shift']());}};_0x1141e3(++_0x72fadc);}(_0x63d7,0x8d));var _0x763d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x63d7[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x763d('0x0'));var db=require(_0x763d('0x1'))['db'];var loggers={'openchannel':require(_0x763d('0x2'))('openchannel-interactions'),'mail':require(_0x763d('0x2'))('mail-interactions'),'fax':require(_0x763d('0x2'))('fax-interactions'),'sms':require(_0x763d('0x2'))(_0x763d('0x3')),'chat':require(_0x763d('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x763d('0x4'))};function getAccountFK(_0x1e026d){return _[_0x763d('0x5')](_0x1e026d)+(_0x1e026d==='chat'?_0x763d('0x6'):_0x763d('0x7'))+'Id';}function getInteractionFK(_0xda1e53){return _[_0x763d('0x5')](_0xda1e53)+_0x763d('0x8');}function getInteractionId(_0x4dd689,_0x3ac1d9,_0x7067a){if(_0x4dd689&&_0x4dd689[_[_0x763d('0x9')](_0x7067a)+_0x763d('0x8')]){return _0x4dd689[_[_0x763d('0x9')](_0x7067a)+_0x763d('0x8')];}else if(_0x4dd689&&_0x4dd689['id']){return _0x4dd689['id'];}else if(_0x3ac1d9&&_0x3ac1d9['id']){return _0x3ac1d9['id'];}else{return'unknown';}}function getInteractionsTables(_0x2edcc5){return{'accounts':_0x2edcc5+'_'+(_0x2edcc5==='chat'?'websites':'accounts'),'interactions':_0x2edcc5+_0x763d('0xa'),'interactionsTags':_0x2edcc5+_0x763d('0xb'),'messages':_0x2edcc5+_0x763d('0xc'),'userInteractions':'user_has_'+_0x2edcc5+_0x763d('0xa')};}function getSelectedTags(_0x1d9f83){var _0x3c0eaa=[];if(_0x1d9f83){_0x3c0eaa=Array[_0x763d('0xd')](_0x1d9f83)?_0x1d9f83:[_0x1d9f83];}return _0x3c0eaa;}function log(_0x25813e,_0x289834,_0x1dcf46,_0x115ca5,_0x475f81,_0x92aea0){loggers[_0x475f81[_0x763d('0xe')]()][_0x25813e](_0x763d('0xf'),_0x92aea0[_0x763d('0x10')](),_0x289834?_0x289834['id']:null,_0x289834?_0x289834[_0x763d('0x11')]:null,_0x289834?_0x289834[_0x763d('0x12')]:null,getInteractionId(_0x1dcf46,_0x115ca5,_0x475f81),_0x1dcf46?JSON[_0x763d('0x13')](_0x1dcf46):_0x763d('0x14'));}function updateUser(_0x2911e0,_0x1ae5f2,_0x5ac3df,_0xc2fbae,_0x3617a0){db[_['upperFirst'](_0xc2fbae)+_0x763d('0x15')]['findOne']({'where':{'id':getInteractionId(_0x1ae5f2,_0x5ac3df,_0xc2fbae)}})[_0x763d('0x16')](function(_0x2006dc){if(_0x2006dc){return _0x2006dc[_0x763d('0x17')]({'UserId':_0x2911e0?_0x2911e0['id']:null});}})[_0x763d('0x16')](function(_0xe1e060){if(_0xe1e060){log(_0x763d('0x18'),_0x2911e0,_0x1ae5f2,_0x5ac3df,_0xc2fbae,_0x3617a0);}})[_0x763d('0x19')](function(){log(_0x763d('0x1a'),_0x2911e0,_0x1ae5f2,_0x5ac3df,_0xc2fbae,_0x3617a0);});}module[_0x763d('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xa827=['Account','InteractionId','upperFirst','chat','accounts','_interactions','_interaction_has_tags','_messages','isArray','toUpperCase','name','stringify','null','findOne','then','info','catch','error','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website'];(function(_0x2607d9,_0x4b5eff){var _0x4d5087=function(_0x479eb3){while(--_0x479eb3){_0x2607d9['push'](_0x2607d9['shift']());}};_0x4d5087(++_0x4b5eff);}(_0xa827,0xc0));var _0x7a82=function(_0x14e705,_0x1fc1c2){_0x14e705=_0x14e705-0x0;var _0x28bf6b=_0xa827[_0x14e705];return _0x28bf6b;};'use strict';var _=require(_0x7a82('0x0'));var db=require(_0x7a82('0x1'))['db'];var loggers={'openchannel':require(_0x7a82('0x2'))(_0x7a82('0x3')),'mail':require('../../config/logger')(_0x7a82('0x4')),'fax':require(_0x7a82('0x2'))(_0x7a82('0x5')),'sms':require(_0x7a82('0x2'))(_0x7a82('0x6')),'chat':require(_0x7a82('0x2'))(_0x7a82('0x7')),'whatsapp':require(_0x7a82('0x2'))(_0x7a82('0x8'))};function getAccountFK(_0x4b2df4){return _[_0x7a82('0x9')](_0x4b2df4)+(_0x4b2df4==='chat'?_0x7a82('0xa'):_0x7a82('0xb'))+'Id';}function getInteractionFK(_0x5f3c16){return _['capitalize'](_0x5f3c16)+_0x7a82('0xc');}function getInteractionId(_0x376d00,_0x18366f,_0x5a3387){if(_0x376d00&&_0x376d00[_[_0x7a82('0xd')](_0x5a3387)+_0x7a82('0xc')]){return _0x376d00[_[_0x7a82('0xd')](_0x5a3387)+_0x7a82('0xc')];}else if(_0x376d00&&_0x376d00['id']){return _0x376d00['id'];}else if(_0x18366f&&_0x18366f['id']){return _0x18366f['id'];}else{return'unknown';}}function getInteractionsTables(_0x58355d){return{'accounts':_0x58355d+'_'+(_0x58355d===_0x7a82('0xe')?'websites':_0x7a82('0xf')),'interactions':_0x58355d+_0x7a82('0x10'),'interactionsTags':_0x58355d+_0x7a82('0x11'),'messages':_0x58355d+_0x7a82('0x12'),'userInteractions':'user_has_'+_0x58355d+'_interactions'};}function getSelectedTags(_0x342273){var _0x38f06a=[];if(_0x342273){_0x38f06a=Array[_0x7a82('0x13')](_0x342273)?_0x342273:[_0x342273];}return _0x38f06a;}function log(_0x430e49,_0xb72309,_0x14b0f3,_0x1b0135,_0x29cc9d,_0x483f77){loggers[_0x29cc9d['toLowerCase']()][_0x430e49]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x483f77[_0x7a82('0x14')](),_0xb72309?_0xb72309['id']:null,_0xb72309?_0xb72309[_0x7a82('0x15')]:null,_0xb72309?_0xb72309['role']:null,getInteractionId(_0x14b0f3,_0x1b0135,_0x29cc9d),_0x14b0f3?JSON[_0x7a82('0x16')](_0x14b0f3):_0x7a82('0x17'));}function updateUser(_0x70f40e,_0x3b5c27,_0x5661c4,_0x5aacfe,_0x4ff50b){db[_[_0x7a82('0xd')](_0x5aacfe)+'Interaction'][_0x7a82('0x18')]({'where':{'id':getInteractionId(_0x3b5c27,_0x5661c4,_0x5aacfe)}})['then'](function(_0x30c50e){if(_0x30c50e){return _0x30c50e['update']({'UserId':_0x70f40e?_0x70f40e['id']:null});}})[_0x7a82('0x19')](function(_0x49d815){if(_0x49d815){log(_0x7a82('0x1a'),_0x70f40e,_0x3b5c27,_0x5661c4,_0x5aacfe,_0x4ff50b);}})[_0x7a82('0x1b')](function(){log(_0x7a82('0x1c'),_0x70f40e,_0x3b5c27,_0x5661c4,_0x5aacfe,_0x4ff50b);});}module['exports']={'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 255839b..c5b9381 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 _0x9fe1=['data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','use','License','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb'];(function(_0x146b09,_0x345cd3){var _0x4e9e36=function(_0x1d9749){while(--_0x1d9749){_0x146b09['push'](_0x146b09['shift']());}};_0x4e9e36(++_0x345cd3);}(_0x9fe1,0xec));var _0x19fe=function(_0x315aaa,_0x4a34be){_0x315aaa=_0x315aaa-0x0;var _0x497b00=_0x9fe1[_0x315aaa];return _0x497b00;};'use strict';var crypto=require(_0x19fe('0x0'));var util=require(_0x19fe('0x1'));var compose=require(_0x19fe('0x2'));var db=require(_0x19fe('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3abe37,_0xd3451b){if(_0x3abe37&&_0xd3451b){if(_0xd3451b[_0x19fe('0x4')]&&_0xd3451b[_0x19fe('0x5')]){var _0x297436=_0xd3451b[_0x19fe('0x4')];var _0x402e58=_0xd3451b[_0x19fe('0x5')];var _0x349ada=_0x297436[_0x19fe('0x6')]('-')[0x4];var _0x2dd6c4=_0x297436['split']('-')[0x0];var _0x53821f=crypto[_0x19fe('0x7')](_0x19fe('0x8'),util[_0x19fe('0x9')](_0x19fe('0xa'),_0x349ada,_0x297436,_0x2dd6c4));var _0x12ed02=_0x53821f[_0x19fe('0xb')](_0x402e58,_0x19fe('0xc'),'utf8');_0x12ed02+=_0x53821f['final'](_0x19fe('0xd'));var _0x55f0ff=JSON[_0x19fe('0xe')](_0x12ed02);return _0x55f0ff['hasOwnProperty'](_0x3abe37)?_0x55f0ff[_0x3abe37]:null;}}return null;}function isLimit(_0x207902,_0x2204fb,_0x30212a,_0x570417){var _0x480844=_0x2204fb;return compose()[_0x19fe('0xf')](function(_0x1a14b9,_0xe3cd4b,_0x9a57e7){return db[_0x19fe('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x19fe('0x11')](function(_0x1953b3){var _0x2a12a2=getValueFromLicense(_0x207902,_0x1953b3);return _0x2a12a2?_0x2a12a2:_0x480844;})[_0x19fe('0x11')](function(_0x144926){_0x480844=_0x144926;return _0x30212a['count'](_0x570417);})['then'](function(_0x14cc7f){if(_0x14cc7f>=_0x480844){return _0xe3cd4b[_0x19fe('0x12')](0x193)['json']({'message':util[_0x19fe('0x9')](_0x19fe('0x13'),_0x207902)});}_0x9a57e7();})['catch'](function(_0x36fc66){_0x9a57e7(_0x36fc66);});});}function isUserLimit(){return isLimit(_0x19fe('0x14'),0x1,db[_0x19fe('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x19fe('0x16')}]}});}exports[_0x19fe('0x17')]=isUserLimit; \ No newline at end of file +var _0x9345=['crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','then','json','catch','users','User','admin','user','isUserLimit'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x9345,0x90));var _0x5934=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x9345[_0x305c31];return _0x17f39f;};'use strict';var crypto=require(_0x5934('0x0'));var util=require(_0x5934('0x1'));var compose=require(_0x5934('0x2'));var db=require(_0x5934('0x3'))['db'];var config=require(_0x5934('0x4'));function getValueFromLicense(_0x1f1119,_0x554f1b){if(_0x1f1119&&_0x554f1b){if(_0x554f1b[_0x5934('0x5')]&&_0x554f1b[_0x5934('0x6')]){var _0x34ed1e=_0x554f1b['data1'];var _0x9ecd87=_0x554f1b['license'];var _0xa980c4=_0x34ed1e[_0x5934('0x7')]('-')[0x4];var _0x154ac2=_0x34ed1e[_0x5934('0x7')]('-')[0x0];var _0x395805=crypto[_0x5934('0x8')](_0x5934('0x9'),util[_0x5934('0xa')](_0x5934('0xb'),_0xa980c4,_0x34ed1e,_0x154ac2));var _0x5db740=_0x395805[_0x5934('0xc')](_0x9ecd87,_0x5934('0xd'),_0x5934('0xe'));_0x5db740+=_0x395805['final'](_0x5934('0xe'));var _0x1e704e=JSON[_0x5934('0xf')](_0x5db740);return _0x1e704e['hasOwnProperty'](_0x1f1119)?_0x1e704e[_0x1f1119]:null;}}return null;}function isLimit(_0x535a17,_0x5712a0,_0x407238,_0x4e4323){var _0x20e5cd=_0x5712a0;return compose()['use'](function(_0x8cdf11,_0x3d0a64,_0x2ec17a){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5da765){var _0xb2647b=getValueFromLicense(_0x535a17,_0x5da765);return _0xb2647b?_0xb2647b:_0x20e5cd;})['then'](function(_0x2b9c15){_0x20e5cd=_0x2b9c15;return _0x407238['count'](_0x4e4323);})[_0x5934('0x10')](function(_0x24bd30){if(_0x24bd30>=_0x20e5cd){return _0x3d0a64['status'](0x193)[_0x5934('0x11')]({'message':util[_0x5934('0xa')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x535a17)});}_0x2ec17a();})[_0x5934('0x12')](function(_0x1f90a1){_0x2ec17a(_0x1f90a1);});});}function isUserLimit(){return isLimit(_0x5934('0x13'),0x1,db[_0x5934('0x14')],{'where':{'$or':[{'role':_0x5934('0x15')},{'role':_0x5934('0x16')}]}});}exports[_0x5934('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8431483..22fab71 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 _0xf3a0=['operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$notIn','start','shift','pop','utcOffset','hours','minutes','seconds','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','match','indexOf','conditions','push','buildExpression','DATE'];(function(_0x145cd9,_0x2fca5d){var _0x3b2e75=function(_0x16bcf2){while(--_0x16bcf2){_0x145cd9['push'](_0x145cd9['shift']());}};_0x3b2e75(++_0x2fca5d);}(_0xf3a0,0x197));var _0x0f3a=function(_0xd5584e,_0x251c06){_0xd5584e=_0xd5584e-0x0;var _0xdc594e=_0xf3a0[_0xd5584e];return _0xdc594e;};'use strict';var _=require('lodash');var moment=require(_0x0f3a('0x0'));exports['parseSearch']=function(_0x368534){var _0x22f815={'conditions':[]};_0x22f815[_0x0f3a('0x1')]=_[_0x0f3a('0x2')](_0x368534,_0x0f3a('0x3'))?'or':_0x0f3a('0x4');var _0x43177d=_0x368534[_0x0f3a('0x5')](_0x0f3a('0x6'),'')[_0x0f3a('0x5')](_0x0f3a('0x3'),'')[_0x0f3a('0x7')]('||');for(var _0x31bc4f=0x0;_0x31bc4f<_0x43177d[_0x0f3a('0x8')];_0x31bc4f++){var _0xf2b229=_0x43177d[_0x31bc4f][_0x0f3a('0x7')](':=');var _0x75e15d=_0xf2b229[0x0];var _0x1c2044=_0xf2b229[_0x0f3a('0x9')](0x1);_0x1c2044[_0x0f3a('0xa')](function(_0x51026d){var _0x57bb75=_0x51026d['split']('[')['shift']();var _0x5d4559=_0x51026d[_0x0f3a('0xb')](/\[(.*?)\]/g);_0x5d4559[_0x0f3a('0xa')](function(_0x23ffb1){var _0x2a2260=_0x23ffb1[_0x0f3a('0x7')]('[')['filter'](function(_0x43727e){return _0x43727e[_0x0f3a('0xc')](']')>-0x1;})['map'](function(_0x1d7880){return _0x1d7880[_0x0f3a('0x7')](']')[0x0];})[0x0];_0x22f815[_0x0f3a('0xd')][_0x0f3a('0xe')]({'field':_0x75e15d,'operator':_0x57bb75,'value':_0x2a2260});});});}return _0x22f815;};exports[_0x0f3a('0xf')]=function(_0x4c2092,_0x374101,_0x53928f){var _0x4aa1bf={};if(_0x374101===_0x0f3a('0x10')){if(_0x53928f[_0x0f3a('0x11')]===_0x0f3a('0x12')){_0x53928f[_0x0f3a('0x11')]=_0x0f3a('0x13');_0x53928f[_0x0f3a('0x14')]+=','+_0x53928f['value'];}else if(_[_0x0f3a('0x15')]([_0x0f3a('0x16'),_0x0f3a('0x17')],_0x53928f['operator'])){_0x53928f[_0x0f3a('0x14')]=moment(_0x53928f[_0x0f3a('0x14')])[_0x0f3a('0x18')](0x1,_0x0f3a('0x19'))[_0x0f3a('0x1a')](_0x0f3a('0x1b'));}}if(_0x53928f[_0x0f3a('0x1c')]){_0x374101=_0x53928f[_0x0f3a('0x1c')];_0x4aa1bf['text']=_0x0f3a('0x1d')+_0x4c2092+'.'+_0x53928f[_0x0f3a('0x1e')]+_0x0f3a('0x1f')+_0x53928f[_0x0f3a('0x1c')]+')\x20'+parseOperator(_0x53928f['operator']);}else{_0x4aa1bf[_0x0f3a('0x20')]=_0x4c2092+'.'+_0x53928f['field']+'\x20'+parseOperator(_0x53928f[_0x0f3a('0x11')]);}if(_['includes'](['$ne','$notIn'],_0x53928f[_0x0f3a('0x11')]))_0x4aa1bf[_0x0f3a('0x20')]='('+_0x4aa1bf['text']+_0x0f3a('0x21')+_0x4c2092+'.'+_0x53928f[_0x0f3a('0x1e')]+_0x0f3a('0x22');_0x4aa1bf['value']=parseValue(_0x374101,_0x53928f[_0x0f3a('0x11')],_0x53928f[_0x0f3a('0x14')]);return _0x4aa1bf;};function parseOperator(_0x5c0510){var _0x200ceb;switch(_0x5c0510){case _0x0f3a('0x23'):_0x200ceb=_0x0f3a('0x24');break;case'$notIn':_0x200ceb=_0x0f3a('0x25');break;case'$eq':_0x200ceb='=\x20?';break;case'$ne':_0x200ceb='<>\x20?';break;case _0x0f3a('0x26'):case _0x0f3a('0x27'):case _0x0f3a('0x28'):_0x200ceb='LIKE\x20?';break;case _0x0f3a('0x29'):_0x200ceb=_0x0f3a('0x2a');break;case _0x0f3a('0x16'):_0x200ceb='>\x20?';break;case _0x0f3a('0x17'):_0x200ceb='<=\x20?';break;case _0x0f3a('0x2b'):_0x200ceb='>=\x20?';break;case _0x0f3a('0x13'):_0x200ceb=_0x0f3a('0x2c');break;}return _0x200ceb;}function parseValue(_0x1a5048,_0x266d85,_0x5e3c70){var _0x516a1e={'start':undefined,'end':undefined};switch(_0x266d85){case'$in':case _0x0f3a('0x2d'):_0x516a1e['start']=_0x5e3c70[_0x0f3a('0x7')](',');break;case _0x0f3a('0x26'):_0x516a1e[_0x0f3a('0x2e')]='%'+_0x5e3c70+'%';break;case _0x0f3a('0x27'):_0x516a1e[_0x0f3a('0x2e')]=_0x5e3c70+'%';break;case'$endsWith':_0x516a1e[_0x0f3a('0x2e')]='%'+_0x5e3c70;break;case _0x0f3a('0x13'):var _0x464f73=_0x5e3c70[_0x0f3a('0x7')](',');var _0x5e3c70=_0x464f73[_0x0f3a('0x2f')]();var _0x1a588e=_0x464f73[_0x0f3a('0x30')]();if(_0x1a5048===_0x0f3a('0x10')){_0x5e3c70=moment(_0x5e3c70)['utcOffset'](0x0,!![])[_0x0f3a('0x1a')]();_0x1a588e=moment(_0x1a588e)[_0x0f3a('0x31')](0x0,!![])[_0x0f3a('0x18')](0x17,_0x0f3a('0x32'))[_0x0f3a('0x18')](0x3b,_0x0f3a('0x33'))['add'](0x3b,_0x0f3a('0x34'))[_0x0f3a('0x1a')]();}_0x516a1e={'start':_0x5e3c70,'end':_0x1a588e};break;default:_0x516a1e[_0x0f3a('0x2e')]=_0x5e3c70;break;}return _0x516a1e;} \ No newline at end of file +var _0x4d2c=['parseSearch','sqlOperator','replace','[$and]','[$or]','split','length','slice','forEach','shift','filter','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','lodash'];(function(_0x35474b,_0x4b7079){var _0x102c41=function(_0x12e5f4){while(--_0x12e5f4){_0x35474b['push'](_0x35474b['shift']());}};_0x102c41(++_0x4b7079);}(_0x4d2c,0x1d3));var _0xc4d2=function(_0x11e9a3,_0xabd526){_0x11e9a3=_0x11e9a3-0x0;var _0x573f45=_0x4d2c[_0x11e9a3];return _0x573f45;};'use strict';var _=require(_0xc4d2('0x0'));var moment=require('moment');exports[_0xc4d2('0x1')]=function(_0x596ae9){var _0x2b58c9={'conditions':[]};_0x2b58c9[_0xc4d2('0x2')]=_['startsWith'](_0x596ae9,'[$or]')?'or':'and';var _0xe61225=_0x596ae9[_0xc4d2('0x3')](_0xc4d2('0x4'),'')[_0xc4d2('0x3')](_0xc4d2('0x5'),'')[_0xc4d2('0x6')]('||');for(var _0xb4df5a=0x0;_0xb4df5a<_0xe61225[_0xc4d2('0x7')];_0xb4df5a++){var _0x2dd3c9=_0xe61225[_0xb4df5a][_0xc4d2('0x6')](':=');var _0x1a322f=_0x2dd3c9[0x0];var _0x1a51f1=_0x2dd3c9[_0xc4d2('0x8')](0x1);_0x1a51f1[_0xc4d2('0x9')](function(_0x478694){var _0x505011=_0x478694[_0xc4d2('0x6')]('[')[_0xc4d2('0xa')]();var _0x57907b=_0x478694['match'](/\[(.*?)\]/g);_0x57907b[_0xc4d2('0x9')](function(_0x5d8812){var _0x45f062=_0x5d8812['split']('[')[_0xc4d2('0xb')](function(_0x257444){return _0x257444['indexOf'](']')>-0x1;})[_0xc4d2('0xc')](function(_0x2b346e){return _0x2b346e[_0xc4d2('0x6')](']')[0x0];})[0x0];_0x2b58c9['conditions'][_0xc4d2('0xd')]({'field':_0x1a322f,'operator':_0x505011,'value':_0x45f062});});});}return _0x2b58c9;};exports[_0xc4d2('0xe')]=function(_0x55caae,_0x59cb39,_0x22031e){var _0x152c2b={};if(_0x59cb39===_0xc4d2('0xf')){if(_0x22031e[_0xc4d2('0x10')]===_0xc4d2('0x11')){_0x22031e['operator']=_0xc4d2('0x12');_0x22031e[_0xc4d2('0x13')]+=','+_0x22031e[_0xc4d2('0x13')];}else if(_[_0xc4d2('0x14')]([_0xc4d2('0x15'),_0xc4d2('0x16')],_0x22031e[_0xc4d2('0x10')])){_0x22031e[_0xc4d2('0x13')]=moment(_0x22031e[_0xc4d2('0x13')])[_0xc4d2('0x17')](0x1,_0xc4d2('0x18'))[_0xc4d2('0x19')](_0xc4d2('0x1a'));}}if(_0x22031e[_0xc4d2('0x1b')]){_0x59cb39=_0x22031e['castTo'];_0x152c2b[_0xc4d2('0x1c')]=_0xc4d2('0x1d')+_0x55caae+'.'+_0x22031e['field']+_0xc4d2('0x1e')+_0x22031e[_0xc4d2('0x1b')]+')\x20'+parseOperator(_0x22031e[_0xc4d2('0x10')]);}else{_0x152c2b[_0xc4d2('0x1c')]=_0x55caae+'.'+_0x22031e[_0xc4d2('0x1f')]+'\x20'+parseOperator(_0x22031e[_0xc4d2('0x10')]);}if(_[_0xc4d2('0x14')]([_0xc4d2('0x20'),_0xc4d2('0x21')],_0x22031e[_0xc4d2('0x10')]))_0x152c2b[_0xc4d2('0x1c')]='('+_0x152c2b[_0xc4d2('0x1c')]+_0xc4d2('0x22')+_0x55caae+'.'+_0x22031e['field']+_0xc4d2('0x23');_0x152c2b[_0xc4d2('0x13')]=parseValue(_0x59cb39,_0x22031e[_0xc4d2('0x10')],_0x22031e[_0xc4d2('0x13')]);return _0x152c2b;};function parseOperator(_0x5ab676){var _0x9907e;switch(_0x5ab676){case _0xc4d2('0x24'):_0x9907e='IN\x20?';break;case'$notIn':_0x9907e='NOT\x20IN\x20?';break;case _0xc4d2('0x11'):_0x9907e='=\x20?';break;case _0xc4d2('0x20'):_0x9907e=_0xc4d2('0x25');break;case'$substring':case _0xc4d2('0x26'):case'$endsWith':_0x9907e=_0xc4d2('0x27');break;case _0xc4d2('0x28'):_0x9907e=_0xc4d2('0x29');break;case'$gt':_0x9907e=_0xc4d2('0x2a');break;case _0xc4d2('0x16'):_0x9907e=_0xc4d2('0x2b');break;case _0xc4d2('0x2c'):_0x9907e=_0xc4d2('0x2d');break;case _0xc4d2('0x12'):_0x9907e=_0xc4d2('0x2e');break;}return _0x9907e;}function parseValue(_0x4825b0,_0x350eb4,_0x933b31){var _0x4a3fde={'start':undefined,'end':undefined};switch(_0x350eb4){case _0xc4d2('0x24'):case'$notIn':_0x4a3fde['start']=_0x933b31[_0xc4d2('0x6')](',');break;case'$substring':_0x4a3fde[_0xc4d2('0x2f')]='%'+_0x933b31+'%';break;case _0xc4d2('0x26'):_0x4a3fde[_0xc4d2('0x2f')]=_0x933b31+'%';break;case'$endsWith':_0x4a3fde[_0xc4d2('0x2f')]='%'+_0x933b31;break;case'$between':var _0x1cd31f=_0x933b31[_0xc4d2('0x6')](',');var _0x933b31=_0x1cd31f[_0xc4d2('0xa')]();var _0x21733e=_0x1cd31f[_0xc4d2('0x30')]();if(_0x4825b0===_0xc4d2('0xf')){_0x933b31=moment(_0x933b31)[_0xc4d2('0x31')](0x0,!![])['format']();_0x21733e=moment(_0x21733e)[_0xc4d2('0x31')](0x0,!![])[_0xc4d2('0x17')](0x17,'hours')[_0xc4d2('0x17')](0x3b,_0xc4d2('0x32'))[_0xc4d2('0x17')](0x3b,_0xc4d2('0x33'))[_0xc4d2('0x19')]();}_0x4a3fde={'start':_0x933b31,'end':_0x21733e};break;default:_0x4a3fde[_0xc4d2('0x2f')]=_0x933b31;break;}return _0x4a3fde;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 653a3ff..fe39fe8 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 _0x31f0=['lodash','moment','parse','includes','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','limit','offset','sort','map','indexOf','priority','cast','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','keys','intersection','attributes','nolimit','order','where','filter','object','columns','merge','VIRTUAL','lower','col','options'];(function(_0x463593,_0x1f1075){var _0x1ac811=function(_0x2ea869){while(--_0x2ea869){_0x463593['push'](_0x463593['shift']());}};_0x1ac811(++_0x1f1075);}(_0x31f0,0xb7));var _0x031f=function(_0x4cd025,_0x199bea){_0x4cd025=_0x4cd025-0x0;var _0x328432=_0x31f0[_0x4cd025];return _0x328432;};'use strict';var _=require(_0x031f('0x0'));var sequelize=require('sequelize');var moment=require(_0x031f('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x50a1ab){var _0x3747a5=['ne'];try{var _0x2021ea=JSON[_0x031f('0x2')](_0x50a1ab);var _0xf20620=Object['keys'](_0x2021ea)[0x0];return _0x3747a5[_0x031f('0x3')](_0xf20620);}catch(_0x1a63ba){return![];}}function getOperatorValue(_0x4f6059){var _0x4c0f94=JSON['parse'](_0x4f6059);var _0x3dc98e=Object['keys'](_0x4c0f94)[0x0];var _0x365f59=_0x4c0f94[_0x3dc98e];return{['$'+_0x3dc98e]:_0x365f59};}exports[_0x031f('0x4')]=function(_0x2569b6){var _0x3e41ed=null;if(_0x2569b6){_0x3e41ed=_0x2569b6['split'](',');}return _0x3e41ed;};exports[_0x031f('0x5')]=function(_0x24145f,_0x327f11){var _0x439940={};if(!_[_0x031f('0x6')](_0x24145f)){_[_0x031f('0x7')](_0x24145f,function(_0x2202dc,_0x3fd541){try{if(_0x327f11){var _0x4df318=_[_0x031f('0x8')](_0x327f11,{'name':_0x3fd541})||{};if(hasSequelizeOperator(_0x2202dc)){_0x439940[_0x3fd541]=getOperatorValue(_0x2202dc);}else if(_0x4df318[_0x031f('0x9')]===_0x031f('0xa')&&_[_0x031f('0xb')](_0x2202dc)){var _0x3819bb=JSON[_0x031f('0x2')](_0x2202dc);var _0x1c230d={'$gte':moment(moment(_0x3819bb['$gte'])[_0x031f('0xc')](_0x031f('0xd')))[_0x031f('0xe')]()[_0x031f('0xc')](),'$lte':moment(moment(_0x3819bb[_0x031f('0xf')])['format']('YYYY-MM-DD'))[_0x031f('0xe')]()[_0x031f('0x10')](0x1,'s')[_0x031f('0xc')]()};_0x439940[_0x3fd541]=_0x1c230d;}else if(_0x4df318[_0x031f('0x11')]==='uniqueid'){_0x439940[_0x3fd541]=_0x2202dc;}else{_0x439940[_0x3fd541]=_[_0x031f('0x12')](_0x2202dc)?_0x2202dc:JSON[_0x031f('0x2')](_0x2202dc);}}else{_0x439940[_0x3fd541]=_['isArray'](_0x2202dc)?_0x2202dc:JSON[_0x031f('0x2')](_0x2202dc);}}catch(_0x535e70){_0x439940[_0x3fd541]=_0x2202dc[_0x031f('0x13')](',');}});}return _0x439940;};exports[_0x031f('0x14')]=function(_0x563bc8){_0x563bc8=parseInt(_0x563bc8,0xa);if(!_0x563bc8||_0x563bc8<0x0){_0x563bc8=LIMIT_VALUE;}return _0x563bc8;};exports[_0x031f('0x15')]=function(_0x1ceddc){_0x1ceddc=parseInt(_0x1ceddc,0xa);if(!_0x1ceddc||_0x1ceddc<0x0){_0x1ceddc=0x0;}return _0x1ceddc;};exports[_0x031f('0x16')]=function(_0x1b76d6){var _0x2825ef,_0xf76f1b=null;if(_0x1b76d6){_0x2825ef=_0x1b76d6[_0x031f('0x13')](',');_0xf76f1b=_[_0x031f('0x17')](_0x2825ef,function(_0x48a76e){if(_0x48a76e[_0x031f('0x18')]('-')===0x0){return[_0x48a76e===_0x031f('0x19')?sequelize[_0x031f('0x1a')](sequelize['col']('priority'),_0x031f('0x1b')):_0x48a76e['substr'](0x1),_0x031f('0x1c')];}else{return[_0x48a76e==='priority'?sequelize['cast'](sequelize['col'](_0x031f('0x19')),_0x031f('0x1b')):_0x48a76e,_0x031f('0x1d')];}});}return _0xf76f1b;};exports[_0x031f('0x1e')]=function(_0x494568,_0x374b65){if(_['isEmpty'](_0x494568)){return _0x494568;}if(_[_0x031f('0x12')](_0x494568)){for(var _0x1f5a14=0x0;_0x1f5a14<_0x494568[_0x031f('0x1f')];_0x1f5a14+=0x1){_0x494568[_0x1f5a14]=this['omit'](_0x494568[_0x1f5a14],_0x374b65);}return _0x494568;}if(!_[_0x031f('0x20')](_0x494568)){return _0x494568;}if(_[_0x031f('0x21')](_0x374b65)){_0x374b65=[_0x374b65];}if(!_['isArray'](_0x374b65)){return _0x494568;}for(var _0x3847b2=0x0;_0x3847b2<_0x374b65[_0x031f('0x1f')];_0x3847b2+=0x1){_[_0x031f('0x22')](_0x494568,_0x374b65[_0x3847b2]);}for(var _0x5395ea in _0x494568){if(_0x494568[_0x031f('0x23')](_0x5395ea)){_0x494568[_0x5395ea]=this[_0x031f('0x1e')](_0x494568[_0x5395ea],_0x374b65);}}return _0x494568;};exports[_0x031f('0x24')]=function(_0xaf5bea){return _0xaf5bea[_0x031f('0x25')](RegExp(_0x031f('0x26')))?!![]:![];};exports['isEmail']=function(_0x1f62eb){return _0x1f62eb[_0x031f('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x031f('0x27')]=function(_0x2ea861){var _0x428ec4=[];_0x2ea861[_0x031f('0x13')](/[ ,]+/)[_0x031f('0x28')](function(_0x87dc07){_0x87dc07=_0x87dc07[_0x031f('0x29')](/([^:]")"+/g,'$1');_0x87dc07='+'+_0x87dc07+'*';var _0xfc4a89=/[ `!@#$%^&*()_\-?~]/;if(_0x87dc07[_0x031f('0x25')](_0xfc4a89))_0x87dc07='\x22'+_0x87dc07+'\x22';_0x428ec4['push'](_0x87dc07);});return _0x428ec4[_0x031f('0x2a')]('\x20');};exports[_0x031f('0x2b')]=function(_0xb3a6bd,_0x2f2616,_0x25a637){var _0xb774cf={},_0x106994={};if(_0x2f2616[_0x031f('0x2c')][_0x031f('0x2d')]){_0x2f2616[_0x031f('0x2c')]['id']=_0x2f2616[_0x031f('0x2c')][_0x031f('0x2d')];delete _0x2f2616[_0x031f('0x2c')]['$id'];}_0xb774cf[_0x031f('0x2e')]=_[_0x031f('0x17')](_0xb3a6bd,'name');_0xb774cf[_0x031f('0x2c')]=_[_0x031f('0x2f')](_0x2f2616['query']);_0xb774cf[_0x031f('0x5')]=_[_0x031f('0x30')](_0xb774cf[_0x031f('0x2e')],_0xb774cf[_0x031f('0x2c')]);_0x106994['attributes']=_['intersection'](_0xb774cf[_0x031f('0x2e')],this['fields'](_0x2f2616[_0x031f('0x2c')][_0x031f('0x4')]));_0x106994[_0x031f('0x31')]=_0x106994['attributes']['length']?_0x106994[_0x031f('0x31')]:_0xb774cf['model'];if(!_0x2f2616['query'][_0x031f('0x23')](_0x031f('0x32'))){_0x106994[_0x031f('0x14')]=this[_0x031f('0x14')](_0x2f2616[_0x031f('0x2c')][_0x031f('0x14')]);_0x106994[_0x031f('0x15')]=this['offset'](_0x2f2616[_0x031f('0x2c')][_0x031f('0x15')]);}_0x106994[_0x031f('0x33')]=this[_0x031f('0x16')](_0x2f2616['query'][_0x031f('0x16')]);_0x106994[_0x031f('0x34')]=this[_0x031f('0x5')](_['pick'](_0x2f2616[_0x031f('0x2c')],_0xb774cf[_0x031f('0x5')]),_0xb3a6bd);if(_0x2f2616['query'][_0x031f('0x35')]){var _0x268dc7=_0xb3a6bd;var _0x56a8f3=_0x2f2616['query'][_0x031f('0x35')];if(typeof _0x56a8f3===_0x031f('0x36')){_0x268dc7=_[_0x031f('0x35')](_0xb3a6bd,function(_0x46885f){return _[_0x031f('0x3')](_0x56a8f3[_0x031f('0x37')],_0x46885f[_0x031f('0x11')]);});_0x56a8f3=_0x56a8f3['value'];}_0x106994[_0x031f('0x34')]=_[_0x031f('0x38')](_0x106994['where'],{'$or':_[_0x031f('0x17')](_0x268dc7,function(_0x505e93){if(_0x505e93[_0x031f('0x9')]!==_0x031f('0x39')){if(_0x25a637){return sequelize['where'](sequelize['fn'](_0x031f('0x3a'),sequelize[_0x031f('0x3b')](_0x505e93[_0x031f('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x2f2616[_0x031f('0x2c')][_0x031f('0x35')]+'%')});}else{var _0x1d3324={};_0x1d3324[_0x505e93[_0x031f('0x11')]]={'$like':'%'+_0x2f2616[_0x031f('0x2c')][_0x031f('0x35')]+'%'};return _0x1d3324;}}})});}_0x106994=_[_0x031f('0x38')]({},_0x106994,_0x2f2616[_0x031f('0x3c')]);return _0x106994;}; \ No newline at end of file +var _0x5075=['subtract','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','isEmpty','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','push','getOptions','query','$id','model','attributes','intersection','length','hasOwnProperty','nolimit','order','where','pick','filter','object','columns','value','merge','type','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','filters','forOwn','find','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte'];(function(_0x32b977,_0x4f457f){var _0x3f1ab5=function(_0x4a685){while(--_0x4a685){_0x32b977['push'](_0x32b977['shift']());}};_0x3f1ab5(++_0x4f457f);}(_0x5075,0x73));var _0x5507=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x5075[_0x18e52b];return _0x3d3062;};'use strict';var _=require(_0x5507('0x0'));var sequelize=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1a552a){var _0x3ec62f=['ne'];try{var _0x2b444e=JSON[_0x5507('0x3')](_0x1a552a);var _0x518ca7=Object[_0x5507('0x4')](_0x2b444e)[0x0];return _0x3ec62f[_0x5507('0x5')](_0x518ca7);}catch(_0x8fb8a3){return![];}}function getOperatorValue(_0x54267f){var _0x5b6d7f=JSON[_0x5507('0x3')](_0x54267f);var _0x773559=Object['keys'](_0x5b6d7f)[0x0];var _0x42c232=_0x5b6d7f[_0x773559];return{['$'+_0x773559]:_0x42c232};}exports[_0x5507('0x6')]=function(_0xbf4b50){var _0x504e05=null;if(_0xbf4b50){_0x504e05=_0xbf4b50['split'](',');}return _0x504e05;};exports[_0x5507('0x7')]=function(_0x441bdc,_0xbbb0fc){var _0x36c9eb={};if(!_['isEmpty'](_0x441bdc)){_[_0x5507('0x8')](_0x441bdc,function(_0x1a6792,_0x55520e){try{if(_0xbbb0fc){var _0x18601c=_[_0x5507('0x9')](_0xbbb0fc,{'name':_0x55520e})||{};if(hasSequelizeOperator(_0x1a6792)){_0x36c9eb[_0x55520e]=getOperatorValue(_0x1a6792);}else if(_0x18601c['type']===_0x5507('0xa')&&_[_0x5507('0xb')](_0x1a6792)){var _0x32c872=JSON[_0x5507('0x3')](_0x1a6792);var _0x13b60a={'$gte':moment(moment(_0x32c872[_0x5507('0xc')])['format'](_0x5507('0xd')))[_0x5507('0xe')]()[_0x5507('0xf')](),'$lte':moment(moment(_0x32c872[_0x5507('0x10')])['format'](_0x5507('0xd')))[_0x5507('0xe')]()[_0x5507('0x11')](0x1,'s')[_0x5507('0xf')]()};_0x36c9eb[_0x55520e]=_0x13b60a;}else if(_0x18601c[_0x5507('0x12')]===_0x5507('0x13')){_0x36c9eb[_0x55520e]=_0x1a6792;}else{_0x36c9eb[_0x55520e]=_[_0x5507('0x14')](_0x1a6792)?_0x1a6792:JSON[_0x5507('0x3')](_0x1a6792);}}else{_0x36c9eb[_0x55520e]=_[_0x5507('0x14')](_0x1a6792)?_0x1a6792:JSON[_0x5507('0x3')](_0x1a6792);}}catch(_0x233b6a){_0x36c9eb[_0x55520e]=_0x1a6792[_0x5507('0x15')](',');}});}return _0x36c9eb;};exports[_0x5507('0x16')]=function(_0x5ad6d7){_0x5ad6d7=parseInt(_0x5ad6d7,0xa);if(!_0x5ad6d7||_0x5ad6d7<0x0){_0x5ad6d7=LIMIT_VALUE;}return _0x5ad6d7;};exports[_0x5507('0x17')]=function(_0x276a81){_0x276a81=parseInt(_0x276a81,0xa);if(!_0x276a81||_0x276a81<0x0){_0x276a81=0x0;}return _0x276a81;};exports[_0x5507('0x18')]=function(_0x193eda){var _0x54f473,_0x1dc53e=null;if(_0x193eda){_0x54f473=_0x193eda[_0x5507('0x15')](',');_0x1dc53e=_[_0x5507('0x19')](_0x54f473,function(_0x3ca1f7){if(_0x3ca1f7[_0x5507('0x1a')]('-')===0x0){return[_0x3ca1f7===_0x5507('0x1b')?sequelize['cast'](sequelize[_0x5507('0x1c')](_0x5507('0x1b')),_0x5507('0x1d')):_0x3ca1f7[_0x5507('0x1e')](0x1),_0x5507('0x1f')];}else{return[_0x3ca1f7===_0x5507('0x1b')?sequelize[_0x5507('0x20')](sequelize[_0x5507('0x1c')](_0x5507('0x1b')),_0x5507('0x1d')):_0x3ca1f7,_0x5507('0x21')];}});}return _0x1dc53e;};exports[_0x5507('0x22')]=function(_0x164ac7,_0x2ee6ed){if(_[_0x5507('0x23')](_0x164ac7)){return _0x164ac7;}if(_['isArray'](_0x164ac7)){for(var _0x4e8906=0x0;_0x4e8906<_0x164ac7['length'];_0x4e8906+=0x1){_0x164ac7[_0x4e8906]=this[_0x5507('0x22')](_0x164ac7[_0x4e8906],_0x2ee6ed);}return _0x164ac7;}if(!_['isObject'](_0x164ac7)){return _0x164ac7;}if(_[_0x5507('0x24')](_0x2ee6ed)){_0x2ee6ed=[_0x2ee6ed];}if(!_[_0x5507('0x14')](_0x2ee6ed)){return _0x164ac7;}for(var _0x4beb0a=0x0;_0x4beb0a<_0x2ee6ed['length'];_0x4beb0a+=0x1){_[_0x5507('0x25')](_0x164ac7,_0x2ee6ed[_0x4beb0a]);}for(var _0x1a18d0 in _0x164ac7){if(_0x164ac7['hasOwnProperty'](_0x1a18d0)){_0x164ac7[_0x1a18d0]=this[_0x5507('0x22')](_0x164ac7[_0x1a18d0],_0x2ee6ed);}}return _0x164ac7;};exports[_0x5507('0x26')]=function(_0x85d383){return _0x85d383[_0x5507('0x27')](RegExp(_0x5507('0x28')))?!![]:![];};exports[_0x5507('0x29')]=function(_0x55e889){return _0x55e889[_0x5507('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x5507('0x2a')]=function(_0x106b11){var _0x38f0f5=[];_0x106b11[_0x5507('0x15')](/[ ,]+/)['forEach'](function(_0x51e692){_0x51e692=_0x51e692[_0x5507('0x2b')](/([^:]")"+/g,'$1');_0x51e692='+'+_0x51e692+'*';var _0x37c364=/[ `!@#$%^&*()_\-?~]/;if(_0x51e692[_0x5507('0x27')](_0x37c364))_0x51e692='\x22'+_0x51e692+'\x22';_0x38f0f5[_0x5507('0x2c')](_0x51e692);});return _0x38f0f5['join']('\x20');};exports[_0x5507('0x2d')]=function(_0x13b6e5,_0xab91bc,_0x3fe39a){var _0x3cf04d={},_0x2074a={};if(_0xab91bc[_0x5507('0x2e')][_0x5507('0x2f')]){_0xab91bc['query']['id']=_0xab91bc[_0x5507('0x2e')][_0x5507('0x2f')];delete _0xab91bc[_0x5507('0x2e')]['$id'];}_0x3cf04d['model']=_[_0x5507('0x19')](_0x13b6e5,_0x5507('0x12'));_0x3cf04d[_0x5507('0x2e')]=_[_0x5507('0x4')](_0xab91bc[_0x5507('0x2e')]);_0x3cf04d['filters']=_['intersection'](_0x3cf04d[_0x5507('0x30')],_0x3cf04d[_0x5507('0x2e')]);_0x2074a[_0x5507('0x31')]=_[_0x5507('0x32')](_0x3cf04d['model'],this['fields'](_0xab91bc[_0x5507('0x2e')]['fields']));_0x2074a[_0x5507('0x31')]=_0x2074a[_0x5507('0x31')][_0x5507('0x33')]?_0x2074a[_0x5507('0x31')]:_0x3cf04d[_0x5507('0x30')];if(!_0xab91bc[_0x5507('0x2e')][_0x5507('0x34')](_0x5507('0x35'))){_0x2074a[_0x5507('0x16')]=this[_0x5507('0x16')](_0xab91bc['query']['limit']);_0x2074a['offset']=this['offset'](_0xab91bc[_0x5507('0x2e')][_0x5507('0x17')]);}_0x2074a[_0x5507('0x36')]=this[_0x5507('0x18')](_0xab91bc[_0x5507('0x2e')][_0x5507('0x18')]);_0x2074a[_0x5507('0x37')]=this[_0x5507('0x7')](_[_0x5507('0x38')](_0xab91bc[_0x5507('0x2e')],_0x3cf04d[_0x5507('0x7')]),_0x13b6e5);if(_0xab91bc[_0x5507('0x2e')][_0x5507('0x39')]){var _0x4418de=_0x13b6e5;var _0x4fe79b=_0xab91bc['query']['filter'];if(typeof _0x4fe79b===_0x5507('0x3a')){_0x4418de=_[_0x5507('0x39')](_0x13b6e5,function(_0x417022){return _[_0x5507('0x5')](_0x4fe79b[_0x5507('0x3b')],_0x417022[_0x5507('0x12')]);});_0x4fe79b=_0x4fe79b[_0x5507('0x3c')];}_0x2074a[_0x5507('0x37')]=_[_0x5507('0x3d')](_0x2074a[_0x5507('0x37')],{'$or':_[_0x5507('0x19')](_0x4418de,function(_0x192a00){if(_0x192a00[_0x5507('0x3e')]!==_0x5507('0x3f')){if(_0x3fe39a){return sequelize[_0x5507('0x37')](sequelize['fn'](_0x5507('0x40'),sequelize[_0x5507('0x1c')](_0x192a00[_0x5507('0x12')])),{'$like':sequelize['fn'](_0x5507('0x40'),'%'+_0xab91bc['query'][_0x5507('0x39')]+'%')});}else{var _0x113f74={};_0x113f74[_0x192a00['name']]={'$like':'%'+_0xab91bc['query'][_0x5507('0x39')]+'%'};return _0x113f74;}}})});}_0x2074a=_[_0x5507('0x3d')]({},_0x2074a,_0xab91bc[_0x5507('0x41')]);return _0x2074a;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 9f3da6b..64ef870 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 _0xd0be=['startCase','Queue','map','findOne','getAgents','all','flatten','uniq','includes','getAgentIdsByStatus','resolve','User','findAll','name','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','fullname','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray'];(function(_0x501f10,_0x20e827){var _0x1af6f8=function(_0x5924cf){while(--_0x5924cf){_0x501f10['push'](_0x501f10['shift']());}};_0x1af6f8(++_0x20e827);}(_0xd0be,0xff));var _0xed0b=function(_0x5f4585,_0x287c9f){_0x5f4585=_0x5f4585-0x0;var _0x32b347=_0xd0be[_0x5f4585];return _0x32b347;};'use strict';var _=require(_0xed0b('0x0'));var jayson=require(_0xed0b('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xed0b('0x2')][_0xed0b('0x3')]({'port':0x232a});var routingClient=jayson[_0xed0b('0x2')][_0xed0b('0x3')]({'port':0x232c});function isAgentPaused(_0x3095d6,_0x46e617){var _0xa71752=[_0x3095d6[_0xed0b('0x4')],_0x3095d6['faxPause'],_0x3095d6[_0xed0b('0x5')],_0x3095d6[_0xed0b('0x6')],_0x3095d6[_0xed0b('0x7')],_0x3095d6[_0xed0b('0x8')],_0x3095d6[_0xed0b('0x9')]];if(!_0x46e617)return _[_0xed0b('0xa')](_0xa71752);var _0x343d08=_[_0xed0b('0xb')](_0xa71752);return _0x343d08[_0xed0b('0xc')]>0x0&&_0x343d08[_0xed0b('0xc')]<_0xa71752[_0xed0b('0xc')]?!![]:![];}function isIdle(_0x1addb7){return _0x1addb7===_0xed0b('0xd')||_0x1addb7===_0xed0b('0xe')||_0x1addb7===_0xed0b('0xf')||_0x1addb7===_0xed0b('0x10')||_['isNil'](_0x1addb7);}function isAgentIdle(_0x51f734){if(_0x51f734[_0xed0b('0x11')]!==_0xed0b('0xd')&&_0x51f734[_0xed0b('0x8')]){_0x51f734[_0xed0b('0x11')]=_0xed0b('0x12');return![];}return _[_0xed0b('0xa')]([_0x51f734[_0xed0b('0x13')],_0x51f734[_0xed0b('0x14')],_0x51f734['mailStatus'],_0x51f734[_0xed0b('0x15')],_0x51f734[_0xed0b('0x16')],_0x51f734[_0xed0b('0x11')],_0x51f734[_0xed0b('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xed0b('0x18')](_0xed0b('0x19'),{})['then'](function(_0x30c174){if(_0x30c174[_0xed0b('0x1a')]){throw new Error(_0xed0b('0x1b'));}var _0xfa1502=_0x30c174[_0xed0b('0x1c')];return routingClient[_0xed0b('0x18')](_0xed0b('0x19'),{})[_0xed0b('0x1d')](function(_0x3e8a16){if(_0x3e8a16[_0xed0b('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0xdcd6b8=_0x3e8a16['result'];return _['merge']({},_0xfa1502,_0xdcd6b8);});})[_0xed0b('0x1e')](function(_0x4ce558){throw _0x4ce558;});}exports[_0xed0b('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x8a626d){var _0x68e1de=_0xed0b('0xe');if(isAgentPaused(_0x8a626d))_0x68e1de='pause';else if(isAgentPaused(_0x8a626d,!![]))_0x68e1de=_0xed0b('0x20');else if(isAgentIdle(_0x8a626d))_0x68e1de=_0xed0b('0xd');else _0x68e1de=_0xed0b('0x21');return _0x68e1de;}exports[_0xed0b('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x1920c8,_0x46f1ef){var _0x4d5533=_[_0xed0b('0x23')](_0x1920c8)?_0x1920c8:[_0x1920c8];var _0x50bd81=_[_0xed0b('0x24')](_0x46f1ef)+_0xed0b('0x25');var _0x22b10b=_[_0xed0b('0x26')](_0x4d5533,function(_0x5d6dfb){return db[_0x50bd81][_0xed0b('0x27')]({'where':{'id':_0x5d6dfb}})[_0xed0b('0x1d')](function(_0x41a939){if(!_0x41a939)return[];return _0x41a939[_0xed0b('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xed0b('0x29')](_0x22b10b)[_0xed0b('0x1d')](function(_0x498475){var _0x2de7d3=_(_0x498475)[_0xed0b('0x2a')]()[_0xed0b('0x26')]('id')[_0xed0b('0x2b')]()['value']();return _0x2de7d3;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x20d6a1,_0x21c2d8,_0xbb500c){try{if(_0x21c2d8[_0xed0b('0xc')]>0x0){_0x20d6a1=_0x20d6a1[_0xed0b('0xb')](function(_0x3c2d00){return _0x21c2d8[_0xed0b('0x2c')](_0x3c2d00['id']);});}var _0x39ab4f=_0x20d6a1['filter'](function(_0x179ea8){var _0x1a1e9e='busy';if(isAgentIdle(_0x179ea8)){_0x1a1e9e=_0xed0b('0xd');}return _0x1a1e9e===_0xbb500c;});return _[_0xed0b('0x26')](_0x39ab4f,'id');}catch(_0x174461){throw _0x174461;}}exports[_0xed0b('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1f4ce3,_0x5087ab,_0x385979){return Promise[_0xed0b('0x2e')]()[_0xed0b('0x1d')](function(){if(_0x5087ab[_0xed0b('0xc')]>0x0){_0x1f4ce3=_0x1f4ce3[_0xed0b('0xb')](function(_0x16d9fd){return _0x5087ab[_0xed0b('0x2c')](_0x16d9fd['id']);});}return _0x1f4ce3;})[_0xed0b('0x1d')](function(){return db[_0xed0b('0x2f')][_0xed0b('0x30')]({'attributes':['id',_0xed0b('0x31'),'fullname',_0xed0b('0x4'),'faxPause','mailPause',_0xed0b('0x6'),'smsPause','voicePause',_0xed0b('0x9'),'pauseType'],'where':{'id':{'$in':_['map'](_0x1f4ce3,'id')}},'raw':!![]});})[_0xed0b('0x1d')](function(_0x2730d6){return _0x2730d6[_0xed0b('0x26')](function(_0x4287a7){var _0x5a992e=_[_0xed0b('0x32')](_0x1f4ce3,['id',_0x4287a7['id']]);var _0x2f63fa=filterAgentAttributes(_0x5a992e);_['merge'](_0x4287a7,_0x2f63fa);_0x4287a7[_0xed0b('0x33')]=getAgentStatus(_0x4287a7);return _0x4287a7;});})[_0xed0b('0x1d')](function(_0x38de22){var _0x560476=sortAgentsByStatus(_0x38de22,_0x385979);return _[_0xed0b('0x26')](_0x560476,'id');})['catch'](function(_0x219315){throw _0x219315;});}exports[_0xed0b('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x41c16b){var _0x5be4c2={'fields':[],'order':null};var _0x3e1c10=_0x41c16b[_0xed0b('0x35')](',');_0x5be4c2[_0xed0b('0x36')]=_[_0xed0b('0xb')](_0x3e1c10,function(_0x1bc8fe){if(!_0x1bc8fe[_0xed0b('0x2c')]('globalStatus')){return!![];}_0x5be4c2[_0xed0b('0x37')]=_['startsWith'](_0x1bc8fe,'-')?_0xed0b('0x38'):_0xed0b('0x39');return![];});return _0x5be4c2;}exports[_0xed0b('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x2af187){if(_0x2af187['includes']('fullname')&&!_0x2af187[_0xed0b('0x2c')](_0xed0b('0x3b'))){var _0x16e47d=_0x2af187[_0xed0b('0x3c')](0x0,_0x2af187[_0xed0b('0x3d')](_0xed0b('0x3e')));_0x2af187+=','+_0x16e47d+_0xed0b('0x3b');}return _0x2af187;}exports[_0xed0b('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x3cc6f5,_0x2640a5){var _0x47b1cb=_0x3cc6f5[_0xed0b('0x40')](function(_0x5818ed,_0x4c58a1){if(_0x5818ed[_0xed0b('0x33')]===_0x4c58a1[_0xed0b('0x33')]){if(_0x5818ed[_0xed0b('0x33')]===_0xed0b('0x12')){if(_0x2640a5===_0xed0b('0x38')){return(_0x5818ed[_0xed0b('0x41')]||'')<(_0x4c58a1[_0xed0b('0x41')]||'')||_0x5818ed[_0xed0b('0x3e')][_0xed0b('0x42')]()>_0x4c58a1[_0xed0b('0x3e')][_0xed0b('0x42')]()?0x1:-0x1;}else{return(_0x5818ed['pauseType']||'')<(_0x4c58a1[_0xed0b('0x41')]||'')||_0x5818ed[_0xed0b('0x3e')][_0xed0b('0x42')]()>_0x4c58a1[_0xed0b('0x3e')][_0xed0b('0x42')]()?-0x1:0x1;}}else{if(_0x2640a5===_0xed0b('0x38')){return _0x5818ed['fullname'][_0xed0b('0x42')]()<_0x4c58a1[_0xed0b('0x3e')][_0xed0b('0x42')]()?0x1:-0x1;}else{return _0x5818ed[_0xed0b('0x3e')][_0xed0b('0x42')]()<_0x4c58a1['fullname'][_0xed0b('0x42')]()?-0x1:0x1;}}}else{if(_0x2640a5===_0xed0b('0x38')){return _0x5818ed[_0xed0b('0x33')]<_0x4c58a1['globalStatus']?0x1:-0x1;}else{return _0x5818ed['globalStatus']<_0x4c58a1[_0xed0b('0x33')]?-0x1:0x1;}}});return _0x47b1cb;}exports[_0xed0b('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x401da6){var _0x76da62=[_0xed0b('0x44'),_0xed0b('0x45'),_0xed0b('0x46'),_0xed0b('0x47'),_0xed0b('0x41'),_0xed0b('0x47'),'internal',_0xed0b('0x48'),'chatPause','openchannelPause','mailPause',_0xed0b('0x7'),'whatsappPause',_0xed0b('0x49'),_0xed0b('0x8'),_0xed0b('0x4a'),_0xed0b('0x4b'),_0xed0b('0x4c'),_0xed0b('0x4d'),_0xed0b('0x4e'),'faxCapacity',_0xed0b('0x4f'),_0xed0b('0x50'),_0xed0b('0x51'),_0xed0b('0x52'),_0xed0b('0x53'),_0xed0b('0x54'),_0xed0b('0x13'),_0xed0b('0x15'),'mailStatus',_0xed0b('0x16'),_0xed0b('0x17'),_0xed0b('0x14'),'voiceStatus','chatStatusTime',_0xed0b('0x55'),_0xed0b('0x56'),_0xed0b('0x57'),'whatsappStatusTime','faxStatusTime','voiceStatusTime',_0xed0b('0x58'),_0xed0b('0x59'),_0xed0b('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0xed0b('0x5b'),_0xed0b('0x5c')];var _0x57e6c7=[_0xed0b('0x4'),_0xed0b('0x6'),_0xed0b('0x5'),'smsPause','whatsappPause',_0xed0b('0x49'),'voicePause',_0xed0b('0x45')];var _0x2fa953=_(_0x401da6)[_0xed0b('0x5d')](_0x57e6c7)[_0xed0b('0x5e')](_0x76da62)[_0xed0b('0x5f')]();return _0x2fa953;}exports[_0xed0b('0x60')]=filterAgentAttributes; \ No newline at end of file +var _0x2444=['../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','filter','length','idle','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','unknown','*pause','busy','getAgentStatus','startCase','Queue','findOne','all','flatten','map','value','resolve','includes','User','findAll','name','fullname','smsPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','userpic','online','lastPauseAt','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x2444,0x1c1));var _0x4244=function(_0x47dcde,_0x533a84){_0x47dcde=_0x47dcde-0x0;var _0xb203c0=_0x2444[_0x47dcde];return _0xb203c0;};'use strict';var _=require(_0x4244('0x0'));var jayson=require('jayson/promise');var db=require(_0x4244('0x1'))['db'];var amiClient=jayson['client'][_0x4244('0x2')]({'port':0x232a});var routingClient=jayson[_0x4244('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x161a86,_0x2e29f9){var _0x3e23f6=[_0x161a86[_0x4244('0x4')],_0x161a86[_0x4244('0x5')],_0x161a86[_0x4244('0x6')],_0x161a86[_0x4244('0x7')],_0x161a86['smsPause'],_0x161a86[_0x4244('0x8')],_0x161a86[_0x4244('0x9')]];if(!_0x2e29f9)return _['every'](_0x3e23f6);var _0x5f40ed=_[_0x4244('0xa')](_0x3e23f6);return _0x5f40ed['length']>0x0&&_0x5f40ed[_0x4244('0xb')]<_0x3e23f6[_0x4244('0xb')]?!![]:![];}function isIdle(_0x99081f){return _0x99081f===_0x4244('0xc')||_0x99081f==='unknown'||_0x99081f==='unavailable'||_0x99081f==='ringing'||_[_0x4244('0xd')](_0x99081f);}function isAgentIdle(_0x46bd82){if(_0x46bd82['voiceStatus']!==_0x4244('0xc')&&_0x46bd82[_0x4244('0x8')]){_0x46bd82[_0x4244('0xe')]=_0x4244('0xf');return![];}return _['every']([_0x46bd82[_0x4244('0x10')],_0x46bd82[_0x4244('0x11')],_0x46bd82[_0x4244('0x12')],_0x46bd82[_0x4244('0x13')],_0x46bd82[_0x4244('0x14')],_0x46bd82['voiceStatus'],_0x46bd82[_0x4244('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4244('0x16')](_0x4244('0x17'),{})[_0x4244('0x18')](function(_0x22a8a1){if(_0x22a8a1['error']){throw new Error(_0x4244('0x19'));}var _0x201ad9=_0x22a8a1[_0x4244('0x1a')];return routingClient[_0x4244('0x16')]('Agents',{})[_0x4244('0x18')](function(_0x19c0f0){if(_0x19c0f0[_0x4244('0x1b')]){throw new Error(_0x4244('0x1c'));}var _0x8f9e3f=_0x19c0f0[_0x4244('0x1a')];return _[_0x4244('0x1d')]({},_0x201ad9,_0x8f9e3f);});})[_0x4244('0x1e')](function(_0x30f3a6){throw _0x30f3a6;});}exports[_0x4244('0x1f')]=getRealtimeAgents;function getAgentStatus(_0xbd7889){var _0x349b10=_0x4244('0x20');if(isAgentPaused(_0xbd7889))_0x349b10=_0x4244('0xf');else if(isAgentPaused(_0xbd7889,!![]))_0x349b10=_0x4244('0x21');else if(isAgentIdle(_0xbd7889))_0x349b10=_0x4244('0xc');else _0x349b10=_0x4244('0x22');return _0x349b10;}exports[_0x4244('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x5183a5,_0x224c0d){var _0x3f95fb=_['isArray'](_0x5183a5)?_0x5183a5:[_0x5183a5];var _0x31fc54=_[_0x4244('0x24')](_0x224c0d)+_0x4244('0x25');var _0x6a284e=_['map'](_0x3f95fb,function(_0x1e50ce){return db[_0x31fc54][_0x4244('0x26')]({'where':{'id':_0x1e50ce}})['then'](function(_0x49708e){if(!_0x49708e)return[];return _0x49708e['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4244('0x27')](_0x6a284e)[_0x4244('0x18')](function(_0x255b1f){var _0x1309b5=_(_0x255b1f)[_0x4244('0x28')]()[_0x4244('0x29')]('id')['uniq']()[_0x4244('0x2a')]();return _0x1309b5;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x177aa2,_0x52fc59,_0x23dd55){try{if(_0x52fc59[_0x4244('0xb')]>0x0){_0x177aa2=_0x177aa2[_0x4244('0xa')](function(_0x1f1f27){return _0x52fc59['includes'](_0x1f1f27['id']);});}var _0x24a761=_0x177aa2[_0x4244('0xa')](function(_0x43cb61){var _0x5c9675=_0x4244('0x22');if(isAgentIdle(_0x43cb61)){_0x5c9675='idle';}return _0x5c9675===_0x23dd55;});return _['map'](_0x24a761,'id');}catch(_0x832db3){throw _0x832db3;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f3639,_0x416fc7,_0x2ab4c7){return Promise[_0x4244('0x2b')]()[_0x4244('0x18')](function(){if(_0x416fc7[_0x4244('0xb')]>0x0){_0x2f3639=_0x2f3639['filter'](function(_0x27a681){return _0x416fc7[_0x4244('0x2c')](_0x27a681['id']);});}return _0x2f3639;})[_0x4244('0x18')](function(){return db[_0x4244('0x2d')][_0x4244('0x2e')]({'attributes':['id',_0x4244('0x2f'),_0x4244('0x30'),_0x4244('0x4'),_0x4244('0x5'),_0x4244('0x6'),_0x4244('0x7'),_0x4244('0x31'),_0x4244('0x8'),_0x4244('0x9'),_0x4244('0x32')],'where':{'id':{'$in':_['map'](_0x2f3639,'id')}},'raw':!![]});})[_0x4244('0x18')](function(_0x5521c7){return _0x5521c7['map'](function(_0x56fa5c){var _0x5d2ad6=_[_0x4244('0x33')](_0x2f3639,['id',_0x56fa5c['id']]);var _0x5d46df=filterAgentAttributes(_0x5d2ad6);_[_0x4244('0x1d')](_0x56fa5c,_0x5d46df);_0x56fa5c[_0x4244('0x34')]=getAgentStatus(_0x56fa5c);return _0x56fa5c;});})[_0x4244('0x18')](function(_0x2e6bc9){var _0x1a73ae=sortAgentsByStatus(_0x2e6bc9,_0x2ab4c7);return _['map'](_0x1a73ae,'id');})[_0x4244('0x1e')](function(_0x253732){throw _0x253732;});}exports[_0x4244('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x11c0a9){var _0x535b58={'fields':[],'order':null};var _0x1b1fde=_0x11c0a9['split'](',');_0x535b58[_0x4244('0x36')]=_[_0x4244('0xa')](_0x1b1fde,function(_0x4174b1){if(!_0x4174b1['includes'](_0x4244('0x34'))){return!![];}_0x535b58[_0x4244('0x37')]=_[_0x4244('0x38')](_0x4174b1,'-')?_0x4244('0x39'):'ASC';return![];});return _0x535b58;}exports[_0x4244('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x39ab96){if(_0x39ab96[_0x4244('0x2c')]('fullname')&&!_0x39ab96[_0x4244('0x2c')](_0x4244('0x3b'))){var _0x45da7e=_0x39ab96[_0x4244('0x3c')](0x0,_0x39ab96[_0x4244('0x3d')]('fullname'));_0x39ab96+=','+_0x45da7e+_0x4244('0x3b');}return _0x39ab96;}exports[_0x4244('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x28ce2a,_0x4eefd6){var _0x217d18=_0x28ce2a[_0x4244('0x3f')](function(_0x4e672c,_0x3e6bb4){if(_0x4e672c[_0x4244('0x34')]===_0x3e6bb4[_0x4244('0x34')]){if(_0x4e672c[_0x4244('0x34')]===_0x4244('0xf')){if(_0x4eefd6===_0x4244('0x39')){return(_0x4e672c[_0x4244('0x32')]||'')<(_0x3e6bb4[_0x4244('0x32')]||'')||_0x4e672c['fullname'][_0x4244('0x40')]()>_0x3e6bb4[_0x4244('0x30')]['toLowerCase']()?0x1:-0x1;}else{return(_0x4e672c[_0x4244('0x32')]||'')<(_0x3e6bb4[_0x4244('0x32')]||'')||_0x4e672c[_0x4244('0x30')][_0x4244('0x40')]()>_0x3e6bb4[_0x4244('0x30')][_0x4244('0x40')]()?-0x1:0x1;}}else{if(_0x4eefd6===_0x4244('0x39')){return _0x4e672c[_0x4244('0x30')][_0x4244('0x40')]()<_0x3e6bb4['fullname'][_0x4244('0x40')]()?0x1:-0x1;}else{return _0x4e672c[_0x4244('0x30')]['toLowerCase']()<_0x3e6bb4[_0x4244('0x30')][_0x4244('0x40')]()?-0x1:0x1;}}}else{if(_0x4eefd6===_0x4244('0x39')){return _0x4e672c[_0x4244('0x34')]<_0x3e6bb4['globalStatus']?0x1:-0x1;}else{return _0x4e672c[_0x4244('0x34')]<_0x3e6bb4[_0x4244('0x34')]?-0x1:0x1;}}});return _0x217d18;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x383e97){var _0xdd04fe=[_0x4244('0x41'),_0x4244('0x42'),'lastLoginAt','lastPauseAt',_0x4244('0x32'),_0x4244('0x43'),_0x4244('0x3b'),'address','chatPause',_0x4244('0x7'),_0x4244('0x6'),_0x4244('0x31'),_0x4244('0x9'),_0x4244('0x5'),_0x4244('0x8'),_0x4244('0x44'),'openchannelCapacity','mailCapacity',_0x4244('0x45'),_0x4244('0x46'),_0x4244('0x47'),_0x4244('0x48'),_0x4244('0x49'),_0x4244('0x4a'),'smsCurrentCapacity',_0x4244('0x4b'),_0x4244('0x4c'),'chatStatus','openchannelStatus','mailStatus',_0x4244('0x14'),_0x4244('0x15'),_0x4244('0x11'),_0x4244('0xe'),'chatStatusTime',_0x4244('0x4d'),_0x4244('0x4e'),_0x4244('0x4f'),_0x4244('0x50'),_0x4244('0x51'),_0x4244('0x52'),'queue',_0x4244('0x53'),'screenrecording',_0x4244('0x54'),_0x4244('0x55'),_0x4244('0x56')];var _0x237eae=[_0x4244('0x4'),_0x4244('0x7'),'mailPause','smsPause','whatsappPause','faxPause','voicePause',_0x4244('0x42')];var _0x53b820=_(_0x383e97)[_0x4244('0x57')](_0x237eae)[_0x4244('0x58')](_0xdd04fe)[_0x4244('0x2a')]();return _0x53b820;}exports[_0x4244('0x59')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 9fe9856..466efe2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x2715cf,_0x517bb2){var _0x1bdcb8=function(_0x5dec7b){while(--_0x5dec7b){_0x2715cf['push'](_0x2715cf['shift']());}};_0x1bdcb8(++_0x517bb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a0c13d0..97382ba 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 _0xe92d=['family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','createHash','update','digest','hex','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe92d,0x82));var _0xde92=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe92d[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xde92('0x0'));var os=require('os');var crypto=require(_0xde92('0x1'));var machine=require(_0xde92('0x2'));var exec=require(_0xde92('0x3'))[_0xde92('0x4')];var config=require(_0xde92('0x5'));function getInterfaces(){var _0x5191d1=[];var _0x173525=os[_0xde92('0x6')]();var _0x590a82=_[_0xde92('0x7')](_[_0xde92('0x8')](_0x173525));for(var _0xb669b9=0x0;_0xb669b9<_0x590a82[_0xde92('0x9')];_0xb669b9++){var _0x29b118=_0x173525[_0x590a82[_0xb669b9]]['filter'](function(_0x4f5afe){return _0x4f5afe[_0xde92('0xa')]===_0xde92('0xb')&&_0x4f5afe[_0xde92('0xc')]===![];});_0x5191d1=_0x5191d1[_0xde92('0xd')](_0x29b118);}return _0x5191d1;}function getFirstInterface(){var _0x1cf708=_[_0xde92('0xe')](getInterfaces());return{'macAddress':_0x1cf708&&_0x1cf708['mac']?_0x1cf708['mac']:_0xde92('0xf'),'ipAddress':_0x1cf708&&_0x1cf708[_0xde92('0x10')]?_0x1cf708[_0xde92('0x10')]:_0xde92('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4370b7=_['orderBy'](os[_0xde92('0x12')]()[_0xde92('0x13')](function(_0x3da525){return _0x3da525[_0xde92('0x14')];}))[_0xde92('0x15')](':');return crypto[_0xde92('0x16')]('md5')[_0xde92('0x17')](_0x4370b7)[_0xde92('0x18')](_0xde92('0x19'));}exports['getUuid']=function(){var _0x398e01=os[_0xde92('0x1a')]();var _0x3828c8=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3828c8['test'](config[_0xde92('0x1b')])){return config['licenseToken'];}else if(_0x398e01==='win32'){return exec(_0xde92('0x1c'),{'encoding':_0xde92('0x1d')})['replace']('\x0d\x0a','');}else{var _0x5abff4=getFirstInterface();var _0x5d5d0b=getCPUhash();var _0x2410a4=_0x5d5d0b+'|'+os[_0xde92('0x1e')]()+'|'+_0x5abff4[_0xde92('0x1f')]+'|'+_0x5abff4[_0xde92('0x20')];var _0x4987a8=crypto[_0xde92('0x16')](_0xde92('0x21'))['update'](_0x2410a4)[_0xde92('0x18')]('hex');return _0x4987a8['substring'](0x0,0x8)+'-'+_0x4987a8[_0xde92('0x22')](0x8,0xc)+'-'+_0x4987a8[_0xde92('0x22')](0xc,0x10)+'-'+_0x4987a8[_0xde92('0x22')](0x10,0x14)+'-'+_0x4987a8[_0xde92('0x22')](0x14);}}; \ No newline at end of file +var _0xe4be=['join','createHash','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','ipAddress','md5','digest','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','model'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xe4be,0x1b3));var _0xee4b=function(_0xab6676,_0x28756e){_0xab6676=_0xab6676-0x0;var _0x1f0ddb=_0xe4be[_0xab6676];return _0x1f0ddb;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xee4b('0x0'));var machine=require(_0xee4b('0x1'));var exec=require(_0xee4b('0x2'))[_0xee4b('0x3')];var config=require(_0xee4b('0x4'));function getInterfaces(){var _0x3ce1dd=[];var _0x264da6=os[_0xee4b('0x5')]();var _0x3825cf=_[_0xee4b('0x6')](_[_0xee4b('0x7')](_0x264da6));for(var _0x3ebdbe=0x0;_0x3ebdbe<_0x3825cf[_0xee4b('0x8')];_0x3ebdbe++){var _0x2fcca8=_0x264da6[_0x3825cf[_0x3ebdbe]][_0xee4b('0x9')](function(_0x348143){return _0x348143[_0xee4b('0xa')]==='IPv4'&&_0x348143[_0xee4b('0xb')]===![];});_0x3ce1dd=_0x3ce1dd[_0xee4b('0xc')](_0x2fcca8);}return _0x3ce1dd;}function getFirstInterface(){var _0x548dce=_[_0xee4b('0xd')](getInterfaces());return{'macAddress':_0x548dce&&_0x548dce[_0xee4b('0xe')]?_0x548dce[_0xee4b('0xe')]:'00:00:00:00:00:00','ipAddress':_0x548dce&&_0x548dce[_0xee4b('0xf')]?_0x548dce[_0xee4b('0xf')]:_0xee4b('0x10')};}exports[_0xee4b('0x11')]=getFirstInterface;function getCPUhash(){var _0x1cdfcb=_['orderBy'](os[_0xee4b('0x12')]()['map'](function(_0xd34f05){return _0xd34f05[_0xee4b('0x13')];}))[_0xee4b('0x14')](':');return crypto[_0xee4b('0x15')]('md5')[_0xee4b('0x16')](_0x1cdfcb)['digest'](_0xee4b('0x17'));}exports[_0xee4b('0x18')]=function(){var _0x47404f=os[_0xee4b('0x19')]();var _0x43577c=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x43577c[_0xee4b('0x1a')](config[_0xee4b('0x1b')])){return config[_0xee4b('0x1b')];}else if(_0x47404f===_0xee4b('0x1c')){return exec(_0xee4b('0x1d'),{'encoding':'utf8'})[_0xee4b('0x1e')]('\x0d\x0a','');}else{var _0x55e16b=getFirstInterface();var _0x3adc0f=getCPUhash();var _0x1eb11c=_0x3adc0f+'|'+os['hostname']()+'|'+_0x55e16b['macAddress']+'|'+_0x55e16b[_0xee4b('0x1f')];var _0x29cfb2=crypto[_0xee4b('0x15')](_0xee4b('0x20'))[_0xee4b('0x16')](_0x1eb11c)[_0xee4b('0x21')](_0xee4b('0x17'));return _0x29cfb2[_0xee4b('0x22')](0x0,0x8)+'-'+_0x29cfb2['substring'](0x8,0xc)+'-'+_0x29cfb2[_0xee4b('0x22')](0xc,0x10)+'-'+_0x29cfb2[_0xee4b('0x22')](0x10,0x14)+'-'+_0x29cfb2['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 97c5606..9a7efd8 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 _0x736e=['bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','license','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x736e,0x1ec));var _0xe736=function(_0x33aa98,_0x36eb28){_0x33aa98=_0x33aa98-0x0;var _0xfbdd43=_0x736e[_0x33aa98];return _0xfbdd43;};'use strict';var util=require(_0xe736('0x0'));var moment=require('moment');var rp=require(_0xe736('0x1'));var BPromise=require(_0xe736('0x2'));var pkginfo=require(_0xe736('0x3'))(module,_0xe736('0x4'));var db=require(_0xe736('0x5'))['db'];var encryptor=require(_0xe736('0x6'));var hardware=require('./hardware');var logger=require('../logger')(_0xe736('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xa3f229){return new BPromise(function(_0x19ff20,_0x8c281f){var _0x1cbe0c=util['format'](_0xe736('0x8'),HOST,_0xa3f229,module[_0xe736('0x9')]['version']);if(oldToken){_0x1cbe0c=util[_0xe736('0xa')](_0xe736('0xb'),HOST,_0xa3f229,module[_0xe736('0x9')][_0xe736('0x4')],oldToken);}var _0x1db304={'uri':_0x1cbe0c,'method':_0xe736('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1db304)['then'](function(_0x45e654){_0x19ff20(_0x45e654);})[_0xe736('0xd')](function(_0x325fc2){_0x8c281f(_0x325fc2);});});}function manageLicense(_0x131d95,_0x1572b4){var _0x1e254d=_0x1572b4[_0xe736('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x1e254d[_0xe736('0xf')]!==_0x131d95&&!_0x1e254d[_0xe736('0x10')]){oldToken=_0x1e254d[_0xe736('0xf')];}httpRequest(_0x131d95)[_0xe736('0x11')](function(_0x188975){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x188975[_0xe736('0x12')]){isOldTokenSent=![];if(!_0x1e254d[_0xe736('0x7')]&&_0x1e254d[_0xe736('0x7')]!=_0x188975[_0xe736('0x7')]||_0x1e254d[_0xe736('0x7')]&&_0x1e254d[_0xe736('0x10')]){logger['info'](_0xe736('0x13'));}if(_0x1e254d[_0xe736('0x7')]&&!_0x1e254d['data2']&&_0x1e254d['license']!=_0x188975[_0xe736('0x7')]){logger['info'](_0xe736('0x14'));}if(_0x1e254d[_0xe736('0x7')]&&!_0x1e254d[_0xe736('0x10')]&&_0x1e254d[_0xe736('0x7')]==_0x188975[_0xe736('0x7')]){return _0x1572b4;}return _0x1572b4[_0xe736('0x15')]({'data1':_0x131d95,'data2':null,'license':_0x188975[_0xe736('0x7')]});}else{if(_0x188975[_0xe736('0x7')]||_0x1e254d['license']){if(!_0x1e254d['data2']){if(_0x1e254d[_0xe736('0xf')]==_0x131d95){GRAY_PERIOD_REASON=_0xe736('0x16');logger[_0xe736('0x17')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0xe736('0x17')](_0xe736('0x18'),_0x1e254d[_0xe736('0xf')],_0x131d95);}logger[_0xe736('0x17')](_0xe736('0x19'),GRAY_PERIOD_REASON[_0xe736('0x1a')](),moment()[_0xe736('0xa')](_0xe736('0x1b')));return _0x1572b4[_0xe736('0x15')]({'data2':encryptor['encryptString'](moment()[_0xe736('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xe736('0x1c')](_0x1e254d[_0xe736('0x10')]),_0xe736('0x1d'))>DAYS){logger[_0xe736('0x17')](_0xe736('0x1e'),moment()['format'](_0xe736('0x1b')));isOldTokenSent=![];return _0x1572b4[_0xe736('0x15')]({'data1':_0x131d95,'data2':null,'license':null});}}}else{if(_0x1e254d['data1']!=_0x131d95){logger[_0xe736('0x17')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1e254d[_0xe736('0xf')],_0x131d95);return _0x1572b4[_0xe736('0x15')]({'data1':_0x131d95,'data2':null,'license':null});}}}return _0x1572b4;})[_0xe736('0x11')](function(_0x3de553){_0x1572b4=_0x3de553;})[_0xe736('0xd')](function(_0x452d9a){logger['error'](_0x452d9a[_0xe736('0x1f')]);})[_0xe736('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xe736('0x21')](),_0x1572b4);},TIME);});}function defaultLicense(){var _0x48e5ec=hardware[_0xe736('0x21')]();if(_0x48e5ec){return db[_0xe736('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x48e5ec}})[_0xe736('0x23')](function(_0x485b4c,_0x21e252){logger[_0xe736('0x17')](_0xe736('0x24'),_0x48e5ec);manageLicense(_0x48e5ec,_0x485b4c);})[_0xe736('0xd')](function(_0x48d04e){logger[_0xe736('0x25')](_0x48d04e[_0xe736('0x1f')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x3b48=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','update','catch','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','bluebird','pkginfo','version','../../components/encryptor','license','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','get','data1','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info'];(function(_0x1d3cbd,_0x13464d){var _0x1eba93=function(_0x5da051){while(--_0x5da051){_0x1d3cbd['push'](_0x1d3cbd['shift']());}};_0x1eba93(++_0x13464d);}(_0x3b48,0x19f));var _0x83b4=function(_0x179698,_0x32199e){_0x179698=_0x179698-0x0;var _0x174bba=_0x3b48[_0x179698];return _0x174bba;};'use strict';var util=require(_0x83b4('0x0'));var moment=require(_0x83b4('0x1'));var rp=require('request-promise');var BPromise=require(_0x83b4('0x2'));var pkginfo=require(_0x83b4('0x3'))(module,_0x83b4('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x83b4('0x5'));var hardware=require('./hardware');var logger=require('../logger')(_0x83b4('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x11c42d){return new BPromise(function(_0x314ab0,_0x2b1139){var _0x2dbeef=util[_0x83b4('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x11c42d,module[_0x83b4('0x8')][_0x83b4('0x4')]);if(oldToken){_0x2dbeef=util['format'](_0x83b4('0x9'),HOST,_0x11c42d,module[_0x83b4('0x8')][_0x83b4('0x4')],oldToken);}var _0x636927={'uri':_0x2dbeef,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x636927)[_0x83b4('0xa')](function(_0x2fb333){_0x314ab0(_0x2fb333);})['catch'](function(_0x2e04a0){_0x2b1139(_0x2e04a0);});});}function manageLicense(_0x343cd5,_0x625e57){var _0x2f5f70=_0x625e57[_0x83b4('0xb')]({'plain':!![]});if(!isOldTokenSent&&_0x2f5f70[_0x83b4('0xc')]!==_0x343cd5&&!_0x2f5f70['data2']){oldToken=_0x2f5f70[_0x83b4('0xc')];}httpRequest(_0x343cd5)['then'](function(_0x5acff7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5acff7[_0x83b4('0xd')]){isOldTokenSent=![];if(!_0x2f5f70[_0x83b4('0x6')]&&_0x2f5f70[_0x83b4('0x6')]!=_0x5acff7[_0x83b4('0x6')]||_0x2f5f70[_0x83b4('0x6')]&&_0x2f5f70[_0x83b4('0xe')]){logger['info'](_0x83b4('0xf'));}if(_0x2f5f70[_0x83b4('0x6')]&&!_0x2f5f70[_0x83b4('0xe')]&&_0x2f5f70[_0x83b4('0x6')]!=_0x5acff7[_0x83b4('0x6')]){logger[_0x83b4('0x10')](_0x83b4('0x11'));}if(_0x2f5f70[_0x83b4('0x6')]&&!_0x2f5f70['data2']&&_0x2f5f70['license']==_0x5acff7[_0x83b4('0x6')]){return _0x625e57;}return _0x625e57['update']({'data1':_0x343cd5,'data2':null,'license':_0x5acff7[_0x83b4('0x6')]});}else{if(_0x5acff7[_0x83b4('0x6')]||_0x2f5f70[_0x83b4('0x6')]){if(!_0x2f5f70[_0x83b4('0xe')]){if(_0x2f5f70['data1']==_0x343cd5){GRAY_PERIOD_REASON=_0x83b4('0x12');logger[_0x83b4('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x83b4('0x10')](_0x83b4('0x13'),_0x2f5f70[_0x83b4('0xc')],_0x343cd5);}logger[_0x83b4('0x10')](_0x83b4('0x14'),GRAY_PERIOD_REASON[_0x83b4('0x15')](),moment()[_0x83b4('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x625e57['update']({'data2':encryptor[_0x83b4('0x16')](moment()['format'](_0x83b4('0x17')))});}else{if(moment()[_0x83b4('0x18')](encryptor[_0x83b4('0x19')](_0x2f5f70['data2']),_0x83b4('0x1a'))>DAYS){logger[_0x83b4('0x10')](_0x83b4('0x1b'),moment()[_0x83b4('0x7')](_0x83b4('0x17')));isOldTokenSent=![];return _0x625e57[_0x83b4('0x1c')]({'data1':_0x343cd5,'data2':null,'license':null});}}}else{if(_0x2f5f70[_0x83b4('0xc')]!=_0x343cd5){logger[_0x83b4('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2f5f70[_0x83b4('0xc')],_0x343cd5);return _0x625e57[_0x83b4('0x1c')]({'data1':_0x343cd5,'data2':null,'license':null});}}}return _0x625e57;})['then'](function(_0x230c63){_0x625e57=_0x230c63;})[_0x83b4('0x1d')](function(_0x22f845){logger['error'](_0x22f845['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x625e57);},TIME);});}function defaultLicense(){var _0xef045c=hardware['getUuid']();if(_0xef045c){return db[_0x83b4('0x1e')][_0x83b4('0x1f')]({'where':{'id':0x1},'defaults':{'data1':_0xef045c}})['spread'](function(_0x452add,_0x3ae7be){logger[_0x83b4('0x10')](_0x83b4('0x20'),_0xef045c);manageLicense(_0xef045c,_0x452add);})['catch'](function(_0x101aaf){logger[_0x83b4('0x21')](_0x101aaf[_0x83b4('0x22')]);});}}exports[_0x83b4('0x23')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5def9fc..0d7062e 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 _0xd2cc=['Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','gray','deadline','add','grayReason','disabled','message','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z'];(function(_0x1505df,_0xef3494){var _0x47fa3d=function(_0x4a36e1){while(--_0x4a36e1){_0x1505df['push'](_0x1505df['shift']());}};_0x47fa3d(++_0xef3494);}(_0xd2cc,0x179));var _0xcd2c=function(_0x395aa7,_0x21602b){_0x395aa7=_0x395aa7-0x0;var _0x2c15e7=_0xd2cc[_0x395aa7];return _0x2c15e7;};'use strict';var util=require(_0xcd2c('0x0'));var _=require(_0xcd2c('0x1'));var moment=require(_0xcd2c('0x2'));var BPromise=require(_0xcd2c('0x3'));var hardware=require(_0xcd2c('0x4'));var encryptor=require(_0xcd2c('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcd2c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcd2c('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcd2c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcd2c('0x8'),'machineUuid':hardware[_0xcd2c('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2a3db9){return new BPromise(function(_0x365487,_0x13e897){return db[_0xcd2c('0xa')][_0xcd2c('0xb')](_[_0xcd2c('0xc')](_0x2a3db9,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x47b7e5){return checkLicense(_0x47b7e5,null);})[_0xcd2c('0xd')](function(_0x3243cf){_0x365487(_0x3243cf);return;})[_0xcd2c('0xe')](function(_0x502da9){_0x13e897(_0x502da9);});});}function checkLicense(_0x116629,_0xdae232){if(!_0x116629){demoLicense['uuid']=_0x116629['data1'];return demoLicense;}try{var _0x234682=_0xdae232||_0x116629[_0xcd2c('0xf')];if(_[_0xcd2c('0x10')](_0x234682)){throw new Error(_0xcd2c('0x11'));}var _0x27a83e=_0x116629[_0xcd2c('0x12')];var _0x3b2288=_0x116629[_0xcd2c('0x13')];var _0x42d852=_0x27a83e[_0xcd2c('0x14')]('-')[0x4];var _0x39f794=_0x27a83e[_0xcd2c('0x14')]('-')[0x0];var _0x222dcd=encryptor['decryptString'](_0x234682,util['format'](_0xcd2c('0x15'),_0x42d852,_0x27a83e,_0x39f794));var _0xe9ed3b=JSON[_0xcd2c('0x16')](_0x222dcd);_0xe9ed3b[_0xcd2c('0x17')]=![];_0xe9ed3b[_0xcd2c('0x18')]=_0x27a83e;_0xe9ed3b[_0xcd2c('0x19')]=hardware[_0xcd2c('0x9')]();if(_0x3b2288){var _0x21c24f=encryptor[_0xcd2c('0x1a')](_0x3b2288);_0xe9ed3b[_0xcd2c('0x1b')]=_0x21c24f;_0xe9ed3b[_0xcd2c('0x1c')]=moment(_0x21c24f)[_0xcd2c('0x1d')](0x7,'days')['format']();_0xe9ed3b[_0xcd2c('0x1e')]=_0xe9ed3b[_0xcd2c('0x18')]!=_0xe9ed3b[_0xcd2c('0x19')]?'changed':_0xcd2c('0x1f');}return _0xe9ed3b;}catch(_0x52d4e8){breakingLicense[_0xcd2c('0x18')]=_0x116629[_0xcd2c('0x12')];breakingLicense[_0xcd2c('0x20')]=_0x52d4e8[_0xcd2c('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4aeb75,_0x7ab4d5){getLicense()[_0xcd2c('0xd')](function(_0x308baa){return db['User'][_0xcd2c('0x21')]({'attributes':[_0xcd2c('0x22'),[db[_0xcd2c('0x23')]['fn'](_0xcd2c('0x24'),db[_0xcd2c('0x23')][_0xcd2c('0x25')](_0xcd2c('0x22'))),_0xcd2c('0x26')]],'group':'role','where':{'role':{'$or':[_0xcd2c('0x27'),_0xcd2c('0x28'),_0xcd2c('0x29')]}},'raw':!![]})[_0xcd2c('0xd')](function(_0x5ea914){var _0x1d8541={'user':_0x308baa[_0xcd2c('0x2a')]||0x0,'telephone':_0x308baa[_0xcd2c('0x2b')]||0x0};_0x5ea914['forEach'](function(_0x429d77){var _0x363505=_0x429d77[_0xcd2c('0x22')]==='admin'?_0xcd2c('0x28'):_0x429d77['role'];_0x1d8541[_0x363505]-=_0x429d77[_0xcd2c('0x26')];if(_0x1d8541[_0x363505]<0x0)_0x1d8541[_0x363505]=0x0;});_0x4aeb75(_0x1d8541);return;});})[_0xcd2c('0xe')](function(_0x2d68eb){_0x7ab4d5(_0x2d68eb);});});}function checkUserLimits(_0x456f7b){return new BPromise(function(_0x13d4ce,_0x577d87){getLimits()[_0xcd2c('0xd')](function(_0x4f5fd0){var _0x30c1e0=_[_0xcd2c('0x2c')](_[_0xcd2c('0x2d')](_0x456f7b,_0xcd2c('0x22')),[_0xcd2c('0x27'),_0xcd2c('0x28'),_0xcd2c('0x29')]);var _0x3d9608=(_0x30c1e0[_0xcd2c('0x27')]||0x0)+(_0x30c1e0[_0xcd2c('0x28')]||0x0);var _0x1d7443=_0x30c1e0['telephone']||0x0;if(_0x3d9608>_0x4f5fd0[_0xcd2c('0x28')])return _0x577d87(_0xcd2c('0x2e'));if(_0x1d7443>_0x4f5fd0[_0xcd2c('0x29')])return _0x577d87('License\x20limit\x20reached\x20for\x20telephones');return _0x13d4ce();})[_0xcd2c('0xe')](function(_0x3d7232){_0x577d87(_0x3d7232);});});}module[_0xcd2c('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x46fe=['add','grayReason','machineUuid','disabled','message','User','findAll','sequelize','COUNT','col','role','user','telephone','users','forEach','admin','count','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline'];(function(_0x98062,_0x592ba8){var _0x47940b=function(_0x1c70d3){while(--_0x1c70d3){_0x98062['push'](_0x98062['shift']());}};_0x47940b(++_0x592ba8);}(_0x46fe,0x105));var _0xe46f=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x46fe[_0x351509];return _0x4e9861;};'use strict';var util=require(_0xe46f('0x0'));var _=require(_0xe46f('0x1'));var moment=require(_0xe46f('0x2'));var BPromise=require(_0xe46f('0x3'));var hardware=require('./hardware');var encryptor=require(_0xe46f('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe46f('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe46f('0x6'),'machineUuid':hardware[_0xe46f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe46f('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1f3dbe){return new BPromise(function(_0x4db656,_0x9914e3){return db['License'][_0xe46f('0x9')](_[_0xe46f('0xa')](_0x1f3dbe,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x19c442){return checkLicense(_0x19c442,null);})[_0xe46f('0xb')](function(_0x12de8c){_0x4db656(_0x12de8c);return;})[_0xe46f('0xc')](function(_0x359ad5){_0x9914e3(_0x359ad5);});});}function checkLicense(_0x24747b,_0x4ef037){if(!_0x24747b){demoLicense[_0xe46f('0xd')]=_0x24747b[_0xe46f('0xe')];return demoLicense;}try{var _0x143943=_0x4ef037||_0x24747b[_0xe46f('0xf')];if(_[_0xe46f('0x10')](_0x143943)){throw new Error(_0xe46f('0x11'));}var _0x44ba61=_0x24747b[_0xe46f('0xe')];var _0x12ba2f=_0x24747b[_0xe46f('0x12')];var _0x2b84c7=_0x44ba61[_0xe46f('0x13')]('-')[0x4];var _0x5ddae3=_0x44ba61['split']('-')[0x0];var _0x2e0976=encryptor[_0xe46f('0x14')](_0x143943,util[_0xe46f('0x15')](_0xe46f('0x16'),_0x2b84c7,_0x44ba61,_0x5ddae3));var _0x2c8273=JSON[_0xe46f('0x17')](_0x2e0976);_0x2c8273[_0xe46f('0x18')]=![];_0x2c8273[_0xe46f('0xd')]=_0x44ba61;_0x2c8273['machineUuid']=hardware[_0xe46f('0x7')]();if(_0x12ba2f){var _0x16e5c5=encryptor[_0xe46f('0x14')](_0x12ba2f);_0x2c8273[_0xe46f('0x19')]=_0x16e5c5;_0x2c8273[_0xe46f('0x1a')]=moment(_0x16e5c5)[_0xe46f('0x1b')](0x7,'days')[_0xe46f('0x15')]();_0x2c8273[_0xe46f('0x1c')]=_0x2c8273[_0xe46f('0xd')]!=_0x2c8273[_0xe46f('0x1d')]?'changed':_0xe46f('0x1e');}return _0x2c8273;}catch(_0x3bdba5){breakingLicense[_0xe46f('0xd')]=_0x24747b[_0xe46f('0xe')];breakingLicense[_0xe46f('0x1f')]=_0x3bdba5[_0xe46f('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x251fad,_0x38defa){getLicense()[_0xe46f('0xb')](function(_0x41ba28){return db[_0xe46f('0x20')][_0xe46f('0x21')]({'attributes':['role',[db[_0xe46f('0x22')]['fn'](_0xe46f('0x23'),db[_0xe46f('0x22')][_0xe46f('0x24')](_0xe46f('0x25'))),'count']],'group':_0xe46f('0x25'),'where':{'role':{'$or':['admin',_0xe46f('0x26'),_0xe46f('0x27')]}},'raw':!![]})['then'](function(_0x43a6c4){var _0x4d2534={'user':_0x41ba28[_0xe46f('0x28')]||0x0,'telephone':_0x41ba28['telephones']||0x0};_0x43a6c4[_0xe46f('0x29')](function(_0x56c64e){var _0x3725ad=_0x56c64e['role']===_0xe46f('0x2a')?_0xe46f('0x26'):_0x56c64e[_0xe46f('0x25')];_0x4d2534[_0x3725ad]-=_0x56c64e[_0xe46f('0x2b')];if(_0x4d2534[_0x3725ad]<0x0)_0x4d2534[_0x3725ad]=0x0;});_0x251fad(_0x4d2534);return;});})[_0xe46f('0xc')](function(_0x45d9c1){_0x38defa(_0x45d9c1);});});}function checkUserLimits(_0x1c900b){return new BPromise(function(_0x14758b,_0x580785){getLimits()[_0xe46f('0xb')](function(_0x217567){var _0x3a7796=_[_0xe46f('0x2c')](_['countBy'](_0x1c900b,_0xe46f('0x25')),[_0xe46f('0x2a'),_0xe46f('0x26'),_0xe46f('0x27')]);var _0xae70f6=(_0x3a7796['admin']||0x0)+(_0x3a7796[_0xe46f('0x26')]||0x0);var _0x58f104=_0x3a7796[_0xe46f('0x27')]||0x0;if(_0xae70f6>_0x217567['user'])return _0x580785(_0xe46f('0x2d'));if(_0x58f104>_0x217567[_0xe46f('0x27')])return _0x580785(_0xe46f('0x2e'));return _0x14758b();})[_0xe46f('0xc')](function(_0x4049b5){_0x580785(_0x4049b5);});});}module[_0xe46f('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index ca38b69..57debef 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 _0x28f2=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x28f2,0x193));var _0x228f=function(_0x3b37d6,_0x3a198f){_0x3b37d6=_0x3b37d6-0x0;var _0x978966=_0x28f2[_0x3b37d6];return _0x978966;};'use strict';module[_0x228f('0x0')]={'DOMAIN':_0x228f('0x1'),'SESSION_SECRET':_0x228f('0x2'),'GOOGLE_ID':_0x228f('0x3'),'GOOGLE_SECRET':_0x228f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x6d11=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x3e0e79,_0x355c1f){var _0x1212d4=function(_0x228ad3){while(--_0x228ad3){_0x3e0e79['push'](_0x3e0e79['shift']());}};_0x1212d4(++_0x355c1f);}(_0x6d11,0xbf));var _0x16d1=function(_0x11bd6f,_0x583dd7){_0x11bd6f=_0x11bd6f-0x0;var _0x563307=_0x6d11[_0x11bd6f];return _0x563307;};'use strict';module[_0x16d1('0x0')]={'DOMAIN':_0x16d1('0x1'),'SESSION_SECRET':_0x16d1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x16d1('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 603251a..40311c0 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8aa=['exports','../utils/loggers','fileLogger'];(function(_0x3cb3ed,_0x4397e5){var _0x3f2887=function(_0x240e2e){while(--_0x240e2e){_0x3cb3ed['push'](_0x3cb3ed['shift']());}};_0x3f2887(++_0x4397e5);}(_0xe8aa,0x6a));var _0xae8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe8aa[_0xa464c9];return _0x3d73c4;};'use strict';var fileLogger=require(_0xae8a('0x0'))[_0xae8a('0x1')];module[_0xae8a('0x2')]=fileLogger; \ No newline at end of file +var _0x5267=['../utils/loggers','fileLogger'];(function(_0x1f8da0,_0xbb56b0){var _0x3c779c=function(_0x202eb5){while(--_0x202eb5){_0x1f8da0['push'](_0x1f8da0['shift']());}};_0x3c779c(++_0xbb56b0);}(_0x5267,0x1c8));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var fileLogger=require(_0x7526('0x0'))[_0x7526('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 e6e9ef4..16fac40 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 _0x6a4c=['../../services/ami/index.js','agi','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0x6a4c,0x1db));var _0xc6a4=function(_0x1eb0d7,_0x481537){_0x1eb0d7=_0x1eb0d7-0x0;var _0x40e13b=_0x6a4c[_0x1eb0d7];return _0x40e13b;};'use strict';var path=require(_0xc6a4('0x0'));var os=require('os');var config={'apps':[{'name':_0xc6a4('0x1'),'script':path[_0xc6a4('0x2')](__dirname,_0xc6a4('0x3'))},{'name':_0xc6a4('0x4'),'script':path[_0xc6a4('0x2')](__dirname,_0xc6a4('0x5'))},{'name':_0xc6a4('0x6'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xc6a4('0x7'),'script':path['join'](__dirname,_0xc6a4('0x8'))},{'name':_0xc6a4('0x9'),'script':path[_0xc6a4('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0xc6a4('0xa'),'script':path[_0xc6a4('0x2')](__dirname,_0xc6a4('0xb'))}]};module['exports']=config; \ No newline at end of file +var _0x27a1=['join','email','routing','../../services/routing/index.js','../../services/xdr/index.js','path','ami','../../services/ami/index.js','agi'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x27a1,0xd4));var _0x127a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x27a1[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x127a('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x127a('0x1'),'script':path['join'](__dirname,_0x127a('0x2'))},{'name':_0x127a('0x3'),'script':path[_0x127a('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0x127a('0x5'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x127a('0x6'),'script':path[_0x127a('0x4')](__dirname,_0x127a('0x7'))},{'name':'xdr','script':path['join'](__dirname,_0x127a('0x8'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 4d179c3..b1c0f52 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 _0xd713=['pm2','bluebird','connect','connected','disconnect','stop','then','restart','list','describe','delete','dump','saved'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0xd713,0x16c));var _0x3d71=function(_0x1c885b,_0xccdd23){_0x1c885b=_0x1c885b-0x0;var _0x3b348d=_0xd713[_0x1c885b];return _0x3b348d;};'use strict';var pm2=require(_0x3d71('0x0'));var BPromise=require(_0x3d71('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5c4bd4,_0x91ae5){return pm2[_0x3d71('0x2')](function(_0x356b06){if(_0x356b06){return _0x91ae5(_0x356b06);}return _0x5c4bd4(_0x3d71('0x3'));});});};exports['start']=function(_0x1e9848){return connect()['then'](function(){return new BPromise(function(_0x5ae8b5,_0x417343){return pm2['start'](_0x1e9848,function(_0x6773fa,_0x1f53be){if(_0x6773fa){return _0x417343(_0x6773fa);}pm2[_0x3d71('0x4')]();return _0x5ae8b5(_0x1f53be);});});});};exports[_0x3d71('0x5')]=function(_0x40f57){return connect()[_0x3d71('0x6')](function(){return new BPromise(function(_0x26bb4b,_0x321556){return pm2[_0x3d71('0x5')](_0x40f57,function(_0xa39c07,_0x13a4ee){if(_0xa39c07){return _0x321556(_0xa39c07);}pm2['disconnect']();return _0x26bb4b(_0x13a4ee);});});});};exports['restart']=function(_0x246b6b){return connect()[_0x3d71('0x6')](function(){return new BPromise(function(_0x313a6b,_0x24166d){return pm2[_0x3d71('0x7')](_0x246b6b,function(_0x16f197,_0x334218){if(_0x16f197){return _0x24166d(_0x16f197);}pm2[_0x3d71('0x4')]();return _0x313a6b(_0x334218);});});});};exports['list']=function(){return connect()[_0x3d71('0x6')](function(){return new BPromise(function(_0x53d910,_0x36f076){return pm2[_0x3d71('0x8')](function(_0x28890c,_0x2af4f1){if(_0x28890c){return _0x36f076(_0x28890c);}pm2[_0x3d71('0x4')]();return _0x53d910(_0x2af4f1);});});});};exports[_0x3d71('0x9')]=function(_0x4c1b5c){return connect()[_0x3d71('0x6')](function(){return new BPromise(function(_0xc4ea52,_0x20f3a9){return pm2[_0x3d71('0x9')](_0x4c1b5c,function(_0x362fb4,_0x2a2eea){if(_0x362fb4){return _0x20f3a9(_0x362fb4);}pm2[_0x3d71('0x4')]();return _0xc4ea52(_0x2a2eea);});});});};exports[_0x3d71('0xa')]=function(_0x42818f){return connect()[_0x3d71('0x6')](function(){return new BPromise(function(_0x25a092,_0x4b5677){return pm2[_0x3d71('0xa')](_0x42818f,function(_0x2a0a43,_0x3bdcae){if(_0x2a0a43){return _0x4b5677(_0x2a0a43);}pm2['disconnect']();return _0x25a092(_0x3bdcae);});});});};exports[_0x3d71('0xb')]=function(){return connect()[_0x3d71('0x6')](function(){return new BPromise(function(_0x15b068,_0x4e3405){return pm2[_0x3d71('0xb')](function(_0x3fb89e){if(_0x3fb89e){return _0x4e3405(_0x3fb89e);}return _0x15b068(_0x3d71('0xc'));});});});}; \ No newline at end of file +var _0xb925=['describe','delete','saved','pm2','./config','connect','connected','start','then','disconnect','stop','restart','list'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb925,0x155));var _0x5b92=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0xb925[_0x343090];return _0x3ff3e8;};'use strict';var pm2=require(_0x5b92('0x0'));var BPromise=require('bluebird');var config=require(_0x5b92('0x1'));function connect(){return new BPromise(function(_0x47be10,_0x1ebb1d){return pm2[_0x5b92('0x2')](function(_0x1d8b56){if(_0x1d8b56){return _0x1ebb1d(_0x1d8b56);}return _0x47be10(_0x5b92('0x3'));});});};exports[_0x5b92('0x4')]=function(_0x398884){return connect()[_0x5b92('0x5')](function(){return new BPromise(function(_0x470acf,_0x18425a){return pm2[_0x5b92('0x4')](_0x398884,function(_0x3f46e6,_0x1d332e){if(_0x3f46e6){return _0x18425a(_0x3f46e6);}pm2[_0x5b92('0x6')]();return _0x470acf(_0x1d332e);});});});};exports['stop']=function(_0x155693){return connect()[_0x5b92('0x5')](function(){return new BPromise(function(_0x7870ad,_0x24d7b6){return pm2[_0x5b92('0x7')](_0x155693,function(_0x4584fe,_0x4d50f7){if(_0x4584fe){return _0x24d7b6(_0x4584fe);}pm2[_0x5b92('0x6')]();return _0x7870ad(_0x4d50f7);});});});};exports['restart']=function(_0x57fa93){return connect()['then'](function(){return new BPromise(function(_0x34f3c3,_0x215212){return pm2[_0x5b92('0x8')](_0x57fa93,function(_0x3cd95c,_0xd5355f){if(_0x3cd95c){return _0x215212(_0x3cd95c);}pm2['disconnect']();return _0x34f3c3(_0xd5355f);});});});};exports[_0x5b92('0x9')]=function(){return connect()[_0x5b92('0x5')](function(){return new BPromise(function(_0x4cf8f2,_0x4b392e){return pm2[_0x5b92('0x9')](function(_0x33a72e,_0x34ae14){if(_0x33a72e){return _0x4b392e(_0x33a72e);}pm2[_0x5b92('0x6')]();return _0x4cf8f2(_0x34ae14);});});});};exports[_0x5b92('0xa')]=function(_0x488663){return connect()['then'](function(){return new BPromise(function(_0x1cf5c8,_0x1506a5){return pm2[_0x5b92('0xa')](_0x488663,function(_0x4f7fa3,_0xabd2a4){if(_0x4f7fa3){return _0x1506a5(_0x4f7fa3);}pm2[_0x5b92('0x6')]();return _0x1cf5c8(_0xabd2a4);});});});};exports[_0x5b92('0xb')]=function(_0x8b232b){return connect()[_0x5b92('0x5')](function(){return new BPromise(function(_0x448037,_0x56bb8c){return pm2[_0x5b92('0xb')](_0x8b232b,function(_0x2b8b9b,_0x5d8c98){if(_0x2b8b9b){return _0x56bb8c(_0x2b8b9b);}pm2[_0x5b92('0x6')]();return _0x448037(_0x5d8c98);});});});};exports['dump']=function(){return connect()[_0x5b92('0x5')](function(){return new BPromise(function(_0x164f93,_0x2fd228){return pm2['dump'](function(_0x1b0ed9){if(_0x1b0ed9){return _0x2fd228(_0x1b0ed9);}return _0x164f93(_0x5b92('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6d8ef43..cfebf8a 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 _0x4e1e=['then','ChatInteraction','lastMsgAt','subtract','minutes','length','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','find','chatTimeout'];(function(_0x37bfd7,_0x56ca68){var _0x2c2d96=function(_0x2d5aba){while(--_0x2d5aba){_0x37bfd7['push'](_0x37bfd7['shift']());}};_0x2c2d96(++_0x56ca68);}(_0x4e1e,0x13f));var _0xe4e1=function(_0x5a488c,_0x4cc470){_0x5a488c=_0x5a488c-0x0;var _0x53a7d6=_0x4e1e[_0x5a488c];return _0x53a7d6;};'use strict';var _=require(_0xe4e1('0x0'));var moment=require('moment');var Redis=require(_0xe4e1('0x1'));var util=require('util');var config=require(_0xe4e1('0x2'));var db=require(_0xe4e1('0x3'))['db'];var logger=require(_0xe4e1('0x4'))(_0xe4e1('0x5'));config[_0xe4e1('0x6')]=_[_0xe4e1('0x7')](config[_0xe4e1('0x6')],{'host':_0xe4e1('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4e1('0x6')]));function closeInteractions(){var _0x2a9191=0x0;var _0x1f5fe2=[];return db['Setting'][_0xe4e1('0x9')]({'raw':!![],'attributes':['id',_0xe4e1('0xa')],'where':{'id':0x1}})[_0xe4e1('0xb')](function(_0x29e432){_0x2a9191=_0x29e432[_0xe4e1('0xa')];if(_0x2a9191){return db[_0xe4e1('0xc')]['findAll']({'raw':!![],'attributes':['id',_0xe4e1('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe4e1('0xe')](_0x29e432[_0xe4e1('0xa')],_0xe4e1('0xf'))}}});}else{return[];}})[_0xe4e1('0xb')](function(_0x42a334){if(_0x42a334&&_0x42a334[_0xe4e1('0x10')]){_0x1f5fe2=_['map'](_0x42a334||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x1f5fe2[_0xe4e1('0x11')]());return db[_0xe4e1('0xc')][_0xe4e1('0x12')]({'closeReason':_0xe4e1('0x13'),'disposition':_0xe4e1('0x14'),'closed':!![],'closedAt':moment()[_0xe4e1('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1f5fe2}});}})[_0xe4e1('0xb')](function(){if(_0x1f5fe2&&_0x1f5fe2[_0xe4e1('0x10')]){logger['info'](_0xe4e1('0x16'),_0x1f5fe2['join']());for(var _0x4dbfe3=0x0;_0x4dbfe3<_0x1f5fe2[_0xe4e1('0x10')];_0x4dbfe3++){io[_0xe4e1('0x17')](_0xe4e1('0x18'),{'id':_0x1f5fe2[_0x4dbfe3],'closed':!![]});}}})[_0xe4e1('0x19')](function(_0x194cd2){logger[_0xe4e1('0x1a')](_0xe4e1('0x1b'),_0x194cd2?util[_0xe4e1('0x1c')](_0x194cd2,{'showHidden':![],'depth':null}):'');});}exports[_0xe4e1('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x63aa=['subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x29f46b,_0x29b6f4){var _0x22b7c2=function(_0x39731d){while(--_0x39731d){_0x29f46b['push'](_0x29f46b['shift']());}};_0x22b7c2(++_0x29b6f4);}(_0x63aa,0x7a));var _0xa63a=function(_0xa13822,_0x113f83){_0xa13822=_0xa13822-0x0;var _0x5cffaa=_0x63aa[_0xa13822];return _0x5cffaa;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0xa63a('0x0'));var db=require(_0xa63a('0x1'))['db'];var logger=require(_0xa63a('0x2'))('schedule');config[_0xa63a('0x3')]=_[_0xa63a('0x4')](config[_0xa63a('0x3')],{'host':_0xa63a('0x5'),'port':0x18eb});var io=require(_0xa63a('0x6'))(new Redis(config[_0xa63a('0x3')]));function closeInteractions(){var _0x5b2459=0x0;var _0x4c3284=[];return db['Setting'][_0xa63a('0x7')]({'raw':!![],'attributes':['id',_0xa63a('0x8')],'where':{'id':0x1}})[_0xa63a('0x9')](function(_0x17534d){_0x5b2459=_0x17534d[_0xa63a('0x8')];if(_0x5b2459){return db[_0xa63a('0xa')][_0xa63a('0xb')]({'raw':!![],'attributes':['id',_0xa63a('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa63a('0xd')](_0x17534d['chatTimeout'],_0xa63a('0xe'))}}});}else{return[];}})[_0xa63a('0x9')](function(_0x3b2a21){if(_0x3b2a21&&_0x3b2a21[_0xa63a('0xf')]){_0x4c3284=_[_0xa63a('0x10')](_0x3b2a21||[],'id');logger[_0xa63a('0x11')](_0xa63a('0x12'),_0x4c3284[_0xa63a('0x13')]());return db[_0xa63a('0xa')]['update']({'closeReason':'system','disposition':_0xa63a('0x14'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4c3284}});}})['then'](function(){if(_0x4c3284&&_0x4c3284[_0xa63a('0xf')]){logger[_0xa63a('0x11')](_0xa63a('0x15'),_0x4c3284[_0xa63a('0x13')]());for(var _0x27d166=0x0;_0x27d166<_0x4c3284[_0xa63a('0xf')];_0x27d166++){io[_0xa63a('0x16')](_0xa63a('0x17'),{'id':_0x4c3284[_0x27d166],'closed':!![]});}}})['catch'](function(_0x537449){logger[_0xa63a('0x18')]('[CHAT]\x20Error\x20closing\x20interactions',_0x537449?util[_0xa63a('0x19')](_0x537449,{'showHidden':![],'depth':null}):'');});}exports[_0xa63a('0x1a')]=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 e8525a0..9787cfb 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 _0x04cb=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x2f000a,_0x183c77){var _0x677ddf=function(_0x419d86){while(--_0x419d86){_0x2f000a['push'](_0x2f000a['shift']());}};_0x677ddf(++_0x183c77);}(_0x04cb,0xff));var _0xb04c=function(_0x28214a,_0x5b001a){_0x28214a=_0x28214a-0x0;var _0x47dcf0=_0x04cb[_0x28214a];return _0x47dcf0;};'use strict';function start(){var _0x4778f1=require(_0xb04c('0x0'));return _0x4778f1[_0xb04c('0x1')]();}module[_0xb04c('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xebe8=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0xebe8,0x166));var _0x8ebe=function(_0x4667f9,_0x1642c5){_0x4667f9=_0x4667f9-0x0;var _0x5cfbf3=_0xebe8[_0x4667f9];return _0x5cfbf3;};'use strict';function start(){var _0x13b496=require(_0x8ebe('0x0'));return _0x13b496[_0x8ebe('0x1')]();}module[_0x8ebe('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 e49dd33..875a06f 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 _0xb334=['Smtp','user','bcc','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20custom\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','isBetween','startAt','add\x20cron','stop\x20cron','update','stop','run','start','util','path','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name'];(function(_0x47ba84,_0x5223b3){var _0x152829=function(_0x105d46){while(--_0x105d46){_0x47ba84['push'](_0x47ba84['shift']());}};_0x152829(++_0x5223b3);}(_0xb334,0xe1));var _0x4b33=function(_0x37f31,_0x32b6d7){_0x37f31=_0x37f31-0x0;var _0x1c0ad5=_0xb334[_0x37f31];return _0x1c0ad5;};'use strict';var fs=require('fs');var util=require(_0x4b33('0x0'));var path=require(_0x4b33('0x1'));var _=require('lodash');var moment=require(_0x4b33('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x4b33('0x3'));var BPromise=require(_0x4b33('0x4'));var logger=require(_0x4b33('0x5'))(_0x4b33('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x4b33('0x7'));var analyticDefaultReportController=require(_0x4b33('0x8'));var client=jayson[_0x4b33('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3ff783,_0x32e26f){return function(){logger[_0x4b33('0xa')](_0x4b33('0xb'),_0x3ff783[_0x4b33('0xc')]);var _0x4f37d7=!![];var _0x1c88fc=_0x3ff783[_0x4b33('0xd')][_0x4b33('0xe')]();var _0xc0195={'account':_0x1c88fc,'message':{'from':util[_0x4b33('0xf')](_0x4b33('0x10'),_0x3ff783['MailAccount'][_0x4b33('0x11')],_0x3ff783[_0x4b33('0xd')]['email']||_0x3ff783['MailAccount'][_0x4b33('0x12')][_0x4b33('0x13')]),'to':_0x3ff783[_0x4b33('0xc')],'cc':_0x3ff783['cc'],'bcc':_0x3ff783[_0x4b33('0x14')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x32e26f[_0x4b33('0x11')],_0x3ff783[_0x4b33('0x15')],_0x3ff783[_0x4b33('0x16')])}};var _0xfb550c=path['join'](__dirname,_0x4b33('0x17'));var _0x4eda9b=_0x32e26f[_0x4b33('0x18')];var _0x18ca6b=util[_0x4b33('0xf')](_0x4b33('0x19'),path[_0x4b33('0x1a')](_0x32e26f['savename'],path[_0x4b33('0x1b')](_0x32e26f['savename'])),_0x4b33('0x1c'));var _0x5d0af5=path[_0x4b33('0x1d')](_0xfb550c,_0x4eda9b);var _0x1620be=path[_0x4b33('0x1d')](_0xfb550c,_0x18ca6b);if(fs[_0x4b33('0x1e')](_0x5d0af5)){_0x32e26f[_0x4b33('0x1f')]=_0x4b33('0x20');_0xc0195[_0x4b33('0x21')][_0x4b33('0x22')]=[{'filename':_0x4eda9b,'path':_0x5d0af5}];_0xc0195['message']['text']=util[_0x4b33('0xf')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x4b33('0x23')](_0x32e26f,null,0x2));}else if(fs['existsSync'](_0x1620be)){_0x32e26f[_0x4b33('0x1f')]='Sent';_0xc0195[_0x4b33('0x21')][_0x4b33('0x22')]=[{'filename':_0x18ca6b,'path':_0x1620be}];}else{_0xc0195[_0x4b33('0x21')][_0x4b33('0x24')]=_0x4b33('0x25');if(!_0x3ff783['sendIfEmpty']){_0x4f37d7=![];logger['info'](_0x4b33('0x26'));}}if(_0x4f37d7){return client[_0x4b33('0x27')]('SendMail',_0xc0195)[_0x4b33('0x28')](function(_0x17a369){if(_0x17a369[_0x4b33('0x29')]){return logger[_0x4b33('0x29')](_0x4b33('0x2a'),JSON[_0x4b33('0x23')](_0x17a369));}return logger['info'](_0x4b33('0x2b'));})[_0x4b33('0x2c')](function(_0x2684cc){return logger['error']('error\x20mail',JSON[_0x4b33('0x23')](_0x2684cc));});}};}function handleError(){return function(_0x525d3f){return logger[_0x4b33('0x29')](JSON[_0x4b33('0x23')](_0x525d3f));};}function handleResult(_0x4b981d){return function(_0x5610cd){logger[_0x4b33('0xa')]('data',JSON[_0x4b33('0x23')](_0x5610cd));if(_0x4b981d[_0x4b33('0xd')]&&_0x4b981d[_0x4b33('0xd')]['Smtp']&&!_[_0x4b33('0x2d')](_0x4b981d[_0x4b33('0xc')])){setTimeout(handleSendEmail(_0x4b981d,_0x5610cd),0x3c*0x3e8);}};}function handleJob(_0x11676b){return function(){try{if(_['isNil'](_0x11676b[_0x4b33('0x15')])){return logger[_0x4b33('0xa')](_0x4b33('0x2e'));}if(_[_0x4b33('0x2d')](_0x11676b[_0x4b33('0x16')])){return logger[_0x4b33('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x32ecf8={'startDate':moment()[_0x4b33('0x2f')](_0x11676b[_0x4b33('0x15')],_0x11676b[_0x4b33('0x16')])[_0x4b33('0xf')](_0x4b33('0x30')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x4b33('0x31'),'output':_0x11676b[_0x4b33('0x32')],'name':_0x11676b[_0x4b33('0x11')]};if(!_[_0x4b33('0x2d')](_0x11676b[_0x4b33('0x33')])){logger[_0x4b33('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x11676b[_0x4b33('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x11676b['DefaultReportId']},_0x32ecf8)[_0x4b33('0x28')](handleResult(_0x11676b))[_0x4b33('0x2c')](handleError());}if(!_[_0x4b33('0x2d')](_0x11676b['CustomReportId'])){logger[_0x4b33('0xa')](_0x4b33('0x34'),_0x11676b['CustomReportId']);return analyticCustomReportController[_0x4b33('0x35')]({'id':_0x11676b[_0x4b33('0x36')]},_0x32ecf8)[_0x4b33('0x28')](handleResult(_0x11676b))[_0x4b33('0x2c')](handleError());}}catch(_0x10df3d){logger[_0x4b33('0x29')](JSON[_0x4b33('0x23')](_0x10df3d));}return logger[_0x4b33('0xa')](_0x4b33('0x37'));};}function getJobs(_0x29df68){var _0x42894b={};if(_0x29df68){_0x42894b['id']=_0x29df68;}return db['Schedule'][_0x4b33('0x38')]({'where':_0x42894b,'include':[{'model':db[_0x4b33('0xd')],'attributes':['id',_0x4b33('0x11'),_0x4b33('0xc')],'include':[{'model':db[_0x4b33('0x39')],'as':_0x4b33('0x12'),'include':[{'model':db[_0x4b33('0x3a')],'as':_0x4b33('0x3a')}]}]}]})[_0x4b33('0x28')](function(_0xc8a6f){var _0x33ebd5=_['keys'](manager['jobs']);var _0x55b892=_[_0x4b33('0x3b')](_0xc8a6f,function(_0x38d825){return _0x38d825['id']['toString']();});var _0x5d9144=_[_0x4b33('0x3c')](_0xc8a6f,function(_0x231f14){return _0x231f14['id'][_0x4b33('0x3d')]();});var _0x326fe5=_0x29df68?_0x55b892:_[_0x4b33('0x3e')](_0x55b892,_0x33ebd5);var _0x4ea0da=_[_0x4b33('0x3f')](_0x55b892,_0x33ebd5);var _0x183c4d=_[_0x4b33('0x3e')](_0x33ebd5,_0x55b892);var _0x1728ad;var _0x42f236;for(_0x1728ad=0x0;_0x1728ad<_0x183c4d[_0x4b33('0x40')]&&!_0x29df68;_0x1728ad+=0x1){_0x42f236=_0x183c4d[_0x1728ad][_0x4b33('0x3d')]();if(manager[_0x4b33('0x41')](_0x42f236)){manager['stop'](_0x42f236);manager[_0x4b33('0x42')](_0x42f236);logger[_0x4b33('0xa')](_0x4b33('0x43'),_0x42f236);}}logger[_0x4b33('0xa')](_0x4b33('0x44'),JSON[_0x4b33('0x23')](_0x326fe5));for(_0x1728ad=0x0;_0x1728ad<_0x326fe5[_0x4b33('0x40')];_0x1728ad+=0x1){_0x42f236=_0x326fe5[_0x1728ad][_0x4b33('0x3d')]();logger[_0x4b33('0xa')](_0x4b33('0x45'),_0x42f236);if(_0x29df68){logger[_0x4b33('0xa')]('my\x20id',_0x29df68);logger[_0x4b33('0xa')](JSON['stringify'](_0x5d9144[_0x42f236]));BPromise[_0x4b33('0x46')]()[_0x4b33('0x28')](handleJob(_0x5d9144[_0x42f236]));logger[_0x4b33('0xa')](_0x4b33('0x47'),_0x5d9144[_0x42f236][_0x4b33('0x11')],_0x5d9144[_0x42f236]['cron']);}else if(_0x5d9144[_0x42f236][_0x4b33('0x48')]&&_0x5d9144[_0x42f236]['active']&&moment()[_0x4b33('0x49')](_0x5d9144[_0x42f236][_0x4b33('0x4a')],_0x5d9144[_0x42f236]['endAt'])){manager['add'](_0x42f236,_0x5d9144[_0x42f236][_0x4b33('0x48')],handleJob(_0x5d9144[_0x42f236]));manager['start'](_0x42f236);logger[_0x4b33('0xa')](_0x4b33('0x4b'),_0x5d9144[_0x42f236][_0x4b33('0x11')],_0x5d9144[_0x42f236][_0x4b33('0x48')]);}else if(manager['exists'](_0x42f236)){manager['stop'](_0x42f236);manager[_0x4b33('0x42')](_0x42f236);logger['info'](_0x4b33('0x4c'),_0x5d9144[_0x42f236][_0x4b33('0x11')],_0x5d9144[_0x42f236][_0x4b33('0x48')]);}}for(_0x1728ad=0x0,_0x42f236;_0x1728ad<_0x4ea0da[_0x4b33('0x40')]&&!_0x29df68;_0x1728ad+=0x1){_0x42f236=_0x4ea0da[_0x1728ad]['toString']();if(manager[_0x4b33('0x41')](_0x42f236)){if(_0x5d9144[_0x42f236]['cron']&&_0x5d9144[_0x42f236]['active']&&moment()['isBetween'](_0x5d9144[_0x42f236][_0x4b33('0x4a')],_0x5d9144[_0x42f236]['endAt'])){manager[_0x4b33('0x4d')](_0x42f236,_0x5d9144[_0x42f236][_0x4b33('0x48')],handleJob(_0x5d9144[_0x42f236]));logger[_0x4b33('0xa')]('update\x20cron',_0x5d9144[_0x42f236][_0x4b33('0x11')],_0x5d9144[_0x42f236][_0x4b33('0x48')]);}else{manager[_0x4b33('0x4e')](_0x42f236);manager[_0x4b33('0x42')](_0x42f236);logger[_0x4b33('0xa')](_0x4b33('0x4c'),_0x5d9144[_0x42f236][_0x4b33('0x11')],_0x5d9144[_0x42f236][_0x4b33('0x48')]);}}}})[_0x4b33('0x2c')](function(_0x5d482d){logger[_0x4b33('0x29')](JSON[_0x4b33('0x23')](_0x5d482d));});}exports[_0x4b33('0x4f')]=function(_0x49c1bb){return getJobs(_0x49c1bb);};exports[_0x4b33('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x1077=['savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','subtractNumber','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','stop\x20cron','active','endAt','update\x20cron','run','util','path','lodash','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','email','MailAccount','getSmtpOptions','format','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports'];(function(_0x1ab35d,_0x3f401d){var _0x133d6d=function(_0x381b41){while(--_0x381b41){_0x1ab35d['push'](_0x1ab35d['shift']());}};_0x133d6d(++_0x3f401d);}(_0x1077,0x13d));var _0x7107=function(_0x24a908,_0x2df8f9){_0x24a908=_0x24a908-0x0;var _0x535352=_0x1077[_0x24a908];return _0x535352;};'use strict';var fs=require('fs');var util=require(_0x7107('0x0'));var path=require(_0x7107('0x1'));var _=require(_0x7107('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x7107('0x3'));var BPromise=require(_0x7107('0x4'));var logger=require(_0x7107('0x5'))(_0x7107('0x6'));var db=require(_0x7107('0x7'))['db'];var analyticCustomReportController=require(_0x7107('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x7107('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x324ad5,_0x1a1225){return function(){logger[_0x7107('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x324ad5[_0x7107('0xb')]);var _0x404084=!![];var _0x228d29=_0x324ad5[_0x7107('0xc')][_0x7107('0xd')]();var _0x2ad5d3={'account':_0x228d29,'message':{'from':util[_0x7107('0xe')]('\x22%s\x22\x20<%s>',_0x324ad5[_0x7107('0xc')][_0x7107('0xf')],_0x324ad5['MailAccount'][_0x7107('0xb')]||_0x324ad5[_0x7107('0xc')][_0x7107('0x10')][_0x7107('0x11')]),'to':_0x324ad5['email'],'cc':_0x324ad5['cc'],'bcc':_0x324ad5[_0x7107('0x12')],'subject':util['format'](_0x7107('0x13'),_0x1a1225[_0x7107('0xf')],_0x324ad5['subtractNumber'],_0x324ad5[_0x7107('0x14')])}};var _0x2ce190=path[_0x7107('0x15')](__dirname,_0x7107('0x16'));var _0x470480=_0x1a1225[_0x7107('0x17')];var _0x4dd129=util[_0x7107('0xe')](_0x7107('0x18'),path[_0x7107('0x19')](_0x1a1225[_0x7107('0x17')],path[_0x7107('0x1a')](_0x1a1225[_0x7107('0x17')])),_0x7107('0x1b'));var _0x33a930=path[_0x7107('0x15')](_0x2ce190,_0x470480);var _0x28da6e=path[_0x7107('0x15')](_0x2ce190,_0x4dd129);if(fs[_0x7107('0x1c')](_0x33a930)){_0x1a1225['status']=_0x7107('0x1d');_0x2ad5d3[_0x7107('0x1e')][_0x7107('0x1f')]=[{'filename':_0x470480,'path':_0x33a930}];_0x2ad5d3['message']['text']=util['format'](_0x7107('0x20'),JSON[_0x7107('0x21')](_0x1a1225,null,0x2));}else if(fs[_0x7107('0x1c')](_0x28da6e)){_0x1a1225[_0x7107('0x22')]=_0x7107('0x1d');_0x2ad5d3[_0x7107('0x1e')][_0x7107('0x1f')]=[{'filename':_0x4dd129,'path':_0x28da6e}];}else{_0x2ad5d3['message'][_0x7107('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x324ad5[_0x7107('0x24')]){_0x404084=![];logger[_0x7107('0xa')](_0x7107('0x25'));}}if(_0x404084){return client[_0x7107('0x26')](_0x7107('0x27'),_0x2ad5d3)[_0x7107('0x28')](function(_0x267fad){if(_0x267fad[_0x7107('0x29')]){return logger['error'](_0x7107('0x2a'),JSON[_0x7107('0x21')](_0x267fad));}return logger[_0x7107('0xa')](_0x7107('0x2b'));})[_0x7107('0x2c')](function(_0x419d02){return logger['error'](_0x7107('0x2a'),JSON['stringify'](_0x419d02));});}};}function handleError(){return function(_0x3a4f23){return logger['error'](JSON['stringify'](_0x3a4f23));};}function handleResult(_0x444f9d){return function(_0x568e9a){logger['info'](_0x7107('0x2d'),JSON[_0x7107('0x21')](_0x568e9a));if(_0x444f9d[_0x7107('0xc')]&&_0x444f9d[_0x7107('0xc')][_0x7107('0x10')]&&!_['isNil'](_0x444f9d[_0x7107('0xb')])){setTimeout(handleSendEmail(_0x444f9d,_0x568e9a),0x3c*0x3e8);}};}function handleJob(_0x23b649){return function(){try{if(_['isNil'](_0x23b649[_0x7107('0x2e')])){return logger[_0x7107('0xa')](_0x7107('0x2f'));}if(_['isNil'](_0x23b649[_0x7107('0x14')])){return logger[_0x7107('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1fc8d5={'startDate':moment()['subtract'](_0x23b649[_0x7107('0x2e')],_0x23b649[_0x7107('0x14')])[_0x7107('0xe')](_0x7107('0x30')),'endDate':moment()[_0x7107('0xe')](_0x7107('0x30')),'type':_0x7107('0x31'),'output':_0x23b649[_0x7107('0x32')],'name':_0x23b649[_0x7107('0xf')]};if(!_[_0x7107('0x33')](_0x23b649[_0x7107('0x34')])){logger[_0x7107('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x23b649[_0x7107('0x34')]);return analyticDefaultReportController[_0x7107('0x35')]({'id':_0x23b649[_0x7107('0x34')]},_0x1fc8d5)['then'](handleResult(_0x23b649))[_0x7107('0x2c')](handleError());}if(!_['isNil'](_0x23b649[_0x7107('0x36')])){logger[_0x7107('0xa')](_0x7107('0x37'),_0x23b649[_0x7107('0x36')]);return analyticCustomReportController[_0x7107('0x35')]({'id':_0x23b649[_0x7107('0x36')]},_0x1fc8d5)['then'](handleResult(_0x23b649))[_0x7107('0x2c')](handleError());}}catch(_0x4c1f92){logger['error'](JSON[_0x7107('0x21')](_0x4c1f92));}return logger[_0x7107('0xa')](_0x7107('0x38'));};}function getJobs(_0x35527d){var _0x3be1f4={};if(_0x35527d){_0x3be1f4['id']=_0x35527d;}return db[_0x7107('0x39')][_0x7107('0x3a')]({'where':_0x3be1f4,'include':[{'model':db[_0x7107('0xc')],'attributes':['id',_0x7107('0xf'),_0x7107('0xb')],'include':[{'model':db['MailServerOut'],'as':_0x7107('0x10'),'include':[{'model':db[_0x7107('0x3b')],'as':_0x7107('0x3b')}]}]}]})[_0x7107('0x28')](function(_0x5ca3fa){var _0x50a815=_[_0x7107('0x3c')](manager[_0x7107('0x3d')]);var _0x480047=_[_0x7107('0x3e')](_0x5ca3fa,function(_0x594f0f){return _0x594f0f['id'][_0x7107('0x3f')]();});var _0x4a0cad=_['keyBy'](_0x5ca3fa,function(_0x697f08){return _0x697f08['id'][_0x7107('0x3f')]();});var _0x173bea=_0x35527d?_0x480047:_['difference'](_0x480047,_0x50a815);var _0xb37691=_[_0x7107('0x40')](_0x480047,_0x50a815);var _0x591d74=_['difference'](_0x50a815,_0x480047);var _0x38f639;var _0x566540;for(_0x38f639=0x0;_0x38f639<_0x591d74['length']&&!_0x35527d;_0x38f639+=0x1){_0x566540=_0x591d74[_0x38f639][_0x7107('0x3f')]();if(manager[_0x7107('0x41')](_0x566540)){manager[_0x7107('0x42')](_0x566540);manager[_0x7107('0x43')](_0x566540);logger[_0x7107('0xa')](_0x7107('0x44'),_0x566540);}}logger[_0x7107('0xa')](_0x7107('0x45'),JSON[_0x7107('0x21')](_0x173bea));for(_0x38f639=0x0;_0x38f639<_0x173bea[_0x7107('0x46')];_0x38f639+=0x1){_0x566540=_0x173bea[_0x38f639][_0x7107('0x3f')]();logger[_0x7107('0xa')](_0x7107('0x47'),_0x566540);if(_0x35527d){logger['info'](_0x7107('0x48'),_0x35527d);logger[_0x7107('0xa')](JSON[_0x7107('0x21')](_0x4a0cad[_0x566540]));BPromise['resolve']()[_0x7107('0x28')](handleJob(_0x4a0cad[_0x566540]));logger[_0x7107('0xa')](_0x7107('0x49'),_0x4a0cad[_0x566540][_0x7107('0xf')],_0x4a0cad[_0x566540]['cron']);}else if(_0x4a0cad[_0x566540][_0x7107('0x4a')]&&_0x4a0cad[_0x566540]['active']&&moment()[_0x7107('0x4b')](_0x4a0cad[_0x566540][_0x7107('0x4c')],_0x4a0cad[_0x566540]['endAt'])){manager[_0x7107('0x4d')](_0x566540,_0x4a0cad[_0x566540]['cron'],handleJob(_0x4a0cad[_0x566540]));manager[_0x7107('0x4e')](_0x566540);logger['info'](_0x7107('0x4f'),_0x4a0cad[_0x566540][_0x7107('0xf')],_0x4a0cad[_0x566540]['cron']);}else if(manager['exists'](_0x566540)){manager[_0x7107('0x42')](_0x566540);manager[_0x7107('0x43')](_0x566540);logger[_0x7107('0xa')](_0x7107('0x50'),_0x4a0cad[_0x566540][_0x7107('0xf')],_0x4a0cad[_0x566540][_0x7107('0x4a')]);}}for(_0x38f639=0x0,_0x566540;_0x38f639<_0xb37691[_0x7107('0x46')]&&!_0x35527d;_0x38f639+=0x1){_0x566540=_0xb37691[_0x38f639]['toString']();if(manager[_0x7107('0x41')](_0x566540)){if(_0x4a0cad[_0x566540]['cron']&&_0x4a0cad[_0x566540][_0x7107('0x51')]&&moment()[_0x7107('0x4b')](_0x4a0cad[_0x566540][_0x7107('0x4c')],_0x4a0cad[_0x566540][_0x7107('0x52')])){manager['update'](_0x566540,_0x4a0cad[_0x566540][_0x7107('0x4a')],handleJob(_0x4a0cad[_0x566540]));logger[_0x7107('0xa')](_0x7107('0x53'),_0x4a0cad[_0x566540][_0x7107('0xf')],_0x4a0cad[_0x566540][_0x7107('0x4a')]);}else{manager['stop'](_0x566540);manager['deleteJob'](_0x566540);logger[_0x7107('0xa')](_0x7107('0x50'),_0x4a0cad[_0x566540][_0x7107('0xf')],_0x4a0cad[_0x566540][_0x7107('0x4a')]);}}}})['catch'](function(_0x47e292){logger['error'](JSON[_0x7107('0x21')](_0x47e292));});}exports[_0x7107('0x54')]=function(_0x2b5c58){return getJobs(_0x2b5c58);};exports[_0x7107('0x4e')]=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 aefa477..484e53e 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 _0x5d31=['[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeRegion','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','start','aws-sdk','request-promise','util','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','ValidationError','Cloud\x20Provider\x20not\x20configured','language'];(function(_0x1a9eb8,_0x32c795){var _0xe8be84=function(_0x2350b6){while(--_0x2350b6){_0x1a9eb8['push'](_0x1a9eb8['shift']());}};_0xe8be84(++_0x32c795);}(_0x5d31,0xf7));var _0x15d3=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0x5d31[_0x4dd71c];return _0x8e4e36;};var _=require('lodash');var AWS=require(_0x15d3('0x0'));var rp=require(_0x15d3('0x1'));var util=require(_0x15d3('0x2'));var BPromise=require('bluebird');var db=require(_0x15d3('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x445652,_0x2a8bbe,_0x16bee7,_0x242755){return new Promise(function(_0x5ebd77,_0x8448c4){var _0xe5e074=new AWS[(_0x15d3('0x4'))]({'accessKeyId':_0x2a8bbe,'secretAccessKey':_0x445652,'region':_0x16bee7});_0xe5e074[_0x15d3('0x5')]({'TranscriptionJobName':_0x242755},function(_0x52b238,_0x3e173c){if(_0x52b238){return _0x8448c4(_0x52b238);}else{return _0x5ebd77(_0x3e173c);}});});}function sentiment(_0x511f14,_0x51718f,_0x26cf8a,_0x4e158f,_0xa999ab){return new Promise(function(_0x4f7227,_0x582816){var _0x3afd0f=new AWS[(_0x15d3('0x6'))]({'accessKeyId':_0x51718f,'secretAccessKey':_0x511f14,'region':_0x26cf8a});_0x3afd0f[_0x15d3('0x7')]({'Text':_0x4e158f,'LanguageCode':_0xa999ab[_0x15d3('0x8')](0x0,0x2)},function(_0x147137,_0x3088a7){if(_0x147137){return _0x582816(_0x147137);}else{return _0x4f7227(_0x3088a7);}});});}function checkTranscribeJob(_0x4a47f7,_0x219867,_0x1397d8){var _0x2811b5;return new BPromise(function(_0x209104,_0x36ab99){logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0xb'),_0x4a47f7['id'],_0x4a47f7[_0x15d3('0xc')]));return getTranscriptionJob(_0x1397d8[_0x15d3('0xd')],_0x1397d8[_0x15d3('0xe')],_0x219867['transcribeRegion'],_0x4a47f7[_0x15d3('0xc')])[_0x15d3('0xf')](function(_0x5bbfef){logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0x10'),_0x4a47f7['id'],_0x4a47f7[_0x15d3('0xc')],_0x5bbfef[_0x15d3('0x11')][_0x15d3('0x12')]));if(!_0x4a47f7[_0x15d3('0x13')]){switch(_0x5bbfef[_0x15d3('0x11')][_0x15d3('0x12')]){case _0x15d3('0x14'):var _0x366a77={'transcribeStatus':_0x5bbfef['TranscriptionJob'][_0x15d3('0x12')],'fileUri':_0x5bbfef[_0x15d3('0x11')]['Transcript']['TranscriptFileUri']};logger['info'](util['format'](_0x15d3('0x15'),_0x4a47f7['id']));return rp({'uri':_0x5bbfef[_0x15d3('0x11')][_0x15d3('0x16')][_0x15d3('0x17')],'json':!![]})[_0x15d3('0xf')](function(_0x2fa13c){logger['info'](util['format'](_0x15d3('0x18'),_0x4a47f7['id']));if(_0x2fa13c&&_0x2fa13c[_0x15d3('0x19')]&&_0x2fa13c[_0x15d3('0x19')][_0x15d3('0x1a')]&&_0x2fa13c['results'][_0x15d3('0x1a')][_0x15d3('0x1b')]){_0x366a77[_0x15d3('0x13')]='';for(var _0x539626=0x0;_0x539626<_0x2fa13c[_0x15d3('0x19')][_0x15d3('0x1a')]['length'];_0x539626++){_0x366a77['fileText']+=_0x2fa13c['results'][_0x15d3('0x1a')][_0x539626][_0x15d3('0x1c')]+'';}}return _0x4a47f7[_0x15d3('0x1d')](_0x366a77);})[_0x15d3('0xf')](function(){logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0x1e'),_0x4a47f7['id']));if(!_0x4a47f7[_0x15d3('0x1f')]){throw new db[(_0x15d3('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x219867[_0x15d3('0x21')]||!_0x219867['sentimentAccountId']||!_0x219867[_0x15d3('0x22')]||!_0x219867['language']||!_0x219867[_0x15d3('0x23')]){throw new db[(_0x15d3('0x20'))]['ValidationError'](_0x15d3('0x24'));}if(!_0x366a77[_0x15d3('0x13')]){throw new Error(_0x15d3('0x25'));}if(_0x219867[_0x15d3('0x26')]===_0x1397d8['id']){return _0x1397d8;}else{return db[_0x15d3('0x27')][_0x15d3('0x28')]({'where':{'id':_settings[_0x15d3('0x26')]}});}})[_0x15d3('0xf')](function(_0x9133e5){if(!_0x9133e5){throw new db[(_0x15d3('0x20'))]['ValidationError'](_0x15d3('0x29'));}if(!_0x9133e5[_0x15d3('0xd')]||!_0x9133e5[_0x15d3('0xe')]){throw new db[(_0x15d3('0x20'))][(_0x15d3('0x2a'))](_0x15d3('0x2b'));}_0x2811b5=_0x9133e5;logger[_0x15d3('0x9')](util[_0x15d3('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a47f7['id']));return sentiment(_0x2811b5[_0x15d3('0xd')],_0x2811b5['data2'],_0x219867[_0x15d3('0x22')],_0x366a77[_0x15d3('0x13')],_0x219867[_0x15d3('0x2c')]);})[_0x15d3('0xf')](function(_0x145fa3){logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0x2d'),_0x4a47f7['id']));return _0x4a47f7[_0x15d3('0x1d')]({'sentiment':_0x145fa3[_0x15d3('0x2e')],'sPositive':_0x145fa3[_0x15d3('0x2f')][_0x15d3('0x30')],'sNegative':_0x145fa3[_0x15d3('0x2f')][_0x15d3('0x31')],'sMixed':_0x145fa3[_0x15d3('0x2f')]['Mixed'],'sNeutral':_0x145fa3[_0x15d3('0x2f')][_0x15d3('0x32')]});})['then'](function(){logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0x1e'),_0x4a47f7['id']));_0x209104();});case'FAILED':return _0x4a47f7[_0x15d3('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x5bbfef[_0x15d3('0x11')][_0x15d3('0x33')]})['then'](function(){logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0x1e'),_0x4a47f7['id']));_0x209104();});default:logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0x34'),_0x4a47f7['id']));break;}}else{return BPromise['resolve']()[_0x15d3('0xf')](function(){if(!_0x4a47f7['tempSentiment']){throw new db[(_0x15d3('0x20'))][(_0x15d3('0x2a'))](_0x15d3('0x35'));}if(!_0x219867[_0x15d3('0x21')]||!_0x219867[_0x15d3('0x26')]||!_0x219867[_0x15d3('0x22')]||!_0x219867[_0x15d3('0x2c')]||!_0x219867[_0x15d3('0x23')]){throw new db[(_0x15d3('0x20'))][(_0x15d3('0x2a'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4a47f7[_0x15d3('0x13')]){throw new Error(_0x15d3('0x25'));}if(_0x219867['sentimentAccountId']===_0x1397d8['id']){return _0x1397d8;}else{return db['CloudProvider'][_0x15d3('0x28')]({'where':{'id':_settings[_0x15d3('0x26')]}});}})[_0x15d3('0xf')](function(_0x20ecab){if(!_0x20ecab){throw new db[(_0x15d3('0x20'))][(_0x15d3('0x2a'))](_0x15d3('0x29'));}if(!_0x20ecab[_0x15d3('0xd')]||!_0x20ecab[_0x15d3('0xe')]){throw new db[(_0x15d3('0x20'))]['ValidationError'](_0x15d3('0x2b'));}_0x2811b5=_0x20ecab;logger[_0x15d3('0x9')](util['format'](_0x15d3('0x36'),_0x4a47f7['id']));return sentiment(_0x2811b5['data1'],_0x2811b5['data2'],_0x219867[_0x15d3('0x22')],_0x4a47f7[_0x15d3('0x13')],_0x219867[_0x15d3('0x2c')]);})['then'](function(_0x22f29d){logger['info'](util[_0x15d3('0xa')](_0x15d3('0x2d'),_0x4a47f7['id']));return _0x4a47f7[_0x15d3('0x1d')]({'sentiment':_0x22f29d[_0x15d3('0x2e')],'sPositive':_0x22f29d[_0x15d3('0x2f')]['Positive'],'sNegative':_0x22f29d['SentimentScore']['Negative'],'sMixed':_0x22f29d[_0x15d3('0x2f')]['Mixed'],'sNeutral':_0x22f29d[_0x15d3('0x2f')][_0x15d3('0x32')],'transcribeStatus':_0x15d3('0x14')});})['then'](function(){logger[_0x15d3('0x9')](util[_0x15d3('0xa')](_0x15d3('0x1e'),_0x4a47f7['id']));_0x209104();});}})[_0x15d3('0x37')](function(_0x404f06){if(_0x404f06){if(!_0x404f06[_0x15d3('0x38')]||_0x404f06[_0x15d3('0x38')]!==_0x15d3('0x39')){logger[_0x15d3('0x3a')](util[_0x15d3('0xa')](_0x15d3('0x3b'),_0x4a47f7['id']),util[_0x15d3('0x3c')](_0x404f06,{'showHidden':![],'depth':null}));}}_0x209104();});});}function checkTranscribe(){var _0x552643;var _0x4b50bf;var _0x264487;return db[_0x15d3('0x3d')][_0x15d3('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x2efe7e){if(!_0x2efe7e||!_0x2efe7e['length']){throw new db[(_0x15d3('0x20'))]['ValidationError'](_0x15d3('0x3f'));}_0x552643=_0x2efe7e;return db[_0x15d3('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x480c9d){if(!_0x480c9d){throw new db['Sequelize']['ValidationError'](_0x15d3('0x41'));}_0x4b50bf=_0x480c9d;if(!_0x4b50bf[_0x15d3('0x42')]||!_0x4b50bf['transcribeAccountId']||!_0x4b50bf[_0x15d3('0x43')]||!_0x4b50bf[_0x15d3('0x2c')]||!_0x4b50bf[_0x15d3('0x23')]){throw new db['Sequelize'][(_0x15d3('0x2a'))](_0x15d3('0x44'));}return db[_0x15d3('0x27')][_0x15d3('0x28')]({'where':{'id':_0x4b50bf[_0x15d3('0x45')]}});})[_0x15d3('0xf')](function(_0x5f0a42){if(!_0x5f0a42){throw new db[(_0x15d3('0x20'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5f0a42[_0x15d3('0xd')]||!_0x5f0a42['data2']){throw new db[(_0x15d3('0x20'))]['ValidationError'](_0x15d3('0x2b'));}_0x264487=_0x5f0a42;var _0x205230=[];_0x552643[_0x15d3('0x46')](function(_0x1e8d1b){_0x205230[_0x15d3('0x47')](checkTranscribeJob(_0x1e8d1b,_0x4b50bf,_0x264487));});return BPromise['all'](_0x205230);})['catch'](function(_0x9bba6){if(_0x9bba6){if(!_0x9bba6['name']||_0x9bba6[_0x15d3('0x38')]!==_0x15d3('0x39')){logger[_0x15d3('0x3a')](util[_0x15d3('0x3c')](_0x9bba6,{'showHidden':![],'depth':null}));}}});}exports[_0x15d3('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3495=['length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Mixed','Neutral','COMPLETED','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','TranscriptionJobStatus','fileText','TranscriptionJob','TranscriptFileUri','Transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x157af3,_0x1bf9f7){var _0xde5c5c=function(_0x333ae2){while(--_0x333ae2){_0x157af3['push'](_0x157af3['shift']());}};_0xde5c5c(++_0x1bf9f7);}(_0x3495,0x1de));var _0x5349=function(_0x378d9d,_0x2a0628){_0x378d9d=_0x378d9d-0x0;var _0x1e01c1=_0x3495[_0x378d9d];return _0x1e01c1;};var _=require(_0x5349('0x0'));var AWS=require(_0x5349('0x1'));var rp=require(_0x5349('0x2'));var util=require(_0x5349('0x3'));var BPromise=require(_0x5349('0x4'));var db=require(_0x5349('0x5'))['db'];var logger=require(_0x5349('0x6'))(_0x5349('0x7'));function getTranscriptionJob(_0xedbd32,_0x5912ac,_0x4034ba,_0x8283b5){return new Promise(function(_0x5ce2cd,_0xcb5a1){var _0x538385=new AWS[(_0x5349('0x8'))]({'accessKeyId':_0x5912ac,'secretAccessKey':_0xedbd32,'region':_0x4034ba});_0x538385['getTranscriptionJob']({'TranscriptionJobName':_0x8283b5},function(_0x393873,_0x583cee){if(_0x393873){return _0xcb5a1(_0x393873);}else{return _0x5ce2cd(_0x583cee);}});});}function sentiment(_0x1751b2,_0x3eaddf,_0x22a3d3,_0x23a1c7,_0x21bf91){return new Promise(function(_0x3a416e,_0x35d425){var _0x4bf160=new AWS[(_0x5349('0x9'))]({'accessKeyId':_0x3eaddf,'secretAccessKey':_0x1751b2,'region':_0x22a3d3});_0x4bf160['detectSentiment']({'Text':_0x23a1c7,'LanguageCode':_0x21bf91[_0x5349('0xa')](0x0,0x2)},function(_0x32b09b,_0xcf06a8){if(_0x32b09b){return _0x35d425(_0x32b09b);}else{return _0x3a416e(_0xcf06a8);}});});}function checkTranscribeJob(_0x11d230,_0x2f5172,_0x3c592a){var _0x642966;return new BPromise(function(_0x52c253,_0x3227bd){logger[_0x5349('0xb')](util['format'](_0x5349('0xc'),_0x11d230['id'],_0x11d230[_0x5349('0xd')]));return getTranscriptionJob(_0x3c592a['data1'],_0x3c592a[_0x5349('0xe')],_0x2f5172[_0x5349('0xf')],_0x11d230[_0x5349('0xd')])['then'](function(_0x5bcb3a){logger['info'](util[_0x5349('0x10')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x11d230['id'],_0x11d230[_0x5349('0xd')],_0x5bcb3a['TranscriptionJob'][_0x5349('0x11')]));if(!_0x11d230[_0x5349('0x12')]){switch(_0x5bcb3a[_0x5349('0x13')][_0x5349('0x11')]){case'COMPLETED':var _0x22d1ca={'transcribeStatus':_0x5bcb3a[_0x5349('0x13')][_0x5349('0x11')],'fileUri':_0x5bcb3a[_0x5349('0x13')]['Transcript'][_0x5349('0x14')]};logger[_0x5349('0xb')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x11d230['id']));return rp({'uri':_0x5bcb3a['TranscriptionJob'][_0x5349('0x15')]['TranscriptFileUri'],'json':!![]})[_0x5349('0x16')](function(_0x1ff911){logger[_0x5349('0xb')](util[_0x5349('0x10')](_0x5349('0x17'),_0x11d230['id']));if(_0x1ff911&&_0x1ff911[_0x5349('0x18')]&&_0x1ff911[_0x5349('0x18')][_0x5349('0x19')]&&_0x1ff911[_0x5349('0x18')][_0x5349('0x19')][_0x5349('0x1a')]){_0x22d1ca[_0x5349('0x12')]='';for(var _0x57af6c=0x0;_0x57af6c<_0x1ff911[_0x5349('0x18')][_0x5349('0x19')][_0x5349('0x1a')];_0x57af6c++){_0x22d1ca['fileText']+=_0x1ff911[_0x5349('0x18')]['transcripts'][_0x57af6c][_0x5349('0x1b')]+'';}}return _0x11d230[_0x5349('0x1c')](_0x22d1ca);})[_0x5349('0x16')](function(){logger['info'](util[_0x5349('0x10')](_0x5349('0x1d'),_0x11d230['id']));if(!_0x11d230[_0x5349('0x1e')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x21'));}if(!_0x2f5172[_0x5349('0x22')]||!_0x2f5172[_0x5349('0x23')]||!_0x2f5172[_0x5349('0x24')]||!_0x2f5172['language']||!_0x2f5172[_0x5349('0x25')]){throw new db[(_0x5349('0x1f'))]['ValidationError'](_0x5349('0x26'));}if(!_0x22d1ca['fileText']){throw new Error(_0x5349('0x27'));}if(_0x2f5172[_0x5349('0x23')]===_0x3c592a['id']){return _0x3c592a;}else{return db[_0x5349('0x28')][_0x5349('0x29')]({'where':{'id':_settings[_0x5349('0x23')]}});}})[_0x5349('0x16')](function(_0x545972){if(!_0x545972){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x2a'));}if(!_0x545972[_0x5349('0x2b')]||!_0x545972['data2']){throw new db['Sequelize'][(_0x5349('0x20'))](_0x5349('0x2c'));}_0x642966=_0x545972;logger[_0x5349('0xb')](util['format'](_0x5349('0x2d'),_0x11d230['id']));return sentiment(_0x642966['data1'],_0x642966[_0x5349('0xe')],_0x2f5172[_0x5349('0x24')],_0x22d1ca[_0x5349('0x12')],_0x2f5172[_0x5349('0x2e')]);})[_0x5349('0x16')](function(_0x196a93){logger['info'](util['format'](_0x5349('0x2f'),_0x11d230['id']));return _0x11d230[_0x5349('0x1c')]({'sentiment':_0x196a93[_0x5349('0x30')],'sPositive':_0x196a93[_0x5349('0x31')][_0x5349('0x32')],'sNegative':_0x196a93[_0x5349('0x31')][_0x5349('0x33')],'sMixed':_0x196a93['SentimentScore']['Mixed'],'sNeutral':_0x196a93[_0x5349('0x31')]['Neutral']});})['then'](function(){logger[_0x5349('0xb')](util['format'](_0x5349('0x1d'),_0x11d230['id']));_0x52c253();});case _0x5349('0x34'):return _0x11d230[_0x5349('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x5bcb3a[_0x5349('0x13')]['FailureReason']})[_0x5349('0x16')](function(){logger[_0x5349('0xb')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x11d230['id']));_0x52c253();});default:logger['info'](util['format'](_0x5349('0x35'),_0x11d230['id']));break;}}else{return BPromise[_0x5349('0x36')]()[_0x5349('0x16')](function(){if(!_0x11d230[_0x5349('0x1e')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2f5172['sentiment']||!_0x2f5172[_0x5349('0x23')]||!_0x2f5172[_0x5349('0x24')]||!_0x2f5172[_0x5349('0x2e')]||!_0x2f5172['bucket']){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x26'));}if(!_0x11d230[_0x5349('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x2f5172[_0x5349('0x23')]===_0x3c592a['id']){return _0x3c592a;}else{return db['CloudProvider'][_0x5349('0x29')]({'where':{'id':_settings[_0x5349('0x23')]}});}})['then'](function(_0x309539){if(!_0x309539){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x2a'));}if(!_0x309539[_0x5349('0x2b')]||!_0x309539[_0x5349('0xe')]){throw new db[(_0x5349('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x642966=_0x309539;logger[_0x5349('0xb')](util[_0x5349('0x10')](_0x5349('0x2d'),_0x11d230['id']));return sentiment(_0x642966[_0x5349('0x2b')],_0x642966['data2'],_0x2f5172[_0x5349('0x24')],_0x11d230['fileText'],_0x2f5172['language']);})[_0x5349('0x16')](function(_0x42d359){logger[_0x5349('0xb')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x11d230['id']));return _0x11d230[_0x5349('0x1c')]({'sentiment':_0x42d359[_0x5349('0x30')],'sPositive':_0x42d359[_0x5349('0x31')][_0x5349('0x32')],'sNegative':_0x42d359[_0x5349('0x31')][_0x5349('0x33')],'sMixed':_0x42d359[_0x5349('0x31')][_0x5349('0x37')],'sNeutral':_0x42d359[_0x5349('0x31')][_0x5349('0x38')],'transcribeStatus':_0x5349('0x39')});})[_0x5349('0x16')](function(){logger[_0x5349('0xb')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x11d230['id']));_0x52c253();});}})['catch'](function(_0x11d862){if(_0x11d862){if(!_0x11d862[_0x5349('0x3a')]||_0x11d862[_0x5349('0x3a')]!==_0x5349('0x3b')){logger[_0x5349('0x3c')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x11d230['id']),util[_0x5349('0x3d')](_0x11d862,{'showHidden':![],'depth':null}));}}_0x52c253();});});}function checkTranscribe(){var _0x37f59a;var _0x1fa080;var _0x3652dc;return db[_0x5349('0x3e')][_0x5349('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x5349('0x16')](function(_0x4fdb77){if(!_0x4fdb77||!_0x4fdb77[_0x5349('0x1a')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x40'));}_0x37f59a=_0x4fdb77;return db[_0x5349('0x41')]['findOne']({'where':{'id':0x1}});})[_0x5349('0x16')](function(_0x3fca72){if(!_0x3fca72){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))]('Settings\x20not\x20available');}_0x1fa080=_0x3fca72;if(!_0x1fa080[_0x5349('0x7')]||!_0x1fa080[_0x5349('0x42')]||!_0x1fa080[_0x5349('0xf')]||!_0x1fa080[_0x5349('0x2e')]||!_0x1fa080[_0x5349('0x25')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x43'));}return db[_0x5349('0x28')][_0x5349('0x29')]({'where':{'id':_0x1fa080[_0x5349('0x42')]}});})[_0x5349('0x16')](function(_0x1286a2){if(!_0x1286a2){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x2a'));}if(!_0x1286a2[_0x5349('0x2b')]||!_0x1286a2[_0x5349('0xe')]){throw new db['Sequelize'][(_0x5349('0x20'))](_0x5349('0x2c'));}_0x3652dc=_0x1286a2;var _0x59f481=[];_0x37f59a['forEach'](function(_0x346599){_0x59f481[_0x5349('0x44')](checkTranscribeJob(_0x346599,_0x1fa080,_0x3652dc));});return BPromise[_0x5349('0x45')](_0x59f481);})[_0x5349('0x46')](function(_0x25a93a){if(_0x25a93a){if(!_0x25a93a[_0x5349('0x3a')]||_0x25a93a[_0x5349('0x3a')]!=='SequelizeValidationError'){logger[_0x5349('0x3c')](util[_0x5349('0x3d')](_0x25a93a,{'showHidden':![],'depth':null}));}}});}exports[_0x5349('0x47')]=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 a14b4dc..067dd70 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 _0xcb15=['lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','update','timeout','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','inspect'];(function(_0x9b5820,_0x8fafe4){var _0x2828d4=function(_0x1f3545){while(--_0x1f3545){_0x9b5820['push'](_0x9b5820['shift']());}};_0x2828d4(++_0x8fafe4);}(_0xcb15,0x177));var _0x5cb1=function(_0x2bd10b,_0x4658b3){_0x2bd10b=_0x2bd10b-0x0;var _0x53580b=_0xcb15[_0x2bd10b];return _0x53580b;};'use strict';var _=require(_0x5cb1('0x0'));var moment=require(_0x5cb1('0x1'));var Redis=require(_0x5cb1('0x2'));var util=require('util');var config=require(_0x5cb1('0x3'));var db=require(_0x5cb1('0x4'))['db'];var logger=require(_0x5cb1('0x5'))('schedule');config['redis']=_['defaults'](config[_0x5cb1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5cb1('0x7'))(new Redis(config[_0x5cb1('0x6')]));function closeInteractions(){var _0x4bbcab=[];return db[_0x5cb1('0x8')][_0x5cb1('0x9')]({'raw':!![],'attributes':['id',_0x5cb1('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5cb1('0xb')](0x18,_0x5cb1('0xc'))}}})['then'](function(_0x5567c9){if(_0x5567c9&&_0x5567c9[_0x5cb1('0xd')]){_0x4bbcab=_[_0x5cb1('0xe')](_0x5567c9||[],'id');logger[_0x5cb1('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4bbcab['join']());return db['WhatsappInteraction'][_0x5cb1('0x10')]({'closeReason':'system','disposition':_0x5cb1('0x11'),'closed':!![],'closedAt':moment()[_0x5cb1('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4bbcab}});}})[_0x5cb1('0x13')](function(){if(_0x4bbcab&&_0x4bbcab['length']){logger[_0x5cb1('0xf')](_0x5cb1('0x14'),_0x4bbcab['join']());for(var _0x5c2017=0x0;_0x5c2017<_0x4bbcab[_0x5cb1('0xd')];_0x5c2017++){io[_0x5cb1('0x15')](_0x5cb1('0x16'),{'id':_0x4bbcab[_0x5c2017],'closed':!![]});}}})['catch'](function(_0x57dece){logger[_0x5cb1('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x57dece?util[_0x5cb1('0x18')](_0x57dece,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5934=['lastMsgAt','subtract','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','findAll'];(function(_0x1e96bb,_0x36b63d){var _0x45e559=function(_0x270744){while(--_0x270744){_0x1e96bb['push'](_0x1e96bb['shift']());}};_0x45e559(++_0x36b63d);}(_0x5934,0x1a6));var _0x4593=function(_0x17c16a,_0x3734f8){_0x17c16a=_0x17c16a-0x0;var _0x235d32=_0x5934[_0x17c16a];return _0x235d32;};'use strict';var _=require(_0x4593('0x0'));var moment=require(_0x4593('0x1'));var Redis=require(_0x4593('0x2'));var util=require(_0x4593('0x3'));var config=require(_0x4593('0x4'));var db=require(_0x4593('0x5'))['db'];var logger=require(_0x4593('0x6'))(_0x4593('0x7'));config['redis']=_['defaults'](config[_0x4593('0x8')],{'host':_0x4593('0x9'),'port':0x18eb});var io=require(_0x4593('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x475217=[];return db['WhatsappInteraction'][_0x4593('0xb')]({'raw':!![],'attributes':['id',_0x4593('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4593('0xd')](0x18,'hours')}}})[_0x4593('0xe')](function(_0x268d08){if(_0x268d08&&_0x268d08['length']){_0x475217=_[_0x4593('0xf')](_0x268d08||[],'id');logger['info'](_0x4593('0x10'),_0x475217['join']());return db[_0x4593('0x11')]['update']({'closeReason':_0x4593('0x12'),'disposition':_0x4593('0x13'),'closed':!![],'closedAt':moment()[_0x4593('0x14')](_0x4593('0x15'))},{'where':{'id':_0x475217}});}})[_0x4593('0xe')](function(){if(_0x475217&&_0x475217[_0x4593('0x16')]){logger[_0x4593('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x475217[_0x4593('0x18')]());for(var _0x2d00e5=0x0;_0x2d00e5<_0x475217[_0x4593('0x16')];_0x2d00e5++){io[_0x4593('0x19')](_0x4593('0x1a'),{'id':_0x475217[_0x2d00e5],'closed':!![]});}}})[_0x4593('0x1b')](function(_0x1d0e14){logger[_0x4593('0x1c')](_0x4593('0x1d'),_0x1d0e14?util[_0x4593('0x1e')](_0x1d0e14,{'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 9f86c84..e39f8eb 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefe3=['hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy'];(function(_0x3443d9,_0x698d6d){var _0x3ac2c1=function(_0x2836b3){while(--_0x2836b3){_0x3443d9['push'](_0x3443d9['shift']());}};_0x3ac2c1(++_0x698d6d);}(_0xefe3,0x134));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x3efe('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3efe('0x1')]({'id':i,'firstName':_0x3efe('0x2')+i,'lastName':_0x3efe('0x3')+i,'phone':0xf879fb460+i,'email':_0x3efe('0x4')+i+_0x3efe('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3efe('0x1')]({'id':i,'firstName':_0x3efe('0x2')+i,'lastName':_0x3efe('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3efe('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3efe('0x6')](),'updatedAt':Date[_0x3efe('0x6')]()});}db['CmContact']['destroy']({'where':{}})[_0x3efe('0x7')](function(){return db[_0x3efe('0x8')][_0x3efe('0x9')](contacts);})['then'](function(){console[_0x3efe('0xa')](_0x3efe('0xb'),_0x3efe('0xc'));return db[_0x3efe('0xd')][_0x3efe('0xe')]({'where':{}});})[_0x3efe('0x7')](function(){return db[_0x3efe('0xd')][_0x3efe('0x9')](hopper);})['then'](function(){console[_0x3efe('0xa')](_0x3efe('0xb'),_0x3efe('0xf'));return db[_0x3efe('0x8')][_0x3efe('0x9')](contacts2);})[_0x3efe('0x7')](function(){console[_0x3efe('0xa')](_0x3efe('0xb'),_0x3efe('0x10'));return db[_0x3efe('0xd')][_0x3efe('0x9')](hopper2);})[_0x3efe('0x7')](function(){console[_0x3efe('0xa')](_0x3efe('0xb'),_0x3efe('0x11'));})[_0x3efe('0x12')](function(_0x1ce7c3){console[_0x3efe('0xa')](_0x1ce7c3);}); \ No newline at end of file +var _0x5936=['log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate'];(function(_0x484813,_0xfd47d2){var _0x12602b=function(_0x2a66b0){while(--_0x2a66b0){_0x484813['push'](_0x484813['shift']());}};_0x12602b(++_0xfd47d2);}(_0x5936,0x1ed));var _0x6593=function(_0x3e8b3f,_0x17d8cc){_0x3e8b3f=_0x3e8b3f-0x0;var _0x302bae=_0x5936[_0x3e8b3f];return _0x302bae;};'use strict';var util=require(_0x6593('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6593('0x1')]({'id':i,'firstName':_0x6593('0x2')+i,'lastName':_0x6593('0x3')+i,'phone':0xf879fb460+i,'email':_0x6593('0x4')+i+_0x6593('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6593('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6593('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6593('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6593('0x1')]({'id':i,'firstName':_0x6593('0x2')+i,'lastName':_0x6593('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x6593('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6593('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6593('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6593('0x6')](),'updatedAt':Date[_0x6593('0x6')]()});}db[_0x6593('0x7')][_0x6593('0x8')]({'where':{}})[_0x6593('0x9')](function(){return db['CmContact'][_0x6593('0xa')](contacts);})['then'](function(){console[_0x6593('0xb')](_0x6593('0xc'),_0x6593('0xd'));return db[_0x6593('0xe')][_0x6593('0x8')]({'where':{}});})['then'](function(){return db[_0x6593('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0x6593('0xb')](_0x6593('0xc'),_0x6593('0xf'));return db[_0x6593('0x7')][_0x6593('0xa')](contacts2);})[_0x6593('0x9')](function(){console[_0x6593('0xb')](_0x6593('0xc'),'contacts2');return db['CmHopper'][_0x6593('0xa')](hopper2);})[_0x6593('0x9')](function(){console['log'](_0x6593('0xc'),_0x6593('0x10'));})[_0x6593('0x11')](function(_0xb1c138){console['log'](_0xb1c138);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e9cfd39..d449f54 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3828=['then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','password','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x459fb4,_0x1659a3){var _0x10dd67=function(_0x30477c){while(--_0x30477c){_0x459fb4['push'](_0x459fb4['shift']());}};_0x10dd67(++_0x1659a3);}(_0x3828,0x169));var _0x8382=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3828[_0x18ab2a];return _0x16dcee;};'use strict';var util=require(_0x8382('0x0'));var db=require(_0x8382('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8382('0x2')]({'name':util[_0x8382('0x3')]('%s%s',_0x8382('0x4'),i),'fullname':util[_0x8382('0x3')](_0x8382('0x5'),'agent',i),'email':util[_0x8382('0x3')]('%s%s@xcally.com',_0x8382('0x4'),i),'role':_0x8382('0x4'),'password':_0x8382('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x8382('0x7')],'disallow':[_0x8382('0x8')],'allow':[_0x8382('0x9')],'defaultuser':util['format'](_0x8382('0x5'),_0x8382('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':'yes','icesupport':_0x8382('0xa'),'dtlsenable':_0x8382('0xa'),'dtlsverify':'no','dtlscertfile':_0x8382('0xb'),'dtlsprivatekey':_0x8382('0xc'),'dtlssetup':_0x8382('0xd'),'callerid':util['format'](_0x8382('0xe'),util[_0x8382('0x3')](_0x8382('0x5'),'agent',i),0xfa0+i)});}db[_0x8382('0xf')][_0x8382('0x10')](users)[_0x8382('0x11')](function(){console[_0x8382('0x12')](_0x8382('0x13'));})[_0x8382('0x14')](function(_0x400ab7){console['log'](_0x400ab7);}); \ No newline at end of file +var _0x16e8=['wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x16e8,0xb3));var _0x816e=function(_0x18c3ca,_0x5100e2){_0x18c3ca=_0x18c3ca-0x0;var _0x52ec09=_0x16e8[_0x18c3ca];return _0x52ec09;};'use strict';var util=require(_0x816e('0x0'));var db=require(_0x816e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x816e('0x2')]({'name':util[_0x816e('0x3')](_0x816e('0x4'),_0x816e('0x5'),i),'fullname':util[_0x816e('0x3')](_0x816e('0x4'),_0x816e('0x5'),i),'email':util['format'](_0x816e('0x6'),_0x816e('0x5'),i),'role':_0x816e('0x5'),'password':_0x816e('0x7'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x816e('0x8')],'disallow':['all'],'allow':[_0x816e('0x9')],'defaultuser':util['format'](_0x816e('0x4'),_0x816e('0x5'),i),'encryption':_0x816e('0xa'),'avpf':'yes','force_avp':'yes','icesupport':'yes','dtlsenable':_0x816e('0xa'),'dtlsverify':'no','dtlscertfile':_0x816e('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x816e('0xc'),'callerid':util[_0x816e('0x3')](_0x816e('0xd'),util[_0x816e('0x3')]('%s%s',_0x816e('0x5'),i),0xfa0+i)});}db['User']['bulkCreate'](users)['then'](function(){console[_0x816e('0xe')](_0x816e('0xf'));})[_0x816e('0x10')](function(_0x20c69b){console[_0x816e('0xe')](_0x20c69b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8cccd50..3e35170 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2525=['SmsQueue','MailQueue','WhatsappQueue','userProfileId','VoiceQueue','OpenchannelQueue','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','chat','sms','mail','openchannel','telephone:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','connection','setMaxListeners','address','request','remotePort','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','telephone','agent','ivr','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','Campaign','where','type','format','length','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteractions','user:%s','role','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue'];(function(_0x3c6d2a,_0x2c06e1){var _0x2f8dfd=function(_0x2ba392){while(--_0x2ba392){_0x3c6d2a['push'](_0x3c6d2a['shift']());}};_0x2f8dfd(++_0x2c06e1);}(_0x2525,0x1f0));var _0x5252=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x2525[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x5252('0x0'));var util=require(_0x5252('0x1'));var BPromise=require(_0x5252('0x2'));var db=require(_0x5252('0x3'))['db'];var config=require(_0x5252('0x4'));var queryQueues={'attributes':['id',_0x5252('0x5')],'include':[{'as':_0x5252('0x6'),'model':db[_0x5252('0x7')],'attributes':['id',_0x5252('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5252('0x5')],'where':{'role':_0x5252('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5252('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x5252('0x5')],'where':{'role':_0x5252('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5252('0x5'),'type'],'where':{'type':_0x5252('0xa')}};function getAssociatedResources(_0x551912,_0x149787,_0x3c8d35){return db['UserProfileSection']['findOne']({'where':{'name':_0x551912,'userProfileId':_0x149787},'raw':!![]})[_0x5252('0xb')](function(_0x5289ce){if(_0x5289ce){if(_0x5289ce[_0x5252('0xc')]){switch(_0x551912){case _0x5252('0xd'):case _0x5252('0xe'):case _0x5252('0xf'):case _0x5252('0x10'):case _0x5252('0x11'):case _0x5252('0x12'):case _0x5252('0x13'):return db[_0x3c8d35][_0x5252('0x14')](queryQueues);case _0x5252('0x15'):return db[_0x3c8d35][_0x5252('0x14')](queryTelephones);case _0x5252('0x16'):return db[_0x3c8d35][_0x5252('0x14')](queryTrunks);case _0x5252('0x17'):return db[_0x3c8d35]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x5252('0x14')]({'attributes':[_0x5252('0x18')],'where':{'sectionId':_0x5289ce['id']},'raw':!![]})[_0x5252('0xb')](function(_0x9ddda){if(_0x9ddda){var _0x399a71={'where':{'id':_[_0x5252('0x19')](_0x9ddda,_0x5252('0x18'))},'raw':!![]};switch(_0x3c8d35){case'User':_0x399a71['where']['role']=_0x5252('0x8');break;case _0x5252('0x1a'):_0x399a71[_0x5252('0x1b')][_0x5252('0x1c')]=_0x5252('0xa');break;}return db[_0x3c8d35][_0x5252('0x14')](_0x399a71);}else{return[];}});}}else{return[];}})[_0x5252('0xb')](function(_0x4c18d0){return _0x4c18d0;});}function joinOrLeaveQueues(_0x26faf5,_0x151108,_0xb0131b,_0x428553){_0x26faf5[_0x151108](util[_0x5252('0x1d')]('%s:queue:%s',_0xb0131b,_0x428553[_0x5252('0x5')]));if(_0x428553[_0x5252('0x6')]){for(var _0x3f77ff=0x0;_0x3f77ff<_0x428553[_0x5252('0x6')][_0x5252('0x1e')];_0x3f77ff+=0x1){_0x26faf5[_0x151108](util[_0x5252('0x1d')]('user:%s',_0x428553[_0x5252('0x6')][_0x3f77ff][_0x5252('0x5')]));}}}function joinOrLeave(_0x57ec1b,_0x5377b0,_0x531417){var _0x509055;if(_0x57ec1b[_0x5252('0x1f')][_0x5252('0x20')]['id']){db['User'][_0x5252('0x21')]({'attributes':['id',_0x5252('0x5'),'role','userProfileId'],'where':{'id':_0x57ec1b[_0x5252('0x1f')]['query']['id']},'include':[{'model':db[_0x5252('0x22')],'as':_0x5252('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x5252('0x24')],'as':_0x5252('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x5252('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x5252('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x5252('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x4ac8b8){if(_0x4ac8b8){_0x509055=_0x4ac8b8;_0x57ec1b[_0x5377b0](util[_0x5252('0x1d')](_0x5252('0x29'),_0x4ac8b8[_0x5252('0x5')]));var _0x55f3b5=[];switch(_0x4ac8b8[_0x5252('0x2a')]){case _0x5252('0x2b'):_0x57ec1b[_0x5377b0](_0x5252('0x2c'));_0x57ec1b[_0x5377b0](_0x5252('0x2d'));if(queryQueues[_0x5252('0x2e')](_0x5252('0x2f'))){delete queryQueues[_0x5252('0x2f')];}_0x55f3b5[_0x5252('0x30')](db['VoiceQueue'][_0x5252('0x14')](queryQueues));_0x55f3b5['push'](db[_0x5252('0x31')][_0x5252('0x14')](queryQueues));_0x55f3b5[_0x5252('0x30')](db['FaxQueue'][_0x5252('0x14')](queryQueues));_0x55f3b5['push'](db[_0x5252('0x32')][_0x5252('0x14')](queryQueues));_0x55f3b5[_0x5252('0x30')](db[_0x5252('0x33')]['findAll'](queryQueues));_0x55f3b5[_0x5252('0x30')](db['OpenchannelQueue']['findAll'](queryQueues));_0x55f3b5['push'](db[_0x5252('0x34')]['findAll'](queryQueues));_0x55f3b5[_0x5252('0x30')](db[_0x5252('0x7')][_0x5252('0x14')](queryTelephones));_0x55f3b5[_0x5252('0x30')](db['Trunk']['findAll'](queryTrunks));_0x55f3b5['push'](db['Campaign'][_0x5252('0x14')](queryCampaigns));_0x55f3b5[_0x5252('0x30')](db[_0x5252('0x7')][_0x5252('0x14')](queryAgents));break;case'user':_0x57ec1b[_0x5377b0](_0x5252('0x2c'));_0x57ec1b[_0x5377b0](_0x5252('0x2d'));_0x55f3b5['push'](getAssociatedResources(_0x5252('0xd'),_0x4ac8b8[_0x5252('0x35')],_0x5252('0x36')));_0x55f3b5['push'](getAssociatedResources('ChatQueues',_0x4ac8b8[_0x5252('0x35')],_0x5252('0x31')));_0x55f3b5[_0x5252('0x30')](getAssociatedResources(_0x5252('0xf'),_0x4ac8b8[_0x5252('0x35')],'FaxQueue'));_0x55f3b5[_0x5252('0x30')](getAssociatedResources(_0x5252('0x10'),_0x4ac8b8['userProfileId'],_0x5252('0x32')));_0x55f3b5[_0x5252('0x30')](getAssociatedResources('MailQueues',_0x4ac8b8[_0x5252('0x35')],_0x5252('0x33')));_0x55f3b5[_0x5252('0x30')](getAssociatedResources(_0x5252('0x12'),_0x4ac8b8[_0x5252('0x35')],_0x5252('0x37')));_0x55f3b5['push'](getAssociatedResources('WhatsappQueues',_0x4ac8b8[_0x5252('0x35')],'WhatsappQueue'));_0x55f3b5[_0x5252('0x30')](getAssociatedResources('Telephones',_0x4ac8b8[_0x5252('0x35')],_0x5252('0x7')));_0x55f3b5['push'](getAssociatedResources(_0x5252('0x16'),_0x4ac8b8['userProfileId'],_0x5252('0x38')));_0x55f3b5[_0x5252('0x30')](getAssociatedResources(_0x5252('0x17'),_0x4ac8b8[_0x5252('0x35')],_0x5252('0x1a')));_0x55f3b5[_0x5252('0x30')](db['User']['findAll'](queryAgents));break;case _0x5252('0x9'):_0x57ec1b[_0x5377b0](_0x5252('0x2c'));_0x57ec1b[_0x5377b0](_0x5252('0x2d'));_0x55f3b5[_0x5252('0x30')](_0x4ac8b8['getVoiceQueues']({'attributes':['id','name']}));_0x55f3b5[_0x5252('0x30')](_0x4ac8b8[_0x5252('0x39')]({'attributes':['id',_0x5252('0x5')]}));_0x55f3b5['push'](_0x4ac8b8[_0x5252('0x3a')]({'attributes':['id',_0x5252('0x5')]}));_0x55f3b5['push'](_0x4ac8b8[_0x5252('0x3b')]({'attributes':['id',_0x5252('0x5')]}));_0x55f3b5[_0x5252('0x30')](_0x4ac8b8['getMailQueues']({'attributes':['id',_0x5252('0x5')]}));_0x55f3b5[_0x5252('0x30')](_0x4ac8b8['getOpenchannelQueues']({'attributes':['id',_0x5252('0x5')]}));_0x55f3b5['push'](_0x4ac8b8[_0x5252('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0x5252('0x3d')](_0x55f3b5);}})['then'](function(_0x2b6b5f){if(_0x2b6b5f&&_0x2b6b5f[_0x5252('0x1e')]){for(var _0x2eba22=0x0;_0x2eba22<_0x2b6b5f[_0x5252('0x1e')];_0x2eba22+=0x1){for(var _0x2219d8=0x0;_0x2219d8<_0x2b6b5f[_0x2eba22][_0x5252('0x1e')];_0x2219d8+=0x1){switch(_0x2eba22){case 0x0:joinOrLeaveQueues(_0x57ec1b,_0x5377b0,'voice',_0x2b6b5f[_0x2eba22][_0x2219d8]);break;case 0x1:joinOrLeaveQueues(_0x57ec1b,_0x5377b0,_0x5252('0x3e'),_0x2b6b5f[_0x2eba22][_0x2219d8]);break;case 0x2:joinOrLeaveQueues(_0x57ec1b,_0x5377b0,'fax',_0x2b6b5f[_0x2eba22][_0x2219d8]);break;case 0x3:joinOrLeaveQueues(_0x57ec1b,_0x5377b0,_0x5252('0x3f'),_0x2b6b5f[_0x2eba22][_0x2219d8]);break;case 0x4:joinOrLeaveQueues(_0x57ec1b,_0x5377b0,_0x5252('0x40'),_0x2b6b5f[_0x2eba22][_0x2219d8]);break;case 0x5:joinOrLeaveQueues(_0x57ec1b,_0x5377b0,_0x5252('0x41'),_0x2b6b5f[_0x2eba22][_0x2219d8]);break;case 0x6:joinOrLeaveQueues(_0x57ec1b,_0x5377b0,'whatsapp',_0x2b6b5f[_0x2eba22][_0x2219d8]);break;case 0x7:if(_0x509055['role']!==_0x5252('0x9'))_0x57ec1b[_0x5377b0](util['format'](_0x5252('0x42'),_0x2b6b5f[_0x2eba22][_0x2219d8]['name']));break;case 0x8:if(_0x509055[_0x5252('0x2a')]!==_0x5252('0x9'))_0x57ec1b[_0x5377b0](util[_0x5252('0x1d')]('trunk:%s',_0x2b6b5f[_0x2eba22][_0x2219d8][_0x5252('0x5')]));break;case 0x9:if(_0x509055[_0x5252('0x2a')]!=='agent')_0x57ec1b[_0x5377b0](util['format']('campaign:%s:%s',_0x2b6b5f[_0x2eba22][_0x2219d8]['type'],_0x2b6b5f[_0x2eba22][_0x2219d8][_0x5252('0x5')]));break;case 0xa:_0x57ec1b[_0x5377b0](util[_0x5252('0x1d')]('user:%s',_0x2b6b5f[_0x2eba22][_0x2219d8]['name']));break;}}}}})['then'](function(){if(_0x5377b0===_0x5252('0x43')){var _0x41423e=_[_0x5252('0x19')](_0x509055[_0x5252('0x23')],'id');return _0x509055[_0x5252('0x44')](_0x41423e)['then'](function(){for(var _0x5275b7=0x0;_0x5275b7<_0x41423e[_0x5252('0x1e')];_0x5275b7+=0x1){_0x531417[_0x5252('0x45')](_0x5252('0x46'),{'ChatInteractionId':Number(_0x41423e[_0x5275b7]),'UserId':Number(_0x509055['id'])});}});}})[_0x5252('0xb')](function(){if(_0x5377b0==='leave'){var _0x3d4c87=_[_0x5252('0x19')](_0x509055['MailInteractions'],'id');return _0x509055[_0x5252('0x47')](_0x3d4c87)[_0x5252('0xb')](function(){for(var _0x24576b=0x0;_0x24576b<_0x3d4c87['length'];_0x24576b+=0x1){_0x531417[_0x5252('0x45')](_0x5252('0x48'),{'MailInteractionId':Number(_0x3d4c87[_0x24576b]),'UserId':Number(_0x509055['id'])});}});}})[_0x5252('0xb')](function(){if(_0x5377b0==='leave'){var _0x5e706c=_['map'](_0x509055[_0x5252('0x49')],'id');return _0x509055[_0x5252('0x4a')](_0x5e706c)[_0x5252('0xb')](function(){for(var _0x30c64e=0x0;_0x30c64e<_0x5e706c[_0x5252('0x1e')];_0x30c64e+=0x1){_0x531417[_0x5252('0x45')](_0x5252('0x4b'),{'FaxInteractionId':Number(_0x5e706c[_0x30c64e]),'UserId':Number(_0x509055['id'])});}});}})[_0x5252('0xb')](function(){if(_0x5377b0===_0x5252('0x43')){var _0x516dae=_['map'](_0x509055[_0x5252('0x27')],'id');return _0x509055['removeSmsInteractions'](_0x516dae)[_0x5252('0xb')](function(){for(var _0x871f5c=0x0;_0x871f5c<_0x516dae['length'];_0x871f5c+=0x1){_0x531417[_0x5252('0x45')](_0x5252('0x4c'),{'SmsInteractionId':Number(_0x516dae[_0x871f5c]),'UserId':Number(_0x509055['id'])});}});}})[_0x5252('0xb')](function(){if(_0x5377b0==='leave'){var _0x287418=_['map'](_0x509055[_0x5252('0x28')],'id');return _0x509055['removeOpenchannelInteractions'](_0x287418)[_0x5252('0xb')](function(){for(var _0x1ff9a9=0x0;_0x1ff9a9<_0x287418[_0x5252('0x1e')];_0x1ff9a9+=0x1){_0x531417[_0x5252('0x45')](_0x5252('0x4d'),{'OpenchannelInteractionId':Number(_0x287418[_0x1ff9a9]),'UserId':Number(_0x509055['id'])});}});}})[_0x5252('0xb')](function(){if(_0x5377b0===_0x5252('0x43')){var _0x1b4e84=_[_0x5252('0x19')](_0x509055[_0x5252('0x4e')],'id');return _0x509055[_0x5252('0x4f')](_0x1b4e84)['then'](function(){for(var _0x3da40c=0x0;_0x3da40c<_0x1b4e84[_0x5252('0x1e')];_0x3da40c+=0x1){_0x531417[_0x5252('0x45')](_0x5252('0x50'),{'WhatsappInteractionId':Number(_0x1b4e84[_0x3da40c]),'UserId':Number(_0x509055['id'])});}});}})['catch'](function(_0xe613bc){_0x57ec1b['log'](_0xe613bc);});}}function onDisconnect(_0x385bbe,_0x3041c8){joinOrLeave(_0x385bbe,'leave',_0x3041c8);}function onConnect(_0xc66377){joinOrLeave(_0xc66377,'join');}exports['default']=function(_0x2a4c81){_0x2a4c81['on'](_0x5252('0x51'),function(_0x3728e8){_0x3728e8[_0x5252('0x52')](0x0);_0x3728e8[_0x5252('0x53')]=_0x3728e8['request'][_0x5252('0x51')]['remoteAddress']+':'+_0x3728e8[_0x5252('0x54')]['connection'][_0x5252('0x55')];_0x3728e8['connectedAt']=new Date();_0x3728e8[_0x5252('0x56')]=function(_0x2f663f){console['log'](_0x5252('0x57')+_0x3728e8[_0x5252('0x58')][_0x5252('0x5')]+'['+_0x3728e8[_0x5252('0x53')]+']',_0x2f663f);};_0x3728e8['on']('disconnect',function(){onDisconnect(_0x3728e8,_0x2a4c81);_0x3728e8['log'](_0x5252('0x59'));});onConnect(_0x3728e8);_0x3728e8[_0x5252('0x56')](_0x5252('0x5a'));});}; \ No newline at end of file +var _0xc1db=['lodash','bluebird','../mysqldb','./environment','name','Agents','role','agent','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','map','resourceId','User','Campaign','where','format','%s:queue:%s','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','userProfileId','MailQueue','OpenchannelQueues','Telephones','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','length','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','emit','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED'];(function(_0x43bd18,_0x543717){var _0x45c504=function(_0x54f138){while(--_0x54f138){_0x43bd18['push'](_0x43bd18['shift']());}};_0x45c504(++_0x543717);}(_0xc1db,0x120));var _0xbc1d=function(_0x211b47,_0x36e680){_0x211b47=_0x211b47-0x0;var _0x4e3cb7=_0xc1db[_0x211b47];return _0x4e3cb7;};'use strict';var _=require(_0xbc1d('0x0'));var util=require('util');var BPromise=require(_0xbc1d('0x1'));var db=require(_0xbc1d('0x2'))['db'];var config=require(_0xbc1d('0x3'));var queryQueues={'attributes':['id',_0xbc1d('0x4')],'include':[{'as':_0xbc1d('0x5'),'model':db['User'],'attributes':['id',_0xbc1d('0x4'),_0xbc1d('0x6')],'raw':!![],'where':{'role':_0xbc1d('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xbc1d('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbc1d('0x4'),'type'],'where':{'type':_0xbc1d('0x8')}};function getAssociatedResources(_0x451e8d,_0x4c2d30,_0x45468e){return db['UserProfileSection'][_0xbc1d('0x9')]({'where':{'name':_0x451e8d,'userProfileId':_0x4c2d30},'raw':!![]})[_0xbc1d('0xa')](function(_0x51282b){if(_0x51282b){if(_0x51282b[_0xbc1d('0xb')]){switch(_0x451e8d){case _0xbc1d('0xc'):case _0xbc1d('0xd'):case _0xbc1d('0xe'):case'SmsQueues':case _0xbc1d('0xf'):case'OpenchannelQueues':case _0xbc1d('0x10'):return db[_0x45468e][_0xbc1d('0x11')](queryQueues);case'Telephones':return db[_0x45468e][_0xbc1d('0x11')](queryTelephones);case _0xbc1d('0x12'):return db[_0x45468e]['findAll'](queryTrunks);case _0xbc1d('0x13'):return db[_0x45468e][_0xbc1d('0x11')](queryCampaigns);}}else{return db['UserProfileResource'][_0xbc1d('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x51282b['id']},'raw':!![]})[_0xbc1d('0xa')](function(_0x238c0d){if(_0x238c0d){var _0xfe7015={'where':{'id':_[_0xbc1d('0x14')](_0x238c0d,_0xbc1d('0x15'))},'raw':!![]};switch(_0x45468e){case _0xbc1d('0x16'):_0xfe7015['where'][_0xbc1d('0x6')]='telephone';break;case _0xbc1d('0x17'):_0xfe7015[_0xbc1d('0x18')]['type']='ivr';break;}return db[_0x45468e]['findAll'](_0xfe7015);}else{return[];}});}}else{return[];}})[_0xbc1d('0xa')](function(_0x403afc){return _0x403afc;});}function joinOrLeaveQueues(_0x44887e,_0x1bd6d7,_0x51415f,_0x284987){_0x44887e[_0x1bd6d7](util[_0xbc1d('0x19')](_0xbc1d('0x1a'),_0x51415f,_0x284987[_0xbc1d('0x4')]));if(_0x284987['Agents']){for(var _0x5ab558=0x0;_0x5ab558<_0x284987[_0xbc1d('0x5')]['length'];_0x5ab558+=0x1){_0x44887e[_0x1bd6d7](util[_0xbc1d('0x19')]('user:%s',_0x284987[_0xbc1d('0x5')][_0x5ab558][_0xbc1d('0x4')]));}}}function joinOrLeave(_0x5c026d,_0x1951a1,_0x1890c0){var _0x3955ab;if(_0x5c026d['handshake']['query']['id']){db[_0xbc1d('0x16')]['find']({'attributes':['id',_0xbc1d('0x4'),_0xbc1d('0x6'),'userProfileId'],'where':{'id':_0x5c026d['handshake'][_0xbc1d('0x1b')]['id']},'include':[{'model':db[_0xbc1d('0x1c')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbc1d('0x1d')],'as':_0xbc1d('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0xbc1d('0x1f')],'as':_0xbc1d('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xbc1d('0x21')],'as':_0xbc1d('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xbc1d('0x23')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbc1d('0x24')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x40d1e2){if(_0x40d1e2){_0x3955ab=_0x40d1e2;_0x5c026d[_0x1951a1](util[_0xbc1d('0x19')](_0xbc1d('0x25'),_0x40d1e2[_0xbc1d('0x4')]));var _0x507310=[];switch(_0x40d1e2[_0xbc1d('0x6')]){case _0xbc1d('0x26'):_0x5c026d[_0x1951a1](_0xbc1d('0x27'));_0x5c026d[_0x1951a1](_0xbc1d('0x28'));if(queryQueues[_0xbc1d('0x29')](_0xbc1d('0x2a'))){delete queryQueues[_0xbc1d('0x2a')];}_0x507310[_0xbc1d('0x2b')](db[_0xbc1d('0x2c')][_0xbc1d('0x11')](queryQueues));_0x507310[_0xbc1d('0x2b')](db[_0xbc1d('0x2d')][_0xbc1d('0x11')](queryQueues));_0x507310['push'](db[_0xbc1d('0x2e')][_0xbc1d('0x11')](queryQueues));_0x507310[_0xbc1d('0x2b')](db[_0xbc1d('0x2f')][_0xbc1d('0x11')](queryQueues));_0x507310[_0xbc1d('0x2b')](db['MailQueue'][_0xbc1d('0x11')](queryQueues));_0x507310[_0xbc1d('0x2b')](db[_0xbc1d('0x30')]['findAll'](queryQueues));_0x507310[_0xbc1d('0x2b')](db[_0xbc1d('0x31')][_0xbc1d('0x11')](queryQueues));_0x507310['push'](db[_0xbc1d('0x16')][_0xbc1d('0x11')](queryTelephones));_0x507310[_0xbc1d('0x2b')](db[_0xbc1d('0x32')]['findAll'](queryTrunks));_0x507310['push'](db[_0xbc1d('0x17')][_0xbc1d('0x11')](queryCampaigns));_0x507310[_0xbc1d('0x2b')](db['User']['findAll'](queryAgents));break;case'user':_0x5c026d[_0x1951a1]('voice:inbound');_0x5c026d[_0x1951a1](_0xbc1d('0x28'));_0x507310[_0xbc1d('0x2b')](getAssociatedResources(_0xbc1d('0xc'),_0x40d1e2[_0xbc1d('0x33')],_0xbc1d('0x2c')));_0x507310[_0xbc1d('0x2b')](getAssociatedResources('ChatQueues',_0x40d1e2[_0xbc1d('0x33')],'ChatQueue'));_0x507310[_0xbc1d('0x2b')](getAssociatedResources('FaxQueues',_0x40d1e2[_0xbc1d('0x33')],_0xbc1d('0x2e')));_0x507310[_0xbc1d('0x2b')](getAssociatedResources('SmsQueues',_0x40d1e2[_0xbc1d('0x33')],_0xbc1d('0x2f')));_0x507310[_0xbc1d('0x2b')](getAssociatedResources(_0xbc1d('0xf'),_0x40d1e2['userProfileId'],_0xbc1d('0x34')));_0x507310[_0xbc1d('0x2b')](getAssociatedResources(_0xbc1d('0x35'),_0x40d1e2[_0xbc1d('0x33')],_0xbc1d('0x30')));_0x507310[_0xbc1d('0x2b')](getAssociatedResources(_0xbc1d('0x10'),_0x40d1e2[_0xbc1d('0x33')],'WhatsappQueue'));_0x507310[_0xbc1d('0x2b')](getAssociatedResources(_0xbc1d('0x36'),_0x40d1e2['userProfileId'],_0xbc1d('0x16')));_0x507310[_0xbc1d('0x2b')](getAssociatedResources('Trunks',_0x40d1e2['userProfileId'],_0xbc1d('0x32')));_0x507310[_0xbc1d('0x2b')](getAssociatedResources(_0xbc1d('0x13'),_0x40d1e2['userProfileId'],_0xbc1d('0x17')));_0x507310[_0xbc1d('0x2b')](db[_0xbc1d('0x16')][_0xbc1d('0x11')](queryAgents));break;case'agent':_0x5c026d[_0x1951a1](_0xbc1d('0x27'));_0x5c026d[_0x1951a1]('voice:outbound');_0x507310[_0xbc1d('0x2b')](_0x40d1e2[_0xbc1d('0x37')]({'attributes':['id','name']}));_0x507310[_0xbc1d('0x2b')](_0x40d1e2[_0xbc1d('0x38')]({'attributes':['id',_0xbc1d('0x4')]}));_0x507310[_0xbc1d('0x2b')](_0x40d1e2['getFaxQueues']({'attributes':['id',_0xbc1d('0x4')]}));_0x507310['push'](_0x40d1e2[_0xbc1d('0x39')]({'attributes':['id','name']}));_0x507310[_0xbc1d('0x2b')](_0x40d1e2['getMailQueues']({'attributes':['id',_0xbc1d('0x4')]}));_0x507310[_0xbc1d('0x2b')](_0x40d1e2[_0xbc1d('0x3a')]({'attributes':['id',_0xbc1d('0x4')]}));_0x507310[_0xbc1d('0x2b')](_0x40d1e2['getWhatsappQueues']({'attributes':['id',_0xbc1d('0x4')]}));break;}return BPromise['all'](_0x507310);}})['then'](function(_0x398f1a){if(_0x398f1a&&_0x398f1a[_0xbc1d('0x3b')]){for(var _0x25f94c=0x0;_0x25f94c<_0x398f1a[_0xbc1d('0x3b')];_0x25f94c+=0x1){for(var _0x390b4d=0x0;_0x390b4d<_0x398f1a[_0x25f94c]['length'];_0x390b4d+=0x1){switch(_0x25f94c){case 0x0:joinOrLeaveQueues(_0x5c026d,_0x1951a1,'voice',_0x398f1a[_0x25f94c][_0x390b4d]);break;case 0x1:joinOrLeaveQueues(_0x5c026d,_0x1951a1,_0xbc1d('0x3c'),_0x398f1a[_0x25f94c][_0x390b4d]);break;case 0x2:joinOrLeaveQueues(_0x5c026d,_0x1951a1,_0xbc1d('0x3d'),_0x398f1a[_0x25f94c][_0x390b4d]);break;case 0x3:joinOrLeaveQueues(_0x5c026d,_0x1951a1,'sms',_0x398f1a[_0x25f94c][_0x390b4d]);break;case 0x4:joinOrLeaveQueues(_0x5c026d,_0x1951a1,_0xbc1d('0x3e'),_0x398f1a[_0x25f94c][_0x390b4d]);break;case 0x5:joinOrLeaveQueues(_0x5c026d,_0x1951a1,_0xbc1d('0x3f'),_0x398f1a[_0x25f94c][_0x390b4d]);break;case 0x6:joinOrLeaveQueues(_0x5c026d,_0x1951a1,_0xbc1d('0x40'),_0x398f1a[_0x25f94c][_0x390b4d]);break;case 0x7:if(_0x3955ab[_0xbc1d('0x6')]!==_0xbc1d('0x7'))_0x5c026d[_0x1951a1](util[_0xbc1d('0x19')](_0xbc1d('0x41'),_0x398f1a[_0x25f94c][_0x390b4d][_0xbc1d('0x4')]));break;case 0x8:if(_0x3955ab[_0xbc1d('0x6')]!==_0xbc1d('0x7'))_0x5c026d[_0x1951a1](util[_0xbc1d('0x19')](_0xbc1d('0x42'),_0x398f1a[_0x25f94c][_0x390b4d][_0xbc1d('0x4')]));break;case 0x9:if(_0x3955ab[_0xbc1d('0x6')]!==_0xbc1d('0x7'))_0x5c026d[_0x1951a1](util[_0xbc1d('0x19')](_0xbc1d('0x43'),_0x398f1a[_0x25f94c][_0x390b4d][_0xbc1d('0x44')],_0x398f1a[_0x25f94c][_0x390b4d]['name']));break;case 0xa:_0x5c026d[_0x1951a1](util[_0xbc1d('0x19')](_0xbc1d('0x25'),_0x398f1a[_0x25f94c][_0x390b4d][_0xbc1d('0x4')]));break;}}}}})[_0xbc1d('0xa')](function(){if(_0x1951a1===_0xbc1d('0x45')){var _0x2300b9=_[_0xbc1d('0x14')](_0x3955ab['ChatInteractions'],'id');return _0x3955ab['removeChatInteractions'](_0x2300b9)[_0xbc1d('0xa')](function(){for(var _0x132fe5=0x0;_0x132fe5<_0x2300b9[_0xbc1d('0x3b')];_0x132fe5+=0x1){_0x1890c0[_0xbc1d('0x46')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2300b9[_0x132fe5]),'UserId':Number(_0x3955ab['id'])});}});}})[_0xbc1d('0xa')](function(){if(_0x1951a1===_0xbc1d('0x45')){var _0x1971fe=_[_0xbc1d('0x14')](_0x3955ab[_0xbc1d('0x1e')],'id');return _0x3955ab[_0xbc1d('0x47')](_0x1971fe)['then'](function(){for(var _0x3b15a4=0x0;_0x3b15a4<_0x1971fe[_0xbc1d('0x3b')];_0x3b15a4+=0x1){_0x1890c0[_0xbc1d('0x46')](_0xbc1d('0x48'),{'MailInteractionId':Number(_0x1971fe[_0x3b15a4]),'UserId':Number(_0x3955ab['id'])});}});}})[_0xbc1d('0xa')](function(){if(_0x1951a1===_0xbc1d('0x45')){var _0x239bfb=_[_0xbc1d('0x14')](_0x3955ab[_0xbc1d('0x20')],'id');return _0x3955ab['removeFaxInteractions'](_0x239bfb)[_0xbc1d('0xa')](function(){for(var _0x271a2b=0x0;_0x271a2b<_0x239bfb[_0xbc1d('0x3b')];_0x271a2b+=0x1){_0x1890c0[_0xbc1d('0x46')](_0xbc1d('0x49'),{'FaxInteractionId':Number(_0x239bfb[_0x271a2b]),'UserId':Number(_0x3955ab['id'])});}});}})[_0xbc1d('0xa')](function(){if(_0x1951a1===_0xbc1d('0x45')){var _0x12d0fe=_[_0xbc1d('0x14')](_0x3955ab[_0xbc1d('0x22')],'id');return _0x3955ab[_0xbc1d('0x4a')](_0x12d0fe)[_0xbc1d('0xa')](function(){for(var _0xc8af7a=0x0;_0xc8af7a<_0x12d0fe[_0xbc1d('0x3b')];_0xc8af7a+=0x1){_0x1890c0['emit'](_0xbc1d('0x4b'),{'SmsInteractionId':Number(_0x12d0fe[_0xc8af7a]),'UserId':Number(_0x3955ab['id'])});}});}})[_0xbc1d('0xa')](function(){if(_0x1951a1===_0xbc1d('0x45')){var _0x3ef112=_['map'](_0x3955ab['OpenchannelInteractions'],'id');return _0x3955ab[_0xbc1d('0x4c')](_0x3ef112)[_0xbc1d('0xa')](function(){for(var _0x2dd522=0x0;_0x2dd522<_0x3ef112[_0xbc1d('0x3b')];_0x2dd522+=0x1){_0x1890c0[_0xbc1d('0x46')](_0xbc1d('0x4d'),{'OpenchannelInteractionId':Number(_0x3ef112[_0x2dd522]),'UserId':Number(_0x3955ab['id'])});}});}})[_0xbc1d('0xa')](function(){if(_0x1951a1===_0xbc1d('0x45')){var _0x57ee3b=_['map'](_0x3955ab[_0xbc1d('0x4e')],'id');return _0x3955ab[_0xbc1d('0x4f')](_0x57ee3b)[_0xbc1d('0xa')](function(){for(var _0x4ca3f3=0x0;_0x4ca3f3<_0x57ee3b[_0xbc1d('0x3b')];_0x4ca3f3+=0x1){_0x1890c0['emit'](_0xbc1d('0x50'),{'WhatsappInteractionId':Number(_0x57ee3b[_0x4ca3f3]),'UserId':Number(_0x3955ab['id'])});}});}})[_0xbc1d('0x51')](function(_0x29d919){_0x5c026d[_0xbc1d('0x52')](_0x29d919);});}}function onDisconnect(_0x51b4cd,_0x1a6848){joinOrLeave(_0x51b4cd,_0xbc1d('0x45'),_0x1a6848);}function onConnect(_0x3604f9){joinOrLeave(_0x3604f9,_0xbc1d('0x53'));}exports[_0xbc1d('0x54')]=function(_0x330570){_0x330570['on'](_0xbc1d('0x55'),function(_0x4a4c9e){_0x4a4c9e[_0xbc1d('0x56')](0x0);_0x4a4c9e[_0xbc1d('0x57')]=_0x4a4c9e[_0xbc1d('0x58')][_0xbc1d('0x55')][_0xbc1d('0x59')]+':'+_0x4a4c9e['request'][_0xbc1d('0x55')][_0xbc1d('0x5a')];_0x4a4c9e[_0xbc1d('0x5b')]=new Date();_0x4a4c9e[_0xbc1d('0x52')]=function(_0x289b98){console[_0xbc1d('0x52')](_0xbc1d('0x5c')+_0x4a4c9e[_0xbc1d('0x5d')][_0xbc1d('0x4')]+'['+_0x4a4c9e[_0xbc1d('0x57')]+']',_0x289b98);};_0x4a4c9e['on']('disconnect',function(){onDisconnect(_0x4a4c9e,_0x330570);_0x4a4c9e[_0xbc1d('0x52')](_0xbc1d('0x5e'));});onConnect(_0x4a4c9e);_0x4a4c9e['log'](_0xbc1d('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 80f6407..a96b4b8 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 _0xf036=['catch','AfterCreateMessage','offlineMessage','opened','contact','AfterCreate','changed','closed','substatus','interface','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','afterCreate','newmessage','Sms','SmsInteraction','closedinteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','get','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage'];(function(_0x3cede0,_0x3b8a15){var _0x323fa2=function(_0x48e440){while(--_0x48e440){_0x3cede0['push'](_0x3cede0['shift']());}};_0x323fa2(++_0x3b8a15);}(_0xf036,0xf3));var _0x6f03=function(_0x4d888e,_0x5ea774){_0x4d888e=_0x4d888e-0x0;var _0x41139c=_0xf036[_0x4d888e];return _0x41139c;};'use strict';var util=require(_0x6f03('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x6f03('0x1'));var client=jayson[_0x6f03('0x2')][_0x6f03('0x3')]({'port':0x232a});var triggers=[{'channel':_0x6f03('0x4'),'model':_0x6f03('0x5'),'event':'afterCreate','condition':_0x6f03('0x6'),'callback':afterCreate},{'channel':_0x6f03('0x4'),'model':_0x6f03('0x5'),'event':_0x6f03('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6f03('0x4'),'model':'ChatMessage','event':_0x6f03('0x8'),'condition':_0x6f03('0x9'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':_0x6f03('0x8'),'condition':_0x6f03('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x6f03('0xa'),'model':'SmsInteraction','event':_0x6f03('0x8'),'condition':_0x6f03('0x6'),'callback':afterCreate},{'channel':_0x6f03('0xa'),'model':_0x6f03('0xb'),'event':_0x6f03('0x7'),'condition':_0x6f03('0xc'),'callback':afterUpdate},{'channel':_0x6f03('0xa'),'model':'SmsMessage','event':_0x6f03('0x8'),'condition':_0x6f03('0x9'),'callback':afterCreateMessage},{'channel':_0x6f03('0xd'),'model':'WhatsappInteraction','event':_0x6f03('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6f03('0xd'),'model':_0x6f03('0xe'),'event':_0x6f03('0x7'),'condition':_0x6f03('0xc'),'callback':afterUpdate},{'channel':_0x6f03('0xd'),'model':_0x6f03('0xf'),'event':'afterCreate','condition':_0x6f03('0x9'),'callback':afterCreateMessage},{'channel':_0x6f03('0x10'),'model':_0x6f03('0x11'),'event':_0x6f03('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6f03('0x10'),'model':_0x6f03('0x11'),'event':_0x6f03('0x7'),'condition':_0x6f03('0xc'),'callback':afterUpdate},{'channel':_0x6f03('0x10'),'model':'FaxMessage','event':'afterCreate','condition':_0x6f03('0x9'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x6f03('0x12'),'event':_0x6f03('0x8'),'condition':_0x6f03('0x6'),'callback':afterCreate},{'channel':_0x6f03('0x13'),'model':'MailInteraction','event':_0x6f03('0x7'),'condition':_0x6f03('0xc'),'callback':afterUpdate},{'channel':_0x6f03('0x13'),'model':_0x6f03('0x14'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterCreate','condition':_0x6f03('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x6f03('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6f03('0x15'),'model':_0x6f03('0x16'),'event':_0x6f03('0x8'),'condition':_0x6f03('0x9'),'callback':afterCreateMessage}];function request(_0x5044cb){return client[_0x6f03('0x17')](_0x6f03('0x18'),_0x5044cb)[_0x6f03('0x19')](function(_0x1cc1e2){logger[_0x6f03('0x1a')](_0x6f03('0x1b'),_0x6f03('0x18'),_0x1cc1e2);if(_0x1cc1e2['error']){if(_0x1cc1e2[_0x6f03('0x1c')][_0x6f03('0x1d')]===0x1f4){logger[_0x6f03('0x1c')]('Trigger,\x20%s',_0x6f03('0x18'),_0x1cc1e2[_0x6f03('0x1c')]);}}})['catch'](function(_0x3d5c6c){logger['error']('Trigger,\x20%s','EventManager',_0x3d5c6c);});}function afterCreateMessage(_0x4f425d){return function(_0x4a817d){_0x4a817d=_0x4a817d[_0x6f03('0x1e')]({'plain':!![]});_0x4a817d['channel']=_0x4f425d;_0x4a817d[_0x6f03('0x1f')]=_0x4f425d;_0x4a817d[_0x6f03('0x20')]=_0x4a817d[_0x6f03('0x21')];Promise['resolve']()[_0x6f03('0x19')](function(){if(typeof _0x4a817d[_0x6f03('0x22')]===_0x6f03('0x23'))return null;var _0x417d10=_0x6f03('0x24')+_0x4a817d['ContactId'];return db[_0x6f03('0x25')][_0x6f03('0x26')](_0x417d10,{'type':db[_0x6f03('0x27')][_0x6f03('0x28')][_0x6f03('0x29')],'raw':!![]});})[_0x6f03('0x19')](function(_0x101d0b){if(_0x101d0b){_0x4a817d['contact']=_0x101d0b[0x0];}if(typeof _0x4a817d[_0x6f03('0x2a')]===_0x6f03('0x23'))return;return getAgent(_0x4a817d['UserId']);})[_0x6f03('0x19')](function(_0x2eaaaf){if(_0x2eaaaf){_0x4a817d['interface']=util['format'](_0x6f03('0x2b'),_0x2eaaaf[_0x6f03('0x2c')]);_0x4a817d[_0x6f03('0x2d')]=_0x2eaaaf;_0x4a817d[_0x6f03('0x2e')]=_0x4f425d;return request({'event':_0x6f03('0x2f'),'message':_0x4a817d});}else{return request({'event':_0x6f03('0x30'),'message':_0x4a817d});}})[_0x6f03('0x31')](function(_0x2e847c){logger[_0x6f03('0x1c')]('Trigger,\x20%s',_0x6f03('0x32'),_0x2e847c);});};}function afterCreateOfflineMessage(_0x4e12b6){return function(_0x234199){_0x234199=_0x234199[_0x6f03('0x1e')]({'plain':!![]});_0x234199[_0x6f03('0x2e')]=_0x4e12b6;_0x234199[_0x6f03('0x1f')]=_0x4e12b6;_0x234199[_0x6f03('0x20')]=_0x6f03('0x33');return request({'event':_0x234199[_0x6f03('0x20')],'message':_0x234199});};}function afterCreate(_0x2f8c26,_0x3f5f63){return function(_0x51b43b){_0x51b43b=_0x51b43b[_0x6f03('0x1e')]({'plain':!![]});_0x51b43b[_0x6f03('0x2e')]=_0x2f8c26;_0x51b43b[_0x6f03('0x1f')]=_0x2f8c26;_0x51b43b[_0x6f03('0x20')]=_0x6f03('0x34');Promise['resolve']()['then'](function(){var _0x2fe287='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x51b43b[_0x6f03('0x22')];return db[_0x6f03('0x25')]['query'](_0x2fe287,{'type':db[_0x6f03('0x27')][_0x6f03('0x28')]['SELECT'],'raw':!![]});})[_0x6f03('0x19')](function(_0x13570b){if(_0x13570b){_0x51b43b[_0x6f03('0x35')]=_0x13570b[0x0];}if(typeof _0x51b43b[_0x6f03('0x2a')]===_0x6f03('0x23'))return;return getAgent(_0x51b43b[_0x6f03('0x2a')]);})[_0x6f03('0x19')](function(_0x39fb13){if(_0x39fb13){_0x51b43b['interface']=util['format'](_0x6f03('0x2b'),_0x39fb13[_0x6f03('0x2c')]);_0x51b43b['agent']=_0x39fb13;}return request({'event':_0x3f5f63,'message':_0x51b43b});})[_0x6f03('0x31')](function(_0x1ab323){logger[_0x6f03('0x1c')](_0x6f03('0x1b'),_0x6f03('0x36'),_0x1ab323);});};}function afterUpdate(_0x3558fc){return function(_0x399c20){var _0x55d6f6=_0x399c20[_0x6f03('0x37')](_0x6f03('0x38'))&&_0x399c20['closed'];var _0x2c8dce=_0x399c20[_0x6f03('0x37')]('substatus');if(_0x55d6f6||_0x2c8dce){var _0x3abe57=_0x55d6f6?_0x6f03('0xc'):_0x6f03('0x39');var _0x4c339e=_0x399c20[_0x6f03('0x1e')]({'plain':!![]});_0x4c339e[_0x6f03('0x2e')]=_0x3558fc;_0x4c339e[_0x6f03('0x1f')]=_0x3558fc;_0x4c339e[_0x6f03('0x20')]=_0x55d6f6?_0x6f03('0x38'):'substatus';var _0x5ed646=_0x6f03('0x24')+_0x4c339e['ContactId'];return db[_0x6f03('0x25')][_0x6f03('0x26')](_0x5ed646,{'type':db[_0x6f03('0x27')][_0x6f03('0x28')][_0x6f03('0x29')],'raw':!![]})[_0x6f03('0x19')](function(_0x108f00){if(_0x108f00){_0x4c339e[_0x6f03('0x35')]=_0x108f00[0x0];}if(typeof _0x4c339e['UserId']===_0x6f03('0x23'))return;return getAgent(_0x4c339e[_0x6f03('0x2a')]);})[_0x6f03('0x19')](function(_0x353827){if(_0x353827){_0x4c339e[_0x6f03('0x3a')]=util['format'](_0x6f03('0x2b'),_0x353827['name']);_0x4c339e['agent']=_0x353827;}return request({'event':_0x3abe57,'message':_0x4c339e});})[_0x6f03('0x31')](function(_0x15231e){logger[_0x6f03('0x1c')]('Trigger,\x20%s',_0x6f03('0x3b'),_0x15231e);});}};}function getAgent(_0x45a179){return db[_0x6f03('0x3c')][_0x6f03('0x3d')]({'where':{'id':_0x45a179},'attributes':['id','name',_0x6f03('0x3e'),_0x6f03('0x3f'),_0x6f03('0x40')],'raw':!![]})[_0x6f03('0x19')](function(_0x1d34c0){return _0x1d34c0;});}exports[_0x6f03('0x41')]=function(){for(var _0x2a3250=0x0;_0x2a3250=_0x488f14['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x442160(_0x3244f7);})['catch'](function(_0x1242c2){_0x217c30(_0x1242c2);});});}; \ No newline at end of file +var _0x3c9d=['catch','lodash','bluebird','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','blockedAt','updateAttributes','getLicense','role','agent','User','count','agents'];(function(_0x500923,_0x3689d9){var _0x4c4e33=function(_0x48f469){while(--_0x48f469){_0x500923['push'](_0x500923['shift']());}};_0x4c4e33(++_0x3689d9);}(_0x3c9d,0x100));var _0xd3c9=function(_0x7d4593,_0xd66d60){_0x7d4593=_0x7d4593-0x0;var _0x440c23=_0x3c9d[_0x7d4593];return _0x440c23;};'use strict';var _=require(_0xd3c9('0x0'));var BPromise=require(_0xd3c9('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice','mail','chat',_0xd3c9('0x2'),_0xd3c9('0x3'),_0xd3c9('0x4'),_0xd3c9('0x5')];exports[_0xd3c9('0x6')]=function(){return channels;};exports[_0xd3c9('0x7')]=function(_0x4e0dd1){_0x4e0dd1=_0x4e0dd1['toLowerCase']();return _['includes'](channels,_0x4e0dd1);};exports['clearBlockUser']=function(_0x135ac9,_0x12e701,_0x57d21a,_0x231ed9){var _0x406c0c={'loginAttempts':_0x12e701,'blocked':_0x57d21a};if(!_['isUndefined'](_0x231ed9)){_0x406c0c[_0xd3c9('0x8')]=_0x231ed9;}return _0x135ac9[_0xd3c9('0x9')](_0x406c0c);};exports[_0xd3c9('0xa')]=function(_0x385ab5){return new BPromise(function(_0x1a37c2,_0x20299b){var _0x438596=0x0;if(_0x385ab5[_0xd3c9('0xb')]!==_0xd3c9('0xc')){_0x1a37c2(_0x385ab5);}db[_0xd3c9('0xd')][_0xd3c9('0xe')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x385ab5['id']}}})['then'](function(_0x4c7b1e){_0x438596=_0x4c7b1e;return util['getLicense']();})['then'](function(_0x3e8b9e){if(_0x3e8b9e&&_0x3e8b9e[_0xd3c9('0xf')]&&_0x438596>=_0x3e8b9e[_0xd3c9('0xf')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1a37c2(_0x385ab5);})[_0xd3c9('0x10')](function(_0x27c191){_0x20299b(_0x27c191);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index bc066ef..815da3c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['OutOfInterval','error','stack','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','inherits'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x70e0,0x17b));var _0x070e=function(_0x4712dc,_0x31881e){_0x4712dc=_0x4712dc-0x0;var _0x4adbbe=_0x70e0[_0x4712dc];return _0x4adbbe;};'use strict';var util=require(_0x070e('0x0'));var logger=require(_0x070e('0x1'))(_0x070e('0x2'));var APIError=function(_0x4d95bb,_0x579b83){this[_0x070e('0x3')]=_0x4d95bb||_0x070e('0x4');this[_0x070e('0x5')]=_0x579b83||_0x070e('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x7bce9b){this['message']=_0x7bce9b||_0x070e('0x7');this['name']='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x35ab0c){this[_0x070e('0x3')]=_0x35ab0c||_0x070e('0x8');this[_0x070e('0x5')]=_0x070e('0x9');util[_0x070e('0xa')](APINotFoundError,APIError);};function getStatusCode(_0x11ffa8){switch(_0x11ffa8){case'Bad\x20Request':return 0x190;case'Forbidden',_0x070e('0xb'):return 0x193;case _0x070e('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x12bb37){return function(_0xb8d819){logger[_0x070e('0xc')](_0xb8d819[_0x070e('0xd')]);var _0x25cfe1=getStatusCode(_0xb8d819[_0x070e('0x5')]);if(_0xb8d819[_0x070e('0x5')])delete _0xb8d819[_0x070e('0x5')];return _0x12bb37[_0x070e('0xe')](_0x25cfe1)['send'](_0xb8d819);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xbdb7=['Error','Bad\x20Request','Entity\x20not\x20found','inherits','Forbidden','OutOfInterval','Not\x20Found','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name'];(function(_0x553029,_0x4b6e5c){var _0x5b3a3a=function(_0x4ce368){while(--_0x4ce368){_0x553029['push'](_0x553029['shift']());}};_0x5b3a3a(++_0x4b6e5c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4730bd,_0x1e9541){_0x4730bd=_0x4730bd-0x0;var _0x1b2849=_0xbdb7[_0x4730bd];return _0x1b2849;};'use strict';var util=require(_0x7bdb('0x0'));var logger=require(_0x7bdb('0x1'))(_0x7bdb('0x2'));var APIError=function(_0x2a2c1c,_0x23c326){this[_0x7bdb('0x3')]=_0x2a2c1c||_0x7bdb('0x4');this[_0x7bdb('0x5')]=_0x23c326||_0x7bdb('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x28542c){this['message']=_0x28542c||'Bad\x20Request';this[_0x7bdb('0x5')]=_0x7bdb('0x7');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x513cba){this[_0x7bdb('0x3')]=_0x513cba||_0x7bdb('0x8');this['name']='Not\x20Found';util[_0x7bdb('0x9')](APINotFoundError,APIError);};function getStatusCode(_0x1a6b61){switch(_0x1a6b61){case _0x7bdb('0x7'):return 0x190;case _0x7bdb('0xa'),_0x7bdb('0xb'):return 0x193;case _0x7bdb('0xc'):return 0x194;default:return 0x1f4;}}function handleError(_0x297724){return function(_0x258cc6){logger['error'](_0x258cc6['stack']);var _0x52b9b9=getStatusCode(_0x258cc6[_0x7bdb('0x5')]);if(_0x258cc6[_0x7bdb('0x5')])delete _0x258cc6['name'];return _0x297724[_0x7bdb('0xd')](_0x52b9b9)['send'](_0x258cc6);};}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 f7e12f5..4348964 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3222=['render','json','exports','404','status'];(function(_0x5ba8a2,_0x2353f2){var _0x343652=function(_0x2457ba){while(--_0x2457ba){_0x5ba8a2['push'](_0x5ba8a2['shift']());}};_0x343652(++_0x2353f2);}(_0x3222,0x101));var _0x2322=function(_0x4152e3,_0x1260aa){_0x4152e3=_0x4152e3-0x0;var _0x4e6a6f=_0x3222[_0x4152e3];return _0x4e6a6f;};'use strict';module[_0x2322('0x0')][0x194]=function pageNotFound(_0xde35e7,_0x41a77){var _0x19ade2=_0x2322('0x1');var _0xebfcf7=0x194;var _0xe5555e={'status':_0xebfcf7};_0x41a77[_0x2322('0x2')](_0xe5555e['status']);_0x41a77[_0x2322('0x3')](_0x19ade2,{},function(_0x453dc6,_0x2b37ea){if(_0x453dc6){return _0x41a77[_0x2322('0x2')](_0xe5555e[_0x2322('0x2')])[_0x2322('0x4')](_0xe5555e);}_0x41a77['send'](_0x2b37ea);});}; \ No newline at end of file +var _0x081e=['status','render','exports'];(function(_0x493220,_0x5dbf59){var _0x4b9b27=function(_0x22b9ff){while(--_0x22b9ff){_0x493220['push'](_0x493220['shift']());}};_0x4b9b27(++_0x5dbf59);}(_0x081e,0xc5));var _0xe081=function(_0xb14b26,_0x38cf9f){_0xb14b26=_0xb14b26-0x0;var _0xfdb28a=_0x081e[_0xb14b26];return _0xfdb28a;};'use strict';module[_0xe081('0x0')][0x194]=function pageNotFound(_0x319adb,_0x526a85){var _0x43ae77='404';var _0x23b05d=0x194;var _0x3a48ae={'status':_0x23b05d};_0x526a85[_0xe081('0x1')](_0x3a48ae[_0xe081('0x1')]);_0x526a85[_0xe081('0x2')](_0x43ae77,{},function(_0x29d73d,_0x9b415a){if(_0x29d73d){return _0x526a85['status'](_0x3a48ae[_0xe081('0x1')])['json'](_0x3a48ae);}_0x526a85['send'](_0x9b415a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 02b5277..8b5beb5 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa11c=['mailbox','QueueCalls','uniqueid','Contact','MailAccountId','CloudProviderId','restrict','MailServerOut','CloudProvider','Imap','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPause','Teams','MailInteractionId','ContactId','Owner','Tags','mail_interaction_has_tags','Users','Interaction','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','TagId','DashboardItem','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','UserChatQueue','chat_group_has_users','Website','CmCompany','CompanyId','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','Agent','Automation','All','OneAll','OneAny','Actions','ParentId','Extensions','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','SalesforceConfiguration','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Configurations','SugarcrmConfiguration','DeskAccount','ZohoAccount','VariableId','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','ToId','SessionId','SmsQueueReport','ProjectId','user_has_teams','team_has_mail_queues','MailQueues','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','Hoppers','CampaignId','TrunkBackup','SquareProjectId','Lists','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToAccount','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','UserWhatsappQueue','WhatsappQueueId','user','Smtp','sequelize','lodash','jstz','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','xC@LL1234','mysql','utf8_general_ci','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.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','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefix','VoicePrefixes','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccounts','SpiedAgents','VoiceContext','Applications','VoiceMusicOnHold','Sounds','Members','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','Interval','mandatoryDispositionPauseId','Agents','Team','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser'];(function(_0x1411aa,_0xbf479a){var _0x28c7f9=function(_0x220c27){while(--_0x220c27){_0x1411aa['push'](_0x1411aa['shift']());}};_0x28c7f9(++_0xbf479a);}(_0xa11c,0xaa));var _0xca11=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa11c[_0x17d9e3];return _0x14192d;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xca11('0x0'));var _=require(_0xca11('0x1'));var jstz=require(_0xca11('0x2'));var timezone=jstz['determine']();config['sequelize']=_['defaultsDeep'](config['sequelize'],{'database':_0xca11('0x3'),'username':_0xca11('0x4'),'password':'xC@LL1234','options':{'host':_0xca11('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xca11('0x6')},'logging':![],'timezone':timezone[_0xca11('0x7')](),'define':{'charset':_0xca11('0x8'),'collate':'utf8_general_ci'}}});config[_0xca11('0x9')]=_[_0xca11('0xa')](config[_0xca11('0x9')],{'database':_0xca11('0x3'),'username':_0xca11('0x4'),'password':_0xca11('0xb'),'options':{'host':_0xca11('0x5'),'port':0xcea,'dialect':_0xca11('0xc'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xca11('0x8'),'collate':_0xca11('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xca11('0x0')][_0xca11('0xe')],config[_0xca11('0x0')]['username'],config[_0xca11('0x0')][_0xca11('0xf')],config['sequelize'][_0xca11('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xca11('0x9')][_0xca11('0xe')],config['sequelizeHistory'][_0xca11('0x11')],config[_0xca11('0x9')][_0xca11('0xf')],config[_0xca11('0x9')][_0xca11('0x10')])};db[_0xca11('0x12')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x14'));db[_0xca11('0x15')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x16'));db['VoiceContext']=db['sequelize'][_0xca11('0x13')](_0xca11('0x17'));db[_0xca11('0x18')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x19'));db['VoiceMusicOnHold']=db['sequelize'][_0xca11('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xca11('0x1a')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x1b'));db[_0xca11('0x1c')]=db['sequelize']['import'](_0xca11('0x1d'));db['ScreenRecording']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x1e'));db['VoiceMail']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x1f'));db[_0xca11('0x20')]=db[_0xca11('0x0')]['import'](_0xca11('0x21'));db[_0xca11('0x22')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0xca11('0x23')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x24'));db[_0xca11('0x25')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x26'));db[_0xca11('0x27')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x28'));db['MemberReport']=db[_0xca11('0x0')]['import']('../api/memberReport/memberReport.model');db[_0xca11('0x29')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x2a'));db[_0xca11('0x2b')]=db[_0xca11('0x0')]['import'](_0xca11('0x2c'));db[_0xca11('0x2d')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x2e'));db[_0xca11('0x2f')]=db['sequelize'][_0xca11('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db['sequelize'][_0xca11('0x13')](_0xca11('0x30'));db[_0xca11('0x31')]=db[_0xca11('0x0')]['import'](_0xca11('0x32'));db[_0xca11('0x33')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x34'));db[_0xca11('0x35')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0xca11('0x36')]=db[_0xca11('0x0')]['import'](_0xca11('0x37'));db['UserWhatsappQueue']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x38'));db[_0xca11('0x39')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x3a'));db['MailServerOut']=db[_0xca11('0x0')][_0xca11('0x13')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize']['import'](_0xca11('0x3b'));db[_0xca11('0x3c')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x3d'));db[_0xca11('0x3e')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xca11('0x0')]['import'](_0xca11('0x3f'));db[_0xca11('0x40')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/mailMessage/mailMessage.model');db[_0xca11('0x41')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x42'));db[_0xca11('0x43')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0xca11('0x44')]=db[_0xca11('0x0')]['import'](_0xca11('0x45'));db['DashboardItem']=db[_0xca11('0x0')]['import']('../api/dashboardItem/dashboardItem.model');db[_0xca11('0x46')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/faxAccount/faxAccount.model');db[_0xca11('0x47')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x48'));db[_0xca11('0x49')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x4a'));db[_0xca11('0x4b')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x4c'));db['FaxQueue']=db['sequelize'][_0xca11('0x13')](_0xca11('0x4d'));db[_0xca11('0x4e')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x4f'));db['SmsAccount']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x50'));db[_0xca11('0x51')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x52'));db[_0xca11('0x53')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0xca11('0x54')]=db[_0xca11('0x0')]['import']('../api/smsMessage/smsMessage.model');db[_0xca11('0x55')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x56'));db[_0xca11('0x57')]=db[_0xca11('0x0')]['import'](_0xca11('0x58'));db['OpenchannelApplication']=db['sequelize'][_0xca11('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0xca11('0x59')]=db[_0xca11('0x0')]['import'](_0xca11('0x5a'));db[_0xca11('0x5b')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x5c'));db[_0xca11('0x5d')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x5e'));db[_0xca11('0x5f')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x60'));db[_0xca11('0x61')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x62'));db[_0xca11('0x63')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x64'));db['ChatInteraction']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x65'));db[_0xca11('0x66')]=db['sequelize'][_0xca11('0x13')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0xca11('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xca11('0x67')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x68'));db[_0xca11('0x69')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x6a'));db[_0xca11('0x6b')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x6c'));db['CmCompany']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x6d'));db[_0xca11('0x6e')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x6f'));db[_0xca11('0x70')]=db['sequelize'][_0xca11('0x13')](_0xca11('0x71'));db['CmHopperFinal']=db['sequelize'][_0xca11('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xca11('0x0')][_0xca11('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xca11('0x72')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x73'));db[_0xca11('0x74')]=db['sequelize'][_0xca11('0x13')](_0xca11('0x75'));db[_0xca11('0x76')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x77'));db['Automation']=db['sequelize']['import'](_0xca11('0x78'));db[_0xca11('0x79')]=db[_0xca11('0x0')]['import'](_0xca11('0x7a'));db[_0xca11('0x7b')]=db[_0xca11('0x0')]['import'](_0xca11('0x7c'));db[_0xca11('0x7d')]=db[_0xca11('0x0')]['import'](_0xca11('0x7e'));db['Interval']=db[_0xca11('0x0')]['import'](_0xca11('0x7f'));db[_0xca11('0x80')]=db['sequelize'][_0xca11('0x13')](_0xca11('0x81'));db[_0xca11('0x82')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/cdr/cdr.model');db[_0xca11('0x83')]=db['sequelize'][_0xca11('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0xca11('0x13')](_0xca11('0x84'));db[_0xca11('0x85')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/sound/sound.model');db[_0xca11('0x86')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x87'));db[_0xca11('0x88')]=db['sequelize']['import'](_0xca11('0x89'));db[_0xca11('0x8a')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x8b'));db[_0xca11('0x8c')]=db['sequelize']['import'](_0xca11('0x8d'));db['Template']=db[_0xca11('0x0')]['import'](_0xca11('0x8e'));db['Trigger']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x8f'));db[_0xca11('0x90')]=db['sequelize']['import']('../api/variable/variable.model');db[_0xca11('0x91')]=db['sequelize'][_0xca11('0x13')](_0xca11('0x92'));db['IntegrationReport']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x93'));db[_0xca11('0x94')]=db['sequelize'][_0xca11('0x13')](_0xca11('0x95'));db[_0xca11('0x96')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x97'));db[_0xca11('0x98')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x99'));db[_0xca11('0x9a')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x9b'));db[_0xca11('0x9c')]=db[_0xca11('0x0')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0xca11('0x9d')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x9e'));db[_0xca11('0x9f')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xa0'));db['SalesforceConfiguration']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xa1'));db[_0xca11('0xa2')]=db['sequelize']['import'](_0xca11('0xa3'));db[_0xca11('0xa4')]=db[_0xca11('0x0')]['import'](_0xca11('0xa5'));db['SugarcrmConfiguration']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xa6'));db[_0xca11('0xa7')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xa8'));db['DeskAccount']=db['sequelize'][_0xca11('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xca11('0xa9')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xca11('0xaa')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xab'));db['ZohoAccount']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xac'));db[_0xca11('0xad')]=db[_0xca11('0x0')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xca11('0xae')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xaf'));db[_0xca11('0xb0')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xb1'));db['ZendeskConfiguration']=db['sequelize'][_0xca11('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xca11('0xb2')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xb3'));db[_0xca11('0xb4')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xca11('0xb5')]=db[_0xca11('0x0')]['import'](_0xca11('0xb6'));db['FreshdeskField']=db[_0xca11('0x0')]['import'](_0xca11('0xb7'));db['VtigerAccount']=db[_0xca11('0x0')][_0xca11('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db['sequelize'][_0xca11('0x13')](_0xca11('0xb8'));db[_0xca11('0xb9')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xba'));db[_0xca11('0xbb')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xbc'));db[_0xca11('0xbd')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xbe'));db[_0xca11('0xbf')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xc0'));db[_0xca11('0xc1')]=db['sequelize'][_0xca11('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xca11('0xc2')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xc3'));db[_0xca11('0xc4')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xc5'));db[_0xca11('0xc6')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xc7'));db[_0xca11('0xc8')]=db['sequelize']['import'](_0xca11('0xc9'));db[_0xca11('0xca')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xcb'));db[_0xca11('0x91')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x92'));db[_0xca11('0xcc')]=db['sequelize']['import']('../api/network/network.model');db[_0xca11('0xcd')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xce'));db[_0xca11('0xcf')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xca11('0xd0')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xd1'));db[_0xca11('0xd2')]=db[_0xca11('0x0')]['import'](_0xca11('0xd3'));db[_0xca11('0xd4')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xd5'));db['SmsQueueReport']=db[_0xca11('0x0')]['import'](_0xca11('0xd6'));db[_0xca11('0xd7')]=db['sequelize']['import'](_0xca11('0xd8'));db[_0xca11('0xd9')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xda'));db[_0xca11('0xdb')]=db[_0xca11('0x0')]['import'](_0xca11('0xdc'));db[_0xca11('0xdd')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xde'));db['SquareOdbc']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xdf'));db[_0xca11('0xe0')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/squareProject/squareProject.model');db[_0xca11('0xe1')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xe2'));db['SquareMessage']=db['sequelize'][_0xca11('0x13')](_0xca11('0xe3'));db['Team']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xe4'));db[_0xca11('0xe5')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xe6'));db[_0xca11('0xe7')]=db[_0xca11('0x0')]['import'](_0xca11('0xe8'));db[_0xca11('0xe9')]=db[_0xca11('0x0')]['import'](_0xca11('0xea'));db[_0xca11('0xeb')]=db[_0xca11('0x0')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0xca11('0x0')]['import']('../api/plugin/plugin.model');db[_0xca11('0xec')]=db[_0xca11('0x0')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xca11('0xed')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xee'));db[_0xca11('0xef')]=db[_0xca11('0x0')]['import'](_0xca11('0xf0'));db[_0xca11('0xf1')]=db['sequelize'][_0xca11('0x13')](_0xca11('0xf2'));db['SmsTransferReport']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xf3'));db[_0xca11('0xf4')]=db[_0xca11('0x0')]['import'](_0xca11('0xf5'));db['VoicePrefix']=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xf6'));db[_0xca11('0xf7')]=db[_0xca11('0x0')]['import'](_0xca11('0xf8'));db[_0xca11('0xf9')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xfa'));db[_0xca11('0xfb')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0xca11('0xfc')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/userNotification/userNotification.model');db[_0xca11('0xfd')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0xfe'));db[_0xca11('0xff')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x100'));db[_0xca11('0x101')]=db[_0xca11('0x0')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xca11('0x102')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x103'));db[_0xca11('0x104')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xca11('0x105')]=db[_0xca11('0x0')]['import'](_0xca11('0x106'));db[_0xca11('0x107')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0xca11('0x13')](_0xca11('0x108'));db[_0xca11('0x109')]=db['sequelize'][_0xca11('0x13')](_0xca11('0x10a'));db[_0xca11('0x10b')]=db[_0xca11('0x0')][_0xca11('0x13')](_0xca11('0x10c'));db[_0xca11('0x10d')]=db[_0xca11('0x0')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0xca11('0x10e')]=db[_0xca11('0x0')][_0xca11('0x13')]('../api/user-setting/user-setting.model');db[_0xca11('0x12')][_0xca11('0x10f')](db[_0xca11('0x110')],{'as':'VoiceMail','onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x12')][_0xca11('0x10f')](db['UserSetting'],{'as':_0xca11('0x113'),'onDelete':'cascade','foreignKey':_0xca11('0x112')});db[_0xca11('0x12')][_0xca11('0x114')](db[_0xca11('0x1c')],{'as':_0xca11('0x115'),'foreignKey':'UserId'});db['User']['hasMany'](db['UserVoiceQueueRt'],{'as':_0xca11('0x116'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x12')][_0xca11('0x114')](db[_0xca11('0x18')],{'as':'Extensions','onDelete':_0xca11('0x111'),'hooks':!![]});db['User'][_0xca11('0x114')](db[_0xca11('0x117')],{'as':_0xca11('0x118'),'foreignKey':'UserId'});db[_0xca11('0x12')][_0xca11('0x114')](db[_0xca11('0x119')],{'as':_0xca11('0x11a'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x12')][_0xca11('0x114')](db[_0xca11('0x72')],{'as':_0xca11('0x72'),'foreignKey':'UserId'});db['User'][_0xca11('0x114')](db['OpenchannelInteraction'],{'as':_0xca11('0x11b'),'foreignKey':_0xca11('0x112')});db['User'][_0xca11('0x114')](db[_0xca11('0x11c')],{'as':_0xca11('0x11d'),'foreignKey':'UserId'});db[_0xca11('0x12')][_0xca11('0x114')](db['SmsInteraction'],{'as':_0xca11('0x11e'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x12')][_0xca11('0x114')](db[_0xca11('0x49')],{'as':_0xca11('0x11f'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xca11('0x120')],{'as':_0xca11('0x121'),'foreignKey':_0xca11('0x112')});db['User'][_0xca11('0x114')](db[_0xca11('0x101')],{'as':_0xca11('0x122'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x12')][_0xca11('0x114')](db['UserNotification'],{'as':_0xca11('0x123'),'foreignKey':_0xca11('0x124')});db[_0xca11('0x12')][_0xca11('0x125')](db[_0xca11('0xf7')],{'as':_0xca11('0xf7'),'foreignKey':_0xca11('0x126')});db[_0xca11('0x12')][_0xca11('0x127')](db['ChatGroup'],{'as':_0xca11('0x128'),'through':'chat_group_has_users'});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x6e')],{'as':_0xca11('0x129'),'through':_0xca11('0x12a')});db[_0xca11('0x12')][_0xca11('0x127')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db['User']['belongsToMany'](db['Team'],{'through':'user_has_teams'});db['User'][_0xca11('0x127')](db['MailInteraction'],{'as':_0xca11('0x121'),'through':_0xca11('0x12b')});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x11c')],{'as':_0xca11('0x11d'),'through':_0xca11('0x12c')});db[_0xca11('0x12')]['belongsToMany'](db['FaxInteraction'],{'as':_0xca11('0x11f'),'through':_0xca11('0x12d')});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x53')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db['User'][_0xca11('0x127')](db[_0xca11('0x59')],{'as':'OpenchannelInteractions','through':_0xca11('0x12e')});db['User'][_0xca11('0x127')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xca11('0x12f')});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x1a')],{'as':'VoiceQueues','through':_0xca11('0x2f'),'required':![]});db['User'][_0xca11('0x127')](db[_0xca11('0x130')],{'as':_0xca11('0x131'),'through':_0xca11('0x10d'),'required':![]});db['User'][_0xca11('0x127')](db['MailQueue'],{'as':'MailQueues','through':_0xca11('0x31'),'required':![]});db[_0xca11('0x12')]['belongsToMany'](db[_0xca11('0x67')],{'as':_0xca11('0x132'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x133')],{'as':_0xca11('0x134'),'through':'UserFaxQueue','required':![]});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x55')],{'as':_0xca11('0x135'),'through':_0xca11('0x35'),'required':![]});db['User']['belongsToMany'](db[_0xca11('0x5d')],{'as':_0xca11('0x136'),'through':_0xca11('0x36'),'required':![]});db['User'][_0xca11('0x127')](db[_0xca11('0x107')],{'as':_0xca11('0x137'),'through':'UserWhatsappQueue','required':![]});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0xf4')],{'through':_0xca11('0x138')});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x5f')],{'as':_0xca11('0x139'),'through':_0xca11('0x13a')});db['User'][_0xca11('0x127')](db[_0xca11('0x46')],{'as':_0xca11('0x13b'),'through':_0xca11('0x13c')});db[_0xca11('0x12')]['belongsToMany'](db[_0xca11('0x13d')],{'as':_0xca11('0x13e'),'through':'user_has_mail_accounts'});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x57')],{'as':_0xca11('0x13f'),'through':_0xca11('0x140')});db[_0xca11('0x12')][_0xca11('0x127')](db[_0xca11('0x141')],{'as':_0xca11('0x142'),'through':'user_has_sms_accounts'});db[_0xca11('0x12')]['belongsToMany'](db[_0xca11('0xfd')],{'as':_0xca11('0x143'),'through':'user_has_whatsapp_accounts'});db[_0xca11('0x15')][_0xca11('0x114')](db[_0xca11('0x18')],{'as':_0xca11('0x144'),'onDelete':_0xca11('0x111'),'foreignKey':'ChanSpyId'});db[_0xca11('0x145')]['hasMany'](db['VoiceExtension'],{'onDelete':_0xca11('0x111')});db['VoiceExtension'][_0xca11('0x114')](db[_0xca11('0x18')],{'as':_0xca11('0x146'),'onDelete':_0xca11('0x111')});db[_0xca11('0x147')][_0xca11('0x127')](db['Sound'],{'as':_0xca11('0x148'),'through':'moh_has_sounds'});db[_0xca11('0x1a')][_0xca11('0x114')](db[_0xca11('0x2d')],{'as':_0xca11('0x149'),'foreignKey':_0xca11('0x14a')});db[_0xca11('0x1a')][_0xca11('0x114')](db[_0xca11('0x14b')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0xca11('0x1a')]['hasMany'](db[_0xca11('0x117')],{'as':_0xca11('0x118'),'foreignKey':_0xca11('0x14a')});db[_0xca11('0x1a')]['hasMany'](db[_0xca11('0x119')],{'as':_0xca11('0x14c'),'foreignKey':_0xca11('0x14a')});db[_0xca11('0x1a')][_0xca11('0x114')](db[_0xca11('0x72')],{'as':'ReportAgentPreview','foreignKey':_0xca11('0x14a')});db['VoiceQueue'][_0xca11('0x114')](db['CmHopperBlack'],{'as':_0xca11('0x14d'),'foreignKey':_0xca11('0x14a')});db['VoiceQueue'][_0xca11('0x114')](db['JscriptySessionReport'],{'as':_0xca11('0x14e'),'foreignKey':_0xca11('0x14a')});db[_0xca11('0x1a')][_0xca11('0x125')](db[_0xca11('0x29')],{'as':_0xca11('0x29'),'foreignKey':_0xca11('0x14f')});db[_0xca11('0x1a')]['belongsTo'](db[_0xca11('0x29')],{'as':'TrunkBackup','foreignKey':_0xca11('0x150')});db[_0xca11('0x1a')][_0xca11('0x125')](db[_0xca11('0x151')],{'as':_0xca11('0x151'),'foreignKey':'IntervalId'});db[_0xca11('0x1a')][_0xca11('0x125')](db[_0xca11('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0xca11('0x152')});db['VoiceQueue'][_0xca11('0x127')](db[_0xca11('0xf4')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xca11('0x1a')]['belongsToMany'](db['User'],{'as':_0xca11('0x153'),'through':_0xca11('0x2f')});db['VoiceQueue'][_0xca11('0x127')](db[_0xca11('0x154')],{'as':'Teams','through':_0xca11('0x109')});db[_0xca11('0x1a')]['belongsToMany'](db[_0xca11('0xf4')],{'as':'BlackLists','through':_0xca11('0x155')});db[_0xca11('0x1c')]['belongsTo'](db[_0xca11('0x12')],{'as':_0xca11('0x12'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x156')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':_0xca11('0x12'),'foreignKey':'UserId'});db[_0xca11('0x110')][_0xca11('0x114')](db[_0xca11('0x20')],{'as':_0xca11('0x157'),'onDelete':'cascade','foreignKey':_0xca11('0x158'),'sourceKey':'mailbox'});db[_0xca11('0x20')][_0xca11('0x125')](db['VoiceMail'],{'foreignKey':_0xca11('0x158'),'targetKey':_0xca11('0x159')});db[_0xca11('0x22')][_0xca11('0x114')](db['VoiceQueueReport'],{'as':_0xca11('0x15a'),'foreignKey':_0xca11('0x15b'),'constraints':![]});db[_0xca11('0x22')][_0xca11('0x114')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0xca11('0x15b'),'constraints':![]});db[_0xca11('0x22')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':_0xca11('0x12'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xca11('0x125')](db[_0xca11('0x6e')],{'as':_0xca11('0x15c'),'foreignKey':'ContactId'});db['MailServerIn']['belongsTo'](db[_0xca11('0x13d')],{'as':_0xca11('0x13d'),'foreignKey':_0xca11('0x15d')});db['MailServerIn'][_0xca11('0x125')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0xca11('0x15e'),'onDelete':_0xca11('0x15f')});db[_0xca11('0x160')][_0xca11('0x125')](db[_0xca11('0x13d')],{'as':_0xca11('0x13d'),'foreignKey':_0xca11('0x15d')});db['MailServerOut'][_0xca11('0x125')](db[_0xca11('0x161')],{'as':'CloudProvider','foreignKey':_0xca11('0x15e'),'onDelete':_0xca11('0x15f')});db[_0xca11('0x13d')][_0xca11('0x10f')](db[_0xca11('0x39')],{'as':_0xca11('0x162'),'onDelete':_0xca11('0x111')});db[_0xca11('0x13d')][_0xca11('0x10f')](db[_0xca11('0x160')],{'as':'Smtp','onDelete':'cascade'});db['MailAccount'][_0xca11('0x114')](db[_0xca11('0x7b')],{'as':_0xca11('0x163'),'foreignKey':'MailAccountId','onDelete':_0xca11('0x111')});db[_0xca11('0x13d')][_0xca11('0x114')](db[_0xca11('0x79')],{'as':_0xca11('0x164'),'foreignKey':_0xca11('0x15d')});db[_0xca11('0x13d')][_0xca11('0x114')](db['MailMessage'],{'as':_0xca11('0x157'),'foreignKey':_0xca11('0x15d')});db[_0xca11('0x13d')][_0xca11('0x114')](db[_0xca11('0x120')],{'as':_0xca11('0x165')});db[_0xca11('0x13d')]['hasMany'](db[_0xca11('0x41')],{'as':_0xca11('0x146')});db[_0xca11('0x13d')][_0xca11('0x125')](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db['MailAccount'][_0xca11('0x125')](db[_0xca11('0x168')],{'as':_0xca11('0x168'),'foreignKey':_0xca11('0x169')});db[_0xca11('0x13d')]['belongsTo'](db['Pause'],{'as':_0xca11('0x16a'),'foreignKey':_0xca11('0x152')});db[_0xca11('0x13d')][_0xca11('0x127')](db['User'],{'as':_0xca11('0x153'),'through':'user_has_mail_accounts'});db['MailQueue'][_0xca11('0x127')](db[_0xca11('0x12')],{'as':'Agents','through':'UserMailQueue'});db[_0xca11('0x3c')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0xca11('0x16b')});db[_0xca11('0x120')][_0xca11('0x114')](db[_0xca11('0x40')],{'as':_0xca11('0x157'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x16c')});db['MailInteraction'][_0xca11('0x125')](db['MailAccount'],{'as':'Account','foreignKey':_0xca11('0x15d')});db[_0xca11('0x120')]['belongsTo'](db['CmContact'],{'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0x120')]['belongsTo'](db[_0xca11('0x12')],{'as':_0xca11('0x16e'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x120')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':'mail_interaction_has_tags','as':_0xca11('0x16f')});db[_0xca11('0x120')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x170'),'as':'ThroughTags'});db[_0xca11('0x120')]['belongsToMany'](db['User'],{'as':_0xca11('0x171'),'through':_0xca11('0x12b'),'foreignKey':_0xca11('0x16c')});db[_0xca11('0x40')][_0xca11('0x114')](db[_0xca11('0xeb')],{'as':'Attachments','onDelete':_0xca11('0x111')});db[_0xca11('0x40')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':_0xca11('0x12')});db[_0xca11('0x40')]['belongsTo'](db[_0xca11('0x6e')],{'onDelete':'cascade','as':'Contact'});db[_0xca11('0x40')]['belongsTo'](db['MailInteraction'],{'as':_0xca11('0x172'),'foreignKey':'MailInteractionId'});db[_0xca11('0x40')][_0xca11('0x125')](db[_0xca11('0x13d')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x15d')});db['MailMessage']['belongsTo'](db[_0xca11('0x5f')],{'as':'ChatWebsite','foreignKey':_0xca11('0x174')});db['MailMessage']['belongsTo'](db[_0xca11('0x175')],{'as':_0xca11('0x175'),'foreignKey':_0xca11('0x176')});db[_0xca11('0x41')][_0xca11('0x125')](db[_0xca11('0x12')],{'onDelete':_0xca11('0x15f')});db[_0xca11('0x41')]['belongsTo'](db[_0xca11('0x3c')],{'onDelete':_0xca11('0x15f')});db['MailApplication']['belongsTo'](db[_0xca11('0x13d')],{'onDelete':_0xca11('0x15f')});db['MailApplication']['belongsTo'](db[_0xca11('0x151')],{'onDelete':'restrict','foreignKey':_0xca11('0x177')});db[_0xca11('0x41')][_0xca11('0x125')](db[_0xca11('0x86')],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x178')});db[_0xca11('0x43')][_0xca11('0x125')](db[_0xca11('0x13d')],{});db[_0xca11('0x43')][_0xca11('0x125')](db['CmList'],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db[_0xca11('0x43')][_0xca11('0x125')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xca11('0x43')][_0xca11('0x125')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db[_0xca11('0x43')][_0xca11('0x125')](db[_0xca11('0x12')],{});db[_0xca11('0x43')]['belongsTo'](db[_0xca11('0x3c')],{});db['Dashboard'][_0xca11('0x114')](db[_0xca11('0x179')],{'as':'Items','onDelete':_0xca11('0x111')});db['FaxAccount'][_0xca11('0x114')](db[_0xca11('0x7b')],{'as':_0xca11('0x163'),'foreignKey':_0xca11('0x17a'),'onDelete':_0xca11('0x111')});db[_0xca11('0x46')]['hasMany'](db[_0xca11('0x79')],{'as':_0xca11('0x164'),'foreignKey':_0xca11('0x17a')});db[_0xca11('0x46')][_0xca11('0x114')](db[_0xca11('0x49')],{'as':_0xca11('0x165')});db[_0xca11('0x46')][_0xca11('0x114')](db[_0xca11('0x47')],{'as':_0xca11('0x146')});db[_0xca11('0x46')][_0xca11('0x114')](db[_0xca11('0x18')],{'as':_0xca11('0x17b'),'onDelete':_0xca11('0x111')});db[_0xca11('0x46')][_0xca11('0x114')](db['FaxMessage'],{'as':_0xca11('0x157')});db['FaxAccount'][_0xca11('0x125')](db[_0xca11('0x29')],{'as':_0xca11('0x29')});db[_0xca11('0x46')]['belongsTo'](db['CmList'],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db['FaxAccount']['belongsTo'](db['Pause'],{'as':_0xca11('0x16a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xca11('0x46')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x13c')});db['FaxApplication']['belongsTo'](db[_0xca11('0x12')],{'onDelete':_0xca11('0x15f')});db['FaxApplication']['belongsTo'](db[_0xca11('0x133')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0xca11('0x46')],{'onDelete':_0xca11('0x15f')});db[_0xca11('0x47')][_0xca11('0x125')](db[_0xca11('0x86')],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x178')});db[_0xca11('0x49')]['hasMany'](db[_0xca11('0x4b')],{'as':_0xca11('0x157'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x17c')});db[_0xca11('0x49')][_0xca11('0x125')](db[_0xca11('0x46')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x17a')});db[_0xca11('0x49')]['belongsTo'](db[_0xca11('0x6e')],{'as':'Contact','foreignKey':_0xca11('0x16d')});db[_0xca11('0x49')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':'Owner','foreignKey':_0xca11('0x112')});db[_0xca11('0x49')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x17d'),'as':_0xca11('0x16f')});db[_0xca11('0x49')]['belongsToMany'](db[_0xca11('0x86')],{'through':'fax_interaction_has_tags','as':_0xca11('0x17e')});db[_0xca11('0x49')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x171'),'through':_0xca11('0x12d'),'foreignKey':_0xca11('0x17c')});db[_0xca11('0x4b')][_0xca11('0x125')](db[_0xca11('0x12')],{'onDelete':_0xca11('0x111'),'as':_0xca11('0x12')});db[_0xca11('0x4b')][_0xca11('0x125')](db[_0xca11('0x49')],{'as':_0xca11('0x172'),'foreignKey':_0xca11('0x17c')});db['FaxMessage'][_0xca11('0x125')](db[_0xca11('0x6e')],{'onDelete':_0xca11('0x111'),'as':_0xca11('0x15c')});db[_0xca11('0x4b')][_0xca11('0x125')](db[_0xca11('0xeb')],{'as':_0xca11('0xeb'),'foreignKey':_0xca11('0x17f')});db[_0xca11('0x4b')][_0xca11('0x125')](db[_0xca11('0x46')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x17a')});db['FaxQueue'][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x33')});db['FaxQueue'][_0xca11('0x127')](db[_0xca11('0x154')],{'through':'team_has_fax_queues','as':_0xca11('0x16b')});db[_0xca11('0x4e')][_0xca11('0x125')](db['FaxAccount'],{});db[_0xca11('0x4e')][_0xca11('0x125')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xca11('0x4e')]['belongsTo'](db[_0xca11('0x6e')],{'as':'Contact','foreignKey':_0xca11('0x16d')});db[_0xca11('0x4e')][_0xca11('0x125')](db['FaxInteraction'],{});db[_0xca11('0x4e')][_0xca11('0x125')](db['FaxMessage'],{});db[_0xca11('0x4e')][_0xca11('0x125')](db[_0xca11('0x12')],{});db['FaxQueueReport'][_0xca11('0x125')](db[_0xca11('0x133')],{});db[_0xca11('0x141')][_0xca11('0x114')](db[_0xca11('0x7b')],{'as':_0xca11('0x163'),'foreignKey':_0xca11('0x180'),'onDelete':_0xca11('0x111')});db[_0xca11('0x141')][_0xca11('0x114')](db[_0xca11('0x79')],{'as':_0xca11('0x164'),'foreignKey':'SmsAccountId'});db[_0xca11('0x141')][_0xca11('0x114')](db[_0xca11('0x54')],{'as':_0xca11('0x157'),'foreignKey':'SmsAccountId'});db[_0xca11('0x141')][_0xca11('0x114')](db[_0xca11('0x53')],{'as':_0xca11('0x165')});db[_0xca11('0x141')][_0xca11('0x114')](db['SmsApplication'],{'as':_0xca11('0x146')});db['SmsAccount'][_0xca11('0x125')](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db[_0xca11('0x141')][_0xca11('0x125')](db[_0xca11('0x80')],{'as':_0xca11('0x16a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xca11('0x141')][_0xca11('0x127')](db['User'],{'as':_0xca11('0x153'),'through':_0xca11('0x181')});db['SmsApplication']['belongsTo'](db[_0xca11('0x12')],{'onDelete':_0xca11('0x15f')});db[_0xca11('0x51')]['belongsTo'](db[_0xca11('0x55')],{'onDelete':'restrict'});db[_0xca11('0x51')][_0xca11('0x125')](db['SmsAccount'],{'onDelete':'restrict'});db[_0xca11('0x51')][_0xca11('0x125')](db[_0xca11('0x151')],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x177')});db[_0xca11('0x51')]['belongsTo'](db[_0xca11('0x86')],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x178')});db[_0xca11('0x53')][_0xca11('0x114')](db[_0xca11('0x54')],{'as':_0xca11('0x157'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x182')});db[_0xca11('0x53')][_0xca11('0x125')](db[_0xca11('0x141')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x180')});db[_0xca11('0x53')][_0xca11('0x125')](db[_0xca11('0x6e')],{'as':_0xca11('0x15c'),'foreignKey':'ContactId'});db[_0xca11('0x53')]['belongsTo'](db[_0xca11('0x12')],{'as':_0xca11('0x16e'),'foreignKey':_0xca11('0x112')});db['SmsInteraction'][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x183'),'as':'Tags'});db[_0xca11('0x53')]['belongsToMany'](db['Tag'],{'through':_0xca11('0x183'),'as':_0xca11('0x17e')});db['SmsInteraction'][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x171'),'through':_0xca11('0x184'),'foreignKey':_0xca11('0x182')});db[_0xca11('0x54')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':'User'});db[_0xca11('0x54')]['belongsTo'](db[_0xca11('0x6e')],{'onDelete':'cascade','as':_0xca11('0x15c')});db[_0xca11('0x54')]['belongsTo'](db[_0xca11('0x53')],{'onDelete':'cascade','as':_0xca11('0x172'),'foreignKey':_0xca11('0x182')});db['SmsMessage'][_0xca11('0x125')](db['SmsAccount'],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x180')});db[_0xca11('0x55')]['belongsToMany'](db['User'],{'as':_0xca11('0x153'),'through':_0xca11('0x35'),'foreignKey':_0xca11('0x185')});db['SmsQueue'][_0xca11('0x127')](db[_0xca11('0x154')],{'through':_0xca11('0x186'),'as':_0xca11('0x16b')});db[_0xca11('0x57')][_0xca11('0x114')](db[_0xca11('0x7b')],{'as':_0xca11('0x163'),'foreignKey':_0xca11('0x187'),'onDelete':'cascade'});db[_0xca11('0x57')][_0xca11('0x114')](db[_0xca11('0x79')],{'as':_0xca11('0x164'),'foreignKey':_0xca11('0x187')});db[_0xca11('0x57')][_0xca11('0x114')](db[_0xca11('0x59')],{'as':'Interactions','foreignKey':_0xca11('0x187')});db[_0xca11('0x57')]['hasMany'](db[_0xca11('0x5b')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0xca11('0x57')][_0xca11('0x114')](db[_0xca11('0x188')],{'as':_0xca11('0x146'),'foreignKey':_0xca11('0x187')});db['OpenchannelAccount'][_0xca11('0x125')](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db[_0xca11('0x57')][_0xca11('0x125')](db[_0xca11('0x80')],{'as':_0xca11('0x16a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xca11('0x57')]['belongsToMany'](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x140')});db[_0xca11('0x188')][_0xca11('0x125')](db[_0xca11('0x12')],{'onDelete':_0xca11('0x15f')});db[_0xca11('0x188')][_0xca11('0x125')](db[_0xca11('0x5d')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xca11('0x188')][_0xca11('0x125')](db[_0xca11('0x57')],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x187')});db[_0xca11('0x188')][_0xca11('0x125')](db[_0xca11('0x151')],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x177')});db[_0xca11('0x188')][_0xca11('0x125')](db['Tag'],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x178')});db[_0xca11('0x59')][_0xca11('0x114')](db[_0xca11('0x5b')],{'as':_0xca11('0x157'),'onDelete':_0xca11('0x111'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db[_0xca11('0x57')],{'as':_0xca11('0x173'),'foreignKey':'OpenchannelAccountId'});db[_0xca11('0x59')]['belongsTo'](db[_0xca11('0x6e')],{'as':_0xca11('0x15c'),'foreignKey':'ContactId'});db[_0xca11('0x59')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':_0xca11('0x16e'),'foreignKey':'UserId'});db[_0xca11('0x59')]['belongsToMany'](db[_0xca11('0x86')],{'through':_0xca11('0x189'),'as':'Tags'});db['OpenchannelInteraction'][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x189'),'as':_0xca11('0x17e')});db[_0xca11('0x59')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x171'),'through':_0xca11('0x12e'),'foreignKey':_0xca11('0x18a')});db['OpenchannelMessage'][_0xca11('0x125')](db[_0xca11('0x12')],{'onDelete':_0xca11('0x111'),'as':_0xca11('0x12')});db[_0xca11('0x5b')][_0xca11('0x125')](db[_0xca11('0x6e')],{'onDelete':_0xca11('0x111'),'as':_0xca11('0x15c')});db[_0xca11('0x5b')][_0xca11('0x125')](db[_0xca11('0x59')],{'onDelete':_0xca11('0x111'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0xca11('0x5b')][_0xca11('0x125')](db[_0xca11('0xeb')],{'as':_0xca11('0xeb'),'foreignKey':'AttachmentId'});db[_0xca11('0x5b')][_0xca11('0x125')](db[_0xca11('0x57')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x187')});db[_0xca11('0x5d')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x36'),'foreignKey':_0xca11('0x18b')});db['OpenchannelQueue'][_0xca11('0x127')](db[_0xca11('0x154')],{'through':_0xca11('0x18c'),'as':_0xca11('0x16b')});db[_0xca11('0x5f')][_0xca11('0x114')](db['Disposition'],{'as':_0xca11('0x163'),'foreignKey':_0xca11('0x174'),'onDelete':_0xca11('0x111')});db[_0xca11('0x5f')][_0xca11('0x114')](db[_0xca11('0x79')],{'as':_0xca11('0x164'),'foreignKey':_0xca11('0x174')});db[_0xca11('0x5f')][_0xca11('0x114')](db[_0xca11('0x6b')],{'as':_0xca11('0x18d')});db['ChatWebsite'][_0xca11('0x114')](db['ChatInteraction'],{'as':_0xca11('0x165')});db[_0xca11('0x5f')][_0xca11('0x114')](db['ChatApplication'],{'as':_0xca11('0x146')});db[_0xca11('0x5f')]['hasMany'](db['ChatMessage'],{'as':_0xca11('0x157')});db[_0xca11('0x5f')][_0xca11('0x125')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xca11('0x5f')][_0xca11('0x125')](db[_0xca11('0x151')],{'as':_0xca11('0x151'),'foreignKey':_0xca11('0x177')});db['ChatWebsite'][_0xca11('0x125')](db[_0xca11('0x13d')],{'as':_0xca11('0x13d'),'foreignKey':'MailAccountId'});db[_0xca11('0x5f')][_0xca11('0x125')](db[_0xca11('0x80')],{'as':_0xca11('0x16a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xca11('0x5f')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x13a')});db[_0xca11('0x61')][_0xca11('0x125')](db[_0xca11('0x57')],{});db['OpenchannelQueueReport'][_0xca11('0x125')](db['CmList'],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db['OpenchannelQueueReport']['belongsTo'](db[_0xca11('0x6e')],{'as':'Contact','foreignKey':_0xca11('0x16d')});db[_0xca11('0x61')][_0xca11('0x125')](db[_0xca11('0x59')],{});db[_0xca11('0x61')][_0xca11('0x125')](db['OpenchannelMessage'],{});db[_0xca11('0x61')][_0xca11('0x125')](db['User'],{});db[_0xca11('0x61')][_0xca11('0x125')](db[_0xca11('0x5d')],{});db[_0xca11('0x63')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':'Agent','foreignKey':_0xca11('0x112'),'onDelete':'restrict'});db['ChatApplication'][_0xca11('0x125')](db[_0xca11('0x67')],{'as':_0xca11('0x18e'),'foreignKey':_0xca11('0x18f'),'onDelete':_0xca11('0x15f')});db['ChatApplication'][_0xca11('0x125')](db[_0xca11('0x5f')],{'as':'Website','foreignKey':_0xca11('0x174'),'onDelete':_0xca11('0x15f')});db[_0xca11('0x63')]['belongsTo'](db[_0xca11('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xca11('0x11c')][_0xca11('0x114')](db[_0xca11('0x66')],{'as':_0xca11('0x157'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x190')});db[_0xca11('0x11c')][_0xca11('0x125')](db[_0xca11('0x5f')],{'as':_0xca11('0x173'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0xca11('0x125')](db[_0xca11('0x6e')],{'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0x11c')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':_0xca11('0x16e'),'foreignKey':_0xca11('0x112')});db[_0xca11('0x11c')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x191'),'as':'Tags'});db[_0xca11('0x11c')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x191'),'as':_0xca11('0x17e')});db[_0xca11('0x11c')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x171'),'through':_0xca11('0x12c'),'foreignKey':_0xca11('0x190')});db[_0xca11('0x66')]['belongsTo'](db[_0xca11('0x12')],{'onDelete':_0xca11('0x111'),'as':'User'});db['ChatMessage'][_0xca11('0x125')](db[_0xca11('0x6e')],{'onDelete':_0xca11('0x111'),'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d')});db['ChatMessage'][_0xca11('0x125')](db[_0xca11('0x11c')],{'onDelete':'cascade','as':_0xca11('0x172'),'foreignKey':_0xca11('0x190')});db[_0xca11('0x66')][_0xca11('0x125')](db['Attachment'],{'as':_0xca11('0xeb'),'foreignKey':_0xca11('0x17f')});db[_0xca11('0x66')][_0xca11('0x125')](db[_0xca11('0x5f')],{'as':_0xca11('0x173'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xca11('0x114')](db[_0xca11('0xeb')],{'as':_0xca11('0x192'),'foreignKey':_0xca11('0x176'),'onDelete':_0xca11('0x111'),'hooks':!![]});db[_0xca11('0x175')][_0xca11('0x125')](db[_0xca11('0x6e')],{'onDelete':_0xca11('0x111'),'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0x175')][_0xca11('0x125')](db[_0xca11('0x5f')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x174')});db[_0xca11('0x67')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x193'),'hooks':!![]});db[_0xca11('0x67')]['belongsToMany'](db[_0xca11('0x154')],{'through':'team_has_chat_queues','as':_0xca11('0x16b')});db['ChatGroup'][_0xca11('0x114')](db[_0xca11('0xcf')],{'as':_0xca11('0x157'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xca11('0x69')]['belongsToMany'](db[_0xca11('0x12')],{'as':_0xca11('0x149'),'through':_0xca11('0x194')});db['ChatProactiveAction'][_0xca11('0x125')](db[_0xca11('0x5f')],{'as':_0xca11('0x195'),'foreignKey':_0xca11('0x174')});db[_0xca11('0x196')][_0xca11('0x114')](db['CmContact'],{'as':'Contacts','foreignKey':_0xca11('0x197')});db[_0xca11('0x6e')][_0xca11('0x114')](db[_0xca11('0x8a')],{'as':'Phones','foreignKey':_0xca11('0x198')});db[_0xca11('0x6e')][_0xca11('0x114')](db[_0xca11('0x14b')],{'as':'Hoppers','foreignKey':_0xca11('0x16d')});db[_0xca11('0x6e')][_0xca11('0x114')](db['CmHopperFinal'],{'as':_0xca11('0x118'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0x6e')][_0xca11('0x114')](db[_0xca11('0x119')],{'as':_0xca11('0x14c'),'foreignKey':_0xca11('0x16d')});db['CmContact'][_0xca11('0x114')](db[_0xca11('0x72')],{'as':_0xca11('0x72'),'foreignKey':_0xca11('0x16d')});db['CmContact']['hasMany'](db['JscriptySessionReport'],{'as':_0xca11('0x14e'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0x6e')][_0xca11('0x114')](db[_0xca11('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0xca11('0x16d'),'onDelete':_0xca11('0x15f')});db['CmContact'][_0xca11('0x114')](db[_0xca11('0x11c')],{'as':_0xca11('0x11d'),'foreignKey':_0xca11('0x16d'),'onDelete':'restrict'});db[_0xca11('0x6e')][_0xca11('0x114')](db[_0xca11('0x53')],{'as':_0xca11('0x11e'),'foreignKey':_0xca11('0x16d'),'onDelete':_0xca11('0x15f')});db[_0xca11('0x6e')][_0xca11('0x114')](db[_0xca11('0x49')],{'as':_0xca11('0x11f'),'foreignKey':_0xca11('0x16d'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0xca11('0x120')],{'as':_0xca11('0x121'),'foreignKey':_0xca11('0x16d'),'onDelete':_0xca11('0x15f')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0xca11('0x199'),'foreignKey':_0xca11('0x197')});db[_0xca11('0x6e')][_0xca11('0x125')](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':'ListId','onDelete':_0xca11('0x111')});db['CmContact'][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x171'),'through':_0xca11('0x12a')});db[_0xca11('0x6e')][_0xca11('0x127')](db[_0xca11('0x86')],{'as':_0xca11('0x16f'),'through':_0xca11('0x19a')});db[_0xca11('0x6e')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x19a'),'as':_0xca11('0x17e')});db[_0xca11('0x14b')]['hasMany'](db[_0xca11('0x8c')],{'as':_0xca11('0x19b'),'foreignKey':'CmHopperId'});db[_0xca11('0x14b')][_0xca11('0x125')](db[_0xca11('0x6e')],{'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d'),'onDelete':_0xca11('0x111')});db[_0xca11('0x14b')]['belongsTo'](db[_0xca11('0xf4')],{'as':'List','foreignKey':_0xca11('0x167'),'onDelete':'cascade'});db[_0xca11('0x14b')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':_0xca11('0x19c'),'foreignKey':'UserId'});db[_0xca11('0x14b')][_0xca11('0x125')](db[_0xca11('0x1a')],{'as':_0xca11('0x18e'),'foreignKey':_0xca11('0x14a'),'onDelete':_0xca11('0x111')});db[_0xca11('0x14b')][_0xca11('0x125')](db[_0xca11('0xe7')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xca11('0x111')});db[_0xca11('0x14b')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack'][_0xca11('0x125')](db['CmContact'],{'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d'),'onDelete':_0xca11('0x111')});db[_0xca11('0x70')]['belongsTo'](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':'ListId','onDelete':'cascade'});db['CmHopperBlack'][_0xca11('0x125')](db[_0xca11('0x1a')],{'as':_0xca11('0x18e'),'foreignKey':_0xca11('0x14a'),'onDelete':_0xca11('0x111')});db[_0xca11('0x70')][_0xca11('0x125')](db[_0xca11('0xe7')],{'as':_0xca11('0xe7'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xca11('0x19d')]['hasMany'](db[_0xca11('0x7d')],{'as':{'plural':_0xca11('0x19e'),'singular':_0xca11('0x19f')},'foreignKey':'AutomationAllId','onDelete':_0xca11('0x111'),'hooks':!![]});db[_0xca11('0x19d')][_0xca11('0x114')](db['Condition'],{'as':{'plural':'Any','singular':_0xca11('0x1a0')},'foreignKey':'AutomationAnyId','onDelete':_0xca11('0x111'),'hooks':!![]});db[_0xca11('0x19d')][_0xca11('0x114')](db[_0xca11('0x76')],{'as':_0xca11('0x1a1'),'foreignKey':'AutomationId','onDelete':_0xca11('0x111'),'hooks':!![]});db['Disposition']['hasMany'](db[_0xca11('0x7b')],{'as':_0xca11('0x163'),'foreignKey':_0xca11('0x1a2'),'onDelete':_0xca11('0x111')});db['Interval']['hasMany'](db[_0xca11('0x151')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xca11('0x111'),'hooks':!![],'required':![]});db['Interval'][_0xca11('0x114')](db[_0xca11('0x18')],{'as':_0xca11('0x1a3'),'foreignKey':'IntervalId','onDelete':_0xca11('0x15f')});db[_0xca11('0x151')]['hasMany'](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xca11('0x177')});db[_0xca11('0x151')][_0xca11('0x114')](db[_0xca11('0x63')],{'as':_0xca11('0x1a4'),'foreignKey':'IntervalId'});db['Interval'][_0xca11('0x114')](db[_0xca11('0x47')],{'as':_0xca11('0x1a5'),'foreignKey':_0xca11('0x177')});db[_0xca11('0x151')]['hasMany'](db[_0xca11('0x51')],{'as':_0xca11('0x1a6'),'foreignKey':_0xca11('0x177')});db['Schedule'][_0xca11('0x125')](db['MailAccount'],{});db['Schedule']['belongsTo'](db[_0xca11('0x96')],{'foreignKey':'DefaultReportId'});db[_0xca11('0x1a7')][_0xca11('0x125')](db[_0xca11('0x94')],{'foreignKey':_0xca11('0x1a8')});db[_0xca11('0x85')][_0xca11('0x127')](db[_0xca11('0x147')],{'as':_0xca11('0x1a9'),'through':_0xca11('0x1aa'),'onDelete':_0xca11('0x15f')});db[_0xca11('0x86')]['belongsToMany'](db[_0xca11('0x6e')],{'through':_0xca11('0x19a')});db[_0xca11('0x86')]['belongsToMany'](db[_0xca11('0x11c')],{'through':_0xca11('0x191')});db['Tag']['belongsToMany'](db[_0xca11('0x120')],{'through':_0xca11('0x170')});db[_0xca11('0x86')][_0xca11('0x127')](db[_0xca11('0x53')],{'through':_0xca11('0x183')});db['Tag'][_0xca11('0x127')](db[_0xca11('0x49')],{'through':_0xca11('0x17d')});db[_0xca11('0x86')]['belongsToMany'](db[_0xca11('0x59')],{'through':_0xca11('0x189')});db[_0xca11('0x86')][_0xca11('0x127')](db[_0xca11('0x101')],{'through':_0xca11('0x1ab')});db['CmContactHasItem'][_0xca11('0x125')](db[_0xca11('0x88')],{'as':_0xca11('0x1ac'),'foreignKey':_0xca11('0x1ad')});db[_0xca11('0x8c')][_0xca11('0x125')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xca11('0x1ae')});db[_0xca11('0x8a')][_0xca11('0x125')](db['CmContact'],{'as':_0xca11('0x15c'),'foreignKey':'CmContactId'});db[_0xca11('0x1af')]['hasMany'](db['Condition'],{'as':{'plural':_0xca11('0x1b0'),'singular':_0xca11('0x1b1')},'foreignKey':_0xca11('0x1b2'),'onDelete':_0xca11('0x111'),'hooks':!![]});db[_0xca11('0x1af')]['hasMany'](db[_0xca11('0x7d')],{'as':{'plural':_0xca11('0x1b3'),'singular':_0xca11('0x1b4')},'foreignKey':_0xca11('0x1b5'),'onDelete':_0xca11('0x111'),'hooks':!![]});db[_0xca11('0x1af')][_0xca11('0x114')](db[_0xca11('0x76')],{'as':_0xca11('0x1a1'),'foreignKey':_0xca11('0x1b6'),'onDelete':'cascade','hooks':!![]});db[_0xca11('0x94')][_0xca11('0x114')](db[_0xca11('0x9c')],{'as':_0xca11('0x1b7'),'onDelete':_0xca11('0x111'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xca11('0x114')](db['AnalyticFieldReport'],{'as':_0xca11('0x1b7'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1b8')});db[_0xca11('0x9a')]['hasMany'](db[_0xca11('0x9c')],{'as':_0xca11('0x1b7'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1b9')});db[_0xca11('0x9c')]['belongsTo'](db[_0xca11('0x9a')],{'foreignKey':_0xca11('0x1b9')});db[_0xca11('0x9f')][_0xca11('0x114')](db[_0xca11('0x1ba')],{'as':'Configurations','onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0x1ba')][_0xca11('0x114')](db[_0xca11('0xa2')],{'as':_0xca11('0x1bc'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bd')});db['SalesforceConfiguration'][_0xca11('0x114')](db[_0xca11('0xa2')],{'as':_0xca11('0x1be'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bf')});db[_0xca11('0x1ba')]['hasMany'](db[_0xca11('0xa2')],{'as':_0xca11('0x1b7'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1c0')});db['SalesforceConfiguration'][_0xca11('0x125')](db[_0xca11('0x9f')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db['SalesforceField'][_0xca11('0x114')](db[_0xca11('0xa2')],{'as':_0xca11('0x1c1'),'foreignKey':'SubjectId'});db[_0xca11('0xa2')][_0xca11('0x114')](db[_0xca11('0xa2')],{'as':_0xca11('0x1c2'),'foreignKey':'DescriptionId'});db[_0xca11('0xa2')]['hasMany'](db['SalesforceField'],{'as':_0xca11('0x1c3'),'foreignKey':_0xca11('0x1c0')});db['SalesforceField'][_0xca11('0x125')](db[_0xca11('0x90')],{'as':'Variable','foreignKey':'VariableId'});db['SugarcrmAccount']['hasMany'](db['SugarcrmConfiguration'],{'as':_0xca11('0x1c4'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0x1c5')][_0xca11('0x114')](db[_0xca11('0xa7')],{'as':_0xca11('0x1bc'),'onDelete':_0xca11('0x111'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0xca11('0x114')](db[_0xca11('0xa7')],{'as':_0xca11('0x1be'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bf')});db[_0xca11('0x1c5')][_0xca11('0x114')](db[_0xca11('0xa7')],{'as':_0xca11('0x1b7'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0x1c5')][_0xca11('0x125')](db[_0xca11('0xa4')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db['SugarcrmField'][_0xca11('0x114')](db[_0xca11('0xa7')],{'as':'Subject','foreignKey':_0xca11('0x1bd')});db[_0xca11('0xa7')][_0xca11('0x114')](db[_0xca11('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xca11('0xa7')][_0xca11('0x114')](db[_0xca11('0xa7')],{'as':_0xca11('0x1c3'),'foreignKey':'FieldId'});db[_0xca11('0xa7')][_0xca11('0x125')](db[_0xca11('0x90')],{'as':'Variable','foreignKey':'VariableId'});db[_0xca11('0x1c6')]['hasMany'](db[_0xca11('0xa9')],{'as':_0xca11('0x1c4'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0xa9')][_0xca11('0x114')](db[_0xca11('0xaa')],{'as':_0xca11('0x1bc'),'onDelete':'cascade','foreignKey':_0xca11('0x1bd')});db[_0xca11('0xa9')][_0xca11('0x114')](db['DeskField'],{'as':'Descriptions','onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bf')});db[_0xca11('0xa9')]['hasMany'](db[_0xca11('0xaa')],{'as':_0xca11('0x1b7'),'onDelete':'cascade','foreignKey':_0xca11('0x1c0')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0xa9')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':'int_desk_configuration_has_tags'});db[_0xca11('0xaa')][_0xca11('0x114')](db[_0xca11('0xaa')],{'as':_0xca11('0x1c1'),'foreignKey':'SubjectId'});db[_0xca11('0xaa')]['hasMany'](db[_0xca11('0xaa')],{'as':_0xca11('0x1c2'),'foreignKey':'DescriptionId'});db[_0xca11('0xaa')][_0xca11('0x114')](db[_0xca11('0xaa')],{'as':_0xca11('0x1c3'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0xaa')][_0xca11('0x125')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xca11('0x1c7')][_0xca11('0x114')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xca11('0x111'),'foreignKey':'AccountId'});db[_0xca11('0xad')]['hasMany'](db[_0xca11('0xae')],{'as':_0xca11('0x1bc'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xca11('0x114')](db[_0xca11('0xae')],{'as':_0xca11('0x1be'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bf')});db['ZohoConfiguration'][_0xca11('0x114')](db[_0xca11('0xae')],{'as':_0xca11('0x1b7'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0xad')]['belongsTo'](db[_0xca11('0x1c7')],{'as':'Account','foreignKey':'AccountId'});db[_0xca11('0xae')]['hasMany'](db[_0xca11('0xae')],{'as':_0xca11('0x1c1'),'foreignKey':'SubjectId'});db[_0xca11('0xae')][_0xca11('0x114')](db[_0xca11('0xae')],{'as':_0xca11('0x1c2'),'foreignKey':_0xca11('0x1bf')});db['ZohoField'][_0xca11('0x114')](db[_0xca11('0xae')],{'as':_0xca11('0x1c3'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0xae')][_0xca11('0x125')](db[_0xca11('0x90')],{'as':'Variable','foreignKey':_0xca11('0x1c8')});db[_0xca11('0xb0')]['hasMany'](db[_0xca11('0x1c9')],{'as':_0xca11('0x1c4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xca11('0x1c9')][_0xca11('0x114')](db[_0xca11('0xb2')],{'as':'Subjects','foreignKey':_0xca11('0x1bd')});db[_0xca11('0x1c9')][_0xca11('0x114')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0xca11('0x1bf')});db[_0xca11('0x1c9')][_0xca11('0x114')](db[_0xca11('0xb2')],{'as':_0xca11('0x1b7'),'foreignKey':'FieldId'});db[_0xca11('0x1c9')][_0xca11('0x125')](db[_0xca11('0xb0')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0x1c9')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x1ca')});db[_0xca11('0xb2')][_0xca11('0x114')](db[_0xca11('0xb2')],{'as':'Subject','foreignKey':_0xca11('0x1bd')});db[_0xca11('0xb2')][_0xca11('0x114')](db[_0xca11('0xb2')],{'as':'Description','foreignKey':_0xca11('0x1bf')});db[_0xca11('0xb2')]['hasMany'](db['ZendeskField'],{'as':_0xca11('0x1c3'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0xb2')][_0xca11('0x125')](db[_0xca11('0x90')],{'as':_0xca11('0x90'),'foreignKey':_0xca11('0x1c8')});db[_0xca11('0xb4')][_0xca11('0x114')](db[_0xca11('0xb5')],{'as':_0xca11('0x1c4'),'onDelete':_0xca11('0x111'),'foreignKey':'AccountId'});db[_0xca11('0xb5')]['hasMany'](db[_0xca11('0x1cb')],{'as':_0xca11('0x1bc'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xca11('0xb5')][_0xca11('0x114')](db[_0xca11('0x1cb')],{'as':'Descriptions','onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bf')});db['FreshdeskConfiguration']['hasMany'](db[_0xca11('0x1cb')],{'as':'Fields','onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0xb5')][_0xca11('0x125')](db[_0xca11('0xb4')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0xb5')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x1cc')});db['FreshdeskField'][_0xca11('0x114')](db[_0xca11('0x1cb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xca11('0x1cb')][_0xca11('0x114')](db[_0xca11('0x1cb')],{'as':_0xca11('0x1c2'),'foreignKey':_0xca11('0x1bf')});db[_0xca11('0x1cb')][_0xca11('0x114')](db[_0xca11('0x1cb')],{'as':_0xca11('0x1c3'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0x1cb')][_0xca11('0x125')](db[_0xca11('0x90')],{'as':_0xca11('0x90'),'foreignKey':'VariableId'});db[_0xca11('0x1cd')][_0xca11('0x114')](db[_0xca11('0x1ce')],{'as':_0xca11('0x1c4'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0x1ce')][_0xca11('0x114')](db[_0xca11('0xb9')],{'as':'Subjects','foreignKey':'SubjectId'});db['VtigerConfiguration'][_0xca11('0x114')](db[_0xca11('0xb9')],{'as':'Descriptions','foreignKey':_0xca11('0x1bf')});db[_0xca11('0x1ce')][_0xca11('0x114')](db['VtigerField'],{'as':_0xca11('0x1b7'),'foreignKey':_0xca11('0x1c0')});db['VtigerConfiguration'][_0xca11('0x125')](db[_0xca11('0x1cd')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db['VtigerField'][_0xca11('0x114')](db[_0xca11('0xb9')],{'as':_0xca11('0x1c1'),'foreignKey':_0xca11('0x1bd')});db[_0xca11('0xb9')][_0xca11('0x114')](db[_0xca11('0xb9')],{'as':_0xca11('0x1c2'),'foreignKey':_0xca11('0x1bf')});db[_0xca11('0xb9')][_0xca11('0x114')](db[_0xca11('0xb9')],{'as':_0xca11('0x1c3'),'foreignKey':'FieldId'});db[_0xca11('0xb9')][_0xca11('0x125')](db[_0xca11('0x90')],{'as':_0xca11('0x90'),'foreignKey':_0xca11('0x1c8')});db['ServicenowAccount'][_0xca11('0x114')](db[_0xca11('0xbd')],{'as':_0xca11('0x1c4'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0xbd')][_0xca11('0x114')](db[_0xca11('0xbf')],{'as':_0xca11('0x1bc'),'foreignKey':_0xca11('0x1bd')});db[_0xca11('0xbd')][_0xca11('0x114')](db[_0xca11('0xbf')],{'as':_0xca11('0x1be'),'foreignKey':_0xca11('0x1bf')});db[_0xca11('0xbd')][_0xca11('0x114')](db[_0xca11('0xbf')],{'as':_0xca11('0x1b7'),'foreignKey':'FieldId'});db[_0xca11('0xbd')][_0xca11('0x125')](db[_0xca11('0xbb')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0xbf')][_0xca11('0x114')](db[_0xca11('0xbf')],{'as':_0xca11('0x1c1'),'foreignKey':_0xca11('0x1bd')});db[_0xca11('0xbf')][_0xca11('0x114')](db[_0xca11('0xbf')],{'as':'Description','foreignKey':_0xca11('0x1bf')});db[_0xca11('0xbf')][_0xca11('0x114')](db[_0xca11('0xbf')],{'as':'Field','foreignKey':'FieldId'});db[_0xca11('0xbf')]['belongsTo'](db[_0xca11('0x90')],{'as':_0xca11('0x90'),'foreignKey':_0xca11('0x1c8')});db['Dynamics365Account']['hasMany'](db[_0xca11('0xc2')],{'as':'Configurations','onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bb')});db['Dynamics365Account'][_0xca11('0x125')](db[_0xca11('0x161')],{'as':_0xca11('0x161'),'foreignKey':_0xca11('0x15e')});db[_0xca11('0xc2')][_0xca11('0x114')](db[_0xca11('0xc4')],{'as':_0xca11('0x1bc'),'onDelete':_0xca11('0x111'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xca11('0x114')](db[_0xca11('0xc4')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xca11('0x1bf')});db[_0xca11('0xc2')][_0xca11('0x114')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xca11('0x111'),'foreignKey':'FieldId'});db[_0xca11('0xc2')][_0xca11('0x125')](db[_0xca11('0xc1')],{'as':_0xca11('0x173'),'foreignKey':'AccountId'});db[_0xca11('0xc4')][_0xca11('0x114')](db[_0xca11('0xc4')],{'as':_0xca11('0x1c1'),'foreignKey':_0xca11('0x1bd')});db['Dynamics365Field'][_0xca11('0x114')](db[_0xca11('0xc4')],{'as':_0xca11('0x1c2'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db[_0xca11('0xc4')],{'as':_0xca11('0x1c3'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0xc4')]['belongsTo'](db[_0xca11('0x90')],{'as':'Variable','foreignKey':'VariableId'});db[_0xca11('0xc6')][_0xca11('0x114')](db[_0xca11('0xc8')],{'as':'Configurations','onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0xc8')]['hasMany'](db[_0xca11('0xca')],{'as':_0xca11('0x1bc'),'foreignKey':_0xca11('0x1bd')});db[_0xca11('0xc8')][_0xca11('0x114')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xca11('0x1bf')});db[_0xca11('0xc8')][_0xca11('0x114')](db[_0xca11('0xca')],{'as':_0xca11('0x1b7'),'foreignKey':'FieldId'});db[_0xca11('0xc8')][_0xca11('0x125')](db[_0xca11('0xc6')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1bb')});db[_0xca11('0xca')][_0xca11('0x114')](db[_0xca11('0xca')],{'as':_0xca11('0x1c1'),'foreignKey':_0xca11('0x1bd')});db[_0xca11('0xca')][_0xca11('0x114')](db[_0xca11('0xca')],{'as':_0xca11('0x1c2'),'foreignKey':_0xca11('0x1bf')});db[_0xca11('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0xca11('0x1c3'),'foreignKey':_0xca11('0x1c0')});db[_0xca11('0xca')][_0xca11('0x125')](db[_0xca11('0x90')],{'as':'Variable','foreignKey':_0xca11('0x1c8')});db[_0xca11('0xcd')][_0xca11('0x125')](db[_0xca11('0x5f')],{});db[_0xca11('0xcd')][_0xca11('0x125')](db[_0xca11('0xf4')],{'as':'List','foreignKey':_0xca11('0x167')});db[_0xca11('0xcd')]['belongsTo'](db[_0xca11('0x6e')],{'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0xcd')][_0xca11('0x125')](db[_0xca11('0x11c')],{});db['ChatQueueReport'][_0xca11('0x125')](db[_0xca11('0x66')],{});db[_0xca11('0xcd')][_0xca11('0x125')](db[_0xca11('0x12')],{});db[_0xca11('0xcd')][_0xca11('0x125')](db[_0xca11('0x67')],{});db[_0xca11('0xcf')][_0xca11('0x125')](db[_0xca11('0x12')],{'onDelete':_0xca11('0x111'),'foreignKey':'FromId'});db[_0xca11('0xcf')]['belongsTo'](db[_0xca11('0x12')],{'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1cf')});db[_0xca11('0xd4')][_0xca11('0x114')](db[_0xca11('0xd2')],{'foreignKey':_0xca11('0x1d0'),'onDelete':_0xca11('0x111')});db[_0xca11('0xd4')][_0xca11('0x114')](db['JscriptyAnswerReport'],{'foreignKey':_0xca11('0x1d0'),'onDelete':_0xca11('0x111')});db[_0xca11('0x1d1')]['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport'][_0xca11('0x125')](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db[_0xca11('0x1d1')]['belongsTo'](db['CmContact'],{'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0x1d1')][_0xca11('0x125')](db['SmsInteraction'],{});db[_0xca11('0x1d1')][_0xca11('0x125')](db[_0xca11('0x54')],{});db[_0xca11('0x1d1')][_0xca11('0x125')](db['User'],{});db['SmsQueueReport']['belongsTo'](db[_0xca11('0x55')],{});db[_0xca11('0xdb')][_0xca11('0x114')](db['JscriptySessionReport'],{'foreignKey':_0xca11('0x1d2')});db['JscriptyProject'][_0xca11('0x114')](db[_0xca11('0xd2')],{'foreignKey':_0xca11('0x1d2')});db[_0xca11('0xdb')][_0xca11('0x114')](db[_0xca11('0xd0')],{'foreignKey':'ProjectId'});db[_0xca11('0x154')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x1d3')});db[_0xca11('0x154')]['belongsToMany'](db[_0xca11('0x1a')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0xca11('0x154')][_0xca11('0x127')](db[_0xca11('0x3c')],{'through':_0xca11('0x1d4'),'as':_0xca11('0x1d5')});db['Team'][_0xca11('0x127')](db[_0xca11('0x67')],{'through':_0xca11('0x1d6'),'as':_0xca11('0x132')});db[_0xca11('0x154')][_0xca11('0x127')](db[_0xca11('0x133')],{'through':_0xca11('0x1d7'),'as':_0xca11('0x134')});db[_0xca11('0x154')][_0xca11('0x127')](db['SmsQueue'],{'through':_0xca11('0x186'),'as':_0xca11('0x135')});db[_0xca11('0x154')]['belongsToMany'](db[_0xca11('0x5d')],{'through':_0xca11('0x18c'),'as':_0xca11('0x136')});db[_0xca11('0x154')][_0xca11('0x127')](db['WhatsappQueue'],{'through':_0xca11('0x1d8'),'as':_0xca11('0x137')});db[_0xca11('0x154')]['belongsToMany'](db[_0xca11('0x130')],{'through':_0xca11('0x10b'),'as':_0xca11('0x131')});db[_0xca11('0xe7')][_0xca11('0x114')](db[_0xca11('0x14b')],{'as':_0xca11('0x1d9'),'foreignKey':_0xca11('0x1da')});db['Campaign']['hasMany'](db['CmHopperFinal'],{'as':_0xca11('0x118'),'foreignKey':_0xca11('0x1da')});db[_0xca11('0xe7')][_0xca11('0x114')](db[_0xca11('0x119')],{'as':_0xca11('0x14c'),'foreignKey':'CampaignId'});db[_0xca11('0xe7')][_0xca11('0x114')](db['CmHopperBlack'],{'as':_0xca11('0x14d'),'foreignKey':_0xca11('0x1da')});db[_0xca11('0xe7')][_0xca11('0x125')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xca11('0xe7')][_0xca11('0x125')](db[_0xca11('0x29')],{'as':_0xca11('0x1db'),'foreignKey':_0xca11('0x150')});db['Campaign'][_0xca11('0x125')](db[_0xca11('0x151')],{'as':_0xca11('0x151'),'foreignKey':_0xca11('0x177')});db[_0xca11('0xe7')][_0xca11('0x125')](db['SquareProject'],{'as':_0xca11('0xe0'),'foreignKey':_0xca11('0x1dc')});db[_0xca11('0xe7')][_0xca11('0x127')](db[_0xca11('0xf4')],{'as':_0xca11('0x1dd'),'through':_0xca11('0x1de')});db[_0xca11('0xe7')]['belongsToMany'](db['CmList'],{'as':_0xca11('0x1df'),'through':_0xca11('0x1e0')});db[_0xca11('0xeb')][_0xca11('0x125')](db[_0xca11('0x175')],{'as':_0xca11('0x175'),'foreignKey':'ChatOfflineMessageId'});db[_0xca11('0xec')][_0xca11('0x125')](db[_0xca11('0x40')],{});db['MailTransferReport']['belongsTo'](db['MailInteraction'],{});db[_0xca11('0xec')][_0xca11('0x125')](db[_0xca11('0x13d')],{'foreignKey':_0xca11('0x1e1'),'as':_0xca11('0x1e2')});db['MailTransferReport'][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e3'),'as':_0xca11('0x1e4')});db[_0xca11('0xec')][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e5'),'as':_0xca11('0x1e6')});db[_0xca11('0xec')][_0xca11('0x125')](db[_0xca11('0x3c')],{'foreignKey':_0xca11('0x1e7'),'as':_0xca11('0x1e8')});db['MailTransferReport'][_0xca11('0x125')](db[_0xca11('0x13d')],{'foreignKey':_0xca11('0x1e9'),'as':'ToAccount'});db[_0xca11('0xed')][_0xca11('0x125')](db[_0xca11('0x66')],{});db[_0xca11('0xed')][_0xca11('0x125')](db['ChatInteraction'],{});db[_0xca11('0xed')]['belongsTo'](db[_0xca11('0x5f')],{'foreignKey':_0xca11('0x1ea'),'as':_0xca11('0x1e2')});db['ChatTransferReport'][_0xca11('0x125')](db['User'],{'foreignKey':'FromUserId','as':_0xca11('0x1e4')});db[_0xca11('0xed')][_0xca11('0x125')](db['User'],{'foreignKey':_0xca11('0x1e5'),'as':'ToAgent'});db['ChatTransferReport']['belongsTo'](db[_0xca11('0x67')],{'foreignKey':_0xca11('0x1eb'),'as':_0xca11('0x1e8')});db[_0xca11('0xed')][_0xca11('0x125')](db[_0xca11('0x5f')],{'foreignKey':_0xca11('0x1ec'),'as':_0xca11('0x1ed')});db[_0xca11('0xef')][_0xca11('0x125')](db[_0xca11('0x4b')],{});db['FaxTransferReport'][_0xca11('0x125')](db[_0xca11('0x49')],{});db['FaxTransferReport']['belongsTo'](db[_0xca11('0x46')],{'foreignKey':'FromFaxAccountId','as':_0xca11('0x1e2')});db[_0xca11('0xef')][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e3'),'as':_0xca11('0x1e4')});db['FaxTransferReport'][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e5'),'as':_0xca11('0x1e6')});db[_0xca11('0xef')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xca11('0x1ee'),'as':_0xca11('0x1e8')});db['FaxTransferReport'][_0xca11('0x125')](db[_0xca11('0x46')],{'foreignKey':_0xca11('0x1ef'),'as':_0xca11('0x1ed')});db['OpenchannelTransferReport']['belongsTo'](db[_0xca11('0x5b')],{});db[_0xca11('0xf1')][_0xca11('0x125')](db[_0xca11('0x59')],{});db[_0xca11('0xf1')][_0xca11('0x125')](db[_0xca11('0x57')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0xca11('0xf1')][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e3'),'as':_0xca11('0x1e4')});db['OpenchannelTransferReport'][_0xca11('0x125')](db['User'],{'foreignKey':_0xca11('0x1e5'),'as':_0xca11('0x1e6')});db[_0xca11('0xf1')][_0xca11('0x125')](db[_0xca11('0x5d')],{'foreignKey':_0xca11('0x1f0'),'as':'ToQueue'});db[_0xca11('0xf1')][_0xca11('0x125')](db[_0xca11('0x57')],{'foreignKey':_0xca11('0x1f1'),'as':_0xca11('0x1ed')});db['SmsTransferReport'][_0xca11('0x125')](db[_0xca11('0x54')],{});db['SmsTransferReport'][_0xca11('0x125')](db[_0xca11('0x53')],{});db[_0xca11('0x1f2')][_0xca11('0x125')](db[_0xca11('0x141')],{'foreignKey':_0xca11('0x1f3'),'as':_0xca11('0x1e2')});db[_0xca11('0x1f2')][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e3'),'as':_0xca11('0x1e4')});db[_0xca11('0x1f2')][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e5'),'as':_0xca11('0x1e6')});db[_0xca11('0x1f2')][_0xca11('0x125')](db[_0xca11('0x55')],{'foreignKey':_0xca11('0x1f4'),'as':_0xca11('0x1e8')});db[_0xca11('0x1f2')][_0xca11('0x125')](db[_0xca11('0x141')],{'foreignKey':_0xca11('0x1f5'),'as':_0xca11('0x1ed')});db[_0xca11('0xf4')][_0xca11('0x114')](db[_0xca11('0x7b')],{'as':_0xca11('0x163'),'foreignKey':_0xca11('0x167'),'onDelete':_0xca11('0x111')});db['CmList']['hasMany'](db[_0xca11('0x74')],{'as':'CustomFields','foreignKey':_0xca11('0x167')});db[_0xca11('0xf4')][_0xca11('0x114')](db[_0xca11('0x6e')],{'as':_0xca11('0x129'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x167')});db[_0xca11('0xf4')][_0xca11('0x114')](db[_0xca11('0x117')],{'as':_0xca11('0x118'),'foreignKey':_0xca11('0x167')});db[_0xca11('0xf4')][_0xca11('0x114')](db[_0xca11('0x119')],{'as':'HopperHistory','foreignKey':_0xca11('0x167')});db[_0xca11('0xf4')][_0xca11('0x114')](db[_0xca11('0x72')],{'as':_0xca11('0x72'),'foreignKey':_0xca11('0x167')});db[_0xca11('0xf4')][_0xca11('0x127')](db[_0xca11('0x1a')],{'as':_0xca11('0x1f6'),'through':_0xca11('0x1f7')});db[_0xca11('0xf4')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x138')});db['VoicePrefix'][_0xca11('0x114')](db[_0xca11('0x18')],{'as':_0xca11('0x1a3'),'onDelete':_0xca11('0x111')});db['VoicePrefix'][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x10d')});db[_0xca11('0x130')][_0xca11('0x127')](db[_0xca11('0x154')],{'through':'TeamVoicePrefix','as':_0xca11('0x16b')});db[_0xca11('0xf7')][_0xca11('0x114')](db[_0xca11('0x12')],{'as':_0xca11('0x171'),'foreignKey':'userProfileId'});db[_0xca11('0xf7')]['hasMany'](db['UserProfileSection'],{'as':_0xca11('0x1f8'),'foreignKey':_0xca11('0x126'),'onDelete':_0xca11('0x111')});db['UserProfileSection'][_0xca11('0x114')](db[_0xca11('0xfb')],{'as':_0xca11('0x1f9'),'foreignKey':_0xca11('0x1fa'),'onDelete':'cascade'});db[_0xca11('0xfd')]['hasMany'](db['Disposition'],{'as':_0xca11('0x163'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xca11('0xfd')][_0xca11('0x114')](db[_0xca11('0x79')],{'as':_0xca11('0x164'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xca11('0x114')](db[_0xca11('0x102')],{'as':_0xca11('0x157'),'foreignKey':_0xca11('0x1fb')});db['WhatsappAccount']['hasMany'](db['WhatsappInteraction'],{'as':_0xca11('0x165')});db[_0xca11('0xfd')][_0xca11('0x114')](db[_0xca11('0xff')],{'as':_0xca11('0x146')});db['WhatsappAccount']['belongsTo'](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':_0xca11('0x167')});db[_0xca11('0xfd')][_0xca11('0x125')](db['Pause'],{'as':_0xca11('0x16a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xca11('0xfd')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xca11('0x125')](db[_0xca11('0x12')],{'onDelete':_0xca11('0x15f')});db[_0xca11('0xff')]['belongsTo'](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xca11('0xff')][_0xca11('0x125')](db[_0xca11('0xfd')],{'onDelete':_0xca11('0x15f')});db['WhatsappApplication'][_0xca11('0x125')](db['Interval'],{'onDelete':_0xca11('0x15f'),'foreignKey':_0xca11('0x177')});db[_0xca11('0xff')][_0xca11('0x125')](db[_0xca11('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['WhatsappInteraction'][_0xca11('0x114')](db['WhatsappMessage'],{'as':_0xca11('0x157'),'onDelete':_0xca11('0x111'),'foreignKey':_0xca11('0x1fc')});db[_0xca11('0x101')]['belongsTo'](db[_0xca11('0xfd')],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1fb')});db[_0xca11('0x101')][_0xca11('0x125')](db[_0xca11('0x6e')],{'as':'Contact','foreignKey':_0xca11('0x16d')});db[_0xca11('0x101')]['belongsTo'](db[_0xca11('0x12')],{'as':'Owner','foreignKey':_0xca11('0x112')});db[_0xca11('0x101')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x1ab'),'as':_0xca11('0x16f')});db[_0xca11('0x101')][_0xca11('0x127')](db[_0xca11('0x86')],{'through':_0xca11('0x1ab'),'as':_0xca11('0x17e')});db[_0xca11('0x101')]['belongsToMany'](db[_0xca11('0x12')],{'as':_0xca11('0x171'),'through':_0xca11('0x12f'),'foreignKey':'WhatsappInteractionId'});db[_0xca11('0x102')][_0xca11('0x125')](db[_0xca11('0x12')],{'as':_0xca11('0x12')});db[_0xca11('0x102')][_0xca11('0x125')](db[_0xca11('0x6e')],{'onDelete':'cascade','as':'Contact'});db['WhatsappMessage'][_0xca11('0x125')](db[_0xca11('0x101')],{'onDelete':_0xca11('0x111'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0xca11('0x102')]['belongsTo'](db['WhatsappAccount'],{'as':_0xca11('0x173'),'foreignKey':_0xca11('0x1fb')});db['WhatsappQueueReport'][_0xca11('0x125')](db[_0xca11('0xfd')],{});db[_0xca11('0x104')]['belongsTo'](db[_0xca11('0xf4')],{'as':_0xca11('0x166'),'foreignKey':'ListId'});db[_0xca11('0x104')][_0xca11('0x125')](db[_0xca11('0x6e')],{'as':_0xca11('0x15c'),'foreignKey':_0xca11('0x16d')});db[_0xca11('0x104')][_0xca11('0x125')](db[_0xca11('0x101')],{});db['WhatsappQueueReport'][_0xca11('0x125')](db[_0xca11('0x107')],{});db[_0xca11('0x104')][_0xca11('0x125')](db[_0xca11('0x102')],{});db['WhatsappQueueReport'][_0xca11('0x125')](db['User'],{});db['WhatsappTransferReport'][_0xca11('0x125')](db[_0xca11('0x102')],{});db[_0xca11('0x105')][_0xca11('0x125')](db['WhatsappInteraction'],{});db['WhatsappTransferReport']['belongsTo'](db[_0xca11('0xfd')],{'foreignKey':_0xca11('0x1fd'),'as':_0xca11('0x1e2')});db[_0xca11('0x105')][_0xca11('0x125')](db[_0xca11('0xfd')],{'foreignKey':_0xca11('0x1fe'),'as':_0xca11('0x1ed')});db[_0xca11('0x105')][_0xca11('0x125')](db[_0xca11('0x107')],{'foreignKey':'ToQueueId','as':_0xca11('0x1e8')});db[_0xca11('0x105')]['belongsTo'](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e3'),'as':_0xca11('0x1e4')});db[_0xca11('0x105')][_0xca11('0x125')](db[_0xca11('0x12')],{'foreignKey':_0xca11('0x1e5'),'as':_0xca11('0x1e6')});db[_0xca11('0x107')][_0xca11('0x127')](db[_0xca11('0x12')],{'as':_0xca11('0x153'),'through':_0xca11('0x1ff'),'foreignKey':_0xca11('0x200')});db['WhatsappQueue'][_0xca11('0x127')](db[_0xca11('0x154')],{'through':'team_has_whatsapp_queues','as':_0xca11('0x16b')});db['UserSetting'][_0xca11('0x125')](db['User'],{'as':_0xca11('0x201'),'foreignKey':_0xca11('0x112'),'onDelete':_0xca11('0x111'),'hooks':!![]});db[_0xca11('0x161')][_0xca11('0x10f')](db[_0xca11('0xc1')],{'as':_0xca11('0xc1'),'onDelete':'restrict'});db[_0xca11('0x161')]['hasOne'](db['MailServerIn'],{'as':_0xca11('0x162'),'onDelete':_0xca11('0x15f')});db[_0xca11('0x161')][_0xca11('0x10f')](db[_0xca11('0x160')],{'as':_0xca11('0x202'),'onDelete':_0xca11('0x15f')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x9d5f=['WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','OpenchannelInteraction','user_has_openchannel_interactions','VoicePrefix','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','VoiceAgentReport','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Dispositions','CannedAnswer','Answers','MailMessage','Interactions','List','mandatoryDispositionPause','team_has_mail_queues','Teams','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachment','Attachments','ChatWebsite','MailQueueReport','ListId','Dashboard','DashboardItem','FaxAccountId','Exntensions','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','Interaction','team_has_fax_queues','SmsAccountId','SmsInteractionId','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','ChatQueue','Queue','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','ChatInternalMessage','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','Condition','All','OneAll','AutomationAllId','Action','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','Sound','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','Subject','Field','FieldId','VariableId','DeskConfiguration','Subjects','int_desk_configuration_has_tags','ZohoField','Description','ZendeskAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','VtigerField','ServicenowAccount','Dynamics365Account','Dynamics365Field','FreshsalesAccount','ChatQueueReport','FromId','SessionId','ProjectId','JscriptyAnswerReport','TeamVoiceQueue','VoiceQueues','MailQueues','team_has_chat_queues','OpenchannelQueues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','Lists','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','WhatsappQueueId','Smtp','../config/environment','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','sequelizeHistory','utf8','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','Disposition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction'];(function(_0x5d79a9,_0xafa2f2){var _0x5b6b86=function(_0x5b6472){while(--_0x5b6472){_0x5d79a9['push'](_0x5d79a9['shift']());}};_0x5b6b86(++_0xafa2f2);}(_0x9d5f,0xfc));var _0xf9d5=function(_0x332dce,_0x572ea1){_0x332dce=_0x332dce-0x0;var _0x16e2ab=_0x9d5f[_0x332dce];return _0x16e2ab;};'use strict';var config=require(_0xf9d5('0x0'));var Sequelize=require('sequelize');var _=require(_0xf9d5('0x1'));var jstz=require(_0xf9d5('0x2'));var timezone=jstz[_0xf9d5('0x3')]();config[_0xf9d5('0x4')]=_['defaultsDeep'](config['sequelize'],{'database':_0xf9d5('0x5'),'username':_0xf9d5('0x6'),'password':_0xf9d5('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xf9d5('0x8'),'dialectOptions':{'charset':_0xf9d5('0x9')},'logging':![],'timezone':timezone[_0xf9d5('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0xf9d5('0xb')]=_['defaultsDeep'](config[_0xf9d5('0xb')],{'database':_0xf9d5('0x5'),'username':'xcall','password':_0xf9d5('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xf9d5('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xf9d5('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf9d5('0x4')][_0xf9d5('0xd')],config[_0xf9d5('0x4')][_0xf9d5('0xe')],config[_0xf9d5('0x4')][_0xf9d5('0xf')],config['sequelize'][_0xf9d5('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf9d5('0xb')][_0xf9d5('0xd')],config[_0xf9d5('0xb')][_0xf9d5('0xe')],config[_0xf9d5('0xb')]['password'],config[_0xf9d5('0xb')]['options'])};db[_0xf9d5('0x11')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x12'));db[_0xf9d5('0x13')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xf9d5('0x15')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x16'));db[_0xf9d5('0x17')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x18'));db[_0xf9d5('0x19')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x1a'));db[_0xf9d5('0x1b')]=db[_0xf9d5('0x4')]['import']('../api/voiceQueue/voiceQueue.model');db[_0xf9d5('0x1c')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x1d'));db[_0xf9d5('0x1e')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x1f'));db['VoiceMail']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x20'));db[_0xf9d5('0x21')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x22'));db[_0xf9d5('0x23')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x24'));db['VoiceDialReport']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x25'));db['VoiceAgentReport']=db[_0xf9d5('0x4')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x26'));db[_0xf9d5('0x27')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/memberReport/memberReport.model');db[_0xf9d5('0x28')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x29'));db['VoiceTransferReport']=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xf9d5('0x2a')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xf9d5('0x2b')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x2c'));db['UserChatQueue']=db['sequelize']['import']('../api/userChatQueue/userChatQueue.model');db[_0xf9d5('0x2d')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x2e'));db[_0xf9d5('0x2f')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x30'));db[_0xf9d5('0x31')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x32'));db[_0xf9d5('0x33')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x34'));db[_0xf9d5('0x35')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x36'));db[_0xf9d5('0x37')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x38'));db[_0xf9d5('0x39')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x3a'));db['MailAccount']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x3b'));db[_0xf9d5('0x3c')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x3d'));db[_0xf9d5('0x3e')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x3f'));db['MailMessage']=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x40'));db[_0xf9d5('0x41')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x42'));db['MailQueueReport']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x43'));db['Dashboard']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x44'));db['DashboardItem']=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x45'));db[_0xf9d5('0x46')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/faxAccount/faxAccount.model');db[_0xf9d5('0x47')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x48'));db[_0xf9d5('0x49')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x4a'));db[_0xf9d5('0x4b')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/faxMessage/faxMessage.model');db[_0xf9d5('0x4c')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x4d'));db[_0xf9d5('0x4e')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x4f'));db[_0xf9d5('0x50')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x51'));db[_0xf9d5('0x52')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x53'));db[_0xf9d5('0x54')]=db['sequelize']['import'](_0xf9d5('0x55'));db[_0xf9d5('0x56')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0xf9d5('0x57')]=db['sequelize'][_0xf9d5('0x14')]('../api/smsQueue/smsQueue.model');db[_0xf9d5('0x58')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x59'));db[_0xf9d5('0x5a')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x5b'));db['OpenchannelInteraction']=db['sequelize'][_0xf9d5('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x5c'));db[_0xf9d5('0x5d')]=db[_0xf9d5('0x4')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x5e'));db['OpenchannelQueueReport']=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x5f'));db[_0xf9d5('0x60')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/chatApplication/chatApplication.model');db[_0xf9d5('0x61')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x62'));db[_0xf9d5('0x63')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x64'));db[_0xf9d5('0x65')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x66'));db[_0xf9d5('0x67')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x68'));db[_0xf9d5('0x69')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x6a'));db[_0xf9d5('0x6b')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x6c'));db[_0xf9d5('0x6d')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x6e'));db[_0xf9d5('0x6f')]=db[_0xf9d5('0x4')]['import']('../api/cmHopper/cmHopper.model');db[_0xf9d5('0x70')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x71'));db[_0xf9d5('0x72')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x73'));db[_0xf9d5('0x74')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x75'));db[_0xf9d5('0x76')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xf9d5('0x77')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x78'));db['Action']=db['sequelize'][_0xf9d5('0x14')]('../api/action/action.model');db[_0xf9d5('0x79')]=db['sequelize'][_0xf9d5('0x14')]('../api/automation/automation.model');db['CannedAnswer']=db[_0xf9d5('0x4')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0xf9d5('0x7a')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/disposition/disposition.model');db['Condition']=db['sequelize'][_0xf9d5('0x14')]('../api/condition/condition.model');db[_0xf9d5('0x7b')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x7c'));db[_0xf9d5('0x7d')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x7e'));db['Cdr']=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x7f'));db[_0xf9d5('0x80')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x81'));db['Schedule']=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/schedule/schedule.model');db['Sound']=db['sequelize'][_0xf9d5('0x14')]('../api/sound/sound.model');db[_0xf9d5('0x82')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x83'));db[_0xf9d5('0x84')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x85'));db[_0xf9d5('0x86')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x87'));db[_0xf9d5('0x88')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x89'));db[_0xf9d5('0x8a')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x8b'));db[_0xf9d5('0x8c')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x8d'));db[_0xf9d5('0x8e')]=db[_0xf9d5('0x4')]['import']('../api/variable/variable.model');db[_0xf9d5('0x8f')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x90'));db[_0xf9d5('0x91')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x92'));db[_0xf9d5('0x93')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x94'));db[_0xf9d5('0x95')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x96'));db[_0xf9d5('0x97')]=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xf9d5('0x98')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x99'));db[_0xf9d5('0x9a')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0x9b'));db[_0xf9d5('0x9c')]=db['sequelize'][_0xf9d5('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xf9d5('0x9d')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x9e'));db[_0xf9d5('0x9f')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xa0'));db[_0xf9d5('0xa1')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xa2'));db[_0xf9d5('0xa3')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0xa4'));db[_0xf9d5('0xa5')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xa6'));db[_0xf9d5('0xa7')]=db['sequelize'][_0xf9d5('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xf9d5('0xa8')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xa9'));db['DeskConfiguration']=db[_0xf9d5('0x4')]['import'](_0xf9d5('0xaa'));db[_0xf9d5('0xab')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xac'));db[_0xf9d5('0xad')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0xae'));db[_0xf9d5('0xaf')]=db['sequelize']['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0xb0'));db['ZendeskAccount']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xb1'));db['ZendeskConfiguration']=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xb2'));db[_0xf9d5('0xb3')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xb4'));db[_0xf9d5('0xb5')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0xb6'));db[_0xf9d5('0xb7')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xf9d5('0xb8')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0xb9'));db[_0xf9d5('0xba')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xbb'));db['VtigerField']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xbc'));db['ServicenowAccount']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xbd'));db[_0xf9d5('0xbe')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0xbf'));db[_0xf9d5('0xc0')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xc1'));db['Dynamics365Account']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xc2'));db[_0xf9d5('0xc3')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0xc4'));db['Dynamics365Field']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xc5'));db['FreshsalesAccount']=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xf9d5('0xc6')]=db['sequelize'][_0xf9d5('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xf9d5('0xc7')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0xc8'));db[_0xf9d5('0x8f')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/integration/integration.model');db[_0xf9d5('0xc9')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xca'));db['ChatQueueReport']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xcb'));db['ChatInternalMessage']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xcc'));db['JscriptyAnswerReport']=db['sequelize'][_0xf9d5('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xf9d5('0xcd')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xf9d5('0xce')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0xcf'));db[_0xf9d5('0xd0')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xf9d5('0xd1')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xd2'));db['SquareDetailsReport']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xd3'));db[_0xf9d5('0xd4')]=db['sequelize']['import'](_0xf9d5('0xd5'));db[_0xf9d5('0xd6')]=db[_0xf9d5('0x4')]['import']('../api/setting/setting.model');db[_0xf9d5('0xd7')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xd8'));db[_0xf9d5('0xd9')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/squareProject/squareProject.model');db[_0xf9d5('0xda')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xdb'));db['SquareMessage']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xdc'));db[_0xf9d5('0xdd')]=db[_0xf9d5('0x4')]['import']('../api/team/team.model');db[_0xf9d5('0xde')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/license/license.model');db['Campaign']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xdf'));db[_0xf9d5('0xe0')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xe1'));db['Attachment']=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/attachment/attachment.model');db[_0xf9d5('0xe2')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0xe3'));db[_0xf9d5('0xe4')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xe5'));db[_0xf9d5('0xe6')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xe7'));db[_0xf9d5('0xe8')]=db[_0xf9d5('0x4')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xf9d5('0xe9')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xea'));db[_0xf9d5('0xeb')]=db['sequelize']['import'](_0xf9d5('0xec'));db[_0xf9d5('0xed')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xee'));db['VoicePrefix']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xef'));db[_0xf9d5('0xf0')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xf1'));db['UserProfileSection']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xf2'));db[_0xf9d5('0xf3')]=db['sequelize'][_0xf9d5('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xf9d5('0xf4')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xf5'));db[_0xf9d5('0xf6')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0xf9d5('0xf7')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0xf8'));db[_0xf9d5('0xf9')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xf9d5('0xfa')]=db[_0xf9d5('0x4')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0xf9d5('0xfb')]=db['sequelize'][_0xf9d5('0x14')](_0xf9d5('0xfc'));db[_0xf9d5('0xfd')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0xfe'));db[_0xf9d5('0xff')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x100'));db[_0xf9d5('0x101')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x102'));db['TeamVoiceQueue']=db[_0xf9d5('0x4')][_0xf9d5('0x14')](_0xf9d5('0x103'));db[_0xf9d5('0x104')]=db[_0xf9d5('0x4')][_0xf9d5('0x14')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xf9d5('0x105')]=db[_0xf9d5('0x4')]['import'](_0xf9d5('0x106'));db[_0xf9d5('0x107')]=db['sequelize']['import'](_0xf9d5('0x108'));db[_0xf9d5('0x11')][_0xf9d5('0x109')](db[_0xf9d5('0x10a')],{'as':_0xf9d5('0x10a'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x109')](db[_0xf9d5('0x107')],{'as':'userSetting','onDelete':'cascade','foreignKey':'UserId'});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c')],{'as':_0xf9d5('0x10e'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0x2a')],{'as':_0xf9d5('0x10f'),'foreignKey':_0xf9d5('0x10c')});db['User']['hasMany'](db[_0xf9d5('0x17')],{'as':'Extensions','onDelete':_0xf9d5('0x10b'),'hooks':!![]});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0x72')],{'as':'HopperFinals','foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0x74')],{'as':'HopperHistory','foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xf9d5('0x10c')});db['User'][_0xf9d5('0x10d')](db['OpenchannelInteraction'],{'as':_0xf9d5('0x110'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db['ChatInteraction'],{'as':_0xf9d5('0x111'),'foreignKey':'UserId'});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0x54')],{'as':_0xf9d5('0x112'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db['FaxInteraction'],{'as':_0xf9d5('0x113'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0x114')],{'as':'MailInteractions','foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0xf9')],{'as':'WhatsappInteractions','foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x11')][_0xf9d5('0x10d')](db[_0xf9d5('0xf4')],{'as':_0xf9d5('0x115'),'foreignKey':'SenderId'});db['User'][_0xf9d5('0x116')](db[_0xf9d5('0xf0')],{'as':_0xf9d5('0xf0'),'foreignKey':_0xf9d5('0x117')});db['User'][_0xf9d5('0x118')](db[_0xf9d5('0x67')],{'as':_0xf9d5('0x119'),'through':_0xf9d5('0x11a')});db[_0xf9d5('0x11')]['belongsToMany'](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x11b'),'through':_0xf9d5('0x11c')});db['User'][_0xf9d5('0x118')](db[_0xf9d5('0xed')],{'as':'Lists','through':_0xf9d5('0x11d')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0xdd')],{'through':_0xf9d5('0x11e')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x114')],{'as':_0xf9d5('0x11f'),'through':_0xf9d5('0x120')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x61')],{'as':_0xf9d5('0x111'),'through':_0xf9d5('0x121')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x49')],{'as':'FaxInteractions','through':_0xf9d5('0x122')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x54')],{'as':_0xf9d5('0x112'),'through':'user_has_sms_interactions'});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x123')],{'as':_0xf9d5('0x110'),'through':_0xf9d5('0x124')});db[_0xf9d5('0x11')]['belongsToMany'](db[_0xf9d5('0xf9')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x1b')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db[_0xf9d5('0x125')],{'as':'VoicePrefixes','through':_0xf9d5('0x105'),'required':![]});db[_0xf9d5('0x11')]['belongsToMany'](db[_0xf9d5('0x3c')],{'as':'MailQueues','through':_0xf9d5('0x2d'),'required':![]});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db['ChatQueue'],{'as':_0xf9d5('0x126'),'through':_0xf9d5('0x127'),'required':![],'hooks':!![]});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db['FaxQueue'],{'as':_0xf9d5('0x128'),'through':_0xf9d5('0x2f'),'required':![]});db['User'][_0xf9d5('0x118')](db[_0xf9d5('0x57')],{'as':_0xf9d5('0x129'),'through':_0xf9d5('0x31'),'required':![]});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0xf9d5('0x33'),'required':![]});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0xff')],{'as':_0xf9d5('0x12a'),'through':'UserWhatsappQueue','required':![]});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0xed')],{'through':_0xf9d5('0x11d')});db[_0xf9d5('0x11')]['belongsToMany'](db['ChatWebsite'],{'as':_0xf9d5('0x12b'),'through':_0xf9d5('0x12c')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x46')],{'as':_0xf9d5('0x12d'),'through':_0xf9d5('0x12e')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x12f')],{'as':_0xf9d5('0x130'),'through':_0xf9d5('0x131')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0x58')],{'as':'OpenchannelAccounts','through':_0xf9d5('0x132')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db['SmsAccount'],{'as':_0xf9d5('0x133'),'through':_0xf9d5('0x134')});db[_0xf9d5('0x11')][_0xf9d5('0x118')](db[_0xf9d5('0xf6')],{'as':_0xf9d5('0x135'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy'][_0xf9d5('0x10d')](db[_0xf9d5('0x17')],{'as':_0xf9d5('0x136'),'onDelete':'cascade','foreignKey':_0xf9d5('0x137')});db[_0xf9d5('0x15')][_0xf9d5('0x10d')](db['VoiceExtension'],{'onDelete':_0xf9d5('0x10b')});db['VoiceExtension'][_0xf9d5('0x10d')](db[_0xf9d5('0x17')],{'as':_0xf9d5('0x138'),'onDelete':_0xf9d5('0x10b')});db['VoiceMusicOnHold']['belongsToMany'](db['Sound'],{'as':'Sounds','through':_0xf9d5('0x139')});db[_0xf9d5('0x1b')][_0xf9d5('0x10d')](db[_0xf9d5('0x2a')],{'as':_0xf9d5('0x13a'),'foreignKey':_0xf9d5('0x13b')});db[_0xf9d5('0x1b')][_0xf9d5('0x10d')](db[_0xf9d5('0x6f')],{'as':_0xf9d5('0x13c'),'foreignKey':_0xf9d5('0x13b')});db['VoiceQueue'][_0xf9d5('0x10d')](db[_0xf9d5('0x72')],{'as':_0xf9d5('0x13d'),'foreignKey':'VoiceQueueId'});db[_0xf9d5('0x1b')][_0xf9d5('0x10d')](db[_0xf9d5('0x74')],{'as':_0xf9d5('0x13e'),'foreignKey':_0xf9d5('0x13b')});db[_0xf9d5('0x1b')][_0xf9d5('0x10d')](db[_0xf9d5('0x76')],{'as':_0xf9d5('0x76'),'foreignKey':_0xf9d5('0x13b')});db[_0xf9d5('0x1b')][_0xf9d5('0x10d')](db['CmHopperBlack'],{'as':_0xf9d5('0x13f'),'foreignKey':_0xf9d5('0x13b')});db[_0xf9d5('0x1b')]['hasMany'](db[_0xf9d5('0xce')],{'as':_0xf9d5('0x140'),'foreignKey':_0xf9d5('0x13b')});db[_0xf9d5('0x1b')][_0xf9d5('0x116')](db['Trunk'],{'as':_0xf9d5('0x28'),'foreignKey':'TrunkId'});db[_0xf9d5('0x1b')][_0xf9d5('0x116')](db['Trunk'],{'as':_0xf9d5('0x141'),'foreignKey':_0xf9d5('0x142')});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0xf9d5('0x7b'),'foreignKey':_0xf9d5('0x143')});db[_0xf9d5('0x1b')][_0xf9d5('0x116')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xf9d5('0x144')});db[_0xf9d5('0x1b')][_0xf9d5('0x118')](db[_0xf9d5('0xed')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xf9d5('0x1b')][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x2b')});db[_0xf9d5('0x1b')][_0xf9d5('0x118')](db['Team'],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xf9d5('0x1b')]['belongsToMany'](db[_0xf9d5('0xed')],{'as':'BlackLists','through':_0xf9d5('0x146')});db[_0xf9d5('0x1c')][_0xf9d5('0x116')](db['User'],{'as':_0xf9d5('0x11'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x1e')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':'User','foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x10a')][_0xf9d5('0x10d')](db[_0xf9d5('0x21')],{'as':_0xf9d5('0x147'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x148'),'sourceKey':_0xf9d5('0x149')});db[_0xf9d5('0x21')][_0xf9d5('0x116')](db[_0xf9d5('0x10a')],{'foreignKey':_0xf9d5('0x148'),'targetKey':'mailbox'});db['VoiceCallReport'][_0xf9d5('0x10d')](db[_0xf9d5('0x14a')],{'as':_0xf9d5('0x14b'),'foreignKey':'uniqueid','constraints':![]});db[_0xf9d5('0x23')]['hasMany'](db[_0xf9d5('0x14c')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xf9d5('0x23')]['belongsTo'](db[_0xf9d5('0x11')],{'as':'User','foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x23')][_0xf9d5('0x116')](db['CmContact'],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db['MailServerIn'][_0xf9d5('0x116')](db[_0xf9d5('0x12f')],{'as':_0xf9d5('0x12f'),'foreignKey':_0xf9d5('0x14f')});db[_0xf9d5('0x37')][_0xf9d5('0x116')](db['CloudProvider'],{'as':_0xf9d5('0x101'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xf9d5('0x39')][_0xf9d5('0x116')](db[_0xf9d5('0x12f')],{'as':_0xf9d5('0x12f'),'foreignKey':'MailAccountId'});db[_0xf9d5('0x39')][_0xf9d5('0x116')](db['CloudProvider'],{'as':_0xf9d5('0x101'),'foreignKey':_0xf9d5('0x150'),'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x12f')][_0xf9d5('0x109')](db['MailServerIn'],{'as':_0xf9d5('0x152'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x12f')][_0xf9d5('0x109')](db[_0xf9d5('0x39')],{'as':'Smtp','onDelete':'cascade'});db[_0xf9d5('0x12f')][_0xf9d5('0x10d')](db['Disposition'],{'as':_0xf9d5('0x153'),'foreignKey':'MailAccountId','onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x12f')][_0xf9d5('0x10d')](db[_0xf9d5('0x154')],{'as':_0xf9d5('0x155'),'foreignKey':_0xf9d5('0x14f')});db[_0xf9d5('0x12f')][_0xf9d5('0x10d')](db[_0xf9d5('0x156')],{'as':'Messages','foreignKey':_0xf9d5('0x14f')});db[_0xf9d5('0x12f')][_0xf9d5('0x10d')](db[_0xf9d5('0x114')],{'as':_0xf9d5('0x157')});db[_0xf9d5('0x12f')]['hasMany'](db[_0xf9d5('0x41')],{'as':_0xf9d5('0x138')});db['MailAccount']['belongsTo'](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x158'),'foreignKey':'ListId'});db[_0xf9d5('0x12f')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0xf9d5('0x12f')][_0xf9d5('0x116')](db[_0xf9d5('0x7d')],{'as':_0xf9d5('0x159'),'foreignKey':_0xf9d5('0x144')});db['MailAccount'][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x131')});db[_0xf9d5('0x3c')]['belongsToMany'](db[_0xf9d5('0x11')],{'as':'Agents','through':_0xf9d5('0x2d')});db[_0xf9d5('0x3c')][_0xf9d5('0x118')](db[_0xf9d5('0xdd')],{'through':_0xf9d5('0x15a'),'as':_0xf9d5('0x15b')});db['MailInteraction'][_0xf9d5('0x10d')](db[_0xf9d5('0x156')],{'as':'Messages','onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x15c')});db[_0xf9d5('0x114')][_0xf9d5('0x116')](db[_0xf9d5('0x12f')],{'as':_0xf9d5('0x15d'),'foreignKey':'MailAccountId'});db[_0xf9d5('0x114')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x114')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':'Owner','foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x114')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':'mail_interaction_has_tags','as':_0xf9d5('0x15e')});db[_0xf9d5('0x114')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x15f'),'as':_0xf9d5('0x160')});db[_0xf9d5('0x114')][_0xf9d5('0x118')](db['User'],{'as':_0xf9d5('0x161'),'through':_0xf9d5('0x120'),'foreignKey':_0xf9d5('0x15c')});db[_0xf9d5('0x156')]['hasMany'](db[_0xf9d5('0x162')],{'as':_0xf9d5('0x163'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x156')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x11')});db[_0xf9d5('0x156')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'onDelete':_0xf9d5('0x10b'),'as':_0xf9d5('0x14d')});db['MailMessage'][_0xf9d5('0x116')](db[_0xf9d5('0x114')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xf9d5('0x156')][_0xf9d5('0x116')](db[_0xf9d5('0x12f')],{'as':'Account','foreignKey':'MailAccountId'});db['MailMessage'][_0xf9d5('0x116')](db[_0xf9d5('0x164')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0xf9d5('0x156')]['belongsTo'](db[_0xf9d5('0x65')],{'as':_0xf9d5('0x65'),'foreignKey':'ChatOfflineMessageId'});db[_0xf9d5('0x41')]['belongsTo'](db['User'],{'onDelete':_0xf9d5('0x151')});db['MailApplication'][_0xf9d5('0x116')](db[_0xf9d5('0x3c')],{'onDelete':'restrict'});db[_0xf9d5('0x41')]['belongsTo'](db[_0xf9d5('0x12f')],{'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x41')][_0xf9d5('0x116')](db['Interval'],{'onDelete':_0xf9d5('0x151'),'foreignKey':_0xf9d5('0x143')});db[_0xf9d5('0x41')][_0xf9d5('0x116')](db[_0xf9d5('0x82')],{'onDelete':_0xf9d5('0x151'),'foreignKey':'TagId'});db[_0xf9d5('0x165')][_0xf9d5('0x116')](db[_0xf9d5('0x12f')],{});db[_0xf9d5('0x165')]['belongsTo'](db['CmList'],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166')});db[_0xf9d5('0x165')]['belongsTo'](db['CmContact'],{'as':_0xf9d5('0x14d'),'foreignKey':'ContactId'});db[_0xf9d5('0x165')][_0xf9d5('0x116')](db['MailInteraction'],{});db[_0xf9d5('0x165')]['belongsTo'](db[_0xf9d5('0x156')],{});db[_0xf9d5('0x165')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{});db[_0xf9d5('0x165')]['belongsTo'](db[_0xf9d5('0x3c')],{});db[_0xf9d5('0x167')][_0xf9d5('0x10d')](db[_0xf9d5('0x168')],{'as':'Items','onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x46')][_0xf9d5('0x10d')](db[_0xf9d5('0x7a')],{'as':'Dispositions','foreignKey':_0xf9d5('0x169'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x46')][_0xf9d5('0x10d')](db['CannedAnswer'],{'as':_0xf9d5('0x155'),'foreignKey':'FaxAccountId'});db[_0xf9d5('0x46')]['hasMany'](db['FaxInteraction'],{'as':_0xf9d5('0x157')});db[_0xf9d5('0x46')][_0xf9d5('0x10d')](db[_0xf9d5('0x47')],{'as':_0xf9d5('0x138')});db[_0xf9d5('0x46')][_0xf9d5('0x10d')](db[_0xf9d5('0x17')],{'as':_0xf9d5('0x16a'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db['FaxMessage'],{'as':_0xf9d5('0x147')});db[_0xf9d5('0x46')][_0xf9d5('0x116')](db[_0xf9d5('0x28')],{'as':_0xf9d5('0x28')});db[_0xf9d5('0x46')][_0xf9d5('0x116')](db[_0xf9d5('0xed')],{'as':'List','foreignKey':_0xf9d5('0x166')});db['FaxAccount'][_0xf9d5('0x116')](db['Pause'],{'as':_0xf9d5('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf9d5('0x46')]['belongsToMany'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x47')][_0xf9d5('0x116')](db[_0xf9d5('0x4c')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication'][_0xf9d5('0x116')](db[_0xf9d5('0x82')],{'onDelete':_0xf9d5('0x151'),'foreignKey':_0xf9d5('0x16b')});db[_0xf9d5('0x49')]['hasMany'](db[_0xf9d5('0x4b')],{'as':'Messages','onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x16c')});db['FaxInteraction'][_0xf9d5('0x116')](db[_0xf9d5('0x46')],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x169')});db[_0xf9d5('0x49')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db['FaxInteraction'][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x16d'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x49')][_0xf9d5('0x118')](db['Tag'],{'through':_0xf9d5('0x16e'),'as':_0xf9d5('0x15e')});db['FaxInteraction'][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xf9d5('0x49')][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x161'),'through':_0xf9d5('0x122'),'foreignKey':_0xf9d5('0x16c')});db['FaxMessage'][_0xf9d5('0x116')](db['User'],{'onDelete':_0xf9d5('0x10b'),'as':'User'});db['FaxMessage'][_0xf9d5('0x116')](db['FaxInteraction'],{'as':_0xf9d5('0x16f'),'foreignKey':_0xf9d5('0x16c')});db['FaxMessage'][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'onDelete':_0xf9d5('0x10b'),'as':'Contact'});db['FaxMessage'][_0xf9d5('0x116')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xf9d5('0x4b')][_0xf9d5('0x116')](db['FaxAccount'],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x169')});db[_0xf9d5('0x4c')]['belongsToMany'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x2f')});db[_0xf9d5('0x4c')]['belongsToMany'](db[_0xf9d5('0xdd')],{'through':_0xf9d5('0x170'),'as':_0xf9d5('0x15b')});db[_0xf9d5('0x4e')][_0xf9d5('0x116')](db['FaxAccount'],{});db[_0xf9d5('0x4e')][_0xf9d5('0x116')](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166')});db['FaxQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x4e')][_0xf9d5('0x116')](db[_0xf9d5('0x49')],{});db[_0xf9d5('0x4e')][_0xf9d5('0x116')](db[_0xf9d5('0x4b')],{});db['FaxQueueReport'][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db['SmsAccount'][_0xf9d5('0x10d')](db['Disposition'],{'as':_0xf9d5('0x153'),'foreignKey':_0xf9d5('0x171'),'onDelete':_0xf9d5('0x10b')});db['SmsAccount'][_0xf9d5('0x10d')](db[_0xf9d5('0x154')],{'as':_0xf9d5('0x155'),'foreignKey':_0xf9d5('0x171')});db[_0xf9d5('0x50')][_0xf9d5('0x10d')](db[_0xf9d5('0x56')],{'as':_0xf9d5('0x147'),'foreignKey':'SmsAccountId'});db[_0xf9d5('0x50')][_0xf9d5('0x10d')](db[_0xf9d5('0x54')],{'as':'Interactions'});db[_0xf9d5('0x50')][_0xf9d5('0x10d')](db[_0xf9d5('0x52')],{'as':'Applications'});db[_0xf9d5('0x50')][_0xf9d5('0x116')](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166')});db['SmsAccount'][_0xf9d5('0x116')](db[_0xf9d5('0x7d')],{'as':_0xf9d5('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf9d5('0x50')][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':'Agents','through':_0xf9d5('0x134')});db[_0xf9d5('0x52')][_0xf9d5('0x116')](db['User'],{'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x52')][_0xf9d5('0x116')](db[_0xf9d5('0x57')],{'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x52')][_0xf9d5('0x116')](db[_0xf9d5('0x50')],{'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x52')][_0xf9d5('0x116')](db[_0xf9d5('0x7b')],{'onDelete':'restrict','foreignKey':_0xf9d5('0x143')});db['SmsApplication'][_0xf9d5('0x116')](db[_0xf9d5('0x82')],{'onDelete':_0xf9d5('0x151'),'foreignKey':_0xf9d5('0x16b')});db[_0xf9d5('0x54')]['hasMany'](db['SmsMessage'],{'as':_0xf9d5('0x147'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x172')});db[_0xf9d5('0x54')][_0xf9d5('0x116')](db[_0xf9d5('0x50')],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x171')});db[_0xf9d5('0x54')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db['SmsInteraction']['belongsTo'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x16d'),'foreignKey':_0xf9d5('0x10c')});db['SmsInteraction'][_0xf9d5('0x118')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xf9d5('0x15e')});db[_0xf9d5('0x54')]['belongsToMany'](db[_0xf9d5('0x82')],{'through':'sms_interaction_has_tags','as':_0xf9d5('0x160')});db['SmsInteraction']['belongsToMany'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x161'),'through':_0xf9d5('0x173'),'foreignKey':_0xf9d5('0x172')});db[_0xf9d5('0x56')]['belongsTo'](db[_0xf9d5('0x11')],{'as':'User'});db[_0xf9d5('0x56')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'onDelete':_0xf9d5('0x10b'),'as':_0xf9d5('0x14d')});db[_0xf9d5('0x56')]['belongsTo'](db[_0xf9d5('0x54')],{'onDelete':_0xf9d5('0x10b'),'as':_0xf9d5('0x16f'),'foreignKey':'SmsInteractionId'});db[_0xf9d5('0x56')][_0xf9d5('0x116')](db[_0xf9d5('0x50')],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x171')});db[_0xf9d5('0x57')][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x31'),'foreignKey':_0xf9d5('0x174')});db[_0xf9d5('0x57')][_0xf9d5('0x118')](db[_0xf9d5('0xdd')],{'through':_0xf9d5('0x175'),'as':'Teams'});db['OpenchannelAccount'][_0xf9d5('0x10d')](db[_0xf9d5('0x7a')],{'as':_0xf9d5('0x153'),'foreignKey':'OpenchannelAccountId','onDelete':_0xf9d5('0x10b')});db['OpenchannelAccount'][_0xf9d5('0x10d')](db['CannedAnswer'],{'as':_0xf9d5('0x155'),'foreignKey':_0xf9d5('0x176')});db['OpenchannelAccount'][_0xf9d5('0x10d')](db['OpenchannelInteraction'],{'as':_0xf9d5('0x157'),'foreignKey':_0xf9d5('0x176')});db['OpenchannelAccount'][_0xf9d5('0x10d')](db[_0xf9d5('0x177')],{'as':_0xf9d5('0x147'),'foreignKey':_0xf9d5('0x176')});db['OpenchannelAccount'][_0xf9d5('0x10d')](db[_0xf9d5('0x5a')],{'as':_0xf9d5('0x138'),'foreignKey':'OpenchannelAccountId'});db[_0xf9d5('0x58')][_0xf9d5('0x116')](db['CmList'],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166')});db[_0xf9d5('0x58')][_0xf9d5('0x116')](db[_0xf9d5('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf9d5('0x144')});db[_0xf9d5('0x58')][_0xf9d5('0x118')](db['User'],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x132')});db[_0xf9d5('0x5a')][_0xf9d5('0x116')](db['User'],{'onDelete':_0xf9d5('0x151')});db['OpenchannelApplication'][_0xf9d5('0x116')](db[_0xf9d5('0x5d')],{'onDelete':_0xf9d5('0x151'),'foreignKey':'OpenchannelQueueId'});db[_0xf9d5('0x5a')][_0xf9d5('0x116')](db[_0xf9d5('0x58')],{'onDelete':_0xf9d5('0x151'),'foreignKey':_0xf9d5('0x176')});db[_0xf9d5('0x5a')][_0xf9d5('0x116')](db[_0xf9d5('0x7b')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0xf9d5('0x116')](db[_0xf9d5('0x82')],{'onDelete':'restrict','foreignKey':'TagId'});db['OpenchannelInteraction'][_0xf9d5('0x10d')](db[_0xf9d5('0x177')],{'as':'Messages','onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x178')});db[_0xf9d5('0x123')][_0xf9d5('0x116')](db[_0xf9d5('0x58')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xf9d5('0x123')]['belongsTo'](db['CmContact'],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x123')]['belongsTo'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x16d'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x123')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x179'),'as':_0xf9d5('0x15e')});db[_0xf9d5('0x123')]['belongsToMany'](db[_0xf9d5('0x82')],{'through':'openchannel_interaction_has_tags','as':_0xf9d5('0x160')});db[_0xf9d5('0x123')]['belongsToMany'](db[_0xf9d5('0x11')],{'as':'Users','through':_0xf9d5('0x124'),'foreignKey':'OpenchannelInteractionId'});db[_0xf9d5('0x177')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'onDelete':_0xf9d5('0x10b'),'as':'User'});db[_0xf9d5('0x177')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'onDelete':_0xf9d5('0x10b'),'as':'Contact'});db['OpenchannelMessage'][_0xf9d5('0x116')](db[_0xf9d5('0x123')],{'onDelete':_0xf9d5('0x10b'),'as':_0xf9d5('0x16f'),'foreignKey':_0xf9d5('0x178')});db[_0xf9d5('0x177')][_0xf9d5('0x116')](db[_0xf9d5('0x162')],{'as':'Attachment','foreignKey':_0xf9d5('0x17a')});db[_0xf9d5('0x177')][_0xf9d5('0x116')](db[_0xf9d5('0x58')],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x176')});db['OpenchannelQueue'][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x33'),'foreignKey':_0xf9d5('0x17b')});db[_0xf9d5('0x5d')]['belongsToMany'](db['Team'],{'through':_0xf9d5('0x17c'),'as':_0xf9d5('0x15b')});db[_0xf9d5('0x164')][_0xf9d5('0x10d')](db[_0xf9d5('0x7a')],{'as':_0xf9d5('0x153'),'foreignKey':_0xf9d5('0x17d'),'onDelete':'cascade'});db[_0xf9d5('0x164')][_0xf9d5('0x10d')](db[_0xf9d5('0x154')],{'as':'Answers','foreignKey':_0xf9d5('0x17d')});db[_0xf9d5('0x164')][_0xf9d5('0x10d')](db['ChatProactiveAction'],{'as':_0xf9d5('0x17e')});db[_0xf9d5('0x164')]['hasMany'](db[_0xf9d5('0x61')],{'as':'Interactions'});db[_0xf9d5('0x164')]['hasMany'](db[_0xf9d5('0x60')],{'as':_0xf9d5('0x138')});db[_0xf9d5('0x164')][_0xf9d5('0x10d')](db[_0xf9d5('0x63')],{'as':_0xf9d5('0x147')});db[_0xf9d5('0x164')][_0xf9d5('0x116')](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166')});db['ChatWebsite'][_0xf9d5('0x116')](db[_0xf9d5('0x7b')],{'as':_0xf9d5('0x7b'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0xf9d5('0x12f')],{'as':_0xf9d5('0x12f'),'foreignKey':'MailAccountId'});db[_0xf9d5('0x164')][_0xf9d5('0x116')](db[_0xf9d5('0x7d')],{'as':_0xf9d5('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf9d5('0x164')]['belongsToMany'](db['User'],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x12c')});db[_0xf9d5('0x17f')]['belongsTo'](db[_0xf9d5('0x58')],{});db[_0xf9d5('0x17f')]['belongsTo'](db[_0xf9d5('0xed')],{'as':'List','foreignKey':'ListId'});db[_0xf9d5('0x17f')]['belongsTo'](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db['OpenchannelQueueReport'][_0xf9d5('0x116')](db[_0xf9d5('0x123')],{});db[_0xf9d5('0x17f')]['belongsTo'](db[_0xf9d5('0x177')],{});db[_0xf9d5('0x17f')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{});db[_0xf9d5('0x17f')]['belongsTo'](db[_0xf9d5('0x5d')],{});db[_0xf9d5('0x60')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x180'),'foreignKey':_0xf9d5('0x10c'),'onDelete':_0xf9d5('0x151')});db['ChatApplication'][_0xf9d5('0x116')](db[_0xf9d5('0x181')],{'as':_0xf9d5('0x182'),'foreignKey':'ChatQueueId','onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x60')]['belongsTo'](db['ChatWebsite'],{'as':_0xf9d5('0x183'),'foreignKey':_0xf9d5('0x17d'),'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x60')][_0xf9d5('0x116')](db['Tag'],{'onDelete':_0xf9d5('0x151'),'foreignKey':'TagId'});db[_0xf9d5('0x61')][_0xf9d5('0x10d')](db[_0xf9d5('0x63')],{'as':_0xf9d5('0x147'),'onDelete':_0xf9d5('0x10b'),'foreignKey':'ChatInteractionId'});db[_0xf9d5('0x61')][_0xf9d5('0x116')](db[_0xf9d5('0x164')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xf9d5('0x61')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x61')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x16d'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0x61')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x184'),'as':_0xf9d5('0x15e')});db[_0xf9d5('0x61')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x184'),'as':_0xf9d5('0x160')});db[_0xf9d5('0x61')][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x161'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'onDelete':_0xf9d5('0x10b'),'as':_0xf9d5('0x11')});db[_0xf9d5('0x63')][_0xf9d5('0x116')](db['CmContact'],{'onDelete':_0xf9d5('0x10b'),'as':_0xf9d5('0x14d'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0xf9d5('0x61')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xf9d5('0x185')});db[_0xf9d5('0x63')]['belongsTo'](db[_0xf9d5('0x162')],{'as':_0xf9d5('0x162'),'foreignKey':_0xf9d5('0x17a')});db[_0xf9d5('0x63')]['belongsTo'](db[_0xf9d5('0x164')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0xf9d5('0x163'),'foreignKey':_0xf9d5('0x186'),'onDelete':_0xf9d5('0x10b'),'hooks':!![]});db[_0xf9d5('0x65')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'onDelete':_0xf9d5('0x10b'),'as':'Contact','foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x65')][_0xf9d5('0x116')](db[_0xf9d5('0x164')],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x17d')});db[_0xf9d5('0x181')]['belongsToMany'](db[_0xf9d5('0x11')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xf9d5('0x181')][_0xf9d5('0x118')](db[_0xf9d5('0xdd')],{'through':'team_has_chat_queues','as':_0xf9d5('0x15b')});db[_0xf9d5('0x67')][_0xf9d5('0x10d')](db[_0xf9d5('0x187')],{'as':_0xf9d5('0x147'),'foreignKey':'ChatGroupId','onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x67')]['belongsToMany'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x13a'),'through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0xf9d5('0x164')],{'as':_0xf9d5('0x183'),'foreignKey':_0xf9d5('0x17d')});db[_0xf9d5('0x6b')][_0xf9d5('0x10d')](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x11b'),'foreignKey':_0xf9d5('0x188')});db['CmContact'][_0xf9d5('0x10d')](db[_0xf9d5('0x86')],{'as':_0xf9d5('0x189'),'foreignKey':_0xf9d5('0x18a')});db[_0xf9d5('0x6d')][_0xf9d5('0x10d')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0xf9d5('0x10d')](db[_0xf9d5('0x72')],{'as':'HopperFinals','foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x6d')]['hasMany'](db[_0xf9d5('0x74')],{'as':_0xf9d5('0x13e'),'foreignKey':'ContactId'});db[_0xf9d5('0x6d')][_0xf9d5('0x10d')](db['ReportAgentPreview'],{'as':_0xf9d5('0x76'),'foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x6d')][_0xf9d5('0x10d')](db['JscriptySessionReport'],{'as':_0xf9d5('0x140'),'foreignKey':_0xf9d5('0x14e')});db['CmContact'][_0xf9d5('0x10d')](db[_0xf9d5('0x123')],{'as':_0xf9d5('0x110'),'foreignKey':_0xf9d5('0x14e'),'onDelete':'restrict'});db['CmContact'][_0xf9d5('0x10d')](db[_0xf9d5('0x61')],{'as':_0xf9d5('0x111'),'foreignKey':_0xf9d5('0x14e'),'onDelete':_0xf9d5('0x151')});db['CmContact'][_0xf9d5('0x10d')](db[_0xf9d5('0x54')],{'as':_0xf9d5('0x112'),'foreignKey':_0xf9d5('0x14e'),'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x6d')][_0xf9d5('0x10d')](db['FaxInteraction'],{'as':_0xf9d5('0x113'),'foreignKey':_0xf9d5('0x14e'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0xf9d5('0x114')],{'as':_0xf9d5('0x11f'),'foreignKey':_0xf9d5('0x14e'),'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x6d')]['belongsTo'](db[_0xf9d5('0x6b')],{'as':_0xf9d5('0x18b'),'foreignKey':_0xf9d5('0x188')});db[_0xf9d5('0x6d')][_0xf9d5('0x116')](db[_0xf9d5('0xed')],{'as':'List','foreignKey':_0xf9d5('0x166'),'onDelete':_0xf9d5('0x10b')});db['CmContact'][_0xf9d5('0x118')](db['User'],{'as':'Users','through':'cm_user_has_contacts'});db[_0xf9d5('0x6d')][_0xf9d5('0x118')](db['Tag'],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xf9d5('0x6d')]['belongsToMany'](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x18c'),'as':_0xf9d5('0x160')});db[_0xf9d5('0x6f')][_0xf9d5('0x10d')](db[_0xf9d5('0x88')],{'as':_0xf9d5('0x18d'),'foreignKey':_0xf9d5('0x18e')});db[_0xf9d5('0x6f')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x6f')]['belongsTo'](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x6f')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x180'),'foreignKey':'UserId'});db[_0xf9d5('0x6f')]['belongsTo'](db[_0xf9d5('0x1b')],{'as':_0xf9d5('0x182'),'foreignKey':_0xf9d5('0x13b'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x6f')][_0xf9d5('0x116')](db['Campaign'],{'as':_0xf9d5('0x18f'),'foreignKey':_0xf9d5('0x190'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x6f')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x16d'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':'Contact','foreignKey':_0xf9d5('0x14e'),'onDelete':'cascade'});db['CmHopperBlack'][_0xf9d5('0x116')](db[_0xf9d5('0xed')],{'as':'List','foreignKey':_0xf9d5('0x166'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x70')]['belongsTo'](db[_0xf9d5('0x1b')],{'as':_0xf9d5('0x182'),'foreignKey':_0xf9d5('0x13b'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x70')]['belongsTo'](db['Campaign'],{'as':_0xf9d5('0x18f'),'foreignKey':'CampaignId','onDelete':_0xf9d5('0x10b')});db['Automation']['hasMany'](db[_0xf9d5('0x191')],{'as':{'plural':_0xf9d5('0x192'),'singular':_0xf9d5('0x193')},'foreignKey':_0xf9d5('0x194'),'onDelete':'cascade','hooks':!![]});db[_0xf9d5('0x79')][_0xf9d5('0x10d')](db[_0xf9d5('0x191')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xf9d5('0x10b'),'hooks':!![]});db[_0xf9d5('0x79')]['hasMany'](db[_0xf9d5('0x195')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xf9d5('0x10b'),'hooks':!![]});db[_0xf9d5('0x7a')][_0xf9d5('0x10d')](db[_0xf9d5('0x7a')],{'as':_0xf9d5('0x153'),'foreignKey':_0xf9d5('0x196'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x7b')]['hasMany'](db[_0xf9d5('0x7b')],{'as':_0xf9d5('0x197'),'foreignKey':_0xf9d5('0x143'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xf9d5('0x7b')][_0xf9d5('0x10d')](db[_0xf9d5('0x17')],{'as':_0xf9d5('0x198'),'foreignKey':_0xf9d5('0x143'),'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x7b')]['hasMany'](db[_0xf9d5('0x41')],{'as':_0xf9d5('0x199'),'foreignKey':_0xf9d5('0x143')});db['Interval'][_0xf9d5('0x10d')](db['ChatApplication'],{'as':_0xf9d5('0x19a'),'foreignKey':_0xf9d5('0x143')});db[_0xf9d5('0x7b')][_0xf9d5('0x10d')](db['FaxApplication'],{'as':_0xf9d5('0x19b'),'foreignKey':_0xf9d5('0x143')});db[_0xf9d5('0x7b')][_0xf9d5('0x10d')](db[_0xf9d5('0x52')],{'as':'SmsApplications','foreignKey':_0xf9d5('0x143')});db[_0xf9d5('0x19c')]['belongsTo'](db[_0xf9d5('0x12f')],{});db[_0xf9d5('0x19c')][_0xf9d5('0x116')](db[_0xf9d5('0x95')],{'foreignKey':_0xf9d5('0x19d')});db[_0xf9d5('0x19c')][_0xf9d5('0x116')](db['AnalyticCustomReport'],{'foreignKey':_0xf9d5('0x19e')});db[_0xf9d5('0x19f')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xf9d5('0x1a0'),'through':_0xf9d5('0x139'),'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x82')][_0xf9d5('0x118')](db[_0xf9d5('0x6d')],{'through':_0xf9d5('0x18c')});db[_0xf9d5('0x82')][_0xf9d5('0x118')](db[_0xf9d5('0x61')],{'through':_0xf9d5('0x184')});db[_0xf9d5('0x82')][_0xf9d5('0x118')](db[_0xf9d5('0x114')],{'through':_0xf9d5('0x15f')});db[_0xf9d5('0x82')][_0xf9d5('0x118')](db[_0xf9d5('0x54')],{'through':_0xf9d5('0x1a1')});db['Tag']['belongsToMany'](db[_0xf9d5('0x49')],{'through':_0xf9d5('0x16e')});db[_0xf9d5('0x82')]['belongsToMany'](db[_0xf9d5('0x123')],{'through':_0xf9d5('0x179')});db[_0xf9d5('0x82')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xf9d5('0x1a2')});db[_0xf9d5('0x86')][_0xf9d5('0x116')](db[_0xf9d5('0x84')],{'as':_0xf9d5('0x1a3'),'foreignKey':_0xf9d5('0x1a4')});db['CmHopperAdditionalPhone'][_0xf9d5('0x116')](db[_0xf9d5('0x6f')],{'as':_0xf9d5('0x1a5'),'foreignKey':_0xf9d5('0x18e')});db[_0xf9d5('0x86')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':'Contact','foreignKey':'CmContactId'});db[_0xf9d5('0x8c')][_0xf9d5('0x10d')](db[_0xf9d5('0x191')],{'as':{'plural':_0xf9d5('0x1a6'),'singular':_0xf9d5('0x1a7')},'foreignKey':_0xf9d5('0x1a8'),'onDelete':_0xf9d5('0x10b'),'hooks':!![]});db['Trigger'][_0xf9d5('0x10d')](db[_0xf9d5('0x191')],{'as':{'plural':_0xf9d5('0x1a9'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0xf9d5('0x10b'),'hooks':!![]});db[_0xf9d5('0x8c')][_0xf9d5('0x10d')](db[_0xf9d5('0x195')],{'as':_0xf9d5('0x1aa'),'foreignKey':_0xf9d5('0x1ab'),'onDelete':_0xf9d5('0x10b'),'hooks':!![]});db[_0xf9d5('0x93')][_0xf9d5('0x10d')](db[_0xf9d5('0x9a')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xf9d5('0x95')][_0xf9d5('0x10d')](db[_0xf9d5('0x9a')],{'as':_0xf9d5('0x1ac'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xf9d5('0x10d')](db[_0xf9d5('0x9a')],{'as':_0xf9d5('0x1ac'),'onDelete':_0xf9d5('0x10b'),'foreignKey':'MetricId'});db[_0xf9d5('0x9a')][_0xf9d5('0x116')](db[_0xf9d5('0x98')],{'foreignKey':_0xf9d5('0x1ad')});db[_0xf9d5('0x9d')][_0xf9d5('0x10d')](db[_0xf9d5('0x9f')],{'as':_0xf9d5('0x1ae'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0x9f')][_0xf9d5('0x10d')](db[_0xf9d5('0xa1')],{'as':'Subjects','onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0x9f')][_0xf9d5('0x10d')](db['SalesforceField'],{'as':_0xf9d5('0x1b1'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b2')});db['SalesforceConfiguration']['hasMany'](db[_0xf9d5('0xa1')],{'as':_0xf9d5('0x1ac'),'onDelete':'cascade','foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xf9d5('0x116')](db[_0xf9d5('0x9d')],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xa1')][_0xf9d5('0x10d')](db[_0xf9d5('0xa1')],{'as':_0xf9d5('0x1b3'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xa1')][_0xf9d5('0x10d')](db[_0xf9d5('0xa1')],{'as':'Description','foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xa1')][_0xf9d5('0x10d')](db['SalesforceField'],{'as':_0xf9d5('0x1b4'),'foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xa1')]['belongsTo'](db['Variable'],{'as':_0xf9d5('0x8e'),'foreignKey':'VariableId'});db[_0xf9d5('0xa3')]['hasMany'](db[_0xf9d5('0xa5')],{'as':_0xf9d5('0x1ae'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1af')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xf9d5('0x1b1'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xa5')][_0xf9d5('0x10d')](db['SugarcrmField'],{'as':_0xf9d5('0x1ac'),'onDelete':_0xf9d5('0x10b'),'foreignKey':'FieldId'});db[_0xf9d5('0xa5')][_0xf9d5('0x116')](db['SugarcrmAccount'],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xa7')][_0xf9d5('0x10d')](db[_0xf9d5('0xa7')],{'as':_0xf9d5('0x1b3'),'foreignKey':_0xf9d5('0x1b0')});db['SugarcrmField'][_0xf9d5('0x10d')](db[_0xf9d5('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0xf9d5('0x10d')](db[_0xf9d5('0xa7')],{'as':_0xf9d5('0x1b4'),'foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xa7')][_0xf9d5('0x116')](db['Variable'],{'as':_0xf9d5('0x8e'),'foreignKey':_0xf9d5('0x1b6')});db[_0xf9d5('0xa8')]['hasMany'](db[_0xf9d5('0x1b7')],{'as':_0xf9d5('0x1ae'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0x1b7')][_0xf9d5('0x10d')](db[_0xf9d5('0xab')],{'as':_0xf9d5('0x1b8'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0x1b7')][_0xf9d5('0x10d')](db[_0xf9d5('0xab')],{'as':_0xf9d5('0x1b1'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0x1b7')][_0xf9d5('0x10d')](db[_0xf9d5('0xab')],{'as':'Fields','onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0x1b7')][_0xf9d5('0x116')](db[_0xf9d5('0xa8')],{'as':_0xf9d5('0x15d'),'foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x1b9')});db['DeskField'][_0xf9d5('0x10d')](db[_0xf9d5('0xab')],{'as':_0xf9d5('0x1b3'),'foreignKey':'SubjectId'});db[_0xf9d5('0xab')]['hasMany'](db[_0xf9d5('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf9d5('0xab')][_0xf9d5('0x10d')](db[_0xf9d5('0xab')],{'as':_0xf9d5('0x1b4'),'foreignKey':'FieldId'});db[_0xf9d5('0xab')]['belongsTo'](db[_0xf9d5('0x8e')],{'as':_0xf9d5('0x8e'),'foreignKey':'VariableId'});db[_0xf9d5('0xad')][_0xf9d5('0x10d')](db['ZohoConfiguration'],{'as':_0xf9d5('0x1ae'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xaf')][_0xf9d5('0x10d')](db[_0xf9d5('0x1ba')],{'as':_0xf9d5('0x1b8'),'onDelete':_0xf9d5('0x10b'),'foreignKey':'SubjectId'});db[_0xf9d5('0xaf')]['hasMany'](db[_0xf9d5('0x1ba')],{'as':_0xf9d5('0x1b1'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xaf')][_0xf9d5('0x10d')](db[_0xf9d5('0x1ba')],{'as':_0xf9d5('0x1ac'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xaf')]['belongsTo'](db['ZohoAccount'],{'as':'Account','foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0x1ba')][_0xf9d5('0x10d')](db[_0xf9d5('0x1ba')],{'as':'Subject','foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0x1ba')][_0xf9d5('0x10d')](db[_0xf9d5('0x1ba')],{'as':_0xf9d5('0x1bb'),'foreignKey':'DescriptionId'});db[_0xf9d5('0x1ba')][_0xf9d5('0x10d')](db['ZohoField'],{'as':'Field','foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0x1ba')][_0xf9d5('0x116')](db[_0xf9d5('0x8e')],{'as':'Variable','foreignKey':'VariableId'});db[_0xf9d5('0x1bc')][_0xf9d5('0x10d')](db[_0xf9d5('0x1bd')],{'as':_0xf9d5('0x1ae'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0x1bd')][_0xf9d5('0x10d')](db[_0xf9d5('0x1be')],{'as':_0xf9d5('0x1b8'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0x1bd')][_0xf9d5('0x10d')](db[_0xf9d5('0x1be')],{'as':_0xf9d5('0x1b1'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xf9d5('0x10d')](db[_0xf9d5('0x1be')],{'as':_0xf9d5('0x1ac'),'foreignKey':'FieldId'});db[_0xf9d5('0x1bd')][_0xf9d5('0x116')](db[_0xf9d5('0x1bc')],{'as':'Account','foreignKey':_0xf9d5('0x1af')});db['ZendeskConfiguration'][_0xf9d5('0x118')](db['Tag'],{'through':_0xf9d5('0x1bf')});db[_0xf9d5('0x1be')][_0xf9d5('0x10d')](db[_0xf9d5('0x1be')],{'as':_0xf9d5('0x1b3'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0x1be')][_0xf9d5('0x10d')](db[_0xf9d5('0x1be')],{'as':_0xf9d5('0x1bb'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0x1be')][_0xf9d5('0x10d')](db[_0xf9d5('0x1be')],{'as':_0xf9d5('0x1b4'),'foreignKey':'FieldId'});db[_0xf9d5('0x1be')]['belongsTo'](db[_0xf9d5('0x8e')],{'as':_0xf9d5('0x8e'),'foreignKey':_0xf9d5('0x1b6')});db[_0xf9d5('0xb3')][_0xf9d5('0x10d')](db[_0xf9d5('0xb5')],{'as':_0xf9d5('0x1ae'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xb5')][_0xf9d5('0x10d')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xb5')][_0xf9d5('0x10d')](db[_0xf9d5('0xb7')],{'as':_0xf9d5('0x1b1'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xb5')]['hasMany'](db[_0xf9d5('0xb7')],{'as':_0xf9d5('0x1ac'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xb5')][_0xf9d5('0x116')](db[_0xf9d5('0xb3')],{'as':'Account','foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xb5')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xf9d5('0xb7')]['hasMany'](db[_0xf9d5('0xb7')],{'as':'Subject','foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xb7')][_0xf9d5('0x10d')](db[_0xf9d5('0xb7')],{'as':_0xf9d5('0x1bb'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xb7')][_0xf9d5('0x10d')](db['FreshdeskField'],{'as':_0xf9d5('0x1b4'),'foreignKey':_0xf9d5('0x1b5')});db['FreshdeskField'][_0xf9d5('0x116')](db['Variable'],{'as':_0xf9d5('0x8e'),'foreignKey':'VariableId'});db[_0xf9d5('0xb8')]['hasMany'](db[_0xf9d5('0xba')],{'as':_0xf9d5('0x1ae'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xba')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c0')],{'as':'Subjects','foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xba')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c0')],{'as':_0xf9d5('0x1b1'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xba')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c0')],{'as':_0xf9d5('0x1ac'),'foreignKey':'FieldId'});db[_0xf9d5('0xba')][_0xf9d5('0x116')](db[_0xf9d5('0xb8')],{'as':'Account','foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0x1c0')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xf9d5('0x1c0')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c0')],{'as':_0xf9d5('0x1bb'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0x1c0')]['hasMany'](db[_0xf9d5('0x1c0')],{'as':_0xf9d5('0x1b4'),'foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0x1c0')]['belongsTo'](db[_0xf9d5('0x8e')],{'as':_0xf9d5('0x8e'),'foreignKey':_0xf9d5('0x1b6')});db['ServicenowAccount']['hasMany'](db[_0xf9d5('0xbe')],{'as':_0xf9d5('0x1ae'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xbe')]['hasMany'](db[_0xf9d5('0xc0')],{'as':_0xf9d5('0x1b8'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xbe')]['hasMany'](db[_0xf9d5('0xc0')],{'as':_0xf9d5('0x1b1'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xbe')][_0xf9d5('0x10d')](db[_0xf9d5('0xc0')],{'as':'Fields','foreignKey':'FieldId'});db[_0xf9d5('0xbe')][_0xf9d5('0x116')](db[_0xf9d5('0x1c1')],{'as':'Account','foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xc0')]['hasMany'](db[_0xf9d5('0xc0')],{'as':_0xf9d5('0x1b3'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xc0')][_0xf9d5('0x10d')](db['ServicenowField'],{'as':_0xf9d5('0x1bb'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xc0')][_0xf9d5('0x10d')](db['ServicenowField'],{'as':_0xf9d5('0x1b4'),'foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xc0')]['belongsTo'](db[_0xf9d5('0x8e')],{'as':_0xf9d5('0x8e'),'foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db[_0xf9d5('0xc3')],{'as':_0xf9d5('0x1ae'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xf9d5('0x1c2')][_0xf9d5('0x116')](db[_0xf9d5('0x101')],{'as':_0xf9d5('0x101'),'foreignKey':_0xf9d5('0x150')});db[_0xf9d5('0xc3')][_0xf9d5('0x10d')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xf9d5('0x10b'),'foreignKey':'SubjectId'});db[_0xf9d5('0xc3')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c3')],{'as':_0xf9d5('0x1b1'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xc3')]['hasMany'](db[_0xf9d5('0x1c3')],{'as':_0xf9d5('0x1ac'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xc3')]['belongsTo'](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0x1c3')][_0xf9d5('0x10d')](db[_0xf9d5('0x1c3')],{'as':_0xf9d5('0x1b3'),'foreignKey':_0xf9d5('0x1b0')});db['Dynamics365Field'][_0xf9d5('0x10d')](db[_0xf9d5('0x1c3')],{'as':_0xf9d5('0x1bb'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0x1c3')]['hasMany'](db['Dynamics365Field'],{'as':_0xf9d5('0x1b4'),'foreignKey':_0xf9d5('0x1b5')});db['Dynamics365Field'][_0xf9d5('0x116')](db[_0xf9d5('0x8e')],{'as':'Variable','foreignKey':_0xf9d5('0x1b6')});db[_0xf9d5('0x1c4')][_0xf9d5('0x10d')](db[_0xf9d5('0xc6')],{'as':_0xf9d5('0x1ae'),'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xc6')][_0xf9d5('0x10d')](db[_0xf9d5('0xc7')],{'as':_0xf9d5('0x1b8'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xc6')][_0xf9d5('0x10d')](db[_0xf9d5('0xc7')],{'as':_0xf9d5('0x1b1'),'foreignKey':_0xf9d5('0x1b2')});db[_0xf9d5('0xc6')][_0xf9d5('0x10d')](db[_0xf9d5('0xc7')],{'as':'Fields','foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xc6')][_0xf9d5('0x116')](db['FreshsalesAccount'],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x1af')});db[_0xf9d5('0xc7')]['hasMany'](db['FreshsalesField'],{'as':_0xf9d5('0x1b3'),'foreignKey':_0xf9d5('0x1b0')});db[_0xf9d5('0xc7')][_0xf9d5('0x10d')](db[_0xf9d5('0xc7')],{'as':_0xf9d5('0x1bb'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xf9d5('0x10d')](db[_0xf9d5('0xc7')],{'as':_0xf9d5('0x1b4'),'foreignKey':_0xf9d5('0x1b5')});db[_0xf9d5('0xc7')][_0xf9d5('0x116')](db[_0xf9d5('0x8e')],{'as':_0xf9d5('0x8e'),'foreignKey':_0xf9d5('0x1b6')});db[_0xf9d5('0x1c5')]['belongsTo'](db[_0xf9d5('0x164')],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xf9d5('0x166')});db['ChatQueueReport']['belongsTo'](db[_0xf9d5('0x6d')],{'as':'Contact','foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0x1c5')]['belongsTo'](db['ChatInteraction'],{});db[_0xf9d5('0x1c5')][_0xf9d5('0x116')](db['ChatMessage'],{});db[_0xf9d5('0x1c5')]['belongsTo'](db[_0xf9d5('0x11')],{});db[_0xf9d5('0x1c5')]['belongsTo'](db['ChatQueue'],{});db[_0xf9d5('0x187')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'onDelete':_0xf9d5('0x10b'),'foreignKey':_0xf9d5('0x1c6')});db[_0xf9d5('0x187')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'onDelete':_0xf9d5('0x10b'),'foreignKey':'ToId'});db[_0xf9d5('0xce')]['hasMany'](db[_0xf9d5('0xcd')],{'foreignKey':_0xf9d5('0x1c7'),'onDelete':'cascade'});db[_0xf9d5('0xce')][_0xf9d5('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db['SmsQueueReport'][_0xf9d5('0x116')](db[_0xf9d5('0x50')],{});db[_0xf9d5('0xd0')]['belongsTo'](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166')});db[_0xf9d5('0xd0')][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0xd0')]['belongsTo'](db['SmsInteraction'],{});db[_0xf9d5('0xd0')]['belongsTo'](db[_0xf9d5('0x56')],{});db[_0xf9d5('0xd0')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{});db[_0xf9d5('0xd0')]['belongsTo'](db[_0xf9d5('0x57')],{});db[_0xf9d5('0xd4')][_0xf9d5('0x10d')](db[_0xf9d5('0xce')],{'foreignKey':_0xf9d5('0x1c8')});db[_0xf9d5('0xd4')][_0xf9d5('0x10d')](db[_0xf9d5('0xcd')],{'foreignKey':'ProjectId'});db[_0xf9d5('0xd4')]['hasMany'](db[_0xf9d5('0x1c9')],{'foreignKey':_0xf9d5('0x1c8')});db[_0xf9d5('0xdd')][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':'user_has_teams'});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0xf9d5('0x1ca'),'as':_0xf9d5('0x1cb')});db[_0xf9d5('0xdd')]['belongsToMany'](db[_0xf9d5('0x3c')],{'through':_0xf9d5('0x15a'),'as':_0xf9d5('0x1cc')});db[_0xf9d5('0xdd')][_0xf9d5('0x118')](db[_0xf9d5('0x181')],{'through':_0xf9d5('0x1cd'),'as':_0xf9d5('0x126')});db[_0xf9d5('0xdd')]['belongsToMany'](db[_0xf9d5('0x4c')],{'through':_0xf9d5('0x170'),'as':_0xf9d5('0x128')});db[_0xf9d5('0xdd')][_0xf9d5('0x118')](db[_0xf9d5('0x57')],{'through':_0xf9d5('0x175'),'as':_0xf9d5('0x129')});db[_0xf9d5('0xdd')][_0xf9d5('0x118')](db[_0xf9d5('0x5d')],{'through':_0xf9d5('0x17c'),'as':_0xf9d5('0x1ce')});db[_0xf9d5('0xdd')][_0xf9d5('0x118')](db[_0xf9d5('0xff')],{'through':_0xf9d5('0x1cf'),'as':_0xf9d5('0x12a')});db[_0xf9d5('0xdd')][_0xf9d5('0x118')](db[_0xf9d5('0x125')],{'through':_0xf9d5('0x104'),'as':_0xf9d5('0x1d0')});db['Campaign'][_0xf9d5('0x10d')](db[_0xf9d5('0x6f')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xf9d5('0x18f')]['hasMany'](db[_0xf9d5('0x72')],{'as':_0xf9d5('0x13d'),'foreignKey':_0xf9d5('0x190')});db['Campaign'][_0xf9d5('0x10d')](db[_0xf9d5('0x74')],{'as':_0xf9d5('0x13e'),'foreignKey':_0xf9d5('0x190')});db['Campaign'][_0xf9d5('0x10d')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xf9d5('0x190')});db[_0xf9d5('0x18f')][_0xf9d5('0x116')](db[_0xf9d5('0x28')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xf9d5('0x18f')][_0xf9d5('0x116')](db[_0xf9d5('0x28')],{'as':_0xf9d5('0x141'),'foreignKey':_0xf9d5('0x142')});db[_0xf9d5('0x18f')][_0xf9d5('0x116')](db[_0xf9d5('0x7b')],{'as':_0xf9d5('0x7b'),'foreignKey':_0xf9d5('0x143')});db[_0xf9d5('0x18f')][_0xf9d5('0x116')](db[_0xf9d5('0xd9')],{'as':'SquareProject','foreignKey':_0xf9d5('0x1d1')});db[_0xf9d5('0x18f')]['belongsToMany'](db['CmList'],{'as':_0xf9d5('0x1d2'),'through':_0xf9d5('0x1d3')});db[_0xf9d5('0x18f')][_0xf9d5('0x118')](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x1d4'),'through':_0xf9d5('0x1d5')});db['Attachment'][_0xf9d5('0x116')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xf9d5('0x186')});db[_0xf9d5('0xe4')][_0xf9d5('0x116')](db['MailMessage'],{});db[_0xf9d5('0xe4')]['belongsTo'](db[_0xf9d5('0x114')],{});db[_0xf9d5('0xe4')][_0xf9d5('0x116')](db['MailAccount'],{'foreignKey':_0xf9d5('0x1d6'),'as':_0xf9d5('0x1d7')});db['MailTransferReport'][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'foreignKey':'FromUserId','as':_0xf9d5('0x1d8')});db[_0xf9d5('0xe4')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'foreignKey':_0xf9d5('0x1d9'),'as':_0xf9d5('0x1da')});db['MailTransferReport'][_0xf9d5('0x116')](db[_0xf9d5('0x3c')],{'foreignKey':_0xf9d5('0x1db'),'as':_0xf9d5('0x1dc')});db['MailTransferReport']['belongsTo'](db[_0xf9d5('0x12f')],{'foreignKey':_0xf9d5('0x1dd'),'as':_0xf9d5('0x1de')});db['ChatTransferReport']['belongsTo'](db['ChatMessage'],{});db[_0xf9d5('0xe6')][_0xf9d5('0x116')](db[_0xf9d5('0x61')],{});db[_0xf9d5('0xe6')][_0xf9d5('0x116')](db[_0xf9d5('0x164')],{'foreignKey':_0xf9d5('0x1df'),'as':'FromAccount'});db[_0xf9d5('0xe6')][_0xf9d5('0x116')](db['User'],{'foreignKey':_0xf9d5('0x1e0'),'as':_0xf9d5('0x1d8')});db['ChatTransferReport'][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'foreignKey':_0xf9d5('0x1d9'),'as':_0xf9d5('0x1da')});db['ChatTransferReport'][_0xf9d5('0x116')](db[_0xf9d5('0x181')],{'foreignKey':'ToChatQueueId','as':_0xf9d5('0x1dc')});db[_0xf9d5('0xe6')][_0xf9d5('0x116')](db[_0xf9d5('0x164')],{'foreignKey':_0xf9d5('0x1e1'),'as':_0xf9d5('0x1de')});db[_0xf9d5('0xe8')][_0xf9d5('0x116')](db[_0xf9d5('0x4b')],{});db[_0xf9d5('0xe8')][_0xf9d5('0x116')](db[_0xf9d5('0x49')],{});db['FaxTransferReport'][_0xf9d5('0x116')](db[_0xf9d5('0x46')],{'foreignKey':_0xf9d5('0x1e2'),'as':_0xf9d5('0x1d7')});db['FaxTransferReport'][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'foreignKey':_0xf9d5('0x1e0'),'as':_0xf9d5('0x1d8')});db['FaxTransferReport'][_0xf9d5('0x116')](db['User'],{'foreignKey':_0xf9d5('0x1d9'),'as':_0xf9d5('0x1da')});db[_0xf9d5('0xe8')][_0xf9d5('0x116')](db['FaxQueue'],{'foreignKey':_0xf9d5('0x1e3'),'as':_0xf9d5('0x1dc')});db[_0xf9d5('0xe8')]['belongsTo'](db[_0xf9d5('0x46')],{'foreignKey':_0xf9d5('0x1e4'),'as':_0xf9d5('0x1de')});db[_0xf9d5('0xe9')][_0xf9d5('0x116')](db[_0xf9d5('0x177')],{});db[_0xf9d5('0xe9')][_0xf9d5('0x116')](db[_0xf9d5('0x123')],{});db[_0xf9d5('0xe9')][_0xf9d5('0x116')](db[_0xf9d5('0x58')],{'foreignKey':'FromOpenchannelAccountId','as':_0xf9d5('0x1d7')});db[_0xf9d5('0xe9')]['belongsTo'](db['User'],{'foreignKey':_0xf9d5('0x1e0'),'as':_0xf9d5('0x1d8')});db[_0xf9d5('0xe9')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'foreignKey':_0xf9d5('0x1d9'),'as':'ToAgent'});db[_0xf9d5('0xe9')][_0xf9d5('0x116')](db[_0xf9d5('0x5d')],{'foreignKey':_0xf9d5('0x1e5'),'as':_0xf9d5('0x1dc')});db['OpenchannelTransferReport']['belongsTo'](db[_0xf9d5('0x58')],{'foreignKey':_0xf9d5('0x1e6'),'as':'ToAccount'});db[_0xf9d5('0xeb')]['belongsTo'](db[_0xf9d5('0x56')],{});db[_0xf9d5('0xeb')][_0xf9d5('0x116')](db[_0xf9d5('0x54')],{});db[_0xf9d5('0xeb')][_0xf9d5('0x116')](db[_0xf9d5('0x50')],{'foreignKey':_0xf9d5('0x1e7'),'as':_0xf9d5('0x1d7')});db[_0xf9d5('0xeb')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'foreignKey':_0xf9d5('0x1e0'),'as':_0xf9d5('0x1d8')});db[_0xf9d5('0xeb')]['belongsTo'](db[_0xf9d5('0x11')],{'foreignKey':_0xf9d5('0x1d9'),'as':'ToAgent'});db[_0xf9d5('0xeb')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xf9d5('0x1dc')});db[_0xf9d5('0xeb')][_0xf9d5('0x116')](db[_0xf9d5('0x50')],{'foreignKey':_0xf9d5('0x1e8'),'as':'ToAccount'});db[_0xf9d5('0xed')]['hasMany'](db['Disposition'],{'as':_0xf9d5('0x153'),'foreignKey':'ListId','onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0xed')]['hasMany'](db['CmCustomField'],{'as':_0xf9d5('0x1e9'),'foreignKey':_0xf9d5('0x166')});db['CmList']['hasMany'](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x11b'),'onDelete':_0xf9d5('0x10b'),'foreignKey':'ListId'});db['CmList'][_0xf9d5('0x10d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xf9d5('0x166')});db['CmList'][_0xf9d5('0x10d')](db['CmHopperHistory'],{'as':_0xf9d5('0x1ea'),'foreignKey':'ListId'});db[_0xf9d5('0xed')]['hasMany'](db[_0xf9d5('0x76')],{'as':'ReportAgentPreview','foreignKey':_0xf9d5('0x166')});db[_0xf9d5('0xed')][_0xf9d5('0x118')](db['VoiceQueue'],{'as':_0xf9d5('0x1eb'),'through':_0xf9d5('0x1ec')});db[_0xf9d5('0xed')][_0xf9d5('0x118')](db['User'],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x11d')});db[_0xf9d5('0x125')][_0xf9d5('0x10d')](db[_0xf9d5('0x17')],{'as':'Extensions','onDelete':'cascade'});db[_0xf9d5('0x125')][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':_0xf9d5('0x105')});db['VoicePrefix'][_0xf9d5('0x118')](db[_0xf9d5('0xdd')],{'through':_0xf9d5('0x104'),'as':_0xf9d5('0x15b')});db['UserProfile'][_0xf9d5('0x10d')](db[_0xf9d5('0x11')],{'as':'Users','foreignKey':_0xf9d5('0x117')});db[_0xf9d5('0xf0')]['hasMany'](db[_0xf9d5('0x1ed')],{'as':_0xf9d5('0x1ee'),'foreignKey':_0xf9d5('0x117'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0x1ed')][_0xf9d5('0x10d')](db[_0xf9d5('0xf3')],{'as':_0xf9d5('0x1ef'),'foreignKey':_0xf9d5('0x1f0'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0xf6')][_0xf9d5('0x10d')](db[_0xf9d5('0x7a')],{'as':_0xf9d5('0x153'),'foreignKey':_0xf9d5('0x1f1'),'onDelete':_0xf9d5('0x10b')});db[_0xf9d5('0xf6')][_0xf9d5('0x10d')](db[_0xf9d5('0x154')],{'as':'Answers','foreignKey':_0xf9d5('0x1f1')});db[_0xf9d5('0xf6')][_0xf9d5('0x10d')](db[_0xf9d5('0xfa')],{'as':_0xf9d5('0x147'),'foreignKey':'WhatsappAccountId'});db[_0xf9d5('0xf6')][_0xf9d5('0x10d')](db[_0xf9d5('0xf9')],{'as':_0xf9d5('0x157')});db[_0xf9d5('0xf6')]['hasMany'](db[_0xf9d5('0xf7')],{'as':'Applications'});db['WhatsappAccount']['belongsTo'](db[_0xf9d5('0xed')],{'as':_0xf9d5('0x158'),'foreignKey':_0xf9d5('0x166')});db[_0xf9d5('0xf6')][_0xf9d5('0x116')](db[_0xf9d5('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf9d5('0x144')});db['WhatsappAccount'][_0xf9d5('0x118')](db['User'],{'as':_0xf9d5('0x145'),'through':'user_has_whatsapp_accounts'});db[_0xf9d5('0xf7')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0xf7')][_0xf9d5('0x116')](db[_0xf9d5('0xff')],{'onDelete':'restrict'});db[_0xf9d5('0xf7')][_0xf9d5('0x116')](db[_0xf9d5('0xf6')],{'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0xf7')][_0xf9d5('0x116')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xf9d5('0xf7')][_0xf9d5('0x116')](db[_0xf9d5('0x82')],{'onDelete':_0xf9d5('0x151'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0xf9d5('0x10d')](db[_0xf9d5('0xfa')],{'as':_0xf9d5('0x147'),'onDelete':'cascade','foreignKey':_0xf9d5('0x1f2')});db[_0xf9d5('0xf9')][_0xf9d5('0x116')](db[_0xf9d5('0xf6')],{'as':_0xf9d5('0x15d'),'foreignKey':_0xf9d5('0x1f1')});db['WhatsappInteraction'][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':_0xf9d5('0x14d'),'foreignKey':_0xf9d5('0x14e')});db['WhatsappInteraction']['belongsTo'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x16d'),'foreignKey':_0xf9d5('0x10c')});db[_0xf9d5('0xf9')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x1a2'),'as':_0xf9d5('0x15e')});db[_0xf9d5('0xf9')][_0xf9d5('0x118')](db[_0xf9d5('0x82')],{'through':_0xf9d5('0x1a2'),'as':_0xf9d5('0x160')});db[_0xf9d5('0xf9')]['belongsToMany'](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x161'),'through':'user_has_whatsapp_interactions','foreignKey':_0xf9d5('0x1f2')});db[_0xf9d5('0xfa')][_0xf9d5('0x116')](db['User'],{'as':_0xf9d5('0x11')});db['WhatsappMessage'][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'onDelete':_0xf9d5('0x10b'),'as':_0xf9d5('0x14d')});db[_0xf9d5('0xfa')][_0xf9d5('0x116')](db[_0xf9d5('0xf9')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xf9d5('0x1f2')});db[_0xf9d5('0xfa')]['belongsTo'](db[_0xf9d5('0xf6')],{'as':'Account','foreignKey':_0xf9d5('0x1f1')});db[_0xf9d5('0xfb')][_0xf9d5('0x116')](db['WhatsappAccount'],{});db[_0xf9d5('0xfb')][_0xf9d5('0x116')](db['CmList'],{'as':_0xf9d5('0x158'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0xf9d5('0x116')](db[_0xf9d5('0x6d')],{'as':'Contact','foreignKey':_0xf9d5('0x14e')});db[_0xf9d5('0xfb')][_0xf9d5('0x116')](db['WhatsappInteraction'],{});db[_0xf9d5('0xfb')]['belongsTo'](db[_0xf9d5('0xff')],{});db['WhatsappQueueReport'][_0xf9d5('0x116')](db[_0xf9d5('0xfa')],{});db[_0xf9d5('0xfb')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{});db[_0xf9d5('0xfd')][_0xf9d5('0x116')](db[_0xf9d5('0xfa')],{});db[_0xf9d5('0xfd')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xf9d5('0xfd')]['belongsTo'](db[_0xf9d5('0xf6')],{'foreignKey':'FromWhatsappAccountId','as':_0xf9d5('0x1d7')});db[_0xf9d5('0xfd')]['belongsTo'](db[_0xf9d5('0xf6')],{'foreignKey':_0xf9d5('0x1f3'),'as':'ToAccount'});db[_0xf9d5('0xfd')][_0xf9d5('0x116')](db[_0xf9d5('0xff')],{'foreignKey':'ToQueueId','as':'ToQueue'});db['WhatsappTransferReport'][_0xf9d5('0x116')](db['User'],{'foreignKey':_0xf9d5('0x1e0'),'as':'FromAgent'});db[_0xf9d5('0xfd')][_0xf9d5('0x116')](db['User'],{'foreignKey':'ToUserId','as':_0xf9d5('0x1da')});db['WhatsappQueue'][_0xf9d5('0x118')](db[_0xf9d5('0x11')],{'as':_0xf9d5('0x145'),'through':'UserWhatsappQueue','foreignKey':_0xf9d5('0x1f4')});db['WhatsappQueue'][_0xf9d5('0x118')](db[_0xf9d5('0xdd')],{'through':_0xf9d5('0x1cf'),'as':_0xf9d5('0x15b')});db[_0xf9d5('0x107')][_0xf9d5('0x116')](db[_0xf9d5('0x11')],{'as':'user','foreignKey':'UserId','onDelete':_0xf9d5('0x10b'),'hooks':!![]});db[_0xf9d5('0x101')]['hasOne'](db[_0xf9d5('0x1c2')],{'as':_0xf9d5('0x1c2'),'onDelete':_0xf9d5('0x151')});db[_0xf9d5('0x101')][_0xf9d5('0x109')](db[_0xf9d5('0x37')],{'as':'Imap','onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0xf9d5('0x39')],{'as':_0xf9d5('0x1f5'),'onDelete':_0xf9d5('0x151')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 458f9e6..9e90842 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4809=['./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/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/sms/reports/queue','./api/smsQueueReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','path','express','./errors','./config/environment','./api/client-side-logs','default','then','/api/users','./api/user','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/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/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage'];(function(_0x287caf,_0x2ca0cc){var _0x234580=function(_0xefb2cb){while(--_0xefb2cb){_0x287caf['push'](_0x287caf['shift']());}};_0x234580(++_0x2ca0cc);}(_0x4809,0x1e0));var _0x9480=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x4809[_0x14fad0];return _0x5c665f;};'use strict';var path=require(_0x9480('0x0'));var express=require(_0x9480('0x1'));var errors=require(_0x9480('0x2'));var config=require(_0x9480('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x9480('0x4'));exports[_0x9480('0x5')]=function(_0x5572dd){return setupLoggers(_0x5572dd)[_0x9480('0x6')](function(){_0x5572dd['use'](_0x9480('0x7'),require(_0x9480('0x8')));_0x5572dd['use']('/api/voice/chanspy',require(_0x9480('0x9')));_0x5572dd[_0x9480('0xa')](_0x9480('0xb'),require(_0x9480('0xc')));_0x5572dd[_0x9480('0xa')](_0x9480('0xd'),require(_0x9480('0xe')));_0x5572dd['use'](_0x9480('0xf'),require('./api/voiceMusicOnHold'));_0x5572dd['use'](_0x9480('0x10'),require(_0x9480('0x11')));_0x5572dd[_0x9480('0xa')](_0x9480('0x12'),require(_0x9480('0x13')));_0x5572dd['use'](_0x9480('0x14'),require('./api/screenRecording'));_0x5572dd[_0x9480('0xa')](_0x9480('0x15'),require(_0x9480('0x16')));_0x5572dd['use'](_0x9480('0x17'),require(_0x9480('0x18')));_0x5572dd[_0x9480('0xa')](_0x9480('0x19'),require(_0x9480('0x1a')));_0x5572dd[_0x9480('0xa')](_0x9480('0x1b'),require(_0x9480('0x1c')));_0x5572dd[_0x9480('0xa')](_0x9480('0x1d'),require(_0x9480('0x1e')));_0x5572dd[_0x9480('0xa')](_0x9480('0x1f'),require('./api/voiceQueueReport'));_0x5572dd['use'](_0x9480('0x20'),require(_0x9480('0x21')));_0x5572dd[_0x9480('0xa')](_0x9480('0x22'),require(_0x9480('0x23')));_0x5572dd[_0x9480('0xa')]('/api/voice/transfers/reports',require(_0x9480('0x24')));_0x5572dd[_0x9480('0xa')](_0x9480('0x25'),require('./api/mailServerOut'));_0x5572dd[_0x9480('0xa')](_0x9480('0x26'),require('./api/mailAccount'));_0x5572dd[_0x9480('0xa')](_0x9480('0x27'),require(_0x9480('0x28')));_0x5572dd[_0x9480('0xa')](_0x9480('0x29'),require(_0x9480('0x2a')));_0x5572dd['use'](_0x9480('0x2b'),require(_0x9480('0x2c')));_0x5572dd['use'](_0x9480('0x2d'),require(_0x9480('0x2e')));_0x5572dd[_0x9480('0xa')](_0x9480('0x2f'),require(_0x9480('0x30')));_0x5572dd[_0x9480('0xa')](_0x9480('0x31'),require('./api/mailQueueReport'));_0x5572dd[_0x9480('0xa')](_0x9480('0x32'),require(_0x9480('0x33')));_0x5572dd[_0x9480('0xa')]('/api/dashboards/items',require('./api/dashboardItem'));_0x5572dd[_0x9480('0xa')](_0x9480('0x34'),require(_0x9480('0x35')));_0x5572dd[_0x9480('0xa')](_0x9480('0x36'),require('./api/faxApplication'));_0x5572dd[_0x9480('0xa')](_0x9480('0x37'),require(_0x9480('0x38')));_0x5572dd[_0x9480('0xa')]('/api/fax/messages',require(_0x9480('0x39')));_0x5572dd[_0x9480('0xa')](_0x9480('0x3a'),require(_0x9480('0x3b')));_0x5572dd[_0x9480('0xa')](_0x9480('0x3c'),require(_0x9480('0x3d')));_0x5572dd[_0x9480('0xa')](_0x9480('0x3e'),require('./api/smsAccount'));_0x5572dd[_0x9480('0xa')](_0x9480('0x3f'),require(_0x9480('0x40')));_0x5572dd[_0x9480('0xa')](_0x9480('0x41'),require(_0x9480('0x42')));_0x5572dd[_0x9480('0xa')]('/api/sms/messages',require(_0x9480('0x43')));_0x5572dd[_0x9480('0xa')]('/api/sms/queues',require(_0x9480('0x44')));_0x5572dd['use'](_0x9480('0x45'),require(_0x9480('0x46')));_0x5572dd[_0x9480('0xa')](_0x9480('0x47'),require(_0x9480('0x48')));_0x5572dd[_0x9480('0xa')](_0x9480('0x49'),require('./api/openchannelInteraction'));_0x5572dd['use'](_0x9480('0x4a'),require(_0x9480('0x4b')));_0x5572dd[_0x9480('0xa')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x5572dd[_0x9480('0xa')](_0x9480('0x4c'),require(_0x9480('0x4d')));_0x5572dd[_0x9480('0xa')](_0x9480('0x4e'),require('./api/openchannelQueueReport'));_0x5572dd[_0x9480('0xa')](_0x9480('0x4f'),require(_0x9480('0x50')));_0x5572dd[_0x9480('0xa')](_0x9480('0x51'),require(_0x9480('0x52')));_0x5572dd['use'](_0x9480('0x53'),require(_0x9480('0x54')));_0x5572dd[_0x9480('0xa')](_0x9480('0x55'),require(_0x9480('0x56')));_0x5572dd[_0x9480('0xa')](_0x9480('0x57'),require(_0x9480('0x58')));_0x5572dd['use']('/api/chat/groups',require(_0x9480('0x59')));_0x5572dd[_0x9480('0xa')](_0x9480('0x5a'),require(_0x9480('0x5b')));_0x5572dd[_0x9480('0xa')]('/api/cm/companies',require('./api/cmCompany'));_0x5572dd[_0x9480('0xa')](_0x9480('0x5c'),require(_0x9480('0x5d')));_0x5572dd[_0x9480('0xa')](_0x9480('0x5e'),require(_0x9480('0x5f')));_0x5572dd[_0x9480('0xa')](_0x9480('0x60'),require(_0x9480('0x61')));_0x5572dd[_0x9480('0xa')]('/api/cm/hopper_final',require(_0x9480('0x62')));_0x5572dd[_0x9480('0xa')](_0x9480('0x63'),require(_0x9480('0x64')));_0x5572dd[_0x9480('0xa')](_0x9480('0x65'),require(_0x9480('0x66')));_0x5572dd[_0x9480('0xa')](_0x9480('0x67'),require('./api/action'));_0x5572dd[_0x9480('0xa')]('/api/automations',require(_0x9480('0x68')));_0x5572dd['use'](_0x9480('0x69'),require(_0x9480('0x6a')));_0x5572dd[_0x9480('0xa')](_0x9480('0x6b'),require(_0x9480('0x6c')));_0x5572dd[_0x9480('0xa')](_0x9480('0x6d'),require(_0x9480('0x6e')));_0x5572dd[_0x9480('0xa')](_0x9480('0x6f'),require('./api/interval'));_0x5572dd[_0x9480('0xa')](_0x9480('0x70'),require(_0x9480('0x71')));_0x5572dd[_0x9480('0xa')](_0x9480('0x72'),require(_0x9480('0x73')));_0x5572dd[_0x9480('0xa')](_0x9480('0x74'),require('./api/voiceQueuesLog'));_0x5572dd[_0x9480('0xa')](_0x9480('0x75'),require(_0x9480('0x76')));_0x5572dd[_0x9480('0xa')]('/api/sounds',require(_0x9480('0x77')));_0x5572dd[_0x9480('0xa')](_0x9480('0x78'),require(_0x9480('0x79')));_0x5572dd[_0x9480('0xa')](_0x9480('0x7a'),require(_0x9480('0x7b')));_0x5572dd[_0x9480('0xa')](_0x9480('0x7c'),require(_0x9480('0x7d')));_0x5572dd['use'](_0x9480('0x7e'),require('./api/cmHopperAdditionalPhone'));_0x5572dd[_0x9480('0xa')](_0x9480('0x7f'),require(_0x9480('0x80')));_0x5572dd['use'](_0x9480('0x81'),require(_0x9480('0x82')));_0x5572dd['use'](_0x9480('0x83'),require('./api/variable'));_0x5572dd[_0x9480('0xa')](_0x9480('0x84'),require(_0x9480('0x85')));_0x5572dd['use']('/api/integrations/reports',require(_0x9480('0x86')));_0x5572dd[_0x9480('0xa')]('/api/analytics/custom_reports',require(_0x9480('0x87')));_0x5572dd[_0x9480('0xa')](_0x9480('0x88'),require(_0x9480('0x89')));_0x5572dd[_0x9480('0xa')](_0x9480('0x8a'),require(_0x9480('0x8b')));_0x5572dd[_0x9480('0xa')](_0x9480('0x8c'),require(_0x9480('0x8d')));_0x5572dd[_0x9480('0xa')](_0x9480('0x8e'),require(_0x9480('0x8f')));_0x5572dd[_0x9480('0xa')](_0x9480('0x90'),require(_0x9480('0x91')));_0x5572dd[_0x9480('0xa')](_0x9480('0x92'),require(_0x9480('0x93')));_0x5572dd[_0x9480('0xa')](_0x9480('0x94'),require(_0x9480('0x95')));_0x5572dd[_0x9480('0xa')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x5572dd[_0x9480('0xa')](_0x9480('0x96'),require(_0x9480('0x97')));_0x5572dd[_0x9480('0xa')](_0x9480('0x98'),require(_0x9480('0x99')));_0x5572dd['use'](_0x9480('0x9a'),require(_0x9480('0x9b')));_0x5572dd[_0x9480('0xa')](_0x9480('0x9c'),require(_0x9480('0x9d')));_0x5572dd[_0x9480('0xa')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x5572dd[_0x9480('0xa')](_0x9480('0x9e'),require('./api/intDeskField'));_0x5572dd[_0x9480('0xa')]('/api/integrations/zoho/accounts',require(_0x9480('0x9f')));_0x5572dd[_0x9480('0xa')](_0x9480('0xa0'),require(_0x9480('0xa1')));_0x5572dd[_0x9480('0xa')](_0x9480('0xa2'),require('./api/intZohoField'));_0x5572dd[_0x9480('0xa')](_0x9480('0xa3'),require('./api/intZendeskAccount'));_0x5572dd[_0x9480('0xa')](_0x9480('0xa4'),require(_0x9480('0xa5')));_0x5572dd[_0x9480('0xa')](_0x9480('0xa6'),require(_0x9480('0xa7')));_0x5572dd[_0x9480('0xa')](_0x9480('0xa8'),require(_0x9480('0xa9')));_0x5572dd[_0x9480('0xa')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x5572dd[_0x9480('0xa')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x5572dd[_0x9480('0xa')](_0x9480('0xaa'),require('./api/intVtigerAccount'));_0x5572dd[_0x9480('0xa')]('/api/integrations/vtiger/configurations',require(_0x9480('0xab')));_0x5572dd[_0x9480('0xa')](_0x9480('0xac'),require(_0x9480('0xad')));_0x5572dd[_0x9480('0xa')]('/api/integrations/servicenow/accounts',require(_0x9480('0xae')));_0x5572dd['use']('/api/integrations/servicenow/configurations',require(_0x9480('0xaf')));_0x5572dd['use'](_0x9480('0xb0'),require('./api/intServicenowField'));_0x5572dd[_0x9480('0xa')](_0x9480('0xb1'),require('./api/intDynamics365Account'));_0x5572dd[_0x9480('0xa')](_0x9480('0xb2'),require(_0x9480('0xb3')));_0x5572dd[_0x9480('0xa')](_0x9480('0xb4'),require(_0x9480('0xb5')));_0x5572dd[_0x9480('0xa')](_0x9480('0xb6'),require('./api/intFreshsalesAccount'));_0x5572dd['use'](_0x9480('0xb7'),require('./api/intFreshsalesConfiguration'));_0x5572dd[_0x9480('0xa')](_0x9480('0xb8'),require('./api/intFreshsalesField'));_0x5572dd[_0x9480('0xa')](_0x9480('0xb9'),require(_0x9480('0xba')));_0x5572dd[_0x9480('0xa')](_0x9480('0xbb'),require(_0x9480('0xbc')));_0x5572dd[_0x9480('0xa')](_0x9480('0xbd'),require('./api/chatInternalMessage'));_0x5572dd[_0x9480('0xa')](_0x9480('0xbe'),require(_0x9480('0xbf')));_0x5572dd[_0x9480('0xa')](_0x9480('0xc0'),require(_0x9480('0xc1')));_0x5572dd['use'](_0x9480('0xc2'),require('./api/jscriptySessionReport'));_0x5572dd['use'](_0x9480('0xc3'),require(_0x9480('0xc4')));_0x5572dd[_0x9480('0xa')]('/api/square/reports',require('./api/squareReport'));_0x5572dd[_0x9480('0xa')]('/api/square/details/reports',require(_0x9480('0xc5')));_0x5572dd[_0x9480('0xa')](_0x9480('0xc6'),require('./api/jscriptyProject'));_0x5572dd[_0x9480('0xa')](_0x9480('0xc7'),require(_0x9480('0xc8')));_0x5572dd[_0x9480('0xa')](_0x9480('0xc9'),require('./api/squareOdbc'));_0x5572dd[_0x9480('0xa')](_0x9480('0xca'),require('./api/squareProject'));_0x5572dd[_0x9480('0xa')](_0x9480('0xcb'),require('./api/squareRecording'));_0x5572dd[_0x9480('0xa')](_0x9480('0xcc'),require(_0x9480('0xcd')));_0x5572dd[_0x9480('0xa')](_0x9480('0xce'),require('./api/team'));_0x5572dd['use'](_0x9480('0xcf'),require('./api/license'));_0x5572dd[_0x9480('0xa')](_0x9480('0xd0'),require(_0x9480('0xd1')));_0x5572dd[_0x9480('0xa')](_0x9480('0xd2'),require('./api/migration'));_0x5572dd['use'](_0x9480('0xd3'),require('./api/attachment'));_0x5572dd[_0x9480('0xa')](_0x9480('0xd4'),require(_0x9480('0xd5')));_0x5572dd[_0x9480('0xa')](_0x9480('0xd6'),require(_0x9480('0xd7')));_0x5572dd[_0x9480('0xa')](_0x9480('0xd8'),require('./api/chatTransferReport'));_0x5572dd[_0x9480('0xa')](_0x9480('0xd9'),require(_0x9480('0xda')));_0x5572dd[_0x9480('0xa')]('/api/openchannel/reports/transfer',require(_0x9480('0xdb')));_0x5572dd[_0x9480('0xa')](_0x9480('0xdc'),require(_0x9480('0xdd')));_0x5572dd[_0x9480('0xa')](_0x9480('0xde'),require(_0x9480('0xdf')));_0x5572dd['use']('/api/voice/prefixes',require(_0x9480('0xe0')));_0x5572dd[_0x9480('0xa')](_0x9480('0xe1'),require(_0x9480('0xe2')));_0x5572dd['use'](_0x9480('0xe3'),require('./api/userProfileSection'));_0x5572dd[_0x9480('0xa')](_0x9480('0xe4'),require('./api/userProfileResource'));_0x5572dd[_0x9480('0xa')](_0x9480('0xe5'),require('./api/userNotification'));_0x5572dd['use'](_0x9480('0xe6'),require('./api/whatsappAccount'));_0x5572dd[_0x9480('0xa')](_0x9480('0xe7'),require('./api/whatsappApplication'));_0x5572dd[_0x9480('0xa')](_0x9480('0xe8'),require(_0x9480('0xe9')));_0x5572dd[_0x9480('0xa')](_0x9480('0xea'),require('./api/whatsappMessage'));_0x5572dd[_0x9480('0xa')](_0x9480('0xeb'),require('./api/whatsappQueueReport'));_0x5572dd[_0x9480('0xa')](_0x9480('0xec'),require(_0x9480('0xed')));_0x5572dd[_0x9480('0xa')]('/api/whatsapp/queues',require(_0x9480('0xee')));_0x5572dd['use']('/api/cloudProviders',require(_0x9480('0xef')));_0x5572dd[_0x9480('0xa')](_0x9480('0xf0'),require(_0x9480('0xf1')));_0x5572dd[_0x9480('0xa')](_0x9480('0xf2'),require(_0x9480('0xf3')));_0x5572dd['use'](_0x9480('0xf4'),require(_0x9480('0xf5')));_0x5572dd[_0x9480('0xa')](_0x9480('0xf6'),require(_0x9480('0xf7')));_0x5572dd[_0x9480('0xa')](_0x9480('0xf8'),require(_0x9480('0xf9')));_0x5572dd[_0x9480('0xa')]('/api/jira',require(_0x9480('0xfa')));_0x5572dd[_0x9480('0xa')](_0x9480('0xfb'),require(_0x9480('0xfc')));_0x5572dd[_0x9480('0xa')]('/api/version',require(_0x9480('0xfd')));_0x5572dd['use'](_0x9480('0xfe'),require(_0x9480('0xff')));_0x5572dd[_0x9480('0xa')](_0x9480('0x100'),require(_0x9480('0x101')));_0x5572dd[_0x9480('0xa')](_0x9480('0x102'),require(_0x9480('0x103')));_0x5572dd[_0x9480('0xa')](_0x9480('0x104'),clientSideLogs);_0x5572dd[_0x9480('0xa')]('/apidoc',express[_0x9480('0x105')](path[_0x9480('0x106')](config[_0x9480('0x107')],_0x9480('0x108'))));_0x5572dd[_0x9480('0xa')](_0x9480('0x109'),express[_0x9480('0x105')](path[_0x9480('0x106')](config[_0x9480('0x107')],_0x9480('0x109'))));_0x5572dd[_0x9480('0xa')](_0x9480('0x10a'),express[_0x9480('0x105')](path['join'](config[_0x9480('0x107')],'/demo')));_0x5572dd[_0x9480('0xa')](_0x9480('0x10b'),express[_0x9480('0x105')](path['join'](config['root'],'snippet','3.0.0')));_0x5572dd['use'](_0x9480('0x10c'),express[_0x9480('0x105')](path[_0x9480('0x106')](config['root'],_0x9480('0x10d'))));_0x5572dd[_0x9480('0x10e')](_0x9480('0x10f'))[_0x9480('0x110')](errors[0x194]);_0x5572dd[_0x9480('0x10e')]('/*')['get'](function(_0x4a704b,_0x29da65){_0x29da65[_0x9480('0x111')](path['resolve'](_0x5572dd[_0x9480('0x110')]('appPath')+'/index.html'));});return _0x5572dd;});}; \ No newline at end of file +var _0xda83=['/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/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/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','join','root','/apidoc','static','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','express','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','./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/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem'];(function(_0x50de06,_0x14569c){var _0x1f99db=function(_0x3e6d7f){while(--_0x3e6d7f){_0x50de06['push'](_0x50de06['shift']());}};_0x1f99db(++_0x14569c);}(_0xda83,0x1bc));var _0x3da8=function(_0x390bb3,_0x2d3d31){_0x390bb3=_0x390bb3-0x0;var _0x55c2b5=_0xda83[_0x390bb3];return _0x55c2b5;};'use strict';var path=require('path');var express=require(_0x3da8('0x0'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x3da8('0x1'))[_0x3da8('0x2')];var clientSideLogs=require(_0x3da8('0x3'));exports[_0x3da8('0x4')]=function(_0x21c7b2){return setupLoggers(_0x21c7b2)[_0x3da8('0x5')](function(){_0x21c7b2[_0x3da8('0x6')]('/api/users',require(_0x3da8('0x7')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x8'),require('./api/voiceChanSpy'));_0x21c7b2[_0x3da8('0x6')]('/api/voice/contexts',require('./api/voiceContext'));_0x21c7b2['use'](_0x3da8('0x9'),require(_0x3da8('0xa')));_0x21c7b2['use'](_0x3da8('0xb'),require(_0x3da8('0xc')));_0x21c7b2['use'](_0x3da8('0xd'),require('./api/voiceQueue'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xe'),require(_0x3da8('0xf')));_0x21c7b2['use'](_0x3da8('0x10'),require(_0x3da8('0x11')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x12'),require(_0x3da8('0x13')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x14'),require(_0x3da8('0x15')));_0x21c7b2[_0x3da8('0x6')]('/api/voice/calls/reports',require(_0x3da8('0x16')));_0x21c7b2[_0x3da8('0x6')]('/api/voice/dials/reports',require(_0x3da8('0x17')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x18'),require('./api/voiceAgentReport'));_0x21c7b2['use'](_0x3da8('0x19'),require('./api/voiceQueueReport'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x1a'),require(_0x3da8('0x1b')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x1c'),require(_0x3da8('0x1d')));_0x21c7b2[_0x3da8('0x6')]('/api/voice/transfers/reports',require(_0x3da8('0x1e')));_0x21c7b2['use'](_0x3da8('0x1f'),require(_0x3da8('0x20')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x21'),require('./api/mailAccount'));_0x21c7b2[_0x3da8('0x6')]('/api/mail/queues',require(_0x3da8('0x22')));_0x21c7b2['use']('/api/mail/substatuses',require(_0x3da8('0x23')));_0x21c7b2['use'](_0x3da8('0x24'),require(_0x3da8('0x25')));_0x21c7b2['use'](_0x3da8('0x26'),require(_0x3da8('0x27')));_0x21c7b2['use']('/api/mail/applications',require(_0x3da8('0x28')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x29'),require(_0x3da8('0x2a')));_0x21c7b2[_0x3da8('0x6')]('/api/dashboards',require(_0x3da8('0x2b')));_0x21c7b2[_0x3da8('0x6')]('/api/dashboards/items',require(_0x3da8('0x2c')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x2d'),require(_0x3da8('0x2e')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x2f'),require(_0x3da8('0x30')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x31'),require(_0x3da8('0x32')));_0x21c7b2[_0x3da8('0x6')]('/api/fax/messages',require('./api/faxMessage'));_0x21c7b2[_0x3da8('0x6')]('/api/fax/queues',require(_0x3da8('0x33')));_0x21c7b2[_0x3da8('0x6')]('/api/fax/reports/queue',require(_0x3da8('0x34')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x35'),require('./api/smsAccount'));_0x21c7b2[_0x3da8('0x6')]('/api/sms/applications',require(_0x3da8('0x36')));_0x21c7b2['use'](_0x3da8('0x37'),require(_0x3da8('0x38')));_0x21c7b2['use'](_0x3da8('0x39'),require(_0x3da8('0x3a')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x3b'),require(_0x3da8('0x3c')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x3d'),require('./api/openchannelAccount'));_0x21c7b2[_0x3da8('0x6')]('/api/openchannel/applications',require(_0x3da8('0x3e')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x3f'),require(_0x3da8('0x40')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x41'),require(_0x3da8('0x42')));_0x21c7b2['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x43'),require(_0x3da8('0x44')));_0x21c7b2[_0x3da8('0x6')]('/api/openchannel/reports/queue',require(_0x3da8('0x45')));_0x21c7b2['use']('/api/chat/applications',require(_0x3da8('0x46')));_0x21c7b2[_0x3da8('0x6')]('/api/chat/interactions',require(_0x3da8('0x47')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x48'),require(_0x3da8('0x49')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x4a'),require(_0x3da8('0x4b')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x4c'),require(_0x3da8('0x4d')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x4e'),require(_0x3da8('0x4f')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x50'),require(_0x3da8('0x51')));_0x21c7b2[_0x3da8('0x6')]('/api/cm/companies',require('./api/cmCompany'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x52'),require(_0x3da8('0x53')));_0x21c7b2['use']('/api/cm/hopper',require(_0x3da8('0x54')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x55'),require(_0x3da8('0x56')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x57'),require('./api/cmHopperFinal'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x58'),require('./api/cmHopperHistory'));_0x21c7b2['use']('/api/cm/custom_fields',require(_0x3da8('0x59')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x5a'),require(_0x3da8('0x5b')));_0x21c7b2['use'](_0x3da8('0x5c'),require(_0x3da8('0x5d')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x5e'),require(_0x3da8('0x5f')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x60'),require(_0x3da8('0x61')));_0x21c7b2['use'](_0x3da8('0x62'),require(_0x3da8('0x63')));_0x21c7b2['use'](_0x3da8('0x64'),require(_0x3da8('0x65')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x66'),require(_0x3da8('0x67')));_0x21c7b2['use'](_0x3da8('0x68'),require(_0x3da8('0x69')));_0x21c7b2[_0x3da8('0x6')]('/api/voiceQueuesLog',require(_0x3da8('0x6a')));_0x21c7b2[_0x3da8('0x6')]('/api/schedules',require(_0x3da8('0x6b')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x6c'),require('./api/sound'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x6d'),require(_0x3da8('0x6e')));_0x21c7b2[_0x3da8('0x6')]('/api/contact_item_types',require(_0x3da8('0x6f')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x70'),require(_0x3da8('0x71')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x72'),require(_0x3da8('0x73')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x74'),require(_0x3da8('0x75')));_0x21c7b2['use']('/api/triggers',require(_0x3da8('0x76')));_0x21c7b2['use']('/api/variables',require(_0x3da8('0x77')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x78'),require(_0x3da8('0x79')));_0x21c7b2['use']('/api/integrations/reports',require(_0x3da8('0x7a')));_0x21c7b2['use'](_0x3da8('0x7b'),require('./api/analyticCustomReport'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x7c'),require('./api/analyticDefaultReport'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x7d'),require(_0x3da8('0x7e')));_0x21c7b2['use'](_0x3da8('0x7f'),require(_0x3da8('0x80')));_0x21c7b2['use'](_0x3da8('0x81'),require(_0x3da8('0x82')));_0x21c7b2['use'](_0x3da8('0x83'),require(_0x3da8('0x84')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x85'),require(_0x3da8('0x86')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x87'),require(_0x3da8('0x88')));_0x21c7b2['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x21c7b2[_0x3da8('0x6')]('/api/integrations/sugarcrm/accounts',require(_0x3da8('0x89')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x8a'),require(_0x3da8('0x8b')));_0x21c7b2['use'](_0x3da8('0x8c'),require(_0x3da8('0x8d')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x8e'),require(_0x3da8('0x8f')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x90'),require(_0x3da8('0x91')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x92'),require(_0x3da8('0x93')));_0x21c7b2['use'](_0x3da8('0x94'),require(_0x3da8('0x95')));_0x21c7b2[_0x3da8('0x6')]('/api/integrations/zoho/configurations',require(_0x3da8('0x96')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x97'),require(_0x3da8('0x98')));_0x21c7b2['use'](_0x3da8('0x99'),require(_0x3da8('0x9a')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x9b'),require(_0x3da8('0x9c')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x9d'),require(_0x3da8('0x9e')));_0x21c7b2['use'](_0x3da8('0x9f'),require(_0x3da8('0xa0')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xa1'),require('./api/intFreshdeskConfiguration'));_0x21c7b2[_0x3da8('0x6')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xa2'),require(_0x3da8('0xa3')));_0x21c7b2['use'](_0x3da8('0xa4'),require(_0x3da8('0xa5')));_0x21c7b2['use'](_0x3da8('0xa6'),require(_0x3da8('0xa7')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xa8'),require(_0x3da8('0xa9')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xaa'),require(_0x3da8('0xab')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xac'),require(_0x3da8('0xad')));_0x21c7b2['use'](_0x3da8('0xae'),require('./api/intDynamics365Account'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xaf'),require(_0x3da8('0xb0')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xb1'),require('./api/intDynamics365Field'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xb2'),require('./api/intFreshsalesAccount'));_0x21c7b2[_0x3da8('0x6')]('/api/integrations/freshsales/configurations',require(_0x3da8('0xb3')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xb4'),require(_0x3da8('0xb5')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xb6'),require(_0x3da8('0xb7')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xb8'),require('./api/chatQueueReport'));_0x21c7b2['use'](_0x3da8('0xb9'),require('./api/chatInternalMessage'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xba'),require(_0x3da8('0xbb')));_0x21c7b2[_0x3da8('0x6')]('/api/jscripty/questions/reports',require(_0x3da8('0xbc')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xbd'),require('./api/jscriptySessionReport'));_0x21c7b2['use'](_0x3da8('0xbe'),require(_0x3da8('0xbf')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xc0'),require(_0x3da8('0xc1')));_0x21c7b2['use'](_0x3da8('0xc2'),require(_0x3da8('0xc3')));_0x21c7b2['use']('/api/jscripty/projects',require(_0x3da8('0xc4')));_0x21c7b2['use'](_0x3da8('0xc5'),require(_0x3da8('0xc6')));_0x21c7b2['use'](_0x3da8('0xc7'),require(_0x3da8('0xc8')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xc9'),require(_0x3da8('0xca')));_0x21c7b2[_0x3da8('0x6')]('/api/square/recordings',require(_0x3da8('0xcb')));_0x21c7b2[_0x3da8('0x6')]('/api/square/messages',require(_0x3da8('0xcc')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xcd'),require('./api/team'));_0x21c7b2['use'](_0x3da8('0xce'),require(_0x3da8('0xcf')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xd0'),require(_0x3da8('0xd1')));_0x21c7b2['use'](_0x3da8('0xd2'),require(_0x3da8('0xd3')));_0x21c7b2[_0x3da8('0x6')]('/api/attachments',require(_0x3da8('0xd4')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xd5'),require(_0x3da8('0xd6')));_0x21c7b2['use'](_0x3da8('0xd7'),require(_0x3da8('0xd8')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xd9'),require(_0x3da8('0xda')));_0x21c7b2['use'](_0x3da8('0xdb'),require('./api/faxTransferReport'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xdc'),require('./api/openchannelTransferReport'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xdd'),require(_0x3da8('0xde')));_0x21c7b2[_0x3da8('0x6')]('/api/cm/lists',require('./api/cmList'));_0x21c7b2['use'](_0x3da8('0xdf'),require(_0x3da8('0xe0')));_0x21c7b2['use'](_0x3da8('0xe1'),require(_0x3da8('0xe2')));_0x21c7b2[_0x3da8('0x6')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x21c7b2['use'](_0x3da8('0xe3'),require(_0x3da8('0xe4')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xe5'),require(_0x3da8('0xe6')));_0x21c7b2['use']('/api/whatsapp/accounts',require(_0x3da8('0xe7')));_0x21c7b2['use'](_0x3da8('0xe8'),require(_0x3da8('0xe9')));_0x21c7b2[_0x3da8('0x6')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xea'),require(_0x3da8('0xeb')));_0x21c7b2['use'](_0x3da8('0xec'),require('./api/whatsappQueueReport'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xed'),require(_0x3da8('0xee')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xef'),require('./api/whatsappQueue'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xf0'),require(_0x3da8('0xf1')));_0x21c7b2['use'](_0x3da8('0xf2'),require(_0x3da8('0xf3')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xf4'),require(_0x3da8('0xf5')));_0x21c7b2['use'](_0x3da8('0xf6'),require('./api/authLocal'));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xf7'),require(_0x3da8('0xf8')));_0x21c7b2['use'](_0x3da8('0xf9'),require(_0x3da8('0xfa')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xfb'),require('./api/jira'));_0x21c7b2[_0x3da8('0x6')]('/api/rpc',require(_0x3da8('0xfc')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0xfd'),require(_0x3da8('0xfe')));_0x21c7b2['use'](_0x3da8('0xff'),require(_0x3da8('0x100')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x101'),require(_0x3da8('0x102')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x103'),require(_0x3da8('0x104')));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x105'),clientSideLogs);_0x21c7b2['use']('/apidoc',express['static'](path[_0x3da8('0x106')](config[_0x3da8('0x107')],_0x3da8('0x108'))));_0x21c7b2[_0x3da8('0x6')]('/www',express[_0x3da8('0x109')](path[_0x3da8('0x106')](config[_0x3da8('0x107')],_0x3da8('0x10a'))));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x10b'),express['static'](path[_0x3da8('0x106')](config[_0x3da8('0x107')],_0x3da8('0x10b'))));_0x21c7b2[_0x3da8('0x6')](_0x3da8('0x10c'),express[_0x3da8('0x109')](path['join'](config[_0x3da8('0x107')],_0x3da8('0x10d'),_0x3da8('0x10e'))));_0x21c7b2['use'](_0x3da8('0x10f'),express[_0x3da8('0x109')](path[_0x3da8('0x106')](config[_0x3da8('0x107')],_0x3da8('0x110'))));_0x21c7b2[_0x3da8('0x111')](_0x3da8('0x112'))[_0x3da8('0x113')](errors[0x194]);_0x21c7b2[_0x3da8('0x111')]('/*')[_0x3da8('0x113')](function(_0x1be77a,_0x473dff){_0x473dff['sendFile'](path[_0x3da8('0x114')](_0x21c7b2[_0x3da8('0x113')](_0x3da8('0x115'))+_0x3da8('0x116')));});return _0x21c7b2;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index e7768f9..17608ef 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa992=['../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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa992,0xc4));var _0x2a99=function(_0x32a154,_0x38fc3e){_0x32a154=_0x32a154-0x0;var _0x58867e=_0xa992[_0x32a154];return _0x58867e;};'use strict';var jayson=require(_0x2a99('0x0'));var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x2d6d8f,_0x12fb59){var _0x4e8b6e={};_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/user/user.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/voiceExtension/voiceExtension.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/voiceQueue/voiceQueue.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x2')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x3')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x4')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x5')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x6')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x7')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x8')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x9')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0xa')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0xb')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0xc')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0xd')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/mailInteraction/mailInteraction.rpc'));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0xe')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0xf')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x10')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x11')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x12')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x13')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x14')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x15')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x16')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x17')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x18')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x19')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x1a')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x1b')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x1c')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x1d')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x1e')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x1f')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x20')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/cmHopper/cmHopper.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x21')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x22')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x23')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x24')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x25')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/pause/pause.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x26')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4e8b6e=_['merge'](_0x4e8b6e,require('../api/template/template.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x27')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x28')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x29')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x2a')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x2b')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x2c')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x2d')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x2e')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x2f')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x30')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x31')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x32')));_0x4e8b6e=_['merge'](_0x4e8b6e,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x33')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x34')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x35')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x36')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x37')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require('../api/squareMessage/squareMessage.rpc'));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x38')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x39')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x3a')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x3b')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x3c')));_0x4e8b6e=_['merge'](_0x4e8b6e,require(_0x2a99('0x3d')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x3e')));_0x4e8b6e=_[_0x2a99('0x1')](_0x4e8b6e,require(_0x2a99('0x3f')));var _0x22793b=jayson[_0x2a99('0x40')](_0x4e8b6e)[_0x2a99('0x41')]();var _0x217bf9=config[_0x2a99('0x42')][_0x2a99('0x43')]||config[_0x2a99('0x43')]+0x1;var _0x281a13=config[_0x2a99('0x42')]['ip']||'localhost';_0x22793b['on']('error',function(_0x4b1fd1){return _0x12fb59(_0x4b1fd1);});_0x22793b[_0x2a99('0x44')](_0x217bf9,_0x281a13,function(){console['log'](_0x2a99('0x45'),_0x281a13,_0x217bf9);require('../config/triggers')[_0x2a99('0x46')]();return _0x2d6d8f('RPC\x20listening\x20on\x20'+_0x281a13+':'+_0x217bf9);});});}; \ No newline at end of file +var _0x7fe0=['../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','port','rpc','localhost','error','log','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','merge','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc'];(function(_0xb70c2d,_0x1e7b42){var _0x4b4806=function(_0x164b3e){while(--_0x164b3e){_0xb70c2d['push'](_0xb70c2d['shift']());}};_0x4b4806(++_0x1e7b42);}(_0x7fe0,0x198));var _0x07fe=function(_0x4741f5,_0x1a1c0d){_0x4741f5=_0x4741f5-0x0;var _0x148c26=_0x7fe0[_0x4741f5];return _0x148c26;};'use strict';var jayson=require(_0x07fe('0x0'));var _=require(_0x07fe('0x1'));var config=require(_0x07fe('0x2'));exports[_0x07fe('0x3')]=function(){return new Promise(function(_0x14a354,_0x412570){var _0x499905={};_0x499905=_['merge'](_0x499905,require(_0x07fe('0x4')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x5')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x6')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x7')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x9')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0xa')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0xb')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0xc')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0xd')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0xe')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0xf')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x10')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x11')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x12')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x13')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x14')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/mailMessage/mailMessage.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x15')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x16')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x17')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x18')));_0x499905=_['merge'](_0x499905,require('../api/faxMessage/faxMessage.rpc'));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x19')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x1a')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x1b')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x1c')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x1d')));_0x499905=_['merge'](_0x499905,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x1e')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x1f')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x20')));_0x499905=_['merge'](_0x499905,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x21')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x22')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/chatQueue/chatQueue.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x23')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x24')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x25')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x26')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x27')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x28')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x29')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/pause/pause.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x2a')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x2b')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x2c')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x2d')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x2e')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x2f')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x30')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x31')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x32')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x33')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x34')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x35')));_0x499905=_['merge'](_0x499905,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x36')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x37')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x38')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x39')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x3a')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x3b')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/squareProject/squareProject.rpc'));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x3c')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x3d')));_0x499905=_[_0x07fe('0x8')](_0x499905,require('../api/campaign/campaign.rpc'));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x3e')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x3f')));_0x499905=_['merge'](_0x499905,require(_0x07fe('0x40')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x41')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x42')));_0x499905=_[_0x07fe('0x8')](_0x499905,require(_0x07fe('0x43')));_0x499905=_['merge'](_0x499905,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5aee10=jayson[_0x07fe('0x44')](_0x499905)['http']();var _0x444c03=config['rpc'][_0x07fe('0x45')]||config['port']+0x1;var _0x184f84=config[_0x07fe('0x46')]['ip']||_0x07fe('0x47');_0x5aee10['on'](_0x07fe('0x48'),function(_0x5d433e){return _0x412570(_0x5d433e);});_0x5aee10[_0x07fe('0x3')](_0x444c03,_0x184f84,function(){console[_0x07fe('0x49')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x184f84,_0x444c03);require(_0x07fe('0x4a'))[_0x07fe('0x4b')]();return _0x14a354('RPC\x20listening\x20on\x20'+_0x184f84+':'+_0x444c03);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 52a1748..a23f8c1 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 _0x4d49=['setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x4d49,0x141));var _0x94d4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4d49[_0x501510];return _0x1e6ee5;};'use strict';var util=require('util');var _=require(_0x94d4('0x0'));var EventEmitter=require('events')[_0x94d4('0x1')];var AGIReply=require(_0x94d4('0x2'));var AGIError=require(_0x94d4('0x3'));function AGIChannel(_0x478610){var _0xa6775f=this,_0x95b780=new AGIReply(),_0x422546=![],_0x122abc={};EventEmitter[_0x94d4('0x4')](_0xa6775f);_0x478610['setEncoding'](_0x94d4('0x5'));_0x478610[_0x94d4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x95b780[_0x94d4('0x7')](_0x94d4('0x5'));_0x95b780['on'](_0x94d4('0x8'),function(_0x26feea){for(var _0x520dde in _0x26feea){_0xa6775f[_0x520dde]=_0x26feea[_0x520dde];}_0xa6775f[_0x94d4('0x9')](_0x94d4('0xa'));});_0x95b780['on']('line',function(_0x23ef86){if(_0x23ef86[_0x94d4('0xb')]()==_0x94d4('0xc')){_0xa6775f[_0x94d4('0x9')]('hangup');return;}if(_0x23ef86[_0x94d4('0xd')](0x0,0xb)==_0x94d4('0xe')){_0x422546=!![];}if(_0x422546){_0x122abc['rx']+=_0x23ef86+'\x0a';if(_0x23ef86[_0x94d4('0xf')](_0x94d4('0x10'))!=-0x1){_0x422546=![];}}else{_0x122abc['rx']=_0x23ef86;}if(_0x422546){return;}if(typeof _0x122abc['cb']==_0x94d4('0x11')){var _0x2789bc=_0x122abc['rx']['substring'](0x0,0x3),_0x562c2e=null,_0x4e1155=null;_0x2789bc=parseInt(_0x2789bc);if(isNaN(_0x2789bc)){_0x122abc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x94d4('0x12')});return;}if(_0x2789bc!=0xc8){_0x122abc['cb'](null,{'code':_0x2789bc,'result':-0x1,'extra':'KO'});return;}_0x562c2e=_0x122abc['rx'][_0x94d4('0xd')](0x4)['replace'](_0x94d4('0x13'),'');if(_0x562c2e[_0x94d4('0x14')]('\x20')!=-0x1){_0x562c2e=_0x562c2e['substr'](0x0,_0x562c2e[_0x94d4('0x14')]('\x20'));}if(_['startsWith'](_0x562c2e,'-1')){_0x562c2e=parseInt(_0x562c2e);}_0x4e1155=_0x122abc['rx'][_0x94d4('0x15')]('\x20');if(_0x4e1155['length']==0x3){_0x4e1155=_0x4e1155[0x2]['substring'](0x1,_0x4e1155[0x2]['length']-0x1);}else if(_0x4e1155[_0x94d4('0x16')]>0x3){var _0x2b5133=/\((.+)\)/;var _0x2ae07c=_0x122abc['rx']['match'](_0x2b5133);if(_0x2ae07c){_0x4e1155=_0x2ae07c[0x1];}else{_0x4e1155=null;}}else{_0x4e1155=null;}_0x122abc['cb'](null,{'code':_0x2789bc,'result':_0x562c2e,'extra':_0x4e1155});}});_0x478610['on']('error',function(_0x5d5fd3){_0xa6775f[_0x94d4('0x9')](_0x94d4('0x17'),new AGIError(_0x94d4('0x18'),_0x5d5fd3[_0x94d4('0x19')]));});_0x478610['on'](_0x94d4('0x1a'),function(){_0xa6775f[_0x94d4('0x9')](_0x94d4('0x1a'),new AGIError(_0x94d4('0x1b')));});_0x478610['on'](_0x94d4('0x1c'),function(){_0xa6775f[_0x94d4('0x9')](_0x94d4('0x1c'),new AGIError(_0x94d4('0x1d')));_0x478610['destroy']();});_0x478610[_0x94d4('0x1e')](_0x95b780);this['command']=function(_0x3c3a,_0x3421e2){var _0x3c3a=_0x3c3a||'',_0x3421e2=typeof _0x3421e2=='function'?_0x3421e2:new Function();_0x122abc={'tx':_0x3c3a,'rx':'','cb':_0x3421e2};_0x478610[_0x94d4('0x1f')](_0x3c3a+'\x0a');},this[_0x94d4('0x1a')]=function(){_0x478610['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x94d4('0x20')][_0x94d4('0x21')]=function(_0x2903b3){return this['command'][_0x94d4('0x22')](this,_0x2903b3);};AGIChannel['prototype'][_0x94d4('0x23')]=function(){return this['sendRequest'](_0x94d4('0x24'));};AGIChannel[_0x94d4('0x20')][_0x94d4('0x25')]=function(_0x6f1813,_0x1b01e2,_0x20d947){_0x6f1813=_0x6f1813===undefined?'beep':_0x6f1813;_0x1b01e2=_0x1b01e2===undefined?'5':_0x1b01e2;_0x20d947=_0x20d947===undefined?'1':_0x20d947;return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x27'),_0x6f1813,_0x1b01e2*0x3e8,_0x20d947));};AGIChannel[_0x94d4('0x20')][_0x94d4('0x28')]=function(_0x2211e2){_0x2211e2=_0x2211e2||_0x94d4('0x29');return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x2a'),_0x2211e2));};AGIChannel['prototype'][_0x94d4('0x2b')]=function(_0x3c5967,_0x59da30){if(_[_0x94d4('0x2c')](_0x59da30)){return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x2d'),_0x3c5967,_0x59da30[_0x94d4('0x2e')](',')));}return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x2d'),_0x3c5967,_0x59da30));};AGIChannel[_0x94d4('0x20')][_0x94d4('0x2f')]=function(_0x189c5e){return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x30'),_0x189c5e));};AGIChannel[_0x94d4('0x20')][_0x94d4('0x31')]=function(_0x1db15d){return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x32'),_0x1db15d));};AGIChannel[_0x94d4('0x20')][_0x94d4('0x33')]=function(_0x410c55){return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x34'),_0x410c55));};AGIChannel[_0x94d4('0x20')][_0x94d4('0xc')]=function(){return this[_0x94d4('0x21')](_0x94d4('0x35'));};AGIChannel['prototype'][_0x94d4('0x36')]=function(_0x5b81da,_0x38b044){var _0x23a6b2=_[_0x94d4('0x37')](_0x38b044)||_[_0x94d4('0x38')](_0x38b044)?_0x38b044['toString']():_0x38b044;return this['sendRequest'](util[_0x94d4('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x5b81da,_0x23a6b2?_0x23a6b2[_0x94d4('0x39')]()[_0x94d4('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x94d4('0x20')]['sayNumber']=function(_0x128a23,_0x504fca){return this['sendRequest'](util['format'](_0x94d4('0x3b'),_0x128a23,_0x504fca));};AGIChannel[_0x94d4('0x20')][_0x94d4('0x3c')]=function(_0x48da56,_0x24ba88){return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x3d'),_0x48da56,_0x24ba88));};AGIChannel[_0x94d4('0x20')][_0x94d4('0x3e')]=function(_0x22ea49,_0xd62692){return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x3f'),_0x22ea49,_0xd62692));};AGIChannel['prototype'][_0x94d4('0x40')]=function(_0x31a0f3,_0x2e23ee,_0x1a250b){_0x2e23ee=_0x2e23ee||this[_0x94d4('0x41')];_0x1a250b=_0x1a250b||0x1;this[_0x94d4('0x2f')](_0x31a0f3);this['setExtension'](_0x2e23ee);this[_0x94d4('0x33')](_0x1a250b);return this[_0x94d4('0x28')](util[_0x94d4('0x26')](_0x94d4('0x42'),_0x31a0f3,_0x2e23ee,_0x1a250b));};AGIChannel[_0x94d4('0x20')]['getVariable']=function(_0x449cfc){return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x43'),_0x449cfc));};AGIChannel['prototype']['recordFile']=function(_0x401f01,_0x3a18bc,_0x281dc8,_0x2bbd46,_0x5e0567,_0x411179){_0x3a18bc=_0x3a18bc||_0x94d4('0x44');_0x281dc8=_0x281dc8||'';_0x2bbd46=_0x2bbd46===undefined?-0x1:_0x2bbd46==='-1'?-0x1:_0x2bbd46*0x3e8;_0x5e0567=_0x5e0567===undefined?'':'s='+_0x5e0567;_0x411179=_0x411179?_0x94d4('0x45'):'';return this[_0x94d4('0x21')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x401f01,_0x3a18bc,_0x281dc8,_0x2bbd46,_0x411179,_0x5e0567));};AGIChannel[_0x94d4('0x20')]['streamFile']=function(_0x45e33d,_0x19c032){_0x19c032=_0x19c032||'';return this[_0x94d4('0x21')](util[_0x94d4('0x26')](_0x94d4('0x46'),_0x45e33d,_0x19c032));};AGIChannel[_0x94d4('0x20')]['agi']=function(_0x146213){return this[_0x94d4('0x2b')](_0x94d4('0x47'),_0x146213);};AGIChannel[_0x94d4('0x20')]['wait']=function(_0x528cfc){return this[_0x94d4('0x2b')]('WAIT',_0x528cfc);};AGIChannel[_0x94d4('0x20')][_0x94d4('0x17')]=function(_0x4c8bad,_0x34c8ae){this[_0x94d4('0x28')](util[_0x94d4('0x26')](_0x94d4('0x48'),_0x4c8bad['id'],_0x4c8bad[_0x94d4('0x49')],_0x34c8ae));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x34f0=['ready','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sendRequest','command','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','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','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./error','call','setEncoding','setTimeout','utf8','headers'];(function(_0x29d83f,_0x9eb180){var _0x3a3f54=function(_0x5d4ac7){while(--_0x5d4ac7){_0x29d83f['push'](_0x29d83f['shift']());}};_0x3a3f54(++_0x9eb180);}(_0x34f0,0x13b));var _0x034f=function(_0x5a11b4,_0x32f7c7){_0x5a11b4=_0x5a11b4-0x0;var _0xb80eee=_0x34f0[_0x5a11b4];return _0xb80eee;};'use strict';var util=require(_0x034f('0x0'));var _=require(_0x034f('0x1'));var EventEmitter=require('events')[_0x034f('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x034f('0x3'));function AGIChannel(_0x405ee5){var _0x30e99f=this,_0x1f0c8a=new AGIReply(),_0x2bd6d1=![],_0x5011cd={};EventEmitter[_0x034f('0x4')](_0x30e99f);_0x405ee5[_0x034f('0x5')]('utf8');_0x405ee5[_0x034f('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1f0c8a['setEncoding'](_0x034f('0x7'));_0x1f0c8a['on'](_0x034f('0x8'),function(_0x32e7ff){for(var _0x47e544 in _0x32e7ff){_0x30e99f[_0x47e544]=_0x32e7ff[_0x47e544];}_0x30e99f['emit'](_0x034f('0x9'));});_0x1f0c8a['on']('line',function(_0x48ed9b){if(_0x48ed9b[_0x034f('0xa')]()==_0x034f('0xb')){_0x30e99f[_0x034f('0xc')](_0x034f('0xb'));return;}if(_0x48ed9b[_0x034f('0xd')](0x0,0xb)=='520-Invalid'){_0x2bd6d1=!![];}if(_0x2bd6d1){_0x5011cd['rx']+=_0x48ed9b+'\x0a';if(_0x48ed9b[_0x034f('0xe')](_0x034f('0xf'))!=-0x1){_0x2bd6d1=![];}}else{_0x5011cd['rx']=_0x48ed9b;}if(_0x2bd6d1){return;}if(typeof _0x5011cd['cb']==_0x034f('0x10')){var _0x568180=_0x5011cd['rx'][_0x034f('0xd')](0x0,0x3),_0x720269=null,_0x4d1f54=null;_0x568180=parseInt(_0x568180);if(isNaN(_0x568180)){_0x5011cd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x034f('0x11')});return;}if(_0x568180!=0xc8){_0x5011cd['cb'](null,{'code':_0x568180,'result':-0x1,'extra':'KO'});return;}_0x720269=_0x5011cd['rx'][_0x034f('0xd')](0x4)[_0x034f('0x12')](_0x034f('0x13'),'');if(_0x720269[_0x034f('0x14')]('\x20')!=-0x1){_0x720269=_0x720269[_0x034f('0x15')](0x0,_0x720269[_0x034f('0x14')]('\x20'));}if(_['startsWith'](_0x720269,'-1')){_0x720269=parseInt(_0x720269);}_0x4d1f54=_0x5011cd['rx']['split']('\x20');if(_0x4d1f54[_0x034f('0x16')]==0x3){_0x4d1f54=_0x4d1f54[0x2][_0x034f('0xd')](0x1,_0x4d1f54[0x2][_0x034f('0x16')]-0x1);}else if(_0x4d1f54['length']>0x3){var _0x48cfb2=/\((.+)\)/;var _0x46e481=_0x5011cd['rx'][_0x034f('0x17')](_0x48cfb2);if(_0x46e481){_0x4d1f54=_0x46e481[0x1];}else{_0x4d1f54=null;}}else{_0x4d1f54=null;}_0x5011cd['cb'](null,{'code':_0x568180,'result':_0x720269,'extra':_0x4d1f54});}});_0x405ee5['on']('error',function(_0xbf8794){_0x30e99f['emit'](_0x034f('0x18'),new AGIError(_0x034f('0x19'),_0xbf8794[_0x034f('0x1a')]));});_0x405ee5['on']('close',function(){_0x30e99f[_0x034f('0xc')](_0x034f('0x1b'),new AGIError(_0x034f('0x1c')));});_0x405ee5['on'](_0x034f('0x1d'),function(){_0x30e99f[_0x034f('0xc')]('timeout',new AGIError(_0x034f('0x1e')));_0x405ee5[_0x034f('0x1f')]();});_0x405ee5[_0x034f('0x20')](_0x1f0c8a);this['command']=function(_0xd6954b,_0x1e9abb){var _0xd6954b=_0xd6954b||'',_0x1e9abb=typeof _0x1e9abb=='function'?_0x1e9abb:new Function();_0x5011cd={'tx':_0xd6954b,'rx':'','cb':_0x1e9abb};_0x405ee5[_0x034f('0x21')](_0xd6954b+'\x0a');},this['close']=function(){_0x405ee5[_0x034f('0x1f')]();};}util[_0x034f('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x034f('0x23')][_0x034f('0x24')]=function(_0x2943b8){return this[_0x034f('0x25')]['sync'](this,_0x2943b8);};AGIChannel[_0x034f('0x23')][_0x034f('0x26')]=function(){return this[_0x034f('0x24')](_0x034f('0x27'));};AGIChannel['prototype'][_0x034f('0x28')]=function(_0x8eacf2,_0x41793b,_0x56d4da){_0x8eacf2=_0x8eacf2===undefined?_0x034f('0x29'):_0x8eacf2;_0x41793b=_0x41793b===undefined?'5':_0x41793b;_0x56d4da=_0x56d4da===undefined?'1':_0x56d4da;return this[_0x034f('0x24')](util[_0x034f('0x2a')](_0x034f('0x2b'),_0x8eacf2,_0x41793b*0x3e8,_0x56d4da));};AGIChannel[_0x034f('0x23')][_0x034f('0x2c')]=function(_0xcfb1cb){_0xcfb1cb=_0xcfb1cb||_0x034f('0x2d');return this[_0x034f('0x24')](util[_0x034f('0x2a')](_0x034f('0x2e'),_0xcfb1cb));};AGIChannel['prototype']['exec']=function(_0x12ee10,_0x50552b){if(_['isArray'](_0x50552b)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x12ee10,_0x50552b['join'](',')));}return this[_0x034f('0x24')](util['format'](_0x034f('0x2f'),_0x12ee10,_0x50552b));};AGIChannel['prototype'][_0x034f('0x30')]=function(_0x4e7911){return this['sendRequest'](util['format'](_0x034f('0x31'),_0x4e7911));};AGIChannel[_0x034f('0x23')][_0x034f('0x32')]=function(_0x590236){return this[_0x034f('0x24')](util['format']('SET\x20EXTENSION\x20%s',_0x590236));};AGIChannel[_0x034f('0x23')][_0x034f('0x33')]=function(_0x3a6ba2){return this[_0x034f('0x24')](util[_0x034f('0x2a')](_0x034f('0x34'),_0x3a6ba2));};AGIChannel[_0x034f('0x23')][_0x034f('0xb')]=function(){return this[_0x034f('0x24')](_0x034f('0x35'));};AGIChannel[_0x034f('0x23')][_0x034f('0x36')]=function(_0x4be081,_0x1e0bc9){var _0x26ef5a=_['isBoolean'](_0x1e0bc9)||_[_0x034f('0x37')](_0x1e0bc9)?_0x1e0bc9[_0x034f('0x38')]():_0x1e0bc9;return this[_0x034f('0x24')](util[_0x034f('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4be081,_0x26ef5a?_0x26ef5a[_0x034f('0x38')]()[_0x034f('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x034f('0x23')][_0x034f('0x39')]=function(_0x255cf0,_0xd4bbc1){return this[_0x034f('0x24')](util[_0x034f('0x2a')](_0x034f('0x3a'),_0x255cf0,_0xd4bbc1));};AGIChannel[_0x034f('0x23')][_0x034f('0x3b')]=function(_0x4fdab0,_0x52a2f5){return this['sendRequest'](util[_0x034f('0x2a')](_0x034f('0x3c'),_0x4fdab0,_0x52a2f5));};AGIChannel['prototype'][_0x034f('0x3d')]=function(_0x3e2340,_0x27a525){return this[_0x034f('0x24')](util['format'](_0x034f('0x3e'),_0x3e2340,_0x27a525));};AGIChannel[_0x034f('0x23')][_0x034f('0x3f')]=function(_0x1c4ae7,_0x2d9c35,_0xa658df){_0x2d9c35=_0x2d9c35||this[_0x034f('0x40')];_0xa658df=_0xa658df||0x1;this[_0x034f('0x30')](_0x1c4ae7);this[_0x034f('0x32')](_0x2d9c35);this[_0x034f('0x33')](_0xa658df);return this[_0x034f('0x2c')](util[_0x034f('0x2a')](_0x034f('0x41'),_0x1c4ae7,_0x2d9c35,_0xa658df));};AGIChannel[_0x034f('0x23')][_0x034f('0x42')]=function(_0xa00762){return this[_0x034f('0x24')](util['format'](_0x034f('0x43'),_0xa00762));};AGIChannel['prototype'][_0x034f('0x44')]=function(_0x39ffad,_0x427f70,_0x3266ec,_0x1bbd47,_0x2bd478,_0x1049ce){_0x427f70=_0x427f70||_0x034f('0x45');_0x3266ec=_0x3266ec||'';_0x1bbd47=_0x1bbd47===undefined?-0x1:_0x1bbd47==='-1'?-0x1:_0x1bbd47*0x3e8;_0x2bd478=_0x2bd478===undefined?'':'s='+_0x2bd478;_0x1049ce=_0x1049ce?_0x034f('0x46'):'';return this['sendRequest'](util[_0x034f('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x39ffad,_0x427f70,_0x3266ec,_0x1bbd47,_0x1049ce,_0x2bd478));};AGIChannel[_0x034f('0x23')][_0x034f('0x47')]=function(_0xb9d346,_0x37842f){_0x37842f=_0x37842f||'';return this[_0x034f('0x24')](util['format'](_0x034f('0x48'),_0xb9d346,_0x37842f));};AGIChannel[_0x034f('0x23')][_0x034f('0x49')]=function(_0x231603){return this[_0x034f('0x4a')](_0x034f('0x4b'),_0x231603);};AGIChannel[_0x034f('0x23')][_0x034f('0x4c')]=function(_0x1cc2d7){return this[_0x034f('0x4a')](_0x034f('0x4d'),_0x1cc2d7);};AGIChannel[_0x034f('0x23')][_0x034f('0x18')]=function(_0x1c0262,_0x5a8ea5){this[_0x034f('0x2c')](util['format'](_0x034f('0x4e'),_0x1c0262['id'],_0x1c0262[_0x034f('0x4f')],_0x5a8ea5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x034f('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3ca34a0..7e47379 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 _0x6257=['util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','message','name','exports'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x6257,0x132));var _0x7625=function(_0x142d94,_0x131d44){_0x142d94=_0x142d94-0x0;var _0x14ee18=_0x6257[_0x142d94];return _0x14ee18;};'use strict';var util=require(_0x7625('0x0'));var error={'E_AGI_UNDEFINED':_0x7625('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x7625('0x2'),'E_AGI_SERVER_CLOSE':_0x7625('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7625('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7625('0x5'),'E_AGI_SOCKET_ERROR':_0x7625('0x6'),'E_AGI_SOCKET_CLOSE':_0x7625('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x7625('0x8'),'E_AGI_COMMAND_EMPTY':_0x7625('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7625('0xa'),'E_AGI_IVR_ENTRY':_0x7625('0xb')};function AGIError(_0x2767e0){var _0x2767e0=_0x2767e0||null,_0x4cf3ef=_0x4cf3ef||[],_0x28f87c=0x1,_0x7d4d1b='';if(!error[_0x2767e0]){_0x2767e0='E_AGI_UNDEFINED';}_0x4cf3ef['push'](error[_0x2767e0]);while(arguments[_0x28f87c]){_0x4cf3ef[_0x7625('0xc')](arguments[_0x28f87c]);_0x28f87c++;}_0x7d4d1b=util['format'][_0x7625('0xd')](util,_0x4cf3ef);this[_0x7625('0xe')]=_0x7d4d1b;this[_0x7625('0xf')]=_0x2767e0;}module[_0x7625('0x10')]=AGIError; \ No newline at end of file +var _0x655f=['push','format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x557886,_0x525a5e){var _0x3026ba=function(_0x212587){while(--_0x212587){_0x557886['push'](_0x557886['shift']());}};_0x3026ba(++_0x525a5e);}(_0x655f,0x159));var _0xf655=function(_0x3a7cd9,_0x2efead){_0x3a7cd9=_0x3a7cd9-0x0;var _0x3abab5=_0x655f[_0x3a7cd9];return _0x3abab5;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xf655('0x0'),'E_AGI_ARGUMENT_PORT':_0xf655('0x1'),'E_AGI_SERVER_ERROR':_0xf655('0x2'),'E_AGI_SERVER_CLOSE':_0xf655('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xf655('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xf655('0x5'),'E_AGI_SOCKET_ERROR':_0xf655('0x6'),'E_AGI_SOCKET_CLOSE':_0xf655('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xf655('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf655('0x9'),'E_AGI_IVR_ENTRY':_0xf655('0xa')};function AGIError(_0x55e2bc){var _0x55e2bc=_0x55e2bc||null,_0x3f8a97=_0x3f8a97||[],_0x209a0e=0x1,_0x18bb24='';if(!error[_0x55e2bc]){_0x55e2bc=_0xf655('0xb');}_0x3f8a97[_0xf655('0xc')](error[_0x55e2bc]);while(arguments[_0x209a0e]){_0x3f8a97['push'](arguments[_0x209a0e]);_0x209a0e++;}_0x18bb24=util[_0xf655('0xd')]['apply'](util,_0x3f8a97);this[_0xf655('0xe')]=_0x18bb24;this[_0xf655('0xf')]=_0x55e2bc;}module[_0xf655('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c439ecd..6c0220e 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 _0x80f3=['agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','lodash','events','EventEmitter','./error','../../config/environment','redis','defaults','localhost'];(function(_0x20ac0b,_0x32cdeb){var _0x270f78=function(_0x442d82){while(--_0x442d82){_0x20ac0b['push'](_0x20ac0b['shift']());}};_0x270f78(++_0x32cdeb);}(_0x80f3,0x88));var _0x380f=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0x80f3[_0x397bfb];return _0x16c9b9;};'use strict';var _=require(_0x380f('0x0'));var EventEmitter=require(_0x380f('0x1'))[_0x380f('0x2')];var Redis=require('ioredis');var AGIError=require(_0x380f('0x3'));var config=require(_0x380f('0x4'));config[_0x380f('0x5')]=_[_0x380f('0x6')](config[_0x380f('0x5')],{'host':_0x380f('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x380f('0x5')]);sub['subscribe'](_0x380f('0x8'),function(_0x2b2e00){if(_0x2b2e00)return eventEmitter[_0x380f('0x9')]('error',new AGIError(_0x380f('0xa'),_0x2b2e00));});sub['on'](_0x380f('0xb'),function(_0x485e6d,_0x244fa4){if(_0x485e6d!=='agi')return;try{var _0x4dee43=JSON[_0x380f('0xc')](_0x244fa4);eventEmitter['emit'](_0x380f('0xd'),_0x4dee43);}catch(_0x47a8d1){eventEmitter[_0x380f('0x9')](_0x380f('0xe'),new AGIError(_0x380f('0xa'),_0x47a8d1));}});module[_0x380f('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x25ad=['message','projectUpdate','error','exports','lodash','ioredis','./error','redis','localhost','subscribe','agi','emit'];(function(_0x7ee493,_0x2cc2cb){var _0x1f2c25=function(_0x243745){while(--_0x243745){_0x7ee493['push'](_0x7ee493['shift']());}};_0x1f2c25(++_0x2cc2cb);}(_0x25ad,0x1c0));var _0xd25a=function(_0x341569,_0x1edec3){_0x341569=_0x341569-0x0;var _0x2cb5c7=_0x25ad[_0x341569];return _0x2cb5c7;};'use strict';var _=require(_0xd25a('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0xd25a('0x1'));var AGIError=require(_0xd25a('0x2'));var config=require('../../config/environment');config[_0xd25a('0x3')]=_['defaults'](config[_0xd25a('0x3')],{'host':_0xd25a('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xd25a('0x3')]);sub[_0xd25a('0x5')](_0xd25a('0x6'),function(_0x559906){if(_0x559906)return eventEmitter[_0xd25a('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x559906));});sub['on'](_0xd25a('0x8'),function(_0x1c0a0a,_0x1efc66){if(_0x1c0a0a!==_0xd25a('0x6'))return;try{var _0x90edd2=JSON['parse'](_0x1efc66);eventEmitter[_0xd25a('0x7')](_0xd25a('0x9'),_0x90edd2);}catch(_0x26f51f){eventEmitter[_0xd25a('0x7')](_0xd25a('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x26f51f));}});module[_0xd25a('0xb')]={'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 02ae4a9..d0a2a80 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 _0xb40d=['traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','menu','getdigits','getsecretdigits','edges','prototype','addVertex','vertices','addEdge','push','size','relations','numberOfEdges','no\x20vertex\x20found','info','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xb40d,0xc8));var _0xdb40=function(_0xb1617f,_0x2cc452){_0xb1617f=_0xb1617f-0x0;var _0x388ac2=_0xb40d[_0xb1617f];return _0x388ac2;};'use strict';var _=require(_0xdb40('0x0'));var logger=require(_0xdb40('0x1'))('agi');var verticesWithRetry=[_0xdb40('0x2'),_0xdb40('0x3'),_0xdb40('0x4')];var Graph=function(){this['vertices']={};this[_0xdb40('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0xdb40('0x6')][_0xdb40('0x7')]=function(_0x54aa52){this[_0xdb40('0x8')][_0x54aa52['id']]=_0x54aa52;this[_0xdb40('0x5')][_0x54aa52['id']]=[];};Graph[_0xdb40('0x6')][_0xdb40('0x9')]=function(_0x281f34,_0x66e4e7,_0x421066){this['edges'][_0x281f34][_0xdb40('0xa')]({'target':_0x66e4e7,'condition':_0x421066});this['numberOfEdges']+=0x1;};Graph[_0xdb40('0x6')]['size']=function(){return _[_0xdb40('0xb')](this[_0xdb40('0x8')]);};Graph[_0xdb40('0x6')][_0xdb40('0xc')]=function(){return this[_0xdb40('0xd')];};Graph[_0xdb40('0x6')]['getVertex']=function(_0x124e45){return this[_0xdb40('0x8')][_0x124e45];};Graph[_0xdb40('0x6')]['traverseBFS']=function(_0x21d17a,_0x17d161){if(!this[_0xdb40('0x8')][_0x21d17a]){return logger['info'](_0xdb40('0xe'));}var _0x146767=_0x17d161(this[_0xdb40('0x8')][_0x21d17a]);if(!_0x146767){return logger[_0xdb40('0xf')]('stop\x20traverse');}if(this[_0xdb40('0x5')][_0x21d17a][_0xdb40('0x10')]===0x0){return logger[_0xdb40('0xf')](_0xdb40('0x11'));}for(var _0x29d37c=0x0,_0xa53f57=[],_0x144cad=![];_0x29d37c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','catch','[LICENSE]','finally','./server','listening','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','127.0.0.1','projectUpdate','nextTick'];(function(_0x442751,_0x68b717){var _0x4e56c2=function(_0x3f5a24){while(--_0x3f5a24){_0x442751['push'](_0x442751['shift']());}};_0x4e56c2(++_0x68b717);}(_0x6bfc,0xe8));var _0xc6bf=function(_0x489a05,_0x35bc04){_0x489a05=_0x489a05-0x0;var _0x5df87c=_0x6bfc[_0x489a05];return _0x5df87c;};'use strict';var _=require(_0xc6bf('0x0'));var syncho=require(_0xc6bf('0x1'));var util=require(_0xc6bf('0x2'));var config=require('../../config/environment');var logger=require(_0xc6bf('0x3'))(_0xc6bf('0x4'));var utilLicense=require(_0xc6bf('0x5'));var rpc=require('./rpc');var Project=require(_0xc6bf('0x6'));var AGIEmitter=require(_0xc6bf('0x7'))[_0xc6bf('0x8')];var projects=[];config[_0xc6bf('0x4')]=_['defaults'](config[_0xc6bf('0x4')],{'ip':_0xc6bf('0x9'),'port':0x11dd});AGIEmitter['on'](_0xc6bf('0xa'),projectUpdateHandler);function connectionHandler(_0x5d9766){process[_0xc6bf('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5d9766);agiHandler(_0x5d9766);}catch(_0x2f3fc0){logger[_0xc6bf('0xc')](_0x2f3fc0[_0xc6bf('0xd')]);}});});}function projectUpdateHandler(_0x3e7713){try{var _0x4bf25b=_[_0xc6bf('0xe')](projects,['id',_0x3e7713['id']]);if(_0x4bf25b>-0x1){if(_0x3e7713[_0xc6bf('0xf')]===!![]){projects[_0xc6bf('0x10')](_0x4bf25b,0x1);}else{projects[_0x4bf25b]=_0x3e7713;}}else{projects[_0xc6bf('0x11')](_0x3e7713);}}catch(_0x574c13){logger[_0xc6bf('0xc')](_0x574c13[_0xc6bf('0xd')]);}}function listeningHandler(){console[_0xc6bf('0x12')](_0xc6bf('0x13'),config[_0xc6bf('0x4')][_0xc6bf('0x14')]);logger[_0xc6bf('0x15')](util[_0xc6bf('0x16')](_0xc6bf('0x17'),config[_0xc6bf('0x4')]['ip'],config['agi'][_0xc6bf('0x14')]));}function errorHandler(_0x572856){if(_0x572856&&_0x572856[_0xc6bf('0x18')]&&_0x572856[_0xc6bf('0x19')]){logger['error'](util[_0xc6bf('0x16')](_0xc6bf('0x1a'),_0x572856[_0xc6bf('0x18')],_0x572856[_0xc6bf('0x19')]));}else{logger['error'](util[_0xc6bf('0x16')](_0xc6bf('0x1b'),_0x572856[_0xc6bf('0xd')]));}}function closeHandler(){logger[_0xc6bf('0x15')](util['format'](_0xc6bf('0x1c'),this[_0xc6bf('0x1d')],this[_0xc6bf('0x1e')],this[_0xc6bf('0x1f')],this['dnid'],this[_0xc6bf('0x20')]));try{createSquareReport(this);}catch(_0x9237a4){logger[_0xc6bf('0xc')](_0x9237a4[_0xc6bf('0xd')]);}}function timeoutHandler(){logger[_0xc6bf('0x15')](util[_0xc6bf('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc6bf('0x1d')],this[_0xc6bf('0x1e')],this[_0xc6bf('0x1f')],this[_0xc6bf('0x21')],this['uniqueid']));}function hangupHandler(){logger[_0xc6bf('0x15')](util[_0xc6bf('0x16')](_0xc6bf('0x22'),this[_0xc6bf('0x1d')],this['calleridname'],this[_0xc6bf('0x1f')],this[_0xc6bf('0x21')],this[_0xc6bf('0x20')]));this[_0xc6bf('0x23')]=!![];}function createSquareReport(_0x2d0d5c,_0x16215d){rpc[_0xc6bf('0x24')](_0x2d0d5c)[_0xc6bf('0x25')](function(_0x578350){if(_0x16215d){_0x16215d(null,_0x578350);}})['catch'](function(_0x44a589){if(_0x16215d){_0x16215d(null,_0x44a589);}});}function setChannelVariables(_0xa7d26a){for(var _0x3ff628 in _0xa7d26a){if(_0xa7d26a[_0xc6bf('0x26')](_0x3ff628)){if(_0x3ff628['indexOf'](_0xc6bf('0x27'))===0x0){_0xa7d26a[_0x3ff628[_0xc6bf('0x28')](0x4)]=_0xa7d26a[_0x3ff628];delete _0xa7d26a[_0x3ff628];}}}}function agiHandler(_0x332588){logger[_0xc6bf('0x29')]('variables',JSON[_0xc6bf('0x2a')](_0x332588,null,0x2));logger[_0xc6bf('0x15')](util['format'](_0xc6bf('0x2b'),_0x332588[_0xc6bf('0x1d')],_0x332588[_0xc6bf('0x1e')],_0x332588[_0xc6bf('0x1f')],_0x332588[_0xc6bf('0x21')],_0x332588[_0xc6bf('0x20')]));_0x332588['on'](_0xc6bf('0xc'),errorHandler);_0x332588['on'](_0xc6bf('0x2c'),closeHandler);_0x332588['on'](_0xc6bf('0x2d'),timeoutHandler);_0x332588[_0xc6bf('0x23')]=![];_0x332588['on']('hangup',hangupHandler);var _0x26625e=_[_0xc6bf('0x2e')](projects,['name',_0x332588[_0xc6bf('0x1d')]]);if(!_0x26625e)return Project[_0xc6bf('0x2f')](_0x332588);if(!_0x26625e[_0xc6bf('0x30')])return Project[_0xc6bf('0x31')](_0x332588);return Project[_0xc6bf('0x32')](_0x26625e,_0x332588);}function main(){var _0x412700;return utilLicense['getLicense']()['then'](function(_0x3fcc0c){if(!_0x3fcc0c)return;if(_0x3fcc0c[_0xc6bf('0x33')]){if(_0x3fcc0c[_0xc6bf('0x34')]&&_0x3fcc0c[_0xc6bf('0x34')]>0x0){logger[_0xc6bf('0x15')](util['format'](_0xc6bf('0x35'),_0x3fcc0c[_0xc6bf('0x34')]));_0x412700=_0x3fcc0c[_0xc6bf('0x34')];}else{logger['info'](_0xc6bf('0x36'));}}else{logger[_0xc6bf('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x412700=-0x1;}})[_0xc6bf('0x25')](function(){return Project[_0xc6bf('0x37')]();})[_0xc6bf('0x25')](function(_0x966ee5){projects=_0x966ee5;return;})[_0xc6bf('0x38')](function(_0x5b561b){logger[_0xc6bf('0xc')](_0xc6bf('0x39'),_0x5b561b[_0xc6bf('0xd')]);})[_0xc6bf('0x3a')](function(){var _0x429103=require(_0xc6bf('0x3b'))(config[_0xc6bf('0x4')][_0xc6bf('0x14')],config['agi']['ip'],_0x412700);_0x429103['on'](_0xc6bf('0xc'),errorHandler);_0x429103['on'](_0xc6bf('0x3c'),listeningHandler);_0x429103['on']('connection',connectionHandler);_0x429103['on'](_0xc6bf('0x2c'),closeHandler);});}main(); \ No newline at end of file +var _0x0dbb=['port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','message','[ERROR]\x20%s','arg_1','callerid','dnid','uniqueid','calleridname','evtHangup','createSquareReport','catch','hasOwnProperty','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','production','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','util','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','stack','findIndex','deleted','splice','push','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x2e7f66,_0x4e8c3c){var _0x1d88db=function(_0x30f0cf){while(--_0x30f0cf){_0x2e7f66['push'](_0x2e7f66['shift']());}};_0x1d88db(++_0x4e8c3c);}(_0x0dbb,0x135));var _0xb0db=function(_0x3671e9,_0x983780){_0x3671e9=_0x3671e9-0x0;var _0x444ba1=_0x0dbb[_0x3671e9];return _0x444ba1;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0xb0db('0x0'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xb0db('0x1'));var utilLicense=require(_0xb0db('0x2'));var rpc=require(_0xb0db('0x3'));var Project=require(_0xb0db('0x4'));var AGIEmitter=require(_0xb0db('0x5'))[_0xb0db('0x6')];var projects=[];config['agi']=_[_0xb0db('0x7')](config[_0xb0db('0x1')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x27cd10){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x27cd10);agiHandler(_0x27cd10);}catch(_0x25be9e){logger['error'](_0x25be9e[_0xb0db('0x8')]);}});});}function projectUpdateHandler(_0x344a09){try{var _0x5e03b9=_[_0xb0db('0x9')](projects,['id',_0x344a09['id']]);if(_0x5e03b9>-0x1){if(_0x344a09[_0xb0db('0xa')]===!![]){projects[_0xb0db('0xb')](_0x5e03b9,0x1);}else{projects[_0x5e03b9]=_0x344a09;}}else{projects[_0xb0db('0xc')](_0x344a09);}}catch(_0x4d9fc2){logger[_0xb0db('0xd')](_0x4d9fc2[_0xb0db('0x8')]);}}function listeningHandler(){console['log'](_0xb0db('0xe'),config[_0xb0db('0x1')][_0xb0db('0xf')]);logger[_0xb0db('0x10')](util[_0xb0db('0x11')](_0xb0db('0x12'),config[_0xb0db('0x1')]['ip'],config[_0xb0db('0x1')][_0xb0db('0xf')]));}function errorHandler(_0x4f1afe){if(_0x4f1afe&&_0x4f1afe['name']&&_0x4f1afe['message']){logger['error'](util[_0xb0db('0x11')](_0xb0db('0x13'),_0x4f1afe[_0xb0db('0x14')],_0x4f1afe[_0xb0db('0x15')]));}else{logger[_0xb0db('0xd')](util['format'](_0xb0db('0x16'),_0x4f1afe[_0xb0db('0x8')]));}}function closeHandler(){logger['info'](util[_0xb0db('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb0db('0x17')],this['calleridname'],this[_0xb0db('0x18')],this[_0xb0db('0x19')],this[_0xb0db('0x1a')]));try{createSquareReport(this);}catch(_0x82b6c7){logger['error'](_0x82b6c7[_0xb0db('0x8')]);}}function timeoutHandler(){logger[_0xb0db('0x10')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb0db('0x17')],this[_0xb0db('0x1b')],this[_0xb0db('0x18')],this[_0xb0db('0x19')],this[_0xb0db('0x1a')]));}function hangupHandler(){logger[_0xb0db('0x10')](util[_0xb0db('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xb0db('0x1b')],this[_0xb0db('0x18')],this[_0xb0db('0x19')],this['uniqueid']));this[_0xb0db('0x1c')]=!![];}function createSquareReport(_0x3496b0,_0x35d4e8){rpc[_0xb0db('0x1d')](_0x3496b0)['then'](function(_0xda23c0){if(_0x35d4e8){_0x35d4e8(null,_0xda23c0);}})[_0xb0db('0x1e')](function(_0x10a68d){if(_0x35d4e8){_0x35d4e8(null,_0x10a68d);}});}function setChannelVariables(_0x31fe63){for(var _0x1b7bdf in _0x31fe63){if(_0x31fe63[_0xb0db('0x1f')](_0x1b7bdf)){if(_0x1b7bdf['indexOf']('agi_')===0x0){_0x31fe63[_0x1b7bdf[_0xb0db('0x20')](0x4)]=_0x31fe63[_0x1b7bdf];delete _0x31fe63[_0x1b7bdf];}}}}function agiHandler(_0x2615a6){logger[_0xb0db('0x21')](_0xb0db('0x22'),JSON[_0xb0db('0x23')](_0x2615a6,null,0x2));logger[_0xb0db('0x10')](util[_0xb0db('0x11')](_0xb0db('0x24'),_0x2615a6[_0xb0db('0x17')],_0x2615a6[_0xb0db('0x1b')],_0x2615a6[_0xb0db('0x18')],_0x2615a6['dnid'],_0x2615a6['uniqueid']));_0x2615a6['on'](_0xb0db('0xd'),errorHandler);_0x2615a6['on'](_0xb0db('0x25'),closeHandler);_0x2615a6['on']('timeout',timeoutHandler);_0x2615a6[_0xb0db('0x1c')]=![];_0x2615a6['on'](_0xb0db('0x26'),hangupHandler);var _0x92fd6=_[_0xb0db('0x27')](projects,['name',_0x2615a6[_0xb0db('0x17')]]);if(!_0x92fd6)return Project['handleNotFound'](_0x2615a6);if(!_0x92fd6[_0xb0db('0x28')])return Project[_0xb0db('0x29')](_0x2615a6);return Project[_0xb0db('0x2a')](_0x92fd6,_0x2615a6);}function main(){var _0x57cfe1;return utilLicense['getLicense']()[_0xb0db('0x2b')](function(_0x5eda04){if(!_0x5eda04)return;if(_0x5eda04[_0xb0db('0x2c')]){if(_0x5eda04[_0xb0db('0x2d')]&&_0x5eda04[_0xb0db('0x2d')]>0x0){logger[_0xb0db('0x10')](util[_0xb0db('0x11')](_0xb0db('0x2e'),_0x5eda04['callysquare']));_0x57cfe1=_0x5eda04[_0xb0db('0x2d')];}else{logger[_0xb0db('0x10')](_0xb0db('0x2f'));}}else{logger['info'](_0xb0db('0x30'));_0x57cfe1=-0x1;}})[_0xb0db('0x2b')](function(){return Project[_0xb0db('0x31')]();})[_0xb0db('0x2b')](function(_0x2be641){projects=_0x2be641;return;})[_0xb0db('0x1e')](function(_0x24680c){logger['error'](_0xb0db('0x32'),_0x24680c['stack']);})[_0xb0db('0x33')](function(){var _0x6a7ee5=require(_0xb0db('0x34'))(config[_0xb0db('0x1')][_0xb0db('0xf')],config[_0xb0db('0x1')]['ip'],_0x57cfe1);_0x6a7ee5['on'](_0xb0db('0xd'),errorHandler);_0x6a7ee5['on'](_0xb0db('0x35'),listeningHandler);_0x6a7ee5['on']('connection',connectionHandler);_0x6a7ee5['on'](_0xb0db('0x25'),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 b2defaf..73c1ca3 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 _0xc6b1=['request','then','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','http'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0xc6b1,0xf7));var _0x1c6b=function(_0x10bdbb,_0x5e8c6e){_0x10bdbb=_0x10bdbb-0x0;var _0x58d6de=_0xc6b1[_0x10bdbb];return _0x58d6de;};'use strict';var BPromise=require(_0x1c6b('0x0'));var jayson=require(_0x1c6b('0x1'));var client=jayson['client'][_0x1c6b('0x2')]({'port':0x232b});function request(_0x454c65,_0x9c344d){return new BPromise(function(_0x3ce788,_0x66d21d){return client[_0x1c6b('0x3')](_0x454c65,_0x9c344d)[_0x1c6b('0x4')](function(_0x2350e4){if(_0x2350e4[_0x1c6b('0x5')]){return _0x66d21d(_0x2350e4[_0x1c6b('0x5')][_0x1c6b('0x6')]);}else{return _0x3ce788(_0x2350e4[_0x1c6b('0x7')]);}})[_0x1c6b('0x8')](function(_0x4d7506){return _0x66d21d(_0x4d7506);});});}exports[_0x1c6b('0x9')]=function(_0x1f1b60,_0x2bcc1e){return request('SendMail',{'account':_0x1f1b60,'message':_0x2bcc1e});}; \ No newline at end of file +var _0x2c27=['result','catch','SendMail','bluebird','client','request','then','error','message'];(function(_0x1abcdd,_0x2b6aa7){var _0x454f66=function(_0x4744bc){while(--_0x4744bc){_0x1abcdd['push'](_0x1abcdd['shift']());}};_0x454f66(++_0x2b6aa7);}(_0x2c27,0x8a));var _0x72c2=function(_0x44b0cb,_0x681421){_0x44b0cb=_0x44b0cb-0x0;var _0x81525f=_0x2c27[_0x44b0cb];return _0x81525f;};'use strict';var BPromise=require(_0x72c2('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x72c2('0x1')]['http']({'port':0x232b});function request(_0x4d8f5e,_0x5dd5d8){return new BPromise(function(_0x2b3977,_0x5617f1){return client[_0x72c2('0x2')](_0x4d8f5e,_0x5dd5d8)[_0x72c2('0x3')](function(_0x2dba79){if(_0x2dba79[_0x72c2('0x4')]){return _0x5617f1(_0x2dba79[_0x72c2('0x4')][_0x72c2('0x5')]);}else{return _0x2b3977(_0x2dba79[_0x72c2('0x6')]);}})[_0x72c2('0x7')](function(_0x106650){return _0x5617f1(_0x106650);});});}exports['sendMailMessage']=function(_0x4cca2e,_0x25953b){return request(_0x72c2('0x8'),{'account':_0x4cca2e,'message':_0x25953b});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 21e9090..6dad244 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 _0xa83f=['Project\x20%s\x20not\x20found','exports','moment','xml2json','util','agi','./rpc','./graph','./vertices','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','inspect','production','start','stringify','joinAt','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','callerid','dnid','traverseBFS','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','debug','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xa83f,0x176));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xfa83('0x0'));var parser=require(_0xfa83('0x1'));var util=require(_0xfa83('0x2'));var logger=require('../../config/logger')(_0xfa83('0x3'));var rpc=require(_0xfa83('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0xfa83('0x5'));var Vertices=require(_0xfa83('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x3bc165){logger['error'](_0xfa83('0x7'),_0x3bc165[_0xfa83('0x8')]);return[];});}function addVertex(_0x246de7,_0x35cb82,_0x1977fc){_0x35cb82[_0xfa83('0x9')]=_0x1977fc;if(_0x35cb82[_0xfa83('0xa')]('retry')){_0x35cb82['maxRetry']=parseInt(_0x35cb82[_0xfa83('0xb')],0xa);}_0x246de7[_0xfa83('0xc')](_[_0xfa83('0xd')](_0x35cb82,'mxCell'));}function initGraph(_0x50cec9,_0x7eda3a){var _0x416243=new Graph();for(var _0x782277 in _0x50cec9){if(_0x50cec9[_0xfa83('0xa')](_0x782277)){if(_[_0xfa83('0xe')](_0x50cec9[_0x782277])){for(var _0x39fd7c=0x0;_0x39fd7c<_0x50cec9[_0x782277][_0xfa83('0xf')];_0x39fd7c+=0x1){addVertex(_0x416243,_0x50cec9[_0x782277][_0x39fd7c],_0x782277);}}else{addVertex(_0x416243,_0x50cec9[_0x782277],_0x782277);}}}for(var _0x4876ce=0x0;_0x4876ce<_0x7eda3a[_0xfa83('0xf')];_0x4876ce+=0x1){if(_0x7eda3a[_0x4876ce][_0xfa83('0x10')]&&_0x7eda3a[_0x4876ce]['target']){_0x416243[_0xfa83('0x11')](_0x7eda3a[_0x4876ce][_0xfa83('0x10')],_0x7eda3a[_0x4876ce][_0xfa83('0x12')],_0x7eda3a[_0x4876ce]['value']);}}return _0x416243;}function getRoot(_0x7bfd96){return parser[_0xfa83('0x13')](_0x7bfd96,{'object':!![]})[_0xfa83('0x14')][_0xfa83('0x15')];}function inspect(_0x4396ac){return util[_0xfa83('0x16')](_0x4396ac,{'showHidden':![],'depth':null});}function initialize(_0xef7867,_0xca1a57){var _0x5010c4=getRoot(_0xef7867[_0xfa83('0x17')]);if(!_0x5010c4||!_0x5010c4[_0xfa83('0x18')])return;var _0x309b56,_0xb830b6,_0x3d88ac;logger['debug']('root',JSON[_0xfa83('0x19')](_0x5010c4,null,0x2));_0xca1a57[_0xfa83('0x1a')]=moment()[_0xfa83('0x1b')](_0xfa83('0x1c'));_0x309b56=initGraph(_[_0xfa83('0xd')](_0x5010c4,_0xfa83('0x1d')),_0x5010c4[_0xfa83('0x1d')]);_0xb830b6=new Vertices(_0xca1a57,rpc,mailRpc);logger['info'](util[_0xfa83('0x1b')](_0xfa83('0x1e'),_0xca1a57[_0xfa83('0x1f')],_0xca1a57[_0xfa83('0x20')],_0xca1a57[_0xfa83('0x21')],_0xca1a57[_0xfa83('0x22')],_0xca1a57['uniqueid']));_0x309b56[_0xfa83('0x23')](_0x5010c4['start']['id'],function(_0x2c9705){try{_0x2c9705=_0xb830b6[_0xfa83('0x24')](_0x2c9705);logger['debug'](_0xfa83('0x25'),JSON[_0xfa83('0x19')](_0x2c9705,null,0x2));if(_0x2c9705['agicommand']===_0xfa83('0x26')){logger[_0xfa83('0x27')](_0xfa83('0x28'));_0xca1a57[_0xfa83('0x29')]=_0x2c9705[_0xfa83('0x29')]||_0xca1a57[_0xfa83('0x29')];_0xca1a57[_0xfa83('0x2a')]=_0x2c9705['extension'];_0xca1a57['priority']=_0x2c9705[_0xfa83('0x2b')]?_0x2c9705[_0xfa83('0x2b')]-0x1:0x1;return null;}else if(_0x2c9705&&_0xb830b6[_0x2c9705[_0xfa83('0x9')]]){_0x3d88ac=_0xb830b6[_0x2c9705[_0xfa83('0x9')]](_0x2c9705);logger[_0xfa83('0x27')](_0xfa83('0x2c'),JSON['stringify'](_0x3d88ac,null,0x2));if(_0x3d88ac&&_0x3d88ac[_0xfa83('0x2d')]===AGI_CODE_SUCCESS&&_0x3d88ac[_0xfa83('0x2e')]!==AGI_RESULT_ERROR&&!_0xca1a57[_0xfa83('0x2f')]){logger['debug'](_0xfa83('0x2c'),inspect(_0x3d88ac));return _[_0xfa83('0x30')](_0x3d88ac[_0xfa83('0x2e')])?null:_0x3d88ac[_0xfa83('0x2e')][_0xfa83('0x31')]();}else{logger[_0xfa83('0x32')](_0xfa83('0x2c'),inspect(_0x3d88ac));return null;}}else{logger[_0xfa83('0x32')](_0xfa83('0x33'));return null;}}catch(_0x20a951){logger[_0xfa83('0x32')](_0x20a951[_0xfa83('0x8')]);return null;}});if(_0x5010c4['finally']){logger[_0xfa83('0x27')](util[_0xfa83('0x1b')](_0xfa83('0x34'),_0xca1a57[_0xfa83('0x1f')],_0xca1a57[_0xfa83('0x20')],_0xca1a57[_0xfa83('0x21')],_0xca1a57[_0xfa83('0x22')],_0xca1a57['uniqueid']));_0x309b56[_0xfa83('0x23')](_0x5010c4[_0xfa83('0x35')]['id'],function(_0xeb9430){try{_0xeb9430=_0xb830b6[_0xfa83('0x24')](_0xeb9430);logger[_0xfa83('0x36')](_0xfa83('0x25'),JSON['stringify'](_0xeb9430,null,0x2));if(_0xeb9430&&_0xb830b6[_0xeb9430[_0xfa83('0x9')]]){_0x3d88ac=_0xb830b6[_0xeb9430[_0xfa83('0x9')]](_0xeb9430);if(_0x3d88ac){logger['debug']('response',inspect(_0x3d88ac));return _[_0xfa83('0x30')](_0x3d88ac[_0xfa83('0x2e')])?null:_0x3d88ac['result']['toString']();}else{logger[_0xfa83('0x32')](_0xfa83('0x2c'),inspect(_0x3d88ac));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x3b3146){logger[_0xfa83('0x32')](_0x3b3146['stack']);return null;}});}logger['info'](util[_0xfa83('0x1b')](_0xfa83('0x37'),_0xca1a57[_0xfa83('0x1f')],_0xca1a57['calleridname'],_0xca1a57[_0xfa83('0x21')],_0xca1a57['dnid'],_0xca1a57[_0xfa83('0x38')]));logger[_0xfa83('0x27')](util[_0xfa83('0x1b')](_0xfa83('0x39'),_0xca1a57[_0xfa83('0x29')],_0xca1a57[_0xfa83('0x2a')],parseInt(_0xca1a57[_0xfa83('0x2b')],0xa)+0x1));_0xca1a57[_0xfa83('0x3a')](_0xca1a57[_0xfa83('0x29')],_0xca1a57[_0xfa83('0x2a')],parseInt(_0xca1a57[_0xfa83('0x2b')],0xa)+0x1);_0xca1a57[_0xfa83('0x3b')]();}function handleNotFound(_0x45d35f){logger[_0xfa83('0x32')](util[_0xfa83('0x1b')](_0xfa83('0x3c'),_0x45d35f[_0xfa83('0x1f')]));_0x45d35f['continueAt'](_0x45d35f[_0xfa83('0x29')],_0x45d35f['extension'],parseInt(_0x45d35f[_0xfa83('0x2b')],0xa)+0x1);_0x45d35f['close']();}function handleUnpublished(_0x438e42){logger[_0xfa83('0x32')](util['format']('Project\x20%s\x20not\x20published',_0x438e42[_0xfa83('0x1f')]));_0x438e42[_0xfa83('0x3a')](_0x438e42['context'],_0x438e42[_0xfa83('0x2a')],parseInt(_0x438e42[_0xfa83('0x2b')],0xa)+0x1);_0x438e42[_0xfa83('0x3b')]();}module[_0xfa83('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x50d8=['toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','extension','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','agi','./graph','./vertices','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','root','inspect','production','start','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','code','result','response','isUndefined'];(function(_0x2c6ffd,_0x41ee11){var _0x2a9e39=function(_0x41d2f8){while(--_0x41d2f8){_0x2c6ffd['push'](_0x2c6ffd['shift']());}};_0x2a9e39(++_0x41ee11);}(_0x50d8,0x174));var _0x850d=function(_0xe33819,_0x432fb9){_0xe33819=_0xe33819-0x0;var _0x5e9ab2=_0x50d8[_0xe33819];return _0x5e9ab2;};'use strict';var _=require(_0x850d('0x0'));var moment=require(_0x850d('0x1'));var parser=require(_0x850d('0x2'));var util=require(_0x850d('0x3'));var logger=require('../../config/logger')(_0x850d('0x4'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x850d('0x5'));var Vertices=require(_0x850d('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x2bfa35){logger['error'](_0x850d('0x7'),_0x2bfa35[_0x850d('0x8')]);return[];});}function addVertex(_0x5a2a27,_0x5e6b39,_0x49ca8a){_0x5e6b39[_0x850d('0x9')]=_0x49ca8a;if(_0x5e6b39[_0x850d('0xa')](_0x850d('0xb'))){_0x5e6b39[_0x850d('0xc')]=parseInt(_0x5e6b39[_0x850d('0xb')],0xa);}_0x5a2a27[_0x850d('0xd')](_[_0x850d('0xe')](_0x5e6b39,_0x850d('0xf')));}function initGraph(_0x1b5447,_0x481359){var _0x2d3329=new Graph();for(var _0x359f14 in _0x1b5447){if(_0x1b5447['hasOwnProperty'](_0x359f14)){if(_[_0x850d('0x10')](_0x1b5447[_0x359f14])){for(var _0x55420c=0x0;_0x55420c<_0x1b5447[_0x359f14][_0x850d('0x11')];_0x55420c+=0x1){addVertex(_0x2d3329,_0x1b5447[_0x359f14][_0x55420c],_0x359f14);}}else{addVertex(_0x2d3329,_0x1b5447[_0x359f14],_0x359f14);}}}for(var _0x3eb6df=0x0;_0x3eb6df<_0x481359[_0x850d('0x11')];_0x3eb6df+=0x1){if(_0x481359[_0x3eb6df][_0x850d('0x12')]&&_0x481359[_0x3eb6df][_0x850d('0x13')]){_0x2d3329[_0x850d('0x14')](_0x481359[_0x3eb6df][_0x850d('0x12')],_0x481359[_0x3eb6df][_0x850d('0x13')],_0x481359[_0x3eb6df][_0x850d('0x15')]);}}return _0x2d3329;}function getRoot(_0x23dbd0){return parser[_0x850d('0x16')](_0x23dbd0,{'object':!![]})['mxGraphModel'][_0x850d('0x17')];}function inspect(_0x468f7d){return util[_0x850d('0x18')](_0x468f7d,{'showHidden':![],'depth':null});}function initialize(_0x1a57fa,_0x2b4ea9){var _0x3516ae=getRoot(_0x1a57fa[_0x850d('0x19')]);if(!_0x3516ae||!_0x3516ae[_0x850d('0x1a')])return;var _0x5de8b9,_0x2e97c0,_0x5319d2;logger['debug']('root',JSON[_0x850d('0x1b')](_0x3516ae,null,0x2));_0x2b4ea9[_0x850d('0x1c')]=moment()[_0x850d('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5de8b9=initGraph(_[_0x850d('0xe')](_0x3516ae,'mxCell'),_0x3516ae[_0x850d('0xf')]);_0x2e97c0=new Vertices(_0x2b4ea9,rpc,mailRpc);logger[_0x850d('0x1e')](util[_0x850d('0x1d')](_0x850d('0x1f'),_0x2b4ea9[_0x850d('0x20')],_0x2b4ea9[_0x850d('0x21')],_0x2b4ea9[_0x850d('0x22')],_0x2b4ea9[_0x850d('0x23')],_0x2b4ea9[_0x850d('0x24')]));_0x5de8b9[_0x850d('0x25')](_0x3516ae[_0x850d('0x1a')]['id'],function(_0x544132){try{_0x544132=_0x2e97c0[_0x850d('0x26')](_0x544132);logger[_0x850d('0x27')](_0x850d('0x28'),JSON[_0x850d('0x1b')](_0x544132,null,0x2));if(_0x544132[_0x850d('0x9')]==='gotoc'){logger[_0x850d('0x1e')](_0x850d('0x29'));_0x2b4ea9['context']=_0x544132['context']||_0x2b4ea9[_0x850d('0x2a')];_0x2b4ea9['extension']=_0x544132['extension'];_0x2b4ea9[_0x850d('0x2b')]=_0x544132[_0x850d('0x2b')]?_0x544132[_0x850d('0x2b')]-0x1:0x1;return null;}else if(_0x544132&&_0x2e97c0[_0x544132[_0x850d('0x9')]]){_0x5319d2=_0x2e97c0[_0x544132[_0x850d('0x9')]](_0x544132);logger[_0x850d('0x1e')]('response',JSON[_0x850d('0x1b')](_0x5319d2,null,0x2));if(_0x5319d2&&_0x5319d2[_0x850d('0x2c')]===AGI_CODE_SUCCESS&&_0x5319d2[_0x850d('0x2d')]!==AGI_RESULT_ERROR&&!_0x2b4ea9['evtHangup']){logger[_0x850d('0x27')](_0x850d('0x2e'),inspect(_0x5319d2));return _[_0x850d('0x2f')](_0x5319d2[_0x850d('0x2d')])?null:_0x5319d2[_0x850d('0x2d')][_0x850d('0x30')]();}else{logger[_0x850d('0x31')](_0x850d('0x2e'),inspect(_0x5319d2));return null;}}else{logger['error'](_0x850d('0x32'));return null;}}catch(_0x26b244){logger[_0x850d('0x31')](_0x26b244[_0x850d('0x8')]);return null;}});if(_0x3516ae[_0x850d('0x33')]){logger['info'](util[_0x850d('0x1d')](_0x850d('0x34'),_0x2b4ea9[_0x850d('0x20')],_0x2b4ea9[_0x850d('0x21')],_0x2b4ea9['callerid'],_0x2b4ea9[_0x850d('0x23')],_0x2b4ea9['uniqueid']));_0x5de8b9[_0x850d('0x25')](_0x3516ae[_0x850d('0x33')]['id'],function(_0x5f409f){try{_0x5f409f=_0x2e97c0[_0x850d('0x26')](_0x5f409f);logger['debug'](_0x850d('0x28'),JSON[_0x850d('0x1b')](_0x5f409f,null,0x2));if(_0x5f409f&&_0x2e97c0[_0x5f409f['agicommand']]){_0x5319d2=_0x2e97c0[_0x5f409f[_0x850d('0x9')]](_0x5f409f);if(_0x5319d2){logger['debug'](_0x850d('0x2e'),inspect(_0x5319d2));return _[_0x850d('0x2f')](_0x5319d2[_0x850d('0x2d')])?null:_0x5319d2[_0x850d('0x2d')][_0x850d('0x30')]();}else{logger[_0x850d('0x31')](_0x850d('0x2e'),inspect(_0x5319d2));return null;}}else{logger[_0x850d('0x31')](_0x850d('0x32'));return null;}}catch(_0x3cc83a){logger[_0x850d('0x31')](_0x3cc83a[_0x850d('0x8')]);return null;}});}logger[_0x850d('0x1e')](util['format'](_0x850d('0x35'),_0x2b4ea9['arg_1'],_0x2b4ea9[_0x850d('0x21')],_0x2b4ea9[_0x850d('0x22')],_0x2b4ea9['dnid'],_0x2b4ea9[_0x850d('0x24')]));logger[_0x850d('0x1e')](util[_0x850d('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2b4ea9[_0x850d('0x2a')],_0x2b4ea9[_0x850d('0x36')],parseInt(_0x2b4ea9[_0x850d('0x2b')],0xa)+0x1));_0x2b4ea9[_0x850d('0x37')](_0x2b4ea9[_0x850d('0x2a')],_0x2b4ea9[_0x850d('0x36')],parseInt(_0x2b4ea9[_0x850d('0x2b')],0xa)+0x1);_0x2b4ea9[_0x850d('0x38')]();}function handleNotFound(_0x185e11){logger[_0x850d('0x31')](util[_0x850d('0x1d')](_0x850d('0x39'),_0x185e11[_0x850d('0x20')]));_0x185e11['continueAt'](_0x185e11['context'],_0x185e11[_0x850d('0x36')],parseInt(_0x185e11[_0x850d('0x2b')],0xa)+0x1);_0x185e11['close']();}function handleUnpublished(_0x433aa4){logger['error'](util['format'](_0x850d('0x3a'),_0x433aa4[_0x850d('0x20')]));_0x433aa4[_0x850d('0x37')](_0x433aa4[_0x850d('0x2a')],_0x433aa4['extension'],parseInt(_0x433aa4['priority'],0xa)+0x1);_0x433aa4['close']();}module[_0x850d('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 7f52906..599cd53 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 _0xa737=['Transform','call','_localBuffer','inherits','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','trim','emit','headers','exports','util','stream'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xa737,0x154));var _0x7a73=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xa737[_0x50e593];return _0x3821d0;};'use strict';var util=require(_0x7a73('0x0'));var Transform=require(_0x7a73('0x1'))[_0x7a73('0x2')];function AGIReply(_0x20e793){Transform[_0x7a73('0x3')](this,_0x20e793);this[_0x7a73('0x4')]='';this['_inBody']=![];}util[_0x7a73('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x7a73('0x6')]=function(_0x41d75b,_0xcc38d1,_0x2c119f){var _0x242609='\x0a',_0xcffeb9=['\x0a\x0a',_0x7a73('0x7')],_0x5d66f4=-0x1,_0x186e8b=-0x1,_0x5d9bff='',_0x45afe4=0x0,_0x1cac79='',_0x184169='';this['_localBuffer']+=_0x41d75b[_0x7a73('0x8')]();_0x1cac79=this[_0x7a73('0x4')];if(!this[_0x7a73('0x9')]){_0x45afe4=0x0;while(_0xcffeb9[_0x45afe4]){while((_0x186e8b=_0x1cac79[_0x7a73('0xa')](_0xcffeb9[_0x45afe4]))!=-0x1){_0x5d9bff=_0xcffeb9[_0x45afe4];_0x184169=_0x1cac79[_0x7a73('0xb')](0x0,_0x186e8b);_0x1cac79=_0x1cac79[_0x7a73('0xb')](_0x186e8b+_0x5d9bff[_0x7a73('0xc')]);var _0x236f3c=_0x184169[_0x7a73('0xd')](_0x242609),_0x297a8f=0x0,_0x2fe021={},_0x504d06='',_0x1a33ac='',_0x5054f0=-0x1;while(_0x236f3c[_0x297a8f]){_0x5054f0=_0x236f3c[_0x297a8f][_0x7a73('0xa')](':');if(_0x5054f0!=-0x1){_0x504d06=_0x236f3c[_0x297a8f][_0x7a73('0xe')](0x0,_0x5054f0)[_0x7a73('0xf')]();_0x1a33ac=_0x236f3c[_0x297a8f]['slice'](_0x5054f0+0x1)[_0x7a73('0xf')]();if(_0x504d06[_0x7a73('0xc')]>0x0){_0x2fe021[_0x504d06]=_0x1a33ac;}}else{}_0x297a8f++;}this[_0x7a73('0x10')](_0x7a73('0x11'),_0x2fe021);this[_0x7a73('0x9')]=!![];}_0x45afe4++;}this[_0x7a73('0x4')]=_0x1cac79;}else{while((_0x5d66f4=_0x1cac79[_0x7a73('0xa')](_0x242609))!=-0x1){_0x184169=_0x1cac79['substring'](0x0,_0x5d66f4);this[_0x7a73('0x10')]('line',_0x184169);_0x1cac79=_0x1cac79[_0x7a73('0xb')](_0x5d66f4+_0x242609['length']);}this[_0x7a73('0x4')]=_0x1cac79;}_0x2c119f();};module[_0x7a73('0x12')]=AGIReply; \ No newline at end of file +var _0x3039=['Transform','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','slice','trim','emit','headers','line','exports','stream'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x3039,0x18b));var _0x9303=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3039[_0x57b54c];return _0x59cc19;};'use strict';var util=require('util');var Transform=require(_0x9303('0x0'))[_0x9303('0x1')];function AGIReply(_0x28c2fc){Transform[_0x9303('0x2')](this,_0x28c2fc);this['_localBuffer']='';this[_0x9303('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x9303('0x4')][_0x9303('0x5')]=function(_0x268661,_0x4aa887,_0x21d1c8){var _0x5b77f3='\x0a',_0x3652a1=['\x0a\x0a',_0x9303('0x6')],_0x1e7771=-0x1,_0x2f5fa3=-0x1,_0x4f67e9='',_0xaf6b2e=0x0,_0x57f85a='',_0xca7362='';this[_0x9303('0x7')]+=_0x268661[_0x9303('0x8')]();_0x57f85a=this[_0x9303('0x7')];if(!this[_0x9303('0x3')]){_0xaf6b2e=0x0;while(_0x3652a1[_0xaf6b2e]){while((_0x2f5fa3=_0x57f85a[_0x9303('0x9')](_0x3652a1[_0xaf6b2e]))!=-0x1){_0x4f67e9=_0x3652a1[_0xaf6b2e];_0xca7362=_0x57f85a[_0x9303('0xa')](0x0,_0x2f5fa3);_0x57f85a=_0x57f85a['substring'](_0x2f5fa3+_0x4f67e9[_0x9303('0xb')]);var _0x525e50=_0xca7362['split'](_0x5b77f3),_0x3bb1c9=0x0,_0x5bbf18={},_0x2f350a='',_0x54a39c='',_0xce0ff2=-0x1;while(_0x525e50[_0x3bb1c9]){_0xce0ff2=_0x525e50[_0x3bb1c9][_0x9303('0x9')](':');if(_0xce0ff2!=-0x1){_0x2f350a=_0x525e50[_0x3bb1c9][_0x9303('0xc')](0x0,_0xce0ff2)[_0x9303('0xd')]();_0x54a39c=_0x525e50[_0x3bb1c9][_0x9303('0xc')](_0xce0ff2+0x1)[_0x9303('0xd')]();if(_0x2f350a[_0x9303('0xb')]>0x0){_0x5bbf18[_0x2f350a]=_0x54a39c;}}else{}_0x3bb1c9++;}this[_0x9303('0xe')](_0x9303('0xf'),_0x5bbf18);this[_0x9303('0x3')]=!![];}_0xaf6b2e++;}this[_0x9303('0x7')]=_0x57f85a;}else{while((_0x1e7771=_0x57f85a[_0x9303('0x9')](_0x5b77f3))!=-0x1){_0xca7362=_0x57f85a[_0x9303('0xa')](0x0,_0x1e7771);this[_0x9303('0xe')](_0x9303('0x10'),_0xca7362);_0x57f85a=_0x57f85a['substring'](_0x1e7771+_0x5b77f3[_0x9303('0xb')]);}this['_localBuffer']=_0x57f85a;}_0x21d1c8();};module[_0x9303('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 83d1f67..1569e83 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 _0xe799=['ShowSound','getIntervalById','Interval','Intervals','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','then','CreateCmContact','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','http','request','error','message','result','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','GetContactByPhone','phone','getTrunkById','getSoundById'];(function(_0x4c1d4c,_0x401209){var _0x12b460=function(_0x3d26c3){while(--_0x3d26c3){_0x4c1d4c['push'](_0x4c1d4c['shift']());}};_0x12b460(++_0x401209);}(_0xe799,0x170));var _0x9e79=function(_0xdc9009,_0x2e0722){_0xdc9009=_0xdc9009-0x0;var _0xa7bb77=_0xe799[_0xdc9009];return _0xa7bb77;};'use strict';var _=require(_0x9e79('0x0'));var moment=require('moment');var jayson=require(_0x9e79('0x1'));var client=jayson['client'][_0x9e79('0x2')]({'port':0x2329});function request(_0x34b481,_0x528d88){return new Promise(function(_0x34a40e,_0x3f0a4f){return client[_0x9e79('0x3')](_0x34b481,_0x528d88)['then'](function(_0x51c2f0){if(_0x51c2f0['error']){return _0x3f0a4f(_0x51c2f0[_0x9e79('0x4')][_0x9e79('0x5')]);}else{return _0x34a40e(_0x51c2f0[_0x9e79('0x6')]);}})['catch'](function(_0x29bb3d){return _0x3f0a4f(_0x29bb3d);});});}exports[_0x9e79('0x7')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x9e79('0x8'),_0x9e79('0x9')]}});};exports[_0x9e79('0xa')]=function(_0x6464d6){return request(_0x9e79('0xb'),{'options':{'raw':![],'where':{'name':_0x6464d6},'attributes':[_0x9e79('0x9')]}});};exports[_0x9e79('0xc')]=function(_0x5d826b){return request(_0x9e79('0xd'),{'options':{'raw':![],'where':{'id':_0x5d826b},'include':[{'model':_0x9e79('0xe'),'as':_0x9e79('0xf'),'include':[{'model':_0x9e79('0x10'),'as':_0x9e79('0x10')}]}],'attributes':['id','name',_0x9e79('0x11')],'smtp':!![]}});};exports[_0x9e79('0x12')]=function(_0x18adcd){return request(_0x9e79('0xb'),{'options':{'where':{'id':_0x18adcd},'attributes':[_0x9e79('0x8')]}});};exports[_0x9e79('0x13')]=function(_0xc939){return request(_0x9e79('0x14'),{'options':{'where':{'id':_0xc939},'attributes':[_0x9e79('0x8')]}});};exports[_0x9e79('0x15')]=function(_0x425a31){return request(_0x9e79('0x16'),{'options':{'where':{'id':_0x425a31},'attributes':['name']}});};exports[_0x9e79('0x17')]=function(_0x591a49){return request(_0x9e79('0x18'),{'options':{'where':{'id':_0x591a49},'attributes':[_0x9e79('0x19')]}});};exports['getUserById']=function(_0x1311cf){return request(_0x9e79('0x1a'),{'options':{'where':{'id':_0x1311cf},'attributes':['name']}});};exports['getContactByPhone']=function(_0x3cd5d7){return request(_0x9e79('0x1b'),{'options':{'where':{'phone':_0x3cd5d7[_0x9e79('0x1c')]},'attributes':['id']}});};exports[_0x9e79('0x1d')]=function(_0x214d0e){return request('ShowTrunk',{'options':{'where':{'id':_0x214d0e},'attributes':[_0x9e79('0x8')]}});};exports[_0x9e79('0x1e')]=function(_0x3664e5){return request(_0x9e79('0x1f'),{'options':{'where':{'id':_0x3664e5},'attributes':['save_name']}});};exports[_0x9e79('0x20')]=function(_0x396a3d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x396a3d},'include':[{'model':_0x9e79('0x21'),'as':_0x9e79('0x22')}]}});};exports['getSmsAccountById']=function(_0x499783){return request('ShowSmsAccount',{'options':{'where':{'id':_0x499783},'attributes':['id','name']}});};exports[_0x9e79('0x23')]=function(_0xa55ae0){return request('CreateSmsMessage',{'body':_0xa55ae0});};exports[_0x9e79('0x24')]=function(_0x22410e){return request(_0x9e79('0x25'),{'body':_0x22410e});};exports[_0x9e79('0x26')]=function(_0x55d42c){return request(_0x9e79('0x27'),{'body':_[_0x9e79('0x28')](_0x55d42c,{'project_name':_0x55d42c['arg_1'],'prev_project_name':_0x55d42c[_0x9e79('0x29')]||'','is_subproject':_0x55d42c[_0x9e79('0x29')]?!![]:![],'leaveAt':moment()['format'](_0x9e79('0x2a'))})});};exports[_0x9e79('0x2b')]=function(_0x2e6fb3){return request(_0x9e79('0x2c'),{'body':_0x2e6fb3});};exports[_0x9e79('0x2d')]=function(_0x348c31){return request('CreateSquareMessage',{'body':_0x348c31});};exports['createCmContact']=function(_0x488e3e){return request(_0x9e79('0x2e'),{'options':{'raw':![],'where':{'phone':_0x488e3e[_0x9e79('0x1c')],'ListId':_0x488e3e[_0x9e79('0x2f')]}}})[_0x9e79('0x30')](function(_0x3fe47b){if(_0x3fe47b){return _0x3fe47b;}return request(_0x9e79('0x31'),{'body':_0x488e3e});});};exports['getPauseById']=function(_0x47b827){return request(_0x9e79('0x32'),{'options':{'where':{'id':_0x47b827},'attributes':[_0x9e79('0x8')]}});};exports['agentLogin']=function(_0x9793cf,_0x131a21){return request('LoginUser',{'body':{'interface':_0x131a21},'options':{'where':_0x9793cf}});};exports[_0x9e79('0x33')]=function(_0x23018a,_0x51a215,_0x56e56d){return request(_0x9e79('0x34'),{'body':{'type':_0x51a215,'uniqueid':_0x56e56d},'options':{'where':_0x23018a}});};exports[_0x9e79('0x35')]=function(_0x4e7faa){return request(_0x9e79('0x36'),{'body':{},'options':{'where':_0x4e7faa}});};exports[_0x9e79('0x37')]=function(_0x2527de){return request(_0x9e79('0x38'),{'body':{},'options':{'where':_0x2527de}});}; \ No newline at end of file +var _0xe700=['http','request','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','lodash','moment','jayson/promise','client'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xe700,0x16a));var _0x0e70=function(_0x5a097b,_0x5e3b5c){_0x5a097b=_0x5a097b-0x0;var _0x207a68=_0xe700[_0x5a097b];return _0x207a68;};'use strict';var _=require(_0x0e70('0x0'));var moment=require(_0x0e70('0x1'));var jayson=require(_0x0e70('0x2'));var client=jayson[_0x0e70('0x3')][_0x0e70('0x4')]({'port':0x2329});function request(_0x48dbb7,_0x203ec7){return new Promise(function(_0x4b5632,_0x20335e){return client[_0x0e70('0x5')](_0x48dbb7,_0x203ec7)['then'](function(_0x5465cc){if(_0x5465cc[_0x0e70('0x6')]){return _0x20335e(_0x5465cc[_0x0e70('0x6')][_0x0e70('0x7')]);}else{return _0x4b5632(_0x5465cc[_0x0e70('0x8')]);}})['catch'](function(_0x33f0c3){return _0x20335e(_0x33f0c3);});});}exports[_0x0e70('0x9')]=function(){return request(_0x0e70('0xa'),{'options':{'raw':![],'attributes':['id',_0x0e70('0xb'),_0x0e70('0xc')]}});};exports[_0x0e70('0xd')]=function(_0x34cac5){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x34cac5},'attributes':[_0x0e70('0xc')]}});};exports[_0x0e70('0xe')]=function(_0x17e9fb){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x17e9fb},'include':[{'model':_0x0e70('0xf'),'as':_0x0e70('0x10'),'include':[{'model':_0x0e70('0x11'),'as':_0x0e70('0x11')}]}],'attributes':['id',_0x0e70('0xb'),_0x0e70('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2a0612){return request(_0x0e70('0x13'),{'options':{'where':{'id':_0x2a0612},'attributes':[_0x0e70('0xb')]}});};exports[_0x0e70('0x14')]=function(_0x429429){return request(_0x0e70('0x15'),{'options':{'where':{'id':_0x429429},'attributes':['name']}});};exports['getVariableById']=function(_0x29403c){return request(_0x0e70('0x16'),{'options':{'where':{'id':_0x29403c},'attributes':[_0x0e70('0xb')]}});};exports['getSquareOdbcById']=function(_0x19e9cf){return request(_0x0e70('0x17'),{'options':{'where':{'id':_0x19e9cf},'attributes':[_0x0e70('0x18')]}});};exports[_0x0e70('0x19')]=function(_0x2470ad){return request(_0x0e70('0x1a'),{'options':{'where':{'id':_0x2470ad},'attributes':['name']}});};exports['getContactByPhone']=function(_0x482ad){return request(_0x0e70('0x1b'),{'options':{'where':{'phone':_0x482ad[_0x0e70('0x1c')]},'attributes':['id']}});};exports[_0x0e70('0x1d')]=function(_0x5b67a7){return request(_0x0e70('0x1e'),{'options':{'where':{'id':_0x5b67a7},'attributes':[_0x0e70('0xb')]}});};exports[_0x0e70('0x1f')]=function(_0x3f050d){return request(_0x0e70('0x20'),{'options':{'where':{'id':_0x3f050d},'attributes':[_0x0e70('0x21')]}});};exports[_0x0e70('0x22')]=function(_0x4b046e){return request(_0x0e70('0x23'),{'options':{'raw':![],'where':{'id':_0x4b046e},'include':[{'model':_0x0e70('0x24'),'as':_0x0e70('0x25')}]}});};exports['getSmsAccountById']=function(_0x21279b){return request('ShowSmsAccount',{'options':{'where':{'id':_0x21279b},'attributes':['id',_0x0e70('0xb')]}});};exports[_0x0e70('0x26')]=function(_0x24624f){return request(_0x0e70('0x27'),{'body':_0x24624f});};exports['createSquareDetailsReport']=function(_0x524ffa){return request(_0x0e70('0x28'),{'body':_0x524ffa});};exports[_0x0e70('0x29')]=function(_0x39e4be){return request(_0x0e70('0x2a'),{'body':_['merge'](_0x39e4be,{'project_name':_0x39e4be[_0x0e70('0x2b')],'prev_project_name':_0x39e4be[_0x0e70('0x2c')]||'','is_subproject':_0x39e4be['arg_2']?!![]:![],'leaveAt':moment()[_0x0e70('0x2d')](_0x0e70('0x2e'))})});};exports['createSquareRecording']=function(_0x492299){return request(_0x0e70('0x2f'),{'body':_0x492299});};exports[_0x0e70('0x30')]=function(_0x168de9){return request(_0x0e70('0x31'),{'body':_0x168de9});};exports[_0x0e70('0x32')]=function(_0x150e45){return request(_0x0e70('0x33'),{'options':{'raw':![],'where':{'phone':_0x150e45['phone'],'ListId':_0x150e45[_0x0e70('0x34')]}}})['then'](function(_0x592074){if(_0x592074){return _0x592074;}return request(_0x0e70('0x35'),{'body':_0x150e45});});};exports[_0x0e70('0x36')]=function(_0x3368d3){return request(_0x0e70('0x37'),{'options':{'where':{'id':_0x3368d3},'attributes':['name']}});};exports[_0x0e70('0x38')]=function(_0x4f30e2,_0x2da0a4){return request('LoginUser',{'body':{'interface':_0x2da0a4},'options':{'where':_0x4f30e2}});};exports[_0x0e70('0x39')]=function(_0x4d84be,_0x8b1164,_0x126553){return request(_0x0e70('0x3a'),{'body':{'type':_0x8b1164,'uniqueid':_0x126553},'options':{'where':_0x4d84be}});};exports[_0x0e70('0x3b')]=function(_0x51a98a){return request('UnpauseUser',{'body':{},'options':{'where':_0x51a98a}});};exports[_0x0e70('0x3c')]=function(_0x260421){return request('LogoutUser',{'body':{},'options':{'where':_0x260421}});}; \ 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 ac087e0..4ed3b38 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 _0x39e6=['./polly','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e6,0x9e));var _0x639e=function(_0x100720,_0x513ac9){_0x100720=_0x100720-0x0;var _0x4b54f9=_0x39e6[_0x100720];return _0x4b54f9;};var polly=require(_0x639e('0x0'));var lex=require('./lex');module[_0x639e('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xad5f=['exports','./polly','./lex'];(function(_0x306481,_0x20527a){var _0x33d816=function(_0x4fee0e){while(--_0x4fee0e){_0x306481['push'](_0x306481['shift']());}};_0x33d816(++_0x20527a);}(_0xad5f,0x1a8));var _0xfad5=function(_0x45bf48,_0x5dd33e){_0x45bf48=_0x45bf48-0x0;var _0x5299a0=_0xad5f[_0x45bf48];return _0x5299a0;};var polly=require(_0xfad5('0x0'));var lex=require(_0xfad5('0x1'));module[_0xfad5('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 188e6ee..5d9137c 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 _0x5c00=['./lib/api','exports'];(function(_0x181ad5,_0x3cf091){var _0x1306f5=function(_0x225b04){while(--_0x225b04){_0x181ad5['push'](_0x181ad5['shift']());}};_0x1306f5(++_0x3cf091);}(_0x5c00,0x17e));var _0x05c0=function(_0x26601e,_0x139a4c){_0x26601e=_0x26601e-0x0;var _0x116282=_0x5c00[_0x26601e];return _0x116282;};'use strict';var lex=require(_0x05c0('0x0'));module[_0x05c0('0x1')]=function(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9){return lex(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ 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 645f95d..1de6a2c 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(_0x35c362,_0x23ba73){var _0x1b58dd=function(_0xfec07c){while(--_0xfec07c){_0x35c362['push'](_0x35c362['shift']());}};_0x1b58dd(++_0x23ba73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x5b4447,_0x4731d7){var _0x4a7de0=function(_0xfc481b){while(--_0xfc481b){_0x5b4447['push'](_0x5b4447['shift']());}};_0x4a7de0(++_0x4731d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 8597319..099d963 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 _0x08e2=['./lib/api'];(function(_0x155bbf,_0x1bca34){var _0x1cb0ac=function(_0x101c7c){while(--_0x101c7c){_0x155bbf['push'](_0x155bbf['shift']());}};_0x1cb0ac(++_0x1bca34);}(_0x08e2,0x18a));var _0x208e=function(_0x3df4a5,_0x4dc16d){_0x3df4a5=_0x3df4a5-0x0;var _0x5261bd=_0x08e2[_0x3df4a5];return _0x5261bd;};'use strict';var polly=require(_0x208e('0x0'));module['exports']=function(_0x3e6461,_0x36a20e,_0x542354,_0x2fc6b5,_0x22228a,_0x5588a7,_0x2a7db9){return polly(_0x3e6461,_0x36a20e,_0x542354,_0x2fc6b5,_0x22228a,_0x5588a7,_0x2a7db9);}; \ No newline at end of file +var _0xaec6=['exports'];(function(_0x15f658,_0x123f17){var _0x5a5cfa=function(_0x21f1a9){while(--_0x21f1a9){_0x15f658['push'](_0x15f658['shift']());}};_0x5a5cfa(++_0x123f17);}(_0xaec6,0x1f4));var _0x6aec=function(_0x5f578c,_0x1ab62f){_0x5f578c=_0x5f578c-0x0;var _0x10a6ea=_0xaec6[_0x5f578c];return _0x10a6ea;};'use strict';var polly=require('./lib/api');module[_0x6aec('0x0')]=function(_0x27000e,_0x4eda9b,_0x2db2be,_0x380b1e,_0x31d17b,_0x56ff37,_0x28dd5e){return polly(_0x27000e,_0x4eda9b,_0x2db2be,_0x380b1e,_0x31d17b,_0x56ff37,_0x28dd5e);}; \ 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 551abc3..c32c812 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 _0x6817=['writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','path','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x390f17,_0x359c7e){var _0x2d4cbd=function(_0x5411dc){while(--_0x5411dc){_0x390f17['push'](_0x390f17['shift']());}};_0x2d4cbd(++_0x359c7e);}(_0x6817,0x176));var _0x7681=function(_0x5da014,_0x5bd574){_0x5da014=_0x5da014-0x0;var _0x5105bb=_0x6817[_0x5da014];return _0x5105bb;};'use strict';var fs=require('fs');var path=require(_0x7681('0x0'));var BPromise=require('bluebird');var rs=require(_0x7681('0x1'));var AWS=require(_0x7681('0x2'));function pollyResult(_0x14ee62,_0x4409d5,_0x3e60f5){return new BPromise(function(_0x44af13,_0x328660){_0x14ee62[_0x7681('0x3')](_0x4409d5,function(_0x4dff38,_0x7aa309){if(_0x4dff38){_0x328660(_0x4dff38);}else if(_0x7aa309){if(_0x7aa309['AudioStream']instanceof Buffer){fs[_0x7681('0x4')](_0x3e60f5,_0x7aa309[_0x7681('0x5')],function(_0x36890a){if(_0x36890a){_0x328660(_0x36890a);}else{_0x44af13();}});}else{_0x328660(new Error(_0x7681('0x6')));}}else{_0x328660(new Error(_0x7681('0x7')));}});});}module[_0x7681('0x8')]=function(_0x35c1b3,_0x56822b,_0x175646,_0x3a332e,_0x37321f,_0x4b82be,_0x9e199a){var _0x429c71=new AWS['Polly']({'accessKeyId':_0x35c1b3,'secretAccessKey':_0x56822b,'region':_0x175646});var _0x4d1f44={'Text':_0x37321f,'TextType':_0x4b82be||'text','OutputFormat':'mp3','VoiceId':_0x3a332e};return pollyResult(_0x429c71,_0x4d1f44,_0x9e199a);}; \ No newline at end of file +var _0xa79e=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk'];(function(_0x3b6595,_0x593b90){var _0x25fe80=function(_0x13d24e){while(--_0x13d24e){_0x3b6595['push'](_0x3b6595['shift']());}};_0x25fe80(++_0x593b90);}(_0xa79e,0xa4));var _0xea79=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0xa79e[_0x40015a];return _0x42f8a4;};'use strict';var fs=require('fs');var path=require(_0xea79('0x0'));var BPromise=require(_0xea79('0x1'));var rs=require(_0xea79('0x2'));var AWS=require(_0xea79('0x3'));function pollyResult(_0x15a910,_0xe6b50f,_0x1b5251){return new BPromise(function(_0xad359d,_0xd3d1e7){_0x15a910[_0xea79('0x4')](_0xe6b50f,function(_0x205c60,_0x392b5c){if(_0x205c60){_0xd3d1e7(_0x205c60);}else if(_0x392b5c){if(_0x392b5c[_0xea79('0x5')]instanceof Buffer){fs[_0xea79('0x6')](_0x1b5251,_0x392b5c[_0xea79('0x5')],function(_0x6d1595){if(_0x6d1595){_0xd3d1e7(_0x6d1595);}else{_0xad359d();}});}else{_0xd3d1e7(new Error(_0xea79('0x7')));}}else{_0xd3d1e7(new Error(_0xea79('0x8')));}});});}module[_0xea79('0x9')]=function(_0x34d5de,_0x4caed7,_0x2c297e,_0x2a79f2,_0xf155a8,_0x3b3f9d,_0xae6be){var _0xf64979=new AWS[(_0xea79('0xa'))]({'accessKeyId':_0x34d5de,'secretAccessKey':_0x4caed7,'region':_0x2c297e});var _0x2c13f4={'Text':_0xf155a8,'TextType':_0x3b3f9d||_0xea79('0xb'),'OutputFormat':'mp3','VoiceId':_0x2a79f2};return pollyResult(_0xf64979,_0x2c13f4,_0xae6be);}; \ 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 baae028..d651c30 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 _0xa58f=['exports','./lib/api'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xa58f,0x18d));var _0xfa58=function(_0x2f198f,_0x600fda){_0x2f198f=_0x2f198f-0x0;var _0xe2724d=_0xa58f[_0x2f198f];return _0xe2724d;};'use strict';var asr=require(_0xfa58('0x0'));module[_0xfa58('0x1')]=function(_0xfbcaca,_0x3ed2a2,_0x41b0f3,_0x5484eb){return asr(_0xfbcaca,_0x3ed2a2,_0x41b0f3);}; \ No newline at end of file +var _0x2531=['./lib/api'];(function(_0x3a08e3,_0x6812cb){var _0xb2d69e=function(_0x3a5902){while(--_0x3a5902){_0x3a08e3['push'](_0x3a08e3['shift']());}};_0xb2d69e(++_0x6812cb);}(_0x2531,0xce));var _0x1253=function(_0x5dc759,_0x24340f){_0x5dc759=_0x5dc759-0x0;var _0x3873c1=_0x2531[_0x5dc759];return _0x3873c1;};'use strict';var asr=require(_0x1253('0x0'));module['exports']=function(_0x4305ce,_0x394dcc,_0xac4455,_0x1f4a11){return asr(_0x4305ce,_0x394dcc,_0xac4455);}; \ 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 fa5a376..19c0d7e 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 _0xde9d=['readFileSync','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x4e0aec,_0x34e066){var _0x316c66=function(_0x3c3409){while(--_0x3c3409){_0x4e0aec['push'](_0x4e0aec['shift']());}};_0x316c66(++_0x34e066);}(_0xde9d,0x156));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var url=require(_0xdde9('0x0'));var BPromise=require(_0xdde9('0x1'));var fs=require('fs');var host=_0xdde9('0x2');module[_0xdde9('0x3')]=function(_0x20ab4a,_0x49fbbe,_0x2a7fa7){return new BPromise(function(_0x28cc44,_0x1aebe6){var _0x4a5ea5;if(typeof _0x20ab4a!==_0xdde9('0x4')||_0x20ab4a[_0xdde9('0x5')]===0x0){return _0x1aebe6(_0xdde9('0x6'));}if(typeof _0x49fbbe!=='string'||_0x49fbbe[_0xdde9('0x5')]===0x0){return _0x1aebe6(_0xdde9('0x7'));}if(typeof _0x2a7fa7!==_0xdde9('0x8')&&(typeof _0x2a7fa7!==_0xdde9('0x4')||_0x2a7fa7[_0xdde9('0x5')]===0x0)){return _0x1aebe6('lang\x20should\x20be\x20a\x20string');}try{_0x4a5ea5=fs[_0xdde9('0x9')](_0x20ab4a)['toString']('base64');}catch(_0x259849){return _0x1aebe6(_0x259849);}return _0x28cc44({'method':_0xdde9('0xa'),'uri':host+_0xdde9('0xb')+_0x49fbbe,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xdde9('0xc'),'languageCode':_0x2a7fa7},'audio':{'content':_0x4a5ea5}},'json':!![]});});}; \ No newline at end of file +var _0x81d5=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','exports','string','length'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x81d5,0x1ab));var _0x581d=function(_0x270119,_0x1ee241){_0x270119=_0x270119-0x0;var _0x5079a9=_0x81d5[_0x270119];return _0x5079a9;};'use strict';var url=require(_0x581d('0x0'));var BPromise=require(_0x581d('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x581d('0x2')]=function(_0x20d1a8,_0x2fe463,_0x9fb336){return new BPromise(function(_0x477e28,_0x553617){var _0x4801bc;if(typeof _0x20d1a8!==_0x581d('0x3')||_0x20d1a8[_0x581d('0x4')]===0x0){return _0x553617(_0x581d('0x5'));}if(typeof _0x2fe463!=='string'||_0x2fe463[_0x581d('0x4')]===0x0){return _0x553617(_0x581d('0x6'));}if(typeof _0x9fb336!==_0x581d('0x7')&&(typeof _0x9fb336!=='string'||_0x9fb336[_0x581d('0x4')]===0x0)){return _0x553617('lang\x20should\x20be\x20a\x20string');}try{_0x4801bc=fs['readFileSync'](_0x20d1a8)['toString'](_0x581d('0x8'));}catch(_0x3435a9){return _0x553617(_0x3435a9);}return _0x477e28({'method':_0x581d('0x9'),'uri':host+_0x581d('0xa')+_0x2fe463,'body':{'config':{'encoding':_0x581d('0xb'),'sampleRateHertz':'8000','languageCode':_0x9fb336},'audio':{'content':_0x4801bc}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 10cb4be..a07f94e 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xadc4=['exports','./asr'];(function(_0x1d3dec,_0x57e95c){var _0x18567f=function(_0x240c43){while(--_0x240c43){_0x1d3dec['push'](_0x1d3dec['shift']());}};_0x18567f(++_0x57e95c);}(_0xadc4,0x165));var _0x4adc=function(_0x5e904e,_0x6749bb){_0x5e904e=_0x5e904e-0x0;var _0x787ee2=_0xadc4[_0x5e904e];return _0x787ee2;};var asr=require(_0x4adc('0x0'));module[_0x4adc('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 ae4145e..59bec7a 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 _0xae90=['close','unlink','WHAT_EVER','get','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','MP3','text:synthesize','generate','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','null','slice','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','resolvedQuery','action','actionIncomplete','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','length','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','asr','polly','awsLex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','channelData','CustomActionData','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','randomstring','sox','parse','util','./aws','./google','./sestek','./tilde','agi','protocol','https:','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file'];(function(_0x11505c,_0x3be5b7){var _0x389e04=function(_0x3e4d3a){while(--_0x3e4d3a){_0x11505c['push'](_0x11505c['shift']());}};_0x389e04(++_0x3be5b7);}(_0xae90,0xe7));var _0x0ae9=function(_0xe5001e,_0x52e01c){_0xe5001e=_0xe5001e-0x0;var _0x477188=_0xae90[_0xe5001e];return _0x477188;};'use strict';var apiai=require(_0x0ae9('0x0'));var BPromise=require(_0x0ae9('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x0ae9('0x2'));var https=require(_0x0ae9('0x3'));var md5=require(_0x0ae9('0x4'));var path=require(_0x0ae9('0x5'));var querystring=require(_0x0ae9('0x6'));var rp=require(_0x0ae9('0x7'));var rs=require(_0x0ae9('0x8'));var sox=require(_0x0ae9('0x9'));var tts=require('google-tts-api');var urlParse=require('url')[_0x0ae9('0xa')];var util=require(_0x0ae9('0xb'));var aws=require(_0x0ae9('0xc'));var google=require(_0x0ae9('0xd'));var sestek=require(_0x0ae9('0xe'));var tilde=require(_0x0ae9('0xf'));var logger=require('../../../config/logger')(_0x0ae9('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x4b69d4,_0x29b851){return new BPromise(function(_0x442da0,_0x59ebdb){var _0xb9fe93=urlParse(_0x4b69d4);var _0x293482=_0xb9fe93[_0x0ae9('0x11')]===_0x0ae9('0x12')?https:http;var _0x37f8e8={'host':_0xb9fe93[_0x0ae9('0x13')],'path':_0xb9fe93[_0x0ae9('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x293482['get'](_0x37f8e8,function(_0x29946a){if(_0x29946a[_0x0ae9('0x14')]!==0xc8){logger[_0x0ae9('0x15')](_0x0ae9('0x16')+_0x4b69d4+_0x0ae9('0x17')+_0x29946a[_0x0ae9('0x14')]+'\x20('+_0x29946a[_0x0ae9('0x18')]+')');_0x59ebdb(new Error(_0x0ae9('0x16')+_0x4b69d4+_0x0ae9('0x17')+_0x29946a['statusCode']+'\x20('+_0x29946a[_0x0ae9('0x18')]+')'));return;}var _0x42b5c1=fs[_0x0ae9('0x19')](_0x29b851);_0x42b5c1['on'](_0x0ae9('0x1a'),function(){logger[_0x0ae9('0x1b')](_0x0ae9('0x1c'));_0x42b5c1[_0x0ae9('0x1d')](_0x442da0);});_0x42b5c1['on'](_0x0ae9('0x15'),function(_0x27101d){fs[_0x0ae9('0x1e')](_0x29b851);logger[_0x0ae9('0x15')]('download\x20error',_0x27101d);_0x59ebdb(_0x27101d);});_0x29946a['pipe'](_0x42b5c1);})['on']('error',function(_0x2bacd0){logger[_0x0ae9('0x15')](_0x2bacd0);_0x59ebdb(_0x2bacd0);})['end']();});}function uploadFile(_0x174962){return new BPromise(function(_0x141873,_0x27a29d){var _0x4c9039=urlParse(_0x174962);var _0x4d7e8a=_0x4c9039['protocol']===_0x0ae9('0x12')?https:http;var _0x2ca105={'host':_0x4c9039[_0x0ae9('0x13')],'path':_0x4c9039['path'],'headers':{'user-agent':_0x0ae9('0x1f')}};_0x4d7e8a[_0x0ae9('0x20')](_0x2ca105,function(_0x456ceb){if(_0x456ceb['statusCode']!==0xc8){_0x27a29d(new Error(_0x0ae9('0x16')+_0x174962+_0x0ae9('0x17')+_0x456ceb['statusCode']+'\x20('+_0x456ceb[_0x0ae9('0x18')]+')'));return;}var _0xe62608='';_0x456ceb['on'](_0x0ae9('0x21'),function(_0x4af898){_0xe62608+=_0x4af898;});_0x456ceb['on'](_0x0ae9('0x22'),function(){_0x141873(_0xe62608);});})['on'](_0x0ae9('0x15'),function(_0x3d4fe1){_0x27a29d(_0x3d4fe1);})[_0x0ae9('0x22')]();});}function convertFile(_0xc6d710,_0x4335b7){return new BPromise(function(_0x1a6ba2,_0x199d90){var _0x1bc130=sox[_0x0ae9('0x23')](_0xc6d710,_0x4335b7,{'sampleRate':0x1f40,'format':_0x0ae9('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1bc130['on'](_0x0ae9('0x15'),function(_0x55f3fb){logger[_0x0ae9('0x15')](_0x0ae9('0x25'),_0x55f3fb);_0x199d90(_0x55f3fb);});_0x1bc130['on'](_0x0ae9('0x22'),function(){logger[_0x0ae9('0x1b')](_0x0ae9('0x26'));_0x1a6ba2();});_0x1bc130[_0x0ae9('0x27')]();});}function base64Decode(_0x169b36,_0x5e80ab){var _0x41a1b8=path[_0x0ae9('0x28')](__dirname,_0x0ae9('0x29'),rs['generate'](0x4)+_0x0ae9('0x2a'));fs[_0x0ae9('0x2b')](_0x41a1b8,_0x169b36,_0x0ae9('0x2c'));return convertFile(_0x41a1b8,_0x5e80ab)[_0x0ae9('0x2d')](function(){try{fs[_0x0ae9('0x1e')](_0x41a1b8);fs[_0x0ae9('0x2e')](_0x5e80ab,_0x0ae9('0x2f'));}catch(_0x3942cc){logger['error'](_0x3942cc);}return _0x5e80ab['split']('.')[0x0];});}function base64Encode(_0x5b4845){var _0x33789f=fs[_0x0ae9('0x30')](_0x5b4845);return new Buffer(_0x33789f)['toString'](_0x0ae9('0x2c'));}exports[_0x0ae9('0x31')]=function(_0x46e687,_0x257b38,_0x4fb620,_0x2299a6,_0x3429bf,_0x5e97f1){var _0x5b6efa,_0x19856b;var _0x52c1ea=_0x0ae9('0x32');var _0x1de6c9=_0x0ae9('0x33')+_0x46e687;var _0xa9079f={};if(_0x257b38==='ssml'){_0xa9079f['input']={'ssml':_0x4fb620};}else{_0xa9079f[_0x0ae9('0x34')]={'text':_0x4fb620};};_0xa9079f['voice']={'languageCode':_0x2299a6,'ssmlGender':_0x3429bf};_0xa9079f['audioConfig']={'audioEncoding':_0x0ae9('0x35'),'sampleRateHertz':0x1f40};var _0x53e265={'url':_0x52c1ea+_0x0ae9('0x36')+_0x1de6c9,'method':'POST','json':!![],'body':_0xa9079f};return rp(_0x53e265)[_0x0ae9('0x2d')](function(_0x304fcd){return new BPromise(function(_0x576b19,_0x256a7b){_0x5b6efa=path[_0x0ae9('0x28')](__dirname,_0x0ae9('0x29'),rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x38'));var _0x5b3ad8=Buffer[_0x0ae9('0x39')](_0x304fcd[_0x0ae9('0x3a')],_0x0ae9('0x2c'));return fs[_0x0ae9('0x3b')](_0x5b6efa,_0x5b3ad8,function(_0x59bdf3){_0x256a7b(_0x59bdf3);},function(_0x5869f0){fs['chmodSync'](_0x5b6efa,_0x0ae9('0x2f'));_0x576b19(_0x5869f0);});});})[_0x0ae9('0x2d')](function(_0x4e06e2){_0x19856b=path['resolve'](__dirname,_0x0ae9('0x29'),rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x2a'));return convertFile(_0x5b6efa,_0x19856b);})[_0x0ae9('0x2d')](function(){try{fs[_0x0ae9('0x1e')](_0x5b6efa);fs[_0x0ae9('0x2e')](_0x19856b,_0x0ae9('0x2f'));}catch(_0x357d06){logger[_0x0ae9('0x15')](_0x357d06);}logger[_0x0ae9('0x1b')](_0x0ae9('0x3c'),_0x19856b[_0x0ae9('0x3d')]('.')[0x0]);return _0x19856b['split']('.')[0x0];});};exports[_0x0ae9('0x3e')]=function(_0x12ae3e,_0x1e17a2){var _0x158b2f=_0x0ae9('0x3f');var _0x255fb9,_0x5d9655;var _0x23dd25;var _0x106790={'encoding':_0x0ae9('0x40'),'method':_0x0ae9('0x41'),'timeout':0x2710,'url':_0x158b2f,'headers':{'Content-Type':_0x0ae9('0x42')},'body':_0x0ae9('0x43')+encodeURIComponent(JSON[_0x0ae9('0x44')]([[['jQ1olc',JSON[_0x0ae9('0x44')]([_0x12ae3e,_0x1e17a2||'en',![],_0x0ae9('0x45')]),null,'generic']]]))};return rp(_0x106790)['then'](function(_0x4f7a31){try{_0x23dd25=eval(_0x4f7a31[_0x0ae9('0x46')](0x5))[0x0][0x2];}catch(_0x30f2b3){throw new Error('parse\x20response\x20failed:\x0a'+_0x4f7a31[_0x0ae9('0x21')]);}if(!_0x23dd25){if(_0x12ae3e['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x1e17a2+_0x0ae9('0x47'));}}try{_0x23dd25=eval(_0x23dd25)[0x0];}catch(_0x229539){throw new Error(_0x0ae9('0x48')+res[_0x0ae9('0x21')]);}const _0x4f7e29=_0x23dd25;_0x255fb9=path[_0x0ae9('0x28')](__dirname,_0x0ae9('0x29'),rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x38'));fs[_0x0ae9('0x2b')](_0x255fb9,_0x23dd25,{'encoding':_0x0ae9('0x2c')});_0x5d9655=path[_0x0ae9('0x28')](__dirname,_0x0ae9('0x29'),rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x2a'));return convertFile(_0x255fb9,_0x5d9655);})[_0x0ae9('0x2d')](function(){try{fs[_0x0ae9('0x1e')](_0x255fb9);fs[_0x0ae9('0x2e')](_0x5d9655,_0x0ae9('0x2f'));}catch(_0x52d3de){logger[_0x0ae9('0x15')](_0x52d3de);}logger[_0x0ae9('0x1b')](_0x0ae9('0x49'),_0x5d9655[_0x0ae9('0x3d')]('.')[0x0]);return _0x5d9655[_0x0ae9('0x3d')]('.')[0x0];});};exports[_0x0ae9('0x4a')]=function(_0x1098ec,_0x5d3825,_0x41e181){return google['asr'](_0x1098ec,_0x5d3825,_0x41e181)[_0x0ae9('0x2d')](function(_0xe69c3f){logger['info'](_0xe69c3f['uri']);return rp(_0xe69c3f);})['then'](function(_0xeefba0){var _0x2d89b1='';var _0xdc755e=0x0;try{fs[_0x0ae9('0x1e')](_0x1098ec);}catch(_0x344640){logger['error'](_0x344640);}if(_0xeefba0&&_0xeefba0[_0x0ae9('0x4b')]){_0x2d89b1=_0xeefba0[_0x0ae9('0x4b')]['map'](function(_0x5e61e7){return _0x5e61e7&&_0x5e61e7['alternatives'][0x0]&&_0x5e61e7[_0x0ae9('0x4c')][0x0][_0x0ae9('0x4d')]?_0x5e61e7['alternatives'][0x0][_0x0ae9('0x4d')]:'';})[_0x0ae9('0x4e')]('\x0a');_0xdc755e=_0xeefba0['results'][_0x0ae9('0x4f')](function(_0xebce28){return _0xebce28&&_0xebce28['alternatives'][0x0]&&_0xebce28[_0x0ae9('0x4c')][0x0][_0x0ae9('0x50')]?_0xebce28[_0x0ae9('0x4c')][0x0]['confidence']:0x0;})['join']('\x0a');}logger['info'](_0x0ae9('0x51'),_0x2d89b1);logger['info'](_0x0ae9('0x52'),_0xdc755e);return{'transcript':_0x2d89b1,'confidence':_0xdc755e};})[_0x0ae9('0x53')](function(_0x370794){logger[_0x0ae9('0x15')](_0x0ae9('0x54'),_0x370794[_0x0ae9('0x14')],_0x370794[_0x0ae9('0x55')],_0x370794[_0x0ae9('0x56')]);});};exports[_0x0ae9('0x57')]=function(_0x16221d,_0x3726f4,_0x4cd12a,_0xdfe34f){var _0x36b111=apiai(_0x3726f4,{'language':_0xdfe34f||'en'});return _0x36b111['textRequest'](_0x4cd12a,{'sessionId':md5(_0x16221d)})[_0x0ae9('0x2d')](function(_0x1a5cc3){logger['info'](JSON[_0x0ae9('0x44')](_0x1a5cc3));return{'source':_0x1a5cc3[_0x0ae9('0x58')]['source'],'resolvedQuery':_0x1a5cc3[_0x0ae9('0x58')][_0x0ae9('0x59')],'action':_0x1a5cc3[_0x0ae9('0x58')][_0x0ae9('0x5a')],'actionIncomplete':_0x1a5cc3['result'][_0x0ae9('0x5b')],'speech':_0x1a5cc3[_0x0ae9('0x58')]['fulfillment'][_0x0ae9('0x5c')],'score':_0x1a5cc3[_0x0ae9('0x58')]['score'],'statusCode':_0x1a5cc3[_0x0ae9('0x5d')][_0x0ae9('0x5e')],'endConversation':_0x1a5cc3[_0x0ae9('0x58')][_0x0ae9('0x5f')][_0x0ae9('0x60')]||![],'isFallbackIntent':_0x1a5cc3[_0x0ae9('0x58')][_0x0ae9('0x5f')][_0x0ae9('0x61')]};});};exports[_0x0ae9('0x62')]=function(_0x3c2436,_0x4b70ec,_0x3dd1b9,_0x41af3b,_0x562e49,_0x26b838){var _0xddfb1b=_0x41af3b['replace'](/\\n/g,'\x0a');var _0x2f574b={'credentials':{'private_key':_0xddfb1b,'client_email':_0x3dd1b9}};var _0x1ed198=new dialogflow[(_0x0ae9('0x63'))](_0x2f574b);var _0x2e4e8a=_0x1ed198['sessionPath'](_0x4b70ec,md5(_0x3c2436));var _0x7cabd9={'session':_0x2e4e8a,'queryInput':{'text':{'text':_0x562e49,'languageCode':_0x26b838}}};return _0x1ed198['detectIntent'](_0x7cabd9)[_0x0ae9('0x2d')](function(_0x37f1fc){if(_0x37f1fc&&_0x37f1fc[_0x0ae9('0x64')]){logger[_0x0ae9('0x1b')](_0x0ae9('0x65'),JSON[_0x0ae9('0x44')](_0x37f1fc));var _0x261382=_0x37f1fc[0x0];if(_0x261382){var _0x22c951={'action':_0x261382['queryResult'][_0x0ae9('0x5a')],'allRequiredParamsPresent':_0x261382['queryResult'][_0x0ae9('0x66')],'endConversation':_0x261382[_0x0ae9('0x67')][_0x0ae9('0x68')]&&_0x261382['queryResult']['diagnosticInfo'][_0x0ae9('0x69')]?_0x261382[_0x0ae9('0x67')][_0x0ae9('0x68')][_0x0ae9('0x69')][_0x0ae9('0x6a')]['boolValue']:![],'fulfillmentText':_0x261382[_0x0ae9('0x67')][_0x0ae9('0x6b')],'intentName':_0x261382['queryResult'][_0x0ae9('0x6c')]['name'],'intentDisplayName':_0x261382[_0x0ae9('0x67')][_0x0ae9('0x6c')][_0x0ae9('0x6d')],'isFallbackIntent':_0x261382['queryResult'][_0x0ae9('0x6c')][_0x0ae9('0x6e')],'languageCode':_0x261382['queryResult'][_0x0ae9('0x6f')],'queryText':_0x261382['queryResult']['queryText'],'responseId':_0x261382[_0x0ae9('0x70')],'score':_0x261382[_0x0ae9('0x67')][_0x0ae9('0x71')],'speech':_0x261382[_0x0ae9('0x67')][_0x0ae9('0x6b')],'providerResponse':JSON[_0x0ae9('0x44')](_0x37f1fc)};return _0x22c951;}}});};exports[_0x0ae9('0x72')]=function(_0x33f5b6,_0x4e56bf,_0x35de46,_0x4f0d32){return tilde[_0x0ae9('0x73')](_0x33f5b6,_0x4e56bf,_0x35de46,_0x4f0d32)[_0x0ae9('0x2d')](function(_0x5b741e){try{fs[_0x0ae9('0x1e')](_0x33f5b6);}catch(_0x3da73e){logger[_0x0ae9('0x15')](_0x3da73e);}logger[_0x0ae9('0x1b')]('Tilde\x20ASR\x20transcription',_0x5b741e[_0x0ae9('0x4d')]);logger[_0x0ae9('0x1b')]('Tilde\x20ASR\x20confidence',_0x5b741e['confidence']);return _0x5b741e;});};exports['awsPolly']=function(_0x249816,_0x2d90d2,_0x88decc,_0x43c177,_0x148179,_0x582136){var _0x31c5c3=path['resolve'](__dirname,_0x0ae9('0x29'),rs['generate'](0x4)+_0x0ae9('0x38'));var _0x21e2cb;return aws[_0x0ae9('0x74')](_0x249816,_0x2d90d2,_0x88decc,_0x43c177,_0x148179,_0x582136,_0x31c5c3)[_0x0ae9('0x2d')](function(){_0x21e2cb=path[_0x0ae9('0x28')](__dirname,_0x0ae9('0x29'),rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x2a'));return convertFile(_0x31c5c3,_0x21e2cb);})['then'](function(){try{fs[_0x0ae9('0x1e')](_0x31c5c3);fs['chmodSync'](_0x21e2cb,_0x0ae9('0x2f'));}catch(_0x5b54f5){logger['error'](_0x5b54f5);}return _0x21e2cb[_0x0ae9('0x3d')]('.')[0x0];});};exports[_0x0ae9('0x75')]=function(_0x20cba2,_0x134da9,_0x308121,_0xdb38cf,_0x4a2ff9,_0xf785b1){return aws['lex'](_0x20cba2,_0x134da9,_0x308121,_0xdb38cf,_0x4a2ff9,_0xf785b1)['then'](function(_0x2bcefd){logger[_0x0ae9('0x1b')](JSON[_0x0ae9('0x44')](_0x2bcefd));return _0x2bcefd;});};exports['ispeechTTS']=function(_0x388ff3,_0x10c981,_0x3924e4,_0x492038){var _0x2c7a53=util['format'](_0x0ae9('0x76'),ISPEECH_API,_0x388ff3,encodeURIComponent(_0x10c981),_0x3924e4,_0x492038);var _0x5befa9=path['resolve'](__dirname,_0x0ae9('0x29'),rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x38'));var _0x20e0ba;return downloadFile(_0x2c7a53,_0x5befa9)['then'](function(){_0x20e0ba=path['resolve'](__dirname,'tmp',rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x2a'));return convertFile(_0x5befa9,_0x20e0ba);})[_0x0ae9('0x2d')](function(){try{fs[_0x0ae9('0x1e')](_0x5befa9);fs[_0x0ae9('0x2e')](_0x20e0ba,_0x0ae9('0x2f'));}catch(_0x2d102d){logger[_0x0ae9('0x15')](_0x2d102d);}return _0x20e0ba['split']('.')[0x0];});};exports[_0x0ae9('0x77')]=function(_0x3a54a5,_0x234d62,_0x5c9290,_0x27a3ad){var _0x1f1356=util[_0x0ae9('0x78')](_0x0ae9('0x79'),ISPEECH_API,_0x234d62,_0x5c9290,base64Encode(_0x3a54a5),_0x27a3ad?util[_0x0ae9('0x78')](_0x0ae9('0x7a'),encodeURIComponent(_0x27a3ad)):_0x0ae9('0x7b'));return uploadFile(_0x1f1356)[_0x0ae9('0x2d')](function(_0x4bb5c9){return querystring[_0x0ae9('0xa')](_0x4bb5c9);});};exports[_0x0ae9('0x7c')]=function(_0x4de2e9,_0x4a0dce){return sestek['nda'](_0x4de2e9,_0x4a0dce)[_0x0ae9('0x2d')](function(_0x56ea1a){logger[_0x0ae9('0x1b')](JSON[_0x0ae9('0x44')](_0x56ea1a));var _0x5c4c38={'speech':_0x56ea1a['text'],'action':_0x56ea1a[_0x0ae9('0x7d')]?_0x56ea1a[_0x0ae9('0x7d')]['CustomAction']:undefined,'actiondata':_0x56ea1a['channelData']?_0x56ea1a[_0x0ae9('0x7d')][_0x0ae9('0x7e')]:undefined};if(_0x56ea1a[_0x0ae9('0x7d')]&&_0x56ea1a[_0x0ae9('0x7d')]['AudioFromTts']){return base64Decode(_0x56ea1a['channelData']['AudioFromTts'][_0x0ae9('0x7f')],path[_0x0ae9('0x28')](__dirname,'tmp',rs[_0x0ae9('0x37')](0x4)+_0x0ae9('0x2a')))[_0x0ae9('0x2d')](function(_0x158ba5){_0x5c4c38[_0x0ae9('0x80')]=_0x158ba5;return _0x5c4c38;});}return _0x5c4c38;});};exports[_0x0ae9('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0xec8a=['goggleTTS\x20path','googleASR','asr','results','map','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','result','source','resolvedQuery','actionIncomplete','fulfillment','score','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','fields','diagnosticInfo','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','transcript','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','WHAT_EVER','data','wav','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','then','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist'];(function(_0x35f85e,_0x500bcc){var _0x41e71a=function(_0x3c9767){while(--_0x3c9767){_0x35f85e['push'](_0x35f85e['shift']());}};_0x41e71a(++_0x500bcc);}(_0xec8a,0xc7));var _0xaec8=function(_0x277352,_0x5196d9){_0x277352=_0x277352-0x0;var _0x270549=_0xec8a[_0x277352];return _0x270549;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xaec8('0x0'));var dialogflow=require(_0xaec8('0x1'));var fs=require('fs');var http=require(_0xaec8('0x2'));var https=require('https');var md5=require(_0xaec8('0x3'));var path=require('path');var querystring=require(_0xaec8('0x4'));var rp=require(_0xaec8('0x5'));var rs=require(_0xaec8('0x6'));var sox=require(_0xaec8('0x7'));var tts=require(_0xaec8('0x8'));var urlParse=require(_0xaec8('0x9'))[_0xaec8('0xa')];var util=require(_0xaec8('0xb'));var aws=require(_0xaec8('0xc'));var google=require(_0xaec8('0xd'));var sestek=require(_0xaec8('0xe'));var tilde=require(_0xaec8('0xf'));var logger=require(_0xaec8('0x10'))(_0xaec8('0x11'));var ISPEECH_API=_0xaec8('0x12');function downloadFile(_0xf04a81,_0x1e6296){return new BPromise(function(_0x563ae8,_0x354d73){var _0x1c951a=urlParse(_0xf04a81);var _0x5ab669=_0x1c951a[_0xaec8('0x13')]===_0xaec8('0x14')?https:http;var _0x1e8332={'host':_0x1c951a[_0xaec8('0x15')],'path':_0x1c951a[_0xaec8('0x16')],'headers':{'user-agent':'WHAT_EVER'}};_0x5ab669[_0xaec8('0x17')](_0x1e8332,function(_0x3a18b8){if(_0x3a18b8[_0xaec8('0x18')]!==0xc8){logger[_0xaec8('0x19')](_0xaec8('0x1a')+_0xf04a81+_0xaec8('0x1b')+_0x3a18b8[_0xaec8('0x18')]+'\x20('+_0x3a18b8[_0xaec8('0x1c')]+')');_0x354d73(new Error(_0xaec8('0x1a')+_0xf04a81+_0xaec8('0x1b')+_0x3a18b8[_0xaec8('0x18')]+'\x20('+_0x3a18b8[_0xaec8('0x1c')]+')'));return;}var _0xd00479=fs[_0xaec8('0x1d')](_0x1e6296);_0xd00479['on']('finish',function(){logger[_0xaec8('0x1e')](_0xaec8('0x1f'));_0xd00479[_0xaec8('0x20')](_0x563ae8);});_0xd00479['on'](_0xaec8('0x19'),function(_0x1d90c6){fs[_0xaec8('0x21')](_0x1e6296);logger[_0xaec8('0x19')](_0xaec8('0x22'),_0x1d90c6);_0x354d73(_0x1d90c6);});_0x3a18b8[_0xaec8('0x23')](_0xd00479);})['on'](_0xaec8('0x19'),function(_0x586b0f){logger[_0xaec8('0x19')](_0x586b0f);_0x354d73(_0x586b0f);})[_0xaec8('0x24')]();});}function uploadFile(_0x573af4){return new BPromise(function(_0x363f64,_0x5d5f79){var _0x24a1a6=urlParse(_0x573af4);var _0xf3069c=_0x24a1a6[_0xaec8('0x13')]==='https:'?https:http;var _0x515d72={'host':_0x24a1a6['host'],'path':_0x24a1a6['path'],'headers':{'user-agent':_0xaec8('0x25')}};_0xf3069c['get'](_0x515d72,function(_0x1bdadf){if(_0x1bdadf[_0xaec8('0x18')]!==0xc8){_0x5d5f79(new Error(_0xaec8('0x1a')+_0x573af4+_0xaec8('0x1b')+_0x1bdadf['statusCode']+'\x20('+_0x1bdadf[_0xaec8('0x1c')]+')'));return;}var _0x4ad0a5='';_0x1bdadf['on'](_0xaec8('0x26'),function(_0x456844){_0x4ad0a5+=_0x456844;});_0x1bdadf['on'](_0xaec8('0x24'),function(){_0x363f64(_0x4ad0a5);});})['on'](_0xaec8('0x19'),function(_0x3b9607){_0x5d5f79(_0x3b9607);})[_0xaec8('0x24')]();});}function convertFile(_0x3ede80,_0x138b3c){return new BPromise(function(_0x4655f2,_0x3b8c21){var _0x5bcba9=sox['transcode'](_0x3ede80,_0x138b3c,{'sampleRate':0x1f40,'format':_0xaec8('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bcba9['on'](_0xaec8('0x19'),function(_0x239cfa){logger[_0xaec8('0x19')]('error\x20convert',_0x239cfa);_0x3b8c21(_0x239cfa);});_0x5bcba9['on'](_0xaec8('0x24'),function(){logger[_0xaec8('0x1e')](_0xaec8('0x28'));_0x4655f2();});_0x5bcba9[_0xaec8('0x29')]();});}function base64Decode(_0x1702a6,_0x45b98f){var _0x4bb3fe=path[_0xaec8('0x2a')](__dirname,'tmp',rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x2c'));fs[_0xaec8('0x2d')](_0x4bb3fe,_0x1702a6,_0xaec8('0x2e'));return convertFile(_0x4bb3fe,_0x45b98f)['then'](function(){try{fs['unlink'](_0x4bb3fe);fs[_0xaec8('0x2f')](_0x45b98f,_0xaec8('0x30'));}catch(_0x2bfec4){logger[_0xaec8('0x19')](_0x2bfec4);}return _0x45b98f[_0xaec8('0x31')]('.')[0x0];});}function base64Encode(_0x5add64){var _0x2d83f3=fs[_0xaec8('0x32')](_0x5add64);return new Buffer(_0x2d83f3)[_0xaec8('0x33')](_0xaec8('0x2e'));}exports[_0xaec8('0x34')]=function(_0x5489d6,_0x18bc66,_0x54637b,_0x34c66a,_0xcf6ef,_0x26e6ea){var _0x17b1e6,_0x194c8f;var _0x34e6a1=_0xaec8('0x35');var _0x1ef67d=_0xaec8('0x36')+_0x5489d6;var _0x3e5444={};if(_0x18bc66===_0xaec8('0x37')){_0x3e5444['input']={'ssml':_0x54637b};}else{_0x3e5444[_0xaec8('0x38')]={'text':_0x54637b};};_0x3e5444['voice']={'languageCode':_0x34c66a,'ssmlGender':_0xcf6ef};_0x3e5444[_0xaec8('0x39')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xe668a4={'url':_0x34e6a1+_0xaec8('0x3a')+_0x1ef67d,'method':'POST','json':!![],'body':_0x3e5444};return rp(_0xe668a4)[_0xaec8('0x3b')](function(_0x7c83c8){return new BPromise(function(_0x50450f,_0x5adf9c){_0x17b1e6=path[_0xaec8('0x2a')](__dirname,_0xaec8('0x3c'),rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x3d'));var _0x2caae8=Buffer[_0xaec8('0x3e')](_0x7c83c8[_0xaec8('0x3f')],'base64');return fs[_0xaec8('0x40')](_0x17b1e6,_0x2caae8,function(_0x1fe99c){_0x5adf9c(_0x1fe99c);},function(_0x4a167d){fs[_0xaec8('0x2f')](_0x17b1e6,'777');_0x50450f(_0x4a167d);});});})[_0xaec8('0x3b')](function(_0x35bced){_0x194c8f=path[_0xaec8('0x2a')](__dirname,'tmp',rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x2c'));return convertFile(_0x17b1e6,_0x194c8f);})[_0xaec8('0x3b')](function(){try{fs[_0xaec8('0x21')](_0x17b1e6);fs['chmodSync'](_0x194c8f,_0xaec8('0x30'));}catch(_0x559038){logger['error'](_0x559038);}logger['info'](_0xaec8('0x41'),_0x194c8f[_0xaec8('0x31')]('.')[0x0]);return _0x194c8f['split']('.')[0x0];});};exports[_0xaec8('0x42')]=function(_0x4a4582,_0x425c4c){var _0x22dc32=_0xaec8('0x43');var _0x4ceb24,_0x2fdc9d;var _0x40ff6a;var _0x204214={'encoding':_0xaec8('0x44'),'method':'POST','timeout':0x2710,'url':_0x22dc32,'headers':{'Content-Type':_0xaec8('0x45')},'body':_0xaec8('0x46')+encodeURIComponent(JSON[_0xaec8('0x47')]([[[_0xaec8('0x48'),JSON[_0xaec8('0x47')]([_0x4a4582,_0x425c4c||'en',![],_0xaec8('0x49')]),null,_0xaec8('0x4a')]]]))};return rp(_0x204214)['then'](function(_0x112ca2){try{_0x40ff6a=eval(_0x112ca2[_0xaec8('0x4b')](0x5))[0x0][0x2];}catch(_0x21f8db){throw new Error(_0xaec8('0x4c')+_0x112ca2['data']);}if(!_0x40ff6a){if(_0x4a4582[_0xaec8('0x4d')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x425c4c+_0xaec8('0x4e'));}}try{_0x40ff6a=eval(_0x40ff6a)[0x0];}catch(_0xc6fa){throw new Error(_0xaec8('0x4c')+res[_0xaec8('0x26')]);}const _0x3a52bb=_0x40ff6a;_0x4ceb24=path[_0xaec8('0x2a')](__dirname,_0xaec8('0x3c'),rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x3d'));fs[_0xaec8('0x2d')](_0x4ceb24,_0x40ff6a,{'encoding':_0xaec8('0x2e')});_0x2fdc9d=path[_0xaec8('0x2a')](__dirname,'tmp',rs['generate'](0x4)+_0xaec8('0x2c'));return convertFile(_0x4ceb24,_0x2fdc9d);})[_0xaec8('0x3b')](function(){try{fs[_0xaec8('0x21')](_0x4ceb24);fs[_0xaec8('0x2f')](_0x2fdc9d,_0xaec8('0x30'));}catch(_0x1bdf20){logger['error'](_0x1bdf20);}logger['info'](_0xaec8('0x4f'),_0x2fdc9d[_0xaec8('0x31')]('.')[0x0]);return _0x2fdc9d[_0xaec8('0x31')]('.')[0x0];});};exports[_0xaec8('0x50')]=function(_0x40b5f6,_0x1e9086,_0x506a40){return google[_0xaec8('0x51')](_0x40b5f6,_0x1e9086,_0x506a40)[_0xaec8('0x3b')](function(_0x21c5bc){logger[_0xaec8('0x1e')](_0x21c5bc['uri']);return rp(_0x21c5bc);})[_0xaec8('0x3b')](function(_0x3e5a65){var _0x2f20bb='';var _0x163e74=0x0;try{fs['unlink'](_0x40b5f6);}catch(_0xec5ef6){logger[_0xaec8('0x19')](_0xec5ef6);}if(_0x3e5a65&&_0x3e5a65[_0xaec8('0x52')]){_0x2f20bb=_0x3e5a65['results'][_0xaec8('0x53')](function(_0xcbf1a3){return _0xcbf1a3&&_0xcbf1a3[_0xaec8('0x54')][0x0]&&_0xcbf1a3[_0xaec8('0x54')][0x0]['transcript']?_0xcbf1a3[_0xaec8('0x54')][0x0]['transcript']:'';})[_0xaec8('0x55')]('\x0a');_0x163e74=_0x3e5a65[_0xaec8('0x52')][_0xaec8('0x53')](function(_0x45daa9){return _0x45daa9&&_0x45daa9[_0xaec8('0x54')][0x0]&&_0x45daa9[_0xaec8('0x54')][0x0][_0xaec8('0x56')]?_0x45daa9['alternatives'][0x0][_0xaec8('0x56')]:0x0;})[_0xaec8('0x55')]('\x0a');}logger[_0xaec8('0x1e')](_0xaec8('0x57'),_0x2f20bb);logger[_0xaec8('0x1e')](_0xaec8('0x58'),_0x163e74);return{'transcript':_0x2f20bb,'confidence':_0x163e74};})['catch'](function(_0x30f060){logger['error'](_0xaec8('0x59'),_0x30f060[_0xaec8('0x18')],_0x30f060[_0xaec8('0x5a')],_0x30f060['message']);});};exports[_0xaec8('0x5b')]=function(_0x58e4be,_0x970c0a,_0x58b3ac,_0x562660){var _0x54d7d5=apiai(_0x970c0a,{'language':_0x562660||'en'});return _0x54d7d5['textRequest'](_0x58b3ac,{'sessionId':md5(_0x58e4be)})[_0xaec8('0x3b')](function(_0x38b42e){logger['info'](JSON[_0xaec8('0x47')](_0x38b42e));return{'source':_0x38b42e[_0xaec8('0x5c')][_0xaec8('0x5d')],'resolvedQuery':_0x38b42e['result'][_0xaec8('0x5e')],'action':_0x38b42e['result']['action'],'actionIncomplete':_0x38b42e[_0xaec8('0x5c')][_0xaec8('0x5f')],'speech':_0x38b42e[_0xaec8('0x5c')][_0xaec8('0x60')]['speech'],'score':_0x38b42e['result'][_0xaec8('0x61')],'statusCode':_0x38b42e['status']['code'],'endConversation':_0x38b42e['result'][_0xaec8('0x62')]['endConversation']||![],'isFallbackIntent':_0x38b42e['result'][_0xaec8('0x62')][_0xaec8('0x63')]};});};exports['googleDialogflowV2']=function(_0x43cd2a,_0x1448ea,_0x86798b,_0x476773,_0x90c14a,_0x11710a){var _0x47f8a1=_0x476773[_0xaec8('0x64')](/\\n/g,'\x0a');var _0x4bfae9={'credentials':{'private_key':_0x47f8a1,'client_email':_0x86798b}};var _0x4fa181=new dialogflow[(_0xaec8('0x65'))](_0x4bfae9);var _0x3a7fa5=_0x4fa181[_0xaec8('0x66')](_0x1448ea,md5(_0x43cd2a));var _0x322e96={'session':_0x3a7fa5,'queryInput':{'text':{'text':_0x90c14a,'languageCode':_0x11710a}}};return _0x4fa181[_0xaec8('0x67')](_0x322e96)[_0xaec8('0x3b')](function(_0xf0ee26){if(_0xf0ee26&&_0xf0ee26[_0xaec8('0x4d')]){logger[_0xaec8('0x1e')](_0xaec8('0x68'),JSON['stringify'](_0xf0ee26));var _0x2f71ef=_0xf0ee26[0x0];if(_0x2f71ef){var _0x8e9b46={'action':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x6a')],'allRequiredParamsPresent':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x6b')],'endConversation':_0x2f71ef[_0xaec8('0x69')]['diagnosticInfo']&&_0x2f71ef['queryResult']['diagnosticInfo'][_0xaec8('0x6c')]?_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x6d')][_0xaec8('0x6c')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x2f71ef[_0xaec8('0x69')]['fulfillmentText'],'intentName':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x6e')][_0xaec8('0x5a')],'intentDisplayName':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x6e')][_0xaec8('0x6f')],'isFallbackIntent':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x6e')][_0xaec8('0x70')],'languageCode':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x71')],'queryText':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x72')],'responseId':_0x2f71ef[_0xaec8('0x73')],'score':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x74')],'speech':_0x2f71ef[_0xaec8('0x69')][_0xaec8('0x75')],'providerResponse':JSON['stringify'](_0xf0ee26)};return _0x8e9b46;}}});};exports[_0xaec8('0x76')]=function(_0x43a011,_0x5d8a7f,_0x7b6b78,_0x539f74){return tilde[_0xaec8('0x51')](_0x43a011,_0x5d8a7f,_0x7b6b78,_0x539f74)['then'](function(_0x9fe349){try{fs['unlink'](_0x43a011);}catch(_0x358853){logger[_0xaec8('0x19')](_0x358853);}logger['info']('Tilde\x20ASR\x20transcription',_0x9fe349[_0xaec8('0x77')]);logger[_0xaec8('0x1e')]('Tilde\x20ASR\x20confidence',_0x9fe349[_0xaec8('0x56')]);return _0x9fe349;});};exports[_0xaec8('0x78')]=function(_0xc54ebc,_0x1e7d26,_0x16941b,_0x428ebd,_0x3e9353,_0x6c1757){var _0x46dce2=path['resolve'](__dirname,_0xaec8('0x3c'),rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x3d'));var _0x3e7d3a;return aws[_0xaec8('0x79')](_0xc54ebc,_0x1e7d26,_0x16941b,_0x428ebd,_0x3e9353,_0x6c1757,_0x46dce2)['then'](function(){_0x3e7d3a=path['resolve'](__dirname,_0xaec8('0x3c'),rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x2c'));return convertFile(_0x46dce2,_0x3e7d3a);})[_0xaec8('0x3b')](function(){try{fs[_0xaec8('0x21')](_0x46dce2);fs[_0xaec8('0x2f')](_0x3e7d3a,'777');}catch(_0xce1f2d){logger[_0xaec8('0x19')](_0xce1f2d);}return _0x3e7d3a[_0xaec8('0x31')]('.')[0x0];});};exports[_0xaec8('0x7a')]=function(_0x31f22a,_0xfafb01,_0x49b664,_0x20221b,_0x18dea1,_0x8f1304){return aws['lex'](_0x31f22a,_0xfafb01,_0x49b664,_0x20221b,_0x18dea1,_0x8f1304)['then'](function(_0x3107c4){logger[_0xaec8('0x1e')](JSON['stringify'](_0x3107c4));return _0x3107c4;});};exports[_0xaec8('0x7b')]=function(_0x3cef83,_0x2f6b33,_0x491d52,_0x1ef513){var _0x1107ab=util[_0xaec8('0x7c')](_0xaec8('0x7d'),ISPEECH_API,_0x3cef83,encodeURIComponent(_0x2f6b33),_0x491d52,_0x1ef513);var _0x2722a6=path[_0xaec8('0x2a')](__dirname,_0xaec8('0x3c'),rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x3d'));var _0x3498eb;return downloadFile(_0x1107ab,_0x2722a6)[_0xaec8('0x3b')](function(){_0x3498eb=path[_0xaec8('0x2a')](__dirname,'tmp',rs[_0xaec8('0x2b')](0x4)+_0xaec8('0x2c'));return convertFile(_0x2722a6,_0x3498eb);})[_0xaec8('0x3b')](function(){try{fs[_0xaec8('0x21')](_0x2722a6);fs[_0xaec8('0x2f')](_0x3498eb,_0xaec8('0x30'));}catch(_0x181b69){logger['error'](_0x181b69);}return _0x3498eb[_0xaec8('0x31')]('.')[0x0];});};exports[_0xaec8('0x7e')]=function(_0x4bcc17,_0xa67cde,_0x5e8e9c,_0x79260e){var _0x154dc8=util[_0xaec8('0x7c')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xa67cde,_0x5e8e9c,base64Encode(_0x4bcc17),_0x79260e?util[_0xaec8('0x7c')](_0xaec8('0x7f'),encodeURIComponent(_0x79260e)):_0xaec8('0x80'));return uploadFile(_0x154dc8)['then'](function(_0x5c3d98){return querystring[_0xaec8('0xa')](_0x5c3d98);});};exports[_0xaec8('0x81')]=function(_0x2096d9,_0x7dc7fb){return sestek[_0xaec8('0x82')](_0x2096d9,_0x7dc7fb)[_0xaec8('0x3b')](function(_0x1a25c0){logger[_0xaec8('0x1e')](JSON['stringify'](_0x1a25c0));var _0x4fd8f6={'speech':_0x1a25c0[_0xaec8('0x83')],'action':_0x1a25c0[_0xaec8('0x84')]?_0x1a25c0['channelData'][_0xaec8('0x85')]:undefined,'actiondata':_0x1a25c0[_0xaec8('0x84')]?_0x1a25c0[_0xaec8('0x84')][_0xaec8('0x86')]:undefined};if(_0x1a25c0['channelData']&&_0x1a25c0['channelData'][_0xaec8('0x87')]){return base64Decode(_0x1a25c0['channelData'][_0xaec8('0x87')][_0xaec8('0x88')],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav'))[_0xaec8('0x3b')](function(_0x5a4eba){_0x4fd8f6[_0xaec8('0x89')]=_0x5a4eba;return _0x4fd8f6;});}return _0x4fd8f6;});};exports[_0xaec8('0x8a')]=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 e6107d8..51f9db1 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 _0x640d=['exports'];(function(_0x280072,_0x5b02f1){var _0x4156da=function(_0x4c0c77){while(--_0x4c0c77){_0x280072['push'](_0x280072['shift']());}};_0x4156da(++_0x5b02f1);}(_0x640d,0x11c));var _0xd640=function(_0x3984c2,_0x5b7159){_0x3984c2=_0x3984c2-0x0;var _0x2d4501=_0x640d[_0x3984c2];return _0x2d4501;};var nda=require('./nda');module[_0xd640('0x0')]={'nda':nda}; \ No newline at end of file +var _0xa920=['exports','./nda'];(function(_0x596309,_0xdf0b80){var _0x35eff8=function(_0x5ecee0){while(--_0x5ecee0){_0x596309['push'](_0x596309['shift']());}};_0x35eff8(++_0xdf0b80);}(_0xa920,0x161));var _0x0a92=function(_0x5120f4,_0xf6fd25){_0x5120f4=_0x5120f4-0x0;var _0x1e5d05=_0xa920[_0x5120f4];return _0x1e5d05;};var nda=require(_0x0a92('0x0'));module[_0x0a92('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 ce77e76..faa6eb2 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 _0x2179=['resolve','ndauth_url','/token','password','username','ndassistant_url','message','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x9884e3,_0x34a043){var _0x6e3ec=function(_0x4d328c){while(--_0x4d328c){_0x9884e3['push'](_0x9884e3['shift']());}};_0x6e3ec(++_0x34a043);}(_0x2179,0xc0));var _0x9217=function(_0x32d537,_0x580e46){_0x32d537=_0x32d537-0x0;var _0x2ec857=_0x2179[_0x32d537];return _0x2ec857;};'use strict';var rp=require(_0x9217('0x0'));var url=require(_0x9217('0x1'));var logger=require(_0x9217('0x2'))(_0x9217('0x3'));module[_0x9217('0x4')]=function(_0x30b6bf,_0x86c47c){var _0x16ee7c={'method':_0x9217('0x5'),'uri':url[_0x9217('0x6')](_0x86c47c[_0x9217('0x7')],_0x9217('0x8')),'form':{'grant_type':_0x9217('0x9'),'username':_0x86c47c[_0x9217('0xa')],'password':_0x86c47c[_0x9217('0x9')]},'json':!![]};return rp(_0x16ee7c)['then'](function(_0x1a0b98){var _0x38127f={'method':_0x9217('0x5'),'uri':url[_0x9217('0x6')](_0x86c47c[_0x9217('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x86c47c['ndaactivity_type']||_0x9217('0xc'),'channelId':'Nda','conversation':{'id':_0x30b6bf[_0x9217('0xd')]},'from':{'id':_0x30b6bf[_0x9217('0xe')],'name':_0x30b6bf[_0x9217('0xf')]},'recipient':{'id':_0x30b6bf['dnid'],'name':_0x30b6bf[_0x9217('0x10')]},'text':_0x86c47c[_0x9217('0x11')],'channelData':{}},'headers':{'Authorization':_0x9217('0x12')+_0x1a0b98[_0x9217('0x13')]},'json':!![]};if(_0x86c47c[_0x9217('0x14')]){_0x38127f[_0x9217('0x15')][_0x9217('0x16')][_0x9217('0x17')]=_0x86c47c['project'];}if(_0x86c47c[_0x9217('0x18')]=='1'){_0x38127f['body'][_0x9217('0x16')][_0x9217('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9217('0x1a')};}if(_0x86c47c[_0x9217('0x1b')]){_0x38127f[_0x9217('0x15')][_0x9217('0x16')][_0x9217('0x1c')]=_0x86c47c[_0x9217('0x1b')];if(_0x86c47c[_0x9217('0x1d')]){_0x38127f[_0x9217('0x15')][_0x9217('0x16')][_0x9217('0x1e')]=_0x86c47c[_0x9217('0x1d')];}}logger[_0x9217('0x1f')](JSON[_0x9217('0x20')](_0x38127f));return rp(_0x38127f);});}; \ No newline at end of file +var _0xeffd=['calleridname','dnid','extension','text','Bearer\x20','project','body','ProjectName','channelData','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xeffd,0x6b));var _0xdeff=function(_0x25ce24,_0x47b355){_0x25ce24=_0x25ce24-0x0;var _0xd4e97b=_0xeffd[_0x25ce24];return _0xd4e97b;};'use strict';var rp=require(_0xdeff('0x0'));var url=require('url');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));module[_0xdeff('0x3')]=function(_0x27f2d0,_0xafbbb1){var _0x4dac0={'method':_0xdeff('0x4'),'uri':url[_0xdeff('0x5')](_0xafbbb1[_0xdeff('0x6')],_0xdeff('0x7')),'form':{'grant_type':_0xdeff('0x8'),'username':_0xafbbb1[_0xdeff('0x9')],'password':_0xafbbb1[_0xdeff('0x8')]},'json':!![]};return rp(_0x4dac0)[_0xdeff('0xa')](function(_0x39878e){var _0x12e953={'method':_0xdeff('0x4'),'uri':url['resolve'](_0xafbbb1[_0xdeff('0xb')],_0xdeff('0xc')),'body':{'type':_0xafbbb1[_0xdeff('0xd')]||'message','channelId':_0xdeff('0xe'),'conversation':{'id':_0x27f2d0[_0xdeff('0xf')]},'from':{'id':_0x27f2d0[_0xdeff('0x10')],'name':_0x27f2d0[_0xdeff('0x11')]},'recipient':{'id':_0x27f2d0[_0xdeff('0x12')],'name':_0x27f2d0[_0xdeff('0x13')]},'text':_0xafbbb1[_0xdeff('0x14')],'channelData':{}},'headers':{'Authorization':_0xdeff('0x15')+_0x39878e['access_token']},'json':!![]};if(_0xafbbb1[_0xdeff('0x16')]){_0x12e953[_0xdeff('0x17')]['channelData'][_0xdeff('0x18')]=_0xafbbb1['project'];}if(_0xafbbb1['ndagenerate_audio']=='1'){_0x12e953[_0xdeff('0x17')][_0xdeff('0x19')][_0xdeff('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdeff('0x1b')};}if(_0xafbbb1['custom_action']){_0x12e953[_0xdeff('0x17')][_0xdeff('0x19')][_0xdeff('0x1c')]=_0xafbbb1[_0xdeff('0x1d')];if(_0xafbbb1[_0xdeff('0x1e')]){_0x12e953[_0xdeff('0x17')]['channelData']['CustomActionData']=_0xafbbb1[_0xdeff('0x1e')];}}logger['info'](JSON['stringify'](_0x12e953));return rp(_0x12e953);});}; \ 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 077e0f4..2344f41 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 _0x48fa=['exports'];(function(_0x43e8d3,_0x53e113){var _0x3831ed=function(_0x101a94){while(--_0x101a94){_0x43e8d3['push'](_0x43e8d3['shift']());}};_0x3831ed(++_0x53e113);}(_0x48fa,0x1b2));var _0xa48f=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x48fa[_0x5f309e];return _0x487b5e;};'use strict';var asr=require('./lib/api');module[_0xa48f('0x0')]=function(_0x558fd0,_0x53fc35,_0x3fb8d7,_0x4aed72){return asr(_0x558fd0,_0x53fc35,_0x3fb8d7,_0x4aed72);}; \ No newline at end of file +var _0x5ec2=['exports'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x5ec2,0xda));var _0x25ec=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x5ec2[_0x16d10f];return _0x50c823;};'use strict';var asr=require('./lib/api');module[_0x25ec('0x0')]=function(_0x44df59,_0x2fe6ee,_0x9f1c4a,_0xd7384f){return asr(_0x44df59,_0x2fe6ee,_0x9f1c4a,_0xd7384f);}; \ 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 ea6d4e6..e8a9b3a 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 _0x3a8a=['Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','lodash','moment','crypto','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','close','send','stringify','terminate','parse','status','result','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error'];(function(_0x3f6068,_0x3da41c){var _0x34136f=function(_0x15a3d6){while(--_0x15a3d6){_0x3f6068['push'](_0x3f6068['shift']());}};_0x34136f(++_0x3da41c);}(_0x3a8a,0x140));var _0xa3a8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3a8a[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require('bluebird');var _=require(_0xa3a8('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa3a8('0x1'));var crypto=require(_0xa3a8('0x2'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0xe19775,_0x481eef,_0x3eac9b,_0x5cb7cc){return new BPromise(function(_0x1aca26,_0x385431){logger['info'](_0xa3a8('0x3'),_0x5cb7cc||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xf9b75f=new WebSocket(_0x5cb7cc||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x520094='';var _0x1f0bb9='0';var _0x2a54e3='1';var _0x161570=_0xa3a8('0x4');function _0x142916(_0x519c29){var _0x338f60=crypto[_0xa3a8('0x5')]('sha1');_0x338f60[_0xa3a8('0x6')](_0x519c29);return _0x338f60[_0xa3a8('0x7')](_0xa3a8('0x8'));}function _0x2fe58b(){try{logger['info'](_0xa3a8('0x9'));var _0x120389=moment()[_0xa3a8('0xa')]();var _0x2dd0f7=_0x142916(_0x120389+_0x481eef+_0x3eac9b);_0xf9b75f['send'](JSON['stringify']({'appID':_0x481eef,'timestamp':_0x120389,'appKey':_0x2dd0f7}));var _0xb72f7f=fs[_0xa3a8('0xb')](_0xe19775);_0xb72f7f['on'](_0xa3a8('0xc'),function(_0x3743c2){_0xf9b75f['send'](_0x3743c2);});_0xb72f7f['on'](_0xa3a8('0xd'),function(){_0xf9b75f[_0xa3a8('0xe')]('EOS');});}catch(_0x543375){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xa3a8('0xf')](_0x543375));_0xf9b75f[_0xa3a8('0x10')]();}}function _0x4fddb4(_0x5ade7c){try{if(_0x5ade7c){var _0x56c5c2=JSON[_0xa3a8('0x11')](_0x5ade7c);switch(_0x56c5c2[_0xa3a8('0x12')]){case 0x0:if(_0x56c5c2[_0xa3a8('0x13')]){if(_0x56c5c2[_0xa3a8('0x13')]['final']){logger[_0xa3a8('0x14')](_0xa3a8('0x15'),JSON['stringify'](_0x56c5c2['result'][_0xa3a8('0x16')]));_0x520094=_0x56c5c2['result'][_0xa3a8('0x16')][0x0][_0xa3a8('0x17')];_0x1f0bb9=_0x56c5c2[_0xa3a8('0x13')][_0xa3a8('0x16')][0x0]['likelihood'];_0x2a54e3='0';_0x161570='Success.';_0xf9b75f[_0xa3a8('0x10')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2a54e3='1';_0x161570='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xa3a8('0x14')](_0xa3a8('0x18'));_0x2a54e3='2';_0x161570='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xa3a8('0x14')](_0xa3a8('0x19'));_0x2a54e3='9';_0x161570=_0xa3a8('0x19');break;case 0xa:logger[_0xa3a8('0x14')](_0xa3a8('0x1a'));_0x2a54e3='10';_0x161570=_0xa3a8('0x1a');break;case 0xb:logger['info'](_0xa3a8('0x1b'));_0x2a54e3='11';_0x161570=_0xa3a8('0x1b');}}}catch(_0x835f0b){logger[_0xa3a8('0x1c')](_0xa3a8('0x1d'),JSON[_0xa3a8('0xf')](_0x835f0b));_0xf9b75f[_0xa3a8('0x10')]();}}function _0x342954(){logger[_0xa3a8('0x14')](_0xa3a8('0x1e'));_0x1aca26({'transcript':_0x520094,'confidence':_0x1f0bb9,'status':_0x2a54e3,'status_message':_0x161570});}function _0x291960(_0x58aca3){logger[_0xa3a8('0x1c')](_0xa3a8('0x1f'));if(!_[_0xa3a8('0x20')](_0x58aca3)){logger[_0xa3a8('0x1c')](_[_0xa3a8('0x21')](_0x58aca3)?JSON[_0xa3a8('0xf')](_0x58aca3):_0x58aca3);}}_0xf9b75f['on']('open',_0x2fe58b);_0xf9b75f['on'](_0xa3a8('0x22'),_0x4fddb4);_0xf9b75f['on']('close',_0x342954);_0xf9b75f['on'](_0xa3a8('0x1c'),_0x291960);});}; \ No newline at end of file +var _0x28f4=['stringify','createReadStream','close','EOS','error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','lodash','moment','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','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send'];(function(_0x16f915,_0x3b7ced){var _0x2a7fa3=function(_0x13ed78){while(--_0x13ed78){_0x16f915['push'](_0x16f915['shift']());}};_0x2a7fa3(++_0x3b7ced);}(_0x28f4,0x1cd));var _0x428f=function(_0x9b9a40,_0x35a836){_0x9b9a40=_0x9b9a40-0x0;var _0x17db24=_0x28f4[_0x9b9a40];return _0x17db24;};'use strict';var BPromise=require(_0x428f('0x0'));var _=require(_0x428f('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x428f('0x2'));var crypto=require(_0x428f('0x3'));var logger=require('../../../../../../config/logger')(_0x428f('0x4'));module[_0x428f('0x5')]=function(_0x2a9b64,_0x17317d,_0x36f035,_0x3940f7){return new BPromise(function(_0x5d178a,_0x59e714){logger[_0x428f('0x6')](_0x428f('0x7'),_0x3940f7||_0x428f('0x8'));var _0x26ac17=new WebSocket(_0x3940f7||_0x428f('0x8'),{'perMessageDeflate':![]});var _0x55f244='';var _0x38cc0a='0';var _0x47600d='1';var _0x2b88d9=_0x428f('0x9');function _0x9283ea(_0x559722){var _0x52617f=crypto['createHash'](_0x428f('0xa'));_0x52617f[_0x428f('0xb')](_0x559722);return _0x52617f[_0x428f('0xc')]('hex');}function _0x207fbf(){try{logger[_0x428f('0x6')](_0x428f('0xd'));var _0x16d49e=moment()['unix']();var _0xc91793=_0x9283ea(_0x16d49e+_0x17317d+_0x36f035);_0x26ac17[_0x428f('0xe')](JSON[_0x428f('0xf')]({'appID':_0x17317d,'timestamp':_0x16d49e,'appKey':_0xc91793}));var _0x21e059=fs[_0x428f('0x10')](_0x2a9b64);_0x21e059['on']('data',function(_0x56cd67){_0x26ac17[_0x428f('0xe')](_0x56cd67);});_0x21e059['on'](_0x428f('0x11'),function(){_0x26ac17[_0x428f('0xe')](_0x428f('0x12'));});}catch(_0x2bda23){logger[_0x428f('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x428f('0xf')](_0x2bda23));_0x26ac17[_0x428f('0x14')]();}}function _0x2e58f2(_0x23561d){try{if(_0x23561d){var _0x5df563=JSON[_0x428f('0x15')](_0x23561d);switch(_0x5df563['status']){case 0x0:if(_0x5df563[_0x428f('0x16')]){if(_0x5df563[_0x428f('0x16')][_0x428f('0x17')]){logger['info'](_0x428f('0x18'),JSON[_0x428f('0xf')](_0x5df563[_0x428f('0x16')]['hypotheses']));_0x55f244=_0x5df563[_0x428f('0x16')][_0x428f('0x19')][0x0][_0x428f('0x1a')];_0x38cc0a=_0x5df563['result'][_0x428f('0x19')][0x0][_0x428f('0x1b')];_0x47600d='0';_0x2b88d9=_0x428f('0x1c');_0x26ac17[_0x428f('0x14')]();}}break;case 0x1:logger[_0x428f('0x6')](_0x428f('0x9'));_0x47600d='1';_0x2b88d9=_0x428f('0x9');break;case 0x2:logger[_0x428f('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x47600d='2';_0x2b88d9='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x428f('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x47600d='9';_0x2b88d9='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x47600d='10';_0x2b88d9='Authentication\x20failed.';break;case 0xb:logger[_0x428f('0x6')](_0x428f('0x1d'));_0x47600d='11';_0x2b88d9=_0x428f('0x1d');}}}catch(_0x37bef9){logger[_0x428f('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x428f('0xf')](_0x37bef9));_0x26ac17['terminate']();}}function _0x14acd7(){logger[_0x428f('0x6')](_0x428f('0x1e'));_0x5d178a({'transcript':_0x55f244,'confidence':_0x38cc0a,'status':_0x47600d,'status_message':_0x2b88d9});}function _0x36e4b8(_0x150e38){logger[_0x428f('0x13')](_0x428f('0x1f'));if(!_['isNil'](_0x150e38)){logger[_0x428f('0x13')](_[_0x428f('0x20')](_0x150e38)?JSON['stringify'](_0x150e38):_0x150e38);}}_0x26ac17['on']('open',_0x207fbf);_0x26ac17['on'](_0x428f('0x21'),_0x2e58f2);_0x26ac17['on'](_0x428f('0x11'),_0x14acd7);_0x26ac17['on'](_0x428f('0x13'),_0x36e4b8);});}; \ 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 40dbfa9..7eff658 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 _0x4838=['exports','./asr'];(function(_0x3dbe83,_0x4e82a1){var _0x42931f=function(_0x54d04c){while(--_0x54d04c){_0x3dbe83['push'](_0x3dbe83['shift']());}};_0x42931f(++_0x4e82a1);}(_0x4838,0x131));var _0x8483=function(_0x3688bd,_0x288623){_0x3688bd=_0x3688bd-0x0;var _0x3c374c=_0x4838[_0x3688bd];return _0x3c374c;};var asr=require(_0x8483('0x0'));module[_0x8483('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe439=['exports','./asr'];(function(_0x245e8f,_0x5706dc){var _0x3a8cb9=function(_0x2f5d9b){while(--_0x2f5d9b){_0x245e8f['push'](_0x245e8f['shift']());}};_0x3a8cb9(++_0x5706dc);}(_0xe439,0x6d));var _0x9e43=function(_0x32a0f2,_0x428728){_0x32a0f2=_0x32a0f2-0x0;var _0x3e87e0=_0xe439[_0x32a0f2];return _0x3e87e0;};var asr=require(_0x9e43('0x0'));module[_0x9e43('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 40f1f28..6c79a70 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(_0x302d1a,_0x387081){var _0xd82ca=function(_0x24912b){while(--_0x24912b){_0x302d1a['push'](_0x302d1a['shift']());}};_0xd82ca(++_0x387081);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a96a018..ad807a0 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 _0xcffe=['uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','parse','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','toUpperCase','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','response','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','unlink','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','no\x20variable\x20found','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','user','bcc','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xcffe,0x1a1));var _0xecff=function(_0x565faf,_0x5f3718){_0x565faf=_0x565faf-0x0;var _0x42292f=_0xcffe[_0x565faf];return _0x42292f;};'use strict';var fs=require('fs');var util=require(_0xecff('0x0'));var _=require(_0xecff('0x1'));var sh=require(_0xecff('0x2'));var odbc=require(_0xecff('0x3'))();var rs=require(_0xecff('0x4'));var moment=require(_0xecff('0x5'));var Mustache=require(_0xecff('0x6'));var rp=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0xecff('0xa'));var FILES_PATH=_0xecff('0xb');var recursiveMapAttributes=[_0xecff('0xc'),_0xecff('0xd')];var verticesWithRetry=[_0xecff('0xe'),_0xecff('0xf'),_0xecff('0x10')];var AGIVertices=function(_0x4d4458,_0x672de1,_0x3eefb9){this[_0xecff('0x11')]=_0x4d4458;this[_0xecff('0x12')]=_0x672de1;this[_0xecff('0x13')]=_0x3eefb9;};AGIVertices['prototype'][_0xecff('0x14')]=function(_0x22ce83,_0x346f02){this[_0xecff('0x12')][_0xecff('0x15')](_0x22ce83)[_0xecff('0x16')](function(_0x16c5dd){_0x346f02(null,_0x16c5dd?_0x16c5dd[_0xecff('0x17')]:![]);})[_0xecff('0x18')](function(_0x151a79){_0x346f02(_0x151a79);});};AGIVertices[_0xecff('0x19')][_0xecff('0x1a')]=function(_0x1e5973,_0xb8745f){this['rpc']['getVoiceQueueById'](_0x1e5973)[_0xecff('0x16')](function(_0x2e1d6f){_0xb8745f(null,_0x2e1d6f?_0x2e1d6f['name']:![]);})[_0xecff('0x18')](function(_0x362ed0){_0xb8745f(_0x362ed0);});};AGIVertices[_0xecff('0x19')]['getSquareProject']=function(_0x52b62f,_0x24abef){this[_0xecff('0x12')]['getSquareProjectById'](_0x52b62f)[_0xecff('0x16')](function(_0x3adc81){_0x24abef(null,_0x3adc81?_0x3adc81[_0xecff('0x17')]:![]);})[_0xecff('0x18')](function(_0x2fc1f9){_0x24abef(_0x2fc1f9);});};AGIVertices[_0xecff('0x19')]['getSquareOdbc']=function(_0x229728,_0x422bd8){this[_0xecff('0x12')][_0xecff('0x1b')](_0x229728)['then'](function(_0x4bb94e){_0x422bd8(null,_0x4bb94e?_0x4bb94e[_0xecff('0x1c')]:![]);})[_0xecff('0x18')](function(_0x333eb7){_0x422bd8(_0x333eb7);});};AGIVertices[_0xecff('0x19')][_0xecff('0x1d')]=function(_0x494754,_0x14378d){this['rpc']['getUserById'](_0x494754)[_0xecff('0x16')](function(_0x4fdc8e){_0x14378d(null,_0x4fdc8e?_0x4fdc8e[_0xecff('0x17')]:![]);})['catch'](function(_0x389281){_0x14378d(_0x389281);});};AGIVertices['prototype'][_0xecff('0x1e')]=function(_0x44f5f7,_0x505e20){this[_0xecff('0x12')][_0xecff('0x1f')](_0x44f5f7)[_0xecff('0x16')](function(_0x3cadb9){_0x505e20(null,_0x3cadb9?_0x3cadb9[_0xecff('0x17')]:![]);})['catch'](function(_0x4f987b){_0x505e20(_0x4f987b);});};AGIVertices[_0xecff('0x19')]['getSound']=function(_0x1281d8,_0x3ef198){var _0x49a224=this;this[_0xecff('0x12')]['getSoundById'](_0x1281d8)['then'](function(_0x55502f){_0x3ef198(null,_0x55502f?_0x49a224[_0xecff('0x20')](_0x55502f[_0xecff('0x21')]):![]);})[_0xecff('0x18')](function(_0x1e3175){_0x3ef198(_0x1e3175);});};AGIVertices['prototype'][_0xecff('0x22')]=function(_0x46372c,_0x1926a5){this['rpc'][_0xecff('0x23')](_0x46372c)[_0xecff('0x16')](function(_0x266ef7){_0x1926a5(null,_0x266ef7?_0x266ef7:![]);})[_0xecff('0x18')](function(_0x58c569){_0x1926a5(_0x58c569);});};AGIVertices[_0xecff('0x19')][_0xecff('0x24')]=function(_0x4ab731,_0x222df6,_0x2921b4){this[_0xecff('0x13')][_0xecff('0x24')](_0x4ab731,_0x222df6)['then'](function(){_0x2921b4(null);})[_0xecff('0x18')](function(_0x298c34){_0x2921b4(_0x298c34);});};AGIVertices[_0xecff('0x19')]['getIntervals']=function(_0x46f42a,_0x154d7a){this[_0xecff('0x12')][_0xecff('0x25')](_0x46f42a)[_0xecff('0x16')](function(_0x20db12){if(_0x20db12){if(_0x20db12['IntervalId']){_0x154d7a(null,[_0x20db12['interval']]);}else{_0x154d7a(null,_['map'](_0x20db12[_0xecff('0x26')],'interval'));}}else{_0x154d7a(null,![]);}})[_0xecff('0x18')](function(_0x21411b){_0x154d7a(_0x21411b);});};AGIVertices['prototype'][_0xecff('0x20')]=function(_0x9c83d6){return util[_0xecff('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x9c83d6);};AGIVertices[_0xecff('0x19')][_0xecff('0x28')]=function(_0x32e9a7,_0x478f17,_0x1c8291){odbc[_0xecff('0x29')](_0x32e9a7,function(_0x226c01){if(_0x226c01){logger[_0xecff('0x2a')](_0xecff('0x2b'),_0x226c01);_0x1c8291(_0x226c01);}else{logger[_0xecff('0x2c')](_0xecff('0x2d'));odbc[_0xecff('0x2e')](_0x478f17,function(_0x6d3916,_0x418466){if(_0x6d3916){logger[_0xecff('0x2c')]('Error\x20executing\x20query\x20%s',_0x478f17);_0x1c8291(_0x6d3916);}else{logger[_0xecff('0x2c')](_0xecff('0x2f'),_0x478f17);odbc[_0xecff('0x30')](function(_0xb7679d){if(_0xb7679d){logger[_0xecff('0x2a')](_0xecff('0x31'),_0xb7679d);}_0x1c8291(null,_0x418466);});}});}});};AGIVertices[_0xecff('0x19')][_0xecff('0x32')]=function(_0x528548,_0x28141f){this['rpc'][_0xecff('0x33')](_0x528548)[_0xecff('0x16')](function(_0x307e40){_0x28141f(null,_0x307e40?_0x307e40:![]);})[_0xecff('0x18')](function(_0x1803e0){_0x28141f(_0x1803e0);});};AGIVertices[_0xecff('0x19')][_0xecff('0x34')]=function(_0x55e2ae,_0x307b99){this[_0xecff('0x12')]['createSmsMessage'](_0x55e2ae)['then'](function(_0x3a7ebc){_0x307b99(null,_0x3a7ebc);})[_0xecff('0x18')](function(_0x27f0dd){_0x307b99(_0x27f0dd);});};AGIVertices[_0xecff('0x19')][_0xecff('0x35')]=function(_0xb9117c,_0x556faa,_0x3c2108){this[_0xecff('0x12')]['createSquareDetailsReport']({'uniqueid':this[_0xecff('0x11')][_0xecff('0x36')],'node':_0xb9117c[_0xecff('0x37')],'application':_0xb9117c[_0xecff('0x38')],'data':_0x556faa||null,'project_name':this[_0xecff('0x11')][_0xecff('0x39')],'callerid':this['channel'][_0xecff('0x3a')]})[_0xecff('0x16')](function(_0x1dab33){if(_0x3c2108){_0x3c2108(null,_0x1dab33);}})['catch'](function(_0x133715){if(_0x3c2108){_0x3c2108(_0x133715);}});};AGIVertices[_0xecff('0x19')][_0xecff('0x3b')]=function(_0x3c73ca,_0x515440,_0x1accb2,_0x20ed00){this['rpc'][_0xecff('0x3b')]({'uniqueid':this[_0xecff('0x11')]['uniqueid'],'callerid':this[_0xecff('0x11')]['callerid'],'calleridname':this[_0xecff('0x11')][_0xecff('0x3c')],'context':this[_0xecff('0x11')][_0xecff('0x3d')],'extension':this[_0xecff('0x11')][_0xecff('0x3e')],'priority':this['channel']['priority'],'accountcode':this[_0xecff('0x11')][_0xecff('0x3f')],'dnid':this[_0xecff('0x11')][_0xecff('0x40')],'projectName':this[_0xecff('0x11')][_0xecff('0x39')],'saveName':_0x515440,'filename':_0x3c73ca[_0xecff('0x41')]||_0x515440,'savePath':_0x1accb2})[_0xecff('0x16')](function(_0x4972c9){_0x20ed00(null,_0x4972c9);})[_0xecff('0x18')](function(_0x332576){_0x20ed00(_0x332576);});};AGIVertices['prototype'][_0xecff('0x42')]=function(_0x576aa9,_0x460fd5,_0x453e4c,_0x481efa,_0x2ef3e5){this[_0xecff('0x12')][_0xecff('0x42')]({'uniqueid':this[_0xecff('0x11')][_0xecff('0x36')],'body':_0x576aa9,'direction':_0x460fd5,'providerName':_0x453e4c,'providerResponse':_0x481efa})['then'](function(_0x57fb15){if(_0x2ef3e5){_0x2ef3e5(null,_0x57fb15);}})[_0xecff('0x18')](function(_0x14998b){if(_0x2ef3e5){_0x2ef3e5(_0x14998b);}});};AGIVertices[_0xecff('0x19')][_0xecff('0x43')]=function(_0x3df7e7,_0xfcd8c3){this[_0xecff('0x12')][_0xecff('0x43')]({'firstName':_[_0xecff('0x44')](_0x3df7e7['name'])||_[_0xecff('0x45')](_0x3df7e7['name'])?_0xecff('0x46')+Math[_0xecff('0x47')]():_0x3df7e7[_0xecff('0x17')],'lastName':_['isEmpty'](_0x3df7e7[_0xecff('0x48')])||_['isNil'](_0x3df7e7[_0xecff('0x48')])?null:_0x3df7e7['lastName'],'phone':_0x3df7e7['phone'],'ListId':_0x3df7e7[_0xecff('0x49')],'scheduledat':_0x3df7e7['scheduledAt'],'callbackUniqueid':this[_0xecff('0x11')][_0xecff('0x36')],'tags':'callback','description':_0xecff('0x4a')+_0x3df7e7[_0xecff('0x4b')][_0xecff('0x4c')](),'priority':_0x3df7e7[_0xecff('0x4d')]})[_0xecff('0x16')](function(_0x162938){_0xfcd8c3(null,_0x162938);})[_0xecff('0x18')](function(_0x574c40){_0xfcd8c3(_0x574c40);});};AGIVertices['prototype'][_0xecff('0x4e')]=function(_0x36525d,_0x18ead4){this[_0xecff('0x12')][_0xecff('0x4f')](_0x36525d)[_0xecff('0x16')](function(_0x29d4d5){_0x18ead4(null,_0x29d4d5?_0x29d4d5[_0xecff('0x17')]:![]);})[_0xecff('0x18')](function(_0x322438){_0x18ead4(_0x322438);});};AGIVertices[_0xecff('0x19')][_0xecff('0x50')]=function(_0x3f8e22,_0x88882b,_0x4e56c0){var _0x5b9c37={'role':_0xecff('0x51')};_0x5b9c37[_0x3f8e22]=this['channel']['callerid'];this[_0xecff('0x12')][_0xecff('0x50')](_0x5b9c37,_0x88882b,this[_0xecff('0x11')]['uniqueid'])[_0xecff('0x16')](function(_0x1eabd0){_0x4e56c0(null,_[_0xecff('0x45')](_0x1eabd0)?![]:!![]);})['catch'](function(_0x781722){logger['error'](_0x781722);_0x4e56c0(null,![]);});};AGIVertices['prototype'][_0xecff('0x52')]=function(_0xf8b6d4,_0x10275d){var _0x168d3f={'role':_0xecff('0x51')};_0x168d3f[_0xf8b6d4]=this[_0xecff('0x11')][_0xecff('0x3a')];this[_0xecff('0x12')][_0xecff('0x52')](_0x168d3f)[_0xecff('0x16')](function(_0x1d612c){_0x10275d(null,_[_0xecff('0x45')](_0x1d612c)?![]:!![]);})[_0xecff('0x18')](function(_0x3042c3){logger['error'](_0x3042c3);_0x10275d(null,![]);});};AGIVertices['prototype'][_0xecff('0x53')]=function(_0x4024ac,_0x4c0b1c){var _0x15be2b={'role':_0xecff('0x51')};_0x15be2b[_0x4024ac]=this['channel'][_0xecff('0x3a')];this[_0xecff('0x12')][_0xecff('0x53')](_0x15be2b)[_0xecff('0x16')](function(_0x20e8ab){_0x4c0b1c(null,_[_0xecff('0x45')](_0x20e8ab)?![]:!![]);})['catch'](function(_0x1c7d9c){logger[_0xecff('0x2a')](_0x1c7d9c);_0x4c0b1c(null,![]);});};AGIVertices[_0xecff('0x19')][_0xecff('0x54')]=function(_0x17c31f,_0x55ea2d){var _0x31cd2d={'role':_0xecff('0x51')};_0x31cd2d[_0x17c31f]=this[_0xecff('0x11')][_0xecff('0x3a')];var _0x5661b5=_0x17c31f!='internal'?util['format'](_0xecff('0x55'),_0xecff('0x56'),this[_0xecff('0x11')]['callerid']):undefined;this[_0xecff('0x12')]['agentLogin'](_0x31cd2d,_0x5661b5)[_0xecff('0x16')](function(_0x3e3197){_0x55ea2d(null,_[_0xecff('0x45')](_0x3e3197)?![]:!![]);})[_0xecff('0x18')](function(_0x492751){logger[_0xecff('0x2a')](_0x492751);_0x55ea2d(null,![]);});};AGIVertices[_0xecff('0x19')][_0xecff('0x57')]=function(_0x4dfd1d,_0x5dd627){sh[_0xecff('0x58')](_[_0xecff('0x59')](_0x4dfd1d),function(_0x5570aa,_0x2f4d24){var _0x3756fe=_0x2f4d24[_0xecff('0x5a')](/(\r\n|\n|\r)/gm,'');_0x5dd627(null,_0x3756fe);});};AGIVertices[_0xecff('0x19')][_0xecff('0x5b')]=function(_0x5499fb,_0x4f0d7f){scripts[_0xecff('0x5b')](_0x5499fb[_0xecff('0x5c')],_0x5499fb['google_cloud_tts_text_type']||'text',_0x5499fb[_0xecff('0x5d')],_0x5499fb['languageCode']||_0xecff('0x5e'),_0x5499fb[_0xecff('0x5f')]||'MALE',_0x5499fb[_0xecff('0x60')]||_0xecff('0x61'))[_0xecff('0x16')](function(_0x3f6444){_0x4f0d7f(null,_0x3f6444);})[_0xecff('0x18')](function(_0x11648c){_0x4f0d7f(_0x11648c);});};AGIVertices[_0xecff('0x19')][_0xecff('0x62')]=function(_0x5b8a4c,_0x290a43){scripts['googleTTS'](_0x5b8a4c['text'],_0x5b8a4c[_0xecff('0x63')]||'en',0x1)['then'](function(_0x4932ff){_0x290a43(null,_0x4932ff);})[_0xecff('0x18')](function(_0x16669b){_0x290a43(_0x16669b);});};AGIVertices[_0xecff('0x19')][_0xecff('0x64')]=function(_0x13ad89,_0x58c36a){var _0x46e71c={'uri':_0x13ad89[_0xecff('0x65')],'method':_0x13ad89[_0xecff('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x13ad89[_0xecff('0x67')])===_0xecff('0x68')&&parseInt(_0x13ad89['timeout'])>=0x1?parseInt(_0x13ad89[_0xecff('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xecff('0x69')]([_0xecff('0x6a'),_0xecff('0x6b')],_0x46e71c[_0xecff('0x66')]['toUpperCase']())){try{_0x46e71c['body']=_0x13ad89[_0xecff('0xd')]?JSON['parse'](_0x13ad89['rawBody']):{};}catch(_0x26593b){logger['error'](_0xecff('0x6c'),_0x26593b);}}try{_0x46e71c['headers']=_0x13ad89['rawHeaders']?JSON['parse'](_0x13ad89['rawHeaders']):{};}catch(_0x2fda07){logger[_0xecff('0x2a')](_0xecff('0x6d'),_0x2fda07);}if(_0x13ad89[_0xecff('0x6e')]){try{var _0x47037c=require(_0x13ad89[_0xecff('0x6e')])[_0xecff('0x6f')](this,_0x46e71c);_0x46e71c[_0xecff('0x70')]=Mustache[_0xecff('0x71')](_0x13ad89[_0xecff('0x65')],_0x47037c,{},['$$','$$']);if(_0x46e71c['headers']){_0x46e71c[_0xecff('0x72')]=JSON[_0xecff('0x73')](Mustache[_0xecff('0x71')](JSON[_0xecff('0x74')](_0x46e71c[_0xecff('0x72')]),_0x47037c,{},['$$','$$']));}if(_0x46e71c['body']){_0x46e71c[_0xecff('0x75')]=JSON[_0xecff('0x73')](Mustache[_0xecff('0x71')](JSON['stringify'](_0x46e71c[_0xecff('0x75')]),_0x47037c,{},['$$','$$']));}}catch(_0x4f2af6){logger[_0xecff('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4f2af6);}}rp(_0x46e71c)[_0xecff('0x16')](function(_0x1fd6df){var _0x2d934a={'statusCode':_0x1fd6df[_0xecff('0x76')]||0xc8,'statusMessage':_0x1fd6df[_0xecff('0x77')]||'OK','headers':_0x1fd6df['headers']||{},'body':_0x1fd6df[_0xecff('0x75')]||{}};_0x58c36a(null,_0x2d934a);})[_0xecff('0x18')](function(_0x537151){var _0x49c50e={'statusCode':_0x537151[_0xecff('0x76')]||0x1f4,'statusMessage':_0x537151[_0xecff('0x78')]||_0xecff('0x79'),'headers':_0x537151[_0xecff('0x7a')]['headers']||{},'body':_0x537151[_0xecff('0x7a')][_0xecff('0x75')]||{}};_0x58c36a(null,_0x49c50e);});};AGIVertices['prototype'][_0xecff('0x7b')]=function(_0x4ee355,_0x565905){scripts[_0xecff('0x7b')](this['channel'][_0xecff('0x36')],_0x4ee355[_0xecff('0x7c')],_0x4ee355[_0xecff('0x5d')],_0x4ee355[_0xecff('0x7d')]||'en')[_0xecff('0x16')](function(_0x4c28f0){_0x565905(null,_0x4c28f0);})['catch'](function(_0x5c4359){_0x565905(_0x5c4359);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x1b3de4,_0x5a1ca5){scripts[_0xecff('0x7e')](this[_0xecff('0x11')][_0xecff('0x36')],_0x1b3de4['dialogflowV2_project_id'],_0x1b3de4[_0xecff('0x7f')],_0x1b3de4['private_key'],_0x1b3de4['text'],_0x1b3de4[_0xecff('0x80')]||'en')[_0xecff('0x16')](function(_0x4fd43d){_0x5a1ca5(null,_0x4fd43d);})[_0xecff('0x18')](function(_0xe7ec21){_0x5a1ca5(_0xe7ec21);});};AGIVertices[_0xecff('0x19')][_0xecff('0x81')]=function(_0x2d743a,_0x24f60b){scripts['sestekNDA'](this['channel'],_0x2d743a)[_0xecff('0x16')](function(_0x37e9f8){_0x24f60b(null,_0x37e9f8);})['catch'](function(_0x44db60){_0x24f60b(_0x44db60);});};AGIVertices[_0xecff('0x19')][_0xecff('0x82')]=function(_0x485eae,_0x284680){scripts[_0xecff('0x82')](_0x485eae[_0xecff('0x7c')],_0x485eae[_0xecff('0x5d')],_0x485eae['ispeech_tts_language']||_0xecff('0x5e'),_0x485eae['speed'])['then'](function(_0x1defc5){_0x284680(null,_0x1defc5);})[_0xecff('0x18')](function(_0x5bf4dc){_0x284680(_0x5bf4dc);});};AGIVertices['prototype'][_0xecff('0x83')]=function(_0x3763ae,_0x2066a7,_0x500c2e){scripts[_0xecff('0x83')](_0x2066a7,_0x3763ae[_0xecff('0x7c')],_0x3763ae[_0xecff('0x84')]||'en-US',this[_0xecff('0x85')](_0x3763ae[_0xecff('0x86')])?_0x3763ae[_0xecff('0x86')]:undefined)[_0xecff('0x16')](function(_0x426947){_0x500c2e(null,_0x426947);})[_0xecff('0x18')](function(_0x532586){_0x500c2e(_0x532586);});};AGIVertices[_0xecff('0x19')][_0xecff('0x87')]=function(_0x285578,_0x1dfaef){scripts[_0xecff('0x87')](_0x285578['aws_access_key_id'],_0x285578[_0xecff('0x88')],_0x285578[_0xecff('0x89')],_0x285578['aws_polly_voice']||_0xecff('0x8a'),_0x285578[_0xecff('0x5d')],_0x285578['aws_text_type']||_0xecff('0x5d'))[_0xecff('0x16')](function(_0x278cf2){_0x1dfaef(null,_0x278cf2);})[_0xecff('0x18')](function(_0x2d5fd1){_0x1dfaef(_0x2d5fd1);});};AGIVertices['prototype'][_0xecff('0x8b')]=function(_0x5b3ba6,_0x5341b4){scripts[_0xecff('0x8b')](this[_0xecff('0x11')][_0xecff('0x36')],_0x5b3ba6['aws_access_key_id'],_0x5b3ba6['aws_secret_access_key'],_0x5b3ba6[_0xecff('0x8c')],_0x5b3ba6[_0xecff('0x5d')],_0x5b3ba6['aws_bot_name'])['then'](function(_0x119e9f){_0x5341b4(null,_0x119e9f);})['catch'](function(_0x4e4ac7){_0x5341b4(_0x4e4ac7);});};AGIVertices[_0xecff('0x19')]['googleASR']=function(_0x4c9d6f,_0x7f34ca,_0x3a5708){scripts[_0xecff('0x8d')](_0x7f34ca,_0x4c9d6f[_0xecff('0x7c')],_0x4c9d6f[_0xecff('0x8e')]||_0xecff('0x5e'))[_0xecff('0x16')](function(_0x39b6fc){_0x3a5708(null,_0x39b6fc);})[_0xecff('0x18')](function(_0x593c35){_0x3a5708(_0x593c35);});};AGIVertices[_0xecff('0x19')][_0xecff('0x8f')]=function(_0xef8d35,_0x526400,_0x5f342b){scripts[_0xecff('0x8f')](_0x526400,_0xef8d35[_0xecff('0x90')],_0xef8d35[_0xecff('0x91')],_0xef8d35[_0xecff('0x70')])[_0xecff('0x16')](function(_0x30bd2b){_0x5f342b(null,_0x30bd2b);})[_0xecff('0x18')](function(_0x237497){_0x5f342b(_0x237497);});};AGIVertices[_0xecff('0x19')][_0xecff('0x92')]=function(_0x28675){var _0x3040dd=_[_0xecff('0x69')](verticesWithRetry,_0x28675[_0xecff('0x38')])?_0x28675:_['clone'](_0x28675);for(var _0x3b4dc0 in _0x3040dd){if(_0x3040dd[_0xecff('0x93')](_0x3b4dc0)){if(_0x3040dd[_0x3b4dc0]&&_[_0xecff('0x94')](_0x3040dd[_0x3b4dc0])){if(_['includes'](recursiveMapAttributes,_0x3b4dc0)){_0x3040dd[_0x3b4dc0]=this[_0xecff('0x95')](_0x3040dd[_0x3b4dc0]);}else{_0x3040dd[_0x3b4dc0]=this['replaceAllVariables'](_0x3040dd[_0x3b4dc0]);}}}}return _0x3040dd;};AGIVertices[_0xecff('0x19')][_0xecff('0x96')]=function(_0x16690e){for(var _0xf1ed3e in _0x16690e){if(_0x16690e['hasOwnProperty'](_0xf1ed3e)){if(_[_0xecff('0x97')](_0x16690e[_0xf1ed3e])){this[_0xecff('0x96')](_0x16690e[_0xf1ed3e]);}else if(_[_0xecff('0x98')](_0x16690e[_0xf1ed3e])){for(var _0x50ea77=0x0;_0x50ea77<_0x16690e[_0xf1ed3e][_0xecff('0x99')];_0x50ea77++){this[_0xecff('0x96')](_0x16690e[_0xf1ed3e][_0x50ea77]);}}else if(_[_0xecff('0x94')](_0x16690e[_0xf1ed3e])){_0x16690e[_0xf1ed3e]=this[_0xecff('0x9a')](_0x16690e[_0xf1ed3e]);}}}};AGIVertices['prototype'][_0xecff('0x9b')]=function(_0x3fac84,_0x1c39c7){for(var _0x15dda4 in _0x3fac84){if(_0x3fac84['hasOwnProperty'](_0x15dda4)){if(_[_0xecff('0x97')](_0x3fac84[_0x15dda4])){if(!_['isEmpty'](_0x3fac84[_0x15dda4])){this['saveRestApiResult'](_0x3fac84[_0x15dda4],util[_0xecff('0x27')](_0xecff('0x9c'),_0x1c39c7,_0x15dda4));}}else if(_[_0xecff('0x98')](_0x3fac84[_0x15dda4])){for(var _0x5f8315=0x0;_0x5f8315<_0x3fac84[_0x15dda4][_0xecff('0x99')];_0x5f8315++){this['saveRestApiResult'](_0x3fac84[_0x15dda4][_0x5f8315],util[_0xecff('0x27')](_0xecff('0x9c'),_0x1c39c7,_0x15dda4+'['+_0x5f8315+']'));}}else{if(!_[_0xecff('0x45')](_0x3fac84[_0x15dda4])){this[_0xecff('0x11')][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0x9c'),_0x1c39c7,_0x15dda4),_0x3fac84[_0x15dda4]);}}}}};AGIVertices[_0xecff('0x19')][_0xecff('0x95')]=function(_0x2055a1){try{var _0x31859b=JSON['parse'](_0x2055a1);this[_0xecff('0x96')](_0x31859b);return JSON[_0xecff('0x74')](_0x31859b);}catch(_0x14240e){return this[_0xecff('0x9a')](_0x2055a1);}};AGIVertices[_0xecff('0x19')][_0xecff('0x9a')]=function(_0x8e0c05){var _0x1f617e=_0x8e0c05[_0xecff('0x9e')]('{');for(var _0x5b0b3c=0x1;_0x5b0b3c<_0x1f617e[_0xecff('0x99')];_0x5b0b3c+=0x1){var _0x1acca7=_0x1f617e[_0x5b0b3c]['split']('}');if(_0x1acca7[_0xecff('0x99')]>0x1){_0x8e0c05=_0x8e0c05[_0xecff('0x9f')]('{'+_0x1acca7[0x0]+'}',this[_0xecff('0x11')]['getVariable'](_0x1acca7[0x0])[_0xecff('0xa0')]||_0x1acca7[0x0]);}}if(_0x1f617e[_0xecff('0x99')]===0x1){return _0x8e0c05['toString']();}return this[_0xecff('0x9a')](_0x8e0c05);};AGIVertices['prototype'][_0xecff('0xa1')]=function(_0x59859d,_0x261b2d){var _0x154ae3=this['channel'][_0xecff('0x14')](_0x59859d);if(_0x154ae3[_0xecff('0xa2')]===-0x1){return _0x154ae3;}logger[_0xecff('0x2c')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x261b2d,_0x154ae3['extra']));return this[_0xecff('0x11')]['setVariable'](_0x261b2d,_0x154ae3[_0xecff('0xa0')]);};AGIVertices[_0xecff('0x19')][_0xecff('0x85')]=function(_0x1c2b1c){return _0x1c2b1c&&_0x1c2b1c!=='0'&&_0x1c2b1c!=='-1'&&_0x1c2b1c!=='';};AGIVertices[_0xecff('0x19')]['maxRetry']=function(_0x1d5840){this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x1d5840,'-');_0x1d5840[_0xecff('0xa3')]=_0x1d5840[_0xecff('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0xd140c6){logger['info'](util[_0xecff('0x27')](_0xecff('0xa5'),_0xd140c6[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0xd140c6[_0xecff('0x5d')])){return this[_0xecff('0x11')]['noop']('no\x20text\x20configured');}var _0x4d4f73='\x22'+_0xd140c6['text']+'\x22';if(this[_0xecff('0x85')](_0xd140c6[_0xecff('0x7a')])){_0x4d4f73+=','+_0xd140c6['options'];}var _0x539125=this[_0xecff('0x11')][_0xecff('0x58')](_0xecff('0xa6'),_0x4d4f73);if(_0x539125[_0xecff('0xa2')]===-0x1){return _0x539125;}return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4d4f73));};AGIVertices[_0xecff('0x19')][_0xecff('0xa8')]=function(_0x25c40c){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0xa9'),_0x25c40c[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x25c40c[_0xecff('0xaa')])){return this[_0xecff('0x11')]['noop'](_0xecff('0xab'));}var _0x34ea10=_0x25c40c['grammar'];if(this[_0xecff('0x85')](_0x25c40c[_0xecff('0x7a')])){_0x34ea10+=','+_0x25c40c[_0xecff('0x7a')];}var _0x5bb321=this[_0xecff('0x11')][_0xecff('0x58')]('MRCPRecog',_0x34ea10);if(_0x5bb321[_0xecff('0xa2')]===-0x1){return _0x5bb321;}var _0x56ea12=this[_0xecff('0xa1')]('RECOG_CONFIDENCE()',_0xecff('0xac'));if(_0x56ea12['result']===-0x1){return _0x56ea12;}var _0x1efe31=this[_0xecff('0xa1')](_0xecff('0xad'),_0xecff('0xae'));if(_0x1efe31['result']===-0x1){return _0x1efe31;}var _0x2f2188=this[_0xecff('0xa1')](_0xecff('0xaf'),_0xecff('0xb0'));if(_0x2f2188[_0xecff('0xa2')]===-0x1){return _0x2f2188;}return this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0xb1'),_0x34ea10));};AGIVertices[_0xecff('0x19')][_0xecff('0x9')]=function(_0x1e617f){logger[_0xecff('0x2c')](util[_0xecff('0x27')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1e617f[_0xecff('0x37')]));return this['channel']['agi']([_0x1e617f[_0xecff('0xb2')],_0x1e617f['args']]);};AGIVertices['prototype'][_0xecff('0xb3')]=function(_0x1d88dc){logger[_0xecff('0x2c')](util['format'](_0xecff('0xb4'),_0x1d88dc[_0xecff('0x37')]));if(this[_0xecff('0x85')](_0x1d88dc[_0xecff('0x67')])){logger['info'](util[_0xecff('0x27')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x1d88dc[_0xecff('0x67')]));var _0x5af80f=this[_0xecff('0x11')][_0xecff('0xb5')](_0x1d88dc[_0xecff('0x67')]);if(_0x5af80f[_0xecff('0xa2')]===-0x1){return _0x5af80f;}}return this[_0xecff('0x11')][_0xecff('0xb3')]();};AGIVertices[_0xecff('0x19')][_0xecff('0xb6')]=function(_0x53f7fb){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0xb7'),_0x53f7fb[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x53f7fb[_0xecff('0x49')])){return this[_0xecff('0x11')]['error'](_0x53f7fb,_0xecff('0xb8'));}_0x53f7fb['scheduledAt']=moment();if(this[_0xecff('0x85')](_0x53f7fb[_0xecff('0xb9')])){_0x53f7fb['scheduledAt']=moment()[_0xecff('0xba')](_0x53f7fb[_0xecff('0xb9')],_0xecff('0xbb'));}if(!this[_0xecff('0x85')](_0x53f7fb[_0xecff('0x4d')])){_0x53f7fb['callback_priority']=0x2;}this['createCmContact'][_0xecff('0x6f')](this,_0x53f7fb);return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x53f7fb[_0xecff('0xbc')],_0x53f7fb[_0xecff('0x49')],_0x53f7fb[_0xecff('0x4b')]));};AGIVertices[_0xecff('0x19')]['custom_app']=function(_0x11a04d){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0xbd'),_0x11a04d[_0xecff('0x37')]));var _0x4c5e0e=this['channel'][_0xecff('0x58')](_0x11a04d[_0xecff('0xbe')],_0x11a04d[_0xecff('0x7a')]);if(_0x4c5e0e[_0xecff('0xa2')]===-0x1){return _0x4c5e0e;}return this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')](_0xecff('0xbf'),_0x11a04d[_0xecff('0xbe')],_0x11a04d['options']));};AGIVertices[_0xecff('0x19')][_0xecff('0xc0')]=function(_0x413f7c){logger[_0xecff('0x2c')](util['format'](_0xecff('0xc1'),_0x413f7c[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x413f7c[_0xecff('0x5d')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xc2'));}var _0x50f70c='\x22'+_0x413f7c[_0xecff('0x5d')]+'\x22';if(this[_0xecff('0x85')](_0x413f7c[_0xecff('0x7a')])){_0x50f70c+=','+_0x413f7c[_0xecff('0x7a')];}var _0xa7ad3f=this[_0xecff('0x11')][_0xecff('0x58')](_0xecff('0xa6'),_0x50f70c);if(_0xa7ad3f[_0xecff('0xa2')]===-0x1){return _0xa7ad3f;}return this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0xc3'),_0x50f70c));};AGIVertices[_0xecff('0x19')][_0xecff('0xc4')]=function(_0x76e2f0){logger[_0xecff('0x2c')](util['format'](_0xecff('0xc5'),_0x76e2f0[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x76e2f0['text'])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xc2'));}var _0x20dff1='\x22'+_0x76e2f0[_0xecff('0x5d')]+'\x22';if(this[_0xecff('0x85')](_0x76e2f0[_0xecff('0x7a')])){_0x20dff1+=','+_0x76e2f0[_0xecff('0x7a')];}var _0x46db92=this['channel'][_0xecff('0x58')]('MRCPSynth',_0x20dff1);if(_0x46db92[_0xecff('0xa2')]===-0x1){return _0x46db92;}return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0xc3'),_0x20dff1));};AGIVertices[_0xecff('0x19')][_0xecff('0xc6')]=function(_0x22e234){logger['info'](util[_0xecff('0x27')](_0xecff('0xc7'),_0x22e234[_0xecff('0x37')]));if(!this['isConfigured'](_0x22e234[_0xecff('0xaa')])){return this[_0xecff('0x11')]['noop'](_0xecff('0xab'));}var _0x406454=_0x22e234[_0xecff('0xaa')];if(this[_0xecff('0x85')](_0x22e234[_0xecff('0x7a')])){_0x406454+=','+_0x22e234[_0xecff('0x7a')];}var _0x1610bc=this['channel'][_0xecff('0x58')](_0xecff('0xc8'),_0x406454);if(_0x1610bc[_0xecff('0xa2')]===-0x1){return _0x1610bc;}var _0x2c95bc=this['getAndSetVariable'](_0xecff('0xc9'),_0xecff('0xca'));if(_0x2c95bc[_0xecff('0xa2')]===-0x1){return _0x2c95bc;}var _0x7aafe5=this[_0xecff('0xa1')]('RECOG_INPUT()',_0xecff('0xcb'));if(_0x7aafe5[_0xecff('0xa2')]===-0x1){return _0x7aafe5;}var _0x38e005=this[_0xecff('0xa1')](_0xecff('0xaf'),_0xecff('0xcc'));if(_0x38e005[_0xecff('0xa2')]===-0x1){return _0x38e005;}return this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0xb1'),_0x406454));};AGIVertices[_0xecff('0x19')]['sestekasr']=function(_0x4919e1){logger['info'](util['format'](_0xecff('0xcd'),_0x4919e1[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x4919e1['grammar'])){return this['channel'][_0xecff('0xa7')](_0xecff('0xab'));}var _0x30c0b5=_0x4919e1['grammar'];if(this[_0xecff('0x85')](_0x4919e1['options'])){_0x30c0b5+=','+_0x4919e1['options'];}var _0x1c25b=this[_0xecff('0x11')][_0xecff('0x58')](_0xecff('0xc8'),_0x30c0b5);if(_0x1c25b[_0xecff('0xa2')]===-0x1){return _0x1c25b;}var _0x1c600c=this[_0xecff('0xa1')](_0xecff('0xc9'),_0xecff('0xce'));if(_0x1c600c[_0xecff('0xa2')]===-0x1){return _0x1c600c;}var _0x870ad8=this['getAndSetVariable']('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x870ad8[_0xecff('0xa2')]===-0x1){return _0x870ad8;}var _0x4e47b5=this['getAndSetVariable'](_0xecff('0xaf'),'SESTEK_ASR_INSTANCE');if(_0x4e47b5['result']===-0x1){return _0x4e47b5;}return this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0xb1'),_0x30c0b5));};AGIVertices[_0xecff('0x19')][_0xecff('0xcf')]=function(_0x11899c){logger[_0xecff('0x2c')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x11899c[_0xecff('0x37')]));if(!this['isConfigured'](_0x11899c[_0xecff('0xd0')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x11899c,_0xecff('0xd1'));}var _0x2a693c=this[_0xecff('0xd2')][_0xecff('0x6f')](this,_0x11899c[_0xecff('0xd0')]);if(!_0x2a693c){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x11899c,_0xecff('0xd3'));}if(!this['isConfigured'](_0x11899c[_0xecff('0x2e')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x11899c,'no\x20query\x20configured');}var _0x4c23d6=_0x11899c[_0xecff('0x2e')][_0xecff('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('query:\x20%s',_0x4c23d6));var _0x265538=this[_0xecff('0x28')][_0xecff('0x6f')](this,_0x2a693c,_0x4c23d6);this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x11899c,_0x4c23d6);if(!this[_0xecff('0x85')](_0x11899c[_0xecff('0xd4')])){return this['channel']['noop'](_0xecff('0xd5'));}var _0x3cb0f4=this[_0xecff('0x14')][_0xecff('0x6f')](this,_0x11899c['variable_id']);if(!_0x3cb0f4){return this[_0xecff('0x11')]['error'](_0x11899c,'no\x20variable\x20found');}var _0x54d23c=this;_0x265538[_0xecff('0xd6')](function(_0xd39dc3,_0x54db57){Object[_0xecff('0xd7')](_0xd39dc3)['forEach'](function(_0x5c00f2){_0x54d23c[_0xecff('0x11')][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0xd8'),_0x3cb0f4,_0x54db57,_0x5c00f2),_0xd39dc3[_0x5c00f2]);});});this['channel']['setVariable'](util[_0xecff('0x27')](_0xecff('0xd9'),_0x3cb0f4),_0x265538['length']);return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('variable\x20%s\x20set',_0x3cb0f4));};AGIVertices[_0xecff('0x19')][_0xecff('0xda')]=function(_0x3b5135){logger[_0xecff('0xdb')](util['format'](_0xecff('0xdc'),_0x3b5135[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x3b5135['sip_id'])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x3b5135,_0xecff('0xdd'));}var _0x5ed5eb=this[_0xecff('0x1d')][_0xecff('0x6f')](this,_0x3b5135[_0xecff('0xde')]);if(!_0x5ed5eb){return this[_0xecff('0x11')]['error'](_0x3b5135,_0xecff('0xdf'));}var _0x475b11=this['channel'][_0xecff('0x58')](_0xecff('0xe0'),[util[_0xecff('0x27')](_0xecff('0xe1'),_0x5ed5eb),_0x3b5135[_0xecff('0x67')],_0x3b5135[_0xecff('0xe2')],_0x3b5135[_0xecff('0x65')]]);if(_0x475b11['result']===-0x1){return _0x475b11;}return this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0xe3'),_0xecff('0xe0')));};AGIVertices[_0xecff('0x19')][_0xecff('0xe4')]=function(_0x3e1faf){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0xe5'),_0x3e1faf[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x3e1faf[_0xecff('0x7c')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xe6'));}if(!this[_0xecff('0x85')](_0x3e1faf[_0xecff('0x5d')])){return this[_0xecff('0x11')]['noop'](_0xecff('0xc2'));}this[_0xecff('0x11')]['bot']=!![];this[_0xecff('0x35')](_0x3e1faf);this[_0xecff('0x42')](_0x3e1faf[_0xecff('0x5d')],'in','','');this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('Trying\x20Dialogflow:\x20%s',_0x3e1faf['text']));var _0x4d5541=this[_0xecff('0x7b')][_0xecff('0x6f')](this,_0x3e1faf);if(_0x4d5541){for(var _0x5d917c in _0x4d5541){if(_0x4d5541[_0xecff('0x93')](_0x5d917c)){this[_0xecff('0x11')][_0xecff('0x9d')](util['format'](_0xecff('0xe7'),_0x5d917c[_0xecff('0xe8')]()),_0x4d5541[_0x5d917c]);}}this['createSquareMessage'](_0x4d5541['speech'],_0xecff('0xe9'),_0xecff('0xe4'),'');return this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')](_0xecff('0xea'),_0x4d5541[_0xecff('0xeb')]));}return this['channel'][_0xecff('0x2a')](_0x3e1faf,_0xecff('0xec'));};AGIVertices['prototype']['dialogflowV2']=function(_0x34a635){logger['info'](util[_0xecff('0x27')](_0xecff('0xed'),_0x34a635['label']));if(!this[_0xecff('0x85')](_0x34a635[_0xecff('0xee')])){return this[_0xecff('0x11')][_0xecff('0xa7')]('no\x20project_id\x20configured');}if(!this[_0xecff('0x85')](_0x34a635[_0xecff('0x7f')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xef'));}if(!this[_0xecff('0x85')](_0x34a635[_0xecff('0xf0')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xf1'));}if(!this[_0xecff('0x85')](_0x34a635[_0xecff('0x80')])){return this['channel'][_0xecff('0xa7')](_0xecff('0xf2'));}if(!this[_0xecff('0x85')](_0x34a635[_0xecff('0x5d')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xc2'));}this[_0xecff('0x11')][_0xecff('0xf3')]=!![];this[_0xecff('0x35')](_0x34a635);this['createSquareMessage'](_0x34a635[_0xecff('0x5d')],'in','','');this[_0xecff('0x11')]['noop'](util['format'](_0xecff('0xf4'),_0x34a635[_0xecff('0x5d')]));var _0x19091d=this[_0xecff('0x7e')]['sync'](this,_0x34a635);if(_0x19091d){for(var _0x322ede in _0x19091d){if(_0x19091d['hasOwnProperty'](_0x322ede)){if(_0x322ede!==_0xecff('0xf5')){this[_0xecff('0x11')]['setVariable'](util[_0xecff('0x27')](_0xecff('0xe7'),_0x322ede[_0xecff('0xe8')]()),_0x19091d[_0x322ede]);}}}this[_0xecff('0x42')](_0x19091d[_0xecff('0xeb')],_0xecff('0xe9'),_0xecff('0xf6'),_0x19091d[_0xecff('0xf5')]);return this[_0xecff('0x11')]['noop'](util['format'](_0xecff('0xf7'),_0x19091d[_0xecff('0xeb')]));}return this['channel'][_0xecff('0x2a')](_0x34a635,_0xecff('0xf8'));};AGIVertices[_0xecff('0x19')]['sesteknda']=function(_0x5525a7){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0xf9'),_0x5525a7['label']));if(!this[_0xecff('0x85')](_0x5525a7[_0xecff('0xfa')])){return this[_0xecff('0x11')]['noop'](_0xecff('0xfb'));}if(!this[_0xecff('0x85')](_0x5525a7['username'])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xfc'));}if(!this[_0xecff('0x85')](_0x5525a7['password'])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xfd'));}if(!this[_0xecff('0x85')](_0x5525a7[_0xecff('0xfe')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xc2'));}this['channel'][_0xecff('0xf3')]=!![];this[_0xecff('0x35')](_0x5525a7);this['createSquareMessage'](_0x5525a7[_0xecff('0x5d')],'in','','');this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')](_0xecff('0xff'),_0x5525a7[_0xecff('0x5d')]));var _0x276cda=this['sestekNDA'][_0xecff('0x6f')](this,_0x5525a7);if(_0x276cda){for(var _0x226e7b in _0x276cda){if(_0x276cda[_0xecff('0x93')](_0x226e7b)){this[_0xecff('0x11')][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0x100'),_0x226e7b[_0xecff('0xe8')]()),_0x276cda[_0x226e7b]);}}this[_0xecff('0x42')](_0x276cda['speech'],_0xecff('0xe9'),_0xecff('0x101'),'');if(_0x276cda[_0xecff('0x102')]){this[_0xecff('0x11')][_0xecff('0xa7')](util['format'](_0xecff('0x103'),_0x276cda[_0xecff('0x102')]));var _0x5960c4=this['channel'][_0xecff('0x104')](_0x276cda[_0xecff('0x102')]);try{fs['unlink'](_0x276cda[_0xecff('0x102')]+_0xecff('0x105'));}catch(_0x53ce3b){logger[_0xecff('0x2a')](_0x53ce3b);}return _0x5960c4;}else{return this[_0xecff('0x11')][_0xecff('0xa7')](util['format'](_0xecff('0x106'),_0x276cda['speech']));}}return this[_0xecff('0x11')][_0xecff('0x2a')](_0x5525a7,_0xecff('0x107'));};AGIVertices[_0xecff('0x19')][_0xecff('0x108')]=function(_0x5ed8c1){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x109'),_0x5ed8c1[_0xecff('0x37')]));return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x108'));};AGIVertices['prototype'][_0xecff('0x10a')]=function(_0x1c07e9){logger[_0xecff('0x2c')](util['format'](_0xecff('0x10b'),_0x1c07e9['label']));var _0x3c49a8='';if(_0x1c07e9[_0xecff('0x10c')]){if(!this[_0xecff('0x85')](_0x1c07e9['trunk_id'])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x1c07e9,'no\x20trunk\x20selected');}else{var _0x5dbcdc=parseInt(_0x1c07e9[_0xecff('0x10c')],0xa);if(isNaN(_0x5dbcdc)){_0x3c49a8=_0x1c07e9[_0xecff('0x10c')];}else{_0x3c49a8=this[_0xecff('0x1e')][_0xecff('0x6f')](this,_0x1c07e9[_0xecff('0x10c')]);if(!_0x3c49a8){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x1c07e9,_0xecff('0x10d'));}}}}else if(_0x1c07e9[_0xecff('0x10e')]){_0x3c49a8=_0x1c07e9[_0xecff('0x10e')];}else{return this['channel'][_0xecff('0x2a')](_0x1c07e9,_0xecff('0x10f'));}var _0x4b560d=this[_0xecff('0x11')][_0xecff('0x58')]('DIAL',[util[_0xecff('0x27')](_0xecff('0x110'),_0x3c49a8,_0x1c07e9[_0xecff('0xbc')]),_0x1c07e9[_0xecff('0x67')],_0x1c07e9[_0xecff('0xe2')],_0x1c07e9[_0xecff('0x65')]]);if(_0x4b560d['result']===-0x1){return _0x4b560d;}return this[_0xecff('0x11')][_0xecff('0xa7')](util['format']('Executed\x20command\x20%s',_0xecff('0xe0')));};AGIVertices['prototype']['finally']=function(_0x479da4){logger[_0xecff('0x2c')](util[_0xecff('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x479da4[_0xecff('0x37')]));return this[_0xecff('0x11')][_0xecff('0xa7')]('finally');};AGIVertices['prototype'][_0xecff('0xf')]=function(_0x554493){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x111'),_0x554493[_0xecff('0x37')]));if(_0x554493['retry']===0x0){return this[_0xecff('0xa4')](_0x554493);}_0x554493[_0xecff('0xa3')]-=0x1;if(!this[_0xecff('0x85')](_0x554493[_0xecff('0x112')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x554493,'no\x20file\x20audio\x20selected');}var _0x51f3bb=this[_0xecff('0x113')][_0xecff('0x6f')](this,_0x554493['file_id']);if(!_0x51f3bb){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x554493,'no\x20file\x20audio\x20found');}if(!this[_0xecff('0x85')](_0x554493[_0xecff('0xd4')])){return this['channel'][_0xecff('0x2a')](_0xecff('0xd5'));}var _0x8ad0e6=this['channel']['getData'](_0x51f3bb,_0x554493[_0xecff('0x114')],_0x554493['maxdigit']);var _0xb029f5=_0x8ad0e6[_0xecff('0xa2')]?_0x8ad0e6[_0xecff('0xa2')][_0xecff('0x4c')]():'';logger['info']('test',JSON[_0xecff('0x74')](_0x8ad0e6));if(_0x8ad0e6[_0xecff('0xa2')]===-0x1){this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x554493,_0xb029f5);return _0x8ad0e6;}else if(_0x8ad0e6[_0xecff('0xa0')]==='timeout'){_0x8ad0e6[_0xecff('0xa2')]=_0xb029f5[_0xecff('0x99')]>=parseInt(_0x554493[_0xecff('0x115')])?'x':'i';}else{_0x8ad0e6[_0xecff('0xa2')]=_0xb029f5[_0xecff('0x99')]>=parseInt(_0x554493[_0xecff('0x115')])&&_0xb029f5[_0xecff('0x99')]<=parseInt(_0x554493[_0xecff('0x116')])?'x':'i';}var _0x175b7a=this[_0xecff('0x14')]['sync'](this,_0x554493[_0xecff('0xd4')]);if(!_0x175b7a){return this['channel'][_0xecff('0x2a')](_0x554493,'no\x20variable\x20found');}this[_0xecff('0x11')][_0xecff('0x9d')](_0x175b7a,_0xb029f5);if(this[_0xecff('0x85')](_0x554493['hiddendigitsnum'])){var _0xe2432e=parseInt(_0x554493[_0xecff('0x117')],0xa);var _0x52d4c4=rs[_0xecff('0x118')]({'charset':'*','length':_0xe2432e});var _0x3b6eae=_0xb029f5[_0xecff('0x99')];if(_0x3b6eae>0x0){if(_0x3b6eae>_0xe2432e){this[_0xecff('0x35')]['sync'](this,_0x554493,_0x554493[_0xecff('0x119')]===_0xecff('0x11a')?_0x52d4c4+_0xb029f5[_0xecff('0x11b')](_0xe2432e):_0xb029f5[_0xecff('0x11b')](0x0,_0x3b6eae-_0xe2432e)+_0x52d4c4);}else{this['createSquareDetailsReport'][_0xecff('0x6f')](this,_0x554493,rs[_0xecff('0x118')]({'charset':'*','length':_0x3b6eae}));}}else{this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x554493,'');}}else{this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x554493,_0xb029f5);}return _0x8ad0e6;};AGIVertices['prototype'][_0xecff('0x10')]=function(_0x23ba09){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x11c'),_0x23ba09[_0xecff('0x37')]));return this[_0xecff('0xf')](_0x23ba09);};AGIVertices[_0xecff('0x19')][_0xecff('0x11d')]=function(_0x3bfd2f){logger[_0xecff('0x2c')](util['format'](_0xecff('0x11e'),_0x3bfd2f[_0xecff('0x37')]));this['createSquareDetailsReport'][_0xecff('0x6f')](this,_0x3bfd2f,_0x3bfd2f[_0xecff('0x11f')]);return this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x120'),_0x3bfd2f[_0xecff('0x11f')]));};AGIVertices[_0xecff('0x19')][_0xecff('0x121')]=function(_0x27474d){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x122'),_0x27474d[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x27474d[_0xecff('0x123')])||!this[_0xecff('0x85')](_0x27474d[_0xecff('0x88')])){return this[_0xecff('0x11')][_0xecff('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xecff('0x85')](_0x27474d[_0xecff('0x5d')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xc2'));}this['channel']['noop'](util[_0xecff('0x27')](_0xecff('0x124'),_0x27474d['text']));var _0x110f13=this[_0xecff('0x87')][_0xecff('0x6f')](this,_0x27474d);if(_0x110f13){this[_0xecff('0x11')]['noop'](util['format'](_0xecff('0x125'),_0x110f13));var _0x1a3e34=this['channel'][_0xecff('0x104')](_0x110f13);try{fs['unlink'](_0x110f13+_0xecff('0x105'));}catch(_0x14863e){logger[_0xecff('0x2a')](_0x14863e);}return _0x1a3e34;}return this[_0xecff('0x11')][_0xecff('0x2a')](_0x27474d,_0xecff('0x126'));};AGIVertices[_0xecff('0x19')][_0xecff('0x127')]=function(_0xe5f0ff){logger['info'](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xe5f0ff[_0xecff('0x37')]));if(!this['isConfigured'](_0xe5f0ff[_0xecff('0x123')])||!this[_0xecff('0x85')](_0xe5f0ff[_0xecff('0x88')])){return this[_0xecff('0x11')][_0xecff('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xecff('0x85')](_0xe5f0ff[_0xecff('0x128')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x129'));}if(!this['isConfigured'](_0xe5f0ff['text'])){return this['channel'][_0xecff('0xa7')](_0xecff('0xc2'));}this[_0xecff('0x11')][_0xecff('0xf3')]=!![];this[_0xecff('0x35')](_0xe5f0ff);this[_0xecff('0x42')](_0xe5f0ff['text'],'in','','');this[_0xecff('0x11')]['noop'](util['format'](_0xecff('0x12a'),_0xe5f0ff['text']));var _0x54686b=this[_0xecff('0x8b')][_0xecff('0x6f')](this,_0xe5f0ff);if(_0x54686b){for(var _0x5f25a8 in _0x54686b){if(_0x54686b['hasOwnProperty'](_0x5f25a8)&&_[_0xecff('0x94')](_0x54686b[_0x5f25a8])){this['channel'][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0x12b'),_0x5f25a8[_0xecff('0xe8')]()),_0x54686b[_0x5f25a8]);}}if(_['isNil'](_0x54686b[_0xecff('0x78')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x12c'));}else{this[_0xecff('0x42')](_0x54686b['message'],'out',_0xecff('0x12d'),'');return this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x54686b[_0xecff('0x78')]));}}return this['channel'][_0xecff('0x2a')](_0xe5f0ff,_0xecff('0x12e'));};AGIVertices[_0xecff('0x19')][_0xecff('0x12f')]=function(_0x5eb4e4){logger['info'](util[_0xecff('0x27')](_0xecff('0x130'),_0x5eb4e4[_0xecff('0x37')],_0x5eb4e4[_0xecff('0x67')]));if(!this[_0xecff('0x85')](_0x5eb4e4[_0xecff('0x7c')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0xe6'));}var _0x1f1c46='wav';var _0x534405=util[_0xecff('0x27')](_0xecff('0x131'),FILES_PATH,rs[_0xecff('0x118')](0x4));var _0x255cc3=util[_0xecff('0x27')](_0xecff('0x9c'),_0x534405,_0x1f1c46);var _0x4103fe=!![];if(_0x5eb4e4[_0xecff('0x132')]===_0xecff('0x133')){_0x4103fe=![];}var _0x521e4e=this[_0xecff('0x11')]['recordFile'](_0x534405,_0x1f1c46,_0x5eb4e4['intKey'],_0x5eb4e4['timeout'],undefined,_0x4103fe);if(_0x521e4e[_0xecff('0xa2')]!==-0x1){this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x134'),_0x255cc3));var _0x1e6cd3=this['googleASR'][_0xecff('0x6f')](this,_0x5eb4e4,_0x255cc3);if(_0x1e6cd3){for(var _0x36b305 in _0x1e6cd3){if(_0x1e6cd3['hasOwnProperty'](_0x36b305)){this['channel'][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0x135'),_0x36b305[_0xecff('0xe8')]()),_0x1e6cd3[_0x36b305]);}}return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x136'),JSON[_0xecff('0x74')](_0x1e6cd3)));}}return _0x521e4e;};AGIVertices[_0xecff('0x19')][_0xecff('0x137')]=function(_0x486760){logger['info'](util[_0xecff('0x27')](_0xecff('0x138'),_0x486760[_0xecff('0x37')]));if(!this['isConfigured'](_0x486760[_0xecff('0x90')])){return this['channel']['noop']('no\x20appid\x20configured');}if(!this[_0xecff('0x85')](_0x486760['appsecret'])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x139'));}var _0x97d935=_0xecff('0x13a');var _0x468836=util[_0xecff('0x27')](_0xecff('0x131'),FILES_PATH,rs[_0xecff('0x118')](0x4));var _0x1b13a4=util[_0xecff('0x27')](_0xecff('0x9c'),_0x468836,_0x97d935);var _0x4b228c=!![];if(_0x486760[_0xecff('0x132')]===_0xecff('0x133')){_0x4b228c=![];}var _0x1a1b6f=this['channel'][_0xecff('0x13b')](_0x468836,_0x97d935,_0x486760[_0xecff('0x13c')],_0x486760[_0xecff('0x67')],undefined,_0x4b228c);if(_0x1a1b6f[_0xecff('0xa2')]!==-0x1){this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x13d'),_0x1b13a4));var _0x3a4b54=this['tildeASR'][_0xecff('0x6f')](this,_0x486760,_0x1b13a4);if(_0x3a4b54){for(var _0x1e8282 in _0x3a4b54){if(_0x3a4b54['hasOwnProperty'](_0x1e8282)){this[_0xecff('0x11')][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0x13e'),_0x1e8282['toUpperCase']()),_0x3a4b54[_0x1e8282]);}}return this[_0xecff('0x11')][_0xecff('0xa7')](util['format'](_0xecff('0x13f'),JSON[_0xecff('0x74')](_0x3a4b54)));}}return _0x1a1b6f;};AGIVertices[_0xecff('0x19')][_0xecff('0x140')]=function(_0x58f4f2){logger[_0xecff('0x2c')](util[_0xecff('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x58f4f2[_0xecff('0x37')]));return this[_0xecff('0x11')][_0xecff('0x141')](_0x58f4f2[_0xecff('0x3d')],_0x58f4f2['extension'],_0x58f4f2['priority']);};AGIVertices[_0xecff('0x19')][_0xecff('0x142')]=function(_0x2670dc){logger[_0xecff('0x2c')](util['format'](_0xecff('0x143'),_0x2670dc['label']));if(!this[_0xecff('0x85')](_0x2670dc[_0xecff('0x144')])){return this[_0xecff('0x11')]['error'](_0x2670dc,_0xecff('0x145'));}try{var _0x4343e6=eval(_0x2670dc[_0xecff('0x144')])?_0xecff('0x146'):_0xecff('0x147');this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x148'),_0x2670dc[_0xecff('0x144')],_0x4343e6));return{'code':0xc8,'result':_0x4343e6};}catch(_0x3e62a9){return{'code':0xc8,'result':_0xecff('0x147')};}};AGIVertices[_0xecff('0x19')][_0xecff('0x149')]=function(_0x1acd14){logger[_0xecff('0x2c')](util['format'](_0xecff('0x14a'),_0x1acd14[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x1acd14[_0xecff('0x14b')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x1acd14,_0xecff('0x14c'));}var _0x52dad9=this[_0xecff('0x14d')][_0xecff('0x6f')](this,_0x1acd14['interval_id']);if(!_0x52dad9){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x1acd14,_0xecff('0x14e'));}for(var _0x1cca62=0x0;_0x1cca62<_0x52dad9[_0xecff('0x99')];_0x1cca62+=0x1){var _0x1e2bef=this[_0xecff('0x11')][_0xecff('0x14')](util[_0xecff('0x27')](_0xecff('0x14f'),_0x52dad9[_0x1cca62]));if(_0x1e2bef[_0xecff('0xa2')]===-0x1){return _0x1e2bef;}logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x150'),_0x52dad9[_0x1cca62],_0x1e2bef['extra']));if(_0x1e2bef[_0xecff('0xa0')]===_0xecff('0x146')){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x150'),_0x52dad9[_0x1cca62],_0xecff('0x146')));this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x150'),_0x52dad9[_0x1cca62],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xecff('0x27')]('IFTIME\x20%s\x20%s',_0x52dad9[_0x1cca62],'false'));this['channel'][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x150'),_0x52dad9[_0x1cca62],'false'));}}return{'code':0xc8,'result':_0xecff('0x147')};};AGIVertices[_0xecff('0x19')][_0xecff('0x151')]=function(_0x440ded){logger['info'](util[_0xecff('0x27')](_0xecff('0x152'),_0x440ded[_0xecff('0x37')]));return this[_0xecff('0x11')][_0xecff('0x151')]();};AGIVertices[_0xecff('0x19')][_0xecff('0x153')]=function(_0x25ba13){logger[_0xecff('0x2c')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x25ba13[_0xecff('0x37')]));if(!this['isConfigured'](_0x25ba13[_0xecff('0x7c')])){return this[_0xecff('0x11')][_0xecff('0xa7')]('no\x20key\x20configured');}var _0x4b59b4=_0xecff('0x13a');var _0x116189=util[_0xecff('0x27')](_0xecff('0x131'),FILES_PATH,rs[_0xecff('0x118')](0x4));var _0x36e548=util[_0xecff('0x27')](_0xecff('0x9c'),_0x116189,_0x4b59b4);var _0x1e56cb=!![];if(_0x25ba13[_0xecff('0x132')]===_0xecff('0x133')){_0x1e56cb=![];}var _0x3efd4a=this[_0xecff('0x11')][_0xecff('0x13b')](_0x116189,_0x4b59b4,_0x25ba13[_0xecff('0x13c')],_0x25ba13['timeout'],undefined,_0x1e56cb);if(_0x3efd4a[_0xecff('0xa2')]!==-0x1){this['channel'][_0xecff('0xa7')](util['format']('ispeech\x20%s\x20file\x20created',_0x36e548));var _0x3866af=this[_0xecff('0x83')][_0xecff('0x6f')](this,_0x25ba13,_0x36e548);if(_0x3866af){for(var _0x517cb1 in _0x3866af){if(_0x3866af[_0xecff('0x93')](_0x517cb1)){this[_0xecff('0x11')][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0x154'),_0x517cb1[_0xecff('0xe8')]()),_0x3866af[_0x517cb1]);}}return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x155'),JSON[_0xecff('0x74')](_0x3866af)));}}return _0x3efd4a;};AGIVertices[_0xecff('0x19')]['ispeechtts']=function(_0x59e4b5){logger[_0xecff('0x2c')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x59e4b5['label']));if(!this[_0xecff('0x85')](_0x59e4b5['key'])){return this['channel'][_0xecff('0xa7')](_0xecff('0xe6'));}if(!this[_0xecff('0x85')](_0x59e4b5[_0xecff('0x5d')])){return this[_0xecff('0x11')]['noop'](_0xecff('0xc2'));}this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x156'),_0x59e4b5['text']));var _0x61d7cd=this[_0xecff('0x82')][_0xecff('0x6f')](this,_0x59e4b5);if(_0x61d7cd){this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x157'),_0x61d7cd));var _0x1e5460=this[_0xecff('0x11')]['streamFile'](_0x61d7cd,_0x59e4b5[_0xecff('0x13c')]);try{fs[_0xecff('0x158')](_0x61d7cd+_0xecff('0x105'));}catch(_0x872ebc){logger['error'](_0x872ebc);}return _0x1e5460;}return this[_0xecff('0x11')][_0xecff('0x2a')](_0x59e4b5,_0xecff('0x159'));};AGIVertices[_0xecff('0x19')]['login']=function(_0x500176){logger['info'](util[_0xecff('0x27')](_0xecff('0x15a'),_0x500176[_0xecff('0x37')]));if(!this['isConfigured'](_0x500176[_0xecff('0x15b')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x500176,_0xecff('0x15c'));}logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x15d'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x500176['findBy']));var _0x508aa4=this['agentLogin'][_0xecff('0x6f')](this,_0x500176[_0xecff('0x15b')]);if(_0x508aa4){logger[_0xecff('0x2c')](util[_0xecff('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xecff('0x11')]['callerid'],_0x500176['findBy']));this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xecff('0x11')][_0xecff('0x3a')],_0x500176[_0xecff('0x15b')]));return{'code':0xc8,'result':_0xecff('0x15e')};}else{logger[_0xecff('0x2c')](util['format'](_0xecff('0x15f'),this[_0xecff('0x11')]['callerid'],_0x500176[_0xecff('0x15b')]));this['channel'][_0xecff('0xa7')](util['format'](_0xecff('0x15f'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x500176[_0xecff('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xecff('0x160')]=function(_0x4d6eeb){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x161'),_0x4d6eeb[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x4d6eeb[_0xecff('0x15b')])){return this['channel'][_0xecff('0x2a')](_0x4d6eeb,_0xecff('0x15c'));}logger['info'](util[_0xecff('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xecff('0x11')][_0xecff('0x3a')],_0x4d6eeb['findBy']));var _0x14095f=this['agentLogout'][_0xecff('0x6f')](this,_0x4d6eeb[_0xecff('0x15b')]);if(_0x14095f){logger[_0xecff('0x2c')](util['format'](_0xecff('0x162'),this['channel'][_0xecff('0x3a')],_0x4d6eeb['findBy']));this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x162'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x4d6eeb['findBy']));return{'code':0xc8,'result':_0xecff('0x15e')};}else{logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x15f'),this[_0xecff('0x11')]['callerid'],_0x4d6eeb[_0xecff('0x15b')]));this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')](_0xecff('0x15f'),this['channel']['callerid'],_0x4d6eeb[_0xecff('0x15b')]));return{'code':0xc8,'result':_0xecff('0x163')};}};AGIVertices[_0xecff('0x19')][_0xecff('0x164')]=function(_0x1a47c2){logger['info'](util[_0xecff('0x27')](_0xecff('0x165'),_0x1a47c2['label']));if(!this[_0xecff('0x85')](_0x1a47c2['operation'])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x1a47c2,_0xecff('0x166'));}this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')]('math\x20%s',_0x1a47c2[_0xecff('0x167')]));var _0xec484e=eval(_0x1a47c2['operation']);if(!this[_0xecff('0x85')](_0x1a47c2[_0xecff('0xd4')])){return this['channel'][_0xecff('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x94f6d9=this[_0xecff('0x14')][_0xecff('0x6f')](this,_0x1a47c2[_0xecff('0xd4')]);if(!_0x94f6d9){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x1a47c2,'no\x20variable\x20found');}if(_[_0xecff('0x98')](_0xec484e)){var _0x509b4a=this;_0xec484e['forEach'](function(_0x105c8e,_0xbeef4e){_0x509b4a[_0xecff('0x11')]['setVariable'](util[_0xecff('0x27')](_0xecff('0x168'),_0x94f6d9,_0xbeef4e),_0x105c8e);});return this[_0xecff('0x11')]['noop'](util['format'](_0xecff('0x169'),_0x94f6d9));}else{return this[_0xecff('0x11')]['setVariable'](_0x94f6d9,_0xec484e);}};AGIVertices[_0xecff('0x19')][_0xecff('0xe')]=function(_0x57fe4f){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x16a'),_0x57fe4f['label']));if(_0x57fe4f['retry']===0x0){return this[_0xecff('0xa4')](_0x57fe4f);}_0x57fe4f[_0xecff('0xa3')]-=0x1;if(!this['isConfigured'](_0x57fe4f[_0xecff('0x112')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x57fe4f,_0xecff('0x16b'));}var _0x10a790=this[_0xecff('0x113')]['sync'](this,_0x57fe4f['file_id']);if(!_0x10a790){return this[_0xecff('0x11')]['error'](_0x57fe4f,_0xecff('0x16c'));}var _0x34d40f=this[_0xecff('0x11')][_0xecff('0x16d')](_0x10a790,_0x57fe4f[_0xecff('0x114')],_0x57fe4f[_0xecff('0x16e')]);var _0x1c3c2c=_0x34d40f[_0xecff('0xa2')];if(_0x34d40f[_0xecff('0xa2')]===-0x1){this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x57fe4f,'-1');return _0x34d40f;}else if(_0x34d40f[_0xecff('0xa0')]===_0xecff('0x67')){_0x34d40f[_0xecff('0xa2')]=_0x34d40f['result'][_0xecff('0x99')]>0x0?_0x34d40f[_0xecff('0xa2')]:'t';}else if(_['isEmpty'](_0x34d40f[_0xecff('0xa2')])){_0x34d40f[_0xecff('0xa2')]='#';_0x1c3c2c='#';}if(!this[_0xecff('0x85')](_0x57fe4f['variable_id'])){this[_0xecff('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x47145b=this[_0xecff('0x14')][_0xecff('0x6f')](this,_0x57fe4f[_0xecff('0xd4')]);if(!_0x47145b){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x57fe4f,'no\x20variable\x20found');}this['channel'][_0xecff('0x9d')](_0x47145b,_0x1c3c2c);}this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x57fe4f,_0x1c3c2c);return _0x34d40f;};AGIVertices[_0xecff('0x19')][_0xecff('0xa7')]=function(_0x22cd5e){logger['info'](util[_0xecff('0x27')](_0xecff('0x16f'),_0x22cd5e[_0xecff('0x37')]));return this[_0xecff('0x11')][_0xecff('0xa7')](_0x22cd5e[_0xecff('0x170')]||_0x22cd5e[_0xecff('0x37')]);};AGIVertices[_0xecff('0x19')]['pause']=function(_0x6035d9){logger['info'](util[_0xecff('0x27')](_0xecff('0x171'),_0x6035d9['label']));if(!this[_0xecff('0x85')](_0x6035d9[_0xecff('0x15b')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x6035d9,'no\x20find\x20by\x20configured');}logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x15d'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x6035d9[_0xecff('0x15b')]));var _0xd59bca=this[_0xecff('0x4e')][_0xecff('0x6f')](this,_0x6035d9[_0xecff('0x172')]);var _0x3f89ba=this[_0xecff('0x50')][_0xecff('0x6f')](this,_0x6035d9['findBy'],_0xd59bca);if(_0x3f89ba){logger[_0xecff('0x2c')](util['format'](_0xecff('0x162'),this['channel'][_0xecff('0x3a')],_0x6035d9[_0xecff('0x15b')]));this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x162'),this['channel'][_0xecff('0x3a')],_0x6035d9[_0xecff('0x15b')]));return{'code':0xc8,'result':_0xecff('0x15e')};}else{logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x15f'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x6035d9[_0xecff('0x15b')]));this[_0xecff('0x11')][_0xecff('0xa7')](util['format'](_0xecff('0x162'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x6035d9['findBy']));return{'code':0xc8,'result':_0xecff('0x163')};}};AGIVertices[_0xecff('0x19')][_0xecff('0x173')]=function(_0x23248f){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x174'),_0x23248f[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x23248f[_0xecff('0x112')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x23248f,_0xecff('0x16b'));}var _0x101449=this[_0xecff('0x113')][_0xecff('0x6f')](this,_0x23248f[_0xecff('0x112')]);if(!_0x101449){return this[_0xecff('0x11')]['error'](_0x23248f,_0xecff('0x16c'));}var _0x96d406=this[_0xecff('0x11')][_0xecff('0x58')](_0xecff('0x175'),[_0x101449,_0x23248f[_0xecff('0xe2')]]);if(_0x96d406[_0xecff('0xa2')]===-0x1){return _0x96d406;}return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0xbf'),_0xecff('0x175'),_0x101449));};AGIVertices['prototype'][_0xecff('0x176')]=function(_0x120eea){logger['info'](util[_0xecff('0x27')](_0xecff('0x177'),_0x120eea['label']));if(!this[_0xecff('0x85')](_0x120eea[_0xecff('0x178')])){return this['channel']['error'](_0x120eea,_0xecff('0x179'));}var _0xc3e67e='';var _0x5ed103=parseInt(_0x120eea[_0xecff('0x178')],0xa);if(isNaN(_0x5ed103)){_0xc3e67e=_0x120eea[_0xecff('0x178')];}else{_0xc3e67e=this['getVoiceQueue'][_0xecff('0x6f')](this,_0x120eea[_0xecff('0x178')]);if(!_0xc3e67e){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x120eea,_0xecff('0x17a'));}}var _0x575085='';if(this[_0xecff('0x85')](_0x120eea[_0xecff('0x112')])){var _0x322cd4=this[_0xecff('0x113')][_0xecff('0x6f')](this,_0x120eea[_0xecff('0x112')]);if(_0x322cd4){_0x575085=_0x322cd4;}}this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x120eea,_0xc3e67e);if(_0x120eea[_0xecff('0xe2')][_0xecff('0x17b')]('x')<0x0){_0x120eea['opts']+='x';}if(_0x120eea[_0xecff('0xe2')]['indexOf']('X')<0x0){_0x120eea[_0xecff('0xe2')]+='X';}this['channel'][_0xecff('0x9d')](_0xecff('0x17c'),_0xc3e67e?_0xc3e67e[_0xecff('0x17d')]():'');var _0x11bf14=this[_0xecff('0x11')][_0xecff('0x58')](_0xecff('0x17e'),[_0xc3e67e,_0x120eea['opts'],_0x120eea[_0xecff('0x65')],_0x575085,_0x120eea['timeout'],_0x120eea['agi'],_0x120eea[_0xecff('0x17f')],_0x120eea[_0xecff('0x180')],'',_0x120eea[_0xecff('0x181')]]);if(_0x11bf14[_0xecff('0xa2')]===-0x1){return _0x11bf14;}return this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')](_0xecff('0xbf'),'QUEUE',_0xc3e67e));};AGIVertices[_0xecff('0x19')][_0xecff('0x182')]=function(_0xc2b389){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x183'),_0xc2b389['label']));var _0x3d35f9=_0xc2b389[_0xecff('0x184')]||'wav';var _0x4e70eb=util['format'](_0xecff('0x185'),this['channel']['uniqueid'],rs[_0xecff('0x118')](0x5));var _0x25b7e7=util['format'](_0xecff('0x186'),FILES_PATH,_0x4e70eb,_0x3d35f9);var _0x6dd4f0=util[_0xecff('0x27')]('%s/recordings/%s',FILES_PATH,_0x4e70eb);this[_0xecff('0x3b')][_0xecff('0x6f')](this,_0xc2b389,_0x4e70eb,_0x25b7e7);this['channel'][_0xecff('0x9d')](_0xecff('0x187'),_0x4e70eb);logger[_0xecff('0x2c')](_0xecff('0x188'),_0x6dd4f0,_0x3d35f9,_0xc2b389[_0xecff('0x189')],_0xc2b389[_0xecff('0x67')]);return this[_0xecff('0x11')][_0xecff('0x13b')](_0x6dd4f0,_0x3d35f9,_0xc2b389[_0xecff('0x189')],_0xc2b389['timeout'],undefined,!![]);};AGIVertices[_0xecff('0x19')]['restapi']=function(_0x4d789b){logger[_0xecff('0x2c')](util['format'](_0xecff('0x18a'),_0x4d789b[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x4d789b[_0xecff('0x65')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x18b'));}var _0x2b69e2=this['restAPI'][_0xecff('0x6f')](this,_0x4d789b);logger[_0xecff('0x2c')](util[_0xecff('0x27')]('Response:',util[_0xecff('0x18c')](_0x2b69e2,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d789b[_0xecff('0xd4')])){return this[_0xecff('0x11')]['noop'](_0xecff('0x18d'));}var _0x13b263=this['getVariable']['sync'](this,_0x4d789b[_0xecff('0xd4')]);if(!_0x13b263){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x4d789b,_0xecff('0x18e'));}this[_0xecff('0x11')][_0xecff('0x9d')](util[_0xecff('0x27')](_0xecff('0x18f'),_0x13b263),_0x2b69e2[_0xecff('0x76')]?_0x2b69e2[_0xecff('0x76')]:_0xecff('0x190'));this[_0xecff('0x11')][_0xecff('0x9d')](util[_0xecff('0x27')]('%s_STATUS_MESSAGE',_0x13b263),_0x2b69e2[_0xecff('0x77')]?_0x2b69e2[_0xecff('0x77')]:'OK');if(_0x2b69e2[_0xecff('0x75')]){try{this[_0xecff('0x9b')](_0x2b69e2[_0xecff('0x75')],_0x13b263);}catch(_0x18d7fa){logger[_0xecff('0x2a')](util['format'](_0xecff('0x191'),_0x13b263));}}return this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')](_0xecff('0x192'),_0x13b263));};AGIVertices['prototype'][_0xecff('0x193')]=function(_0x9562a0){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x194'),_0x9562a0[_0xecff('0x37')]));return this[_0xecff('0x11')]['sayDigits'](_0x9562a0[_0xecff('0x195')][_0xecff('0x5a')](/\s+/g,''),_0x9562a0[_0xecff('0x189')]);};AGIVertices[_0xecff('0x19')][_0xecff('0x196')]=function(_0x134945){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x197'),_0x134945[_0xecff('0x37')]));return this[_0xecff('0x11')][_0xecff('0x198')](_0x134945[_0xecff('0x68')][_0xecff('0x5a')](/\s+/g,''),_0x134945[_0xecff('0x189')]);};AGIVertices[_0xecff('0x19')][_0xecff('0x199')]=function(_0x35e6ac){logger['info'](util[_0xecff('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x35e6ac[_0xecff('0x37')]));return this['channel'][_0xecff('0x19a')](_0x35e6ac['text'],_0x35e6ac[_0xecff('0x189')]);};AGIVertices['prototype'][_0xecff('0x19b')]=function(_0x23faa8){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x19c'),_0x23faa8[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x23faa8[_0xecff('0x19d')])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x19e'));}var _0x9e5fa3=this[_0xecff('0x22')][_0xecff('0x6f')](this,_0x23faa8[_0xecff('0x19d')]);if(!_0x9e5fa3||!_0x9e5fa3['Smtp']){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x23faa8,_0xecff('0x19f'));}var _0x3fd2d1={'from':util[_0xecff('0x27')]('\x22%s\x22\x20<%s>',_0x9e5fa3[_0xecff('0x17')],_0x9e5fa3[_0xecff('0x1a0')]||_0x9e5fa3['Smtp'][_0xecff('0x1a1')]),'to':_0x23faa8['to']||'','cc':_0x23faa8['cc']||'','bcc':_0x23faa8[_0xecff('0x1a2')]||'','subject':_0x23faa8[_0xecff('0x1a3')],'html':_0x23faa8[_0xecff('0x5d')],'text':_0x23faa8['text']};if(this[_0xecff('0x85')](_0x23faa8['template_id'])){}logger['debug']('sendMail\x20message',JSON[_0xecff('0x74')](_0x3fd2d1));this['createSquareDetailsReport']['sync'](this,_0x23faa8,_0x23faa8[_0xecff('0x19d')]);this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x1a4'),_0x9e5fa3[_0xecff('0x17')]));this[_0xecff('0x24')][_0xecff('0x6f')](this,_0x9e5fa3[_0xecff('0x1a5')],_0x3fd2d1);return this['channel'][_0xecff('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xecff('0x19')][_0xecff('0x1a6')]=function(_0x33e75f){logger[_0xecff('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x33e75f[_0xecff('0x37')]));return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x1a7'));};AGIVertices['prototype'][_0xecff('0x1a8')]=function(_0x5e48ec){logger[_0xecff('0x2c')](util['format'](_0xecff('0x1a9'),_0x5e48ec[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x5e48ec['sms_account_id'])){return this['channel'][_0xecff('0xa7')](_0xecff('0x1aa'));}var _0x15aaaa=this[_0xecff('0x32')][_0xecff('0x6f')](this,_0x5e48ec['sms_account_id']);if(!_0x15aaaa){return this['channel'][_0xecff('0x2a')](_0x5e48ec,_0xecff('0x1ab'));}var _0x5cb9f8={'body':_0x5e48ec['sms_text'],'phone':_0x5e48ec['to']||'','SmsAccountId':_0x15aaaa['id']};logger[_0xecff('0xdb')](_0xecff('0x1ac'),JSON['stringify'](_0x5cb9f8));this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x5e48ec,_0x5e48ec[_0xecff('0x1ad')]);this[_0xecff('0x11')]['noop'](util[_0xecff('0x27')](_0xecff('0x1ae'),_0x15aaaa[_0xecff('0x17')]));this[_0xecff('0x34')][_0xecff('0x6f')](this,_0x5cb9f8);return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x1af'));};AGIVertices[_0xecff('0x19')][_0xecff('0x1b0')]=function(_0x3daa4d){logger[_0xecff('0x2c')](util['format'](_0xecff('0x1b1'),_0x3daa4d[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x3daa4d[_0xecff('0xd4')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x3daa4d,_0xecff('0x1b2'));}var _0x208ccb=this[_0xecff('0x14')][_0xecff('0x6f')](this,_0x3daa4d[_0xecff('0xd4')]);if(!_0x208ccb){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x3daa4d,_0xecff('0x18e'));}return this['channel'][_0xecff('0x9d')](_0x208ccb,_0x3daa4d['variable_value']);};AGIVertices[_0xecff('0x19')][_0xecff('0x1b3')]=function(_0x1514e2){logger['info'](util[_0xecff('0x27')](_0xecff('0x1b4'),_0x1514e2[_0xecff('0x37')]));this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x1b5'));if(_0x1514e2['answer']==='yes'){this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x1b6'));return this['channel'][_0xecff('0xb3')]();}return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x1b7'));};AGIVertices[_0xecff('0x19')]['subproject']=function(_0x8a192){logger[_0xecff('0x2c')](util[_0xecff('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x8a192[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x8a192['project_id'])){return this[_0xecff('0x11')]['error'](_0x8a192,_0xecff('0x1b8'));}var _0x2993a1=this['getSquareProject']['sync'](this,_0x8a192[_0xecff('0x1b9')]);if(!this[_0xecff('0x85')](_0x2993a1)){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x8a192,util[_0xecff('0x27')](_0xecff('0x1ba'),_0x8a192[_0xecff('0x1b9')]));}if(_0x2993a1===this[_0xecff('0x11')][_0xecff('0x39')]){return this[_0xecff('0x11')]['error'](_0x8a192,_0xecff('0x1bb'));}this[_0xecff('0x35')][_0xecff('0x6f')](this,_0x8a192,_0x2993a1);var _0x6e0d71=this[_0xecff('0x11')][_0xecff('0x58')](_0xecff('0x1bc'),util[_0xecff('0x27')](_0xecff('0x1bd'),config[_0xecff('0x9')][_0xecff('0x1be')]||_0xecff('0x1bf'),_0x2993a1,this[_0xecff('0x11')][_0xecff('0x39')]));if(_0x6e0d71[_0xecff('0xa2')]===-0x1){return _0x6e0d71;}return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('Executed\x20command\x20%s\x20%s',_0xecff('0x1bc'),_0x2993a1));};AGIVertices['prototype'][_0xecff('0x1c0')]=function(_0x3cffb4){logger['info'](util[_0xecff('0x27')](_0xecff('0x1c1'),_0x3cffb4[_0xecff('0x37')]));var _0x58da77=this[_0xecff('0x57')][_0xecff('0x6f')](this,_0x3cffb4[_0xecff('0xb2')]);this[_0xecff('0x35')]['sync'](this,_0x3cffb4,_0x3cffb4[_0xecff('0xb2')]);if(this['isConfigured'](_0x3cffb4[_0xecff('0xd4')])){var _0x423233=this[_0xecff('0x14')][_0xecff('0x6f')](this,_0x3cffb4['variable_id']);if(_0x423233){this[_0xecff('0x11')]['setVariable'](_0x423233,_0x58da77);return this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3cffb4['command'],_0x423233));}}return this[_0xecff('0x11')][_0xecff('0xa7')](util['format'](_0xecff('0x1c2'),_0x3cffb4[_0xecff('0xb2')]));};AGIVertices['prototype'][_0xecff('0x1c3')]=function(_0x2d3688){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x1c4'),_0x2d3688[_0xecff('0x37')]));_0x2d3688[_0xecff('0x5d')]=_0x2d3688[_0xecff('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xecff('0x85')](_0x2d3688['apiKey'])){return this[_0xecff('0x11')][_0xecff('0xa7')](_0xecff('0x1c5'));}if(!this[_0xecff('0x85')](_0x2d3688[_0xecff('0x5d')])){return this['channel'][_0xecff('0xa7')](_0xecff('0xc2'));}this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x1c6'),_0x2d3688[_0xecff('0x5d')]));var _0x315d70=this[_0xecff('0x5b')]['sync'](this,_0x2d3688);if(_0x315d70){this[_0xecff('0x11')][_0xecff('0xa7')](util['format'](_0xecff('0x1c7'),_0x315d70));var _0xfb30a4=this[_0xecff('0x11')]['streamFile'](_0x315d70);try{fs[_0xecff('0x158')](_0x315d70+_0xecff('0x105'));}catch(_0x1b4af3){logger['error'](_0x1b4af3);}return _0xfb30a4;}return this[_0xecff('0x11')][_0xecff('0x2a')](_0x2d3688,_0xecff('0x1c8'));};AGIVertices[_0xecff('0x19')]['tts']=function(_0xd353c1){logger['info'](util['format'](_0xecff('0x1c9'),_0xd353c1[_0xecff('0x37')]));_0xd353c1[_0xecff('0x5d')]=_0xd353c1[_0xecff('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xecff('0x85')](_0xd353c1[_0xecff('0x5d')])){return this[_0xecff('0x11')][_0xecff('0xa7')]('no\x20text\x20configured');}this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')](_0xecff('0x1ca'),_0xd353c1[_0xecff('0x5d')]));var _0x27e3ef=this['googleTTS']['sync'](this,_0xd353c1);if(_0x27e3ef){this['channel'][_0xecff('0xa7')](util['format'](_0xecff('0x1cb'),_0x27e3ef));var _0xf8fef4=this[_0xecff('0x11')][_0xecff('0x104')](_0x27e3ef);try{fs['unlink'](_0x27e3ef+_0xecff('0x105'));}catch(_0x5c6249){logger['error'](_0x5c6249);}return _0xf8fef4;}return this[_0xecff('0x11')][_0xecff('0x2a')](_0xd353c1,_0xecff('0x1cc'));};AGIVertices[_0xecff('0x19')][_0xecff('0x1cd')]=function(_0x3eb151){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x1ce'),_0x3eb151['label']));if(!this[_0xecff('0x85')](_0x3eb151['findBy'])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x3eb151,_0xecff('0x15c'));}logger['info'](util['format'](_0xecff('0x15d'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x3eb151['findBy']));var _0x412fdd=this[_0xecff('0x52')]['sync'](this,_0x3eb151[_0xecff('0x15b')]);if(_0x412fdd){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xecff('0x11')]['callerid'],_0x3eb151[_0xecff('0x15b')]));this[_0xecff('0x11')][_0xecff('0xa7')](util['format'](_0xecff('0x162'),this[_0xecff('0x11')][_0xecff('0x3a')],_0x3eb151[_0xecff('0x15b')]));return{'code':0xc8,'result':_0xecff('0x15e')};}else{logger[_0xecff('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xecff('0x11')][_0xecff('0x3a')],_0x3eb151[_0xecff('0x15b')]));this[_0xecff('0x11')][_0xecff('0xa7')](util[_0xecff('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xecff('0x3a')],_0x3eb151['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xecff('0x1cf')]=function(_0xe0ae0e){logger[_0xecff('0x2c')](util[_0xecff('0x27')](_0xecff('0x1d0'),_0xe0ae0e[_0xecff('0x37')]));var _0x270fb7=this[_0xecff('0x11')]['exec'](_0xecff('0x1d1'),[_0xe0ae0e[_0xecff('0x1d2')],_0xe0ae0e[_0xecff('0x7a')]]);if(_0x270fb7[_0xecff('0xa2')]===-0x1){return _0x270fb7;}return this[_0xecff('0x11')]['noop'](util['format'](_0xecff('0xbf'),'VOICEMAIL',_0xe0ae0e[_0xecff('0x1d2')]));};AGIVertices[_0xecff('0x19')][_0xecff('0x1d3')]=function(_0x47b4e4){logger['info'](util[_0xecff('0x27')](_0xecff('0x1d4'),_0x47b4e4[_0xecff('0x37')]));if(!this[_0xecff('0x85')](_0x47b4e4[_0xecff('0xd4')])){return this[_0xecff('0x11')][_0xecff('0x2a')](_0x47b4e4,_0xecff('0x1b2'));}var _0x25f9d6=this[_0xecff('0x14')][_0xecff('0x6f')](this,_0x47b4e4[_0xecff('0xd4')]);if(!_0x25f9d6){return this['channel'][_0xecff('0x2a')](_0x47b4e4,_0xecff('0x18e'));}var _0x191a53=this['channel'][_0xecff('0x14')](_0x25f9d6);return{'code':0xc8,'result':_0x191a53['extra']?_0x191a53['extra']:'-'};};String[_0xecff('0x19')][_0xecff('0x9f')]=function(_0x1cb728,_0xcb483){return this[_0xecff('0x9e')](_0x1cb728)[_0xecff('0x1d5')](_0xcb483);};module[_0xecff('0x1d6')]=AGIVertices; \ No newline at end of file +var _0x6739=['Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','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','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','sendMail\x20message','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','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','127.0.0.1','arg_1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','shelljs','odbc','randomstring','moment','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','context','extension','accountcode','createSquareMessage','isEmpty','callback_','random','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPause','agent','agentPause','isNil','agentUnpause','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','createCmContact','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','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6739,0xd3));var _0x9673=function(_0x186b51,_0x37be0b){_0x186b51=_0x186b51-0x0;var _0x191f10=_0x6739[_0x186b51];return _0x191f10;};'use strict';var fs=require('fs');var util=require(_0x9673('0x0'));var _=require(_0x9673('0x1'));var sh=require(_0x9673('0x2'));var odbc=require(_0x9673('0x3'))();var rs=require(_0x9673('0x4'));var moment=require(_0x9673('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x9673('0x6'))('agi');var config=require(_0x9673('0x7'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x9673('0x8');var recursiveMapAttributes=[_0x9673('0x9'),_0x9673('0xa')];var verticesWithRetry=['menu','getdigits',_0x9673('0xb')];var AGIVertices=function(_0x21e4b4,_0x2c4d48,_0x509966){this[_0x9673('0xc')]=_0x21e4b4;this[_0x9673('0xd')]=_0x2c4d48;this[_0x9673('0xe')]=_0x509966;};AGIVertices['prototype'][_0x9673('0xf')]=function(_0x2bae3b,_0x2c00cd){this[_0x9673('0xd')]['getVariableById'](_0x2bae3b)[_0x9673('0x10')](function(_0x3cf3d1){_0x2c00cd(null,_0x3cf3d1?_0x3cf3d1[_0x9673('0x11')]:![]);})[_0x9673('0x12')](function(_0x565201){_0x2c00cd(_0x565201);});};AGIVertices[_0x9673('0x13')][_0x9673('0x14')]=function(_0x5d9a57,_0xcf8543){this[_0x9673('0xd')][_0x9673('0x15')](_0x5d9a57)['then'](function(_0x34cb76){_0xcf8543(null,_0x34cb76?_0x34cb76['name']:![]);})[_0x9673('0x12')](function(_0x4a846a){_0xcf8543(_0x4a846a);});};AGIVertices['prototype'][_0x9673('0x16')]=function(_0x5484ea,_0x3d5642){this[_0x9673('0xd')]['getSquareProjectById'](_0x5484ea)[_0x9673('0x10')](function(_0x46d721){_0x3d5642(null,_0x46d721?_0x46d721[_0x9673('0x11')]:![]);})[_0x9673('0x12')](function(_0x431564){_0x3d5642(_0x431564);});};AGIVertices[_0x9673('0x13')][_0x9673('0x17')]=function(_0x16a77c,_0x43a196){this[_0x9673('0xd')]['getSquareOdbcById'](_0x16a77c)[_0x9673('0x10')](function(_0xbfc9d6){_0x43a196(null,_0xbfc9d6?_0xbfc9d6['dsn']:![]);})[_0x9673('0x12')](function(_0x4fe72c){_0x43a196(_0x4fe72c);});};AGIVertices['prototype'][_0x9673('0x18')]=function(_0xa8bc6d,_0x3c1e8f){this['rpc'][_0x9673('0x19')](_0xa8bc6d)[_0x9673('0x10')](function(_0x30df62){_0x3c1e8f(null,_0x30df62?_0x30df62[_0x9673('0x11')]:![]);})['catch'](function(_0x282b8d){_0x3c1e8f(_0x282b8d);});};AGIVertices['prototype'][_0x9673('0x1a')]=function(_0x404213,_0x2b99a5){this[_0x9673('0xd')][_0x9673('0x1b')](_0x404213)[_0x9673('0x10')](function(_0x1733cf){_0x2b99a5(null,_0x1733cf?_0x1733cf[_0x9673('0x11')]:![]);})[_0x9673('0x12')](function(_0x4f7473){_0x2b99a5(_0x4f7473);});};AGIVertices[_0x9673('0x13')][_0x9673('0x1c')]=function(_0x4d8cca,_0x4c3dde){var _0x2de799=this;this[_0x9673('0xd')][_0x9673('0x1d')](_0x4d8cca)[_0x9673('0x10')](function(_0x52513e){_0x4c3dde(null,_0x52513e?_0x2de799[_0x9673('0x1e')](_0x52513e['save_name']):![]);})[_0x9673('0x12')](function(_0x5bf713){_0x4c3dde(_0x5bf713);});};AGIVertices[_0x9673('0x13')][_0x9673('0x1f')]=function(_0x3838c5,_0x588154){this[_0x9673('0xd')]['getMailAccountById'](_0x3838c5)[_0x9673('0x10')](function(_0x2d3880){_0x588154(null,_0x2d3880?_0x2d3880:![]);})['catch'](function(_0x4e6af2){_0x588154(_0x4e6af2);});};AGIVertices[_0x9673('0x13')][_0x9673('0x20')]=function(_0x12f8a7,_0x28d3c0,_0x332966){this[_0x9673('0xe')][_0x9673('0x20')](_0x12f8a7,_0x28d3c0)['then'](function(){_0x332966(null);})[_0x9673('0x12')](function(_0x208448){_0x332966(_0x208448);});};AGIVertices[_0x9673('0x13')][_0x9673('0x21')]=function(_0xdf7a84,_0x11c2ab){this[_0x9673('0xd')][_0x9673('0x22')](_0xdf7a84)[_0x9673('0x10')](function(_0x449a59){if(_0x449a59){if(_0x449a59['IntervalId']){_0x11c2ab(null,[_0x449a59[_0x9673('0x23')]]);}else{_0x11c2ab(null,_['map'](_0x449a59['Intervals'],_0x9673('0x23')));}}else{_0x11c2ab(null,![]);}})[_0x9673('0x12')](function(_0x9bcbef){_0x11c2ab(_0x9bcbef);});};AGIVertices[_0x9673('0x13')]['getSoundPath']=function(_0x2f960d){return util[_0x9673('0x24')](_0x9673('0x25'),FILES_PATH,_0x2f960d);};AGIVertices[_0x9673('0x13')][_0x9673('0x26')]=function(_0x36cf45,_0x3edae9,_0x39e640){odbc[_0x9673('0x27')](_0x36cf45,function(_0x5d5e3c){if(_0x5d5e3c){logger[_0x9673('0x28')](_0x9673('0x29'),_0x5d5e3c);_0x39e640(_0x5d5e3c);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x9673('0x2a')](_0x3edae9,function(_0x53bee0,_0x32b4e7){if(_0x53bee0){logger[_0x9673('0x2b')]('Error\x20executing\x20query\x20%s',_0x3edae9);_0x39e640(_0x53bee0);}else{logger['info'](_0x9673('0x2c'),_0x3edae9);odbc[_0x9673('0x2d')](function(_0x1d5ff2){if(_0x1d5ff2){logger[_0x9673('0x28')](_0x9673('0x2e'),_0x1d5ff2);}_0x39e640(null,_0x32b4e7);});}});}});};AGIVertices[_0x9673('0x13')][_0x9673('0x2f')]=function(_0x393f83,_0x168169){this['rpc'][_0x9673('0x30')](_0x393f83)[_0x9673('0x10')](function(_0x1c1087){_0x168169(null,_0x1c1087?_0x1c1087:![]);})[_0x9673('0x12')](function(_0x2168b9){_0x168169(_0x2168b9);});};AGIVertices[_0x9673('0x13')][_0x9673('0x31')]=function(_0x5f3385,_0x219580){this[_0x9673('0xd')][_0x9673('0x31')](_0x5f3385)[_0x9673('0x10')](function(_0xef619a){_0x219580(null,_0xef619a);})['catch'](function(_0x2b4066){_0x219580(_0x2b4066);});};AGIVertices['prototype'][_0x9673('0x32')]=function(_0x5a63e3,_0x3278aa,_0x4026e9){this[_0x9673('0xd')][_0x9673('0x32')]({'uniqueid':this[_0x9673('0xc')][_0x9673('0x33')],'node':_0x5a63e3[_0x9673('0x34')],'application':_0x5a63e3[_0x9673('0x35')],'data':_0x3278aa||null,'project_name':this['channel']['arg_1'],'callerid':this['channel']['callerid']})[_0x9673('0x10')](function(_0x4739dd){if(_0x4026e9){_0x4026e9(null,_0x4739dd);}})[_0x9673('0x12')](function(_0x38264d){if(_0x4026e9){_0x4026e9(_0x38264d);}});};AGIVertices[_0x9673('0x13')]['createSquareRecording']=function(_0x14feb6,_0x2a1466,_0x48b1d8,_0x1077ad){this['rpc']['createSquareRecording']({'uniqueid':this[_0x9673('0xc')][_0x9673('0x33')],'callerid':this[_0x9673('0xc')][_0x9673('0x36')],'calleridname':this['channel']['calleridname'],'context':this[_0x9673('0xc')][_0x9673('0x37')],'extension':this[_0x9673('0xc')][_0x9673('0x38')],'priority':this[_0x9673('0xc')]['priority'],'accountcode':this[_0x9673('0xc')][_0x9673('0x39')],'dnid':this[_0x9673('0xc')]['dnid'],'projectName':this['channel']['arg_1'],'saveName':_0x2a1466,'filename':_0x14feb6['file']||_0x2a1466,'savePath':_0x48b1d8})[_0x9673('0x10')](function(_0x36bf41){_0x1077ad(null,_0x36bf41);})[_0x9673('0x12')](function(_0x59f14a){_0x1077ad(_0x59f14a);});};AGIVertices[_0x9673('0x13')][_0x9673('0x3a')]=function(_0x3bea34,_0x48cc16,_0x482732,_0x457e1f,_0x4343a5){this[_0x9673('0xd')]['createSquareMessage']({'uniqueid':this[_0x9673('0xc')][_0x9673('0x33')],'body':_0x3bea34,'direction':_0x48cc16,'providerName':_0x482732,'providerResponse':_0x457e1f})[_0x9673('0x10')](function(_0x1b98da){if(_0x4343a5){_0x4343a5(null,_0x1b98da);}})['catch'](function(_0x480462){if(_0x4343a5){_0x4343a5(_0x480462);}});};AGIVertices[_0x9673('0x13')]['createCmContact']=function(_0x3c561b,_0x3a62fe){this[_0x9673('0xd')]['createCmContact']({'firstName':_[_0x9673('0x3b')](_0x3c561b['name'])||_['isNil'](_0x3c561b[_0x9673('0x11')])?_0x9673('0x3c')+Math[_0x9673('0x3d')]():_0x3c561b[_0x9673('0x11')],'lastName':_['isEmpty'](_0x3c561b[_0x9673('0x3e')])||_['isNil'](_0x3c561b[_0x9673('0x3e')])?null:_0x3c561b[_0x9673('0x3e')],'phone':_0x3c561b[_0x9673('0x3f')],'ListId':_0x3c561b[_0x9673('0x40')],'scheduledat':_0x3c561b['scheduledAt'],'callbackUniqueid':this[_0x9673('0xc')][_0x9673('0x33')],'tags':_0x9673('0x41'),'description':'Callback\x20scheduled\x20at\x20'+_0x3c561b[_0x9673('0x42')][_0x9673('0x43')](),'priority':_0x3c561b[_0x9673('0x44')]})[_0x9673('0x10')](function(_0x38cdf8){_0x3a62fe(null,_0x38cdf8);})[_0x9673('0x12')](function(_0x20d90d){_0x3a62fe(_0x20d90d);});};AGIVertices[_0x9673('0x13')][_0x9673('0x45')]=function(_0x18471d,_0x91c931){this[_0x9673('0xd')]['getPauseById'](_0x18471d)[_0x9673('0x10')](function(_0x268baf){_0x91c931(null,_0x268baf?_0x268baf[_0x9673('0x11')]:![]);})[_0x9673('0x12')](function(_0x408a76){_0x91c931(_0x408a76);});};AGIVertices['prototype']['agentPause']=function(_0x4b99d3,_0xd5967e,_0x59ac79){var _0x39d9a0={'role':_0x9673('0x46')};_0x39d9a0[_0x4b99d3]=this[_0x9673('0xc')][_0x9673('0x36')];this[_0x9673('0xd')][_0x9673('0x47')](_0x39d9a0,_0xd5967e,this[_0x9673('0xc')][_0x9673('0x33')])[_0x9673('0x10')](function(_0x302ca1){_0x59ac79(null,_[_0x9673('0x48')](_0x302ca1)?![]:!![]);})[_0x9673('0x12')](function(_0x267470){logger[_0x9673('0x28')](_0x267470);_0x59ac79(null,![]);});};AGIVertices[_0x9673('0x13')][_0x9673('0x49')]=function(_0x587251,_0x483139){var _0x3cc025={'role':'agent'};_0x3cc025[_0x587251]=this[_0x9673('0xc')][_0x9673('0x36')];this[_0x9673('0xd')]['agentUnpause'](_0x3cc025)['then'](function(_0x38cc40){_0x483139(null,_[_0x9673('0x48')](_0x38cc40)?![]:!![]);})[_0x9673('0x12')](function(_0x1929a1){logger[_0x9673('0x28')](_0x1929a1);_0x483139(null,![]);});};AGIVertices[_0x9673('0x13')]['agentLogout']=function(_0x436ead,_0x34b104){var _0xb2f6c2={'role':_0x9673('0x46')};_0xb2f6c2[_0x436ead]=this[_0x9673('0xc')]['callerid'];this[_0x9673('0xd')]['agentLogout'](_0xb2f6c2)[_0x9673('0x10')](function(_0x4601f7){_0x34b104(null,_['isNil'](_0x4601f7)?![]:!![]);})[_0x9673('0x12')](function(_0x539a35){logger[_0x9673('0x28')](_0x539a35);_0x34b104(null,![]);});};AGIVertices[_0x9673('0x13')][_0x9673('0x4a')]=function(_0xd14e74,_0x53d876){var _0xa22c11={'role':'agent'};_0xa22c11[_0xd14e74]=this[_0x9673('0xc')]['callerid'];var _0x6dc687=_0xd14e74!=_0x9673('0x4b')?util[_0x9673('0x24')](_0x9673('0x4c'),_0x9673('0x4d'),this['channel'][_0x9673('0x36')]):undefined;this[_0x9673('0xd')]['agentLogin'](_0xa22c11,_0x6dc687)[_0x9673('0x10')](function(_0x35aa0b){_0x53d876(null,_[_0x9673('0x48')](_0x35aa0b)?![]:!![]);})[_0x9673('0x12')](function(_0x1cd1fb){logger[_0x9673('0x28')](_0x1cd1fb);_0x53d876(null,![]);});};AGIVertices[_0x9673('0x13')][_0x9673('0x4e')]=function(_0x51c25a,_0x41135f){sh[_0x9673('0x4f')](_[_0x9673('0x50')](_0x51c25a),function(_0x7a9c52,_0x3aa063){var _0x3b80d9=_0x3aa063[_0x9673('0x51')](/(\r\n|\n|\r)/gm,'');_0x41135f(null,_0x3b80d9);});};AGIVertices[_0x9673('0x13')]['googleCloudTTS']=function(_0x3745f4,_0x505062){scripts[_0x9673('0x52')](_0x3745f4[_0x9673('0x53')],_0x3745f4['google_cloud_tts_text_type']||_0x9673('0x54'),_0x3745f4[_0x9673('0x54')],_0x3745f4[_0x9673('0x55')]||'en-US',_0x3745f4[_0x9673('0x56')]||'MALE',_0x3745f4[_0x9673('0x57')]||_0x9673('0x58'))[_0x9673('0x10')](function(_0x35946a){_0x505062(null,_0x35946a);})[_0x9673('0x12')](function(_0x437266){_0x505062(_0x437266);});};AGIVertices[_0x9673('0x13')][_0x9673('0x59')]=function(_0x40530d,_0xc6f4cd){scripts[_0x9673('0x59')](_0x40530d['text'],_0x40530d[_0x9673('0x5a')]||'en',0x1)[_0x9673('0x10')](function(_0xbccee){_0xc6f4cd(null,_0xbccee);})[_0x9673('0x12')](function(_0x486727){_0xc6f4cd(_0x486727);});};AGIVertices['prototype'][_0x9673('0x5b')]=function(_0x254f54,_0x286144){var _0xebe383={'uri':_0x254f54[_0x9673('0x5c')],'method':_0x254f54[_0x9673('0x5d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x254f54[_0x9673('0x5e')])===_0x9673('0x5f')&&parseInt(_0x254f54[_0x9673('0x5e')])>=0x1?parseInt(_0x254f54[_0x9673('0x5e')])*0x3e8:0x5*0x3e8};if(_[_0x9673('0x60')]([_0x9673('0x61'),_0x9673('0x62')],_0xebe383[_0x9673('0x5d')]['toUpperCase']())){try{_0xebe383[_0x9673('0x63')]=_0x254f54[_0x9673('0xa')]?JSON['parse'](_0x254f54[_0x9673('0xa')]):{};}catch(_0x36ee15){logger[_0x9673('0x28')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36ee15);}}try{_0xebe383['headers']=_0x254f54[_0x9673('0x9')]?JSON[_0x9673('0x64')](_0x254f54[_0x9673('0x9')]):{};}catch(_0x186d7f){logger[_0x9673('0x28')](_0x9673('0x65'),_0x186d7f);}if(_0x254f54[_0x9673('0x66')]){try{var _0x4adb7a=require(_0x254f54[_0x9673('0x66')])['sync'](this,_0xebe383);_0xebe383['uri']=Mustache[_0x9673('0x67')](_0x254f54[_0x9673('0x5c')],_0x4adb7a,{},['$$','$$']);if(_0xebe383[_0x9673('0x68')]){_0xebe383['headers']=JSON[_0x9673('0x64')](Mustache[_0x9673('0x67')](JSON['stringify'](_0xebe383[_0x9673('0x68')]),_0x4adb7a,{},['$$','$$']));}if(_0xebe383[_0x9673('0x63')]){_0xebe383[_0x9673('0x63')]=JSON[_0x9673('0x64')](Mustache[_0x9673('0x67')](JSON[_0x9673('0x69')](_0xebe383[_0x9673('0x63')]),_0x4adb7a,{},['$$','$$']));}}catch(_0x244aeb){logger[_0x9673('0x28')](_0x9673('0x6a'),_0x244aeb);}}rp(_0xebe383)[_0x9673('0x10')](function(_0x1ee565){var _0x2b9be6={'statusCode':_0x1ee565[_0x9673('0x6b')]||0xc8,'statusMessage':_0x1ee565[_0x9673('0x6c')]||'OK','headers':_0x1ee565[_0x9673('0x68')]||{},'body':_0x1ee565[_0x9673('0x63')]||{}};_0x286144(null,_0x2b9be6);})[_0x9673('0x12')](function(_0x508cf4){var _0x7a6469={'statusCode':_0x508cf4[_0x9673('0x6b')]||0x1f4,'statusMessage':_0x508cf4[_0x9673('0x6d')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x508cf4[_0x9673('0x6e')][_0x9673('0x68')]||{},'body':_0x508cf4[_0x9673('0x6e')][_0x9673('0x63')]||{}};_0x286144(null,_0x7a6469);});};AGIVertices['prototype'][_0x9673('0x6f')]=function(_0x32baa3,_0x4e258f){scripts[_0x9673('0x6f')](this[_0x9673('0xc')]['uniqueid'],_0x32baa3[_0x9673('0x70')],_0x32baa3[_0x9673('0x54')],_0x32baa3[_0x9673('0x71')]||'en')['then'](function(_0x22a1c0){_0x4e258f(null,_0x22a1c0);})[_0x9673('0x12')](function(_0x483295){_0x4e258f(_0x483295);});};AGIVertices[_0x9673('0x13')][_0x9673('0x72')]=function(_0x1a9f83,_0x1dc63b){scripts[_0x9673('0x72')](this[_0x9673('0xc')][_0x9673('0x33')],_0x1a9f83[_0x9673('0x73')],_0x1a9f83['client_email'],_0x1a9f83[_0x9673('0x74')],_0x1a9f83[_0x9673('0x54')],_0x1a9f83['dialogflowV2_language']||'en')['then'](function(_0x370787){_0x1dc63b(null,_0x370787);})[_0x9673('0x12')](function(_0x377958){_0x1dc63b(_0x377958);});};AGIVertices['prototype'][_0x9673('0x75')]=function(_0x14ac90,_0x5bba98){scripts[_0x9673('0x75')](this[_0x9673('0xc')],_0x14ac90)[_0x9673('0x10')](function(_0x282b84){_0x5bba98(null,_0x282b84);})[_0x9673('0x12')](function(_0x53d2e5){_0x5bba98(_0x53d2e5);});};AGIVertices[_0x9673('0x13')][_0x9673('0x76')]=function(_0x5d92e1,_0x174351){scripts['ispeechTTS'](_0x5d92e1[_0x9673('0x70')],_0x5d92e1[_0x9673('0x54')],_0x5d92e1[_0x9673('0x77')]||_0x9673('0x78'),_0x5d92e1[_0x9673('0x79')])[_0x9673('0x10')](function(_0x4bbdb3){_0x174351(null,_0x4bbdb3);})['catch'](function(_0x3f9d3c){_0x174351(_0x3f9d3c);});};AGIVertices[_0x9673('0x13')][_0x9673('0x7a')]=function(_0x372a3f,_0x204055,_0x1f99d4){scripts[_0x9673('0x7a')](_0x204055,_0x372a3f[_0x9673('0x70')],_0x372a3f[_0x9673('0x7b')]||'en-US',this[_0x9673('0x7c')](_0x372a3f['model'])?_0x372a3f[_0x9673('0x7d')]:undefined)[_0x9673('0x10')](function(_0x223c45){_0x1f99d4(null,_0x223c45);})['catch'](function(_0x15bc6f){_0x1f99d4(_0x15bc6f);});};AGIVertices[_0x9673('0x13')][_0x9673('0x7e')]=function(_0x221a8e,_0x134e71){scripts['awsPolly'](_0x221a8e[_0x9673('0x7f')],_0x221a8e[_0x9673('0x80')],_0x221a8e[_0x9673('0x81')],_0x221a8e[_0x9673('0x82')]||_0x9673('0x83'),_0x221a8e['text'],_0x221a8e['aws_text_type']||'text')[_0x9673('0x10')](function(_0x380638){_0x134e71(null,_0x380638);})['catch'](function(_0x45f00f){_0x134e71(_0x45f00f);});};AGIVertices['prototype']['awsLex']=function(_0x54d4da,_0x14631b){scripts[_0x9673('0x84')](this[_0x9673('0xc')][_0x9673('0x33')],_0x54d4da[_0x9673('0x7f')],_0x54d4da[_0x9673('0x80')],_0x54d4da[_0x9673('0x85')],_0x54d4da['text'],_0x54d4da[_0x9673('0x86')])[_0x9673('0x10')](function(_0x2345b7){_0x14631b(null,_0x2345b7);})[_0x9673('0x12')](function(_0x19bcf8){_0x14631b(_0x19bcf8);});};AGIVertices[_0x9673('0x13')][_0x9673('0x87')]=function(_0x56ee6f,_0x6eb7ae,_0x145dcf){scripts[_0x9673('0x87')](_0x6eb7ae,_0x56ee6f[_0x9673('0x70')],_0x56ee6f[_0x9673('0x88')]||_0x9673('0x78'))[_0x9673('0x10')](function(_0x53e9f7){_0x145dcf(null,_0x53e9f7);})['catch'](function(_0x43b99){_0x145dcf(_0x43b99);});};AGIVertices[_0x9673('0x13')]['tildeASR']=function(_0x174704,_0x434ca1,_0x584e09){scripts[_0x9673('0x89')](_0x434ca1,_0x174704[_0x9673('0x8a')],_0x174704[_0x9673('0x8b')],_0x174704[_0x9673('0x8c')])[_0x9673('0x10')](function(_0x4cc669){_0x584e09(null,_0x4cc669);})[_0x9673('0x12')](function(_0x12b79d){_0x584e09(_0x12b79d);});};AGIVertices[_0x9673('0x13')]['clear']=function(_0xc7cdd9){var _0x2af650=_[_0x9673('0x60')](verticesWithRetry,_0xc7cdd9[_0x9673('0x35')])?_0xc7cdd9:_[_0x9673('0x8d')](_0xc7cdd9);for(var _0x718256 in _0x2af650){if(_0x2af650[_0x9673('0x8e')](_0x718256)){if(_0x2af650[_0x718256]&&_[_0x9673('0x8f')](_0x2af650[_0x718256])){if(_[_0x9673('0x60')](recursiveMapAttributes,_0x718256)){_0x2af650[_0x718256]=this['replaceObjectAllVariables'](_0x2af650[_0x718256]);}else{_0x2af650[_0x718256]=this[_0x9673('0x90')](_0x2af650[_0x718256]);}}}}return _0x2af650;};AGIVertices[_0x9673('0x13')][_0x9673('0x91')]=function(_0x1e11a7){for(var _0x1d0d35 in _0x1e11a7){if(_0x1e11a7[_0x9673('0x8e')](_0x1d0d35)){if(_[_0x9673('0x92')](_0x1e11a7[_0x1d0d35])){this[_0x9673('0x91')](_0x1e11a7[_0x1d0d35]);}else if(_[_0x9673('0x93')](_0x1e11a7[_0x1d0d35])){for(var _0x263c04=0x0;_0x263c04<_0x1e11a7[_0x1d0d35][_0x9673('0x94')];_0x263c04++){this[_0x9673('0x91')](_0x1e11a7[_0x1d0d35][_0x263c04]);}}else if(_[_0x9673('0x8f')](_0x1e11a7[_0x1d0d35])){_0x1e11a7[_0x1d0d35]=this[_0x9673('0x90')](_0x1e11a7[_0x1d0d35]);}}}};AGIVertices['prototype'][_0x9673('0x95')]=function(_0x27d55c,_0x6696da){for(var _0xb375f1 in _0x27d55c){if(_0x27d55c[_0x9673('0x8e')](_0xb375f1)){if(_[_0x9673('0x92')](_0x27d55c[_0xb375f1])){if(!_[_0x9673('0x3b')](_0x27d55c[_0xb375f1])){this['saveRestApiResult'](_0x27d55c[_0xb375f1],util['format'](_0x9673('0x96'),_0x6696da,_0xb375f1));}}else if(_[_0x9673('0x93')](_0x27d55c[_0xb375f1])){for(var _0x3b4c58=0x0;_0x3b4c58<_0x27d55c[_0xb375f1][_0x9673('0x94')];_0x3b4c58++){this[_0x9673('0x95')](_0x27d55c[_0xb375f1][_0x3b4c58],util[_0x9673('0x24')]('%s.%s',_0x6696da,_0xb375f1+'['+_0x3b4c58+']'));}}else{if(!_[_0x9673('0x48')](_0x27d55c[_0xb375f1])){this[_0x9673('0xc')][_0x9673('0x97')](util[_0x9673('0x24')]('%s.%s',_0x6696da,_0xb375f1),_0x27d55c[_0xb375f1]);}}}}};AGIVertices['prototype'][_0x9673('0x98')]=function(_0x21bcea){try{var _0x4b83f2=JSON[_0x9673('0x64')](_0x21bcea);this[_0x9673('0x91')](_0x4b83f2);return JSON['stringify'](_0x4b83f2);}catch(_0x15f7bc){return this[_0x9673('0x90')](_0x21bcea);}};AGIVertices[_0x9673('0x13')][_0x9673('0x90')]=function(_0x19acc2){var _0x3a6871=_0x19acc2[_0x9673('0x99')]('{');for(var _0x28a070=0x1;_0x28a070<_0x3a6871['length'];_0x28a070+=0x1){var _0x3d70ad=_0x3a6871[_0x28a070][_0x9673('0x99')]('}');if(_0x3d70ad['length']>0x1){_0x19acc2=_0x19acc2[_0x9673('0x9a')]('{'+_0x3d70ad[0x0]+'}',this[_0x9673('0xc')][_0x9673('0xf')](_0x3d70ad[0x0])[_0x9673('0x9b')]||_0x3d70ad[0x0]);}}if(_0x3a6871[_0x9673('0x94')]===0x1){return _0x19acc2['toString']();}return this['replaceAllVariables'](_0x19acc2);};AGIVertices[_0x9673('0x13')][_0x9673('0x9c')]=function(_0x523c93,_0x4f54b7){var _0x1a6399=this[_0x9673('0xc')][_0x9673('0xf')](_0x523c93);if(_0x1a6399['result']===-0x1){return _0x1a6399;}logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x9d'),_0x4f54b7,_0x1a6399['extra']));return this[_0x9673('0xc')]['setVariable'](_0x4f54b7,_0x1a6399['extra']);};AGIVertices[_0x9673('0x13')][_0x9673('0x7c')]=function(_0x4a72a0){return _0x4a72a0&&_0x4a72a0!=='0'&&_0x4a72a0!=='-1'&&_0x4a72a0!=='';};AGIVertices[_0x9673('0x13')][_0x9673('0x9e')]=function(_0x26f0cd){this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x26f0cd,'-');_0x26f0cd[_0x9673('0xa0')]=_0x26f0cd[_0x9673('0x9e')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9673('0x13')][_0x9673('0xa1')]=function(_0x310efe){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xa2'),_0x310efe[_0x9673('0x34')]));if(!this['isConfigured'](_0x310efe[_0x9673('0x54')])){return this[_0x9673('0xc')][_0x9673('0xa3')]('no\x20text\x20configured');}var _0x2fddee='\x22'+_0x310efe['text']+'\x22';if(this[_0x9673('0x7c')](_0x310efe[_0x9673('0x6e')])){_0x2fddee+=','+_0x310efe[_0x9673('0x6e')];}var _0x3f1739=this[_0x9673('0xc')]['exec'](_0x9673('0xa4'),_0x2fddee);if(_0x3f1739[_0x9673('0xa5')]===-0x1){return _0x3f1739;}return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xa6'),_0x2fddee));};AGIVertices[_0x9673('0x13')]['mrcprecog']=function(_0x5ed446){logger['info'](util[_0x9673('0x24')](_0x9673('0xa7'),_0x5ed446[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x5ed446['grammar'])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xa8'));}var _0x52c411=_0x5ed446[_0x9673('0xa9')];if(this[_0x9673('0x7c')](_0x5ed446[_0x9673('0x6e')])){_0x52c411+=','+_0x5ed446[_0x9673('0x6e')];}var _0x136954=this[_0x9673('0xc')][_0x9673('0x4f')]('MRCPRecog',_0x52c411);if(_0x136954['result']===-0x1){return _0x136954;}var _0x47cc8d=this[_0x9673('0x9c')](_0x9673('0xaa'),_0x9673('0xab'));if(_0x47cc8d[_0x9673('0xa5')]===-0x1){return _0x47cc8d;}var _0xc53fb7=this[_0x9673('0x9c')](_0x9673('0xac'),_0x9673('0xad'));if(_0xc53fb7[_0x9673('0xa5')]===-0x1){return _0xc53fb7;}var _0x5c19e4=this[_0x9673('0x9c')](_0x9673('0xae'),'MRCP_RECOG_INSTANCE');if(_0x5c19e4['result']===-0x1){return _0x5c19e4;}return this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xaf'),_0x52c411));};AGIVertices[_0x9673('0x13')][_0x9673('0xb0')]=function(_0x45a6c9){logger[_0x9673('0x2b')](util[_0x9673('0x24')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x45a6c9[_0x9673('0x34')]));return this['channel']['agi']([_0x45a6c9[_0x9673('0xb1')],_0x45a6c9[_0x9673('0xb2')]]);};AGIVertices[_0x9673('0x13')][_0x9673('0xb3')]=function(_0xb3193c){logger[_0x9673('0x2b')](util[_0x9673('0x24')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xb3193c[_0x9673('0x34')]));if(this[_0x9673('0x7c')](_0xb3193c[_0x9673('0x5e')])){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xb4'),_0xb3193c[_0x9673('0x5e')]));var _0x43338d=this['channel'][_0x9673('0xb5')](_0xb3193c[_0x9673('0x5e')]);if(_0x43338d[_0x9673('0xa5')]===-0x1){return _0x43338d;}}return this[_0x9673('0xc')][_0x9673('0xb3')]();};AGIVertices[_0x9673('0x13')]['callback']=function(_0x57dc9c){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xb6'),_0x57dc9c[_0x9673('0x34')]));if(!this['isConfigured'](_0x57dc9c['list_id'])){return this['channel'][_0x9673('0x28')](_0x57dc9c,_0x9673('0xb7'));}_0x57dc9c[_0x9673('0x42')]=moment();if(this[_0x9673('0x7c')](_0x57dc9c['delay'])){_0x57dc9c[_0x9673('0x42')]=moment()[_0x9673('0xb8')](_0x57dc9c[_0x9673('0xb9')],_0x9673('0xba'));}if(!this[_0x9673('0x7c')](_0x57dc9c[_0x9673('0x44')])){_0x57dc9c[_0x9673('0x44')]=0x2;}this[_0x9673('0xbb')][_0x9673('0x9f')](this,_0x57dc9c);return this['channel'][_0x9673('0xa3')](util['format'](_0x9673('0xbc'),_0x57dc9c[_0x9673('0x3f')],_0x57dc9c[_0x9673('0x40')],_0x57dc9c[_0x9673('0x42')]));};AGIVertices[_0x9673('0x13')][_0x9673('0xbd')]=function(_0x3116e9){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xbe'),_0x3116e9['label']));var _0x5d8be9=this[_0x9673('0xc')]['exec'](_0x3116e9[_0x9673('0xbf')],_0x3116e9['options']);if(_0x5d8be9['result']===-0x1){return _0x5d8be9;}return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xc0'),_0x3116e9[_0x9673('0xbf')],_0x3116e9[_0x9673('0x6e')]));};AGIVertices['prototype'][_0x9673('0xc1')]=function(_0x24dd0c){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xc2'),_0x24dd0c[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x24dd0c[_0x9673('0x54')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xc3'));}var _0x181d5a='\x22'+_0x24dd0c[_0x9673('0x54')]+'\x22';if(this['isConfigured'](_0x24dd0c['options'])){_0x181d5a+=','+_0x24dd0c[_0x9673('0x6e')];}var _0x5326c2=this['channel'][_0x9673('0x4f')]('MRCPSynth',_0x181d5a);if(_0x5326c2[_0x9673('0xa5')]===-0x1){return _0x5326c2;}return this[_0x9673('0xc')][_0x9673('0xa3')](util['format'](_0x9673('0xa6'),_0x181d5a));};AGIVertices[_0x9673('0x13')][_0x9673('0xc4')]=function(_0x4371b6){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xc5'),_0x4371b6[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x4371b6[_0x9673('0x54')])){return this[_0x9673('0xc')]['noop']('no\x20text\x20configured');}var _0x50a715='\x22'+_0x4371b6[_0x9673('0x54')]+'\x22';if(this[_0x9673('0x7c')](_0x4371b6['options'])){_0x50a715+=','+_0x4371b6[_0x9673('0x6e')];}var _0x42729e=this[_0x9673('0xc')][_0x9673('0x4f')](_0x9673('0xa4'),_0x50a715);if(_0x42729e[_0x9673('0xa5')]===-0x1){return _0x42729e;}return this[_0x9673('0xc')]['noop'](util[_0x9673('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x50a715));};AGIVertices[_0x9673('0x13')][_0x9673('0xc6')]=function(_0x56bf94){logger['info'](util[_0x9673('0x24')](_0x9673('0xc7'),_0x56bf94[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x56bf94[_0x9673('0xa9')])){return this['channel'][_0x9673('0xa3')]('no\x20grammar\x20configured');}var _0x184506=_0x56bf94[_0x9673('0xa9')];if(this[_0x9673('0x7c')](_0x56bf94[_0x9673('0x6e')])){_0x184506+=','+_0x56bf94[_0x9673('0x6e')];}var _0x370258=this[_0x9673('0xc')]['exec'](_0x9673('0xc8'),_0x184506);if(_0x370258[_0x9673('0xa5')]===-0x1){return _0x370258;}var _0x593f98=this[_0x9673('0x9c')](_0x9673('0xaa'),'LUMENVOX_ASR_CONFIDENCE');if(_0x593f98[_0x9673('0xa5')]===-0x1){return _0x593f98;}var _0xdd71f4=this[_0x9673('0x9c')](_0x9673('0xac'),_0x9673('0xc9'));if(_0xdd71f4[_0x9673('0xa5')]===-0x1){return _0xdd71f4;}var _0x1f618c=this[_0x9673('0x9c')](_0x9673('0xae'),_0x9673('0xca'));if(_0x1f618c[_0x9673('0xa5')]===-0x1){return _0x1f618c;}return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xaf'),_0x184506));};AGIVertices[_0x9673('0x13')][_0x9673('0xcb')]=function(_0x684754){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xcc'),_0x684754[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x684754[_0x9673('0xa9')])){return this[_0x9673('0xc')]['noop'](_0x9673('0xa8'));}var _0x135acb=_0x684754[_0x9673('0xa9')];if(this['isConfigured'](_0x684754[_0x9673('0x6e')])){_0x135acb+=','+_0x684754[_0x9673('0x6e')];}var _0x4d8d02=this[_0x9673('0xc')][_0x9673('0x4f')](_0x9673('0xc8'),_0x135acb);if(_0x4d8d02[_0x9673('0xa5')]===-0x1){return _0x4d8d02;}var _0x1266d8=this[_0x9673('0x9c')](_0x9673('0xaa'),_0x9673('0xcd'));if(_0x1266d8[_0x9673('0xa5')]===-0x1){return _0x1266d8;}var _0x34e2f2=this['getAndSetVariable'](_0x9673('0xac'),_0x9673('0xce'));if(_0x34e2f2[_0x9673('0xa5')]===-0x1){return _0x34e2f2;}var _0x984cb2=this['getAndSetVariable'](_0x9673('0xae'),_0x9673('0xcf'));if(_0x984cb2[_0x9673('0xa5')]===-0x1){return _0x984cb2;}return this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xaf'),_0x135acb));};AGIVertices['prototype'][_0x9673('0xd0')]=function(_0x2a8482){logger[_0x9673('0x2b')](util[_0x9673('0x24')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2a8482[_0x9673('0x34')]));if(!this['isConfigured'](_0x2a8482[_0x9673('0xd1')])){return this[_0x9673('0xc')]['error'](_0x2a8482,'no\x20database\x20selected');}var _0x3eeb9b=this[_0x9673('0x17')]['sync'](this,_0x2a8482['odbc_id']);if(!_0x3eeb9b){return this['channel'][_0x9673('0x28')](_0x2a8482,_0x9673('0xd2'));}if(!this['isConfigured'](_0x2a8482['query'])){return this[_0x9673('0xc')]['error'](_0x2a8482,'no\x20query\x20configured');}var _0x1033f5=_0x2a8482[_0x9673('0x2a')][_0x9673('0x51')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9673('0xc')][_0x9673('0xa3')](util['format'](_0x9673('0xd3'),_0x1033f5));var _0xe01af3=this[_0x9673('0x26')][_0x9673('0x9f')](this,_0x3eeb9b,_0x1033f5);this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x2a8482,_0x1033f5);if(!this[_0x9673('0x7c')](_0x2a8482[_0x9673('0xd4')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xd5'));}var _0x13fede=this['getVariable'][_0x9673('0x9f')](this,_0x2a8482[_0x9673('0xd4')]);if(!_0x13fede){return this['channel'][_0x9673('0x28')](_0x2a8482,_0x9673('0xd6'));}var _0x41f02c=this;_0xe01af3[_0x9673('0xd7')](function(_0x237423,_0x20231f){Object[_0x9673('0xd8')](_0x237423)[_0x9673('0xd7')](function(_0x4953d3){_0x41f02c[_0x9673('0xc')][_0x9673('0x97')](util[_0x9673('0x24')]('%s[%s][%s]',_0x13fede,_0x20231f,_0x4953d3),_0x237423[_0x4953d3]);});});this[_0x9673('0xc')]['setVariable'](util['format'](_0x9673('0xd9'),_0x13fede),_0xe01af3[_0x9673('0x94')]);return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xda'),_0x13fede));};AGIVertices[_0x9673('0x13')][_0x9673('0xdb')]=function(_0x4da864){logger[_0x9673('0xdc')](util[_0x9673('0x24')](_0x9673('0xdd'),_0x4da864[_0x9673('0x34')]));if(!this['isConfigured'](_0x4da864[_0x9673('0xde')])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x4da864,_0x9673('0xdf'));}var _0x1614a4=this['getUser'][_0x9673('0x9f')](this,_0x4da864['sip_id']);if(!_0x1614a4){return this[_0x9673('0xc')][_0x9673('0x28')](_0x4da864,_0x9673('0xe0'));}var _0xa0ac31=this['channel']['exec']('DIAL',[util[_0x9673('0x24')](_0x9673('0xe1'),_0x1614a4),_0x4da864[_0x9673('0x5e')],_0x4da864[_0x9673('0xe2')],_0x4da864[_0x9673('0x5c')]]);if(_0xa0ac31[_0x9673('0xa5')]===-0x1){return _0xa0ac31;}return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')]('Executed\x20command\x20%s',_0x9673('0xe3')));};AGIVertices[_0x9673('0x13')][_0x9673('0xe4')]=function(_0x323eed){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xe5'),_0x323eed[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x323eed[_0x9673('0x70')])){return this[_0x9673('0xc')][_0x9673('0xa3')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x323eed['text'])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xc3'));}this[_0x9673('0xc')][_0x9673('0xe6')]=!![];this[_0x9673('0x32')](_0x323eed);this[_0x9673('0x3a')](_0x323eed['text'],'in','','');this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xe7'),_0x323eed[_0x9673('0x54')]));var _0x704226=this['googleDialogflow']['sync'](this,_0x323eed);if(_0x704226){for(var _0x49f4a7 in _0x704226){if(_0x704226['hasOwnProperty'](_0x49f4a7)){this[_0x9673('0xc')]['setVariable'](util[_0x9673('0x24')](_0x9673('0xe8'),_0x49f4a7[_0x9673('0xe9')]()),_0x704226[_0x49f4a7]);}}this[_0x9673('0x3a')](_0x704226[_0x9673('0xea')],_0x9673('0xeb'),_0x9673('0xe4'),'');return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xec'),_0x704226[_0x9673('0xea')]));}return this[_0x9673('0xc')][_0x9673('0x28')](_0x323eed,_0x9673('0xed'));};AGIVertices[_0x9673('0x13')][_0x9673('0xee')]=function(_0x360920){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xef'),_0x360920['label']));if(!this[_0x9673('0x7c')](_0x360920[_0x9673('0x73')])){return this[_0x9673('0xc')]['noop'](_0x9673('0xf0'));}if(!this[_0x9673('0x7c')](_0x360920[_0x9673('0xf1')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xf2'));}if(!this[_0x9673('0x7c')](_0x360920['private_key'])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xf3'));}if(!this['isConfigured'](_0x360920[_0x9673('0xf4')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xf5'));}if(!this[_0x9673('0x7c')](_0x360920[_0x9673('0x54')])){return this[_0x9673('0xc')]['noop'](_0x9673('0xc3'));}this[_0x9673('0xc')][_0x9673('0xe6')]=!![];this[_0x9673('0x32')](_0x360920);this[_0x9673('0x3a')](_0x360920['text'],'in','','');this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xf6'),_0x360920['text']));var _0x527fe9=this[_0x9673('0x72')][_0x9673('0x9f')](this,_0x360920);if(_0x527fe9){for(var _0xec894d in _0x527fe9){if(_0x527fe9['hasOwnProperty'](_0xec894d)){if(_0xec894d!=='providerResponse'){this['channel']['setVariable'](util['format']('DIALOGFLOW_%s',_0xec894d[_0x9673('0xe9')]()),_0x527fe9[_0xec894d]);}}}this['createSquareMessage'](_0x527fe9[_0x9673('0xea')],_0x9673('0xeb'),_0x9673('0xee'),_0x527fe9[_0x9673('0xf7')]);return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xf8'),_0x527fe9[_0x9673('0xea')]));}return this['channel'][_0x9673('0x28')](_0x360920,_0x9673('0xf9'));};AGIVertices['prototype']['sesteknda']=function(_0x135893){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0xfa'),_0x135893[_0x9673('0x34')]));if(!this['isConfigured'](_0x135893[_0x9673('0xfb')])){return this['channel'][_0x9673('0xa3')](_0x9673('0xfc'));}if(!this[_0x9673('0x7c')](_0x135893[_0x9673('0xfd')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xfe'));}if(!this[_0x9673('0x7c')](_0x135893['password'])){return this['channel'][_0x9673('0xa3')]('no\x20password\x20configured');}if(!this[_0x9673('0x7c')](_0x135893[_0x9673('0xff')])){return this[_0x9673('0xc')]['noop'](_0x9673('0xc3'));}this['channel'][_0x9673('0xe6')]=!![];this[_0x9673('0x32')](_0x135893);this[_0x9673('0x3a')](_0x135893[_0x9673('0x54')],'in','','');this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x100'),_0x135893[_0x9673('0x54')]));var _0x467cb3=this[_0x9673('0x75')][_0x9673('0x9f')](this,_0x135893);if(_0x467cb3){for(var _0x5db987 in _0x467cb3){if(_0x467cb3[_0x9673('0x8e')](_0x5db987)){this[_0x9673('0xc')]['setVariable'](util[_0x9673('0x24')](_0x9673('0x101'),_0x5db987[_0x9673('0xe9')]()),_0x467cb3[_0x5db987]);}}this[_0x9673('0x3a')](_0x467cb3[_0x9673('0xea')],_0x9673('0xeb'),'sesteknda','');if(_0x467cb3['audiofile']){this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x467cb3[_0x9673('0x102')]));var _0x4795d6=this[_0x9673('0xc')][_0x9673('0x103')](_0x467cb3[_0x9673('0x102')]);try{fs[_0x9673('0x104')](_0x467cb3[_0x9673('0x102')]+_0x9673('0x105'));}catch(_0x3f3335){logger[_0x9673('0x28')](_0x3f3335);}return _0x4795d6;}else{return this['channel']['noop'](util[_0x9673('0x24')](_0x9673('0x106'),_0x467cb3[_0x9673('0xea')]));}}return this[_0x9673('0xc')]['error'](_0x135893,_0x9673('0x107'));};AGIVertices['prototype'][_0x9673('0x108')]=function(_0x122c95){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x109'),_0x122c95[_0x9673('0x34')]));return this['channel'][_0x9673('0xa3')](_0x9673('0x108'));};AGIVertices[_0x9673('0x13')]['ext_dial']=function(_0x53d5a1){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x53d5a1['label']));var _0x2a3169='';if(_0x53d5a1['trunk_id']){if(!this[_0x9673('0x7c')](_0x53d5a1[_0x9673('0x10a')])){return this['channel']['error'](_0x53d5a1,_0x9673('0x10b'));}else{var _0x48c2b0=parseInt(_0x53d5a1[_0x9673('0x10a')],0xa);if(isNaN(_0x48c2b0)){_0x2a3169=_0x53d5a1[_0x9673('0x10a')];}else{_0x2a3169=this[_0x9673('0x1a')][_0x9673('0x9f')](this,_0x53d5a1[_0x9673('0x10a')]);if(!_0x2a3169){return this[_0x9673('0xc')][_0x9673('0x28')](_0x53d5a1,_0x9673('0x10c'));}}}}else if(_0x53d5a1[_0x9673('0x10d')]){_0x2a3169=_0x53d5a1[_0x9673('0x10d')];}else{return this['channel'][_0x9673('0x28')](_0x53d5a1,_0x9673('0x10b'));}var _0x8f37ef=this[_0x9673('0xc')][_0x9673('0x4f')]('DIAL',[util[_0x9673('0x24')]('SIP/%s/%s',_0x2a3169,_0x53d5a1[_0x9673('0x3f')]),_0x53d5a1[_0x9673('0x5e')],_0x53d5a1['opts'],_0x53d5a1['url']]);if(_0x8f37ef[_0x9673('0xa5')]===-0x1){return _0x8f37ef;}return this[_0x9673('0xc')][_0x9673('0xa3')](util['format']('Executed\x20command\x20%s',_0x9673('0xe3')));};AGIVertices[_0x9673('0x13')]['finally']=function(_0x19527d){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x10e'),_0x19527d[_0x9673('0x34')]));return this['channel']['noop']('finally');};AGIVertices[_0x9673('0x13')][_0x9673('0x10f')]=function(_0x30d976){logger[_0x9673('0x2b')](util['format'](_0x9673('0x110'),_0x30d976[_0x9673('0x34')]));if(_0x30d976[_0x9673('0xa0')]===0x0){return this[_0x9673('0x9e')](_0x30d976);}_0x30d976[_0x9673('0xa0')]-=0x1;if(!this[_0x9673('0x7c')](_0x30d976['file_id'])){return this[_0x9673('0xc')]['error'](_0x30d976,_0x9673('0x111'));}var _0x2a7ed4=this[_0x9673('0x1c')][_0x9673('0x9f')](this,_0x30d976[_0x9673('0x112')]);if(!_0x2a7ed4){return this[_0x9673('0xc')][_0x9673('0x28')](_0x30d976,'no\x20file\x20audio\x20found');}if(!this[_0x9673('0x7c')](_0x30d976['variable_id'])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x9673('0xd5'));}var _0x1d86ca=this[_0x9673('0xc')][_0x9673('0x113')](_0x2a7ed4,_0x30d976['response'],_0x30d976['maxdigit']);var _0x25ad53=_0x1d86ca['result']?_0x1d86ca[_0x9673('0xa5')][_0x9673('0x43')]():'';logger[_0x9673('0x2b')](_0x9673('0x114'),JSON['stringify'](_0x1d86ca));if(_0x1d86ca[_0x9673('0xa5')]===-0x1){this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x30d976,_0x25ad53);return _0x1d86ca;}else if(_0x1d86ca['extra']==='timeout'){_0x1d86ca['result']=_0x25ad53[_0x9673('0x94')]>=parseInt(_0x30d976[_0x9673('0x115')])?'x':'i';}else{_0x1d86ca['result']=_0x25ad53['length']>=parseInt(_0x30d976[_0x9673('0x115')])&&_0x25ad53[_0x9673('0x94')]<=parseInt(_0x30d976[_0x9673('0x116')])?'x':'i';}var _0x1f1b17=this[_0x9673('0xf')][_0x9673('0x9f')](this,_0x30d976[_0x9673('0xd4')]);if(!_0x1f1b17){return this['channel'][_0x9673('0x28')](_0x30d976,_0x9673('0xd6'));}this[_0x9673('0xc')][_0x9673('0x97')](_0x1f1b17,_0x25ad53);if(this[_0x9673('0x7c')](_0x30d976[_0x9673('0x117')])){var _0x449eb8=parseInt(_0x30d976[_0x9673('0x117')],0xa);var _0x37387a=rs[_0x9673('0x118')]({'charset':'*','length':_0x449eb8});var _0x543c5d=_0x25ad53[_0x9673('0x94')];if(_0x543c5d>0x0){if(_0x543c5d>_0x449eb8){this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x30d976,_0x30d976[_0x9673('0x119')]===_0x9673('0x11a')?_0x37387a+_0x25ad53[_0x9673('0x11b')](_0x449eb8):_0x25ad53[_0x9673('0x11b')](0x0,_0x543c5d-_0x449eb8)+_0x37387a);}else{this['createSquareDetailsReport'][_0x9673('0x9f')](this,_0x30d976,rs[_0x9673('0x118')]({'charset':'*','length':_0x543c5d}));}}else{this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x30d976,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x30d976,_0x25ad53);}return _0x1d86ca;};AGIVertices['prototype'][_0x9673('0xb')]=function(_0x2c686b){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x11c'),_0x2c686b[_0x9673('0x34')]));return this['getdigits'](_0x2c686b);};AGIVertices[_0x9673('0x13')][_0x9673('0x11d')]=function(_0x3a0a27){logger[_0x9673('0x2b')](util['format'](_0x9673('0x11e'),_0x3a0a27[_0x9673('0x34')]));this[_0x9673('0x32')]['sync'](this,_0x3a0a27,_0x3a0a27[_0x9673('0x11f')]);return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x120'),_0x3a0a27['goalname']));};AGIVertices['prototype']['awspolly']=function(_0x2745c8){logger[_0x9673('0x2b')](util['format'](_0x9673('0x121'),_0x2745c8[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x2745c8[_0x9673('0x7f')])||!this['isConfigured'](_0x2745c8['aws_secret_access_key'])){return this[_0x9673('0xc')][_0x9673('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2745c8[_0x9673('0x54')])){return this['channel'][_0x9673('0xa3')]('no\x20text\x20configured');}this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')]('Trying\x20aws\x20Polly\x20%s',_0x2745c8[_0x9673('0x54')]));var _0x2cd921=this[_0x9673('0x7e')][_0x9673('0x9f')](this,_0x2745c8);if(_0x2cd921){this[_0x9673('0xc')][_0x9673('0xa3')](util['format'](_0x9673('0x122'),_0x2cd921));var _0x2bf0cd=this[_0x9673('0xc')]['streamFile'](_0x2cd921);try{fs[_0x9673('0x104')](_0x2cd921+'.wav');}catch(_0x211c34){logger[_0x9673('0x28')](_0x211c34);}return _0x2bf0cd;}return this[_0x9673('0xc')][_0x9673('0x28')](_0x2745c8,_0x9673('0x123'));};AGIVertices[_0x9673('0x13')]['awslex']=function(_0x326e96){logger['info'](util[_0x9673('0x24')](_0x9673('0x124'),_0x326e96[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x326e96[_0x9673('0x7f')])||!this[_0x9673('0x7c')](_0x326e96[_0x9673('0x80')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x125'));}if(!this[_0x9673('0x7c')](_0x326e96[_0x9673('0x86')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x126'));}if(!this[_0x9673('0x7c')](_0x326e96[_0x9673('0x54')])){return this[_0x9673('0xc')][_0x9673('0xa3')]('no\x20text\x20configured');}this[_0x9673('0xc')][_0x9673('0xe6')]=!![];this[_0x9673('0x32')](_0x326e96);this[_0x9673('0x3a')](_0x326e96['text'],'in','','');this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x127'),_0x326e96['text']));var _0x33090d=this[_0x9673('0x84')][_0x9673('0x9f')](this,_0x326e96);if(_0x33090d){for(var _0x4d728b in _0x33090d){if(_0x33090d[_0x9673('0x8e')](_0x4d728b)&&_['isString'](_0x33090d[_0x4d728b])){this[_0x9673('0xc')][_0x9673('0x97')](util[_0x9673('0x24')](_0x9673('0x128'),_0x4d728b[_0x9673('0xe9')]()),_0x33090d[_0x4d728b]);}}if(_[_0x9673('0x48')](_0x33090d[_0x9673('0x6d')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x129'));}else{this[_0x9673('0x3a')](_0x33090d[_0x9673('0x6d')],_0x9673('0xeb'),_0x9673('0x12a'),'');return this['channel'][_0x9673('0xa3')](util['format'](_0x9673('0x12b'),_0x33090d[_0x9673('0x6d')]));}}return this[_0x9673('0xc')][_0x9673('0x28')](_0x326e96,_0x9673('0x12c'));};AGIVertices['prototype'][_0x9673('0x12d')]=function(_0x59257e){logger['info'](util['format'](_0x9673('0x12e'),_0x59257e['label'],_0x59257e[_0x9673('0x5e')]));if(!this['isConfigured'](_0x59257e[_0x9673('0x70')])){return this[_0x9673('0xc')]['noop'](_0x9673('0x12f'));}var _0x184cac=_0x9673('0x130');var _0x50a3a2=util[_0x9673('0x24')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4c0cff=util[_0x9673('0x24')]('%s.%s',_0x50a3a2,_0x184cac);var _0x4f7c84=!![];if(_0x59257e['beep']===_0x9673('0x131')){_0x4f7c84=![];}var _0x3b087a=this[_0x9673('0xc')][_0x9673('0x132')](_0x50a3a2,_0x184cac,_0x59257e[_0x9673('0x133')],_0x59257e['timeout'],undefined,_0x4f7c84);if(_0x3b087a[_0x9673('0xa5')]!==-0x1){this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')]('google\x20%s\x20file\x20created',_0x4c0cff));var _0x494f26=this[_0x9673('0x87')][_0x9673('0x9f')](this,_0x59257e,_0x4c0cff);if(_0x494f26){for(var _0x3355c4 in _0x494f26){if(_0x494f26[_0x9673('0x8e')](_0x3355c4)){this[_0x9673('0xc')][_0x9673('0x97')](util[_0x9673('0x24')](_0x9673('0x134'),_0x3355c4[_0x9673('0xe9')]()),_0x494f26[_0x3355c4]);}}return this[_0x9673('0xc')][_0x9673('0xa3')](util['format'](_0x9673('0x135'),JSON[_0x9673('0x69')](_0x494f26)));}}return _0x3b087a;};AGIVertices[_0x9673('0x13')][_0x9673('0x136')]=function(_0x380739){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x137'),_0x380739[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x380739[_0x9673('0x8a')])){return this[_0x9673('0xc')][_0x9673('0xa3')]('no\x20appid\x20configured');}if(!this[_0x9673('0x7c')](_0x380739[_0x9673('0x8b')])){return this[_0x9673('0xc')][_0x9673('0xa3')]('no\x20appsecret\x20configured');}var _0x4b39f4=_0x9673('0x130');var _0x3f7924=util[_0x9673('0x24')]('%s/recordings/%s',FILES_PATH,rs[_0x9673('0x118')](0x4));var _0x2a3787=util[_0x9673('0x24')](_0x9673('0x96'),_0x3f7924,_0x4b39f4);var _0x24c3cd=!![];if(_0x380739[_0x9673('0x138')]==='NOBEEP'){_0x24c3cd=![];}var _0x55d333=this[_0x9673('0xc')][_0x9673('0x132')](_0x3f7924,_0x4b39f4,_0x380739[_0x9673('0x133')],_0x380739[_0x9673('0x5e')],undefined,_0x24c3cd);if(_0x55d333[_0x9673('0xa5')]!==-0x1){this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')]('tilde\x20%s\x20file\x20created',_0x2a3787));var _0x154753=this['tildeASR'][_0x9673('0x9f')](this,_0x380739,_0x2a3787);if(_0x154753){for(var _0x37d9ee in _0x154753){if(_0x154753['hasOwnProperty'](_0x37d9ee)){this['channel']['setVariable'](util['format'](_0x9673('0x139'),_0x37d9ee[_0x9673('0xe9')]()),_0x154753[_0x37d9ee]);}}return this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x13a'),JSON[_0x9673('0x69')](_0x154753)));}}return _0x55d333;};AGIVertices[_0x9673('0x13')][_0x9673('0x13b')]=function(_0x1a4c42){logger[_0x9673('0x2b')](util['format'](_0x9673('0x13c'),_0x1a4c42[_0x9673('0x34')]));return this[_0x9673('0xc')][_0x9673('0x13d')](_0x1a4c42[_0x9673('0x37')],_0x1a4c42[_0x9673('0x38')],_0x1a4c42[_0x9673('0x13e')]);};AGIVertices['prototype'][_0x9673('0x13f')]=function(_0x3c2d45){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x140'),_0x3c2d45[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x3c2d45[_0x9673('0x141')])){return this[_0x9673('0xc')]['error'](_0x3c2d45,_0x9673('0x142'));}try{var _0x399ca4=eval(_0x3c2d45[_0x9673('0x141')])?_0x9673('0x143'):_0x9673('0x144');this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3c2d45[_0x9673('0x141')],_0x399ca4));return{'code':0xc8,'result':_0x399ca4};}catch(_0x45a3f0){return{'code':0xc8,'result':_0x9673('0x144')};}};AGIVertices[_0x9673('0x13')][_0x9673('0x145')]=function(_0xbc12d8){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x146'),_0xbc12d8['label']));if(!this[_0x9673('0x7c')](_0xbc12d8[_0x9673('0x147')])){return this[_0x9673('0xc')][_0x9673('0x28')](_0xbc12d8,_0x9673('0x148'));}var _0x280741=this[_0x9673('0x21')]['sync'](this,_0xbc12d8[_0x9673('0x147')]);if(!_0x280741){return this[_0x9673('0xc')][_0x9673('0x28')](_0xbc12d8,_0x9673('0x149'));}for(var _0x282222=0x0;_0x282222<_0x280741[_0x9673('0x94')];_0x282222+=0x1){var _0xf8c1bd=this['channel'][_0x9673('0xf')](util[_0x9673('0x24')]('IFTIME(%s?true:false)',_0x280741[_0x282222]));if(_0xf8c1bd['result']===-0x1){return _0xf8c1bd;}logger['info'](util[_0x9673('0x24')]('IFTIME\x20%s\x20%s',_0x280741[_0x282222],_0xf8c1bd[_0x9673('0x9b')]));if(_0xf8c1bd['extra']===_0x9673('0x143')){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x14a'),_0x280741[_0x282222],_0x9673('0x143')));this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x14a'),_0x280741[_0x282222],_0x9673('0x143')));return{'code':0xc8,'result':_0x9673('0x143')};}else{logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x14a'),_0x280741[_0x282222],_0x9673('0x144')));this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x14a'),_0x280741[_0x282222],_0x9673('0x144')));}}return{'code':0xc8,'result':_0x9673('0x144')};};AGIVertices[_0x9673('0x13')][_0x9673('0x14b')]=function(_0x513e53){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x14c'),_0x513e53[_0x9673('0x34')]));return this[_0x9673('0xc')][_0x9673('0x14b')]();};AGIVertices['prototype'][_0x9673('0x14d')]=function(_0x469dfc){logger['info'](util[_0x9673('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x469dfc['label']));if(!this[_0x9673('0x7c')](_0x469dfc['key'])){return this[_0x9673('0xc')]['noop'](_0x9673('0x12f'));}var _0x27ac0b='wav';var _0xc03171=util[_0x9673('0x24')](_0x9673('0x14e'),FILES_PATH,rs[_0x9673('0x118')](0x4));var _0x544bf6=util[_0x9673('0x24')](_0x9673('0x96'),_0xc03171,_0x27ac0b);var _0x318557=!![];if(_0x469dfc[_0x9673('0x138')]==='NOBEEP'){_0x318557=![];}var _0x16cf1e=this[_0x9673('0xc')][_0x9673('0x132')](_0xc03171,_0x27ac0b,_0x469dfc[_0x9673('0x133')],_0x469dfc[_0x9673('0x5e')],undefined,_0x318557);if(_0x16cf1e['result']!==-0x1){this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x14f'),_0x544bf6));var _0x37a074=this[_0x9673('0x7a')][_0x9673('0x9f')](this,_0x469dfc,_0x544bf6);if(_0x37a074){for(var _0x45171a in _0x37a074){if(_0x37a074[_0x9673('0x8e')](_0x45171a)){this[_0x9673('0xc')][_0x9673('0x97')](util[_0x9673('0x24')](_0x9673('0x150'),_0x45171a[_0x9673('0xe9')]()),_0x37a074[_0x45171a]);}}return this[_0x9673('0xc')][_0x9673('0xa3')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x9673('0x69')](_0x37a074)));}}return _0x16cf1e;};AGIVertices[_0x9673('0x13')][_0x9673('0x151')]=function(_0x2eea95){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x152'),_0x2eea95[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x2eea95['key'])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x12f'));}if(!this[_0x9673('0x7c')](_0x2eea95['text'])){return this[_0x9673('0xc')]['noop'](_0x9673('0xc3'));}this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x153'),_0x2eea95['text']));var _0x14e8f0=this[_0x9673('0x76')][_0x9673('0x9f')](this,_0x2eea95);if(_0x14e8f0){this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x14f'),_0x14e8f0));var _0x4ab1e9=this[_0x9673('0xc')]['streamFile'](_0x14e8f0,_0x2eea95[_0x9673('0x133')]);try{fs[_0x9673('0x104')](_0x14e8f0+_0x9673('0x105'));}catch(_0x152a2a){logger[_0x9673('0x28')](_0x152a2a);}return _0x4ab1e9;}return this[_0x9673('0xc')][_0x9673('0x28')](_0x2eea95,_0x9673('0x154'));};AGIVertices['prototype'][_0x9673('0x155')]=function(_0x2d3e35){logger[_0x9673('0x2b')](util['format'](_0x9673('0x156'),_0x2d3e35[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x2d3e35[_0x9673('0x157')])){return this[_0x9673('0xc')]['error'](_0x2d3e35,_0x9673('0x158'));}logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x159'),this['channel']['callerid'],_0x2d3e35['findBy']));var _0x2a133f=this[_0x9673('0x4a')][_0x9673('0x9f')](this,_0x2d3e35[_0x9673('0x157')]);if(_0x2a133f){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x15a'),this[_0x9673('0xc')]['callerid'],_0x2d3e35['findBy']));this[_0x9673('0xc')]['noop'](util['format'](_0x9673('0x15a'),this[_0x9673('0xc')]['callerid'],_0x2d3e35[_0x9673('0x157')]));return{'code':0xc8,'result':_0x9673('0x15b')};}else{logger['info'](util[_0x9673('0x24')](_0x9673('0x15c'),this['channel'][_0x9673('0x36')],_0x2d3e35[_0x9673('0x157')]));this['channel'][_0x9673('0xa3')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9673('0xc')]['callerid'],_0x2d3e35[_0x9673('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9673('0x13')]['logout']=function(_0x2abad3){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x15d'),_0x2abad3[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x2abad3[_0x9673('0x157')])){return this[_0x9673('0xc')]['error'](_0x2abad3,_0x9673('0x158'));}logger['info'](util[_0x9673('0x24')](_0x9673('0x159'),this[_0x9673('0xc')][_0x9673('0x36')],_0x2abad3[_0x9673('0x157')]));var _0x514536=this[_0x9673('0x15e')][_0x9673('0x9f')](this,_0x2abad3[_0x9673('0x157')]);if(_0x514536){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x15a'),this[_0x9673('0xc')]['callerid'],_0x2abad3[_0x9673('0x157')]));this[_0x9673('0xc')]['noop'](util[_0x9673('0x24')](_0x9673('0x15a'),this[_0x9673('0xc')][_0x9673('0x36')],_0x2abad3[_0x9673('0x157')]));return{'code':0xc8,'result':_0x9673('0x15b')};}else{logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x15c'),this['channel'][_0x9673('0x36')],_0x2abad3[_0x9673('0x157')]));this[_0x9673('0xc')]['noop'](util['format'](_0x9673('0x15c'),this['channel'][_0x9673('0x36')],_0x2abad3['findBy']));return{'code':0xc8,'result':_0x9673('0x15f')};}};AGIVertices[_0x9673('0x13')][_0x9673('0x160')]=function(_0x550d67){logger[_0x9673('0x2b')](util['format'](_0x9673('0x161'),_0x550d67['label']));if(!this[_0x9673('0x7c')](_0x550d67[_0x9673('0x162')])){return this[_0x9673('0xc')]['error'](_0x550d67,'no\x20operation\x20configured');}this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x163'),_0x550d67[_0x9673('0x162')]));var _0x14330c=eval(_0x550d67['operation']);if(!this[_0x9673('0x7c')](_0x550d67[_0x9673('0xd4')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0xd5'));}var _0x40abdb=this[_0x9673('0xf')][_0x9673('0x9f')](this,_0x550d67['variable_id']);if(!_0x40abdb){return this[_0x9673('0xc')][_0x9673('0x28')](_0x550d67,_0x9673('0xd6'));}if(_[_0x9673('0x93')](_0x14330c)){var _0x3fd1eb=this;_0x14330c['forEach'](function(_0x7dbdf8,_0x132a0e){_0x3fd1eb[_0x9673('0xc')][_0x9673('0x97')](util[_0x9673('0x24')](_0x9673('0x164'),_0x40abdb,_0x132a0e),_0x7dbdf8);});return this[_0x9673('0xc')][_0x9673('0xa3')](util['format'](_0x9673('0x165'),_0x40abdb));}else{return this[_0x9673('0xc')][_0x9673('0x97')](_0x40abdb,_0x14330c);}};AGIVertices[_0x9673('0x13')][_0x9673('0x166')]=function(_0x1c369a){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x167'),_0x1c369a[_0x9673('0x34')]));if(_0x1c369a[_0x9673('0xa0')]===0x0){return this[_0x9673('0x9e')](_0x1c369a);}_0x1c369a[_0x9673('0xa0')]-=0x1;if(!this['isConfigured'](_0x1c369a['file_id'])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x1c369a,_0x9673('0x111'));}var _0x2adb5b=this[_0x9673('0x1c')][_0x9673('0x9f')](this,_0x1c369a[_0x9673('0x112')]);if(!_0x2adb5b){return this[_0x9673('0xc')][_0x9673('0x28')](_0x1c369a,'no\x20file\x20audio\x20found');}var _0x347197=this[_0x9673('0xc')][_0x9673('0x113')](_0x2adb5b,_0x1c369a[_0x9673('0x168')],_0x1c369a[_0x9673('0x169')]);var _0x5cc49e=_0x347197['result'];if(_0x347197[_0x9673('0xa5')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x1c369a,'-1');return _0x347197;}else if(_0x347197[_0x9673('0x9b')]===_0x9673('0x5e')){_0x347197[_0x9673('0xa5')]=_0x347197[_0x9673('0xa5')]['length']>0x0?_0x347197[_0x9673('0xa5')]:'t';}else if(_[_0x9673('0x3b')](_0x347197[_0x9673('0xa5')])){_0x347197[_0x9673('0xa5')]='#';_0x5cc49e='#';}if(!this['isConfigured'](_0x1c369a[_0x9673('0xd4')])){this['channel'][_0x9673('0xa3')](_0x9673('0xd5'));}else{var _0x5b9961=this[_0x9673('0xf')]['sync'](this,_0x1c369a['variable_id']);if(!_0x5b9961){return this[_0x9673('0xc')][_0x9673('0x28')](_0x1c369a,_0x9673('0xd6'));}this[_0x9673('0xc')][_0x9673('0x97')](_0x5b9961,_0x5cc49e);}this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x1c369a,_0x5cc49e);return _0x347197;};AGIVertices[_0x9673('0x13')][_0x9673('0xa3')]=function(_0x52e187){logger[_0x9673('0x2b')](util['format'](_0x9673('0x16a'),_0x52e187[_0x9673('0x34')]));return this[_0x9673('0xc')]['noop'](_0x52e187[_0x9673('0x16b')]||_0x52e187[_0x9673('0x34')]);};AGIVertices[_0x9673('0x13')]['pause']=function(_0x2d5e7f){logger[_0x9673('0x2b')](util[_0x9673('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2d5e7f[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x2d5e7f[_0x9673('0x157')])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x2d5e7f,'no\x20find\x20by\x20configured');}logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x159'),this[_0x9673('0xc')][_0x9673('0x36')],_0x2d5e7f[_0x9673('0x157')]));var _0x109698=this[_0x9673('0x45')][_0x9673('0x9f')](this,_0x2d5e7f[_0x9673('0x16c')]);var _0x448b7e=this[_0x9673('0x47')][_0x9673('0x9f')](this,_0x2d5e7f[_0x9673('0x157')],_0x109698);if(_0x448b7e){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x15a'),this[_0x9673('0xc')][_0x9673('0x36')],_0x2d5e7f[_0x9673('0x157')]));this[_0x9673('0xc')][_0x9673('0xa3')](util['format'](_0x9673('0x15a'),this[_0x9673('0xc')]['callerid'],_0x2d5e7f[_0x9673('0x157')]));return{'code':0xc8,'result':_0x9673('0x15b')};}else{logger['info'](util[_0x9673('0x24')](_0x9673('0x15c'),this['channel'][_0x9673('0x36')],_0x2d5e7f[_0x9673('0x157')]));this[_0x9673('0xc')][_0x9673('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9673('0xc')]['callerid'],_0x2d5e7f['findBy']));return{'code':0xc8,'result':_0x9673('0x15f')};}};AGIVertices[_0x9673('0x13')]['playback']=function(_0x550cd1){logger['info'](util['format'](_0x9673('0x16d'),_0x550cd1['label']));if(!this[_0x9673('0x7c')](_0x550cd1[_0x9673('0x112')])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x550cd1,_0x9673('0x111'));}var _0x41c696=this['getSound'][_0x9673('0x9f')](this,_0x550cd1[_0x9673('0x112')]);if(!_0x41c696){return this['channel']['error'](_0x550cd1,_0x9673('0x16e'));}var _0x3ebfae=this[_0x9673('0xc')][_0x9673('0x4f')](_0x9673('0x16f'),[_0x41c696,_0x550cd1[_0x9673('0xe2')]]);if(_0x3ebfae[_0x9673('0xa5')]===-0x1){return _0x3ebfae;}return this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')]('Executed\x20command\x20%s\x20%s',_0x9673('0x16f'),_0x41c696));};AGIVertices['prototype'][_0x9673('0x170')]=function(_0x4fe74b){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x171'),_0x4fe74b['label']));if(!this[_0x9673('0x7c')](_0x4fe74b[_0x9673('0x172')])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x4fe74b,'no\x20queue\x20selected');}var _0x5c7472='';var _0x37ded6=parseInt(_0x4fe74b[_0x9673('0x172')],0xa);if(isNaN(_0x37ded6)){_0x5c7472=_0x4fe74b[_0x9673('0x172')];}else{_0x5c7472=this['getVoiceQueue'][_0x9673('0x9f')](this,_0x4fe74b[_0x9673('0x172')]);if(!_0x5c7472){return this['channel'][_0x9673('0x28')](_0x4fe74b,'no\x20queue\x20found');}}var _0x8406fc='';if(this[_0x9673('0x7c')](_0x4fe74b[_0x9673('0x112')])){var _0x22e864=this['getSound'][_0x9673('0x9f')](this,_0x4fe74b[_0x9673('0x112')]);if(_0x22e864){_0x8406fc=_0x22e864;}}this[_0x9673('0x32')]['sync'](this,_0x4fe74b,_0x5c7472);if(_0x4fe74b[_0x9673('0xe2')][_0x9673('0x173')]('x')<0x0){_0x4fe74b[_0x9673('0xe2')]+='x';}if(_0x4fe74b[_0x9673('0xe2')]['indexOf']('X')<0x0){_0x4fe74b['opts']+='X';}this[_0x9673('0xc')][_0x9673('0x97')]('XMCS-QUEUE',_0x5c7472?_0x5c7472['toLowerCase']():'');var _0x2e6f57=this[_0x9673('0xc')][_0x9673('0x4f')](_0x9673('0x174'),[_0x5c7472,_0x4fe74b['opts'],_0x4fe74b[_0x9673('0x5c')],_0x8406fc,_0x4fe74b[_0x9673('0x5e')],_0x4fe74b[_0x9673('0xb0')],_0x4fe74b[_0x9673('0x175')],_0x4fe74b[_0x9673('0x176')],'',_0x4fe74b[_0x9673('0x177')]]);if(_0x2e6f57[_0x9673('0xa5')]===-0x1){return _0x2e6f57;}return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xc0'),'QUEUE',_0x5c7472));};AGIVertices[_0x9673('0x13')]['record']=function(_0x1394f8){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x178'),_0x1394f8['label']));var _0xfa25a=_0x1394f8[_0x9673('0x179')]||'wav';var _0x3ed894=util[_0x9673('0x24')](_0x9673('0x17a'),this[_0x9673('0xc')]['uniqueid'],rs[_0x9673('0x118')](0x5));var _0x5dc734=util[_0x9673('0x24')]('%s/recordings/%s.%s',FILES_PATH,_0x3ed894,_0xfa25a);var _0x1bd8bd=util[_0x9673('0x24')](_0x9673('0x14e'),FILES_PATH,_0x3ed894);this['createSquareRecording'][_0x9673('0x9f')](this,_0x1394f8,_0x3ed894,_0x5dc734);this['channel']['setVariable'](_0x9673('0x17b'),_0x3ed894);logger[_0x9673('0x2b')](_0x9673('0x17c'),_0x1bd8bd,_0xfa25a,_0x1394f8[_0x9673('0x17d')],_0x1394f8[_0x9673('0x5e')]);return this[_0x9673('0xc')][_0x9673('0x132')](_0x1bd8bd,_0xfa25a,_0x1394f8[_0x9673('0x17d')],_0x1394f8[_0x9673('0x5e')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x580678){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x17e'),_0x580678[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x580678[_0x9673('0x5c')])){return this['channel'][_0x9673('0xa3')](_0x9673('0x17f'));}var _0x384fc1=this[_0x9673('0x5b')][_0x9673('0x9f')](this,_0x580678);logger[_0x9673('0x2b')](util[_0x9673('0x24')]('Response:',util[_0x9673('0x180')](_0x384fc1,{'showHidden':![],'depth':null})));if(!this[_0x9673('0x7c')](_0x580678[_0x9673('0xd4')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x181'));}var _0x544c8b=this['getVariable'][_0x9673('0x9f')](this,_0x580678['variable_id']);if(!_0x544c8b){return this[_0x9673('0xc')]['error'](_0x580678,_0x9673('0xd6'));}this[_0x9673('0xc')][_0x9673('0x97')](util['format'](_0x9673('0x182'),_0x544c8b),_0x384fc1[_0x9673('0x6b')]?_0x384fc1[_0x9673('0x6b')]:_0x9673('0x183'));this[_0x9673('0xc')][_0x9673('0x97')](util[_0x9673('0x24')](_0x9673('0x184'),_0x544c8b),_0x384fc1[_0x9673('0x6c')]?_0x384fc1[_0x9673('0x6c')]:'OK');if(_0x384fc1['body']){try{this[_0x9673('0x95')](_0x384fc1[_0x9673('0x63')],_0x544c8b);}catch(_0x5ee7b4){logger[_0x9673('0x28')](util[_0x9673('0x24')](_0x9673('0x185'),_0x544c8b));}}return this['channel']['noop'](util[_0x9673('0x24')](_0x9673('0xda'),_0x544c8b));};AGIVertices[_0x9673('0x13')]['saydigits']=function(_0x41c873){logger['info'](util[_0x9673('0x24')](_0x9673('0x186'),_0x41c873[_0x9673('0x34')]));return this[_0x9673('0xc')][_0x9673('0x187')](_0x41c873['digits'][_0x9673('0x51')](/\s+/g,''),_0x41c873[_0x9673('0x17d')]);};AGIVertices[_0x9673('0x13')][_0x9673('0x188')]=function(_0x13264a){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x189'),_0x13264a[_0x9673('0x34')]));return this[_0x9673('0xc')][_0x9673('0x18a')](_0x13264a[_0x9673('0x5f')][_0x9673('0x51')](/\s+/g,''),_0x13264a[_0x9673('0x17d')]);};AGIVertices[_0x9673('0x13')][_0x9673('0x18b')]=function(_0x41004a){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x18c'),_0x41004a[_0x9673('0x34')]));return this[_0x9673('0xc')][_0x9673('0x18d')](_0x41004a['text'],_0x41004a[_0x9673('0x17d')]);};AGIVertices['prototype']['sendMail']=function(_0x201326){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x18e'),_0x201326['label']));if(!this['isConfigured'](_0x201326[_0x9673('0x18f')])){return this[_0x9673('0xc')]['noop'](_0x9673('0x190'));}var _0x1aa113=this[_0x9673('0x1f')][_0x9673('0x9f')](this,_0x201326[_0x9673('0x18f')]);if(!_0x1aa113||!_0x1aa113[_0x9673('0x191')]){return this[_0x9673('0xc')]['error'](_0x201326,_0x9673('0x192'));}var _0x564383={'from':util[_0x9673('0x24')](_0x9673('0x193'),_0x1aa113[_0x9673('0x11')],_0x1aa113[_0x9673('0x194')]||_0x1aa113[_0x9673('0x191')][_0x9673('0x195')]),'to':_0x201326['to']||'','cc':_0x201326['cc']||'','bcc':_0x201326[_0x9673('0x196')]||'','subject':_0x201326['subject'],'html':_0x201326['text'],'text':_0x201326[_0x9673('0x54')]};if(this['isConfigured'](_0x201326[_0x9673('0x197')])){}logger[_0x9673('0xdc')](_0x9673('0x198'),JSON[_0x9673('0x69')](_0x564383));this[_0x9673('0x32')]['sync'](this,_0x201326,_0x201326['account_id']);this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x199'),_0x1aa113[_0x9673('0x11')]));this[_0x9673('0x20')][_0x9673('0x9f')](this,_0x1aa113[_0x9673('0x19a')],_0x564383);return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x19b'));};AGIVertices[_0x9673('0x13')]['sendFax']=function(_0x461645){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x19c'),_0x461645[_0x9673('0x34')]));return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x19d'));};AGIVertices[_0x9673('0x13')][_0x9673('0x19e')]=function(_0x112af6){logger[_0x9673('0x2b')](util['format'](_0x9673('0x19f'),_0x112af6['label']));if(!this['isConfigured'](_0x112af6[_0x9673('0x1a0')])){return this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x1a1'));}var _0xf74dee=this[_0x9673('0x2f')]['sync'](this,_0x112af6[_0x9673('0x1a0')]);if(!_0xf74dee){return this['channel'][_0x9673('0x28')](_0x112af6,_0x9673('0x1a2'));}var _0x3151b2={'body':_0x112af6[_0x9673('0x1a3')],'phone':_0x112af6['to']||'','SmsAccountId':_0xf74dee['id']};logger[_0x9673('0xdc')](_0x9673('0x1a4'),JSON[_0x9673('0x69')](_0x3151b2));this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x112af6,_0x112af6['sms_account_id']);this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x1a5'),_0xf74dee[_0x9673('0x11')]));this[_0x9673('0x31')][_0x9673('0x9f')](this,_0x3151b2);return this[_0x9673('0xc')]['noop'](_0x9673('0x1a6'));};AGIVertices[_0x9673('0x13')][_0x9673('0x1a7')]=function(_0x2b7c04){logger['info'](util['format'](_0x9673('0x1a8'),_0x2b7c04['label']));if(!this[_0x9673('0x7c')](_0x2b7c04[_0x9673('0xd4')])){return this[_0x9673('0xc')]['error'](_0x2b7c04,_0x9673('0x1a9'));}var _0x2399bf=this[_0x9673('0xf')][_0x9673('0x9f')](this,_0x2b7c04[_0x9673('0xd4')]);if(!_0x2399bf){return this['channel'][_0x9673('0x28')](_0x2b7c04,'no\x20variable\x20found');}return this[_0x9673('0xc')]['setVariable'](_0x2399bf,_0x2b7c04[_0x9673('0x1aa')]);};AGIVertices[_0x9673('0x13')][_0x9673('0x1ab')]=function(_0x1889bf){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x1ac'),_0x1889bf[_0x9673('0x34')]));this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x1ad'));if(_0x1889bf['answer']===_0x9673('0x1ae')){this[_0x9673('0xc')][_0x9673('0xa3')](_0x9673('0x1af'));return this[_0x9673('0xc')]['answer']();}return this['channel'][_0x9673('0xa3')]('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x358e65){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x1b0'),_0x358e65[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x358e65[_0x9673('0x1b1')])){return this['channel'][_0x9673('0x28')](_0x358e65,_0x9673('0x1b2'));}var _0x506a98=this['getSquareProject']['sync'](this,_0x358e65[_0x9673('0x1b1')]);if(!this[_0x9673('0x7c')](_0x506a98)){return this[_0x9673('0xc')]['error'](_0x358e65,util['format'](_0x9673('0x1b3'),_0x358e65[_0x9673('0x1b1')]));}if(_0x506a98===this[_0x9673('0xc')]['arg_1']){return this[_0x9673('0xc')][_0x9673('0x28')](_0x358e65,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x9673('0x32')][_0x9673('0x9f')](this,_0x358e65,_0x506a98);var _0x2028f7=this[_0x9673('0xc')][_0x9673('0x4f')](_0x9673('0x1b4'),util[_0x9673('0x24')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x9673('0xb0')][_0x9673('0x1b5')]||_0x9673('0x1b6'),_0x506a98,this[_0x9673('0xc')][_0x9673('0x1b7')]));if(_0x2028f7[_0x9673('0xa5')]===-0x1){return _0x2028f7;}return this[_0x9673('0xc')]['noop'](util['format'](_0x9673('0xc0'),'AGI',_0x506a98));};AGIVertices[_0x9673('0x13')]['system']=function(_0x2e2ed6){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x1b8'),_0x2e2ed6[_0x9673('0x34')]));var _0x45906b=this[_0x9673('0x4e')]['sync'](this,_0x2e2ed6[_0x9673('0xb1')]);this[_0x9673('0x32')]['sync'](this,_0x2e2ed6,_0x2e2ed6['command']);if(this[_0x9673('0x7c')](_0x2e2ed6['variable_id'])){var _0x356490=this[_0x9673('0xf')][_0x9673('0x9f')](this,_0x2e2ed6[_0x9673('0xd4')]);if(_0x356490){this[_0x9673('0xc')][_0x9673('0x97')](_0x356490,_0x45906b);return this[_0x9673('0xc')]['noop'](util[_0x9673('0x24')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2e2ed6[_0x9673('0xb1')],_0x356490));}}return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x1b9'),_0x2e2ed6['command']));};AGIVertices['prototype'][_0x9673('0x1ba')]=function(_0x112d0e){logger[_0x9673('0x2b')](util[_0x9673('0x24')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x112d0e[_0x9673('0x34')]));_0x112d0e[_0x9673('0x54')]=_0x112d0e[_0x9673('0x54')][_0x9673('0x51')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x112d0e['apiKey'])){return this['channel'][_0x9673('0xa3')](_0x9673('0x1bb'));}if(!this[_0x9673('0x7c')](_0x112d0e[_0x9673('0x54')])){return this[_0x9673('0xc')]['noop']('no\x20text\x20configured');}this[_0x9673('0xc')]['noop'](util['format'](_0x9673('0x1bc'),_0x112d0e[_0x9673('0x54')]));var _0x69790=this[_0x9673('0x52')]['sync'](this,_0x112d0e);if(_0x69790){this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x69790));var _0x5c1f97=this[_0x9673('0xc')][_0x9673('0x103')](_0x69790);try{fs[_0x9673('0x104')](_0x69790+_0x9673('0x105'));}catch(_0x34d4){logger[_0x9673('0x28')](_0x34d4);}return _0x5c1f97;}return this[_0x9673('0xc')][_0x9673('0x28')](_0x112d0e,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9673('0x13')][_0x9673('0x1bd')]=function(_0x7724c3){logger[_0x9673('0x2b')](util['format'](_0x9673('0x1be'),_0x7724c3[_0x9673('0x34')]));_0x7724c3['text']=_0x7724c3['text'][_0x9673('0x51')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x7724c3['text'])){return this[_0x9673('0xc')][_0x9673('0xa3')]('no\x20text\x20configured');}this['channel'][_0x9673('0xa3')](util['format'](_0x9673('0x1bf'),_0x7724c3[_0x9673('0x54')]));var _0x42c509=this[_0x9673('0x59')]['sync'](this,_0x7724c3);if(_0x42c509){this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x1c0'),_0x42c509));var _0x4058de=this[_0x9673('0xc')][_0x9673('0x103')](_0x42c509);try{fs[_0x9673('0x104')](_0x42c509+_0x9673('0x105'));}catch(_0x4bd67d){logger[_0x9673('0x28')](_0x4bd67d);}return _0x4058de;}return this[_0x9673('0xc')][_0x9673('0x28')](_0x7724c3,_0x9673('0x1c1'));};AGIVertices[_0x9673('0x13')][_0x9673('0x1c2')]=function(_0x37d591){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x1c3'),_0x37d591[_0x9673('0x34')]));if(!this['isConfigured'](_0x37d591['findBy'])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x37d591,_0x9673('0x158'));}logger[_0x9673('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9673('0x36')],_0x37d591['findBy']));var _0x46798d=this['agentUnpause'][_0x9673('0x9f')](this,_0x37d591['findBy']);if(_0x46798d){logger[_0x9673('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9673('0x36')],_0x37d591[_0x9673('0x157')]));this['channel'][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0x15a'),this[_0x9673('0xc')][_0x9673('0x36')],_0x37d591[_0x9673('0x157')]));return{'code':0xc8,'result':_0x9673('0x15b')};}else{logger['info'](util[_0x9673('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x9673('0x36')],_0x37d591[_0x9673('0x157')]));this[_0x9673('0xc')][_0x9673('0xa3')](util['format'](_0x9673('0x15c'),this['channel'][_0x9673('0x36')],_0x37d591[_0x9673('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9673('0x13')]['voicemail']=function(_0x3c5620){logger[_0x9673('0x2b')](util[_0x9673('0x24')](_0x9673('0x1c4'),_0x3c5620[_0x9673('0x34')]));var _0x1f45eb=this[_0x9673('0xc')]['exec'](_0x9673('0x1c5'),[_0x3c5620['mailbox'],_0x3c5620[_0x9673('0x6e')]]);if(_0x1f45eb[_0x9673('0xa5')]===-0x1){return _0x1f45eb;}return this[_0x9673('0xc')][_0x9673('0xa3')](util[_0x9673('0x24')](_0x9673('0xc0'),_0x9673('0x1c5'),_0x3c5620[_0x9673('0x1c6')]));};AGIVertices[_0x9673('0x13')][_0x9673('0x1c7')]=function(_0x5c1e9f){logger[_0x9673('0x2b')](util['format'](_0x9673('0x1c8'),_0x5c1e9f[_0x9673('0x34')]));if(!this[_0x9673('0x7c')](_0x5c1e9f['variable_id'])){return this[_0x9673('0xc')][_0x9673('0x28')](_0x5c1e9f,'no\x20variable\x20selected');}var _0x5a56ee=this[_0x9673('0xf')][_0x9673('0x9f')](this,_0x5c1e9f[_0x9673('0xd4')]);if(!_0x5a56ee){return this[_0x9673('0xc')][_0x9673('0x28')](_0x5c1e9f,'no\x20variable\x20found');}var _0x5fe7da=this[_0x9673('0xc')][_0x9673('0xf')](_0x5a56ee);return{'code':0xc8,'result':_0x5fe7da[_0x9673('0x9b')]?_0x5fe7da[_0x9673('0x9b')]:'-'};};String[_0x9673('0x13')][_0x9673('0x9a')]=function(_0x1f764a,_0x8bfbdd){return this['split'](_0x1f764a)['join'](_0x8bfbdd);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 77964be..cbc8f2b 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 _0x00ea=['Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','destlinkedid','prototype','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all'];(function(_0x3fa1de,_0x44e939){var _0x5524b0=function(_0x4a2dc){while(--_0x4a2dc){_0x3fa1de['push'](_0x3fa1de['shift']());}};_0x5524b0(++_0x44e939);}(_0x00ea,0x10b));var _0xa00e=function(_0x52dbc6,_0x586871){_0x52dbc6=_0x52dbc6-0x0;var _0x5aaad0=_0x00ea[_0x52dbc6];return _0x5aaad0;};'use strict';var util=require('util');var _=require(_0xa00e('0x0'));var moment=require(_0xa00e('0x1'));var ami=require(_0xa00e('0x2'));var logger=require('../../../config/logger')(_0xa00e('0x3'));var RpcUser=require(_0xa00e('0x4'));var RpcVoiceAgentReport=require(_0xa00e('0x5'));function Acw(_0x191118){this[_0xa00e('0x6')]=_0x191118[_0xa00e('0x6')];this[_0xa00e('0x7')]=_0x191118['agents'];this[_0xa00e('0x8')]=_0x191118[_0xa00e('0x8')];this[_0xa00e('0x9')]={};ami['on'](_0xa00e('0xa'),this[_0xa00e('0xb')]['bind'](this));ami['on'](_0xa00e('0xc'),this['syncHangupRequest'][_0xa00e('0xd')](this));ami['on'](_0xa00e('0xe'),this[_0xa00e('0xf')]['bind'](this));ami['on'](_0xa00e('0x10'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xa00e('0x11'),this[_0xa00e('0x12')][_0xa00e('0xd')](this));ami['on'](_0xa00e('0x13'),this[_0xa00e('0x14')]['bind'](this));ami['on'](_0xa00e('0x15'),this[_0xa00e('0x16')]['bind'](this));}function getDiff(_0x12115d){var _0x5358f8=moment()['milliseconds'](0x0);var _0x46ba6f=moment(_0x12115d)[_0xa00e('0x17')](0x0);return _0x5358f8[_0xa00e('0x18')](_0x46ba6f,_0xa00e('0x19'));}Acw['prototype'][_0xa00e('0x1a')]=function(_0x496f49){try{var _0x4b3595=this;var _0x27220c=this[_0xa00e('0x9')][_0x496f49][_0xa00e('0x1b')];var _0x1cca3b=this[_0xa00e('0x9')][_0x496f49][_0xa00e('0x1c')];var _0x5abc32=this[_0xa00e('0x6')][_0x1cca3b];var _0x87bd50=![];var _0x45c445=_0xa00e('0x1d');if(_0x5abc32[_0xa00e('0x1e')]){if(_0x5abc32['mandatoryDispositionPause'][_0xa00e('0x1f')]){_0x87bd50=!![];_0x45c445=_0x5abc32[_0xa00e('0x20')]['name'];}}ami[_0xa00e('0x21')]({'action':'QueuePause','interface':_0x27220c,'paused':!![],'reason':_0x45c445})[_0xa00e('0x22')](function(_0x110b46){if(_0x4b3595[_0xa00e('0x7')][_0x27220c]){return RpcUser[_0xa00e('0x23')](_0x4b3595['agents'][_0x27220c]['id'])[_0xa00e('0x22')](function(_0x3bcdcd){if(_0x3bcdcd&&!_0x3bcdcd[_0xa00e('0x24')]){logger[_0xa00e('0x25')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x496f49,_0x27220c,_0x1cca3b);var _0x103a91=_0x4b3595[_0xa00e('0x9')][_0x496f49][_0xa00e('0x26')]&&_0x4b3595['channels'][_0x496f49]['destlinkedid']?_0x4b3595[_0xa00e('0x9')][_0x496f49]['destlinkedid']:_0x496f49;return RpcUser[_0xa00e('0x27')](_0x4b3595['agents'][_0x27220c],_0x45c445,_0x103a91)['then'](function(_0x412d4a){if(!_0x87bd50){_0x4b3595[_0xa00e('0x8')][_0x27220c]={};logger[_0xa00e('0x25')](_0xa00e('0x28'),_0x496f49,_0x4b3595['voiceQueues'][_0x1cca3b][_0xa00e('0x29')],_0x27220c,_0x1cca3b);_0x4b3595[_0xa00e('0x8')][_0x27220c][_0xa00e('0x2a')]=setTimeout(_0x4b3595[_0xa00e('0x2b')]['bind'](_0x4b3595,_0x27220c),_0x4b3595[_0xa00e('0x6')][_0x1cca3b][_0xa00e('0x29')]*0x3e8);_0x4b3595['timers'][_0x27220c][_0xa00e('0x2c')]=moment()[_0xa00e('0x2d')](_0xa00e('0x2e'));_0x4b3595[_0xa00e('0x8')][_0x27220c][_0xa00e('0x2f')]=_0x496f49;_0x4b3595[_0xa00e('0x8')][_0x27220c][_0xa00e('0x1c')]=_0x1cca3b;_0x4b3595[_0xa00e('0x8')][_0x27220c][_0xa00e('0x30')]=function(){var _0x2681eb=getDiff(_0x4b3595['timers'][_0x27220c][_0xa00e('0x2c')]);clearTimeout(_0x4b3595['timers'][_0x27220c][_0xa00e('0x2a')]);_0x4b3595[_0xa00e('0x8')][_0x27220c][_0xa00e('0x2a')]=![];RpcVoiceAgentReport[_0xa00e('0x31')]({'acwtime':_0x2681eb},_0x4b3595['timers'][_0x27220c][_0xa00e('0x2f')],_0x27220c)[_0xa00e('0x22')](function(_0x4038d7){logger[_0xa00e('0x25')](_0xa00e('0x32'),_0x496f49,_0x2681eb,_0x4038d7);})[_0xa00e('0x33')](function(_0x4e19d6){logger[_0xa00e('0x34')](_0xa00e('0x35'),_0x496f49,_0x4e19d6);});delete _0x4b3595[_0xa00e('0x8')][_0x27220c];};}});}else{logger[_0xa00e('0x25')](_0xa00e('0x36'),_0x496f49,_0x27220c,_0x1cca3b);}});}})[_0xa00e('0x33')](function(_0x40bcff){logger[_0xa00e('0x34')](_0xa00e('0x28'),_0x496f49,_0x4b3595[_0xa00e('0x6')][_0x1cca3b][_0xa00e('0x29')],_0x27220c,_0x1cca3b);})['finally'](function(){delete _0x4b3595[_0xa00e('0x9')][_0x496f49];});}catch(_0x1c7ead){logger[_0xa00e('0x34')](_0xa00e('0x37'),_0x1c7ead[_0xa00e('0x38')]);}};Acw['prototype'][_0xa00e('0x2b')]=function(_0x360664){try{var _0x5261dd=this;if(_0x5261dd[_0xa00e('0x8')][_0x360664]){_0x5261dd[_0xa00e('0x8')][_0x360664][_0xa00e('0x2a')]=![];var _0x15459d=_0x5261dd[_0xa00e('0x8')][_0x360664][_0xa00e('0x2f')];var _0x290b24=_0x5261dd[_0xa00e('0x8')][_0x360664][_0xa00e('0x1c')];var _0x527c46=_0x5261dd[_0xa00e('0x6')][_0x290b24]['acwTimeout'];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x15459d,_0x360664);RpcUser['saveUnpause'](this[_0xa00e('0x7')][_0x360664]);RpcVoiceAgentReport[_0xa00e('0x31')]({'acwtime':_0x527c46,'agentacw':!![]},_0x15459d,_0x360664)['then'](function(_0x267ece){logger[_0xa00e('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x15459d,_0x527c46,_0x267ece);})[_0xa00e('0x33')](function(_0x1c91d0){logger[_0xa00e('0x34')](_0xa00e('0x35'),_0x15459d,_0x1c91d0);});}else{logger['error'](_0xa00e('0x39'),_0x360664);if(_0x5261dd['timers']){logger[_0xa00e('0x25')]('[ACW][TIMERS]',JSON[_0xa00e('0x3a')](_0x5261dd[_0xa00e('0x8')]));}}}catch(_0x37b06d){logger[_0xa00e('0x34')](_0xa00e('0x3b'),_0x37b06d['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x5e0338){try{if(this[_0xa00e('0x6')][_0x5e0338['queue']]&&(this[_0xa00e('0x6')][_0x5e0338[_0xa00e('0x1c')]][_0xa00e('0x3')]||this[_0xa00e('0x6')][_0x5e0338[_0xa00e('0x1c')]]['mandatoryDisposition'])){if(this[_0xa00e('0x7')][_0x5e0338[_0xa00e('0x1b')]]){this[_0xa00e('0x9')][_0x5e0338['uniqueid']]={'queue':_0x5e0338[_0xa00e('0x1c')],'interface':_0x5e0338['interface'],'destlinkedid':_0x5e0338[_0xa00e('0x3c')]};}}}catch(_0x15ab80){logger[_0xa00e('0x34')]('[ACW][syncAgentConnect]\x20%s',_0x15ab80[_0xa00e('0x38')]);}};Acw[_0xa00e('0x3d')][_0xa00e('0x16')]=function(_0x4053ee){try{if(this[_0xa00e('0x6')][_0x4053ee[_0xa00e('0x1c')]]&&(this[_0xa00e('0x6')][_0x4053ee[_0xa00e('0x1c')]][_0xa00e('0x3')]||this[_0xa00e('0x6')][_0x4053ee['queue']]['mandatoryDisposition'])){if(this[_0xa00e('0x7')][_0x4053ee[_0xa00e('0x1b')]]){this['channels'][_0x4053ee[_0xa00e('0x2f')]]={'queue':_0x4053ee[_0xa00e('0x1c')],'interface':_0x4053ee[_0xa00e('0x1b')]};}}}catch(_0x19dd70){logger[_0xa00e('0x34')](_0xa00e('0x3e'),_0x19dd70[_0xa00e('0x38')]);}};Acw['prototype'][_0xa00e('0x3f')]=function(_0x323567){try{if(this['channels'][_0x323567[_0xa00e('0x2f')]]&&_[_0xa00e('0x40')](this[_0xa00e('0x9')][_0x323567[_0xa00e('0x2f')]][_0xa00e('0x26')])){logger[_0xa00e('0x25')](_0xa00e('0x41'),_0x323567[_0xa00e('0x2f')]);this[_0xa00e('0x1a')](_0x323567[_0xa00e('0x2f')]);}else if(this[_0xa00e('0x9')][_0x323567['linkedid']]&&_['isUndefined'](this['channels'][_0x323567[_0xa00e('0x42')]][_0xa00e('0x26')])){logger[_0xa00e('0x25')](_0xa00e('0x43'),_0x323567['linkedid']);this[_0xa00e('0x1a')](_0x323567[_0xa00e('0x42')]);}}catch(_0x114969){logger[_0xa00e('0x34')](_0xa00e('0x44'),_0x114969[_0xa00e('0x38')]);}};Acw[_0xa00e('0x3d')][_0xa00e('0xf')]=function(_0x529579){try{if(this[_0xa00e('0x9')][_0x529579[_0xa00e('0x2f')]]&&this[_0xa00e('0x9')][_0x529579[_0xa00e('0x2f')]][_0xa00e('0x26')]){logger[_0xa00e('0x25')](_0xa00e('0x45'),_0x529579[_0xa00e('0x2f')]);this[_0xa00e('0x1a')](_0x529579[_0xa00e('0x2f')]);}else if(this[_0xa00e('0x9')][_0x529579[_0xa00e('0x42')]]&&this[_0xa00e('0x9')][_0x529579[_0xa00e('0x42')]][_0xa00e('0x26')]){logger[_0xa00e('0x25')](_0xa00e('0x46'),_0x529579['linkedid']);this[_0xa00e('0x1a')](_0x529579['linkedid']);}}catch(_0x16fe33){logger[_0xa00e('0x34')]('[ACW][syncHangup]\x20%s',_0x16fe33[_0xa00e('0x38')]);}};Acw[_0xa00e('0x3d')][_0xa00e('0x12')]=function(_0x286a84){try{if(!_[_0xa00e('0x47')](this[_0xa00e('0x9')][_0x286a84[_0xa00e('0x48')]])){this[_0xa00e('0x1a')](_0x286a84['transfereeuniqueid']);if(this[_0xa00e('0x9')][_0x286a84[_0xa00e('0x49')]]){this['channels'][_0x286a84['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x286a84['transfertargetuniqueid']]=this[_0xa00e('0x9')][_0x286a84[_0xa00e('0x49')]];delete this[_0xa00e('0x9')][_0x286a84[_0xa00e('0x49')]];}}else if(!_[_0xa00e('0x47')](this[_0xa00e('0x9')][_0x286a84[_0xa00e('0x4a')]])){this[_0xa00e('0x1a')](_0x286a84[_0xa00e('0x4a')]);if(this['channels'][_0x286a84['origtransfereruniqueid']]){this['channels'][_0x286a84[_0xa00e('0x4b')]][_0xa00e('0x26')]=!![];this[_0xa00e('0x9')][_0x286a84['transfereeuniqueid']]=this[_0xa00e('0x9')][_0x286a84[_0xa00e('0x4b')]];delete this[_0xa00e('0x9')][_0x286a84[_0xa00e('0x4b')]];}}}catch(_0x15dd7c){logger[_0xa00e('0x34')](_0xa00e('0x4c'),_0x15dd7c[_0xa00e('0x38')]);}};Acw[_0xa00e('0x3d')][_0xa00e('0x14')]=function(_0xa4ceb5){try{if(this[_0xa00e('0x9')][_0xa4ceb5[_0xa00e('0x4d')]]){logger['info'](_0xa00e('0x4e'),JSON[_0xa00e('0x3a')](_0xa4ceb5[_0xa00e('0x4d')]));this['startAcw'](_0xa4ceb5['transfereruniqueid']);}else if(this[_0xa00e('0x9')][_0xa4ceb5[_0xa00e('0x4f')]]){logger['info'](_0xa00e('0x50'),JSON[_0xa00e('0x3a')](_0xa4ceb5['transfererlinkedid']));this['startAcw'](_0xa4ceb5[_0xa00e('0x4f')]);}}catch(_0x25b570){logger[_0xa00e('0x34')](_0xa00e('0x51'),_0x25b570[_0xa00e('0x38')]);}};Acw[_0xa00e('0x3d')][_0xa00e('0x52')]=function(_0x3f09e6){try{if(this[_0xa00e('0x6')][_0x3f09e6[_0xa00e('0x1c')]]&&this[_0xa00e('0x6')][_0x3f09e6[_0xa00e('0x1c')]][_0xa00e('0x53')]===_0xa00e('0x54')){if(this[_0xa00e('0x7')][_0x3f09e6[_0xa00e('0x1b')]]){logger[_0xa00e('0x25')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3f09e6[_0xa00e('0x2f')],_0x3f09e6[_0xa00e('0x1b')],_0x3f09e6[_0xa00e('0x1c')]);return RpcUser[_0xa00e('0x27')](this[_0xa00e('0x7')][_0x3f09e6[_0xa00e('0x1b')]],_0xa00e('0x55'),_0x3f09e6[_0xa00e('0x2f')]);}}}catch(_0x3942db){logger[_0xa00e('0x34')](_0xa00e('0x56'),_0x3942db[_0xa00e('0x38')]);}};module[_0xa00e('0x57')]=Acw; \ No newline at end of file +var _0xa0c7=['[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','../ami','acw','../rpc/user','voiceQueues','agents','timers','syncAgentConnect','bind','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','info','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','message'];(function(_0x41b8f2,_0x1ebe99){var _0x555e15=function(_0x57dd2c){while(--_0x57dd2c){_0x41b8f2['push'](_0x41b8f2['shift']());}};_0x555e15(++_0x1ebe99);}(_0xa0c7,0xc1));var _0x7a0c=function(_0x1ed3e7,_0x55a2d4){_0x1ed3e7=_0x1ed3e7-0x0;var _0x37a703=_0xa0c7[_0x1ed3e7];return _0x37a703;};'use strict';var util=require(_0x7a0c('0x0'));var _=require('lodash');var moment=require('moment');var ami=require(_0x7a0c('0x1'));var logger=require('../../../config/logger')(_0x7a0c('0x2'));var RpcUser=require(_0x7a0c('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1ae968){this[_0x7a0c('0x4')]=_0x1ae968[_0x7a0c('0x4')];this[_0x7a0c('0x5')]=_0x1ae968[_0x7a0c('0x5')];this[_0x7a0c('0x6')]=_0x1ae968['timers'];this['channels']={};ami['on']('agentconnect',this[_0x7a0c('0x7')][_0x7a0c('0x8')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x7a0c('0x8')](this));ami['on']('hangup',this['syncHangup'][_0x7a0c('0x8')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x7a0c('0x8')](this));ami['on'](_0x7a0c('0x9'),this[_0x7a0c('0xa')]['bind'](this));ami['on'](_0x7a0c('0xb'),this[_0x7a0c('0xc')][_0x7a0c('0x8')](this));ami['on'](_0x7a0c('0xd'),this[_0x7a0c('0xe')]['bind'](this));}function getDiff(_0x493517){var _0x4e9298=moment()[_0x7a0c('0xf')](0x0);var _0x2e40b6=moment(_0x493517)[_0x7a0c('0xf')](0x0);return _0x4e9298[_0x7a0c('0x10')](_0x2e40b6,'seconds');}Acw[_0x7a0c('0x11')][_0x7a0c('0x12')]=function(_0x37bfb3){try{var _0x94f6f1=this;var _0x8d9dff=this[_0x7a0c('0x13')][_0x37bfb3]['interface'];var _0x347275=this[_0x7a0c('0x13')][_0x37bfb3][_0x7a0c('0x14')];var _0x4f75b5=this[_0x7a0c('0x4')][_0x347275];var _0x508038=![];var _0x2b5326=_0x7a0c('0x15');if(_0x4f75b5[_0x7a0c('0x16')]){if(_0x4f75b5[_0x7a0c('0x17')]['name']){_0x508038=!![];_0x2b5326=_0x4f75b5['mandatoryDispositionPause'][_0x7a0c('0x18')];}}ami[_0x7a0c('0x19')]({'action':_0x7a0c('0x1a'),'interface':_0x8d9dff,'paused':!![],'reason':_0x2b5326})['then'](function(_0x2b58df){if(_0x94f6f1[_0x7a0c('0x5')][_0x8d9dff]){return RpcUser['getAgent'](_0x94f6f1[_0x7a0c('0x5')][_0x8d9dff]['id'])[_0x7a0c('0x1b')](function(_0x4f2f89){if(_0x4f2f89&&!_0x4f2f89['voicePause']){logger[_0x7a0c('0x1c')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x37bfb3,_0x8d9dff,_0x347275);var _0x1ecf55=_0x94f6f1[_0x7a0c('0x13')][_0x37bfb3]['attended']&&_0x94f6f1['channels'][_0x37bfb3][_0x7a0c('0x1d')]?_0x94f6f1['channels'][_0x37bfb3][_0x7a0c('0x1d')]:_0x37bfb3;return RpcUser[_0x7a0c('0x1e')](_0x94f6f1[_0x7a0c('0x5')][_0x8d9dff],_0x2b5326,_0x1ecf55)[_0x7a0c('0x1b')](function(_0x2c5c38){if(!_0x508038){_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff]={};logger[_0x7a0c('0x1c')](_0x7a0c('0x1f'),_0x37bfb3,_0x94f6f1['voiceQueues'][_0x347275]['acwTimeout'],_0x8d9dff,_0x347275);_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff][_0x7a0c('0x20')]=setTimeout(_0x94f6f1[_0x7a0c('0x21')][_0x7a0c('0x8')](_0x94f6f1,_0x8d9dff),_0x94f6f1[_0x7a0c('0x4')][_0x347275][_0x7a0c('0x22')]*0x3e8);_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff]['lastPauseAt']=moment()[_0x7a0c('0x23')](_0x7a0c('0x24'));_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff][_0x7a0c('0x25')]=_0x37bfb3;_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff][_0x7a0c('0x14')]=_0x347275;_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff][_0x7a0c('0x26')]=function(){var _0x5585eb=getDiff(_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff][_0x7a0c('0x27')]);clearTimeout(_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff]['timer']);_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff][_0x7a0c('0x20')]=![];RpcVoiceAgentReport[_0x7a0c('0x28')]({'acwtime':_0x5585eb},_0x94f6f1[_0x7a0c('0x6')][_0x8d9dff][_0x7a0c('0x25')],_0x8d9dff)[_0x7a0c('0x1b')](function(_0x50bb44){logger[_0x7a0c('0x1c')](_0x7a0c('0x29'),_0x37bfb3,_0x5585eb,_0x50bb44);})[_0x7a0c('0x2a')](function(_0x568b52){logger[_0x7a0c('0x2b')](_0x7a0c('0x2c'),_0x37bfb3,_0x568b52);});delete _0x94f6f1['timers'][_0x8d9dff];};}});}else{logger[_0x7a0c('0x1c')](_0x7a0c('0x2d'),_0x37bfb3,_0x8d9dff,_0x347275);}});}})[_0x7a0c('0x2a')](function(_0x2706f0){logger[_0x7a0c('0x2b')](_0x7a0c('0x1f'),_0x37bfb3,_0x94f6f1[_0x7a0c('0x4')][_0x347275]['acwTimeout'],_0x8d9dff,_0x347275);})[_0x7a0c('0x2e')](function(){delete _0x94f6f1[_0x7a0c('0x13')][_0x37bfb3];});}catch(_0x2796f7){logger[_0x7a0c('0x2b')](_0x7a0c('0x2f'),_0x2796f7['message']);}};Acw[_0x7a0c('0x11')]['stopAcw']=function(_0x3ddd24){try{var _0xfc034a=this;if(_0xfc034a[_0x7a0c('0x6')][_0x3ddd24]){_0xfc034a['timers'][_0x3ddd24]['timer']=![];var _0xd85fc2=_0xfc034a[_0x7a0c('0x6')][_0x3ddd24][_0x7a0c('0x25')];var _0x36323c=_0xfc034a[_0x7a0c('0x6')][_0x3ddd24][_0x7a0c('0x14')];var _0x58e510=_0xfc034a[_0x7a0c('0x4')][_0x36323c][_0x7a0c('0x22')];logger[_0x7a0c('0x1c')](_0x7a0c('0x30'),_0xd85fc2,_0x3ddd24);RpcUser[_0x7a0c('0x31')](this[_0x7a0c('0x5')][_0x3ddd24]);RpcVoiceAgentReport[_0x7a0c('0x28')]({'acwtime':_0x58e510,'agentacw':!![]},_0xd85fc2,_0x3ddd24)[_0x7a0c('0x1b')](function(_0x18797a){logger[_0x7a0c('0x1c')](_0x7a0c('0x29'),_0xd85fc2,_0x58e510,_0x18797a);})[_0x7a0c('0x2a')](function(_0x1df741){logger[_0x7a0c('0x2b')](_0x7a0c('0x2c'),_0xd85fc2,_0x1df741);});}else{logger[_0x7a0c('0x2b')](_0x7a0c('0x32'),_0x3ddd24);if(_0xfc034a['timers']){logger['info']('[ACW][TIMERS]',JSON[_0x7a0c('0x33')](_0xfc034a[_0x7a0c('0x6')]));}}}catch(_0x5c4a30){logger[_0x7a0c('0x2b')](_0x7a0c('0x34'),_0x5c4a30['message']);}};Acw[_0x7a0c('0x11')][_0x7a0c('0x7')]=function(_0x556e96){try{if(this[_0x7a0c('0x4')][_0x556e96[_0x7a0c('0x14')]]&&(this[_0x7a0c('0x4')][_0x556e96['queue']][_0x7a0c('0x2')]||this[_0x7a0c('0x4')][_0x556e96[_0x7a0c('0x14')]][_0x7a0c('0x16')])){if(this[_0x7a0c('0x5')][_0x556e96[_0x7a0c('0x35')]]){this['channels'][_0x556e96['uniqueid']]={'queue':_0x556e96[_0x7a0c('0x14')],'interface':_0x556e96[_0x7a0c('0x35')],'destlinkedid':_0x556e96['destlinkedid']};}}}catch(_0x50f5cb){logger[_0x7a0c('0x2b')](_0x7a0c('0x36'),_0x50f5cb[_0x7a0c('0x37')]);}};Acw[_0x7a0c('0x11')]['syncAgentConnectPreview']=function(_0x371c1f){try{if(this[_0x7a0c('0x4')][_0x371c1f[_0x7a0c('0x14')]]&&(this[_0x7a0c('0x4')][_0x371c1f[_0x7a0c('0x14')]]['acw']||this[_0x7a0c('0x4')][_0x371c1f[_0x7a0c('0x14')]]['mandatoryDisposition'])){if(this[_0x7a0c('0x5')][_0x371c1f['interface']]){this[_0x7a0c('0x13')][_0x371c1f[_0x7a0c('0x25')]]={'queue':_0x371c1f[_0x7a0c('0x14')],'interface':_0x371c1f[_0x7a0c('0x35')]};}}}catch(_0x250562){logger['error'](_0x7a0c('0x38'),_0x250562[_0x7a0c('0x37')]);}};Acw[_0x7a0c('0x11')]['syncHangupRequest']=function(_0x30e628){try{if(this[_0x7a0c('0x13')][_0x30e628[_0x7a0c('0x25')]]&&_[_0x7a0c('0x39')](this[_0x7a0c('0x13')][_0x30e628[_0x7a0c('0x25')]][_0x7a0c('0x3a')])){logger[_0x7a0c('0x1c')]('[%s][HANGUP:UNIQUEID]',_0x30e628[_0x7a0c('0x25')]);this[_0x7a0c('0x12')](_0x30e628[_0x7a0c('0x25')]);}else if(this[_0x7a0c('0x13')][_0x30e628[_0x7a0c('0x3b')]]&&_[_0x7a0c('0x39')](this[_0x7a0c('0x13')][_0x30e628[_0x7a0c('0x3b')]][_0x7a0c('0x3a')])){logger[_0x7a0c('0x1c')](_0x7a0c('0x3c'),_0x30e628[_0x7a0c('0x3b')]);this[_0x7a0c('0x12')](_0x30e628[_0x7a0c('0x3b')]);}}catch(_0x4f5ad2){logger[_0x7a0c('0x2b')](_0x7a0c('0x3d'),_0x4f5ad2[_0x7a0c('0x37')]);}};Acw['prototype']['syncHangup']=function(_0x34f4a8){try{if(this[_0x7a0c('0x13')][_0x34f4a8[_0x7a0c('0x25')]]&&this[_0x7a0c('0x13')][_0x34f4a8[_0x7a0c('0x25')]][_0x7a0c('0x3a')]){logger['info'](_0x7a0c('0x3e'),_0x34f4a8[_0x7a0c('0x25')]);this[_0x7a0c('0x12')](_0x34f4a8[_0x7a0c('0x25')]);}else if(this[_0x7a0c('0x13')][_0x34f4a8[_0x7a0c('0x3b')]]&&this['channels'][_0x34f4a8['linkedid']][_0x7a0c('0x3a')]){logger[_0x7a0c('0x1c')](_0x7a0c('0x3f'),_0x34f4a8[_0x7a0c('0x3b')]);this['startAcw'](_0x34f4a8[_0x7a0c('0x3b')]);}}catch(_0x5190b3){logger[_0x7a0c('0x2b')](_0x7a0c('0x40'),_0x5190b3[_0x7a0c('0x37')]);}};Acw[_0x7a0c('0x11')][_0x7a0c('0xa')]=function(_0x250c38){try{if(!_[_0x7a0c('0x41')](this['channels'][_0x250c38[_0x7a0c('0x42')]])){this[_0x7a0c('0x12')](_0x250c38[_0x7a0c('0x42')]);if(this[_0x7a0c('0x13')][_0x250c38['secondtransfereruniqueid']]){this[_0x7a0c('0x13')][_0x250c38['secondtransfereruniqueid']][_0x7a0c('0x3a')]=!![];this[_0x7a0c('0x13')][_0x250c38[_0x7a0c('0x43')]]=this['channels'][_0x250c38[_0x7a0c('0x44')]];delete this[_0x7a0c('0x13')][_0x250c38['secondtransfereruniqueid']];}}else if(!_[_0x7a0c('0x41')](this[_0x7a0c('0x13')][_0x250c38[_0x7a0c('0x43')]])){this[_0x7a0c('0x12')](_0x250c38[_0x7a0c('0x43')]);if(this['channels'][_0x250c38[_0x7a0c('0x45')]]){this['channels'][_0x250c38['origtransfereruniqueid']]['attended']=!![];this[_0x7a0c('0x13')][_0x250c38['transfereeuniqueid']]=this[_0x7a0c('0x13')][_0x250c38[_0x7a0c('0x45')]];delete this[_0x7a0c('0x13')][_0x250c38[_0x7a0c('0x45')]];}}}catch(_0x57729){logger['error'](_0x7a0c('0x46'),_0x57729[_0x7a0c('0x37')]);}};Acw['prototype'][_0x7a0c('0xc')]=function(_0x23ed33){try{if(this[_0x7a0c('0x13')][_0x23ed33[_0x7a0c('0x47')]]){logger['info'](_0x7a0c('0x48'),JSON[_0x7a0c('0x33')](_0x23ed33[_0x7a0c('0x47')]));this['startAcw'](_0x23ed33['transfereruniqueid']);}else if(this[_0x7a0c('0x13')][_0x23ed33['transfererlinkedid']]){logger[_0x7a0c('0x1c')](_0x7a0c('0x49'),JSON[_0x7a0c('0x33')](_0x23ed33[_0x7a0c('0x4a')]));this[_0x7a0c('0x12')](_0x23ed33[_0x7a0c('0x4a')]);}}catch(_0xd15a1e){logger['error'](_0x7a0c('0x4b'),_0xd15a1e[_0x7a0c('0x37')]);}};Acw[_0x7a0c('0x11')][_0x7a0c('0x4c')]=function(_0x1df86d){try{if(this['voiceQueues'][_0x1df86d[_0x7a0c('0x14')]]&&this[_0x7a0c('0x4')][_0x1df86d['queue']][_0x7a0c('0x4d')]===_0x7a0c('0x4e')){if(this[_0x7a0c('0x5')][_0x1df86d[_0x7a0c('0x35')]]){logger['info'](_0x7a0c('0x4f'),_0x1df86d[_0x7a0c('0x25')],_0x1df86d[_0x7a0c('0x35')],_0x1df86d[_0x7a0c('0x14')]);return RpcUser[_0x7a0c('0x1e')](this[_0x7a0c('0x5')][_0x1df86d[_0x7a0c('0x35')]],_0x7a0c('0x50'),_0x1df86d[_0x7a0c('0x25')]);}}}catch(_0x1b2d50){logger['error'](_0x7a0c('0x51'),_0x1b2d50[_0x7a0c('0x37')]);}};module[_0x7a0c('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 7da8511..3783572 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 _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x5b2271,_0x3728a2){var _0x4c3907=function(_0x506052){while(--_0x506052){_0x5b2271['push'](_0x5b2271['shift']());}};_0x4c3907(++_0x3728a2);}(_0x757a,0xde));var _0xa757=function(_0x2100f4,_0x33e437){_0x2100f4=_0x2100f4-0x0;var _0x16576e=_0x757a[_0x2100f4];return _0x16576e;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file +var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x1ac567,_0x30e18c){_0x1ac567=_0x1ac567-0x0;var _0x2e95ad=_0x2032[_0x1ac567];return _0x2e95ad;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5c275ab..a737a0a 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x70e0,0x17b));var _0x070e=function(_0x21188a,_0x760320){_0x21188a=_0x21188a-0x0;var _0x3eb2af=_0x70e0[_0x21188a];return _0x3eb2af;};'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 _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x524f05,_0x5697b1){var _0x52907a=function(_0x4dd152){while(--_0x4dd152){_0x524f05['push'](_0x524f05['shift']());}};_0x52907a(++_0x5697b1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c912fdb..e02f703 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0084=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x2c03ad,_0x578808){var _0x285eb3=function(_0x4d36c7){while(--_0x4d36c7){_0x2c03ad['push'](_0x2c03ad['shift']());}};_0x285eb3(++_0x578808);}(_0x0084,0x153));var _0x4008=function(_0x16d578,_0x3cbca3){_0x16d578=_0x16d578-0x0;var _0x3c0177=_0x0084[_0x16d578];return _0x3c0177;};'use strict';var util=require(_0x4008('0x0'));var _=require(_0x4008('0x1'));var moment=require(_0x4008('0x2'));function checkNameSurname(_0x2dea7c,_0x4eee91,_0x51a301){var _0x2eaeb3='';if(!_[_0x4008('0x3')](_0x4eee91)&&'string'===typeof _0x4eee91){_0x2eaeb3+=_0x4eee91;}if(!_[_0x4008('0x3')](_0x51a301)&&_0x4008('0x4')===typeof _0x51a301){_0x2eaeb3+='\x20'+_0x51a301;}if(_0x2eaeb3!==''){return _0x2eaeb3;}return _0x2dea7c;}function Action(_0x348091,_0x5dc7fa,_0x1867b6){this[_0x4008('0x5')]=_0x348091;this[_0x4008('0x6')]=_0x1867b6||undefined;this[_0x4008('0x7')]=checkNameSurname(_0x5dc7fa[_0x4008('0x8')][_0x4008('0x9')],_0x5dc7fa[_0x4008('0x8')][_0x4008('0xa')],_0x5dc7fa['Contact'][_0x4008('0xb')]);this['number']=_0x5dc7fa['phone'];this[_0x4008('0xc')]=_0x348091[_0x4008('0x7')];this[_0x4008('0xd')]=_0x5dc7fa[_0x4008('0xd')]||![];this[_0x4008('0xe')]=_0x348091[_0x4008('0xe')];this[_0x4008('0xf')]=_0x348091[_0x4008('0xf')]||0x3;this[_0x4008('0x10')]=_0x5dc7fa['scheduledat'];this[_0x4008('0x11')]=_0x5dc7fa[_0x4008('0x11')];this[_0x4008('0x12')]=_0x5dc7fa[_0x4008('0x12')];this['countnoanswerretry']=_0x5dc7fa[_0x4008('0x13')];this[_0x4008('0x14')]=_0x5dc7fa['countnosuchnumberretry'];this[_0x4008('0x15')]=_0x5dc7fa[_0x4008('0x15')];this[_0x4008('0x16')]=_0x5dc7fa['countabandonedretry'];this[_0x4008('0x17')]=_0x5dc7fa[_0x4008('0x17')];this[_0x4008('0x18')]=_0x5dc7fa['countagentrejectretry'];this[_0x4008('0x19')]=_0x5dc7fa[_0x4008('0x19')];this[_0x4008('0x1a')]=_0x5dc7fa[_0x4008('0x1a')];this[_0x4008('0x1b')]=_0x5dc7fa[_0x4008('0x1b')];this[_0x4008('0x1c')]=_0x5dc7fa[_0x4008('0x1c')];this[_0x4008('0x1d')]=_0x5dc7fa[_0x4008('0x1d')];this[_0x4008('0x1e')]=_0x5dc7fa['id'];this[_0x4008('0x1f')]=_0x5dc7fa[_0x4008('0x8')]['firstName']||'';this[_0x4008('0x20')]=moment()[_0x4008('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x5dc7fa[_0x4008('0x22')];this[_0x4008('0x23')]=_0x5dc7fa[_0x4008('0x23')];this[_0x4008('0x24')]=_0x5dc7fa[_0x4008('0x24')];this['recallme']=_0x5dc7fa[_0x4008('0x25')];this['originatecalleridnum']='';this[_0x4008('0x26')]='';}Action[_0x4008('0x27')][_0x4008('0x28')]=function(){return util[_0x4008('0x21')](_0x4008('0x29'),this['name'],this[_0x4008('0x5')][_0x4008('0x2a')]>0x0?this[_0x4008('0x2b')][_0x4008('0x2c')](this[_0x4008('0x5')][_0x4008('0x2a')]):this[_0x4008('0x2b')]);};Action['prototype']['getQueue']=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0xc1f1=['originatecalleridnum','originatecalleridname','getCaller','format','voiceQueue','dialCutDigit','substring','util','lodash','moment','string','isNil','phone','Contact','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x51b7d2,_0x42232d){var _0x187c0c=function(_0x408cdc){while(--_0x408cdc){_0x51b7d2['push'](_0x51b7d2['shift']());}};_0x187c0c(++_0x42232d);}(_0xc1f1,0x88));var _0x1c1f=function(_0x480c83,_0x1f8665){_0x480c83=_0x480c83-0x0;var _0x3368e0=_0xc1f1[_0x480c83];return _0x3368e0;};'use strict';var util=require(_0x1c1f('0x0'));var _=require(_0x1c1f('0x1'));var moment=require(_0x1c1f('0x2'));function checkNameSurname(_0xd9682d,_0x504184,_0x259ca2){var _0x2f308f='';if(!_['isNil'](_0x504184)&&_0x1c1f('0x3')===typeof _0x504184){_0x2f308f+=_0x504184;}if(!_[_0x1c1f('0x4')](_0x259ca2)&&'string'===typeof _0x259ca2){_0x2f308f+='\x20'+_0x259ca2;}if(_0x2f308f!==''){return _0x2f308f;}return _0xd9682d;}function Action(_0x329ad2,_0x188834,_0x4280e9){this['voiceQueue']=_0x329ad2;this['uniqueid']=_0x4280e9||undefined;this['name']=checkNameSurname(_0x188834['Contact'][_0x1c1f('0x5')],_0x188834[_0x1c1f('0x6')][_0x1c1f('0x7')],_0x188834[_0x1c1f('0x6')][_0x1c1f('0x8')]);this[_0x1c1f('0x9')]=_0x188834['phone'];this[_0x1c1f('0xa')]=_0x329ad2[_0x1c1f('0xb')];this[_0x1c1f('0xc')]=_0x188834['active']||![];this[_0x1c1f('0xd')]=_0x329ad2[_0x1c1f('0xd')];this[_0x1c1f('0xe')]=_0x329ad2[_0x1c1f('0xe')]||0x3;this[_0x1c1f('0xf')]=_0x188834[_0x1c1f('0xf')];this[_0x1c1f('0x10')]=_0x188834[_0x1c1f('0x10')];this[_0x1c1f('0x11')]=_0x188834['countcongestionretry'];this['countnoanswerretry']=_0x188834[_0x1c1f('0x12')];this[_0x1c1f('0x13')]=_0x188834[_0x1c1f('0x13')];this[_0x1c1f('0x14')]=_0x188834[_0x1c1f('0x14')];this[_0x1c1f('0x15')]=_0x188834[_0x1c1f('0x15')];this[_0x1c1f('0x16')]=_0x188834[_0x1c1f('0x16')];this['countagentrejectretry']=_0x188834[_0x1c1f('0x17')];this[_0x1c1f('0x18')]=_0x188834[_0x1c1f('0x18')];this[_0x1c1f('0x19')]=_0x188834[_0x1c1f('0x19')];this[_0x1c1f('0x1a')]=_0x188834[_0x1c1f('0x1a')];this[_0x1c1f('0x1b')]=_0x188834[_0x1c1f('0x1b')];this[_0x1c1f('0x1c')]=_0x188834[_0x1c1f('0x1c')];this[_0x1c1f('0x1d')]=_0x188834['id'];this[_0x1c1f('0x1e')]=_0x188834['Contact'][_0x1c1f('0x7')]||'';this['starttime']=moment()['format'](_0x1c1f('0x1f'));this['callback']=_0x188834[_0x1c1f('0x20')];this[_0x1c1f('0x21')]=_0x188834['callbackuniqueid'];this[_0x1c1f('0x22')]=_0x188834[_0x1c1f('0x22')];this[_0x1c1f('0x23')]=_0x188834[_0x1c1f('0x23')];this[_0x1c1f('0x24')]='';this[_0x1c1f('0x25')]='';}Action['prototype'][_0x1c1f('0x26')]=function(){return util[_0x1c1f('0x27')]('\x22%s\x22\x20<%s>',this[_0x1c1f('0xb')],this[_0x1c1f('0x28')][_0x1c1f('0x29')]>0x0?this[_0x1c1f('0x9')][_0x1c1f('0x2a')](this[_0x1c1f('0x28')][_0x1c1f('0x29')]):this[_0x1c1f('0x9')]);};Action['prototype']['getQueue']=function(){return this[_0x1c1f('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index f672e68..c6cbdcc 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe128=['countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x4b0c78,_0x5d7e3f){var _0x2136bd=function(_0x49c382){while(--_0x49c382){_0x4b0c78['push'](_0x4b0c78['shift']());}};_0x2136bd(++_0x5d7e3f);}(_0xe128,0x14e));var _0x8e12=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0xe128[_0x1a014b];return _0x462258;};'use strict';var util=require('util');var _=require(_0x8e12('0x0'));var moment=require(_0x8e12('0x1'));function getSeconds(_0x3cc568,_0x1bb28c){var _0x447e6c=moment(_0x3cc568)[_0x8e12('0x2')](0x0);var _0x57df7e=moment(_0x1bb28c)[_0x8e12('0x2')](0x0);return _0x447e6c['diff'](_0x57df7e,'seconds');}function AgentComplete(_0xdd9c7e,_0x71a680){this['state']=0x4;this[_0x8e12('0x3')]='Answer';this['scheduledat']=_0xdd9c7e[_0x8e12('0x4')];this[_0x8e12('0x5')]=_0xdd9c7e[_0x8e12('0x5')];this[_0x8e12('0x6')]=_0xdd9c7e[_0x8e12('0x5')]===_0x8e12('0x7')?_0x8e12('0x8'):_0xdd9c7e['type'];this['countbusyretry']=_0xdd9c7e[_0x8e12('0x9')];this[_0x8e12('0xa')]=_0xdd9c7e['countcongestionretry'];this['countnoanswerretry']=_0xdd9c7e[_0x8e12('0xb')];this['countglobal']=_0xdd9c7e[_0x8e12('0x9')]+_0xdd9c7e[_0x8e12('0xa')]+_0xdd9c7e[_0x8e12('0xb')]+_0xdd9c7e['countnosuchnumberretry']+_0xdd9c7e[_0x8e12('0xc')]+_0xdd9c7e[_0x8e12('0xd')]+_0xdd9c7e[_0x8e12('0xe')]+_0xdd9c7e[_0x8e12('0xf')];this[_0x8e12('0x10')]=_0xdd9c7e[_0x8e12('0x10')];this[_0x8e12('0xc')]=_0xdd9c7e['countdropretry'];this[_0x8e12('0xd')]=_0xdd9c7e[_0x8e12('0xd')];this[_0x8e12('0xe')]=_0xdd9c7e[_0x8e12('0xe')];this[_0x8e12('0xf')]=_0xdd9c7e[_0x8e12('0xf')];this[_0x8e12('0x11')]=_0x71a680[_0x8e12('0x11')];this[_0x8e12('0x12')]=_0xdd9c7e[_0x8e12('0x13')];this[_0x8e12('0x14')]=_0xdd9c7e[_0x8e12('0x15')];this[_0x8e12('0x16')]=_0xdd9c7e[_0x8e12('0x16')];this[_0x8e12('0x17')]=_0xdd9c7e[_0x8e12('0x17')];this[_0x8e12('0x18')]=_0xdd9c7e['answertime'];this[_0x8e12('0x19')]=moment()[_0x8e12('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8e12('0x1b')]=getSeconds(_0xdd9c7e[_0x8e12('0x17')],_0xdd9c7e['starttime']);this['holdtime']=getSeconds(_0xdd9c7e[_0x8e12('0x18')],_0xdd9c7e[_0x8e12('0x17')]);this[_0x8e12('0x1c')]=getSeconds(this[_0x8e12('0x19')],_0xdd9c7e[_0x8e12('0x18')]);this[_0x8e12('0x8')]=_0x71a680[_0x8e12('0x8')];this['membername']=_0x71a680[_0x8e12('0x1d')];this[_0x8e12('0x1e')]=_0x71a680[_0x8e12('0x1e')];this[_0x8e12('0x1f')]=_0xdd9c7e['callback'];this[_0x8e12('0x20')]=_0xdd9c7e['callbackuniqueid'];this[_0x8e12('0x21')]=_0xdd9c7e['callbackat'];this[_0x8e12('0x22')]=_0xdd9c7e[_0x8e12('0x22')];this['ContactId']=_0xdd9c7e[_0x8e12('0x23')];this[_0x8e12('0x24')]=_0xdd9c7e['ListId'];this[_0x8e12('0x25')]=_0xdd9c7e[_0x8e12('0x25')];this[_0x8e12('0x26')]=_0xdd9c7e[_0x8e12('0x26')];this[_0x8e12('0x27')]=_0xdd9c7e['CampaignId'];this[_0x8e12('0x28')]=_0xdd9c7e['originatecalleridnum']||'';this[_0x8e12('0x29')]=_0xdd9c7e[_0x8e12('0x29')]||'';}module[_0x8e12('0x2a')]=AgentComplete; \ No newline at end of file +var _0x89fd=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','statedesc','Answer'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x89fd,0x113));var _0xd89f=function(_0x2ddd8f,_0x3a05cf){_0x2ddd8f=_0x2ddd8f-0x0;var _0x405d6f=_0x89fd[_0x2ddd8f];return _0x405d6f;};'use strict';var util=require('util');var _=require(_0xd89f('0x0'));var moment=require(_0xd89f('0x1'));function getSeconds(_0xb20231,_0x7e9848){var _0x376539=moment(_0xb20231)[_0xd89f('0x2')](0x0);var _0x2c77d6=moment(_0x7e9848)[_0xd89f('0x2')](0x0);return _0x376539[_0xd89f('0x3')](_0x2c77d6,_0xd89f('0x4'));}function AgentComplete(_0x3a0350,_0x25481d){this['state']=0x4;this[_0xd89f('0x5')]=_0xd89f('0x6');this['scheduledat']=_0x3a0350[_0xd89f('0x7')];this['type']=_0x3a0350[_0xd89f('0x8')];this[_0xd89f('0x9')]=_0x3a0350[_0xd89f('0x8')]===_0xd89f('0xa')?_0xd89f('0xb'):_0x3a0350[_0xd89f('0x8')];this[_0xd89f('0xc')]=_0x3a0350[_0xd89f('0xc')];this[_0xd89f('0xd')]=_0x3a0350['countcongestionretry'];this['countnoanswerretry']=_0x3a0350[_0xd89f('0xe')];this[_0xd89f('0xf')]=_0x3a0350[_0xd89f('0xc')]+_0x3a0350[_0xd89f('0xd')]+_0x3a0350[_0xd89f('0xe')]+_0x3a0350[_0xd89f('0x10')]+_0x3a0350[_0xd89f('0x11')]+_0x3a0350[_0xd89f('0x12')]+_0x3a0350['countmachineretry']+_0x3a0350['countagentrejectretry'];this['countnosuchnumberretry']=_0x3a0350[_0xd89f('0x10')];this['countdropretry']=_0x3a0350[_0xd89f('0x11')];this[_0xd89f('0x12')]=_0x3a0350[_0xd89f('0x12')];this[_0xd89f('0x13')]=_0x3a0350[_0xd89f('0x13')];this[_0xd89f('0x14')]=_0x3a0350[_0xd89f('0x14')];this[_0xd89f('0x15')]=_0x25481d[_0xd89f('0x15')];this[_0xd89f('0x16')]=_0x3a0350[_0xd89f('0x17')];this['calleridnum']=_0x3a0350[_0xd89f('0x18')];this['starttime']=_0x3a0350[_0xd89f('0x19')];this[_0xd89f('0x1a')]=_0x3a0350[_0xd89f('0x1a')];this[_0xd89f('0x1b')]=_0x3a0350[_0xd89f('0x1b')];this[_0xd89f('0x1c')]=moment()[_0xd89f('0x1d')](_0xd89f('0x1e'));this[_0xd89f('0x1f')]=getSeconds(_0x3a0350['responsetime'],_0x3a0350['starttime']);this[_0xd89f('0x20')]=getSeconds(_0x3a0350[_0xd89f('0x1b')],_0x3a0350['responsetime']);this['talktime']=getSeconds(this[_0xd89f('0x1c')],_0x3a0350[_0xd89f('0x1b')]);this[_0xd89f('0xb')]=_0x25481d[_0xd89f('0xb')];this[_0xd89f('0x21')]=_0x25481d[_0xd89f('0x21')];this[_0xd89f('0x22')]=_0x25481d[_0xd89f('0x22')];this[_0xd89f('0x23')]=_0x3a0350[_0xd89f('0x23')];this[_0xd89f('0x24')]=_0x3a0350[_0xd89f('0x24')];this['callbackat']=_0x3a0350[_0xd89f('0x25')];this[_0xd89f('0x26')]=_0x3a0350['recallme'];this[_0xd89f('0x27')]=_0x3a0350['ContactId'];this[_0xd89f('0x28')]=_0x3a0350['ListId'];this['UserId']=_0x3a0350[_0xd89f('0x29')];this[_0xd89f('0x2a')]=_0x3a0350[_0xd89f('0x2a')];this[_0xd89f('0x2b')]=_0x3a0350[_0xd89f('0x2b')];this[_0xd89f('0x2c')]=_0x3a0350[_0xd89f('0x2c')]||'';this['originatecalleridname']=_0x3a0350[_0xd89f('0x2d')]||'';}module[_0xd89f('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index f2b8ebf..2b8ce0e 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55ca,0x126));var _0xa55c=function(_0x250d2a,_0x2983be){_0x250d2a=_0x250d2a-0x0;var _0x5738fa=_0x55ca[_0x250d2a];return _0x5738fa;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var moment=require('moment');function getSeconds(_0x5edc58,_0x49875a){var _0x1c6ec3=moment(_0x5edc58)[_0xa55c('0x2')](0x0);var _0x5dc716=moment(_0x49875a)[_0xa55c('0x2')](0x0);return _0x1c6ec3[_0xa55c('0x3')](_0x5dc716,_0xa55c('0x4'));}function Final(_0x204951){this[_0xa55c('0x5')]=_0x204951[_0xa55c('0x5')];this[_0xa55c('0x6')]=_0x204951['scheduledat'];this[_0xa55c('0x7')]=_0x204951[_0xa55c('0x7')];this['campaigntype']=_0x204951[_0xa55c('0x7')]===_0xa55c('0x8')?'queue':_0x204951['type'];this[_0xa55c('0x9')]=_0x204951[_0xa55c('0x9')];this[_0xa55c('0xa')]=_0x204951[_0xa55c('0xa')];this[_0xa55c('0xb')]=_0x204951[_0xa55c('0xb')];this[_0xa55c('0xc')]=_0x204951[_0xa55c('0x9')]+_0x204951[_0xa55c('0xa')]+_0x204951[_0xa55c('0xb')]+_0x204951['countnosuchnumberretry']+_0x204951['countdropretry']+_0x204951[_0xa55c('0xd')]+_0x204951['countmachineretry']+_0x204951['countagentrejectretry'];this['countnosuchnumberretry']=_0x204951[_0xa55c('0xe')];this[_0xa55c('0xf')]=_0x204951[_0xa55c('0xf')];this[_0xa55c('0xd')]=_0x204951[_0xa55c('0xd')];this[_0xa55c('0x10')]=_0x204951['countmachineretry'];this[_0xa55c('0x11')]=_0x204951[_0xa55c('0x11')];this[_0xa55c('0x12')]=_0x204951[_0xa55c('0x12')];this[_0xa55c('0x13')]=_0x204951[_0xa55c('0x13')];this[_0xa55c('0x14')]=_0x204951[_0xa55c('0x14')];this[_0xa55c('0x15')]=_0x204951['starttime'];this[_0xa55c('0x16')]=_0x204951[_0xa55c('0x16')];this[_0xa55c('0x17')]=_0x204951[_0xa55c('0x16')];this[_0xa55c('0x18')]=_0x204951[_0xa55c('0x18')]||0x0;this['holdtime']=_0x204951['holdtime']||0x0;this[_0xa55c('0x19')]=_0x204951[_0xa55c('0x19')]||0x0;this[_0xa55c('0x1a')]=_0x204951['callback'];this[_0xa55c('0x1b')]=_0x204951[_0xa55c('0x1b')];this['callbackat']=_0x204951[_0xa55c('0x1c')];this[_0xa55c('0x1d')]=_0x204951[_0xa55c('0x1d')];this[_0xa55c('0x1e')]=_0x204951[_0xa55c('0x1e')];this['ListId']=_0x204951[_0xa55c('0x1f')];this['UserId']=_0x204951['UserId'];this['VoiceQueueId']=_0x204951[_0xa55c('0x20')];this['CampaignId']=_0x204951[_0xa55c('0x21')];this[_0xa55c('0x22')]=_0x204951[_0xa55c('0x22')]||'';this[_0xa55c('0x23')]=_0x204951[_0xa55c('0x23')]||'';}module[_0xa55c('0x24')]=Final; \ No newline at end of file +var _0xc949=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1a3515,_0xe6b7f0){var _0x248825=function(_0x31c500){while(--_0x31c500){_0x1a3515['push'](_0x1a3515['shift']());}};_0x248825(++_0xe6b7f0);}(_0xc949,0x181));var _0x9c94=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xc949[_0xa6cc5c];return _0x44803d;};'use strict';var util=require(_0x9c94('0x0'));var _=require('lodash');var moment=require(_0x9c94('0x1'));function getSeconds(_0x322fed,_0x209cd8){var _0x27613f=moment(_0x322fed)['milliseconds'](0x0);var _0x11a56c=moment(_0x209cd8)[_0x9c94('0x2')](0x0);return _0x27613f['diff'](_0x11a56c,_0x9c94('0x3'));}function Final(_0x1b60a1){this[_0x9c94('0x4')]=_0x1b60a1[_0x9c94('0x4')];this['scheduledat']=_0x1b60a1[_0x9c94('0x5')];this[_0x9c94('0x6')]=_0x1b60a1[_0x9c94('0x6')];this[_0x9c94('0x7')]=_0x1b60a1[_0x9c94('0x6')]===_0x9c94('0x8')?_0x9c94('0x9'):_0x1b60a1[_0x9c94('0x6')];this[_0x9c94('0xa')]=_0x1b60a1[_0x9c94('0xa')];this['countcongestionretry']=_0x1b60a1[_0x9c94('0xb')];this[_0x9c94('0xc')]=_0x1b60a1[_0x9c94('0xc')];this[_0x9c94('0xd')]=_0x1b60a1[_0x9c94('0xa')]+_0x1b60a1[_0x9c94('0xb')]+_0x1b60a1[_0x9c94('0xc')]+_0x1b60a1[_0x9c94('0xe')]+_0x1b60a1[_0x9c94('0xf')]+_0x1b60a1[_0x9c94('0x10')]+_0x1b60a1[_0x9c94('0x11')]+_0x1b60a1[_0x9c94('0x12')];this[_0x9c94('0xe')]=_0x1b60a1[_0x9c94('0xe')];this['countdropretry']=_0x1b60a1[_0x9c94('0xf')];this['countabandonedretry']=_0x1b60a1[_0x9c94('0x10')];this[_0x9c94('0x11')]=_0x1b60a1['countmachineretry'];this[_0x9c94('0x12')]=_0x1b60a1['countagentrejectretry'];this['queue']=_0x1b60a1[_0x9c94('0x9')];this['calleridname']=_0x1b60a1[_0x9c94('0x13')];this[_0x9c94('0x14')]=_0x1b60a1['calleridnum'];this[_0x9c94('0x15')]=_0x1b60a1[_0x9c94('0x15')];this[_0x9c94('0x16')]=_0x1b60a1[_0x9c94('0x16')];this[_0x9c94('0x17')]=_0x1b60a1[_0x9c94('0x16')];this[_0x9c94('0x18')]=_0x1b60a1['ringtime']||0x0;this[_0x9c94('0x19')]=_0x1b60a1[_0x9c94('0x19')]||0x0;this['talktime']=_0x1b60a1[_0x9c94('0x1a')]||0x0;this[_0x9c94('0x1b')]=_0x1b60a1[_0x9c94('0x1b')];this[_0x9c94('0x1c')]=_0x1b60a1[_0x9c94('0x1c')];this[_0x9c94('0x1d')]=_0x1b60a1[_0x9c94('0x1d')];this[_0x9c94('0x1e')]=_0x1b60a1[_0x9c94('0x1e')];this[_0x9c94('0x1f')]=_0x1b60a1[_0x9c94('0x1f')];this[_0x9c94('0x20')]=_0x1b60a1[_0x9c94('0x20')];this[_0x9c94('0x21')]=_0x1b60a1['UserId'];this[_0x9c94('0x22')]=_0x1b60a1[_0x9c94('0x22')];this['CampaignId']=_0x1b60a1[_0x9c94('0x23')];this[_0x9c94('0x24')]=_0x1b60a1[_0x9c94('0x24')]||'';this[_0x9c94('0x25')]=_0x1b60a1[_0x9c94('0x25')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 81c556f..6d8dc86 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e54=['CampaignId','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','endtime','format','ringtime','queue','membername','IVR','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xc4f2f5,_0x3a8711){var _0x39671a=function(_0x59afac){while(--_0x59afac){_0xc4f2f5['push'](_0xc4f2f5['shift']());}};_0x39671a(++_0x3a8711);}(_0x5e54,0x1c9));var _0x45e5=function(_0x58e75c,_0x278500){_0x58e75c=_0x58e75c-0x0;var _0x41b7f9=_0x5e54[_0x58e75c];return _0x41b7f9;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x5e211f,_0x54e94d){var _0x56777c=moment(_0x5e211f)['milliseconds'](0x0);var _0x24e789=moment(_0x54e94d)[_0x45e5('0x0')](0x0);return _0x56777c[_0x45e5('0x1')](_0x24e789,_0x45e5('0x2'));}function Hangup(_0x3b61ef,_0x338b43){this[_0x45e5('0x3')]=0x4;this[_0x45e5('0x4')]=_0x45e5('0x5');this['scheduledat']=_0x3b61ef[_0x45e5('0x6')];this[_0x45e5('0x7')]=_0x3b61ef[_0x45e5('0x7')];this[_0x45e5('0x8')]=_0x3b61ef['type']===_0x45e5('0x9')?'queue':_0x3b61ef[_0x45e5('0x7')];this[_0x45e5('0xa')]=_0x3b61ef[_0x45e5('0xa')];this[_0x45e5('0xb')]=_0x3b61ef['countcongestionretry'];this[_0x45e5('0xc')]=_0x3b61ef[_0x45e5('0xc')];this[_0x45e5('0xd')]=_0x3b61ef[_0x45e5('0xa')]+_0x3b61ef[_0x45e5('0xb')]+_0x3b61ef[_0x45e5('0xc')]+_0x3b61ef[_0x45e5('0xe')]+_0x3b61ef[_0x45e5('0xf')]+_0x3b61ef[_0x45e5('0x10')]+_0x3b61ef[_0x45e5('0x11')]+_0x3b61ef[_0x45e5('0x12')];this[_0x45e5('0xe')]=_0x3b61ef[_0x45e5('0xe')];this[_0x45e5('0xf')]=_0x3b61ef['countdropretry'];this[_0x45e5('0x10')]=_0x3b61ef[_0x45e5('0x10')];this[_0x45e5('0x11')]=_0x3b61ef[_0x45e5('0x11')];this[_0x45e5('0x12')]=_0x3b61ef[_0x45e5('0x12')];this[_0x45e5('0x13')]=_0x338b43[_0x45e5('0x13')];this[_0x45e5('0x14')]=_0x3b61ef['name'];this['calleridnum']=_0x3b61ef[_0x45e5('0x15')];this[_0x45e5('0x16')]=_0x3b61ef[_0x45e5('0x16')];this[_0x45e5('0x17')]=_0x3b61ef['responsetime'];this[_0x45e5('0x18')]=moment()[_0x45e5('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x45e5('0x1a')]=getSeconds(_0x3b61ef[_0x45e5('0x17')],_0x3b61ef[_0x45e5('0x16')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0x45e5('0x18')],_0x3b61ef[_0x45e5('0x17')]);this[_0x45e5('0x1b')]=_0x3b61ef[_0x45e5('0x1b')];this[_0x45e5('0x1c')]=_0x45e5('0x1d');this['reason']=_0x338b43['cause-txt'];this['callback']=_0x3b61ef[_0x45e5('0x1e')];this[_0x45e5('0x1f')]=_0x3b61ef[_0x45e5('0x1f')];this['callbackat']=_0x3b61ef['callbackat'];this['recallme']=_0x3b61ef[_0x45e5('0x20')];this['ContactId']=_0x3b61ef[_0x45e5('0x21')];this[_0x45e5('0x22')]=_0x3b61ef['ListId'];this[_0x45e5('0x23')]=_0x3b61ef[_0x45e5('0x23')];this[_0x45e5('0x24')]=_0x3b61ef[_0x45e5('0x24')];this[_0x45e5('0x25')]=_0x3b61ef[_0x45e5('0x25')];}module['exports']=Hangup; \ No newline at end of file +var _0x57c1=['talktime','endtime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x2e7c1b,_0x232f79){var _0x42f565=function(_0x31ee5a){while(--_0x31ee5a){_0x2e7c1b['push'](_0x2e7c1b['shift']());}};_0x42f565(++_0x232f79);}(_0x57c1,0x1b5));var _0x157c=function(_0x4df38a,_0x957b58){_0x4df38a=_0x4df38a-0x0;var _0x3300e0=_0x57c1[_0x4df38a];return _0x3300e0;};'use strict';var util=require(_0x157c('0x0'));var _=require(_0x157c('0x1'));var moment=require(_0x157c('0x2'));function getSeconds(_0x2d3c4d,_0x40668f){var _0x911f8f=moment(_0x2d3c4d)[_0x157c('0x3')](0x0);var _0x4f59fa=moment(_0x40668f)[_0x157c('0x3')](0x0);return _0x911f8f[_0x157c('0x4')](_0x4f59fa,'seconds');}function Hangup(_0x4e9549,_0x548199){this[_0x157c('0x5')]=0x4;this[_0x157c('0x6')]=_0x157c('0x7');this[_0x157c('0x8')]=_0x4e9549[_0x157c('0x8')];this[_0x157c('0x9')]=_0x4e9549[_0x157c('0x9')];this[_0x157c('0xa')]=_0x4e9549[_0x157c('0x9')]===_0x157c('0xb')?_0x157c('0xc'):_0x4e9549[_0x157c('0x9')];this[_0x157c('0xd')]=_0x4e9549[_0x157c('0xd')];this[_0x157c('0xe')]=_0x4e9549['countcongestionretry'];this[_0x157c('0xf')]=_0x4e9549['countnoanswerretry'];this[_0x157c('0x10')]=_0x4e9549[_0x157c('0xd')]+_0x4e9549[_0x157c('0xe')]+_0x4e9549[_0x157c('0xf')]+_0x4e9549[_0x157c('0x11')]+_0x4e9549[_0x157c('0x12')]+_0x4e9549[_0x157c('0x13')]+_0x4e9549[_0x157c('0x14')]+_0x4e9549[_0x157c('0x15')];this[_0x157c('0x11')]=_0x4e9549[_0x157c('0x11')];this[_0x157c('0x12')]=_0x4e9549[_0x157c('0x12')];this['countabandonedretry']=_0x4e9549[_0x157c('0x13')];this[_0x157c('0x14')]=_0x4e9549[_0x157c('0x14')];this['countagentrejectretry']=_0x4e9549[_0x157c('0x15')];this[_0x157c('0x16')]=_0x548199[_0x157c('0x16')];this[_0x157c('0x17')]=_0x4e9549[_0x157c('0x18')];this[_0x157c('0x19')]=_0x4e9549[_0x157c('0x1a')];this[_0x157c('0x1b')]=_0x4e9549[_0x157c('0x1b')];this[_0x157c('0x1c')]=_0x4e9549[_0x157c('0x1c')];this['endtime']=moment()[_0x157c('0x1d')](_0x157c('0x1e'));this[_0x157c('0x1f')]=getSeconds(_0x4e9549[_0x157c('0x1c')],_0x4e9549[_0x157c('0x1b')]);this[_0x157c('0x20')]=0x0;this[_0x157c('0x21')]=getSeconds(this[_0x157c('0x22')],_0x4e9549[_0x157c('0x1c')]);this[_0x157c('0xc')]=_0x4e9549[_0x157c('0xc')];this[_0x157c('0x23')]='IVR';this['reason']=_0x548199[_0x157c('0x24')];this[_0x157c('0x25')]=_0x4e9549[_0x157c('0x25')];this[_0x157c('0x26')]=_0x4e9549[_0x157c('0x26')];this[_0x157c('0x27')]=_0x4e9549[_0x157c('0x27')];this[_0x157c('0x28')]=_0x4e9549[_0x157c('0x28')];this[_0x157c('0x29')]=_0x4e9549[_0x157c('0x29')];this[_0x157c('0x2a')]=_0x4e9549['ListId'];this['UserId']=_0x4e9549[_0x157c('0x2b')];this[_0x157c('0x2c')]=_0x4e9549['VoiceQueueId'];this['CampaignId']=_0x4e9549[_0x157c('0x2d')];}module[_0x157c('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e71723f..ebc4ef9 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4375=['countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0x32ce99,_0x18b220){var _0x33917d=function(_0x2f8298){while(--_0x2f8298){_0x32ce99['push'](_0x32ce99['shift']());}};_0x33917d(++_0x18b220);}(_0x4375,0x1bd));var _0x5437=function(_0x20a60b,_0x9b2549){_0x20a60b=_0x20a60b-0x0;var _0x1ad2cf=_0x4375[_0x20a60b];return _0x1ad2cf;};'use strict';var util=require(_0x5437('0x0'));var _=require(_0x5437('0x1'));var moment=require('moment');function getSeconds(_0x500909,_0x254869){var _0x121a20=moment(_0x500909)['milliseconds'](0x0);var _0x1c9213=moment(_0x254869)['milliseconds'](0x0);return _0x121a20[_0x5437('0x2')](_0x1c9213,_0x5437('0x3'));}function History(_0x490fff){this[_0x5437('0x4')]=_0x490fff[_0x5437('0x4')];this[_0x5437('0x5')]=_0x490fff[_0x5437('0x5')]||undefined;this[_0x5437('0x6')]=_0x490fff[_0x5437('0x6')];this[_0x5437('0x7')]=_0x490fff[_0x5437('0x6')]==='outbound'?_0x5437('0x8'):_0x490fff[_0x5437('0x6')];this[_0x5437('0x9')]=_0x490fff[_0x5437('0x9')];this['countcongestionretry']=_0x490fff[_0x5437('0xa')];this[_0x5437('0xb')]=_0x490fff['countnoanswerretry'];this[_0x5437('0xc')]=_0x490fff[_0x5437('0x9')]+_0x490fff[_0x5437('0xa')]+_0x490fff[_0x5437('0xb')]+_0x490fff[_0x5437('0xd')]+_0x490fff['countdropretry']+_0x490fff[_0x5437('0xe')]+_0x490fff[_0x5437('0xf')]+_0x490fff['countagentrejectretry'];this[_0x5437('0xd')]=_0x490fff[_0x5437('0xd')];this[_0x5437('0x10')]=_0x490fff[_0x5437('0x10')];this[_0x5437('0xe')]=_0x490fff['countabandonedretry'];this['countmachineretry']=_0x490fff[_0x5437('0xf')];this[_0x5437('0x11')]=_0x490fff['countagentrejectretry'];this[_0x5437('0x8')]=_0x490fff[_0x5437('0x8')];this[_0x5437('0x12')]=_0x490fff[_0x5437('0x13')];this['calleridnum']=_0x490fff[_0x5437('0x14')];this['starttime']=_0x490fff[_0x5437('0x15')];this[_0x5437('0x16')]=_0x490fff[_0x5437('0x16')];this[_0x5437('0x17')]=_0x490fff[_0x5437('0x16')];this[_0x5437('0x18')]=getSeconds(_0x490fff[_0x5437('0x16')],_0x490fff['starttime']);this[_0x5437('0x19')]=0x0;this[_0x5437('0x1a')]=0x0;this[_0x5437('0x1b')]=_0x490fff[_0x5437('0x1b')];this[_0x5437('0x1c')]=_0x490fff['callbackuniqueid'];this['callbackat']=_0x490fff[_0x5437('0x1d')];this[_0x5437('0x1e')]=_0x490fff[_0x5437('0x1e')];this[_0x5437('0x1f')]=_0x490fff['ContactId'];this['ListId']=_0x490fff[_0x5437('0x20')];this[_0x5437('0x21')]=_0x490fff[_0x5437('0x21')];this[_0x5437('0x22')]=_0x490fff[_0x5437('0x22')];this['CampaignId']=_0x490fff[_0x5437('0x23')];this[_0x5437('0x24')]=_0x490fff[_0x5437('0x24')]||'';this[_0x5437('0x25')]=_0x490fff[_0x5437('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0x4044=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x5d99ad,_0x15d2b5){var _0x453124=function(_0x57c8cf){while(--_0x57c8cf){_0x5d99ad['push'](_0x5d99ad['shift']());}};_0x453124(++_0x15d2b5);}(_0x4044,0x19c));var _0x4404=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4044[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require('util');var _=require(_0x4404('0x0'));var moment=require('moment');function getSeconds(_0x2f9050,_0x3a4ae2){var _0x3022bd=moment(_0x2f9050)[_0x4404('0x1')](0x0);var _0x19b454=moment(_0x3a4ae2)[_0x4404('0x1')](0x0);return _0x3022bd[_0x4404('0x2')](_0x19b454,_0x4404('0x3'));}function History(_0x3794be){this[_0x4404('0x4')]=_0x3794be[_0x4404('0x4')];this[_0x4404('0x5')]=_0x3794be[_0x4404('0x5')]||undefined;this[_0x4404('0x6')]=_0x3794be[_0x4404('0x6')];this[_0x4404('0x7')]=_0x3794be[_0x4404('0x6')]===_0x4404('0x8')?_0x4404('0x9'):_0x3794be[_0x4404('0x6')];this[_0x4404('0xa')]=_0x3794be[_0x4404('0xa')];this[_0x4404('0xb')]=_0x3794be['countcongestionretry'];this['countnoanswerretry']=_0x3794be[_0x4404('0xc')];this['countglobal']=_0x3794be['countbusyretry']+_0x3794be[_0x4404('0xb')]+_0x3794be['countnoanswerretry']+_0x3794be[_0x4404('0xd')]+_0x3794be[_0x4404('0xe')]+_0x3794be[_0x4404('0xf')]+_0x3794be[_0x4404('0x10')]+_0x3794be[_0x4404('0x11')];this[_0x4404('0xd')]=_0x3794be[_0x4404('0xd')];this[_0x4404('0xe')]=_0x3794be['countdropretry'];this[_0x4404('0xf')]=_0x3794be['countabandonedretry'];this[_0x4404('0x10')]=_0x3794be['countmachineretry'];this[_0x4404('0x11')]=_0x3794be[_0x4404('0x11')];this[_0x4404('0x9')]=_0x3794be[_0x4404('0x9')];this[_0x4404('0x12')]=_0x3794be[_0x4404('0x13')];this[_0x4404('0x14')]=_0x3794be[_0x4404('0x15')];this[_0x4404('0x16')]=_0x3794be[_0x4404('0x16')];this[_0x4404('0x17')]=_0x3794be[_0x4404('0x17')];this[_0x4404('0x18')]=_0x3794be[_0x4404('0x17')];this[_0x4404('0x19')]=getSeconds(_0x3794be[_0x4404('0x17')],_0x3794be['starttime']);this[_0x4404('0x1a')]=0x0;this[_0x4404('0x1b')]=0x0;this[_0x4404('0x1c')]=_0x3794be[_0x4404('0x1c')];this['callbackuniqueid']=_0x3794be[_0x4404('0x1d')];this[_0x4404('0x1e')]=_0x3794be['callbackat'];this[_0x4404('0x1f')]=_0x3794be['recallme'];this['ContactId']=_0x3794be[_0x4404('0x20')];this[_0x4404('0x21')]=_0x3794be[_0x4404('0x21')];this[_0x4404('0x22')]=_0x3794be['UserId'];this[_0x4404('0x23')]=_0x3794be[_0x4404('0x23')];this[_0x4404('0x24')]=_0x3794be[_0x4404('0x24')];this[_0x4404('0x25')]=_0x3794be[_0x4404('0x25')]||'';this['originatecalleridname']=_0x3794be[_0x4404('0x26')]||'';}module[_0x4404('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d209ed2..3ddea02 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 _0xd986=['checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','timezones','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','dialPowerLevel','predictive','Queue','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','handleIvr','dialTimezone','checkDialMethod','[syncQueueSummary]','throttle','filter','map','user:dialPreviewRecallReminder','syncCampaigns','dialGlobalInterval','pow','replace','random','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','xcally-motion-dialer','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','syncOriginateResponse','getQueue','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','merge','dialPredictiveOptimization','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','busyFactor','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','debug','is\x20disactive','state','endtime','starttime','clearZombieChannels','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','[emptyContact][createHistory]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueId','uniqueid','variable','amdstatus','exten','value','HANGUP','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','countmachineretry','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','createStateFinal','CampaignId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','syncAgentComplete','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','agiafterat','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','paused','stateinterface','pick','idHopper','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime'];(function(_0x50ce10,_0x4d1905){var _0x203e43=function(_0x3f5a5e){while(--_0x3f5a5e){_0x50ce10['push'](_0x50ce10['shift']());}};_0x203e43(++_0x4d1905);}(_0xd986,0xe6));var _0x6d98=function(_0x3a87c9,_0x132bad){_0x3a87c9=_0x3a87c9-0x0;var _0x4e1ad8=_0xd986[_0x3a87c9];return _0x4e1ad8;};'use strict';var util=require(_0x6d98('0x0'));var _=require(_0x6d98('0x1'));var uuid=require(_0x6d98('0x2'));var moment=require(_0x6d98('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x6d98('0x4'));var ut=require(_0x6d98('0x5'));var config=require(_0x6d98('0x6'));var logger=require(_0x6d98('0x7'))(_0x6d98('0x8'));var loggerBooked=require(_0x6d98('0x7'))(_0x6d98('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x6d98('0x7'))(_0x6d98('0xa'));var loggerSyncQueueSummary=require(_0x6d98('0x7'))(_0x6d98('0xb'));var ami=require(_0x6d98('0xc'));config['redis']=_[_0x6d98('0xd')](config[_0x6d98('0xe')],{'host':_0x6d98('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d98('0xe')]));var cmHopper=require(_0x6d98('0x10'));var cmHopperHistory=require(_0x6d98('0x11'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x6d98('0x12'));var voiceQueueRt=require(_0x6d98('0x13'));var RpcSetting=require(_0x6d98('0x14'));var Action=require(_0x6d98('0x15'));var History=require(_0x6d98('0x16'));var Final=require(_0x6d98('0x17'));var AgentComplete=require(_0x6d98('0x18'));var QueueCallerAbandon=require(_0x6d98('0x19'));var Hangup=require(_0x6d98('0x1a'));var ipAgi=process[_0x6d98('0x1b')][_0x6d98('0x1c')]||_0x6d98('0x1d');var strategy={'rrmemory':_0x6d98('0x1e'),'roundrobin':_0x6d98('0x1f')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6d98('0x20')][_0x6d98('0x21')]=function(_0x466909){this['tail']=this[_0x6d98('0x22')]?this[_0x6d98('0x22')][_0x6d98('0x23')](_0x466909):_0x466909();};function Dialer(_0x26525b,_0x19e677){this['sequence']=new Sequence();this['preview']=_0x19e677;this[_0x6d98('0x24')]=_0x26525b['voiceQueues'];this[_0x6d98('0x25')]=_0x26525b[_0x6d98('0x25')];this[_0x6d98('0x26')]=_0x26525b[_0x6d98('0x26')];this[_0x6d98('0x27')]=_0x26525b[_0x6d98('0x27')];this[_0x6d98('0x28')]=config[_0x6d98('0x28')]||0x2;this[_0x6d98('0x29')]={};this[_0x6d98('0x2a')]={};this[_0x6d98('0x2b')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x6d98('0x2c')]={};this[_0x6d98('0x2d')]={};this[_0x6d98('0x2e')]={};this[_0x6d98('0x2f')]={};this['queueBookedRR']={};ami['on'](_0x6d98('0x30'),this[_0x6d98('0x31')][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x33'),this['syncQueueCallerAbandon'][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x34'),this['syncOriginateResponse'][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x35'),this['syncAgentComplete'][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x36'),this[_0x6d98('0xb')][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x37'),this[_0x6d98('0x38')][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x39'),this[_0x6d98('0x3a')][_0x6d98('0x32')](this));ami['on']('newexten',this[_0x6d98('0x3b')][_0x6d98('0x32')](this));ami['on']('varset',this[_0x6d98('0x3c')][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x3d'),this[_0x6d98('0x3e')][_0x6d98('0x32')](this));ami['on'](_0x6d98('0x3f'),this[_0x6d98('0x40')][_0x6d98('0x32')](this));this[_0x6d98('0x41')]();this[_0x6d98('0x42')]();RpcSetting[_0x6d98('0x43')]()[_0x6d98('0x44')](function(_0x206ef4){previewRecallmeReminderInterval=_0x206ef4['previewRecallmeReminderInterval'];});}function isNotNull(_0x304699){return _0x304699!==null&&!_[_0x6d98('0x45')](_0x304699);}function checkIsLoggedIn(_0x286f72,_0xe4e494){return function(){if(_0xe4e494<=0x0){_0x286f72[_0x6d98('0x46')]=_0x6d98('0x47');throw _0x286f72[_0x6d98('0x48')]+_0x6d98('0x49');}};}function isActive(_0x50a3e1){return _0x50a3e1;}function checkIsActive(_0x19ba3a,_0xefefaa){return function(){if(!isActive(_0xefefaa)){_0x19ba3a[_0x6d98('0x46')]='NOT_ACTIVE';throw _0x19ba3a['name']+'\x20NOT\x20Active';}};}function checkInterval(_0xd93319){return function(){if(!isNotNull(_0xd93319[_0x6d98('0x4a')])){_0xd93319[_0x6d98('0x46')]='INTERVAL_IS_NULL';throw _0xd93319[_0x6d98('0x48')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0xd93319[_0x6d98('0x4a')][_0x6d98('0x4b')])){_0xd93319[_0x6d98('0x46')]='INTERVAL_IS_NULL';throw _0xd93319[_0x6d98('0x48')]+_0x6d98('0x4c');}if(!isNotNull(_[_0x6d98('0x4d')](_0xd93319['Interval']['Intervals']))){_0xd93319[_0x6d98('0x46')]=_0x6d98('0x4e');throw _0xd93319['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x3afce2,_0x52b8d9,_0x54779b){return{'action':_0x3afce2,'response':_0x52b8d9,'message':_0x54779b,'stack':_0x54779b};}function myreject(_0x25c490){return function(_0x20c4e3){return _0x25c490(msgResponse(_0x6d98('0x4f'),'Error',JSON[_0x6d98('0x50')](_0x20c4e3)));};}function getSeconds(_0x1bdb1f,_0x16e71e){var _0x27c645=moment(_0x1bdb1f)[_0x6d98('0x51')](0x0);var _0x3e6d0f=moment(_0x16e71e)[_0x6d98('0x51')](0x0);return _0x27c645[_0x6d98('0x52')](_0x3e6d0f,_0x6d98('0x53'));}function emit(_0x112164,_0x339496,_0x593c33){io['to'](_0x112164)[_0x6d98('0x54')](_0x339496,_0x593c33);}function emitVoiceQueueSummary(_0x324061){if(_0x324061[_0x6d98('0x55')]===_0x6d98('0x56')){var _0x233932={'id':_0x324061['id'],'name':_0x324061[_0x6d98('0x48')],'strategy':_0x324061['strategy'],'answered':_0x324061[_0x6d98('0x57')],'available':_0x324061[_0x6d98('0x58')],'loggedIn':_0x324061[_0x6d98('0x59')],'pTalking':_0x324061[_0x6d98('0x5a')],'sumBillable':_0x324061[_0x6d98('0x5b')],'sumDuration':_0x324061['sumDuration'],'sumHoldTime':_0x324061[_0x6d98('0x5c')]||0x0,'talking':_0x324061[_0x6d98('0x5d')],'total':_0x324061['total'],'type':_0x324061[_0x6d98('0x55')],'unmanaged':_0x324061[_0x6d98('0x5e')],'abandoned':_0x324061[_0x6d98('0x5f')],'waiting':_0x324061[_0x6d98('0x60')],'loggedInDb':_0x324061[_0x6d98('0x61')],'dialActive':_0x324061[_0x6d98('0x62')],'dialMethod':_0x324061[_0x6d98('0x63')],'dialOriginateCallerIdName':_0x324061[_0x6d98('0x64')],'dialOriginateCallerIdNumber':_0x324061['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x324061[_0x6d98('0x65')],'dialPrefix':_0x324061[_0x6d98('0x66')],'outboundAnswerAgiCallsDay':_0x324061['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x324061[_0x6d98('0x67')],'outboundBlacklistCallsDay':_0x324061[_0x6d98('0x68')],'outboundBusyCallsDay':_0x324061[_0x6d98('0x69')],'outboundCongestionCallsDay':_0x324061[_0x6d98('0x6a')],'outboundDropCallsDayACS':_0x324061['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x324061[_0x6d98('0x6b')],'outboundDropCallsDayTimeout':_0x324061['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x324061[_0x6d98('0x6c')],'outboundNoSuchCallsDay':_0x324061['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x324061['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x324061[_0x6d98('0x6d')],'outboundRejectCallsDay':_0x324061['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x324061[_0x6d98('0x6e')],'predictiveIntervalAnsweredCalls':_0x324061[_0x6d98('0x6f')],'predictiveIntervalAvgHoldtime':_0x324061[_0x6d98('0x70')],'predictiveIntervalAvgTalktime':_0x324061[_0x6d98('0x71')],'predictiveIntervalDroppedCallsCallersExit':_0x324061[_0x6d98('0x72')],'predictiveIntervalDroppedCallsTimeout':_0x324061[_0x6d98('0x73')],'predictiveIntervalErlangCalls':_0x324061[_0x6d98('0x74')],'predictiveIntervalErlangCallsDroppedCalls':_0x324061[_0x6d98('0x75')],'predictiveIntervalHitRate':_0x324061[_0x6d98('0x76')],'predictiveIntervalMultiplicativeFactor':_0x324061['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x324061['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x324061[_0x6d98('0x77')],'predictiveIntervalTotalCalls':_0x324061[_0x6d98('0x78')],'message':_0x324061[_0x6d98('0x46')],'originated':_0x324061[_0x6d98('0x79')],'erlangCalls':_0x324061[_0x6d98('0x7a')],'erlangCallToSecond':_0x324061[_0x6d98('0x7b')],'erlangAbandonmentRate':_0x324061[_0x6d98('0x7c')],'erlangBusyFactor':_0x324061['erlangBusyFactor'],'startPredictive':_0x324061['startPredictive'],'startProgressive':_0x324061[_0x6d98('0x2d')]};if(_0x324061['Trunk']){_0x233932[_0x6d98('0x7d')]={'id':_0x324061[_0x6d98('0x7d')]['id'],'name':_0x324061[_0x6d98('0x7d')][_0x6d98('0x48')],'active':_0x324061[_0x6d98('0x7d')][_0x6d98('0x7e')],'callerid':_0x324061[_0x6d98('0x7d')][_0x6d98('0x7f')]};}if(_0x324061['Interval']){_0x233932[_0x6d98('0x4a')]={'id':_0x324061[_0x6d98('0x4a')]['id'],'name':_0x324061['Interval'][_0x6d98('0x48')]};}var _0x2d8efb=md5(JSON[_0x6d98('0x50')](_0x233932));if(_0x324061[_0x6d98('0x80')]!==_0x2d8efb){_0x324061['md5']=_0x2d8efb;emit(util[_0x6d98('0x81')](_0x6d98('0x82'),_0x233932[_0x6d98('0x48')]),_0x6d98('0x83'),_0x233932);}}}function emitCampaignSummary(_0x4e199e){if(_0x4e199e['type']===_0x6d98('0x84')){emit(util['format']('campaign:ivr:%s',_0x4e199e[_0x6d98('0x48')]),_0x6d98('0x85'),_0x4e199e);}}function checkGetDataPredictive(_0x54b54a){if(isNotNull(_0x54b54a)&&!_[_0x6d98('0x4d')](_0x54b54a)){loggerPredictive[_0x6d98('0x86')](_0x6d98('0x87'));loggerPredictive[_0x6d98('0x86')](_0x6d98('0x88'),_0x54b54a[_0x6d98('0x78')]);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x89'),_0x54b54a[_0x6d98('0x6f')]);loggerPredictive['info'](_0x6d98('0x8a'),_0x54b54a[_0x6d98('0x73')]);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x8b'),_0x54b54a[_0x6d98('0x72')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54b54a[_0x6d98('0x70')]);loggerPredictive['info'](_0x6d98('0x8c'),_0x54b54a[_0x6d98('0x71')]);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x8d'));if(_0x54b54a[_0x6d98('0x78')]>0x0){if(!_[_0x6d98('0x45')](_0x54b54a[_0x6d98('0x71')])&&_0x54b54a[_0x6d98('0x71')]>0x0){return!![];}loggerPredictive['info'](_0x6d98('0x8e'));if(!_[_0x6d98('0x45')](_0x54b54a[_0x6d98('0x70')])&&_0x54b54a['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x6d98('0x86')](_0x6d98('0x8f'));}else{loggerPredictive[_0x6d98('0x86')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x6d98('0x86')](_0x6d98('0x90'));}return![];}function mergeDataErlangB(_0x317fc0){return function(_0x22c01b){loggerPredictive[_0x6d98('0x86')](_0x6d98('0x91'));loggerPredictive[_0x6d98('0x86')](_0x6d98('0x92'),_0x22c01b['erlangCalls']);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x93'),_0x22c01b[_0x6d98('0x7b')]);loggerPredictive[_0x6d98('0x86')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22c01b[_0x6d98('0x7c')]);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x94'),_0x22c01b[_0x6d98('0x95')]);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x96'),_0x22c01b['erlangAbandonmentRate']);loggerPredictive['info']('---------------------------');_['merge'](_0x317fc0,_0x22c01b);};}function getDiff(_0x3fb10d){var _0xbe5524=moment()['milliseconds'](0x0);var _0x556ecd=moment(_0x3fb10d)['milliseconds'](0x0);return _0xbe5524[_0x6d98('0x52')](_0x556ecd,_0x6d98('0x53'));}function ifInterval(_0xdd92af,_0x41557a){if(_[_0x6d98('0x45')](_0x41557a)){return![];}return getDiff(_0x41557a)<_0xdd92af*0x3c;}function freeVariablesPredictive(_0x5ea3f2){if(isNotNull(_0x5ea3f2)){if(!_[_0x6d98('0x45')](_0x5ea3f2[_0x6d98('0x2d')])){_0x5ea3f2[_0x6d98('0x2d')]=undefined;loggerPredictive['info'](_0x5ea3f2[_0x6d98('0x48')],_0x6d98('0x97'));}if(!_[_0x6d98('0x45')](_0x5ea3f2[_0x6d98('0x2c')])){_0x5ea3f2[_0x6d98('0x2c')]=undefined;loggerPredictive['info'](_0x5ea3f2['name'],_0x6d98('0x98'));}if(!_['isUndefined'](_0x5ea3f2[_0x6d98('0x99')])){clearInterval(_0x5ea3f2[_0x6d98('0x99')]);_0x5ea3f2[_0x6d98('0x99')]=undefined;loggerPredictive[_0x6d98('0x86')](_0x5ea3f2['name'],_0x6d98('0x9a'));}}}function erlangb(_0x281be4,_0xcfa343){if(_0xcfa343===0x0){return 0x0;}var _0x4ef7ea=0x1;for(var _0x2fd557=0x1;_0x2fd557<=_0xcfa343;_0x2fd557+=0x1){_0x4ef7ea=0x1+_0x4ef7ea*_0x2fd557/_0x281be4;}return 0x1/_0x4ef7ea;}function isVoiceQueueOutbound(_0x1aa800){return _0x1aa800===_0x6d98('0x56');}function isNotPreview(_0x1941b9){return _0x1941b9!==_0x6d98('0x9b');}function isCampaignIvr(_0x431462){return _0x431462===_0x6d98('0x84');}function getCallerId(_0x2fccad,_0x3565c9,_0x58000f){if(!_['isUndefined'](_0x58000f)&&typeof _0x58000f===_0x6d98('0x9c')&&!_[_0x6d98('0x4d')](_0x58000f)){if(!_['isUndefined'](_0x3565c9)&&typeof _0x3565c9===_0x6d98('0x9c')&&!_[_0x6d98('0x4d')](_0x3565c9)){return util[_0x6d98('0x81')](_0x6d98('0x9d'),_0x3565c9,_0x58000f);}return util[_0x6d98('0x81')]('\x22%s\x22\x20<%s>',_0x58000f,_0x58000f);}if(!_[_0x6d98('0x45')](_0x2fccad)&&typeof _0x2fccad===_0x6d98('0x9c')&&!_[_0x6d98('0x4d')](_0x2fccad)){return _0x2fccad;}return _0x6d98('0x9e');}function loggerCatchQueueSummary(_0x4c8872,_0x4be055){return function(_0x3ffc4a){freeVariablesPredictive(_0x4be055);emitVoiceQueueSummary(_0x4be055);emitCampaignSummary(_0x4be055);loggerSyncQueueSummary['debug'](_0x4c8872,util[_0x6d98('0x9f')](_0x3ffc4a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4e0eb8,_0x143609){return function(_0x48853c){loggerPredictive[_0x6d98('0xa0')](_0x143609[_0x6d98('0x48')],_0x4e0eb8);loggerPredictive[_0x6d98('0xa0')](_0x48853c[_0x6d98('0xa1')]);freeVariablesPredictive(_0x143609);};}function loggerCatch(_0x2ef5df){return function(_0x424005){logger[_0x6d98('0xa0')](_0x2ef5df,util['inspect'](_0x424005,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x13a5ec){return _0x13a5ec&&!_[_0x6d98('0x45')](_0x13a5ec)&&_0x13a5ec[_0x6d98('0xa2')]>0x0;}function decremetOriginate(_0x480c9b){if(!_[_0x6d98('0x45')](_0x480c9b)&&_0x480c9b!==null){if(typeof _0x480c9b[_0x6d98('0x79')]!==_0x6d98('0xa3')){if(_0x480c9b[_0x6d98('0x79')]>0x0){_0x480c9b[_0x6d98('0x79')]-=0x1;}else{logger[_0x6d98('0xa0')](_0x6d98('0xa4'));}}}else{logger[_0x6d98('0xa0')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2af10e,_0x2dd3d5,_0x1b463c){if(_0x2dd3d5>_0x1b463c){for(var _0x2772d5=0x0;_0x2772d5<_0x2dd3d5-_0x1b463c;_0x2772d5+=0x1){decremetOriginate(_0x2af10e);}}}function loggerGetContactDialer(_0x3b36a9,_0x66efa8,_0x63d0b){return function(_0x1c2c7d){checkContactLowerLimitOriginate(_0x66efa8,_0x63d0b,0x0);logger['error'](_0x3b36a9,util[_0x6d98('0x9f')](_0x1c2c7d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x162009){return function(_0x47016a){if(isNotNull(_0x47016a)&&isNotNull(_0x47016a[0x0])){if(_0x47016a[0x0][_0x6d98('0xa5')]>0x0){_0x162009[_0x6d98('0x46')]='RESCHEDULED_CONTACTS';logger[_0x6d98('0x86')](_0x6d98('0xa6')+_0x162009[_0x6d98('0x48')],_0x47016a[0x0][_0x6d98('0xa5')],'contacts');}else{_0x162009[_0x6d98('0x46')]=_0x6d98('0xa7');logger[_0x6d98('0x86')]('[getContactDialer2][Empty]'+_0x162009['name']);}}};}function notSendMessagesQueue(_0x44152c){if(_0x44152c[_0x6d98('0xa8')]){freeVariablesPredictive(_0x44152c);if(_0x44152c[_0x6d98('0x79')]===0x0&&_0x44152c[_0x6d98('0x5d')]===0x0&&_0x44152c[_0x6d98('0x60')]===0x0&&(_0x44152c[_0x6d98('0x5a')]||0x0)===0x0){_0x44152c['sendMessageOneNotActive']=![];_0x44152c['available']=0x0;_0x44152c[_0x6d98('0x46')]=_0x6d98('0xa9');loggerSyncQueueSummary['debug'](_0x6d98('0xaa'),_0x44152c[_0x6d98('0x48')],_0x6d98('0xab'));}else{_0x44152c[_0x6d98('0x46')]=_0x6d98('0xac');loggerSyncQueueSummary[_0x6d98('0xad')](_0x6d98('0xaa'),_0x44152c[_0x6d98('0x48')],_0x6d98('0xae'));}emitVoiceQueueSummary(_0x44152c);}}function notSendMessagesCampaign(_0x47d80c){if(_0x47d80c[_0x6d98('0xa8')]){if(_0x47d80c[_0x6d98('0x79')]===0x0){_0x47d80c[_0x6d98('0xa8')]=![];_0x47d80c[_0x6d98('0x46')]=_0x6d98('0xa9');loggerSyncQueueSummary[_0x6d98('0xad')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x47d80c[_0x6d98('0x48')],'is\x20not\x20active');}else{_0x47d80c[_0x6d98('0x46')]=_0x6d98('0xac');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x47d80c[_0x6d98('0x48')],_0x6d98('0xae'));}emitCampaignSummary(_0x47d80c);}}function createObjHistory(_0x4dad77,_0x30e673,_0x5cad35,_0x3d76b2,_0x18e231){_0x4dad77['message']=_0x5cad35;var _0x43e181=new Action(_0x4dad77,_0x30e673);var _0x3d55a0=new History(_0x43e181);_0x3d55a0[_0x6d98('0xaf')]=_0x3d76b2;_0x3d55a0['statedesc']=_0x18e231;_0x3d55a0[_0x6d98('0xb0')]=_0x43e181[_0x6d98('0xb1')];return _0x3d55a0;}Dialer[_0x6d98('0x20')]['loopClearZombieChannels']=function(){var _0xf61ac5=this;setInterval(function(){_0xf61ac5[_0x6d98('0xb2')](_0xf61ac5['uniqueId'],'[uniqueid]');_0xf61ac5[_0x6d98('0xb2')](_0xf61ac5[_0x6d98('0x2a')],_0x6d98('0xb3'));},0x32c8);};Dialer[_0x6d98('0x20')]['clearZombieChannels']=function(_0x5cbd2c,_0x2305de){var _0x31a11e=this;for(var _0x4517b5 in _0x5cbd2c){if(typeof _0x5cbd2c[_0x4517b5]!==_0x6d98('0xa3')){this['sequence'][_0x6d98('0x21')](function(){if(!_[_0x6d98('0xb4')](_0x5cbd2c[_0x4517b5])){return ami[_0x6d98('0xb5')]({'action':_0x6d98('0xb6'),'channel':_0x5cbd2c[_0x4517b5][_0x6d98('0xb7')]})[_0x6d98('0xb8')](function(_0x14034f){if(_0x14034f['message']===_0x6d98('0xb9')){setTimeout(function(){if(_0x5cbd2c[_0x4517b5]&&_0x5cbd2c[_0x4517b5][_0x6d98('0x55')]!=='ivr'){_0x31a11e[_0x6d98('0xba')](_0x31a11e['voiceQueues'][_0x5cbd2c[_0x4517b5]['queue']]);logger[_0x6d98('0xa0')](_0x6d98('0xbb'),_0x2305de,_0x4517b5,_0x5cbd2c[_0x4517b5][_0x6d98('0xbc')]);delete _0x5cbd2c[_0x4517b5];}if(_0x5cbd2c[_0x4517b5]&&_0x5cbd2c[_0x4517b5][_0x6d98('0x55')]===_0x6d98('0x84')){_0x31a11e['updateOriginated'](_0x31a11e[_0x6d98('0x25')][_0x5cbd2c[_0x4517b5]['queue']]);logger[_0x6d98('0xa0')](_0x6d98('0xbd'),_0x2305de,_0x4517b5,_0x5cbd2c[_0x4517b5][_0x6d98('0xbc')]);delete _0x5cbd2c[_0x4517b5];}},0x2328);}});}});}}};Dialer['prototype'][_0x6d98('0xbe')]=function(_0x493935){return Promise[_0x6d98('0xbf')]()['then'](cmHopper[_0x6d98('0xbe')](_0x493935))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x6d98('0x20')]['checkIsBlackList']=function(_0x5cf66b){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopperBlack[_0x6d98('0xc0')](_0x5cf66b))['catch'](loggerCatch(_0x6d98('0xc1')));};Dialer[_0x6d98('0x20')][_0x6d98('0xc2')]=function(_0x38b4ce,_0x1753cc,_0x1d5b29){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopperAdditionalPhone[_0x6d98('0xc2')](_0x38b4ce,_0x1753cc,_0x1d5b29))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x6d98('0x20')][_0x6d98('0xc3')]=function(_0xcca1c3,_0x5a6068,_0x21a0ad){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x6d98('0xc3')](_0xcca1c3,_0x5a6068,_0x21a0ad))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xc4')));};Dialer[_0x6d98('0x20')][_0x6d98('0xc5')]=function(_0x539671){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopperBlack[_0x6d98('0xc5')](_0x539671))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xc6')));};Dialer['prototype'][_0x6d98('0xc7')]=function(_0x6ead51){return Promise[_0x6d98('0xbf')]()['then'](cmHopperHistory[_0x6d98('0xc8')](_0x6ead51))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xc9')));};Dialer[_0x6d98('0x20')][_0x6d98('0xca')]=function(_0x6718a9){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopper[_0x6d98('0xca')](_0x6718a9))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xcb')));};Dialer['prototype'][_0x6d98('0xcc')]=function(_0x2cc50d,_0x446f31,_0xf9f3b5){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopper[_0x6d98('0xcc')](_0x2cc50d,_0x446f31,_0xf9f3b5))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xcd')));};Dialer[_0x6d98('0x20')]['getContactDialer']=function(_0x50e458,_0x39989b,_0x2cc913,_0x530448,_0x3df774){return Promise['resolve']()[_0x6d98('0x44')](cmHopper[_0x6d98('0xce')](_0x50e458,_0x39989b,_0x2cc913,_0x530448))['catch'](function(_0xcf2d59){_0x3df774[_0x6d98('0xcf')]-=_0x2cc913;_0x3df774[_0x6d98('0xcf')]=_0x3df774[_0x6d98('0xcf')]>0x0?_0x3df774[_0x6d98('0xcf')]:0x0;loggerCatch(_0x6d98('0xd0'))(_0xcf2d59);});};Dialer[_0x6d98('0x20')][_0x6d98('0xd1')]=function(_0x310c8d,_0x4796d9,_0x2b50b2,_0x370204){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopper[_0x6d98('0xd1')](_0x310c8d,_0x4796d9,_0x2b50b2))['catch'](function(_0x1a2b6e){_0x370204['temp']-=_0x4796d9;_0x370204[_0x6d98('0xcf')]=_0x370204['temp']>0x0?_0x370204[_0x6d98('0xcf')]:0x0;loggerCatch(_0x6d98('0xd2'))(_0x1a2b6e);});};Dialer['prototype'][_0x6d98('0xd3')]=function(_0x161ed4){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](voiceQueueRt[_0x6d98('0xd3')](_0x161ed4))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xd4')));};Dialer[_0x6d98('0x20')][_0x6d98('0xd5')]=function(_0x329c59){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopper[_0x6d98('0xd5')](_0x329c59))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xd6')));};Dialer['prototype'][_0x6d98('0xd7')]=function(_0x2f91dc){return Promise['resolve']()['then'](cmHopperHistory[_0x6d98('0xd7')](_0x2f91dc))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xd8')));};Dialer['prototype'][_0x6d98('0xba')]=function(_0x5e5c84){if(!_[_0x6d98('0x45')](_0x5e5c84)&&_0x5e5c84!==null){if(typeof _0x5e5c84[_0x6d98('0x79')]!==_0x6d98('0xa3')){if(_0x5e5c84[_0x6d98('0x79')]>0x0){_0x5e5c84[_0x6d98('0x79')]-=0x1;}else{logger[_0x6d98('0xa0')](_0x6d98('0xd9'));}}}else{logger[_0x6d98('0xa0')](_0x6d98('0xda'));}};Dialer['prototype']['loggerHandler']=function(_0x190e8b,_0x181100){var _0x20ecf5=this;return function(_0x1cc6ae){_0x20ecf5['updateOriginated'](_0x181100);logger[_0x6d98('0xa0')](_0x190e8b,util[_0x6d98('0x9f')](_0x1cc6ae,{'showHidden':![],'depth':null}));};};Dialer[_0x6d98('0x20')][_0x6d98('0xdb')]=function(_0x4d0ae2,_0x4e30fb,_0x1249a3){var _0x4da1e4={'state':0x19,'statedesc':_0x6d98('0xdc')};this[_0x6d98('0xba')](_0x4e30fb);this[_0x6d98('0xdd')](_['merge'](_0x4da1e4,_['pick'](_0x1249a3,[_0x6d98('0xde'),_0x6d98('0xdf'),_0x6d98('0xe0'),'VoiceQueueId','CampaignId'])),_0x6d98('0xe1'),'[emptyContact]');logger[_0x6d98('0xa0')](_0x4d0ae2);};Dialer[_0x6d98('0x20')][_0x6d98('0xe2')]=function(_0x1ca20b){return _0x1ca20b===_0x6d98('0xe3');};Dialer[_0x6d98('0x20')]['isTrunkReachable']=function(_0xda9ae6){return!_[_0x6d98('0x45')](_0xda9ae6)&&_0xda9ae6&&!_[_0x6d98('0x45')](_0xda9ae6[_0x6d98('0x48')])&&!_['isUndefined'](_0xda9ae6[_0x6d98('0x7e')])&&_0xda9ae6['active']&&(this[_0x6d98('0x27')][util['format'](_0x6d98('0xe4'),_0xda9ae6[_0x6d98('0x48')])]['status']===_0x6d98('0xe5')||this[_0x6d98('0x27')][util[_0x6d98('0x81')](_0x6d98('0xe4'),_0xda9ae6['name'])][_0x6d98('0xb6')]===_0x6d98('0xe6'));};Dialer['prototype'][_0x6d98('0xdd')]=function(_0xf7c9ab,_0x4aeb02,_0x214a59){this[_0x6d98('0xd7')](_0xf7c9ab)[_0x6d98('0xb8')](loggerCatch(_0x4aeb02));this[_0x6d98('0xd5')](_0xf7c9ab)['catch'](loggerCatch(_0x214a59));};Dialer['prototype'][_0x6d98('0x3c')]=function(_0x33831c){var _0x28653e=this;var _0xaf8cbc=this[_0x6d98('0xe7')][_0x33831c[_0x6d98('0xe8')]];var _0x515c45;if(!_['isNil'](_0x33831c)&&!_[_0x6d98('0xb4')](_0x33831c['variable'])&&!_[_0x6d98('0xb4')](_0x33831c[_0x6d98('0xe9')][_0x6d98('0xea')])&&_0x33831c[_0x6d98('0xeb')]==='xcally-motion-dialer'&&_0xaf8cbc){if(_0xaf8cbc[_0x6d98('0x55')]!==_0x6d98('0x84')&&this[_0x6d98('0x24')][_0xaf8cbc[_0x6d98('0xbc')]]['dialAMDActive']&&_0x33831c[_0x6d98('0xec')]===_0x6d98('0xed')){delete this[_0x6d98('0xe7')][_0x33831c[_0x6d98('0xe8')]];this['updateOriginated'](this[_0x6d98('0x24')][_0xaf8cbc['queue']]);this[_0x6d98('0x24')][_0xaf8cbc['queue']][_0x6d98('0x67')]+=0x1;this[_0x6d98('0x24')][_0xaf8cbc['queue']][_0x6d98('0xee')]+=0x1;_0x515c45=new Hangup(_0xaf8cbc,_0x33831c);_0x515c45[_0x6d98('0xaf')]=0x12;_0x515c45[_0x6d98('0xef')]=_0x6d98('0xf0');_0x515c45[_0x6d98('0xf1')]=_0x6d98('0xf2');ami[_0x6d98('0x54')]('custom:amd',ut[_0x6d98('0xf3')](_0x515c45,_0x6d98('0xf4')));this[_0x6d98('0xdd')](_0x515c45,_0x6d98('0xf5'),_0x6d98('0xf6'));}if(_0xaf8cbc[_0x6d98('0x55')]!=='ivr'&&this[_0x6d98('0x24')][_0xaf8cbc[_0x6d98('0xbc')]][_0x6d98('0xf7')]&&_0x33831c[_0x6d98('0xec')]==='MACHINE'){return new Promise(function(_0x169235,_0xc6f97c){delete _0x28653e[_0x6d98('0xe7')][_0x33831c[_0x6d98('0xe8')]];_0x28653e[_0x6d98('0xba')](_0x28653e[_0x6d98('0x24')][_0xaf8cbc[_0x6d98('0xbc')]]);_0x28653e['voiceQueues'][_0xaf8cbc['queue']][_0x6d98('0x67')]+=0x1;_0x28653e[_0x6d98('0x24')][_0xaf8cbc[_0x6d98('0xbc')]][_0x6d98('0xee')]+=0x1;var _0x4bf8bd=_0x28653e['voiceQueues'][_0xaf8cbc['queue']];var _0x4299f5=new Hangup(_0xaf8cbc,_0x33831c);_0x4299f5['state']=0x13;_0x4299f5[_0x6d98('0xef')]=_0x6d98('0xf8');_0x4299f5['membername']=_0x6d98('0xf2');_0x4299f5[_0x6d98('0xf9')]+=0x1;_0x4299f5[_0x6d98('0xfa')]+=0x1;_0x4299f5['amd']=!![];ami[_0x6d98('0x54')](_0x6d98('0xfb'),ut[_0x6d98('0xf3')](_0x4299f5,'amd'));_0x28653e['createHistory'](_0x4299f5)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0xfc')));if(_0x4299f5[_0x6d98('0xfd')]+_0x4299f5[_0x6d98('0xfe')]+_0x4299f5[_0x6d98('0xff')]+_0x4299f5[_0x6d98('0x100')]+_0x4299f5[_0x6d98('0x101')]+_0x4299f5[_0x6d98('0x102')]+_0x4299f5['countmachineretry']+_0x4299f5[_0x6d98('0x103')]>=_0x4bf8bd[_0x6d98('0x104')]){_0x28653e[_0x6d98('0x105')](_0x4299f5,_0x169235,_0xc6f97c,_0x6d98('0x106'));}else{if(_0x4299f5[_0x6d98('0xf9')]>=_0x4bf8bd[_0x6d98('0x107')]){_0x28653e['createStateFinal'](_0x4299f5,_0x169235,_0xc6f97c,_0x6d98('0x108'));}else{_0x28653e[_0x6d98('0xca')]({'active':![],'countmachineretry':_0x4299f5[_0x6d98('0xf9')],'scheduledat':moment()[_0x6d98('0x109')](_0x4bf8bd[_0x6d98('0x10a')],_0x6d98('0x10b'))[_0x6d98('0x81')](_0x6d98('0x10c')),'ContactId':_0x4299f5['ContactId'],'ListId':_0x4299f5[_0x6d98('0xdf')],'VoiceQueueId':_0x4299f5[_0x6d98('0x10d')]||undefined,'CampaignId':_0x4299f5['CampaignId']||undefined})[_0x6d98('0xb8')](loggerCatch('[rescheduleContact][Machine]'));_0x169235({'reschedule':0x1});}}});}if(_0xaf8cbc[_0x6d98('0x55')]===_0x6d98('0x84')&&this['campaigns'][_0xaf8cbc['queue']][_0x6d98('0xf7')]&&_0x33831c[_0x6d98('0xec')]===_0x6d98('0xed')){delete this[_0x6d98('0xe7')][_0x33831c[_0x6d98('0xe8')]];this['updateOriginated'](this[_0x6d98('0x25')][_0xaf8cbc[_0x6d98('0xbc')]]);_0x515c45=new Hangup(_0xaf8cbc,_0x33831c);_0x515c45['state']=0x12;_0x515c45[_0x6d98('0xef')]=_0x6d98('0xf0');_0x515c45[_0x6d98('0xf1')]=_0x6d98('0xf2');ami[_0x6d98('0x54')](_0x6d98('0xfb'),ut[_0x6d98('0xf3')](_0x515c45,_0x6d98('0xf4')));this[_0x6d98('0xdd')](_0x515c45,_0x6d98('0x10e'),_0x6d98('0x10f'));}if(_0xaf8cbc[_0x6d98('0x55')]===_0x6d98('0x84')&&this[_0x6d98('0x25')][_0xaf8cbc['queue']][_0x6d98('0xf7')]&&_0x33831c[_0x6d98('0xec')]==='MACHINE'){return new Promise(function(_0x8e6880,_0x2262bd){delete _0x28653e[_0x6d98('0xe7')][_0x33831c[_0x6d98('0xe8')]];_0x28653e[_0x6d98('0xba')](_0x28653e[_0x6d98('0x25')][_0xaf8cbc[_0x6d98('0xbc')]]);_0x28653e[_0x6d98('0x25')][_0xaf8cbc[_0x6d98('0xbc')]]['outboundAnswerCallsDay']+=0x1;_0x28653e['campaigns'][_0xaf8cbc['queue']][_0x6d98('0xee')]+=0x1;var _0x392ead=_0x28653e[_0x6d98('0x25')][_0xaf8cbc[_0x6d98('0xbc')]];var _0x2b3282=new Hangup(_0xaf8cbc,_0x33831c);_0x2b3282[_0x6d98('0xaf')]=0x13;_0x2b3282[_0x6d98('0xef')]='Machine';_0x2b3282[_0x6d98('0xf1')]=_0x6d98('0xf2');_0x2b3282[_0x6d98('0xf9')]+=0x1;_0x2b3282[_0x6d98('0xfa')]+=0x1;_0x2b3282['amd']=!![];ami['emit'](_0x6d98('0xfb'),ut[_0x6d98('0xf3')](_0x2b3282,'amd'));_0x28653e[_0x6d98('0xd7')](_0x2b3282)['catch'](loggerCatch(_0x6d98('0xfc')));if(_0x2b3282[_0x6d98('0xfd')]+_0x2b3282[_0x6d98('0xfe')]+_0x2b3282['countnoanswerretry']+_0x2b3282[_0x6d98('0x100')]+_0x2b3282[_0x6d98('0x101')]+_0x2b3282[_0x6d98('0x102')]+_0x2b3282['countmachineretry']+_0x2b3282[_0x6d98('0x103')]>=_0x392ead[_0x6d98('0x104')]){_0x28653e[_0x6d98('0x105')](_0x2b3282,_0x8e6880,_0x2262bd,'reason19\x20machine....');}else{if(_0x2b3282[_0x6d98('0xf9')]>=_0x392ead[_0x6d98('0x107')]){_0x28653e[_0x6d98('0x110')](_0x2b3282,_0x8e6880,_0x2262bd,_0x6d98('0x108'));}else{_0x28653e[_0x6d98('0xca')]({'active':![],'countmachineretry':_0x2b3282[_0x6d98('0xf9')],'scheduledat':moment()[_0x6d98('0x109')](_0x392ead[_0x6d98('0x10a')],_0x6d98('0x10b'))[_0x6d98('0x81')](_0x6d98('0x10c')),'ContactId':_0x2b3282[_0x6d98('0xde')],'ListId':_0x2b3282[_0x6d98('0xdf')],'VoiceQueueId':_0x2b3282[_0x6d98('0x10d')]||undefined,'CampaignId':_0x2b3282[_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x112')));_0x8e6880({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x6d98('0x3a')]=function(_0x356026){var _0x3d3d53=this[_0x6d98('0xe7')][_0x356026[_0x6d98('0xe8')]];var _0x5346a0;if(_0x3d3d53&&_0x3d3d53[_0x6d98('0x55')]===_0x6d98('0x84')){delete this[_0x6d98('0xe7')][_0x356026[_0x6d98('0xe8')]];this['updateOriginated'](this[_0x6d98('0x25')][_0x3d3d53[_0x6d98('0xbc')]]);this[_0x6d98('0x25')][_0x3d3d53[_0x6d98('0xbc')]][_0x6d98('0x113')]+=0x1;_0x5346a0=new Hangup(_0x3d3d53,_0x356026);this[_0x6d98('0xd7')](_0x5346a0)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x114')));this[_0x6d98('0xd5')](_0x5346a0)[_0x6d98('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0x3d3d53&&_0x3d3d53['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x3d3d53[_0x6d98('0xbc')]][_0x6d98('0x115')])){delete this['uniqueId'][_0x356026[_0x6d98('0xe8')]];this[_0x6d98('0xba')](this[_0x6d98('0x24')][_0x3d3d53[_0x6d98('0xbc')]]);this[_0x6d98('0x24')][_0x3d3d53[_0x6d98('0xbc')]][_0x6d98('0x67')]+=0x1;this[_0x6d98('0x24')][_0x3d3d53[_0x6d98('0xbc')]][_0x6d98('0xee')]+=0x1;_0x5346a0=new Hangup(_0x3d3d53,_0x356026);_0x5346a0[_0x6d98('0xaf')]=0x10;_0x5346a0[_0x6d98('0xef')]=_0x6d98('0x116');_0x5346a0[_0x6d98('0xf1')]=_0x6d98('0x117');this[_0x6d98('0xd7')](_0x5346a0)['catch'](loggerCatch(_0x6d98('0x114')));this['moveContactManagedDialer'](_0x5346a0)['catch'](loggerCatch(_0x6d98('0x118')));}if(_0x3d3d53&&_0x3d3d53[_0x6d98('0x55')]!==_0x6d98('0x84')&&!isNotNull(this[_0x6d98('0x24')][_0x3d3d53[_0x6d98('0xbc')]]['dialQueueProject'])){delete this['uniqueId'][_0x356026['uniqueid']];this['updateOriginated'](this[_0x6d98('0x24')][_0x3d3d53[_0x6d98('0xbc')]]);this['voiceQueues'][_0x3d3d53[_0x6d98('0xbc')]][_0x6d98('0x6e')]+=0x1;_0x5346a0=new Hangup(_0x3d3d53,_0x356026);_0x5346a0[_0x6d98('0xaf')]=0xc;_0x5346a0[_0x6d98('0xef')]=_0x356026[_0x6d98('0x119')];_0x5346a0[_0x6d98('0xf1')]=_0x6d98('0x11a');this[_0x6d98('0xd7')](_0x5346a0)['catch'](loggerCatch(_0x6d98('0x114')));this['moveContactManagedDialer'](_0x5346a0)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x118')));}};Dialer[_0x6d98('0x20')][_0x6d98('0x11b')]=function(_0x38fcdb){var _0x336647=this[_0x6d98('0xe7')][_0x38fcdb['uniqueid']];if(this[_0x6d98('0x24')][_0x38fcdb['queue']]){if(_0x336647&&_0x336647[_0x6d98('0x55')]!==_0x6d98('0x84')){delete this[_0x6d98('0xe7')][_0x38fcdb[_0x6d98('0xe8')]];this['voiceQueues'][_0x38fcdb['queue']][_0x6d98('0x67')]+=0x1;var _0x365f84=new AgentComplete(_0x336647,_0x38fcdb);if(_0x38fcdb[_0x6d98('0x11c')]===_0x6d98('0x11d')){_0x365f84['agiafterat']=this[_0x6d98('0x24')][_0x38fcdb[_0x6d98('0xbc')]][_0x6d98('0x11e')]&&this[_0x6d98('0x24')][_0x38fcdb[_0x6d98('0xbc')]][_0x6d98('0x11f')]?moment()[_0x6d98('0x81')](_0x6d98('0x10c')):undefined;}this['createHistory'](_0x365f84)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x120')));this[_0x6d98('0xd5')](_0x365f84)['catch'](loggerCatch(_0x6d98('0x121')));}}};Dialer[_0x6d98('0x20')][_0x6d98('0x31')]=function(_0x2e4852){if(this[_0x6d98('0x24')][_0x2e4852[_0x6d98('0xbc')]]){if(this[_0x6d98('0xe7')][_0x2e4852[_0x6d98('0xe8')]]&&this[_0x6d98('0xe7')][_0x2e4852[_0x6d98('0xe8')]][_0x6d98('0x55')]!=='ivr'){this[_0x6d98('0xba')](this[_0x6d98('0x24')][_0x2e4852[_0x6d98('0xbc')]]);this[_0x6d98('0xe7')][_0x2e4852[_0x6d98('0xe8')]][_0x6d98('0x122')]=moment()[_0x6d98('0x81')](_0x6d98('0x10c'));}}};Dialer['prototype'][_0x6d98('0x123')]=function(_0x286233,_0x1222dc){this['createHistory'](_0x286233)[_0x6d98('0xb8')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x1222dc==0x0){this[_0x6d98('0xd5')](_0x286233)[_0x6d98('0xb8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x6d98('0x20')][_0x6d98('0x124')]=function(_0xf07f43){var _0x591e93=this['uniqueId'][_0xf07f43[_0x6d98('0xe8')]];var _0x4cd039=this;var _0x565e30=![];var _0x572fbb;var _0x3ca5cc;if(this['voiceQueues'][_0xf07f43['queue']]){if(_0x591e93&&_0x591e93['type']!==_0x6d98('0x84')){delete this[_0x6d98('0xe7')][_0xf07f43['uniqueid']];this['updateOriginated'](this[_0x6d98('0x24')][_0xf07f43['queue']]);_0x591e93[_0x6d98('0x125')]=moment()['format'](_0x6d98('0x10c'));var _0x39153e=new QueueCallerAbandon(_0x591e93,_0xf07f43);if(getSeconds(_0x591e93[_0x6d98('0x125')],_0x591e93[_0x6d98('0x126')])>=_0x591e93[_0x6d98('0x127')]){this[_0x6d98('0x24')][_0xf07f43['queue']][_0x6d98('0x73')]+=0x1;this['voiceQueues'][_0xf07f43['queue']][_0x6d98('0x128')]+=0x1;this[_0x6d98('0x24')][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x75')]+=0x1;_0x39153e[_0x6d98('0xaf')]=0xa;_0x39153e[_0x6d98('0xef')]='Drop';_0x39153e[_0x6d98('0x129')]=_0x6d98('0x12a');_0x39153e[_0x6d98('0x12b')]=this[_0x6d98('0x24')][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x11e')]?moment()['format'](_0x6d98('0x10c')):undefined;_0x39153e[_0x6d98('0x101')]+=0x1;_0x39153e[_0x6d98('0xfa')]+=0x1;_0x572fbb=this[_0x6d98('0x24')][_0xf07f43['queue']][_0x6d98('0x12c')];_0x3ca5cc=this[_0x6d98('0x24')][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x12d')];_0x4cd039[_0x6d98('0xc2')](_0x39153e,_0x39153e[_0x6d98('0xaf')],_0x591e93[_0x6d98('0x12e')])[_0x6d98('0x44')](function(_0x46fe00){_0x565e30=_0x46fe00[_0x6d98('0x12f')]==0x1;if(_0x39153e[_0x6d98('0x101')]>=_0x4cd039[_0x6d98('0x24')][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x130')]){_0x4cd039[_0x6d98('0x123')](_0x39153e,_0x46fe00[_0x6d98('0x12f')]);}else{_0x4cd039[_0x6d98('0xca')]({'active':![],'countdropretry':_0x39153e[_0x6d98('0x101')],'scheduledat':moment()[_0x6d98('0x109')](_0x4cd039['voiceQueues'][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x12c')],'minutes')[_0x6d98('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x591e93['ContactId'],'ListId':_0x591e93[_0x6d98('0xdf')],'VoiceQueueId':_0x591e93['VoiceQueueId']||undefined,'CampaignId':_0x591e93[_0x6d98('0x111')]||undefined})['catch'](loggerCatch(_0x6d98('0x131')));var _0x45dcb9=new History(_0x39153e);_0x45dcb9[_0x6d98('0xaf')]=0xa;_0x45dcb9[_0x6d98('0xef')]=_0x6d98('0x132');_0x45dcb9[_0x6d98('0xb1')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x45dcb9['endtime']=_0x45dcb9[_0x6d98('0xb1')];_0x45dcb9[_0x6d98('0x133')]=_0x39153e[_0x6d98('0x133')];_0x45dcb9[_0x6d98('0x134')]=_0x39153e[_0x6d98('0x134')];_0x4cd039[_0x6d98('0xd7')](_0x45dcb9)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x135')));}})[_0x6d98('0x44')](function(){if(_0x565e30)_0x4cd039[_0x6d98('0xc3')](_0x39153e,_0x572fbb,_0x3ca5cc)[_0x6d98('0x44')](function(){return 0x1;});});}else{this['voiceQueues'][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x72')]+=0x1;this['voiceQueues'][_0xf07f43[_0x6d98('0xbc')]]['outboundDropCallsDayCallersExit']+=0x1;_0x39153e['state']=0xb;_0x39153e['statedesc']='Abandoned';_0x39153e['dropreason']=_0x6d98('0x136');_0x39153e[_0x6d98('0x102')]+=0x1;_0x39153e['countglobal']+=0x1;_0x572fbb=this[_0x6d98('0x24')][_0xf07f43[_0x6d98('0xbc')]]['dialAbandonedRetryFrequency'];_0x3ca5cc=this[_0x6d98('0x24')][_0xf07f43[_0x6d98('0xbc')]]['callAdditionalPhoneAfterMin'];_0x4cd039[_0x6d98('0xc2')](_0x39153e,_0x39153e[_0x6d98('0xaf')],_0x591e93[_0x6d98('0x12e')])[_0x6d98('0x44')](function(_0x466d03){if(_0x39153e[_0x6d98('0x102')]>=_0x4cd039[_0x6d98('0x24')][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x137')]){_0x4cd039[_0x6d98('0x123')](_0x39153e,_0x466d03['additional']);}else{_0x4cd039[_0x6d98('0xca')]({'active':![],'countabandonedretry':_0x39153e['countabandonedretry'],'scheduledat':moment()[_0x6d98('0x109')](_0x4cd039['voiceQueues'][_0xf07f43[_0x6d98('0xbc')]][_0x6d98('0x138')],'minutes')['format'](_0x6d98('0x10c')),'ContactId':_0x591e93[_0x6d98('0xde')],'ListId':_0x591e93['ListId'],'VoiceQueueId':_0x591e93[_0x6d98('0x10d')]||undefined,'CampaignId':_0x591e93['CampaignId']||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x139')));var _0x4feec6=new History(_0x39153e);_0x4feec6[_0x6d98('0xaf')]=0xb;_0x4feec6['statedesc']='Abandoned';_0x4feec6['starttime']=moment()[_0x6d98('0x81')](_0x6d98('0x10c'));_0x4feec6[_0x6d98('0xb0')]=_0x4feec6[_0x6d98('0xb1')];_0x4feec6['calleridname']=_0x39153e[_0x6d98('0x133')];_0x4feec6[_0x6d98('0x134')]=_0x39153e['calleridnum'];_0x4cd039[_0x6d98('0xd7')](_0x4feec6)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x13a')));}})['then'](function(){if(_0x565e30)_0x4cd039[_0x6d98('0xc3')](_0x39153e,_0x572fbb,_0x3ca5cc)['then'](function(){return 0x1;});});}}}};Dialer[_0x6d98('0x20')][_0x6d98('0x3b')]=function(_0x2ca93a){if(this[_0x6d98('0x2a')][_0x2ca93a[_0x6d98('0xe8')]]){this[_0x6d98('0x2a')][_0x2ca93a[_0x6d98('0xe8')]][_0x6d98('0xb7')]=_0x2ca93a[_0x6d98('0xb7')];}if(this['uniqueId'][_0x2ca93a[_0x6d98('0xe8')]]){this['uniqueId'][_0x2ca93a[_0x6d98('0xe8')]][_0x6d98('0xb7')]=_0x2ca93a[_0x6d98('0xb7')];}};Dialer[_0x6d98('0x20')][_0x6d98('0x3e')]=function(_0x4c0002){if(strategy[this[_0x6d98('0x24')][this[_0x6d98('0x2a')][_0x4c0002[_0x6d98('0x13b')]][_0x6d98('0xbc')]][_0x6d98('0x13c')]]===_0x6d98('0x1f')){if(this['actions'][_0x4c0002['actionid']]&&_[_0x6d98('0xb4')](this[_0x6d98('0x2a')][_0x4c0002[_0x6d98('0x13b')]][_0x6d98('0x13d')])&&_0x4c0002[_0x6d98('0xb6')]==='1'&&_0x4c0002[_0x6d98('0x13e')]==='0'){if(this[_0x6d98('0x26')][_0x4c0002[_0x6d98('0x13f')]]){if(!this[_0x6d98('0x26')][_0x4c0002['stateinterface']][_0x6d98('0x13d')]){this['agents'][_0x4c0002[_0x6d98('0x13f')]][_0x6d98('0x13d')]=!![];this['actions'][_0x4c0002[_0x6d98('0x13b')]][_0x6d98('0x13d')]=!![];this[_0x6d98('0x2a')][_0x4c0002[_0x6d98('0x13b')]][_0x6d98('0x13f')]=_0x4c0002[_0x6d98('0x13f')];}}}}else if((strategy[this[_0x6d98('0x24')][this['actions'][_0x4c0002[_0x6d98('0x13b')]][_0x6d98('0xbc')]][_0x6d98('0x13c')]]||_0x6d98('0x1e'))===_0x6d98('0x1e')){if(this['actions'][_0x4c0002[_0x6d98('0x13b')]]){if(this[_0x6d98('0x26')][_0x4c0002[_0x6d98('0x13f')]]){this[_0x6d98('0x2a')][_0x4c0002[_0x6d98('0x13b')]][_0x6d98('0x13f')]=_0x4c0002[_0x6d98('0x13f')];if(_[_0x6d98('0xb4')](this[_0x6d98('0x2f')][this[_0x6d98('0x2a')][_0x4c0002[_0x6d98('0x13b')]][_0x6d98('0xbc')]])){this[_0x6d98('0x2f')][this[_0x6d98('0x2a')][_0x4c0002['actionid']][_0x6d98('0xbc')]]=[];}this[_0x6d98('0x2f')][this[_0x6d98('0x2a')][_0x4c0002[_0x6d98('0x13b')]]['queue']]['push'](_['merge'](_[_0x6d98('0x140')](this[_0x6d98('0x2a')][_0x4c0002[_0x6d98('0x13b')]],[_0x6d98('0x141'),_0x6d98('0x13f')]),{'status':_0x4c0002[_0x6d98('0xb6')],'paused':_0x4c0002[_0x6d98('0x13e')]}));}}}};function unlockQueueStatus(_0x2e0513,_0x571f91){setTimeout(function(){if(_[_0x6d98('0x45')](_0x2e0513[_0x6d98('0x142')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x571f91);}_0x2e0513['queueStatusComplete']=!![];loggerBooked[_0x6d98('0x86')]('[booked][unlockQueueStatus]',_0x571f91,JSON['stringify'](_['pick'](_0x2e0513,['name','queueStatusComplete'])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x2dcecb){var _0x3892b2=this;var _0x222207=_0x3892b2[_0x6d98('0x24')][_0x3892b2[_0x6d98('0x2a')][_0x2dcecb['actionid']][_0x6d98('0xbc')]];if(strategy[this[_0x6d98('0x24')][this[_0x6d98('0x2a')][_0x2dcecb['actionid']][_0x6d98('0xbc')]]['strategy']]===_0x6d98('0x1f')){if(this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]]&&this[_0x6d98('0x2a')][_0x2dcecb['actionid']]['stateinterface']){this[_0x6d98('0x9b')][_0x6d98('0x143')](this[_0x6d98('0x2a')][_0x2dcecb['actionid']][_0x6d98('0x141')],this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0x13f')])['catch'](function(_0x7f5a6f){logger[_0x6d98('0xa0')](_0x6d98('0x144'),util[_0x6d98('0x9f')](_0x7f5a6f,{'showHidden':![],'depth':null}));})[_0x6d98('0x23')](function(){_0x3892b2['updateOriginated'](_0x3892b2[_0x6d98('0x24')][_0x3892b2['actions'][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]]);_0x3892b2[_0x6d98('0x26')][_0x3892b2[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0x13f')]][_0x6d98('0x13d')]=![];delete _0x3892b2[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]];unlockQueueStatus(_0x222207);});}else{this[_0x6d98('0xba')](this['voiceQueues'][this['actions'][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xde')],'ListId':this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xdf')],'VoiceQueueId':this['actions'][_0x2dcecb[_0x6d98('0x13b')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x145')));delete this[_0x6d98('0x2a')][_0x2dcecb['actionid']];unlockQueueStatus(_0x222207);}}else if((strategy[this[_0x6d98('0x24')][this[_0x6d98('0x2a')][_0x2dcecb['actionid']]['queue']][_0x6d98('0x13c')]]||_0x6d98('0x1e'))===_0x6d98('0x1e')){var _0x35d5eb;if(this[_0x6d98('0x2a')][_0x2dcecb['actionid']]&&!_[_0x6d98('0x4d')](this[_0x6d98('0x2f')][this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]])){if(this[_0x6d98('0x146')][_0x3892b2[_0x6d98('0x2a')][_0x2dcecb['actionid']][_0x6d98('0xbc')]]){this[_0x6d98('0x146')][_0x3892b2[_0x6d98('0x2a')][_0x2dcecb['actionid']][_0x6d98('0xbc')]]=this['queueBookedRR'][this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]]?this['queueBookedRR'][this['actions'][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]]:this[_0x6d98('0x2f')][this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]]?this[_0x6d98('0x2f')][this[_0x6d98('0x2a')][_0x2dcecb['actionid']][_0x6d98('0xbc')]][_0x6d98('0x147')]||0x0:0x0;}this['queueBooked'][this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]][_0x6d98('0x147')]=this[_0x6d98('0x146')][this[_0x6d98('0x2a')][_0x2dcecb[_0x6d98('0x13b')]][_0x6d98('0xbc')]];for(var _0x1500da=0x0;_0x1500da=0x0;})[_0x6d98('0xb8')](myreject(_0x2b8fb5)));}}else{_0x3ccab7[_0x6d98('0x160')](ami['Action']({'action':_0x6d98('0x161'),'command':util['format']('iftime\x20%s,%s',_0x3cad67,!_['isUndefined'](config[_0x6d98('0x163')][_0x40b22c])?_0x40b22c:'')})[_0x6d98('0x44')](function(_0x32af4c){return _0x32af4c['content'][_0x6d98('0x164')]('true')>=0x0;})[_0x6d98('0xb8')](myreject(_0x2b8fb5)));}Promise[_0x6d98('0x165')](_0x3ccab7)[_0x6d98('0x44')](function(_0x22b6d8){var _0x97e336=_[_0x6d98('0x166')](_0x22b6d8);if(_0x97e336){return _0x2dc89e(_0x97e336);}else{_0x206fe4[_0x6d98('0x46')]=_0x58b4dd?_0x6d98('0x167'):_0x6d98('0x168');return _0x2b8fb5(msgResponse(_0x6d98('0x169'),'Failure',_0x6d98('0x16a')+_0x58b4dd+'\x20'+_0x17d532+_0x6d98('0x16b')+util['inspect'](_0x3cad67,{'showHidden':![],'depth':null})+_0x6d98('0x16c')+_0x40b22c));}})[_0x6d98('0xb8')](function(_0x4f348f){return _0x2b8fb5(msgResponse(_0x6d98('0x158'),'Failure',JSON['stringify'](_0x4f348f)));});});};Dialer['prototype']['checkDialMethod']=function(_0x4c36ae){var _0x419b40=this;return function(){switch(_0x4c36ae[_0x6d98('0x63')]){case _0x6d98('0x16d'):freeVariablesPredictive(_0x4c36ae);_0x419b40['handlePower'](_0x4c36ae,0x1);break;case _0x6d98('0x16e'):freeVariablesPredictive(_0x4c36ae);_0x419b40[_0x6d98('0x16f')](_0x4c36ae,_0x4c36ae[_0x6d98('0x170')]);break;case _0x6d98('0x171'):_0x419b40[_0x6d98('0x171')](_0x4c36ae);break;case _0x6d98('0x9'):freeVariablesPredictive(_0x4c36ae);_0x419b40[_0x6d98('0x16f')](_0x4c36ae,0x1);break;default:freeVariablesPredictive(_0x4c36ae);logger[_0x6d98('0xa0')](_0x6d98('0x172'),_0x4c36ae[_0x6d98('0x48')],'method\x20not\x20recognized');}};};Dialer['prototype'][_0x6d98('0x173')]=function(_0x2384b6){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopper[_0x6d98('0x174')](_0x2384b6['id'],previewRecallmeReminderInterval))['then'](function(_0x265ebf){for(var _0x41251d=0x0;_0x41251d<_0x265ebf[_0x6d98('0xa2')];_0x41251d++){var _0x517c80=_0x265ebf[_0x41251d][_0x6d98('0x175')][_0x6d98('0x48')];if(_0x517c80)io['to'](util['format'](_0x6d98('0x176'),_0x517c80))[_0x6d98('0x54')]('user:dialPreviewRecallReminder',{'hopper':_0x265ebf[_0x41251d]});}})['catch'](function(){});};Dialer[_0x6d98('0x20')][_0x6d98('0x177')]=function(_0x13d435){var _0x4a8a4b=this;return function(){_0x4a8a4b[_0x6d98('0x178')](_0x13d435);};};Dialer[_0x6d98('0x20')][_0x6d98('0xb')]=function(_0x1b5bf4){var _0x1fc25e=this;if(isNotPreview(_0x1b5bf4[_0x6d98('0x63')])){if(isVoiceQueueOutbound(_0x1b5bf4['type'])&&isActive(_0x1b5bf4[_0x6d98('0x62')])){_0x1b5bf4[_0x6d98('0xa8')]=!![];Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](checkIsLoggedIn(_0x1b5bf4,_0x1b5bf4[_0x6d98('0x59')]))[_0x6d98('0x44')](checkIsActive(_0x1b5bf4,_0x1b5bf4['dialActive']))[_0x6d98('0x44')](checkInterval(_0x1b5bf4))[_0x6d98('0x44')](_0x1fc25e[_0x6d98('0x153')](_0x1b5bf4))['then'](_0x1fc25e['checkIfTime'](_0x1b5bf4['dialGlobalInterval'],_0x1b5bf4['dialTimezone'],_0x1b5bf4[_0x6d98('0x48')],_0x1b5bf4))[_0x6d98('0x44')](_0x1fc25e[_0x6d98('0x159')](_0x1b5bf4[_0x6d98('0x4a')],_0x1b5bf4[_0x6d98('0x179')],_0x1b5bf4[_0x6d98('0x48')],_0x1b5bf4))['then'](_0x1fc25e[_0x6d98('0x17a')](_0x1b5bf4))['catch'](loggerCatchQueueSummary(_0x6d98('0x17b'),_0x1b5bf4));}else{notSendMessagesQueue(_0x1b5bf4);}}else{freeVariablesPredictive(_0x1b5bf4);}};Dialer['prototype']['syncQueueSummaryComplete']=_[_0x6d98('0x17c')](function(){var _0x3669f7=_[_0x6d98('0x17d')](this[_0x6d98('0x24')],function(_0x194e8b){return _0x194e8b['dialPreviewRecallmeReminder'];});var _0x19ce4b=_[_0x6d98('0x17d')](this[_0x6d98('0x26')],function(_0x15df26){return _0x15df26['online']&&_0x15df26[_0x6d98('0xb6')]===_0x6d98('0xe5');});if(_0x3669f7[_0x6d98('0xa2')]>0x0&&_0x19ce4b[_0x6d98('0xa2')]>0x0){return Promise[_0x6d98('0xbf')]()[_0x6d98('0x44')](cmHopper['handlePreviewRecallNotifications'](_[_0x6d98('0x17e')](_0x3669f7,'id'),previewRecallmeReminderInterval,_[_0x6d98('0x17e')](_0x19ce4b,'id')))['then'](function(_0xa42364){for(var _0x2cbfbc=0x0;_0x2cbfbc<_0xa42364['length'];_0x2cbfbc++){var _0x1eaace=_0xa42364[_0x2cbfbc][_0x6d98('0x175')][_0x6d98('0x48')];if(_0x1eaace)io['to'](util[_0x6d98('0x81')](_0x6d98('0x176'),_0x1eaace))['emit'](_0x6d98('0x17f'),{'hopper':_0xa42364[_0x2cbfbc]});}})[_0x6d98('0xb8')](function(_0x35e577){logger[_0x6d98('0xa0')]('checkPreviewRecallReminder',_0x35e577);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x6d98('0x20')][_0x6d98('0x180')]=function(){var _0x39d78c=this;var _0x3f130e;for(var _0x232e64 in this[_0x6d98('0x25')]){if(typeof this['campaigns'][_0x232e64]!==_0x6d98('0xa3')){_0x3f130e=this[_0x6d98('0x25')][_0x232e64];if(isCampaignIvr(_0x3f130e[_0x6d98('0x55')])&&isActive(_0x3f130e[_0x6d98('0x7e')])){_0x3f130e['sendMessageOneNotActive']=!![];Promise[_0x6d98('0xbf')]()['then'](checkIsActive(_0x3f130e,_0x3f130e[_0x6d98('0x7e')]))[_0x6d98('0x44')](checkInterval(_0x3f130e))[_0x6d98('0x44')](_0x39d78c[_0x6d98('0x153')](_0x3f130e))[_0x6d98('0x44')](_0x39d78c[_0x6d98('0x157')](_0x3f130e[_0x6d98('0x181')],_0x3f130e['dialTimezone'],_0x3f130e[_0x6d98('0x48')],_0x3f130e))[_0x6d98('0x44')](_0x39d78c[_0x6d98('0x159')](_0x3f130e[_0x6d98('0x4a')],_0x3f130e[_0x6d98('0x179')],_0x3f130e[_0x6d98('0x48')],_0x3f130e))[_0x6d98('0x44')](_0x39d78c['launchHandleIvr'](_0x3f130e))[_0x6d98('0xb8')](loggerCatchQueueSummary('[syncCampaigns]',_0x3f130e));}else{notSendMessagesCampaign(_0x3f130e);}}}};function getCallerIdRandom(_0x299bb3,_0x57ff00){var _0xf81876;var _0x2ea52a;var _0x1425d4;if(_0x57ff00<=0x0){_0x57ff00=0x1;}_0xf81876=new RegExp('\x5cw{0,'+_0x57ff00+'}$');_0x2ea52a=Math[_0x6d98('0x182')](0xa,_0x57ff00-0x1);_0x1425d4=Math[_0x6d98('0x182')](0xa,_0x57ff00)-0x1;return util[_0x6d98('0x81')]('%s',_[_0x6d98('0x183')](_0x299bb3,_0xf81876,_[_0x6d98('0x184')](_0x2ea52a,_0x1425d4)));}function extractCalleridName(_0xc2777f){var _0x4b4b37=_0xc2777f['match'](/"(.*?)"/);return _0x4b4b37?_0x4b4b37[0x1]:_0xc2777f;}Dialer['prototype'][_0x6d98('0x185')]=function(_0xc68554,_0x17bed5){var _0x1e709a=this;var _0x349bae=uuid['v4']();this[_0x6d98('0x2a')][_0x349bae]=new Action(_0xc68554,_0x17bed5,_0x349bae);return new Promise(function(_0x1d648f,_0x491095){if(_[_0x6d98('0x45')](_0xc68554)&&typeof _0xc68554!=='object'){return _0x491095(msgResponse(_0x6d98('0x186'),_0x6d98('0x15c'),_0x6d98('0x187')));}if(_[_0x6d98('0x45')](_0x17bed5[_0x6d98('0x188')])||_0x17bed5[_0x6d98('0x188')]===null){return _0x491095(msgResponse(_0x6d98('0x186'),_0x6d98('0x15c'),_0x6d98('0x189')));}var _0x47f075={'XMD-CALLERID':_0x1e709a[_0x6d98('0x2a')][_0x349bae]['getCaller'](),'XMD-AGI':_0xc68554[_0x6d98('0x115')]?util[_0x6d98('0x81')](_0x6d98('0x18a'),ipAgi,_0xc68554[_0x6d98('0x115')]):_0x6d98('0x18b'),'XMD-AGIAFTER':_0xc68554['dialQueueProject2']?util[_0x6d98('0x81')](_0x6d98('0x18a'),ipAgi,_0xc68554[_0x6d98('0x11e')]):_0x6d98('0x18b'),'XMD-QUEUE':_0xc68554['type']==='outbound'?util[_0x6d98('0x81')](_0x6d98('0x18c'),_0xc68554[_0x6d98('0x48')],_0xc68554[_0x6d98('0x18d')]||'',_0xc68554[_0x6d98('0x11f')]?'c':'',_0xc68554[_0x6d98('0x127')]||0x3):_0x6d98('0x18b'),'XMD-CONTACTID':_0x17bed5[_0x6d98('0xde')],'XMD-CDRTYPE':_0x6d98('0x8'),'CALLERID(all)':_0x1e709a[_0x6d98('0x2a')][_0x349bae][_0x6d98('0x18e')](),'XMD-AMD':_0xc68554[_0x6d98('0xf7')]?_0x6d98('0x18f'):_0x6d98('0x18b'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xc68554['dialAMDActive']){_0x47f075[_0x6d98('0x190')]=_0xc68554[_0x6d98('0x191')]||0x9c4;_0x47f075[_0x6d98('0x192')]=_0xc68554[_0x6d98('0x193')]||0x5dc;_0x47f075[_0x6d98('0x194')]=_0xc68554[_0x6d98('0x195')]||0x320;_0x47f075[_0x6d98('0x196')]=_0xc68554['dialAMDTotalAnalysisTime']||0x1388;_0x47f075[_0x6d98('0x197')]=_0xc68554[_0x6d98('0x198')]||0x64;_0x47f075[_0x6d98('0x199')]=_0xc68554[_0x6d98('0x19a')]||0x32;_0x47f075[_0x6d98('0x19b')]=_0xc68554[_0x6d98('0x19c')]||0x3;_0x47f075[_0x6d98('0x19d')]=_0xc68554[_0x6d98('0x19e')]||0x100;_0x47f075[_0x6d98('0x19f')]=_0xc68554[_0x6d98('0x1a0')]||0x1388;}if(_0xc68554[_0x6d98('0x55')]==='outbound'){_0x47f075[_0x6d98('0x1a1')]=_0x17bed5[_0x6d98('0x10d')];}else{_0x47f075[_0x6d98('0x1a2')]=_0x17bed5[_0x6d98('0x111')];}for(var _0x25cf77 in _0x17bed5['Contact']){if(typeof _0x17bed5['Contact'][_0x25cf77]!=='undefined'){if(isNotNull(_0x17bed5[_0x6d98('0x1a3')][_0x25cf77])&&_0x25cf77!=='id'&&_0x25cf77!==_0x6d98('0x1a4')&&_0x25cf77!==_0x6d98('0x1a5')&&_0x25cf77!==_0x6d98('0x1a6')){_0x47f075[util[_0x6d98('0x81')](_0x6d98('0x1a7'),_0x6d98('0x1a8'),_['toUpper'](_0x25cf77))]=_0x17bed5['Contact'][_0x25cf77];}}}var _0xcc71dd=_0x1e709a['isTrunkReachable'](_0xc68554[_0x6d98('0x7d')])?getCallerId(_0xc68554[_0x6d98('0x7d')][_0x6d98('0x7f')],_0xc68554[_0x6d98('0x64')],_0xc68554[_0x6d98('0x1a9')]>0x0?getCallerIdRandom(_0xc68554['dialOriginateCallerIdNumber'],_0xc68554[_0x6d98('0x1a9')]):_0xc68554['dialOriginateCallerIdNumber']):getCallerId(_[_0x6d98('0xb4')](_0xc68554[_0x6d98('0x1aa')])?_0xc68554['Trunk'][_0x6d98('0x7f')]:_0xc68554['TrunkBackup'][_0x6d98('0x7f')],_0xc68554['dialOriginateCallerIdName'],_0xc68554[_0x6d98('0x1a9')]>0x0?getCallerIdRandom(_0xc68554[_0x6d98('0x1ab')],_0xc68554[_0x6d98('0x1a9')]):_0xc68554[_0x6d98('0x1ab')]);if(_0xcc71dd){_0x47f075[_0x6d98('0x1ac')]=_0x1e709a['actions'][_0x349bae][_0x6d98('0x1ad')]=extractCalleridName(_0xcc71dd);_0x47f075[_0x6d98('0x1ae')]=_0x17bed5[_0x6d98('0x188')];}_0xc68554['variables']=_0x47f075;return ami[_0x6d98('0xb5')]({'actionid':_0x349bae,'action':_0x6d98('0x186'),'channel':_0x1e709a[_0x6d98('0x154')](_0xc68554['Trunk'])?util[_0x6d98('0x81')](_0x6d98('0x1af'),_0xc68554['Trunk']['name'],isNotNull(_0xc68554[_0x6d98('0x66')])?_0xc68554[_0x6d98('0x66')][_0x6d98('0x1b0')]()||'':'',_0xc68554['dialCutDigit']>0x0?_0x17bed5[_0x6d98('0x188')][_0x6d98('0x1b1')](_0xc68554[_0x6d98('0x1b2')]):_0x17bed5[_0x6d98('0x188')]):util[_0x6d98('0x81')](_0x6d98('0x1af'),_[_0x6d98('0xb4')](_0xc68554['TrunkBackup'])?_0xc68554[_0x6d98('0x7d')][_0x6d98('0x48')]:_0xc68554[_0x6d98('0x1aa')][_0x6d98('0x48')],isNotNull(_0xc68554[_0x6d98('0x66')])?_0xc68554[_0x6d98('0x66')]['trim']()||'':'',_0xc68554[_0x6d98('0x1b2')]>0x0?_0x17bed5[_0x6d98('0x188')][_0x6d98('0x1b1')](_0xc68554[_0x6d98('0x1b2')]):_0x17bed5[_0x6d98('0x188')]),'callerid':_0xcc71dd,'Exten':_0x6d98('0x1b3'),'Context':_0x6d98('0x1b4'),'Priority':'1','variable':_0x47f075,'timeout':(_0xc68554['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x349bae})[_0x6d98('0x44')](function(_0x22c34a){return _0x1d648f(_0x22c34a);})[_0x6d98('0xb8')](function(_0x18622e){_0xc68554['outboundOriginateFailureCallsDay']+=0x1;var _0xc612a6=new History(_0x1e709a[_0x6d98('0x2a')][_0x349bae]);logger[_0x6d98('0xa0')](util['format'](_0x6d98('0x1b5'),JSON[_0x6d98('0x50')](_0x18622e)));_0xc612a6[_0x6d98('0xaf')]=0xe;_0xc612a6[_0x6d98('0xef')]=_0x6d98('0x1b6');_0xc612a6[_0x6d98('0xb1')]=moment()[_0x6d98('0x81')](_0x6d98('0x10c'));_0xc612a6['endtime']=_0xc612a6[_0x6d98('0xb1')];_0x1e709a[_0x6d98('0xd7')](_0xc612a6)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x1b7')));_0x1e709a[_0x6d98('0xd5')](_0xc612a6)['catch'](loggerCatch(_0x6d98('0x1b7')))[_0x6d98('0x23')](function(){delete _0x1e709a['actions'][_0x349bae];return _0x491095(msgResponse(_0x6d98('0x186'),_0x6d98('0x1b8'),_0x6d98('0x1b9')));});});});};Dialer['prototype'][_0x6d98('0x1ba')]=function(_0x8ea90c){var _0x4f93c7=this[_0x6d98('0x2a')][_0x8ea90c['actionid']];if(_0x4f93c7){delete this[_0x6d98('0x2a')][_0x8ea90c[_0x6d98('0x13b')]];_0x4f93c7[_0x6d98('0x126')]=moment()['format'](_0x6d98('0x10c'));var _0x3918b5=_0x4f93c7['type']===_0x6d98('0x84')?this[_0x6d98('0x25')][_0x4f93c7['queue']]:this[_0x6d98('0x24')][_0x4f93c7[_0x6d98('0x1bb')]()];if(!this[_0x6d98('0xe2')](_0x8ea90c['response'])){this['updateOriginated'](_0x3918b5);return this[_0x6d98('0x1bc')](_0x4f93c7,_0x3918b5,_0x8ea90c)[_0x6d98('0xb8')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x8ea90c[_0x6d98('0xe8')]]=_0x4f93c7;}};Dialer[_0x6d98('0x20')][_0x6d98('0x1bd')]=function(_0x252a9f,_0x3b75c2,_0x243ff1){var _0x2f80a9=new History(_0x3b75c2);if(_0x2f80a9[_0x6d98('0xfd')]+_0x2f80a9[_0x6d98('0xfe')]+_0x2f80a9[_0x6d98('0xff')]+_0x2f80a9['countnosuchnumberretry']+_0x2f80a9[_0x6d98('0x101')]+_0x2f80a9[_0x6d98('0x102')]+_0x2f80a9[_0x6d98('0xf9')]+_0x2f80a9[_0x6d98('0x103')]>=_0x243ff1[_0x6d98('0x104')]-0x1){return!![];}switch(_0x252a9f){case 0x3:if(_0x2f80a9[_0x6d98('0xff')]>=_0x243ff1[_0x6d98('0x1be')]-0x1){return!![];}this[_0x6d98('0xca')]({'active':![],'countnoanswerretry':_0x2f80a9[_0x6d98('0xff')]+=0x1,'scheduledat':moment()[_0x6d98('0x109')](_0x243ff1[_0x6d98('0x1bf')],_0x6d98('0x10b'))['format'](_0x6d98('0x10c')),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9[_0x6d98('0xdf')],'VoiceQueueId':_0x2f80a9['VoiceQueueId']||undefined,'CampaignId':_0x2f80a9[_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2f80a9[_0x6d98('0xfd')]>=_0x243ff1[_0x6d98('0x1c0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x2f80a9[_0x6d98('0xfd')]+=0x1,'scheduledat':moment()['add'](_0x243ff1[_0x6d98('0x1c1')],_0x6d98('0x10b'))[_0x6d98('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9[_0x6d98('0xdf')],'VoiceQueueId':_0x2f80a9[_0x6d98('0x10d')]||undefined,'CampaignId':_0x2f80a9[_0x6d98('0x111')]||undefined})['catch'](loggerCatch(_0x6d98('0x1c2')));break;case 0x8:if(_0x2f80a9[_0x6d98('0xfe')]>=_0x243ff1[_0x6d98('0x1c3')]-0x1){return!![];}this[_0x6d98('0xca')]({'active':![],'countcongestionretry':_0x2f80a9['countcongestionretry']+=0x1,'scheduledat':moment()[_0x6d98('0x109')](_0x243ff1[_0x6d98('0x1c4')],_0x6d98('0x10b'))[_0x6d98('0x81')](_0x6d98('0x10c')),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9[_0x6d98('0xdf')],'VoiceQueueId':_0x2f80a9[_0x6d98('0x10d')]||undefined,'CampaignId':_0x2f80a9[_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x1c5')));break;case 0x0:if(_0x2f80a9[_0x6d98('0x100')]>=_0x243ff1[_0x6d98('0x1c6')]-0x1){return!![];}else{this[_0x6d98('0xca')]({'active':![],'countnosuchnumberretry':_0x2f80a9['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x243ff1['dialNoSuchNumberRetryFrequency'],'minutes')['format'](_0x6d98('0x10c')),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9[_0x6d98('0xdf')],'VoiceQueueId':_0x2f80a9[_0x6d98('0x10d')]||undefined,'CampaignId':_0x2f80a9[_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2f80a9[_0x6d98('0x101')]>=_0x243ff1['dialDropMaxRetry']-0x1){return!![];}this[_0x6d98('0xca')]({'active':![],'countdropretry':_0x2f80a9['countdropretry']+=0x1,'scheduledat':moment()[_0x6d98('0x109')](_0x243ff1[_0x6d98('0x12c')],_0x6d98('0x10b'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9['ListId'],'VoiceQueueId':_0x2f80a9[_0x6d98('0x10d')]||undefined,'CampaignId':_0x2f80a9[_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x131')));break;case 0xb:if(_0x2f80a9[_0x6d98('0x102')]>=_0x243ff1['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x6d98('0xca')]({'active':![],'countabandonedretry':_0x2f80a9[_0x6d98('0x102')]+=0x1,'scheduledat':moment()[_0x6d98('0x109')](_0x243ff1[_0x6d98('0x138')],'minutes')[_0x6d98('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9[_0x6d98('0xdf')],'VoiceQueueId':_0x2f80a9[_0x6d98('0x10d')]||undefined,'CampaignId':_0x2f80a9['CampaignId']||undefined})['catch'](loggerCatch(_0x6d98('0x139')));break;case 0x13:if(_0x2f80a9[_0x6d98('0xf9')]>=_0x243ff1[_0x6d98('0x107')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x2f80a9[_0x6d98('0xf9')]+=0x1,'scheduledat':moment()[_0x6d98('0x109')](_0x243ff1[_0x6d98('0x10a')],_0x6d98('0x10b'))[_0x6d98('0x81')](_0x6d98('0x10c')),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9[_0x6d98('0xdf')],'VoiceQueueId':_0x2f80a9['VoiceQueueId']||undefined,'CampaignId':_0x2f80a9[_0x6d98('0x111')]||undefined})['catch'](loggerCatch(_0x6d98('0x112')));break;case 0x14:if(_0x2f80a9[_0x6d98('0x103')]>=_0x243ff1['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x6d98('0xca')]({'active':![],'countagentrejectretry':_0x2f80a9[_0x6d98('0x103')]+=0x1,'scheduledat':moment()[_0x6d98('0x109')](_0x243ff1['dialAgentRejectRetryFrequency'],_0x6d98('0x10b'))[_0x6d98('0x81')](_0x6d98('0x10c')),'ContactId':_0x2f80a9[_0x6d98('0xde')],'ListId':_0x2f80a9[_0x6d98('0xdf')],'VoiceQueueId':_0x2f80a9[_0x6d98('0x10d')]||undefined,'CampaignId':_0x2f80a9[_0x6d98('0x111')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x1efca0,_0x41d3d2,_0x1c8071){var _0x75a4bd=this;var _0x6e571b=new History(_0x1efca0);var _0x45eb23=![];var _0x133dcd;var _0x2ee7ea;return new Promise(function(_0x270aa2,_0x14146b){if(_['isUndefined'](_0x41d3d2)&&typeof _0x41d3d2!=='object'){return _0x14146b(msgResponse('[callProgressDetecting]',_0x6d98('0x15c'),'entity\x20is\x20undefine'));}if(_[_0x6d98('0x45')](_0x1c8071)&&typeof _0x1c8071!==_0x6d98('0x1c7')){return _0x14146b(msgResponse(_0x6d98('0x1c8'),_0x6d98('0x15c'),_0x6d98('0x1c9')));}_0x75a4bd['verifyAdditionalPhones'](_0x6e571b,_0x1c8071['reason'],_0x41d3d2)[_0x6d98('0x44')](function(_0xe01e79){if(_0xe01e79[_0x6d98('0x12f')]==0x1)_0x45eb23=!![];switch(_0x1c8071[_0x6d98('0x11c')]){case'0':_0x41d3d2['outboundNoSuchCallsDay']+=0x1;_0x6e571b[_0x6d98('0xaf')]=0x0;_0x6e571b[_0x6d98('0xef')]=_0x6d98('0x1ca');_0x6e571b[_0x6d98('0x100')]+=0x1;_0x6e571b[_0x6d98('0xfa')]+=0x1;ami[_0x6d98('0x54')](_0x6d98('0x1cb'),ut[_0x6d98('0xf3')](_0x1efca0,_0x6d98('0x1cc')));_0x133dcd=_0x41d3d2[_0x6d98('0x1cd')];_0x2ee7ea=_0x41d3d2[_0x6d98('0x12d')];_0x75a4bd['createHistory'](_0x6e571b)[_0x6d98('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x75a4bd[_0x6d98('0x1bd')](0x0,_0x1efca0,_0x41d3d2)&&!_0x45eb23){if(_0x6e571b['countnosuchnumberretry']>=_0x41d3d2[_0x6d98('0x1c6')]){_0x75a4bd[_0x6d98('0x110')](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1ce'));}else{_0x75a4bd[_0x6d98('0x105')](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1ce'));}}break;case'3':_0x41d3d2[_0x6d98('0x6c')]+=0x1;_0x6e571b[_0x6d98('0xaf')]=0x3;_0x6e571b[_0x6d98('0xef')]='NoAnswer';_0x6e571b['countnoanswerretry']+=0x1;_0x6e571b[_0x6d98('0xfa')]+=0x1;var _0x540b3e=ut[_0x6d98('0x1cf')](_0x1efca0,_0x41d3d2);ami[_0x6d98('0x54')](_0x6d98('0x1d0'),_0x540b3e);_0x133dcd=_0x41d3d2[_0x6d98('0x1bf')];_0x2ee7ea=_0x41d3d2[_0x6d98('0x12d')];_0x75a4bd[_0x6d98('0xd7')](_0x6e571b)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x1d1')));if(_0x75a4bd[_0x6d98('0x1bd')](0x3,_0x1efca0,_0x41d3d2)&&!_0x45eb23){if(_0x6e571b[_0x6d98('0xff')]>=_0x41d3d2['dialNoAnswerMaxRetry']){_0x75a4bd['createStateFinal'](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1d2'));}else{_0x75a4bd['stateGlobal'](_0x6e571b,_0x270aa2,_0x14146b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x41d3d2[_0x6d98('0x69')]+=0x1;_0x6e571b['state']=0x5;_0x6e571b[_0x6d98('0xef')]=_0x6d98('0x1d3');_0x6e571b[_0x6d98('0xfd')]+=0x1;_0x6e571b[_0x6d98('0xfa')]+=0x1;ami['emit'](_0x6d98('0x1d4'),ut[_0x6d98('0xf3')](_0x1efca0,_0x6d98('0x1d5')));_0x133dcd=_0x41d3d2[_0x6d98('0x1c1')];_0x2ee7ea=_0x41d3d2['callAdditionalPhoneAfterMin'];_0x75a4bd[_0x6d98('0xd7')](_0x6e571b)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x1d6')));if(_0x75a4bd[_0x6d98('0x1bd')](0x5,_0x1efca0,_0x41d3d2)&&!_0x45eb23){if(_0x6e571b[_0x6d98('0xfd')]>=_0x41d3d2[_0x6d98('0x1c0')]){_0x75a4bd[_0x6d98('0x110')](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1d7'));}else{_0x75a4bd[_0x6d98('0x105')](_0x6e571b,_0x270aa2,_0x14146b,'reason\x205\x20busy');}}break;case'8':_0x41d3d2['outboundCongestionCallsDay']+=0x1;_0x6e571b[_0x6d98('0xaf')]=0x8;_0x6e571b[_0x6d98('0xef')]=_0x6d98('0x1d8');_0x6e571b[_0x6d98('0xfe')]+=0x1;_0x6e571b[_0x6d98('0xfa')]+=0x1;_0x133dcd=_0x41d3d2[_0x6d98('0x1c4')];_0x2ee7ea=_0x41d3d2[_0x6d98('0x12d')];ami[_0x6d98('0x54')](_0x6d98('0x1d9'),ut[_0x6d98('0xf3')](_0x1efca0,_0x6d98('0x1da')));_0x75a4bd[_0x6d98('0xd7')](_0x6e571b)[_0x6d98('0xb8')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x75a4bd[_0x6d98('0x1bd')](0x8,_0x1efca0,_0x41d3d2)&&!_0x45eb23){if(_0x6e571b[_0x6d98('0xfe')]>=_0x41d3d2[_0x6d98('0x1c3')]){_0x75a4bd[_0x6d98('0x110')](_0x6e571b,_0x270aa2,_0x14146b,'reason\x208\x20congestion');}else{_0x75a4bd[_0x6d98('0x105')](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1db'));}}break;case'11':_0x41d3d2[_0x6d98('0x1dc')]+=0x1;_0x6e571b[_0x6d98('0xaf')]=0xb;_0x6e571b[_0x6d98('0xef')]='Abandoned';_0x6e571b[_0x6d98('0x102')]+=0x1;_0x6e571b['countglobal']+=0x1;_0x133dcd=_0x41d3d2['dialAbandonedRetryFrequency'];_0x2ee7ea=_0x41d3d2[_0x6d98('0x12d')];_0x75a4bd[_0x6d98('0xd7')](_0x6e571b)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x13a')));if(_0x75a4bd[_0x6d98('0x1bd')](0xb,_0x1efca0,_0x41d3d2)&&!_0x45eb23){if(_0x6e571b[_0x6d98('0x102')]>=_0x41d3d2['dialAbandonedMaxRetry']){_0x75a4bd['createStateFinal'](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1dd'));}else{_0x75a4bd[_0x6d98('0x105')](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1dd'));}}break;case'20':_0x41d3d2[_0x6d98('0x1de')]+=0x1;_0x6e571b[_0x6d98('0xaf')]=0x14;_0x6e571b[_0x6d98('0xef')]=_0x6d98('0x1df');_0x6e571b[_0x6d98('0x103')]+=0x1;_0x6e571b[_0x6d98('0xfa')]+=0x1;_0x133dcd=_0x41d3d2[_0x6d98('0x1e0')];_0x2ee7ea=_0x41d3d2['callAdditionalPhoneAfterMin'];ami[_0x6d98('0x54')](_0x6d98('0x1e1'),ut[_0x6d98('0xf3')](_0x1efca0,_0x6d98('0x1e2')));_0x75a4bd[_0x6d98('0xd7')](_0x6e571b)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x1e3')));if(_0x75a4bd['checkRetriveMax'](0x14,_0x1efca0,_0x41d3d2)&&!_0x45eb23){if(_0x6e571b[_0x6d98('0x103')]>=_0x41d3d2[_0x6d98('0x1e4')]){_0x75a4bd['createStateFinal'](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1e5'));}else{_0x75a4bd['stateGlobal'](_0x6e571b,_0x270aa2,_0x14146b,_0x6d98('0x1e5'));}}break;default:_0x41d3d2[_0x6d98('0x6e')]+=0x1;_0x6e571b['state']=0xc;_0x6e571b[_0x6d98('0xef')]=_0x1c8071[_0x6d98('0x11c')];_0x133dcd=_0x41d3d2[_0x6d98('0x1e0')];_0x2ee7ea=_0x41d3d2[_0x6d98('0x12d')];_0x75a4bd['createHistory'](_0x6e571b)[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x1e6')));if(_0x75a4bd[_0x6d98('0x1bd')](_0x1c8071[_0x6d98('0x11c')],_0x1efca0,_0x41d3d2)&&!_0x45eb23){if(_0x6e571b['countbusyretry']+_0x6e571b['countcongestionretry']+_0x6e571b[_0x6d98('0xff')]+_0x6e571b[_0x6d98('0x100')]+_0x6e571b[_0x6d98('0x101')]+_0x6e571b[_0x6d98('0x102')]+_0x6e571b[_0x6d98('0xf9')]+_0x6e571b['countagentrejectretry']>=_0x41d3d2[_0x6d98('0x104')]){_0x75a4bd[_0x6d98('0x105')](_0x6e571b,_0x270aa2,_0x14146b,_0x1c8071['reason']);}else{_0x75a4bd[_0x6d98('0x110')](_0x6e571b,_0x270aa2,_0x14146b,_0x1c8071[_0x6d98('0x11c')]);}}}})[_0x6d98('0x44')](function(){if(_0x45eb23){_0x75a4bd[_0x6d98('0xc3')](_0x6e571b,_0x133dcd,_0x2ee7ea)[_0x6d98('0x44')](function(){return _0x270aa2(0x1);});}});});};Dialer[_0x6d98('0x20')][_0x6d98('0x105')]=function(_0x21398f,_0x530b0d,_0x4e1464,_0x3bedab){var _0x213f2c=new Final(_0x21398f);_0x213f2c[_0x6d98('0xaf')]=0xf;_0x213f2c[_0x6d98('0xef')]=_0x6d98('0x1e7');this['createStateFinal'](_0x213f2c,_0x530b0d,_0x4e1464,_0x3bedab);};Dialer[_0x6d98('0x20')][_0x6d98('0x110')]=function(_0x3927bc,_0x3bd0b7,_0x29611c,_0x19fff1){this[_0x6d98('0xd5')](_0x3927bc)[_0x6d98('0x44')](function(){return _0x3bd0b7(msgResponse(_0x6d98('0x1c8'),'Success',_0x19fff1));})['catch'](function(){return _0x29611c(msgResponse(_0x6d98('0x1e8'),_0x6d98('0x15c'),_0x6d98('0x1e9')));});};Dialer['prototype'][_0x6d98('0x171')]=function(_0x2188c9){var _0x2d44f9=_0x2188c9[_0x6d98('0x1ea')]/0x64;var _0x33d73f=_0x2188c9[_0x6d98('0x128')]/(_0x2188c9[_0x6d98('0x128')]+_0x2188c9[_0x6d98('0x67')]);var _0x5c6dec=Math[_0x6d98('0x1eb')](_0x2188c9[_0x6d98('0x77')]*(_0x2188c9[_0x6d98('0x1ec')]/0x64));var _0x378b35=Math[_0x6d98('0x1eb')](_0x2188c9[_0x6d98('0x77')]*(_0x2188c9[_0x6d98('0x1ed')]/0x64));var _0x279d77=_0x2188c9[_0x6d98('0x58')]+_0x2188c9[_0x6d98('0x5d')];var _0x4d41c8=Math[_0x6d98('0x1ee')](_0x2188c9[_0x6d98('0x7a')]*_0x2188c9[_0x6d98('0x7c')]*_0x2188c9[_0x6d98('0x76')]*_0x2188c9['predictiveIntervalMultiplicativeFactor']);if(_[_0x6d98('0x45')](_0x2188c9[_0x6d98('0x2d')])){if(!_[_0x6d98('0x45')](_0x2188c9[_0x6d98('0x2c')])){_0x2188c9[_0x6d98('0x2c')]=undefined;loggerPredictive[_0x6d98('0xa0')](_0x6d98('0x1ef'),_0x6d98('0x1f0'));}if(!_[_0x6d98('0x45')](_0x2188c9[_0x6d98('0x99')])){loggerPredictive['error'](_0x6d98('0x1ef'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2188c9[_0x6d98('0x99')]);_0x2188c9[_0x6d98('0x99')]=undefined;}_0x2188c9[_0x6d98('0x2d')]=moment()[_0x6d98('0x81')](_0x6d98('0x10c'));loggerPredictive['info'](_0x2188c9[_0x6d98('0x48')],_0x6d98('0x1f1'),_0x2188c9[_0x6d98('0x2d')]);this['handlePower'](_0x2188c9,0x1);}else if(ifInterval(_0x2188c9[_0x6d98('0x1f2')],_0x2188c9['startProgressive'])){this[_0x6d98('0x16f')](_0x2188c9,0x1);loggerPredictiveCalls[_0x6d98('0x86')]('[startMethodPredictive][StartProgressive][Loop]',_0x2188c9[_0x6d98('0x2d')],_0x2188c9['name']);_0x2188c9['erlangCalls']=0x0;_0x2188c9[_0x6d98('0x75')]=0x0;}else if(_0x2d44f9<_0x33d73f&&_0x2188c9['dialPredictiveOptimization']===_0x6d98('0x1f3')){freeVariablesPredictive(_0x2188c9);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x6d98('0x1f4'),_0x33d73f,'startProgressive',_0x2188c9[_0x6d98('0x48')]);}else if(_0x4d41c8<_0x2188c9['predictiveIntervalErlangCallsDroppedCalls']&&_0x2188c9['dialPredictiveOptimization']===_0x6d98('0x1f3')){freeVariablesPredictive(_0x2188c9);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x1f5'),_0x6d98('0x1f6'),_0x4d41c8,_0x6d98('0x1f7'),_0x2188c9['predictiveIntervalErlangCallsDroppedCalls'],_0x6d98('0x2d'),_0x2188c9[_0x6d98('0x48')]);}else if(!ifInterval(_0x2188c9[_0x6d98('0x1f2')],_0x2188c9['startProgressive'])&&_['isUndefined'](_0x2188c9['startPredictive'])&&!_['isUndefined'](_0x2188c9[_0x6d98('0x2d')])){_0x2188c9['startPredictive']=moment()[_0x6d98('0x81')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2188c9[_0x6d98('0x48')],_0x6d98('0x1f8'),_0x2188c9['startPredictive']);this[_0x6d98('0xc7')](_0x2188c9[_0x6d98('0x1f2')])['then'](this[_0x6d98('0x1f9')](_0x2188c9))['then'](mergeDataErlangB(_0x2188c9))['then'](this[_0x6d98('0x1fa')](_0x2188c9))[_0x6d98('0xb8')](loggerCatchPredictive(_0x6d98('0x1fb'),_0x2188c9));}else if(!ifInterval(_0x2188c9[_0x6d98('0x1f2')],_0x2188c9[_0x6d98('0x2c')])){_0x2188c9['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2188c9[_0x6d98('0x2c')]=moment()[_0x6d98('0x81')](_0x6d98('0x10c'));loggerPredictive[_0x6d98('0x86')](_0x2188c9[_0x6d98('0x48')],_0x6d98('0x1fc'),_0x2188c9[_0x6d98('0x2c')]);clearInterval(_0x2188c9[_0x6d98('0x99')]);_0x2188c9[_0x6d98('0x99')]=undefined;this[_0x6d98('0xc7')](_0x2188c9[_0x6d98('0x1f2')])['then'](this[_0x6d98('0x1f9')](_0x2188c9))['then'](mergeDataErlangB(_0x2188c9))[_0x6d98('0x44')](this['startMethodPredictive'](_0x2188c9))['catch'](loggerCatchPredictive(_0x6d98('0x1fd'),_0x2188c9));}else if(_0x2188c9[_0x6d98('0x77')]&&_0x279d77<_0x2188c9[_0x6d98('0x77')]-_0x378b35){freeVariablesPredictive(_0x2188c9);loggerPredictive[_0x6d98('0x86')](_0x2188c9['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x279d77,')\x20are\x20less\x20than\x20threshold\x20(',_0x2188c9[_0x6d98('0x77')],'-',_0x378b35,'=',_0x2188c9[_0x6d98('0x77')]-_0x378b35,')');}else if(_0x2188c9[_0x6d98('0x77')]&&_0x279d77>_0x2188c9[_0x6d98('0x77')]+_0x5c6dec){freeVariablesPredictive(_0x2188c9);loggerPredictive[_0x6d98('0x86')](_0x2188c9[_0x6d98('0x48')],_0x6d98('0x1fe'),_0x279d77,_0x6d98('0x1ff'),_0x2188c9['predictiveIntervalAvailable'],'+',_0x5c6dec,'=',_0x2188c9['predictiveIntervalAvailable']+_0x5c6dec,')');}};Dialer['prototype'][_0x6d98('0x1f9')]=function(_0x2e430f){var _0x212e08=this;return function(_0x31e323){return new Promise(function(_0x130f14,_0x52d4b1){_[_0x6d98('0x200')](_0x2e430f,_0x31e323[0x0]);if(checkGetDataPredictive(_0x31e323[0x0])){var _0x4c4bd6=_0x2e430f[_0x6d98('0x77')]=_0x2e430f[_0x6d98('0x5d')]+_0x2e430f[_0x6d98('0x58')];var _0x21fc31=_0x2e430f['dialPredictiveInterval']*0x3c;var _0x175192=_0x31e323[0x0][_0x6d98('0x71')]+_0x31e323[0x0][_0x6d98('0x70')];var _0x94a1e9=(_0x31e323[0x0]['predictiveIntervalAnsweredCalls']+_0x31e323[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x31e323[0x0][_0x6d98('0x72')])/_0x31e323[0x0]['predictiveIntervalTotalCalls'];_0x2e430f[_0x6d98('0x76')]=_0x94a1e9>0x0?_0x94a1e9:0x1;switch(_0x2e430f[_0x6d98('0x201')]){case _0x6d98('0x1f3'):var _0x2dd74f=_0x2e430f[_0x6d98('0x1ea')]/0x64;return _0x212e08['abandonmentRate'](_0x4c4bd6,_0x21fc31,_0x175192,_0x94a1e9,_0x2dd74f)['then'](function(_0x14f119){return _0x130f14(_0x14f119);});case'agentBusyFactor':var _0x4edcff=_0x2e430f['dialPredictiveOptimizationPercentage']/0x64;return _0x212e08['busyFactor'](_0x4c4bd6,_0x21fc31,_0x175192,_0x94a1e9,_0x4edcff)[_0x6d98('0x44')](function(_0x551285){return _0x130f14(_0x551285);});default:return _0x52d4b1(msgResponse('[getDataPredictive]',_0x6d98('0x15c'),_0x6d98('0x202')));}}else{return _0x52d4b1(msgResponse(_0x6d98('0x203'),_0x6d98('0x15c'),_0x6d98('0x204')));}});};};Dialer[_0x6d98('0x20')][_0x6d98('0x205')]=function(_0x31fe81){var _0x115e7f=this;return function(_0x1c3750){return new Promise(function(_0x37cae0,_0x12e6a5){_[_0x6d98('0x200')](_0x31fe81,_0x1c3750[0x0]);if(checkGetDataPredictive(_0x1c3750[0x0])){loggerPredictive[_0x6d98('0x86')](JSON['stringify'](_0x1c3750[0x0]));if(_0x31fe81[_0x6d98('0x201')]===_0x6d98('0x1f3')){return _0x115e7f[_0x6d98('0xd3')](_0x31fe81['id'])[_0x6d98('0x44')](function(_0x369e8b){var _0x3aef1e=_0x31fe81[_0x6d98('0x59')]-_0x369e8b[0x0][_0x6d98('0x206')];var _0x4bed50=_0x31fe81[_0x6d98('0x1f2')]*0x3c;var _0xb7ffb1=_0x1c3750[0x0][_0x6d98('0x71')]+_0x1c3750[0x0][_0x6d98('0x70')];var _0x5f3df8=(_0x1c3750[0x0][_0x6d98('0x6f')]+_0x1c3750[0x0][_0x6d98('0x73')]+_0x1c3750[0x0][_0x6d98('0x72')])/_0x1c3750[0x0]['predictiveIntervalTotalCalls'];var _0x17e034=_0x31fe81[_0x6d98('0x1ea')]/0x64;_0x31fe81[_0x6d98('0x207')]=_0x369e8b[0x0][_0x6d98('0x206')]||0x0;_0x31fe81[_0x6d98('0x76')]=_0x5f3df8>0x0?_0x5f3df8:0x1;return _0x115e7f[_0x6d98('0x208')](_0x3aef1e,_0x4bed50,_0xb7ffb1,_0x5f3df8,_0x17e034);})[_0x6d98('0x44')](function(_0x449fbc){return _0x37cae0(_0x449fbc);})[_0x6d98('0xb8')](function(_0x129674){return _0x12e6a5(msgResponse('[CatchErlangB]',_0x6d98('0x15c'),JSON[_0x6d98('0x50')](_0x129674)));});}if(_0x31fe81[_0x6d98('0x201')]==='agentBusyFactor'){return _0x115e7f[_0x6d98('0xd3')](_0x31fe81['id'])[_0x6d98('0x44')](function(_0x31b725){var _0xca99bd=_0x31fe81[_0x6d98('0x59')]-_0x31b725[0x0][_0x6d98('0x206')];var _0x2da77d=_0x31fe81['dialPredictiveInterval']*0x3c;var _0x518ec8=_0x1c3750[0x0][_0x6d98('0x71')]+_0x1c3750[0x0][_0x6d98('0x70')];var _0x298e53=(_0x1c3750[0x0][_0x6d98('0x6f')]+_0x1c3750[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1c3750[0x0][_0x6d98('0x72')])/_0x1c3750[0x0]['predictiveIntervalTotalCalls'];var _0x5b2efb=_0x31fe81[_0x6d98('0x1ea')]/0x64;_0x31fe81[_0x6d98('0x207')]=_0x31b725[0x0]['outboundQueuePauses']||0x0;_0x31fe81[_0x6d98('0x76')]=_0x298e53>0x0?_0x298e53:0x1;return _0x115e7f[_0x6d98('0x209')](_0xca99bd,_0x2da77d,_0x518ec8,_0x298e53,_0x5b2efb);})[_0x6d98('0x44')](function(_0x3507c8){return _0x37cae0(_0x3507c8);})[_0x6d98('0xb8')](function(_0x47a451){return _0x12e6a5(msgResponse(_0x6d98('0x20a'),_0x6d98('0x15c'),JSON[_0x6d98('0x50')](_0x47a451)));});}}else{return _0x12e6a5(msgResponse(_0x6d98('0x203'),'Failure',_0x6d98('0x204')));}});};};Dialer[_0x6d98('0x20')][_0x6d98('0x1fa')]=function(_0x54d503){var _0x177ef4=this;return function(){var _0x58cdf9=0x0;var _0x21988d=Math['floor'](_0x54d503['erlangCallToSecond']*0x3e8);if(_0x21988d>0x0){_0x21988d=_0x21988d<0x64?0x64:_0x21988d;loggerPredictive[_0x6d98('0x86')](_0x54d503[_0x6d98('0x48')],_0x6d98('0x20b'),_0x21988d,_0x6d98('0x51'));_0x54d503[_0x6d98('0x99')]=setInterval(function(){_0x177ef4[_0x6d98('0x99')](_0x54d503);loggerPredictiveCalls[_0x6d98('0x86')]('[handlePredictive]',_0x58cdf9+=0x1);},_0x21988d);}else{loggerPredictive[_0x6d98('0x86')](_0x54d503['name'],_0x6d98('0x20c'));}};};Dialer[_0x6d98('0x20')][_0x6d98('0x20d')]=function(_0xe4c461,_0x1b8739){var _0x2ce6f6=this;return function(_0x2c743e){if(_[_0x6d98('0x4d')](_0x2c743e)){if(_[_0x6d98('0xb4')](_0x1b8739[_0x6d98('0xe0')])||!_0x1b8739[_0x6d98('0x20e')]){if(_0xe4c461[_0x6d98('0x63')]===_0x6d98('0x9')){_0xe4c461['queueStatusComplete']=_['isUndefined'](_0xe4c461[_0x6d98('0x142')])?!![]:_0xe4c461[_0x6d98('0x142')];var _0x2cdf37=uuid['v4']();_0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37]=new Action(_0xe4c461,_0x1b8739,_0x2cdf37);loggerBooked[_0x6d98('0x86')](_0x6d98('0x20f'),_0x2cdf37,_0x6d98('0x210'),JSON[_0x6d98('0x50')](_0xe4c461[_0x6d98('0x142')]),_0x6d98('0x211'),_0xe4c461[_0x6d98('0x48')]);if(_0xe4c461[_0x6d98('0x142')]){_0xe4c461[_0x6d98('0x142')]=![];_0x2ce6f6[_0x6d98('0x2f')][_0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37][_0x6d98('0xbc')]]=[];ami['Action']({'actionid':_0x2cdf37,'action':_0x6d98('0x212'),'queue':_0xe4c461[_0x6d98('0x48')]})['catch'](function(){_0x2ce6f6[_0x6d98('0xba')](_0xe4c461);_0x2ce6f6['rescheduleContact']({'active':![],'ContactId':_0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37]['ContactId'],'ListId':_0x2ce6f6['actions'][_0x2cdf37][_0x6d98('0xdf')],'VoiceQueueId':_0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37][_0x6d98('0x10d')]||undefined,'CampaignId':_0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37]['CampaignId']||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x213')));delete _0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37];});}else{loggerBooked[_0x6d98('0x86')](_0x6d98('0x214'),JSON['stringify'](_0xe4c461[_0x6d98('0x142')]),_0x6d98('0x211'),_0xe4c461['name']);_0x2ce6f6['updateOriginated'](_0xe4c461);_0x2ce6f6[_0x6d98('0xca')]({'active':![],'ContactId':_0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37][_0x6d98('0xde')],'ListId':_0x2ce6f6['actions'][_0x2cdf37][_0x6d98('0xdf')],'VoiceQueueId':_0x2ce6f6['actions'][_0x2cdf37]['VoiceQueueId']||undefined,'CampaignId':_0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37][_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x213')));delete _0x2ce6f6[_0x6d98('0x2a')][_0x2cdf37];}}else{return _0x2ce6f6[_0x6d98('0x185')](_0xe4c461,_0x1b8739);}}else{if(getDiff(_0x1b8739[_0x6d98('0x215')])<_0xe4c461[_0x6d98('0x216')]*0x3c){if(_0x1b8739[_0x6d98('0x175')]&&!_0x1b8739[_0x6d98('0x175')]['voicePause']){_0x2ce6f6[_0x6d98('0x9b')][_0x6d98('0x143')](_0x1b8739['id'])[_0x6d98('0x23')](function(){_0x2ce6f6[_0x6d98('0xba')](_0xe4c461);});}else{_0x2ce6f6['unlockContact']({'active':![]},_0x1b8739['id'],0x1)[_0x6d98('0x23')](function(){_0x2ce6f6[_0x6d98('0xba')](_0xe4c461);});}}else{_0xe4c461[_0x6d98('0x6d')]+=0x1;_0x2ce6f6[_0x6d98('0xba')](_0xe4c461);if(_0xe4c461['dialRecallInQueue']){_0x2ce6f6[_0x6d98('0xca')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b8739['ContactId'],'ListId':_0x1b8739[_0x6d98('0xdf')],'VoiceQueueId':_0x1b8739[_0x6d98('0x10d')]||undefined,'CampaignId':_0x1b8739[_0x6d98('0x111')]||undefined})[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x217')));_0x2ce6f6['createHistory'](createObjHistory(_0xe4c461,_0x1b8739,_0x6d98('0x218'),0x17,_0x6d98('0x219')))[_0x6d98('0xb8')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2ce6f6['saveInDb'](createObjHistory(_0xe4c461,_0x1b8739,_0x6d98('0x21a'),0x16,_0x6d98('0x21b')),_0x6d98('0x21c'),'[Originate][HistoryRecallClose]');}}}}else{_0xe4c461[_0x6d98('0x68')]+=0x1;_0x2ce6f6['saveInDb'](createObjHistory(_0xe4c461,_0x1b8739,_0x6d98('0x21d'),0xd,'Blacklist'),_0x6d98('0x21e'),_0x6d98('0x21f'));throw _0x6d98('0x220');}};};Dialer['prototype'][_0x6d98('0x178')]=function(_0x3d3de3){var _0x58fa01=this;var _0x2cbbe5=_0x3d3de3['limitCalls']-_0x3d3de3[_0x6d98('0x79')]-_0x3d3de3['temp'];emitCampaignSummary(_0x3d3de3);if(_0x2cbbe5>0x0){if(_0x2cbbe5>this[_0x6d98('0x28')]){_0x2cbbe5=this['maxNumberOriginate'];}_0x3d3de3['temp']+=_0x2cbbe5;this[_0x6d98('0xd1')](_0x3d3de3['id'],_0x2cbbe5,_0x3d3de3[_0x6d98('0x221')],_0x3d3de3)[_0x6d98('0x44')](function(_0x23cc79){_0x3d3de3[_0x6d98('0xcf')]-=_0x2cbbe5;_0x3d3de3['temp']=_0x3d3de3[_0x6d98('0xcf')]>0x0?_0x3d3de3[_0x6d98('0xcf')]:0x0;if(!checkContactEmpty(_0x23cc79)){_0x3d3de3[_0x6d98('0x46')]=_0x6d98('0xa7');logger['info'](_0x6d98('0x222')+_0x3d3de3[_0x6d98('0x48')]);}else{_0x3d3de3['originated']+=_0x23cc79[_0x6d98('0xa2')];_0x3d3de3['message']='RUNNING';for(var _0x17ce9e=0x0;_0x17ce9e<_0x23cc79[_0x6d98('0xa2')];_0x17ce9e+=0x1){_0x3d3de3[_0x6d98('0x223')]+=0x1;if(_[_0x6d98('0xb4')](_0x23cc79[_0x17ce9e])||_['isNil'](_0x23cc79[_0x17ce9e][_0x6d98('0x1a3')])||_[_0x6d98('0xb4')](_0x23cc79[_0x17ce9e][_0x6d98('0x188')])){_0x58fa01[_0x6d98('0xdb')](_0x6d98('0x224'),_0x3d3de3,_0x23cc79[_0x17ce9e]);}else{_0x58fa01[_0x6d98('0xc5')](_[_0x6d98('0x140')](_0x23cc79[_0x17ce9e],[_0x6d98('0x111'),_0x6d98('0x188')]))[_0x6d98('0x44')](_0x58fa01[_0x6d98('0x20d')](_0x3d3de3,_0x23cc79[_0x17ce9e]))[_0x6d98('0xb8')](_0x58fa01[_0x6d98('0x225')](_0x6d98('0x226'),_0x3d3de3));}}}})[_0x6d98('0xb8')](loggerGetContactDialer(_0x6d98('0x227'),_0x3d3de3,_0x2cbbe5));}};Dialer[_0x6d98('0x20')][_0x6d98('0x16f')]=function(_0x1a2059,_0x1e736c){var _0x216ea0=this;var _0x1c8506=[];var _0x2cdc2c=_0x1e736c>=0x1?_0x1e736c:0x1;if(_0x1a2059[_0x6d98('0x63')]===_0x6d98('0x9')){_0x2cdc2c=0x1;}var _0x3e5f80=Math[_0x6d98('0x1ee')](_0x1a2059['available']*_0x2cdc2c)-_0x1a2059[_0x6d98('0x79')]-_0x1a2059[_0x6d98('0xcf')];emitVoiceQueueSummary(_0x1a2059);if(_0x1a2059[_0x6d98('0x228')]>0x0){var _0x114e41=_0x1a2059[_0x6d98('0x228')]-_0x1a2059[_0x6d98('0x79')]-_0x1a2059['talking']-_0x1a2059['temp']-_0x1a2059[_0x6d98('0x5a')];if(_0x3e5f80>_0x114e41){_0x3e5f80=_0x114e41;}}if(_0x3e5f80>0x0){if(_0x1a2059[_0x6d98('0x63')]===_0x6d98('0x9')){_0x3e5f80=0x1;}if(_0x3e5f80>this[_0x6d98('0x28')]){_0x3e5f80=this[_0x6d98('0x28')];}_0x1a2059['temp']+=_0x3e5f80;for(var _0xbe8c70 in this[_0x6d98('0x26')]){if(typeof this['agents'][_0xbe8c70]!==_0x6d98('0xa3')){if(this[_0x6d98('0x26')][_0xbe8c70]['state']===_0x6d98('0x229')&&this[_0x6d98('0x26')][_0xbe8c70][_0x6d98('0xb6')]===_0x6d98('0xe5')){_0x1c8506['push'](this[_0x6d98('0x26')][_0xbe8c70]['id']);}}}this[_0x6d98('0xce')](_0x1a2059['id'],_0x1c8506,_0x3e5f80,_0x1a2059[_0x6d98('0x221')],_0x1a2059)[_0x6d98('0x44')](function(_0x54602d){_0x1a2059[_0x6d98('0xcf')]-=_0x3e5f80;_0x1a2059[_0x6d98('0xcf')]=_0x1a2059[_0x6d98('0xcf')]>0x0?_0x1a2059[_0x6d98('0xcf')]:0x0;if(!checkContactEmpty(_0x54602d)){_0x216ea0[_0x6d98('0xbe')](_0x1a2059)[_0x6d98('0x44')](sendMessageReschedule(_0x1a2059))['catch'](loggerCatch(_0x6d98('0x22a')));}else{_0x1a2059[_0x6d98('0x79')]+=_0x54602d[_0x6d98('0xa2')];_0x1a2059[_0x6d98('0x46')]=_0x1a2059[_0x6d98('0x63')]==='booked'?_0x6d98('0x18f'):_0x6d98('0x22b');for(var _0x319443=0x0;_0x319443<_0x54602d[_0x6d98('0xa2')];_0x319443+=0x1){if(_[_0x6d98('0xb4')](_0x54602d[_0x319443])||_['isNil'](_0x54602d[_0x319443][_0x6d98('0x1a3')])||_[_0x6d98('0xb4')](_0x54602d[_0x319443][_0x6d98('0x188')])){_0x216ea0[_0x6d98('0xdb')](_0x6d98('0x224'),_0x1a2059,_0x54602d[_0x319443]);}else{_0x216ea0['checkIsBlackList'](_[_0x6d98('0x140')](_0x54602d[_0x319443],['VoiceQueueId',_0x6d98('0x188')]))['then'](_0x216ea0[_0x6d98('0x20d')](_0x1a2059,_0x54602d[_0x319443]))['catch'](_0x216ea0['loggerHandler'](_0x6d98('0x224'),_0x1a2059));}}}})[_0x6d98('0xb8')](loggerGetContactDialer(_0x6d98('0x22c'),_0x1a2059,_0x3e5f80));}};Dialer[_0x6d98('0x20')][_0x6d98('0x99')]=function(_0x167ced){if(_0x167ced[_0x6d98('0x228')]>0x0){var _0x522324=_0x167ced['dialLimitQueue']-_0x167ced[_0x6d98('0x79')]-_0x167ced[_0x6d98('0x5d')];if(_0x522324>0x0){this[_0x6d98('0x22d')](_0x167ced);}else{loggerPredictiveCalls[_0x6d98('0x86')](_0x6d98('0x22e'));}}else{this[_0x6d98('0x22d')](_0x167ced);}};Dialer['prototype'][_0x6d98('0x22d')]=function(_0x5d59e2){var _0x1edac8=this;var _0x44c79c=[];_0x5d59e2[_0x6d98('0x79')]+=0x1;for(var _0x1d9664 in this[_0x6d98('0x26')]){if(typeof this[_0x6d98('0x26')][_0x1d9664]!=='undefined'){if(this[_0x6d98('0x26')][_0x1d9664][_0x6d98('0xaf')]==='not_inuse'&&this[_0x6d98('0x26')][_0x1d9664]['status']===_0x6d98('0xe5')){_0x44c79c[_0x6d98('0x160')](this['agents'][_0x1d9664]['id']);}}}this['getContactDialer'](_0x5d59e2['id'],_0x44c79c,0x1,_0x5d59e2[_0x6d98('0x221')],_0x5d59e2)['then'](function(_0x28c505){if(!checkContactEmpty(_0x28c505)){checkContactLowerLimitOriginate(_0x5d59e2,0x1,0x0);_0x1edac8[_0x6d98('0xbe')](_0x5d59e2)[_0x6d98('0x44')](sendMessageReschedule(_0x5d59e2))[_0x6d98('0xb8')](loggerCatch(_0x6d98('0x22a')));}else{_0x5d59e2[_0x6d98('0x46')]=_0x6d98('0x22b');if(_[_0x6d98('0xb4')](_0x28c505[0x0])||_[_0x6d98('0xb4')](_0x28c505[0x0][_0x6d98('0x1a3')])||_[_0x6d98('0xb4')](_0x28c505[0x0][_0x6d98('0x188')])){_0x1edac8['emptyContact'](_0x6d98('0x224'),_0x5d59e2,_0x28c505[0x0]);}else{_0x1edac8['checkIsBlackList'](_[_0x6d98('0x140')](_0x28c505[0x0],['VoiceQueueId',_0x6d98('0x188')]))[_0x6d98('0x44')](_0x1edac8[_0x6d98('0x20d')](_0x5d59e2,_0x28c505[0x0]))[_0x6d98('0xb8')](_0x1edac8['loggerHandler'](_0x6d98('0x22f'),_0x5d59e2));}}})[_0x6d98('0xb8')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5d59e2,0x1));emitVoiceQueueSummary(_0x5d59e2);};Dialer['prototype']['abandonmentRate']=function(_0x3f566d,_0x6d2ba7,_0xc3e16f,_0xb2cde0,_0x166ba8,_0x3dd916){loggerPredictive[_0x6d98('0x86')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x6d98('0x86')](_0x6d98('0x230'),_0x3f566d);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x231'),_0x6d2ba7);loggerPredictive[_0x6d98('0x86')]('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',_0xc3e16f);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x232'),_0xb2cde0);loggerPredictive['info'](_0x6d98('0x233'),_0x166ba8);loggerPredictive['info'](_0x6d98('0x8d'));return new Promise(function(_0x332afa,_0x1ee1d3){if(_0x3f566d<=0x0||isNaN(_0x3f566d)){return _0x1ee1d3(msgResponse('[abandonmentRate]','Error',_0x6d98('0x234')+_0x3f566d));}if(_0xc3e16f<=0x0||isNaN(_0xc3e16f)){return _0x1ee1d3(msgResponse(_0x6d98('0x235'),'Error',_0x6d98('0x236')+_0xc3e16f));}if(_0xb2cde0<=0x0||isNaN(_0xb2cde0)){return _0x1ee1d3(msgResponse(_0x6d98('0x235'),'Error',_0x6d98('0x237')+_0xb2cde0));}if(_0x6d2ba7<=0x0||isNaN(_0x6d2ba7)){return _0x1ee1d3(msgResponse('[abandonmentRate]',_0x6d98('0x1b8'),_0x6d98('0x238')+_0x6d2ba7));}if(_0x166ba8<=0x0||isNaN(_0x166ba8)){return _0x1ee1d3(msgResponse(_0x6d98('0x235'),_0x6d98('0x1b8'),_0x6d98('0x239')+_0x166ba8));}_0x3dd916=_0x3dd916||0x0;var _0x4c344f=0x1/_0xc3e16f;var _0x550d08=0x0;var _0x53f03c=0x0;var _0x509429=0x0;var _0x24d312=0x0;for(var _0x3def1c=0x0;_0x509429<_0x166ba8;_0x3def1c+=0x1){_0x53f03c=_0x3def1c/_0x6d2ba7;_0x550d08=(_0xb2cde0*_0x53f03c+_0x3dd916)/_0x4c344f;_0x509429=erlangb(_0x550d08,_0x3f566d);_0x24d312=_0x550d08/_0x3f566d*(0x1-erlangb(_0x550d08,_0x3f566d));}return _0x332afa({'erlangCalls':_0x3def1c,'erlangCallToSecond':_0x6d2ba7/_0x3def1c,'erlangAbandonmentRate':_0x509429,'erlangBusyFactor':_0x24d312});});};Dialer['prototype'][_0x6d98('0x209')]=function(_0x35bf1a,_0x355740,_0x4f5df9,_0x198f48,_0x3c766a,_0x393cf9){loggerPredictive[_0x6d98('0x86')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x6d98('0x86')](_0x6d98('0x230'),_0x35bf1a);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x231'),_0x355740);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x23a'),_0x4f5df9);loggerPredictive[_0x6d98('0x86')]('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',_0x198f48);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x23b'),_0x3c766a);loggerPredictive[_0x6d98('0x86')](_0x6d98('0x8d'));return new Promise(function(_0x323ebf,_0x416cd9){if(_0x35bf1a<=0x0||isNaN(_0x35bf1a)){return _0x416cd9(msgResponse(_0x6d98('0x23c'),'Error','m\x20=\x20'+_0x35bf1a));}if(_0x4f5df9<=0x0||isNaN(_0x4f5df9)){return _0x416cd9(msgResponse('[busyFactor]',_0x6d98('0x1b8'),_0x6d98('0x236')+_0x4f5df9));}if(_0x198f48<=0x0||isNaN(_0x198f48)){return _0x416cd9(msgResponse(_0x6d98('0x23c'),_0x6d98('0x1b8'),_0x6d98('0x237')+_0x198f48));}if(_0x355740<=0x0||isNaN(_0x355740)){return _0x416cd9(msgResponse(_0x6d98('0x23c'),_0x6d98('0x1b8'),_0x6d98('0x238')+_0x355740));}if(_0x3c766a<=0x0||isNaN(_0x3c766a)){return _0x416cd9(msgResponse('[busyFactor]',_0x6d98('0x1b8'),_0x6d98('0x23d')+_0x3c766a));}_0x393cf9=_0x393cf9||0x0;var _0xa3fac1=0x1/_0x4f5df9;var _0x3cd0d2=0x0;var _0x5cca7b=0x0;var _0x5b4559=0x0;var _0x6e5244=0x0;for(var _0x1a08e9=0x0;_0x6e5244<_0x3c766a;_0x1a08e9+=0x1){_0x5cca7b=_0x1a08e9/_0x355740;_0x3cd0d2=(_0x198f48*_0x5cca7b+_0x393cf9)/_0xa3fac1;_0x5b4559=erlangb(_0x3cd0d2,_0x35bf1a);_0x6e5244=_0x3cd0d2/_0x35bf1a*(0x1-erlangb(_0x3cd0d2,_0x35bf1a));}return _0x323ebf({'erlangCalls':_0x1a08e9,'erlangCallToSecond':_0x355740/_0x1a08e9,'erlangAbandonmentRate':_0x5b4559,'erlangBusyFactor':_0x6e5244});});};module[_0x6d98('0x23e')]=Dialer; \ No newline at end of file +var _0xbd19=['Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','stack','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','actions','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','temp','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','loggerHandler','emptyContact','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','AMD','buildObj','[syncHangupInAMD]','MACHINE','countmachineretry','countglobal','amd','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countcongestionretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','minutes','ivrAnswerCallsDay','dialQueueProject','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','add','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','Queue','checkPreviewRecallReminder','Agent','user:dialPreviewRecallReminder','handleIvr','dialTimezone','checkIfTimeIntervals','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:%s','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outbound','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','variables','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','response','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAvgTalktime','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','ACTIVE','[getContactDialer2]','tryOriginatePredictive','not_inuse','[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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','Ts\x20=\x20','p\x20=\x20','Amax\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','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','predictive','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','strategy','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','voice_queue:save','format','campaign:save','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond'];(function(_0x4936d2,_0x2570b0){var _0x305254=function(_0xfd6025){while(--_0xfd6025){_0x4936d2['push'](_0x4936d2['shift']());}};_0x305254(++_0x2570b0);}(_0xbd19,0x192));var _0x9bd1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbd19[_0x46e363];return _0x3fb059;};'use strict';var util=require(_0x9bd1('0x0'));var _=require(_0x9bd1('0x1'));var uuid=require('uuid');var moment=require(_0x9bd1('0x2'));var rr=require('rr');var md5=require(_0x9bd1('0x3'));var Redis=require(_0x9bd1('0x4'));var ut=require(_0x9bd1('0x5'));var config=require(_0x9bd1('0x6'));var logger=require('../../../config/logger')(_0x9bd1('0x7'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require('../../../config/logger')(_0x9bd1('0x8'));var loggerPredictiveCalls=require(_0x9bd1('0x9'))(_0x9bd1('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x9bd1('0xb'));var ami=require(_0x9bd1('0xc'));config[_0x9bd1('0xd')]=_[_0x9bd1('0xe')](config[_0x9bd1('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x9bd1('0xf'))(new Redis(config[_0x9bd1('0xd')]));var cmHopper=require(_0x9bd1('0x10'));var cmHopperHistory=require(_0x9bd1('0x11'));var cmHopperAdditionalPhone=require(_0x9bd1('0x12'));var cmHopperBlack=require(_0x9bd1('0x13'));var voiceQueueRt=require(_0x9bd1('0x14'));var RpcSetting=require('../rpc/setting');var Action=require(_0x9bd1('0x15'));var History=require('./history');var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x9bd1('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0x9bd1('0x17')][_0x9bd1('0x18')]||_0x9bd1('0x19');var strategy={'rrmemory':_0x9bd1('0x1a'),'roundrobin':_0x9bd1('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9bd1('0x1c')][_0x9bd1('0x1d')]=function(_0x47e641){this[_0x9bd1('0x1e')]=this[_0x9bd1('0x1e')]?this[_0x9bd1('0x1e')][_0x9bd1('0x1f')](_0x47e641):_0x47e641();};function Dialer(_0x54a5b2,_0x281e){this[_0x9bd1('0x20')]=new Sequence();this['preview']=_0x281e;this[_0x9bd1('0x21')]=_0x54a5b2[_0x9bd1('0x21')];this[_0x9bd1('0x22')]=_0x54a5b2[_0x9bd1('0x22')];this[_0x9bd1('0x23')]=_0x54a5b2[_0x9bd1('0x23')];this[_0x9bd1('0x24')]=_0x54a5b2['trunks'];this[_0x9bd1('0x25')]=config[_0x9bd1('0x25')]||0x2;this[_0x9bd1('0x26')]={};this['actions']={};this[_0x9bd1('0x27')]={};this[_0x9bd1('0x28')]={};this[_0x9bd1('0x29')]={};this[_0x9bd1('0x2a')]={};this[_0x9bd1('0x2b')]={};this[_0x9bd1('0x2c')]={};this[_0x9bd1('0x2d')]={};this[_0x9bd1('0x2e')]={};ami['on'](_0x9bd1('0x2f'),this[_0x9bd1('0x30')]['bind'](this));ami['on'](_0x9bd1('0x31'),this[_0x9bd1('0x32')][_0x9bd1('0x33')](this));ami['on'](_0x9bd1('0x34'),this[_0x9bd1('0x35')][_0x9bd1('0x33')](this));ami['on']('agentcomplete',this[_0x9bd1('0x36')]['bind'](this));ami['on'](_0x9bd1('0x37'),this[_0x9bd1('0xb')][_0x9bd1('0x33')](this));ami['on']('custom:queuesummarycomplete',this[_0x9bd1('0x38')][_0x9bd1('0x33')](this));ami['on'](_0x9bd1('0x39'),this[_0x9bd1('0x3a')][_0x9bd1('0x33')](this));ami['on'](_0x9bd1('0x3b'),this['syncNewExten'][_0x9bd1('0x33')](this));ami['on']('varset',this[_0x9bd1('0x3c')][_0x9bd1('0x33')](this));ami['on'](_0x9bd1('0x3d'),this[_0x9bd1('0x3e')]['bind'](this));ami['on'](_0x9bd1('0x3f'),this[_0x9bd1('0x40')][_0x9bd1('0x33')](this));this[_0x9bd1('0x41')]();this[_0x9bd1('0x42')]();RpcSetting[_0x9bd1('0x43')]()[_0x9bd1('0x44')](function(_0x3090f9){previewRecallmeReminderInterval=_0x3090f9[_0x9bd1('0x45')];});}function isNotNull(_0x4b63e0){return _0x4b63e0!==null&&!_[_0x9bd1('0x46')](_0x4b63e0);}function checkIsLoggedIn(_0x35de67,_0x242b38){return function(){if(_0x242b38<=0x0){_0x35de67[_0x9bd1('0x47')]=_0x9bd1('0x48');throw _0x35de67[_0x9bd1('0x49')]+_0x9bd1('0x4a');}};}function isActive(_0x30aaad){return _0x30aaad;}function checkIsActive(_0x5ac81e,_0x4e49ba){return function(){if(!isActive(_0x4e49ba)){_0x5ac81e[_0x9bd1('0x47')]=_0x9bd1('0x4b');throw _0x5ac81e[_0x9bd1('0x49')]+_0x9bd1('0x4c');}};}function checkInterval(_0x140db6){return function(){if(!isNotNull(_0x140db6[_0x9bd1('0x4d')])){_0x140db6[_0x9bd1('0x47')]=_0x9bd1('0x4e');throw _0x140db6[_0x9bd1('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x140db6['Interval'][_0x9bd1('0x4f')])){_0x140db6[_0x9bd1('0x47')]=_0x9bd1('0x4e');throw _0x140db6[_0x9bd1('0x49')]+_0x9bd1('0x50');}if(!isNotNull(_[_0x9bd1('0x51')](_0x140db6[_0x9bd1('0x4d')][_0x9bd1('0x4f')]))){_0x140db6[_0x9bd1('0x47')]=_0x9bd1('0x4e');throw _0x140db6[_0x9bd1('0x49')]+_0x9bd1('0x50');}};}function msgResponse(_0x24155e,_0x14fd70,_0x4e6c6c){return{'action':_0x24155e,'response':_0x14fd70,'message':_0x4e6c6c,'stack':_0x4e6c6c};}function myreject(_0x1c599d){return function(_0x563944){return _0x1c599d(msgResponse(_0x9bd1('0x52'),'Error',JSON[_0x9bd1('0x53')](_0x563944)));};}function getSeconds(_0x4897fc,_0x35cdc2){var _0x261eff=moment(_0x4897fc)[_0x9bd1('0x54')](0x0);var _0x2f4eff=moment(_0x35cdc2)[_0x9bd1('0x54')](0x0);return _0x261eff[_0x9bd1('0x55')](_0x2f4eff,_0x9bd1('0x56'));}function emit(_0xbe4fc1,_0x346180,_0x4c8203){io['to'](_0xbe4fc1)[_0x9bd1('0x57')](_0x346180,_0x4c8203);}function emitVoiceQueueSummary(_0x493b32){if(_0x493b32[_0x9bd1('0x58')]==='outbound'){var _0x1e3c88={'id':_0x493b32['id'],'name':_0x493b32['name'],'strategy':_0x493b32[_0x9bd1('0x59')],'answered':_0x493b32['answered'],'available':_0x493b32['available'],'loggedIn':_0x493b32[_0x9bd1('0x5a')],'pTalking':_0x493b32[_0x9bd1('0x5b')],'sumBillable':_0x493b32[_0x9bd1('0x5c')],'sumDuration':_0x493b32['sumDuration'],'sumHoldTime':_0x493b32[_0x9bd1('0x5d')]||0x0,'talking':_0x493b32['talking'],'total':_0x493b32[_0x9bd1('0x5e')],'type':_0x493b32[_0x9bd1('0x58')],'unmanaged':_0x493b32[_0x9bd1('0x5f')],'abandoned':_0x493b32['abandoned'],'waiting':_0x493b32[_0x9bd1('0x60')],'loggedInDb':_0x493b32[_0x9bd1('0x61')],'dialActive':_0x493b32[_0x9bd1('0x62')],'dialMethod':_0x493b32[_0x9bd1('0x63')],'dialOriginateCallerIdName':_0x493b32['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x493b32[_0x9bd1('0x64')],'dialOriginateTimeout':_0x493b32[_0x9bd1('0x65')],'dialPrefix':_0x493b32[_0x9bd1('0x66')],'outboundAnswerAgiCallsDay':_0x493b32[_0x9bd1('0x67')],'outboundAnswerCallsDay':_0x493b32[_0x9bd1('0x68')],'outboundBlacklistCallsDay':_0x493b32[_0x9bd1('0x69')],'outboundBusyCallsDay':_0x493b32[_0x9bd1('0x6a')],'outboundCongestionCallsDay':_0x493b32['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x493b32[_0x9bd1('0x6b')],'outboundDropCallsDayCallersExit':_0x493b32[_0x9bd1('0x6c')],'outboundDropCallsDayTimeout':_0x493b32[_0x9bd1('0x6d')],'outboundNoAnswerCallsDay':_0x493b32[_0x9bd1('0x6e')],'outboundNoSuchCallsDay':_0x493b32[_0x9bd1('0x6f')],'outboundOriginateFailureCallsDay':_0x493b32[_0x9bd1('0x70')],'outboundReCallsDay':_0x493b32['outboundReCallsDay'],'outboundRejectCallsDay':_0x493b32[_0x9bd1('0x71')],'outboundUnknownCallsDay':_0x493b32[_0x9bd1('0x72')],'predictiveIntervalAnsweredCalls':_0x493b32[_0x9bd1('0x73')],'predictiveIntervalAvgHoldtime':_0x493b32['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x493b32['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x493b32[_0x9bd1('0x74')],'predictiveIntervalDroppedCallsTimeout':_0x493b32[_0x9bd1('0x75')],'predictiveIntervalErlangCalls':_0x493b32[_0x9bd1('0x76')],'predictiveIntervalErlangCallsDroppedCalls':_0x493b32['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x493b32[_0x9bd1('0x77')],'predictiveIntervalMultiplicativeFactor':_0x493b32[_0x9bd1('0x78')],'predictiveIntervalPauses':_0x493b32['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x493b32[_0x9bd1('0x79')],'predictiveIntervalTotalCalls':_0x493b32['predictiveIntervalTotalCalls'],'message':_0x493b32[_0x9bd1('0x47')],'originated':_0x493b32['originated'],'erlangCalls':_0x493b32[_0x9bd1('0x7a')],'erlangCallToSecond':_0x493b32['erlangCallToSecond'],'erlangAbandonmentRate':_0x493b32[_0x9bd1('0x7b')],'erlangBusyFactor':_0x493b32[_0x9bd1('0x7c')],'startPredictive':_0x493b32[_0x9bd1('0x2a')],'startProgressive':_0x493b32[_0x9bd1('0x2b')]};if(_0x493b32[_0x9bd1('0x7d')]){_0x1e3c88[_0x9bd1('0x7d')]={'id':_0x493b32[_0x9bd1('0x7d')]['id'],'name':_0x493b32[_0x9bd1('0x7d')][_0x9bd1('0x49')],'active':_0x493b32[_0x9bd1('0x7d')][_0x9bd1('0x7e')],'callerid':_0x493b32[_0x9bd1('0x7d')][_0x9bd1('0x7f')]};}if(_0x493b32[_0x9bd1('0x4d')]){_0x1e3c88[_0x9bd1('0x4d')]={'id':_0x493b32['Interval']['id'],'name':_0x493b32[_0x9bd1('0x4d')][_0x9bd1('0x49')]};}var _0x36b3fb=md5(JSON[_0x9bd1('0x53')](_0x1e3c88));if(_0x493b32[_0x9bd1('0x3')]!==_0x36b3fb){_0x493b32[_0x9bd1('0x3')]=_0x36b3fb;emit(util['format'](_0x9bd1('0x80'),_0x1e3c88[_0x9bd1('0x49')]),_0x9bd1('0x81'),_0x1e3c88);}}}function emitCampaignSummary(_0x489607){if(_0x489607[_0x9bd1('0x58')]==='ivr'){emit(util[_0x9bd1('0x82')]('campaign:ivr:%s',_0x489607[_0x9bd1('0x49')]),_0x9bd1('0x83'),_0x489607);}}function checkGetDataPredictive(_0x5abd90){if(isNotNull(_0x5abd90)&&!_[_0x9bd1('0x51')](_0x5abd90)){loggerPredictive['info'](_0x9bd1('0x84'));loggerPredictive[_0x9bd1('0x85')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5abd90[_0x9bd1('0x86')]);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x87'),_0x5abd90[_0x9bd1('0x73')]);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x88'),_0x5abd90['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x89'),_0x5abd90[_0x9bd1('0x74')]);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x8a'),_0x5abd90['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x9bd1('0x8b'),_0x5abd90['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x9bd1('0x8c'));if(_0x5abd90[_0x9bd1('0x86')]>0x0){if(!_[_0x9bd1('0x46')](_0x5abd90['predictiveIntervalAvgTalktime'])&&_0x5abd90['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x8d'));if(!_[_0x9bd1('0x46')](_0x5abd90[_0x9bd1('0x8e')])&&_0x5abd90[_0x9bd1('0x8e')]>0x0){return!![];}loggerPredictive['info'](_0x9bd1('0x8f'));}else{loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x90'));}}else{loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x91'));}return![];}function mergeDataErlangB(_0x59ae6a){return function(_0x4184ad){loggerPredictive['info'](_0x9bd1('0x92'));loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x93'),_0x4184ad[_0x9bd1('0x7a')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4184ad[_0x9bd1('0x94')]);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x95'),_0x4184ad[_0x9bd1('0x7b')]);loggerPredictive[_0x9bd1('0x85')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4184ad[_0x9bd1('0x7c')]);loggerPredictive[_0x9bd1('0x85')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4184ad['erlangAbandonmentRate']);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x8c'));_[_0x9bd1('0x96')](_0x59ae6a,_0x4184ad);};}function getDiff(_0x4390e9){var _0x14369d=moment()[_0x9bd1('0x54')](0x0);var _0x3ac4d7=moment(_0x4390e9)[_0x9bd1('0x54')](0x0);return _0x14369d['diff'](_0x3ac4d7,'seconds');}function ifInterval(_0x4451e2,_0x17132f){if(_[_0x9bd1('0x46')](_0x17132f)){return![];}return getDiff(_0x17132f)<_0x4451e2*0x3c;}function freeVariablesPredictive(_0x7db8e1){if(isNotNull(_0x7db8e1)){if(!_[_0x9bd1('0x46')](_0x7db8e1[_0x9bd1('0x2b')])){_0x7db8e1[_0x9bd1('0x2b')]=undefined;loggerPredictive[_0x9bd1('0x85')](_0x7db8e1[_0x9bd1('0x49')],_0x9bd1('0x97'));}if(!_[_0x9bd1('0x46')](_0x7db8e1[_0x9bd1('0x2a')])){_0x7db8e1['startPredictive']=undefined;loggerPredictive[_0x9bd1('0x85')](_0x7db8e1['name'],_0x9bd1('0x98'));}if(!_[_0x9bd1('0x46')](_0x7db8e1[_0x9bd1('0x99')])){clearInterval(_0x7db8e1['handlePredictive']);_0x7db8e1[_0x9bd1('0x99')]=undefined;loggerPredictive[_0x9bd1('0x85')](_0x7db8e1[_0x9bd1('0x49')],_0x9bd1('0x9a'));}}}function erlangb(_0x4c2d80,_0x440bcf){if(_0x440bcf===0x0){return 0x0;}var _0x92e6e1=0x1;for(var _0x673929=0x1;_0x673929<=_0x440bcf;_0x673929+=0x1){_0x92e6e1=0x1+_0x92e6e1*_0x673929/_0x4c2d80;}return 0x1/_0x92e6e1;}function isVoiceQueueOutbound(_0x481b7b){return _0x481b7b==='outbound';}function isNotPreview(_0x429a89){return _0x429a89!==_0x9bd1('0x9b');}function isCampaignIvr(_0x4e008d){return _0x4e008d===_0x9bd1('0x9c');}function getCallerId(_0x17cbb9,_0xbfe8e7,_0x4ce156){if(!_[_0x9bd1('0x46')](_0x4ce156)&&typeof _0x4ce156===_0x9bd1('0x9d')&&!_[_0x9bd1('0x51')](_0x4ce156)){if(!_[_0x9bd1('0x46')](_0xbfe8e7)&&typeof _0xbfe8e7==='string'&&!_[_0x9bd1('0x51')](_0xbfe8e7)){return util['format'](_0x9bd1('0x9e'),_0xbfe8e7,_0x4ce156);}return util['format']('\x22%s\x22\x20<%s>',_0x4ce156,_0x4ce156);}if(!_[_0x9bd1('0x46')](_0x17cbb9)&&typeof _0x17cbb9===_0x9bd1('0x9d')&&!_[_0x9bd1('0x51')](_0x17cbb9)){return _0x17cbb9;}return _0x9bd1('0x9f');}function loggerCatchQueueSummary(_0xa0a504,_0x1f26ba){return function(_0x456851){freeVariablesPredictive(_0x1f26ba);emitVoiceQueueSummary(_0x1f26ba);emitCampaignSummary(_0x1f26ba);loggerSyncQueueSummary[_0x9bd1('0xa0')](_0xa0a504,util['inspect'](_0x456851,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x161ba7,_0xefbd8e){return function(_0x10bb26){loggerPredictive[_0x9bd1('0xa1')](_0xefbd8e[_0x9bd1('0x49')],_0x161ba7);loggerPredictive[_0x9bd1('0xa1')](_0x10bb26[_0x9bd1('0xa2')]);freeVariablesPredictive(_0xefbd8e);};}function loggerCatch(_0x13646f){return function(_0x3f4ae7){logger['error'](_0x13646f,util[_0x9bd1('0xa3')](_0x3f4ae7,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1f6a3f){return _0x1f6a3f&&!_[_0x9bd1('0x46')](_0x1f6a3f)&&_0x1f6a3f[_0x9bd1('0xa4')]>0x0;}function decremetOriginate(_0x556ed1){if(!_[_0x9bd1('0x46')](_0x556ed1)&&_0x556ed1!==null){if(typeof _0x556ed1[_0x9bd1('0xa5')]!==_0x9bd1('0xa6')){if(_0x556ed1[_0x9bd1('0xa5')]>0x0){_0x556ed1['originated']-=0x1;}else{logger[_0x9bd1('0xa1')](_0x9bd1('0xa7'));}}}else{logger[_0x9bd1('0xa1')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x5dd68d,_0x3853de,_0x1ec468){if(_0x3853de>_0x1ec468){for(var _0x86a09c=0x0;_0x86a09c<_0x3853de-_0x1ec468;_0x86a09c+=0x1){decremetOriginate(_0x5dd68d);}}}function loggerGetContactDialer(_0x63b2a5,_0x2b8c49,_0x11a97a){return function(_0x46275d){checkContactLowerLimitOriginate(_0x2b8c49,_0x11a97a,0x0);logger[_0x9bd1('0xa1')](_0x63b2a5,util[_0x9bd1('0xa3')](_0x46275d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x14e553){return function(_0x3b4e60){if(isNotNull(_0x3b4e60)&&isNotNull(_0x3b4e60[0x0])){if(_0x3b4e60[0x0][_0x9bd1('0xa8')]>0x0){_0x14e553[_0x9bd1('0x47')]=_0x9bd1('0xa9');logger['info'](_0x9bd1('0xaa')+_0x14e553[_0x9bd1('0x49')],_0x3b4e60[0x0][_0x9bd1('0xa8')],'contacts');}else{_0x14e553[_0x9bd1('0x47')]=_0x9bd1('0xab');logger['info'](_0x9bd1('0xac')+_0x14e553[_0x9bd1('0x49')]);}}};}function notSendMessagesQueue(_0x109e93){if(_0x109e93[_0x9bd1('0xad')]){freeVariablesPredictive(_0x109e93);if(_0x109e93[_0x9bd1('0xa5')]===0x0&&_0x109e93[_0x9bd1('0xae')]===0x0&&_0x109e93[_0x9bd1('0x60')]===0x0&&(_0x109e93[_0x9bd1('0x5b')]||0x0)===0x0){_0x109e93['sendMessageOneNotActive']=![];_0x109e93[_0x9bd1('0xaf')]=0x0;_0x109e93['message']=_0x9bd1('0x4b');loggerSyncQueueSummary[_0x9bd1('0xa0')](_0x9bd1('0xb0'),_0x109e93[_0x9bd1('0x49')],_0x9bd1('0xb1'));}else{_0x109e93['message']=_0x9bd1('0xb2');loggerSyncQueueSummary[_0x9bd1('0xa0')](_0x9bd1('0xb0'),_0x109e93['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x109e93);}}function notSendMessagesCampaign(_0x1451ce){if(_0x1451ce[_0x9bd1('0xad')]){if(_0x1451ce['originated']===0x0){_0x1451ce[_0x9bd1('0xad')]=![];_0x1451ce[_0x9bd1('0x47')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x9bd1('0xa0')](_0x9bd1('0xb3'),_0x1451ce[_0x9bd1('0x49')],_0x9bd1('0xb1'));}else{_0x1451ce[_0x9bd1('0x47')]=_0x9bd1('0xb2');loggerSyncQueueSummary[_0x9bd1('0xa0')](_0x9bd1('0xb3'),_0x1451ce[_0x9bd1('0x49')],_0x9bd1('0xb4'));}emitCampaignSummary(_0x1451ce);}}function createObjHistory(_0x3dfdae,_0x1e7f82,_0xbe846c,_0x14dc9e,_0x4bc066){_0x3dfdae[_0x9bd1('0x47')]=_0xbe846c;var _0x4848f3=new Action(_0x3dfdae,_0x1e7f82);var _0x108da=new History(_0x4848f3);_0x108da[_0x9bd1('0xb5')]=_0x14dc9e;_0x108da[_0x9bd1('0xb6')]=_0x4bc066;_0x108da[_0x9bd1('0xb7')]=_0x4848f3[_0x9bd1('0xb8')];return _0x108da;}Dialer[_0x9bd1('0x1c')][_0x9bd1('0x42')]=function(){var _0x2008d4=this;setInterval(function(){_0x2008d4['clearZombieChannels'](_0x2008d4[_0x9bd1('0x28')],_0x9bd1('0xb9'));_0x2008d4[_0x9bd1('0xba')](_0x2008d4[_0x9bd1('0xbb')],'[actions]');},0x32c8);};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xba')]=function(_0x540d8d,_0xc3ce25){var _0x2ed0f2=this;for(var _0x35f438 in _0x540d8d){if(typeof _0x540d8d[_0x35f438]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x9bd1('0xbc')](_0x540d8d[_0x35f438])){return ami[_0x9bd1('0xbd')]({'action':_0x9bd1('0xbe'),'channel':_0x540d8d[_0x35f438][_0x9bd1('0xbf')]})[_0x9bd1('0xc0')](function(_0x54c1f8){if(_0x54c1f8['message']===_0x9bd1('0xc1')){setTimeout(function(){if(_0x540d8d[_0x35f438]&&_0x540d8d[_0x35f438]['type']!=='ivr'){_0x2ed0f2[_0x9bd1('0xc2')](_0x2ed0f2[_0x9bd1('0x21')][_0x540d8d[_0x35f438][_0x9bd1('0xc3')]]);logger[_0x9bd1('0xa1')](_0x9bd1('0xc4'),_0xc3ce25,_0x35f438,_0x540d8d[_0x35f438]['queue']);delete _0x540d8d[_0x35f438];}if(_0x540d8d[_0x35f438]&&_0x540d8d[_0x35f438][_0x9bd1('0x58')]===_0x9bd1('0x9c')){_0x2ed0f2[_0x9bd1('0xc2')](_0x2ed0f2[_0x9bd1('0x22')][_0x540d8d[_0x35f438][_0x9bd1('0xc3')]]);logger['error'](_0x9bd1('0xc5'),_0xc3ce25,_0x35f438,_0x540d8d[_0x35f438]['queue']);delete _0x540d8d[_0x35f438];}},0x2328);}});}});}}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xc6')]=function(_0x1bb920){return Promise[_0x9bd1('0xc7')]()['then'](cmHopper['countReScheduled'](_0x1bb920))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xc8')));};Dialer[_0x9bd1('0x1c')]['checkIsBlackList']=function(_0xc87d83){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopperBlack[_0x9bd1('0xc9')](_0xc87d83))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x9bd1('0xca')]=function(_0x2c7ef4,_0x2e9518,_0x1dad43){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x9bd1('0xca')](_0x2c7ef4,_0x2e9518,_0x1dad43))['catch'](loggerCatch(_0x9bd1('0xcb')));};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xcc')]=function(_0x108ba1,_0x3ebe0c,_0x313b9a){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopperAdditionalPhone[_0x9bd1('0xcc')](_0x108ba1,_0x3ebe0c,_0x313b9a))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xcd')));};Dialer['prototype'][_0x9bd1('0xce')]=function(_0x12cd08){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopperBlack['checkIsBlackListIvr'](_0x12cd08))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xcf')));};Dialer['prototype'][_0x9bd1('0xd0')]=function(_0x9e630){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopperHistory[_0x9bd1('0xd1')](_0x9e630))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xd2')));};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xd3')]=function(_0x185fd3){return Promise[_0x9bd1('0xc7')]()['then'](cmHopper[_0x9bd1('0xd3')](_0x185fd3))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xd4')));};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xd5')]=function(_0x3606e3,_0x56e5e5,_0x4d45a2){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopper[_0x9bd1('0xd5')](_0x3606e3,_0x56e5e5,_0x4d45a2))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xd6')));};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xd7')]=function(_0x5da55e,_0x4484c7,_0x38e948,_0x254d10,_0x376105){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopper[_0x9bd1('0xd7')](_0x5da55e,_0x4484c7,_0x38e948,_0x254d10))[_0x9bd1('0xc0')](function(_0x11194a){_0x376105['temp']-=_0x38e948;_0x376105['temp']=_0x376105['temp']>0x0?_0x376105['temp']:0x0;loggerCatch(_0x9bd1('0xd8'))(_0x11194a);});};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xd9')]=function(_0x569b24,_0x208ec3,_0x1fc699,_0x5ebf74){return Promise['resolve']()[_0x9bd1('0x44')](cmHopper[_0x9bd1('0xd9')](_0x569b24,_0x208ec3,_0x1fc699))[_0x9bd1('0xc0')](function(_0x44dec4){_0x5ebf74[_0x9bd1('0xda')]-=_0x208ec3;_0x5ebf74[_0x9bd1('0xda')]=_0x5ebf74[_0x9bd1('0xda')]>0x0?_0x5ebf74[_0x9bd1('0xda')]:0x0;loggerCatch(_0x9bd1('0xdb'))(_0x44dec4);});};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xdc')]=function(_0x42ffcb){return Promise[_0x9bd1('0xc7')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x42ffcb))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xdd')));};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xde')]=function(_0x20bd87){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopper[_0x9bd1('0xde')](_0x20bd87))['catch'](loggerCatch(_0x9bd1('0xdf')));};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xe0')]=function(_0xa9082d){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopperHistory[_0x9bd1('0xe0')](_0xa9082d))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0xe1')));};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xc2')]=function(_0x58fb73){if(!_[_0x9bd1('0x46')](_0x58fb73)&&_0x58fb73!==null){if(typeof _0x58fb73[_0x9bd1('0xa5')]!=='undefined'){if(_0x58fb73[_0x9bd1('0xa5')]>0x0){_0x58fb73[_0x9bd1('0xa5')]-=0x1;}else{logger[_0x9bd1('0xa1')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xe2')]=function(_0x426481,_0x3c58c3){var _0x2e6aff=this;return function(_0x20115d){_0x2e6aff[_0x9bd1('0xc2')](_0x3c58c3);logger['error'](_0x426481,util[_0x9bd1('0xa3')](_0x20115d,{'showHidden':![],'depth':null}));};};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xe3')]=function(_0x4ce604,_0x542d60,_0x1099a2){var _0x2da050={'state':0x19,'statedesc':'notFound'};this[_0x9bd1('0xc2')](_0x542d60);this[_0x9bd1('0xe4')](_['merge'](_0x2da050,_['pick'](_0x1099a2,[_0x9bd1('0xe5'),_0x9bd1('0xe6'),_0x9bd1('0xe7'),_0x9bd1('0xe8'),_0x9bd1('0xe9')])),'[emptyContact][createHistory]',_0x9bd1('0xea'));logger[_0x9bd1('0xa1')](_0x4ce604);};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xeb')]=function(_0xae1ddb){return _0xae1ddb===_0x9bd1('0xec');};Dialer['prototype'][_0x9bd1('0xed')]=function(_0x2a1d62){return!_[_0x9bd1('0x46')](_0x2a1d62)&&_0x2a1d62&&!_[_0x9bd1('0x46')](_0x2a1d62[_0x9bd1('0x49')])&&!_[_0x9bd1('0x46')](_0x2a1d62[_0x9bd1('0x7e')])&&_0x2a1d62['active']&&(this[_0x9bd1('0x24')][util[_0x9bd1('0x82')]('SIP/%s',_0x2a1d62[_0x9bd1('0x49')])][_0x9bd1('0xbe')]===_0x9bd1('0xee')||this[_0x9bd1('0x24')][util['format'](_0x9bd1('0xef'),_0x2a1d62[_0x9bd1('0x49')])][_0x9bd1('0xbe')]==='unmonitored');};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xe4')]=function(_0x93dc0,_0x5c8c24,_0x1a8f7d){this[_0x9bd1('0xe0')](_0x93dc0)[_0x9bd1('0xc0')](loggerCatch(_0x5c8c24));this[_0x9bd1('0xde')](_0x93dc0)[_0x9bd1('0xc0')](loggerCatch(_0x1a8f7d));};Dialer[_0x9bd1('0x1c')]['syncVarSet']=function(_0xc87452){var _0x1b8245=this;var _0x231005=this['uniqueId'][_0xc87452[_0x9bd1('0xf0')]];var _0x4abc94;if(!_[_0x9bd1('0xbc')](_0xc87452)&&!_[_0x9bd1('0xbc')](_0xc87452[_0x9bd1('0xf1')])&&!_[_0x9bd1('0xbc')](_0xc87452[_0x9bd1('0xf1')][_0x9bd1('0xf2')])&&_0xc87452['exten']===_0x9bd1('0xf3')&&_0x231005){if(_0x231005[_0x9bd1('0x58')]!==_0x9bd1('0x9c')&&this[_0x9bd1('0x21')][_0x231005[_0x9bd1('0xc3')]][_0x9bd1('0xf4')]&&_0xc87452[_0x9bd1('0xf5')]===_0x9bd1('0xf6')){delete this['uniqueId'][_0xc87452[_0x9bd1('0xf0')]];this[_0x9bd1('0xc2')](this[_0x9bd1('0x21')][_0x231005[_0x9bd1('0xc3')]]);this['voiceQueues'][_0x231005[_0x9bd1('0xc3')]][_0x9bd1('0x68')]+=0x1;this['voiceQueues'][_0x231005[_0x9bd1('0xc3')]][_0x9bd1('0x67')]+=0x1;_0x4abc94=new Hangup(_0x231005,_0xc87452);_0x4abc94[_0x9bd1('0xb5')]=0x12;_0x4abc94[_0x9bd1('0xb6')]=_0x9bd1('0xf7');_0x4abc94['membername']=_0x9bd1('0xf8');ami[_0x9bd1('0x57')]('custom:amd',ut[_0x9bd1('0xf9')](_0x4abc94,'amd'));this['saveInDb'](_0x4abc94,'[syncHangupInAMD][createHistory]',_0x9bd1('0xfa'));}if(_0x231005['type']!=='ivr'&&this[_0x9bd1('0x21')][_0x231005[_0x9bd1('0xc3')]][_0x9bd1('0xf4')]&&_0xc87452[_0x9bd1('0xf5')]===_0x9bd1('0xfb')){return new Promise(function(_0x4eb524,_0x3fd34b){delete _0x1b8245[_0x9bd1('0x28')][_0xc87452[_0x9bd1('0xf0')]];_0x1b8245[_0x9bd1('0xc2')](_0x1b8245[_0x9bd1('0x21')][_0x231005[_0x9bd1('0xc3')]]);_0x1b8245['voiceQueues'][_0x231005[_0x9bd1('0xc3')]]['outboundAnswerCallsDay']+=0x1;_0x1b8245[_0x9bd1('0x21')][_0x231005[_0x9bd1('0xc3')]][_0x9bd1('0x67')]+=0x1;var _0x2eabba=_0x1b8245[_0x9bd1('0x21')][_0x231005[_0x9bd1('0xc3')]];var _0x1faffd=new Hangup(_0x231005,_0xc87452);_0x1faffd['state']=0x13;_0x1faffd[_0x9bd1('0xb6')]='Machine';_0x1faffd['membername']=_0x9bd1('0xf8');_0x1faffd[_0x9bd1('0xfc')]+=0x1;_0x1faffd[_0x9bd1('0xfd')]+=0x1;_0x1faffd[_0x9bd1('0xfe')]=!![];ami['emit'](_0x9bd1('0xff'),ut[_0x9bd1('0xf9')](_0x1faffd,'amd'));_0x1b8245['createHistory'](_0x1faffd)['catch'](loggerCatch(_0x9bd1('0x100')));if(_0x1faffd[_0x9bd1('0x101')]+_0x1faffd['countcongestionretry']+_0x1faffd['countnoanswerretry']+_0x1faffd[_0x9bd1('0x102')]+_0x1faffd['countdropretry']+_0x1faffd[_0x9bd1('0x103')]+_0x1faffd[_0x9bd1('0xfc')]+_0x1faffd[_0x9bd1('0x104')]>=_0x2eabba['dialGlobalMaxRetry']){_0x1b8245[_0x9bd1('0x105')](_0x1faffd,_0x4eb524,_0x3fd34b,_0x9bd1('0x106'));}else{if(_0x1faffd[_0x9bd1('0xfc')]>=_0x2eabba['dialMachineMaxRetry']){_0x1b8245['createStateFinal'](_0x1faffd,_0x4eb524,_0x3fd34b,'reason\x2019\x20machine....');}else{_0x1b8245[_0x9bd1('0xd3')]({'active':![],'countmachineretry':_0x1faffd['countmachineretry'],'scheduledat':moment()['add'](_0x2eabba[_0x9bd1('0x107')],'minutes')[_0x9bd1('0x82')](_0x9bd1('0x108')),'ContactId':_0x1faffd[_0x9bd1('0xe5')],'ListId':_0x1faffd[_0x9bd1('0xe6')],'VoiceQueueId':_0x1faffd[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x1faffd['CampaignId']||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x109')));_0x4eb524({'reschedule':0x1});}}});}if(_0x231005[_0x9bd1('0x58')]===_0x9bd1('0x9c')&&this[_0x9bd1('0x22')][_0x231005[_0x9bd1('0xc3')]][_0x9bd1('0xf4')]&&_0xc87452['value']===_0x9bd1('0xf6')){delete this[_0x9bd1('0x28')][_0xc87452[_0x9bd1('0xf0')]];this['updateOriginated'](this[_0x9bd1('0x22')][_0x231005['queue']]);_0x4abc94=new Hangup(_0x231005,_0xc87452);_0x4abc94['state']=0x12;_0x4abc94['statedesc']=_0x9bd1('0xf7');_0x4abc94[_0x9bd1('0x10a')]=_0x9bd1('0xf8');ami['emit']('custom:amd',ut[_0x9bd1('0xf9')](_0x4abc94,_0x9bd1('0xfe')));this[_0x9bd1('0xe4')](_0x4abc94,_0x9bd1('0x10b'),_0x9bd1('0x10c'));}if(_0x231005['type']===_0x9bd1('0x9c')&&this[_0x9bd1('0x22')][_0x231005[_0x9bd1('0xc3')]]['dialAMDActive']&&_0xc87452[_0x9bd1('0xf5')]===_0x9bd1('0xfb')){return new Promise(function(_0x5e21f1,_0xc04294){delete _0x1b8245[_0x9bd1('0x28')][_0xc87452[_0x9bd1('0xf0')]];_0x1b8245[_0x9bd1('0xc2')](_0x1b8245[_0x9bd1('0x22')][_0x231005[_0x9bd1('0xc3')]]);_0x1b8245[_0x9bd1('0x22')][_0x231005[_0x9bd1('0xc3')]][_0x9bd1('0x68')]+=0x1;_0x1b8245[_0x9bd1('0x22')][_0x231005['queue']][_0x9bd1('0x67')]+=0x1;var _0x2be201=_0x1b8245[_0x9bd1('0x22')][_0x231005[_0x9bd1('0xc3')]];var _0x1d266d=new Hangup(_0x231005,_0xc87452);_0x1d266d[_0x9bd1('0xb5')]=0x13;_0x1d266d[_0x9bd1('0xb6')]=_0x9bd1('0x10d');_0x1d266d[_0x9bd1('0x10a')]=_0x9bd1('0xf8');_0x1d266d[_0x9bd1('0xfc')]+=0x1;_0x1d266d['countglobal']+=0x1;_0x1d266d[_0x9bd1('0xfe')]=!![];ami[_0x9bd1('0x57')](_0x9bd1('0xff'),ut[_0x9bd1('0xf9')](_0x1d266d,_0x9bd1('0xfe')));_0x1b8245[_0x9bd1('0xe0')](_0x1d266d)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x100')));if(_0x1d266d[_0x9bd1('0x101')]+_0x1d266d[_0x9bd1('0x10e')]+_0x1d266d['countnoanswerretry']+_0x1d266d[_0x9bd1('0x102')]+_0x1d266d['countdropretry']+_0x1d266d['countabandonedretry']+_0x1d266d['countmachineretry']+_0x1d266d[_0x9bd1('0x104')]>=_0x2be201[_0x9bd1('0x10f')]){_0x1b8245[_0x9bd1('0x105')](_0x1d266d,_0x5e21f1,_0xc04294,_0x9bd1('0x106'));}else{if(_0x1d266d[_0x9bd1('0xfc')]>=_0x2be201[_0x9bd1('0x110')]){_0x1b8245[_0x9bd1('0x111')](_0x1d266d,_0x5e21f1,_0xc04294,_0x9bd1('0x112'));}else{_0x1b8245['rescheduleContact']({'active':![],'countmachineretry':_0x1d266d['countmachineretry'],'scheduledat':moment()['add'](_0x2be201[_0x9bd1('0x107')],_0x9bd1('0x113'))[_0x9bd1('0x82')](_0x9bd1('0x108')),'ContactId':_0x1d266d['ContactId'],'ListId':_0x1d266d[_0x9bd1('0xe6')],'VoiceQueueId':_0x1d266d['VoiceQueueId']||undefined,'CampaignId':_0x1d266d[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x109')));_0x5e21f1({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x9bd1('0x3a')]=function(_0x247b29){var _0x10ad0b=this['uniqueId'][_0x247b29[_0x9bd1('0xf0')]];var _0x8f01f3;if(_0x10ad0b&&_0x10ad0b[_0x9bd1('0x58')]===_0x9bd1('0x9c')){delete this['uniqueId'][_0x247b29[_0x9bd1('0xf0')]];this[_0x9bd1('0xc2')](this[_0x9bd1('0x22')][_0x10ad0b[_0x9bd1('0xc3')]]);this['campaigns'][_0x10ad0b['queue']][_0x9bd1('0x114')]+=0x1;_0x8f01f3=new Hangup(_0x10ad0b,_0x247b29);this[_0x9bd1('0xe0')](_0x8f01f3)[_0x9bd1('0xc0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x9bd1('0xde')](_0x8f01f3)[_0x9bd1('0xc0')](loggerCatch('[syncHangupIvr]'));}if(_0x10ad0b&&_0x10ad0b[_0x9bd1('0x58')]!==_0x9bd1('0x9c')&&isNotNull(this[_0x9bd1('0x21')][_0x10ad0b[_0x9bd1('0xc3')]][_0x9bd1('0x115')])){delete this[_0x9bd1('0x28')][_0x247b29[_0x9bd1('0xf0')]];this[_0x9bd1('0xc2')](this[_0x9bd1('0x21')][_0x10ad0b['queue']]);this[_0x9bd1('0x21')][_0x10ad0b[_0x9bd1('0xc3')]][_0x9bd1('0x68')]+=0x1;this[_0x9bd1('0x21')][_0x10ad0b[_0x9bd1('0xc3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x8f01f3=new Hangup(_0x10ad0b,_0x247b29);_0x8f01f3['state']=0x10;_0x8f01f3[_0x9bd1('0xb6')]='AnswerAGI';_0x8f01f3['membername']=_0x9bd1('0x116');this['createHistory'](_0x8f01f3)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x117')));this[_0x9bd1('0xde')](_0x8f01f3)['catch'](loggerCatch(_0x9bd1('0x118')));}if(_0x10ad0b&&_0x10ad0b[_0x9bd1('0x58')]!==_0x9bd1('0x9c')&&!isNotNull(this[_0x9bd1('0x21')][_0x10ad0b[_0x9bd1('0xc3')]][_0x9bd1('0x115')])){delete this[_0x9bd1('0x28')][_0x247b29[_0x9bd1('0xf0')]];this['updateOriginated'](this[_0x9bd1('0x21')][_0x10ad0b[_0x9bd1('0xc3')]]);this[_0x9bd1('0x21')][_0x10ad0b[_0x9bd1('0xc3')]][_0x9bd1('0x72')]+=0x1;_0x8f01f3=new Hangup(_0x10ad0b,_0x247b29);_0x8f01f3[_0x9bd1('0xb5')]=0xc;_0x8f01f3[_0x9bd1('0xb6')]=_0x247b29[_0x9bd1('0x119')];_0x8f01f3[_0x9bd1('0x10a')]='Unknow';this[_0x9bd1('0xe0')](_0x8f01f3)['catch'](loggerCatch(_0x9bd1('0x117')));this['moveContactManagedDialer'](_0x8f01f3)[_0x9bd1('0xc0')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x36')]=function(_0x4cc82d){var _0x4e6eee=this[_0x9bd1('0x28')][_0x4cc82d['uniqueid']];if(this[_0x9bd1('0x21')][_0x4cc82d['queue']]){if(_0x4e6eee&&_0x4e6eee[_0x9bd1('0x58')]!==_0x9bd1('0x9c')){delete this[_0x9bd1('0x28')][_0x4cc82d[_0x9bd1('0xf0')]];this[_0x9bd1('0x21')][_0x4cc82d['queue']][_0x9bd1('0x68')]+=0x1;var _0x11853=new AgentComplete(_0x4e6eee,_0x4cc82d);if(_0x4cc82d[_0x9bd1('0x11a')]===_0x9bd1('0x11b')){_0x11853[_0x9bd1('0x11c')]=this[_0x9bd1('0x21')][_0x4cc82d['queue']][_0x9bd1('0x11d')]&&this[_0x9bd1('0x21')][_0x4cc82d[_0x9bd1('0xc3')]]['dialAgiAfterHangupAgent']?moment()[_0x9bd1('0x82')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x9bd1('0xe0')](_0x11853)['catch'](loggerCatch(_0x9bd1('0x11e')));this['moveContactManagedDialer'](_0x11853)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype']['syncAgentConnect']=function(_0x163cf9){if(this[_0x9bd1('0x21')][_0x163cf9['queue']]){if(this[_0x9bd1('0x28')][_0x163cf9[_0x9bd1('0xf0')]]&&this['uniqueId'][_0x163cf9[_0x9bd1('0xf0')]][_0x9bd1('0x58')]!=='ivr'){this[_0x9bd1('0xc2')](this[_0x9bd1('0x21')][_0x163cf9[_0x9bd1('0xc3')]]);this[_0x9bd1('0x28')][_0x163cf9[_0x9bd1('0xf0')]][_0x9bd1('0x11f')]=moment()[_0x9bd1('0x82')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x120')]=function(_0x7154a3,_0x57c3e8){this['createHistory'](_0x7154a3)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x11e')));if(_0x57c3e8==0x0){this[_0x9bd1('0xde')](_0x7154a3)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x121')));}};Dialer[_0x9bd1('0x1c')]['syncQueueCallerAbandon']=function(_0x4d07c9){var _0x50ae80=this['uniqueId'][_0x4d07c9[_0x9bd1('0xf0')]];var _0x18167b=this;var _0xdc7dfd=![];var _0x2f3234;var _0x5bac82;if(this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]]){if(_0x50ae80&&_0x50ae80[_0x9bd1('0x58')]!==_0x9bd1('0x9c')){delete this[_0x9bd1('0x28')][_0x4d07c9['uniqueid']];this[_0x9bd1('0xc2')](this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]]);_0x50ae80[_0x9bd1('0x122')]=moment()[_0x9bd1('0x82')](_0x9bd1('0x108'));var _0x162f43=new QueueCallerAbandon(_0x50ae80,_0x4d07c9);if(getSeconds(_0x50ae80[_0x9bd1('0x122')],_0x50ae80[_0x9bd1('0x123')])>=_0x50ae80['dialQueueTimeout']){this['voiceQueues'][_0x4d07c9[_0x9bd1('0xc3')]][_0x9bd1('0x75')]+=0x1;this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]][_0x9bd1('0x6d')]+=0x1;this[_0x9bd1('0x21')][_0x4d07c9['queue']][_0x9bd1('0x124')]+=0x1;_0x162f43['state']=0xa;_0x162f43[_0x9bd1('0xb6')]=_0x9bd1('0x125');_0x162f43[_0x9bd1('0x126')]=_0x9bd1('0x127');_0x162f43[_0x9bd1('0x11c')]=this[_0x9bd1('0x21')][_0x4d07c9['queue']][_0x9bd1('0x11d')]?moment()[_0x9bd1('0x82')](_0x9bd1('0x108')):undefined;_0x162f43[_0x9bd1('0x128')]+=0x1;_0x162f43[_0x9bd1('0xfd')]+=0x1;_0x2f3234=this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]][_0x9bd1('0x129')];_0x5bac82=this['voiceQueues'][_0x4d07c9['queue']][_0x9bd1('0x12a')];_0x18167b[_0x9bd1('0xca')](_0x162f43,_0x162f43[_0x9bd1('0xb5')],_0x50ae80[_0x9bd1('0x12b')])[_0x9bd1('0x44')](function(_0x190e3f){_0xdc7dfd=_0x190e3f[_0x9bd1('0x12c')]==0x1;if(_0x162f43[_0x9bd1('0x128')]>=_0x18167b['voiceQueues'][_0x4d07c9[_0x9bd1('0xc3')]]['dialDropMaxRetry']){_0x18167b['queueCallerAbandonCreateState'](_0x162f43,_0x190e3f['additional']);}else{_0x18167b[_0x9bd1('0xd3')]({'active':![],'countdropretry':_0x162f43['countdropretry'],'scheduledat':moment()['add'](_0x18167b[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]]['dialDropRetryFrequency'],_0x9bd1('0x113'))[_0x9bd1('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50ae80[_0x9bd1('0xe5')],'ListId':_0x50ae80['ListId'],'VoiceQueueId':_0x50ae80['VoiceQueueId']||undefined,'CampaignId':_0x50ae80[_0x9bd1('0xe9')]||undefined})['catch'](loggerCatch(_0x9bd1('0x12d')));var _0x225ed3=new History(_0x162f43);_0x225ed3[_0x9bd1('0xb5')]=0xa;_0x225ed3['statedesc']=_0x9bd1('0x125');_0x225ed3[_0x9bd1('0xb8')]=moment()[_0x9bd1('0x82')]('YYYY-MM-DD\x20HH:mm:ss');_0x225ed3['endtime']=_0x225ed3[_0x9bd1('0xb8')];_0x225ed3[_0x9bd1('0x12e')]=_0x162f43['calleridname'];_0x225ed3[_0x9bd1('0x12f')]=_0x162f43['calleridnum'];_0x18167b['createHistory'](_0x225ed3)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x130')));}})['then'](function(){if(_0xdc7dfd)_0x18167b['swapAdditionalPhones'](_0x162f43,_0x2f3234,_0x5bac82)['then'](function(){return 0x1;});});}else{this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]][_0x9bd1('0x74')]+=0x1;this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]][_0x9bd1('0x6c')]+=0x1;_0x162f43[_0x9bd1('0xb5')]=0xb;_0x162f43[_0x9bd1('0xb6')]=_0x9bd1('0x131');_0x162f43['dropreason']='CALLEREXIT';_0x162f43[_0x9bd1('0x103')]+=0x1;_0x162f43[_0x9bd1('0xfd')]+=0x1;_0x2f3234=this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]]['dialAbandonedRetryFrequency'];_0x5bac82=this[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]][_0x9bd1('0x12a')];_0x18167b[_0x9bd1('0xca')](_0x162f43,_0x162f43[_0x9bd1('0xb5')],_0x50ae80[_0x9bd1('0x12b')])['then'](function(_0x50a61b){if(_0x162f43[_0x9bd1('0x103')]>=_0x18167b[_0x9bd1('0x21')][_0x4d07c9['queue']][_0x9bd1('0x132')]){_0x18167b['queueCallerAbandonCreateState'](_0x162f43,_0x50a61b[_0x9bd1('0x12c')]);}else{_0x18167b[_0x9bd1('0xd3')]({'active':![],'countabandonedretry':_0x162f43['countabandonedretry'],'scheduledat':moment()[_0x9bd1('0x133')](_0x18167b[_0x9bd1('0x21')][_0x4d07c9[_0x9bd1('0xc3')]][_0x9bd1('0x134')],'minutes')['format'](_0x9bd1('0x108')),'ContactId':_0x50ae80[_0x9bd1('0xe5')],'ListId':_0x50ae80[_0x9bd1('0xe6')],'VoiceQueueId':_0x50ae80[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x50ae80['CampaignId']||undefined})['catch'](loggerCatch(_0x9bd1('0x135')));var _0x429252=new History(_0x162f43);_0x429252[_0x9bd1('0xb5')]=0xb;_0x429252[_0x9bd1('0xb6')]=_0x9bd1('0x131');_0x429252[_0x9bd1('0xb8')]=moment()[_0x9bd1('0x82')](_0x9bd1('0x108'));_0x429252[_0x9bd1('0xb7')]=_0x429252['starttime'];_0x429252[_0x9bd1('0x12e')]=_0x162f43[_0x9bd1('0x12e')];_0x429252[_0x9bd1('0x12f')]=_0x162f43[_0x9bd1('0x12f')];_0x18167b[_0x9bd1('0xe0')](_0x429252)['catch'](loggerCatch(_0x9bd1('0x136')));}})['then'](function(){if(_0xdc7dfd)_0x18167b['swapAdditionalPhones'](_0x162f43,_0x2f3234,_0x5bac82)[_0x9bd1('0x44')](function(){return 0x1;});});}}}};Dialer[_0x9bd1('0x1c')]['syncNewExten']=function(_0x397332){if(this[_0x9bd1('0xbb')][_0x397332[_0x9bd1('0xf0')]]){this[_0x9bd1('0xbb')][_0x397332[_0x9bd1('0xf0')]]['channel']=_0x397332[_0x9bd1('0xbf')];}if(this[_0x9bd1('0x28')][_0x397332['uniqueid']]){this[_0x9bd1('0x28')][_0x397332[_0x9bd1('0xf0')]][_0x9bd1('0xbf')]=_0x397332[_0x9bd1('0xbf')];}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x3e')]=function(_0x2585a0){if(strategy[this['voiceQueues'][this[_0x9bd1('0xbb')][_0x2585a0[_0x9bd1('0x137')]][_0x9bd1('0xc3')]][_0x9bd1('0x59')]]==='roundrobin'){if(this['actions'][_0x2585a0['actionid']]&&_[_0x9bd1('0xbc')](this[_0x9bd1('0xbb')][_0x2585a0[_0x9bd1('0x137')]]['locked'])&&_0x2585a0[_0x9bd1('0xbe')]==='1'&&_0x2585a0[_0x9bd1('0x138')]==='0'){if(this[_0x9bd1('0x23')][_0x2585a0[_0x9bd1('0x139')]]){if(!this[_0x9bd1('0x23')][_0x2585a0[_0x9bd1('0x139')]]['locked']){this[_0x9bd1('0x23')][_0x2585a0['stateinterface']][_0x9bd1('0x13a')]=!![];this['actions'][_0x2585a0[_0x9bd1('0x137')]][_0x9bd1('0x13a')]=!![];this[_0x9bd1('0xbb')][_0x2585a0[_0x9bd1('0x137')]][_0x9bd1('0x139')]=_0x2585a0[_0x9bd1('0x139')];}}}}else if((strategy[this[_0x9bd1('0x21')][this['actions'][_0x2585a0[_0x9bd1('0x137')]][_0x9bd1('0xc3')]][_0x9bd1('0x59')]]||_0x9bd1('0x1a'))==='rrmemory'){if(this['actions'][_0x2585a0[_0x9bd1('0x137')]]){if(this[_0x9bd1('0x23')][_0x2585a0[_0x9bd1('0x139')]]){this[_0x9bd1('0xbb')][_0x2585a0['actionid']][_0x9bd1('0x139')]=_0x2585a0[_0x9bd1('0x139')];if(_[_0x9bd1('0xbc')](this['queueBooked'][this['actions'][_0x2585a0[_0x9bd1('0x137')]][_0x9bd1('0xc3')]])){this['queueBooked'][this[_0x9bd1('0xbb')][_0x2585a0[_0x9bd1('0x137')]][_0x9bd1('0xc3')]]=[];}this['queueBooked'][this[_0x9bd1('0xbb')][_0x2585a0[_0x9bd1('0x137')]][_0x9bd1('0xc3')]][_0x9bd1('0x13b')](_['merge'](_['pick'](this[_0x9bd1('0xbb')][_0x2585a0['actionid']],[_0x9bd1('0x13c'),_0x9bd1('0x139')]),{'status':_0x2585a0['status'],'paused':_0x2585a0[_0x9bd1('0x138')]}));}}}};function unlockQueueStatus(_0x281047,_0x371153){setTimeout(function(){if(_[_0x9bd1('0x46')](_0x281047['queueStatusComplete'])){loggerBooked[_0x9bd1('0xa1')](_0x9bd1('0x13d'),_0x371153);}_0x281047[_0x9bd1('0x13e')]=!![];loggerBooked[_0x9bd1('0x85')](_0x9bd1('0x13f'),_0x371153,JSON[_0x9bd1('0x53')](_[_0x9bd1('0x140')](_0x281047,[_0x9bd1('0x49'),_0x9bd1('0x13e')])));},0x1f3);}Dialer[_0x9bd1('0x1c')][_0x9bd1('0x40')]=function(_0x11c2d5){var _0x4e24c4=this;var _0x138290=_0x4e24c4['voiceQueues'][_0x4e24c4[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]]['queue']];if(strategy[this['voiceQueues'][this[_0x9bd1('0xbb')][_0x11c2d5['actionid']][_0x9bd1('0xc3')]]['strategy']]==='roundrobin'){if(this['actions'][_0x11c2d5[_0x9bd1('0x137')]]&&this['actions'][_0x11c2d5[_0x9bd1('0x137')]]['stateinterface']){this[_0x9bd1('0x9b')][_0x9bd1('0x141')](this['actions'][_0x11c2d5['actionid']][_0x9bd1('0x13c')],this[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]]['stateinterface'])[_0x9bd1('0xc0')](function(_0x44ffc9){logger[_0x9bd1('0xa1')](_0x9bd1('0x142'),util[_0x9bd1('0xa3')](_0x44ffc9,{'showHidden':![],'depth':null}));})[_0x9bd1('0x1f')](function(){_0x4e24c4[_0x9bd1('0xc2')](_0x4e24c4[_0x9bd1('0x21')][_0x4e24c4[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]][_0x9bd1('0xc3')]]);_0x4e24c4[_0x9bd1('0x23')][_0x4e24c4[_0x9bd1('0xbb')][_0x11c2d5['actionid']][_0x9bd1('0x139')]]['locked']=![];delete _0x4e24c4[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]];unlockQueueStatus(_0x138290);});}else{this[_0x9bd1('0xc2')](this['voiceQueues'][this[_0x9bd1('0xbb')][_0x11c2d5['actionid']]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x11c2d5[_0x9bd1('0x137')]]['ContactId'],'ListId':this['actions'][_0x11c2d5[_0x9bd1('0x137')]]['ListId'],'VoiceQueueId':this[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]][_0x9bd1('0xe8')]||undefined,'CampaignId':this[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]]['CampaignId']||undefined})[_0x9bd1('0xc0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x9bd1('0xbb')][_0x11c2d5['actionid']];unlockQueueStatus(_0x138290);}}else if((strategy[this[_0x9bd1('0x21')][this[_0x9bd1('0xbb')][_0x11c2d5['actionid']][_0x9bd1('0xc3')]][_0x9bd1('0x59')]]||'rrmemory')==='rrmemory'){var _0x1e3441;if(this[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]]&&!_[_0x9bd1('0x51')](this['queueBooked'][this[_0x9bd1('0xbb')][_0x11c2d5['actionid']][_0x9bd1('0xc3')]])){if(this[_0x9bd1('0x2e')][_0x4e24c4['actions'][_0x11c2d5[_0x9bd1('0x137')]]['queue']]){this[_0x9bd1('0x2e')][_0x4e24c4['actions'][_0x11c2d5[_0x9bd1('0x137')]][_0x9bd1('0xc3')]]=this[_0x9bd1('0x2e')][this[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]][_0x9bd1('0xc3')]]?this['queueBookedRR'][this['actions'][_0x11c2d5['actionid']][_0x9bd1('0xc3')]]:this[_0x9bd1('0x2d')][this[_0x9bd1('0xbb')][_0x11c2d5['actionid']]['queue']]?this['queueBooked'][this[_0x9bd1('0xbb')][_0x11c2d5['actionid']]['queue']]['_rr']||0x0:0x0;}this[_0x9bd1('0x2d')][this[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]][_0x9bd1('0xc3')]]['_rr']=this[_0x9bd1('0x2e')][this[_0x9bd1('0xbb')][_0x11c2d5[_0x9bd1('0x137')]][_0x9bd1('0xc3')]];for(var _0x35de31=0x0;_0x35de31=0x0;})[_0x9bd1('0xc0')](myreject(_0x566606)));}}else{_0x39abc7['push'](ami[_0x9bd1('0xbd')]({'action':'command','command':util[_0x9bd1('0x82')](_0x9bd1('0x15d'),_0x1d1eca,!_['isUndefined'](config[_0x9bd1('0x159')][_0x16eea8])?_0x16eea8:'')})['then'](function(_0x61dd59){return _0x61dd59[_0x9bd1('0x15e')][_0x9bd1('0x15f')](_0x9bd1('0x160'))>=0x0;})[_0x9bd1('0xc0')](myreject(_0x566606)));}Promise['all'](_0x39abc7)[_0x9bd1('0x44')](function(_0x3dec35){var _0xfdcaee=_[_0x9bd1('0x161')](_0x3dec35);if(_0xfdcaee){return _0x53b8a1(_0xfdcaee);}else{_0x51e7e8[_0x9bd1('0x47')]=_0x34ec50?_0x9bd1('0x162'):'INTERVAL_IS_OVERTIME';return _0x566606(msgResponse('[ifTime][promiseAll]',_0x9bd1('0x155'),'Global:\x20'+_0x34ec50+'\x20'+_0x1a767a+_0x9bd1('0x163')+util['inspect'](_0x1d1eca,{'showHidden':![],'depth':null})+_0x9bd1('0x164')+_0x16eea8));}})['catch'](function(_0x3c229c){return _0x566606(msgResponse(_0x9bd1('0x154'),_0x9bd1('0x155'),JSON[_0x9bd1('0x53')](_0x3c229c)));});});};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x165')]=function(_0x3ce5ea){var _0x111e79=this;return function(){switch(_0x3ce5ea[_0x9bd1('0x63')]){case'progressive':freeVariablesPredictive(_0x3ce5ea);_0x111e79[_0x9bd1('0x166')](_0x3ce5ea,0x1);break;case _0x9bd1('0x167'):freeVariablesPredictive(_0x3ce5ea);_0x111e79[_0x9bd1('0x166')](_0x3ce5ea,_0x3ce5ea['dialPowerLevel']);break;case _0x9bd1('0x8'):_0x111e79[_0x9bd1('0x8')](_0x3ce5ea);break;case'booked':freeVariablesPredictive(_0x3ce5ea);_0x111e79[_0x9bd1('0x166')](_0x3ce5ea,0x1);break;default:freeVariablesPredictive(_0x3ce5ea);logger[_0x9bd1('0xa1')](_0x9bd1('0x168'),_0x3ce5ea['name'],'method\x20not\x20recognized');}};};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x169')]=function(_0x19b7b0){return Promise['resolve']()[_0x9bd1('0x44')](cmHopper['handlePreviewRecallNotifications'](_0x19b7b0['id'],previewRecallmeReminderInterval))[_0x9bd1('0x44')](function(_0x18d3b5){for(var _0x20f743=0x0;_0x20f743<_0x18d3b5[_0x9bd1('0xa4')];_0x20f743++){var _0x1d56d7=_0x18d3b5[_0x20f743][_0x9bd1('0x16a')][_0x9bd1('0x49')];if(_0x1d56d7)io['to'](util[_0x9bd1('0x82')]('user:%s',_0x1d56d7))[_0x9bd1('0x57')](_0x9bd1('0x16b'),{'hopper':_0x18d3b5[_0x20f743]});}})[_0x9bd1('0xc0')](function(){});};Dialer[_0x9bd1('0x1c')]['launchHandleIvr']=function(_0x3871cb){var _0x2be560=this;return function(){_0x2be560[_0x9bd1('0x16c')](_0x3871cb);};};Dialer[_0x9bd1('0x1c')][_0x9bd1('0xb')]=function(_0x433887){var _0x515684=this;if(isNotPreview(_0x433887[_0x9bd1('0x63')])){if(isVoiceQueueOutbound(_0x433887[_0x9bd1('0x58')])&&isActive(_0x433887[_0x9bd1('0x62')])){_0x433887[_0x9bd1('0xad')]=!![];Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](checkIsLoggedIn(_0x433887,_0x433887[_0x9bd1('0x5a')]))[_0x9bd1('0x44')](checkIsActive(_0x433887,_0x433887[_0x9bd1('0x62')]))['then'](checkInterval(_0x433887))['then'](_0x515684[_0x9bd1('0x150')](_0x433887))['then'](_0x515684['checkIfTime'](_0x433887['dialGlobalInterval'],_0x433887[_0x9bd1('0x16d')],_0x433887[_0x9bd1('0x49')],_0x433887))[_0x9bd1('0x44')](_0x515684[_0x9bd1('0x16e')](_0x433887[_0x9bd1('0x4d')],_0x433887[_0x9bd1('0x16d')],_0x433887['name'],_0x433887))['then'](_0x515684[_0x9bd1('0x165')](_0x433887))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x433887));}else{notSendMessagesQueue(_0x433887);}}else{freeVariablesPredictive(_0x433887);}};Dialer[_0x9bd1('0x1c')]['syncQueueSummaryComplete']=_[_0x9bd1('0x16f')](function(){var _0x117cfe=_[_0x9bd1('0x170')](this[_0x9bd1('0x21')],function(_0x54bcef){return _0x54bcef[_0x9bd1('0x171')];});var _0x3049d8=_['filter'](this['agents'],function(_0x2c2433){return _0x2c2433[_0x9bd1('0x172')]&&_0x2c2433[_0x9bd1('0xbe')]===_0x9bd1('0xee');});if(_0x117cfe[_0x9bd1('0xa4')]>0x0&&_0x3049d8[_0x9bd1('0xa4')]>0x0){return Promise[_0x9bd1('0xc7')]()[_0x9bd1('0x44')](cmHopper[_0x9bd1('0x173')](_['map'](_0x117cfe,'id'),previewRecallmeReminderInterval,_[_0x9bd1('0x174')](_0x3049d8,'id')))[_0x9bd1('0x44')](function(_0x368063){for(var _0x27d9bc=0x0;_0x27d9bc<_0x368063[_0x9bd1('0xa4')];_0x27d9bc++){var _0x36b67e=_0x368063[_0x27d9bc][_0x9bd1('0x16a')][_0x9bd1('0x49')];if(_0x36b67e)io['to'](util[_0x9bd1('0x82')](_0x9bd1('0x175'),_0x36b67e))[_0x9bd1('0x57')](_0x9bd1('0x16b'),{'hopper':_0x368063[_0x27d9bc]});}})['catch'](function(_0xeca22c){logger['error'](_0x9bd1('0x169'),_0xeca22c);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['syncCampaigns']=function(){var _0x1eb8ad=this;var _0x36f2b2;for(var _0x374071 in this['campaigns']){if(typeof this['campaigns'][_0x374071]!==_0x9bd1('0xa6')){_0x36f2b2=this[_0x9bd1('0x22')][_0x374071];if(isCampaignIvr(_0x36f2b2[_0x9bd1('0x58')])&&isActive(_0x36f2b2['active'])){_0x36f2b2[_0x9bd1('0xad')]=!![];Promise[_0x9bd1('0xc7')]()['then'](checkIsActive(_0x36f2b2,_0x36f2b2['active']))['then'](checkInterval(_0x36f2b2))[_0x9bd1('0x44')](_0x1eb8ad[_0x9bd1('0x150')](_0x36f2b2))[_0x9bd1('0x44')](_0x1eb8ad[_0x9bd1('0x153')](_0x36f2b2['dialGlobalInterval'],_0x36f2b2['dialTimezone'],_0x36f2b2[_0x9bd1('0x49')],_0x36f2b2))[_0x9bd1('0x44')](_0x1eb8ad[_0x9bd1('0x16e')](_0x36f2b2[_0x9bd1('0x4d')],_0x36f2b2['dialTimezone'],_0x36f2b2[_0x9bd1('0x49')],_0x36f2b2))['then'](_0x1eb8ad[_0x9bd1('0x176')](_0x36f2b2))[_0x9bd1('0xc0')](loggerCatchQueueSummary(_0x9bd1('0x177'),_0x36f2b2));}else{notSendMessagesCampaign(_0x36f2b2);}}}};function getCallerIdRandom(_0x223449,_0x3f9e87){var _0x5a1768;var _0x3bf16b;var _0x40b1c8;if(_0x3f9e87<=0x0){_0x3f9e87=0x1;}_0x5a1768=new RegExp(_0x9bd1('0x178')+_0x3f9e87+'}$');_0x3bf16b=Math[_0x9bd1('0x179')](0xa,_0x3f9e87-0x1);_0x40b1c8=Math[_0x9bd1('0x179')](0xa,_0x3f9e87)-0x1;return util[_0x9bd1('0x82')]('%s',_[_0x9bd1('0x17a')](_0x223449,_0x5a1768,_[_0x9bd1('0x17b')](_0x3bf16b,_0x40b1c8)));}function extractCalleridName(_0x8a1a46){var _0x1c94a1=_0x8a1a46['match'](/"(.*?)"/);return _0x1c94a1?_0x1c94a1[0x1]:_0x8a1a46;}Dialer['prototype'][_0x9bd1('0x17c')]=function(_0xa76ef5,_0x7d8f44){var _0x37f86c=this;var _0x846230=uuid['v4']();this[_0x9bd1('0xbb')][_0x846230]=new Action(_0xa76ef5,_0x7d8f44,_0x846230);return new Promise(function(_0x526078,_0x156e94){if(_['isUndefined'](_0xa76ef5)&&typeof _0xa76ef5!==_0x9bd1('0x17d')){return _0x156e94(msgResponse(_0x9bd1('0x17e'),_0x9bd1('0x155'),_0x9bd1('0x17f')));}if(_[_0x9bd1('0x46')](_0x7d8f44[_0x9bd1('0x180')])||_0x7d8f44[_0x9bd1('0x180')]===null){return _0x156e94(msgResponse(_0x9bd1('0x17e'),'Failure',_0x9bd1('0x181')));}var _0xa6b27d={'XMD-CALLERID':_0x37f86c['actions'][_0x846230]['getCaller'](),'XMD-AGI':_0xa76ef5[_0x9bd1('0x115')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0xa76ef5[_0x9bd1('0x115')]):_0x9bd1('0x182'),'XMD-AGIAFTER':_0xa76ef5['dialQueueProject2']?util[_0x9bd1('0x82')](_0x9bd1('0x183'),ipAgi,_0xa76ef5[_0x9bd1('0x11d')]):'NONE','XMD-QUEUE':_0xa76ef5[_0x9bd1('0x58')]==='outbound'?util[_0x9bd1('0x82')](_0x9bd1('0x184'),_0xa76ef5[_0x9bd1('0x49')],_0xa76ef5[_0x9bd1('0x185')]||'',_0xa76ef5['dialAgiAfterHangupAgent']?'c':'',_0xa76ef5[_0x9bd1('0x186')]||0x3):_0x9bd1('0x182'),'XMD-CONTACTID':_0x7d8f44[_0x9bd1('0xe5')],'XMD-CDRTYPE':_0x9bd1('0x7'),'CALLERID(all)':_0x37f86c['actions'][_0x846230][_0x9bd1('0x187')](),'XMD-AMD':_0xa76ef5[_0x9bd1('0xf4')]?'ACTIVE':_0x9bd1('0x182'),'XMD-DESTINATION':_0x9bd1('0xf3')};if(_0xa76ef5[_0x9bd1('0xf4')]){_0xa6b27d[_0x9bd1('0x188')]=_0xa76ef5[_0x9bd1('0x189')]||0x9c4;_0xa6b27d['XMD-AMDGREETING']=_0xa76ef5[_0x9bd1('0x18a')]||0x5dc;_0xa6b27d[_0x9bd1('0x18b')]=_0xa76ef5[_0x9bd1('0x18c')]||0x320;_0xa6b27d['XMD-AMDTOTALANALYSISTIME']=_0xa76ef5[_0x9bd1('0x18d')]||0x1388;_0xa6b27d[_0x9bd1('0x18e')]=_0xa76ef5[_0x9bd1('0x18f')]||0x64;_0xa6b27d[_0x9bd1('0x190')]=_0xa76ef5[_0x9bd1('0x191')]||0x32;_0xa6b27d['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xa76ef5[_0x9bd1('0x192')]||0x3;_0xa6b27d[_0x9bd1('0x193')]=_0xa76ef5[_0x9bd1('0x194')]||0x100;_0xa6b27d['XMD-AMDMAXIMUMWORDLENGTH']=_0xa76ef5[_0x9bd1('0x195')]||0x1388;}if(_0xa76ef5['type']===_0x9bd1('0x196')){_0xa6b27d[_0x9bd1('0x197')]=_0x7d8f44[_0x9bd1('0xe8')];}else{_0xa6b27d[_0x9bd1('0x198')]=_0x7d8f44[_0x9bd1('0xe9')];}for(var _0x34c1ef in _0x7d8f44[_0x9bd1('0x199')]){if(typeof _0x7d8f44['Contact'][_0x34c1ef]!==_0x9bd1('0xa6')){if(isNotNull(_0x7d8f44['Contact'][_0x34c1ef])&&_0x34c1ef!=='id'&&_0x34c1ef!=='tags'&&_0x34c1ef!==_0x9bd1('0x19a')&&_0x34c1ef!==_0x9bd1('0x19b')){_0xa6b27d[util['format'](_0x9bd1('0x19c'),_0x9bd1('0x19d'),_[_0x9bd1('0x19e')](_0x34c1ef))]=_0x7d8f44[_0x9bd1('0x199')][_0x34c1ef];}}}var _0x575d95=_0x37f86c[_0x9bd1('0xed')](_0xa76ef5[_0x9bd1('0x7d')])?getCallerId(_0xa76ef5[_0x9bd1('0x7d')][_0x9bd1('0x7f')],_0xa76ef5[_0x9bd1('0x19f')],_0xa76ef5[_0x9bd1('0x1a0')]>0x0?getCallerIdRandom(_0xa76ef5[_0x9bd1('0x64')],_0xa76ef5[_0x9bd1('0x1a0')]):_0xa76ef5[_0x9bd1('0x64')]):getCallerId(_[_0x9bd1('0xbc')](_0xa76ef5[_0x9bd1('0x151')])?_0xa76ef5[_0x9bd1('0x7d')][_0x9bd1('0x7f')]:_0xa76ef5[_0x9bd1('0x151')][_0x9bd1('0x7f')],_0xa76ef5[_0x9bd1('0x19f')],_0xa76ef5[_0x9bd1('0x1a0')]>0x0?getCallerIdRandom(_0xa76ef5[_0x9bd1('0x64')],_0xa76ef5['dialRandomLastDigitCallerIdNumber']):_0xa76ef5[_0x9bd1('0x64')]);if(_0x575d95){_0xa6b27d['XMD-ORIGINATECALLERIDNAME']=_0x37f86c[_0x9bd1('0xbb')][_0x846230]['originatecalleridname']=extractCalleridName(_0x575d95);_0xa6b27d['XMD-ORIGINATECALLERIDNUM']=_0x7d8f44[_0x9bd1('0x180')];}_0xa76ef5[_0x9bd1('0x1a1')]=_0xa6b27d;return ami['Action']({'actionid':_0x846230,'action':_0x9bd1('0x17e'),'channel':_0x37f86c[_0x9bd1('0xed')](_0xa76ef5[_0x9bd1('0x7d')])?util['format']('SIP/%s/%s%s',_0xa76ef5[_0x9bd1('0x7d')][_0x9bd1('0x49')],isNotNull(_0xa76ef5[_0x9bd1('0x66')])?_0xa76ef5[_0x9bd1('0x66')][_0x9bd1('0x1a2')]()||'':'',_0xa76ef5[_0x9bd1('0x1a3')]>0x0?_0x7d8f44[_0x9bd1('0x180')][_0x9bd1('0x1a4')](_0xa76ef5[_0x9bd1('0x1a3')]):_0x7d8f44[_0x9bd1('0x180')]):util[_0x9bd1('0x82')]('SIP/%s/%s%s',_[_0x9bd1('0xbc')](_0xa76ef5[_0x9bd1('0x151')])?_0xa76ef5['Trunk'][_0x9bd1('0x49')]:_0xa76ef5['TrunkBackup'][_0x9bd1('0x49')],isNotNull(_0xa76ef5['dialPrefix'])?_0xa76ef5[_0x9bd1('0x66')][_0x9bd1('0x1a2')]()||'':'',_0xa76ef5[_0x9bd1('0x1a3')]>0x0?_0x7d8f44[_0x9bd1('0x180')][_0x9bd1('0x1a4')](_0xa76ef5['dialCutDigit']):_0x7d8f44[_0x9bd1('0x180')]),'callerid':_0x575d95,'Exten':_0x9bd1('0xf3'),'Context':'from-sip','Priority':'1','variable':_0xa6b27d,'timeout':(_0xa76ef5[_0x9bd1('0x65')]||0x1e)*0x3e8,'async':!![],'channelid':_0x846230})['then'](function(_0x1a82b8){return _0x526078(_0x1a82b8);})[_0x9bd1('0xc0')](function(_0x4dc64b){_0xa76ef5[_0x9bd1('0x70')]+=0x1;var _0x433779=new History(_0x37f86c[_0x9bd1('0xbb')][_0x846230]);logger[_0x9bd1('0xa1')](util[_0x9bd1('0x82')](_0x9bd1('0x1a5'),JSON['stringify'](_0x4dc64b)));_0x433779[_0x9bd1('0xb5')]=0xe;_0x433779['statedesc']=_0x9bd1('0x1a6');_0x433779[_0x9bd1('0xb8')]=moment()['format'](_0x9bd1('0x108'));_0x433779[_0x9bd1('0xb7')]=_0x433779[_0x9bd1('0xb8')];_0x37f86c[_0x9bd1('0xe0')](_0x433779)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x1a7')));_0x37f86c['moveContactManagedDialer'](_0x433779)['catch'](loggerCatch(_0x9bd1('0x1a7')))[_0x9bd1('0x1f')](function(){delete _0x37f86c['actions'][_0x846230];return _0x156e94(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x35')]=function(_0x11b504){var _0x378484=this[_0x9bd1('0xbb')][_0x11b504[_0x9bd1('0x137')]];if(_0x378484){delete this[_0x9bd1('0xbb')][_0x11b504[_0x9bd1('0x137')]];_0x378484[_0x9bd1('0x123')]=moment()[_0x9bd1('0x82')](_0x9bd1('0x108'));var _0x47e1dc=_0x378484[_0x9bd1('0x58')]===_0x9bd1('0x9c')?this[_0x9bd1('0x22')][_0x378484[_0x9bd1('0xc3')]]:this[_0x9bd1('0x21')][_0x378484['getQueue']()];if(!this[_0x9bd1('0xeb')](_0x11b504[_0x9bd1('0x1a8')])){this[_0x9bd1('0xc2')](_0x47e1dc);return this['callProgressDetecting'](_0x378484,_0x47e1dc,_0x11b504)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x1a9')));}this[_0x9bd1('0x28')][_0x11b504[_0x9bd1('0xf0')]]=_0x378484;}};Dialer['prototype'][_0x9bd1('0x1aa')]=function(_0x178856,_0x2b976e,_0x144f80){var _0x414dec=new History(_0x2b976e);if(_0x414dec[_0x9bd1('0x101')]+_0x414dec[_0x9bd1('0x10e')]+_0x414dec[_0x9bd1('0x1ab')]+_0x414dec[_0x9bd1('0x102')]+_0x414dec[_0x9bd1('0x128')]+_0x414dec[_0x9bd1('0x103')]+_0x414dec[_0x9bd1('0xfc')]+_0x414dec[_0x9bd1('0x104')]>=_0x144f80[_0x9bd1('0x10f')]-0x1){return!![];}switch(_0x178856){case 0x3:if(_0x414dec[_0x9bd1('0x1ab')]>=_0x144f80['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x414dec[_0x9bd1('0x1ab')]+=0x1,'scheduledat':moment()[_0x9bd1('0x133')](_0x144f80[_0x9bd1('0x1ac')],_0x9bd1('0x113'))[_0x9bd1('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec[_0x9bd1('0xe6')],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x1ad')));break;case 0x5:if(_0x414dec[_0x9bd1('0x101')]>=_0x144f80[_0x9bd1('0x1ae')]-0x1){return!![];}this[_0x9bd1('0xd3')]({'active':![],'countbusyretry':_0x414dec[_0x9bd1('0x101')]+=0x1,'scheduledat':moment()[_0x9bd1('0x133')](_0x144f80[_0x9bd1('0x1af')],_0x9bd1('0x113'))[_0x9bd1('0x82')](_0x9bd1('0x108')),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec[_0x9bd1('0xe6')],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x1b0')));break;case 0x8:if(_0x414dec[_0x9bd1('0x10e')]>=_0x144f80[_0x9bd1('0x1b1')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x414dec['countcongestionretry']+=0x1,'scheduledat':moment()[_0x9bd1('0x133')](_0x144f80['dialCongestionRetryFrequency'],_0x9bd1('0x113'))['format'](_0x9bd1('0x108')),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec[_0x9bd1('0xe6')],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x1b2')));break;case 0x0:if(_0x414dec[_0x9bd1('0x102')]>=_0x144f80[_0x9bd1('0x1b3')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x414dec[_0x9bd1('0x102')]+=0x1,'scheduledat':moment()[_0x9bd1('0x133')](_0x144f80[_0x9bd1('0x1b4')],_0x9bd1('0x113'))[_0x9bd1('0x82')](_0x9bd1('0x108')),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec[_0x9bd1('0xe6')],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x414dec[_0x9bd1('0x128')]>=_0x144f80[_0x9bd1('0x1b5')]-0x1){return!![];}this[_0x9bd1('0xd3')]({'active':![],'countdropretry':_0x414dec[_0x9bd1('0x128')]+=0x1,'scheduledat':moment()['add'](_0x144f80[_0x9bd1('0x129')],_0x9bd1('0x113'))['format'](_0x9bd1('0x108')),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec[_0x9bd1('0xe6')],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x414dec[_0x9bd1('0x103')]>=_0x144f80['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x9bd1('0xd3')]({'active':![],'countabandonedretry':_0x414dec[_0x9bd1('0x103')]+=0x1,'scheduledat':moment()[_0x9bd1('0x133')](_0x144f80['dialAbandonedRetryFrequency'],_0x9bd1('0x113'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec['ListId'],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})['catch'](loggerCatch(_0x9bd1('0x135')));break;case 0x13:if(_0x414dec[_0x9bd1('0xfc')]>=_0x144f80[_0x9bd1('0x110')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x414dec[_0x9bd1('0xfc')]+=0x1,'scheduledat':moment()[_0x9bd1('0x133')](_0x144f80['dialMachineRetryFrequency'],_0x9bd1('0x113'))[_0x9bd1('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec[_0x9bd1('0xe6')],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x109')));break;case 0x14:if(_0x414dec[_0x9bd1('0x104')]>=_0x144f80['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x9bd1('0xd3')]({'active':![],'countagentrejectretry':_0x414dec[_0x9bd1('0x104')]+=0x1,'scheduledat':moment()[_0x9bd1('0x133')](_0x144f80[_0x9bd1('0x1b6')],_0x9bd1('0x113'))['format'](_0x9bd1('0x108')),'ContactId':_0x414dec[_0x9bd1('0xe5')],'ListId':_0x414dec[_0x9bd1('0xe6')],'VoiceQueueId':_0x414dec[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x414dec[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x1b7')));break;default:return!![];}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x1b8')]=function(_0x4bb550,_0x271ac7,_0x544795){var _0x274f6c=this;var _0x2601e2=new History(_0x4bb550);var _0x5e1c6e=![];var _0x403225;var _0x30974f;return new Promise(function(_0x469c3c,_0xf9172e){if(_[_0x9bd1('0x46')](_0x271ac7)&&typeof _0x271ac7!==_0x9bd1('0x17d')){return _0xf9172e(msgResponse(_0x9bd1('0x1b9'),_0x9bd1('0x155'),_0x9bd1('0x1ba')));}if(_[_0x9bd1('0x46')](_0x544795)&&typeof _0x544795!=='object'){return _0xf9172e(msgResponse(_0x9bd1('0x1b9'),'Failure','evt\x20is\x20undefine'));}_0x274f6c[_0x9bd1('0xca')](_0x2601e2,_0x544795[_0x9bd1('0x11a')],_0x271ac7)[_0x9bd1('0x44')](function(_0xe26ad6){if(_0xe26ad6[_0x9bd1('0x12c')]==0x1)_0x5e1c6e=!![];switch(_0x544795[_0x9bd1('0x11a')]){case'0':_0x271ac7[_0x9bd1('0x6f')]+=0x1;_0x2601e2[_0x9bd1('0xb5')]=0x0;_0x2601e2['statedesc']=_0x9bd1('0x1bb');_0x2601e2[_0x9bd1('0x102')]+=0x1;_0x2601e2[_0x9bd1('0xfd')]+=0x1;ami[_0x9bd1('0x57')](_0x9bd1('0x1bc'),ut[_0x9bd1('0xf9')](_0x4bb550,_0x9bd1('0x1bd')));_0x403225=_0x271ac7[_0x9bd1('0x1b4')];_0x30974f=_0x271ac7[_0x9bd1('0x12a')];_0x274f6c[_0x9bd1('0xe0')](_0x2601e2)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x100')));if(_0x274f6c[_0x9bd1('0x1aa')](0x0,_0x4bb550,_0x271ac7)&&!_0x5e1c6e){if(_0x2601e2[_0x9bd1('0x102')]>=_0x271ac7[_0x9bd1('0x1b3')]){_0x274f6c[_0x9bd1('0x111')](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1be'));}else{_0x274f6c[_0x9bd1('0x105')](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1be'));}}break;case'3':_0x271ac7[_0x9bd1('0x6e')]+=0x1;_0x2601e2[_0x9bd1('0xb5')]=0x3;_0x2601e2['statedesc']=_0x9bd1('0x1bf');_0x2601e2[_0x9bd1('0x1ab')]+=0x1;_0x2601e2['countglobal']+=0x1;var _0x32501e=ut[_0x9bd1('0x1c0')](_0x4bb550,_0x271ac7);ami['emit'](_0x9bd1('0x1c1'),_0x32501e);_0x403225=_0x271ac7[_0x9bd1('0x1ac')];_0x30974f=_0x271ac7[_0x9bd1('0x12a')];_0x274f6c[_0x9bd1('0xe0')](_0x2601e2)[_0x9bd1('0xc0')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x274f6c[_0x9bd1('0x1aa')](0x3,_0x4bb550,_0x271ac7)&&!_0x5e1c6e){if(_0x2601e2[_0x9bd1('0x1ab')]>=_0x271ac7['dialNoAnswerMaxRetry']){_0x274f6c['createStateFinal'](_0x2601e2,_0x469c3c,_0xf9172e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x274f6c['stateGlobal'](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1c2'));}}break;case'5':_0x271ac7['outboundBusyCallsDay']+=0x1;_0x2601e2[_0x9bd1('0xb5')]=0x5;_0x2601e2[_0x9bd1('0xb6')]=_0x9bd1('0x1c3');_0x2601e2['countbusyretry']+=0x1;_0x2601e2[_0x9bd1('0xfd')]+=0x1;ami[_0x9bd1('0x57')]('custom:agentbusy',ut[_0x9bd1('0xf9')](_0x4bb550,_0x9bd1('0x1c4')));_0x403225=_0x271ac7[_0x9bd1('0x1af')];_0x30974f=_0x271ac7['callAdditionalPhoneAfterMin'];_0x274f6c[_0x9bd1('0xe0')](_0x2601e2)['catch'](loggerCatch(_0x9bd1('0x1c5')));if(_0x274f6c[_0x9bd1('0x1aa')](0x5,_0x4bb550,_0x271ac7)&&!_0x5e1c6e){if(_0x2601e2['countbusyretry']>=_0x271ac7[_0x9bd1('0x1ae')]){_0x274f6c[_0x9bd1('0x111')](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1c6'));}else{_0x274f6c[_0x9bd1('0x105')](_0x2601e2,_0x469c3c,_0xf9172e,'reason\x205\x20busy');}}break;case'8':_0x271ac7[_0x9bd1('0x1c7')]+=0x1;_0x2601e2[_0x9bd1('0xb5')]=0x8;_0x2601e2[_0x9bd1('0xb6')]=_0x9bd1('0x1c8');_0x2601e2['countcongestionretry']+=0x1;_0x2601e2[_0x9bd1('0xfd')]+=0x1;_0x403225=_0x271ac7[_0x9bd1('0x1c9')];_0x30974f=_0x271ac7['callAdditionalPhoneAfterMin'];ami[_0x9bd1('0x57')](_0x9bd1('0x1ca'),ut[_0x9bd1('0xf9')](_0x4bb550,_0x9bd1('0x1cb')));_0x274f6c[_0x9bd1('0xe0')](_0x2601e2)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x1cc')));if(_0x274f6c[_0x9bd1('0x1aa')](0x8,_0x4bb550,_0x271ac7)&&!_0x5e1c6e){if(_0x2601e2[_0x9bd1('0x10e')]>=_0x271ac7[_0x9bd1('0x1b1')]){_0x274f6c[_0x9bd1('0x111')](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1cd'));}else{_0x274f6c[_0x9bd1('0x105')](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1cd'));}}break;case'11':_0x271ac7[_0x9bd1('0x1ce')]+=0x1;_0x2601e2[_0x9bd1('0xb5')]=0xb;_0x2601e2[_0x9bd1('0xb6')]='Abandoned';_0x2601e2[_0x9bd1('0x103')]+=0x1;_0x2601e2[_0x9bd1('0xfd')]+=0x1;_0x403225=_0x271ac7[_0x9bd1('0x134')];_0x30974f=_0x271ac7[_0x9bd1('0x12a')];_0x274f6c['createHistory'](_0x2601e2)[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x136')));if(_0x274f6c[_0x9bd1('0x1aa')](0xb,_0x4bb550,_0x271ac7)&&!_0x5e1c6e){if(_0x2601e2[_0x9bd1('0x103')]>=_0x271ac7[_0x9bd1('0x132')]){_0x274f6c[_0x9bd1('0x111')](_0x2601e2,_0x469c3c,_0xf9172e,'reason\x2011\x20abandoned');}else{_0x274f6c[_0x9bd1('0x105')](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1cf'));}}break;case'20':_0x271ac7['outboundRejectCallsDay']+=0x1;_0x2601e2[_0x9bd1('0xb5')]=0x14;_0x2601e2[_0x9bd1('0xb6')]=_0x9bd1('0x1d0');_0x2601e2['countagentrejectretry']+=0x1;_0x2601e2[_0x9bd1('0xfd')]+=0x1;_0x403225=_0x271ac7[_0x9bd1('0x1b6')];_0x30974f=_0x271ac7[_0x9bd1('0x12a')];ami[_0x9bd1('0x57')]('custom:agentreject',ut[_0x9bd1('0xf9')](_0x4bb550,_0x9bd1('0x1d1')));_0x274f6c[_0x9bd1('0xe0')](_0x2601e2)[_0x9bd1('0xc0')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x274f6c['checkRetriveMax'](0x14,_0x4bb550,_0x271ac7)&&!_0x5e1c6e){if(_0x2601e2[_0x9bd1('0x104')]>=_0x271ac7[_0x9bd1('0x1d2')]){_0x274f6c[_0x9bd1('0x111')](_0x2601e2,_0x469c3c,_0xf9172e,_0x9bd1('0x1d3'));}else{_0x274f6c[_0x9bd1('0x105')](_0x2601e2,_0x469c3c,_0xf9172e,'reason\x2020\x20agentreject');}}break;default:_0x271ac7[_0x9bd1('0x72')]+=0x1;_0x2601e2[_0x9bd1('0xb5')]=0xc;_0x2601e2[_0x9bd1('0xb6')]=_0x544795['reason'];_0x403225=_0x271ac7[_0x9bd1('0x1b6')];_0x30974f=_0x271ac7['callAdditionalPhoneAfterMin'];_0x274f6c['createHistory'](_0x2601e2)[_0x9bd1('0xc0')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x274f6c[_0x9bd1('0x1aa')](_0x544795['reason'],_0x4bb550,_0x271ac7)&&!_0x5e1c6e){if(_0x2601e2[_0x9bd1('0x101')]+_0x2601e2[_0x9bd1('0x10e')]+_0x2601e2[_0x9bd1('0x1ab')]+_0x2601e2[_0x9bd1('0x102')]+_0x2601e2[_0x9bd1('0x128')]+_0x2601e2[_0x9bd1('0x103')]+_0x2601e2['countmachineretry']+_0x2601e2[_0x9bd1('0x104')]>=_0x271ac7[_0x9bd1('0x10f')]){_0x274f6c[_0x9bd1('0x105')](_0x2601e2,_0x469c3c,_0xf9172e,_0x544795[_0x9bd1('0x11a')]);}else{_0x274f6c[_0x9bd1('0x111')](_0x2601e2,_0x469c3c,_0xf9172e,_0x544795['reason']);}}}})[_0x9bd1('0x44')](function(){if(_0x5e1c6e){_0x274f6c[_0x9bd1('0xcc')](_0x2601e2,_0x403225,_0x30974f)[_0x9bd1('0x44')](function(){return _0x469c3c(0x1);});}});});};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x105')]=function(_0x40295b,_0x272772,_0x1c6a35,_0x3b5cfc){var _0x1409cb=new Final(_0x40295b);_0x1409cb[_0x9bd1('0xb5')]=0xf;_0x1409cb[_0x9bd1('0xb6')]=_0x9bd1('0x1d4');this[_0x9bd1('0x111')](_0x1409cb,_0x272772,_0x1c6a35,_0x3b5cfc);};Dialer['prototype'][_0x9bd1('0x111')]=function(_0x2e2a3d,_0x3b9529,_0xfc6c54,_0x54b6e7){this[_0x9bd1('0xde')](_0x2e2a3d)[_0x9bd1('0x44')](function(){return _0x3b9529(msgResponse(_0x9bd1('0x1b9'),_0x9bd1('0xec'),_0x54b6e7));})['catch'](function(){return _0xfc6c54(msgResponse('[moveContactManagedDialer][0]',_0x9bd1('0x155'),'contact\x20not\x20moved'));});};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x8')]=function(_0x3ccb20){var _0x134395=_0x3ccb20[_0x9bd1('0x1d5')]/0x64;var _0x46afb3=_0x3ccb20[_0x9bd1('0x6d')]/(_0x3ccb20[_0x9bd1('0x6d')]+_0x3ccb20[_0x9bd1('0x68')]);var _0x3655a6=Math[_0x9bd1('0x1d6')](_0x3ccb20[_0x9bd1('0x79')]*(_0x3ccb20['predictiveIntervalMaxThreshold']/0x64));var _0x3e899a=Math['round'](_0x3ccb20[_0x9bd1('0x79')]*(_0x3ccb20[_0x9bd1('0x1d7')]/0x64));var _0x493cc0=_0x3ccb20['available']+_0x3ccb20[_0x9bd1('0xae')];var _0x334bea=Math['floor'](_0x3ccb20[_0x9bd1('0x7a')]*_0x3ccb20['erlangAbandonmentRate']*_0x3ccb20[_0x9bd1('0x77')]*_0x3ccb20[_0x9bd1('0x78')]);if(_[_0x9bd1('0x46')](_0x3ccb20[_0x9bd1('0x2b')])){if(!_[_0x9bd1('0x46')](_0x3ccb20[_0x9bd1('0x2a')])){_0x3ccb20['startPredictive']=undefined;loggerPredictive[_0x9bd1('0xa1')](_0x9bd1('0x1d8'),_0x9bd1('0x1d9'));}if(!_['isUndefined'](_0x3ccb20[_0x9bd1('0x99')])){loggerPredictive['error'](_0x9bd1('0x1d8'),_0x9bd1('0x1da'));clearInterval(_0x3ccb20[_0x9bd1('0x99')]);_0x3ccb20[_0x9bd1('0x99')]=undefined;}_0x3ccb20[_0x9bd1('0x2b')]=moment()['format'](_0x9bd1('0x108'));loggerPredictive[_0x9bd1('0x85')](_0x3ccb20[_0x9bd1('0x49')],'collection\x20data\x20in\x20progressive\x20at',_0x3ccb20[_0x9bd1('0x2b')]);this[_0x9bd1('0x166')](_0x3ccb20,0x1);}else if(ifInterval(_0x3ccb20['dialPredictiveInterval'],_0x3ccb20[_0x9bd1('0x2b')])){this[_0x9bd1('0x166')](_0x3ccb20,0x1);loggerPredictiveCalls[_0x9bd1('0x85')](_0x9bd1('0x1db'),_0x3ccb20[_0x9bd1('0x2b')],_0x3ccb20[_0x9bd1('0x49')]);_0x3ccb20[_0x9bd1('0x7a')]=0x0;_0x3ccb20['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x134395<_0x46afb3&&_0x3ccb20[_0x9bd1('0x1dc')]===_0x9bd1('0x1dd')){freeVariablesPredictive(_0x3ccb20);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x1de'),'Dropped\x20calls\x20day',_0x46afb3,_0x9bd1('0x2b'),_0x3ccb20[_0x9bd1('0x49')]);}else if(_0x334bea<_0x3ccb20[_0x9bd1('0x124')]&&_0x3ccb20['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3ccb20);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x1df'),'Max\x20Drop\x20',_0x334bea,_0x9bd1('0x1e0'),_0x3ccb20[_0x9bd1('0x124')],_0x9bd1('0x2b'),_0x3ccb20['name']);}else if(!ifInterval(_0x3ccb20[_0x9bd1('0x1e1')],_0x3ccb20[_0x9bd1('0x2b')])&&_['isUndefined'](_0x3ccb20[_0x9bd1('0x2a')])&&!_[_0x9bd1('0x46')](_0x3ccb20['startProgressive'])){_0x3ccb20[_0x9bd1('0x2a')]=moment()[_0x9bd1('0x82')](_0x9bd1('0x108'));loggerPredictive[_0x9bd1('0x85')](_0x3ccb20[_0x9bd1('0x49')],_0x9bd1('0x1e2'),_0x3ccb20[_0x9bd1('0x2a')]);this[_0x9bd1('0xd0')](_0x3ccb20[_0x9bd1('0x1e1')])[_0x9bd1('0x44')](this[_0x9bd1('0x1e3')](_0x3ccb20))[_0x9bd1('0x44')](mergeDataErlangB(_0x3ccb20))[_0x9bd1('0x44')](this[_0x9bd1('0x1e4')](_0x3ccb20))[_0x9bd1('0xc0')](loggerCatchPredictive(_0x9bd1('0x1e5'),_0x3ccb20));}else if(!ifInterval(_0x3ccb20['dialPredictiveInterval'],_0x3ccb20[_0x9bd1('0x2a')])){_0x3ccb20[_0x9bd1('0x124')]=0x0;_0x3ccb20['startPredictive']=moment()[_0x9bd1('0x82')](_0x9bd1('0x108'));loggerPredictive['info'](_0x3ccb20[_0x9bd1('0x49')],_0x9bd1('0x1e6'),_0x3ccb20[_0x9bd1('0x2a')]);clearInterval(_0x3ccb20[_0x9bd1('0x99')]);_0x3ccb20[_0x9bd1('0x99')]=undefined;this[_0x9bd1('0xd0')](_0x3ccb20[_0x9bd1('0x1e1')])['then'](this[_0x9bd1('0x1e3')](_0x3ccb20))['then'](mergeDataErlangB(_0x3ccb20))[_0x9bd1('0x44')](this['startMethodPredictive'](_0x3ccb20))[_0x9bd1('0xc0')](loggerCatchPredictive(_0x9bd1('0x1e7'),_0x3ccb20));}else if(_0x3ccb20[_0x9bd1('0x79')]&&_0x493cc0<_0x3ccb20[_0x9bd1('0x79')]-_0x3e899a){freeVariablesPredictive(_0x3ccb20);loggerPredictive['info'](_0x3ccb20[_0x9bd1('0x49')],_0x9bd1('0x1e8'),_0x493cc0,')\x20are\x20less\x20than\x20threshold\x20(',_0x3ccb20[_0x9bd1('0x79')],'-',_0x3e899a,'=',_0x3ccb20[_0x9bd1('0x79')]-_0x3e899a,')');}else if(_0x3ccb20[_0x9bd1('0x79')]&&_0x493cc0>_0x3ccb20[_0x9bd1('0x79')]+_0x3655a6){freeVariablesPredictive(_0x3ccb20);loggerPredictive['info'](_0x3ccb20[_0x9bd1('0x49')],_0x9bd1('0x1e8'),_0x493cc0,_0x9bd1('0x1e9'),_0x3ccb20['predictiveIntervalAvailable'],'+',_0x3655a6,'=',_0x3ccb20['predictiveIntervalAvailable']+_0x3655a6,')');}};Dialer[_0x9bd1('0x1c')]['getDataPredictive']=function(_0x4124ad){var _0x26fc8a=this;return function(_0x22423a){return new Promise(function(_0x477594,_0x2c6825){_[_0x9bd1('0x96')](_0x4124ad,_0x22423a[0x0]);if(checkGetDataPredictive(_0x22423a[0x0])){var _0x2b7010=_0x4124ad['predictiveIntervalAvailable']=_0x4124ad[_0x9bd1('0xae')]+_0x4124ad[_0x9bd1('0xaf')];var _0x45a928=_0x4124ad[_0x9bd1('0x1e1')]*0x3c;var _0xaff3e0=_0x22423a[0x0][_0x9bd1('0x1ea')]+_0x22423a[0x0][_0x9bd1('0x8e')];var _0x2fce1a=(_0x22423a[0x0]['predictiveIntervalAnsweredCalls']+_0x22423a[0x0][_0x9bd1('0x75')]+_0x22423a[0x0][_0x9bd1('0x74')])/_0x22423a[0x0][_0x9bd1('0x86')];_0x4124ad[_0x9bd1('0x77')]=_0x2fce1a>0x0?_0x2fce1a:0x1;switch(_0x4124ad[_0x9bd1('0x1dc')]){case _0x9bd1('0x1dd'):var _0x3e2a84=_0x4124ad[_0x9bd1('0x1d5')]/0x64;return _0x26fc8a[_0x9bd1('0x1eb')](_0x2b7010,_0x45a928,_0xaff3e0,_0x2fce1a,_0x3e2a84)[_0x9bd1('0x44')](function(_0x1b663f){return _0x477594(_0x1b663f);});case _0x9bd1('0x1ec'):var _0x39b3f0=_0x4124ad[_0x9bd1('0x1d5')]/0x64;return _0x26fc8a[_0x9bd1('0x1ed')](_0x2b7010,_0x45a928,_0xaff3e0,_0x2fce1a,_0x39b3f0)[_0x9bd1('0x44')](function(_0x4660f1){return _0x477594(_0x4660f1);});default:return _0x2c6825(msgResponse('[getDataPredictive]',_0x9bd1('0x155'),_0x9bd1('0x1ee')));}}else{return _0x2c6825(msgResponse(_0x9bd1('0x1ef'),'Failure',_0x9bd1('0x1f0')));}});};};Dialer['prototype'][_0x9bd1('0x1f1')]=function(_0x1774e9){var _0x623ae3=this;return function(_0x178336){return new Promise(function(_0x3d6a04,_0x274861){_['merge'](_0x1774e9,_0x178336[0x0]);if(checkGetDataPredictive(_0x178336[0x0])){loggerPredictive[_0x9bd1('0x85')](JSON['stringify'](_0x178336[0x0]));if(_0x1774e9[_0x9bd1('0x1dc')]===_0x9bd1('0x1dd')){return _0x623ae3[_0x9bd1('0xdc')](_0x1774e9['id'])[_0x9bd1('0x44')](function(_0x23b457){var _0x282a3e=_0x1774e9[_0x9bd1('0x5a')]-_0x23b457[0x0]['outboundQueuePauses'];var _0x36c48e=_0x1774e9[_0x9bd1('0x1e1')]*0x3c;var _0x47e5b3=_0x178336[0x0][_0x9bd1('0x1ea')]+_0x178336[0x0][_0x9bd1('0x8e')];var _0x1fb143=(_0x178336[0x0][_0x9bd1('0x73')]+_0x178336[0x0][_0x9bd1('0x75')]+_0x178336[0x0][_0x9bd1('0x74')])/_0x178336[0x0]['predictiveIntervalTotalCalls'];var _0x32928c=_0x1774e9[_0x9bd1('0x1d5')]/0x64;_0x1774e9[_0x9bd1('0x1f2')]=_0x23b457[0x0][_0x9bd1('0x1f3')]||0x0;_0x1774e9[_0x9bd1('0x77')]=_0x1fb143>0x0?_0x1fb143:0x1;return _0x623ae3[_0x9bd1('0x1eb')](_0x282a3e,_0x36c48e,_0x47e5b3,_0x1fb143,_0x32928c);})[_0x9bd1('0x44')](function(_0xd45e58){return _0x3d6a04(_0xd45e58);})['catch'](function(_0x4dfdb1){return _0x274861(msgResponse(_0x9bd1('0x1f4'),_0x9bd1('0x155'),JSON[_0x9bd1('0x53')](_0x4dfdb1)));});}if(_0x1774e9[_0x9bd1('0x1dc')]===_0x9bd1('0x1ec')){return _0x623ae3[_0x9bd1('0xdc')](_0x1774e9['id'])[_0x9bd1('0x44')](function(_0x505bc2){var _0x1b927b=_0x1774e9[_0x9bd1('0x5a')]-_0x505bc2[0x0][_0x9bd1('0x1f3')];var _0x7028b1=_0x1774e9[_0x9bd1('0x1e1')]*0x3c;var _0x15b887=_0x178336[0x0]['predictiveIntervalAvgTalktime']+_0x178336[0x0][_0x9bd1('0x8e')];var _0x4ff5b5=(_0x178336[0x0]['predictiveIntervalAnsweredCalls']+_0x178336[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x178336[0x0][_0x9bd1('0x74')])/_0x178336[0x0][_0x9bd1('0x86')];var _0x1eae39=_0x1774e9[_0x9bd1('0x1d5')]/0x64;_0x1774e9[_0x9bd1('0x1f2')]=_0x505bc2[0x0][_0x9bd1('0x1f3')]||0x0;_0x1774e9[_0x9bd1('0x77')]=_0x4ff5b5>0x0?_0x4ff5b5:0x1;return _0x623ae3[_0x9bd1('0x1ed')](_0x1b927b,_0x7028b1,_0x15b887,_0x4ff5b5,_0x1eae39);})['then'](function(_0x2b9da){return _0x3d6a04(_0x2b9da);})[_0x9bd1('0xc0')](function(_0x5129ef){return _0x274861(msgResponse(_0x9bd1('0x1f4'),_0x9bd1('0x155'),JSON['stringify'](_0x5129ef)));});}}else{return _0x274861(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer['prototype'][_0x9bd1('0x1e4')]=function(_0x27664c){var _0x5b74df=this;return function(){var _0x24c8f5=0x0;var _0x43dba6=Math[_0x9bd1('0x1f5')](_0x27664c[_0x9bd1('0x94')]*0x3e8);if(_0x43dba6>0x0){_0x43dba6=_0x43dba6<0x64?0x64:_0x43dba6;loggerPredictive[_0x9bd1('0x85')](_0x27664c['name'],_0x9bd1('0x1f6'),_0x43dba6,'milliseconds');_0x27664c[_0x9bd1('0x99')]=setInterval(function(){_0x5b74df['handlePredictive'](_0x27664c);loggerPredictiveCalls[_0x9bd1('0x85')](_0x9bd1('0x1f7'),_0x24c8f5+=0x1);},_0x43dba6);}else{loggerPredictive[_0x9bd1('0x85')](_0x27664c[_0x9bd1('0x49')],_0x9bd1('0x1f8'));}};};Dialer['prototype'][_0x9bd1('0x1f9')]=function(_0x5eb9b5,_0x3ee519){var _0x521b6c=this;return function(_0x3e200a){if(_['isEmpty'](_0x3e200a)){if(_[_0x9bd1('0xbc')](_0x3ee519[_0x9bd1('0xe7')])||!_0x3ee519['recallme']){if(_0x5eb9b5[_0x9bd1('0x63')]===_0x9bd1('0x1fa')){_0x5eb9b5[_0x9bd1('0x13e')]=_[_0x9bd1('0x46')](_0x5eb9b5[_0x9bd1('0x13e')])?!![]:_0x5eb9b5[_0x9bd1('0x13e')];var _0x2f03cb=uuid['v4']();_0x521b6c['actions'][_0x2f03cb]=new Action(_0x5eb9b5,_0x3ee519,_0x2f03cb);loggerBooked[_0x9bd1('0x85')](_0x9bd1('0x1fb'),_0x2f03cb,_0x9bd1('0x1fc'),JSON[_0x9bd1('0x53')](_0x5eb9b5[_0x9bd1('0x13e')]),_0x9bd1('0x1fd'),_0x5eb9b5[_0x9bd1('0x49')]);if(_0x5eb9b5[_0x9bd1('0x13e')]){_0x5eb9b5['queueStatusComplete']=![];_0x521b6c['queueBooked'][_0x521b6c['actions'][_0x2f03cb][_0x9bd1('0xc3')]]=[];ami[_0x9bd1('0xbd')]({'actionid':_0x2f03cb,'action':'queuestatus','queue':_0x5eb9b5[_0x9bd1('0x49')]})[_0x9bd1('0xc0')](function(){_0x521b6c[_0x9bd1('0xc2')](_0x5eb9b5);_0x521b6c[_0x9bd1('0xd3')]({'active':![],'ContactId':_0x521b6c[_0x9bd1('0xbb')][_0x2f03cb]['ContactId'],'ListId':_0x521b6c[_0x9bd1('0xbb')][_0x2f03cb]['ListId'],'VoiceQueueId':_0x521b6c['actions'][_0x2f03cb][_0x9bd1('0xe8')]||undefined,'CampaignId':_0x521b6c[_0x9bd1('0xbb')][_0x2f03cb]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x521b6c[_0x9bd1('0xbb')][_0x2f03cb];});}else{loggerBooked[_0x9bd1('0x85')](_0x9bd1('0x1fe'),JSON[_0x9bd1('0x53')](_0x5eb9b5[_0x9bd1('0x13e')]),_0x9bd1('0x1fd'),_0x5eb9b5[_0x9bd1('0x49')]);_0x521b6c[_0x9bd1('0xc2')](_0x5eb9b5);_0x521b6c[_0x9bd1('0xd3')]({'active':![],'ContactId':_0x521b6c[_0x9bd1('0xbb')][_0x2f03cb][_0x9bd1('0xe5')],'ListId':_0x521b6c['actions'][_0x2f03cb][_0x9bd1('0xe6')],'VoiceQueueId':_0x521b6c[_0x9bd1('0xbb')][_0x2f03cb]['VoiceQueueId']||undefined,'CampaignId':_0x521b6c['actions'][_0x2f03cb]['CampaignId']||undefined})[_0x9bd1('0xc0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x521b6c[_0x9bd1('0xbb')][_0x2f03cb];}}else{return _0x521b6c[_0x9bd1('0x17c')](_0x5eb9b5,_0x3ee519);}}else{if(getDiff(_0x3ee519[_0x9bd1('0x1ff')])<_0x5eb9b5[_0x9bd1('0x200')]*0x3c){if(_0x3ee519[_0x9bd1('0x16a')]&&!_0x3ee519[_0x9bd1('0x16a')][_0x9bd1('0x201')]){_0x521b6c[_0x9bd1('0x9b')]['run'](_0x3ee519['id'])[_0x9bd1('0x1f')](function(){_0x521b6c['updateOriginated'](_0x5eb9b5);});}else{_0x521b6c[_0x9bd1('0xd5')]({'active':![]},_0x3ee519['id'],0x1)[_0x9bd1('0x1f')](function(){_0x521b6c[_0x9bd1('0xc2')](_0x5eb9b5);});}}else{_0x5eb9b5['outboundReCallsDay']+=0x1;_0x521b6c['updateOriginated'](_0x5eb9b5);if(_0x5eb9b5[_0x9bd1('0x202')]){_0x521b6c[_0x9bd1('0xd3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ee519[_0x9bd1('0xe5')],'ListId':_0x3ee519[_0x9bd1('0xe6')],'VoiceQueueId':_0x3ee519[_0x9bd1('0xe8')]||undefined,'CampaignId':_0x3ee519[_0x9bd1('0xe9')]||undefined})[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x203')));_0x521b6c['createHistory'](createObjHistory(_0x5eb9b5,_0x3ee519,'RECALLINQUEUE',0x17,_0x9bd1('0x204')))[_0x9bd1('0xc0')](loggerCatch(_0x9bd1('0x205')));}else{_0x521b6c[_0x9bd1('0xe4')](createObjHistory(_0x5eb9b5,_0x3ee519,_0x9bd1('0x206'),0x16,_0x9bd1('0x207')),_0x9bd1('0x208'),'[Originate][HistoryRecallClose]');}}}}else{_0x5eb9b5[_0x9bd1('0x69')]+=0x1;_0x521b6c['saveInDb'](createObjHistory(_0x5eb9b5,_0x3ee519,'BLACKLIST',0xd,_0x9bd1('0x209')),'[Originate][historyBlacklist]',_0x9bd1('0x20a'));throw _0x9bd1('0x20b');}};};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x16c')]=function(_0xf5eaed){var _0x2e059b=this;var _0x48d677=_0xf5eaed[_0x9bd1('0x20c')]-_0xf5eaed[_0x9bd1('0xa5')]-_0xf5eaed[_0x9bd1('0xda')];emitCampaignSummary(_0xf5eaed);if(_0x48d677>0x0){if(_0x48d677>this['maxNumberOriginate']){_0x48d677=this['maxNumberOriginate'];}_0xf5eaed['temp']+=_0x48d677;this['getContactDialerIvr'](_0xf5eaed['id'],_0x48d677,_0xf5eaed[_0x9bd1('0x20d')],_0xf5eaed)[_0x9bd1('0x44')](function(_0x1669b9){_0xf5eaed[_0x9bd1('0xda')]-=_0x48d677;_0xf5eaed[_0x9bd1('0xda')]=_0xf5eaed[_0x9bd1('0xda')]>0x0?_0xf5eaed['temp']:0x0;if(!checkContactEmpty(_0x1669b9)){_0xf5eaed[_0x9bd1('0x47')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x9bd1('0x85')]('[getContactCampaign2][Empty]'+_0xf5eaed[_0x9bd1('0x49')]);}else{_0xf5eaed['originated']+=_0x1669b9[_0x9bd1('0xa4')];_0xf5eaed[_0x9bd1('0x47')]=_0x9bd1('0x20e');for(var _0x38283c=0x0;_0x38283c<_0x1669b9[_0x9bd1('0xa4')];_0x38283c+=0x1){_0xf5eaed['ivrTotalCallsDays']+=0x1;if(_[_0x9bd1('0xbc')](_0x1669b9[_0x38283c])||_[_0x9bd1('0xbc')](_0x1669b9[_0x38283c]['Contact'])||_[_0x9bd1('0xbc')](_0x1669b9[_0x38283c][_0x9bd1('0x180')])){_0x2e059b[_0x9bd1('0xe3')](_0x9bd1('0x20f'),_0xf5eaed,_0x1669b9[_0x38283c]);}else{_0x2e059b[_0x9bd1('0xce')](_['pick'](_0x1669b9[_0x38283c],['CampaignId','phone']))['then'](_0x2e059b[_0x9bd1('0x1f9')](_0xf5eaed,_0x1669b9[_0x38283c]))[_0x9bd1('0xc0')](_0x2e059b['loggerHandler']('[actionOriginateIvr]\x20',_0xf5eaed));}}}})[_0x9bd1('0xc0')](loggerGetContactDialer(_0x9bd1('0x210'),_0xf5eaed,_0x48d677));}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x166')]=function(_0x29c896,_0x5735d6){var _0x54dd13=this;var _0xb94ba1=[];var _0x3af049=_0x5735d6>=0x1?_0x5735d6:0x1;if(_0x29c896[_0x9bd1('0x63')]===_0x9bd1('0x1fa')){_0x3af049=0x1;}var _0x245eaf=Math[_0x9bd1('0x1f5')](_0x29c896[_0x9bd1('0xaf')]*_0x3af049)-_0x29c896[_0x9bd1('0xa5')]-_0x29c896['temp'];emitVoiceQueueSummary(_0x29c896);if(_0x29c896['dialLimitQueue']>0x0){var _0xb76b7b=_0x29c896[_0x9bd1('0x211')]-_0x29c896[_0x9bd1('0xa5')]-_0x29c896[_0x9bd1('0xae')]-_0x29c896[_0x9bd1('0xda')]-_0x29c896[_0x9bd1('0x5b')];if(_0x245eaf>_0xb76b7b){_0x245eaf=_0xb76b7b;}}if(_0x245eaf>0x0){if(_0x29c896[_0x9bd1('0x63')]===_0x9bd1('0x1fa')){_0x245eaf=0x1;}if(_0x245eaf>this[_0x9bd1('0x25')]){_0x245eaf=this[_0x9bd1('0x25')];}_0x29c896[_0x9bd1('0xda')]+=_0x245eaf;for(var _0x43c03f in this[_0x9bd1('0x23')]){if(typeof this[_0x9bd1('0x23')][_0x43c03f]!==_0x9bd1('0xa6')){if(this[_0x9bd1('0x23')][_0x43c03f][_0x9bd1('0xb5')]==='not_inuse'&&this[_0x9bd1('0x23')][_0x43c03f]['status']===_0x9bd1('0xee')){_0xb94ba1[_0x9bd1('0x13b')](this[_0x9bd1('0x23')][_0x43c03f]['id']);}}}this['getContactDialer'](_0x29c896['id'],_0xb94ba1,_0x245eaf,_0x29c896['dialOrderByScheduledAt'],_0x29c896)[_0x9bd1('0x44')](function(_0x30015d){_0x29c896['temp']-=_0x245eaf;_0x29c896[_0x9bd1('0xda')]=_0x29c896['temp']>0x0?_0x29c896[_0x9bd1('0xda')]:0x0;if(!checkContactEmpty(_0x30015d)){_0x54dd13[_0x9bd1('0xc6')](_0x29c896)[_0x9bd1('0x44')](sendMessageReschedule(_0x29c896))[_0x9bd1('0xc0')](loggerCatch('[countReScheduled]\x20'));}else{_0x29c896[_0x9bd1('0xa5')]+=_0x30015d['length'];_0x29c896[_0x9bd1('0x47')]=_0x29c896[_0x9bd1('0x63')]===_0x9bd1('0x1fa')?_0x9bd1('0x212'):_0x9bd1('0x20e');for(var _0x11e65e=0x0;_0x11e65e<_0x30015d[_0x9bd1('0xa4')];_0x11e65e+=0x1){if(_[_0x9bd1('0xbc')](_0x30015d[_0x11e65e])||_[_0x9bd1('0xbc')](_0x30015d[_0x11e65e][_0x9bd1('0x199')])||_['isNil'](_0x30015d[_0x11e65e][_0x9bd1('0x180')])){_0x54dd13[_0x9bd1('0xe3')](_0x9bd1('0x20f'),_0x29c896,_0x30015d[_0x11e65e]);}else{_0x54dd13[_0x9bd1('0xc9')](_[_0x9bd1('0x140')](_0x30015d[_0x11e65e],[_0x9bd1('0xe8'),_0x9bd1('0x180')]))['then'](_0x54dd13[_0x9bd1('0x1f9')](_0x29c896,_0x30015d[_0x11e65e]))['catch'](_0x54dd13[_0x9bd1('0xe2')](_0x9bd1('0x20f'),_0x29c896));}}}})[_0x9bd1('0xc0')](loggerGetContactDialer(_0x9bd1('0x213'),_0x29c896,_0x245eaf));}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x99')]=function(_0x1fbab8){if(_0x1fbab8[_0x9bd1('0x211')]>0x0){var _0xf6353c=_0x1fbab8['dialLimitQueue']-_0x1fbab8[_0x9bd1('0xa5')]-_0x1fbab8[_0x9bd1('0xae')];if(_0xf6353c>0x0){this['tryOriginatePredictive'](_0x1fbab8);}else{loggerPredictiveCalls[_0x9bd1('0x85')]('[handlePredictive][limitChannel]');}}else{this[_0x9bd1('0x214')](_0x1fbab8);}};Dialer[_0x9bd1('0x1c')][_0x9bd1('0x214')]=function(_0x2ad53a){var _0x58d4f0=this;var _0x3f0555=[];_0x2ad53a['originated']+=0x1;for(var _0x4eaba7 in this[_0x9bd1('0x23')]){if(typeof this[_0x9bd1('0x23')][_0x4eaba7]!==_0x9bd1('0xa6')){if(this[_0x9bd1('0x23')][_0x4eaba7][_0x9bd1('0xb5')]===_0x9bd1('0x215')&&this[_0x9bd1('0x23')][_0x4eaba7][_0x9bd1('0xbe')]===_0x9bd1('0xee')){_0x3f0555[_0x9bd1('0x13b')](this['agents'][_0x4eaba7]['id']);}}}this[_0x9bd1('0xd7')](_0x2ad53a['id'],_0x3f0555,0x1,_0x2ad53a['dialOrderByScheduledAt'],_0x2ad53a)[_0x9bd1('0x44')](function(_0x21e54a){if(!checkContactEmpty(_0x21e54a)){checkContactLowerLimitOriginate(_0x2ad53a,0x1,0x0);_0x58d4f0[_0x9bd1('0xc6')](_0x2ad53a)[_0x9bd1('0x44')](sendMessageReschedule(_0x2ad53a))[_0x9bd1('0xc0')](loggerCatch('[countReScheduled]\x20'));}else{_0x2ad53a[_0x9bd1('0x47')]=_0x9bd1('0x20e');if(_[_0x9bd1('0xbc')](_0x21e54a[0x0])||_[_0x9bd1('0xbc')](_0x21e54a[0x0][_0x9bd1('0x199')])||_[_0x9bd1('0xbc')](_0x21e54a[0x0][_0x9bd1('0x180')])){_0x58d4f0[_0x9bd1('0xe3')](_0x9bd1('0x20f'),_0x2ad53a,_0x21e54a[0x0]);}else{_0x58d4f0['checkIsBlackList'](_[_0x9bd1('0x140')](_0x21e54a[0x0],[_0x9bd1('0xe8'),_0x9bd1('0x180')]))['then'](_0x58d4f0['checkContactBlack'](_0x2ad53a,_0x21e54a[0x0]))[_0x9bd1('0xc0')](_0x58d4f0[_0x9bd1('0xe2')](_0x9bd1('0x216'),_0x2ad53a));}}})[_0x9bd1('0xc0')](loggerGetContactDialer(_0x9bd1('0x217'),_0x2ad53a,0x1));emitVoiceQueueSummary(_0x2ad53a);};Dialer[_0x9bd1('0x1c')]['abandonmentRate']=function(_0x4256d1,_0x422bdc,_0x5ad09a,_0x77d608,_0x3253bb,_0x130ff9){loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x218'));loggerPredictive['info'](_0x9bd1('0x219'),_0x4256d1);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x21a'),_0x422bdc);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x21b'),_0x5ad09a);loggerPredictive[_0x9bd1('0x85')]('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',_0x77d608);loggerPredictive['info'](_0x9bd1('0x21c'),_0x3253bb);loggerPredictive['info'](_0x9bd1('0x8c'));return new Promise(function(_0x22dce1,_0x4c68e0){if(_0x4256d1<=0x0||isNaN(_0x4256d1)){return _0x4c68e0(msgResponse(_0x9bd1('0x21d'),_0x9bd1('0x21e'),'m\x20=\x20'+_0x4256d1));}if(_0x5ad09a<=0x0||isNaN(_0x5ad09a)){return _0x4c68e0(msgResponse(_0x9bd1('0x21d'),_0x9bd1('0x21e'),_0x9bd1('0x21f')+_0x5ad09a));}if(_0x77d608<=0x0||isNaN(_0x77d608)){return _0x4c68e0(msgResponse('[abandonmentRate]','Error',_0x9bd1('0x220')+_0x77d608));}if(_0x422bdc<=0x0||isNaN(_0x422bdc)){return _0x4c68e0(msgResponse(_0x9bd1('0x21d'),_0x9bd1('0x21e'),'interval\x20=\x20'+_0x422bdc));}if(_0x3253bb<=0x0||isNaN(_0x3253bb)){return _0x4c68e0(msgResponse(_0x9bd1('0x21d'),_0x9bd1('0x21e'),_0x9bd1('0x221')+_0x3253bb));}_0x130ff9=_0x130ff9||0x0;var _0x429bed=0x1/_0x5ad09a;var _0x18b617=0x0;var _0x32ad57=0x0;var _0x226e33=0x0;var _0xf35c48=0x0;for(var _0x632955=0x0;_0x226e33<_0x3253bb;_0x632955+=0x1){_0x32ad57=_0x632955/_0x422bdc;_0x18b617=(_0x77d608*_0x32ad57+_0x130ff9)/_0x429bed;_0x226e33=erlangb(_0x18b617,_0x4256d1);_0xf35c48=_0x18b617/_0x4256d1*(0x1-erlangb(_0x18b617,_0x4256d1));}return _0x22dce1({'erlangCalls':_0x632955,'erlangCallToSecond':_0x422bdc/_0x632955,'erlangAbandonmentRate':_0x226e33,'erlangBusyFactor':_0xf35c48});});};Dialer[_0x9bd1('0x1c')]['busyFactor']=function(_0x42299f,_0x45c26d,_0x1b5e4e,_0x374dc4,_0x168314,_0xa416b2){loggerPredictive[_0x9bd1('0x85')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x9bd1('0x85')]('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',_0x42299f);loggerPredictive[_0x9bd1('0x85')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45c26d);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x21b'),_0x1b5e4e);loggerPredictive[_0x9bd1('0x85')]('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',_0x374dc4);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x222'),_0x168314);loggerPredictive[_0x9bd1('0x85')](_0x9bd1('0x8c'));return new Promise(function(_0x26c448,_0x152648){if(_0x42299f<=0x0||isNaN(_0x42299f)){return _0x152648(msgResponse('[busyFactor]',_0x9bd1('0x21e'),'m\x20=\x20'+_0x42299f));}if(_0x1b5e4e<=0x0||isNaN(_0x1b5e4e)){return _0x152648(msgResponse(_0x9bd1('0x223'),_0x9bd1('0x21e'),_0x9bd1('0x21f')+_0x1b5e4e));}if(_0x374dc4<=0x0||isNaN(_0x374dc4)){return _0x152648(msgResponse(_0x9bd1('0x223'),_0x9bd1('0x21e'),_0x9bd1('0x220')+_0x374dc4));}if(_0x45c26d<=0x0||isNaN(_0x45c26d)){return _0x152648(msgResponse(_0x9bd1('0x223'),_0x9bd1('0x21e'),_0x9bd1('0x224')+_0x45c26d));}if(_0x168314<=0x0||isNaN(_0x168314)){return _0x152648(msgResponse(_0x9bd1('0x223'),_0x9bd1('0x21e'),_0x9bd1('0x225')+_0x168314));}_0xa416b2=_0xa416b2||0x0;var _0x4f8b6e=0x1/_0x1b5e4e;var _0x5881dc=0x0;var _0x65957f=0x0;var _0x25eb59=0x0;var _0x5a315e=0x0;for(var _0x19e854=0x0;_0x5a315e<_0x168314;_0x19e854+=0x1){_0x65957f=_0x19e854/_0x45c26d;_0x5881dc=(_0x374dc4*_0x65957f+_0xa416b2)/_0x4f8b6e;_0x25eb59=erlangb(_0x5881dc,_0x42299f);_0x5a315e=_0x5881dc/_0x42299f*(0x1-erlangb(_0x5881dc,_0x42299f));}return _0x26c448({'erlangCalls':_0x19e854,'erlangCallToSecond':_0x45c26d/_0x19e854,'erlangAbandonmentRate':_0x25eb59,'erlangBusyFactor':_0x5a315e});});};module[_0x9bd1('0x226')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 65ce140..2492019 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x506e=['countmachineretry','uniqueid','name','number','starttime','responsetime','droptime','endtime','ringtime','membername','connectedlinename','reason','callback','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x506e,0x68));var _0xe506=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x506e[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xe506('0x0'));var _=require(_0xe506('0x1'));var moment=require(_0xe506('0x2'));function getSeconds(_0x28d0bd,_0xa559de){var _0xd38e46=moment(_0x28d0bd)[_0xe506('0x3')](0x0);var _0x4c7d68=moment(_0xa559de)[_0xe506('0x3')](0x0);return _0xd38e46[_0xe506('0x4')](_0x4c7d68,_0xe506('0x5'));}function QueueCallerAbandon(_0x3663df,_0x2b0c0c){this[_0xe506('0x6')]=_0x3663df[_0xe506('0x6')];this['type']=_0x3663df[_0xe506('0x7')];this[_0xe506('0x8')]=_0x3663df[_0xe506('0x7')]===_0xe506('0x9')?_0xe506('0xa'):_0x3663df['type'];this['countbusyretry']=_0x3663df['countbusyretry'];this[_0xe506('0xb')]=_0x3663df[_0xe506('0xb')];this['countnoanswerretry']=_0x3663df[_0xe506('0xc')];this[_0xe506('0xd')]=_0x3663df[_0xe506('0xe')]+_0x3663df['countcongestionretry']+_0x3663df[_0xe506('0xc')]+_0x3663df[_0xe506('0xf')]+_0x3663df['countdropretry']+_0x3663df[_0xe506('0x10')]+_0x3663df['countmachineretry']+_0x3663df[_0xe506('0x11')];this[_0xe506('0xf')]=_0x3663df[_0xe506('0xf')];this['countdropretry']=_0x3663df[_0xe506('0x12')];this['countabandonedretry']=_0x3663df[_0xe506('0x10')];this[_0xe506('0x13')]=_0x3663df[_0xe506('0x13')];this['countagentrejectretry']=_0x3663df['countagentrejectretry'];this[_0xe506('0x14')]=_0x2b0c0c[_0xe506('0x14')];this['calleridname']=_0x3663df[_0xe506('0x15')];this['calleridnum']=_0x3663df[_0xe506('0x16')];this[_0xe506('0x17')]=_0x3663df['starttime'];this['responsetime']=_0x3663df[_0xe506('0x18')];this[_0xe506('0x19')]=_0x3663df['droptime'];this[_0xe506('0x1a')]=this['droptime'];this[_0xe506('0x1b')]=getSeconds(_0x3663df[_0xe506('0x18')],_0x3663df[_0xe506('0x17')]);this['holdtime']=getSeconds(this['droptime'],_0x3663df['responsetime']);this['talktime']=0x0;this[_0xe506('0xa')]=_0x2b0c0c[_0xe506('0xa')];this[_0xe506('0x1c')]=_0x2b0c0c[_0xe506('0x1d')];this[_0xe506('0x1e')]=_0x2b0c0c['reason'];this[_0xe506('0x1f')]=_0x3663df['callback'];this['callbackuniqueid']=_0x3663df['callbackuniqueid'];this['callbackat']=_0x3663df['callbackat'];this['recallme']=_0x3663df[_0xe506('0x20')];this[_0xe506('0x21')]=_0x3663df[_0xe506('0x21')];this['ListId']=_0x3663df[_0xe506('0x22')];this['UserId']=_0x3663df[_0xe506('0x23')];this[_0xe506('0x24')]=_0x3663df[_0xe506('0x24')];this[_0xe506('0x25')]=_0x3663df[_0xe506('0x25')];this['originatecalleridnum']=_0x3663df[_0xe506('0x26')]||'';this[_0xe506('0x27')]=_0x3663df['originatecalleridname']||'';}module[_0xe506('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x3382=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','scheduledat','campaigntype','outbound','type','countbusyretry'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x3382,0xc4));var _0x2338=function(_0x3fd9ec,_0x2face3){_0x3fd9ec=_0x3fd9ec-0x0;var _0x456369=_0x3382[_0x3fd9ec];return _0x456369;};'use strict';var util=require(_0x2338('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x170efb,_0x571977){var _0xc5b1c7=moment(_0x170efb)[_0x2338('0x1')](0x0);var _0x56853b=moment(_0x571977)['milliseconds'](0x0);return _0xc5b1c7[_0x2338('0x2')](_0x56853b,_0x2338('0x3'));}function QueueCallerAbandon(_0x55c1c8,_0x49da0c){this['scheduledat']=_0x55c1c8[_0x2338('0x4')];this['type']=_0x55c1c8['type'];this[_0x2338('0x5')]=_0x55c1c8['type']===_0x2338('0x6')?'queue':_0x55c1c8[_0x2338('0x7')];this[_0x2338('0x8')]=_0x55c1c8[_0x2338('0x8')];this['countcongestionretry']=_0x55c1c8[_0x2338('0x9')];this[_0x2338('0xa')]=_0x55c1c8[_0x2338('0xa')];this[_0x2338('0xb')]=_0x55c1c8[_0x2338('0x8')]+_0x55c1c8[_0x2338('0x9')]+_0x55c1c8['countnoanswerretry']+_0x55c1c8['countnosuchnumberretry']+_0x55c1c8[_0x2338('0xc')]+_0x55c1c8['countabandonedretry']+_0x55c1c8[_0x2338('0xd')]+_0x55c1c8[_0x2338('0xe')];this['countnosuchnumberretry']=_0x55c1c8[_0x2338('0xf')];this[_0x2338('0xc')]=_0x55c1c8[_0x2338('0xc')];this[_0x2338('0x10')]=_0x55c1c8[_0x2338('0x10')];this['countmachineretry']=_0x55c1c8[_0x2338('0xd')];this[_0x2338('0xe')]=_0x55c1c8['countagentrejectretry'];this[_0x2338('0x11')]=_0x49da0c[_0x2338('0x11')];this[_0x2338('0x12')]=_0x55c1c8[_0x2338('0x13')];this[_0x2338('0x14')]=_0x55c1c8[_0x2338('0x15')];this[_0x2338('0x16')]=_0x55c1c8[_0x2338('0x16')];this[_0x2338('0x17')]=_0x55c1c8[_0x2338('0x17')];this[_0x2338('0x18')]=_0x55c1c8[_0x2338('0x18')];this[_0x2338('0x19')]=this[_0x2338('0x18')];this['ringtime']=getSeconds(_0x55c1c8[_0x2338('0x17')],_0x55c1c8[_0x2338('0x16')]);this['holdtime']=getSeconds(this[_0x2338('0x18')],_0x55c1c8[_0x2338('0x17')]);this[_0x2338('0x1a')]=0x0;this[_0x2338('0x1b')]=_0x49da0c['queue'];this[_0x2338('0x1c')]=_0x49da0c[_0x2338('0x1d')];this[_0x2338('0x1e')]=_0x49da0c[_0x2338('0x1e')];this[_0x2338('0x1f')]=_0x55c1c8['callback'];this[_0x2338('0x20')]=_0x55c1c8[_0x2338('0x20')];this[_0x2338('0x21')]=_0x55c1c8[_0x2338('0x21')];this[_0x2338('0x22')]=_0x55c1c8[_0x2338('0x22')];this[_0x2338('0x23')]=_0x55c1c8['ContactId'];this['ListId']=_0x55c1c8['ListId'];this['UserId']=_0x55c1c8[_0x2338('0x24')];this['VoiceQueueId']=_0x55c1c8['VoiceQueueId'];this[_0x2338('0x25')]=_0x55c1c8['CampaignId'];this[_0x2338('0x26')]=_0x55c1c8[_0x2338('0x26')]||'';this['originatecalleridname']=_0x55c1c8[_0x2338('0x27')]||'';}module[_0x2338('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0eeb578..cad61c6 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(_0x4676b0,_0x3a362a){var _0x39ed8a=function(_0x85741e){while(--_0x85741e){_0x4676b0['push'](_0x4676b0['shift']());}};_0x39ed8a(++_0x3a362a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x599120,_0x485114){var _0x38b455=function(_0x42ae7c){while(--_0x42ae7c){_0x599120['push'](_0x599120['shift']());}};_0x38b455(++_0x485114);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 94f1b68..916ab45 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 _0xd142=['syncNewState','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable'];(function(_0x337930,_0x4dc6fd){var _0x324aa4=function(_0x47e8d2){while(--_0x47e8d2){_0x337930['push'](_0x337930['shift']());}};_0x324aa4(++_0x4dc6fd);}(_0xd142,0x1b0));var _0x2d14=function(_0xce51e,_0x5d388f){_0xce51e=_0xce51e-0x0;var _0x442be7=_0xd142[_0xce51e];return _0x442be7;};'use strict';var util=require(_0x2d14('0x0'));var _=require('lodash');var BPromise=require(_0x2d14('0x1'));var uuid=require(_0x2d14('0x2'));var moment=require('moment');var path=require(_0x2d14('0x3'));var tiff2pdf=require(_0x2d14('0x4'));var gs=require(_0x2d14('0x5'));var logger=require(_0x2d14('0x6'))(_0x2d14('0x7'));var ami=require(_0x2d14('0x8'));var rpcDb=require(_0x2d14('0x9'));var Channel=require(_0x2d14('0xa'));var ut=require(_0x2d14('0xb'));var Action=require(_0x2d14('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x2d14('0xd'));var faxMessage=require(_0x2d14('0xe'));function Fax(_0x2bf827){this['channels']={};this[_0x2d14('0xf')]=_0x2bf827[_0x2d14('0xf')];this[_0x2d14('0x10')]=_0x2bf827['trunks'];this[_0x2d14('0x11')]={};ami['on'](_0x2d14('0x12'),this[_0x2d14('0x13')][_0x2d14('0x14')](this));ami['on']('varset',this[_0x2d14('0x15')][_0x2d14('0x14')](this));ami['on'](_0x2d14('0x16'),this['syncNewState'][_0x2d14('0x14')](this));ami['on'](_0x2d14('0x17'),this[_0x2d14('0x18')][_0x2d14('0x14')](this));ami['on'](_0x2d14('0x19'),this[_0x2d14('0x1a')][_0x2d14('0x14')](this));ami['on']('receivefax',this[_0x2d14('0x1b')][_0x2d14('0x14')](this));ami['on']('hangup',this[_0x2d14('0x1c')][_0x2d14('0x14')](this));ami['on'](_0x2d14('0x1d'),this[_0x2d14('0x1e')]['bind'](this));}Fax[_0x2d14('0x1f')]['syncNewchannel']=function(_0x4351ee){if(_0x4351ee[_0x2d14('0x20')]===_0x2d14('0x21')){for(var _0x5b9b6c in this[_0x2d14('0xf')]){if(this[_0x2d14('0xf')][_0x2d14('0x22')](_0x5b9b6c)){if(_0x4351ee[_0x2d14('0x23')]===this[_0x2d14('0xf')][_0x5b9b6c][_0x2d14('0x24')]){this[_0x2d14('0x25')][_0x4351ee[_0x2d14('0x26')]]={};this[_0x2d14('0x25')][_0x4351ee[_0x2d14('0x26')]][_0x2d14('0x27')]=_0x4351ee[_0x2d14('0x27')];this[_0x2d14('0x25')][_0x4351ee[_0x2d14('0x26')]]['id']=this[_0x2d14('0xf')][_0x5b9b6c]['id'];this['channels'][_0x4351ee[_0x2d14('0x26')]]['name']=this[_0x2d14('0xf')][_0x5b9b6c][_0x2d14('0x28')];logger[_0x2d14('0x29')](_0x4351ee[_0x2d14('0x26')],_0x2d14('0x2a'));}}}}if(this[_0x2d14('0x11')][_0x4351ee['uniqueid']]){this['channels'][_0x4351ee[_0x2d14('0x26')]]={};this['channels'][_0x4351ee[_0x2d14('0x26')]][_0x2d14('0x27')]=_0x4351ee['channel'];logger['info'](_0x4351ee[_0x2d14('0x26')],_0x2d14('0x2a'));}};Fax[_0x2d14('0x1f')][_0x2d14('0x15')]=function(_0x1bf818){if(this['channels'][_0x1bf818[_0x2d14('0x26')]]){for(var _0x697188 in _0x1bf818[_0x2d14('0x2b')]){if(_0x1bf818[_0x2d14('0x2b')][_0x2d14('0x22')](_0x697188)){this['channels'][_0x1bf818[_0x2d14('0x26')]][_0x697188]=_0x1bf818['value'];}}}};Fax['prototype'][_0x2d14('0x2c')]=function(_0x1ddea9){if(this[_0x2d14('0x25')][_0x1ddea9[_0x2d14('0x26')]]){this[_0x2d14('0x25')][_0x1ddea9[_0x2d14('0x26')]][_0x2d14('0x2d')]=_0x1ddea9[_0x2d14('0x2d')];this['channels'][_0x1ddea9[_0x2d14('0x26')]]['channelstatedesc']=_0x1ddea9[_0x2d14('0x2e')];}};Fax['prototype'][_0x2d14('0x18')]=function(_0x1ac88f){if(this['channels'][_0x1ac88f[_0x2d14('0x26')]]){for(var _0x2d8120 in _0x1ac88f[_0x2d14('0x2b')]){if(_0x1ac88f['variable'][_0x2d14('0x22')](_0x2d8120)){this[_0x2d14('0x25')][_0x1ac88f[_0x2d14('0x26')]][_0x2d8120]=_0x1ac88f[_0x2d14('0x2f')];}}}};Fax[_0x2d14('0x1f')][_0x2d14('0x1a')]=function(_0x544022){if(this[_0x2d14('0x25')][_0x544022[_0x2d14('0x26')]]){this[_0x2d14('0x25')][_0x544022['uniqueid']][_0x2d14('0x30')]=_0x544022[_0x2d14('0x30')];this[_0x2d14('0x25')][_0x544022['uniqueid']][_0x2d14('0x31')]=_0x544022[_0x2d14('0x31')];this[_0x2d14('0x25')][_0x544022[_0x2d14('0x26')]][_0x2d14('0x24')]=_0x544022['localstationid'];this[_0x2d14('0x25')][_0x544022[_0x2d14('0x26')]][_0x2d14('0x32')]=_0x544022[_0x2d14('0x32')];logger[_0x2d14('0x29')](_0x544022[_0x2d14('0x26')],_0x2d14('0x33'));}};Fax[_0x2d14('0x1f')]['syncReceiveFax']=function(_0x35006e){var _0x3622da=this;if(this[_0x2d14('0x25')][_0x35006e[_0x2d14('0x26')]]){var _0x41bc02=this[_0x2d14('0x25')][_0x35006e[_0x2d14('0x26')]]['id'];this['channels'][_0x35006e[_0x2d14('0x26')]][_0x2d14('0x34')]=_0x35006e[_0x2d14('0x34')];this[_0x2d14('0x25')][_0x35006e['uniqueid']]['pagestransferred']=_0x35006e[_0x2d14('0x35')];this[_0x2d14('0x25')][_0x35006e[_0x2d14('0x26')]][_0x2d14('0x24')]=_0x35006e[_0x2d14('0x24')];this[_0x2d14('0x25')][_0x35006e[_0x2d14('0x26')]][_0x2d14('0x36')]=_0x35006e['resolution'];this[_0x2d14('0x25')][_0x35006e['uniqueid']][_0x2d14('0x37')]=_0x35006e[_0x2d14('0x37')];this['channels'][_0x35006e['uniqueid']][_0x2d14('0x32')]=_0x35006e['filename'];this[_0x2d14('0x25')][_0x35006e['uniqueid']][_0x2d14('0x38')]=_0x35006e[_0x2d14('0x38')];if(this[_0x2d14('0x25')][_0x35006e[_0x2d14('0x26')]][_0x2d14('0x35')]>0x0){tiff2pdf(_0x35006e[_0x2d14('0x32')],_0x2d14('0x39'),function(_0x322de1){logger[_0x2d14('0x29')](_0x35006e[_0x2d14('0x26')],_0x2d14('0x3a'),_0x322de1[_0x2d14('0x3b')]);attachment['create']({'name':path[_0x2d14('0x3c')](_0x35006e[_0x2d14('0x32')])[_0x2d14('0x28')],'basename':path[_0x2d14('0x3c')](_0x35006e[_0x2d14('0x32')])[_0x2d14('0x28')]+_0x2d14('0x3d'),'type':_0x2d14('0x3e')})[_0x2d14('0x3f')](function(_0x16a21b){faxAccount[_0x2d14('0x40')](_0x41bc02,{'from':_0x35006e[_0x2d14('0x38')],'mapKey':_0x2d14('0x7'),'body':path[_0x2d14('0x3c')](_0x35006e[_0x2d14('0x32')])[_0x2d14('0x28')]+_0x2d14('0x3d'),'AttachmentId':_0x16a21b['id']})[_0x2d14('0x41')](function(_0xa26a20){logger['error'](_0x35006e[_0x2d14('0x26')],_0x2d14('0x42'),JSON[_0x2d14('0x43')](_0xa26a20));});})['catch'](function(_0x57a1c1){logger[_0x2d14('0x44')](_0x35006e['uniqueid'],_0x2d14('0x45'),JSON[_0x2d14('0x43')](_0x57a1c1));});});}logger[_0x2d14('0x29')](_0x35006e[_0x2d14('0x26')],_0x2d14('0x45'));}};Fax[_0x2d14('0x1f')][_0x2d14('0x1e')]=function(_0xbb635b){if(this[_0x2d14('0x11')][_0xbb635b[_0x2d14('0x26')]]){_['merge'](this[_0x2d14('0x25')][_0xbb635b[_0x2d14('0x26')]],_[_0x2d14('0x46')](_0xbb635b,[_0x2d14('0x47'),'reason']));}};function updateStatus(_0x38180b){if(_0x38180b[_0x2d14('0x48')]){faxMessage['update'](_0x38180b[_0x2d14('0x48')],{'failMessage':_0x2d14('0x49')})[_0x2d14('0x3f')](function(_0x2ce465){ut[_0x2d14('0x4a')](_0x2d14('0x4b'),_0x2ce465);})[_0x2d14('0x41')](function(_0x59571d){ut['logger'](_0x2d14('0x4c'),_0x59571d);});}else{ut[_0x2d14('0x4a')](_0x2d14('0x4d'));}}Fax[_0x2d14('0x1f')][_0x2d14('0x4e')]=function(_0x2a2909,_0x416a9f,_0xc205b1){var _0x5af255=this;var _0x36d959={};if(_0x416a9f){_0x36d959={'read':_0x416a9f};}else{_0x36d959={'failMessage':_0xc205b1};}if(this['actions'][_0x2a2909][_0x2d14('0x48')]){faxMessage[_0x2d14('0x4f')](this['actions'][_0x2a2909][_0x2d14('0x48')],_0x36d959)['then'](function(_0xa099f7){ut[_0x2d14('0x4a')](_0x2d14('0x50'),_0xa099f7);})[_0x2d14('0x41')](function(_0x40c99d){ut[_0x2d14('0x4a')](_0x2d14('0x51'),_0x40c99d);})[_0x2d14('0x52')](function(){delete _0x5af255[_0x2d14('0x25')][_0x2a2909];delete _0x5af255[_0x2d14('0x11')][_0x2a2909];});}else{ut[_0x2d14('0x4a')](_0x2d14('0x53'));delete this[_0x2d14('0x25')][_0x2a2909];delete this[_0x2d14('0x11')][_0x2a2909];}};Fax[_0x2d14('0x1f')][_0x2d14('0x1c')]=function(_0x3ec711){var _0x5366b5=this;if(this['channels'][_0x3ec711['uniqueid']]){if(this['actions'][_0x3ec711[_0x2d14('0x26')]]){this['channels'][_0x3ec711[_0x2d14('0x26')]]['id']=this['actions'][_0x3ec711['uniqueid']]['id'];this['channels'][_0x3ec711['uniqueid']]['name']=this['actions'][_0x3ec711[_0x2d14('0x26')]][_0x2d14('0x28')];}logger[_0x2d14('0x29')](_0x3ec711[_0x2d14('0x26')],this[_0x2d14('0x11')][_0x3ec711['uniqueid']]?_0x2d14('0x54'):_0x2d14('0x55'),JSON[_0x2d14('0x43')](this['channels'][_0x3ec711['uniqueid']]));if(this['actions'][_0x3ec711[_0x2d14('0x26')]]){if(this['channels'][_0x3ec711[_0x2d14('0x26')]][_0x2d14('0x56')]>0x0&&this[_0x2d14('0x25')][_0x3ec711['uniqueid']][_0x2d14('0x19')]===_0x2d14('0x57')){this[_0x2d14('0x4e')](_0x3ec711[_0x2d14('0x26')],!![]);}else{this[_0x2d14('0x4e')](_0x3ec711[_0x2d14('0x26')],![],this[_0x2d14('0x25')][_0x3ec711[_0x2d14('0x26')]][_0x2d14('0x58')]?'SENDING\x20FAILED:\x20'+this[_0x2d14('0x25')][_0x3ec711['uniqueid']][_0x2d14('0x58')]:'SENDING\x20FAILED');}}}};Fax[_0x2d14('0x1f')]['send']=function(_0x568299){var _0x42e5e3=this;return new BPromise(function(_0x5a60e9,_0x1b52d4){_0x42e5e3['execOriginate'](_0x568299,_0x42e5e3['faxAccounts'][_0x568299[_0x2d14('0x59')]])[_0x2d14('0x3f')](function(_0x37e448){ut[_0x2d14('0x4a')]('[Fax][execOriginate][success]',_0x37e448);_0x5a60e9(ut[_0x2d14('0x3b')](_0x2d14('0x5a')));})[_0x2d14('0x41')](function(_0x5178f2){ut['logger'](_0x2d14('0x5b'),_0x5178f2);updateStatus(_0x568299);_0x1b52d4(ut[_0x2d14('0x3b')](_0x2d14('0x5c')));});});};Fax[_0x2d14('0x1f')][_0x2d14('0x5d')]=function(_0x5a8620){var _0xfd7bce=this;return new BPromise(function(_0x2ca5fc,_0x3e7c11){var _0x262327=_0xfd7bce[_0x2d14('0x5e')](_0xfd7bce[_0x2d14('0xf')][_0x5a8620['FaxAccountId']]['Trunk'],_0x5a8620);if(_0x262327[_0x2d14('0x5f')]){_0x2ca5fc(ut['message'](_0x2d14('0x60')));}else{_0x3e7c11(ut[_0x2d14('0x3b')](_0x262327['message']));}});};function originate(_0x159af8,_0x10be25,_0x5a9cb4){return new BPromise(function(_0x5d55ad,_0x1b9a5a){if(_0x5a9cb4){var _0x1eaf72=util[_0x2d14('0x61')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x2d14('0x3c')](_0x159af8['path'])[_0x2d14('0x28')],_0x159af8[_0x2d14('0x3')]);gs[_0x2d14('0x62')](_0x1eaf72)[_0x2d14('0x3f')](function(){_0x159af8['path']=util[_0x2d14('0x61')](_0x2d14('0x63'),path['parse'](_0x159af8[_0x2d14('0x3')])[_0x2d14('0x64')],path['parse'](_0x159af8[_0x2d14('0x3')])[_0x2d14('0x28')]);_0x10be25[_0x2d14('0x65')]=_0x159af8['path'];ut['logger'](_0x2d14('0x66'),'');ami[_0x2d14('0x67')](ut[_0x2d14('0x68')](_0x159af8,_0x10be25))[_0x2d14('0x3f')](function(_0x1c64ae){_0x5d55ad(_0x1c64ae);})[_0x2d14('0x41')](function(_0x3cb92a){_0x1b9a5a(_0x3cb92a);});})[_0x2d14('0x41')](function(_0x2f287e){_0x1b9a5a(_0x2f287e);});}else{ami['Action'](ut[_0x2d14('0x68')](_0x159af8,_0x10be25))[_0x2d14('0x3f')](function(_0x1cd334){_0x5d55ad(_0x1cd334);})[_0x2d14('0x41')](function(_0x27cde8){_0x1b9a5a(_0x27cde8);});}});}Fax[_0x2d14('0x1f')][_0x2d14('0x69')]=function(_0x1ddbe2,_0x39ce61){var _0x1d2016=this;return new BPromise(function(_0x42c0e0,_0x5e2a45){var _0x1ac2ef=uuid['v4']();var _0x1e425b=ut[_0x2d14('0x6a')](_0x1ddbe2,_0x39ce61);_0x1d2016['actions'][_0x1ac2ef]=new Action(_0x1ac2ef,_0x39ce61,_0x1ddbe2);var _0x570a3a=_0x1d2016[_0x2d14('0x11')][_0x1ac2ef];if(path['parse'](_0x1ddbe2[_0x2d14('0x3')])['ext']==='.pdf'){originate(_0x570a3a,_0x1e425b,!![])[_0x2d14('0x3f')](function(_0x4bea4e){_0x42c0e0(_0x4bea4e);})[_0x2d14('0x41')](function(_0x394138){_0x5e2a45(_0x394138);});}else{originate(_0x570a3a,_0x1e425b,![])[_0x2d14('0x3f')](function(_0x40bfae){_0x42c0e0(_0x40bfae);})[_0x2d14('0x41')](function(_0x2c70a9){_0x5e2a45(_0x2c70a9);});}});};Fax['prototype'][_0x2d14('0x6b')]=function(_0x22e64b){return!_[_0x2d14('0x6c')](_0x22e64b)&&!_['isNil'](_0x22e64b['name'])&&!_['isNil'](_0x22e64b[_0x2d14('0x6d')])&&_0x22e64b['active']&&!_[_0x2d14('0x6c')](this[_0x2d14('0x10')][util[_0x2d14('0x61')](_0x2d14('0x6e'),_0x22e64b[_0x2d14('0x28')])])&&!_[_0x2d14('0x6c')](this[_0x2d14('0x10')][util[_0x2d14('0x61')]('SIP/%s',_0x22e64b[_0x2d14('0x28')])][_0x2d14('0x31')])&&(this['trunks'][util['format'](_0x2d14('0x6e'),_0x22e64b['name'])]['status']===_0x2d14('0x6f')||this[_0x2d14('0x10')][util['format'](_0x2d14('0x6e'),_0x22e64b['name'])][_0x2d14('0x31')]===_0x2d14('0x70'));};Fax[_0x2d14('0x1f')][_0x2d14('0x5e')]=function(_0x4bbda6,_0x2e4fe6){if(!this[_0x2d14('0x6b')](_0x4bbda6)){ut[_0x2d14('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x2d14('0x6c')](_0x4bbda6)?'':_0x4bbda6['name']+_0x2d14('0x71'));return{'isValid':![],'message':_0x2d14('0x72')};}if(_[_0x2d14('0x6c')](_0x2e4fe6['fax'])){ut[_0x2d14('0x4a')](_0x2d14('0x73'),JSON[_0x2d14('0x43')](_0x2e4fe6));return{'isValid':![],'message':_0x2d14('0x74')};}if(_[_0x2d14('0x6c')](_0x2e4fe6[_0x2d14('0x3')])){ut[_0x2d14('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x2d14('0x43')](_0x2e4fe6));return{'isValid':![],'message':_0x2d14('0x75')};}return{'isValid':!![],'message':_0x2d14('0x76')};};module['exports']=Fax; \ No newline at end of file +var _0x64d8=['execOriginate','FaxAccountId','Fax\x20received','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','newexten','syncNewExten','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','calleridnum','pagestransferred','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][NoUpdate1]','logger','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','send'];(function(_0x1e96d3,_0x522dbe){var _0x1454e0=function(_0x4964ca){while(--_0x4964ca){_0x1e96d3['push'](_0x1e96d3['shift']());}};_0x1454e0(++_0x522dbe);}(_0x64d8,0xf4));var _0x864d=function(_0x4b4ce5,_0x573d2d){_0x4b4ce5=_0x4b4ce5-0x0;var _0x6522f3=_0x64d8[_0x4b4ce5];return _0x6522f3;};'use strict';var util=require(_0x864d('0x0'));var _=require(_0x864d('0x1'));var BPromise=require(_0x864d('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x864d('0x3'));var logger=require(_0x864d('0x4'))(_0x864d('0x5'));var ami=require(_0x864d('0x6'));var rpcDb=require(_0x864d('0x7'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x864d('0x8'));var faxAccount=require(_0x864d('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x864d('0xa'));function Fax(_0x5bc54d){this[_0x864d('0xb')]={};this[_0x864d('0xc')]=_0x5bc54d[_0x864d('0xc')];this[_0x864d('0xd')]=_0x5bc54d[_0x864d('0xd')];this[_0x864d('0xe')]={};ami['on'](_0x864d('0xf'),this[_0x864d('0x10')][_0x864d('0x11')](this));ami['on'](_0x864d('0x12'),this['syncVarSet']['bind'](this));ami['on'](_0x864d('0x13'),this['syncNewState']['bind'](this));ami['on'](_0x864d('0x14'),this[_0x864d('0x15')][_0x864d('0x11')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0x864d('0x16')]['bind'](this));ami['on']('hangup',this[_0x864d('0x17')][_0x864d('0x11')](this));ami['on']('originateresponse',this[_0x864d('0x18')][_0x864d('0x11')](this));}Fax[_0x864d('0x19')][_0x864d('0x10')]=function(_0x2ca8fa){if(_0x2ca8fa[_0x864d('0x1a')]==='from-voip-provider'){for(var _0x61649 in this[_0x864d('0xc')]){if(this['faxAccounts']['hasOwnProperty'](_0x61649)){if(_0x2ca8fa[_0x864d('0x1b')]===this[_0x864d('0xc')][_0x61649][_0x864d('0x1c')]){this[_0x864d('0xb')][_0x2ca8fa['uniqueid']]={};this[_0x864d('0xb')][_0x2ca8fa[_0x864d('0x1d')]]['channel']=_0x2ca8fa[_0x864d('0x1e')];this['channels'][_0x2ca8fa['uniqueid']]['id']=this[_0x864d('0xc')][_0x61649]['id'];this['channels'][_0x2ca8fa[_0x864d('0x1d')]][_0x864d('0x1f')]=this[_0x864d('0xc')][_0x61649][_0x864d('0x1f')];logger[_0x864d('0x20')](_0x2ca8fa[_0x864d('0x1d')],_0x864d('0x21'));}}}}if(this[_0x864d('0xe')][_0x2ca8fa['uniqueid']]){this['channels'][_0x2ca8fa[_0x864d('0x1d')]]={};this[_0x864d('0xb')][_0x2ca8fa[_0x864d('0x1d')]]['channel']=_0x2ca8fa[_0x864d('0x1e')];logger['info'](_0x2ca8fa[_0x864d('0x1d')],'\x20syncNewchannel\x20');}};Fax[_0x864d('0x19')]['syncVarSet']=function(_0x572b2d){if(this[_0x864d('0xb')][_0x572b2d['uniqueid']]){for(var _0x25c49f in _0x572b2d[_0x864d('0x22')]){if(_0x572b2d['variable'][_0x864d('0x23')](_0x25c49f)){this[_0x864d('0xb')][_0x572b2d['uniqueid']][_0x25c49f]=_0x572b2d['value'];}}}};Fax[_0x864d('0x19')]['syncNewState']=function(_0x44a589){if(this['channels'][_0x44a589[_0x864d('0x1d')]]){this[_0x864d('0xb')][_0x44a589[_0x864d('0x1d')]][_0x864d('0x24')]=_0x44a589['channelstate'];this[_0x864d('0xb')][_0x44a589[_0x864d('0x1d')]][_0x864d('0x25')]=_0x44a589['channelstatedesc'];}};Fax[_0x864d('0x19')][_0x864d('0x15')]=function(_0x44e853){if(this[_0x864d('0xb')][_0x44e853[_0x864d('0x1d')]]){for(var _0x43c9ca in _0x44e853[_0x864d('0x22')]){if(_0x44e853[_0x864d('0x22')][_0x864d('0x23')](_0x43c9ca)){this[_0x864d('0xb')][_0x44e853[_0x864d('0x1d')]][_0x43c9ca]=_0x44e853[_0x864d('0x26')];}}}};Fax[_0x864d('0x19')][_0x864d('0x27')]=function(_0x2ff0cd){if(this[_0x864d('0xb')][_0x2ff0cd['uniqueid']]){this[_0x864d('0xb')][_0x2ff0cd[_0x864d('0x1d')]][_0x864d('0x28')]=_0x2ff0cd[_0x864d('0x28')];this['channels'][_0x2ff0cd[_0x864d('0x1d')]][_0x864d('0x29')]=_0x2ff0cd[_0x864d('0x29')];this[_0x864d('0xb')][_0x2ff0cd[_0x864d('0x1d')]]['localstationid']=_0x2ff0cd[_0x864d('0x1c')];this[_0x864d('0xb')][_0x2ff0cd[_0x864d('0x1d')]][_0x864d('0x2a')]=_0x2ff0cd[_0x864d('0x2a')];logger['info'](_0x2ff0cd['uniqueid'],_0x864d('0x2b'));}};Fax[_0x864d('0x19')][_0x864d('0x16')]=function(_0x53ac24){var _0x23d85e=this;if(this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]]){var _0x2718a9=this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]]['id'];this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]][_0x864d('0x2c')]=_0x53ac24[_0x864d('0x2c')];this['channels'][_0x53ac24[_0x864d('0x1d')]]['pagestransferred']=_0x53ac24['pagestransferred'];this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]]['localstationid']=_0x53ac24[_0x864d('0x1c')];this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]][_0x864d('0x2d')]=_0x53ac24['resolution'];this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]]['transferrate']=_0x53ac24['transferrate'];this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]]['filename']=_0x53ac24[_0x864d('0x2a')];this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]][_0x864d('0x2e')]=_0x53ac24['calleridnum'];if(this[_0x864d('0xb')][_0x53ac24[_0x864d('0x1d')]][_0x864d('0x2f')]>0x0){tiff2pdf(_0x53ac24[_0x864d('0x2a')],'/var/opt/motion2/server/files/attachments/',function(_0x4fa19f){logger[_0x864d('0x20')](_0x53ac24[_0x864d('0x1d')],_0x864d('0x30'),_0x4fa19f[_0x864d('0x31')]);attachment[_0x864d('0x32')]({'name':path[_0x864d('0x33')](_0x53ac24[_0x864d('0x2a')])[_0x864d('0x1f')],'basename':path[_0x864d('0x33')](_0x53ac24['filename'])[_0x864d('0x1f')]+_0x864d('0x34'),'type':_0x864d('0x35')})['then'](function(_0x3b44da){faxAccount[_0x864d('0x36')](_0x2718a9,{'from':_0x53ac24[_0x864d('0x2e')],'mapKey':'fax','body':path[_0x864d('0x33')](_0x53ac24['filename'])[_0x864d('0x1f')]+_0x864d('0x34'),'AttachmentId':_0x3b44da['id']})[_0x864d('0x37')](function(_0x1f2a55){logger['error'](_0x53ac24[_0x864d('0x1d')],_0x864d('0x38'),JSON[_0x864d('0x39')](_0x1f2a55));});})[_0x864d('0x37')](function(_0x29ab13){logger['error'](_0x53ac24[_0x864d('0x1d')],_0x864d('0x3a'),JSON[_0x864d('0x39')](_0x29ab13));});});}logger[_0x864d('0x20')](_0x53ac24[_0x864d('0x1d')],_0x864d('0x3a'));}};Fax[_0x864d('0x19')]['syncOriginateResponse']=function(_0x1756ae){if(this[_0x864d('0xe')][_0x1756ae[_0x864d('0x1d')]]){_[_0x864d('0x3b')](this['channels'][_0x1756ae[_0x864d('0x1d')]],_[_0x864d('0x3c')](_0x1756ae,['response',_0x864d('0x3d')]));}};function updateStatus(_0x3666c4){if(_0x3666c4[_0x864d('0x3e')]){faxMessage[_0x864d('0x3f')](_0x3666c4[_0x864d('0x3e')],{'failMessage':_0x864d('0x40')})[_0x864d('0x41')](function(_0x18c5c8){ut['logger']('[Fax][Message][Error][Updated]',_0x18c5c8);})[_0x864d('0x37')](function(_0xf48829){ut['logger'](_0x864d('0x42'),_0xf48829);});}else{ut[_0x864d('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x864d('0x19')][_0x864d('0x44')]=function(_0x351f63,_0x3fc1b3,_0x2060a5){var _0x435c8b=this;var _0x5ea481={};if(_0x3fc1b3){_0x5ea481={'read':_0x3fc1b3};}else{_0x5ea481={'failMessage':_0x2060a5};}if(this['actions'][_0x351f63][_0x864d('0x3e')]){faxMessage[_0x864d('0x3f')](this['actions'][_0x351f63]['AttachmentId'],_0x5ea481)[_0x864d('0x41')](function(_0x578191){ut[_0x864d('0x43')](_0x864d('0x45'),_0x578191);})[_0x864d('0x37')](function(_0x23d820){ut[_0x864d('0x43')](_0x864d('0x46'),_0x23d820);})[_0x864d('0x47')](function(){delete _0x435c8b[_0x864d('0xb')][_0x351f63];delete _0x435c8b[_0x864d('0xe')][_0x351f63];});}else{ut[_0x864d('0x43')](_0x864d('0x48'));delete this[_0x864d('0xb')][_0x351f63];delete this[_0x864d('0xe')][_0x351f63];}};Fax[_0x864d('0x19')][_0x864d('0x17')]=function(_0x253bc4){var _0x119d40=this;if(this[_0x864d('0xb')][_0x253bc4[_0x864d('0x1d')]]){if(this['actions'][_0x253bc4['uniqueid']]){this['channels'][_0x253bc4[_0x864d('0x1d')]]['id']=this[_0x864d('0xe')][_0x253bc4['uniqueid']]['id'];this[_0x864d('0xb')][_0x253bc4[_0x864d('0x1d')]][_0x864d('0x1f')]=this[_0x864d('0xe')][_0x253bc4[_0x864d('0x1d')]]['name'];}logger[_0x864d('0x20')](_0x253bc4['uniqueid'],this['actions'][_0x253bc4[_0x864d('0x1d')]]?_0x864d('0x49'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x864d('0xb')][_0x253bc4[_0x864d('0x1d')]]));if(this[_0x864d('0xe')][_0x253bc4['uniqueid']]){if(this[_0x864d('0xb')][_0x253bc4[_0x864d('0x1d')]][_0x864d('0x4a')]>0x0&&this[_0x864d('0xb')][_0x253bc4['uniqueid']][_0x864d('0x4b')]===_0x864d('0x4c')){this[_0x864d('0x44')](_0x253bc4[_0x864d('0x1d')],!![]);}else{this[_0x864d('0x44')](_0x253bc4[_0x864d('0x1d')],![],this[_0x864d('0xb')][_0x253bc4[_0x864d('0x1d')]][_0x864d('0x4d')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x253bc4['uniqueid']][_0x864d('0x4d')]:_0x864d('0x4e'));}}}};Fax[_0x864d('0x19')][_0x864d('0x4f')]=function(_0x50ad7c){var _0x5639c9=this;return new BPromise(function(_0x483662,_0x349a01){_0x5639c9[_0x864d('0x50')](_0x50ad7c,_0x5639c9[_0x864d('0xc')][_0x50ad7c[_0x864d('0x51')]])[_0x864d('0x41')](function(_0x3433bc){ut['logger']('[Fax][execOriginate][success]',_0x3433bc);_0x483662(ut[_0x864d('0x31')](_0x864d('0x52')));})['catch'](function(_0x32c4b9){ut['logger']('[Fax][execOriginate][failure]',_0x32c4b9);updateStatus(_0x50ad7c);_0x349a01(ut[_0x864d('0x31')](_0x864d('0x53')));});});};Fax[_0x864d('0x19')]['checkAfterSend']=function(_0x5c5522){var _0xf7a7e9=this;return new BPromise(function(_0x587e10,_0x35abea){var _0x5186c2=_0xf7a7e9[_0x864d('0x54')](_0xf7a7e9[_0x864d('0xc')][_0x5c5522['FaxAccountId']]['Trunk'],_0x5c5522);if(_0x5186c2[_0x864d('0x55')]){_0x587e10(ut[_0x864d('0x31')](_0x864d('0x56')));}else{_0x35abea(ut[_0x864d('0x31')](_0x5186c2[_0x864d('0x31')]));}});};function originate(_0x2cd876,_0x450af0,_0xda656d){return new BPromise(function(_0x4f8549,_0x17d13b){if(_0xda656d){var _0x1ff6f0=util[_0x864d('0x57')](_0x864d('0x58'),path['parse'](_0x2cd876[_0x864d('0x59')])[_0x864d('0x1f')],_0x2cd876[_0x864d('0x59')]);gs[_0x864d('0x5a')](_0x1ff6f0)[_0x864d('0x41')](function(){_0x2cd876[_0x864d('0x59')]=util[_0x864d('0x57')](_0x864d('0x5b'),path[_0x864d('0x33')](_0x2cd876[_0x864d('0x59')])['dir'],path[_0x864d('0x33')](_0x2cd876[_0x864d('0x59')])[_0x864d('0x1f')]);_0x450af0[_0x864d('0x5c')]=_0x2cd876[_0x864d('0x59')];ut[_0x864d('0x43')](_0x864d('0x5d'),'');ami['Action'](ut[_0x864d('0x5e')](_0x2cd876,_0x450af0))[_0x864d('0x41')](function(_0x1244d8){_0x4f8549(_0x1244d8);})[_0x864d('0x37')](function(_0x45c8dc){_0x17d13b(_0x45c8dc);});})[_0x864d('0x37')](function(_0x3f0e0a){_0x17d13b(_0x3f0e0a);});}else{ami[_0x864d('0x5f')](ut[_0x864d('0x5e')](_0x2cd876,_0x450af0))[_0x864d('0x41')](function(_0x572a21){_0x4f8549(_0x572a21);})[_0x864d('0x37')](function(_0x516002){_0x17d13b(_0x516002);});}});}Fax[_0x864d('0x19')]['execOriginate']=function(_0x462f95,_0x430e35){var _0x1fdbe6=this;return new BPromise(function(_0xbfbdda,_0x8d3ea5){var _0x5c354a=uuid['v4']();var _0x61fed2=ut['addVariables'](_0x462f95,_0x430e35);_0x1fdbe6[_0x864d('0xe')][_0x5c354a]=new Action(_0x5c354a,_0x430e35,_0x462f95);var _0x49e615=_0x1fdbe6['actions'][_0x5c354a];if(path[_0x864d('0x33')](_0x462f95['path'])[_0x864d('0x60')]===_0x864d('0x34')){originate(_0x49e615,_0x61fed2,!![])[_0x864d('0x41')](function(_0x550006){_0xbfbdda(_0x550006);})[_0x864d('0x37')](function(_0x115813){_0x8d3ea5(_0x115813);});}else{originate(_0x49e615,_0x61fed2,![])[_0x864d('0x41')](function(_0x17080f){_0xbfbdda(_0x17080f);})['catch'](function(_0x22ef5d){_0x8d3ea5(_0x22ef5d);});}});};Fax[_0x864d('0x19')][_0x864d('0x61')]=function(_0x51adf3){return!_[_0x864d('0x62')](_0x51adf3)&&!_[_0x864d('0x62')](_0x51adf3['name'])&&!_[_0x864d('0x62')](_0x51adf3[_0x864d('0x63')])&&_0x51adf3[_0x864d('0x63')]&&!_['isNil'](this[_0x864d('0xd')][util[_0x864d('0x57')]('SIP/%s',_0x51adf3[_0x864d('0x1f')])])&&!_['isNil'](this['trunks'][util[_0x864d('0x57')](_0x864d('0x64'),_0x51adf3[_0x864d('0x1f')])][_0x864d('0x29')])&&(this[_0x864d('0xd')][util[_0x864d('0x57')](_0x864d('0x64'),_0x51adf3[_0x864d('0x1f')])][_0x864d('0x29')]===_0x864d('0x65')||this[_0x864d('0xd')][util[_0x864d('0x57')]('SIP/%s',_0x51adf3[_0x864d('0x1f')])]['status']===_0x864d('0x66'));};Fax[_0x864d('0x19')][_0x864d('0x54')]=function(_0x4b4f7e,_0x1d6c7d){if(!this['isTrunkReachable'](_0x4b4f7e)){ut[_0x864d('0x43')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x864d('0x62')](_0x4b4f7e)?'':_0x4b4f7e[_0x864d('0x1f')]+_0x864d('0x67'));return{'isValid':![],'message':_0x864d('0x68')};}if(_[_0x864d('0x62')](_0x1d6c7d[_0x864d('0x5')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x1d6c7d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x864d('0x62')](_0x1d6c7d[_0x864d('0x59')])){ut[_0x864d('0x43')](_0x864d('0x69'),JSON[_0x864d('0x39')](_0x1d6c7d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x864d('0x6a')};};module[_0x864d('0x6b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1648d9c..d2fef9b 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 _0x748a=['../../../config/logger','preview','resolve','then','notify','[Notify]\x20','util','bluebird'];(function(_0x5c85e5,_0x36fa12){var _0x517017=function(_0x6e11a5){while(--_0x6e11a5){_0x5c85e5['push'](_0x5c85e5['shift']());}};_0x517017(++_0x36fa12);}(_0x748a,0x1ee));var _0xa748=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x748a[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0xa748('0x0'));var BPromise=require(_0xa748('0x1'));var logger=require(_0xa748('0x2'))(_0xa748('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x97f126){return function(_0x506fc1){logger['error'](_0x97f126,util['inspect'](_0x506fc1,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3076db,_0x2ae87a){return BPromise[_0xa748('0x4')]()[_0xa748('0x5')](faxAccount[_0xa748('0x6')](_0x3076db,_0x2ae87a))['catch'](loggerCatch(_0xa748('0x7')));}; \ No newline at end of file +var _0x444a=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0x1be0c0,_0x1ff6ef){var _0x4b8160=function(_0x5dd499){while(--_0x5dd499){_0x1be0c0['push'](_0x1be0c0['shift']());}};_0x4b8160(++_0x1ff6ef);}(_0x444a,0x12e));var _0xa444=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x444a[_0x1b76e6];return _0x333b53;};'use strict';var util=require(_0xa444('0x0'));var BPromise=require(_0xa444('0x1'));var logger=require(_0xa444('0x2'))(_0xa444('0x3'));var _=require(_0xa444('0x4'));var faxAccount=require(_0xa444('0x5'));function loggerCatch(_0xe1043c){return function(_0x4f4a53){logger[_0xa444('0x6')](_0xe1043c,util[_0xa444('0x7')](_0x4f4a53,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3ffb7a,_0x49c753){return BPromise[_0xa444('0x8')]()[_0xa444('0x9')](faxAccount[_0xa444('0xa')](_0x3ffb7a,_0x49c753))[_0xa444('0xb')](loggerCatch(_0xa444('0xc')));}; \ 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 30776b2..c0bd2f1 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 _0xa66b=['execute','info','Exec\x20gs','util','../../../../config/logger','bluebird','child_process','exec'];(function(_0x22a0d3,_0x126821){var _0x4c1b56=function(_0x59d9fe){while(--_0x59d9fe){_0x22a0d3['push'](_0x22a0d3['shift']());}};_0x4c1b56(++_0x126821);}(_0xa66b,0x11b));var _0xba66=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0xa66b[_0x4ca288];return _0x2362c1;};'use strict';var util=require(_0xba66('0x0'));var logger=require(_0xba66('0x1'))('fax');var BPromise=require(_0xba66('0x2'));var exec=require(_0xba66('0x3'))[_0xba66('0x4')];exports[_0xba66('0x5')]=function(_0x30c4fd){return new BPromise(function(_0x3a3ba9,_0x25c48e){exec(_0x30c4fd,function(_0x5c1ef4,_0x3ebdf4,_0x35e2a6){logger[_0xba66('0x6')]('Exec\x20gs',_0x3ebdf4);if(_0x5c1ef4){logger['info'](_0xba66('0x7'),'\x20Error\x20:',util['inspect'](_0x5c1ef4,{'showHidden':![],'depth':null}),_0x3ebdf4,_0x35e2a6);_0x25c48e(_0x5c1ef4);}_0x3a3ba9(_0x3ebdf4);});});}; \ No newline at end of file +var _0x2c89=['util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs','inspect'];(function(_0x5d624d,_0x1cc59a){var _0x2f85f1=function(_0x2f25ea){while(--_0x2f25ea){_0x5d624d['push'](_0x5d624d['shift']());}};_0x2f85f1(++_0x1cc59a);}(_0x2c89,0x1b0));var _0x92c8=function(_0x17c226,_0x141738){_0x17c226=_0x17c226-0x0;var _0x16988c=_0x2c89[_0x17c226];return _0x16988c;};'use strict';var util=require(_0x92c8('0x0'));var logger=require(_0x92c8('0x1'))(_0x92c8('0x2'));var BPromise=require('bluebird');var exec=require(_0x92c8('0x3'))[_0x92c8('0x4')];exports[_0x92c8('0x5')]=function(_0x500319){return new BPromise(function(_0x1fe8d3,_0x32d9be){exec(_0x500319,function(_0x31de96,_0x112b7b,_0x285aa7){logger[_0x92c8('0x6')](_0x92c8('0x7'),_0x112b7b);if(_0x31de96){logger[_0x92c8('0x6')](_0x92c8('0x7'),'\x20Error\x20:',util[_0x92c8('0x8')](_0x31de96,{'showHidden':![],'depth':null}),_0x112b7b,_0x285aa7);_0x32d9be(_0x31de96);}_0x1fe8d3(_0x112b7b);});});}; \ 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 397e3ef..1325cfb 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 _0xcb7b=['moment','fax','logger','info','inspect','headerinfo','maxrate','format','\x22%s\x22','gateway','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcb7b,0x17a));var _0xbcb7=function(_0x740af4,_0x2310d4){_0x740af4=_0x740af4-0x0;var _0x35be4f=_0xcb7b[_0x740af4];return _0x35be4f;};'use strict';var util=require(_0xbcb7('0x0'));var _=require(_0xbcb7('0x1'));var moment=require(_0xbcb7('0x2'));var logger=require('../../../../config/logger')(_0xbcb7('0x3'));exports['message']=function(_0x3f2969){return{'message':_0x3f2969};};exports[_0xbcb7('0x4')]=function(_0x4f3afc,_0x203a51){logger[_0xbcb7('0x5')](_0x4f3afc,util[_0xbcb7('0x6')](_0x203a51,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x528fbc,_0x511787){var _0xb8b103={'XMF-ECM':_0x511787['ecm'],'XMF-HEADERINFO':_0x511787[_0xbcb7('0x7')],'XMF-MINRATE':_0x511787['minrate'],'XMF-MAXRATE':_0x511787[_0xbcb7('0x8')],'XMF-MODEM':util[_0xbcb7('0x9')](_0xbcb7('0xa'),_0x511787['modem']),'XMF-GATEWAY':_0x511787[_0xbcb7('0xb')],'XMF-FAXDETECT':_0x511787['faxdetect'],'XMF-T38TIMEOUT':_0x511787[_0xbcb7('0xc')],'XMF-LOCALSTATIONID':_0x511787[_0xbcb7('0xd')],'XMF-PATH':_0x528fbc[_0xbcb7('0xe')]};return _0xb8b103;};exports['variablesAction']=function(_0x5f37f8,_0x51644f){return{'actionid':_0x5f37f8[_0xbcb7('0xf')],'action':'originate','channel':_0x5f37f8[_0xbcb7('0x10')],'Exten':_0xbcb7('0x11'),'Context':_0xbcb7('0x12'),'Priority':'1','callerid':util['format'](_0xbcb7('0x13'),_0x5f37f8[_0xbcb7('0x7')]?_0x5f37f8['headerinfo']:'',_0x5f37f8[_0xbcb7('0xd')]),'variable':_0x51644f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5f37f8[_0xbcb7('0xf')]};}; \ No newline at end of file +var _0xe022=['faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','message','logger','inspect','addVariables','ecm','headerinfo','minrate','format'];(function(_0x1a1e9e,_0x4bbb85){var _0x37ee15=function(_0x346039){while(--_0x346039){_0x1a1e9e['push'](_0x1a1e9e['shift']());}};_0x37ee15(++_0x4bbb85);}(_0xe022,0xf9));var _0x2e02=function(_0x59fdc9,_0x54b3d9){_0x59fdc9=_0x59fdc9-0x0;var _0x5ba923=_0xe022[_0x59fdc9];return _0x5ba923;};'use strict';var util=require(_0x2e02('0x0'));var _=require(_0x2e02('0x1'));var moment=require(_0x2e02('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x2e02('0x3')]=function(_0x3d20ce){return{'message':_0x3d20ce};};exports[_0x2e02('0x4')]=function(_0x4fcc90,_0x46dfd2){logger['info'](_0x4fcc90,util[_0x2e02('0x5')](_0x46dfd2,{'showHidden':![],'depth':null}));};exports[_0x2e02('0x6')]=function(_0x2511eb,_0x12230b){var _0x1a6c17={'XMF-ECM':_0x12230b[_0x2e02('0x7')],'XMF-HEADERINFO':_0x12230b[_0x2e02('0x8')],'XMF-MINRATE':_0x12230b[_0x2e02('0x9')],'XMF-MAXRATE':_0x12230b['maxrate'],'XMF-MODEM':util[_0x2e02('0xa')]('\x22%s\x22',_0x12230b['modem']),'XMF-GATEWAY':_0x12230b['gateway'],'XMF-FAXDETECT':_0x12230b[_0x2e02('0xb')],'XMF-T38TIMEOUT':_0x12230b[_0x2e02('0xc')],'XMF-LOCALSTATIONID':_0x12230b[_0x2e02('0xd')],'XMF-PATH':_0x2511eb['path']};return _0x1a6c17;};exports[_0x2e02('0xe')]=function(_0x557435,_0x2cb399){return{'actionid':_0x557435[_0x2e02('0xf')],'action':_0x2e02('0x10'),'channel':_0x557435[_0x2e02('0x11')],'Exten':'xcally-motion-fax','Context':_0x2e02('0x12'),'Priority':'1','callerid':util[_0x2e02('0xa')](_0x2e02('0x13'),_0x557435[_0x2e02('0x8')]?_0x557435[_0x2e02('0x8')]:'',_0x557435['localstationid']),'variable':_0x2cb399,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x557435[_0x2e02('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f507427..03ff0d5 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 _0x5b0d=['initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts'];(function(_0x5d8515,_0x2fac54){var _0x56b4a5=function(_0x3059fd){while(--_0x3059fd){_0x5d8515['push'](_0x5d8515['shift']());}};_0x56b4a5(++_0x2fac54);}(_0x5b0d,0xeb));var _0xd5b0=function(_0x4b479b,_0x3b686f){_0x4b479b=_0x4b479b-0x0;var _0x5d2376=_0x5b0d[_0x4b479b];return _0x5d2376;};'use strict';var BPromise=require(_0xd5b0('0x0'));var util=require(_0xd5b0('0x1'));var moment=require(_0xd5b0('0x2'));var server=require(_0xd5b0('0x3'));var Realtime=require(_0xd5b0('0x4'));var Report=require(_0xd5b0('0x5'));var Acw=require(_0xd5b0('0x6'));var Trigger=require(_0xd5b0('0x7'));var Dialer=require(_0xd5b0('0x8'));var Preview=require(_0xd5b0('0x9'));var Fax=require(_0xd5b0('0xa'));var user=require(_0xd5b0('0xb'));var voiceQueue=require(_0xd5b0('0xc'));var voiceQueueReport=require(_0xd5b0('0xd'));var voiceCallReport=require(_0xd5b0('0xe'));var trunk=require('./rpc/trunk');var trigger=require(_0xd5b0('0xf'));var template=require('./rpc/template');var cmHopperHistory=require(_0xd5b0('0x10'));var campaign=require(_0xd5b0('0x11'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xd5b0('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xd5b0('0x13'));var freshdesk=require(_0xd5b0('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xd5b0('0x15'));var freshsales=require(_0xd5b0('0x16'));var servicenow=require(_0xd5b0('0x17'));var dynamics365=require(_0xd5b0('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xd5b0('0x19'))(_0xd5b0('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd5b0('0x1b')](_0xd5b0('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd5b0('0x1b')](_0xd5b0('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xd5b0('0x1d')](user[_0xd5b0('0x1e')]())[_0xd5b0('0x1d')](realtime['initAgents']())['then'](user[_0xd5b0('0x1f')]())['then'](realtime['initTelephones']())[_0xd5b0('0x1d')](trunk['getTrunks']())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x20')]())['then'](voiceQueue[_0xd5b0('0x21')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x22')]())[_0xd5b0('0x1d')](trigger['getTriggers']())[_0xd5b0('0x1d')](realtime['initTriggers']())[_0xd5b0('0x1d')](template[_0xd5b0('0x23')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x24')]())[_0xd5b0('0x1d')](zendesk[_0xd5b0('0x25')]())['then'](realtime[_0xd5b0('0x26')]())[_0xd5b0('0x1d')](salesforce[_0xd5b0('0x27')]())[_0xd5b0('0x1d')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xd5b0('0x28')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x29')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x2a')]())[_0xd5b0('0x1d')](desk[_0xd5b0('0x2b')]())['then'](realtime[_0xd5b0('0x2c')]())[_0xd5b0('0x1d')](zoho[_0xd5b0('0x2d')]())['then'](realtime[_0xd5b0('0x2e')]())[_0xd5b0('0x1d')](vtiger['getVtigerAccounts']())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x2f')]())[_0xd5b0('0x1d')](freshsales[_0xd5b0('0x30')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x31')]())[_0xd5b0('0x1d')](servicenow[_0xd5b0('0x32')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x33')]())['then'](dynamics365[_0xd5b0('0x34')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x35')]())[_0xd5b0('0x1d')](campaign[_0xd5b0('0x36')]())['then'](realtime['initCampaigns']())[_0xd5b0('0x1d')](voiceExtension[_0xd5b0('0x37')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x38')]())[_0xd5b0('0x1d')](faxAccount[_0xd5b0('0x39')]())[_0xd5b0('0x1d')](realtime['initFaxAccounts']())[_0xd5b0('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0xd5b0('0x3a')]()[_0xd5b0('0x1d')](voiceQueueReport[_0xd5b0('0x3b')]())['then'](realtime[_0xd5b0('0x3c')]())[_0xd5b0('0x1d')](cmHopperHistory[_0xd5b0('0x3d')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x3e')]())[_0xd5b0('0x1d')](cmHopperHistory[_0xd5b0('0x3f')]())[_0xd5b0('0x1d')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xd5b0('0x40')]())[_0xd5b0('0x1d')](realtime[_0xd5b0('0x41')]())[_0xd5b0('0x42')](function(_0xb3ec25){logger[_0xd5b0('0x43')](_0xd5b0('0x44'),util['inspect'](_0xb3ec25,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x1bcde8){return initRealtime();})[_0xd5b0('0x1d')](function(){return initParams();})[_0xd5b0('0x1d')](function(){report[_0xd5b0('0x45')]();setInterval(initRealtime,0x1388);})[_0xd5b0('0x42')](function(_0x22aac8){logger[_0xd5b0('0x43')](_0xd5b0('0x46'),util['inspect'](_0x22aac8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xd377=['initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve'];(function(_0x1e779a,_0x299119){var _0x4a11e2=function(_0x4dfbeb){while(--_0x4dfbeb){_0x1e779a['push'](_0x1e779a['shift']());}};_0x4a11e2(++_0x299119);}(_0xd377,0xf6));var _0x7d37=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd377[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x7d37('0x0'));var util=require(_0x7d37('0x1'));var moment=require(_0x7d37('0x2'));var server=require('./server');var Realtime=require(_0x7d37('0x3'));var Report=require(_0x7d37('0x4'));var Acw=require(_0x7d37('0x5'));var Trigger=require(_0x7d37('0x6'));var Dialer=require(_0x7d37('0x7'));var Preview=require('./preview');var Fax=require(_0x7d37('0x8'));var user=require(_0x7d37('0x9'));var voiceQueue=require(_0x7d37('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x7d37('0xb'));var trunk=require(_0x7d37('0xc'));var trigger=require(_0x7d37('0xd'));var template=require(_0x7d37('0xe'));var cmHopperHistory=require(_0x7d37('0xf'));var campaign=require(_0x7d37('0x10'));var voiceExtension=require(_0x7d37('0x11'));var faxAccount=require(_0x7d37('0x12'));var zendesk=require(_0x7d37('0x13'));var salesforce=require(_0x7d37('0x14'));var sugarcrm=require(_0x7d37('0x15'));var freshdesk=require(_0x7d37('0x16'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x7d37('0x17'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x7d37('0x18'));var servicenow=require(_0x7d37('0x19'));var dynamics365=require(_0x7d37('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(_0x7d37('0x1b'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7d37('0x1c')](_0x7d37('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x7d37('0x1e')]())['then'](realtime[_0x7d37('0x1f')]())[_0x7d37('0x20')](user[_0x7d37('0x21')]())[_0x7d37('0x20')](realtime[_0x7d37('0x22')]())[_0x7d37('0x20')](trunk[_0x7d37('0x23')]())[_0x7d37('0x20')](realtime[_0x7d37('0x24')]())['then'](voiceQueue[_0x7d37('0x25')]())[_0x7d37('0x20')](realtime[_0x7d37('0x26')]())['then'](trigger[_0x7d37('0x27')]())[_0x7d37('0x20')](realtime[_0x7d37('0x28')]())[_0x7d37('0x20')](template[_0x7d37('0x29')]())[_0x7d37('0x20')](realtime[_0x7d37('0x2a')]())[_0x7d37('0x20')](zendesk[_0x7d37('0x2b')]())[_0x7d37('0x20')](realtime[_0x7d37('0x2c')]())[_0x7d37('0x20')](salesforce[_0x7d37('0x2d')]())[_0x7d37('0x20')](realtime[_0x7d37('0x2e')]())['then'](sugarcrm[_0x7d37('0x2f')]())[_0x7d37('0x20')](realtime['initSugarcrmAccounts']())[_0x7d37('0x20')](freshdesk[_0x7d37('0x30')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())[_0x7d37('0x20')](realtime[_0x7d37('0x31')]())[_0x7d37('0x20')](zoho[_0x7d37('0x32')]())[_0x7d37('0x20')](realtime[_0x7d37('0x33')]())['then'](vtiger[_0x7d37('0x34')]())['then'](realtime[_0x7d37('0x35')]())[_0x7d37('0x20')](freshsales[_0x7d37('0x36')]())[_0x7d37('0x20')](realtime[_0x7d37('0x37')]())[_0x7d37('0x20')](servicenow[_0x7d37('0x38')]())[_0x7d37('0x20')](realtime['initServicenowAccounts']())[_0x7d37('0x20')](dynamics365[_0x7d37('0x39')]())['then'](realtime[_0x7d37('0x3a')]())[_0x7d37('0x20')](campaign[_0x7d37('0x3b')]())[_0x7d37('0x20')](realtime[_0x7d37('0x3c')]())[_0x7d37('0x20')](voiceExtension[_0x7d37('0x3d')]())[_0x7d37('0x20')](realtime[_0x7d37('0x3e')]())['then'](faxAccount[_0x7d37('0x3f')]())[_0x7d37('0x20')](realtime[_0x7d37('0x40')]())[_0x7d37('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0x7d37('0x41')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x7d37('0x20')](realtime[_0x7d37('0x42')]())[_0x7d37('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x7d37('0x43')]())[_0x7d37('0x20')](cmHopperHistory[_0x7d37('0x44')]())[_0x7d37('0x20')](realtime[_0x7d37('0x45')]())[_0x7d37('0x20')](voiceCallReport[_0x7d37('0x46')]())[_0x7d37('0x20')](realtime['initVoiceCallReports']())[_0x7d37('0x47')](function(_0x193999){logger[_0x7d37('0x48')](_0x7d37('0x49'),util[_0x7d37('0x4a')](_0x193999,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7d37('0x4b')](realtime,preview,fax)[_0x7d37('0x20')](function(_0x1bd3ac){return initRealtime();})[_0x7d37('0x20')](function(){return initParams();})[_0x7d37('0x20')](function(){report[_0x7d37('0x4c')]();setInterval(initRealtime,0x1388);})[_0x7d37('0x47')](function(_0x18b7e5){logger[_0x7d37('0x48')](_0x7d37('0x4d'),util[_0x7d37('0x4a')](_0x18b7e5,{'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 3d0b3b3..73b95ef 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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xedd9,0xfc));var _0x9edd=function(_0x336699,_0x5b67c5){_0x336699=_0x336699-0x0;var _0x467080=_0xedd9[_0x336699];return _0x467080;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1464ec6..065e044 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 _0x5e33=['originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign'];(function(_0x234ce7,_0x3e909c){var _0x57c561=function(_0x8ac1bb){while(--_0x8ac1bb){_0x234ce7['push'](_0x234ce7['shift']());}};_0x57c561(++_0x3e909c);}(_0x5e33,0x11d));var _0x35e3=function(_0x417bef,_0x4ea4e9){_0x417bef=_0x417bef-0x0;var _0x23599a=_0x5e33[_0x417bef];return _0x23599a;};'use strict';function Campaign(_0x1e81ea){this['id']=_0x1e81ea['id']||0x0;this[_0x35e3('0x0')]=_0x1e81ea[_0x35e3('0x0')]||'';this[_0x35e3('0x1')]=_0x1e81ea[_0x35e3('0x1')]||_0x35e3('0x2');this[_0x35e3('0x3')]=0x0;this[_0x35e3('0x4')]=0x0;this[_0x35e3('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x35e3('0x6')]='';this[_0x35e3('0x7')]=!![];this[_0x35e3('0x8')]=_0x1e81ea['active'];this[_0x35e3('0x9')]=_0x1e81ea[_0x35e3('0x9')];this['dialTimezone']=_0x1e81ea[_0x35e3('0xa')]||null;this[_0x35e3('0xb')]=_0x1e81ea[_0x35e3('0xb')]?_0x1e81ea[_0x35e3('0xb')]:null;this['dialOriginateCallerIdName']=_0x1e81ea['dialOriginateCallerIdName'];this[_0x35e3('0xc')]=_0x1e81ea[_0x35e3('0xc')];this[_0x35e3('0xd')]=_0x1e81ea[_0x35e3('0xd')]||0x1e;this[_0x35e3('0xe')]=_0x1e81ea['dialCongestionMaxRetry'];this[_0x35e3('0xf')]=_0x1e81ea[_0x35e3('0xf')];this[_0x35e3('0x10')]=_0x1e81ea['dialBusyMaxRetry'];this[_0x35e3('0x11')]=_0x1e81ea[_0x35e3('0x11')];this[_0x35e3('0x12')]=_0x1e81ea[_0x35e3('0x12')];this[_0x35e3('0x13')]=_0x1e81ea['dialNoAnswerRetryFrequency'];this[_0x35e3('0x14')]=_0x1e81ea[_0x35e3('0x14')];this[_0x35e3('0x15')]=_0x1e81ea[_0x35e3('0x15')]||0x3;this[_0x35e3('0x16')]=_0x1e81ea[_0x35e3('0x16')]||0x96;this[_0x35e3('0x17')]=_0x1e81ea['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1e81ea['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x1e81ea[_0x35e3('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x1e81ea[_0x35e3('0x19')]||0x96;this[_0x35e3('0x1a')]=_0x1e81ea[_0x35e3('0x1a')]||0x3;this[_0x35e3('0x1b')]=_0x1e81ea['dialMachineRetryFrequency']||0x96;this[_0x35e3('0x1c')]=_0x1e81ea[_0x35e3('0x1c')]||0x3;this[_0x35e3('0x1d')]=_0x1e81ea['dialAgentRejectRetryFrequency']||0x96;this[_0x35e3('0x1e')]=_0x1e81ea['dialOrderByScheduledAt']||'DESC';this[_0x35e3('0x1f')]=_0x1e81ea[_0x35e3('0x1f')]||undefined;this[_0x35e3('0x20')]=_0x1e81ea['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x1e81ea['dialCutDigit']||undefined;this[_0x35e3('0x21')]=_0x1e81ea[_0x35e3('0x21')]?_0x1e81ea['TrunkBackup']:undefined;this[_0x35e3('0x22')]=_0x1e81ea[_0x35e3('0x22')]?_0x1e81ea[_0x35e3('0x22')]:undefined;this['Interval']=_0x1e81ea['Interval']?_0x1e81ea[_0x35e3('0x23')]:undefined;this['SquareProject']=_0x1e81ea['SquareProject']?_0x1e81ea[_0x35e3('0x24')]:undefined;this[_0x35e3('0x25')]=_0x1e81ea['SquareProject']?_0x1e81ea[_0x35e3('0x24')][_0x35e3('0x0')]:undefined;this[_0x35e3('0x26')]=_0x1e81ea[_0x35e3('0x26')]||![];this[_0x35e3('0x27')]=_0x1e81ea[_0x35e3('0x27')];this[_0x35e3('0x28')]=_0x1e81ea[_0x35e3('0x28')];this[_0x35e3('0x29')]=_0x1e81ea[_0x35e3('0x29')];this[_0x35e3('0x2a')]=_0x1e81ea[_0x35e3('0x2a')];this['dialAMDMinWordLength']=_0x1e81ea['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x1e81ea[_0x35e3('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x1e81ea[_0x35e3('0x2c')];this['dialAMDSilenceThreshold']=_0x1e81ea[_0x35e3('0x2d')];this['dialAMDMaximumWordLength']=_0x1e81ea[_0x35e3('0x2e')];}module[_0x35e3('0x2f')]=Campaign; \ No newline at end of file +var _0x195a=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x5dd1d8,_0x20fc4e){var _0x18ad62=function(_0x392e6f){while(--_0x392e6f){_0x5dd1d8['push'](_0x5dd1d8['shift']());}};_0x18ad62(++_0x20fc4e);}(_0x195a,0x121));var _0xa195=function(_0xbc6183,_0x502ed5){_0xbc6183=_0xbc6183-0x0;var _0x123f68=_0x195a[_0xbc6183];return _0x123f68;};'use strict';function Campaign(_0xc185db){this['id']=_0xc185db['id']||0x0;this['name']=_0xc185db['name']||'';this['type']=_0xc185db[_0xa195('0x0')]||_0xa195('0x1');this[_0xa195('0x2')]=0x0;this[_0xa195('0x3')]=0x0;this[_0xa195('0x4')]=0x0;this[_0xa195('0x5')]=0x0;this[_0xa195('0x6')]='';this[_0xa195('0x7')]=!![];this[_0xa195('0x8')]=_0xc185db[_0xa195('0x8')];this['limitCalls']=_0xc185db[_0xa195('0x9')];this[_0xa195('0xa')]=_0xc185db['dialTimezone']||null;this['dialGlobalInterval']=_0xc185db[_0xa195('0xb')]?_0xc185db[_0xa195('0xb')]:null;this[_0xa195('0xc')]=_0xc185db[_0xa195('0xc')];this[_0xa195('0xd')]=_0xc185db[_0xa195('0xd')];this[_0xa195('0xe')]=_0xc185db['dialOriginateTimeout']||0x1e;this[_0xa195('0xf')]=_0xc185db[_0xa195('0xf')];this[_0xa195('0x10')]=_0xc185db[_0xa195('0x10')];this[_0xa195('0x11')]=_0xc185db['dialBusyMaxRetry'];this[_0xa195('0x12')]=_0xc185db[_0xa195('0x12')];this[_0xa195('0x13')]=_0xc185db[_0xa195('0x13')];this[_0xa195('0x14')]=_0xc185db[_0xa195('0x14')];this[_0xa195('0x15')]=_0xc185db[_0xa195('0x15')];this[_0xa195('0x16')]=_0xc185db[_0xa195('0x16')]||0x3;this[_0xa195('0x17')]=_0xc185db[_0xa195('0x17')]||0x96;this[_0xa195('0x18')]=_0xc185db[_0xa195('0x18')]||0x3;this['dialDropRetryFrequency']=_0xc185db['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0xc185db[_0xa195('0x19')]||0x3;this[_0xa195('0x1a')]=_0xc185db['dialAbandonedRetryFrequency']||0x96;this[_0xa195('0x1b')]=_0xc185db[_0xa195('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0xc185db[_0xa195('0x1c')]||0x96;this[_0xa195('0x1d')]=_0xc185db[_0xa195('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0xc185db[_0xa195('0x1e')]||0x96;this[_0xa195('0x1f')]=_0xc185db[_0xa195('0x1f')]||_0xa195('0x20');this[_0xa195('0x21')]=_0xc185db['dialPrefix']||undefined;this[_0xa195('0x22')]=_0xc185db[_0xa195('0x22')]||undefined;this[_0xa195('0x23')]=_0xc185db['dialCutDigit']||undefined;this[_0xa195('0x24')]=_0xc185db[_0xa195('0x24')]?_0xc185db[_0xa195('0x24')]:undefined;this['Trunk']=_0xc185db[_0xa195('0x25')]?_0xc185db[_0xa195('0x25')]:undefined;this[_0xa195('0x26')]=_0xc185db['Interval']?_0xc185db[_0xa195('0x26')]:undefined;this['SquareProject']=_0xc185db[_0xa195('0x27')]?_0xc185db['SquareProject']:undefined;this[_0xa195('0x28')]=_0xc185db['SquareProject']?_0xc185db[_0xa195('0x27')]['name']:undefined;this[_0xa195('0x29')]=_0xc185db['dialAMDActive']||![];this[_0xa195('0x2a')]=_0xc185db['dialAMDInitialSilence'];this[_0xa195('0x2b')]=_0xc185db[_0xa195('0x2b')];this[_0xa195('0x2c')]=_0xc185db['dialAMDAfterGreetingSilence'];this[_0xa195('0x2d')]=_0xc185db['dialAMDTotalAnalysisTime'];this[_0xa195('0x2e')]=_0xc185db['dialAMDMinWordLength'];this[_0xa195('0x2f')]=_0xc185db['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0xc185db[_0xa195('0x30')];this[_0xa195('0x31')]=_0xc185db[_0xa195('0x31')];this[_0xa195('0x32')]=_0xc185db[_0xa195('0x32')];}module[_0xa195('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 0423996..a4657a7 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 _0x3c85=['destinationchannel','calleridnum','connectedlinename','accountcode','context','linkedid','exten','answered','lastapplication','billableseconds','holdtime','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel'];(function(_0x1f5788,_0x3366e5){var _0x6e28f0=function(_0x95477f){while(--_0x95477f){_0x1f5788['push'](_0x1f5788['shift']());}};_0x6e28f0(++_0x3366e5);}(_0x3c85,0x1a0));var _0x53c8=function(_0x4dee00,_0x580191){_0x4dee00=_0x4dee00-0x0;var _0x10b1b9=_0x3c85[_0x4dee00];return _0x10b1b9;};'use strict';function Channel(){this[_0x53c8('0x0')]=null;this[_0x53c8('0x1')]='';this[_0x53c8('0x2')]='';this[_0x53c8('0x3')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x53c8('0x4')]=undefined;this[_0x53c8('0x5')]=0x0;this[_0x53c8('0x6')]='';this['uniqueid']=0x0;this[_0x53c8('0x7')]=0x0;this[_0x53c8('0x8')]=0x0;this[_0x53c8('0x9')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0x53c8('0xa')]='';this['lastdata']='';this['duration']=0x0;this[_0x53c8('0xb')]=0x0;this[_0x53c8('0xc')]=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0x53c8('0xd')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x53c8('0xe')]=[];this[_0x53c8('0xf')]=undefined;this[_0x53c8('0x10')]=undefined;this[_0x53c8('0x11')]=undefined;this[_0x53c8('0x12')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x84c6=['answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','type','disposition','monitor','monitorFilename','queue','monitors','transferType','exports','destinationchannel','calleridnum','calleridname','connectedlinename','context','uniqueid','linkedid','exten','answered'];(function(_0x171bad,_0x4e5d56){var _0x4a1244=function(_0x2df084){while(--_0x2df084){_0x171bad['push'](_0x171bad['shift']());}};_0x4a1244(++_0x4e5d56);}(_0x84c6,0xe7));var _0x684c=function(_0x1baebe,_0x31ae03){_0x1baebe=_0x1baebe-0x0;var _0x202a23=_0x84c6[_0x1baebe];return _0x202a23;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x684c('0x0')]='';this[_0x684c('0x1')]=0x0;this[_0x684c('0x2')]='';this['connectedlinenum']=undefined;this[_0x684c('0x3')]=undefined;this['accountcode']=0x0;this[_0x684c('0x4')]='';this[_0x684c('0x5')]=0x0;this[_0x684c('0x6')]=0x0;this[_0x684c('0x7')]=0x0;this[_0x684c('0x8')]=![];this[_0x684c('0x9')]=null;this[_0x684c('0xa')]=null;this[_0x684c('0xb')]=![];this[_0x684c('0xc')]=![];this[_0x684c('0xd')]='';this['lastdata']='';this[_0x684c('0xe')]=0x0;this[_0x684c('0xf')]=0x0;this['holdtime']=0x0;this[_0x684c('0x10')]=null;this['tag']=null;this[_0x684c('0x11')]=null;this[_0x684c('0x12')]=![];this[_0x684c('0x13')]=null;this[_0x684c('0x14')]=null;this[_0x684c('0x15')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x684c('0x16')]=undefined;this['mohtime']=0x0;}module[_0x684c('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 d80ea37..de15229 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 _0xb6c7=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','name','username','authType'];(function(_0x5c6645,_0x76bec0){var _0x5d9483=function(_0x4315c8){while(--_0x4315c8){_0x5c6645['push'](_0x5c6645['shift']());}};_0x5d9483(++_0x76bec0);}(_0xb6c7,0x1c9));var _0x7b6c=function(_0x49dc49,_0x5b0a31){_0x49dc49=_0x49dc49-0x0;var _0x2e2af8=_0xb6c7[_0x49dc49];return _0x2e2af8;};'use strict';function DeskAccount(_0x41cac7){this['id']=_0x41cac7['id']||0x0;this[_0x7b6c('0x0')]=_0x41cac7[_0x7b6c('0x0')]||'';this[_0x7b6c('0x1')]=_0x41cac7[_0x7b6c('0x1')]||'';this['remoteUri']=_0x41cac7['remoteUri']||'';this[_0x7b6c('0x2')]=_0x41cac7[_0x7b6c('0x2')]||'';this[_0x7b6c('0x3')]=_0x41cac7[_0x7b6c('0x3')]||'';this[_0x7b6c('0x4')]=_0x41cac7[_0x7b6c('0x4')]||'';this[_0x7b6c('0x5')]=_0x41cac7[_0x7b6c('0x5')]||'';this['token']=_0x41cac7[_0x7b6c('0x6')]||'';this[_0x7b6c('0x7')]=_0x41cac7['tokenSecret']||'';this['type']=_0x41cac7[_0x7b6c('0x8')]||'';this[_0x7b6c('0x9')]=_0x41cac7['serverUrl']||'';this['Configurations']=_0x41cac7['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x3e80=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x29fc56,_0x1c45b3){var _0xafe725=function(_0x93477){while(--_0x93477){_0x29fc56['push'](_0x29fc56['shift']());}};_0xafe725(++_0x1c45b3);}(_0x3e80,0x157));var _0x03e8=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0x3e80[_0x2493f7];return _0x594ab2;};'use strict';function DeskAccount(_0x54c832){this['id']=_0x54c832['id']||0x0;this[_0x03e8('0x0')]=_0x54c832[_0x03e8('0x0')]||'';this[_0x03e8('0x1')]=_0x54c832[_0x03e8('0x1')]||'';this[_0x03e8('0x2')]=_0x54c832[_0x03e8('0x2')]||'';this['authType']=_0x54c832[_0x03e8('0x3')]||'';this[_0x03e8('0x4')]=_0x54c832['password']||'';this['consumerKey']=_0x54c832[_0x03e8('0x5')]||'';this['consumerSecret']=_0x54c832[_0x03e8('0x6')]||'';this[_0x03e8('0x7')]=_0x54c832[_0x03e8('0x7')]||'';this[_0x03e8('0x8')]=_0x54c832[_0x03e8('0x8')]||'';this['type']=_0x54c832[_0x03e8('0x9')]||'';this[_0x03e8('0xa')]=_0x54c832['serverUrl']||'';this[_0x03e8('0xb')]=_0x54c832[_0x03e8('0xb')]||{};}module[_0x03e8('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 8844d32..e190b7d 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 _0x2cc6=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','username','password','remoteUri'];(function(_0x1fb749,_0x1f268c){var _0x1a6be2=function(_0x378b80){while(--_0x378b80){_0x1fb749['push'](_0x1fb749['shift']());}};_0x1a6be2(++_0x1f268c);}(_0x2cc6,0x1cb));var _0x62cc=function(_0x899a7b,_0x47f3fe){_0x899a7b=_0x899a7b-0x0;var _0x501574=_0x2cc6[_0x899a7b];return _0x501574;};'use strict';function Dynamics365Account(_0x33da98){this['id']=_0x33da98['id']||0x0;this['name']=_0x33da98['name']||'';this[_0x62cc('0x0')]=_0x33da98['username']||'';this[_0x62cc('0x1')]=_0x33da98[_0x62cc('0x1')]||'';this[_0x62cc('0x2')]=_0x33da98[_0x62cc('0x2')]||'';this[_0x62cc('0x3')]=_0x33da98['tenantId']||'';this[_0x62cc('0x4')]=_0x33da98[_0x62cc('0x4')]||'';this[_0x62cc('0x5')]=_0x33da98[_0x62cc('0x5')]||{};this[_0x62cc('0x6')]=_0x33da98['serverUrl']||'';this[_0x62cc('0x7')]=_0x33da98[_0x62cc('0x7')]||![];this['Configurations']=_0x33da98[_0x62cc('0x8')]||{};this[_0x62cc('0x9')]=_0x33da98[_0x62cc('0x9')]||{};}module[_0x62cc('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xf891=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xf891,0xaa));var _0x1f89=function(_0x318bb6,_0x56076e){_0x318bb6=_0x318bb6-0x0;var _0x4128f6=_0xf891[_0x318bb6];return _0x4128f6;};'use strict';function Dynamics365Account(_0x2d64ea){this['id']=_0x2d64ea['id']||0x0;this['name']=_0x2d64ea[_0x1f89('0x0')]||'';this[_0x1f89('0x1')]=_0x2d64ea['username']||'';this[_0x1f89('0x2')]=_0x2d64ea['password']||'';this[_0x1f89('0x3')]=_0x2d64ea[_0x1f89('0x3')]||'';this['tenantId']=_0x2d64ea[_0x1f89('0x4')]||'';this[_0x1f89('0x5')]=_0x2d64ea['clientId']||'';this[_0x1f89('0x6')]=_0x2d64ea[_0x1f89('0x6')]||{};this[_0x1f89('0x7')]=_0x2d64ea[_0x1f89('0x7')]||'';this[_0x1f89('0x8')]=_0x2d64ea['modernAuthentication']||![];this[_0x1f89('0x9')]=_0x2d64ea['Configurations']||{};this[_0x1f89('0xa')]=_0x2d64ea['CloudProvider']||{};}module[_0x1f89('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 99af554..8e4ff93 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 _0x0e1a=['description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e1a,0xef));var _0xa0e1=function(_0x46075d,_0x13bbeb){_0x46075d=_0x46075d-0x0;var _0xa1d75d=_0x0e1a[_0x46075d];return _0xa1d75d;};'use strict';function FaxAccount(_0x221082){this['id']=_0x221082['id']||0x0;this[_0xa0e1('0x0')]=_0x221082[_0xa0e1('0x0')]||'';this[_0xa0e1('0x1')]=_0x221082[_0xa0e1('0x1')];this['ecm']=_0x221082['ecm'];this[_0xa0e1('0x2')]=_0x221082[_0xa0e1('0x2')];this['localstationid']=_0x221082[_0xa0e1('0x3')];this['minrate']=_0x221082[_0xa0e1('0x4')]||0x960;this[_0xa0e1('0x5')]=_0x221082[_0xa0e1('0x5')]||0x3840;this[_0xa0e1('0x6')]=_0x221082['modem']||_0xa0e1('0x7');this['gateway']=_0x221082[_0xa0e1('0x8')]||'no';this['faxdetect']=_0x221082[_0xa0e1('0x9')]||'no';this['t38timeout']=_0x221082[_0xa0e1('0xa')]||0x1388;this['tech']=_0x221082[_0xa0e1('0xb')]||'SIP';this[_0xa0e1('0xc')]=_0x221082['Trunk']?_0x221082[_0xa0e1('0xc')]:undefined;this[_0xa0e1('0xd')]=_0x221082[_0xa0e1('0xd')];this[_0xa0e1('0xe')]=_0x221082[_0xa0e1('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x741c=['maxrate','gateway','faxdetect','t38timeout','tech','SIP','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x2c8b3d,_0x5302f9){var _0x198c88=function(_0x316c91){while(--_0x316c91){_0x2c8b3d['push'](_0x2c8b3d['shift']());}};_0x198c88(++_0x5302f9);}(_0x741c,0xae));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';function FaxAccount(_0x23c132){this['id']=_0x23c132['id']||0x0;this[_0xc741('0x0')]=_0x23c132[_0xc741('0x0')]||'';this[_0xc741('0x1')]=_0x23c132[_0xc741('0x1')];this[_0xc741('0x2')]=_0x23c132['ecm'];this['headerinfo']=_0x23c132[_0xc741('0x3')];this['localstationid']=_0x23c132[_0xc741('0x4')];this[_0xc741('0x5')]=_0x23c132[_0xc741('0x5')]||0x960;this[_0xc741('0x6')]=_0x23c132['maxrate']||0x3840;this['modem']=_0x23c132['modem']||'v17,v27,v29';this[_0xc741('0x7')]=_0x23c132[_0xc741('0x7')]||'no';this[_0xc741('0x8')]=_0x23c132[_0xc741('0x8')]||'no';this[_0xc741('0x9')]=_0x23c132[_0xc741('0x9')]||0x1388;this[_0xc741('0xa')]=_0x23c132[_0xc741('0xa')]||_0xc741('0xb');this['Trunk']=_0x23c132['Trunk']?_0x23c132['Trunk']:undefined;this['ListId']=_0x23c132[_0xc741('0xc')];this[_0xc741('0xd')]=_0x23c132['key'];}module[_0xc741('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 2b50bfc..257000b 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 _0x4407=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4407,0x17f));var _0x7440=function(_0xea38c3,_0x16bafc){_0xea38c3=_0xea38c3-0x0;var _0x52e8f8=_0x4407[_0xea38c3];return _0x52e8f8;};'use strict';function FreshdeskAccount(_0x53f08d){this['id']=_0x53f08d['id']||0x0;this[_0x7440('0x0')]=_0x53f08d[_0x7440('0x0')]||'';this['username']=_0x53f08d[_0x7440('0x1')]||'';this['apiKey']=_0x53f08d[_0x7440('0x2')]||'';this[_0x7440('0x3')]=_0x53f08d['remoteUri']||'';this[_0x7440('0x4')]=_0x53f08d[_0x7440('0x4')]||'';this[_0x7440('0x5')]=_0x53f08d[_0x7440('0x5')]||{};}module[_0x7440('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x9e71=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x1e07e5,_0x59bf3f){var _0x476f24=function(_0x192706){while(--_0x192706){_0x1e07e5['push'](_0x1e07e5['shift']());}};_0x476f24(++_0x59bf3f);}(_0x9e71,0x1a5));var _0x19e7=function(_0x7c506f,_0x23ab0e){_0x7c506f=_0x7c506f-0x0;var _0xbd4bf0=_0x9e71[_0x7c506f];return _0xbd4bf0;};'use strict';function FreshdeskAccount(_0x17f5a2){this['id']=_0x17f5a2['id']||0x0;this[_0x19e7('0x0')]=_0x17f5a2['name']||'';this['username']=_0x17f5a2[_0x19e7('0x1')]||'';this['apiKey']=_0x17f5a2['token']||'';this[_0x19e7('0x2')]=_0x17f5a2[_0x19e7('0x2')]||'';this['serverUrl']=_0x17f5a2[_0x19e7('0x3')]||'';this[_0x19e7('0x4')]=_0x17f5a2[_0x19e7('0x4')]||{};}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 a934d27..123cf0e 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 _0xef39=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xef39,0x92));var _0x9ef3=function(_0x48b619,_0x45c5c9){_0x48b619=_0x48b619-0x0;var _0x212a07=_0xef39[_0x48b619];return _0x212a07;};'use strict';function FreshsalesAccount(_0x5dea47){this['id']=_0x5dea47['id']||0x0;this[_0x9ef3('0x0')]=_0x5dea47[_0x9ef3('0x0')]||'';this[_0x9ef3('0x1')]=_0x5dea47[_0x9ef3('0x1')]||'';this[_0x9ef3('0x2')]=_0x5dea47[_0x9ef3('0x3')]||'';this[_0x9ef3('0x4')]=_0x5dea47[_0x9ef3('0x4')]||'';this[_0x9ef3('0x5')]=_0x5dea47[_0x9ef3('0x5')]||'';this[_0x9ef3('0x6')]=_0x5dea47[_0x9ef3('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x536e=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x536e,0x155));var _0xe536=function(_0xb4d928,_0x579093){_0xb4d928=_0xb4d928-0x0;var _0x47166e=_0x536e[_0xb4d928];return _0x47166e;};'use strict';function FreshsalesAccount(_0x56606f){this['id']=_0x56606f['id']||0x0;this[_0xe536('0x0')]=_0x56606f[_0xe536('0x0')]||'';this[_0xe536('0x1')]=_0x56606f[_0xe536('0x1')]||'';this[_0xe536('0x2')]=_0x56606f[_0xe536('0x3')]||'';this[_0xe536('0x4')]=_0x56606f[_0xe536('0x4')]||'';this[_0xe536('0x5')]=_0x56606f[_0xe536('0x5')]||'';this[_0xe536('0x6')]=_0x56606f[_0xe536('0x6')]||{};}module[_0xe536('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 34cc004..943f789 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 _0xba4c=['mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice'];(function(_0x1dd7d8,_0x9ba9c9){var _0x81acc9=function(_0x1373b9){while(--_0x1373b9){_0x1dd7d8['push'](_0x1dd7d8['shift']());}};_0x81acc9(++_0x9ba9c9);}(_0xba4c,0x8a));var _0xcba4=function(_0x47b73a,_0x2b0b31){_0x47b73a=_0x47b73a-0x0;var _0x5609a0=_0xba4c[_0x47b73a];return _0x5609a0;};'use strict';function QueueReport(){this['type']=_0xcba4('0x0');this[_0xcba4('0x1')]='';this[_0xcba4('0x2')]='';this[_0xcba4('0x3')]='';this[_0xcba4('0x4')]='';this[_0xcba4('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0xcba4('0x6')]=![];this[_0xcba4('0x7')]=null;this[_0xcba4('0x8')]=![];this[_0xcba4('0x9')]=null;this[_0xcba4('0xa')]=![];this[_0xcba4('0xb')]=null;this[_0xcba4('0xc')]=0x1;this[_0xcba4('0xd')]='';this[_0xcba4('0xe')]='';this[_0xcba4('0xf')]='';this[_0xcba4('0x10')]='';this[_0xcba4('0x11')]='';this[_0xcba4('0x12')]='';this[_0xcba4('0x13')]='';this[_0xcba4('0x14')]=0x0;this[_0xcba4('0x15')]=![];this['lastAssignedTo']='';this[_0xcba4('0x16')]=_0xcba4('0x17');this[_0xcba4('0x18')]=0x0;this[_0xcba4('0x19')]={};}module[_0xcba4('0x1a')]=QueueReport; \ No newline at end of file +var _0x52b5=['queue','queuecallerleaveAt','position','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','mohtime','variables','type','inbound','uniqueid','calleridnum'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x52b5,0xec));var _0x552b=function(_0x2975f1,_0x453f49){_0x2975f1=_0x2975f1-0x0;var _0x2c08d5=_0x52b5[_0x2975f1];return _0x2c08d5;};'use strict';function QueueReport(){this[_0x552b('0x0')]=_0x552b('0x1');this[_0x552b('0x2')]='';this[_0x552b('0x3')]='';this['calleridname']='';this[_0x552b('0x4')]='';this['queuecallerjoinAt']=null;this[_0x552b('0x5')]=null;this[_0x552b('0x6')]=0x1;this['count']=0x1;this[_0x552b('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x552b('0x8')]=![];this['queuecallercompleteAt']=null;this[_0x552b('0x9')]=![];this[_0x552b('0xa')]=null;this[_0x552b('0xb')]=0x1;this[_0x552b('0xc')]='';this[_0x552b('0xd')]='';this[_0x552b('0xe')]='';this[_0x552b('0xf')]='';this[_0x552b('0x10')]='';this[_0x552b('0x11')]='';this[_0x552b('0x12')]='';this[_0x552b('0x13')]=0x0;this[_0x552b('0x14')]=![];this['lastAssignedTo']='';this[_0x552b('0x15')]='voice';this[_0x552b('0x16')]=0x0;this[_0x552b('0x17')]={};}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 9fd7f64..8ea1266 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 _0xdbeb=['remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0xdbeb,0x174));var _0xbdbe=function(_0x56ddd3,_0x1b53aa){_0x56ddd3=_0x56ddd3-0x0;var _0x327609=_0xdbeb[_0x56ddd3];return _0x327609;};'use strict';function SalesforceAccount(_0x8383bd){this['id']=_0x8383bd['id']||0x0;this[_0xbdbe('0x0')]=_0x8383bd[_0xbdbe('0x0')]||'';this[_0xbdbe('0x1')]=_0x8383bd[_0xbdbe('0x1')]||'';this[_0xbdbe('0x2')]=_0x8383bd[_0xbdbe('0x2')]||'';this['password']=_0x8383bd[_0xbdbe('0x3')]||'';this['clientId']=_0x8383bd['clientId']||'';this['clientSecret']=_0x8383bd[_0xbdbe('0x4')]||'';this[_0xbdbe('0x5')]=_0x8383bd[_0xbdbe('0x5')]||'';this[_0xbdbe('0x6')]=_0x8383bd['type']||_0xbdbe('0x7');this[_0xbdbe('0x8')]=_0x8383bd[_0xbdbe('0x8')]||'';this[_0xbdbe('0x9')]=_0x8383bd[_0xbdbe('0x9')]||{};}module[_0xbdbe('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x8651=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','securityToken','type','integrationTab'];(function(_0x163628,_0x55a1f8){var _0xbfa4a1=function(_0x19da44){while(--_0x19da44){_0x163628['push'](_0x163628['shift']());}};_0xbfa4a1(++_0x55a1f8);}(_0x8651,0x142));var _0x1865=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x8651[_0x525c7b];return _0x27b33e;};'use strict';function SalesforceAccount(_0x2e54fc){this['id']=_0x2e54fc['id']||0x0;this[_0x1865('0x0')]=_0x2e54fc[_0x1865('0x0')]||'';this['username']=_0x2e54fc[_0x1865('0x1')]||'';this[_0x1865('0x2')]=_0x2e54fc[_0x1865('0x2')]||'';this[_0x1865('0x3')]=_0x2e54fc[_0x1865('0x3')]||'';this[_0x1865('0x4')]=_0x2e54fc['clientId']||'';this['clientSecret']=_0x2e54fc['clientSecret']||'';this[_0x1865('0x5')]=_0x2e54fc[_0x1865('0x5')]||'';this[_0x1865('0x6')]=_0x2e54fc[_0x1865('0x6')]||_0x1865('0x7');this[_0x1865('0x8')]=_0x2e54fc[_0x1865('0x8')]||'';this[_0x1865('0x9')]=_0x2e54fc[_0x1865('0x9')]||{};}module[_0x1865('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 d373b7c..6c7ec1c 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 _0x9635=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x52e7d5,_0x292993){var _0x9b5d0c=function(_0x354653){while(--_0x354653){_0x52e7d5['push'](_0x52e7d5['shift']());}};_0x9b5d0c(++_0x292993);}(_0x9635,0xce));var _0x5963=function(_0x806a0c,_0x3c9b7a){_0x806a0c=_0x806a0c-0x0;var _0x21d4fe=_0x9635[_0x806a0c];return _0x21d4fe;};'use strict';function ServicenowAccount(_0x4c09c9){this['id']=_0x4c09c9['id']||0x0;this[_0x5963('0x0')]=_0x4c09c9['name']||'';this[_0x5963('0x1')]=_0x4c09c9['username']||'';this['password']=_0x4c09c9[_0x5963('0x2')]||'';this[_0x5963('0x3')]=_0x4c09c9[_0x5963('0x3')]||'';this[_0x5963('0x4')]=_0x4c09c9['serverUrl']||'';this[_0x5963('0x5')]=_0x4c09c9[_0x5963('0x5')]||{};}module[_0x5963('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x0409=['username','password','Configurations','exports','name'];(function(_0x2705ac,_0x59a9cd){var _0x3b373c=function(_0x13ae25){while(--_0x13ae25){_0x2705ac['push'](_0x2705ac['shift']());}};_0x3b373c(++_0x59a9cd);}(_0x0409,0xa4));var _0x9040=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x0409[_0x491a7f];return _0x3d8f44;};'use strict';function ServicenowAccount(_0x50a849){this['id']=_0x50a849['id']||0x0;this['name']=_0x50a849[_0x9040('0x0')]||'';this[_0x9040('0x1')]=_0x50a849['username']||'';this[_0x9040('0x2')]=_0x50a849[_0x9040('0x2')]||'';this['remoteUri']=_0x50a849['remoteUri']||'';this['serverUrl']=_0x50a849['serverUrl']||'';this[_0x9040('0x3')]=_0x50a849['Configurations']||{};}module[_0x9040('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 2661fb9..d55cfa8 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 _0x77ec=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x529f10,_0x459c06){var _0x77a1f1=function(_0x1e6a58){while(--_0x1e6a58){_0x529f10['push'](_0x529f10['shift']());}};_0x77a1f1(++_0x459c06);}(_0x77ec,0x1ec));var _0xc77e=function(_0x553362,_0x5ba4f9){_0x553362=_0x553362-0x0;var _0x454ad0=_0x77ec[_0x553362];return _0x454ad0;};'use strict';function SugarcrmAccount(_0x4e3693){this['id']=_0x4e3693['id']||0x0;this[_0xc77e('0x0')]=_0x4e3693[_0xc77e('0x0')]||'';this[_0xc77e('0x1')]=_0x4e3693[_0xc77e('0x1')]||'';this[_0xc77e('0x2')]=_0x4e3693[_0xc77e('0x2')]||'';this[_0xc77e('0x3')]=_0x4e3693[_0xc77e('0x3')]||'';this['serverUrl']=_0x4e3693[_0xc77e('0x4')]||'';this[_0xc77e('0x5')]=_0x4e3693[_0xc77e('0x5')]||{};}module[_0xc77e('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x9fef=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x871a59,_0x587263){var _0x4808f9=function(_0x4d1284){while(--_0x4d1284){_0x871a59['push'](_0x871a59['shift']());}};_0x4808f9(++_0x587263);}(_0x9fef,0x1d6));var _0xf9fe=function(_0x319fa0,_0x31377a){_0x319fa0=_0x319fa0-0x0;var _0x464fee=_0x9fef[_0x319fa0];return _0x464fee;};'use strict';function SugarcrmAccount(_0x3e425e){this['id']=_0x3e425e['id']||0x0;this['name']=_0x3e425e[_0xf9fe('0x0')]||'';this[_0xf9fe('0x1')]=_0x3e425e['username']||'';this[_0xf9fe('0x2')]=_0x3e425e[_0xf9fe('0x2')]||'';this[_0xf9fe('0x3')]=_0x3e425e[_0xf9fe('0x3')]||'';this[_0xf9fe('0x4')]=_0x3e425e['serverUrl']||'';this[_0xf9fe('0x5')]=_0x3e425e[_0xf9fe('0x5')]||{};}module[_0xf9fe('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 721c9a1..5288256 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 _0xb4c2=['stateTime','status','address','exports','name','accountcode','state','unknown'];(function(_0x1b0011,_0x13cf37){var _0x540300=function(_0x1a5e43){while(--_0x1a5e43){_0x1b0011['push'](_0x1b0011['shift']());}};_0x540300(++_0x13cf37);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x5e96a0,_0x84c281){_0x5e96a0=_0x5e96a0-0x0;var _0x584368=_0xb4c2[_0x5e96a0];return _0x584368;};'use strict';function Telephone(_0x52d764){this['id']=_0x52d764['id']||0x0;this[_0x2b4c('0x0')]=_0x52d764[_0x2b4c('0x0')]||'';this[_0x2b4c('0x1')]=_0x52d764[_0x2b4c('0x1')]||'';this[_0x2b4c('0x2')]=_0x2b4c('0x3');this[_0x2b4c('0x4')]=0x0;this[_0x2b4c('0x5')]=_0x2b4c('0x3');this[_0x2b4c('0x6')]='';}module[_0x2b4c('0x7')]=Telephone; \ No newline at end of file +var _0xe468=['address','exports','name','accountcode','state','stateTime','status','unknown'];(function(_0x1bf75b,_0x4e608f){var _0xa2a081=function(_0x400e67){while(--_0x400e67){_0x1bf75b['push'](_0x1bf75b['shift']());}};_0xa2a081(++_0x4e608f);}(_0xe468,0x92));var _0x8e46=function(_0x2dbf69,_0x52c626){_0x2dbf69=_0x2dbf69-0x0;var _0x3dc208=_0xe468[_0x2dbf69];return _0x3dc208;};'use strict';function Telephone(_0x279b67){this['id']=_0x279b67['id']||0x0;this[_0x8e46('0x0')]=_0x279b67[_0x8e46('0x0')]||'';this[_0x8e46('0x1')]=_0x279b67['accountcode']||'';this[_0x8e46('0x2')]='unknown';this[_0x8e46('0x3')]=0x0;this[_0x8e46('0x4')]=_0x8e46('0x5');this[_0x8e46('0x6')]='';}module[_0x8e46('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b7beddd..3d01f53 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(_0x59ddca,_0x1c099f){var _0xbc1341=function(_0x7c96b8){while(--_0x7c96b8){_0x59ddca['push'](_0x59ddca['shift']());}};_0xbc1341(++_0x1c099f);}(_0xb10b,0x12a));var _0xbb10=function(_0x15af2f,_0x3c0a01){_0x15af2f=_0x15af2f-0x0;var _0x359239=_0xb10b[_0x15af2f];return _0x359239;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x3c1b2a,_0x505cc6){var _0x44898c=function(_0x226173){while(--_0x226173){_0x3c1b2a['push'](_0x3c1b2a['shift']());}};_0x44898c(++_0x505cc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 04eecef..ad02b66 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x513a33,_0x5bebb1){var _0x10eebe=function(_0x1ec8b0){while(--_0x1ec8b0){_0x513a33['push'](_0x513a33['shift']());}};_0x10eebe(++_0x5bebb1);}(_0xb10b,0x12a));var _0xbb10=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb10b[_0x8c43de];return _0xa6591b;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x5b9b95,_0x1c7807){var _0x463ccb=function(_0x1b2945){while(--_0x1b2945){_0x5b9b95['push'](_0x5b9b95['shift']());}};_0x463ccb(++_0x1c7807);}(_0x2032,0xd9));var _0x2203=function(_0x1e26f9,_0xef2cf2){_0x1e26f9=_0x1e26f9-0x0;var _0x15ec5d=_0x2032[_0x1e26f9];return _0x15ec5d;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 65132b8..2d70b61 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 _0x01e6=['host','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf'];(function(_0x46034e,_0x3d44c7){var _0x58531a=function(_0x6aa523){while(--_0x6aa523){_0x46034e['push'](_0x46034e['shift']());}};_0x58531a(++_0x3d44c7);}(_0x01e6,0x189));var _0x601e=function(_0x181f8e,_0x1606a8){_0x181f8e=_0x181f8e-0x0;var _0x4c4e3f=_0x01e6[_0x181f8e];return _0x4c4e3f;};'use strict';function Trunk(_0x4d464b){this['id']=_0x4d464b['id']||0x0;this[_0x601e('0x0')]=_0x4d464b['active']||![];this[_0x601e('0x1')]=_0x4d464b['name']||'';this[_0x601e('0x2')]=_0x601e('0x3');this[_0x601e('0x4')]=0x0;this['status']=_0x601e('0x3');this['registry']=_0x4d464b[_0x601e('0x5')]&&_0x4d464b['registry'][_0x601e('0x6')](':')?_0x4d464b['registry']['split'](':')[0x0]:'';this[_0x601e('0x7')]='';this[_0x601e('0x8')]='';this[_0x601e('0x9')]='';this[_0x601e('0xa')]='';this['refresh']='';this[_0x601e('0xb')]='unknown';this[_0x601e('0xc')]='';this[_0x601e('0xd')]='';this[_0x601e('0xe')]=_0x4d464b[_0x601e('0xe')]||'';}module[_0x601e('0xf')]=Trunk; \ No newline at end of file +var _0xc205=['stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc205,0xe7));var _0x5c20=function(_0x286596,_0x332d8f){_0x286596=_0x286596-0x0;var _0x48f82f=_0xc205[_0x286596];return _0x48f82f;};'use strict';function Trunk(_0x27bfce){this['id']=_0x27bfce['id']||0x0;this[_0x5c20('0x0')]=_0x27bfce[_0x5c20('0x0')]||![];this[_0x5c20('0x1')]=_0x27bfce[_0x5c20('0x1')]||'';this['state']=_0x5c20('0x2');this[_0x5c20('0x3')]=0x0;this[_0x5c20('0x4')]=_0x5c20('0x2');this[_0x5c20('0x5')]=_0x27bfce[_0x5c20('0x5')]&&_0x27bfce[_0x5c20('0x5')][_0x5c20('0x6')](':')?_0x27bfce['registry'][_0x5c20('0x7')](':')[0x0]:'';this[_0x5c20('0x8')]='';this[_0x5c20('0x9')]='';this[_0x5c20('0xa')]='';this[_0x5c20('0xb')]='';this[_0x5c20('0xc')]='';this[_0x5c20('0xd')]=_0x5c20('0x2');this[_0x5c20('0xe')]='';this[_0x5c20('0xf')]='';this[_0x5c20('0x10')]=_0x27bfce[_0x5c20('0x10')]||'';}module[_0x5c20('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0a4b485..ed32ef1 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 _0x08c0=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x08c0,0xef));var _0x008c=function(_0x2d0e29,_0x43466c){_0x2d0e29=_0x2d0e29-0x0;var _0x525ce5=_0x08c0[_0x2d0e29];return _0x525ce5;};'use strict';function voiceExtension(_0x56bfa3){this['id']=_0x56bfa3['id']||0x0;this['exten']=_0x56bfa3[_0x008c('0x0')]||'';this[_0x008c('0x1')]=_0x56bfa3[_0x008c('0x1')]||'none';this[_0x008c('0x2')]=_0x56bfa3['mandatoryDisposition']||![];}module[_0x008c('0x3')]=voiceExtension; \ No newline at end of file +var _0xdc89=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0xee0f23,_0x599581){var _0x53fab5=function(_0x46bd8f){while(--_0x46bd8f){_0xee0f23['push'](_0xee0f23['shift']());}};_0x53fab5(++_0x599581);}(_0xdc89,0xa4));var _0x9dc8=function(_0x2b91ac,_0x310741){_0x2b91ac=_0x2b91ac-0x0;var _0xe88814=_0xdc89[_0x2b91ac];return _0xe88814;};'use strict';function voiceExtension(_0x3cc68a){this['id']=_0x3cc68a['id']||0x0;this[_0x9dc8('0x0')]=_0x3cc68a['exten']||'';this[_0x9dc8('0x1')]=_0x3cc68a['recordingFormat']||_0x9dc8('0x2');this[_0x9dc8('0x3')]=_0x3cc68a[_0x9dc8('0x3')]||![];}module[_0x9dc8('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 18a5682..651f583 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 _0x58b4=['mandatoryDispositionPause','exports','unknown','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','unmanaged','loggedIn','available','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x58b4,0x16d));var _0x458b=function(_0x11be8e,_0x57a1fe){_0x11be8e=_0x11be8e-0x0;var _0x4ae6b9=_0x58b4[_0x11be8e];return _0x4ae6b9;};'use strict';var statusDesc=[_0x458b('0x0'),'not_inuse','inuse','busy',_0x458b('0x1'),_0x458b('0x2'),'ringing',_0x458b('0x3'),_0x458b('0x4')];var monitorFormat={'wav':_0x458b('0x5'),'wav49':_0x458b('0x6'),'gsm':_0x458b('0x7')};var strategy={'rrmemory':_0x458b('0x8'),'roundrobin':_0x458b('0x9')};function VoiceQueue(_0x11217b){this['id']=_0x11217b['id']||0x0;this['name']=_0x11217b[_0x458b('0xa')]||'';this['monitor_format']=_0x11217b[_0x458b('0xb')]||'';this[_0x458b('0xc')]=_0x11217b[_0x458b('0xc')]||_0x458b('0xd');this[_0x458b('0xe')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0x458b('0xf')]=0x0;this[_0x458b('0x10')]=0x0;this[_0x458b('0x11')]=0x0;this['sumBillable']=0x0;this[_0x458b('0x12')]=0x0;this['abandoned']=0x0;this[_0x458b('0x13')]=0x0;this[_0x458b('0x14')]=0x0;this[_0x458b('0x15')]=_0x11217b[_0x458b('0x15')]||![];this['acwTimeout']=_0x11217b['acwTimeout']||0xa;this[_0x458b('0x16')]=_0x11217b[_0x458b('0x16')]||'no';this[_0x458b('0x17')]=!![];this[_0x458b('0x18')]='';this[_0x458b('0x19')]=0x0;this[_0x458b('0x1a')]=0x0;this[_0x458b('0x1b')]=_0x11217b[_0x458b('0x1b')]||null;this[_0x458b('0x1c')]=_0x11217b['dialGlobalInterval']?_0x11217b[_0x458b('0x1c')]:null;this[_0x458b('0x1d')]=_0x11217b['dialActive'];this[_0x458b('0x1e')]=_0x11217b[_0x458b('0x1e')]||'progressive';this['dialLimitChannel']=_0x11217b['dialLimitChannel']||0x0;this[_0x458b('0x1f')]=_0x11217b[_0x458b('0x1f')]||0x0;this['dialPowerLevel']=_0x11217b['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x11217b[_0x458b('0x20')]||_0x458b('0x21');this[_0x458b('0x22')]=_0x11217b[_0x458b('0x22')]||0.03;this[_0x458b('0x23')]=_0x11217b[_0x458b('0x23')]||0x258;this[_0x458b('0x24')]=_0x11217b['dialOriginateCallerIdName']||'anonymous';this[_0x458b('0x25')]=_0x11217b[_0x458b('0x25')]||_0x458b('0x26');this['dialOriginateTimeout']=_0x11217b[_0x458b('0x27')]||0x1e;this['dialQueueOptions']=_0x11217b['dialQueueOptions']||_0x458b('0x28');this[_0x458b('0x29')]=_0x11217b[_0x458b('0x29')]||0x3;this[_0x458b('0x2a')]=_0x11217b[_0x458b('0x2a')]||undefined;this['dialCongestionMaxRetry']=_0x11217b['dialCongestionMaxRetry']||0x3;this[_0x458b('0x2b')]=_0x11217b[_0x458b('0x2b')]||0x96;this[_0x458b('0x2c')]=_0x11217b[_0x458b('0x2c')]||0x3;this[_0x458b('0x2d')]=_0x11217b[_0x458b('0x2d')]||0x96;this[_0x458b('0x2e')]=_0x11217b[_0x458b('0x2e')]||0x3;this[_0x458b('0x2f')]=_0x11217b['dialNoAnswerRetryFrequency']||0x96;this[_0x458b('0x30')]=_0x11217b[_0x458b('0x30')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x11217b[_0x458b('0x31')]||0x96;this[_0x458b('0x32')]=_0x11217b['dialDropMaxRetry']||0x3;this[_0x458b('0x33')]=_0x11217b[_0x458b('0x33')]||0x96;this['dialAbandonedMaxRetry']=_0x11217b[_0x458b('0x34')]||0x3;this[_0x458b('0x35')]=_0x11217b['dialAbandonedRetryFrequency']||0x96;this[_0x458b('0x36')]=_0x11217b[_0x458b('0x36')]||0x3;this[_0x458b('0x37')]=_0x11217b[_0x458b('0x37')]||0x96;this[_0x458b('0x38')]=_0x11217b[_0x458b('0x38')]||0x3;this[_0x458b('0x39')]=_0x11217b[_0x458b('0x39')]||0x96;this[_0x458b('0x3a')]=_0x11217b[_0x458b('0x3a')]||0x3;this[_0x458b('0x3b')]=_0x11217b[_0x458b('0x3b')]||0x4;this[_0x458b('0x3c')]=_0x11217b[_0x458b('0x3c')]?_0x11217b[_0x458b('0x3c')]:undefined;this[_0x458b('0x3d')]=_0x11217b[_0x458b('0x3d')]?_0x11217b[_0x458b('0x3d')]:undefined;this['dialPrefix']=_0x11217b[_0x458b('0x3e')]||undefined;this[_0x458b('0x3f')]=_0x11217b[_0x458b('0x3f')]?_0x11217b[_0x458b('0x3f')]:undefined;this[_0x458b('0x40')]=_0x11217b[_0x458b('0x40')]||_0x458b('0x41');this[_0x458b('0x42')]=_0x11217b[_0x458b('0x42')]||undefined;this[_0x458b('0x43')]=_0x11217b[_0x458b('0x43')]||undefined;this[_0x458b('0x44')]=strategy[_0x11217b[_0x458b('0x44')]]||_0x458b('0x8');this[_0x458b('0x45')]=!![];this[_0x458b('0x46')]=_0x11217b[_0x458b('0x46')]||![];this['dialAMDInitialSilence']=_0x11217b['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x11217b[_0x458b('0x47')];this[_0x458b('0x48')]=_0x11217b[_0x458b('0x48')];this[_0x458b('0x49')]=_0x11217b[_0x458b('0x49')];this[_0x458b('0x4a')]=_0x11217b[_0x458b('0x4a')];this[_0x458b('0x4b')]=_0x11217b[_0x458b('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x11217b['dialAMDMaximumNumberOfWords'];this[_0x458b('0x4c')]=_0x11217b[_0x458b('0x4c')];this[_0x458b('0x4d')]=_0x11217b[_0x458b('0x4d')];this[_0x458b('0x4e')]=0x0;this[_0x458b('0x4f')]=0x0;this[_0x458b('0x50')]=_0x11217b[_0x458b('0x50')];this[_0x458b('0x51')]=0x0;this[_0x458b('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x458b('0x53')]=0x0;this[_0x458b('0x54')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x458b('0x55')]=0x0;this[_0x458b('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x458b('0x57')]=0x0;this[_0x458b('0x58')]=0x0;this[_0x458b('0x59')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x458b('0x5a')]=undefined;this[_0x458b('0x5b')]=undefined;this[_0x458b('0x5c')]=undefined;this[_0x458b('0x5d')]=1.05;this[_0x458b('0x5e')]=0x0;this[_0x458b('0x5f')]=0x0;this[_0x458b('0x60')]=0x0;this[_0x458b('0x61')]=0x0;this[_0x458b('0x62')]=0x0;this[_0x458b('0x63')]=0x0;this[_0x458b('0x64')]=0x0;this[_0x458b('0x65')]=0x0;this[_0x458b('0x66')]=_0x11217b[_0x458b('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x11217b[_0x458b('0x67')]||0xa;this[_0x458b('0x68')]=0x0;this[_0x458b('0x69')]=0x0;this[_0x458b('0x6a')]=0x1;this[_0x458b('0x6b')]=0x0;this[_0x458b('0x6c')]=0x0;this[_0x458b('0x6d')]=0x0;this[_0x458b('0x6e')]=0x0;this[_0x458b('0x6f')]=_0x11217b[_0x458b('0x6f')]||0x1e;this['dialRecallInQueue']=_0x11217b[_0x458b('0x70')]||![];this[_0x458b('0x71')]=!!_0x11217b[_0x458b('0x71')]||![];this[_0x458b('0x72')]=!!_0x11217b['dialPreviewRecallmeReminder']||![];this[_0x458b('0x73')]=_0x11217b['dialQueueProject2']||undefined;this[_0x458b('0x74')]=_0x11217b[_0x458b('0x74')]||![];this[_0x458b('0x75')]=_0x11217b[_0x458b('0x75')]||![];this[_0x458b('0xb')]=monitorFormat[_0x11217b[_0x458b('0xb')]]?monitorFormat[_0x11217b[_0x458b('0xb')]]:undefined;this[_0x458b('0x76')]=_0x11217b['mandatoryDisposition']||![];this[_0x458b('0x77')]=_0x11217b[_0x458b('0x77')]?_0x11217b['mandatoryDispositionPause']:undefined;}module[_0x458b('0x78')]=VoiceQueue; \ No newline at end of file +var _0x7809=['unavailable','ringing','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumBillable','unmanaged','abandoned','available','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','not_inuse','inuse','invalid'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7809,0xe3));var _0x9780=function(_0x31e49f,_0x2dc244){_0x31e49f=_0x31e49f-0x0;var _0x596a3a=_0x7809[_0x31e49f];return _0x596a3a;};'use strict';var statusDesc=['unknown',_0x9780('0x0'),_0x9780('0x1'),'busy',_0x9780('0x2'),_0x9780('0x3'),_0x9780('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x9780('0x5')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x9780('0x6')};function VoiceQueue(_0xf27ae1){this['id']=_0xf27ae1['id']||0x0;this[_0x9780('0x7')]=_0xf27ae1[_0x9780('0x7')]||'';this[_0x9780('0x8')]=_0xf27ae1[_0x9780('0x8')]||'';this[_0x9780('0x9')]=_0xf27ae1[_0x9780('0x9')]||_0x9780('0xa');this[_0x9780('0xb')]=0x0;this[_0x9780('0xc')]=0x0;this['total']=0x0;this[_0x9780('0xd')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x9780('0xe')]=0x0;this[_0x9780('0xf')]=0x0;this[_0x9780('0x10')]=0x0;this['loggedIn']=0x0;this[_0x9780('0x11')]=0x0;this[_0x9780('0x12')]=_0xf27ae1['acw']||![];this['acwTimeout']=_0xf27ae1['acwTimeout']||0xa;this[_0x9780('0x13')]=_0xf27ae1[_0x9780('0x13')]||'no';this[_0x9780('0x14')]=!![];this[_0x9780('0x15')]='';this[_0x9780('0x16')]=0x0;this[_0x9780('0x17')]=0x0;this[_0x9780('0x18')]=_0xf27ae1['dialTimezone']||null;this['dialGlobalInterval']=_0xf27ae1[_0x9780('0x19')]?_0xf27ae1[_0x9780('0x19')]:null;this[_0x9780('0x1a')]=_0xf27ae1[_0x9780('0x1a')];this[_0x9780('0x1b')]=_0xf27ae1['dialMethod']||_0x9780('0x1c');this['dialLimitChannel']=_0xf27ae1[_0x9780('0x1d')]||0x0;this['dialLimitQueue']=_0xf27ae1[_0x9780('0x1e')]||0x0;this[_0x9780('0x1f')]=_0xf27ae1[_0x9780('0x1f')]||0x1;this[_0x9780('0x20')]=_0xf27ae1['dialPredictiveOptimization']||_0x9780('0x21');this[_0x9780('0x22')]=_0xf27ae1['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0xf27ae1[_0x9780('0x23')]||0x258;this[_0x9780('0x24')]=_0xf27ae1[_0x9780('0x24')]||_0x9780('0x25');this[_0x9780('0x26')]=_0xf27ae1[_0x9780('0x26')]||_0x9780('0x25');this[_0x9780('0x27')]=_0xf27ae1['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0xf27ae1['dialQueueOptions']||_0x9780('0x28');this[_0x9780('0x29')]=_0xf27ae1[_0x9780('0x29')]||0x3;this[_0x9780('0x2a')]=_0xf27ae1['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0xf27ae1[_0x9780('0x2b')]||0x3;this[_0x9780('0x2c')]=_0xf27ae1['dialCongestionRetryFrequency']||0x96;this[_0x9780('0x2d')]=_0xf27ae1[_0x9780('0x2d')]||0x3;this[_0x9780('0x2e')]=_0xf27ae1['dialBusyRetryFrequency']||0x96;this[_0x9780('0x2f')]=_0xf27ae1[_0x9780('0x2f')]||0x3;this[_0x9780('0x30')]=_0xf27ae1[_0x9780('0x30')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xf27ae1[_0x9780('0x31')]||0x3;this[_0x9780('0x32')]=_0xf27ae1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9780('0x33')]=_0xf27ae1[_0x9780('0x33')]||0x3;this[_0x9780('0x34')]=_0xf27ae1[_0x9780('0x34')]||0x96;this['dialAbandonedMaxRetry']=_0xf27ae1[_0x9780('0x35')]||0x3;this[_0x9780('0x36')]=_0xf27ae1['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0xf27ae1[_0x9780('0x37')]||0x3;this['dialMachineRetryFrequency']=_0xf27ae1[_0x9780('0x38')]||0x96;this[_0x9780('0x39')]=_0xf27ae1[_0x9780('0x39')]||0x3;this['dialAgentRejectRetryFrequency']=_0xf27ae1[_0x9780('0x3a')]||0x96;this[_0x9780('0x3b')]=_0xf27ae1[_0x9780('0x3b')]||0x3;this[_0x9780('0x3c')]=_0xf27ae1['dialGlobalMaxRetry']||0x4;this['Trunk']=_0xf27ae1['Trunk']?_0xf27ae1[_0x9780('0x3d')]:undefined;this[_0x9780('0x3e')]=_0xf27ae1['TrunkBackup']?_0xf27ae1[_0x9780('0x3e')]:undefined;this['dialPrefix']=_0xf27ae1[_0x9780('0x3f')]||undefined;this[_0x9780('0x40')]=_0xf27ae1['Interval']?_0xf27ae1['Interval']:undefined;this[_0x9780('0x41')]=_0xf27ae1[_0x9780('0x41')]||_0x9780('0x42');this[_0x9780('0x43')]=_0xf27ae1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9780('0x44')]=_0xf27ae1[_0x9780('0x44')]||undefined;this[_0x9780('0x45')]=strategy[_0xf27ae1[_0x9780('0x45')]]||'rrmemory';this[_0x9780('0x46')]=!![];this[_0x9780('0x47')]=_0xf27ae1[_0x9780('0x47')]||![];this[_0x9780('0x48')]=_0xf27ae1[_0x9780('0x48')];this[_0x9780('0x49')]=_0xf27ae1['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0xf27ae1['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0xf27ae1[_0x9780('0x4a')];this[_0x9780('0x4b')]=_0xf27ae1[_0x9780('0x4b')];this[_0x9780('0x4c')]=_0xf27ae1['dialAMDBetweenWordsSilence'];this[_0x9780('0x4d')]=_0xf27ae1[_0x9780('0x4d')];this['dialAMDSilenceThreshold']=_0xf27ae1['dialAMDSilenceThreshold'];this[_0x9780('0x4e')]=_0xf27ae1['dialAMDMaximumWordLength'];this[_0x9780('0x4f')]=0x0;this[_0x9780('0x50')]=0x0;this[_0x9780('0x51')]=_0xf27ae1[_0x9780('0x51')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x9780('0x52')]=0x0;this[_0x9780('0x53')]=0x0;this[_0x9780('0x54')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x9780('0x55')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x9780('0x56')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x9780('0x57')]=0x0;this[_0x9780('0x58')]=0x0;this[_0x9780('0x59')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x9780('0x5a')]=undefined;this[_0x9780('0x5b')]=undefined;this[_0x9780('0x5c')]=undefined;this[_0x9780('0x5d')]=1.05;this[_0x9780('0x5e')]=0x0;this[_0x9780('0x5f')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x9780('0x60')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x9780('0x61')]=0x0;this[_0x9780('0x62')]=0x0;this[_0x9780('0x63')]=_0xf27ae1[_0x9780('0x64')]||0x14;this[_0x9780('0x65')]=_0xf27ae1['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x9780('0x66')]=0x0;this[_0x9780('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x9780('0x68')]=0x0;this[_0x9780('0x69')]=0x0;this[_0x9780('0x6a')]=0x0;this['dialRecallMeTimeout']=_0xf27ae1[_0x9780('0x6b')]||0x1e;this[_0x9780('0x6c')]=_0xf27ae1[_0x9780('0x6c')]||![];this[_0x9780('0x6d')]=!!_0xf27ae1[_0x9780('0x6d')]||![];this[_0x9780('0x6e')]=!!_0xf27ae1[_0x9780('0x6e')]||![];this[_0x9780('0x6f')]=_0xf27ae1[_0x9780('0x6f')]||undefined;this[_0x9780('0x70')]=_0xf27ae1['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0xf27ae1['dialAgiAfterHangupAgent']||![];this[_0x9780('0x8')]=monitorFormat[_0xf27ae1[_0x9780('0x8')]]?monitorFormat[_0xf27ae1[_0x9780('0x8')]]:undefined;this['mandatoryDisposition']=_0xf27ae1[_0x9780('0x71')]||![];this[_0x9780('0x72')]=_0xf27ae1[_0x9780('0x72')]?_0xf27ae1[_0x9780('0x72')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 12ed39c..744b95d 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 _0x95e5=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x504110,_0x9b9034){var _0x27e808=function(_0x2dd7d8){while(--_0x2dd7d8){_0x504110['push'](_0x504110['shift']());}};_0x27e808(++_0x9b9034);}(_0x95e5,0x1c6));var _0x595e=function(_0xf45564,_0x5570b1){_0xf45564=_0xf45564-0x0;var _0x3de022=_0x95e5[_0xf45564];return _0x3de022;};'use strict';function VtigerAccount(_0x348337){this['id']=_0x348337['id']||0x0;this[_0x595e('0x0')]=_0x348337[_0x595e('0x0')]||'';this[_0x595e('0x1')]=_0x348337[_0x595e('0x1')]||'';this[_0x595e('0x2')]=_0x348337[_0x595e('0x2')]||'';this[_0x595e('0x3')]=_0x348337[_0x595e('0x3')]||'';this[_0x595e('0x4')]=_0x348337[_0x595e('0x4')]||'';this[_0x595e('0x5')]=_0x348337[_0x595e('0x5')]||{};}module[_0x595e('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb4bb=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x435b35,_0x34a430){var _0x35ed54=function(_0x3508df){while(--_0x3508df){_0x435b35['push'](_0x435b35['shift']());}};_0x35ed54(++_0x34a430);}(_0xb4bb,0x1c3));var _0xbb4b=function(_0x408362,_0x3cf046){_0x408362=_0x408362-0x0;var _0x3ef963=_0xb4bb[_0x408362];return _0x3ef963;};'use strict';function VtigerAccount(_0xcc5e91){this['id']=_0xcc5e91['id']||0x0;this[_0xbb4b('0x0')]=_0xcc5e91[_0xbb4b('0x0')]||'';this[_0xbb4b('0x1')]=_0xcc5e91['username']||'';this[_0xbb4b('0x2')]=_0xcc5e91[_0xbb4b('0x2')]||'';this[_0xbb4b('0x3')]=_0xcc5e91[_0xbb4b('0x3')]||'';this[_0xbb4b('0x4')]=_0xcc5e91[_0xbb4b('0x4')]||'';this[_0xbb4b('0x5')]=_0xcc5e91[_0xbb4b('0x5')]||{};}module[_0xbb4b('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 7e66765..d5b7257 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 _0x2a0b=['Configurations','exports','name','username','password','token','authType','type','integrationTab','serverUrl'];(function(_0x521b8a,_0xac9f6b){var _0x5d1ebf=function(_0x149cc3){while(--_0x149cc3){_0x521b8a['push'](_0x521b8a['shift']());}};_0x5d1ebf(++_0xac9f6b);}(_0x2a0b,0xb6));var _0xb2a0=function(_0x5a47eb,_0x552795){_0x5a47eb=_0x5a47eb-0x0;var _0x22994b=_0x2a0b[_0x5a47eb];return _0x22994b;};'use strict';function ZendeskAccount(_0x5c5f97){this['id']=_0x5c5f97['id']||0x0;this[_0xb2a0('0x0')]=_0x5c5f97[_0xb2a0('0x0')]||'';this[_0xb2a0('0x1')]=_0x5c5f97[_0xb2a0('0x1')]||'';this['password']=_0x5c5f97[_0xb2a0('0x2')]||'';this[_0xb2a0('0x3')]=_0x5c5f97[_0xb2a0('0x3')]||'';this['remoteUri']=_0x5c5f97['remoteUri']||'';this[_0xb2a0('0x4')]=_0x5c5f97[_0xb2a0('0x4')]||'';this[_0xb2a0('0x5')]=_0x5c5f97[_0xb2a0('0x5')]||_0xb2a0('0x6');this[_0xb2a0('0x7')]=_0x5c5f97[_0xb2a0('0x7')]||'';this[_0xb2a0('0x8')]=_0x5c5f97[_0xb2a0('0x8')]||{};}module[_0xb2a0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5877=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x26d467,_0x864bb1){var _0x5b86dd=function(_0x393f83){while(--_0x393f83){_0x26d467['push'](_0x26d467['shift']());}};_0x5b86dd(++_0x864bb1);}(_0x5877,0x172));var _0x7587=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5877[_0x2dafbe];return _0x58a45a;};'use strict';function ZendeskAccount(_0x4ce92c){this['id']=_0x4ce92c['id']||0x0;this[_0x7587('0x0')]=_0x4ce92c[_0x7587('0x0')]||'';this[_0x7587('0x1')]=_0x4ce92c[_0x7587('0x1')]||'';this[_0x7587('0x2')]=_0x4ce92c[_0x7587('0x2')]||'';this[_0x7587('0x3')]=_0x4ce92c[_0x7587('0x3')]||'';this['remoteUri']=_0x4ce92c[_0x7587('0x4')]||'';this[_0x7587('0x5')]=_0x4ce92c[_0x7587('0x5')]||'';this[_0x7587('0x6')]=_0x4ce92c[_0x7587('0x6')]||_0x7587('0x7');this[_0x7587('0x8')]=_0x4ce92c['serverUrl']||'';this[_0x7587('0x9')]=_0x4ce92c[_0x7587('0x9')]||{};}module[_0x7587('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 41d4b7e..49ef1de 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 _0xe9b3=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name'];(function(_0x341309,_0x227f8d){var _0x5b3dba=function(_0x1a436c){while(--_0x1a436c){_0x341309['push'](_0x341309['shift']());}};_0x5b3dba(++_0x227f8d);}(_0xe9b3,0xd1));var _0x3e9b=function(_0x398dc5,_0x4b9fe8){_0x398dc5=_0x398dc5-0x0;var _0x1000a2=_0xe9b3[_0x398dc5];return _0x1000a2;};'use strict';function ZohoAccount(_0x51cd61){this['id']=_0x51cd61['id']||0x0;this[_0x3e9b('0x0')]=_0x51cd61[_0x3e9b('0x0')]||'';this[_0x3e9b('0x1')]=_0x51cd61[_0x3e9b('0x1')]||'';this[_0x3e9b('0x2')]=_0x51cd61['host']||'';this[_0x3e9b('0x3')]=_0x51cd61[_0x3e9b('0x3')]||'';this[_0x3e9b('0x4')]=_0x51cd61['clientId']||'';this[_0x3e9b('0x5')]=_0x51cd61[_0x3e9b('0x5')]||'';this['serverUrl']=_0x51cd61[_0x3e9b('0x6')]||'';this[_0x3e9b('0x7')]=_0x51cd61[_0x3e9b('0x7')]||'';this['refreshToken']=_0x51cd61[_0x3e9b('0x8')]||'';this['Configurations']=_0x51cd61['Configurations']||{};}module[_0x3e9b('0x9')]=ZohoAccount; \ No newline at end of file +var _0xd7a0=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x311cd7,_0x596503){var _0x33a071=function(_0x23ea7d){while(--_0x23ea7d){_0x311cd7['push'](_0x311cd7['shift']());}};_0x33a071(++_0x596503);}(_0xd7a0,0x7b));var _0x0d7a=function(_0x3bd53e,_0x456399){_0x3bd53e=_0x3bd53e-0x0;var _0x42797c=_0xd7a0[_0x3bd53e];return _0x42797c;};'use strict';function ZohoAccount(_0x1dd0f9){this['id']=_0x1dd0f9['id']||0x0;this[_0x0d7a('0x0')]=_0x1dd0f9[_0x0d7a('0x0')]||'';this[_0x0d7a('0x1')]=_0x1dd0f9[_0x0d7a('0x1')]||'';this[_0x0d7a('0x2')]=_0x1dd0f9[_0x0d7a('0x2')]||'';this[_0x0d7a('0x3')]=_0x1dd0f9[_0x0d7a('0x3')]||'';this['clientId']=_0x1dd0f9[_0x0d7a('0x4')]||'';this['clientSecret']=_0x1dd0f9[_0x0d7a('0x5')]||'';this[_0x0d7a('0x6')]=_0x1dd0f9[_0x0d7a('0x6')]||'';this[_0x0d7a('0x7')]=_0x1dd0f9['code']||'';this[_0x0d7a('0x8')]=_0x1dd0f9[_0x0d7a('0x8')]||'';this[_0x0d7a('0x9')]=_0x1dd0f9[_0x0d7a('0x9')]||{};}module[_0x0d7a('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 a6e6dd0..c2128c4 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 _0x0abf=['callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','Agent','channelAgent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback'];(function(_0x1d6dd0,_0x3b1626){var _0x5c5d15=function(_0x4d7dc1){while(--_0x4d7dc1){_0x1d6dd0['push'](_0x1d6dd0['shift']());}};_0x5c5d15(++_0x3b1626);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0abf[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0xf0ab('0x0'));var _=require('lodash');var moment=require(_0xf0ab('0x1'));function checkNameSurname(_0x27c8c9,_0x528ef7,_0x598001){var _0x313b14='';if(!_['isNil'](_0x528ef7)&&_0xf0ab('0x2')===typeof _0x528ef7){_0x313b14+=_0x528ef7;}if(!_[_0xf0ab('0x3')](_0x598001)&&_0xf0ab('0x2')===typeof _0x598001){_0x313b14+='\x20'+_0x598001;}if(_0x313b14!==''){return _0x313b14;}return _0x27c8c9;}function Action(_0xbb1f91,_0x2ab7d6,_0x4d2ea8,_0x233afe,_0x57ff3b){this[_0xf0ab('0x4')]=_0x4d2ea8||undefined;this[_0xf0ab('0x5')]=_0xbb1f91['id'];this[_0xf0ab('0x6')]=_0x2ab7d6[_0xf0ab('0x7')];this['type']=_0x2ab7d6[_0xf0ab('0x8')];this[_0xf0ab('0x9')]=_0xf0ab('0x6');this['dialAnswer']=![];this['membername']=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?undefined:_0xbb1f91[_0xf0ab('0xa')][_0xf0ab('0x7')];this[_0xf0ab('0xb')]=this[_0xf0ab('0xc')]?util[_0xf0ab('0xd')](_0xf0ab('0xe'),this[_0xf0ab('0xc')]):_0x233afe||undefined;this['calleridname']=checkNameSurname(_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x10')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x11')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x12')]);this[_0xf0ab('0x13')]=_0xbb1f91[_0xf0ab('0x13')]||![];this[_0xf0ab('0x14')]=_0xbb1f91[_0xf0ab('0x10')];this[_0xf0ab('0x15')]=_0xbb1f91[_0xf0ab('0x15')];this[_0xf0ab('0x16')]=_0xbb1f91[_0xf0ab('0x16')]||0x0;this[_0xf0ab('0x17')]=_0xbb1f91['countcongestionretry']||0x0;this[_0xf0ab('0x18')]=_0xbb1f91[_0xf0ab('0x18')]||0x0;this[_0xf0ab('0x19')]=(_0xbb1f91[_0xf0ab('0x16')]||0x0)+(_0xbb1f91[_0xf0ab('0x17')]||0x0)+(_0xbb1f91[_0xf0ab('0x18')]||0x0)+(_0xbb1f91[_0xf0ab('0x1a')]||0x0)+(_0xbb1f91[_0xf0ab('0x1b')]||0x0)+(_0xbb1f91[_0xf0ab('0x1c')]||0x0)+(_0xbb1f91[_0xf0ab('0x1d')]||0x0)+(_0xbb1f91[_0xf0ab('0x1e')]||0x0);this[_0xf0ab('0x1a')]=_0xbb1f91[_0xf0ab('0x1a')]||0x0;this[_0xf0ab('0x1b')]=_0xbb1f91[_0xf0ab('0x1b')]||0x0;this[_0xf0ab('0x1c')]=_0xbb1f91['countabandonedretry']||0x0;this[_0xf0ab('0x1d')]=_0xbb1f91[_0xf0ab('0x1d')]||0x0;this[_0xf0ab('0x1e')]=_0xbb1f91[_0xf0ab('0x1e')]||0x0;this[_0xf0ab('0x1f')]=_0xbb1f91[_0xf0ab('0x1f')];this[_0xf0ab('0x20')]=_0xbb1f91[_0xf0ab('0x20')];this[_0xf0ab('0x21')]=_0xbb1f91[_0xf0ab('0x21')];this[_0xf0ab('0x22')]=_0xbb1f91['recallme'];this['ContactId']=_0xbb1f91['ContactId'];this[_0xf0ab('0x23')]=_0xbb1f91['ListId'];this[_0xf0ab('0x24')]=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?_0xbb1f91[_0xf0ab('0x24')]:_0xbb1f91[_0xf0ab('0xa')]['id'];this[_0xf0ab('0x25')]=_0xbb1f91[_0xf0ab('0x25')];this[_0xf0ab('0x26')]='';this['originatecalleridname']='';}Action[_0xf0ab('0x27')]['getCaller']=function(){return util['format'](_0xf0ab('0x28'),this[_0xf0ab('0x29')],this[_0xf0ab('0x2a')]);};module[_0xf0ab('0x2b')]=Action; \ No newline at end of file +var _0xaebd=['scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','string','isNil','queue','name','type','campaigntype','dialAnswer','Agent','format','membername','calleridname','Contact','phone','firstName','active','calleridnum'];(function(_0x2290cb,_0x392316){var _0x85e816=function(_0x4de2bd){while(--_0x4de2bd){_0x2290cb['push'](_0x2290cb['shift']());}};_0x85e816(++_0x392316);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x24bb54,_0xe357ac){_0x24bb54=_0x24bb54-0x0;var _0xbb436a=_0xaebd[_0x24bb54];return _0xbb436a;};'use strict';var util=require(_0xdaeb('0x0'));var _=require('lodash');var moment=require(_0xdaeb('0x1'));function checkNameSurname(_0xac84fd,_0x1312be,_0x18af69){var _0x198c72='';if(!_['isNil'](_0x1312be)&&_0xdaeb('0x2')===typeof _0x1312be){_0x198c72+=_0x1312be;}if(!_[_0xdaeb('0x3')](_0x18af69)&&_0xdaeb('0x2')===typeof _0x18af69){_0x198c72+='\x20'+_0x18af69;}if(_0x198c72!==''){return _0x198c72;}return _0xac84fd;}function Action(_0x1141fe,_0xee94f9,_0x4b7255,_0x3ea090,_0x3f7ba1){this['uniqueid']=_0x4b7255||undefined;this['idContact']=_0x1141fe['id'];this[_0xdaeb('0x4')]=_0xee94f9[_0xdaeb('0x5')];this[_0xdaeb('0x6')]=_0xee94f9['type'];this[_0xdaeb('0x7')]='queue';this[_0xdaeb('0x8')]=![];this['membername']=_[_0xdaeb('0x3')](_0x1141fe['Agent'])?undefined:_0x1141fe[_0xdaeb('0x9')][_0xdaeb('0x5')];this['channelAgent']=this['membername']?util[_0xdaeb('0xa')]('SIP/%s',this[_0xdaeb('0xb')]):_0x3ea090||undefined;this[_0xdaeb('0xc')]=checkNameSurname(_0x1141fe[_0xdaeb('0xd')][_0xdaeb('0xe')],_0x1141fe[_0xdaeb('0xd')][_0xdaeb('0xf')],_0x1141fe[_0xdaeb('0xd')]['lastName']);this['active']=_0x1141fe[_0xdaeb('0x10')]||![];this[_0xdaeb('0x11')]=_0x1141fe[_0xdaeb('0xe')];this[_0xdaeb('0x12')]=_0x1141fe['scheduledat'];this['countbusyretry']=_0x1141fe[_0xdaeb('0x13')]||0x0;this['countcongestionretry']=_0x1141fe['countcongestionretry']||0x0;this[_0xdaeb('0x14')]=_0x1141fe[_0xdaeb('0x14')]||0x0;this[_0xdaeb('0x15')]=(_0x1141fe[_0xdaeb('0x13')]||0x0)+(_0x1141fe[_0xdaeb('0x16')]||0x0)+(_0x1141fe[_0xdaeb('0x14')]||0x0)+(_0x1141fe['countnosuchnumberretry']||0x0)+(_0x1141fe[_0xdaeb('0x17')]||0x0)+(_0x1141fe['countabandonedretry']||0x0)+(_0x1141fe[_0xdaeb('0x18')]||0x0)+(_0x1141fe[_0xdaeb('0x19')]||0x0);this[_0xdaeb('0x1a')]=_0x1141fe['countnosuchnumberretry']||0x0;this['countdropretry']=_0x1141fe[_0xdaeb('0x17')]||0x0;this[_0xdaeb('0x1b')]=_0x1141fe[_0xdaeb('0x1b')]||0x0;this[_0xdaeb('0x18')]=_0x1141fe[_0xdaeb('0x18')]||0x0;this['countagentrejectretry']=_0x1141fe['countagentrejectretry']||0x0;this[_0xdaeb('0x1c')]=_0x1141fe[_0xdaeb('0x1c')];this[_0xdaeb('0x1d')]=_0x1141fe[_0xdaeb('0x1d')];this[_0xdaeb('0x1e')]=_0x1141fe['callbackat'];this[_0xdaeb('0x1f')]=_0x1141fe['recallme'];this[_0xdaeb('0x20')]=_0x1141fe[_0xdaeb('0x20')];this[_0xdaeb('0x21')]=_0x1141fe[_0xdaeb('0x21')];this[_0xdaeb('0x22')]=_['isNil'](_0x1141fe[_0xdaeb('0x9')])?_0x1141fe[_0xdaeb('0x22')]:_0x1141fe[_0xdaeb('0x9')]['id'];this['VoiceQueueId']=_0x1141fe['VoiceQueueId'];this[_0xdaeb('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0xdaeb('0x24')]=function(){return util[_0xdaeb('0xa')](_0xdaeb('0x25'),this['calleridname'],this['number']);};module[_0xdaeb('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b949976..ca8f838 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 _0x90ec=['countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkInBlack','Contact','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','isTrunkReachable','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','trunks','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','preview','booked','clockClearZombieChannels','clearZombieChannels','hasOwnProperty','dialMethod','setMessage','dialPreviewAutoRecallMe','recallMe','sequence','isNil','Queue','queue','originated:\x20','actions','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','agentReadyId','then','length','getDiff','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','activeContact','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','idContact','CANCEL','AgentReject','custom:agentreject','agentreject','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay'];(function(_0x5a0ab9,_0x33c633){var _0x14854a=function(_0x1113c6){while(--_0x1113c6){_0x5a0ab9['push'](_0x5a0ab9['shift']());}};_0x14854a(++_0x33c633);}(_0x90ec,0x1d4));var _0xc90e=function(_0x8fa4bc,_0x5cd2af){_0x8fa4bc=_0x8fa4bc-0x0;var _0x35b6a7=_0x90ec[_0x8fa4bc];return _0x35b6a7;};'use strict';var util=require(_0xc90e('0x0'));var _=require(_0xc90e('0x1'));var uuid=require('uuid');var moment=require(_0xc90e('0x2'));var md5=require(_0xc90e('0x3'));var Redis=require(_0xc90e('0x4'));var config=require(_0xc90e('0x5'));var logger=require(_0xc90e('0x6'))('preview');var loggerAction=require(_0xc90e('0x6'))(_0xc90e('0x7'));var ami=require(_0xc90e('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xc90e('0x9'));var Action=require('./action');var ut=require(_0xc90e('0xa'));config[_0xc90e('0xb')]=_['defaults'](config[_0xc90e('0xb')],{'host':_0xc90e('0xc'),'port':0x18eb});var io=require(_0xc90e('0xd'))(new Redis(config[_0xc90e('0xb')]));var Sequence=function(){};Sequence[_0xc90e('0xe')][_0xc90e('0xf')]=function(_0x386e63){this[_0xc90e('0x10')]=this[_0xc90e('0x10')]?this['tail'][_0xc90e('0x11')](_0x386e63):_0x386e63();};function Preview(_0x5e14b7){this['sequence']=new Sequence();this['campaignsPreview']=_0x5e14b7['voiceQueues'];this[_0xc90e('0x12')]=_0x5e14b7[_0xc90e('0x12')];this['actions']={};this[_0xc90e('0x13')]=_0x5e14b7[_0xc90e('0x13')];this['clockClearZombieChannels']=0x0;ami['on'](_0xc90e('0x14'),this[_0xc90e('0x15')][_0xc90e('0x16')](this));ami['on'](_0xc90e('0x17'),this[_0xc90e('0x18')][_0xc90e('0x16')](this));ami['on']('hanguprequest',this[_0xc90e('0x19')][_0xc90e('0x16')](this));ami['on']('dialend',this[_0xc90e('0x1a')]['bind'](this));ami['on'](_0xc90e('0x1b'),this[_0xc90e('0x1c')]['bind'](this));ami['on'](_0xc90e('0x1d'),this[_0xc90e('0x1e')][_0xc90e('0x16')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xc90e('0x1f'),this[_0xc90e('0x20')][_0xc90e('0x16')](this));this[_0xc90e('0x21')](this[_0xc90e('0x22')]);}function emit(_0x50d0a2,_0x469f0d,_0x556954){io['to'](_0x50d0a2)[_0xc90e('0x23')](_0x469f0d,_0x556954);}function emitCampaignPreview(_0x3cf47c){if(_0x3cf47c['type']===_0xc90e('0x24')){var _0x134760={'id':_0x3cf47c['id'],'name':_0x3cf47c[_0xc90e('0x25')],'strategy':_0x3cf47c[_0xc90e('0x26')],'answered':_0x3cf47c[_0xc90e('0x27')],'available':_0x3cf47c[_0xc90e('0x28')],'loggedIn':_0x3cf47c[_0xc90e('0x29')],'pTalking':_0x3cf47c[_0xc90e('0x2a')],'sumBillable':_0x3cf47c[_0xc90e('0x2b')],'sumDuration':_0x3cf47c['sumDuration'],'sumHoldTime':_0x3cf47c[_0xc90e('0x2c')]||0x0,'talking':_0x3cf47c[_0xc90e('0x2d')],'total':_0x3cf47c[_0xc90e('0x2e')],'type':_0x3cf47c[_0xc90e('0x2f')],'unmanaged':_0x3cf47c[_0xc90e('0x30')],'abandoned':_0x3cf47c['abandoned'],'waiting':_0x3cf47c[_0xc90e('0x31')],'loggedInDb':_0x3cf47c[_0xc90e('0x32')],'dialActive':_0x3cf47c[_0xc90e('0x33')],'dialMethod':_0x3cf47c['dialMethod'],'dialOriginateCallerIdName':_0x3cf47c[_0xc90e('0x34')],'dialOriginateCallerIdNumber':_0x3cf47c[_0xc90e('0x35')],'dialOriginateTimeout':_0x3cf47c[_0xc90e('0x36')],'dialPrefix':_0x3cf47c[_0xc90e('0x37')],'outboundAnswerAgiCallsDay':_0x3cf47c[_0xc90e('0x38')],'outboundAnswerCallsDay':_0x3cf47c[_0xc90e('0x39')],'outboundBlacklistCallsDay':_0x3cf47c['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3cf47c['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3cf47c[_0xc90e('0x3a')],'outboundDropCallsDayACS':_0x3cf47c['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3cf47c[_0xc90e('0x3b')],'outboundDropCallsDayTimeout':_0x3cf47c[_0xc90e('0x3c')],'outboundNoAnswerCallsDay':_0x3cf47c[_0xc90e('0x3d')],'outboundNoSuchCallsDay':_0x3cf47c[_0xc90e('0x3e')],'outboundOriginateFailureCallsDay':_0x3cf47c[_0xc90e('0x3f')],'outboundReCallsDay':_0x3cf47c[_0xc90e('0x40')],'outboundRejectCallsDay':_0x3cf47c[_0xc90e('0x41')],'outboundUnknownCallsDay':_0x3cf47c['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x3cf47c[_0xc90e('0x42')],'predictiveIntervalAnsweredCalls':_0x3cf47c[_0xc90e('0x43')],'predictiveIntervalAvgHoldtime':_0x3cf47c['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3cf47c[_0xc90e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x3cf47c['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3cf47c[_0xc90e('0x45')],'predictiveIntervalErlangCalls':_0x3cf47c[_0xc90e('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x3cf47c[_0xc90e('0x47')],'predictiveIntervalHitRate':_0x3cf47c[_0xc90e('0x48')],'predictiveIntervalMultiplicativeFactor':_0x3cf47c[_0xc90e('0x49')],'predictiveIntervalPauses':_0x3cf47c[_0xc90e('0x4a')],'predictiveIntervalAvailable':_0x3cf47c[_0xc90e('0x4b')],'predictiveIntervalTotalCalls':_0x3cf47c[_0xc90e('0x4c')],'message':_0x3cf47c[_0xc90e('0x4d')],'originated':_0x3cf47c['originated'],'erlangCalls':_0x3cf47c['erlangCalls'],'erlangCallToSecond':_0x3cf47c[_0xc90e('0x4e')],'erlangAbandonmentRate':_0x3cf47c[_0xc90e('0x4f')],'erlangBusyFactor':_0x3cf47c[_0xc90e('0x50')],'startPredictive':_0x3cf47c[_0xc90e('0x51')],'startProgressive':_0x3cf47c[_0xc90e('0x52')]};if(_0x3cf47c[_0xc90e('0x53')]){_0x134760[_0xc90e('0x53')]={'id':_0x3cf47c[_0xc90e('0x53')]['id'],'name':_0x3cf47c[_0xc90e('0x53')][_0xc90e('0x25')],'active':_0x3cf47c['Trunk'][_0xc90e('0x54')],'callerid':_0x3cf47c[_0xc90e('0x53')][_0xc90e('0x55')]};}if(_0x3cf47c[_0xc90e('0x56')]){_0x134760['Interval']={'id':_0x3cf47c['Interval']['id'],'name':_0x3cf47c['Interval'][_0xc90e('0x25')]};}var _0x11d990=md5(JSON[_0xc90e('0x57')](_0x134760));if(_0x3cf47c[_0xc90e('0x3')]!==_0x11d990){_0x3cf47c[_0xc90e('0x3')]=_0x11d990;emit(util['format'](_0xc90e('0x58'),_0x134760[_0xc90e('0x25')]),_0xc90e('0x59'),_0x134760);}}}function emitVoiceQueueChannelRemove(_0x29649a){logger[_0xc90e('0x5a')](_0xc90e('0x5b'),JSON[_0xc90e('0x57')](_0x29649a));emit(util[_0xc90e('0x5c')](_0xc90e('0x58'),_0x29649a[_0xc90e('0x25')]),_0xc90e('0x5d'),_0x29649a);io[_0xc90e('0x23')](_0xc90e('0x5e'),_0x29649a);}function notSendMessagesQueue(_0x5421b6){if(_0x5421b6[_0xc90e('0x5f')]){if(_0x5421b6[_0xc90e('0x60')]===0x0&&_0x5421b6['pTalking']===0x0){_0x5421b6['sendMessageOneNotActive']=![];_0x5421b6[_0xc90e('0x28')]=0x0;_0x5421b6['paused']=0x0;_0x5421b6[_0xc90e('0x4d')]=_0xc90e('0x61');ut['logger'](_0xc90e('0x62'),_0x5421b6['name']+'\x20is\x20not\x20active');}else{_0x5421b6[_0xc90e('0x4d')]='DEACTIVATED';ut['logger'](_0xc90e('0x62'),_0x5421b6[_0xc90e('0x25')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x5421b6);}}Preview[_0xc90e('0xe')][_0xc90e('0x21')]=function(){var _0x238a47=this;setInterval(function(){_0x238a47[_0xc90e('0x63')]();},0x7cf);};Preview[_0xc90e('0xe')][_0xc90e('0x63')]=function(){var _0x3f194a=this[_0xc90e('0x22')];this['clockClearZombieChannels']+=0x1;for(var _0xd8113c in _0x3f194a){if(_0x3f194a['hasOwnProperty'](_0xd8113c)&&(_0x3f194a[_0xd8113c]['dialMethod']===_0xc90e('0x64')||_0x3f194a[_0xd8113c]['dialMethod']===_0xc90e('0x65'))&&_0x3f194a[_0xd8113c]['type']===_0xc90e('0x24')){if(this[_0xc90e('0x66')]>0x7){this[_0xc90e('0x66')]=0x0;this[_0xc90e('0x67')]();}}if(_0x3f194a[_0xc90e('0x68')](_0xd8113c)&&_0x3f194a[_0xd8113c][_0xc90e('0x69')]===_0xc90e('0x64')&&_0x3f194a[_0xd8113c][_0xc90e('0x2f')]===_0xc90e('0x24')){if(_0x3f194a[_0xd8113c]['dialActive']){this[_0xc90e('0x6a')](_0x3f194a[_0xd8113c]);if(_0x3f194a[_0xd8113c][_0xc90e('0x6b')])this[_0xc90e('0x6c')](_0x3f194a[_0xd8113c]);}else{notSendMessagesQueue(_0x3f194a[_0xd8113c]);}}}};Preview[_0xc90e('0xe')]['clearZombieChannel']=function(_0x21408a){var _0x29f936=this;this[_0xc90e('0x6d')]['enqueue'](function(){if(!_[_0xc90e('0x6e')](_0x29f936['actions'][_0x21408a])){loggerAction[_0xc90e('0x5a')]('[clearZombieChannels][talking]',_0x21408a,_0xc90e('0x6f'),_0x29f936['actions'][_0x21408a][_0xc90e('0x70')],_0xc90e('0x71'),JSON[_0xc90e('0x57')](_0x29f936[_0xc90e('0x22')][_0x29f936[_0xc90e('0x72')][_0x21408a][_0xc90e('0x70')]][_0xc90e('0x60')]),_0xc90e('0x73'),JSON['stringify'](_0x29f936[_0xc90e('0x22')][_0x29f936[_0xc90e('0x72')][_0x21408a]['queue']]['pTalking']),JSON[_0xc90e('0x57')](_0x29f936['actions'][_0x21408a][_0xc90e('0x74')]),JSON[_0xc90e('0x57')](_[_0xc90e('0x75')](_0x29f936[_0xc90e('0x72')][_0x21408a],[_0xc90e('0x76'),'UserId',_0xc90e('0x77'),_0xc90e('0x78')])));return ami['Action']({'action':_0xc90e('0x79'),'channel':_0x29f936['actions'][_0x21408a][_0xc90e('0x7a')]})['catch'](function(_0xa63f87){if(_0xa63f87[_0xc90e('0x4d')]===_0xc90e('0x7b')){setTimeout(function(){if(_0x29f936[_0xc90e('0x72')][_0x21408a]){ut[_0xc90e('0x7c')](_0x29f936[_0xc90e('0x22')][_0x29f936[_0xc90e('0x72')][_0x21408a][_0xc90e('0x70')]],_0xc90e('0x7d'));if(_0x29f936[_0xc90e('0x72')][_0x21408a][_0xc90e('0x74')]===!![]){ut[_0xc90e('0x7e')](_0x29f936[_0xc90e('0x22')][_0x29f936[_0xc90e('0x72')][_0x21408a][_0xc90e('0x70')]],_0xc90e('0x7d'));ut['loggerError'](_0xc90e('0x7f')+_0x21408a,_0x29f936[_0xc90e('0x72')][_0x21408a][_0xc90e('0x70')]);}ut[_0xc90e('0x80')](_0xc90e('0x81')+_0x21408a,_0x29f936[_0xc90e('0x72')][_0x21408a][_0xc90e('0x70')]);delete _0x29f936['actions'][_0x21408a];}},0x2328);}});}});};Preview[_0xc90e('0xe')]['clearZombieChannels']=function(){var _0x2ce45e=this;loggerAction[_0xc90e('0x5a')](_0xc90e('0x82'),_[_0xc90e('0x83')](this[_0xc90e('0x72')]));for(var _0x5b67d9 in this[_0xc90e('0x72')]){if(_0x2ce45e[_0xc90e('0x72')]['hasOwnProperty'](_0x5b67d9)){_0x2ce45e[_0xc90e('0x84')](_0x5b67d9);}}};Preview[_0xc90e('0xe')][_0xc90e('0x6c')]=function(_0xaebbb3){var _0x591ac7=this;rpcDb['getContactRecallMe'](_0xaebbb3['id'],ut[_0xc90e('0x85')](this[_0xc90e('0x13')]))[_0xc90e('0x86')](function(_0x33865d){if(!_[_0xc90e('0x6e')](_0x33865d)){for(var _0x4c44ea=0x0;_0x4c44ea<_0x33865d[_0xc90e('0x87')];_0x4c44ea+=0x1){if(ut[_0xc90e('0x88')](_0x33865d[_0x4c44ea]['scheduledat'])<_0xaebbb3['dialRecallMeTimeout']*0x3c){if(_0x33865d[_0x4c44ea][_0xc90e('0x89')]&&!_0x33865d[_0x4c44ea][_0xc90e('0x89')][_0xc90e('0x8a')]){_0x591ac7[_0xc90e('0x8b')](_0x33865d[_0x4c44ea]['id'])['then'](ut[_0xc90e('0x8c')](_0xc90e('0x8d')))[_0xc90e('0x8e')](ut[_0xc90e('0x8c')](_0xc90e('0x8d')));}else{rpcDb[_0xc90e('0x8f')](_0x33865d[_0x4c44ea]['id']);}}else{var _0x171938=new Action(_0x33865d[_0x4c44ea],_0xaebbb3);_0x171938[_0xc90e('0x90')]=moment()['format'](_0xc90e('0x91'));_0xaebbb3[_0xc90e('0x40')]+=0x1;ut[_0xc90e('0x92')](_0x171938,0x17,_0xc90e('0x93'));if(_0xaebbb3[_0xc90e('0x94')]){rpcDb['rescheduleContactInQueue'](ut[_0xc90e('0x95')](_0x33865d[_0x4c44ea]));rpcDb[_0xc90e('0x96')](_0x171938,_0xc90e('0x97'));}else{ut['logCustomer'](_0x171938,0x16,'RecallFailedTimeout');rpcDb[_0xc90e('0x96')](_0x171938,'[HistoryRecallClose]');rpcDb[_0xc90e('0x98')](_0x171938,'[HistoryRecallClose]');}}}}})[_0xc90e('0x8e')](ut[_0xc90e('0x8c')](_0xc90e('0x99')));};Preview[_0xc90e('0xe')][_0xc90e('0x6a')]=function(_0x379847){_0x379847[_0xc90e('0x5f')]=!![];if(ut[_0xc90e('0x9a')](_0x379847[_0xc90e('0x29')])){_0x379847[_0xc90e('0x4d')]=_0xc90e('0x9b');}else if(!ut[_0xc90e('0x9c')](_0x379847['dialActive'])){_0x379847[_0xc90e('0x4d')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x379847['Trunk'])){if(!this['isTrunkReachable'](_0x379847[_0xc90e('0x9d')])){_0x379847[_0xc90e('0x4d')]='TRUNK_IS_NOT_REACHABLE';}else{_0x379847[_0xc90e('0x4d')]=_0xc90e('0x9e');}}else{_0x379847[_0xc90e('0x4d')]=_0xc90e('0x9e');}emitCampaignPreview(_0x379847);};Preview[_0xc90e('0xe')][_0xc90e('0x9f')]=function(_0x51c2d6,_0x371ba6,_0x1cd004){var _0x3c42c4=this;var _0x459bd9=this[_0xc90e('0x72')][_0x371ba6];var _0x4783fb=this['campaignsPreview'][_0x459bd9[_0xc90e('0x70')]];var _0x5bb7de;var _0x1b92e3=![];var _0x592924=0x2;var _0x5c96c9=0x3;if(_0x4783fb){switch(_0x1cd004){case'1':_0x4783fb[_0xc90e('0x3e')]+=0x1;_0x459bd9[_0xc90e('0xa0')]+=0x1;_0x459bd9['countglobal']=ut[_0xc90e('0xa1')](_0x459bd9);ut['logCustomer'](_0x459bd9,0x0,'NoSuchNumber');ami['emit']('custom:agentnosuchnumber',ut[_0xc90e('0xa2')](_0x459bd9,_0xc90e('0xa3')));rpcDb['createCustomerHistory'](_0x459bd9,_0xc90e('0xa4'));_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'0',_0x4783fb)[_0xc90e('0x86')](function(_0xb4bb6a){_0x1b92e3=_0xb4bb6a[_0xc90e('0xa6')]==0x1;_0x592924=_0x4783fb[_0xc90e('0xa7')];_0x5c96c9=_0x4783fb[_0xc90e('0xa8')];if(!_0x1b92e3){if(ut['totalGlobal'](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut[_0xc90e('0xaa')](_0x459bd9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5bb7de,_0xc90e('0xab'));}else{if(_0x459bd9['countnosuchnumberretry']>=_0x4783fb['dialNoSuchNumberMaxRetry']){rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xab'));}else{rpcDb[_0xc90e('0xac')](ut[_0xc90e('0xad')](_0x459bd9,_0xc90e('0xa0'),_0x4783fb[_0xc90e('0xa7')]),_0x459bd9[_0xc90e('0xae')],_0x459bd9['activeContact']);}}delete this[_0xc90e('0x72')][_0x51c2d6[_0xc90e('0xaf')]];}else{_0x459bd9['countnosuchnumberretry']++;logger[_0xc90e('0x5a')](_0xc90e('0xb0'),_0x459bd9[_0xc90e('0xa0')]);logger['info']('id',_0x459bd9['idContact']);_0x3c42c4[_0xc90e('0xb1')]({'id':_0x459bd9['idContact'],'field':{'countnosuchnumberretry':_0x459bd9[_0xc90e('0xa0')]}})[_0xc90e('0x86')](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)[_0xc90e('0x86')](function(){});});}});break;case'ANSWER':var _0x26f9c0=moment()[_0xc90e('0x5c')](_0xc90e('0x91'));_0x459bd9[_0xc90e('0xb3')]=_0x26f9c0;_0x459bd9['answertime']=_0x26f9c0;_0x459bd9[_0xc90e('0x74')]=!![];_0x4783fb['pTalking']+=0x1;logger[_0xc90e('0x5a')](_0xc90e('0xb4'),_0x459bd9[_0xc90e('0xb5')],_0xc90e('0xb6'),_0x4783fb[_0xc90e('0x25')],'pTalking:\x20',_0x4783fb[_0xc90e('0x2a')]);ami[_0xc90e('0x23')]('custom:agentconnect',ut[_0xc90e('0xa2')](_0x459bd9,_0xc90e('0xb7'),this[_0xc90e('0x22')][_0x459bd9[_0xc90e('0x70')]]));if(_0x4783fb[_0xc90e('0xb8')]){ami[_0xc90e('0x23')]('custom:agentConnectPreview',ut['buildAcw'](_0x459bd9));}break;case'16':ami[_0xc90e('0x23')](_0xc90e('0xb9'),ut[_0xc90e('0xa2')](_0x459bd9,_0xc90e('0xba'),this['campaignsPreview'][_0x459bd9[_0xc90e('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x459bd9,'complete'));_0x4783fb[_0xc90e('0x39')]+=0x1;_0x4783fb[_0xc90e('0x2e')]+=0x1;_0x4783fb[_0xc90e('0x27')]+=0x1;ut['decrementTalkink'](_0x4783fb,_0xc90e('0xbb'));_0x459bd9[_0xc90e('0xbc')]=ut[_0xc90e('0xa1')](_0x459bd9);ut[_0xc90e('0x92')](_0x459bd9,0x4,_0xc90e('0xbd'));rpcDb['createCustomerHistory'](_0x459bd9,_0xc90e('0xbe'));rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xbf'));rpcDb[_0xc90e('0xc0')](_0x459bd9);_0x4783fb[_0xc90e('0xc1')]+=_0x459bd9['talktime'];_0x4783fb[_0xc90e('0x2b')]+=_0x459bd9[_0xc90e('0xc2')];logger[_0xc90e('0x5a')](_0xc90e('0xc3'),_0x459bd9['uniqueid'],_0xc90e('0xb6'),_0x4783fb[_0xc90e('0x25')],_0xc90e('0x73'),_0x4783fb[_0xc90e('0x2a')]);delete this['actions'][_0x51c2d6[_0xc90e('0xaf')]];break;case _0xc90e('0xc4'):_0x4783fb[_0xc90e('0xc5')]+=0x1;_0x459bd9[_0xc90e('0xc6')]+=0x1;_0x459bd9['countglobal']=ut[_0xc90e('0xa1')](_0x459bd9);ut['logCustomer'](_0x459bd9,0x5,_0xc90e('0xc7'));_0x592924=_0x4783fb[_0xc90e('0xc8')];_0x5c96c9=_0x4783fb['callAdditionalPhoneAfterMin'];ami[_0xc90e('0x23')](_0xc90e('0xc9'),ut[_0xc90e('0xa2')](_0x459bd9,_0xc90e('0xca')));rpcDb[_0xc90e('0x96')](_0x459bd9,_0xc90e('0xcb'));_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'5',_0x4783fb)[_0xc90e('0x86')](function(_0x8651ff){_0x1b92e3=_0x8651ff[_0xc90e('0xa6')]==0x1;if(!_0x1b92e3){if(ut[_0xc90e('0xa1')](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut[_0xc90e('0xaa')](_0x459bd9,0xf,_0xc90e('0xcc'));rpcDb[_0xc90e('0x98')](_0x5bb7de,_0xc90e('0xcd'));}else{if(_0x459bd9[_0xc90e('0xc6')]>=_0x4783fb['dialBusyMaxRetry']){rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xcb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x459bd9,_0xc90e('0xc6'),_0x4783fb[_0xc90e('0xc8')]),_0x459bd9['unlockAgent'],_0x459bd9['activeContact']);}}}else{_0x459bd9['countbusyretry']++;_0x3c42c4['incrementPreviewCounters']({'id':_0x459bd9['idContact'],'field':{'countbusyretry':_0x459bd9[_0xc90e('0xc6')]}})['then'](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)[_0xc90e('0x86')](function(){});});}});break;case _0xc90e('0xce'):_0x4783fb['outboundNoAnswerCallsDay']+=0x1;_0x459bd9['countnoanswerretry']+=0x1;_0x459bd9[_0xc90e('0xbc')]=ut[_0xc90e('0xa1')](_0x459bd9);ut[_0xc90e('0x92')](_0x459bd9,0x3,_0xc90e('0xcf'));_0x592924=_0x4783fb[_0xc90e('0xd0')];_0x5c96c9=_0x4783fb['callAdditionalPhoneAfterMin'];var _0x269d75=ut[_0xc90e('0xd1')](_0x459bd9,_0x4783fb);ami[_0xc90e('0x23')]('custom:agentnoanswer',_0x269d75);rpcDb[_0xc90e('0x96')](_0x459bd9,_0xc90e('0xd2'));_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'3',_0x4783fb)['then'](function(_0x328a92){_0x1b92e3=_0x328a92['additional']==0x1;if(!_0x1b92e3){if(ut['totalGlobal'](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut[_0xc90e('0xaa')](_0x459bd9,0xf,_0xc90e('0xcc'));rpcDb[_0xc90e('0x98')](_0x5bb7de,_0xc90e('0xd3'));}else{if(_0x459bd9[_0xc90e('0xd4')]>=_0x4783fb[_0xc90e('0xd5')]){rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xd2'));}else{rpcDb[_0xc90e('0xac')](ut[_0xc90e('0xad')](_0x459bd9,'countnoanswerretry',_0x4783fb[_0xc90e('0xd0')]),_0x459bd9['unlockAgent'],_0x459bd9[_0xc90e('0xd6')]);}}}else{_0x459bd9[_0xc90e('0xd4')]++;_0x3c42c4[_0xc90e('0xb1')]({'id':_0x459bd9['idContact'],'field':{'countnoanswerretry':_0x459bd9[_0xc90e('0xd4')]}})[_0xc90e('0x86')](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)[_0xc90e('0x86')](function(){});});}});break;case _0xc90e('0xd7'):_0x4783fb[_0xc90e('0x3a')]+=0x1;_0x459bd9[_0xc90e('0xd8')]+=0x1;_0x459bd9[_0xc90e('0xbc')]=ut[_0xc90e('0xa1')](_0x459bd9);ut[_0xc90e('0x92')](_0x459bd9,0x8,_0xc90e('0xd9'));_0x592924=_0x4783fb['dialCongestionRetryFrequency'];_0x5c96c9=_0x4783fb[_0xc90e('0xa8')];ami[_0xc90e('0x23')](_0xc90e('0xda'),ut[_0xc90e('0xa2')](_0x459bd9,_0xc90e('0xdb')));rpcDb[_0xc90e('0x96')](_0x459bd9,_0xc90e('0xdc'));_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'8',_0x4783fb)[_0xc90e('0x86')](function(_0x1d10eb){_0x1b92e3=_0x1d10eb['additional']==0x1;if(!_0x1b92e3){if(ut[_0xc90e('0xa1')](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut['cloneAction'](_0x459bd9,0xf,_0xc90e('0xcc'));rpcDb[_0xc90e('0x98')](_0x5bb7de,_0xc90e('0xdd'));}else{if(_0x459bd9[_0xc90e('0xd8')]>=_0x4783fb[_0xc90e('0xde')]){rpcDb[_0xc90e('0x98')](_0x459bd9,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xc90e('0xac')](ut[_0xc90e('0xad')](_0x459bd9,_0xc90e('0xd8'),_0x4783fb[_0xc90e('0xc8')]),_0x459bd9[_0xc90e('0xae')],_0x459bd9[_0xc90e('0xd6')]);}}}else{_0x459bd9['countcongestionretry']++;_0x3c42c4[_0xc90e('0xb1')]({'id':_0x459bd9[_0xc90e('0xdf')],'field':{'countcongestionretry':_0x459bd9[_0xc90e('0xd8')]}})[_0xc90e('0x86')](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)[_0xc90e('0x86')](function(){});});}});break;case _0xc90e('0xe0'):_0x4783fb['outboundRejectCallsDay']+=0x1;_0x459bd9['countagentrejectretry']+=0x1;_0x459bd9['countglobal']=ut[_0xc90e('0xa1')](_0x459bd9);ut[_0xc90e('0x92')](_0x459bd9,0x14,_0xc90e('0xe1'));_0x592924=_0x4783fb['dialAgentRejectRetryFrequency'];_0x5c96c9=_0x4783fb['callAdditionalPhoneAfterMin'];ami[_0xc90e('0x23')](_0xc90e('0xe2'),ut[_0xc90e('0xa2')](_0x459bd9,_0xc90e('0xe3')));rpcDb[_0xc90e('0x96')](_0x459bd9,'[syncHangupRequest][logAgentReject]');_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'20',_0x4783fb)[_0xc90e('0x86')](function(_0x526606){_0x1b92e3=_0x526606[_0xc90e('0xa6')]==0x1;if(!_0x1b92e3){if(ut[_0xc90e('0xa1')](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut[_0xc90e('0xaa')](_0x459bd9,0x14,'AgentReject');rpcDb[_0xc90e('0x98')](_0x5bb7de,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x459bd9[_0xc90e('0xe4')]>=_0x4783fb[_0xc90e('0xe5')]){rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xe6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x459bd9,_0xc90e('0xe4'),_0x4783fb[_0xc90e('0xe7')]),_0x459bd9[_0xc90e('0xae')],_0x459bd9[_0xc90e('0xd6')]);}}}else{_0x459bd9[_0xc90e('0xd4')]++;_0x3c42c4[_0xc90e('0xb1')]({'id':_0x459bd9[_0xc90e('0xdf')],'field':{'countnoanswerretry':_0x459bd9[_0xc90e('0xd4')]}})[_0xc90e('0x86')](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)['then'](function(){});});}});break;case _0xc90e('0xe8'):_0x4783fb[_0xc90e('0x42')]+=0x1;_0x459bd9[_0xc90e('0xe9')]+=0x1;_0x459bd9['countglobal']=ut[_0xc90e('0xa1')](_0x459bd9);ut[_0xc90e('0x92')](_0x459bd9,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x459bd9,_0xc90e('0xea'));_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'11',_0x4783fb)[_0xc90e('0x86')](function(_0x2456cb){_0x1b92e3=_0x2456cb['additional']==0x1;if(!_0x1b92e3){if(ut['totalGlobal'](_0x459bd9)>=_0x4783fb['dialGlobalMaxRetry']){_0x5bb7de=ut[_0xc90e('0xaa')](_0x459bd9,0xf,_0xc90e('0xcc'));rpcDb[_0xc90e('0x98')](_0x5bb7de,_0xc90e('0xea'));}else{if(_0x459bd9[_0xc90e('0xeb')]>=_0x4783fb['dialAbandonedMaxRety']){rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xea'));}else{rpcDb[_0xc90e('0xac')](ut[_0xc90e('0xad')](_0x459bd9,'countabandonedretry',_0x4783fb[_0xc90e('0xec')]),_0x459bd9[_0xc90e('0xae')],_0x459bd9[_0xc90e('0xd6')]);}}}else{_0x459bd9[_0xc90e('0xd4')]++;_0x3c42c4['incrementPreviewCounters']({'id':_0x459bd9['idContact'],'field':{'countnoanswerretry':_0x459bd9[_0xc90e('0xd4')]}})[_0xc90e('0x86')](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)[_0xc90e('0x86')](function(){});});}});break;case'18':_0x4783fb[_0xc90e('0xed')]+=0x1;_0x459bd9[_0xc90e('0xee')]+=0x1;_0x459bd9[_0xc90e('0xbc')]=ut[_0xc90e('0xa1')](_0x459bd9);ut[_0xc90e('0x92')](_0x459bd9,0x12,_0x51c2d6['cause-txt']||_0x51c2d6[_0xc90e('0xef')]);ami[_0xc90e('0x23')](_0xc90e('0xf0'),ut[_0xc90e('0xa2')](_0x459bd9,_0xc90e('0xf1')));rpcDb[_0xc90e('0x96')](_0x459bd9,'[callProgressDetectingCustomer][hangupInAMD]');_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'18',_0x4783fb)[_0xc90e('0x86')](function(_0xb75412){_0x1b92e3=_0xb75412[_0xc90e('0xa6')]==0x1;if(!_0x1b92e3){if(ut[_0xc90e('0xa1')](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut['cloneAction'](_0x459bd9,0x12,_0xc90e('0xcc'));rpcDb[_0xc90e('0x98')](_0x5bb7de,_0xc90e('0xf2'));}else{rpcDb['createCustomerFinal'](_0x459bd9,_0xc90e('0xf2'));}}else{_0x459bd9[_0xc90e('0xd4')]++;_0x3c42c4[_0xc90e('0xb1')]({'id':_0x459bd9['idContact'],'field':{'countnoanswerretry':_0x459bd9[_0xc90e('0xd4')]}})['then'](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)[_0xc90e('0x86')](function(){});});}});delete this[_0xc90e('0x72')][_0x51c2d6[_0xc90e('0xaf')]];break;case'19':_0x4783fb['outboundUnknownCallsDay']+=0x1;_0x459bd9[_0xc90e('0xbc')]=ut[_0xc90e('0xa1')](_0x459bd9);ut[_0xc90e('0x92')](_0x459bd9,0x13,_0x51c2d6['cause-txt']||_0x51c2d6[_0xc90e('0xef')]);ami['emit'](_0xc90e('0xf0'),ut['buildObj'](_0x459bd9,'amd'));rpcDb[_0xc90e('0x96')](_0x459bd9,_0xc90e('0xf3'));_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'18',_0x4783fb)[_0xc90e('0x86')](function(_0x506e92){_0x1b92e3=_0x506e92['additional']==0x1;if(!_0x1b92e3){if(ut[_0xc90e('0xa1')](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut[_0xc90e('0xaa')](_0x459bd9,0xf,_0xc90e('0xcc'));rpcDb[_0xc90e('0x98')](_0x5bb7de,_0xc90e('0xf3'));}else{rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xf3'));}}else{_0x459bd9['countnoanswerretry']++;_0x3c42c4['incrementPreviewCounters']({'id':_0x459bd9[_0xc90e('0xdf')],'field':{'countnoanswerretry':_0x459bd9['countnoanswerretry']}})[_0xc90e('0x86')](function(){_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)['then'](function(){});});}});delete this[_0xc90e('0x72')][_0x51c2d6['linkedid']];break;default:if(_0x459bd9[_0xc90e('0x74')]){ut[_0xc90e('0x7e')](_0x4783fb,_0xc90e('0xf4'));ut['loggerError'](_0xc90e('0xf5')+_0x4783fb[_0xc90e('0x25')],_0x51c2d6);}_0x4783fb[_0xc90e('0xed')]+=0x1;_0x459bd9[_0xc90e('0xbc')]=ut[_0xc90e('0xa1')](_0x459bd9);ut['logCustomer'](_0x459bd9,0xc,_0x51c2d6['cause-txt']||_0x51c2d6['dialstatus']);_0x592924=_0x4783fb[_0xc90e('0xe7')];_0x5c96c9=_0x4783fb[_0xc90e('0xa8')];rpcDb[_0xc90e('0x96')](_0x459bd9,_0xc90e('0xf6'));_0x3c42c4[_0xc90e('0xa5')](_0x459bd9,'20',_0x4783fb)['then'](function(_0x3d9973){_0x1b92e3=_0x3d9973['additional']==0x1;if(!_0x1b92e3){if(ut[_0xc90e('0xa1')](_0x459bd9)>=_0x4783fb[_0xc90e('0xa9')]){_0x5bb7de=ut[_0xc90e('0xaa')](_0x459bd9,0xf,_0xc90e('0xcc'));rpcDb[_0xc90e('0x98')](_0x5bb7de,_0xc90e('0xf7'));}else{rpcDb[_0xc90e('0x98')](_0x459bd9,_0xc90e('0xf7'));}delete this['actions'][_0x51c2d6[_0xc90e('0xaf')]];}else{_0x3c42c4[_0xc90e('0xb2')](_0x459bd9,_0x592924,_0x5c96c9)[_0xc90e('0x86')](function(){});}});}if(!(_0x459bd9[_0xc90e('0x74')]&&_0x1cd004==='16')){ut[_0xc90e('0x7c')](_0x4783fb,_0xc90e('0xf8'));logger['info'](_0xc90e('0xf9'),_0x459bd9[_0xc90e('0xb5')],_0xc90e('0xb6'),_0x4783fb[_0xc90e('0x25')],_0xc90e('0x71'),_0x4783fb[_0xc90e('0x60')]);}if(_0x1cd004!==_0xc90e('0xfa')){delete this[_0xc90e('0x72')][_0x51c2d6['linkedid']];delete this[_0xc90e('0x72')][_0x51c2d6[_0xc90e('0xfb')]];}}};Preview['prototype'][_0xc90e('0xfc')]=function(_0x569664,_0x1a83af,_0x4c589c){if(_[_0xc90e('0xfd')](_0x1a83af)&&'object'!==typeof _0x1a83af){return;}if(_[_0xc90e('0xfd')](_0x4c589c)&&_0xc90e('0xfe')!==typeof _0x4c589c){return;}switch(_0x4c589c[_0xc90e('0xff')]){case'0':ut['logAgent'](_0x569664,0x0,'NoSuchNumber');rpcDb[_0xc90e('0x100')](_0x569664,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xc90e('0x101')](_0x569664,0x3,_0xc90e('0xcf'));rpcDb[_0xc90e('0x100')](_0x569664,_0xc90e('0x102'));break;case'5':ut[_0xc90e('0x101')](_0x569664,0x5,_0xc90e('0xc7'));rpcDb['createAgentHistory'](_0x569664,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xc90e('0x101')](_0x569664,0x8,'Congestion');rpcDb[_0xc90e('0x100')](_0x569664,_0xc90e('0x103'));break;case'22':ut['logAgent'](_0x569664,0x16,_0xc90e('0x104'));rpcDb[_0xc90e('0x100')](_0x569664,_0xc90e('0x105'));break;default:ut['logAgent'](_0x569664,0xc,_0x4c589c['reason']);rpcDb[_0xc90e('0x100')](_0x569664,_0xc90e('0x103'));}ut['updateOriginated'](_0x1a83af,_0xc90e('0x106'));logger['info'](_0xc90e('0x107'),_0x569664[_0xc90e('0xb5')],_0xc90e('0xb6'),_0x1a83af['name'],_0xc90e('0x71'),_0x1a83af['originated']);delete this[_0xc90e('0x72')][_0x569664[_0xc90e('0xb5')]];};Preview['prototype'][_0xc90e('0xa5')]=function(_0x4055e5,_0x4758f2,_0xd85f0f){return Promise[_0xc90e('0x108')]()['then'](cmHopperAdditionalPhone[_0xc90e('0xa5')](_0x4055e5,_0x4758f2,_0xd85f0f))[_0xc90e('0x8e')](logger[_0xc90e('0x5a')](_0xc90e('0x109')));};Preview['prototype']['swapAdditionalPhones']=function(_0x18fe24,_0x49e599,_0x80dead){return Promise[_0xc90e('0x108')]()['then'](cmHopperAdditionalPhone[_0xc90e('0xb2')](_0x18fe24,_0x49e599,_0x80dead))[_0xc90e('0x8e')](logger[_0xc90e('0x5a')](_0xc90e('0x10a')));};Preview[_0xc90e('0xe')]['incrementPreviewCounters']=function(_0x1500d3){return Promise[_0xc90e('0x108')]()['then'](cmHopperAdditionalPhone[_0xc90e('0xb1')](_0x1500d3))[_0xc90e('0x8e')](logger[_0xc90e('0x5a')]('[incrementPreviewCounters]\x20'));};Preview[_0xc90e('0xe')][_0xc90e('0x10b')]=function(_0x4ffd92,_0x57946f,_0x4eb964,_0xa0dd83,_0x126f42){var _0x43278c=this;return new Promise(function(_0x55424a,_0x3a4f74){if(_[_0xc90e('0x6e')](_0x57946f)||_[_0xc90e('0x6e')](_0x57946f[_0xc90e('0x10c')])||_[_0xc90e('0x6e')](_0x57946f['phone'])||_[_0xc90e('0x6e')](_0x57946f[_0xc90e('0x77')])){_0x3a4f74(ut['message']('Contact\x20is\x20undefined',_0xa0dd83,_0x126f42));return;}var _0x589668=uuid['v4']();var _0x32522f=_0x43278c[_0xc90e('0x22')][_0x57946f[_0xc90e('0x6f')]['name']];var _0x1d50c1=_0x4eb964?_0x43278c['agents'][_0x4eb964]['id']:undefined;_0x43278c['actions'][_0x589668]=new Action(_0x57946f,_0x32522f,_0x589668,_0x4eb964,_0x1d50c1);var _0x186b5a=_0x43278c['actions'][_0x589668];_0x186b5a[_0xc90e('0xae')]=_0xa0dd83;_0x186b5a[_0xc90e('0xd6')]=_0x126f42;_0x186b5a['lookAgent']=_0x4eb964;if(_[_0xc90e('0x10d')](_0x4ffd92)){_0x43278c[_0xc90e('0x10e')](_0x186b5a,_0x32522f,_0x57946f,_0x4eb964)[_0xc90e('0x86')](function(_0x243876){logger['info'](_0xc90e('0x10f'),_0xc90e('0x110')+_0x186b5a[_0xc90e('0x70')]+_0xc90e('0x111')+_0x186b5a[_0xc90e('0xdf')],JSON[_0xc90e('0x57')](_0x243876));ami['emit'](_0xc90e('0x112'),ut[_0xc90e('0xa2')](_0x186b5a,_0xc90e('0x113'),_0x43278c['campaignsPreview'][_0x186b5a[_0xc90e('0x70')]]));_0x55424a(ut[_0xc90e('0x4d')](_0xc90e('0x114')));})['catch'](function(_0x17c262){ut[_0xc90e('0x115')](_0xc90e('0x116'),_0x17c262);_0x3a4f74(ut['message']('Call\x20failed',_0xa0dd83,_0x126f42));});}else{_0x32522f[_0xc90e('0x117')]+=0x1;ut[_0xc90e('0x118')](_0x186b5a);rpcDb[_0xc90e('0x119')](_0x186b5a,'[Blacklist][error]');delete _0x43278c[_0xc90e('0x72')][_0x589668];_0x3a4f74(ut[_0xc90e('0x4d')](_0xc90e('0x11a'),_0xa0dd83,_0x126f42));}});};Preview[_0xc90e('0xe')][_0xc90e('0x11b')]=function(_0x96b3f7){return!_[_0xc90e('0x6e')](_0x96b3f7)&&!_[_0xc90e('0x6e')](_0x96b3f7[_0xc90e('0x25')])&&!_[_0xc90e('0x6e')](_0x96b3f7[_0xc90e('0x54')])&&_0x96b3f7['active']&&!_[_0xc90e('0x6e')](this[_0xc90e('0x12')][util[_0xc90e('0x5c')](_0xc90e('0x11c'),_0x96b3f7['name'])])&&!_[_0xc90e('0x6e')](this['trunks'][util['format'](_0xc90e('0x11c'),_0x96b3f7['name'])][_0xc90e('0x79')])&&(this[_0xc90e('0x12')][util[_0xc90e('0x5c')](_0xc90e('0x11c'),_0x96b3f7['name'])][_0xc90e('0x79')]===_0xc90e('0x11d')||this['trunks'][util[_0xc90e('0x5c')](_0xc90e('0x11c'),_0x96b3f7[_0xc90e('0x25')])][_0xc90e('0x79')]===_0xc90e('0x11e'));};Preview[_0xc90e('0xe')][_0xc90e('0x8b')]=function(_0x29936e,_0x41a212){return this[_0xc90e('0x11f')](_0x29936e,_0x41a212)['then'](function(_0x42a9b4){return _[_0xc90e('0x75')](_0x42a9b4,[_0xc90e('0x4d')]);})[_0xc90e('0x8e')](function(_0x5f131e){if(_0x5f131e[_0xc90e('0x120')]){rpcDb[_0xc90e('0x121')](_0x29936e);}if(_0x5f131e['active']){rpcDb['disableContact'](_0x29936e);}throw _['pick'](_0x5f131e,[_0xc90e('0x4d')]);});};Preview['prototype'][_0xc90e('0x11f')]=function(_0xc98204,_0x5a4ba0){var _0x26da2b=this;var _0x4f7c46,_0x54d74b;return rpcDb[_0xc90e('0x122')](_0xc98204)[_0xc90e('0x86')](function(_0xa5764c){if(!_['isNil'](_0xa5764c[0x0])){_0x54d74b=_0xa5764c[0x0][_0xc90e('0x123')]?![]:!![];_0x4f7c46=_0xa5764c[0x0]['recallme']?!![]:![];_0x4f7c46=_0x5a4ba0?!![]:_0x4f7c46;}var _0x2bd287=_0x26da2b[_0xc90e('0x124')](_0xa5764c);if(_0x2bd287['isValid']){rpcDb['checkIsBlackList'](_[_0xc90e('0x75')](_0xa5764c[0x0],[_0xc90e('0x77'),_0xc90e('0x125')]))['then'](function(_0x1a2de2){_0x26da2b[_0xc90e('0x10b')](_0x1a2de2,_0xa5764c[0x0],_0x5a4ba0,_0x54d74b,_0x4f7c46)['then'](function(_0x3231b6){return _0x3231b6;})['catch'](function(_0x54eae0){throw _0x54eae0;});})[_0xc90e('0x8e')](function(_0x1e404c){ut[_0xc90e('0x115')](_0xc90e('0x126'),_0x1e404c);throw ut['message'](_0xc90e('0x127'),_0x54d74b,_0x4f7c46);});}else{throw ut[_0xc90e('0x4d')](_0x2bd287[_0xc90e('0x4d')],_0x54d74b,_0x4f7c46);}})[_0xc90e('0x8e')](function(_0x5ed783){ut[_0xc90e('0x115')](_0xc90e('0x128'),_0x5ed783);throw ut[_0xc90e('0x4d')](_0xc90e('0x127'),![],!![]);});};Preview[_0xc90e('0xe')][_0xc90e('0x124')]=function(_0x46c3cd){if(_[_0xc90e('0x6e')](_0x46c3cd)||_[_0xc90e('0x10d')](_0x46c3cd)||!_[_0xc90e('0x6e')](_0x46c3cd[0x0][_0xc90e('0x89')])&&_[_0xc90e('0x6e')](_0x46c3cd[0x0][_0xc90e('0x89')][_0xc90e('0x25')])){ut[_0xc90e('0x115')](_0xc90e('0x129'),_0x46c3cd);return{'isValid':![],'message':_0xc90e('0x12a')};}var _0x236f4d=this[_0xc90e('0x22')][_0x46c3cd[0x0][_0xc90e('0x6f')]['name']];_0x236f4d['message']='ACTIVE';if(_[_0xc90e('0x6e')](_0x236f4d)){ut['logger'](_0xc90e('0x12b'),_0x236f4d);return{'isValid':![],'message':_0xc90e('0x12c')};}if(!this['isTrunkReachable'](_0x236f4d['Trunk'])){ut[_0xc90e('0x115')](_0xc90e('0x12d'),_0xc90e('0x12e')+_0x236f4d[_0xc90e('0x25')]+_0xc90e('0x12f'));if(!this[_0xc90e('0x11b')](_0x236f4d[_0xc90e('0x9d')])){ut[_0xc90e('0x115')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x236f4d['name']+_0xc90e('0x130'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xc90e('0x9c')](_0x236f4d[_0xc90e('0x33')])){ut['logger'](_0xc90e('0x131'),_0x236f4d[_0xc90e('0x25')]+_0xc90e('0x132'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x236f4d['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xc90e('0xe')][_0xc90e('0x10e')]=function(_0x2653c2,_0x5317bd,_0x416a96,_0x482a1a){var _0x292ecb=this;return new Promise(function(_0xda19f5,_0x1204a7){var _0xb856ff=_0x2653c2[_0xc90e('0xb5')];var _0xc5ae7e=_0x292ecb[_0xc90e('0x11b')](_0x5317bd[_0xc90e('0x53')])?util['format'](_0xc90e('0x133'),_0x5317bd[_0xc90e('0x53')][_0xc90e('0x25')],_[_0xc90e('0x6e')](_0x5317bd['dialPrefix'])?'':_0x5317bd[_0xc90e('0x37')][_0xc90e('0x134')]()||'',_0x5317bd[_0xc90e('0x135')]>0x0?_0x416a96[_0xc90e('0x125')]['substring'](_0x5317bd[_0xc90e('0x135')]):_0x416a96['phone']):util[_0xc90e('0x5c')](_0xc90e('0x133'),_[_0xc90e('0x6e')](_0x5317bd[_0xc90e('0x9d')])?_0x5317bd[_0xc90e('0x53')][_0xc90e('0x25')]:_0x5317bd[_0xc90e('0x9d')][_0xc90e('0x25')],_['isNil'](_0x5317bd['dialPrefix'])?'':_0x5317bd[_0xc90e('0x37')][_0xc90e('0x134')]()||'',_0x5317bd[_0xc90e('0x135')]>0x0?_0x416a96[_0xc90e('0x125')][_0xc90e('0x136')](_0x5317bd['dialCutDigit']):_0x416a96['phone']);var _0x34eae6=_0x292ecb[_0xc90e('0x11b')](_0x5317bd[_0xc90e('0x53')])?ut['getCallerId'](_0x5317bd[_0xc90e('0x53')][_0xc90e('0x55')],_0x5317bd[_0xc90e('0x34')],_0x5317bd['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xc90e('0x137')](_0x5317bd[_0xc90e('0x35')],_0x5317bd[_0xc90e('0x138')]):_0x5317bd[_0xc90e('0x35')]):ut[_0xc90e('0x139')](_[_0xc90e('0x6e')](_0x5317bd[_0xc90e('0x9d')])?_0x5317bd[_0xc90e('0x53')][_0xc90e('0x55')]:_0x5317bd['TrunkBackup'][_0xc90e('0x55')],_0x5317bd[_0xc90e('0x34')],_0x5317bd['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xc90e('0x137')](_0x5317bd[_0xc90e('0x35')],_0x5317bd['dialRandomLastDigitCallerIdNumber']):_0x5317bd['dialOriginateCallerIdNumber']);if(_0x34eae6){_0x2653c2[_0xc90e('0x13a')]=ut[_0xc90e('0x13b')](_0x34eae6);_0x2653c2['originatecalleridnum']=ut[_0xc90e('0x13c')](_0x34eae6);}var _0x2a08f4=ut[_0xc90e('0x13d')](_0x5317bd,_0x416a96,_0xc5ae7e,_0x34eae6,_0xb856ff,_0x2653c2);_[_0xc90e('0x13e')](_0x2653c2,ut[_0xc90e('0x13f')](_0x2a08f4));_0x2653c2[_0xc90e('0x90')]=moment()[_0xc90e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5317bd[_0xc90e('0x140')]=_0x2a08f4;ami[_0xc90e('0x141')](ut[_0xc90e('0x142')](_0x2653c2,_0x5317bd,_0x2a08f4,_0x2653c2[_0xc90e('0xd6')],_0x482a1a))['then'](function(_0x287275){_0x5317bd[_0xc90e('0x60')]+=0x1;logger[_0xc90e('0x5a')](_0xc90e('0x143'),_0xb856ff,'\x20Queue',_0x5317bd[_0xc90e('0x25')],_0xc90e('0x71'),_0x5317bd[_0xc90e('0x60')]);_0xda19f5(_0x287275);})[_0xc90e('0x8e')](function(_0x5e4bbb){ut['logAgent'](_0x2653c2,0xe,_0xc90e('0x144'));rpcDb['createAgentHistory'](_0x2653c2,_0xc90e('0x145'));_0x1204a7(_0x5e4bbb);});});};Preview[_0xc90e('0xe')]['syncNewExten']=function(_0x1b1733){if(this[_0xc90e('0x72')][_0x1b1733[_0xc90e('0xaf')]]){this['actions'][_0x1b1733[_0xc90e('0xaf')]][_0xc90e('0x7a')]=_0x1b1733[_0xc90e('0x7a')];}};Preview['prototype'][_0xc90e('0x15')]=function(_0x500a8a){var _0x226ae2=this;var _0x222fbd=this[_0xc90e('0x72')][_0x500a8a[_0xc90e('0x146')]];if(_0x222fbd){if(_0x222fbd['lookAgent']&&this[_0xc90e('0x13')][_0x222fbd[_0xc90e('0x147')]]){ut[_0xc90e('0x148')](_0x222fbd,this[_0xc90e('0x13')][_0x222fbd[_0xc90e('0x147')]][_0xc90e('0x25')],this['agents'][_0x222fbd[_0xc90e('0x147')]]['id']);}var _0x27f824=_[_0xc90e('0x149')](_0x222fbd);_0x27f824[_0xc90e('0xb3')]=moment()[_0xc90e('0x5c')](_0xc90e('0x91'));var _0x1c7336=_0x226ae2[_0xc90e('0x22')][_0x222fbd[_0xc90e('0x70')]];if(ut[_0xc90e('0x14a')](_0x500a8a[_0xc90e('0x14b')])){if(_0x222fbd[_0xc90e('0xae')]){rpcDb[_0xc90e('0x121')](_0x222fbd[_0xc90e('0xdf')]);}if(_0x222fbd[_0xc90e('0xd6')]){rpcDb[_0xc90e('0x8f')](_0x222fbd[_0xc90e('0xdf')]);}ami['emit'](_0xc90e('0x14c'),ut[_0xc90e('0xa2')](_0x222fbd,_0xc90e('0x14d'),this[_0xc90e('0x22')][_0x222fbd['queue']]));this[_0xc90e('0xfc')](_0x27f824,_0x1c7336,_0x500a8a);}else{_0x222fbd['starttime']=moment()[_0xc90e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x27f824,0x4,_0xc90e('0xbd'));rpcDb[_0xc90e('0x100')](_0x27f824,_0xc90e('0x14e'));}}};Preview[_0xc90e('0xe')][_0xc90e('0x18')]=function(_0x179e36){var _0x4b1199=this[_0xc90e('0x72')][_0x179e36[_0xc90e('0xaf')]];var _0x50bbef;if(_0x4b1199){_0x50bbef=this['campaignsPreview'][_0x4b1199[_0xc90e('0x70')]];logger[_0xc90e('0x5a')](_0xc90e('0x14f'),_0x179e36[_0xc90e('0xaf')],_0xc90e('0xb6'),_0x50bbef[_0xc90e('0x25')],'pTalking:\x20',_0x50bbef[_0xc90e('0x2a')]);}if(this['actions'][_0x179e36['linkedid']]&&_0x179e36[_0xc90e('0xaf')]!==_0x179e36[_0xc90e('0xb5')]){if(_0x179e36[_0xc90e('0x150')]==='16'&&this[_0xc90e('0x72')][_0x179e36[_0xc90e('0xaf')]]['dialAnswer']){this[_0xc90e('0x9f')](_0x179e36,_0x179e36[_0xc90e('0xaf')],_0x179e36['cause']);}else if(this[_0xc90e('0x72')][_0x179e36[_0xc90e('0xaf')]][_0xc90e('0x74')]){logger[_0xc90e('0x5a')](_0xc90e('0x151'),_0x179e36[_0xc90e('0xaf')],_0x179e36[_0xc90e('0x150')],_0xc90e('0xb6'),_0x50bbef[_0xc90e('0x25')],_0xc90e('0x73'),_0x50bbef[_0xc90e('0x2a')]);this[_0xc90e('0x9f')](_0x179e36,_0x179e36['linkedid'],_0x179e36[_0xc90e('0x150')]);}}else if(_0x4b1199&&_['isNil'](_0x4b1199[_0xc90e('0x152')])&&_0x50bbef[_0xc90e('0x153')]&&_0x179e36[_0xc90e('0xaf')]===_0x179e36[_0xc90e('0xb5')]&&_[_0xc90e('0x6e')](_0x179e36[_0xc90e('0xff')])&&_0x179e36[_0xc90e('0x150')]==='16'&&_0x179e36[_0xc90e('0x154')]==='6'&&_[_0xc90e('0xfd')](_0x4b1199['transfer'])){if(_0x4b1199[_0xc90e('0xae')]){rpcDb[_0xc90e('0x121')](_0x4b1199[_0xc90e('0xdf')]);}if(_0x4b1199[_0xc90e('0xd6')]){rpcDb['disableContact'](_0x4b1199[_0xc90e('0xdf')]);}_0x179e36[_0xc90e('0xff')]='22';this[_0xc90e('0xfc')](_0x4b1199,_0x50bbef,_0x179e36);}else if(_0x4b1199&&_0x4b1199[_0xc90e('0x155')]){if(_0x179e36['cause']==='16'&&this[_0xc90e('0x72')][_0x179e36['linkedid']][_0xc90e('0x74')]){logger[_0xc90e('0x5a')](_0xc90e('0x156'),_0x179e36[_0xc90e('0xaf')],_0x179e36[_0xc90e('0x150')],_0xc90e('0xb6'),_0x50bbef['name'],'pTalking:\x20',_0x50bbef[_0xc90e('0x2a')]);this[_0xc90e('0x9f')](_0x179e36,_0x179e36[_0xc90e('0xaf')],_0x179e36[_0xc90e('0x150')]);}else if(this[_0xc90e('0x72')][_0x179e36[_0xc90e('0xaf')]][_0xc90e('0x74')]){logger['info']('[syncHangup][talking][cause]',_0x179e36['linkedid'],_0x179e36[_0xc90e('0x150')],_0xc90e('0xb6'),_0x50bbef[_0xc90e('0x25')],_0xc90e('0x73'),_0x50bbef[_0xc90e('0x2a')]);this[_0xc90e('0x9f')](_0x179e36,_0x179e36[_0xc90e('0xaf')],_0x179e36[_0xc90e('0x150')]);}}};Preview[_0xc90e('0xe')][_0xc90e('0x1a')]=function(_0xbab071){if(this[_0xc90e('0x72')][_0xbab071[_0xc90e('0xfb')]]&&_0xbab071['destlinkedid']!==_0xbab071[_0xc90e('0x157')]){this[_0xc90e('0x9f')](_0xbab071,_0xbab071['destlinkedid'],_0xbab071[_0xc90e('0xef')]);}};Preview[_0xc90e('0xe')][_0xc90e('0x19')]=function(_0x2d6eaa){if(this[_0xc90e('0x72')][_0x2d6eaa[_0xc90e('0xaf')]]&&_0x2d6eaa[_0xc90e('0xaf')]!==_0x2d6eaa[_0xc90e('0xb5')]&&!this[_0xc90e('0x72')][_0x2d6eaa[_0xc90e('0xaf')]][_0xc90e('0x74')]){if(_0x2d6eaa[_0xc90e('0x150')]==='1'){this[_0xc90e('0x9f')](_0x2d6eaa,_0x2d6eaa[_0xc90e('0xaf')],_0x2d6eaa[_0xc90e('0x150')]);}}};Preview[_0xc90e('0xe')][_0xc90e('0x158')]=function(_0x229f49,_0x590fb1,_0x55fb7e){if(this['actions'][_0x229f49]){if(_['isNil'](this[_0xc90e('0x72')][_0x229f49][_0xc90e('0x140')])){this['actions'][_0x229f49]['variables']={};}this[_0xc90e('0x72')][_0x229f49][_0xc90e('0x140')][_0x590fb1]=_0x55fb7e;}};Preview['prototype'][_0xc90e('0x1e')]=function(_0x530ca2){try{if(!_[_0xc90e('0x6e')](_0x530ca2)){if(ut[_0xc90e('0x159')](_[_0xc90e('0x15a')](_0x530ca2[_0xc90e('0x15b')])[0x0])){this[_0xc90e('0x158')](_0x530ca2[_0xc90e('0xb5')],_[_0xc90e('0x15a')](_0x530ca2[_0xc90e('0x15b')])[0x0],_0x530ca2[_0xc90e('0x15c')]);}}}catch(_0x44e825){logger[_0xc90e('0x15d')](_0xc90e('0x15e'),util['inspect'](_0x44e825,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0xb863cb){if(_0xb863cb){if(this[_0xc90e('0x72')][_0xb863cb[_0xc90e('0x15f')]]){this[_0xc90e('0x72')][_0xb863cb[_0xc90e('0x15f')]][_0xc90e('0x155')]=!![];}}};Preview[_0xc90e('0xe')][_0xc90e('0x20')]=function(_0x2020cf){if(_0x2020cf){if(this['actions'][_0x2020cf[_0xc90e('0x160')]]){this[_0xc90e('0x72')][_0x2020cf['transfererlinkedid']][_0xc90e('0x155')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x0650=['VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','logCustomer','RecallInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','then','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','createCustomerFinal','dialNoSuchNumberMaxRetry','scheduledAt','activeContact','actioncountonusuch','idContact','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','additional','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','trim','substring','dialCutDigit','SIP/%s/%s%s','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','syncHangupRequest','addVariable','syncVarSet','keys','variable','error','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','ioredis','../../../config/logger','preview','../ami','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','trunks','agents','syncOriginateResponse','syncHangup','hanguprequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateTimeout','dialPrefix','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','md5','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','emit','voice_queue_presence:remove','originated','sendMessageOneNotActive','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId'];(function(_0x2b38d5,_0x200446){var _0x475608=function(_0xebfaee){while(--_0xebfaee){_0x2b38d5['push'](_0x2b38d5['shift']());}};_0x475608(++_0x200446);}(_0x0650,0xed));var _0x0065=function(_0x109307,_0x4f12d1){_0x109307=_0x109307-0x0;var _0x2ea750=_0x0650[_0x109307];return _0x2ea750;};'use strict';var util=require(_0x0065('0x0'));var _=require('lodash');var uuid=require(_0x0065('0x1'));var moment=require(_0x0065('0x2'));var md5=require('md5');var Redis=require(_0x0065('0x3'));var config=require('../../../config/environment');var logger=require(_0x0065('0x4'))(_0x0065('0x5'));var loggerAction=require(_0x0065('0x4'))('actionPreview');var ami=require(_0x0065('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0x0065('0x7'));config[_0x0065('0x8')]=_[_0x0065('0x9')](config[_0x0065('0x8')],{'host':_0x0065('0xa'),'port':0x18eb});var io=require(_0x0065('0xb'))(new Redis(config[_0x0065('0x8')]));var Sequence=function(){};Sequence[_0x0065('0xc')][_0x0065('0xd')]=function(_0x5907e4){this[_0x0065('0xe')]=this[_0x0065('0xe')]?this['tail']['finally'](_0x5907e4):_0x5907e4();};function Preview(_0x4c8f33){this[_0x0065('0xf')]=new Sequence();this[_0x0065('0x10')]=_0x4c8f33['voiceQueues'];this[_0x0065('0x11')]=_0x4c8f33[_0x0065('0x11')];this['actions']={};this[_0x0065('0x12')]=_0x4c8f33[_0x0065('0x12')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x0065('0x13')]['bind'](this));ami['on']('hangup',this[_0x0065('0x14')]['bind'](this));ami['on'](_0x0065('0x15'),this['syncHangupRequest'][_0x0065('0x16')](this));ami['on'](_0x0065('0x17'),this[_0x0065('0x18')][_0x0065('0x16')](this));ami['on'](_0x0065('0x19'),this[_0x0065('0x1a')][_0x0065('0x16')](this));ami['on'](_0x0065('0x1b'),this['syncVarSet'][_0x0065('0x16')](this));ami['on'](_0x0065('0x1c'),this['syncAttendedTransfer'][_0x0065('0x16')](this));ami['on'](_0x0065('0x1d'),this[_0x0065('0x1e')][_0x0065('0x16')](this));this[_0x0065('0x1f')](this[_0x0065('0x10')]);}function emit(_0x319e7a,_0x529e30,_0x5b93a6){io['to'](_0x319e7a)['emit'](_0x529e30,_0x5b93a6);}function emitCampaignPreview(_0x3f7af1){if(_0x3f7af1[_0x0065('0x20')]==='outbound'){var _0x2de3ae={'id':_0x3f7af1['id'],'name':_0x3f7af1['name'],'strategy':_0x3f7af1[_0x0065('0x21')],'answered':_0x3f7af1[_0x0065('0x22')],'available':_0x3f7af1[_0x0065('0x23')],'loggedIn':_0x3f7af1[_0x0065('0x24')],'pTalking':_0x3f7af1[_0x0065('0x25')],'sumBillable':_0x3f7af1[_0x0065('0x26')],'sumDuration':_0x3f7af1[_0x0065('0x27')],'sumHoldTime':_0x3f7af1['sumHoldTime']||0x0,'talking':_0x3f7af1[_0x0065('0x28')],'total':_0x3f7af1['total'],'type':_0x3f7af1['type'],'unmanaged':_0x3f7af1[_0x0065('0x29')],'abandoned':_0x3f7af1['abandoned'],'waiting':_0x3f7af1[_0x0065('0x2a')],'loggedInDb':_0x3f7af1[_0x0065('0x2b')],'dialActive':_0x3f7af1['dialActive'],'dialMethod':_0x3f7af1[_0x0065('0x2c')],'dialOriginateCallerIdName':_0x3f7af1['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3f7af1['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3f7af1[_0x0065('0x2d')],'dialPrefix':_0x3f7af1[_0x0065('0x2e')],'outboundAnswerAgiCallsDay':_0x3f7af1['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x3f7af1['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3f7af1['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3f7af1[_0x0065('0x2f')],'outboundCongestionCallsDay':_0x3f7af1[_0x0065('0x30')],'outboundDropCallsDayACS':_0x3f7af1[_0x0065('0x31')],'outboundDropCallsDayCallersExit':_0x3f7af1[_0x0065('0x32')],'outboundDropCallsDayTimeout':_0x3f7af1[_0x0065('0x33')],'outboundNoAnswerCallsDay':_0x3f7af1['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3f7af1['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3f7af1['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3f7af1[_0x0065('0x34')],'outboundRejectCallsDay':_0x3f7af1[_0x0065('0x35')],'outboundUnknownCallsDay':_0x3f7af1[_0x0065('0x36')],'outboundAbandonedCallsDay':_0x3f7af1['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3f7af1[_0x0065('0x37')],'predictiveIntervalAvgHoldtime':_0x3f7af1[_0x0065('0x38')],'predictiveIntervalAvgTalktime':_0x3f7af1['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3f7af1[_0x0065('0x39')],'predictiveIntervalDroppedCallsTimeout':_0x3f7af1[_0x0065('0x3a')],'predictiveIntervalErlangCalls':_0x3f7af1[_0x0065('0x3b')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f7af1[_0x0065('0x3c')],'predictiveIntervalHitRate':_0x3f7af1[_0x0065('0x3d')],'predictiveIntervalMultiplicativeFactor':_0x3f7af1[_0x0065('0x3e')],'predictiveIntervalPauses':_0x3f7af1[_0x0065('0x3f')],'predictiveIntervalAvailable':_0x3f7af1[_0x0065('0x40')],'predictiveIntervalTotalCalls':_0x3f7af1['predictiveIntervalTotalCalls'],'message':_0x3f7af1['message'],'originated':_0x3f7af1['originated'],'erlangCalls':_0x3f7af1[_0x0065('0x41')],'erlangCallToSecond':_0x3f7af1[_0x0065('0x42')],'erlangAbandonmentRate':_0x3f7af1[_0x0065('0x43')],'erlangBusyFactor':_0x3f7af1[_0x0065('0x44')],'startPredictive':_0x3f7af1[_0x0065('0x45')],'startProgressive':_0x3f7af1[_0x0065('0x46')]};if(_0x3f7af1[_0x0065('0x47')]){_0x2de3ae['Trunk']={'id':_0x3f7af1[_0x0065('0x47')]['id'],'name':_0x3f7af1[_0x0065('0x47')][_0x0065('0x48')],'active':_0x3f7af1[_0x0065('0x47')][_0x0065('0x49')],'callerid':_0x3f7af1['Trunk'][_0x0065('0x4a')]};}if(_0x3f7af1[_0x0065('0x4b')]){_0x2de3ae[_0x0065('0x4b')]={'id':_0x3f7af1[_0x0065('0x4b')]['id'],'name':_0x3f7af1[_0x0065('0x4b')][_0x0065('0x48')]};}var _0x2437f0=md5(JSON[_0x0065('0x4c')](_0x2de3ae));if(_0x3f7af1[_0x0065('0x4d')]!==_0x2437f0){_0x3f7af1[_0x0065('0x4d')]=_0x2437f0;emit(util['format'](_0x0065('0x4e'),_0x2de3ae[_0x0065('0x48')]),_0x0065('0x4f'),_0x2de3ae);}}}function emitVoiceQueueChannelRemove(_0x599bbc){logger[_0x0065('0x50')](_0x0065('0x51'),JSON[_0x0065('0x4c')](_0x599bbc));emit(util[_0x0065('0x52')](_0x0065('0x4e'),_0x599bbc[_0x0065('0x48')]),'voice_queue_channel:remove',_0x599bbc);io[_0x0065('0x53')](_0x0065('0x54'),_0x599bbc);}function notSendMessagesQueue(_0x188fe1){if(_0x188fe1['sendMessageOneNotActive']){if(_0x188fe1[_0x0065('0x55')]===0x0&&_0x188fe1['pTalking']===0x0){_0x188fe1[_0x0065('0x56')]=![];_0x188fe1[_0x0065('0x23')]=0x0;_0x188fe1['paused']=0x0;_0x188fe1[_0x0065('0x57')]=_0x0065('0x58');ut[_0x0065('0x59')](_0x0065('0x5a'),_0x188fe1[_0x0065('0x48')]+_0x0065('0x5b'));}else{_0x188fe1['message']=_0x0065('0x5c');ut[_0x0065('0x59')](_0x0065('0x5a'),_0x188fe1[_0x0065('0x48')]+_0x0065('0x5d'));}emitCampaignPreview(_0x188fe1);}}Preview[_0x0065('0xc')][_0x0065('0x1f')]=function(){var _0x1e49ce=this;setInterval(function(){_0x1e49ce[_0x0065('0x5e')]();},0x7cf);};Preview[_0x0065('0xc')][_0x0065('0x5e')]=function(){var _0x32ab66=this[_0x0065('0x10')];this[_0x0065('0x5f')]+=0x1;for(var _0x475f0a in _0x32ab66){if(_0x32ab66[_0x0065('0x60')](_0x475f0a)&&(_0x32ab66[_0x475f0a][_0x0065('0x2c')]===_0x0065('0x5')||_0x32ab66[_0x475f0a][_0x0065('0x2c')]===_0x0065('0x61'))&&_0x32ab66[_0x475f0a][_0x0065('0x20')]===_0x0065('0x62')){if(this[_0x0065('0x5f')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x0065('0x63')]();}}if(_0x32ab66['hasOwnProperty'](_0x475f0a)&&_0x32ab66[_0x475f0a][_0x0065('0x2c')]==='preview'&&_0x32ab66[_0x475f0a][_0x0065('0x20')]==='outbound'){if(_0x32ab66[_0x475f0a][_0x0065('0x64')]){this[_0x0065('0x65')](_0x32ab66[_0x475f0a]);if(_0x32ab66[_0x475f0a][_0x0065('0x66')])this['recallMe'](_0x32ab66[_0x475f0a]);}else{notSendMessagesQueue(_0x32ab66[_0x475f0a]);}}}};Preview['prototype'][_0x0065('0x67')]=function(_0x496f7d){var _0x7a8a11=this;this[_0x0065('0xf')]['enqueue'](function(){if(!_[_0x0065('0x68')](_0x7a8a11[_0x0065('0x69')][_0x496f7d])){loggerAction[_0x0065('0x50')](_0x0065('0x6a'),_0x496f7d,_0x0065('0x6b'),_0x7a8a11['actions'][_0x496f7d][_0x0065('0x6c')],'originated:\x20',JSON[_0x0065('0x4c')](_0x7a8a11[_0x0065('0x10')][_0x7a8a11[_0x0065('0x69')][_0x496f7d][_0x0065('0x6c')]]['originated']),_0x0065('0x6d'),JSON['stringify'](_0x7a8a11[_0x0065('0x10')][_0x7a8a11[_0x0065('0x69')][_0x496f7d][_0x0065('0x6c')]][_0x0065('0x25')]),JSON[_0x0065('0x4c')](_0x7a8a11[_0x0065('0x69')][_0x496f7d][_0x0065('0x6e')]),JSON[_0x0065('0x4c')](_[_0x0065('0x6f')](_0x7a8a11[_0x0065('0x69')][_0x496f7d],[_0x0065('0x70'),'UserId',_0x0065('0x71'),_0x0065('0x72')])));return ami[_0x0065('0x73')]({'action':_0x0065('0x74'),'channel':_0x7a8a11[_0x0065('0x69')][_0x496f7d][_0x0065('0x75')]})[_0x0065('0x76')](function(_0x47e10c){if(_0x47e10c['message']===_0x0065('0x77')){setTimeout(function(){if(_0x7a8a11[_0x0065('0x69')][_0x496f7d]){ut[_0x0065('0x78')](_0x7a8a11[_0x0065('0x10')][_0x7a8a11[_0x0065('0x69')][_0x496f7d][_0x0065('0x6c')]],_0x0065('0x79'));if(_0x7a8a11[_0x0065('0x69')][_0x496f7d][_0x0065('0x6e')]===!![]){ut[_0x0065('0x7a')](_0x7a8a11[_0x0065('0x10')][_0x7a8a11[_0x0065('0x69')][_0x496f7d][_0x0065('0x6c')]],'[clearZombieChannel]');ut[_0x0065('0x7b')](_0x0065('0x7c')+_0x496f7d,_0x7a8a11['actions'][_0x496f7d][_0x0065('0x6c')]);}ut[_0x0065('0x7b')](_0x0065('0x7d')+_0x496f7d,_0x7a8a11['actions'][_0x496f7d][_0x0065('0x6c')]);delete _0x7a8a11[_0x0065('0x69')][_0x496f7d];}},0x2328);}});}});};Preview[_0x0065('0xc')][_0x0065('0x63')]=function(){var _0x52bf1d=this;loggerAction[_0x0065('0x50')](_0x0065('0x7e'),_[_0x0065('0x7f')](this[_0x0065('0x69')]));for(var _0x8b30be in this[_0x0065('0x69')]){if(_0x52bf1d['actions'][_0x0065('0x60')](_0x8b30be)){_0x52bf1d['clearZombieChannel'](_0x8b30be);}}};Preview[_0x0065('0xc')]['recallMe']=function(_0x3fdadd){var _0x58b49a=this;rpcDb[_0x0065('0x80')](_0x3fdadd['id'],ut[_0x0065('0x81')](this['agents']))['then'](function(_0x2f82e8){if(!_[_0x0065('0x68')](_0x2f82e8)){for(var _0x20925a=0x0;_0x20925a<_0x2f82e8['length'];_0x20925a+=0x1){if(ut[_0x0065('0x82')](_0x2f82e8[_0x20925a][_0x0065('0x83')])<_0x3fdadd['dialRecallMeTimeout']*0x3c){if(_0x2f82e8[_0x20925a]['Agent']&&!_0x2f82e8[_0x20925a][_0x0065('0x84')][_0x0065('0x85')]){_0x58b49a[_0x0065('0x86')](_0x2f82e8[_0x20925a]['id'])['then'](ut[_0x0065('0x87')]('[RecallMe]'))[_0x0065('0x76')](ut[_0x0065('0x87')]('[RecallMe]'));}else{rpcDb[_0x0065('0x88')](_0x2f82e8[_0x20925a]['id']);}}else{var _0x1f994b=new Action(_0x2f82e8[_0x20925a],_0x3fdadd);_0x1f994b[_0x0065('0x89')]=moment()[_0x0065('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fdadd[_0x0065('0x34')]+=0x1;ut[_0x0065('0x8a')](_0x1f994b,0x17,_0x0065('0x8b'));if(_0x3fdadd['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0065('0x8c')](_0x2f82e8[_0x20925a]));rpcDb[_0x0065('0x8d')](_0x1f994b,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x0065('0x8a')](_0x1f994b,0x16,_0x0065('0x8e'));rpcDb[_0x0065('0x8d')](_0x1f994b,_0x0065('0x8f'));rpcDb['createCustomerFinal'](_0x1f994b,_0x0065('0x8f'));}}}}})[_0x0065('0x76')](ut['logger2'](_0x0065('0x90')));};Preview[_0x0065('0xc')]['setMessage']=function(_0x2977f0){_0x2977f0[_0x0065('0x56')]=!![];if(ut[_0x0065('0x91')](_0x2977f0['loggedIn'])){_0x2977f0[_0x0065('0x57')]=_0x0065('0x92');}else if(!ut[_0x0065('0x93')](_0x2977f0[_0x0065('0x64')])){_0x2977f0[_0x0065('0x57')]=_0x0065('0x58');}else if(!this[_0x0065('0x94')](_0x2977f0['Trunk'])){if(!this['isTrunkReachable'](_0x2977f0[_0x0065('0x95')])){_0x2977f0[_0x0065('0x57')]=_0x0065('0x96');}else{_0x2977f0[_0x0065('0x57')]='ACTIVE';}}else{_0x2977f0['message']='ACTIVE';}emitCampaignPreview(_0x2977f0);};Preview[_0x0065('0xc')][_0x0065('0x97')]=function(_0x33d707,_0x5da2f7,_0x19791a){var _0x2fdd75=this;var _0x243b40=this['actions'][_0x5da2f7];var _0x17938a=this[_0x0065('0x10')][_0x243b40[_0x0065('0x6c')]];var _0x499848;var _0xd56ba7=![];var _0x539bc6=0x2;var _0x10c177=0x3;if(_0x17938a){switch(_0x19791a){case'1':_0x17938a[_0x0065('0x98')]+=0x1;_0x243b40[_0x0065('0x99')]+=0x1;_0x243b40[_0x0065('0x9a')]=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x0,_0x0065('0x9c'));ami[_0x0065('0x53')](_0x0065('0x9d'),ut[_0x0065('0x9e')](_0x243b40,'nosuchnumber'));rpcDb[_0x0065('0x8d')](_0x243b40,_0x0065('0x9f'));_0x2fdd75[_0x0065('0xa0')](_0x243b40,'0',_0x17938a)[_0x0065('0xa1')](function(_0x39f0a1){_0xd56ba7=_0x39f0a1['additional']==0x1;_0x539bc6=_0x17938a[_0x0065('0xa2')];_0x10c177=_0x17938a[_0x0065('0xa3')];if(!_0xd56ba7){if(ut[_0x0065('0x9b')](_0x243b40)>=_0x17938a[_0x0065('0xa4')]){_0x499848=ut[_0x0065('0xa5')](_0x243b40,0xf,'Global');rpcDb[_0x0065('0xa6')](_0x499848,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x243b40[_0x0065('0x99')]>=_0x17938a[_0x0065('0xa7')]){rpcDb['createCustomerFinal'](_0x243b40,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x0065('0xa8')](_0x243b40,_0x0065('0x99'),_0x17938a[_0x0065('0xa2')]),_0x243b40['unlockAgent'],_0x243b40[_0x0065('0xa9')]);}}delete this[_0x0065('0x69')][_0x33d707['linkedid']];}else{_0x243b40[_0x0065('0x99')]++;logger[_0x0065('0x50')](_0x0065('0xaa'),_0x243b40['countnosuchnumberretry']);logger['info']('id',_0x243b40[_0x0065('0xab')]);_0x2fdd75['incrementPreviewCounters']({'id':_0x243b40[_0x0065('0xab')],'field':{'countnosuchnumberretry':_0x243b40[_0x0065('0x99')]}})[_0x0065('0xa1')](function(){_0x2fdd75[_0x0065('0xac')](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});break;case'ANSWER':var _0x3f6dfc=moment()['format'](_0x0065('0xad'));_0x243b40[_0x0065('0xae')]=_0x3f6dfc;_0x243b40[_0x0065('0xaf')]=_0x3f6dfc;_0x243b40[_0x0065('0x6e')]=!![];_0x17938a[_0x0065('0x25')]+=0x1;logger[_0x0065('0x50')](_0x0065('0xb0'),_0x243b40['uniqueid'],_0x0065('0xb1'),_0x17938a[_0x0065('0x48')],_0x0065('0x6d'),_0x17938a[_0x0065('0x25')]);ami[_0x0065('0x53')](_0x0065('0xb2'),ut[_0x0065('0x9e')](_0x243b40,_0x0065('0xb3'),this[_0x0065('0x10')][_0x243b40[_0x0065('0x6c')]]));if(_0x17938a['acw']){ami[_0x0065('0x53')](_0x0065('0xb4'),ut[_0x0065('0xb5')](_0x243b40));}break;case'16':ami[_0x0065('0x53')](_0x0065('0xb6'),ut[_0x0065('0x9e')](_0x243b40,'complete',this['campaignsPreview'][_0x243b40[_0x0065('0x6c')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x243b40,_0x0065('0xb7')));_0x17938a[_0x0065('0xb8')]+=0x1;_0x17938a[_0x0065('0xb9')]+=0x1;_0x17938a[_0x0065('0x22')]+=0x1;ut[_0x0065('0x7a')](_0x17938a,_0x0065('0xba'));_0x243b40['countglobal']=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x4,_0x0065('0xbb'));rpcDb[_0x0065('0x8d')](_0x243b40,_0x0065('0xbc'));rpcDb['createCustomerFinal'](_0x243b40,_0x0065('0xbd'));rpcDb[_0x0065('0xbe')](_0x243b40);_0x17938a['sumDuration']+=_0x243b40[_0x0065('0xbf')];_0x17938a['sumBillable']+=_0x243b40[_0x0065('0xbf')];logger[_0x0065('0x50')](_0x0065('0xc0'),_0x243b40['uniqueid'],_0x0065('0xb1'),_0x17938a[_0x0065('0x48')],'pTalking:\x20',_0x17938a[_0x0065('0x25')]);delete this[_0x0065('0x69')][_0x33d707['linkedid']];break;case _0x0065('0xc1'):_0x17938a['outboundBusyCallsDay']+=0x1;_0x243b40[_0x0065('0xc2')]+=0x1;_0x243b40['countglobal']=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x5,_0x0065('0xc3'));_0x539bc6=_0x17938a['dialBusyRetryFrequency'];_0x10c177=_0x17938a[_0x0065('0xa3')];ami[_0x0065('0x53')](_0x0065('0xc4'),ut[_0x0065('0x9e')](_0x243b40,_0x0065('0xc5')));rpcDb[_0x0065('0x8d')](_0x243b40,_0x0065('0xc6'));_0x2fdd75[_0x0065('0xa0')](_0x243b40,'5',_0x17938a)[_0x0065('0xa1')](function(_0x405d52){_0xd56ba7=_0x405d52[_0x0065('0xc7')]==0x1;if(!_0xd56ba7){if(ut[_0x0065('0x9b')](_0x243b40)>=_0x17938a[_0x0065('0xa4')]){_0x499848=ut['cloneAction'](_0x243b40,0xf,_0x0065('0xc8'));rpcDb[_0x0065('0xa6')](_0x499848,_0x0065('0xc9'));}else{if(_0x243b40['countbusyretry']>=_0x17938a[_0x0065('0xca')]){rpcDb[_0x0065('0xa6')](_0x243b40,_0x0065('0xc6'));}else{rpcDb[_0x0065('0xcb')](ut[_0x0065('0xa8')](_0x243b40,_0x0065('0xc2'),_0x17938a[_0x0065('0xcc')]),_0x243b40[_0x0065('0xcd')],_0x243b40[_0x0065('0xa9')]);}}}else{_0x243b40[_0x0065('0xc2')]++;_0x2fdd75[_0x0065('0xce')]({'id':_0x243b40[_0x0065('0xab')],'field':{'countbusyretry':_0x243b40[_0x0065('0xc2')]}})[_0x0065('0xa1')](function(){_0x2fdd75[_0x0065('0xac')](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});break;case _0x0065('0xcf'):_0x17938a[_0x0065('0xd0')]+=0x1;_0x243b40['countnoanswerretry']+=0x1;_0x243b40[_0x0065('0x9a')]=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x3,_0x0065('0xd1'));_0x539bc6=_0x17938a[_0x0065('0xd2')];_0x10c177=_0x17938a[_0x0065('0xa3')];var _0x3c5f3b=ut[_0x0065('0xd3')](_0x243b40,_0x17938a);ami['emit'](_0x0065('0xd4'),_0x3c5f3b);rpcDb['createCustomerHistory'](_0x243b40,_0x0065('0xd5'));_0x2fdd75['verifyAdditionalPhones'](_0x243b40,'3',_0x17938a)[_0x0065('0xa1')](function(_0x121edd){_0xd56ba7=_0x121edd[_0x0065('0xc7')]==0x1;if(!_0xd56ba7){if(ut['totalGlobal'](_0x243b40)>=_0x17938a[_0x0065('0xa4')]){_0x499848=ut[_0x0065('0xa5')](_0x243b40,0xf,_0x0065('0xc8'));rpcDb[_0x0065('0xa6')](_0x499848,_0x0065('0xd6'));}else{if(_0x243b40[_0x0065('0xd7')]>=_0x17938a[_0x0065('0xd8')]){rpcDb[_0x0065('0xa6')](_0x243b40,_0x0065('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x0065('0xa8')](_0x243b40,_0x0065('0xd7'),_0x17938a[_0x0065('0xd2')]),_0x243b40[_0x0065('0xcd')],_0x243b40['activeContact']);}}}else{_0x243b40['countnoanswerretry']++;_0x2fdd75[_0x0065('0xce')]({'id':_0x243b40[_0x0065('0xab')],'field':{'countnoanswerretry':_0x243b40[_0x0065('0xd7')]}})[_0x0065('0xa1')](function(){_0x2fdd75['swapAdditionalPhones'](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});break;case _0x0065('0xd9'):_0x17938a[_0x0065('0x30')]+=0x1;_0x243b40['countcongestionretry']+=0x1;_0x243b40[_0x0065('0x9a')]=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x8,_0x0065('0xda'));_0x539bc6=_0x17938a[_0x0065('0xdb')];_0x10c177=_0x17938a[_0x0065('0xa3')];ami['emit'](_0x0065('0xdc'),ut[_0x0065('0x9e')](_0x243b40,_0x0065('0xdd')));rpcDb[_0x0065('0x8d')](_0x243b40,_0x0065('0xde'));_0x2fdd75[_0x0065('0xa0')](_0x243b40,'8',_0x17938a)[_0x0065('0xa1')](function(_0x367223){_0xd56ba7=_0x367223[_0x0065('0xc7')]==0x1;if(!_0xd56ba7){if(ut[_0x0065('0x9b')](_0x243b40)>=_0x17938a[_0x0065('0xa4')]){_0x499848=ut['cloneAction'](_0x243b40,0xf,_0x0065('0xc8'));rpcDb['createCustomerFinal'](_0x499848,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x243b40[_0x0065('0xdf')]>=_0x17938a[_0x0065('0xe0')]){rpcDb['createCustomerFinal'](_0x243b40,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0065('0xcb')](ut['scheduledAt'](_0x243b40,_0x0065('0xdf'),_0x17938a['dialBusyRetryFrequency']),_0x243b40[_0x0065('0xcd')],_0x243b40[_0x0065('0xa9')]);}}}else{_0x243b40[_0x0065('0xdf')]++;_0x2fdd75['incrementPreviewCounters']({'id':_0x243b40[_0x0065('0xab')],'field':{'countcongestionretry':_0x243b40[_0x0065('0xdf')]}})[_0x0065('0xa1')](function(){_0x2fdd75['swapAdditionalPhones'](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});break;case _0x0065('0xe1'):_0x17938a[_0x0065('0x35')]+=0x1;_0x243b40[_0x0065('0xe2')]+=0x1;_0x243b40['countglobal']=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x14,'AgentReject');_0x539bc6=_0x17938a[_0x0065('0xe3')];_0x10c177=_0x17938a[_0x0065('0xa3')];ami[_0x0065('0x53')](_0x0065('0xe4'),ut['buildObj'](_0x243b40,_0x0065('0xe5')));rpcDb[_0x0065('0x8d')](_0x243b40,_0x0065('0xe6'));_0x2fdd75[_0x0065('0xa0')](_0x243b40,'20',_0x17938a)[_0x0065('0xa1')](function(_0x57f2f1){_0xd56ba7=_0x57f2f1[_0x0065('0xc7')]==0x1;if(!_0xd56ba7){if(ut['totalGlobal'](_0x243b40)>=_0x17938a['dialGlobalMaxRetry']){_0x499848=ut[_0x0065('0xa5')](_0x243b40,0x14,_0x0065('0xe7'));rpcDb['createCustomerFinal'](_0x499848,_0x0065('0xe8'));}else{if(_0x243b40['countagentrejectretry']>=_0x17938a[_0x0065('0xe9')]){rpcDb[_0x0065('0xa6')](_0x243b40,_0x0065('0xe8'));}else{rpcDb['rescheduleContact'](ut[_0x0065('0xa8')](_0x243b40,'countagentrejectretry',_0x17938a[_0x0065('0xe3')]),_0x243b40['unlockAgent'],_0x243b40[_0x0065('0xa9')]);}}}else{_0x243b40[_0x0065('0xd7')]++;_0x2fdd75['incrementPreviewCounters']({'id':_0x243b40[_0x0065('0xab')],'field':{'countnoanswerretry':_0x243b40[_0x0065('0xd7')]}})[_0x0065('0xa1')](function(){_0x2fdd75[_0x0065('0xac')](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});break;case _0x0065('0xea'):_0x17938a[_0x0065('0xeb')]+=0x1;_0x243b40[_0x0065('0xec')]+=0x1;_0x243b40['countglobal']=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0xb,_0x0065('0xed'));rpcDb[_0x0065('0x8d')](_0x243b40,_0x0065('0xee'));_0x2fdd75[_0x0065('0xa0')](_0x243b40,'11',_0x17938a)[_0x0065('0xa1')](function(_0x288d21){_0xd56ba7=_0x288d21[_0x0065('0xc7')]==0x1;if(!_0xd56ba7){if(ut[_0x0065('0x9b')](_0x243b40)>=_0x17938a[_0x0065('0xa4')]){_0x499848=ut[_0x0065('0xa5')](_0x243b40,0xf,_0x0065('0xc8'));rpcDb[_0x0065('0xa6')](_0x499848,_0x0065('0xee'));}else{if(_0x243b40[_0x0065('0xef')]>=_0x17938a[_0x0065('0xf0')]){rpcDb['createCustomerFinal'](_0x243b40,_0x0065('0xee'));}else{rpcDb[_0x0065('0xcb')](ut[_0x0065('0xa8')](_0x243b40,'countabandonedretry',_0x17938a[_0x0065('0xf1')]),_0x243b40[_0x0065('0xcd')],_0x243b40[_0x0065('0xa9')]);}}}else{_0x243b40[_0x0065('0xd7')]++;_0x2fdd75[_0x0065('0xce')]({'id':_0x243b40[_0x0065('0xab')],'field':{'countnoanswerretry':_0x243b40[_0x0065('0xd7')]}})[_0x0065('0xa1')](function(){_0x2fdd75[_0x0065('0xac')](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});break;case'18':_0x17938a[_0x0065('0x36')]+=0x1;_0x243b40['countmachineretry']+=0x1;_0x243b40[_0x0065('0x9a')]=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x12,_0x33d707[_0x0065('0xf2')]||_0x33d707[_0x0065('0xf3')]);ami['emit'](_0x0065('0xf4'),ut[_0x0065('0x9e')](_0x243b40,'amd'));rpcDb[_0x0065('0x8d')](_0x243b40,'[callProgressDetectingCustomer][hangupInAMD]');_0x2fdd75[_0x0065('0xa0')](_0x243b40,'18',_0x17938a)[_0x0065('0xa1')](function(_0x7d7f16){_0xd56ba7=_0x7d7f16['additional']==0x1;if(!_0xd56ba7){if(ut[_0x0065('0x9b')](_0x243b40)>=_0x17938a[_0x0065('0xa4')]){_0x499848=ut['cloneAction'](_0x243b40,0x12,_0x0065('0xc8'));rpcDb[_0x0065('0xa6')](_0x499848,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x0065('0xa6')](_0x243b40,_0x0065('0xf5'));}}else{_0x243b40[_0x0065('0xd7')]++;_0x2fdd75[_0x0065('0xce')]({'id':_0x243b40[_0x0065('0xab')],'field':{'countnoanswerretry':_0x243b40[_0x0065('0xd7')]}})[_0x0065('0xa1')](function(){_0x2fdd75[_0x0065('0xac')](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});delete this[_0x0065('0x69')][_0x33d707[_0x0065('0xf6')]];break;case'19':_0x17938a[_0x0065('0x36')]+=0x1;_0x243b40[_0x0065('0x9a')]=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0x13,_0x33d707[_0x0065('0xf2')]||_0x33d707[_0x0065('0xf3')]);ami[_0x0065('0x53')](_0x0065('0xf4'),ut['buildObj'](_0x243b40,'amd'));rpcDb[_0x0065('0x8d')](_0x243b40,_0x0065('0xf7'));_0x2fdd75[_0x0065('0xa0')](_0x243b40,'18',_0x17938a)[_0x0065('0xa1')](function(_0x2697dc){_0xd56ba7=_0x2697dc[_0x0065('0xc7')]==0x1;if(!_0xd56ba7){if(ut[_0x0065('0x9b')](_0x243b40)>=_0x17938a[_0x0065('0xa4')]){_0x499848=ut[_0x0065('0xa5')](_0x243b40,0xf,'Global');rpcDb[_0x0065('0xa6')](_0x499848,_0x0065('0xf7'));}else{rpcDb['createCustomerFinal'](_0x243b40,'[callProgressDetectingCustomer][machine]');}}else{_0x243b40[_0x0065('0xd7')]++;_0x2fdd75[_0x0065('0xce')]({'id':_0x243b40[_0x0065('0xab')],'field':{'countnoanswerretry':_0x243b40[_0x0065('0xd7')]}})[_0x0065('0xa1')](function(){_0x2fdd75[_0x0065('0xac')](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});});}});delete this[_0x0065('0x69')][_0x33d707['linkedid']];break;default:if(_0x243b40[_0x0065('0x6e')]){ut[_0x0065('0x7a')](_0x17938a,_0x0065('0xf8'));ut[_0x0065('0x7b')](_0x0065('0xf9')+_0x17938a['name'],_0x33d707);}_0x17938a[_0x0065('0x36')]+=0x1;_0x243b40[_0x0065('0x9a')]=ut[_0x0065('0x9b')](_0x243b40);ut[_0x0065('0x8a')](_0x243b40,0xc,_0x33d707[_0x0065('0xf2')]||_0x33d707[_0x0065('0xf3')]);_0x539bc6=_0x17938a[_0x0065('0xe3')];_0x10c177=_0x17938a['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x243b40,'[callProgressDetectingCustomer][logUnknown]');_0x2fdd75[_0x0065('0xa0')](_0x243b40,'20',_0x17938a)[_0x0065('0xa1')](function(_0x31dde5){_0xd56ba7=_0x31dde5['additional']==0x1;if(!_0xd56ba7){if(ut[_0x0065('0x9b')](_0x243b40)>=_0x17938a['dialGlobalMaxRetry']){_0x499848=ut[_0x0065('0xa5')](_0x243b40,0xf,_0x0065('0xc8'));rpcDb[_0x0065('0xa6')](_0x499848,_0x0065('0xfa'));}else{rpcDb['createCustomerFinal'](_0x243b40,_0x0065('0xfa'));}delete this[_0x0065('0x69')][_0x33d707[_0x0065('0xf6')]];}else{_0x2fdd75[_0x0065('0xac')](_0x243b40,_0x539bc6,_0x10c177)[_0x0065('0xa1')](function(){});}});}if(!(_0x243b40['dialAnswer']&&_0x19791a==='16')){ut['updateOriginated'](_0x17938a,_0x0065('0xfb'));logger['info'](_0x0065('0xfc'),_0x243b40[_0x0065('0xfd')],'\x20Queue',_0x17938a['name'],'originated:\x20',_0x17938a[_0x0065('0x55')]);}if(_0x19791a!=='ANSWER'){delete this[_0x0065('0x69')][_0x33d707[_0x0065('0xf6')]];delete this[_0x0065('0x69')][_0x33d707[_0x0065('0xfe')]];}}};Preview['prototype'][_0x0065('0xff')]=function(_0x1cf9a3,_0x3eb8a1,_0x5c9e5c){if(_[_0x0065('0x100')](_0x3eb8a1)&&_0x0065('0x101')!==typeof _0x3eb8a1){return;}if(_[_0x0065('0x100')](_0x5c9e5c)&&_0x0065('0x101')!==typeof _0x5c9e5c){return;}switch(_0x5c9e5c[_0x0065('0x102')]){case'0':ut[_0x0065('0x103')](_0x1cf9a3,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x1cf9a3,_0x0065('0x104'));break;case'3':ut['logAgent'](_0x1cf9a3,0x3,'NoAnswer');rpcDb[_0x0065('0x105')](_0x1cf9a3,_0x0065('0x106'));break;case'5':ut[_0x0065('0x103')](_0x1cf9a3,0x5,'Busy');rpcDb['createAgentHistory'](_0x1cf9a3,_0x0065('0x107'));break;case'8':ut[_0x0065('0x103')](_0x1cf9a3,0x8,'Congestion');rpcDb[_0x0065('0x105')](_0x1cf9a3,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x1cf9a3,0x16,_0x0065('0x108'));rpcDb['createAgentHistory'](_0x1cf9a3,_0x0065('0x109'));break;default:ut[_0x0065('0x103')](_0x1cf9a3,0xc,_0x5c9e5c[_0x0065('0x102')]);rpcDb[_0x0065('0x105')](_0x1cf9a3,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0065('0x78')](_0x3eb8a1,_0x0065('0x10a'));logger[_0x0065('0x50')](_0x0065('0x10b'),_0x1cf9a3['uniqueid'],_0x0065('0xb1'),_0x3eb8a1[_0x0065('0x48')],_0x0065('0x10c'),_0x3eb8a1[_0x0065('0x55')]);delete this['actions'][_0x1cf9a3[_0x0065('0xfd')]];};Preview[_0x0065('0xc')][_0x0065('0xa0')]=function(_0x442e81,_0x14dfdf,_0x2fddc4){return Promise[_0x0065('0x10d')]()['then'](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x442e81,_0x14dfdf,_0x2fddc4))[_0x0065('0x76')](logger['info'](_0x0065('0x10e')));};Preview[_0x0065('0xc')][_0x0065('0xac')]=function(_0x1223be,_0x30423b,_0x503588){return Promise[_0x0065('0x10d')]()[_0x0065('0xa1')](cmHopperAdditionalPhone[_0x0065('0xac')](_0x1223be,_0x30423b,_0x503588))[_0x0065('0x76')](logger[_0x0065('0x50')](_0x0065('0x10f')));};Preview[_0x0065('0xc')][_0x0065('0xce')]=function(_0x5261bb){return Promise[_0x0065('0x10d')]()[_0x0065('0xa1')](cmHopperAdditionalPhone[_0x0065('0xce')](_0x5261bb))[_0x0065('0x76')](logger[_0x0065('0x50')]('[incrementPreviewCounters]\x20'));};Preview[_0x0065('0xc')][_0x0065('0x110')]=function(_0x32fbec,_0x3ed83d,_0x41359f,_0x41609a,_0x4219d8){var _0x21e08a=this;return new Promise(function(_0x30425b,_0x32722a){if(_['isNil'](_0x3ed83d)||_[_0x0065('0x68')](_0x3ed83d['Contact'])||_[_0x0065('0x68')](_0x3ed83d[_0x0065('0x111')])||_[_0x0065('0x68')](_0x3ed83d[_0x0065('0x71')])){_0x32722a(ut[_0x0065('0x57')](_0x0065('0x112'),_0x41609a,_0x4219d8));return;}var _0x1f6606=uuid['v4']();var _0x391980=_0x21e08a['campaignsPreview'][_0x3ed83d[_0x0065('0x6b')][_0x0065('0x48')]];var _0x1b8c6d=_0x41359f?_0x21e08a[_0x0065('0x12')][_0x41359f]['id']:undefined;_0x21e08a[_0x0065('0x69')][_0x1f6606]=new Action(_0x3ed83d,_0x391980,_0x1f6606,_0x41359f,_0x1b8c6d);var _0x4e7260=_0x21e08a[_0x0065('0x69')][_0x1f6606];_0x4e7260['unlockAgent']=_0x41609a;_0x4e7260[_0x0065('0xa9')]=_0x4219d8;_0x4e7260[_0x0065('0x113')]=_0x41359f;if(_[_0x0065('0x114')](_0x32fbec)){_0x21e08a[_0x0065('0x115')](_0x4e7260,_0x391980,_0x3ed83d,_0x41359f)[_0x0065('0xa1')](function(_0x15144a){logger[_0x0065('0x50')](_0x0065('0x116'),_0x0065('0x117')+_0x4e7260['queue']+_0x0065('0x118')+_0x4e7260[_0x0065('0xab')],JSON[_0x0065('0x4c')](_0x15144a));ami[_0x0065('0x53')](_0x0065('0x119'),ut[_0x0065('0x9e')](_0x4e7260,'called',_0x21e08a[_0x0065('0x10')][_0x4e7260[_0x0065('0x6c')]]));_0x30425b(ut[_0x0065('0x57')]('Calling'));})['catch'](function(_0x34345f){ut[_0x0065('0x59')](_0x0065('0x11a'),_0x34345f);_0x32722a(ut[_0x0065('0x57')]('Call\x20failed',_0x41609a,_0x4219d8));});}else{_0x391980['outboundBlacklistCallsDay']+=0x1;ut[_0x0065('0x11b')](_0x4e7260);rpcDb['createHistory'](_0x4e7260,_0x0065('0x11c'));delete _0x21e08a[_0x0065('0x69')][_0x1f6606];_0x32722a(ut[_0x0065('0x57')](_0x0065('0x11d'),_0x41609a,_0x4219d8));}});};Preview[_0x0065('0xc')][_0x0065('0x94')]=function(_0x13fb6f){return!_[_0x0065('0x68')](_0x13fb6f)&&!_[_0x0065('0x68')](_0x13fb6f[_0x0065('0x48')])&&!_[_0x0065('0x68')](_0x13fb6f['active'])&&_0x13fb6f[_0x0065('0x49')]&&!_[_0x0065('0x68')](this[_0x0065('0x11')][util['format'](_0x0065('0x11e'),_0x13fb6f[_0x0065('0x48')])])&&!_[_0x0065('0x68')](this[_0x0065('0x11')][util[_0x0065('0x52')](_0x0065('0x11e'),_0x13fb6f['name'])]['status'])&&(this[_0x0065('0x11')][util['format'](_0x0065('0x11e'),_0x13fb6f[_0x0065('0x48')])][_0x0065('0x74')]===_0x0065('0x11f')||this[_0x0065('0x11')][util[_0x0065('0x52')](_0x0065('0x11e'),_0x13fb6f[_0x0065('0x48')])][_0x0065('0x74')]==='unmonitored');};Preview[_0x0065('0xc')][_0x0065('0x86')]=function(_0x43e79d,_0x36d342){return this[_0x0065('0x120')](_0x43e79d,_0x36d342)['then'](function(_0x5a5aec){return _[_0x0065('0x6f')](_0x5a5aec,[_0x0065('0x57')]);})[_0x0065('0x76')](function(_0x3e12e1){if(_0x3e12e1['unlock']){rpcDb[_0x0065('0x121')](_0x43e79d);}if(_0x3e12e1[_0x0065('0x49')]){rpcDb[_0x0065('0x88')](_0x43e79d);}throw _[_0x0065('0x6f')](_0x3e12e1,[_0x0065('0x57')]);});};Preview['prototype'][_0x0065('0x120')]=function(_0x333ca3,_0x504232){var _0x2663ea=this;var _0x1f26fa,_0x5cc4e0;return rpcDb[_0x0065('0x122')](_0x333ca3)[_0x0065('0xa1')](function(_0x27ae31){if(!_[_0x0065('0x68')](_0x27ae31[0x0])){_0x5cc4e0=_0x27ae31[0x0][_0x0065('0x123')]?![]:!![];_0x1f26fa=_0x27ae31[0x0][_0x0065('0x123')]?!![]:![];_0x1f26fa=_0x504232?!![]:_0x1f26fa;}var _0x23ae9f=_0x2663ea[_0x0065('0x124')](_0x27ae31);if(_0x23ae9f[_0x0065('0x125')]){rpcDb[_0x0065('0x126')](_['pick'](_0x27ae31[0x0],['VoiceQueueId','phone']))[_0x0065('0xa1')](function(_0x540fd4){_0x2663ea[_0x0065('0x110')](_0x540fd4,_0x27ae31[0x0],_0x504232,_0x5cc4e0,_0x1f26fa)[_0x0065('0xa1')](function(_0x25adcb){return _0x25adcb;})['catch'](function(_0x43cfe5){throw _0x43cfe5;});})[_0x0065('0x76')](function(_0x2b813a){ut[_0x0065('0x59')](_0x0065('0x127'),_0x2b813a);throw ut['message'](_0x0065('0x128'),_0x5cc4e0,_0x1f26fa);});}else{throw ut[_0x0065('0x57')](_0x23ae9f[_0x0065('0x57')],_0x5cc4e0,_0x1f26fa);}})[_0x0065('0x76')](function(_0x2c768b){ut[_0x0065('0x59')](_0x0065('0x129'),_0x2c768b);throw ut['message'](_0x0065('0x128'),![],!![]);});};Preview[_0x0065('0xc')][_0x0065('0x124')]=function(_0x2e42c0){if(_[_0x0065('0x68')](_0x2e42c0)||_[_0x0065('0x114')](_0x2e42c0)||!_[_0x0065('0x68')](_0x2e42c0[0x0][_0x0065('0x84')])&&_[_0x0065('0x68')](_0x2e42c0[0x0][_0x0065('0x84')][_0x0065('0x48')])){ut[_0x0065('0x59')](_0x0065('0x12a'),_0x2e42c0);return{'isValid':![],'message':_0x0065('0x12b')};}var _0x5b0825=this[_0x0065('0x10')][_0x2e42c0[0x0][_0x0065('0x6b')][_0x0065('0x48')]];_0x5b0825[_0x0065('0x57')]='ACTIVE';if(_[_0x0065('0x68')](_0x5b0825)){ut[_0x0065('0x59')](_0x0065('0x12c'),_0x5b0825);return{'isValid':![],'message':_0x0065('0x12d')};}if(!this['isTrunkReachable'](_0x5b0825['Trunk'])){ut['logger'](_0x0065('0x12e'),_0x0065('0x12f')+_0x5b0825[_0x0065('0x48')]+_0x0065('0x130'));if(!this['isTrunkReachable'](_0x5b0825[_0x0065('0x95')])){ut['logger'](_0x0065('0x12e'),_0x5b0825['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x0065('0x131')};}}if(!ut['isActive'](_0x5b0825['dialActive'])){ut[_0x0065('0x59')](_0x0065('0x132'),_0x5b0825[_0x0065('0x48')]+_0x0065('0x133'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5b0825[_0x0065('0x48')]+_0x0065('0x133')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0x5eb57b,_0x3e7855,_0x10109a,_0x5cf9ba){var _0x33af13=this;return new Promise(function(_0x3b8ac2,_0x150134){var _0x28a53f=_0x5eb57b['uniqueid'];var _0x1f1de1=_0x33af13[_0x0065('0x94')](_0x3e7855[_0x0065('0x47')])?util[_0x0065('0x52')]('SIP/%s/%s%s',_0x3e7855[_0x0065('0x47')][_0x0065('0x48')],_[_0x0065('0x68')](_0x3e7855[_0x0065('0x2e')])?'':_0x3e7855['dialPrefix'][_0x0065('0x134')]()||'',_0x3e7855['dialCutDigit']>0x0?_0x10109a[_0x0065('0x111')][_0x0065('0x135')](_0x3e7855[_0x0065('0x136')]):_0x10109a[_0x0065('0x111')]):util[_0x0065('0x52')](_0x0065('0x137'),_[_0x0065('0x68')](_0x3e7855['TrunkBackup'])?_0x3e7855['Trunk'][_0x0065('0x48')]:_0x3e7855[_0x0065('0x95')][_0x0065('0x48')],_[_0x0065('0x68')](_0x3e7855[_0x0065('0x2e')])?'':_0x3e7855[_0x0065('0x2e')][_0x0065('0x134')]()||'',_0x3e7855[_0x0065('0x136')]>0x0?_0x10109a[_0x0065('0x111')][_0x0065('0x135')](_0x3e7855[_0x0065('0x136')]):_0x10109a[_0x0065('0x111')]);var _0x5971e4=_0x33af13[_0x0065('0x94')](_0x3e7855[_0x0065('0x47')])?ut['getCallerId'](_0x3e7855[_0x0065('0x47')][_0x0065('0x4a')],_0x3e7855[_0x0065('0x138')],_0x3e7855[_0x0065('0x139')]>0x0?ut['getCallerIdRandom'](_0x3e7855[_0x0065('0x13a')],_0x3e7855['dialRandomLastDigitCallerIdNumber']):_0x3e7855['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x0065('0x68')](_0x3e7855['TrunkBackup'])?_0x3e7855['Trunk'][_0x0065('0x4a')]:_0x3e7855[_0x0065('0x95')][_0x0065('0x4a')],_0x3e7855['dialOriginateCallerIdName'],_0x3e7855[_0x0065('0x139')]>0x0?ut[_0x0065('0x13b')](_0x3e7855[_0x0065('0x13a')],_0x3e7855[_0x0065('0x139')]):_0x3e7855[_0x0065('0x13a')]);if(_0x5971e4){_0x5eb57b['originatecalleridname']=ut['extractCalleridName'](_0x5971e4);_0x5eb57b['originatecalleridnum']=ut[_0x0065('0x13c')](_0x5971e4);}var _0x28fa8a=ut[_0x0065('0x13d')](_0x3e7855,_0x10109a,_0x1f1de1,_0x5971e4,_0x28a53f,_0x5eb57b);_[_0x0065('0x13e')](_0x5eb57b,ut[_0x0065('0x13f')](_0x28fa8a));_0x5eb57b['starttime']=moment()[_0x0065('0x52')](_0x0065('0xad'));_0x3e7855[_0x0065('0x140')]=_0x28fa8a;ami['Action'](ut[_0x0065('0x141')](_0x5eb57b,_0x3e7855,_0x28fa8a,_0x5eb57b[_0x0065('0xa9')],_0x5cf9ba))[_0x0065('0xa1')](function(_0x6eabd){_0x3e7855['originated']+=0x1;logger[_0x0065('0x50')](_0x0065('0x142'),_0x28a53f,_0x0065('0xb1'),_0x3e7855['name'],'originated:\x20',_0x3e7855[_0x0065('0x55')]);_0x3b8ac2(_0x6eabd);})[_0x0065('0x76')](function(_0xdfb6fc){ut[_0x0065('0x103')](_0x5eb57b,0xe,_0x0065('0x143'));rpcDb[_0x0065('0x105')](_0x5eb57b,_0x0065('0x144'));_0x150134(_0xdfb6fc);});});};Preview[_0x0065('0xc')][_0x0065('0x1a')]=function(_0x5c24aa){if(this[_0x0065('0x69')][_0x5c24aa[_0x0065('0xf6')]]){this[_0x0065('0x69')][_0x5c24aa[_0x0065('0xf6')]]['channel']=_0x5c24aa[_0x0065('0x75')];}};Preview['prototype'][_0x0065('0x13')]=function(_0x4bd130){var _0x2ec287=this;var _0x41f61f=this[_0x0065('0x69')][_0x4bd130['actionid']];if(_0x41f61f){if(_0x41f61f[_0x0065('0x113')]&&this[_0x0065('0x12')][_0x41f61f[_0x0065('0x113')]]){ut[_0x0065('0x145')](_0x41f61f,this[_0x0065('0x12')][_0x41f61f[_0x0065('0x113')]][_0x0065('0x48')],this['agents'][_0x41f61f[_0x0065('0x113')]]['id']);}var _0x54761d=_[_0x0065('0x146')](_0x41f61f);_0x54761d[_0x0065('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x331a03=_0x2ec287[_0x0065('0x10')][_0x41f61f[_0x0065('0x6c')]];if(ut[_0x0065('0x147')](_0x4bd130[_0x0065('0x148')])){if(_0x41f61f['unlockAgent']){rpcDb[_0x0065('0x121')](_0x41f61f[_0x0065('0xab')]);}if(_0x41f61f[_0x0065('0xa9')]){rpcDb['disableContact'](_0x41f61f['idContact']);}ami[_0x0065('0x53')](_0x0065('0x149'),ut['buildObj'](_0x41f61f,_0x0065('0x14a'),this[_0x0065('0x10')][_0x41f61f[_0x0065('0x6c')]]));this[_0x0065('0xff')](_0x54761d,_0x331a03,_0x4bd130);}else{_0x41f61f['starttime']=moment()[_0x0065('0x52')](_0x0065('0xad'));ut[_0x0065('0x103')](_0x54761d,0x4,_0x0065('0xbb'));rpcDb[_0x0065('0x105')](_0x54761d,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x0065('0xc')][_0x0065('0x14')]=function(_0x145718){var _0x1033c5=this['actions'][_0x145718['linkedid']];var _0x352712;if(_0x1033c5){_0x352712=this[_0x0065('0x10')][_0x1033c5[_0x0065('0x6c')]];logger[_0x0065('0x50')](_0x0065('0x14b'),_0x145718['linkedid'],_0x0065('0xb1'),_0x352712[_0x0065('0x48')],_0x0065('0x6d'),_0x352712[_0x0065('0x25')]);}if(this[_0x0065('0x69')][_0x145718[_0x0065('0xf6')]]&&_0x145718['linkedid']!==_0x145718[_0x0065('0xfd')]){if(_0x145718[_0x0065('0x14c')]==='16'&&this['actions'][_0x145718[_0x0065('0xf6')]][_0x0065('0x6e')]){this[_0x0065('0x97')](_0x145718,_0x145718[_0x0065('0xf6')],_0x145718[_0x0065('0x14c')]);}else if(this[_0x0065('0x69')][_0x145718['linkedid']][_0x0065('0x6e')]){logger[_0x0065('0x50')]('[syncHangup][talking][cause]',_0x145718['linkedid'],_0x145718[_0x0065('0x14c')],_0x0065('0xb1'),_0x352712[_0x0065('0x48')],_0x0065('0x6d'),_0x352712['pTalking']);this[_0x0065('0x97')](_0x145718,_0x145718[_0x0065('0xf6')],_0x145718['cause']);}}else if(_0x1033c5&&_[_0x0065('0x68')](_0x1033c5[_0x0065('0x14d')])&&_0x352712[_0x0065('0x14e')]&&_0x145718[_0x0065('0xf6')]===_0x145718[_0x0065('0xfd')]&&_[_0x0065('0x68')](_0x145718['reason'])&&_0x145718[_0x0065('0x14c')]==='16'&&_0x145718['channelstate']==='6'&&_[_0x0065('0x100')](_0x1033c5[_0x0065('0x14f')])){if(_0x1033c5['unlockAgent']){rpcDb['unlockContact'](_0x1033c5[_0x0065('0xab')]);}if(_0x1033c5[_0x0065('0xa9')]){rpcDb['disableContact'](_0x1033c5['idContact']);}_0x145718[_0x0065('0x102')]='22';this[_0x0065('0xff')](_0x1033c5,_0x352712,_0x145718);}else if(_0x1033c5&&_0x1033c5[_0x0065('0x14f')]){if(_0x145718[_0x0065('0x14c')]==='16'&&this[_0x0065('0x69')][_0x145718[_0x0065('0xf6')]][_0x0065('0x6e')]){logger[_0x0065('0x50')](_0x0065('0x150'),_0x145718['linkedid'],_0x145718[_0x0065('0x14c')],'\x20Queue',_0x352712[_0x0065('0x48')],_0x0065('0x6d'),_0x352712['pTalking']);this['callProgressDetectingCustomer'](_0x145718,_0x145718[_0x0065('0xf6')],_0x145718[_0x0065('0x14c')]);}else if(this[_0x0065('0x69')][_0x145718[_0x0065('0xf6')]]['dialAnswer']){logger[_0x0065('0x50')](_0x0065('0x151'),_0x145718[_0x0065('0xf6')],_0x145718[_0x0065('0x14c')],_0x0065('0xb1'),_0x352712[_0x0065('0x48')],_0x0065('0x6d'),_0x352712[_0x0065('0x25')]);this[_0x0065('0x97')](_0x145718,_0x145718[_0x0065('0xf6')],_0x145718['cause']);}}};Preview['prototype'][_0x0065('0x18')]=function(_0x1de92b){if(this[_0x0065('0x69')][_0x1de92b[_0x0065('0xfe')]]&&_0x1de92b[_0x0065('0xfe')]!==_0x1de92b[_0x0065('0x152')]){this[_0x0065('0x97')](_0x1de92b,_0x1de92b[_0x0065('0xfe')],_0x1de92b[_0x0065('0xf3')]);}};Preview[_0x0065('0xc')][_0x0065('0x153')]=function(_0x5b8441){if(this[_0x0065('0x69')][_0x5b8441['linkedid']]&&_0x5b8441['linkedid']!==_0x5b8441['uniqueid']&&!this[_0x0065('0x69')][_0x5b8441[_0x0065('0xf6')]][_0x0065('0x6e')]){if(_0x5b8441['cause']==='1'){this[_0x0065('0x97')](_0x5b8441,_0x5b8441['linkedid'],_0x5b8441[_0x0065('0x14c')]);}}};Preview[_0x0065('0xc')][_0x0065('0x154')]=function(_0x28aa82,_0x29c48e,_0x3b46fb){if(this[_0x0065('0x69')][_0x28aa82]){if(_[_0x0065('0x68')](this[_0x0065('0x69')][_0x28aa82][_0x0065('0x140')])){this[_0x0065('0x69')][_0x28aa82]['variables']={};}this[_0x0065('0x69')][_0x28aa82][_0x0065('0x140')][_0x29c48e]=_0x3b46fb;}};Preview[_0x0065('0xc')][_0x0065('0x155')]=function(_0x8b72c2){try{if(!_['isNil'](_0x8b72c2)){if(ut['filterKey'](_[_0x0065('0x156')](_0x8b72c2[_0x0065('0x157')])[0x0])){this[_0x0065('0x154')](_0x8b72c2[_0x0065('0xfd')],_[_0x0065('0x156')](_0x8b72c2['variable'])[0x0],_0x8b72c2['value']);}}}catch(_0x279580){logger[_0x0065('0x158')]('[syncVarSet][Preview]',util[_0x0065('0x159')](_0x279580,{'showHidden':![],'depth':null}));}};Preview[_0x0065('0xc')][_0x0065('0x15a')]=function(_0x108c81){if(_0x108c81){if(this[_0x0065('0x69')][_0x108c81[_0x0065('0x15b')]]){this[_0x0065('0x69')][_0x108c81[_0x0065('0x15b')]][_0x0065('0x14f')]=!![];}}};Preview[_0x0065('0xc')][_0x0065('0x1e')]=function(_0x1f4c6c){if(_0x1f4c6c){if(this[_0x0065('0x69')][_0x1f4c6c[_0x0065('0x15c')]]){this[_0x0065('0x69')][_0x1f4c6c['transfererlinkedid']][_0x0065('0x14f')]=!![];}}};module[_0x0065('0x15d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index dd34b2e..3ae09ef 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 _0xc3f5=['create','getContactRecallMe','rescheduleContactInQueue','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','then','catch','resolve','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED'];(function(_0xdc8025,_0x210eab){var _0x4cc260=function(_0x114c0f){while(--_0x114c0f){_0xdc8025['push'](_0xdc8025['shift']());}};_0x4cc260(++_0x210eab);}(_0xc3f5,0xdb));var _0x5c3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc3f5[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x5c3f('0x0'));var BPromise=require(_0x5c3f('0x1'));var logger=require('../../../config/logger')(_0x5c3f('0x2'));var _=require('lodash');var cmHopper=require(_0x5c3f('0x3'));var cmHopperFinal=require(_0x5c3f('0x4'));var cmHopperHistory=require(_0x5c3f('0x5'));var cmHopperBlack=require(_0x5c3f('0x6'));var voiceQueueRt=require(_0x5c3f('0x7'));var agentReportPreview=require(_0x5c3f('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x488e7f){return function(_0x1b2ce9){logger[_0x5c3f('0x9')](_0x488e7f,util['inspect'](_0x1b2ce9,{'showHidden':![],'depth':null}));};}function create(_0x2d5c4c){return BPromise['resolve']()[_0x5c3f('0xa')](cmHopperHistory['createHistory'](_0x2d5c4c))[_0x5c3f('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x38d7a5){return BPromise[_0x5c3f('0xc')]()[_0x5c3f('0xa')](agentReportPreview['createHistory'](_0x38d7a5))['catch'](loggerCatch(_0x5c3f('0xd')));}function moveContact(_0x151300){return BPromise[_0x5c3f('0xc')]()[_0x5c3f('0xa')](cmHopper['moveContactManagedDialer'](_0x151300,!![]))[_0x5c3f('0xb')](loggerCatch(_0x5c3f('0xe')));}exports[_0x5c3f('0xf')]=function(_0x46a251){return BPromise[_0x5c3f('0xc')]()[_0x5c3f('0xa')](cmHopperBlack[_0x5c3f('0xf')](_0x46a251))[_0x5c3f('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x5c3f('0x10')]=function(_0xe42a21){return BPromise[_0x5c3f('0xc')]()['then'](cmHopper[_0x5c3f('0x10')](_0xe42a21))[_0x5c3f('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0x5c3f('0x11')]=function(_0x1499d4,_0x285ef1){create(_0x1499d4)[_0x5c3f('0xb')](loggerCatch(_0x285ef1));moveContact(_0x1499d4)[_0x5c3f('0xb')](loggerCatch(_0x285ef1));};exports[_0x5c3f('0x12')]=function(_0x354071,_0x5647a0){createAgent(_0x354071)[_0x5c3f('0xb')](loggerCatch(_0x5647a0));};exports[_0x5c3f('0x13')]=function(_0x5d136f,_0x847f71){create(_0x5d136f)[_0x5c3f('0xb')](loggerCatch(_0x847f71));};exports[_0x5c3f('0x14')]=function(_0x548c72,_0x247e27){moveContact(_0x548c72)['catch'](loggerCatch(_0x247e27));};exports[_0x5c3f('0x15')]=function(_0x451547,_0x5385a4,_0xc4f1fd){if(_0x5385a4){_0x451547[_0x5c3f('0x16')]=null;}if(_0xc4f1fd){_0x451547[_0x5c3f('0x17')]=![];}return BPromise['resolve']()[_0x5c3f('0xa')](cmHopper[_0x5c3f('0x15')](_0x451547))[_0x5c3f('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x5c3f('0x18')]=function(_0x243783){return BPromise['resolve']()[_0x5c3f('0xa')](cmHopper[_0x5c3f('0x18')](_0x243783))[_0x5c3f('0xb')](loggerCatch(_0x5c3f('0x19')));};exports[_0x5c3f('0x1a')]=function(_0x4fc464){return BPromise['resolve']()[_0x5c3f('0xa')](cmHopper[_0x5c3f('0x1a')]({'UserId':null},_0x4fc464,0x1))[_0x5c3f('0xb')](loggerCatch(_0x5c3f('0x1b')));};exports[_0x5c3f('0x1c')]=function(_0xbdfc26){return BPromise[_0x5c3f('0xc')]()[_0x5c3f('0xa')](cmHopper[_0x5c3f('0x1a')]({'active':![]},_0xbdfc26,0x1))[_0x5c3f('0xb')](loggerCatch(_0x5c3f('0x1d')));};exports[_0x5c3f('0x1e')]=function(_0x82ef9a){var _0x3ca9dd={};_0x3ca9dd['type']=_0x82ef9a[_0x5c3f('0x1f')];_0x3ca9dd[_0x5c3f('0x20')]=_0x82ef9a[_0x5c3f('0x20')];_0x3ca9dd[_0x5c3f('0x21')]=_0x82ef9a[_0x5c3f('0x21')];_0x3ca9dd[_0x5c3f('0x22')]=_0x82ef9a['calleridname'];_0x3ca9dd[_0x5c3f('0x23')]=_0x82ef9a[_0x5c3f('0x23')];_0x3ca9dd[_0x5c3f('0x24')]=_0x82ef9a[_0x5c3f('0x25')];_0x3ca9dd['queuecallerleaveAt']=_0x82ef9a[_0x5c3f('0x25')];_0x3ca9dd[_0x5c3f('0x26')]=0x1;_0x3ca9dd[_0x5c3f('0x27')]=_0x82ef9a[_0x5c3f('0x28')];_0x3ca9dd[_0x5c3f('0x29')]=_0x82ef9a[_0x5c3f('0x2a')];_0x3ca9dd[_0x5c3f('0x2b')]=_0x5c3f('0x2c');_0x3ca9dd[_0x5c3f('0x2d')]='xcally-motion-preview';_0x3ca9dd[_0x5c3f('0x2e')]=0x0;_0x3ca9dd[_0x5c3f('0x2f')]=0x1;_0x3ca9dd[_0x5c3f('0x30')]=_0x82ef9a[_0x5c3f('0x2a')];_0x3ca9dd[_0x5c3f('0x31')]=_0x5c3f('0x32');return BPromise['resolve']()[_0x5c3f('0xa')](voiceQueueReport[_0x5c3f('0x33')](_0x3ca9dd))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x5c3f('0x34')]=function(_0x1ccb4f,_0x235cd9){return BPromise[_0x5c3f('0xc')]()[_0x5c3f('0xa')](cmHopper[_0x5c3f('0x34')](_0x1ccb4f,_0x235cd9))[_0x5c3f('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x5c3f('0x35')]=function(_0x5bb8bd){return BPromise[_0x5c3f('0xc')]()[_0x5c3f('0xa')](cmHopper[_0x5c3f('0x15')](_0x5bb8bd,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x9ac6=['createHistory','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9ac6,0x1a3));var _0x69ac=function(_0x18241e,_0x544d72){_0x18241e=_0x18241e-0x0;var _0x2233da=_0x9ac6[_0x18241e];return _0x2233da;};'use strict';var util=require(_0x69ac('0x0'));var BPromise=require(_0x69ac('0x1'));var logger=require(_0x69ac('0x2'))(_0x69ac('0x3'));var _=require('lodash');var cmHopper=require(_0x69ac('0x4'));var cmHopperFinal=require(_0x69ac('0x5'));var cmHopperHistory=require(_0x69ac('0x6'));var cmHopperBlack=require(_0x69ac('0x7'));var voiceQueueRt=require(_0x69ac('0x8'));var agentReportPreview=require(_0x69ac('0x9'));var voiceQueueReport=require(_0x69ac('0xa'));function loggerCatch(_0x92039a){return function(_0x55716d){logger[_0x69ac('0xb')](_0x92039a,util[_0x69ac('0xc')](_0x55716d,{'showHidden':![],'depth':null}));};}function create(_0xa9b55a){return BPromise[_0x69ac('0xd')]()[_0x69ac('0xe')](cmHopperHistory[_0x69ac('0xf')](_0xa9b55a))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x35f1e0){return BPromise['resolve']()[_0x69ac('0xe')](agentReportPreview[_0x69ac('0xf')](_0x35f1e0))['catch'](loggerCatch(_0x69ac('0x10')));}function moveContact(_0x5348f6){return BPromise[_0x69ac('0xd')]()[_0x69ac('0xe')](cmHopper[_0x69ac('0x11')](_0x5348f6,!![]))[_0x69ac('0x12')](loggerCatch(_0x69ac('0x13')));}exports[_0x69ac('0x14')]=function(_0x3b39a9){return BPromise[_0x69ac('0xd')]()[_0x69ac('0xe')](cmHopperBlack[_0x69ac('0x14')](_0x3b39a9))[_0x69ac('0x12')](loggerCatch(_0x69ac('0x15')));};exports[_0x69ac('0x16')]=function(_0x3745fe){return BPromise[_0x69ac('0xd')]()['then'](cmHopper[_0x69ac('0x16')](_0x3745fe))[_0x69ac('0x12')](loggerCatch(_0x69ac('0x17')));};exports[_0x69ac('0xf')]=function(_0x440dcc,_0x594744){create(_0x440dcc)['catch'](loggerCatch(_0x594744));moveContact(_0x440dcc)[_0x69ac('0x12')](loggerCatch(_0x594744));};exports[_0x69ac('0x18')]=function(_0x51ea59,_0x2ab349){createAgent(_0x51ea59)[_0x69ac('0x12')](loggerCatch(_0x2ab349));};exports[_0x69ac('0x19')]=function(_0x46e0e1,_0x19aacf){create(_0x46e0e1)[_0x69ac('0x12')](loggerCatch(_0x19aacf));};exports[_0x69ac('0x1a')]=function(_0x4be8fe,_0x46620b){moveContact(_0x4be8fe)['catch'](loggerCatch(_0x46620b));};exports['rescheduleContact']=function(_0x54a7d3,_0x193b74,_0x3340ea){if(_0x193b74){_0x54a7d3['UserId']=null;}if(_0x3340ea){_0x54a7d3[_0x69ac('0x1b')]=![];}return BPromise[_0x69ac('0xd')]()[_0x69ac('0xe')](cmHopper[_0x69ac('0x1c')](_0x54a7d3))['catch'](loggerCatch(_0x69ac('0x1d')));};exports[_0x69ac('0x1e')]=function(_0x2a7cc5){return BPromise[_0x69ac('0xd')]()['then'](cmHopper['countReScheduled'](_0x2a7cc5))[_0x69ac('0x12')](loggerCatch(_0x69ac('0x1f')));};exports[_0x69ac('0x20')]=function(_0x2767c6){return BPromise['resolve']()['then'](cmHopper[_0x69ac('0x20')]({'UserId':null},_0x2767c6,0x1))['catch'](loggerCatch(_0x69ac('0x21')));};exports[_0x69ac('0x22')]=function(_0x1b3ada){return BPromise[_0x69ac('0xd')]()[_0x69ac('0xe')](cmHopper[_0x69ac('0x20')]({'active':![]},_0x1b3ada,0x1))[_0x69ac('0x12')](loggerCatch('[activeContact]\x20'));};exports[_0x69ac('0x23')]=function(_0x311d41){var _0x450c1a={};_0x450c1a[_0x69ac('0x24')]=_0x311d41['type'];_0x450c1a['uniqueid']=_0x311d41[_0x69ac('0x25')];_0x450c1a[_0x69ac('0x26')]=_0x311d41[_0x69ac('0x26')];_0x450c1a['calleridname']=_0x311d41[_0x69ac('0x27')];_0x450c1a[_0x69ac('0x28')]=_0x311d41[_0x69ac('0x28')];_0x450c1a[_0x69ac('0x29')]=_0x311d41[_0x69ac('0x2a')];_0x450c1a[_0x69ac('0x2b')]=_0x311d41[_0x69ac('0x2a')];_0x450c1a[_0x69ac('0x2c')]=0x1;_0x450c1a['queuecallercompleteAt']=_0x311d41[_0x69ac('0x2d')];_0x450c1a[_0x69ac('0x2e')]=_0x311d41[_0x69ac('0x2f')];_0x450c1a[_0x69ac('0x30')]='from-sip';_0x450c1a[_0x69ac('0x31')]=_0x69ac('0x32');_0x450c1a[_0x69ac('0x33')]=0x0;_0x450c1a[_0x69ac('0x34')]=0x1;_0x450c1a[_0x69ac('0x35')]=_0x311d41[_0x69ac('0x2f')];_0x450c1a[_0x69ac('0x36')]=_0x69ac('0x37');return BPromise[_0x69ac('0xd')]()[_0x69ac('0xe')](voiceQueueReport[_0x69ac('0x38')](_0x450c1a))['catch'](loggerCatch(_0x69ac('0x39')));};exports[_0x69ac('0x3a')]=function(_0x91a206,_0x1e3cc8){return BPromise[_0x69ac('0xd')]()[_0x69ac('0xe')](cmHopper[_0x69ac('0x3a')](_0x91a206,_0x1e3cc8))['catch'](loggerCatch(_0x69ac('0x3b')));};exports[_0x69ac('0x3c')]=function(_0x1050be){return BPromise['resolve']()[_0x69ac('0xe')](cmHopper[_0x69ac('0x1c')](_0x1050be,!![],!![]))[_0x69ac('0x12')](loggerCatch(_0x69ac('0x3d')));}; \ 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 0f7cf7b..788efa2 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 _0xbbbb=['%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','motionChannel','buildObj','buildAcw','agentReadyId','not_inuse','getDiff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','calleridname','countcongestionretry','countglobal','callback','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqoslossbridged','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','noanswer','variables','keys','toLowerCase','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt'];(function(_0x520184,_0x516807){var _0x12e8fc=function(_0x21ba10){while(--_0x21ba10){_0x520184['push'](_0x520184['shift']());}};_0x12e8fc(++_0x516807);}(_0xbbbb,0xf4));var _0xbbbb=function(_0x12f22a,_0x38073a){_0x12f22a=_0x12f22a-0x0;var _0x255685=_0xbbbb[_0x12f22a];return _0x255685;};'use strict';var util=require(_0xbbbb('0x0'));var _=require(_0xbbbb('0x1'));var moment=require(_0xbbbb('0x2'));var logger=require(_0xbbbb('0x3'))('preview');var ipAgi=process['env'][_0xbbbb('0x4')]||_0xbbbb('0x5');function getSeconds(_0x2ffd2f,_0x28a671){var _0x574cd1=moment(_0x2ffd2f)[_0xbbbb('0x6')](0x0);var _0x9dc91e=moment(_0x28a671)['milliseconds'](0x0);return _0x574cd1[_0xbbbb('0x7')](_0x9dc91e,_0xbbbb('0x8'));}exports[_0xbbbb('0x9')]=function(_0x41ef7a){return function(_0x484f47){logger[_0xbbbb('0xa')](_0x41ef7a,util[_0xbbbb('0xb')](_0x484f47,{'showHidden':![],'depth':null}));};};exports[_0xbbbb('0xc')]=function(_0x1bfce0,_0x166edf){logger[_0xbbbb('0xd')](_0x1bfce0,util[_0xbbbb('0xb')](_0x166edf,{'showHidden':![],'depth':null}));};exports[_0xbbbb('0xe')]=function(_0x4530de,_0x452b23){logger['error'](_0x4530de,util[_0xbbbb('0xb')](_0x452b23,{'showHidden':![],'depth':null}));};exports[_0xbbbb('0xf')]=function(_0x364529){return function(_0x572b7b){logger[_0xbbbb('0xd')](_0x364529,util['inspect'](_0x572b7b,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x499f34,_0x320fac,_0x495f41){return{'message':_0x499f34,'unlock':_0x320fac,'active':_0x495f41};};exports['getCallerId']=function(_0x3d9100,_0x45a286,_0x27c5ec){if(!_[_0xbbbb('0x10')](_0x27c5ec)&&_0xbbbb('0x11')===typeof _0x27c5ec&&!_[_0xbbbb('0x12')](_0x27c5ec)){if(!_[_0xbbbb('0x10')](_0x45a286)&&_0xbbbb('0x11')===typeof _0x45a286&&!_[_0xbbbb('0x12')](_0x45a286)){return util['format']('\x22%s\x22\x20<%s>',_0x45a286,_0x27c5ec);}return util[_0xbbbb('0x13')](_0xbbbb('0x14'),_0x27c5ec,_0x27c5ec);}if(!_[_0xbbbb('0x10')](_0x3d9100)&&_0xbbbb('0x11')===typeof _0x3d9100&&!_[_0xbbbb('0x12')](_0x3d9100)){return _0x3d9100;}return _0xbbbb('0x15');};exports[_0xbbbb('0x16')]=function(_0x239e40){if(_[_0xbbbb('0x17')](_0x239e40)){return![];}return _0x239e40;};exports[_0xbbbb('0x18')]=function(_0x3f45b0,_0x478c9a,_0x50ce5e,_0x51b846,_0x35daad,_0x52e0b2){var _0x3677e4={'XMD-QUEUE':_0x478c9a[_0xbbbb('0x19')]?_0x478c9a[_0xbbbb('0x19')][_0xbbbb('0x1a')]:'','XMD-CALLERID':_0x51b846,'XMD-CALLERID-PREVIEW':_0x52e0b2?util[_0xbbbb('0x13')](_0xbbbb('0x14'),_0x52e0b2['calleridname'],_0x52e0b2[_0xbbbb('0x1b')]):_0x51b846,'XMD-DIALID':_0x35daad,'XMD-CONTACTID':_0x478c9a[_0xbbbb('0x1c')],'XMD-CDRTYPE':_0xbbbb('0x1d'),'CALLERID(all)':_0x51b846,'XMD-VOICEQUEUEID':_0x478c9a['VoiceQueueId'],'XMD-DIALCHANNEL':_0x50ce5e,'XMD-DIALTIMEOUT':_0x3f45b0[_0xbbbb('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xbbbb('0x13')]('\x22rtTxX%s%s\x22',_0x3f45b0[_0xbbbb('0x1f')]?'g':'',_[_0xbbbb('0x12')](_0x3f45b0[_0xbbbb('0x20')])?'':_0xbbbb('0x21')),'XMD-DIALURL':_0x3f45b0[_0xbbbb('0x22')]||'','XMD-AGI':_0x3f45b0[_0xbbbb('0x23')]?util['format'](_0xbbbb('0x24'),ipAgi,_0x3f45b0[_0xbbbb('0x23')]):'NONE','XMD-AGIAFTER':_0x3f45b0[_0xbbbb('0x1f')]?util[_0xbbbb('0x13')](_0xbbbb('0x24'),ipAgi,_0x3f45b0['dialQueueProject2']):_0xbbbb('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x52e0b2?_0x52e0b2[_0xbbbb('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x52e0b2?_0x52e0b2['originatecalleridname']:'','XMD-DESTINATION':_0xbbbb('0x27'),'SIPADDHEADER':_0xbbbb('0x28')};if(!_['isEmpty'](_0x3f45b0[_0xbbbb('0x20')])){_0x3677e4[util['format']('%s',_0xbbbb('0x29'))]=_0x3f45b0[_0xbbbb('0x20')];_0x3677e4[util[_0xbbbb('0x13')]('%s',_0xbbbb('0x2a'))]=_0x35daad;}if(_0x478c9a&&_0x478c9a[_0xbbbb('0x2b')]){for(var _0x36ff12 in _0x478c9a[_0xbbbb('0x2b')]){if(_0x478c9a[_0xbbbb('0x2b')][_0xbbbb('0x2c')](_0x36ff12)){if(!_['isNil'](_0x478c9a[_0xbbbb('0x2b')][_0x36ff12])&&_0x36ff12!=='id'&&_0x36ff12!==_0xbbbb('0x2d')&&_0x36ff12!==_0xbbbb('0x2e')&&_0x36ff12!==_0xbbbb('0x2f')){_0x3677e4[util[_0xbbbb('0x13')](_0xbbbb('0x30'),_0xbbbb('0x31'),_[_0xbbbb('0x32')](_0x36ff12))]=_0x478c9a[_0xbbbb('0x2b')][_0x36ff12];}}}}return _0x3677e4;};exports[_0xbbbb('0x33')]=function(_0x41cb9a){var _0xb74cb7={};for(var _0x44f8dc in _0x41cb9a){if(_0x41cb9a['hasOwnProperty'](_0x44f8dc)){_0xb74cb7[util['format']('%s',_[_0xbbbb('0x34')](_0x44f8dc))]=_0x41cb9a[_0x44f8dc];}}return{'variables':_0xb74cb7};};exports[_0xbbbb('0x35')]=function(_0x58eaa4,_0x4e67bd){if(!_[_0xbbbb('0x17')](_0x58eaa4)){if(_0x58eaa4[_0xbbbb('0x2c')](_0xbbbb('0x36'))){if(_0x58eaa4['originated']>0x0){_0x58eaa4['originated']-=0x1;}else{logger[_0xbbbb('0xa')](_0xbbbb('0x37'),_0x4e67bd);}}}else{logger[_0xbbbb('0xa')](_0xbbbb('0x38'),_0x4e67bd);}};exports[_0xbbbb('0x39')]=function(_0x31c23f){var _0x578020=moment()['format'](_0xbbbb('0x3a'));_0x31c23f[_0xbbbb('0x3b')]=0xd;_0x31c23f[_0xbbbb('0x3c')]='Blacklist';_0x31c23f[_0xbbbb('0x3d')]=_0x578020;_0x31c23f[_0xbbbb('0x3e')]=_0x578020;_0x31c23f[_0xbbbb('0x3f')]=_0x578020;};exports[_0xbbbb('0x40')]=function(_0x3c05b5,_0x3ba78e,_0x5d23d3){var _0x27c16c=moment()[_0xbbbb('0x13')](_0xbbbb('0x3a'));_0x3c05b5[_0xbbbb('0x3b')]=_0x3ba78e;_0x3c05b5[_0xbbbb('0x3c')]=_0x5d23d3;_0x3c05b5['responsetime']=_0x27c16c;_0x3c05b5[_0xbbbb('0x41')]=getSeconds(_0x3c05b5['responsetime'],_0x3c05b5[_0xbbbb('0x3d')]);};exports[_0xbbbb('0x42')]=function(_0x566e37,_0x237f1e,_0x44409d){_0x566e37[_0xbbbb('0x43')]=_0x237f1e;_0x566e37[_0xbbbb('0x44')]=_0x44409d;};exports[_0xbbbb('0x45')]=function(_0x50f335,_0x1dd54e,_0x507d16){var _0x21db12=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x50f335[_0xbbbb('0x3b')]=_0x1dd54e;_0x50f335[_0xbbbb('0x3c')]=_0x507d16;_0x50f335[_0xbbbb('0x3e')]=_0x50f335[_0xbbbb('0x3e')]?_0x50f335[_0xbbbb('0x3e')]:_0x21db12;_0x50f335[_0xbbbb('0x3f')]=_0x50f335[_0xbbbb('0x3f')]?_0x50f335['endtime']:_0x21db12;_0x50f335[_0xbbbb('0x41')]=getSeconds(_0x50f335[_0xbbbb('0x3e')]||0x0,_0x50f335[_0xbbbb('0x3d')]||0x0);_0x50f335[_0xbbbb('0x46')]=_0x50f335[_0xbbbb('0x47')]?getSeconds(_0x50f335['endtime'],_0x50f335[_0xbbbb('0x47')]):0x0;};exports[_0xbbbb('0x48')]=function(_0x53ed63){return _0x53ed63===_0xbbbb('0x49');};exports['variablesAction']=function(_0x5f1568,_0x4ba0e7,_0x4ed627,_0x10f8a3,_0x1b9463){var _0x1ff731=_0x10f8a3?'RECALL':_0x5f1568['calleridname'];_0x1ff731=_0x1b9463?'BOOKED':_0x1ff731;return{'actionid':_0x5f1568[_0xbbbb('0x4a')],'action':_0xbbbb('0x4b'),'channel':_0x5f1568[_0xbbbb('0x4c')],'callerid':util[_0xbbbb('0x13')](_0xbbbb('0x14'),_0x1ff731,_0x5f1568['calleridnum']),'Exten':_0xbbbb('0x27'),'Context':_0xbbbb('0x4d'),'Priority':'1','variable':_0x4ed627,'timeout':(_0x4ba0e7[_0xbbbb('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5f1568['uniqueid']};};exports[_0xbbbb('0x4f')]=function(_0x1e9262){return _0x1e9262[_0xbbbb('0x50')]+_0x1e9262['countcongestionretry']+_0x1e9262[_0xbbbb('0x51')]+_0x1e9262['countagentrejectretry']+_0x1e9262[_0xbbbb('0x52')];};exports[_0xbbbb('0x53')]=function(_0x10e160){var _0x29d7eb=_[_0xbbbb('0x54')](_0x10e160);_0x29d7eb[_0xbbbb('0x3b')]=0xf;_0x29d7eb['statedesc']=_0xbbbb('0x55');return _0x29d7eb;};exports[_0xbbbb('0x56')]=function(_0x1f90da,_0x5eb202,_0x2c59fb){var _0x5e29bb={};_0x5e29bb[_0x5eb202]=_0x1f90da[_0x5eb202];_0x5e29bb[_0xbbbb('0x57')]=![];_0x5e29bb[_0xbbbb('0x58')]=moment()[_0xbbbb('0x59')](_0x2c59fb,_0xbbbb('0x5a'))[_0xbbbb('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e29bb[_0xbbbb('0x1c')]=_0x1f90da[_0xbbbb('0x1c')];_0x5e29bb[_0xbbbb('0x5b')]=_0x1f90da[_0xbbbb('0x5b')];_0x5e29bb['VoiceQueueId']=_0x1f90da[_0xbbbb('0x5c')]||undefined;return _0x5e29bb;};exports[_0xbbbb('0x5d')]=function(_0x2f3ac6,_0x13cf8a){if(!_[_0xbbbb('0x17')](_0x2f3ac6)){if(_0x2f3ac6['pTalking']>0x0){_0x2f3ac6[_0xbbbb('0x5e')]-=0x1;}else{logger[_0xbbbb('0xa')](_0x13cf8a,_0xbbbb('0x5f'));}}else{logger[_0xbbbb('0xa')](_0x13cf8a,_0xbbbb('0x60'));}};exports[_0xbbbb('0x61')]=function(_0x4519c3){if(_0x4519c3<=0x0){return!![];}return![];};function buildObj(_0x212e58,_0x3c229d,_0x132f41){_0x212e58[_0xbbbb('0x62')]=_0x3c229d;_0x212e58['name']=_0x212e58[_0xbbbb('0x63')];_0x212e58['interface']=_0x212e58['channelAgent'];_0x212e58[_0xbbbb('0x64')]='voice';if(_0x132f41){_0x212e58['mandatoryDisposition']=_0x132f41['mandatoryDisposition'];}return _0x212e58;}exports[_0xbbbb('0x65')]=buildObj;exports[_0xbbbb('0x66')]=function(_0x4daf33){var _0x14b8d1={};_0x14b8d1['queue']=_0x4daf33[_0xbbbb('0x63')];_0x14b8d1['interface']=_0x4daf33[_0xbbbb('0x4c')];_0x14b8d1[_0xbbbb('0x4a')]=_0x4daf33[_0xbbbb('0x4a')];return _0x14b8d1;};exports[_0xbbbb('0x67')]=function(_0xd6e1fc){var _0x356594=[];for(var _0xcb5aba in _0xd6e1fc){if(_0xd6e1fc['hasOwnProperty'](_0xcb5aba)){if(!_[_0xbbbb('0x17')](_0xd6e1fc[_0xcb5aba])&&_0xd6e1fc[_0xcb5aba][_0xbbbb('0x3b')]===_0xbbbb('0x68')&&_0xd6e1fc[_0xcb5aba]['status']==='reachable'){_0x356594['push'](_0xd6e1fc[_0xcb5aba]['id']);}}}return _0x356594;};exports[_0xbbbb('0x69')]=function(_0x19d482){var _0x4d8c2b=moment()[_0xbbbb('0x6')](0x0);var _0x502cef=moment(_0x19d482)[_0xbbbb('0x6')](0x0);return _0x4d8c2b[_0xbbbb('0x7')](_0x502cef,_0xbbbb('0x8'));};exports[_0xbbbb('0x6a')]=function(_0x5c9cb8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c9cb8[_0xbbbb('0x1c')],'ListId':_0x5c9cb8[_0xbbbb('0x5b')],'VoiceQueueId':_0x5c9cb8[_0xbbbb('0x5c')]||undefined,'CampaignId':_0x5c9cb8['CampaignId']||undefined};};exports[_0xbbbb('0x6b')]=function(_0x550a34){if(_0x550a34===_0xbbbb('0x4a')||_0x550a34===_0xbbbb('0x6c')||_0x550a34===_0xbbbb('0x63')||_0x550a34===_0xbbbb('0x6d')||_0x550a34===_0xbbbb('0x6e')||_0x550a34===_0xbbbb('0x6f')||_0x550a34===_0xbbbb('0x43')||_0x550a34===_0xbbbb('0x4c')||_0x550a34===_0xbbbb('0x70')||_0x550a34===_0xbbbb('0x57')||_0x550a34===_0xbbbb('0x1b')||_0x550a34===_0xbbbb('0x58')||_0x550a34===_0xbbbb('0x50')||_0x550a34===_0xbbbb('0x71')||_0x550a34===_0xbbbb('0x51')||_0x550a34===_0xbbbb('0x72')||_0x550a34===_0xbbbb('0x73')||_0x550a34==='callbackuniqueid'||_0x550a34==='callbackat'||_0x550a34===_0xbbbb('0x74')||_0x550a34===_0xbbbb('0x1c')||_0x550a34==='ListId'||_0x550a34===_0xbbbb('0x44')||_0x550a34==='VoiceQueueId'||_0x550a34===_0xbbbb('0x75')||_0x550a34==='xmd-voicequeueid'||_0x550a34===_0xbbbb('0x76')||_0x550a34===_0xbbbb('0x77')||_0x550a34===_0xbbbb('0x78')||_0x550a34===_0xbbbb('0x79')||_0x550a34===_0xbbbb('0x7a')||_0x550a34===_0xbbbb('0x7b')||_0x550a34===_0xbbbb('0x7c')||_0x550a34===_0xbbbb('0x7d')||_0x550a34===_0xbbbb('0x7e')||_0x550a34===_0xbbbb('0x7f')||_0x550a34==='xmd-callerid'||_0x550a34===_0xbbbb('0x80')||_0x550a34==='xmd-agi'||_0x550a34===_0xbbbb('0x81')||_0x550a34==='rtpaudioqosbridged'||_0x550a34==='rtpaudioqosjitter'||_0x550a34==='rtpaudioqosjitterbridged'||_0x550a34==='rtpaudioqosloss'||_0x550a34===_0xbbbb('0x82')||_0x550a34==='rtpaudioqosrtt'||_0x550a34==='rtpaudioqosrttbridged'||_0x550a34==='rtpaudioqos'||_0x550a34===_0xbbbb('0x83')||_0x550a34===_0xbbbb('0x84')||_0x550a34===_0xbbbb('0x85')||_0x550a34==='rtpaudioqosloss'||_0x550a34===_0xbbbb('0x82')||_0x550a34===_0xbbbb('0x86')||_0x550a34===_0xbbbb('0x87')||_0x550a34==='bridgepeer'||_0x550a34==='bridgepvtcallid'||_0x550a34===_0xbbbb('0x3b')||_0x550a34===_0xbbbb('0x3c')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x33c49a,_0x193a2e){var _0x15f8c2,_0x3d7516,_0x4fd96c;if(_0x193a2e<=0x0){_0x193a2e=0x1;}_0x15f8c2=new RegExp(_0xbbbb('0x88')+_0x193a2e+'}$');_0x3d7516=Math['pow'](0xa,_0x193a2e-0x1);_0x4fd96c=Math[_0xbbbb('0x89')](0xa,_0x193a2e)-0x1;return util[_0xbbbb('0x13')]('%s',_[_0xbbbb('0x8a')](_0x33c49a,_0x15f8c2,_[_0xbbbb('0x8b')](_0x3d7516,_0x4fd96c)));};exports[_0xbbbb('0x8c')]=function(_0x27edfd){var _0x553d6a=_0x27edfd['match'](/"(.*?)"/);return _0x553d6a?_0x553d6a[0x1]:_0x27edfd;};exports[_0xbbbb('0x8d')]=function(_0x13336f){var _0x5024f8=_0x13336f['match'](/<(.*?)>/);return _0x5024f8?_0x5024f8[0x1]:_0x13336f;};function buildNoAnswerEventPayload(_0xdc471a,_0xbc3938){var _0x1e9c33=buildObj(_0xdc471a,_0xbbbb('0x8e'));if(!_['isEmpty'](_0xbc3938[_0xbbbb('0x8f')])){Object[_0xbbbb('0x90')](_0xbc3938[_0xbbbb('0x8f')])['forEach'](function(_0xbbb41f){_0x1e9c33[_0xbbb41f[_0xbbbb('0x91')]()]=_0xbc3938[_0xbbbb('0x8f')][_0xbbb41f];});}return _0x1e9c33;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0xe111=['originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','statedesc','ringtime','starttime','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','scheduledat','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','name','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','active','countbusyretry','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialOriginateTimeout','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2'];(function(_0xddf468,_0x29bb82){var _0x820bf6=function(_0x4c926a){while(--_0x4c926a){_0xddf468['push'](_0xddf468['shift']());}};_0x820bf6(++_0x29bb82);}(_0xe111,0x106));var _0x1e11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe111[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1e11('0x0'));var _=require(_0x1e11('0x1'));var moment=require(_0x1e11('0x2'));var logger=require(_0x1e11('0x3'))('preview');var ipAgi=process[_0x1e11('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x57cba7,_0x150e45){var _0x6fc738=moment(_0x57cba7)[_0x1e11('0x5')](0x0);var _0x11315b=moment(_0x150e45)[_0x1e11('0x5')](0x0);return _0x6fc738[_0x1e11('0x6')](_0x11315b,_0x1e11('0x7'));}exports[_0x1e11('0x8')]=function(_0x14d161){return function(_0x4a0e9a){logger[_0x1e11('0x9')](_0x14d161,util['inspect'](_0x4a0e9a,{'showHidden':![],'depth':null}));};};exports[_0x1e11('0xa')]=function(_0x4768f3,_0x53ed6d){logger[_0x1e11('0xb')](_0x4768f3,util[_0x1e11('0xc')](_0x53ed6d,{'showHidden':![],'depth':null}));};exports[_0x1e11('0xd')]=function(_0x48dfb3,_0xb210a7){logger[_0x1e11('0x9')](_0x48dfb3,util['inspect'](_0xb210a7,{'showHidden':![],'depth':null}));};exports[_0x1e11('0xe')]=function(_0x1007ab){return function(_0x1ddeb5){logger[_0x1e11('0xb')](_0x1007ab,util[_0x1e11('0xc')](_0x1ddeb5,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x29e8e6,_0x4a8a2d,_0x15b48a){return{'message':_0x29e8e6,'unlock':_0x4a8a2d,'active':_0x15b48a};};exports[_0x1e11('0xf')]=function(_0x4ce720,_0x5b2ec0,_0x7da52a){if(!_[_0x1e11('0x10')](_0x7da52a)&&_0x1e11('0x11')===typeof _0x7da52a&&!_[_0x1e11('0x12')](_0x7da52a)){if(!_[_0x1e11('0x10')](_0x5b2ec0)&&_0x1e11('0x11')===typeof _0x5b2ec0&&!_[_0x1e11('0x12')](_0x5b2ec0)){return util['format'](_0x1e11('0x13'),_0x5b2ec0,_0x7da52a);}return util[_0x1e11('0x14')]('\x22%s\x22\x20<%s>',_0x7da52a,_0x7da52a);}if(!_['isUndefined'](_0x4ce720)&&_0x1e11('0x11')===typeof _0x4ce720&&!_[_0x1e11('0x12')](_0x4ce720)){return _0x4ce720;}return _0x1e11('0x15');};exports[_0x1e11('0x16')]=function(_0x5d5d0d){if(_[_0x1e11('0x17')](_0x5d5d0d)){return![];}return _0x5d5d0d;};exports[_0x1e11('0x18')]=function(_0x3e54ac,_0x4d486e,_0x3c257a,_0x57aa1f,_0x458e75,_0x45f2bd){var _0x585e5a={'XMD-QUEUE':_0x4d486e[_0x1e11('0x19')]?_0x4d486e[_0x1e11('0x19')]['name']:'','XMD-CALLERID':_0x57aa1f,'XMD-CALLERID-PREVIEW':_0x45f2bd?util[_0x1e11('0x14')]('\x22%s\x22\x20<%s>',_0x45f2bd[_0x1e11('0x1a')],_0x45f2bd[_0x1e11('0x1b')]):_0x57aa1f,'XMD-DIALID':_0x458e75,'XMD-CONTACTID':_0x4d486e[_0x1e11('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x57aa1f,'XMD-VOICEQUEUEID':_0x4d486e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3c257a,'XMD-DIALTIMEOUT':_0x3e54ac[_0x1e11('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x3e54ac['dialQueueProject2']?'g':'',_[_0x1e11('0x12')](_0x3e54ac['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3e54ac['dialPreviewUrl']||'','XMD-AGI':_0x3e54ac[_0x1e11('0x1e')]?util[_0x1e11('0x14')](_0x1e11('0x1f'),ipAgi,_0x3e54ac[_0x1e11('0x1e')]):_0x1e11('0x20'),'XMD-AGIAFTER':_0x3e54ac[_0x1e11('0x21')]?util[_0x1e11('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3e54ac[_0x1e11('0x21')]):_0x1e11('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x45f2bd?_0x45f2bd[_0x1e11('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x45f2bd?_0x45f2bd[_0x1e11('0x23')]:'','XMD-DESTINATION':_0x1e11('0x24'),'SIPADDHEADER':_0x1e11('0x25')};if(!_[_0x1e11('0x12')](_0x3e54ac[_0x1e11('0x26')])){_0x585e5a[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3e54ac['monitor_format'];_0x585e5a[util[_0x1e11('0x14')]('%s',_0x1e11('0x27'))]=_0x458e75;}if(_0x4d486e&&_0x4d486e[_0x1e11('0x28')]){for(var _0x527770 in _0x4d486e[_0x1e11('0x28')]){if(_0x4d486e[_0x1e11('0x28')][_0x1e11('0x29')](_0x527770)){if(!_['isNil'](_0x4d486e['Contact'][_0x527770])&&_0x527770!=='id'&&_0x527770!==_0x1e11('0x2a')&&_0x527770!==_0x1e11('0x2b')&&_0x527770!=='updatedAt'){_0x585e5a[util[_0x1e11('0x14')](_0x1e11('0x2c'),_0x1e11('0x2d'),_[_0x1e11('0x2e')](_0x527770))]=_0x4d486e[_0x1e11('0x28')][_0x527770];}}}}return _0x585e5a;};exports[_0x1e11('0x2f')]=function(_0x2d68a0){var _0x59df17={};for(var _0x42284c in _0x2d68a0){if(_0x2d68a0['hasOwnProperty'](_0x42284c)){_0x59df17[util[_0x1e11('0x14')]('%s',_['toLower'](_0x42284c))]=_0x2d68a0[_0x42284c];}}return{'variables':_0x59df17};};exports[_0x1e11('0x30')]=function(_0x117869,_0x5f5354){if(!_[_0x1e11('0x17')](_0x117869)){if(_0x117869['hasOwnProperty'](_0x1e11('0x31'))){if(_0x117869['originated']>0x0){_0x117869[_0x1e11('0x31')]-=0x1;}else{logger[_0x1e11('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5f5354);}}}else{logger[_0x1e11('0x9')](_0x1e11('0x32'),_0x5f5354);}};exports[_0x1e11('0x33')]=function(_0x2f1d24){var _0x49a9eb=moment()[_0x1e11('0x14')](_0x1e11('0x34'));_0x2f1d24[_0x1e11('0x35')]=0xd;_0x2f1d24['statedesc']=_0x1e11('0x36');_0x2f1d24['starttime']=_0x49a9eb;_0x2f1d24[_0x1e11('0x37')]=_0x49a9eb;_0x2f1d24[_0x1e11('0x38')]=_0x49a9eb;};exports['logAgent']=function(_0x3ee1a0,_0x2b6c33,_0x298582){var _0x51ed61=moment()['format'](_0x1e11('0x34'));_0x3ee1a0[_0x1e11('0x35')]=_0x2b6c33;_0x3ee1a0[_0x1e11('0x39')]=_0x298582;_0x3ee1a0['responsetime']=_0x51ed61;_0x3ee1a0[_0x1e11('0x3a')]=getSeconds(_0x3ee1a0['responsetime'],_0x3ee1a0[_0x1e11('0x3b')]);};exports['logLookAgent']=function(_0x304114,_0x3dbf29,_0x45070b){_0x304114['membername']=_0x3dbf29;_0x304114[_0x1e11('0x3c')]=_0x45070b;};exports[_0x1e11('0x3d')]=function(_0x2d8044,_0x2d5c30,_0x194f6c){var _0xd2d433=moment()[_0x1e11('0x14')](_0x1e11('0x34'));_0x2d8044[_0x1e11('0x35')]=_0x2d5c30;_0x2d8044[_0x1e11('0x39')]=_0x194f6c;_0x2d8044['responsetime']=_0x2d8044[_0x1e11('0x37')]?_0x2d8044['responsetime']:_0xd2d433;_0x2d8044[_0x1e11('0x38')]=_0x2d8044['endtime']?_0x2d8044[_0x1e11('0x38')]:_0xd2d433;_0x2d8044[_0x1e11('0x3a')]=getSeconds(_0x2d8044[_0x1e11('0x37')]||0x0,_0x2d8044[_0x1e11('0x3b')]||0x0);_0x2d8044[_0x1e11('0x3e')]=_0x2d8044[_0x1e11('0x3f')]?getSeconds(_0x2d8044[_0x1e11('0x38')],_0x2d8044[_0x1e11('0x3f')]):0x0;};exports[_0x1e11('0x40')]=function(_0x4acf31){return _0x4acf31===_0x1e11('0x41');};exports[_0x1e11('0x42')]=function(_0x441643,_0x2a3347,_0x484068,_0x5eaf5d,_0x32bca4){var _0x1e6ffc=_0x5eaf5d?'RECALL':_0x441643[_0x1e11('0x1a')];_0x1e6ffc=_0x32bca4?_0x1e11('0x43'):_0x1e6ffc;return{'actionid':_0x441643[_0x1e11('0x44')],'action':_0x1e11('0x45'),'channel':_0x441643[_0x1e11('0x46')],'callerid':util[_0x1e11('0x14')](_0x1e11('0x13'),_0x1e6ffc,_0x441643[_0x1e11('0x1b')]),'Exten':_0x1e11('0x24'),'Context':_0x1e11('0x47'),'Priority':'1','variable':_0x484068,'timeout':(_0x2a3347[_0x1e11('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x441643[_0x1e11('0x44')]};};exports['totalGlobal']=function(_0x2582c9){return _0x2582c9['countbusyretry']+_0x2582c9[_0x1e11('0x49')]+_0x2582c9[_0x1e11('0x4a')]+_0x2582c9[_0x1e11('0x4b')]+_0x2582c9[_0x1e11('0x4c')];};exports[_0x1e11('0x4d')]=function(_0x2f4ad3){var _0x1eedfc=_[_0x1e11('0x4e')](_0x2f4ad3);_0x1eedfc['state']=0xf;_0x1eedfc[_0x1e11('0x39')]='Global';return _0x1eedfc;};exports[_0x1e11('0x4f')]=function(_0x5954e9,_0x5f0fc3,_0x2fde33){var _0x3d42ee={};_0x3d42ee[_0x5f0fc3]=_0x5954e9[_0x5f0fc3];_0x3d42ee['active']=![];_0x3d42ee[_0x1e11('0x50')]=moment()[_0x1e11('0x51')](_0x2fde33,'minutes')[_0x1e11('0x14')](_0x1e11('0x34'));_0x3d42ee[_0x1e11('0x1c')]=_0x5954e9['ContactId'];_0x3d42ee[_0x1e11('0x52')]=_0x5954e9['ListId'];_0x3d42ee[_0x1e11('0x53')]=_0x5954e9['VoiceQueueId']||undefined;return _0x3d42ee;};exports[_0x1e11('0x54')]=function(_0x58fef6,_0x1dfcb6){if(!_['isNil'](_0x58fef6)){if(_0x58fef6[_0x1e11('0x55')]>0x0){_0x58fef6[_0x1e11('0x55')]-=0x1;}else{logger['error'](_0x1dfcb6,_0x1e11('0x56'));}}else{logger['error'](_0x1dfcb6,_0x1e11('0x57'));}};exports[_0x1e11('0x58')]=function(_0x3cb48f){if(_0x3cb48f<=0x0){return!![];}return![];};function buildObj(_0x81bbe,_0xf59d8d,_0x5a0ca9){_0x81bbe['lastevent']=_0xf59d8d;_0x81bbe[_0x1e11('0x59')]=_0x81bbe['queue'];_0x81bbe[_0x1e11('0x5a')]=_0x81bbe[_0x1e11('0x46')];_0x81bbe[_0x1e11('0x5b')]=_0x1e11('0x5c');if(_0x5a0ca9){_0x81bbe[_0x1e11('0x5d')]=_0x5a0ca9['mandatoryDisposition'];}return _0x81bbe;}exports[_0x1e11('0x5e')]=buildObj;exports[_0x1e11('0x5f')]=function(_0xa78122){var _0x50729e={};_0x50729e[_0x1e11('0x60')]=_0xa78122[_0x1e11('0x60')];_0x50729e[_0x1e11('0x5a')]=_0xa78122['channelAgent'];_0x50729e[_0x1e11('0x44')]=_0xa78122[_0x1e11('0x44')];return _0x50729e;};exports[_0x1e11('0x61')]=function(_0x2ccd56){var _0x32b370=[];for(var _0x53c3c2 in _0x2ccd56){if(_0x2ccd56[_0x1e11('0x29')](_0x53c3c2)){if(!_[_0x1e11('0x17')](_0x2ccd56[_0x53c3c2])&&_0x2ccd56[_0x53c3c2]['state']===_0x1e11('0x62')&&_0x2ccd56[_0x53c3c2][_0x1e11('0x63')]===_0x1e11('0x64')){_0x32b370[_0x1e11('0x65')](_0x2ccd56[_0x53c3c2]['id']);}}}return _0x32b370;};exports['getDiff']=function(_0x4987ad){var _0xd2dca=moment()['milliseconds'](0x0);var _0x1c9d3a=moment(_0x4987ad)['milliseconds'](0x0);return _0xd2dca[_0x1e11('0x6')](_0x1c9d3a,'seconds');};exports[_0x1e11('0x66')]=function(_0x4dba2f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4dba2f[_0x1e11('0x1c')],'ListId':_0x4dba2f[_0x1e11('0x52')],'VoiceQueueId':_0x4dba2f[_0x1e11('0x53')]||undefined,'CampaignId':_0x4dba2f[_0x1e11('0x67')]||undefined};};exports[_0x1e11('0x68')]=function(_0x27bc27){if(_0x27bc27===_0x1e11('0x44')||_0x27bc27===_0x1e11('0x69')||_0x27bc27==='queue'||_0x27bc27==='type'||_0x27bc27===_0x1e11('0x6a')||_0x27bc27===_0x1e11('0x6b')||_0x27bc27===_0x1e11('0x6c')||_0x27bc27===_0x1e11('0x46')||_0x27bc27===_0x1e11('0x1a')||_0x27bc27===_0x1e11('0x6d')||_0x27bc27===_0x1e11('0x1b')||_0x27bc27===_0x1e11('0x50')||_0x27bc27===_0x1e11('0x6e')||_0x27bc27===_0x1e11('0x49')||_0x27bc27===_0x1e11('0x4a')||_0x27bc27==='countglobal'||_0x27bc27===_0x1e11('0x6f')||_0x27bc27===_0x1e11('0x70')||_0x27bc27===_0x1e11('0x71')||_0x27bc27===_0x1e11('0x72')||_0x27bc27===_0x1e11('0x1c')||_0x27bc27===_0x1e11('0x52')||_0x27bc27===_0x1e11('0x3c')||_0x27bc27===_0x1e11('0x53')||_0x27bc27==='sipcallid'||_0x27bc27==='xmd-voicequeueid'||_0x27bc27===_0x1e11('0x73')||_0x27bc27===_0x1e11('0x74')||_0x27bc27==='xmd-listid'||_0x27bc27===_0x1e11('0x75')||_0x27bc27===_0x1e11('0x76')||_0x27bc27===_0x1e11('0x77')||_0x27bc27===_0x1e11('0x78')||_0x27bc27===_0x1e11('0x79')||_0x27bc27===_0x1e11('0x7a')||_0x27bc27==='xmd-cdrtype'||_0x27bc27===_0x1e11('0x7b')||_0x27bc27===_0x1e11('0x7c')||_0x27bc27===_0x1e11('0x7d')||_0x27bc27===_0x1e11('0x7e')||_0x27bc27===_0x1e11('0x7f')||_0x27bc27===_0x1e11('0x80')||_0x27bc27===_0x1e11('0x81')||_0x27bc27===_0x1e11('0x82')||_0x27bc27===_0x1e11('0x83')||_0x27bc27===_0x1e11('0x84')||_0x27bc27===_0x1e11('0x85')||_0x27bc27===_0x1e11('0x7e')||_0x27bc27===_0x1e11('0x7f')||_0x27bc27==='rtpaudioqosjitter'||_0x27bc27===_0x1e11('0x81')||_0x27bc27===_0x1e11('0x82')||_0x27bc27===_0x1e11('0x83')||_0x27bc27===_0x1e11('0x84')||_0x27bc27==='rtpaudioqosrttbridged'||_0x27bc27===_0x1e11('0x86')||_0x27bc27===_0x1e11('0x87')||_0x27bc27===_0x1e11('0x35')||_0x27bc27===_0x1e11('0x39')){return![];}return!![];};exports[_0x1e11('0x88')]=function(_0x5d2cdb,_0x38b8b9){var _0x2368b0,_0x2afbd6,_0x58a3d0;if(_0x38b8b9<=0x0){_0x38b8b9=0x1;}_0x2368b0=new RegExp(_0x1e11('0x89')+_0x38b8b9+'}$');_0x2afbd6=Math[_0x1e11('0x8a')](0xa,_0x38b8b9-0x1);_0x58a3d0=Math[_0x1e11('0x8a')](0xa,_0x38b8b9)-0x1;return util[_0x1e11('0x14')]('%s',_[_0x1e11('0x8b')](_0x5d2cdb,_0x2368b0,_[_0x1e11('0x8c')](_0x2afbd6,_0x58a3d0)));};exports['extractCalleridName']=function(_0x1ee852){var _0x16e9e7=_0x1ee852[_0x1e11('0x8d')](/"(.*?)"/);return _0x16e9e7?_0x16e9e7[0x1]:_0x1ee852;};exports['extractCalleridNumber']=function(_0x2faf71){var _0x478f35=_0x2faf71[_0x1e11('0x8d')](/<(.*?)>/);return _0x478f35?_0x478f35[0x1]:_0x2faf71;};function buildNoAnswerEventPayload(_0x505cde,_0x13f512){var _0x52f7b=buildObj(_0x505cde,_0x1e11('0x8e'));if(!_[_0x1e11('0x12')](_0x13f512['variables'])){Object[_0x1e11('0x8f')](_0x13f512[_0x1e11('0x90')])[_0x1e11('0x91')](function(_0x283d6f){_0x52f7b[_0x283d6f[_0x1e11('0x92')]()]=_0x13f512['variables'][_0x283d6f];});}return _0x52f7b;}exports[_0x1e11('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 09cd228..3be22d5 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 _0xa82d=['number','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x2781dd,_0x1ee6e4){var _0x4c29f9=function(_0x560a7e){while(--_0x560a7e){_0x2781dd['push'](_0x2781dd['shift']());}};_0x4c29f9(++_0x1ee6e4);}(_0xa82d,0xde));var _0xda82=function(_0x1c7d7b,_0x218f66){_0x1c7d7b=_0x1c7d7b-0x0;var _0x32b5d8=_0xa82d[_0x1c7d7b];return _0x32b5d8;};'use strict';exports[_0xda82('0x0')]={'queue':{'type':_0xda82('0x1'),'required':!![]},'interface':{'type':_0xda82('0x1'),'required':!![]},'membername':{'type':_0xda82('0x1'),'required':!![]},'penalty':{'type':_0xda82('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xda82('0x1'),'required':!![]},'interface':{'type':_0xda82('0x1'),'required':!![]}};exports[_0xda82('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xda82('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xda82('0x1'),'required':![]}};exports[_0xda82('0x4')]={'uniqueid':{'type':_0xda82('0x1'),'required':!![]}};exports[_0xda82('0x5')]={'uniqueid':{'type':_0xda82('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xda82('0x1')},'mixmonitorid':{'type':_0xda82('0x1')}};exports[_0xda82('0x6')]={'uniqueid':{'type':_0xda82('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xda82('0x1'),'required':!![]},'exten':{'type':_0xda82('0x1'),'required':!![]},'context':{'type':_0xda82('0x1')}}; \ No newline at end of file +var _0xdbe8=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x404358,_0xd69ae0){var _0x34092c=function(_0x5ea87f){while(--_0x5ea87f){_0x404358['push'](_0x404358['shift']());}};_0x34092c(++_0xd69ae0);}(_0xdbe8,0x1b3));var _0x8dbe=function(_0x1bc3ac,_0x4f68ea){_0x1bc3ac=_0x1bc3ac-0x0;var _0x4aeff6=_0xdbe8[_0x1bc3ac];return _0x4aeff6;};'use strict';exports[_0x8dbe('0x0')]={'queue':{'type':_0x8dbe('0x1'),'required':!![]},'interface':{'type':_0x8dbe('0x1'),'required':!![]},'membername':{'type':_0x8dbe('0x1'),'required':!![]},'penalty':{'type':_0x8dbe('0x2'),'required':![]},'paused':{'type':_0x8dbe('0x3'),'required':![]}};exports[_0x8dbe('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8dbe('0x1'),'required':!![]}};exports[_0x8dbe('0x5')]={'interface':{'type':_0x8dbe('0x1'),'required':!![]},'paused':{'type':_0x8dbe('0x3')},'reason':{'type':_0x8dbe('0x1'),'required':![]}};exports[_0x8dbe('0x6')]={'module':{'type':'string','required':![]}};exports[_0x8dbe('0x7')]={'uniqueid':{'type':_0x8dbe('0x1'),'required':!![]}};exports[_0x8dbe('0x8')]={'uniqueid':{'type':_0x8dbe('0x1'),'required':!![]},'filename':{'type':_0x8dbe('0x1')},'format':{'type':_0x8dbe('0x1')},'mixmonitorid':{'type':_0x8dbe('0x1')}};exports[_0x8dbe('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8dbe('0xa')]={'uniqueid':{'type':_0x8dbe('0x1'),'required':!![]},'exten':{'type':_0x8dbe('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1a20287..b6cf03e 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 _0x1d54=['abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','telephones','isUndefined','initTriggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueReports','uniqueid','queuecallerexit','unmanaged','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','disposition','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1d54,0x100));var _0x41d5=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x1d54[_0x4cd21c];return _0x5d8e5e;};'use strict';var util=require(_0x41d5('0x0'));var _=require('lodash');var moment=require(_0x41d5('0x1'));var Agent=require(_0x41d5('0x2'));var Telephone=require(_0x41d5('0x3'));var Trunk=require(_0x41d5('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x41d5('0x5'));var Template=require(_0x41d5('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x41d5('0x7'));var ZendeskAccount=require(_0x41d5('0x8'));var SalesforceAccount=require(_0x41d5('0x9'));var FreshdeskAccount=require(_0x41d5('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x41d5('0xb'));var DeskAccount=require(_0x41d5('0xc'));var VtigerAccount=require(_0x41d5('0xd'));var ServicenowAccount=require(_0x41d5('0xe'));var Dynamics365Account=require(_0x41d5('0xf'));var FreshsalesAccount=require(_0x41d5('0x10'));var FaxAccount=require(_0x41d5('0x11'));var Realtime=function(){this[_0x41d5('0x12')]={};this['telephones']={};this[_0x41d5('0x13')]={};this[_0x41d5('0x14')]={};this[_0x41d5('0x15')]={};this[_0x41d5('0x16')]={};this[_0x41d5('0x17')]={};this[_0x41d5('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x41d5('0x19')]={};this[_0x41d5('0x1a')]={};this['queueChannels']={};this[_0x41d5('0x1b')]={};this[_0x41d5('0x1c')]={};this[_0x41d5('0x1d')]={};this[_0x41d5('0x1e')]={};this[_0x41d5('0x1f')]={};this[_0x41d5('0x20')]={};this['freshdeskAccounts']={};this[_0x41d5('0x21')]={};this['deskAccounts']={};this[_0x41d5('0x22')]={};this[_0x41d5('0x23')]={};this[_0x41d5('0x24')]={};this[_0x41d5('0x25')]={};this[_0x41d5('0x26')]={};};function freeIsNotKey(_0x19c456,_0x5e29db,_0x153940){var _0x1a309e=_[_0x41d5('0x27')](_0x19c456,function(_0x4578ea,_0x1a3f97){return _0x4578ea[_0x153940];});for(var _0x815e8 in _0x5e29db){if(_0x5e29db[_0x41d5('0x28')](_0x815e8)){if(!_0x1a309e[_0x815e8]){delete _0x5e29db[_0x815e8];}}}}function freeIsNotKeySip(_0x3ce11a,_0x48247f){var _0x14300c=_[_0x41d5('0x27')](_0x3ce11a,function(_0x1e5a5b,_0x1c989c){return util[_0x41d5('0x29')]('SIP/%s',_0x1e5a5b[_0x41d5('0x2a')]);});for(var _0x2b0adf in _0x48247f){if(_0x48247f[_0x41d5('0x28')](_0x2b0adf)){if(!_0x14300c[_0x2b0adf]){delete _0x48247f[_0x2b0adf];}}}}function freeIsNotKeyAgent(_0xa3daa3,_0x59ae4b){var _0x22c440=_['mapKeys'](_0xa3daa3,function(_0x47582a,_0x58e7db){var _0x66874=_[_0x41d5('0x2b')](_0x47582a[_0x41d5('0x2c')])?util[_0x41d5('0x29')](_0x41d5('0x2d'),_0x47582a[_0x41d5('0x2a')]):_0x47582a['interface'];return _0x66874;});for(var _0x593bac in _0x59ae4b){if(_0x59ae4b[_0x41d5('0x28')](_0x593bac)){if(!_0x22c440[_0x593bac]){delete _0x59ae4b[_0x593bac];}}}}function clearVoiceCallReports(_0x874583){_0x874583[_0x41d5('0x2e')]=0x0;_0x874583['answered']=0x0;_0x874583[_0x41d5('0x2f')]=0x0;_0x874583['sumDuration']=0x0;_0x874583[_0x41d5('0x30')]=0x0;}function clearCampaigns(_0x12e422){if(!_[_0x41d5('0x31')](_0x12e422)){for(var _0x53582f in _0x12e422){if(_0x12e422[_0x41d5('0x28')](_0x53582f)){_0x12e422[_0x53582f][_0x41d5('0x32')]=0x0;_0x12e422[_0x53582f][_0x41d5('0x33')]=0x0;}}}}function clearVoiceQueues(_0x4c44dc){if(!_[_0x41d5('0x31')](_0x4c44dc)){for(var _0x28210b in _0x4c44dc){if(_0x4c44dc['hasOwnProperty'](_0x28210b)){_0x4c44dc[_0x28210b][_0x41d5('0x2e')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x34')]=0x0;_0x4c44dc[_0x28210b]['unmanaged']=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x35')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x2f')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x36')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x30')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x37')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x38')]=0x0;_0x4c44dc[_0x28210b]['outboundBusyCallsDay']=0x0;_0x4c44dc[_0x28210b]['outboundCongestionCallsDay']=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x39')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x3a')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x3b')]=0x0;_0x4c44dc[_0x28210b]['outboundDropCallsDayCallersExit']=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x3c')]=0x0;_0x4c44dc[_0x28210b]['outboundOriginateFailureCallsDay']=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x3d')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x3e')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x37')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x3f')]=0x0;_0x4c44dc[_0x28210b][_0x41d5('0x40')]=!![];}}}}Realtime[_0x41d5('0x41')][_0x41d5('0x42')]=function(_0x481aab,_0x1059ce){for(var _0xdfc40b in _0x1059ce){if(_0x481aab['hasOwnProperty'](_0xdfc40b)){_0x481aab[_0xdfc40b]=_0x1059ce[_0xdfc40b];}}};Realtime[_0x41d5('0x41')][_0x41d5('0x43')]=function(){var _0x5ec6ca=this;return function(_0x3b2c38){if(_0x3b2c38){freeIsNotKeyAgent(_0x3b2c38,_0x5ec6ca['agents']);for(var _0x5a35a8=0x0,_0x26e1ee={},_0xb5bf04={};_0x5a35a8<_0x3b2c38[_0x41d5('0x44')];_0x5a35a8+=0x1){_0x26e1ee=_0x3b2c38[_0x5a35a8];var _0x2f08e7=_['isNil'](_0x26e1ee[_0x41d5('0x2c')])?util[_0x41d5('0x29')](_0x41d5('0x2d'),_0x26e1ee[_0x41d5('0x2a')]):_0x26e1ee[_0x41d5('0x2c')];if(_['isUndefined'](_0x5ec6ca[_0x41d5('0x12')][_0x2f08e7])){_0x5ec6ca[_0x41d5('0x12')][_0x2f08e7]=new Agent(_0x26e1ee);}else{_0x5ec6ca[_0x41d5('0x42')](_0x5ec6ca['agents'][_0x2f08e7],_0x26e1ee);}}}return _0x5ec6ca['agents'];};};Realtime[_0x41d5('0x41')]['initTelephones']=function(){var _0x28d2f1=this;return function(_0x4d611f){if(_0x4d611f){freeIsNotKeySip(_0x4d611f,_0x28d2f1[_0x41d5('0x45')]);for(var _0x4a63fb=0x0,_0x20283a={},_0x268f47={};_0x4a63fb<_0x4d611f[_0x41d5('0x44')];_0x4a63fb+=0x1){_0x20283a=_0x4d611f[_0x4a63fb];if(_[_0x41d5('0x46')](_0x28d2f1[_0x41d5('0x45')][util['format'](_0x41d5('0x2d'),_0x20283a[_0x41d5('0x2a')])])){_0x28d2f1[_0x41d5('0x45')][util['format']('SIP/%s',_0x20283a[_0x41d5('0x2a')])]=new Telephone(_0x20283a);}else{_0x28d2f1[_0x41d5('0x42')](_0x28d2f1[_0x41d5('0x45')][util[_0x41d5('0x29')]('SIP/%s',_0x20283a[_0x41d5('0x2a')])],_0x20283a);}}}return _0x28d2f1[_0x41d5('0x45')];};};Realtime[_0x41d5('0x41')]['initTrunks']=function(){var _0x256789=this;return function(_0x63a3f8){if(_0x63a3f8){freeIsNotKeySip(_0x63a3f8,_0x256789[_0x41d5('0x13')]);for(var _0x3ffbc2=0x0,_0x66e81e={},_0x4bf5d4={};_0x3ffbc2<_0x63a3f8[_0x41d5('0x44')];_0x3ffbc2+=0x1){_0x66e81e=_0x63a3f8[_0x3ffbc2];if(_[_0x41d5('0x46')](_0x256789[_0x41d5('0x13')][util[_0x41d5('0x29')]('SIP/%s',_0x66e81e[_0x41d5('0x2a')])])){_0x256789[_0x41d5('0x13')][util[_0x41d5('0x29')](_0x41d5('0x2d'),_0x66e81e['name'])]=new Trunk(_0x66e81e);}else{_0x256789['mergeFromDatabase'](_0x256789[_0x41d5('0x13')][util[_0x41d5('0x29')](_0x41d5('0x2d'),_0x66e81e['name'])],_0x66e81e);}}}return _0x256789['trunks'];};};Realtime[_0x41d5('0x41')]['initVoiceQueues']=function(){var _0x4218a2=this;return function(_0x5f5a2c){if(_0x5f5a2c){freeIsNotKey(_0x5f5a2c,_0x4218a2[_0x41d5('0x14')],'name');for(var _0x583f35=0x0,_0x359f3e={},_0x2cbf42={};_0x583f35<_0x5f5a2c[_0x41d5('0x44')];_0x583f35+=0x1){_0x359f3e=_0x5f5a2c[_0x583f35];if(_[_0x41d5('0x46')](_0x4218a2[_0x41d5('0x14')][_0x359f3e[_0x41d5('0x2a')]])){_0x4218a2['voiceQueues'][_0x359f3e[_0x41d5('0x2a')]]=new VoiceQueue(_0x359f3e);}else{_0x4218a2[_0x41d5('0x42')](_0x4218a2[_0x41d5('0x14')][_0x359f3e[_0x41d5('0x2a')]],_0x359f3e);}}}return _0x4218a2[_0x41d5('0x14')];};};Realtime[_0x41d5('0x41')][_0x41d5('0x47')]=function(){var _0x2e659d=this;return function(_0x2c5cba){if(_0x2c5cba){freeIsNotKey(_0x2c5cba,_0x2e659d[_0x41d5('0x15')],'id');for(var _0x39f4c8=0x0,_0x5856e4={},_0xe1a1bc={};_0x39f4c8<_0x2c5cba[_0x41d5('0x44')];_0x39f4c8+=0x1){_0x5856e4=_0x2c5cba[_0x39f4c8];if(_[_0x41d5('0x46')](_0x2e659d[_0x41d5('0x15')][_0x5856e4['id']])){_0x2e659d[_0x41d5('0x15')][_0x5856e4['id']]=new Trigger(_0x5856e4);}else{_0x2e659d[_0x41d5('0x42')](_0x2e659d[_0x41d5('0x15')][_0x5856e4['id']],_0x5856e4);}}}return _0x2e659d[_0x41d5('0x15')];};};Realtime[_0x41d5('0x41')]['initTemplates']=function(){var _0x24fdfe=this;return function(_0x2e2540){if(_0x2e2540){freeIsNotKey(_0x2e2540,_0x24fdfe[_0x41d5('0x17')],'id');for(var _0x50f52f=0x0,_0x234ec6={},_0x37cc06={};_0x50f52f<_0x2e2540[_0x41d5('0x44')];_0x50f52f+=0x1){_0x234ec6=_0x2e2540[_0x50f52f];if(_['isUndefined'](_0x24fdfe[_0x41d5('0x17')][_0x234ec6['id']])){_0x24fdfe[_0x41d5('0x17')][_0x234ec6['id']]=new Template(_0x234ec6);}else{_0x24fdfe[_0x41d5('0x42')](_0x24fdfe[_0x41d5('0x17')][_0x234ec6['id']],_0x234ec6);}}}return _0x24fdfe[_0x41d5('0x17')];};};Realtime['prototype'][_0x41d5('0x48')]=function(){var _0x4a3ae1=this;return function(_0x19f1b3){if(_0x19f1b3){freeIsNotKey(_0x19f1b3,_0x4a3ae1[_0x41d5('0x1e')],'id');for(var _0x5716b6=0x0,_0xcea45c={},_0x156980={};_0x5716b6<_0x19f1b3[_0x41d5('0x44')];_0x5716b6+=0x1){_0xcea45c=_0x19f1b3[_0x5716b6];if(_[_0x41d5('0x46')](_0x4a3ae1[_0x41d5('0x1e')][_0xcea45c['id']])){_0x4a3ae1[_0x41d5('0x1e')][_0xcea45c['id']]=new ZendeskAccount(_0xcea45c);}else{_0x4a3ae1[_0x41d5('0x42')](_0x4a3ae1[_0x41d5('0x1e')][_0xcea45c['id']],_0xcea45c);}}}return _0x4a3ae1['zendeskAccounts'];};};Realtime['prototype'][_0x41d5('0x49')]=function(){var _0x284e99=this;return function(_0x196950){if(_0x196950){freeIsNotKey(_0x196950,_0x284e99['salesforceAccounts'],'id');for(var _0x376f6e=0x0,_0x8a45c7={},_0x4f8717={};_0x376f6e<_0x196950[_0x41d5('0x44')];_0x376f6e+=0x1){_0x8a45c7=_0x196950[_0x376f6e];if(_[_0x41d5('0x46')](_0x284e99[_0x41d5('0x1f')][_0x8a45c7['id']])){_0x284e99[_0x41d5('0x1f')][_0x8a45c7['id']]=new SalesforceAccount(_0x8a45c7);}else{_0x284e99[_0x41d5('0x42')](_0x284e99['salesforceAccounts'][_0x8a45c7['id']],_0x8a45c7);}}}return _0x284e99[_0x41d5('0x1f')];};};Realtime['prototype'][_0x41d5('0x4a')]=function(){var _0x437bbb=this;return function(_0x3dad56){if(_0x3dad56){freeIsNotKey(_0x3dad56,_0x437bbb[_0x41d5('0x4b')],'id');for(var _0x40199a=0x0,_0x266484={},_0x5f3626={};_0x40199a<_0x3dad56[_0x41d5('0x44')];_0x40199a+=0x1){_0x266484=_0x3dad56[_0x40199a];if(_[_0x41d5('0x46')](_0x437bbb[_0x41d5('0x4b')][_0x266484['id']])){_0x437bbb['freshdeskAccounts'][_0x266484['id']]=new FreshdeskAccount(_0x266484);}else{_0x437bbb['mergeFromDatabase'](_0x437bbb[_0x41d5('0x4b')][_0x266484['id']],_0x266484);}}}return _0x437bbb[_0x41d5('0x4b')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x1ad39b=this;return function(_0x1b298c){if(_0x1b298c){freeIsNotKey(_0x1b298c,_0x1ad39b[_0x41d5('0x21')],'id');for(var _0x3d518f=0x0,_0x22dbd3={},_0x54ca7d={};_0x3d518f<_0x1b298c['length'];_0x3d518f+=0x1){_0x22dbd3=_0x1b298c[_0x3d518f];if(_[_0x41d5('0x46')](_0x1ad39b[_0x41d5('0x21')][_0x22dbd3['id']])){_0x1ad39b[_0x41d5('0x21')][_0x22dbd3['id']]=new ZohoAccount(_0x22dbd3);}else{_0x1ad39b['mergeFromDatabase'](_0x1ad39b[_0x41d5('0x21')][_0x22dbd3['id']],_0x22dbd3);}}}return _0x1ad39b['zohoAccounts'];};};Realtime[_0x41d5('0x41')][_0x41d5('0x4c')]=function(){var _0x4f65da=this;return function(_0x328faf){if(_0x328faf){freeIsNotKey(_0x328faf,_0x4f65da[_0x41d5('0x4d')],'id');for(var _0x27996b=0x0,_0xfc5d0d={},_0x3b8021={};_0x27996b<_0x328faf[_0x41d5('0x44')];_0x27996b+=0x1){_0xfc5d0d=_0x328faf[_0x27996b];if(_[_0x41d5('0x46')](_0x4f65da[_0x41d5('0x4d')][_0xfc5d0d['id']])){_0x4f65da['deskAccounts'][_0xfc5d0d['id']]=new DeskAccount(_0xfc5d0d);}else{_0x4f65da['mergeFromDatabase'](_0x4f65da[_0x41d5('0x4d')][_0xfc5d0d['id']],_0xfc5d0d);}}}return _0x4f65da[_0x41d5('0x4d')];};};Realtime[_0x41d5('0x41')]['initSugarcrmAccounts']=function(){var _0x17aa0f=this;return function(_0x20deed){if(_0x20deed){freeIsNotKey(_0x20deed,_0x17aa0f['sugarcrmAccounts'],'id');for(var _0x397d6a=0x0,_0x512117={},_0x5e383c={};_0x397d6a<_0x20deed['length'];_0x397d6a+=0x1){_0x512117=_0x20deed[_0x397d6a];if(_[_0x41d5('0x46')](_0x17aa0f[_0x41d5('0x20')][_0x512117['id']])){_0x17aa0f[_0x41d5('0x20')][_0x512117['id']]=new SugarcrmAccount(_0x512117);}else{_0x17aa0f[_0x41d5('0x42')](_0x17aa0f['sugarcrmAccounts'][_0x512117['id']],_0x512117);}}}return _0x17aa0f[_0x41d5('0x20')];};};Realtime[_0x41d5('0x41')][_0x41d5('0x4e')]=function(){var _0x11f2ab=this;return function(_0x397c32){if(_0x397c32){freeIsNotKey(_0x397c32,_0x11f2ab[_0x41d5('0x22')],'id');for(var _0x11bbb9=0x0,_0x4526d8={},_0x233041={};_0x11bbb9<_0x397c32[_0x41d5('0x44')];_0x11bbb9+=0x1){_0x4526d8=_0x397c32[_0x11bbb9];if(_[_0x41d5('0x46')](_0x11f2ab[_0x41d5('0x22')][_0x4526d8['id']])){_0x11f2ab[_0x41d5('0x22')][_0x4526d8['id']]=new VtigerAccount(_0x4526d8);}else{_0x11f2ab[_0x41d5('0x42')](_0x11f2ab[_0x41d5('0x22')][_0x4526d8['id']],_0x4526d8);}}}return _0x11f2ab[_0x41d5('0x22')];};};Realtime[_0x41d5('0x41')][_0x41d5('0x4f')]=function(){var _0x6d7c23=this;return function(_0x292e4d){if(_0x292e4d){freeIsNotKey(_0x292e4d,_0x6d7c23['servicenowAccounts'],'id');for(var _0x467162=0x0,_0x27b310={},_0x1cde63={};_0x467162<_0x292e4d[_0x41d5('0x44')];_0x467162+=0x1){_0x27b310=_0x292e4d[_0x467162];if(_[_0x41d5('0x46')](_0x6d7c23[_0x41d5('0x23')][_0x27b310['id']])){_0x6d7c23[_0x41d5('0x23')][_0x27b310['id']]=new ServicenowAccount(_0x27b310);}else{_0x6d7c23['mergeFromDatabase'](_0x6d7c23[_0x41d5('0x23')][_0x27b310['id']],_0x27b310);}}}return _0x6d7c23['servicenowAccounts'];};};Realtime['prototype'][_0x41d5('0x50')]=function(){var _0x439660=this;return function(_0x4dcdd7){if(_0x4dcdd7){freeIsNotKey(_0x4dcdd7,_0x439660['dynamics365Accounts'],'id');for(var _0x25622c=0x0,_0x63140a={},_0x5c4387={};_0x25622c<_0x4dcdd7[_0x41d5('0x44')];_0x25622c+=0x1){_0x63140a=_0x4dcdd7[_0x25622c];if(_['isUndefined'](_0x439660[_0x41d5('0x24')][_0x63140a['id']])){_0x439660['dynamics365Accounts'][_0x63140a['id']]=new Dynamics365Account(_0x63140a);}else{_0x439660[_0x41d5('0x42')](_0x439660[_0x41d5('0x24')][_0x63140a['id']],_0x63140a);}}}return _0x439660[_0x41d5('0x24')];};};Realtime[_0x41d5('0x41')]['initFreshsalesAccounts']=function(){var _0x119300=this;return function(_0x36522f){if(_0x36522f){freeIsNotKey(_0x36522f,_0x119300[_0x41d5('0x25')],'id');for(var _0x35fdb0=0x0,_0x476809={},_0x44f1ce={};_0x35fdb0<_0x36522f[_0x41d5('0x44')];_0x35fdb0+=0x1){_0x476809=_0x36522f[_0x35fdb0];if(_[_0x41d5('0x46')](_0x119300['freshsalesAccounts'][_0x476809['id']])){_0x119300[_0x41d5('0x25')][_0x476809['id']]=new FreshsalesAccount(_0x476809);}else{_0x119300['mergeFromDatabase'](_0x119300[_0x41d5('0x25')][_0x476809['id']],_0x476809);}}}return _0x119300['freshsalesAccounts'];};};Realtime[_0x41d5('0x41')]['initVoiceQueueHopperHistory']=function(){var _0x5b6ee7=this;return function(_0x1dbf34){for(var _0x4aab56=0x0;_0x4aab56<_0x1dbf34[_0x41d5('0x44')];_0x4aab56+=0x1){_['merge'](_0x5b6ee7[_0x41d5('0x14')][_0x1dbf34[_0x4aab56][_0x41d5('0x2a')]],_0x1dbf34[_0x4aab56]);}return _0x5b6ee7['voiceQueues'];};};Realtime[_0x41d5('0x41')][_0x41d5('0x51')]=function(){var _0x3aeb29=this;return function(_0x8c3dec){clearVoiceQueues(_0x3aeb29[_0x41d5('0x14')]);if(_0x8c3dec){_0x8c3dec=_['groupBy'](_0x8c3dec,_0x41d5('0x52'));for(var _0x43e175 in _0x8c3dec){if(_0x8c3dec[_0x41d5('0x28')](_0x43e175)){var _0x5b8eb2={};for(var _0x1df0bb=0x0;_0x1df0bb<_0x8c3dec[_0x43e175][_0x41d5('0x44')];_0x1df0bb+=0x1){var _0x2490d4=_0x8c3dec[_0x43e175][_0x1df0bb]['queue'];if(_0x3aeb29[_0x41d5('0x14')][_0x2490d4]){if(_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x53')]){_0x3aeb29[_0x41d5('0x14')][_0x2490d4][_0x41d5('0x54')]+=0x1;}if(_0x8c3dec[_0x43e175][_0x1df0bb]['queuecallerabandon']){_0x3aeb29[_0x41d5('0x14')][_0x2490d4][_0x41d5('0x35')]+=0x1;}_0x3aeb29['voiceQueues'][_0x2490d4]['sumHoldTime']+=moment(_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x55')])[_0x41d5('0x56')](moment(_0x8c3dec[_0x43e175][_0x1df0bb]['queuecallerjoinAt']),'seconds')||0x0;if(_0x1df0bb===_0x8c3dec[_0x43e175][_0x41d5('0x44')]-0x1){_0x3aeb29[_0x41d5('0x14')][_0x2490d4][_0x41d5('0x36')]+=moment(_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x57')]||_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x58')]||_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x59')])[_0x41d5('0x56')](moment(_0x8c3dec[_0x43e175][_0x1df0bb]['queuecallerjoinAt']),_0x41d5('0x5a'))||0x0;_0x3aeb29['voiceQueues'][_0x2490d4][_0x41d5('0x2e')]+=0x1;if(_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x5b')]){_0x3aeb29[_0x41d5('0x14')][_0x2490d4][_0x41d5('0x34')]+=0x1;_0x3aeb29[_0x41d5('0x14')][_0x2490d4][_0x41d5('0x30')]+=moment(_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x57')])[_0x41d5('0x56')](moment(_0x8c3dec[_0x43e175][_0x1df0bb][_0x41d5('0x55')]),_0x41d5('0x5a'))||0x0;}}else{_0x3aeb29[_0x41d5('0x14')][_0x2490d4][_0x41d5('0x36')]+=_0x3aeb29[_0x41d5('0x14')][_0x2490d4][_0x41d5('0x2f')]||0x0;}}}}}}return _0x3aeb29[_0x41d5('0x14')];};};Realtime[_0x41d5('0x41')][_0x41d5('0x5c')]=function(){var _0x4d8e5c=this;return function(_0x3cee6c){clearVoiceCallReports(_0x4d8e5c[_0x41d5('0x18')]);if(_0x3cee6c){for(var _0x3e4742=0x0;_0x3e4742<_0x3cee6c[_0x41d5('0x44')];_0x3e4742+=0x1){_0x4d8e5c[_0x41d5('0x18')][_0x41d5('0x2e')]+=0x1;_0x4d8e5c[_0x41d5('0x18')]['sumDuration']+=_0x3cee6c[_0x3e4742]['duration'];if(_0x3cee6c[_0x3e4742][_0x41d5('0x5d')]==='ANSWERED'){_0x4d8e5c[_0x41d5('0x18')][_0x41d5('0x34')]+=0x1;_0x4d8e5c[_0x41d5('0x18')][_0x41d5('0x2f')]+=_0x3cee6c[_0x3e4742][_0x41d5('0x5e')]-_0x3cee6c[_0x3e4742]['billableseconds']||0x0;_0x4d8e5c['outbound'][_0x41d5('0x30')]+=_0x3cee6c[_0x3e4742][_0x41d5('0x5f')];}}}return _0x4d8e5c[_0x41d5('0x18')];};};Realtime[_0x41d5('0x41')][_0x41d5('0x60')]=function(){var _0x3e8315=this;return function(_0x296e36){if(_0x296e36){freeIsNotKey(_0x296e36,_0x3e8315['campaigns'],'name');for(var _0x1bf848=0x0,_0x465bea={};_0x1bf848<_0x296e36['length'];_0x1bf848+=0x1){_0x465bea=_0x296e36[_0x1bf848];if(_['isUndefined'](_0x3e8315[_0x41d5('0x16')][_0x465bea[_0x41d5('0x2a')]])){_0x3e8315['campaigns'][_0x465bea[_0x41d5('0x2a')]]=new Campaign(_0x465bea);}else{_0x3e8315[_0x41d5('0x42')](_0x3e8315[_0x41d5('0x16')][_0x465bea[_0x41d5('0x2a')]],_0x465bea);_0x3e8315[_0x41d5('0x16')][_0x465bea[_0x41d5('0x2a')]][_0x41d5('0x61')]=_0x465bea[_0x41d5('0x62')]?_0x465bea['SquareProject'][_0x41d5('0x2a')]:undefined;}}}return _0x3e8315['campaigns'];};};Realtime[_0x41d5('0x41')][_0x41d5('0x63')]=function(){var _0x37cc1a=this;return function(_0x11bc3b){if(_0x11bc3b){freeIsNotKey(_0x11bc3b,_0x37cc1a['voiceExtensions'],'id');for(var _0x7d34b0=0x0,_0x32b52c={};_0x7d34b0<_0x11bc3b[_0x41d5('0x44')];_0x7d34b0+=0x1){_0x32b52c=_0x11bc3b[_0x7d34b0];if(_[_0x41d5('0x46')](_0x37cc1a[_0x41d5('0x19')][_0x32b52c['id']])){_0x37cc1a['voiceExtensions'][_0x32b52c['id']]=new VoiceExtension(_0x32b52c);}else{_0x37cc1a['mergeFromDatabase'](_0x37cc1a['voiceExtensions'][_0x32b52c['id']],_0x32b52c);}}}return _0x37cc1a[_0x41d5('0x19')];};};Realtime[_0x41d5('0x41')][_0x41d5('0x64')]=function(){var _0x40ef5b=this;return function(_0x60ce2e){clearCampaigns(_0x40ef5b[_0x41d5('0x16')]);for(var _0x4da16d=0x0;_0x4da16d<_0x60ce2e[_0x41d5('0x44')];_0x4da16d+=0x1){_['merge'](_0x40ef5b[_0x41d5('0x16')][_0x60ce2e[_0x4da16d][_0x41d5('0x2a')]],_0x60ce2e[_0x4da16d]);}return _0x40ef5b[_0x41d5('0x16')];};};Realtime['prototype'][_0x41d5('0x65')]=function(){var _0x161891=this;return function(_0x303caa){if(_0x303caa){freeIsNotKey(_0x303caa,_0x161891[_0x41d5('0x26')],'id');for(var _0x63f6b8=0x0,_0xe8ef56={},_0x10d2b3={};_0x63f6b8<_0x303caa[_0x41d5('0x44')];_0x63f6b8+=0x1){_0xe8ef56=_0x303caa[_0x63f6b8];if(_[_0x41d5('0x46')](_0x161891[_0x41d5('0x26')][_0xe8ef56['id']])){_0x161891[_0x41d5('0x26')][_0xe8ef56['id']]=new FaxAccount(_0xe8ef56);}else{_0x161891[_0x41d5('0x42')](_0x161891['faxAccounts'][_0xe8ef56['id']],_0xe8ef56);}}}return _0x161891[_0x41d5('0x26')];};};module[_0x41d5('0x66')]=Realtime; \ No newline at end of file +var _0xb145=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','hasOwnProperty','isNil','interface','SIP/%s','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','name','telephones','length','isUndefined','initVoiceQueues','initTriggers','initZendeskAccounts','initZohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','outbound','duration','disposition','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x25f6f3,_0x1ffbd0){var _0x4775ae=function(_0x5c551b){while(--_0x5c551b){_0x25f6f3['push'](_0x25f6f3['shift']());}};_0x4775ae(++_0x1ffbd0);}(_0xb145,0xa3));var _0x5b14=function(_0x1b2115,_0x2c2723){_0x1b2115=_0x1b2115-0x0;var _0x15bcf9=_0xb145[_0x1b2115];return _0x15bcf9;};'use strict';var util=require('util');var _=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var Agent=require(_0x5b14('0x2'));var Telephone=require(_0x5b14('0x3'));var Trunk=require(_0x5b14('0x4'));var VoiceQueue=require(_0x5b14('0x5'));var Trigger=require(_0x5b14('0x6'));var Template=require(_0x5b14('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x5b14('0x8'));var ZendeskAccount=require(_0x5b14('0x9'));var SalesforceAccount=require(_0x5b14('0xa'));var FreshdeskAccount=require(_0x5b14('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x5b14('0xc'));var DeskAccount=require(_0x5b14('0xd'));var VtigerAccount=require(_0x5b14('0xe'));var ServicenowAccount=require(_0x5b14('0xf'));var Dynamics365Account=require(_0x5b14('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x5b14('0x11'));var Realtime=function(){this[_0x5b14('0x12')]={};this['telephones']={};this[_0x5b14('0x13')]={};this[_0x5b14('0x14')]={};this[_0x5b14('0x15')]={};this[_0x5b14('0x16')]={};this[_0x5b14('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5b14('0x18')]={};this['channels']={};this[_0x5b14('0x19')]={};this[_0x5b14('0x1a')]={};this[_0x5b14('0x1b')]={};this[_0x5b14('0x1c')]={};this[_0x5b14('0x1d')]={};this[_0x5b14('0x1e')]={};this['sugarcrmAccounts']={};this[_0x5b14('0x1f')]={};this[_0x5b14('0x20')]={};this[_0x5b14('0x21')]={};this[_0x5b14('0x22')]={};this[_0x5b14('0x23')]={};this[_0x5b14('0x24')]={};this[_0x5b14('0x25')]={};this[_0x5b14('0x26')]={};};function freeIsNotKey(_0x183b0a,_0x287bb7,_0x221344){var _0x2c3efb=_['mapKeys'](_0x183b0a,function(_0x24cfd0,_0x50866a){return _0x24cfd0[_0x221344];});for(var _0x48d395 in _0x287bb7){if(_0x287bb7['hasOwnProperty'](_0x48d395)){if(!_0x2c3efb[_0x48d395]){delete _0x287bb7[_0x48d395];}}}}function freeIsNotKeySip(_0x3f397d,_0x3035b5){var _0x3662a7=_[_0x5b14('0x27')](_0x3f397d,function(_0x3786f7,_0x16fba5){return util[_0x5b14('0x28')]('SIP/%s',_0x3786f7['name']);});for(var _0x4fa079 in _0x3035b5){if(_0x3035b5[_0x5b14('0x29')](_0x4fa079)){if(!_0x3662a7[_0x4fa079]){delete _0x3035b5[_0x4fa079];}}}}function freeIsNotKeyAgent(_0x2afa17,_0x9a9495){var _0x1e22a5=_['mapKeys'](_0x2afa17,function(_0x1018d9,_0x1577f7){var _0x4857c7=_[_0x5b14('0x2a')](_0x1018d9[_0x5b14('0x2b')])?util['format'](_0x5b14('0x2c'),_0x1018d9['name']):_0x1018d9['interface'];return _0x4857c7;});for(var _0x5e0780 in _0x9a9495){if(_0x9a9495['hasOwnProperty'](_0x5e0780)){if(!_0x1e22a5[_0x5e0780]){delete _0x9a9495[_0x5e0780];}}}}function clearVoiceCallReports(_0x2d62d1){_0x2d62d1[_0x5b14('0x2d')]=0x0;_0x2d62d1[_0x5b14('0x2e')]=0x0;_0x2d62d1['sumHoldTime']=0x0;_0x2d62d1[_0x5b14('0x2f')]=0x0;_0x2d62d1[_0x5b14('0x30')]=0x0;}function clearCampaigns(_0x2ac7b0){if(!_[_0x5b14('0x31')](_0x2ac7b0)){for(var _0xe6851b in _0x2ac7b0){if(_0x2ac7b0[_0x5b14('0x29')](_0xe6851b)){_0x2ac7b0[_0xe6851b][_0x5b14('0x32')]=0x0;_0x2ac7b0[_0xe6851b][_0x5b14('0x33')]=0x0;}}}}function clearVoiceQueues(_0x296d65){if(!_[_0x5b14('0x31')](_0x296d65)){for(var _0xbe39bc in _0x296d65){if(_0x296d65[_0x5b14('0x29')](_0xbe39bc)){_0x296d65[_0xbe39bc][_0x5b14('0x2d')]=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x2e')]=0x0;_0x296d65[_0xbe39bc]['unmanaged']=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x34')]=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x35')]=0x0;_0x296d65[_0xbe39bc]['sumDuration']=0x0;_0x296d65[_0xbe39bc]['sumBillable']=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x36')]=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x37')]=0x0;_0x296d65[_0xbe39bc]['outboundBusyCallsDay']=0x0;_0x296d65[_0xbe39bc]['outboundCongestionCallsDay']=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x38')]=0x0;_0x296d65[_0xbe39bc]['outboundUnknownCallsDay']=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x39')]=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x3a')]=0x0;_0x296d65[_0xbe39bc]['outboundBlacklistCallsDay']=0x0;_0x296d65[_0xbe39bc]['outboundOriginateFailureCallsDay']=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x3b')]=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x3c')]=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x36')]=0x0;_0x296d65[_0xbe39bc]['outboundAnswerCallsDay']=0x0;_0x296d65[_0xbe39bc][_0x5b14('0x3d')]=!![];}}}}Realtime['prototype'][_0x5b14('0x3e')]=function(_0x291c92,_0x3f3c5f){for(var _0x2e2a83 in _0x3f3c5f){if(_0x291c92['hasOwnProperty'](_0x2e2a83)){_0x291c92[_0x2e2a83]=_0x3f3c5f[_0x2e2a83];}}};Realtime[_0x5b14('0x3f')][_0x5b14('0x40')]=function(){var _0x2a1aa7=this;return function(_0x37f62c){if(_0x37f62c){freeIsNotKeyAgent(_0x37f62c,_0x2a1aa7['agents']);for(var _0x32be08=0x0,_0x3a11a2={},_0x17bd9f={};_0x32be08<_0x37f62c['length'];_0x32be08+=0x1){_0x3a11a2=_0x37f62c[_0x32be08];var _0x2fe74d=_['isNil'](_0x3a11a2[_0x5b14('0x2b')])?util[_0x5b14('0x28')]('SIP/%s',_0x3a11a2[_0x5b14('0x41')]):_0x3a11a2[_0x5b14('0x2b')];if(_['isUndefined'](_0x2a1aa7[_0x5b14('0x12')][_0x2fe74d])){_0x2a1aa7['agents'][_0x2fe74d]=new Agent(_0x3a11a2);}else{_0x2a1aa7[_0x5b14('0x3e')](_0x2a1aa7[_0x5b14('0x12')][_0x2fe74d],_0x3a11a2);}}}return _0x2a1aa7[_0x5b14('0x12')];};};Realtime[_0x5b14('0x3f')]['initTelephones']=function(){var _0xfac72=this;return function(_0x2b3396){if(_0x2b3396){freeIsNotKeySip(_0x2b3396,_0xfac72[_0x5b14('0x42')]);for(var _0x228fe2=0x0,_0x2f8714={},_0x2428b0={};_0x228fe2<_0x2b3396[_0x5b14('0x43')];_0x228fe2+=0x1){_0x2f8714=_0x2b3396[_0x228fe2];if(_[_0x5b14('0x44')](_0xfac72[_0x5b14('0x42')][util[_0x5b14('0x28')](_0x5b14('0x2c'),_0x2f8714[_0x5b14('0x41')])])){_0xfac72[_0x5b14('0x42')][util[_0x5b14('0x28')](_0x5b14('0x2c'),_0x2f8714[_0x5b14('0x41')])]=new Telephone(_0x2f8714);}else{_0xfac72['mergeFromDatabase'](_0xfac72[_0x5b14('0x42')][util['format'](_0x5b14('0x2c'),_0x2f8714[_0x5b14('0x41')])],_0x2f8714);}}}return _0xfac72['telephones'];};};Realtime['prototype']['initTrunks']=function(){var _0x42a381=this;return function(_0x18ba6b){if(_0x18ba6b){freeIsNotKeySip(_0x18ba6b,_0x42a381['trunks']);for(var _0x10f5a3=0x0,_0x21e7ec={},_0x266d48={};_0x10f5a3<_0x18ba6b[_0x5b14('0x43')];_0x10f5a3+=0x1){_0x21e7ec=_0x18ba6b[_0x10f5a3];if(_[_0x5b14('0x44')](_0x42a381['trunks'][util[_0x5b14('0x28')](_0x5b14('0x2c'),_0x21e7ec['name'])])){_0x42a381[_0x5b14('0x13')][util[_0x5b14('0x28')](_0x5b14('0x2c'),_0x21e7ec[_0x5b14('0x41')])]=new Trunk(_0x21e7ec);}else{_0x42a381['mergeFromDatabase'](_0x42a381[_0x5b14('0x13')][util[_0x5b14('0x28')](_0x5b14('0x2c'),_0x21e7ec[_0x5b14('0x41')])],_0x21e7ec);}}}return _0x42a381['trunks'];};};Realtime[_0x5b14('0x3f')][_0x5b14('0x45')]=function(){var _0x376eee=this;return function(_0x1da448){if(_0x1da448){freeIsNotKey(_0x1da448,_0x376eee['voiceQueues'],'name');for(var _0x40f2e0=0x0,_0x1f2e23={},_0x5ebbbe={};_0x40f2e0<_0x1da448[_0x5b14('0x43')];_0x40f2e0+=0x1){_0x1f2e23=_0x1da448[_0x40f2e0];if(_['isUndefined'](_0x376eee[_0x5b14('0x14')][_0x1f2e23[_0x5b14('0x41')]])){_0x376eee[_0x5b14('0x14')][_0x1f2e23[_0x5b14('0x41')]]=new VoiceQueue(_0x1f2e23);}else{_0x376eee[_0x5b14('0x3e')](_0x376eee['voiceQueues'][_0x1f2e23[_0x5b14('0x41')]],_0x1f2e23);}}}return _0x376eee[_0x5b14('0x14')];};};Realtime[_0x5b14('0x3f')][_0x5b14('0x46')]=function(){var _0x46e8ba=this;return function(_0x5d8ad7){if(_0x5d8ad7){freeIsNotKey(_0x5d8ad7,_0x46e8ba['triggers'],'id');for(var _0x370f19=0x0,_0x51af0f={},_0x4a93e9={};_0x370f19<_0x5d8ad7['length'];_0x370f19+=0x1){_0x51af0f=_0x5d8ad7[_0x370f19];if(_[_0x5b14('0x44')](_0x46e8ba[_0x5b14('0x15')][_0x51af0f['id']])){_0x46e8ba[_0x5b14('0x15')][_0x51af0f['id']]=new Trigger(_0x51af0f);}else{_0x46e8ba[_0x5b14('0x3e')](_0x46e8ba[_0x5b14('0x15')][_0x51af0f['id']],_0x51af0f);}}}return _0x46e8ba[_0x5b14('0x15')];};};Realtime[_0x5b14('0x3f')]['initTemplates']=function(){var _0x548e1c=this;return function(_0x49a803){if(_0x49a803){freeIsNotKey(_0x49a803,_0x548e1c['templates'],'id');for(var _0x517372=0x0,_0x2ff9e3={},_0x42e7d8={};_0x517372<_0x49a803[_0x5b14('0x43')];_0x517372+=0x1){_0x2ff9e3=_0x49a803[_0x517372];if(_[_0x5b14('0x44')](_0x548e1c[_0x5b14('0x17')][_0x2ff9e3['id']])){_0x548e1c['templates'][_0x2ff9e3['id']]=new Template(_0x2ff9e3);}else{_0x548e1c['mergeFromDatabase'](_0x548e1c[_0x5b14('0x17')][_0x2ff9e3['id']],_0x2ff9e3);}}}return _0x548e1c[_0x5b14('0x17')];};};Realtime['prototype'][_0x5b14('0x47')]=function(){var _0x2b6610=this;return function(_0x508984){if(_0x508984){freeIsNotKey(_0x508984,_0x2b6610['zendeskAccounts'],'id');for(var _0x921a85=0x0,_0x1d6fdc={},_0x397304={};_0x921a85<_0x508984['length'];_0x921a85+=0x1){_0x1d6fdc=_0x508984[_0x921a85];if(_[_0x5b14('0x44')](_0x2b6610[_0x5b14('0x1d')][_0x1d6fdc['id']])){_0x2b6610[_0x5b14('0x1d')][_0x1d6fdc['id']]=new ZendeskAccount(_0x1d6fdc);}else{_0x2b6610[_0x5b14('0x3e')](_0x2b6610[_0x5b14('0x1d')][_0x1d6fdc['id']],_0x1d6fdc);}}}return _0x2b6610[_0x5b14('0x1d')];};};Realtime[_0x5b14('0x3f')]['initSalesforceAccounts']=function(){var _0x286518=this;return function(_0x5e99a4){if(_0x5e99a4){freeIsNotKey(_0x5e99a4,_0x286518[_0x5b14('0x1e')],'id');for(var _0x2030c2=0x0,_0x4167e2={},_0x1258a2={};_0x2030c2<_0x5e99a4[_0x5b14('0x43')];_0x2030c2+=0x1){_0x4167e2=_0x5e99a4[_0x2030c2];if(_[_0x5b14('0x44')](_0x286518[_0x5b14('0x1e')][_0x4167e2['id']])){_0x286518[_0x5b14('0x1e')][_0x4167e2['id']]=new SalesforceAccount(_0x4167e2);}else{_0x286518[_0x5b14('0x3e')](_0x286518[_0x5b14('0x1e')][_0x4167e2['id']],_0x4167e2);}}}return _0x286518[_0x5b14('0x1e')];};};Realtime[_0x5b14('0x3f')]['initFreshdeskAccounts']=function(){var _0x59326e=this;return function(_0x4d1a88){if(_0x4d1a88){freeIsNotKey(_0x4d1a88,_0x59326e[_0x5b14('0x1f')],'id');for(var _0x4dc9d1=0x0,_0xa23f6e={},_0x8283a2={};_0x4dc9d1<_0x4d1a88[_0x5b14('0x43')];_0x4dc9d1+=0x1){_0xa23f6e=_0x4d1a88[_0x4dc9d1];if(_[_0x5b14('0x44')](_0x59326e[_0x5b14('0x1f')][_0xa23f6e['id']])){_0x59326e['freshdeskAccounts'][_0xa23f6e['id']]=new FreshdeskAccount(_0xa23f6e);}else{_0x59326e[_0x5b14('0x3e')](_0x59326e[_0x5b14('0x1f')][_0xa23f6e['id']],_0xa23f6e);}}}return _0x59326e['freshdeskAccounts'];};};Realtime['prototype'][_0x5b14('0x48')]=function(){var _0x45def1=this;return function(_0x414f79){if(_0x414f79){freeIsNotKey(_0x414f79,_0x45def1[_0x5b14('0x20')],'id');for(var _0x32629d=0x0,_0x1009e5={},_0x5a21af={};_0x32629d<_0x414f79[_0x5b14('0x43')];_0x32629d+=0x1){_0x1009e5=_0x414f79[_0x32629d];if(_['isUndefined'](_0x45def1[_0x5b14('0x20')][_0x1009e5['id']])){_0x45def1['zohoAccounts'][_0x1009e5['id']]=new ZohoAccount(_0x1009e5);}else{_0x45def1[_0x5b14('0x3e')](_0x45def1[_0x5b14('0x20')][_0x1009e5['id']],_0x1009e5);}}}return _0x45def1[_0x5b14('0x20')];};};Realtime['prototype'][_0x5b14('0x49')]=function(){var _0x566063=this;return function(_0x2975bb){if(_0x2975bb){freeIsNotKey(_0x2975bb,_0x566063[_0x5b14('0x21')],'id');for(var _0xe8343f=0x0,_0x5ac9a5={},_0xe18ccf={};_0xe8343f<_0x2975bb[_0x5b14('0x43')];_0xe8343f+=0x1){_0x5ac9a5=_0x2975bb[_0xe8343f];if(_[_0x5b14('0x44')](_0x566063[_0x5b14('0x21')][_0x5ac9a5['id']])){_0x566063['deskAccounts'][_0x5ac9a5['id']]=new DeskAccount(_0x5ac9a5);}else{_0x566063[_0x5b14('0x3e')](_0x566063['deskAccounts'][_0x5ac9a5['id']],_0x5ac9a5);}}}return _0x566063[_0x5b14('0x21')];};};Realtime[_0x5b14('0x3f')]['initSugarcrmAccounts']=function(){var _0x4a506a=this;return function(_0x38750d){if(_0x38750d){freeIsNotKey(_0x38750d,_0x4a506a[_0x5b14('0x4a')],'id');for(var _0xb50187=0x0,_0x47e232={},_0x474999={};_0xb50187<_0x38750d[_0x5b14('0x43')];_0xb50187+=0x1){_0x47e232=_0x38750d[_0xb50187];if(_['isUndefined'](_0x4a506a[_0x5b14('0x4a')][_0x47e232['id']])){_0x4a506a[_0x5b14('0x4a')][_0x47e232['id']]=new SugarcrmAccount(_0x47e232);}else{_0x4a506a[_0x5b14('0x3e')](_0x4a506a[_0x5b14('0x4a')][_0x47e232['id']],_0x47e232);}}}return _0x4a506a[_0x5b14('0x4a')];};};Realtime['prototype'][_0x5b14('0x4b')]=function(){var _0x465907=this;return function(_0x521513){if(_0x521513){freeIsNotKey(_0x521513,_0x465907['vtigerAccounts'],'id');for(var _0x75b90c=0x0,_0x1b25e1={},_0x4d3667={};_0x75b90c<_0x521513['length'];_0x75b90c+=0x1){_0x1b25e1=_0x521513[_0x75b90c];if(_[_0x5b14('0x44')](_0x465907[_0x5b14('0x22')][_0x1b25e1['id']])){_0x465907[_0x5b14('0x22')][_0x1b25e1['id']]=new VtigerAccount(_0x1b25e1);}else{_0x465907['mergeFromDatabase'](_0x465907[_0x5b14('0x22')][_0x1b25e1['id']],_0x1b25e1);}}}return _0x465907[_0x5b14('0x22')];};};Realtime[_0x5b14('0x3f')]['initServicenowAccounts']=function(){var _0x453e4b=this;return function(_0x3c61ff){if(_0x3c61ff){freeIsNotKey(_0x3c61ff,_0x453e4b[_0x5b14('0x23')],'id');for(var _0x48bca2=0x0,_0x439817={},_0x404adb={};_0x48bca2<_0x3c61ff[_0x5b14('0x43')];_0x48bca2+=0x1){_0x439817=_0x3c61ff[_0x48bca2];if(_[_0x5b14('0x44')](_0x453e4b[_0x5b14('0x23')][_0x439817['id']])){_0x453e4b[_0x5b14('0x23')][_0x439817['id']]=new ServicenowAccount(_0x439817);}else{_0x453e4b[_0x5b14('0x3e')](_0x453e4b['servicenowAccounts'][_0x439817['id']],_0x439817);}}}return _0x453e4b['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x34e049=this;return function(_0x1f0867){if(_0x1f0867){freeIsNotKey(_0x1f0867,_0x34e049[_0x5b14('0x24')],'id');for(var _0x2d93a=0x0,_0x3666a2={},_0x58f544={};_0x2d93a<_0x1f0867['length'];_0x2d93a+=0x1){_0x3666a2=_0x1f0867[_0x2d93a];if(_[_0x5b14('0x44')](_0x34e049[_0x5b14('0x24')][_0x3666a2['id']])){_0x34e049[_0x5b14('0x24')][_0x3666a2['id']]=new Dynamics365Account(_0x3666a2);}else{_0x34e049[_0x5b14('0x3e')](_0x34e049[_0x5b14('0x24')][_0x3666a2['id']],_0x3666a2);}}}return _0x34e049['dynamics365Accounts'];};};Realtime['prototype'][_0x5b14('0x4c')]=function(){var _0x1b76a0=this;return function(_0x160a4f){if(_0x160a4f){freeIsNotKey(_0x160a4f,_0x1b76a0[_0x5b14('0x25')],'id');for(var _0x18de83=0x0,_0x1c464f={},_0x221759={};_0x18de83<_0x160a4f[_0x5b14('0x43')];_0x18de83+=0x1){_0x1c464f=_0x160a4f[_0x18de83];if(_[_0x5b14('0x44')](_0x1b76a0['freshsalesAccounts'][_0x1c464f['id']])){_0x1b76a0[_0x5b14('0x25')][_0x1c464f['id']]=new FreshsalesAccount(_0x1c464f);}else{_0x1b76a0['mergeFromDatabase'](_0x1b76a0[_0x5b14('0x25')][_0x1c464f['id']],_0x1c464f);}}}return _0x1b76a0[_0x5b14('0x25')];};};Realtime[_0x5b14('0x3f')][_0x5b14('0x4d')]=function(){var _0x4665d7=this;return function(_0x223faa){for(var _0x2b8286=0x0;_0x2b8286<_0x223faa['length'];_0x2b8286+=0x1){_['merge'](_0x4665d7[_0x5b14('0x14')][_0x223faa[_0x2b8286][_0x5b14('0x41')]],_0x223faa[_0x2b8286]);}return _0x4665d7[_0x5b14('0x14')];};};Realtime[_0x5b14('0x3f')][_0x5b14('0x4e')]=function(){var _0x54bbeb=this;return function(_0x1310a5){clearVoiceQueues(_0x54bbeb[_0x5b14('0x14')]);if(_0x1310a5){_0x1310a5=_[_0x5b14('0x4f')](_0x1310a5,_0x5b14('0x50'));for(var _0x3f717a in _0x1310a5){if(_0x1310a5[_0x5b14('0x29')](_0x3f717a)){var _0x350797={};for(var _0x12f46a=0x0;_0x12f46a<_0x1310a5[_0x3f717a][_0x5b14('0x43')];_0x12f46a+=0x1){var _0x718e6a=_0x1310a5[_0x3f717a][_0x12f46a]['queue'];if(_0x54bbeb['voiceQueues'][_0x718e6a]){if(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x51')]){_0x54bbeb[_0x5b14('0x14')][_0x718e6a]['unmanaged']+=0x1;}if(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x52')]){_0x54bbeb[_0x5b14('0x14')][_0x718e6a][_0x5b14('0x34')]+=0x1;}_0x54bbeb[_0x5b14('0x14')][_0x718e6a]['sumHoldTime']+=moment(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x53')])[_0x5b14('0x54')](moment(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x55')]),_0x5b14('0x56'))||0x0;if(_0x12f46a===_0x1310a5[_0x3f717a][_0x5b14('0x43')]-0x1){_0x54bbeb[_0x5b14('0x14')][_0x718e6a][_0x5b14('0x2f')]+=moment(_0x1310a5[_0x3f717a][_0x12f46a]['queuecallercompleteAt']||_0x1310a5[_0x3f717a][_0x12f46a]['queuecallerabandonAt']||_0x1310a5[_0x3f717a][_0x12f46a]['queuecallerexitAt'])[_0x5b14('0x54')](moment(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x55')]),_0x5b14('0x56'))||0x0;_0x54bbeb[_0x5b14('0x14')][_0x718e6a][_0x5b14('0x2d')]+=0x1;if(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x57')]){_0x54bbeb[_0x5b14('0x14')][_0x718e6a][_0x5b14('0x2e')]+=0x1;_0x54bbeb[_0x5b14('0x14')][_0x718e6a][_0x5b14('0x30')]+=moment(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x58')])['diff'](moment(_0x1310a5[_0x3f717a][_0x12f46a][_0x5b14('0x53')]),_0x5b14('0x56'))||0x0;}}else{_0x54bbeb[_0x5b14('0x14')][_0x718e6a][_0x5b14('0x2f')]+=_0x54bbeb['voiceQueues'][_0x718e6a][_0x5b14('0x35')]||0x0;}}}}}}return _0x54bbeb[_0x5b14('0x14')];};};Realtime[_0x5b14('0x3f')][_0x5b14('0x59')]=function(){var _0x27fe05=this;return function(_0x29b327){clearVoiceCallReports(_0x27fe05[_0x5b14('0x5a')]);if(_0x29b327){for(var _0x36589c=0x0;_0x36589c<_0x29b327[_0x5b14('0x43')];_0x36589c+=0x1){_0x27fe05[_0x5b14('0x5a')][_0x5b14('0x2d')]+=0x1;_0x27fe05[_0x5b14('0x5a')][_0x5b14('0x2f')]+=_0x29b327[_0x36589c][_0x5b14('0x5b')];if(_0x29b327[_0x36589c][_0x5b14('0x5c')]==='ANSWERED'){_0x27fe05[_0x5b14('0x5a')][_0x5b14('0x2e')]+=0x1;_0x27fe05[_0x5b14('0x5a')][_0x5b14('0x35')]+=_0x29b327[_0x36589c][_0x5b14('0x5b')]-_0x29b327[_0x36589c]['billableseconds']||0x0;_0x27fe05['outbound'][_0x5b14('0x30')]+=_0x29b327[_0x36589c]['billableseconds'];}}}return _0x27fe05[_0x5b14('0x5a')];};};Realtime[_0x5b14('0x3f')][_0x5b14('0x5d')]=function(){var _0x5ca3b0=this;return function(_0x1af04d){if(_0x1af04d){freeIsNotKey(_0x1af04d,_0x5ca3b0[_0x5b14('0x16')],'name');for(var _0x1f08e3=0x0,_0x47c338={};_0x1f08e3<_0x1af04d['length'];_0x1f08e3+=0x1){_0x47c338=_0x1af04d[_0x1f08e3];if(_[_0x5b14('0x44')](_0x5ca3b0[_0x5b14('0x16')][_0x47c338[_0x5b14('0x41')]])){_0x5ca3b0['campaigns'][_0x47c338['name']]=new Campaign(_0x47c338);}else{_0x5ca3b0['mergeFromDatabase'](_0x5ca3b0['campaigns'][_0x47c338[_0x5b14('0x41')]],_0x47c338);_0x5ca3b0[_0x5b14('0x16')][_0x47c338[_0x5b14('0x41')]]['dialQueueProject']=_0x47c338['SquareProject']?_0x47c338[_0x5b14('0x5e')][_0x5b14('0x41')]:undefined;}}}return _0x5ca3b0['campaigns'];};};Realtime[_0x5b14('0x3f')][_0x5b14('0x5f')]=function(){var _0x4bead1=this;return function(_0x4e7109){if(_0x4e7109){freeIsNotKey(_0x4e7109,_0x4bead1['voiceExtensions'],'id');for(var _0x522cc5=0x0,_0x33d7de={};_0x522cc5<_0x4e7109['length'];_0x522cc5+=0x1){_0x33d7de=_0x4e7109[_0x522cc5];if(_[_0x5b14('0x44')](_0x4bead1[_0x5b14('0x18')][_0x33d7de['id']])){_0x4bead1['voiceExtensions'][_0x33d7de['id']]=new VoiceExtension(_0x33d7de);}else{_0x4bead1[_0x5b14('0x3e')](_0x4bead1['voiceExtensions'][_0x33d7de['id']],_0x33d7de);}}}return _0x4bead1[_0x5b14('0x18')];};};Realtime['prototype'][_0x5b14('0x60')]=function(){var _0x250947=this;return function(_0x52df2d){clearCampaigns(_0x250947[_0x5b14('0x16')]);for(var _0x14b2e9=0x0;_0x14b2e9<_0x52df2d[_0x5b14('0x43')];_0x14b2e9+=0x1){_[_0x5b14('0x61')](_0x250947['campaigns'][_0x52df2d[_0x14b2e9][_0x5b14('0x41')]],_0x52df2d[_0x14b2e9]);}return _0x250947[_0x5b14('0x16')];};};Realtime['prototype'][_0x5b14('0x62')]=function(){var _0x4042ec=this;return function(_0x3f8876){if(_0x3f8876){freeIsNotKey(_0x3f8876,_0x4042ec['faxAccounts'],'id');for(var _0x22eef3=0x0,_0x3e22b9={},_0xe32822={};_0x22eef3<_0x3f8876['length'];_0x22eef3+=0x1){_0x3e22b9=_0x3f8876[_0x22eef3];if(_[_0x5b14('0x44')](_0x4042ec['faxAccounts'][_0x3e22b9['id']])){_0x4042ec[_0x5b14('0x26')][_0x3e22b9['id']]=new FaxAccount(_0x3e22b9);}else{_0x4042ec['mergeFromDatabase'](_0x4042ec[_0x5b14('0x26')][_0x3e22b9['id']],_0x3e22b9);}}}return _0x4042ec[_0x5b14('0x26')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4056f1c..dc749ed 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 _0xbc48=['telephones','prototype','sync','disabled','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','assigned','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','calleridname','transfers','linkedid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','isArray','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','util','../../../config/environment','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbc48,0x9b));var _0x8bc4=function(_0x548017,_0x1ee984){_0x548017=_0x548017-0x0;var _0x5bec3e=_0xbc48[_0x548017];return _0x5bec3e;};'use strict';var _=require(_0x8bc4('0x0'));var moment=require('moment');var util=require(_0x8bc4('0x1'));var config=require(_0x8bc4('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x8bc4('0x3'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x8bc4('0x4'));var RpcVoiceRecording=require(_0x8bc4('0x5'));var RpcVoiceTransferReport=require(_0x8bc4('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8bc4('0x7'));var VoiceAgentReport=require(_0x8bc4('0x8'));var VoiceDialReport=require(_0x8bc4('0x9'));var UserReport=require(_0x8bc4('0xa'));function Report(_0x1b788b){this[_0x8bc4('0xb')]=_0x1b788b;this[_0x8bc4('0xc')]=_0x1b788b[_0x8bc4('0xc')];this[_0x8bc4('0xd')]=_0x1b788b[_0x8bc4('0xd')];}Report[_0x8bc4('0xe')][_0x8bc4('0xf')]=function(_0x30babd){var _0x257d18=new VoiceQueueReport(this[_0x8bc4('0xb')]);var _0x2ba42d=new VoiceAgentReport(this['realtime']);var _0x512d40=new VoiceDialReport(this[_0x8bc4('0xb')]);var _0x37fb20=new VoiceCallReport(this['realtime']);var _0x3c03d9=new UserReport(this[_0x8bc4('0xb')]);if(config['xdr']&&config['xdr'][_0x8bc4('0x10')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x8bc4('0x11')](this));ami['on'](_0x8bc4('0x12'),this[_0x8bc4('0x13')][_0x8bc4('0x11')](this));ami['on'](_0x8bc4('0x14'),this[_0x8bc4('0x15')][_0x8bc4('0x11')](this));ami['on'](_0x8bc4('0x16'),this[_0x8bc4('0x17')][_0x8bc4('0x11')](this));ami['on'](_0x8bc4('0x18'),this[_0x8bc4('0x19')][_0x8bc4('0x11')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x8bc4('0x11')](this));}};Report[_0x8bc4('0xe')][_0x8bc4('0x1a')]=function(_0x482295){var _0x418b9b;_0x418b9b=_[_0x8bc4('0x1b')](this['agents'],function(_0x5a9882){return _0x5a9882[_0x8bc4('0x1c')]==_0x482295||_0x5a9882[_0x8bc4('0x1d')]==_0x482295;});if(_[_0x8bc4('0x1e')](_0x418b9b)){var _0x2cf93b=_[_0x8bc4('0x1b')](this[_0x8bc4('0xd')],function(_0x385396){return _0x385396['accountcode']==_0x482295||_0x385396['name']==_0x482295;});if(_0x2cf93b){_0x418b9b=_[_0x8bc4('0x1b')](this['agents'],function(_0xdc6622){return _0xdc6622['interface']==util[_0x8bc4('0x1f')](_0x8bc4('0x20'),_0x2cf93b['name']);});}}return _0x418b9b;};Report[_0x8bc4('0xe')]['voiceQueueReport']=function(_0x411ff4){for(var _0x327edb=0x0;_0x327edb<_0x411ff4[_0x8bc4('0x21')];_0x327edb+=0x1){var _0x166d34=this['findAgent'](_0x411ff4[_0x327edb][_0x8bc4('0x22')]);if(_0x166d34){_0x411ff4[_0x327edb]['accountcode']=_0x166d34['accountcode'];_0x411ff4[_0x327edb][_0x8bc4('0x23')]=!![];_0x411ff4[_0x327edb]['lastAssignedTo']=_0x166d34[_0x8bc4('0x1d')];_0x411ff4[_0x327edb][_0x8bc4('0x24')]=_[_0x8bc4('0x1e')](_0x166d34['interface'])?util['format'](_0x8bc4('0x20'),_0x166d34[_0x8bc4('0x1d')]):_0x166d34['interface'];if(_0x411ff4[_0x327edb]['queuecallercomplete']){_0x411ff4[_0x327edb][_0x8bc4('0x25')]=moment()[_0x8bc4('0x1f')](_0x8bc4('0x26'));}if(_0x411ff4[_0x327edb]['queuecallerexit']){_0x411ff4[_0x327edb][_0x8bc4('0x27')]=moment()[_0x8bc4('0x1f')](_0x8bc4('0x26'));}RpcMemberReport['voiceQueueReport'](_0x411ff4[_0x327edb]);}RpcVoiceQueueReport[_0x8bc4('0x28')](_0x411ff4[_0x327edb]);}};function extractCalleridNumber(_0x768ca2){var _0xae64d=_0x768ca2['match'](/<(.*?)>/);return _0xae64d?_0xae64d[0x1]:_0x768ca2;}Report['prototype'][_0x8bc4('0x29')]=function(_0x209cff){for(var _0x379198=0x0;_0x379198',_0x17ab04[_0x8bc4('0x3e')],_0x17ab04[_0x8bc4('0x2d')]);}if(RpcVoiceTransferReport[_0x8bc4('0x3f')][_0x17ab04[_0x8bc4('0x40')]]){var _0x3d94a7=RpcVoiceTransferReport['transfers'][_0x17ab04[_0x8bc4('0x40')]];_0x3d94a7['transfereelinkedid']=_0x17ab04['uniqueid'];RpcVoiceTransferReport[_0x8bc4('0x19')](_0x3d94a7);delete RpcVoiceTransferReport[_0x8bc4('0x3f')][_0x17ab04['linkedid']];}if(_[_0x8bc4('0x1e')](_0x17ab04['type'])){_0x17ab04[_0x8bc4('0x31')]=this[_0x8bc4('0x2b')](_0x17ab04);}if(_[_0x8bc4('0x1e')](_0x17ab04[_0x8bc4('0x41')])){var _0xa44f2=_0x17ab04[_0x8bc4('0x3a')]['split']('-')[0x0];var _0x46e2ce=this[_0x8bc4('0xc')][_0xa44f2];if(!_0x46e2ce)_0x46e2ce=this[_0x8bc4('0x29')](_0x17ab04['accountcode']);if(_0x46e2ce){_0x17ab04['UserId']=_0x46e2ce['id'];_0x17ab04[_0x8bc4('0x42')]=_0x46e2ce[_0x8bc4('0x1d')];}}RpcVoiceCallReport[_0x8bc4('0x28')](_0x17ab04);if(_0x17ab04[_0x8bc4('0x43')]){for(var _0x42cc39=0x0;_0x42cc39<_0x17ab04[_0x8bc4('0x44')][_0x8bc4('0x21')];_0x42cc39+=0x1){_0x17ab04[_0x8bc4('0x45')]=_0x17ab04[_0x8bc4('0x44')][_0x42cc39][_0x8bc4('0x46')];_0x17ab04[_0x8bc4('0x47')]=_0x17ab04[_0x8bc4('0x44')][_0x42cc39][_0x8bc4('0x47')];if(_0x17ab04[_0x8bc4('0x30')]==_0x8bc4('0x48')){_0x17ab04[_0x8bc4('0x2d')]=_0x17ab04['connectedlinenum'];_0x17ab04['calleridname']=_0x17ab04['connectedlinename'];_0x17ab04[_0x8bc4('0x22')]=_0x17ab04[_0x8bc4('0x1c')];_0x17ab04[_0x8bc4('0x49')]=_0x17ab04['membername'];_0x17ab04[_0x8bc4('0x30')]=_0x17ab04[_0x8bc4('0x38')];}else if(_0x17ab04[_0x8bc4('0x30')]=='xcally-motion-dialer'){_0x17ab04[_0x8bc4('0x2d')]=_0x17ab04[_0x8bc4('0x2f')];_0x17ab04[_0x8bc4('0x30')]=_0x17ab04[_0x8bc4('0x38')];}RpcVoiceRecording[_0x8bc4('0x28')](_0x17ab04);}}};Report[_0x8bc4('0xe')][_0x8bc4('0x15')]=function(_0xd8c58c){if(_[_0x8bc4('0x4a')](_0xd8c58c)){_0xd8c58c['forEach'](function(_0x481778){RpcVoiceAgentReport[_0x8bc4('0x28')](_0x481778);});}else{RpcVoiceAgentReport[_0x8bc4('0x28')](_0xd8c58c);}};Report[_0x8bc4('0xe')]['voiceDialReport']=function(_0x4698c6){RpcVoiceDialReport[_0x8bc4('0x28')](_0x4698c6);var _0x5b39d3;var _0x58c9d4;var _0x1766ec=_0x4698c6[_0x8bc4('0x3a')];if(_['startsWith'](_0x1766ec,_0x8bc4('0x4b'))){_0x58c9d4=_0x1766ec[_0x8bc4('0x4c')](_0x1766ec['indexOf']('/')+0x1,_0x1766ec[_0x8bc4('0x4d')]('@'));_0x5b39d3=_['find'](this['agents'],function(_0x1c7785){return _0x1c7785[_0x8bc4('0x4e')]==_0x58c9d4||_0x1c7785[_0x8bc4('0x4f')]==_0x58c9d4||_0x1c7785[_0x8bc4('0x1c')]==_0x58c9d4;});}else{_0x58c9d4=_0x1766ec[_0x8bc4('0x4c')](_0x1766ec[_0x8bc4('0x4d')]('/')+0x1,_0x1766ec[_0x8bc4('0x50')]('-'));_0x5b39d3=this[_0x8bc4('0x1a')](_0x58c9d4);}if(_0x5b39d3){_0x4698c6['interface']=_['isNil'](_0x5b39d3['interface'])?util[_0x8bc4('0x1f')](_0x8bc4('0x20'),_0x5b39d3[_0x8bc4('0x1d')]):_0x5b39d3[_0x8bc4('0x24')];_0x4698c6['membername']=_0x5b39d3[_0x8bc4('0x1d')];_0x4698c6[_0x8bc4('0x1c')]=_0x5b39d3['accountcode'];RpcMemberReport['voiceDialReport'](_0x4698c6);}};Report[_0x8bc4('0xe')]['blindTransfer']=function(_0x3e904f){RpcVoiceTransferReport['transfers'][_0x3e904f[_0x8bc4('0x51')]]=_0x3e904f;};Report[_0x8bc4('0xe')][_0x8bc4('0x52')]=function(_0x570692){RpcVoiceTransferReport['attendedTransfer'](_0x570692);};module[_0x8bc4('0x53')]=Report; \ No newline at end of file +var _0xdb88=['exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','UserId','split','getAgentByInternal','monitor','filename','createdAt','monitors','connectedlinename','xcally-motion-dialer','originatecalleridnum','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','length','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallerexitAt','create','match','keys','getCallType','channel','internal','destination'];(function(_0xadbe21,_0x1f367e){var _0x283c67=function(_0x19100c){while(--_0x19100c){_0xadbe21['push'](_0xadbe21['shift']());}};_0x283c67(++_0x1f367e);}(_0xdb88,0x13a));var _0x8db8=function(_0x46adcd,_0x15c37b){_0x46adcd=_0x46adcd-0x0;var _0x2f9454=_0xdb88[_0x46adcd];return _0x2f9454;};'use strict';var _=require(_0x8db8('0x0'));var moment=require(_0x8db8('0x1'));var util=require(_0x8db8('0x2'));var config=require('../../../config/environment');var ami=require(_0x8db8('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x8db8('0x4'));var RpcVoiceDialReport=require(_0x8db8('0x5'));var RpcMemberReport=require(_0x8db8('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x8db8('0x7'));var RpcVoiceTransferReport=require(_0x8db8('0x8'));var VoiceQueueReport=require(_0x8db8('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x8db8('0xa'));var VoiceDialReport=require(_0x8db8('0xb'));var UserReport=require('./userReport');function Report(_0x456fed){this[_0x8db8('0xc')]=_0x456fed;this[_0x8db8('0xd')]=_0x456fed[_0x8db8('0xd')];this['telephones']=_0x456fed[_0x8db8('0xe')];}Report[_0x8db8('0xf')][_0x8db8('0x10')]=function(_0x1901f9){var _0x1f0c7f=new VoiceQueueReport(this[_0x8db8('0xc')]);var _0x226122=new VoiceAgentReport(this['realtime']);var _0x529173=new VoiceDialReport(this[_0x8db8('0xc')]);var _0x37546d=new VoiceCallReport(this[_0x8db8('0xc')]);var _0x23ff03=new UserReport(this[_0x8db8('0xc')]);if(config[_0x8db8('0x11')]&&config[_0x8db8('0x11')][_0x8db8('0x12')]){ami['on'](_0x8db8('0x13'),this[_0x8db8('0x14')][_0x8db8('0x15')](this));ami['on'](_0x8db8('0x16'),this[_0x8db8('0x17')]['bind'](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x8db8('0x15')](this));ami['on'](_0x8db8('0x18'),this[_0x8db8('0x19')]['bind'](this));ami['on'](_0x8db8('0x1a'),this['blindTransfer'][_0x8db8('0x15')](this));ami['on'](_0x8db8('0x1b'),this[_0x8db8('0x1c')][_0x8db8('0x15')](this));}};Report['prototype'][_0x8db8('0x1d')]=function(_0x3f42e5){var _0x493571;_0x493571=_[_0x8db8('0x1e')](this[_0x8db8('0xd')],function(_0x66f95c){return _0x66f95c[_0x8db8('0x1f')]==_0x3f42e5||_0x66f95c[_0x8db8('0x20')]==_0x3f42e5;});if(_['isNil'](_0x493571)){var _0x5cc7b4=_[_0x8db8('0x1e')](this[_0x8db8('0xe')],function(_0x1dca9b){return _0x1dca9b['accountcode']==_0x3f42e5||_0x1dca9b[_0x8db8('0x20')]==_0x3f42e5;});if(_0x5cc7b4){_0x493571=_['find'](this[_0x8db8('0xd')],function(_0x491692){return _0x491692[_0x8db8('0x21')]==util[_0x8db8('0x22')]('SIP/%s',_0x5cc7b4[_0x8db8('0x20')]);});}}return _0x493571;};Report['prototype'][_0x8db8('0x14')]=function(_0x577f83){for(var _0x283a5d=0x0;_0x283a5d<_0x577f83[_0x8db8('0x23')];_0x283a5d+=0x1){var _0x4a9172=this[_0x8db8('0x1d')](_0x577f83[_0x283a5d][_0x8db8('0x24')]);if(_0x4a9172){_0x577f83[_0x283a5d][_0x8db8('0x1f')]=_0x4a9172[_0x8db8('0x1f')];_0x577f83[_0x283a5d][_0x8db8('0x25')]=!![];_0x577f83[_0x283a5d][_0x8db8('0x26')]=_0x4a9172[_0x8db8('0x20')];_0x577f83[_0x283a5d][_0x8db8('0x21')]=_[_0x8db8('0x27')](_0x4a9172[_0x8db8('0x21')])?util[_0x8db8('0x22')](_0x8db8('0x28'),_0x4a9172[_0x8db8('0x20')]):_0x4a9172['interface'];if(_0x577f83[_0x283a5d][_0x8db8('0x29')]){_0x577f83[_0x283a5d]['queuecallercompleteAt']=moment()[_0x8db8('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x577f83[_0x283a5d]['queuecallerexit']){_0x577f83[_0x283a5d][_0x8db8('0x2a')]=moment()[_0x8db8('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x8db8('0x14')](_0x577f83[_0x283a5d]);}RpcVoiceQueueReport[_0x8db8('0x2b')](_0x577f83[_0x283a5d]);}};function extractCalleridNumber(_0x303c5b){var _0x2b3f55=_0x303c5b[_0x8db8('0x2c')](/<(.*?)>/);return _0x2b3f55?_0x2b3f55[0x1]:_0x303c5b;}Report[_0x8db8('0xf')]['getAgentByInternal']=function(_0x42c435){for(var _0xeade34=0x0;_0xeade340x0?_0x4ad0a3:0x0;this[_0xe060('0x10')][_0x39fae4[_0xe060('0x69')]]['talking']=this['voiceQueues'][_0x39fae4[_0xe060('0x69')]][_0xe060('0x30')]>_[_0xe060('0x6e')](_0x39fae4[_0xe060('0x6f')])?_[_0xe060('0x6e')](_0x39fae4['loggedin']):this[_0xe060('0x10')][_0x39fae4[_0xe060('0x69')]][_0xe060('0x30')];this[_0xe060('0x51')](this[_0xe060('0x10')][_0x39fae4[_0xe060('0x69')]],'queuesummary');}logger[_0xe060('0x44')](_0xe060('0x70'),util[_0xe060('0x3c')](this[_0xe060('0x10')][_0x39fae4[_0xe060('0x69')]],{'showHidden':![],'depth':null}));ami[_0xe060('0x42')](_0xe060('0x71'),this[_0xe060('0x10')][_0x39fae4[_0xe060('0x69')]]);}}}catch(_0x4a0b6b){logger[_0xe060('0x3d')](_0xe060('0x72'),util[_0xe060('0x3c')](_0x4a0b6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe060('0x17')]=function(_0x4561be){logger['debug'](_0xe060('0x73'),util[_0xe060('0x3c')](_0x4561be,{'showHidden':![],'depth':null}));ami[_0xe060('0x42')](_0xe060('0x74'),{});this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0xe060('0x19')]=function(_0x200f34){try{if(this[_0xe060('0x63')](_0x200f34)){logger[_0xe060('0x44')](_0xe060('0x75'),_0x200f34[_0xe060('0x46')],util[_0xe060('0x3c')](_0x200f34,{'showHidden':![],'depth':null}));if(_[_0xe060('0x64')](this[_0xe060('0xd')][_0x200f34['uniqueid']]))this[_0xe060('0xd')][_0x200f34[_0xe060('0x46')]]=[];if(_[_0xe060('0x64')](this[_0xe060('0xe')][_0x200f34[_0xe060('0x46')]]))this[_0xe060('0xe')][_0x200f34[_0xe060('0x46')]]={};var _0x367026=new QueueReport();_0x367026[_0xe060('0x48')]=_0x200f34[_0xe060('0x69')];_0x367026[_0xe060('0x58')]=this[_0xe060('0x10')][_0x367026['name']]&&this[_0xe060('0x10')][_0x367026[_0xe060('0x48')]]['type']?this['voiceQueues'][_0x367026[_0xe060('0x48')]]['type']||_0xe060('0x76'):_0xe060('0x76');_0x367026['queue']=_0x200f34[_0xe060('0x69')];_0x367026['queuecallerjoinAt']=moment()[_0xe060('0x47')](_0xe060('0x77'));_0x367026['position']=_0x200f34[_0xe060('0x78')];_0x367026[_0xe060('0x79')]=_0x200f34[_0xe060('0x79')];_0x367026[_0xe060('0x46')]=_0x200f34[_0xe060('0x46')];_0x367026[_0xe060('0x7a')]=this[_0xe060('0xe')][_0x200f34['uniqueid']][_0xe060('0x7a')];logger['info'](_0xe060('0x7b'),_0x367026[_0xe060('0x48')],_0x367026['type']);_[_0xe060('0x7c')](_0x367026,_[_0xe060('0x7d')](_0x200f34,_[_0xe060('0x7e')](_0x367026)));this[_0xe060('0xd')][_0x200f34[_0xe060('0x46')]][_0xe060('0x7f')](_0x367026);this[_0xe060('0xe')][_0x200f34[_0xe060('0x46')]]=_0x367026;this[_0xe060('0x43')](_0x367026,_0xe060('0x18'));}}catch(_0x440c99){logger[_0xe060('0x3d')](_0xe060('0x75'),_0x200f34[_0xe060('0x46')],util[_0xe060('0x3c')](_0x440c99,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe060('0x8')]['syncQueueCallerAbandon']=function(_0x67f49b){try{if(this['isNotNull'](_0x67f49b)){logger[_0xe060('0x44')](_0xe060('0x80'),_0x67f49b['uniqueid'],util['inspect'](_0x67f49b,{'showHidden':![],'depth':null}));if(this[_0xe060('0xd')][_0x67f49b[_0xe060('0x46')]]){var _0x2be9cd=_['last'](this[_0xe060('0xd')][_0x67f49b['uniqueid']]);_0x2be9cd[_0xe060('0x81')]=![];_0x2be9cd[_0xe060('0x82')]=null;_0x2be9cd[_0xe060('0x83')]=_0x67f49b[_0xe060('0x83')];_0x2be9cd[_0xe060('0x84')]=_0x67f49b[_0xe060('0x84')];_0x2be9cd[_0xe060('0x1a')]=!![];_0x2be9cd[_0xe060('0x85')]=moment()[_0xe060('0x47')](_0xe060('0x77'));_0x2be9cd[_0xe060('0x86')]=_0xe060('0x87');_0x2be9cd[_0xe060('0x88')]=null;logger[_0xe060('0x6b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2be9cd[_0xe060('0x48')],_0x2be9cd[_0xe060('0x58')]);this[_0xe060('0xe')][_0x67f49b[_0xe060('0x46')]]=_0x2be9cd;this['emitVoiceQueueChannelRemove'](_0x2be9cd,'queuecallerabandon');}}}catch(_0x2d2726){logger[_0xe060('0x3d')](_0xe060('0x80'),_0x67f49b[_0xe060('0x46')],util['inspect'](_0x2d2726,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe060('0x8')][_0xe060('0x1d')]=function(_0xe43c9b){try{if(this[_0xe060('0x63')](_0xe43c9b)){logger['debug'](_0xe060('0x89'),_0xe43c9b[_0xe060('0x46')],util[_0xe060('0x3c')](_0xe43c9b,{'showHidden':![],'depth':null}));if(this[_0xe060('0xd')][_0xe43c9b[_0xe060('0x46')]]){var _0x3efe73=_[_0xe060('0x8a')](this[_0xe060('0xd')][_0xe43c9b[_0xe060('0x46')]]);_0x3efe73[_0xe060('0x8b')]=moment()[_0xe060('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x3efe73['connectedlinenum']=_0xe43c9b[_0xe060('0x8c')];_0x3efe73['connectedlinename']=_0xe43c9b['connectedlinename'];logger['info'](_0xe060('0x8d'),_0x3efe73[_0xe060('0x48')],_0x3efe73[_0xe060('0x58')],_0xe43c9b[_0xe060('0x8c')],_0xe43c9b[_0xe060('0x8e')]);this['channels'][_0xe43c9b['uniqueid']]=_0x3efe73;this[_0xe060('0x43')](_0x3efe73,_0xe060('0x1c'));}}}catch(_0x55781){logger[_0xe060('0x3d')]('[%s][voiceQueueReport][queuecallerleave]',_0xe43c9b['uniqueid'],util['inspect'](_0x55781,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe060('0x8')][_0xe060('0x21')]=function(_0x118314){try{if(this['isNotNull'](_0x118314)){logger[_0xe060('0x44')](_0xe060('0x8f'),_0x118314[_0xe060('0x46')],util['inspect'](_0x118314,{'showHidden':![],'depth':null}));if(this[_0xe060('0xd')][_0x118314[_0xe060('0x46')]]){var _0x127226=_[_0xe060('0x8a')](this[_0xe060('0xd')][_0x118314['uniqueid']]);_0x127226[_0xe060('0x81')]=!![];_0x127226[_0xe060('0x86')]=_0xe060('0x90');logger['info'](_0xe060('0x91'),_0x127226[_0xe060('0x48')],_0x127226[_0xe060('0x58')]);}}}catch(_0xffe4be){logger[_0xe060('0x3d')](_0xe060('0x8f'),_0x118314['uniqueid'],util[_0xe060('0x3c')](_0xffe4be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe060('0x8')][_0xe060('0x1f')]=function(_0x437498){try{if(this[_0xe060('0x63')](_0x437498)){logger[_0xe060('0x44')](_0xe060('0x92'),_0x437498[_0xe060('0x46')],util[_0xe060('0x3c')](_0x437498,{'showHidden':![],'depth':null}));if(this[_0xe060('0xd')][_0x437498[_0xe060('0x46')]]){var _0x342c7a=_[_0xe060('0x8a')](this[_0xe060('0xd')][_0x437498[_0xe060('0x46')]]);_0x342c7a[_0xe060('0x1a')]=![];_0x342c7a[_0xe060('0x85')]=null;_0x342c7a[_0xe060('0x93')]=!![];_0x342c7a[_0xe060('0x88')]=_0x437498[_0xe060('0x94')];_0x342c7a[_0xe060('0x83')]=_0x437498[_0xe060('0x83')];_0x342c7a[_0xe060('0x81')]=!![];_0x342c7a['queuecallerexit']=![];_0x342c7a[_0xe060('0x95')]=null;if(!_0x342c7a[_0xe060('0x96')]){if(_0x437498[_0xe060('0x97')]==_0xe060('0x96')){_0x342c7a[_0xe060('0x86')]=_0xe060('0x98');logger[_0xe060('0x6b')](_0xe060('0x99'),_0x342c7a[_0xe060('0x48')],_0x342c7a[_0xe060('0x58')]);}else{if(_['startsWith'](_0x437498['channel'][_0xe060('0x9a')](),'local/')){if(this[_0xe060('0xd')][_0x437498['linkedid']]){var _0x119024=_[_0xe060('0x8a')](this['queueReports'][_0x437498['linkedid']]);_0x119024[_0xe060('0x81')]=![];_0x119024[_0xe060('0x9b')]=!![];_0x119024[_0xe060('0x95')]=moment(_0x342c7a['queuecallerjoinAt'])['add'](_0x437498[_0xe060('0x83')],'seconds')['format'](_0xe060('0x77'));_0x119024['queuecallerexitreason']=_0xe060('0x9c');_0x119024[_0xe060('0x96')]=!![];_0x119024[_0xe060('0x9d')]=_0xe060('0x9e');_0x119024[_0xe060('0x9f')]=_0x437498[_0xe060('0xa0')];_0x119024[_0xe060('0xa1')]=_0x437498[_0xe060('0x46')];logger['info'](_0xe060('0xa2'),_0x119024['name'],_0x119024[_0xe060('0x58')]);var _0x366d6e=this[_0xe060('0xd')][_0x437498[_0xe060('0xa3')]];this[_0xe060('0xd')][_0x437498[_0xe060('0xa3')]]=this[_0xe060('0xd')][_0x437498[_0xe060('0x46')]];this['queueReports'][_0x437498[_0xe060('0x46')]]=_0x366d6e;}}else{_0x342c7a['queuecallerexitreason']=_0xe060('0xa4')+_0x437498[_0xe060('0x97')][_0xe060('0xa5')]();logger[_0xe060('0x6b')](_0xe060('0xa6'),_0x342c7a[_0xe060('0x48')],_0x342c7a[_0xe060('0x58')],_0x342c7a['queuecallerexitreason']);}}}this[_0xe060('0xe')][_0x437498['uniqueid']]=_0x342c7a;this[_0xe060('0xa7')](_0x342c7a,_0xe060('0x1e'));}}}catch(_0x70f670){logger['error'](_0xe060('0x92'),_0x437498[_0xe060('0x46')],util[_0xe060('0x3c')](_0x70f670,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe060('0x8')][_0xe060('0x23')]=function(_0x4f698b){try{if(this[_0xe060('0x63')](_0x4f698b)){logger['debug'](_0xe060('0xa8'),_0x4f698b[_0xe060('0x46')],util['inspect'](_0x4f698b,{'showHidden':![],'depth':null}));this[_0xe060('0xa9')](_0x4f698b[_0xe060('0x46')],_[_0xe060('0x7e')](_0x4f698b['variable'])[0x0],_0x4f698b[_0xe060('0xaa')]);if(this['queueReports'][_0x4f698b[_0xe060('0x46')]]){var _0x4a393f=_[_0xe060('0x8a')](this[_0xe060('0xd')][_0x4f698b[_0xe060('0x46')]]);if(_0x4a393f){if(this[_0xe060('0x63')](_0x4f698b[_0xe060('0xab')])&&this[_0xe060('0x63')](_0x4f698b[_0xe060('0xab')][_0xe060('0xac')])){switch(_0x4f698b[_0xe060('0xaa')]){case _0xe060('0xad'):_0x4a393f[_0xe060('0x9b')]=![];_0x4a393f['queuecallerexitAt']=null;break;case'TIMEOUT':_0x4a393f[_0xe060('0xae')]='timeout';_0x4a393f[_0xe060('0x9b')]=!![];_0x4a393f['queuecallerexitAt']=moment()[_0xe060('0x47')](_0xe060('0x77'));_0x4a393f[_0xe060('0x8b')]=moment()[_0xe060('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xe060('0x44')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x4f698b[_0xe060('0x46')],util[_0xe060('0x3c')](_0x4a393f,{'showHidden':![],'depth':null}));ami[_0xe060('0x42')](_0xe060('0xaf'),_0x4a393f);break;default:_0x4a393f[_0xe060('0x9b')]=!![];_0x4a393f['queuecallerexitAt']=moment()[_0xe060('0x47')](_0xe060('0x77'));_0x4a393f[_0xe060('0x8b')]=moment()[_0xe060('0x47')](_0xe060('0x77'));}_0x4a393f['queuecallerabandon']=![];_0x4a393f[_0xe060('0x85')]=null;_0x4a393f['queuecallerexitreason']=_0x4f698b[_0xe060('0xaa')];this[_0xe060('0xe')][_0x4f698b[_0xe060('0x46')]]=_0x4a393f;this['emitVoiceQueueChannelRemove'](_0x4a393f,'varset');}else if(this['isNotNull'](_0x4f698b[_0xe060('0xab')])&&this[_0xe060('0x63')](_0x4f698b[_0xe060('0xab')][_0xe060('0xb0')])){if(!_0x4a393f[_0xe060('0x1a')]){_0x4a393f[_0xe060('0x9b')]=!![];_0x4a393f[_0xe060('0x95')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4a393f['queuecallerexitreason']=_0xe060('0xb1');_0x4a393f[_0xe060('0x8b')]=moment()['format'](_0xe060('0x77'));this[_0xe060('0xe')][_0x4f698b['uniqueid']]=_0x4a393f;}}logger['info'](_0xe060('0xb2'),_0x4f698b[_0xe060('0x46')],_0x4a393f[_0xe060('0x48')],_0x4a393f[_0xe060('0x58')],_['keys'](_0x4f698b['variable'])[0x0],_0x4f698b[_0xe060('0xaa')]);_0x4a393f['variables']=this['variables'][_0x4f698b[_0xe060('0x46')]];}}}}catch(_0x4d2b7){logger[_0xe060('0x3d')](_0xe060('0xa8'),_0x4f698b[_0xe060('0x46')],util['inspect'](_0x4d2b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x2bcea6,_0x461f70,_0x4bad25){var _0x1296b5=[_0xe060('0xb3'),_0xe060('0xb4'),_0xe060('0xb5'),_0xe060('0xb6'),_0xe060('0xb7'),'rtpaudioqoslossbridged',_0xe060('0xb8'),_0xe060('0xb9'),_0xe060('0xba'),_0xe060('0xbb'),'bridgepeer','bridgepvtcallid',_0xe060('0xbc'),'memberdynamic',_0xe060('0xbd'),'memberlastcall',_0xe060('0x94'),'memberpenalty',_0xe060('0xbe')];if(!_[_0xe060('0xbf')](_0x461f70)&&!_[_0xe060('0xc0')](_0x1296b5,_0x461f70)){if(_[_0xe060('0x64')](this[_0xe060('0x13')][_0x2bcea6])){this[_0xe060('0x13')][_0x2bcea6]={};}this['variables'][_0x2bcea6][_0x461f70]=_0x4bad25;}};VoiceQueueReport['prototype'][_0xe060('0xc1')]=function(_0x2e8877,_0x482776,_0x33eeff){var _0x200846={};for(var _0x20cf7b=0x0;_0x20cf7b0x0?_0x41d30c:0x0;this[_0xabcf('0x3f')][_0x1d1a99['queue']]['talking']=this[_0xabcf('0x3f')][_0x1d1a99[_0xabcf('0x6d')]][_0xabcf('0x2f')]>_[_0xabcf('0x6e')](_0x1d1a99['loggedin'])?_[_0xabcf('0x6e')](_0x1d1a99[_0xabcf('0x70')]):this['voiceQueues'][_0x1d1a99[_0xabcf('0x6d')]][_0xabcf('0x2f')];this[_0xabcf('0x4e')](this['voiceQueues'][_0x1d1a99['queue']],_0xabcf('0x14'));}logger[_0xabcf('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xabcf('0x3c')](this[_0xabcf('0x3f')][_0x1d1a99[_0xabcf('0x6d')]],{'showHidden':![],'depth':null}));ami['emit'](_0xabcf('0x71'),this[_0xabcf('0x3f')][_0x1d1a99[_0xabcf('0x6d')]]);}}}catch(_0x2dfa1d){logger[_0xabcf('0x64')](_0xabcf('0x67'),util[_0xabcf('0x3c')](_0x2dfa1d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabcf('0x9')][_0xabcf('0x17')]=function(_0x48c486){logger[_0xabcf('0x44')](_0xabcf('0x72'),util[_0xabcf('0x3c')](_0x48c486,{'showHidden':![],'depth':null}));ami[_0xabcf('0x42')](_0xabcf('0x73'),{});this[_0xabcf('0x11')]=!![];};VoiceQueueReport[_0xabcf('0x9')]['syncQueueCallerJoin']=function(_0x5d3601){try{if(this[_0xabcf('0x68')](_0x5d3601)){logger[_0xabcf('0x44')](_0xabcf('0x74'),_0x5d3601[_0xabcf('0x47')],util[_0xabcf('0x3c')](_0x5d3601,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xabcf('0xe')][_0x5d3601[_0xabcf('0x47')]]))this[_0xabcf('0xe')][_0x5d3601[_0xabcf('0x47')]]=[];if(_[_0xabcf('0x62')](this[_0xabcf('0x10')][_0x5d3601[_0xabcf('0x47')]]))this[_0xabcf('0x10')][_0x5d3601['uniqueid']]={};var _0xab5b48=new QueueReport();_0xab5b48[_0xabcf('0x4a')]=_0x5d3601[_0xabcf('0x6d')];_0xab5b48[_0xabcf('0x4f')]=this[_0xabcf('0x3f')][_0xab5b48['name']]&&this[_0xabcf('0x3f')][_0xab5b48[_0xabcf('0x4a')]]['type']?this[_0xabcf('0x3f')][_0xab5b48['name']][_0xabcf('0x4f')]||_0xabcf('0x50'):_0xabcf('0x50');_0xab5b48[_0xabcf('0x6d')]=_0x5d3601[_0xabcf('0x6d')];_0xab5b48[_0xabcf('0x75')]=moment()['format'](_0xabcf('0x76'));_0xab5b48['position']=_0x5d3601[_0xabcf('0x77')];_0xab5b48[_0xabcf('0x78')]=_0x5d3601['count'];_0xab5b48[_0xabcf('0x47')]=_0x5d3601[_0xabcf('0x47')];_0xab5b48[_0xabcf('0x79')]=this[_0xabcf('0x10')][_0x5d3601[_0xabcf('0x47')]][_0xabcf('0x79')];logger[_0xabcf('0x6a')](_0xabcf('0x7a'),_0xab5b48[_0xabcf('0x4a')],_0xab5b48[_0xabcf('0x4f')]);_['merge'](_0xab5b48,_[_0xabcf('0x7b')](_0x5d3601,_[_0xabcf('0x7c')](_0xab5b48)));this['queueReports'][_0x5d3601[_0xabcf('0x47')]]['push'](_0xab5b48);this[_0xabcf('0x10')][_0x5d3601[_0xabcf('0x47')]]=_0xab5b48;this[_0xabcf('0x43')](_0xab5b48,_0xabcf('0x18'));}}catch(_0x4b69c6){logger[_0xabcf('0x64')]('[%s][voiceQueueReport][queuecallerjoin]',_0x5d3601[_0xabcf('0x47')],util['inspect'](_0x4b69c6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabcf('0x9')][_0xabcf('0x1a')]=function(_0x52b763){try{if(this['isNotNull'](_0x52b763)){logger[_0xabcf('0x44')](_0xabcf('0x7d'),_0x52b763[_0xabcf('0x47')],util['inspect'](_0x52b763,{'showHidden':![],'depth':null}));if(this[_0xabcf('0xe')][_0x52b763[_0xabcf('0x47')]]){var _0xba4c65=_['last'](this[_0xabcf('0xe')][_0x52b763[_0xabcf('0x47')]]);_0xba4c65['queuecallercomplete']=![];_0xba4c65[_0xabcf('0x7e')]=null;_0xba4c65[_0xabcf('0x7f')]=_0x52b763[_0xabcf('0x7f')];_0xba4c65[_0xabcf('0x80')]=_0x52b763[_0xabcf('0x80')];_0xba4c65[_0xabcf('0x81')]=!![];_0xba4c65[_0xabcf('0x82')]=moment()[_0xabcf('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0xba4c65[_0xabcf('0x83')]='ABANDONED';_0xba4c65[_0xabcf('0x84')]=null;logger[_0xabcf('0x6a')](_0xabcf('0x85'),_0xba4c65[_0xabcf('0x4a')],_0xba4c65[_0xabcf('0x4f')]);this[_0xabcf('0x10')][_0x52b763[_0xabcf('0x47')]]=_0xba4c65;this[_0xabcf('0x40')](_0xba4c65,_0xabcf('0x81'));}}}catch(_0x29d1cf){logger[_0xabcf('0x64')]('[%s][voiceQueueReport][queuecallerabandon]',_0x52b763[_0xabcf('0x47')],util[_0xabcf('0x3c')](_0x29d1cf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x3865be){try{if(this['isNotNull'](_0x3865be)){logger[_0xabcf('0x44')](_0xabcf('0x86'),_0x3865be[_0xabcf('0x47')],util[_0xabcf('0x3c')](_0x3865be,{'showHidden':![],'depth':null}));if(this[_0xabcf('0xe')][_0x3865be[_0xabcf('0x47')]]){var _0x4155da=_['last'](this[_0xabcf('0xe')][_0x3865be[_0xabcf('0x47')]]);_0x4155da['queuecallerleaveAt']=moment()['format'](_0xabcf('0x76'));_0x4155da[_0xabcf('0x87')]=_0x3865be[_0xabcf('0x87')];_0x4155da['connectedlinename']=_0x3865be['connectedlinename'];logger[_0xabcf('0x6a')](_0xabcf('0x88'),_0x4155da['name'],_0x4155da['type'],_0x3865be[_0xabcf('0x87')],_0x3865be[_0xabcf('0x89')]);this[_0xabcf('0x10')][_0x3865be['uniqueid']]=_0x4155da;this[_0xabcf('0x43')](_0x4155da,_0xabcf('0x8a'));}}}catch(_0x42bb85){logger[_0xabcf('0x64')](_0xabcf('0x86'),_0x3865be['uniqueid'],util[_0xabcf('0x3c')](_0x42bb85,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabcf('0x9')]['syncAgentConnect']=function(_0x24b901){try{if(this['isNotNull'](_0x24b901)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x24b901['uniqueid'],util[_0xabcf('0x3c')](_0x24b901,{'showHidden':![],'depth':null}));if(this[_0xabcf('0xe')][_0x24b901['uniqueid']]){var _0x2caa56=_['last'](this[_0xabcf('0xe')][_0x24b901[_0xabcf('0x47')]]);_0x2caa56[_0xabcf('0x8b')]=!![];_0x2caa56['queuecallerexitreason']=_0xabcf('0x8c');logger[_0xabcf('0x6a')](_0xabcf('0x8d'),_0x2caa56[_0xabcf('0x4a')],_0x2caa56[_0xabcf('0x4f')]);}}}catch(_0x510626){logger[_0xabcf('0x64')](_0xabcf('0x8e'),_0x24b901[_0xabcf('0x47')],util[_0xabcf('0x3c')](_0x510626,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xabcf('0x1c')]=function(_0x1ff7c3){try{if(this[_0xabcf('0x68')](_0x1ff7c3)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x1ff7c3[_0xabcf('0x47')],util['inspect'](_0x1ff7c3,{'showHidden':![],'depth':null}));if(this[_0xabcf('0xe')][_0x1ff7c3[_0xabcf('0x47')]]){var _0x418866=_[_0xabcf('0x8f')](this[_0xabcf('0xe')][_0x1ff7c3[_0xabcf('0x47')]]);_0x418866['queuecallerabandon']=![];_0x418866[_0xabcf('0x82')]=null;_0x418866[_0xabcf('0x90')]=!![];_0x418866[_0xabcf('0x84')]=_0x1ff7c3[_0xabcf('0x91')];_0x418866['holdtime']=_0x1ff7c3[_0xabcf('0x7f')];_0x418866[_0xabcf('0x8b')]=!![];_0x418866[_0xabcf('0x92')]=![];_0x418866['queuecallerexitAt']=null;if(!_0x418866[_0xabcf('0x93')]){if(_0x1ff7c3['reason']==_0xabcf('0x93')){_0x418866[_0xabcf('0x83')]=_0xabcf('0x94');logger[_0xabcf('0x6a')](_0xabcf('0x95'),_0x418866[_0xabcf('0x4a')],_0x418866[_0xabcf('0x4f')]);}else{if(_[_0xabcf('0x96')](_0x1ff7c3[_0xabcf('0x38')][_0xabcf('0x97')](),_0xabcf('0x98'))){if(this[_0xabcf('0xe')][_0x1ff7c3[_0xabcf('0x99')]]){var _0x4f1739=_[_0xabcf('0x8f')](this['queueReports'][_0x1ff7c3[_0xabcf('0x99')]]);_0x4f1739[_0xabcf('0x8b')]=![];_0x4f1739[_0xabcf('0x92')]=!![];_0x4f1739[_0xabcf('0x9a')]=moment(_0x418866[_0xabcf('0x75')])[_0xabcf('0x9b')](_0x1ff7c3['holdtime'],'seconds')['format'](_0xabcf('0x76'));_0x4f1739[_0xabcf('0x83')]=_0xabcf('0x9c');_0x4f1739[_0xabcf('0x93')]=!![];_0x4f1739[_0xabcf('0x9d')]=_0xabcf('0x9e');_0x4f1739['transferexten']=_0x1ff7c3[_0xabcf('0x9f')];_0x4f1739[_0xabcf('0xa0')]=_0x1ff7c3[_0xabcf('0x47')];logger[_0xabcf('0x6a')](_0xabcf('0xa1'),_0x4f1739[_0xabcf('0x4a')],_0x4f1739[_0xabcf('0x4f')]);var _0x43f92f=this[_0xabcf('0xe')][_0x1ff7c3[_0xabcf('0x99')]];this[_0xabcf('0xe')][_0x1ff7c3[_0xabcf('0x99')]]=this[_0xabcf('0xe')][_0x1ff7c3[_0xabcf('0x47')]];this[_0xabcf('0xe')][_0x1ff7c3[_0xabcf('0x47')]]=_0x43f92f;}}else{_0x418866[_0xabcf('0x83')]=_0xabcf('0xa2')+_0x1ff7c3[_0xabcf('0xa3')][_0xabcf('0xa4')]();logger['info'](_0xabcf('0xa5'),_0x418866[_0xabcf('0x4a')],_0x418866[_0xabcf('0x4f')],_0x418866[_0xabcf('0x83')]);}}}this[_0xabcf('0x10')][_0x1ff7c3[_0xabcf('0x47')]]=_0x418866;this[_0xabcf('0x40')](_0x418866,_0xabcf('0x1b'));}}}catch(_0x3ca608){logger[_0xabcf('0x64')](_0xabcf('0xa6'),_0x1ff7c3['uniqueid'],util[_0xabcf('0x3c')](_0x3ca608,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabcf('0x9')][_0xabcf('0x20')]=function(_0x5d82ff){try{if(this[_0xabcf('0x68')](_0x5d82ff)){logger['debug']('[%s][voiceQueueReport][varset]',_0x5d82ff[_0xabcf('0x47')],util['inspect'](_0x5d82ff,{'showHidden':![],'depth':null}));this[_0xabcf('0xa7')](_0x5d82ff[_0xabcf('0x47')],_['keys'](_0x5d82ff[_0xabcf('0xa8')])[0x0],_0x5d82ff[_0xabcf('0xa9')]);if(this['queueReports'][_0x5d82ff[_0xabcf('0x47')]]){var _0x1b762f=_[_0xabcf('0x8f')](this[_0xabcf('0xe')][_0x5d82ff[_0xabcf('0x47')]]);if(_0x1b762f){if(this[_0xabcf('0x68')](_0x5d82ff[_0xabcf('0xa8')])&&this[_0xabcf('0x68')](_0x5d82ff[_0xabcf('0xa8')][_0xabcf('0xaa')])){switch(_0x5d82ff[_0xabcf('0xa9')]){case'CONTINUE':_0x1b762f['queuecallerexit']=![];_0x1b762f[_0xabcf('0x9a')]=null;break;case _0xabcf('0xab'):_0x1b762f[_0xabcf('0xac')]=_0xabcf('0xad');_0x1b762f[_0xabcf('0x92')]=!![];_0x1b762f[_0xabcf('0x9a')]=moment()[_0xabcf('0x48')](_0xabcf('0x76'));_0x1b762f['queuecallerleaveAt']=moment()[_0xabcf('0x48')](_0xabcf('0x76'));logger[_0xabcf('0x44')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5d82ff[_0xabcf('0x47')],util['inspect'](_0x1b762f,{'showHidden':![],'depth':null}));ami[_0xabcf('0x42')](_0xabcf('0xae'),_0x1b762f);break;default:_0x1b762f['queuecallerexit']=!![];_0x1b762f['queuecallerexitAt']=moment()[_0xabcf('0x48')](_0xabcf('0x76'));_0x1b762f['queuecallerleaveAt']=moment()['format'](_0xabcf('0x76'));}_0x1b762f['queuecallerabandon']=![];_0x1b762f[_0xabcf('0x82')]=null;_0x1b762f['queuecallerexitreason']=_0x5d82ff[_0xabcf('0xa9')];this['channels'][_0x5d82ff[_0xabcf('0x47')]]=_0x1b762f;this[_0xabcf('0x40')](_0x1b762f,'varset');}else if(this[_0xabcf('0x68')](_0x5d82ff[_0xabcf('0xa8')])&&this[_0xabcf('0x68')](_0x5d82ff[_0xabcf('0xa8')][_0xabcf('0xaf')])){if(!_0x1b762f[_0xabcf('0x81')]){_0x1b762f['queuecallerexit']=!![];_0x1b762f[_0xabcf('0x9a')]=moment()[_0xabcf('0x48')](_0xabcf('0x76'));_0x1b762f[_0xabcf('0x83')]=_0xabcf('0xb0');_0x1b762f[_0xabcf('0xb1')]=moment()['format'](_0xabcf('0x76'));this[_0xabcf('0x10')][_0x5d82ff[_0xabcf('0x47')]]=_0x1b762f;}}logger[_0xabcf('0x6a')](_0xabcf('0xb2'),_0x5d82ff[_0xabcf('0x47')],_0x1b762f[_0xabcf('0x4a')],_0x1b762f[_0xabcf('0x4f')],_[_0xabcf('0x7c')](_0x5d82ff['variable'])[0x0],_0x5d82ff[_0xabcf('0xa9')]);_0x1b762f[_0xabcf('0x13')]=this['variables'][_0x5d82ff[_0xabcf('0x47')]];}}}}catch(_0x20e3de){logger['error']('[%s][voiceQueueReport][varset]',_0x5d82ff[_0xabcf('0x47')],util['inspect'](_0x20e3de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xabcf('0x9')][_0xabcf('0xa7')]=function(_0x241629,_0x1b9731,_0x67c4a1){var _0xca7abb=[_0xabcf('0xb3'),_0xabcf('0xb4'),_0xabcf('0xb5'),_0xabcf('0xb6'),_0xabcf('0xb7'),_0xabcf('0xb8'),_0xabcf('0xb9'),_0xabcf('0xba'),'sipcallid','sipuri',_0xabcf('0xbb'),_0xabcf('0xbc'),_0xabcf('0xbd'),_0xabcf('0xbe'),_0xabcf('0xbf'),_0xabcf('0xc0'),_0xabcf('0x91'),_0xabcf('0xc1'),_0xabcf('0xc2')];if(!_[_0xabcf('0x35')](_0x1b9731)&&!_['includes'](_0xca7abb,_0x1b9731)){if(_[_0xabcf('0x62')](this[_0xabcf('0x13')][_0x241629])){this[_0xabcf('0x13')][_0x241629]={};}this[_0xabcf('0x13')][_0x241629][_0x1b9731]=_0x67c4a1;}};VoiceQueueReport[_0xabcf('0x9')]['handleHangup']=function(_0x31d5b1,_0x55a49d,_0x49e21e){var _0x5b2bdc={};for(var _0x233b8b=0x0;_0x233b8b=0x0?moment(_0x1bb4b8[_0x9da6('0x18')])[_0x9da6('0xc')](_0x1bb4b8[_0x9da6('0x17')],_0x9da6('0xd')):null,'data1':'outbound','data2':_0x1bb4b8[_0x9da6('0x12')],'data3':_0x1bb4b8['exten'],'data4':_0x1bb4b8[_0x9da6('0x19')]||null,'role':_0x9da6('0x10'),'internal':_0x1bb4b8[_0x9da6('0x12')]?_[_0x9da6('0x11')](_0x1bb4b8[_0x9da6('0x12')]):undefined,'uniqueid':_0x1bb4b8[_0x9da6('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x8a16=['Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','voiceDialReport','membername','endtime','starttime','dialstring','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt'];(function(_0x159d3a,_0x5dc2e0){var _0x31ea38=function(_0x258a0f){while(--_0x258a0f){_0x159d3a['push'](_0x159d3a['shift']());}};_0x31ea38(++_0x5dc2e0);}(_0x8a16,0x1cb));var _0x68a1=function(_0x4414a9,_0x235083){_0x4414a9=_0x4414a9-0x0;var _0x405d0a=_0x8a16[_0x4414a9];return _0x405d0a;};'use strict';var moment=require(_0x68a1('0x0'));var _=require(_0x68a1('0x1'));var util=require(_0x68a1('0x2'));var client=require(_0x68a1('0x3'));exports[_0x68a1('0x4')]=function(_0x58c33b){var _0x2cd986=_0x58c33b['queuecallercompleteAt']||_0x58c33b[_0x68a1('0x5')];return client[_0x68a1('0x6')](_0x68a1('0x7'),{'body':{'channel':_0x68a1('0x8'),'membername':_0x58c33b[_0x68a1('0x9')],'interface':_[_0x68a1('0xa')](_0x58c33b[_0x68a1('0xb')])?util[_0x68a1('0xc')](_0x68a1('0xd'),_0x58c33b['lastAssignedTo']):_0x58c33b[_0x68a1('0xb')],'type':_0x68a1('0xe'),'enterAt':_0x58c33b[_0x68a1('0xf')],'exitAt':_0x2cd986,'duration':moment(_0x2cd986)[_0x68a1('0x10')](_0x58c33b[_0x68a1('0xf')],_0x68a1('0x11')),'data1':_0x68a1('0x12'),'data2':_0x58c33b[_0x68a1('0x13')],'data3':_0x58c33b[_0x68a1('0x14')],'data4':null,'data5':_0x58c33b[_0x68a1('0x15')],'role':_0x68a1('0x16'),'internal':_0x58c33b[_0x68a1('0x17')]?_[_0x68a1('0x18')](_0x58c33b[_0x68a1('0x17')]):undefined,'uniqueid':_0x58c33b['uniqueid']},'log':_0x68a1('0x7')});};exports[_0x68a1('0x19')]=function(_0x456508){return client[_0x68a1('0x6')](_0x68a1('0x7'),{'body':{'channel':_0x68a1('0x8'),'membername':_0x456508[_0x68a1('0x1a')],'interface':_0x456508[_0x68a1('0xb')],'type':'TALKING','enterAt':_0x456508['starttime'],'exitAt':_0x456508[_0x68a1('0x1b')],'duration':moment(_0x456508[_0x68a1('0x1b')])[_0x68a1('0x10')](_0x456508[_0x68a1('0x1c')],'seconds')>=0x0?moment(_0x456508[_0x68a1('0x1b')])[_0x68a1('0x10')](_0x456508[_0x68a1('0x1c')],_0x68a1('0x11')):null,'data1':'outbound','data2':_0x456508['accountcode'],'data3':_0x456508[_0x68a1('0x14')],'data4':_0x456508[_0x68a1('0x1d')]||null,'role':'agent','internal':_0x456508[_0x68a1('0x17')]?_[_0x68a1('0x18')](_0x456508[_0x68a1('0x17')]):undefined,'uniqueid':_0x456508[_0x68a1('0x1e')]},'log':_0x68a1('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3a8b514..457e153 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 _0xa547=['getSettings','ShowSetting','previewRecallmeReminderInterval','GetSettings'];(function(_0x3bb4cd,_0x4c8132){var _0x2bfb41=function(_0x227b4e){while(--_0x227b4e){_0x3bb4cd['push'](_0x3bb4cd['shift']());}};_0x2bfb41(++_0x4c8132);}(_0xa547,0xb0));var _0x7a54=function(_0x1b4f8f,_0x30c738){_0x1b4f8f=_0x1b4f8f-0x0;var _0x4267a6=_0xa547[_0x1b4f8f];return _0x4267a6;};'use strict';var client=require('../client');exports[_0x7a54('0x0')]=function(){return client['Request'](_0x7a54('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x7a54('0x2')]},'log':_0x7a54('0x3')});}; \ No newline at end of file +var _0xaf4c=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings','Request'];(function(_0x37224b,_0x2f2ee0){var _0x18cff1=function(_0x4255cb){while(--_0x4255cb){_0x37224b['push'](_0x37224b['shift']());}};_0x18cff1(++_0x2f2ee0);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x22af54,_0x969e4c){_0x22af54=_0x22af54-0x0;var _0x3328df=_0xaf4c[_0x22af54];return _0x3328df;};'use strict';var client=require('../client');exports[_0xcaf4('0x0')]=function(){return client[_0xcaf4('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcaf4('0x2'),_0xcaf4('0x3')]},'log':_0xcaf4('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d0d4587..bf12001 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 _0xdfe9=['Request','GetTemplate','name','html','getTemplates'];(function(_0x192b1c,_0x2d6f00){var _0x3c102f=function(_0x84cb24){while(--_0x84cb24){_0x192b1c['push'](_0x192b1c['shift']());}};_0x3c102f(++_0x2d6f00);}(_0xdfe9,0x14e));var _0x9dfe=function(_0x42135a,_0x1c098b){_0x42135a=_0x42135a-0x0;var _0xe2699b=_0xdfe9[_0x42135a];return _0xe2699b;};'use strict';var client=require('../client');exports[_0x9dfe('0x0')]=function(_0x1c5168){return function(_0x4bba7f){return client[_0x9dfe('0x1')](_0x9dfe('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9dfe('0x3'),_0x9dfe('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xf4d4=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x73f87f,_0x2eb5c5){var _0x11899b=function(_0x5b2560){while(--_0x5b2560){_0x73f87f['push'](_0x73f87f['shift']());}};_0x11899b(++_0x2eb5c5);}(_0xf4d4,0xf3));var _0x4f4d=function(_0x2e800b,_0x2fafac){_0x2e800b=_0x2e800b-0x0;var _0x5b1280=_0xf4d4[_0x2e800b];return _0x5b1280;};'use strict';var client=require(_0x4f4d('0x0'));exports[_0x4f4d('0x1')]=function(_0x1b430b){return function(_0x5915d1){return client[_0x4f4d('0x2')](_0x4f4d('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4f4d('0x4'),_0x4f4d('0x5')]},'log':_0x4f4d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ea51f30..3eea60b 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 _0x3c4d=['AllConditions','AnyConditions','operator','value','Action','Actions','action','data1','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c4d,0x188));var _0xd3c4=function(_0x3cf72c,_0x3ed3c3){_0x3cf72c=_0x3cf72c-0x0;var _0x4c0176=_0x3c4d[_0x3cf72c];return _0x4c0176;};'use strict';var client=require(_0xd3c4('0x0'));exports[_0xd3c4('0x1')]=function(_0x17cab4){return function(_0x52fb45){return client[_0xd3c4('0x2')](_0xd3c4('0x3'),{'options':{'raw':![],'attributes':['id',_0xd3c4('0x4'),_0xd3c4('0x5'),_0xd3c4('0x6')],'include':[{'model':_0xd3c4('0x7'),'as':_0xd3c4('0x8'),'attributes':['id','field','operator','value']},{'model':'Condition','as':_0xd3c4('0x9'),'attributes':['id','field',_0xd3c4('0xa'),_0xd3c4('0xb')]},{'model':_0xd3c4('0xc'),'as':_0xd3c4('0xd'),'attributes':['id',_0xd3c4('0xe'),_0xd3c4('0xf'),'data2',_0xd3c4('0x10'),'data4',_0xd3c4('0x11'),_0xd3c4('0x12'),_0xd3c4('0x13')]}]},'log':_0xd3c4('0x3')});};}; \ No newline at end of file +var _0x80b6=['Actions','data1','data2','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','value','Action'];(function(_0x147aef,_0x548f7b){var _0x125b35=function(_0x4674ca){while(--_0x4674ca){_0x147aef['push'](_0x147aef['shift']());}};_0x125b35(++_0x548f7b);}(_0x80b6,0x127));var _0x680b=function(_0x5659bd,_0x48b69){_0x5659bd=_0x5659bd-0x0;var _0x293e46=_0x80b6[_0x5659bd];return _0x293e46;};'use strict';var client=require('../client');exports[_0x680b('0x0')]=function(_0x35408a){return function(_0x433f53){return client[_0x680b('0x1')](_0x680b('0x2'),{'options':{'raw':![],'attributes':['id',_0x680b('0x3'),'channel',_0x680b('0x4')],'include':[{'model':_0x680b('0x5'),'as':_0x680b('0x6'),'attributes':['id',_0x680b('0x7'),_0x680b('0x8'),_0x680b('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x680b('0x7'),'operator',_0x680b('0x9')]},{'model':_0x680b('0xa'),'as':_0x680b('0xb'),'attributes':['id','action',_0x680b('0xc'),_0x680b('0xd'),'data3',_0x680b('0xe'),_0x680b('0xf'),_0x680b('0x10'),_0x680b('0x11')]}]},'log':_0x680b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index aec838a..84b2f9f 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 _0xe011=['defaultuser','GetTrunk','../client','getTrunks','Request','name'];(function(_0x20022a,_0x406c94){var _0x11ee01=function(_0x2b91a1){while(--_0x2b91a1){_0x20022a['push'](_0x20022a['shift']());}};_0x11ee01(++_0x406c94);}(_0xe011,0x14c));var _0x1e01=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xe011[_0x5627e1];return _0x2f013f;};'use strict';var client=require(_0x1e01('0x0'));exports[_0x1e01('0x1')]=function(_0x3e94c1){return function(_0x43a1f2){return client[_0x1e01('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1e01('0x3'),'registry',_0x1e01('0x4')]},'log':_0x1e01('0x5')});};}; \ No newline at end of file +var _0xc964=['registry','../client','getTrunks','Request','GetTrunk'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xc964,0x7e));var _0x4c96=function(_0x2a1b16,_0x26178a){_0x2a1b16=_0x2a1b16-0x0;var _0x1236d8=_0xc964[_0x2a1b16];return _0x1236d8;};'use strict';var client=require(_0x4c96('0x0'));exports[_0x4c96('0x1')]=function(_0x5749a1){return function(_0x37968d){return client[_0x4c96('0x2')](_0x4c96('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x4c96('0x4'),'defaultuser']},'log':_0x4c96('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 60c753e..23b6f29 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x44e3f8,_0xef65b6){var _0x4616ff=function(_0x3a0dea){while(--_0x3a0dea){_0x44e3f8['push'](_0x44e3f8['shift']());}};_0x4616ff(++_0xef65b6);}(_0x70e0,0x17b));var _0x070e=function(_0x6ee738,_0x5f4005){_0x6ee738=_0x6ee738-0x0;var _0x330491=_0x70e0[_0x6ee738];return _0x330491;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x37a149,_0x553c14){var _0x460af8=function(_0x2f260b){while(--_0x2f260b){_0x37a149['push'](_0x37a149['shift']());}};_0x460af8(++_0x553c14);}(_0x70e0,0x17b));var _0x070e=function(_0x3e5095,_0x449be5){_0x3e5095=_0x3e5095-0x0;var _0x564fb4=_0x70e0[_0x3e5095];return _0x564fb4;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f5fc6bb..bf40e0a 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 _0x8d1c=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x19ddf2,_0x10df1b){var _0x4edb88=function(_0x528462){while(--_0x528462){_0x19ddf2['push'](_0x19ddf2['shift']());}};_0x4edb88(++_0x10df1b);}(_0x8d1c,0x1a3));var _0xc8d1=function(_0x284d1e,_0x44ac0a){_0x284d1e=_0x284d1e-0x0;var _0x296c3d=_0x8d1c[_0x284d1e];return _0x296c3d;};'use strict';var client=require(_0xc8d1('0x0'));exports[_0xc8d1('0x1')]=function(_0x4295fe){return client[_0xc8d1('0x2')](_0xc8d1('0x3'),{'body':_0x4295fe,'log':_0xc8d1('0x3')});};exports[_0xc8d1('0x4')]=function(_0x2ee0f9,_0x23104f,_0x387574){return client[_0xc8d1('0x2')](_0xc8d1('0x5'),{'body':_0x2ee0f9,'options':{'where':{'uniqueid':_0x23104f,'interface':_0x387574,'agentcomplete':!![]}},'log':_0xc8d1('0x5')});}; \ No newline at end of file +var _0x192a=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x1804fa,_0x4f70f9){var _0x3c4f56=function(_0x42b2a9){while(--_0x42b2a9){_0x1804fa['push'](_0x1804fa['shift']());}};_0x3c4f56(++_0x4f70f9);}(_0x192a,0x9b));var _0xa192=function(_0x30bed3,_0x8c8414){_0x30bed3=_0x30bed3-0x0;var _0x354e82=_0x192a[_0x30bed3];return _0x354e82;};'use strict';var client=require(_0xa192('0x0'));exports[_0xa192('0x1')]=function(_0xac8d83){return client[_0xa192('0x2')](_0xa192('0x3'),{'body':_0xac8d83,'log':_0xa192('0x3')});};exports[_0xa192('0x4')]=function(_0x144b47,_0x2a1770,_0x1f159a){return client['Request'](_0xa192('0x5'),{'body':_0x144b47,'options':{'where':{'uniqueid':_0x2a1770,'interface':_0x1f159a,'agentcomplete':!![]}},'log':_0xa192('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 808275f..c640b3a 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 _0x5179=['GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','calleridnum','context','callerid','CreateVoiceCallReport'];(function(_0x380287,_0x56201c){var _0x2a6a4f=function(_0x1a3bb6){while(--_0x1a3bb6){_0x380287['push'](_0x380287['shift']());}};_0x2a6a4f(++_0x56201c);}(_0x5179,0xc8));var _0x9517=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0x5179[_0x2f32c4];return _0x95b5dc;};'use strict';var moment=require(_0x9517('0x0'));var util=require('util');var _=require(_0x9517('0x1'));var client=require(_0x9517('0x2'));exports[_0x9517('0x3')]=function(_0x1726e5){return client[_0x9517('0x4')]('CreateVoiceCallReport',{'body':_['merge'](_0x1726e5,{'source':_0x1726e5[_0x9517('0x5')],'destinationcontext':_0x1726e5[_0x9517('0x6')],'callerid':_0x1726e5[_0x9517('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0x9517('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x9517('0x4')](_0x9517('0x9'),{'options':{'where':{'type':[_0x9517('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x9517('0xb'))[_0x9517('0xc')](_0x9517('0xd')),moment()[_0x9517('0xe')](_0x9517('0xb'))[_0x9517('0xc')](_0x9517('0xd'))]}},'attributes':[_0x9517('0xf'),_0x9517('0x10'),'duration',_0x9517('0x11')]},'log':_0x9517('0x12')});};}; \ No newline at end of file +var _0x05e9=['GetVoiceCallReports','moment','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration'];(function(_0x37f7aa,_0x582991){var _0x590b9f=function(_0x53fc0f){while(--_0x53fc0f){_0x37f7aa['push'](_0x37f7aa['shift']());}};_0x590b9f(++_0x582991);}(_0x05e9,0x157));var _0x905e=function(_0x799a96,_0x5220df){_0x799a96=_0x799a96-0x0;var _0x3b451b=_0x05e9[_0x799a96];return _0x3b451b;};'use strict';var moment=require(_0x905e('0x0'));var util=require('util');var _=require(_0x905e('0x1'));var client=require('../client');exports['create']=function(_0x56221b){return client[_0x905e('0x2')](_0x905e('0x3'),{'body':_[_0x905e('0x4')](_0x56221b,{'source':_0x56221b[_0x905e('0x5')],'destinationcontext':_0x56221b[_0x905e('0x6')],'callerid':_0x56221b[_0x905e('0x7')],'amaflags':_0x905e('0x8')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x905e('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x905e('0xa')](_0x905e('0xb'))[_0x905e('0xc')](_0x905e('0xd')),moment()[_0x905e('0xe')](_0x905e('0xb'))[_0x905e('0xc')](_0x905e('0xd'))]}},'attributes':[_0x905e('0xf'),'disposition',_0x905e('0x10'),'billableseconds']},'log':_0x905e('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a99b764..6e91500 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 _0xe8f8=['../client','Request','CreateVoiceDialReport'];(function(_0x84a74c,_0x5609ac){var _0x5945e8=function(_0x2c11dc){while(--_0x2c11dc){_0x84a74c['push'](_0x84a74c['shift']());}};_0x5945e8(++_0x5609ac);}(_0xe8f8,0x1da));var _0x8e8f=function(_0x43fc63,_0x458c8b){_0x43fc63=_0x43fc63-0x0;var _0x2b408d=_0xe8f8[_0x43fc63];return _0x2b408d;};'use strict';var client=require(_0x8e8f('0x0'));exports['create']=function(_0x41ccb4){return client[_0x8e8f('0x1')](_0x8e8f('0x2'),{'body':_0x41ccb4,'log':_0x8e8f('0x2')});}; \ No newline at end of file +var _0xc42e=['../client','Request'];(function(_0x361353,_0x22a3df){var _0xc77125=function(_0x47adbf){while(--_0x47adbf){_0x361353['push'](_0x361353['shift']());}};_0xc77125(++_0x22a3df);}(_0xc42e,0x14c));var _0xec42=function(_0x3c700f,_0x2ad2c8){_0x3c700f=_0x3c700f-0x0;var _0x1bf773=_0xc42e[_0x3c700f];return _0x1bf773;};'use strict';var client=require(_0xec42('0x0'));exports['create']=function(_0x2fe85b){return client[_0xec42('0x1')]('CreateVoiceDialReport',{'body':_0x2fe85b,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7822199..ada19e4 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 _0x9b87=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0xe8194,_0xc7ec76){var _0x1cb195=function(_0x1fe53a){while(--_0x1fe53a){_0xe8194['push'](_0xe8194['shift']());}};_0x1cb195(++_0xc7ec76);}(_0x9b87,0x8e));var _0x79b8=function(_0x414aca,_0x53dcb6){_0x414aca=_0x414aca-0x0;var _0x2d03f8=_0x9b87[_0x414aca];return _0x2d03f8;};'use strict';var client=require(_0x79b8('0x0'));exports[_0x79b8('0x1')]=function(){return function(){return client[_0x79b8('0x2')](_0x79b8('0x3'),{'options':{'raw':!![],'attributes':['id',_0x79b8('0x4'),_0x79b8('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x79b8('0x1')});};}; \ No newline at end of file +var _0xb49a=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x56d1c5,_0x5e3d24){var _0x274d29=function(_0x6dcdc1){while(--_0x6dcdc1){_0x56d1c5['push'](_0x56d1c5['shift']());}};_0x274d29(++_0x5e3d24);}(_0xb49a,0xfb));var _0xab49=function(_0xd4470d,_0x47318d){_0xd4470d=_0xd4470d-0x0;var _0x5544c5=_0xb49a[_0xd4470d];return _0x5544c5;};'use strict';var client=require(_0xab49('0x0'));exports[_0xab49('0x1')]=function(){return function(){return client[_0xab49('0x2')](_0xab49('0x3'),{'options':{'raw':!![],'attributes':['id',_0xab49('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xab49('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 87aa217..5f2e298 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 _0x6528=['dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','../client','getVoiceQueues','GetVoiceQueue','name','autopause','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','monitor_format','strategy'];(function(_0x3057b0,_0x339e7f){var _0x50c8e2=function(_0x2b40a8){while(--_0x2b40a8){_0x3057b0['push'](_0x3057b0['shift']());}};_0x50c8e2(++_0x339e7f);}(_0x6528,0x102));var _0x8652=function(_0x52c32f,_0x5d5431){_0x52c32f=_0x52c32f-0x0;var _0x6504cb=_0x6528[_0x52c32f];return _0x6504cb;};'use strict';var client=require(_0x8652('0x0'));exports[_0x8652('0x1')]=function(){return function(){return client['Request'](_0x8652('0x2'),{'options':{'raw':![],'attributes':['id',_0x8652('0x3'),'acw','acwTimeout',_0x8652('0x4'),'monitor_format',_0x8652('0x5'),'dialActive',_0x8652('0x6'),_0x8652('0x7'),_0x8652('0x8'),'dialPowerLevel',_0x8652('0x9'),'dialPredictiveOptimizationPercentage',_0x8652('0xa'),_0x8652('0xb'),_0x8652('0xc'),_0x8652('0xd'),_0x8652('0xe'),_0x8652('0xf'),_0x8652('0x10'),_0x8652('0x11'),_0x8652('0x12'),_0x8652('0x13'),_0x8652('0x14'),_0x8652('0x15'),_0x8652('0x16'),'dialGlobalMaxRetry',_0x8652('0x17'),'dialGlobalInterval',_0x8652('0x18'),'dialCheckDuplicateType','dialAMDActive',_0x8652('0x19'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x8652('0x1a'),_0x8652('0x1b'),_0x8652('0x1c'),_0x8652('0x1d'),_0x8652('0x1e'),'dialAMDMaximumWordLength',_0x8652('0x1f'),_0x8652('0x20'),_0x8652('0x21'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x8652('0x22'),_0x8652('0x23'),_0x8652('0x24'),'dialRandomLastDigitCallerIdNumber',_0x8652('0x25'),_0x8652('0x26'),_0x8652('0x27'),'dialDropMaxRetry',_0x8652('0x28'),_0x8652('0x29'),_0x8652('0x2a'),_0x8652('0x2b'),_0x8652('0x2c'),_0x8652('0x2d'),_0x8652('0x2e'),'mandatoryDisposition',_0x8652('0x2f'),_0x8652('0x30'),_0x8652('0x31'),_0x8652('0x32'),_0x8652('0x33')],'include':[{'model':_0x8652('0x34'),'as':_0x8652('0x34'),'attributes':['id',_0x8652('0x3'),'callerid',_0x8652('0x35')]},{'model':_0x8652('0x36'),'as':_0x8652('0x37'),'attributes':['id',_0x8652('0x3')]},{'model':'Trunk','as':_0x8652('0x38'),'attributes':['id','name',_0x8652('0x39'),_0x8652('0x35')]},{'model':_0x8652('0x3a'),'as':_0x8652('0x3a'),'attributes':['id',_0x8652('0x3')],'include':[{'model':_0x8652('0x3a'),'as':'Intervals','attributes':['id',_0x8652('0x3'),'interval']}]}]},'log':_0x8652('0x1')});};}; \ No newline at end of file +var _0x5e33=['getVoiceQueues','../client','Request','name','acw','acwTimeout','monitor_format','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval'];(function(_0x40189f,_0x526880){var _0xfc3842=function(_0x449c23){while(--_0x449c23){_0x40189f['push'](_0x40189f['shift']());}};_0xfc3842(++_0x526880);}(_0x5e33,0xed));var _0x35e3=function(_0x2c62c9,_0x43ac5b){_0x2c62c9=_0x2c62c9-0x0;var _0x7f74e7=_0x5e33[_0x2c62c9];return _0x7f74e7;};'use strict';var client=require(_0x35e3('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x35e3('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x35e3('0x2'),_0x35e3('0x3'),_0x35e3('0x4'),'autopause',_0x35e3('0x5'),'type','dialActive',_0x35e3('0x6'),_0x35e3('0x7'),'dialLimitQueue',_0x35e3('0x8'),_0x35e3('0x9'),_0x35e3('0xa'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x35e3('0xb'),_0x35e3('0xc'),'dialQueueOptions',_0x35e3('0xd'),'dialQueueProject',_0x35e3('0xe'),_0x35e3('0xf'),_0x35e3('0x10'),_0x35e3('0x11'),_0x35e3('0x12'),_0x35e3('0x13'),'dialGlobalMaxRetry','dialTimezone','dialGlobalInterval',_0x35e3('0x14'),_0x35e3('0x15'),_0x35e3('0x16'),'dialAMDInitialSilence',_0x35e3('0x17'),_0x35e3('0x18'),'dialAMDTotalAnalysisTime',_0x35e3('0x19'),_0x35e3('0x1a'),_0x35e3('0x1b'),_0x35e3('0x1c'),_0x35e3('0x1d'),_0x35e3('0x1e'),_0x35e3('0x1f'),'dialRecallInQueue',_0x35e3('0x20'),'dialAgiAfterHangupAgent',_0x35e3('0x21'),_0x35e3('0x22'),_0x35e3('0x5'),_0x35e3('0x23'),_0x35e3('0x24'),'dialCutDigit',_0x35e3('0x25'),_0x35e3('0x26'),_0x35e3('0x27'),_0x35e3('0x28'),_0x35e3('0x29'),_0x35e3('0x2a'),_0x35e3('0x2b'),'dialMachineRetryFrequency',_0x35e3('0x2c'),_0x35e3('0x2d'),_0x35e3('0x2e'),_0x35e3('0x2f'),'dialPredictiveIntervalMinThreshold',_0x35e3('0x30'),_0x35e3('0x31'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0x35e3('0x32'),'as':_0x35e3('0x32'),'attributes':['id','name',_0x35e3('0x33'),_0x35e3('0x34')]},{'model':_0x35e3('0x35'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x35e3('0x32'),'as':_0x35e3('0x36'),'attributes':['id',_0x35e3('0x2'),_0x35e3('0x33'),_0x35e3('0x34')]},{'model':_0x35e3('0x37'),'as':'Interval','attributes':['id',_0x35e3('0x2')],'include':[{'model':'Interval','as':_0x35e3('0x38'),'attributes':['id',_0x35e3('0x2'),_0x35e3('0x39')]}]}]},'log':_0x35e3('0x3a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 78c3646..7e3fb67 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(_0xbba5bd,_0x258abc){var _0x28b5a3=function(_0x11921c){while(--_0x11921c){_0xbba5bd['push'](_0xbba5bd['shift']());}};_0x28b5a3(++_0x258abc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0xc96580,_0x2dbfdf){var _0x7cda84=function(_0x27436d){while(--_0x27436d){_0xc96580['push'](_0xc96580['shift']());}};_0x7cda84(++_0x2dbfdf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 1dc0d5a..facc5de 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 _0x63ff=['../client','Request','GetVoiceQueueRtPauses'];(function(_0x577766,_0x4dc228){var _0x37b2cb=function(_0x33151d){while(--_0x33151d){_0x577766['push'](_0x577766['shift']());}};_0x37b2cb(++_0x4dc228);}(_0x63ff,0x1d1));var _0xf63f=function(_0x345d6b,_0x3da234){_0x345d6b=_0x345d6b-0x0;var _0x4c5276=_0x63ff[_0x345d6b];return _0x4c5276;};'use strict';var client=require(_0xf63f('0x0'));exports['getVoiceQueueRtPauses']=function(_0x118168){return function(){return client[_0xf63f('0x1')](_0xf63f('0x2'),{'options':{'where':{'VoiceQueueId':_0x118168,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x14ec=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x11c3db,_0x1df5b2){var _0x1665e5=function(_0xcdb7af){while(--_0xcdb7af){_0x11c3db['push'](_0x11c3db['shift']());}};_0x1665e5(++_0x1df5b2);}(_0x14ec,0xb2));var _0xc14e=function(_0xf79222,_0x52da45){_0xf79222=_0xf79222-0x0;var _0x335071=_0x14ec[_0xf79222];return _0x335071;};'use strict';var client=require(_0xc14e('0x0'));exports[_0xc14e('0x1')]=function(_0x505652){return function(){return client['Request'](_0xc14e('0x2'),{'options':{'where':{'VoiceQueueId':_0x505652,'paused':!![]},'raw':!![]},'log':_0xc14e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ca65360..2730ef6 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(_0x348626,_0x50397b){var _0x10d51d=function(_0x5a77eb){while(--_0x5a77eb){_0x348626['push'](_0x348626['shift']());}};_0x10d51d(++_0x50397b);}(_0x7a54,0x106));var _0x47a5=function(_0x2bd760,_0x53bad3){_0x2bd760=_0x2bd760-0x0;var _0x12269d=_0x7a54[_0x2bd760];return _0x12269d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4f5379,_0x26252f){var _0xd925ae=function(_0x2c1646){while(--_0x2c1646){_0x4f5379['push'](_0x4f5379['shift']());}};_0xd925ae(++_0x26252f);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4fa3c7d..50a9221 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 _0x482f=['transfereeaccountcode','transfereecontext','transfereeexten','extension','attendedTransfer','Request','result','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x5ad6df,_0x330785){var _0x23eff0=function(_0x2fa236){while(--_0x2fa236){_0x5ad6df['push'](_0x5ad6df['shift']());}};_0x23eff0(++_0x330785);}(_0x482f,0xe1));var _0xf482=function(_0x33e4b1,_0x4c9ae6){_0x33e4b1=_0x33e4b1-0x0;var _0x2ed91d=_0x482f[_0x33e4b1];return _0x2ed91d;};'use strict';var client=require(_0xf482('0x0'));exports[_0xf482('0x1')]={};exports[_0xf482('0x2')]=function(_0x392531){return client['Request'](_0xf482('0x3'),{'body':{'result':_0x392531['result'],'transfererchannel':_0x392531[_0xf482('0x4')],'transferercalleridnum':_0x392531[_0xf482('0x5')],'transferercalleridname':_0x392531[_0xf482('0x6')],'transfererconnectedlinenum':_0x392531[_0xf482('0x7')],'transfererconnectedlinename':_0x392531[_0xf482('0x8')],'transfereraccountcode':_0x392531[_0xf482('0x9')],'transferercontext':_0x392531[_0xf482('0xa')],'transfererexten':_0x392531['transfererexten'],'transfererlinkedid':_0x392531[_0xf482('0xb')],'transfereechannel':_0x392531[_0xf482('0xc')],'transfereecalleridnum':_0x392531['transfereecalleridnum'],'transfereecalleridname':_0x392531['transfereecalleridname'],'transfereeconnectedlinenum':_0x392531[_0xf482('0xd')],'transfereeconnectedlinename':_0x392531[_0xf482('0xe')],'transfereeaccountcode':_0x392531[_0xf482('0xf')],'transfereecontext':_0x392531[_0xf482('0x10')],'transfereeexten':_0x392531[_0xf482('0x11')],'transfereelinkedid':_0x392531['transfereelinkedid'],'isexternal':_0x392531['isexternal'],'context':_0x392531['context'],'extension':_0x392531[_0xf482('0x12')],'type':'blind'},'log':_0xf482('0x3')});};exports[_0xf482('0x13')]=function(_0x1beb65){return client[_0xf482('0x14')](_0xf482('0x3'),{'body':{'result':_0x1beb65[_0xf482('0x15')],'transfererchannel':_0x1beb65[_0xf482('0x16')],'transferercalleridnum':_0x1beb65['origtransferercalleridnum'],'transferercalleridname':_0x1beb65['origtransferercalleridname'],'transfererconnectedlinenum':_0x1beb65[_0xf482('0x17')],'transfererconnectedlinename':_0x1beb65['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1beb65[_0xf482('0x18')],'transferercontext':_0x1beb65[_0xf482('0x19')],'transfererexten':_0x1beb65[_0xf482('0x1a')],'transfererlinkedid':_0x1beb65[_0xf482('0x1b')],'transfereechannel':_0x1beb65[_0xf482('0x1c')],'transfereecalleridnum':_0x1beb65['transfertargetcalleridnum'],'transfereecalleridname':_0x1beb65[_0xf482('0x1d')],'transfereeconnectedlinenum':_0x1beb65[_0xf482('0x1e')],'transfereeconnectedlinename':_0x1beb65[_0xf482('0x1f')],'transfereeaccountcode':_0x1beb65[_0xf482('0x20')],'transfereecontext':_0x1beb65[_0xf482('0x21')],'transfereeexten':_0x1beb65[_0xf482('0x22')],'transfereelinkedid':_0x1beb65[_0xf482('0x23')],'isexternal':_0x1beb65[_0xf482('0x24')],'context':_0x1beb65[_0xf482('0x25')],'extension':_0x1beb65[_0xf482('0x26')],'type':_0xf482('0x27')},'log':_0xf482('0x3')});}; \ No newline at end of file +var _0x2886=['transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetcontext','origtransferercontext','origtransfererexten','attended','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transferercontext','transfererexten'];(function(_0x197a7a,_0x4b9054){var _0x386cb6=function(_0xa32b1b){while(--_0xa32b1b){_0x197a7a['push'](_0x197a7a['shift']());}};_0x386cb6(++_0x4b9054);}(_0x2886,0x84));var _0x6288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2886[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x2e584){return client[_0x6288('0x0')](_0x6288('0x1'),{'body':{'result':_0x2e584['result'],'transfererchannel':_0x2e584[_0x6288('0x2')],'transferercalleridnum':_0x2e584[_0x6288('0x3')],'transferercalleridname':_0x2e584[_0x6288('0x4')],'transfererconnectedlinenum':_0x2e584['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2e584['transfererconnectedlinename'],'transfereraccountcode':_0x2e584[_0x6288('0x5')],'transferercontext':_0x2e584[_0x6288('0x6')],'transfererexten':_0x2e584[_0x6288('0x7')],'transfererlinkedid':_0x2e584[_0x6288('0x8')],'transfereechannel':_0x2e584[_0x6288('0x9')],'transfereecalleridnum':_0x2e584['transfereecalleridnum'],'transfereecalleridname':_0x2e584[_0x6288('0xa')],'transfereeconnectedlinenum':_0x2e584[_0x6288('0xb')],'transfereeconnectedlinename':_0x2e584[_0x6288('0xc')],'transfereeaccountcode':_0x2e584[_0x6288('0xd')],'transfereecontext':_0x2e584[_0x6288('0xe')],'transfereeexten':_0x2e584[_0x6288('0xf')],'transfereelinkedid':_0x2e584[_0x6288('0x10')],'isexternal':_0x2e584[_0x6288('0x11')],'context':_0x2e584['context'],'extension':_0x2e584[_0x6288('0x12')],'type':_0x6288('0x13')},'log':_0x6288('0x1')});};exports[_0x6288('0x14')]=function(_0x13fdc8){return client['Request'](_0x6288('0x1'),{'body':{'result':_0x13fdc8['result'],'transfererchannel':_0x13fdc8[_0x6288('0x15')],'transferercalleridnum':_0x13fdc8[_0x6288('0x16')],'transferercalleridname':_0x13fdc8['origtransferercalleridname'],'transfererconnectedlinenum':_0x13fdc8[_0x6288('0x17')],'transfererconnectedlinename':_0x13fdc8[_0x6288('0x18')],'transfereraccountcode':_0x13fdc8[_0x6288('0x19')],'transferercontext':_0x13fdc8[_0x6288('0x1a')],'transfererexten':_0x13fdc8[_0x6288('0x1b')],'transfererlinkedid':_0x13fdc8['origtransfererlinkedid'],'transfereechannel':_0x13fdc8[_0x6288('0x1c')],'transfereecalleridnum':_0x13fdc8[_0x6288('0x1d')],'transfereecalleridname':_0x13fdc8[_0x6288('0x1e')],'transfereeconnectedlinenum':_0x13fdc8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x13fdc8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x13fdc8['transfertargetaccountcode'],'transfereecontext':_0x13fdc8[_0x6288('0x1f')],'transfereeexten':_0x13fdc8['transfertargetexten'],'transfereelinkedid':_0x13fdc8['transfertargetlinkedid'],'isexternal':_0x13fdc8[_0x6288('0x11')],'context':_0x13fdc8[_0x6288('0x20')],'extension':_0x13fdc8[_0x6288('0x21')],'type':_0x6288('0x22')},'log':_0x6288('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5b136cd..d7c6ff7 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 _0x657b=['voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','moment','../properties','../ami','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','module','action','Reload','Action','then','message','catch','username','pick','Command','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','values','voicechannel','channels','channel','%s.%s','filename','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor','destinationchannel','status','stop','wav','voicequeuechannel','queueChannels','Hangup'];(function(_0x5eab61,_0x2ef079){var _0x308fdb=function(_0x1c94bb){while(--_0x1c94bb){_0x5eab61['push'](_0x5eab61['shift']());}};_0x308fdb(++_0x2ef079);}(_0x657b,0x131));var _0xb657=function(_0x6c842d,_0x1f310f){_0x6c842d=_0x6c842d-0x0;var _0x117c42=_0x657b[_0x6c842d];return _0x117c42;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var jayson=require(_0xb657('0x2'));var schema=require(_0xb657('0x3'));var moment=require(_0xb657('0x4'));var config=require('../../../config/environment');var properties=require(_0xb657('0x5'));var ami=require(_0xb657('0x6'));exports['listen']=function(_0x175072,_0x322e57,_0x42a145){return new Promise(function(_0x25738d,_0x446b17){var _0x5d54f6={'QueuePause':function(_0x471e78){return new Promise(function(_0x55acdf){var _0x326dd7=util[_0xb657('0x7')](_0xb657('0x8'),'SIP',_0x471e78[_0xb657('0x9')]);if(_0x175072['timers']&&_0x175072[_0xb657('0xa')][_0x326dd7]&&_0x175072['timers'][_0x326dd7][_0xb657('0xb')]){_0x175072[_0xb657('0xa')][_0x326dd7][_0xb657('0xc')]();}if(_0x175072['agents'][_0x326dd7]){_0x175072[_0xb657('0xd')][_0x326dd7][_0xb657('0xe')]({'statePause':_0x471e78[_0xb657('0xf')]?!![]:![]});}_0x55acdf({'code':0xc8,'message':_0xb657('0x10')});});},'Reload':function(_0x51228b){var _0x3e1ea1=this;return new Promise(function(_0x3ebcc2,_0x558eba){if(ami[_0xb657('0x11')]()==![]){return _0x558eba(_0x3e1ea1[_0xb657('0x12')](0x1f4,[config[_0xb657('0x13')]['ip'],config[_0xb657('0x13')]['username'],_0xb657('0x14')][_0xb657('0x15')]('\x20')));}_0x51228b=_['pick'](_0x51228b,_['keys'](properties[_0xb657('0x16')]));_0x51228b[_0xb657('0x17')]=_0xb657('0x18');return ami[_0xb657('0x19')](_0x51228b)[_0xb657('0x1a')](function(_0x1163e1){_0x3ebcc2({'code':0xc8,'message':_0x1163e1[_0xb657('0x1b')]});})[_0xb657('0x1c')](function(_0x9e98be){_0x558eba(_0x3e1ea1[_0xb657('0x12')](0x1f5,_0x9e98be[_0xb657('0x1b')]));});});},'Command':function(_0x4918ff){var _0x8c156f=this;return new Promise(function(_0x12f79e,_0x21474b){if(ami[_0xb657('0x11')]()==![]){return _0x21474b(_0x8c156f['error'](0x1f4,[config['asterisk']['ip'],config[_0xb657('0x13')][_0xb657('0x1d')],_0xb657('0x14')]['join']('\x20')));}_0x4918ff=_[_0xb657('0x1e')](_0x4918ff,'command');_0x4918ff[_0xb657('0x17')]=_0xb657('0x1f');return ami[_0xb657('0x19')](_0x4918ff)[_0xb657('0x1a')](function(_0x2c3301){_0x12f79e({'code':0xc8,'message':_0x2c3301['content']});})[_0xb657('0x1c')](function(_0x13cea8){_0x21474b(_0x8c156f[_0xb657('0x12')](0x1f5,_0x13cea8[_0xb657('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x5e3579){var _0x387dc6=[];for(var _0x595020 in _0x175072[_0xb657('0x20')]){if(_0x175072['voiceQueues'][_0xb657('0x21')](_0x595020)){var _0x4fe1c5=_0x175072[_0xb657('0x20')][_0x595020];var _0x154f83={'id':_0x4fe1c5['id'],'name':_0x4fe1c5['name'],'strategy':_0x4fe1c5[_0xb657('0x22')],'answered':_0x4fe1c5[_0xb657('0x23')],'available':_0x4fe1c5[_0xb657('0x24')],'loggedIn':_0x4fe1c5['loggedIn'],'pTalking':_0x4fe1c5[_0xb657('0x25')],'sumBillable':_0x4fe1c5[_0xb657('0x26')],'sumDuration':_0x4fe1c5[_0xb657('0x27')],'sumHoldTime':_0x4fe1c5[_0xb657('0x28')]||0x0,'talking':_0x4fe1c5[_0xb657('0x29')],'total':_0x4fe1c5[_0xb657('0x2a')],'type':_0x4fe1c5[_0xb657('0x2b')],'unmanaged':_0x4fe1c5[_0xb657('0x2c')],'abandoned':_0x4fe1c5[_0xb657('0x2d')],'waiting':_0x4fe1c5[_0xb657('0x2e')],'loggedInDb':_0x4fe1c5[_0xb657('0x2f')]};if(_0x4fe1c5[_0xb657('0x2b')]===_0xb657('0x30')){_0x154f83[_0xb657('0x31')]=_0x4fe1c5[_0xb657('0x31')];_0x154f83[_0xb657('0x32')]=_0x4fe1c5[_0xb657('0x32')];_0x154f83['dialOriginateCallerIdName']=_0x4fe1c5[_0xb657('0x33')];_0x154f83['dialOriginateCallerIdNumber']=_0x4fe1c5[_0xb657('0x34')];_0x154f83[_0xb657('0x35')]=_0x4fe1c5['dialOriginateTimeout'];_0x154f83[_0xb657('0x36')]=_0x4fe1c5[_0xb657('0x36')];_0x154f83[_0xb657('0x37')]=_0x4fe1c5[_0xb657('0x37')];_0x154f83[_0xb657('0x38')]=_0x4fe1c5['outboundAnswerAgiCallsDay'];_0x154f83[_0xb657('0x39')]=_0x4fe1c5[_0xb657('0x39')];_0x154f83[_0xb657('0x3a')]=_0x4fe1c5[_0xb657('0x3a')];_0x154f83[_0xb657('0x3b')]=_0x4fe1c5['outboundBusyCallsDay'];_0x154f83[_0xb657('0x3c')]=_0x4fe1c5[_0xb657('0x3c')];_0x154f83[_0xb657('0x3d')]=_0x4fe1c5['outboundDropCallsDayACS'];_0x154f83[_0xb657('0x3e')]=_0x4fe1c5['outboundDropCallsDayCallersExit'];_0x154f83[_0xb657('0x3f')]=_0x4fe1c5[_0xb657('0x3f')];_0x154f83[_0xb657('0x40')]=_0x4fe1c5[_0xb657('0x40')];_0x154f83[_0xb657('0x41')]=_0x4fe1c5[_0xb657('0x41')];_0x154f83[_0xb657('0x42')]=_0x4fe1c5[_0xb657('0x42')];_0x154f83[_0xb657('0x43')]=_0x4fe1c5[_0xb657('0x43')];_0x154f83[_0xb657('0x44')]=_0x4fe1c5['outboundRejectCallsDay'];_0x154f83['outboundUnknownCallsDay']=_0x4fe1c5[_0xb657('0x45')];_0x154f83[_0xb657('0x46')]=_0x4fe1c5[_0xb657('0x46')];_0x154f83[_0xb657('0x47')]=_0x4fe1c5[_0xb657('0x47')];_0x154f83[_0xb657('0x48')]=_0x4fe1c5['predictiveIntervalAvgTalktime'];_0x154f83[_0xb657('0x49')]=_0x4fe1c5['predictiveIntervalDroppedCallsCallersExit'];_0x154f83[_0xb657('0x4a')]=_0x4fe1c5[_0xb657('0x4a')];_0x154f83[_0xb657('0x4b')]=_0x4fe1c5[_0xb657('0x4b')];_0x154f83[_0xb657('0x4c')]=_0x4fe1c5['predictiveIntervalErlangCallsDroppedCalls'];_0x154f83[_0xb657('0x4d')]=_0x4fe1c5[_0xb657('0x4d')];_0x154f83[_0xb657('0x4e')]=_0x4fe1c5[_0xb657('0x4e')];_0x154f83[_0xb657('0x4f')]=_0x4fe1c5[_0xb657('0x4f')];_0x154f83[_0xb657('0x50')]=_0x4fe1c5[_0xb657('0x50')];_0x154f83[_0xb657('0x51')]=_0x4fe1c5[_0xb657('0x51')];_0x154f83['message']=_0x4fe1c5[_0xb657('0x1b')];_0x154f83['originated']=_0x4fe1c5[_0xb657('0x52')];_0x154f83['erlangCalls']=_0x4fe1c5[_0xb657('0x53')];_0x154f83[_0xb657('0x54')]=_0x4fe1c5[_0xb657('0x54')];_0x154f83[_0xb657('0x55')]=_0x4fe1c5[_0xb657('0x55')];_0x154f83[_0xb657('0x56')]=_0x4fe1c5['erlangBusyFactor'];_0x154f83[_0xb657('0x57')]=_0x4fe1c5[_0xb657('0x57')];_0x154f83[_0xb657('0x58')]=_0x4fe1c5['startProgressive'];}if(_0x4fe1c5[_0xb657('0x59')]){_0x154f83[_0xb657('0x59')]={'id':_0x4fe1c5[_0xb657('0x59')]['id'],'name':_0x4fe1c5[_0xb657('0x59')][_0xb657('0x9')],'active':_0x4fe1c5[_0xb657('0x59')][_0xb657('0x5a')],'callerid':_0x4fe1c5[_0xb657('0x59')][_0xb657('0x5b')]};}if(_0x4fe1c5['Interval']){_0x154f83[_0xb657('0x5c')]={'id':_0x4fe1c5['Interval']['id'],'name':_0x4fe1c5[_0xb657('0x5c')][_0xb657('0x9')]};}_0x387dc6['push'](_0x154f83);}}_0x5e3579({'count':_0x387dc6[_0xb657('0x5d')],'rows':_0x387dc6});});},'UpdateVoiceQueue':function(_0x59e4b4){return new Promise(function(_0x491226,_0x185138){var _0x244813=_[_0xb657('0x5e')](_0x175072[_0xb657('0x20')],{'id':parseInt(_0x59e4b4['id'])});var _0x4f646f=_[_0xb657('0x5f')](_0x59e4b4,['id']);if(_0x244813){for(var _0xab76d8 in _0x4f646f){if(typeof _0x4f646f[_0xab76d8]!==_0xb657('0x60')&&typeof _0x244813[_0xab76d8]!==_0xb657('0x60')){_0x244813[_0xab76d8]=_0x4f646f[_0xab76d8];}}_0x491226(_0x244813);}else{_0x185138();}});},'VoiceChannels':function(){return new Promise(function(_0x3f4a16){var _0x5c7d53=_[_0xb657('0x61')](_0x175072['channels']);_0x3f4a16({'count':_0x5c7d53['length'],'rows':_0x5c7d53});});},'VoiceChannelMixMonitor':function(_0x534644){var _0x1fd7ce=this;return new Promise(function(_0x4a4a38,_0x2367aa){if(ami[_0xb657('0x11')]()==![]){return _0x2367aa(_0x1fd7ce[_0xb657('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xb657('0x13')][_0xb657('0x1d')],_0xb657('0x14')][_0xb657('0x15')]('\x20')));}var _0x2b957b=schema(properties[_0xb657('0x62')])['validate'](_0x534644);if(_0x2b957b[_0xb657('0x5d')]>0x0){return _0x2367aa(_0x1fd7ce[_0xb657('0x12')](0x1f4,_['map'](_0x2b957b,_0xb657('0x1b'))['join'](',\x20')));}var _0x22cfae=_['find'](_0x175072[_0xb657('0x63')],{'uniqueid':_0x534644['uniqueid']});if(_0x22cfae&&_0x22cfae[_0xb657('0x64')]){var _0x5b6e64=util[_0xb657('0x7')](_0xb657('0x65'),_0x534644[_0xb657('0x66')]||_0x534644[_0xb657('0x67')],_0x534644[_0xb657('0x7')]||'wav');return ami[_0xb657('0x19')]({'action':_0xb657('0x68'),'channel':_0x22cfae[_0xb657('0x64')],'file':_0x5b6e64,'options':_0xb657('0x69')})[_0xb657('0x1a')](function(_0x2dcf79){var _0x5b226f=_[_0xb657('0x5e')](_0x22cfae[_0xb657('0x6a')],{'filename':_0xb657('0x6b')+_0x5b6e64[_0xb657('0x6c')]()});if(_[_0xb657('0x6d')](_0x5b226f)){_0x22cfae[_0xb657('0x6a')][_0xb657('0x6e')]({'filename':_0xb657('0x6b')+_0x5b6e64[_0xb657('0x6c')](),'createdAt':moment()['format'](_0xb657('0x6f')),'mixmonitorid':_0x2dcf79[_0xb657('0x70')],'status':_0xb657('0x71')});}else{_0x5b226f[_0xb657('0x70')]=_0x2dcf79[_0xb657('0x70')];_0x5b226f['status']=_0xb657('0x71');}_0x4a4a38({'code':0xc8,'message':[_0x534644['uniqueid'],'MixMonitor\x20Success',_0x2dcf79[_0xb657('0x70')]][_0xb657('0x15')]('\x20'),'mixmonitorid':_0x2dcf79[_0xb657('0x70')]});})[_0xb657('0x1c')](function(_0x376dc0){_0x2367aa(_0x1fd7ce['error'](0x1f5,[_0x534644[_0xb657('0x67')],_0x376dc0['message'][_0xb657('0x6c')]()][_0xb657('0x15')]('\x20')));});}else{return _0x2367aa(_0x1fd7ce[_0xb657('0x12')](0x1f5,_0xb657('0x72')));}});},'VoiceChannelStopMixMonitor':function(_0xccc49b){var _0x162d76=this;return new Promise(function(_0x2e79cf,_0x305551){if(ami[_0xb657('0x11')]()==![]){return _0x305551(_0x162d76[_0xb657('0x12')](0x1f4,[config[_0xb657('0x13')]['ip'],config[_0xb657('0x13')][_0xb657('0x1d')],_0xb657('0x14')][_0xb657('0x15')]('\x20')));}var _0x1b93a6=schema(properties[_0xb657('0x62')])[_0xb657('0x3')](_0xccc49b);if(_0x1b93a6[_0xb657('0x5d')]>0x0){return _0x305551(_0x162d76[_0xb657('0x12')](0x1f4,_[_0xb657('0x73')](_0x1b93a6,_0xb657('0x1b'))[_0xb657('0x15')](',\x20')));}var _0x5a86f7=_[_0xb657('0x5e')](_0x175072[_0xb657('0x63')],{'uniqueid':_0xccc49b[_0xb657('0x67')]});if(_0x5a86f7){return Promise['resolve']()[_0xb657('0x1a')](function(){if(_0x5a86f7['channel']){return ami['Action']({'action':_0xb657('0x74'),'channel':_0x5a86f7[_0xb657('0x64')],'mixmonitorid':_0xccc49b[_0xb657('0x70')]})['catch'](function(){});}})[_0xb657('0x1a')](function(){if(_0x5a86f7[_0xb657('0x75')]){return ami[_0xb657('0x19')]({'action':'StopMixMonitor','channel':_0x5a86f7['destinationchannel'],'mixmonitorid':_0xccc49b[_0xb657('0x70')]})[_0xb657('0x1c')](function(){});}})[_0xb657('0x1a')](function(){var _0x418086=_[_0xb657('0x5e')](_0x5a86f7['monitors'],{'mixmonitorid':_0xccc49b['mixmonitorid']});if(_0x418086){_0x418086[_0xb657('0x76')]=_0xb657('0x77');}})[_0xb657('0x1a')](function(){var _0xe8f0b2=util[_0xb657('0x7')]('%s.%s',_0xccc49b[_0xb657('0x66')]||_0xccc49b[_0xb657('0x67')],_0xccc49b['format']||_0xb657('0x78'));var _0xfe306f=_[_0xb657('0x5e')](_0x5a86f7[_0xb657('0x6a')],{'filename':_0xb657('0x6b')+_0xe8f0b2[_0xb657('0x6c')]()});if(_0xfe306f){_0xfe306f[_0xb657('0x76')]=_0xb657('0x77');}})['then'](function(){_0x2e79cf({'code':0xc8,'message':[_0xccc49b['uniqueid'],'StopMixMonitor\x20Success'][_0xb657('0x15')]('\x20')});})[_0xb657('0x1c')](function(_0x341aa7){_0x305551(_0x162d76[_0xb657('0x12')](0x1f5,[_0xccc49b[_0xb657('0x67')],_0x341aa7[_0xb657('0x1b')][_0xb657('0x6c')]()]['join']('\x20')));});}else{return _0x305551(_0x162d76[_0xb657('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x4ece89){var _0x173fd6=_[_0xb657('0x61')](_0x175072['queueChannels']);_0x4ece89({'count':_0x173fd6[_0xb657('0x5d')],'rows':_0x173fd6});});},'VoiceQueuesChannel':function(_0x135c7d){var _0x271da7=this;return new Promise(function(_0x5be596,_0x39911a){var _0x4185de=schema(properties[_0xb657('0x79')])[_0xb657('0x3')](_0x135c7d);if(_0x4185de[_0xb657('0x5d')]>0x0){return _0x39911a(_0x271da7['error'](0x1f4,_['map'](_0x4185de,_0xb657('0x1b'))[_0xb657('0x15')](',\x20')));}var _0x361944=_[_0xb657('0x5e')](_0x175072[_0xb657('0x7a')],{'uniqueid':_0x135c7d[_0xb657('0x67')]});if(_0x361944){_0x5be596(_0x361944);}else{return _0x39911a(_0x271da7[_0xb657('0x12')](0x1f5,_0xb657('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x5532c7){var _0x347e9d=this;return new Promise(function(_0x2b7e92,_0x59f118){if(ami['isConnected']()==![]){return _0x59f118(_0x347e9d['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xb657('0x1d')],_0xb657('0x14')][_0xb657('0x15')]('\x20')));}var _0x4c99c1=schema(properties['voicequeuechannelhangup'])['validate'](_0x5532c7);if(_0x4c99c1[_0xb657('0x5d')]>0x0){return _0x59f118(_0x347e9d[_0xb657('0x12')](0x1f4,_[_0xb657('0x73')](_0x4c99c1,_0xb657('0x1b'))['join'](',\x20')));}var _0x3bcb24=_[_0xb657('0x5e')](_0x175072[_0xb657('0x7a')],{'uniqueid':_0x5532c7['uniqueid']});if(_0x3bcb24&&_0x3bcb24[_0xb657('0x64')]){return ami['Action']({'action':_0xb657('0x7b'),'channel':_0x3bcb24[_0xb657('0x64')]})['then'](function(_0x53e57a){_0x2b7e92({'code':0xc8,'message':[_0x5532c7[_0xb657('0x67')],_0x53e57a[_0xb657('0x1b')]['toLowerCase']()]['join']('\x20')});})[_0xb657('0x1c')](function(_0x364fb9){_0x59f118(_0x347e9d[_0xb657('0x12')](0x1f5,[_0x5532c7[_0xb657('0x67')],_0x364fb9[_0xb657('0x1b')][_0xb657('0x6c')]()]['join']('\x20')));});}else{return _0x59f118(_0x347e9d['error'](0x1f5,_0xb657('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x3c3aa0){var _0x22ab59=this;return new Promise(function(_0x326751,_0x5537eb){if(ami[_0xb657('0x11')]()==![]){return _0x5537eb(_0x22ab59[_0xb657('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xb657('0x13')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x5c0efb=schema(properties[_0xb657('0x7c')])['validate'](_0x3c3aa0);if(_0x5c0efb[_0xb657('0x5d')]>0x0){return _0x5537eb(_0x22ab59[_0xb657('0x12')](0x1f4,_[_0xb657('0x73')](_0x5c0efb,'message')['join'](',\x20')));}var _0x91e6c7=_['find'](_0x175072[_0xb657('0x7a')],{'uniqueid':_0x3c3aa0[_0xb657('0x67')]});if(_0x91e6c7&&_0x91e6c7['channel']){return ami[_0xb657('0x19')]({'action':_0xb657('0x7d'),'channel':_0x91e6c7[_0xb657('0x64')],'exten':_0x3c3aa0[_0xb657('0x7e')],'context':_0x3c3aa0[_0xb657('0x7f')]||_0x91e6c7[_0xb657('0x7f')],'priority':0x1})[_0xb657('0x1a')](function(_0x647043){_0x326751({'code':0xc8,'message':[_0x3c3aa0[_0xb657('0x67')],_0x647043[_0xb657('0x1b')]['toLowerCase']()][_0xb657('0x15')]('\x20')});})[_0xb657('0x1c')](function(_0x20b98c){_0x5537eb(_0x22ab59[_0xb657('0x12')](0x1f5,[_0x3c3aa0[_0xb657('0x67')],_0x20b98c['message'][_0xb657('0x6c')]()][_0xb657('0x15')]('\x20')));});}else{return _0x5537eb(_0x22ab59[_0xb657('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xb92035){return new Promise(function(_0x510bc0){var _0x59118c=_[_0xb657('0x61')](_0x175072[_0xb657('0xd')]);if(_0xb92035&&_0xb92035['id']){var _0x1417fb=_[_0xb657('0x5e')](_0x59118c,function(_0x35d59c){return _0x35d59c['id']===_0xb92035['id'];});_0x510bc0(_0x1417fb);}else{_0x510bc0({'count':_0x59118c[_0xb657('0x5d')],'rows':_0x59118c});}});},'Telephones':function(){return new Promise(function(_0xcc962b){var _0x3f1a07=_[_0xb657('0x61')](_0x175072[_0xb657('0x80')]);_0xcc962b({'count':_0x3f1a07[_0xb657('0x5d')],'rows':_0x3f1a07});});},'Trunks':function(){return new Promise(function(_0x2a48ea){var _0x4932fc=_[_0xb657('0x61')](_0x175072[_0xb657('0x81')]);_0x2a48ea({'count':_0x4932fc[_0xb657('0x5d')],'rows':_0x4932fc});});},'OutboundChannels':function(){return new Promise(function(_0x5ef440){var _0x27d455=_[_0xb657('0x61')](_0x175072[_0xb657('0x82')]);_0x5ef440({'count':_0x27d455[_0xb657('0x5d')],'rows':_0x27d455});});},'Outbound':function(){return new Promise(function(_0x54bf8e){_0x54bf8e(_0x175072['outbound']);});},'Campaigns':function(){return new Promise(function(_0x20ef2f){var _0xe2560c=_['values'](_0x175072[_0xb657('0x83')]);_0x20ef2f({'count':_0xe2560c[_0xb657('0x5d')],'rows':_0xe2560c});});},'VoiceQueuesPreview':function(_0x4682c9){var _0x44cd8f=this;return new Promise(function(_0x5f5297,_0x357492){_0x322e57['run'](_0x4682c9['id'])['then'](function(_0x507030){_0x5f5297({'code':0xc8,'message':_0x507030[_0xb657('0x1b')]});})[_0xb657('0x1c')](function(_0x2b5789){_0x357492(_0x44cd8f[_0xb657('0x12')](0x1f4,_0x2b5789['message']));});});},'EventManager':function(_0x4e3ac7){var _0xa05d0b=this;return new Promise(function(_0x318904,_0x49d6b1){if(!_0x4e3ac7[_0xb657('0x84')]){return _0x49d6b1(_0xa05d0b[_0xb657('0x12')](0x1f4,_0xb657('0x85')));}ami[_0xb657('0x86')]('custom:'+_0x4e3ac7[_0xb657('0x84')],_0x4e3ac7[_0xb657('0x1b')]);_0x318904({'code':0xc8,'message':_0x4e3ac7});});},'FaxAccounts':function(){return new Promise(function(_0x4339bc){var _0x1678f6=_['values'](_0x175072[_0xb657('0x87')]);_0x4339bc({'count':_0x1678f6[_0xb657('0x5d')],'rows':_0x1678f6});});},'SendFax':function(_0x2f5789){var _0xcbbb1f=this;return new Promise(function(_0x61e73d,_0x43d9fe){_0x42a145[_0xb657('0x88')](_0x2f5789)[_0xb657('0x1a')](function(_0x261153){_0x61e73d({'code':0xc8,'message':_0x261153['message']});})['catch'](function(_0x5b698c){_0x43d9fe(_0xcbbb1f[_0xb657('0x12')](0x1f4,_0x5b698c[_0xb657('0x1b')]));});});},'CheckAfterSend':function(_0x32cb27){var _0x2b17cd=this;return new Promise(function(_0x57046d,_0x434cce){_0x42a145[_0xb657('0x89')](_0x32cb27)[_0xb657('0x1a')](function(_0x354eaa){_0x57046d({'code':0xc8,'message':_0x354eaa[_0xb657('0x1b')]});})[_0xb657('0x1c')](function(_0x30a80c){_0x434cce(_0x2b17cd[_0xb657('0x12')](0x1f4,_0x30a80c[_0xb657('0x1b')]));});});}};var _0x504f61=jayson[_0xb657('0x8a')](_0x5d54f6)[_0xb657('0x8b')]();_0x504f61['on'](_0xb657('0x12'),function(_0x3b39f7){return _0x446b17(_0x3b39f7);});_0x504f61[_0xb657('0x8c')](0x232a,'127.0.0.1',function(){console[_0xb657('0x8d')](_0xb657('0x8e'),0x232a);return _0x25738d('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x85b5=['format','%s/%s','name','timers','timer','updateAcw','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','Action','message','catch','command','action','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','Interval','push','omit','undefined','values','channels','length','find','uniqueid','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','destinationchannel','StopMixMonitor','status','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','validate','../../../config/environment','listen'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85b5,0x7f));var _0x585b=function(_0x1a79ed,_0x47f3bf){_0x1a79ed=_0x1a79ed-0x0;var _0x593291=_0x85b5[_0x1a79ed];return _0x593291;};'use strict';var _=require(_0x585b('0x0'));var util=require(_0x585b('0x1'));var jayson=require('jayson/promise');var schema=require(_0x585b('0x2'));var moment=require('moment');var config=require(_0x585b('0x3'));var properties=require('../properties');var ami=require('../ami');exports[_0x585b('0x4')]=function(_0x4f37a9,_0x3c7651,_0x26ccfb){return new Promise(function(_0x9ccfca,_0x5b9e48){var _0x1605b5={'QueuePause':function(_0x55ffb3){return new Promise(function(_0x432e2d){var _0x2f8895=util[_0x585b('0x5')](_0x585b('0x6'),'SIP',_0x55ffb3[_0x585b('0x7')]);if(_0x4f37a9[_0x585b('0x8')]&&_0x4f37a9[_0x585b('0x8')][_0x2f8895]&&_0x4f37a9[_0x585b('0x8')][_0x2f8895][_0x585b('0x9')]){_0x4f37a9[_0x585b('0x8')][_0x2f8895][_0x585b('0xa')]();}if(_0x4f37a9['agents'][_0x2f8895]){_0x4f37a9[_0x585b('0xb')][_0x2f8895]['updateStatusRealtime']({'statePause':_0x55ffb3[_0x585b('0xc')]?!![]:![]});}_0x432e2d({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x16d608){var _0x35bda0=this;return new Promise(function(_0x19336c,_0x56fd9c){if(ami[_0x585b('0xd')]()==![]){return _0x56fd9c(_0x35bda0[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config[_0x585b('0xf')][_0x585b('0x10')],_0x585b('0x11')][_0x585b('0x12')]('\x20')));}_0x16d608=_['pick'](_0x16d608,_[_0x585b('0x13')](properties[_0x585b('0x14')]));_0x16d608['action']='Reload';return ami[_0x585b('0x15')](_0x16d608)['then'](function(_0x5edd12){_0x19336c({'code':0xc8,'message':_0x5edd12[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x20c4ba){_0x56fd9c(_0x35bda0['error'](0x1f5,_0x20c4ba[_0x585b('0x16')]));});});},'Command':function(_0x14648f){var _0x326a4e=this;return new Promise(function(_0x31f5c2,_0x562886){if(ami[_0x585b('0xd')]()==![]){return _0x562886(_0x326a4e[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config['asterisk']['username'],_0x585b('0x11')]['join']('\x20')));}_0x14648f=_['pick'](_0x14648f,_0x585b('0x18'));_0x14648f[_0x585b('0x19')]='Command';return ami[_0x585b('0x15')](_0x14648f)[_0x585b('0x1a')](function(_0x48998c){_0x31f5c2({'code':0xc8,'message':_0x48998c[_0x585b('0x1b')]});})[_0x585b('0x17')](function(_0x2122e0){_0x562886(_0x326a4e['error'](0x1f5,_0x2122e0[_0x585b('0x16')]));});});},'VoiceQueues':function(){return new Promise(function(_0x48940e){var _0x3c861c=[];for(var _0x10dd42 in _0x4f37a9[_0x585b('0x1c')]){if(_0x4f37a9[_0x585b('0x1c')][_0x585b('0x1d')](_0x10dd42)){var _0x1b1241=_0x4f37a9[_0x585b('0x1c')][_0x10dd42];var _0x799947={'id':_0x1b1241['id'],'name':_0x1b1241[_0x585b('0x7')],'strategy':_0x1b1241[_0x585b('0x1e')],'answered':_0x1b1241[_0x585b('0x1f')],'available':_0x1b1241[_0x585b('0x20')],'loggedIn':_0x1b1241[_0x585b('0x21')],'pTalking':_0x1b1241[_0x585b('0x22')],'sumBillable':_0x1b1241[_0x585b('0x23')],'sumDuration':_0x1b1241['sumDuration'],'sumHoldTime':_0x1b1241[_0x585b('0x24')]||0x0,'talking':_0x1b1241[_0x585b('0x25')],'total':_0x1b1241[_0x585b('0x26')],'type':_0x1b1241[_0x585b('0x27')],'unmanaged':_0x1b1241['unmanaged'],'abandoned':_0x1b1241['abandoned'],'waiting':_0x1b1241[_0x585b('0x28')],'loggedInDb':_0x1b1241[_0x585b('0x29')]};if(_0x1b1241['type']===_0x585b('0x2a')){_0x799947[_0x585b('0x2b')]=_0x1b1241['dialActive'];_0x799947[_0x585b('0x2c')]=_0x1b1241[_0x585b('0x2c')];_0x799947[_0x585b('0x2d')]=_0x1b1241[_0x585b('0x2d')];_0x799947[_0x585b('0x2e')]=_0x1b1241[_0x585b('0x2e')];_0x799947[_0x585b('0x2f')]=_0x1b1241[_0x585b('0x2f')];_0x799947[_0x585b('0x30')]=_0x1b1241[_0x585b('0x30')];_0x799947['temp']=_0x1b1241[_0x585b('0x31')];_0x799947[_0x585b('0x32')]=_0x1b1241[_0x585b('0x32')];_0x799947['outboundAnswerCallsDay']=_0x1b1241[_0x585b('0x33')];_0x799947[_0x585b('0x34')]=_0x1b1241[_0x585b('0x34')];_0x799947['outboundBusyCallsDay']=_0x1b1241[_0x585b('0x35')];_0x799947[_0x585b('0x36')]=_0x1b1241[_0x585b('0x36')];_0x799947[_0x585b('0x37')]=_0x1b1241['outboundDropCallsDayACS'];_0x799947['outboundDropCallsDayCallersExit']=_0x1b1241[_0x585b('0x38')];_0x799947[_0x585b('0x39')]=_0x1b1241[_0x585b('0x39')];_0x799947[_0x585b('0x3a')]=_0x1b1241[_0x585b('0x3a')];_0x799947['outboundNoSuchCallsDay']=_0x1b1241[_0x585b('0x3b')];_0x799947[_0x585b('0x3c')]=_0x1b1241[_0x585b('0x3c')];_0x799947[_0x585b('0x3d')]=_0x1b1241[_0x585b('0x3d')];_0x799947['outboundRejectCallsDay']=_0x1b1241['outboundRejectCallsDay'];_0x799947['outboundUnknownCallsDay']=_0x1b1241[_0x585b('0x3e')];_0x799947[_0x585b('0x3f')]=_0x1b1241[_0x585b('0x3f')];_0x799947[_0x585b('0x40')]=_0x1b1241[_0x585b('0x40')];_0x799947[_0x585b('0x41')]=_0x1b1241[_0x585b('0x41')];_0x799947[_0x585b('0x42')]=_0x1b1241[_0x585b('0x42')];_0x799947['predictiveIntervalDroppedCallsTimeout']=_0x1b1241[_0x585b('0x43')];_0x799947[_0x585b('0x44')]=_0x1b1241['predictiveIntervalErlangCalls'];_0x799947[_0x585b('0x45')]=_0x1b1241[_0x585b('0x45')];_0x799947[_0x585b('0x46')]=_0x1b1241[_0x585b('0x46')];_0x799947[_0x585b('0x47')]=_0x1b1241[_0x585b('0x47')];_0x799947['predictiveIntervalPauses']=_0x1b1241[_0x585b('0x48')];_0x799947[_0x585b('0x49')]=_0x1b1241[_0x585b('0x49')];_0x799947[_0x585b('0x4a')]=_0x1b1241[_0x585b('0x4a')];_0x799947[_0x585b('0x16')]=_0x1b1241[_0x585b('0x16')];_0x799947[_0x585b('0x4b')]=_0x1b1241['originated'];_0x799947[_0x585b('0x4c')]=_0x1b1241[_0x585b('0x4c')];_0x799947[_0x585b('0x4d')]=_0x1b1241['erlangCallToSecond'];_0x799947[_0x585b('0x4e')]=_0x1b1241[_0x585b('0x4e')];_0x799947[_0x585b('0x4f')]=_0x1b1241['erlangBusyFactor'];_0x799947[_0x585b('0x50')]=_0x1b1241[_0x585b('0x50')];_0x799947['startProgressive']=_0x1b1241['startProgressive'];}if(_0x1b1241[_0x585b('0x51')]){_0x799947['Trunk']={'id':_0x1b1241[_0x585b('0x51')]['id'],'name':_0x1b1241['Trunk'][_0x585b('0x7')],'active':_0x1b1241[_0x585b('0x51')]['active'],'callerid':_0x1b1241[_0x585b('0x51')]['callerid']};}if(_0x1b1241['Interval']){_0x799947['Interval']={'id':_0x1b1241[_0x585b('0x52')]['id'],'name':_0x1b1241['Interval'][_0x585b('0x7')]};}_0x3c861c[_0x585b('0x53')](_0x799947);}}_0x48940e({'count':_0x3c861c['length'],'rows':_0x3c861c});});},'UpdateVoiceQueue':function(_0x16b80a){return new Promise(function(_0x3d707f,_0x891252){var _0x4f087c=_['find'](_0x4f37a9['voiceQueues'],{'id':parseInt(_0x16b80a['id'])});var _0x2f1d2e=_[_0x585b('0x54')](_0x16b80a,['id']);if(_0x4f087c){for(var _0xa008dc in _0x2f1d2e){if(typeof _0x2f1d2e[_0xa008dc]!==_0x585b('0x55')&&typeof _0x4f087c[_0xa008dc]!=='undefined'){_0x4f087c[_0xa008dc]=_0x2f1d2e[_0xa008dc];}}_0x3d707f(_0x4f087c);}else{_0x891252();}});},'VoiceChannels':function(){return new Promise(function(_0x21eba3){var _0xf9c56d=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x57')]);_0x21eba3({'count':_0xf9c56d['length'],'rows':_0xf9c56d});});},'VoiceChannelMixMonitor':function(_0x41f22a){var _0x39c2e0=this;return new Promise(function(_0x36eb61,_0x5bf8b4){if(ami[_0x585b('0xd')]()==![]){return _0x5bf8b4(_0x39c2e0['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x585b('0x10')],'ami\x20disconnected'][_0x585b('0x12')]('\x20')));}var _0x54ab6f=schema(properties['voicechannel'])['validate'](_0x41f22a);if(_0x54ab6f[_0x585b('0x58')]>0x0){return _0x5bf8b4(_0x39c2e0[_0x585b('0xe')](0x1f4,_['map'](_0x54ab6f,'message')[_0x585b('0x12')](',\x20')));}var _0x40dd9f=_[_0x585b('0x59')](_0x4f37a9['channels'],{'uniqueid':_0x41f22a[_0x585b('0x5a')]});if(_0x40dd9f&&_0x40dd9f['channel']){var _0x44234e=util['format'](_0x585b('0x5b'),_0x41f22a['filename']||_0x41f22a[_0x585b('0x5a')],_0x41f22a['format']||_0x585b('0x5c'));return ami[_0x585b('0x15')]({'action':_0x585b('0x5d'),'channel':_0x40dd9f[_0x585b('0x5e')],'file':_0x44234e,'options':_0x585b('0x5f')})['then'](function(_0xec885c){var _0x2ef157=_[_0x585b('0x59')](_0x40dd9f[_0x585b('0x60')],{'filename':_0x585b('0x61')+_0x44234e[_0x585b('0x62')]()});if(_['isNil'](_0x2ef157)){_0x40dd9f[_0x585b('0x60')][_0x585b('0x53')]({'filename':_0x585b('0x61')+_0x44234e[_0x585b('0x62')](),'createdAt':moment()['format'](_0x585b('0x63')),'mixmonitorid':_0xec885c[_0x585b('0x64')],'status':_0x585b('0x65')});}else{_0x2ef157['mixmonitorid']=_0xec885c['mixmonitorid'];_0x2ef157['status']='rec';}_0x36eb61({'code':0xc8,'message':[_0x41f22a['uniqueid'],'MixMonitor\x20Success',_0xec885c[_0x585b('0x64')]][_0x585b('0x12')]('\x20'),'mixmonitorid':_0xec885c[_0x585b('0x64')]});})['catch'](function(_0x1efe6b){_0x5bf8b4(_0x39c2e0[_0x585b('0xe')](0x1f5,[_0x41f22a[_0x585b('0x5a')],_0x1efe6b[_0x585b('0x16')]['toLowerCase']()][_0x585b('0x12')]('\x20')));});}else{return _0x5bf8b4(_0x39c2e0[_0x585b('0xe')](0x1f5,_0x585b('0x66')));}});},'VoiceChannelStopMixMonitor':function(_0x136ba9){var _0xe4f07b=this;return new Promise(function(_0x3d5b4a,_0x214869){if(ami['isConnected']()==![]){return _0x214869(_0xe4f07b[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config[_0x585b('0xf')][_0x585b('0x10')],_0x585b('0x11')][_0x585b('0x12')]('\x20')));}var _0x13678f=schema(properties[_0x585b('0x67')])[_0x585b('0x2')](_0x136ba9);if(_0x13678f[_0x585b('0x58')]>0x0){return _0x214869(_0xe4f07b[_0x585b('0xe')](0x1f4,_[_0x585b('0x68')](_0x13678f,_0x585b('0x16'))[_0x585b('0x12')](',\x20')));}var _0x4ded11=_[_0x585b('0x59')](_0x4f37a9['channels'],{'uniqueid':_0x136ba9[_0x585b('0x5a')]});if(_0x4ded11){return Promise[_0x585b('0x69')]()['then'](function(){if(_0x4ded11[_0x585b('0x5e')]){return ami[_0x585b('0x15')]({'action':'StopMixMonitor','channel':_0x4ded11['channel'],'mixmonitorid':_0x136ba9['mixmonitorid']})['catch'](function(){});}})['then'](function(){if(_0x4ded11[_0x585b('0x6a')]){return ami['Action']({'action':_0x585b('0x6b'),'channel':_0x4ded11[_0x585b('0x6a')],'mixmonitorid':_0x136ba9[_0x585b('0x64')]})[_0x585b('0x17')](function(){});}})[_0x585b('0x1a')](function(){var _0x3275c4=_['find'](_0x4ded11['monitors'],{'mixmonitorid':_0x136ba9['mixmonitorid']});if(_0x3275c4){_0x3275c4[_0x585b('0x6c')]=_0x585b('0x6d');}})[_0x585b('0x1a')](function(){var _0x117a66=util[_0x585b('0x5')]('%s.%s',_0x136ba9[_0x585b('0x6e')]||_0x136ba9[_0x585b('0x5a')],_0x136ba9[_0x585b('0x5')]||_0x585b('0x5c'));var _0xd23f61=_['find'](_0x4ded11[_0x585b('0x60')],{'filename':_0x585b('0x61')+_0x117a66[_0x585b('0x62')]()});if(_0xd23f61){_0xd23f61[_0x585b('0x6c')]=_0x585b('0x6d');}})['then'](function(){_0x3d5b4a({'code':0xc8,'message':[_0x136ba9[_0x585b('0x5a')],_0x585b('0x6f')][_0x585b('0x12')]('\x20')});})[_0x585b('0x17')](function(_0x4ab991){_0x214869(_0xe4f07b[_0x585b('0xe')](0x1f5,[_0x136ba9[_0x585b('0x5a')],_0x4ab991[_0x585b('0x16')][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')));});}else{return _0x214869(_0xe4f07b[_0x585b('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x362070){var _0x56f7f4=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x70')]);_0x362070({'count':_0x56f7f4[_0x585b('0x58')],'rows':_0x56f7f4});});},'VoiceQueuesChannel':function(_0x5a4373){var _0x257703=this;return new Promise(function(_0x11bd7b,_0x424658){var _0x21ad2b=schema(properties[_0x585b('0x71')])[_0x585b('0x2')](_0x5a4373);if(_0x21ad2b[_0x585b('0x58')]>0x0){return _0x424658(_0x257703['error'](0x1f4,_[_0x585b('0x68')](_0x21ad2b,_0x585b('0x16'))[_0x585b('0x12')](',\x20')));}var _0x23f7b0=_[_0x585b('0x59')](_0x4f37a9['queueChannels'],{'uniqueid':_0x5a4373[_0x585b('0x5a')]});if(_0x23f7b0){_0x11bd7b(_0x23f7b0);}else{return _0x424658(_0x257703[_0x585b('0xe')](0x1f5,_0x585b('0x66')));}});},'VoiceQueuesChannelHangup':function(_0x252397){var _0x518155=this;return new Promise(function(_0x284bf9,_0x17644f){if(ami[_0x585b('0xd')]()==![]){return _0x17644f(_0x518155[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config[_0x585b('0xf')]['username'],'ami\x20disconnected'][_0x585b('0x12')]('\x20')));}var _0x2112e=schema(properties['voicequeuechannelhangup'])[_0x585b('0x2')](_0x252397);if(_0x2112e[_0x585b('0x58')]>0x0){return _0x17644f(_0x518155[_0x585b('0xe')](0x1f4,_[_0x585b('0x68')](_0x2112e,'message')['join'](',\x20')));}var _0x16808b=_['find'](_0x4f37a9[_0x585b('0x70')],{'uniqueid':_0x252397[_0x585b('0x5a')]});if(_0x16808b&&_0x16808b['channel']){return ami['Action']({'action':_0x585b('0x72'),'channel':_0x16808b[_0x585b('0x5e')]})[_0x585b('0x1a')](function(_0x34cee5){_0x284bf9({'code':0xc8,'message':[_0x252397[_0x585b('0x5a')],_0x34cee5[_0x585b('0x16')][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')});})['catch'](function(_0x3d1c26){_0x17644f(_0x518155['error'](0x1f5,[_0x252397['uniqueid'],_0x3d1c26[_0x585b('0x16')][_0x585b('0x62')]()]['join']('\x20')));});}else{return _0x17644f(_0x518155[_0x585b('0xe')](0x1f5,_0x585b('0x66')));}});},'VoiceQueuesChannelRedirect':function(_0x4c55b5){var _0xfa879a=this;return new Promise(function(_0x1f4d1e,_0x583f4a){if(ami[_0x585b('0xd')]()==![]){return _0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x585b('0xf')]['username'],_0x585b('0x11')][_0x585b('0x12')]('\x20')));}var _0x22367f=schema(properties[_0x585b('0x73')])[_0x585b('0x2')](_0x4c55b5);if(_0x22367f[_0x585b('0x58')]>0x0){return _0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f4,_[_0x585b('0x68')](_0x22367f,_0x585b('0x16'))[_0x585b('0x12')](',\x20')));}var _0x17bf88=_[_0x585b('0x59')](_0x4f37a9[_0x585b('0x70')],{'uniqueid':_0x4c55b5[_0x585b('0x5a')]});if(_0x17bf88&&_0x17bf88['channel']){return ami[_0x585b('0x15')]({'action':_0x585b('0x74'),'channel':_0x17bf88[_0x585b('0x5e')],'exten':_0x4c55b5[_0x585b('0x75')],'context':_0x4c55b5[_0x585b('0x76')]||_0x17bf88[_0x585b('0x76')],'priority':0x1})[_0x585b('0x1a')](function(_0x18a997){_0x1f4d1e({'code':0xc8,'message':[_0x4c55b5[_0x585b('0x5a')],_0x18a997['message'][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')});})[_0x585b('0x17')](function(_0x27bc68){_0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f5,[_0x4c55b5[_0x585b('0x5a')],_0x27bc68['message'][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')));});}else{return _0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x47aca4){return new Promise(function(_0x1ee917){var _0x44f336=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0xb')]);if(_0x47aca4&&_0x47aca4['id']){var _0x5a0f9f=_[_0x585b('0x59')](_0x44f336,function(_0x227aac){return _0x227aac['id']===_0x47aca4['id'];});_0x1ee917(_0x5a0f9f);}else{_0x1ee917({'count':_0x44f336[_0x585b('0x58')],'rows':_0x44f336});}});},'Telephones':function(){return new Promise(function(_0x2c8150){var _0x1860c0=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x77')]);_0x2c8150({'count':_0x1860c0['length'],'rows':_0x1860c0});});},'Trunks':function(){return new Promise(function(_0x145bf5){var _0x5f58de=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x78')]);_0x145bf5({'count':_0x5f58de['length'],'rows':_0x5f58de});});},'OutboundChannels':function(){return new Promise(function(_0x1fc8b2){var _0x2f6407=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x79')]);_0x1fc8b2({'count':_0x2f6407[_0x585b('0x58')],'rows':_0x2f6407});});},'Outbound':function(){return new Promise(function(_0xeb2a1e){_0xeb2a1e(_0x4f37a9[_0x585b('0x2a')]);});},'Campaigns':function(){return new Promise(function(_0x52bfa6){var _0x5dfc52=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x7a')]);_0x52bfa6({'count':_0x5dfc52[_0x585b('0x58')],'rows':_0x5dfc52});});},'VoiceQueuesPreview':function(_0x31cc88){var _0x2b2e3c=this;return new Promise(function(_0x5b83d6,_0x2ed882){_0x3c7651['run'](_0x31cc88['id'])[_0x585b('0x1a')](function(_0xcbc665){_0x5b83d6({'code':0xc8,'message':_0xcbc665[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x14d919){_0x2ed882(_0x2b2e3c['error'](0x1f4,_0x14d919[_0x585b('0x16')]));});});},'EventManager':function(_0x407d42){var _0x1dafe=this;return new Promise(function(_0x246fc3,_0x17b210){if(!_0x407d42[_0x585b('0x7b')]){return _0x17b210(_0x1dafe[_0x585b('0xe')](0x1f4,_0x585b('0x7c')));}ami['emit']('custom:'+_0x407d42[_0x585b('0x7b')],_0x407d42['message']);_0x246fc3({'code':0xc8,'message':_0x407d42});});},'FaxAccounts':function(){return new Promise(function(_0x264cf4){var _0x5f165b=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x7d')]);_0x264cf4({'count':_0x5f165b['length'],'rows':_0x5f165b});});},'SendFax':function(_0x41c464){var _0x5d9a36=this;return new Promise(function(_0x3d11e4,_0x42a0b7){_0x26ccfb[_0x585b('0x7e')](_0x41c464)[_0x585b('0x1a')](function(_0x427867){_0x3d11e4({'code':0xc8,'message':_0x427867[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x2e25dc){_0x42a0b7(_0x5d9a36['error'](0x1f4,_0x2e25dc[_0x585b('0x16')]));});});},'CheckAfterSend':function(_0x2d2fa5){var _0x2b6ee1=this;return new Promise(function(_0x9a500d,_0x1571b0){_0x26ccfb[_0x585b('0x7f')](_0x2d2fa5)['then'](function(_0x508d55){_0x9a500d({'code':0xc8,'message':_0x508d55[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x534f43){_0x1571b0(_0x2b6ee1[_0x585b('0xe')](0x1f4,_0x534f43[_0x585b('0x16')]));});});}};var _0x44b792=jayson[_0x585b('0x80')](_0x1605b5)[_0x585b('0x81')]();_0x44b792['on']('error',function(_0x39086e){return _0x5b9e48(_0x39086e);});_0x44b792[_0x585b('0x4')](0x232a,'127.0.0.1',function(){console[_0x585b('0x82')](_0x585b('0x83'),0x232a);return _0x9ccfca('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 8422fbb..8bf3a51 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 _0x49b0=['$or','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','routeId','calleridname','','destcalleridname','Unknown','createContact','push','format','user:%s','name','trigger:%s','action','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone'];(function(_0x57cdf2,_0x14899b){var _0x5f1d82=function(_0x358efa){while(--_0x358efa){_0x57cdf2['push'](_0x57cdf2['shift']());}};_0x5f1d82(++_0x14899b);}(_0x49b0,0x115));var _0x049b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x49b0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x049b('0x0'));var BPromise=require(_0x049b('0x1'));var Redis=require(_0x049b('0x2'));var util=require('util');var config=require(_0x049b('0x3'));var logger=require(_0x049b('0x4'))('trigger');var cmContactRpc=require(_0x049b('0x5'));config[_0x049b('0x6')]=_[_0x049b('0x7')](config[_0x049b('0x6')],{'host':_0x049b('0x8'),'port':0x18eb});var io=require(_0x049b('0x9'))(new Redis(config[_0x049b('0x6')]));function emit(_0x3bd445,_0x1a5895,_0x39c578,_0x288930,_0x4fef3a){logger[_0x049b('0xa')](_0x049b('0xb'),_0x3bd445,_0x1a5895['id'],_0x39c578,_0x288930,JSON[_0x049b('0xc')](_0x4fef3a));io['to'](_0x39c578)[_0x049b('0xd')](_0x288930,_0x4fef3a);}exports[_0x049b('0xe')]=function(_0x606de6,_0x55a76e,_0x3f1404,_0x1a21fc){var _0x38fd3f,_0x2b46b0;var _0xaa7ff={};var _0x4fd563;var _0x2b1b8f=Number(_0x3f1404[_0x049b('0xf')]);var _0x225d46=_0x3f1404[_0x049b('0x10')]?Boolean(Number(_0x3f1404[_0x049b('0x10')])):![];var _0x3e101a;var _0x5595c6=![];if(!_[_0x049b('0x11')](_0x3f1404[_0x049b('0x12')])){if(_0x3f1404[_0x049b('0x12')]=='1')_0x5595c6=!![];}if(!_0x5595c6){if(_0x1a21fc[_0x049b('0x13')]){_0xaa7ff['id']=_0x1a21fc[_0x049b('0x13')];}}if(!_0xaa7ff['id']){_0xaa7ff['ListId']=_0x2b1b8f;_0x3e101a=_0x3f1404[_0x049b('0x14')]&&_0x3f1404[_0x049b('0x14')]!=='0'?_0x3f1404[_0x049b('0x14')][_0x049b('0x15')](','):[_0x049b('0x16')];_0xaa7ff[_0x049b('0x17')]=_['map'](_0x3e101a,function(_0x4bada3){var _0x6b5ac1={};_0x6b5ac1[_0x4bada3]=_0x1a21fc['routeId']?_0x1a21fc[_0x049b('0x18')]:_0x1a21fc['calleridnum'];return _0x6b5ac1;});_0x4fd563=_0x1a21fc['routeId']?_0x1a21fc[_0x049b('0x18')]:_0x1a21fc[_0x049b('0x19')];}var _0xbc27aa=['id',_0x049b('0x1a'),_0x049b('0x1b'),_0x049b('0x16'),_0x049b('0x1c'),_0x049b('0x1d'),_0x049b('0x1e'),_0x049b('0x1f'),_0x049b('0x20'),_0x049b('0x21')];var _0x14f0b6=_[_0x049b('0x22')](_0xbc27aa,_0x3e101a);BPromise[_0x049b('0x23')]()[_0x049b('0x24')](cmContactRpc[_0x049b('0x25')]({'attributes':_0x14f0b6,'where':_0xaa7ff,'phone':_0x4fd563}))[_0x049b('0x24')](function(_0x66a3cc){_0x2b46b0=_0x66a3cc;if(!_[_0x049b('0x26')](_0x2b46b0)){if(_0x2b46b0[_0x049b('0x27')]===0x1){_0x38fd3f=_0x2b46b0[0x0];logger[_0x049b('0xa')](_0x049b('0x28'),_0x1a21fc[_0x049b('0x29')],_0x55a76e['id'],_0x38fd3f['id']);}else{logger[_0x049b('0xa')](_0x049b('0x2a'),_0x1a21fc[_0x049b('0x29')],_0x55a76e['id'],_[_0x049b('0x2b')](_0x2b46b0,'id')[_0x049b('0x2c')](','));}return;}else{logger[_0x049b('0xa')](_0x049b('0x2d'),_0x1a21fc[_0x049b('0x29')],_0x55a76e['id']);var _0xb4398a={'ListId':_0x2b1b8f};var _0x137368=_0x3f1404[_0x049b('0x2e')]&&_0x3f1404[_0x049b('0x2e')]!=='0'?_0x3f1404['data4']:'phone';if(_0x225d46){logger[_0x049b('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1a21fc['uniqueid'],_0x55a76e['id']);_0xb4398a[_0x137368]=_['isNil'](_0x1a21fc[_0x049b('0x2f')])?_0x1a21fc['calleridnum']:_0x1a21fc[_0x049b('0x18')];if(_['isNil'](_0x1a21fc[_0x049b('0x2f')])){_0xb4398a[_0x049b('0x1a')]=_0x1a21fc[_0x049b('0x30')]&&_0x1a21fc[_0x049b('0x30')]!==_0x049b('0x31')?_0x1a21fc[_0x049b('0x30')]:'Unknown';}else{_0xb4398a['firstName']=_0x1a21fc[_0x049b('0x32')]&&_0x1a21fc[_0x049b('0x32')]!==_0x049b('0x31')?_0x1a21fc[_0x049b('0x32')]:_0x049b('0x33');}return BPromise[_0x049b('0x23')]()[_0x049b('0x24')](cmContactRpc[_0x049b('0x34')](_0xb4398a))[_0x049b('0x24')](function(_0x2f985a){_0x38fd3f=_0x2f985a;_0x2b46b0[_0x049b('0x35')](_0x2f985a);if(_0x38fd3f){logger[_0x049b('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1a21fc[_0x049b('0x29')],_0x55a76e['id'],_0x38fd3f['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1a21fc[_0x049b('0x29')],_0x55a76e['id']);_0xb4398a[_0x137368]=_[_0x049b('0x11')](_0x1a21fc[_0x049b('0x2f')])?_0x1a21fc['calleridnum']:_0x1a21fc['destcalleridnum'];if(_[_0x049b('0x11')](_0x1a21fc[_0x049b('0x2f')])){_0xb4398a[_0x049b('0x1a')]=_0x1a21fc[_0x049b('0x30')]&&_0x1a21fc[_0x049b('0x30')]!==_0x049b('0x31')?_0x1a21fc[_0x049b('0x30')]:_0x049b('0x33');}else{_0xb4398a[_0x049b('0x1a')]=_0x1a21fc[_0x049b('0x32')]&&_0x1a21fc[_0x049b('0x32')]!==_0x049b('0x31')?_0x1a21fc[_0x049b('0x32')]:'Unknown';}_0x38fd3f=_0xb4398a;_0x2b46b0[_0x049b('0x35')](_0xb4398a);return;}}})[_0x049b('0x24')](function(){if(_0x606de6){emit(_0x1a21fc[_0x049b('0x29')],_0x55a76e,util[_0x049b('0x36')](_0x049b('0x37'),_0x606de6[_0x049b('0x38')]),util['format'](_0x049b('0x39'),_0x3f1404[_0x049b('0x3a')]['toLowerCase']()),{'evt':_[_0x049b('0x3b')](_0x1a21fc,{'autoCreate':_0x225d46}),'contact':_0x38fd3f===undefined?{}:_0x38fd3f,'contacts':_0x2b46b0['length']===0x0?undefined:_0x2b46b0});}});}; \ No newline at end of file +var _0x46f1=['map','routeId','destcalleridnum','calleridnum','lastName','fax','scheduledAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','firstName','destcalleridname','Unknown','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone'];(function(_0x59f3c5,_0x336ec8){var _0x4cbe58=function(_0x1eae45){while(--_0x1eae45){_0x59f3c5['push'](_0x59f3c5['shift']());}};_0x4cbe58(++_0x336ec8);}(_0x46f1,0x1da));var _0x146f=function(_0x4789da,_0x33b046){_0x4789da=_0x4789da-0x0;var _0x573480=_0x46f1[_0x4789da];return _0x573480;};'use strict';var _=require(_0x146f('0x0'));var BPromise=require(_0x146f('0x1'));var Redis=require('ioredis');var util=require(_0x146f('0x2'));var config=require(_0x146f('0x3'));var logger=require(_0x146f('0x4'))(_0x146f('0x5'));var cmContactRpc=require(_0x146f('0x6'));config[_0x146f('0x7')]=_['defaults'](config[_0x146f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x146f('0x8'))(new Redis(config['redis']));function emit(_0x576962,_0x73162f,_0x14b007,_0x3e7321,_0x30a118){logger[_0x146f('0x9')](_0x146f('0xa'),_0x576962,_0x73162f['id'],_0x14b007,_0x3e7321,JSON['stringify'](_0x30a118));io['to'](_0x14b007)[_0x146f('0xb')](_0x3e7321,_0x30a118);}exports[_0x146f('0xc')]=function(_0x421703,_0x58326e,_0x2440a3,_0x50a8fc){var _0x8c3984,_0x269d43;var _0x3b09a6={};var _0x410473;var _0x57f2c4=Number(_0x2440a3['data1']);var _0x47c7dd=_0x2440a3['data2']?Boolean(Number(_0x2440a3[_0x146f('0xd')])):![];var _0x33be1c;var _0x18121e=![];if(!_[_0x146f('0xe')](_0x2440a3[_0x146f('0xf')])){if(_0x2440a3[_0x146f('0xf')]=='1')_0x18121e=!![];}if(!_0x18121e){if(_0x50a8fc[_0x146f('0x10')]){_0x3b09a6['id']=_0x50a8fc[_0x146f('0x10')];}}if(!_0x3b09a6['id']){_0x3b09a6[_0x146f('0x11')]=_0x57f2c4;_0x33be1c=_0x2440a3[_0x146f('0x12')]&&_0x2440a3['data3']!=='0'?_0x2440a3[_0x146f('0x12')][_0x146f('0x13')](','):[_0x146f('0x14')];_0x3b09a6['$or']=_[_0x146f('0x15')](_0x33be1c,function(_0x2ba8f5){var _0x33190e={};_0x33190e[_0x2ba8f5]=_0x50a8fc[_0x146f('0x16')]?_0x50a8fc[_0x146f('0x17')]:_0x50a8fc[_0x146f('0x18')];return _0x33190e;});_0x410473=_0x50a8fc[_0x146f('0x16')]?_0x50a8fc[_0x146f('0x17')]:_0x50a8fc['calleridnum'];}var _0x5d7774=['id','firstName',_0x146f('0x19'),_0x146f('0x14'),'mobile',_0x146f('0x1a'),'ListId','createdAt',_0x146f('0x1b'),'updatedAt'];var _0x3c9002=_[_0x146f('0x1c')](_0x5d7774,_0x33be1c);BPromise[_0x146f('0x1d')]()['then'](cmContactRpc[_0x146f('0x1e')]({'attributes':_0x3c9002,'where':_0x3b09a6,'phone':_0x410473}))[_0x146f('0x1f')](function(_0x4124d8){_0x269d43=_0x4124d8;if(!_[_0x146f('0x20')](_0x269d43)){if(_0x269d43[_0x146f('0x21')]===0x1){_0x8c3984=_0x269d43[0x0];logger[_0x146f('0x9')](_0x146f('0x22'),_0x50a8fc[_0x146f('0x23')],_0x58326e['id'],_0x8c3984['id']);}else{logger[_0x146f('0x9')](_0x146f('0x24'),_0x50a8fc[_0x146f('0x23')],_0x58326e['id'],_['map'](_0x269d43,'id')['join'](','));}return;}else{logger['info'](_0x146f('0x25'),_0x50a8fc[_0x146f('0x23')],_0x58326e['id']);var _0x3b88d8={'ListId':_0x57f2c4};var _0x27d210=_0x2440a3[_0x146f('0x26')]&&_0x2440a3[_0x146f('0x26')]!=='0'?_0x2440a3['data4']:_0x146f('0x14');if(_0x47c7dd){logger['info'](_0x146f('0x27'),_0x50a8fc[_0x146f('0x23')],_0x58326e['id']);_0x3b88d8[_0x27d210]=_[_0x146f('0xe')](_0x50a8fc['routeId'])?_0x50a8fc[_0x146f('0x18')]:_0x50a8fc[_0x146f('0x17')];if(_[_0x146f('0xe')](_0x50a8fc[_0x146f('0x16')])){_0x3b88d8['firstName']=_0x50a8fc[_0x146f('0x28')]&&_0x50a8fc['calleridname']!==_0x146f('0x29')?_0x50a8fc['calleridname']:'Unknown';}else{_0x3b88d8[_0x146f('0x2a')]=_0x50a8fc[_0x146f('0x2b')]&&_0x50a8fc[_0x146f('0x2b')]!==''?_0x50a8fc['destcalleridname']:_0x146f('0x2c');}return BPromise['resolve']()[_0x146f('0x1f')](cmContactRpc['createContact'](_0x3b88d8))[_0x146f('0x1f')](function(_0x3a9b5c){_0x8c3984=_0x3a9b5c;_0x269d43['push'](_0x3a9b5c);if(_0x8c3984){logger[_0x146f('0x9')](_0x146f('0x2d'),_0x50a8fc[_0x146f('0x23')],_0x58326e['id'],_0x8c3984['id']);}return;});}else{logger[_0x146f('0x9')](_0x146f('0x2e'),_0x50a8fc[_0x146f('0x23')],_0x58326e['id']);_0x3b88d8[_0x27d210]=_[_0x146f('0xe')](_0x50a8fc['routeId'])?_0x50a8fc[_0x146f('0x18')]:_0x50a8fc['destcalleridnum'];if(_['isNil'](_0x50a8fc['routeId'])){_0x3b88d8[_0x146f('0x2a')]=_0x50a8fc[_0x146f('0x28')]&&_0x50a8fc[_0x146f('0x28')]!==_0x146f('0x29')?_0x50a8fc[_0x146f('0x28')]:'Unknown';}else{_0x3b88d8[_0x146f('0x2a')]=_0x50a8fc['destcalleridname']&&_0x50a8fc[_0x146f('0x2b')]!==_0x146f('0x29')?_0x50a8fc['destcalleridname']:'Unknown';}_0x8c3984=_0x3b88d8;_0x269d43[_0x146f('0x2f')](_0x3b88d8);return;}}})[_0x146f('0x1f')](function(){if(_0x421703){emit(_0x50a8fc[_0x146f('0x23')],_0x58326e,util[_0x146f('0x30')](_0x146f('0x31'),_0x421703[_0x146f('0x32')]),util['format'](_0x146f('0x33'),_0x2440a3[_0x146f('0x34')][_0x146f('0x35')]()),{'evt':_[_0x146f('0x36')](_0x50a8fc,{'autoCreate':_0x47c7dd}),'contact':_0x8c3984===undefined?{}:_0x8c3984,'contacts':_0x269d43['length']===0x0?undefined:_0x269d43});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0571b67..634a8f8 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 _0xaee6=['some','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','queue','agent','membername','lastevent','null','substatus','created','exports','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','salesforceAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','undefined','motionChannel','voice','checkTriggers','hasOwnProperty','status','variables','interface','action','toLowerCase','motionbar','TemplateId','data2','html','render','template\x20not\x20found','buildUri','data3','isNil','data4','location','uriLocation','data5','800','600','data6','winapp','winApplication','winArguments','format','trigger:%s:%s','jscripty','user:%s','merge','data1','name','trigger:%s','contactmanager','integration','exec','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','length','every','checkConditions'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0xaee6,0x187));var _0x6aee=function(_0x4f4fca,_0x22129f){_0x4f4fca=_0x4f4fca-0x0;var _0x3ad1a1=_0xaee6[_0x4f4fca];return _0x3ad1a1;};'use strict';var util=require(_0x6aee('0x0'));var _=require(_0x6aee('0x1'));var url=require(_0x6aee('0x2'));var Mustache=require(_0x6aee('0x3'));var Redis=require(_0x6aee('0x4'));var urlforward=require(_0x6aee('0x5'));var integration=require('./integration');var cmContact=require(_0x6aee('0x6'));var script=require(_0x6aee('0x7'));var config=require(_0x6aee('0x8'));var logger=require('../../../config/logger')(_0x6aee('0x9'));var ami=require(_0x6aee('0xa'));config[_0x6aee('0xb')]=_[_0x6aee('0xc')](config[_0x6aee('0xb')],{'host':_0x6aee('0xd'),'port':0x18eb});var io=require(_0x6aee('0xe'))(new Redis(config['redis']));var operators={'equals':function(_0x490b55,_0x9cc4ee){return _0x490b55==_0x9cc4ee;},'not_equals':function(_0x5ac194,_0x27a179){return _0x5ac194!=_0x27a179;}};var barAndWebActions=[_0x6aee('0xf'),_0x6aee('0x2'),'winapp'];function Trigger(_0xd99e94){this[_0x6aee('0x10')]=_0xd99e94[_0x6aee('0x10')];this[_0x6aee('0x11')]=_0xd99e94['agents'];this[_0x6aee('0x12')]=_0xd99e94['voiceQueues'];this[_0x6aee('0x13')]=_0xd99e94[_0x6aee('0x13')];this[_0x6aee('0x14')]=_0xd99e94[_0x6aee('0x14')];this[_0x6aee('0x15')]=_0xd99e94['zendeskAccounts'];this[_0x6aee('0x16')]=_0xd99e94[_0x6aee('0x16')];this['salesforceAccounts']=_0xd99e94['salesforceAccounts'];this[_0x6aee('0x17')]=_0xd99e94[_0x6aee('0x17')];this[_0x6aee('0x18')]=_0xd99e94[_0x6aee('0x18')];this[_0x6aee('0x19')]=_0xd99e94[_0x6aee('0x19')];this[_0x6aee('0x1a')]=_0xd99e94[_0x6aee('0x1a')];this['servicenowAccounts']=_0xd99e94[_0x6aee('0x1b')];this[_0x6aee('0x1c')]=_0xd99e94['dynamics365Accounts'];this[_0x6aee('0x1d')]=_0xd99e94[_0x6aee('0x1d')];this['accounts']={'zendesk':this[_0x6aee('0x15')],'salesforce':this[_0x6aee('0x1e')],'freshdesk':this[_0x6aee('0x16')],'sugarcrm':this[_0x6aee('0x17')],'zoho':this[_0x6aee('0x18')],'desk':this[_0x6aee('0x19')],'vtiger':this[_0x6aee('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x6aee('0x1d')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x21'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x22'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on']('custom:agentcomplete',this[_0x6aee('0x1f')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on']('custom:agentnoanswer',this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on']('custom:agentbusy',this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x23'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x24'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x25'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x26'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x27'),this[_0x6aee('0x1f')]['bind'](this));ami['on']('custom:dialbegin',this[_0x6aee('0x28')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x29'),this[_0x6aee('0x28')]['bind'](this));ami['on'](_0x6aee('0x2a'),this['syncAgentDial'][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x2b'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x2c'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x2d'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x2e'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on']('custom:outgoingmessage',this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x2f'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on'](_0x6aee('0x30'),this[_0x6aee('0x1f')][_0x6aee('0x20')](this));ami['on']('custom:offlineMessage',this[_0x6aee('0x1f')][_0x6aee('0x20')](this));}Trigger[_0x6aee('0x31')][_0x6aee('0x32')]=function(_0x2d964e,_0x11d99b,_0x1b3ae9){logger[_0x6aee('0x33')](_0x2d964e,_0x11d99b,JSON[_0x6aee('0x34')](_0x1b3ae9));io['to'](_0x2d964e)[_0x6aee('0x32')](_0x11d99b,_0x1b3ae9);};Trigger[_0x6aee('0x31')]['syncCustomEvent']=function(_0x4d1252){var _0x3478a2=_['clone'](_0x4d1252);if(typeof _0x3478a2['motionChannel']===_0x6aee('0x35')){_0x3478a2[_0x6aee('0x36')]=_0x6aee('0x37');}this['checkTriggers'](_0x3478a2);};Trigger[_0x6aee('0x31')][_0x6aee('0x28')]=function(_0x3928e5){if(this[_0x6aee('0x11')][_0x3928e5['interface']]){this[_0x6aee('0x1f')](_0x3928e5);}};Trigger[_0x6aee('0x31')][_0x6aee('0x38')]=function(_0x2d27b9){var _0x2c3f7c;for(var _0x5b85cc in this[_0x6aee('0x10')]){if(this[_0x6aee('0x10')][_0x6aee('0x39')](_0x5b85cc)){if(this[_0x6aee('0x10')][_0x5b85cc][_0x6aee('0x3a')]){_0x2c3f7c=this['checkTrigger'](this[_0x6aee('0x10')][_0x5b85cc],_0x2d27b9);if(_0x2c3f7c){_['merge'](_0x2d27b9,_0x2d27b9[_0x6aee('0x3b')]);for(var _0x243438=0x0,_0x43ea65,_0x3e44e2,_0x36c6a4;_0x2434380x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x326f,0xd1));var _0xf326=function(_0x2c617e,_0x59fed0){_0x2c617e=_0x2c617e-0x0;var _0x460560=_0x326f[_0x2c617e];return _0x460560;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 7b24f16..cf48d38 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 _0x01a4=['\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','queue','/contacts(','callDirection','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','POST','clientId','username','password','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=','&$filter='];(function(_0x4e6518,_0x455ad0){var _0x18cc30=function(_0x5c9633){while(--_0x5c9633){_0x4e6518['push'](_0x4e6518['shift']());}};_0x18cc30(++_0x455ad0);}(_0x01a4,0xaa));var _0x401a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x01a4[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x401a('0x0'));var rp=require(_0x401a('0x1'));var util=require(_0x401a('0x2'));var intUtil=require(_0x401a('0x3'));var md5=require(_0x401a('0x4'));var Redis=require(_0x401a('0x5'));var logger=require(_0x401a('0x6'))(_0x401a('0x7'));var config=require(_0x401a('0x8'));config[_0x401a('0x9')]=_[_0x401a('0xa')](config[_0x401a('0x9')],{'host':_0x401a('0xb'),'port':0x18eb});var io=require(_0x401a('0xc'))(new Redis(config[_0x401a('0x9')]));function getAuthToken(_0x25f54f,_0x4f0f74,_0x5ecc9a){if(_0x25f54f[_0x401a('0xd')]){_0x25f54f[_0x401a('0xe')]=_0x25f54f[_0x401a('0xf')][_0x401a('0x10')];_0x25f54f[_0x401a('0x11')]=_0x25f54f[_0x401a('0xf')][_0x401a('0x12')];return Promise['resolve'](_0x25f54f[_0x401a('0xf')]['data5']);}var _0x386bf8={'method':_0x401a('0x13'),'uri':_0x4f0f74,'form':{'client_id':_0x25f54f[_0x401a('0x14')],'resource':_0x25f54f[_0x401a('0xe')],'username':_0x25f54f[_0x401a('0x15')],'password':_0x25f54f[_0x401a('0x16')],'grant_type':_0x401a('0x16'),'client_secret':_0x25f54f['clientSecret']},'json':!![]};return rp(_0x386bf8)[_0x401a('0x17')](function(_0x230fe7){return _0x230fe7[_0x401a('0x18')];})[_0x401a('0x19')](function(_0x41f706){logger['error']('['+[_0x5ecc9a[_0x401a('0x1a')]()]+_0x401a('0x1b'));return _0x41f706[_0x401a('0x1c')];});}function getUser(_0x10ca26,_0x577dab,_0x1b5d13,_0x20cbea,_0x3a54bd,_0x17af54){return new Promise(function(_0x3f1c12,_0x2cfd9b){return getAuthToken(_0x577dab,_0x20cbea,_0x17af54)[_0x401a('0x17')](function(_0x14504f){var _0x5090b3={'method':_0x401a('0x1d'),'uri':_0x3a54bd+_0x401a('0x1e'),'headers':{'Authorization':_0x401a('0x1f')+_0x14504f,'OData-Version':_0x401a('0x20')},'json':!![]};return rp(_0x5090b3);})[_0x401a('0x17')](function(_0x119645){var _0x104d8c=_0x119645[_0x401a('0x21')];var _0x4eb687=![];var _0x1af709=null;if(!_[_0x401a('0x22')](_0x1b5d13)){if(intUtil[_0x401a('0x23')](_0x1b5d13['email'])){_0x10ca26[_0x401a('0x24')]=_0x1b5d13[_0x401a('0x25')];for(_0x1af709=0x0;_0x1af709<_0x104d8c['length'];_0x1af709++){if(_0x104d8c[_0x1af709]['internalemailaddress']===_0x1b5d13[_0x401a('0x25')]&&!_0x104d8c[_0x1af709][_0x401a('0x26')]){_0x4eb687=!![];logger[_0x401a('0x27')]('['+[_0x17af54[_0x401a('0x1a')]()]+_0x401a('0x28')+_0x104d8c[_0x1af709][_0x401a('0x29')]+'!');_0x10ca26[_0x401a('0x2a')]=_0x104d8c[_0x1af709]['systemuserid'];}}}}if(!_0x4eb687){logger[_0x401a('0x27')]('['+[_0x17af54[_0x401a('0x1a')]()]+_0x401a('0x2b'));_0x10ca26[_0x401a('0x24')]=_0x577dab[_0x401a('0x15')];for(_0x1af709=0x0;_0x1af709<_0x104d8c[_0x401a('0x2c')];_0x1af709++){if(_0x104d8c[_0x1af709]['internalemailaddress']===_0x577dab[_0x401a('0x15')]){_0x10ca26[_0x401a('0x2a')]=_0x104d8c[_0x1af709]['systemuserid'];}}}_0x3f1c12(_0x10ca26);})[_0x401a('0x19')](function(_0x2b190a){_0x2cfd9b(_0x2b190a[_0x401a('0x1c')]);});});}function createEndUser(_0x275d79,_0x4beb6d,_0x4cda99,_0xb2de9,_0x305637,_0x94d746,_0x29dd47){return new Promise(function(_0x36daa5,_0x317310){return getAuthToken(_0x4beb6d,_0x4cda99,_0x94d746)[_0x401a('0x17')](function(_0x3c2957){var _0x3aedb5=_0x94d746[_0x401a('0x2d')]()===_0x401a('0x2e')?_0x305637[_0x401a('0x2f')]:_0x305637[_0x401a('0x30')];var _0x1e70eb={'method':_0x401a('0x13'),'uri':_0xb2de9+'contacts','body':{'fullname':_0x3aedb5,'firstname':_0x3aedb5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x401a('0x31')+_0x275d79[_0x401a('0x2a')]+')'},'headers':{'Authorization':_0x401a('0x1f')+_0x3c2957,'OData-Version':_0x401a('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x1e70eb[_0x401a('0x32')][_0x29dd47]=_0x3aedb5;return rp(_0x1e70eb);})[_0x401a('0x17')](function(_0x5e2bc0){var _0x982aef=_0x5e2bc0[_0x401a('0x33')][_0x401a('0x34')];var _0x22b7a4=_0x982aef[_0x401a('0x35')](_0x982aef[_0x401a('0x36')]('(')+0x1,_0x982aef[_0x401a('0x36')](')'));_0x275d79[_0x401a('0x37')]=_0x22b7a4;_0x36daa5(_0x275d79);})[_0x401a('0x19')](function(_0xf73bd9){_0x317310(_0xf73bd9[_0x401a('0x1c')]);});});}function getEndUser(_0x2adf11,_0x46d471,_0x15da92,_0x1bd98b,_0x41f637,_0x5eff62,_0x5a6378,_0x3d88bd){var _0x2b70be=_0x5eff62[_0x401a('0x2d')]()==='outbound'?_0x41f637['destcalleridnum']:_0x41f637['calleridnum'];return getAuthToken(_0x46d471,_0x15da92,_0x5eff62)['then'](function(_0x43ba20){_0x3d88bd=_0x3d88bd?_0x3d88bd:'telephone1';var _0x40c3ef={'method':_0x401a('0x1d'),'uri':_0x1bd98b+_0x401a('0x38')+_0x3d88bd+_0x401a('0x39')+_0x3d88bd+_0x401a('0x3a')+_0x2b70be['replace']('+',_0x401a('0x3b'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x43ba20,'If-None-Match':null,'OData-Version':_0x401a('0x20')},'json':!![]};return rp(_0x40c3ef);})[_0x401a('0x17')](function(_0x571009){var _0x1822f9=![];if(!_0x571009)return _0x1822f9;var _0xd459af=_0x571009[_0x401a('0x21')];for(var _0x520d5f=0x0;_0x520d5f<_0xd459af[_0x401a('0x2c')];_0x520d5f++){if(_0xd459af[_0x520d5f][_0x3d88bd]===_0x2b70be){_0x1822f9=!![];_0x2adf11[_0x401a('0x37')]=_0xd459af[_0x520d5f][_0x401a('0x3c')];}}return _0x1822f9;})[_0x401a('0x17')](function(_0x258d86){if(_0x258d86)return _0x2adf11;if(_0x5a6378===_0x401a('0x3d')){logger['info']('['+[_0x5eff62[_0x401a('0x1a')]()]+_0x401a('0x3e'));return _0x2adf11;}return createEndUser(_0x2adf11,_0x46d471,_0x15da92,_0x1bd98b,_0x41f637,_0x5eff62,_0x3d88bd)['then'](function(_0x6900b){logger[_0x401a('0x27')]('['+[_0x5eff62[_0x401a('0x1a')]()]+_0x401a('0x3f'),_0x6900b[_0x401a('0x37')]);return _0x6900b;});});}function getCustomFields(_0x5a081d,_0x114b1e,_0x1d2689){var _0xfb9662={};if(_0x5a081d[_0x401a('0x2c')]>0x0){_[_0x401a('0x40')](_0x5a081d,function(_0x1dcf98){if(_[_0x401a('0x41')]([_0x401a('0x42'),_0x401a('0x43')],_0x1dcf98[_0x401a('0x44')])&&_0x1dcf98[_0x401a('0x45')]&&!_0x1dcf98[_0x401a('0x46')]){var _0x3a5933=_0x1dcf98['idField'][_0x401a('0x2d')]();var _0x70af16=_0x3a5933['substring'](0x0,_0x3a5933[_0x401a('0x47')]('_'));var _0x520282=_0x3a5933[_0x401a('0x35')](_0x3a5933['indexOf']('_')+0x1);if(_0x70af16===_0x1d2689){_0xfb9662[_0x520282]=_0x1dcf98[_0x401a('0x48')];}}});}return _0xfb9662;}function getTicket(_0x948f56,_0x2bdcb9,_0x37f54a,_0x3a8d01,_0x2f8ef8,_0x4fa541,_0x1280a4){return new Promise(function(_0xb94834,_0x2a9271){var _0x35ecfb;return getAuthToken(_0x2bdcb9,_0x37f54a,_0x1280a4)['then'](function(_0x30f9f1){if(_0x4fa541[_0x401a('0x49')]==='incident'){_0x35ecfb={'method':_0x401a('0x13'),'uri':_0x3a8d01+_0x401a('0x4a'),'body':Object[_0x401a('0x4b')]({},{'title':intUtil[_0x401a('0x4c')](_0x4fa541[_0x401a('0x4d')],_0x2f8ef8,'\x20'),'description':intUtil[_0x401a('0x4c')](_0x4fa541[_0x401a('0x4e')],_0x2f8ef8,'\x0a'),'customerid_contact@odata.bind':_0x948f56['enduserId']?'/contacts('+_0x948f56[_0x401a('0x37')]+')':undefined,'ownerid@odata.bind':_0x401a('0x31')+_0x948f56[_0x401a('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x4fa541[_0x401a('0x4f')],_0x2f8ef8,_0x4fa541['ticketType'])),'headers':{'Authorization':_0x401a('0x1f')+_0x30f9f1,'OData-Version':_0x401a('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4fa541['ticketType']===_0x401a('0x50')){var _0x27e389=_0x948f56[_0x401a('0x37')]?[{'partyid_systemuser@odata.bind':_0x401a('0x31')+_0x948f56['userId']+')','participationtypemask':_0x948f56['callDirection']===_0x401a('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0x401a('0x52')+_0x948f56[_0x401a('0x37')]+')','participationtypemask':_0x948f56[_0x401a('0x53')]===_0x401a('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x401a('0x31')+_0x948f56[_0x401a('0x2a')]+')','participationtypemask':_0x948f56[_0x401a('0x53')]==='queue'?0x2:0x1}];_0x35ecfb={'method':_0x401a('0x13'),'uri':_0x3a8d01+_0x401a('0x54'),'body':Object['assign']({},{'subject':intUtil[_0x401a('0x4c')](_0x4fa541[_0x401a('0x4d')],_0x2f8ef8,'\x20'),'phonenumber':String(_0x2f8ef8[_0x401a('0x30')]),'description':intUtil['getString'](_0x4fa541['Descriptions'],_0x2f8ef8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x948f56[_0x401a('0x37')]?'/contacts('+_0x948f56[_0x401a('0x37')]+')':undefined,'ownerid@odata.bind':_0x401a('0x31')+_0x948f56['userId']+')','directioncode':_0x948f56[_0x401a('0x53')]==='queue'?![]:!![],'phonecall_activity_parties':_0x27e389},getCustomFields(_0x4fa541['Fields'],_0x2f8ef8,_0x4fa541[_0x401a('0x49')])),'headers':{'Authorization':_0x401a('0x1f')+_0x30f9f1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x35ecfb);})['then'](function(_0xc6b9cb){var _0x55aef1=_0xc6b9cb[_0x401a('0x33')][_0x401a('0x34')];var _0x186a97=_0x55aef1[_0x401a('0x35')](_0x55aef1[_0x401a('0x36')]('(')+0x1,_0x55aef1[_0x401a('0x36')](')'));_0x948f56[_0x401a('0x55')]=_0x186a97;_0xb94834(_0x948f56);})[_0x401a('0x19')](function(_0x356216){_0x2a9271(_0x356216[_0x401a('0x1c')]);});});}function emit(_0x163169,_0x1d269b,_0x35911c,_0x2e9ece){var _0xfec6ea={'uri':util[_0x401a('0x56')](_0x401a('0x57'),_0x163169,_0x35911c,_0x2e9ece)};io['to'](util['format']('user:%s',_0x1d269b))[_0x401a('0x58')]('trigger:browser:url',_0xfec6ea);}exports['cs']=function(_0x1d390c,_0x2e749e,_0x44e7d4,_0x590c08,_0x912641,_0x3b0eb2,_0x37305b,_0x1f5996){var _0x23777a={};_0x3b0eb2[_0x401a('0xe')]=_0x3b0eb2['modernAuthentication']?intUtil[_0x401a('0x59')](_0x3b0eb2['CloudProvider'][_0x401a('0x10')]):intUtil[_0x401a('0x59')](_0x3b0eb2[_0x401a('0xe')]);_0x3b0eb2[_0x401a('0x5a')]=intUtil[_0x401a('0x59')](_0x3b0eb2['serverUrl']);_0x23777a[_0x401a('0x53')]=_0x1f5996===_0x401a('0x51')||_0x1f5996===_0x401a('0x5b')?_0x401a('0x51'):_0x401a('0x2e');var _0x13b6c3=_0x3b0eb2[_0x401a('0xd')]?util[_0x401a('0x56')]('%s/api/data/v9.0/',_0x3b0eb2[_0x401a('0xf')]['data7']):util['format'](_0x401a('0x5c'),_0x3b0eb2[_0x401a('0xe')]);var _0x4fc331=util[_0x401a('0x56')](_0x401a('0x5d'),_0x3b0eb2['tenantId']);var _0x535a3f=util[_0x401a('0x56')](_0x401a('0x5e'),_0x3b0eb2[_0x401a('0x5a')],_0x2e749e[_0x401a('0x5f')],md5(_0x2e749e[_0x401a('0x5f')]));if(_0x912641&&_0x912641[_0x401a('0x60')]){logger[_0x401a('0x27')](_0x401a('0x61'),'Recording\x20is\x20enabled!');_0x2e749e[_0x401a('0x62')]=_0x535a3f;}else if(_0x37305b&&_0x37305b[_0x401a('0x63')]&&_0x37305b[_0x401a('0x63')]!==_0x401a('0x64')){logger[_0x401a('0x27')](_0x401a('0x65'),_0x401a('0x66'));_0x2e749e[_0x401a('0x62')]=_0x535a3f;}else{_0x2e749e[_0x401a('0x62')]='';}return getUser(_0x23777a,_0x3b0eb2,_0x590c08,_0x4fc331,_0x13b6c3,_0x1f5996)['then'](function(_0x14ead2){logger[_0x401a('0x27')]('['+_0x1f5996[_0x401a('0x1a')]()+_0x401a('0x67'),_0x14ead2[_0x401a('0x2a')]);logger['info']('['+_0x1f5996[_0x401a('0x1a')]()+_0x401a('0x68'),_0x14ead2[_0x401a('0x24')]);return getEndUser(_0x14ead2,_0x3b0eb2,_0x4fc331,_0x13b6c3,_0x2e749e,_0x1f5996,_0x44e7d4[_0x401a('0x69')],_0x44e7d4[_0x401a('0x6a')]);})[_0x401a('0x17')](function(_0x3e8bc8){logger['info']('['+_0x1f5996[_0x401a('0x1a')]()+_0x401a('0x6b'),_0x3e8bc8[_0x401a('0x37')]);logger[_0x401a('0x27')]('['+_0x1f5996[_0x401a('0x1a')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2e749e[_0x401a('0x30')]);return getTicket(_0x3e8bc8,_0x3b0eb2,_0x4fc331,_0x13b6c3,_0x2e749e,_0x44e7d4,_0x1f5996);})[_0x401a('0x17')](function(_0x1f06af){logger[_0x401a('0x27')](util[_0x401a('0x56')]('['+_0x1f5996['toUpperCase']()+_0x401a('0x6c'),_0x44e7d4[_0x401a('0x49')],_0x1f06af['ticketId']));logger['info'](util['format']('['+_0x1f5996[_0x401a('0x1a')]()+_0x401a('0x6d'),_0x1f5996));if(_0x1f5996!==_0x401a('0x5b')&&_0x44e7d4[_0x401a('0x6e')]){logger[_0x401a('0x27')]('['+_0x1f5996['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3b0eb2[_0x401a('0xe')],_0x590c08[_0x401a('0x6f')],_0x44e7d4[_0x401a('0x49')],_0x1f06af['ticketId']);}})[_0x401a('0x19')](function(_0x537e37){logger[_0x401a('0x70')]('['+_0x1f5996[_0x401a('0x1a')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x537e37[_0x401a('0x1c')]);console['error'](_0x401a('0x71'),_0x537e37);});}; \ No newline at end of file +var _0xa550=['catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','validateEmail','email','length','internalemailaddress','info','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','\x20eq\x20\x27','contactid','nothing','forEach','includes','picklist','type','nameField','customField','idField','content','ticketType','assign','getString','Descriptions','Fields','callDirection','queue','Subjects','/contacts(','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','CloudProvider','data7','data2','resolve','data5','POST','username','password','clientSecret','then'];(function(_0xa13807,_0x58a9ae){var _0x425ff6=function(_0x2880d8){while(--_0x2880d8){_0xa13807['push'](_0xa13807['shift']());}};_0x425ff6(++_0x58a9ae);}(_0xa550,0x15b));var _0x0a55=function(_0x10778c,_0x461571){_0x10778c=_0x10778c-0x0;var _0x38d5f2=_0xa550[_0x10778c];return _0x38d5f2;};'use strict';var _=require(_0x0a55('0x0'));var rp=require(_0x0a55('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0x0a55('0x2'));var Redis=require(_0x0a55('0x3'));var logger=require(_0x0a55('0x4'))(_0x0a55('0x5'));var config=require(_0x0a55('0x6'));config[_0x0a55('0x7')]=_[_0x0a55('0x8')](config[_0x0a55('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0a55('0x9'))(new Redis(config[_0x0a55('0x7')]));function getAuthToken(_0x32dd81,_0x2edccf,_0x5bcf01){if(_0x32dd81[_0x0a55('0xa')]){_0x32dd81['remoteUri']=_0x32dd81[_0x0a55('0xb')][_0x0a55('0xc')];_0x32dd81['tenantId']=_0x32dd81[_0x0a55('0xb')][_0x0a55('0xd')];return Promise[_0x0a55('0xe')](_0x32dd81[_0x0a55('0xb')][_0x0a55('0xf')]);}var _0x56dae9={'method':_0x0a55('0x10'),'uri':_0x2edccf,'form':{'client_id':_0x32dd81['clientId'],'resource':_0x32dd81['remoteUri'],'username':_0x32dd81[_0x0a55('0x11')],'password':_0x32dd81[_0x0a55('0x12')],'grant_type':_0x0a55('0x12'),'client_secret':_0x32dd81[_0x0a55('0x13')]},'json':!![]};return rp(_0x56dae9)[_0x0a55('0x14')](function(_0xf9f438){return _0xf9f438['access_token'];})[_0x0a55('0x15')](function(_0x51454e){logger[_0x0a55('0x16')]('['+[_0x5bcf01[_0x0a55('0x17')]()]+_0x0a55('0x18'));return _0x51454e[_0x0a55('0x19')];});}function getUser(_0x3f49be,_0x31fd85,_0x54de32,_0x3c2e86,_0x4af76a,_0x441c59){return new Promise(function(_0x2148a6,_0x4d8af5){return getAuthToken(_0x31fd85,_0x3c2e86,_0x441c59)[_0x0a55('0x14')](function(_0x344b45){var _0x269811={'method':_0x0a55('0x1a'),'uri':_0x4af76a+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x344b45,'OData-Version':_0x0a55('0x1b')},'json':!![]};return rp(_0x269811);})[_0x0a55('0x14')](function(_0x331984){var _0x1629a8=_0x331984['value'];var _0xbdcf5e=![];var _0x3ce603=null;if(!_['isNil'](_0x54de32)){if(intUtil[_0x0a55('0x1c')](_0x54de32[_0x0a55('0x1d')])){_0x3f49be['userEmail']=_0x54de32['email'];for(_0x3ce603=0x0;_0x3ce603<_0x1629a8[_0x0a55('0x1e')];_0x3ce603++){if(_0x1629a8[_0x3ce603][_0x0a55('0x1f')]===_0x54de32[_0x0a55('0x1d')]&&!_0x1629a8[_0x3ce603]['isdisabled']){_0xbdcf5e=!![];logger[_0x0a55('0x20')]('['+[_0x441c59[_0x0a55('0x17')]()]+']\x20Agent\x20found\x20'+_0x1629a8[_0x3ce603]['systemuserid']+'!');_0x3f49be[_0x0a55('0x21')]=_0x1629a8[_0x3ce603]['systemuserid'];}}}}if(!_0xbdcf5e){logger[_0x0a55('0x20')]('['+[_0x441c59['toUpperCase']()]+_0x0a55('0x22'));_0x3f49be[_0x0a55('0x23')]=_0x31fd85[_0x0a55('0x11')];for(_0x3ce603=0x0;_0x3ce603<_0x1629a8[_0x0a55('0x1e')];_0x3ce603++){if(_0x1629a8[_0x3ce603][_0x0a55('0x1f')]===_0x31fd85[_0x0a55('0x11')]){_0x3f49be[_0x0a55('0x21')]=_0x1629a8[_0x3ce603][_0x0a55('0x24')];}}}_0x2148a6(_0x3f49be);})['catch'](function(_0x35cc67){_0x4d8af5(_0x35cc67[_0x0a55('0x19')]);});});}function createEndUser(_0xfea5e,_0x187516,_0x420fd1,_0xba270c,_0x1be27e,_0x5798ba,_0x459fd1){return new Promise(function(_0x3769c5,_0x52032e){return getAuthToken(_0x187516,_0x420fd1,_0x5798ba)['then'](function(_0x72a545){var _0x475b3a=_0x5798ba[_0x0a55('0x25')]()===_0x0a55('0x26')?_0x1be27e[_0x0a55('0x27')]:_0x1be27e[_0x0a55('0x28')];var _0x5ec4dc={'method':_0x0a55('0x10'),'uri':_0xba270c+_0x0a55('0x29'),'body':{'fullname':_0x475b3a,'firstname':_0x475b3a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0a55('0x2a')+_0xfea5e['userId']+')'},'headers':{'Authorization':_0x0a55('0x2b')+_0x72a545,'OData-Version':_0x0a55('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x5ec4dc['body'][_0x459fd1]=_0x475b3a;return rp(_0x5ec4dc);})[_0x0a55('0x14')](function(_0x4585d6){var _0x1f4279=_0x4585d6[_0x0a55('0x2c')][_0x0a55('0x2d')];var _0x4c15cc=_0x1f4279[_0x0a55('0x2e')](_0x1f4279[_0x0a55('0x2f')]('(')+0x1,_0x1f4279[_0x0a55('0x2f')](')'));_0xfea5e[_0x0a55('0x30')]=_0x4c15cc;_0x3769c5(_0xfea5e);})['catch'](function(_0x3ed6e3){_0x52032e(_0x3ed6e3['message']);});});}function getEndUser(_0x1d2460,_0x3105c4,_0x264f64,_0x38b9ed,_0xe5b8c1,_0x479441,_0x260b87,_0x10f8a1){var _0x3e8290=_0x479441[_0x0a55('0x25')]()===_0x0a55('0x26')?_0xe5b8c1[_0x0a55('0x27')]:_0xe5b8c1['calleridnum'];return getAuthToken(_0x3105c4,_0x264f64,_0x479441)[_0x0a55('0x14')](function(_0x3a5871){_0x10f8a1=_0x10f8a1?_0x10f8a1:'telephone1';var _0x4213a2={'method':_0x0a55('0x1a'),'uri':_0x38b9ed+'contacts?$select='+_0x10f8a1+'&$filter='+_0x10f8a1+_0x0a55('0x31')+_0x3e8290['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x0a55('0x2b')+_0x3a5871,'If-None-Match':null,'OData-Version':_0x0a55('0x1b')},'json':!![]};return rp(_0x4213a2);})[_0x0a55('0x14')](function(_0x16e141){var _0x101989=![];if(!_0x16e141)return _0x101989;var _0x2542cb=_0x16e141['value'];for(var _0x15e138=0x0;_0x15e138<_0x2542cb[_0x0a55('0x1e')];_0x15e138++){if(_0x2542cb[_0x15e138][_0x10f8a1]===_0x3e8290){_0x101989=!![];_0x1d2460[_0x0a55('0x30')]=_0x2542cb[_0x15e138][_0x0a55('0x32')];}}return _0x101989;})['then'](function(_0xc0f61c){if(_0xc0f61c)return _0x1d2460;if(_0x260b87===_0x0a55('0x33')){logger['info']('['+[_0x479441[_0x0a55('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1d2460;}return createEndUser(_0x1d2460,_0x3105c4,_0x264f64,_0x38b9ed,_0xe5b8c1,_0x479441,_0x10f8a1)[_0x0a55('0x14')](function(_0x3caa01){logger[_0x0a55('0x20')]('['+[_0x479441[_0x0a55('0x17')]()]+']\x20Enduser\x20created!',_0x3caa01[_0x0a55('0x30')]);return _0x3caa01;});});}function getCustomFields(_0x7425e4,_0x5861be,_0x2ebc63){var _0xc6a17c={};if(_0x7425e4['length']>0x0){_[_0x0a55('0x34')](_0x7425e4,function(_0x5f5919){if(_[_0x0a55('0x35')](['string',_0x0a55('0x36')],_0x5f5919[_0x0a55('0x37')])&&_0x5f5919[_0x0a55('0x38')]&&!_0x5f5919[_0x0a55('0x39')]){var _0x346b55=_0x5f5919[_0x0a55('0x3a')][_0x0a55('0x25')]();var _0x2d9cba=_0x346b55[_0x0a55('0x2e')](0x0,_0x346b55['indexOf']('_'));var _0x5d7a51=_0x346b55[_0x0a55('0x2e')](_0x346b55['indexOf']('_')+0x1);if(_0x2d9cba===_0x2ebc63){_0xc6a17c[_0x5d7a51]=_0x5f5919[_0x0a55('0x3b')];}}});}return _0xc6a17c;}function getTicket(_0x5127cd,_0x11c62c,_0x51fd93,_0x1d43e6,_0x3561dd,_0x15f6a1,_0x5d9912){return new Promise(function(_0x59b9d9,_0x453890){var _0x5e0e1b;return getAuthToken(_0x11c62c,_0x51fd93,_0x5d9912)[_0x0a55('0x14')](function(_0xd85750){if(_0x15f6a1[_0x0a55('0x3c')]==='incident'){_0x5e0e1b={'method':_0x0a55('0x10'),'uri':_0x1d43e6+'incidents','body':Object[_0x0a55('0x3d')]({},{'title':intUtil['getString'](_0x15f6a1['Subjects'],_0x3561dd,'\x20'),'description':intUtil[_0x0a55('0x3e')](_0x15f6a1[_0x0a55('0x3f')],_0x3561dd,'\x0a'),'customerid_contact@odata.bind':_0x5127cd[_0x0a55('0x30')]?'/contacts('+_0x5127cd['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x5127cd[_0x0a55('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x15f6a1[_0x0a55('0x40')],_0x3561dd,_0x15f6a1[_0x0a55('0x3c')])),'headers':{'Authorization':_0x0a55('0x2b')+_0xd85750,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x15f6a1[_0x0a55('0x3c')]==='phonecall'){var _0x28133d=_0x5127cd[_0x0a55('0x30')]?[{'partyid_systemuser@odata.bind':_0x0a55('0x2a')+_0x5127cd['userId']+')','participationtypemask':_0x5127cd[_0x0a55('0x41')]===_0x0a55('0x42')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5127cd[_0x0a55('0x30')]+')','participationtypemask':_0x5127cd[_0x0a55('0x41')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0a55('0x2a')+_0x5127cd[_0x0a55('0x21')]+')','participationtypemask':_0x5127cd[_0x0a55('0x41')]===_0x0a55('0x42')?0x2:0x1}];_0x5e0e1b={'method':'POST','uri':_0x1d43e6+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0x15f6a1[_0x0a55('0x43')],_0x3561dd,'\x20'),'phonenumber':String(_0x3561dd[_0x0a55('0x28')]),'description':intUtil[_0x0a55('0x3e')](_0x15f6a1[_0x0a55('0x3f')],_0x3561dd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5127cd[_0x0a55('0x30')]?_0x0a55('0x44')+_0x5127cd[_0x0a55('0x30')]+')':undefined,'ownerid@odata.bind':_0x0a55('0x2a')+_0x5127cd[_0x0a55('0x21')]+')','directioncode':_0x5127cd[_0x0a55('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':_0x28133d},getCustomFields(_0x15f6a1['Fields'],_0x3561dd,_0x15f6a1[_0x0a55('0x3c')])),'headers':{'Authorization':_0x0a55('0x2b')+_0xd85750,'OData-Version':_0x0a55('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e0e1b);})[_0x0a55('0x14')](function(_0x3c4628){var _0x3229c4=_0x3c4628[_0x0a55('0x2c')][_0x0a55('0x2d')];var _0x4c4b23=_0x3229c4[_0x0a55('0x2e')](_0x3229c4[_0x0a55('0x2f')]('(')+0x1,_0x3229c4[_0x0a55('0x2f')](')'));_0x5127cd[_0x0a55('0x45')]=_0x4c4b23;_0x59b9d9(_0x5127cd);})['catch'](function(_0x551c2b){_0x453890(_0x551c2b[_0x0a55('0x19')]);});});}function emit(_0x49c875,_0x2fac5e,_0x3dd41e,_0x22e667){var _0x29625d={'uri':util[_0x0a55('0x46')](_0x0a55('0x47'),_0x49c875,_0x3dd41e,_0x22e667)};io['to'](util[_0x0a55('0x46')](_0x0a55('0x48'),_0x2fac5e))['emit'](_0x0a55('0x49'),_0x29625d);}exports['cs']=function(_0x55fc78,_0x313da0,_0x41d06,_0x51813a,_0x259ecc,_0x28e642,_0x466db7,_0x3f2e81){var _0x1c2c98={};_0x28e642['remoteUri']=_0x28e642[_0x0a55('0xa')]?intUtil[_0x0a55('0x4a')](_0x28e642[_0x0a55('0xb')][_0x0a55('0xc')]):intUtil[_0x0a55('0x4a')](_0x28e642[_0x0a55('0x4b')]);_0x28e642['serverUrl']=intUtil[_0x0a55('0x4a')](_0x28e642[_0x0a55('0x4c')]);_0x1c2c98[_0x0a55('0x41')]=_0x3f2e81===_0x0a55('0x42')||_0x3f2e81===_0x0a55('0x4d')?_0x0a55('0x42'):_0x0a55('0x26');var _0x4b43c4=_0x28e642[_0x0a55('0xa')]?util[_0x0a55('0x46')]('%s/api/data/v9.0/',_0x28e642[_0x0a55('0xb')][_0x0a55('0xc')]):util[_0x0a55('0x46')]('%s/api/data/v9.0/',_0x28e642['remoteUri']);var _0x501aa3=util[_0x0a55('0x46')]('https://login.microsoftonline.com/%s/oauth2/token',_0x28e642['tenantId']);var _0x488043=util[_0x0a55('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x28e642[_0x0a55('0x4c')],_0x313da0[_0x0a55('0x4e')],md5(_0x313da0[_0x0a55('0x4e')]));if(_0x259ecc&&_0x259ecc['monitor_format']){logger['info'](_0x0a55('0x4f'),_0x0a55('0x50'));_0x313da0[_0x0a55('0x51')]=_0x488043;}else if(_0x466db7&&_0x466db7[_0x0a55('0x52')]&&_0x466db7[_0x0a55('0x52')]!==_0x0a55('0x53')){logger[_0x0a55('0x20')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x313da0[_0x0a55('0x51')]=_0x488043;}else{_0x313da0[_0x0a55('0x51')]='';}return getUser(_0x1c2c98,_0x28e642,_0x51813a,_0x501aa3,_0x4b43c4,_0x3f2e81)[_0x0a55('0x14')](function(_0x20f0b4){logger[_0x0a55('0x20')]('['+_0x3f2e81[_0x0a55('0x17')]()+_0x0a55('0x54'),_0x20f0b4['userId']);logger[_0x0a55('0x20')]('['+_0x3f2e81[_0x0a55('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x20f0b4[_0x0a55('0x23')]);return getEndUser(_0x20f0b4,_0x28e642,_0x501aa3,_0x4b43c4,_0x313da0,_0x3f2e81,_0x41d06[_0x0a55('0x55')],_0x41d06[_0x0a55('0x56')]);})[_0x0a55('0x14')](function(_0x2e5e43){logger[_0x0a55('0x20')]('['+_0x3f2e81['toUpperCase']()+_0x0a55('0x57'),_0x2e5e43[_0x0a55('0x30')]);logger[_0x0a55('0x20')]('['+_0x3f2e81[_0x0a55('0x17')]()+_0x0a55('0x58'),_0x313da0[_0x0a55('0x28')]);return getTicket(_0x2e5e43,_0x28e642,_0x501aa3,_0x4b43c4,_0x313da0,_0x41d06,_0x3f2e81);})[_0x0a55('0x14')](function(_0x3b9820){logger[_0x0a55('0x20')](util[_0x0a55('0x46')]('['+_0x3f2e81[_0x0a55('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x41d06[_0x0a55('0x3c')],_0x3b9820[_0x0a55('0x45')]));logger[_0x0a55('0x20')](util[_0x0a55('0x46')]('['+_0x3f2e81[_0x0a55('0x17')]()+']\x20Call\x20direction:\x20%s',_0x3f2e81));if(_0x3f2e81!==_0x0a55('0x4d')&&_0x41d06['openNewTab']){logger['info']('['+_0x3f2e81[_0x0a55('0x17')]()+']',_0x0a55('0x59'));emit(_0x28e642[_0x0a55('0x4b')],_0x51813a[_0x0a55('0x5a')],_0x41d06['ticketType'],_0x3b9820[_0x0a55('0x45')]);}})['catch'](function(_0xc02541){logger['error']('['+_0x3f2e81[_0x0a55('0x17')]()+_0x0a55('0x5b'),_0xc02541[_0x0a55('0x19')]);console[_0x0a55('0x16')]('Error\x20running\x20Dynamics365\x20integration',_0xc02541);});}; \ 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 963ec61..655a868 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 _0x4c2b=['%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','includes','picklist','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','Ticket\x20created!','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','unmanaged','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','then','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone'];(function(_0x3fb033,_0x313a99){var _0x58ba6c=function(_0x36d866){while(--_0x36d866){_0x3fb033['push'](_0x3fb033['shift']());}};_0x58ba6c(++_0x313a99);}(_0x4c2b,0x19e));var _0xb4c2=function(_0x1d4249,_0x2a6956){_0x1d4249=_0x1d4249-0x0;var _0x27b8d6=_0x4c2b[_0x1d4249];return _0x27b8d6;};'use strict';var _=require(_0xb4c2('0x0'));var rp=require(_0xb4c2('0x1'));var md5=require(_0xb4c2('0x2'));var util=require(_0xb4c2('0x3'));var Redis=require(_0xb4c2('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb4c2('0x5'))('freshdesk');config[_0xb4c2('0x6')]=_[_0xb4c2('0x7')](config[_0xb4c2('0x6')],{'host':_0xb4c2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb4c2('0x6')]));var headers={'Content-Type':_0xb4c2('0x9'),'Accept':_0xb4c2('0x9')};function emit(_0x252c7d,_0x228447,_0x5da5b6){io['to'](_0x252c7d)[_0xb4c2('0xa')](_0x228447,_0x5da5b6);}function getTicket(_0x570e0b,_0xd66ba2,_0x5c75d8,_0x4551d1,_0x364868){logger[_0xb4c2('0xb')](_0xb4c2('0xc'));var _0x1b823a=_[_0xb4c2('0xd')]({'responder_id':_0xd66ba2['id'],'requester_id':_0x5c75d8['id'],'name':util['format'](_0xb4c2('0xe'),_0x364868[_0xb4c2('0xf')]),'phone':_0x364868[_0xb4c2('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb4c2('0x11')](_0x4551d1[_0xb4c2('0x12')],_0x364868,'\x20'),'description':intUtil[_0xb4c2('0x11')](_0x4551d1[_0xb4c2('0x13')],_0x364868,'
'),'tags':getTags(_0x4551d1[_0xb4c2('0x14')],_0xb4c2('0x15'))},getCustomFields(_0x4551d1[_0xb4c2('0x16')],_0x364868));_0x1b823a['custom_fields']=_[_0xb4c2('0x17')](_[_0xb4c2('0x18')](_0x1b823a[_0xb4c2('0x19')],'id'),_0xb4c2('0x1a'));return request({'uri':util[_0xb4c2('0x1b')](_0xb4c2('0x1c'),_0x570e0b[_0xb4c2('0x1d')]),'method':_0xb4c2('0x1e'),'body':_0x1b823a})[_0xb4c2('0x1f')](function(_0x27c55b){logger[_0xb4c2('0xb')]('Ticket\x20created!');return _0x27c55b;});}function getUser(_0x3329d9,_0x8c5f4){if(intUtil['validateEmail'](_0x8c5f4)){return request({'uri':util[_0xb4c2('0x1b')](_0xb4c2('0x20'),_0x3329d9['remoteUri']),'qs':{'email':_0x8c5f4}})[_0xb4c2('0x1f')](function(_0x445ab1){if(_0x445ab1[_0xb4c2('0x21')]){logger[_0xb4c2('0xb')](_0xb4c2('0x22'));return _[_0xb4c2('0x23')](_0x445ab1,function(_0x2a4e25){return _0x2a4e25[_0xb4c2('0x24')]['email']===_0x8c5f4;});}else{logger[_0xb4c2('0xb')](_0xb4c2('0x25'));return request({'uri':util[_0xb4c2('0x1b')]('%s/api/v2/agents/me',_0x3329d9['remoteUri'])})[_0xb4c2('0x1f')](function(_0x12be3b){logger['info'](_0xb4c2('0x26'));return _0x12be3b;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb4c2('0x1b')](_0xb4c2('0x27'),_0x3329d9['remoteUri'])})[_0xb4c2('0x1f')](function(_0xbee3ed){logger[_0xb4c2('0xb')](_0xb4c2('0x26'));return _0xbee3ed;});}}function getEndUser(_0x1f5220,_0x25c558,_0x17a940){logger[_0xb4c2('0xb')](_0xb4c2('0x28'),_0x17a940);return request({'uri':util[_0xb4c2('0x1b')](_0xb4c2('0x29'),_0x1f5220[_0xb4c2('0x1d')]),'qs':{'phone':_0x17a940}})[_0xb4c2('0x1f')](function(_0x2f7651){if(_0x2f7651[_0xb4c2('0x21')]){logger[_0xb4c2('0xb')](_0xb4c2('0x2a'));return _[_0xb4c2('0x23')](_0x2f7651,{'phone':_0x17a940});}else{logger[_0xb4c2('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb4c2('0x1b')]('%s/api/v2/contacts',_0x1f5220[_0xb4c2('0x1d')]),'method':_0xb4c2('0x1e'),'body':{'name':_0x25c558,'phone':_0x17a940}})[_0xb4c2('0x1f')](function(_0x161885){logger[_0xb4c2('0xb')](_0xb4c2('0x2b'));return _0x161885;});}});}function getAuth(_0x30839d){return util[_0xb4c2('0x1b')](_0xb4c2('0x2c'),new Buffer(_0x30839d['apiKey']+':X')[_0xb4c2('0x2d')](_0xb4c2('0x2e')));}function request(_0x1977ee){logger[_0xb4c2('0x2f')](_0xb4c2('0x30'),JSON[_0xb4c2('0x31')](_0x1977ee));return rp(_[_0xb4c2('0x7')](_0x1977ee,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2f8b2a,_0x3b789c){var _0x18cfff=[];if(_0x2f8b2a&&_0x2f8b2a[_0xb4c2('0x21')]>0x0){_0x18cfff=_[_0xb4c2('0x32')](_0x2f8b2a,_0x3b789c);}return _0x18cfff;}function getCustomFields(_0x42233b,_0x2c1956){var _0x121a8c=[];var _0xdfd287={'custom_fields':[]};if(_0x42233b[_0xb4c2('0x21')]>0x0){_['forEach'](_0x42233b,function(_0x185729){if(_[_0xb4c2('0x33')](['string',_0xb4c2('0x34')],_0x185729['type'])&&_0x185729[_0xb4c2('0x35')]&&!_0x185729[_0xb4c2('0x36')]){_0xdfd287[_0x185729[_0xb4c2('0x35')][_0xb4c2('0x37')]()]=_0x185729[_0xb4c2('0x38')]['toString']();}else if(_[_0xb4c2('0x33')](['string',_0xb4c2('0x34')],_0x185729[_0xb4c2('0x39')])&&_0x185729[_0xb4c2('0x3a')]&&_0x185729[_0xb4c2('0x36')]){_0xdfd287[_0xb4c2('0x19')][_0xb4c2('0x3b')]({'id':_0x185729['idField'],'value':_0x185729[_0xb4c2('0x38')][_0xb4c2('0x2d')]()});}else if(_0x185729[_0xb4c2('0x39')]===_0xb4c2('0x3c')&&_0x185729[_0xb4c2('0x3d')]&&_0x185729[_0xb4c2('0x3a')]&&_0x185729[_0xb4c2('0x36')]){_0x2c1956[_0x185729[_0xb4c2('0x3d')]]&&_0xdfd287[_0xb4c2('0x19')][_0xb4c2('0x3b')]({'id':_0x185729[_0xb4c2('0x3a')],'value':_0x2c1956[_0x185729[_0xb4c2('0x3d')]][_0xb4c2('0x2d')]()});}else if(_0x185729[_0xb4c2('0x39')]===_0xb4c2('0x3e')&&_0x185729[_0xb4c2('0x3f')]&&_0x185729[_0xb4c2('0x3f')][_0xb4c2('0x15')]&&_0x185729['idField']&&_0x185729[_0xb4c2('0x36')]){_0x2c1956[_0x185729['Variable'][_0xb4c2('0x15')]['toLowerCase']()]&&_0xdfd287[_0xb4c2('0x19')][_0xb4c2('0x3b')]({'id':_0x185729['idField'],'value':_0x2c1956[_0x185729[_0xb4c2('0x3f')]['name'][_0xb4c2('0x37')]()][_0xb4c2('0x2d')]()});}});}return _0xdfd287;}exports[_0xb4c2('0x40')]=function(_0x50f762,_0x1ec8f3,_0x38f781,_0x2cce5e,_0x500d6e,_0x191a5d){var _0x1bf12a,_0x22ce10;_0x191a5d[_0xb4c2('0x1d')]=intUtil['stripTrailingSlash'](_0x191a5d[_0xb4c2('0x1d')]);_0x191a5d[_0xb4c2('0x41')]=intUtil[_0xb4c2('0x42')](_0x191a5d[_0xb4c2('0x41')]);if(_0x500d6e&&_0x500d6e['monitor_format']){logger[_0xb4c2('0xb')](_0xb4c2('0x43'),_0xb4c2('0x44'));_0x1ec8f3[_0xb4c2('0x45')]=util[_0xb4c2('0x1b')](_0xb4c2('0x46'),_0x191a5d[_0xb4c2('0x41')],_0x1ec8f3[_0xb4c2('0x47')],md5(_0x1ec8f3['uniqueid']));}else{_0x1ec8f3[_0xb4c2('0x45')]='';}headers[_0xb4c2('0x48')]=getAuth(_0x191a5d);return getUser(_0x191a5d,_0x2cce5e[_0xb4c2('0x49')])['then'](function(_0x312381){_0x1bf12a=_0x312381;logger[_0xb4c2('0xb')]('The\x20User\x20ID\x20is:',_0x1bf12a['id']);return getEndUser(_0x191a5d,_0x1ec8f3[_0xb4c2('0xf')],_0x1ec8f3[_0xb4c2('0x10')]);})[_0xb4c2('0x1f')](function(_0x1a801b){_0x22ce10=_0x1a801b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x22ce10['id']);return getTicket(_0x191a5d,_0x1bf12a,_0x22ce10,_0x38f781,_0x1ec8f3);})[_0xb4c2('0x1f')](function(_0x533e2d){if(_0x533e2d&&_0x533e2d['id']){logger[_0xb4c2('0xb')](_0xb4c2('0x4a'));logger[_0xb4c2('0xb')]('The\x20Ticket\x20ID\x20is:',_0x533e2d['id']);logger[_0xb4c2('0xb')](_0xb4c2('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb4c2('0x1b')](_0xb4c2('0x4b'),_0x2cce5e[_0xb4c2('0x15')]),_0xb4c2('0x4c'),{'uri':util[_0xb4c2('0x1b')](_0xb4c2('0x4d'),_0x191a5d[_0xb4c2('0x1d')],_0x533e2d['id'])});}})['catch'](function(_0x4dd6a7){logger['error'](_0xb4c2('0x43'),JSON[_0xb4c2('0x31')](_0x4dd6a7));});};exports[_0xb4c2('0x4e')]=function(_0x2b1793,_0x178c76,_0x32e0f1,_0x2f1024,_0x4de729,_0x49a7ab,_0x576c3b){var _0x14df7d,_0x23ca25;_0x49a7ab[_0xb4c2('0x1d')]=intUtil[_0xb4c2('0x42')](_0x49a7ab[_0xb4c2('0x1d')]);_0x49a7ab[_0xb4c2('0x41')]=intUtil[_0xb4c2('0x42')](_0x49a7ab[_0xb4c2('0x41')]);if(_0x576c3b&&_0x576c3b['recordingFormat']&&_0x576c3b[_0xb4c2('0x4f')]!==_0xb4c2('0x50')){logger[_0xb4c2('0xb')](_0xb4c2('0x51'),_0xb4c2('0x44'));_0x178c76[_0xb4c2('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49a7ab[_0xb4c2('0x41')],_0x178c76['uniqueid'],md5(_0x178c76[_0xb4c2('0x47')]));}headers[_0xb4c2('0x48')]=getAuth(_0x49a7ab);return getUser(_0x49a7ab,_0x2f1024[_0xb4c2('0x49')])[_0xb4c2('0x1f')](function(_0x1cbdad){_0x14df7d=_0x1cbdad;logger[_0xb4c2('0xb')](_0xb4c2('0x52'),_0x14df7d['id']);return getEndUser(_0x49a7ab,_0x178c76['destcalleridname'],_0x178c76[_0xb4c2('0x53')]);})[_0xb4c2('0x1f')](function(_0x26710e){_0x23ca25=_0x26710e;logger['info'](_0xb4c2('0x54'),_0x23ca25['id']);return getTicket(_0x49a7ab,_0x14df7d,_0x23ca25,_0x32e0f1,_0x178c76);})['then'](function(_0x1a0e06){if(_0x1a0e06&&_0x1a0e06['id']){logger[_0xb4c2('0xb')](_0xb4c2('0x4a'));logger[_0xb4c2('0xb')](_0xb4c2('0x55'),_0x1a0e06['id']);logger[_0xb4c2('0xb')](_0xb4c2('0x51'),_0xb4c2('0x56'));emit(util[_0xb4c2('0x1b')](_0xb4c2('0x4b'),_0x2f1024['name']),_0xb4c2('0x4c'),{'uri':util[_0xb4c2('0x1b')](_0xb4c2('0x4d'),_0x49a7ab[_0xb4c2('0x1d')],_0x1a0e06['id'])});}})[_0xb4c2('0x57')](function(_0x324f7e){logger[_0xb4c2('0x58')](_0xb4c2('0x51'),JSON['stringify'](_0x324f7e));});};exports[_0xb4c2('0x59')]=function(_0x302fe5,_0x3117e7,_0xeeeb7e,_0x30cd9a,_0x1c8c47,_0x42655d){var _0x4d687b,_0x435411;_0x42655d[_0xb4c2('0x1d')]=intUtil[_0xb4c2('0x42')](_0x42655d['remoteUri']);_0x42655d[_0xb4c2('0x41')]=intUtil[_0xb4c2('0x42')](_0x42655d[_0xb4c2('0x41')]);if(_0x1c8c47&&_0x1c8c47['monitor_format']){logger[_0xb4c2('0xb')]('['+_0x3117e7['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3117e7[_0xb4c2('0x45')]=util[_0xb4c2('0x1b')](_0xb4c2('0x46'),_0x42655d[_0xb4c2('0x41')],_0x3117e7[_0xb4c2('0x47')],md5(_0x3117e7['uniqueid']));}else{_0x3117e7[_0xb4c2('0x45')]='';}headers[_0xb4c2('0x48')]=getAuth(_0x42655d);return getUser(_0x42655d,'')[_0xb4c2('0x1f')](function(_0x2416d2){_0x4d687b=_0x2416d2;logger['info'](_0xb4c2('0x52'),_0x4d687b['id']);return getEndUser(_0x42655d,_0x3117e7['calleridname'],_0x3117e7[_0xb4c2('0x10')]);})['then'](function(_0x5b8c54){_0x435411=_0x5b8c54;logger[_0xb4c2('0xb')](_0xb4c2('0x54'),_0x435411['id']);return getTicket(_0x42655d,_0x4d687b,_0x435411,_0xeeeb7e,_0x3117e7);})[_0xb4c2('0x1f')](function(_0x194c6f){if(_0x194c6f){logger['info']('Ticket\x20created!');logger['info'](_0xb4c2('0x55'),_0x194c6f['id']);}})[_0xb4c2('0x57')](function(_0x3e9364){logger[_0xb4c2('0x58')]('['+_0x3117e7['lastevent'][_0xb4c2('0x5a')]()+']',JSON[_0xb4c2('0x31')](_0x3e9364));});}; \ No newline at end of file +var _0x278b=['lastevent','lodash','md5','util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','mapValues','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','defaults','GET','map','includes','picklist','type','nameField','content','string','idField','push','variable','customVariable','Variable','name','customField','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x278b,0x16d));var _0xb278=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x278b[_0x11e05d];return _0x335588;};'use strict';var _=require(_0xb278('0x0'));var rp=require('request-promise');var md5=require(_0xb278('0x1'));var util=require(_0xb278('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xb278('0x3'));var logger=require('../../../../config/logger')(_0xb278('0x4'));config[_0xb278('0x5')]=_['defaults'](config[_0xb278('0x5')],{'host':_0xb278('0x6'),'port':0x18eb});var io=require(_0xb278('0x7'))(new Redis(config[_0xb278('0x5')]));var headers={'Content-Type':_0xb278('0x8'),'Accept':'application/json'};function emit(_0x5e9c87,_0x3879da,_0x1dd1f3){io['to'](_0x5e9c87)[_0xb278('0x9')](_0x3879da,_0x1dd1f3);}function getTicket(_0x79ae3c,_0x802668,_0x14b1d4,_0xd80ca9,_0x161e20){logger['info']('Creating\x20new\x20ticket...');var _0x514d6c=_['merge']({'responder_id':_0x802668['id'],'requester_id':_0x14b1d4['id'],'name':util[_0xb278('0xa')](_0xb278('0xb'),_0x161e20[_0xb278('0xc')]),'phone':_0x161e20['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb278('0xd')](_0xd80ca9[_0xb278('0xe')],_0x161e20,'\x20'),'description':intUtil[_0xb278('0xd')](_0xd80ca9[_0xb278('0xf')],_0x161e20,_0xb278('0x10')),'tags':getTags(_0xd80ca9[_0xb278('0x11')],'name')},getCustomFields(_0xd80ca9['Fields'],_0x161e20));_0x514d6c['custom_fields']=_[_0xb278('0x12')](_['keyBy'](_0x514d6c[_0xb278('0x13')],'id'),_0xb278('0x14'));return request({'uri':util[_0xb278('0xa')](_0xb278('0x15'),_0x79ae3c[_0xb278('0x16')]),'method':_0xb278('0x17'),'body':_0x514d6c})[_0xb278('0x18')](function(_0x171ca4){logger[_0xb278('0x19')](_0xb278('0x1a'));return _0x171ca4;});}function getUser(_0xdd4f9b,_0x1be675){if(intUtil[_0xb278('0x1b')](_0x1be675)){return request({'uri':util[_0xb278('0xa')](_0xb278('0x1c'),_0xdd4f9b['remoteUri']),'qs':{'email':_0x1be675}})[_0xb278('0x18')](function(_0x34483b){if(_0x34483b[_0xb278('0x1d')]){logger['info'](_0xb278('0x1e'));return _[_0xb278('0x1f')](_0x34483b,function(_0x916525){return _0x916525[_0xb278('0x20')][_0xb278('0x21')]===_0x1be675;});}else{logger[_0xb278('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb278('0xa')](_0xb278('0x22'),_0xdd4f9b[_0xb278('0x16')])})[_0xb278('0x18')](function(_0xdd1625){logger['info'](_0xb278('0x23'));return _0xdd1625;});}});}else{logger['info'](_0xb278('0x24'));return request({'uri':util[_0xb278('0xa')](_0xb278('0x22'),_0xdd4f9b[_0xb278('0x16')])})[_0xb278('0x18')](function(_0x5c2c1e){logger['info'](_0xb278('0x23'));return _0x5c2c1e;});}}function getEndUser(_0x3d01fd,_0x2af726,_0x1447fa){logger[_0xb278('0x19')]('Searching\x20enduser\x20with\x20phone',_0x1447fa);return request({'uri':util['format']('%s/api/v2/contacts',_0x3d01fd[_0xb278('0x16')]),'qs':{'phone':_0x1447fa}})[_0xb278('0x18')](function(_0x26db03){if(_0x26db03[_0xb278('0x1d')]){logger[_0xb278('0x19')](_0xb278('0x25'));return _[_0xb278('0x1f')](_0x26db03,{'phone':_0x1447fa});}else{logger['info'](_0xb278('0x26'));return request({'uri':util[_0xb278('0xa')](_0xb278('0x27'),_0x3d01fd[_0xb278('0x16')]),'method':'POST','body':{'name':_0x2af726,'phone':_0x1447fa}})[_0xb278('0x18')](function(_0x5c69fa){logger[_0xb278('0x19')](_0xb278('0x28'));return _0x5c69fa;});}});}function getAuth(_0x5d9ff8){return util[_0xb278('0xa')](_0xb278('0x29'),new Buffer(_0x5d9ff8[_0xb278('0x2a')]+':X')[_0xb278('0x2b')]('base64'));}function request(_0x3c7bb4){logger[_0xb278('0x2c')](_0xb278('0x2d'),JSON[_0xb278('0x2e')](_0x3c7bb4));return rp(_[_0xb278('0x2f')](_0x3c7bb4,{'method':_0xb278('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x34627b,_0x5db016){var _0x431bed=[];if(_0x34627b&&_0x34627b[_0xb278('0x1d')]>0x0){_0x431bed=_[_0xb278('0x31')](_0x34627b,_0x5db016);}return _0x431bed;}function getCustomFields(_0x2c9307,_0x3a2be9){var _0x1b2ff4=[];var _0x5bbc08={'custom_fields':[]};if(_0x2c9307[_0xb278('0x1d')]>0x0){_['forEach'](_0x2c9307,function(_0x51ae47){if(_[_0xb278('0x32')](['string',_0xb278('0x33')],_0x51ae47[_0xb278('0x34')])&&_0x51ae47[_0xb278('0x35')]&&!_0x51ae47['customField']){_0x5bbc08[_0x51ae47[_0xb278('0x35')]['toLowerCase']()]=_0x51ae47[_0xb278('0x36')][_0xb278('0x2b')]();}else if(_[_0xb278('0x32')]([_0xb278('0x37'),_0xb278('0x33')],_0x51ae47[_0xb278('0x34')])&&_0x51ae47[_0xb278('0x38')]&&_0x51ae47['customField']){_0x5bbc08[_0xb278('0x13')][_0xb278('0x39')]({'id':_0x51ae47[_0xb278('0x38')],'value':_0x51ae47['content'][_0xb278('0x2b')]()});}else if(_0x51ae47[_0xb278('0x34')]===_0xb278('0x3a')&&_0x51ae47['variableName']&&_0x51ae47[_0xb278('0x38')]&&_0x51ae47['customField']){_0x3a2be9[_0x51ae47['variableName']]&&_0x5bbc08[_0xb278('0x13')][_0xb278('0x39')]({'id':_0x51ae47[_0xb278('0x38')],'value':_0x3a2be9[_0x51ae47['variableName']][_0xb278('0x2b')]()});}else if(_0x51ae47['type']===_0xb278('0x3b')&&_0x51ae47[_0xb278('0x3c')]&&_0x51ae47['Variable'][_0xb278('0x3d')]&&_0x51ae47[_0xb278('0x38')]&&_0x51ae47[_0xb278('0x3e')]){_0x3a2be9[_0x51ae47[_0xb278('0x3c')][_0xb278('0x3d')][_0xb278('0x3f')]()]&&_0x5bbc08['custom_fields'][_0xb278('0x39')]({'id':_0x51ae47[_0xb278('0x38')],'value':_0x3a2be9[_0x51ae47[_0xb278('0x3c')]['name'][_0xb278('0x3f')]()][_0xb278('0x2b')]()});}});}return _0x5bbc08;}exports[_0xb278('0x40')]=function(_0x52c751,_0x4ebf65,_0xc86662,_0x4a0356,_0x25dc0a,_0x2325e0){var _0x401b90,_0x260fbf;_0x2325e0[_0xb278('0x16')]=intUtil[_0xb278('0x41')](_0x2325e0[_0xb278('0x16')]);_0x2325e0[_0xb278('0x42')]=intUtil[_0xb278('0x41')](_0x2325e0[_0xb278('0x42')]);if(_0x25dc0a&&_0x25dc0a[_0xb278('0x43')]){logger[_0xb278('0x19')]('[QUEUE]',_0xb278('0x44'));_0x4ebf65[_0xb278('0x45')]=util[_0xb278('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2325e0[_0xb278('0x42')],_0x4ebf65[_0xb278('0x46')],md5(_0x4ebf65[_0xb278('0x46')]));}else{_0x4ebf65[_0xb278('0x45')]='';}headers[_0xb278('0x47')]=getAuth(_0x2325e0);return getUser(_0x2325e0,_0x4a0356[_0xb278('0x21')])[_0xb278('0x18')](function(_0x8d58b7){_0x401b90=_0x8d58b7;logger[_0xb278('0x19')](_0xb278('0x48'),_0x401b90['id']);return getEndUser(_0x2325e0,_0x4ebf65[_0xb278('0xc')],_0x4ebf65[_0xb278('0x49')]);})[_0xb278('0x18')](function(_0x50ece2){_0x260fbf=_0x50ece2;logger['info'](_0xb278('0x4a'),_0x260fbf['id']);return getTicket(_0x2325e0,_0x401b90,_0x260fbf,_0xc86662,_0x4ebf65);})[_0xb278('0x18')](function(_0x6aee85){if(_0x6aee85&&_0x6aee85['id']){logger[_0xb278('0x19')]('Ticket\x20created!');logger['info'](_0xb278('0x4b'),_0x6aee85['id']);logger['info'](_0xb278('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb278('0xa')](_0xb278('0x4d'),_0x4a0356[_0xb278('0x3d')]),_0xb278('0x4e'),{'uri':util[_0xb278('0xa')](_0xb278('0x4f'),_0x2325e0['remoteUri'],_0x6aee85['id'])});}})[_0xb278('0x50')](function(_0x5312dc){logger[_0xb278('0x51')](_0xb278('0x4c'),JSON['stringify'](_0x5312dc));});};exports[_0xb278('0x52')]=function(_0x1d29d9,_0x96292a,_0x298205,_0xd048d2,_0x1de014,_0x354695,_0x1a7835){var _0x3583b9,_0x456abb;_0x354695[_0xb278('0x16')]=intUtil[_0xb278('0x41')](_0x354695['remoteUri']);_0x354695[_0xb278('0x42')]=intUtil[_0xb278('0x41')](_0x354695[_0xb278('0x42')]);if(_0x1a7835&&_0x1a7835[_0xb278('0x53')]&&_0x1a7835[_0xb278('0x53')]!=='none'){logger[_0xb278('0x19')](_0xb278('0x54'),'Recording\x20is\x20enabled!');_0x96292a[_0xb278('0x45')]=util[_0xb278('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x354695[_0xb278('0x42')],_0x96292a[_0xb278('0x46')],md5(_0x96292a[_0xb278('0x46')]));}headers[_0xb278('0x47')]=getAuth(_0x354695);return getUser(_0x354695,_0xd048d2[_0xb278('0x21')])[_0xb278('0x18')](function(_0x3b1353){_0x3583b9=_0x3b1353;logger[_0xb278('0x19')](_0xb278('0x48'),_0x3583b9['id']);return getEndUser(_0x354695,_0x96292a[_0xb278('0x55')],_0x96292a[_0xb278('0x56')]);})[_0xb278('0x18')](function(_0x4bbe8e){_0x456abb=_0x4bbe8e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x456abb['id']);return getTicket(_0x354695,_0x3583b9,_0x456abb,_0x298205,_0x96292a);})[_0xb278('0x18')](function(_0x1e4558){if(_0x1e4558&&_0x1e4558['id']){logger[_0xb278('0x19')]('Ticket\x20created!');logger[_0xb278('0x19')]('The\x20Ticket\x20ID\x20is:',_0x1e4558['id']);logger[_0xb278('0x19')](_0xb278('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb278('0xa')](_0xb278('0x4d'),_0xd048d2[_0xb278('0x3d')]),_0xb278('0x4e'),{'uri':util[_0xb278('0xa')](_0xb278('0x4f'),_0x354695[_0xb278('0x16')],_0x1e4558['id'])});}})[_0xb278('0x50')](function(_0x35d710){logger[_0xb278('0x51')]('[OUTBOUND]',JSON[_0xb278('0x2e')](_0x35d710));});};exports[_0xb278('0x57')]=function(_0x20c47a,_0x2effdd,_0x48a210,_0x4b6f66,_0x25882d,_0x224e58){var _0x31035f,_0x40aaa5;_0x224e58['remoteUri']=intUtil[_0xb278('0x41')](_0x224e58[_0xb278('0x16')]);_0x224e58['serverUrl']=intUtil[_0xb278('0x41')](_0x224e58['serverUrl']);if(_0x25882d&&_0x25882d[_0xb278('0x43')]){logger[_0xb278('0x19')]('['+_0x2effdd['lastevent'][_0xb278('0x58')]()+']','Recording\x20is\x20enabled!');_0x2effdd[_0xb278('0x45')]=util['format'](_0xb278('0x59'),_0x224e58[_0xb278('0x42')],_0x2effdd['uniqueid'],md5(_0x2effdd[_0xb278('0x46')]));}else{_0x2effdd[_0xb278('0x45')]='';}headers['Authorization']=getAuth(_0x224e58);return getUser(_0x224e58,'')['then'](function(_0x3ab775){_0x31035f=_0x3ab775;logger[_0xb278('0x19')]('The\x20User\x20ID\x20is:',_0x31035f['id']);return getEndUser(_0x224e58,_0x2effdd[_0xb278('0xc')],_0x2effdd[_0xb278('0x49')]);})[_0xb278('0x18')](function(_0x44ae9c){_0x40aaa5=_0x44ae9c;logger[_0xb278('0x19')](_0xb278('0x4a'),_0x40aaa5['id']);return getTicket(_0x224e58,_0x31035f,_0x40aaa5,_0x48a210,_0x2effdd);})[_0xb278('0x18')](function(_0x1361e4){if(_0x1361e4){logger[_0xb278('0x19')]('Ticket\x20created!');logger['info'](_0xb278('0x4b'),_0x1361e4['id']);}})[_0xb278('0x50')](function(_0xc15031){logger[_0xb278('0x51')]('['+_0x2effdd[_0xb278('0x5a')][_0xb278('0x58')]()+']',JSON[_0xb278('0x2e')](_0xc15031));});}; \ 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 35de383..a889403 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 _0x3e56=['/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/logger','redis','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','users','email','adminEmail','adminId','info','Admin\x20found:','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','catch','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST'];(function(_0x3ea62b,_0x196039){var _0x4d97ee=function(_0x563ab5){while(--_0x563ab5){_0x3ea62b['push'](_0x3ea62b['shift']());}};_0x4d97ee(++_0x196039);}(_0x3e56,0x165));var _0x63e5=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x3e56[_0x27beea];return _0x122645;};'use strict';var _=require(_0x63e5('0x0'));var rp=require(_0x63e5('0x1'));var md5=require(_0x63e5('0x2'));var util=require('util');var moment=require(_0x63e5('0x3'));var Promise=require(_0x63e5('0x4'));var Redis=require(_0x63e5('0x5'));var intUtil=require(_0x63e5('0x6'));var config=require('../../../../config/environment');var logger=require(_0x63e5('0x7'))('freshsales');config[_0x63e5('0x8')]=_['defaults'](config[_0x63e5('0x8')],{'host':_0x63e5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x63e5('0x8')]));function getAdminId(_0x22f5f1,_0x120369,_0x2dab90,_0x55ec3f){return new Promise(function(_0x29646e,_0x3b801a){var _0x1d3c7e=![];var _0x2e5461={'method':_0x63e5('0xa'),'uri':_0x55ec3f+_0x63e5('0xb'),'json':!![]};_0x2e5461[_0x63e5('0xc')]=_0x2dab90;logger['info'](_0x63e5('0xd'));return rp(_0x2e5461)['then'](function(_0x4e5eec){if(_0x4e5eec){var _0x528110=_0x4e5eec[_0x63e5('0xe')];var _0x344db0=null;for(_0x344db0=0x0;_0x344db0<_0x528110['length'];_0x344db0++){if(_0x528110[_0x344db0][_0x63e5('0xf')]===_0x22f5f1[_0x63e5('0x10')]){_0x22f5f1[_0x63e5('0x11')]=_0x528110[_0x344db0]['id'];_0x1d3c7e=!![];}}if(_0x1d3c7e){logger[_0x63e5('0x12')](_0x63e5('0x13'),_0x22f5f1[_0x63e5('0x11')]);_0x29646e(_0x22f5f1);}else{_0x3b801a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3b801a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x3b660c){logger[_0x63e5('0x14')]('['+[_0x120369[_0x63e5('0x15')]()]+']',_0x3b660c[_0x63e5('0x16')]);_0x3b801a(_0x3b660c);});});}function getUser(_0x58ee4c,_0x4a6540,_0x2cbc2d){return function(_0x197741){return new Promise(function(_0x24fa61,_0x2e68a2){var _0x50f27a={'method':_0x63e5('0xa'),'uri':_0x2cbc2d+_0x63e5('0xb'),'json':!![]};_0x50f27a['headers']=_0x4a6540;logger['info'](_0x63e5('0x17'));return rp(_0x50f27a)[_0x63e5('0x18')](function(_0x1e4030){if(_0x1e4030){var _0x4511c8=_0x1e4030[_0x63e5('0xe')];var _0x5a533e=![];var _0x37ad53=null;if(_0x197741[_0x63e5('0x19')]!==null){logger[_0x63e5('0x12')](_0x63e5('0x1a'),_0x197741[_0x63e5('0x19')]);_0x197741[_0x63e5('0x1b')]=_0x197741[_0x63e5('0x19')];for(_0x37ad53=0x0;_0x37ad53<_0x4511c8[_0x63e5('0x1c')];_0x37ad53++){if(_0x4511c8[_0x37ad53][_0x63e5('0xf')]===_0x197741[_0x63e5('0x19')]){_0x5a533e=!![];_0x197741[_0x63e5('0x1d')]=_0x4511c8[_0x37ad53]['id'];logger[_0x63e5('0x12')](_0x63e5('0x1e'),_0x197741[_0x63e5('0x1d')]);}}}if(!_0x5a533e){logger[_0x63e5('0x12')](_0x63e5('0x1f'));_0x197741[_0x63e5('0x1b')]=_0x197741[_0x63e5('0x10')];_0x197741[_0x63e5('0x1d')]=_0x197741['adminId'];_0x5a533e=!![];}if(_0x5a533e){_0x24fa61(_0x197741);}else{_0x2e68a2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2e68a2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x63e5('0x20')](function(_0x3c9b7b){logger[_0x63e5('0x14')]('['+[_0x58ee4c[_0x63e5('0x15')]()]+']',_0x3c9b7b['message']);_0x2e68a2(_0x3c9b7b);});});};}function searchContact(_0x11a1ae,_0x185854,_0x146360,_0x5b890e){return new Promise(function(_0x563b0e,_0x245e2a){var _0x281e2a={'method':_0x63e5('0xa'),'headers':_0x185854,'uri':_0x11a1ae+'/api/lookup?q='+_0x5b890e+'&f='+_0x146360+_0x63e5('0x21'),'json':!![]};rp(_0x281e2a)[_0x63e5('0x18')](function(_0x39da9e){var _0x774488=_['find'](_0x39da9e[_0x63e5('0x22')]['contacts'],[_0x146360,_0x5b890e]);_0x563b0e(_0x774488);})[_0x63e5('0x20')](function(_0x1fcdca){_0x245e2a(_0x1fcdca);});});}function getEndUser(_0x406e1b,_0x44fb67,_0x2e2b75){return function(_0x250d47){return new Promise(function(_0x32ad4e,_0x3c85ff){logger[_0x63e5('0x12')](util[_0x63e5('0x23')](_0x63e5('0x24'),_0x250d47['contactNumber']));searchContact(_0x2e2b75,_0x44fb67,'mobile_number',_0x250d47[_0x63e5('0x25')])['then'](function(_0x40bf73){if(_0x40bf73){_0x250d47[_0x63e5('0x26')]=_0x40bf73['id'];logger[_0x63e5('0x12')](_0x63e5('0x27'),_0x250d47['endUserId']);return _0x32ad4e(_0x250d47);}searchContact(_0x2e2b75,_0x44fb67,_0x63e5('0x28'),_0x250d47['contactNumber'])[_0x63e5('0x18')](function(_0xcea83b){if(_0xcea83b){_0x250d47[_0x63e5('0x26')]=_0xcea83b['id'];logger[_0x63e5('0x12')](_0x63e5('0x29'),_0x250d47['endUserId']);return _0x32ad4e(_0x250d47);}createEndUser(_0x250d47,_0x406e1b,_0x44fb67,_0x2e2b75)[_0x63e5('0x18')](function(_0x5c9b28){logger[_0x63e5('0x12')]('Contact\x20created:',_0x5c9b28[_0x63e5('0x26')]);return _0x32ad4e(_0x5c9b28);});});})['catch'](function(_0xb1f6d1){_0x3c85ff(_0xb1f6d1);});});};}function createEndUser(_0x1c0a9f,_0x1e32b5,_0x27176e,_0x298f5c){return new Promise(function(_0x4e4339,_0x217c2a){var _0x5da06f=moment();var _0x43b120={'method':_0x63e5('0x2a'),'uri':_0x298f5c+_0x63e5('0x2b'),'body':{'contact':{'last_name':_0x1c0a9f[_0x63e5('0x25')],'work_number':_0x1c0a9f[_0x63e5('0x25')],'mobile_number':_0x1c0a9f[_0x63e5('0x25')],'owner_id':_0x1c0a9f[_0x63e5('0x1d')],'created_at':_0x5da06f[_0x63e5('0x23')](_0x63e5('0x2c'))}},'json':!![]};_0x43b120[_0x63e5('0xc')]=_0x27176e;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x43b120)[_0x63e5('0x18')](function(_0x100b67){_0x1c0a9f[_0x63e5('0x26')]=_0x100b67[_0x63e5('0x2d')]['id'];_0x4e4339(_0x1c0a9f);})[_0x63e5('0x20')](function(_0x4c3d1e){logger[_0x63e5('0x14')]('['+[_0x1e32b5[_0x63e5('0x15')]()]+']',_0x4c3d1e['message']);_0x217c2a(_0x4c3d1e[_0x63e5('0x16')]);});});}function getTicket(_0x2b3ab4,_0x374f35,_0x54ffb8,_0x10022e,_0x1e30c2){return function(_0x41b043){logger[_0x63e5('0x12')](_0x63e5('0x2e'));return new Promise(function(_0x2fca54,_0x213cba){var _0x3012b6=moment();var _0x5bdc09={'method':'POST','uri':_0x54ffb8+_0x63e5('0x2f'),'body':{'title':intUtil[_0x63e5('0x30')](_0x10022e[_0x63e5('0x31')],_0x1e30c2,'\x20'),'description':intUtil['getString'](_0x10022e['Descriptions'],_0x1e30c2,'\x0a'),'owner_id':_0x41b043[_0x63e5('0x1d')],'creater_id':_0x41b043['adminId'],'targetable_id':_0x41b043[_0x63e5('0x26')],'targetable_type':_0x63e5('0x32'),'created_at':_0x3012b6[_0x63e5('0x23')](_0x63e5('0x2c')),'due_date':_0x3012b6[_0x63e5('0x33')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5bdc09[_0x63e5('0xc')]=_0x374f35;return rp(_0x5bdc09)[_0x63e5('0x18')](function(_0x3db000){_0x41b043[_0x63e5('0x34')]=_0x3db000[_0x63e5('0x35')]['id'];logger[_0x63e5('0x12')](_0x63e5('0x36'),_0x41b043['ticketId']);_0x2fca54(_0x41b043);})[_0x63e5('0x20')](function(_0x1e01d8){logger[_0x63e5('0x14')]('['+[_0x2b3ab4[_0x63e5('0x15')]()]+']',_0x1e01d8['message']);_0x213cba(_0x1e01d8[_0x63e5('0x16')]);});});};}function emit(_0x5d95b3,_0x4b1ce2,_0x5b749b){var _0x1fdcd3={'uri':_0x5d95b3+'/contacts/'+_0x5b749b};io['to'](util[_0x63e5('0x23')]('user:%s',_0x4b1ce2))[_0x63e5('0x37')](_0x63e5('0x38'),_0x1fdcd3);}exports['cs']=function(_0x26c058,_0x3d3729,_0x2abb54,_0x120cc9,_0x72d971,_0x6cef96,_0x22a189,_0x6faa4e){var _0x357dfd={};var _0x37e961={'Authorization':_0x63e5('0x39')+_0x6cef96[_0x63e5('0x3a')]};_0x6cef96['remoteUri']=intUtil[_0x63e5('0x3b')](_0x6cef96[_0x63e5('0x3c')]);_0x6cef96[_0x63e5('0x3d')]=intUtil[_0x63e5('0x3b')](_0x6cef96[_0x63e5('0x3d')]);var _0x242fb2=_0x6cef96['remoteUri'];_0x357dfd[_0x63e5('0x10')]=_0x6cef96[_0x63e5('0x3e')];_0x357dfd['contactNumber']=_0x6faa4e['toLowerCase']()===_0x63e5('0x3f')?_0x3d3729[_0x63e5('0x40')]:_0x3d3729[_0x63e5('0x41')];_0x357dfd[_0x63e5('0x42')]=_0x6faa4e==='queue'||_0x6faa4e==='unmanaged'?'queue':'outbound';if(_0x120cc9){_0x357dfd[_0x63e5('0x19')]=_0x120cc9[_0x63e5('0xf')];}var _0x2ad2d5=util[_0x63e5('0x23')](_0x63e5('0x43'),_0x6cef96['serverUrl'],_0x3d3729[_0x63e5('0x44')],md5(_0x3d3729[_0x63e5('0x44')]));if(_0x72d971&&_0x72d971[_0x63e5('0x45')]){logger[_0x63e5('0x12')]('[QUEUE]',_0x63e5('0x46'));_0x3d3729[_0x63e5('0x47')]=_0x2ad2d5;}else if(_0x22a189&&_0x22a189[_0x63e5('0x48')]&&_0x22a189[_0x63e5('0x48')]!=='none'){logger[_0x63e5('0x12')](_0x63e5('0x49'),_0x63e5('0x46'));_0x3d3729['recordingURL']=_0x2ad2d5;}else{_0x3d3729['recordingURL']='';}return getAdminId(_0x357dfd,_0x6faa4e,_0x37e961,_0x242fb2)[_0x63e5('0x18')](getUser(_0x6faa4e,_0x37e961,_0x242fb2))[_0x63e5('0x18')](getEndUser(_0x6faa4e,_0x37e961,_0x242fb2))['then'](getTicket(_0x6faa4e,_0x37e961,_0x242fb2,_0x2abb54,_0x3d3729))[_0x63e5('0x18')](function(_0xdd0ea3){logger[_0x63e5('0x12')](util[_0x63e5('0x23')](_0x63e5('0x4a'),_0xdd0ea3['ticketId']));if(_0x6faa4e!==_0x63e5('0x4b')){logger[_0x63e5('0x12')]('['+[_0x6faa4e[_0x63e5('0x15')]()]+']',_0x63e5('0x4c'));emit(_0x242fb2,_0x120cc9[_0x63e5('0x4d')],_0xdd0ea3['endUserId']);}})[_0x63e5('0x20')](function(_0x57d543){logger[_0x63e5('0x14')]('['+[_0x6faa4e['toUpperCase']()]+_0x63e5('0x4e'),util[_0x63e5('0x4f')](_0x57d543,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc4e3=['length','email','userId','User\x20found:','/api/lookup?q=','&entities=contact','find','contacts','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','add','ticketId','task','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail'];(function(_0x46614d,_0x2585cd){var _0x2ac14a=function(_0x347118){while(--_0x347118){_0x46614d['push'](_0x46614d['shift']());}};_0x2ac14a(++_0x2585cd);}(_0xc4e3,0x83));var _0x3c4e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4e3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3c4e('0x0'));var rp=require(_0x3c4e('0x1'));var md5=require(_0x3c4e('0x2'));var util=require(_0x3c4e('0x3'));var moment=require(_0x3c4e('0x4'));var Promise=require('bluebird');var Redis=require(_0x3c4e('0x5'));var intUtil=require(_0x3c4e('0x6'));var config=require(_0x3c4e('0x7'));var logger=require(_0x3c4e('0x8'))(_0x3c4e('0x9'));config[_0x3c4e('0xa')]=_[_0x3c4e('0xb')](config[_0x3c4e('0xa')],{'host':_0x3c4e('0xc'),'port':0x18eb});var io=require(_0x3c4e('0xd'))(new Redis(config[_0x3c4e('0xa')]));function getAdminId(_0x5373f6,_0x16343d,_0x3a4d98,_0x3f9ee2){return new Promise(function(_0x58285b,_0x40224c){var _0xadb22=![];var _0x5e37c4={'method':_0x3c4e('0xe'),'uri':_0x3f9ee2+_0x3c4e('0xf'),'json':!![]};_0x5e37c4[_0x3c4e('0x10')]=_0x3a4d98;logger['info'](_0x3c4e('0x11'));return rp(_0x5e37c4)[_0x3c4e('0x12')](function(_0x5ceca4){if(_0x5ceca4){var _0x170aa1=_0x5ceca4[_0x3c4e('0x13')];var _0x2f692d=null;for(_0x2f692d=0x0;_0x2f692d<_0x170aa1['length'];_0x2f692d++){if(_0x170aa1[_0x2f692d]['email']===_0x5373f6[_0x3c4e('0x14')]){_0x5373f6[_0x3c4e('0x15')]=_0x170aa1[_0x2f692d]['id'];_0xadb22=!![];}}if(_0xadb22){logger[_0x3c4e('0x16')](_0x3c4e('0x17'),_0x5373f6[_0x3c4e('0x15')]);_0x58285b(_0x5373f6);}else{_0x40224c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x40224c({'statusCode':0x194,'message':_0x3c4e('0x18')});}})[_0x3c4e('0x19')](function(_0x2e4902){logger[_0x3c4e('0x1a')]('['+[_0x16343d[_0x3c4e('0x1b')]()]+']',_0x2e4902[_0x3c4e('0x1c')]);_0x40224c(_0x2e4902);});});}function getUser(_0x21fcd2,_0x9aef09,_0x51f04a){return function(_0x79e62a){return new Promise(function(_0x48b1cf,_0xbe6f8a){var _0xb3a04e={'method':_0x3c4e('0xe'),'uri':_0x51f04a+_0x3c4e('0xf'),'json':!![]};_0xb3a04e['headers']=_0x9aef09;logger[_0x3c4e('0x16')](_0x3c4e('0x1d'));return rp(_0xb3a04e)[_0x3c4e('0x12')](function(_0x384bf4){if(_0x384bf4){var _0x53c31d=_0x384bf4['users'];var _0x420689=![];var _0x4b607c=null;if(_0x79e62a[_0x3c4e('0x1e')]!==null){logger[_0x3c4e('0x16')](_0x3c4e('0x1f'),_0x79e62a[_0x3c4e('0x1e')]);_0x79e62a[_0x3c4e('0x20')]=_0x79e62a[_0x3c4e('0x1e')];for(_0x4b607c=0x0;_0x4b607c<_0x53c31d[_0x3c4e('0x21')];_0x4b607c++){if(_0x53c31d[_0x4b607c][_0x3c4e('0x22')]===_0x79e62a[_0x3c4e('0x1e')]){_0x420689=!![];_0x79e62a[_0x3c4e('0x23')]=_0x53c31d[_0x4b607c]['id'];logger['info'](_0x3c4e('0x24'),_0x79e62a[_0x3c4e('0x23')]);}}}if(!_0x420689){logger[_0x3c4e('0x16')]('Admin\x20selected');_0x79e62a[_0x3c4e('0x20')]=_0x79e62a[_0x3c4e('0x14')];_0x79e62a[_0x3c4e('0x23')]=_0x79e62a[_0x3c4e('0x15')];_0x420689=!![];}if(_0x420689){_0x48b1cf(_0x79e62a);}else{_0xbe6f8a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xbe6f8a({'statusCode':0x194,'message':_0x3c4e('0x18')});}})[_0x3c4e('0x19')](function(_0x1d9a42){logger[_0x3c4e('0x1a')]('['+[_0x21fcd2[_0x3c4e('0x1b')]()]+']',_0x1d9a42[_0x3c4e('0x1c')]);_0xbe6f8a(_0x1d9a42);});});};}function searchContact(_0x407ee5,_0x488903,_0x1763be,_0x24ff60){return new Promise(function(_0x50a33f,_0x5877cd){var _0x5e0695={'method':_0x3c4e('0xe'),'headers':_0x488903,'uri':_0x407ee5+_0x3c4e('0x25')+_0x24ff60+'&f='+_0x1763be+_0x3c4e('0x26'),'json':!![]};rp(_0x5e0695)[_0x3c4e('0x12')](function(_0x20c502){var _0x306cd2=_[_0x3c4e('0x27')](_0x20c502['contacts'][_0x3c4e('0x28')],[_0x1763be,_0x24ff60]);_0x50a33f(_0x306cd2);})[_0x3c4e('0x19')](function(_0x25ef94){_0x5877cd(_0x25ef94);});});}function getEndUser(_0x43759a,_0x4690e9,_0x2bf35c){return function(_0x1a1631){return new Promise(function(_0x18face,_0x10104a){logger[_0x3c4e('0x16')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x1a1631[_0x3c4e('0x29')]));searchContact(_0x2bf35c,_0x4690e9,_0x3c4e('0x2a'),_0x1a1631[_0x3c4e('0x29')])['then'](function(_0x498eb8){if(_0x498eb8){_0x1a1631['endUserId']=_0x498eb8['id'];logger['info'](_0x3c4e('0x2b'),_0x1a1631['endUserId']);return _0x18face(_0x1a1631);}searchContact(_0x2bf35c,_0x4690e9,_0x3c4e('0x2c'),_0x1a1631[_0x3c4e('0x29')])[_0x3c4e('0x12')](function(_0x290ceb){if(_0x290ceb){_0x1a1631[_0x3c4e('0x2d')]=_0x290ceb['id'];logger[_0x3c4e('0x16')]('Contact\x20found\x20work_number:',_0x1a1631[_0x3c4e('0x2d')]);return _0x18face(_0x1a1631);}createEndUser(_0x1a1631,_0x43759a,_0x4690e9,_0x2bf35c)[_0x3c4e('0x12')](function(_0x3162d8){logger['info']('Contact\x20created:',_0x3162d8[_0x3c4e('0x2d')]);return _0x18face(_0x3162d8);});});})['catch'](function(_0x71329c){_0x10104a(_0x71329c);});});};}function createEndUser(_0x5a86b4,_0x39bede,_0x9b4313,_0x23593f){return new Promise(function(_0x1a7275,_0x397a0c){var _0x44dbf9=moment();var _0x4c956d={'method':_0x3c4e('0x2e'),'uri':_0x23593f+_0x3c4e('0x2f'),'body':{'contact':{'last_name':_0x5a86b4[_0x3c4e('0x29')],'work_number':_0x5a86b4[_0x3c4e('0x29')],'mobile_number':_0x5a86b4['contactNumber'],'owner_id':_0x5a86b4[_0x3c4e('0x23')],'created_at':_0x44dbf9[_0x3c4e('0x30')](_0x3c4e('0x31'))}},'json':!![]};_0x4c956d[_0x3c4e('0x10')]=_0x9b4313;logger['info'](_0x3c4e('0x32'));return rp(_0x4c956d)['then'](function(_0x22028b){_0x5a86b4[_0x3c4e('0x2d')]=_0x22028b['contact']['id'];_0x1a7275(_0x5a86b4);})['catch'](function(_0x257935){logger[_0x3c4e('0x1a')]('['+[_0x39bede[_0x3c4e('0x1b')]()]+']',_0x257935[_0x3c4e('0x1c')]);_0x397a0c(_0x257935[_0x3c4e('0x1c')]);});});}function getTicket(_0x269d89,_0x138574,_0x275a82,_0x29ba21,_0x1ea3cc){return function(_0x2082e0){logger[_0x3c4e('0x16')](_0x3c4e('0x33'));return new Promise(function(_0x1aeab7,_0x50fb0f){var _0x58e00b=moment();var _0x59de13={'method':_0x3c4e('0x2e'),'uri':_0x275a82+_0x3c4e('0x34'),'body':{'title':intUtil[_0x3c4e('0x35')](_0x29ba21[_0x3c4e('0x36')],_0x1ea3cc,'\x20'),'description':intUtil[_0x3c4e('0x35')](_0x29ba21['Descriptions'],_0x1ea3cc,'\x0a'),'owner_id':_0x2082e0[_0x3c4e('0x23')],'creater_id':_0x2082e0[_0x3c4e('0x15')],'targetable_id':_0x2082e0[_0x3c4e('0x2d')],'targetable_type':'Contact','created_at':_0x58e00b[_0x3c4e('0x30')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x58e00b[_0x3c4e('0x37')](0x1e,'m')['format'](_0x3c4e('0x31'))},'json':!![]};_0x59de13[_0x3c4e('0x10')]=_0x138574;return rp(_0x59de13)[_0x3c4e('0x12')](function(_0x5e482c){_0x2082e0[_0x3c4e('0x38')]=_0x5e482c[_0x3c4e('0x39')]['id'];logger[_0x3c4e('0x16')]('Task\x20created:',_0x2082e0[_0x3c4e('0x38')]);_0x1aeab7(_0x2082e0);})[_0x3c4e('0x19')](function(_0x19e263){logger[_0x3c4e('0x1a')]('['+[_0x269d89[_0x3c4e('0x1b')]()]+']',_0x19e263[_0x3c4e('0x1c')]);_0x50fb0f(_0x19e263[_0x3c4e('0x1c')]);});});};}function emit(_0xe359f6,_0x1a9cea,_0x28ec6e){var _0x381ff3={'uri':_0xe359f6+'/contacts/'+_0x28ec6e};io['to'](util[_0x3c4e('0x30')](_0x3c4e('0x3a'),_0x1a9cea))[_0x3c4e('0x3b')](_0x3c4e('0x3c'),_0x381ff3);}exports['cs']=function(_0x4c9108,_0x5ae9d5,_0x201f41,_0x20317c,_0x44418d,_0x42c9d4,_0x3316f4,_0x1fb7b6){var _0x5a16f9={};var _0x2de5f3={'Authorization':_0x3c4e('0x3d')+_0x42c9d4['apiKey']};_0x42c9d4[_0x3c4e('0x3e')]=intUtil[_0x3c4e('0x3f')](_0x42c9d4[_0x3c4e('0x3e')]);_0x42c9d4[_0x3c4e('0x40')]=intUtil['stripTrailingSlash'](_0x42c9d4['serverUrl']);var _0x33bb6c=_0x42c9d4[_0x3c4e('0x3e')];_0x5a16f9[_0x3c4e('0x14')]=_0x42c9d4[_0x3c4e('0x41')];_0x5a16f9[_0x3c4e('0x29')]=_0x1fb7b6[_0x3c4e('0x42')]()===_0x3c4e('0x43')?_0x5ae9d5[_0x3c4e('0x44')]:_0x5ae9d5[_0x3c4e('0x45')];_0x5a16f9['callDirection']=_0x1fb7b6===_0x3c4e('0x46')||_0x1fb7b6===_0x3c4e('0x47')?_0x3c4e('0x46'):_0x3c4e('0x43');if(_0x20317c){_0x5a16f9[_0x3c4e('0x1e')]=_0x20317c['email'];}var _0xaeb39d=util[_0x3c4e('0x30')](_0x3c4e('0x48'),_0x42c9d4[_0x3c4e('0x40')],_0x5ae9d5[_0x3c4e('0x49')],md5(_0x5ae9d5[_0x3c4e('0x49')]));if(_0x44418d&&_0x44418d[_0x3c4e('0x4a')]){logger[_0x3c4e('0x16')](_0x3c4e('0x4b'),_0x3c4e('0x4c'));_0x5ae9d5[_0x3c4e('0x4d')]=_0xaeb39d;}else if(_0x3316f4&&_0x3316f4[_0x3c4e('0x4e')]&&_0x3316f4[_0x3c4e('0x4e')]!=='none'){logger[_0x3c4e('0x16')]('[OUTBOUND]',_0x3c4e('0x4c'));_0x5ae9d5['recordingURL']=_0xaeb39d;}else{_0x5ae9d5[_0x3c4e('0x4d')]='';}return getAdminId(_0x5a16f9,_0x1fb7b6,_0x2de5f3,_0x33bb6c)[_0x3c4e('0x12')](getUser(_0x1fb7b6,_0x2de5f3,_0x33bb6c))[_0x3c4e('0x12')](getEndUser(_0x1fb7b6,_0x2de5f3,_0x33bb6c))['then'](getTicket(_0x1fb7b6,_0x2de5f3,_0x33bb6c,_0x201f41,_0x5ae9d5))['then'](function(_0x406d65){logger[_0x3c4e('0x16')](util[_0x3c4e('0x30')]('The\x20ticket\x20ID\x20is:\x20%s',_0x406d65[_0x3c4e('0x38')]));if(_0x1fb7b6!==_0x3c4e('0x47')){logger[_0x3c4e('0x16')]('['+[_0x1fb7b6[_0x3c4e('0x1b')]()]+']',_0x3c4e('0x4f'));emit(_0x33bb6c,_0x20317c['name'],_0x406d65[_0x3c4e('0x2d')]);}})[_0x3c4e('0x19')](function(_0x2877e3){logger[_0x3c4e('0x1a')]('['+[_0x1fb7b6[_0x3c4e('0x1b')]()]+_0x3c4e('0x50'),util[_0x3c4e('0x51')](_0x2877e3,{'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 daeca8c..35b0ddd 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 _0xd56b=['vtiger','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','unmanaged','freshdesk','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk'];(function(_0x489b12,_0xfbda9c){var _0x2fe3d3=function(_0x33ff52){while(--_0x33ff52){_0x489b12['push'](_0x489b12['shift']());}};_0x2fe3d3(++_0xfbda9c);}(_0xd56b,0x173));var _0xbd56=function(_0x3d2550,_0x597362){_0x3d2550=_0x3d2550-0x0;var _0xff9f94=_0xd56b[_0x3d2550];return _0xff9f94;};'use strict';var _=require(_0xbd56('0x0'));var util=require('util');var zendesk=require(_0xbd56('0x1'));var salesforce=require(_0xbd56('0x2'));var sugarcrm=require(_0xbd56('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0xbd56('0x4'));var desk=require(_0xbd56('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0xbd56('0x6'));var dynamics365=require(_0xbd56('0x7'));var freshsales=require(_0xbd56('0x8'));var integrations=[_0xbd56('0x9'),_0xbd56('0xa'),_0xbd56('0xb'),'freshdesk',_0xbd56('0xc'),_0xbd56('0xd'),_0xbd56('0xe'),'dynamics365',_0xbd56('0xf'),_0xbd56('0x10')];exports[_0xbd56('0x11')]=function(_0x3d4e7b,_0x37b4e1,_0xa94bdd,_0x1f1afc,_0x43a95c,_0x4a2db8){if(_0xa94bdd){if(_['includes'](integrations,_0x3d4e7b[_0xbd56('0x12')][_0xbd56('0x13')]())){try{var _0xea63f8=null;var _0x18bac1='';var _0x24e881=_0xa94bdd[_0x3d4e7b[_0xbd56('0x12')][_0xbd56('0x13')]()];if(_0x24e881){var _0x4cb2ee=_0x24e881[_0x3d4e7b[_0xbd56('0x14')]];if(_0x4cb2ee){var _0x2bda34=_[_0xbd56('0x15')](_0x4cb2ee[_0xbd56('0x16')],{'id':parseInt(_0x3d4e7b[_0xbd56('0x17')],0xa)});if(_0x2bda34){if(_0x1f1afc){if(_0x43a95c&&_0x37b4e1[_0xbd56('0x18')]){_0x18bac1=_0xbd56('0x18');}else if(_0x37b4e1['routeId']){_0x18bac1=_0xbd56('0x19');}else{console[_0xbd56('0x1a')]('EVENT\x20UNKNOWN',_0x37b4e1);}}else{_0x18bac1=_0xbd56('0x1b');}switch(_0x3d4e7b[_0xbd56('0x12')][_0xbd56('0x13')]()){case _0xbd56('0x9'):zendesk[_0x18bac1](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8);break;case'salesforce':salesforce[_0x18bac1](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8);break;case'sugarcrm':sugarcrm[_0x18bac1](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8);break;case _0xbd56('0x1c'):freshdesk[_0x18bac1](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8);break;case _0xbd56('0xc'):zoho[_0x18bac1](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8);break;case _0xbd56('0xd'):desk[_0x18bac1](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8);break;case'vtiger':vtiger[_0x18bac1](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8);break;case'freshsales':freshsales['cs'](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8,_0x18bac1);break;case _0xbd56('0x10'):servicenow['cs'](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8,_0x18bac1);break;case'dynamics365':dynamics365['cs'](_0x3d4e7b,_0x37b4e1,_0x2bda34,_0x1f1afc,_0x43a95c,_0x4cb2ee,_0x4a2db8,_0x18bac1);break;default:console[_0xbd56('0x1a')]('unknown\x20integration');}}else{_0xea63f8=require(_0xbd56('0x1d'))(_0x3d4e7b[_0xbd56('0x12')][_0xbd56('0x13')]());_0xea63f8[_0xbd56('0x1e')]('[EXEC]',util[_0xbd56('0x1f')](_0xbd56('0x20'),_0x3d4e7b[_0xbd56('0x12')][_0xbd56('0x13')](),_0x3d4e7b[_0xbd56('0x17')]));}}else{_0xea63f8=require(_0xbd56('0x1d'))(_0x3d4e7b[_0xbd56('0x12')][_0xbd56('0x13')]());_0xea63f8[_0xbd56('0x1e')](_0xbd56('0x21'),util['format'](_0xbd56('0x22'),_0x3d4e7b[_0xbd56('0x12')][_0xbd56('0x13')](),_0x3d4e7b[_0xbd56('0x14')]));}}else{}}catch(_0x458b19){console[_0xbd56('0x1e')](_0x458b19);}}}}; \ No newline at end of file +var _0x184f=['outbound','desk','vtiger','freshsales','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','dynamics365','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x184f,0x110));var _0xf184=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x184f[_0x1e05c1];return _0x15f1ca;};'use strict';var _=require('lodash');var util=require(_0xf184('0x0'));var zendesk=require(_0xf184('0x1'));var salesforce=require(_0xf184('0x2'));var sugarcrm=require(_0xf184('0x3'));var freshdesk=require(_0xf184('0x4'));var zoho=require(_0xf184('0x5'));var desk=require(_0xf184('0x6'));var vtiger=require(_0xf184('0x7'));var servicenow=require(_0xf184('0x8'));var dynamics365=require(_0xf184('0x9'));var freshsales=require(_0xf184('0xa'));var integrations=[_0xf184('0xb'),_0xf184('0xc'),_0xf184('0xd'),'freshdesk',_0xf184('0xe'),'desk','vtiger',_0xf184('0xf'),'freshsales','servicenow'];exports['exec']=function(_0x41f1f1,_0x35efc2,_0x7be81d,_0x43dad0,_0x1ae1ef,_0x43c9dd){if(_0x7be81d){if(_[_0xf184('0x10')](integrations,_0x41f1f1[_0xf184('0x11')]['toLowerCase']())){try{var _0x562502=null;var _0x3790cd='';var _0x7c8bcf=_0x7be81d[_0x41f1f1['data1'][_0xf184('0x12')]()];if(_0x7c8bcf){var _0x4c5b78=_0x7c8bcf[_0x41f1f1['data2']];if(_0x4c5b78){var _0x1ce81e=_[_0xf184('0x13')](_0x4c5b78[_0xf184('0x14')],{'id':parseInt(_0x41f1f1[_0xf184('0x15')],0xa)});if(_0x1ce81e){if(_0x43dad0){if(_0x1ae1ef&&_0x35efc2[_0xf184('0x16')]){_0x3790cd=_0xf184('0x16');}else if(_0x35efc2[_0xf184('0x17')]){_0x3790cd=_0xf184('0x18');}else{console['log']('EVENT\x20UNKNOWN',_0x35efc2);}}else{_0x3790cd='unmanaged';}switch(_0x41f1f1[_0xf184('0x11')]['toLowerCase']()){case _0xf184('0xb'):zendesk[_0x3790cd](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd);break;case'salesforce':salesforce[_0x3790cd](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd);break;case'sugarcrm':sugarcrm[_0x3790cd](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd);break;case'freshdesk':freshdesk[_0x3790cd](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd);break;case _0xf184('0xe'):zoho[_0x3790cd](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd);break;case _0xf184('0x19'):desk[_0x3790cd](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd);break;case _0xf184('0x1a'):vtiger[_0x3790cd](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd);break;case _0xf184('0x1b'):freshsales['cs'](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd,_0x3790cd);break;case _0xf184('0x1c'):servicenow['cs'](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd,_0x3790cd);break;case _0xf184('0xf'):dynamics365['cs'](_0x41f1f1,_0x35efc2,_0x1ce81e,_0x43dad0,_0x1ae1ef,_0x4c5b78,_0x43c9dd,_0x3790cd);break;default:console['log'](_0xf184('0x1d'));}}else{_0x562502=require(_0xf184('0x1e'))(_0x41f1f1[_0xf184('0x11')][_0xf184('0x12')]());_0x562502['error'](_0xf184('0x1f'),util[_0xf184('0x20')](_0xf184('0x21'),_0x41f1f1[_0xf184('0x11')][_0xf184('0x12')](),_0x41f1f1[_0xf184('0x15')]));}}else{_0x562502=require('../../../../config/logger')(_0x41f1f1[_0xf184('0x11')]['toLowerCase']());_0x562502[_0xf184('0x22')](_0xf184('0x1f'),util[_0xf184('0x20')](_0xf184('0x23'),_0x41f1f1[_0xf184('0x11')]['toLowerCase'](),_0x41f1f1[_0xf184('0x24')]));}}else{}}catch(_0x503ae0){console[_0xf184('0x22')](_0x503ae0);}}}}; \ 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 fd77527..d6142bb 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 _0x07ae=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','Case','ContactId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07ae,0x123));var _0xe07a=function(_0x13d0a5,_0x5c1bdf){_0x13d0a5=_0x13d0a5-0x0;var _0x259aee=_0x07ae[_0x13d0a5];return _0x259aee;};'use strict';var _=require(_0xe07a('0x0'));var rp=require(_0xe07a('0x1'));var moment=require(_0xe07a('0x2'));var BPromise=require(_0xe07a('0x3'));var md5=require('md5');var jsforce=require(_0xe07a('0x4'));var util=require(_0xe07a('0x5'));var Redis=require(_0xe07a('0x6'));var intUtil=require(_0xe07a('0x7'));var config=require(_0xe07a('0x8'));var logger=require(_0xe07a('0x9'))(_0xe07a('0xa'));config[_0xe07a('0xb')]=_[_0xe07a('0xc')](config[_0xe07a('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xe07a('0xd'))(new Redis(config['redis']));function emit(_0x505cc7,_0x561ef5,_0x3bf298){io['to'](_0x505cc7)[_0xe07a('0xe')](_0x561ef5,_0x3bf298);}function getTicket(_0x4bb044,_0x52d417,_0x1591ab,_0x25d3d6,_0x2e4d25,_0x39efc3,_0x428729,_0x17c515){var _0x5c8c01=Object[_0xe07a('0xf')]({},{'OwnerId':_0x52d417['id'],'Subject':intUtil[_0xe07a('0x10')](_0x25d3d6[_0xe07a('0x11')],_0x2e4d25,'\x20'),'Description':intUtil[_0xe07a('0x10')](_0x25d3d6[_0xe07a('0x12')],_0x2e4d25,'\x0a')},getCustomFields(_0x39efc3,_0x2e4d25));if(_0x1591ab){if(_0x25d3d6[_0xe07a('0x13')]===_0xe07a('0x14')){_0x5c8c01[_0xe07a('0x15')]=moment[_0xe07a('0x16')]();_0x5c8c01[_0xe07a('0x17')]=![];_0x5c8c01[_0xe07a('0x18')]=![];if(_0x1591ab[_0xe07a('0x19')]===_0xe07a('0x1a')||_0x1591ab[_0xe07a('0x19')]===_0xe07a('0x1b')){_0x5c8c01[_0xe07a('0x1c')]=_0x1591ab['id'];}else if(_0x1591ab['endUserType']===_0xe07a('0x1d')){_0x5c8c01['WhatId']=_0x1591ab['id'];}}else if(_0x25d3d6[_0xe07a('0x13')]===_0xe07a('0x1e')){if(_0x1591ab[_0xe07a('0x19')]===_0xe07a('0x1a')){_0x5c8c01[_0xe07a('0x1f')]=_0x1591ab['id'];}else if(_0x1591ab['endUserType']===_0xe07a('0x1d')){_0x5c8c01['AccountId']=_0x1591ab['id'];}else if(_0x1591ab['endUserType']===_0xe07a('0x1b')&&_0x25d3d6[_0xe07a('0x20')]){_0x5c8c01[_0x25d3d6['leadId']]=_0x1591ab['id'];}else{logger['info'](_0xe07a('0x21'));}}}return _0x428729[_0xe07a('0x22')](_0x25d3d6[_0xe07a('0x13')])[_0xe07a('0x23')](_0x5c8c01);}function getUser(_0x4de36c,_0x3ca81e,_0x37fd22){if(!_[_0xe07a('0x24')](_0x3ca81e)&&intUtil['validateEmail'](_0x3ca81e)){var _0x533995={'Email':_0x3ca81e};var _0xf49fd2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x37fd22[_0xe07a('0x22')](_0xe07a('0x25'))[_0xe07a('0x26')](_0x533995,_0xf49fd2)[_0xe07a('0x27')]()[_0xe07a('0x28')](function(_0x3b9263){if(_0x3b9263[_0xe07a('0x29')]){var _0x52ef15=_[_0xe07a('0x26')](_0x3b9263,function(_0x421b53){return _0x421b53['Email']===_0x3ca81e;});if(_0x52ef15){logger[_0xe07a('0x2a')](_0xe07a('0x2b'),_0x3ca81e);return BPromise['resolve']({'id':_0x52ef15['Id'],'name':_0x52ef15[_0xe07a('0x2c')]});}}else{logger[_0xe07a('0x2a')](_0xe07a('0x2d'),_0x3ca81e);return _0x37fd22[_0xe07a('0x2e')]()[_0xe07a('0x28')](function(_0x38715b){return BPromise[_0xe07a('0x2f')]({'id':_0x38715b[_0xe07a('0x30')],'name':_0x38715b['display_name']});});}});}else{logger[_0xe07a('0x2a')](_0xe07a('0x2d'),_0x3ca81e);return _0x37fd22[_0xe07a('0x2e')]()[_0xe07a('0x28')](function(_0x4381dd){return BPromise[_0xe07a('0x2f')]({'id':_0x4381dd[_0xe07a('0x30')],'name':_0x4381dd[_0xe07a('0x31')]});});}}function getEndUser(_0x473030,_0x49b852,_0x111f7f,_0x1ed8b8,_0x453767){var _0x211e52={'$or':{'Phone':_0x1ed8b8}};var _0x2c4787={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe07a('0x2f')]()[_0xe07a('0x28')](function(){logger[_0xe07a('0x2a')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1ed8b8,_0x49b852['moduleSearch']);switch(_0x49b852['moduleSearch']){case _0xe07a('0x32'):var _0x59661c=_[_0xe07a('0x33')](_0x211e52);if(_0x49b852['additionalSearchContact']){var _0x101fa7={};_0x101fa7[_0x49b852[_0xe07a('0x34')]]=_0x1ed8b8;_[_0xe07a('0x35')](_0x59661c[_0xe07a('0x36')],_0x101fa7);}return _0x453767[_0xe07a('0x22')](_0xe07a('0x37'))[_0xe07a('0x26')](_0x59661c,_0x2c4787)[_0xe07a('0x27')]()[_0xe07a('0x28')](function(_0x3e2fdb){if(_0x3e2fdb&&_0x3e2fdb[_0xe07a('0x29')]){return _0x3e2fdb;}else{var _0x402d9c=_['cloneDeep'](_0x211e52);if(_0x49b852['additionalSearchLead']){var _0x1e2825={};_0x1e2825[_0x49b852[_0xe07a('0x38')]]=_0x1ed8b8;_[_0xe07a('0x35')](_0x402d9c[_0xe07a('0x36')],_0x1e2825);}return _0x453767[_0xe07a('0x22')](_0xe07a('0x39'))[_0xe07a('0x26')](_0x402d9c,_0x2c4787);}});case _0xe07a('0x3a'):var _0x5a87a6=_[_0xe07a('0x33')](_0x211e52);if(_0x49b852[_0xe07a('0x3b')]){var _0x101fa7={};_0x101fa7[_0x49b852[_0xe07a('0x3b')]]=_0x1ed8b8;_['merge'](_0x5a87a6['$or'],_0x101fa7);}return _0x453767['sobject'](_0xe07a('0x3c'))[_0xe07a('0x26')](_0x5a87a6,_0x2c4787)[_0xe07a('0x27')]()['then'](function(_0x30a6af){if(_0x30a6af&&_0x30a6af['length']){return _0x30a6af;}else{var _0x56ce07=_[_0xe07a('0x33')](_0x211e52);if(_0x49b852['additionalSearchContact']){var _0x42c9c3={};_0x42c9c3[_0x49b852[_0xe07a('0x34')]]=_0x1ed8b8;_[_0xe07a('0x35')](_0x56ce07[_0xe07a('0x36')],_0x42c9c3);}return _0x453767['sobject'](_0xe07a('0x37'))[_0xe07a('0x26')](_0x56ce07,_0x2c4787)[_0xe07a('0x28')](function(_0x45f9e5){if(_0x45f9e5&&_0x45f9e5[_0xe07a('0x29')]){return _0x45f9e5;}else{var _0x4fae08=_[_0xe07a('0x33')](_0x211e52);if(_0x49b852['additionalSearchLead']){var _0x4e861b={};_0x4e861b[_0x49b852[_0xe07a('0x38')]]=_0x1ed8b8;_[_0xe07a('0x35')](_0x4fae08[_0xe07a('0x36')],_0x4e861b);}return _0x453767[_0xe07a('0x22')]('Lead')[_0xe07a('0x26')](_0x4fae08,_0x2c4787);}});}});case _0xe07a('0x1a'):var _0x59661c=_[_0xe07a('0x33')](_0x211e52);if(_0x49b852[_0xe07a('0x34')]){var _0x101fa7={};_0x101fa7[_0x49b852[_0xe07a('0x34')]]=_0x1ed8b8;_[_0xe07a('0x35')](_0x59661c[_0xe07a('0x36')],_0x101fa7);}return _0x453767[_0xe07a('0x22')](_0xe07a('0x37'))[_0xe07a('0x26')](_0x59661c,_0x2c4787)[_0xe07a('0x27')]();case _0xe07a('0x1b'):var _0x4f4c8a=_[_0xe07a('0x33')](_0x211e52);if(_0x49b852['additionalSearchLead']){var _0x101fa7={};_0x101fa7[_0x49b852[_0xe07a('0x38')]]=_0x1ed8b8;_[_0xe07a('0x35')](_0x4f4c8a[_0xe07a('0x36')],_0x101fa7);}return _0x453767['sobject']('Lead')[_0xe07a('0x26')](_0x4f4c8a,_0x2c4787);case _0xe07a('0x1d'):var _0x5a87a6=_[_0xe07a('0x33')](_0x211e52);if(_0x49b852['additionalSearchAccount']){var _0x101fa7={};_0x101fa7[_0x49b852['additionalSearchAccount']]=_0x1ed8b8;_['merge'](_0x5a87a6['$or'],_0x101fa7);}return _0x453767[_0xe07a('0x22')](_0xe07a('0x3c'))['find'](_0x5a87a6,_0x2c4787);default:return null;}})[_0xe07a('0x28')](function(_0x4ea601){if(_0x4ea601&&_0x4ea601[_0xe07a('0x29')]){var _0x141751=_[_0xe07a('0x3d')](_0x4ea601);if(_0x141751){return BPromise[_0xe07a('0x2f')]({'id':_0x141751['Id'],'name':_0x141751[_0xe07a('0x2c')],'phone':_0x141751[_0xe07a('0x3e')],'endUserType':_0x141751[_0xe07a('0x3f')][_0xe07a('0x40')][_0xe07a('0x41')]()});}}})['then'](function(_0x1a7d90){if(_0x1a7d90){logger[_0xe07a('0x2a')](_0xe07a('0x42'),_0x1a7d90[_0xe07a('0x19')],_0x1ed8b8);return BPromise[_0xe07a('0x2f')](_0x1a7d90);}else{logger[_0xe07a('0x2a')](_0xe07a('0x43'),_0x1ed8b8);var _0x3ab235={'Phone':_0x1ed8b8};if(_0x49b852[_0xe07a('0x44')]){if(_0x49b852[_0xe07a('0x44')]==='contact'){logger[_0xe07a('0x2a')](_0xe07a('0x45'),_0x1ed8b8,_0x49b852[_0xe07a('0x44')]);_0x3ab235[_0xe07a('0x46')]=_0x111f7f!==_0xe07a('0x47')?_0x111f7f:util['format']('Caller\x20-\x20%s',_0x1ed8b8);}else if(_0x49b852[_0xe07a('0x44')]===_0xe07a('0x1b')){logger[_0xe07a('0x2a')](_0xe07a('0x45'),_0x1ed8b8,_0x49b852[_0xe07a('0x44')]);_0x3ab235[_0xe07a('0x46')]=_0x111f7f!==_0xe07a('0x47')?_0x111f7f:util[_0xe07a('0x48')](_0xe07a('0x49'),_0x1ed8b8);_0x3ab235['Company']=_0xe07a('0x4a');}else if(_0x49b852[_0xe07a('0x44')]===_0xe07a('0x1d')){logger[_0xe07a('0x2a')](_0xe07a('0x45'),_0x1ed8b8,_0x49b852['moduleCreate']);_0x3ab235[_0xe07a('0x2c')]=_0x111f7f!==_0xe07a('0x47')?_0x111f7f:util[_0xe07a('0x48')](_0xe07a('0x49'),_0x1ed8b8);}else{return null;}}return _0x453767[_0xe07a('0x22')](_[_0xe07a('0x4b')](_0x49b852[_0xe07a('0x44')]))[_0xe07a('0x23')](_0x3ab235)[_0xe07a('0x28')](function(_0x39b2ed){return BPromise['resolve']({'id':_0x39b2ed['id'],'endUserType':_0x49b852[_0xe07a('0x44')]});});}});}function getCustomFields(_0xa0f26b,_0xe10ef8){var _0x578a97={};if(_0xa0f26b[_0xe07a('0x29')]>0x0){_[_0xe07a('0x4c')](_0xa0f26b,function(_0x2ad6b1){if(_[_0xe07a('0x4d')]([_0xe07a('0x4e'),_0xe07a('0x4f')],_0x2ad6b1[_0xe07a('0x40')])&&_0x2ad6b1['idField']){_0x578a97[_0x2ad6b1[_0xe07a('0x50')]]=_0x2ad6b1[_0xe07a('0x51')][_0xe07a('0x52')]();}else if(_0x2ad6b1['type']===_0xe07a('0x53')&&_0x2ad6b1[_0xe07a('0x54')]&&_0x2ad6b1['idField']){_0xe10ef8[_0x2ad6b1['variableName']]&&(_0x578a97[_0x2ad6b1[_0xe07a('0x50')]]=_0xe10ef8[_0x2ad6b1[_0xe07a('0x54')]][_0xe07a('0x52')]());}else if(_0x2ad6b1['type']===_0xe07a('0x55')&&_0x2ad6b1[_0xe07a('0x56')]&&_0x2ad6b1[_0xe07a('0x56')][_0xe07a('0x57')]&&_0x2ad6b1['idField']){_0xe10ef8[_0x2ad6b1[_0xe07a('0x56')][_0xe07a('0x57')][_0xe07a('0x41')]()]&&(_0x578a97[_0x2ad6b1['idField']]=_0xe10ef8[_0x2ad6b1['Variable'][_0xe07a('0x57')][_0xe07a('0x41')]()][_0xe07a('0x52')]());}});}return _0x578a97;}function getConnection(_0x18d5ad){var _0x37bf3a=_0x18d5ad[_0xe07a('0x58')][_0xe07a('0x59')](_0x18d5ad[_0xe07a('0x5a')]);var _0x29eaed=new jsforce['Connection']({'oauth2':{'loginUrl':_0x18d5ad[_0xe07a('0x5b')]||_0xe07a('0x5c'),'clientId':_0x18d5ad[_0xe07a('0x5d')],'clientSecret':_0x18d5ad['clientSecret']}});return _0x29eaed['login'](_0x18d5ad['username'],_0x37bf3a)[_0xe07a('0x28')](function(){logger['info'](_0xe07a('0x5e'));return _0x29eaed;});}exports['queue']=function(_0xead53c,_0x878cef,_0x459d86,_0x2a0f09,_0x11a78f,_0xb1e854){var _0x9f7df4,_0xdd3cdf,_0x432b09,_0x20ef89;_0xb1e854[_0xe07a('0x5f')]=intUtil[_0xe07a('0x60')](_0xb1e854['serverUrl']);_0xb1e854[_0xe07a('0x5b')]=intUtil[_0xe07a('0x60')](_0xb1e854[_0xe07a('0x5b')]);if(_0x11a78f&&_0x11a78f['monitor_format']){logger['info'](_0xe07a('0x61'),_0xe07a('0x62'));_0x878cef['recordingURL']=util[_0xe07a('0x48')](_0xe07a('0x63'),_0xb1e854[_0xe07a('0x5f')],_0x878cef[_0xe07a('0x64')],md5(_0x878cef[_0xe07a('0x64')]));}else{_0x878cef[_0xe07a('0x65')]='';}return getConnection(_0xb1e854)['then'](function(_0x16f904){_0x20ef89=_0x16f904;return getUser(_0xb1e854,_0x2a0f09[_0xe07a('0x66')],_0x20ef89);})[_0xe07a('0x28')](function(_0x1b26ef){_0x9f7df4=_0x1b26ef;return getEndUser(_0xb1e854,_0x459d86,_0x878cef[_0xe07a('0x67')],_0x878cef[_0xe07a('0x68')],_0x20ef89);})['then'](function(_0x7ffac2){_0xdd3cdf=_0x7ffac2;return getTicket(_0xb1e854,_0x9f7df4,_0xdd3cdf,_0x459d86,_0x878cef,_0x459d86[_0xe07a('0x69')],_0x20ef89,_0xe07a('0x6a'));})[_0xe07a('0x28')](function(_0x60201){_0x432b09=_0x60201;logger[_0xe07a('0x2a')](_0xe07a('0x6b'),_0x432b09['id']);logger[_0xe07a('0x2a')](_0xe07a('0x6c'),_0x432b09['id'],_0x2a0f09[_0xe07a('0x57')],_0xb1e854['type']);switch(_0xb1e854[_0xe07a('0x40')]){case'integrationTab':emit(util[_0xe07a('0x48')](_0xe07a('0x6d'),_0x2a0f09[_0xe07a('0x57')]),_0xe07a('0x6e'),{'recordId':_0x432b09['id']});break;case _0xe07a('0x6f'):emit(util[_0xe07a('0x48')](_0xe07a('0x6d'),_0x2a0f09[_0xe07a('0x57')]),_0xe07a('0x70'),{'uri':util[_0xe07a('0x48')](_0xe07a('0x71'),_0x20ef89[_0xe07a('0x72')],_0x432b09['id'])});break;default:logger[_0xe07a('0x73')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xe07a('0x74')](function(_0x3e23b4){logger[_0xe07a('0x73')](_0xe07a('0x61'),_0x3e23b4);});};exports[_0xe07a('0x75')]=function(_0x3bbe1d,_0x9909b0,_0x361c78,_0x4663d5,_0x466b56,_0x20ba05,_0x48db40){var _0x4c6896,_0x30e705,_0x59e3af,_0x1db4e6;_0x20ba05[_0xe07a('0x5f')]=intUtil[_0xe07a('0x60')](_0x20ba05[_0xe07a('0x5f')]);_0x20ba05['remoteUri']=intUtil[_0xe07a('0x60')](_0x20ba05[_0xe07a('0x5b')]);if(_0x48db40&&_0x48db40[_0xe07a('0x76')]&&_0x48db40['recordingFormat']!==_0xe07a('0x77')){logger['info'](_0xe07a('0x78'),_0xe07a('0x62'));_0x9909b0['recordingURL']=util[_0xe07a('0x48')](_0xe07a('0x63'),_0x20ba05['serverUrl'],_0x9909b0['uniqueid'],md5(_0x9909b0['uniqueid']));}return getConnection(_0x20ba05)[_0xe07a('0x28')](function(_0x20ea75){_0x1db4e6=_0x20ea75;return getUser(_0x20ba05,_0x4663d5[_0xe07a('0x66')],_0x1db4e6);})[_0xe07a('0x28')](function(_0x5bdfb0){_0x4c6896=_0x5bdfb0;return getEndUser(_0x20ba05,_0x361c78,_0x9909b0[_0xe07a('0x79')],_0x9909b0[_0xe07a('0x7a')],_0x1db4e6);})['then'](function(_0x30b262){_0x30e705=_0x30b262;return getTicket(_0x20ba05,_0x4c6896,_0x30e705,_0x361c78,_0x9909b0,_0x361c78[_0xe07a('0x69')],_0x1db4e6,'outbound');})[_0xe07a('0x28')](function(_0xa63e1b){_0x59e3af=_0xa63e1b;logger[_0xe07a('0x2a')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x59e3af['id']);logger[_0xe07a('0x2a')](_0xe07a('0x7b'),_0x59e3af['id'],_0x4663d5[_0xe07a('0x57')],_0x20ba05[_0xe07a('0x40')]);switch(_0x20ba05[_0xe07a('0x40')]){case'integrationTab':emit(util['format']('user:%s',_0x4663d5[_0xe07a('0x57')]),_0xe07a('0x6e'),{'recordId':_0x59e3af['id']});break;case'newTab':emit(util[_0xe07a('0x48')](_0xe07a('0x6d'),_0x4663d5[_0xe07a('0x57')]),_0xe07a('0x70'),{'uri':util[_0xe07a('0x48')](_0xe07a('0x71'),_0x1db4e6['instanceUrl'],_0x59e3af['id'])});break;default:logger[_0xe07a('0x73')](_0xe07a('0x78'),_0xe07a('0x7c'));}})[_0xe07a('0x74')](function(_0x5464b0){logger[_0xe07a('0x73')](_0xe07a('0x78'),_0x5464b0);});};exports[_0xe07a('0x7d')]=function(_0xacca23,_0x50c1d7,_0x296d55,_0x5a29d2,_0x3d1dd3,_0x44cb02){var _0x44ac11,_0x4a0867,_0x543aa9,_0x2f2fce;_0x44cb02[_0xe07a('0x5f')]=intUtil[_0xe07a('0x60')](_0x44cb02[_0xe07a('0x5f')]);_0x44cb02['remoteUri']=intUtil[_0xe07a('0x60')](_0x44cb02[_0xe07a('0x5b')]);if(_0x3d1dd3&&_0x3d1dd3[_0xe07a('0x7e')]){logger[_0xe07a('0x2a')]('['+_0x50c1d7[_0xe07a('0x7f')]['toUpperCase']()+']',_0xe07a('0x62'));_0x50c1d7[_0xe07a('0x65')]=util[_0xe07a('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44cb02[_0xe07a('0x5f')],_0x50c1d7[_0xe07a('0x64')],md5(_0x50c1d7['uniqueid']));}else{_0x50c1d7['recordingURL']='';}return getConnection(_0x44cb02)[_0xe07a('0x28')](function(_0xb967f){_0x2f2fce=_0xb967f;if(!_[_0xe07a('0x24')](_0x5a29d2)){return getUser(_0x44cb02,_0x5a29d2[_0xe07a('0x57')],_0x2f2fce);}else{return getUser(_0x44cb02,null,_0x2f2fce);}})[_0xe07a('0x28')](function(_0x14bf12){_0x44ac11=_0x14bf12;return getEndUser(_0x44cb02,_0x296d55,_0x50c1d7[_0xe07a('0x67')],_0x50c1d7[_0xe07a('0x68')],_0x2f2fce);})[_0xe07a('0x28')](function(_0x24198c){_0x4a0867=_0x24198c;return getTicket(_0x44cb02,_0x44ac11,_0x4a0867,_0x296d55,_0x50c1d7,_0x296d55[_0xe07a('0x69')],_0x2f2fce);})['then'](function(_0x2a6f9e){_0x543aa9=_0x2a6f9e;logger[_0xe07a('0x2a')]('['+_0x50c1d7[_0xe07a('0x7f')][_0xe07a('0x80')]()+_0xe07a('0x81'),_0x543aa9['id']);logger[_0xe07a('0x2a')]('['+_0x50c1d7[_0xe07a('0x7f')][_0xe07a('0x80')]()+']\x20Integration\x20account\x20type\x20%s.',_0x44cb02[_0xe07a('0x40')]);})['catch'](function(_0x4404bb){logger[_0xe07a('0x73')]('['+_0x50c1d7[_0xe07a('0x7f')]['toUpperCase']()+']',_0x4404bb);});}; \ No newline at end of file +var _0x13df=['error','outbound','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','md5','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','account','WhatId','Case','contact','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch'];(function(_0x437545,_0x4ab48b){var _0x408060=function(_0x564586){while(--_0x564586){_0x437545['push'](_0x437545['shift']());}};_0x408060(++_0x4ab48b);}(_0x13df,0x189));var _0xf13d=function(_0xc04b31,_0x762cf8){_0xc04b31=_0xc04b31-0x0;var _0x10a2d1=_0x13df[_0xc04b31];return _0x10a2d1;};'use strict';var _=require(_0xf13d('0x0'));var rp=require(_0xf13d('0x1'));var moment=require(_0xf13d('0x2'));var BPromise=require('bluebird');var md5=require(_0xf13d('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xf13d('0x4'));var logger=require(_0xf13d('0x5'))(_0xf13d('0x6'));config[_0xf13d('0x7')]=_['defaults'](config[_0xf13d('0x7')],{'host':_0xf13d('0x8'),'port':0x18eb});var io=require(_0xf13d('0x9'))(new Redis(config[_0xf13d('0x7')]));function emit(_0x33d413,_0x436e14,_0x1478c1){io['to'](_0x33d413)[_0xf13d('0xa')](_0x436e14,_0x1478c1);}function getTicket(_0x5f158a,_0x400d0f,_0x321d5d,_0x5df844,_0x2cc5ac,_0x57f096,_0x46a428,_0x20b19a){var _0x2dfd7d=Object[_0xf13d('0xb')]({},{'OwnerId':_0x400d0f['id'],'Subject':intUtil[_0xf13d('0xc')](_0x5df844['Subjects'],_0x2cc5ac,'\x20'),'Description':intUtil[_0xf13d('0xc')](_0x5df844['Descriptions'],_0x2cc5ac,'\x0a')},getCustomFields(_0x57f096,_0x2cc5ac));if(_0x321d5d){if(_0x5df844[_0xf13d('0xd')]===_0xf13d('0xe')){_0x2dfd7d[_0xf13d('0xf')]=moment['utc']();_0x2dfd7d[_0xf13d('0x10')]=![];_0x2dfd7d[_0xf13d('0x11')]=![];if(_0x321d5d[_0xf13d('0x12')]==='contact'||_0x321d5d[_0xf13d('0x12')]==='lead'){_0x2dfd7d['WhoId']=_0x321d5d['id'];}else if(_0x321d5d[_0xf13d('0x12')]===_0xf13d('0x13')){_0x2dfd7d[_0xf13d('0x14')]=_0x321d5d['id'];}}else if(_0x5df844[_0xf13d('0xd')]===_0xf13d('0x15')){if(_0x321d5d[_0xf13d('0x12')]===_0xf13d('0x16')){_0x2dfd7d[_0xf13d('0x17')]=_0x321d5d['id'];}else if(_0x321d5d[_0xf13d('0x12')]==='account'){_0x2dfd7d[_0xf13d('0x18')]=_0x321d5d['id'];}else if(_0x321d5d[_0xf13d('0x12')]===_0xf13d('0x19')&&_0x5df844[_0xf13d('0x1a')]){_0x2dfd7d[_0x5df844[_0xf13d('0x1a')]]=_0x321d5d['id'];}else{logger[_0xf13d('0x1b')](_0xf13d('0x1c'));}}}return _0x46a428[_0xf13d('0x1d')](_0x5df844['ticketType'])[_0xf13d('0x1e')](_0x2dfd7d);}function getUser(_0x176189,_0x433f4f,_0x17423a){if(!_[_0xf13d('0x1f')](_0x433f4f)&&intUtil[_0xf13d('0x20')](_0x433f4f)){var _0x4ba20e={'Email':_0x433f4f};var _0x1f2bb2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x17423a[_0xf13d('0x1d')]('User')[_0xf13d('0x21')](_0x4ba20e,_0x1f2bb2)[_0xf13d('0x22')]()[_0xf13d('0x23')](function(_0x332ab3){if(_0x332ab3['length']){var _0x200c1d=_['find'](_0x332ab3,function(_0x52993a){return _0x52993a['Email']===_0x433f4f;});if(_0x200c1d){logger['info'](_0xf13d('0x24'),_0x433f4f);return BPromise[_0xf13d('0x25')]({'id':_0x200c1d['Id'],'name':_0x200c1d[_0xf13d('0x26')]});}}else{logger['info'](_0xf13d('0x27'),_0x433f4f);return _0x17423a['identity']()['then'](function(_0x13661a){return BPromise[_0xf13d('0x25')]({'id':_0x13661a[_0xf13d('0x28')],'name':_0x13661a['display_name']});});}});}else{logger[_0xf13d('0x1b')](_0xf13d('0x27'),_0x433f4f);return _0x17423a[_0xf13d('0x29')]()[_0xf13d('0x23')](function(_0x421a70){return BPromise[_0xf13d('0x25')]({'id':_0x421a70['user_id'],'name':_0x421a70[_0xf13d('0x2a')]});});}}function getEndUser(_0x2024f2,_0x4520f2,_0x3e015d,_0x51a793,_0x47e349){var _0x5ae7f6={'$or':{'Phone':_0x51a793}};var _0x201fa4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf13d('0x25')]()[_0xf13d('0x23')](function(){logger['info'](_0xf13d('0x2b'),_0x51a793,_0x4520f2[_0xf13d('0x2c')]);switch(_0x4520f2[_0xf13d('0x2c')]){case _0xf13d('0x2d'):var _0x2b720c=_[_0xf13d('0x2e')](_0x5ae7f6);if(_0x4520f2['additionalSearchContact']){var _0xbb315={};_0xbb315[_0x4520f2[_0xf13d('0x2f')]]=_0x51a793;_[_0xf13d('0x30')](_0x2b720c[_0xf13d('0x31')],_0xbb315);}return _0x47e349[_0xf13d('0x1d')](_0xf13d('0x32'))[_0xf13d('0x21')](_0x2b720c,_0x201fa4)['execute']()[_0xf13d('0x23')](function(_0x4c2bc3){if(_0x4c2bc3&&_0x4c2bc3[_0xf13d('0x33')]){return _0x4c2bc3;}else{var _0x291ea3=_['cloneDeep'](_0x5ae7f6);if(_0x4520f2[_0xf13d('0x34')]){var _0x27ec90={};_0x27ec90[_0x4520f2[_0xf13d('0x34')]]=_0x51a793;_[_0xf13d('0x30')](_0x291ea3[_0xf13d('0x31')],_0x27ec90);}return _0x47e349[_0xf13d('0x1d')](_0xf13d('0x35'))[_0xf13d('0x21')](_0x291ea3,_0x201fa4);}});case _0xf13d('0x36'):var _0x3af84c=_[_0xf13d('0x2e')](_0x5ae7f6);if(_0x4520f2['additionalSearchAccount']){var _0xbb315={};_0xbb315[_0x4520f2[_0xf13d('0x37')]]=_0x51a793;_[_0xf13d('0x30')](_0x3af84c[_0xf13d('0x31')],_0xbb315);}return _0x47e349[_0xf13d('0x1d')](_0xf13d('0x38'))[_0xf13d('0x21')](_0x3af84c,_0x201fa4)[_0xf13d('0x22')]()[_0xf13d('0x23')](function(_0x30f022){if(_0x30f022&&_0x30f022['length']){return _0x30f022;}else{var _0x4f2fb0=_[_0xf13d('0x2e')](_0x5ae7f6);if(_0x4520f2['additionalSearchContact']){var _0x126304={};_0x126304[_0x4520f2['additionalSearchContact']]=_0x51a793;_[_0xf13d('0x30')](_0x4f2fb0['$or'],_0x126304);}return _0x47e349[_0xf13d('0x1d')]('Contact')[_0xf13d('0x21')](_0x4f2fb0,_0x201fa4)['then'](function(_0xba12cf){if(_0xba12cf&&_0xba12cf[_0xf13d('0x33')]){return _0xba12cf;}else{var _0x3597e4=_[_0xf13d('0x2e')](_0x5ae7f6);if(_0x4520f2[_0xf13d('0x34')]){var _0x1ddae1={};_0x1ddae1[_0x4520f2[_0xf13d('0x34')]]=_0x51a793;_[_0xf13d('0x30')](_0x3597e4['$or'],_0x1ddae1);}return _0x47e349[_0xf13d('0x1d')]('Lead')[_0xf13d('0x21')](_0x3597e4,_0x201fa4);}});}});case _0xf13d('0x16'):var _0x2b720c=_['cloneDeep'](_0x5ae7f6);if(_0x4520f2[_0xf13d('0x2f')]){var _0xbb315={};_0xbb315[_0x4520f2[_0xf13d('0x2f')]]=_0x51a793;_[_0xf13d('0x30')](_0x2b720c['$or'],_0xbb315);}return _0x47e349[_0xf13d('0x1d')]('Contact')[_0xf13d('0x21')](_0x2b720c,_0x201fa4)[_0xf13d('0x22')]();case _0xf13d('0x19'):var _0x526a3b=_[_0xf13d('0x2e')](_0x5ae7f6);if(_0x4520f2[_0xf13d('0x34')]){var _0xbb315={};_0xbb315[_0x4520f2[_0xf13d('0x34')]]=_0x51a793;_[_0xf13d('0x30')](_0x526a3b[_0xf13d('0x31')],_0xbb315);}return _0x47e349[_0xf13d('0x1d')](_0xf13d('0x35'))[_0xf13d('0x21')](_0x526a3b,_0x201fa4);case'account':var _0x3af84c=_[_0xf13d('0x2e')](_0x5ae7f6);if(_0x4520f2[_0xf13d('0x37')]){var _0xbb315={};_0xbb315[_0x4520f2[_0xf13d('0x37')]]=_0x51a793;_[_0xf13d('0x30')](_0x3af84c[_0xf13d('0x31')],_0xbb315);}return _0x47e349[_0xf13d('0x1d')]('Account')[_0xf13d('0x21')](_0x3af84c,_0x201fa4);default:return null;}})['then'](function(_0x20bb6b){if(_0x20bb6b&&_0x20bb6b[_0xf13d('0x33')]){var _0x514e2b=_['first'](_0x20bb6b);if(_0x514e2b){return BPromise[_0xf13d('0x25')]({'id':_0x514e2b['Id'],'name':_0x514e2b[_0xf13d('0x26')],'phone':_0x514e2b[_0xf13d('0x39')],'endUserType':_0x514e2b[_0xf13d('0x3a')][_0xf13d('0x3b')]['toLowerCase']()});}}})[_0xf13d('0x23')](function(_0x5a040f){if(_0x5a040f){logger[_0xf13d('0x1b')](_0xf13d('0x3c'),_0x5a040f[_0xf13d('0x12')],_0x51a793);return BPromise[_0xf13d('0x25')](_0x5a040f);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x51a793);var _0x34a0bc={'Phone':_0x51a793};if(_0x4520f2[_0xf13d('0x3d')]){if(_0x4520f2[_0xf13d('0x3d')]==='contact'){logger[_0xf13d('0x1b')](_0xf13d('0x3e'),_0x51a793,_0x4520f2['moduleCreate']);_0x34a0bc[_0xf13d('0x3f')]=_0x3e015d!==_0xf13d('0x40')?_0x3e015d:util[_0xf13d('0x41')](_0xf13d('0x42'),_0x51a793);}else if(_0x4520f2['moduleCreate']==='lead'){logger[_0xf13d('0x1b')](_0xf13d('0x3e'),_0x51a793,_0x4520f2[_0xf13d('0x3d')]);_0x34a0bc['LastName']=_0x3e015d!==''?_0x3e015d:util[_0xf13d('0x41')](_0xf13d('0x42'),_0x51a793);_0x34a0bc[_0xf13d('0x43')]=_0xf13d('0x44');}else if(_0x4520f2[_0xf13d('0x3d')]===_0xf13d('0x13')){logger[_0xf13d('0x1b')](_0xf13d('0x3e'),_0x51a793,_0x4520f2[_0xf13d('0x3d')]);_0x34a0bc[_0xf13d('0x26')]=_0x3e015d!==_0xf13d('0x40')?_0x3e015d:util[_0xf13d('0x41')](_0xf13d('0x42'),_0x51a793);}else{return null;}}return _0x47e349[_0xf13d('0x1d')](_[_0xf13d('0x45')](_0x4520f2[_0xf13d('0x3d')]))['create'](_0x34a0bc)[_0xf13d('0x23')](function(_0x4bef14){return BPromise['resolve']({'id':_0x4bef14['id'],'endUserType':_0x4520f2[_0xf13d('0x3d')]});});}});}function getCustomFields(_0x10abf7,_0x246e42){var _0xc0ddf5={};if(_0x10abf7[_0xf13d('0x33')]>0x0){_[_0xf13d('0x46')](_0x10abf7,function(_0x107ab2){if(_[_0xf13d('0x47')]([_0xf13d('0x48'),_0xf13d('0x49')],_0x107ab2['type'])&&_0x107ab2[_0xf13d('0x4a')]){_0xc0ddf5[_0x107ab2[_0xf13d('0x4a')]]=_0x107ab2[_0xf13d('0x4b')][_0xf13d('0x4c')]();}else if(_0x107ab2[_0xf13d('0x3b')]===_0xf13d('0x4d')&&_0x107ab2[_0xf13d('0x4e')]&&_0x107ab2[_0xf13d('0x4a')]){_0x246e42[_0x107ab2[_0xf13d('0x4e')]]&&(_0xc0ddf5[_0x107ab2[_0xf13d('0x4a')]]=_0x246e42[_0x107ab2[_0xf13d('0x4e')]][_0xf13d('0x4c')]());}else if(_0x107ab2[_0xf13d('0x3b')]===_0xf13d('0x4f')&&_0x107ab2['Variable']&&_0x107ab2[_0xf13d('0x50')][_0xf13d('0x51')]&&_0x107ab2[_0xf13d('0x4a')]){_0x246e42[_0x107ab2['Variable'][_0xf13d('0x51')][_0xf13d('0x52')]()]&&(_0xc0ddf5[_0x107ab2[_0xf13d('0x4a')]]=_0x246e42[_0x107ab2[_0xf13d('0x50')][_0xf13d('0x51')][_0xf13d('0x52')]()]['toString']());}});}return _0xc0ddf5;}function getConnection(_0x2335c3){var _0x27dd4b=_0x2335c3[_0xf13d('0x53')][_0xf13d('0x54')](_0x2335c3[_0xf13d('0x55')]);var _0x3ff277=new jsforce[(_0xf13d('0x56'))]({'oauth2':{'loginUrl':_0x2335c3[_0xf13d('0x57')]||_0xf13d('0x58'),'clientId':_0x2335c3[_0xf13d('0x59')],'clientSecret':_0x2335c3['clientSecret']}});return _0x3ff277['login'](_0x2335c3[_0xf13d('0x5a')],_0x27dd4b)[_0xf13d('0x23')](function(){logger[_0xf13d('0x1b')](_0xf13d('0x5b'));return _0x3ff277;});}exports['queue']=function(_0x1d928b,_0x2fec69,_0x386b30,_0x1349bc,_0x324004,_0x15d05f){var _0xc7a33d,_0x2576d1,_0xedbd13,_0x17d0cd;_0x15d05f[_0xf13d('0x5c')]=intUtil[_0xf13d('0x5d')](_0x15d05f[_0xf13d('0x5c')]);_0x15d05f[_0xf13d('0x57')]=intUtil[_0xf13d('0x5d')](_0x15d05f[_0xf13d('0x57')]);if(_0x324004&&_0x324004[_0xf13d('0x5e')]){logger[_0xf13d('0x1b')](_0xf13d('0x5f'),_0xf13d('0x60'));_0x2fec69['recordingURL']=util[_0xf13d('0x41')](_0xf13d('0x61'),_0x15d05f[_0xf13d('0x5c')],_0x2fec69[_0xf13d('0x62')],md5(_0x2fec69['uniqueid']));}else{_0x2fec69[_0xf13d('0x63')]='';}return getConnection(_0x15d05f)[_0xf13d('0x23')](function(_0xfc03f5){_0x17d0cd=_0xfc03f5;return getUser(_0x15d05f,_0x1349bc[_0xf13d('0x64')],_0x17d0cd);})['then'](function(_0x2cffeb){_0xc7a33d=_0x2cffeb;return getEndUser(_0x15d05f,_0x386b30,_0x2fec69[_0xf13d('0x65')],_0x2fec69['calleridnum'],_0x17d0cd);})['then'](function(_0x15567a){_0x2576d1=_0x15567a;return getTicket(_0x15d05f,_0xc7a33d,_0x2576d1,_0x386b30,_0x2fec69,_0x386b30[_0xf13d('0x66')],_0x17d0cd,_0xf13d('0x67'));})[_0xf13d('0x23')](function(_0x50f313){_0xedbd13=_0x50f313;logger[_0xf13d('0x1b')](_0xf13d('0x68'),_0xedbd13['id']);logger[_0xf13d('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xedbd13['id'],_0x1349bc[_0xf13d('0x51')],_0x15d05f[_0xf13d('0x3b')]);switch(_0x15d05f[_0xf13d('0x3b')]){case'integrationTab':emit(util['format'](_0xf13d('0x69'),_0x1349bc['name']),'trigger:salesforce:display',{'recordId':_0xedbd13['id']});break;case _0xf13d('0x6a'):emit(util[_0xf13d('0x41')](_0xf13d('0x69'),_0x1349bc['name']),_0xf13d('0x6b'),{'uri':util[_0xf13d('0x41')](_0xf13d('0x6c'),_0x17d0cd[_0xf13d('0x6d')],_0xedbd13['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xf13d('0x6e')](function(_0x4be8a5){logger[_0xf13d('0x6f')](_0xf13d('0x5f'),_0x4be8a5);});};exports[_0xf13d('0x70')]=function(_0x450a46,_0x392534,_0x5ec861,_0x51ec84,_0x5cc5a0,_0x1dd526,_0x22d70b){var _0x8f277e,_0x715f0a,_0xfabe23,_0x5d5b28;_0x1dd526[_0xf13d('0x5c')]=intUtil[_0xf13d('0x5d')](_0x1dd526[_0xf13d('0x5c')]);_0x1dd526[_0xf13d('0x57')]=intUtil['stripTrailingSlash'](_0x1dd526[_0xf13d('0x57')]);if(_0x22d70b&&_0x22d70b[_0xf13d('0x71')]&&_0x22d70b[_0xf13d('0x71')]!==_0xf13d('0x72')){logger[_0xf13d('0x1b')](_0xf13d('0x73'),_0xf13d('0x60'));_0x392534[_0xf13d('0x63')]=util[_0xf13d('0x41')](_0xf13d('0x61'),_0x1dd526[_0xf13d('0x5c')],_0x392534['uniqueid'],md5(_0x392534[_0xf13d('0x62')]));}return getConnection(_0x1dd526)['then'](function(_0x1a62c9){_0x5d5b28=_0x1a62c9;return getUser(_0x1dd526,_0x51ec84['email'],_0x5d5b28);})[_0xf13d('0x23')](function(_0x5503cf){_0x8f277e=_0x5503cf;return getEndUser(_0x1dd526,_0x5ec861,_0x392534['destcalleridname'],_0x392534['destcalleridnum'],_0x5d5b28);})[_0xf13d('0x23')](function(_0x200043){_0x715f0a=_0x200043;return getTicket(_0x1dd526,_0x8f277e,_0x715f0a,_0x5ec861,_0x392534,_0x5ec861[_0xf13d('0x66')],_0x5d5b28,_0xf13d('0x70'));})[_0xf13d('0x23')](function(_0x4440a4){_0xfabe23=_0x4440a4;logger[_0xf13d('0x1b')](_0xf13d('0x74'),_0xfabe23['id']);logger[_0xf13d('0x1b')](_0xf13d('0x75'),_0xfabe23['id'],_0x51ec84[_0xf13d('0x51')],_0x1dd526[_0xf13d('0x3b')]);switch(_0x1dd526[_0xf13d('0x3b')]){case _0xf13d('0x76'):emit(util['format'](_0xf13d('0x69'),_0x51ec84[_0xf13d('0x51')]),_0xf13d('0x77'),{'recordId':_0xfabe23['id']});break;case'newTab':emit(util[_0xf13d('0x41')](_0xf13d('0x69'),_0x51ec84[_0xf13d('0x51')]),_0xf13d('0x6b'),{'uri':util[_0xf13d('0x41')](_0xf13d('0x6c'),_0x5d5b28[_0xf13d('0x6d')],_0xfabe23['id'])});break;default:logger[_0xf13d('0x6f')]('[OUTBOUND]',_0xf13d('0x78'));}})[_0xf13d('0x6e')](function(_0x1b6aaa){logger['error']('[OUTBOUND]',_0x1b6aaa);});};exports[_0xf13d('0x79')]=function(_0x4874b2,_0x229005,_0x9063a8,_0x5f1f13,_0x585bdd,_0x1b4187){var _0x2d2c6a,_0x1b9a92,_0x269dfa,_0x4dff75;_0x1b4187[_0xf13d('0x5c')]=intUtil[_0xf13d('0x5d')](_0x1b4187[_0xf13d('0x5c')]);_0x1b4187[_0xf13d('0x57')]=intUtil[_0xf13d('0x5d')](_0x1b4187[_0xf13d('0x57')]);if(_0x585bdd&&_0x585bdd[_0xf13d('0x5e')]){logger[_0xf13d('0x1b')]('['+_0x229005['lastevent'][_0xf13d('0x7a')]()+']',_0xf13d('0x60'));_0x229005[_0xf13d('0x63')]=util[_0xf13d('0x41')](_0xf13d('0x61'),_0x1b4187['serverUrl'],_0x229005[_0xf13d('0x62')],md5(_0x229005[_0xf13d('0x62')]));}else{_0x229005[_0xf13d('0x63')]='';}return getConnection(_0x1b4187)['then'](function(_0x4a5803){_0x4dff75=_0x4a5803;if(!_['isNil'](_0x5f1f13)){return getUser(_0x1b4187,_0x5f1f13[_0xf13d('0x51')],_0x4dff75);}else{return getUser(_0x1b4187,null,_0x4dff75);}})['then'](function(_0x18be3a){_0x2d2c6a=_0x18be3a;return getEndUser(_0x1b4187,_0x9063a8,_0x229005[_0xf13d('0x65')],_0x229005[_0xf13d('0x7b')],_0x4dff75);})[_0xf13d('0x23')](function(_0x22e3e9){_0x1b9a92=_0x22e3e9;return getTicket(_0x1b4187,_0x2d2c6a,_0x1b9a92,_0x9063a8,_0x229005,_0x9063a8[_0xf13d('0x66')],_0x4dff75);})['then'](function(_0x346e5d){_0x269dfa=_0x346e5d;logger[_0xf13d('0x1b')]('['+_0x229005[_0xf13d('0x7c')]['toUpperCase']()+_0xf13d('0x7d'),_0x269dfa['id']);logger['info']('['+_0x229005[_0xf13d('0x7c')][_0xf13d('0x7a')]()+']\x20Integration\x20account\x20type\x20%s.',_0x1b4187['type']);})[_0xf13d('0x6e')](function(_0x537812){logger['error']('['+_0x229005['lastevent'][_0xf13d('0x7a')]()+']',_0x537812);});}; \ 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 777d95a..ca692b3 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 _0xee32=['servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','customField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','format','email','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger'];(function(_0x3f525b,_0xff7bc2){var _0x22b854=function(_0x16cd32){while(--_0x16cd32){_0x3f525b['push'](_0x3f525b['shift']());}};_0x22b854(++_0xff7bc2);}(_0xee32,0x64));var _0x2ee3=function(_0xd62831,_0xac4714){_0xd62831=_0xd62831-0x0;var _0x45489c=_0xee32[_0xd62831];return _0x45489c;};'use strict';var _=require(_0x2ee3('0x0'));var Promise=require('bluebird');var rp=require(_0x2ee3('0x1'));var util=require(_0x2ee3('0x2'));var md5=require(_0x2ee3('0x3'));var Redis=require(_0x2ee3('0x4'));var intUtil=require(_0x2ee3('0x5'));var config=require(_0x2ee3('0x6'));var logger=require(_0x2ee3('0x7'))(_0x2ee3('0x8'));config[_0x2ee3('0x9')]=_[_0x2ee3('0xa')](config[_0x2ee3('0x9')],{'host':_0x2ee3('0xb'),'port':0x18eb});var io=require(_0x2ee3('0xc'))(new Redis(config[_0x2ee3('0x9')]));function getAdminUser(_0x2eee62,_0x140fdb,_0x5d7958,_0xbf27d9,_0x30bb2e,_0x27b3a2){return new Promise(function(_0xc0be59,_0x494a38){var _0x259c51={'method':_0x2ee3('0xd'),'uri':_0xbf27d9+_0x2ee3('0xe')+'&'+_0x30bb2e+'&'+_0x27b3a2,'auth':_0x140fdb,'json':!![]};return rp(_0x259c51)[_0x2ee3('0xf')](function(_0x1da49d){if(_0x1da49d[_0x2ee3('0x10')][_0x2ee3('0x11')]>0x0){_0x5d7958[_0x2ee3('0x12')]=_0x1da49d[_0x2ee3('0x10')][0x0]['sys_id'];}logger[_0x2ee3('0x13')]('['+[_0x2eee62['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x5d7958);_0xc0be59(_0x5d7958);})[_0x2ee3('0x14')](function(_0x211097){logger[_0x2ee3('0x15')]('['+[_0x2eee62['toUpperCase']()]+']',_0x211097[_0x2ee3('0x16')]);_0x494a38(_0x211097[_0x2ee3('0x16')]);});});}function getUser(_0x256df0,_0x43ed2c,_0x15d16d,_0x3d8510,_0x93c3f7){return function(_0x16862a){logger[_0x2ee3('0x13')]('['+[_0x256df0[_0x2ee3('0x17')]()]+_0x2ee3('0x18'),_0x16862a);return new Promise(function(_0x5882a9,_0x34524d){if(intUtil['validateEmail'](_0x16862a[_0x2ee3('0x19')])){var _0x1462ae={'method':_0x2ee3('0xd'),'uri':_0x15d16d+_0x2ee3('0x1a')+_0x16862a['userEmail']+'&'+_0x3d8510+'&'+_0x93c3f7,'auth':_0x43ed2c,'json':!![]};logger[_0x2ee3('0x13')]('['+[_0x256df0[_0x2ee3('0x17')]()]+_0x2ee3('0x1b'),_0x1462ae);return rp(_0x1462ae)[_0x2ee3('0xf')](function(_0x30b53c){logger[_0x2ee3('0x13')]('['+[_0x256df0[_0x2ee3('0x17')]()]+_0x2ee3('0x1c'),_0x30b53c);if(_0x30b53c[_0x2ee3('0x10')]['length']>0x0&&String(_0x30b53c['result'][0x0][_0x2ee3('0x1d')])===_0x2ee3('0x1e')){_0x16862a[_0x2ee3('0x1f')]=_0x30b53c['result'][0x0][_0x2ee3('0x20')];}else{_0x16862a[_0x2ee3('0x1f')]=_0x16862a[_0x2ee3('0x12')];_0x16862a[_0x2ee3('0x19')]=_0x16862a[_0x2ee3('0x21')];}logger['info']('['+[_0x256df0[_0x2ee3('0x17')]()]+'],\x20getUser\x20crm',_0x16862a);_0x5882a9(_0x16862a);})[_0x2ee3('0x14')](function(_0x428578){logger[_0x2ee3('0x15')]('['+[_0x256df0[_0x2ee3('0x17')]()]+']',_0x428578['message']);_0x34524d(_0x428578['message']);});}else{logger['info']('['+[_0x256df0[_0x2ee3('0x17')]()]+_0x2ee3('0x22'));_0x16862a['userId']=_0x16862a['adminId'];_0x16862a[_0x2ee3('0x19')]=_0x16862a[_0x2ee3('0x21')];_0x5882a9(_0x16862a);}});};}function createEndUser(_0x32b26f,_0x49ae21,_0x144fdc,_0x3f89be,_0x10587c){logger['info']('['+[_0x32b26f['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x144fdc);return new Promise(function(_0x35ec0f,_0x46be99){var _0x1ff11e={'method':_0x2ee3('0x23'),'uri':_0x3f89be+_0x2ee3('0x24')+_0x10587c,'body':{'user_name':_0x144fdc['endUserNumber'],'roles':'user','first_name':_0x144fdc[_0x2ee3('0x25')],'active':'true','date_format':_0x2ee3('0x26'),'phone':_0x144fdc['endUserNumber']},'auth':_0x49ae21,'json':!![]};return rp(_0x1ff11e)[_0x2ee3('0xf')](function(_0x31a1ec){logger[_0x2ee3('0x13')]('['+[_0x32b26f[_0x2ee3('0x17')]()]+'],\x20EndUser\x20schema',_0x31a1ec[_0x2ee3('0x10')]);_0x144fdc['endUserId']=_0x31a1ec['result'][_0x2ee3('0x20')];_0x35ec0f(_0x144fdc);})[_0x2ee3('0x14')](function(_0x494db5){logger[_0x2ee3('0x15')]('['+[_0x32b26f[_0x2ee3('0x17')]()]+']',_0x494db5[_0x2ee3('0x16')]);_0x46be99(_0x494db5['message']);});});}function getEndUser(_0x24e835,_0x133414,_0x47703c,_0x138106,_0x30380b){return function(_0x22a8a7){logger['info']('['+[_0x24e835['toUpperCase']()]+_0x2ee3('0x27'),_0x22a8a7);return new Promise(function(_0x2f34e2,_0x31e433){var _0x4dc3f3={'method':_0x2ee3('0xd'),'uri':_0x47703c+_0x2ee3('0x28')+_0x22a8a7['endUserNumber']+'&'+_0x138106+'&'+_0x30380b,'auth':_0x133414,'json':!![]};return rp(_0x4dc3f3)[_0x2ee3('0xf')](function(_0x32e299){if(_0x32e299[_0x2ee3('0x10')][_0x2ee3('0x11')]>0x0){_0x22a8a7[_0x2ee3('0x29')]=_0x32e299[_0x2ee3('0x10')][0x0]['sys_id'];logger[_0x2ee3('0x13')]('['+[_0x24e835[_0x2ee3('0x17')]()]+'],\x20getEndUser\x20crm',_0x22a8a7);_0x2f34e2(_0x22a8a7);}else{return createEndUser(_0x24e835,_0x133414,_0x22a8a7,_0x47703c,_0x138106)['then'](function(_0x3f67bf){logger[_0x2ee3('0x13')]('['+[_0x24e835[_0x2ee3('0x17')]()]+_0x2ee3('0x2a'),_0x3f67bf);_0x2f34e2(_0x3f67bf);});}})['catch'](function(_0x82c345){logger['error']('['+[_0x24e835['toUpperCase']()]+']',_0x82c345[_0x2ee3('0x16')]);_0x31e433(_0x82c345['message']);});});};}function getCustomFields(_0x4bd760,_0x893ffd){var _0xe5bbf7={};if(_0x4bd760[_0x2ee3('0x11')]>0x0){_[_0x2ee3('0x2b')](_0x4bd760,function(_0x18a558){if(_[_0x2ee3('0x2c')]([_0x2ee3('0x2d'),_0x2ee3('0x2e')],_0x18a558['type'])&&_0x18a558[_0x2ee3('0x2f')]&&!_0x18a558['customField']){_0xe5bbf7[_0x18a558[_0x2ee3('0x2f')][_0x2ee3('0x30')]()]=_0x18a558[_0x2ee3('0x31')][_0x2ee3('0x32')]();}else if(_['includes']([_0x2ee3('0x2d'),_0x2ee3('0x2e')],_0x18a558[_0x2ee3('0x33')])&&_0x18a558[_0x2ee3('0x34')]&&_0x18a558[_0x2ee3('0x35')]){_0xe5bbf7[_0x18a558[_0x2ee3('0x34')][_0x2ee3('0x30')]()]=_0x18a558[_0x2ee3('0x31')]['toString']();}else if(_0x18a558['type']===_0x2ee3('0x36')&&_0x18a558['variableName']&&_0x18a558[_0x2ee3('0x34')]&&_0x18a558['customField']){_0xe5bbf7[_0x18a558[_0x2ee3('0x34')][_0x2ee3('0x30')]()]=_0x893ffd[_0x18a558[_0x2ee3('0x37')]][_0x2ee3('0x32')]();}else if(_0x18a558['type']===_0x2ee3('0x38')&&_0x18a558[_0x2ee3('0x39')]&&_0x18a558['Variable'][_0x2ee3('0x3a')]&&_0x18a558[_0x2ee3('0x34')]&&_0x18a558['customField']){_0xe5bbf7[_0x18a558[_0x2ee3('0x34')][_0x2ee3('0x30')]()]=_0x893ffd[_0x18a558['Variable']['name'][_0x2ee3('0x30')]()]['toString']();}});}return _0xe5bbf7;}function getTicket(_0x10515a,_0x173d4e,_0x5620ce,_0x4ed639,_0x393072,_0xc55150){return function(_0x3e902e){logger[_0x2ee3('0x13')]('['+[_0x10515a['toUpperCase']()]+_0x2ee3('0x3b'),_0x3e902e);return new Promise(function(_0x5e64ac,_0x2bd77a){var _0x4f9b75=_0x10515a[_0x2ee3('0x30')]()===_0x2ee3('0x3c')?_0x3e902e[_0x2ee3('0x1f')]:_0x3e902e['endUserId'];var _0x15fe77={'method':'POST','uri':_0x5620ce+_0x2ee3('0x3d')+'?'+_0xc55150,'body':Object[_0x2ee3('0x3e')]({},{'active':_0x2ee3('0x1e'),'caller_id':_0x4f9b75,'assigned_to':_0x3e902e[_0x2ee3('0x1f')],'short_description':intUtil[_0x2ee3('0x3f')](_0x4ed639[_0x2ee3('0x40')],_0x393072,'\x20'),'description':intUtil['getString'](_0x4ed639[_0x2ee3('0x41')],_0x393072,'\x0a')},getCustomFields(_0x4ed639[_0x2ee3('0x42')],_0x393072)),'auth':_0x173d4e,'json':!![]};return rp(_0x15fe77)[_0x2ee3('0xf')](function(_0x21dc6c){logger[_0x2ee3('0x13')]('['+[_0x10515a[_0x2ee3('0x17')]()]+_0x2ee3('0x43'),_0x21dc6c[_0x2ee3('0x10')]);_0x3e902e[_0x2ee3('0x44')]=_0x21dc6c[_0x2ee3('0x10')][_0x2ee3('0x20')];_0x3e902e['ticketNumber']=_0x21dc6c[_0x2ee3('0x10')]['number'];logger['info']('['+[_0x10515a[_0x2ee3('0x17')]()]+']\x20getTicket\x20crm',_0x3e902e);_0x5e64ac(_0x3e902e);})[_0x2ee3('0x14')](function(_0x1e493c){logger[_0x2ee3('0x15')]('['+[_0x10515a[_0x2ee3('0x17')]()]+']',_0x1e493c['message']);_0x2bd77a(_0x1e493c[_0x2ee3('0x16')]);});});};}function createRemoteTag(_0x5bab06,_0xfd3641,_0xf92e7f,_0x32db51){return new Promise(function(_0x37046e,_0x2535a3){var _0x509431={'method':_0x2ee3('0x23'),'uri':_0xf92e7f+_0x2ee3('0x45')+'?'+_0x32db51,'body':{'short_description':_0x5bab06,'global':!![],'active':!![],'name':_0x5bab06},'auth':_0xfd3641,'json':!![]};return rp(_0x509431)[_0x2ee3('0xf')](function(_0x4917c0){var _0x5d4973=_0x4917c0['result'][_0x2ee3('0x20')];_0x37046e(_0x5d4973);});});}function getRemoteTag(_0x414d2d,_0x23827e,_0x473a32,_0xca69e4,_0x2f4251){return new Promise(function(_0x925158,_0x376672){var _0x177ffc={'method':'GET','uri':_0x473a32+_0x2ee3('0x45')+'?sysparm_query=name%3D'+_0x414d2d+'&'+_0xca69e4,'auth':_0x23827e,'json':!![]};return rp(_0x177ffc)['then'](function(_0x3ee88a){if(_0x3ee88a['result'][_0x2ee3('0x11')]>0x0){var _0x489c6a=_0x3ee88a[_0x2ee3('0x10')][0x0][_0x2ee3('0x20')];_0x925158(_0x489c6a);}else{return createRemoteTag(_0x414d2d,_0x23827e,_0x473a32,_0xca69e4)[_0x2ee3('0xf')](function(_0x5eec99){_0x925158(_0x5eec99);});}});});}function assignTagToIncident(_0x29b006,_0x372765,_0x1a3d14,_0x43f620,_0x2740ad){return new Promise(function(_0x5302ef,_0x17256e){var _0x3feea3={'method':_0x2ee3('0x23'),'uri':_0x1a3d14+_0x2ee3('0x46')+'?'+_0x2740ad,'body':{'label':_0x29b006,'table':_0x2ee3('0x3d'),'id_type':_0x2ee3('0x47'),'table_key':_0x43f620[_0x2ee3('0x44')],'title':_0x2ee3('0x48')+_0x43f620[_0x2ee3('0x49')],'id_display':_0x43f620['ticketNumber']},'auth':_0x372765,'json':!![]};return rp(_0x3feea3)[_0x2ee3('0xf')](function(_0x294332){_0x5302ef();})[_0x2ee3('0x14')](function(){_0x5302ef();});});}function manageTags(_0x56ebd0,_0x19691c,_0x329b0b,_0x51e1aa,_0x583f6f,_0x254b9b,_0x724063){return new Promise(function(_0x362b7d,_0x5b70f2){var _0x815de2=[];_0x19691c[_0x2ee3('0x2b')](function(_0x399f26){_0x815de2[_0x2ee3('0x4a')](getRemoteTag(_0x399f26,_0x329b0b,_0x51e1aa,_0x254b9b,_0x724063));});return Promise[_0x2ee3('0x4b')](_0x815de2)[_0x2ee3('0xf')](function(_0x43d11c){if(_0x43d11c[_0x2ee3('0x11')]){logger[_0x2ee3('0x13')]('['+[_0x56ebd0[_0x2ee3('0x17')]()]+_0x2ee3('0x4c'),_0x43d11c);var _0x18ee01=[];_0x43d11c[_0x2ee3('0x2b')](function(_0x511ae1){_0x18ee01[_0x2ee3('0x4a')](assignTagToIncident(_0x511ae1,_0x329b0b,_0x51e1aa,_0x583f6f,_0x254b9b));});return Promise[_0x2ee3('0x4b')](_0x18ee01)[_0x2ee3('0xf')](function(){_0x362b7d();})[_0x2ee3('0x14')](function(){_0x362b7d();});}else{_0x362b7d();}});});}function getTags(_0x40ef64,_0x73d49d,_0x832588,_0x4df0ef,_0x4550b0,_0xeb3c2a){return function(_0x4f06d9){return new Promise(function(_0x4c2e05,_0x59995e){var _0x43ac4c=[];var _0x4b16a0=_0x4df0ef[_0x2ee3('0x4d')];if(_0x4b16a0&&_0x4b16a0[_0x2ee3('0x11')]>0x0){_0x43ac4c=_['map'](_0x4b16a0,_0x2ee3('0x3a'));}if(_0x43ac4c[_0x2ee3('0x11')]>0x0){return manageTags(_0x40ef64,_0x43ac4c,_0x73d49d,_0x832588,_0x4f06d9,_0x4550b0,_0xeb3c2a)[_0x2ee3('0xf')](function(){_0x4c2e05(_0x4f06d9);});}else{_0x4c2e05(_0x4f06d9);}});};}function emit(_0x497f3d,_0x373a18,_0x567040){var _0x5ab54f=_0x2ee3('0x4e')+_0x2ee3('0x4f')+_0x2ee3('0x50')+'%255EORDERBYDESCnumber';var _0x4ac134={'uri':_0x497f3d+_0x2ee3('0x51')+_0x567040+_0x5ab54f};io['to'](util['format'](_0x2ee3('0x52'),_0x373a18))[_0x2ee3('0x53')]('trigger:browser:url',_0x4ac134);}exports['cs']=function(_0x9e592a,_0x5cba45,_0x811bb2,_0x3a3753,_0x50fd5b,_0x1087cb,_0x2d6c19,_0xc649b8){var _0x46a730={};var _0x25434e={'user':_0x1087cb['username'],'pass':_0x1087cb[_0x2ee3('0x54')]};var _0x5899be=_0x2ee3('0x55');var _0x5d7f2b=_0x2ee3('0x56');_0x1087cb['remoteUri']=intUtil[_0x2ee3('0x57')](_0x1087cb[_0x2ee3('0x58')]);_0x1087cb[_0x2ee3('0x59')]=intUtil[_0x2ee3('0x57')](_0x1087cb[_0x2ee3('0x59')]);var _0x2b6eaf=util[_0x2ee3('0x5a')]('%s/api/now/table/',_0x1087cb['remoteUri']);_0x46a730['userEmail']=!_['isNil'](_0x3a3753)?_0x3a3753[_0x2ee3('0x5b')]:null;_0x46a730[_0x2ee3('0x21')]=_0x1087cb[_0x2ee3('0x5b')];_0x46a730[_0x2ee3('0x25')]=_0xc649b8[_0x2ee3('0x30')]()===_0x2ee3('0x3c')?_0x5cba45[_0x2ee3('0x5c')]:_0x5cba45[_0x2ee3('0x5d')];_0x46a730[_0x2ee3('0x5e')]=_0xc649b8===_0x2ee3('0x5f')||_0xc649b8==='unmanaged'?_0x2ee3('0x5f'):_0x2ee3('0x3c');var _0x3849ce=util[_0x2ee3('0x5a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1087cb[_0x2ee3('0x59')],_0x5cba45[_0x2ee3('0x60')],md5(_0x5cba45[_0x2ee3('0x60')]));if(_0x50fd5b&&_0x50fd5b[_0x2ee3('0x61')]){logger[_0x2ee3('0x13')](_0x2ee3('0x62'),'Recording\x20is\x20enabled!');_0x5cba45[_0x2ee3('0x63')]=_0x3849ce;}else if(_0x2d6c19&&_0x2d6c19['recordingFormat']&&_0x2d6c19[_0x2ee3('0x64')]!==_0x2ee3('0x65')){logger[_0x2ee3('0x13')](_0x2ee3('0x66'),_0x2ee3('0x67'));_0x5cba45['recordingURL']=_0x3849ce;}else{_0x5cba45['recordingURL']='';}return getAdminUser(_0xc649b8,_0x25434e,_0x46a730,_0x2b6eaf,_0x5d7f2b,_0x5899be)[_0x2ee3('0xf')](getUser(_0xc649b8,_0x25434e,_0x2b6eaf,_0x5d7f2b,_0x5899be))[_0x2ee3('0xf')](getEndUser(_0xc649b8,_0x25434e,_0x2b6eaf,_0x5d7f2b,_0x5899be))[_0x2ee3('0xf')](getTicket(_0xc649b8,_0x25434e,_0x2b6eaf,_0x811bb2,_0x5cba45,_0x5d7f2b))['then'](function(_0x3ca70e){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3ca70e[_0x2ee3('0x44')]));logger['info'](util[_0x2ee3('0x5a')](_0x2ee3('0x68'),_0xc649b8));if(_0xc649b8!==_0x2ee3('0x69')){logger[_0x2ee3('0x13')]('['+[_0xc649b8[_0x2ee3('0x17')]()]+']',_0x2ee3('0x6a'));emit(_0x1087cb[_0x2ee3('0x58')],_0x3a3753[_0x2ee3('0x3a')],_0x3ca70e[_0x2ee3('0x44')]);}})[_0x2ee3('0x14')](function(_0xa09290){logger[_0x2ee3('0x15')]('['+[_0xc649b8[_0x2ee3('0x17')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x2ee3('0x6b')](_0xa09290,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7cb8=['content','idField','toString','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','adminEmail','destcalleridnum','calleridnum','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','GET','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm','catch','error',']\x20using\x20admin\x20profile','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase'];(function(_0x1d3046,_0x8b14e1){var _0x3b9b62=function(_0xb69d69){while(--_0xb69d69){_0x1d3046['push'](_0x1d3046['shift']());}};_0x3b9b62(++_0x8b14e1);}(_0x7cb8,0xac));var _0x87cb=function(_0x5c9e36,_0x1b0bc8){_0x5c9e36=_0x5c9e36-0x0;var _0x32d060=_0x7cb8[_0x5c9e36];return _0x32d060;};'use strict';var _=require(_0x87cb('0x0'));var Promise=require('bluebird');var rp=require(_0x87cb('0x1'));var util=require('util');var md5=require(_0x87cb('0x2'));var Redis=require(_0x87cb('0x3'));var intUtil=require(_0x87cb('0x4'));var config=require(_0x87cb('0x5'));var logger=require(_0x87cb('0x6'))('servicenow');config[_0x87cb('0x7')]=_[_0x87cb('0x8')](config[_0x87cb('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x87cb('0x9'))(new Redis(config['redis']));function getAdminUser(_0x198cce,_0xd764dd,_0x51d078,_0x42f00f,_0x425441,_0xeba47b){return new Promise(function(_0xb380d6,_0x908465){var _0x27eebb={'method':_0x87cb('0xa'),'uri':_0x42f00f+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x425441+'&'+_0xeba47b,'auth':_0xd764dd,'json':!![]};return rp(_0x27eebb)[_0x87cb('0xb')](function(_0x4eb806){if(_0x4eb806['result']['length']>0x0){_0x51d078[_0x87cb('0xc')]=_0x4eb806[_0x87cb('0xd')][0x0][_0x87cb('0xe')];}logger[_0x87cb('0xf')]('['+[_0x198cce[_0x87cb('0x10')]()]+_0x87cb('0x11'),_0x51d078);_0xb380d6(_0x51d078);})['catch'](function(_0x1f25e7){logger['error']('['+[_0x198cce[_0x87cb('0x10')]()]+']',_0x1f25e7['message']);_0x908465(_0x1f25e7[_0x87cb('0x12')]);});});}function getUser(_0x2d533a,_0x1d02a5,_0x2f2040,_0x4802ed,_0x55ddf2){return function(_0x355ae9){logger[_0x87cb('0xf')]('['+[_0x2d533a[_0x87cb('0x10')]()]+_0x87cb('0x13'),_0x355ae9);return new Promise(function(_0xb8a690,_0xb2dee6){if(intUtil[_0x87cb('0x14')](_0x355ae9[_0x87cb('0x15')])){var _0x36c7f4={'method':'GET','uri':_0x2f2040+_0x87cb('0x16')+_0x355ae9[_0x87cb('0x15')]+'&'+_0x4802ed+'&'+_0x55ddf2,'auth':_0x1d02a5,'json':!![]};logger['info']('['+[_0x2d533a[_0x87cb('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x36c7f4);return rp(_0x36c7f4)[_0x87cb('0xb')](function(_0x306a91){logger['info']('['+[_0x2d533a[_0x87cb('0x10')]()]+_0x87cb('0x17'),_0x306a91);if(_0x306a91[_0x87cb('0xd')]['length']>0x0&&String(_0x306a91[_0x87cb('0xd')][0x0][_0x87cb('0x18')])===_0x87cb('0x19')){_0x355ae9[_0x87cb('0x1a')]=_0x306a91[_0x87cb('0xd')][0x0][_0x87cb('0xe')];}else{_0x355ae9[_0x87cb('0x1a')]=_0x355ae9[_0x87cb('0xc')];_0x355ae9[_0x87cb('0x15')]=_0x355ae9['adminEmail'];}logger[_0x87cb('0xf')]('['+[_0x2d533a[_0x87cb('0x10')]()]+_0x87cb('0x1b'),_0x355ae9);_0xb8a690(_0x355ae9);})[_0x87cb('0x1c')](function(_0xc4f783){logger[_0x87cb('0x1d')]('['+[_0x2d533a[_0x87cb('0x10')]()]+']',_0xc4f783[_0x87cb('0x12')]);_0xb2dee6(_0xc4f783[_0x87cb('0x12')]);});}else{logger[_0x87cb('0xf')]('['+[_0x2d533a[_0x87cb('0x10')]()]+_0x87cb('0x1e'));_0x355ae9[_0x87cb('0x1a')]=_0x355ae9[_0x87cb('0xc')];_0x355ae9[_0x87cb('0x15')]=_0x355ae9['adminEmail'];_0xb8a690(_0x355ae9);}});};}function createEndUser(_0x451ca3,_0x228d36,_0x6c87ae,_0x56105a,_0x257c84){logger[_0x87cb('0xf')]('['+[_0x451ca3[_0x87cb('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x6c87ae);return new Promise(function(_0x2cbb61,_0x5aa1f6){var _0x19aaba={'method':'POST','uri':_0x56105a+_0x87cb('0x1f')+_0x257c84,'body':{'user_name':_0x6c87ae['endUserNumber'],'roles':_0x87cb('0x20'),'first_name':_0x6c87ae[_0x87cb('0x21')],'active':_0x87cb('0x19'),'date_format':_0x87cb('0x22'),'phone':_0x6c87ae[_0x87cb('0x21')]},'auth':_0x228d36,'json':!![]};return rp(_0x19aaba)[_0x87cb('0xb')](function(_0x5e2b96){logger[_0x87cb('0xf')]('['+[_0x451ca3[_0x87cb('0x10')]()]+_0x87cb('0x23'),_0x5e2b96[_0x87cb('0xd')]);_0x6c87ae['endUserId']=_0x5e2b96[_0x87cb('0xd')][_0x87cb('0xe')];_0x2cbb61(_0x6c87ae);})[_0x87cb('0x1c')](function(_0x200581){logger[_0x87cb('0x1d')]('['+[_0x451ca3[_0x87cb('0x10')]()]+']',_0x200581[_0x87cb('0x12')]);_0x5aa1f6(_0x200581[_0x87cb('0x12')]);});});}function getEndUser(_0x4d1fce,_0x5bb921,_0x3b3544,_0xb16741,_0x3b5d4a){return function(_0x4cb21e){logger[_0x87cb('0xf')]('['+[_0x4d1fce[_0x87cb('0x10')]()]+_0x87cb('0x24'),_0x4cb21e);return new Promise(function(_0x2125a5,_0x14a69f){var _0x73771e={'method':_0x87cb('0xa'),'uri':_0x3b3544+_0x87cb('0x25')+_0x4cb21e[_0x87cb('0x21')]+'&'+_0xb16741+'&'+_0x3b5d4a,'auth':_0x5bb921,'json':!![]};return rp(_0x73771e)[_0x87cb('0xb')](function(_0x100d31){if(_0x100d31['result'][_0x87cb('0x26')]>0x0){_0x4cb21e[_0x87cb('0x27')]=_0x100d31['result'][0x0][_0x87cb('0xe')];logger['info']('['+[_0x4d1fce['toUpperCase']()]+_0x87cb('0x28'),_0x4cb21e);_0x2125a5(_0x4cb21e);}else{return createEndUser(_0x4d1fce,_0x5bb921,_0x4cb21e,_0x3b3544,_0xb16741)[_0x87cb('0xb')](function(_0x2a3e73){logger[_0x87cb('0xf')]('['+[_0x4d1fce[_0x87cb('0x10')]()]+_0x87cb('0x29'),_0x2a3e73);_0x2125a5(_0x2a3e73);});}})['catch'](function(_0x1e5d82){logger[_0x87cb('0x1d')]('['+[_0x4d1fce['toUpperCase']()]+']',_0x1e5d82['message']);_0x14a69f(_0x1e5d82['message']);});});};}function getCustomFields(_0x25cd96,_0x54a445){var _0x4fb14d={};if(_0x25cd96[_0x87cb('0x26')]>0x0){_[_0x87cb('0x2a')](_0x25cd96,function(_0x13baee){if(_[_0x87cb('0x2b')]([_0x87cb('0x2c'),_0x87cb('0x2d')],_0x13baee[_0x87cb('0x2e')])&&_0x13baee[_0x87cb('0x2f')]&&!_0x13baee[_0x87cb('0x30')]){_0x4fb14d[_0x13baee['nameField'][_0x87cb('0x31')]()]=_0x13baee[_0x87cb('0x32')]['toString']();}else if(_[_0x87cb('0x2b')]([_0x87cb('0x2c'),_0x87cb('0x2d')],_0x13baee[_0x87cb('0x2e')])&&_0x13baee[_0x87cb('0x33')]&&_0x13baee['customField']){_0x4fb14d[_0x13baee[_0x87cb('0x33')][_0x87cb('0x31')]()]=_0x13baee[_0x87cb('0x32')][_0x87cb('0x34')]();}else if(_0x13baee[_0x87cb('0x2e')]==='variable'&&_0x13baee['variableName']&&_0x13baee['idField']&&_0x13baee[_0x87cb('0x30')]){_0x4fb14d[_0x13baee['idField']['toLowerCase']()]=_0x54a445[_0x13baee[_0x87cb('0x35')]][_0x87cb('0x34')]();}else if(_0x13baee[_0x87cb('0x2e')]===_0x87cb('0x36')&&_0x13baee[_0x87cb('0x37')]&&_0x13baee[_0x87cb('0x37')][_0x87cb('0x38')]&&_0x13baee[_0x87cb('0x33')]&&_0x13baee[_0x87cb('0x30')]){_0x4fb14d[_0x13baee[_0x87cb('0x33')][_0x87cb('0x31')]()]=_0x54a445[_0x13baee[_0x87cb('0x37')][_0x87cb('0x38')]['toLowerCase']()][_0x87cb('0x34')]();}});}return _0x4fb14d;}function getTicket(_0x4c29e6,_0x1d77e9,_0x164817,_0x365657,_0x224a7e,_0x2b0476){return function(_0x10ff94){logger[_0x87cb('0xf')]('['+[_0x4c29e6[_0x87cb('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x10ff94);return new Promise(function(_0x3f2d23,_0x113e09){var _0x20874a=_0x4c29e6['toLowerCase']()===_0x87cb('0x39')?_0x10ff94['userId']:_0x10ff94[_0x87cb('0x27')];var _0x42ed97={'method':'POST','uri':_0x164817+_0x87cb('0x3a')+'?'+_0x2b0476,'body':Object[_0x87cb('0x3b')]({},{'active':_0x87cb('0x19'),'caller_id':_0x20874a,'assigned_to':_0x10ff94[_0x87cb('0x1a')],'short_description':intUtil['getString'](_0x365657[_0x87cb('0x3c')],_0x224a7e,'\x20'),'description':intUtil[_0x87cb('0x3d')](_0x365657['Descriptions'],_0x224a7e,'\x0a')},getCustomFields(_0x365657[_0x87cb('0x3e')],_0x224a7e)),'auth':_0x1d77e9,'json':!![]};return rp(_0x42ed97)[_0x87cb('0xb')](function(_0x2e9325){logger[_0x87cb('0xf')]('['+[_0x4c29e6[_0x87cb('0x10')]()]+_0x87cb('0x3f'),_0x2e9325[_0x87cb('0xd')]);_0x10ff94[_0x87cb('0x40')]=_0x2e9325[_0x87cb('0xd')][_0x87cb('0xe')];_0x10ff94[_0x87cb('0x41')]=_0x2e9325[_0x87cb('0xd')][_0x87cb('0x42')];logger[_0x87cb('0xf')]('['+[_0x4c29e6[_0x87cb('0x10')]()]+_0x87cb('0x43'),_0x10ff94);_0x3f2d23(_0x10ff94);})['catch'](function(_0x57220c){logger[_0x87cb('0x1d')]('['+[_0x4c29e6[_0x87cb('0x10')]()]+']',_0x57220c[_0x87cb('0x12')]);_0x113e09(_0x57220c['message']);});});};}function createRemoteTag(_0x5889f6,_0x5cc3be,_0xff9da3,_0x1ea61c){return new Promise(function(_0x14aae2,_0x3c48b6){var _0x1decc2={'method':_0x87cb('0x44'),'uri':_0xff9da3+'label'+'?'+_0x1ea61c,'body':{'short_description':_0x5889f6,'global':!![],'active':!![],'name':_0x5889f6},'auth':_0x5cc3be,'json':!![]};return rp(_0x1decc2)['then'](function(_0x328f4d){var _0x3dc4ac=_0x328f4d['result'][_0x87cb('0xe')];_0x14aae2(_0x3dc4ac);});});}function getRemoteTag(_0x1306d6,_0x482d5a,_0x1c4b0b,_0x29f5ca,_0x3053c2){return new Promise(function(_0x5469cf,_0x14cfa3){var _0x46a9e9={'method':_0x87cb('0xa'),'uri':_0x1c4b0b+_0x87cb('0x45')+_0x87cb('0x46')+_0x1306d6+'&'+_0x29f5ca,'auth':_0x482d5a,'json':!![]};return rp(_0x46a9e9)[_0x87cb('0xb')](function(_0x5202a8){if(_0x5202a8['result'][_0x87cb('0x26')]>0x0){var _0x34c9cd=_0x5202a8[_0x87cb('0xd')][0x0][_0x87cb('0xe')];_0x5469cf(_0x34c9cd);}else{return createRemoteTag(_0x1306d6,_0x482d5a,_0x1c4b0b,_0x29f5ca)[_0x87cb('0xb')](function(_0x25299c){_0x5469cf(_0x25299c);});}});});}function assignTagToIncident(_0xcd3ac0,_0x43e859,_0x5d6b6f,_0x2ac32b,_0x3ff5f1){return new Promise(function(_0xbfb0db,_0x1f5d15){var _0x3744aa={'method':_0x87cb('0x44'),'uri':_0x5d6b6f+_0x87cb('0x47')+'?'+_0x3ff5f1,'body':{'label':_0xcd3ac0,'table':_0x87cb('0x3a'),'id_type':_0x87cb('0x48'),'table_key':_0x2ac32b[_0x87cb('0x40')],'title':_0x87cb('0x49')+_0x2ac32b['ticketNumber'],'id_display':_0x2ac32b[_0x87cb('0x41')]},'auth':_0x43e859,'json':!![]};return rp(_0x3744aa)['then'](function(_0x217361){_0xbfb0db();})[_0x87cb('0x1c')](function(){_0xbfb0db();});});}function manageTags(_0x2f7a6f,_0x4d3ccb,_0x807671,_0x395ddc,_0x44b3bc,_0x528d8d,_0x32c25a){return new Promise(function(_0x4ae8ca,_0x2c824e){var _0x5b7ca1=[];_0x4d3ccb[_0x87cb('0x2a')](function(_0x3855bf){_0x5b7ca1[_0x87cb('0x4a')](getRemoteTag(_0x3855bf,_0x807671,_0x395ddc,_0x528d8d,_0x32c25a));});return Promise['all'](_0x5b7ca1)[_0x87cb('0xb')](function(_0x28ebb2){if(_0x28ebb2['length']){logger[_0x87cb('0xf')]('['+[_0x2f7a6f[_0x87cb('0x10')]()]+_0x87cb('0x4b'),_0x28ebb2);var _0xf5c71b=[];_0x28ebb2[_0x87cb('0x2a')](function(_0x5835f0){_0xf5c71b[_0x87cb('0x4a')](assignTagToIncident(_0x5835f0,_0x807671,_0x395ddc,_0x44b3bc,_0x528d8d));});return Promise[_0x87cb('0x4c')](_0xf5c71b)['then'](function(){_0x4ae8ca();})['catch'](function(){_0x4ae8ca();});}else{_0x4ae8ca();}});});}function getTags(_0x37bbd3,_0x352765,_0x3e0c1b,_0xb23906,_0x2b3eb8,_0x2d3412){return function(_0x260d52){return new Promise(function(_0x4ebfc3,_0x4004e2){var _0xafee60=[];var _0x3ef85f=_0xb23906['Tags'];if(_0x3ef85f&&_0x3ef85f[_0x87cb('0x26')]>0x0){_0xafee60=_[_0x87cb('0x4d')](_0x3ef85f,_0x87cb('0x38'));}if(_0xafee60[_0x87cb('0x26')]>0x0){return manageTags(_0x37bbd3,_0xafee60,_0x352765,_0x3e0c1b,_0x260d52,_0x2b3eb8,_0x2d3412)['then'](function(){_0x4ebfc3(_0x260d52);});}else{_0x4ebfc3(_0x260d52);}});};}function emit(_0x319585,_0x27489e,_0x3b60f9){var _0x1a9950=_0x87cb('0x4e')+_0x87cb('0x4f')+_0x87cb('0x50')+_0x87cb('0x51');var _0x478f17={'uri':_0x319585+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3b60f9+_0x1a9950};io['to'](util[_0x87cb('0x52')]('user:%s',_0x27489e))['emit'](_0x87cb('0x53'),_0x478f17);}exports['cs']=function(_0x3b06c6,_0x4556a6,_0x162950,_0x1d241b,_0x25f3c3,_0x2cc9a1,_0x38edbd,_0x55fbab){var _0x28ba42={};var _0x208d52={'user':_0x2cc9a1[_0x87cb('0x54')],'pass':_0x2cc9a1[_0x87cb('0x55')]};var _0x452f36=_0x87cb('0x56');var _0x2e7c69=_0x87cb('0x57');_0x2cc9a1[_0x87cb('0x58')]=intUtil[_0x87cb('0x59')](_0x2cc9a1[_0x87cb('0x58')]);_0x2cc9a1[_0x87cb('0x5a')]=intUtil[_0x87cb('0x59')](_0x2cc9a1[_0x87cb('0x5a')]);var _0x1c3ff8=util[_0x87cb('0x52')](_0x87cb('0x5b'),_0x2cc9a1[_0x87cb('0x58')]);_0x28ba42[_0x87cb('0x15')]=!_[_0x87cb('0x5c')](_0x1d241b)?_0x1d241b[_0x87cb('0x5d')]:null;_0x28ba42[_0x87cb('0x5e')]=_0x2cc9a1[_0x87cb('0x5d')];_0x28ba42[_0x87cb('0x21')]=_0x55fbab[_0x87cb('0x31')]()===_0x87cb('0x39')?_0x4556a6[_0x87cb('0x5f')]:_0x4556a6[_0x87cb('0x60')];_0x28ba42['callDirection']=_0x55fbab==='queue'||_0x55fbab===_0x87cb('0x61')?_0x87cb('0x62'):_0x87cb('0x39');var _0x43557e=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cc9a1[_0x87cb('0x5a')],_0x4556a6[_0x87cb('0x63')],md5(_0x4556a6[_0x87cb('0x63')]));if(_0x25f3c3&&_0x25f3c3[_0x87cb('0x64')]){logger[_0x87cb('0xf')](_0x87cb('0x65'),_0x87cb('0x66'));_0x4556a6['recordingURL']=_0x43557e;}else if(_0x38edbd&&_0x38edbd[_0x87cb('0x67')]&&_0x38edbd[_0x87cb('0x67')]!==_0x87cb('0x68')){logger[_0x87cb('0xf')](_0x87cb('0x69'),_0x87cb('0x66'));_0x4556a6['recordingURL']=_0x43557e;}else{_0x4556a6[_0x87cb('0x6a')]='';}return getAdminUser(_0x55fbab,_0x208d52,_0x28ba42,_0x1c3ff8,_0x2e7c69,_0x452f36)[_0x87cb('0xb')](getUser(_0x55fbab,_0x208d52,_0x1c3ff8,_0x2e7c69,_0x452f36))[_0x87cb('0xb')](getEndUser(_0x55fbab,_0x208d52,_0x1c3ff8,_0x2e7c69,_0x452f36))[_0x87cb('0xb')](getTicket(_0x55fbab,_0x208d52,_0x1c3ff8,_0x162950,_0x4556a6,_0x2e7c69))[_0x87cb('0xb')](function(_0x261d37){logger[_0x87cb('0xf')](util[_0x87cb('0x52')]('The\x20ticket\x20ID\x20is:\x20%s',_0x261d37[_0x87cb('0x40')]));logger[_0x87cb('0xf')](util[_0x87cb('0x52')](_0x87cb('0x6b'),_0x55fbab));if(_0x55fbab!==_0x87cb('0x61')){logger[_0x87cb('0xf')]('['+[_0x55fbab[_0x87cb('0x10')]()]+']',_0x87cb('0x6c'));emit(_0x2cc9a1[_0x87cb('0x58')],_0x1d241b[_0x87cb('0x38')],_0x261d37['ticketId']);}})[_0x87cb('0x1c')](function(_0x446e3b){logger['error']('['+[_0x55fbab['toUpperCase']()]+_0x87cb('0x6d'),util[_0x87cb('0x6e')](_0x446e3b,{'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 5b3a4e6..950695a 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 _0x34f3=['The\x20Ticket\x20ID\x20is:','users','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','duration_hours','duration_minutes','parent_type','parent_name','name','direction','length','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','get_entry_list','Employees','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','[HTTP]','merge','map','forEach','type','string','customField','nameField','content','toString','custom_fields','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','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','trigger:browser:url','outbound','recordingFormat','destcalleridname','Outbound'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x34f3,0x80));var _0x334f=function(_0x4cd6f5,_0x4b0248){_0x4cd6f5=_0x4cd6f5-0x0;var _0x57ea36=_0x34f3[_0x4cd6f5];return _0x57ea36;};'use strict';var _=require(_0x334f('0x0'));var rp=require(_0x334f('0x1'));var BPromise=require(_0x334f('0x2'));var md5=require(_0x334f('0x3'));var util=require('util');var Redis=require(_0x334f('0x4'));var intUtil=require(_0x334f('0x5'));var config=require(_0x334f('0x6'));var logger=require(_0x334f('0x7'))(_0x334f('0x8'));config[_0x334f('0x9')]=_[_0x334f('0xa')](config[_0x334f('0x9')],{'host':_0x334f('0xb'),'port':0x18eb});var io=require(_0x334f('0xc'))(new Redis(config[_0x334f('0x9')]));var def={'method':_0x334f('0xd'),'json':!![]};function emit(_0x1800c1,_0x2eb779,_0x16e15e){io['to'](_0x1800c1)[_0x334f('0xe')](_0x2eb779,_0x16e15e);}function getTicket(_0x2f3300,_0x5b11ce,_0xbed291,_0x4a6c9a,_0x26e5d7,_0x246d6f,_0x34240e,_0x185b42){logger[_0x334f('0xf')](_0x334f('0x10'));var _0x5c3724=new Date();var _0x44d122=[{'name':'name','value':intUtil[_0x334f('0x11')](_0x4a6c9a[_0x334f('0x12')],_0x26e5d7,'\x20')},{'name':_0x334f('0x13'),'value':_0x5b11ce['id']},{'name':'created_by','value':_0x5b11ce['id']},{'name':_0x334f('0x14'),'value':intUtil[_0x334f('0x11')](_0x4a6c9a[_0x334f('0x15')],_0x26e5d7,'\x0a')},{'name':'date_start','value':_0x5c3724[_0x334f('0x16')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x334f('0x17'),'value':'0'},{'name':_0x334f('0x18'),'value':'15'},{'name':'parent_id','value':_0xbed291['id']},{'name':_0x334f('0x19'),'value':'Contacts'},{'name':_0x334f('0x1a'),'value':_0xbed291[_0x334f('0x1b')]},{'name':_0x334f('0x1c'),'value':_0x185b42}];if(_0x246d6f[_0x334f('0x1d')]){_['forEach'](_0x246d6f,function(_0x543e3f){if(_0x26e5d7[_0x543e3f[_0x334f('0x1e')]]){_0x44d122[_0x334f('0x1f')]({'name':_0x543e3f[_0x334f('0x20')],'value':_0x26e5d7[_0x543e3f[_0x334f('0x1e')]]});}});}return request({'form':{'method':_0x334f('0x21'),'input_type':_0x334f('0x22'),'response_type':_0x334f('0x22'),'rest_data':JSON[_0x334f('0x23')]({'session':_0x34240e['id'],'module_name':'Calls','name_value_list':_0x44d122})}});}function getAuth(_0x4edcb4){return util[_0x334f('0x24')](_0x334f('0x25'),new Buffer(_0x4edcb4[_0x334f('0x26')]+':X')['toString'](_0x334f('0x27')));}function getServerInfo(_0x4176e9){return request({'form':{'method':_0x334f('0x28'),'input_type':_0x334f('0x22'),'response_type':_0x334f('0x22'),'rest_data':JSON[_0x334f('0x23')]({'session':_0x4176e9['id']})}});}function getUser(_0x50a6d0,_0x41a54b,_0x1479b5){if(!_[_0x334f('0x29')](_0x41a54b)){logger[_0x334f('0xf')]('Getting\x20agent\x20with\x20name',_0x41a54b);return request({'form':{'method':_0x334f('0x2a'),'input_type':_0x334f('0x22'),'response_type':_0x334f('0x22'),'rest_data':JSON[_0x334f('0x23')]({'session':_0x1479b5['id'],'module_name':_0x334f('0x2b'),'query':util[_0x334f('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x41a54b),'order_by':'','offset':'0','select_fields':['id',_0x334f('0x1b'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x334f('0x2c')](function(_0x3a10ef){if(_0x3a10ef[_0x334f('0x2d')][_0x334f('0x1d')]){var _0x775c2f=_[_0x334f('0x2e')](_0x3a10ef['entry_list'],function(_0x51d71e){return _0x51d71e[_0x334f('0x2f')][_0x334f('0x30')][_0x334f('0x31')]===_0x41a54b;});if(_0x775c2f){logger[_0x334f('0xf')](_0x334f('0x32'));return BPromise['resolve']({'id':_0x775c2f[_0x334f('0x2f')]['id'][_0x334f('0x31')],'name':_0x775c2f[_0x334f('0x2f')][_0x334f('0x1b')][_0x334f('0x31')]});}}logger[_0x334f('0xf')](_0x334f('0x33'));return BPromise[_0x334f('0x34')]({'id':_0x1479b5['name_value_list'][_0x334f('0x35')][_0x334f('0x31')],'name':_0x1479b5[_0x334f('0x2f')]['user_name'][_0x334f('0x31')]});});}else{logger['info'](_0x334f('0x36'));return BPromise[_0x334f('0x34')]({'id':_0x1479b5[_0x334f('0x2f')][_0x334f('0x35')][_0x334f('0x31')],'name':_0x1479b5['name_value_list'][_0x334f('0x30')][_0x334f('0x31')]});}}function getEndUser(_0x35d8d2,_0x566224,_0x304741,_0x4e1c58){logger[_0x334f('0xf')]('Searching\x20enduser\x20with\x20phone',_0x304741);return request({'form':{'method':_0x334f('0x2a'),'input_type':_0x334f('0x22'),'response_type':'JSON','rest_data':JSON[_0x334f('0x23')]({'session':_0x4e1c58['id'],'module_name':_0x334f('0x37'),'query':util[_0x334f('0x24')](_0x334f('0x38'),_0x304741),'order_by':'','offset':'0','select_fields':['id',_0x334f('0x1b'),_0x334f('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x334f('0x2c')](function(_0x1c53f0){if(_0x1c53f0[_0x334f('0x2d')][_0x334f('0x1d')]){var _0x4d70da=_[_0x334f('0x2e')](_0x1c53f0['entry_list'],function(_0x4bee81){return _0x4bee81[_0x334f('0x2f')][_0x334f('0x39')]['value']===_0x304741;});if(_0x4d70da){logger[_0x334f('0xf')](_0x334f('0x3a'));return BPromise[_0x334f('0x34')]({'id':_0x4d70da[_0x334f('0x2f')]['id'][_0x334f('0x31')],'name':_0x4d70da['name_value_list'][_0x334f('0x1b')]['value'],'phone':_0x4d70da[_0x334f('0x2f')][_0x334f('0x39')][_0x334f('0x31')]});}}else{logger['info'](_0x334f('0x3b'));return request({'form':{'method':_0x334f('0x21'),'input_type':_0x334f('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4e1c58['id'],'module_name':'Contacts','name_value_list':[{'name':_0x334f('0x3c'),'value':_0x566224!==_0x334f('0x3d')?_0x566224:util[_0x334f('0x24')]('Caller\x20-\x20%s',_0x304741)},{'name':_0x334f('0x39'),'value':_0x304741}]})}})[_0x334f('0x2c')](function(_0x44fcf5){logger[_0x334f('0xf')](_0x334f('0x3e'));return BPromise[_0x334f('0x34')]({'id':_0x44fcf5['id'],'name':_0x44fcf5[_0x334f('0x2d')][_0x334f('0x3c')][_0x334f('0x31')],'phone':_0x44fcf5[_0x334f('0x2d')]['phone_home'][_0x334f('0x31')]});});}});}function request(_0x557333){logger['debug'](_0x334f('0x3f'),JSON[_0x334f('0x23')](_0x557333));return rp(_[_0x334f('0x40')](def,_0x557333));}function getTags(_0x2b1e0b,_0x2a4e48){var _0x1fec3c=[];if(_0x2b1e0b&&_0x2b1e0b[_0x334f('0x1d')]>0x0){_0x1fec3c=_[_0x334f('0x41')](_0x2b1e0b,_0x2a4e48);}return _0x1fec3c;}function getCustomFields(_0x367d2d,_0x3a735d){var _0x3d453e=[];var _0x1f3b76={'custom_fields':[]};if(_0x367d2d[_0x334f('0x1d')]>0x0){_[_0x334f('0x42')](_0x367d2d,function(_0x14c2bd){if(_0x14c2bd[_0x334f('0x43')]===_0x334f('0x44')&&_0x14c2bd['nameField']&&!_0x14c2bd[_0x334f('0x45')]){_0x1f3b76[_0x14c2bd[_0x334f('0x46')]['toLowerCase']()]=_0x14c2bd[_0x334f('0x47')][_0x334f('0x48')]();}else if(_0x14c2bd[_0x334f('0x43')]===_0x334f('0x44')&&_0x14c2bd[_0x334f('0x20')]&&_0x14c2bd[_0x334f('0x45')]){_0x1f3b76[_0x334f('0x49')][_0x334f('0x1f')]({'id':_0x14c2bd['idField'],'value':_0x14c2bd[_0x334f('0x47')]['toString']()});}else if(_0x14c2bd[_0x334f('0x43')]==='variable'&&_0x14c2bd[_0x334f('0x1e')]&&_0x14c2bd[_0x334f('0x20')]&&_0x14c2bd[_0x334f('0x45')]){_0x3a735d[_0x14c2bd['variableName']]&&_0x1f3b76[_0x334f('0x49')][_0x334f('0x1f')]({'id':_0x14c2bd[_0x334f('0x20')],'value':_0x3a735d[_0x14c2bd[_0x334f('0x1e')]][_0x334f('0x48')]()});}else if(_0x14c2bd['type']==='customVariable'&&_0x14c2bd[_0x334f('0x4a')]&&_0x14c2bd[_0x334f('0x4a')]['name']&&_0x14c2bd[_0x334f('0x20')]&&_0x14c2bd['customField']){_0x3a735d[_0x14c2bd['Variable'][_0x334f('0x1b')][_0x334f('0x4b')]()]&&_0x1f3b76[_0x334f('0x49')][_0x334f('0x1f')]({'id':_0x14c2bd[_0x334f('0x20')],'value':_0x3a735d[_0x14c2bd[_0x334f('0x4a')]['name'][_0x334f('0x4b')]()][_0x334f('0x48')]()});}});}return _0x1f3b76;}function getConnection(_0x24c160){return request({'method':_0x334f('0xd'),'form':{'method':_0x334f('0x4c'),'input_type':_0x334f('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x24c160[_0x334f('0x4d')],'password':_0x24c160[_0x334f('0x4e')],'encryption':_0x334f('0x4f')},'application':_0x334f('0x50')})}})[_0x334f('0x2c')](function(_0x53e3af){var _0x6c1276=_0x53e3af;if(_0x6c1276['id']){def['sessionID']=_0x6c1276['id'];return BPromise['resolve'](_0x6c1276);}else{throw new Error(util[_0x334f('0x24')](_0x334f('0x51'),_0x24c160['id']));}});}function setRelationship(_0xa68362,_0x2d8d06,_0x2b3cb9,_0x7efe39){return request({'form':{'method':'set_relationship','input_type':_0x334f('0x22'),'response_type':'JSON','rest_data':JSON[_0x334f('0x23')]({'session':_0xa68362['id'],'module_name':'Calls','module_id':_0x2b3cb9['id'],'link_field_name':_0x7efe39,'related_ids':[_0x2d8d06['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4710ad,_0x236544,_0x6048c1,_0x34ff6a,_0x264f19,_0x27bebc){var _0x4732f8,_0x6109ee,_0x3c11cc,_0x479307;_0x27bebc[_0x334f('0x52')]=intUtil[_0x334f('0x53')](_0x27bebc[_0x334f('0x52')]);_0x27bebc[_0x334f('0x54')]=intUtil['stripTrailingSlash'](_0x27bebc['serverUrl']);def[_0x334f('0x55')]=util[_0x334f('0x24')](_0x334f('0x56'),_0x27bebc[_0x334f('0x52')]);if(_0x264f19&&_0x264f19['monitor_format']){logger[_0x334f('0xf')](_0x334f('0x57'),_0x334f('0x58'));_0x236544[_0x334f('0x59')]=util[_0x334f('0x24')](_0x334f('0x5a'),_0x27bebc[_0x334f('0x54')],_0x236544[_0x334f('0x5b')],md5(_0x236544[_0x334f('0x5b')]));}else{_0x236544[_0x334f('0x59')]='';}return getConnection(_0x27bebc)[_0x334f('0x2c')](function(_0x1725ff){_0x479307=_0x1725ff;return getUser(_0x27bebc,_0x34ff6a[_0x334f('0x1b')],_0x479307);})['then'](function(_0x15c68d){_0x4732f8=_0x15c68d;logger[_0x334f('0xf')](_0x334f('0x5c'),_0x4732f8['id']);return getEndUser(_0x27bebc,_0x236544[_0x334f('0x5d')],_0x236544[_0x334f('0x5e')],_0x479307);})[_0x334f('0x2c')](function(_0xf4ed46){_0x6109ee=_0xf4ed46;logger[_0x334f('0xf')](_0x334f('0x5f'),_0x6109ee['id']);return getTicket(_0x27bebc,_0x4732f8,_0x6109ee,_0x6048c1,_0x236544,_0x6048c1[_0x334f('0x60')],_0x479307,_0x334f('0x61'));})[_0x334f('0x2c')](function(_0x461c11){_0x3c11cc=_0x461c11;logger[_0x334f('0xf')](_0x334f('0x62'));logger[_0x334f('0xf')]('The\x20Ticket\x20ID\x20is:',_0x3c11cc['id']);return setRelationship(_0x479307,_0x4732f8,_0x3c11cc,'users');})[_0x334f('0x2c')](function(){return setRelationship(_0x479307,_0x6109ee,_0x3c11cc,_0x334f('0x63'));})[_0x334f('0x2c')](function(){return getServerInfo(_0x479307);})['then'](function(_0x5773c2){var _0x2a90da=parseInt(_0x5773c2[_0x334f('0x64')]['charAt'](0x0));var _0x3bfcd6=util[_0x334f('0x24')](_0x334f('0x65'),_0x27bebc[_0x334f('0x52')],_0x3c11cc['id']);if(_0x2a90da>0x6){_0x3bfcd6=util[_0x334f('0x24')](_0x334f('0x66'),_0x27bebc[_0x334f('0x52')],_0x3c11cc['id']);}logger[_0x334f('0xf')](_0x334f('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x34ff6a[_0x334f('0x1b')]),_0x334f('0x67'),{'uri':_0x3bfcd6});})['catch'](function(_0x4a9f39){logger['error']('[QUEUE]',JSON[_0x334f('0x23')](_0x4a9f39));});};exports[_0x334f('0x68')]=function(_0x5f31bc,_0x186f4d,_0x510bed,_0xb57f7b,_0x1c23f5,_0x1d6108,_0x3bcd7e){var _0x1b4e2b,_0x4d0960,_0x456951,_0x4991fb;_0x1d6108[_0x334f('0x52')]=intUtil[_0x334f('0x53')](_0x1d6108[_0x334f('0x52')]);_0x1d6108[_0x334f('0x54')]=intUtil[_0x334f('0x53')](_0x1d6108['serverUrl']);def['uri']=util[_0x334f('0x24')](_0x334f('0x56'),_0x1d6108[_0x334f('0x52')]);if(_0x3bcd7e&&_0x3bcd7e[_0x334f('0x69')]&&_0x3bcd7e[_0x334f('0x69')]!=='none'){logger[_0x334f('0xf')]('[OUTBOUND]',_0x334f('0x58'));_0x186f4d[_0x334f('0x59')]=util[_0x334f('0x24')](_0x334f('0x5a'),_0x1d6108[_0x334f('0x54')],_0x186f4d[_0x334f('0x5b')],md5(_0x186f4d[_0x334f('0x5b')]));}return getConnection(_0x1d6108)[_0x334f('0x2c')](function(_0x5d5282){_0x4991fb=_0x5d5282;return getUser(_0x1d6108,_0xb57f7b['name'],_0x4991fb);})[_0x334f('0x2c')](function(_0x2f7d60){_0x1b4e2b=_0x2f7d60;logger[_0x334f('0xf')](_0x334f('0x5c'),_0x1b4e2b['id']);return getEndUser(_0x1d6108,_0x186f4d[_0x334f('0x6a')],_0x186f4d['destcalleridnum'],_0x4991fb);})[_0x334f('0x2c')](function(_0x21981d){_0x4d0960=_0x21981d;logger[_0x334f('0xf')](_0x334f('0x5f'),_0x4d0960['id']);return getTicket(_0x1d6108,_0x1b4e2b,_0x4d0960,_0x510bed,_0x186f4d,_0x510bed[_0x334f('0x60')],_0x4991fb,_0x334f('0x6b'));})[_0x334f('0x2c')](function(_0x4b929d){_0x456951=_0x4b929d;logger['info'](_0x334f('0x62'));logger[_0x334f('0xf')](_0x334f('0x6c'),_0x456951['id']);return setRelationship(_0x4991fb,_0x1b4e2b,_0x456951,_0x334f('0x6d'));})[_0x334f('0x2c')](function(){return setRelationship(_0x4991fb,_0x4d0960,_0x456951,'contacts');})[_0x334f('0x2c')](function(){return getServerInfo(_0x4991fb);})['then'](function(_0x7d77a7){var _0x22523f=parseInt(_0x7d77a7[_0x334f('0x64')]['charAt'](0x0));var _0x13a679=util[_0x334f('0x24')](_0x334f('0x65'),_0x1d6108[_0x334f('0x52')],_0x456951['id']);if(_0x22523f>0x6){_0x13a679=util[_0x334f('0x24')](_0x334f('0x66'),_0x1d6108['remoteUri'],_0x456951['id']);}logger['info'](_0x334f('0x6e'),_0x334f('0x6f'));emit(util['format']('user:%s',_0xb57f7b['name']),_0x334f('0x67'),{'uri':_0x13a679});})[_0x334f('0x70')](function(_0x5828b3){logger[_0x334f('0x71')](_0x334f('0x6e'),JSON[_0x334f('0x23')](_0x5828b3));});};exports[_0x334f('0x72')]=function(_0x31359c,_0x337437,_0x505bba,_0x6cffa4,_0x54ae1a,_0x3985cb){var _0x258b8b,_0x59d075,_0xb10f34,_0x38a5ed;_0x3985cb[_0x334f('0x52')]=intUtil[_0x334f('0x53')](_0x3985cb[_0x334f('0x52')]);_0x3985cb[_0x334f('0x54')]=intUtil[_0x334f('0x53')](_0x3985cb[_0x334f('0x54')]);def[_0x334f('0x55')]=util[_0x334f('0x24')]('%s/service/v4_1/rest.php',_0x3985cb['remoteUri']);if(_0x54ae1a&&_0x54ae1a[_0x334f('0x73')]){logger['info']('['+_0x337437[_0x334f('0x74')][_0x334f('0x75')]()+']',_0x334f('0x58'));_0x337437[_0x334f('0x59')]=util[_0x334f('0x24')](_0x334f('0x5a'),_0x3985cb[_0x334f('0x54')],_0x337437[_0x334f('0x5b')],md5(_0x337437[_0x334f('0x5b')]));}else{_0x337437[_0x334f('0x59')]='';}return getConnection(_0x3985cb)[_0x334f('0x2c')](function(_0xaf9b19){_0x38a5ed=_0xaf9b19;if(!_[_0x334f('0x29')](_0x6cffa4)){return getUser(_0x3985cb,_0x6cffa4[_0x334f('0x1b')],_0x38a5ed);}else{return getUser(_0x3985cb,null,_0x38a5ed);}})['then'](function(_0x225110){_0x258b8b=_0x225110;logger[_0x334f('0xf')](_0x334f('0x5c'),_0x258b8b['id']);return getEndUser(_0x3985cb,_0x337437[_0x334f('0x5d')],_0x337437[_0x334f('0x5e')],_0x38a5ed);})[_0x334f('0x2c')](function(_0x42ac33){_0x59d075=_0x42ac33;logger['info']('The\x20Enduser\x20ID\x20is:',_0x59d075['id']);return getTicket(_0x3985cb,_0x258b8b,_0x59d075,_0x505bba,_0x337437,_0x505bba[_0x334f('0x60')],_0x38a5ed,_0x334f('0x61'));})[_0x334f('0x2c')](function(_0x2b680d){_0xb10f34=_0x2b680d;logger[_0x334f('0xf')]('Ticket\x20created!');logger[_0x334f('0xf')](_0x334f('0x6c'),_0xb10f34['id']);return setRelationship(_0x38a5ed,_0x258b8b,_0xb10f34,'users');})['then'](function(){return setRelationship(_0x38a5ed,_0x59d075,_0xb10f34,_0x334f('0x63'));})[_0x334f('0x2c')](function(){return getServerInfo(_0x38a5ed);})[_0x334f('0x70')](function(_0x464fc2){logger['error']('['+_0x337437[_0x334f('0x74')][_0x334f('0x75')]()+']',JSON[_0x334f('0x23')](_0x464fc2));});}; \ No newline at end of file +var _0xa74a=['name','Subjects','assigned_user_id','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','toString','get_server_info','isNil','info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','entry_list','user_name','Agent\x20found!','value','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','Enduser\x20created.','merge','map','forEach','string','nameField','customField','toLowerCase','type','custom_fields','content','push','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','users','contacts','version','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','error','toUpperCase','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','socket.io-emitter','POST'];(function(_0x466068,_0x229e83){var _0x1b1bf3=function(_0x41f39a){while(--_0x41f39a){_0x466068['push'](_0x466068['shift']());}};_0x1b1bf3(++_0x229e83);}(_0xa74a,0x1bd));var _0xaa74=function(_0x2247a0,_0x314fb3){_0x2247a0=_0x2247a0-0x0;var _0x36067c=_0xa74a[_0x2247a0];return _0x36067c;};'use strict';var _=require(_0xaa74('0x0'));var rp=require('request-promise');var BPromise=require(_0xaa74('0x1'));var md5=require(_0xaa74('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xaa74('0x3'));var config=require(_0xaa74('0x4'));var logger=require(_0xaa74('0x5'))(_0xaa74('0x6'));config['redis']=_[_0xaa74('0x7')](config[_0xaa74('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xaa74('0x9'))(new Redis(config[_0xaa74('0x8')]));var def={'method':_0xaa74('0xa'),'json':!![]};function emit(_0x3a2a90,_0x27c772,_0x8fe562){io['to'](_0x3a2a90)['emit'](_0x27c772,_0x8fe562);}function getTicket(_0x223eef,_0x2c1a14,_0x186c0a,_0x7e789d,_0x142ae6,_0x4de8e0,_0x17ccdb,_0x472937){logger['info']('Creating\x20new\x20ticket...');var _0x3d5125=new Date();var _0x416dae=[{'name':_0xaa74('0xb'),'value':intUtil['getString'](_0x7e789d[_0xaa74('0xc')],_0x142ae6,'\x20')},{'name':_0xaa74('0xd'),'value':_0x2c1a14['id']},{'name':'created_by','value':_0x2c1a14['id']},{'name':'description','value':intUtil[_0xaa74('0xe')](_0x7e789d[_0xaa74('0xf')],_0x142ae6,'\x0a')},{'name':_0xaa74('0x10'),'value':_0x3d5125[_0xaa74('0x11')]()[_0xaa74('0x12')](0x0,0x13)[_0xaa74('0x13')]('T','\x20')},{'name':_0xaa74('0x14'),'value':'0'},{'name':_0xaa74('0x15'),'value':'15'},{'name':_0xaa74('0x16'),'value':_0x186c0a['id']},{'name':_0xaa74('0x17'),'value':'Contacts'},{'name':_0xaa74('0x18'),'value':_0x186c0a['name']},{'name':'direction','value':_0x472937}];if(_0x4de8e0[_0xaa74('0x19')]){_['forEach'](_0x4de8e0,function(_0x22977e){if(_0x142ae6[_0x22977e[_0xaa74('0x1a')]]){_0x416dae['push']({'name':_0x22977e[_0xaa74('0x1b')],'value':_0x142ae6[_0x22977e['variableName']]});}});}return request({'form':{'method':_0xaa74('0x1c'),'input_type':_0xaa74('0x1d'),'response_type':_0xaa74('0x1d'),'rest_data':JSON[_0xaa74('0x1e')]({'session':_0x17ccdb['id'],'module_name':'Calls','name_value_list':_0x416dae})}});}function getAuth(_0x225c84){return util[_0xaa74('0x1f')](_0xaa74('0x20'),new Buffer(_0x225c84['apiKey']+':X')[_0xaa74('0x21')]('base64'));}function getServerInfo(_0x4f7943){return request({'form':{'method':_0xaa74('0x22'),'input_type':'JSON','response_type':_0xaa74('0x1d'),'rest_data':JSON[_0xaa74('0x1e')]({'session':_0x4f7943['id']})}});}function getUser(_0x1bd7fe,_0x307b86,_0x1196d9){if(!_[_0xaa74('0x23')](_0x307b86)){logger[_0xaa74('0x24')]('Getting\x20agent\x20with\x20name',_0x307b86);return request({'form':{'method':_0xaa74('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xaa74('0x1e')]({'session':_0x1196d9['id'],'module_name':_0xaa74('0x26'),'query':util[_0xaa74('0x1f')](_0xaa74('0x27'),_0x307b86),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaa74('0x28')](function(_0x5a35ff){if(_0x5a35ff['entry_list'][_0xaa74('0x19')]){var _0x58be29=_[_0xaa74('0x29')](_0x5a35ff[_0xaa74('0x2a')],function(_0x4dc982){return _0x4dc982['name_value_list'][_0xaa74('0x2b')]['value']===_0x307b86;});if(_0x58be29){logger['info'](_0xaa74('0x2c'));return BPromise['resolve']({'id':_0x58be29['name_value_list']['id'][_0xaa74('0x2d')],'name':_0x58be29[_0xaa74('0x2e')][_0xaa74('0xb')][_0xaa74('0x2d')]});}}logger[_0xaa74('0x24')](_0xaa74('0x2f'));return BPromise[_0xaa74('0x30')]({'id':_0x1196d9[_0xaa74('0x2e')][_0xaa74('0x31')][_0xaa74('0x2d')],'name':_0x1196d9[_0xaa74('0x2e')][_0xaa74('0x2b')][_0xaa74('0x2d')]});});}else{logger['info'](_0xaa74('0x32'));return BPromise[_0xaa74('0x30')]({'id':_0x1196d9['name_value_list'][_0xaa74('0x31')]['value'],'name':_0x1196d9[_0xaa74('0x2e')]['user_name'][_0xaa74('0x2d')]});}}function getEndUser(_0x2811db,_0x516f11,_0x418830,_0xba7fc5){logger[_0xaa74('0x24')](_0xaa74('0x33'),_0x418830);return request({'form':{'method':_0xaa74('0x25'),'input_type':_0xaa74('0x1d'),'response_type':_0xaa74('0x1d'),'rest_data':JSON[_0xaa74('0x1e')]({'session':_0xba7fc5['id'],'module_name':_0xaa74('0x34'),'query':util[_0xaa74('0x1f')](_0xaa74('0x35'),_0x418830),'order_by':'','offset':'0','select_fields':['id',_0xaa74('0xb'),_0xaa74('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2bd0cf){if(_0x2bd0cf[_0xaa74('0x2a')]['length']){var _0x5347bb=_['find'](_0x2bd0cf[_0xaa74('0x2a')],function(_0x4d636a){return _0x4d636a[_0xaa74('0x2e')][_0xaa74('0x36')][_0xaa74('0x2d')]===_0x418830;});if(_0x5347bb){logger[_0xaa74('0x24')](_0xaa74('0x37'));return BPromise[_0xaa74('0x30')]({'id':_0x5347bb[_0xaa74('0x2e')]['id'][_0xaa74('0x2d')],'name':_0x5347bb[_0xaa74('0x2e')]['name'][_0xaa74('0x2d')],'phone':_0x5347bb[_0xaa74('0x2e')][_0xaa74('0x36')][_0xaa74('0x2d')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xaa74('0x1c'),'input_type':_0xaa74('0x1d'),'response_type':'JSON','rest_data':JSON[_0xaa74('0x1e')]({'session':_0xba7fc5['id'],'module_name':'Contacts','name_value_list':[{'name':_0xaa74('0x38'),'value':_0x516f11!==''?_0x516f11:util[_0xaa74('0x1f')]('Caller\x20-\x20%s',_0x418830)},{'name':_0xaa74('0x36'),'value':_0x418830}]})}})[_0xaa74('0x28')](function(_0x4e296c){logger[_0xaa74('0x24')](_0xaa74('0x39'));return BPromise['resolve']({'id':_0x4e296c['id'],'name':_0x4e296c['entry_list'][_0xaa74('0x38')][_0xaa74('0x2d')],'phone':_0x4e296c[_0xaa74('0x2a')][_0xaa74('0x36')]['value']});});}});}function request(_0x1f009f){logger['debug']('[HTTP]',JSON[_0xaa74('0x1e')](_0x1f009f));return rp(_[_0xaa74('0x3a')](def,_0x1f009f));}function getTags(_0x179540,_0x24c867){var _0x41ace4=[];if(_0x179540&&_0x179540[_0xaa74('0x19')]>0x0){_0x41ace4=_[_0xaa74('0x3b')](_0x179540,_0x24c867);}return _0x41ace4;}function getCustomFields(_0x1d60d2,_0x7b5b68){var _0x52f147=[];var _0x463a6a={'custom_fields':[]};if(_0x1d60d2['length']>0x0){_[_0xaa74('0x3c')](_0x1d60d2,function(_0x1c7eb9){if(_0x1c7eb9['type']===_0xaa74('0x3d')&&_0x1c7eb9[_0xaa74('0x3e')]&&!_0x1c7eb9[_0xaa74('0x3f')]){_0x463a6a[_0x1c7eb9[_0xaa74('0x3e')][_0xaa74('0x40')]()]=_0x1c7eb9['content'][_0xaa74('0x21')]();}else if(_0x1c7eb9[_0xaa74('0x41')]==='string'&&_0x1c7eb9[_0xaa74('0x1b')]&&_0x1c7eb9[_0xaa74('0x3f')]){_0x463a6a[_0xaa74('0x42')]['push']({'id':_0x1c7eb9[_0xaa74('0x1b')],'value':_0x1c7eb9[_0xaa74('0x43')][_0xaa74('0x21')]()});}else if(_0x1c7eb9[_0xaa74('0x41')]==='variable'&&_0x1c7eb9['variableName']&&_0x1c7eb9['idField']&&_0x1c7eb9['customField']){_0x7b5b68[_0x1c7eb9[_0xaa74('0x1a')]]&&_0x463a6a[_0xaa74('0x42')][_0xaa74('0x44')]({'id':_0x1c7eb9['idField'],'value':_0x7b5b68[_0x1c7eb9['variableName']][_0xaa74('0x21')]()});}else if(_0x1c7eb9[_0xaa74('0x41')]===_0xaa74('0x45')&&_0x1c7eb9[_0xaa74('0x46')]&&_0x1c7eb9[_0xaa74('0x46')]['name']&&_0x1c7eb9['idField']&&_0x1c7eb9['customField']){_0x7b5b68[_0x1c7eb9['Variable'][_0xaa74('0xb')][_0xaa74('0x40')]()]&&_0x463a6a[_0xaa74('0x42')]['push']({'id':_0x1c7eb9[_0xaa74('0x1b')],'value':_0x7b5b68[_0x1c7eb9[_0xaa74('0x46')][_0xaa74('0xb')][_0xaa74('0x40')]()][_0xaa74('0x21')]()});}});}return _0x463a6a;}function getConnection(_0x3e4d67){return request({'method':'POST','form':{'method':_0xaa74('0x47'),'input_type':_0xaa74('0x1d'),'response_type':_0xaa74('0x1d'),'rest_data':JSON[_0xaa74('0x1e')]({'user_auth':{'user_name':_0x3e4d67[_0xaa74('0x48')],'password':_0x3e4d67[_0xaa74('0x49')],'encryption':'PLAIN'},'application':_0xaa74('0x4a')})}})[_0xaa74('0x28')](function(_0x442bf8){var _0x298640=_0x442bf8;if(_0x298640['id']){def[_0xaa74('0x4b')]=_0x298640['id'];return BPromise[_0xaa74('0x30')](_0x298640);}else{throw new Error(util[_0xaa74('0x1f')](_0xaa74('0x4c'),_0x3e4d67['id']));}});}function setRelationship(_0xae0d41,_0x1e8ace,_0x2fb175,_0x49ed0c){return request({'form':{'method':_0xaa74('0x4d'),'input_type':_0xaa74('0x1d'),'response_type':_0xaa74('0x1d'),'rest_data':JSON[_0xaa74('0x1e')]({'session':_0xae0d41['id'],'module_name':_0xaa74('0x4e'),'module_id':_0x2fb175['id'],'link_field_name':_0x49ed0c,'related_ids':[_0x1e8ace['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xaa74('0x4f')]=function(_0x3a8d42,_0x39ac4a,_0x1d46a5,_0x56183f,_0x1549d9,_0x55e63e){var _0x56f836,_0x14963a,_0x50ab43,_0x4ecc9f;_0x55e63e['remoteUri']=intUtil[_0xaa74('0x50')](_0x55e63e[_0xaa74('0x51')]);_0x55e63e['serverUrl']=intUtil[_0xaa74('0x50')](_0x55e63e['serverUrl']);def[_0xaa74('0x52')]=util['format'](_0xaa74('0x53'),_0x55e63e[_0xaa74('0x51')]);if(_0x1549d9&&_0x1549d9[_0xaa74('0x54')]){logger['info'](_0xaa74('0x55'),'Recording\x20is\x20enabled!');_0x39ac4a['recordingURL']=util[_0xaa74('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55e63e['serverUrl'],_0x39ac4a['uniqueid'],md5(_0x39ac4a['uniqueid']));}else{_0x39ac4a[_0xaa74('0x56')]='';}return getConnection(_0x55e63e)[_0xaa74('0x28')](function(_0xd11fe7){_0x4ecc9f=_0xd11fe7;return getUser(_0x55e63e,_0x56183f[_0xaa74('0xb')],_0x4ecc9f);})[_0xaa74('0x28')](function(_0x1cad6c){_0x56f836=_0x1cad6c;logger[_0xaa74('0x24')]('The\x20User\x20ID\x20is:',_0x56f836['id']);return getEndUser(_0x55e63e,_0x39ac4a[_0xaa74('0x57')],_0x39ac4a[_0xaa74('0x58')],_0x4ecc9f);})[_0xaa74('0x28')](function(_0x2bafa6){_0x14963a=_0x2bafa6;logger[_0xaa74('0x24')](_0xaa74('0x59'),_0x14963a['id']);return getTicket(_0x55e63e,_0x56f836,_0x14963a,_0x1d46a5,_0x39ac4a,_0x1d46a5['Fields'],_0x4ecc9f,'Inbound');})['then'](function(_0x2e6705){_0x50ab43=_0x2e6705;logger[_0xaa74('0x24')]('Ticket\x20created!');logger[_0xaa74('0x24')](_0xaa74('0x5a'),_0x50ab43['id']);return setRelationship(_0x4ecc9f,_0x56f836,_0x50ab43,_0xaa74('0x5b'));})[_0xaa74('0x28')](function(){return setRelationship(_0x4ecc9f,_0x14963a,_0x50ab43,_0xaa74('0x5c'));})[_0xaa74('0x28')](function(){return getServerInfo(_0x4ecc9f);})[_0xaa74('0x28')](function(_0x41fe39){var _0x1a66d9=parseInt(_0x41fe39[_0xaa74('0x5d')]['charAt'](0x0));var _0x290ae4=util[_0xaa74('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x55e63e[_0xaa74('0x51')],_0x50ab43['id']);if(_0x1a66d9>0x6){_0x290ae4=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x55e63e[_0xaa74('0x51')],_0x50ab43['id']);}logger[_0xaa74('0x24')](_0xaa74('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaa74('0x1f')](_0xaa74('0x5e'),_0x56183f[_0xaa74('0xb')]),_0xaa74('0x5f'),{'uri':_0x290ae4});})['catch'](function(_0x3a7c00){logger['error']('[QUEUE]',JSON['stringify'](_0x3a7c00));});};exports[_0xaa74('0x60')]=function(_0x107c85,_0x53ae7c,_0x17e2e8,_0x49ae18,_0x157867,_0x4e881c,_0x28d08c){var _0x399482,_0x3f0511,_0x331fe7,_0x4ff190;_0x4e881c['remoteUri']=intUtil[_0xaa74('0x50')](_0x4e881c[_0xaa74('0x51')]);_0x4e881c[_0xaa74('0x61')]=intUtil['stripTrailingSlash'](_0x4e881c[_0xaa74('0x61')]);def[_0xaa74('0x52')]=util[_0xaa74('0x1f')](_0xaa74('0x53'),_0x4e881c[_0xaa74('0x51')]);if(_0x28d08c&&_0x28d08c['recordingFormat']&&_0x28d08c[_0xaa74('0x62')]!=='none'){logger[_0xaa74('0x24')](_0xaa74('0x63'),'Recording\x20is\x20enabled!');_0x53ae7c['recordingURL']=util[_0xaa74('0x1f')](_0xaa74('0x64'),_0x4e881c[_0xaa74('0x61')],_0x53ae7c[_0xaa74('0x65')],md5(_0x53ae7c[_0xaa74('0x65')]));}return getConnection(_0x4e881c)[_0xaa74('0x28')](function(_0x2d55c0){_0x4ff190=_0x2d55c0;return getUser(_0x4e881c,_0x49ae18['name'],_0x4ff190);})[_0xaa74('0x28')](function(_0x5572c6){_0x399482=_0x5572c6;logger[_0xaa74('0x24')](_0xaa74('0x66'),_0x399482['id']);return getEndUser(_0x4e881c,_0x53ae7c[_0xaa74('0x67')],_0x53ae7c[_0xaa74('0x68')],_0x4ff190);})['then'](function(_0x4578cb){_0x3f0511=_0x4578cb;logger[_0xaa74('0x24')]('The\x20Enduser\x20ID\x20is:',_0x3f0511['id']);return getTicket(_0x4e881c,_0x399482,_0x3f0511,_0x17e2e8,_0x53ae7c,_0x17e2e8[_0xaa74('0x69')],_0x4ff190,_0xaa74('0x6a'));})[_0xaa74('0x28')](function(_0x4e0d22){_0x331fe7=_0x4e0d22;logger['info']('Ticket\x20created!');logger[_0xaa74('0x24')](_0xaa74('0x5a'),_0x331fe7['id']);return setRelationship(_0x4ff190,_0x399482,_0x331fe7,_0xaa74('0x5b'));})[_0xaa74('0x28')](function(){return setRelationship(_0x4ff190,_0x3f0511,_0x331fe7,_0xaa74('0x5c'));})[_0xaa74('0x28')](function(){return getServerInfo(_0x4ff190);})[_0xaa74('0x28')](function(_0x29e6ed){var _0x2a8ad2=parseInt(_0x29e6ed[_0xaa74('0x5d')][_0xaa74('0x6b')](0x0));var _0xd472cf=util[_0xaa74('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4e881c[_0xaa74('0x51')],_0x331fe7['id']);if(_0x2a8ad2>0x6){_0xd472cf=util['format'](_0xaa74('0x6c'),_0x4e881c[_0xaa74('0x51')],_0x331fe7['id']);}logger['info']('[OUTBOUND]',_0xaa74('0x6d'));emit(util[_0xaa74('0x1f')](_0xaa74('0x5e'),_0x49ae18['name']),_0xaa74('0x5f'),{'uri':_0xd472cf});})['catch'](function(_0x10b43c){logger['error']('[OUTBOUND]',JSON[_0xaa74('0x1e')](_0x10b43c));});};exports[_0xaa74('0x6e')]=function(_0x4b4fa1,_0x3e162,_0x59881b,_0x3747a1,_0x39cc06,_0x37bd0f){var _0x16cdeb,_0x2c77f9,_0x123d8f,_0x580a48;_0x37bd0f[_0xaa74('0x51')]=intUtil[_0xaa74('0x50')](_0x37bd0f[_0xaa74('0x51')]);_0x37bd0f[_0xaa74('0x61')]=intUtil[_0xaa74('0x50')](_0x37bd0f[_0xaa74('0x61')]);def['uri']=util[_0xaa74('0x1f')](_0xaa74('0x53'),_0x37bd0f['remoteUri']);if(_0x39cc06&&_0x39cc06['monitor_format']){logger[_0xaa74('0x24')]('['+_0x3e162[_0xaa74('0x6f')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3e162[_0xaa74('0x56')]=util['format'](_0xaa74('0x64'),_0x37bd0f[_0xaa74('0x61')],_0x3e162[_0xaa74('0x65')],md5(_0x3e162['uniqueid']));}else{_0x3e162['recordingURL']='';}return getConnection(_0x37bd0f)['then'](function(_0x2f3aaf){_0x580a48=_0x2f3aaf;if(!_[_0xaa74('0x23')](_0x3747a1)){return getUser(_0x37bd0f,_0x3747a1[_0xaa74('0xb')],_0x580a48);}else{return getUser(_0x37bd0f,null,_0x580a48);}})[_0xaa74('0x28')](function(_0x1b792b){_0x16cdeb=_0x1b792b;logger[_0xaa74('0x24')](_0xaa74('0x66'),_0x16cdeb['id']);return getEndUser(_0x37bd0f,_0x3e162[_0xaa74('0x57')],_0x3e162[_0xaa74('0x58')],_0x580a48);})[_0xaa74('0x28')](function(_0x4ee8d8){_0x2c77f9=_0x4ee8d8;logger[_0xaa74('0x24')]('The\x20Enduser\x20ID\x20is:',_0x2c77f9['id']);return getTicket(_0x37bd0f,_0x16cdeb,_0x2c77f9,_0x59881b,_0x3e162,_0x59881b['Fields'],_0x580a48,'Inbound');})['then'](function(_0x1c7e0b){_0x123d8f=_0x1c7e0b;logger[_0xaa74('0x24')]('Ticket\x20created!');logger[_0xaa74('0x24')](_0xaa74('0x5a'),_0x123d8f['id']);return setRelationship(_0x580a48,_0x16cdeb,_0x123d8f,'users');})[_0xaa74('0x28')](function(){return setRelationship(_0x580a48,_0x2c77f9,_0x123d8f,_0xaa74('0x5c'));})[_0xaa74('0x28')](function(){return getServerInfo(_0x580a48);})['catch'](function(_0x498f20){logger[_0xaa74('0x70')]('['+_0x3e162['lastevent'][_0xaa74('0x71')]()+']',JSON['stringify'](_0x498f20));});}; \ 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 1982815..f19d3aa 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 _0x3e66=['toLowerCase','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','getString','length','sortBy','string','push','content','type','variable','variableName','customVariable','Variable','name','toString','keyValue','keyType','format','%s:\x20%s','key','keyContent'];(function(_0x14648d,_0x3a2102){var _0x9da71d=function(_0x106e17){while(--_0x106e17){_0x14648d['push'](_0x14648d['shift']());}};_0x9da71d(++_0x3a2102);}(_0x3e66,0x19d));var _0x63e6=function(_0x3b2531,_0x2a8cbb){_0x3b2531=_0x3b2531-0x0;var _0x5b08e3=_0x3e66[_0x3b2531];return _0x5b08e3;};'use strict';var _=require('lodash');var util=require('util');exports[_0x63e6('0x0')]=function(_0x2742da,_0x4ce9d9,_0x49e479){var _0x3ca82a=[];if(_0x2742da[_0x63e6('0x1')]>0x0){var _0x49430b=_[_0x63e6('0x2')](_0x2742da,['id']);for(var _0x4c3a11=0x0;_0x4c3a11<_0x49430b[_0x63e6('0x1')];_0x4c3a11++){var _0x139681=_0x49430b[_0x4c3a11];if(_0x139681['type']===_0x63e6('0x3')){_0x3ca82a[_0x63e6('0x4')](_0x139681[_0x63e6('0x5')]);}else if(_0x139681[_0x63e6('0x6')]===_0x63e6('0x7')&&_0x139681['variableName']){_0x4ce9d9[_0x139681[_0x63e6('0x8')]]&&_0x3ca82a[_0x63e6('0x4')](_0x4ce9d9[_0x139681['variableName']]['toString']());}else if(_0x139681[_0x63e6('0x6')]===_0x63e6('0x9')&&_0x139681[_0x63e6('0xa')]&&_0x139681[_0x63e6('0xa')][_0x63e6('0xb')]){_0x4ce9d9[_0x139681[_0x63e6('0xa')]['name']['toLowerCase']()]&&_0x3ca82a[_0x63e6('0x4')](_0x4ce9d9[_0x139681[_0x63e6('0xa')][_0x63e6('0xb')]['toLowerCase']()][_0x63e6('0xc')]());}else if(_0x139681[_0x63e6('0x6')]===_0x63e6('0xd')){if(_0x139681[_0x63e6('0xe')]===_0x63e6('0x3')&&_0x139681['key']){_0x3ca82a['push'](util[_0x63e6('0xf')](_0x63e6('0x10'),_0x139681[_0x63e6('0x11')],_0x139681[_0x63e6('0x12')]));}else if(_0x139681[_0x63e6('0xe')]===_0x63e6('0x7')&&_0x139681[_0x63e6('0x8')]&&_0x139681[_0x63e6('0x11')]){_0x4ce9d9[_0x139681[_0x63e6('0x8')]]&&_0x3ca82a['push'](util[_0x63e6('0xf')](_0x63e6('0x10'),_0x139681['key'],_0x4ce9d9[_0x139681[_0x63e6('0x8')]]));}else if(_0x139681[_0x63e6('0xe')]==='customVariable'&&_0x139681['Variable']&&_0x139681[_0x63e6('0xa')][_0x63e6('0xb')]&&_0x139681['key']){_0x4ce9d9[_0x139681[_0x63e6('0xa')][_0x63e6('0xb')]['toLowerCase']()]&&_0x3ca82a[_0x63e6('0x4')](util[_0x63e6('0xf')](_0x63e6('0x10'),_0x139681[_0x63e6('0x11')],_0x4ce9d9[_0x139681[_0x63e6('0xa')][_0x63e6('0xb')][_0x63e6('0x13')]()]));}}}}return _0x3ca82a[_0x63e6('0x14')](_0x49e479);};exports[_0x63e6('0x15')]=function(_0x52cc2a){var _0x31835c=_0x52cc2a[_0x63e6('0x16')](-0x1);if(_0x31835c==='/'){_0x52cc2a=_0x52cc2a[_0x63e6('0x17')](0x0,_0x52cc2a['lastIndexOf'](_0x31835c));}return _0x52cc2a;};exports[_0x63e6('0x18')]=function(_0x2bca07){if(!_[_0x63e6('0x19')](_0x2bca07)&&_0x2bca07!==''){var _0x1f3ece=/^(([^<>()\[\]\\.,;:\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 _0x1f3ece[_0x63e6('0x1a')](String(_0x2bca07)[_0x63e6('0x13')]());}else{return![];}}; \ No newline at end of file +var _0x1753=['test','lodash','util','sortBy','length','type','string','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','variable','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x1753,0x1a1));var _0x3175=function(_0x26dd62,_0x215a9b){_0x26dd62=_0x26dd62-0x0;var _0x413844=_0x1753[_0x26dd62];return _0x413844;};'use strict';var _=require(_0x3175('0x0'));var util=require(_0x3175('0x1'));exports['getString']=function(_0x4f780f,_0x2e3e74,_0x40e895){var _0x593072=[];if(_0x4f780f['length']>0x0){var _0x513000=_[_0x3175('0x2')](_0x4f780f,['id']);for(var _0x16ac44=0x0;_0x16ac44<_0x513000[_0x3175('0x3')];_0x16ac44++){var _0x422080=_0x513000[_0x16ac44];if(_0x422080[_0x3175('0x4')]===_0x3175('0x5')){_0x593072['push'](_0x422080['content']);}else if(_0x422080[_0x3175('0x4')]==='variable'&&_0x422080['variableName']){_0x2e3e74[_0x422080[_0x3175('0x6')]]&&_0x593072[_0x3175('0x7')](_0x2e3e74[_0x422080[_0x3175('0x6')]][_0x3175('0x8')]());}else if(_0x422080[_0x3175('0x4')]===_0x3175('0x9')&&_0x422080[_0x3175('0xa')]&&_0x422080[_0x3175('0xa')][_0x3175('0xb')]){_0x2e3e74[_0x422080[_0x3175('0xa')][_0x3175('0xb')]['toLowerCase']()]&&_0x593072[_0x3175('0x7')](_0x2e3e74[_0x422080['Variable']['name'][_0x3175('0xc')]()][_0x3175('0x8')]());}else if(_0x422080['type']===_0x3175('0xd')){if(_0x422080[_0x3175('0xe')]===_0x3175('0x5')&&_0x422080[_0x3175('0xf')]){_0x593072['push'](util[_0x3175('0x10')]('%s:\x20%s',_0x422080[_0x3175('0xf')],_0x422080[_0x3175('0x11')]));}else if(_0x422080[_0x3175('0xe')]===_0x3175('0x12')&&_0x422080['variableName']&&_0x422080[_0x3175('0xf')]){_0x2e3e74[_0x422080[_0x3175('0x6')]]&&_0x593072[_0x3175('0x7')](util['format'](_0x3175('0x13'),_0x422080[_0x3175('0xf')],_0x2e3e74[_0x422080['variableName']]));}else if(_0x422080[_0x3175('0xe')]===_0x3175('0x9')&&_0x422080[_0x3175('0xa')]&&_0x422080['Variable'][_0x3175('0xb')]&&_0x422080[_0x3175('0xf')]){_0x2e3e74[_0x422080['Variable']['name'][_0x3175('0xc')]()]&&_0x593072[_0x3175('0x7')](util['format'](_0x3175('0x13'),_0x422080['key'],_0x2e3e74[_0x422080['Variable']['name'][_0x3175('0xc')]()]));}}}}return _0x593072['join'](_0x40e895);};exports[_0x3175('0x14')]=function(_0x2b923e){var _0x6793a=_0x2b923e[_0x3175('0x15')](-0x1);if(_0x6793a==='/'){_0x2b923e=_0x2b923e[_0x3175('0x16')](0x0,_0x2b923e[_0x3175('0x17')](_0x6793a));}return _0x2b923e;};exports[_0x3175('0x18')]=function(_0xfd71e6){if(!_['isNil'](_0xfd71e6)&&_0xfd71e6!==''){var _0x57a0e3=/^(([^<>()\[\]\\.,;:\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 _0x57a0e3[_0x3175('0x19')](String(_0xfd71e6)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 709d9e9..cb06d67 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 0df543c..7710b8e 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 _0x29aa=['customVariable','Variable','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','merge','Tags','name','getString','Subjects','Descriptions','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','%s/users/me.json','then','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','results','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','end-user','Caller\x20-\x20%s','authType','password','%s:%s','token','username','base64','[HTTP]','stringify','GET','map','forEach','includes','nameField','toLowerCase','content','toString','string','picklist','idField','customField','push','type','variable','variableName','custom_fields'];(function(_0xc70dbf,_0x282a96){var _0x21114e=function(_0x5104b0){while(--_0x5104b0){_0xc70dbf['push'](_0xc70dbf['shift']());}};_0x21114e(++_0x282a96);}(_0x29aa,0x108));var _0xa29a=function(_0x48d960,_0x26ab67){_0x48d960=_0x48d960-0x0;var _0x2257ea=_0x29aa[_0x48d960];return _0x2257ea;};'use strict';var _=require(_0xa29a('0x0'));var rp=require('request-promise');var md5=require(_0xa29a('0x1'));var util=require(_0xa29a('0x2'));var Redis=require('ioredis');var intUtil=require(_0xa29a('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa29a('0x4'))(_0xa29a('0x5'));config[_0xa29a('0x6')]=_[_0xa29a('0x7')](config[_0xa29a('0x6')],{'host':_0xa29a('0x8'),'port':0x18eb});var io=require(_0xa29a('0x9'))(new Redis(config[_0xa29a('0x6')]));function emit(_0x38e0ef,_0x585829,_0x2d6b49){io['to'](_0x38e0ef)['emit'](_0x585829,_0x2d6b49);}var headers={'Content-Type':_0xa29a('0xa'),'Accept':_0xa29a('0xa')};function getTicket(_0x434cb6,_0x4e176b,_0x4687ca,_0x42b3d5,_0x5f2c18){logger[_0xa29a('0xb')](_0xa29a('0xc'));return request({'uri':util['format'](_0xa29a('0xd'),_0x434cb6['remoteUri']),'method':'POST','body':{'ticket':_[_0xa29a('0xe')]({'requester_id':_0x4687ca['id'],'submitter_id':_0x4e176b?_0x4e176b['id']:undefined,'assignee_id':_0x4e176b?_0x4e176b['id']:undefined,'tags':getTags(_0x42b3d5[_0xa29a('0xf')],_0xa29a('0x10')),'subject':intUtil[_0xa29a('0x11')](_0x42b3d5[_0xa29a('0x12')],_0x5f2c18,'\x20'),'description':intUtil[_0xa29a('0x11')](_0x42b3d5[_0xa29a('0x13')],_0x5f2c18,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa29a('0x11')](_0x42b3d5['Descriptions'],_0x5f2c18,'\x0a')}},getCustomFields(_0x42b3d5[_0xa29a('0x14')],_0x5f2c18))}})['then'](function(_0x4536a4){logger['info']('Ticket\x20created!');return _0x4536a4[_0xa29a('0x15')];});}function getUser(_0x503d28,_0xbba863){if(intUtil[_0xa29a('0x16')](_0xbba863)){logger[_0xa29a('0xb')](_0xa29a('0x17'),_0xbba863);return request({'uri':util[_0xa29a('0x18')](_0xa29a('0x19'),_0x503d28[_0xa29a('0x1a')]),'qs':{'query':util['format'](_0xa29a('0x1b'),_0xbba863)}})['then'](function(_0x1ecb70){if(_0x1ecb70[_0xa29a('0x1c')]){logger[_0xa29a('0xb')](_0xa29a('0x1d'));return _[_0xa29a('0x1e')](_0x1ecb70['results'],{'email':_0xbba863,'role':'agent'});}else{logger[_0xa29a('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa29a('0x18')](_0xa29a('0x1f'),_0x503d28[_0xa29a('0x1a')])})[_0xa29a('0x20')](function(_0x5289ec){logger['info'](_0xa29a('0x21'));return _0x5289ec[_0xa29a('0x22')];});}});}else{logger[_0xa29a('0xb')](_0xa29a('0x23'));return request({'uri':util[_0xa29a('0x18')](_0xa29a('0x1f'),_0x503d28['remoteUri'])})['then'](function(_0x4ae3b9){logger[_0xa29a('0xb')]('Admin\x20account\x20selected.');return _0x4ae3b9[_0xa29a('0x22')];});}}function getEndUser(_0x530a2f,_0x16ef2,_0x3a106c){logger[_0xa29a('0xb')](_0xa29a('0x24'),_0x3a106c);return request({'uri':util[_0xa29a('0x18')](_0xa29a('0x19'),_0x530a2f[_0xa29a('0x1a')]),'qs':{'query':util[_0xa29a('0x18')]('type:user\x20role:end-user\x20phone:%s',_0x3a106c)}})['then'](function(_0x2e34a2){var _0x1b0f81;if(_0x2e34a2[_0xa29a('0x25')][_0xa29a('0x26')]){_0x2e34a2[_0xa29a('0x25')]=_[_0xa29a('0x27')](_0x2e34a2['results'],{'suspended':![],'role':'end-user'});if(_0x2e34a2['results'][_0xa29a('0x26')]){_0x1b0f81=_[_0xa29a('0x28')](_0x2e34a2[_0xa29a('0x25')]);}}if(_0x1b0f81){logger[_0xa29a('0xb')](_0xa29a('0x29'));return _0x1b0f81;}else{logger[_0xa29a('0xb')](_0xa29a('0x2a'));return request({'uri':util[_0xa29a('0x18')](_0xa29a('0x2b'),_0x530a2f[_0xa29a('0x1a')]),'method':_0xa29a('0x2c'),'body':{'user':{'role':_0xa29a('0x2d'),'name':util[_0xa29a('0x18')](_0xa29a('0x2e'),_0x16ef2||_0x3a106c),'phone':_0x3a106c}}})[_0xa29a('0x20')](function(_0x1adec2){logger['info']('Enduser\x20created.');return _0x1adec2[_0xa29a('0x22')];});}});}function getAuth(_0x8c1ce3){var _0x6e3584;if(_0x8c1ce3[_0xa29a('0x2f')]===_0xa29a('0x30')){_0x6e3584=util[_0xa29a('0x18')](_0xa29a('0x31'),_0x8c1ce3['username'],_0x8c1ce3['password']);}else if(_0x8c1ce3[_0xa29a('0x2f')]===_0xa29a('0x32')){_0x6e3584=util['format']('%s/token:%s',_0x8c1ce3[_0xa29a('0x33')],_0x8c1ce3['token']);}return util['format']('Basic\x20%s',new Buffer(_0x6e3584)['toString'](_0xa29a('0x34')));}function request(_0x52039e){logger['debug'](_0xa29a('0x35'),JSON[_0xa29a('0x36')](_0x52039e));return rp(_[_0xa29a('0x7')](_0x52039e,{'method':_0xa29a('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x56c5d5,_0x501388){var _0x20078b=[];if(_0x56c5d5&&_0x56c5d5['length']>0x0){_0x20078b=_[_0xa29a('0x38')](_0x56c5d5,_0x501388);}return _0x20078b;}function getCustomFields(_0x2822f8,_0x155656){var _0x4d958e=[];var _0x415876={'custom_fields':[]};if(_0x2822f8[_0xa29a('0x26')]>0x0){_[_0xa29a('0x39')](_0x2822f8,function(_0x14e9d4){if(_[_0xa29a('0x3a')](['string','picklist'],_0x14e9d4['type'])&&_0x14e9d4[_0xa29a('0x3b')]&&!_0x14e9d4['customField']){_0x415876[_0x14e9d4[_0xa29a('0x3b')][_0xa29a('0x3c')]()]=_0x14e9d4[_0xa29a('0x3d')][_0xa29a('0x3e')]();}else if(_['includes']([_0xa29a('0x3f'),_0xa29a('0x40')],_0x14e9d4['type'])&&_0x14e9d4[_0xa29a('0x41')]&&_0x14e9d4[_0xa29a('0x42')]){_0x415876['custom_fields'][_0xa29a('0x43')]({'id':_0x14e9d4[_0xa29a('0x41')],'value':_0x14e9d4['content']['toString']()});}else if(_0x14e9d4[_0xa29a('0x44')]===_0xa29a('0x45')&&_0x14e9d4[_0xa29a('0x46')]&&_0x14e9d4['idField']&&_0x14e9d4[_0xa29a('0x42')]){_0x155656[_0x14e9d4[_0xa29a('0x46')]]&&_0x415876[_0xa29a('0x47')][_0xa29a('0x43')]({'id':_0x14e9d4[_0xa29a('0x41')],'value':_0x155656[_0x14e9d4[_0xa29a('0x46')]][_0xa29a('0x3e')]()});}else if(_0x14e9d4['type']===_0xa29a('0x48')&&_0x14e9d4[_0xa29a('0x49')]&&_0x14e9d4[_0xa29a('0x49')][_0xa29a('0x10')]&&_0x14e9d4['idField']&&_0x14e9d4[_0xa29a('0x42')]){_0x155656[_0x14e9d4[_0xa29a('0x49')][_0xa29a('0x10')][_0xa29a('0x3c')]()]&&_0x415876[_0xa29a('0x47')][_0xa29a('0x43')]({'id':_0x14e9d4[_0xa29a('0x41')],'value':_0x155656[_0x14e9d4[_0xa29a('0x49')][_0xa29a('0x10')][_0xa29a('0x3c')]()][_0xa29a('0x3e')]()});}});}return _0x415876;}exports['queue']=function(_0x5761e4,_0x58b136,_0x2dc511,_0x5d90e2,_0x5639dd,_0x34fa71){var _0x16b078,_0x390076;_0x34fa71[_0xa29a('0x1a')]=intUtil[_0xa29a('0x4a')](_0x34fa71[_0xa29a('0x1a')]);_0x34fa71['serverUrl']=intUtil[_0xa29a('0x4a')](_0x34fa71['serverUrl']);if(_0x5639dd&&_0x5639dd[_0xa29a('0x4b')]){logger[_0xa29a('0xb')](_0xa29a('0x4c'),'Recording\x20is\x20enabled!');_0x58b136[_0xa29a('0x4d')]=util[_0xa29a('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34fa71[_0xa29a('0x4e')],_0x58b136[_0xa29a('0x4f')],md5(_0x58b136[_0xa29a('0x4f')]));}else{_0x58b136[_0xa29a('0x4d')]='';}headers[_0xa29a('0x50')]=getAuth(_0x34fa71);return getUser(_0x34fa71,_0x5d90e2[_0xa29a('0x51')])[_0xa29a('0x20')](function(_0x32a00a){_0x16b078=_0x32a00a;logger[_0xa29a('0xb')](_0xa29a('0x52'),_0x16b078['id']);return getEndUser(_0x34fa71,_0x58b136['calleridname'],_0x58b136[_0xa29a('0x53')]);})[_0xa29a('0x20')](function(_0x3137d8){_0x390076=_0x3137d8;logger[_0xa29a('0xb')](_0xa29a('0x54'),_0x390076['id']);return getTicket(_0x34fa71,_0x16b078,_0x390076,_0x2dc511,_0x58b136);})[_0xa29a('0x20')](function(_0x59ab01){if(_0x59ab01){logger[_0xa29a('0xb')]('The\x20Ticket\x20ID\x20is:',_0x59ab01['id']);switch(_0x34fa71[_0xa29a('0x44')]){case _0xa29a('0x55'):logger[_0xa29a('0xb')](_0xa29a('0x4c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa29a('0x18')](_0xa29a('0x56'),_0x34fa71[_0xa29a('0x1a')],_0x16b078['id'],_0x59ab01['id']),'method':_0xa29a('0x2c')});case'newTab':logger[_0xa29a('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa29a('0x57'),_0x5d90e2['name']),_0xa29a('0x58'),{'uri':util['format'](_0xa29a('0x59'),_0x34fa71[_0xa29a('0x1a')][_0xa29a('0x5a')](_0xa29a('0x5b'),''),_0x59ab01['id'])});break;default:logger['error']('[QUEUE]',_0xa29a('0x5c'));}}})['catch'](function(_0x42dd83){logger[_0xa29a('0x5d')](_0xa29a('0x5e'),util[_0xa29a('0x5f')](_0x42dd83,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x486630,_0x1726d1,_0x5e2e99,_0x3bba64,_0xc82a05,_0x41ab99,_0x113998){var _0x4ba6db,_0x5882b0;_0x41ab99[_0xa29a('0x1a')]=intUtil[_0xa29a('0x4a')](_0x41ab99[_0xa29a('0x1a')]);_0x41ab99[_0xa29a('0x4e')]=intUtil[_0xa29a('0x4a')](_0x41ab99['serverUrl']);if(_0x113998&&_0x113998['recordingFormat']&&_0x113998[_0xa29a('0x60')]!==_0xa29a('0x61')){logger[_0xa29a('0xb')](_0xa29a('0x62'),_0xa29a('0x63'));_0x1726d1[_0xa29a('0x4d')]=util[_0xa29a('0x18')](_0xa29a('0x64'),_0x41ab99[_0xa29a('0x4e')],_0x1726d1[_0xa29a('0x4f')],md5(_0x1726d1[_0xa29a('0x4f')]));}headers[_0xa29a('0x50')]=getAuth(_0x41ab99);return getUser(_0x41ab99,_0x3bba64[_0xa29a('0x51')])[_0xa29a('0x20')](function(_0x131045){_0x4ba6db=_0x131045;logger[_0xa29a('0xb')](_0xa29a('0x52'),_0x4ba6db['id']);return getEndUser(_0x41ab99,_0x1726d1['destcalleridname'],_0x1726d1[_0xa29a('0x65')]);})['then'](function(_0x4f8a00){_0x5882b0=_0x4f8a00;logger[_0xa29a('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5882b0['id']);return getTicket(_0x41ab99,_0x4ba6db,_0x5882b0,_0x5e2e99,_0x1726d1);})[_0xa29a('0x20')](function(_0x3eddb8){if(_0x3eddb8){logger[_0xa29a('0xb')](_0xa29a('0x66'),_0x3eddb8['id']);switch(_0x41ab99[_0xa29a('0x44')]){case _0xa29a('0x55'):logger[_0xa29a('0xb')]('[OUTBOUND]',_0xa29a('0x67'));return request({'uri':util[_0xa29a('0x18')](_0xa29a('0x56'),_0x41ab99[_0xa29a('0x1a')],_0x4ba6db['id'],_0x3eddb8['id']),'method':'POST'});case _0xa29a('0x68'):logger[_0xa29a('0xb')](_0xa29a('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa29a('0x57'),_0x3bba64[_0xa29a('0x10')]),_0xa29a('0x58'),{'uri':util[_0xa29a('0x18')]('%s/agent/tickets/%s',_0x41ab99[_0xa29a('0x1a')]['replace']('/api/v2',''),_0x3eddb8['id'])});break;default:logger[_0xa29a('0x5d')](_0xa29a('0x62'),_0xa29a('0x5c'));}}})['catch'](function(_0x2290cb){logger[_0xa29a('0x5d')](_0xa29a('0x69'),util[_0xa29a('0x5f')](_0x2290cb,{'showHidden':!![],'depth':null}));});};exports[_0xa29a('0x6a')]=function(_0x433a9a,_0x5f346a,_0x2d072c,_0x3faf65,_0x3bbde0,_0x502f32){var _0x5143c8,_0x19c2a3;_0x502f32[_0xa29a('0x1a')]=intUtil[_0xa29a('0x4a')](_0x502f32[_0xa29a('0x1a')]);_0x502f32[_0xa29a('0x4e')]=intUtil[_0xa29a('0x4a')](_0x502f32[_0xa29a('0x4e')]);if(_0x3bbde0&&_0x3bbde0[_0xa29a('0x4b')]){logger['info']('['+_0x5f346a[_0xa29a('0x6b')][_0xa29a('0x6c')]()+']',_0xa29a('0x63'));_0x5f346a[_0xa29a('0x4d')]=util[_0xa29a('0x18')](_0xa29a('0x64'),_0x502f32['serverUrl'],_0x5f346a[_0xa29a('0x4f')],md5(_0x5f346a[_0xa29a('0x4f')]));}else{_0x5f346a[_0xa29a('0x4d')]='';}headers['Authorization']=getAuth(_0x502f32);return getUser(_0x502f32)[_0xa29a('0x20')](function(_0x433f92){_0x5143c8=_0x433f92;logger[_0xa29a('0xb')](_0xa29a('0x52'),_0x5143c8['id']);return getEndUser(_0x502f32,_0x5f346a[_0xa29a('0x6d')],_0x5f346a[_0xa29a('0x53')]);})['then'](function(_0x4db08b){_0x19c2a3=_0x4db08b;logger[_0xa29a('0xb')](_0xa29a('0x54'),_0x19c2a3['id']);return getTicket(_0x502f32,_0x5143c8,_0x19c2a3,_0x2d072c,_0x5f346a);})[_0xa29a('0x20')](function(_0x544391){if(_0x544391){logger[_0xa29a('0xb')]('The\x20Ticket\x20ID\x20is:',_0x544391['id']);}})[_0xa29a('0x6e')](function(_0x3face3){logger[_0xa29a('0x5d')]('['+_0x5f346a['lastevent']['toUpperCase']()+']'+_0xa29a('0x6f'),util[_0xa29a('0x5f')](_0x3face3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4a61=['Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','email','destcalleridnum','newTab','replace','/api/v2','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','calleridnum','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','merge','Subjects','getString','Descriptions','Fields','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','then','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','Basic\x20%s','toString','base64','stringify','GET','includes','picklist','nameField','toLowerCase','content','string','type','idField','customField','custom_fields','push','variable','variableName'];(function(_0x1f8374,_0x53e7a8){var _0x133e81=function(_0x37523d){while(--_0x37523d){_0x1f8374['push'](_0x1f8374['shift']());}};_0x133e81(++_0x53e7a8);}(_0x4a61,0xf8));var _0x14a6=function(_0xdd42a5,_0x1f66f1){_0xdd42a5=_0xdd42a5-0x0;var _0xf5f90b=_0x4a61[_0xdd42a5];return _0xf5f90b;};'use strict';var _=require(_0x14a6('0x0'));var rp=require(_0x14a6('0x1'));var md5=require('md5');var util=require(_0x14a6('0x2'));var Redis=require(_0x14a6('0x3'));var intUtil=require(_0x14a6('0x4'));var config=require(_0x14a6('0x5'));var logger=require(_0x14a6('0x6'))(_0x14a6('0x7'));config['redis']=_[_0x14a6('0x8')](config[_0x14a6('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x14a6('0x9')]));function emit(_0x1748c4,_0x288852,_0x17ead5){io['to'](_0x1748c4)['emit'](_0x288852,_0x17ead5);}var headers={'Content-Type':'application/json','Accept':_0x14a6('0xa')};function getTicket(_0x392735,_0x53d188,_0x1da51a,_0x4ba57d,_0x16b506){logger[_0x14a6('0xb')](_0x14a6('0xc'));return request({'uri':util['format']('%s/tickets.json',_0x392735[_0x14a6('0xd')]),'method':_0x14a6('0xe'),'body':{'ticket':_[_0x14a6('0xf')]({'requester_id':_0x1da51a['id'],'submitter_id':_0x53d188?_0x53d188['id']:undefined,'assignee_id':_0x53d188?_0x53d188['id']:undefined,'tags':getTags(_0x4ba57d['Tags'],'name'),'subject':intUtil['getString'](_0x4ba57d[_0x14a6('0x10')],_0x16b506,'\x20'),'description':intUtil[_0x14a6('0x11')](_0x4ba57d[_0x14a6('0x12')],_0x16b506,'\x0a'),'comment':{'public':![],'body':intUtil[_0x14a6('0x11')](_0x4ba57d['Descriptions'],_0x16b506,'\x0a')}},getCustomFields(_0x4ba57d[_0x14a6('0x13')],_0x16b506))}})['then'](function(_0x15754e){logger[_0x14a6('0xb')](_0x14a6('0x14'));return _0x15754e['ticket'];});}function getUser(_0x14663e,_0x57591c){if(intUtil[_0x14a6('0x15')](_0x57591c)){logger[_0x14a6('0xb')](_0x14a6('0x16'),_0x57591c);return request({'uri':util[_0x14a6('0x17')](_0x14a6('0x18'),_0x14663e[_0x14a6('0xd')]),'qs':{'query':util[_0x14a6('0x17')]('type:user\x20role:agent\x20email:%s',_0x57591c)}})[_0x14a6('0x19')](function(_0x13addc){if(_0x13addc['count']){logger['info']('Agent\x20found!');return _[_0x14a6('0x1a')](_0x13addc[_0x14a6('0x1b')],{'email':_0x57591c,'role':_0x14a6('0x1c')});}else{logger[_0x14a6('0xb')](_0x14a6('0x1d'));return request({'uri':util[_0x14a6('0x17')](_0x14a6('0x1e'),_0x14663e[_0x14a6('0xd')])})['then'](function(_0x5e006a){logger[_0x14a6('0xb')](_0x14a6('0x1f'));return _0x5e006a[_0x14a6('0x20')];});}});}else{logger[_0x14a6('0xb')](_0x14a6('0x1d'));return request({'uri':util[_0x14a6('0x17')](_0x14a6('0x1e'),_0x14663e['remoteUri'])})['then'](function(_0x53dabf){logger[_0x14a6('0xb')](_0x14a6('0x1f'));return _0x53dabf[_0x14a6('0x20')];});}}function getEndUser(_0x295759,_0x42a962,_0x1ff375){logger[_0x14a6('0xb')]('Searching\x20enduser\x20with\x20phone',_0x1ff375);return request({'uri':util['format'](_0x14a6('0x18'),_0x295759[_0x14a6('0xd')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x1ff375)}})['then'](function(_0x39fc5f){var _0x36c58b;if(_0x39fc5f['results'][_0x14a6('0x21')]){_0x39fc5f[_0x14a6('0x1b')]=_[_0x14a6('0x22')](_0x39fc5f[_0x14a6('0x1b')],{'suspended':![],'role':_0x14a6('0x23')});if(_0x39fc5f[_0x14a6('0x1b')][_0x14a6('0x21')]){_0x36c58b=_[_0x14a6('0x24')](_0x39fc5f[_0x14a6('0x1b')]);}}if(_0x36c58b){logger['info'](_0x14a6('0x25'));return _0x36c58b;}else{logger[_0x14a6('0xb')](_0x14a6('0x26'));return request({'uri':util[_0x14a6('0x17')](_0x14a6('0x27'),_0x295759[_0x14a6('0xd')]),'method':_0x14a6('0xe'),'body':{'user':{'role':_0x14a6('0x23'),'name':util['format'](_0x14a6('0x28'),_0x42a962||_0x1ff375),'phone':_0x1ff375}}})[_0x14a6('0x19')](function(_0x685c74){logger[_0x14a6('0xb')](_0x14a6('0x29'));return _0x685c74[_0x14a6('0x20')];});}});}function getAuth(_0xe5ff8d){var _0x2978e9;if(_0xe5ff8d[_0x14a6('0x2a')]===_0x14a6('0x2b')){_0x2978e9=util[_0x14a6('0x17')]('%s:%s',_0xe5ff8d[_0x14a6('0x2c')],_0xe5ff8d[_0x14a6('0x2b')]);}else if(_0xe5ff8d[_0x14a6('0x2a')]==='token'){_0x2978e9=util[_0x14a6('0x17')]('%s/token:%s',_0xe5ff8d[_0x14a6('0x2c')],_0xe5ff8d[_0x14a6('0x2d')]);}return util[_0x14a6('0x17')](_0x14a6('0x2e'),new Buffer(_0x2978e9)[_0x14a6('0x2f')](_0x14a6('0x30')));}function request(_0x76c75f){logger['debug']('[HTTP]',JSON[_0x14a6('0x31')](_0x76c75f));return rp(_[_0x14a6('0x8')](_0x76c75f,{'method':_0x14a6('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x346e1c,_0x2542e7){var _0x2a9b86=[];if(_0x346e1c&&_0x346e1c['length']>0x0){_0x2a9b86=_['map'](_0x346e1c,_0x2542e7);}return _0x2a9b86;}function getCustomFields(_0x4ac6bb,_0x11b9b3){var _0x56e906=[];var _0x13eca4={'custom_fields':[]};if(_0x4ac6bb[_0x14a6('0x21')]>0x0){_['forEach'](_0x4ac6bb,function(_0x3c30d8){if(_[_0x14a6('0x33')](['string',_0x14a6('0x34')],_0x3c30d8['type'])&&_0x3c30d8[_0x14a6('0x35')]&&!_0x3c30d8['customField']){_0x13eca4[_0x3c30d8['nameField'][_0x14a6('0x36')]()]=_0x3c30d8[_0x14a6('0x37')][_0x14a6('0x2f')]();}else if(_[_0x14a6('0x33')]([_0x14a6('0x38'),'picklist'],_0x3c30d8[_0x14a6('0x39')])&&_0x3c30d8[_0x14a6('0x3a')]&&_0x3c30d8[_0x14a6('0x3b')]){_0x13eca4[_0x14a6('0x3c')][_0x14a6('0x3d')]({'id':_0x3c30d8[_0x14a6('0x3a')],'value':_0x3c30d8['content'][_0x14a6('0x2f')]()});}else if(_0x3c30d8['type']===_0x14a6('0x3e')&&_0x3c30d8[_0x14a6('0x3f')]&&_0x3c30d8[_0x14a6('0x3a')]&&_0x3c30d8[_0x14a6('0x3b')]){_0x11b9b3[_0x3c30d8[_0x14a6('0x3f')]]&&_0x13eca4[_0x14a6('0x3c')][_0x14a6('0x3d')]({'id':_0x3c30d8[_0x14a6('0x3a')],'value':_0x11b9b3[_0x3c30d8[_0x14a6('0x3f')]][_0x14a6('0x2f')]()});}else if(_0x3c30d8[_0x14a6('0x39')]==='customVariable'&&_0x3c30d8[_0x14a6('0x40')]&&_0x3c30d8[_0x14a6('0x40')][_0x14a6('0x41')]&&_0x3c30d8['idField']&&_0x3c30d8[_0x14a6('0x3b')]){_0x11b9b3[_0x3c30d8[_0x14a6('0x40')][_0x14a6('0x41')][_0x14a6('0x36')]()]&&_0x13eca4[_0x14a6('0x3c')][_0x14a6('0x3d')]({'id':_0x3c30d8['idField'],'value':_0x11b9b3[_0x3c30d8[_0x14a6('0x40')][_0x14a6('0x41')][_0x14a6('0x36')]()][_0x14a6('0x2f')]()});}});}return _0x13eca4;}exports[_0x14a6('0x42')]=function(_0x204f80,_0x1ce0c0,_0x544762,_0x3a349c,_0x40d877,_0x1e89b7){var _0x35ec89,_0x3d14c4;_0x1e89b7['remoteUri']=intUtil['stripTrailingSlash'](_0x1e89b7['remoteUri']);_0x1e89b7[_0x14a6('0x43')]=intUtil[_0x14a6('0x44')](_0x1e89b7[_0x14a6('0x43')]);if(_0x40d877&&_0x40d877[_0x14a6('0x45')]){logger[_0x14a6('0xb')]('[QUEUE]',_0x14a6('0x46'));_0x1ce0c0[_0x14a6('0x47')]=util[_0x14a6('0x17')](_0x14a6('0x48'),_0x1e89b7[_0x14a6('0x43')],_0x1ce0c0[_0x14a6('0x49')],md5(_0x1ce0c0[_0x14a6('0x49')]));}else{_0x1ce0c0[_0x14a6('0x47')]='';}headers[_0x14a6('0x4a')]=getAuth(_0x1e89b7);return getUser(_0x1e89b7,_0x3a349c['email'])[_0x14a6('0x19')](function(_0x55831b){_0x35ec89=_0x55831b;logger['info'](_0x14a6('0x4b'),_0x35ec89['id']);return getEndUser(_0x1e89b7,_0x1ce0c0[_0x14a6('0x4c')],_0x1ce0c0['calleridnum']);})[_0x14a6('0x19')](function(_0x1c1399){_0x3d14c4=_0x1c1399;logger[_0x14a6('0xb')](_0x14a6('0x4d'),_0x3d14c4['id']);return getTicket(_0x1e89b7,_0x35ec89,_0x3d14c4,_0x544762,_0x1ce0c0);})[_0x14a6('0x19')](function(_0x20621e){if(_0x20621e){logger[_0x14a6('0xb')](_0x14a6('0x4e'),_0x20621e['id']);switch(_0x1e89b7[_0x14a6('0x39')]){case'integrationTab':logger[_0x14a6('0xb')](_0x14a6('0x4f'),_0x14a6('0x50'));return request({'uri':util['format'](_0x14a6('0x51'),_0x1e89b7[_0x14a6('0xd')],_0x35ec89['id'],_0x20621e['id']),'method':_0x14a6('0xe')});case'newTab':logger['info'](_0x14a6('0x4f'),_0x14a6('0x52'));emit(util[_0x14a6('0x17')](_0x14a6('0x53'),_0x3a349c[_0x14a6('0x41')]),_0x14a6('0x54'),{'uri':util[_0x14a6('0x17')](_0x14a6('0x55'),_0x1e89b7[_0x14a6('0xd')]['replace']('/api/v2',''),_0x20621e['id'])});break;default:logger[_0x14a6('0x56')](_0x14a6('0x4f'),_0x14a6('0x57'));}}})[_0x14a6('0x58')](function(_0x583e9b){logger[_0x14a6('0x56')](_0x14a6('0x59'),util[_0x14a6('0x5a')](_0x583e9b,{'showHidden':!![],'depth':null}));});};exports[_0x14a6('0x5b')]=function(_0x4f2a89,_0x1ec595,_0x66312c,_0x167267,_0x482fd3,_0x135f57,_0x34ca4c){var _0x2b8811,_0x38676b;_0x135f57['remoteUri']=intUtil['stripTrailingSlash'](_0x135f57[_0x14a6('0xd')]);_0x135f57['serverUrl']=intUtil[_0x14a6('0x44')](_0x135f57[_0x14a6('0x43')]);if(_0x34ca4c&&_0x34ca4c[_0x14a6('0x5c')]&&_0x34ca4c['recordingFormat']!==_0x14a6('0x5d')){logger[_0x14a6('0xb')]('[OUTBOUND]',_0x14a6('0x46'));_0x1ec595[_0x14a6('0x47')]=util[_0x14a6('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x135f57[_0x14a6('0x43')],_0x1ec595['uniqueid'],md5(_0x1ec595[_0x14a6('0x49')]));}headers[_0x14a6('0x4a')]=getAuth(_0x135f57);return getUser(_0x135f57,_0x167267[_0x14a6('0x5e')])['then'](function(_0x509dfa){_0x2b8811=_0x509dfa;logger[_0x14a6('0xb')](_0x14a6('0x4b'),_0x2b8811['id']);return getEndUser(_0x135f57,_0x1ec595['destcalleridname'],_0x1ec595[_0x14a6('0x5f')]);})['then'](function(_0x2992c4){_0x38676b=_0x2992c4;logger[_0x14a6('0xb')]('The\x20Enduser\x20ID\x20is:',_0x38676b['id']);return getTicket(_0x135f57,_0x2b8811,_0x38676b,_0x66312c,_0x1ec595);})[_0x14a6('0x19')](function(_0x401a00){if(_0x401a00){logger[_0x14a6('0xb')](_0x14a6('0x4e'),_0x401a00['id']);switch(_0x135f57[_0x14a6('0x39')]){case'integrationTab':logger[_0x14a6('0xb')]('[OUTBOUND]',_0x14a6('0x50'));return request({'uri':util[_0x14a6('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x135f57[_0x14a6('0xd')],_0x2b8811['id'],_0x401a00['id']),'method':_0x14a6('0xe')});case _0x14a6('0x60'):logger[_0x14a6('0xb')]('[OUTBOUND]',_0x14a6('0x52'));emit(util['format'](_0x14a6('0x53'),_0x167267[_0x14a6('0x41')]),_0x14a6('0x54'),{'uri':util['format'](_0x14a6('0x55'),_0x135f57['remoteUri'][_0x14a6('0x61')](_0x14a6('0x62'),''),_0x401a00['id'])});break;default:logger[_0x14a6('0x56')](_0x14a6('0x63'),_0x14a6('0x57'));}}})[_0x14a6('0x58')](function(_0x1956ac){logger[_0x14a6('0x56')](_0x14a6('0x64'),util[_0x14a6('0x5a')](_0x1956ac,{'showHidden':!![],'depth':null}));});};exports[_0x14a6('0x65')]=function(_0x430a97,_0x3951de,_0x3a75f8,_0x3801a7,_0x4e4a79,_0x1621d3){var _0x55d603,_0x4648a3;_0x1621d3[_0x14a6('0xd')]=intUtil['stripTrailingSlash'](_0x1621d3['remoteUri']);_0x1621d3[_0x14a6('0x43')]=intUtil[_0x14a6('0x44')](_0x1621d3['serverUrl']);if(_0x4e4a79&&_0x4e4a79[_0x14a6('0x45')]){logger[_0x14a6('0xb')]('['+_0x3951de['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3951de[_0x14a6('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1621d3[_0x14a6('0x43')],_0x3951de[_0x14a6('0x49')],md5(_0x3951de[_0x14a6('0x49')]));}else{_0x3951de[_0x14a6('0x47')]='';}headers['Authorization']=getAuth(_0x1621d3);return getUser(_0x1621d3)[_0x14a6('0x19')](function(_0x56c68d){_0x55d603=_0x56c68d;logger[_0x14a6('0xb')](_0x14a6('0x4b'),_0x55d603['id']);return getEndUser(_0x1621d3,_0x3951de[_0x14a6('0x4c')],_0x3951de[_0x14a6('0x66')]);})[_0x14a6('0x19')](function(_0x1a0afb){_0x4648a3=_0x1a0afb;logger[_0x14a6('0xb')](_0x14a6('0x4d'),_0x4648a3['id']);return getTicket(_0x1621d3,_0x55d603,_0x4648a3,_0x3a75f8,_0x3951de);})[_0x14a6('0x19')](function(_0x3a31ba){if(_0x3a31ba){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3a31ba['id']);}})[_0x14a6('0x58')](function(_0x2c6171){logger[_0x14a6('0x56')]('['+_0x3951de['lastevent'][_0x14a6('0x67')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2c6171,{'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 6231a14..598a7b0 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 _0x149c=['recordingURL','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','none','com','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','Recording\x20is\x20enabled!','lodash','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','toString','variableName','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','SUCCESS','details','Error:\x20','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','Call_Result','Called','connect','rejected','Rejected','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stripTrailingSlash','monitor_format','[QUEUE]'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x149c,0x143));var _0xc149=function(_0xa72212,_0x445431){_0xa72212=_0xa72212-0x0;var _0x1a53bb=_0x149c[_0xa72212];return _0x1a53bb;};'use strict';var _=require(_0xc149('0x0'));var rp=require('request-promise');var md5=require(_0xc149('0x1'));var util=require(_0xc149('0x2'));var intUtil=require(_0xc149('0x3'));var moment=require('moment');var Redis=require(_0xc149('0x4'));var BPromise=require(_0xc149('0x5'));var config=require(_0xc149('0x6'));var logger=require(_0xc149('0x7'))(_0xc149('0x8'));config[_0xc149('0x9')]=_[_0xc149('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc149('0xb'))(new Redis(config[_0xc149('0x9')]));function emit(_0x3a1739,_0x1d9eca,_0x26ae44){io['to'](_0x3a1739)[_0xc149('0xc')](_0x1d9eca,_0x26ae44);}function request(_0x25fb58){logger[_0xc149('0xd')](_0xc149('0xe'),JSON[_0xc149('0xf')](_0x25fb58));return rp(_0x25fb58);}function getCustomFields(_0x123352,_0x3fc283){var _0x2bc423={};if(_0x123352[_0xc149('0x10')]>0x0){_[_0xc149('0x11')](_0x123352,function(_0x3a18ca){if(_[_0xc149('0x12')]([_0xc149('0x13'),'picklist'],_0x3a18ca[_0xc149('0x14')])&&_0x3a18ca['idField']){_0x2bc423[_0x3a18ca[_0xc149('0x15')]]=_0x3a18ca['content'][_0xc149('0x16')]();}else if(_0x3a18ca[_0xc149('0x14')]==='variable'&&_0x3a18ca['variableName']&&_0x3a18ca[_0xc149('0x15')]&&_0x3fc283[_0x3a18ca[_0xc149('0x17')]]){_0x2bc423[_0x3a18ca[_0xc149('0x15')]]=_0x3fc283[_0x3a18ca[_0xc149('0x17')]][_0xc149('0x16')]();}else if(_0x3a18ca[_0xc149('0x14')]==='customVariable'&&_0x3a18ca[_0xc149('0x18')]&&_0x3a18ca[_0xc149('0x18')][_0xc149('0x19')]&&_0x3a18ca[_0xc149('0x15')]&&_0x3fc283[_0x3a18ca[_0xc149('0x18')]['name'][_0xc149('0x1a')]()]){_0x2bc423[_0x3a18ca[_0xc149('0x15')]]=_0x3fc283[_0x3a18ca[_0xc149('0x18')][_0xc149('0x19')][_0xc149('0x1a')]()][_0xc149('0x16')]();}});}return _0x2bc423;}function getName(_0x550b86){if(_0x550b86[_0xc149('0x1b')]('\x20')>0x0){var _0x393d4f=_0x550b86['split'](/ (.+)/);if(_0x393d4f[0x1]){return _0x393d4f;}}return[_0x550b86,_0x550b86];}var accountsTokens={};function getAccessToken(_0x586ea8){return new Promise(function(_0x1800cb,_0x3de104){if(!_[_0xc149('0x1c')](accountsTokens[_0x586ea8['id']])&&!_[_0xc149('0x1c')](accountsTokens[_0x586ea8['id']][_0xc149('0x1d')])){if(moment()[_0xc149('0x1e')](accountsTokens[_0x586ea8['id']][_0xc149('0x1f')])){_0x1800cb(accountsTokens[_0x586ea8['id']]['access_token']);}}var _0x50ed2e;switch(_0x586ea8[_0xc149('0x20')]){case'US':_0x50ed2e='https://accounts.zoho.com';break;case'AU':_0x50ed2e='https://accounts.zoho.com.au';break;case'EU':_0x50ed2e=_0xc149('0x21');break;case'IN':_0x50ed2e='https://accounts.zoho.in';break;case'CN':_0x50ed2e=_0xc149('0x22');break;default:_0x50ed2e='https://accounts.zoho.eu';break;}var _0x15777f={'method':_0xc149('0x23'),'uri':_0x50ed2e+_0xc149('0x24'),'qs':{'refresh_token':_0x586ea8[_0xc149('0x25')],'client_id':_0x586ea8[_0xc149('0x26')],'client_secret':_0x586ea8[_0xc149('0x27')],'grant_type':_0xc149('0x28')},'json':!![]};return rp(_0x15777f)['then'](function(_0x2d2700){accountsTokens[_0x586ea8['id']]={'access_token':_0x2d2700['access_token'],'expires_in':moment()[_0xc149('0x29')](_0x2d2700[_0xc149('0x1f')],_0xc149('0x2a'))};_0x1800cb(_0x2d2700[_0xc149('0x1d')]);})[_0xc149('0x2b')](function(_0x2f02be){logger[_0xc149('0x2c')](_0xc149('0x2d'),_0x2f02be[_0xc149('0x2e')]);_0x3de104(_0x2f02be);});});}function getUser(_0x34ffd9,_0x2ef998,_0x524b1e,_0x7b9227){logger[_0xc149('0x2f')]('Search\x20user');return request({'method':_0xc149('0x30'),'uri':util['format'](_0xc149('0x31'),_0x2ef998),'qs':{'type':_0xc149('0x32')},'headers':{'Authorization':_0xc149('0x33')+_0x34ffd9},'json':!![]})[_0xc149('0x34')](function(_0x217e18){if(_0x217e18[_0xc149('0x35')]){var _0x46027c=-0x1;if(_[_0xc149('0x36')](_0x217e18[_0xc149('0x35')])){if(!_['isNil'](_0x7b9227)){_0x46027c=_[_0xc149('0x37')](_0x217e18[_0xc149('0x35')],function(_0x479c36){return _0x479c36[_0xc149('0x38')]===_0x7b9227;});}if(_0x46027c>=0x0){logger[_0xc149('0x2f')](_0xc149('0x39'));}else{logger['info'](_0xc149('0x3a'));_0x46027c=_[_0xc149('0x37')](_0x217e18[_0xc149('0x35')],function(_0x137646){return _0x137646[_0xc149('0x3b')]['name']==='Administrator';});}return _0x217e18[_0xc149('0x35')][_0x46027c];}else{if(_0x217e18['user'][_0xc149('0x3b')][_0xc149('0x19')]===_0xc149('0x3c')){logger[_0xc149('0x2f')](_0xc149('0x3a'));user=_0x217e18[_0xc149('0x3d')];return user;}else{logger[_0xc149('0x2c')](_0xc149('0x3e'),JSON[_0xc149('0xf')](_0x217e18));throw new Error(_0xc149('0x3f')+JSON['stringify'](_0x217e18));}}}else{logger[_0xc149('0x2c')](_0xc149('0x3e'),JSON[_0xc149('0xf')](_0x217e18));throw new Error(_0xc149('0x3f')+JSON[_0xc149('0xf')](_0x217e18));}})[_0xc149('0x2b')](function(_0x18a204){console[_0xc149('0x2c')](_0x18a204);});}function getZohoUser(_0x2e15e0,_0x420645){return new BPromise(function(_0x4e34e4,_0x2d524e){request(_0x2e15e0)['then'](function(_0x4934e1){var _0x51fd06=null;if(_0x4934e1){_0x51fd06=_0x4934e1['data'][0x0];_0x51fd06[_0xc149('0x40')]=_0x420645;}_0x4e34e4(_0x51fd06);})[_0xc149('0x2b')](function(_0x1f57b4){_0x2d524e(_0x1f57b4);});});}function createEndUser(_0xb9561f,_0x3d4e67,_0x1b4de8,_0x234ae3,_0xa6d75d,_0x525fc6){var _0x1b4de8=getName(_0x1b4de8);return request({'method':_0xc149('0x23'),'uri':_0xc149('0x41')+_0x3d4e67+'/crm/v2/'+_[_0xc149('0x42')](_0x525fc6[_0xc149('0x43')])+'s','body':{'data':[{'Last_Name':_0x1b4de8[0x1],'First_Name':_0x1b4de8[0x0],'Phone':_0x234ae3,'Owner':{'name':!_[_0xc149('0x1c')](_0xa6d75d[_0xc149('0x44')]['name'])?_0xa6d75d[_0xc149('0x44')][_0xc149('0x19')]:!_[_0xc149('0x1c')](_0xa6d75d[_0xc149('0x45')])?_0xa6d75d[_0xc149('0x45')]+'\x20'+_0xa6d75d['last_name']:_0xa6d75d[_0xc149('0x46')],'id':_0xa6d75d['id']}}]},'headers':{'Authorization':_0xc149('0x33')+_0xb9561f},'json':!![]})[_0xc149('0x34')](function(_0x162f3a){if(_0x162f3a&&_0x162f3a[_0xc149('0x47')][0x0]['code']===_0xc149('0x48')){var _0x13efd7=_0x162f3a[_0xc149('0x47')][0x0][_0xc149('0x49')];_0x13efd7[_0xc149('0x40')]=_[_0xc149('0x42')](_0x525fc6[_0xc149('0x43')])+'s';return _0x13efd7;}logger[_0xc149('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xc149('0xf')](data));throw new Error(_0xc149('0x4a')+JSON['stringify'](data));})['catch'](function(_0x43a41b){console[_0xc149('0x4b')]('CREATE\x20ERROR',_0x43a41b);});}function getEndUser(_0x1638e2,_0x3d8fec,_0x294638,_0x2ecb3c,_0x5a0126,_0x2e8ed0,_0x40f5f6){var _0x885361={'method':_0xc149('0x30'),'uri':'','headers':{'Authorization':_0xc149('0x33')+_0x1638e2},'json':!![]};switch(_0x40f5f6['moduleSearch']){case _0xc149('0x4c'):_0x885361[_0xc149('0x4d')]=_0xc149('0x41')+_0x3d8fec+_0xc149('0x4e')+_0x5a0126+'))';return getZohoUser(_0x885361,_0xc149('0x4f'))[_0xc149('0x34')](function(_0x4673eb){if(_0x4673eb)return _0x4673eb;_0x885361['uri']=_0xc149('0x41')+_0x3d8fec+_0xc149('0x50')+_0x5a0126+'))';return getZohoUser(_0x885361,_0xc149('0x51'))[_0xc149('0x34')](function(_0x429b11){if(_0x429b11)return _0x429b11;if(_0x40f5f6['moduleCreate']!=_0xc149('0x52')){return createEndUser(_0x1638e2,_0x3d8fec,_0x2ecb3c,_0x5a0126,_0x2e8ed0,_0x40f5f6);}else{return{};}});});break;case _0xc149('0x53'):_0x885361['uri']=_0xc149('0x41')+_0x3d8fec+_0xc149('0x4e')+_0x5a0126+'))';return getZohoUser(_0x885361,_0xc149('0x4f'))[_0xc149('0x34')](function(_0x1fb432){if(_0x1fb432)return _0x1fb432;if(_0x40f5f6[_0xc149('0x43')]!=_0xc149('0x52')){return createEndUser(_0x1638e2,_0x3d8fec,_0x2ecb3c,_0x5a0126,_0x2e8ed0,_0x40f5f6);}else{return{};}});break;case _0xc149('0x54'):_0x885361[_0xc149('0x4d')]=_0xc149('0x41')+_0x3d8fec+_0xc149('0x50')+_0x5a0126+'))';return getZohoUser(_0x885361,_0xc149('0x51'))[_0xc149('0x34')](function(_0xaa8c97){if(_0xaa8c97)return _0xaa8c97;if(_0x40f5f6[_0xc149('0x43')]!='nothing'){return createEndUser(_0x1638e2,_0x3d8fec,_0x2ecb3c,_0x5a0126,_0x2e8ed0,_0x40f5f6);}else{return{};}});break;}}function getCall(_0x579db6,_0x5e8a4f,_0x471b10,_0x43557e,_0x8969af,_0x516354,_0x1444f5,_0x1ac0c0){logger[_0xc149('0x2f')](_0xc149('0x55'));var _0x412b6d={};_0x412b6d['Owner']={'name':!_[_0xc149('0x1c')](_0x43557e['role']['name'])&&!_[_0xc149('0x1c')](_0x43557e[_0xc149('0x3b')][_0xc149('0x19')])&&_0x43557e[_0xc149('0x3b')][_0xc149('0x19')]===_0xc149('0x56')?_0x43557e['role'][_0xc149('0x19')]:!_[_0xc149('0x1c')](_0x43557e[_0xc149('0x45')])?_0x43557e['first_name']+'\x20'+_0x43557e[_0xc149('0x46')]:_0x43557e[_0xc149('0x46')],'id':_0x43557e['id']};_0x412b6d[_0xc149('0x57')]=intUtil[_0xc149('0x58')](_0x516354[_0xc149('0x59')],_0x1444f5,'\x20');_0x412b6d['Description']=intUtil[_0xc149('0x58')](_0x516354[_0xc149('0x5a')],_0x1444f5,'\x0a');if(_0x8969af[_0xc149('0x40')]==='Contacts'){_0x412b6d[_0xc149('0x5b')]={'name':!_[_0xc149('0x1c')](_0x8969af[_0xc149('0x5c')])?_0x8969af[_0xc149('0x5c')]:!_[_0xc149('0x1c')](_0x8969af['First_Name'])?_0x8969af[_0xc149('0x5d')]+'\x20'+_0x8969af[_0xc149('0x5e')]:_0x8969af[_0xc149('0x5e')],'id':_0x8969af['id']};}if(_0x8969af[_0xc149('0x40')]===_0xc149('0x51')){_0x412b6d[_0xc149('0x5f')]={'name':!_[_0xc149('0x1c')](_0x8969af[_0xc149('0x5c')])?_0x8969af['Full_Name']:!_[_0xc149('0x1c')](_0x8969af['First_Name'])?_0x8969af['First_Name']+'\x20'+_0x8969af[_0xc149('0x5e')]:_0x8969af[_0xc149('0x5e')],'id':_0x8969af['id']};_0x412b6d[_0xc149('0x60')]=_[_0xc149('0x42')](_0x8969af['enduserType']);}if(_0x1444f5[_0xc149('0x61')]){_0x412b6d[_0xc149('0x62')]=moment[_0xc149('0x63')](parseInt(_0x1444f5[_0xc149('0x61')])*0x3e8)[_0xc149('0x64')](_0xc149('0x65'));}else if(_0x1444f5[_0xc149('0x66')]&&_0x1444f5[_0xc149('0x67')]){_0x412b6d['Call_Duration']=moment[_0xc149('0x63')](moment(_0x1444f5[_0xc149('0x67')],_0xc149('0x68'))['diff'](moment(_0x1444f5[_0xc149('0x69')],'YYYY-MM-DDTHH:mm:ss')))[_0xc149('0x64')](_0xc149('0x65'));}switch(_0x1444f5[_0xc149('0x6a')]){case'called':_0x412b6d[_0xc149('0x6b')]=_0xc149('0x6c');break;case'complete':case _0xc149('0x6d'):_0x412b6d['Call_Result']='Answered';break;case _0xc149('0x6e'):_0x412b6d[_0xc149('0x6b')]=_0xc149('0x6f');break;case'abandoned':_0x412b6d[_0xc149('0x6b')]=_0xc149('0x70');break;case _0xc149('0x71'):_0x412b6d['Call_Result']='Timeout';default:}_0x412b6d[_0xc149('0x72')]=(_0x1ac0c0===_0xc149('0x73')?moment(_0x1444f5['starttime'])[_0xc149('0x64')](_0xc149('0x68')):moment(_0x1444f5[_0xc149('0x74')])[_0xc149('0x64')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xc149('0x64')](_0xc149('0x68'));_0x412b6d[_0xc149('0x75')]=_0x1ac0c0||_0xc149('0x76');_0x412b6d=_[_0xc149('0x77')](_0x412b6d,getCustomFields(_0x516354[_0xc149('0x78')],_0x1444f5));return request({'method':_0xc149('0x23'),'uri':_0xc149('0x41')+_0x5e8a4f+_0xc149('0x79'),'headers':{'Authorization':_0xc149('0x33')+_0x579db6},'body':{'data':[_0x412b6d]},'json':!![]})[_0xc149('0x34')](function(_0x518a12){if(_0x518a12&&_0x518a12['data'][0x0]['code']===_0xc149('0x48')){logger['info'](_0xc149('0x7a'));return{'id':_0x518a12[_0xc149('0x47')][0x0][_0xc149('0x49')]['id']};}})[_0xc149('0x2b')](function(_0x2b6f85){logger[_0xc149('0x2f')](_0xc149('0x7b'),_0x2b6f85[_0xc149('0x2e')]);console[_0xc149('0x4b')]('err',_0x2b6f85);});}exports['queue']=function(_0x5eef74,_0x296494,_0x3c54b5,_0x842463,_0xaed35a,_0x439d5d){var _0xef5740,_0x4208b2,_0x1d3d76;_0x439d5d['host']=intUtil[_0xc149('0x7c')](_0x439d5d['host']);_0x439d5d['serverUrl']=intUtil[_0xc149('0x7c')](_0x439d5d['serverUrl']);if(_0xaed35a&&_0xaed35a[_0xc149('0x7d')]){logger[_0xc149('0x2f')](_0xc149('0x7e'),'Recording\x20is\x20enabled!');_0x296494[_0xc149('0x7f')]=_0x439d5d[_0xc149('0x80')]+_0xc149('0x81')+_0x296494[_0xc149('0x82')]+_0xc149('0x83')+md5(_0x296494['uniqueid']);}else{_0x296494[_0xc149('0x7f')]='';}var _0x227d00=_0x439d5d[_0xc149('0x84')]===_0xc149('0x85')?'eu':'com';return getAccessToken(_0x439d5d)[_0xc149('0x34')](function(_0x3e9fa5){_0x1d3d76=_0x3e9fa5;return getUser(_0x1d3d76,_0x227d00,_0x439d5d,_0x842463[_0xc149('0x38')]);})[_0xc149('0x34')](function(_0x11a935){_0xef5740=_0x11a935;logger[_0xc149('0x2f')](_0xc149('0x86'),_0xef5740['id']);return getEndUser(_0x1d3d76,_0x227d00,_0x439d5d,_0x296494[_0xc149('0x87')],_0x296494[_0xc149('0x88')],_0xef5740,_0x3c54b5);})['then'](function(_0x5c2560){_0x4208b2=_0x5c2560;return getCall(_0x1d3d76,_0x227d00,_0x439d5d,_0xef5740,_0x4208b2,_0x3c54b5,_0x296494,_0xc149('0x76'));})['then'](function(_0x3da8da){if(_0x3da8da){logger[_0xc149('0x2f')](_0xc149('0x89'),_0x3da8da['id']);logger[_0xc149('0x2f')](_0xc149('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc149('0x64')]('user:%s',_0x842463[_0xc149('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x439d5d['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x3da8da['id']});}})[_0xc149('0x2b')](function(_0xafef11){logger[_0xc149('0x2c')]('[QUEUE]',JSON['stringify'](_0xafef11));});};exports['outbound']=function(_0x22f095,_0x2a99ba,_0x20308f,_0x8901ed,_0x37bc40,_0x4b64a3,_0x2763dc){var _0x3cd33a,_0x467678,_0x8b9f48;_0x4b64a3[_0xc149('0x84')]=intUtil['stripTrailingSlash'](_0x4b64a3[_0xc149('0x84')]);_0x4b64a3[_0xc149('0x80')]=intUtil[_0xc149('0x7c')](_0x4b64a3[_0xc149('0x80')]);if(_0x2763dc&&_0x2763dc['recordingFormat']&&_0x2763dc['recordingFormat']!==_0xc149('0x8a')){logger[_0xc149('0x2f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2a99ba['recordingURL']=_0x4b64a3[_0xc149('0x80')]+_0xc149('0x81')+_0x2a99ba[_0xc149('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x2a99ba['uniqueid']);}var _0x1dadb4=_0x4b64a3['host']===_0xc149('0x85')?'eu':_0xc149('0x8b');return getAccessToken(_0x4b64a3)[_0xc149('0x34')](function(_0x49f209){_0x8b9f48=_0x49f209;return getUser(_0x8b9f48,_0x1dadb4,_0x4b64a3,_0x8901ed[_0xc149('0x38')]);})[_0xc149('0x34')](function(_0x2a6cb1){_0x3cd33a=_0x2a6cb1;logger[_0xc149('0x2f')](_0xc149('0x86'),_0x3cd33a['id']);return getEndUser(_0x8b9f48,_0x1dadb4,_0x4b64a3,_0x2a99ba[_0xc149('0x8c')],_0x2a99ba[_0xc149('0x8d')],_0x3cd33a,_0x20308f);})[_0xc149('0x34')](function(_0x17965c){_0x467678=_0x17965c;return getCall(_0x8b9f48,_0x1dadb4,_0x4b64a3,_0x3cd33a,_0x467678,_0x20308f,_0x2a99ba,_0xc149('0x8e'));})['then'](function(_0xb632c4){if(_0xb632c4){logger[_0xc149('0x2f')](_0xc149('0x89'),_0xb632c4['id']);logger[_0xc149('0x2f')](_0xc149('0x8f'),_0xc149('0x90'));emit(util[_0xc149('0x64')]('user:%s',_0x8901ed[_0xc149('0x19')]),_0xc149('0x91'),{'uri':_0xc149('0x92')+_0x4b64a3[_0xc149('0x84')]+_0xc149('0x93')+_0xb632c4['id']});}})[_0xc149('0x2b')](function(_0x1c27a3){logger[_0xc149('0x2c')](_0xc149('0x8f'),JSON[_0xc149('0xf')](_0x1c27a3));});};exports['unmanaged']=function(_0x22d350,_0x3e8c8f,_0x25d4b7,_0x45f98d,_0x5bb31a,_0x51a2d6){var _0x2d0a11,_0x50939e,_0x237e57;_0x51a2d6[_0xc149('0x84')]=intUtil[_0xc149('0x7c')](_0x51a2d6[_0xc149('0x84')]);_0x51a2d6['serverUrl']=intUtil[_0xc149('0x7c')](_0x51a2d6[_0xc149('0x80')]);if(_0x5bb31a&&_0x5bb31a[_0xc149('0x7d')]){logger[_0xc149('0x2f')]('['+_0x3e8c8f[_0xc149('0x6a')][_0xc149('0x94')]()+']',_0xc149('0x95'));_0x3e8c8f[_0xc149('0x7f')]=_0x51a2d6[_0xc149('0x80')]+'/api/voice/recordings/'+_0x3e8c8f[_0xc149('0x82')]+_0xc149('0x83')+md5(_0x3e8c8f[_0xc149('0x82')]);}else{_0x3e8c8f[_0xc149('0x7f')]='';}var _0x45d60b=_0x51a2d6['host']===_0xc149('0x85')?'eu':_0xc149('0x8b');return getAccessToken(_0x51a2d6)[_0xc149('0x34')](function(_0x35dd4d){_0x237e57=_0x35dd4d;return getUser(_0x237e57,_0x45d60b,_0x51a2d6);})[_0xc149('0x34')](function(_0xd6c142){_0x2d0a11=_0xd6c142;logger[_0xc149('0x2f')](_0xc149('0x86'),_0x2d0a11['id']);return getEndUser(_0x237e57,_0x45d60b,_0x51a2d6,_0x3e8c8f[_0xc149('0x87')],_0x3e8c8f[_0xc149('0x88')],_0x2d0a11,_0x25d4b7);})[_0xc149('0x34')](function(_0x464440){_0x50939e=_0x464440;return getCall(_0x237e57,_0x45d60b,_0x51a2d6,_0x2d0a11,_0x50939e,_0x25d4b7,_0x3e8c8f,_0xc149('0x76'));})[_0xc149('0x34')](function(_0x328f11){if(_0x328f11){logger[_0xc149('0x2f')](_0xc149('0x89'),_0x328f11['id']);}})[_0xc149('0x2b')](function(_0xb28e9c){logger['error']('['+_0x3e8c8f[_0xc149('0x6a')][_0xc149('0x94')]()+']',JSON[_0xc149('0xf')](_0xb28e9c));});}; \ No newline at end of file +var _0xd601=['customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','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','clientSecret','refresh_token','add','catch','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','SUCCESS','moduleCreate','Error:\x20','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','called','Call_Result','complete','connect','Answered','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','picklist','type','idField','content','variable','variableName','toString'];(function(_0x2d5324,_0xe02bf6){var _0x3508d6=function(_0xaa5ae3){while(--_0xaa5ae3){_0x2d5324['push'](_0x2d5324['shift']());}};_0x3508d6(++_0xe02bf6);}(_0xd601,0x1bb));var _0x1d60=function(_0x1c8961,_0x5bb684){_0x1c8961=_0x1c8961-0x0;var _0x263438=_0xd601[_0x1c8961];return _0x263438;};'use strict';var _=require(_0x1d60('0x0'));var rp=require(_0x1d60('0x1'));var md5=require(_0x1d60('0x2'));var util=require(_0x1d60('0x3'));var intUtil=require(_0x1d60('0x4'));var moment=require('moment');var Redis=require(_0x1d60('0x5'));var BPromise=require(_0x1d60('0x6'));var config=require(_0x1d60('0x7'));var logger=require(_0x1d60('0x8'))(_0x1d60('0x9'));config[_0x1d60('0xa')]=_[_0x1d60('0xb')](config[_0x1d60('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x1d60('0xc'))(new Redis(config['redis']));function emit(_0x25f94a,_0x3f5f24,_0x10428b){io['to'](_0x25f94a)[_0x1d60('0xd')](_0x3f5f24,_0x10428b);}function request(_0x3bb739){logger[_0x1d60('0xe')](_0x1d60('0xf'),JSON[_0x1d60('0x10')](_0x3bb739));return rp(_0x3bb739);}function getCustomFields(_0x234acd,_0x93f046){var _0x261265={};if(_0x234acd[_0x1d60('0x11')]>0x0){_['forEach'](_0x234acd,function(_0x2bbf4d){if(_['includes'](['string',_0x1d60('0x12')],_0x2bbf4d[_0x1d60('0x13')])&&_0x2bbf4d[_0x1d60('0x14')]){_0x261265[_0x2bbf4d['idField']]=_0x2bbf4d[_0x1d60('0x15')]['toString']();}else if(_0x2bbf4d[_0x1d60('0x13')]===_0x1d60('0x16')&&_0x2bbf4d[_0x1d60('0x17')]&&_0x2bbf4d[_0x1d60('0x14')]&&_0x93f046[_0x2bbf4d[_0x1d60('0x17')]]){_0x261265[_0x2bbf4d[_0x1d60('0x14')]]=_0x93f046[_0x2bbf4d[_0x1d60('0x17')]][_0x1d60('0x18')]();}else if(_0x2bbf4d[_0x1d60('0x13')]===_0x1d60('0x19')&&_0x2bbf4d['Variable']&&_0x2bbf4d[_0x1d60('0x1a')][_0x1d60('0x1b')]&&_0x2bbf4d['idField']&&_0x93f046[_0x2bbf4d[_0x1d60('0x1a')]['name'][_0x1d60('0x1c')]()]){_0x261265[_0x2bbf4d[_0x1d60('0x14')]]=_0x93f046[_0x2bbf4d[_0x1d60('0x1a')]['name']['toLowerCase']()][_0x1d60('0x18')]();}});}return _0x261265;}function getName(_0x251512){if(_0x251512[_0x1d60('0x1d')]('\x20')>0x0){var _0x54fc28=_0x251512['split'](/ (.+)/);if(_0x54fc28[0x1]){return _0x54fc28;}}return[_0x251512,_0x251512];}var accountsTokens={};function getAccessToken(_0x465cec){return new Promise(function(_0x363166,_0x292e06){if(!_[_0x1d60('0x1e')](accountsTokens[_0x465cec['id']])&&!_[_0x1d60('0x1e')](accountsTokens[_0x465cec['id']][_0x1d60('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x465cec['id']]['expires_in'])){_0x363166(accountsTokens[_0x465cec['id']][_0x1d60('0x1f')]);}}var _0x3dc7d9;switch(_0x465cec[_0x1d60('0x20')]){case'US':_0x3dc7d9=_0x1d60('0x21');break;case'AU':_0x3dc7d9=_0x1d60('0x22');break;case'EU':_0x3dc7d9=_0x1d60('0x23');break;case'IN':_0x3dc7d9=_0x1d60('0x24');break;case'CN':_0x3dc7d9=_0x1d60('0x25');break;default:_0x3dc7d9='https://accounts.zoho.eu';break;}var _0x4fb65e={'method':_0x1d60('0x26'),'uri':_0x3dc7d9+_0x1d60('0x27'),'qs':{'refresh_token':_0x465cec[_0x1d60('0x28')],'client_id':_0x465cec['clientId'],'client_secret':_0x465cec[_0x1d60('0x29')],'grant_type':_0x1d60('0x2a')},'json':!![]};return rp(_0x4fb65e)['then'](function(_0x5bf691){accountsTokens[_0x465cec['id']]={'access_token':_0x5bf691[_0x1d60('0x1f')],'expires_in':moment()[_0x1d60('0x2b')](_0x5bf691['expires_in'],'seconds')};_0x363166(_0x5bf691[_0x1d60('0x1f')]);})[_0x1d60('0x2c')](function(_0x51f85b){logger['error']('Failing\x20creating\x20the\x20access_token',_0x51f85b[_0x1d60('0x2d')]);_0x292e06(_0x51f85b);});});}function getUser(_0x35d536,_0x59aa12,_0x200d3b,_0x58ff69){logger[_0x1d60('0x2e')]('Search\x20user');return request({'method':_0x1d60('0x2f'),'uri':util['format'](_0x1d60('0x30'),_0x59aa12),'qs':{'type':_0x1d60('0x31')},'headers':{'Authorization':_0x1d60('0x32')+_0x35d536},'json':!![]})[_0x1d60('0x33')](function(_0x155a54){if(_0x155a54['users']){var _0x4027ba=-0x1;if(_[_0x1d60('0x34')](_0x155a54[_0x1d60('0x35')])){if(!_['isNil'](_0x58ff69)){_0x4027ba=_['findIndex'](_0x155a54['users'],function(_0x9d1db2){return _0x9d1db2['email']===_0x58ff69;});}if(_0x4027ba>=0x0){logger[_0x1d60('0x2e')](_0x1d60('0x36'));}else{logger['info'](_0x1d60('0x37'));_0x4027ba=_[_0x1d60('0x38')](_0x155a54['users'],function(_0x391060){return _0x391060[_0x1d60('0x39')][_0x1d60('0x1b')]===_0x1d60('0x3a');});}return _0x155a54[_0x1d60('0x35')][_0x4027ba];}else{if(_0x155a54[_0x1d60('0x3b')][_0x1d60('0x39')][_0x1d60('0x1b')]==='Administrator'){logger[_0x1d60('0x2e')](_0x1d60('0x37'));user=_0x155a54['user'];return user;}else{logger[_0x1d60('0x3c')]('The\x20failing\x20result\x20is',JSON[_0x1d60('0x10')](_0x155a54));throw new Error(_0x1d60('0x3d')+JSON[_0x1d60('0x10')](_0x155a54));}}}else{logger[_0x1d60('0x3c')](_0x1d60('0x3e'),JSON[_0x1d60('0x10')](_0x155a54));throw new Error(_0x1d60('0x3d')+JSON[_0x1d60('0x10')](_0x155a54));}})[_0x1d60('0x2c')](function(_0x4de40b){console[_0x1d60('0x3c')](_0x4de40b);});}function getZohoUser(_0x4a2a77,_0x5cc4ca){return new BPromise(function(_0x4bf5e2,_0x118403){request(_0x4a2a77)[_0x1d60('0x33')](function(_0x143fc5){var _0x293378=null;if(_0x143fc5){_0x293378=_0x143fc5[_0x1d60('0x3f')][0x0];_0x293378[_0x1d60('0x40')]=_0x5cc4ca;}_0x4bf5e2(_0x293378);})[_0x1d60('0x2c')](function(_0x543f08){_0x118403(_0x543f08);});});}function createEndUser(_0x4b3b86,_0x1e7f0d,_0x52f3f0,_0x4be210,_0x5dd76a,_0x197bdd){var _0x52f3f0=getName(_0x52f3f0);return request({'method':'POST','uri':_0x1d60('0x41')+_0x1e7f0d+_0x1d60('0x42')+_[_0x1d60('0x43')](_0x197bdd['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x52f3f0[0x1],'First_Name':_0x52f3f0[0x0],'Phone':_0x4be210,'Owner':{'name':!_['isNil'](_0x5dd76a[_0x1d60('0x44')]['name'])?_0x5dd76a[_0x1d60('0x44')][_0x1d60('0x1b')]:!_[_0x1d60('0x1e')](_0x5dd76a[_0x1d60('0x45')])?_0x5dd76a[_0x1d60('0x45')]+'\x20'+_0x5dd76a[_0x1d60('0x46')]:_0x5dd76a[_0x1d60('0x46')],'id':_0x5dd76a['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4b3b86},'json':!![]})[_0x1d60('0x33')](function(_0x56d183){if(_0x56d183&&_0x56d183['data'][0x0]['code']===_0x1d60('0x47')){var _0x1d5647=_0x56d183['data'][0x0]['details'];_0x1d5647[_0x1d60('0x40')]=_[_0x1d60('0x43')](_0x197bdd[_0x1d60('0x48')])+'s';return _0x1d5647;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x1d60('0x10')](data));throw new Error(_0x1d60('0x49')+JSON[_0x1d60('0x10')](data));})['catch'](function(_0xdb58fa){console[_0x1d60('0x4a')](_0x1d60('0x4b'),_0xdb58fa);});}function getEndUser(_0x2d37e8,_0x5f02e3,_0x17b315,_0x4820ff,_0x5e9d2b,_0x5253c2,_0x379523){var _0x10dc25={'method':_0x1d60('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2d37e8},'json':!![]};switch(_0x379523['moduleSearch']){case _0x1d60('0x4c'):_0x10dc25['uri']=_0x1d60('0x41')+_0x5f02e3+_0x1d60('0x4d')+_0x5e9d2b+'))';return getZohoUser(_0x10dc25,_0x1d60('0x4e'))[_0x1d60('0x33')](function(_0x2ef228){if(_0x2ef228)return _0x2ef228;_0x10dc25[_0x1d60('0x4f')]=_0x1d60('0x41')+_0x5f02e3+_0x1d60('0x50')+_0x5e9d2b+'))';return getZohoUser(_0x10dc25,_0x1d60('0x51'))[_0x1d60('0x33')](function(_0x74acd){if(_0x74acd)return _0x74acd;if(_0x379523['moduleCreate']!=_0x1d60('0x52')){return createEndUser(_0x2d37e8,_0x5f02e3,_0x4820ff,_0x5e9d2b,_0x5253c2,_0x379523);}else{return{};}});});break;case _0x1d60('0x53'):_0x10dc25['uri']=_0x1d60('0x41')+_0x5f02e3+_0x1d60('0x4d')+_0x5e9d2b+'))';return getZohoUser(_0x10dc25,'Contacts')['then'](function(_0x5dcee3){if(_0x5dcee3)return _0x5dcee3;if(_0x379523[_0x1d60('0x48')]!=_0x1d60('0x52')){return createEndUser(_0x2d37e8,_0x5f02e3,_0x4820ff,_0x5e9d2b,_0x5253c2,_0x379523);}else{return{};}});break;case _0x1d60('0x54'):_0x10dc25[_0x1d60('0x4f')]=_0x1d60('0x41')+_0x5f02e3+_0x1d60('0x50')+_0x5e9d2b+'))';return getZohoUser(_0x10dc25,_0x1d60('0x51'))[_0x1d60('0x33')](function(_0x2640ce){if(_0x2640ce)return _0x2640ce;if(_0x379523[_0x1d60('0x48')]!='nothing'){return createEndUser(_0x2d37e8,_0x5f02e3,_0x4820ff,_0x5e9d2b,_0x5253c2,_0x379523);}else{return{};}});break;}}function getCall(_0x2929b1,_0x59cf2e,_0x4ef4fe,_0x16df25,_0x391b35,_0x56659e,_0xf652be,_0x599098){logger[_0x1d60('0x2e')](_0x1d60('0x55'));var _0x18fecb={};_0x18fecb[_0x1d60('0x56')]={'name':!_[_0x1d60('0x1e')](_0x16df25['role'][_0x1d60('0x1b')])&&!_[_0x1d60('0x1e')](_0x16df25[_0x1d60('0x39')][_0x1d60('0x1b')])&&_0x16df25['profile']['name']==='administrator'?_0x16df25[_0x1d60('0x44')][_0x1d60('0x1b')]:!_['isNil'](_0x16df25[_0x1d60('0x45')])?_0x16df25[_0x1d60('0x45')]+'\x20'+_0x16df25['last_name']:_0x16df25[_0x1d60('0x46')],'id':_0x16df25['id']};_0x18fecb[_0x1d60('0x57')]=intUtil[_0x1d60('0x58')](_0x56659e['Subjects'],_0xf652be,'\x20');_0x18fecb[_0x1d60('0x59')]=intUtil[_0x1d60('0x58')](_0x56659e[_0x1d60('0x5a')],_0xf652be,'\x0a');if(_0x391b35[_0x1d60('0x40')]===_0x1d60('0x4e')){_0x18fecb['Who_Id']={'name':!_[_0x1d60('0x1e')](_0x391b35[_0x1d60('0x5b')])?_0x391b35[_0x1d60('0x5b')]:!_[_0x1d60('0x1e')](_0x391b35['First_Name'])?_0x391b35[_0x1d60('0x5c')]+'\x20'+_0x391b35[_0x1d60('0x5d')]:_0x391b35['Last_Name'],'id':_0x391b35['id']};}if(_0x391b35[_0x1d60('0x40')]===_0x1d60('0x51')){_0x18fecb[_0x1d60('0x5e')]={'name':!_[_0x1d60('0x1e')](_0x391b35['Full_Name'])?_0x391b35[_0x1d60('0x5b')]:!_[_0x1d60('0x1e')](_0x391b35['First_Name'])?_0x391b35['First_Name']+'\x20'+_0x391b35[_0x1d60('0x5d')]:_0x391b35[_0x1d60('0x5d')],'id':_0x391b35['id']};_0x18fecb[_0x1d60('0x5f')]=_[_0x1d60('0x43')](_0x391b35['enduserType']);}if(_0xf652be[_0x1d60('0x60')]){_0x18fecb[_0x1d60('0x61')]=moment[_0x1d60('0x62')](parseInt(_0xf652be[_0x1d60('0x60')])*0x3e8)['format'](_0x1d60('0x63'));}else if(_0xf652be[_0x1d60('0x64')]&&_0xf652be[_0x1d60('0x65')]){_0x18fecb[_0x1d60('0x61')]=moment[_0x1d60('0x62')](moment(_0xf652be[_0x1d60('0x65')],_0x1d60('0x66'))[_0x1d60('0x67')](moment(_0xf652be[_0x1d60('0x68')],'YYYY-MM-DDTHH:mm:ss')))[_0x1d60('0x69')](_0x1d60('0x63'));}switch(_0xf652be[_0x1d60('0x6a')]){case _0x1d60('0x6b'):_0x18fecb[_0x1d60('0x6c')]='Called';break;case _0x1d60('0x6d'):case _0x1d60('0x6e'):_0x18fecb[_0x1d60('0x6c')]=_0x1d60('0x6f');break;case'rejected':_0x18fecb[_0x1d60('0x6c')]='Rejected';break;case'abandoned':_0x18fecb[_0x1d60('0x6c')]=_0x1d60('0x70');break;case _0x1d60('0x71'):_0x18fecb['Call_Result']=_0x1d60('0x72');default:}_0x18fecb[_0x1d60('0x73')]=(_0x599098==='outbound'?moment(_0xf652be[_0x1d60('0x68')])[_0x1d60('0x69')](_0x1d60('0x66')):moment(_0xf652be[_0x1d60('0x74')])[_0x1d60('0x69')](_0x1d60('0x66')))||moment()['format'](_0x1d60('0x66'));_0x18fecb[_0x1d60('0x75')]=_0x599098||_0x1d60('0x76');_0x18fecb=_[_0x1d60('0x77')](_0x18fecb,getCustomFields(_0x56659e[_0x1d60('0x78')],_0xf652be));return request({'method':_0x1d60('0x26'),'uri':'https://www.zohoapis.'+_0x59cf2e+_0x1d60('0x79'),'headers':{'Authorization':_0x1d60('0x32')+_0x2929b1},'body':{'data':[_0x18fecb]},'json':!![]})['then'](function(_0x83157c){if(_0x83157c&&_0x83157c[_0x1d60('0x3f')][0x0][_0x1d60('0x7a')]==='SUCCESS'){logger['info'](_0x1d60('0x7b'));return{'id':_0x83157c[_0x1d60('0x3f')][0x0][_0x1d60('0x7c')]['id']};}})['catch'](function(_0x3ee0a1){logger[_0x1d60('0x2e')](_0x1d60('0x7d'),_0x3ee0a1[_0x1d60('0x2d')]);console[_0x1d60('0x4a')](_0x1d60('0x7d'),_0x3ee0a1);});}exports[_0x1d60('0x7e')]=function(_0xe09784,_0x26d48a,_0x4e95c5,_0x931605,_0x2534ac,_0x438252){var _0x3dc86e,_0x36150f,_0x48adf8;_0x438252[_0x1d60('0x7f')]=intUtil[_0x1d60('0x80')](_0x438252['host']);_0x438252[_0x1d60('0x81')]=intUtil[_0x1d60('0x80')](_0x438252[_0x1d60('0x81')]);if(_0x2534ac&&_0x2534ac[_0x1d60('0x82')]){logger['info']('[QUEUE]',_0x1d60('0x83'));_0x26d48a[_0x1d60('0x84')]=_0x438252[_0x1d60('0x81')]+_0x1d60('0x85')+_0x26d48a[_0x1d60('0x86')]+_0x1d60('0x87')+md5(_0x26d48a[_0x1d60('0x86')]);}else{_0x26d48a['recordingURL']='';}var _0x283aed=_0x438252[_0x1d60('0x7f')]===_0x1d60('0x88')?'eu':_0x1d60('0x89');return getAccessToken(_0x438252)[_0x1d60('0x33')](function(_0x31de2a){_0x48adf8=_0x31de2a;return getUser(_0x48adf8,_0x283aed,_0x438252,_0x931605[_0x1d60('0x8a')]);})[_0x1d60('0x33')](function(_0x37274d){_0x3dc86e=_0x37274d;logger[_0x1d60('0x2e')](_0x1d60('0x8b'),_0x3dc86e['id']);return getEndUser(_0x48adf8,_0x283aed,_0x438252,_0x26d48a[_0x1d60('0x8c')],_0x26d48a[_0x1d60('0x8d')],_0x3dc86e,_0x4e95c5);})[_0x1d60('0x33')](function(_0x370b09){_0x36150f=_0x370b09;return getCall(_0x48adf8,_0x283aed,_0x438252,_0x3dc86e,_0x36150f,_0x4e95c5,_0x26d48a,_0x1d60('0x76'));})['then'](function(_0x4ce407){if(_0x4ce407){logger['info']('The\x20Call\x20ID\x20is:',_0x4ce407['id']);logger['info'](_0x1d60('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1d60('0x69')](_0x1d60('0x8f'),_0x931605[_0x1d60('0x1b')]),_0x1d60('0x90'),{'uri':_0x1d60('0x91')+_0x438252[_0x1d60('0x7f')]+_0x1d60('0x92')+_0x4ce407['id']});}})['catch'](function(_0x55f8b6){logger[_0x1d60('0x3c')](_0x1d60('0x8e'),JSON[_0x1d60('0x10')](_0x55f8b6));});};exports['outbound']=function(_0x4cea19,_0x3b3e25,_0x42cfb0,_0x46fb0f,_0x1e6ba5,_0x229577,_0x535149){var _0xe6b1fe,_0x1a5375,_0x46cc18;_0x229577['host']=intUtil[_0x1d60('0x80')](_0x229577[_0x1d60('0x7f')]);_0x229577[_0x1d60('0x81')]=intUtil[_0x1d60('0x80')](_0x229577[_0x1d60('0x81')]);if(_0x535149&&_0x535149[_0x1d60('0x93')]&&_0x535149['recordingFormat']!==_0x1d60('0x94')){logger[_0x1d60('0x2e')](_0x1d60('0x95'),_0x1d60('0x83'));_0x3b3e25[_0x1d60('0x84')]=_0x229577['serverUrl']+_0x1d60('0x85')+_0x3b3e25[_0x1d60('0x86')]+_0x1d60('0x87')+md5(_0x3b3e25[_0x1d60('0x86')]);}var _0x3141a1=_0x229577[_0x1d60('0x7f')]===_0x1d60('0x88')?'eu':_0x1d60('0x89');return getAccessToken(_0x229577)[_0x1d60('0x33')](function(_0x39064e){_0x46cc18=_0x39064e;return getUser(_0x46cc18,_0x3141a1,_0x229577,_0x46fb0f[_0x1d60('0x8a')]);})[_0x1d60('0x33')](function(_0x38d9e1){_0xe6b1fe=_0x38d9e1;logger[_0x1d60('0x2e')]('The\x20User\x20ID\x20is:',_0xe6b1fe['id']);return getEndUser(_0x46cc18,_0x3141a1,_0x229577,_0x3b3e25[_0x1d60('0x96')],_0x3b3e25['destcalleridnum'],_0xe6b1fe,_0x42cfb0);})[_0x1d60('0x33')](function(_0xdb5213){_0x1a5375=_0xdb5213;return getCall(_0x46cc18,_0x3141a1,_0x229577,_0xe6b1fe,_0x1a5375,_0x42cfb0,_0x3b3e25,_0x1d60('0x97'));})[_0x1d60('0x33')](function(_0x334d66){if(_0x334d66){logger['info'](_0x1d60('0x98'),_0x334d66['id']);logger[_0x1d60('0x2e')](_0x1d60('0x95'),_0x1d60('0x99'));emit(util['format']('user:%s',_0x46fb0f[_0x1d60('0x1b')]),_0x1d60('0x90'),{'uri':_0x1d60('0x91')+_0x229577[_0x1d60('0x7f')]+_0x1d60('0x92')+_0x334d66['id']});}})[_0x1d60('0x2c')](function(_0x426af4){logger[_0x1d60('0x3c')](_0x1d60('0x95'),JSON[_0x1d60('0x10')](_0x426af4));});};exports[_0x1d60('0x9a')]=function(_0x694504,_0x18a8f0,_0x32f2be,_0x14177a,_0x1c5b7a,_0x27f535){var _0x3edfc8,_0x2199fb,_0x53a461;_0x27f535[_0x1d60('0x7f')]=intUtil[_0x1d60('0x80')](_0x27f535[_0x1d60('0x7f')]);_0x27f535[_0x1d60('0x81')]=intUtil[_0x1d60('0x80')](_0x27f535[_0x1d60('0x81')]);if(_0x1c5b7a&&_0x1c5b7a[_0x1d60('0x82')]){logger[_0x1d60('0x2e')]('['+_0x18a8f0[_0x1d60('0x6a')][_0x1d60('0x9b')]()+']',_0x1d60('0x83'));_0x18a8f0['recordingURL']=_0x27f535[_0x1d60('0x81')]+_0x1d60('0x85')+_0x18a8f0[_0x1d60('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x18a8f0['uniqueid']);}else{_0x18a8f0[_0x1d60('0x84')]='';}var _0xa3b066=_0x27f535[_0x1d60('0x7f')]===_0x1d60('0x88')?'eu':_0x1d60('0x89');return getAccessToken(_0x27f535)['then'](function(_0x3ab11c){_0x53a461=_0x3ab11c;return getUser(_0x53a461,_0xa3b066,_0x27f535);})[_0x1d60('0x33')](function(_0x540205){_0x3edfc8=_0x540205;logger[_0x1d60('0x2e')](_0x1d60('0x8b'),_0x3edfc8['id']);return getEndUser(_0x53a461,_0xa3b066,_0x27f535,_0x18a8f0[_0x1d60('0x8c')],_0x18a8f0[_0x1d60('0x8d')],_0x3edfc8,_0x32f2be);})[_0x1d60('0x33')](function(_0x21d2e3){_0x2199fb=_0x21d2e3;return getCall(_0x53a461,_0xa3b066,_0x27f535,_0x3edfc8,_0x2199fb,_0x32f2be,_0x18a8f0,_0x1d60('0x76'));})[_0x1d60('0x33')](function(_0x4e13b9){if(_0x4e13b9){logger[_0x1d60('0x2e')](_0x1d60('0x98'),_0x4e13b9['id']);}})[_0x1d60('0x2c')](function(_0x59e30d){logger[_0x1d60('0x3c')]('['+_0x18a8f0[_0x1d60('0x6a')]['toUpperCase']()+']',JSON[_0x1d60('0x10')](_0x59e30d));});}; \ 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 9f03e6e..3ac1294 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 _0x07b6=['../../../../config/logger','trigger','exec','data2','Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','shelljs','mustache'];(function(_0xa804c,_0x21a85b){var _0x158afd=function(_0x436b1a){while(--_0x436b1a){_0xa804c['push'](_0xa804c['shift']());}};_0x158afd(++_0x21a85b);}(_0x07b6,0x1d2));var _0x607b=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x07b6[_0x5f3905];return _0x2923b1;};'use strict';var util=require('util');var sh=require(_0x607b('0x0'));var Mustache=require(_0x607b('0x1'));var logger=require(_0x607b('0x2'))(_0x607b('0x3'));exports[_0x607b('0x4')]=function(_0xba81c8,_0x2b766a){var _0x140751=_0xba81c8[_0x607b('0x5')]?_0xba81c8['data2']:_0x607b('0x6');var _0x28b879=_0xba81c8[_0x607b('0x7')]?Mustache['render'](_0xba81c8[_0x607b('0x7')],_0x2b766a):_0x2b766a;sh[_0x607b('0x4')](_0x28b879,function(_0xd60f57,_0x4bdb52,_0x5f498a){if(_0xd60f57!==0x0){logger[_0x607b('0x8')](util['format'](_0x607b('0x9'),_0x140751,_0x28b879,_0xd60f57,_0x5f498a));}else{logger[_0x607b('0xa')](util[_0x607b('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x140751,_0x28b879,_0x4bdb52));}});}; \ No newline at end of file +var _0xca29=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x3f43d6,_0x2efc89){var _0x1c693f=function(_0x3da47c){while(--_0x3da47c){_0x3f43d6['push'](_0x3f43d6['shift']());}};_0x1c693f(++_0x2efc89);}(_0xca29,0xa7));var _0x9ca2=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xca29[_0x3b4b1d];return _0x488c36;};'use strict';var util=require(_0x9ca2('0x0'));var sh=require(_0x9ca2('0x1'));var Mustache=require(_0x9ca2('0x2'));var logger=require(_0x9ca2('0x3'))(_0x9ca2('0x4'));exports[_0x9ca2('0x5')]=function(_0x178dfe,_0x39f7c0){var _0x3af787=_0x178dfe[_0x9ca2('0x6')]?_0x178dfe[_0x9ca2('0x6')]:'Script';var _0x49e866=_0x178dfe[_0x9ca2('0x7')]?Mustache[_0x9ca2('0x8')](_0x178dfe[_0x9ca2('0x7')],_0x39f7c0):_0x39f7c0;sh[_0x9ca2('0x5')](_0x49e866,function(_0x4bd7a0,_0x26e131,_0x5da7fb){if(_0x4bd7a0!==0x0){logger[_0x9ca2('0x9')](util[_0x9ca2('0xa')](_0x9ca2('0xb'),_0x3af787,_0x49e866,_0x4bd7a0,_0x5da7fb));}else{logger[_0x9ca2('0xc')](util[_0x9ca2('0xa')](_0x9ca2('0xd'),_0x3af787,_0x49e866,_0x26e131));}});}; \ 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 725dc2a..015f729 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 _0xc754=['lodash','mustache','trigger','exec','toUpperCase','render','data2','data5','number','data6','parse','error','stack','data1','POST','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','message','request-promise','util'];(function(_0x78fd11,_0x33a87b){var _0x19a180=function(_0x583395){while(--_0x583395){_0x78fd11['push'](_0x78fd11['shift']());}};_0x19a180(++_0x33a87b);}(_0xc754,0x1a2));var _0x4c75=function(_0x48ad00,_0x32a3f9){_0x48ad00=_0x48ad00-0x0;var _0x27fb17=_0xc754[_0x48ad00];return _0x27fb17;};'use strict';var rp=require(_0x4c75('0x0'));var util=require(_0x4c75('0x1'));var _=require(_0x4c75('0x2'));var Mustache=require(_0x4c75('0x3'));var logger=require('../../../../config/logger')(_0x4c75('0x4'));exports[_0x4c75('0x5')]=function(_0x4d64e2,_0x3ac7e7){var _0x27bf41,_0x5a5a4c;var _0x5737d6={'method':_0x4d64e2['data1'][_0x4c75('0x6')](),'uri':Mustache[_0x4c75('0x7')](_0x4d64e2[_0x4c75('0x8')],_0x3ac7e7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4d64e2[_0x4c75('0x9')])===_0x4c75('0xa')&&parseInt(_0x4d64e2[_0x4c75('0x9')])>=0x1&&parseInt(_0x4d64e2[_0x4c75('0x9')])<=0xa?parseInt(_0x4d64e2['data5'])*0x3e8:0x5*0x3e8};try{_0x5737d6['headers']=_0x4d64e2[_0x4c75('0xb')]?JSON[_0x4c75('0xc')](Mustache[_0x4c75('0x7')](_0x4d64e2[_0x4c75('0xb')],_0x3ac7e7)):{};}catch(_0x38239c){logger[_0x4c75('0xd')](_0x38239c[_0x4c75('0xe')]);}switch(_0x4d64e2[_0x4c75('0xf')][_0x4c75('0x6')]()){case'GET':case'DELETE':_0x27bf41=null;_0x5737d6['qs']=_0x3ac7e7;break;case _0x4c75('0x10'):case'PUT':if(_0x4d64e2[_0x4c75('0x11')]){try{_0x27bf41=JSON[_0x4c75('0xc')](Mustache[_0x4c75('0x7')](_0x4d64e2[_0x4c75('0x11')],_0x3ac7e7));_0x5737d6[_0x4c75('0x12')]=_0x27bf41;}catch(_0x4cc57d){logger[_0x4c75('0xd')](_0x4cc57d['stack']);logger[_0x4c75('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x27bf41=_0x3ac7e7;_0x5737d6[_0x4c75('0x12')]=_0x27bf41;}break;}logger[_0x4c75('0x13')](util[_0x4c75('0x14')](_0x4c75('0x15'),_0x4d64e2[_0x4c75('0xf')],_0x4d64e2[_0x4c75('0x8')],JSON[_0x4c75('0x16')](_0x5737d6)));rp(_0x5737d6)['then'](function(_0x42c3b9){_0x27bf41=!_[_0x4c75('0x17')](_0x27bf41)?_0x4c75('0x18')+_0x27bf41:'';_0x5a5a4c=typeof _0x42c3b9[_0x4c75('0x12')]===_0x4c75('0x19')?JSON[_0x4c75('0x16')](_0x42c3b9[_0x4c75('0x12')]):_0x42c3b9[_0x4c75('0x12')];logger[_0x4c75('0x13')](util[_0x4c75('0x14')](_0x4c75('0x1a'),_0x4d64e2[_0x4c75('0xf')],_0x4d64e2[_0x4c75('0x8')],_0x42c3b9['statusCode'],_0x5a5a4c));})['catch'](function(_0x91c5fb){logger['error'](util[_0x4c75('0x14')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4d64e2[_0x4c75('0xf')],_0x4d64e2['data2'],_0x91c5fb[_0x4c75('0x1b')],_0x91c5fb[_0x4c75('0x1c')],_0x91c5fb[_0x4c75('0x1d')]));});}; \ No newline at end of file +var _0xa151=['then',',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','parse','render','data6','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x1b467b,_0x432ef6){var _0x46a925=function(_0x51294c){while(--_0x51294c){_0x1b467b['push'](_0x1b467b['shift']());}};_0x46a925(++_0x432ef6);}(_0xa151,0xa8));var _0x1a15=function(_0x340095,_0xf7e13b){_0x340095=_0x340095-0x0;var _0x3e980a=_0xa151[_0x340095];return _0x3e980a;};'use strict';var rp=require(_0x1a15('0x0'));var util=require(_0x1a15('0x1'));var _=require('lodash');var Mustache=require(_0x1a15('0x2'));var logger=require(_0x1a15('0x3'))(_0x1a15('0x4'));exports[_0x1a15('0x5')]=function(_0x3a0d9f,_0x380709){var _0x249f89,_0x213403;var _0x3b7262={'method':_0x3a0d9f[_0x1a15('0x6')][_0x1a15('0x7')](),'uri':Mustache['render'](_0x3a0d9f[_0x1a15('0x8')],_0x380709),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3a0d9f['data5'])==='number'&&parseInt(_0x3a0d9f[_0x1a15('0x9')])>=0x1&&parseInt(_0x3a0d9f[_0x1a15('0x9')])<=0xa?parseInt(_0x3a0d9f[_0x1a15('0x9')])*0x3e8:0x5*0x3e8};try{_0x3b7262['headers']=_0x3a0d9f['data6']?JSON[_0x1a15('0xa')](Mustache[_0x1a15('0xb')](_0x3a0d9f[_0x1a15('0xc')],_0x380709)):{};}catch(_0x880e3e){logger['error'](_0x880e3e[_0x1a15('0xd')]);}switch(_0x3a0d9f[_0x1a15('0x6')]['toUpperCase']()){case _0x1a15('0xe'):case _0x1a15('0xf'):_0x249f89=null;_0x3b7262['qs']=_0x380709;break;case _0x1a15('0x10'):case _0x1a15('0x11'):if(_0x3a0d9f[_0x1a15('0x12')]){try{_0x249f89=JSON[_0x1a15('0xa')](Mustache[_0x1a15('0xb')](_0x3a0d9f[_0x1a15('0x12')],_0x380709));_0x3b7262[_0x1a15('0x13')]=_0x249f89;}catch(_0x4b7774){logger[_0x1a15('0x14')](_0x4b7774[_0x1a15('0xd')]);logger[_0x1a15('0x14')](_0x1a15('0x15'));}}else{_0x249f89=_0x380709;_0x3b7262[_0x1a15('0x13')]=_0x249f89;}break;}logger[_0x1a15('0x16')](util['format'](_0x1a15('0x17'),_0x3a0d9f['data1'],_0x3a0d9f[_0x1a15('0x8')],JSON['stringify'](_0x3b7262)));rp(_0x3b7262)[_0x1a15('0x18')](function(_0x10ca83){_0x249f89=!_['isNil'](_0x249f89)?_0x1a15('0x19')+_0x249f89:'';_0x213403=typeof _0x10ca83['body']==='object'?JSON[_0x1a15('0x1a')](_0x10ca83[_0x1a15('0x13')]):_0x10ca83['body'];logger[_0x1a15('0x16')](util['format'](_0x1a15('0x1b'),_0x3a0d9f[_0x1a15('0x6')],_0x3a0d9f['data2'],_0x10ca83['statusCode'],_0x213403));})[_0x1a15('0x1c')](function(_0x258f1d){logger['error'](util['format'](_0x1a15('0x1d'),_0x3a0d9f[_0x1a15('0x6')],_0x3a0d9f[_0x1a15('0x8')],_0x258f1d[_0x1a15('0x1e')],_0x258f1d[_0x1a15('0x1f')],_0x258f1d['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9a972bb..dbadea8 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 _0x59de=['catch','exports','bluebird','routing','client','http','Request','then','error','rpc','message','result'];(function(_0x2c920a,_0x1300e6){var _0x42cfca=function(_0x3f6247){while(--_0x3f6247){_0x2c920a['push'](_0x2c920a['shift']());}};_0x42cfca(++_0x1300e6);}(_0x59de,0x19a));var _0xe59d=function(_0x2ebc31,_0x336378){_0x2ebc31=_0x2ebc31-0x0;var _0x4a96ef=_0x59de[_0x2ebc31];return _0x4a96ef;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe59d('0x0'));var logger=require('../../config/logger')(_0xe59d('0x1'));var client=jayson[_0xe59d('0x2')][_0xe59d('0x3')]({'port':0x2329});client[_0xe59d('0x4')]=function(_0x9017f3,_0x2c72f7){return new BPromise(function(_0x39c092,_0x4a6a74){return client['request'](_0x9017f3,_0x2c72f7)[_0xe59d('0x5')](function(_0x3e1c37){logger['debug']('rpc','routing',_0x9017f3,_0x2c72f7,_0x3e1c37);if(_0x3e1c37[_0xe59d('0x6')]){logger[_0xe59d('0x6')](_0xe59d('0x7'),_0xe59d('0x1'),_0x9017f3,_0x3e1c37[_0xe59d('0x6')][_0xe59d('0x8')],_0x2c72f7);return _0x4a6a74(_0x3e1c37[_0xe59d('0x6')]['message']);}else{return _0x39c092(_0x3e1c37[_0xe59d('0x9')]);}})[_0xe59d('0xa')](function(_0x162a28){logger['error'](_0xe59d('0x7'),'routing',_0x9017f3,_0x162a28,_0x2c72f7);return _0x4a6a74(_0x162a28);});});};module[_0xe59d('0xb')]=client; \ No newline at end of file +var _0x44f4=['error','message','result','catch','jayson/promise','../../config/logger','routing','client','request','then','debug','rpc'];(function(_0x5837a4,_0x15c0f7){var _0x1feb62=function(_0x17d586){while(--_0x17d586){_0x5837a4['push'](_0x5837a4['shift']());}};_0x1feb62(++_0x15c0f7);}(_0x44f4,0x190));var _0x444f=function(_0x57b437,_0x12a5e6){_0x57b437=_0x57b437-0x0;var _0x383641=_0x44f4[_0x57b437];return _0x383641;};'use strict';var jayson=require(_0x444f('0x0'));var BPromise=require('bluebird');var logger=require(_0x444f('0x1'))(_0x444f('0x2'));var client=jayson[_0x444f('0x3')]['http']({'port':0x2329});client['Request']=function(_0x16e466,_0x2637dd){return new BPromise(function(_0x3f9ff5,_0x15041c){return client[_0x444f('0x4')](_0x16e466,_0x2637dd)[_0x444f('0x5')](function(_0x46e053){logger[_0x444f('0x6')](_0x444f('0x7'),_0x444f('0x2'),_0x16e466,_0x2637dd,_0x46e053);if(_0x46e053['error']){logger[_0x444f('0x8')](_0x444f('0x7'),'routing',_0x16e466,_0x46e053[_0x444f('0x8')][_0x444f('0x9')],_0x2637dd);return _0x15041c(_0x46e053[_0x444f('0x8')][_0x444f('0x9')]);}else{return _0x3f9ff5(_0x46e053[_0x444f('0xa')]);}})[_0x444f('0xb')](function(_0x4eccdd){logger['error'](_0x444f('0x7'),_0x444f('0x2'),_0x16e466,_0x4eccdd,_0x2637dd);return _0x15041c(_0x4eccdd);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9d3e375..ffd16c3 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 _0x1dfe=['then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','../../config/logger','email','resolve'];(function(_0x4956e4,_0x55f935){var _0x2ad8f9=function(_0x3a56d3){while(--_0x3a56d3){_0x4956e4['push'](_0x4956e4['shift']());}};_0x2ad8f9(++_0x55f935);}(_0x1dfe,0x153));var _0xe1df=function(_0x2de0bc,_0x349069){_0x2de0bc=_0x2de0bc-0x0;var _0x3676ef=_0x1dfe[_0x2de0bc];return _0x3676ef;};'use strict';var server=require(_0xe1df('0x0'));var Realtime=require(_0xe1df('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xe1df('0x2'));var setting=require('./rpc/setting');var logger=require(_0xe1df('0x3'))(_0xe1df('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe1df('0x5')]()[_0xe1df('0x6')](mailAccount[_0xe1df('0x7')]())[_0xe1df('0x6')](realtime[_0xe1df('0x8')]())['then'](function(){email['refresh'](realtime[_0xe1df('0x9')]);return realtime;});}function main(){return server[_0xe1df('0xa')](realtime,email)[_0xe1df('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0xe1df('0xb')]();})['then'](function(_0x544dfd){return setInterval(initRealtime,_0x544dfd['loginMailFrequency']*0x3e8);})[_0xe1df('0xc')](function(_0xa1173d){logger[_0xe1df('0xd')](_0xe1df('0xe'),_0xa1173d);});}main(); \ No newline at end of file +var _0x6cc4=['getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','resolve','then'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x6cc4,0x119));var _0x46cc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6cc4[_0x17d9e3];return _0x14192d;};'use strict';var server=require(_0x46cc('0x0'));var Realtime=require(_0x46cc('0x1'));var EmailChannel=require(_0x46cc('0x2'));var mailAccount=require(_0x46cc('0x3'));var setting=require('./rpc/setting');var logger=require(_0x46cc('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x46cc('0x5')]()[_0x46cc('0x6')](mailAccount[_0x46cc('0x7')]())['then'](realtime['initMailAccounts']())[_0x46cc('0x6')](function(){email[_0x46cc('0x8')](realtime[_0x46cc('0x9')]);return realtime;});}function main(){return server[_0x46cc('0xa')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x46cc('0xb')]();})[_0x46cc('0x6')](function(_0x42b969){return setInterval(initRealtime,_0x42b969[_0x46cc('0xc')]*0x3e8);})[_0x46cc('0xd')](function(_0x4c0d5b){logger[_0x46cc('0xe')](_0x46cc('0xf'),_0x4c0d5b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index f1396cd..7a2def9 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 _0x6b60=['../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','prototype','emit','name','active','Imap','messageStatus','total','isNil','stringify','hasOwnProperty','service','provider','custom','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','status','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','smtp','send','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','md5','ioredis'];(function(_0x56d816,_0x424a26){var _0x23df96=function(_0x1af45d){while(--_0x1af45d){_0x56d816['push'](_0x56d816['shift']());}};_0x23df96(++_0x424a26);}(_0x6b60,0x157));var _0x06b6=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x6b60[_0x5ca353];return _0x4f2fe5;};'use strict';var _=require(_0x06b6('0x0'));var moment=require(_0x06b6('0x1'));var BPromise=require(_0x06b6('0x2'));var md5=require(_0x06b6('0x3'));var Redis=require(_0x06b6('0x4'));var config=require(_0x06b6('0x5'));var logger=require(_0x06b6('0x6'))('email');config[_0x06b6('0x7')]=_[_0x06b6('0x8')](config[_0x06b6('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x06b6('0x9'))(new Redis(config[_0x06b6('0x7')]));var EmailImap=require(_0x06b6('0xa'));var EmailSmtp=require(_0x06b6('0xb'));var mailAccount=require(_0x06b6('0xc'));var md5Accounts={};function EmailChannel(_0x29ae16){logger['info'](_0x06b6('0xd'));this[_0x06b6('0xe')]=_0x29ae16[_0x06b6('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x06b6('0xf')][_0x06b6('0x10')]=function(_0xcf7bbf){var _0x462ccc=this[_0x06b6('0xe')][_0xcf7bbf];var _0x57d85a={'id':_0x462ccc['id'],'name':_0x462ccc[_0x06b6('0x11')],'key':_0x462ccc['key'],'active':_0x462ccc[_0x06b6('0x12')],'Imap':{'status':_0x462ccc['Imap']['status'],'messageStatus':_0x462ccc[_0x06b6('0x13')][_0x06b6('0x14')],'total':_0x462ccc[_0x06b6('0x13')][_0x06b6('0x15')]}};if(_[_0x06b6('0x16')](md5Accounts[_0xcf7bbf])){md5Accounts[_0xcf7bbf]={};}var _0x28a908=md5(JSON[_0x06b6('0x17')](_0x57d85a));if(md5Accounts[_0xcf7bbf]['md5']!==_0x28a908){md5Accounts[_0xcf7bbf][_0x06b6('0x3')]=_0x28a908;io[_0x06b6('0x10')]('mailAccount:update',_0x57d85a);}};EmailChannel[_0x06b6('0xf')]['refresh']=function(_0x43178b){for(var _0x31d195 in _0x43178b){if(_0x43178b[_0x06b6('0x18')](_0x31d195)){if(_0x43178b[_0x31d195][_0x06b6('0x13')]&&_0x43178b[_0x31d195]['active']){var _0x4a6b67=_0x43178b[_0x31d195]['Imap'];if(!_0x4a6b67[_0x06b6('0x19')]&&_0x43178b[_0x31d195][_0x06b6('0x1a')]!==_0x06b6('0x1b'))_0x4a6b67[_0x06b6('0x19')]=_0x43178b[_0x31d195][_0x06b6('0x1a')];if(!this[_0x06b6('0x1c')][_0x06b6('0x18')](_0x4a6b67['id'])){this[_0x06b6('0x1c')][_0x4a6b67['id']]=new EmailImap(_0x4a6b67,_0x43178b[_0x31d195][_0x06b6('0x1d')]);this[_0x06b6('0x1c')][_0x4a6b67['id']]['on'](_0x06b6('0x1e'),this[_0x06b6('0x1f')][_0x06b6('0x20')](this,_0x31d195));this['imapAccounts'][_0x4a6b67['id']]['on'](_0x06b6('0x1d'),this[_0x06b6('0x21')]['bind'](this,_0x31d195));this[_0x06b6('0x1c')][_0x4a6b67['id']]['on'](_0x06b6('0x22'),this['handleImapEnd'][_0x06b6('0x20')](this,_0x31d195));this[_0x06b6('0x1c')][_0x4a6b67['id']]['on'](_0x06b6('0x23'),this[_0x06b6('0x24')]['bind'](this,_0x31d195));}}else{if(_[_0x06b6('0x16')](this[_0x06b6('0xe')][_0x31d195][_0x06b6('0x13')])){this[_0x06b6('0xe')][_0x31d195]['Imap']={};}this[_0x06b6('0xe')][_0x31d195][_0x06b6('0x13')][_0x06b6('0x25')]=_0x06b6('0x26');this[_0x06b6('0xe')][_0x31d195][_0x06b6('0x13')][_0x06b6('0x14')]='';this['emit'](_0x31d195);}}}};EmailChannel['prototype'][_0x06b6('0x1f')]=function(_0x5bd988,_0x4584e3){if(this['mailAccounts'][_0x5bd988]){this['mailAccounts'][_0x5bd988][_0x06b6('0x13')][_0x06b6('0x25')]=_0x06b6('0x27');this[_0x06b6('0xe')][_0x5bd988][_0x06b6('0x13')][_0x06b6('0x14')]=_0x4584e3[_0x06b6('0x11')];if(_0x4584e3[_0x06b6('0x28')]){this['mailAccounts'][_0x5bd988][_0x06b6('0x13')]['total']=_0x4584e3[_0x06b6('0x28')][_0x06b6('0x15')];}return this[_0x06b6('0x10')](_0x5bd988);}};EmailChannel[_0x06b6('0xf')][_0x06b6('0x21')]=function(_0x4e0890,_0x552616){logger[_0x06b6('0x29')](_0x06b6('0x2a'),_0x552616['firstName'],_0x552616['lastName'],_0x552616[_0x06b6('0x2b')],_0x4e0890);if(this[_0x06b6('0xe')][_0x4e0890]){return mailAccount[_0x06b6('0x2c')](_0x4e0890,_0x552616)[_0x06b6('0x2d')](function(_0x94bca8){if(_0x94bca8){logger['info'](_0x06b6('0x2e'));}})['catch'](function(_0xf174fd){logger['error'](_0x06b6('0x2f'),JSON[_0x06b6('0x17')](_0xf174fd));});}};EmailChannel[_0x06b6('0xf')][_0x06b6('0x30')]=function(_0x145763){if(this['mailAccounts'][_0x145763]&&this['mailAccounts'][_0x145763]['Imap']){if(this[_0x06b6('0x1c')][this[_0x06b6('0xe')][_0x145763][_0x06b6('0x13')]['id']]){delete this[_0x06b6('0x1c')][this[_0x06b6('0xe')][_0x145763][_0x06b6('0x13')]['id']];}this[_0x06b6('0xe')][_0x145763][_0x06b6('0x13')][_0x06b6('0x31')]=moment();this[_0x06b6('0x10')](_0x145763);}};EmailChannel[_0x06b6('0xf')][_0x06b6('0x24')]=function(_0xb3ffdc,_0x38cfb3){if(this[_0x06b6('0xe')][_0xb3ffdc]){this['mailAccounts'][_0xb3ffdc][_0x06b6('0x13')][_0x06b6('0x25')]=_0x06b6('0x23');this['mailAccounts'][_0xb3ffdc][_0x06b6('0x13')][_0x06b6('0x14')]=_0x38cfb3;return this['emit'](_0xb3ffdc);}};EmailChannel[_0x06b6('0xf')][_0x06b6('0x32')]=function(_0x360d2e,_0x3a8565){return this[_0x06b6('0x33')][_0x06b6('0x34')](_0x360d2e,_0x3a8565);};EmailChannel['prototype']['verifySmtp']=function(_0x11e4c7){var _0xe5b5ed=this;if(this[_0x06b6('0xe')][_0x11e4c7['id']]){if(_[_0x06b6('0x16')](this[_0x06b6('0xe')][_0x11e4c7['id']]['Smtp'])){this[_0x06b6('0xe')][_0x11e4c7['id']][_0x06b6('0x35')]={};}this[_0x06b6('0xe')][_0x11e4c7['id']][_0x06b6('0x35')][_0x06b6('0x31')]=moment();return new BPromise(function(_0x3b7108,_0x377d51){return _0xe5b5ed[_0x06b6('0x33')][_0x06b6('0x36')](_0x11e4c7)['then'](function(_0xf0ac6c){_0xe5b5ed['mailAccounts'][_0x11e4c7['id']][_0x06b6('0x35')][_0x06b6('0x25')]=_0x06b6('0x37');_0xe5b5ed['mailAccounts'][_0x11e4c7['id']][_0x06b6('0x35')][_0x06b6('0x14')]='';_0xe5b5ed[_0x06b6('0x10')](_0x11e4c7['id']);_0x3b7108(_0xf0ac6c);})[_0x06b6('0x38')](function(_0x15b50b){_0xe5b5ed[_0x06b6('0xe')][_0x11e4c7['id']][_0x06b6('0x35')][_0x06b6('0x25')]=_0x06b6('0x23');_0xe5b5ed[_0x06b6('0xe')][_0x11e4c7['id']][_0x06b6('0x35')][_0x06b6('0x14')]=_0x15b50b;_0xe5b5ed[_0x06b6('0x10')](_0x11e4c7['id']);_0x377d51(_0x15b50b);});});}return this['smtp'][_0x06b6('0x36')](_0x11e4c7);};module[_0x06b6('0x39')]=EmailChannel; \ No newline at end of file +var _0xf483=['md5','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','email','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','connected','messages','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf483,0x10d));var _0x3f48=function(_0x4e1de5,_0xac3956){_0x4e1de5=_0x4e1de5-0x0;var _0x4be012=_0xf483[_0x4e1de5];return _0x4be012;};'use strict';var _=require('lodash');var moment=require(_0x3f48('0x0'));var BPromise=require(_0x3f48('0x1'));var md5=require('md5');var Redis=require(_0x3f48('0x2'));var config=require(_0x3f48('0x3'));var logger=require(_0x3f48('0x4'))('email');config['redis']=_[_0x3f48('0x5')](config['redis'],{'host':_0x3f48('0x6'),'port':0x18eb});var io=require(_0x3f48('0x7'))(new Redis(config[_0x3f48('0x8')]));var EmailImap=require(_0x3f48('0x9'));var EmailSmtp=require(_0x3f48('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2636d8){logger[_0x3f48('0xb')](_0x3f48('0xc'));this[_0x3f48('0xd')]=_0x2636d8[_0x3f48('0xd')];this[_0x3f48('0xe')]={};this[_0x3f48('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0x3f48('0x10')]=function(_0x48179a){var _0x317523=this[_0x3f48('0xd')][_0x48179a];var _0x2081c3={'id':_0x317523['id'],'name':_0x317523[_0x3f48('0x11')],'key':_0x317523[_0x3f48('0x12')],'active':_0x317523[_0x3f48('0x13')],'Imap':{'status':_0x317523[_0x3f48('0x14')][_0x3f48('0x15')],'messageStatus':_0x317523[_0x3f48('0x14')][_0x3f48('0x16')],'total':_0x317523[_0x3f48('0x14')][_0x3f48('0x17')]}};if(_[_0x3f48('0x18')](md5Accounts[_0x48179a])){md5Accounts[_0x48179a]={};}var _0x58a7c4=md5(JSON[_0x3f48('0x19')](_0x2081c3));if(md5Accounts[_0x48179a][_0x3f48('0x1a')]!==_0x58a7c4){md5Accounts[_0x48179a][_0x3f48('0x1a')]=_0x58a7c4;io[_0x3f48('0x10')](_0x3f48('0x1b'),_0x2081c3);}};EmailChannel[_0x3f48('0x1c')][_0x3f48('0x1d')]=function(_0x3b5d72){for(var _0x3ce816 in _0x3b5d72){if(_0x3b5d72[_0x3f48('0x1e')](_0x3ce816)){if(_0x3b5d72[_0x3ce816][_0x3f48('0x14')]&&_0x3b5d72[_0x3ce816][_0x3f48('0x13')]){var _0x4c7ac8=_0x3b5d72[_0x3ce816]['Imap'];if(!_0x4c7ac8[_0x3f48('0x1f')]&&_0x3b5d72[_0x3ce816][_0x3f48('0x20')]!==_0x3f48('0x21'))_0x4c7ac8[_0x3f48('0x1f')]=_0x3b5d72[_0x3ce816][_0x3f48('0x20')];if(!this[_0x3f48('0xe')][_0x3f48('0x1e')](_0x4c7ac8['id'])){this[_0x3f48('0xe')][_0x4c7ac8['id']]=new EmailImap(_0x4c7ac8,_0x3b5d72[_0x3ce816][_0x3f48('0x22')]);this[_0x3f48('0xe')][_0x4c7ac8['id']]['on'](_0x3f48('0x23'),this[_0x3f48('0x24')]['bind'](this,_0x3ce816));this[_0x3f48('0xe')][_0x4c7ac8['id']]['on'](_0x3f48('0x22'),this[_0x3f48('0x25')]['bind'](this,_0x3ce816));this['imapAccounts'][_0x4c7ac8['id']]['on'](_0x3f48('0x26'),this[_0x3f48('0x27')][_0x3f48('0x28')](this,_0x3ce816));this[_0x3f48('0xe')][_0x4c7ac8['id']]['on'](_0x3f48('0x29'),this[_0x3f48('0x2a')][_0x3f48('0x28')](this,_0x3ce816));}}else{if(_['isNil'](this[_0x3f48('0xd')][_0x3ce816][_0x3f48('0x14')])){this[_0x3f48('0xd')][_0x3ce816][_0x3f48('0x14')]={};}this[_0x3f48('0xd')][_0x3ce816][_0x3f48('0x14')][_0x3f48('0x15')]='disabled';this['mailAccounts'][_0x3ce816][_0x3f48('0x14')][_0x3f48('0x16')]='';this[_0x3f48('0x10')](_0x3ce816);}}}};EmailChannel['prototype'][_0x3f48('0x24')]=function(_0x47bfc7,_0x1481ae){if(this['mailAccounts'][_0x47bfc7]){this[_0x3f48('0xd')][_0x47bfc7]['Imap'][_0x3f48('0x15')]=_0x3f48('0x2b');this['mailAccounts'][_0x47bfc7][_0x3f48('0x14')][_0x3f48('0x16')]=_0x1481ae['name'];if(_0x1481ae['messages']){this[_0x3f48('0xd')][_0x47bfc7][_0x3f48('0x14')][_0x3f48('0x17')]=_0x1481ae[_0x3f48('0x2c')]['total'];}return this[_0x3f48('0x10')](_0x47bfc7);}};EmailChannel['prototype'][_0x3f48('0x25')]=function(_0x2265cf,_0x39f0d3){logger[_0x3f48('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x39f0d3['firstName'],_0x39f0d3[_0x3f48('0x2d')],_0x39f0d3[_0x3f48('0x2e')],_0x2265cf);if(this[_0x3f48('0xd')][_0x2265cf]){return mailAccount[_0x3f48('0x2f')](_0x2265cf,_0x39f0d3)[_0x3f48('0x30')](function(_0x5dc0c3){if(_0x5dc0c3){logger[_0x3f48('0xb')](_0x3f48('0x31'));}})[_0x3f48('0x32')](function(_0x2052d2){logger['error'](_0x3f48('0x33'),JSON['stringify'](_0x2052d2));});}};EmailChannel[_0x3f48('0x1c')][_0x3f48('0x27')]=function(_0x3caa17){if(this['mailAccounts'][_0x3caa17]&&this[_0x3f48('0xd')][_0x3caa17][_0x3f48('0x14')]){if(this[_0x3f48('0xe')][this['mailAccounts'][_0x3caa17][_0x3f48('0x14')]['id']]){delete this[_0x3f48('0xe')][this[_0x3f48('0xd')][_0x3caa17][_0x3f48('0x14')]['id']];}this[_0x3f48('0xd')][_0x3caa17][_0x3f48('0x14')]['lastSync']=moment();this[_0x3f48('0x10')](_0x3caa17);}};EmailChannel[_0x3f48('0x1c')][_0x3f48('0x2a')]=function(_0xb58fea,_0x388d75){if(this[_0x3f48('0xd')][_0xb58fea]){this[_0x3f48('0xd')][_0xb58fea][_0x3f48('0x14')][_0x3f48('0x15')]='error';this['mailAccounts'][_0xb58fea][_0x3f48('0x14')][_0x3f48('0x16')]=_0x388d75;return this[_0x3f48('0x10')](_0xb58fea);}};EmailChannel[_0x3f48('0x1c')][_0x3f48('0x34')]=function(_0x528c93,_0x4ab3ec){return this[_0x3f48('0xf')][_0x3f48('0x35')](_0x528c93,_0x4ab3ec);};EmailChannel[_0x3f48('0x1c')][_0x3f48('0x36')]=function(_0xb020af){var _0x346886=this;if(this[_0x3f48('0xd')][_0xb020af['id']]){if(_['isNil'](this[_0x3f48('0xd')][_0xb020af['id']]['Smtp'])){this[_0x3f48('0xd')][_0xb020af['id']][_0x3f48('0x37')]={};}this[_0x3f48('0xd')][_0xb020af['id']][_0x3f48('0x37')][_0x3f48('0x38')]=moment();return new BPromise(function(_0x17fb38,_0xab1036){return _0x346886[_0x3f48('0xf')][_0x3f48('0x39')](_0xb020af)['then'](function(_0x1744be){_0x346886[_0x3f48('0xd')][_0xb020af['id']][_0x3f48('0x37')]['status']=_0x3f48('0x3a');_0x346886[_0x3f48('0xd')][_0xb020af['id']][_0x3f48('0x37')][_0x3f48('0x16')]='';_0x346886[_0x3f48('0x10')](_0xb020af['id']);_0x17fb38(_0x1744be);})[_0x3f48('0x32')](function(_0x564127){_0x346886[_0x3f48('0xd')][_0xb020af['id']][_0x3f48('0x37')][_0x3f48('0x15')]=_0x3f48('0x29');_0x346886[_0x3f48('0xd')][_0xb020af['id']][_0x3f48('0x37')][_0x3f48('0x16')]=_0x564127;_0x346886[_0x3f48('0x10')](_0xb020af['id']);_0xab1036(_0x564127);});});}return this[_0x3f48('0xf')]['verify'](_0xb020af);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5a58b45..1c45574 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 _0x1252=['handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','email','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','Iconv','EventEmitter','mailbox','account','getAccount','once','ready','handleReady','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','bind','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes'];(function(_0x4c8c4d,_0x170fc3){var _0x7c72d2=function(_0x249fd1){while(--_0x249fd1){_0x4c8c4d['push'](_0x4c8c4d['shift']());}};_0x7c72d2(++_0x170fc3);}(_0x1252,0x1ca));var _0x2125=function(_0x28aa1f,_0x52dc11){_0x28aa1f=_0x28aa1f-0x0;var _0x573646=_0x1252[_0x28aa1f];return _0x573646;};'use strict';var _=require(_0x2125('0x0'));var util=require(_0x2125('0x1'));var Imap=require(_0x2125('0x2'));var simpleParser=require(_0x2125('0x3'))[_0x2125('0x4')];var Iconv=require('iconv')[_0x2125('0x5')];var EventEmitter=require('events')[_0x2125('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0x32b922,_0x2a8d1b){this[_0x2125('0x7')]=_0x32b922[_0x2125('0x7')];this[_0x2125('0x8')]=this[_0x2125('0x9')](_0x32b922,_0x2a8d1b);this[_0x2125('0x2')]=new Imap(this[_0x2125('0x8')]);this[_0x2125('0x2')][_0x2125('0xa')](_0x2125('0xb'),this[_0x2125('0xc')]['bind'](this));this[_0x2125('0x2')][_0x2125('0xa')](_0x2125('0xd'),this[_0x2125('0xe')]['bind'](this));this['imap']['on'](_0x2125('0xf'),this[_0x2125('0x10')]['bind'](this));this[_0x2125('0x2')][_0x2125('0x11')]();}util[_0x2125('0x12')](EmailImap,EventEmitter);EmailImap[_0x2125('0x13')]['getAccount']=function(_0x27c0b8,_0x3ff3c4){var _0x5d2782={'connTimeout':_0x27c0b8[_0x2125('0x14')]?_0x27c0b8[_0x2125('0x14')]*0x3e8:0x2710,'authTimeout':_0x27c0b8[_0x2125('0x15')]?_0x27c0b8[_0x2125('0x15')]*0x3e8:0x1388};if(_0x27c0b8['service']){_0x5d2782['user']=_0x27c0b8[_0x2125('0x16')];if(_0x27c0b8[_0x2125('0x17')]){_0x5d2782[_0x2125('0x18')]=utils[_0x2125('0x19')](_0x27c0b8[_0x2125('0x1a')][_0x2125('0x1b')],_0x27c0b8[_0x2125('0x16')]);}else{_0x5d2782[_0x2125('0x1c')]=_0x27c0b8['password'];}}else{if(_0x27c0b8[_0x2125('0x1d')]){_0x5d2782['user']=_0x27c0b8[_0x2125('0x16')];_0x5d2782[_0x2125('0x1c')]=_0x27c0b8[_0x2125('0x1c')];}}_0x5d2782['email']=_0x3ff3c4||_0x27c0b8[_0x2125('0x16')]||_0x2125('0x1e');_0x5d2782['host']=_0x27c0b8[_0x2125('0x1f')];_0x5d2782[_0x2125('0x20')]=_0x27c0b8[_0x2125('0x20')]||0x3e1;if(_0x27c0b8['tls']){_0x5d2782[_0x2125('0x21')]=!![];}else{_0x5d2782[_0x2125('0x21')]=![];_0x5d2782[_0x2125('0x22')]=_0x2125('0x23');}return _0x5d2782;};EmailImap[_0x2125('0x13')][_0x2125('0xc')]=function(){this[_0x2125('0x2')][_0x2125('0x24')](this[_0x2125('0x7')],![],this[_0x2125('0x25')][_0x2125('0x26')](this));};EmailImap[_0x2125('0x13')][_0x2125('0x25')]=function(_0x1e5f6e,_0x428194){if(_0x1e5f6e){this[_0x2125('0x10')](_0x1e5f6e,!![]);}else{this[_0x2125('0x27')](_0x2125('0x28'),_0x428194);this[_0x2125('0x29')]();}};EmailImap[_0x2125('0x13')][_0x2125('0x2a')]=function(_0x17f398){if(_0x17f398){this[_0x2125('0x10')](_0x17f398,!![]);}else{this[_0x2125('0x2')][_0x2125('0xd')]();}};EmailImap[_0x2125('0x13')][_0x2125('0x29')]=function(){this[_0x2125('0x2')][_0x2125('0x2b')]([_0x2125('0x2c')],this[_0x2125('0x2d')][_0x2125('0x26')](this));};EmailImap['prototype'][_0x2125('0x2d')]=function(_0x5d0dc0,_0x13704d){if(_0x5d0dc0){this[_0x2125('0x10')](_0x5d0dc0,!![]);}else{if(_0x13704d['length']){try{var _0x407fd0=this[_0x2125('0x2')][_0x2125('0x2e')](_0x13704d,{'bodies':'','markSeen':!![]});_0x407fd0['on'](_0x2125('0x2f'),this['handleFetchMessage'][_0x2125('0x26')](this));_0x407fd0[_0x2125('0xa')](_0x2125('0xf'),this[_0x2125('0x30')][_0x2125('0x26')](this));_0x407fd0[_0x2125('0xa')](_0x2125('0xd'),this[_0x2125('0x31')][_0x2125('0x26')](this));}catch(_0xab80f0){logger[_0x2125('0xf')](_0xab80f0);}}else{this[_0x2125('0x2')][_0x2125('0x32')](!![],this[_0x2125('0x2a')][_0x2125('0x26')](this));}}};EmailImap['prototype'][_0x2125('0x33')]=function(_0x627a1d){_0x627a1d['on'](_0x2125('0x34'),this['handleMessageBody'][_0x2125('0x26')](this));_0x627a1d[_0x2125('0xa')](_0x2125('0x35'),this[_0x2125('0x36')][_0x2125('0x26')](this));_0x627a1d[_0x2125('0xa')](_0x2125('0xd'),this[_0x2125('0x37')]['bind'](this));};EmailImap[_0x2125('0x13')][_0x2125('0x38')]=function(_0x1f0d6){simpleParser(_0x1f0d6,{'Iconv':Iconv},this[_0x2125('0x39')][_0x2125('0x26')](this));};EmailImap[_0x2125('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x2125('0x13')]['handleMessageEnd']=function(){};EmailImap[_0x2125('0x13')][_0x2125('0x39')]=function(_0x2b34c7,_0x2dd8a4){if(_0x2b34c7){logger[_0x2125('0xf')](_0x2b34c7);}else{var _0x1c756a=this;utils[_0x2125('0x3a')](this['account'],_0x2dd8a4,function(_0x308356){_0x1c756a['emit'](_0x2125('0x3b'),_0x308356);});}};EmailImap[_0x2125('0x13')][_0x2125('0x31')]=function(){this['imap'][_0x2125('0x32')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x2125('0x13')][_0x2125('0x30')]=function(_0x463b54){this[_0x2125('0x10')](_0x463b54);this[_0x2125('0x2')][_0x2125('0x32')](!![],this[_0x2125('0x2a')][_0x2125('0x26')](this));};EmailImap[_0x2125('0x13')][_0x2125('0xe')]=function(){this[_0x2125('0x27')]('end');};EmailImap[_0x2125('0x13')][_0x2125('0x10')]=function(_0x474730,_0x4bdb0d){logger[_0x2125('0xf')](_0x2125('0x10'),this[_0x2125('0x8')][_0x2125('0x3b')],JSON[_0x2125('0x3c')](_0x474730));var _0x397100='';if(_0x474730){if(_0x474730[_0x2125('0x3d')]){_0x397100=_0x474730[_0x2125('0x3d')];}else{for(var _0x122899 in _0x474730){if(_0x474730[_0x2125('0x3e')](_0x122899)){_0x397100+=_[_0x2125('0x3f')](_0x122899)+':\x20'+_0x474730[_0x122899]+'\x0a';}}}}if(_0x4bdb0d){this[_0x2125('0x2')][_0x2125('0xd')]();}else{this[_0x2125('0x27')]('error',_0x397100);this['emit'](_0x2125('0xd'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x3534=['imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','ready','handleReady','bind','handleEnd','error','handleError','connTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','prototype','handleOpenBox','emit','box','handleCloseBox','end','readUnseen','handleReadUnseen','length','message','handleFetchMessage','once','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','handleFetchError','textCode','hasOwnProperty','upperFirst','exports','lodash'];(function(_0x3b4a85,_0x476b77){var _0x16cf37=function(_0x205318){while(--_0x205318){_0x3b4a85['push'](_0x3b4a85['shift']());}};_0x16cf37(++_0x476b77);}(_0x3534,0xb0));var _0x4353=function(_0x3d16c7,_0x513c2b){_0x3d16c7=_0x3d16c7-0x0;var _0x5a9fdf=_0x3534[_0x3d16c7];return _0x5a9fdf;};'use strict';var _=require(_0x4353('0x0'));var util=require('util');var Imap=require(_0x4353('0x1'));var simpleParser=require(_0x4353('0x2'))[_0x4353('0x3')];var Iconv=require(_0x4353('0x4'))[_0x4353('0x5')];var EventEmitter=require('events')[_0x4353('0x6')];var utils=require(_0x4353('0x7'));var logger=require(_0x4353('0x8'))(_0x4353('0x9'));function EmailImap(_0x124011,_0xcc642a){this[_0x4353('0xa')]=_0x124011[_0x4353('0xa')];this['account']=this[_0x4353('0xb')](_0x124011,_0xcc642a);this[_0x4353('0x1')]=new Imap(this['account']);this[_0x4353('0x1')]['once'](_0x4353('0xc'),this[_0x4353('0xd')][_0x4353('0xe')](this));this[_0x4353('0x1')]['once']('end',this[_0x4353('0xf')][_0x4353('0xe')](this));this[_0x4353('0x1')]['on'](_0x4353('0x10'),this[_0x4353('0x11')][_0x4353('0xe')](this));this[_0x4353('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x4353('0xb')]=function(_0x43fbc6,_0xaa8ae0){var _0x43570d={'connTimeout':_0x43fbc6[_0x4353('0x12')]?_0x43fbc6[_0x4353('0x12')]*0x3e8:0x2710,'authTimeout':_0x43fbc6['authTimeout']?_0x43fbc6['authTimeout']*0x3e8:0x1388};if(_0x43fbc6[_0x4353('0x13')]){_0x43570d['user']=_0x43fbc6[_0x4353('0x14')];if(_0x43fbc6[_0x4353('0x15')]){_0x43570d[_0x4353('0x16')]=utils[_0x4353('0x17')](_0x43fbc6['CloudProvider'][_0x4353('0x18')],_0x43fbc6[_0x4353('0x14')]);}else{_0x43570d[_0x4353('0x19')]=_0x43fbc6[_0x4353('0x19')];}}else{if(_0x43fbc6[_0x4353('0x1a')]){_0x43570d[_0x4353('0x14')]=_0x43fbc6[_0x4353('0x14')];_0x43570d['password']=_0x43fbc6[_0x4353('0x19')];}}_0x43570d[_0x4353('0x9')]=_0xaa8ae0||_0x43fbc6[_0x4353('0x14')]||_0x4353('0x1b');_0x43570d['host']=_0x43fbc6[_0x4353('0x1c')];_0x43570d[_0x4353('0x1d')]=_0x43fbc6[_0x4353('0x1d')]||0x3e1;if(_0x43fbc6[_0x4353('0x1e')]){_0x43570d[_0x4353('0x1e')]=!![];}else{_0x43570d['tls']=![];_0x43570d['autotls']=_0x4353('0x1f');}return _0x43570d;};EmailImap[_0x4353('0x20')][_0x4353('0xd')]=function(){this[_0x4353('0x1')]['openBox'](this['mailbox'],![],this[_0x4353('0x21')][_0x4353('0xe')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x3c549f,_0x40ccad){if(_0x3c549f){this[_0x4353('0x11')](_0x3c549f,!![]);}else{this[_0x4353('0x22')](_0x4353('0x23'),_0x40ccad);this['readUnseen']();}};EmailImap[_0x4353('0x20')][_0x4353('0x24')]=function(_0x31eca4){if(_0x31eca4){this[_0x4353('0x11')](_0x31eca4,!![]);}else{this[_0x4353('0x1')][_0x4353('0x25')]();}};EmailImap[_0x4353('0x20')][_0x4353('0x26')]=function(){this[_0x4353('0x1')]['search'](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x4353('0x27')]=function(_0x186da0,_0x185ddc){if(_0x186da0){this['handleError'](_0x186da0,!![]);}else{if(_0x185ddc[_0x4353('0x28')]){try{var _0x306e03=this[_0x4353('0x1')]['fetch'](_0x185ddc,{'bodies':'','markSeen':!![]});_0x306e03['on'](_0x4353('0x29'),this[_0x4353('0x2a')][_0x4353('0xe')](this));_0x306e03[_0x4353('0x2b')](_0x4353('0x10'),this['handleFetchError'][_0x4353('0xe')](this));_0x306e03[_0x4353('0x2b')](_0x4353('0x25'),this[_0x4353('0x2c')][_0x4353('0xe')](this));}catch(_0x235b8c){logger[_0x4353('0x10')](_0x235b8c);}}else{this[_0x4353('0x1')][_0x4353('0x2d')](!![],this[_0x4353('0x24')]['bind'](this));}}};EmailImap[_0x4353('0x20')][_0x4353('0x2a')]=function(_0x39c4a3){_0x39c4a3['on'](_0x4353('0x2e'),this[_0x4353('0x2f')][_0x4353('0xe')](this));_0x39c4a3['once'](_0x4353('0x30'),this[_0x4353('0x31')][_0x4353('0xe')](this));_0x39c4a3[_0x4353('0x2b')](_0x4353('0x25'),this[_0x4353('0x32')][_0x4353('0xe')](this));};EmailImap[_0x4353('0x20')][_0x4353('0x2f')]=function(_0x36b504){simpleParser(_0x36b504,{'Iconv':Iconv},this[_0x4353('0x33')][_0x4353('0xe')](this));};EmailImap[_0x4353('0x20')]['handleMessageAttributes']=function(){};EmailImap[_0x4353('0x20')][_0x4353('0x32')]=function(){};EmailImap[_0x4353('0x20')]['handleSimpleParser']=function(_0x476e2e,_0x105367){if(_0x476e2e){logger[_0x4353('0x10')](_0x476e2e);}else{var _0x5b8606=this;utils[_0x4353('0x34')](this[_0x4353('0x35')],_0x105367,function(_0x169f9b){_0x5b8606[_0x4353('0x22')](_0x4353('0x9'),_0x169f9b);});}};EmailImap[_0x4353('0x20')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0x4353('0x24')]['bind'](this));};EmailImap[_0x4353('0x20')][_0x4353('0x36')]=function(_0xf11f03){this['handleError'](_0xf11f03);this['imap'][_0x4353('0x2d')](!![],this[_0x4353('0x24')][_0x4353('0xe')](this));};EmailImap[_0x4353('0x20')][_0x4353('0xf')]=function(){this[_0x4353('0x22')](_0x4353('0x25'));};EmailImap[_0x4353('0x20')][_0x4353('0x11')]=function(_0x5b3b4d,_0x3e4cfa){logger[_0x4353('0x10')](_0x4353('0x11'),this[_0x4353('0x35')][_0x4353('0x9')],JSON['stringify'](_0x5b3b4d));var _0x5d4158='';if(_0x5b3b4d){if(_0x5b3b4d['textCode']){_0x5d4158=_0x5b3b4d[_0x4353('0x37')];}else{for(var _0x513522 in _0x5b3b4d){if(_0x5b3b4d[_0x4353('0x38')](_0x513522)){_0x5d4158+=_[_0x4353('0x39')](_0x513522)+':\x20'+_0x5b3b4d[_0x513522]+'\x0a';}}}}if(_0x3e4cfa){this[_0x4353('0x1')][_0x4353('0x25')]();}else{this[_0x4353('0x22')]('error',_0x5d4158);this['emit']('end');}};module[_0x4353('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 481809e..79024d1 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 _0xe0df=['verify','createTransport','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe0df,0x71));var _0xfe0d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe0df[_0xbca1b1];return _0x4e1686;};'use strict';var nodemailer=require(_0xfe0d('0x0'));var inlineBase64=require(_0xfe0d('0x1'));function EmailSmtp(){}EmailSmtp[_0xfe0d('0x2')][_0xfe0d('0x3')]=function(_0x5e2ef5,_0xebeaf8){return new Promise(function(_0x474401,_0x5a5790){var _0x1dd952=nodemailer['createTransport'](_0x5e2ef5);_0x1dd952[_0xfe0d('0x4')](_0xfe0d('0x5'),inlineBase64());_0x1dd952[_0xfe0d('0x6')](_0xebeaf8,function(_0x4f790b,_0x4163ef){if(_0x4f790b){_0x5a5790(_0x4f790b[_0xfe0d('0x7')]());}else{_0x474401(_0x4163ef);}});});};EmailSmtp[_0xfe0d('0x2')][_0xfe0d('0x8')]=function(_0x141d17){return new Promise(function(_0x1de228,_0xc161d){var _0x5aa504=nodemailer[_0xfe0d('0x9')](_0x141d17);_0x5aa504['verify'](function(_0xad8a49,_0x4a2001){if(_0xad8a49){_0xc161d(_0xad8a49[_0xfe0d('0x7')]());}else{if(_0x4a2001){_0x1de228(_0x4a2001);}else{_0xc161d('Not\x20verifired');}}});});};module[_0xfe0d('0xa')]=EmailSmtp; \ No newline at end of file +var _0x7d37=['sendMail','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile'];(function(_0x322310,_0x2665cc){var _0x510c82=function(_0x1a78b3){while(--_0x1a78b3){_0x322310['push'](_0x322310['shift']());}};_0x510c82(++_0x2665cc);}(_0x7d37,0x122));var _0x77d3=function(_0x4dd10a,_0x44abbe){_0x4dd10a=_0x4dd10a-0x0;var _0x5bb6d9=_0x7d37[_0x4dd10a];return _0x5bb6d9;};'use strict';var nodemailer=require(_0x77d3('0x0'));var inlineBase64=require(_0x77d3('0x1'));function EmailSmtp(){}EmailSmtp[_0x77d3('0x2')][_0x77d3('0x3')]=function(_0x2a2015,_0x1fae5e){return new Promise(function(_0x3d406f,_0x1f442c){var _0x4ad99a=nodemailer[_0x77d3('0x4')](_0x2a2015);_0x4ad99a[_0x77d3('0x5')](_0x77d3('0x6'),inlineBase64());_0x4ad99a[_0x77d3('0x7')](_0x1fae5e,function(_0x57cb61,_0x7398d1){if(_0x57cb61){_0x1f442c(_0x57cb61['toString']());}else{_0x3d406f(_0x7398d1);}});});};EmailSmtp[_0x77d3('0x2')]['verify']=function(_0x2efab0){return new Promise(function(_0x4968bb,_0x5bd1b4){var _0x4106a6=nodemailer['createTransport'](_0x2efab0);_0x4106a6['verify'](function(_0x1694ac,_0x47de90){if(_0x1694ac){_0x5bd1b4(_0x1694ac[_0x77d3('0x8')]());}else{if(_0x47de90){_0x4968bb(_0x47de90);}else{_0x5bd1b4(_0x77d3('0x9'));}}});});};module[_0x77d3('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 66b1ee7..c9f946a 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 _0x0f7d=['includes','originCc','bcc','attachments','attach','attachment','attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','headerLines','line','isAutoreply','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','util','node-tnef','email','head','value','address','generate','name','substring','indexOf','split','length','slice','join','Anonymous','pop','anonymous','@xcally.com','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x30792e[_0xd0f7('0xe')](0x0,-0x1)[_0xd0f7('0xf')]('\x20'):_0x36e7ab['name'];}return _0xd0f7('0x10');}function getLastName(_0x50b4b8){var _0x5b6c26=_[_0xd0f7('0x5')](_0x50b4b8[_0xd0f7('0x6')]);if(_0x5b6c26&&_0x5b6c26[_0xd0f7('0x9')]){var _0x17465c=_0x5b6c26[_0xd0f7('0x9')][_0xd0f7('0xc')](/\s+/);return _0x17465c['length']>0x1?_0x17465c[_0xd0f7('0x11')]():'';}return'';}function getMails(_0x451da8,_0x2047da){var _0x389701='';for(var _0x2beba1=0x0;_0x2beba1<_0x2047da[_0xd0f7('0x6')][_0xd0f7('0xd')];_0x2beba1+=0x1){if(_0x2047da['value'][_0x2beba1][_0xd0f7('0x7')]!==_0x451da8){if(!_['isEmpty'](_0x389701)){_0x389701+=',';}_0x389701+=_0x2047da[_0xd0f7('0x6')][_0x2beba1][_0xd0f7('0x9')]||_0x2047da[_0xd0f7('0x6')][_0x2beba1]['address']||'';_0x389701+='\x20<';_0x389701+=_0x2047da['value'][_0x2beba1][_0xd0f7('0x7')]?_0x2047da['value'][_0x2beba1][_0xd0f7('0x7')]:_0xd0f7('0x12')+random[_0xd0f7('0x8')](0x6)+_0xd0f7('0x13');_0x389701+='>';}}return _0x389701;}function parseEmail(_0x45d424,_0x367311,_0x5f1881){if(_0x367311[_0xd0f7('0x14')]){var _0x29c99c=/)<[^<]*)*<\/script>/gi;while(_0x29c99c['test'](_0x367311[_0xd0f7('0x14')])){_0x367311[_0xd0f7('0x14')]=_0x367311[_0xd0f7('0x14')][_0xd0f7('0x15')](_0x29c99c,'');}if(_0x367311[_0xd0f7('0x14')]['includes'](_0xd0f7('0x16'))){var _0x2bc01a=[];_0x367311['attachments'][_0xd0f7('0x17')](_0x3c482d=>{_0x2bc01a[_0xd0f7('0x18')](_0x3c482d[_0xd0f7('0x19')]);});var _0x31ba35=/]+>/g;var _0x43e406=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5b87d7=_0x367311[_0xd0f7('0x14')][_0xd0f7('0x15')](_0x43e406,'_SRC');var _0x5c6a07=_0x5b87d7['replace'](_0x31ba35,'_IMG');for(let _0x21ba72=0x0;_0x21ba72<_0x2bc01a[_0xd0f7('0xd')];_0x21ba72++){var _0x3d0994=_0x5c6a07[_0xd0f7('0x15')](_0xd0f7('0x1a'),_0xd0f7('0x1b')+_0x2bc01a[_0x21ba72]+_0xd0f7('0x1c'));_0x5c6a07=_0x3d0994;}_0x367311[_0xd0f7('0x14')]=_0x5c6a07;}_0x5f1881[_0xd0f7('0x1d')]=_0x367311['html'];}else{_0x5f1881['body']=_0x367311[_0xd0f7('0x1e')];}if(_0x5f1881[_0xd0f7('0x1d')]){_0x5f1881['body']=_0x5f1881[_0xd0f7('0x1d')][_0xd0f7('0x15')](/0x0){var _0x4247c5=[_0xd0f7('0x31'),_0xd0f7('0x32'),_0xd0f7('0x33')];for(var _0x520784=0x0;_0x520784<_0x367311[_0xd0f7('0x34')][_0xd0f7('0xd')];_0x520784++){var _0x113ea8=_[_0xd0f7('0xb')](_0x4247c5,_0x367311[_0xd0f7('0x34')][_0x520784][_0xd0f7('0x35')]);if(_0x113ea8>=0x0){_0x5f1881[_0xd0f7('0x36')]=!![];}}}return _0x5f1881;}exports['parser']=function(_0xc3cf17,_0x1834cb,_0x32283e){var _0x5300b1={'from':getAddress(_0x1834cb[_0xd0f7('0x37')]),'firstName':getFirstName(_0x1834cb[_0xd0f7('0x37')]),'lastName':getLastName(_0x1834cb[_0xd0f7('0x37')]),'mapKey':_0xd0f7('0x4'),'message':{'from':getMails(_0xc3cf17[_0xd0f7('0x4')],_0x1834cb['from']),'to':_0xc3cf17[_0xd0f7('0x4')],'cc':'','subject':_0x1834cb[_0xd0f7('0x38')]||'','messageId':_0x1834cb[_0xd0f7('0x39')],'inReplyTo':_0x1834cb[_0xd0f7('0x3a')],'sentAt':moment(_0x1834cb[_0xd0f7('0x3b')])[_0xd0f7('0x3c')](_0xd0f7('0x3d')),'attach':![],'attachments':[]}};if(!_0x1834cb[_0xd0f7('0x14')]&&!_0x1834cb[_0xd0f7('0x1e')]){var _0xf08bce=_[_0xd0f7('0x3e')](_0x1834cb[_0xd0f7('0x26')],{'contentType':_0xd0f7('0x3f')});if(_0xf08bce[_0xd0f7('0xd')]){logger[_0xd0f7('0x40')](util[_0xd0f7('0x3c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1834cb['messageId']));tnef[_0xd0f7('0x41')](_[_0xd0f7('0x42')](_0xf08bce)[_0xd0f7('0x2f')],function(_0x180fd3,_0x42e9c0){if(_0x42e9c0){_0x1834cb[_0xd0f7('0x14')]=_0x42e9c0[_0xd0f7('0x43')]||_0xd0f7('0x44');if(_0x42e9c0[_0xd0f7('0x45')]){for(var _0x3c1f13=0x0;_0x3c1f13<_0x42e9c0[_0xd0f7('0x45')]['length'];_0x3c1f13++){var _0x163d9e=_0x42e9c0[_0xd0f7('0x45')][_0x3c1f13];_0x5300b1[_0xd0f7('0x20')][_0xd0f7('0x26')][_0xd0f7('0x18')]({'filename':_0x163d9e[_0xd0f7('0x46')],'content':Buffer[_0xd0f7('0x37')](_0x163d9e[_0xd0f7('0x47')])});}}}_0x32283e(parseEmail(_0xc3cf17,_0x1834cb,_0x5300b1));});}else{_0x1834cb[_0xd0f7('0x14')]='

Empty\x20message

';_0x32283e(parseEmail(_0xc3cf17,_0x1834cb,_0x5300b1));}}else{_0x32283e(parseEmail(_0xc3cf17,_0x1834cb,_0x5300b1));}};exports[_0xd0f7('0x48')]=function(_0x1897f2,_0x1e63d2){var _0x439e92=[_0xd0f7('0x49')+(_0x1e63d2||''),_0xd0f7('0x4a')+_0x1897f2,'',''];return Buffer[_0xd0f7('0x37')](_0x439e92[_0xd0f7('0xf')](''),_0xd0f7('0x4b'))[_0xd0f7('0x4c')](_0xd0f7('0x4d'));}; \ No newline at end of file +var _0xf7b3=['replace','includes','\x20[Attachment:\x20','body','textAsHtml','message','originTo','originCc','bcc','type','attachment','attachment-','format','%s-%s','now','root','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','parseBuffer','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split','length','join','Anonymous','isEmpty','anonymous','html','test'];(function(_0x11ecea,_0xac684e){var _0x3c033b=function(_0x5926a1){while(--_0x5926a1){_0x11ecea['push'](_0x11ecea['shift']());}};_0x3c033b(++_0xac684e);}(_0xf7b3,0x77));var _0x3f7b=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xf7b3[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require('lodash');var moment=require(_0x3f7b('0x0'));var random=require(_0x3f7b('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x3f7b('0x2'));var tnef=require(_0x3f7b('0x3'));var logger=require(_0x3f7b('0x4'))(_0x3f7b('0x5'));var config=require(_0x3f7b('0x6'));function getAddress(_0x4c0736){var _0x3f61ec=_[_0x3f7b('0x7')](_0x4c0736[_0x3f7b('0x8')]);return _0x3f61ec&&_0x3f61ec[_0x3f7b('0x9')]?_0x3f61ec[_0x3f7b('0x9')]:'anonymous'+random[_0x3f7b('0xa')](0x6)+_0x3f7b('0xb');}function getFirstName(_0x370d1c){var _0x15e857=_[_0x3f7b('0x7')](_0x370d1c[_0x3f7b('0x8')]);if(_0x15e857&&_0x15e857[_0x3f7b('0xc')]){if(_0x15e857[_0x3f7b('0xc')]==_0x15e857[_0x3f7b('0x9')]){return _0x15e857[_0x3f7b('0xc')][_0x3f7b('0xd')](0x0,_0x15e857['name'][_0x3f7b('0xe')]('@'));}var _0x2e31d5=_0x15e857[_0x3f7b('0xc')][_0x3f7b('0xf')](/\s+/);return _0x2e31d5[_0x3f7b('0x10')]>0x1?_0x2e31d5['slice'](0x0,-0x1)[_0x3f7b('0x11')]('\x20'):_0x15e857[_0x3f7b('0xc')];}return _0x3f7b('0x12');}function getLastName(_0x5de8c5){var _0x5cbf6d=_[_0x3f7b('0x7')](_0x5de8c5['value']);if(_0x5cbf6d&&_0x5cbf6d[_0x3f7b('0xc')]){var _0x5b6791=_0x5cbf6d[_0x3f7b('0xc')][_0x3f7b('0xf')](/\s+/);return _0x5b6791[_0x3f7b('0x10')]>0x1?_0x5b6791['pop']():'';}return'';}function getMails(_0x2f6878,_0x34cec6){var _0x19728f='';for(var _0x47c2a3=0x0;_0x47c2a3<_0x34cec6[_0x3f7b('0x8')][_0x3f7b('0x10')];_0x47c2a3+=0x1){if(_0x34cec6[_0x3f7b('0x8')][_0x47c2a3][_0x3f7b('0x9')]!==_0x2f6878){if(!_[_0x3f7b('0x13')](_0x19728f)){_0x19728f+=',';}_0x19728f+=_0x34cec6[_0x3f7b('0x8')][_0x47c2a3][_0x3f7b('0xc')]||_0x34cec6[_0x3f7b('0x8')][_0x47c2a3][_0x3f7b('0x9')]||'';_0x19728f+='\x20<';_0x19728f+=_0x34cec6[_0x3f7b('0x8')][_0x47c2a3][_0x3f7b('0x9')]?_0x34cec6['value'][_0x47c2a3][_0x3f7b('0x9')]:_0x3f7b('0x14')+random[_0x3f7b('0xa')](0x6)+_0x3f7b('0xb');_0x19728f+='>';}}return _0x19728f;}function parseEmail(_0x4a42a5,_0x1aaba3,_0x28b1a7){if(_0x1aaba3[_0x3f7b('0x15')]){var _0x2f82eb=/)<[^<]*)*<\/script>/gi;while(_0x2f82eb[_0x3f7b('0x16')](_0x1aaba3['html'])){_0x1aaba3[_0x3f7b('0x15')]=_0x1aaba3[_0x3f7b('0x15')][_0x3f7b('0x17')](_0x2f82eb,'');}if(_0x1aaba3[_0x3f7b('0x15')][_0x3f7b('0x18')](_0x3f7b('0x19'))){var _0x92aecc=[];_0x1aaba3[_0x3f7b('0x1a')][_0x3f7b('0x1b')](_0x2c5e4f=>{_0x92aecc['push'](_0x2c5e4f[_0x3f7b('0x1c')]);});var _0x2ee478=/]+>/g;var _0x1013e8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x48d69d=_0x1aaba3['html'][_0x3f7b('0x17')](_0x1013e8,'_SRC');var _0x49089f=_0x48d69d[_0x3f7b('0x17')](_0x2ee478,_0x3f7b('0x1d'));for(let _0x220fc5=0x0;_0x220fc5<_0x92aecc[_0x3f7b('0x10')];_0x220fc5++){var _0x5103f0=_0x49089f[_0x3f7b('0x17')](_0x3f7b('0x1d'),_0x3f7b('0x1e')+_0x92aecc[_0x220fc5]+'\x20]');_0x49089f=_0x5103f0;}_0x1aaba3['html']=_0x49089f;}_0x28b1a7['body']=_0x1aaba3[_0x3f7b('0x15')];}else{_0x28b1a7[_0x3f7b('0x1f')]=_0x1aaba3[_0x3f7b('0x20')];}if(_0x28b1a7[_0x3f7b('0x1f')]){_0x28b1a7[_0x3f7b('0x1f')]=_0x28b1a7[_0x3f7b('0x1f')][_0x3f7b('0x17')](/0x0){var _0x2a3de3=[_0x3f7b('0x31'),_0x3f7b('0x32'),'Precedence:\x20auto_reply'];for(var _0x20a2aa=0x0;_0x20a2aa<_0x1aaba3[_0x3f7b('0x30')][_0x3f7b('0x10')];_0x20a2aa++){var _0x3803ef=_['indexOf'](_0x2a3de3,_0x1aaba3[_0x3f7b('0x30')][_0x20a2aa][_0x3f7b('0x33')]);if(_0x3803ef>=0x0){_0x28b1a7[_0x3f7b('0x34')]=!![];}}}return _0x28b1a7;}exports[_0x3f7b('0x35')]=function(_0x84a8bf,_0x1f6511,_0x3cd5bb){var _0x248142={'from':getAddress(_0x1f6511[_0x3f7b('0x36')]),'firstName':getFirstName(_0x1f6511[_0x3f7b('0x36')]),'lastName':getLastName(_0x1f6511['from']),'mapKey':_0x3f7b('0x5'),'message':{'from':getMails(_0x84a8bf[_0x3f7b('0x5')],_0x1f6511[_0x3f7b('0x36')]),'to':_0x84a8bf[_0x3f7b('0x5')],'cc':'','subject':_0x1f6511[_0x3f7b('0x37')]||'','messageId':_0x1f6511[_0x3f7b('0x38')],'inReplyTo':_0x1f6511[_0x3f7b('0x39')],'sentAt':moment(_0x1f6511['date'])[_0x3f7b('0x28')](_0x3f7b('0x3a')),'attach':![],'attachments':[]}};if(!_0x1f6511['html']&&!_0x1f6511[_0x3f7b('0x20')]){var _0x5795b1=_['filter'](_0x1f6511[_0x3f7b('0x1a')],{'contentType':'application/ms-tnef'});if(_0x5795b1[_0x3f7b('0x10')]){logger['info'](util[_0x3f7b('0x28')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1f6511['messageId']));tnef[_0x3f7b('0x3b')](_[_0x3f7b('0x3c')](_0x5795b1)[_0x3f7b('0x2d')],function(_0x32cb16,_0x9d0abf){if(_0x9d0abf){_0x1f6511['html']=_0x9d0abf['BodyHTML']||_0x3f7b('0x3d');if(_0x9d0abf[_0x3f7b('0x3e')]){for(var _0x5eeb99=0x0;_0x5eeb99<_0x9d0abf[_0x3f7b('0x3e')][_0x3f7b('0x10')];_0x5eeb99++){var _0x33d9a8=_0x9d0abf[_0x3f7b('0x3e')][_0x5eeb99];_0x248142['message'][_0x3f7b('0x1a')][_0x3f7b('0x2e')]({'filename':_0x33d9a8[_0x3f7b('0x3f')],'content':Buffer[_0x3f7b('0x36')](_0x33d9a8[_0x3f7b('0x40')])});}}}_0x3cd5bb(parseEmail(_0x84a8bf,_0x1f6511,_0x248142));});}else{_0x1f6511[_0x3f7b('0x15')]='

Empty\x20message

';_0x3cd5bb(parseEmail(_0x84a8bf,_0x1f6511,_0x248142));}}else{_0x3cd5bb(parseEmail(_0x84a8bf,_0x1f6511,_0x248142));}};exports[_0x3f7b('0x41')]=function(_0x5a4293,_0x31b952){var _0x226a80=[_0x3f7b('0x42')+(_0x31b952||''),_0x3f7b('0x43')+_0x5a4293,'',''];return Buffer[_0x3f7b('0x36')](_0x226a80[_0x3f7b('0x11')](''),_0x3f7b('0x44'))[_0x3f7b('0x45')](_0x3f7b('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6163986..b49e08a 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 _0x9652=['active','Imap','Smtp','name','key','SERV'];(function(_0x5c16d7,_0x4802d8){var _0x57ea07=function(_0x597a72){while(--_0x597a72){_0x5c16d7['push'](_0x5c16d7['shift']());}};_0x57ea07(++_0x4802d8);}(_0x9652,0x16b));var _0x2965=function(_0x58f8d6,_0x3de6e9){_0x58f8d6=_0x58f8d6-0x0;var _0x249399=_0x9652[_0x58f8d6];return _0x249399;};'use strict';var _=require('lodash');function MailAccount(_0x4f3416){this['id']=_0x4f3416['id']||0x0;this[_0x2965('0x0')]=_0x4f3416[_0x2965('0x0')]||'Service';this[_0x2965('0x1')]=_0x4f3416['key']||_0x2965('0x2');this[_0x2965('0x3')]=_0x4f3416[_0x2965('0x3')]||![];this[_0x2965('0x4')]=_0x4f3416['Imap']||[];this[_0x2965('0x5')]=_0x4f3416['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x6938=['name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6938,0xe8));var _0x8693=function(_0x2db98d,_0x364e98){_0x2db98d=_0x2db98d-0x0;var _0x3c0ffe=_0x6938[_0x2db98d];return _0x3c0ffe;};'use strict';var _=require('lodash');function MailAccount(_0xc5e21){this['id']=_0xc5e21['id']||0x0;this[_0x8693('0x0')]=_0xc5e21['name']||_0x8693('0x1');this['key']=_0xc5e21[_0x8693('0x2')]||_0x8693('0x3');this[_0x8693('0x4')]=_0xc5e21[_0x8693('0x4')]||![];this['Imap']=_0xc5e21[_0x8693('0x5')]||[];this[_0x8693('0x6')]=_0xc5e21['Smtp']||[];}module[_0x8693('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 6eaef02..cd93904 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 _0xdd4c=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','lodash','../model/mailAccount'];(function(_0x1839fa,_0x2d18ba){var _0x599af0=function(_0x4b1afe){while(--_0x4b1afe){_0x1839fa['push'](_0x1839fa['shift']());}};_0x599af0(++_0x2d18ba);}(_0xdd4c,0x13e));var _0xcdd4=function(_0x12d78d,_0x46a9de){_0x12d78d=_0x12d78d-0x0;var _0xde4cb3=_0xdd4c[_0x12d78d];return _0xde4cb3;};'use strict';var _=require(_0xcdd4('0x0'));var MailAccount=require(_0xcdd4('0x1'));var Realtime=function(){this[_0xcdd4('0x2')]={};};function freeIsNotKey(_0x195b7a,_0x374e3c,_0x8530d0){var _0x57cd9f=_[_0xcdd4('0x3')](_0x195b7a,function(_0x12d279,_0x1e8353){return _0x12d279[_0x8530d0];});for(var _0x7597b4 in _0x374e3c){if(_0x374e3c[_0xcdd4('0x4')](_0x7597b4)){if(!_0x57cd9f[_0x7597b4]){delete _0x374e3c[_0x7597b4];}}}}Realtime[_0xcdd4('0x5')][_0xcdd4('0x6')]=function(_0x5e2337,_0x4acd3e){for(var _0x3c68ee in _0x4acd3e){if(_0x5e2337[_0xcdd4('0x4')](_0x3c68ee)){_0x5e2337[_0x3c68ee]=_0x4acd3e[_0x3c68ee];}}};Realtime['prototype'][_0xcdd4('0x7')]=function(){var _0x414a36=this;return function(_0x1568d9){if(_0x1568d9){freeIsNotKey(_0x1568d9,_0x414a36[_0xcdd4('0x2')],'id');for(var _0x5a6ab0=0x0,_0x3e023f={},_0x4f5c51={};_0x5a6ab0<_0x1568d9[_0xcdd4('0x8')];_0x5a6ab0+=0x1){_0x3e023f=_0x1568d9[_0x5a6ab0];if(_[_0xcdd4('0x9')](_0x414a36[_0xcdd4('0x2')][_0x3e023f['id']])){_0x414a36[_0xcdd4('0x2')][_0x3e023f['id']]=new MailAccount(_0x3e023f);}else{_['merge'](_0x414a36['mailAccounts'][_0x3e023f['id']],_0x3e023f);}}}return _0x414a36[_0xcdd4('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe1f2=['exports','lodash','mapKeys','hasOwnProperty','prototype','initMailAccounts','mailAccounts','isUndefined','merge'];(function(_0x6bc489,_0x550593){var _0x4f2aea=function(_0x591568){while(--_0x591568){_0x6bc489['push'](_0x6bc489['shift']());}};_0x4f2aea(++_0x550593);}(_0xe1f2,0x172));var _0x2e1f=function(_0x4f6259,_0x35094b){_0x4f6259=_0x4f6259-0x0;var _0x35f1bb=_0xe1f2[_0x4f6259];return _0x35f1bb;};'use strict';var _=require(_0x2e1f('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x48294e,_0x1da85e,_0x4f5241){var _0x165497=_[_0x2e1f('0x1')](_0x48294e,function(_0x2d75d9,_0x308759){return _0x2d75d9[_0x4f5241];});for(var _0x52f80f in _0x1da85e){if(_0x1da85e[_0x2e1f('0x2')](_0x52f80f)){if(!_0x165497[_0x52f80f]){delete _0x1da85e[_0x52f80f];}}}}Realtime[_0x2e1f('0x3')]['mergeFromDatabase']=function(_0x4a9267,_0x532954){for(var _0x4e487e in _0x532954){if(_0x4a9267['hasOwnProperty'](_0x4e487e)){_0x4a9267[_0x4e487e]=_0x532954[_0x4e487e];}}};Realtime['prototype'][_0x2e1f('0x4')]=function(){var _0x212b1c=this;return function(_0x5e1eed){if(_0x5e1eed){freeIsNotKey(_0x5e1eed,_0x212b1c[_0x2e1f('0x5')],'id');for(var _0x12912f=0x0,_0x364dc9={},_0x3dea4f={};_0x12912f<_0x5e1eed['length'];_0x12912f+=0x1){_0x364dc9=_0x5e1eed[_0x12912f];if(_[_0x2e1f('0x6')](_0x212b1c[_0x2e1f('0x5')][_0x364dc9['id']])){_0x212b1c[_0x2e1f('0x5')][_0x364dc9['id']]=new MailAccount(_0x364dc9);}else{_[_0x2e1f('0x7')](_0x212b1c['mailAccounts'][_0x364dc9['id']],_0x364dc9);}}}return _0x212b1c[_0x2e1f('0x5')];};};module[_0x2e1f('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9761e70..f82f0dc 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 _0x002d=['ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','provider','service','email','active','key'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x002d,0xca));var _0xd002=function(_0x80a4c,_0x19bfa8){_0x80a4c=_0x80a4c-0x0;var _0x1cf5f5=_0x002d[_0x80a4c];return _0x1cf5f5;};'use strict';var client=require(_0xd002('0x0'));exports[_0xd002('0x1')]=function(){return function(){return client[_0xd002('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0xd002('0x3'),_0xd002('0x4'),_0xd002('0x5'),_0xd002('0x6'),_0xd002('0x7'),_0xd002('0x8'),_0xd002('0x9')],'raw':![],'include':[{'model':_0xd002('0xa'),'as':_0xd002('0xb'),'include':[{'model':_0xd002('0xc'),'attributes':['id',_0xd002('0xd'),_0xd002('0x4'),_0xd002('0xe'),_0xd002('0xf')],'as':_0xd002('0xc')}]},{'model':_0xd002('0x10'),'as':_0xd002('0x11'),'include':[{'model':'CloudProvider','attributes':['id','name',_0xd002('0x4'),_0xd002('0xe'),_0xd002('0xf')],'as':'CloudProvider'}]}]},'log':_0xd002('0x12')});};};exports[_0xd002('0x13')]=function(_0x439e07,_0xa09d51){return client[_0xd002('0x2')](_0xd002('0x14'),{'account':{'id':_0x439e07},'body':_0xa09d51,'log':_0xd002('0x14')});}; \ No newline at end of file +var _0xc12c=['Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email','active','key','ListId','MailServerIn'];(function(_0xca8a7d,_0x31f702){var _0x445822=function(_0x3d6e41){while(--_0x3d6e41){_0xca8a7d['push'](_0xca8a7d['shift']());}};_0x445822(++_0x31f702);}(_0xc12c,0xb3));var _0xcc12=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xc12c[_0x5b78e8];return _0xf2c321;};'use strict';var client=require(_0xcc12('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xcc12('0x1')](_0xcc12('0x2'),{'options':{'attributes':['id',_0xcc12('0x3'),_0xcc12('0x4'),_0xcc12('0x5'),_0xcc12('0x6'),_0xcc12('0x7'),_0xcc12('0x8'),_0xcc12('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0xcc12('0xa'),'as':_0xcc12('0xb'),'include':[{'model':_0xcc12('0xc'),'attributes':['id',_0xcc12('0x3'),_0xcc12('0x5'),_0xcc12('0xd'),_0xcc12('0xe')],'as':_0xcc12('0xc')}]},{'model':'MailServerOut','as':_0xcc12('0xf'),'include':[{'model':_0xcc12('0xc'),'attributes':['id',_0xcc12('0x3'),_0xcc12('0x5'),'type',_0xcc12('0xe')],'as':_0xcc12('0xc')}]}]},'log':_0xcc12('0x10')});};};exports[_0xcc12('0x11')]=function(_0x385c90,_0x5e0952){return client['Request'](_0xcc12('0x12'),{'account':{'id':_0x385c90},'body':_0x5e0952,'log':_0xcc12('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index c8ea871..55b6d84 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 _0x01d0=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x4b23e7,_0x15a180){var _0x5b3ed0=function(_0x6a9310){while(--_0x6a9310){_0x4b23e7['push'](_0x4b23e7['shift']());}};_0x5b3ed0(++_0x15a180);}(_0x01d0,0x7c));var _0x001d=function(_0x34c773,_0x270145){_0x34c773=_0x34c773-0x0;var _0x4ab6e3=_0x01d0[_0x34c773];return _0x4ab6e3;};'use strict';var client=require(_0x001d('0x0'));exports[_0x001d('0x1')]=function(){return client[_0x001d('0x2')](_0x001d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x001d('0x4')});}; \ No newline at end of file +var _0x5a56=['../client','getSettings','ShowSetting','GetSettings'];(function(_0x36f872,_0x288676){var _0x5d2070=function(_0x6d296c){while(--_0x6d296c){_0x36f872['push'](_0x36f872['shift']());}};_0x5d2070(++_0x288676);}(_0x5a56,0x18c));var _0x65a5=function(_0xad5cf9,_0x5e7334){_0xad5cf9=_0xad5cf9-0x0;var _0xfc4f10=_0x5a56[_0xad5cf9];return _0xfc4f10;};'use strict';var client=require(_0x65a5('0x0'));exports[_0x65a5('0x1')]=function(){return client['Request'](_0x65a5('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x65a5('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d4f5617..76301c5 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 06c74f4..9320393 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 _0x0efd=['lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0x0efd,0x69));var _0xd0ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0efd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0ef('0x0'));var http=require(_0xd0ef('0x1'));var express=require(_0xd0ef('0x2'));var sticky=require(_0xd0ef('0x3'));var Redis=require(_0xd0ef('0x4'));var config=require(_0xd0ef('0x5'));var app=express();var server=http[_0xd0ef('0x6')](app);server[_0xd0ef('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0xd0ef('0x8')])){var socketio=require(_0xd0ef('0x9'))(server,{'transports':['websocket','polling']});config[_0xd0ef('0xa')]=_['defaults'](config['redis'],{'host':_0xd0ef('0xb'),'port':0x18eb});socketio['adapter'](require(_0xd0ef('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xd0ef('0xa')])}));require(_0xd0ef('0xd'))[_0xd0ef('0xe')]();require(_0xd0ef('0xf'))['default'](socketio);require(_0xd0ef('0x10'))[_0xd0ef('0xe')](app);require('../../routes')[_0xd0ef('0xe')](app);}else{server[_0xd0ef('0x11')](_0xd0ef('0x12'),function(){console['log'](_0xd0ef('0x13'),config[_0xd0ef('0x8')]);});}exports=module[_0xd0ef('0x14')]=app; \ No newline at end of file +var _0x4ee6=['../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../routes','once','listening','exports','express'];(function(_0x39a34a,_0x45968c){var _0x10bb03=function(_0x2a90cc){while(--_0x2a90cc){_0x39a34a['push'](_0x39a34a['shift']());}};_0x10bb03(++_0x45968c);}(_0x4ee6,0x9f));var _0x64ee=function(_0x55b90e,_0x460549){_0x55b90e=_0x55b90e-0x0;var _0x3adcb6=_0x4ee6[_0x55b90e];return _0x3adcb6;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x64ee('0x0'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x64ee('0x1'));var app=express();var server=http['createServer'](app);server[_0x64ee('0x2')]=0xdbba0;if(sticky[_0x64ee('0x3')](server,config[_0x64ee('0x4')])){var socketio=require(_0x64ee('0x5'))(server,{'transports':[_0x64ee('0x6'),_0x64ee('0x7')]});config[_0x64ee('0x8')]=_[_0x64ee('0x9')](config[_0x64ee('0x8')],{'host':_0x64ee('0xa'),'port':0x18eb});socketio[_0x64ee('0xb')](require(_0x64ee('0xc'))({'pubClient':new Redis(config[_0x64ee('0x8')]),'subClient':new Redis(config[_0x64ee('0x8')])}));require(_0x64ee('0xd'))['default']();require(_0x64ee('0xe'))[_0x64ee('0xf')](socketio);require('../../config/express')[_0x64ee('0xf')](app);require(_0x64ee('0x10'))[_0x64ee('0xf')](app);}else{server[_0x64ee('0x11')](_0x64ee('0x12'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x64ee('0x4')]);});}exports=module[_0x64ee('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 4880526..ba42ff4 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 _0xf264=['Request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x298a2f,_0x42610d){var _0x2d36dd=function(_0x1c5b53){while(--_0x1c5b53){_0x298a2f['push'](_0x298a2f['shift']());}};_0x2d36dd(++_0x42610d);}(_0xf264,0xbd));var _0x4f26=function(_0x3b9a5c,_0x17a703){_0x3b9a5c=_0x3b9a5c-0x0;var _0x5cfb76=_0xf264[_0x3b9a5c];return _0x5cfb76;};'use strict';var jayson=require(_0x4f26('0x0'));var BPromise=require(_0x4f26('0x1'));var logger=require(_0x4f26('0x2'))(_0x4f26('0x3'));var client=jayson[_0x4f26('0x4')][_0x4f26('0x5')]({'port':0x2329});client[_0x4f26('0x6')]=function(_0x40f0e4,_0x37a7d4){return new BPromise(function(_0x136866,_0x2f84d3){return client['request'](_0x40f0e4,_0x37a7d4)[_0x4f26('0x7')](function(_0x48e2f3){logger[_0x4f26('0x8')](_0x4f26('0x9'),_0x4f26('0x3'),_0x40f0e4,_0x37a7d4,_0x48e2f3);if(_0x48e2f3[_0x4f26('0xa')]){logger[_0x4f26('0xa')]('rpc',_0x4f26('0x3'),_0x40f0e4,_0x48e2f3['error'][_0x4f26('0xb')],_0x37a7d4);return _0x2f84d3(_0x48e2f3[_0x4f26('0xa')][_0x4f26('0xb')]);}else{return _0x136866(_0x48e2f3[_0x4f26('0xc')]);}})[_0x4f26('0xd')](function(_0x2dfd40){logger['error']('rpc',_0x4f26('0x3'),_0x40f0e4,_0x2dfd40,_0x37a7d4);return _0x2f84d3(_0x2dfd40);});});};module[_0x4f26('0xe')]=client; \ No newline at end of file +var _0x5c60=['then','debug','rpc','error','message','result','catch','jayson/promise','../../config/logger','routing','client','http','Request','request'];(function(_0x509dad,_0x1f995f){var _0x21e122=function(_0x2a9b90){while(--_0x2a9b90){_0x509dad['push'](_0x509dad['shift']());}};_0x21e122(++_0x1f995f);}(_0x5c60,0xa1));var _0x05c6=function(_0x3eabc4,_0x3dabbc){_0x3eabc4=_0x3eabc4-0x0;var _0x21ff58=_0x5c60[_0x3eabc4];return _0x21ff58;};'use strict';var jayson=require(_0x05c6('0x0'));var BPromise=require('bluebird');var logger=require(_0x05c6('0x1'))(_0x05c6('0x2'));var client=jayson[_0x05c6('0x3')][_0x05c6('0x4')]({'port':0x2329});client[_0x05c6('0x5')]=function(_0x2fc147,_0x3228fd){return new BPromise(function(_0x2eb3a1,_0x185ee8){return client[_0x05c6('0x6')](_0x2fc147,_0x3228fd)[_0x05c6('0x7')](function(_0x989ca5){logger[_0x05c6('0x8')]('rpc','routing',_0x2fc147,_0x3228fd,_0x989ca5);if(_0x989ca5['error']){logger['error'](_0x05c6('0x9'),_0x05c6('0x2'),_0x2fc147,_0x989ca5[_0x05c6('0xa')][_0x05c6('0xb')],_0x3228fd);return _0x185ee8(_0x989ca5['error'][_0x05c6('0xb')]);}else{return _0x2eb3a1(_0x989ca5[_0x05c6('0xc')]);}})[_0x05c6('0xd')](function(_0x371006){logger['error']('rpc',_0x05c6('0x2'),_0x2fc147,_0x371006,_0x3228fd);return _0x185ee8(_0x371006);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 67d55fc..d854fe1 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 _0x346e=['initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/faxQueue','resolve','then','getAgents'];(function(_0x1f4378,_0x4f416e){var _0x4b5219=function(_0x163696){while(--_0x163696){_0x1f4378['push'](_0x1f4378['shift']());}};_0x4b5219(++_0x4f416e);}(_0x346e,0x167));var _0xe346=function(_0x427074,_0xb76196){_0x427074=_0x427074-0x0;var _0x31a4e5=_0x346e[_0x427074];return _0x31a4e5;};'use strict';var BPromise=require('bluebird');var server=require(_0xe346('0x0'));var Realtime=require(_0xe346('0x1'));var user=require(_0xe346('0x2'));var interval=require(_0xe346('0x3'));var openchannelQueue=require(_0xe346('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xe346('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xe346('0x6')]()[_0xe346('0x7')](user[_0xe346('0x8')]())[_0xe346('0x7')](realtime[_0xe346('0x9')]())[_0xe346('0x7')](interval['getIntervals']())['then'](realtime[_0xe346('0xa')]())[_0xe346('0x7')](openchannelQueue[_0xe346('0xb')]())[_0xe346('0x7')](realtime[_0xe346('0xc')]())[_0xe346('0x7')](chatQueue[_0xe346('0xd')]())[_0xe346('0x7')](realtime[_0xe346('0xe')]())[_0xe346('0x7')](smsQueue[_0xe346('0xf')]())[_0xe346('0x7')](realtime[_0xe346('0x10')]())['then'](mailQueue['getMailQueues']())[_0xe346('0x7')](realtime[_0xe346('0x11')]())[_0xe346('0x7')](faxQueue[_0xe346('0x12')]())['then'](realtime[_0xe346('0x13')]())[_0xe346('0x7')](whatsappQueue[_0xe346('0x14')]())[_0xe346('0x7')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xe346('0x7')](function(_0x161b16){return initRealtime();})[_0xe346('0x7')](function(_0xe44a94){return setInterval(initRealtime,0x1388);})[_0xe346('0x15')](function(_0x586744){console[_0xe346('0x16')](_0x586744);});}main(); \ No newline at end of file +var _0x5119=['getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initWhatsappQueues','catch','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','resolve','then','initAgents'];(function(_0x4e3321,_0x23c724){var _0x4d6bdf=function(_0x179671){while(--_0x179671){_0x4e3321['push'](_0x4e3321['shift']());}};_0x4d6bdf(++_0x23c724);}(_0x5119,0xd3));var _0x9511=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x5119[_0x511bd1];return _0x4c48ec;};'use strict';var BPromise=require('bluebird');var server=require(_0x9511('0x0'));var Realtime=require('./realtime');var user=require(_0x9511('0x1'));var interval=require(_0x9511('0x2'));var openchannelQueue=require(_0x9511('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x9511('0x4'));var mailQueue=require(_0x9511('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x9511('0x6')]()[_0x9511('0x7')](user['getAgents']())[_0x9511('0x7')](realtime[_0x9511('0x8')]())[_0x9511('0x7')](interval[_0x9511('0x9')]())[_0x9511('0x7')](realtime[_0x9511('0xa')]())[_0x9511('0x7')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x9511('0xb')]())[_0x9511('0x7')](chatQueue[_0x9511('0xc')]())['then'](realtime[_0x9511('0xd')]())['then'](smsQueue[_0x9511('0xe')]())[_0x9511('0x7')](realtime[_0x9511('0xf')]())[_0x9511('0x7')](mailQueue[_0x9511('0x10')]())[_0x9511('0x7')](realtime['initMailQueues']())[_0x9511('0x7')](faxQueue[_0x9511('0x11')]())['then'](realtime['initFaxQueues']())[_0x9511('0x7')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x9511('0x12')]())[_0x9511('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x9511('0x7')](function(_0x322af1){return initRealtime();})[_0x9511('0x7')](function(_0x5768f8){return setInterval(initRealtime,0x1388);})[_0x9511('0x13')](function(_0xa8db19){console['log'](_0xa8db19);});}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 b66b4e3..be576ac 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0x1261[_0x5c0dcb];return _0x183a0e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x3bf878,_0x37c1ec){var _0x2a81cc=function(_0x2c7fdf){while(--_0x2c7fdf){_0x3bf878['push'](_0x3bf878['shift']());}};_0x2a81cc(++_0x37c1ec);}(_0xe14b,0x93));var _0xbe14=function(_0xd731bb,_0x13b877){_0xd731bb=_0xd731bb-0x0;var _0x2ace4b=_0xe14b[_0xd731bb];return _0x2ace4b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4769330..79fa7a9 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 _0xcee9=['SendMail','bluebird','jayson/promise','client','http','request','then','message','result','catch','sendMailMessage'];(function(_0xb6dbd4,_0x266af6){var _0x263e21=function(_0x3d216c){while(--_0x3d216c){_0xb6dbd4['push'](_0xb6dbd4['shift']());}};_0x263e21(++_0x266af6);}(_0xcee9,0x7a));var _0x9cee=function(_0x538c5,_0x37efc5){_0x538c5=_0x538c5-0x0;var _0x141ea0=_0xcee9[_0x538c5];return _0x141ea0;};'use strict';var BPromise=require(_0x9cee('0x0'));var jayson=require(_0x9cee('0x1'));var client=jayson[_0x9cee('0x2')][_0x9cee('0x3')]({'port':0x232b});function request(_0x669936,_0x2d59c8){return new BPromise(function(_0x120b0c,_0x25d476){return client[_0x9cee('0x4')](_0x669936,_0x2d59c8)[_0x9cee('0x5')](function(_0x3806ce){if(_0x3806ce['error']){return _0x25d476(_0x3806ce['error'][_0x9cee('0x6')]);}else{return _0x120b0c(_0x3806ce[_0x9cee('0x7')]);}})[_0x9cee('0x8')](function(_0x4bf9e0){return _0x25d476(_0x4bf9e0);});});}exports[_0x9cee('0x9')]=function(_0x5c74e4,_0x47c768){return request(_0x9cee('0xa'),{'account':_0x5c74e4,'message':_0x47c768});}; \ No newline at end of file +var _0x02a6=['catch','sendMailMessage','SendMail','jayson/promise','http','then','error','message','result'];(function(_0x4edac1,_0x3975da){var _0x4f38e5=function(_0x357fac){while(--_0x357fac){_0x4edac1['push'](_0x4edac1['shift']());}};_0x4f38e5(++_0x3975da);}(_0x02a6,0x159));var _0x602a=function(_0x5a5361,_0x14f04d){_0x5a5361=_0x5a5361-0x0;var _0x3f7a03=_0x02a6[_0x5a5361];return _0x3f7a03;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x602a('0x0'));var client=jayson['client'][_0x602a('0x1')]({'port':0x232b});function request(_0x429f41,_0x22e56c){return new BPromise(function(_0x18a540,_0x541dda){return client['request'](_0x429f41,_0x22e56c)[_0x602a('0x2')](function(_0x2fb8f1){if(_0x2fb8f1['error']){return _0x541dda(_0x2fb8f1[_0x602a('0x3')][_0x602a('0x4')]);}else{return _0x18a540(_0x2fb8f1[_0x602a('0x5')]);}})[_0x602a('0x6')](function(_0x380ac7){return _0x541dda(_0x380ac7);});});}exports[_0x602a('0x7')]=function(_0x1d8523,_0x5d0c91){return request(_0x602a('0x8'),{'account':_0x1d8523,'message':_0x5d0c91});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index cddfb1c..376bb83 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 _0x7a3b=['online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','CurrentCapacity','Capacity','working','idle','prototype','mail','chat','openchannel','sms','whatsapp','getChannelStatus','Status','StatusTime','toNumber','chatStatusTime','mailCurrentCapacity','smsStatus','smsStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','name'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0x7a3b,0xb5));var _0xb7a3=function(_0xedc14,_0x4b4136){_0xedc14=_0xedc14-0x0;var _0x15756f=_0x7a3b[_0xedc14];return _0x15756f;};'use strict';var _=require(_0xb7a3('0x0'));var moment=require(_0xb7a3('0x1'));var md5=require(_0xb7a3('0x2'));var Redis=require('ioredis');var config=require(_0xb7a3('0x3'));config[_0xb7a3('0x4')]=_[_0xb7a3('0x5')](config[_0xb7a3('0x4')],{'host':_0xb7a3('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x1ffa39){this['id']=_0x1ffa39['id']||0x0;this[_0xb7a3('0x7')]=_0x1ffa39[_0xb7a3('0x7')]||'';this['online']=_0x1ffa39[_0xb7a3('0x8')]||!![];this['voicePause']=_0x1ffa39[_0xb7a3('0x9')]||![];this[_0xb7a3('0xa')]=_0x1ffa39[_0xb7a3('0xa')]||![];this[_0xb7a3('0xb')]=_0x1ffa39[_0xb7a3('0xb')]||![];this[_0xb7a3('0xc')]=_0x1ffa39[_0xb7a3('0xc')]||![];this[_0xb7a3('0xd')]=_0x1ffa39[_0xb7a3('0xd')]||![];this[_0xb7a3('0xe')]=_0x1ffa39[_0xb7a3('0xe')]||![];this['chatStatus']=_0xb7a3('0xf');this['chatStatusTime']=0x0;this[_0xb7a3('0x10')]=_0x1ffa39[_0xb7a3('0x10')]||0x0;this[_0xb7a3('0x11')]=0x0;this[_0xb7a3('0x12')]='unknown';this[_0xb7a3('0x13')]=0x0;this['mailCapacity']=_0x1ffa39[_0xb7a3('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xb7a3('0xf');this[_0xb7a3('0x15')]=0x0;this[_0xb7a3('0x16')]=_0x1ffa39[_0xb7a3('0x16')]||0x0;this[_0xb7a3('0x17')]=0x0;this['smsStatus']=_0xb7a3('0xf');this['smsStatusTime']=0x0;this['smsCapacity']=_0x1ffa39[_0xb7a3('0x18')]||0x0;this[_0xb7a3('0x19')]=0x0;this[_0xb7a3('0x1a')]=_0xb7a3('0xf');this[_0xb7a3('0x1b')]=0x0;this[_0xb7a3('0x1c')]=_0x1ffa39[_0xb7a3('0x1c')]||0x0;this[_0xb7a3('0x1d')]=0x0;this[_0xb7a3('0x1e')]='unknown';this[_0xb7a3('0x1f')]=0x0;this[_0xb7a3('0x20')]=_0x1ffa39[_0xb7a3('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xb7a3('0x21')]=![];this[_0xb7a3('0x22')]=undefined;this[_0xb7a3('0x2')]='';this[_0xb7a3('0x23')]={};this[_0xb7a3('0x24')]={};this[_0xb7a3('0x25')]={};this[_0xb7a3('0x26')]={};this[_0xb7a3('0x27')]={};this['whatsappWaitingInteractions']={};this[_0xb7a3('0x28')]();}Agent['prototype']['getChannelStatus']=function(_0x3f8b5e){if(this[_0x3f8b5e+_0xb7a3('0x29')]>0x0){if(this[_0x3f8b5e+_0xb7a3('0x2a')]>0x0&&this[_0x3f8b5e+_0xb7a3('0x29')]>=this[_0x3f8b5e+_0xb7a3('0x2a')]){return'maxcapacity';}else{return _0xb7a3('0x2b');}}else{return _0xb7a3('0x2c');}};Agent[_0xb7a3('0x2d')][_0xb7a3('0x28')]=function(){var _0x36388d=[_0xb7a3('0x2e'),_0xb7a3('0x2f'),_0xb7a3('0x30'),'fax',_0xb7a3('0x31'),_0xb7a3('0x32')];for(var _0x385c66=0x0;_0x385c66<_0x36388d['length'];_0x385c66+=0x1){var _0xcfb705=this[_0xb7a3('0x33')](_0x36388d[_0x385c66]);if(this[_0x36388d[_0x385c66]+_0xb7a3('0x34')]!==_0xcfb705){this[_0x36388d[_0x385c66]+_0xb7a3('0x35')]=_[_0xb7a3('0x36')](moment()['format']('x'));}this[_0x36388d[_0x385c66]+'Status']=_0xcfb705;}var _0x229438={'id':this['id'],'name':this[_0xb7a3('0x7')],'online':this['online'],'voicePause':this[_0xb7a3('0x9')],'chatPause':this[_0xb7a3('0xa')],'mailPause':this[_0xb7a3('0xb')],'smsPause':this[_0xb7a3('0xd')],'faxPause':this[_0xb7a3('0xc')],'openchannelPause':this[_0xb7a3('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xb7a3('0x37')],'chatCapacity':this[_0xb7a3('0x10')],'chatCurrentCapacity':this[_0xb7a3('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xb7a3('0x14')],'mailCurrentCapacity':this[_0xb7a3('0x38')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xb7a3('0x15')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xb7a3('0x39')],'smsStatusTime':this[_0xb7a3('0x3a')],'smsCapacity':this[_0xb7a3('0x18')],'smsCurrentCapacity':this[_0xb7a3('0x19')],'whatsappStatus':this[_0xb7a3('0x1a')],'whatsappStatusTime':this[_0xb7a3('0x1b')],'whatsappCapacity':this[_0xb7a3('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xb7a3('0x1e')],'openchannelStatusTime':this[_0xb7a3('0x1f')],'openchannelCapacity':this[_0xb7a3('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xb7a3('0x21')],'busyQueue':this[_0xb7a3('0x22')],'chatWaitingInteractions':this[_0xb7a3('0x23')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xb7a3('0x25')],'openchannelWaitingInteractions':this[_0xb7a3('0x26')],'smsWaitingInteractions':this[_0xb7a3('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x3639ba=md5(JSON[_0xb7a3('0x3b')](_0x229438));if(this[_0xb7a3('0x2')]!==_0x3639ba){this[_0xb7a3('0x2')]=_0x3639ba;io[_0xb7a3('0x3c')](_0xb7a3('0x3d'),_0x229438);}};module[_0xb7a3('0x3e')]=Agent; \ No newline at end of file +var _0xc727=['smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','prototype','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatusTime','chatCurrentCapacity','mailCurrentCapacity','smsStatus','smsStatusTime','whatsappCurrentCapacity','openchannelStatusTime','emit','user:save','lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions'];(function(_0xa65ffb,_0x53dd5b){var _0x491769=function(_0x237134){while(--_0x237134){_0xa65ffb['push'](_0xa65ffb['shift']());}};_0x491769(++_0x53dd5b);}(_0xc727,0x94));var _0x7c72=function(_0x25e1fd,_0x28cff0){_0x25e1fd=_0x25e1fd-0x0;var _0x3e9e8b=_0xc727[_0x25e1fd];return _0x3e9e8b;};'use strict';var _=require(_0x7c72('0x0'));var moment=require('moment');var md5=require(_0x7c72('0x1'));var Redis=require(_0x7c72('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x7c72('0x3')],{'host':_0x7c72('0x4'),'port':0x18eb});var io=require(_0x7c72('0x5'))(new Redis(config['redis']));function Agent(_0xf7b22d){this['id']=_0xf7b22d['id']||0x0;this['name']=_0xf7b22d[_0x7c72('0x6')]||'';this['online']=_0xf7b22d[_0x7c72('0x7')]||!![];this[_0x7c72('0x8')]=_0xf7b22d[_0x7c72('0x8')]||![];this[_0x7c72('0x9')]=_0xf7b22d['chatPause']||![];this[_0x7c72('0xa')]=_0xf7b22d['mailPause']||![];this[_0x7c72('0xb')]=_0xf7b22d[_0x7c72('0xb')]||![];this[_0x7c72('0xc')]=_0xf7b22d[_0x7c72('0xc')]||![];this[_0x7c72('0xd')]=_0xf7b22d['openchannelPause']||![];this[_0x7c72('0xe')]=_0x7c72('0xf');this['chatStatusTime']=0x0;this[_0x7c72('0x10')]=_0xf7b22d[_0x7c72('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x7c72('0x11')]=_0x7c72('0xf');this[_0x7c72('0x12')]=0x0;this[_0x7c72('0x13')]=_0xf7b22d[_0x7c72('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x7c72('0x14')]=_0x7c72('0xf');this[_0x7c72('0x15')]=0x0;this[_0x7c72('0x16')]=_0xf7b22d[_0x7c72('0x16')]||0x0;this[_0x7c72('0x17')]=0x0;this['smsStatus']=_0x7c72('0xf');this['smsStatusTime']=0x0;this[_0x7c72('0x18')]=_0xf7b22d['smsCapacity']||0x0;this[_0x7c72('0x19')]=0x0;this[_0x7c72('0x1a')]='unknown';this[_0x7c72('0x1b')]=0x0;this[_0x7c72('0x1c')]=_0xf7b22d['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x7c72('0x1d')]=_0x7c72('0xf');this['openchannelStatusTime']=0x0;this[_0x7c72('0x1e')]=_0xf7b22d[_0x7c72('0x1e')]||0x0;this[_0x7c72('0x1f')]=0x0;this[_0x7c72('0x20')]=![];this[_0x7c72('0x21')]=undefined;this[_0x7c72('0x1')]='';this[_0x7c72('0x22')]={};this[_0x7c72('0x23')]={};this[_0x7c72('0x24')]={};this[_0x7c72('0x25')]={};this[_0x7c72('0x26')]={};this[_0x7c72('0x27')]={};this[_0x7c72('0x28')]();}Agent['prototype'][_0x7c72('0x29')]=function(_0x125dc5){if(this[_0x125dc5+_0x7c72('0x2a')]>0x0){if(this[_0x125dc5+_0x7c72('0x2b')]>0x0&&this[_0x125dc5+'CurrentCapacity']>=this[_0x125dc5+_0x7c72('0x2b')]){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x7c72('0x2c')]['updateRealtime']=function(){var _0x1ccb96=['mail','chat',_0x7c72('0x2d'),_0x7c72('0x2e'),_0x7c72('0x2f'),_0x7c72('0x30')];for(var _0x21d81e=0x0;_0x21d81e<_0x1ccb96[_0x7c72('0x31')];_0x21d81e+=0x1){var _0x13ce0a=this[_0x7c72('0x29')](_0x1ccb96[_0x21d81e]);if(this[_0x1ccb96[_0x21d81e]+_0x7c72('0x32')]!==_0x13ce0a){this[_0x1ccb96[_0x21d81e]+_0x7c72('0x33')]=_['toNumber'](moment()[_0x7c72('0x34')]('x'));}this[_0x1ccb96[_0x21d81e]+'Status']=_0x13ce0a;}var _0x5ad289={'id':this['id'],'name':this[_0x7c72('0x6')],'online':this[_0x7c72('0x7')],'voicePause':this[_0x7c72('0x8')],'chatPause':this[_0x7c72('0x9')],'mailPause':this[_0x7c72('0xa')],'smsPause':this[_0x7c72('0xc')],'faxPause':this[_0x7c72('0xb')],'openchannelPause':this[_0x7c72('0xd')],'chatStatus':this[_0x7c72('0xe')],'chatStatusTime':this[_0x7c72('0x35')],'chatCapacity':this[_0x7c72('0x10')],'chatCurrentCapacity':this[_0x7c72('0x36')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x7c72('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x7c72('0x37')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x7c72('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7c72('0x38')],'smsStatusTime':this[_0x7c72('0x39')],'smsCapacity':this[_0x7c72('0x18')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x7c72('0x1b')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x7c72('0x3a')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x7c72('0x3b')],'openchannelCapacity':this[_0x7c72('0x1e')],'openchannelCurrentCapacity':this[_0x7c72('0x1f')],'busy':this[_0x7c72('0x20')],'busyQueue':this[_0x7c72('0x21')],'chatWaitingInteractions':this[_0x7c72('0x22')],'faxWaitingInteractions':this[_0x7c72('0x23')],'mailWaitingInteractions':this[_0x7c72('0x24')],'openchannelWaitingInteractions':this[_0x7c72('0x25')],'smsWaitingInteractions':this[_0x7c72('0x26')],'whatsappWaitingInteractions':this[_0x7c72('0x27')]};var _0x41f374=md5(JSON['stringify'](_0x5ad289));if(this[_0x7c72('0x1')]!==_0x41f374){this[_0x7c72('0x1')]=_0x41f374;io[_0x7c72('0x3c')](_0x7c72('0x3d'),_0x5ad289);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 87fc311..ad80382 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 _0xe78d=['Agents','mapAgentsId','updateRouting','_rr','prototype','updateRealtime','loggedIn','paused','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x419560,_0x16a92c){var _0x52a0a9=function(_0x1cdc67){while(--_0x1cdc67){_0x419560['push'](_0x419560['shift']());}};_0x52a0a9(++_0x16a92c);}(_0xe78d,0xbe));var _0xde78=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe78d[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xde78('0x0'));var md5=require(_0xde78('0x1'));var util=require(_0xde78('0x2'));var Redis=require(_0xde78('0x3'));var config=require(_0xde78('0x4'));config[_0xde78('0x5')]=_[_0xde78('0x6')](config['redis'],{'host':_0xde78('0x7'),'port':0x18eb});var io=require(_0xde78('0x8'))(new Redis(config[_0xde78('0x5')]));function ChatQueue(_0x3e5e79){this['id']=_0x3e5e79['id']||0x0;this['name']=_0x3e5e79[_0xde78('0x9')]||'';this[_0xde78('0xa')]=_0x3e5e79['timeout']||0xa;this['strategy']=_0x3e5e79[_0xde78('0xb')]||_0xde78('0xc');this['Agents']=_0x3e5e79[_0xde78('0xd')];this[_0xde78('0xe')]={};this['waiting']=0x0;this['md5']='';this[_0xde78('0xf')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x4a92c1=this[_0xde78('0xe')][_0xde78('0x10')];this[_0xde78('0xe')]=_['map'](this[_0xde78('0xd')],'id');this[_0xde78('0xe')][_0xde78('0x10')]=_0x4a92c1;};ChatQueue[_0xde78('0x11')][_0xde78('0x12')]=function(){this[_0xde78('0x13')]=0x0;this[_0xde78('0x14')]=0x0;for(var _0x404f8=0x0;_0x404f8=0x0?this[_0xde78('0x17')]:0x0;var _0x3078f7={'id':this['id'],'available':this['available'],'loggedIn':this[_0xde78('0x13')],'name':this[_0xde78('0x9')],'paused':this[_0xde78('0x14')],'waiting':this['waiting']};var _0x8ea24=md5(JSON[_0xde78('0x18')](_0x3078f7));if(this[_0xde78('0x1')]!==_0x8ea24){this[_0xde78('0x1')]=_0x8ea24;io['to'](util[_0xde78('0x19')](_0xde78('0x1a'),_0x3078f7['name']))[_0xde78('0x1b')](_0xde78('0x1c'),_0x3078f7);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x19a7=['paused','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x147e56,_0x2efae8){var _0x40c49c=function(_0x380aaa){while(--_0x380aaa){_0x147e56['push'](_0x147e56['shift']());}};_0x40c49c(++_0x2efae8);}(_0x19a7,0x1c8));var _0x719a=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x19a7[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var md5=require(_0x719a('0x0'));var util=require(_0x719a('0x1'));var Redis=require('ioredis');var config=require(_0x719a('0x2'));config[_0x719a('0x3')]=_[_0x719a('0x4')](config[_0x719a('0x3')],{'host':_0x719a('0x5'),'port':0x18eb});var io=require(_0x719a('0x6'))(new Redis(config[_0x719a('0x3')]));function ChatQueue(_0x50637b){this['id']=_0x50637b['id']||0x0;this[_0x719a('0x7')]=_0x50637b[_0x719a('0x7')]||'';this[_0x719a('0x8')]=_0x50637b[_0x719a('0x8')]||0xa;this[_0x719a('0x9')]=_0x50637b[_0x719a('0x9')]||_0x719a('0xa');this[_0x719a('0xb')]=_0x50637b[_0x719a('0xb')];this[_0x719a('0xc')]={};this[_0x719a('0xd')]=0x0;this[_0x719a('0x0')]='';this[_0x719a('0xe')]();this[_0x719a('0xf')]();}ChatQueue[_0x719a('0x10')][_0x719a('0xe')]=function(){var _0x569ac2=this[_0x719a('0xc')][_0x719a('0x11')];this[_0x719a('0xc')]=_[_0x719a('0x12')](this[_0x719a('0xb')],'id');this[_0x719a('0xc')][_0x719a('0x11')]=_0x569ac2;};ChatQueue[_0x719a('0x10')][_0x719a('0xf')]=function(){this[_0x719a('0x13')]=0x0;this[_0x719a('0x14')]=0x0;for(var _0x185328=0x0;_0x185328=0x0?this[_0x719a('0x17')]:0x0;var _0x37fb6a={'id':this['id'],'available':this[_0x719a('0x17')],'loggedIn':this[_0x719a('0x13')],'name':this['name'],'paused':this[_0x719a('0x14')],'waiting':this['waiting']};var _0x359600=md5(JSON['stringify'](_0x37fb6a));if(this[_0x719a('0x0')]!==_0x359600){this[_0x719a('0x0')]=_0x359600;io['to'](util[_0x719a('0x18')](_0x719a('0x19'),_0x37fb6a[_0x719a('0x7')]))[_0x719a('0x1a')](_0x719a('0x1b'),_0x37fb6a);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index a8e568c..165e35f 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 _0xd89b=['map','loggedIn','length','online','faxPause','paused','available','md5','format','fax:queue:%s','fax_queue:save','exports','lodash','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd89b,0x15c));var _0xbd89=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xd89b[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0xbd89('0x0'));var md5=require('md5');var util=require(_0xbd89('0x1'));var Redis=require(_0xbd89('0x2'));var config=require('../../../config/environment');config[_0xbd89('0x3')]=_[_0xbd89('0x4')](config[_0xbd89('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xbd89('0x5'))(new Redis(config[_0xbd89('0x3')]));function FaxQueue(_0x3d2e51){this['id']=_0x3d2e51['id']||0x0;this[_0xbd89('0x6')]=_0x3d2e51[_0xbd89('0x6')]||'';this[_0xbd89('0x7')]=_0x3d2e51[_0xbd89('0x7')]||0xa;this[_0xbd89('0x8')]=_0x3d2e51[_0xbd89('0x8')]||_0xbd89('0x9');this[_0xbd89('0xa')]=_0x3d2e51[_0xbd89('0xa')];this[_0xbd89('0xb')]={};this[_0xbd89('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xbd89('0xd')]();}FaxQueue[_0xbd89('0xe')]['updateRouting']=function(){var _0x34fbed=this['mapAgentsId'][_0xbd89('0xf')];this[_0xbd89('0xb')]=_[_0xbd89('0x10')](this['Agents'],'id');this[_0xbd89('0xb')][_0xbd89('0xf')]=_0x34fbed;};FaxQueue['prototype'][_0xbd89('0xd')]=function(){this[_0xbd89('0x11')]=0x0;this['paused']=0x0;for(var _0x15fa7b=0x0;_0x15fa7b=0x0?this[_0xbd89('0x16')]:0x0;var _0x183646={'id':this['id'],'available':this[_0xbd89('0x16')],'loggedIn':this[_0xbd89('0x11')],'name':this[_0xbd89('0x6')],'paused':this[_0xbd89('0x15')],'waiting':this[_0xbd89('0xc')]};var _0x4998cd=md5(JSON['stringify'](_0x183646));if(this['md5']!==_0x4998cd){this[_0xbd89('0x17')]=_0x4998cd;io['to'](util[_0xbd89('0x18')](_0xbd89('0x19'),_0x183646[_0xbd89('0x6')]))['emit'](_0xbd89('0x1a'),_0x183646);}};module[_0xbd89('0x1b')]=FaxQueue; \ No newline at end of file +var _0xba7a=['fax_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','emit'];(function(_0x51461b,_0x32ad42){var _0x1a66c4=function(_0x291777){while(--_0x291777){_0x51461b['push'](_0x51461b['shift']());}};_0x1a66c4(++_0x32ad42);}(_0xba7a,0xfd));var _0xaba7=function(_0x58d2c6,_0x3551b5){_0x58d2c6=_0x58d2c6-0x0;var _0x553a29=_0xba7a[_0x58d2c6];return _0x553a29;};'use strict';var _=require('lodash');var md5=require(_0xaba7('0x0'));var util=require(_0xaba7('0x1'));var Redis=require(_0xaba7('0x2'));var config=require(_0xaba7('0x3'));config[_0xaba7('0x4')]=_[_0xaba7('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xaba7('0x6'))(new Redis(config['redis']));function FaxQueue(_0x1f028d){this['id']=_0x1f028d['id']||0x0;this['name']=_0x1f028d[_0xaba7('0x7')]||'';this[_0xaba7('0x8')]=_0x1f028d['timeout']||0xa;this[_0xaba7('0x9')]=_0x1f028d[_0xaba7('0x9')]||_0xaba7('0xa');this[_0xaba7('0xb')]=_0x1f028d[_0xaba7('0xb')];this[_0xaba7('0xc')]={};this[_0xaba7('0xd')]=0x0;this[_0xaba7('0x0')]='';this[_0xaba7('0xe')]();this[_0xaba7('0xf')]();}FaxQueue['prototype'][_0xaba7('0xe')]=function(){var _0x250bfb=this[_0xaba7('0xc')]['_rr'];this[_0xaba7('0xc')]=_[_0xaba7('0x10')](this[_0xaba7('0xb')],'id');this[_0xaba7('0xc')][_0xaba7('0x11')]=_0x250bfb;};FaxQueue['prototype'][_0xaba7('0xf')]=function(){this[_0xaba7('0x12')]=0x0;this[_0xaba7('0x13')]=0x0;for(var _0x520478=0x0;_0x520478=0x0?this[_0xaba7('0x17')]:0x0;var _0x2e81fe={'id':this['id'],'available':this[_0xaba7('0x17')],'loggedIn':this[_0xaba7('0x12')],'name':this[_0xaba7('0x7')],'paused':this[_0xaba7('0x13')],'waiting':this[_0xaba7('0xd')]};var _0x395f7a=md5(JSON[_0xaba7('0x18')](_0x2e81fe));if(this[_0xaba7('0x0')]!==_0x395f7a){this[_0xaba7('0x0')]=_0x395f7a;io['to'](util[_0xaba7('0x19')]('fax:queue:%s',_0x2e81fe[_0xaba7('0x7')]))[_0xaba7('0x1a')](_0xaba7('0x1b'),_0x2e81fe);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e03edb1..19eb2b9 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 _0x1e99=['name','Intervals'];(function(_0x4e737a,_0x1f027c){var _0xb3c78e=function(_0x5934db){while(--_0x5934db){_0x4e737a['push'](_0x4e737a['shift']());}};_0xb3c78e(++_0x1f027c);}(_0x1e99,0xf2));var _0x91e9=function(_0x535acc,_0x160bca){_0x535acc=_0x535acc-0x0;var _0x54393a=_0x1e99[_0x535acc];return _0x54393a;};'use strict';function Interval(_0x23f49c){this['id']=_0x23f49c['id']||0x0;this['name']=_0x23f49c[_0x91e9('0x0')]||'';this[_0x91e9('0x1')]=_0x23f49c[_0x91e9('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x748b=['Intervals'];(function(_0x2f853a,_0x285ccd){var _0x152441=function(_0x4598a5){while(--_0x4598a5){_0x2f853a['push'](_0x2f853a['shift']());}};_0x152441(++_0x285ccd);}(_0x748b,0x1d3));var _0xb748=function(_0x39ed61,_0x5b8ba9){_0x39ed61=_0x39ed61-0x0;var _0x46fb5b=_0x748b[_0x39ed61];return _0x46fb5b;};'use strict';function Interval(_0x455898){this['id']=_0x455898['id']||0x0;this['name']=_0x455898['name']||'';this[_0xb748('0x0')]=_0x455898[_0xb748('0x0')]||{};}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 b337a38..c32a460 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 _0x1f46=['format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','Agents','prototype','paused','length','loggedIn','mailPause','available','stringify'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x1f46,0x14f));var _0x61f4=function(_0xc21d1e,_0x54fb97){_0xc21d1e=_0xc21d1e-0x0;var _0x14ae65=_0x1f46[_0xc21d1e];return _0x14ae65;};'use strict';var _=require(_0x61f4('0x0'));var md5=require(_0x61f4('0x1'));var util=require(_0x61f4('0x2'));var Redis=require(_0x61f4('0x3'));var config=require(_0x61f4('0x4'));config['redis']=_[_0x61f4('0x5')](config['redis'],{'host':_0x61f4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x32e7c3){this['id']=_0x32e7c3['id']||0x0;this['name']=_0x32e7c3[_0x61f4('0x7')]||'';this[_0x61f4('0x8')]=_0x32e7c3[_0x61f4('0x8')]||0xa;this['strategy']=_0x32e7c3[_0x61f4('0x9')]||_0x61f4('0xa');this['Agents']=_0x32e7c3['Agents'];this[_0x61f4('0xb')]={};this[_0x61f4('0xc')]=0x0;this[_0x61f4('0x1')]='';this['updateRouting']();this[_0x61f4('0xd')]();}MailQueue['prototype'][_0x61f4('0xe')]=function(){var _0x120ecc=this[_0x61f4('0xb')][_0x61f4('0xf')];this[_0x61f4('0xb')]=_[_0x61f4('0x10')](this[_0x61f4('0x11')],'id');this[_0x61f4('0xb')][_0x61f4('0xf')]=_0x120ecc;};MailQueue[_0x61f4('0x12')][_0x61f4('0xd')]=function(){this['loggedIn']=0x0;this[_0x61f4('0x13')]=0x0;for(var _0x577629=0x0;_0x577629=0x0?this['available']:0x0;var _0xfd5891={'id':this['id'],'available':this[_0x61f4('0x17')],'loggedIn':this[_0x61f4('0x15')],'name':this['name'],'paused':this[_0x61f4('0x13')],'waiting':this[_0x61f4('0xc')]};var _0x5dba08=md5(JSON[_0x61f4('0x18')](_0xfd5891));if(this[_0x61f4('0x1')]!==_0x5dba08){this[_0x61f4('0x1')]=_0x5dba08;io['to'](util[_0x61f4('0x19')](_0x61f4('0x1a'),_0xfd5891[_0x61f4('0x7')]))[_0x61f4('0x1b')](_0x61f4('0x1c'),_0xfd5891);}};module[_0x61f4('0x1d')]=MailQueue; \ No newline at end of file +var _0x0fa1=['beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy'];(function(_0x6fd276,_0x32ca86){var _0x870689=function(_0x34f8dc){while(--_0x34f8dc){_0x6fd276['push'](_0x6fd276['shift']());}};_0x870689(++_0x32ca86);}(_0x0fa1,0x1c6));var _0x10fa=function(_0x251218,_0x4cf81f){_0x251218=_0x251218-0x0;var _0xe8f82e=_0x0fa1[_0x251218];return _0xe8f82e;};'use strict';var _=require(_0x10fa('0x0'));var md5=require(_0x10fa('0x1'));var util=require(_0x10fa('0x2'));var Redis=require(_0x10fa('0x3'));var config=require(_0x10fa('0x4'));config[_0x10fa('0x5')]=_[_0x10fa('0x6')](config[_0x10fa('0x5')],{'host':_0x10fa('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x10fa('0x5')]));function MailQueue(_0x247f1e){this['id']=_0x247f1e['id']||0x0;this[_0x10fa('0x8')]=_0x247f1e['name']||'';this[_0x10fa('0x9')]=_0x247f1e[_0x10fa('0x9')]||0xa;this[_0x10fa('0xa')]=_0x247f1e[_0x10fa('0xa')]||_0x10fa('0xb');this[_0x10fa('0xc')]=_0x247f1e['Agents'];this['mapAgentsId']={};this[_0x10fa('0xd')]=0x0;this[_0x10fa('0x1')]='';this[_0x10fa('0xe')]();this['updateRealtime']();}MailQueue[_0x10fa('0xf')]['updateRouting']=function(){var _0x9d9548=this[_0x10fa('0x10')][_0x10fa('0x11')];this['mapAgentsId']=_[_0x10fa('0x12')](this[_0x10fa('0xc')],'id');this[_0x10fa('0x10')][_0x10fa('0x11')]=_0x9d9548;};MailQueue[_0x10fa('0xf')]['updateRealtime']=function(){this[_0x10fa('0x13')]=0x0;this['paused']=0x0;for(var _0x489cd8=0x0;_0x489cd8=0x0?this[_0x10fa('0x18')]:0x0;var _0x25d1e6={'id':this['id'],'available':this[_0x10fa('0x18')],'loggedIn':this[_0x10fa('0x13')],'name':this[_0x10fa('0x8')],'paused':this[_0x10fa('0x17')],'waiting':this['waiting']};var _0x16e2b3=md5(JSON[_0x10fa('0x19')](_0x25d1e6));if(this['md5']!==_0x16e2b3){this[_0x10fa('0x1')]=_0x16e2b3;io['to'](util[_0x10fa('0x1a')](_0x10fa('0x1b'),_0x25d1e6[_0x10fa('0x8')]))[_0x10fa('0x1c')](_0x10fa('0x1d'),_0x25d1e6);}};module[_0x10fa('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 261c189..d3a46e8 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x1261,0x144));var _0x1126=function(_0x54d5c8,_0x344ce5){_0x54d5c8=_0x54d5c8-0x0;var _0x525e2e=_0x1261[_0x54d5c8];return _0x525e2e;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x525fb3,_0x530025){var _0x480b31=function(_0x3a9920){while(--_0x3a9920){_0x525fb3['push'](_0x525fb3['shift']());}};_0x480b31(++_0x530025);}(_0x814b,0x1a2));var _0xb814=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0x814b[_0xdd9a5f];return _0x3464b7;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 0305d29..27b80f5 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 _0xffe1=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','../../../config/environment','redis','defaults'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xffe1,0x175));var _0x1ffe=function(_0x2e8172,_0xaebf41){_0x2e8172=_0x2e8172-0x0;var _0x261e00=_0xffe1[_0x2e8172];return _0x261e00;};'use strict';var _=require(_0x1ffe('0x0'));var md5=require(_0x1ffe('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x1ffe('0x2'));config[_0x1ffe('0x3')]=_[_0x1ffe('0x4')](config['redis'],{'host':_0x1ffe('0x5'),'port':0x18eb});var io=require(_0x1ffe('0x6'))(new Redis(config[_0x1ffe('0x3')]));function SmsQueue(_0x5a5912){this['id']=_0x5a5912['id']||0x0;this[_0x1ffe('0x7')]=_0x5a5912[_0x1ffe('0x7')]||'';this[_0x1ffe('0x8')]=_0x5a5912[_0x1ffe('0x8')]||0xa;this[_0x1ffe('0x9')]=_0x5a5912[_0x1ffe('0x9')]||'beepall';this['Agents']=_0x5a5912[_0x1ffe('0xa')];this[_0x1ffe('0xb')]={};this[_0x1ffe('0xc')]=0x0;this[_0x1ffe('0x1')]='';this['updateRouting']();this[_0x1ffe('0xd')]();}SmsQueue[_0x1ffe('0xe')][_0x1ffe('0xf')]=function(){var _0x3f5ff0=this[_0x1ffe('0xb')][_0x1ffe('0x10')];this[_0x1ffe('0xb')]=_[_0x1ffe('0x11')](this['Agents'],'id');this[_0x1ffe('0xb')][_0x1ffe('0x10')]=_0x3f5ff0;};SmsQueue['prototype'][_0x1ffe('0xd')]=function(){this[_0x1ffe('0x12')]=0x0;this[_0x1ffe('0x13')]=0x0;for(var _0xae23bf=0x0;_0xae23bf=0x0?this['available']:0x0;var _0x4dbd7f={'id':this['id'],'available':this[_0x1ffe('0x16')],'loggedIn':this[_0x1ffe('0x12')],'name':this[_0x1ffe('0x7')],'paused':this[_0x1ffe('0x13')],'waiting':this[_0x1ffe('0xc')]};var _0x73c91e=md5(JSON[_0x1ffe('0x17')](_0x4dbd7f));if(this[_0x1ffe('0x1')]!==_0x73c91e){this[_0x1ffe('0x1')]=_0x73c91e;io['to'](util[_0x1ffe('0x18')](_0x1ffe('0x19'),_0x4dbd7f[_0x1ffe('0x7')]))['emit']('sms_queue:save',_0x4dbd7f);}};module[_0x1ffe('0x1a')]=SmsQueue; \ No newline at end of file +var _0x1782=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','stringify','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents'];(function(_0x4af42d,_0x226c6d){var _0x14b54f=function(_0x107076){while(--_0x107076){_0x4af42d['push'](_0x4af42d['shift']());}};_0x14b54f(++_0x226c6d);}(_0x1782,0x13e));var _0x2178=function(_0x15dafa,_0x5556c1){_0x15dafa=_0x15dafa-0x0;var _0x12e47e=_0x1782[_0x15dafa];return _0x12e47e;};'use strict';var _=require(_0x2178('0x0'));var md5=require('md5');var util=require(_0x2178('0x1'));var Redis=require(_0x2178('0x2'));var config=require(_0x2178('0x3'));config[_0x2178('0x4')]=_[_0x2178('0x5')](config['redis'],{'host':_0x2178('0x6'),'port':0x18eb});var io=require(_0x2178('0x7'))(new Redis(config['redis']));function SmsQueue(_0x59ebf6){this['id']=_0x59ebf6['id']||0x0;this[_0x2178('0x8')]=_0x59ebf6[_0x2178('0x8')]||'';this['timeout']=_0x59ebf6['timeout']||0xa;this['strategy']=_0x59ebf6[_0x2178('0x9')]||_0x2178('0xa');this[_0x2178('0xb')]=_0x59ebf6[_0x2178('0xb')];this[_0x2178('0xc')]={};this[_0x2178('0xd')]=0x0;this['md5']='';this[_0x2178('0xe')]();this[_0x2178('0xf')]();}SmsQueue[_0x2178('0x10')][_0x2178('0xe')]=function(){var _0x46db79=this[_0x2178('0xc')][_0x2178('0x11')];this[_0x2178('0xc')]=_[_0x2178('0x12')](this[_0x2178('0xb')],'id');this['mapAgentsId'][_0x2178('0x11')]=_0x46db79;};SmsQueue[_0x2178('0x10')]['updateRealtime']=function(){this[_0x2178('0x13')]=0x0;this[_0x2178('0x14')]=0x0;for(var _0x32f65c=0x0;_0x32f65c=0x0?this['available']:0x0;var _0x3d7e36={'id':this['id'],'available':this[_0x2178('0x16')],'loggedIn':this[_0x2178('0x13')],'name':this[_0x2178('0x8')],'paused':this[_0x2178('0x14')],'waiting':this[_0x2178('0xd')]};var _0x23f84d=md5(JSON[_0x2178('0x17')](_0x3d7e36));if(this[_0x2178('0x18')]!==_0x23f84d){this[_0x2178('0x18')]=_0x23f84d;io['to'](util[_0x2178('0x19')](_0x2178('0x1a'),_0x3d7e36['name']))[_0x2178('0x1b')](_0x2178('0x1c'),_0x3d7e36);}};module[_0x2178('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 87ca452..686178d 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 _0x2ee1=['stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available'];(function(_0x2c7780,_0x100f4a){var _0x580bc8=function(_0x3d435c){while(--_0x3d435c){_0x2c7780['push'](_0x2c7780['shift']());}};_0x580bc8(++_0x100f4a);}(_0x2ee1,0x19c));var _0x12ee=function(_0x5df25c,_0x1d20e5){_0x5df25c=_0x5df25c-0x0;var _0x21f525=_0x2ee1[_0x5df25c];return _0x21f525;};'use strict';var _=require(_0x12ee('0x0'));var md5=require(_0x12ee('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x12ee('0x2'));config[_0x12ee('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x12ee('0x4'))(new Redis(config['redis']));function WhatsappQueue(_0x4f9be2){this['id']=_0x4f9be2['id']||0x0;this[_0x12ee('0x5')]=_0x4f9be2[_0x12ee('0x5')]||'';this[_0x12ee('0x6')]=_0x4f9be2[_0x12ee('0x6')]||0xa;this[_0x12ee('0x7')]=_0x4f9be2[_0x12ee('0x7')]||_0x12ee('0x8');this[_0x12ee('0x9')]=_0x4f9be2[_0x12ee('0x9')];this[_0x12ee('0xa')]={};this[_0x12ee('0xb')]=0x0;this[_0x12ee('0x1')]='';this[_0x12ee('0xc')]();this[_0x12ee('0xd')]();}WhatsappQueue[_0x12ee('0xe')][_0x12ee('0xc')]=function(){var _0x297799=this[_0x12ee('0xa')][_0x12ee('0xf')];this[_0x12ee('0xa')]=_[_0x12ee('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x12ee('0xf')]=_0x297799;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x12ee('0x11')]=0x0;this[_0x12ee('0x12')]=0x0;for(var _0x8d60c0=0x0;_0x8d60c0=0x0?this[_0x12ee('0x16')]:0x0;var _0xec2ae9={'id':this['id'],'available':this[_0x12ee('0x16')],'loggedIn':this[_0x12ee('0x11')],'name':this['name'],'paused':this[_0x12ee('0x12')],'waiting':this[_0x12ee('0xb')]};var _0x261997=md5(JSON[_0x12ee('0x17')](_0xec2ae9));if(this[_0x12ee('0x1')]!==_0x261997){this[_0x12ee('0x1')]=_0x261997;io['to'](util[_0x12ee('0x18')](_0x12ee('0x19'),_0xec2ae9['name']))[_0x12ee('0x1a')](_0x12ee('0x1b'),_0xec2ae9);}};module[_0x12ee('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x1bda=['prototype','_rr','map','loggedIn','paused','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x2272d7,_0x694f20){var _0x42697c=function(_0x3fe829){while(--_0x3fe829){_0x2272d7['push'](_0x2272d7['shift']());}};_0x42697c(++_0x694f20);}(_0x1bda,0xca));var _0xa1bd=function(_0x256d94,_0x4983f1){_0x256d94=_0x256d94-0x0;var _0x585843=_0x1bda[_0x256d94];return _0x585843;};'use strict';var _=require('lodash');var md5=require(_0xa1bd('0x0'));var util=require(_0xa1bd('0x1'));var Redis=require('ioredis');var config=require(_0xa1bd('0x2'));config[_0xa1bd('0x3')]=_['defaults'](config[_0xa1bd('0x3')],{'host':_0xa1bd('0x4'),'port':0x18eb});var io=require(_0xa1bd('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x3fb188){this['id']=_0x3fb188['id']||0x0;this[_0xa1bd('0x6')]=_0x3fb188[_0xa1bd('0x6')]||'';this[_0xa1bd('0x7')]=_0x3fb188[_0xa1bd('0x7')]||0xa;this[_0xa1bd('0x8')]=_0x3fb188['strategy']||'beepall';this[_0xa1bd('0x9')]=_0x3fb188[_0xa1bd('0x9')];this[_0xa1bd('0xa')]={};this[_0xa1bd('0xb')]=0x0;this[_0xa1bd('0x0')]='';this[_0xa1bd('0xc')]();this[_0xa1bd('0xd')]();}WhatsappQueue[_0xa1bd('0xe')][_0xa1bd('0xc')]=function(){var _0x191cd2=this[_0xa1bd('0xa')][_0xa1bd('0xf')];this['mapAgentsId']=_[_0xa1bd('0x10')](this[_0xa1bd('0x9')],'id');this['mapAgentsId']['_rr']=_0x191cd2;};WhatsappQueue[_0xa1bd('0xe')][_0xa1bd('0xd')]=function(){this[_0xa1bd('0x11')]=0x0;this[_0xa1bd('0x12')]=0x0;for(var _0x3977be=0x0;_0x3977be=0x0?this[_0xa1bd('0x14')]:0x0;var _0x37ea8f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa1bd('0x6')],'paused':this[_0xa1bd('0x12')],'waiting':this[_0xa1bd('0xb')]};var _0x349251=md5(JSON[_0xa1bd('0x15')](_0x37ea8f));if(this[_0xa1bd('0x0')]!==_0x349251){this[_0xa1bd('0x0')]=_0x349251;io['to'](util[_0xa1bd('0x16')](_0xa1bd('0x17'),_0x37ea8f[_0xa1bd('0x6')]))[_0xa1bd('0x18')](_0xa1bd('0x19'),_0x37ea8f);}};module[_0xa1bd('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f052821..b944893 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 98f8375..8ee1b30 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 _0xd5aa=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','update'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0xd5aa,0xcb));var _0xad5a=function(_0x495a30,_0x5744b1){_0x495a30=_0x495a30-0x0;var _0x24088b=_0xd5aa[_0x495a30];return _0x24088b;};'use strict';var client=require('../client');exports[_0xad5a('0x0')]=function(_0x2e1528,_0x3b2d8a){return client[_0xad5a('0x1')](_0xad5a('0x2'),{'body':_0x3b2d8a,'options':{'where':{'id':_0x2e1528}},'log':_0xad5a('0x3')});};exports[_0xad5a('0x4')]=function(_0xebac14,_0x3ff775){return client[_0xad5a('0x1')](_0xad5a('0x5'),{'body':_0x3ff775,'options':{'where':{'id':_0xebac14}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xff34=['addTags','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction'];(function(_0x397d5d,_0x2959d3){var _0x2bf052=function(_0x4ccaf1){while(--_0x4ccaf1){_0x397d5d['push'](_0x397d5d['shift']());}};_0x2bf052(++_0x2959d3);}(_0xff34,0x80));var _0x4ff3=function(_0x190f92,_0x5180cc){_0x190f92=_0x190f92-0x0;var _0x3297f1=_0xff34[_0x190f92];return _0x3297f1;};'use strict';var client=require(_0x4ff3('0x0'));exports[_0x4ff3('0x1')]=function(_0x1928f5,_0x5697ba){return client['Request'](_0x4ff3('0x2'),{'body':_0x5697ba,'options':{'where':{'id':_0x1928f5}},'log':_0x4ff3('0x3')});};exports[_0x4ff3('0x4')]=function(_0x5d1353,_0x5410ec){return client['Request']('AddTagsToChatInteraction',{'body':_0x5410ec,'options':{'where':{'id':_0x5d1353}},'log':_0x4ff3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 14b8d0b..0403fbf 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 _0x0155=['Request','CreateChatMessage','createChatMessage'];(function(_0x378eb5,_0x9afc29){var _0x5ca53e=function(_0x2f1ecd){while(--_0x2f1ecd){_0x378eb5['push'](_0x378eb5['shift']());}};_0x5ca53e(++_0x9afc29);}(_0x0155,0xc3));var _0x5015=function(_0x4656f3,_0x1e6f9b){_0x4656f3=_0x4656f3-0x0;var _0x3814c5=_0x0155[_0x4656f3];return _0x3814c5;};'use strict';var client=require('../client');exports['create']=function(_0x74e84c){return client[_0x5015('0x0')](_0x5015('0x1'),{'body':_0x74e84c,'log':_0x5015('0x2')});}; \ No newline at end of file +var _0xd1f2=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x410cca,_0x1ef117){var _0x185db7=function(_0xaa48ea){while(--_0xaa48ea){_0x410cca['push'](_0x410cca['shift']());}};_0x185db7(++_0x1ef117);}(_0xd1f2,0x156));var _0x2d1f=function(_0x525c0e,_0x2da864){_0x525c0e=_0x525c0e-0x0;var _0x48985a=_0xd1f2[_0x525c0e];return _0x48985a;};'use strict';var client=require(_0x2d1f('0x0'));exports[_0x2d1f('0x1')]=function(_0x44c2a6){return client[_0x2d1f('0x2')](_0x2d1f('0x3'),{'body':_0x44c2a6,'log':_0x2d1f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index d4deb66..85eedeb 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 _0x425d=['timeout','strategy','User','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name'];(function(_0x4e83df,_0x3725f0){var _0x117fc4=function(_0x1164a9){while(--_0x1164a9){_0x4e83df['push'](_0x4e83df['shift']());}};_0x117fc4(++_0x3725f0);}(_0x425d,0x1e0));var _0xd425=function(_0x2ea9fd,_0x45d80b){_0x2ea9fd=_0x2ea9fd-0x0;var _0x27d18e=_0x425d[_0x2ea9fd];return _0x27d18e;};'use strict';var client=require(_0xd425('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xd425('0x1')](_0xd425('0x2'),{'options':{'raw':![],'attributes':['id',_0xd425('0x3'),_0xd425('0x4'),_0xd425('0x5')],'include':[{'model':_0xd425('0x6'),'as':_0xd425('0x7'),'attributes':['id','name',_0xd425('0x8'),_0xd425('0x9')]}]},'log':_0xd425('0xa')});};}; \ No newline at end of file +var _0x9305=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents'];(function(_0x436376,_0x152e72){var _0x107484=function(_0x4d3fe7){while(--_0x4d3fe7){_0x436376['push'](_0x436376['shift']());}};_0x107484(++_0x152e72);}(_0x9305,0x1e2));var _0x5930=function(_0x1a37b2,_0x584b3b){_0x1a37b2=_0x1a37b2-0x0;var _0x130c75=_0x9305[_0x1a37b2];return _0x130c75;};'use strict';var client=require(_0x5930('0x0'));exports[_0x5930('0x1')]=function(){return function(){return client[_0x5930('0x2')](_0x5930('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5930('0x4'),_0x5930('0x5')],'include':[{'model':_0x5930('0x6'),'as':_0x5930('0x7'),'attributes':['id','name',_0x5930('0x8'),_0x5930('0x9')]}]},'log':_0x5930('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 36495b1..6e409a8 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 _0xc820=['Request','CreateChatQueueReport','UpdateChatQueueReport','DESC','create'];(function(_0x174096,_0x345c0e){var _0x37742d=function(_0x535f9f){while(--_0x535f9f){_0x174096['push'](_0x174096['shift']());}};_0x37742d(++_0x345c0e);}(_0xc820,0x13f));var _0x0c82=function(_0x5841a4,_0x12aa83){_0x5841a4=_0x5841a4-0x0;var _0x1a3e49=_0xc820[_0x5841a4];return _0x1a3e49;};'use strict';var client=require('../client');exports[_0x0c82('0x0')]=function(_0x44415e){return client[_0x0c82('0x1')](_0x0c82('0x2'),{'body':_0x44415e,'log':_0x0c82('0x2')});};exports['update']=function(_0x409381,_0x4edc9c){return client[_0x0c82('0x1')](_0x0c82('0x3'),{'body':_0x4edc9c,'options':{'where':{'uniqueid':_0x409381},'order':[['id',_0x0c82('0x4')]],'limit':0x1},'log':_0x0c82('0x3')});}; \ No newline at end of file +var _0x9649=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0x5e9dfd,_0x508625){var _0x264b0f=function(_0x4ce93c){while(--_0x4ce93c){_0x5e9dfd['push'](_0x5e9dfd['shift']());}};_0x264b0f(++_0x508625);}(_0x9649,0x19f));var _0x9964=function(_0x230a38,_0x321033){_0x230a38=_0x230a38-0x0;var _0x20595a=_0x9649[_0x230a38];return _0x20595a;};'use strict';var client=require(_0x9964('0x0'));exports[_0x9964('0x1')]=function(_0x1922f0){return client[_0x9964('0x2')]('CreateChatQueueReport',{'body':_0x1922f0,'log':_0x9964('0x3')});};exports[_0x9964('0x4')]=function(_0x48790a,_0x18402a){return client['Request'](_0x9964('0x5'),{'body':_0x18402a,'options':{'where':{'uniqueid':_0x48790a},'order':[['id',_0x9964('0x6')]],'limit':0x1},'log':_0x9964('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6fff792..94c5a24 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x284f2c,_0xee8843){var _0x427a32=function(_0x2dbf6d){while(--_0x2dbf6d){_0x284f2c['push'](_0x284f2c['shift']());}};_0x427a32(++_0xee8843);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0x7a54,0x106));var _0x47a5=function(_0x4aa74a,_0x158f23){_0x4aa74a=_0x4aa74a-0x0;var _0x448a95=_0x7a54[_0x4aa74a];return _0x448a95;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 37c525b..fc4efff 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 _0x05d7=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x4ed354,_0x55a040){var _0x4f084f=function(_0x551c81){while(--_0x551c81){_0x4ed354['push'](_0x4ed354['shift']());}};_0x4f084f(++_0x55a040);}(_0x05d7,0xe7));var _0x705d=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x05d7[_0x35da42];return _0x370035;};'use strict';var client=require(_0x705d('0x0'));exports['create']=function(_0x2e56ff){return client[_0x705d('0x1')](_0x705d('0x2'),{'body':_0x2e56ff,'log':_0x705d('0x3')});}; \ No newline at end of file +var _0xdde6=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdde6,0x10e));var _0x6dde=function(_0x40c9ae,_0x2f7545){_0x40c9ae=_0x40c9ae-0x0;var _0x4be291=_0xdde6[_0x40c9ae];return _0x4be291;};'use strict';var client=require(_0x6dde('0x0'));exports[_0x6dde('0x1')]=function(_0x27103f){return client[_0x6dde('0x2')](_0x6dde('0x3'),{'body':_0x27103f,'log':_0x6dde('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4b7485e..ad4c850 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 _0xd7b4=['../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','Agents','name','online','faxPause'];(function(_0x133425,_0x2d60f2){var _0x45c4a4=function(_0x39b453){while(--_0x39b453){_0x133425['push'](_0x133425['shift']());}};_0x45c4a4(++_0x2d60f2);}(_0xd7b4,0x154));var _0x4d7b=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0xd7b4[_0x334fea];return _0x3c5829;};'use strict';var client=require(_0x4d7b('0x0'));exports[_0x4d7b('0x1')]=function(){return function(){return client[_0x4d7b('0x2')](_0x4d7b('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4d7b('0x4'),_0x4d7b('0x5')],'include':[{'model':'User','as':_0x4d7b('0x6'),'attributes':['id',_0x4d7b('0x7'),_0x4d7b('0x8'),_0x4d7b('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xe180=['Agents','online','faxPause','getFaxQueues','../client','GetFaxQueue','name','timeout','strategy','User'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xe180,0x1c6));var _0x0e18=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xe180[_0x12f688];return _0x59c3de;};'use strict';var client=require(_0x0e18('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x0e18('0x1'),{'options':{'raw':![],'attributes':['id',_0x0e18('0x2'),_0x0e18('0x3'),_0x0e18('0x4')],'include':[{'model':_0x0e18('0x5'),'as':_0x0e18('0x6'),'attributes':['id','name',_0x0e18('0x7'),_0x0e18('0x8')]}]},'log':_0x0e18('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 132b003..5e8f37f 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 _0x4fda=['DESC','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x3eef96,_0x18c7a9){var _0x4693a8=function(_0x2cf359){while(--_0x2cf359){_0x3eef96['push'](_0x3eef96['shift']());}};_0x4693a8(++_0x18c7a9);}(_0x4fda,0x1f3));var _0xa4fd=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4fda[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports[_0xa4fd('0x0')]=function(_0x5bc6b8){return client[_0xa4fd('0x1')](_0xa4fd('0x2'),{'body':_0x5bc6b8,'log':_0xa4fd('0x2')});};exports[_0xa4fd('0x3')]=function(_0x52911b,_0x29d053){return client[_0xa4fd('0x1')](_0xa4fd('0x4'),{'body':_0x29d053,'options':{'where':{'uniqueid':_0x52911b},'order':[['id',_0xa4fd('0x5')]],'limit':0x1},'log':_0xa4fd('0x4')});}; \ No newline at end of file +var _0x378d=['Request','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update'];(function(_0x5e5c7b,_0x2495a3){var _0x3f947f=function(_0x29bca5){while(--_0x29bca5){_0x5e5c7b['push'](_0x5e5c7b['shift']());}};_0x3f947f(++_0x2495a3);}(_0x378d,0x1d0));var _0xd378=function(_0x298b82,_0x59d222){_0x298b82=_0x298b82-0x0;var _0x30c4c7=_0x378d[_0x298b82];return _0x30c4c7;};'use strict';var client=require(_0xd378('0x0'));exports[_0xd378('0x1')]=function(_0x36b239){return client['Request']('CreateFaxQueueReport',{'body':_0x36b239,'log':_0xd378('0x2')});};exports[_0xd378('0x3')]=function(_0x2cf100,_0x2384d4){return client[_0xd378('0x4')](_0xd378('0x5'),{'body':_0x2384d4,'options':{'where':{'uniqueid':_0x2cf100},'order':[['id','DESC']],'limit':0x1},'log':_0xd378('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b8c30c5..507fd6e 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 _0x9700=['name','Interval','Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x109775,_0x465e7a){var _0x5ee7de=function(_0x141f89){while(--_0x141f89){_0x109775['push'](_0x109775['shift']());}};_0x5ee7de(++_0x465e7a);}(_0x9700,0xd4));var _0x0970=function(_0x136573,_0x5bb522){_0x136573=_0x136573-0x0;var _0x557e1d=_0x9700[_0x136573];return _0x557e1d;};'use strict';var client=require(_0x0970('0x0'));exports[_0x0970('0x1')]=function(){return function(){return client[_0x0970('0x2')](_0x0970('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0970('0x4')],'include':[{'model':_0x0970('0x5'),'as':_0x0970('0x6'),'attributes':['id',_0x0970('0x4'),_0x0970('0x7')]}]},'log':_0x0970('0x1')});};}; \ No newline at end of file +var _0x402d=['Intervals','interval','../client','getIntervals','Request','name'];(function(_0x427c73,_0xe98574){var _0x6b9596=function(_0x2e4fa1){while(--_0x2e4fa1){_0x427c73['push'](_0x427c73['shift']());}};_0x6b9596(++_0xe98574);}(_0x402d,0x7a));var _0xd402=function(_0x431162,_0x52de19){_0x431162=_0x431162-0x0;var _0x52b2e5=_0x402d[_0x431162];return _0x52b2e5;};'use strict';var client=require(_0xd402('0x0'));exports[_0xd402('0x1')]=function(){return function(){return client[_0xd402('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd402('0x3')],'include':[{'model':'Interval','as':_0xd402('0x4'),'attributes':['id','name',_0xd402('0x5')]}]},'log':_0xd402('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 89b242c..136baaf 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 _0xb78e=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x2f0893,_0x26d24f){var _0x5f4442=function(_0x340723){while(--_0x340723){_0x2f0893['push'](_0x2f0893['shift']());}};_0x5f4442(++_0x26d24f);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5d476b,_0x28d50a){_0x5d476b=_0x5d476b-0x0;var _0x2ff6b6=_0xb78e[_0x5d476b];return _0x2ff6b6;};'use strict';var client=require(_0xeb78('0x0'));exports[_0xeb78('0x1')]=function(_0x4b8534,_0x1570f5){return client[_0xeb78('0x2')](_0xeb78('0x3'),{'body':_0x1570f5,'options':{'where':{'id':_0x4b8534}},'log':_0xeb78('0x4')});};exports[_0xeb78('0x5')]=function(_0x308d12,_0x13ef9d){return client[_0xeb78('0x2')]('AddTagsToMailInteraction',{'body':_0x13ef9d,'options':{'where':{'id':_0x308d12}},'log':_0xeb78('0x6')});}; \ No newline at end of file +var _0x8952=['UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request'];(function(_0x42265b,_0x744d19){var _0xa665fa=function(_0x42d58a){while(--_0x42d58a){_0x42265b['push'](_0x42265b['shift']());}};_0xa665fa(++_0x744d19);}(_0x8952,0x17e));var _0x2895=function(_0xc73cf,_0x2638f7){_0xc73cf=_0xc73cf-0x0;var _0x2283ef=_0x8952[_0xc73cf];return _0x2283ef;};'use strict';var client=require('../client');exports[_0x2895('0x0')]=function(_0x2c099b,_0x43e8d9){return client[_0x2895('0x1')](_0x2895('0x2'),{'body':_0x43e8d9,'options':{'where':{'id':_0x2c099b}},'log':'updateMailInteraction'});};exports[_0x2895('0x3')]=function(_0xb5afd9,_0x1f69f6){return client['Request'](_0x2895('0x4'),{'body':_0x1f69f6,'options':{'where':{'id':_0xb5afd9}},'log':_0x2895('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 772e68c..9ae7ea2 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 _0xd263=['CreateMailMessage'];(function(_0x29e03f,_0x515781){var _0x343198=function(_0x2497e1){while(--_0x2497e1){_0x29e03f['push'](_0x29e03f['shift']());}};_0x343198(++_0x515781);}(_0xd263,0x14e));var _0x3d26=function(_0x165127,_0x3d7c52){_0x165127=_0x165127-0x0;var _0x27fcdb=_0xd263[_0x165127];return _0x27fcdb;};'use strict';var client=require('../client');exports['create']=function(_0x21d3db){return client['Request'](_0x3d26('0x0'),{'body':_0x21d3db,'log':'createMailMessage'});}; \ No newline at end of file +var _0xdcb0=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcb0,0x7e));var _0x0dcb=function(_0x2e35a6,_0x5ef737){_0x2e35a6=_0x2e35a6-0x0;var _0x450c20=_0xdcb0[_0x2e35a6];return _0x450c20;};'use strict';var client=require(_0x0dcb('0x0'));exports['create']=function(_0x1b02fa){return client[_0x0dcb('0x1')](_0x0dcb('0x2'),{'body':_0x1b02fa,'log':_0x0dcb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 386d190..69f7d98 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 _0x9983=['mailPause','../client','Request','GetMailQueue','name','strategy','Agents','online'];(function(_0x40e415,_0x503a64){var _0x496ed4=function(_0x1365cd){while(--_0x1365cd){_0x40e415['push'](_0x40e415['shift']());}};_0x496ed4(++_0x503a64);}(_0x9983,0x159));var _0x3998=function(_0x5241be,_0x11afb8){_0x5241be=_0x5241be-0x0;var _0x38a4d1=_0x9983[_0x5241be];return _0x38a4d1;};'use strict';var client=require(_0x3998('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x3998('0x1')](_0x3998('0x2'),{'options':{'raw':![],'attributes':['id',_0x3998('0x3'),'timeout',_0x3998('0x4')],'include':[{'model':'User','as':_0x3998('0x5'),'attributes':['id',_0x3998('0x3'),_0x3998('0x6'),_0x3998('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x8bf0=['Request','name','timeout','strategy','User','Agents','online','mailPause','getMailQueues'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x8bf0,0x7d));var _0x08bf=function(_0x5a328a,_0x4acc6a){_0x5a328a=_0x5a328a-0x0;var _0x150d51=_0x8bf0[_0x5a328a];return _0x150d51;};'use strict';var client=require('../client');exports[_0x08bf('0x0')]=function(){return function(){return client[_0x08bf('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x08bf('0x2'),_0x08bf('0x3'),_0x08bf('0x4')],'include':[{'model':_0x08bf('0x5'),'as':_0x08bf('0x6'),'attributes':['id',_0x08bf('0x2'),_0x08bf('0x7'),_0x08bf('0x8')]}]},'log':_0x08bf('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5f5165d..0d1cbbc 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 _0x5e58=['create','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x5e58,0x8c));var _0x85e5=function(_0x2cc76e,_0x244f64){_0x2cc76e=_0x2cc76e-0x0;var _0x21bfbf=_0x5e58[_0x2cc76e];return _0x21bfbf;};'use strict';var client=require('../client');exports[_0x85e5('0x0')]=function(_0x49c9bf){return client['Request'](_0x85e5('0x1'),{'body':_0x49c9bf,'log':_0x85e5('0x1')});};exports[_0x85e5('0x2')]=function(_0x568176,_0x2f86b6){return client['Request']('UpdateMailQueueReport',{'body':_0x2f86b6,'options':{'where':{'uniqueid':_0x568176},'order':[['id',_0x85e5('0x3')]],'limit':0x1},'log':_0x85e5('0x4')});}; \ No newline at end of file +var _0x43fd=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x43fd,0x1ad));var _0xd43f=function(_0x1e6660,_0x4291e1){_0x1e6660=_0x1e6660-0x0;var _0x2f87fa=_0x43fd[_0x1e6660];return _0x2f87fa;};'use strict';var client=require(_0xd43f('0x0'));exports[_0xd43f('0x1')]=function(_0x14a8d7){return client[_0xd43f('0x2')](_0xd43f('0x3'),{'body':_0x14a8d7,'log':_0xd43f('0x3')});};exports[_0xd43f('0x4')]=function(_0x3b602c,_0x1f62bf){return client[_0xd43f('0x2')](_0xd43f('0x5'),{'body':_0x1f62bf,'options':{'where':{'uniqueid':_0x3b602c},'order':[['id','DESC']],'limit':0x1},'log':_0xd43f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 644b898..61f6046 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 _0x9248=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x2daa08,_0x422b8c){var _0x4c3a6d=function(_0x14119b){while(--_0x14119b){_0x2daa08['push'](_0x2daa08['shift']());}};_0x4c3a6d(++_0x422b8c);}(_0x9248,0x14d));var _0x8924=function(_0x12a103,_0x5d901e){_0x12a103=_0x12a103-0x0;var _0x2287ff=_0x9248[_0x12a103];return _0x2287ff;};'use strict';var client=require('../client');exports[_0x8924('0x0')]=function(_0x5e45d9,_0x238ce6){return client[_0x8924('0x1')](_0x8924('0x2'),{'body':_0x238ce6,'options':{'where':{'id':_0x5e45d9}},'log':_0x8924('0x3')});};exports[_0x8924('0x4')]=function(_0x1f9eee,_0x49159c){return client[_0x8924('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x49159c,'options':{'where':{'id':_0x1f9eee}},'log':_0x8924('0x5')});}; \ No newline at end of file +var _0x42ed=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x5f0b82,_0x197e66){var _0x816a19=function(_0x4066f7){while(--_0x4066f7){_0x5f0b82['push'](_0x5f0b82['shift']());}};_0x816a19(++_0x197e66);}(_0x42ed,0x1d3));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd42e('0x0'));exports[_0xd42e('0x1')]=function(_0x12fc61,_0x49c1df){return client[_0xd42e('0x2')](_0xd42e('0x3'),{'body':_0x49c1df,'options':{'where':{'id':_0x12fc61}},'log':_0xd42e('0x4')});};exports[_0xd42e('0x5')]=function(_0x662292,_0x268bfd){return client[_0xd42e('0x2')](_0xd42e('0x6'),{'body':_0x268bfd,'options':{'where':{'id':_0x662292}},'log':_0xd42e('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4de75b4..ea414a1 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 _0x346e=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x26bf50,_0x348f3d){var _0x166e1b=function(_0x564f73){while(--_0x564f73){_0x26bf50['push'](_0x26bf50['shift']());}};_0x166e1b(++_0x348f3d);}(_0x346e,0xb6));var _0xe346=function(_0x319dda,_0x2352b3){_0x319dda=_0x319dda-0x0;var _0x2dbbde=_0x346e[_0x319dda];return _0x2dbbde;};'use strict';var client=require(_0xe346('0x0'));exports[_0xe346('0x1')]=function(_0x11ea5c){return client[_0xe346('0x2')](_0xe346('0x3'),{'body':_0x11ea5c,'log':_0xe346('0x4')});}; \ No newline at end of file +var _0xcadf=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x738d6e,_0x20a992){var _0x24b1f1=function(_0xcbb2b2){while(--_0xcbb2b2){_0x738d6e['push'](_0x738d6e['shift']());}};_0x24b1f1(++_0x20a992);}(_0xcadf,0x1c7));var _0xfcad=function(_0x3c8cef,_0x484465){_0x3c8cef=_0x3c8cef-0x0;var _0x28e391=_0xcadf[_0x3c8cef];return _0x28e391;};'use strict';var client=require(_0xfcad('0x0'));exports[_0xfcad('0x1')]=function(_0x42da9a){return client[_0xfcad('0x2')](_0xfcad('0x3'),{'body':_0x42da9a,'log':_0xfcad('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 138e945..6a7a7e4 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 _0xd5c5=['Request','GetOpenchannelQueue','timeout','strategy','User','Agents','name','online','openchannelPause','getOpenchannelQueues'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0xd5c5,0x6d));var _0x5d5c=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xd5c5[_0x576170];return _0x397c70;};'use strict';var client=require('../client');exports[_0x5d5c('0x0')]=function(){return function(){return client[_0x5d5c('0x1')](_0x5d5c('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5d5c('0x3'),_0x5d5c('0x4')],'include':[{'model':_0x5d5c('0x5'),'as':_0x5d5c('0x6'),'attributes':['id',_0x5d5c('0x7'),_0x5d5c('0x8'),_0x5d5c('0x9')]}]},'log':_0x5d5c('0x0')});};}; \ No newline at end of file +var _0xfacc=['online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','Agents'];(function(_0x3433d9,_0x439f8c){var _0x1dc4c5=function(_0x1ed0e3){while(--_0x1ed0e3){_0x3433d9['push'](_0x3433d9['shift']());}};_0x1dc4c5(++_0x439f8c);}(_0xfacc,0x8a));var _0xcfac=function(_0x5be1ac,_0x5ee1f4){_0x5be1ac=_0x5be1ac-0x0;var _0x21b996=_0xfacc[_0x5be1ac];return _0x21b996;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xcfac('0x0')](_0xcfac('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xcfac('0x2'),_0xcfac('0x3')],'include':[{'model':_0xcfac('0x4'),'as':_0xcfac('0x5'),'attributes':['id','name',_0xcfac('0x6'),_0xcfac('0x7')]}]},'log':_0xcfac('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index eebcca9..cb62bbe 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 _0x611f=['UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x611f,0x1ac));var _0xf611=function(_0x104b26,_0x1cc8e9){_0x104b26=_0x104b26-0x0;var _0x437196=_0x611f[_0x104b26];return _0x437196;};'use strict';var client=require(_0xf611('0x0'));exports['create']=function(_0x283a93){return client[_0xf611('0x1')](_0xf611('0x2'),{'body':_0x283a93,'log':'CreateOpenchannelQueueReport'});};exports[_0xf611('0x3')]=function(_0x25d08d,_0x399fb3){return client['Request'](_0xf611('0x4'),{'body':_0x399fb3,'options':{'where':{'uniqueid':_0x25d08d},'order':[['id',_0xf611('0x5')]],'limit':0x1},'log':_0xf611('0x4')});}; \ No newline at end of file +var _0xfda3=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x8229f4,_0x2d3ca5){var _0x357c15=function(_0x5311d1){while(--_0x5311d1){_0x8229f4['push'](_0x8229f4['shift']());}};_0x357c15(++_0x2d3ca5);}(_0xfda3,0x187));var _0x3fda=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0xfda3[_0x1d291d];return _0x44cc4e;};'use strict';var client=require(_0x3fda('0x0'));exports[_0x3fda('0x1')]=function(_0x535fbc){return client[_0x3fda('0x2')]('CreateOpenchannelQueueReport',{'body':_0x535fbc,'log':_0x3fda('0x3')});};exports[_0x3fda('0x4')]=function(_0x3391e0,_0x593807){return client[_0x3fda('0x2')](_0x3fda('0x5'),{'body':_0x593807,'options':{'where':{'uniqueid':_0x3391e0},'order':[['id','DESC']],'limit':0x1},'log':_0x3fda('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e9cb336..a94c5e3 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 _0xea89=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction'];(function(_0x40ee18,_0xf3da4){var _0x37f463=function(_0x173ba0){while(--_0x173ba0){_0x40ee18['push'](_0x40ee18['shift']());}};_0x37f463(++_0xf3da4);}(_0xea89,0x1e2));var _0x9ea8=function(_0x580e1c,_0x57befc){_0x580e1c=_0x580e1c-0x0;var _0x3ac43c=_0xea89[_0x580e1c];return _0x3ac43c;};'use strict';var client=require(_0x9ea8('0x0'));exports[_0x9ea8('0x1')]=function(_0x1e85a2,_0x39bad4){return client[_0x9ea8('0x2')]('UpdateSmsInteraction',{'body':_0x39bad4,'options':{'where':{'id':_0x1e85a2}},'log':_0x9ea8('0x3')});};exports['addTags']=function(_0x226d05,_0x5af295){return client[_0x9ea8('0x2')](_0x9ea8('0x4'),{'body':_0x5af295,'options':{'where':{'id':_0x226d05}},'log':_0x9ea8('0x5')});}; \ No newline at end of file +var _0x6c32=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x54070e,_0x1dfc7d){var _0x563a51=function(_0x2f33a4){while(--_0x2f33a4){_0x54070e['push'](_0x54070e['shift']());}};_0x563a51(++_0x1dfc7d);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x26c3('0x0'));exports[_0x26c3('0x1')]=function(_0x3049a5,_0x416a62){return client[_0x26c3('0x2')](_0x26c3('0x3'),{'body':_0x416a62,'options':{'where':{'id':_0x3049a5}},'log':_0x26c3('0x4')});};exports[_0x26c3('0x5')]=function(_0x36528a,_0x49d4a1){return client[_0x26c3('0x2')](_0x26c3('0x6'),{'body':_0x49d4a1,'options':{'where':{'id':_0x36528a}},'log':_0x26c3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index fc9be88..a778c2b 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 _0xfa84=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x23b424,_0x21ac42){var _0x10b3e6=function(_0x3f887a){while(--_0x3f887a){_0x23b424['push'](_0x23b424['shift']());}};_0x10b3e6(++_0x21ac42);}(_0xfa84,0x1e9));var _0x4fa8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xfa84[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x4fa8('0x0'));exports[_0x4fa8('0x1')]=function(_0x4f359e){return client['Request'](_0x4fa8('0x2'),{'body':_0x4f359e,'log':_0x4fa8('0x3')});}; \ No newline at end of file +var _0x1026=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1026,0x109));var _0x6102=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x1026[_0x1529a3];return _0x1a0d4b;};'use strict';var client=require(_0x6102('0x0'));exports[_0x6102('0x1')]=function(_0x23d4da){return client[_0x6102('0x2')](_0x6102('0x3'),{'body':_0x23d4da,'log':_0x6102('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5916e5e..764bb0e 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(_0x31f8ee,_0x1fc6b3){var _0x1654de=function(_0x8747c7){while(--_0x8747c7){_0x31f8ee['push'](_0x31f8ee['shift']());}};_0x1654de(++_0x1fc6b3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x327043,_0x505916){var _0x234cd0=function(_0x197b4e){while(--_0x197b4e){_0x327043['push'](_0x327043['shift']());}};_0x234cd0(++_0x505916);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xcb91[_0x644ecd];return _0x1c66ce;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e3f97a8..ec99f82 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xedd9,0xfc));var _0x9edd=function(_0x3abcbd,_0x2c7383){_0x3abcbd=_0x3abcbd-0x0;var _0x58c3cf=_0xedd9[_0x3abcbd];return _0x58c3cf;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x45149b,_0x1d80bd){var _0x27c3f9=function(_0x5cf7a1){while(--_0x5cf7a1){_0x45149b['push'](_0x45149b['shift']());}};_0x27c3f9(++_0x1d80bd);}(_0x3e74,0x175));var _0x43e7=function(_0x2406fb,_0x3b1e39){_0x2406fb=_0x2406fb-0x0;var _0x37d7df=_0x3e74[_0x2406fb];return _0x37d7df;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ae1f761..6d66ced 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(_0xbe4550,_0x307e7f){var _0x17958c=function(_0x12cd90){while(--_0x12cd90){_0xbe4550['push'](_0xbe4550['shift']());}};_0x17958c(++_0x307e7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x39eb83,_0x14ab61){var _0x110eb8=function(_0xdf8c1){while(--_0xdf8c1){_0x39eb83['push'](_0x39eb83['shift']());}};_0x110eb8(++_0x14ab61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 7ae554f..72f1cda 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 _0x0af5=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x1ff9db,_0x28da76){var _0x3b01a0=function(_0x27cf90){while(--_0x27cf90){_0x1ff9db['push'](_0x1ff9db['shift']());}};_0x3b01a0(++_0x28da76);}(_0x0af5,0x158));var _0x50af=function(_0x111b3b,_0x49ae66){_0x111b3b=_0x111b3b-0x0;var _0x2e6048=_0x0af5[_0x111b3b];return _0x2e6048;};'use strict';var client=require('../client');exports[_0x50af('0x0')]=function(_0x2dae50,_0x13e284){return client[_0x50af('0x1')](_0x50af('0x2'),{'body':_0x13e284,'options':{'where':{'id':_0x2dae50}},'log':_0x50af('0x3')});};exports[_0x50af('0x4')]=function(_0x3733b7,_0x34e045){return client[_0x50af('0x1')](_0x50af('0x5'),{'body':_0x34e045,'options':{'where':{'id':_0x3733b7}},'log':_0x50af('0x6')});}; \ No newline at end of file +var _0x5b47=['addTags','Request','AddTagsToWhatsappInteraction','../client','update'];(function(_0x12309b,_0x59dd8c){var _0x482e4d=function(_0x308407){while(--_0x308407){_0x12309b['push'](_0x12309b['shift']());}};_0x482e4d(++_0x59dd8c);}(_0x5b47,0x120));var _0x75b4=function(_0x5d3e18,_0x1c21ce){_0x5d3e18=_0x5d3e18-0x0;var _0x2f8380=_0x5b47[_0x5d3e18];return _0x2f8380;};'use strict';var client=require(_0x75b4('0x0'));exports[_0x75b4('0x1')]=function(_0x5ee71e,_0x5c0b0c){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5c0b0c,'options':{'where':{'id':_0x5ee71e}},'log':'updateWhatsappInteraction'});};exports[_0x75b4('0x2')]=function(_0x42359f,_0x37497c){return client[_0x75b4('0x3')](_0x75b4('0x4'),{'body':_0x37497c,'options':{'where':{'id':_0x42359f}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 1a64426..f471527 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 _0x7e17=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x360d5c,_0xe500ec){var _0x126fa8=function(_0x2dccbe){while(--_0x2dccbe){_0x360d5c['push'](_0x360d5c['shift']());}};_0x126fa8(++_0xe500ec);}(_0x7e17,0x14d));var _0x77e1=function(_0x4ef11c,_0x387510){_0x4ef11c=_0x4ef11c-0x0;var _0x1c3026=_0x7e17[_0x4ef11c];return _0x1c3026;};'use strict';var client=require(_0x77e1('0x0'));exports[_0x77e1('0x1')]=function(_0x2ebfc7){return client[_0x77e1('0x2')](_0x77e1('0x3'),{'body':_0x2ebfc7,'log':_0x77e1('0x4')});}; \ No newline at end of file +var _0x2bf4=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x1d7d05,_0x447490){var _0x2f2a70=function(_0x14a8c6){while(--_0x14a8c6){_0x1d7d05['push'](_0x1d7d05['shift']());}};_0x2f2a70(++_0x447490);}(_0x2bf4,0x66));var _0x42bf=function(_0x579f17,_0x1984cb){_0x579f17=_0x579f17-0x0;var _0x25e10e=_0x2bf4[_0x579f17];return _0x25e10e;};'use strict';var client=require(_0x42bf('0x0'));exports[_0x42bf('0x1')]=function(_0xe1f20){return client[_0x42bf('0x2')](_0x42bf('0x3'),{'body':_0xe1f20,'log':_0x42bf('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c86e9d5..2c1af96 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 _0xa06a=['User','Agents','online','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa06a,0xc0));var _0xaa06=function(_0x4f2484,_0x5866aa){_0x4f2484=_0x4f2484-0x0;var _0x43c717=_0xa06a[_0x4f2484];return _0x43c717;};'use strict';var client=require(_0xaa06('0x0'));exports[_0xaa06('0x1')]=function(){return function(){return client['Request'](_0xaa06('0x2'),{'options':{'raw':![],'attributes':['id',_0xaa06('0x3'),_0xaa06('0x4'),_0xaa06('0x5')],'include':[{'model':_0xaa06('0x6'),'as':_0xaa06('0x7'),'attributes':['id',_0xaa06('0x3'),_0xaa06('0x8'),'whatsappPause']}]},'log':_0xaa06('0x1')});};}; \ No newline at end of file +var _0x1f7b=['Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x423488,_0x599f06){var _0x5f3ec3=function(_0x3af57f){while(--_0x3af57f){_0x423488['push'](_0x423488['shift']());}};_0x5f3ec3(++_0x599f06);}(_0x1f7b,0x1ca));var _0xb1f7=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x1f7b[_0x5c3c0b];return _0x52ecd2;};'use strict';var client=require('../client');exports[_0xb1f7('0x0')]=function(){return function(){return client[_0xb1f7('0x1')](_0xb1f7('0x2'),{'options':{'raw':![],'attributes':['id',_0xb1f7('0x3'),_0xb1f7('0x4'),_0xb1f7('0x5')],'include':[{'model':'User','as':_0xb1f7('0x6'),'attributes':['id',_0xb1f7('0x3'),_0xb1f7('0x7'),_0xb1f7('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1c38124..829e932 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 _0xacf5=['create','Request','CreateWhatsappQueueReport','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xacf5,0x11f));var _0x5acf=function(_0x23d77a,_0x5c651b){_0x23d77a=_0x23d77a-0x0;var _0xffcbc5=_0xacf5[_0x23d77a];return _0xffcbc5;};'use strict';var client=require(_0x5acf('0x0'));exports[_0x5acf('0x1')]=function(_0x40aa0f){return client[_0x5acf('0x2')](_0x5acf('0x3'),{'body':_0x40aa0f,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x35943b,_0x597e2f){return client[_0x5acf('0x2')]('UpdateWhatsappQueueReport',{'body':_0x597e2f,'options':{'where':{'uniqueid':_0x35943b},'order':[['id',_0x5acf('0x4')]],'limit':0x1},'log':_0x5acf('0x5')});}; \ No newline at end of file +var _0x4856=['update','UpdateWhatsappQueueReport','DESC','create','Request','CreateWhatsappQueueReport'];(function(_0xc0bae,_0x3afb2e){var _0x3fc1f4=function(_0x559f30){while(--_0x559f30){_0xc0bae['push'](_0xc0bae['shift']());}};_0x3fc1f4(++_0x3afb2e);}(_0x4856,0xbd));var _0x6485=function(_0xd06df9,_0x42eb29){_0xd06df9=_0xd06df9-0x0;var _0x144a22=_0x4856[_0xd06df9];return _0x144a22;};'use strict';var client=require('../client');exports[_0x6485('0x0')]=function(_0x54dbcd){return client[_0x6485('0x1')](_0x6485('0x2'),{'body':_0x54dbcd,'log':_0x6485('0x2')});};exports[_0x6485('0x3')]=function(_0x1cec83,_0x50f274){return client[_0x6485('0x1')](_0x6485('0x4'),{'body':_0x50f274,'options':{'where':{'uniqueid':_0x1cec83},'order':[['id',_0x6485('0x5')]],'limit':0x1},'log':_0x6485('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index dcfce5d..f3c9237 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 _0x96f9=['name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','find','timeout','createQueue','atimeout','channel','START:%s','end','close','rules','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format'];(function(_0x517d9e,_0x214a0a){var _0x2da8ac=function(_0xf5e07c){while(--_0xf5e07c){_0x517d9e['push'](_0x517d9e['shift']());}};_0x2da8ac(++_0x214a0a);}(_0x96f9,0x1a5));var _0x996f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x96f9[_0x2c91e9];return _0x13f0ff;};'use strict';var schema=require(_0x996f('0x0'));var _=require(_0x996f('0x1'));var util=require(_0x996f('0x2'));var seqqueue=require(_0x996f('0x3'));var logger=require(_0x996f('0x4'))(_0x996f('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x996f('0x6'),'required':!![],'message':_0x996f('0x7')},'timeout':{'type':'number','message':_0x996f('0x8')}});function writeLog(_0x29c945,_0x478df9,_0x18c6d5){return logger[_0x996f('0x9')](util[_0x996f('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x29c945,_0x478df9[_0x996f('0xb')],_0x18c6d5));}function handleFindAgent(_0x1f4d5d){return function(_0x580edd){return _0x580edd[_0x996f('0xb')][_0x996f('0xc')]()===_0x1f4d5d[_0x996f('0xc')]();};}exports[_0x996f('0xd')]=function(_0x4811a2,_0x5be22e,_0x245c6c,_0x5a89b8){return function(_0x1369ca){try{var _0x4c58b7={'name':_0x5be22e[0x0],'timeout':_0x5be22e[0x1]};var _0x52a62b=queue[_0x996f('0x0')](_0x4c58b7,{'typecast':!![]});if(_0x52a62b[_0x996f('0xe')]){logger[_0x996f('0xf')](_0x996f('0x10'),_0x4811a2,_[_0x996f('0x11')](_0x52a62b,_0x996f('0x12'))['join'](',\x20'));_0x1369ca[_0x996f('0x13')]();}else{var _0x56f2af=_[_0x996f('0x14')](_0x245c6c['agents'],handleFindAgent(_0x4c58b7['name']));if(_0x56f2af){var _0x235715=(_0x4c58b7[_0x996f('0x15')]||0xa)*0x3e8;var _0x319005,_0x34d7e0;var _0x17554d=seqqueue[_0x996f('0x16')](_0x235715);_0x17554d['id']=_0x4811a2;_0x17554d[_0x996f('0x17')]=_0x235715;_0x17554d[_0x996f('0x18')]=_0x5a89b8[_0x996f('0x18')];writeLog(_0x4811a2,_0x56f2af,util[_0x996f('0xa')](_0x996f('0x19'),_0x235715));_0x245c6c['rules'][_0x4811a2]['on'](_0x996f('0x1a'),function(){logger[_0x996f('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4811a2);clearTimeout(_0x34d7e0);_0x34d7e0=undefined;_0x17554d[_0x996f('0x1b')]();if(_0x245c6c['rules'][_0x4811a2]){delete _0x245c6c['rules'][_0x4811a2];}_0x1369ca[_0x996f('0x13')]();});_0x245c6c[_0x996f('0x1c')][_0x4811a2]['on']('complete',function(){if(_0x245c6c['rules'][_0x4811a2]){delete _0x245c6c[_0x996f('0x1c')][_0x4811a2];}});_0x34d7e0=setTimeout(function(){logger[_0x996f('0x9')](_0x996f('0x1d'),_0x4811a2);clearTimeout(_0x34d7e0);_0x17554d[_0x996f('0x1b')]();_0x1369ca[_0x996f('0x1e')]();},_0x235715);strategy[_0x996f('0x1f')](_0x17554d,_0x56f2af,_0x245c6c,_0x5a89b8);}else{logger[_0x996f('0xf')](_0x996f('0x20'),_0x4811a2,_0x4c58b7['name']);_0x1369ca[_0x996f('0x13')]();}}}catch(_0x9e87a3){console[_0x996f('0x21')](_0x9e87a3);logger[_0x996f('0xf')](_0x996f('0x22'),_0x4811a2,_0x9e87a3[_0x996f('0x23')]);_0x1369ca[_0x996f('0x13')]();}};}; \ No newline at end of file +var _0x76f7=['find','timeout','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','join','stop'];(function(_0x128119,_0x2ec797){var _0x5c5e78=function(_0x51faa0){while(--_0x51faa0){_0x128119['push'](_0x128119['shift']());}};_0x5c5e78(++_0x2ec797);}(_0x76f7,0x19b));var _0x776f=function(_0x3f8da9,_0x219e40){_0x3f8da9=_0x3f8da9-0x0;var _0x17ba96=_0x76f7[_0x3f8da9];return _0x17ba96;};'use strict';var schema=require('validate');var _=require(_0x776f('0x0'));var util=require(_0x776f('0x1'));var seqqueue=require(_0x776f('0x2'));var logger=require(_0x776f('0x3'))(_0x776f('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x776f('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x776f('0x6'),'message':_0x776f('0x7')}});function writeLog(_0x250ac0,_0x43b2b0,_0x279ff4){return logger[_0x776f('0x8')](util[_0x776f('0x9')](_0x776f('0xa'),_0x250ac0,_0x43b2b0[_0x776f('0xb')],_0x279ff4));}function handleFindAgent(_0x1a032c){return function(_0xaeff66){return _0xaeff66[_0x776f('0xb')]['toLowerCase']()===_0x1a032c[_0x776f('0xc')]();};}exports[_0x776f('0xd')]=function(_0x3f8d63,_0x48cd41,_0x2933bc,_0x1ac6d1){return function(_0x5be38e){try{var _0x2fb883={'name':_0x48cd41[0x0],'timeout':_0x48cd41[0x1]};var _0x235cde=queue[_0x776f('0xe')](_0x2fb883,{'typecast':!![]});if(_0x235cde[_0x776f('0xf')]){logger[_0x776f('0x10')](_0x776f('0x11'),_0x3f8d63,_['map'](_0x235cde,_0x776f('0x12'))[_0x776f('0x13')](',\x20'));_0x5be38e[_0x776f('0x14')]();}else{var _0x33253a=_[_0x776f('0x15')](_0x2933bc['agents'],handleFindAgent(_0x2fb883['name']));if(_0x33253a){var _0xf76eee=(_0x2fb883[_0x776f('0x16')]||0xa)*0x3e8;var _0xd2acd3,_0x2abc66;var _0x463272=seqqueue[_0x776f('0x17')](_0xf76eee);_0x463272['id']=_0x3f8d63;_0x463272['atimeout']=_0xf76eee;_0x463272[_0x776f('0x18')]=_0x1ac6d1[_0x776f('0x18')];writeLog(_0x3f8d63,_0x33253a,util['format'](_0x776f('0x19'),_0xf76eee));_0x2933bc[_0x776f('0x1a')][_0x3f8d63]['on']('end',function(){logger[_0x776f('0x8')](_0x776f('0x1b'),_0x3f8d63);clearTimeout(_0x2abc66);_0x2abc66=undefined;_0x463272[_0x776f('0x1c')]();if(_0x2933bc[_0x776f('0x1a')][_0x3f8d63]){delete _0x2933bc[_0x776f('0x1a')][_0x3f8d63];}_0x5be38e[_0x776f('0x14')]();});_0x2933bc['rules'][_0x3f8d63]['on']('complete',function(){if(_0x2933bc[_0x776f('0x1a')][_0x3f8d63]){delete _0x2933bc[_0x776f('0x1a')][_0x3f8d63];}});_0x2abc66=setTimeout(function(){logger[_0x776f('0x8')](_0x776f('0x1d'),_0x3f8d63);clearTimeout(_0x2abc66);_0x463272['close']();_0x5be38e[_0x776f('0x1e')]();},_0xf76eee);strategy[_0x776f('0x1f')](_0x463272,_0x33253a,_0x2933bc,_0x1ac6d1);}else{logger['error'](_0x776f('0x20'),_0x3f8d63,_0x2fb883['name']);_0x5be38e[_0x776f('0x14')]();}}}catch(_0x483728){console[_0x776f('0x21')](_0x483728);logger['error'](_0x776f('0x22'),_0x3f8d63,_0x483728[_0x776f('0x23')]);_0x5be38e[_0x776f('0x14')]();}};}; \ 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 e7fcbb8..33fdb40 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 _0xb0bb=['account','upperFirst','isEmpty','getMustacheRender','Message','create','then','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','postText','message','amazonlex','providerName','providerResponse','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','interaction','AccountId'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xb0bb,0x1c7));var _0xbb0b=function(_0x3b4597,_0x234c25){_0x3b4597=_0x3b4597-0x0;var _0x1dbe3f=_0xb0bb[_0x3b4597];return _0x1dbe3f;};'use strict';var _=require(_0xbb0b('0x0'));var moment=require(_0xbb0b('0x1'));var AWS=require(_0xbb0b('0x2'));var utils=require(_0xbb0b('0x3'));var logger=require(_0xbb0b('0x4'))(_0xbb0b('0x5'));var rpc={'chatMessage':require(_0xbb0b('0x6')),'openchannelMessage':require(_0xbb0b('0x7')),'mailMessage':require(_0xbb0b('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbb0b('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xbb0b('0xa')]=function(_0x385208,_0xe4c5da){return function(_0x26134a){try{if(!_['isNil'](this['interaction'][_0xbb0b('0xb')])){logger[_0xbb0b('0xc')](_0xbb0b('0xd'),_0x385208,_0xbb0b('0xe'));return _0x26134a[_0xbb0b('0xf')]();}var _0x2c27d5={'ContactId':this[_0xbb0b('0x10')]['id'],'sentAt':moment()[_0xbb0b('0x11')](_0xbb0b('0x12')),'direction':'out'};if(this['channel']===_0xbb0b('0x13')||this[_0xbb0b('0x14')]===_0xbb0b('0x15')){_0x2c27d5[_0xbb0b('0x16')]=this[_0xbb0b('0x17')][_0xbb0b('0x16')];}var _0x5ae687=this['channel'];if(_0x5ae687==='chat'){_0x2c27d5['ChatWebsiteId']=this['account']['id'];}else{_0x2c27d5[_['upperFirst'](_0x5ae687)+_0xbb0b('0x18')]=this[_0xbb0b('0x19')]['id'];}_0x2c27d5[_[_0xbb0b('0x1a')](_0x5ae687)+'InteractionId']=this[_0xbb0b('0x17')]['id'];if(this[_0xbb0b('0x17')]['created']){var _0x1dd381=_0xe4c5da[0x4];if(!_[_0xbb0b('0x1b')](_0x1dd381)){_0x2c27d5['body']=utils[_0xbb0b('0x1c')](_0x1dd381,this);return rpc[_0x5ae687+_0xbb0b('0x1d')][_0xbb0b('0x1e')](_0x2c27d5)[_0xbb0b('0x1f')](function(_0x361e43){logger['info'](_0xbb0b('0xd'),_0x385208,_0x2c27d5[_0xbb0b('0x20')]);})['catch'](function(_0x47a9a8){logger[_0xbb0b('0x21')](_0xbb0b('0xd'),_0x385208,JSON[_0xbb0b('0x22')](_0x47a9a8));})[_0xbb0b('0x23')](function(){logger[_0xbb0b('0xc')](_0xbb0b('0x24'),_0x385208);_0x26134a[_0xbb0b('0x25')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x385208);_0x26134a[_0xbb0b('0x25')]();}}else{var _0x2a1daf=this;var _0x4a4e98=new AWS[(_0xbb0b('0x26'))]({'accessKeyId':_0xe4c5da[0x0],'secretAccessKey':_0xe4c5da[0x1],'region':_0xe4c5da[0x2]});var _0x200a4c={'botAlias':_0xbb0b('0x27'),'botName':_0xe4c5da[0x3],'inputText':this['message'][_0xbb0b('0x20')],'userId':this['channel']+':'+this[_0xbb0b('0x17')]['id']['toString']()};_0x4a4e98[_0xbb0b('0x28')](_0x200a4c,function(_0x4eaf9a,_0x265f33){if(_0x4eaf9a){logger[_0xbb0b('0x21')](_0xbb0b('0xd'),_0x385208,_0x4eaf9a[_0xbb0b('0x29')]);_0x26134a[_0xbb0b('0xf')]();}else if(_0x265f33&&_0x265f33[_0xbb0b('0x29')]){_0x2a1daf[_0xbb0b('0x20')][_0xbb0b('0x2a')]=_0x265f33;_0x2c27d5[_0xbb0b('0x20')]=_0x265f33[_0xbb0b('0x29')];_0x2c27d5[_0xbb0b('0x2b')]=_0xbb0b('0x2a');_0x2c27d5[_0xbb0b('0x2c')]=JSON[_0xbb0b('0x22')](_0x265f33);return rpc[_0x5ae687+'Message'][_0xbb0b('0x1e')](_0x2c27d5)[_0xbb0b('0x1f')](function(_0xb0fdf3){logger[_0xbb0b('0xc')](_0xbb0b('0xd'),_0x385208,_0x2c27d5['body']);if(_0x265f33[_0xbb0b('0x2d')]==_0xbb0b('0x2e')){_0x26134a['next']();}else{_0x26134a[_0xbb0b('0x25')]();}})[_0xbb0b('0x2f')](function(_0xd284c3){logger['error'](_0xbb0b('0xd'),_0x385208,JSON['stringify'](_0xd284c3));_0x26134a[_0xbb0b('0xf')]();});}else{_0x26134a[_0xbb0b('0xf')]();}});}}catch(_0x31acc3){logger[_0xbb0b('0x21')](_0xbb0b('0xd'),_0x385208,JSON[_0xbb0b('0x22')](_0x31acc3));_0x26134a[_0xbb0b('0x25')]();}};}; \ No newline at end of file +var _0xfa3c=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','then','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','error','message','providerResponse','stringify','create','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage'];(function(_0x51bcf9,_0x10c560){var _0x48b6c0=function(_0x3d072e){while(--_0x3d072e){_0x51bcf9['push'](_0x51bcf9['shift']());}};_0x48b6c0(++_0x10c560);}(_0xfa3c,0x1ea));var _0xcfa3=function(_0x4ebf6a,_0xfd0a40){_0x4ebf6a=_0x4ebf6a-0x0;var _0x1e7a72=_0xfa3c[_0x4ebf6a];return _0x1e7a72;};'use strict';var _=require(_0xcfa3('0x0'));var moment=require('moment');var AWS=require(_0xcfa3('0x1'));var utils=require(_0xcfa3('0x2'));var logger=require(_0xcfa3('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcfa3('0x4')),'mailMessage':require(_0xcfa3('0x5')),'smsMessage':require(_0xcfa3('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcfa3('0x7'))};exports[_0xcfa3('0x8')]=function(_0x236555,_0x1b2d8e){return function(_0xc8992f){try{if(!_[_0xcfa3('0x9')](this[_0xcfa3('0xa')]['UserId'])){logger[_0xcfa3('0xb')](_0xcfa3('0xc'),_0x236555,_0xcfa3('0xd'));return _0xc8992f[_0xcfa3('0xe')]();}var _0x4db4df={'ContactId':this[_0xcfa3('0xf')]['id'],'sentAt':moment()[_0xcfa3('0x10')](_0xcfa3('0x11')),'direction':'out'};if(this[_0xcfa3('0x12')]===_0xcfa3('0x13')||this[_0xcfa3('0x12')]===_0xcfa3('0x14')){_0x4db4df['phone']=this[_0xcfa3('0xa')][_0xcfa3('0x15')];}var _0x55b651=this['channel'];if(_0x55b651===_0xcfa3('0x16')){_0x4db4df[_0xcfa3('0x17')]=this[_0xcfa3('0x18')]['id'];}else{_0x4db4df[_[_0xcfa3('0x19')](_0x55b651)+_0xcfa3('0x1a')]=this[_0xcfa3('0x18')]['id'];}_0x4db4df[_[_0xcfa3('0x19')](_0x55b651)+'InteractionId']=this['interaction']['id'];if(this['interaction']['created']){var _0x4a1d76=_0x1b2d8e[0x4];if(!_[_0xcfa3('0x1b')](_0x4a1d76)){_0x4db4df[_0xcfa3('0x1c')]=utils[_0xcfa3('0x1d')](_0x4a1d76,this);return rpc[_0x55b651+_0xcfa3('0x1e')]['create'](_0x4db4df)[_0xcfa3('0x1f')](function(_0x59a755){logger[_0xcfa3('0xb')]('[%s][AMAZONLEX]\x20%s',_0x236555,_0x4db4df[_0xcfa3('0x1c')]);})[_0xcfa3('0x20')](function(_0x4cc5d5){logger['error']('[%s][AMAZONLEX]\x20%s',_0x236555,JSON['stringify'](_0x4cc5d5));})[_0xcfa3('0x21')](function(){logger[_0xcfa3('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x236555);_0xc8992f['stop']();});}else{logger[_0xcfa3('0xb')](_0xcfa3('0x22'),_0x236555);_0xc8992f['stop']();}}else{var _0x402066=this;var _0x5320ff=new AWS[(_0xcfa3('0x23'))]({'accessKeyId':_0x1b2d8e[0x0],'secretAccessKey':_0x1b2d8e[0x1],'region':_0x1b2d8e[0x2]});var _0x2bb682={'botAlias':_0xcfa3('0x24'),'botName':_0x1b2d8e[0x3],'inputText':this['message'][_0xcfa3('0x1c')],'userId':this[_0xcfa3('0x12')]+':'+this[_0xcfa3('0xa')]['id'][_0xcfa3('0x25')]()};_0x5320ff['postText'](_0x2bb682,function(_0x50a9f2,_0x5c3784){if(_0x50a9f2){logger[_0xcfa3('0x26')](_0xcfa3('0xc'),_0x236555,_0x50a9f2[_0xcfa3('0x27')]);_0xc8992f['next']();}else if(_0x5c3784&&_0x5c3784[_0xcfa3('0x27')]){_0x402066[_0xcfa3('0x1c')]['amazonlex']=_0x5c3784;_0x4db4df[_0xcfa3('0x1c')]=_0x5c3784[_0xcfa3('0x27')];_0x4db4df['providerName']='amazonlex';_0x4db4df[_0xcfa3('0x28')]=JSON[_0xcfa3('0x29')](_0x5c3784);return rpc[_0x55b651+_0xcfa3('0x1e')][_0xcfa3('0x2a')](_0x4db4df)[_0xcfa3('0x1f')](function(_0x38eaad){logger[_0xcfa3('0xb')](_0xcfa3('0xc'),_0x236555,_0x4db4df[_0xcfa3('0x1c')]);if(_0x5c3784[_0xcfa3('0x2b')]==_0xcfa3('0x2c')){_0xc8992f[_0xcfa3('0xe')]();}else{_0xc8992f['stop']();}})[_0xcfa3('0x20')](function(_0xb190ce){logger[_0xcfa3('0x26')](_0xcfa3('0xc'),_0x236555,JSON[_0xcfa3('0x29')](_0xb190ce));_0xc8992f[_0xcfa3('0xe')]();});}else{_0xc8992f[_0xcfa3('0xe')]();}});}}catch(_0x14ab72){logger[_0xcfa3('0x26')](_0xcfa3('0xc'),_0x236555,JSON[_0xcfa3('0x29')](_0x14ab72));_0xc8992f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 7f3e2a3..36758f5 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 _0x1902=['Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','messageId','','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','update','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created'];(function(_0x698239,_0x107a44){var _0x87e18f=function(_0x1e15a6){while(--_0x1e15a6){_0x698239['push'](_0x698239['shift']());}};_0x87e18f(++_0x107a44);}(_0x1902,0xbe));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2190('0x0'));var moment=require(_0x2190('0x1'));var utils=require(_0x2190('0x2'));var logger=require(_0x2190('0x3'))(_0x2190('0x4'));var rpc={'chatMessage':require(_0x2190('0x5')),'openchannelMessage':require(_0x2190('0x6')),'mailMessage':require(_0x2190('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2190('0x8')),'whatsappMessage':require(_0x2190('0x9')),'chatInteraction':require(_0x2190('0xa')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x2190('0xb')),'smsInteraction':require(_0x2190('0xc')),'faxInteraction':require(_0x2190('0xd')),'whatsappInteraction':require(_0x2190('0xe'))};var mailRpc=require(_0x2190('0xf'));exports[_0x2190('0x10')]=function(_0x4c5d8e,_0x4dfcf1,_0xd482dd,_0x2914a5){return function(_0x3267fc){try{var _0x3e50a0=this[_0x2190('0x11')];if(_0x3e50a0===_0x2190('0x12')&&_0x2914a5['body']['isAutoreply']){logger[_0x2190('0x13')](_0x2190('0x14'),_0x4c5d8e,_0x2190('0x15'));return _0x3267fc[_0x2190('0x16')]();}if(_0x4dfcf1[0x0]==='1'&&(_[_0x2190('0x17')](this[_0x2190('0x18')][_0x2190('0x19')])||!this[_0x2190('0x18')][_0x2190('0x19')])){logger['info'](_0x2190('0x14'),_0x4c5d8e,_0x2190('0x1a'));return _0x3267fc[_0x2190('0x16')]();}if(_0x4dfcf1[0x0]==='2'&&this['interaction'][_0x2190('0x1b')]){logger[_0x2190('0x13')](_0x2190('0x1c'),_0x4c5d8e,_0x2190('0x1d'));return _0x3267fc[_0x2190('0x16')]();}var _0x511b28={'ContactId':this[_0x2190('0x1e')]['id'],'sentAt':moment()[_0x2190('0x1f')](_0x2190('0x20')),'direction':_0x2190('0x21')};if(this[_0x2190('0x11')]==='mail'){_0x511b28[_0x2190('0x22')]=utils[_0x2190('0x23')](_0x4dfcf1[0x2],this);}else{_0x511b28[_0x2190('0x22')]=utils[_0x2190('0x23')](_0x4dfcf1[0x1],this);}if(this[_0x2190('0x24')]){_0x511b28['to']=this[_0x2190('0x24')][_0x2190('0x25')]||'';if(this[_0x2190('0x11')]===_0x2190('0x12')&&_0x4dfcf1[0x1]==='1'){_0x511b28['cc']=this[_0x2190('0x24')]['cc']||'';}_0x511b28['from']=this[_0x2190('0x24')]['to']||'';_0x511b28[_0x2190('0x26')]=this[_0x2190('0x24')][_0x2190('0x26')]||'';_0x511b28[_0x2190('0x27')]=!![];if(this[_0x2190('0x24')]['subject']){_0x511b28['subject']='';_0x511b28[_0x2190('0x28')]+=_[_0x2190('0x29')](this['message'][_0x2190('0x28')],_0x2190('0x2a'))?'':_0x2190('0x2b');_0x511b28[_0x2190('0x28')]+=this[_0x2190('0x24')]['subject'];}}if(this[_0x2190('0x11')]===_0x2190('0x2c')){_0x511b28[_0x2190('0x2d')]=this[_0x2190('0x2e')]['id'];}else{_0x511b28[_[_0x2190('0x2f')](this[_0x2190('0x11')])+_0x2190('0x30')]=this[_0x2190('0x2e')]['id'];}_0x511b28[_[_0x2190('0x2f')](this[_0x2190('0x11')])+_0x2190('0x31')]=this[_0x2190('0x18')]['id'];var _0x52a426=this['interaction'];if(rpc[this['channel']+'Message']){if(this[_0x2190('0x11')]==='mail'){_0x511b28['inReplyTo']=this[_0x2190('0x24')][_0x2190('0x32')];_0x511b28['html']=_0x2190('0x33')+_['replace'](_0x511b28[_0x2190('0x22')],'','';_0x52f355[_0x48f9('0x33')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0x48f9('0x34')](this[_0x48f9('0x29')][_0x48f9('0x35')],_0x52f355)['then'](function(_0x1487be){logger['info'](_0x48f9('0x36'),_0x56a2b7);_0x52f355[_0x48f9('0x2e')]=_0x1487be['message']['messageId'];return rpc[_0x119071+_0x48f9('0x37')]['create'](_0x52f355);})[_0x48f9('0x38')](function(_0x5204a1){logger[_0x48f9('0x13')](_0x48f9('0x17'),_0x56a2b7,JSON[_0x48f9('0x39')](_0x5204a1));})[_0x48f9('0x3a')](function(_0x5b0a43){logger['error'](_0x48f9('0x3b'),_0x56a2b7,JSON[_0x48f9('0x39')](_0x5b0a43));})[_0x48f9('0x3c')](function(){Promise['resolve']()[_0x48f9('0x38')](function(){if(_0x435ccb[0x0]!=='2'||_0x3be328[_0x48f9('0x3d')])return;return rpc[_0x119071+_0x48f9('0x3e')][_0x48f9('0x3f')](_0x3be328['id'],{'autoreplyExecuted':!![]})[_0x48f9('0x38')](function(_0x10aa62){logger[_0x48f9('0x13')](_0x48f9('0x1a'),_0x56a2b7,JSON[_0x48f9('0x39')](_0x10aa62));})['catch'](function(_0x378053){logger[_0x48f9('0x40')](_0x48f9('0x41'),_0x56a2b7,JSON[_0x48f9('0x39')](_0x378053));});})['then'](function(){_0x47cf33[_0x48f9('0x19')]();});});}else{return rpc[this[_0x48f9('0x11')]+_0x48f9('0x37')][_0x48f9('0x42')](_0x52f355)[_0x48f9('0x38')](function(){logger[_0x48f9('0x13')](_0x48f9('0x17'),_0x56a2b7,_0x52f355['body']);})[_0x48f9('0x3a')](function(_0x329b7b){logger['error'](_0x48f9('0x17'),_0x56a2b7,JSON[_0x48f9('0x39')](_0x329b7b));})[_0x48f9('0x3c')](function(){Promise['resolve']()['then'](function(){if(_0x435ccb[0x0]!=='2'||_0x3be328[_0x48f9('0x3d')])return;return rpc[_0x119071+_0x48f9('0x3e')]['update'](_0x3be328['id'],{'autoreplyExecuted':!![]})[_0x48f9('0x38')](function(_0x2ab909){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x56a2b7,JSON['stringify'](_0x2ab909));})[_0x48f9('0x3a')](function(_0x5f366a){logger[_0x48f9('0x40')](_0x48f9('0x41'),_0x56a2b7,JSON[_0x48f9('0x39')](_0x5f366a));});})[_0x48f9('0x38')](function(){_0x47cf33[_0x48f9('0x19')]();});});}}}catch(_0xa298){logger[_0x48f9('0x40')](_0x48f9('0x17'),_0x56a2b7,JSON[_0x48f9('0x39')](_0xa298));_0x47cf33[_0x48f9('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 6620da6..b7db1f6 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 _0xb95b=['channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','format','system'];(function(_0x78bca9,_0x15d5ef){var _0x323573=function(_0x100ff5){while(--_0x100ff5){_0x78bca9['push'](_0x78bca9['shift']());}};_0x323573(++_0x15d5ef);}(_0xb95b,0x15b));var _0xbb95=function(_0x4693b8,_0xff4dcc){_0x4693b8=_0x4693b8-0x0;var _0x117328=_0xb95b[_0x4693b8];return _0x117328;};'use strict';var moment=require(_0xbb95('0x0'));var logger=require(_0xbb95('0x1'))('routing');var rpc={'chatInteraction':require(_0xbb95('0x2')),'openchannelInteraction':require(_0xbb95('0x3')),'smsInteraction':require(_0xbb95('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xbb95('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xbb95('0x6')]=function(_0x65a434,_0x225511,_0x4b92d0,_0x5c9a72){return function(_0x50eb5b){try{logger[_0xbb95('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x65a434,_0x225511[0x0]);var _0x40d33a={'closed':0x1,'closedAt':moment()[_0xbb95('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xbb95('0x9'),'disposition':_0x225511[0x0]};if(rpc[_0x5c9a72[_0xbb95('0xa')]+_0xbb95('0xb')]){rpc[_0x5c9a72[_0xbb95('0xa')]+_0xbb95('0xb')][_0xbb95('0xc')](_0x5c9a72['interaction']['id'],_0x40d33a)[_0xbb95('0xd')](function(_0x19a081){logger['info'](_0xbb95('0xe'),_0x65a434,_0x5c9a72[_0xbb95('0xf')]['id']);})[_0xbb95('0x10')](function(_0x441a9e){logger[_0xbb95('0x11')](_0xbb95('0x12'),_0x65a434,JSON['stringify'](_0x441a9e));})[_0xbb95('0x13')](function(){_0x50eb5b['stop']();});}}catch(_0x23b8e5){logger[_0xbb95('0x11')](_0xbb95('0x12'),_0x65a434,JSON['stringify'](_0x23b8e5));_0x50eb5b[_0xbb95('0x14')]();}};}; \ No newline at end of file +var _0xbb0a=['finally','[%s][CLOSE]\x20%s','stringify','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../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','error'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0xbb0a,0xc3));var _0xabb0=function(_0x5c8821,_0x12ddae){_0x5c8821=_0x5c8821-0x0;var _0x3cb98b=_0xbb0a[_0x5c8821];return _0x3cb98b;};'use strict';var moment=require('moment');var logger=require(_0xabb0('0x0'))(_0xabb0('0x1'));var rpc={'chatInteraction':require(_0xabb0('0x2')),'openchannelInteraction':require(_0xabb0('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xabb0('0x4')),'faxInteraction':require(_0xabb0('0x5')),'whatsappInteraction':require(_0xabb0('0x6'))};exports[_0xabb0('0x7')]=function(_0x5e679f,_0x5151af,_0x6c0940,_0x42fdc2){return function(_0x5c2f2b){try{logger[_0xabb0('0x8')](_0xabb0('0x9'),_0x5e679f,_0x5151af[0x0]);var _0x565796={'closed':0x1,'closedAt':moment()[_0xabb0('0xa')](_0xabb0('0xb')),'closeReason':_0xabb0('0xc'),'disposition':_0x5151af[0x0]};if(rpc[_0x42fdc2[_0xabb0('0xd')]+_0xabb0('0xe')]){rpc[_0x42fdc2['channel']+'Interaction'][_0xabb0('0xf')](_0x42fdc2[_0xabb0('0x10')]['id'],_0x565796)[_0xabb0('0x11')](function(_0x4d7a03){logger[_0xabb0('0x8')](_0xabb0('0x12'),_0x5e679f,_0x42fdc2['interaction']['id']);})[_0xabb0('0x13')](function(_0x591667){logger[_0xabb0('0x14')]('[%s][CLOSE]\x20%s',_0x5e679f,JSON['stringify'](_0x591667));})[_0xabb0('0x15')](function(){_0x5c2f2b['stop']();});}}catch(_0x400af3){logger[_0xabb0('0x14')](_0xabb0('0x16'),_0x5e679f,JSON[_0xabb0('0x17')](_0x400af3));_0x5c2f2b['stop']();}};}; \ 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 4fb70ef..4ec3a64 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 _0xa992=['consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','body','getMustacheRender','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','result','speech','providerName','dialogflow','providerResponse','stringify','Message','endConversation','message','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xa992,0x18c));var _0x2a99=function(_0xd815d4,_0x40c120){_0xd815d4=_0xd815d4-0x0;var _0x297aa8=_0xa992[_0xd815d4];return _0x297aa8;};'use strict';var _=require(_0x2a99('0x0'));var moment=require(_0x2a99('0x1'));var apiai=require(_0x2a99('0x2'));var md5=require(_0x2a99('0x3'));var utils=require('./utils');var logger=require(_0x2a99('0x4'))(_0x2a99('0x5'));var rpc={'chatMessage':require(_0x2a99('0x6')),'openchannelMessage':require(_0x2a99('0x7')),'mailMessage':require(_0x2a99('0x8')),'smsMessage':require(_0x2a99('0x9')),'faxMessage':require(_0x2a99('0xa')),'whatsappMessage':require(_0x2a99('0xb'))};exports[_0x2a99('0xc')]=function(_0x9325b0,_0x483fb7){return function(_0x365583){try{if(!_[_0x2a99('0xd')](this[_0x2a99('0xe')][_0x2a99('0xf')])){logger[_0x2a99('0x10')](_0x2a99('0x11'),_0x9325b0,_0x2a99('0x12'));return _0x365583[_0x2a99('0x13')]();}var _0x2b8f01={'ContactId':this[_0x2a99('0x14')]['id'],'sentAt':moment()[_0x2a99('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x2a99('0x16')]===_0x2a99('0x17')||this[_0x2a99('0x16')]===_0x2a99('0x18')){_0x2b8f01[_0x2a99('0x19')]=this[_0x2a99('0xe')]['phone'];}var _0x310868=this[_0x2a99('0x16')];if(_0x310868===_0x2a99('0x1a')){_0x2b8f01[_0x2a99('0x1b')]=this[_0x2a99('0x1c')]['id'];}else{_0x2b8f01[_['upperFirst'](_0x310868)+_0x2a99('0x1d')]=this['account']['id'];}_0x2b8f01[_['upperFirst'](_0x310868)+_0x2a99('0x1e')]=this[_0x2a99('0xe')]['id'];if(this[_0x2a99('0xe')]['created']){var _0x5bf701=_0x483fb7[0x2];if(!_['isEmpty'](_0x5bf701)){_0x2b8f01[_0x2a99('0x1f')]=utils[_0x2a99('0x20')](_0x5bf701,this);return rpc[_0x310868+'Message'][_0x2a99('0x21')](_0x2b8f01)[_0x2a99('0x22')](function(_0xbca200){logger[_0x2a99('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x9325b0,_0x2b8f01[_0x2a99('0x1f')]);})[_0x2a99('0x23')](function(_0x428109){logger[_0x2a99('0x24')](_0x2a99('0x11'),_0x9325b0,JSON['stringify'](_0x428109));})[_0x2a99('0x25')](function(){logger[_0x2a99('0x10')](_0x2a99('0x26'),_0x9325b0);_0x365583[_0x2a99('0x27')]();});}else{logger[_0x2a99('0x10')](_0x2a99('0x28'),_0x9325b0);_0x365583[_0x2a99('0x27')]();}}else{var _0x36aa21=this;var _0x3541fc=apiai(_0x483fb7[0x0],{'language':_0x483fb7[0x1]||'en'});return _0x3541fc[_0x2a99('0x29')](this['message'][_0x2a99('0x1f')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x48c611){_0x36aa21[_0x2a99('0x1f')]['dialogflow']=_0x48c611;_0x2b8f01['body']=_0x48c611[_0x2a99('0x2a')]['fulfillment'][_0x2a99('0x2b')];_0x2b8f01[_0x2a99('0x2c')]=_0x2a99('0x2d');_0x2b8f01[_0x2a99('0x2e')]=JSON[_0x2a99('0x2f')](_0x48c611);return rpc[_0x310868+_0x2a99('0x30')][_0x2a99('0x21')](_0x2b8f01)[_0x2a99('0x22')](function(_0x2b5d97){logger[_0x2a99('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x9325b0,_0x2b8f01[_0x2a99('0x1f')]);if(_0x48c611[_0x2a99('0x2a')]['metadata'][_0x2a99('0x31')]){_0x365583[_0x2a99('0x13')]();}else{_0x365583[_0x2a99('0x27')]();}})['catch'](function(_0x247bc1){logger[_0x2a99('0x24')](_0x2a99('0x11'),_0x9325b0,JSON[_0x2a99('0x2f')](_0x247bc1));_0x365583['next']();});})[_0x2a99('0x23')](function(_0x1dbffa){logger['error'](_0x2a99('0x11'),_0x9325b0,_0x1dbffa[_0x2a99('0x32')]);_0x365583[_0x2a99('0x13')]();});}}catch(_0x56dee2){logger[_0x2a99('0x24')](_0x2a99('0x11'),_0x9325b0,JSON[_0x2a99('0x2f')](_0x56dee2));_0x365583[_0x2a99('0x27')]();}};}; \ No newline at end of file +var _0xcaf2=['isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','InteractionId','created','isEmpty','getMustacheRender','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','dialogflow','result','fulfillment','speech','providerName','Message','create','metadata','endConversation','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x2028e0,_0x37d31f){var _0x524757=function(_0x5aa183){while(--_0x5aa183){_0x2028e0['push'](_0x2028e0['shift']());}};_0x524757(++_0x37d31f);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1e8f9e,_0x148061){_0x1e8f9e=_0x1e8f9e-0x0;var _0x2cec83=_0xcaf2[_0x1e8f9e];return _0x2cec83;};'use strict';var _=require(_0x2caf('0x0'));var moment=require('moment');var apiai=require(_0x2caf('0x1'));var md5=require(_0x2caf('0x2'));var utils=require('./utils');var logger=require(_0x2caf('0x3'))(_0x2caf('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2caf('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2caf('0x6')),'faxMessage':require(_0x2caf('0x7')),'whatsappMessage':require(_0x2caf('0x8'))};exports['consequence']=function(_0xc44e4e,_0x314486){return function(_0x4667c6){try{if(!_[_0x2caf('0x9')](this['interaction'][_0x2caf('0xa')])){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0xc44e4e,_0x2caf('0xd'));return _0x4667c6[_0x2caf('0xe')]();}var _0x438434={'ContactId':this[_0x2caf('0xf')]['id'],'sentAt':moment()[_0x2caf('0x10')](_0x2caf('0x11')),'direction':'out'};if(this[_0x2caf('0x12')]===_0x2caf('0x13')||this[_0x2caf('0x12')]===_0x2caf('0x14')){_0x438434[_0x2caf('0x15')]=this[_0x2caf('0x16')][_0x2caf('0x15')];}var _0x3b2e0a=this['channel'];if(_0x3b2e0a===_0x2caf('0x17')){_0x438434[_0x2caf('0x18')]=this['account']['id'];}else{_0x438434[_['upperFirst'](_0x3b2e0a)+'AccountId']=this[_0x2caf('0x19')]['id'];}_0x438434[_['upperFirst'](_0x3b2e0a)+_0x2caf('0x1a')]=this[_0x2caf('0x16')]['id'];if(this[_0x2caf('0x16')][_0x2caf('0x1b')]){var _0x486b8d=_0x314486[0x2];if(!_[_0x2caf('0x1c')](_0x486b8d)){_0x438434['body']=utils[_0x2caf('0x1d')](_0x486b8d,this);return rpc[_0x3b2e0a+'Message']['create'](_0x438434)[_0x2caf('0x1e')](function(_0x58047b){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0xc44e4e,_0x438434['body']);})[_0x2caf('0x1f')](function(_0x1eeb76){logger[_0x2caf('0x20')](_0x2caf('0xc'),_0xc44e4e,JSON[_0x2caf('0x21')](_0x1eeb76));})['finally'](function(){logger[_0x2caf('0xb')](_0x2caf('0x22'),_0xc44e4e);_0x4667c6[_0x2caf('0x23')]();});}else{logger[_0x2caf('0xb')](_0x2caf('0x24'),_0xc44e4e);_0x4667c6[_0x2caf('0x23')]();}}else{var _0x4092ba=this;var _0x256cc4=apiai(_0x314486[0x0],{'language':_0x314486[0x1]||'en'});return _0x256cc4[_0x2caf('0x25')](this[_0x2caf('0x26')][_0x2caf('0x27')],{'sessionId':md5(this['interaction']['id'])})[_0x2caf('0x1e')](function(_0x14bfd2){_0x4092ba[_0x2caf('0x27')][_0x2caf('0x28')]=_0x14bfd2;_0x438434[_0x2caf('0x27')]=_0x14bfd2[_0x2caf('0x29')][_0x2caf('0x2a')][_0x2caf('0x2b')];_0x438434[_0x2caf('0x2c')]=_0x2caf('0x28');_0x438434['providerResponse']=JSON[_0x2caf('0x21')](_0x14bfd2);return rpc[_0x3b2e0a+_0x2caf('0x2d')][_0x2caf('0x2e')](_0x438434)[_0x2caf('0x1e')](function(_0x3c60d1){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0xc44e4e,_0x438434[_0x2caf('0x27')]);if(_0x14bfd2[_0x2caf('0x29')][_0x2caf('0x2f')][_0x2caf('0x30')]){_0x4667c6[_0x2caf('0xe')]();}else{_0x4667c6[_0x2caf('0x23')]();}})['catch'](function(_0xb944cc){logger[_0x2caf('0x20')](_0x2caf('0xc'),_0xc44e4e,JSON[_0x2caf('0x21')](_0xb944cc));_0x4667c6[_0x2caf('0xe')]();});})[_0x2caf('0x1f')](function(_0x3812cd){logger['error'](_0x2caf('0xc'),_0xc44e4e,_0x3812cd[_0x2caf('0x26')]);_0x4667c6['next']();});}}catch(_0x302e39){logger[_0x2caf('0x20')](_0x2caf('0xc'),_0xc44e4e,JSON['stringify'](_0x302e39));_0x4667c6[_0x2caf('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 96b7a61..5e684eb 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 _0x6b4b=['body','Message','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','sessionPath','message','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','length','push','fulfillmentText','all','lodash','dialogflow','md5','moment','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x6b4b,0x88));var _0xb6b4=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6b4b[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xb6b4('0x0'));var dialogflow=require(_0xb6b4('0x1'));var md5=require(_0xb6b4('0x2'));var moment=require(_0xb6b4('0x3'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0xb6b4('0x4'));var utils=require(_0xb6b4('0x5'));var rpc={'chatMessage':require(_0xb6b4('0x6')),'openchannelMessage':require(_0xb6b4('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb6b4('0x8')),'faxMessage':require(_0xb6b4('0x9')),'whatsappMessage':require(_0xb6b4('0xa'))};function createMessage(_0xf6f978,_0xdab49f,_0x19aa4b,_0x44de28){return new Promise(function(_0x41e3d6,_0x11ff77){var _0x188594=_[_0xb6b4('0xb')](_0x19aa4b);_0x188594[_0xb6b4('0xc')]=_0x44de28;return rpc[_0xdab49f+_0xb6b4('0xd')]['create'](_0x188594)[_0xb6b4('0xe')](function(){logger[_0xb6b4('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0xf6f978,_0x188594[_0xb6b4('0xc')]);_0x41e3d6();})[_0xb6b4('0x10')](function(_0x68eb7){logger[_0xb6b4('0x11')](_0xb6b4('0x12'),_0xf6f978,JSON[_0xb6b4('0x13')](_0x68eb7));_0x11ff77(_0x68eb7);});});}exports[_0xb6b4('0x14')]=function(_0x25c258,_0x409075){return function(_0x2750ca){try{if(!_[_0xb6b4('0x15')](this[_0xb6b4('0x16')][_0xb6b4('0x17')])){logger[_0xb6b4('0xf')](_0xb6b4('0x12'),_0x25c258,_0xb6b4('0x18'));return _0x2750ca[_0xb6b4('0x19')]();}var _0x1e21e3={'ContactId':this[_0xb6b4('0x1a')]['id'],'sentAt':moment()['format'](_0xb6b4('0x1b')),'direction':'out'};if(this[_0xb6b4('0x1c')]===_0xb6b4('0x1d')||this[_0xb6b4('0x1c')]==='whatsapp'){_0x1e21e3[_0xb6b4('0x1e')]=this['interaction']['phone'];}var _0x3635a2=this[_0xb6b4('0x1c')];if(_0x3635a2===_0xb6b4('0x1f')){_0x1e21e3[_0xb6b4('0x20')]=this['account']['id'];}else{_0x1e21e3[_['upperFirst'](_0x3635a2)+'AccountId']=this[_0xb6b4('0x21')]['id'];}_0x1e21e3[_[_0xb6b4('0x22')](_0x3635a2)+_0xb6b4('0x23')]=this[_0xb6b4('0x16')]['id'];if(this[_0xb6b4('0x16')][_0xb6b4('0x24')]){var _0x3495d0=_0x409075[0x4];if(!_[_0xb6b4('0x25')](_0x3495d0)){_0x1e21e3[_0xb6b4('0xc')]=utils[_0xb6b4('0x26')](_0x3495d0,this);return rpc[_0x3635a2+'Message'][_0xb6b4('0x27')](_0x1e21e3)[_0xb6b4('0xe')](function(_0xd2e8c5){logger[_0xb6b4('0xf')](_0xb6b4('0x12'),_0x25c258,_0x1e21e3['body']);})[_0xb6b4('0x10')](function(_0x3f1fb5){logger[_0xb6b4('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x25c258,JSON[_0xb6b4('0x13')](_0x3f1fb5));})[_0xb6b4('0x28')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x25c258);_0x2750ca['stop']();});}else{logger[_0xb6b4('0xf')](_0xb6b4('0x29'),_0x25c258);_0x2750ca[_0xb6b4('0x2a')]();}}else{var _0x3ca0e8=this;var _0x317c2a=_0x409075[0x2][_0xb6b4('0x2b')](/\\n/g,'\x0a');var _0x328c33={'credentials':{'private_key':_0x317c2a,'client_email':_0x409075[0x1]}};var _0xea2297=new dialogflow['SessionsClient'](_0x328c33);var _0x21b0eb=_0xea2297[_0xb6b4('0x2c')](_0x409075[0x0],md5(_0x3ca0e8[_0xb6b4('0x16')]['id']));var _0x4173a3={'session':_0x21b0eb,'queryInput':{'text':{'text':_0x3ca0e8[_0xb6b4('0x2d')][_0xb6b4('0xc')],'languageCode':_0x409075[0x3]||'en'}}};return _0xea2297[_0xb6b4('0x2e')](_0x4173a3)['then'](function(_0x2063bd){if(_0x2063bd&&_0x2063bd['length']){_0x3ca0e8['body']['dialogflowV2']=_0x2063bd;var _0x37ae1a=_0x2063bd[0x0];var _0x2ab226=_0x37ae1a[_0xb6b4('0x2f')]['diagnosticInfo']&&_0x37ae1a['queryResult'][_0xb6b4('0x30')]['fields']?_0x37ae1a[_0xb6b4('0x2f')][_0xb6b4('0x30')][_0xb6b4('0x31')][_0xb6b4('0x32')][_0xb6b4('0x33')]:![];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x34')]=_0x37ae1a[_0xb6b4('0x2f')][_0xb6b4('0x35')];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x36')]=_0x37ae1a[_0xb6b4('0x2f')]['allRequiredParamsPresent'];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x37')]=_0x37ae1a[_0xb6b4('0x2f')][_0xb6b4('0x30')]&&_0x37ae1a[_0xb6b4('0x2f')][_0xb6b4('0x30')][_0xb6b4('0x31')]?_0x37ae1a[_0xb6b4('0x2f')]['diagnosticInfo']['fields']['end_conversation'][_0xb6b4('0x33')]:![];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x38')]=_0x37ae1a[_0xb6b4('0x2f')]['intent']['name'];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x39')]=_0x37ae1a[_0xb6b4('0x2f')]['intent'][_0xb6b4('0x3a')];_0x3ca0e8['body'][_0xb6b4('0x3b')]=_0x37ae1a[_0xb6b4('0x2f')][_0xb6b4('0x3c')][_0xb6b4('0x3d')];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x3e')]=_0x37ae1a[_0xb6b4('0x2f')]['languageCode'];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x3f')]=_0x37ae1a[_0xb6b4('0x2f')][_0xb6b4('0x40')];_0x3ca0e8[_0xb6b4('0xc')][_0xb6b4('0x41')]=_0x37ae1a[_0xb6b4('0x2f')][_0xb6b4('0x42')];_0x1e21e3[_0xb6b4('0x43')]=_0xb6b4('0x44');_0x1e21e3[_0xb6b4('0x45')]=JSON[_0xb6b4('0x13')](_0x2063bd);var _0x27980b=[];for(var _0x326d81=0x0;_0x326d81<_0x2063bd[_0xb6b4('0x46')];_0x326d81++){var _0x2779a5=_0x2063bd[_0x326d81];if(_0x2779a5&&_0x2779a5[_0xb6b4('0x2f')]&&_0x2779a5[_0xb6b4('0x2f')]['fulfillmentText']){_0x27980b[_0xb6b4('0x47')](createMessage(_0x25c258,_0x3635a2,_0x1e21e3,_0x2779a5[_0xb6b4('0x2f')][_0xb6b4('0x48')]));}}return Promise[_0xb6b4('0x49')](_0x27980b)[_0xb6b4('0xe')](function(){if(_0x2ab226){_0x2750ca['next']();}else{_0x2750ca[_0xb6b4('0x2a')]();}})[_0xb6b4('0x10')](function(_0x15aa82){logger[_0xb6b4('0x11')](_0xb6b4('0x12'),_0x25c258,JSON[_0xb6b4('0x13')](_0x15aa82));_0x2750ca['next']();});}})[_0xb6b4('0x10')](function(_0x32ec38){logger[_0xb6b4('0x11')](_0xb6b4('0x12'),_0x25c258,_0x32ec38[_0xb6b4('0x2d')]);_0x2750ca[_0xb6b4('0x19')]();});}}catch(_0x5760c7){logger[_0xb6b4('0x11')](_0xb6b4('0x12'),_0x25c258,JSON[_0xb6b4('0x13')](_0x5760c7));_0x2750ca[_0xb6b4('0x2a')]();}};}; \ No newline at end of file +var _0x5697=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','channel','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','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!','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','fields','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','length','fulfillmentText','all','next','lodash','md5','moment','bluebird','../../rpc/mailMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','UserId'];(function(_0x3c2749,_0x56a63a){var _0x421f56=function(_0x4a2535){while(--_0x4a2535){_0x3c2749['push'](_0x3c2749['shift']());}};_0x421f56(++_0x56a63a);}(_0x5697,0x1b5));var _0x7569=function(_0x1a0e6a,_0x1b43de){_0x1a0e6a=_0x1a0e6a-0x0;var _0x4b3934=_0x5697[_0x1a0e6a];return _0x4b3934;};'use strict';var _=require(_0x7569('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x7569('0x1'));var moment=require(_0x7569('0x2'));var Promise=require(_0x7569('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7569('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x149fa1,_0x11536f,_0x30b7e2,_0xee5a4){return new Promise(function(_0x3c0470,_0x172efe){var _0x56d3e1=_[_0x7569('0x5')](_0x30b7e2);_0x56d3e1['body']=_0xee5a4;return rpc[_0x11536f+_0x7569('0x6')][_0x7569('0x7')](_0x56d3e1)[_0x7569('0x8')](function(){logger[_0x7569('0x9')](_0x7569('0xa'),_0x149fa1,_0x56d3e1[_0x7569('0xb')]);_0x3c0470();})[_0x7569('0xc')](function(_0x103221){logger[_0x7569('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x149fa1,JSON[_0x7569('0xe')](_0x103221));_0x172efe(_0x103221);});});}exports[_0x7569('0xf')]=function(_0x411e47,_0xb4e76e){return function(_0x14213f){try{if(!_[_0x7569('0x10')](this['interaction'][_0x7569('0x11')])){logger[_0x7569('0x9')](_0x7569('0xa'),_0x411e47,_0x7569('0x12'));return _0x14213f['next']();}var _0x358b10={'ContactId':this[_0x7569('0x13')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7569('0x14')};if(this[_0x7569('0x15')]==='sms'||this[_0x7569('0x15')]===_0x7569('0x16')){_0x358b10['phone']=this[_0x7569('0x17')][_0x7569('0x18')];}var _0x2fee4d=this[_0x7569('0x15')];if(_0x2fee4d===_0x7569('0x19')){_0x358b10[_0x7569('0x1a')]=this[_0x7569('0x1b')]['id'];}else{_0x358b10[_['upperFirst'](_0x2fee4d)+'AccountId']=this['account']['id'];}_0x358b10[_[_0x7569('0x1c')](_0x2fee4d)+_0x7569('0x1d')]=this[_0x7569('0x17')]['id'];if(this[_0x7569('0x17')]['created']){var _0x5a5db1=_0xb4e76e[0x4];if(!_[_0x7569('0x1e')](_0x5a5db1)){_0x358b10['body']=utils[_0x7569('0x1f')](_0x5a5db1,this);return rpc[_0x2fee4d+'Message'][_0x7569('0x7')](_0x358b10)[_0x7569('0x8')](function(_0xf2d6c0){logger[_0x7569('0x9')](_0x7569('0xa'),_0x411e47,_0x358b10[_0x7569('0xb')]);})['catch'](function(_0x187179){logger[_0x7569('0xd')](_0x7569('0xa'),_0x411e47,JSON[_0x7569('0xe')](_0x187179));})[_0x7569('0x20')](function(){logger[_0x7569('0x9')](_0x7569('0x21'),_0x411e47);_0x14213f[_0x7569('0x22')]();});}else{logger[_0x7569('0x9')](_0x7569('0x23'),_0x411e47);_0x14213f[_0x7569('0x22')]();}}else{var _0xd6774d=this;var _0x2349c2=_0xb4e76e[0x2][_0x7569('0x24')](/\\n/g,'\x0a');var _0x5253db={'credentials':{'private_key':_0x2349c2,'client_email':_0xb4e76e[0x1]}};var _0x3ed9f8=new dialogflow[(_0x7569('0x25'))](_0x5253db);var _0x5d5e1e=_0x3ed9f8[_0x7569('0x26')](_0xb4e76e[0x0],md5(_0xd6774d[_0x7569('0x17')]['id']));var _0x111562={'session':_0x5d5e1e,'queryInput':{'text':{'text':_0xd6774d[_0x7569('0x27')][_0x7569('0xb')],'languageCode':_0xb4e76e[0x3]||'en'}}};return _0x3ed9f8[_0x7569('0x28')](_0x111562)['then'](function(_0x490441){if(_0x490441&&_0x490441['length']){_0xd6774d[_0x7569('0xb')][_0x7569('0x29')]=_0x490441;var _0x400005=_0x490441[0x0];var _0xa58a64=_0x400005[_0x7569('0x2a')][_0x7569('0x2b')]&&_0x400005[_0x7569('0x2a')][_0x7569('0x2b')]['fields']?_0x400005[_0x7569('0x2a')][_0x7569('0x2b')]['fields'][_0x7569('0x2c')][_0x7569('0x2d')]:![];_0xd6774d[_0x7569('0xb')][_0x7569('0x2e')]=_0x400005[_0x7569('0x2a')][_0x7569('0x2f')];_0xd6774d[_0x7569('0xb')][_0x7569('0x30')]=_0x400005[_0x7569('0x2a')][_0x7569('0x31')];_0xd6774d[_0x7569('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x400005['queryResult']['diagnosticInfo']&&_0x400005[_0x7569('0x2a')][_0x7569('0x2b')]['fields']?_0x400005['queryResult'][_0x7569('0x2b')][_0x7569('0x32')][_0x7569('0x2c')]['boolValue']:![];_0xd6774d['body'][_0x7569('0x33')]=_0x400005[_0x7569('0x2a')][_0x7569('0x34')][_0x7569('0x35')];_0xd6774d[_0x7569('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x400005[_0x7569('0x2a')][_0x7569('0x34')][_0x7569('0x36')];_0xd6774d[_0x7569('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x400005[_0x7569('0x2a')][_0x7569('0x34')]['isFallback'];_0xd6774d['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x400005[_0x7569('0x2a')][_0x7569('0x37')];_0xd6774d[_0x7569('0xb')][_0x7569('0x38')]=_0x400005[_0x7569('0x2a')][_0x7569('0x39')];_0xd6774d[_0x7569('0xb')][_0x7569('0x3a')]=_0x400005[_0x7569('0x2a')]['intentDetectionConfidence'];_0x358b10[_0x7569('0x3b')]='dialogflowV2';_0x358b10[_0x7569('0x3c')]=JSON[_0x7569('0xe')](_0x490441);var _0x31065a=[];for(var _0x44e63d=0x0;_0x44e63d<_0x490441[_0x7569('0x3d')];_0x44e63d++){var _0x3aa21a=_0x490441[_0x44e63d];if(_0x3aa21a&&_0x3aa21a[_0x7569('0x2a')]&&_0x3aa21a[_0x7569('0x2a')][_0x7569('0x3e')]){_0x31065a['push'](createMessage(_0x411e47,_0x2fee4d,_0x358b10,_0x3aa21a[_0x7569('0x2a')][_0x7569('0x3e')]));}}return Promise[_0x7569('0x3f')](_0x31065a)[_0x7569('0x8')](function(){if(_0xa58a64){_0x14213f[_0x7569('0x40')]();}else{_0x14213f[_0x7569('0x22')]();}})[_0x7569('0xc')](function(_0x4cc17c){logger[_0x7569('0xd')](_0x7569('0xa'),_0x411e47,JSON['stringify'](_0x4cc17c));_0x14213f['next']();});}})[_0x7569('0xc')](function(_0x37ce34){logger[_0x7569('0xd')](_0x7569('0xa'),_0x411e47,_0x37ce34['message']);_0x14213f[_0x7569('0x40')]();});}}catch(_0x4ab71a){logger[_0x7569('0xd')](_0x7569('0xa'),_0x411e47,JSON[_0x7569('0xe')](_0x4ab71a));_0x14213f['stop']();}};}; \ 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 a20a958..b738cc7 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 _0xfac0=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x58f10c,_0x2605a0){var _0x587d4c=function(_0x18ac1f){while(--_0x18ac1f){_0x58f10c['push'](_0x58f10c['shift']());}};_0x587d4c(++_0x2605a0);}(_0xfac0,0x75));var _0x0fac=function(_0x1a575e,_0x3dd212){_0x1a575e=_0x1a575e-0x0;var _0x8261c9=_0xfac0[_0x1a575e];return _0x8261c9;};'use strict';var schema=require(_0x0fac('0x0'));var _=require(_0x0fac('0x1'));var htmlToText=require(_0x0fac('0x2'));var utils=require('./utils');var logger=require(_0x0fac('0x3'))(_0x0fac('0x4'));var gotoif=schema({'condition':{'type':_0x0fac('0x5'),'required':!![],'message':_0x0fac('0x6')},'priorityTrue':{'type':_0x0fac('0x7'),'message':_0x0fac('0x8')},'priorityFalse':{'type':'number','message':_0x0fac('0x9')}});exports[_0x0fac('0xa')]=function(_0x2a64b6,_0x5c5cde){return function(_0x848b61){try{var _0x319ded={'condition':htmlToText[_0x0fac('0xb')](utils[_0x0fac('0xc')](_0x5c5cde[0x0],this),{'wordwrap':![]})[_0x0fac('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5c5cde[0x1],'priorityFalse':_0x5c5cde[0x2]};var _0x299af1=gotoif['validate'](_0x319ded,{'typecast':!![]});if(_0x299af1[_0x0fac('0xe')]){logger[_0x0fac('0xf')](_0x0fac('0x10'),_0x2a64b6,_[_0x0fac('0x11')](_0x299af1,_0x0fac('0x12'))[_0x0fac('0x13')](',\x20'));_0x848b61[_0x0fac('0x14')]();}else{try{var _0x3a9421=eval('('+_0x319ded['condition']+')');var _0x286ea2=_0x3a9421?_0x319ded['priorityTrue']:_0x319ded[_0x0fac('0x15')];logger[_0x0fac('0x16')](_0x0fac('0x17'),_0x2a64b6,_0x319ded[_0x0fac('0x18')],_0x3a9421,_0x286ea2||_0x0fac('0x19'));if(_0x286ea2){var _0xd64d04=_['findIndex'](_0x848b61[_0x0fac('0x1a')](),{'p':_0x286ea2});if(_0xd64d04>=0x0){logger[_0x0fac('0x16')](_0x0fac('0x1b'),_0x2a64b6,_0x286ea2||_0x0fac('0x19'),_0xd64d04);_0x848b61[_0x0fac('0x19')](_0xd64d04);}else{logger[_0x0fac('0x16')](_0x0fac('0x1c'),_0x2a64b6,_0x286ea2||_0x0fac('0x19'));_0x848b61['stop']();}}else{_0x848b61[_0x0fac('0x19')]();}}catch(_0x574404){logger[_0x0fac('0xf')](_0x0fac('0x1d'),_0x2a64b6,_0x574404[_0x0fac('0x12')]);_0x848b61[_0x0fac('0x14')]();}}}catch(_0x3c68d4){logger[_0x0fac('0xf')]('[%s][GOTOIF]\x20%s',_0x2a64b6,JSON[_0x0fac('0x1e')](_0x3c68d4));_0x848b61[_0x0fac('0x14')]();}};}; \ No newline at end of file +var _0x9fc5=['validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify'];(function(_0x14be7c,_0x362ad2){var _0x56922c=function(_0x53c5f7){while(--_0x53c5f7){_0x14be7c['push'](_0x14be7c['shift']());}};_0x56922c(++_0x362ad2);}(_0x9fc5,0x78));var _0x59fc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x9fc5[_0x433a86];return _0x23000c;};'use strict';var schema=require(_0x59fc('0x0'));var _=require('lodash');var htmlToText=require(_0x59fc('0x1'));var utils=require(_0x59fc('0x2'));var logger=require(_0x59fc('0x3'))(_0x59fc('0x4'));var gotoif=schema({'condition':{'type':_0x59fc('0x5'),'required':!![],'message':_0x59fc('0x6')},'priorityTrue':{'type':_0x59fc('0x7'),'message':_0x59fc('0x8')},'priorityFalse':{'type':_0x59fc('0x7'),'message':_0x59fc('0x9')}});exports[_0x59fc('0xa')]=function(_0x117f83,_0x57b3e6){return function(_0x5af9fc){try{var _0x12afb9={'condition':htmlToText[_0x59fc('0xb')](utils[_0x59fc('0xc')](_0x57b3e6[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x57b3e6[0x1],'priorityFalse':_0x57b3e6[0x2]};var _0x20610d=gotoif[_0x59fc('0x0')](_0x12afb9,{'typecast':!![]});if(_0x20610d[_0x59fc('0xd')]){logger[_0x59fc('0xe')](_0x59fc('0xf'),_0x117f83,_[_0x59fc('0x10')](_0x20610d,_0x59fc('0x11'))[_0x59fc('0x12')](',\x20'));_0x5af9fc[_0x59fc('0x13')]();}else{try{var _0x2f7c14=eval('('+_0x12afb9[_0x59fc('0x14')]+')');var _0x3dd88e=_0x2f7c14?_0x12afb9[_0x59fc('0x15')]:_0x12afb9[_0x59fc('0x16')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x117f83,_0x12afb9['condition'],_0x2f7c14,_0x3dd88e||'next');if(_0x3dd88e){var _0x423c8c=_[_0x59fc('0x17')](_0x5af9fc['rules'](),{'p':_0x3dd88e});if(_0x423c8c>=0x0){logger[_0x59fc('0x18')](_0x59fc('0x19'),_0x117f83,_0x3dd88e||_0x59fc('0x1a'),_0x423c8c);_0x5af9fc['next'](_0x423c8c);}else{logger[_0x59fc('0x18')](_0x59fc('0x1b'),_0x117f83,_0x3dd88e||'next');_0x5af9fc[_0x59fc('0x13')]();}}else{_0x5af9fc[_0x59fc('0x1a')]();}}catch(_0x1c0516){logger[_0x59fc('0xe')](_0x59fc('0x1c'),_0x117f83,_0x1c0516['message']);_0x5af9fc[_0x59fc('0x13')]();}}}catch(_0x19cc0a){logger[_0x59fc('0xe')]('[%s][GOTOIF]\x20%s',_0x117f83,JSON[_0x59fc('0x1d')](_0x19cc0a));_0x5af9fc[_0x59fc('0x13')]();}};}; \ 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 147f3f4..10f7b91 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 _0x9f63=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','routing','number','validate','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x3ef8be,_0xc5a4f0){var _0x90c201=function(_0x503bbe){while(--_0x503bbe){_0x3ef8be['push'](_0x3ef8be['shift']());}};_0x90c201(++_0xc5a4f0);}(_0x9f63,0x136));var _0x39f6=function(_0x4d4d71,_0x109a6d){_0x4d4d71=_0x4d4d71-0x0;var _0x53c78b=_0x9f63[_0x4d4d71];return _0x53c78b;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0x39f6('0x0'));var gotop=schema({'priority':{'type':_0x39f6('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x2cb081,_0xbfc364){return function(_0x3e579d){try{var _0x1b4f90={'priority':_0xbfc364[0x0]};var _0x56ad02=gotop[_0x39f6('0x2')](_0x1b4f90,{'typecast':!![]});if(_0x56ad02[_0x39f6('0x3')]){logger[_0x39f6('0x4')](_0x39f6('0x5'),_0x2cb081,_[_0x39f6('0x6')](_0x56ad02,'message')[_0x39f6('0x7')](',\x20'));_0x3e579d[_0x39f6('0x8')]();}else{logger[_0x39f6('0x9')](_0x39f6('0xa'),_0x2cb081,_0x1b4f90[_0x39f6('0xb')]);if(_0x1b4f90[_0x39f6('0xb')]){var _0x1d3753=_[_0x39f6('0xc')](_0x3e579d[_0x39f6('0xd')](),{'p':_0x1b4f90[_0x39f6('0xb')]});if(_0x1d3753>=0x0){logger[_0x39f6('0x9')](_0x39f6('0xe'),_0x2cb081,_0x1b4f90[_0x39f6('0xb')]||_0x39f6('0xf'),_0x1d3753);_0x3e579d[_0x39f6('0xf')](_0x1d3753);}else{logger[_0x39f6('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2cb081,_0x1b4f90[_0x39f6('0xb')]||_0x39f6('0xf'));_0x3e579d[_0x39f6('0x8')]();}}else{_0x3e579d[_0x39f6('0xf')]();}}}catch(_0x749662){logger['error'](_0x39f6('0x5'),_0x2cb081,JSON[_0x39f6('0x10')](_0x749662));_0x3e579d[_0x39f6('0x8')]();}};}; \ No newline at end of file +var _0x49d5=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','stringify','validate','lodash'];(function(_0x40b3a2,_0x322292){var _0x5b806a=function(_0x257773){while(--_0x257773){_0x40b3a2['push'](_0x40b3a2['shift']());}};_0x5b806a(++_0x322292);}(_0x49d5,0x139));var _0x549d=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x49d5[_0x2bf141];return _0x48277b;};'use strict';var schema=require(_0x549d('0x0'));var _=require(_0x549d('0x1'));var logger=require(_0x549d('0x2'))(_0x549d('0x3'));var gotop=schema({'priority':{'type':_0x549d('0x4'),'required':!![],'message':_0x549d('0x5')}});exports[_0x549d('0x6')]=function(_0x124c46,_0x35c75c){return function(_0x550388){try{var _0x4fc4d1={'priority':_0x35c75c[0x0]};var _0x16fe00=gotop['validate'](_0x4fc4d1,{'typecast':!![]});if(_0x16fe00[_0x549d('0x7')]){logger[_0x549d('0x8')](_0x549d('0x9'),_0x124c46,_['map'](_0x16fe00,_0x549d('0xa'))[_0x549d('0xb')](',\x20'));_0x550388['stop']();}else{logger[_0x549d('0xc')](_0x549d('0xd'),_0x124c46,_0x4fc4d1[_0x549d('0xe')]);if(_0x4fc4d1[_0x549d('0xe')]){var _0x3482dd=_[_0x549d('0xf')](_0x550388[_0x549d('0x10')](),{'p':_0x4fc4d1[_0x549d('0xe')]});if(_0x3482dd>=0x0){logger[_0x549d('0xc')](_0x549d('0x11'),_0x124c46,_0x4fc4d1['priority']||'next',_0x3482dd);_0x550388[_0x549d('0x12')](_0x3482dd);}else{logger[_0x549d('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x124c46,_0x4fc4d1[_0x549d('0xe')]||_0x549d('0x12'));_0x550388[_0x549d('0x13')]();}}else{_0x550388[_0x549d('0x12')]();}}}catch(_0x375bc1){logger[_0x549d('0x8')](_0x549d('0x9'),_0x124c46,JSON[_0x549d('0x14')](_0x375bc1));_0x550388[_0x549d('0x13')]();}};}; \ 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 64f3b40..a3daf7e 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 _0x2eab=['next','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','interaction','Message','create','info','[%s][MESSAGE]\x20%s'];(function(_0x4d1f0a,_0x574e6d){var _0x5b2549=function(_0x46cae6){while(--_0x46cae6){_0x4d1f0a['push'](_0x4d1f0a['shift']());}};_0x5b2549(++_0x574e6d);}(_0x2eab,0x8d));var _0xb2ea=function(_0x2b4fdd,_0x163a9e){_0x2b4fdd=_0x2b4fdd-0x0;var _0x3d5662=_0x2eab[_0x2b4fdd];return _0x3d5662;};'use strict';var _=require(_0xb2ea('0x0'));var utils=require(_0xb2ea('0x1'));var logger=require(_0xb2ea('0x2'))(_0xb2ea('0x3'));var rpc={'chatMessage':require(_0xb2ea('0x4')),'openchannelMessage':require(_0xb2ea('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb2ea('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb2ea('0x7'))};exports['consequence']=function(_0x58c654,_0x117496){return function(_0x3a6c1e){try{var _0x7f4b31={'body':utils['getMustacheRender'](_0x117496[0x0],this),'ContactId':this[_0xb2ea('0x8')]['id']};if(this[_0xb2ea('0x9')]===_0xb2ea('0xa')){_0x7f4b31[_0xb2ea('0xb')]=this[_0xb2ea('0xc')]['id'];}else{_0x7f4b31[_['upperFirst'](this[_0xb2ea('0x9')])+_0xb2ea('0xd')]=this[_0xb2ea('0xc')]['id'];}_0x7f4b31[_[_0xb2ea('0xe')](this[_0xb2ea('0x9')])+'InteractionId']=this[_0xb2ea('0xf')]['id'];if(rpc[this['channel']+_0xb2ea('0x10')]){return rpc[this[_0xb2ea('0x9')]+_0xb2ea('0x10')][_0xb2ea('0x11')](_0x7f4b31)['then'](function(_0x4cdbef){logger[_0xb2ea('0x12')](_0xb2ea('0x13'),_0x58c654,_0x7f4b31['body']);_0x3a6c1e[_0xb2ea('0x14')]();})['catch'](function(_0x16ab10){logger[_0xb2ea('0x15')](_0xb2ea('0x13'),_0x58c654,JSON['stringify'](_0x16ab10));_0x3a6c1e[_0xb2ea('0x16')]();});}}catch(_0x24f3f0){logger[_0xb2ea('0x15')](_0xb2ea('0x13'),_0x58c654,JSON['stringify'](_0x24f3f0));_0x3a6c1e[_0xb2ea('0x16')]();}};}; \ No newline at end of file +var _0xe486=['stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error'];(function(_0xf3ed87,_0x3a7cee){var _0x57edb8=function(_0x518aa1){while(--_0x518aa1){_0xf3ed87['push'](_0xf3ed87['shift']());}};_0x57edb8(++_0x3a7cee);}(_0xe486,0x6a));var _0x6e48=function(_0x488982,_0x3e260c){_0x488982=_0x488982-0x0;var _0xfe389c=_0xe486[_0x488982];return _0xfe389c;};'use strict';var _=require(_0x6e48('0x0'));var utils=require(_0x6e48('0x1'));var logger=require(_0x6e48('0x2'))(_0x6e48('0x3'));var rpc={'chatMessage':require(_0x6e48('0x4')),'openchannelMessage':require(_0x6e48('0x5')),'mailMessage':require(_0x6e48('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6e48('0x7'))};exports[_0x6e48('0x8')]=function(_0x41f4e4,_0x404e2f){return function(_0x5e77f1){try{var _0x1ea941={'body':utils[_0x6e48('0x9')](_0x404e2f[0x0],this),'ContactId':this[_0x6e48('0xa')]['id']};if(this[_0x6e48('0xb')]===_0x6e48('0xc')){_0x1ea941['ChatWebsiteId']=this[_0x6e48('0xd')]['id'];}else{_0x1ea941[_['upperFirst'](this[_0x6e48('0xb')])+'AccountId']=this[_0x6e48('0xd')]['id'];}_0x1ea941[_[_0x6e48('0xe')](this[_0x6e48('0xb')])+_0x6e48('0xf')]=this['interaction']['id'];if(rpc[this[_0x6e48('0xb')]+'Message']){return rpc[this['channel']+_0x6e48('0x10')][_0x6e48('0x11')](_0x1ea941)[_0x6e48('0x12')](function(_0x199cbe){logger['info'](_0x6e48('0x13'),_0x41f4e4,_0x1ea941[_0x6e48('0x14')]);_0x5e77f1[_0x6e48('0x15')]();})[_0x6e48('0x16')](function(_0x272a24){logger[_0x6e48('0x17')](_0x6e48('0x13'),_0x41f4e4,JSON[_0x6e48('0x18')](_0x272a24));_0x5e77f1[_0x6e48('0x19')]();});}}catch(_0x48c10c){logger[_0x6e48('0x17')](_0x6e48('0x13'),_0x41f4e4,JSON[_0x6e48('0x18')](_0x48c10c));_0x5e77f1[_0x6e48('0x19')]();}};}; \ 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 791ec72..572be90 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 _0x9d8e=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x42f6d1,_0x52c740){var _0x50ae08=function(_0x419bf5){while(--_0x419bf5){_0x42f6d1['push'](_0x42f6d1['shift']());}};_0x50ae08(++_0x52c740);}(_0x9d8e,0x1a9));var _0xe9d8=function(_0x236793,_0xd5f76c){_0x236793=_0x236793-0x0;var _0xca269a=_0x9d8e[_0x236793];return _0xca269a;};'use strict';var utils=require(_0xe9d8('0x0'));var logger=require(_0xe9d8('0x1'))(_0xe9d8('0x2'));exports[_0xe9d8('0x3')]=function(_0xce22e2,_0x501b41){return function(_0x27c37c){try{logger['info'](_0xe9d8('0x4'),_0xce22e2,utils[_0xe9d8('0x5')](_0x501b41[0x0],this));_0x27c37c[_0xe9d8('0x6')]();}catch(_0x3afddc){logger[_0xe9d8('0x7')](_0xe9d8('0x4'),_0xce22e2,JSON[_0xe9d8('0x8')](_0x3afddc));_0x27c37c[_0xe9d8('0x9')]();}};}; \ No newline at end of file +var _0xaeb1=['next','error','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x1e9af2,_0x35b088){var _0x2b6fa0=function(_0x17fa06){while(--_0x17fa06){_0x1e9af2['push'](_0x1e9af2['shift']());}};_0x2b6fa0(++_0x35b088);}(_0xaeb1,0x1de));var _0x1aeb=function(_0x274bf1,_0x374cb8){_0x274bf1=_0x274bf1-0x0;var _0x47a58d=_0xaeb1[_0x274bf1];return _0x47a58d;};'use strict';var utils=require(_0x1aeb('0x0'));var logger=require('../../../../config/logger')(_0x1aeb('0x1'));exports[_0x1aeb('0x2')]=function(_0x39364f,_0x5ad773){return function(_0x4d1dba){try{logger[_0x1aeb('0x3')](_0x1aeb('0x4'),_0x39364f,utils['getMustacheRender'](_0x5ad773[0x0],this));_0x4d1dba[_0x1aeb('0x5')]();}catch(_0x276c9b){logger[_0x1aeb('0x6')](_0x1aeb('0x4'),_0x39364f,JSON['stringify'](_0x276c9b));_0x4d1dba['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 df901ba..ad5b9ac 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 _0x5c5d=['waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','moment','routing','./strategy','redis','queue_id','joinAt','emit','clone','queue','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','timeout\x20is\x20a\x20number'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0x5c5d,0x1e4));var _0xd5c5=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x5c5d[_0x5bd426];return _0x23a7eb;};'use strict';var schema=require(_0xd5c5('0x0'));var _=require('lodash');var util=require(_0xd5c5('0x1'));var seqqueue=require(_0xd5c5('0x2'));var moment=require(_0xd5c5('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd5c5('0x4'));var strategy=require(_0xd5c5('0x5'));config[_0xd5c5('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd5c5('0x6')]));var attributes=['id',_0xd5c5('0x7'),'account','queue','from',_0xd5c5('0x8')];function emit(_0x3cc3cd,_0x183186,_0x8ae3f9){io['to'](_0x3cc3cd)[_0xd5c5('0x9')](_0x183186,_0x8ae3f9);}function emitChannelQueueInteraction(_0x3486b0,_0x2e2108,_0x447db0,_0x5f00c3,_0x47885b,_0x3ed3df,_0x1091da,_0x3697ed){var _0x16e32d=_[_0xd5c5('0xa')](_0x447db0);_0x16e32d[_0xd5c5('0x7')]=_0x3697ed;_0x16e32d[_0xd5c5('0xb')]=_0x2e2108;_0x16e32d[_0xd5c5('0xc')]=_0x5f00c3;_0x16e32d['id']=_0x47885b;if(_0x3ed3df){attributes[_0xd5c5('0xd')](_[_0xd5c5('0xe')](_0x3486b0)+_0xd5c5('0xf'));_0x1091da[util[_0xd5c5('0x10')](_0xd5c5('0x11'),_0x3486b0)][_0x47885b]=_['pick'](_0x16e32d,attributes);}else{delete _0x1091da[util[_0xd5c5('0x10')](_0xd5c5('0x11'),_0x3486b0)][_0x47885b];}emit(util[_0xd5c5('0x10')](_0xd5c5('0x12'),_0x3486b0,_0x2e2108),util[_0xd5c5('0x10')](_0xd5c5('0x13'),_0x3486b0,_0x3ed3df?_0xd5c5('0x14'):_0xd5c5('0x15')),_[_0xd5c5('0x16')](_0x16e32d,attributes));}var rpc={'openchannelQueueReport':require(_0xd5c5('0x17')),'mailQueueReport':require(_0xd5c5('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xd5c5('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xd5c5('0x1a')}});function startRouting(_0x32737e,_0x2e13f6,_0x1fa1a5,_0x341b9b){if(_0x32737e&&_0x2e13f6&&_0x1fa1a5){_0x2e13f6[_0xd5c5('0x1b')]+=0x1;var _0x56db52={'uniqueid':_0x32737e,'from':_0x1fa1a5['body']?_0x1fa1a5[_0xd5c5('0x1c')][_0xd5c5('0x1d')]:'','joinAt':moment()['format'](_0xd5c5('0x1e')),'ContactId':_0x1fa1a5[_0xd5c5('0x1f')]?_0x1fa1a5['contact']['id']:null,'ListId':_0x1fa1a5[_0xd5c5('0x20')]?_0x1fa1a5[_0xd5c5('0x20')]['id']:null};_0x56db52[_['upperFirst'](_0x1fa1a5[_0xd5c5('0x21')])+_0xd5c5('0x22')]=_0x2e13f6['id']||null;_0x56db52[_[_0xd5c5('0x23')](_0x1fa1a5['channel'])+_0xd5c5('0xf')]=_0x1fa1a5['interaction']?_0x1fa1a5[_0xd5c5('0x24')]['id']:null;_0x56db52[_[_0xd5c5('0x23')](_0x1fa1a5[_0xd5c5('0x21')])+_0xd5c5('0x25')]=_0x1fa1a5[_0xd5c5('0x26')]?_0x1fa1a5['message']['id']:null;_0x56db52[_['upperFirst'](_0x1fa1a5[_0xd5c5('0x21')])+(_0x1fa1a5[_0xd5c5('0x21')]!=='chat'?'AccountId':_0xd5c5('0x27'))]=_0x1fa1a5[_0xd5c5('0xc')]?_0x1fa1a5[_0xd5c5('0xc')]['id']:null;logger['info'](util[_0xd5c5('0x10')](_0xd5c5('0x28'),_0x32737e,_0x2e13f6[_0xd5c5('0x29')]));emitChannelQueueInteraction(_0x1fa1a5['channel'],_0x2e13f6[_0xd5c5('0x29')],_0x56db52,_0x1fa1a5[_0xd5c5('0xc')]['name'],_0x1fa1a5['message']['id'],!![],_0x341b9b,_0x2e13f6['id']);if(rpc[_0x1fa1a5['channel']+_0xd5c5('0x2a')]){return rpc[_0x1fa1a5[_0xd5c5('0x21')]+_0xd5c5('0x2a')][_0xd5c5('0x2b')](_0x56db52)[_0xd5c5('0x2c')](function(_0x2d4665){logger[_0xd5c5('0x2d')](_0xd5c5('0x2e'));});}}}function stopRouting(_0x5b41e2,_0xf57a73,_0x1f5064,_0x23b18b){if(_0x5b41e2&&_0xf57a73){_0xf57a73[_0xd5c5('0x1b')]-=0x1;var _0x22a57e={'leaveAt':moment()[_0xd5c5('0x10')](_0xd5c5('0x1e')),'acceptAt':moment()[_0xd5c5('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd5c5('0x2f')};logger[_0xd5c5('0x30')](util[_0xd5c5('0x10')](_0xd5c5('0x31'),_0x5b41e2,_0xf57a73[_0xd5c5('0x29')]));emitChannelQueueInteraction(_0x1f5064['channel'],_0xf57a73[_0xd5c5('0x29')],_0x1f5064[_0xd5c5('0x1c')],_0x1f5064[_0xd5c5('0xc')][_0xd5c5('0x29')],_0x1f5064[_0xd5c5('0x26')]['id'],![],_0x23b18b,_0xf57a73['id']);if(rpc[_0x1f5064['channel']+'QueueReport']){return rpc[_0x1f5064['channel']+'QueueReport'][_0xd5c5('0x32')](_0x5b41e2,_0x22a57e)[_0xd5c5('0x2c')](function(_0xe0307c){logger['error'](_0xd5c5('0x33'));});}}}function endRouting(_0x25fcc2,_0x4c0cd9,_0x1f7eb3,_0x320fef){if(_0x25fcc2&&_0x4c0cd9){_0x4c0cd9[_0xd5c5('0x1b')]-=0x1;var _0x5528b2={'leaveAt':moment()[_0xd5c5('0x10')](_0xd5c5('0x1e')),'exitAt':moment()[_0xd5c5('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd5c5('0x34')};logger[_0xd5c5('0x30')](util[_0xd5c5('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x25fcc2,_0x4c0cd9[_0xd5c5('0x29')]));emitChannelQueueInteraction(_0x1f7eb3['channel'],_0x4c0cd9[_0xd5c5('0x29')],_0x1f7eb3[_0xd5c5('0x1c')],_0x1f7eb3[_0xd5c5('0xc')][_0xd5c5('0x29')],_0x1f7eb3['message']['id'],![],_0x320fef);if(rpc[_0x1f7eb3[_0xd5c5('0x21')]+'QueueReport']){return rpc[_0x1f7eb3['channel']+'QueueReport'][_0xd5c5('0x32')](_0x25fcc2,_0x5528b2)['catch'](function(_0x545174){logger[_0xd5c5('0x2d')](_0xd5c5('0x33'));});}}}function handleFindQueue(_0x272fdd){return function(_0x27b7b8){return _0x27b7b8[_0xd5c5('0x29')][_0xd5c5('0x35')]()===_0x272fdd[_0xd5c5('0x35')]();};}exports[_0xd5c5('0x36')]=function(_0x534ac4,_0x2d5c5c,_0x27c9ae,_0x2e25e7){return function(_0x3aee35){try{var _0x387bc6={'name':_0x2d5c5c[0x0],'timeout':_0x2d5c5c[0x1]};var _0x3c7de8=queue[_0xd5c5('0x0')](_0x387bc6,{'typecast':!![]});if(_0x3c7de8['length']){logger[_0xd5c5('0x2d')](_0xd5c5('0x37'),_0x534ac4,_[_0xd5c5('0x38')](_0x3c7de8,'message')[_0xd5c5('0x39')](',\x20'));_0x3aee35[_0xd5c5('0x3a')]();}else{var _0x3e6fe0=_[_0xd5c5('0x3b')](_0x27c9ae[_0x2e25e7[_0xd5c5('0x21')]+_0xd5c5('0x3c')],handleFindQueue(_0x387bc6[_0xd5c5('0x29')]));if(_0x3e6fe0){startRouting(_0x534ac4,_0x3e6fe0,_0x2e25e7,_0x27c9ae);var _0x3d4d86=(_0x3e6fe0[_0xd5c5('0x34')]||0xa)*0x3e8;var _0x37f6e3=(_0x387bc6['timeout']||0x14)*0x3e8;var _0x4402e8;if(_0x3d4d86>_0x37f6e3){_0x37f6e3=_0x3d4d86;}var _0x3a2667=seqqueue['createQueue'](_0x3d4d86);_0x3a2667['id']=_0x534ac4;_0x3a2667[_0xd5c5('0x3d')]=_0x3d4d86;_0x3a2667[_0xd5c5('0x3e')]=_0x37f6e3;_0x3a2667[_0xd5c5('0x21')]=_0x2e25e7[_0xd5c5('0x21')];_0x27c9ae[_0xd5c5('0x3f')][_0x534ac4]['on'](_0xd5c5('0x40'),function(){logger[_0xd5c5('0x30')](_0xd5c5('0x41'),_0x534ac4);stopRouting(_0x534ac4,_0x3e6fe0,_0x2e25e7,_0x27c9ae);clearTimeout(_0x4402e8);_0x4402e8=undefined;_0x3a2667[_0xd5c5('0x42')](!![]);if(_0x27c9ae[_0xd5c5('0x3f')][_0x534ac4]){delete _0x27c9ae[_0xd5c5('0x3f')][_0x534ac4];}_0x3aee35[_0xd5c5('0x3a')]();});_0x27c9ae[_0xd5c5('0x3f')][_0x534ac4]['on'](_0xd5c5('0x43'),function(){if(_0x27c9ae['rules'][_0x534ac4]){delete _0x27c9ae[_0xd5c5('0x3f')][_0x534ac4];}});_0x4402e8=setTimeout(function(){logger[_0xd5c5('0x30')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x534ac4);endRouting(_0x534ac4,_0x3e6fe0,_0x2e25e7,_0x27c9ae);clearTimeout(_0x4402e8);_0x3a2667[_0xd5c5('0x42')](!![]);_0x3aee35['next']();},_0x37f6e3);switch(_0x3e6fe0['strategy']){case _0xd5c5('0x44'):strategy[_0xd5c5('0x44')](_0x3a2667,_0x3e6fe0,_0x27c9ae,_0x2e25e7);break;default:strategy[_0xd5c5('0x45')](_0x3a2667,_0x3e6fe0,_0x27c9ae,_0x2e25e7);}}else{logger[_0xd5c5('0x2d')](_0xd5c5('0x46'),_0x534ac4,_0x387bc6['name']);_0x3aee35[_0xd5c5('0x3a')]();}}}catch(_0x59e7fd){console[_0xd5c5('0x47')](_0x59e7fd);logger['error'](_0xd5c5('0x37'),_0x534ac4,_0x59e7fd[_0xd5c5('0x48')]);_0x3aee35[_0xd5c5('0x3a')]();}};}; \ No newline at end of file +var _0x4d7a=['update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','Queues','timeout','atimeout','qtimeout','rules','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','from','joinAt','emit','queue_id','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','YYYY-MM-DD\x20HH:mm:ss','accepted','error','[%s][END:QUEUE][NAME:%s]'];(function(_0x3a548b,_0xcccc77){var _0x311ea5=function(_0xc45d66){while(--_0xc45d66){_0x3a548b['push'](_0x3a548b['shift']());}};_0x311ea5(++_0xcccc77);}(_0x4d7a,0x1a0));var _0xa4d7=function(_0x53d004,_0x1edeea){_0x53d004=_0x53d004-0x0;var _0x272a77=_0x4d7a[_0x53d004];return _0x272a77;};'use strict';var schema=require(_0xa4d7('0x0'));var _=require(_0xa4d7('0x1'));var util=require(_0xa4d7('0x2'));var seqqueue=require(_0xa4d7('0x3'));var moment=require(_0xa4d7('0x4'));var Redis=require(_0xa4d7('0x5'));var config=require(_0xa4d7('0x6'));var logger=require(_0xa4d7('0x7'))(_0xa4d7('0x8'));var strategy=require('./strategy');config[_0xa4d7('0x9')]=_[_0xa4d7('0xa')](config[_0xa4d7('0x9')],{'host':_0xa4d7('0xb'),'port':0x18eb});var io=require(_0xa4d7('0xc'))(new Redis(config[_0xa4d7('0x9')]));var attributes=['id','queue_id',_0xa4d7('0xd'),_0xa4d7('0xe'),_0xa4d7('0xf'),_0xa4d7('0x10')];function emit(_0x42317f,_0x477d79,_0xfd2567){io['to'](_0x42317f)[_0xa4d7('0x11')](_0x477d79,_0xfd2567);}function emitChannelQueueInteraction(_0x28d106,_0x2ba92f,_0x1d87c8,_0x51cefe,_0x34cbb1,_0x4c3ba6,_0x245145,_0xb5a5a4){var _0x18b0de=_['clone'](_0x1d87c8);_0x18b0de[_0xa4d7('0x12')]=_0xb5a5a4;_0x18b0de[_0xa4d7('0xe')]=_0x2ba92f;_0x18b0de[_0xa4d7('0xd')]=_0x51cefe;_0x18b0de['id']=_0x34cbb1;if(_0x4c3ba6){attributes[_0xa4d7('0x13')](_[_0xa4d7('0x14')](_0x28d106)+_0xa4d7('0x15'));_0x245145[util[_0xa4d7('0x16')](_0xa4d7('0x17'),_0x28d106)][_0x34cbb1]=_[_0xa4d7('0x18')](_0x18b0de,attributes);}else{delete _0x245145[util[_0xa4d7('0x16')](_0xa4d7('0x17'),_0x28d106)][_0x34cbb1];}emit(util[_0xa4d7('0x16')](_0xa4d7('0x19'),_0x28d106,_0x2ba92f),util[_0xa4d7('0x16')](_0xa4d7('0x1a'),_0x28d106,_0x4c3ba6?_0xa4d7('0x1b'):_0xa4d7('0x1c')),_['pick'](_0x18b0de,attributes));}var rpc={'openchannelQueueReport':require(_0xa4d7('0x1d')),'mailQueueReport':require(_0xa4d7('0x1e')),'chatQueueReport':require(_0xa4d7('0x1f')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xa4d7('0x20')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa4d7('0x21'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xa4d7('0x22')}});function startRouting(_0x6d71ac,_0xf1cab4,_0x4f968a,_0x1e183e){if(_0x6d71ac&&_0xf1cab4&&_0x4f968a){_0xf1cab4[_0xa4d7('0x23')]+=0x1;var _0x8e04cd={'uniqueid':_0x6d71ac,'from':_0x4f968a[_0xa4d7('0x24')]?_0x4f968a['body'][_0xa4d7('0xf')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f968a[_0xa4d7('0x25')]?_0x4f968a[_0xa4d7('0x25')]['id']:null,'ListId':_0x4f968a[_0xa4d7('0x26')]?_0x4f968a['list']['id']:null};_0x8e04cd[_[_0xa4d7('0x27')](_0x4f968a[_0xa4d7('0x28')])+_0xa4d7('0x29')]=_0xf1cab4['id']||null;_0x8e04cd[_['upperFirst'](_0x4f968a[_0xa4d7('0x28')])+_0xa4d7('0x15')]=_0x4f968a[_0xa4d7('0x2a')]?_0x4f968a['interaction']['id']:null;_0x8e04cd[_['upperFirst'](_0x4f968a['channel'])+_0xa4d7('0x2b')]=_0x4f968a[_0xa4d7('0x2c')]?_0x4f968a[_0xa4d7('0x2c')]['id']:null;_0x8e04cd[_[_0xa4d7('0x27')](_0x4f968a['channel'])+(_0x4f968a['channel']!==_0xa4d7('0x2d')?_0xa4d7('0x2e'):_0xa4d7('0x2f'))]=_0x4f968a['account']?_0x4f968a[_0xa4d7('0xd')]['id']:null;logger[_0xa4d7('0x30')](util[_0xa4d7('0x16')](_0xa4d7('0x31'),_0x6d71ac,_0xf1cab4[_0xa4d7('0x32')]));emitChannelQueueInteraction(_0x4f968a[_0xa4d7('0x28')],_0xf1cab4[_0xa4d7('0x32')],_0x8e04cd,_0x4f968a['account'][_0xa4d7('0x32')],_0x4f968a['message']['id'],!![],_0x1e183e,_0xf1cab4['id']);if(rpc[_0x4f968a[_0xa4d7('0x28')]+_0xa4d7('0x33')]){return rpc[_0x4f968a[_0xa4d7('0x28')]+_0xa4d7('0x33')][_0xa4d7('0x34')](_0x8e04cd)[_0xa4d7('0x35')](function(_0x36ed2a){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x442932,_0x57a6dd,_0x5e7262,_0x575e11){if(_0x442932&&_0x57a6dd){_0x57a6dd[_0xa4d7('0x23')]-=0x1;var _0x2dc35f={'leaveAt':moment()[_0xa4d7('0x16')](_0xa4d7('0x36')),'acceptAt':moment()[_0xa4d7('0x16')](_0xa4d7('0x36')),'reason':_0xa4d7('0x37')};logger[_0xa4d7('0x30')](util[_0xa4d7('0x16')]('[%s][STOP:QUEUE][NAME:%s]',_0x442932,_0x57a6dd[_0xa4d7('0x32')]));emitChannelQueueInteraction(_0x5e7262[_0xa4d7('0x28')],_0x57a6dd[_0xa4d7('0x32')],_0x5e7262[_0xa4d7('0x24')],_0x5e7262[_0xa4d7('0xd')][_0xa4d7('0x32')],_0x5e7262[_0xa4d7('0x2c')]['id'],![],_0x575e11,_0x57a6dd['id']);if(rpc[_0x5e7262[_0xa4d7('0x28')]+_0xa4d7('0x33')]){return rpc[_0x5e7262['channel']+'QueueReport']['update'](_0x442932,_0x2dc35f)['catch'](function(_0x34f087){logger[_0xa4d7('0x38')]('update\x20queue\x20report');});}}}function endRouting(_0x4d7bcc,_0x1ea58b,_0x3597f4,_0x230aef){if(_0x4d7bcc&&_0x1ea58b){_0x1ea58b[_0xa4d7('0x23')]-=0x1;var _0x165622={'leaveAt':moment()['format'](_0xa4d7('0x36')),'exitAt':moment()[_0xa4d7('0x16')](_0xa4d7('0x36')),'reason':'timeout'};logger[_0xa4d7('0x30')](util[_0xa4d7('0x16')](_0xa4d7('0x39'),_0x4d7bcc,_0x1ea58b[_0xa4d7('0x32')]));emitChannelQueueInteraction(_0x3597f4['channel'],_0x1ea58b[_0xa4d7('0x32')],_0x3597f4[_0xa4d7('0x24')],_0x3597f4[_0xa4d7('0xd')]['name'],_0x3597f4['message']['id'],![],_0x230aef);if(rpc[_0x3597f4[_0xa4d7('0x28')]+'QueueReport']){return rpc[_0x3597f4['channel']+_0xa4d7('0x33')][_0xa4d7('0x3a')](_0x4d7bcc,_0x165622)[_0xa4d7('0x35')](function(_0x5e31c4){logger[_0xa4d7('0x38')](_0xa4d7('0x3b'));});}}}function handleFindQueue(_0x9ae685){return function(_0x1d2273){return _0x1d2273['name'][_0xa4d7('0x3c')]()===_0x9ae685['toLowerCase']();};}exports[_0xa4d7('0x3d')]=function(_0x1b6cd0,_0xf15140,_0x1d9b1b,_0xb977){return function(_0x15602e){try{var _0x2b8486={'name':_0xf15140[0x0],'timeout':_0xf15140[0x1]};var _0x118079=queue[_0xa4d7('0x0')](_0x2b8486,{'typecast':!![]});if(_0x118079[_0xa4d7('0x3e')]){logger[_0xa4d7('0x38')](_0xa4d7('0x3f'),_0x1b6cd0,_['map'](_0x118079,_0xa4d7('0x2c'))[_0xa4d7('0x40')](',\x20'));_0x15602e[_0xa4d7('0x41')]();}else{var _0x3c185a=_['find'](_0x1d9b1b[_0xb977[_0xa4d7('0x28')]+_0xa4d7('0x42')],handleFindQueue(_0x2b8486['name']));if(_0x3c185a){startRouting(_0x1b6cd0,_0x3c185a,_0xb977,_0x1d9b1b);var _0x438177=(_0x3c185a[_0xa4d7('0x43')]||0xa)*0x3e8;var _0x56444b=(_0x2b8486['timeout']||0x14)*0x3e8;var _0x319754;if(_0x438177>_0x56444b){_0x56444b=_0x438177;}var _0x838a3f=seqqueue['createQueue'](_0x438177);_0x838a3f['id']=_0x1b6cd0;_0x838a3f[_0xa4d7('0x44')]=_0x438177;_0x838a3f[_0xa4d7('0x45')]=_0x56444b;_0x838a3f[_0xa4d7('0x28')]=_0xb977[_0xa4d7('0x28')];_0x1d9b1b['rules'][_0x1b6cd0]['on']('end',function(){logger[_0xa4d7('0x30')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x1b6cd0);stopRouting(_0x1b6cd0,_0x3c185a,_0xb977,_0x1d9b1b);clearTimeout(_0x319754);_0x319754=undefined;_0x838a3f['close'](!![]);if(_0x1d9b1b['rules'][_0x1b6cd0]){delete _0x1d9b1b[_0xa4d7('0x46')][_0x1b6cd0];}_0x15602e[_0xa4d7('0x41')]();});_0x1d9b1b[_0xa4d7('0x46')][_0x1b6cd0]['on']('complete',function(){if(_0x1d9b1b['rules'][_0x1b6cd0]){delete _0x1d9b1b[_0xa4d7('0x46')][_0x1b6cd0];}});_0x319754=setTimeout(function(){logger['info'](_0xa4d7('0x47'),_0x1b6cd0);endRouting(_0x1b6cd0,_0x3c185a,_0xb977,_0x1d9b1b);clearTimeout(_0x319754);_0x838a3f[_0xa4d7('0x48')](!![]);_0x15602e[_0xa4d7('0x49')]();},_0x56444b);switch(_0x3c185a['strategy']){case _0xa4d7('0x4a'):strategy[_0xa4d7('0x4a')](_0x838a3f,_0x3c185a,_0x1d9b1b,_0xb977);break;default:strategy[_0xa4d7('0x4b')](_0x838a3f,_0x3c185a,_0x1d9b1b,_0xb977);}}else{logger['error'](_0xa4d7('0x4c'),_0x1b6cd0,_0x2b8486[_0xa4d7('0x32')]);_0x15602e['stop']();}}}catch(_0x326d6d){console[_0xa4d7('0x4d')](_0x326d6d);logger['error'](_0xa4d7('0x3f'),_0x1b6cd0,_0x326d6d[_0xa4d7('0x4e')]);_0x15602e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index e8593f2..f54e5c5 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 _0x0ba7=['handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push'];(function(_0x38f073,_0x2b5306){var _0x1b0201=function(_0x32a6d8){while(--_0x32a6d8){_0x38f073['push'](_0x38f073['shift']());}};_0x1b0201(++_0x2b5306);}(_0x0ba7,0x16d));var _0x70ba=function(_0x396c7a,_0x12f2e1){_0x396c7a=_0x396c7a-0x0;var _0x13b803=_0x0ba7[_0x396c7a];return _0x13b803;};'use strict';var _=require(_0x70ba('0x0'));var uuid=require('uuid');var util=require(_0x70ba('0x1'));var logger=require(_0x70ba('0x2'))(_0x70ba('0x3'));var Agent=function(_0x42d93c,_0x5e5368,_0x319ca9,_0x3e20ab){this[_0x70ba('0x4')]=uuid['v4']();this[_0x70ba('0x5')]=_0x42d93c;this[_0x70ba('0x6')]=_0x5e5368;this[_0x70ba('0x7')]=_0x319ca9;this[_0x70ba('0x3')]=_0x3e20ab;this[_0x70ba('0x5')][_0x70ba('0x8')](this[_0x70ba('0x9')][_0x70ba('0xa')](this),this[_0x70ba('0xb')][_0x70ba('0xa')](this));this[_0x70ba('0x5')]['on'](_0x70ba('0xc'),this['handleTimeout'][_0x70ba('0xa')](this));this['squeue']['on'](_0x70ba('0xd'),this[_0x70ba('0xe')][_0x70ba('0xa')](this));};Agent[_0x70ba('0xf')]['push']=function(){this['squeue'][_0x70ba('0x8')](this['handleRun'][_0x70ba('0xa')](this),this['handleTimeout'][_0x70ba('0xa')](this));};Agent[_0x70ba('0xf')]['handleDrained']=function(){this[_0x70ba('0xb')](!![]);};Agent['prototype'][_0x70ba('0x9')]=function(){logger[_0x70ba('0x10')](_0x70ba('0x11'),this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);if(_[_0x70ba('0x12')](this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']])){logger[_0x70ba('0x10')](_0x70ba('0x14'),this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);setTimeout(this[_0x70ba('0x8')]['bind'](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x70ba('0x15')](this[_0x70ba('0x5')]['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']],this[_0x70ba('0x5')][_0x70ba('0x16')],![])){this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']][_0x70ba('0x17')]=!![];this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']][_0x70ba('0x18')]=undefined;util['saveWaitingNotification'](this[_0x70ba('0x7')],this[_0x70ba('0x3')],this['agent'],this[_0x70ba('0x5')]['channel']);util['showNotification'](this[_0x70ba('0x4')],this['squeue']['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this['agent']['id']],null,this[_0x70ba('0x3')]);util['writeLog'](this['squeue']['id'],this[_0x70ba('0x7')]['agents'][this[_0x70ba('0x6')]['id']],_0x70ba('0x19')+(this[_0x70ba('0x3')][_0x70ba('0x1a')]?_0x70ba('0x1b'):''));}else{logger[_0x70ba('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);setTimeout(this[_0x70ba('0x8')]['bind'](this),0x3e8);}}};Agent[_0x70ba('0xf')]['handleTimeout']=function(_0x5955dc){if(_['isNil'](this[_0x70ba('0x7')][_0x70ba('0x13')][this['agent']['id']])){return logger['debug'](_0x70ba('0x14'),this['squeue']['id'],this[_0x70ba('0x6')]['id']);}else{logger[_0x70ba('0x10')](_0x70ba('0x1c'),this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);util[_0x70ba('0x1d')](this[_0x70ba('0x4')],this[_0x70ba('0x5')]['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']],null,this['routing']);this['realtime'][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']][_0x70ba('0x17')]=![];this['realtime']['agents'][this['agent']['id']][_0x70ba('0x18')]=undefined;util[_0x70ba('0x1e')](this[_0x70ba('0x7')],this['routing'],this[_0x70ba('0x6')],this['squeue']['channel']);util[_0x70ba('0x1f')](this['squeue']['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this['agent']['id']],_0x5955dc?_0x70ba('0x20'):_0x70ba('0x21'));}if(!_0x5955dc){setTimeout(this[_0x70ba('0x8')]['bind'](this),0x3e8);}};function agent(_0x1402b2,_0x20c3fd,_0xbb0c72,_0x75fbbe){return new Agent(_0x1402b2,_0x20c3fd,_0xbb0c72,_0x75fbbe);}module['exports']=agent; \ No newline at end of file +var _0x4b84=['hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','routing','notificationId','push','bind','squeue','timeout','handleTimeout','drained','handleDrained','prototype','handleRun','agent','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','debug','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x1cc41e,_0x3053cc){var _0x1f3d14=function(_0x18c494){while(--_0x18c494){_0x1cc41e['push'](_0x1cc41e['shift']());}};_0x1f3d14(++_0x3053cc);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0x4b84[_0x3c5e54];return _0x3ae1f3;};'use strict';var _=require(_0x44b8('0x0'));var uuid=require(_0x44b8('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x44b8('0x2'));var Agent=function(_0x519db3,_0x4b8ad8,_0x3b26c7,_0x31282a){this[_0x44b8('0x3')]=uuid['v4']();this['squeue']=_0x519db3;this['agent']=_0x4b8ad8;this['realtime']=_0x3b26c7;this[_0x44b8('0x2')]=_0x31282a;this['squeue'][_0x44b8('0x4')](this['handleRun'][_0x44b8('0x5')](this),this['handleTimeout']['bind'](this));this[_0x44b8('0x6')]['on'](_0x44b8('0x7'),this[_0x44b8('0x8')]['bind'](this));this[_0x44b8('0x6')]['on'](_0x44b8('0x9'),this[_0x44b8('0xa')][_0x44b8('0x5')](this));};Agent[_0x44b8('0xb')][_0x44b8('0x4')]=function(){this[_0x44b8('0x6')]['push'](this[_0x44b8('0xc')][_0x44b8('0x5')](this),this['handleTimeout'][_0x44b8('0x5')](this));};Agent['prototype'][_0x44b8('0xa')]=function(){this[_0x44b8('0x8')](!![]);};Agent['prototype'][_0x44b8('0xc')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x44b8('0x6')]['id'],this[_0x44b8('0xd')]['id']);if(_[_0x44b8('0xe')](this[_0x44b8('0xf')]['agents'][this['agent']['id']])){logger['debug'](_0x44b8('0x10'),this['squeue']['id'],this[_0x44b8('0xd')]['id']);setTimeout(this[_0x44b8('0x4')]['bind'](this),0x3e8);}else{if(this[_0x44b8('0x2')][_0x44b8('0x11')]||util['isAgentAvailable'](this[_0x44b8('0x6')]['id'],this[_0x44b8('0xf')]['agents'][this[_0x44b8('0xd')]['id']],this[_0x44b8('0x6')][_0x44b8('0x12')],![])){this[_0x44b8('0xf')][_0x44b8('0x13')][this[_0x44b8('0xd')]['id']][_0x44b8('0x14')]=!![];this[_0x44b8('0xf')][_0x44b8('0x13')][this[_0x44b8('0xd')]['id']][_0x44b8('0x15')]=undefined;util[_0x44b8('0x16')](this['realtime'],this[_0x44b8('0x2')],this[_0x44b8('0xd')],this[_0x44b8('0x6')][_0x44b8('0x12')]);util[_0x44b8('0x17')](this['notificationId'],this[_0x44b8('0x6')]['id'],this['realtime'][_0x44b8('0x13')][this[_0x44b8('0xd')]['id']],null,this[_0x44b8('0x2')]);util[_0x44b8('0x18')](this[_0x44b8('0x6')]['id'],this['realtime'][_0x44b8('0x13')][this['agent']['id']],_0x44b8('0x19')+(this[_0x44b8('0x2')]['forcedOwnership']?_0x44b8('0x1a'):''));}else{logger[_0x44b8('0x1b')](_0x44b8('0x1c'),this['squeue']['id'],this[_0x44b8('0xd')]['id']);setTimeout(this[_0x44b8('0x4')]['bind'](this),0x3e8);}}};Agent[_0x44b8('0xb')]['handleTimeout']=function(_0xfb0028){if(_['isNil'](this['realtime']['agents'][this[_0x44b8('0xd')]['id']])){return logger[_0x44b8('0x1b')](_0x44b8('0x10'),this[_0x44b8('0x6')]['id'],this[_0x44b8('0xd')]['id']);}else{logger[_0x44b8('0x1b')](_0x44b8('0x1d'),this[_0x44b8('0x6')]['id'],this[_0x44b8('0xd')]['id']);util[_0x44b8('0x1e')](this[_0x44b8('0x3')],this[_0x44b8('0x6')]['id'],this[_0x44b8('0xf')]['agents'][this[_0x44b8('0xd')]['id']],null,this['routing']);this[_0x44b8('0xf')][_0x44b8('0x13')][this[_0x44b8('0xd')]['id']][_0x44b8('0x14')]=![];this[_0x44b8('0xf')]['agents'][this[_0x44b8('0xd')]['id']][_0x44b8('0x15')]=undefined;util[_0x44b8('0x1f')](this[_0x44b8('0xf')],this[_0x44b8('0x2')],this['agent'],this[_0x44b8('0x6')][_0x44b8('0x12')]);util[_0x44b8('0x18')](this[_0x44b8('0x6')]['id'],this[_0x44b8('0xf')][_0x44b8('0x13')][this[_0x44b8('0xd')]['id']],_0xfb0028?_0x44b8('0x20'):_0x44b8('0x21'));}if(!_0xfb0028){setTimeout(this[_0x44b8('0x4')][_0x44b8('0x5')](this),0x3e8);}};function agent(_0xce304d,_0xa5ac3e,_0xae15f4,_0x1e1a8a){return new Agent(_0xce304d,_0xa5ac3e,_0xae15f4,_0x1e1a8a);}module[_0x44b8('0x22')]=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 27880f5..40110ea 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 _0x1828=['debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','name','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','TIMEOUT','busyQueue','removeWaitingNotification','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','Agents','length','isNil','agents'];(function(_0x5b2488,_0x170d3c){var _0x583867=function(_0xab27cb){while(--_0xab27cb){_0x5b2488['push'](_0x5b2488['shift']());}};_0x583867(++_0x170d3c);}(_0x1828,0x1d6));var _0x8182=function(_0x15eed4,_0x5c36a9){_0x15eed4=_0x15eed4-0x0;var _0x15d192=_0x1828[_0x15eed4];return _0x15d192;};'use strict';var _=require('lodash');var uuid=require(_0x8182('0x0'));var util=require(_0x8182('0x1'));var logger=require(_0x8182('0x2'))(_0x8182('0x3'));var Beepall=function(_0x85be57,_0x3c7616,_0x3726d2,_0x47aa3c){this[_0x8182('0x4')]=uuid['v4']();this[_0x8182('0x5')]=_0x85be57;this[_0x8182('0x6')]=_0x3c7616;this[_0x8182('0x7')]=_0x3726d2;this[_0x8182('0x3')]=_0x47aa3c;this[_0x8182('0x5')][_0x8182('0x8')](this[_0x8182('0x9')][_0x8182('0xa')](this),this[_0x8182('0xb')][_0x8182('0xa')](this));this[_0x8182('0x5')]['on'](_0x8182('0xc'),this[_0x8182('0xb')][_0x8182('0xa')](this));this[_0x8182('0x5')]['on'](_0x8182('0xd'),this[_0x8182('0xe')][_0x8182('0xa')](this));};Beepall['prototype'][_0x8182('0x8')]=function(){this['squeue']['push'](this[_0x8182('0x9')][_0x8182('0xa')](this),this[_0x8182('0xb')][_0x8182('0xa')](this));};Beepall[_0x8182('0xf')][_0x8182('0xe')]=function(){this[_0x8182('0xb')](!![]);};Beepall[_0x8182('0xf')][_0x8182('0x9')]=function(){var _0x15e52a=!![];if(!_['isNil'](this[_0x8182('0x6')])&&!_['isNil'](this[_0x8182('0x6')]['Agents'])&&this[_0x8182('0x6')][_0x8182('0x10')][_0x8182('0x11')]>0x0){for(var _0x44e0a9=0x0,_0x1d8eda;_0x44e0a90x0){for(var _0x8b6187=0x0,_0x3b9168;_0x8b61870x0&&_0x30b152[_0x2b6199+'CurrentCapacity']>=_0x30b152[_0x2b6199+_0xab5b('0x20')]){writeLog(_0x86cd02,_0x30b152,_0x2b6199[_0xab5b('0x21')]()+_0xab5b('0x22'));return![];}}return!![];};exports[_0xab5b('0x23')]=function(_0xaa293b,_0x49bb25,_0x2a83b9,_0x2c4aa5,_0x478049){return sendNotification(!![],_0xaa293b,_0x49bb25,_0x2a83b9,_0x2c4aa5,_0x478049);};exports['hideNotification']=function(_0x9dbc1b,_0x23fd62,_0x463de5,_0x381196,_0x171135){return sendNotification(![],_0x9dbc1b,_0x23fd62,_0x463de5,_0x381196,_0x171135);};exports[_0xab5b('0x24')]=function(_0x26d5c4,_0x23e0c1,_0xd8d280){var _0x233671=_0x23e0c1[_0xab5b('0x25')][_0xab5b('0x26')];if(!_0x233671&&_0xd8d280){_0x233671=_0xd8d280['id'];}var _0x5d8090=_['some'](_0x26d5c4[_0x23e0c1['channel']+_0xab5b('0x27')],function(_0x555906){var _0x561eb9=_[_0xab5b('0x28')](_0x23e0c1['channel'])+_0xab5b('0x29');return _0x555906[_0x561eb9]===_0x23e0c1['interaction']['id'];});if(!_0x5d8090&&_0x233671){_0x5d8090=_[_0xab5b('0x2a')](_0x26d5c4[_0xab5b('0x2b')][_0x233671][_0x23e0c1[_0xab5b('0x2c')]+_0xab5b('0x2d')],function(_0x9435a6){return _0x9435a6['id']===_0x23e0c1['interaction']['id'];});}return _0x5d8090;};exports['saveWaitingNotification']=function(_0x5134e8,_0x1fb203,_0x53ce62,_0x79b968){_0x5134e8[_0xab5b('0x2b')][_0x53ce62['id']][_0x79b968+_0xab5b('0x2d')][_0x1fb203[_0xab5b('0x17')]['id']]={'id':_0x1fb203[_0xab5b('0x25')]['id']};};exports['removeWaitingNotification']=function(_0x2e792d,_0x2e76ee,_0x916d4b,_0x4cc46a){delete _0x2e792d['agents'][_0x916d4b['id']][_0x4cc46a+'WaitingInteractions'][_0x2e76ee['message']['id']];};exports[_0xab5b('0x2e')]=writeLog; \ No newline at end of file +var _0xe497=['../../../../../config/logger','routing','redis','defaults','socket.io-emitter','format','user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','emit','notification:%s','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','checkWaitingNotifications','interaction','UserId','some','channel','capitalize','agents','saveWaitingNotification','WaitingInteractions','removeWaitingNotification','lodash','util','../utils','ioredis'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xe497,0x128));var _0x7e49=function(_0x3af9b6,_0x1c30d5){_0x3af9b6=_0x3af9b6-0x0;var _0x2e0de3=_0xe497[_0x3af9b6];return _0x2e0de3;};'use strict';var _=require(_0x7e49('0x0'));var util=require(_0x7e49('0x1'));var utils=require(_0x7e49('0x2'));var Redis=require(_0x7e49('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x7e49('0x4'))(_0x7e49('0x5'));config[_0x7e49('0x6')]=_[_0x7e49('0x7')](config[_0x7e49('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7e49('0x8'))(new Redis(config[_0x7e49('0x6')]));function sendNotification(_0x54f83a,_0x51f8c5,_0x48f4b4,_0x2b608c,_0x3bd862,_0x474e6b){io['to'](util[_0x7e49('0x9')](_0x7e49('0xa'),_0x2b608c[_0x7e49('0xb')]))['emit'](_0x7e49('0xc'),_0x2b608c);var _0x5e1346=_0x474e6b||{};var _0x7a8a09=_0x48f4b4['split']('.');var _0x42ae2a={'uniqueid':_0x51f8c5,'channel':_0x7a8a09[0x0],'id':_0x7a8a09[0x1],'title':_0x7a8a09[0x0]+_0x7e49('0xd'),'interactionId':_0x7a8a09[0x2],'queue':_0x3bd862?_0x3bd862['name']:null,'sound':_0x5e1346[_0x7e49('0xe')][_0x7e49('0xf')],'shake':_0x5e1346[_0x7e49('0xe')][_0x7e49('0x10')]};try{if(!_0x5e1346['body']){_0x5e1346[_0x7e49('0x11')]={};}if(_0x3bd862){_0x5e1346[_0x7e49('0x11')][_0x7e49('0x12')]=_0x3bd862;}else if(_0x5e1346['body']['queue']){delete _0x5e1346[_0x7e49('0x11')][_0x7e49('0x12')];}_0x42ae2a[_0x7e49('0x13')]=utils['getMustacheRender'](_0x5e1346[_0x7e49('0xe')]['notificationTemplate'],_0x5e1346);}catch(_0x4af0f5){_0x42ae2a[_0x7e49('0x13')]=_0x7e49('0x14');logger[_0x7e49('0x15')](util[_0x7e49('0x9')](_0x7e49('0x16'),_0x51f8c5,_0x4af0f5[_0x7e49('0x17')]));}io['to'](util[_0x7e49('0x9')]('user:%s',_0x2b608c[_0x7e49('0xb')]))[_0x7e49('0x18')](util[_0x7e49('0x9')](_0x7e49('0x19'),_0x54f83a?'save':'remove'),_0x42ae2a);}function writeLog(_0x51b021,_0x14bc4e,_0x5fd704){return logger[_0x7e49('0x1a')](util[_0x7e49('0x9')](_0x7e49('0x1b'),_0x51b021,_0x14bc4e[_0x7e49('0xb')],_0x5fd704));}exports[_0x7e49('0x1c')]=function(_0xf6d64f,_0x5b95d5,_0x34c66d,_0x116d93){if(_0x5b95d5[_0x7e49('0x1d')]){writeLog(_0xf6d64f,_0x5b95d5,_0x7e49('0x1e'));return![];}if(!_0x5b95d5[_0x7e49('0x1f')]){writeLog(_0xf6d64f,_0x5b95d5,_0x7e49('0x20'));return![];}if(_0x5b95d5[_0x34c66d+_0x7e49('0x21')]){writeLog(_0xf6d64f,_0x5b95d5,_0x7e49('0x22'));return![];}if(_0x116d93&&_0x5b95d5[_0x7e49('0x23')](_0x34c66d+'Capacity')&&_0x5b95d5[_0x7e49('0x23')](_0x34c66d+_0x7e49('0x24'))){if(_0x5b95d5[_0x34c66d+_0x7e49('0x25')]>0x0&&_0x5b95d5[_0x34c66d+_0x7e49('0x24')]>=_0x5b95d5[_0x34c66d+_0x7e49('0x25')]){writeLog(_0xf6d64f,_0x5b95d5,_0x34c66d[_0x7e49('0x26')]()+_0x7e49('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x5ce85b,_0x4948bb,_0x31c469,_0x4b9808,_0x13570c){return sendNotification(!![],_0x5ce85b,_0x4948bb,_0x31c469,_0x4b9808,_0x13570c);};exports['hideNotification']=function(_0x5a1e61,_0x37afbc,_0xefa3eb,_0x177b6d,_0x2ffd44){return sendNotification(![],_0x5a1e61,_0x37afbc,_0xefa3eb,_0x177b6d,_0x2ffd44);};exports[_0x7e49('0x28')]=function(_0x1ef790,_0xa9e379,_0x2601cb){var _0x2baac1=_0xa9e379[_0x7e49('0x29')][_0x7e49('0x2a')];if(!_0x2baac1&&_0x2601cb){_0x2baac1=_0x2601cb['id'];}var _0xe9623=_[_0x7e49('0x2b')](_0x1ef790[_0xa9e379[_0x7e49('0x2c')]+'QueuesWaitingInteractions'],function(_0x3cca23){var _0x476fee=_[_0x7e49('0x2d')](_0xa9e379[_0x7e49('0x2c')])+'InteractionId';return _0x3cca23[_0x476fee]===_0xa9e379[_0x7e49('0x29')]['id'];});if(!_0xe9623&&_0x2baac1){_0xe9623=_[_0x7e49('0x2b')](_0x1ef790[_0x7e49('0x2e')][_0x2baac1][_0xa9e379['channel']+'WaitingInteractions'],function(_0x307eb5){return _0x307eb5['id']===_0xa9e379[_0x7e49('0x29')]['id'];});}return _0xe9623;};exports[_0x7e49('0x2f')]=function(_0x39573c,_0x420c39,_0x55ed0c,_0x4648fa){_0x39573c[_0x7e49('0x2e')][_0x55ed0c['id']][_0x4648fa+_0x7e49('0x30')][_0x420c39[_0x7e49('0x17')]['id']]={'id':_0x420c39['interaction']['id']};};exports[_0x7e49('0x31')]=function(_0x6c740c,_0x246776,_0x4e2332,_0x15a4e5){delete _0x6c740c[_0x7e49('0x2e')][_0x4e2332['id']][_0x15a4e5+_0x7e49('0x30')][_0x246776['message']['id']];};exports['writeLog']=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 3f28134..ef7d5fa 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 _0xdc85=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join'];(function(_0xe5380c,_0x1fc459){var _0x5b71d8=function(_0x44101d){while(--_0x44101d){_0xe5380c['push'](_0xe5380c['shift']());}};_0x5b71d8(++_0x1fc459);}(_0xdc85,0x1b1));var _0x5dc8=function(_0x5c31aa,_0x7c31cb){_0x5c31aa=_0x5c31aa-0x0;var _0x5eb1f9=_0xdc85[_0x5c31aa];return _0x5eb1f9;};'use strict';var schema=require(_0x5dc8('0x0'));var sh=require(_0x5dc8('0x1'));var _=require(_0x5dc8('0x2'));var utils=require(_0x5dc8('0x3'));var logger=require(_0x5dc8('0x4'))(_0x5dc8('0x5'));var system=schema({'command':{'type':_0x5dc8('0x6'),'required':!![],'message':_0x5dc8('0x7')}});exports[_0x5dc8('0x8')]=function(_0x1b1bdd,_0x2cfd76){return function(_0x15bd11){try{var _0x35fa78={'command':_0x2cfd76[0x0]};var _0x4287f5=system[_0x5dc8('0x0')](_0x35fa78,{'typecast':!![]});if(_0x4287f5[_0x5dc8('0x9')]){logger[_0x5dc8('0xa')](_0x5dc8('0xb'),_0x1b1bdd,_[_0x5dc8('0xc')](_0x4287f5,_0x5dc8('0xd'))[_0x5dc8('0xe')](',\x20'));logger[_0x5dc8('0xf')](_0x5dc8('0x10'),_0x1b1bdd);_0x15bd11[_0x5dc8('0x11')]();}else{var _0x122dbe=this;var _0x5d68fc=utils['getMustacheRender'](_0x2cfd76[0x0],this);logger[_0x5dc8('0xf')](_0x5dc8('0x12'),_0x1b1bdd,_0x5d68fc);sh['exec'](_[_0x5dc8('0x13')](_0x5d68fc),function(_0x44d623,_0x2375d0){logger[_0x5dc8('0xf')](_0x5dc8('0x14'),_0x1b1bdd,_0x44d623);if(_0x44d623==0x0){var _0x780a10=_0x2375d0[_0x5dc8('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x5dc8('0x16')](_0x2cfd76[0x1])||_[_0x5dc8('0x17')](_0x2cfd76[0x1])){logger[_0x5dc8('0xf')](_0x5dc8('0x18'),_0x1b1bdd);_0x122dbe[_0x5dc8('0x19')][_0x2cfd76[0x1]]=_0x780a10;}else{logger[_0x5dc8('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1b1bdd,_0x2cfd76[0x1],_0x780a10);_0x122dbe[_0x5dc8('0x19')][_0x2cfd76[0x1]]=_0x780a10;}}_0x15bd11[_0x5dc8('0x11')]();});}}catch(_0x4e0362){logger[_0x5dc8('0xa')](_0x5dc8('0xb'),_0x1b1bdd,_[_0x5dc8('0x1a')](_0x4e0362)?JSON[_0x5dc8('0x1b')](_0x4e0362):_0x4e0362);logger[_0x5dc8('0xf')](_0x5dc8('0x10'),_0x1b1bdd);_0x15bd11['next']();}};}; \ No newline at end of file +var _0x95d9=['info','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','trim'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0x95d9,0x97));var _0x995d=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x95d9[_0xc67528];return _0x38e26d;};'use strict';var schema=require(_0x995d('0x0'));var sh=require(_0x995d('0x1'));var _=require(_0x995d('0x2'));var utils=require(_0x995d('0x3'));var logger=require('../../../../config/logger')(_0x995d('0x4'));var system=schema({'command':{'type':_0x995d('0x5'),'required':!![],'message':_0x995d('0x6')}});exports['consequence']=function(_0x225c17,_0x14e096){return function(_0x25462e){try{var _0x226250={'command':_0x14e096[0x0]};var _0xe6d244=system['validate'](_0x226250,{'typecast':!![]});if(_0xe6d244[_0x995d('0x7')]){logger[_0x995d('0x8')](_0x995d('0x9'),_0x225c17,_[_0x995d('0xa')](_0xe6d244,_0x995d('0xb'))[_0x995d('0xc')](',\x20'));logger['info'](_0x995d('0xd'),_0x225c17);_0x25462e[_0x995d('0xe')]();}else{var _0x62ee7=this;var _0x53f102=utils['getMustacheRender'](_0x14e096[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x225c17,_0x53f102);sh[_0x995d('0xf')](_[_0x995d('0x10')](_0x53f102),function(_0x3df311,_0x3f4e26){logger[_0x995d('0x11')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x225c17,_0x3df311);if(_0x3df311==0x0){var _0x2f9e79=_0x3f4e26[_0x995d('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x995d('0x13')](_0x14e096[0x1])||_[_0x995d('0x14')](_0x14e096[0x1])){logger['info'](_0x995d('0x15'),_0x225c17);_0x62ee7['body'][_0x14e096[0x1]]=_0x2f9e79;}else{logger[_0x995d('0x11')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x225c17,_0x14e096[0x1],_0x2f9e79);_0x62ee7['body'][_0x14e096[0x1]]=_0x2f9e79;}}_0x25462e[_0x995d('0xe')]();});}}catch(_0x53d041){logger[_0x995d('0x8')](_0x995d('0x9'),_0x225c17,_[_0x995d('0x16')](_0x53d041)?JSON[_0x995d('0x17')](_0x53d041):_0x53d041);logger[_0x995d('0x11')](_0x995d('0xd'),_0x225c17);_0x25462e[_0x995d('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 6c7793d..3af7786 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 _0xf4eb=['lodash','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','validate'];(function(_0x84b0c5,_0x2d6546){var _0x5af62c=function(_0xeffd5){while(--_0xeffd5){_0x84b0c5['push'](_0x84b0c5['shift']());}};_0x5af62c(++_0x2d6546);}(_0xf4eb,0x1af));var _0xbf4e=function(_0x2e7128,_0x3c8329){_0x2e7128=_0x2e7128-0x0;var _0x5ba9fb=_0xf4eb[_0x2e7128];return _0x5ba9fb;};'use strict';var schema=require(_0xbf4e('0x0'));var _=require(_0xbf4e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xbf4e('0x2')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xbf4e('0x3'))};var logger=require(_0xbf4e('0x4'))(_0xbf4e('0x5'));var tag=schema({'tag':{'type':_0xbf4e('0x6'),'required':!![],'message':_0xbf4e('0x7')}});exports['consequence']=function(_0xc2d281,_0x3b6d18,_0x644cbd,_0x2cd622){return function(_0x31176e){try{var _0x9706fd={'tag':_0x3b6d18[0x0]};var _0xdf11ed=tag[_0xbf4e('0x0')](_0x9706fd,{'typecast':!![]});if(_0xdf11ed['length']){logger['error'](_0xbf4e('0x8'),_0xc2d281,_[_0xbf4e('0x9')](_0xdf11ed,_0xbf4e('0xa'))[_0xbf4e('0xb')](',\x20'));logger[_0xbf4e('0xc')](_0xbf4e('0xd'),_0xc2d281);_0x31176e[_0xbf4e('0xe')]();}else{var _0x13f328={'ids':[_0x3b6d18[0x0]]};if(rpc[_0x2cd622[_0xbf4e('0xf')]+_0xbf4e('0x10')]){rpc[_0x2cd622[_0xbf4e('0xf')]+_0xbf4e('0x10')]['addTags'](_0x2cd622['interaction']['id'],_0x13f328)[_0xbf4e('0x11')](function(_0x4ca626){logger['info'](_0xbf4e('0x12'),_0xc2d281,_0x3b6d18[0x1],_0x2cd622[_0xbf4e('0xf')],_0x2cd622['interaction']['id']);})[_0xbf4e('0x13')](function(_0x427b25){logger[_0xbf4e('0x14')](_0xbf4e('0x8'),_0xc2d281,JSON[_0xbf4e('0x15')](_0x427b25));logger[_0xbf4e('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xc2d281);})[_0xbf4e('0x16')](function(){_0x31176e[_0xbf4e('0xe')]();});}}}catch(_0x5a2f5a){logger['error']('[%s][TAG]\x20%s',_0xc2d281,_[_0xbf4e('0x17')](_0x5a2f5a)?JSON['stringify'](_0x5a2f5a):_0x5a2f5a);logger[_0xbf4e('0xc')](_0xbf4e('0xd'),_0xc2d281);_0x31176e[_0xbf4e('0xe')]();}};}; \ No newline at end of file +var _0x5765=['[%s][TAG]\x20%s','message','join','info','next','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error'];(function(_0x501732,_0x53aaa0){var _0x588ae8=function(_0x2ad1fd){while(--_0x2ad1fd){_0x501732['push'](_0x501732['shift']());}};_0x588ae8(++_0x53aaa0);}(_0x5765,0x1b1));var _0x5576=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0x5765[_0x4fa166];return _0x5dd974;};'use strict';var schema=require(_0x5576('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5576('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5576('0x2')),'faxInteraction':require(_0x5576('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x5576('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x5576('0x5')}});exports[_0x5576('0x6')]=function(_0x31e7a6,_0x1546a8,_0x5e9882,_0x110439){return function(_0xde5f68){try{var _0x4b4730={'tag':_0x1546a8[0x0]};var _0x8c76de=tag[_0x5576('0x0')](_0x4b4730,{'typecast':!![]});if(_0x8c76de['length']){logger[_0x5576('0x7')](_0x5576('0x8'),_0x31e7a6,_['map'](_0x8c76de,_0x5576('0x9'))[_0x5576('0xa')](',\x20'));logger[_0x5576('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x31e7a6);_0xde5f68[_0x5576('0xc')]();}else{var _0x22e513={'ids':[_0x1546a8[0x0]]};if(rpc[_0x110439['channel']+_0x5576('0xd')]){rpc[_0x110439['channel']+_0x5576('0xd')][_0x5576('0xe')](_0x110439[_0x5576('0xf')]['id'],_0x22e513)['then'](function(_0x9678cd){logger['info'](_0x5576('0x10'),_0x31e7a6,_0x1546a8[0x1],_0x110439['channel'],_0x110439[_0x5576('0xf')]['id']);})[_0x5576('0x11')](function(_0x3bc500){logger['error']('[%s][TAG]\x20%s',_0x31e7a6,JSON[_0x5576('0x12')](_0x3bc500));logger[_0x5576('0xb')](_0x5576('0x13'),_0x31e7a6);})[_0x5576('0x14')](function(){_0xde5f68[_0x5576('0xc')]();});}}}catch(_0x4c4269){logger[_0x5576('0x7')]('[%s][TAG]\x20%s',_0x31e7a6,_['isObject'](_0x4c4269)?JSON[_0x5576('0x12')](_0x4c4269):_0x4c4269);logger[_0x5576('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x31e7a6);_0xde5f68[_0x5576('0xc')]();}};}; \ 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 57af33e..4c94c83 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 _0x1033=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&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','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','login','stringify','POST','application/json-rpc','parse','result','logged'];(function(_0x3fa08f,_0x13b913){var _0x1426c0=function(_0xc51e89){while(--_0xc51e89){_0x3fa08f['push'](_0x3fa08f['shift']());}};_0x1426c0(++_0x13b913);}(_0x1033,0xbd));var _0x3103=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x1033[_0x255d5b];return _0x3e141a;};'use strict';var rp=require(_0x3103('0x0'));var logger=require(_0x3103('0x1'))(_0x3103('0x2'));var _=require(_0x3103('0x3'));var arr=[];exports[_0x3103('0x4')]=function(_0x159d34,_0x1ed882){return function(_0x3e53c4){var _0xec145a=_0x1ed882[0xa];var _0x463eda=_0x1ed882[0xb];var _0x3f9d0b=_0x1ed882[0xc];var _0x51ff44=_0x1ed882[0xd];var _0xea8ecc=_0x1ed882[0xe];var _0x47bcea=_0x1ed882[0xf][_0x3103('0x5')](/\n/g,_0x3103('0x6'));var _0x4f7d8b=_0x1ed882[0x10][_0x3103('0x5')](/\n/g,'\x20');if(!arr[_0x3103('0x7')](_0x463eda)){arr[_0x3103('0x8')](_0x463eda);var _0x5e21aa=_0x1ed882[0x3];var _0x281edb=_0x1ed882[0x4];var _0x289cf4=_0x1ed882[0x1];var _0x3ba412=_0x1ed882[0x0];var _0x176e2c={};_0x176e2c[_0x3103('0x9')]=_0x1ed882[0x8]+'?params='+_0x3f9d0b+'|'+_0xec145a+'|'+_0x51ff44+'|'+_0x463eda+'|'+_0xea8ecc;_0x176e2c['urlOnRing']=_0x1ed882[0x7]+_0x3103('0xa')+_0x3f9d0b+'|'+_0xec145a+'|'+_0x51ff44+'|'+_0x463eda+'|'+_0xea8ecc+'|'+_0x47bcea+'|'+_0x4f7d8b;_0x176e2c[_0x3103('0xb')]=_0x1ed882[0x9];var _0x2aa998={};_0x2aa998[_0x3103('0xc')]=_0x3103('0xd');_0x2aa998['method']=_0x3103('0xe');var _0x5a0596=[];_0x5a0596[_0x3103('0x8')](_0x1ed882[0x2]);_0x5a0596[_0x3103('0x8')](_0x1ed882[0x5]);_0x5a0596['push'](_0x1ed882[0x6]);_0x2aa998['params']=_0x5a0596;_0x2aa998['id']=0x1;var _0x362f4c=JSON[_0x3103('0xf')](_0x2aa998);var _0x4d7a62={'encoding':'utf8','method':_0x3103('0x10'),'timeout':0x2710,'url':_0x5e21aa,'headers':{'Content-Type':_0x3103('0x11')},'body':_0x362f4c};return rp(_0x4d7a62)['then'](function(_0x2bcb03){const _0x124f74=JSON[_0x3103('0x12')](_0x2bcb03);if(!_0x124f74[_0x3103('0x13')][_0x3103('0x14')]){throw new Error(_0x3103('0x15'));}var _0x4c0023=_0x463eda;var _0x18937b=_0x3103('0x16')+_0x289cf4+_0x3103('0x17')+_0x3ba412+_0x3103('0x18')+_0x4c0023+_0x3103('0x19')+JSON[_0x3103('0xf')](_0x176e2c);var _0x292726=_0x281edb+'?'+_0x18937b;return rp(_0x292726);})['then'](function(_0x284e94){logger[_0x3103('0x1a')](_0x3103('0x1b'),_0x159d34,_0x284e94);_0x3e53c4[_0x3103('0x1c')]();})[_0x3103('0x1d')](function(_0x11d3b6){logger[_0x3103('0x1e')](_0x3103('0x1f'),_0x159d34,_[_0x3103('0x20')](_0x11d3b6)?JSON[_0x3103('0xf')](_0x11d3b6):_0x11d3b6);_0x3e53c4[_0x3103('0x1c')]();});}else{logger[_0x3103('0x1a')](_0x3103('0x21'),_0x159d34);_0x3e53c4[_0x3103('0x22')]();}};}; \ No newline at end of file +var _0xf716=['includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence','replace','\x20-\x20'];(function(_0x1e58a1,_0x192735){var _0x2c631e=function(_0x2dcab1){while(--_0x2dcab1){_0x1e58a1['push'](_0x1e58a1['shift']());}};_0x2c631e(++_0x192735);}(_0xf716,0xcd));var _0x6f71=function(_0x1eb5ba,_0x497d1f){_0x1eb5ba=_0x1eb5ba-0x0;var _0x50f999=_0xf716[_0x1eb5ba];return _0x50f999;};'use strict';var rp=require('request-promise');var logger=require(_0x6f71('0x0'))('routing');var _=require(_0x6f71('0x1'));var arr=[];exports[_0x6f71('0x2')]=function(_0xef2a96,_0x4cd4f6){return function(_0x5e7a5a){var _0x484455=_0x4cd4f6[0xa];var _0x579bb3=_0x4cd4f6[0xb];var _0x18479d=_0x4cd4f6[0xc];var _0x1c6c63=_0x4cd4f6[0xd];var _0x3ba048=_0x4cd4f6[0xe];var _0x328da3=_0x4cd4f6[0xf][_0x6f71('0x3')](/\n/g,_0x6f71('0x4'));var _0x3ba6a9=_0x4cd4f6[0x10][_0x6f71('0x3')](/\n/g,'\x20');if(!arr[_0x6f71('0x5')](_0x579bb3)){arr[_0x6f71('0x6')](_0x579bb3);var _0x4ce080=_0x4cd4f6[0x3];var _0x447fc7=_0x4cd4f6[0x4];var _0x480dcc=_0x4cd4f6[0x1];var _0x13a972=_0x4cd4f6[0x0];var _0xd599f8={};_0xd599f8[_0x6f71('0x7')]=_0x4cd4f6[0x8]+'?params='+_0x18479d+'|'+_0x484455+'|'+_0x1c6c63+'|'+_0x579bb3+'|'+_0x3ba048;_0xd599f8[_0x6f71('0x8')]=_0x4cd4f6[0x7]+_0x6f71('0x9')+_0x18479d+'|'+_0x484455+'|'+_0x1c6c63+'|'+_0x579bb3+'|'+_0x3ba048+'|'+_0x328da3+'|'+_0x3ba6a9;_0xd599f8[_0x6f71('0xa')]=_0x4cd4f6[0x9];var _0x31f867={};_0x31f867[_0x6f71('0xb')]=_0x6f71('0xc');_0x31f867[_0x6f71('0xd')]=_0x6f71('0xe');var _0x54d7c5=[];_0x54d7c5[_0x6f71('0x6')](_0x4cd4f6[0x2]);_0x54d7c5[_0x6f71('0x6')](_0x4cd4f6[0x5]);_0x54d7c5[_0x6f71('0x6')](_0x4cd4f6[0x6]);_0x31f867[_0x6f71('0xf')]=_0x54d7c5;_0x31f867['id']=0x1;var _0x3b3bbc=JSON[_0x6f71('0x10')](_0x31f867);var _0xeded78={'encoding':_0x6f71('0x11'),'method':_0x6f71('0x12'),'timeout':0x2710,'url':_0x4ce080,'headers':{'Content-Type':_0x6f71('0x13')},'body':_0x3b3bbc};return rp(_0xeded78)['then'](function(_0x57fe50){const _0x22947b=JSON[_0x6f71('0x14')](_0x57fe50);if(!_0x22947b[_0x6f71('0x15')]['logged']){throw new Error(_0x6f71('0x16'));}var _0x52bb76=_0x579bb3;var _0xb2ca82=_0x6f71('0x17')+_0x480dcc+'&serviceId='+_0x13a972+_0x6f71('0x18')+_0x52bb76+_0x6f71('0x19')+JSON['stringify'](_0xd599f8);var _0x505675=_0x447fc7+'?'+_0xb2ca82;return rp(_0x505675);})[_0x6f71('0x1a')](function(_0x5c09cd){logger[_0x6f71('0x1b')](_0x6f71('0x1c'),_0xef2a96,_0x5c09cd);_0x5e7a5a['stop']();})[_0x6f71('0x1d')](function(_0x1f4e7a){logger[_0x6f71('0x1e')](_0x6f71('0x1f'),_0xef2a96,_['isObject'](_0x1f4e7a)?JSON[_0x6f71('0x10')](_0x1f4e7a):_0x1f4e7a);_0x5e7a5a[_0x6f71('0x20')]();});}else{logger['info'](_0x6f71('0x21'),_0xef2a96);_0x5e7a5a[_0x6f71('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 03ee97a..85001af 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x309c11,_0x16e07f){var _0x5120fd=function(_0xb253fd){while(--_0xb253fd){_0x309c11['push'](_0x309c11['shift']());}};_0x5120fd(++_0x16e07f);}(_0xe706,0xa3));var _0x6e70=function(_0x20a270,_0x8b8437){_0x20a270=_0x20a270-0x0;var _0x49429a=_0xe706[_0x20a270];return _0x49429a;};'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 +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x15831a,_0x563214){var _0x597e22=function(_0x16e7c2){while(--_0x16e7c2){_0x15831a['push'](_0x15831a['shift']());}};_0x597e22(++_0x563214);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 18a9bc4..f0f597d 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 _0x3c29=['message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','autoreply','split','mail','push','slice','appdata','amazonlex','tag','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','./applications/','consequence','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agents','agent','busy','busyQueue','QueueReport','update','UserId','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel'];(function(_0x3b7b42,_0x31badd){var _0x1ebaad=function(_0x3655d9){while(--_0x3655d9){_0x3b7b42['push'](_0x3b7b42['shift']());}};_0x1ebaad(++_0x31badd);}(_0x3c29,0x1e7));var _0x93c2=function(_0x3e982a,_0x3a86ba){_0x3e982a=_0x3e982a-0x0;var _0x40fa38=_0x3c29[_0x3e982a];return _0x40fa38;};'use strict';var _=require('lodash');var util=require(_0x93c2('0x0'));var path=require(_0x93c2('0x1'));var fs=require('fs');var jayson=require(_0x93c2('0x2'));var BPromise=require(_0x93c2('0x3'));var utils=require(_0x93c2('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x93c2('0x5'))(_0x93c2('0x6'));var rpc={'openchannelQueueReport':require(_0x93c2('0x7')),'mailQueueReport':require(_0x93c2('0x8')),'chatQueueReport':require(_0x93c2('0x9')),'smsQueueReport':require(_0x93c2('0xa')),'faxQueueReport':require(_0x93c2('0xb')),'whatsappQueueReport':require(_0x93c2('0xc'))};var RuleEngine=require(_0x93c2('0xd'));function getId(_0x598f7e,_0x1ba4cf,_0x37ca7f){return util['format'](_0x93c2('0xe'),_0x598f7e,_0x1ba4cf||0x0,_0x37ca7f||0x0);}function getIntervals(_0x10b48b,_0x3d08df){var _0x30551c=[];if(!_[_0x93c2('0xf')](_0x3d08df['IntervalId'])&&!_[_0x93c2('0xf')](_0x10b48b[_0x3d08df[_0x93c2('0x10')]])&&!_[_0x93c2('0xf')](_0x10b48b[_0x3d08df[_0x93c2('0x10')]]['Intervals'])){_0x30551c=_[_0x93c2('0x11')](_0x10b48b[_0x3d08df[_0x93c2('0x10')]][_0x93c2('0x12')],_0x93c2('0x13'));}else if(!_['isNil'](_0x3d08df[_0x93c2('0x13')])){_0x30551c=[_0x3d08df[_0x93c2('0x13')]];}return _0x30551c;}exports[_0x93c2('0x14')]=function(_0x1a31a4){_0x1a31a4[_0x93c2('0x15')]={};return new BPromise(function(_0x3a6a70,_0x60e2a3){var _0x2f9890={'Start':function(_0x1cbcbc){var _0x4fc66a=this;return new Promise(function(_0x10b861,_0x97d913){if(_0x1cbcbc){try{var _0x4adc2a=[];var _0x5d3ab5=getId(_0x1cbcbc[_0x93c2('0x16')],_0x1cbcbc[_0x93c2('0x17')]?_0x1cbcbc[_0x93c2('0x17')]['id']:0x0,_0x1cbcbc[_0x93c2('0x18')]?_0x1cbcbc[_0x93c2('0x18')]['id']:0x0);var _0x2ccfb9=sUtils[_0x93c2('0x19')](_0x1a31a4,_0x1cbcbc);if(!_0x2ccfb9&&_0x1cbcbc[_0x93c2('0x1a')]&&_[_0x93c2('0x1b')](_0x1cbcbc[_0x93c2('0x1a')])&&_0x1cbcbc[_0x93c2('0x1a')][_0x93c2('0x1c')]){for(var _0x225e8d=0x0;_0x225e8d<_0x1cbcbc['applications'][_0x93c2('0x1c')];_0x225e8d+=0x1){var _0x1f7ad8=_0x1cbcbc[_0x93c2('0x1a')][_0x225e8d];if(fs[_0x93c2('0x1d')](path[_0x93c2('0x1e')](__dirname,_0x93c2('0x1a'),_0x1f7ad8[_0x93c2('0x1f')]+_0x93c2('0x20')))){var _0x27b21d=[];switch(_0x1f7ad8[_0x93c2('0x1f')]['toLowerCase']()){case _0x93c2('0x21'):var _0x561dbc=_0x1f7ad8['appdata'][_0x93c2('0x22')](',');if(_0x1cbcbc[_0x93c2('0x16')]===_0x93c2('0x23')){_0x27b21d['push'](_0x561dbc[0x0]);_0x27b21d['push'](_0x561dbc[0x1]);_0x27b21d[_0x93c2('0x24')](_0x561dbc['slice'](0x2,_0x561dbc['length'])[_0x93c2('0x1e')](','));}else{_0x27b21d[_0x93c2('0x24')](_0x561dbc[0x0]);_0x27b21d[_0x93c2('0x24')](_0x561dbc[_0x93c2('0x25')](0x1,_0x561dbc['length'])[_0x93c2('0x1e')](','));}break;case'dialogflow':var _0x3958e6=_0x1f7ad8[_0x93c2('0x26')][_0x93c2('0x22')](',');_0x27b21d[_0x93c2('0x24')](_0x3958e6[0x0]);_0x27b21d[_0x93c2('0x24')](_0x3958e6[0x1]);_0x27b21d[_0x93c2('0x24')](_0x3958e6[_0x93c2('0x25')](0x2,_0x3958e6[_0x93c2('0x1c')])[_0x93c2('0x1e')](','));break;case'dialogflowv2':var _0x56e246=_0x1f7ad8['appdata']['split'](',');_0x27b21d[_0x93c2('0x24')](_0x56e246[0x0]);_0x27b21d[_0x93c2('0x24')](_0x56e246[0x1]);_0x27b21d[_0x93c2('0x24')](_0x56e246[0x2]);_0x27b21d[_0x93c2('0x24')](_0x56e246[0x3]);_0x27b21d[_0x93c2('0x24')](_0x56e246[_0x93c2('0x25')](0x4,_0x56e246[_0x93c2('0x1c')])[_0x93c2('0x1e')](','));break;case _0x93c2('0x27'):var _0x4fb731=_0x1f7ad8['appdata']['split'](',');_0x27b21d[_0x93c2('0x24')](_0x4fb731[0x0]);_0x27b21d[_0x93c2('0x24')](_0x4fb731[0x1]);_0x27b21d[_0x93c2('0x24')](_0x4fb731[0x2]);_0x27b21d['push'](_0x4fb731[0x3]);_0x27b21d['push'](_0x4fb731[_0x93c2('0x25')](0x4,_0x4fb731[_0x93c2('0x1c')])[_0x93c2('0x1e')](','));break;case _0x93c2('0x17'):_0x27b21d[_0x93c2('0x24')](_0x1f7ad8[_0x93c2('0x26')]);break;case _0x93c2('0x28'):_0x27b21d[_0x93c2('0x24')](_0x1f7ad8['TagId']);_0x27b21d[_0x93c2('0x24')](_0x1f7ad8[_0x93c2('0x26')]);break;case _0x93c2('0x29'):var _0x47a5fe=utils[_0x93c2('0x2a')](_0x1cbcbc['account'][_0x93c2('0x2b')],_0x1cbcbc);var _0x26a062=_0x1f7ad8[_0x93c2('0x26')][_0x93c2('0x22')](',');_0x27b21d[_0x93c2('0x24')](_0x26a062[0x0]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x1]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x2]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x3]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x4]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x5]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x6]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x7]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x8]);_0x27b21d[_0x93c2('0x24')](_0x26a062[0x9]);_0x27b21d['push'](_0x26a062[0xa]);_0x27b21d[_0x93c2('0x24')](_0x1cbcbc['interaction']['id']);_0x27b21d['push'](_0x1cbcbc[_0x93c2('0x17')]['id']);_0x27b21d[_0x93c2('0x24')](_0x1f7ad8[_0x93c2('0x2c')]);_0x27b21d[_0x93c2('0x24')](_0x1cbcbc[_0x93c2('0x18')][_0x93c2('0x2d')]);_0x27b21d[_0x93c2('0x24')](_0x1cbcbc[_0x93c2('0x2e')][_0x93c2('0x2e')]);_0x27b21d[_0x93c2('0x24')](_0x47a5fe);break;default:_0x27b21d=_[_0x93c2('0xf')](_0x1f7ad8[_0x93c2('0x26')])?[]:_0x1f7ad8[_0x93c2('0x26')][_0x93c2('0x22')](',');}var _0x360b0d={'id':util[_0x93c2('0x2f')](_0x93c2('0x30'),_0x5d3ab5,_0x1f7ad8['id'],_0x1f7ad8[_0x93c2('0x1f')]),'condition':require(_0x93c2('0x31'))[_0x93c2('0x32')](_0x5d3ab5,getIntervals(_0x1a31a4['intervals'],_0x1f7ad8),_0x1a31a4),'consequence':require(_0x93c2('0x33')+_0x1f7ad8['app'])[_0x93c2('0x34')](_0x5d3ab5,_0x27b21d,_0x1a31a4,_0x1cbcbc),'p':_0x1f7ad8['priority']||0x0};logger['info'](_0x93c2('0x35'),_0x360b0d['id'],_0x93c2('0x36'),getIntervals(_0x1a31a4[_0x93c2('0x37')],_0x1f7ad8)[_0x93c2('0x1e')](_0x93c2('0x38')));_0x4adc2a[_0x93c2('0x24')](_0x360b0d);}else{logger[_0x93c2('0x39')](_0x93c2('0x3a'),path[_0x93c2('0x1e')](__dirname,_0x93c2('0x1a'),_0x1f7ad8[_0x93c2('0x1f')]+_0x93c2('0x20')));}}_0x1a31a4[_0x93c2('0x15')][_0x5d3ab5]=new RuleEngine(_0x4adc2a);_0x1a31a4[_0x93c2('0x15')][_0x5d3ab5][_0x93c2('0x3b')](_0x1cbcbc,function(_0x573e65){logger[_0x93c2('0x3c')]('Applications\x20executed',JSON['stringify'](_0x573e65['matchPath']));if(_0x1a31a4['rules'][_0x5d3ab5]){_0x1a31a4[_0x93c2('0x15')][_0x5d3ab5][_0x93c2('0x3d')](_0x93c2('0x3e'));}});return _0x10b861({'code':0xc8,'message':_0x1cbcbc});}else{if(_0x2ccfb9){logger[_0x93c2('0x3c')](util[_0x93c2('0x2f')](_0x93c2('0x3f'),_0x5d3ab5));}else{logger['info'](_0x93c2('0x40'));}return _0x10b861({'code':0xc8,'message':_0x1cbcbc});}}catch(_0x413a14){logger[_0x93c2('0x39')](_0x413a14[_0x93c2('0x41')]);return _0x97d913(_0x4fc66a[_0x93c2('0x39')](0x1f4,_0x413a14));}}return _0x97d913('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5af130){var _0x544a58=this;return new Promise(function(_0x2c66ef,_0x529bb0){if(_0x5af130['agent']&&_0x5af130['agent']['id']){if(_0x1a31a4[_0x93c2('0x42')][_0x5af130[_0x93c2('0x43')]['id']]){_0x1a31a4['agents'][_0x5af130[_0x93c2('0x43')]['id']][_0x93c2('0x44')]=![];_0x1a31a4[_0x93c2('0x42')][_0x5af130[_0x93c2('0x43')]['id']][_0x93c2('0x45')]=undefined;}}if(_0x5af130[_0x93c2('0x17')]&&_0x5af130[_0x93c2('0x17')]['id']){try{var _0x564881=getId(_0x5af130[_0x93c2('0x16')],_0x5af130[_0x93c2('0x17')]?_0x5af130['message']['id']:0x0,_0x5af130[_0x93c2('0x18')]?_0x5af130[_0x93c2('0x18')]['id']:0x0);if(_0x1a31a4['rules'][_0x564881]){_0x1a31a4[_0x93c2('0x15')][_0x564881]['emit']('end');if(rpc[_0x5af130[_0x93c2('0x16')]+_0x93c2('0x46')]){rpc[_0x5af130[_0x93c2('0x16')]+_0x93c2('0x46')][_0x93c2('0x47')](_0x564881,{'UserId':_0x5af130[_0x93c2('0x17')][_0x93c2('0x48')]})['catch'](function(){logger[_0x93c2('0x39')]('error\x20update\x20queue\x20report');});}}return _0x2c66ef({'code':0xc8,'message':_0x5af130});}catch(_0xb687b3){logger[_0x93c2('0x39')](_0xb687b3[_0x93c2('0x41')]);return _0x529bb0(_0x544a58[_0x93c2('0x39')](0x1f4,_0xb687b3));}}logger['error'](_0x93c2('0x49'));return _0x529bb0(_0x544a58['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x21a5f4){var _0x2ed794=this;return new Promise(function(_0x2e4455,_0x3e3d8e){if(_0x21a5f4[_0x93c2('0x43')]&&_0x21a5f4[_0x93c2('0x43')]['id']){try{if(_0x1a31a4[_0x93c2('0x42')][_0x21a5f4[_0x93c2('0x43')]['id']]){_0x1a31a4[_0x93c2('0x42')][_0x21a5f4[_0x93c2('0x43')]['id']][_0x93c2('0x44')]=![];_0x1a31a4[_0x93c2('0x42')][_0x21a5f4['agent']['id']][_0x93c2('0x45')]=undefined;}return _0x2e4455({'code':0xc8,'message':_0x21a5f4});}catch(_0xdaa2a4){logger[_0x93c2('0x39')](_0xdaa2a4[_0x93c2('0x41')]);return _0x3e3d8e(_0x2ed794['error'](0x1f4,_0xdaa2a4));}}logger[_0x93c2('0x39')](_0x93c2('0x49'));return _0x3e3d8e(_0x2ed794['error'](0x1f4,_0x93c2('0x49')));});},'AbandonInteraction':function(_0x1349ff){var _0x43a00c=this;return new Promise(function(_0x130404,_0x513c5e){if(_0x1349ff['channel']&&_0x1349ff[_0x93c2('0x18')]&&_0x1349ff['interaction']['id']){try{var _0x25d71b=getId(_0x1349ff['channel'],_0x1349ff[_0x93c2('0x17')]?_0x1349ff['message']['id']:0x0,_0x1349ff[_0x93c2('0x18')]?_0x1349ff[_0x93c2('0x18')]['id']:0x0);if(_0x1a31a4[_0x93c2('0x15')][_0x25d71b]){_0x1a31a4[_0x93c2('0x15')][_0x25d71b][_0x93c2('0x3d')](_0x93c2('0x4a'));}return _0x130404({'code':0xc8,'message':_0x1349ff});}catch(_0x5e8e7a){logger[_0x93c2('0x39')](_0x5e8e7a[_0x93c2('0x41')]);return _0x513c5e(_0x43a00c[_0x93c2('0x39')](0x1f4,_0x5e8e7a));}}logger[_0x93c2('0x39')]('message\x20is\x20empty');return _0x513c5e(_0x43a00c[_0x93c2('0x39')](0x1f4,_0x93c2('0x49')));});},'AgentCapacity':function(_0x2237d7){var _0x32cf15=this;return new Promise(function(_0x38bcd9,_0x842375){if(_0x1a31a4[_0x93c2('0x42')][_0x93c2('0x4b')](_0x2237d7['id'])){for(var _0x319431 in _0x2237d7[_0x93c2('0x4c')]){if(_0x2237d7[_0x93c2('0x4c')][_0x93c2('0x4b')](_0x319431)){if(_0x1a31a4['agents'][_0x2237d7['id']][_0x93c2('0x4b')](_0x319431+_0x93c2('0x4d'))){_0x1a31a4['agents'][_0x2237d7['id']][_0x319431+'CurrentCapacity']=parseInt(_0x2237d7[_0x93c2('0x4c')][_0x319431],0xa);}}}_0x1a31a4[_0x93c2('0x42')][_0x2237d7['id']][_0x93c2('0x4e')]();return _0x38bcd9({'code':0xc8,'message':_0x1a31a4[_0x93c2('0x42')][_0x2237d7['id']]});}else{return _0x842375(_0x32cf15[_0x93c2('0x39')](0x1f4,_0x93c2('0x4f')));}});},'Agents':function(_0x3cd835){return new Promise(function(_0x57b1cc){var _0x4b8bb2=_['values'](_0x1a31a4[_0x93c2('0x42')]);if(_0x3cd835&&_0x3cd835['id']){var _0xad27fc=_[_0x93c2('0x50')](_0x4b8bb2,function(_0x2e6e0c){return _0x2e6e0c['id']===_0x3cd835['id'];});_0x57b1cc(_0xad27fc);}else{_0x57b1cc({'count':_0x4b8bb2[_0x93c2('0x1c')],'rows':_0x4b8bb2});}});},'ChatQueues':function(){return new Promise(function(_0x474441){var _0xb181fc=[];for(var _0x28379b in _0x1a31a4[_0x93c2('0x51')]){if(_0x1a31a4[_0x93c2('0x51')]['hasOwnProperty'](_0x28379b)){var _0x38789f=_0x1a31a4[_0x93c2('0x51')][_0x28379b];var _0x34f279={'id':_0x38789f['id'],'available':_0x38789f[_0x93c2('0x52')],'loggedIn':_0x38789f[_0x93c2('0x53')],'name':_0x38789f[_0x93c2('0x54')],'paused':_0x38789f[_0x93c2('0x55')],'waiting':_0x38789f[_0x93c2('0x56')]};_0xb181fc['push'](_0x34f279);}}_0x474441({'count':_0xb181fc['length'],'rows':_0xb181fc});});},'MailQueues':function(){return new Promise(function(_0x3ee88b){var _0x1a9bd7=[];for(var _0x59b46a in _0x1a31a4[_0x93c2('0x57')]){if(_0x1a31a4[_0x93c2('0x57')]['hasOwnProperty'](_0x59b46a)){var _0x42033a=_0x1a31a4[_0x93c2('0x57')][_0x59b46a];var _0x4265ab={'id':_0x42033a['id'],'available':_0x42033a[_0x93c2('0x52')],'loggedIn':_0x42033a['loggedIn'],'name':_0x42033a[_0x93c2('0x54')],'paused':_0x42033a[_0x93c2('0x55')],'waiting':_0x42033a[_0x93c2('0x56')]};_0x1a9bd7[_0x93c2('0x24')](_0x4265ab);}}_0x3ee88b({'count':_0x1a9bd7['length'],'rows':_0x1a9bd7});});},'OpenchannelQueues':function(){return new Promise(function(_0x205c13){var _0x297454=[];for(var _0x13bf93 in _0x1a31a4[_0x93c2('0x58')]){if(_0x1a31a4['openchannelQueues'][_0x93c2('0x4b')](_0x13bf93)){var _0x3cafba=_0x1a31a4['openchannelQueues'][_0x13bf93];var _0x15398a={'id':_0x3cafba['id'],'available':_0x3cafba['available'],'loggedIn':_0x3cafba['loggedIn'],'name':_0x3cafba[_0x93c2('0x54')],'paused':_0x3cafba[_0x93c2('0x55')],'waiting':_0x3cafba[_0x93c2('0x56')]};_0x297454['push'](_0x15398a);}}_0x205c13({'count':_0x297454['length'],'rows':_0x297454});});},'SmsQueues':function(){return new Promise(function(_0x2dce05){var _0x3212a8=[];for(var _0x1c8865 in _0x1a31a4[_0x93c2('0x59')]){if(_0x1a31a4['smsQueues'][_0x93c2('0x4b')](_0x1c8865)){var _0x3b62e1=_0x1a31a4[_0x93c2('0x59')][_0x1c8865];var _0xc26a4c={'id':_0x3b62e1['id'],'available':_0x3b62e1['available'],'loggedIn':_0x3b62e1[_0x93c2('0x53')],'name':_0x3b62e1['name'],'paused':_0x3b62e1[_0x93c2('0x55')],'waiting':_0x3b62e1[_0x93c2('0x56')]};_0x3212a8[_0x93c2('0x24')](_0xc26a4c);}}_0x2dce05({'count':_0x3212a8['length'],'rows':_0x3212a8});});},'FaxQueues':function(){return new Promise(function(_0xe4fe84){var _0x3e7a23=[];for(var _0x3271e3 in _0x1a31a4[_0x93c2('0x5a')]){if(_0x1a31a4[_0x93c2('0x5a')][_0x93c2('0x4b')](_0x3271e3)){var _0x14d5cc=_0x1a31a4[_0x93c2('0x5a')][_0x3271e3];var _0x4efabb={'id':_0x14d5cc['id'],'available':_0x14d5cc[_0x93c2('0x52')],'loggedIn':_0x14d5cc['loggedIn'],'name':_0x14d5cc[_0x93c2('0x54')],'paused':_0x14d5cc[_0x93c2('0x55')],'waiting':_0x14d5cc[_0x93c2('0x56')]};_0x3e7a23['push'](_0x4efabb);}}_0xe4fe84({'count':_0x3e7a23[_0x93c2('0x1c')],'rows':_0x3e7a23});});},'WhatsappQueues':function(){return new Promise(function(_0x3083db){var _0x1c036b=[];for(var _0x1cf5c3 in _0x1a31a4[_0x93c2('0x5b')]){if(_0x1a31a4['whatsappQueues'][_0x93c2('0x4b')](_0x1cf5c3)){var _0x4aeb8b=_0x1a31a4[_0x93c2('0x5b')][_0x1cf5c3];var _0x24598b={'id':_0x4aeb8b['id'],'available':_0x4aeb8b[_0x93c2('0x52')],'loggedIn':_0x4aeb8b[_0x93c2('0x53')],'name':_0x4aeb8b[_0x93c2('0x54')],'paused':_0x4aeb8b[_0x93c2('0x55')],'waiting':_0x4aeb8b[_0x93c2('0x56')]};_0x1c036b[_0x93c2('0x24')](_0x24598b);}}_0x3083db({'count':_0x1c036b['length'],'rows':_0x1c036b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xd31da7){var _0x2358a9=_[_0x93c2('0x5c')](_0x1a31a4['chatQueuesWaitingInteractions']);_0xd31da7({'count':_0x2358a9[_0x93c2('0x1c')],'rows':_0x2358a9});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1b1631){var _0x26210f=_[_0x93c2('0x5c')](_0x1a31a4[_0x93c2('0x5d')]);_0x1b1631({'count':_0x26210f[_0x93c2('0x1c')],'rows':_0x26210f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2cb14c){var _0x3cd137=_[_0x93c2('0x5c')](_0x1a31a4[_0x93c2('0x5e')]);_0x2cb14c({'count':_0x3cd137['length'],'rows':_0x3cd137});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x851ee7){var _0x269bca=_[_0x93c2('0x5c')](_0x1a31a4[_0x93c2('0x5f')]);_0x851ee7({'count':_0x269bca['length'],'rows':_0x269bca});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x524135){var _0x53b9cc=_[_0x93c2('0x5c')](_0x1a31a4[_0x93c2('0x60')]);_0x524135({'count':_0x53b9cc['length'],'rows':_0x53b9cc});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1da7d9){var _0x47ec90=_['values'](_0x1a31a4[_0x93c2('0x61')]);_0x1da7d9({'count':_0x47ec90[_0x93c2('0x1c')],'rows':_0x47ec90});});}};var _0x5f0a60=jayson[_0x93c2('0x62')](_0x2f9890)[_0x93c2('0x63')]();_0x5f0a60['on'](_0x93c2('0x39'),function(_0xa54594){logger[_0x93c2('0x39')](JSON['stringify'](_0xa54594));return _0x60e2a3(_0xa54594);});_0x5f0a60['listen'](0x232c,_0x93c2('0x64'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3a6a70(_0x93c2('0x65')+0x232c);});});}; \ No newline at end of file +var _0x39f9=['join','.js','app','toLowerCase','autoreply','appdata','split','mail','push','slice','amazonlex','tag','tvox','getMustacheRender','account','ChatWebsiteId','body','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','info','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','length'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x39f9,0x174));var _0x939f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39f9[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x939f('0x0'));var util=require(_0x939f('0x1'));var path=require(_0x939f('0x2'));var fs=require('fs');var jayson=require(_0x939f('0x3'));var BPromise=require(_0x939f('0x4'));var utils=require(_0x939f('0x5'));var sUtils=require(_0x939f('0x6'));var logger=require(_0x939f('0x7'))(_0x939f('0x8'));var rpc={'openchannelQueueReport':require(_0x939f('0x9')),'mailQueueReport':require(_0x939f('0xa')),'chatQueueReport':require(_0x939f('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x939f('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x939f('0xd'));function getId(_0x38d473,_0x187300,_0x491b89){return util[_0x939f('0xe')]('%s.%s.%s',_0x38d473,_0x187300||0x0,_0x491b89||0x0);}function getIntervals(_0x44c81b,_0x3272c8){var _0x53ae3f=[];if(!_['isNil'](_0x3272c8['IntervalId'])&&!_['isNil'](_0x44c81b[_0x3272c8['IntervalId']])&&!_[_0x939f('0xf')](_0x44c81b[_0x3272c8[_0x939f('0x10')]][_0x939f('0x11')])){_0x53ae3f=_[_0x939f('0x12')](_0x44c81b[_0x3272c8['IntervalId']][_0x939f('0x11')],_0x939f('0x13'));}else if(!_[_0x939f('0xf')](_0x3272c8[_0x939f('0x13')])){_0x53ae3f=[_0x3272c8[_0x939f('0x13')]];}return _0x53ae3f;}exports[_0x939f('0x14')]=function(_0x313aca){_0x313aca[_0x939f('0x15')]={};return new BPromise(function(_0x8baff3,_0x52abfd){var _0x44fb84={'Start':function(_0x5d6641){var _0xc5262b=this;return new Promise(function(_0x17e3a5,_0x509e4c){if(_0x5d6641){try{var _0x284a0d=[];var _0x76e2a6=getId(_0x5d6641[_0x939f('0x16')],_0x5d6641[_0x939f('0x17')]?_0x5d6641[_0x939f('0x17')]['id']:0x0,_0x5d6641[_0x939f('0x18')]?_0x5d6641[_0x939f('0x18')]['id']:0x0);var _0x4b6dcc=sUtils[_0x939f('0x19')](_0x313aca,_0x5d6641);if(!_0x4b6dcc&&_0x5d6641[_0x939f('0x1a')]&&_['isArray'](_0x5d6641[_0x939f('0x1a')])&&_0x5d6641[_0x939f('0x1a')][_0x939f('0x1b')]){for(var _0x5c585c=0x0;_0x5c585c<_0x5d6641['applications'][_0x939f('0x1b')];_0x5c585c+=0x1){var _0x48f4e5=_0x5d6641[_0x939f('0x1a')][_0x5c585c];if(fs['existsSync'](path[_0x939f('0x1c')](__dirname,_0x939f('0x1a'),_0x48f4e5['app']+_0x939f('0x1d')))){var _0x13a6f5=[];switch(_0x48f4e5[_0x939f('0x1e')][_0x939f('0x1f')]()){case _0x939f('0x20'):var _0x475c91=_0x48f4e5[_0x939f('0x21')][_0x939f('0x22')](',');if(_0x5d6641[_0x939f('0x16')]===_0x939f('0x23')){_0x13a6f5['push'](_0x475c91[0x0]);_0x13a6f5[_0x939f('0x24')](_0x475c91[0x1]);_0x13a6f5[_0x939f('0x24')](_0x475c91['slice'](0x2,_0x475c91[_0x939f('0x1b')])['join'](','));}else{_0x13a6f5[_0x939f('0x24')](_0x475c91[0x0]);_0x13a6f5[_0x939f('0x24')](_0x475c91[_0x939f('0x25')](0x1,_0x475c91['length'])[_0x939f('0x1c')](','));}break;case'dialogflow':var _0x228d20=_0x48f4e5['appdata']['split'](',');_0x13a6f5['push'](_0x228d20[0x0]);_0x13a6f5[_0x939f('0x24')](_0x228d20[0x1]);_0x13a6f5['push'](_0x228d20[_0x939f('0x25')](0x2,_0x228d20[_0x939f('0x1b')])[_0x939f('0x1c')](','));break;case'dialogflowv2':var _0x3c5e05=_0x48f4e5['appdata']['split'](',');_0x13a6f5[_0x939f('0x24')](_0x3c5e05[0x0]);_0x13a6f5[_0x939f('0x24')](_0x3c5e05[0x1]);_0x13a6f5[_0x939f('0x24')](_0x3c5e05[0x2]);_0x13a6f5[_0x939f('0x24')](_0x3c5e05[0x3]);_0x13a6f5['push'](_0x3c5e05['slice'](0x4,_0x3c5e05[_0x939f('0x1b')])[_0x939f('0x1c')](','));break;case _0x939f('0x26'):var _0x20d9dd=_0x48f4e5[_0x939f('0x21')][_0x939f('0x22')](',');_0x13a6f5['push'](_0x20d9dd[0x0]);_0x13a6f5[_0x939f('0x24')](_0x20d9dd[0x1]);_0x13a6f5['push'](_0x20d9dd[0x2]);_0x13a6f5[_0x939f('0x24')](_0x20d9dd[0x3]);_0x13a6f5[_0x939f('0x24')](_0x20d9dd['slice'](0x4,_0x20d9dd[_0x939f('0x1b')])[_0x939f('0x1c')](','));break;case _0x939f('0x17'):_0x13a6f5[_0x939f('0x24')](_0x48f4e5['appdata']);break;case _0x939f('0x27'):_0x13a6f5['push'](_0x48f4e5['TagId']);_0x13a6f5[_0x939f('0x24')](_0x48f4e5[_0x939f('0x21')]);break;case _0x939f('0x28'):var _0x1c12b8=utils[_0x939f('0x29')](_0x5d6641[_0x939f('0x2a')]['notificationTemplate'],_0x5d6641);var _0x47cc72=_0x48f4e5[_0x939f('0x21')][_0x939f('0x22')](',');_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x0]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x1]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x2]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x3]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x4]);_0x13a6f5['push'](_0x47cc72[0x5]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x6]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x7]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x8]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0x9]);_0x13a6f5[_0x939f('0x24')](_0x47cc72[0xa]);_0x13a6f5[_0x939f('0x24')](_0x5d6641['interaction']['id']);_0x13a6f5[_0x939f('0x24')](_0x5d6641[_0x939f('0x17')]['id']);_0x13a6f5[_0x939f('0x24')](_0x48f4e5[_0x939f('0x2b')]);_0x13a6f5[_0x939f('0x24')](_0x5d6641[_0x939f('0x18')]['ContactId']);_0x13a6f5['push'](_0x5d6641[_0x939f('0x2c')][_0x939f('0x2c')]);_0x13a6f5[_0x939f('0x24')](_0x1c12b8);break;default:_0x13a6f5=_['isNil'](_0x48f4e5[_0x939f('0x21')])?[]:_0x48f4e5[_0x939f('0x21')][_0x939f('0x22')](',');}var _0xa0f6b9={'id':util[_0x939f('0xe')]('%s:%s:%s',_0x76e2a6,_0x48f4e5['id'],_0x48f4e5['app']),'condition':require('./interval')[_0x939f('0x2d')](_0x76e2a6,getIntervals(_0x313aca[_0x939f('0x2e')],_0x48f4e5),_0x313aca),'consequence':require(_0x939f('0x2f')+_0x48f4e5[_0x939f('0x1e')])[_0x939f('0x30')](_0x76e2a6,_0x13a6f5,_0x313aca,_0x5d6641),'p':_0x48f4e5[_0x939f('0x31')]||0x0};logger['info'](_0x939f('0x32'),_0xa0f6b9['id'],_0x939f('0x33'),getIntervals(_0x313aca[_0x939f('0x2e')],_0x48f4e5)[_0x939f('0x1c')]('\x20|\x20'));_0x284a0d[_0x939f('0x24')](_0xa0f6b9);}else{logger[_0x939f('0x34')](_0x939f('0x35'),path[_0x939f('0x1c')](__dirname,'applications',_0x48f4e5['app']+_0x939f('0x1d')));}}_0x313aca[_0x939f('0x15')][_0x76e2a6]=new RuleEngine(_0x284a0d);_0x313aca[_0x939f('0x15')][_0x76e2a6][_0x939f('0x36')](_0x5d6641,function(_0x3c0230){logger['info'](_0x939f('0x37'),JSON[_0x939f('0x38')](_0x3c0230[_0x939f('0x39')]));if(_0x313aca[_0x939f('0x15')][_0x76e2a6]){_0x313aca[_0x939f('0x15')][_0x76e2a6][_0x939f('0x3a')](_0x939f('0x3b'));}});return _0x17e3a5({'code':0xc8,'message':_0x5d6641});}else{if(_0x4b6dcc){logger['info'](util[_0x939f('0xe')]('Skipped\x20routing\x20for\x20%s',_0x76e2a6));}else{logger[_0x939f('0x3c')](_0x939f('0x3d'));}return _0x17e3a5({'code':0xc8,'message':_0x5d6641});}}catch(_0x477480){logger[_0x939f('0x34')](_0x477480[_0x939f('0x3e')]);return _0x509e4c(_0xc5262b[_0x939f('0x34')](0x1f4,_0x477480));}}return _0x509e4c(_0x939f('0x3f'));});},'AcceptMessage':function(_0x41a9ae){var _0x4656d5=this;return new Promise(function(_0x1def1d,_0x4024e0){if(_0x41a9ae['agent']&&_0x41a9ae[_0x939f('0x40')]['id']){if(_0x313aca[_0x939f('0x41')][_0x41a9ae[_0x939f('0x40')]['id']]){_0x313aca[_0x939f('0x41')][_0x41a9ae['agent']['id']][_0x939f('0x42')]=![];_0x313aca[_0x939f('0x41')][_0x41a9ae[_0x939f('0x40')]['id']][_0x939f('0x43')]=undefined;}}if(_0x41a9ae['message']&&_0x41a9ae[_0x939f('0x17')]['id']){try{var _0x10050b=getId(_0x41a9ae['channel'],_0x41a9ae[_0x939f('0x17')]?_0x41a9ae['message']['id']:0x0,_0x41a9ae[_0x939f('0x18')]?_0x41a9ae[_0x939f('0x18')]['id']:0x0);if(_0x313aca[_0x939f('0x15')][_0x10050b]){_0x313aca[_0x939f('0x15')][_0x10050b][_0x939f('0x3a')](_0x939f('0x44'));if(rpc[_0x41a9ae['channel']+_0x939f('0x45')]){rpc[_0x41a9ae[_0x939f('0x16')]+'QueueReport'][_0x939f('0x46')](_0x10050b,{'UserId':_0x41a9ae[_0x939f('0x17')]['UserId']})[_0x939f('0x47')](function(){logger[_0x939f('0x34')](_0x939f('0x48'));});}}return _0x1def1d({'code':0xc8,'message':_0x41a9ae});}catch(_0x4b2d41){logger[_0x939f('0x34')](_0x4b2d41[_0x939f('0x3e')]);return _0x4024e0(_0x4656d5['error'](0x1f4,_0x4b2d41));}}logger['error']('message\x20is\x20empty');return _0x4024e0(_0x4656d5[_0x939f('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3524c5){var _0x518ade=this;return new Promise(function(_0x43c2c0,_0x1f8e92){if(_0x3524c5[_0x939f('0x40')]&&_0x3524c5[_0x939f('0x40')]['id']){try{if(_0x313aca[_0x939f('0x41')][_0x3524c5[_0x939f('0x40')]['id']]){_0x313aca['agents'][_0x3524c5[_0x939f('0x40')]['id']][_0x939f('0x42')]=![];_0x313aca[_0x939f('0x41')][_0x3524c5['agent']['id']][_0x939f('0x43')]=undefined;}return _0x43c2c0({'code':0xc8,'message':_0x3524c5});}catch(_0x12b169){logger[_0x939f('0x34')](_0x12b169['stack']);return _0x1f8e92(_0x518ade[_0x939f('0x34')](0x1f4,_0x12b169));}}logger[_0x939f('0x34')](_0x939f('0x49'));return _0x1f8e92(_0x518ade[_0x939f('0x34')](0x1f4,_0x939f('0x49')));});},'AbandonInteraction':function(_0x3a2f47){var _0x472f64=this;return new Promise(function(_0x2b0b40,_0x25f9ad){if(_0x3a2f47[_0x939f('0x16')]&&_0x3a2f47[_0x939f('0x18')]&&_0x3a2f47[_0x939f('0x18')]['id']){try{var _0x553078=getId(_0x3a2f47[_0x939f('0x16')],_0x3a2f47[_0x939f('0x17')]?_0x3a2f47[_0x939f('0x17')]['id']:0x0,_0x3a2f47['interaction']?_0x3a2f47[_0x939f('0x18')]['id']:0x0);if(_0x313aca['rules'][_0x553078]){_0x313aca[_0x939f('0x15')][_0x553078][_0x939f('0x3a')]('end');}return _0x2b0b40({'code':0xc8,'message':_0x3a2f47});}catch(_0x344bfd){logger[_0x939f('0x34')](_0x344bfd[_0x939f('0x3e')]);return _0x25f9ad(_0x472f64['error'](0x1f4,_0x344bfd));}}logger[_0x939f('0x34')]('message\x20is\x20empty');return _0x25f9ad(_0x472f64[_0x939f('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3dd6ab){var _0xbdb7c8=this;return new Promise(function(_0x406d56,_0x2baad9){if(_0x313aca[_0x939f('0x41')][_0x939f('0x4a')](_0x3dd6ab['id'])){for(var _0x26bd9e in _0x3dd6ab['capacity']){if(_0x3dd6ab[_0x939f('0x4b')][_0x939f('0x4a')](_0x26bd9e)){if(_0x313aca[_0x939f('0x41')][_0x3dd6ab['id']]['hasOwnProperty'](_0x26bd9e+_0x939f('0x4c'))){_0x313aca[_0x939f('0x41')][_0x3dd6ab['id']][_0x26bd9e+_0x939f('0x4c')]=parseInt(_0x3dd6ab[_0x939f('0x4b')][_0x26bd9e],0xa);}}}_0x313aca[_0x939f('0x41')][_0x3dd6ab['id']][_0x939f('0x4d')]();return _0x406d56({'code':0xc8,'message':_0x313aca[_0x939f('0x41')][_0x3dd6ab['id']]});}else{return _0x2baad9(_0xbdb7c8[_0x939f('0x34')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x31c272){return new Promise(function(_0x644978){var _0x4b4391=_[_0x939f('0x4e')](_0x313aca['agents']);if(_0x31c272&&_0x31c272['id']){var _0x258d43=_['find'](_0x4b4391,function(_0x52a889){return _0x52a889['id']===_0x31c272['id'];});_0x644978(_0x258d43);}else{_0x644978({'count':_0x4b4391[_0x939f('0x1b')],'rows':_0x4b4391});}});},'ChatQueues':function(){return new Promise(function(_0x12abd9){var _0x419639=[];for(var _0x19b43b in _0x313aca[_0x939f('0x4f')]){if(_0x313aca[_0x939f('0x4f')]['hasOwnProperty'](_0x19b43b)){var _0x225807=_0x313aca[_0x939f('0x4f')][_0x19b43b];var _0x2dbdcc={'id':_0x225807['id'],'available':_0x225807[_0x939f('0x50')],'loggedIn':_0x225807[_0x939f('0x51')],'name':_0x225807[_0x939f('0x52')],'paused':_0x225807[_0x939f('0x53')],'waiting':_0x225807[_0x939f('0x54')]};_0x419639[_0x939f('0x24')](_0x2dbdcc);}}_0x12abd9({'count':_0x419639[_0x939f('0x1b')],'rows':_0x419639});});},'MailQueues':function(){return new Promise(function(_0x15759c){var _0x5ad210=[];for(var _0x32ac7d in _0x313aca[_0x939f('0x55')]){if(_0x313aca[_0x939f('0x55')][_0x939f('0x4a')](_0x32ac7d)){var _0x1d655e=_0x313aca[_0x939f('0x55')][_0x32ac7d];var _0x13bc1c={'id':_0x1d655e['id'],'available':_0x1d655e[_0x939f('0x50')],'loggedIn':_0x1d655e[_0x939f('0x51')],'name':_0x1d655e[_0x939f('0x52')],'paused':_0x1d655e['paused'],'waiting':_0x1d655e[_0x939f('0x54')]};_0x5ad210['push'](_0x13bc1c);}}_0x15759c({'count':_0x5ad210[_0x939f('0x1b')],'rows':_0x5ad210});});},'OpenchannelQueues':function(){return new Promise(function(_0xffce49){var _0x361282=[];for(var _0x5dd3df in _0x313aca['openchannelQueues']){if(_0x313aca[_0x939f('0x56')][_0x939f('0x4a')](_0x5dd3df)){var _0x34b988=_0x313aca[_0x939f('0x56')][_0x5dd3df];var _0x21332d={'id':_0x34b988['id'],'available':_0x34b988[_0x939f('0x50')],'loggedIn':_0x34b988[_0x939f('0x51')],'name':_0x34b988['name'],'paused':_0x34b988['paused'],'waiting':_0x34b988[_0x939f('0x54')]};_0x361282[_0x939f('0x24')](_0x21332d);}}_0xffce49({'count':_0x361282[_0x939f('0x1b')],'rows':_0x361282});});},'SmsQueues':function(){return new Promise(function(_0xa9f5cc){var _0x188601=[];for(var _0x5b9d01 in _0x313aca[_0x939f('0x57')]){if(_0x313aca[_0x939f('0x57')][_0x939f('0x4a')](_0x5b9d01)){var _0x1bd441=_0x313aca[_0x939f('0x57')][_0x5b9d01];var _0x276162={'id':_0x1bd441['id'],'available':_0x1bd441[_0x939f('0x50')],'loggedIn':_0x1bd441['loggedIn'],'name':_0x1bd441['name'],'paused':_0x1bd441[_0x939f('0x53')],'waiting':_0x1bd441['waiting']};_0x188601[_0x939f('0x24')](_0x276162);}}_0xa9f5cc({'count':_0x188601[_0x939f('0x1b')],'rows':_0x188601});});},'FaxQueues':function(){return new Promise(function(_0x5945bb){var _0x15df62=[];for(var _0x1b415a in _0x313aca[_0x939f('0x58')]){if(_0x313aca['faxQueues'][_0x939f('0x4a')](_0x1b415a)){var _0x5dfbb4=_0x313aca[_0x939f('0x58')][_0x1b415a];var _0x12ebec={'id':_0x5dfbb4['id'],'available':_0x5dfbb4['available'],'loggedIn':_0x5dfbb4[_0x939f('0x51')],'name':_0x5dfbb4[_0x939f('0x52')],'paused':_0x5dfbb4[_0x939f('0x53')],'waiting':_0x5dfbb4[_0x939f('0x54')]};_0x15df62[_0x939f('0x24')](_0x12ebec);}}_0x5945bb({'count':_0x15df62[_0x939f('0x1b')],'rows':_0x15df62});});},'WhatsappQueues':function(){return new Promise(function(_0x36f8a4){var _0x14e52b=[];for(var _0x38347f in _0x313aca[_0x939f('0x59')]){if(_0x313aca[_0x939f('0x59')][_0x939f('0x4a')](_0x38347f)){var _0x3ac9c5=_0x313aca[_0x939f('0x59')][_0x38347f];var _0x5de3a1={'id':_0x3ac9c5['id'],'available':_0x3ac9c5['available'],'loggedIn':_0x3ac9c5['loggedIn'],'name':_0x3ac9c5[_0x939f('0x52')],'paused':_0x3ac9c5[_0x939f('0x53')],'waiting':_0x3ac9c5[_0x939f('0x54')]};_0x14e52b['push'](_0x5de3a1);}}_0x36f8a4({'count':_0x14e52b[_0x939f('0x1b')],'rows':_0x14e52b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x471873){var _0x1208ce=_[_0x939f('0x4e')](_0x313aca[_0x939f('0x5a')]);_0x471873({'count':_0x1208ce[_0x939f('0x1b')],'rows':_0x1208ce});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x596178){var _0x1ff1dd=_['values'](_0x313aca['mailQueuesWaitingInteractions']);_0x596178({'count':_0x1ff1dd[_0x939f('0x1b')],'rows':_0x1ff1dd});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x35b627){var _0x4cbf4c=_[_0x939f('0x4e')](_0x313aca[_0x939f('0x5b')]);_0x35b627({'count':_0x4cbf4c[_0x939f('0x1b')],'rows':_0x4cbf4c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xc69b97){var _0x3f9e71=_[_0x939f('0x4e')](_0x313aca[_0x939f('0x5c')]);_0xc69b97({'count':_0x3f9e71['length'],'rows':_0x3f9e71});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2d3721){var _0x259d6c=_['values'](_0x313aca[_0x939f('0x5d')]);_0x2d3721({'count':_0x259d6c[_0x939f('0x1b')],'rows':_0x259d6c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x934da0){var _0x145176=_['values'](_0x313aca['whatsappQueuesWaitingInteractions']);_0x934da0({'count':_0x145176[_0x939f('0x1b')],'rows':_0x145176});});}};var _0x57188e=jayson[_0x939f('0x5e')](_0x44fb84)[_0x939f('0x5f')]();_0x57188e['on'](_0x939f('0x34'),function(_0x37b702){logger[_0x939f('0x34')](JSON[_0x939f('0x38')](_0x37b702));return _0x52abfd(_0x37b702);});_0x57188e[_0x939f('0x14')](0x232c,_0x939f('0x60'),function(){console[_0x939f('0x61')](_0x939f('0x62'),0x232c);return _0x8baff3(_0x939f('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3717ed1..4b0c0af 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 _0xa38f=['stack','util','bluebird','jayson/promise','lodash','routing','client','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','then','true','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa38f,0x187));var _0xfa38=function(_0x39c894,_0x47123d){_0x39c894=_0x39c894-0x0;var _0x3f5e06=_0xa38f[_0x39c894];return _0x3f5e06;};'use strict';var util=require(_0xfa38('0x0'));var BPromise=require(_0xfa38('0x1'));var jayson=require(_0xfa38('0x2'));var _=require(_0xfa38('0x3'));var logger=require('../../../config/logger')(_0xfa38('0x4'));var client=jayson[_0xfa38('0x5')]['http']({'port':0x232a});function request(_0x20babd,_0x40ba86){return new BPromise(function(_0xcc7b13,_0x730076){return client['request'](_0x20babd,_0x40ba86)['then'](function(_0x58b1f5){if(_0x58b1f5[_0xfa38('0x6')]){return _0x730076(_0x58b1f5[_0xfa38('0x6')][_0xfa38('0x7')]);}else{return _0xcc7b13(_0x58b1f5[_0xfa38('0x8')]);}})[_0xfa38('0x9')](function(_0x507677){return _0x730076(_0x507677);});});}exports['condition']=function(_0x371ddb,_0x441981,_0x14b747){return function(_0x2c6191){if(_0x14b747[_0xfa38('0xa')]&&!_0x14b747[_0xfa38('0xa')][_0x371ddb]){logger[_0xfa38('0xb')](_0xfa38('0xc'),_0x371ddb);return _0x2c6191[_0xfa38('0xd')]();}var _0x171ff2=[];for(var _0xf77941=0x0;_0xf77941<_0x441981['length'];_0xf77941+=0x1){_0x171ff2[_0xfa38('0xe')](request(_0xfa38('0xf'),{'command':util['format'](_0xfa38('0x10'),_0x441981[_0xf77941])})[_0xfa38('0x11')](function(_0x138f38){return _0x138f38&&_0x138f38[_0xfa38('0x7')]&&_0x138f38['message']['indexOf'](_0xfa38('0x12'))>=0x0?!![]:![];})[_0xfa38('0x9')](function(_0x3c1064){logger[_0xfa38('0x6')](_0xfa38('0x13'),_0x371ddb,_0x441981[_0xf77941]);}));}BPromise['all'](_0x171ff2)[_0xfa38('0x11')](function(_0x1713d0){var _0x98b276=_['some'](_0x1713d0);logger[_0xfa38('0xb')](_0xfa38('0x14'),_0x371ddb,_0x441981[_0xfa38('0x15')](_0xfa38('0x16')),_0x98b276);_0x2c6191[_0xfa38('0x17')](_0x98b276);})[_0xfa38('0x9')](function(_0x46a31f){console[_0xfa38('0x18')](_0x46a31f);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x371ddb,_0x441981[_0xfa38('0x15')](_0xfa38('0x16')),_0x46a31f[_0xfa38('0x19')]);_0x2c6191['stop']();});};}; \ No newline at end of file +var _0x733a=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','catch','condition','rules'];(function(_0x4ab023,_0x37d43f){var _0x1a5c6f=function(_0xd1b6ef){while(--_0xd1b6ef){_0x4ab023['push'](_0x4ab023['shift']());}};_0x1a5c6f(++_0x37d43f);}(_0x733a,0x67));var _0xa733=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x733a[_0x9dfc10];return _0x4f938a;};'use strict';var util=require('util');var BPromise=require(_0xa733('0x0'));var jayson=require(_0xa733('0x1'));var _=require(_0xa733('0x2'));var logger=require(_0xa733('0x3'))(_0xa733('0x4'));var client=jayson['client'][_0xa733('0x5')]({'port':0x232a});function request(_0x37fb5f,_0x6f27c0){return new BPromise(function(_0x237991,_0x1f17be){return client[_0xa733('0x6')](_0x37fb5f,_0x6f27c0)[_0xa733('0x7')](function(_0x2716a8){if(_0x2716a8[_0xa733('0x8')]){return _0x1f17be(_0x2716a8['error'][_0xa733('0x9')]);}else{return _0x237991(_0x2716a8['result']);}})[_0xa733('0xa')](function(_0xc6fa84){return _0x1f17be(_0xc6fa84);});});}exports[_0xa733('0xb')]=function(_0x167451,_0x53b69d,_0x304c3a){return function(_0x2c42b7){if(_0x304c3a[_0xa733('0xc')]&&!_0x304c3a[_0xa733('0xc')][_0x167451]){logger[_0xa733('0xd')](_0xa733('0xe'),_0x167451);return _0x2c42b7[_0xa733('0xf')]();}var _0x1f63b2=[];for(var _0x550359=0x0;_0x550359<_0x53b69d[_0xa733('0x10')];_0x550359+=0x1){_0x1f63b2[_0xa733('0x11')](request(_0xa733('0x12'),{'command':util['format'](_0xa733('0x13'),_0x53b69d[_0x550359])})[_0xa733('0x7')](function(_0x2ad112){return _0x2ad112&&_0x2ad112[_0xa733('0x9')]&&_0x2ad112[_0xa733('0x9')][_0xa733('0x14')](_0xa733('0x15'))>=0x0?!![]:![];})['catch'](function(_0x4d797e){logger[_0xa733('0x8')](_0xa733('0x16'),_0x167451,_0x53b69d[_0x550359]);}));}BPromise[_0xa733('0x17')](_0x1f63b2)[_0xa733('0x7')](function(_0x33940c){var _0x47cde=_['some'](_0x33940c);logger[_0xa733('0xd')](_0xa733('0x18'),_0x167451,_0x53b69d[_0xa733('0x19')](_0xa733('0x1a')),_0x47cde);_0x2c42b7[_0xa733('0x1b')](_0x47cde);})['catch'](function(_0x3689b0){console['log'](_0x3689b0);logger[_0xa733('0x8')](_0xa733('0x18'),_0x167451,_0x53b69d[_0xa733('0x19')](_0xa733('0x1a')),_0x3689b0[_0xa733('0x1c')]);_0x2c42b7[_0xa733('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8d2ab01..04a7bf8 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 _0xa74f=['calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answered_elsewhere','[%s][agents][agentconnect]','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','transferexten','transferuniqueid','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause','rejected','indexOf','splice','complete','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue'];(function(_0x499d03,_0x488a0c){var _0x1d99cf=function(_0x405182){while(--_0x405182){_0x499d03['push'](_0x499d03['shift']());}};_0x1d99cf(++_0x488a0c);}(_0xa74f,0x9a));var _0xfa74=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xa74f[_0x3ed054];return _0x16dd95;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xfa74('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4c4c00,_0x4b5765){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3'),_0x4c4c00[_0xfa74('0x4')],_0x4c4c00['channel'],_0x4c4c00[_0xfa74('0x5')],_0x4c4c00['membername'],_0x4c4c00['interface'],_0x4c4c00[_0xfa74('0x6')],_0x4c4c00[_0xfa74('0x7')],_0x4c4c00[_0xfa74('0x8')]));if(_0x4c4c00[_0xfa74('0x5')]){utils[_0xfa74('0x9')](_0x4c4c00[_0xfa74('0x5')])['then'](function(_0x32f55c){if(_0x32f55c){_0x4c4c00[_0xfa74('0xa')]=_0x32f55c[_0xfa74('0xa')];_0x4c4c00[_0xfa74('0xb')]=_0x4c4c00['agentcomplete']?_0x32f55c[_0xfa74('0xc')]:![];_0x4c4c00[_0xfa74('0xd')]=_0x4c4c00['agentacw']?_0x32f55c[_0xfa74('0xe')]:0x0;}utils[_0xfa74('0xf')](_0xfa74('0x10'),_0x4c4c00);});}else{utils[_0xfa74('0xf')]('CreateVoiceAgentReport',_0x4c4c00);}if(_0x4b5765){delete transfers[_0x4c4c00[_0xfa74('0x4')]];}else{delete agents[_0x4c4c00[_0xfa74('0x11')]];}}exports[_0xfa74('0x12')]=function(_0x278e8b){try{utils['debug'](util[_0xfa74('0x2')](_0xfa74('0x13'),_0x278e8b[_0xfa74('0x4')]),_0x278e8b);agents[_0x278e8b[_0xfa74('0x11')]]=_0x278e8b;agents[_0x278e8b[_0xfa74('0x11')]]['agentcalledAt']=utils[_0xfa74('0x14')]();agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x8')]=_0xfa74('0x15');agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x7')]=null;agents[_0x278e8b[_0xfa74('0x11')]]['connectedlinename']=null;utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x278e8b['uniqueid'],agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x16')],_0x278e8b[_0xfa74('0x11')]));}catch(_0x5a863f){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x13'),_0x278e8b['uniqueid']),_0x5a863f);}};exports[_0xfa74('0x18')]=function(_0x302eb4){try{if(!_[_0xfa74('0x19')](agents[_0x302eb4['destuniqueid']])){utils['debug'](util[_0xfa74('0x2')](_0xfa74('0x1a'),_0x302eb4[_0xfa74('0x4')]),_0x302eb4);utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x302eb4['uniqueid'],agents[_0x302eb4[_0xfa74('0x11')]]['membername'],_0x302eb4['destuniqueid']));agents[_0x302eb4['destuniqueid']][_0xfa74('0x18')]=!![];agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x1b')]=utils['now']();agents[_0x302eb4['destuniqueid']][_0xfa74('0x8')]=_0xfa74('0x1c');agents[_0x302eb4['destuniqueid']][_0xfa74('0x1d')]='timeout';agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x1e')]=_0x302eb4['ringtime']?parseInt(_0x302eb4[_0xfa74('0x1f')])/0x3e8:0x0;agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x20')]=0x0;unanswered[_0xfa74('0x21')](_0x302eb4['destuniqueid']);}}catch(_0xd9c55d){utils[_0xfa74('0x17')](util[_0xfa74('0x2')]('[%s][agents][agentringnoanswer]',_0x302eb4['uniqueid']),_0xd9c55d);}};exports[_0xfa74('0x22')]=function(_0x8b706e){try{_['forIn'](agents,function(_0x4b38fc,_0x343466){if(_0x4b38fc['uniqueid']==_0x8b706e[_0xfa74('0x4')]&&!_['includes'](unanswered,_0x4b38fc[_0xfa74('0x11')])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x24'),_0x8b706e['uniqueid']),_0x8b706e);utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x25'),_0x8b706e[_0xfa74('0x4')],_0x4b38fc[_0xfa74('0x16')],_0x4b38fc[_0xfa74('0x11')]));_0x4b38fc[_0xfa74('0x18')]=!![];_0x4b38fc['agentringnoanswerAt']=utils[_0xfa74('0x14')]();_0x4b38fc['lastevent']=_0xfa74('0x26');_0x4b38fc[_0xfa74('0x1d')]=_0xfa74('0x26');_0x4b38fc[_0xfa74('0x1e')]=_0x8b706e['holdtime'];_0x4b38fc['talktime']=0x0;writeDB(_0x4b38fc);}});}catch(_0x390ed4){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x24'),_0x8b706e['uniqueid']),_0x390ed4);}};exports[_0xfa74('0x27')]=function(_0x231698){try{if(agents[_0x231698['destuniqueid']]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x231698['uniqueid']),_0x231698);utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x28'),_0x231698[_0xfa74('0x4')],agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x16')],_0x231698[_0xfa74('0x11')]));agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x29')]=utils['now']();agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x7')]=_0x231698[_0xfa74('0x7')];agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x2a')]=_0x231698[_0xfa74('0x2a')];agents[_0x231698['destuniqueid']][_0xfa74('0x1e')]=_0x231698[_0xfa74('0x1f')];agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x8')]='connect';_[_0xfa74('0x2b')](agents,function(_0x13d9a5,_0xe8491b){if(_0x13d9a5[_0xfa74('0x11')]!=_0x231698['destuniqueid']&&_0x13d9a5[_0xfa74('0x4')]==_0x231698[_0xfa74('0x4')]){_0x13d9a5[_0xfa74('0x20')]=0x0;_0x13d9a5['holdtime']=_0x231698['ringtime'];_0x13d9a5[_0xfa74('0x18')]=!![];_0x13d9a5[_0xfa74('0x1b')]=utils[_0xfa74('0x14')]();_0x13d9a5[_0xfa74('0x8')]='answered_elsewhere';_0x13d9a5[_0xfa74('0x1d')]=_0xfa74('0x2c');_0x13d9a5['answeredelsewheredestinationuniqueid']=_0x231698['destuniqueid'];_0x13d9a5['answeredelsewheremembername']=_0x231698['membername'];writeDB(_0x13d9a5);}});}}catch(_0x95c891){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x2d'),_0x231698[_0xfa74('0x4')]),_0x95c891);}};exports[_0xfa74('0x2e')]=function(_0x7735c5){try{if(!_['isNil'](agents[_0x7735c5[_0xfa74('0x11')]])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x2f'),_0x7735c5[_0xfa74('0x4')]),_0x7735c5);utils['info'](util[_0xfa74('0x2')](_0xfa74('0x30'),_0x7735c5[_0xfa74('0x4')],agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x16')],_0x7735c5[_0xfa74('0x11')]));agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x2e')]=!![];agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x31')]=utils['now']();agents[_0x7735c5[_0xfa74('0x11')]]['talktime']=utils[_0xfa74('0x32')](agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x31')],agents[_0x7735c5[_0xfa74('0x11')]]['agentconnectAt']);agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x1d')]=_0x7735c5['reason'];agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x8')]='complete';writeDB(agents[_0x7735c5[_0xfa74('0x11')]]);}}catch(_0x134d95){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x2f'),_0x7735c5['uniqueid']),_0x134d95);}};exports['blindtransfer']=function(_0x36f6ca){try{if(!_[_0xfa74('0x19')](agents[_0x36f6ca['transfereruniqueid']])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x33'),_0x36f6ca['uniqueid']),_0x36f6ca);utils['info'](util[_0xfa74('0x2')](_0xfa74('0x34'),_0x36f6ca[_0xfa74('0x4')],agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x16')],agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x4')]));agents[_0x36f6ca[_0xfa74('0x35')]]['transfer']=!![];agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x36')]=_0xfa74('0x37');agents[_0x36f6ca[_0xfa74('0x35')]]['transferexten']=_0x36f6ca['extension'];agents[_0x36f6ca[_0xfa74('0x35')]]['transferuniqueid']=agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x4')];}}catch(_0x427469){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x33'),_0x36f6ca[_0xfa74('0x4')]),_0x427469);}};exports['attendedtransfer']=function(_0x118cfc){try{utils['debug'](util[_0xfa74('0x2')]('[%s][agents][attendedtransfer]',_0x118cfc['origtransfereruniqueid']),_0x118cfc);if(_0x118cfc[_0xfa74('0x38')]==_0x118cfc[_0xfa74('0x39')]){if(!_['isNil'](agents[_0x118cfc['secondtransfereruniqueid']])){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3a'),_0x118cfc[_0xfa74('0x38')],agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x16')]));agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x3c')]=!![];agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x36')]='ATTENDED';agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x3d')]=_0x118cfc['origtransfererexten'];agents[_0x118cfc['secondtransfereruniqueid']][_0xfa74('0x3e')]=_0x118cfc[_0xfa74('0x38')];}if(_0x118cfc[_0xfa74('0x3f')]&&agents[_0x118cfc[_0xfa74('0x3f')]]){agents[_0x118cfc[_0xfa74('0x3f')]]['agententerreason']=0x1;transfers[_0x118cfc[_0xfa74('0x3f')]]=_['clone'](agents[_0x118cfc[_0xfa74('0x3f')]]);transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x6')]=agents[_0x118cfc['secondtransfereruniqueid']]['calleridnum'];transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x40')]=agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x40')];transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x41')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x29')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x1e')]=0x0;transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x42')]=0x2;}}else if(_0x118cfc['secondtransfereruniqueid']==_0x118cfc[_0xfa74('0x43')]){if(!_[_0xfa74('0x19')](agents[_0x118cfc[_0xfa74('0x38')]])){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3a'),_0x118cfc[_0xfa74('0x38')],agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x16')]));agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x3c')]=!![];agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x36')]=_0xfa74('0x44');agents[_0x118cfc[_0xfa74('0x38')]]['transferexten']=_0x118cfc[_0xfa74('0x45')];agents[_0x118cfc[_0xfa74('0x38')]]['transferuniqueid']=_0x118cfc['secondtransfereruniqueid'];}if(_0x118cfc[_0xfa74('0x46')]&&agents[_0x118cfc['transfertargetuniqueid']]){agents[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x42')]=0x1;transfers[_0x118cfc[_0xfa74('0x46')]]=_['clone'](agents[_0x118cfc[_0xfa74('0x46')]]);transfers[_0x118cfc['transfertargetuniqueid']]['calleridnum']=agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x6')];transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x40')]=agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x40')];transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x41')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x29')]=utils['now']();transfers[_0x118cfc[_0xfa74('0x46')]]['holdtime']=0x0;transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x42')]=0x2;}}}catch(_0x15b586){utils['error'](util[_0xfa74('0x2')](_0xfa74('0x47'),_0x118cfc[_0xfa74('0x38')]),_0x15b586);}};exports['hangup']=function(_0x1b8c06){try{utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x48'),_0x1b8c06[_0xfa74('0x4')]),_0x1b8c06);if(agents[_0x1b8c06['uniqueid']]&&agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')]===_0xfa74('0x1c')){if(_0x1b8c06[_0xfa74('0x49')]==='21'){agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')]=_0xfa74('0x4a');agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]=_0xfa74('0x4a');}utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1b8c06[_0xfa74('0x4')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]));writeDB(agents[_0x1b8c06[_0xfa74('0x4')]]);var _0x491529=unanswered[_0xfa74('0x4b')](_0x1b8c06[_0xfa74('0x4')]);if(_0x491529>-0x1){unanswered[_0xfa74('0x4c')](_0x491529,0x1);}}if(transfers[_0x1b8c06[_0xfa74('0x4')]]){transfers[_0x1b8c06['uniqueid']][_0xfa74('0x2e')]=!![];transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')]=utils[_0xfa74('0x14')]();transfers[_0x1b8c06['uniqueid']][_0xfa74('0x20')]=utils['diffTime'](transfers[_0x1b8c06['uniqueid']][_0xfa74('0x31')],transfers[_0x1b8c06['uniqueid']][_0xfa74('0x29')]);transfers[_0x1b8c06[_0xfa74('0x4')]]['reason']='agent';transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]=_0xfa74('0x4d');utils[_0xfa74('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1b8c06['uniqueid'],transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')],transfers[_0x1b8c06[_0xfa74('0x4')]]['lastevent']));writeDB(transfers[_0x1b8c06[_0xfa74('0x4')]],!![]);}if(agents[_0x1b8c06[_0xfa74('0x4')]]&&agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x29')]){agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x2e')]=!![];agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')]=utils[_0xfa74('0x14')]();agents[_0x1b8c06['uniqueid']]['talktime']=utils['diffTime'](agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x29')]);agents[_0x1b8c06[_0xfa74('0x4')]]['reason']=agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x3c')]?'transfer':_0xfa74('0x4e');agents[_0x1b8c06['uniqueid']][_0xfa74('0x8')]=_0xfa74('0x4d');utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x4f'),_0x1b8c06[_0xfa74('0x4')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],agents[_0x1b8c06['uniqueid']]['reason'],agents[_0x1b8c06['uniqueid']][_0xfa74('0x8')]));writeDB(agents[_0x1b8c06[_0xfa74('0x4')]]);}}catch(_0x4d46e1){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x48'),_0x1b8c06[_0xfa74('0x4')]),_0x4d46e1);}}; \ No newline at end of file +var _0x6f7a=['indexOf','splice','agent','complete','diffTime','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','error','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcomplete','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x571ee6,_0x404c04){_0x571ee6=_0x571ee6-0x0;var _0x4280a7=_0x6f7a[_0x571ee6];return _0x4280a7;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var utils=require(_0xa6f7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x982062,_0x4dd99d){utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')](_0xa6f7('0x5'),_0x982062[_0xa6f7('0x6')],_0x982062[_0xa6f7('0x7')],_0x982062[_0xa6f7('0x8')],_0x982062[_0xa6f7('0x9')],_0x982062[_0xa6f7('0xa')],_0x982062[_0xa6f7('0xb')],_0x982062[_0xa6f7('0xc')],_0x982062[_0xa6f7('0xd')]));if(_0x982062['queue']){utils['getVoiceQueueByName'](_0x982062[_0xa6f7('0x8')])[_0xa6f7('0xe')](function(_0x397020){if(_0x397020){_0x982062[_0xa6f7('0xf')]=_0x397020[_0xa6f7('0xf')];_0x982062['agentacw']=_0x982062['agentcomplete']?_0x397020[_0xa6f7('0x10')]:![];_0x982062[_0xa6f7('0x11')]=_0x982062['agentacw']?_0x397020[_0xa6f7('0x12')]:0x0;}utils['request'](_0xa6f7('0x13'),_0x982062);});}else{utils[_0xa6f7('0x14')](_0xa6f7('0x13'),_0x982062);}if(_0x4dd99d){delete transfers[_0x982062[_0xa6f7('0x6')]];}else{delete agents[_0x982062['destuniqueid']];}}exports[_0xa6f7('0x15')]=function(_0x532352){try{utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')](_0xa6f7('0x17'),_0x532352['uniqueid']),_0x532352);agents[_0x532352[_0xa6f7('0x18')]]=_0x532352;agents[_0x532352['destuniqueid']][_0xa6f7('0x19')]=utils['now']();agents[_0x532352[_0xa6f7('0x18')]][_0xa6f7('0xd')]=_0xa6f7('0x1a');agents[_0x532352['destuniqueid']][_0xa6f7('0xc')]=null;agents[_0x532352[_0xa6f7('0x18')]][_0xa6f7('0x1b')]=null;utils[_0xa6f7('0x3')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x532352[_0xa6f7('0x6')],agents[_0x532352['destuniqueid']][_0xa6f7('0x9')],_0x532352[_0xa6f7('0x18')]));}catch(_0x5d16d0){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x17'),_0x532352[_0xa6f7('0x6')]),_0x5d16d0);}};exports[_0xa6f7('0x1d')]=function(_0x1aa8dc){try{if(!_['isNil'](agents[_0x1aa8dc[_0xa6f7('0x18')]])){utils[_0xa6f7('0x16')](util['format']('[%s][agents][agentringnoanswer]',_0x1aa8dc['uniqueid']),_0x1aa8dc);utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1aa8dc['uniqueid'],agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0x9')],_0x1aa8dc[_0xa6f7('0x18')]));agents[_0x1aa8dc[_0xa6f7('0x18')]]['agentringnoanswer']=!![];agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0x1e')]=utils['now']();agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0xd')]='timeout';agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x1f')]=_0xa6f7('0x20');agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x21')]=_0x1aa8dc['ringtime']?parseInt(_0x1aa8dc['ringtime'])/0x3e8:0x0;agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x22')]=0x0;unanswered['push'](_0x1aa8dc[_0xa6f7('0x18')]);}}catch(_0x27babb){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x23'),_0x1aa8dc[_0xa6f7('0x6')]),_0x27babb);}};exports[_0xa6f7('0x24')]=function(_0x54f72c){try{_[_0xa6f7('0x25')](agents,function(_0x3dee2e,_0x40b0f8){if(_0x3dee2e[_0xa6f7('0x6')]==_0x54f72c['uniqueid']&&!_[_0xa6f7('0x26')](unanswered,_0x3dee2e[_0xa6f7('0x18')])){utils['debug'](util[_0xa6f7('0x4')](_0xa6f7('0x27'),_0x54f72c['uniqueid']),_0x54f72c);utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x28'),_0x54f72c[_0xa6f7('0x6')],_0x3dee2e[_0xa6f7('0x9')],_0x3dee2e[_0xa6f7('0x18')]));_0x3dee2e['agentringnoanswer']=!![];_0x3dee2e['agentringnoanswerAt']=utils[_0xa6f7('0x29')]();_0x3dee2e['lastevent']=_0xa6f7('0x2a');_0x3dee2e[_0xa6f7('0x1f')]=_0xa6f7('0x2a');_0x3dee2e[_0xa6f7('0x21')]=_0x54f72c[_0xa6f7('0x21')];_0x3dee2e[_0xa6f7('0x22')]=0x0;writeDB(_0x3dee2e);}});}catch(_0x4d2d38){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x27'),_0x54f72c['uniqueid']),_0x4d2d38);}};exports[_0xa6f7('0x2b')]=function(_0x5ab03d){try{if(agents[_0x5ab03d[_0xa6f7('0x18')]]){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][agentconnect]',_0x5ab03d[_0xa6f7('0x6')]),_0x5ab03d);utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')](_0xa6f7('0x2c'),_0x5ab03d[_0xa6f7('0x6')],agents[_0x5ab03d[_0xa6f7('0x18')]]['membername'],_0x5ab03d[_0xa6f7('0x18')]));agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0x2d')]=utils[_0xa6f7('0x29')]();agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0xc')]=_0x5ab03d[_0xa6f7('0xc')];agents[_0x5ab03d[_0xa6f7('0x18')]]['connectedlinename']=_0x5ab03d[_0xa6f7('0x1b')];agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0x21')]=_0x5ab03d['ringtime'];agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0xd')]='connect';_[_0xa6f7('0x25')](agents,function(_0x13c7c4,_0x3ecb88){if(_0x13c7c4[_0xa6f7('0x18')]!=_0x5ab03d[_0xa6f7('0x18')]&&_0x13c7c4['uniqueid']==_0x5ab03d[_0xa6f7('0x6')]){_0x13c7c4[_0xa6f7('0x22')]=0x0;_0x13c7c4[_0xa6f7('0x21')]=_0x5ab03d[_0xa6f7('0x2e')];_0x13c7c4[_0xa6f7('0x1d')]=!![];_0x13c7c4[_0xa6f7('0x1e')]=utils[_0xa6f7('0x29')]();_0x13c7c4[_0xa6f7('0xd')]='answered_elsewhere';_0x13c7c4['reason']=_0xa6f7('0x2f');_0x13c7c4[_0xa6f7('0x30')]=_0x5ab03d[_0xa6f7('0x18')];_0x13c7c4[_0xa6f7('0x31')]=_0x5ab03d[_0xa6f7('0x9')];writeDB(_0x13c7c4);}});}}catch(_0x387714){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x32'),_0x5ab03d[_0xa6f7('0x6')]),_0x387714);}};exports['agentcomplete']=function(_0x41917c){try{if(!_[_0xa6f7('0x33')](agents[_0x41917c['destuniqueid']])){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')](_0xa6f7('0x34'),_0x41917c[_0xa6f7('0x6')]),_0x41917c);utils['info'](util[_0xa6f7('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x41917c['uniqueid'],agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x9')],_0x41917c[_0xa6f7('0x18')]));agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x35')]=!![];agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x36')]=utils['now']();agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x22')]=utils['diffTime'](agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x36')],agents[_0x41917c[_0xa6f7('0x18')]]['agentconnectAt']);agents[_0x41917c[_0xa6f7('0x18')]]['reason']=_0x41917c[_0xa6f7('0x1f')];agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0xd')]='complete';writeDB(agents[_0x41917c['destuniqueid']]);}}catch(_0x2b06b5){utils['error'](util[_0xa6f7('0x4')]('[%s][agents][agentcomplete]',_0x41917c['uniqueid']),_0x2b06b5);}};exports[_0xa6f7('0x37')]=function(_0x2e3a04){try{if(!_[_0xa6f7('0x33')](agents[_0x2e3a04[_0xa6f7('0x38')]])){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][blindtransfer]',_0x2e3a04[_0xa6f7('0x6')]),_0x2e3a04);utils[_0xa6f7('0x3')](util['format'](_0xa6f7('0x39'),_0x2e3a04['uniqueid'],agents[_0x2e3a04[_0xa6f7('0x38')]]['membername'],agents[_0x2e3a04['transfereruniqueid']][_0xa6f7('0x6')]));agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3a')]=!![];agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3b')]='blind';agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3c')]=_0x2e3a04['extension'];agents[_0x2e3a04[_0xa6f7('0x38')]]['transferuniqueid']=agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x6')];}}catch(_0x134dd7){utils['error'](util[_0xa6f7('0x4')]('[%s][agents][blindtransfer]',_0x2e3a04[_0xa6f7('0x6')]),_0x134dd7);}};exports[_0xa6f7('0x3d')]=function(_0x236372){try{utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][attendedtransfer]',_0x236372['origtransfereruniqueid']),_0x236372);if(_0x236372[_0xa6f7('0x3e')]==_0x236372[_0xa6f7('0x3f')]){if(!_[_0xa6f7('0x33')](agents[_0x236372[_0xa6f7('0x40')]])){utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x41'),_0x236372[_0xa6f7('0x3e')],agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x9')]));agents[_0x236372[_0xa6f7('0x40')]]['transfer']=!![];agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x3b')]=_0xa6f7('0x42');agents[_0x236372['secondtransfereruniqueid']][_0xa6f7('0x3c')]=_0x236372[_0xa6f7('0x43')];agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x44')]=_0x236372['origtransfereruniqueid'];}if(_0x236372['transfereeuniqueid']&&agents[_0x236372[_0xa6f7('0x45')]]){agents[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x46')]=0x1;transfers[_0x236372[_0xa6f7('0x45')]]=_[_0xa6f7('0x47')](agents[_0x236372[_0xa6f7('0x45')]]);transfers[_0x236372[_0xa6f7('0x45')]]['calleridnum']=agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0xb')];transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x48')]=agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x48')];transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x19')]=utils[_0xa6f7('0x29')]();transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x2d')]=utils['now']();transfers[_0x236372[_0xa6f7('0x45')]]['holdtime']=0x0;transfers[_0x236372[_0xa6f7('0x45')]]['agententerreason']=0x2;}}else if(_0x236372[_0xa6f7('0x40')]==_0x236372[_0xa6f7('0x49')]){if(!_['isNil'](agents[_0x236372[_0xa6f7('0x3e')]])){utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x236372[_0xa6f7('0x3e')],agents[_0x236372['origtransfereruniqueid']][_0xa6f7('0x9')]));agents[_0x236372[_0xa6f7('0x3e')]]['transfer']=!![];agents[_0x236372[_0xa6f7('0x3e')]]['transfertype']=_0xa6f7('0x42');agents[_0x236372['origtransfereruniqueid']][_0xa6f7('0x3c')]=_0x236372[_0xa6f7('0x4a')];agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0x44')]=_0x236372[_0xa6f7('0x40')];}if(_0x236372[_0xa6f7('0x4b')]&&agents[_0x236372[_0xa6f7('0x4b')]]){agents[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x46')]=0x1;transfers[_0x236372[_0xa6f7('0x4b')]]=_[_0xa6f7('0x47')](agents[_0x236372[_0xa6f7('0x4b')]]);transfers[_0x236372['transfertargetuniqueid']][_0xa6f7('0xb')]=agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0xb')];transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x48')]=agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0x48')];transfers[_0x236372[_0xa6f7('0x4b')]]['agentcalledAt']=utils[_0xa6f7('0x29')]();transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x2d')]=utils['now']();transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x21')]=0x0;transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x46')]=0x2;}}}catch(_0x1a1055){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x4c'),_0x236372['origtransfereruniqueid']),_0x1a1055);}};exports['hangup']=function(_0x265194){try{utils[_0xa6f7('0x16')](util['format'](_0xa6f7('0x4d'),_0x265194[_0xa6f7('0x6')]),_0x265194);if(agents[_0x265194[_0xa6f7('0x6')]]&&agents[_0x265194['uniqueid']][_0xa6f7('0x1f')]==='timeout'){if(_0x265194['cause']==='21'){agents[_0x265194['uniqueid']]['reason']='rejected';agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]=_0xa6f7('0x4e');}utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x4f'),_0x265194[_0xa6f7('0x6')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]));writeDB(agents[_0x265194[_0xa6f7('0x6')]]);var _0x55ad6b=unanswered[_0xa6f7('0x50')](_0x265194[_0xa6f7('0x6')]);if(_0x55ad6b>-0x1){unanswered[_0xa6f7('0x51')](_0x55ad6b,0x1);}}if(transfers[_0x265194[_0xa6f7('0x6')]]){transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x35')]=!![];transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x36')]=utils[_0xa6f7('0x29')]();transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x22')]=utils['diffTime'](transfers[_0x265194['uniqueid']][_0xa6f7('0x36')],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]);transfers[_0x265194['uniqueid']][_0xa6f7('0x1f')]=_0xa6f7('0x52');transfers[_0x265194['uniqueid']][_0xa6f7('0xd')]=_0xa6f7('0x53');utils['info'](util['format'](_0xa6f7('0x4f'),_0x265194['uniqueid'],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],transfers[_0x265194['uniqueid']]['reason'],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]));writeDB(transfers[_0x265194[_0xa6f7('0x6')]],!![]);}if(agents[_0x265194['uniqueid']]&&agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]){agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x35')]=!![];agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x36')]=utils[_0xa6f7('0x29')]();agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x22')]=utils[_0xa6f7('0x54')](agents[_0x265194[_0xa6f7('0x6')]]['agentcompleteAt'],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]);agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')]=agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x3a')]?'transfer':_0xa6f7('0x52');agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]=_0xa6f7('0x53');utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x265194['uniqueid'],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')],agents[_0x265194[_0xa6f7('0x6')]]['lastevent']));writeDB(agents[_0x265194[_0xa6f7('0x6')]]);}}catch(_0x4c7383){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')]('[%s][agents][hangup]',_0x265194['uniqueid']),_0x4c7383);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b69b8a9..80c5c13 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 _0x9541=['channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','split','substring','lastIndexOf','noop','execif','set','gotoif','lastapplication','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','calleridnum','lastevent','then','UserId','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','accountcode','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil'];(function(_0x15ddf6,_0x3fe1a3){var _0x2271ef=function(_0x12d3de){while(--_0x12d3de){_0x15ddf6['push'](_0x15ddf6['shift']());}};_0x2271ef(++_0x3fe1a3);}(_0x9541,0xb3));var _0x1954=function(_0x2cf8ee,_0x34b72f){_0x2cf8ee=_0x2cf8ee-0x0;var _0x44b42b=_0x9541[_0x2cf8ee];return _0x44b42b;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var utils=require(_0x1954('0x2'));var transfers=require(_0x1954('0x3'));var dispositions=[_0x1954('0x4'),_0x1954('0x5'),_0x1954('0x5'),_0x1954('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0x1954('0x6'),_0x1954('0x7'),'FAILED',_0x1954('0x5'),_0x1954('0x5')];var channels={};function writeDB(_0x30beea){var _0x2ccff8;if(transfers[_0x1954('0x8')][_0x30beea[_0x1954('0x9')]]){_0x2ccff8=_0x30beea['uniqueid'];_0x30beea[_0x1954('0x9')]=transfers[_0x1954('0x8')][_0x30beea[_0x1954('0x9')]][_0x1954('0xa')];}utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0xd'),_0x30beea[_0x1954('0x9')],_0x30beea['channel'],_0x30beea[_0x1954('0xe')],_0x30beea[_0x1954('0xf')],_0x30beea['interface'],_0x30beea[_0x1954('0x10')],_0x30beea['connectedlinenum'],_0x30beea[_0x1954('0x11')]));if(_0x30beea['accountcode']){utils['getUserByInternal'](_0x30beea['accountcode'])[_0x1954('0x12')](function(_0x1b33cb){if(_0x1b33cb){_0x30beea[_0x1954('0x13')]=_0x1b33cb['id'];}utils['request'](_0x1954('0x14'),_0x30beea);});}else{utils['request']('CreateVoiceCallReport',_0x30beea);}if(channels[_0x30beea[_0x1954('0x9')]]){delete channels[_0x30beea[_0x1954('0x9')]];}else if(_0x2ccff8&&channels[_0x2ccff8]){if(!transfers[_0x1954('0x8')][_0x2ccff8][_0x1954('0x15')])delete transfers[_0x1954('0x8')][_0x2ccff8];delete channels[_0x2ccff8];}}exports[_0x1954('0x16')]=function(_0x166641){try{utils[_0x1954('0x17')](util[_0x1954('0xc')](_0x1954('0x18'),_0x166641[_0x1954('0x9')]),_0x166641);if(_0x166641[_0x1954('0x9')]==_0x166641[_0x1954('0x19')]&&_0x166641[_0x1954('0x1a')]!=_0x1954('0x1b')){utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0x1c'),_0x166641[_0x1954('0x9')],_0x166641[_0x1954('0x1d')],_0x166641['exten']));channels[_0x166641[_0x1954('0x9')]]={'uniqueid':_0x166641[_0x1954('0x9')],'accountcode':_0x166641[_0x1954('0x1e')],'source':_0x166641[_0x1954('0x10')],'destination':_0x166641[_0x1954('0x1f')],'destinationcontext':_0x166641['context'],'channel':_0x166641[_0x1954('0x1a')],'starttime':utils[_0x1954('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1954('0x4'),'amaflags':_0x1954('0x21')};}}catch(_0x6d8a2){utils['error'](util['format'](_0x1954('0x18'),_0x166641[_0x1954('0x9')]),_0x6d8a2);}};exports[_0x1954('0x22')]=function(_0x406699){try{utils['debug'](util[_0x1954('0xc')](_0x1954('0x23'),_0x406699[_0x1954('0x9')]),_0x406699);if(!_[_0x1954('0x24')](channels[_0x406699[_0x1954('0x9')]])&&_0x406699[_0x1954('0x25')]==0x6){utils[_0x1954('0xb')](util['format'](_0x1954('0x26'),_0x406699[_0x1954('0x9')],_0x406699['context'],_0x406699[_0x1954('0x1a')]));if(_[_0x1954('0x24')](channels[_0x406699[_0x1954('0x9')]][_0x1954('0x27')])){channels[_0x406699[_0x1954('0x9')]][_0x1954('0x27')]=utils[_0x1954('0x20')]();}}else if(!_[_0x1954('0x24')](channels[_0x406699[_0x1954('0x19')]])&&_0x406699[_0x1954('0x25')]==0x6&&_0x406699[_0x1954('0x1d')]!=_0x1954('0x28')){utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0x29'),_0x406699[_0x1954('0x9')],_0x406699[_0x1954('0x19')],_0x406699[_0x1954('0x1d')],_0x406699[_0x1954('0x1a')]));channels[_0x406699[_0x1954('0x19')]][_0x1954('0x1e')]=_0x406699[_0x1954('0x1e')];channels[_0x406699[_0x1954('0x19')]][_0x1954('0x2a')]=_0x406699['channel'];if(_['isNil'](channels[_0x406699[_0x1954('0x19')]]['answertime'])){channels[_0x406699[_0x1954('0x19')]][_0x1954('0x2b')]=utils['now']();}channels[_0x406699[_0x1954('0x19')]][_0x1954('0x2c')]=dispositions[_['toNumber'](_0x406699['channelstate'])]||_0x1954('0x6');}}catch(_0x17cef4){utils[_0x1954('0x2d')](util[_0x1954('0xc')](_0x1954('0x23'),_0x406699[_0x1954('0x9')]),_0x17cef4);}};exports[_0x1954('0x2e')]=function(_0x501135){try{if(!_['isNil'](channels[_0x501135[_0x1954('0x9')]])){utils[_0x1954('0x17')](util[_0x1954('0xc')](_0x1954('0x2f'),_0x501135[_0x1954('0x9')]),_0x501135);if(_[_0x1954('0x24')](channels[_0x501135['uniqueid']][_0x1954('0x30')])){channels[_0x501135[_0x1954('0x9')]]['callerid']=_0x501135[_0x1954('0x31')]+'\x20<'+_0x501135[_0x1954('0x10')]+'>';}utils['info'](util['format'](_0x1954('0x32'),_0x501135[_0x1954('0x9')],channels[_0x501135['uniqueid']][_0x1954('0x30')],_0x501135[_0x1954('0x33')]));channels[_0x501135[_0x1954('0x9')]][_0x1954('0x34')]=utils['now']();channels[_0x501135[_0x1954('0x9')]]['duration']=utils[_0x1954('0x35')](channels[_0x501135[_0x1954('0x9')]][_0x1954('0x34')],channels[_0x501135['uniqueid']][_0x1954('0x36')]);channels[_0x501135[_0x1954('0x9')]][_0x1954('0x37')]=channels[_0x501135[_0x1954('0x9')]][_0x1954('0x2b')]?utils['diffTime'](channels[_0x501135[_0x1954('0x9')]]['endtime'],channels[_0x501135[_0x1954('0x9')]]['answertime']):0x0;writeDB(channels[_0x501135[_0x1954('0x9')]]);}}catch(_0x11b14c){utils[_0x1954('0x2d')](util[_0x1954('0xc')]('[%s][calls][hangup]',_0x501135[_0x1954('0x9')]),_0x11b14c);}};exports['attendedtransfer']=function(_0x22e0bc){try{if(!_[_0x1954('0x24')](channels[_0x22e0bc['localtwolinkedid']])){utils[_0x1954('0x17')](util[_0x1954('0xc')](_0x1954('0x38'),_0x22e0bc[_0x1954('0x39')]),_0x22e0bc);if(channels[_0x22e0bc[_0x1954('0x3a')]][_0x1954('0x1a')]==_0x22e0bc[_0x1954('0x3b')]){utils[_0x1954('0xb')](util[_0x1954('0xc')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x22e0bc['origtransfereruniqueid'],_0x22e0bc['localtwolinkedid'],_0x22e0bc[_0x1954('0x3c')]));channels[_0x22e0bc['localtwolinkedid']][_0x1954('0x2a')]=_0x22e0bc[_0x1954('0x3c')];channels[_0x22e0bc[_0x1954('0x3a')]][_0x1954('0x3d')]=_0x1954('0x3e');}else if(channels[_0x22e0bc[_0x1954('0x3a')]][_0x1954('0x1a')]=_0x22e0bc[_0x1954('0x3f')]){utils[_0x1954('0xb')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x22e0bc[_0x1954('0x39')],_0x22e0bc['localtwolinkedid'],_0x22e0bc[_0x1954('0x40')]));channels[_0x22e0bc['localtwolinkedid']][_0x1954('0x2a')]=_0x22e0bc[_0x1954('0x40')];channels[_0x22e0bc[_0x1954('0x3a')]][_0x1954('0x3d')]=_0x1954('0x3e');}}}catch(_0xca432a){utils[_0x1954('0x2d')](util[_0x1954('0xc')](_0x1954('0x38'),_0x22e0bc[_0x1954('0x39')]),_0xca432a);}};exports['musiconholdstart']=function(_0x3267eb){try{if(!_[_0x1954('0x24')](channels[_0x3267eb[_0x1954('0x9')]])){utils[_0x1954('0x17')](util['format'](_0x1954('0x41'),_0x3267eb[_0x1954('0x9')]),_0x3267eb);channels[_0x3267eb['uniqueid']][_0x1954('0x42')]=utils['now']();utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0x43'),_0x3267eb[_0x1954('0x9')],channels[_0x3267eb[_0x1954('0x9')]][_0x1954('0x42')]));}}catch(_0x4e9240){utils['error'](util[_0x1954('0xc')]('[%s][calls][musiconholdstart]',_0x3267eb[_0x1954('0x9')]),_0x4e9240);}};exports[_0x1954('0x44')]=function(_0x411eaf){try{if(!_['isNil'](channels[_0x411eaf[_0x1954('0x9')]])){utils[_0x1954('0x17')](util[_0x1954('0xc')](_0x1954('0x45'),_0x411eaf[_0x1954('0x9')]),_0x411eaf);if(!_['isNil'](channels[_0x411eaf[_0x1954('0x9')]][_0x1954('0x42')])){channels[_0x411eaf[_0x1954('0x9')]][_0x1954('0x46')]+=utils[_0x1954('0x35')](utils['now'](),channels[_0x411eaf[_0x1954('0x9')]][_0x1954('0x42')]);utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0x47'),_0x411eaf[_0x1954('0x9')],channels[_0x411eaf[_0x1954('0x9')]][_0x1954('0x46')]));delete channels[_0x411eaf[_0x1954('0x9')]]['musiconholdstartAt'];}}}catch(_0x1176d8){utils[_0x1954('0x2d')](util[_0x1954('0xc')](_0x1954('0x45'),_0x411eaf[_0x1954('0x9')]),_0x1176d8);}};exports[_0x1954('0x48')]=function(_0x1fa09b){try{if(!_[_0x1954('0x24')](channels[_0x1fa09b[_0x1954('0x9')]])){utils[_0x1954('0x17')](util[_0x1954('0xc')](_0x1954('0x49'),_0x1fa09b[_0x1954('0x9')]),_0x1fa09b);if(!_[_0x1954('0x24')](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x4b')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1fa09b['uniqueid'],_0x1fa09b[_0x1954('0x4c')]));channels[_0x1fa09b['uniqueid']]['source']=_0x1fa09b[_0x1954('0x4c')];}if(!_[_0x1954('0x24')](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x4d')])){utils[_0x1954('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1fa09b[_0x1954('0x9')],_0x1fa09b[_0x1954('0x4c')]));channels[_0x1fa09b[_0x1954('0x9')]][_0x1954('0x4e')]=_0x1fa09b[_0x1954('0x4c')];channels[_0x1fa09b[_0x1954('0x9')]][_0x1954('0x30')]='\x22'+_0x1fa09b[_0x1954('0x4c')]+_0x1954('0x4f')+_0x1fa09b['value']+'>';}if(!_[_0x1954('0x24')](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x50')])||!_['isNil'](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x51')])){utils[_0x1954('0xb')](util['format'](_0x1954('0x52'),_0x1fa09b['uniqueid'],!_[_0x1954('0x24')](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x50')])?_0x1954('0x50'):_0x1954('0x51'),_0x1fa09b[_0x1954('0x4c')]));channels[_0x1fa09b[_0x1954('0x9')]][_0x1954('0x30')]=_0x1fa09b[_0x1954('0x4c')];}if(!_['isNil'](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x53')])||!_['isNil'](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x54')])){utils[_0x1954('0xb')](util[_0x1954('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1fa09b[_0x1954('0x9')],!_[_0x1954('0x24')](_0x1fa09b[_0x1954('0x4a')][_0x1954('0x53')])?_0x1954('0x53'):_0x1954('0x54'),_0x1fa09b[_0x1954('0x4c')]));channels[_0x1fa09b[_0x1954('0x9')]]['lastapplication']='Queue';channels[_0x1fa09b[_0x1954('0x9')]]['lastdata']=_0x1fa09b[_0x1954('0x4c')];channels[_0x1fa09b['uniqueid']][_0x1954('0xe')]=!![];}if(!_[_0x1954('0x24')](_0x1fa09b[_0x1954('0x4a')]['xmd-contactid'])){utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0x55'),_0x1fa09b['uniqueid'],_0x1fa09b['value']));channels[_0x1fa09b[_0x1954('0x9')]][_0x1954('0x56')]=_0x1fa09b[_0x1954('0x4c')];}if(!_[_0x1954('0x24')](_0x1fa09b['variable'][_0x1954('0x57')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1fa09b[_0x1954('0x9')],_0x1fa09b[_0x1954('0x4c')]));channels[_0x1fa09b[_0x1954('0x9')]][_0x1954('0x58')]=_0x1fa09b['value'];}if(!_[_0x1954('0x24')](_0x1fa09b[_0x1954('0x4a')]['outboundrouteid'])){utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0x59'),_0x1fa09b[_0x1954('0x9')],_0x1fa09b[_0x1954('0x4c')]));channels[_0x1fa09b['uniqueid']][_0x1954('0x5a')]=_0x1fa09b[_0x1954('0x4c')];}if(!_['isNil'](_0x1fa09b['variable'][_0x1954('0x5b')])){utils[_0x1954('0xb')](util['format'](_0x1954('0x5c'),_0x1fa09b[_0x1954('0x9')],_0x1fa09b[_0x1954('0x4c')]));channels[_0x1fa09b['uniqueid']][_0x1954('0x5b')]=_0x1fa09b[_0x1954('0x4c')];}}}catch(_0x3b039d){utils[_0x1954('0x2d')](util[_0x1954('0xc')](_0x1954('0x49'),_0x1fa09b['uniqueid']),_0x3b039d);}};exports[_0x1954('0x5d')]=function(_0x1bfc1d){try{if(!_[_0x1954('0x24')](channels[_0x1bfc1d[_0x1954('0x9')]])){utils[_0x1954('0x17')](util[_0x1954('0xc')](_0x1954('0x5e'),_0x1bfc1d[_0x1954('0x9')]),_0x1bfc1d);utils[_0x1954('0xb')](util[_0x1954('0xc')](_0x1954('0x5f'),_0x1bfc1d[_0x1954('0x9')],_0x1bfc1d[_0x1954('0x60')],_0x1bfc1d[_0x1954('0x61')]));if(_0x1bfc1d[_0x1954('0x60')][_0x1954('0x62')]()=='set'&&_['startsWith'](_0x1bfc1d[_0x1954('0x61')][_0x1954('0x62')](),'cdr')){var _0x50fde6=_0x1bfc1d[_0x1954('0x61')][_0x1954('0x63')]('=');var _0x4adbb1=_0x50fde6[0x0][_0x1954('0x64')](_0x50fde6[0x0][_0x1954('0x65')]('(')+0x1,_0x50fde6[0x0][_0x1954('0x65')](')'));var _0x548d48=_0x50fde6[0x1];channels[_0x1bfc1d['uniqueid']][_0x4adbb1]=_0x548d48;}if(!_['includes'](['hangup',_0x1954('0x66'),_0x1954('0x67'),_0x1954('0x68'),_0x1954('0x69')],_0x1bfc1d[_0x1954('0x60')][_0x1954('0x62')]())){channels[_0x1bfc1d['uniqueid']][_0x1954('0x6a')]=_0x1bfc1d[_0x1954('0x60')];channels[_0x1bfc1d[_0x1954('0x9')]][_0x1954('0x6b')]=_0x1bfc1d['appdata'];}}}catch(_0x16c259){utils[_0x1954('0x2d')](util[_0x1954('0xc')](_0x1954('0x5e'),_0x1bfc1d[_0x1954('0x9')]),_0x16c259);}}; \ No newline at end of file +var _0x8825=['origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','includes','noop','gotoif','application','lastapplication','[%s][calls][newexten]','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','uniqueid','blinds','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','error','newstate','debug','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]'];(function(_0x7c7ec9,_0x152828){var _0x47f3d3=function(_0x580ce3){while(--_0x580ce3){_0x7c7ec9['push'](_0x7c7ec9['shift']());}};_0x47f3d3(++_0x152828);}(_0x8825,0x9e));var _0x5882=function(_0x5583c3,_0x1a02a1){_0x5583c3=_0x5583c3-0x0;var _0x5c02d1=_0x8825[_0x5583c3];return _0x5c02d1;};'use strict';var _=require('lodash');var util=require(_0x5882('0x0'));var utils=require(_0x5882('0x1'));var transfers=require(_0x5882('0x2'));var dispositions=['NO\x20ANSWER',_0x5882('0x3'),_0x5882('0x3'),_0x5882('0x4'),_0x5882('0x4'),_0x5882('0x4'),_0x5882('0x5'),_0x5882('0x6'),_0x5882('0x3'),_0x5882('0x3'),_0x5882('0x3')];var channels={};function writeDB(_0x11b03c){var _0x110780;if(transfers['blinds'][_0x11b03c[_0x5882('0x7')]]){_0x110780=_0x11b03c['uniqueid'];_0x11b03c[_0x5882('0x7')]=transfers[_0x5882('0x8')][_0x11b03c[_0x5882('0x7')]]['transfereeuniqueid'];}utils[_0x5882('0x9')](util[_0x5882('0xa')](_0x5882('0xb'),_0x11b03c['uniqueid'],_0x11b03c[_0x5882('0xc')],_0x11b03c['queue'],_0x11b03c[_0x5882('0xd')],_0x11b03c['interface'],_0x11b03c['calleridnum'],_0x11b03c[_0x5882('0xe')],_0x11b03c[_0x5882('0xf')]));if(_0x11b03c[_0x5882('0x10')]){utils[_0x5882('0x11')](_0x11b03c['accountcode'])[_0x5882('0x12')](function(_0x35516d){if(_0x35516d){_0x11b03c[_0x5882('0x13')]=_0x35516d['id'];}utils[_0x5882('0x14')](_0x5882('0x15'),_0x11b03c);});}else{utils[_0x5882('0x14')]('CreateVoiceCallReport',_0x11b03c);}if(channels[_0x11b03c[_0x5882('0x7')]]){delete channels[_0x11b03c[_0x5882('0x7')]];}else if(_0x110780&&channels[_0x110780]){if(!transfers[_0x5882('0x8')][_0x110780][_0x5882('0x16')])delete transfers['blinds'][_0x110780];delete channels[_0x110780];}}exports[_0x5882('0x17')]=function(_0x2d8798){try{utils['debug'](util[_0x5882('0xa')](_0x5882('0x18'),_0x2d8798[_0x5882('0x7')]),_0x2d8798);if(_0x2d8798[_0x5882('0x7')]==_0x2d8798[_0x5882('0x19')]&&_0x2d8798[_0x5882('0xc')]!='OutgoingSpoolFailed'){utils[_0x5882('0x9')](util[_0x5882('0xa')](_0x5882('0x1a'),_0x2d8798[_0x5882('0x7')],_0x2d8798[_0x5882('0x1b')],_0x2d8798[_0x5882('0x1c')]));channels[_0x2d8798[_0x5882('0x7')]]={'uniqueid':_0x2d8798[_0x5882('0x7')],'accountcode':_0x2d8798['accountcode'],'source':_0x2d8798[_0x5882('0x1d')],'destination':_0x2d8798[_0x5882('0x1c')],'destinationcontext':_0x2d8798[_0x5882('0x1b')],'channel':_0x2d8798[_0x5882('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5882('0x4'),'amaflags':_0x5882('0x1e')};}}catch(_0x501901){utils[_0x5882('0x1f')](util[_0x5882('0xa')](_0x5882('0x18'),_0x2d8798[_0x5882('0x7')]),_0x501901);}};exports[_0x5882('0x20')]=function(_0x261569){try{utils[_0x5882('0x21')](util[_0x5882('0xa')]('[%s][calls][newstate]',_0x261569[_0x5882('0x7')]),_0x261569);if(!_[_0x5882('0x22')](channels[_0x261569[_0x5882('0x7')]])&&_0x261569['channelstate']==0x6){utils[_0x5882('0x9')](util[_0x5882('0xa')](_0x5882('0x23'),_0x261569['uniqueid'],_0x261569[_0x5882('0x1b')],_0x261569['channel']));if(_[_0x5882('0x22')](channels[_0x261569[_0x5882('0x7')]][_0x5882('0x24')])){channels[_0x261569[_0x5882('0x7')]]['systemanswertime']=utils[_0x5882('0x25')]();}}else if(!_[_0x5882('0x22')](channels[_0x261569[_0x5882('0x19')]])&&_0x261569[_0x5882('0x26')]==0x6&&_0x261569[_0x5882('0x1b')]!=_0x5882('0x27')){utils['info'](util[_0x5882('0xa')](_0x5882('0x28'),_0x261569[_0x5882('0x7')],_0x261569[_0x5882('0x19')],_0x261569['context'],_0x261569[_0x5882('0xc')]));channels[_0x261569[_0x5882('0x19')]]['accountcode']=_0x261569[_0x5882('0x10')];channels[_0x261569[_0x5882('0x19')]][_0x5882('0x29')]=_0x261569[_0x5882('0xc')];if(_['isNil'](channels[_0x261569[_0x5882('0x19')]][_0x5882('0x2a')])){channels[_0x261569[_0x5882('0x19')]]['answertime']=utils[_0x5882('0x25')]();}channels[_0x261569[_0x5882('0x19')]][_0x5882('0x2b')]=dispositions[_[_0x5882('0x2c')](_0x261569[_0x5882('0x26')])]||'ANSWERED';}}catch(_0x413587){utils[_0x5882('0x1f')](util[_0x5882('0xa')](_0x5882('0x2d'),_0x261569[_0x5882('0x7')]),_0x413587);}};exports[_0x5882('0x2e')]=function(_0x5e495d){try{if(!_['isNil'](channels[_0x5e495d[_0x5882('0x7')]])){utils[_0x5882('0x21')](util[_0x5882('0xa')]('[%s][calls][hangup]',_0x5e495d[_0x5882('0x7')]),_0x5e495d);if(_['isNil'](channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x2f')])){channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x2f')]=_0x5e495d[_0x5882('0x30')]+'\x20<'+_0x5e495d['calleridnum']+'>';}utils[_0x5882('0x9')](util[_0x5882('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x5e495d[_0x5882('0x7')],channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x2f')],_0x5e495d[_0x5882('0x31')]));channels[_0x5e495d['uniqueid']][_0x5882('0x32')]=utils[_0x5882('0x25')]();channels[_0x5e495d['uniqueid']][_0x5882('0x33')]=utils[_0x5882('0x34')](channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x32')],channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x35')]);channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x36')]=channels[_0x5e495d['uniqueid']]['answertime']?utils[_0x5882('0x34')](channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x32')],channels[_0x5e495d[_0x5882('0x7')]][_0x5882('0x2a')]):0x0;writeDB(channels[_0x5e495d[_0x5882('0x7')]]);}}catch(_0x3aa589){utils[_0x5882('0x1f')](util[_0x5882('0xa')]('[%s][calls][hangup]',_0x5e495d['uniqueid']),_0x3aa589);}};exports[_0x5882('0x37')]=function(_0x4a9fa0){try{if(!_['isNil'](channels[_0x4a9fa0[_0x5882('0x38')]])){utils['debug'](util['format'](_0x5882('0x39'),_0x4a9fa0[_0x5882('0x3a')]),_0x4a9fa0);if(channels[_0x4a9fa0[_0x5882('0x38')]][_0x5882('0xc')]==_0x4a9fa0['transfereechannel']){utils['info'](util[_0x5882('0xa')](_0x5882('0x3b'),_0x4a9fa0['origtransfereruniqueid'],_0x4a9fa0['localtwolinkedid'],_0x4a9fa0[_0x5882('0x3c')]));channels[_0x4a9fa0[_0x5882('0x38')]][_0x5882('0x29')]=_0x4a9fa0['secondtransfererchannel'];channels[_0x4a9fa0[_0x5882('0x38')]][_0x5882('0x3d')]=_0x5882('0x3e');}else if(channels[_0x4a9fa0[_0x5882('0x38')]][_0x5882('0xc')]=_0x4a9fa0[_0x5882('0x3f')]){utils[_0x5882('0x9')](util['format'](_0x5882('0x3b'),_0x4a9fa0[_0x5882('0x3a')],_0x4a9fa0[_0x5882('0x38')],_0x4a9fa0[_0x5882('0x40')]));channels[_0x4a9fa0[_0x5882('0x38')]][_0x5882('0x29')]=_0x4a9fa0['origtransfererchannel'];channels[_0x4a9fa0[_0x5882('0x38')]][_0x5882('0x3d')]=_0x5882('0x3e');}}}catch(_0x566b47){utils[_0x5882('0x1f')](util[_0x5882('0xa')]('[%s][calls][attendedtransfer]',_0x4a9fa0[_0x5882('0x3a')]),_0x566b47);}};exports['musiconholdstart']=function(_0x287aeb){try{if(!_[_0x5882('0x22')](channels[_0x287aeb[_0x5882('0x7')]])){utils[_0x5882('0x21')](util[_0x5882('0xa')](_0x5882('0x41'),_0x287aeb[_0x5882('0x7')]),_0x287aeb);channels[_0x287aeb['uniqueid']][_0x5882('0x42')]=utils[_0x5882('0x25')]();utils[_0x5882('0x9')](util[_0x5882('0xa')](_0x5882('0x43'),_0x287aeb[_0x5882('0x7')],channels[_0x287aeb['uniqueid']][_0x5882('0x42')]));}}catch(_0x43d91f){utils[_0x5882('0x1f')](util[_0x5882('0xa')](_0x5882('0x41'),_0x287aeb['uniqueid']),_0x43d91f);}};exports[_0x5882('0x44')]=function(_0x358b8d){try{if(!_[_0x5882('0x22')](channels[_0x358b8d[_0x5882('0x7')]])){utils[_0x5882('0x21')](util[_0x5882('0xa')](_0x5882('0x45'),_0x358b8d[_0x5882('0x7')]),_0x358b8d);if(!_[_0x5882('0x22')](channels[_0x358b8d[_0x5882('0x7')]][_0x5882('0x42')])){channels[_0x358b8d[_0x5882('0x7')]]['mohtime']+=utils[_0x5882('0x34')](utils[_0x5882('0x25')](),channels[_0x358b8d[_0x5882('0x7')]][_0x5882('0x42')]);utils[_0x5882('0x9')](util[_0x5882('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x358b8d[_0x5882('0x7')],channels[_0x358b8d[_0x5882('0x7')]]['mohtime']));delete channels[_0x358b8d[_0x5882('0x7')]][_0x5882('0x42')];}}}catch(_0x2c642f){utils[_0x5882('0x1f')](util[_0x5882('0xa')]('[%s][calls][musiconholdstop]',_0x358b8d[_0x5882('0x7')]),_0x2c642f);}};exports['varset']=function(_0x309fbd){try{if(!_[_0x5882('0x22')](channels[_0x309fbd[_0x5882('0x7')]])){utils[_0x5882('0x21')](util[_0x5882('0xa')](_0x5882('0x46'),_0x309fbd[_0x5882('0x7')]),_0x309fbd);if(!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')][_0x5882('0x48')])){utils[_0x5882('0x9')](util['format'](_0x5882('0x49'),_0x309fbd[_0x5882('0x7')],_0x309fbd['value']));channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x4a')]=_0x309fbd[_0x5882('0x4b')];}if(!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')][_0x5882('0x4c')])){utils[_0x5882('0x9')](util[_0x5882('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x309fbd[_0x5882('0x7')],_0x309fbd['value']));channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x4d')]=_0x309fbd[_0x5882('0x4b')];channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x2f')]='\x22'+_0x309fbd[_0x5882('0x4b')]+_0x5882('0x4e')+_0x309fbd['value']+'>';}if(!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')][_0x5882('0x4f')])||!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')][_0x5882('0x50')])){utils[_0x5882('0x9')](util[_0x5882('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x309fbd[_0x5882('0x7')],!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')][_0x5882('0x4f')])?_0x5882('0x4f'):'xmd-callerid',_0x309fbd[_0x5882('0x4b')]));channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x2f')]=_0x309fbd[_0x5882('0x4b')];}if(!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')]['xmd-queue'])||!_['isNil'](_0x309fbd[_0x5882('0x47')][_0x5882('0x51')])){utils[_0x5882('0x9')](util[_0x5882('0xa')](_0x5882('0x52'),_0x309fbd[_0x5882('0x7')],!_[_0x5882('0x22')](_0x309fbd['variable']['xmd-queue'])?'xmd-queue':_0x5882('0x51'),_0x309fbd['value']));channels[_0x309fbd[_0x5882('0x7')]]['lastapplication']=_0x5882('0x53');channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x54')]=_0x309fbd[_0x5882('0x4b')];channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x55')]=!![];}if(!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')]['xmd-contactid'])){utils[_0x5882('0x9')](util[_0x5882('0xa')](_0x5882('0x56'),_0x309fbd[_0x5882('0x7')],_0x309fbd[_0x5882('0x4b')]));channels[_0x309fbd['uniqueid']][_0x5882('0x57')]=_0x309fbd[_0x5882('0x4b')];}if(!_['isNil'](_0x309fbd[_0x5882('0x47')][_0x5882('0x58')])){utils['info'](util[_0x5882('0xa')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x309fbd['uniqueid'],_0x309fbd['value']));channels[_0x309fbd['uniqueid']][_0x5882('0x59')]=_0x309fbd[_0x5882('0x4b')];}if(!_[_0x5882('0x22')](_0x309fbd[_0x5882('0x47')][_0x5882('0x5a')])){utils['info'](util[_0x5882('0xa')](_0x5882('0x5b'),_0x309fbd[_0x5882('0x7')],_0x309fbd[_0x5882('0x4b')]));channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x5c')]=_0x309fbd[_0x5882('0x4b')];}if(!_['isNil'](_0x309fbd[_0x5882('0x47')][_0x5882('0x5d')])){utils[_0x5882('0x9')](util[_0x5882('0xa')](_0x5882('0x5e'),_0x309fbd[_0x5882('0x7')],_0x309fbd['value']));channels[_0x309fbd[_0x5882('0x7')]][_0x5882('0x5d')]=_0x309fbd[_0x5882('0x4b')];}}}catch(_0x469f54){utils[_0x5882('0x1f')](util[_0x5882('0xa')](_0x5882('0x46'),_0x309fbd[_0x5882('0x7')]),_0x469f54);}};exports[_0x5882('0x5f')]=function(_0x2bac99){try{if(!_[_0x5882('0x22')](channels[_0x2bac99['uniqueid']])){utils[_0x5882('0x21')](util[_0x5882('0xa')]('[%s][calls][newexten]',_0x2bac99['uniqueid']),_0x2bac99);utils[_0x5882('0x9')](util[_0x5882('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2bac99['uniqueid'],_0x2bac99['application'],_0x2bac99[_0x5882('0x60')]));if(_0x2bac99['application'][_0x5882('0x61')]()=='set'&&_[_0x5882('0x62')](_0x2bac99[_0x5882('0x60')][_0x5882('0x61')](),'cdr')){var _0x2e5a20=_0x2bac99['appdata'][_0x5882('0x63')]('=');var _0xa654f4=_0x2e5a20[0x0][_0x5882('0x64')](_0x2e5a20[0x0][_0x5882('0x65')]('(')+0x1,_0x2e5a20[0x0][_0x5882('0x65')](')'));var _0x377356=_0x2e5a20[0x1];channels[_0x2bac99[_0x5882('0x7')]][_0xa654f4]=_0x377356;}if(!_[_0x5882('0x66')]([_0x5882('0x2e'),_0x5882('0x67'),'execif','set',_0x5882('0x68')],_0x2bac99[_0x5882('0x69')]['toLowerCase']())){channels[_0x2bac99[_0x5882('0x7')]][_0x5882('0x6a')]=_0x2bac99[_0x5882('0x69')];channels[_0x2bac99['uniqueid']][_0x5882('0x54')]=_0x2bac99['appdata'];}}}catch(_0x22c5a2){utils[_0x5882('0x1f')](util['format'](_0x5882('0x6b'),_0x2bac99[_0x5882('0x7')]),_0x22c5a2);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b72f6ff..8b9ce04 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 _0x453e=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x453e,0x8a));var _0xe453=function(_0x495c52,_0x53c0cc){_0x495c52=_0x495c52-0x0;var _0x2b4bb2=_0x453e[_0x495c52];return _0x2b4bb2;};'use strict';var utils=require(_0xe453('0x0'));exports[_0xe453('0x1')]=function(){utils['info'](_0xe453('0x2'));};exports[_0xe453('0x3')]=function(){utils['info'](_0xe453('0x4'));};exports[_0xe453('0x5')]=function(){utils[_0xe453('0x6')](_0xe453('0x7'));};exports['error']=function(_0x358f32){utils[_0xe453('0x8')](_0xe453('0x9'),_0x358f32);};exports[_0xe453('0xa')]=function(){utils[_0xe453('0x6')](_0xe453('0xb'));};exports[_0xe453('0xc')]=function(_0x138ad0){}; \ No newline at end of file +var _0x2968=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2968,0x90));var _0x8296=function(_0x3286b5,_0x58276c){_0x3286b5=_0x3286b5-0x0;var _0x497322=_0x2968[_0x3286b5];return _0x497322;};'use strict';var utils=require(_0x8296('0x0'));exports[_0x8296('0x1')]=function(){utils[_0x8296('0x2')](_0x8296('0x3'));};exports[_0x8296('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x8296('0x5')]=function(){utils[_0x8296('0x2')](_0x8296('0x6'));};exports[_0x8296('0x7')]=function(_0xdd4606){utils[_0x8296('0x7')](_0x8296('0x8'),_0xdd4606);};exports[_0x8296('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0x8296('0xa')]=function(_0x5d92d7){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d07206b..a43dbd4 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 _0xe350=['util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','startsWith','split','varset','[%s][dials][varset]','isNil','outboundrouteid','value','error','dialbegin','starttime','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','complete','duration','endtime','diffTime','billableseconds','lodash'];(function(_0x3c52e6,_0x2834ab){var _0x23977e=function(_0x507e19){while(--_0x507e19){_0x3c52e6['push'](_0x3c52e6['shift']());}};_0x23977e(++_0x2834ab);}(_0xe350,0xc3));var _0x0e35=function(_0xcd641,_0x49bb95){_0xcd641=_0xcd641-0x0;var _0x464f70=_0xe350[_0xcd641];return _0x464f70;};'use strict';var _=require(_0x0e35('0x0'));var util=require(_0x0e35('0x1'));var utils=require(_0x0e35('0x2'));var dials={};function writeDB(_0x59d4bd){utils['info'](util[_0x0e35('0x3')](_0x0e35('0x4'),_0x59d4bd[_0x0e35('0x5')],_0x59d4bd['channel'],_0x59d4bd[_0x0e35('0x6')],_0x59d4bd[_0x0e35('0x7')],_0x59d4bd[_0x0e35('0x8')],_0x59d4bd[_0x0e35('0x9')]));utils[_0x0e35('0xa')](_0x0e35('0xb'),_0x59d4bd);delete dials[_0x59d4bd['uniqueid']];}exports[_0x0e35('0xc')]=function(_0x1eb4b0){try{utils[_0x0e35('0xd')](util[_0x0e35('0x3')](_0x0e35('0xe'),_0x1eb4b0[_0x0e35('0x5')]),_0x1eb4b0);utils[_0x0e35('0xf')](util[_0x0e35('0x3')](_0x0e35('0x10'),_0x1eb4b0[_0x0e35('0x5')],_0x1eb4b0['application'],_0x1eb4b0[_0x0e35('0x11')]));if(_0x1eb4b0['application'][_0x0e35('0x12')]()=='set'&&_[_0x0e35('0x13')](_0x1eb4b0[_0x0e35('0x11')][_0x0e35('0x12')](),'cdr(routeid)')){var _0xb0a681=_0x1eb4b0['appdata'][_0x0e35('0x14')]('=');dials[_0x1eb4b0[_0x0e35('0x5')]]={'routeId':_0xb0a681[0x1]};}}catch(_0x491351){utils['error'](util[_0x0e35('0x3')](_0x0e35('0xe'),_0x1eb4b0[_0x0e35('0x5')]),_0x491351);}};exports[_0x0e35('0x15')]=function(_0x20f90e){try{utils[_0x0e35('0xd')](util[_0x0e35('0x3')](_0x0e35('0x16'),_0x20f90e[_0x0e35('0x5')]),_0x20f90e);if(!_[_0x0e35('0x17')](_0x20f90e['variable'][_0x0e35('0x18')])){utils[_0x0e35('0xf')](util[_0x0e35('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x20f90e[_0x0e35('0x5')],_0x20f90e[_0x0e35('0x19')]));dials[_0x20f90e[_0x0e35('0x5')]]={'routeId':_0x20f90e[_0x0e35('0x19')]};}}catch(_0x16e6cf){utils[_0x0e35('0x1a')](util['format']('[%s][dials][varset]',_0x20f90e[_0x0e35('0x5')]),_0x16e6cf);}};exports[_0x0e35('0x1b')]=function(_0x23e019){try{if(!_[_0x0e35('0x17')](dials[_0x23e019['uniqueid']])){utils[_0x0e35('0xd')](util['format']('[%s][dials][dialbegin]',_0x23e019[_0x0e35('0x5')]),_0x23e019);dials[_0x23e019['uniqueid']]=_['assign'](dials[_0x23e019[_0x0e35('0x5')]],_0x23e019);dials[_0x23e019[_0x0e35('0x5')]][_0x0e35('0x1c')]=utils['now']();dials[_0x23e019[_0x0e35('0x5')]][_0x0e35('0x1d')]=_0x0e35('0x1e');utils[_0x0e35('0xf')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x23e019[_0x0e35('0x5')],dials[_0x23e019[_0x0e35('0x5')]][_0x0e35('0x1c')]));}}catch(_0x2d5d26){utils['error'](util[_0x0e35('0x3')](_0x0e35('0x1f'),_0x23e019[_0x0e35('0x5')]),_0x2d5d26);}};exports[_0x0e35('0x20')]=function(_0x55015c){try{if(!_['isNil'](dials[_0x55015c[_0x0e35('0x5')]])){utils['debug'](util[_0x0e35('0x3')](_0x0e35('0x21'),_0x55015c['uniqueid']),_0x55015c);dials[_0x55015c['uniqueid']]['dialstatus']=_0x55015c['dialstatus'];if(_0x55015c[_0x0e35('0x9')]==_0x0e35('0x22')){dials[_0x55015c[_0x0e35('0x5')]]=_[_0x0e35('0x23')](dials[_0x55015c[_0x0e35('0x5')]],_0x55015c);dials[_0x55015c[_0x0e35('0x5')]][_0x0e35('0x24')]=utils[_0x0e35('0x25')]();dials[_0x55015c[_0x0e35('0x5')]][_0x0e35('0x1d')]=_0x0e35('0x26');utils[_0x0e35('0xf')](util[_0x0e35('0x3')](_0x0e35('0x27'),_0x55015c[_0x0e35('0x5')],_0x55015c[_0x0e35('0x9')],dials[_0x55015c[_0x0e35('0x5')]][_0x0e35('0x24')]));}else{utils[_0x0e35('0xf')](util[_0x0e35('0x3')](_0x0e35('0x28'),_0x55015c[_0x0e35('0x5')],_0x55015c[_0x0e35('0x9')]));}}}catch(_0x20ad21){utils['error'](util['format'](_0x0e35('0x21'),_0x55015c[_0x0e35('0x5')]),_0x20ad21);}};exports[_0x0e35('0x29')]=function(_0x1f3bbf){try{if(!_[_0x0e35('0x17')](dials[_0x1f3bbf[_0x0e35('0x5')]])){utils[_0x0e35('0xd')](util['format'](_0x0e35('0x2a'),_0x1f3bbf[_0x0e35('0x5')]),_0x1f3bbf);utils[_0x0e35('0xf')](util[_0x0e35('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x1f3bbf[_0x0e35('0x5')],_0x1f3bbf['calleridnum'],_0x1f3bbf[_0x0e35('0x2b')],_0x1f3bbf['cause-txt']));dials[_0x1f3bbf[_0x0e35('0x5')]]=_[_0x0e35('0x23')](dials[_0x1f3bbf[_0x0e35('0x5')]],{'endtime':utils[_0x0e35('0x25')](),'lastevent':_0x0e35('0x2c')});dials[_0x1f3bbf['uniqueid']][_0x0e35('0x2d')]=utils['diffTime'](dials[_0x1f3bbf[_0x0e35('0x5')]][_0x0e35('0x2e')],dials[_0x1f3bbf[_0x0e35('0x5')]][_0x0e35('0x1c')]);dials[_0x1f3bbf[_0x0e35('0x5')]]['holdtime']=utils[_0x0e35('0x2f')](dials[_0x1f3bbf[_0x0e35('0x5')]][_0x0e35('0x24')]||dials[_0x1f3bbf[_0x0e35('0x5')]][_0x0e35('0x2e')],dials[_0x1f3bbf[_0x0e35('0x5')]][_0x0e35('0x1c')]);dials[_0x1f3bbf[_0x0e35('0x5')]][_0x0e35('0x30')]=dials[_0x1f3bbf['uniqueid']][_0x0e35('0x24')]?utils['diffTime'](dials[_0x1f3bbf['uniqueid']][_0x0e35('0x2e')],dials[_0x1f3bbf[_0x0e35('0x5')]][_0x0e35('0x24')]):0x0;writeDB(dials[_0x1f3bbf[_0x0e35('0x5')]]);}}catch(_0x23b442){utils[_0x0e35('0x1a')](util[_0x0e35('0x3')](_0x0e35('0x2a'),_0x1f3bbf[_0x0e35('0x5')]),_0x23b442);}}; \ No newline at end of file +var _0x5975=['billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','[%s][dials][newexten]','format','application','appdata','toLowerCase','startsWith','error','varset','debug','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime'];(function(_0x5e7384,_0x588a4b){var _0x366959=function(_0x2041f0){while(--_0x2041f0){_0x5e7384['push'](_0x5e7384['shift']());}};_0x366959(++_0x588a4b);}(_0x5975,0x1e1));var _0x5597=function(_0x41974d,_0x2a9354){_0x41974d=_0x41974d-0x0;var _0x1fb1e2=_0x5975[_0x41974d];return _0x1fb1e2;};'use strict';var _=require(_0x5597('0x0'));var util=require(_0x5597('0x1'));var utils=require(_0x5597('0x2'));var dials={};function writeDB(_0x39ceb9){utils[_0x5597('0x3')](util['format'](_0x5597('0x4'),_0x39ceb9[_0x5597('0x5')],_0x39ceb9[_0x5597('0x6')],_0x39ceb9[_0x5597('0x7')],_0x39ceb9[_0x5597('0x8')],_0x39ceb9[_0x5597('0x9')],_0x39ceb9['dialstatus']));utils[_0x5597('0xa')](_0x5597('0xb'),_0x39ceb9);delete dials[_0x39ceb9['uniqueid']];}exports['newexten']=function(_0x4820a1){try{utils['debug'](util['format'](_0x5597('0xc'),_0x4820a1['uniqueid']),_0x4820a1);utils[_0x5597('0x3')](util[_0x5597('0xd')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4820a1['uniqueid'],_0x4820a1[_0x5597('0xe')],_0x4820a1[_0x5597('0xf')]));if(_0x4820a1['application'][_0x5597('0x10')]()=='set'&&_[_0x5597('0x11')](_0x4820a1[_0x5597('0xf')][_0x5597('0x10')](),'cdr(routeid)')){var _0x3a6156=_0x4820a1[_0x5597('0xf')]['split']('=');dials[_0x4820a1['uniqueid']]={'routeId':_0x3a6156[0x1]};}}catch(_0x39fb67){utils[_0x5597('0x12')](util['format'](_0x5597('0xc'),_0x4820a1['uniqueid']),_0x39fb67);}};exports[_0x5597('0x13')]=function(_0x20f14e){try{utils[_0x5597('0x14')](util['format'](_0x5597('0x15'),_0x20f14e[_0x5597('0x5')]),_0x20f14e);if(!_[_0x5597('0x16')](_0x20f14e['variable']['outboundrouteid'])){utils['info'](util[_0x5597('0xd')](_0x5597('0x17'),_0x20f14e[_0x5597('0x5')],_0x20f14e[_0x5597('0x18')]));dials[_0x20f14e[_0x5597('0x5')]]={'routeId':_0x20f14e[_0x5597('0x18')]};}}catch(_0x4977e7){utils['error'](util[_0x5597('0xd')](_0x5597('0x15'),_0x20f14e[_0x5597('0x5')]),_0x4977e7);}};exports[_0x5597('0x19')]=function(_0x5516ba){try{if(!_[_0x5597('0x16')](dials[_0x5516ba[_0x5597('0x5')]])){utils[_0x5597('0x14')](util['format'](_0x5597('0x1a'),_0x5516ba[_0x5597('0x5')]),_0x5516ba);dials[_0x5516ba[_0x5597('0x5')]]=_[_0x5597('0x1b')](dials[_0x5516ba[_0x5597('0x5')]],_0x5516ba);dials[_0x5516ba['uniqueid']][_0x5597('0x1c')]=utils[_0x5597('0x1d')]();dials[_0x5516ba[_0x5597('0x5')]][_0x5597('0x1e')]=_0x5597('0x1f');utils[_0x5597('0x3')](util['format'](_0x5597('0x20'),_0x5516ba[_0x5597('0x5')],dials[_0x5516ba[_0x5597('0x5')]][_0x5597('0x1c')]));}}catch(_0xf47390){utils[_0x5597('0x12')](util['format'](_0x5597('0x1a'),_0x5516ba[_0x5597('0x5')]),_0xf47390);}};exports[_0x5597('0x21')]=function(_0x4654fa){try{if(!_[_0x5597('0x16')](dials[_0x4654fa['uniqueid']])){utils['debug'](util[_0x5597('0xd')](_0x5597('0x22'),_0x4654fa[_0x5597('0x5')]),_0x4654fa);dials[_0x4654fa[_0x5597('0x5')]][_0x5597('0x23')]=_0x4654fa[_0x5597('0x23')];if(_0x4654fa[_0x5597('0x23')]=='ANSWER'){dials[_0x4654fa[_0x5597('0x5')]]=_['assign'](dials[_0x4654fa['uniqueid']],_0x4654fa);dials[_0x4654fa[_0x5597('0x5')]]['answertime']=utils['now']();dials[_0x4654fa[_0x5597('0x5')]][_0x5597('0x1e')]=_0x5597('0x24');utils[_0x5597('0x3')](util[_0x5597('0xd')](_0x5597('0x25'),_0x4654fa[_0x5597('0x5')],_0x4654fa[_0x5597('0x23')],dials[_0x4654fa[_0x5597('0x5')]][_0x5597('0x26')]));}else{utils[_0x5597('0x3')](util[_0x5597('0xd')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4654fa[_0x5597('0x5')],_0x4654fa[_0x5597('0x23')]));}}}catch(_0x4cab6b){utils[_0x5597('0x12')](util['format'](_0x5597('0x22'),_0x4654fa[_0x5597('0x5')]),_0x4cab6b);}};exports['hangup']=function(_0x5a639d){try{if(!_[_0x5597('0x16')](dials[_0x5a639d['uniqueid']])){utils[_0x5597('0x14')](util[_0x5597('0xd')](_0x5597('0x27'),_0x5a639d[_0x5597('0x5')]),_0x5a639d);utils[_0x5597('0x3')](util[_0x5597('0xd')](_0x5597('0x28'),_0x5a639d[_0x5597('0x5')],_0x5a639d[_0x5597('0x8')],_0x5a639d[_0x5597('0x29')],_0x5a639d[_0x5597('0x2a')]));dials[_0x5a639d[_0x5597('0x5')]]=_[_0x5597('0x1b')](dials[_0x5a639d['uniqueid']],{'endtime':utils[_0x5597('0x1d')](),'lastevent':_0x5597('0x2b')});dials[_0x5a639d[_0x5597('0x5')]][_0x5597('0x2c')]=utils[_0x5597('0x2d')](dials[_0x5a639d['uniqueid']][_0x5597('0x2e')],dials[_0x5a639d[_0x5597('0x5')]]['starttime']);dials[_0x5a639d[_0x5597('0x5')]]['holdtime']=utils['diffTime'](dials[_0x5a639d[_0x5597('0x5')]][_0x5597('0x26')]||dials[_0x5a639d[_0x5597('0x5')]][_0x5597('0x2e')],dials[_0x5a639d[_0x5597('0x5')]][_0x5597('0x1c')]);dials[_0x5a639d['uniqueid']][_0x5597('0x2f')]=dials[_0x5a639d[_0x5597('0x5')]]['answertime']?utils[_0x5597('0x2d')](dials[_0x5a639d['uniqueid']][_0x5597('0x2e')],dials[_0x5a639d[_0x5597('0x5')]][_0x5597('0x26')]):0x0;writeDB(dials[_0x5a639d['uniqueid']]);}}catch(_0x225ca7){utils['error'](util[_0x5597('0xd')]('[%s][dials][hangup]',_0x5a639d[_0x5597('0x5')]),_0x225ca7);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6fd3f0c..93b4876 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 _0xa7fe=['format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug'];(function(_0x3f041d,_0x11279b){var _0xfb795b=function(_0x1abca6){while(--_0x1abca6){_0x3f041d['push'](_0x3f041d['shift']());}};_0xfb795b(++_0x11279b);}(_0xa7fe,0x14a));var _0xea7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7fe[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xea7f('0x0'));var config=require('../../config/environment');var utils=require(_0xea7f('0x1'));var util=require(_0xea7f('0x2'));var isXDREnabled=config[_0xea7f('0x3')]&&config[_0xea7f('0x3')][_0xea7f('0x4')]?!config[_0xea7f('0x3')][_0xea7f('0x4')]:!![];var isProduction=config[_0xea7f('0x5')]===_0xea7f('0x6')||![];var isLocalAsterisk=config[_0xea7f('0x3')]&&config[_0xea7f('0x3')][_0xea7f('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xea7f('0x8')][_0xea7f('0x9')],config[_0xea7f('0x8')]['ip'],config[_0xea7f('0x8')][_0xea7f('0xa')],config[_0xea7f('0x8')][_0xea7f('0xb')],!![]);ami[_0xea7f('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xea7f('0xd')](_0xea7f('0xe'));}else{var agents=require(_0xea7f('0xf'));var calls=require(_0xea7f('0x10'));var queues=require(_0xea7f('0x11'));var recordings=require(_0xea7f('0x12'));var members=require(_0xea7f('0x13'));var dials=require(_0xea7f('0x14'));var transfers=require(_0xea7f('0x15'));var core=require(_0xea7f('0x16'));ami['on'](_0xea7f('0x17'),core['connect']);ami['on'](_0xea7f('0x18'),core[_0xea7f('0x18')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xea7f('0x19'),core[_0xea7f('0x19')]);ami['on']('close',core[_0xea7f('0x1a')]);ami['on'](_0xea7f('0x1b'),core[_0xea7f('0x1b')]);ami['on'](_0xea7f('0x1c'),function(_0x263406){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x1f'),_0x263406[_0xea7f('0x20')]),_0x263406);members['devicestatechange'](_0x263406);}catch(_0x281f06){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')](_0xea7f('0x1f'),_0x263406[_0xea7f('0x20')]),_0x281f06);}});ami['on'](_0xea7f('0x21'),function(_0x47a347){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x22'),_0x47a347[_0xea7f('0x23')]),_0x47a347);agents[_0xea7f('0x21')](_0x47a347);}catch(_0x1e33ce){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')](_0xea7f('0x22'),_0x47a347[_0xea7f('0x23')]),_0x1e33ce);}});ami['on'](_0xea7f('0x24'),function(_0x30a6b1){try{utils['debug'](util[_0xea7f('0x1e')](_0xea7f('0x25'),_0x30a6b1[_0xea7f('0x23')]),_0x30a6b1);agents[_0xea7f('0x24')](_0x30a6b1);}catch(_0x5b2222){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')](_0xea7f('0x25'),_0x30a6b1[_0xea7f('0x23')]),_0x5b2222);}});ami['on'](_0xea7f('0x26'),function(_0x2bc6ea){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')]('[%s][index][agentconnect]',_0x2bc6ea[_0xea7f('0x23')]),_0x2bc6ea);agents['agentconnect'](_0x2bc6ea);queues['agentconnect'](_0x2bc6ea);}catch(_0x5377d0){utils['error'](util[_0xea7f('0x1e')](_0xea7f('0x27'),_0x2bc6ea[_0xea7f('0x23')]),_0x5377d0);}});ami['on'](_0xea7f('0x28'),function(_0x403652){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x29'),_0x403652['uniqueid']),_0x403652);agents[_0xea7f('0x28')](_0x403652);queues['agentcomplete'](_0x403652);members[_0xea7f('0x28')](_0x403652);}catch(_0x956c3c){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')](_0xea7f('0x29'),_0x403652['uniqueid']),_0x956c3c);}});ami['on']('queuecallerabandon',function(_0x1437ad){try{utils['debug'](util[_0xea7f('0x1e')](_0xea7f('0x2a'),_0x1437ad[_0xea7f('0x23')]),_0x1437ad);agents['queuecallerabandon'](_0x1437ad);queues[_0xea7f('0x2b')](_0x1437ad);}catch(_0x18fb6b){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')]('[%s][index][queuecallerabandon]',_0x1437ad['uniqueid']),_0x18fb6b);}});ami['on']('queuecallerjoin',function(_0x5ea5b7){try{utils['debug'](util['format'](_0xea7f('0x2c'),_0x5ea5b7['uniqueid']),_0x5ea5b7);queues[_0xea7f('0x2d')](_0x5ea5b7);recordings[_0xea7f('0x2d')](_0x5ea5b7);}catch(_0x422173){utils[_0xea7f('0x19')](util['format'](_0xea7f('0x2c'),_0x5ea5b7['uniqueid']),_0x422173);}});ami['on']('queuecallerleave',function(_0x43cdc4){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x2e'),_0x43cdc4[_0xea7f('0x23')]),_0x43cdc4);queues[_0xea7f('0x2f')](_0x43cdc4);}catch(_0x26daf9){utils['error'](util[_0xea7f('0x1e')]('[%s][index][queuecallerleave]',_0x43cdc4[_0xea7f('0x23')]),_0x26daf9);}});ami['on'](_0xea7f('0x30'),function(_0x1f432c){try{utils['debug'](util[_0xea7f('0x1e')]('[%s][index][musiconholdstart]',_0x1f432c[_0xea7f('0x23')]),_0x1f432c);queues[_0xea7f('0x30')](_0x1f432c);calls[_0xea7f('0x30')](_0x1f432c);}catch(_0xaddd70){utils['error'](util[_0xea7f('0x1e')](_0xea7f('0x31'),_0x1f432c[_0xea7f('0x23')]),_0xaddd70);}});ami['on'](_0xea7f('0x32'),function(_0x9b365){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')]('[%s][index][musiconholdstop]',_0x9b365[_0xea7f('0x23')]),_0x9b365);queues[_0xea7f('0x32')](_0x9b365);calls[_0xea7f('0x32')](_0x9b365);}catch(_0x232a35){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')]('[%s][index][musiconholdstop]',_0x9b365[_0xea7f('0x23')]),_0x232a35);}});ami['on'](_0xea7f('0x33'),function(_0xdbf330){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x34'),_0xdbf330['uniqueid']),_0xdbf330);calls[_0xea7f('0x33')](_0xdbf330);recordings[_0xea7f('0x33')](_0xdbf330);}catch(_0x35d17a){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')](_0xea7f('0x34'),_0xdbf330['uniqueid']),_0x35d17a);}});ami['on'](_0xea7f('0x35'),function(_0x33eb6b){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x36'),_0x33eb6b[_0xea7f('0x23')]),_0x33eb6b);calls[_0xea7f('0x35')](_0x33eb6b);recordings[_0xea7f('0x35')](_0x33eb6b);dials['hangup'](_0x33eb6b);agents['hangup'](_0x33eb6b);queues[_0xea7f('0x35')](_0x33eb6b);}catch(_0x4ba9d8){utils[_0xea7f('0x19')](util['format'](_0xea7f('0x36'),_0x33eb6b[_0xea7f('0x23')]),_0x4ba9d8);}});ami['on'](_0xea7f('0x37'),function(_0x20cc3f){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x38'),_0x20cc3f[_0xea7f('0x23')]),_0x20cc3f);members[_0xea7f('0x37')](_0x20cc3f);}catch(_0x433c32){utils['error'](util[_0xea7f('0x1e')](_0xea7f('0x38'),_0x20cc3f[_0xea7f('0x23')]),_0x433c32);}});ami['on'](_0xea7f('0x39'),function(_0x39a359){try{utils[_0xea7f('0x1d')](util['format'](_0xea7f('0x3a'),_0x39a359[_0xea7f('0x23')]),_0x39a359);queues[_0xea7f('0x39')](_0x39a359);agents[_0xea7f('0x39')](_0x39a359);transfers[_0xea7f('0x39')](_0x39a359);recordings[_0xea7f('0x39')](_0x39a359);}catch(_0x2185fe){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')]('[%s][index][blindtransfer]',_0x39a359[_0xea7f('0x23')]),_0x2185fe);}});ami['on'](_0xea7f('0x3b'),function(_0x39be0e){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')]('[%s][index][attendedtransfer]',_0x39be0e[_0xea7f('0x3c')]),_0x39be0e);queues[_0xea7f('0x3b')](_0x39be0e);transfers['attendedtransfer'](_0x39be0e);agents['attendedtransfer'](_0x39be0e);calls['attendedtransfer'](_0x39be0e);}catch(_0x3d2932){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')](_0xea7f('0x3d'),_0x39be0e['origtransfereruniqueid']),_0x3d2932);}});ami['on']('varset',function(_0x54915c){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x3e'),_0x54915c[_0xea7f('0x23')]),_0x54915c);queues[_0xea7f('0x3f')](_0x54915c);recordings[_0xea7f('0x3f')](_0x54915c);calls[_0xea7f('0x3f')](_0x54915c);dials[_0xea7f('0x3f')](_0x54915c);}catch(_0x38c3ab){utils[_0xea7f('0x19')](util[_0xea7f('0x1e')]('[%s][index][varset]',_0x54915c['uniqueid']),_0x38c3ab);}});ami['on'](_0xea7f('0x40'),function(_0x1b6089){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x41'),_0x1b6089['uniqueid']),_0x1b6089);calls['newexten'](_0x1b6089);recordings[_0xea7f('0x40')](_0x1b6089);dials[_0xea7f('0x40')](_0x1b6089);}catch(_0x1d97ab){utils['error'](util[_0xea7f('0x1e')](_0xea7f('0x41'),_0x1b6089[_0xea7f('0x23')]),_0x1d97ab);}});ami['on'](_0xea7f('0x42'),function(_0x8742b6){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')](_0xea7f('0x43'),_0x8742b6[_0xea7f('0x23')]),_0x8742b6);calls[_0xea7f('0x42')](_0x8742b6);recordings['newchannel'](_0x8742b6);}catch(_0x97f666){utils[_0xea7f('0x19')](util['format']('[%s][index][newchannel]',_0x8742b6[_0xea7f('0x23')]),_0x97f666);}});ami['on'](_0xea7f('0x44'),function(_0x18479e){try{utils[_0xea7f('0x1d')](util[_0xea7f('0x1e')]('[%s][index][dialbegin]',_0x18479e[_0xea7f('0x23')]),_0x18479e);dials['dialbegin'](_0x18479e);}catch(_0x578050){utils[_0xea7f('0x19')](util['format'](_0xea7f('0x45'),_0x18479e['uniqueid']),_0x578050);}});ami['on'](_0xea7f('0x46'),function(_0x54e13d){try{utils[_0xea7f('0x1d')](util['format'](_0xea7f('0x47'),_0x54e13d['uniqueid']),_0x54e13d);dials['dialend'](_0x54e13d);}catch(_0x3d5e0c){utils[_0xea7f('0x19')](util['format']('[%s][index][dialend]',_0x54e13d['uniqueid']),_0x3d5e0c);}});} \ No newline at end of file +var _0x3dff=['production','asterisk','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','xdr','disabled','env'];(function(_0xc84698,_0x34188c){var _0x17782a=function(_0x4255e0){while(--_0x4255e0){_0xc84698['push'](_0xc84698['shift']());}};_0x17782a(++_0x34188c);}(_0x3dff,0x140));var _0xf3df=function(_0x57c7be,_0x144865){_0x57c7be=_0x57c7be-0x0;var _0x49adb4=_0x3dff[_0x57c7be];return _0x49adb4;};var AsteriskManager=require(_0xf3df('0x0'));var config=require('../../config/environment');var utils=require(_0xf3df('0x1'));var util=require('util');var isXDREnabled=config[_0xf3df('0x2')]&&config[_0xf3df('0x2')]['disabled']?!config[_0xf3df('0x2')][_0xf3df('0x3')]:!![];var isProduction=config[_0xf3df('0x4')]===_0xf3df('0x5')||![];var isLocalAsterisk=config[_0xf3df('0x2')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0xf3df('0x6')]['port'],config[_0xf3df('0x6')]['ip'],config['asterisk'][_0xf3df('0x7')],config[_0xf3df('0x6')]['password'],!![]);ami[_0xf3df('0x8')]();if(!isXDREnabled){utils[_0xf3df('0x9')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xf3df('0xa'));}else{var agents=require(_0xf3df('0xb'));var calls=require('./calls.controller');var queues=require(_0xf3df('0xc'));var recordings=require(_0xf3df('0xd'));var members=require(_0xf3df('0xe'));var dials=require(_0xf3df('0xf'));var transfers=require(_0xf3df('0x10'));var core=require(_0xf3df('0x11'));ami['on'](_0xf3df('0x12'),core[_0xf3df('0x12')]);ami['on'](_0xf3df('0x13'),core[_0xf3df('0x13')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xf3df('0x14'),core['error']);ami['on'](_0xf3df('0x15'),core[_0xf3df('0x15')]);ami['on'](_0xf3df('0x16'),core['managerevent']);ami['on'](_0xf3df('0x17'),function(_0x281ae8){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')](_0xf3df('0x1a'),_0x281ae8['device']),_0x281ae8);members[_0xf3df('0x17')](_0x281ae8);}catch(_0x4dc4bb){utils[_0xf3df('0x14')](util[_0xf3df('0x19')]('[%s][index][devicestatechange]',_0x281ae8['device']),_0x4dc4bb);}});ami['on'](_0xf3df('0x1b'),function(_0x54c685){try{utils['debug'](util['format'](_0xf3df('0x1c'),_0x54c685[_0xf3df('0x1d')]),_0x54c685);agents['agentcalled'](_0x54c685);}catch(_0x155cac){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x1c'),_0x54c685[_0xf3df('0x1d')]),_0x155cac);}});ami['on']('agentringnoanswer',function(_0x7282dc){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')]('[%s][index][agentringnoanswer]',_0x7282dc[_0xf3df('0x1d')]),_0x7282dc);agents['agentringnoanswer'](_0x7282dc);}catch(_0x85b051){utils[_0xf3df('0x14')](util['format'](_0xf3df('0x1e'),_0x7282dc['uniqueid']),_0x85b051);}});ami['on'](_0xf3df('0x1f'),function(_0x35f700){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')](_0xf3df('0x20'),_0x35f700['uniqueid']),_0x35f700);agents['agentconnect'](_0x35f700);queues[_0xf3df('0x1f')](_0x35f700);}catch(_0x52be81){utils[_0xf3df('0x14')](util[_0xf3df('0x19')]('[%s][index][agentconnect]',_0x35f700['uniqueid']),_0x52be81);}});ami['on']('agentcomplete',function(_0xa2b0b0){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')]('[%s][index][agentcomplete]',_0xa2b0b0['uniqueid']),_0xa2b0b0);agents[_0xf3df('0x21')](_0xa2b0b0);queues[_0xf3df('0x21')](_0xa2b0b0);members[_0xf3df('0x21')](_0xa2b0b0);}catch(_0x537ba1){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x22'),_0xa2b0b0[_0xf3df('0x1d')]),_0x537ba1);}});ami['on']('queuecallerabandon',function(_0x53d00f){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')]('[%s][index][queuecallerabandon]',_0x53d00f['uniqueid']),_0x53d00f);agents[_0xf3df('0x23')](_0x53d00f);queues[_0xf3df('0x23')](_0x53d00f);}catch(_0xcea788){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x24'),_0x53d00f[_0xf3df('0x1d')]),_0xcea788);}});ami['on'](_0xf3df('0x25'),function(_0x4b2f29){try{utils['debug'](util[_0xf3df('0x19')](_0xf3df('0x26'),_0x4b2f29[_0xf3df('0x1d')]),_0x4b2f29);queues[_0xf3df('0x25')](_0x4b2f29);recordings[_0xf3df('0x25')](_0x4b2f29);}catch(_0x29f2cb){utils['error'](util[_0xf3df('0x19')](_0xf3df('0x26'),_0x4b2f29[_0xf3df('0x1d')]),_0x29f2cb);}});ami['on']('queuecallerleave',function(_0x20c960){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')]('[%s][index][queuecallerleave]',_0x20c960[_0xf3df('0x1d')]),_0x20c960);queues[_0xf3df('0x27')](_0x20c960);}catch(_0x2cbde0){utils[_0xf3df('0x14')](util['format'](_0xf3df('0x28'),_0x20c960[_0xf3df('0x1d')]),_0x2cbde0);}});ami['on']('musiconholdstart',function(_0x41c6d2){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')](_0xf3df('0x29'),_0x41c6d2[_0xf3df('0x1d')]),_0x41c6d2);queues['musiconholdstart'](_0x41c6d2);calls['musiconholdstart'](_0x41c6d2);}catch(_0x5443a0){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x29'),_0x41c6d2[_0xf3df('0x1d')]),_0x5443a0);}});ami['on'](_0xf3df('0x2a'),function(_0x5a73cf){try{utils['debug'](util[_0xf3df('0x19')](_0xf3df('0x2b'),_0x5a73cf[_0xf3df('0x1d')]),_0x5a73cf);queues[_0xf3df('0x2a')](_0x5a73cf);calls[_0xf3df('0x2a')](_0x5a73cf);}catch(_0x53c1cf){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x2b'),_0x5a73cf[_0xf3df('0x1d')]),_0x53c1cf);}});ami['on']('newstate',function(_0x3dc7c3){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')]('[%s][index][newstate]',_0x3dc7c3[_0xf3df('0x1d')]),_0x3dc7c3);calls['newstate'](_0x3dc7c3);recordings[_0xf3df('0x2c')](_0x3dc7c3);}catch(_0x46de8c){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x2d'),_0x3dc7c3[_0xf3df('0x1d')]),_0x46de8c);}});ami['on'](_0xf3df('0x2e'),function(_0x2c8a7e){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')]('[%s][index][hangup]',_0x2c8a7e[_0xf3df('0x1d')]),_0x2c8a7e);calls['hangup'](_0x2c8a7e);recordings[_0xf3df('0x2e')](_0x2c8a7e);dials[_0xf3df('0x2e')](_0x2c8a7e);agents[_0xf3df('0x2e')](_0x2c8a7e);queues[_0xf3df('0x2e')](_0x2c8a7e);}catch(_0x270fee){utils['error'](util[_0xf3df('0x19')](_0xf3df('0x2f'),_0x2c8a7e[_0xf3df('0x1d')]),_0x270fee);}});ami['on'](_0xf3df('0x30'),function(_0x2b6c24){try{utils[_0xf3df('0x18')](util['format'](_0xf3df('0x31'),_0x2b6c24[_0xf3df('0x1d')]),_0x2b6c24);members[_0xf3df('0x30')](_0x2b6c24);}catch(_0x422001){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x31'),_0x2b6c24[_0xf3df('0x1d')]),_0x422001);}});ami['on'](_0xf3df('0x32'),function(_0x4f6234){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')](_0xf3df('0x33'),_0x4f6234[_0xf3df('0x1d')]),_0x4f6234);queues['blindtransfer'](_0x4f6234);agents[_0xf3df('0x32')](_0x4f6234);transfers['blindtransfer'](_0x4f6234);recordings[_0xf3df('0x32')](_0x4f6234);}catch(_0x352a93){utils['error'](util[_0xf3df('0x19')](_0xf3df('0x33'),_0x4f6234[_0xf3df('0x1d')]),_0x352a93);}});ami['on'](_0xf3df('0x34'),function(_0x922b40){try{utils[_0xf3df('0x18')](util['format'](_0xf3df('0x35'),_0x922b40[_0xf3df('0x36')]),_0x922b40);queues[_0xf3df('0x34')](_0x922b40);transfers[_0xf3df('0x34')](_0x922b40);agents[_0xf3df('0x34')](_0x922b40);calls[_0xf3df('0x34')](_0x922b40);}catch(_0x117adf){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x35'),_0x922b40[_0xf3df('0x36')]),_0x117adf);}});ami['on'](_0xf3df('0x37'),function(_0xcd85b3){try{utils[_0xf3df('0x18')](util['format'](_0xf3df('0x38'),_0xcd85b3[_0xf3df('0x1d')]),_0xcd85b3);queues['varset'](_0xcd85b3);recordings[_0xf3df('0x37')](_0xcd85b3);calls[_0xf3df('0x37')](_0xcd85b3);dials[_0xf3df('0x37')](_0xcd85b3);}catch(_0x1edc9e){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x38'),_0xcd85b3['uniqueid']),_0x1edc9e);}});ami['on'](_0xf3df('0x39'),function(_0x206eaa){try{utils['debug'](util[_0xf3df('0x19')]('[%s][index][newexten]',_0x206eaa[_0xf3df('0x1d')]),_0x206eaa);calls['newexten'](_0x206eaa);recordings[_0xf3df('0x39')](_0x206eaa);dials[_0xf3df('0x39')](_0x206eaa);}catch(_0x28857e){utils[_0xf3df('0x14')](util[_0xf3df('0x19')]('[%s][index][newexten]',_0x206eaa[_0xf3df('0x1d')]),_0x28857e);}});ami['on'](_0xf3df('0x3a'),function(_0x2e53b4){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')]('[%s][index][newchannel]',_0x2e53b4[_0xf3df('0x1d')]),_0x2e53b4);calls[_0xf3df('0x3a')](_0x2e53b4);recordings[_0xf3df('0x3a')](_0x2e53b4);}catch(_0x1070fb){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x3b'),_0x2e53b4[_0xf3df('0x1d')]),_0x1070fb);}});ami['on']('dialbegin',function(_0x37f100){try{utils['debug'](util['format'](_0xf3df('0x3c'),_0x37f100[_0xf3df('0x1d')]),_0x37f100);dials[_0xf3df('0x3d')](_0x37f100);}catch(_0x2ff8b9){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x3e'),_0x37f100[_0xf3df('0x1d')]),_0x2ff8b9);}});ami['on'](_0xf3df('0x3f'),function(_0x362d27){try{utils[_0xf3df('0x18')](util[_0xf3df('0x19')](_0xf3df('0x40'),_0x362d27['uniqueid']),_0x362d27);dials[_0xf3df('0x3f')](_0x362d27);}catch(_0x4495cc){utils[_0xf3df('0x14')](util[_0xf3df('0x19')](_0xf3df('0x40'),_0x362d27[_0xf3df('0x1d')]),_0x4495cc);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 970f65e..bd809e0 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 _0x39a9=['internal','CreateMemberReport','getUserByName','request','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','voice','agent','isNil','exitAt','diffTime','enterAt','agentcomplete','assign','[%s][members][agentcomplete]','cdr','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','name'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x39a9,0x1d0));var _0x939a=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x39a9[_0x456a4b];return _0x42957c;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var utils=require(_0x939a('0x2'));var members={};var exclude=[_0x939a('0x3'),_0x939a('0x4')];function writeDB(_0x1e8619){utils[_0x939a('0x5')](util[_0x939a('0x6')](_0x939a('0x7'),_0x1e8619[_0x939a('0x8')],_0x1e8619[_0x939a('0x9')],_0x1e8619['channel'],_0x1e8619[_0x939a('0xa')],_0x1e8619[_0x939a('0xb')],_0x1e8619[_0x939a('0xc')]));if(_0x1e8619[_0x939a('0x9')]){utils[_0x939a('0xd')](_0x1e8619[_0x939a('0x9')])[_0x939a('0xe')](function(_0x7a6c61){if(_0x7a6c61){_0x1e8619['membername']=_0x7a6c61[_0x939a('0xf')];_0x1e8619[_0x939a('0x10')]=_0x7a6c61[_0x939a('0x10')];utils['request'](_0x939a('0x11'),_0x1e8619);}else{utils[_0x939a('0x12')](_0x1e8619[_0x939a('0x9')]['split']('/')[0x1])[_0x939a('0xe')](function(_0x6f14c3){if(_0x6f14c3){_0x1e8619[_0x939a('0xb')]=_0x6f14c3['name'];_0x1e8619['internal']=_0x6f14c3[_0x939a('0x10')];utils[_0x939a('0x13')](_0x939a('0x11'),_0x1e8619);}});}})['catch'](function(_0x3dbc7f){utils[_0x939a('0x14')](util[_0x939a('0x6')](_0x939a('0x15'),_0x1e8619[_0x939a('0x8')]),_0x3dbc7f);});}delete members[_0x1e8619[_0x939a('0x9')]];}function startsWith(_0x10481a,_0x521346){return _[_0x939a('0x16')](_0x10481a,function(_0x5cf40e){return _[_0x939a('0x17')](_0x521346,_0x5cf40e);});}exports['devicestatechange']=function(_0x42c937){try{utils[_0x939a('0x18')](util[_0x939a('0x6')](_0x939a('0x19'),members[_0x42c937['device']]?members[_0x42c937['device']][_0x939a('0x8')]:_0x42c937['device']),_0x42c937);utils['info'](util[_0x939a('0x6')](_0x939a('0x1a'),members[_0x42c937[_0x939a('0x1b')]]?members[_0x42c937[_0x939a('0x1b')]][_0x939a('0x8')]:_0x42c937['device'],_0x42c937[_0x939a('0x1c')],_0x42c937['device']));switch(_0x42c937[_0x939a('0x1c')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x42c937[_0x939a('0x1b')])){members[_0x42c937[_0x939a('0x1b')]]={'channel':_0x939a('0x1d'),'interface':_0x42c937['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0x939a('0x1e')};}break;case'NOT_INUSE':if(!_[_0x939a('0x1f')](members[_0x42c937[_0x939a('0x1b')]])){members[_0x42c937['device']][_0x939a('0x20')]=utils['now']();members[_0x42c937[_0x939a('0x1b')]]['duration']=utils[_0x939a('0x21')](members[_0x42c937[_0x939a('0x1b')]][_0x939a('0x20')],members[_0x42c937[_0x939a('0x1b')]][_0x939a('0x22')]);if(members[_0x42c937[_0x939a('0x1b')]][_0x939a('0x8')]){writeDB(members[_0x42c937[_0x939a('0x1b')]]);}}break;default:break;}}catch(_0x350be5){utils[_0x939a('0x14')](util[_0x939a('0x6')](_0x939a('0x19'),members[_0x42c937[_0x939a('0x1b')]]?members[_0x42c937[_0x939a('0x1b')]][_0x939a('0x8')]:_0x42c937['device']),_0x350be5);}};exports[_0x939a('0x23')]=function(_0x5d7cfe){try{if(!_[_0x939a('0x1f')](members[_0x5d7cfe[_0x939a('0x9')]])){utils[_0x939a('0x18')](util[_0x939a('0x6')]('[%s][members][agentcomplete]',_0x5d7cfe['uniqueid']),_0x5d7cfe);utils[_0x939a('0x5')](util[_0x939a('0x6')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5d7cfe[_0x939a('0x8')],_0x5d7cfe['interface'],_0x5d7cfe['queue']));members[_0x5d7cfe[_0x939a('0x9')]]=_[_0x939a('0x24')](members[_0x5d7cfe[_0x939a('0x9')]],{'data4':_0x5d7cfe['queue'],'uniqueid':_0x5d7cfe[_0x939a('0x8')]});}}catch(_0x7ca538){utils[_0x939a('0x14')](util[_0x939a('0x6')](_0x939a('0x25'),_0x5d7cfe[_0x939a('0x8')]),_0x7ca538);}};exports[_0x939a('0x26')]=function(_0x51b98e){try{utils[_0x939a('0x18')](util[_0x939a('0x6')]('[%s][members][cdr]',_0x51b98e[_0x939a('0x8')]),_0x51b98e);if(_0x51b98e[_0x939a('0x27')]){var _0x587e54=_0x51b98e[_0x939a('0x27')]['split']('-')[0x0];if(!_[_0x939a('0x1f')](members[_0x587e54])){members[_0x587e54]=_[_0x939a('0x24')](members[_0x587e54],{'data1':members[_0x587e54][_0x939a('0x28')]||_0x51b98e[_0x939a('0xc')],'data2':members[_0x587e54][_0x939a('0xa')]||_0x51b98e[_0x939a('0x29')],'data3':members[_0x587e54][_0x939a('0x2a')]||_0x51b98e[_0x939a('0x2b')],'uniqueid':members[_0x587e54][_0x939a('0x8')]||_0x51b98e[_0x939a('0x8')]});utils[_0x939a('0x5')](util[_0x939a('0x6')](_0x939a('0x2c'),_0x51b98e[_0x939a('0x8')],members[_0x587e54][_0x939a('0x28')],members[_0x587e54]['data2'],members[_0x587e54][_0x939a('0x2a')]));if(members[_0x587e54][_0x939a('0x20')]){writeDB(members[_0x587e54]);}}}if(_0x51b98e['destinationchannel']){var _0x14f5a8=_0x51b98e[_0x939a('0x2d')][_0x939a('0x2e')]('-')[0x0];if(!_[_0x939a('0x1f')](members[_0x14f5a8])){members[_0x14f5a8]=_[_0x939a('0x24')](members[_0x14f5a8],{'data1':members[_0x14f5a8][_0x939a('0x28')]||_0x51b98e[_0x939a('0xc')],'data2':members[_0x14f5a8]['data2']||_0x51b98e[_0x939a('0x29')],'data3':members[_0x14f5a8][_0x939a('0x2a')]||_0x51b98e[_0x939a('0x2b')],'uniqueid':members[_0x14f5a8][_0x939a('0x8')]||_0x51b98e['uniqueid']});utils[_0x939a('0x5')](util[_0x939a('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x51b98e[_0x939a('0x8')],members[_0x14f5a8][_0x939a('0x28')],members[_0x14f5a8][_0x939a('0xa')],members[_0x14f5a8][_0x939a('0x2a')]));if(members[_0x14f5a8][_0x939a('0x20')]){writeDB(members[_0x14f5a8]);}}}}catch(_0x427bab){utils[_0x939a('0x14')](util[_0x939a('0x6')](_0x939a('0x2f'),_0x51b98e[_0x939a('0x8')]),_0x427bab);}}; \ No newline at end of file +var _0x8c91=['exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','then','membername','name','internal','CreateMemberReport','getUserByName','catch','error','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','agent','NOT_INUSE','isNil'];(function(_0x18cabd,_0x4c086d){var _0x737f87=function(_0xec94b0){while(--_0xec94b0){_0x18cabd['push'](_0x18cabd['shift']());}};_0x737f87(++_0x4c086d);}(_0x8c91,0x169));var _0x18c9=function(_0x4a12a4,_0xf61ff8){_0x4a12a4=_0x4a12a4-0x0;var _0x36c1d3=_0x8c91[_0x4a12a4];return _0x36c1d3;};'use strict';var _=require(_0x18c9('0x0'));var util=require(_0x18c9('0x1'));var utils=require(_0x18c9('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x18c9('0x3')];function writeDB(_0x1911d0){utils[_0x18c9('0x4')](util[_0x18c9('0x5')](_0x18c9('0x6'),_0x1911d0[_0x18c9('0x7')],_0x1911d0[_0x18c9('0x8')],_0x1911d0[_0x18c9('0x9')],_0x1911d0['data2'],_0x1911d0['membername'],_0x1911d0[_0x18c9('0xa')]));if(_0x1911d0[_0x18c9('0x8')]){utils['getUserByInterface'](_0x1911d0[_0x18c9('0x8')])[_0x18c9('0xb')](function(_0x4b5f14){if(_0x4b5f14){_0x1911d0[_0x18c9('0xc')]=_0x4b5f14[_0x18c9('0xd')];_0x1911d0[_0x18c9('0xe')]=_0x4b5f14[_0x18c9('0xe')];utils['request'](_0x18c9('0xf'),_0x1911d0);}else{utils[_0x18c9('0x10')](_0x1911d0['interface']['split']('/')[0x1])[_0x18c9('0xb')](function(_0x508c13){if(_0x508c13){_0x1911d0[_0x18c9('0xc')]=_0x508c13[_0x18c9('0xd')];_0x1911d0[_0x18c9('0xe')]=_0x508c13['internal'];utils['request'](_0x18c9('0xf'),_0x1911d0);}});}})[_0x18c9('0x11')](function(_0x3cc74f){utils[_0x18c9('0x12')](util['format']('[%s][members][writeDB]',_0x1911d0[_0x18c9('0x7')]),_0x3cc74f);});}delete members[_0x1911d0[_0x18c9('0x8')]];}function startsWith(_0x3e6dfd,_0x329246){return _[_0x18c9('0x13')](_0x3e6dfd,function(_0x2c2779){return _[_0x18c9('0x14')](_0x329246,_0x2c2779);});}exports['devicestatechange']=function(_0xd18fd6){try{utils[_0x18c9('0x15')](util[_0x18c9('0x5')]('[%s][members][devicestatechange]',members[_0xd18fd6[_0x18c9('0x16')]]?members[_0xd18fd6[_0x18c9('0x16')]][_0x18c9('0x7')]:_0xd18fd6['device']),_0xd18fd6);utils['info'](util[_0x18c9('0x5')](_0x18c9('0x17'),members[_0xd18fd6['device']]?members[_0xd18fd6[_0x18c9('0x16')]][_0x18c9('0x7')]:_0xd18fd6[_0x18c9('0x16')],_0xd18fd6['state'],_0xd18fd6[_0x18c9('0x16')]));switch(_0xd18fd6[_0x18c9('0x18')]){case _0x18c9('0x19'):case'BUSY':if(!startsWith(exclude,_0xd18fd6[_0x18c9('0x16')])){members[_0xd18fd6['device']]={'channel':_0x18c9('0x1a'),'interface':_0xd18fd6[_0x18c9('0x16')],'type':'TALKING','enterAt':utils[_0x18c9('0x1b')](),'role':_0x18c9('0x1c')};}break;case _0x18c9('0x1d'):if(!_[_0x18c9('0x1e')](members[_0xd18fd6['device']])){members[_0xd18fd6[_0x18c9('0x16')]][_0x18c9('0x1f')]=utils['now']();members[_0xd18fd6['device']]['duration']=utils[_0x18c9('0x20')](members[_0xd18fd6['device']][_0x18c9('0x1f')],members[_0xd18fd6[_0x18c9('0x16')]][_0x18c9('0x21')]);if(members[_0xd18fd6[_0x18c9('0x16')]][_0x18c9('0x7')]){writeDB(members[_0xd18fd6[_0x18c9('0x16')]]);}}break;default:break;}}catch(_0x33e12e){utils[_0x18c9('0x12')](util['format']('[%s][members][devicestatechange]',members[_0xd18fd6[_0x18c9('0x16')]]?members[_0xd18fd6[_0x18c9('0x16')]][_0x18c9('0x7')]:_0xd18fd6['device']),_0x33e12e);}};exports[_0x18c9('0x22')]=function(_0x4b8421){try{if(!_['isNil'](members[_0x4b8421[_0x18c9('0x8')]])){utils[_0x18c9('0x15')](util['format'](_0x18c9('0x23'),_0x4b8421[_0x18c9('0x7')]),_0x4b8421);utils[_0x18c9('0x4')](util[_0x18c9('0x5')](_0x18c9('0x24'),_0x4b8421[_0x18c9('0x7')],_0x4b8421['interface'],_0x4b8421[_0x18c9('0x25')]));members[_0x4b8421[_0x18c9('0x8')]]=_[_0x18c9('0x26')](members[_0x4b8421[_0x18c9('0x8')]],{'data4':_0x4b8421[_0x18c9('0x25')],'uniqueid':_0x4b8421[_0x18c9('0x7')]});}}catch(_0x516254){utils[_0x18c9('0x12')](util[_0x18c9('0x5')](_0x18c9('0x23'),_0x4b8421[_0x18c9('0x7')]),_0x516254);}};exports[_0x18c9('0x27')]=function(_0x484512){try{utils[_0x18c9('0x15')](util[_0x18c9('0x5')](_0x18c9('0x28'),_0x484512['uniqueid']),_0x484512);if(_0x484512[_0x18c9('0x9')]){var _0x4c1a7f=_0x484512[_0x18c9('0x9')][_0x18c9('0x29')]('-')[0x0];if(!_[_0x18c9('0x1e')](members[_0x4c1a7f])){members[_0x4c1a7f]=_['assign'](members[_0x4c1a7f],{'data1':members[_0x4c1a7f][_0x18c9('0x2a')]||_0x484512[_0x18c9('0xa')],'data2':members[_0x4c1a7f][_0x18c9('0x2b')]||_0x484512['source'],'data3':members[_0x4c1a7f][_0x18c9('0x2c')]||_0x484512[_0x18c9('0x2d')],'uniqueid':members[_0x4c1a7f][_0x18c9('0x7')]||_0x484512['uniqueid']});utils[_0x18c9('0x4')](util[_0x18c9('0x5')](_0x18c9('0x2e'),_0x484512['uniqueid'],members[_0x4c1a7f][_0x18c9('0x2a')],members[_0x4c1a7f][_0x18c9('0x2b')],members[_0x4c1a7f]['data3']));if(members[_0x4c1a7f][_0x18c9('0x1f')]){writeDB(members[_0x4c1a7f]);}}}if(_0x484512[_0x18c9('0x2f')]){var _0x33a9dc=_0x484512['destinationchannel'][_0x18c9('0x29')]('-')[0x0];if(!_[_0x18c9('0x1e')](members[_0x33a9dc])){members[_0x33a9dc]=_['assign'](members[_0x33a9dc],{'data1':members[_0x33a9dc]['data1']||_0x484512[_0x18c9('0xa')],'data2':members[_0x33a9dc]['data2']||_0x484512[_0x18c9('0x30')],'data3':members[_0x33a9dc]['data3']||_0x484512[_0x18c9('0x2d')],'uniqueid':members[_0x33a9dc][_0x18c9('0x7')]||_0x484512[_0x18c9('0x7')]});utils[_0x18c9('0x4')](util[_0x18c9('0x5')](_0x18c9('0x2e'),_0x484512[_0x18c9('0x7')],members[_0x33a9dc]['data1'],members[_0x33a9dc][_0x18c9('0x2b')],members[_0x33a9dc][_0x18c9('0x2c')]));if(members[_0x33a9dc]['exitAt']){writeDB(members[_0x33a9dc]);}}}}catch(_0x30033d){utils[_0x18c9('0x12')](util['format'](_0x18c9('0x28'),_0x484512[_0x18c9('0x7')]),_0x30033d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 750f19a..32d198a 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 _0x8a0e=['secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','then','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexitAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','error','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x8a0e,0x13f));var _0xe8a0=function(_0x37d801,_0x3bce0f){_0x37d801=_0x37d801-0x0;var _0x59dced=_0x8a0e[_0x37d801];return _0x59dced;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x17139b){utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x2'),_0x17139b[_0xe8a0('0x3')],_0x17139b[_0xe8a0('0x4')],_0x17139b[_0xe8a0('0x5')],_0x17139b[_0xe8a0('0x6')],_0x17139b[_0xe8a0('0x7')],_0x17139b[_0xe8a0('0x8')],_0x17139b['queuecallerexitreason']));if(_0x17139b[_0xe8a0('0x5')]){utils['getVoiceQueueByName'](_0x17139b[_0xe8a0('0x5')])[_0xe8a0('0x9')](function(_0x4f8329){if(_0x4f8329){_0x17139b['type']=_0x4f8329['type'];}utils['request'](_0xe8a0('0xa'),_0x17139b);});}else{utils[_0xe8a0('0xb')]('CreateVoiceQueueReport',_0x17139b);}if(_0x17139b[_0xe8a0('0xc')]){delete queues[_0x17139b[_0xe8a0('0xc')]];}else{delete queues[_0x17139b[_0xe8a0('0x3')]];}}exports[_0xe8a0('0xd')]=function(_0xda9967){try{utils[_0xe8a0('0xe')](util[_0xe8a0('0x1')](_0xe8a0('0xf'),_0xda9967['uniqueid']),_0xda9967);utils[_0xe8a0('0x0')](util['format'](_0xe8a0('0x10'),_0xda9967[_0xe8a0('0x3')],_0xda9967[_0xe8a0('0x5')],_0xda9967[_0xe8a0('0x11')]));queues[_0xda9967[_0xe8a0('0x3')]]=_[_0xe8a0('0x12')](_0xda9967,{'originalposition':_0xda9967[_0xe8a0('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x28fdc6){utils['error'](util['format'](_0xe8a0('0xf'),_0xda9967[_0xe8a0('0x3')]),_0x28fdc6);}};exports[_0xe8a0('0x13')]=function(_0x303cd7){try{if(!_['isNil'](queues[_0x303cd7[_0xe8a0('0x3')]])){utils[_0xe8a0('0xe')](util[_0xe8a0('0x1')](_0xe8a0('0x14'),_0x303cd7[_0xe8a0('0x3')]),_0x303cd7);if(queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0x15')]){if(!queues[_0x303cd7[_0xe8a0('0x3')]]['queuecallerabandon']&&!queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0x16')]){queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0x17')]=!![];queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0x18')]=utils[_0xe8a0('0x19')]();queues[_0x303cd7['uniqueid']][_0xe8a0('0x1a')]=_0xe8a0('0x1b');}utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x1c'),_0x303cd7[_0xe8a0('0x3')],queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0x1d')],queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0x1a')]));writeDB(queues[_0x303cd7[_0xe8a0('0x3')]]);}else if(queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0xc')]){utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x1e'),_0x303cd7['uniqueid'],queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0x1d')],queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0xc')]));queues[queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0xc')]]=queues[_0x303cd7[_0xe8a0('0x3')]];queues[queues[_0x303cd7[_0xe8a0('0x3')]][_0xe8a0('0xc')]][_0xe8a0('0x1f')]=0x2;delete queues[_0x303cd7[_0xe8a0('0x3')]];}}}catch(_0x4f6b95){utils['error'](util[_0xe8a0('0x1')](_0xe8a0('0x14'),_0x303cd7[_0xe8a0('0x3')]),_0x4f6b95);}};exports[_0xe8a0('0x20')]=function(_0x544167){try{utils[_0xe8a0('0xe')](util[_0xe8a0('0x1')](_0xe8a0('0x21'),_0x544167[_0xe8a0('0x3')]),_0x544167);if(!_[_0xe8a0('0x22')](_0x544167[_0xe8a0('0x23')][_0xe8a0('0x24')])&&_0x544167[_0xe8a0('0x25')][_0xe8a0('0x26')]()!==_0xe8a0('0x27')){if(!_[_0xe8a0('0x22')](queues[_0x544167[_0xe8a0('0x3')]])){queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x28')]=![];queues[_0x544167[_0xe8a0('0x3')]]['queuecallerabandonAt']=null;queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x16')]=!![];queues[_0x544167[_0xe8a0('0x3')]]['queuecallerexitAt']=utils['now']();queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x1a')]=_0x544167[_0xe8a0('0x25')][_0xe8a0('0x26')]();utils['info'](util[_0xe8a0('0x1')](_0xe8a0('0x29'),_0x544167[_0xe8a0('0x3')],queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x1d')],_0x544167['value'],queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x1a')]));writeDB(queues[_0x544167[_0xe8a0('0x3')]]);}}else if(!_[_0xe8a0('0x22')](_0x544167[_0xe8a0('0x23')][_0xe8a0('0x2a')])){if(!_[_0xe8a0('0x22')](queues[_0x544167[_0xe8a0('0x3')]])&&!queues[_0x544167['uniqueid']][_0xe8a0('0x28')]){queues[_0x544167[_0xe8a0('0x3')]]['queuecallerabandon']=![];queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x2b')]=null;queues[_0x544167['uniqueid']]['queuecallerexit']=!![];queues[_0x544167['uniqueid']]['queuecallerexitAt']=utils[_0xe8a0('0x19')]();queues[_0x544167['uniqueid']][_0xe8a0('0x1a')]='EXITWITHKEY';utils['info'](util[_0xe8a0('0x1')](_0xe8a0('0x2c'),_0x544167[_0xe8a0('0x3')],queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x1d')],_0x544167[_0xe8a0('0x25')],queues[_0x544167[_0xe8a0('0x3')]][_0xe8a0('0x1a')]));}}}catch(_0x3ba21f){utils['error'](util['format'](_0xe8a0('0x21'),_0x544167[_0xe8a0('0x3')]),_0x3ba21f);}};exports[_0xe8a0('0x28')]=function(_0x5fc567){try{if(!_[_0xe8a0('0x22')](queues[_0x5fc567[_0xe8a0('0x3')]])){utils[_0xe8a0('0xe')](util[_0xe8a0('0x1')](_0xe8a0('0x2d'),_0x5fc567['uniqueid']),_0x5fc567);queues[_0x5fc567[_0xe8a0('0x3')]][_0xe8a0('0x16')]=![];queues[_0x5fc567[_0xe8a0('0x3')]][_0xe8a0('0x2e')]=null;queues[_0x5fc567['uniqueid']][_0xe8a0('0x28')]=!![];queues[_0x5fc567[_0xe8a0('0x3')]]['queuecallerabandonAt']=utils[_0xe8a0('0x19')]();queues[_0x5fc567[_0xe8a0('0x3')]][_0xe8a0('0x1a')]='ABANDONED';utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x2f'),_0x5fc567[_0xe8a0('0x3')],queues[_0x5fc567[_0xe8a0('0x3')]][_0xe8a0('0x1d')],queues[_0x5fc567['uniqueid']]['queuecallerexitreason']));}}catch(_0x430af6){utils[_0xe8a0('0x30')](util[_0xe8a0('0x1')](_0xe8a0('0x2d'),_0x5fc567[_0xe8a0('0x3')]),_0x430af6);}};exports[_0xe8a0('0x31')]=function(_0x1f33c4){try{if(!_[_0xe8a0('0x22')](queues[_0x1f33c4[_0xe8a0('0x3')]])){utils['debug'](util['format'](_0xe8a0('0x32'),_0x1f33c4['uniqueid']),_0x1f33c4);utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x33'),_0x1f33c4[_0xe8a0('0x3')],queues[_0x1f33c4['uniqueid']][_0xe8a0('0x1d')],_0x1f33c4['connectedlinenum'],_0x1f33c4[_0xe8a0('0x34')]));queues[_0x1f33c4['uniqueid']][_0xe8a0('0x31')]=!![];queues[_0x1f33c4[_0xe8a0('0x3')]]['queuecallerleaveAt']=utils[_0xe8a0('0x19')]();queues[_0x1f33c4[_0xe8a0('0x3')]][_0xe8a0('0x35')]=utils[_0xe8a0('0x36')](queues[_0x1f33c4[_0xe8a0('0x3')]][_0xe8a0('0x15')],queues[_0x1f33c4[_0xe8a0('0x3')]][_0xe8a0('0x37')]);queues[_0x1f33c4['uniqueid']][_0xe8a0('0x11')]=_0x1f33c4['position'];queues[_0x1f33c4[_0xe8a0('0x3')]][_0xe8a0('0x38')]=_0x1f33c4[_0xe8a0('0x38')];queues[_0x1f33c4[_0xe8a0('0x3')]][_0xe8a0('0x39')]=_0x1f33c4['connectedlinenum'];queues[_0x1f33c4[_0xe8a0('0x3')]][_0xe8a0('0x34')]=_0x1f33c4['connectedlinename'];}}catch(_0x1b0df3){utils[_0xe8a0('0x30')](util[_0xe8a0('0x1')](_0xe8a0('0x32'),_0x1f33c4[_0xe8a0('0x3')]),_0x1b0df3);}};exports[_0xe8a0('0x3a')]=function(_0x5ddf64){try{if(!_[_0xe8a0('0x22')](queues[_0x5ddf64[_0xe8a0('0x3')]])){utils['debug'](util[_0xe8a0('0x1')](_0xe8a0('0x3b'),_0x5ddf64['uniqueid']),_0x5ddf64);utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x3c'),_0x5ddf64[_0xe8a0('0x3')],queues[_0x5ddf64[_0xe8a0('0x3')]][_0xe8a0('0x1d')],_0x5ddf64[_0xe8a0('0x3d')],_0x5ddf64[_0xe8a0('0x3e')]));queues[_0x5ddf64['uniqueid']][_0xe8a0('0x28')]=![];queues[_0x5ddf64[_0xe8a0('0x3')]][_0xe8a0('0x28')]=![];queues[_0x5ddf64[_0xe8a0('0x3')]][_0xe8a0('0x2b')]=null;queues[_0x5ddf64[_0xe8a0('0x3')]][_0xe8a0('0x16')]=![];queues[_0x5ddf64[_0xe8a0('0x3')]][_0xe8a0('0x1a')]=null;queues[_0x5ddf64[_0xe8a0('0x3')]][_0xe8a0('0x2e')]=null;queues[_0x5ddf64['uniqueid']]['assigned']=!![];queues[_0x5ddf64[_0xe8a0('0x3')]][_0xe8a0('0x8')]=_0x5ddf64[_0xe8a0('0x3e')];queues[_0x5ddf64[_0xe8a0('0x3')]]['lastAssignedTo']=_0x5ddf64[_0xe8a0('0x3d')];}}catch(_0x3a7947){utils['error'](util[_0xe8a0('0x1')](_0xe8a0('0x3b'),_0x5ddf64[_0xe8a0('0x3')]),_0x3a7947);}};exports[_0xe8a0('0x3f')]=function(_0x13bbee){try{if(!_['isNil'](queues[_0x13bbee[_0xe8a0('0x3')]])){if(queues[_0x13bbee['uniqueid']][_0xe8a0('0x15')]){utils[_0xe8a0('0xe')](util[_0xe8a0('0x1')](_0xe8a0('0x40'),_0x13bbee[_0xe8a0('0x3')]),_0x13bbee);queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x28')]=![];queues[_0x13bbee[_0xe8a0('0x3')]]['queuecallerabandon']=![];queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x2b')]=null;queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x16')]=![];queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x2e')]=null;queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x41')]=!![];queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x6')]=_0x13bbee[_0xe8a0('0x3d')];queues[_0x13bbee[_0xe8a0('0x3')]]['queuecallercomplete']=!![];queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x18')]=utils[_0xe8a0('0x19')]();if(_0x13bbee[_0xe8a0('0x42')]==_0xe8a0('0x43')){if(!queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x43')]){queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x1a')]=_0xe8a0('0x44');}}else{queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x1a')]='COMPLETEDBY'+_0x13bbee[_0xe8a0('0x42')]['toUpperCase']();}utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x13bbee[_0xe8a0('0x3')],queues[_0x13bbee['uniqueid']][_0xe8a0('0x1d')],_0x13bbee[_0xe8a0('0x3d')],queues[_0x13bbee[_0xe8a0('0x3')]][_0xe8a0('0x1a')]));writeDB(queues[_0x13bbee[_0xe8a0('0x3')]]);}}}catch(_0x43de92){utils['error'](util[_0xe8a0('0x1')](_0xe8a0('0x40'),_0x13bbee[_0xe8a0('0x3')]),_0x43de92);}};exports['blindtransfer']=function(_0x429cb9){try{if(!_[_0xe8a0('0x22')](queues[_0x429cb9[_0xe8a0('0x45')]])){utils['debug'](util['format'](_0xe8a0('0x46'),_0x429cb9[_0xe8a0('0x3')]),_0x429cb9);queues[_0x429cb9[_0xe8a0('0x45')]][_0xe8a0('0x43')]=!![];queues[_0x429cb9[_0xe8a0('0x45')]][_0xe8a0('0x47')]=_0xe8a0('0x48');queues[_0x429cb9[_0xe8a0('0x45')]][_0xe8a0('0x49')]=_0x429cb9[_0xe8a0('0x4a')];queues[_0x429cb9[_0xe8a0('0x45')]][_0xe8a0('0x4b')]=_0x429cb9[_0xe8a0('0x45')];queues[_0x429cb9[_0xe8a0('0x45')]][_0xe8a0('0x1a')]='BLINDTRANSFER';utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x4c'),_0x429cb9[_0xe8a0('0x3')],queues[_0x429cb9[_0xe8a0('0x45')]][_0xe8a0('0x1d')],_0x429cb9[_0xe8a0('0x45')],_0x429cb9[_0xe8a0('0x4a')]));}}catch(_0x12fd80){utils[_0xe8a0('0x30')](util[_0xe8a0('0x1')](_0xe8a0('0x46'),_0x429cb9[_0xe8a0('0x3')]),_0x12fd80);}};exports[_0xe8a0('0x4d')]=function(_0x111997){try{utils[_0xe8a0('0xe')](util[_0xe8a0('0x1')](_0xe8a0('0x4e'),_0x111997[_0xe8a0('0x4f')]),_0x111997);if(_0x111997['origtransfereruniqueid']==_0x111997[_0xe8a0('0x50')]){if(!_[_0xe8a0('0x22')](queues[_0x111997[_0xe8a0('0x51')]])){utils['info'](util['format'](_0xe8a0('0x52'),_0x111997['origtransfereruniqueid'],queues[_0x111997['secondtransfererlinkedid']][_0xe8a0('0x1d')],_0x111997[_0xe8a0('0x53')]));queues[_0x111997[_0xe8a0('0x51')]][_0xe8a0('0x43')]=!![];queues[_0x111997['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x111997[_0xe8a0('0x51')]][_0xe8a0('0x49')]=_0x111997['origtransfererexten'];queues[_0x111997[_0xe8a0('0x51')]][_0xe8a0('0x4b')]=_0x111997[_0xe8a0('0x4f')];queues[_0x111997[_0xe8a0('0x51')]][_0xe8a0('0x1a')]='ATTENDEDTRANSFER';}if(!_[_0xe8a0('0x22')](queues[_0x111997[_0xe8a0('0x50')]])){if(_0x111997[_0xe8a0('0x54')]&&queues[_0x111997[_0xe8a0('0x54')]]){queues[_0x111997[_0xe8a0('0x54')]][_0xe8a0('0x1f')]=0x1;queues[_0x111997[_0xe8a0('0x45')]]=_[_0xe8a0('0x55')](queues[_0x111997['transfereelinkedid']]);queues[_0x111997[_0xe8a0('0x45')]][_0xe8a0('0xc')]=_0x111997['transfertargetuniqueid'];queues[_0x111997[_0xe8a0('0x45')]][_0xe8a0('0x1f')]=0x2;queues[_0x111997[_0xe8a0('0x45')]]['calleridnum']=queues[_0x111997[_0xe8a0('0x51')]][_0xe8a0('0x7')];queues[_0x111997[_0xe8a0('0x45')]][_0xe8a0('0x56')]=queues[_0x111997[_0xe8a0('0x51')]]['calleridname'];queues[_0x111997['transfereeuniqueid']][_0xe8a0('0x37')]=utils['now']();queues[_0x111997[_0xe8a0('0x45')]]['queuecallerleaveAt']=utils[_0xe8a0('0x19')]();queues[_0x111997[_0xe8a0('0x45')]]['holdtime']=0x0;queues[_0x111997[_0xe8a0('0x45')]][_0xe8a0('0x57')]=0x0;utils['info'](util[_0xe8a0('0x1')](_0xe8a0('0x58'),_0x111997[_0xe8a0('0x4f')],queues[_0x111997[_0xe8a0('0x45')]][_0xe8a0('0x1d')],queues[_0x111997['transfereeuniqueid']][_0xe8a0('0x7')],queues[_0x111997[_0xe8a0('0x45')]][_0xe8a0('0x56')]));}else{utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x59'),_0x111997['origtransfereruniqueid'],queues[_0x111997[_0xe8a0('0x50')]][_0xe8a0('0x1d')],_0x111997['secondtransfererlinkedid']));queues[_0x111997[_0xe8a0('0x50')]][_0xe8a0('0xc')]=_0x111997['secondtransfererlinkedid'];}}}else if(_0x111997[_0xe8a0('0x5a')]==_0x111997[_0xe8a0('0x51')]){if(!_[_0xe8a0('0x22')](queues[_0x111997[_0xe8a0('0x50')]])){utils[_0xe8a0('0x0')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x111997[_0xe8a0('0x4f')],queues[_0x111997[_0xe8a0('0x50')]][_0xe8a0('0x1d')],_0x111997[_0xe8a0('0x5a')],_0x111997[_0xe8a0('0x5b')]));queues[_0x111997[_0xe8a0('0x50')]][_0xe8a0('0x43')]=!![];queues[_0x111997['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x111997['origtransfererlinkedid']][_0xe8a0('0x49')]=_0x111997['secondtransfererexten'];queues[_0x111997[_0xe8a0('0x50')]]['transferuniqueid']=_0x111997['secondtransfereruniqueid'];queues[_0x111997[_0xe8a0('0x50')]][_0xe8a0('0x1a')]=_0xe8a0('0x5c');}if(!_[_0xe8a0('0x22')](queues[_0x111997[_0xe8a0('0x51')]])){if(_0x111997[_0xe8a0('0x5d')]&&queues[_0x111997[_0xe8a0('0x5d')]]){queues[_0x111997[_0xe8a0('0x5d')]][_0xe8a0('0x1f')]=0x1;queues[_0x111997['transfertargetuniqueid']]=_[_0xe8a0('0x55')](queues[_0x111997[_0xe8a0('0x5d')]]);queues[_0x111997[_0xe8a0('0x5e')]]['transfereduniqueid']=_0x111997[_0xe8a0('0x5e')];queues[_0x111997['transfertargetuniqueid']][_0xe8a0('0x1f')]=0x2;queues[_0x111997['transfertargetuniqueid']][_0xe8a0('0x7')]=queues[_0x111997['origtransfererlinkedid']][_0xe8a0('0x7')];queues[_0x111997['transfertargetuniqueid']][_0xe8a0('0x56')]=queues[_0x111997[_0xe8a0('0x50')]]['calleridname'];queues[_0x111997[_0xe8a0('0x5e')]][_0xe8a0('0x37')]=utils['now']();queues[_0x111997[_0xe8a0('0x5e')]][_0xe8a0('0x15')]=utils['now']();queues[_0x111997[_0xe8a0('0x5e')]][_0xe8a0('0x35')]=0x0;queues[_0x111997[_0xe8a0('0x5e')]][_0xe8a0('0x57')]=0x0;utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x5f'),_0x111997[_0xe8a0('0x4f')],queues[_0x111997[_0xe8a0('0x5e')]]['name'],queues[_0x111997[_0xe8a0('0x5e')]]['transfereduniqueid'],queues[_0x111997['transfertargetuniqueid']][_0xe8a0('0x7')],queues[_0x111997[_0xe8a0('0x5e')]][_0xe8a0('0x56')]));}else{utils['info'](util['format'](_0xe8a0('0x59'),_0x111997[_0xe8a0('0x4f')],queues[_0x111997[_0xe8a0('0x51')]]['name'],_0x111997[_0xe8a0('0x50')]));queues[_0x111997[_0xe8a0('0x51')]][_0xe8a0('0xc')]=_0x111997[_0xe8a0('0x50')];}}}}catch(_0x5af741){utils[_0xe8a0('0x30')](util[_0xe8a0('0x1')](_0xe8a0('0x4e'),_0x111997[_0xe8a0('0x4f')]),_0x5af741);}};exports['musiconholdstart']=function(_0x1ecdde){try{if(!_['isNil'](queues[_0x1ecdde[_0xe8a0('0x3')]])){utils[_0xe8a0('0xe')](util[_0xe8a0('0x1')](_0xe8a0('0x60'),_0x1ecdde[_0xe8a0('0x3')]),_0x1ecdde);queues[_0x1ecdde[_0xe8a0('0x3')]][_0xe8a0('0x61')]=utils[_0xe8a0('0x19')]();utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1ecdde[_0xe8a0('0x3')],queues[_0x1ecdde[_0xe8a0('0x3')]][_0xe8a0('0x1d')],queues[_0x1ecdde[_0xe8a0('0x3')]][_0xe8a0('0x61')]));}}catch(_0x19d85e){utils[_0xe8a0('0x30')](util[_0xe8a0('0x1')]('[%s][queues][musiconholdstart]',_0x1ecdde['uniqueid']),_0x19d85e);}};exports[_0xe8a0('0x62')]=function(_0xf664a3){try{if(!_[_0xe8a0('0x22')](queues[_0xf664a3[_0xe8a0('0x3')]])){if(!_[_0xe8a0('0x22')](queues[_0xf664a3[_0xe8a0('0x3')]][_0xe8a0('0x61')])){utils['debug'](util[_0xe8a0('0x1')]('[%s][queues][musiconholdstop]',_0xf664a3[_0xe8a0('0x3')]),_0xf664a3);queues[_0xf664a3[_0xe8a0('0x3')]][_0xe8a0('0x57')]+=utils['diffTime'](utils[_0xe8a0('0x19')](),queues[_0xf664a3[_0xe8a0('0x3')]]['musiconholdstartAt']);utils[_0xe8a0('0x0')](util[_0xe8a0('0x1')](_0xe8a0('0x63'),_0xf664a3['uniqueid'],queues[_0xf664a3['uniqueid']]['name'],queues[_0xf664a3[_0xe8a0('0x3')]][_0xe8a0('0x57')]));delete queues[_0xf664a3[_0xe8a0('0x3')]][_0xe8a0('0x61')];}}}catch(_0x85f206){utils[_0xe8a0('0x30')](util[_0xe8a0('0x1')]('[%s][queues][musiconholdstop]',_0xf664a3[_0xe8a0('0x3')]),_0x85f206);}}; \ No newline at end of file +var _0xc4d6=['value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','count','connectedlinenum','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','destaccountcode','assigned','membername','agentcomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','extension','transferuniqueid','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','transferexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','queuecallerjoinAt','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','name','queuecallerenterreason','varset','variable','queuestatus'];(function(_0x3a0961,_0x2b4846){var _0x25b302=function(_0x67d6f9){while(--_0x67d6f9){_0x3a0961['push'](_0x3a0961['shift']());}};_0x25b302(++_0x2b4846);}(_0xc4d6,0x1c1));var _0x6c4d=function(_0x49e4c5,_0x1bdc1e){_0x49e4c5=_0x49e4c5-0x0;var _0x2a4ceb=_0xc4d6[_0x49e4c5];return _0x2a4ceb;};'use strict';var _=require(_0x6c4d('0x0'));var util=require(_0x6c4d('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x5caf08){utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')](_0x6c4d('0x4'),_0x5caf08[_0x6c4d('0x5')],_0x5caf08[_0x6c4d('0x6')],_0x5caf08[_0x6c4d('0x7')],_0x5caf08[_0x6c4d('0x8')],_0x5caf08[_0x6c4d('0x9')],_0x5caf08[_0x6c4d('0xa')],_0x5caf08[_0x6c4d('0xb')]));if(_0x5caf08[_0x6c4d('0x7')]){utils[_0x6c4d('0xc')](_0x5caf08[_0x6c4d('0x7')])[_0x6c4d('0xd')](function(_0x50151b){if(_0x50151b){_0x5caf08[_0x6c4d('0xe')]=_0x50151b[_0x6c4d('0xe')];}utils[_0x6c4d('0xf')](_0x6c4d('0x10'),_0x5caf08);});}else{utils[_0x6c4d('0xf')](_0x6c4d('0x10'),_0x5caf08);}if(_0x5caf08[_0x6c4d('0x11')]){delete queues[_0x5caf08[_0x6c4d('0x11')]];}else{delete queues[_0x5caf08[_0x6c4d('0x5')]];}}exports[_0x6c4d('0x12')]=function(_0x46452c){try{utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')]('[%s][queues][queuecallerjoin]',_0x46452c[_0x6c4d('0x5')]),_0x46452c);utils['info'](util['format'](_0x6c4d('0x14'),_0x46452c[_0x6c4d('0x5')],_0x46452c[_0x6c4d('0x7')],_0x46452c[_0x6c4d('0x15')]));queues[_0x46452c['uniqueid']]=_[_0x6c4d('0x16')](_0x46452c,{'originalposition':_0x46452c[_0x6c4d('0x15')],'queuecallerjoinAt':utils[_0x6c4d('0x17')](),'mohtime':0x0});}catch(_0x22f59c){utils[_0x6c4d('0x18')](util[_0x6c4d('0x3')]('[%s][queues][queuecallerjoin]',_0x46452c[_0x6c4d('0x5')]),_0x22f59c);}};exports[_0x6c4d('0x19')]=function(_0x3e6f2a){try{if(!_[_0x6c4d('0x1a')](queues[_0x3e6f2a[_0x6c4d('0x5')]])){utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')](_0x6c4d('0x1b'),_0x3e6f2a['uniqueid']),_0x3e6f2a);if(queues[_0x3e6f2a[_0x6c4d('0x5')]]['queuecallerleaveAt']){if(!queues[_0x3e6f2a['uniqueid']][_0x6c4d('0x1c')]&&!queues[_0x3e6f2a['uniqueid']][_0x6c4d('0x1d')]){queues[_0x3e6f2a['uniqueid']][_0x6c4d('0x1e')]=!![];queues[_0x3e6f2a[_0x6c4d('0x5')]]['queuecallercompleteAt']=utils[_0x6c4d('0x17')]();queues[_0x3e6f2a['uniqueid']]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util[_0x6c4d('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x3e6f2a['uniqueid'],queues[_0x3e6f2a[_0x6c4d('0x5')]]['name'],queues[_0x3e6f2a[_0x6c4d('0x5')]][_0x6c4d('0xb')]));writeDB(queues[_0x3e6f2a['uniqueid']]);}else if(queues[_0x3e6f2a[_0x6c4d('0x5')]][_0x6c4d('0x11')]){utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3e6f2a['uniqueid'],queues[_0x3e6f2a[_0x6c4d('0x5')]][_0x6c4d('0x1f')],queues[_0x3e6f2a['uniqueid']][_0x6c4d('0x11')]));queues[queues[_0x3e6f2a[_0x6c4d('0x5')]]['transfereduniqueid']]=queues[_0x3e6f2a['uniqueid']];queues[queues[_0x3e6f2a['uniqueid']][_0x6c4d('0x11')]][_0x6c4d('0x20')]=0x2;delete queues[_0x3e6f2a[_0x6c4d('0x5')]];}}}catch(_0x38b475){utils[_0x6c4d('0x18')](util[_0x6c4d('0x3')](_0x6c4d('0x1b'),_0x3e6f2a['uniqueid']),_0x38b475);}};exports[_0x6c4d('0x21')]=function(_0x1ca470){try{utils['debug'](util[_0x6c4d('0x3')]('[%s][queues][varset]',_0x1ca470[_0x6c4d('0x5')]),_0x1ca470);if(!_[_0x6c4d('0x1a')](_0x1ca470[_0x6c4d('0x22')][_0x6c4d('0x23')])&&_0x1ca470[_0x6c4d('0x24')][_0x6c4d('0x25')]()!==_0x6c4d('0x26')){if(!_[_0x6c4d('0x1a')](queues[_0x1ca470['uniqueid']])){queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x1c')]=![];queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x27')]=null;queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x1d')]=!![];queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x28')]=utils[_0x6c4d('0x17')]();queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0xb')]=_0x1ca470[_0x6c4d('0x24')]['toUpperCase']();utils['info'](util[_0x6c4d('0x3')](_0x6c4d('0x29'),_0x1ca470['uniqueid'],queues[_0x1ca470[_0x6c4d('0x5')]]['name'],_0x1ca470['value'],queues[_0x1ca470['uniqueid']][_0x6c4d('0xb')]));writeDB(queues[_0x1ca470[_0x6c4d('0x5')]]);}}else if(!_[_0x6c4d('0x1a')](_0x1ca470[_0x6c4d('0x22')]['queueposition'])){if(!_[_0x6c4d('0x1a')](queues[_0x1ca470[_0x6c4d('0x5')]])&&!queues[_0x1ca470[_0x6c4d('0x5')]]['queuecallerabandon']){queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x1c')]=![];queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x27')]=null;queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x1d')]=!![];queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0x28')]=utils['now']();queues[_0x1ca470[_0x6c4d('0x5')]][_0x6c4d('0xb')]='EXITWITHKEY';utils[_0x6c4d('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1ca470[_0x6c4d('0x5')],queues[_0x1ca470['uniqueid']][_0x6c4d('0x1f')],_0x1ca470[_0x6c4d('0x24')],queues[_0x1ca470[_0x6c4d('0x5')]]['queuecallerexitreason']));}}}catch(_0x8a608b){utils['error'](util[_0x6c4d('0x3')](_0x6c4d('0x2a'),_0x1ca470['uniqueid']),_0x8a608b);}};exports['queuecallerabandon']=function(_0x52fd6d){try{if(!_[_0x6c4d('0x1a')](queues[_0x52fd6d[_0x6c4d('0x5')]])){utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')](_0x6c4d('0x2b'),_0x52fd6d[_0x6c4d('0x5')]),_0x52fd6d);queues[_0x52fd6d[_0x6c4d('0x5')]][_0x6c4d('0x1d')]=![];queues[_0x52fd6d[_0x6c4d('0x5')]][_0x6c4d('0x28')]=null;queues[_0x52fd6d[_0x6c4d('0x5')]][_0x6c4d('0x1c')]=!![];queues[_0x52fd6d[_0x6c4d('0x5')]][_0x6c4d('0x27')]=utils[_0x6c4d('0x17')]();queues[_0x52fd6d[_0x6c4d('0x5')]][_0x6c4d('0xb')]='ABANDONED';utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')](_0x6c4d('0x2c'),_0x52fd6d['uniqueid'],queues[_0x52fd6d[_0x6c4d('0x5')]][_0x6c4d('0x1f')],queues[_0x52fd6d[_0x6c4d('0x5')]][_0x6c4d('0xb')]));}}catch(_0x303e1c){utils[_0x6c4d('0x18')](util['format'](_0x6c4d('0x2b'),_0x52fd6d['uniqueid']),_0x303e1c);}};exports[_0x6c4d('0x2d')]=function(_0x24456e){try{if(!_[_0x6c4d('0x1a')](queues[_0x24456e[_0x6c4d('0x5')]])){utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')]('[%s][queues][queuecallerleave]',_0x24456e['uniqueid']),_0x24456e);utils['info'](util[_0x6c4d('0x3')](_0x6c4d('0x2e'),_0x24456e[_0x6c4d('0x5')],queues[_0x24456e['uniqueid']][_0x6c4d('0x1f')],_0x24456e['connectedlinenum'],_0x24456e[_0x6c4d('0x2f')]));queues[_0x24456e[_0x6c4d('0x5')]][_0x6c4d('0x2d')]=!![];queues[_0x24456e[_0x6c4d('0x5')]][_0x6c4d('0x30')]=utils['now']();queues[_0x24456e['uniqueid']][_0x6c4d('0x31')]=utils['diffTime'](queues[_0x24456e[_0x6c4d('0x5')]]['queuecallerleaveAt'],queues[_0x24456e[_0x6c4d('0x5')]]['queuecallerjoinAt']);queues[_0x24456e[_0x6c4d('0x5')]]['position']=_0x24456e[_0x6c4d('0x15')];queues[_0x24456e['uniqueid']][_0x6c4d('0x32')]=_0x24456e[_0x6c4d('0x32')];queues[_0x24456e['uniqueid']][_0x6c4d('0x33')]=_0x24456e['connectedlinenum'];queues[_0x24456e['uniqueid']]['connectedlinename']=_0x24456e[_0x6c4d('0x2f')];}}catch(_0x5127c1){utils[_0x6c4d('0x18')](util['format'](_0x6c4d('0x34'),_0x24456e[_0x6c4d('0x5')]),_0x5127c1);}};exports['agentconnect']=function(_0x2a84e6){try{if(!_[_0x6c4d('0x1a')](queues[_0x2a84e6[_0x6c4d('0x5')]])){utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')](_0x6c4d('0x35'),_0x2a84e6['uniqueid']),_0x2a84e6);utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x2a84e6['uniqueid'],queues[_0x2a84e6[_0x6c4d('0x5')]][_0x6c4d('0x1f')],_0x2a84e6['membername'],_0x2a84e6[_0x6c4d('0x36')]));queues[_0x2a84e6[_0x6c4d('0x5')]]['queuecallerabandon']=![];queues[_0x2a84e6[_0x6c4d('0x5')]][_0x6c4d('0x1c')]=![];queues[_0x2a84e6['uniqueid']][_0x6c4d('0x27')]=null;queues[_0x2a84e6['uniqueid']][_0x6c4d('0x1d')]=![];queues[_0x2a84e6[_0x6c4d('0x5')]][_0x6c4d('0xb')]=null;queues[_0x2a84e6[_0x6c4d('0x5')]][_0x6c4d('0x28')]=null;queues[_0x2a84e6[_0x6c4d('0x5')]][_0x6c4d('0x37')]=!![];queues[_0x2a84e6['uniqueid']]['accountcode']=_0x2a84e6[_0x6c4d('0x36')];queues[_0x2a84e6['uniqueid']][_0x6c4d('0x8')]=_0x2a84e6[_0x6c4d('0x38')];}}catch(_0x332243){utils[_0x6c4d('0x18')](util['format']('[%s][queues][agentconnect]',_0x2a84e6['uniqueid']),_0x332243);}};exports[_0x6c4d('0x39')]=function(_0x1bb6fa){try{if(!_['isNil'](queues[_0x1bb6fa[_0x6c4d('0x5')]])){if(queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x30')]){utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')]('[%s][queues][agentcomplete]',_0x1bb6fa['uniqueid']),_0x1bb6fa);queues[_0x1bb6fa[_0x6c4d('0x5')]]['queuecallerabandon']=![];queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x1c')]=![];queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x27')]=null;queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x1d')]=![];queues[_0x1bb6fa['uniqueid']]['queuecallerexitAt']=null;queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x37')]=!![];queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x8')]=_0x1bb6fa[_0x6c4d('0x38')];queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x1e')]=!![];queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x3a')]=utils[_0x6c4d('0x17')]();if(_0x1bb6fa[_0x6c4d('0x3b')]==_0x6c4d('0x3c')){if(!queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x3c')]){queues[_0x1bb6fa['uniqueid']][_0x6c4d('0xb')]=_0x6c4d('0x3d');}}else{queues[_0x1bb6fa['uniqueid']]['queuecallerexitreason']=_0x6c4d('0x3e')+_0x1bb6fa[_0x6c4d('0x3b')]['toUpperCase']();}utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1bb6fa[_0x6c4d('0x5')],queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0x1f')],_0x1bb6fa['membername'],queues[_0x1bb6fa[_0x6c4d('0x5')]][_0x6c4d('0xb')]));writeDB(queues[_0x1bb6fa['uniqueid']]);}}}catch(_0x14b8a1){utils[_0x6c4d('0x18')](util[_0x6c4d('0x3')]('[%s][queues][agentcomplete]',_0x1bb6fa['uniqueid']),_0x14b8a1);}};exports['blindtransfer']=function(_0x2af773){try{if(!_[_0x6c4d('0x1a')](queues[_0x2af773[_0x6c4d('0x3f')]])){utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')](_0x6c4d('0x40'),_0x2af773[_0x6c4d('0x5')]),_0x2af773);queues[_0x2af773[_0x6c4d('0x3f')]][_0x6c4d('0x3c')]=!![];queues[_0x2af773[_0x6c4d('0x3f')]]['transfertype']=_0x6c4d('0x41');queues[_0x2af773[_0x6c4d('0x3f')]]['transferexten']=_0x2af773[_0x6c4d('0x42')];queues[_0x2af773['transfereeuniqueid']][_0x6c4d('0x43')]=_0x2af773[_0x6c4d('0x3f')];queues[_0x2af773[_0x6c4d('0x3f')]][_0x6c4d('0xb')]='BLINDTRANSFER';utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2af773[_0x6c4d('0x5')],queues[_0x2af773[_0x6c4d('0x3f')]][_0x6c4d('0x1f')],_0x2af773[_0x6c4d('0x3f')],_0x2af773['extension']));}}catch(_0x4a2053){utils[_0x6c4d('0x18')](util[_0x6c4d('0x3')](_0x6c4d('0x40'),_0x2af773[_0x6c4d('0x5')]),_0x4a2053);}};exports[_0x6c4d('0x44')]=function(_0xd35e49){try{utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')](_0x6c4d('0x45'),_0xd35e49[_0x6c4d('0x46')]),_0xd35e49);if(_0xd35e49['origtransfereruniqueid']==_0xd35e49[_0x6c4d('0x47')]){if(!_[_0x6c4d('0x1a')](queues[_0xd35e49[_0x6c4d('0x48')]])){utils['info'](util[_0x6c4d('0x3')](_0x6c4d('0x49'),_0xd35e49[_0x6c4d('0x46')],queues[_0xd35e49['secondtransfererlinkedid']][_0x6c4d('0x1f')],_0xd35e49[_0x6c4d('0x4a')]));queues[_0xd35e49[_0x6c4d('0x48')]]['transfer']=!![];queues[_0xd35e49[_0x6c4d('0x48')]][_0x6c4d('0x4b')]='ATTENDED';queues[_0xd35e49[_0x6c4d('0x48')]][_0x6c4d('0x4c')]=_0xd35e49[_0x6c4d('0x4a')];queues[_0xd35e49['secondtransfererlinkedid']][_0x6c4d('0x43')]=_0xd35e49[_0x6c4d('0x46')];queues[_0xd35e49[_0x6c4d('0x48')]][_0x6c4d('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x6c4d('0x1a')](queues[_0xd35e49['origtransfererlinkedid']])){if(_0xd35e49[_0x6c4d('0x4d')]&&queues[_0xd35e49[_0x6c4d('0x4d')]]){queues[_0xd35e49[_0x6c4d('0x4d')]][_0x6c4d('0x20')]=0x1;queues[_0xd35e49[_0x6c4d('0x3f')]]=_[_0x6c4d('0x4e')](queues[_0xd35e49[_0x6c4d('0x4d')]]);queues[_0xd35e49[_0x6c4d('0x3f')]][_0x6c4d('0x11')]=_0xd35e49[_0x6c4d('0x4f')];queues[_0xd35e49['transfereeuniqueid']][_0x6c4d('0x20')]=0x2;queues[_0xd35e49[_0x6c4d('0x3f')]][_0x6c4d('0x9')]=queues[_0xd35e49[_0x6c4d('0x48')]][_0x6c4d('0x9')];queues[_0xd35e49[_0x6c4d('0x3f')]]['calleridname']=queues[_0xd35e49['secondtransfererlinkedid']][_0x6c4d('0x50')];queues[_0xd35e49[_0x6c4d('0x3f')]]['queuecallerjoinAt']=utils['now']();queues[_0xd35e49[_0x6c4d('0x3f')]][_0x6c4d('0x30')]=utils[_0x6c4d('0x17')]();queues[_0xd35e49[_0x6c4d('0x3f')]]['holdtime']=0x0;queues[_0xd35e49[_0x6c4d('0x3f')]][_0x6c4d('0x51')]=0x0;utils[_0x6c4d('0x2')](util['format'](_0x6c4d('0x52'),_0xd35e49[_0x6c4d('0x46')],queues[_0xd35e49[_0x6c4d('0x3f')]][_0x6c4d('0x1f')],queues[_0xd35e49[_0x6c4d('0x3f')]][_0x6c4d('0x9')],queues[_0xd35e49[_0x6c4d('0x3f')]][_0x6c4d('0x50')]));}else{utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')](_0x6c4d('0x53'),_0xd35e49['origtransfereruniqueid'],queues[_0xd35e49[_0x6c4d('0x47')]][_0x6c4d('0x1f')],_0xd35e49[_0x6c4d('0x48')]));queues[_0xd35e49[_0x6c4d('0x47')]][_0x6c4d('0x11')]=_0xd35e49[_0x6c4d('0x48')];}}}else if(_0xd35e49[_0x6c4d('0x54')]==_0xd35e49[_0x6c4d('0x48')]){if(!_[_0x6c4d('0x1a')](queues[_0xd35e49[_0x6c4d('0x47')]])){utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xd35e49[_0x6c4d('0x46')],queues[_0xd35e49['origtransfererlinkedid']][_0x6c4d('0x1f')],_0xd35e49[_0x6c4d('0x54')],_0xd35e49[_0x6c4d('0x55')]));queues[_0xd35e49[_0x6c4d('0x47')]][_0x6c4d('0x3c')]=!![];queues[_0xd35e49[_0x6c4d('0x47')]]['transfertype']=_0x6c4d('0x56');queues[_0xd35e49['origtransfererlinkedid']][_0x6c4d('0x4c')]=_0xd35e49[_0x6c4d('0x55')];queues[_0xd35e49['origtransfererlinkedid']][_0x6c4d('0x43')]=_0xd35e49['secondtransfereruniqueid'];queues[_0xd35e49[_0x6c4d('0x47')]][_0x6c4d('0xb')]=_0x6c4d('0x57');}if(!_['isNil'](queues[_0xd35e49[_0x6c4d('0x48')]])){if(_0xd35e49['transfertargetlinkedid']&&queues[_0xd35e49[_0x6c4d('0x58')]]){queues[_0xd35e49[_0x6c4d('0x58')]][_0x6c4d('0x20')]=0x1;queues[_0xd35e49['transfertargetuniqueid']]=_[_0x6c4d('0x4e')](queues[_0xd35e49[_0x6c4d('0x58')]]);queues[_0xd35e49[_0x6c4d('0x4f')]]['transfereduniqueid']=_0xd35e49['transfertargetuniqueid'];queues[_0xd35e49[_0x6c4d('0x4f')]][_0x6c4d('0x20')]=0x2;queues[_0xd35e49[_0x6c4d('0x4f')]][_0x6c4d('0x9')]=queues[_0xd35e49[_0x6c4d('0x47')]][_0x6c4d('0x9')];queues[_0xd35e49[_0x6c4d('0x4f')]][_0x6c4d('0x50')]=queues[_0xd35e49[_0x6c4d('0x47')]][_0x6c4d('0x50')];queues[_0xd35e49[_0x6c4d('0x4f')]][_0x6c4d('0x59')]=utils['now']();queues[_0xd35e49[_0x6c4d('0x4f')]][_0x6c4d('0x30')]=utils['now']();queues[_0xd35e49[_0x6c4d('0x4f')]][_0x6c4d('0x31')]=0x0;queues[_0xd35e49[_0x6c4d('0x4f')]][_0x6c4d('0x51')]=0x0;utils['info'](util[_0x6c4d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0xd35e49['origtransfereruniqueid'],queues[_0xd35e49[_0x6c4d('0x4f')]]['name'],queues[_0xd35e49[_0x6c4d('0x4f')]]['transfereduniqueid'],queues[_0xd35e49['transfertargetuniqueid']][_0x6c4d('0x9')],queues[_0xd35e49[_0x6c4d('0x4f')]]['calleridname']));}else{utils[_0x6c4d('0x2')](util[_0x6c4d('0x3')](_0x6c4d('0x53'),_0xd35e49[_0x6c4d('0x46')],queues[_0xd35e49[_0x6c4d('0x48')]]['name'],_0xd35e49['origtransfererlinkedid']));queues[_0xd35e49[_0x6c4d('0x48')]][_0x6c4d('0x11')]=_0xd35e49[_0x6c4d('0x47')];}}}}catch(_0x183ef6){utils[_0x6c4d('0x18')](util[_0x6c4d('0x3')]('[%s][queues][attendedtransfer]',_0xd35e49[_0x6c4d('0x46')]),_0x183ef6);}};exports[_0x6c4d('0x5a')]=function(_0x3addaf){try{if(!_[_0x6c4d('0x1a')](queues[_0x3addaf[_0x6c4d('0x5')]])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x3addaf[_0x6c4d('0x5')]),_0x3addaf);queues[_0x3addaf[_0x6c4d('0x5')]][_0x6c4d('0x5b')]=utils[_0x6c4d('0x17')]();utils[_0x6c4d('0x2')](util['format'](_0x6c4d('0x5c'),_0x3addaf[_0x6c4d('0x5')],queues[_0x3addaf[_0x6c4d('0x5')]][_0x6c4d('0x1f')],queues[_0x3addaf[_0x6c4d('0x5')]][_0x6c4d('0x5b')]));}}catch(_0x2476e7){utils['error'](util[_0x6c4d('0x3')]('[%s][queues][musiconholdstart]',_0x3addaf[_0x6c4d('0x5')]),_0x2476e7);}};exports[_0x6c4d('0x5d')]=function(_0x54e559){try{if(!_[_0x6c4d('0x1a')](queues[_0x54e559['uniqueid']])){if(!_[_0x6c4d('0x1a')](queues[_0x54e559[_0x6c4d('0x5')]][_0x6c4d('0x5b')])){utils[_0x6c4d('0x13')](util[_0x6c4d('0x3')](_0x6c4d('0x5e'),_0x54e559[_0x6c4d('0x5')]),_0x54e559);queues[_0x54e559['uniqueid']][_0x6c4d('0x51')]+=utils[_0x6c4d('0x5f')](utils['now'](),queues[_0x54e559[_0x6c4d('0x5')]][_0x6c4d('0x5b')]);utils[_0x6c4d('0x2')](util['format'](_0x6c4d('0x60'),_0x54e559[_0x6c4d('0x5')],queues[_0x54e559[_0x6c4d('0x5')]][_0x6c4d('0x1f')],queues[_0x54e559[_0x6c4d('0x5')]]['mohtime']));delete queues[_0x54e559[_0x6c4d('0x5')]][_0x6c4d('0x5b')];}}}catch(_0x1ba8da){utils[_0x6c4d('0x18')](util[_0x6c4d('0x3')](_0x6c4d('0x5e'),_0x54e559[_0x6c4d('0x5')]),_0x1ba8da);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 25ce961..ec5b5c2 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 _0x1270=['debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0x1270,0x1ab));var _0x0127=function(_0x3b56f9,_0x2984d4){_0x3b56f9=_0x3b56f9-0x0;var _0x227ea1=_0x1270[_0x3b56f9];return _0x227ea1;};'use strict';var _=require(_0x0127('0x0'));var util=require(_0x0127('0x1'));var utils=require(_0x0127('0x2'));var transfers=require(_0x0127('0x3'));var recordings={};function writeDB(_0x3a5514){var _0x1c4766;utils[_0x0127('0x4')](util[_0x0127('0x5')](_0x0127('0x6'),_0x3a5514[_0x0127('0x7')]));if(transfers[_0x0127('0x8')][_0x3a5514[_0x0127('0x7')]]){_0x1c4766=_0x3a5514[_0x0127('0x7')];_0x3a5514[_0x0127('0x7')]=transfers[_0x0127('0x8')][_0x3a5514[_0x0127('0x7')]][_0x0127('0x9')];}if(_0x3a5514[_0x0127('0xa')]){utils['getUserByInternal'](_0x3a5514[_0x0127('0xa')])[_0x0127('0xb')](function(_0x5f1d89){if(_0x5f1d89){_0x3a5514[_0x0127('0xc')]=_0x5f1d89['name'];_0x3a5514[_0x0127('0xd')]=_0x5f1d89['id'];}utils[_0x0127('0xe')](_0x0127('0xf'),_0x3a5514);});}else{utils[_0x0127('0xe')](_0x0127('0xf'),_0x3a5514);}if(_0x1c4766)delete transfers['blinds'][_0x1c4766];}exports[_0x0127('0x10')]=function(_0x221db7){try{utils[_0x0127('0x11')](util[_0x0127('0x5')](_0x0127('0x12'),_0x221db7[_0x0127('0x7')]),_0x221db7);if(_0x221db7['uniqueid']==_0x221db7[_0x0127('0x13')]){utils[_0x0127('0x4')](util[_0x0127('0x5')](_0x0127('0x14'),_0x221db7[_0x0127('0x7')],_0x221db7[_0x0127('0x15')],_0x221db7['exten']));recordings[_0x221db7['uniqueid']]={'uniqueid':_0x221db7[_0x0127('0x7')],'accountcode':_0x221db7[_0x0127('0xa')],'exten':_0x221db7[_0x0127('0x16')],'context':_0x221db7[_0x0127('0x15')],'channel':_0x221db7['channel'],'monitors':[]};}}catch(_0x113a02){utils[_0x0127('0x17')](util['format']('[%s][recordings][newchannel]',_0x221db7['uniqueid']),_0x113a02);}};exports[_0x0127('0x18')]=function(_0x19fba6){try{utils[_0x0127('0x11')](util[_0x0127('0x5')](_0x0127('0x19'),_0x19fba6[_0x0127('0x7')]),_0x19fba6);if(!_[_0x0127('0x1a')](recordings[_0x19fba6[_0x0127('0x7')]])&&_0x19fba6[_0x0127('0x1b')]==0x6){utils[_0x0127('0x4')](util[_0x0127('0x5')](_0x0127('0x1c'),_0x19fba6[_0x0127('0x7')],_0x19fba6[_0x0127('0x15')],_0x19fba6['channel']));}else if(!_['isNil'](recordings[_0x19fba6['linkedid']])&&_0x19fba6[_0x0127('0x1b')]==0x6&&_0x19fba6['context']!=_0x0127('0x1d')){utils[_0x0127('0x4')](util[_0x0127('0x5')](_0x0127('0x1e'),_0x19fba6['uniqueid'],_0x19fba6['linkedid'],_0x19fba6[_0x0127('0x15')],_0x19fba6['channel']));recordings[_0x19fba6[_0x0127('0x13')]][_0x0127('0xa')]=_0x19fba6[_0x0127('0xa')];}}catch(_0x4762e1){utils[_0x0127('0x17')](util[_0x0127('0x5')](_0x0127('0x19'),_0x19fba6[_0x0127('0x7')]),_0x4762e1);}};exports['varset']=function(_0x410c13){try{if(!_['isNil'](_0x410c13[_0x0127('0x1f')])&&!_[_0x0127('0x1a')](_0x410c13['variable'][_0x0127('0x20')])){utils[_0x0127('0x11')](util[_0x0127('0x5')](_0x0127('0x21'),_0x410c13[_0x0127('0x7')]),_0x410c13);utils[_0x0127('0x4')](util[_0x0127('0x5')](_0x0127('0x22'),_0x410c13[_0x0127('0x7')],_0x410c13[_0x0127('0x1f')],_0x410c13[_0x0127('0x23')]));if(_[_0x0127('0x24')](_0x410c13[_0x0127('0x23')],_0x0127('0x25'))){_0x410c13[_0x0127('0x23')]=_0x410c13[_0x0127('0x23')]['replace'](_0x0127('0x25'),_0x0127('0x26'));}if(recordings[_0x410c13[_0x0127('0x13')]]){var _0x476d7f=_['find'](recordings[_0x410c13[_0x0127('0x13')]]['monitors'],{'value':_0x410c13[_0x0127('0x23')]});if(_[_0x0127('0x1a')](_0x476d7f)){recordings[_0x410c13['linkedid']]['monitors'][_0x0127('0x27')]({'value':_0x410c13[_0x0127('0x23')]});}}}}catch(_0x68e7c2){utils[_0x0127('0x17')](util[_0x0127('0x5')]('[%s][recordings][varset]',_0x410c13[_0x0127('0x7')]),_0x68e7c2);}};exports[_0x0127('0x28')]=function(_0x526abf){try{if(!_['isNil'](recordings[_0x526abf[_0x0127('0x7')]])){utils[_0x0127('0x11')](util['format'](_0x0127('0x29'),_0x526abf[_0x0127('0x7')]),_0x526abf);utils[_0x0127('0x4')](util[_0x0127('0x5')](_0x0127('0x2a'),_0x526abf[_0x0127('0x7')],_0x526abf[_0x0127('0x2b')],_0x526abf[_0x0127('0x2c')],_0x526abf[_0x0127('0x2d')]));recordings[_0x526abf['uniqueid']][_0x0127('0x2b')]=_0x526abf[_0x0127('0x2b')];recordings[_0x526abf['uniqueid']][_0x0127('0x2c')]=_0x526abf['calleridname'];recordings[_0x526abf[_0x0127('0x7')]][_0x0127('0x2e')]=_0x526abf[_0x0127('0x2e')];recordings[_0x526abf[_0x0127('0x7')]]['connectedlinename']=_0x526abf[_0x0127('0x2f')];if(recordings[_0x526abf['uniqueid']][_0x0127('0x30')]==_0x0127('0x31')&&recordings[_0x526abf[_0x0127('0x7')]][_0x0127('0xa')]){recordings[_0x526abf[_0x0127('0x7')]][_0x0127('0x2e')]=recordings[_0x526abf[_0x0127('0x7')]][_0x0127('0xa')];recordings[_0x526abf[_0x0127('0x7')]][_0x0127('0x2f')]='';}recordings[_0x526abf[_0x0127('0x7')]][_0x0127('0x32')][_0x0127('0x33')](function(_0x4b70b6){var _0x50ac61=_[_0x0127('0x34')](recordings[_0x526abf[_0x0127('0x7')]]);_0x50ac61[_0x0127('0x23')]=_0x4b70b6[_0x0127('0x23')];writeDB(_0x50ac61);});delete recordings[_0x526abf[_0x0127('0x7')]];}}catch(_0x293a82){utils[_0x0127('0x17')](util[_0x0127('0x5')](_0x0127('0x29'),_0x526abf[_0x0127('0x7')]),_0x293a82);}};exports['newexten']=function(_0x22e145){try{if(!_[_0x0127('0x1a')](recordings[_0x22e145[_0x0127('0x7')]])){utils[_0x0127('0x11')](util[_0x0127('0x5')](_0x0127('0x35'),_0x22e145[_0x0127('0x7')]),_0x22e145);utils[_0x0127('0x4')](util['format'](_0x0127('0x36'),_0x22e145[_0x0127('0x7')],_0x22e145[_0x0127('0x37')],_0x22e145[_0x0127('0x38')]));if(_0x22e145[_0x0127('0x37')]['toLowerCase']()==_0x0127('0x39')&&_[_0x0127('0x3a')](_0x22e145['appdata'][_0x0127('0x3b')](),_0x0127('0x3c'))){var _0x49e0b3=_0x22e145[_0x0127('0x38')][_0x0127('0x3d')]('=');var _0x118ff5=_0x49e0b3[0x0]['substring'](_0x49e0b3[0x0][_0x0127('0x3e')]('(')+0x1,_0x49e0b3[0x0][_0x0127('0x3e')](')'));var _0xe2508c=_0x49e0b3[0x1];recordings[_0x22e145[_0x0127('0x7')]][_0x118ff5]=_0xe2508c;}}}catch(_0x2b01fb){utils['error'](util[_0x0127('0x5')](_0x0127('0x35'),_0x22e145[_0x0127('0x7')]),_0x2b01fb);}};exports[_0x0127('0x3f')]=function(_0x4fe916){try{if(!_['isNil'](recordings[_0x4fe916[_0x0127('0x7')]])){utils['debug'](util['format'](_0x0127('0x40'),_0x4fe916['uniqueid']),_0x4fe916);utils[_0x0127('0x4')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x4fe916[_0x0127('0x7')],_0x4fe916[_0x0127('0x41')]));recordings[_0x4fe916[_0x0127('0x7')]][_0x0127('0x41')]=_0x4fe916['queue'];}}catch(_0xf4c7a){utils['error'](util['format']('[%s][recordings][queuecallerjoin]',_0x4fe916[_0x0127('0x7')]),_0xf4c7a);}};exports[_0x0127('0x42')]=function(_0xc2aac){try{utils[_0x0127('0x11')](util[_0x0127('0x5')](_0x0127('0x43'),_0xc2aac[_0x0127('0x7')]),_0xc2aac);utils['info'](util['format'](_0x0127('0x44'),_0xc2aac[_0x0127('0x7')],_0xc2aac['transferercalleridnum'],_0xc2aac[_0x0127('0x45')],_0xc2aac[_0x0127('0x46')],_0xc2aac[_0x0127('0x47')]));if(recordings[_0xc2aac[_0x0127('0x48')]]&&transfers[_0x0127('0x8')][_0xc2aac[_0x0127('0x48')]]){transfers[_0x0127('0x8')][_0xc2aac['transfereruniqueid']][_0x0127('0x49')]=!![];}}catch(_0x20a900){utils[_0x0127('0x17')](util[_0x0127('0x5')]('[%s][recordings][blindtransfer]',_0xc2aac[_0x0127('0x7')]),_0x20a900);}}; \ No newline at end of file +var _0x2e22=['blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','find','monitors','push','error','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid'];(function(_0x5293a1,_0x351c64){var _0x5085aa=function(_0x3c3bd8){while(--_0x3c3bd8){_0x5293a1['push'](_0x5293a1['shift']());}};_0x5085aa(++_0x351c64);}(_0x2e22,0x91));var _0x22e2=function(_0x54395b,_0x51babb){_0x54395b=_0x54395b-0x0;var _0x199c87=_0x2e22[_0x54395b];return _0x199c87;};'use strict';var _=require(_0x22e2('0x0'));var util=require(_0x22e2('0x1'));var utils=require('./utils');var transfers=require(_0x22e2('0x2'));var recordings={};function writeDB(_0x2a2961){var _0x5766c4;utils[_0x22e2('0x3')](util[_0x22e2('0x4')](_0x22e2('0x5'),_0x2a2961[_0x22e2('0x6')]));if(transfers[_0x22e2('0x7')][_0x2a2961[_0x22e2('0x6')]]){_0x5766c4=_0x2a2961[_0x22e2('0x6')];_0x2a2961[_0x22e2('0x6')]=transfers['blinds'][_0x2a2961[_0x22e2('0x6')]][_0x22e2('0x8')];}if(_0x2a2961[_0x22e2('0x9')]){utils[_0x22e2('0xa')](_0x2a2961[_0x22e2('0x9')])[_0x22e2('0xb')](function(_0x56b87e){if(_0x56b87e){_0x2a2961[_0x22e2('0xc')]=_0x56b87e[_0x22e2('0xd')];_0x2a2961[_0x22e2('0xe')]=_0x56b87e['id'];}utils[_0x22e2('0xf')](_0x22e2('0x10'),_0x2a2961);});}else{utils[_0x22e2('0xf')]('CreateVoiceRecording',_0x2a2961);}if(_0x5766c4)delete transfers[_0x22e2('0x7')][_0x5766c4];}exports[_0x22e2('0x11')]=function(_0x4e0c0f){try{utils[_0x22e2('0x12')](util['format'](_0x22e2('0x13'),_0x4e0c0f[_0x22e2('0x6')]),_0x4e0c0f);if(_0x4e0c0f[_0x22e2('0x6')]==_0x4e0c0f[_0x22e2('0x14')]){utils['info'](util[_0x22e2('0x4')](_0x22e2('0x15'),_0x4e0c0f[_0x22e2('0x6')],_0x4e0c0f[_0x22e2('0x16')],_0x4e0c0f[_0x22e2('0x17')]));recordings[_0x4e0c0f['uniqueid']]={'uniqueid':_0x4e0c0f[_0x22e2('0x6')],'accountcode':_0x4e0c0f['accountcode'],'exten':_0x4e0c0f['exten'],'context':_0x4e0c0f['context'],'channel':_0x4e0c0f[_0x22e2('0x18')],'monitors':[]};}}catch(_0x456425){utils['error'](util[_0x22e2('0x4')](_0x22e2('0x13'),_0x4e0c0f[_0x22e2('0x6')]),_0x456425);}};exports[_0x22e2('0x19')]=function(_0x555519){try{utils[_0x22e2('0x12')](util[_0x22e2('0x4')](_0x22e2('0x1a'),_0x555519[_0x22e2('0x6')]),_0x555519);if(!_[_0x22e2('0x1b')](recordings[_0x555519[_0x22e2('0x6')]])&&_0x555519[_0x22e2('0x1c')]==0x6){utils[_0x22e2('0x3')](util[_0x22e2('0x4')](_0x22e2('0x1d'),_0x555519[_0x22e2('0x6')],_0x555519[_0x22e2('0x16')],_0x555519[_0x22e2('0x18')]));}else if(!_['isNil'](recordings[_0x555519['linkedid']])&&_0x555519[_0x22e2('0x1c')]==0x6&&_0x555519[_0x22e2('0x16')]!=_0x22e2('0x1e')){utils[_0x22e2('0x3')](util[_0x22e2('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x555519[_0x22e2('0x6')],_0x555519[_0x22e2('0x14')],_0x555519['context'],_0x555519['channel']));recordings[_0x555519[_0x22e2('0x14')]][_0x22e2('0x9')]=_0x555519[_0x22e2('0x9')];}}catch(_0x4accbe){utils['error'](util[_0x22e2('0x4')]('[%s][recordings][newstate]',_0x555519[_0x22e2('0x6')]),_0x4accbe);}};exports[_0x22e2('0x1f')]=function(_0x38c6c1){try{if(!_['isNil'](_0x38c6c1[_0x22e2('0x20')])&&!_[_0x22e2('0x1b')](_0x38c6c1[_0x22e2('0x20')]['mixmonitor_filename'])){utils[_0x22e2('0x12')](util['format'](_0x22e2('0x21'),_0x38c6c1[_0x22e2('0x6')]),_0x38c6c1);utils['info'](util['format'](_0x22e2('0x22'),_0x38c6c1['uniqueid'],_0x38c6c1[_0x22e2('0x20')],_0x38c6c1['value']));if(_[_0x22e2('0x23')](_0x38c6c1[_0x22e2('0x24')],_0x22e2('0x25'))){_0x38c6c1[_0x22e2('0x24')]=_0x38c6c1[_0x22e2('0x24')][_0x22e2('0x26')](_0x22e2('0x25'),'.WAV');}if(recordings[_0x38c6c1[_0x22e2('0x14')]]){var _0x31f1a3=_[_0x22e2('0x27')](recordings[_0x38c6c1[_0x22e2('0x14')]][_0x22e2('0x28')],{'value':_0x38c6c1[_0x22e2('0x24')]});if(_['isNil'](_0x31f1a3)){recordings[_0x38c6c1['linkedid']][_0x22e2('0x28')][_0x22e2('0x29')]({'value':_0x38c6c1[_0x22e2('0x24')]});}}}}catch(_0x18edac){utils[_0x22e2('0x2a')](util[_0x22e2('0x4')](_0x22e2('0x21'),_0x38c6c1[_0x22e2('0x6')]),_0x18edac);}};exports['hangup']=function(_0x4539bd){try{if(!_[_0x22e2('0x1b')](recordings[_0x4539bd[_0x22e2('0x6')]])){utils[_0x22e2('0x12')](util[_0x22e2('0x4')](_0x22e2('0x2b'),_0x4539bd[_0x22e2('0x6')]),_0x4539bd);utils['info'](util[_0x22e2('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4539bd[_0x22e2('0x6')],_0x4539bd[_0x22e2('0x2c')],_0x4539bd[_0x22e2('0x2d')],_0x4539bd[_0x22e2('0x2e')]));recordings[_0x4539bd[_0x22e2('0x6')]][_0x22e2('0x2c')]=_0x4539bd[_0x22e2('0x2c')];recordings[_0x4539bd[_0x22e2('0x6')]]['calleridname']=_0x4539bd['calleridname'];recordings[_0x4539bd['uniqueid']]['connectedlinenum']=_0x4539bd[_0x22e2('0x2f')];recordings[_0x4539bd[_0x22e2('0x6')]]['connectedlinename']=_0x4539bd[_0x22e2('0x30')];if(recordings[_0x4539bd['uniqueid']][_0x22e2('0x31')]==_0x22e2('0x32')&&recordings[_0x4539bd[_0x22e2('0x6')]][_0x22e2('0x9')]){recordings[_0x4539bd[_0x22e2('0x6')]][_0x22e2('0x2f')]=recordings[_0x4539bd[_0x22e2('0x6')]][_0x22e2('0x9')];recordings[_0x4539bd['uniqueid']]['connectedlinename']='';}recordings[_0x4539bd['uniqueid']][_0x22e2('0x28')][_0x22e2('0x33')](function(_0x35c423){var _0x2fbdd4=_[_0x22e2('0x34')](recordings[_0x4539bd[_0x22e2('0x6')]]);_0x2fbdd4['value']=_0x35c423[_0x22e2('0x24')];writeDB(_0x2fbdd4);});delete recordings[_0x4539bd['uniqueid']];}}catch(_0x8abc2f){utils['error'](util['format']('[%s][recordings][hangup]',_0x4539bd['uniqueid']),_0x8abc2f);}};exports['newexten']=function(_0x15d12b){try{if(!_[_0x22e2('0x1b')](recordings[_0x15d12b[_0x22e2('0x6')]])){utils[_0x22e2('0x12')](util['format'](_0x22e2('0x35'),_0x15d12b[_0x22e2('0x6')]),_0x15d12b);utils[_0x22e2('0x3')](util['format'](_0x22e2('0x36'),_0x15d12b[_0x22e2('0x6')],_0x15d12b[_0x22e2('0x37')],_0x15d12b['appdata']));if(_0x15d12b['application'][_0x22e2('0x38')]()==_0x22e2('0x39')&&_[_0x22e2('0x3a')](_0x15d12b[_0x22e2('0x3b')][_0x22e2('0x38')](),_0x22e2('0x3c'))){var _0x10f9eb=_0x15d12b['appdata'][_0x22e2('0x3d')]('=');var _0x265722=_0x10f9eb[0x0][_0x22e2('0x3e')](_0x10f9eb[0x0][_0x22e2('0x3f')]('(')+0x1,_0x10f9eb[0x0]['lastIndexOf'](')'));var _0x4d1a84=_0x10f9eb[0x1];recordings[_0x15d12b['uniqueid']][_0x265722]=_0x4d1a84;}}}catch(_0x2fac8d){utils[_0x22e2('0x2a')](util[_0x22e2('0x4')]('[%s][recordings][newexten]',_0x15d12b['uniqueid']),_0x2fac8d);}};exports[_0x22e2('0x40')]=function(_0x1f1b0b){try{if(!_[_0x22e2('0x1b')](recordings[_0x1f1b0b['uniqueid']])){utils[_0x22e2('0x12')](util[_0x22e2('0x4')](_0x22e2('0x41'),_0x1f1b0b['uniqueid']),_0x1f1b0b);utils[_0x22e2('0x3')](util[_0x22e2('0x4')](_0x22e2('0x42'),_0x1f1b0b[_0x22e2('0x6')],_0x1f1b0b[_0x22e2('0x43')]));recordings[_0x1f1b0b[_0x22e2('0x6')]]['queue']=_0x1f1b0b[_0x22e2('0x43')];}}catch(_0x3db3cb){utils['error'](util[_0x22e2('0x4')](_0x22e2('0x41'),_0x1f1b0b['uniqueid']),_0x3db3cb);}};exports[_0x22e2('0x44')]=function(_0x59711f){try{utils[_0x22e2('0x12')](util[_0x22e2('0x4')](_0x22e2('0x45'),_0x59711f['uniqueid']),_0x59711f);utils[_0x22e2('0x3')](util[_0x22e2('0x4')](_0x22e2('0x46'),_0x59711f[_0x22e2('0x6')],_0x59711f[_0x22e2('0x47')],_0x59711f[_0x22e2('0x48')],_0x59711f['transfereecalleridnum'],_0x59711f[_0x22e2('0x49')]));if(recordings[_0x59711f[_0x22e2('0x4a')]]&&transfers[_0x22e2('0x7')][_0x59711f[_0x22e2('0x4a')]]){transfers[_0x22e2('0x7')][_0x59711f[_0x22e2('0x4a')]][_0x22e2('0x4b')]=!![];}}catch(_0x421383){utils[_0x22e2('0x2a')](util[_0x22e2('0x4')](_0x22e2('0x45'),_0x59711f[_0x22e2('0x6')]),_0x421383);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1b5f752..6c5b0bf 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 _0x7a18=['origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','format','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x14bce2,_0x2b08bb){var _0x2b5d8f=function(_0xa1a7d8){while(--_0xa1a7d8){_0x14bce2['push'](_0x14bce2['shift']());}};_0x2b5d8f(++_0x2b08bb);}(_0x7a18,0xac));var _0x87a1=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x7a18[_0x5c14f6];return _0x4949b3;};'use strict';var _=require('lodash');var util=require(_0x87a1('0x0'));var utils=require(_0x87a1('0x1'));function writeDB(_0x41bea8){utils[_0x87a1('0x2')](util['format'](_0x87a1('0x3'),_0x41bea8[_0x87a1('0x4')]===_0x87a1('0x5')?_0x41bea8[_0x87a1('0x6')]:_0x41bea8[_0x87a1('0x7')],_0x41bea8[_0x87a1('0x4')]));utils['request'](_0x87a1('0x8'),_0x41bea8);}exports[_0x87a1('0x9')]={};exports[_0x87a1('0xa')]=function(_0x2d43b2){try{utils['debug'](util[_0x87a1('0xb')]('[%s][transfers][blindtransfer]',_0x2d43b2[_0x87a1('0x7')]),_0x2d43b2);utils[_0x87a1('0x2')](util[_0x87a1('0xb')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2d43b2['uniqueid'],_0x2d43b2[_0x87a1('0xc')],_0x2d43b2[_0x87a1('0xd')],_0x2d43b2[_0x87a1('0xe')],_0x2d43b2[_0x87a1('0xf')]));_0x2d43b2['type']=_0x87a1('0x10');exports[_0x87a1('0x9')][_0x2d43b2['transfereruniqueid']]=_0x2d43b2;writeDB(_0x2d43b2);}catch(_0x2772ee){utils[_0x87a1('0x11')](util['format']('[%s][transfers][blindtransfer]',_0x2d43b2[_0x87a1('0x7')]),_0x2772ee);}};exports[_0x87a1('0x12')]=function(_0x146996){try{utils[_0x87a1('0x13')](util[_0x87a1('0xb')](_0x87a1('0x14'),_0x146996[_0x87a1('0x6')]),_0x146996);utils['info'](util[_0x87a1('0xb')](_0x87a1('0x15'),_0x146996[_0x87a1('0x6')],_0x146996[_0x87a1('0x16')],_0x146996[_0x87a1('0x17')],_0x146996[_0x87a1('0x18')],_0x146996[_0x87a1('0x19')]));_0x146996=_['assign'](_0x146996,{'transfererchannel':_0x146996['origtransfererchannel'],'transferercalleridnum':_0x146996[_0x87a1('0x16')],'transferercalleridname':_0x146996[_0x87a1('0x17')],'transfererconnectedlinenum':_0x146996[_0x87a1('0x1a')],'transfererconnectedlinename':_0x146996[_0x87a1('0x1b')],'transfereraccountcode':_0x146996[_0x87a1('0x1c')],'transferercontext':_0x146996['secondtransferercontext'],'transfererexten':_0x146996[_0x87a1('0x1d')],'transfererlinkedid':_0x146996['origtransfererlinkedid'],'context':_0x146996[_0x87a1('0x1e')],'extension':_0x146996[_0x87a1('0x1f')],'type':_0x87a1('0x5')});if(_[_0x87a1('0x20')](_0x146996[_0x87a1('0x21')])){_0x146996=_[_0x87a1('0x22')](_0x146996,{'transfereechannel':_0x146996['transfertargetchannel'],'transfereecalleridnum':_0x146996['transfertargetcalleridnum'],'transfereecalleridname':_0x146996['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x146996[_0x87a1('0x23')],'transfereeconnectedlinename':_0x146996[_0x87a1('0x24')],'transfereeaccountcode':_0x146996[_0x87a1('0x25')],'transfereecontext':_0x146996[_0x87a1('0x26')],'transfereeexten':_0x146996['transfertargetexten'],'transfereelinkedid':_0x146996[_0x87a1('0x27')]});}writeDB(_0x146996);}catch(_0x1f4f6d){utils[_0x87a1('0x11')](util[_0x87a1('0xb')](_0x87a1('0x14'),_0x146996[_0x87a1('0x6')]),_0x1f4f6d);}}; \ No newline at end of file +var _0xda95=['origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign'];(function(_0xc66a39,_0x1d744a){var _0x437e78=function(_0x12441f){while(--_0x12441f){_0xc66a39['push'](_0xc66a39['shift']());}};_0x437e78(++_0x1d744a);}(_0xda95,0x13e));var _0x5da9=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xda95[_0x38b14f];return _0x22a324;};'use strict';var _=require('lodash');var util=require(_0x5da9('0x0'));var utils=require(_0x5da9('0x1'));function writeDB(_0x2b8dc9){utils[_0x5da9('0x2')](util[_0x5da9('0x3')](_0x5da9('0x4'),_0x2b8dc9[_0x5da9('0x5')]==='attended'?_0x2b8dc9[_0x5da9('0x6')]:_0x2b8dc9[_0x5da9('0x7')],_0x2b8dc9[_0x5da9('0x5')]));utils[_0x5da9('0x8')]('CreateVoiceTransferReport',_0x2b8dc9);}exports[_0x5da9('0x9')]={};exports['blindtransfer']=function(_0x2a0ba8){try{utils[_0x5da9('0xa')](util[_0x5da9('0x3')](_0x5da9('0xb'),_0x2a0ba8['uniqueid']),_0x2a0ba8);utils['info'](util[_0x5da9('0x3')](_0x5da9('0xc'),_0x2a0ba8[_0x5da9('0x7')],_0x2a0ba8[_0x5da9('0xd')],_0x2a0ba8[_0x5da9('0xe')],_0x2a0ba8[_0x5da9('0xf')],_0x2a0ba8[_0x5da9('0x10')]));_0x2a0ba8['type']=_0x5da9('0x11');exports[_0x5da9('0x9')][_0x2a0ba8[_0x5da9('0x12')]]=_0x2a0ba8;writeDB(_0x2a0ba8);}catch(_0x196dcd){utils[_0x5da9('0x13')](util['format'](_0x5da9('0xb'),_0x2a0ba8[_0x5da9('0x7')]),_0x196dcd);}};exports[_0x5da9('0x14')]=function(_0x28e13f){try{utils[_0x5da9('0xa')](util['format'](_0x5da9('0x15'),_0x28e13f['origtransfereruniqueid']),_0x28e13f);utils[_0x5da9('0x2')](util[_0x5da9('0x3')](_0x5da9('0x16'),_0x28e13f[_0x5da9('0x6')],_0x28e13f['origtransferercalleridnum'],_0x28e13f['origtransferercalleridname'],_0x28e13f[_0x5da9('0x17')],_0x28e13f[_0x5da9('0x18')]));_0x28e13f=_[_0x5da9('0x19')](_0x28e13f,{'transfererchannel':_0x28e13f[_0x5da9('0x1a')],'transferercalleridnum':_0x28e13f['origtransferercalleridnum'],'transferercalleridname':_0x28e13f[_0x5da9('0x1b')],'transfererconnectedlinenum':_0x28e13f[_0x5da9('0x1c')],'transfererconnectedlinename':_0x28e13f[_0x5da9('0x1d')],'transfereraccountcode':_0x28e13f['origtransfereraccountcode'],'transferercontext':_0x28e13f[_0x5da9('0x1e')],'transfererexten':_0x28e13f[_0x5da9('0x1f')],'transfererlinkedid':_0x28e13f[_0x5da9('0x20')],'context':_0x28e13f[_0x5da9('0x21')],'extension':_0x28e13f[_0x5da9('0x22')],'type':_0x5da9('0x23')});if(_['isNil'](_0x28e13f[_0x5da9('0x24')])){_0x28e13f=_[_0x5da9('0x19')](_0x28e13f,{'transfereechannel':_0x28e13f[_0x5da9('0x25')],'transfereecalleridnum':_0x28e13f[_0x5da9('0x17')],'transfereecalleridname':_0x28e13f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x28e13f[_0x5da9('0x26')],'transfereeconnectedlinename':_0x28e13f[_0x5da9('0x27')],'transfereeaccountcode':_0x28e13f[_0x5da9('0x28')],'transfereecontext':_0x28e13f[_0x5da9('0x29')],'transfereeexten':_0x28e13f['transfertargetexten'],'transfereelinkedid':_0x28e13f[_0x5da9('0x2a')]});}writeDB(_0x28e13f);}catch(_0x4718b8){utils['error'](util['format']('[%s][transfers][attendedtransfer]',_0x28e13f[_0x5da9('0x6')]),_0x4718b8);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 24c358f..15ec39a 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 _0x609d=['[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','../../config/logger','info','inspect','debug','then','[utils][request]\x20name:%s','catch','error','request','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','notfound','[utils][getUserByInternal]','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout'];(function(_0x5caa3f,_0x30de03){var _0x390078=function(_0x102d5d){while(--_0x102d5d){_0x5caa3f['push'](_0x5caa3f['shift']());}};_0x390078(++_0x30de03);}(_0x609d,0x8e));var _0xd609=function(_0x201043,_0x57e46b){_0x201043=_0x201043-0x0;var _0x29e5f2=_0x609d[_0x201043];return _0x29e5f2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xd609('0x0'));var moment=require(_0xd609('0x1'));var util=require(_0xd609('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0xd609('0x3'))('xdr');exports['info']=function(_0x48145e,_0x2e0bbb){logger[_0xd609('0x4')](_0x48145e,_0x2e0bbb?util[_0xd609('0x5')](_0x2e0bbb,{'showHidden':![],'depth':null}):'');};exports[_0xd609('0x6')]=function(_0x552b82,_0x3f5735){logger['debug'](_0x552b82,_0x3f5735?util[_0xd609('0x5')](_0x3f5735,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x9962ca,_0x47fa74){logger['error'](_0x9962ca,_0x47fa74?util[_0xd609('0x5')](_0x47fa74,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x389254,_0x137009){return client['request'](_0x389254,{'body':_0x137009})[_0xd609('0x7')](function(_0x4bd5df){logger['debug'](_0xd609('0x8'),_0x389254,_0x4bd5df?util[_0xd609('0x5')](_0x4bd5df,{'showHidden':![],'depth':null}):'');})[_0xd609('0x9')](function(_0x2e9d85){logger[_0xd609('0xa')]('[utils][request]\x20name:%s',_0x389254,_0x2e9d85?util[_0xd609('0x5')](_0x2e9d85,{'showHidden':![],'depth':null}):'');});};function getUser(_0x43bf48){return client[_0xd609('0xb')](_0xd609('0xc'),{'options':{'raw':!![],'attributes':['id',_0xd609('0xd'),_0xd609('0xe'),_0xd609('0xf')],'where':_0x43bf48,'limit':0x1}})[_0xd609('0x7')](function(_0x1f6208){logger[_0xd609('0x6')](_0xd609('0x10'),JSON[_0xd609('0x11')](_0x43bf48),_0x1f6208?util[_0xd609('0x5')](_0x1f6208,{'showHidden':![],'depth':null}):'');return _0x1f6208[_0xd609('0x12')][_0xd609('0x13')]?_0x1f6208['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x1ae87e){return new BPromise(function(_0xcc962b,_0x392ef9){if(_0x1ae87e){return getUser({'internal':_0x1ae87e})[_0xd609('0x7')](function(_0x2f2b11){logger[_0xd609('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x1ae87e,_0x2f2b11?'found':_0xd609('0x14'));return _0xcc962b(_0x2f2b11);})[_0xd609('0x9')](function(_0x516076){logger['error'](_0xd609('0x15'),_0x516076?util[_0xd609('0x5')](_0x516076,{'showHidden':![],'depth':null}):'');return _0xcc962b(null);});}return _0xcc962b(null);});};exports['getUserByInterface']=function(_0x446206){return new BPromise(function(_0x26ae97,_0x3d4f86){if(_0x446206){return getUser({'interface':_0x446206})[_0xd609('0x7')](function(_0x59231a){logger[_0xd609('0x4')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x446206,_0x59231a?_0xd609('0x16'):_0xd609('0x14'));return _0x26ae97(_0x59231a);})['catch'](function(_0xffbd35){logger[_0xd609('0xa')](_0xd609('0x17'),_0xffbd35?util[_0xd609('0x5')](_0xffbd35,{'showHidden':![],'depth':null}):'');return _0x26ae97(null);});}return _0x26ae97(null);});};exports['getUserByName']=function(_0x407248){return new BPromise(function(_0x3e9724,_0x37d8af){if(_0x407248){return getUser({'name':_0x407248})[_0xd609('0x7')](function(_0x1b5541){logger['info'](_0xd609('0x18'),_0x407248,_0x1b5541?_0xd609('0x16'):_0xd609('0x14'));return _0x3e9724(_0x1b5541);})[_0xd609('0x9')](function(_0x4cb4b8){logger[_0xd609('0xa')](_0xd609('0x19'),_0x4cb4b8?util['inspect'](_0x4cb4b8,{'showHidden':![],'depth':null}):'');return _0x3e9724(null);});}return _0x3e9724(null);});};exports['getVoiceQueueByName']=function(_0x48af24){return new BPromise(function(_0x7134f,_0xe0f643){if(_0x48af24){return client[_0xd609('0xb')](_0xd609('0x1a'),{'options':{'raw':!![],'attributes':['id',_0xd609('0xe'),_0xd609('0x1b'),_0xd609('0x1c'),_0xd609('0x1d')],'where':{'name':_0x48af24},'limit':0x1}})[_0xd609('0x7')](function(_0x4edffa){logger[_0xd609('0x6')](_0xd609('0x1e'),_0x48af24,_0x4edffa?util[_0xd609('0x5')](_0x4edffa,{'showHidden':![],'depth':null}):'');logger[_0xd609('0x4')](_0xd609('0x1f'),_0x48af24,_0x4edffa?'found':_0xd609('0x14'));return _0x7134f(_0x4edffa['result'][_0xd609('0x13')]?_0x4edffa[_0xd609('0x12')][0x0]:null);})[_0xd609('0x9')](function(_0x357e84){logger[_0xd609('0xa')]('[utils][getVoiceQueueByName]',_0x357e84?util['inspect'](_0x357e84,{'showHidden':![],'depth':null}):'');return _0x7134f(null);});}return _0x7134f(null);});};exports['addTime']=function(_0x726a9e,_0x16218c){return moment(_0x726a9e)[_0xd609('0x20')](_0x16218c,_0xd609('0x21'))[_0xd609('0x22')](_0xd609('0x23'));};exports[_0xd609('0x24')]=function(_0x5ba2ff,_0xbe2f38){return moment(_0x5ba2ff)[_0xd609('0x25')](_0xbe2f38,_0xd609('0x21'))[_0xd609('0x22')](_0xd609('0x23'));};exports['diffTime']=function(_0x399c92,_0x214fc0){return moment(_0x399c92)[_0xd609('0x26')](moment(_0x214fc0),_0xd609('0x21'));};exports[_0xd609('0x27')]=function(_0x3834af,_0x326be8){return parseInt(_0x3834af,0xa)+parseInt(_0x326be8,0xa);};exports[_0xd609('0x28')]=function(){return moment()[_0xd609('0x22')](_0xd609('0x23'));};exports[_0xd609('0x29')]=function(_0x5e2d2e,_0x35b10c){if(_0x35b10c){return moment(_0x5e2d2e)[_0xd609('0x29')](_0x35b10c);}return!![];};exports[_0xd609('0x2a')]=function(_0x33ffac,_0x20dd42){if(_0x20dd42){return moment(_0x33ffac)[_0xd609('0x2a')](_0x20dd42);}else if(_0x33ffac){return!![];}return![];}; \ No newline at end of file +var _0xa009=['subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xa009,0x13a));var _0x9a00=function(_0x524234,_0x42161c){_0x524234=_0x524234-0x0;var _0x5bc9aa=_0xa009[_0x524234];return _0x5bc9aa;};'use strict';var BPromise=require(_0x9a00('0x0'));var jayson=require(_0x9a00('0x1'));var moment=require(_0x9a00('0x2'));var util=require(_0x9a00('0x3'));var client=jayson[_0x9a00('0x4')][_0x9a00('0x5')]({'port':0x2329});var logger=require(_0x9a00('0x6'))(_0x9a00('0x7'));exports[_0x9a00('0x8')]=function(_0x399968,_0x398e60){logger[_0x9a00('0x8')](_0x399968,_0x398e60?util[_0x9a00('0x9')](_0x398e60,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x65e349,_0x583587){logger['debug'](_0x65e349,_0x583587?util[_0x9a00('0x9')](_0x583587,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x349e71,_0x1c2a64){logger[_0x9a00('0xa')](_0x349e71,_0x1c2a64?util[_0x9a00('0x9')](_0x1c2a64,{'showHidden':![],'depth':null}):'');};exports[_0x9a00('0xb')]=function(_0x5efffd,_0x30f41f){return client[_0x9a00('0xb')](_0x5efffd,{'body':_0x30f41f})[_0x9a00('0xc')](function(_0x12b120){logger[_0x9a00('0xd')](_0x9a00('0xe'),_0x5efffd,_0x12b120?util[_0x9a00('0x9')](_0x12b120,{'showHidden':![],'depth':null}):'');})[_0x9a00('0xf')](function(_0x909f19){logger['error']('[utils][request]\x20name:%s',_0x5efffd,_0x909f19?util[_0x9a00('0x9')](_0x909f19,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2354b0){return client[_0x9a00('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x9a00('0x10'),_0x9a00('0x11'),_0x9a00('0x12')],'where':_0x2354b0,'limit':0x1}})[_0x9a00('0xc')](function(_0x377c35){logger[_0x9a00('0xd')](_0x9a00('0x13'),JSON[_0x9a00('0x14')](_0x2354b0),_0x377c35?util[_0x9a00('0x9')](_0x377c35,{'showHidden':![],'depth':null}):'');return _0x377c35[_0x9a00('0x15')][_0x9a00('0x16')]?_0x377c35[_0x9a00('0x15')][0x0]:null;});}exports[_0x9a00('0x17')]=function(_0x2135de){return new BPromise(function(_0x2f8e71,_0x45dc48){if(_0x2135de){return getUser({'internal':_0x2135de})['then'](function(_0xf22f34){logger[_0x9a00('0x8')](_0x9a00('0x18'),_0x2135de,_0xf22f34?_0x9a00('0x19'):'notfound');return _0x2f8e71(_0xf22f34);})[_0x9a00('0xf')](function(_0x5e281a){logger[_0x9a00('0xa')](_0x9a00('0x1a'),_0x5e281a?util[_0x9a00('0x9')](_0x5e281a,{'showHidden':![],'depth':null}):'');return _0x2f8e71(null);});}return _0x2f8e71(null);});};exports[_0x9a00('0x1b')]=function(_0x3257b6){return new BPromise(function(_0x5b4009,_0x26fee2){if(_0x3257b6){return getUser({'interface':_0x3257b6})[_0x9a00('0xc')](function(_0x24669c){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x3257b6,_0x24669c?_0x9a00('0x19'):_0x9a00('0x1c'));return _0x5b4009(_0x24669c);})[_0x9a00('0xf')](function(_0x3ec4b2){logger[_0x9a00('0xa')]('[utils][getUserByInterface]',_0x3ec4b2?util[_0x9a00('0x9')](_0x3ec4b2,{'showHidden':![],'depth':null}):'');return _0x5b4009(null);});}return _0x5b4009(null);});};exports[_0x9a00('0x1d')]=function(_0x54ded5){return new BPromise(function(_0x46b59b,_0x553988){if(_0x54ded5){return getUser({'name':_0x54ded5})[_0x9a00('0xc')](function(_0x35f28f){logger[_0x9a00('0x8')](_0x9a00('0x1e'),_0x54ded5,_0x35f28f?'found':'notfound');return _0x46b59b(_0x35f28f);})[_0x9a00('0xf')](function(_0x183600){logger[_0x9a00('0xa')](_0x9a00('0x1f'),_0x183600?util[_0x9a00('0x9')](_0x183600,{'showHidden':![],'depth':null}):'');return _0x46b59b(null);});}return _0x46b59b(null);});};exports[_0x9a00('0x20')]=function(_0x4715cf){return new BPromise(function(_0x286d9d,_0x8be141){if(_0x4715cf){return client[_0x9a00('0xb')](_0x9a00('0x21'),{'options':{'raw':!![],'attributes':['id',_0x9a00('0x11'),_0x9a00('0x22'),_0x9a00('0x23'),'acwTimeout'],'where':{'name':_0x4715cf},'limit':0x1}})[_0x9a00('0xc')](function(_0x379ecf){logger[_0x9a00('0xd')](_0x9a00('0x24'),_0x4715cf,_0x379ecf?util[_0x9a00('0x9')](_0x379ecf,{'showHidden':![],'depth':null}):'');logger[_0x9a00('0x8')](_0x9a00('0x25'),_0x4715cf,_0x379ecf?'found':_0x9a00('0x1c'));return _0x286d9d(_0x379ecf['result'][_0x9a00('0x16')]?_0x379ecf['result'][0x0]:null);})['catch'](function(_0xaec00b){logger[_0x9a00('0xa')](_0x9a00('0x26'),_0xaec00b?util[_0x9a00('0x9')](_0xaec00b,{'showHidden':![],'depth':null}):'');return _0x286d9d(null);});}return _0x286d9d(null);});};exports[_0x9a00('0x27')]=function(_0x43b411,_0x28ce28){return moment(_0x43b411)[_0x9a00('0x28')](_0x28ce28,_0x9a00('0x29'))[_0x9a00('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9a00('0x2b')]=function(_0x1a206c,_0x3ada13){return moment(_0x1a206c)[_0x9a00('0x2c')](_0x3ada13,_0x9a00('0x29'))[_0x9a00('0x2a')](_0x9a00('0x2d'));};exports[_0x9a00('0x2e')]=function(_0x5edc6e,_0x5a5e44){return moment(_0x5edc6e)['diff'](moment(_0x5a5e44),_0x9a00('0x29'));};exports[_0x9a00('0x2f')]=function(_0x23b46f,_0x197fd5){return parseInt(_0x23b46f,0xa)+parseInt(_0x197fd5,0xa);};exports[_0x9a00('0x30')]=function(){return moment()[_0x9a00('0x2a')](_0x9a00('0x2d'));};exports['isAfter']=function(_0x2fb43c,_0x59696a){if(_0x59696a){return moment(_0x2fb43c)[_0x9a00('0x31')](_0x59696a);}return!![];};exports[_0x9a00('0x32')]=function(_0x512e83,_0x47c367){if(_0x47c367){return moment(_0x512e83)[_0x9a00('0x32')](_0x47c367);}else if(_0x512e83){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 1480986..446b4a6 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 _0x78ee=['./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','role','name','then','catch','user','no-user','data','client','error','auth','set','client-side-logger','use','isEmpty','\x20body=%s','body','format','method','headers','connection','remoteAddress','statusCode','responseTime','inspect','logger','device','agent_id','x-forwarded-for','url','other','setupLoggers','fs-extra','lodash','express-winston','path','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78ee,0x103));var _0xe78e=function(_0x4645b8,_0x324906){_0x4645b8=_0x4645b8-0x0;var _0x1c42db=_0x78ee[_0x4645b8];return _0x1c42db;};var fs=require(_0xe78e('0x0'));var _=require(_0xe78e('0x1'));var ewinston=require(_0xe78e('0x2'));var path=require(_0xe78e('0x3'));var util=require(_0xe78e('0x4'));var fileLogger=require(_0xe78e('0x5'))[_0xe78e('0x6')];var safeTemplate=require(_0xe78e('0x7'))[_0xe78e('0x8')];var maskSensitiveData=require(_0xe78e('0x9'))[_0xe78e('0xa')];function ClientSideLogger(){function _0xa9c5a8(_0x1e7dd){var _0x2f1ac6=path[_0xe78e('0xb')]('/var',_0xe78e('0xc'),'xcally');var _0x3bc1c9=path['join']('client',_0x1e7dd[_0xe78e('0xd')]+'-'+_0x1e7dd[_0xe78e('0xe')]);return fs['ensureDir'](path[_0xe78e('0xb')](_0x2f1ac6,_0x3bc1c9))[_0xe78e('0xf')](function(){var _0x90aee7=fileLogger('client',path[_0xe78e('0xb')](_0x2f1ac6,_0x3bc1c9));return _0x90aee7;})[_0xe78e('0x10')](function(_0x1b3732){throw _0x1b3732;});}this[_0xe78e('0xc')]=function(_0x5097bc,_0x446cb4,_0x407a79,_0x19d5c5){return _0xa9c5a8(_0x5097bc[_0xe78e('0x11')])['then'](function(_0x1de0dc){var _0x41b151=_0x1de0dc[_0x446cb4];return _0x41b151;})[_0xe78e('0xf')](function(_0x59ab04){var _0x108cc1=_0x5097bc[_0xe78e('0x11')]?_0x5097bc[_0xe78e('0x11')]['id']:_0xe78e('0x12');var _0x57cc0c=_0x19d5c5[_0xe78e('0x13')];var _0x1eb865=_0x19d5c5['timestamp'];var _0x27258c=new Date(Number(_0x1eb865));return _0x59ab04(_0x108cc1,_0x27258c,_0x407a79,_0x57cc0c);})[_0xe78e('0x10')](function(_0x219fca){fileLogger(_0xe78e('0x14'))[_0xe78e('0x15')](_0x219fca);});};}function setupLoggers(_0x4f5b34){return new Promise(function(_0x463e55){var _0x56ef7a=new ClientSideLogger();var _0x5783a5=fileLogger('api');var _0x55bb68=fileLogger(_0xe78e('0x16'));_0x4f5b34[_0xe78e('0x17')](_0xe78e('0x18'),_0x56ef7a);_0x4f5b34[_0xe78e('0x19')](ewinston['logger']({'winstonInstance':_0x5783a5,'meta':![],'statusLevels':!![],'msg':function(_0x3070c6,_0x41e63f){var _0x1b9c02='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xe78e('0x1a')](_0x3070c6['body'])){_0x1b9c02+=_0xe78e('0x1b');var _0x398a1e=_0x3070c6[_0xe78e('0x1c')];maskSensitiveData(_0x398a1e);}return safeTemplate(util[_0xe78e('0x1d')](_0x1b9c02,_0x3070c6[_0xe78e('0x1e')],_0x3070c6['headers']['x-forwarded-for']?_0x3070c6[_0xe78e('0x1f')]['x-forwarded-for']:_0x3070c6[_0xe78e('0x20')][_0xe78e('0x21')]||_0x3070c6['ip'],_0x3070c6['url'],_0x41e63f[_0xe78e('0x22')],_0x41e63f[_0xe78e('0x23')],_0x3070c6['user']?_0x3070c6[_0xe78e('0x11')]['id']:null,_0x3070c6[_0xe78e('0x11')]?_0x3070c6[_0xe78e('0x11')][_0xe78e('0xe')]:null,_0x3070c6[_0xe78e('0x11')]?_0x3070c6[_0xe78e('0x11')][_0xe78e('0xd')]:null,_0x398a1e?util[_0xe78e('0x24')](_0x398a1e,![],null):''));}}));_0x4f5b34[_0xe78e('0x19')](ewinston[_0xe78e('0x25')]({'winstonInstance':_0x55bb68,'meta':![],'statusLevels':!![],'msg':function(_0x21c69c,_0x3e0d63){var _0x2d6e29='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x21c69c[_0xe78e('0x1c')]&&_0x21c69c[_0xe78e('0x1c')][_0xe78e('0x26')]&&_0x21c69c['body'][_0xe78e('0x27')]){_0x2d6e29='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xe78e('0x1d')](_0x2d6e29,_0x21c69c[_0xe78e('0x1e')],_0x21c69c['headers'][_0xe78e('0x28')]?_0x21c69c[_0xe78e('0x1f')][_0xe78e('0x28')]:_0x21c69c[_0xe78e('0x20')][_0xe78e('0x21')]||_0x21c69c['ip'],_0x21c69c[_0xe78e('0x29')],_0x3e0d63['statusCode'],_0x3e0d63['responseTime'],_0x21c69c['user']?_0x21c69c['user']['id']:null,_0x21c69c[_0xe78e('0x11')]?_0x21c69c[_0xe78e('0x11')]['name']:null,_0x21c69c[_0xe78e('0x11')]?_0x21c69c['user']['role']:null,_0x21c69c[_0xe78e('0x1c')]&&_0x21c69c[_0xe78e('0x1c')]['device']?_0x21c69c[_0xe78e('0x1c')][_0xe78e('0x26')]:_0xe78e('0x2a'),_0x21c69c['body']&&_0x21c69c['body'][_0xe78e('0x27')]?_0x21c69c[_0xe78e('0x1c')][_0xe78e('0x27')]:'',_0x21c69c['body']&&_0x21c69c['body']['agent_name']?_0x21c69c[_0xe78e('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x59e548){var _0x1a5549=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a5549['test'](_0x59e548[_0xe78e('0x29')]);}}));return _0x463e55();});}exports[_0xe78e('0x2b')]=setupLoggers; \ No newline at end of file +var _0xdd07=['maskSensitiveData','/var','xcally','join','client','role','name','ensureDir','then','log','user','no-user','timestamp','catch','error','api','auth','set','client-side-logger','use','logger','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','responseTime','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','statusCode','other','agent_name','test','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data'];(function(_0x23ffba,_0x3ab025){var _0x2c7805=function(_0x24ad1e){while(--_0x24ad1e){_0x23ffba['push'](_0x23ffba['shift']());}};_0x2c7805(++_0x3ab025);}(_0xdd07,0x147));var _0x7dd0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xdd07[_0x160c73];return _0xd9302;};var fs=require(_0x7dd0('0x0'));var _=require(_0x7dd0('0x1'));var ewinston=require(_0x7dd0('0x2'));var path=require(_0x7dd0('0x3'));var util=require(_0x7dd0('0x4'));var fileLogger=require(_0x7dd0('0x5'))['fileLogger'];var safeTemplate=require(_0x7dd0('0x6'))[_0x7dd0('0x7')];var maskSensitiveData=require(_0x7dd0('0x8'))[_0x7dd0('0x9')];function ClientSideLogger(){function _0x37a2bb(_0x11f36c){var _0x809152=path['join'](_0x7dd0('0xa'),'log',_0x7dd0('0xb'));var _0x3000c0=path[_0x7dd0('0xc')](_0x7dd0('0xd'),_0x11f36c[_0x7dd0('0xe')]+'-'+_0x11f36c[_0x7dd0('0xf')]);return fs[_0x7dd0('0x10')](path[_0x7dd0('0xc')](_0x809152,_0x3000c0))[_0x7dd0('0x11')](function(){var _0x47148=fileLogger(_0x7dd0('0xd'),path['join'](_0x809152,_0x3000c0));return _0x47148;})['catch'](function(_0x77e1b5){throw _0x77e1b5;});}this[_0x7dd0('0x12')]=function(_0x1f39e6,_0x3ab086,_0x58f18c,_0x595248){return _0x37a2bb(_0x1f39e6['user'])['then'](function(_0x248fd7){var _0x1d3c61=_0x248fd7[_0x3ab086];return _0x1d3c61;})[_0x7dd0('0x11')](function(_0x4682b8){var _0x582219=_0x1f39e6[_0x7dd0('0x13')]?_0x1f39e6[_0x7dd0('0x13')]['id']:_0x7dd0('0x14');var _0x5145ed=_0x595248['data'];var _0x44e980=_0x595248[_0x7dd0('0x15')];var _0x2f81d2=new Date(Number(_0x44e980));return _0x4682b8(_0x582219,_0x2f81d2,_0x58f18c,_0x5145ed);})[_0x7dd0('0x16')](function(_0x344388){fileLogger(_0x7dd0('0xd'))[_0x7dd0('0x17')](_0x344388);});};}function setupLoggers(_0x56f2cf){return new Promise(function(_0x3b3405){var _0x2bf770=new ClientSideLogger();var _0x496e7e=fileLogger(_0x7dd0('0x18'));var _0x566919=fileLogger(_0x7dd0('0x19'));_0x56f2cf[_0x7dd0('0x1a')](_0x7dd0('0x1b'),_0x2bf770);_0x56f2cf[_0x7dd0('0x1c')](ewinston[_0x7dd0('0x1d')]({'winstonInstance':_0x496e7e,'meta':![],'statusLevels':!![],'msg':function(_0xce53db,_0x1a133d){var _0x599db9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x7dd0('0x1e')](_0xce53db['body'])){_0x599db9+='\x20body=%s';var _0x11f1ac=_0xce53db[_0x7dd0('0x1f')];maskSensitiveData(_0x11f1ac);}return safeTemplate(util[_0x7dd0('0x20')](_0x599db9,_0xce53db[_0x7dd0('0x21')],_0xce53db[_0x7dd0('0x22')][_0x7dd0('0x23')]?_0xce53db[_0x7dd0('0x22')][_0x7dd0('0x23')]:_0xce53db[_0x7dd0('0x24')][_0x7dd0('0x25')]||_0xce53db['ip'],_0xce53db['url'],_0x1a133d['statusCode'],_0x1a133d[_0x7dd0('0x26')],_0xce53db[_0x7dd0('0x13')]?_0xce53db[_0x7dd0('0x13')]['id']:null,_0xce53db[_0x7dd0('0x13')]?_0xce53db['user']['name']:null,_0xce53db[_0x7dd0('0x13')]?_0xce53db[_0x7dd0('0x13')][_0x7dd0('0xe')]:null,_0x11f1ac?util[_0x7dd0('0x27')](_0x11f1ac,![],null):''));}}));_0x56f2cf['use'](ewinston[_0x7dd0('0x1d')]({'winstonInstance':_0x566919,'meta':![],'statusLevels':!![],'msg':function(_0x4d80b8,_0x263076){var _0x2c7e78='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4d80b8[_0x7dd0('0x1f')]&&_0x4d80b8[_0x7dd0('0x1f')][_0x7dd0('0x28')]&&_0x4d80b8[_0x7dd0('0x1f')][_0x7dd0('0x29')]){_0x2c7e78=_0x7dd0('0x2a');}return util['format'](_0x2c7e78,_0x4d80b8['method'],_0x4d80b8[_0x7dd0('0x22')]['x-forwarded-for']?_0x4d80b8[_0x7dd0('0x22')][_0x7dd0('0x23')]:_0x4d80b8[_0x7dd0('0x24')][_0x7dd0('0x25')]||_0x4d80b8['ip'],_0x4d80b8[_0x7dd0('0x2b')],_0x263076[_0x7dd0('0x2c')],_0x263076[_0x7dd0('0x26')],_0x4d80b8['user']?_0x4d80b8['user']['id']:null,_0x4d80b8['user']?_0x4d80b8[_0x7dd0('0x13')][_0x7dd0('0xf')]:null,_0x4d80b8['user']?_0x4d80b8['user'][_0x7dd0('0xe')]:null,_0x4d80b8['body']&&_0x4d80b8[_0x7dd0('0x1f')][_0x7dd0('0x28')]?_0x4d80b8[_0x7dd0('0x1f')]['device']:_0x7dd0('0x2d'),_0x4d80b8[_0x7dd0('0x1f')]&&_0x4d80b8[_0x7dd0('0x1f')]['agent_id']?_0x4d80b8['body'][_0x7dd0('0x29')]:'',_0x4d80b8[_0x7dd0('0x1f')]&&_0x4d80b8[_0x7dd0('0x1f')][_0x7dd0('0x2e')]?_0x4d80b8[_0x7dd0('0x1f')][_0x7dd0('0x2e')]:'');},'ignoreRoute':function(_0x518593){var _0x18a3ed=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x18a3ed[_0x7dd0('0x2f')](_0x518593[_0x7dd0('0x2b')]);}}));return _0x3b3405();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 324c9eb..a908258 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f4e=['info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','Console','warn','Logger','transports','File','%s-%s','error','consoleLogger','path','util','moment','winston','../config/environment','toLowerCase'];(function(_0x516d9c,_0x2979d0){var _0x2ee516=function(_0xaeff01){while(--_0xaeff01){_0x516d9c['push'](_0x516d9c['shift']());}};_0x2ee516(++_0x2979d0);}(_0x0f4e,0xc7));var _0xe0f4=function(_0x3d0a87,_0x5654a0){_0x3d0a87=_0x3d0a87-0x0;var _0xe5659e=_0x0f4e[_0x3d0a87];return _0xe5659e;};'use strict';var path=require(_0xe0f4('0x0'));var util=require(_0xe0f4('0x1'));var moment=require(_0xe0f4('0x2'));var winston=require(_0xe0f4('0x3'));var config=require(_0xe0f4('0x4'));var debugLevel=config['debugLevel']?config['debugLevel'][_0xe0f4('0x5')]():_0xe0f4('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xe0f4('0x7'),'error':_0xe0f4('0x8'),'warn':_0xe0f4('0x9'),'info':_0xe0f4('0xa'),'print':_0xe0f4('0xb'),'success':_0xe0f4('0xc'),'http':_0xe0f4('0xd'),'verbose':_0xe0f4('0xe'),'debug':_0xe0f4('0xf'),'silly':_0xe0f4('0x10')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x176662,_0x52b97e,_0x19613b){var _0x2e507f=_0x176662||_0xe0f4('0x11');return path[_0xe0f4('0x12')](_0x2e507f,util[_0xe0f4('0x13')](_0xe0f4('0x14'),_0x52b97e,_0x19613b));}function formatter(_0x5dd104,_0x2ec6c2){_0x2ec6c2[_0xe0f4('0x15')]=_0x2ec6c2[_0xe0f4('0x15')]['replace'](/@@{/g,_0xe0f4('0x16'))[_0xe0f4('0x17')](/}@@/g,_0xe0f4('0x18'))[_0xe0f4('0x17')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xe0f4('0x13')](_0xe0f4('0x19'),moment()[_0xe0f4('0x13')](_0xe0f4('0x1a')),_0x2ec6c2[_0xe0f4('0x1b')][_0xe0f4('0x1c')](),_0x5dd104,_0x2ec6c2[_0xe0f4('0x15')]);}function fileFormat(_0x4dd331,_0x123a35){_0x123a35['message']=_0x123a35[_0xe0f4('0x15')][_0xe0f4('0x17')](/@@{/g,_0xe0f4('0x16'))[_0xe0f4('0x17')](/}@@/g,'}}}')[_0xe0f4('0x17')](/@{/g,'{{')[_0xe0f4('0x17')](/}@/g,'}}');var _0x46bf38=_0x123a35['meta']&&Object[_0xe0f4('0x1d')](_0x123a35[_0xe0f4('0x1e')])[_0xe0f4('0x1f')]?'\x0a\x09'+JSON[_0xe0f4('0x20')](_0x123a35['meta']):'';return util[_0xe0f4('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xe0f4('0x13')](_0xe0f4('0x1a')),_0x123a35[_0xe0f4('0x1b')][_0xe0f4('0x1c')](),_0x4dd331,_0x123a35[_0xe0f4('0x15')],_0x46bf38);}function consoleLogger(){var _0x398739=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xe0f4('0x21'))]({'level':_0xe0f4('0x22'),'json':![],'formatter':function(_0x12de2b){return formatter('',_0x12de2b);}})]});return _0x398739;}function fileLogger(_0x4ddf81,_0x2c2005){var _0x5c2584=new winston[(_0xe0f4('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe0f4('0x24'))][(_0xe0f4('0x25'))]({'name':util[_0xe0f4('0x13')](_0xe0f4('0x26'),_0x4ddf81,_0xe0f4('0x27')),'filename':getLogFileName(_0x2c2005,_0x4ddf81,'error'),'level':_0xe0f4('0x27'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x39e05d){return fileFormat(_0x4ddf81,_0x39e05d);}}),new winston['transports']['File']({'name':util[_0xe0f4('0x13')]('%s-%s',_0x4ddf81,debugLevel),'filename':getLogFileName(_0x2c2005,_0x4ddf81,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5e1beb){return fileFormat(_0x4ddf81,_0x5e1beb);}}),new winston['transports'][(_0xe0f4('0x21'))]({'level':'warn','json':![],'formatter':function(_0x10868){return fileFormat(_0x4ddf81,_0x10868);}})]});return _0x5c2584;}exports[_0xe0f4('0x28')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x2a0e=['replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Console','Logger','transports','File','%s-%s','error','warn','consoleLogger','path','util','winston','debugLevel','toLowerCase','red','bold\x20yellow','white','bold\x20white','bold\x20blue','bold\x20cyan','addColors','message'];(function(_0x4ead2d,_0x49860c){var _0x1e143e=function(_0x3b22d9){while(--_0x3b22d9){_0x4ead2d['push'](_0x4ead2d['shift']());}};_0x1e143e(++_0x49860c);}(_0x2a0e,0xf3));var _0xe2a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a0e[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0xe2a0('0x0'));var util=require(_0xe2a0('0x1'));var moment=require('moment');var winston=require(_0xe2a0('0x2'));var config=require('../config/environment');var debugLevel=config[_0xe2a0('0x3')]?config['debugLevel'][_0xe2a0('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xe2a0('0x5'),'warn':_0xe2a0('0x6'),'info':_0xe2a0('0x7'),'print':_0xe2a0('0x8'),'success':'bold\x20green','http':'gray','verbose':'bold\x20magenta','debug':_0xe2a0('0x9'),'silly':_0xe2a0('0xa')};winston[_0xe2a0('0xb')](XC_LOG_COLORS);function getLogFileName(_0x54edf2,_0x17daab,_0x2b4f8c){var _0x2c6327=_0x54edf2||'/var/log/xcally';return path['join'](_0x2c6327,util['format']('%s-%s.log',_0x17daab,_0x2b4f8c));}function formatter(_0x3f4d3b,_0x33498b){_0x33498b[_0xe2a0('0xc')]=_0x33498b['message'][_0xe2a0('0xd')](/@@{/g,'{{{')['replace'](/}@@/g,_0xe2a0('0xe'))['replace'](/@{/g,'{{')[_0xe2a0('0xd')](/}@/g,'}}');return util[_0xe2a0('0xf')](_0xe2a0('0x10'),moment()['format'](_0xe2a0('0x11')),_0x33498b[_0xe2a0('0x12')][_0xe2a0('0x13')](),_0x3f4d3b,_0x33498b[_0xe2a0('0xc')]);}function fileFormat(_0x359305,_0x4566ba){_0x4566ba[_0xe2a0('0xc')]=_0x4566ba[_0xe2a0('0xc')]['replace'](/@@{/g,_0xe2a0('0x14'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xe2a0('0xd')](/}@/g,'}}');var _0x2c7ae8=_0x4566ba[_0xe2a0('0x15')]&&Object[_0xe2a0('0x16')](_0x4566ba[_0xe2a0('0x15')])['length']?'\x0a\x09'+JSON['stringify'](_0x4566ba[_0xe2a0('0x15')]):'';return util[_0xe2a0('0xf')](_0xe2a0('0x17'),moment()[_0xe2a0('0xf')](_0xe2a0('0x11')),_0x4566ba[_0xe2a0('0x12')]['toUpperCase'](),_0x359305,_0x4566ba[_0xe2a0('0xc')],_0x2c7ae8);}function consoleLogger(){var _0x10f1a9=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xe2a0('0x18'))]({'level':'warn','json':![],'formatter':function(_0x7f5864){return formatter('',_0x7f5864);}})]});return _0x10f1a9;}function fileLogger(_0xba6ee5,_0x5f1339){var _0xd029=new winston[(_0xe2a0('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe2a0('0x1a'))][(_0xe2a0('0x1b'))]({'name':util[_0xe2a0('0xf')](_0xe2a0('0x1c'),_0xba6ee5,_0xe2a0('0x1d')),'filename':getLogFileName(_0x5f1339,_0xba6ee5,_0xe2a0('0x1d')),'level':_0xe2a0('0x1d'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58e326){return fileFormat(_0xba6ee5,_0x58e326);}}),new winston[(_0xe2a0('0x1a'))][(_0xe2a0('0x1b'))]({'name':util['format'](_0xe2a0('0x1c'),_0xba6ee5,debugLevel),'filename':getLogFileName(_0x5f1339,_0xba6ee5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1aeaae){return fileFormat(_0xba6ee5,_0x1aeaae);}}),new winston['transports'][(_0xe2a0('0x18'))]({'level':_0xe2a0('0x1e'),'json':![],'formatter':function(_0x180248){return fileFormat(_0xba6ee5,_0x180248);}})]});return _0xd029;}exports[_0xe2a0('0x1f')]=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 aa19880..7a92174 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 _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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdb28,0x106));var _0x8db2=function(_0x43aadb,_0x1ecbc8){_0x43aadb=_0x43aadb-0x0;var _0xdefe69=_0xdb28[_0x43aadb];return _0xdefe69;};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 +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x1a85,0x178));var _0x51a8=function(_0x27ab58,_0x48c638){_0x27ab58=_0x27ab58-0x0;var _0x3daff0=_0x1a85[_0x27ab58];return _0x3daff0;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 0329f53..f997592 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 _0x0598=['exports','safeTemplate','lodash','\x20}\x20}','string','replace','isPlainObject','keys'];(function(_0x25fe03,_0x5097a1){var _0x4b35ed=function(_0x45afe6){while(--_0x45afe6){_0x25fe03['push'](_0x25fe03['shift']());}};_0x4b35ed(++_0x5097a1);}(_0x0598,0x92));var _0x8059=function(_0x44e0ee,_0x1f0ae4){_0x44e0ee=_0x44e0ee-0x0;var _0x2f14f6=_0x0598[_0x44e0ee];return _0x2f14f6;};var _=require(_0x8059('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x8f4b1){return _0x8f4b1==='{{'?'{\x20{\x20':_0x8059('0x1');}function safeTemplate(_0x52c9bf){var _0x4dad54=_0x52c9bf;if(typeof _0x52c9bf===_0x8059('0x2')){_0x4dad54=_0x52c9bf[_0x8059('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x52c9bf)){_0x4dad54=_0x52c9bf['map'](function(_0x555fb5){return safeTemplate(_0x555fb5);});}else if(_[_0x8059('0x4')](_0x52c9bf)){_0x4dad54=Object[_0x8059('0x5')](_0x52c9bf)['reduce'](function(_0x5996d7,_0x248273){_0x5996d7[_0x248273]=safeTemplate(_0x52c9bf[_0x248273]);return _0x5996d7;},{});}return _0x4dad54;}module[_0x8059('0x6')][_0x8059('0x7')]=safeTemplate; \ No newline at end of file +var _0xf7b4=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}'];(function(_0x570809,_0x3a04b8){var _0x317a7e=function(_0x3d5499){while(--_0x3d5499){_0x570809['push'](_0x570809['shift']());}};_0x317a7e(++_0x3a04b8);}(_0xf7b4,0x152));var _0x4f7b=function(_0x1479c8,_0x3da7b3){_0x1479c8=_0x1479c8-0x0;var _0x44ec73=_0xf7b4[_0x1479c8];return _0x44ec73;};var _=require(_0x4f7b('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5579ed){return _0x5579ed==='{{'?'{\x20{\x20':_0x4f7b('0x1');}function safeTemplate(_0x103165){var _0x50ea23=_0x103165;if(typeof _0x103165==='string'){_0x50ea23=_0x103165[_0x4f7b('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4f7b('0x3')](_0x103165)){_0x50ea23=_0x103165[_0x4f7b('0x4')](function(_0x44f991){return safeTemplate(_0x44f991);});}else if(_[_0x4f7b('0x5')](_0x103165)){_0x50ea23=Object[_0x4f7b('0x6')](_0x103165)[_0x4f7b('0x7')](function(_0x3ad135,_0x173784){_0x3ad135[_0x173784]=safeTemplate(_0x103165[_0x173784]);return _0x3ad135;},{});}return _0x50ea23;}module[_0x4f7b('0x8')][_0x4f7b('0x9')]=safeTemplate; \ No newline at end of file